aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/Kconfig2
-rw-r--r--arch/alpha/include/asm/atomic.h9
-rw-r--r--arch/alpha/include/asm/io.h3
-rw-r--r--arch/alpha/include/asm/smp.h1
-rw-r--r--arch/alpha/include/asm/topology.h17
-rw-r--r--arch/alpha/kernel/Makefile2
-rw-r--r--arch/alpha/kernel/asm-offsets.c11
-rw-r--r--arch/alpha/kernel/binfmt_loader.c51
-rw-r--r--arch/alpha/kernel/entry.S10
-rw-r--r--arch/alpha/kernel/init_task.c1
-rw-r--r--arch/alpha/kernel/irq.c5
-rw-r--r--arch/alpha/kernel/process.c2
-rw-r--r--arch/alpha/kernel/setup.c5
-rw-r--r--arch/alpha/kernel/smp.c7
-rw-r--r--arch/alpha/kernel/sys_dp264.c8
-rw-r--r--arch/alpha/kernel/sys_titan.c4
-rw-r--r--arch/arm/Kconfig73
-rw-r--r--arch/arm/Makefile7
-rw-r--r--arch/arm/boot/compressed/Makefile4
-rw-r--r--arch/arm/boot/compressed/head-clps7500.S86
-rw-r--r--arch/arm/boot/compressed/head.S20
-rw-r--r--arch/arm/boot/compressed/misc.c2
-rw-r--r--arch/arm/common/Kconfig3
-rw-r--r--arch/arm/common/Makefile1
-rw-r--r--arch/arm/common/clkdev.c128
-rw-r--r--arch/arm/common/gic.c4
-rw-r--r--arch/arm/common/locomo.c1
-rw-r--r--arch/arm/common/vic.c8
-rw-r--r--arch/arm/configs/eseries_pxa_defconfig326
-rw-r--r--arch/arm/configs/h5000_defconfig996
-rw-r--r--arch/arm/configs/kirkwood_defconfig329
-rw-r--r--arch/arm/configs/ks8695_defconfig707
-rw-r--r--arch/arm/configs/mx31moboard_defconfig790
-rw-r--r--arch/arm/configs/mx31pdk_defconfig773
-rw-r--r--arch/arm/configs/neocore926_defconfig1302
-rw-r--r--arch/arm/configs/netx_defconfig6
-rw-r--r--arch/arm/configs/omap3_pandora_defconfig1409
-rw-r--r--arch/arm/configs/omap_ldp_defconfig148
-rw-r--r--arch/arm/configs/picotux200_defconfig6
-rw-r--r--arch/arm/configs/realview-smp_defconfig718
-rw-r--r--arch/arm/configs/realview_defconfig763
-rw-r--r--arch/arm/configs/s3c6400_defconfig845
-rw-r--r--arch/arm/configs/w90p910_defconfig626
-rw-r--r--arch/arm/include/asm/atomic.h3
-rw-r--r--arch/arm/include/asm/cacheflush.h37
-rw-r--r--arch/arm/include/asm/clkdev.h30
-rw-r--r--arch/arm/include/asm/dma-mapping.h4
-rw-r--r--arch/arm/include/asm/dma.h24
-rw-r--r--arch/arm/include/asm/hardware/iomd.h41
-rw-r--r--arch/arm/include/asm/hardware/vic.h10
-rw-r--r--arch/arm/include/asm/hwcap.h1
-rw-r--r--arch/arm/include/asm/io.h8
-rw-r--r--arch/arm/include/asm/irq.h4
-rw-r--r--arch/arm/include/asm/memory.h7
-rw-r--r--arch/arm/include/asm/mmu_context.h1
-rw-r--r--arch/arm/include/asm/mtd-xip.h1
-rw-r--r--arch/arm/include/asm/page.h32
-rw-r--r--arch/arm/include/asm/processor.h2
-rw-r--r--arch/arm/include/asm/setup.h6
-rw-r--r--arch/arm/include/asm/smp.h6
-rw-r--r--arch/arm/include/asm/string.h9
-rw-r--r--arch/arm/include/asm/system.h2
-rw-r--r--arch/arm/include/asm/uaccess.h5
-rw-r--r--arch/arm/kernel/armksyms.c1
-rw-r--r--arch/arm/kernel/ecard.c2
-rw-r--r--arch/arm/kernel/ftrace.c2
-rw-r--r--arch/arm/kernel/head-common.S2
-rw-r--r--arch/arm/kernel/init_task.c1
-rw-r--r--arch/arm/kernel/irq.c2
-rw-r--r--arch/arm/kernel/kprobes.c2
-rw-r--r--arch/arm/kernel/module.c4
-rw-r--r--arch/arm/kernel/setup.c57
-rw-r--r--arch/arm/kernel/smp.c14
-rw-r--r--arch/arm/kernel/thumbee.c2
-rw-r--r--arch/arm/kernel/vmlinux.lds.S2
-rw-r--r--arch/arm/lib/Makefile1
-rw-r--r--arch/arm/lib/memset.S2
-rw-r--r--arch/arm/mach-aaec2000/Makefile2
-rw-r--r--arch/arm/mach-aaec2000/clock.c99
-rw-r--r--arch/arm/mach-aaec2000/clock.h23
-rw-r--r--arch/arm/mach-aaec2000/core.c31
-rw-r--r--arch/arm/mach-aaec2000/include/mach/dma.h9
-rw-r--r--arch/arm/mach-aaec2000/include/mach/io.h6
-rw-r--r--arch/arm/mach-aaec2000/include/mach/memory.h3
-rw-r--r--arch/arm/mach-at91/Kconfig15
-rw-r--r--arch/arm/mach-at91/Makefile13
-rw-r--r--arch/arm/mach-at91/at91cap9.c8
-rw-r--r--arch/arm/mach-at91/at91cap9_devices.c36
-rw-r--r--arch/arm/mach-at91/at91rm9200_time.c12
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c38
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c17
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c17
-rw-r--r--arch/arm/mach-at91/at91sam926x_time.c2
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c11
-rw-r--r--arch/arm/mach-at91/board-cam60.c30
-rw-r--r--arch/arm/mach-at91/board-cap9adk.c77
-rw-r--r--arch/arm/mach-at91/board-neocore926.c397
-rw-r--r--arch/arm/mach-at91/board-qil-a9260.c35
-rw-r--r--arch/arm/mach-at91/board-sam9-l9260.c35
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c37
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c80
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c36
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c36
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c32
-rw-r--r--arch/arm/mach-at91/board-usb-a9260.c35
-rw-r--r--arch/arm/mach-at91/board-usb-a9263.c36
-rw-r--r--arch/arm/mach-at91/include/mach/at91_pmc.h7
-rw-r--r--arch/arm/mach-at91/include/mach/at91cap9.h4
-rw-r--r--arch/arm/mach-at91/include/mach/cpu.h15
-rw-r--r--arch/arm/mach-at91/include/mach/dma.h19
-rw-r--r--arch/arm/mach-at91/include/mach/io.h4
-rw-r--r--arch/arm/mach-at91/include/mach/memory.h11
-rw-r--r--arch/arm/mach-at91/sam9_smc.c47
-rw-r--r--arch/arm/mach-at91/sam9_smc.h33
-rw-r--r--arch/arm/mach-clps711x/include/mach/dma.h19
-rw-r--r--arch/arm/mach-clps711x/include/mach/io.h6
-rw-r--r--arch/arm/mach-clps711x/include/mach/memory.h20
-rw-r--r--arch/arm/mach-clps7500/Makefile11
-rw-r--r--arch/arm/mach-clps7500/Makefile.boot2
-rw-r--r--arch/arm/mach-clps7500/core.c395
-rw-r--r--arch/arm/mach-clps7500/include/mach/acornfb.h33
-rw-r--r--arch/arm/mach-clps7500/include/mach/debug-macro.S21
-rw-r--r--arch/arm/mach-clps7500/include/mach/dma.h21
-rw-r--r--arch/arm/mach-clps7500/include/mach/entry-macro.S16
-rw-r--r--arch/arm/mach-clps7500/include/mach/hardware.h67
-rw-r--r--arch/arm/mach-clps7500/include/mach/io.h255
-rw-r--r--arch/arm/mach-clps7500/include/mach/irq.h32
-rw-r--r--arch/arm/mach-clps7500/include/mach/irqs.h66
-rw-r--r--arch/arm/mach-clps7500/include/mach/memory.h43
-rw-r--r--arch/arm/mach-clps7500/include/mach/system.h23
-rw-r--r--arch/arm/mach-clps7500/include/mach/timex.h13
-rw-r--r--arch/arm/mach-clps7500/include/mach/uncompress.h35
-rw-r--r--arch/arm/mach-clps7500/include/mach/vmalloc.h4
-rw-r--r--arch/arm/mach-davinci/include/mach/dma.h16
-rw-r--r--arch/arm/mach-davinci/include/mach/io.h3
-rw-r--r--arch/arm/mach-davinci/include/mach/memory.h7
-rw-r--r--arch/arm/mach-davinci/include/mach/vmalloc.h1
-rw-r--r--arch/arm/mach-davinci/time.c2
-rw-r--r--arch/arm/mach-ebsa110/include/mach/dma.h11
-rw-r--r--arch/arm/mach-ebsa110/include/mach/memory.h7
-rw-r--r--arch/arm/mach-ep93xx/Kconfig6
-rw-r--r--arch/arm/mach-ep93xx/Makefile1
-rw-r--r--arch/arm/mach-ep93xx/adssphere.c7
-rw-r--r--arch/arm/mach-ep93xx/clock.c68
-rw-r--r--arch/arm/mach-ep93xx/core.c46
-rw-r--r--arch/arm/mach-ep93xx/edb9302.c7
-rw-r--r--arch/arm/mach-ep93xx/edb9302a.c9
-rw-r--r--arch/arm/mach-ep93xx/edb9307.c9
-rw-r--r--arch/arm/mach-ep93xx/edb9307a.c68
-rw-r--r--arch/arm/mach-ep93xx/edb9312.c9
-rw-r--r--arch/arm/mach-ep93xx/edb9315.c9
-rw-r--r--arch/arm/mach-ep93xx/edb9315a.c9
-rw-r--r--arch/arm/mach-ep93xx/gesbc9312.c7
-rw-r--r--arch/arm/mach-ep93xx/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-ep93xx/include/mach/dma.h3
-rw-r--r--arch/arm/mach-ep93xx/include/mach/gpio.h2
-rw-r--r--arch/arm/mach-ep93xx/include/mach/io.h4
-rw-r--r--arch/arm/mach-ep93xx/include/mach/memory.h4
-rw-r--r--arch/arm/mach-ep93xx/include/mach/platform.h1
-rw-r--r--arch/arm/mach-ep93xx/micro9.c89
-rw-r--r--arch/arm/mach-ep93xx/ts72xx.c21
-rw-r--r--arch/arm/mach-footbridge/cats-hw.c1
-rw-r--r--arch/arm/mach-footbridge/common.c1
-rw-r--r--arch/arm/mach-footbridge/dc21285-timer.c1
-rw-r--r--arch/arm/mach-footbridge/dc21285.c1
-rw-r--r--arch/arm/mach-footbridge/dma.c1
-rw-r--r--arch/arm/mach-footbridge/ebsa285.c1
-rw-r--r--arch/arm/mach-footbridge/include/mach/hardware.h14
-rw-r--r--arch/arm/mach-footbridge/include/mach/io.h3
-rw-r--r--arch/arm/mach-footbridge/include/mach/isa-dma.h (renamed from arch/arm/mach-footbridge/include/mach/dma.h)2
-rw-r--r--arch/arm/mach-footbridge/include/mach/memory.h9
-rw-r--r--arch/arm/mach-footbridge/isa-irq.c1
-rw-r--r--arch/arm/mach-footbridge/netwinder-hw.c54
-rw-r--r--arch/arm/mach-footbridge/netwinder-leds.c7
-rw-r--r--arch/arm/mach-footbridge/personal.c1
-rw-r--r--arch/arm/mach-h720x/include/mach/io.h4
-rw-r--r--arch/arm/mach-h720x/include/mach/isa-dma.h (renamed from arch/arm/mach-h720x/include/mach/dma.h)9
-rw-r--r--arch/arm/mach-h720x/include/mach/memory.h20
-rw-r--r--arch/arm/mach-imx/dma.c7
-rw-r--r--arch/arm/mach-imx/include/mach/imx-dma.h12
-rw-r--r--arch/arm/mach-imx/include/mach/imxfb.h50
-rw-r--r--arch/arm/mach-imx/include/mach/io.h4
-rw-r--r--arch/arm/mach-imx/include/mach/memory.h10
-rw-r--r--arch/arm/mach-imx/time.c2
-rw-r--r--arch/arm/mach-integrator/clock.c80
-rw-r--r--arch/arm/mach-integrator/clock.h25
-rw-r--r--arch/arm/mach-integrator/core.c45
-rw-r--r--arch/arm/mach-integrator/impd1.c26
-rw-r--r--arch/arm/mach-integrator/include/mach/clkdev.h25
-rw-r--r--arch/arm/mach-integrator/include/mach/memory.h13
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c24
-rw-r--r--arch/arm/mach-iop13xx/include/mach/dma.h3
-rw-r--r--arch/arm/mach-iop13xx/include/mach/memory.h16
-rw-r--r--arch/arm/mach-iop13xx/include/mach/timex.h2
-rw-r--r--arch/arm/mach-iop32x/include/mach/dma.h9
-rw-r--r--arch/arm/mach-iop32x/include/mach/io.h2
-rw-r--r--arch/arm/mach-iop32x/include/mach/memory.h13
-rw-r--r--arch/arm/mach-iop32x/include/mach/system.h3
-rw-r--r--arch/arm/mach-iop32x/include/mach/timex.h3
-rw-r--r--arch/arm/mach-iop33x/include/mach/dma.h9
-rw-r--r--arch/arm/mach-iop33x/include/mach/io.h2
-rw-r--r--arch/arm/mach-iop33x/include/mach/memory.h13
-rw-r--r--arch/arm/mach-iop33x/include/mach/system.h1
-rw-r--r--arch/arm/mach-iop33x/include/mach/timex.h3
-rw-r--r--arch/arm/mach-ixp2000/include/mach/dma.h9
-rw-r--r--arch/arm/mach-ixp2000/include/mach/memory.h7
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/dma.h3
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/io.h2
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/memory.h13
-rw-r--r--arch/arm/mach-ixp4xx/common.c2
-rw-r--r--arch/arm/mach-ixp4xx/fsg-setup.c9
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/dma.h21
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/io.h4
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/memory.h13
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/qmgr.h35
-rw-r--r--arch/arm/mach-ixp4xx/ixp4xx_qmgr.c44
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-setup.c5
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-setup.c5
-rw-r--r--arch/arm/mach-kirkwood/common.c59
-rw-r--r--arch/arm/mach-kirkwood/common.h1
-rw-r--r--arch/arm/mach-kirkwood/include/mach/dma.h1
-rw-r--r--arch/arm/mach-kirkwood/include/mach/gpio.h38
-rw-r--r--arch/arm/mach-kirkwood/include/mach/irqs.h5
-rw-r--r--arch/arm/mach-kirkwood/include/mach/kirkwood.h3
-rw-r--r--arch/arm/mach-kirkwood/include/mach/memory.h4
-rw-r--r--arch/arm/mach-kirkwood/irq.c35
-rw-r--r--arch/arm/mach-kirkwood/rd88f6281-setup.c16
-rw-r--r--arch/arm/mach-ks8695/Kconfig6
-rw-r--r--arch/arm/mach-ks8695/Makefile1
-rw-r--r--arch/arm/mach-ks8695/board-dsm320.c131
-rw-r--r--arch/arm/mach-ks8695/board-micrel.c3
-rw-r--r--arch/arm/mach-ks8695/devices.c38
-rw-r--r--arch/arm/mach-ks8695/gpio.c44
-rw-r--r--arch/arm/mach-ks8695/include/mach/dma.h17
-rw-r--r--arch/arm/mach-ks8695/include/mach/gpio.h49
-rw-r--r--arch/arm/mach-ks8695/include/mach/io.h4
-rw-r--r--arch/arm/mach-ks8695/include/mach/memory.h5
-rw-r--r--arch/arm/mach-l7200/include/mach/dma.h23
-rw-r--r--arch/arm/mach-l7200/include/mach/io.h10
-rw-r--r--arch/arm/mach-l7200/include/mach/memory.h3
-rw-r--r--arch/arm/mach-lh7a40x/clcd.c2
-rw-r--r--arch/arm/mach-lh7a40x/clocks.c92
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/io.h6
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/memory.h10
-rw-r--r--arch/arm/mach-loki/include/mach/dma.h1
-rw-r--r--arch/arm/mach-loki/include/mach/memory.h4
-rw-r--r--arch/arm/mach-msm/include/mach/io.h6
-rw-r--r--arch/arm/mach-msm/include/mach/memory.h4
-rw-r--r--arch/arm/mach-msm/timer.c2
-rw-r--r--arch/arm/mach-mv78xx0/common.c1
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/dma.h1
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/gpio.h40
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/irqs.h4
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/memory.h4
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/mv78xx0.h3
-rw-r--r--arch/arm/mach-mv78xx0/irq.c29
-rw-r--r--arch/arm/mach-mx1/Kconfig14
-rw-r--r--arch/arm/mach-mx1/Makefile10
-rw-r--r--arch/arm/mach-mx1/Makefile.boot4
-rw-r--r--arch/arm/mach-mx1/clock.c656
-rw-r--r--arch/arm/mach-mx1/crm_regs.h55
-rw-r--r--arch/arm/mach-mx1/devices.c260
-rw-r--r--arch/arm/mach-mx1/devices.h7
-rw-r--r--arch/arm/mach-mx1/generic.c (renamed from arch/arm/mach-integrator/include/mach/dma.h)28
-rw-r--r--arch/arm/mach-mx1/mx1ads.c148
-rw-r--r--arch/arm/mach-mx2/devices.c46
-rw-r--r--arch/arm/mach-mx2/devices.h3
-rw-r--r--arch/arm/mach-mx2/mx27ads.c61
-rw-r--r--arch/arm/mach-mx2/pcm038.c82
-rw-r--r--arch/arm/mach-mx3/Kconfig14
-rw-r--r--arch/arm/mach-mx3/Makefile2
-rw-r--r--arch/arm/mach-mx3/clock.c1
-rw-r--r--arch/arm/mach-mx3/devices.c40
-rw-r--r--arch/arm/mach-mx3/devices.h2
-rw-r--r--arch/arm/mach-mx3/iomux.c9
-rw-r--r--arch/arm/mach-mx3/mx31moboard.c141
-rw-r--r--arch/arm/mach-mx3/mx31pdk.c115
-rw-r--r--arch/arm/mach-mx3/pcm037.c70
-rw-r--r--arch/arm/mach-netx/fb.c9
-rw-r--r--arch/arm/mach-netx/include/mach/dma.h21
-rw-r--r--arch/arm/mach-netx/include/mach/io.h2
-rw-r--r--arch/arm/mach-netx/include/mach/memory.h10
-rw-r--r--arch/arm/mach-netx/include/mach/netx-regs.h22
-rw-r--r--arch/arm/mach-netx/time.c98
-rw-r--r--arch/arm/mach-netx/xc.c6
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/dma.h14
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/hardware.h2
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/io.h2
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/memory.h3
-rw-r--r--arch/arm/mach-ns9xxx/time-ns9360.c2
-rw-r--r--arch/arm/mach-omap1/Kconfig3
-rw-r--r--arch/arm/mach-omap1/board-fsample.c7
-rw-r--r--arch/arm/mach-omap1/board-h2-mmc.c89
-rw-r--r--arch/arm/mach-omap1/board-h2.c49
-rw-r--r--arch/arm/mach-omap1/board-h3-mmc.c100
-rw-r--r--arch/arm/mach-omap1/board-h3.c19
-rw-r--r--arch/arm/mach-omap1/board-innovator.c52
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c86
-rw-r--r--arch/arm/mach-omap1/board-osk.c43
-rw-r--r--arch/arm/mach-omap1/board-palmte.c15
-rw-r--r--arch/arm/mach-omap1/board-palmtt.c2
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c34
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c7
-rw-r--r--arch/arm/mach-omap1/board-sx1-mmc.c80
-rw-r--r--arch/arm/mach-omap1/board-sx1.c21
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c59
-rw-r--r--arch/arm/mach-omap1/clock.h3
-rw-r--r--arch/arm/mach-omap1/devices.c90
-rw-r--r--arch/arm/mach-omap1/fpga.c6
-rw-r--r--arch/arm/mach-omap1/id.c53
-rw-r--r--arch/arm/mach-omap1/leds-h2p2-debug.c10
-rw-r--r--arch/arm/mach-omap1/leds-osk.c4
-rw-r--r--arch/arm/mach-omap1/leds.c8
-rw-r--r--arch/arm/mach-omap1/pm.c6
-rw-r--r--arch/arm/mach-omap1/serial.c10
-rw-r--r--arch/arm/mach-omap1/time.c2
-rw-r--r--arch/arm/mach-omap1/timer32k.c2
-rw-r--r--arch/arm/mach-omap2/Kconfig4
-rw-r--r--arch/arm/mach-omap2/Makefile14
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c52
-rw-r--r--arch/arm/mach-omap2/board-apollon.c26
-rw-r--r--arch/arm/mach-omap2/board-generic.c11
-rw-r--r--arch/arm/mach-omap2/board-h4.c25
-rw-r--r--arch/arm/mach-omap2/board-ldp.c97
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c90
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c212
-rw-r--r--arch/arm/mach-omap2/board-overo.c43
-rw-r--r--arch/arm/mach-omap2/clock24xx.h13
-rw-r--r--arch/arm/mach-omap2/clock34xx.c2
-rw-r--r--arch/arm/mach-omap2/clock34xx.h46
-rw-r--r--arch/arm/mach-omap2/devices.c169
-rw-r--r--arch/arm/mach-omap2/id.c305
-rw-r--r--arch/arm/mach-omap2/irq.c39
-rw-r--r--arch/arm/mach-omap2/mmc-twl4030.c408
-rw-r--r--arch/arm/mach-omap2/mmc-twl4030.h29
-rw-r--r--arch/arm/mach-omap2/mux.c44
-rw-r--r--arch/arm/mach-omap2/timer-gp.c2
-rw-r--r--arch/arm/mach-omap2/usb-tusb6010.c6
-rw-r--r--arch/arm/mach-orion5x/Makefile2
-rw-r--r--arch/arm/mach-orion5x/common.c1
-rw-r--r--arch/arm/mach-orion5x/common.h7
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c174
-rw-r--r--arch/arm/mach-orion5x/gpio.c231
-rw-r--r--arch/arm/mach-orion5x/include/mach/dma.h1
-rw-r--r--arch/arm/mach-orion5x/include/mach/gpio.h29
-rw-r--r--arch/arm/mach-orion5x/include/mach/io.h7
-rw-r--r--arch/arm/mach-orion5x/include/mach/irqs.h4
-rw-r--r--arch/arm/mach-orion5x/include/mach/memory.h4
-rw-r--r--arch/arm/mach-orion5x/include/mach/orion5x.h9
-rw-r--r--arch/arm/mach-orion5x/irq.c183
-rw-r--r--arch/arm/mach-orion5x/mpp.c6
-rw-r--r--arch/arm/mach-pnx4008/dma.c3
-rw-r--r--arch/arm/mach-pnx4008/include/mach/dma.h2
-rw-r--r--arch/arm/mach-pnx4008/include/mach/io.h4
-rw-r--r--arch/arm/mach-pnx4008/include/mach/memory.h5
-rw-r--r--arch/arm/mach-pxa/Kconfig44
-rw-r--r--arch/arm/mach-pxa/Makefile5
-rw-r--r--arch/arm/mach-pxa/am200epd.c19
-rw-r--r--arch/arm/mach-pxa/clock.c67
-rw-r--r--arch/arm/mach-pxa/clock.h59
-rw-r--r--arch/arm/mach-pxa/cm-x2xx.c29
-rw-r--r--arch/arm/mach-pxa/cm-x300.c5
-rw-r--r--arch/arm/mach-pxa/corgi.c32
-rw-r--r--arch/arm/mach-pxa/cpufreq-pxa2xx.c57
-rw-r--r--arch/arm/mach-pxa/devices.c95
-rw-r--r--arch/arm/mach-pxa/devices.h1
-rw-r--r--arch/arm/mach-pxa/dma.c2
-rw-r--r--arch/arm/mach-pxa/e330.c36
-rw-r--r--arch/arm/mach-pxa/e350.c36
-rw-r--r--arch/arm/mach-pxa/e400.c67
-rw-r--r--arch/arm/mach-pxa/e740.c46
-rw-r--r--arch/arm/mach-pxa/e750.c36
-rw-r--r--arch/arm/mach-pxa/e800.c30
-rw-r--r--arch/arm/mach-pxa/eseries.c124
-rw-r--r--arch/arm/mach-pxa/eseries.h12
-rw-r--r--arch/arm/mach-pxa/ezx.c701
-rw-r--r--arch/arm/mach-pxa/generic.c16
-rw-r--r--arch/arm/mach-pxa/gpio.c59
-rw-r--r--arch/arm/mach-pxa/gumstix.c22
-rw-r--r--arch/arm/mach-pxa/h5000.c200
-rw-r--r--arch/arm/mach-pxa/imote2.c575
-rw-r--r--arch/arm/mach-pxa/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-pxa/include/mach/dma.h4
-rw-r--r--arch/arm/mach-pxa/include/mach/eseries-gpio.h4
-rw-r--r--arch/arm/mach-pxa/include/mach/gumstix.h4
-rw-r--r--arch/arm/mach-pxa/include/mach/h5000.h113
-rw-r--r--arch/arm/mach-pxa/include/mach/hardware.h52
-rw-r--r--arch/arm/mach-pxa/include/mach/io.h6
-rw-r--r--arch/arm/mach-pxa/include/mach/littleton.h11
-rw-r--r--arch/arm/mach-pxa/include/mach/memory.h11
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa25x.h31
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa27x.h6
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa930.h1
-rw-r--r--arch/arm/mach-pxa/include/mach/mioa701.h9
-rw-r--r--arch/arm/mach-pxa/include/mach/mtd-xip.h1
-rw-r--r--arch/arm/mach-pxa/include/mach/palmasoc.h13
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa-regs.h507
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa2xx-gpio.h5
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa2xx-regs.h12
-rw-r--r--arch/arm/mach-pxa/include/mach/pxafb.h6
-rw-r--r--arch/arm/mach-pxa/include/mach/regs-ac97.h99
-rw-r--r--arch/arm/mach-pxa/include/mach/regs-lcd.h67
-rw-r--r--arch/arm/mach-pxa/include/mach/regs-uart.h143
-rw-r--r--arch/arm/mach-pxa/include/mach/timex.h8
-rw-r--r--arch/arm/mach-pxa/include/mach/uncompress.h4
-rw-r--r--arch/arm/mach-pxa/littleton.c75
-rw-r--r--arch/arm/mach-pxa/magician.c11
-rw-r--r--arch/arm/mach-pxa/mainstone.c4
-rw-r--r--arch/arm/mach-pxa/mfp-pxa2xx.c62
-rw-r--r--arch/arm/mach-pxa/mioa701.c203
-rw-r--r--arch/arm/mach-pxa/pcm990-baseboard.c10
-rw-r--r--arch/arm/mach-pxa/poodle.c32
-rw-r--r--arch/arm/mach-pxa/pwm.c2
-rw-r--r--arch/arm/mach-pxa/pxa25x.c89
-rw-r--r--arch/arm/mach-pxa/pxa27x.c115
-rw-r--r--arch/arm/mach-pxa/pxa300.c18
-rw-r--r--arch/arm/mach-pxa/pxa320.c8
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c111
-rw-r--r--arch/arm/mach-pxa/saar.c421
-rw-r--r--arch/arm/mach-pxa/smemc.c2
-rw-r--r--arch/arm/mach-pxa/spitz.c36
-rw-r--r--arch/arm/mach-pxa/ssp.c2
-rw-r--r--arch/arm/mach-pxa/tavorevb.c412
-rw-r--r--arch/arm/mach-pxa/time.c13
-rw-r--r--arch/arm/mach-pxa/tosa.c74
-rw-r--r--arch/arm/mach-pxa/zylonite.c2
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa320.c2
-rw-r--r--arch/arm/mach-realview/Kconfig30
-rw-r--r--arch/arm/mach-realview/Makefile1
-rw-r--r--arch/arm/mach-realview/Makefile.boot7
-rw-r--r--arch/arm/mach-realview/clock.c80
-rw-r--r--arch/arm/mach-realview/clock.h6
-rw-r--r--arch/arm/mach-realview/core.c143
-rw-r--r--arch/arm/mach-realview/core.h7
-rw-r--r--arch/arm/mach-realview/hotplug.c5
-rw-r--r--arch/arm/mach-realview/include/mach/board-eb.h18
-rw-r--r--arch/arm/mach-realview/include/mach/board-pb11mp.h3
-rw-r--r--arch/arm/mach-realview/include/mach/board-pba8.h152
-rw-r--r--arch/arm/mach-realview/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-realview/include/mach/debug-macro.S29
-rw-r--r--arch/arm/mach-realview/include/mach/dma.h20
-rw-r--r--arch/arm/mach-realview/include/mach/hardware.h9
-rw-r--r--arch/arm/mach-realview/include/mach/io.h9
-rw-r--r--arch/arm/mach-realview/include/mach/irqs.h1
-rw-r--r--arch/arm/mach-realview/include/mach/memory.h14
-rw-r--r--arch/arm/mach-realview/include/mach/uncompress.h3
-rw-r--r--arch/arm/mach-realview/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-realview/localtimer.c48
-rw-r--r--arch/arm/mach-realview/platsmp.c37
-rw-r--r--arch/arm/mach-realview/realview_eb.c33
-rw-r--r--arch/arm/mach-realview/realview_pb1176.c13
-rw-r--r--arch/arm/mach-realview/realview_pb11mp.c16
-rw-r--r--arch/arm/mach-realview/realview_pba8.c300
-rw-r--r--arch/arm/mach-rpc/include/mach/io.h47
-rw-r--r--arch/arm/mach-rpc/include/mach/irqs.h1
-rw-r--r--arch/arm/mach-rpc/include/mach/isa-dma.h (renamed from arch/arm/mach-rpc/include/mach/dma.h)8
-rw-r--r--arch/arm/mach-rpc/include/mach/memory.h7
-rw-r--r--arch/arm/mach-s3c2400/include/mach/memory.h3
-rw-r--r--arch/arm/mach-s3c2410/Kconfig8
-rw-r--r--arch/arm/mach-s3c2410/Makefile1
-rw-r--r--arch/arm/mach-s3c2410/dma.c5
-rw-r--r--arch/arm/mach-s3c2410/include/mach/dma.h23
-rw-r--r--arch/arm/mach-s3c2410/include/mach/gpio-core.h34
-rw-r--r--arch/arm/mach-s3c2410/include/mach/gpio.h6
-rw-r--r--arch/arm/mach-s3c2410/include/mach/irqs.h8
-rw-r--r--arch/arm/mach-s3c2410/include/mach/map.h83
-rw-r--r--arch/arm/mach-s3c2410/include/mach/memory.h3
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-clock.h33
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-gpio.h7
-rw-r--r--arch/arm/mach-s3c2410/include/mach/spi.h9
-rw-r--r--arch/arm/mach-s3c2410/include/mach/system-reset.h2
-rw-r--r--arch/arm/mach-s3c2410/include/mach/tick.h15
-rw-r--r--arch/arm/mach-s3c2410/include/mach/uncompress.h1
-rw-r--r--arch/arm/mach-s3c2410/mach-amlm5900.c4
-rw-r--r--arch/arm/mach-s3c2410/mach-bast.c11
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c14
-rw-r--r--arch/arm/mach-s3c2410/mach-n30.c11
-rw-r--r--arch/arm/mach-s3c2410/mach-otom.c4
-rw-r--r--arch/arm/mach-s3c2410/mach-qt2410.c8
-rw-r--r--arch/arm/mach-s3c2410/mach-smdk2410.c4
-rw-r--r--arch/arm/mach-s3c2410/mach-tct_hammer.c4
-rw-r--r--arch/arm/mach-s3c2410/mach-vr1000.c4
-rw-r--r--arch/arm/mach-s3c2410/s3c2410.c27
-rw-r--r--arch/arm/mach-s3c2412/Kconfig1
-rw-r--r--arch/arm/mach-s3c2412/clock.c7
-rw-r--r--arch/arm/mach-s3c2412/dma.c5
-rw-r--r--arch/arm/mach-s3c2412/mach-jive.c22
-rw-r--r--arch/arm/mach-s3c2412/mach-smdk2413.c6
-rw-r--r--arch/arm/mach-s3c2412/mach-vstms.c6
-rw-r--r--arch/arm/mach-s3c2412/s3c2412.c27
-rw-r--r--arch/arm/mach-s3c2440/Kconfig5
-rw-r--r--arch/arm/mach-s3c2440/dma.c5
-rw-r--r--arch/arm/mach-s3c2440/mach-anubis.c11
-rw-r--r--arch/arm/mach-s3c2440/mach-at2440evb.c51
-rw-r--r--arch/arm/mach-s3c2440/mach-nexcoder.c4
-rw-r--r--arch/arm/mach-s3c2440/mach-osiris.c7
-rw-r--r--arch/arm/mach-s3c2440/mach-rx3715.c4
-rw-r--r--arch/arm/mach-s3c2440/mach-smdk2440.c4
-rw-r--r--arch/arm/mach-s3c2442/Kconfig1
-rw-r--r--arch/arm/mach-s3c2443/Kconfig1
-rw-r--r--arch/arm/mach-s3c2443/clock.c53
-rw-r--r--arch/arm/mach-s3c2443/dma.c5
-rw-r--r--arch/arm/mach-s3c2443/mach-smdk2443.c6
-rw-r--r--arch/arm/mach-s3c2443/s3c2443.c3
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/debug-macro.S28
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/irqs.h115
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/map.h85
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/memory.h19
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/regs-clock.h88
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/regs-irq.h25
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/system.h25
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/tick.h15
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/timex.h18
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/vmalloc.h17
-rw-r--r--arch/arm/mach-s3c6400/Kconfig8
-rw-r--r--arch/arm/mach-s3c6400/Makefile15
-rw-r--r--arch/arm/mach-s3c6400/Makefile.boot2
-rw-r--r--arch/arm/mach-s3c6400/include/mach/debug-macro.S39
-rw-r--r--arch/arm/mach-s3c6400/include/mach/dma.h16
-rw-r--r--arch/arm/mach-s3c6400/include/mach/entry-macro.S44
-rw-r--r--arch/arm/mach-s3c6400/include/mach/gpio-core.h21
-rw-r--r--arch/arm/mach-s3c6400/include/mach/gpio.h96
-rw-r--r--arch/arm/mach-s3c6400/include/mach/hardware.h16
-rw-r--r--arch/arm/mach-s3c6400/include/mach/irqs.h20
-rw-r--r--arch/arm/mach-s3c6400/include/mach/map.h68
-rw-r--r--arch/arm/mach-s3c6400/include/mach/memory.h18
-rw-r--r--arch/arm/mach-s3c6400/include/mach/pwm-clock.h56
-rw-r--r--arch/arm/mach-s3c6400/include/mach/regs-fb.h259
-rw-r--r--arch/arm/mach-s3c6400/include/mach/regs-irq.h20
-rw-r--r--arch/arm/mach-s3c6400/include/mach/system.h24
-rw-r--r--arch/arm/mach-s3c6400/include/mach/tick.h29
-rw-r--r--arch/arm/mach-s3c6400/include/mach/uncompress.h28
-rw-r--r--arch/arm/mach-s3c6410/Kconfig62
-rw-r--r--arch/arm/mach-s3c6410/Makefile23
-rw-r--r--arch/arm/mach-s3c6410/cpu.c101
-rw-r--r--arch/arm/mach-s3c6410/mach-smdk6410.c185
-rw-r--r--arch/arm/mach-s3c6410/setup-sdhci.c102
-rw-r--r--arch/arm/mach-sa1100/clock.c100
-rw-r--r--arch/arm/mach-sa1100/collie.c29
-rw-r--r--arch/arm/mach-sa1100/collie_pm.c22
-rw-r--r--arch/arm/mach-sa1100/cpu-sa1100.c20
-rw-r--r--arch/arm/mach-sa1100/cpu-sa1110.c18
-rw-r--r--arch/arm/mach-sa1100/dma.c10
-rw-r--r--arch/arm/mach-sa1100/include/mach/h3600.h12
-rw-r--r--arch/arm/mach-sa1100/include/mach/hardware.h4
-rw-r--r--arch/arm/mach-sa1100/include/mach/io.h8
-rw-r--r--arch/arm/mach-sa1100/include/mach/memory.h13
-rw-r--r--arch/arm/mach-sa1100/include/mach/mtd-xip.h2
-rw-r--r--arch/arm/mach-sa1100/pleb.c10
-rw-r--r--arch/arm/mach-sa1100/shannon.c2
-rw-r--r--arch/arm/mach-sa1100/sleep.S52
-rw-r--r--arch/arm/mach-sa1100/time.c6
-rw-r--r--arch/arm/mach-shark/core.c2
-rw-r--r--arch/arm/mach-shark/include/mach/hardware.h2
-rw-r--r--arch/arm/mach-shark/include/mach/io.h44
-rw-r--r--arch/arm/mach-shark/include/mach/isa-dma.h (renamed from arch/arm/mach-shark/include/mach/dma.h)3
-rw-r--r--arch/arm/mach-shark/include/mach/memory.h4
-rw-r--r--arch/arm/mach-versatile/Kconfig2
-rw-r--r--arch/arm/mach-versatile/clock.c80
-rw-r--r--arch/arm/mach-versatile/clock.h7
-rw-r--r--arch/arm/mach-versatile/core.c58
-rw-r--r--arch/arm/mach-versatile/core.h2
-rw-r--r--arch/arm/mach-versatile/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-versatile/include/mach/dma.h20
-rw-r--r--arch/arm/mach-versatile/include/mach/io.h8
-rw-r--r--arch/arm/mach-versatile/include/mach/irqs.h86
-rw-r--r--arch/arm/mach-versatile/include/mach/memory.h10
-rw-r--r--arch/arm/mach-versatile/include/mach/platform.h58
-rw-r--r--arch/arm/mach-w90x900/Kconfig19
-rw-r--r--arch/arm/mach-w90x900/Makefile15
-rw-r--r--arch/arm/mach-w90x900/Makefile.boot3
-rw-r--r--arch/arm/mach-w90x900/cpu.h77
-rw-r--r--arch/arm/mach-w90x900/include/mach/entry-macro.S34
-rw-r--r--arch/arm/mach-w90x900/include/mach/hardware.h24
-rw-r--r--arch/arm/mach-w90x900/include/mach/io.h30
-rw-r--r--arch/arm/mach-w90x900/include/mach/irqs.h45
-rw-r--r--arch/arm/mach-w90x900/include/mach/map.h76
-rw-r--r--arch/arm/mach-w90x900/include/mach/memory.h23
-rw-r--r--arch/arm/mach-w90x900/include/mach/regs-irq.h51
-rw-r--r--arch/arm/mach-w90x900/include/mach/regs-serial.h59
-rw-r--r--arch/arm/mach-w90x900/include/mach/regs-timer.h42
-rw-r--r--arch/arm/mach-w90x900/include/mach/system.h28
-rw-r--r--arch/arm/mach-w90x900/include/mach/timex.h25
-rw-r--r--arch/arm/mach-w90x900/include/mach/uncompress.h40
-rw-r--r--arch/arm/mach-w90x900/include/mach/vmalloc.h23
-rw-r--r--arch/arm/mach-w90x900/irq.c76
-rw-r--r--arch/arm/mach-w90x900/mach-w90p910evb.c72
-rw-r--r--arch/arm/mach-w90x900/time.c80
-rw-r--r--arch/arm/mach-w90x900/w90p910.c134
-rw-r--r--arch/arm/mm/Kconfig67
-rw-r--r--arch/arm/mm/alignment.c1
-rw-r--r--arch/arm/mm/cache-v3.S1
-rw-r--r--arch/arm/mm/cache-v4.S1
-rw-r--r--arch/arm/mm/cache-v4wt.S1
-rw-r--r--arch/arm/mm/cache-v7.S2
-rw-r--r--arch/arm/mm/copypage-feroceon.S95
-rw-r--r--arch/arm/mm/copypage-feroceon.c111
-rw-r--r--arch/arm/mm/copypage-v3.S67
-rw-r--r--arch/arm/mm/copypage-v3.c81
-rw-r--r--arch/arm/mm/copypage-v4mc.c53
-rw-r--r--arch/arm/mm/copypage-v4wb.S79
-rw-r--r--arch/arm/mm/copypage-v4wb.c94
-rw-r--r--arch/arm/mm/copypage-v4wt.S73
-rw-r--r--arch/arm/mm/copypage-v4wt.c88
-rw-r--r--arch/arm/mm/copypage-v6.c84
-rw-r--r--arch/arm/mm/copypage-xsc3.S97
-rw-r--r--arch/arm/mm/copypage-xsc3.c113
-rw-r--r--arch/arm/mm/copypage-xscale.c47
-rw-r--r--arch/arm/mm/fault.c6
-rw-r--r--arch/arm/mm/init.c60
-rw-r--r--arch/arm/mm/mm.h4
-rw-r--r--arch/arm/mm/mmu.c128
-rw-r--r--arch/arm/mm/nommu.c23
-rw-r--r--arch/arm/mm/pgd.c2
-rw-r--r--arch/arm/mm/proc-syms.c4
-rw-r--r--arch/arm/mm/proc-v6.S2
-rw-r--r--arch/arm/mm/proc-v7.S19
-rw-r--r--arch/arm/mm/proc-xsc3.S25
-rw-r--r--arch/arm/oprofile/op_model_mpcore.c4
-rw-r--r--arch/arm/plat-mxc/Kconfig9
-rw-r--r--arch/arm/plat-mxc/Makefile1
-rw-r--r--arch/arm/plat-mxc/dma-mx1-mx2.c14
-rw-r--r--arch/arm/plat-mxc/gpio.c6
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx27ads.h7
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx31ads.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx31pdk.h19
-rw-r--r--arch/arm/plat-mxc/include/mach/debug-macro.S3
-rw-r--r--arch/arm/plat-mxc/include/mach/dma-mx1-mx2.h10
-rw-r--r--arch/arm/plat-mxc/include/mach/dma.h14
-rw-r--r--arch/arm/plat-mxc/include/mach/entry-macro.S2
-rw-r--r--arch/arm/plat-mxc/include/mach/gpio.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/hardware.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/io.h8
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mx1-mx2.h72
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mx3.h19
-rw-r--r--arch/arm/plat-mxc/include/mach/irqs.h32
-rw-r--r--arch/arm/plat-mxc/include/mach/memory.h21
-rw-r--r--arch/arm/plat-mxc/include/mach/mtd-xip.h34
-rw-r--r--arch/arm/plat-mxc/include/mach/mx1.h186
-rw-r--r--arch/arm/plat-mxc/include/mach/mx27.h15
-rw-r--r--arch/arm/plat-mxc/include/mach/mx31.h25
-rw-r--r--arch/arm/plat-mxc/include/mach/mxc_timer.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/timex.h8
-rw-r--r--arch/arm/plat-mxc/iomux-mx1-mx2.c37
-rw-r--r--arch/arm/plat-mxc/irq.c33
-rw-r--r--arch/arm/plat-mxc/time.c2
-rw-r--r--arch/arm/plat-omap/Kconfig2
-rw-r--r--arch/arm/plat-omap/debug-devices.c8
-rw-r--r--arch/arm/plat-omap/debug-leds.c10
-rw-r--r--arch/arm/plat-omap/devices.c225
-rw-r--r--arch/arm/plat-omap/dma.c17
-rw-r--r--arch/arm/plat-omap/dmtimer.c11
-rw-r--r--arch/arm/plat-omap/gpio.c127
-rw-r--r--arch/arm/plat-omap/i2c.c55
-rw-r--r--arch/arm/plat-omap/include/mach/board-apollon.h4
-rw-r--r--arch/arm/plat-omap/include/mach/board-h2.h6
-rw-r--r--arch/arm/plat-omap/include/mach/board-ldp.h5
-rw-r--r--arch/arm/plat-omap/include/mach/board.h22
-rw-r--r--arch/arm/plat-omap/include/mach/control.h17
-rw-r--r--arch/arm/plat-omap/include/mach/cpu.h82
-rw-r--r--arch/arm/plat-omap/include/mach/gpio.h31
-rw-r--r--arch/arm/plat-omap/include/mach/io.h6
-rw-r--r--arch/arm/plat-omap/include/mach/memory.h19
-rw-r--r--arch/arm/plat-omap/include/mach/mmc.h74
-rw-r--r--arch/arm/plat-omap/include/mach/mux.h41
-rw-r--r--arch/arm/plat-omap/sram.c3
-rw-r--r--arch/arm/plat-orion/Makefile2
-rw-r--r--arch/arm/plat-orion/gpio.c415
-rw-r--r--arch/arm/plat-orion/include/plat/ehci-orion.h8
-rw-r--r--arch/arm/plat-orion/include/plat/gpio.h39
-rw-r--r--arch/arm/plat-orion/time.c2
-rw-r--r--arch/arm/plat-s3c/Kconfig95
-rw-r--r--arch/arm/plat-s3c/Makefile28
-rw-r--r--arch/arm/plat-s3c/clock.c368
-rw-r--r--arch/arm/plat-s3c/dev-fb.c72
-rw-r--r--arch/arm/plat-s3c/dev-hsmmc.c68
-rw-r--r--arch/arm/plat-s3c/dev-hsmmc1.c68
-rw-r--r--arch/arm/plat-s3c/dev-i2c0.c71
-rw-r--r--arch/arm/plat-s3c/dev-i2c1.c68
-rw-r--r--arch/arm/plat-s3c/gpio-config.c163
-rw-r--r--arch/arm/plat-s3c/gpio.c147
-rw-r--r--arch/arm/plat-s3c/include/mach/io.h18
-rw-r--r--arch/arm/plat-s3c/include/mach/timex.h (renamed from arch/arm/mach-s3c2410/include/mach/timex.h)0
-rw-r--r--arch/arm/plat-s3c/include/mach/vmalloc.h (renamed from arch/arm/mach-s3c2410/include/mach/vmalloc.h)2
-rw-r--r--arch/arm/plat-s3c/include/plat/adc.h29
-rw-r--r--arch/arm/plat-s3c/include/plat/clock.h (renamed from arch/arm/plat-s3c24xx/include/plat/clock.h)38
-rw-r--r--arch/arm/plat-s3c/include/plat/cpu-freq.h94
-rw-r--r--arch/arm/plat-s3c/include/plat/cpu.h (renamed from arch/arm/plat-s3c24xx/include/plat/cpu.h)21
-rw-r--r--arch/arm/plat-s3c/include/plat/debug-macro.S2
-rw-r--r--arch/arm/plat-s3c/include/plat/devs.h (renamed from arch/arm/plat-s3c24xx/include/plat/devs.h)9
-rw-r--r--arch/arm/plat-s3c/include/plat/fb.h73
-rw-r--r--arch/arm/plat-s3c/include/plat/gpio-cfg-helpers.h176
-rw-r--r--arch/arm/plat-s3c/include/plat/gpio-cfg.h110
-rw-r--r--arch/arm/plat-s3c/include/plat/gpio-core.h77
-rw-r--r--arch/arm/plat-s3c/include/plat/iic-core.h35
-rw-r--r--arch/arm/plat-s3c/include/plat/iic.h57
-rw-r--r--arch/arm/plat-s3c/include/plat/map-base.h (renamed from arch/arm/plat-s3c/include/plat/map.h)0
-rw-r--r--arch/arm/plat-s3c/include/plat/nand.h50
-rw-r--r--arch/arm/plat-s3c/include/plat/regs-ac97.h67
-rw-r--r--arch/arm/plat-s3c/include/plat/regs-fb.h366
-rw-r--r--arch/arm/plat-s3c/include/plat/regs-iic.h56
-rw-r--r--arch/arm/plat-s3c/include/plat/regs-irqtype.h21
-rw-r--r--arch/arm/plat-s3c/include/plat/regs-nand.h123
-rw-r--r--arch/arm/plat-s3c/include/plat/regs-rtc.h61
-rw-r--r--arch/arm/plat-s3c/include/plat/regs-sdhci.h87
-rw-r--r--arch/arm/plat-s3c/include/plat/regs-serial.h16
-rw-r--r--arch/arm/plat-s3c/include/plat/regs-timer.h11
-rw-r--r--arch/arm/plat-s3c/include/plat/regs-watchdog.h41
-rw-r--r--arch/arm/plat-s3c/include/plat/sdhci.h108
-rw-r--r--arch/arm/plat-s3c/include/plat/uncompress.h32
-rw-r--r--arch/arm/plat-s3c/init.c160
-rw-r--r--arch/arm/plat-s3c/pwm-clock.c (renamed from arch/arm/plat-s3c24xx/pwm-clock.c)126
-rw-r--r--arch/arm/plat-s3c/time.c (renamed from arch/arm/plat-s3c24xx/time.c)89
-rw-r--r--arch/arm/plat-s3c24xx/Kconfig61
-rw-r--r--arch/arm/plat-s3c24xx/Makefile16
-rw-r--r--arch/arm/plat-s3c24xx/adc.c372
-rw-r--r--arch/arm/plat-s3c24xx/clock-dclk.c194
-rw-r--r--arch/arm/plat-s3c24xx/clock.c493
-rw-r--r--arch/arm/plat-s3c24xx/common-smdk.c2
-rw-r--r--arch/arm/plat-s3c24xx/cpu.c142
-rw-r--r--arch/arm/plat-s3c24xx/devs.c103
-rw-r--r--arch/arm/plat-s3c24xx/dma.c18
-rw-r--r--arch/arm/plat-s3c24xx/gpiolib.c130
-rw-r--r--arch/arm/plat-s3c24xx/include/mach/pwm-clock.h55
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/map.h99
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/mci.h15
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/pll.h37
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/regs-spi.h82
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/regs-udc.h153
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/s3c2400.h2
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/s3c2410.h2
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/s3c2412.h2
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/s3c2443.h2
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/udc.h36
-rw-r--r--arch/arm/plat-s3c24xx/irq.c1
-rw-r--r--arch/arm/plat-s3c24xx/pm.c5
-rw-r--r--arch/arm/plat-s3c24xx/s3c2410-clock.c (renamed from arch/arm/mach-s3c2410/clock.c)1
-rw-r--r--arch/arm/plat-s3c24xx/s3c244x-clock.c5
-rw-r--r--arch/arm/plat-s3c24xx/s3c244x.c29
-rw-r--r--arch/arm/plat-s3c24xx/s3c244x.h2
-rw-r--r--arch/arm/plat-s3c24xx/setup-i2c.c25
-rw-r--r--arch/arm/plat-s3c24xx/spi-bus0-gpe11_12_13.c37
-rw-r--r--arch/arm/plat-s3c24xx/spi-bus1-gpg5_6_7.c37
-rw-r--r--arch/arm/plat-s3c64xx/Kconfig62
-rw-r--r--arch/arm/plat-s3c64xx/Makefile31
-rw-r--r--arch/arm/plat-s3c64xx/clock.c281
-rw-r--r--arch/arm/plat-s3c64xx/cpu.c114
-rw-r--r--arch/arm/plat-s3c64xx/dev-uart.c176
-rw-r--r--arch/arm/plat-s3c64xx/gpiolib.c420
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/gpio-bank-a.h48
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/gpio-bank-b.h60
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/gpio-bank-c.h53
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/gpio-bank-d.h49
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/gpio-bank-e.h44
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/gpio-bank-f.h71
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/gpio-bank-g.h42
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/gpio-bank-h.h74
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/gpio-bank-i.h40
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/gpio-bank-j.h36
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/gpio-bank-n.h54
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/gpio-bank-o.h70
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/gpio-bank-p.h69
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/gpio-bank-q.h46
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/irqs.h201
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/pll.h74
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/regs-clock.h224
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/regs-gpio.h35
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/regs-sys.h24
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/s3c6400.h35
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/s3c6410.h29
-rw-r--r--arch/arm/plat-s3c64xx/irq-eint.c202
-rw-r--r--arch/arm/plat-s3c64xx/irq.c257
-rw-r--r--arch/arm/plat-s3c64xx/s3c6400-clock.c655
-rw-r--r--arch/arm/plat-s3c64xx/s3c6400-init.c29
-rw-r--r--arch/arm/plat-s3c64xx/setup-fb-24bpp.c37
-rw-r--r--arch/arm/plat-s3c64xx/setup-i2c0.c31
-rw-r--r--arch/arm/plat-s3c64xx/setup-i2c1.c31
-rw-r--r--arch/arm/tools/mach-types101
-rw-r--r--arch/arm/vfp/vfp.h2
-rw-r--r--arch/arm/vfp/vfphw.S29
-rw-r--r--arch/arm/vfp/vfpmodule.c65
-rw-r--r--arch/avr32/include/asm/atomic.h2
-rw-r--r--arch/avr32/include/asm/bitops.h5
-rw-r--r--arch/avr32/kernel/init_task.c1
-rw-r--r--arch/avr32/kernel/time.c2
-rw-r--r--arch/avr32/kernel/traps.c1
-rw-r--r--arch/avr32/mach-at32ap/clock.c4
-rw-r--r--arch/blackfin/boot/Makefile2
-rw-r--r--arch/blackfin/include/asm/atomic.h4
-rw-r--r--arch/blackfin/include/asm/bitops.h1
-rw-r--r--arch/blackfin/kernel/init_task.c1
-rw-r--r--arch/blackfin/kernel/time-ts.c2
-rw-r--r--arch/cris/Kconfig2
-rw-r--r--arch/cris/arch-v32/drivers/iop_fw_load.c6
-rw-r--r--arch/cris/arch-v32/kernel/irq.c4
-rw-r--r--arch/cris/arch-v32/kernel/smp.c4
-rw-r--r--arch/cris/include/asm/atomic.h4
-rw-r--r--arch/cris/include/asm/bitops.h1
-rw-r--r--arch/cris/include/asm/smp.h1
-rw-r--r--arch/cris/kernel/process.c1
-rw-r--r--arch/frv/kernel/init_task.c1
-rw-r--r--arch/h8300/Kconfig2
-rw-r--r--arch/h8300/include/asm/atomic.h3
-rw-r--r--arch/h8300/include/asm/bitops.h1
-rw-r--r--arch/h8300/kernel/init_task.c1
-rw-r--r--arch/ia64/Kconfig5
-rw-r--r--arch/ia64/hp/sim/hpsim_irq.c2
-rw-r--r--arch/ia64/hp/sim/simeth.c25
-rw-r--r--arch/ia64/ia32/sys_ia32.c7
-rw-r--r--arch/ia64/include/asm/atomic.h6
-rw-r--r--arch/ia64/include/asm/irq.h2
-rw-r--r--arch/ia64/include/asm/kvm.h6
-rw-r--r--arch/ia64/include/asm/kvm_host.h198
-rw-r--r--arch/ia64/include/asm/smp.h1
-rw-r--r--arch/ia64/include/asm/swiotlb.h39
-rw-r--r--arch/ia64/include/asm/topology.h11
-rw-r--r--arch/ia64/kernel/acpi.c3
-rw-r--r--arch/ia64/kernel/init_task.c1
-rw-r--r--arch/ia64/kernel/iosapic.c35
-rw-r--r--arch/ia64/kernel/irq.c13
-rw-r--r--arch/ia64/kernel/kprobes.c8
-rw-r--r--arch/ia64/kernel/mca_drv.c2
-rw-r--r--arch/ia64/kernel/msi_ia64.c12
-rw-r--r--arch/ia64/kernel/pci-dma.c2
-rw-r--r--arch/ia64/kernel/perfmon.c43
-rw-r--r--arch/ia64/kernel/signal.c4
-rw-r--r--arch/ia64/kernel/smpboot.c10
-rw-r--r--arch/ia64/kernel/time.c18
-rw-r--r--arch/ia64/kernel/topology.c2
-rw-r--r--arch/ia64/kvm/Makefile6
-rw-r--r--arch/ia64/kvm/asm-offsets.c11
-rw-r--r--arch/ia64/kvm/kvm-ia64.c110
-rw-r--r--arch/ia64/kvm/kvm_lib.c15
-rw-r--r--arch/ia64/kvm/kvm_minstate.h4
-rw-r--r--arch/ia64/kvm/misc.h3
-rw-r--r--arch/ia64/kvm/mmio.c38
-rw-r--r--arch/ia64/kvm/process.c29
-rw-r--r--arch/ia64/kvm/vcpu.c76
-rw-r--r--arch/ia64/kvm/vcpu.h5
-rw-r--r--arch/ia64/kvm/vmm.c29
-rw-r--r--arch/ia64/kvm/vmm_ivt.S1469
-rw-r--r--arch/ia64/kvm/vtlb.c4
-rw-r--r--arch/ia64/mm/init.c2
-rw-r--r--arch/ia64/sn/kernel/irq.c6
-rw-r--r--arch/ia64/sn/kernel/msi_sn.c7
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_hwperf.c27
-rw-r--r--arch/ia64/sn/kernel/tiocx.c3
-rw-r--r--arch/m32r/Kconfig3
-rw-r--r--arch/m32r/kernel/init_task.c1
-rw-r--r--arch/m32r/kernel/smpboot.c8
-rw-r--r--arch/m68k/Kconfig1
-rw-r--r--arch/m68k/fpsp040/setox.S4
-rw-r--r--arch/m68k/kernel/process.c1
-rw-r--r--arch/m68k/mac/baboon.c42
-rw-r--r--arch/m68k/mac/config.c3
-rw-r--r--arch/m68k/mac/debug.c1
-rw-r--r--arch/m68k/mac/macints.c9
-rw-r--r--arch/m68k/mac/misc.c16
-rw-r--r--arch/m68k/mac/oss.c1
-rw-r--r--arch/m68k/mac/via.c80
-rw-r--r--arch/m68knommu/include/asm/atomic.h2
-rw-r--r--arch/m68knommu/include/asm/bitops.h1
-rw-r--r--arch/m68knommu/kernel/init_task.c1
-rw-r--r--arch/m68knommu/platform/coldfire/pit.c2
-rw-r--r--arch/mips/Kconfig2
-rw-r--r--arch/mips/include/asm/atomic.h5
-rw-r--r--arch/mips/include/asm/irq.h3
-rw-r--r--arch/mips/include/asm/mach-ip27/topology.h5
-rw-r--r--arch/mips/include/asm/smp.h3
-rw-r--r--arch/mips/jazz/irq.c2
-rw-r--r--arch/mips/kernel/cevt-bcm1480.c4
-rw-r--r--arch/mips/kernel/cevt-ds1287.c2
-rw-r--r--arch/mips/kernel/cevt-gt641xx.c2
-rw-r--r--arch/mips/kernel/cevt-r4k.c2
-rw-r--r--arch/mips/kernel/cevt-sb1250.c4
-rw-r--r--arch/mips/kernel/cevt-smtc.c2
-rw-r--r--arch/mips/kernel/cevt-txx9.c2
-rw-r--r--arch/mips/kernel/i8253.c2
-rw-r--r--arch/mips/kernel/init_task.c1
-rw-r--r--arch/mips/kernel/irq-gic.c6
-rw-r--r--arch/mips/kernel/kspd.c4
-rw-r--r--arch/mips/kernel/mips-mt-fpaff.c5
-rw-r--r--arch/mips/kernel/smp-cmp.c6
-rw-r--r--arch/mips/kernel/smp-mt.c2
-rw-r--r--arch/mips/kernel/smp.c7
-rw-r--r--arch/mips/kernel/smtc.c6
-rw-r--r--arch/mips/kernel/vpe.c6
-rw-r--r--arch/mips/mti-malta/malta-smtc.c6
-rw-r--r--arch/mips/nxp/pnx8550/common/time.c1
-rw-r--r--arch/mips/pmc-sierra/yosemite/smp.c6
-rw-r--r--arch/mips/sgi-ip27/ip27-smp.c2
-rw-r--r--arch/mips/sgi-ip27/ip27-timer.c2
-rw-r--r--arch/mips/sibyte/bcm1480/irq.c8
-rw-r--r--arch/mips/sibyte/bcm1480/smp.c8
-rw-r--r--arch/mips/sibyte/sb1250/irq.c8
-rw-r--r--arch/mips/sibyte/sb1250/smp.c8
-rw-r--r--arch/mips/sni/time.c2
-rw-r--r--arch/mn10300/kernel/init_task.c1
-rw-r--r--arch/parisc/Kconfig1
-rw-r--r--arch/parisc/include/asm/atomic.h11
-rw-r--r--arch/parisc/include/asm/module.h6
-rw-r--r--arch/parisc/include/asm/smp.h2
-rw-r--r--arch/parisc/kernel/init_task.c1
-rw-r--r--arch/parisc/kernel/irq.c6
-rw-r--r--arch/parisc/kernel/module.c216
-rw-r--r--arch/parisc/kernel/signal.c2
-rw-r--r--arch/parisc/kernel/smp.c15
-rw-r--r--arch/powerpc/Kconfig66
-rw-r--r--arch/powerpc/Kconfig.debug9
-rw-r--r--arch/powerpc/Makefile1
-rw-r--r--arch/powerpc/boot/Makefile1
-rw-r--r--arch/powerpc/boot/devtree.c2
-rw-r--r--arch/powerpc/boot/dts/asp834x-redboot.dts20
-rw-r--r--arch/powerpc/boot/dts/bamboo.dts3
-rw-r--r--arch/powerpc/boot/dts/canyonlands.dts14
-rw-r--r--arch/powerpc/boot/dts/gef_sbc610.dts11
-rw-r--r--arch/powerpc/boot/dts/ksi8560.dts20
-rw-r--r--arch/powerpc/boot/dts/kuroboxHD.dts1
-rw-r--r--arch/powerpc/boot/dts/kuroboxHG.dts1
-rw-r--r--arch/powerpc/boot/dts/lite5200.dts1
-rw-r--r--arch/powerpc/boot/dts/lite5200b.dts1
-rw-r--r--arch/powerpc/boot/dts/motionpro.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8313erdb.dts20
-rw-r--r--arch/powerpc/boot/dts/mpc8315erdb.dts20
-rw-r--r--arch/powerpc/boot/dts/mpc8349emitx.dts19
-rw-r--r--arch/powerpc/boot/dts/mpc8349emitxgp.dts6
-rw-r--r--arch/powerpc/boot/dts/mpc834x_mds.dts19
-rw-r--r--arch/powerpc/boot/dts/mpc8377_mds.dts19
-rw-r--r--arch/powerpc/boot/dts/mpc8377_rdb.dts20
-rw-r--r--arch/powerpc/boot/dts/mpc8378_mds.dts19
-rw-r--r--arch/powerpc/boot/dts/mpc8378_rdb.dts18
-rw-r--r--arch/powerpc/boot/dts/mpc8379_mds.dts18
-rw-r--r--arch/powerpc/boot/dts/mpc8379_rdb.dts19
-rw-r--r--arch/powerpc/boot/dts/mpc8536ds.dts18
-rw-r--r--arch/powerpc/boot/dts/mpc8540ads.dts31
-rw-r--r--arch/powerpc/boot/dts/mpc8541cds.dts18
-rw-r--r--arch/powerpc/boot/dts/mpc8544ds.dts20
-rw-r--r--arch/powerpc/boot/dts/mpc8548cds.dts44
-rw-r--r--arch/powerpc/boot/dts/mpc8555cds.dts18
-rw-r--r--arch/powerpc/boot/dts/mpc8560ads.dts18
-rw-r--r--arch/powerpc/boot/dts/mpc8568mds.dts18
-rw-r--r--arch/powerpc/boot/dts/mpc8572ds.dts158
-rw-r--r--arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts483
-rw-r--r--arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts234
-rw-r--r--arch/powerpc/boot/dts/mpc8641_hpcn.dts45
-rw-r--r--arch/powerpc/boot/dts/pcm030.dts2
-rw-r--r--arch/powerpc/boot/dts/sbc8349.dts18
-rw-r--r--arch/powerpc/boot/dts/sbc8548.dts18
-rw-r--r--arch/powerpc/boot/dts/sbc8560.dts18
-rw-r--r--arch/powerpc/boot/dts/sbc8641d.dts44
-rw-r--r--arch/powerpc/boot/dts/stx_gp3_8560.dts18
-rw-r--r--arch/powerpc/boot/dts/tqm5200.dts1
-rw-r--r--arch/powerpc/boot/dts/tqm8540.dts28
-rw-r--r--arch/powerpc/boot/dts/tqm8541.dts18
-rw-r--r--arch/powerpc/boot/dts/tqm8548-bigflash.dts44
-rw-r--r--arch/powerpc/boot/dts/tqm8548.dts44
-rw-r--r--arch/powerpc/boot/dts/tqm8555.dts18
-rw-r--r--arch/powerpc/boot/dts/tqm8560.dts18
-rw-r--r--arch/powerpc/boot/libfdt-wrapper.c2
-rw-r--r--arch/powerpc/configs/86xx/gef_sbc610_defconfig8
-rw-r--r--arch/powerpc/configs/ppc44x_defconfig12
-rw-r--r--arch/powerpc/include/asm/atomic.h22
-rw-r--r--arch/powerpc/include/asm/bug.h11
-rw-r--r--arch/powerpc/include/asm/byteorder.h38
-rw-r--r--arch/powerpc/include/asm/cputable.h113
-rw-r--r--arch/powerpc/include/asm/dcr-native.h63
-rw-r--r--arch/powerpc/include/asm/dcr.h4
-rw-r--r--arch/powerpc/include/asm/device.h12
-rw-r--r--arch/powerpc/include/asm/disassemble.h80
-rw-r--r--arch/powerpc/include/asm/dma-mapping.h156
-rw-r--r--arch/powerpc/include/asm/eeh.h8
-rw-r--r--arch/powerpc/include/asm/elf.h2
-rw-r--r--arch/powerpc/include/asm/feature-fixups.h30
-rw-r--r--arch/powerpc/include/asm/ftrace.h14
-rw-r--r--arch/powerpc/include/asm/highmem.h23
-rw-r--r--arch/powerpc/include/asm/hugetlb.h6
-rw-r--r--arch/powerpc/include/asm/io.h7
-rw-r--r--arch/powerpc/include/asm/kdump.h13
-rw-r--r--arch/powerpc/include/asm/kexec.h15
-rw-r--r--arch/powerpc/include/asm/kvm_44x.h61
-rw-r--r--arch/powerpc/include/asm/kvm_host.h116
-rw-r--r--arch/powerpc/include/asm/kvm_ppc.h83
-rw-r--r--arch/powerpc/include/asm/local.h4
-rw-r--r--arch/powerpc/include/asm/lppaca.h3
-rw-r--r--arch/powerpc/include/asm/mmu-40x.h5
-rw-r--r--arch/powerpc/include/asm/mmu-44x.h23
-rw-r--r--arch/powerpc/include/asm/mmu-8xx.h3
-rw-r--r--arch/powerpc/include/asm/mmu-fsl-booke.h7
-rw-r--r--arch/powerpc/include/asm/mmu.h57
-rw-r--r--arch/powerpc/include/asm/mmu_context.h257
-rw-r--r--arch/powerpc/include/asm/module.h16
-rw-r--r--arch/powerpc/include/asm/mpc52xx.h19
-rw-r--r--arch/powerpc/include/asm/mpc52xx_psc.h11
-rw-r--r--arch/powerpc/include/asm/mutex.h135
-rw-r--r--arch/powerpc/include/asm/page.h13
-rw-r--r--arch/powerpc/include/asm/page_32.h7
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h30
-rw-r--r--arch/powerpc/include/asm/pci.h15
-rw-r--r--arch/powerpc/include/asm/pgalloc-32.h11
-rw-r--r--arch/powerpc/include/asm/pgalloc-64.h34
-rw-r--r--arch/powerpc/include/asm/pgalloc.h41
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc32.h42
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64.h15
-rw-r--r--arch/powerpc/include/asm/pgtable.h26
-rw-r--r--arch/powerpc/include/asm/ppc_asm.h4
-rw-r--r--arch/powerpc/include/asm/processor.h8
-rw-r--r--arch/powerpc/include/asm/prom.h3
-rw-r--r--arch/powerpc/include/asm/ps3.h56
-rw-r--r--arch/powerpc/include/asm/ps3av.h4
-rw-r--r--arch/powerpc/include/asm/reg.h4
-rw-r--r--arch/powerpc/include/asm/rtas.h1
-rw-r--r--arch/powerpc/include/asm/sfp-machine.h58
-rw-r--r--arch/powerpc/include/asm/smp.h7
-rw-r--r--arch/powerpc/include/asm/spinlock.h2
-rw-r--r--arch/powerpc/include/asm/synch.h4
-rw-r--r--arch/powerpc/include/asm/system.h24
-rw-r--r--arch/powerpc/include/asm/time.h20
-rw-r--r--arch/powerpc/include/asm/tlbflush.h87
-rw-r--r--arch/powerpc/include/asm/topology.h13
-rw-r--r--arch/powerpc/include/asm/vdso_datapage.h3
-rw-r--r--arch/powerpc/kernel/Makefile5
-rw-r--r--arch/powerpc/kernel/asm-offsets.c27
-rw-r--r--arch/powerpc/kernel/cputable.c117
-rw-r--r--arch/powerpc/kernel/dma.c26
-rw-r--r--arch/powerpc/kernel/entry_32.S40
-rw-r--r--arch/powerpc/kernel/entry_64.S12
-rw-r--r--arch/powerpc/kernel/ftrace.c461
-rw-r--r--arch/powerpc/kernel/head_32.S31
-rw-r--r--arch/powerpc/kernel/head_44x.S34
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S107
-rw-r--r--arch/powerpc/kernel/ibmebus.c3
-rw-r--r--arch/powerpc/kernel/idle.c5
-rw-r--r--arch/powerpc/kernel/init_task.c1
-rw-r--r--arch/powerpc/kernel/irq.c2
-rw-r--r--arch/powerpc/kernel/kprobes.c7
-rw-r--r--arch/powerpc/kernel/machine_kexec.c91
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c78
-rw-r--r--arch/powerpc/kernel/misc_32.S238
-rw-r--r--arch/powerpc/kernel/module.c6
-rw-r--r--arch/powerpc/kernel/module_32.c10
-rw-r--r--arch/powerpc/kernel/module_64.c13
-rw-r--r--arch/powerpc/kernel/of_device.c18
-rw-r--r--arch/powerpc/kernel/paca.c1
-rw-r--r--arch/powerpc/kernel/pci-common.c300
-rw-r--r--arch/powerpc/kernel/pci_32.c108
-rw-r--r--arch/powerpc/kernel/pci_64.c134
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c9
-rw-r--r--arch/powerpc/kernel/ppc_save_regs.S (renamed from arch/powerpc/xmon/setjmp.S)2
-rw-r--r--arch/powerpc/kernel/process.c5
-rw-r--r--arch/powerpc/kernel/prom.c47
-rw-r--r--arch/powerpc/kernel/prom_parse.c5
-rw-r--r--arch/powerpc/kernel/rtas.c26
-rw-r--r--arch/powerpc/kernel/rtas_pci.c48
-rw-r--r--arch/powerpc/kernel/setup_32.c15
-rw-r--r--arch/powerpc/kernel/setup_64.c5
-rw-r--r--arch/powerpc/kernel/smp-tbsync.c12
-rw-r--r--arch/powerpc/kernel/smp.c75
-rw-r--r--arch/powerpc/kernel/swsusp.c2
-rw-r--r--arch/powerpc/kernel/swsusp_32.S6
-rw-r--r--arch/powerpc/kernel/sysfs.c7
-rw-r--r--arch/powerpc/kernel/time.c56
-rw-r--r--arch/powerpc/kernel/traps.c62
-rw-r--r--arch/powerpc/kernel/vdso.c13
-rw-r--r--arch/powerpc/kernel/vdso32/gettimeofday.S208
-rw-r--r--arch/powerpc/kernel/vdso32/vdso32.lds.S3
-rw-r--r--arch/powerpc/kernel/vdso64/gettimeofday.S141
-rw-r--r--arch/powerpc/kernel/vdso64/vdso64.lds.S3
-rw-r--r--arch/powerpc/kernel/vio.c12
-rw-r--r--arch/powerpc/kernel/vmlinux.lds.S6
-rw-r--r--arch/powerpc/kvm/44x.c228
-rw-r--r--arch/powerpc/kvm/44x_emulate.c371
-rw-r--r--arch/powerpc/kvm/44x_tlb.c463
-rw-r--r--arch/powerpc/kvm/44x_tlb.h26
-rw-r--r--arch/powerpc/kvm/Kconfig28
-rw-r--r--arch/powerpc/kvm/Makefile12
-rw-r--r--arch/powerpc/kvm/booke.c (renamed from arch/powerpc/kvm/booke_guest.c)418
-rw-r--r--arch/powerpc/kvm/booke.h60
-rw-r--r--arch/powerpc/kvm/booke_host.c83
-rw-r--r--arch/powerpc/kvm/booke_interrupts.S72
-rw-r--r--arch/powerpc/kvm/emulate.c447
-rw-r--r--arch/powerpc/kvm/powerpc.c133
-rw-r--r--arch/powerpc/kvm/timing.c239
-rw-r--r--arch/powerpc/kvm/timing.h102
-rw-r--r--arch/powerpc/lib/Makefile3
-rw-r--r--arch/powerpc/lib/copyuser_64.S17
-rw-r--r--arch/powerpc/lib/dma-noncoherent.c25
-rw-r--r--arch/powerpc/lib/memcpy_64.S16
-rw-r--r--arch/powerpc/math-emu/Makefile2
-rw-r--r--arch/powerpc/math-emu/fadd.c1
-rw-r--r--arch/powerpc/math-emu/fcmpo.c5
-rw-r--r--arch/powerpc/math-emu/fdiv.c9
-rw-r--r--arch/powerpc/math-emu/fdivs.c9
-rw-r--r--arch/powerpc/math-emu/fmadd.c5
-rw-r--r--arch/powerpc/math-emu/fmadds.c5
-rw-r--r--arch/powerpc/math-emu/fmsub.c5
-rw-r--r--arch/powerpc/math-emu/fmsubs.c5
-rw-r--r--arch/powerpc/math-emu/fmul.c3
-rw-r--r--arch/powerpc/math-emu/fmuls.c3
-rw-r--r--arch/powerpc/math-emu/fnmadd.c5
-rw-r--r--arch/powerpc/math-emu/fnmadds.c5
-rw-r--r--arch/powerpc/math-emu/fnmsub.c5
-rw-r--r--arch/powerpc/math-emu/fnmsubs.c5
-rw-r--r--arch/powerpc/math-emu/fsqrt.c5
-rw-r--r--arch/powerpc/math-emu/fsqrts.c5
-rw-r--r--arch/powerpc/math-emu/fsub.c3
-rw-r--r--arch/powerpc/math-emu/fsubs.c3
-rw-r--r--arch/powerpc/math-emu/math_efp.c720
-rw-r--r--arch/powerpc/mm/Makefile10
-rw-r--r--arch/powerpc/mm/fault.c16
-rw-r--r--arch/powerpc/mm/hash_low_32.S111
-rw-r--r--arch/powerpc/mm/hugetlbpage.c29
-rw-r--r--arch/powerpc/mm/init_32.c6
-rw-r--r--arch/powerpc/mm/mem.c8
-rw-r--r--arch/powerpc/mm/mmu_context_32.c84
-rw-r--r--arch/powerpc/mm/mmu_context_hash32.c103
-rw-r--r--arch/powerpc/mm/mmu_context_hash64.c (renamed from arch/powerpc/mm/mmu_context_64.c)8
-rw-r--r--arch/powerpc/mm/mmu_context_nohash.c397
-rw-r--r--arch/powerpc/mm/mmu_decl.h65
-rw-r--r--arch/powerpc/mm/pgtable.c117
-rw-r--r--arch/powerpc/mm/pgtable_32.c56
-rw-r--r--arch/powerpc/mm/ppc_mmu_32.c10
-rw-r--r--arch/powerpc/mm/tlb_hash32.c (renamed from arch/powerpc/mm/tlb_32.c)4
-rw-r--r--arch/powerpc/mm/tlb_hash64.c (renamed from arch/powerpc/mm/tlb_64.c)86
-rw-r--r--arch/powerpc/mm/tlb_nohash.c209
-rw-r--r--arch/powerpc/mm/tlb_nohash_low.S166
-rw-r--r--arch/powerpc/oprofile/cell/spu_task_sync.c2
-rw-r--r--arch/powerpc/platforms/40x/ep405.c2
-rw-r--r--arch/powerpc/platforms/40x/kilauea.c2
-rw-r--r--arch/powerpc/platforms/40x/ppc40x_simple.c2
-rw-r--r--arch/powerpc/platforms/44x/ebony.c2
-rw-r--r--arch/powerpc/platforms/44x/ppc44x_simple.c2
-rw-r--r--arch/powerpc/platforms/44x/sam440ep.c2
-rw-r--r--arch/powerpc/platforms/52xx/lite5200_pm.c1
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pci.c2
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pic.c237
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pic.h53
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pm.c3
-rw-r--r--arch/powerpc/platforms/82xx/pq2.c2
-rw-r--r--arch/powerpc/platforms/85xx/Makefile2
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ds.c11
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c8
-rw-r--r--arch/powerpc/platforms/85xx/smp.c104
-rw-r--r--arch/powerpc/platforms/86xx/Kconfig2
-rw-r--r--arch/powerpc/platforms/86xx/Makefile3
-rw-r--r--arch/powerpc/platforms/86xx/gef_gpio.c143
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype12
-rw-r--r--arch/powerpc/platforms/cell/Kconfig23
-rw-r--r--arch/powerpc/platforms/cell/Makefile17
-rw-r--r--arch/powerpc/platforms/cell/celleb_setup.c9
-rw-r--r--arch/powerpc/platforms/cell/iommu.c5
-rw-r--r--arch/powerpc/platforms/cell/qpace_setup.c152
-rw-r--r--arch/powerpc/platforms/cell/setup.c6
-rw-r--r--arch/powerpc/platforms/cell/spu_priv1_mmio.c6
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c27
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c9
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c4
-rw-r--r--arch/powerpc/platforms/chrp/pci.c3
-rw-r--r--arch/powerpc/platforms/embedded6xx/c2k.c6
-rw-r--r--arch/powerpc/platforms/embedded6xx/prpmc2800.c6
-rw-r--r--arch/powerpc/platforms/iseries/Kconfig1
-rw-r--r--arch/powerpc/platforms/maple/setup.c6
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_32.c2
-rw-r--r--arch/powerpc/platforms/powermac/pci.c6
-rw-r--r--arch/powerpc/platforms/powermac/setup.c10
-rw-r--r--arch/powerpc/platforms/powermac/sleep.S5
-rw-r--r--arch/powerpc/platforms/powermac/smp.c2
-rw-r--r--arch/powerpc/platforms/ps3/device-init.c33
-rw-r--r--arch/powerpc/platforms/ps3/mm.c2
-rw-r--r--arch/powerpc/platforms/ps3/setup.c8
-rw-r--r--arch/powerpc/platforms/ps3/system-bus.c38
-rw-r--r--arch/powerpc/platforms/pseries/Kconfig2
-rw-r--r--arch/powerpc/platforms/pseries/cmm.c29
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c44
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-cpu.c2
-rw-r--r--arch/powerpc/platforms/pseries/pci_dlpar.c163
-rw-r--r--arch/powerpc/platforms/pseries/phyp_dump.c5
-rw-r--r--arch/powerpc/platforms/pseries/rtasd.c4
-rw-r--r--arch/powerpc/platforms/pseries/xics.c47
-rw-r--r--arch/powerpc/sysdev/bestcomm/ata.c3
-rw-r--r--arch/powerpc/sysdev/bestcomm/ata.h19
-rw-r--r--arch/powerpc/sysdev/bestcomm/bestcomm.c7
-rw-r--r--arch/powerpc/sysdev/bestcomm/bestcomm.h61
-rw-r--r--arch/powerpc/sysdev/bestcomm/bestcomm_priv.h20
-rw-r--r--arch/powerpc/sysdev/dcr-low.S8
-rw-r--r--arch/powerpc/sysdev/dcr.c5
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c4
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c241
-rw-r--r--arch/powerpc/sysdev/grackle.c2
-rw-r--r--arch/powerpc/sysdev/mpic.c36
-rw-r--r--arch/powerpc/sysdev/mpic.h2
-rw-r--r--arch/powerpc/sysdev/ppc4xx_pci.c306
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe.c3
-rw-r--r--arch/powerpc/sysdev/qe_lib/ucc.c4
-rw-r--r--arch/powerpc/xmon/Makefile2
-rw-r--r--arch/powerpc/xmon/xmon.c5
-rw-r--r--arch/s390/Kconfig42
-rw-r--r--arch/s390/Makefile1
-rw-r--r--arch/s390/appldata/appldata.h4
-rw-r--r--arch/s390/appldata/appldata_base.c12
-rw-r--r--arch/s390/appldata/appldata_net_sum.c4
-rw-r--r--arch/s390/appldata/appldata_os.c21
-rw-r--r--arch/s390/crypto/aes_s390.c14
-rw-r--r--arch/s390/hypfs/hypfs_diag.c10
-rw-r--r--arch/s390/hypfs/inode.c19
-rw-r--r--arch/s390/include/asm/atomic.h7
-rw-r--r--arch/s390/include/asm/auxvec.h2
-rw-r--r--arch/s390/include/asm/bug.h5
-rw-r--r--arch/s390/include/asm/byteorder.h72
-rw-r--r--arch/s390/include/asm/cpu.h7
-rw-r--r--arch/s390/include/asm/cputime.h42
-rw-r--r--arch/s390/include/asm/elf.h16
-rw-r--r--arch/s390/include/asm/fcx.h4
-rw-r--r--arch/s390/include/asm/ftrace.h8
-rw-r--r--arch/s390/include/asm/isc.h1
-rw-r--r--arch/s390/include/asm/kvm_virtio.h4
-rw-r--r--arch/s390/include/asm/lowcore.h49
-rw-r--r--arch/s390/include/asm/mmu.h1
-rw-r--r--arch/s390/include/asm/page.h2
-rw-r--r--arch/s390/include/asm/pgalloc.h5
-rw-r--r--arch/s390/include/asm/processor.h4
-rw-r--r--arch/s390/include/asm/qdio.h16
-rw-r--r--arch/s390/include/asm/s390_rdev.h15
-rw-r--r--arch/s390/include/asm/sigp.h1
-rw-r--r--arch/s390/include/asm/smp.h5
-rw-r--r--arch/s390/include/asm/sysinfo.h11
-rw-r--r--arch/s390/include/asm/system.h28
-rw-r--r--arch/s390/include/asm/thread_info.h2
-rw-r--r--arch/s390/include/asm/timer.h25
-rw-r--r--arch/s390/include/asm/topology.h2
-rw-r--r--arch/s390/include/asm/vdso.h50
-rw-r--r--arch/s390/kernel/Makefile18
-rw-r--r--arch/s390/kernel/asm-offsets.c20
-rw-r--r--arch/s390/kernel/compat_linux.c28
-rw-r--r--arch/s390/kernel/cpcmd.c7
-rw-r--r--arch/s390/kernel/debug.c39
-rw-r--r--arch/s390/kernel/entry.S59
-rw-r--r--arch/s390/kernel/entry64.S104
-rw-r--r--arch/s390/kernel/head.S49
-rw-r--r--arch/s390/kernel/head31.S28
-rw-r--r--arch/s390/kernel/head64.S26
-rw-r--r--arch/s390/kernel/init_task.c1
-rw-r--r--arch/s390/kernel/kprobes.c7
-rw-r--r--arch/s390/kernel/mcount.S56
-rw-r--r--arch/s390/kernel/process.c43
-rw-r--r--arch/s390/kernel/processor.c98
-rw-r--r--arch/s390/kernel/ptrace.c10
-rw-r--r--arch/s390/kernel/s390_ext.c2
-rw-r--r--arch/s390/kernel/s390_ksyms.c5
-rw-r--r--arch/s390/kernel/setup.c187
-rw-r--r--arch/s390/kernel/smp.c241
-rw-r--r--arch/s390/kernel/time.c280
-rw-r--r--arch/s390/kernel/topology.c51
-rw-r--r--arch/s390/kernel/vdso.c351
-rw-r--r--arch/s390/kernel/vdso32/Makefile55
-rw-r--r--arch/s390/kernel/vdso32/clock_getres.S39
-rw-r--r--arch/s390/kernel/vdso32/clock_gettime.S128
-rw-r--r--arch/s390/kernel/vdso32/gettimeofday.S82
-rw-r--r--arch/s390/kernel/vdso32/note.S12
-rw-r--r--arch/s390/kernel/vdso32/vdso32.lds.S138
-rw-r--r--arch/s390/kernel/vdso32/vdso32_wrapper.S13
-rw-r--r--arch/s390/kernel/vdso64/Makefile55
-rw-r--r--arch/s390/kernel/vdso64/clock_getres.S44
-rw-r--r--arch/s390/kernel/vdso64/clock_gettime.S118
-rw-r--r--arch/s390/kernel/vdso64/gettimeofday.S56
-rw-r--r--arch/s390/kernel/vdso64/note.S12
-rw-r--r--arch/s390/kernel/vdso64/vdso64.lds.S138
-rw-r--r--arch/s390/kernel/vdso64/vdso64_wrapper.S13
-rw-r--r--arch/s390/kernel/vtime.c497
-rw-r--r--arch/s390/kvm/kvm-s390.c41
-rw-r--r--arch/s390/mm/extmem.c106
-rw-r--r--arch/s390/mm/init.c2
-rw-r--r--arch/s390/mm/pgtable.c4
-rw-r--r--arch/sh/Kconfig83
-rw-r--r--arch/sh/Kconfig.debug104
-rw-r--r--arch/sh/Makefile33
-rw-r--r--arch/sh/boards/Kconfig11
-rw-r--r--arch/sh/boards/Makefile1
-rw-r--r--arch/sh/boards/board-ap325rxa.c7
-rw-r--r--arch/sh/boards/board-shmin.c14
-rw-r--r--arch/sh/boards/mach-cayman/Makefile1
-rw-r--r--arch/sh/boards/mach-cayman/irq.c35
-rw-r--r--arch/sh/boards/mach-cayman/led.c51
-rw-r--r--arch/sh/boards/mach-dreamcast/irq.c192
-rw-r--r--arch/sh/boards/mach-dreamcast/setup.c5
-rw-r--r--arch/sh/boards/mach-edosk7705/Makefile1
-rw-r--r--arch/sh/boards/mach-edosk7705/io.c61
-rw-r--r--arch/sh/boards/mach-edosk7705/setup.c9
-rw-r--r--arch/sh/boards/mach-hp6xx/pm.c78
-rw-r--r--arch/sh/boards/mach-microdev/Makefile5
-rw-r--r--arch/sh/boards/mach-microdev/fdc37c93xapm.c160
-rw-r--r--arch/sh/boards/mach-microdev/irq.c36
-rw-r--r--arch/sh/boards/mach-microdev/led.c101
-rw-r--r--arch/sh/boards/mach-microdev/setup.c196
-rw-r--r--arch/sh/boards/mach-migor/setup.c21
-rw-r--r--arch/sh/boards/mach-rsk/Kconfig18
-rw-r--r--arch/sh/boards/mach-rsk/Makefile2
-rw-r--r--arch/sh/boards/mach-rsk/devices-rsk7203.c (renamed from arch/sh/boards/board-rsk7203.c)76
-rw-r--r--arch/sh/boards/mach-rsk/setup.c106
-rw-r--r--arch/sh/boards/mach-se/7343/Makefile2
-rw-r--r--arch/sh/boards/mach-se/7343/io.c273
-rw-r--r--arch/sh/boards/mach-se/7343/setup.c126
-rw-r--r--arch/sh/boards/mach-se/770x/setup.c4
-rw-r--r--arch/sh/boards/mach-se/7721/setup.c7
-rw-r--r--arch/sh/boards/mach-se/7722/setup.c10
-rw-r--r--arch/sh/boards/mach-sh03/setup.c59
-rw-r--r--arch/sh/boards/mach-systemh/irq.c37
-rw-r--r--arch/sh/cchips/hd6446x/hd64461.c115
-rw-r--r--arch/sh/configs/edosk7705_defconfig438
-rw-r--r--arch/sh/configs/rsk7201_defconfig703
-rw-r--r--arch/sh/configs/rsk7203_defconfig65
-rw-r--r--arch/sh/configs/rts7751r2dplus_qemu_defconfig949
-rw-r--r--arch/sh/configs/se7343_defconfig303
-rw-r--r--arch/sh/drivers/dma/Makefile1
-rw-r--r--arch/sh/drivers/dma/dma-isa.c106
-rw-r--r--arch/sh/drivers/dma/dma-sh.c3
-rw-r--r--arch/sh/drivers/dma/dma-sh.h1
-rw-r--r--arch/sh/drivers/pci/ops-sh03.c3
-rw-r--r--arch/sh/drivers/pci/pci-sh7780.c12
-rw-r--r--arch/sh/include/asm/addrspace.h11
-rw-r--r--arch/sh/include/asm/atomic.h7
-rw-r--r--arch/sh/include/asm/bitops-grb.h3
-rw-r--r--arch/sh/include/asm/bitops-irq.h91
-rw-r--r--arch/sh/include/asm/bitops-llsc.h2
-rw-r--r--arch/sh/include/asm/bitops-op32.h142
-rw-r--r--arch/sh/include/asm/bitops.h9
-rw-r--r--arch/sh/include/asm/bugs.h2
-rw-r--r--arch/sh/include/asm/elf.h4
-rw-r--r--arch/sh/include/asm/ftrace.h28
-rw-r--r--arch/sh/include/asm/io.h4
-rw-r--r--arch/sh/include/asm/kgdb.h66
-rw-r--r--arch/sh/include/asm/machvec.h5
-rw-r--r--arch/sh/include/asm/mmu_context.h4
-rw-r--r--arch/sh/include/asm/mutex-llsc.h112
-rw-r--r--arch/sh/include/asm/mutex.h5
-rw-r--r--arch/sh/include/asm/pm.h17
-rw-r--r--arch/sh/include/asm/processor.h5
-rw-r--r--arch/sh/include/asm/processor_32.h12
-rw-r--r--arch/sh/include/asm/processor_64.h4
-rw-r--r--arch/sh/include/asm/ptrace.h2
-rw-r--r--arch/sh/include/asm/sh_bios.h1
-rw-r--r--arch/sh/include/asm/smp.h2
-rw-r--r--arch/sh/include/asm/string_64.h21
-rw-r--r--arch/sh/include/asm/syscall_32.h2
-rw-r--r--arch/sh/include/asm/syscall_64.h76
-rw-r--r--arch/sh/include/asm/system.h2
-rw-r--r--arch/sh/include/asm/topology.h2
-rw-r--r--arch/sh/include/asm/unaligned-sh4a.h258
-rw-r--r--arch/sh/include/asm/unaligned.h7
-rw-r--r--arch/sh/include/cpu-sh3/cpu/gpio.h14
-rw-r--r--arch/sh/include/mach-common/mach/edosk7705.h31
-rw-r--r--arch/sh/include/mach-se/mach/mrshpc.h52
-rw-r--r--arch/sh/include/mach-se/mach/se.h18
-rw-r--r--arch/sh/include/mach-se/mach/se7343.h9
-rw-r--r--arch/sh/kernel/Makefile_3218
-rw-r--r--arch/sh/kernel/Makefile_645
-rw-r--r--arch/sh/kernel/cf-enabler.c168
-rw-r--r--arch/sh/kernel/cpu/clock.c10
-rw-r--r--arch/sh/kernel/cpu/init.c2
-rw-r--r--arch/sh/kernel/cpu/sh2a/Makefile3
-rw-r--r--arch/sh/kernel/cpu/sh2a/clock-sh7201.c85
-rw-r--r--arch/sh/kernel/cpu/sh2a/probe.c7
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-sh7201.c331
-rw-r--r--arch/sh/kernel/cpu/sh3/entry.S14
-rw-r--r--arch/sh/kernel/cpu/sh3/ex.S2
-rw-r--r--arch/sh/kernel/cpu/sh4/softfloat.c73
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7722.c310
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7343.c37
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7366.c19
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7722.c50
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7723.c19
-rw-r--r--arch/sh/kernel/debugtraps.S13
-rw-r--r--arch/sh/kernel/disassemble.c573
-rw-r--r--arch/sh/kernel/entry-common.S54
-rw-r--r--arch/sh/kernel/ftrace.c133
-rw-r--r--arch/sh/kernel/head_32.S12
-rw-r--r--arch/sh/kernel/idle.c81
-rw-r--r--arch/sh/kernel/init_task.c1
-rw-r--r--arch/sh/kernel/kgdb.c285
-rw-r--r--arch/sh/kernel/kgdb_jmp.S33
-rw-r--r--arch/sh/kernel/kgdb_stub.c1052
-rw-r--r--arch/sh/kernel/pm.c88
-rw-r--r--arch/sh/kernel/process_32.c81
-rw-r--r--arch/sh/kernel/process_64.c111
-rw-r--r--arch/sh/kernel/ptrace_64.c186
-rw-r--r--arch/sh/kernel/setup.c1
-rw-r--r--arch/sh/kernel/sh_bios.c65
-rw-r--r--arch/sh/kernel/sh_ksyms_32.c37
-rw-r--r--arch/sh/kernel/sh_ksyms_64.c5
-rw-r--r--arch/sh/kernel/signal_32.c1
-rw-r--r--arch/sh/kernel/signal_64.c154
-rw-r--r--arch/sh/kernel/smp.c10
-rw-r--r--arch/sh/kernel/sys_sh.c92
-rw-r--r--arch/sh/kernel/time_32.c12
-rw-r--r--arch/sh/kernel/time_64.c5
-rw-r--r--arch/sh/kernel/timers/timer-broadcast.c2
-rw-r--r--arch/sh/kernel/timers/timer-mtu2.c5
-rw-r--r--arch/sh/kernel/timers/timer-tmu.c2
-rw-r--r--arch/sh/kernel/traps_32.c37
-rw-r--r--arch/sh/kernel/vsyscall/vsyscall.c3
-rw-r--r--arch/sh/lib/Makefile16
-rw-r--r--arch/sh/lib/ashiftrt.S149
-rw-r--r--arch/sh/lib/ashldi3.c29
-rw-r--r--arch/sh/lib/ashlsi3.S193
-rw-r--r--arch/sh/lib/ashrdi3.c31
-rw-r--r--arch/sh/lib/ashrsi3.S185
-rw-r--r--arch/sh/lib/libgcc.h26
-rw-r--r--arch/sh/lib/lshrdi3.c29
-rw-r--r--arch/sh/lib/lshrsi3.S193
-rw-r--r--arch/sh/lib/mcount.S90
-rw-r--r--arch/sh/lib/movmem.S238
-rw-r--r--arch/sh/lib/udiv_qrnnd.S81
-rw-r--r--arch/sh/lib/udivsi3.S87
-rw-r--r--arch/sh/lib/udivsi3_i4i-Os.S149
-rw-r--r--arch/sh/lib/udivsi3_i4i.S666
-rw-r--r--arch/sh/lib64/Makefile8
-rw-r--r--arch/sh/lib64/c-checksum.c4
-rw-r--r--arch/sh/lib64/memcpy.S201
-rw-r--r--arch/sh/lib64/memcpy.c81
-rw-r--r--arch/sh/lib64/memset.S91
-rw-r--r--arch/sh/lib64/sdivsi3.S131
-rw-r--r--arch/sh/lib64/strcpy.S97
-rw-r--r--arch/sh/lib64/strlen.S33
-rw-r--r--arch/sh/lib64/udivdi3.S120
-rw-r--r--arch/sh/lib64/udivsi3.S59
-rw-r--r--arch/sh/mm/Makefile_321
-rw-r--r--arch/sh/mm/Makefile_641
-rw-r--r--arch/sh/mm/asids-debugfs.c79
-rw-r--r--arch/sh/mm/consistent.c7
-rw-r--r--arch/sh/mm/fault_32.c17
-rw-r--r--arch/sh/mm/init.c3
-rw-r--r--arch/sh/mm/ioremap_32.c3
-rw-r--r--arch/sh/mm/mmap.c94
-rw-r--r--arch/sh/oprofile/Makefile13
-rw-r--r--arch/sh/oprofile/backtrace.c114
-rw-r--r--arch/sh/oprofile/common.c150
-rw-r--r--arch/sh/oprofile/op_impl.h33
-rw-r--r--arch/sh/oprofile/op_model_null.c23
-rw-r--r--arch/sh/oprofile/op_model_sh7750.c172
-rw-r--r--arch/sh/tools/mach-types2
-rw-r--r--arch/sparc/Kconfig510
-rw-r--r--arch/sparc/Kconfig.debug26
-rw-r--r--arch/sparc/Makefile97
-rw-r--r--arch/sparc/boot/.gitignore (renamed from arch/sparc64/boot/.gitignore)4
-rw-r--r--arch/sparc/boot/Makefile38
-rw-r--r--arch/sparc/boot/piggyback_32.c (renamed from arch/sparc/boot/piggyback.c)0
-rw-r--r--arch/sparc/boot/piggyback_64.c (renamed from arch/sparc64/boot/piggyback.c)0
-rw-r--r--arch/sparc/configs/sparc32_defconfig (renamed from arch/sparc/defconfig)0
-rw-r--r--arch/sparc/configs/sparc64_defconfig (renamed from arch/sparc64/defconfig)105
-rw-r--r--arch/sparc/include/asm/Kbuild22
-rw-r--r--arch/sparc/include/asm/asm.h40
-rw-r--r--arch/sparc/include/asm/atomic_32.h2
-rw-r--r--arch/sparc/include/asm/atomic_64.h10
-rw-r--r--arch/sparc/include/asm/bitops_64.h5
-rw-r--r--arch/sparc/include/asm/byteorder.h12
-rw-r--r--arch/sparc/include/asm/device.h12
-rw-r--r--arch/sparc/include/asm/hypervisor.h24
-rw-r--r--arch/sparc/include/asm/ipcbuf.h38
-rw-r--r--arch/sparc/include/asm/ipcbuf_32.h31
-rw-r--r--arch/sparc/include/asm/ipcbuf_64.h28
-rw-r--r--arch/sparc/include/asm/irq_32.h1
-rw-r--r--arch/sparc/include/asm/irq_64.h3
-rw-r--r--arch/sparc/include/asm/irqflags_64.h6
-rw-r--r--arch/sparc/include/asm/jsflash.h2
-rw-r--r--arch/sparc/include/asm/module.h32
-rw-r--r--arch/sparc/include/asm/module_32.h7
-rw-r--r--arch/sparc/include/asm/module_64.h7
-rw-r--r--arch/sparc/include/asm/openprom.h277
-rw-r--r--arch/sparc/include/asm/openprom_32.h255
-rw-r--r--arch/sparc/include/asm/openprom_64.h280
-rw-r--r--arch/sparc/include/asm/oplib_32.h8
-rw-r--r--arch/sparc/include/asm/pil.h9
-rw-r--r--arch/sparc/include/asm/posix_types.h157
-rw-r--r--arch/sparc/include/asm/posix_types_32.h118
-rw-r--r--arch/sparc/include/asm/posix_types_64.h122
-rw-r--r--arch/sparc/include/asm/processor_32.h2
-rw-r--r--arch/sparc/include/asm/ptrace.h448
-rw-r--r--arch/sparc/include/asm/ptrace_32.h186
-rw-r--r--arch/sparc/include/asm/ptrace_64.h356
-rw-r--r--arch/sparc/include/asm/reg.h8
-rw-r--r--arch/sparc/include/asm/reg_32.h79
-rw-r--r--arch/sparc/include/asm/reg_64.h56
-rw-r--r--arch/sparc/include/asm/scatterlist.h33
-rw-r--r--arch/sparc/include/asm/scatterlist_32.h26
-rw-r--r--arch/sparc/include/asm/scatterlist_64.h27
-rw-r--r--arch/sparc/include/asm/sections.h16
-rw-r--r--arch/sparc/include/asm/sections_32.h6
-rw-r--r--arch/sparc/include/asm/sections_64.h9
-rw-r--r--arch/sparc/include/asm/sigcontext.h102
-rw-r--r--arch/sparc/include/asm/sigcontext_32.h62
-rw-r--r--arch/sparc/include/asm/sigcontext_64.h87
-rw-r--r--arch/sparc/include/asm/siginfo.h43
-rw-r--r--arch/sparc/include/asm/siginfo_32.h17
-rw-r--r--arch/sparc/include/asm/siginfo_64.h32
-rw-r--r--arch/sparc/include/asm/signal.h212
-rw-r--r--arch/sparc/include/asm/signal_32.h207
-rw-r--r--arch/sparc/include/asm/signal_64.h194
-rw-r--r--arch/sparc/include/asm/smp_32.h5
-rw-r--r--arch/sparc/include/asm/spinlock_64.h31
-rw-r--r--arch/sparc/include/asm/spitfire.h4
-rw-r--r--arch/sparc/include/asm/stat.h111
-rw-r--r--arch/sparc/include/asm/stat_32.h76
-rw-r--r--arch/sparc/include/asm/stat_64.h47
-rw-r--r--arch/sparc/include/asm/system_32.h5
-rw-r--r--arch/sparc/include/asm/system_64.h46
-rw-r--r--arch/sparc/include/asm/thread_info_32.h2
-rw-r--r--arch/sparc/include/asm/topology_64.h13
-rw-r--r--arch/sparc/include/asm/traps.h11
-rw-r--r--arch/sparc/include/asm/tsb.h6
-rw-r--r--arch/sparc/include/asm/ttable.h15
-rw-r--r--arch/sparc/include/asm/unistd.h446
-rw-r--r--arch/sparc/include/asm/unistd_32.h385
-rw-r--r--arch/sparc/include/asm/unistd_64.h380
-rw-r--r--arch/sparc/kernel/.gitignore1
-rw-r--r--arch/sparc/kernel/Makefile117
-rw-r--r--arch/sparc/kernel/asm-offsets.c19
-rw-r--r--arch/sparc/kernel/audit.c (renamed from arch/sparc64/kernel/audit.c)0
-rw-r--r--arch/sparc/kernel/auxio_32.c (renamed from arch/sparc/kernel/auxio.c)0
-rw-r--r--arch/sparc/kernel/auxio_64.c (renamed from arch/sparc64/kernel/auxio.c)70
-rw-r--r--arch/sparc/kernel/central.c (renamed from arch/sparc64/kernel/central.c)0
-rw-r--r--arch/sparc/kernel/cherrs.S (renamed from arch/sparc64/kernel/cherrs.S)10
-rw-r--r--arch/sparc/kernel/chmc.c (renamed from arch/sparc64/kernel/chmc.c)0
-rw-r--r--arch/sparc/kernel/compat_audit.c (renamed from arch/sparc64/kernel/compat_audit.c)3
-rw-r--r--arch/sparc/kernel/cpu.c413
-rw-r--r--arch/sparc/kernel/devices.c2
-rw-r--r--arch/sparc/kernel/ds.c (renamed from arch/sparc64/kernel/ds.c)0
-rw-r--r--arch/sparc/kernel/dtlb_miss.S (renamed from arch/sparc64/kernel/dtlb_miss.S)0
-rw-r--r--arch/sparc/kernel/dtlb_prot.S (renamed from arch/sparc64/kernel/dtlb_prot.S)0
-rw-r--r--arch/sparc/kernel/ebus.c (renamed from arch/sparc64/kernel/ebus.c)0
-rw-r--r--arch/sparc/kernel/entry.h (renamed from arch/sparc64/kernel/entry.h)40
-rw-r--r--arch/sparc/kernel/etrap_32.S (renamed from arch/sparc/kernel/etrap.S)0
-rw-r--r--arch/sparc/kernel/etrap_64.S (renamed from arch/sparc64/kernel/etrap.S)6
-rw-r--r--arch/sparc/kernel/fpu_traps.S (renamed from arch/sparc64/kernel/fpu_traps.S)0
-rw-r--r--arch/sparc/kernel/ftrace.c (renamed from arch/sparc64/kernel/ftrace.c)0
-rw-r--r--arch/sparc/kernel/getsetcc.S (renamed from arch/sparc64/kernel/getsetcc.S)0
-rw-r--r--arch/sparc/kernel/head_32.S (renamed from arch/sparc/kernel/head.S)2
-rw-r--r--arch/sparc/kernel/head_64.S (renamed from arch/sparc64/kernel/head.S)8
-rw-r--r--arch/sparc/kernel/helpers.S (renamed from arch/sparc64/kernel/helpers.S)0
-rw-r--r--arch/sparc/kernel/hvapi.c (renamed from arch/sparc64/kernel/hvapi.c)0
-rw-r--r--arch/sparc/kernel/hvcalls.S (renamed from arch/sparc64/kernel/hvcalls.S)32
-rw-r--r--arch/sparc/kernel/hvtramp.S (renamed from arch/sparc64/kernel/hvtramp.S)5
-rw-r--r--arch/sparc/kernel/idprom.c67
-rw-r--r--arch/sparc/kernel/init_task.c4
-rw-r--r--arch/sparc/kernel/iommu.c (renamed from arch/sparc64/kernel/iommu.c)0
-rw-r--r--arch/sparc/kernel/iommu_common.h (renamed from arch/sparc64/kernel/iommu_common.h)0
-rw-r--r--arch/sparc/kernel/ioport.c4
-rw-r--r--arch/sparc/kernel/irq_32.c (renamed from arch/sparc/kernel/irq.c)9
-rw-r--r--arch/sparc/kernel/irq_64.c (renamed from arch/sparc64/kernel/irq.c)74
-rw-r--r--arch/sparc/kernel/itlb_miss.S (renamed from arch/sparc64/kernel/itlb_miss.S)0
-rw-r--r--arch/sparc/kernel/ivec.S (renamed from arch/sparc64/kernel/ivec.S)0
-rw-r--r--arch/sparc/kernel/kernel.h31
-rw-r--r--arch/sparc/kernel/kgdb_32.c (renamed from arch/sparc/kernel/kgdb.c)12
-rw-r--r--arch/sparc/kernel/kgdb_64.c (renamed from arch/sparc64/kernel/kgdb.c)0
-rw-r--r--arch/sparc/kernel/kprobes.c (renamed from arch/sparc64/kernel/kprobes.c)0
-rw-r--r--arch/sparc/kernel/kstack.h (renamed from arch/sparc64/kernel/kstack.h)0
-rw-r--r--arch/sparc/kernel/ktlb.S (renamed from arch/sparc64/kernel/ktlb.S)0
-rw-r--r--arch/sparc/kernel/ldc.c (renamed from arch/sparc64/kernel/ldc.c)0
-rw-r--r--arch/sparc/kernel/mdesc.c (renamed from arch/sparc64/kernel/mdesc.c)1
-rw-r--r--arch/sparc/kernel/misctrap.S (renamed from arch/sparc64/kernel/misctrap.S)0
-rw-r--r--arch/sparc/kernel/module.c140
-rw-r--r--arch/sparc/kernel/muldiv.c13
-rw-r--r--arch/sparc/kernel/of_device_32.c (renamed from arch/sparc/kernel/of_device.c)0
-rw-r--r--arch/sparc/kernel/of_device_64.c (renamed from arch/sparc64/kernel/of_device.c)22
-rw-r--r--arch/sparc/kernel/pci.c (renamed from arch/sparc64/kernel/pci.c)0
-rw-r--r--arch/sparc/kernel/pci_common.c (renamed from arch/sparc64/kernel/pci_common.c)0
-rw-r--r--arch/sparc/kernel/pci_fire.c (renamed from arch/sparc64/kernel/pci_fire.c)0
-rw-r--r--arch/sparc/kernel/pci_impl.h (renamed from arch/sparc64/kernel/pci_impl.h)0
-rw-r--r--arch/sparc/kernel/pci_msi.c (renamed from arch/sparc64/kernel/pci_msi.c)4
-rw-r--r--arch/sparc/kernel/pci_psycho.c (renamed from arch/sparc64/kernel/pci_psycho.c)5
-rw-r--r--arch/sparc/kernel/pci_sabre.c (renamed from arch/sparc64/kernel/pci_sabre.c)0
-rw-r--r--arch/sparc/kernel/pci_schizo.c (renamed from arch/sparc64/kernel/pci_schizo.c)0
-rw-r--r--arch/sparc/kernel/pci_sun4v.c (renamed from arch/sparc64/kernel/pci_sun4v.c)0
-rw-r--r--arch/sparc/kernel/pci_sun4v.h (renamed from arch/sparc64/kernel/pci_sun4v.h)0
-rw-r--r--arch/sparc/kernel/pci_sun4v_asm.S (renamed from arch/sparc64/kernel/pci_sun4v_asm.S)0
-rw-r--r--arch/sparc/kernel/pcic.c2
-rw-r--r--arch/sparc/kernel/pmc.c18
-rw-r--r--arch/sparc/kernel/power.c (renamed from arch/sparc64/kernel/power.c)0
-rw-r--r--arch/sparc/kernel/process_32.c (renamed from arch/sparc/kernel/process.c)18
-rw-r--r--arch/sparc/kernel/process_64.c (renamed from arch/sparc64/kernel/process.c)0
-rw-r--r--arch/sparc/kernel/prom.h29
-rw-r--r--arch/sparc/kernel/prom_32.c (renamed from arch/sparc/kernel/prom.c)287
-rw-r--r--arch/sparc/kernel/prom_64.c571
-rw-r--r--arch/sparc/kernel/prom_common.c318
-rw-r--r--arch/sparc/kernel/prom_irqtrans.c (renamed from arch/sparc64/kernel/prom.c)854
-rw-r--r--arch/sparc/kernel/psycho_common.c (renamed from arch/sparc64/kernel/psycho_common.c)0
-rw-r--r--arch/sparc/kernel/psycho_common.h (renamed from arch/sparc64/kernel/psycho_common.h)0
-rw-r--r--arch/sparc/kernel/ptrace_32.c (renamed from arch/sparc/kernel/ptrace.c)0
-rw-r--r--arch/sparc/kernel/ptrace_64.c (renamed from arch/sparc64/kernel/ptrace.c)0
-rw-r--r--arch/sparc/kernel/reboot.c (renamed from arch/sparc64/kernel/reboot.c)0
-rw-r--r--arch/sparc/kernel/rtrap_32.S (renamed from arch/sparc/kernel/rtrap.S)0
-rw-r--r--arch/sparc/kernel/rtrap_64.S (renamed from arch/sparc64/kernel/rtrap.S)20
-rw-r--r--arch/sparc/kernel/sbus.c (renamed from arch/sparc64/kernel/sbus.c)0
-rw-r--r--arch/sparc/kernel/setup_32.c (renamed from arch/sparc/kernel/setup.c)9
-rw-r--r--arch/sparc/kernel/setup_64.c (renamed from arch/sparc64/kernel/setup.c)1
-rw-r--r--arch/sparc/kernel/signal32.c (renamed from arch/sparc64/kernel/signal32.c)0
-rw-r--r--arch/sparc/kernel/signal_32.c (renamed from arch/sparc/kernel/signal.c)6
-rw-r--r--arch/sparc/kernel/signal_64.c (renamed from arch/sparc64/kernel/signal.c)0
-rw-r--r--arch/sparc/kernel/smp_32.c (renamed from arch/sparc/kernel/smp.c)6
-rw-r--r--arch/sparc/kernel/smp_64.c (renamed from arch/sparc64/kernel/smp.c)21
-rw-r--r--arch/sparc/kernel/sparc_ksyms_32.c (renamed from arch/sparc/kernel/sparc_ksyms.c)8
-rw-r--r--arch/sparc/kernel/sparc_ksyms_64.c (renamed from arch/sparc64/kernel/sparc64_ksyms.c)11
-rw-r--r--arch/sparc/kernel/spiterrs.S (renamed from arch/sparc64/kernel/spiterrs.S)2
-rw-r--r--arch/sparc/kernel/sstate.c (renamed from arch/sparc64/kernel/sstate.c)0
-rw-r--r--arch/sparc/kernel/stacktrace.c (renamed from arch/sparc64/kernel/stacktrace.c)32
-rw-r--r--arch/sparc/kernel/starfire.c (renamed from arch/sparc64/kernel/starfire.c)0
-rw-r--r--arch/sparc/kernel/sun4c_irq.c2
-rw-r--r--arch/sparc/kernel/sun4d_irq.c3
-rw-r--r--arch/sparc/kernel/sun4m_irq.c2
-rw-r--r--arch/sparc/kernel/sun4v_ivec.S (renamed from arch/sparc64/kernel/sun4v_ivec.S)8
-rw-r--r--arch/sparc/kernel/sun4v_tlb_miss.S (renamed from arch/sparc64/kernel/sun4v_tlb_miss.S)0
-rw-r--r--arch/sparc/kernel/sys32.S (renamed from arch/sparc64/kernel/sys32.S)0
-rw-r--r--arch/sparc/kernel/sys_sparc32.c (renamed from arch/sparc64/kernel/sys_sparc32.c)0
-rw-r--r--arch/sparc/kernel/sys_sparc_32.c (renamed from arch/sparc/kernel/sys_sparc.c)0
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c (renamed from arch/sparc64/kernel/sys_sparc.c)0
-rw-r--r--arch/sparc/kernel/syscalls.S (renamed from arch/sparc64/kernel/syscalls.S)0
-rw-r--r--arch/sparc/kernel/sysfs.c (renamed from arch/sparc64/kernel/sysfs.c)1
-rw-r--r--arch/sparc/kernel/systbls.h (renamed from arch/sparc64/kernel/systbls.h)0
-rw-r--r--arch/sparc/kernel/systbls_32.S (renamed from arch/sparc/kernel/systbls.S)0
-rw-r--r--arch/sparc/kernel/systbls_64.S (renamed from arch/sparc64/kernel/systbls.S)0
-rw-r--r--arch/sparc/kernel/time_32.c (renamed from arch/sparc/kernel/time.c)0
-rw-r--r--arch/sparc/kernel/time_64.c (renamed from arch/sparc64/kernel/time.c)2
-rw-r--r--arch/sparc/kernel/trampoline_32.S (renamed from arch/sparc/kernel/trampoline.S)0
-rw-r--r--arch/sparc/kernel/trampoline_64.S (renamed from arch/sparc64/kernel/trampoline.S)4
-rw-r--r--arch/sparc/kernel/traps_32.c (renamed from arch/sparc/kernel/traps.c)38
-rw-r--r--arch/sparc/kernel/traps_64.c (renamed from arch/sparc64/kernel/traps.c)5
-rw-r--r--arch/sparc/kernel/tsb.S (renamed from arch/sparc64/kernel/tsb.S)6
-rw-r--r--arch/sparc/kernel/ttable.S (renamed from arch/sparc64/kernel/ttable.S)2
-rw-r--r--arch/sparc/kernel/una_asm_32.S (renamed from arch/sparc/kernel/una_asm.S)0
-rw-r--r--arch/sparc/kernel/una_asm_64.S (renamed from arch/sparc64/kernel/una_asm.S)0
-rw-r--r--arch/sparc/kernel/unaligned_32.c (renamed from arch/sparc/kernel/unaligned.c)12
-rw-r--r--arch/sparc/kernel/unaligned_64.c (renamed from arch/sparc64/kernel/unaligned.c)0
-rw-r--r--arch/sparc/kernel/us2e_cpufreq.c (renamed from arch/sparc64/kernel/us2e_cpufreq.c)0
-rw-r--r--arch/sparc/kernel/us3_cpufreq.c (renamed from arch/sparc64/kernel/us3_cpufreq.c)0
-rw-r--r--arch/sparc/kernel/utrap.S (renamed from arch/sparc64/kernel/utrap.S)0
-rw-r--r--arch/sparc/kernel/vio.c (renamed from arch/sparc64/kernel/vio.c)0
-rw-r--r--arch/sparc/kernel/viohs.c (renamed from arch/sparc64/kernel/viohs.c)0
-rw-r--r--arch/sparc/kernel/visemul.c (renamed from arch/sparc64/kernel/visemul.c)0
-rw-r--r--arch/sparc/kernel/vmlinux.lds.S109
-rw-r--r--arch/sparc/kernel/windows.c6
-rw-r--r--arch/sparc/kernel/winfixup.S (renamed from arch/sparc64/kernel/winfixup.S)0
-rw-r--r--arch/sparc/lib/GENbzero.S (renamed from arch/sparc64/lib/GENbzero.S)0
-rw-r--r--arch/sparc/lib/GENcopy_from_user.S (renamed from arch/sparc64/lib/GENcopy_from_user.S)0
-rw-r--r--arch/sparc/lib/GENcopy_to_user.S (renamed from arch/sparc64/lib/GENcopy_to_user.S)0
-rw-r--r--arch/sparc/lib/GENmemcpy.S (renamed from arch/sparc64/lib/GENmemcpy.S)0
-rw-r--r--arch/sparc/lib/GENpage.S (renamed from arch/sparc64/lib/GENpage.S)0
-rw-r--r--arch/sparc/lib/GENpatch.S (renamed from arch/sparc64/lib/GENpatch.S)0
-rw-r--r--arch/sparc/lib/Makefile47
-rw-r--r--arch/sparc/lib/NG2copy_from_user.S (renamed from arch/sparc64/lib/NG2copy_from_user.S)0
-rw-r--r--arch/sparc/lib/NG2copy_to_user.S (renamed from arch/sparc64/lib/NG2copy_to_user.S)0
-rw-r--r--arch/sparc/lib/NG2memcpy.S (renamed from arch/sparc64/lib/NG2memcpy.S)0
-rw-r--r--arch/sparc/lib/NG2page.S (renamed from arch/sparc64/lib/NG2page.S)0
-rw-r--r--arch/sparc/lib/NG2patch.S (renamed from arch/sparc64/lib/NG2patch.S)0
-rw-r--r--arch/sparc/lib/NGbzero.S (renamed from arch/sparc64/lib/NGbzero.S)0
-rw-r--r--arch/sparc/lib/NGcopy_from_user.S (renamed from arch/sparc64/lib/NGcopy_from_user.S)0
-rw-r--r--arch/sparc/lib/NGcopy_to_user.S (renamed from arch/sparc64/lib/NGcopy_to_user.S)0
-rw-r--r--arch/sparc/lib/NGmemcpy.S (renamed from arch/sparc64/lib/NGmemcpy.S)0
-rw-r--r--arch/sparc/lib/NGpage.S (renamed from arch/sparc64/lib/NGpage.S)0
-rw-r--r--arch/sparc/lib/NGpatch.S (renamed from arch/sparc64/lib/NGpatch.S)0
-rw-r--r--arch/sparc/lib/PeeCeeI.c (renamed from arch/sparc64/lib/PeeCeeI.c)0
-rw-r--r--arch/sparc/lib/U1copy_from_user.S (renamed from arch/sparc64/lib/U1copy_from_user.S)0
-rw-r--r--arch/sparc/lib/U1copy_to_user.S (renamed from arch/sparc64/lib/U1copy_to_user.S)0
-rw-r--r--arch/sparc/lib/U1memcpy.S (renamed from arch/sparc64/lib/U1memcpy.S)0
-rw-r--r--arch/sparc/lib/U3copy_from_user.S (renamed from arch/sparc64/lib/U3copy_from_user.S)0
-rw-r--r--arch/sparc/lib/U3copy_to_user.S (renamed from arch/sparc64/lib/U3copy_to_user.S)0
-rw-r--r--arch/sparc/lib/U3memcpy.S (renamed from arch/sparc64/lib/U3memcpy.S)0
-rw-r--r--arch/sparc/lib/U3patch.S (renamed from arch/sparc64/lib/U3patch.S)0
-rw-r--r--arch/sparc/lib/VISsave.S (renamed from arch/sparc64/lib/VISsave.S)0
-rw-r--r--arch/sparc/lib/atomic_32.S (renamed from arch/sparc/lib/atomic.S)0
-rw-r--r--arch/sparc/lib/atomic_64.S (renamed from arch/sparc64/lib/atomic.S)26
-rw-r--r--arch/sparc/lib/bitops.S (renamed from arch/sparc64/lib/bitops.S)24
-rw-r--r--arch/sparc/lib/bzero.S (renamed from arch/sparc64/lib/bzero.S)0
-rw-r--r--arch/sparc/lib/checksum_32.S (renamed from arch/sparc/lib/checksum.S)0
-rw-r--r--arch/sparc/lib/checksum_64.S (renamed from arch/sparc64/lib/checksum.S)0
-rw-r--r--arch/sparc/lib/clear_page.S (renamed from arch/sparc64/lib/clear_page.S)0
-rw-r--r--arch/sparc/lib/copy_in_user.S (renamed from arch/sparc64/lib/copy_in_user.S)0
-rw-r--r--arch/sparc/lib/copy_page.S (renamed from arch/sparc64/lib/copy_page.S)0
-rw-r--r--arch/sparc/lib/csum_copy.S (renamed from arch/sparc64/lib/csum_copy.S)0
-rw-r--r--arch/sparc/lib/csum_copy_from_user.S (renamed from arch/sparc64/lib/csum_copy_from_user.S)0
-rw-r--r--arch/sparc/lib/csum_copy_to_user.S (renamed from arch/sparc64/lib/csum_copy_to_user.S)0
-rw-r--r--arch/sparc/lib/ipcsum.S (renamed from arch/sparc64/lib/ipcsum.S)0
-rw-r--r--arch/sparc/lib/mcount.S (renamed from arch/sparc64/lib/mcount.S)0
-rw-r--r--arch/sparc/lib/memcmp.S329
-rw-r--r--arch/sparc/lib/memmove.S (renamed from arch/sparc64/lib/memmove.S)0
-rw-r--r--arch/sparc/lib/memscan_32.S (renamed from arch/sparc/lib/memscan.S)0
-rw-r--r--arch/sparc/lib/memscan_64.S (renamed from arch/sparc64/lib/memscan.S)0
-rw-r--r--arch/sparc/lib/rwsem_32.S (renamed from arch/sparc/lib/rwsem.S)0
-rw-r--r--arch/sparc/lib/rwsem_64.S (renamed from arch/sparc64/lib/rwsem.S)7
-rw-r--r--arch/sparc/lib/strlen.S79
-rw-r--r--arch/sparc/lib/strlen_user_32.S (renamed from arch/sparc/lib/strlen_user.S)0
-rw-r--r--arch/sparc/lib/strlen_user_64.S (renamed from arch/sparc64/lib/strlen_user.S)0
-rw-r--r--arch/sparc/lib/strncmp_32.S (renamed from arch/sparc/lib/strncmp.S)0
-rw-r--r--arch/sparc/lib/strncmp_64.S (renamed from arch/sparc64/lib/strncmp.S)0
-rw-r--r--arch/sparc/lib/strncpy_from_user_32.S (renamed from arch/sparc/lib/strncpy_from_user.S)0
-rw-r--r--arch/sparc/lib/strncpy_from_user_64.S (renamed from arch/sparc64/lib/strncpy_from_user.S)0
-rw-r--r--arch/sparc/lib/user_fixup.c (renamed from arch/sparc64/lib/user_fixup.c)0
-rw-r--r--arch/sparc/lib/xor.S (renamed from arch/sparc64/lib/xor.S)0
-rw-r--r--arch/sparc/math-emu/Makefile6
-rw-r--r--arch/sparc/math-emu/ashldi3.S36
-rw-r--r--arch/sparc/math-emu/math_32.c (renamed from arch/sparc/math-emu/math.c)2
-rw-r--r--arch/sparc/math-emu/math_64.c (renamed from arch/sparc64/math-emu/math.c)2
-rw-r--r--arch/sparc/math-emu/sfp-util_32.h (renamed from arch/sparc/math-emu/sfp-util.h)0
-rw-r--r--arch/sparc/math-emu/sfp-util_64.h (renamed from arch/sparc64/math-emu/sfp-util.h)0
-rw-r--r--arch/sparc/mm/Makefile24
-rw-r--r--arch/sparc/mm/fault_32.c (renamed from arch/sparc/mm/fault.c)0
-rw-r--r--arch/sparc/mm/fault_64.c (renamed from arch/sparc64/mm/fault.c)0
-rw-r--r--arch/sparc/mm/generic_32.c (renamed from arch/sparc/mm/generic.c)0
-rw-r--r--arch/sparc/mm/generic_64.c (renamed from arch/sparc64/mm/generic.c)0
-rw-r--r--arch/sparc/mm/hugetlbpage.c (renamed from arch/sparc64/mm/hugetlbpage.c)0
-rw-r--r--arch/sparc/mm/init_32.c (renamed from arch/sparc/mm/init.c)14
-rw-r--r--arch/sparc/mm/init_64.c (renamed from arch/sparc64/mm/init.c)6
-rw-r--r--arch/sparc/mm/init_64.h (renamed from arch/sparc64/mm/init.h)0
-rw-r--r--arch/sparc/mm/io-unit.c8
-rw-r--r--arch/sparc/mm/iommu.c16
-rw-r--r--arch/sparc/mm/srmmu.c25
-rw-r--r--arch/sparc/mm/sun4c.c12
-rw-r--r--arch/sparc/mm/tlb.c (renamed from arch/sparc64/mm/tlb.c)0
-rw-r--r--arch/sparc/mm/tsb.c (renamed from arch/sparc64/mm/tsb.c)25
-rw-r--r--arch/sparc/mm/ultra.S (renamed from arch/sparc64/mm/ultra.S)6
-rw-r--r--arch/sparc/oprofile/init.c229
-rw-r--r--arch/sparc/prom/Makefile19
-rw-r--r--arch/sparc/prom/bootstr_32.c (renamed from arch/sparc/prom/bootstr.c)0
-rw-r--r--arch/sparc/prom/bootstr_64.c (renamed from arch/sparc64/prom/bootstr.c)0
-rw-r--r--arch/sparc/prom/cif.S (renamed from arch/sparc64/prom/cif.S)0
-rw-r--r--arch/sparc/prom/console_32.c (renamed from arch/sparc/prom/console.c)0
-rw-r--r--arch/sparc/prom/console_64.c (renamed from arch/sparc64/prom/console.c)0
-rw-r--r--arch/sparc/prom/devops_32.c (renamed from arch/sparc/prom/devops.c)0
-rw-r--r--arch/sparc/prom/devops_64.c (renamed from arch/sparc64/prom/devops.c)0
-rw-r--r--arch/sparc/prom/init_32.c (renamed from arch/sparc/prom/init.c)0
-rw-r--r--arch/sparc/prom/init_64.c (renamed from arch/sparc64/prom/init.c)0
-rw-r--r--arch/sparc/prom/misc_32.c (renamed from arch/sparc/prom/misc.c)2
-rw-r--r--arch/sparc/prom/misc_64.c (renamed from arch/sparc64/prom/misc.c)0
-rw-r--r--arch/sparc/prom/p1275.c (renamed from arch/sparc64/prom/p1275.c)0
-rw-r--r--arch/sparc/prom/printf.c5
-rw-r--r--arch/sparc/prom/tree_32.c (renamed from arch/sparc/prom/tree.c)6
-rw-r--r--arch/sparc/prom/tree_64.c (renamed from arch/sparc64/prom/tree.c)0
-rw-r--r--arch/sparc64/Kconfig433
-rw-r--r--arch/sparc64/Kconfig.debug44
-rw-r--r--arch/sparc64/Makefile48
-rw-r--r--arch/sparc64/boot/Makefile33
-rw-r--r--arch/sparc64/kernel/Makefile36
-rw-r--r--arch/sparc64/kernel/asm-offsets.c1
-rw-r--r--arch/sparc64/kernel/cpu.c166
-rw-r--r--arch/sparc64/kernel/idprom.c49
-rw-r--r--arch/sparc64/kernel/init_task.c35
-rw-r--r--arch/sparc64/kernel/module.c213
-rw-r--r--arch/sparc64/kernel/vmlinux.lds.S147
-rw-r--r--arch/sparc64/lib/Makefile23
-rw-r--r--arch/sparc64/lib/iomap.c48
-rw-r--r--arch/sparc64/lib/memcmp.S28
-rw-r--r--arch/sparc64/lib/strlen.S80
-rw-r--r--arch/sparc64/math-emu/Makefile7
-rw-r--r--arch/sparc64/mm/Makefile9
-rw-r--r--arch/sparc64/oprofile/Makefile9
-rw-r--r--arch/sparc64/oprofile/init.c23
-rw-r--r--arch/sparc64/prom/Makefile9
-rw-r--r--arch/sparc64/prom/printf.c47
-rw-r--r--arch/um/Makefile25
-rw-r--r--arch/um/drivers/daemon_kern.c2
-rw-r--r--arch/um/drivers/mcast_kern.c2
-rw-r--r--arch/um/drivers/mconsole_kern.c3
-rw-r--r--arch/um/drivers/net_kern.c29
-rw-r--r--arch/um/drivers/pcap_kern.c2
-rw-r--r--arch/um/drivers/slip_kern.c2
-rw-r--r--arch/um/drivers/slirp_kern.c2
-rw-r--r--arch/um/drivers/vde_kern.c2
-rw-r--r--arch/um/kernel/init_task.c1
-rw-r--r--arch/um/kernel/smp.c7
-rw-r--r--arch/um/kernel/time.c2
-rw-r--r--arch/um/kernel/trap.c24
-rw-r--r--arch/um/os-Linux/drivers/ethertap_kern.c2
-rw-r--r--arch/um/os-Linux/drivers/tuntap_kern.c2
-rw-r--r--arch/x86/Kconfig141
-rw-r--r--arch/x86/Kconfig.cpu4
-rw-r--r--arch/x86/Kconfig.debug24
-rw-r--r--arch/x86/boot/video-vga.c4
-rw-r--r--arch/x86/boot/video.c2
-rw-r--r--arch/x86/configs/i386_defconfig4
-rw-r--r--arch/x86/configs/x86_64_defconfig4
-rw-r--r--arch/x86/crypto/crc32c-intel.c121
-rw-r--r--arch/x86/ia32/ia32_aout.c2
-rw-r--r--arch/x86/ia32/ia32_signal.c110
-rw-r--r--arch/x86/ia32/ipc32.c1
-rw-r--r--arch/x86/ia32/sys_ia32.c2
-rw-r--r--arch/x86/include/asm/amd_iommu_types.h61
-rw-r--r--arch/x86/include/asm/apic.h4
-rw-r--r--arch/x86/include/asm/atomic_32.h10
-rw-r--r--arch/x86/include/asm/atomic_64.h18
-rw-r--r--arch/x86/include/asm/bigsmp/apic.h34
-rw-r--r--arch/x86/include/asm/bigsmp/ipi.h13
-rw-r--r--arch/x86/include/asm/bitops.h10
-rw-r--r--arch/x86/include/asm/bug.h2
-rw-r--r--arch/x86/include/asm/byteorder.h74
-rw-r--r--arch/x86/include/asm/cpufeature.h5
-rw-r--r--arch/x86/include/asm/desc.h10
-rw-r--r--arch/x86/include/asm/dma-mapping.h4
-rw-r--r--arch/x86/include/asm/ds.h312
-rw-r--r--arch/x86/include/asm/dwarf2.h97
-rw-r--r--arch/x86/include/asm/efi.h1
-rw-r--r--arch/x86/include/asm/elf.h2
-rw-r--r--arch/x86/include/asm/emergency-restart.h4
-rw-r--r--arch/x86/include/asm/es7000/apic.h123
-rw-r--r--arch/x86/include/asm/es7000/ipi.h12
-rw-r--r--arch/x86/include/asm/es7000/wakecpu.h41
-rw-r--r--arch/x86/include/asm/ftrace.h61
-rw-r--r--arch/x86/include/asm/gart.h33
-rw-r--r--arch/x86/include/asm/genapic_32.h32
-rw-r--r--arch/x86/include/asm/genapic_64.h16
-rw-r--r--arch/x86/include/asm/hardirq_32.h2
-rw-r--r--arch/x86/include/asm/hardirq_64.h2
-rw-r--r--arch/x86/include/asm/hw_irq.h4
-rw-r--r--arch/x86/include/asm/hypervisor.h26
-rw-r--r--arch/x86/include/asm/ia32.h18
-rw-r--r--arch/x86/include/asm/idle.h5
-rw-r--r--arch/x86/include/asm/io.h37
-rw-r--r--arch/x86/include/asm/io_64.h2
-rw-r--r--arch/x86/include/asm/io_apic.h19
-rw-r--r--arch/x86/include/asm/iommu.h35
-rw-r--r--arch/x86/include/asm/ipi.h23
-rw-r--r--arch/x86/include/asm/irq.h7
-rw-r--r--arch/x86/include/asm/irq_regs_32.h2
-rw-r--r--arch/x86/include/asm/irq_vectors.h11
-rw-r--r--arch/x86/include/asm/kexec.h31
-rw-r--r--arch/x86/include/asm/kvm_host.h47
-rw-r--r--arch/x86/include/asm/kvm_x86_emulate.h11
-rw-r--r--arch/x86/include/asm/lguest.h2
-rw-r--r--arch/x86/include/asm/linkage.h60
-rw-r--r--arch/x86/include/asm/mach-default/mach_apic.h30
-rw-r--r--arch/x86/include/asm/mach-default/mach_ipi.h18
-rw-r--r--arch/x86/include/asm/mach-default/mach_wakecpu.h24
-rw-r--r--arch/x86/include/asm/mach-default/smpboot_hooks.h8
-rw-r--r--arch/x86/include/asm/mach-generic/mach_apic.h2
-rw-r--r--arch/x86/include/asm/mach-generic/mach_wakecpu.h12
-rw-r--r--arch/x86/include/asm/mmu_context_32.h13
-rw-r--r--arch/x86/include/asm/mpspec.h2
-rw-r--r--arch/x86/include/asm/msr-index.h2
-rw-r--r--arch/x86/include/asm/msr.h15
-rw-r--r--arch/x86/include/asm/mtrr.h25
-rw-r--r--arch/x86/include/asm/numaq/apic.h16
-rw-r--r--arch/x86/include/asm/numaq/ipi.h13
-rw-r--r--arch/x86/include/asm/numaq/wakecpu.h24
-rw-r--r--arch/x86/include/asm/pci.h14
-rw-r--r--arch/x86/include/asm/pci_64.h1
-rw-r--r--arch/x86/include/asm/pci_x86.h (renamed from arch/x86/pci/pci.h)18
-rw-r--r--arch/x86/include/asm/pgtable-2level.h50
-rw-r--r--arch/x86/include/asm/pgtable-3level.h1
-rw-r--r--arch/x86/include/asm/pgtable.h28
-rw-r--r--arch/x86/include/asm/pgtable_32.h9
-rw-r--r--arch/x86/include/asm/pgtable_64.h28
-rw-r--r--arch/x86/include/asm/prctl.h3
-rw-r--r--arch/x86/include/asm/processor.h17
-rw-r--r--arch/x86/include/asm/ptrace.h43
-rw-r--r--arch/x86/include/asm/reboot.h5
-rw-r--r--arch/x86/include/asm/setup.h7
-rw-r--r--arch/x86/include/asm/sigframe.h70
-rw-r--r--arch/x86/include/asm/signal.h6
-rw-r--r--arch/x86/include/asm/smp.h6
-rw-r--r--arch/x86/include/asm/sparsemem.h2
-rw-r--r--arch/x86/include/asm/summit/apic.h39
-rw-r--r--arch/x86/include/asm/summit/ipi.h9
-rw-r--r--arch/x86/include/asm/svm.h (renamed from arch/x86/kvm/svm.h)0
-rw-r--r--arch/x86/include/asm/swiotlb.h38
-rw-r--r--arch/x86/include/asm/sys_ia32.h101
-rw-r--r--arch/x86/include/asm/syscalls.h16
-rw-r--r--arch/x86/include/asm/system.h6
-rw-r--r--arch/x86/include/asm/thread_info.h9
-rw-r--r--arch/x86/include/asm/topology.h38
-rw-r--r--arch/x86/include/asm/trampoline.h7
-rw-r--r--arch/x86/include/asm/traps.h11
-rw-r--r--arch/x86/include/asm/tsc.h8
-rw-r--r--arch/x86/include/asm/uaccess.h6
-rw-r--r--arch/x86/include/asm/uaccess_32.h8
-rw-r--r--arch/x86/include/asm/uaccess_64.h6
-rw-r--r--arch/x86/include/asm/unwind.h13
-rw-r--r--arch/x86/include/asm/uv/bios.h34
-rw-r--r--arch/x86/include/asm/uv/uv_bau.h46
-rw-r--r--arch/x86/include/asm/uv/uv_hub.h103
-rw-r--r--arch/x86/include/asm/virtext.h132
-rw-r--r--arch/x86/include/asm/vmware.h27
-rw-r--r--arch/x86/include/asm/vmx.h (renamed from arch/x86/kvm/vmx.h)27
-rw-r--r--arch/x86/include/asm/xen/hypercall.h6
-rw-r--r--arch/x86/include/asm/xen/hypervisor.h39
-rw-r--r--arch/x86/include/asm/xen/page.h5
-rw-r--r--arch/x86/kernel/Makefile11
-rw-r--r--arch/x86/kernel/acpi/boot.c42
-rw-r--r--arch/x86/kernel/amd_iommu.c667
-rw-r--r--arch/x86/kernel/amd_iommu_init.c20
-rw-r--r--arch/x86/kernel/aperture_64.c5
-rw-r--r--arch/x86/kernel/apic.c177
-rw-r--r--arch/x86/kernel/apm_32.c4
-rw-r--r--arch/x86/kernel/asm-offsets_32.c2
-rw-r--r--arch/x86/kernel/asm-offsets_64.c4
-rw-r--r--arch/x86/kernel/bios_uv.c60
-rw-r--r--arch/x86/kernel/check.c161
-rw-r--r--arch/x86/kernel/cpu/Makefile6
-rw-r--r--arch/x86/kernel/cpu/addon_cpuid_features.c8
-rw-r--r--arch/x86/kernel/cpu/amd.c9
-rw-r--r--arch/x86/kernel/cpu/common.c10
-rw-r--r--arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c32
-rw-r--r--arch/x86/kernel/cpu/cpufreq/p4-clockmod.c6
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k7.c9
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c24
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c51
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-lib.c9
-rw-r--r--arch/x86/kernel/cpu/hypervisor.c58
-rw-r--r--arch/x86/kernel/cpu/intel.c23
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c62
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd_64.c110
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_intel_64.c2
-rw-r--r--arch/x86/kernel/cpu/mtrr/generic.c12
-rw-r--r--arch/x86/kernel/cpu/mtrr/main.c356
-rw-r--r--arch/x86/kernel/cpu/mtrr/mtrr.h18
-rw-r--r--arch/x86/kernel/cpu/vmware.c112
-rw-r--r--arch/x86/kernel/cpuid.c8
-rw-r--r--arch/x86/kernel/crash.c86
-rw-r--r--arch/x86/kernel/ds.c1147
-rw-r--r--arch/x86/kernel/dumpstack.c351
-rw-r--r--arch/x86/kernel/dumpstack.h39
-rw-r--r--arch/x86/kernel/dumpstack_32.c307
-rw-r--r--arch/x86/kernel/dumpstack_64.c289
-rw-r--r--arch/x86/kernel/e820.c16
-rw-r--r--arch/x86/kernel/early-quirks.c1
-rw-r--r--arch/x86/kernel/early_printk.c49
-rw-r--r--arch/x86/kernel/entry_32.S528
-rw-r--r--arch/x86/kernel/entry_64.S1458
-rw-r--r--arch/x86/kernel/es7000_32.c62
-rw-r--r--arch/x86/kernel/ftrace.c390
-rw-r--r--arch/x86/kernel/genapic_64.c4
-rw-r--r--arch/x86/kernel/genapic_flat_64.c107
-rw-r--r--arch/x86/kernel/genx2apic_cluster.c81
-rw-r--r--arch/x86/kernel/genx2apic_phys.c78
-rw-r--r--arch/x86/kernel/genx2apic_uv_x.c172
-rw-r--r--arch/x86/kernel/head.c1
-rw-r--r--arch/x86/kernel/head32.c3
-rw-r--r--arch/x86/kernel/head64.c5
-rw-r--r--arch/x86/kernel/hpet.c19
-rw-r--r--arch/x86/kernel/i8253.c2
-rw-r--r--arch/x86/kernel/init_task.c2
-rw-r--r--arch/x86/kernel/io_apic.c1026
-rw-r--r--arch/x86/kernel/ipi.c28
-rw-r--r--arch/x86/kernel/irq.c6
-rw-r--r--arch/x86/kernel/irq_32.c15
-rw-r--r--arch/x86/kernel/irq_64.c44
-rw-r--r--arch/x86/kernel/irqinit_32.c21
-rw-r--r--arch/x86/kernel/irqinit_64.c82
-rw-r--r--arch/x86/kernel/kprobes.c7
-rw-r--r--arch/x86/kernel/kvmclock.c10
-rw-r--r--arch/x86/kernel/ldt.c4
-rw-r--r--arch/x86/kernel/machine_kexec_32.c104
-rw-r--r--arch/x86/kernel/mfgpt_32.c2
-rw-r--r--arch/x86/kernel/microcode_amd.c232
-rw-r--r--arch/x86/kernel/microcode_core.c6
-rw-r--r--arch/x86/kernel/microcode_intel.c2
-rw-r--r--arch/x86/kernel/mmconf-fam10h_64.c3
-rw-r--r--arch/x86/kernel/mpparse.c35
-rw-r--r--arch/x86/kernel/msr.c2
-rw-r--r--arch/x86/kernel/nmi.c61
-rw-r--r--arch/x86/kernel/numaq_32.c10
-rw-r--r--arch/x86/kernel/pci-dma.c24
-rw-r--r--arch/x86/kernel/pci-gart_64.c2
-rw-r--r--arch/x86/kernel/pci-swiotlb_64.c29
-rw-r--r--arch/x86/kernel/process.c35
-rw-r--r--arch/x86/kernel/process_32.c67
-rw-r--r--arch/x86/kernel/process_64.c58
-rw-r--r--arch/x86/kernel/ptrace.c432
-rw-r--r--arch/x86/kernel/quirks.c2
-rw-r--r--arch/x86/kernel/reboot.c189
-rw-r--r--arch/x86/kernel/relocate_kernel_32.S115
-rw-r--r--arch/x86/kernel/setup.c171
-rw-r--r--arch/x86/kernel/setup_percpu.c36
-rw-r--r--arch/x86/kernel/sigframe.h42
-rw-r--r--arch/x86/kernel/signal.c (renamed from arch/x86/kernel/signal_32.c)567
-rw-r--r--arch/x86/kernel/signal_64.c516
-rw-r--r--arch/x86/kernel/smp.c39
-rw-r--r--arch/x86/kernel/smpboot.c73
-rw-r--r--arch/x86/kernel/stacktrace.c64
-rw-r--r--arch/x86/kernel/time_32.c2
-rw-r--r--arch/x86/kernel/time_64.c6
-rw-r--r--arch/x86/kernel/tlb_32.c15
-rw-r--r--arch/x86/kernel/tlb_64.c4
-rw-r--r--arch/x86/kernel/tlb_uv.c13
-rw-r--r--arch/x86/kernel/trampoline.c19
-rw-r--r--arch/x86/kernel/traps.c77
-rw-r--r--arch/x86/kernel/tsc.c42
-rw-r--r--arch/x86/kernel/tsc_sync.c8
-rw-r--r--arch/x86/kernel/vmi_32.c119
-rw-r--r--arch/x86/kernel/vmiclock_32.c2
-rw-r--r--arch/x86/kernel/vmlinux_32.lds.S1
-rw-r--r--arch/x86/kernel/vmlinux_64.lds.S1
-rw-r--r--arch/x86/kernel/vsyscall_64.c12
-rw-r--r--arch/x86/kernel/xsave.c2
-rw-r--r--arch/x86/kvm/Makefile4
-rw-r--r--arch/x86/kvm/i8254.c19
-rw-r--r--arch/x86/kvm/i8259.c52
-rw-r--r--arch/x86/kvm/irq.h6
-rw-r--r--arch/x86/kvm/kvm_svm.h2
-rw-r--r--arch/x86/kvm/lapic.c58
-rw-r--r--arch/x86/kvm/mmu.c444
-rw-r--r--arch/x86/kvm/paging_tmpl.h44
-rw-r--r--arch/x86/kvm/svm.c48
-rw-r--r--arch/x86/kvm/vmx.c350
-rw-r--r--arch/x86/kvm/x86.c120
-rw-r--r--arch/x86/kvm/x86_emulate.c297
-rw-r--r--arch/x86/lguest/boot.c5
-rw-r--r--arch/x86/lguest/i386_head.S15
-rw-r--r--arch/x86/lib/usercopy_32.c8
-rw-r--r--arch/x86/lib/usercopy_64.c4
-rw-r--r--arch/x86/mach-default/setup.c15
-rw-r--r--arch/x86/mach-generic/bigsmp.c6
-rw-r--r--arch/x86/mach-generic/default.c1
-rw-r--r--arch/x86/mach-generic/es7000.c19
-rw-r--r--arch/x86/mach-generic/numaq.c5
-rw-r--r--arch/x86/mach-generic/probe.c16
-rw-r--r--arch/x86/mach-generic/summit.c6
-rw-r--r--arch/x86/mach-voyager/voyager_smp.c16
-rw-r--r--arch/x86/mm/Makefile3
-rw-r--r--arch/x86/mm/fault.c39
-rw-r--r--arch/x86/mm/init_32.c43
-rw-r--r--arch/x86/mm/init_64.c4
-rw-r--r--arch/x86/mm/ioremap.c3
-rw-r--r--arch/x86/mm/numa_64.c4
-rw-r--r--arch/x86/mm/pat.c236
-rw-r--r--arch/x86/mm/srat_64.c2
-rw-r--r--arch/x86/oprofile/op_model_amd.c89
-rw-r--r--arch/x86/pci/acpi.c2
-rw-r--r--arch/x86/pci/amd_bus.c2
-rw-r--r--arch/x86/pci/common.c20
-rw-r--r--arch/x86/pci/direct.c6
-rw-r--r--arch/x86/pci/early.c2
-rw-r--r--arch/x86/pci/fixup.c3
-rw-r--r--arch/x86/pci/i386.c2
-rw-r--r--arch/x86/pci/init.c2
-rw-r--r--arch/x86/pci/irq.c3
-rw-r--r--arch/x86/pci/legacy.c2
-rw-r--r--arch/x86/pci/mmconfig-shared.c3
-rw-r--r--arch/x86/pci/mmconfig_32.c2
-rw-r--r--arch/x86/pci/mmconfig_64.c3
-rw-r--r--arch/x86/pci/numaq_32.c2
-rw-r--r--arch/x86/pci/olpc.c2
-rw-r--r--arch/x86/pci/pcbios.c5
-rw-r--r--arch/x86/pci/visws.c3
-rw-r--r--arch/x86/scripts/strip-symbols1
-rw-r--r--arch/x86/vdso/vclock_gettime.c3
-rw-r--r--arch/x86/vdso/vdso32-setup.c2
-rw-r--r--arch/x86/vdso/vma.c2
-rw-r--r--arch/x86/xen/enlighten.c17
-rw-r--r--arch/x86/xen/mmu.c37
-rw-r--r--arch/x86/xen/multicalls.c2
-rw-r--r--arch/x86/xen/setup.c9
-rw-r--r--arch/x86/xen/smp.c27
-rw-r--r--arch/x86/xen/suspend.c3
-rw-r--r--arch/x86/xen/time.c12
-rw-r--r--arch/x86/xen/xen-ops.h2
-rw-r--r--arch/xtensa/kernel/init_task.c1
-rw-r--r--arch/xtensa/platforms/iss/network.c21
2053 files changed, 70618 insertions, 34962 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index 471e72dbaf8b..2e13aa261929 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -6,6 +6,8 @@ config OPROFILE
6 tristate "OProfile system profiling (EXPERIMENTAL)" 6 tristate "OProfile system profiling (EXPERIMENTAL)"
7 depends on PROFILING 7 depends on PROFILING
8 depends on HAVE_OPROFILE 8 depends on HAVE_OPROFILE
9 select TRACING
10 select RING_BUFFER
9 help 11 help
10 OProfile is a profiling system capable of profiling the 12 OProfile is a profiling system capable of profiling the
11 whole system, include the kernel, kernel modules, libraries, 13 whole system, include the kernel, kernel modules, libraries,
diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h
index ca88e54dec93..62b363584b2b 100644
--- a/arch/alpha/include/asm/atomic.h
+++ b/arch/alpha/include/asm/atomic.h
@@ -1,6 +1,7 @@
1#ifndef _ALPHA_ATOMIC_H 1#ifndef _ALPHA_ATOMIC_H
2#define _ALPHA_ATOMIC_H 2#define _ALPHA_ATOMIC_H
3 3
4#include <linux/types.h>
4#include <asm/barrier.h> 5#include <asm/barrier.h>
5#include <asm/system.h> 6#include <asm/system.h>
6 7
@@ -13,14 +14,6 @@
13 */ 14 */
14 15
15 16
16/*
17 * Counter is volatile to make sure gcc doesn't try to be clever
18 * and move things around on us. We need to use _exactly_ the address
19 * the user gave us, not some alias that contains the same information.
20 */
21typedef struct { volatile int counter; } atomic_t;
22typedef struct { volatile long counter; } atomic64_t;
23
24#define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) 17#define ATOMIC_INIT(i) ( (atomic_t) { (i) } )
25#define ATOMIC64_INIT(i) ( (atomic64_t) { (i) } ) 18#define ATOMIC64_INIT(i) ( (atomic64_t) { (i) } )
26 19
diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h
index e971ab000f95..eda9b909aa05 100644
--- a/arch/alpha/include/asm/io.h
+++ b/arch/alpha/include/asm/io.h
@@ -96,9 +96,6 @@ static inline dma_addr_t __deprecated isa_page_to_bus(struct page *page)
96 return page_to_phys(page); 96 return page_to_phys(page);
97} 97}
98 98
99/* This depends on working iommu. */
100#define BIO_VMERGE_BOUNDARY (alpha_mv.mv_pci_tbi ? PAGE_SIZE : 0)
101
102/* Maximum PIO space address supported? */ 99/* Maximum PIO space address supported? */
103#define IO_SPACE_LIMIT 0xffff 100#define IO_SPACE_LIMIT 0xffff
104 101
diff --git a/arch/alpha/include/asm/smp.h b/arch/alpha/include/asm/smp.h
index 544c69af8168..547e90951cec 100644
--- a/arch/alpha/include/asm/smp.h
+++ b/arch/alpha/include/asm/smp.h
@@ -45,7 +45,6 @@ extern struct cpuinfo_alpha cpu_data[NR_CPUS];
45#define raw_smp_processor_id() (current_thread_info()->cpu) 45#define raw_smp_processor_id() (current_thread_info()->cpu)
46 46
47extern int smp_num_cpus; 47extern int smp_num_cpus;
48#define cpu_possible_map cpu_present_map
49 48
50extern void arch_send_call_function_single_ipi(int cpu); 49extern void arch_send_call_function_single_ipi(int cpu);
51extern void arch_send_call_function_ipi(cpumask_t mask); 50extern void arch_send_call_function_ipi(cpumask_t mask);
diff --git a/arch/alpha/include/asm/topology.h b/arch/alpha/include/asm/topology.h
index 149532e162c4..b4f284c72ff3 100644
--- a/arch/alpha/include/asm/topology.h
+++ b/arch/alpha/include/asm/topology.h
@@ -39,7 +39,24 @@ static inline cpumask_t node_to_cpumask(int node)
39 return node_cpu_mask; 39 return node_cpu_mask;
40} 40}
41 41
42extern struct cpumask node_to_cpumask_map[];
43/* FIXME: This is dumb, recalculating every time. But simple. */
44static const struct cpumask *cpumask_of_node(int node)
45{
46 int cpu;
47
48 cpumask_clear(&node_to_cpumask_map[node]);
49
50 for_each_online_cpu(cpu) {
51 if (cpu_to_node(cpu) == node)
52 cpumask_set_cpu(cpu, node_to_cpumask_map[node]);
53 }
54
55 return &node_to_cpumask_map[node];
56}
57
42#define pcibus_to_cpumask(bus) (cpu_online_map) 58#define pcibus_to_cpumask(bus) (cpu_online_map)
59#define cpumask_of_pcibus(bus) (cpu_online_mask)
43 60
44#endif /* !CONFIG_NUMA */ 61#endif /* !CONFIG_NUMA */
45# include <asm-generic/topology.h> 62# include <asm-generic/topology.h>
diff --git a/arch/alpha/kernel/Makefile b/arch/alpha/kernel/Makefile
index ac706c1d7ada..b4697759a123 100644
--- a/arch/alpha/kernel/Makefile
+++ b/arch/alpha/kernel/Makefile
@@ -8,7 +8,7 @@ EXTRA_CFLAGS := -Werror -Wno-sign-compare
8 8
9obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o \ 9obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o \
10 irq_alpha.o signal.o setup.o ptrace.o time.o \ 10 irq_alpha.o signal.o setup.o ptrace.o time.o \
11 alpha_ksyms.o systbls.o err_common.o io.o 11 alpha_ksyms.o systbls.o err_common.o io.o binfmt_loader.o
12 12
13obj-$(CONFIG_VGA_HOSE) += console.o 13obj-$(CONFIG_VGA_HOSE) += console.o
14obj-$(CONFIG_SMP) += smp.o 14obj-$(CONFIG_SMP) += smp.o
diff --git a/arch/alpha/kernel/asm-offsets.c b/arch/alpha/kernel/asm-offsets.c
index 4b18cd94d59d..6ff8886e7e22 100644
--- a/arch/alpha/kernel/asm-offsets.c
+++ b/arch/alpha/kernel/asm-offsets.c
@@ -19,15 +19,18 @@ void foo(void)
19 BLANK(); 19 BLANK();
20 20
21 DEFINE(TASK_BLOCKED, offsetof(struct task_struct, blocked)); 21 DEFINE(TASK_BLOCKED, offsetof(struct task_struct, blocked));
22 DEFINE(TASK_UID, offsetof(struct task_struct, uid)); 22 DEFINE(TASK_CRED, offsetof(struct task_struct, cred));
23 DEFINE(TASK_EUID, offsetof(struct task_struct, euid));
24 DEFINE(TASK_GID, offsetof(struct task_struct, gid));
25 DEFINE(TASK_EGID, offsetof(struct task_struct, egid));
26 DEFINE(TASK_REAL_PARENT, offsetof(struct task_struct, real_parent)); 23 DEFINE(TASK_REAL_PARENT, offsetof(struct task_struct, real_parent));
27 DEFINE(TASK_GROUP_LEADER, offsetof(struct task_struct, group_leader)); 24 DEFINE(TASK_GROUP_LEADER, offsetof(struct task_struct, group_leader));
28 DEFINE(TASK_TGID, offsetof(struct task_struct, tgid)); 25 DEFINE(TASK_TGID, offsetof(struct task_struct, tgid));
29 BLANK(); 26 BLANK();
30 27
28 DEFINE(CRED_UID, offsetof(struct cred, uid));
29 DEFINE(CRED_EUID, offsetof(struct cred, euid));
30 DEFINE(CRED_GID, offsetof(struct cred, gid));
31 DEFINE(CRED_EGID, offsetof(struct cred, egid));
32 BLANK();
33
31 DEFINE(SIZEOF_PT_REGS, sizeof(struct pt_regs)); 34 DEFINE(SIZEOF_PT_REGS, sizeof(struct pt_regs));
32 DEFINE(PT_PTRACED, PT_PTRACED); 35 DEFINE(PT_PTRACED, PT_PTRACED);
33 DEFINE(CLONE_VM, CLONE_VM); 36 DEFINE(CLONE_VM, CLONE_VM);
diff --git a/arch/alpha/kernel/binfmt_loader.c b/arch/alpha/kernel/binfmt_loader.c
new file mode 100644
index 000000000000..4a0af906b00a
--- /dev/null
+++ b/arch/alpha/kernel/binfmt_loader.c
@@ -0,0 +1,51 @@
1#include <linux/init.h>
2#include <linux/fs.h>
3#include <linux/file.h>
4#include <linux/mm_types.h>
5#include <linux/binfmts.h>
6#include <linux/a.out.h>
7
8static int load_binary(struct linux_binprm *bprm, struct pt_regs *regs)
9{
10 struct exec *eh = (struct exec *)bprm->buf;
11 unsigned long loader;
12 struct file *file;
13 int retval;
14
15 if (eh->fh.f_magic != 0x183 || (eh->fh.f_flags & 0x3000) != 0x3000)
16 return -ENOEXEC;
17
18 if (bprm->loader)
19 return -ENOEXEC;
20
21 allow_write_access(bprm->file);
22 fput(bprm->file);
23 bprm->file = NULL;
24
25 loader = bprm->vma->vm_end - sizeof(void *);
26
27 file = open_exec("/sbin/loader");
28 retval = PTR_ERR(file);
29 if (IS_ERR(file))
30 return retval;
31
32 /* Remember if the application is TASO. */
33 bprm->taso = eh->ah.entry < 0x100000000UL;
34
35 bprm->file = file;
36 bprm->loader = loader;
37 retval = prepare_binprm(bprm);
38 if (retval < 0)
39 return retval;
40 return search_binary_handler(bprm,regs);
41}
42
43static struct linux_binfmt loader_format = {
44 .load_binary = load_binary,
45};
46
47static int __init init_loader_binfmt(void)
48{
49 return register_binfmt(&loader_format);
50}
51arch_initcall(init_loader_binfmt);
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
index 5fc61e281ac7..f77345bc66a9 100644
--- a/arch/alpha/kernel/entry.S
+++ b/arch/alpha/kernel/entry.S
@@ -850,8 +850,9 @@ osf_getpriority:
850sys_getxuid: 850sys_getxuid:
851 .prologue 0 851 .prologue 0
852 ldq $2, TI_TASK($8) 852 ldq $2, TI_TASK($8)
853 ldl $0, TASK_UID($2) 853 ldq $3, TASK_CRED($2)
854 ldl $1, TASK_EUID($2) 854 ldl $0, CRED_UID($3)
855 ldl $1, CRED_EUID($3)
855 stq $1, 80($sp) 856 stq $1, 80($sp)
856 ret 857 ret
857.end sys_getxuid 858.end sys_getxuid
@@ -862,8 +863,9 @@ sys_getxuid:
862sys_getxgid: 863sys_getxgid:
863 .prologue 0 864 .prologue 0
864 ldq $2, TI_TASK($8) 865 ldq $2, TI_TASK($8)
865 ldl $0, TASK_GID($2) 866 ldq $3, TASK_CRED($2)
866 ldl $1, TASK_EGID($2) 867 ldl $0, CRED_GID($3)
868 ldl $1, CRED_EGID($3)
867 stq $1, 80($sp) 869 stq $1, 80($sp)
868 ret 870 ret
869.end sys_getxgid 871.end sys_getxgid
diff --git a/arch/alpha/kernel/init_task.c b/arch/alpha/kernel/init_task.c
index 1f762189fa64..c2938e574a40 100644
--- a/arch/alpha/kernel/init_task.c
+++ b/arch/alpha/kernel/init_task.c
@@ -8,7 +8,6 @@
8#include <asm/uaccess.h> 8#include <asm/uaccess.h>
9 9
10 10
11static struct fs_struct init_fs = INIT_FS;
12static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 11static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
13static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 12static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
14struct mm_struct init_mm = INIT_MM(init_mm); 13struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/alpha/kernel/irq.c b/arch/alpha/kernel/irq.c
index c626a821cdcb..703731accda6 100644
--- a/arch/alpha/kernel/irq.c
+++ b/arch/alpha/kernel/irq.c
@@ -50,12 +50,13 @@ int irq_select_affinity(unsigned int irq)
50 if (!irq_desc[irq].chip->set_affinity || irq_user_affinity[irq]) 50 if (!irq_desc[irq].chip->set_affinity || irq_user_affinity[irq])
51 return 1; 51 return 1;
52 52
53 while (!cpu_possible(cpu) || !cpu_isset(cpu, irq_default_affinity)) 53 while (!cpu_possible(cpu) ||
54 !cpumask_test_cpu(cpu, irq_default_affinity))
54 cpu = (cpu < (NR_CPUS-1) ? cpu + 1 : 0); 55 cpu = (cpu < (NR_CPUS-1) ? cpu + 1 : 0);
55 last_cpu = cpu; 56 last_cpu = cpu;
56 57
57 irq_desc[irq].affinity = cpumask_of_cpu(cpu); 58 irq_desc[irq].affinity = cpumask_of_cpu(cpu);
58 irq_desc[irq].chip->set_affinity(irq, cpumask_of_cpu(cpu)); 59 irq_desc[irq].chip->set_affinity(irq, cpumask_of(cpu));
59 return 0; 60 return 0;
60} 61}
61#endif /* CONFIG_SMP */ 62#endif /* CONFIG_SMP */
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index 351407e07e71..f238370c907d 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -94,6 +94,7 @@ common_shutdown_1(void *generic_ptr)
94 flags |= 0x00040000UL; /* "remain halted" */ 94 flags |= 0x00040000UL; /* "remain halted" */
95 *pflags = flags; 95 *pflags = flags;
96 cpu_clear(cpuid, cpu_present_map); 96 cpu_clear(cpuid, cpu_present_map);
97 cpu_clear(cpuid, cpu_possible_map);
97 halt(); 98 halt();
98 } 99 }
99#endif 100#endif
@@ -120,6 +121,7 @@ common_shutdown_1(void *generic_ptr)
120#ifdef CONFIG_SMP 121#ifdef CONFIG_SMP
121 /* Wait for the secondaries to halt. */ 122 /* Wait for the secondaries to halt. */
122 cpu_clear(boot_cpuid, cpu_present_map); 123 cpu_clear(boot_cpuid, cpu_present_map);
124 cpu_clear(boot_cpuid, cpu_possible_map);
123 while (cpus_weight(cpu_present_map)) 125 while (cpus_weight(cpu_present_map))
124 barrier(); 126 barrier();
125#endif 127#endif
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
index a449e999027c..02bee6983ce2 100644
--- a/arch/alpha/kernel/setup.c
+++ b/arch/alpha/kernel/setup.c
@@ -79,6 +79,11 @@ int alpha_l3_cacheshape;
79unsigned long alpha_verbose_mcheck = CONFIG_VERBOSE_MCHECK_ON; 79unsigned long alpha_verbose_mcheck = CONFIG_VERBOSE_MCHECK_ON;
80#endif 80#endif
81 81
82#ifdef CONFIG_NUMA
83struct cpumask node_to_cpumask_map[MAX_NUMNODES] __read_mostly;
84EXPORT_SYMBOL(node_to_cpumask_map);
85#endif
86
82/* Which processor we booted from. */ 87/* Which processor we booted from. */
83int boot_cpuid; 88int boot_cpuid;
84 89
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index cf7da10097bb..d953e510f68d 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -70,11 +70,6 @@ enum ipi_message_type {
70/* Set to a secondary's cpuid when it comes online. */ 70/* Set to a secondary's cpuid when it comes online. */
71static int smp_secondary_alive __devinitdata = 0; 71static int smp_secondary_alive __devinitdata = 0;
72 72
73/* Which cpus ids came online. */
74cpumask_t cpu_online_map;
75
76EXPORT_SYMBOL(cpu_online_map);
77
78int smp_num_probed; /* Internal processor count */ 73int smp_num_probed; /* Internal processor count */
79int smp_num_cpus = 1; /* Number that came online. */ 74int smp_num_cpus = 1; /* Number that came online. */
80EXPORT_SYMBOL(smp_num_cpus); 75EXPORT_SYMBOL(smp_num_cpus);
@@ -440,6 +435,7 @@ setup_smp(void)
440 ((char *)cpubase + i*hwrpb->processor_size); 435 ((char *)cpubase + i*hwrpb->processor_size);
441 if ((cpu->flags & 0x1cc) == 0x1cc) { 436 if ((cpu->flags & 0x1cc) == 0x1cc) {
442 smp_num_probed++; 437 smp_num_probed++;
438 cpu_set(i, cpu_possible_map);
443 cpu_set(i, cpu_present_map); 439 cpu_set(i, cpu_present_map);
444 cpu->pal_revision = boot_cpu_palrev; 440 cpu->pal_revision = boot_cpu_palrev;
445 } 441 }
@@ -473,6 +469,7 @@ smp_prepare_cpus(unsigned int max_cpus)
473 469
474 /* Nothing to do on a UP box, or when told not to. */ 470 /* Nothing to do on a UP box, or when told not to. */
475 if (smp_num_probed == 1 || max_cpus == 0) { 471 if (smp_num_probed == 1 || max_cpus == 0) {
472 cpu_possible_map = cpumask_of_cpu(boot_cpuid);
476 cpu_present_map = cpumask_of_cpu(boot_cpuid); 473 cpu_present_map = cpumask_of_cpu(boot_cpuid);
477 printk(KERN_INFO "SMP mode deactivated.\n"); 474 printk(KERN_INFO "SMP mode deactivated.\n");
478 return; 475 return;
diff --git a/arch/alpha/kernel/sys_dp264.c b/arch/alpha/kernel/sys_dp264.c
index c71b0fd7a61f..ab44c164d9d4 100644
--- a/arch/alpha/kernel/sys_dp264.c
+++ b/arch/alpha/kernel/sys_dp264.c
@@ -177,19 +177,19 @@ cpu_set_irq_affinity(unsigned int irq, cpumask_t affinity)
177} 177}
178 178
179static void 179static void
180dp264_set_affinity(unsigned int irq, cpumask_t affinity) 180dp264_set_affinity(unsigned int irq, const struct cpumask *affinity)
181{ 181{
182 spin_lock(&dp264_irq_lock); 182 spin_lock(&dp264_irq_lock);
183 cpu_set_irq_affinity(irq, affinity); 183 cpu_set_irq_affinity(irq, *affinity);
184 tsunami_update_irq_hw(cached_irq_mask); 184 tsunami_update_irq_hw(cached_irq_mask);
185 spin_unlock(&dp264_irq_lock); 185 spin_unlock(&dp264_irq_lock);
186} 186}
187 187
188static void 188static void
189clipper_set_affinity(unsigned int irq, cpumask_t affinity) 189clipper_set_affinity(unsigned int irq, const struct cpumask *affinity)
190{ 190{
191 spin_lock(&dp264_irq_lock); 191 spin_lock(&dp264_irq_lock);
192 cpu_set_irq_affinity(irq - 16, affinity); 192 cpu_set_irq_affinity(irq - 16, *affinity);
193 tsunami_update_irq_hw(cached_irq_mask); 193 tsunami_update_irq_hw(cached_irq_mask);
194 spin_unlock(&dp264_irq_lock); 194 spin_unlock(&dp264_irq_lock);
195} 195}
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c
index 52c91ccc1648..27f840a4ad3d 100644
--- a/arch/alpha/kernel/sys_titan.c
+++ b/arch/alpha/kernel/sys_titan.c
@@ -158,10 +158,10 @@ titan_cpu_set_irq_affinity(unsigned int irq, cpumask_t affinity)
158} 158}
159 159
160static void 160static void
161titan_set_irq_affinity(unsigned int irq, cpumask_t affinity) 161titan_set_irq_affinity(unsigned int irq, const struct cpumask *affinity)
162{ 162{
163 spin_lock(&titan_irq_lock); 163 spin_lock(&titan_irq_lock);
164 titan_cpu_set_irq_affinity(irq - 16, affinity); 164 titan_cpu_set_irq_affinity(irq - 16, *affinity);
165 titan_update_irq_hw(titan_cached_irq_mask); 165 titan_update_irq_hw(titan_cached_irq_mask);
166 spin_unlock(&titan_irq_lock); 166 spin_unlock(&titan_irq_lock);
167} 167}
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 9722f8bb506c..dbfdf87f993f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -156,7 +156,6 @@ config ARCH_MTD_XIP
156 bool 156 bool
157 157
158config GENERIC_HARDIRQS_NO__DO_IRQ 158config GENERIC_HARDIRQS_NO__DO_IRQ
159 bool
160 def_bool y 159 def_bool y
161 160
162if OPROFILE 161if OPROFILE
@@ -201,6 +200,7 @@ choice
201 200
202config ARCH_AAEC2000 201config ARCH_AAEC2000
203 bool "Agilent AAEC-2000 based" 202 bool "Agilent AAEC-2000 based"
203 select CPU_ARM920T
204 select ARM_AMBA 204 select ARM_AMBA
205 select HAVE_CLK 205 select HAVE_CLK
206 help 206 help
@@ -210,6 +210,7 @@ config ARCH_INTEGRATOR
210 bool "ARM Ltd. Integrator family" 210 bool "ARM Ltd. Integrator family"
211 select ARM_AMBA 211 select ARM_AMBA
212 select HAVE_CLK 212 select HAVE_CLK
213 select COMMON_CLKDEV
213 select ICST525 214 select ICST525
214 help 215 help
215 Support for ARM's Integrator platform. 216 Support for ARM's Integrator platform.
@@ -218,6 +219,7 @@ config ARCH_REALVIEW
218 bool "ARM Ltd. RealView family" 219 bool "ARM Ltd. RealView family"
219 select ARM_AMBA 220 select ARM_AMBA
220 select HAVE_CLK 221 select HAVE_CLK
222 select COMMON_CLKDEV
221 select ICST307 223 select ICST307
222 select GENERIC_TIME 224 select GENERIC_TIME
223 select GENERIC_CLOCKEVENTS 225 select GENERIC_CLOCKEVENTS
@@ -229,6 +231,7 @@ config ARCH_VERSATILE
229 select ARM_AMBA 231 select ARM_AMBA
230 select ARM_VIC 232 select ARM_VIC
231 select HAVE_CLK 233 select HAVE_CLK
234 select COMMON_CLKDEV
232 select ICST307 235 select ICST307
233 select GENERIC_TIME 236 select GENERIC_TIME
234 select GENERIC_CLOCKEVENTS 237 select GENERIC_CLOCKEVENTS
@@ -243,22 +246,15 @@ config ARCH_AT91
243 This enables support for systems based on the Atmel AT91RM9200, 246 This enables support for systems based on the Atmel AT91RM9200,
244 AT91SAM9 and AT91CAP9 processors. 247 AT91SAM9 and AT91CAP9 processors.
245 248
246config ARCH_CLPS7500
247 bool "Cirrus CL-PS7500FE"
248 select TIMER_ACORN
249 select ISA
250 select NO_IOPORT
251 select ARCH_SPARSEMEM_ENABLE
252 help
253 Support for the Cirrus Logic PS7500FE system-on-a-chip.
254
255config ARCH_CLPS711X 249config ARCH_CLPS711X
256 bool "Cirrus Logic CLPS711x/EP721x-based" 250 bool "Cirrus Logic CLPS711x/EP721x-based"
251 select CPU_ARM720T
257 help 252 help
258 Support for Cirrus Logic 711x/721x based boards. 253 Support for Cirrus Logic 711x/721x based boards.
259 254
260config ARCH_EBSA110 255config ARCH_EBSA110
261 bool "EBSA-110" 256 bool "EBSA-110"
257 select CPU_SA110
262 select ISA 258 select ISA
263 select NO_IOPORT 259 select NO_IOPORT
264 help 260 help
@@ -269,16 +265,19 @@ config ARCH_EBSA110
269 265
270config ARCH_EP93XX 266config ARCH_EP93XX
271 bool "EP93xx-based" 267 bool "EP93xx-based"
268 select CPU_ARM920T
272 select ARM_AMBA 269 select ARM_AMBA
273 select ARM_VIC 270 select ARM_VIC
274 select GENERIC_GPIO 271 select GENERIC_GPIO
275 select HAVE_CLK 272 select HAVE_CLK
273 select COMMON_CLKDEV
276 select ARCH_REQUIRE_GPIOLIB 274 select ARCH_REQUIRE_GPIOLIB
277 help 275 help
278 This enables support for the Cirrus EP93xx series of CPUs. 276 This enables support for the Cirrus EP93xx series of CPUs.
279 277
280config ARCH_FOOTBRIDGE 278config ARCH_FOOTBRIDGE
281 bool "FootBridge" 279 bool "FootBridge"
280 select CPU_SA110
282 select FOOTBRIDGE 281 select FOOTBRIDGE
283 help 282 help
284 Support for systems based on the DC21285 companion chip 283 Support for systems based on the DC21285 companion chip
@@ -286,18 +285,23 @@ config ARCH_FOOTBRIDGE
286 285
287config ARCH_NETX 286config ARCH_NETX
288 bool "Hilscher NetX based" 287 bool "Hilscher NetX based"
288 select CPU_ARM926T
289 select ARM_VIC 289 select ARM_VIC
290 select GENERIC_CLOCKEVENTS
291 select GENERIC_TIME
290 help 292 help
291 This enables support for systems based on the Hilscher NetX Soc 293 This enables support for systems based on the Hilscher NetX Soc
292 294
293config ARCH_H720X 295config ARCH_H720X
294 bool "Hynix HMS720x-based" 296 bool "Hynix HMS720x-based"
297 select CPU_ARM720T
295 select ISA_DMA_API 298 select ISA_DMA_API
296 help 299 help
297 This enables support for systems based on the Hynix HMS720x 300 This enables support for systems based on the Hynix HMS720x
298 301
299config ARCH_IMX 302config ARCH_IMX
300 bool "IMX" 303 bool "IMX"
304 select CPU_ARM920T
301 select GENERIC_GPIO 305 select GENERIC_GPIO
302 select GENERIC_TIME 306 select GENERIC_TIME
303 select GENERIC_CLOCKEVENTS 307 select GENERIC_CLOCKEVENTS
@@ -307,6 +311,7 @@ config ARCH_IMX
307config ARCH_IOP13XX 311config ARCH_IOP13XX
308 bool "IOP13xx-based" 312 bool "IOP13xx-based"
309 depends on MMU 313 depends on MMU
314 select CPU_XSC3
310 select PLAT_IOP 315 select PLAT_IOP
311 select PCI 316 select PCI
312 select ARCH_SUPPORTS_MSI 317 select ARCH_SUPPORTS_MSI
@@ -317,6 +322,7 @@ config ARCH_IOP13XX
317config ARCH_IOP32X 322config ARCH_IOP32X
318 bool "IOP32x-based" 323 bool "IOP32x-based"
319 depends on MMU 324 depends on MMU
325 select CPU_XSCALE
320 select PLAT_IOP 326 select PLAT_IOP
321 select PCI 327 select PCI
322 select GENERIC_GPIO 328 select GENERIC_GPIO
@@ -328,6 +334,7 @@ config ARCH_IOP32X
328config ARCH_IOP33X 334config ARCH_IOP33X
329 bool "IOP33x-based" 335 bool "IOP33x-based"
330 depends on MMU 336 depends on MMU
337 select CPU_XSCALE
331 select PLAT_IOP 338 select PLAT_IOP
332 select PCI 339 select PCI
333 select GENERIC_GPIO 340 select GENERIC_GPIO
@@ -338,6 +345,7 @@ config ARCH_IOP33X
338config ARCH_IXP23XX 345config ARCH_IXP23XX
339 bool "IXP23XX-based" 346 bool "IXP23XX-based"
340 depends on MMU 347 depends on MMU
348 select CPU_XSC3
341 select PCI 349 select PCI
342 help 350 help
343 Support for Intel's IXP23xx (XScale) family of processors. 351 Support for Intel's IXP23xx (XScale) family of processors.
@@ -345,6 +353,7 @@ config ARCH_IXP23XX
345config ARCH_IXP2000 353config ARCH_IXP2000
346 bool "IXP2400/2800-based" 354 bool "IXP2400/2800-based"
347 depends on MMU 355 depends on MMU
356 select CPU_XSCALE
348 select PCI 357 select PCI
349 help 358 help
350 Support for Intel's IXP2400/2800 (XScale) family of processors. 359 Support for Intel's IXP2400/2800 (XScale) family of processors.
@@ -352,6 +361,7 @@ config ARCH_IXP2000
352config ARCH_IXP4XX 361config ARCH_IXP4XX
353 bool "IXP4xx-based" 362 bool "IXP4xx-based"
354 depends on MMU 363 depends on MMU
364 select CPU_XSCALE
355 select GENERIC_GPIO 365 select GENERIC_GPIO
356 select GENERIC_TIME 366 select GENERIC_TIME
357 select GENERIC_CLOCKEVENTS 367 select GENERIC_CLOCKEVENTS
@@ -361,6 +371,7 @@ config ARCH_IXP4XX
361 371
362config ARCH_L7200 372config ARCH_L7200
363 bool "LinkUp-L7200" 373 bool "LinkUp-L7200"
374 select CPU_ARM720T
364 select FIQ 375 select FIQ
365 help 376 help
366 Say Y here if you intend to run this kernel on a LinkUp Systems 377 Say Y here if you intend to run this kernel on a LinkUp Systems
@@ -374,7 +385,9 @@ config ARCH_L7200
374 385
375config ARCH_KIRKWOOD 386config ARCH_KIRKWOOD
376 bool "Marvell Kirkwood" 387 bool "Marvell Kirkwood"
388 select CPU_FEROCEON
377 select PCI 389 select PCI
390 select GENERIC_GPIO
378 select GENERIC_TIME 391 select GENERIC_TIME
379 select GENERIC_CLOCKEVENTS 392 select GENERIC_CLOCKEVENTS
380 select PLAT_ORION 393 select PLAT_ORION
@@ -384,13 +397,16 @@ config ARCH_KIRKWOOD
384 397
385config ARCH_KS8695 398config ARCH_KS8695
386 bool "Micrel/Kendin KS8695" 399 bool "Micrel/Kendin KS8695"
400 select CPU_ARM922T
387 select GENERIC_GPIO 401 select GENERIC_GPIO
402 select ARCH_REQUIRE_GPIOLIB
388 help 403 help
389 Support for Micrel/Kendin KS8695 "Centaur" (ARM922T) based 404 Support for Micrel/Kendin KS8695 "Centaur" (ARM922T) based
390 System-on-Chip devices. 405 System-on-Chip devices.
391 406
392config ARCH_NS9XXX 407config ARCH_NS9XXX
393 bool "NetSilicon NS9xxx" 408 bool "NetSilicon NS9xxx"
409 select CPU_ARM926T
394 select GENERIC_GPIO 410 select GENERIC_GPIO
395 select GENERIC_TIME 411 select GENERIC_TIME
396 select GENERIC_CLOCKEVENTS 412 select GENERIC_CLOCKEVENTS
@@ -403,6 +419,7 @@ config ARCH_NS9XXX
403 419
404config ARCH_LOKI 420config ARCH_LOKI
405 bool "Marvell Loki (88RC8480)" 421 bool "Marvell Loki (88RC8480)"
422 select CPU_FEROCEON
406 select GENERIC_TIME 423 select GENERIC_TIME
407 select GENERIC_CLOCKEVENTS 424 select GENERIC_CLOCKEVENTS
408 select PLAT_ORION 425 select PLAT_ORION
@@ -411,7 +428,9 @@ config ARCH_LOKI
411 428
412config ARCH_MV78XX0 429config ARCH_MV78XX0
413 bool "Marvell MV78xx0" 430 bool "Marvell MV78xx0"
431 select CPU_FEROCEON
414 select PCI 432 select PCI
433 select GENERIC_GPIO
415 select GENERIC_TIME 434 select GENERIC_TIME
416 select GENERIC_CLOCKEVENTS 435 select GENERIC_CLOCKEVENTS
417 select PLAT_ORION 436 select PLAT_ORION
@@ -432,6 +451,7 @@ config ARCH_MXC
432config ARCH_ORION5X 451config ARCH_ORION5X
433 bool "Marvell Orion" 452 bool "Marvell Orion"
434 depends on MMU 453 depends on MMU
454 select CPU_FEROCEON
435 select PCI 455 select PCI
436 select GENERIC_GPIO 456 select GENERIC_GPIO
437 select GENERIC_TIME 457 select GENERIC_TIME
@@ -444,6 +464,7 @@ config ARCH_ORION5X
444 464
445config ARCH_PNX4008 465config ARCH_PNX4008
446 bool "Philips Nexperia PNX4008 Mobile" 466 bool "Philips Nexperia PNX4008 Mobile"
467 select CPU_ARM926T
447 select HAVE_CLK 468 select HAVE_CLK
448 help 469 help
449 This enables support for Philips PNX4008 mobile platform. 470 This enables support for Philips PNX4008 mobile platform.
@@ -454,6 +475,7 @@ config ARCH_PXA
454 select ARCH_MTD_XIP 475 select ARCH_MTD_XIP
455 select GENERIC_GPIO 476 select GENERIC_GPIO
456 select HAVE_CLK 477 select HAVE_CLK
478 select COMMON_CLKDEV
457 select ARCH_REQUIRE_GPIOLIB 479 select ARCH_REQUIRE_GPIOLIB
458 select GENERIC_TIME 480 select GENERIC_TIME
459 select GENERIC_CLOCKEVENTS 481 select GENERIC_CLOCKEVENTS
@@ -477,6 +499,7 @@ config ARCH_RPC
477 499
478config ARCH_SA1100 500config ARCH_SA1100
479 bool "SA1100-based" 501 bool "SA1100-based"
502 select CPU_SA1100
480 select ISA 503 select ISA
481 select ARCH_SPARSEMEM_ENABLE 504 select ARCH_SPARSEMEM_ENABLE
482 select ARCH_MTD_XIP 505 select ARCH_MTD_XIP
@@ -498,8 +521,16 @@ config ARCH_S3C2410
498 BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or 521 BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or
499 the Samsung SMDK2410 development board (and derivatives). 522 the Samsung SMDK2410 development board (and derivatives).
500 523
524config ARCH_S3C64XX
525 bool "Samsung S3C64XX"
526 select GENERIC_GPIO
527 select HAVE_CLK
528 help
529 Samsung S3C64XX series based systems
530
501config ARCH_SHARK 531config ARCH_SHARK
502 bool "Shark" 532 bool "Shark"
533 select CPU_SA110
503 select ISA 534 select ISA
504 select ISA_DMA 535 select ISA_DMA
505 select ZONE_DMA 536 select ZONE_DMA
@@ -510,6 +541,7 @@ config ARCH_SHARK
510 541
511config ARCH_LH7A40X 542config ARCH_LH7A40X
512 bool "Sharp LH7A40X" 543 bool "Sharp LH7A40X"
544 select CPU_ARM922T
513 select ARCH_DISCONTIGMEM_ENABLE if !LH7A40X_CONTIGMEM 545 select ARCH_DISCONTIGMEM_ENABLE if !LH7A40X_CONTIGMEM
514 select ARCH_SPARSEMEM_ENABLE if !LH7A40X_CONTIGMEM 546 select ARCH_SPARSEMEM_ENABLE if !LH7A40X_CONTIGMEM
515 help 547 help
@@ -520,6 +552,7 @@ config ARCH_LH7A40X
520 552
521config ARCH_DAVINCI 553config ARCH_DAVINCI
522 bool "TI DaVinci" 554 bool "TI DaVinci"
555 select CPU_ARM926T
523 select GENERIC_TIME 556 select GENERIC_TIME
524 select GENERIC_CLOCKEVENTS 557 select GENERIC_CLOCKEVENTS
525 select GENERIC_GPIO 558 select GENERIC_GPIO
@@ -541,6 +574,7 @@ config ARCH_OMAP
541 574
542config ARCH_MSM 575config ARCH_MSM
543 bool "Qualcomm MSM" 576 bool "Qualcomm MSM"
577 select CPU_V6
544 select GENERIC_TIME 578 select GENERIC_TIME
545 select GENERIC_CLOCKEVENTS 579 select GENERIC_CLOCKEVENTS
546 help 580 help
@@ -549,6 +583,13 @@ config ARCH_MSM
549 interface to the ARM9 modem processor which runs the baseband stack 583 interface to the ARM9 modem processor which runs the baseband stack
550 and controls some vital subsystems (clock and power control, etc). 584 and controls some vital subsystems (clock and power control, etc).
551 585
586config ARCH_W90X900
587 bool "Nuvoton W90X900 CPU"
588 select CPU_ARM926T
589 help
590 Support for Nuvoton (Winbond logic dept.) ARM9 processor,You
591 can login www.mcuos.com or www.nuvoton.com to know more.
592
552endchoice 593endchoice
553 594
554source "arch/arm/mach-clps711x/Kconfig" 595source "arch/arm/mach-clps711x/Kconfig"
@@ -590,6 +631,7 @@ source "arch/arm/mach-orion5x/Kconfig"
590source "arch/arm/mach-kirkwood/Kconfig" 631source "arch/arm/mach-kirkwood/Kconfig"
591 632
592source "arch/arm/plat-s3c24xx/Kconfig" 633source "arch/arm/plat-s3c24xx/Kconfig"
634source "arch/arm/plat-s3c64xx/Kconfig"
593source "arch/arm/plat-s3c/Kconfig" 635source "arch/arm/plat-s3c/Kconfig"
594 636
595if ARCH_S3C2410 637if ARCH_S3C2410
@@ -601,6 +643,11 @@ source "arch/arm/mach-s3c2442/Kconfig"
601source "arch/arm/mach-s3c2443/Kconfig" 643source "arch/arm/mach-s3c2443/Kconfig"
602endif 644endif
603 645
646if ARCH_S3C64XX
647source "arch/arm/mach-s3c6400/Kconfig"
648source "arch/arm/mach-s3c6410/Kconfig"
649endif
650
604source "arch/arm/mach-lh7a40x/Kconfig" 651source "arch/arm/mach-lh7a40x/Kconfig"
605 652
606source "arch/arm/mach-imx/Kconfig" 653source "arch/arm/mach-imx/Kconfig"
@@ -627,6 +674,8 @@ source "arch/arm/mach-ks8695/Kconfig"
627 674
628source "arch/arm/mach-msm/Kconfig" 675source "arch/arm/mach-msm/Kconfig"
629 676
677source "arch/arm/mach-w90x900/Kconfig"
678
630# Definitions to make life easier 679# Definitions to make life easier
631config ARCH_ACORN 680config ARCH_ACORN
632 bool 681 bool
@@ -781,7 +830,7 @@ config HOTPLUG_CPU
781 830
782config LOCAL_TIMERS 831config LOCAL_TIMERS
783 bool "Use local timer interrupts" 832 bool "Use local timer interrupts"
784 depends on SMP && (REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP) 833 depends on SMP && (REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || REALVIEW_EB_A9MP)
785 default y 834 default y
786 help 835 help
787 Enable support for local timers on SMP platforms, rather then the 836 Enable support for local timers on SMP platforms, rather then the
@@ -1276,6 +1325,8 @@ source "drivers/regulator/Kconfig"
1276 1325
1277source "drivers/uio/Kconfig" 1326source "drivers/uio/Kconfig"
1278 1327
1328source "drivers/staging/Kconfig"
1329
1279endmenu 1330endmenu
1280 1331
1281source "fs/Kconfig" 1332source "fs/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index bd6e28115ebb..24e0f0187697 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -76,6 +76,7 @@ tune-$(CONFIG_CPU_SA110) :=-mtune=strongarm110
76tune-$(CONFIG_CPU_SA1100) :=-mtune=strongarm1100 76tune-$(CONFIG_CPU_SA1100) :=-mtune=strongarm1100
77tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale 77tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
78tune-$(CONFIG_CPU_XSC3) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale 78tune-$(CONFIG_CPU_XSC3) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
79tune-$(CONFIG_CPU_FEROCEON) :=$(call cc-option,-mtune=marvell-f,-mtune=xscale)
79tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm) 80tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
80 81
81ifeq ($(CONFIG_AEABI),y) 82ifeq ($(CONFIG_AEABI),y)
@@ -96,7 +97,6 @@ textofs-y := 0x00008000
96 97
97 machine-$(CONFIG_ARCH_RPC) := rpc 98 machine-$(CONFIG_ARCH_RPC) := rpc
98 machine-$(CONFIG_ARCH_EBSA110) := ebsa110 99 machine-$(CONFIG_ARCH_EBSA110) := ebsa110
99 machine-$(CONFIG_ARCH_CLPS7500) := clps7500
100 machine-$(CONFIG_FOOTBRIDGE) := footbridge 100 machine-$(CONFIG_FOOTBRIDGE) := footbridge
101 machine-$(CONFIG_ARCH_SHARK) := shark 101 machine-$(CONFIG_ARCH_SHARK) := shark
102 machine-$(CONFIG_ARCH_SA1100) := sa1100 102 machine-$(CONFIG_ARCH_SA1100) := sa1100
@@ -121,7 +121,10 @@ endif
121 machine-$(CONFIG_ARCH_OMAP3) := omap2 121 machine-$(CONFIG_ARCH_OMAP3) := omap2
122 plat-$(CONFIG_ARCH_OMAP) := omap 122 plat-$(CONFIG_ARCH_OMAP) := omap
123 machine-$(CONFIG_ARCH_S3C2410) := s3c2410 s3c2400 s3c2412 s3c2440 s3c2442 s3c2443 123 machine-$(CONFIG_ARCH_S3C2410) := s3c2410 s3c2400 s3c2412 s3c2440 s3c2442 s3c2443
124 machine-$(CONFIG_ARCH_S3C24A0) := s3c24a0
124 plat-$(CONFIG_PLAT_S3C24XX) := s3c24xx s3c 125 plat-$(CONFIG_PLAT_S3C24XX) := s3c24xx s3c
126 machine-$(CONFIG_ARCH_S3C64XX) := s3c6400 s3c6410
127 plat-$(CONFIG_PLAT_S3C64XX) := s3c64xx s3c
125 machine-$(CONFIG_ARCH_LH7A40X) := lh7a40x 128 machine-$(CONFIG_ARCH_LH7A40X) := lh7a40x
126 machine-$(CONFIG_ARCH_VERSATILE) := versatile 129 machine-$(CONFIG_ARCH_VERSATILE) := versatile
127 machine-$(CONFIG_ARCH_IMX) := imx 130 machine-$(CONFIG_ARCH_IMX) := imx
@@ -139,11 +142,13 @@ endif
139 plat-$(CONFIG_ARCH_MXC) := mxc 142 plat-$(CONFIG_ARCH_MXC) := mxc
140 machine-$(CONFIG_ARCH_MX2) := mx2 143 machine-$(CONFIG_ARCH_MX2) := mx2
141 machine-$(CONFIG_ARCH_MX3) := mx3 144 machine-$(CONFIG_ARCH_MX3) := mx3
145 machine-$(CONFIG_ARCH_MX1) := mx1
142 machine-$(CONFIG_ARCH_ORION5X) := orion5x 146 machine-$(CONFIG_ARCH_ORION5X) := orion5x
143 plat-$(CONFIG_PLAT_ORION) := orion 147 plat-$(CONFIG_PLAT_ORION) := orion
144 machine-$(CONFIG_ARCH_MSM) := msm 148 machine-$(CONFIG_ARCH_MSM) := msm
145 machine-$(CONFIG_ARCH_LOKI) := loki 149 machine-$(CONFIG_ARCH_LOKI) := loki
146 machine-$(CONFIG_ARCH_MV78XX0) := mv78xx0 150 machine-$(CONFIG_ARCH_MV78XX0) := mv78xx0
151 machine-$(CONFIG_ARCH_W90X900) := w90x900
147 152
148ifeq ($(CONFIG_ARCH_EBSA110),y) 153ifeq ($(CONFIG_ARCH_EBSA110),y)
149# This is what happens if you forget the IOCS16 line. 154# This is what happens if you forget the IOCS16 line.
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index c47f2a3f8f8f..fbe5eef1f6c9 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -23,10 +23,6 @@ ifeq ($(CONFIG_ARCH_L7200),y)
23OBJS += head-l7200.o 23OBJS += head-l7200.o
24endif 24endif
25 25
26ifeq ($(CONFIG_ARCH_CLPS7500),y)
27HEAD = head-clps7500.o
28endif
29
30ifeq ($(CONFIG_ARCH_P720T),y) 26ifeq ($(CONFIG_ARCH_P720T),y)
31# Borrow this code from SA1100 27# Borrow this code from SA1100
32OBJS += head-sa1100.o 28OBJS += head-sa1100.o
diff --git a/arch/arm/boot/compressed/head-clps7500.S b/arch/arm/boot/compressed/head-clps7500.S
deleted file mode 100644
index 4f3c78ac30a0..000000000000
--- a/arch/arm/boot/compressed/head-clps7500.S
+++ /dev/null
@@ -1,86 +0,0 @@
1/*
2 * linux/arch/arm/boot/compressed/head-clps7500.S
3 *
4 * Copyright (C) 1999, 2000, 2001 Nexus Electronics Ltd
5 */
6
7
8 /* There are three different ways the kernel can be
9 booted on a 7500 system: from Angel (loaded in RAM), from
10 16-bit ROM or from 32-bit Flash. Luckily, a single kernel
11 image does for them all. */
12 /* This branch is taken if the CPU memory width matches the
13 actual device in use. The default at power on is 16 bits
14 so we must be prepared for a mismatch. */
15 .section ".start", "ax"
162:
17 b 1f
18 .word 0xffff
19 .word 0xb632 @ mov r11, #0x03200000
20 .word 0xe3a0
21 .word 0x0000 @ mov r0, #0
22 .word 0xe3a0
23 .word 0x0080 @ strb r0, [r11, #0x80]
24 .word 0xe5cb
25 .word 0xf000 @ mov pc, #0
26 .word 0xe3a0
271:
28 adr r1, 2b
29 teq r1, #0
30 bne .Langel
31 /* This is a direct-from-ROM boot. Copy the kernel into
32 RAM and run it there. */
33 mov r0, #0x30
34 mcr p15, 0, r0, c1, c0, 0
35 mov r0, #0x13
36 msr cpsr_cxsf, r0
37 mov r12, #0x03000000 @ point to LEDs
38 orr r12, r12, #0x00020000
39 orr r12, r12, #0xba00
40 mov r0, #0x5500
41 str r0, [r12]
42 mov r0, #0x10000000
43 orr r0, r0, #0x8000
44 mov r4, r0
45 ldr r2, =_end
462:
47 ldr r3, [r1], #4
48 str r3, [r0], #4
49 teq r0, r2
50 bne 2b
51 mov r0, #0xff00
52 str r0, [r12]
531:
54 mov r12, #0x03000000 @ point to LEDs
55 orr r12, r12, #0x00020000
56 orr r12, r12, #0xba00
57 mov r0, #0xfe00
58 str r0, [r12]
59
60 adr lr, 1f
61 mov r0, #0
62 mov r1, #14 /* MACH_TYPE_CLPS7500 */
63 mov pc, lr
64.Langel:
65#ifdef CONFIG_ANGELBOOT
66 /* Call Angel to switch into SVC mode. */
67 mov r0, #0x17
68 swi 0x123456
69#endif
70 /* Ensure all interrupts are off and MMU disabled */
71 mrs r0, cpsr
72 orr r0, r0, #0xc0
73 msr cpsr_cxsf, r0
74
75 adr lr, 1b
76 orr lr, lr, #0x10000000
77 mov r0, #0x30 @ MMU off
78 mcr p15, 0, r0, c1, c0, 0
79 mov r0, r0
80 mov pc, lr
81
82 .ltorg
83
841:
85/* And the rest */
86#include "head.S"
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 84a1e0496a3c..77d614232d81 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -624,6 +624,12 @@ proc_types:
624 b __armv4_mmu_cache_off 624 b __armv4_mmu_cache_off
625 b __armv4_mmu_cache_flush 625 b __armv4_mmu_cache_flush
626 626
627 .word 0x56056930
628 .word 0xff0ffff0 @ PXA935
629 b __armv4_mmu_cache_on
630 b __armv4_mmu_cache_off
631 b __armv4_mmu_cache_flush
632
627 .word 0x56050000 @ Feroceon 633 .word 0x56050000 @ Feroceon
628 .word 0xff0f0000 634 .word 0xff0f0000
629 b __armv4_mmu_cache_on 635 b __armv4_mmu_cache_on
@@ -717,6 +723,9 @@ __armv7_mmu_cache_off:
717 bl __armv7_mmu_cache_flush 723 bl __armv7_mmu_cache_flush
718 mov r0, #0 724 mov r0, #0
719 mcr p15, 0, r0, c8, c7, 0 @ invalidate whole TLB 725 mcr p15, 0, r0, c8, c7, 0 @ invalidate whole TLB
726 mcr p15, 0, r0, c7, c5, 6 @ invalidate BTC
727 mcr p15, 0, r0, c7, c10, 4 @ DSB
728 mcr p15, 0, r0, c7, c5, 4 @ ISB
720 mov pc, r12 729 mov pc, r12
721 730
722__arm6_mmu_cache_off: 731__arm6_mmu_cache_off:
@@ -778,12 +787,13 @@ __armv6_mmu_cache_flush:
778__armv7_mmu_cache_flush: 787__armv7_mmu_cache_flush:
779 mrc p15, 0, r10, c0, c1, 5 @ read ID_MMFR1 788 mrc p15, 0, r10, c0, c1, 5 @ read ID_MMFR1
780 tst r10, #0xf << 16 @ hierarchical cache (ARMv7) 789 tst r10, #0xf << 16 @ hierarchical cache (ARMv7)
781 beq hierarchical
782 mov r10, #0 790 mov r10, #0
791 beq hierarchical
783 mcr p15, 0, r10, c7, c14, 0 @ clean+invalidate D 792 mcr p15, 0, r10, c7, c14, 0 @ clean+invalidate D
784 b iflush 793 b iflush
785hierarchical: 794hierarchical:
786 stmfd sp!, {r0-r5, r7, r9-r11} 795 mcr p15, 0, r10, c7, c10, 5 @ DMB
796 stmfd sp!, {r0-r5, r7, r9, r11}
787 mrc p15, 1, r0, c0, c0, 1 @ read clidr 797 mrc p15, 1, r0, c0, c0, 1 @ read clidr
788 ands r3, r0, #0x7000000 @ extract loc from clidr 798 ands r3, r0, #0x7000000 @ extract loc from clidr
789 mov r3, r3, lsr #23 @ left align loc bit field 799 mov r3, r3, lsr #23 @ left align loc bit field
@@ -820,12 +830,14 @@ skip:
820 cmp r3, r10 830 cmp r3, r10
821 bgt loop1 831 bgt loop1
822finished: 832finished:
833 ldmfd sp!, {r0-r5, r7, r9, r11}
823 mov r10, #0 @ swith back to cache level 0 834 mov r10, #0 @ swith back to cache level 0
824 mcr p15, 2, r10, c0, c0, 0 @ select current cache level in cssr 835 mcr p15, 2, r10, c0, c0, 0 @ select current cache level in cssr
825 ldmfd sp!, {r0-r5, r7, r9-r11}
826iflush: 836iflush:
837 mcr p15, 0, r10, c7, c10, 4 @ DSB
827 mcr p15, 0, r10, c7, c5, 0 @ invalidate I+BTB 838 mcr p15, 0, r10, c7, c5, 0 @ invalidate I+BTB
828 mcr p15, 0, r10, c7, c10, 4 @ drain WB 839 mcr p15, 0, r10, c7, c10, 4 @ DSB
840 mcr p15, 0, r10, c7, c5, 4 @ ISB
829 mov pc, lr 841 mov pc, lr
830 842
831__armv5tej_mmu_cache_flush: 843__armv5tej_mmu_cache_flush:
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index 65ce8fff29db..3fc08413fff0 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -86,6 +86,8 @@ static void putstr(const char *ptr)
86 86
87#define __ptr_t void * 87#define __ptr_t void *
88 88
89#define memzero(s,n) __memzero(s,n)
90
89/* 91/*
90 * Optimised C version of memzero for the ARM. 92 * Optimised C version of memzero for the ARM.
91 */ 93 */
diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig
index 86b5e6982660..a2cd9beaf37d 100644
--- a/arch/arm/common/Kconfig
+++ b/arch/arm/common/Kconfig
@@ -33,3 +33,6 @@ config SHARPSL_PM
33 33
34config SHARP_SCOOP 34config SHARP_SCOOP
35 bool 35 bool
36
37config COMMON_CLKDEV
38 bool
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index 325e4b6a6afb..7cb7961d81cb 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -17,3 +17,4 @@ obj-$(CONFIG_SHARP_SCOOP) += scoop.o
17obj-$(CONFIG_ARCH_IXP2000) += uengine.o 17obj-$(CONFIG_ARCH_IXP2000) += uengine.o
18obj-$(CONFIG_ARCH_IXP23XX) += uengine.o 18obj-$(CONFIG_ARCH_IXP23XX) += uengine.o
19obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o 19obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o
20obj-$(CONFIG_COMMON_CLKDEV) += clkdev.o
diff --git a/arch/arm/common/clkdev.c b/arch/arm/common/clkdev.c
new file mode 100644
index 000000000000..17a17b49a45b
--- /dev/null
+++ b/arch/arm/common/clkdev.c
@@ -0,0 +1,128 @@
1/*
2 * arch/arm/common/clkdev.c
3 *
4 * Copyright (C) 2008 Russell King.
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 * Helper for the clk API to assist looking up a struct clk.
11 */
12#include <linux/module.h>
13#include <linux/kernel.h>
14#include <linux/device.h>
15#include <linux/list.h>
16#include <linux/errno.h>
17#include <linux/err.h>
18#include <linux/string.h>
19#include <linux/mutex.h>
20
21#include <asm/clkdev.h>
22#include <mach/clkdev.h>
23
24static LIST_HEAD(clocks);
25static DEFINE_MUTEX(clocks_mutex);
26
27static struct clk *clk_find(const char *dev_id, const char *con_id)
28{
29 struct clk_lookup *p;
30 struct clk *clk = NULL;
31 int match, best = 0;
32
33 list_for_each_entry(p, &clocks, node) {
34 if ((p->dev_id && !dev_id) || (p->con_id && !con_id))
35 continue;
36 match = 0;
37 if (p->dev_id)
38 match += 2 * (strcmp(p->dev_id, dev_id) == 0);
39 if (p->con_id)
40 match += 1 * (strcmp(p->con_id, con_id) == 0);
41 if (match == 0)
42 continue;
43
44 if (match > best) {
45 clk = p->clk;
46 best = match;
47 }
48 }
49 return clk;
50}
51
52struct clk *clk_get(struct device *dev, const char *con_id)
53{
54 const char *dev_id = dev ? dev_name(dev) : NULL;
55 struct clk *clk;
56
57 mutex_lock(&clocks_mutex);
58 clk = clk_find(dev_id, con_id);
59 if (clk && !__clk_get(clk))
60 clk = NULL;
61 mutex_unlock(&clocks_mutex);
62
63 return clk ? clk : ERR_PTR(-ENOENT);
64}
65EXPORT_SYMBOL(clk_get);
66
67void clk_put(struct clk *clk)
68{
69 __clk_put(clk);
70}
71EXPORT_SYMBOL(clk_put);
72
73void clkdev_add(struct clk_lookup *cl)
74{
75 mutex_lock(&clocks_mutex);
76 list_add_tail(&cl->node, &clocks);
77 mutex_unlock(&clocks_mutex);
78}
79EXPORT_SYMBOL(clkdev_add);
80
81#define MAX_DEV_ID 20
82#define MAX_CON_ID 16
83
84struct clk_lookup_alloc {
85 struct clk_lookup cl;
86 char dev_id[MAX_DEV_ID];
87 char con_id[MAX_CON_ID];
88};
89
90struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,
91 const char *dev_fmt, ...)
92{
93 struct clk_lookup_alloc *cla;
94
95 cla = kzalloc(sizeof(*cla), GFP_KERNEL);
96 if (!cla)
97 return NULL;
98
99 cla->cl.clk = clk;
100 if (con_id) {
101 strlcpy(cla->con_id, con_id, sizeof(cla->con_id));
102 cla->cl.con_id = cla->con_id;
103 }
104
105 if (dev_fmt) {
106 va_list ap;
107
108 va_start(ap, dev_fmt);
109 vscnprintf(cla->dev_id, sizeof(cla->dev_id), dev_fmt, ap);
110 cla->cl.dev_id = cla->dev_id;
111 va_end(ap);
112 }
113
114 return &cla->cl;
115}
116EXPORT_SYMBOL(clkdev_alloc);
117
118/*
119 * clkdev_drop - remove a clock dynamically allocated
120 */
121void clkdev_drop(struct clk_lookup *cl)
122{
123 mutex_lock(&clocks_mutex);
124 list_del(&cl->node);
125 mutex_unlock(&clocks_mutex);
126 kfree(cl);
127}
128EXPORT_SYMBOL(clkdev_drop);
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index 7fc9860a97d7..c6884ba1d5ed 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -109,11 +109,11 @@ static void gic_unmask_irq(unsigned int irq)
109} 109}
110 110
111#ifdef CONFIG_SMP 111#ifdef CONFIG_SMP
112static void gic_set_cpu(unsigned int irq, cpumask_t mask_val) 112static void gic_set_cpu(unsigned int irq, const struct cpumask *mask_val)
113{ 113{
114 void __iomem *reg = gic_dist_base(irq) + GIC_DIST_TARGET + (gic_irq(irq) & ~3); 114 void __iomem *reg = gic_dist_base(irq) + GIC_DIST_TARGET + (gic_irq(irq) & ~3);
115 unsigned int shift = (irq % 4) * 8; 115 unsigned int shift = (irq % 4) * 8;
116 unsigned int cpu = first_cpu(mask_val); 116 unsigned int cpu = cpumask_first(mask_val);
117 u32 val; 117 u32 val;
118 118
119 spin_lock(&irq_controller_lock); 119 spin_lock(&irq_controller_lock);
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index 7c6b4b99a2df..2293f0ce061e 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -1108,6 +1108,7 @@ void locomo_frontlight_set(struct locomo_dev *dev, int duty, int vr, int bpwf)
1108 locomo_writel(bpwf | LOCOMO_ALC_EN, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS); 1108 locomo_writel(bpwf | LOCOMO_ALC_EN, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
1109 spin_unlock_irqrestore(&lchip->lock, flags); 1109 spin_unlock_irqrestore(&lchip->lock, flags);
1110} 1110}
1111EXPORT_SYMBOL(locomo_frontlight_set);
1111 1112
1112/* 1113/*
1113 * LoCoMo "Register Access Bus." 1114 * LoCoMo "Register Access Bus."
diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c
index f1e4b8f60cab..ecf0bfbab107 100644
--- a/arch/arm/common/vic.c
+++ b/arch/arm/common/vic.c
@@ -69,12 +69,12 @@ void __init vic_init(void __iomem *base, unsigned int irq_start,
69 /* 69 /*
70 * Make sure we clear all existing interrupts 70 * Make sure we clear all existing interrupts
71 */ 71 */
72 writel(0, base + VIC_VECT_ADDR); 72 writel(0, base + VIC_PL190_VECT_ADDR);
73 for (i = 0; i < 19; i++) { 73 for (i = 0; i < 19; i++) {
74 unsigned int value; 74 unsigned int value;
75 75
76 value = readl(base + VIC_VECT_ADDR); 76 value = readl(base + VIC_PL190_VECT_ADDR);
77 writel(value, base + VIC_VECT_ADDR); 77 writel(value, base + VIC_PL190_VECT_ADDR);
78 } 78 }
79 79
80 for (i = 0; i < 16; i++) { 80 for (i = 0; i < 16; i++) {
@@ -82,7 +82,7 @@ void __init vic_init(void __iomem *base, unsigned int irq_start,
82 writel(VIC_VECT_CNTL_ENABLE | i, reg); 82 writel(VIC_VECT_CNTL_ENABLE | i, reg);
83 } 83 }
84 84
85 writel(32, base + VIC_DEF_VECT_ADDR); 85 writel(32, base + VIC_PL190_DEF_VECT_ADDR);
86 86
87 for (i = 0; i < 32; i++) { 87 for (i = 0; i < 32; i++) {
88 unsigned int irq = irq_start + i; 88 unsigned int irq = irq_start + i;
diff --git a/arch/arm/configs/eseries_pxa_defconfig b/arch/arm/configs/eseries_pxa_defconfig
index 2307587a38a9..b6c5cbbf4c85 100644
--- a/arch/arm/configs/eseries_pxa_defconfig
+++ b/arch/arm/configs/eseries_pxa_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.26 3# Linux kernel version: 2.6.28-rc8
4# Sat Jul 26 22:28:46 2008 4# Wed Dec 24 23:35:45 2008
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y 7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -22,8 +22,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
22# CONFIG_ARCH_HAS_ILOG2_U64 is not set 22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
23CONFIG_GENERIC_HWEIGHT=y 23CONFIG_GENERIC_HWEIGHT=y
24CONFIG_GENERIC_CALIBRATE_DELAY=y 24CONFIG_GENERIC_CALIBRATE_DELAY=y
25CONFIG_ARCH_SUPPORTS_AOUT=y
26CONFIG_ZONE_DMA=y
27CONFIG_ARCH_MTD_XIP=y 25CONFIG_ARCH_MTD_XIP=y
28CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y 26CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
29CONFIG_VECTORS_BASE=0xffff0000 27CONFIG_VECTORS_BASE=0xffff0000
@@ -48,8 +46,7 @@ CONFIG_SYSVIPC_SYSCTL=y
48CONFIG_LOG_BUF_SHIFT=14 46CONFIG_LOG_BUF_SHIFT=14
49# CONFIG_CGROUPS is not set 47# CONFIG_CGROUPS is not set
50# CONFIG_GROUP_SCHED is not set 48# CONFIG_GROUP_SCHED is not set
51CONFIG_SYSFS_DEPRECATED=y 49# CONFIG_SYSFS_DEPRECATED_V2 is not set
52CONFIG_SYSFS_DEPRECATED_V2=y
53# CONFIG_RELAY is not set 50# CONFIG_RELAY is not set
54# CONFIG_NAMESPACES is not set 51# CONFIG_NAMESPACES is not set
55# CONFIG_BLK_DEV_INITRD is not set 52# CONFIG_BLK_DEV_INITRD is not set
@@ -58,13 +55,12 @@ CONFIG_SYSCTL=y
58CONFIG_EMBEDDED=y 55CONFIG_EMBEDDED=y
59CONFIG_UID16=y 56CONFIG_UID16=y
60CONFIG_SYSCTL_SYSCALL=y 57CONFIG_SYSCTL_SYSCALL=y
61CONFIG_SYSCTL_SYSCALL_CHECK=y
62# CONFIG_KALLSYMS is not set 58# CONFIG_KALLSYMS is not set
63CONFIG_HOTPLUG=y 59CONFIG_HOTPLUG=y
64CONFIG_PRINTK=y 60CONFIG_PRINTK=y
65CONFIG_BUG=y 61CONFIG_BUG=y
66CONFIG_ELF_CORE=y 62CONFIG_ELF_CORE=y
67CONFIG_COMPAT_BRK=y 63# CONFIG_COMPAT_BRK is not set
68CONFIG_BASE_FULL=y 64CONFIG_BASE_FULL=y
69CONFIG_FUTEX=y 65CONFIG_FUTEX=y
70CONFIG_ANON_INODES=y 66CONFIG_ANON_INODES=y
@@ -73,6 +69,7 @@ CONFIG_SIGNALFD=y
73CONFIG_TIMERFD=y 69CONFIG_TIMERFD=y
74CONFIG_EVENTFD=y 70CONFIG_EVENTFD=y
75CONFIG_SHMEM=y 71CONFIG_SHMEM=y
72CONFIG_AIO=y
76CONFIG_VM_EVENT_COUNTERS=y 73CONFIG_VM_EVENT_COUNTERS=y
77CONFIG_SLAB=y 74CONFIG_SLAB=y
78# CONFIG_SLUB is not set 75# CONFIG_SLUB is not set
@@ -80,15 +77,10 @@ CONFIG_SLAB=y
80# CONFIG_PROFILING is not set 77# CONFIG_PROFILING is not set
81# CONFIG_MARKERS is not set 78# CONFIG_MARKERS is not set
82CONFIG_HAVE_OPROFILE=y 79CONFIG_HAVE_OPROFILE=y
83# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
84# CONFIG_HAVE_IOREMAP_PROT is not set
85CONFIG_HAVE_KPROBES=y 80CONFIG_HAVE_KPROBES=y
86CONFIG_HAVE_KRETPROBES=y 81CONFIG_HAVE_KRETPROBES=y
87# CONFIG_HAVE_ARCH_TRACEHOOK is not set
88# CONFIG_HAVE_DMA_ATTRS is not set
89# CONFIG_USE_GENERIC_SMP_HELPERS is not set
90CONFIG_HAVE_CLK=y 82CONFIG_HAVE_CLK=y
91CONFIG_PROC_PAGE_MONITOR=y 83CONFIG_HAVE_GENERIC_DMA_COHERENT=y
92CONFIG_SLABINFO=y 84CONFIG_SLABINFO=y
93CONFIG_RT_MUTEXES=y 85CONFIG_RT_MUTEXES=y
94# CONFIG_TINY_SHMEM is not set 86# CONFIG_TINY_SHMEM is not set
@@ -112,14 +104,15 @@ CONFIG_BLOCK=y
112# 104#
113CONFIG_IOSCHED_NOOP=y 105CONFIG_IOSCHED_NOOP=y
114CONFIG_IOSCHED_AS=y 106CONFIG_IOSCHED_AS=y
115CONFIG_IOSCHED_DEADLINE=y 107# CONFIG_IOSCHED_DEADLINE is not set
116CONFIG_IOSCHED_CFQ=y 108# CONFIG_IOSCHED_CFQ is not set
117CONFIG_DEFAULT_AS=y 109CONFIG_DEFAULT_AS=y
118# CONFIG_DEFAULT_DEADLINE is not set 110# CONFIG_DEFAULT_DEADLINE is not set
119# CONFIG_DEFAULT_CFQ is not set 111# CONFIG_DEFAULT_CFQ is not set
120# CONFIG_DEFAULT_NOOP is not set 112# CONFIG_DEFAULT_NOOP is not set
121CONFIG_DEFAULT_IOSCHED="anticipatory" 113CONFIG_DEFAULT_IOSCHED="anticipatory"
122CONFIG_CLASSIC_RCU=y 114CONFIG_CLASSIC_RCU=y
115CONFIG_FREEZER=y
123 116
124# 117#
125# System Type 118# System Type
@@ -129,7 +122,6 @@ CONFIG_CLASSIC_RCU=y
129# CONFIG_ARCH_REALVIEW is not set 122# CONFIG_ARCH_REALVIEW is not set
130# CONFIG_ARCH_VERSATILE is not set 123# CONFIG_ARCH_VERSATILE is not set
131# CONFIG_ARCH_AT91 is not set 124# CONFIG_ARCH_AT91 is not set
132# CONFIG_ARCH_CLPS7500 is not set
133# CONFIG_ARCH_CLPS711X is not set 125# CONFIG_ARCH_CLPS711X is not set
134# CONFIG_ARCH_EBSA110 is not set 126# CONFIG_ARCH_EBSA110 is not set
135# CONFIG_ARCH_EP93XX is not set 127# CONFIG_ARCH_EP93XX is not set
@@ -160,7 +152,8 @@ CONFIG_ARCH_PXA=y
160# CONFIG_ARCH_LH7A40X is not set 152# CONFIG_ARCH_LH7A40X is not set
161# CONFIG_ARCH_DAVINCI is not set 153# CONFIG_ARCH_DAVINCI is not set
162# CONFIG_ARCH_OMAP is not set 154# CONFIG_ARCH_OMAP is not set
163# CONFIG_ARCH_MSM7X00A is not set 155# CONFIG_ARCH_MSM is not set
156# CONFIG_ARCH_W90X900 is not set
164 157
165# 158#
166# Intel PXA2xx/PXA3xx Implementations 159# Intel PXA2xx/PXA3xx Implementations
@@ -169,8 +162,10 @@ CONFIG_ARCH_PXA=y
169# CONFIG_ARCH_LUBBOCK is not set 162# CONFIG_ARCH_LUBBOCK is not set
170# CONFIG_MACH_LOGICPD_PXA270 is not set 163# CONFIG_MACH_LOGICPD_PXA270 is not set
171# CONFIG_MACH_MAINSTONE is not set 164# CONFIG_MACH_MAINSTONE is not set
165# CONFIG_MACH_MP900C is not set
172# CONFIG_ARCH_PXA_IDP is not set 166# CONFIG_ARCH_PXA_IDP is not set
173# CONFIG_PXA_SHARPSL is not set 167# CONFIG_PXA_SHARPSL is not set
168# CONFIG_ARCH_VIPER is not set
174CONFIG_ARCH_PXA_ESERIES=y 169CONFIG_ARCH_PXA_ESERIES=y
175CONFIG_MACH_E330=y 170CONFIG_MACH_E330=y
176CONFIG_MACH_E350=y 171CONFIG_MACH_E350=y
@@ -178,7 +173,8 @@ CONFIG_MACH_E740=y
178CONFIG_MACH_E750=y 173CONFIG_MACH_E750=y
179CONFIG_MACH_E400=y 174CONFIG_MACH_E400=y
180CONFIG_MACH_E800=y 175CONFIG_MACH_E800=y
181# CONFIG_MACH_TRIZEPS4 is not set 176# CONFIG_TRIZEPS_PXA is not set
177# CONFIG_MACH_H5000 is not set
182# CONFIG_MACH_EM_X270 is not set 178# CONFIG_MACH_EM_X270 is not set
183# CONFIG_MACH_COLIBRI is not set 179# CONFIG_MACH_COLIBRI is not set
184# CONFIG_MACH_ZYLONITE is not set 180# CONFIG_MACH_ZYLONITE is not set
@@ -186,12 +182,15 @@ CONFIG_MACH_E800=y
186# CONFIG_MACH_TAVOREVB is not set 182# CONFIG_MACH_TAVOREVB is not set
187# CONFIG_MACH_SAAR is not set 183# CONFIG_MACH_SAAR is not set
188# CONFIG_MACH_ARMCORE is not set 184# CONFIG_MACH_ARMCORE is not set
185# CONFIG_MACH_CM_X300 is not set
189# CONFIG_MACH_MAGICIAN is not set 186# CONFIG_MACH_MAGICIAN is not set
187# CONFIG_MACH_MIOA701 is not set
190# CONFIG_MACH_PCM027 is not set 188# CONFIG_MACH_PCM027 is not set
191# CONFIG_ARCH_PXA_PALM is not set 189# CONFIG_ARCH_PXA_PALM is not set
192# CONFIG_PXA_EZX is not set 190# CONFIG_PXA_EZX is not set
193CONFIG_PXA25x=y 191CONFIG_PXA25x=y
194# CONFIG_PXA_PWM is not set 192# CONFIG_PXA_PWM is not set
193CONFIG_PXA_HAVE_BOARD_IRQS=y
195 194
196# 195#
197# Boot options 196# Boot options
@@ -222,6 +221,7 @@ CONFIG_CPU_CP15_MMU=y
222# CONFIG_OUTER_CACHE is not set 221# CONFIG_OUTER_CACHE is not set
223CONFIG_IWMMXT=y 222CONFIG_IWMMXT=y
224CONFIG_XSCALE_PMU=y 223CONFIG_XSCALE_PMU=y
224CONFIG_COMMON_CLKDEV=y
225 225
226# 226#
227# Bus support 227# Bus support
@@ -237,6 +237,7 @@ CONFIG_PCMCIA_IOCTL=y
237# 237#
238# PC-card bridges 238# PC-card bridges
239# 239#
240CONFIG_PCMCIA_PXA2XX=m
240 241
241# 242#
242# Kernel Features 243# Kernel Features
@@ -245,25 +246,30 @@ CONFIG_TICK_ONESHOT=y
245# CONFIG_NO_HZ is not set 246# CONFIG_NO_HZ is not set
246# CONFIG_HIGH_RES_TIMERS is not set 247# CONFIG_HIGH_RES_TIMERS is not set
247CONFIG_GENERIC_CLOCKEVENTS_BUILD=y 248CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
249CONFIG_VMSPLIT_3G=y
250# CONFIG_VMSPLIT_2G is not set
251# CONFIG_VMSPLIT_1G is not set
252CONFIG_PAGE_OFFSET=0xC0000000
248# CONFIG_PREEMPT is not set 253# CONFIG_PREEMPT is not set
249CONFIG_HZ=100 254CONFIG_HZ=100
250CONFIG_AEABI=y 255CONFIG_AEABI=y
251CONFIG_OABI_COMPAT=y 256CONFIG_OABI_COMPAT=y
252# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 257CONFIG_ARCH_FLATMEM_HAS_HOLES=y
258# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
259# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
253CONFIG_SELECT_MEMORY_MODEL=y 260CONFIG_SELECT_MEMORY_MODEL=y
254CONFIG_FLATMEM_MANUAL=y 261CONFIG_FLATMEM_MANUAL=y
255# CONFIG_DISCONTIGMEM_MANUAL is not set 262# CONFIG_DISCONTIGMEM_MANUAL is not set
256# CONFIG_SPARSEMEM_MANUAL is not set 263# CONFIG_SPARSEMEM_MANUAL is not set
257CONFIG_FLATMEM=y 264CONFIG_FLATMEM=y
258CONFIG_FLAT_NODE_MEM_MAP=y 265CONFIG_FLAT_NODE_MEM_MAP=y
259# CONFIG_SPARSEMEM_STATIC is not set
260# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
261CONFIG_PAGEFLAGS_EXTENDED=y 266CONFIG_PAGEFLAGS_EXTENDED=y
262CONFIG_SPLIT_PTLOCK_CPUS=4096 267CONFIG_SPLIT_PTLOCK_CPUS=4096
263# CONFIG_RESOURCES_64BIT is not set 268# CONFIG_RESOURCES_64BIT is not set
264CONFIG_ZONE_DMA_FLAG=1 269# CONFIG_PHYS_ADDR_T_64BIT is not set
265CONFIG_BOUNCE=y 270CONFIG_ZONE_DMA_FLAG=0
266CONFIG_VIRT_TO_BUS=y 271CONFIG_VIRT_TO_BUS=y
272CONFIG_UNEVICTABLE_LRU=y
267CONFIG_ALIGNMENT_TRAP=y 273CONFIG_ALIGNMENT_TRAP=y
268 274
269# 275#
@@ -277,9 +283,10 @@ CONFIG_KEXEC=y
277CONFIG_ATAGS_PROC=y 283CONFIG_ATAGS_PROC=y
278 284
279# 285#
280# CPU Frequency scaling 286# CPU Power Management
281# 287#
282# CONFIG_CPU_FREQ is not set 288# CONFIG_CPU_FREQ is not set
289# CONFIG_CPU_IDLE is not set
283 290
284# 291#
285# Floating point emulation 292# Floating point emulation
@@ -296,6 +303,8 @@ CONFIG_FPE_NWFPE=y
296# Userspace binary formats 303# Userspace binary formats
297# 304#
298CONFIG_BINFMT_ELF=y 305CONFIG_BINFMT_ELF=y
306# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
307CONFIG_HAVE_AOUT=y
299# CONFIG_BINFMT_AOUT is not set 308# CONFIG_BINFMT_AOUT is not set
300CONFIG_BINFMT_MISC=y 309CONFIG_BINFMT_MISC=y
301 310
@@ -309,10 +318,6 @@ CONFIG_SUSPEND=y
309CONFIG_SUSPEND_FREEZER=y 318CONFIG_SUSPEND_FREEZER=y
310# CONFIG_APM_EMULATION is not set 319# CONFIG_APM_EMULATION is not set
311CONFIG_ARCH_SUSPEND_POSSIBLE=y 320CONFIG_ARCH_SUSPEND_POSSIBLE=y
312
313#
314# Networking
315#
316CONFIG_NET=y 321CONFIG_NET=y
317 322
318# 323#
@@ -339,7 +344,7 @@ CONFIG_IP_FIB_HASH=y
339# CONFIG_INET_ESP is not set 344# CONFIG_INET_ESP is not set
340# CONFIG_INET_IPCOMP is not set 345# CONFIG_INET_IPCOMP is not set
341# CONFIG_INET_XFRM_TUNNEL is not set 346# CONFIG_INET_XFRM_TUNNEL is not set
342CONFIG_INET_TUNNEL=y 347# CONFIG_INET_TUNNEL is not set
343CONFIG_INET_XFRM_MODE_TRANSPORT=y 348CONFIG_INET_XFRM_MODE_TRANSPORT=y
344CONFIG_INET_XFRM_MODE_TUNNEL=y 349CONFIG_INET_XFRM_MODE_TUNNEL=y
345CONFIG_INET_XFRM_MODE_BEET=y 350CONFIG_INET_XFRM_MODE_BEET=y
@@ -350,25 +355,7 @@ CONFIG_INET_TCP_DIAG=y
350CONFIG_TCP_CONG_CUBIC=y 355CONFIG_TCP_CONG_CUBIC=y
351CONFIG_DEFAULT_TCP_CONG="cubic" 356CONFIG_DEFAULT_TCP_CONG="cubic"
352# CONFIG_TCP_MD5SIG is not set 357# CONFIG_TCP_MD5SIG is not set
353CONFIG_IPV6=y 358# CONFIG_IPV6 is not set
354# CONFIG_IPV6_PRIVACY is not set
355# CONFIG_IPV6_ROUTER_PREF is not set
356# CONFIG_IPV6_OPTIMISTIC_DAD is not set
357# CONFIG_INET6_AH is not set
358# CONFIG_INET6_ESP is not set
359# CONFIG_INET6_IPCOMP is not set
360# CONFIG_IPV6_MIP6 is not set
361# CONFIG_INET6_XFRM_TUNNEL is not set
362# CONFIG_INET6_TUNNEL is not set
363CONFIG_INET6_XFRM_MODE_TRANSPORT=y
364CONFIG_INET6_XFRM_MODE_TUNNEL=y
365CONFIG_INET6_XFRM_MODE_BEET=y
366# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
367CONFIG_IPV6_SIT=y
368CONFIG_IPV6_NDISC_NODETYPE=y
369# CONFIG_IPV6_TUNNEL is not set
370# CONFIG_IPV6_MULTIPLE_TABLES is not set
371# CONFIG_IPV6_MROUTE is not set
372# CONFIG_NETWORK_SECMARK is not set 359# CONFIG_NETWORK_SECMARK is not set
373# CONFIG_NETFILTER is not set 360# CONFIG_NETFILTER is not set
374# CONFIG_IP_DCCP is not set 361# CONFIG_IP_DCCP is not set
@@ -376,6 +363,7 @@ CONFIG_IPV6_NDISC_NODETYPE=y
376# CONFIG_TIPC is not set 363# CONFIG_TIPC is not set
377# CONFIG_ATM is not set 364# CONFIG_ATM is not set
378# CONFIG_BRIDGE is not set 365# CONFIG_BRIDGE is not set
366# CONFIG_NET_DSA is not set
379# CONFIG_VLAN_8021Q is not set 367# CONFIG_VLAN_8021Q is not set
380# CONFIG_DECNET is not set 368# CONFIG_DECNET is not set
381# CONFIG_LLC2 is not set 369# CONFIG_LLC2 is not set
@@ -421,25 +409,18 @@ CONFIG_IRDA_FAST_RR=y
421# 409#
422# Dongle support 410# Dongle support
423# 411#
424# CONFIG_KINGSUN_DONGLE is not set
425# CONFIG_KSDAZZLE_DONGLE is not set
426# CONFIG_KS959_DONGLE is not set
427 412
428# 413#
429# FIR device drivers 414# FIR device drivers
430# 415#
431# CONFIG_USB_IRDA is not set
432# CONFIG_SIGMATEL_FIR is not set
433CONFIG_PXA_FICP=y 416CONFIG_PXA_FICP=y
434# CONFIG_MCS_FIR is not set
435# CONFIG_BT is not set 417# CONFIG_BT is not set
436# CONFIG_AF_RXRPC is not set 418# CONFIG_AF_RXRPC is not set
437 419# CONFIG_PHONET is not set
438# 420CONFIG_WIRELESS=y
439# Wireless
440#
441CONFIG_CFG80211=m 421CONFIG_CFG80211=m
442CONFIG_NL80211=y 422CONFIG_NL80211=y
423CONFIG_WIRELESS_OLD_REGULATORY=y
443CONFIG_WIRELESS_EXT=y 424CONFIG_WIRELESS_EXT=y
444CONFIG_WIRELESS_EXT_SYSFS=y 425CONFIG_WIRELESS_EXT_SYSFS=y
445CONFIG_MAC80211=m 426CONFIG_MAC80211=m
@@ -448,7 +429,9 @@ CONFIG_MAC80211=m
448# Rate control algorithm selection 429# Rate control algorithm selection
449# 430#
450CONFIG_MAC80211_RC_PID=y 431CONFIG_MAC80211_RC_PID=y
432# CONFIG_MAC80211_RC_MINSTREL is not set
451CONFIG_MAC80211_RC_DEFAULT_PID=y 433CONFIG_MAC80211_RC_DEFAULT_PID=y
434# CONFIG_MAC80211_RC_DEFAULT_MINSTREL is not set
452CONFIG_MAC80211_RC_DEFAULT="pid" 435CONFIG_MAC80211_RC_DEFAULT="pid"
453# CONFIG_MAC80211_MESH is not set 436# CONFIG_MAC80211_MESH is not set
454# CONFIG_MAC80211_LEDS is not set 437# CONFIG_MAC80211_LEDS is not set
@@ -539,11 +522,12 @@ CONFIG_MTD_NAND=m
539# CONFIG_MTD_NAND_VERIFY_WRITE is not set 522# CONFIG_MTD_NAND_VERIFY_WRITE is not set
540# CONFIG_MTD_NAND_ECC_SMC is not set 523# CONFIG_MTD_NAND_ECC_SMC is not set
541# CONFIG_MTD_NAND_MUSEUM_IDS is not set 524# CONFIG_MTD_NAND_MUSEUM_IDS is not set
525# CONFIG_MTD_NAND_GPIO is not set
542CONFIG_MTD_NAND_IDS=m 526CONFIG_MTD_NAND_IDS=m
543# CONFIG_MTD_NAND_DISKONCHIP is not set 527# CONFIG_MTD_NAND_DISKONCHIP is not set
544# CONFIG_MTD_NAND_SHARPSL is not set 528# CONFIG_MTD_NAND_SHARPSL is not set
529CONFIG_MTD_NAND_TMIO=m
545# CONFIG_MTD_NAND_PLATFORM is not set 530# CONFIG_MTD_NAND_PLATFORM is not set
546# CONFIG_MTD_ALAUDA is not set
547# CONFIG_MTD_ONENAND is not set 531# CONFIG_MTD_ONENAND is not set
548 532
549# 533#
@@ -556,13 +540,13 @@ CONFIG_BLK_DEV=y
556CONFIG_BLK_DEV_LOOP=m 540CONFIG_BLK_DEV_LOOP=m
557# CONFIG_BLK_DEV_CRYPTOLOOP is not set 541# CONFIG_BLK_DEV_CRYPTOLOOP is not set
558# CONFIG_BLK_DEV_NBD is not set 542# CONFIG_BLK_DEV_NBD is not set
559# CONFIG_BLK_DEV_UB is not set
560# CONFIG_BLK_DEV_RAM is not set 543# CONFIG_BLK_DEV_RAM is not set
561# CONFIG_CDROM_PKTCDVD is not set 544# CONFIG_CDROM_PKTCDVD is not set
562# CONFIG_ATA_OVER_ETH is not set 545# CONFIG_ATA_OVER_ETH is not set
563CONFIG_MISC_DEVICES=y 546CONFIG_MISC_DEVICES=y
564# CONFIG_EEPROM_93CX6 is not set 547# CONFIG_EEPROM_93CX6 is not set
565# CONFIG_ENCLOSURE_SERVICES is not set 548# CONFIG_ENCLOSURE_SERVICES is not set
549# CONFIG_C2PORT is not set
566CONFIG_HAVE_IDE=y 550CONFIG_HAVE_IDE=y
567# CONFIG_IDE is not set 551# CONFIG_IDE is not set
568 552
@@ -632,37 +616,25 @@ CONFIG_NETDEVICES=y
632CONFIG_WLAN_80211=y 616CONFIG_WLAN_80211=y
633# CONFIG_PCMCIA_RAYCS is not set 617# CONFIG_PCMCIA_RAYCS is not set
634# CONFIG_LIBERTAS is not set 618# CONFIG_LIBERTAS is not set
619# CONFIG_LIBERTAS_THINFIRM is not set
635CONFIG_HERMES=m 620CONFIG_HERMES=m
636CONFIG_PCMCIA_HERMES=m 621CONFIG_PCMCIA_HERMES=m
637# CONFIG_PCMCIA_SPECTRUM is not set 622# CONFIG_PCMCIA_SPECTRUM is not set
638# CONFIG_ATMEL is not set 623# CONFIG_ATMEL is not set
639# CONFIG_AIRO_CS is not set 624# CONFIG_AIRO_CS is not set
640# CONFIG_PCMCIA_WL3501 is not set 625# CONFIG_PCMCIA_WL3501 is not set
641# CONFIG_USB_ZD1201 is not set
642# CONFIG_USB_NET_RNDIS_WLAN is not set
643# CONFIG_RTL8187 is not set
644# CONFIG_MAC80211_HWSIM is not set 626# CONFIG_MAC80211_HWSIM is not set
645# CONFIG_P54_COMMON is not set 627# CONFIG_P54_COMMON is not set
646# CONFIG_IWLWIFI_LEDS is not set 628# CONFIG_IWLWIFI_LEDS is not set
647# CONFIG_HOSTAP is not set 629# CONFIG_HOSTAP is not set
648# CONFIG_B43 is not set 630# CONFIG_B43 is not set
649# CONFIG_B43LEGACY is not set 631# CONFIG_B43LEGACY is not set
650# CONFIG_ZD1211RW is not set
651# CONFIG_RT2X00 is not set 632# CONFIG_RT2X00 is not set
652
653#
654# USB Network Adapters
655#
656# CONFIG_USB_CATC is not set
657# CONFIG_USB_KAWETH is not set
658# CONFIG_USB_PEGASUS is not set
659# CONFIG_USB_RTL8150 is not set
660# CONFIG_USB_USBNET is not set
661CONFIG_NET_PCMCIA=y 633CONFIG_NET_PCMCIA=y
662# CONFIG_PCMCIA_3C589 is not set 634# CONFIG_PCMCIA_3C589 is not set
663# CONFIG_PCMCIA_3C574 is not set 635# CONFIG_PCMCIA_3C574 is not set
664# CONFIG_PCMCIA_FMVJ18X is not set 636# CONFIG_PCMCIA_FMVJ18X is not set
665CONFIG_PCMCIA_PCNET=m 637# CONFIG_PCMCIA_PCNET is not set
666# CONFIG_PCMCIA_NMCLAN is not set 638# CONFIG_PCMCIA_NMCLAN is not set
667# CONFIG_PCMCIA_SMC91C92 is not set 639# CONFIG_PCMCIA_SMC91C92 is not set
668# CONFIG_PCMCIA_XIRC2PS is not set 640# CONFIG_PCMCIA_XIRC2PS is not set
@@ -714,13 +686,11 @@ CONFIG_INPUT_TOUCHSCREEN=y
714# CONFIG_TOUCHSCREEN_PENMOUNT is not set 686# CONFIG_TOUCHSCREEN_PENMOUNT is not set
715# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set 687# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
716# CONFIG_TOUCHSCREEN_TOUCHWIN is not set 688# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
717# CONFIG_TOUCHSCREEN_UCB1400 is not set
718CONFIG_TOUCHSCREEN_WM97XX=m 689CONFIG_TOUCHSCREEN_WM97XX=m
719CONFIG_TOUCHSCREEN_WM9705=y 690CONFIG_TOUCHSCREEN_WM9705=y
720CONFIG_TOUCHSCREEN_WM9712=y 691CONFIG_TOUCHSCREEN_WM9712=y
721CONFIG_TOUCHSCREEN_WM9713=y 692CONFIG_TOUCHSCREEN_WM9713=y
722# CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE is not set 693# CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE is not set
723# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
724# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set 694# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
725# CONFIG_INPUT_MISC is not set 695# CONFIG_INPUT_MISC is not set
726 696
@@ -749,11 +719,13 @@ CONFIG_DEVKMEM=y
749# 719#
750# Non-8250 serial port support 720# Non-8250 serial port support
751# 721#
752# CONFIG_SERIAL_PXA is not set 722CONFIG_SERIAL_PXA=y
723# CONFIG_SERIAL_PXA_CONSOLE is not set
724CONFIG_SERIAL_CORE=y
753CONFIG_UNIX98_PTYS=y 725CONFIG_UNIX98_PTYS=y
754# CONFIG_LEGACY_PTYS is not set 726# CONFIG_LEGACY_PTYS is not set
755# CONFIG_IPMI_HANDLER is not set 727# CONFIG_IPMI_HANDLER is not set
756CONFIG_HW_RANDOM=m 728# CONFIG_HW_RANDOM is not set
757# CONFIG_NVRAM is not set 729# CONFIG_NVRAM is not set
758# CONFIG_R3964 is not set 730# CONFIG_R3964 is not set
759 731
@@ -773,6 +745,10 @@ CONFIG_GPIOLIB=y
773# CONFIG_GPIO_SYSFS is not set 745# CONFIG_GPIO_SYSFS is not set
774 746
775# 747#
748# Memory mapped GPIO expanders:
749#
750
751#
776# I2C GPIO expanders: 752# I2C GPIO expanders:
777# 753#
778 754
@@ -786,12 +762,14 @@ CONFIG_GPIOLIB=y
786# CONFIG_W1 is not set 762# CONFIG_W1 is not set
787# CONFIG_POWER_SUPPLY is not set 763# CONFIG_POWER_SUPPLY is not set
788# CONFIG_HWMON is not set 764# CONFIG_HWMON is not set
765# CONFIG_THERMAL is not set
766# CONFIG_THERMAL_HWMON is not set
789# CONFIG_WATCHDOG is not set 767# CONFIG_WATCHDOG is not set
768CONFIG_SSB_POSSIBLE=y
790 769
791# 770#
792# Sonics Silicon Backplane 771# Sonics Silicon Backplane
793# 772#
794CONFIG_SSB_POSSIBLE=y
795# CONFIG_SSB is not set 773# CONFIG_SSB is not set
796 774
797# 775#
@@ -799,8 +777,13 @@ CONFIG_SSB_POSSIBLE=y
799# 777#
800CONFIG_MFD_CORE=y 778CONFIG_MFD_CORE=y
801# CONFIG_MFD_SM501 is not set 779# CONFIG_MFD_SM501 is not set
780# CONFIG_MFD_ASIC3 is not set
802# CONFIG_HTC_EGPIO is not set 781# CONFIG_HTC_EGPIO is not set
803# CONFIG_HTC_PASIC3 is not set 782# CONFIG_HTC_PASIC3 is not set
783# CONFIG_UCB1400_CORE is not set
784CONFIG_MFD_TMIO=y
785CONFIG_MFD_T7L66XB=y
786CONFIG_MFD_TC6387XB=y
804CONFIG_MFD_TC6393XB=y 787CONFIG_MFD_TC6393XB=y
805 788
806# 789#
@@ -827,6 +810,7 @@ CONFIG_MFD_TC6393XB=y
827CONFIG_FB=y 810CONFIG_FB=y
828# CONFIG_FIRMWARE_EDID is not set 811# CONFIG_FIRMWARE_EDID is not set
829# CONFIG_FB_DDC is not set 812# CONFIG_FB_DDC is not set
813# CONFIG_FB_BOOT_VESA_SUPPORT is not set
830CONFIG_FB_CFB_FILLRECT=y 814CONFIG_FB_CFB_FILLRECT=y
831CONFIG_FB_CFB_COPYAREA=y 815CONFIG_FB_CFB_COPYAREA=y
832CONFIG_FB_CFB_IMAGEBLIT=y 816CONFIG_FB_CFB_IMAGEBLIT=y
@@ -851,8 +835,10 @@ CONFIG_FB_PXA=y
851# CONFIG_FB_PXA_PARAMETERS is not set 835# CONFIG_FB_PXA_PARAMETERS is not set
852# CONFIG_FB_MBX is not set 836# CONFIG_FB_MBX is not set
853CONFIG_FB_W100=y 837CONFIG_FB_W100=y
854# CONFIG_FB_AM200EPD is not set 838# CONFIG_FB_TMIO is not set
855# CONFIG_FB_VIRTUAL is not set 839# CONFIG_FB_VIRTUAL is not set
840# CONFIG_FB_METRONOME is not set
841# CONFIG_FB_MB862XX is not set
856CONFIG_BACKLIGHT_LCD_SUPPORT=y 842CONFIG_BACKLIGHT_LCD_SUPPORT=y
857CONFIG_LCD_CLASS_DEVICE=y 843CONFIG_LCD_CLASS_DEVICE=y
858# CONFIG_LCD_ILI9320 is not set 844# CONFIG_LCD_ILI9320 is not set
@@ -886,6 +872,7 @@ CONFIG_FONT_MINI_4x6=y
886# CONFIG_FONT_10x18 is not set 872# CONFIG_FONT_10x18 is not set
887# CONFIG_LOGO is not set 873# CONFIG_LOGO is not set
888CONFIG_SOUND=y 874CONFIG_SOUND=y
875CONFIG_SOUND_OSS_CORE=y
889CONFIG_SND=m 876CONFIG_SND=m
890CONFIG_SND_TIMER=m 877CONFIG_SND_TIMER=m
891CONFIG_SND_PCM=m 878CONFIG_SND_PCM=m
@@ -899,14 +886,18 @@ CONFIG_SND_SUPPORT_OLD_API=y
899CONFIG_SND_VERBOSE_PROCFS=y 886CONFIG_SND_VERBOSE_PROCFS=y
900CONFIG_SND_VERBOSE_PRINTK=y 887CONFIG_SND_VERBOSE_PRINTK=y
901# CONFIG_SND_DEBUG is not set 888# CONFIG_SND_DEBUG is not set
889CONFIG_SND_VMASTER=y
890CONFIG_SND_AC97_CODEC=m
902CONFIG_SND_DRIVERS=y 891CONFIG_SND_DRIVERS=y
903# CONFIG_SND_DUMMY is not set 892# CONFIG_SND_DUMMY is not set
904# CONFIG_SND_MTPAV is not set 893# CONFIG_SND_MTPAV is not set
905# CONFIG_SND_SERIAL_U16550 is not set 894# CONFIG_SND_SERIAL_U16550 is not set
906# CONFIG_SND_MPU401 is not set 895# CONFIG_SND_MPU401 is not set
896# CONFIG_SND_AC97_POWER_SAVE is not set
907CONFIG_SND_ARM=y 897CONFIG_SND_ARM=y
898CONFIG_SND_PXA2XX_LIB=m
899CONFIG_SND_PXA2XX_LIB_AC97=y
908# CONFIG_SND_PXA2XX_AC97 is not set 900# CONFIG_SND_PXA2XX_AC97 is not set
909# CONFIG_SND_USB is not set
910# CONFIG_SND_PCMCIA is not set 901# CONFIG_SND_PCMCIA is not set
911CONFIG_SND_SOC=m 902CONFIG_SND_SOC=m
912CONFIG_SND_SOC_AC97_BUS=y 903CONFIG_SND_SOC_AC97_BUS=y
@@ -920,133 +911,19 @@ CONFIG_HID_SUPPORT=y
920CONFIG_HID=y 911CONFIG_HID=y
921# CONFIG_HID_DEBUG is not set 912# CONFIG_HID_DEBUG is not set
922# CONFIG_HIDRAW is not set 913# CONFIG_HIDRAW is not set
914# CONFIG_HID_PID is not set
923 915
924# 916#
925# USB Input Devices 917# Special HID drivers
926# 918#
927CONFIG_USB_HID=m 919CONFIG_HID_COMPAT=y
928# CONFIG_USB_HIDINPUT_POWERBOOK is not set 920# CONFIG_USB_SUPPORT is not set
929# CONFIG_HID_FF is not set
930# CONFIG_USB_HIDDEV is not set
931
932#
933# USB HID Boot Protocol drivers
934#
935# CONFIG_USB_KBD is not set
936# CONFIG_USB_MOUSE is not set
937CONFIG_USB_SUPPORT=y
938CONFIG_USB_ARCH_HAS_HCD=y
939# CONFIG_USB_ARCH_HAS_OHCI is not set
940# CONFIG_USB_ARCH_HAS_EHCI is not set
941CONFIG_USB=m
942# CONFIG_USB_DEBUG is not set
943# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
944
945#
946# Miscellaneous USB options
947#
948# CONFIG_USB_DEVICEFS is not set
949CONFIG_USB_DEVICE_CLASS=y
950# CONFIG_USB_DYNAMIC_MINORS is not set
951# CONFIG_USB_SUSPEND is not set
952# CONFIG_USB_OTG is not set
953# CONFIG_USB_OTG_WHITELIST is not set
954# CONFIG_USB_OTG_BLACKLIST_HUB is not set
955
956#
957# USB Host Controller Drivers
958#
959# CONFIG_USB_C67X00_HCD is not set
960# CONFIG_USB_ISP116X_HCD is not set
961# CONFIG_USB_ISP1760_HCD is not set
962# CONFIG_USB_SL811_HCD is not set
963# CONFIG_USB_R8A66597_HCD is not set
964
965#
966# USB Device Class drivers
967#
968# CONFIG_USB_ACM is not set
969# CONFIG_USB_PRINTER is not set
970# CONFIG_USB_WDM is not set
971
972#
973# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
974#
975
976#
977# may also be needed; see USB_STORAGE Help for more information
978#
979# CONFIG_USB_STORAGE is not set
980# CONFIG_USB_LIBUSUAL is not set
981
982#
983# USB Imaging devices
984#
985# CONFIG_USB_MDC800 is not set
986# CONFIG_USB_MICROTEK is not set
987CONFIG_USB_MON=y
988
989#
990# USB port drivers
991#
992# CONFIG_USB_SERIAL is not set
993
994#
995# USB Miscellaneous drivers
996#
997# CONFIG_USB_EMI62 is not set
998# CONFIG_USB_EMI26 is not set
999# CONFIG_USB_ADUTUX is not set
1000# CONFIG_USB_AUERSWALD is not set
1001# CONFIG_USB_RIO500 is not set
1002# CONFIG_USB_LEGOTOWER is not set
1003# CONFIG_USB_LCD is not set
1004# CONFIG_USB_BERRY_CHARGE is not set
1005# CONFIG_USB_LED is not set
1006# CONFIG_USB_CYPRESS_CY7C63 is not set
1007# CONFIG_USB_CYTHERM is not set
1008# CONFIG_USB_PHIDGET is not set
1009# CONFIG_USB_IDMOUSE is not set
1010# CONFIG_USB_FTDI_ELAN is not set
1011# CONFIG_USB_APPLEDISPLAY is not set
1012# CONFIG_USB_LD is not set
1013# CONFIG_USB_TRANCEVIBRATOR is not set
1014# CONFIG_USB_IOWARRIOR is not set
1015# CONFIG_USB_ISIGHTFW is not set
1016CONFIG_USB_GADGET=y
1017# CONFIG_USB_GADGET_DEBUG_FILES is not set
1018CONFIG_USB_GADGET_SELECTED=y
1019# CONFIG_USB_GADGET_AMD5536UDC is not set
1020# CONFIG_USB_GADGET_ATMEL_USBA is not set
1021# CONFIG_USB_GADGET_FSL_USB2 is not set
1022# CONFIG_USB_GADGET_NET2280 is not set
1023CONFIG_USB_GADGET_PXA25X=y
1024CONFIG_USB_PXA25X=y
1025CONFIG_USB_PXA25X_SMALL=y
1026# CONFIG_USB_GADGET_M66592 is not set
1027# CONFIG_USB_GADGET_PXA27X is not set
1028# CONFIG_USB_GADGET_GOKU is not set
1029# CONFIG_USB_GADGET_LH7A40X is not set
1030# CONFIG_USB_GADGET_OMAP is not set
1031# CONFIG_USB_GADGET_S3C2410 is not set
1032# CONFIG_USB_GADGET_AT91 is not set
1033# CONFIG_USB_GADGET_DUMMY_HCD is not set
1034# CONFIG_USB_GADGET_DUALSPEED is not set
1035# CONFIG_USB_ZERO is not set
1036CONFIG_USB_ETH=m
1037# CONFIG_USB_ETH_RNDIS is not set
1038# CONFIG_USB_GADGETFS is not set
1039# CONFIG_USB_FILE_STORAGE is not set
1040# CONFIG_USB_G_SERIAL is not set
1041# CONFIG_USB_MIDI_GADGET is not set
1042# CONFIG_USB_G_PRINTER is not set
1043# CONFIG_USB_CDC_COMPOSITE is not set
1044CONFIG_MMC=y 921CONFIG_MMC=y
1045# CONFIG_MMC_DEBUG is not set 922# CONFIG_MMC_DEBUG is not set
1046CONFIG_MMC_UNSAFE_RESUME=y 923CONFIG_MMC_UNSAFE_RESUME=y
1047 924
1048# 925#
1049# MMC/SD Card Drivers 926# MMC/SD/SDIO Card Drivers
1050# 927#
1051CONFIG_MMC_BLOCK=y 928CONFIG_MMC_BLOCK=y
1052CONFIG_MMC_BLOCK_BOUNCE=y 929CONFIG_MMC_BLOCK_BOUNCE=y
@@ -1054,14 +931,18 @@ CONFIG_MMC_BLOCK_BOUNCE=y
1054# CONFIG_MMC_TEST is not set 931# CONFIG_MMC_TEST is not set
1055 932
1056# 933#
1057# MMC/SD Host Controller Drivers 934# MMC/SD/SDIO Host Controller Drivers
1058# 935#
1059# CONFIG_MMC_PXA is not set 936# CONFIG_MMC_PXA is not set
1060# CONFIG_MMC_SDHCI is not set 937# CONFIG_MMC_SDHCI is not set
938CONFIG_MMC_TMIO=y
939# CONFIG_MEMSTICK is not set
940# CONFIG_ACCESSIBILITY is not set
1061# CONFIG_NEW_LEDS is not set 941# CONFIG_NEW_LEDS is not set
1062CONFIG_RTC_LIB=y 942CONFIG_RTC_LIB=y
1063# CONFIG_RTC_CLASS is not set 943# CONFIG_RTC_CLASS is not set
1064# CONFIG_DMADEVICES is not set 944# CONFIG_DMADEVICES is not set
945# CONFIG_REGULATOR is not set
1065# CONFIG_UIO is not set 946# CONFIG_UIO is not set
1066 947
1067# 948#
@@ -1070,11 +951,17 @@ CONFIG_RTC_LIB=y
1070CONFIG_EXT2_FS=y 951CONFIG_EXT2_FS=y
1071# CONFIG_EXT2_FS_XATTR is not set 952# CONFIG_EXT2_FS_XATTR is not set
1072# CONFIG_EXT2_FS_XIP is not set 953# CONFIG_EXT2_FS_XIP is not set
1073# CONFIG_EXT3_FS is not set 954CONFIG_EXT3_FS=m
1074# CONFIG_EXT4DEV_FS is not set 955CONFIG_EXT3_FS_XATTR=y
956# CONFIG_EXT3_FS_POSIX_ACL is not set
957# CONFIG_EXT3_FS_SECURITY is not set
958# CONFIG_EXT4_FS is not set
959CONFIG_JBD=m
960CONFIG_FS_MBCACHE=m
1075# CONFIG_REISERFS_FS is not set 961# CONFIG_REISERFS_FS is not set
1076# CONFIG_JFS_FS is not set 962# CONFIG_JFS_FS is not set
1077# CONFIG_FS_POSIX_ACL is not set 963# CONFIG_FS_POSIX_ACL is not set
964CONFIG_FILE_LOCKING=y
1078# CONFIG_XFS_FS is not set 965# CONFIG_XFS_FS is not set
1079# CONFIG_OCFS2_FS is not set 966# CONFIG_OCFS2_FS is not set
1080CONFIG_DNOTIFY=y 967CONFIG_DNOTIFY=y
@@ -1106,6 +993,7 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1106# 993#
1107CONFIG_PROC_FS=y 994CONFIG_PROC_FS=y
1108CONFIG_PROC_SYSCTL=y 995CONFIG_PROC_SYSCTL=y
996CONFIG_PROC_PAGE_MONITOR=y
1109CONFIG_SYSFS=y 997CONFIG_SYSFS=y
1110CONFIG_TMPFS=y 998CONFIG_TMPFS=y
1111# CONFIG_TMPFS_POSIX_ACL is not set 999# CONFIG_TMPFS_POSIX_ACL is not set
@@ -1142,6 +1030,7 @@ CONFIG_LOCKD=y
1142CONFIG_LOCKD_V4=y 1030CONFIG_LOCKD_V4=y
1143CONFIG_NFS_COMMON=y 1031CONFIG_NFS_COMMON=y
1144CONFIG_SUNRPC=y 1032CONFIG_SUNRPC=y
1033# CONFIG_SUNRPC_REGISTER_V4 is not set
1145# CONFIG_RPCSEC_GSS_KRB5 is not set 1034# CONFIG_RPCSEC_GSS_KRB5 is not set
1146# CONFIG_RPCSEC_GSS_SPKM3 is not set 1035# CONFIG_RPCSEC_GSS_SPKM3 is not set
1147# CONFIG_SMB_FS is not set 1036# CONFIG_SMB_FS is not set
@@ -1228,13 +1117,15 @@ CONFIG_FRAME_WARN=1024
1228# CONFIG_DEBUG_BUGVERBOSE is not set 1117# CONFIG_DEBUG_BUGVERBOSE is not set
1229# CONFIG_DEBUG_MEMORY_INIT is not set 1118# CONFIG_DEBUG_MEMORY_INIT is not set
1230CONFIG_FRAME_POINTER=y 1119CONFIG_FRAME_POINTER=y
1120# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1231# CONFIG_LATENCYTOP is not set 1121# CONFIG_LATENCYTOP is not set
1232CONFIG_HAVE_FTRACE=y 1122CONFIG_SYSCTL_SYSCALL_CHECK=y
1233CONFIG_HAVE_DYNAMIC_FTRACE=y 1123CONFIG_HAVE_FUNCTION_TRACER=y
1234# CONFIG_FTRACE is not set 1124
1235# CONFIG_IRQSOFF_TRACER is not set 1125#
1236# CONFIG_SCHED_TRACER is not set 1126# Tracers
1237# CONFIG_CONTEXT_SWITCH_TRACER is not set 1127#
1128# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1238# CONFIG_SAMPLES is not set 1129# CONFIG_SAMPLES is not set
1239CONFIG_HAVE_ARCH_KGDB=y 1130CONFIG_HAVE_ARCH_KGDB=y
1240# CONFIG_DEBUG_USER is not set 1131# CONFIG_DEBUG_USER is not set
@@ -1244,15 +1135,23 @@ CONFIG_HAVE_ARCH_KGDB=y
1244# 1135#
1245# CONFIG_KEYS is not set 1136# CONFIG_KEYS is not set
1246# CONFIG_SECURITY is not set 1137# CONFIG_SECURITY is not set
1138# CONFIG_SECURITYFS is not set
1247# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1139# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1248CONFIG_CRYPTO=y 1140CONFIG_CRYPTO=y
1249 1141
1250# 1142#
1251# Crypto core or helper 1143# Crypto core or helper
1252# 1144#
1145# CONFIG_CRYPTO_FIPS is not set
1253CONFIG_CRYPTO_ALGAPI=m 1146CONFIG_CRYPTO_ALGAPI=m
1147CONFIG_CRYPTO_ALGAPI2=m
1148CONFIG_CRYPTO_AEAD2=m
1254CONFIG_CRYPTO_BLKCIPHER=m 1149CONFIG_CRYPTO_BLKCIPHER=m
1150CONFIG_CRYPTO_BLKCIPHER2=m
1151CONFIG_CRYPTO_HASH2=m
1152CONFIG_CRYPTO_RNG2=m
1255CONFIG_CRYPTO_MANAGER=m 1153CONFIG_CRYPTO_MANAGER=m
1154CONFIG_CRYPTO_MANAGER2=m
1256# CONFIG_CRYPTO_GF128MUL is not set 1155# CONFIG_CRYPTO_GF128MUL is not set
1257# CONFIG_CRYPTO_NULL is not set 1156# CONFIG_CRYPTO_NULL is not set
1258# CONFIG_CRYPTO_CRYPTD is not set 1157# CONFIG_CRYPTO_CRYPTD is not set
@@ -1324,14 +1223,17 @@ CONFIG_CRYPTO_ARC4=m
1324# 1223#
1325# CONFIG_CRYPTO_DEFLATE is not set 1224# CONFIG_CRYPTO_DEFLATE is not set
1326# CONFIG_CRYPTO_LZO is not set 1225# CONFIG_CRYPTO_LZO is not set
1226
1227#
1228# Random Number Generation
1229#
1230# CONFIG_CRYPTO_ANSI_CPRNG is not set
1327CONFIG_CRYPTO_HW=y 1231CONFIG_CRYPTO_HW=y
1328 1232
1329# 1233#
1330# Library routines 1234# Library routines
1331# 1235#
1332CONFIG_BITREVERSE=y 1236CONFIG_BITREVERSE=y
1333# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1334# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1335CONFIG_CRC_CCITT=y 1237CONFIG_CRC_CCITT=y
1336# CONFIG_CRC16 is not set 1238# CONFIG_CRC16 is not set
1337# CONFIG_CRC_T10DIF is not set 1239# CONFIG_CRC_T10DIF is not set
diff --git a/arch/arm/configs/h5000_defconfig b/arch/arm/configs/h5000_defconfig
new file mode 100644
index 000000000000..649baa370495
--- /dev/null
+++ b/arch/arm/configs/h5000_defconfig
@@ -0,0 +1,996 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.27-rc6
4# Tue Sep 16 16:13:48 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_ARCH_MTD_XIP=y
28CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
29CONFIG_VECTORS_BASE=0xffff0000
30CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
31
32#
33# General setup
34#
35CONFIG_EXPERIMENTAL=y
36CONFIG_BROKEN_ON_SMP=y
37CONFIG_INIT_ENV_ARG_LIMIT=32
38CONFIG_LOCALVERSION=""
39CONFIG_LOCALVERSION_AUTO=y
40CONFIG_SWAP=y
41CONFIG_SYSVIPC=y
42CONFIG_SYSVIPC_SYSCTL=y
43# CONFIG_POSIX_MQUEUE is not set
44# CONFIG_BSD_PROCESS_ACCT is not set
45# CONFIG_TASKSTATS is not set
46# CONFIG_AUDIT is not set
47CONFIG_IKCONFIG=y
48CONFIG_IKCONFIG_PROC=y
49CONFIG_LOG_BUF_SHIFT=16
50# CONFIG_CGROUPS is not set
51CONFIG_GROUP_SCHED=y
52CONFIG_FAIR_GROUP_SCHED=y
53# CONFIG_RT_GROUP_SCHED is not set
54CONFIG_USER_SCHED=y
55# CONFIG_CGROUP_SCHED is not set
56# CONFIG_SYSFS_DEPRECATED_V2 is not set
57# CONFIG_RELAY is not set
58# CONFIG_NAMESPACES is not set
59# CONFIG_BLK_DEV_INITRD is not set
60# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
61CONFIG_SYSCTL=y
62CONFIG_EMBEDDED=y
63# CONFIG_UID16 is not set
64CONFIG_SYSCTL_SYSCALL=y
65CONFIG_KALLSYMS=y
66# CONFIG_KALLSYMS_ALL is not set
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
89# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
90# CONFIG_HAVE_IOREMAP_PROT is not set
91CONFIG_HAVE_KPROBES=y
92CONFIG_HAVE_KRETPROBES=y
93# CONFIG_HAVE_ARCH_TRACEHOOK is not set
94# CONFIG_HAVE_DMA_ATTRS is not set
95# CONFIG_USE_GENERIC_SMP_HELPERS is not set
96CONFIG_HAVE_CLK=y
97# CONFIG_PROC_PAGE_MONITOR is not set
98CONFIG_HAVE_GENERIC_DMA_COHERENT=y
99CONFIG_SLABINFO=y
100CONFIG_RT_MUTEXES=y
101# CONFIG_TINY_SHMEM is not set
102CONFIG_BASE_SMALL=0
103CONFIG_MODULES=y
104# CONFIG_MODULE_FORCE_LOAD is not set
105CONFIG_MODULE_UNLOAD=y
106CONFIG_MODULE_FORCE_UNLOAD=y
107# CONFIG_MODVERSIONS is not set
108# CONFIG_MODULE_SRCVERSION_ALL is not set
109CONFIG_KMOD=y
110CONFIG_BLOCK=y
111# CONFIG_LBD is not set
112# CONFIG_BLK_DEV_IO_TRACE is not set
113# CONFIG_LSF is not set
114# CONFIG_BLK_DEV_BSG is not set
115# CONFIG_BLK_DEV_INTEGRITY is not set
116
117#
118# IO Schedulers
119#
120CONFIG_IOSCHED_NOOP=y
121CONFIG_IOSCHED_AS=y
122CONFIG_IOSCHED_DEADLINE=y
123# CONFIG_IOSCHED_CFQ is not set
124CONFIG_DEFAULT_AS=y
125# CONFIG_DEFAULT_DEADLINE is not set
126# CONFIG_DEFAULT_CFQ is not set
127# CONFIG_DEFAULT_NOOP is not set
128CONFIG_DEFAULT_IOSCHED="anticipatory"
129CONFIG_CLASSIC_RCU=y
130
131#
132# System Type
133#
134# CONFIG_ARCH_AAEC2000 is not set
135# CONFIG_ARCH_INTEGRATOR is not set
136# CONFIG_ARCH_REALVIEW is not set
137# CONFIG_ARCH_VERSATILE is not set
138# CONFIG_ARCH_AT91 is not set
139# CONFIG_ARCH_CLPS7500 is not set
140# CONFIG_ARCH_CLPS711X is not set
141# CONFIG_ARCH_EBSA110 is not set
142# CONFIG_ARCH_EP93XX is not set
143# CONFIG_ARCH_FOOTBRIDGE is not set
144# CONFIG_ARCH_NETX is not set
145# CONFIG_ARCH_H720X is not set
146# CONFIG_ARCH_IMX is not set
147# CONFIG_ARCH_IOP13XX is not set
148# CONFIG_ARCH_IOP32X is not set
149# CONFIG_ARCH_IOP33X is not set
150# CONFIG_ARCH_IXP23XX is not set
151# CONFIG_ARCH_IXP2000 is not set
152# CONFIG_ARCH_IXP4XX is not set
153# CONFIG_ARCH_L7200 is not set
154# CONFIG_ARCH_KIRKWOOD is not set
155# CONFIG_ARCH_KS8695 is not set
156# CONFIG_ARCH_NS9XXX is not set
157# CONFIG_ARCH_LOKI is not set
158# CONFIG_ARCH_MV78XX0 is not set
159# CONFIG_ARCH_MXC is not set
160# CONFIG_ARCH_ORION5X is not set
161# CONFIG_ARCH_PNX4008 is not set
162CONFIG_ARCH_PXA=y
163# CONFIG_ARCH_RPC is not set
164# CONFIG_ARCH_SA1100 is not set
165# CONFIG_ARCH_S3C2410 is not set
166# CONFIG_ARCH_SHARK is not set
167# CONFIG_ARCH_LH7A40X is not set
168# CONFIG_ARCH_DAVINCI is not set
169# CONFIG_ARCH_OMAP is not set
170# CONFIG_ARCH_MSM7X00A is not set
171
172#
173# Intel PXA2xx/PXA3xx Implementations
174#
175# CONFIG_ARCH_GUMSTIX is not set
176# CONFIG_ARCH_LUBBOCK is not set
177# CONFIG_MACH_LOGICPD_PXA270 is not set
178# CONFIG_MACH_MAINSTONE is not set
179# CONFIG_ARCH_PXA_IDP is not set
180# CONFIG_PXA_SHARPSL is not set
181# CONFIG_ARCH_PXA_ESERIES is not set
182CONFIG_MACH_H5000=y
183# CONFIG_MACH_TRIZEPS4 is not set
184# CONFIG_MACH_EM_X270 is not set
185# CONFIG_MACH_COLIBRI is not set
186# CONFIG_MACH_ZYLONITE is not set
187# CONFIG_MACH_LITTLETON is not set
188# CONFIG_MACH_TAVOREVB is not set
189# CONFIG_MACH_SAAR is not set
190# CONFIG_MACH_ARMCORE is not set
191# CONFIG_MACH_MAGICIAN is not set
192# CONFIG_MACH_PCM027 is not set
193# CONFIG_ARCH_PXA_PALM is not set
194# CONFIG_PXA_EZX is not set
195CONFIG_PXA25x=y
196# CONFIG_PXA_PWM is not set
197
198#
199# Boot options
200#
201
202#
203# Power management
204#
205
206#
207# Processor Type
208#
209CONFIG_CPU_32=y
210CONFIG_CPU_XSCALE=y
211CONFIG_CPU_32v5=y
212CONFIG_CPU_ABRT_EV5T=y
213CONFIG_CPU_PABRT_NOIFAR=y
214CONFIG_CPU_CACHE_VIVT=y
215CONFIG_CPU_TLB_V4WBI=y
216CONFIG_CPU_CP15=y
217CONFIG_CPU_CP15_MMU=y
218
219#
220# Processor Features
221#
222CONFIG_ARM_THUMB=y
223# CONFIG_CPU_DCACHE_DISABLE is not set
224# CONFIG_OUTER_CACHE is not set
225# CONFIG_IWMMXT is not set
226CONFIG_XSCALE_PMU=y
227
228#
229# Bus support
230#
231# CONFIG_PCI_SYSCALL is not set
232# CONFIG_ARCH_SUPPORTS_MSI is not set
233# CONFIG_PCCARD is not set
234
235#
236# Kernel Features
237#
238CONFIG_TICK_ONESHOT=y
239# CONFIG_NO_HZ is not set
240# CONFIG_HIGH_RES_TIMERS is not set
241CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
242# CONFIG_PREEMPT is not set
243CONFIG_HZ=100
244CONFIG_AEABI=y
245CONFIG_OABI_COMPAT=y
246CONFIG_ARCH_FLATMEM_HAS_HOLES=y
247# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
248CONFIG_SELECT_MEMORY_MODEL=y
249CONFIG_FLATMEM_MANUAL=y
250# CONFIG_DISCONTIGMEM_MANUAL is not set
251# CONFIG_SPARSEMEM_MANUAL is not set
252CONFIG_FLATMEM=y
253CONFIG_FLAT_NODE_MEM_MAP=y
254# CONFIG_SPARSEMEM_STATIC is not set
255# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
256CONFIG_PAGEFLAGS_EXTENDED=y
257CONFIG_SPLIT_PTLOCK_CPUS=4096
258# CONFIG_RESOURCES_64BIT is not set
259CONFIG_ZONE_DMA_FLAG=1
260CONFIG_BOUNCE=y
261CONFIG_VIRT_TO_BUS=y
262CONFIG_ALIGNMENT_TRAP=y
263
264#
265# Boot options
266#
267CONFIG_ZBOOT_ROM_TEXT=0x0
268CONFIG_ZBOOT_ROM_BSS=0x0
269CONFIG_CMDLINE="keepinitrd"
270# CONFIG_XIP_KERNEL is not set
271CONFIG_KEXEC=y
272CONFIG_ATAGS_PROC=y
273
274#
275# CPU Frequency scaling
276#
277# CONFIG_CPU_FREQ is not set
278
279#
280# Floating point emulation
281#
282
283#
284# At least one emulation must be selected
285#
286CONFIG_FPE_NWFPE=y
287# CONFIG_FPE_NWFPE_XP is not set
288# CONFIG_FPE_FASTFPE is not set
289
290#
291# Userspace binary formats
292#
293CONFIG_BINFMT_ELF=y
294# CONFIG_BINFMT_AOUT is not set
295# CONFIG_BINFMT_MISC is not set
296
297#
298# Power management options
299#
300CONFIG_PM=y
301# CONFIG_PM_DEBUG is not set
302CONFIG_PM_SLEEP=y
303CONFIG_SUSPEND=y
304CONFIG_SUSPEND_FREEZER=y
305CONFIG_APM_EMULATION=y
306CONFIG_ARCH_SUSPEND_POSSIBLE=y
307CONFIG_NET=y
308
309#
310# Networking options
311#
312CONFIG_PACKET=y
313CONFIG_PACKET_MMAP=y
314CONFIG_UNIX=y
315# CONFIG_NET_KEY is not set
316CONFIG_INET=y
317CONFIG_IP_MULTICAST=y
318# CONFIG_IP_ADVANCED_ROUTER is not set
319CONFIG_IP_FIB_HASH=y
320CONFIG_IP_PNP=y
321# CONFIG_IP_PNP_DHCP is not set
322# CONFIG_IP_PNP_BOOTP is not set
323# CONFIG_IP_PNP_RARP is not set
324# CONFIG_NET_IPIP is not set
325# CONFIG_NET_IPGRE is not set
326# CONFIG_IP_MROUTE is not set
327# CONFIG_ARPD is not set
328# CONFIG_SYN_COOKIES is not set
329# CONFIG_INET_AH is not set
330# CONFIG_INET_ESP is not set
331# CONFIG_INET_IPCOMP is not set
332# CONFIG_INET_XFRM_TUNNEL is not set
333# CONFIG_INET_TUNNEL is not set
334# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
335# CONFIG_INET_XFRM_MODE_TUNNEL is not set
336# CONFIG_INET_XFRM_MODE_BEET is not set
337# CONFIG_INET_LRO is not set
338# CONFIG_INET_DIAG is not set
339# CONFIG_TCP_CONG_ADVANCED is not set
340CONFIG_TCP_CONG_CUBIC=y
341CONFIG_DEFAULT_TCP_CONG="cubic"
342# CONFIG_TCP_MD5SIG is not set
343# CONFIG_IPV6 is not set
344# CONFIG_NETWORK_SECMARK is not set
345# CONFIG_NETFILTER is not set
346# CONFIG_IP_DCCP is not set
347# CONFIG_IP_SCTP is not set
348# CONFIG_TIPC is not set
349# CONFIG_ATM is not set
350# CONFIG_BRIDGE is not set
351# CONFIG_VLAN_8021Q is not set
352# CONFIG_DECNET is not set
353# CONFIG_LLC2 is not set
354# CONFIG_IPX is not set
355# CONFIG_ATALK is not set
356# CONFIG_X25 is not set
357# CONFIG_LAPB is not set
358# CONFIG_ECONET is not set
359# CONFIG_WAN_ROUTER is not set
360# CONFIG_NET_SCHED is not set
361
362#
363# Network testing
364#
365# CONFIG_NET_PKTGEN is not set
366# CONFIG_HAMRADIO is not set
367# CONFIG_CAN is not set
368# CONFIG_IRDA is not set
369# CONFIG_BT is not set
370# CONFIG_AF_RXRPC is not set
371
372#
373# Wireless
374#
375# CONFIG_CFG80211 is not set
376# CONFIG_WIRELESS_EXT is not set
377# CONFIG_MAC80211 is not set
378# CONFIG_IEEE80211 is not set
379# CONFIG_RFKILL is not set
380# CONFIG_NET_9P is not set
381
382#
383# Device Drivers
384#
385
386#
387# Generic Driver Options
388#
389CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
390CONFIG_STANDALONE=y
391CONFIG_PREVENT_FIRMWARE_BUILD=y
392CONFIG_FW_LOADER=y
393CONFIG_FIRMWARE_IN_KERNEL=y
394CONFIG_EXTRA_FIRMWARE=""
395# CONFIG_DEBUG_DRIVER is not set
396# CONFIG_DEBUG_DEVRES is not set
397# CONFIG_SYS_HYPERVISOR is not set
398# CONFIG_CONNECTOR is not set
399CONFIG_MTD=y
400# CONFIG_MTD_DEBUG is not set
401# CONFIG_MTD_CONCAT is not set
402CONFIG_MTD_PARTITIONS=y
403# CONFIG_MTD_REDBOOT_PARTS is not set
404# CONFIG_MTD_CMDLINE_PARTS is not set
405# CONFIG_MTD_AFS_PARTS is not set
406# CONFIG_MTD_AR7_PARTS is not set
407
408#
409# User Modules And Translation Layers
410#
411# CONFIG_MTD_CHAR is not set
412CONFIG_MTD_BLKDEVS=y
413CONFIG_MTD_BLOCK=y
414# CONFIG_FTL is not set
415# CONFIG_NFTL is not set
416# CONFIG_INFTL is not set
417# CONFIG_RFD_FTL is not set
418# CONFIG_SSFDC is not set
419# CONFIG_MTD_OOPS is not set
420
421#
422# RAM/ROM/Flash chip drivers
423#
424CONFIG_MTD_CFI=y
425# CONFIG_MTD_JEDECPROBE is not set
426CONFIG_MTD_GEN_PROBE=y
427CONFIG_MTD_CFI_ADV_OPTIONS=y
428CONFIG_MTD_CFI_NOSWAP=y
429# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
430# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
431CONFIG_MTD_CFI_GEOMETRY=y
432CONFIG_MTD_MAP_BANK_WIDTH_1=y
433CONFIG_MTD_MAP_BANK_WIDTH_2=y
434CONFIG_MTD_MAP_BANK_WIDTH_4=y
435# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
436# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
437# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
438CONFIG_MTD_CFI_I1=y
439CONFIG_MTD_CFI_I2=y
440# CONFIG_MTD_CFI_I4 is not set
441# CONFIG_MTD_CFI_I8 is not set
442# CONFIG_MTD_OTP is not set
443CONFIG_MTD_CFI_INTELEXT=y
444# CONFIG_MTD_CFI_AMDSTD is not set
445# CONFIG_MTD_CFI_STAA is not set
446CONFIG_MTD_CFI_UTIL=y
447# CONFIG_MTD_RAM is not set
448# CONFIG_MTD_ROM is not set
449# CONFIG_MTD_ABSENT is not set
450# CONFIG_MTD_XIP is not set
451
452#
453# Mapping drivers for chip access
454#
455# CONFIG_MTD_COMPLEX_MAPPINGS is not set
456CONFIG_MTD_PHYSMAP=y
457CONFIG_MTD_PHYSMAP_START=0x8000000
458CONFIG_MTD_PHYSMAP_LEN=0x0
459CONFIG_MTD_PHYSMAP_BANKWIDTH=2
460# CONFIG_MTD_PXA2XX is not set
461# CONFIG_MTD_ARM_INTEGRATOR is not set
462# CONFIG_MTD_SHARP_SL is not set
463# CONFIG_MTD_PLATRAM is not set
464
465#
466# Self-contained MTD device drivers
467#
468# CONFIG_MTD_SLRAM is not set
469# CONFIG_MTD_PHRAM is not set
470# CONFIG_MTD_MTDRAM is not set
471# CONFIG_MTD_BLOCK2MTD is not set
472
473#
474# Disk-On-Chip Device Drivers
475#
476# CONFIG_MTD_DOC2000 is not set
477# CONFIG_MTD_DOC2001 is not set
478# CONFIG_MTD_DOC2001PLUS is not set
479# CONFIG_MTD_NAND is not set
480# CONFIG_MTD_ONENAND is not set
481
482#
483# UBI - Unsorted block images
484#
485# CONFIG_MTD_UBI is not set
486# CONFIG_PARPORT is not set
487CONFIG_BLK_DEV=y
488# CONFIG_BLK_DEV_COW_COMMON is not set
489# CONFIG_BLK_DEV_LOOP is not set
490# CONFIG_BLK_DEV_NBD is not set
491# CONFIG_BLK_DEV_RAM is not set
492# CONFIG_CDROM_PKTCDVD is not set
493# CONFIG_ATA_OVER_ETH is not set
494CONFIG_MISC_DEVICES=y
495# CONFIG_EEPROM_93CX6 is not set
496# CONFIG_ENCLOSURE_SERVICES is not set
497CONFIG_HAVE_IDE=y
498# CONFIG_IDE is not set
499
500#
501# SCSI device support
502#
503# CONFIG_RAID_ATTRS is not set
504# CONFIG_SCSI is not set
505# CONFIG_SCSI_DMA is not set
506# CONFIG_SCSI_NETLINK is not set
507# CONFIG_ATA is not set
508# CONFIG_MD is not set
509# CONFIG_NETDEVICES is not set
510# CONFIG_ISDN is not set
511
512#
513# Input device support
514#
515CONFIG_INPUT=y
516# CONFIG_INPUT_FF_MEMLESS is not set
517# CONFIG_INPUT_POLLDEV is not set
518
519#
520# Userland interfaces
521#
522# CONFIG_INPUT_MOUSEDEV is not set
523# CONFIG_INPUT_JOYDEV is not set
524# CONFIG_INPUT_EVDEV is not set
525# CONFIG_INPUT_EVBUG is not set
526# CONFIG_INPUT_APMPOWER is not set
527
528#
529# Input Device Drivers
530#
531# CONFIG_INPUT_KEYBOARD is not set
532# CONFIG_INPUT_MOUSE is not set
533# CONFIG_INPUT_JOYSTICK is not set
534# CONFIG_INPUT_TABLET is not set
535# CONFIG_INPUT_TOUCHSCREEN is not set
536# CONFIG_INPUT_MISC is not set
537
538#
539# Hardware I/O ports
540#
541# CONFIG_SERIO is not set
542# CONFIG_GAMEPORT is not set
543
544#
545# Character devices
546#
547CONFIG_VT=y
548CONFIG_CONSOLE_TRANSLATIONS=y
549CONFIG_VT_CONSOLE=y
550CONFIG_HW_CONSOLE=y
551# CONFIG_VT_HW_CONSOLE_BINDING is not set
552CONFIG_DEVKMEM=y
553# CONFIG_SERIAL_NONSTANDARD is not set
554
555#
556# Serial drivers
557#
558# CONFIG_SERIAL_8250 is not set
559
560#
561# Non-8250 serial port support
562#
563CONFIG_SERIAL_PXA=y
564CONFIG_SERIAL_PXA_CONSOLE=y
565CONFIG_SERIAL_CORE=y
566CONFIG_SERIAL_CORE_CONSOLE=y
567CONFIG_UNIX98_PTYS=y
568CONFIG_LEGACY_PTYS=y
569CONFIG_LEGACY_PTY_COUNT=32
570# CONFIG_IPMI_HANDLER is not set
571# CONFIG_HW_RANDOM is not set
572# CONFIG_NVRAM is not set
573# CONFIG_R3964 is not set
574# CONFIG_RAW_DRIVER is not set
575# CONFIG_TCG_TPM is not set
576# CONFIG_I2C is not set
577# CONFIG_SPI is not set
578CONFIG_ARCH_REQUIRE_GPIOLIB=y
579CONFIG_GPIOLIB=y
580# CONFIG_DEBUG_GPIO is not set
581# CONFIG_GPIO_SYSFS is not set
582
583#
584# I2C GPIO expanders:
585#
586
587#
588# PCI GPIO expanders:
589#
590
591#
592# SPI GPIO expanders:
593#
594# CONFIG_W1 is not set
595# CONFIG_POWER_SUPPLY is not set
596# CONFIG_HWMON is not set
597# CONFIG_WATCHDOG is not set
598
599#
600# Sonics Silicon Backplane
601#
602CONFIG_SSB_POSSIBLE=y
603# CONFIG_SSB is not set
604
605#
606# Multifunction device drivers
607#
608# CONFIG_MFD_CORE is not set
609# CONFIG_MFD_SM501 is not set
610# CONFIG_HTC_EGPIO is not set
611# CONFIG_HTC_PASIC3 is not set
612# CONFIG_MFD_TMIO is not set
613# CONFIG_MFD_T7L66XB is not set
614# CONFIG_MFD_TC6387XB is not set
615# CONFIG_MFD_TC6393XB is not set
616
617#
618# Multimedia devices
619#
620
621#
622# Multimedia core support
623#
624# CONFIG_VIDEO_DEV is not set
625# CONFIG_DVB_CORE is not set
626# CONFIG_VIDEO_MEDIA is not set
627
628#
629# Multimedia drivers
630#
631# CONFIG_DAB is not set
632
633#
634# Graphics support
635#
636# CONFIG_VGASTATE is not set
637# CONFIG_VIDEO_OUTPUT_CONTROL is not set
638# CONFIG_FB is not set
639# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
640
641#
642# Display device support
643#
644# CONFIG_DISPLAY_SUPPORT is not set
645
646#
647# Console display driver support
648#
649# CONFIG_VGA_CONSOLE is not set
650CONFIG_DUMMY_CONSOLE=y
651# CONFIG_SOUND is not set
652# CONFIG_HID_SUPPORT is not set
653CONFIG_USB_SUPPORT=y
654CONFIG_USB_ARCH_HAS_HCD=y
655# CONFIG_USB_ARCH_HAS_OHCI is not set
656# CONFIG_USB_ARCH_HAS_EHCI is not set
657# CONFIG_USB is not set
658# CONFIG_USB_OTG_WHITELIST is not set
659# CONFIG_USB_OTG_BLACKLIST_HUB is not set
660# CONFIG_USB_MUSB_HDRC is not set
661# CONFIG_USB_GADGET_MUSB_HDRC is not set
662
663#
664# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
665#
666CONFIG_USB_GADGET=y
667# CONFIG_USB_GADGET_DEBUG is not set
668# CONFIG_USB_GADGET_DEBUG_FILES is not set
669CONFIG_USB_GADGET_SELECTED=y
670# CONFIG_USB_GADGET_AMD5536UDC is not set
671# CONFIG_USB_GADGET_ATMEL_USBA is not set
672# CONFIG_USB_GADGET_FSL_USB2 is not set
673# CONFIG_USB_GADGET_NET2280 is not set
674CONFIG_USB_GADGET_PXA25X=y
675CONFIG_USB_PXA25X=y
676CONFIG_USB_PXA25X_SMALL=y
677# CONFIG_USB_GADGET_M66592 is not set
678# CONFIG_USB_GADGET_PXA27X is not set
679# CONFIG_USB_GADGET_GOKU is not set
680# CONFIG_USB_GADGET_LH7A40X is not set
681# CONFIG_USB_GADGET_OMAP is not set
682# CONFIG_USB_GADGET_S3C2410 is not set
683# CONFIG_USB_GADGET_AT91 is not set
684# CONFIG_USB_GADGET_DUMMY_HCD is not set
685# CONFIG_USB_GADGET_DUALSPEED is not set
686# CONFIG_USB_ZERO is not set
687CONFIG_USB_ETH=y
688# CONFIG_USB_ETH_RNDIS is not set
689# CONFIG_USB_GADGETFS is not set
690# CONFIG_USB_FILE_STORAGE is not set
691# CONFIG_USB_G_SERIAL is not set
692# CONFIG_USB_MIDI_GADGET is not set
693# CONFIG_USB_G_PRINTER is not set
694# CONFIG_USB_CDC_COMPOSITE is not set
695# CONFIG_MMC is not set
696# CONFIG_NEW_LEDS is not set
697CONFIG_RTC_LIB=y
698CONFIG_RTC_CLASS=y
699CONFIG_RTC_HCTOSYS=y
700CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
701# CONFIG_RTC_DEBUG is not set
702
703#
704# RTC interfaces
705#
706CONFIG_RTC_INTF_SYSFS=y
707CONFIG_RTC_INTF_PROC=y
708CONFIG_RTC_INTF_DEV=y
709# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
710# CONFIG_RTC_DRV_TEST is not set
711
712#
713# SPI RTC drivers
714#
715
716#
717# Platform RTC drivers
718#
719# CONFIG_RTC_DRV_CMOS is not set
720# CONFIG_RTC_DRV_DS1511 is not set
721# CONFIG_RTC_DRV_DS1553 is not set
722# CONFIG_RTC_DRV_DS1742 is not set
723# CONFIG_RTC_DRV_STK17TA8 is not set
724# CONFIG_RTC_DRV_M48T86 is not set
725# CONFIG_RTC_DRV_M48T59 is not set
726# CONFIG_RTC_DRV_V3020 is not set
727
728#
729# on-CPU RTC drivers
730#
731CONFIG_RTC_DRV_SA1100=y
732# CONFIG_DMADEVICES is not set
733
734#
735# Voltage and Current regulators
736#
737# CONFIG_REGULATOR is not set
738# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
739# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
740# CONFIG_REGULATOR_BQ24022 is not set
741# CONFIG_UIO is not set
742
743#
744# File systems
745#
746CONFIG_EXT2_FS=y
747# CONFIG_EXT2_FS_XATTR is not set
748# CONFIG_EXT2_FS_XIP is not set
749# CONFIG_EXT3_FS is not set
750# CONFIG_EXT4DEV_FS is not set
751# CONFIG_REISERFS_FS is not set
752# CONFIG_JFS_FS is not set
753# CONFIG_FS_POSIX_ACL is not set
754# CONFIG_XFS_FS is not set
755# CONFIG_OCFS2_FS is not set
756CONFIG_DNOTIFY=y
757CONFIG_INOTIFY=y
758CONFIG_INOTIFY_USER=y
759# CONFIG_QUOTA is not set
760# CONFIG_AUTOFS_FS is not set
761# CONFIG_AUTOFS4_FS is not set
762# CONFIG_FUSE_FS is not set
763
764#
765# CD-ROM/DVD Filesystems
766#
767# CONFIG_ISO9660_FS is not set
768# CONFIG_UDF_FS is not set
769
770#
771# DOS/FAT/NT Filesystems
772#
773# CONFIG_MSDOS_FS is not set
774# CONFIG_VFAT_FS is not set
775# CONFIG_NTFS_FS is not set
776
777#
778# Pseudo filesystems
779#
780CONFIG_PROC_FS=y
781CONFIG_PROC_SYSCTL=y
782CONFIG_SYSFS=y
783CONFIG_TMPFS=y
784# CONFIG_TMPFS_POSIX_ACL is not set
785# CONFIG_HUGETLB_PAGE is not set
786# CONFIG_CONFIGFS_FS is not set
787
788#
789# Miscellaneous filesystems
790#
791# CONFIG_ADFS_FS is not set
792# CONFIG_AFFS_FS is not set
793# CONFIG_HFS_FS is not set
794# CONFIG_HFSPLUS_FS is not set
795# CONFIG_BEFS_FS is not set
796# CONFIG_BFS_FS is not set
797# CONFIG_EFS_FS is not set
798CONFIG_JFFS2_FS=y
799CONFIG_JFFS2_FS_DEBUG=0
800CONFIG_JFFS2_FS_WRITEBUFFER=y
801# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
802# CONFIG_JFFS2_SUMMARY is not set
803# CONFIG_JFFS2_FS_XATTR is not set
804CONFIG_JFFS2_COMPRESSION_OPTIONS=y
805CONFIG_JFFS2_ZLIB=y
806# CONFIG_JFFS2_LZO is not set
807CONFIG_JFFS2_RTIME=y
808# CONFIG_JFFS2_RUBIN is not set
809# CONFIG_JFFS2_CMODE_NONE is not set
810CONFIG_JFFS2_CMODE_PRIORITY=y
811# CONFIG_JFFS2_CMODE_SIZE is not set
812# CONFIG_JFFS2_CMODE_FAVOURLZO is not set
813# CONFIG_CRAMFS is not set
814# CONFIG_VXFS_FS is not set
815# CONFIG_MINIX_FS is not set
816# CONFIG_OMFS_FS is not set
817# CONFIG_HPFS_FS is not set
818# CONFIG_QNX4FS_FS is not set
819# CONFIG_ROMFS_FS is not set
820# CONFIG_SYSV_FS is not set
821# CONFIG_UFS_FS is not set
822# CONFIG_NETWORK_FILESYSTEMS is not set
823
824#
825# Partition Types
826#
827# CONFIG_PARTITION_ADVANCED is not set
828CONFIG_MSDOS_PARTITION=y
829# CONFIG_NLS is not set
830# CONFIG_DLM is not set
831
832#
833# Kernel hacking
834#
835CONFIG_PRINTK_TIME=y
836CONFIG_ENABLE_WARN_DEPRECATED=y
837CONFIG_ENABLE_MUST_CHECK=y
838CONFIG_FRAME_WARN=1024
839# CONFIG_MAGIC_SYSRQ is not set
840# CONFIG_UNUSED_SYMBOLS is not set
841# CONFIG_DEBUG_FS is not set
842# CONFIG_HEADERS_CHECK is not set
843CONFIG_DEBUG_KERNEL=y
844# CONFIG_DEBUG_SHIRQ is not set
845CONFIG_DETECT_SOFTLOCKUP=y
846# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
847CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
848# CONFIG_SCHED_DEBUG is not set
849# CONFIG_SCHEDSTATS is not set
850# CONFIG_TIMER_STATS is not set
851# CONFIG_DEBUG_OBJECTS is not set
852# CONFIG_DEBUG_SLAB is not set
853# CONFIG_DEBUG_RT_MUTEXES is not set
854# CONFIG_RT_MUTEX_TESTER is not set
855# CONFIG_DEBUG_SPINLOCK is not set
856# CONFIG_DEBUG_MUTEXES is not set
857# CONFIG_DEBUG_LOCK_ALLOC is not set
858# CONFIG_PROVE_LOCKING is not set
859# CONFIG_LOCK_STAT is not set
860# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
861# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
862# CONFIG_DEBUG_KOBJECT is not set
863# CONFIG_DEBUG_BUGVERBOSE is not set
864# CONFIG_DEBUG_INFO is not set
865# CONFIG_DEBUG_VM is not set
866# CONFIG_DEBUG_WRITECOUNT is not set
867# CONFIG_DEBUG_MEMORY_INIT is not set
868# CONFIG_DEBUG_LIST is not set
869# CONFIG_DEBUG_SG is not set
870CONFIG_FRAME_POINTER=y
871# CONFIG_BOOT_PRINTK_DELAY is not set
872# CONFIG_RCU_TORTURE_TEST is not set
873# CONFIG_BACKTRACE_SELF_TEST is not set
874# CONFIG_FAULT_INJECTION is not set
875# CONFIG_LATENCYTOP is not set
876CONFIG_SYSCTL_SYSCALL_CHECK=y
877CONFIG_HAVE_FTRACE=y
878CONFIG_HAVE_DYNAMIC_FTRACE=y
879# CONFIG_FTRACE is not set
880# CONFIG_IRQSOFF_TRACER is not set
881# CONFIG_SCHED_TRACER is not set
882# CONFIG_CONTEXT_SWITCH_TRACER is not set
883# CONFIG_SAMPLES is not set
884CONFIG_HAVE_ARCH_KGDB=y
885# CONFIG_KGDB is not set
886# CONFIG_DEBUG_USER is not set
887# CONFIG_DEBUG_ERRORS is not set
888# CONFIG_DEBUG_STACK_USAGE is not set
889# CONFIG_DEBUG_LL is not set
890
891#
892# Security options
893#
894# CONFIG_KEYS is not set
895# CONFIG_SECURITY is not set
896# CONFIG_SECURITY_FILE_CAPABILITIES is not set
897CONFIG_CRYPTO=y
898
899#
900# Crypto core or helper
901#
902CONFIG_CRYPTO_ALGAPI=y
903CONFIG_CRYPTO_HASH=y
904CONFIG_CRYPTO_MANAGER=y
905# CONFIG_CRYPTO_GF128MUL is not set
906# CONFIG_CRYPTO_NULL is not set
907# CONFIG_CRYPTO_CRYPTD is not set
908# CONFIG_CRYPTO_AUTHENC is not set
909# CONFIG_CRYPTO_TEST is not set
910
911#
912# Authenticated Encryption with Associated Data
913#
914# CONFIG_CRYPTO_CCM is not set
915# CONFIG_CRYPTO_GCM is not set
916# CONFIG_CRYPTO_SEQIV is not set
917
918#
919# Block modes
920#
921# CONFIG_CRYPTO_CBC is not set
922# CONFIG_CRYPTO_CTR is not set
923# CONFIG_CRYPTO_CTS is not set
924# CONFIG_CRYPTO_ECB is not set
925# CONFIG_CRYPTO_LRW is not set
926# CONFIG_CRYPTO_PCBC is not set
927# CONFIG_CRYPTO_XTS is not set
928
929#
930# Hash modes
931#
932CONFIG_CRYPTO_HMAC=y
933# CONFIG_CRYPTO_XCBC is not set
934
935#
936# Digest
937#
938# CONFIG_CRYPTO_CRC32C is not set
939# CONFIG_CRYPTO_MD4 is not set
940CONFIG_CRYPTO_MD5=y
941# CONFIG_CRYPTO_MICHAEL_MIC is not set
942# CONFIG_CRYPTO_RMD128 is not set
943# CONFIG_CRYPTO_RMD160 is not set
944# CONFIG_CRYPTO_RMD256 is not set
945# CONFIG_CRYPTO_RMD320 is not set
946CONFIG_CRYPTO_SHA1=y
947# CONFIG_CRYPTO_SHA256 is not set
948# CONFIG_CRYPTO_SHA512 is not set
949# CONFIG_CRYPTO_TGR192 is not set
950# CONFIG_CRYPTO_WP512 is not set
951
952#
953# Ciphers
954#
955# CONFIG_CRYPTO_AES is not set
956# CONFIG_CRYPTO_ANUBIS is not set
957# CONFIG_CRYPTO_ARC4 is not set
958# CONFIG_CRYPTO_BLOWFISH is not set
959# CONFIG_CRYPTO_CAMELLIA is not set
960# CONFIG_CRYPTO_CAST5 is not set
961# CONFIG_CRYPTO_CAST6 is not set
962CONFIG_CRYPTO_DES=y
963# CONFIG_CRYPTO_FCRYPT is not set
964# CONFIG_CRYPTO_KHAZAD is not set
965# CONFIG_CRYPTO_SALSA20 is not set
966# CONFIG_CRYPTO_SEED is not set
967# CONFIG_CRYPTO_SERPENT is not set
968# CONFIG_CRYPTO_TEA is not set
969# CONFIG_CRYPTO_TWOFISH is not set
970
971#
972# Compression
973#
974CONFIG_CRYPTO_DEFLATE=y
975# CONFIG_CRYPTO_LZO is not set
976# CONFIG_CRYPTO_HW is not set
977
978#
979# Library routines
980#
981CONFIG_BITREVERSE=y
982# CONFIG_GENERIC_FIND_FIRST_BIT is not set
983# CONFIG_GENERIC_FIND_NEXT_BIT is not set
984CONFIG_CRC_CCITT=y
985# CONFIG_CRC16 is not set
986# CONFIG_CRC_T10DIF is not set
987# CONFIG_CRC_ITU_T is not set
988CONFIG_CRC32=y
989# CONFIG_CRC7 is not set
990# CONFIG_LIBCRC32C is not set
991CONFIG_ZLIB_INFLATE=y
992CONFIG_ZLIB_DEFLATE=y
993CONFIG_PLIST=y
994CONFIG_HAS_IOMEM=y
995CONFIG_HAS_IOPORT=y
996CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
index e3357ba10f1f..ab8b1e0d0dac 100644
--- a/arch/arm/configs/kirkwood_defconfig
+++ b/arch/arm/configs/kirkwood_defconfig
@@ -1,11 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc5 3# Linux kernel version: 2.6.28-rc7
4# Sun Jun 22 15:51:25 2008 4# Thu Dec 4 15:27:39 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 8# CONFIG_GENERIC_GPIO is not set
9CONFIG_GENERIC_TIME=y 9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y 10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y 11CONFIG_MMU=y
@@ -22,8 +22,7 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
22# CONFIG_ARCH_HAS_ILOG2_U64 is not set 22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
23CONFIG_GENERIC_HWEIGHT=y 23CONFIG_GENERIC_HWEIGHT=y
24CONFIG_GENERIC_CALIBRATE_DELAY=y 24CONFIG_GENERIC_CALIBRATE_DELAY=y
25CONFIG_ARCH_SUPPORTS_AOUT=y 25CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
26CONFIG_ZONE_DMA=y
27CONFIG_VECTORS_BASE=0xffff0000 26CONFIG_VECTORS_BASE=0xffff0000
28CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 27CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
29 28
@@ -49,14 +48,17 @@ CONFIG_LOG_BUF_SHIFT=14
49# CONFIG_GROUP_SCHED is not set 48# CONFIG_GROUP_SCHED is not set
50# CONFIG_SYSFS_DEPRECATED_V2 is not set 49# CONFIG_SYSFS_DEPRECATED_V2 is not set
51# CONFIG_RELAY is not set 50# CONFIG_RELAY is not set
52# CONFIG_NAMESPACES is not set 51CONFIG_NAMESPACES=y
52# CONFIG_UTS_NS is not set
53# CONFIG_IPC_NS is not set
54# CONFIG_USER_NS is not set
55# CONFIG_PID_NS is not set
53# CONFIG_BLK_DEV_INITRD is not set 56# CONFIG_BLK_DEV_INITRD is not set
54CONFIG_CC_OPTIMIZE_FOR_SIZE=y 57CONFIG_CC_OPTIMIZE_FOR_SIZE=y
55CONFIG_SYSCTL=y 58CONFIG_SYSCTL=y
56CONFIG_EMBEDDED=y 59# CONFIG_EMBEDDED is not set
57CONFIG_UID16=y 60CONFIG_UID16=y
58CONFIG_SYSCTL_SYSCALL=y 61CONFIG_SYSCTL_SYSCALL=y
59CONFIG_SYSCTL_SYSCALL_CHECK=y
60CONFIG_KALLSYMS=y 62CONFIG_KALLSYMS=y
61# CONFIG_KALLSYMS_ALL is not set 63# CONFIG_KALLSYMS_ALL is not set
62# CONFIG_KALLSYMS_EXTRA_PASS is not set 64# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -73,9 +75,12 @@ CONFIG_SIGNALFD=y
73CONFIG_TIMERFD=y 75CONFIG_TIMERFD=y
74CONFIG_EVENTFD=y 76CONFIG_EVENTFD=y
75CONFIG_SHMEM=y 77CONFIG_SHMEM=y
78CONFIG_AIO=y
76CONFIG_VM_EVENT_COUNTERS=y 79CONFIG_VM_EVENT_COUNTERS=y
77CONFIG_SLAB=y 80CONFIG_PCI_QUIRKS=y
78# CONFIG_SLUB is not set 81CONFIG_SLUB_DEBUG=y
82# CONFIG_SLAB is not set
83CONFIG_SLUB=y
79# CONFIG_SLOB is not set 84# CONFIG_SLOB is not set
80CONFIG_PROFILING=y 85CONFIG_PROFILING=y
81# CONFIG_MARKERS is not set 86# CONFIG_MARKERS is not set
@@ -85,8 +90,7 @@ CONFIG_KPROBES=y
85CONFIG_KRETPROBES=y 90CONFIG_KRETPROBES=y
86CONFIG_HAVE_KPROBES=y 91CONFIG_HAVE_KPROBES=y
87CONFIG_HAVE_KRETPROBES=y 92CONFIG_HAVE_KRETPROBES=y
88# CONFIG_HAVE_DMA_ATTRS is not set 93CONFIG_HAVE_GENERIC_DMA_COHERENT=y
89CONFIG_PROC_PAGE_MONITOR=y
90CONFIG_SLABINFO=y 94CONFIG_SLABINFO=y
91CONFIG_RT_MUTEXES=y 95CONFIG_RT_MUTEXES=y
92# CONFIG_TINY_SHMEM is not set 96# CONFIG_TINY_SHMEM is not set
@@ -97,12 +101,13 @@ CONFIG_MODULE_UNLOAD=y
97# CONFIG_MODULE_FORCE_UNLOAD is not set 101# CONFIG_MODULE_FORCE_UNLOAD is not set
98# CONFIG_MODVERSIONS is not set 102# CONFIG_MODVERSIONS is not set
99# CONFIG_MODULE_SRCVERSION_ALL is not set 103# CONFIG_MODULE_SRCVERSION_ALL is not set
100# CONFIG_KMOD is not set 104CONFIG_KMOD=y
101CONFIG_BLOCK=y 105CONFIG_BLOCK=y
102# CONFIG_LBD is not set 106# CONFIG_LBD is not set
103# CONFIG_BLK_DEV_IO_TRACE is not set 107# CONFIG_BLK_DEV_IO_TRACE is not set
104# CONFIG_LSF is not set 108# CONFIG_LSF is not set
105# CONFIG_BLK_DEV_BSG is not set 109# CONFIG_BLK_DEV_BSG is not set
110# CONFIG_BLK_DEV_INTEGRITY is not set
106 111
107# 112#
108# IO Schedulers 113# IO Schedulers
@@ -117,6 +122,7 @@ CONFIG_DEFAULT_CFQ=y
117# CONFIG_DEFAULT_NOOP is not set 122# CONFIG_DEFAULT_NOOP is not set
118CONFIG_DEFAULT_IOSCHED="cfq" 123CONFIG_DEFAULT_IOSCHED="cfq"
119CONFIG_CLASSIC_RCU=y 124CONFIG_CLASSIC_RCU=y
125# CONFIG_FREEZER is not set
120 126
121# 127#
122# System Type 128# System Type
@@ -128,7 +134,6 @@ CONFIG_CLASSIC_RCU=y
128# CONFIG_ARCH_AT91 is not set 134# CONFIG_ARCH_AT91 is not set
129# CONFIG_ARCH_CLPS7500 is not set 135# CONFIG_ARCH_CLPS7500 is not set
130# CONFIG_ARCH_CLPS711X is not set 136# CONFIG_ARCH_CLPS711X is not set
131# CONFIG_ARCH_CO285 is not set
132# CONFIG_ARCH_EBSA110 is not set 137# CONFIG_ARCH_EBSA110 is not set
133# CONFIG_ARCH_EP93XX is not set 138# CONFIG_ARCH_EP93XX is not set
134# CONFIG_ARCH_FOOTBRIDGE is not set 139# CONFIG_ARCH_FOOTBRIDGE is not set
@@ -158,7 +163,7 @@ CONFIG_ARCH_KIRKWOOD=y
158# CONFIG_ARCH_LH7A40X is not set 163# CONFIG_ARCH_LH7A40X is not set
159# CONFIG_ARCH_DAVINCI is not set 164# CONFIG_ARCH_DAVINCI is not set
160# CONFIG_ARCH_OMAP is not set 165# CONFIG_ARCH_OMAP is not set
161# CONFIG_ARCH_MSM7X00A is not set 166# CONFIG_ARCH_MSM is not set
162 167
163# 168#
164# Marvell Kirkwood Implementations 169# Marvell Kirkwood Implementations
@@ -199,6 +204,7 @@ CONFIG_ARM_THUMB=y
199# CONFIG_CPU_DCACHE_DISABLE is not set 204# CONFIG_CPU_DCACHE_DISABLE is not set
200CONFIG_OUTER_CACHE=y 205CONFIG_OUTER_CACHE=y
201CONFIG_CACHE_FEROCEON_L2=y 206CONFIG_CACHE_FEROCEON_L2=y
207# CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH is not set
202 208
203# 209#
204# Bus support 210# Bus support
@@ -217,25 +223,30 @@ CONFIG_TICK_ONESHOT=y
217CONFIG_NO_HZ=y 223CONFIG_NO_HZ=y
218CONFIG_HIGH_RES_TIMERS=y 224CONFIG_HIGH_RES_TIMERS=y
219CONFIG_GENERIC_CLOCKEVENTS_BUILD=y 225CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
226CONFIG_VMSPLIT_3G=y
227# CONFIG_VMSPLIT_2G is not set
228# CONFIG_VMSPLIT_1G is not set
229CONFIG_PAGE_OFFSET=0xC0000000
220CONFIG_PREEMPT=y 230CONFIG_PREEMPT=y
221CONFIG_HZ=100 231CONFIG_HZ=100
222CONFIG_AEABI=y 232CONFIG_AEABI=y
223# CONFIG_OABI_COMPAT is not set 233# CONFIG_OABI_COMPAT is not set
224# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 234CONFIG_ARCH_FLATMEM_HAS_HOLES=y
235# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
236# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
225CONFIG_SELECT_MEMORY_MODEL=y 237CONFIG_SELECT_MEMORY_MODEL=y
226CONFIG_FLATMEM_MANUAL=y 238CONFIG_FLATMEM_MANUAL=y
227# CONFIG_DISCONTIGMEM_MANUAL is not set 239# CONFIG_DISCONTIGMEM_MANUAL is not set
228# CONFIG_SPARSEMEM_MANUAL is not set 240# CONFIG_SPARSEMEM_MANUAL is not set
229CONFIG_FLATMEM=y 241CONFIG_FLATMEM=y
230CONFIG_FLAT_NODE_MEM_MAP=y 242CONFIG_FLAT_NODE_MEM_MAP=y
231# CONFIG_SPARSEMEM_STATIC is not set
232# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
233CONFIG_PAGEFLAGS_EXTENDED=y 243CONFIG_PAGEFLAGS_EXTENDED=y
234CONFIG_SPLIT_PTLOCK_CPUS=4096 244CONFIG_SPLIT_PTLOCK_CPUS=4096
235# CONFIG_RESOURCES_64BIT is not set 245# CONFIG_RESOURCES_64BIT is not set
236CONFIG_ZONE_DMA_FLAG=1 246# CONFIG_PHYS_ADDR_T_64BIT is not set
237CONFIG_BOUNCE=y 247CONFIG_ZONE_DMA_FLAG=0
238CONFIG_VIRT_TO_BUS=y 248CONFIG_VIRT_TO_BUS=y
249CONFIG_UNEVICTABLE_LRU=y
239CONFIG_ALIGNMENT_TRAP=y 250CONFIG_ALIGNMENT_TRAP=y
240 251
241# 252#
@@ -248,6 +259,11 @@ CONFIG_CMDLINE=""
248# CONFIG_KEXEC is not set 259# CONFIG_KEXEC is not set
249 260
250# 261#
262# CPU Power Management
263#
264# CONFIG_CPU_IDLE is not set
265
266#
251# Floating point emulation 267# Floating point emulation
252# 268#
253 269
@@ -260,6 +276,8 @@ CONFIG_CMDLINE=""
260# Userspace binary formats 276# Userspace binary formats
261# 277#
262CONFIG_BINFMT_ELF=y 278CONFIG_BINFMT_ELF=y
279# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
280CONFIG_HAVE_AOUT=y
263# CONFIG_BINFMT_AOUT is not set 281# CONFIG_BINFMT_AOUT is not set
264# CONFIG_BINFMT_MISC is not set 282# CONFIG_BINFMT_MISC is not set
265 283
@@ -268,10 +286,6 @@ CONFIG_BINFMT_ELF=y
268# 286#
269# CONFIG_PM is not set 287# CONFIG_PM is not set
270CONFIG_ARCH_SUSPEND_POSSIBLE=y 288CONFIG_ARCH_SUSPEND_POSSIBLE=y
271
272#
273# Networking
274#
275CONFIG_NET=y 289CONFIG_NET=y
276 290
277# 291#
@@ -322,6 +336,15 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
322# CONFIG_TIPC is not set 336# CONFIG_TIPC is not set
323# CONFIG_ATM is not set 337# CONFIG_ATM is not set
324# CONFIG_BRIDGE is not set 338# CONFIG_BRIDGE is not set
339CONFIG_NET_DSA=y
340# CONFIG_NET_DSA_TAG_DSA is not set
341CONFIG_NET_DSA_TAG_EDSA=y
342# CONFIG_NET_DSA_TAG_TRAILER is not set
343CONFIG_NET_DSA_MV88E6XXX=y
344# CONFIG_NET_DSA_MV88E6060 is not set
345# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set
346# CONFIG_NET_DSA_MV88E6131 is not set
347CONFIG_NET_DSA_MV88E6123_61_65=y
325# CONFIG_VLAN_8021Q is not set 348# CONFIG_VLAN_8021Q is not set
326# CONFIG_DECNET is not set 349# CONFIG_DECNET is not set
327# CONFIG_LLC2 is not set 350# CONFIG_LLC2 is not set
@@ -343,12 +366,12 @@ CONFIG_NET_PKTGEN=m
343# CONFIG_IRDA is not set 366# CONFIG_IRDA is not set
344# CONFIG_BT is not set 367# CONFIG_BT is not set
345# CONFIG_AF_RXRPC is not set 368# CONFIG_AF_RXRPC is not set
346 369# CONFIG_PHONET is not set
347# 370CONFIG_WIRELESS=y
348# Wireless
349#
350# CONFIG_CFG80211 is not set 371# CONFIG_CFG80211 is not set
372CONFIG_WIRELESS_OLD_REGULATORY=y
351CONFIG_WIRELESS_EXT=y 373CONFIG_WIRELESS_EXT=y
374CONFIG_WIRELESS_EXT_SYSFS=y
352# CONFIG_MAC80211 is not set 375# CONFIG_MAC80211 is not set
353# CONFIG_IEEE80211 is not set 376# CONFIG_IEEE80211 is not set
354# CONFIG_RFKILL is not set 377# CONFIG_RFKILL is not set
@@ -365,6 +388,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
365CONFIG_STANDALONE=y 388CONFIG_STANDALONE=y
366CONFIG_PREVENT_FIRMWARE_BUILD=y 389CONFIG_PREVENT_FIRMWARE_BUILD=y
367CONFIG_FW_LOADER=y 390CONFIG_FW_LOADER=y
391CONFIG_FIRMWARE_IN_KERNEL=y
392CONFIG_EXTRA_FIRMWARE=""
368# CONFIG_DEBUG_DRIVER is not set 393# CONFIG_DEBUG_DRIVER is not set
369# CONFIG_DEBUG_DEVRES is not set 394# CONFIG_DEBUG_DEVRES is not set
370# CONFIG_SYS_HYPERVISOR is not set 395# CONFIG_SYS_HYPERVISOR is not set
@@ -453,7 +478,7 @@ CONFIG_M25PXX_USE_FAST_READ=y
453# CONFIG_MTD_DOC2001 is not set 478# CONFIG_MTD_DOC2001 is not set
454# CONFIG_MTD_DOC2001PLUS is not set 479# CONFIG_MTD_DOC2001PLUS is not set
455CONFIG_MTD_NAND=y 480CONFIG_MTD_NAND=y
456CONFIG_MTD_NAND_VERIFY_WRITE=y 481# CONFIG_MTD_NAND_VERIFY_WRITE is not set
457# CONFIG_MTD_NAND_ECC_SMC is not set 482# CONFIG_MTD_NAND_ECC_SMC is not set
458# CONFIG_MTD_NAND_MUSEUM_IDS is not set 483# CONFIG_MTD_NAND_MUSEUM_IDS is not set
459CONFIG_MTD_NAND_IDS=y 484CONFIG_MTD_NAND_IDS=y
@@ -561,6 +586,7 @@ CONFIG_SCSI_LOWLEVEL=y
561# CONFIG_SCSI_NSP32 is not set 586# CONFIG_SCSI_NSP32 is not set
562# CONFIG_SCSI_DEBUG is not set 587# CONFIG_SCSI_DEBUG is not set
563# CONFIG_SCSI_SRP is not set 588# CONFIG_SCSI_SRP is not set
589# CONFIG_SCSI_DH is not set
564CONFIG_ATA=y 590CONFIG_ATA=y
565# CONFIG_ATA_NONSTANDARD is not set 591# CONFIG_ATA_NONSTANDARD is not set
566CONFIG_SATA_PMP=y 592CONFIG_SATA_PMP=y
@@ -619,7 +645,6 @@ CONFIG_SATA_MV=y
619# CONFIG_PATA_SIS is not set 645# CONFIG_PATA_SIS is not set
620# CONFIG_PATA_VIA is not set 646# CONFIG_PATA_VIA is not set
621# CONFIG_PATA_WINBOND is not set 647# CONFIG_PATA_WINBOND is not set
622# CONFIG_PATA_PLATFORM is not set
623# CONFIG_PATA_SCH is not set 648# CONFIG_PATA_SCH is not set
624# CONFIG_MD is not set 649# CONFIG_MD is not set
625# CONFIG_FUSION is not set 650# CONFIG_FUSION is not set
@@ -627,11 +652,14 @@ CONFIG_SATA_MV=y
627# 652#
628# IEEE 1394 (FireWire) support 653# IEEE 1394 (FireWire) support
629# 654#
655
656#
657# Enable only one of the two stacks, unless you know what you are doing
658#
630# CONFIG_FIREWIRE is not set 659# CONFIG_FIREWIRE is not set
631# CONFIG_IEEE1394 is not set 660# CONFIG_IEEE1394 is not set
632# CONFIG_I2O is not set 661# CONFIG_I2O is not set
633CONFIG_NETDEVICES=y 662CONFIG_NETDEVICES=y
634# CONFIG_NETDEVICES_MULTIQUEUE is not set
635# CONFIG_DUMMY is not set 663# CONFIG_DUMMY is not set
636# CONFIG_BONDING is not set 664# CONFIG_BONDING is not set
637# CONFIG_MACVLAN is not set 665# CONFIG_MACVLAN is not set
@@ -639,7 +667,23 @@ CONFIG_NETDEVICES=y
639# CONFIG_TUN is not set 667# CONFIG_TUN is not set
640# CONFIG_VETH is not set 668# CONFIG_VETH is not set
641# CONFIG_ARCNET is not set 669# CONFIG_ARCNET is not set
642# CONFIG_PHYLIB is not set 670CONFIG_PHYLIB=y
671
672#
673# MII PHY device drivers
674#
675CONFIG_MARVELL_PHY=y
676# CONFIG_DAVICOM_PHY is not set
677# CONFIG_QSEMI_PHY is not set
678# CONFIG_LXT_PHY is not set
679# CONFIG_CICADA_PHY is not set
680# CONFIG_VITESSE_PHY is not set
681# CONFIG_SMSC_PHY is not set
682# CONFIG_BROADCOM_PHY is not set
683# CONFIG_ICPLUS_PHY is not set
684# CONFIG_REALTEK_PHY is not set
685# CONFIG_FIXED_PHY is not set
686# CONFIG_MDIO_BITBANG is not set
643CONFIG_NET_ETHERNET=y 687CONFIG_NET_ETHERNET=y
644CONFIG_MII=y 688CONFIG_MII=y
645# CONFIG_AX88796 is not set 689# CONFIG_AX88796 is not set
@@ -650,12 +694,16 @@ CONFIG_MII=y
650# CONFIG_SMC91X is not set 694# CONFIG_SMC91X is not set
651# CONFIG_DM9000 is not set 695# CONFIG_DM9000 is not set
652# CONFIG_ENC28J60 is not set 696# CONFIG_ENC28J60 is not set
697# CONFIG_SMC911X is not set
653# CONFIG_NET_TULIP is not set 698# CONFIG_NET_TULIP is not set
654# CONFIG_HP100 is not set 699# CONFIG_HP100 is not set
655# CONFIG_IBM_NEW_EMAC_ZMII is not set 700# CONFIG_IBM_NEW_EMAC_ZMII is not set
656# CONFIG_IBM_NEW_EMAC_RGMII is not set 701# CONFIG_IBM_NEW_EMAC_RGMII is not set
657# CONFIG_IBM_NEW_EMAC_TAH is not set 702# CONFIG_IBM_NEW_EMAC_TAH is not set
658# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 703# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
704# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
705# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
706# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
659CONFIG_NET_PCI=y 707CONFIG_NET_PCI=y
660# CONFIG_PCNET32 is not set 708# CONFIG_PCNET32 is not set
661# CONFIG_AMD8111_ETH is not set 709# CONFIG_AMD8111_ETH is not set
@@ -676,14 +724,12 @@ CONFIG_NET_PCI=y
676# CONFIG_TLAN is not set 724# CONFIG_TLAN is not set
677# CONFIG_VIA_RHINE is not set 725# CONFIG_VIA_RHINE is not set
678# CONFIG_SC92031 is not set 726# CONFIG_SC92031 is not set
727# CONFIG_ATL2 is not set
679CONFIG_NETDEV_1000=y 728CONFIG_NETDEV_1000=y
680# CONFIG_ACENIC is not set 729# CONFIG_ACENIC is not set
681# CONFIG_DL2K is not set 730# CONFIG_DL2K is not set
682CONFIG_E1000=y 731# CONFIG_E1000 is not set
683CONFIG_E1000_NAPI=y
684# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
685# CONFIG_E1000E is not set 732# CONFIG_E1000E is not set
686# CONFIG_E1000E_ENABLED is not set
687# CONFIG_IP1000 is not set 733# CONFIG_IP1000 is not set
688# CONFIG_IGB is not set 734# CONFIG_IGB is not set
689# CONFIG_NS83820 is not set 735# CONFIG_NS83820 is not set
@@ -699,6 +745,8 @@ CONFIG_E1000_NAPI=y
699CONFIG_MV643XX_ETH=y 745CONFIG_MV643XX_ETH=y
700# CONFIG_QLA3XXX is not set 746# CONFIG_QLA3XXX is not set
701# CONFIG_ATL1 is not set 747# CONFIG_ATL1 is not set
748# CONFIG_ATL1E is not set
749# CONFIG_JME is not set
702# CONFIG_NETDEV_10000 is not set 750# CONFIG_NETDEV_10000 is not set
703# CONFIG_TR is not set 751# CONFIG_TR is not set
704 752
@@ -765,7 +813,11 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
765# 813#
766# Character devices 814# Character devices
767# 815#
768# CONFIG_VT is not set 816CONFIG_VT=y
817CONFIG_CONSOLE_TRANSLATIONS=y
818CONFIG_VT_CONSOLE=y
819CONFIG_HW_CONSOLE=y
820# CONFIG_VT_HW_CONSOLE_BINDING is not set
769# CONFIG_DEVKMEM is not set 821# CONFIG_DEVKMEM is not set
770# CONFIG_SERIAL_NONSTANDARD is not set 822# CONFIG_SERIAL_NONSTANDARD is not set
771# CONFIG_NOZOMI is not set 823# CONFIG_NOZOMI is not set
@@ -775,7 +827,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
775# 827#
776CONFIG_SERIAL_8250=y 828CONFIG_SERIAL_8250=y
777CONFIG_SERIAL_8250_CONSOLE=y 829CONFIG_SERIAL_8250_CONSOLE=y
778# CONFIG_SERIAL_8250_PCI is not set 830CONFIG_SERIAL_8250_PCI=y
779CONFIG_SERIAL_8250_NR_UARTS=4 831CONFIG_SERIAL_8250_NR_UARTS=4
780CONFIG_SERIAL_8250_RUNTIME_UARTS=2 832CONFIG_SERIAL_8250_RUNTIME_UARTS=2
781# CONFIG_SERIAL_8250_EXTENDED is not set 833# CONFIG_SERIAL_8250_EXTENDED is not set
@@ -800,44 +852,64 @@ CONFIG_DEVPORT=y
800CONFIG_I2C=y 852CONFIG_I2C=y
801CONFIG_I2C_BOARDINFO=y 853CONFIG_I2C_BOARDINFO=y
802CONFIG_I2C_CHARDEV=y 854CONFIG_I2C_CHARDEV=y
855CONFIG_I2C_HELPER_AUTO=y
803 856
804# 857#
805# I2C Hardware Bus support 858# I2C Hardware Bus support
806# 859#
860
861#
862# PC SMBus host controller drivers
863#
807# CONFIG_I2C_ALI1535 is not set 864# CONFIG_I2C_ALI1535 is not set
808# CONFIG_I2C_ALI1563 is not set 865# CONFIG_I2C_ALI1563 is not set
809# CONFIG_I2C_ALI15X3 is not set 866# CONFIG_I2C_ALI15X3 is not set
810# CONFIG_I2C_AMD756 is not set 867# CONFIG_I2C_AMD756 is not set
811# CONFIG_I2C_AMD8111 is not set 868# CONFIG_I2C_AMD8111 is not set
812# CONFIG_I2C_GPIO is not set
813# CONFIG_I2C_I801 is not set 869# CONFIG_I2C_I801 is not set
814# CONFIG_I2C_I810 is not set 870# CONFIG_I2C_ISCH is not set
815# CONFIG_I2C_PIIX4 is not set 871# CONFIG_I2C_PIIX4 is not set
816# CONFIG_I2C_NFORCE2 is not set 872# 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 873# CONFIG_I2C_SIS5595 is not set
823# CONFIG_I2C_SIS630 is not set 874# CONFIG_I2C_SIS630 is not set
824# CONFIG_I2C_SIS96X is not set 875# 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 876# CONFIG_I2C_VIA is not set
829# CONFIG_I2C_VIAPRO is not set 877# CONFIG_I2C_VIAPRO is not set
878
879#
880# I2C system bus drivers (mostly embedded / system-on-chip)
881#
882CONFIG_I2C_MV64XXX=y
883# CONFIG_I2C_OCORES is not set
884# CONFIG_I2C_SIMTEC is not set
885
886#
887# External I2C/SMBus adapter drivers
888#
889# CONFIG_I2C_PARPORT_LIGHT is not set
890# CONFIG_I2C_TAOS_EVM is not set
891# CONFIG_I2C_TINY_USB is not set
892
893#
894# Graphics adapter I2C/DDC channel drivers
895#
830# CONFIG_I2C_VOODOO3 is not set 896# CONFIG_I2C_VOODOO3 is not set
897
898#
899# Other I2C/SMBus bus drivers
900#
831# CONFIG_I2C_PCA_PLATFORM is not set 901# CONFIG_I2C_PCA_PLATFORM is not set
832CONFIG_I2C_MV64XXX=y 902# CONFIG_I2C_STUB is not set
833 903
834# 904#
835# Miscellaneous I2C Chip support 905# Miscellaneous I2C Chip support
836# 906#
837# CONFIG_DS1682 is not set 907# CONFIG_DS1682 is not set
908# CONFIG_AT24 is not set
838# CONFIG_SENSORS_EEPROM is not set 909# CONFIG_SENSORS_EEPROM is not set
839# CONFIG_SENSORS_PCF8574 is not set 910# CONFIG_SENSORS_PCF8574 is not set
840# CONFIG_PCF8575 is not set 911# CONFIG_PCF8575 is not set
912# CONFIG_SENSORS_PCA9539 is not set
841# CONFIG_SENSORS_PCF8591 is not set 913# CONFIG_SENSORS_PCF8591 is not set
842# CONFIG_SENSORS_MAX6875 is not set 914# CONFIG_SENSORS_MAX6875 is not set
843# CONFIG_SENSORS_TSL2550 is not set 915# CONFIG_SENSORS_TSL2550 is not set
@@ -864,20 +936,26 @@ CONFIG_SPI_ORION=y
864# CONFIG_W1 is not set 936# CONFIG_W1 is not set
865# CONFIG_POWER_SUPPLY is not set 937# CONFIG_POWER_SUPPLY is not set
866# CONFIG_HWMON is not set 938# CONFIG_HWMON is not set
939# CONFIG_THERMAL is not set
940# CONFIG_THERMAL_HWMON is not set
867# CONFIG_WATCHDOG is not set 941# CONFIG_WATCHDOG is not set
942CONFIG_SSB_POSSIBLE=y
868 943
869# 944#
870# Sonics Silicon Backplane 945# Sonics Silicon Backplane
871# 946#
872CONFIG_SSB_POSSIBLE=y
873# CONFIG_SSB is not set 947# CONFIG_SSB is not set
874 948
875# 949#
876# Multifunction device drivers 950# Multifunction device drivers
877# 951#
952# CONFIG_MFD_CORE is not set
878# CONFIG_MFD_SM501 is not set 953# CONFIG_MFD_SM501 is not set
879# CONFIG_MFD_ASIC3 is not set
880# CONFIG_HTC_PASIC3 is not set 954# CONFIG_HTC_PASIC3 is not set
955# CONFIG_MFD_TMIO is not set
956# CONFIG_PMIC_DA903X is not set
957# CONFIG_MFD_WM8400 is not set
958# CONFIG_MFD_WM8350_I2C is not set
881 959
882# 960#
883# Multimedia devices 961# Multimedia devices
@@ -910,8 +988,10 @@ CONFIG_SSB_POSSIBLE=y
910# CONFIG_DISPLAY_SUPPORT is not set 988# CONFIG_DISPLAY_SUPPORT is not set
911 989
912# 990#
913# Sound 991# Console display driver support
914# 992#
993# CONFIG_VGA_CONSOLE is not set
994CONFIG_DUMMY_CONSOLE=y
915# CONFIG_SOUND is not set 995# CONFIG_SOUND is not set
916CONFIG_HID_SUPPORT=y 996CONFIG_HID_SUPPORT=y
917CONFIG_HID=y 997CONFIG_HID=y
@@ -922,9 +1002,36 @@ CONFIG_HID=y
922# USB Input Devices 1002# USB Input Devices
923# 1003#
924CONFIG_USB_HID=y 1004CONFIG_USB_HID=y
925# CONFIG_USB_HIDINPUT_POWERBOOK is not set 1005# CONFIG_HID_PID is not set
926# CONFIG_HID_FF is not set
927# CONFIG_USB_HIDDEV is not set 1006# CONFIG_USB_HIDDEV is not set
1007
1008#
1009# Special HID drivers
1010#
1011CONFIG_HID_COMPAT=y
1012CONFIG_HID_A4TECH=y
1013CONFIG_HID_APPLE=y
1014CONFIG_HID_BELKIN=y
1015CONFIG_HID_BRIGHT=y
1016CONFIG_HID_CHERRY=y
1017CONFIG_HID_CHICONY=y
1018CONFIG_HID_CYPRESS=y
1019CONFIG_HID_DELL=y
1020CONFIG_HID_EZKEY=y
1021CONFIG_HID_GYRATION=y
1022CONFIG_HID_LOGITECH=y
1023# CONFIG_LOGITECH_FF is not set
1024# CONFIG_LOGIRUMBLEPAD2_FF is not set
1025CONFIG_HID_MICROSOFT=y
1026CONFIG_HID_MONTEREY=y
1027CONFIG_HID_PANTHERLORD=y
1028# CONFIG_PANTHERLORD_FF is not set
1029CONFIG_HID_PETALYNX=y
1030CONFIG_HID_SAMSUNG=y
1031CONFIG_HID_SONY=y
1032CONFIG_HID_SUNPLUS=y
1033# CONFIG_THRUSTMASTER_FF is not set
1034# CONFIG_ZEROPLUS_FF is not set
928CONFIG_USB_SUPPORT=y 1035CONFIG_USB_SUPPORT=y
929CONFIG_USB_ARCH_HAS_HCD=y 1036CONFIG_USB_ARCH_HAS_HCD=y
930CONFIG_USB_ARCH_HAS_OHCI=y 1037CONFIG_USB_ARCH_HAS_OHCI=y
@@ -940,8 +1047,9 @@ CONFIG_USB_DEVICEFS=y
940CONFIG_USB_DEVICE_CLASS=y 1047CONFIG_USB_DEVICE_CLASS=y
941# CONFIG_USB_DYNAMIC_MINORS is not set 1048# CONFIG_USB_DYNAMIC_MINORS is not set
942# CONFIG_USB_OTG is not set 1049# CONFIG_USB_OTG is not set
943# CONFIG_USB_OTG_WHITELIST is not set 1050# CONFIG_USB_MON is not set
944# CONFIG_USB_OTG_BLACKLIST_HUB is not set 1051# CONFIG_USB_WUSB is not set
1052# CONFIG_USB_WUSB_CBAF is not set
945 1053
946# 1054#
947# USB Host Controller Drivers 1055# USB Host Controller Drivers
@@ -956,20 +1064,23 @@ CONFIG_USB_EHCI_TT_NEWSCHED=y
956# CONFIG_USB_UHCI_HCD is not set 1064# CONFIG_USB_UHCI_HCD is not set
957# CONFIG_USB_SL811_HCD is not set 1065# CONFIG_USB_SL811_HCD is not set
958# CONFIG_USB_R8A66597_HCD is not set 1066# CONFIG_USB_R8A66597_HCD is not set
1067# CONFIG_USB_WHCI_HCD is not set
1068# CONFIG_USB_HWA_HCD is not set
959 1069
960# 1070#
961# USB Device Class drivers 1071# USB Device Class drivers
962# 1072#
963# CONFIG_USB_ACM is not set 1073# CONFIG_USB_ACM is not set
964CONFIG_USB_PRINTER=y 1074CONFIG_USB_PRINTER=m
965# CONFIG_USB_WDM is not set 1075# CONFIG_USB_WDM is not set
1076# CONFIG_USB_TMC is not set
966 1077
967# 1078#
968# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1079# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
969# 1080#
970 1081
971# 1082#
972# may also be needed; see USB_STORAGE Help for more information 1083# see USB_STORAGE Help for more information
973# 1084#
974CONFIG_USB_STORAGE=y 1085CONFIG_USB_STORAGE=y
975# CONFIG_USB_STORAGE_DEBUG is not set 1086# CONFIG_USB_STORAGE_DEBUG is not set
@@ -992,7 +1103,6 @@ CONFIG_USB_STORAGE_JUMPSHOT=y
992# 1103#
993# CONFIG_USB_MDC800 is not set 1104# CONFIG_USB_MDC800 is not set
994# CONFIG_USB_MICROTEK is not set 1105# CONFIG_USB_MICROTEK is not set
995# CONFIG_USB_MON is not set
996 1106
997# 1107#
998# USB port drivers 1108# USB port drivers
@@ -1005,7 +1115,7 @@ CONFIG_USB_STORAGE_JUMPSHOT=y
1005# CONFIG_USB_EMI62 is not set 1115# CONFIG_USB_EMI62 is not set
1006# CONFIG_USB_EMI26 is not set 1116# CONFIG_USB_EMI26 is not set
1007# CONFIG_USB_ADUTUX is not set 1117# CONFIG_USB_ADUTUX is not set
1008# CONFIG_USB_AUERSWALD is not set 1118# CONFIG_USB_SEVSEG is not set
1009# CONFIG_USB_RIO500 is not set 1119# CONFIG_USB_RIO500 is not set
1010# CONFIG_USB_LEGOTOWER is not set 1120# CONFIG_USB_LEGOTOWER is not set
1011# CONFIG_USB_LCD is not set 1121# CONFIG_USB_LCD is not set
@@ -1023,8 +1133,12 @@ CONFIG_USB_STORAGE_JUMPSHOT=y
1023# CONFIG_USB_IOWARRIOR is not set 1133# CONFIG_USB_IOWARRIOR is not set
1024# CONFIG_USB_TEST is not set 1134# CONFIG_USB_TEST is not set
1025# CONFIG_USB_ISIGHTFW is not set 1135# CONFIG_USB_ISIGHTFW is not set
1136# CONFIG_USB_VST is not set
1026# CONFIG_USB_GADGET is not set 1137# CONFIG_USB_GADGET is not set
1138# CONFIG_UWB is not set
1027# CONFIG_MMC is not set 1139# CONFIG_MMC is not set
1140# CONFIG_MEMSTICK is not set
1141# CONFIG_ACCESSIBILITY is not set
1028CONFIG_NEW_LEDS=y 1142CONFIG_NEW_LEDS=y
1029# CONFIG_LEDS_CLASS is not set 1143# CONFIG_LEDS_CLASS is not set
1030 1144
@@ -1038,6 +1152,8 @@ CONFIG_NEW_LEDS=y
1038# CONFIG_LEDS_TRIGGERS is not set 1152# CONFIG_LEDS_TRIGGERS is not set
1039CONFIG_RTC_LIB=y 1153CONFIG_RTC_LIB=y
1040CONFIG_RTC_CLASS=y 1154CONFIG_RTC_CLASS=y
1155CONFIG_RTC_HCTOSYS=y
1156CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
1041# CONFIG_RTC_DEBUG is not set 1157# CONFIG_RTC_DEBUG is not set
1042 1158
1043# 1159#
@@ -1056,7 +1172,6 @@ CONFIG_RTC_INTF_DEV=y
1056# CONFIG_RTC_DRV_DS1374 is not set 1172# CONFIG_RTC_DRV_DS1374 is not set
1057# CONFIG_RTC_DRV_DS1672 is not set 1173# CONFIG_RTC_DRV_DS1672 is not set
1058# CONFIG_RTC_DRV_MAX6900 is not set 1174# CONFIG_RTC_DRV_MAX6900 is not set
1059CONFIG_RTC_DRV_MV=y
1060# CONFIG_RTC_DRV_RS5C372 is not set 1175# CONFIG_RTC_DRV_RS5C372 is not set
1061# CONFIG_RTC_DRV_ISL1208 is not set 1176# CONFIG_RTC_DRV_ISL1208 is not set
1062# CONFIG_RTC_DRV_X1205 is not set 1177# CONFIG_RTC_DRV_X1205 is not set
@@ -1064,29 +1179,39 @@ CONFIG_RTC_DRV_MV=y
1064# CONFIG_RTC_DRV_PCF8583 is not set 1179# CONFIG_RTC_DRV_PCF8583 is not set
1065# CONFIG_RTC_DRV_M41T80 is not set 1180# CONFIG_RTC_DRV_M41T80 is not set
1066# CONFIG_RTC_DRV_S35390A is not set 1181# CONFIG_RTC_DRV_S35390A is not set
1182# CONFIG_RTC_DRV_FM3130 is not set
1183# CONFIG_RTC_DRV_RX8581 is not set
1067 1184
1068# 1185#
1069# SPI RTC drivers 1186# SPI RTC drivers
1070# 1187#
1188# CONFIG_RTC_DRV_M41T94 is not set
1189# CONFIG_RTC_DRV_DS1305 is not set
1190# CONFIG_RTC_DRV_DS1390 is not set
1071# CONFIG_RTC_DRV_MAX6902 is not set 1191# CONFIG_RTC_DRV_MAX6902 is not set
1072# CONFIG_RTC_DRV_R9701 is not set 1192# CONFIG_RTC_DRV_R9701 is not set
1073# CONFIG_RTC_DRV_RS5C348 is not set 1193# CONFIG_RTC_DRV_RS5C348 is not set
1194# CONFIG_RTC_DRV_DS3234 is not set
1074 1195
1075# 1196#
1076# Platform RTC drivers 1197# Platform RTC drivers
1077# 1198#
1078# CONFIG_RTC_DRV_CMOS is not set 1199# CONFIG_RTC_DRV_CMOS is not set
1200# CONFIG_RTC_DRV_DS1286 is not set
1079# CONFIG_RTC_DRV_DS1511 is not set 1201# CONFIG_RTC_DRV_DS1511 is not set
1080# CONFIG_RTC_DRV_DS1553 is not set 1202# CONFIG_RTC_DRV_DS1553 is not set
1081# CONFIG_RTC_DRV_DS1742 is not set 1203# CONFIG_RTC_DRV_DS1742 is not set
1082# CONFIG_RTC_DRV_STK17TA8 is not set 1204# CONFIG_RTC_DRV_STK17TA8 is not set
1083# CONFIG_RTC_DRV_M48T86 is not set 1205# CONFIG_RTC_DRV_M48T86 is not set
1206# CONFIG_RTC_DRV_M48T35 is not set
1084# CONFIG_RTC_DRV_M48T59 is not set 1207# CONFIG_RTC_DRV_M48T59 is not set
1208# CONFIG_RTC_DRV_BQ4802 is not set
1085# CONFIG_RTC_DRV_V3020 is not set 1209# CONFIG_RTC_DRV_V3020 is not set
1086 1210
1087# 1211#
1088# on-CPU RTC drivers 1212# on-CPU RTC drivers
1089# 1213#
1214CONFIG_RTC_DRV_MV=y
1090CONFIG_DMADEVICES=y 1215CONFIG_DMADEVICES=y
1091 1216
1092# 1217#
@@ -1099,6 +1224,8 @@ CONFIG_DMA_ENGINE=y
1099# DMA Clients 1224# DMA Clients
1100# 1225#
1101# CONFIG_NET_DMA is not set 1226# CONFIG_NET_DMA is not set
1227# CONFIG_DMATEST is not set
1228# CONFIG_REGULATOR is not set
1102# CONFIG_UIO is not set 1229# CONFIG_UIO is not set
1103 1230
1104# 1231#
@@ -1109,11 +1236,12 @@ CONFIG_EXT2_FS=y
1109# CONFIG_EXT2_FS_XIP is not set 1236# CONFIG_EXT2_FS_XIP is not set
1110CONFIG_EXT3_FS=y 1237CONFIG_EXT3_FS=y
1111# CONFIG_EXT3_FS_XATTR is not set 1238# CONFIG_EXT3_FS_XATTR is not set
1112# CONFIG_EXT4DEV_FS is not set 1239# CONFIG_EXT4_FS is not set
1113CONFIG_JBD=y 1240CONFIG_JBD=y
1114# CONFIG_REISERFS_FS is not set 1241# CONFIG_REISERFS_FS is not set
1115# CONFIG_JFS_FS is not set 1242# CONFIG_JFS_FS is not set
1116# CONFIG_FS_POSIX_ACL is not set 1243# CONFIG_FS_POSIX_ACL is not set
1244CONFIG_FILE_LOCKING=y
1117CONFIG_XFS_FS=y 1245CONFIG_XFS_FS=y
1118# CONFIG_XFS_QUOTA is not set 1246# CONFIG_XFS_QUOTA is not set
1119# CONFIG_XFS_POSIX_ACL is not set 1247# CONFIG_XFS_POSIX_ACL is not set
@@ -1131,7 +1259,7 @@ CONFIG_INOTIFY_USER=y
1131# 1259#
1132# CD-ROM/DVD Filesystems 1260# CD-ROM/DVD Filesystems
1133# 1261#
1134CONFIG_ISO9660_FS=y 1262CONFIG_ISO9660_FS=m
1135CONFIG_JOLIET=y 1263CONFIG_JOLIET=y
1136# CONFIG_ZISOFS is not set 1264# CONFIG_ZISOFS is not set
1137CONFIG_UDF_FS=m 1265CONFIG_UDF_FS=m
@@ -1140,9 +1268,9 @@ CONFIG_UDF_NLS=y
1140# 1268#
1141# DOS/FAT/NT Filesystems 1269# DOS/FAT/NT Filesystems
1142# 1270#
1143CONFIG_FAT_FS=y 1271CONFIG_FAT_FS=m
1144CONFIG_MSDOS_FS=y 1272CONFIG_MSDOS_FS=m
1145CONFIG_VFAT_FS=y 1273CONFIG_VFAT_FS=m
1146CONFIG_FAT_DEFAULT_CODEPAGE=437 1274CONFIG_FAT_DEFAULT_CODEPAGE=437
1147CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" 1275CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1148# CONFIG_NTFS_FS is not set 1276# CONFIG_NTFS_FS is not set
@@ -1152,6 +1280,7 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1152# 1280#
1153CONFIG_PROC_FS=y 1281CONFIG_PROC_FS=y
1154CONFIG_PROC_SYSCTL=y 1282CONFIG_PROC_SYSCTL=y
1283CONFIG_PROC_PAGE_MONITOR=y
1155CONFIG_SYSFS=y 1284CONFIG_SYSFS=y
1156CONFIG_TMPFS=y 1285CONFIG_TMPFS=y
1157# CONFIG_TMPFS_POSIX_ACL is not set 1286# CONFIG_TMPFS_POSIX_ACL is not set
@@ -1182,6 +1311,7 @@ CONFIG_JFFS2_RTIME=y
1182CONFIG_CRAMFS=y 1311CONFIG_CRAMFS=y
1183# CONFIG_VXFS_FS is not set 1312# CONFIG_VXFS_FS is not set
1184# CONFIG_MINIX_FS is not set 1313# CONFIG_MINIX_FS is not set
1314# CONFIG_OMFS_FS is not set
1185# CONFIG_HPFS_FS is not set 1315# CONFIG_HPFS_FS is not set
1186# CONFIG_QNX4FS_FS is not set 1316# CONFIG_QNX4FS_FS is not set
1187# CONFIG_ROMFS_FS is not set 1317# CONFIG_ROMFS_FS is not set
@@ -1192,13 +1322,13 @@ CONFIG_NFS_FS=y
1192CONFIG_NFS_V3=y 1322CONFIG_NFS_V3=y
1193# CONFIG_NFS_V3_ACL is not set 1323# CONFIG_NFS_V3_ACL is not set
1194# CONFIG_NFS_V4 is not set 1324# CONFIG_NFS_V4 is not set
1195# CONFIG_NFSD is not set
1196CONFIG_ROOT_NFS=y 1325CONFIG_ROOT_NFS=y
1326# CONFIG_NFSD is not set
1197CONFIG_LOCKD=y 1327CONFIG_LOCKD=y
1198CONFIG_LOCKD_V4=y 1328CONFIG_LOCKD_V4=y
1199CONFIG_NFS_COMMON=y 1329CONFIG_NFS_COMMON=y
1200CONFIG_SUNRPC=y 1330CONFIG_SUNRPC=y
1201# CONFIG_SUNRPC_BIND34 is not set 1331# CONFIG_SUNRPC_REGISTER_V4 is not set
1202# CONFIG_RPCSEC_GSS_KRB5 is not set 1332# CONFIG_RPCSEC_GSS_KRB5 is not set
1203# CONFIG_RPCSEC_GSS_SPKM3 is not set 1333# CONFIG_RPCSEC_GSS_SPKM3 is not set
1204# CONFIG_SMB_FS is not set 1334# CONFIG_SMB_FS is not set
@@ -1210,24 +1340,8 @@ CONFIG_SUNRPC=y
1210# 1340#
1211# Partition Types 1341# Partition Types
1212# 1342#
1213CONFIG_PARTITION_ADVANCED=y 1343# CONFIG_PARTITION_ADVANCED is not set
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 1344CONFIG_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 1345CONFIG_NLS=y
1232CONFIG_NLS_DEFAULT="iso8859-1" 1346CONFIG_NLS_DEFAULT="iso8859-1"
1233CONFIG_NLS_CODEPAGE_437=y 1347CONFIG_NLS_CODEPAGE_437=y
@@ -1284,11 +1398,14 @@ CONFIG_MAGIC_SYSRQ=y
1284CONFIG_DEBUG_KERNEL=y 1398CONFIG_DEBUG_KERNEL=y
1285# CONFIG_DEBUG_SHIRQ is not set 1399# CONFIG_DEBUG_SHIRQ is not set
1286CONFIG_DETECT_SOFTLOCKUP=y 1400CONFIG_DETECT_SOFTLOCKUP=y
1401# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1402CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1287# CONFIG_SCHED_DEBUG is not set 1403# CONFIG_SCHED_DEBUG is not set
1288# CONFIG_SCHEDSTATS is not set 1404# CONFIG_SCHEDSTATS is not set
1289# CONFIG_TIMER_STATS is not set 1405# CONFIG_TIMER_STATS is not set
1290# CONFIG_DEBUG_OBJECTS is not set 1406# CONFIG_DEBUG_OBJECTS is not set
1291# CONFIG_DEBUG_SLAB is not set 1407# CONFIG_SLUB_DEBUG_ON is not set
1408# CONFIG_SLUB_STATS is not set
1292# CONFIG_DEBUG_PREEMPT is not set 1409# CONFIG_DEBUG_PREEMPT is not set
1293# CONFIG_DEBUG_RT_MUTEXES is not set 1410# CONFIG_DEBUG_RT_MUTEXES is not set
1294# CONFIG_RT_MUTEX_TESTER is not set 1411# CONFIG_RT_MUTEX_TESTER is not set
@@ -1300,21 +1417,40 @@ CONFIG_DETECT_SOFTLOCKUP=y
1300# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1417# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1301# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1418# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1302# CONFIG_DEBUG_KOBJECT is not set 1419# CONFIG_DEBUG_KOBJECT is not set
1303# CONFIG_DEBUG_BUGVERBOSE is not set 1420CONFIG_DEBUG_BUGVERBOSE=y
1304CONFIG_DEBUG_INFO=y 1421CONFIG_DEBUG_INFO=y
1305# CONFIG_DEBUG_VM is not set 1422# CONFIG_DEBUG_VM is not set
1306# CONFIG_DEBUG_WRITECOUNT is not set 1423# CONFIG_DEBUG_WRITECOUNT is not set
1424CONFIG_DEBUG_MEMORY_INIT=y
1307# CONFIG_DEBUG_LIST is not set 1425# CONFIG_DEBUG_LIST is not set
1308# CONFIG_DEBUG_SG is not set 1426# CONFIG_DEBUG_SG is not set
1309CONFIG_FRAME_POINTER=y 1427CONFIG_FRAME_POINTER=y
1310# CONFIG_BOOT_PRINTK_DELAY is not set 1428# CONFIG_BOOT_PRINTK_DELAY is not set
1311# CONFIG_RCU_TORTURE_TEST is not set 1429# CONFIG_RCU_TORTURE_TEST is not set
1430# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1312# CONFIG_KPROBES_SANITY_TEST is not set 1431# CONFIG_KPROBES_SANITY_TEST is not set
1313# CONFIG_BACKTRACE_SELF_TEST is not set 1432# CONFIG_BACKTRACE_SELF_TEST is not set
1433# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1314# CONFIG_LKDTM is not set 1434# CONFIG_LKDTM is not set
1315# CONFIG_FAULT_INJECTION is not set 1435# CONFIG_FAULT_INJECTION is not set
1316# CONFIG_LATENCYTOP is not set 1436# CONFIG_LATENCYTOP is not set
1437CONFIG_SYSCTL_SYSCALL_CHECK=y
1438CONFIG_HAVE_FUNCTION_TRACER=y
1439
1440#
1441# Tracers
1442#
1443# CONFIG_FUNCTION_TRACER is not set
1444# CONFIG_IRQSOFF_TRACER is not set
1445# CONFIG_PREEMPT_TRACER is not set
1446# CONFIG_SCHED_TRACER is not set
1447# CONFIG_CONTEXT_SWITCH_TRACER is not set
1448# CONFIG_BOOT_TRACER is not set
1449# CONFIG_STACK_TRACER is not set
1450# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1317# CONFIG_SAMPLES is not set 1451# CONFIG_SAMPLES is not set
1452CONFIG_HAVE_ARCH_KGDB=y
1453# CONFIG_KGDB is not set
1318CONFIG_DEBUG_USER=y 1454CONFIG_DEBUG_USER=y
1319CONFIG_DEBUG_ERRORS=y 1455CONFIG_DEBUG_ERRORS=y
1320# CONFIG_DEBUG_STACK_USAGE is not set 1456# CONFIG_DEBUG_STACK_USAGE is not set
@@ -1326,6 +1462,7 @@ CONFIG_DEBUG_LL=y
1326# 1462#
1327# CONFIG_KEYS is not set 1463# CONFIG_KEYS is not set
1328# CONFIG_SECURITY is not set 1464# CONFIG_SECURITY is not set
1465# CONFIG_SECURITYFS is not set
1329# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1466# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1330CONFIG_ASYNC_CORE=y 1467CONFIG_ASYNC_CORE=y
1331CONFIG_CRYPTO=y 1468CONFIG_CRYPTO=y
@@ -1333,8 +1470,12 @@ CONFIG_CRYPTO=y
1333# 1470#
1334# Crypto core or helper 1471# Crypto core or helper
1335# 1472#
1473# CONFIG_CRYPTO_FIPS is not set
1336CONFIG_CRYPTO_ALGAPI=m 1474CONFIG_CRYPTO_ALGAPI=m
1475CONFIG_CRYPTO_AEAD=m
1337CONFIG_CRYPTO_BLKCIPHER=m 1476CONFIG_CRYPTO_BLKCIPHER=m
1477CONFIG_CRYPTO_HASH=m
1478CONFIG_CRYPTO_RNG=m
1338CONFIG_CRYPTO_MANAGER=m 1479CONFIG_CRYPTO_MANAGER=m
1339# CONFIG_CRYPTO_GF128MUL is not set 1480# CONFIG_CRYPTO_GF128MUL is not set
1340# CONFIG_CRYPTO_NULL is not set 1481# CONFIG_CRYPTO_NULL is not set
@@ -1373,6 +1514,10 @@ CONFIG_CRYPTO_PCBC=m
1373# CONFIG_CRYPTO_MD4 is not set 1514# CONFIG_CRYPTO_MD4 is not set
1374# CONFIG_CRYPTO_MD5 is not set 1515# CONFIG_CRYPTO_MD5 is not set
1375# CONFIG_CRYPTO_MICHAEL_MIC is not set 1516# CONFIG_CRYPTO_MICHAEL_MIC is not set
1517# CONFIG_CRYPTO_RMD128 is not set
1518# CONFIG_CRYPTO_RMD160 is not set
1519# CONFIG_CRYPTO_RMD256 is not set
1520# CONFIG_CRYPTO_RMD320 is not set
1376# CONFIG_CRYPTO_SHA1 is not set 1521# CONFIG_CRYPTO_SHA1 is not set
1377# CONFIG_CRYPTO_SHA256 is not set 1522# CONFIG_CRYPTO_SHA256 is not set
1378# CONFIG_CRYPTO_SHA512 is not set 1523# CONFIG_CRYPTO_SHA512 is not set
@@ -1403,6 +1548,11 @@ CONFIG_CRYPTO_PCBC=m
1403# 1548#
1404# CONFIG_CRYPTO_DEFLATE is not set 1549# CONFIG_CRYPTO_DEFLATE is not set
1405# CONFIG_CRYPTO_LZO is not set 1550# CONFIG_CRYPTO_LZO is not set
1551
1552#
1553# Random Number Generation
1554#
1555# CONFIG_CRYPTO_ANSI_CPRNG is not set
1406CONFIG_CRYPTO_HW=y 1556CONFIG_CRYPTO_HW=y
1407# CONFIG_CRYPTO_DEV_HIFN_795X is not set 1557# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1408 1558
@@ -1410,10 +1560,9 @@ CONFIG_CRYPTO_HW=y
1410# Library routines 1560# Library routines
1411# 1561#
1412CONFIG_BITREVERSE=y 1562CONFIG_BITREVERSE=y
1413# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1414# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1415CONFIG_CRC_CCITT=y 1563CONFIG_CRC_CCITT=y
1416CONFIG_CRC16=y 1564CONFIG_CRC16=y
1565# CONFIG_CRC_T10DIF is not set
1417CONFIG_CRC_ITU_T=m 1566CONFIG_CRC_ITU_T=m
1418CONFIG_CRC32=y 1567CONFIG_CRC32=y
1419# CONFIG_CRC7 is not set 1568# CONFIG_CRC7 is not set
diff --git a/arch/arm/configs/ks8695_defconfig b/arch/arm/configs/ks8695_defconfig
index 6077f2cb88e4..d25c41bab06c 100644
--- a/arch/arm/configs/ks8695_defconfig
+++ b/arch/arm/configs/ks8695_defconfig
@@ -1,39 +1,67 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.17-rc4 3# Linux kernel version: 2.6.27-simtec-micrel1
4# Thu May 25 15:42:51 2006 4# Fri Dec 5 10:30:27 2008
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9# CONFIG_GENERIC_TIME is not set
10# CONFIG_GENERIC_CLOCKEVENTS is not set
7CONFIG_MMU=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
8CONFIG_RWSEM_GENERIC_SPINLOCK=y 20CONFIG_RWSEM_GENERIC_SPINLOCK=y
21# CONFIG_ARCH_HAS_ILOG2_U32 is not set
22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
9CONFIG_GENERIC_HWEIGHT=y 23CONFIG_GENERIC_HWEIGHT=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y 24CONFIG_GENERIC_CALIBRATE_DELAY=y
25CONFIG_ARCH_SUPPORTS_AOUT=y
26CONFIG_ZONE_DMA=y
27CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
11CONFIG_VECTORS_BASE=0xffff0000 28CONFIG_VECTORS_BASE=0xffff0000
29CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
12 30
13# 31#
14# Code maturity level options 32# General setup
15# 33#
16CONFIG_EXPERIMENTAL=y 34CONFIG_EXPERIMENTAL=y
17CONFIG_BROKEN_ON_SMP=y 35CONFIG_BROKEN_ON_SMP=y
18CONFIG_INIT_ENV_ARG_LIMIT=32 36CONFIG_INIT_ENV_ARG_LIMIT=32
19
20#
21# General setup
22#
23CONFIG_LOCALVERSION="" 37CONFIG_LOCALVERSION=""
24CONFIG_LOCALVERSION_AUTO=y 38CONFIG_LOCALVERSION_AUTO=y
25# CONFIG_SWAP is not set 39# CONFIG_SWAP is not set
26CONFIG_SYSVIPC=y 40CONFIG_SYSVIPC=y
41CONFIG_SYSVIPC_SYSCTL=y
27# CONFIG_POSIX_MQUEUE is not set 42# CONFIG_POSIX_MQUEUE is not set
28# CONFIG_BSD_PROCESS_ACCT is not set 43# CONFIG_BSD_PROCESS_ACCT is not set
29CONFIG_SYSCTL=y 44# CONFIG_TASKSTATS is not set
30# CONFIG_AUDIT is not set 45# CONFIG_AUDIT is not set
31# CONFIG_IKCONFIG 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
32# CONFIG_RELAY is not set 52# CONFIG_RELAY is not set
53CONFIG_NAMESPACES=y
54# CONFIG_UTS_NS is not set
55# CONFIG_IPC_NS is not set
56# CONFIG_USER_NS is not set
57# CONFIG_PID_NS is not set
58CONFIG_BLK_DEV_INITRD=y
33CONFIG_INITRAMFS_SOURCE="" 59CONFIG_INITRAMFS_SOURCE=""
34CONFIG_UID16=y
35CONFIG_CC_OPTIMIZE_FOR_SIZE=y 60CONFIG_CC_OPTIMIZE_FOR_SIZE=y
61CONFIG_SYSCTL=y
36# CONFIG_EMBEDDED is not set 62# CONFIG_EMBEDDED is not set
63CONFIG_UID16=y
64CONFIG_SYSCTL_SYSCALL=y
37CONFIG_KALLSYMS=y 65CONFIG_KALLSYMS=y
38# CONFIG_KALLSYMS_ALL is not set 66# CONFIG_KALLSYMS_ALL is not set
39# CONFIG_KALLSYMS_EXTRA_PASS is not set 67# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -41,30 +69,50 @@ CONFIG_HOTPLUG=y
41CONFIG_PRINTK=y 69CONFIG_PRINTK=y
42CONFIG_BUG=y 70CONFIG_BUG=y
43CONFIG_ELF_CORE=y 71CONFIG_ELF_CORE=y
72CONFIG_COMPAT_BRK=y
44CONFIG_BASE_FULL=y 73CONFIG_BASE_FULL=y
45CONFIG_FUTEX=y 74CONFIG_FUTEX=y
75CONFIG_ANON_INODES=y
46CONFIG_EPOLL=y 76CONFIG_EPOLL=y
77CONFIG_SIGNALFD=y
78CONFIG_TIMERFD=y
79CONFIG_EVENTFD=y
47CONFIG_SHMEM=y 80CONFIG_SHMEM=y
81CONFIG_VM_EVENT_COUNTERS=y
48CONFIG_SLAB=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
89# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
90# CONFIG_HAVE_IOREMAP_PROT is not set
91CONFIG_HAVE_KPROBES=y
92CONFIG_HAVE_KRETPROBES=y
93# CONFIG_HAVE_ARCH_TRACEHOOK is not set
94# CONFIG_HAVE_DMA_ATTRS is not set
95# CONFIG_USE_GENERIC_SMP_HELPERS is not set
96# CONFIG_HAVE_CLK is not set
97CONFIG_PROC_PAGE_MONITOR=y
98CONFIG_HAVE_GENERIC_DMA_COHERENT=y
99CONFIG_SLABINFO=y
100CONFIG_RT_MUTEXES=y
49# CONFIG_TINY_SHMEM is not set 101# CONFIG_TINY_SHMEM is not set
50CONFIG_BASE_SMALL=0 102CONFIG_BASE_SMALL=0
51# CONFIG_SLOB is not set
52CONFIG_OBSOLETE_INTERMODULE=y
53
54#
55# Loadable module support
56#
57CONFIG_MODULES=y 103CONFIG_MODULES=y
104# CONFIG_MODULE_FORCE_LOAD is not set
58CONFIG_MODULE_UNLOAD=y 105CONFIG_MODULE_UNLOAD=y
59# CONFIG_MODULE_FORCE_UNLOAD is not set 106# CONFIG_MODULE_FORCE_UNLOAD is not set
60# CONFIG_MODVERSIONS is not set 107# CONFIG_MODVERSIONS is not set
61# CONFIG_MODULE_SRCVERSION_ALL is not set 108# CONFIG_MODULE_SRCVERSION_ALL is not set
62CONFIG_KMOD=y 109CONFIG_KMOD=y
63 110CONFIG_BLOCK=y
64# 111# CONFIG_LBD is not set
65# Block layer
66#
67# CONFIG_BLK_DEV_IO_TRACE is not set 112# CONFIG_BLK_DEV_IO_TRACE is not set
113# CONFIG_LSF is not set
114# CONFIG_BLK_DEV_BSG is not set
115# CONFIG_BLK_DEV_INTEGRITY is not set
68 116
69# 117#
70# IO Schedulers 118# IO Schedulers
@@ -78,60 +126,77 @@ CONFIG_DEFAULT_AS=y
78# CONFIG_DEFAULT_CFQ is not set 126# CONFIG_DEFAULT_CFQ is not set
79# CONFIG_DEFAULT_NOOP is not set 127# CONFIG_DEFAULT_NOOP is not set
80CONFIG_DEFAULT_IOSCHED="anticipatory" 128CONFIG_DEFAULT_IOSCHED="anticipatory"
129CONFIG_CLASSIC_RCU=y
81 130
82# 131#
83# System Type 132# System Type
84# 133#
134# CONFIG_ARCH_AAEC2000 is not set
135# CONFIG_ARCH_INTEGRATOR is not set
136# CONFIG_ARCH_REALVIEW is not set
137# CONFIG_ARCH_VERSATILE is not set
138# CONFIG_ARCH_AT91 is not set
85# CONFIG_ARCH_CLPS7500 is not set 139# CONFIG_ARCH_CLPS7500 is not set
86# CONFIG_ARCH_CLPS711X is not set 140# CONFIG_ARCH_CLPS711X is not set
87# CONFIG_ARCH_CO285 is not set
88# CONFIG_ARCH_EBSA110 is not set 141# CONFIG_ARCH_EBSA110 is not set
89# CONFIG_ARCH_EP93XX is not set 142# CONFIG_ARCH_EP93XX is not set
90# CONFIG_ARCH_FOOTBRIDGE is not set 143# CONFIG_ARCH_FOOTBRIDGE is not set
91# CONFIG_ARCH_INTEGRATOR is not set 144# CONFIG_ARCH_NETX is not set
92# CONFIG_ARCH_IOP3XX is not set 145# CONFIG_ARCH_H720X is not set
93# CONFIG_ARCH_IXP4XX is not set 146# CONFIG_ARCH_IMX is not set
94# CONFIG_ARCH_IXP2000 is not set 147# CONFIG_ARCH_IOP13XX is not set
148# CONFIG_ARCH_IOP32X is not set
149# CONFIG_ARCH_IOP33X is not set
95# CONFIG_ARCH_IXP23XX is not set 150# CONFIG_ARCH_IXP23XX is not set
151# CONFIG_ARCH_IXP2000 is not set
152# CONFIG_ARCH_IXP4XX is not set
96# CONFIG_ARCH_L7200 is not set 153# CONFIG_ARCH_L7200 is not set
154# CONFIG_ARCH_KIRKWOOD is not set
155CONFIG_ARCH_KS8695=y
156# CONFIG_ARCH_NS9XXX is not set
157# CONFIG_ARCH_LOKI is not set
158# CONFIG_ARCH_MV78XX0 is not set
159# CONFIG_ARCH_MXC is not set
160# CONFIG_ARCH_ORION5X is not set
161# CONFIG_ARCH_PNX4008 is not set
97# CONFIG_ARCH_PXA is not set 162# CONFIG_ARCH_PXA is not set
98# CONFIG_ARCH_RPC is not set 163# CONFIG_ARCH_RPC is not set
99# CONFIG_ARCH_SA1100 is not set 164# CONFIG_ARCH_SA1100 is not set
100# CONFIG_ARCH_S3C2410 is not set 165# CONFIG_ARCH_S3C2410 is not set
101# CONFIG_ARCH_SHARK is not set 166# CONFIG_ARCH_SHARK is not set
102# CONFIG_ARCH_LH7A40X is not set 167# CONFIG_ARCH_LH7A40X is not set
168# CONFIG_ARCH_DAVINCI is not set
103# CONFIG_ARCH_OMAP is not set 169# CONFIG_ARCH_OMAP is not set
104# CONFIG_ARCH_VERSATILE is not set 170# CONFIG_ARCH_MSM7X00A is not set
105# CONFIG_ARCH_REALVIEW is not set 171
106# CONFIG_ARCH_IMX is not set 172#
107# CONFIG_ARCH_H720X is not set 173# Boot options
108# CONFIG_ARCH_AAEC2000 is not set 174#
109# CONFIG_ARCH_AT91 is not set 175
110CONFIG_ARCH_KS8695=y 176#
177# Power management
178#
111 179
112# 180#
113# Kendin/Micrel KS8695 Implementations 181# Kendin/Micrel KS8695 Implementations
114# 182#
115CONFIG_MACH_KS8695=y 183CONFIG_MACH_KS8695=y
116# CONFIG_MACH_DSM320 is not set 184CONFIG_MACH_DSM320=y
117# CONFIG_MACH_CM4002 is not set
118# CONFIG_MACH_CM4008 is not set
119# CONFIG_MACH_CM40xx is not set
120# CONFIG_MACH_LITE300 is not set
121# CONFIG_MACH_SE4200 is not set
122# CONFIG_MACH_MANGA_KS8695 is not set
123 185
124# 186#
125# Processor Type 187# Processor Type
126# 188#
127CONFIG_CPU_32=y 189CONFIG_CPU_32=y
128CONFIG_CPU_ARM922T=y 190CONFIG_CPU_ARM922T=y
129CONFIG_CPU_32v4=y 191CONFIG_CPU_32v4T=y
130CONFIG_CPU_ABRT_EV4T=y 192CONFIG_CPU_ABRT_EV4T=y
193CONFIG_CPU_PABRT_NOIFAR=y
131CONFIG_CPU_CACHE_V4WT=y 194CONFIG_CPU_CACHE_V4WT=y
132CONFIG_CPU_CACHE_VIVT=y 195CONFIG_CPU_CACHE_VIVT=y
133CONFIG_CPU_COPY_V4WB=y 196CONFIG_CPU_COPY_V4WB=y
134CONFIG_CPU_TLB_V4WBI=y 197CONFIG_CPU_TLB_V4WBI=y
198CONFIG_CPU_CP15=y
199CONFIG_CPU_CP15_MMU=y
135 200
136# 201#
137# Processor Features 202# Processor Features
@@ -140,16 +205,16 @@ CONFIG_CPU_TLB_V4WBI=y
140# CONFIG_CPU_ICACHE_DISABLE is not set 205# CONFIG_CPU_ICACHE_DISABLE is not set
141# CONFIG_CPU_DCACHE_DISABLE is not set 206# CONFIG_CPU_DCACHE_DISABLE is not set
142# CONFIG_CPU_DCACHE_WRITETHROUGH is not set 207# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
208# CONFIG_OUTER_CACHE is not set
143 209
144# 210#
145# Bus support 211# Bus support
146# 212#
147CONFIG_PCI=y 213CONFIG_PCI=y
214CONFIG_PCI_SYSCALL=y
215# CONFIG_ARCH_SUPPORTS_MSI is not set
216CONFIG_PCI_LEGACY=y
148CONFIG_PCI_DEBUG=y 217CONFIG_PCI_DEBUG=y
149
150#
151# PCCARD (PCMCIA/CardBus) support
152#
153CONFIG_PCCARD=y 218CONFIG_PCCARD=y
154# CONFIG_PCMCIA_DEBUG is not set 219# CONFIG_PCMCIA_DEBUG is not set
155CONFIG_PCMCIA=y 220CONFIG_PCMCIA=y
@@ -173,9 +238,12 @@ CONFIG_PCCARD_NONSTATIC=y
173# 238#
174# Kernel Features 239# Kernel Features
175# 240#
241# CONFIG_TICK_ONESHOT is not set
176# CONFIG_PREEMPT is not set 242# CONFIG_PREEMPT is not set
177CONFIG_HZ=100 243CONFIG_HZ=100
178# CONFIG_AEABI is not set 244CONFIG_AEABI=y
245CONFIG_OABI_COMPAT=y
246CONFIG_ARCH_FLATMEM_HAS_HOLES=y
179# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 247# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
180CONFIG_SELECT_MEMORY_MODEL=y 248CONFIG_SELECT_MEMORY_MODEL=y
181CONFIG_FLATMEM_MANUAL=y 249CONFIG_FLATMEM_MANUAL=y
@@ -184,7 +252,14 @@ CONFIG_FLATMEM_MANUAL=y
184CONFIG_FLATMEM=y 252CONFIG_FLATMEM=y
185CONFIG_FLAT_NODE_MEM_MAP=y 253CONFIG_FLAT_NODE_MEM_MAP=y
186# CONFIG_SPARSEMEM_STATIC is not set 254# CONFIG_SPARSEMEM_STATIC is not set
255# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
256CONFIG_PAGEFLAGS_EXTENDED=y
187CONFIG_SPLIT_PTLOCK_CPUS=4096 257CONFIG_SPLIT_PTLOCK_CPUS=4096
258# CONFIG_RESOURCES_64BIT is not set
259CONFIG_ZONE_DMA_FLAG=1
260CONFIG_BOUNCE=y
261CONFIG_VIRT_TO_BUS=y
262# CONFIG_LEDS is not set
188CONFIG_ALIGNMENT_TRAP=y 263CONFIG_ALIGNMENT_TRAP=y
189 264
190# 265#
@@ -194,6 +269,7 @@ CONFIG_ZBOOT_ROM_TEXT=0x0
194CONFIG_ZBOOT_ROM_BSS=0x0 269CONFIG_ZBOOT_ROM_BSS=0x0
195CONFIG_CMDLINE="mem=32M console=ttyS0,115200 initrd=0x20410000,3145728 root=/dev/ram0 rw" 270CONFIG_CMDLINE="mem=32M console=ttyS0,115200 initrd=0x20410000,3145728 root=/dev/ram0 rw"
196# CONFIG_XIP_KERNEL is not set 271# CONFIG_XIP_KERNEL is not set
272# CONFIG_KEXEC is not set
197 273
198# 274#
199# Floating point emulation 275# Floating point emulation
@@ -202,8 +278,7 @@ CONFIG_CMDLINE="mem=32M console=ttyS0,115200 initrd=0x20410000,3145728 root=/dev
202# 278#
203# At least one emulation must be selected 279# At least one emulation must be selected
204# 280#
205CONFIG_FPE_NWFPE=y 281# CONFIG_FPE_NWFPE is not set
206# CONFIG_FPE_NWFPE_XP is not set
207# CONFIG_FPE_FASTFPE is not set 282# CONFIG_FPE_FASTFPE is not set
208 283
209# 284#
@@ -212,34 +287,33 @@ CONFIG_FPE_NWFPE=y
212CONFIG_BINFMT_ELF=y 287CONFIG_BINFMT_ELF=y
213# CONFIG_BINFMT_AOUT is not set 288# CONFIG_BINFMT_AOUT is not set
214# CONFIG_BINFMT_MISC is not set 289# CONFIG_BINFMT_MISC is not set
215# CONFIG_ARTHUR is not set
216 290
217# 291#
218# Power management options 292# Power management options
219# 293#
220# CONFIG_PM is not set 294# CONFIG_PM is not set
221# CONFIG_APM is not set 295CONFIG_ARCH_SUSPEND_POSSIBLE=y
222
223#
224# Networking
225#
226CONFIG_NET=y 296CONFIG_NET=y
227 297
228# 298#
229# Networking options 299# Networking options
230# 300#
231# CONFIG_NETDEBUG is not set
232CONFIG_PACKET=y 301CONFIG_PACKET=y
233# CONFIG_PACKET_MMAP is not set 302# CONFIG_PACKET_MMAP is not set
234CONFIG_UNIX=y 303CONFIG_UNIX=y
304CONFIG_XFRM=y
305# CONFIG_XFRM_USER is not set
306# CONFIG_XFRM_SUB_POLICY is not set
307# CONFIG_XFRM_MIGRATE is not set
308# CONFIG_XFRM_STATISTICS is not set
235# CONFIG_NET_KEY is not set 309# CONFIG_NET_KEY is not set
236CONFIG_INET=y 310CONFIG_INET=y
237# CONFIG_IP_MULTICAST is not set 311# CONFIG_IP_MULTICAST is not set
238# CONFIG_IP_ADVANCED_ROUTER is not set 312# CONFIG_IP_ADVANCED_ROUTER is not set
239CONFIG_IP_FIB_HASH=y 313CONFIG_IP_FIB_HASH=y
240CONFIG_IP_PNP=y 314CONFIG_IP_PNP=y
241# CONFIG_IP_PNP_DHCP is not set 315CONFIG_IP_PNP_DHCP=y
242CONFIG_IP_PNP_BOOTP=y 316# CONFIG_IP_PNP_BOOTP is not set
243# CONFIG_IP_PNP_RARP is not set 317# CONFIG_IP_PNP_RARP is not set
244# CONFIG_NET_IPIP is not set 318# CONFIG_NET_IPIP is not set
245# CONFIG_NET_IPGRE is not set 319# CONFIG_NET_IPGRE is not set
@@ -250,28 +324,21 @@ CONFIG_IP_PNP_BOOTP=y
250# CONFIG_INET_IPCOMP is not set 324# CONFIG_INET_IPCOMP is not set
251# CONFIG_INET_XFRM_TUNNEL is not set 325# CONFIG_INET_XFRM_TUNNEL is not set
252# CONFIG_INET_TUNNEL is not set 326# CONFIG_INET_TUNNEL is not set
327CONFIG_INET_XFRM_MODE_TRANSPORT=y
328CONFIG_INET_XFRM_MODE_TUNNEL=y
329CONFIG_INET_XFRM_MODE_BEET=y
330# CONFIG_INET_LRO is not set
253CONFIG_INET_DIAG=y 331CONFIG_INET_DIAG=y
254CONFIG_INET_TCP_DIAG=y 332CONFIG_INET_TCP_DIAG=y
255# CONFIG_TCP_CONG_ADVANCED is not set 333# CONFIG_TCP_CONG_ADVANCED is not set
256CONFIG_TCP_CONG_BIC=y 334CONFIG_TCP_CONG_CUBIC=y
335CONFIG_DEFAULT_TCP_CONG="cubic"
336# CONFIG_TCP_MD5SIG is not set
257# CONFIG_IPV6 is not set 337# CONFIG_IPV6 is not set
258# CONFIG_INET6_XFRM_TUNNEL is not set 338# CONFIG_NETWORK_SECMARK is not set
259# CONFIG_INET6_TUNNEL is not set
260# CONFIG_NETFILTER is not set 339# CONFIG_NETFILTER is not set
261
262#
263# DCCP Configuration (EXPERIMENTAL)
264#
265# CONFIG_IP_DCCP is not set 340# CONFIG_IP_DCCP is not set
266
267#
268# SCTP Configuration (EXPERIMENTAL)
269#
270# CONFIG_IP_SCTP is not set 341# CONFIG_IP_SCTP is not set
271
272#
273# TIPC Configuration (EXPERIMENTAL)
274#
275# CONFIG_TIPC is not set 342# CONFIG_TIPC is not set
276# CONFIG_ATM is not set 343# CONFIG_ATM is not set
277# CONFIG_BRIDGE is not set 344# CONFIG_BRIDGE is not set
@@ -282,13 +349,8 @@ CONFIG_TCP_CONG_BIC=y
282# CONFIG_ATALK is not set 349# CONFIG_ATALK is not set
283# CONFIG_X25 is not set 350# CONFIG_X25 is not set
284# CONFIG_LAPB is not set 351# CONFIG_LAPB is not set
285# CONFIG_NET_DIVERT is not set
286# CONFIG_ECONET is not set 352# CONFIG_ECONET is not set
287# CONFIG_WAN_ROUTER is not set 353# CONFIG_WAN_ROUTER is not set
288
289#
290# QoS and/or fair queueing
291#
292# CONFIG_NET_SCHED is not set 354# CONFIG_NET_SCHED is not set
293 355
294# 356#
@@ -296,9 +358,21 @@ CONFIG_TCP_CONG_BIC=y
296# 358#
297# CONFIG_NET_PKTGEN is not set 359# CONFIG_NET_PKTGEN is not set
298# CONFIG_HAMRADIO is not set 360# CONFIG_HAMRADIO is not set
361# CONFIG_CAN is not set
299# CONFIG_IRDA is not set 362# CONFIG_IRDA is not set
300# CONFIG_BT is not set 363# CONFIG_BT is not set
364# CONFIG_AF_RXRPC is not set
365
366#
367# Wireless
368#
369# CONFIG_CFG80211 is not set
370CONFIG_WIRELESS_EXT=y
371CONFIG_WIRELESS_EXT_SYSFS=y
372# CONFIG_MAC80211 is not set
301# CONFIG_IEEE80211 is not set 373# CONFIG_IEEE80211 is not set
374# CONFIG_RFKILL is not set
375# CONFIG_NET_9P is not set
302 376
303# 377#
304# Device Drivers 378# Device Drivers
@@ -307,36 +381,40 @@ CONFIG_TCP_CONG_BIC=y
307# 381#
308# Generic Driver Options 382# Generic Driver Options
309# 383#
384CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
310CONFIG_STANDALONE=y 385CONFIG_STANDALONE=y
311CONFIG_PREVENT_FIRMWARE_BUILD=y 386CONFIG_PREVENT_FIRMWARE_BUILD=y
312CONFIG_FW_LOADER=y 387CONFIG_FW_LOADER=y
388CONFIG_FIRMWARE_IN_KERNEL=y
389CONFIG_EXTRA_FIRMWARE=""
313# CONFIG_DEBUG_DRIVER is not set 390# CONFIG_DEBUG_DRIVER is not set
314 391# CONFIG_DEBUG_DEVRES is not set
315# 392# CONFIG_SYS_HYPERVISOR is not set
316# Connector - unified userspace <-> kernelspace linker
317#
318# CONFIG_CONNECTOR is not set 393# CONFIG_CONNECTOR is not set
319
320#
321# Memory Technology Devices (MTD)
322#
323CONFIG_MTD=y 394CONFIG_MTD=y
324# CONFIG_MTD_DEBUG is not set 395# CONFIG_MTD_DEBUG is not set
325# CONFIG_MTD_CONCAT is not set 396# CONFIG_MTD_CONCAT is not set
326CONFIG_MTD_PARTITIONS=y 397CONFIG_MTD_PARTITIONS=y
327# CONFIG_MTD_REDBOOT_PARTS is not set 398CONFIG_MTD_REDBOOT_PARTS=y
399CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
400# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
401# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
328CONFIG_MTD_CMDLINE_PARTS=y 402CONFIG_MTD_CMDLINE_PARTS=y
329# CONFIG_MTD_AFS_PARTS is not set 403# CONFIG_MTD_AFS_PARTS is not set
404# CONFIG_MTD_AR7_PARTS is not set
330 405
331# 406#
332# User Modules And Translation Layers 407# User Modules And Translation Layers
333# 408#
334CONFIG_MTD_CHAR=y 409CONFIG_MTD_CHAR=y
410CONFIG_MTD_BLKDEVS=y
335CONFIG_MTD_BLOCK=y 411CONFIG_MTD_BLOCK=y
336# CONFIG_FTL is not set 412# CONFIG_FTL is not set
337# CONFIG_NFTL is not set 413# CONFIG_NFTL is not set
338# CONFIG_INFTL is not set 414# CONFIG_INFTL is not set
339# CONFIG_RFD_FTL is not set 415# CONFIG_RFD_FTL is not set
416# CONFIG_SSFDC is not set
417# CONFIG_MTD_OOPS is not set
340 418
341# 419#
342# RAM/ROM/Flash chip drivers 420# RAM/ROM/Flash chip drivers
@@ -355,22 +433,25 @@ CONFIG_MTD_CFI_I1=y
355CONFIG_MTD_CFI_I2=y 433CONFIG_MTD_CFI_I2=y
356# CONFIG_MTD_CFI_I4 is not set 434# CONFIG_MTD_CFI_I4 is not set
357# CONFIG_MTD_CFI_I8 is not set 435# CONFIG_MTD_CFI_I8 is not set
358# CONFIG_MTD_CFI_INTELEXT is not set 436CONFIG_MTD_CFI_INTELEXT=y
359CONFIG_MTD_CFI_AMDSTD=y 437# CONFIG_MTD_CFI_AMDSTD is not set
360# CONFIG_MTD_CFI_STAA is not set 438# CONFIG_MTD_CFI_STAA is not set
361CONFIG_MTD_CFI_UTIL=y 439CONFIG_MTD_CFI_UTIL=y
362# CONFIG_MTD_RAM is not set 440# CONFIG_MTD_RAM is not set
363# CONFIG_MTD_ROM is not set 441# CONFIG_MTD_ROM is not set
364# CONFIG_MTD_ABSENT is not set 442# CONFIG_MTD_ABSENT is not set
365# CONFIG_MTD_OBSOLETE_CHIPS is not set
366 443
367# 444#
368# Mapping drivers for chip access 445# Mapping drivers for chip access
369# 446#
370# CONFIG_MTD_COMPLEX_MAPPINGS is not set 447# CONFIG_MTD_COMPLEX_MAPPINGS is not set
371# CONFIG_MTD_PHYSMAP is not set 448CONFIG_MTD_PHYSMAP=y
449CONFIG_MTD_PHYSMAP_START=0x8000000
450CONFIG_MTD_PHYSMAP_LEN=0
451CONFIG_MTD_PHYSMAP_BANKWIDTH=4
372# CONFIG_MTD_ARM_INTEGRATOR is not set 452# CONFIG_MTD_ARM_INTEGRATOR is not set
373# CONFIG_MTD_IMPA7 is not set 453# CONFIG_MTD_IMPA7 is not set
454# CONFIG_MTD_INTEL_VR_NOR is not set
374# CONFIG_MTD_PLATRAM is not set 455# CONFIG_MTD_PLATRAM is not set
375 456
376# 457#
@@ -388,29 +469,15 @@ CONFIG_MTD_CFI_UTIL=y
388# CONFIG_MTD_DOC2000 is not set 469# CONFIG_MTD_DOC2000 is not set
389# CONFIG_MTD_DOC2001 is not set 470# CONFIG_MTD_DOC2001 is not set
390# CONFIG_MTD_DOC2001PLUS is not set 471# CONFIG_MTD_DOC2001PLUS is not set
391
392#
393# NAND Flash Device Drivers
394#
395# CONFIG_MTD_NAND is not set 472# CONFIG_MTD_NAND is not set
396
397#
398# OneNAND Flash Device Drivers
399#
400# CONFIG_MTD_ONENAND is not set 473# CONFIG_MTD_ONENAND is not set
401 474
402# 475#
403# Parallel port support 476# UBI - Unsorted block images
404# 477#
478# CONFIG_MTD_UBI is not set
405# CONFIG_PARPORT is not set 479# CONFIG_PARPORT is not set
406 480CONFIG_BLK_DEV=y
407#
408# Plug and Play support
409#
410
411#
412# Block devices
413#
414# CONFIG_BLK_CPQ_DA is not set 481# CONFIG_BLK_CPQ_DA is not set
415# CONFIG_BLK_CPQ_CISS_DA is not set 482# CONFIG_BLK_CPQ_CISS_DA is not set
416# CONFIG_BLK_DEV_DAC960 is not set 483# CONFIG_BLK_DEV_DAC960 is not set
@@ -422,13 +489,17 @@ CONFIG_MTD_CFI_UTIL=y
422CONFIG_BLK_DEV_RAM=y 489CONFIG_BLK_DEV_RAM=y
423CONFIG_BLK_DEV_RAM_COUNT=16 490CONFIG_BLK_DEV_RAM_COUNT=16
424CONFIG_BLK_DEV_RAM_SIZE=8192 491CONFIG_BLK_DEV_RAM_SIZE=8192
425CONFIG_BLK_DEV_INITRD=y 492# CONFIG_BLK_DEV_XIP is not set
426# CONFIG_CDROM_PKTCDVD is not set 493# CONFIG_CDROM_PKTCDVD is not set
427# CONFIG_ATA_OVER_ETH is not set 494# CONFIG_ATA_OVER_ETH is not set
428 495CONFIG_MISC_DEVICES=y
429# 496# CONFIG_PHANTOM is not set
430# ATA/ATAPI/MFM/RLL support 497# CONFIG_EEPROM_93CX6 is not set
431# 498# CONFIG_SGI_IOC4 is not set
499# CONFIG_TIFM_CORE is not set
500# CONFIG_ENCLOSURE_SERVICES is not set
501# CONFIG_HP_ILO is not set
502CONFIG_HAVE_IDE=y
432# CONFIG_IDE is not set 503# CONFIG_IDE is not set
433 504
434# 505#
@@ -436,127 +507,85 @@ CONFIG_BLK_DEV_INITRD=y
436# 507#
437# CONFIG_RAID_ATTRS is not set 508# CONFIG_RAID_ATTRS is not set
438# CONFIG_SCSI is not set 509# CONFIG_SCSI is not set
439 510# CONFIG_SCSI_DMA is not set
440# 511# CONFIG_SCSI_NETLINK is not set
441# Multi-device support (RAID and LVM) 512# CONFIG_ATA is not set
442#
443# CONFIG_MD is not set 513# CONFIG_MD is not set
444
445#
446# Fusion MPT device support
447#
448# CONFIG_FUSION is not set 514# CONFIG_FUSION is not set
449 515
450# 516#
451# IEEE 1394 (FireWire) support 517# IEEE 1394 (FireWire) support
452# 518#
453# CONFIG_IEEE1394 is not set
454 519
455# 520#
456# I2O device support 521# Enable only one of the two stacks, unless you know what you are doing
457# 522#
523# CONFIG_FIREWIRE is not set
524# CONFIG_IEEE1394 is not set
458# CONFIG_I2O is not set 525# CONFIG_I2O is not set
459
460#
461# Network device support
462#
463CONFIG_NETDEVICES=y 526CONFIG_NETDEVICES=y
464# CONFIG_DUMMY is not set 527# CONFIG_DUMMY is not set
465# CONFIG_BONDING is not set 528# CONFIG_BONDING is not set
529# CONFIG_MACVLAN is not set
466# CONFIG_EQUALIZER is not set 530# CONFIG_EQUALIZER is not set
467# CONFIG_TUN is not set 531# CONFIG_TUN is not set
468 532# CONFIG_VETH is not set
469#
470# ARCnet devices
471#
472# CONFIG_ARCNET is not set 533# CONFIG_ARCNET is not set
473
474#
475# PHY device support
476#
477# CONFIG_PHYLIB is not set 534# CONFIG_PHYLIB is not set
478
479#
480# Ethernet (10 or 100Mbit)
481#
482CONFIG_NET_ETHERNET=y 535CONFIG_NET_ETHERNET=y
483# CONFIG_MII is not set 536CONFIG_MII=y
484CONFIG_ARM_KS8695_ETHER=y 537# CONFIG_AX88796 is not set
485# CONFIG_HAPPYMEAL is not set 538# CONFIG_HAPPYMEAL is not set
486# CONFIG_SUNGEM is not set 539# CONFIG_SUNGEM is not set
487# CONFIG_CASSINI is not set 540# CONFIG_CASSINI is not set
488# CONFIG_NET_VENDOR_3COM is not set 541# CONFIG_NET_VENDOR_3COM is not set
489# CONFIG_SMC91X is not set 542# CONFIG_SMC91X is not set
490# CONFIG_DM9000 is not set 543# CONFIG_DM9000 is not set
491
492#
493# Tulip family network device support
494#
495# CONFIG_NET_TULIP is not set 544# CONFIG_NET_TULIP is not set
496# CONFIG_HP100 is not set 545# CONFIG_HP100 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
497# CONFIG_NET_PCI is not set 550# CONFIG_NET_PCI is not set
498 551# CONFIG_B44 is not set
499# 552# CONFIG_NETDEV_1000 is not set
500# Ethernet (1000 Mbit) 553# CONFIG_NETDEV_10000 is not set
501#
502# CONFIG_ACENIC is not set
503# CONFIG_DL2K is not set
504# CONFIG_E1000 is not set
505# CONFIG_NS83820 is not set
506# CONFIG_HAMACHI is not set
507# CONFIG_YELLOWFIN is not set
508# CONFIG_R8169 is not set
509# CONFIG_SIS190 is not set
510# CONFIG_SKGE is not set
511# CONFIG_SKY2 is not set
512# CONFIG_SK98LIN is not set
513# CONFIG_TIGON3 is not set
514# CONFIG_BNX2 is not set
515
516#
517# Ethernet (10000 Mbit)
518#
519# CONFIG_CHELSIO_T1 is not set
520# CONFIG_IXGB is not set
521# CONFIG_S2IO is not set
522
523#
524# Token Ring devices
525#
526# CONFIG_TR is not set 554# CONFIG_TR is not set
527 555
528# 556#
529# Wireless LAN (non-hamradio) 557# Wireless LAN
530# 558#
531# CONFIG_NET_RADIO is not set 559# CONFIG_WLAN_PRE80211 is not set
532 560CONFIG_WLAN_80211=y
533# 561# CONFIG_PCMCIA_RAYCS is not set
534# PCMCIA network device support 562# CONFIG_IPW2100 is not set
535# 563# CONFIG_IPW2200 is not set
564# CONFIG_LIBERTAS is not set
565# CONFIG_HERMES is not set
566# CONFIG_ATMEL is not set
567# CONFIG_AIRO_CS is not set
568# CONFIG_PCMCIA_WL3501 is not set
569CONFIG_PRISM54=m
570# CONFIG_IWLWIFI_LEDS is not set
571# CONFIG_HOSTAP is not set
536# CONFIG_NET_PCMCIA is not set 572# CONFIG_NET_PCMCIA is not set
537
538#
539# Wan interfaces
540#
541# CONFIG_WAN is not set 573# CONFIG_WAN is not set
542# CONFIG_FDDI is not set 574# CONFIG_FDDI is not set
543# CONFIG_HIPPI is not set 575# CONFIG_HIPPI is not set
544# CONFIG_PPP is not set 576# CONFIG_PPP is not set
545# CONFIG_SLIP is not set 577# CONFIG_SLIP is not set
546# CONFIG_SHAPER is not set
547# CONFIG_NETCONSOLE is not set 578# CONFIG_NETCONSOLE is not set
548# CONFIG_NETPOLL is not set 579# CONFIG_NETPOLL is not set
549# CONFIG_NET_POLL_CONTROLLER is not set 580# CONFIG_NET_POLL_CONTROLLER is not set
550
551#
552# ISDN subsystem
553#
554# CONFIG_ISDN is not set 581# CONFIG_ISDN is not set
555 582
556# 583#
557# Input device support 584# Input device support
558# 585#
559CONFIG_INPUT=y 586CONFIG_INPUT=y
587# CONFIG_INPUT_FF_MEMLESS is not set
588# CONFIG_INPUT_POLLDEV is not set
560 589
561# 590#
562# Userland interfaces 591# Userland interfaces
@@ -566,7 +595,6 @@ CONFIG_INPUT_MOUSEDEV=y
566CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 595CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
567CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 596CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
568# CONFIG_INPUT_JOYDEV is not set 597# CONFIG_INPUT_JOYDEV is not set
569# CONFIG_INPUT_TSDEV is not set
570# CONFIG_INPUT_EVDEV is not set 598# CONFIG_INPUT_EVDEV is not set
571# CONFIG_INPUT_EVBUG is not set 599# CONFIG_INPUT_EVBUG is not set
572 600
@@ -576,6 +604,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
576# CONFIG_INPUT_KEYBOARD is not set 604# CONFIG_INPUT_KEYBOARD is not set
577# CONFIG_INPUT_MOUSE is not set 605# CONFIG_INPUT_MOUSE is not set
578# CONFIG_INPUT_JOYSTICK is not set 606# CONFIG_INPUT_JOYSTICK is not set
607# CONFIG_INPUT_TABLET is not set
579# CONFIG_INPUT_TOUCHSCREEN is not set 608# CONFIG_INPUT_TOUCHSCREEN is not set
580# CONFIG_INPUT_MISC is not set 609# CONFIG_INPUT_MISC is not set
581 610
@@ -589,9 +618,13 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
589# Character devices 618# Character devices
590# 619#
591CONFIG_VT=y 620CONFIG_VT=y
621CONFIG_CONSOLE_TRANSLATIONS=y
592CONFIG_VT_CONSOLE=y 622CONFIG_VT_CONSOLE=y
593CONFIG_HW_CONSOLE=y 623CONFIG_HW_CONSOLE=y
624# CONFIG_VT_HW_CONSOLE_BINDING is not set
625CONFIG_DEVKMEM=y
594# CONFIG_SERIAL_NONSTANDARD is not set 626# CONFIG_SERIAL_NONSTANDARD is not set
627# CONFIG_NOZOMI is not set
595 628
596# 629#
597# Serial drivers 630# Serial drivers
@@ -609,132 +642,113 @@ CONFIG_SERIAL_CORE_CONSOLE=y
609CONFIG_UNIX98_PTYS=y 642CONFIG_UNIX98_PTYS=y
610CONFIG_LEGACY_PTYS=y 643CONFIG_LEGACY_PTYS=y
611CONFIG_LEGACY_PTY_COUNT=256 644CONFIG_LEGACY_PTY_COUNT=256
612
613#
614# IPMI
615#
616# CONFIG_IPMI_HANDLER is not set 645# CONFIG_IPMI_HANDLER is not set
617 646CONFIG_HW_RANDOM=m
618#
619# Watchdog Cards
620#
621# CONFIG_WATCHDOG is not set
622# CONFIG_NVRAM is not set 647# CONFIG_NVRAM is not set
623# CONFIG_DTLK is not set
624# CONFIG_R3964 is not set 648# CONFIG_R3964 is not set
625# CONFIG_APPLICOM is not set 649# CONFIG_APPLICOM is not set
626 650
627# 651#
628# Ftape, the floppy tape device driver
629#
630# CONFIG_DRM is not set
631
632#
633# PCMCIA character devices 652# PCMCIA character devices
634# 653#
635# CONFIG_SYNCLINK_CS is not set 654# CONFIG_SYNCLINK_CS is not set
636# CONFIG_CARDMAN_4000 is not set 655# CONFIG_CARDMAN_4000 is not set
637# CONFIG_CARDMAN_4040 is not set 656# CONFIG_CARDMAN_4040 is not set
657# CONFIG_IPWIRELESS is not set
638# CONFIG_RAW_DRIVER is not set 658# CONFIG_RAW_DRIVER is not set
639
640#
641# TPM devices
642#
643# CONFIG_TCG_TPM is not set 659# CONFIG_TCG_TPM is not set
644# CONFIG_TELCLOCK is not set 660CONFIG_DEVPORT=y
645
646#
647# I2C support
648#
649# CONFIG_I2C is not set 661# CONFIG_I2C is not set
650
651#
652# SPI support
653#
654# CONFIG_SPI is not set 662# CONFIG_SPI is not set
655# CONFIG_SPI_MASTER is not set
656
657#
658# Dallas's 1-wire bus
659#
660# CONFIG_W1 is not set 663# CONFIG_W1 is not set
661 664# CONFIG_POWER_SUPPLY is not set
662#
663# Hardware Monitoring support
664#
665# CONFIG_HWMON is not set 665# CONFIG_HWMON is not set
666# CONFIG_HWMON_VID is not set 666# CONFIG_WATCHDOG is not set
667
668#
669# Misc devices
670#
671 667
672# 668#
673# LED devices 669# Sonics Silicon Backplane
674# 670#
675# CONFIG_NEW_LEDS is not set 671CONFIG_SSB_POSSIBLE=y
672# CONFIG_SSB is not set
676 673
677# 674#
678# LED drivers 675# Multifunction device drivers
679# 676#
677# CONFIG_MFD_CORE is not set
678# CONFIG_MFD_SM501 is not set
679# CONFIG_HTC_PASIC3 is not set
680# CONFIG_MFD_TMIO is not set
681# CONFIG_MFD_T7L66XB is not set
682# CONFIG_MFD_TC6387XB is not set
680 683
681# 684#
682# LED Triggers 685# Multimedia devices
683# 686#
684 687
685# 688#
686# Multimedia devices 689# Multimedia core support
687# 690#
688# CONFIG_VIDEO_DEV is not set 691# CONFIG_VIDEO_DEV is not set
692# CONFIG_DVB_CORE is not set
693# CONFIG_VIDEO_MEDIA is not set
689 694
690# 695#
691# Digital Video Broadcasting Devices 696# Multimedia drivers
692# 697#
693# CONFIG_DVB is not set 698# CONFIG_DAB is not set
694 699
695# 700#
696# Graphics support 701# Graphics support
697# 702#
703# CONFIG_DRM is not set
704# CONFIG_VGASTATE is not set
705# CONFIG_VIDEO_OUTPUT_CONTROL is not set
698# CONFIG_FB is not set 706# CONFIG_FB is not set
707# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
699 708
700# 709#
701# Console display driver support 710# Display device support
702# 711#
703# CONFIG_VGA_CONSOLE is not set 712# CONFIG_DISPLAY_SUPPORT is not set
704CONFIG_DUMMY_CONSOLE=y
705 713
706# 714#
707# Sound 715# Console display driver support
708# 716#
717# CONFIG_VGA_CONSOLE is not set
718CONFIG_DUMMY_CONSOLE=y
709# CONFIG_SOUND is not set 719# CONFIG_SOUND is not set
710 720CONFIG_HID_SUPPORT=y
711# 721CONFIG_HID=y
712# USB support 722CONFIG_HID_DEBUG=y
713# 723# CONFIG_HIDRAW is not set
724CONFIG_USB_SUPPORT=y
714CONFIG_USB_ARCH_HAS_HCD=y 725CONFIG_USB_ARCH_HAS_HCD=y
715CONFIG_USB_ARCH_HAS_OHCI=y 726CONFIG_USB_ARCH_HAS_OHCI=y
716CONFIG_USB_ARCH_HAS_EHCI=y 727CONFIG_USB_ARCH_HAS_EHCI=y
717# CONFIG_USB is not set 728# CONFIG_USB is not set
718 729
719# 730#
720# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 731# Enable Host or Gadget support to see Inventra options
721# 732#
722 733
723# 734#
724# USB Gadget Support 735# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
725# 736#
726# CONFIG_USB_GADGET is not set 737# CONFIG_USB_GADGET is not set
727
728#
729# MMC/SD Card support
730#
731# CONFIG_MMC is not set 738# CONFIG_MMC is not set
739# CONFIG_NEW_LEDS is not set
740CONFIG_RTC_LIB=y
741# CONFIG_RTC_CLASS is not set
742# CONFIG_DMADEVICES is not set
732 743
733# 744#
734# Real Time Clock 745# Voltage and Current regulators
735# 746#
736CONFIG_RTC_LIB=y 747# CONFIG_REGULATOR is not set
737# CONFIG_RTC_CLASS is not set 748# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
749# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
750# CONFIG_REGULATOR_BQ24022 is not set
751# CONFIG_UIO is not set
738 752
739# 753#
740# File systems 754# File systems
@@ -743,16 +757,16 @@ CONFIG_EXT2_FS=y
743# CONFIG_EXT2_FS_XATTR is not set 757# CONFIG_EXT2_FS_XATTR is not set
744# CONFIG_EXT2_FS_XIP is not set 758# CONFIG_EXT2_FS_XIP is not set
745# CONFIG_EXT3_FS is not set 759# CONFIG_EXT3_FS is not set
760# CONFIG_EXT4DEV_FS is not set
746# CONFIG_REISERFS_FS is not set 761# CONFIG_REISERFS_FS is not set
747# CONFIG_JFS_FS is not set 762# CONFIG_JFS_FS is not set
748# CONFIG_FS_POSIX_ACL is not set 763# CONFIG_FS_POSIX_ACL is not set
749# CONFIG_XFS_FS is not set 764# CONFIG_XFS_FS is not set
750# CONFIG_OCFS2_FS is not set 765# CONFIG_OCFS2_FS is not set
751# CONFIG_MINIX_FS is not set 766CONFIG_DNOTIFY=y
752# CONFIG_ROMFS_FS is not set
753CONFIG_INOTIFY=y 767CONFIG_INOTIFY=y
768CONFIG_INOTIFY_USER=y
754# CONFIG_QUOTA is not set 769# CONFIG_QUOTA is not set
755CONFIG_DNOTIFY=y
756# CONFIG_AUTOFS_FS is not set 770# CONFIG_AUTOFS_FS is not set
757# CONFIG_AUTOFS4_FS is not set 771# CONFIG_AUTOFS4_FS is not set
758# CONFIG_FUSE_FS is not set 772# CONFIG_FUSE_FS is not set
@@ -774,10 +788,11 @@ CONFIG_DNOTIFY=y
774# Pseudo filesystems 788# Pseudo filesystems
775# 789#
776CONFIG_PROC_FS=y 790CONFIG_PROC_FS=y
791CONFIG_PROC_SYSCTL=y
777CONFIG_SYSFS=y 792CONFIG_SYSFS=y
778CONFIG_TMPFS=y 793CONFIG_TMPFS=y
794# CONFIG_TMPFS_POSIX_ACL is not set
779# CONFIG_HUGETLB_PAGE is not set 795# CONFIG_HUGETLB_PAGE is not set
780CONFIG_RAMFS=y
781# CONFIG_CONFIGFS_FS is not set 796# CONFIG_CONFIGFS_FS is not set
782 797
783# 798#
@@ -790,67 +805,113 @@ CONFIG_RAMFS=y
790# CONFIG_BEFS_FS is not set 805# CONFIG_BEFS_FS is not set
791# CONFIG_BFS_FS is not set 806# CONFIG_BFS_FS is not set
792# CONFIG_EFS_FS is not set 807# CONFIG_EFS_FS is not set
793# CONFIG_JFFS_FS is not set 808CONFIG_JFFS2_FS=y
794# CONFIG_JFFS2_FS is not set 809CONFIG_JFFS2_FS_DEBUG=0
810CONFIG_JFFS2_FS_WRITEBUFFER=y
811# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
812CONFIG_JFFS2_SUMMARY=y
813# CONFIG_JFFS2_FS_XATTR is not set
814CONFIG_JFFS2_COMPRESSION_OPTIONS=y
815CONFIG_JFFS2_ZLIB=y
816# CONFIG_JFFS2_LZO is not set
817CONFIG_JFFS2_RTIME=y
818CONFIG_JFFS2_RUBIN=y
819# CONFIG_JFFS2_CMODE_NONE is not set
820CONFIG_JFFS2_CMODE_PRIORITY=y
821# CONFIG_JFFS2_CMODE_SIZE is not set
822# CONFIG_JFFS2_CMODE_FAVOURLZO is not set
795CONFIG_CRAMFS=y 823CONFIG_CRAMFS=y
796# CONFIG_VXFS_FS is not set 824# CONFIG_VXFS_FS is not set
825# CONFIG_MINIX_FS is not set
826# CONFIG_OMFS_FS is not set
797# CONFIG_HPFS_FS is not set 827# CONFIG_HPFS_FS is not set
798# CONFIG_QNX4FS_FS is not set 828# CONFIG_QNX4FS_FS is not set
829# CONFIG_ROMFS_FS is not set
799# CONFIG_SYSV_FS is not set 830# CONFIG_SYSV_FS is not set
800# CONFIG_UFS_FS is not set 831# CONFIG_UFS_FS is not set
801 832CONFIG_NETWORK_FILESYSTEMS=y
802# 833CONFIG_NFS_FS=y
803# Network File Systems 834CONFIG_NFS_V3=y
804# 835# CONFIG_NFS_V3_ACL is not set
805# CONFIG_NFS_FS is not set 836# CONFIG_NFS_V4 is not set
837CONFIG_ROOT_NFS=y
806# CONFIG_NFSD is not set 838# CONFIG_NFSD is not set
839CONFIG_LOCKD=y
840CONFIG_LOCKD_V4=y
841CONFIG_NFS_COMMON=y
842CONFIG_SUNRPC=y
843# CONFIG_RPCSEC_GSS_KRB5 is not set
844# CONFIG_RPCSEC_GSS_SPKM3 is not set
807# CONFIG_SMB_FS is not set 845# CONFIG_SMB_FS is not set
808# CONFIG_CIFS is not set 846# CONFIG_CIFS is not set
809# CONFIG_NCP_FS is not set 847# CONFIG_NCP_FS is not set
810# CONFIG_CODA_FS is not set 848# CONFIG_CODA_FS is not set
811# CONFIG_AFS_FS is not set 849# CONFIG_AFS_FS is not set
812# CONFIG_9P_FS is not set
813 850
814# 851#
815# Partition Types 852# Partition Types
816# 853#
817# CONFIG_PARTITION_ADVANCED is not set 854# CONFIG_PARTITION_ADVANCED is not set
818CONFIG_MSDOS_PARTITION=y 855CONFIG_MSDOS_PARTITION=y
819
820#
821# Native Language Support
822#
823# CONFIG_NLS is not set 856# CONFIG_NLS is not set
824 857# CONFIG_DLM is not set
825#
826# Profiling support
827#
828# CONFIG_PROFILING is not set
829 858
830# 859#
831# Kernel hacking 860# Kernel hacking
832# 861#
833# CONFIG_PRINTK_TIME is not set 862# CONFIG_PRINTK_TIME is not set
863CONFIG_ENABLE_WARN_DEPRECATED=y
864CONFIG_ENABLE_MUST_CHECK=y
865CONFIG_FRAME_WARN=1024
834# CONFIG_MAGIC_SYSRQ is not set 866# CONFIG_MAGIC_SYSRQ is not set
867# CONFIG_UNUSED_SYMBOLS is not set
868# CONFIG_DEBUG_FS is not set
869# CONFIG_HEADERS_CHECK is not set
835CONFIG_DEBUG_KERNEL=y 870CONFIG_DEBUG_KERNEL=y
836CONFIG_LOG_BUF_SHIFT=14 871# CONFIG_DEBUG_SHIRQ is not set
837CONFIG_DETECT_SOFTLOCKUP=y 872CONFIG_DETECT_SOFTLOCKUP=y
873# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
874CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
875CONFIG_SCHED_DEBUG=y
838# CONFIG_SCHEDSTATS is not set 876# CONFIG_SCHEDSTATS is not set
877# CONFIG_TIMER_STATS is not set
878# CONFIG_DEBUG_OBJECTS is not set
839# CONFIG_DEBUG_SLAB is not set 879# CONFIG_DEBUG_SLAB is not set
840CONFIG_DEBUG_MUTEXES=y 880# CONFIG_DEBUG_RT_MUTEXES is not set
881# CONFIG_RT_MUTEX_TESTER is not set
841# CONFIG_DEBUG_SPINLOCK is not set 882# CONFIG_DEBUG_SPINLOCK is not set
883CONFIG_DEBUG_MUTEXES=y
884# CONFIG_DEBUG_LOCK_ALLOC is not set
885# CONFIG_PROVE_LOCKING is not set
886# CONFIG_LOCK_STAT is not set
842# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 887# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
888# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
843# CONFIG_DEBUG_KOBJECT is not set 889# CONFIG_DEBUG_KOBJECT is not set
844CONFIG_DEBUG_BUGVERBOSE=y 890CONFIG_DEBUG_BUGVERBOSE=y
845# CONFIG_DEBUG_INFO is not set 891# CONFIG_DEBUG_INFO is not set
846# CONFIG_DEBUG_FS is not set
847# CONFIG_DEBUG_VM is not set 892# CONFIG_DEBUG_VM is not set
893# CONFIG_DEBUG_WRITECOUNT is not set
894CONFIG_DEBUG_MEMORY_INIT=y
895# CONFIG_DEBUG_LIST is not set
896# CONFIG_DEBUG_SG is not set
848CONFIG_FRAME_POINTER=y 897CONFIG_FRAME_POINTER=y
849# CONFIG_UNWIND_INFO is not set 898# CONFIG_BOOT_PRINTK_DELAY is not set
850CONFIG_FORCED_INLINING=y
851# CONFIG_RCU_TORTURE_TEST is not set 899# CONFIG_RCU_TORTURE_TEST is not set
900# CONFIG_BACKTRACE_SELF_TEST is not set
901# CONFIG_FAULT_INJECTION is not set
902# CONFIG_LATENCYTOP is not set
903# CONFIG_SYSCTL_SYSCALL_CHECK is not set
904CONFIG_HAVE_FTRACE=y
905CONFIG_HAVE_DYNAMIC_FTRACE=y
906# CONFIG_FTRACE is not set
907# CONFIG_SCHED_TRACER is not set
908# CONFIG_CONTEXT_SWITCH_TRACER is not set
909# CONFIG_SAMPLES is not set
910CONFIG_HAVE_ARCH_KGDB=y
911# CONFIG_KGDB is not set
852CONFIG_DEBUG_USER=y 912CONFIG_DEBUG_USER=y
853# CONFIG_DEBUG_ERRORS is not set 913# CONFIG_DEBUG_ERRORS is not set
914# CONFIG_DEBUG_STACK_USAGE is not set
854CONFIG_DEBUG_LL=y 915CONFIG_DEBUG_LL=y
855# CONFIG_DEBUG_ICEDCC is not set 916# CONFIG_DEBUG_ICEDCC is not set
856 917
@@ -859,21 +920,103 @@ CONFIG_DEBUG_LL=y
859# 920#
860# CONFIG_KEYS is not set 921# CONFIG_KEYS is not set
861# CONFIG_SECURITY is not set 922# CONFIG_SECURITY is not set
923# CONFIG_SECURITY_FILE_CAPABILITIES is not set
924CONFIG_CRYPTO=y
925
926#
927# Crypto core or helper
928#
929# CONFIG_CRYPTO_MANAGER is not set
930# CONFIG_CRYPTO_GF128MUL is not set
931# CONFIG_CRYPTO_NULL is not set
932# CONFIG_CRYPTO_CRYPTD is not set
933# CONFIG_CRYPTO_AUTHENC is not set
934# CONFIG_CRYPTO_TEST is not set
935
936#
937# Authenticated Encryption with Associated Data
938#
939# CONFIG_CRYPTO_CCM is not set
940# CONFIG_CRYPTO_GCM is not set
941# CONFIG_CRYPTO_SEQIV is not set
942
943#
944# Block modes
945#
946# CONFIG_CRYPTO_CBC is not set
947# CONFIG_CRYPTO_CTR is not set
948# CONFIG_CRYPTO_CTS is not set
949# CONFIG_CRYPTO_ECB is not set
950# CONFIG_CRYPTO_LRW is not set
951# CONFIG_CRYPTO_PCBC is not set
952# CONFIG_CRYPTO_XTS is not set
953
954#
955# Hash modes
956#
957# CONFIG_CRYPTO_HMAC is not set
958# CONFIG_CRYPTO_XCBC is not set
959
960#
961# Digest
962#
963# CONFIG_CRYPTO_CRC32C is not set
964# CONFIG_CRYPTO_MD4 is not set
965# CONFIG_CRYPTO_MD5 is not set
966# CONFIG_CRYPTO_MICHAEL_MIC is not set
967# CONFIG_CRYPTO_RMD128 is not set
968# CONFIG_CRYPTO_RMD160 is not set
969# CONFIG_CRYPTO_RMD256 is not set
970# CONFIG_CRYPTO_RMD320 is not set
971# CONFIG_CRYPTO_SHA1 is not set
972# CONFIG_CRYPTO_SHA256 is not set
973# CONFIG_CRYPTO_SHA512 is not set
974# CONFIG_CRYPTO_TGR192 is not set
975# CONFIG_CRYPTO_WP512 is not set
862 976
863# 977#
864# Cryptographic options 978# Ciphers
865# 979#
866# CONFIG_CRYPTO is not set 980# CONFIG_CRYPTO_AES is not set
981# CONFIG_CRYPTO_ANUBIS is not set
982# CONFIG_CRYPTO_ARC4 is not set
983# CONFIG_CRYPTO_BLOWFISH is not set
984# CONFIG_CRYPTO_CAMELLIA is not set
985# CONFIG_CRYPTO_CAST5 is not set
986# CONFIG_CRYPTO_CAST6 is not set
987# CONFIG_CRYPTO_DES is not set
988# CONFIG_CRYPTO_FCRYPT is not set
989# CONFIG_CRYPTO_KHAZAD is not set
990# CONFIG_CRYPTO_SALSA20 is not set
991# CONFIG_CRYPTO_SEED is not set
992# CONFIG_CRYPTO_SERPENT is not set
993# CONFIG_CRYPTO_TEA is not set
994# CONFIG_CRYPTO_TWOFISH is not set
867 995
868# 996#
869# Hardware crypto devices 997# Compression
870# 998#
999# CONFIG_CRYPTO_DEFLATE is not set
1000# CONFIG_CRYPTO_LZO is not set
1001CONFIG_CRYPTO_HW=y
1002# CONFIG_CRYPTO_DEV_HIFN_795X is not set
871 1003
872# 1004#
873# Library routines 1005# Library routines
874# 1006#
1007CONFIG_BITREVERSE=y
1008# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1009# CONFIG_GENERIC_FIND_NEXT_BIT is not set
875# CONFIG_CRC_CCITT is not set 1010# CONFIG_CRC_CCITT is not set
876# CONFIG_CRC16 is not set 1011# CONFIG_CRC16 is not set
1012# CONFIG_CRC_T10DIF is not set
1013# CONFIG_CRC_ITU_T is not set
877CONFIG_CRC32=y 1014CONFIG_CRC32=y
1015# CONFIG_CRC7 is not set
878# CONFIG_LIBCRC32C is not set 1016# CONFIG_LIBCRC32C is not set
879CONFIG_ZLIB_INFLATE=y 1017CONFIG_ZLIB_INFLATE=y
1018CONFIG_ZLIB_DEFLATE=y
1019CONFIG_PLIST=y
1020CONFIG_HAS_IOMEM=y
1021CONFIG_HAS_IOPORT=y
1022CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/mx31moboard_defconfig b/arch/arm/configs/mx31moboard_defconfig
new file mode 100644
index 000000000000..e90f86d6deef
--- /dev/null
+++ b/arch/arm/configs/mx31moboard_defconfig
@@ -0,0 +1,790 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.27-rc5
4# Fri Oct 24 11:41:22 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_ARCH_MTD_XIP=y
28CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
29CONFIG_VECTORS_BASE=0xffff0000
30CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
31
32#
33# General setup
34#
35CONFIG_EXPERIMENTAL=y
36CONFIG_BROKEN_ON_SMP=y
37CONFIG_LOCK_KERNEL=y
38CONFIG_INIT_ENV_ARG_LIMIT=32
39CONFIG_LOCALVERSION=""
40CONFIG_LOCALVERSION_AUTO=y
41CONFIG_SWAP=y
42CONFIG_SYSVIPC=y
43CONFIG_SYSVIPC_SYSCTL=y
44# CONFIG_POSIX_MQUEUE is not set
45# CONFIG_BSD_PROCESS_ACCT is not set
46# CONFIG_TASKSTATS is not set
47# CONFIG_AUDIT is not set
48CONFIG_IKCONFIG=y
49CONFIG_IKCONFIG_PROC=y
50CONFIG_LOG_BUF_SHIFT=14
51# CONFIG_CGROUPS is not set
52CONFIG_GROUP_SCHED=y
53CONFIG_FAIR_GROUP_SCHED=y
54# CONFIG_RT_GROUP_SCHED is not set
55CONFIG_USER_SCHED=y
56# CONFIG_CGROUP_SCHED is not set
57CONFIG_SYSFS_DEPRECATED=y
58CONFIG_SYSFS_DEPRECATED_V2=y
59# CONFIG_RELAY is not set
60# CONFIG_NAMESPACES is not set
61# CONFIG_BLK_DEV_INITRD is not set
62CONFIG_CC_OPTIMIZE_FOR_SIZE=y
63CONFIG_SYSCTL=y
64CONFIG_EMBEDDED=y
65CONFIG_UID16=y
66CONFIG_SYSCTL_SYSCALL=y
67CONFIG_KALLSYMS=y
68# CONFIG_KALLSYMS_EXTRA_PASS is not set
69CONFIG_HOTPLUG=y
70CONFIG_PRINTK=y
71CONFIG_BUG=y
72CONFIG_ELF_CORE=y
73CONFIG_COMPAT_BRK=y
74CONFIG_BASE_FULL=y
75CONFIG_FUTEX=y
76CONFIG_ANON_INODES=y
77CONFIG_EPOLL=y
78CONFIG_SIGNALFD=y
79CONFIG_TIMERFD=y
80CONFIG_EVENTFD=y
81CONFIG_SHMEM=y
82CONFIG_VM_EVENT_COUNTERS=y
83CONFIG_SLAB=y
84# CONFIG_SLUB is not set
85# CONFIG_SLOB is not set
86# CONFIG_PROFILING is not set
87# CONFIG_MARKERS is not set
88CONFIG_HAVE_OPROFILE=y
89# CONFIG_KPROBES is not set
90# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
91# CONFIG_HAVE_IOREMAP_PROT is not set
92CONFIG_HAVE_KPROBES=y
93CONFIG_HAVE_KRETPROBES=y
94# CONFIG_HAVE_ARCH_TRACEHOOK is not set
95# CONFIG_HAVE_DMA_ATTRS is not set
96# CONFIG_USE_GENERIC_SMP_HELPERS is not set
97# CONFIG_HAVE_CLK is not set
98CONFIG_PROC_PAGE_MONITOR=y
99CONFIG_HAVE_GENERIC_DMA_COHERENT=y
100CONFIG_SLABINFO=y
101CONFIG_RT_MUTEXES=y
102# CONFIG_TINY_SHMEM is not set
103CONFIG_BASE_SMALL=0
104CONFIG_MODULES=y
105# CONFIG_MODULE_FORCE_LOAD is not set
106CONFIG_MODULE_UNLOAD=y
107CONFIG_MODULE_FORCE_UNLOAD=y
108CONFIG_MODVERSIONS=y
109# CONFIG_MODULE_SRCVERSION_ALL is not set
110CONFIG_KMOD=y
111CONFIG_BLOCK=y
112# CONFIG_LBD is not set
113# CONFIG_BLK_DEV_IO_TRACE is not set
114# CONFIG_LSF is not set
115# CONFIG_BLK_DEV_BSG is not set
116# CONFIG_BLK_DEV_INTEGRITY is not set
117
118#
119# IO Schedulers
120#
121CONFIG_IOSCHED_NOOP=y
122CONFIG_IOSCHED_AS=y
123CONFIG_IOSCHED_DEADLINE=y
124CONFIG_IOSCHED_CFQ=y
125# CONFIG_DEFAULT_AS is not set
126# CONFIG_DEFAULT_DEADLINE is not set
127CONFIG_DEFAULT_CFQ=y
128# CONFIG_DEFAULT_NOOP is not set
129CONFIG_DEFAULT_IOSCHED="cfq"
130CONFIG_CLASSIC_RCU=y
131
132#
133# System Type
134#
135# CONFIG_ARCH_AAEC2000 is not set
136# CONFIG_ARCH_INTEGRATOR is not set
137# CONFIG_ARCH_REALVIEW is not set
138# CONFIG_ARCH_VERSATILE is not set
139# CONFIG_ARCH_AT91 is not set
140# CONFIG_ARCH_CLPS7500 is not set
141# CONFIG_ARCH_CLPS711X is not set
142# CONFIG_ARCH_EBSA110 is not set
143# CONFIG_ARCH_EP93XX is not set
144# CONFIG_ARCH_FOOTBRIDGE is not set
145# CONFIG_ARCH_NETX is not set
146# CONFIG_ARCH_H720X is not set
147# CONFIG_ARCH_IMX is not set
148# CONFIG_ARCH_IOP13XX is not set
149# CONFIG_ARCH_IOP32X is not set
150# CONFIG_ARCH_IOP33X is not set
151# CONFIG_ARCH_IXP23XX is not set
152# CONFIG_ARCH_IXP2000 is not set
153# CONFIG_ARCH_IXP4XX is not set
154# CONFIG_ARCH_L7200 is not set
155# CONFIG_ARCH_KIRKWOOD is not set
156# CONFIG_ARCH_KS8695 is not set
157# CONFIG_ARCH_NS9XXX is not set
158# CONFIG_ARCH_LOKI is not set
159# CONFIG_ARCH_MV78XX0 is not set
160CONFIG_ARCH_MXC=y
161# CONFIG_ARCH_ORION5X is not set
162# CONFIG_ARCH_PNX4008 is not set
163# CONFIG_ARCH_PXA is not set
164# CONFIG_ARCH_RPC is not set
165# CONFIG_ARCH_SA1100 is not set
166# CONFIG_ARCH_S3C2410 is not set
167# CONFIG_ARCH_SHARK is not set
168# CONFIG_ARCH_LH7A40X is not set
169# CONFIG_ARCH_DAVINCI is not set
170# CONFIG_ARCH_OMAP is not set
171# CONFIG_ARCH_MSM7X00A is not set
172
173#
174# Boot options
175#
176
177#
178# Power management
179#
180
181#
182# Freescale MXC Implementations
183#
184# CONFIG_ARCH_MX2 is not set
185CONFIG_ARCH_MX3=y
186
187#
188# MX3 Options
189#
190# CONFIG_MACH_MX31ADS is not set
191# CONFIG_MACH_PCM037 is not set
192# CONFIG_MACH_MX31LITE is not set
193CONFIG_MACH_MX31MOBOARD=y
194# CONFIG_MXC_IRQ_PRIOR is not set
195
196#
197# Processor Type
198#
199CONFIG_CPU_32=y
200CONFIG_CPU_V6=y
201# CONFIG_CPU_32v6K is not set
202CONFIG_CPU_32v6=y
203CONFIG_CPU_ABRT_EV6=y
204CONFIG_CPU_PABRT_NOIFAR=y
205CONFIG_CPU_CACHE_V6=y
206CONFIG_CPU_CACHE_VIPT=y
207CONFIG_CPU_COPY_V6=y
208CONFIG_CPU_TLB_V6=y
209CONFIG_CPU_HAS_ASID=y
210CONFIG_CPU_CP15=y
211CONFIG_CPU_CP15_MMU=y
212
213#
214# Processor Features
215#
216CONFIG_ARM_THUMB=y
217# CONFIG_CPU_ICACHE_DISABLE is not set
218# CONFIG_CPU_DCACHE_DISABLE is not set
219# CONFIG_CPU_BPREDICT_DISABLE is not set
220# CONFIG_OUTER_CACHE is not set
221
222#
223# Bus support
224#
225# CONFIG_PCI_SYSCALL is not set
226# CONFIG_ARCH_SUPPORTS_MSI is not set
227# CONFIG_PCCARD is not set
228
229#
230# Kernel Features
231#
232CONFIG_TICK_ONESHOT=y
233CONFIG_NO_HZ=y
234CONFIG_HIGH_RES_TIMERS=y
235CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
236CONFIG_PREEMPT=y
237CONFIG_HZ=100
238CONFIG_AEABI=y
239# CONFIG_OABI_COMPAT is not set
240CONFIG_ARCH_FLATMEM_HAS_HOLES=y
241# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
242CONFIG_SELECT_MEMORY_MODEL=y
243CONFIG_FLATMEM_MANUAL=y
244# CONFIG_DISCONTIGMEM_MANUAL is not set
245# CONFIG_SPARSEMEM_MANUAL is not set
246CONFIG_FLATMEM=y
247CONFIG_FLAT_NODE_MEM_MAP=y
248# CONFIG_SPARSEMEM_STATIC is not set
249# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
250CONFIG_PAGEFLAGS_EXTENDED=y
251CONFIG_SPLIT_PTLOCK_CPUS=4
252# CONFIG_RESOURCES_64BIT is not set
253CONFIG_ZONE_DMA_FLAG=1
254CONFIG_BOUNCE=y
255CONFIG_VIRT_TO_BUS=y
256CONFIG_ALIGNMENT_TRAP=y
257
258#
259# Boot options
260#
261CONFIG_ZBOOT_ROM_TEXT=0x0
262CONFIG_ZBOOT_ROM_BSS=0x0
263CONFIG_CMDLINE="noinitrd console=ttymxc0,115200 root=/dev/mtdblock2 rw ip=off"
264# CONFIG_XIP_KERNEL is not set
265# CONFIG_KEXEC is not set
266
267#
268# Floating point emulation
269#
270
271#
272# At least one emulation must be selected
273#
274CONFIG_VFP=y
275
276#
277# Userspace binary formats
278#
279CONFIG_BINFMT_ELF=y
280# CONFIG_BINFMT_AOUT is not set
281# CONFIG_BINFMT_MISC is not set
282
283#
284# Power management options
285#
286# CONFIG_PM is not set
287CONFIG_ARCH_SUSPEND_POSSIBLE=y
288CONFIG_NET=y
289
290#
291# Networking options
292#
293CONFIG_PACKET=y
294# CONFIG_PACKET_MMAP is not set
295CONFIG_UNIX=y
296# CONFIG_NET_KEY is not set
297CONFIG_INET=y
298# CONFIG_IP_MULTICAST is not set
299# CONFIG_IP_ADVANCED_ROUTER is not set
300CONFIG_IP_FIB_HASH=y
301CONFIG_IP_PNP=y
302CONFIG_IP_PNP_DHCP=y
303# CONFIG_IP_PNP_BOOTP is not set
304# CONFIG_IP_PNP_RARP is not set
305# CONFIG_NET_IPIP is not set
306# CONFIG_NET_IPGRE is not set
307# CONFIG_ARPD is not set
308# CONFIG_SYN_COOKIES is not set
309# CONFIG_INET_AH is not set
310# CONFIG_INET_ESP is not set
311# CONFIG_INET_IPCOMP is not set
312# CONFIG_INET_XFRM_TUNNEL is not set
313# CONFIG_INET_TUNNEL is not set
314# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
315# CONFIG_INET_XFRM_MODE_TUNNEL is not set
316# CONFIG_INET_XFRM_MODE_BEET is not set
317# CONFIG_INET_LRO is not set
318# CONFIG_INET_DIAG is not set
319# CONFIG_TCP_CONG_ADVANCED is not set
320CONFIG_TCP_CONG_CUBIC=y
321CONFIG_DEFAULT_TCP_CONG="cubic"
322# CONFIG_TCP_MD5SIG is not set
323# CONFIG_IPV6 is not set
324# CONFIG_NETWORK_SECMARK is not set
325# CONFIG_NETFILTER is not set
326# CONFIG_IP_DCCP is not set
327# CONFIG_IP_SCTP is not set
328# CONFIG_TIPC is not set
329# CONFIG_ATM is not set
330# CONFIG_BRIDGE is not set
331# CONFIG_VLAN_8021Q is not set
332# CONFIG_DECNET is not set
333# CONFIG_LLC2 is not set
334# CONFIG_IPX is not set
335# CONFIG_ATALK is not set
336# CONFIG_X25 is not set
337# CONFIG_LAPB is not set
338# CONFIG_ECONET is not set
339# CONFIG_WAN_ROUTER is not set
340# CONFIG_NET_SCHED is not set
341
342#
343# Network testing
344#
345# CONFIG_NET_PKTGEN is not set
346# CONFIG_HAMRADIO is not set
347# CONFIG_CAN is not set
348# CONFIG_IRDA is not set
349# CONFIG_BT is not set
350# CONFIG_AF_RXRPC is not set
351
352#
353# Wireless
354#
355# CONFIG_CFG80211 is not set
356# CONFIG_WIRELESS_EXT is not set
357# CONFIG_MAC80211 is not set
358# CONFIG_IEEE80211 is not set
359# CONFIG_RFKILL is not set
360# CONFIG_NET_9P is not set
361
362#
363# Device Drivers
364#
365
366#
367# Generic Driver Options
368#
369CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
370CONFIG_STANDALONE=y
371CONFIG_PREVENT_FIRMWARE_BUILD=y
372CONFIG_FW_LOADER=m
373CONFIG_FIRMWARE_IN_KERNEL=y
374CONFIG_EXTRA_FIRMWARE=""
375# CONFIG_SYS_HYPERVISOR is not set
376# CONFIG_CONNECTOR is not set
377CONFIG_MTD=y
378# CONFIG_MTD_DEBUG is not set
379# CONFIG_MTD_CONCAT is not set
380CONFIG_MTD_PARTITIONS=y
381CONFIG_MTD_REDBOOT_PARTS=y
382CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
383# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
384CONFIG_MTD_REDBOOT_PARTS_READONLY=y
385# CONFIG_MTD_CMDLINE_PARTS is not set
386# CONFIG_MTD_AFS_PARTS is not set
387# CONFIG_MTD_AR7_PARTS is not set
388
389#
390# User Modules And Translation Layers
391#
392CONFIG_MTD_CHAR=y
393CONFIG_MTD_BLKDEVS=y
394CONFIG_MTD_BLOCK=y
395# CONFIG_FTL is not set
396# CONFIG_NFTL is not set
397# CONFIG_INFTL is not set
398# CONFIG_RFD_FTL is not set
399# CONFIG_SSFDC is not set
400# CONFIG_MTD_OOPS is not set
401
402#
403# RAM/ROM/Flash chip drivers
404#
405CONFIG_MTD_CFI=y
406# CONFIG_MTD_JEDECPROBE is not set
407CONFIG_MTD_GEN_PROBE=y
408CONFIG_MTD_CFI_ADV_OPTIONS=y
409CONFIG_MTD_CFI_NOSWAP=y
410# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
411# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
412CONFIG_MTD_CFI_GEOMETRY=y
413# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
414CONFIG_MTD_MAP_BANK_WIDTH_2=y
415# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
416# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
417# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
418# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
419CONFIG_MTD_CFI_I1=y
420# CONFIG_MTD_CFI_I2 is not set
421# CONFIG_MTD_CFI_I4 is not set
422# CONFIG_MTD_CFI_I8 is not set
423# CONFIG_MTD_OTP is not set
424# CONFIG_MTD_CFI_INTELEXT is not set
425CONFIG_MTD_CFI_AMDSTD=y
426# CONFIG_MTD_CFI_STAA is not set
427CONFIG_MTD_CFI_UTIL=y
428# CONFIG_MTD_RAM is not set
429# CONFIG_MTD_ROM is not set
430# CONFIG_MTD_ABSENT is not set
431# CONFIG_MTD_XIP is not set
432
433#
434# Mapping drivers for chip access
435#
436# CONFIG_MTD_COMPLEX_MAPPINGS is not set
437CONFIG_MTD_PHYSMAP=y
438CONFIG_MTD_PHYSMAP_START=0x0
439CONFIG_MTD_PHYSMAP_LEN=0x0
440CONFIG_MTD_PHYSMAP_BANKWIDTH=2
441# CONFIG_MTD_ARM_INTEGRATOR is not set
442# CONFIG_MTD_PLATRAM is not set
443
444#
445# Self-contained MTD device drivers
446#
447# CONFIG_MTD_SLRAM is not set
448# CONFIG_MTD_PHRAM is not set
449# CONFIG_MTD_MTDRAM is not set
450# CONFIG_MTD_BLOCK2MTD is not set
451
452#
453# Disk-On-Chip Device Drivers
454#
455# CONFIG_MTD_DOC2000 is not set
456# CONFIG_MTD_DOC2001 is not set
457# CONFIG_MTD_DOC2001PLUS is not set
458# CONFIG_MTD_NAND is not set
459# CONFIG_MTD_ONENAND is not set
460
461#
462# UBI - Unsorted block images
463#
464# CONFIG_MTD_UBI is not set
465# CONFIG_PARPORT is not set
466# CONFIG_BLK_DEV is not set
467# CONFIG_MISC_DEVICES is not set
468CONFIG_HAVE_IDE=y
469# CONFIG_IDE is not set
470
471#
472# SCSI device support
473#
474# CONFIG_RAID_ATTRS is not set
475# CONFIG_SCSI is not set
476# CONFIG_SCSI_DMA is not set
477# CONFIG_SCSI_NETLINK is not set
478# CONFIG_ATA is not set
479# CONFIG_MD is not set
480CONFIG_NETDEVICES=y
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
489CONFIG_MII=y
490# CONFIG_AX88796 is not set
491CONFIG_SMC91X=y
492# CONFIG_DM9000 is not set
493# CONFIG_IBM_NEW_EMAC_ZMII is not set
494# CONFIG_IBM_NEW_EMAC_RGMII is not set
495# CONFIG_IBM_NEW_EMAC_TAH is not set
496# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
497# CONFIG_B44 is not set
498# CONFIG_NETDEV_1000 is not set
499# CONFIG_NETDEV_10000 is not set
500
501#
502# Wireless LAN
503#
504# CONFIG_WLAN_PRE80211 is not set
505# CONFIG_WLAN_80211 is not set
506# CONFIG_IWLWIFI_LEDS is not set
507# CONFIG_WAN is not set
508# CONFIG_PPP is not set
509# CONFIG_SLIP is not set
510# CONFIG_NETCONSOLE is not set
511# CONFIG_NETPOLL is not set
512# CONFIG_NET_POLL_CONTROLLER is not set
513# CONFIG_ISDN is not set
514
515#
516# Input device support
517#
518# CONFIG_INPUT is not set
519
520#
521# Hardware I/O ports
522#
523# CONFIG_SERIO is not set
524# CONFIG_GAMEPORT is not set
525
526#
527# Character devices
528#
529# CONFIG_VT is not set
530CONFIG_DEVKMEM=y
531# CONFIG_SERIAL_NONSTANDARD is not set
532
533#
534# Serial drivers
535#
536# CONFIG_SERIAL_8250 is not set
537
538#
539# Non-8250 serial port support
540#
541CONFIG_SERIAL_IMX=y
542CONFIG_SERIAL_IMX_CONSOLE=y
543CONFIG_SERIAL_CORE=y
544CONFIG_SERIAL_CORE_CONSOLE=y
545CONFIG_UNIX98_PTYS=y
546# CONFIG_LEGACY_PTYS is not set
547# CONFIG_IPMI_HANDLER is not set
548# CONFIG_HW_RANDOM is not set
549# CONFIG_NVRAM is not set
550# CONFIG_R3964 is not set
551# CONFIG_RAW_DRIVER is not set
552# CONFIG_TCG_TPM is not set
553# CONFIG_I2C is not set
554# CONFIG_SPI is not set
555CONFIG_ARCH_REQUIRE_GPIOLIB=y
556CONFIG_GPIOLIB=y
557# CONFIG_GPIO_SYSFS is not set
558
559#
560# I2C GPIO expanders:
561#
562
563#
564# PCI GPIO expanders:
565#
566
567#
568# SPI GPIO expanders:
569#
570# CONFIG_W1 is not set
571# CONFIG_POWER_SUPPLY is not set
572# CONFIG_HWMON is not set
573# CONFIG_WATCHDOG is not set
574
575#
576# Sonics Silicon Backplane
577#
578CONFIG_SSB_POSSIBLE=y
579# CONFIG_SSB is not set
580
581#
582# Multifunction device drivers
583#
584# CONFIG_MFD_CORE is not set
585# CONFIG_MFD_SM501 is not set
586# CONFIG_HTC_EGPIO is not set
587# CONFIG_HTC_PASIC3 is not set
588# CONFIG_MFD_TMIO is not set
589# CONFIG_MFD_T7L66XB is not set
590# CONFIG_MFD_TC6387XB is not set
591# CONFIG_MFD_TC6393XB is not set
592
593#
594# Multimedia devices
595#
596
597#
598# Multimedia core support
599#
600# CONFIG_VIDEO_DEV is not set
601# CONFIG_DVB_CORE is not set
602# CONFIG_VIDEO_MEDIA is not set
603
604#
605# Multimedia drivers
606#
607# CONFIG_DAB is not set
608
609#
610# Graphics support
611#
612# CONFIG_VGASTATE is not set
613# CONFIG_VIDEO_OUTPUT_CONTROL is not set
614# CONFIG_FB is not set
615# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
616
617#
618# Display device support
619#
620# CONFIG_DISPLAY_SUPPORT is not set
621# CONFIG_SOUND is not set
622# CONFIG_USB_SUPPORT is not set
623# CONFIG_MMC is not set
624# CONFIG_NEW_LEDS is not set
625CONFIG_RTC_LIB=y
626# CONFIG_RTC_CLASS is not set
627# CONFIG_DMADEVICES is not set
628
629#
630# Voltage and Current regulators
631#
632# CONFIG_REGULATOR is not set
633# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
634# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
635# CONFIG_REGULATOR_BQ24022 is not set
636# CONFIG_UIO is not set
637
638#
639# File systems
640#
641# CONFIG_EXT2_FS is not set
642# CONFIG_EXT3_FS is not set
643# CONFIG_EXT4DEV_FS is not set
644# CONFIG_REISERFS_FS is not set
645# CONFIG_JFS_FS is not set
646# CONFIG_FS_POSIX_ACL is not set
647# CONFIG_XFS_FS is not set
648# CONFIG_OCFS2_FS is not set
649# CONFIG_DNOTIFY is not set
650CONFIG_INOTIFY=y
651CONFIG_INOTIFY_USER=y
652# CONFIG_QUOTA is not set
653# CONFIG_AUTOFS_FS is not set
654# CONFIG_AUTOFS4_FS is not set
655# CONFIG_FUSE_FS is not set
656
657#
658# CD-ROM/DVD Filesystems
659#
660# CONFIG_ISO9660_FS is not set
661# CONFIG_UDF_FS is not set
662
663#
664# DOS/FAT/NT Filesystems
665#
666# CONFIG_MSDOS_FS is not set
667# CONFIG_VFAT_FS is not set
668# CONFIG_NTFS_FS is not set
669
670#
671# Pseudo filesystems
672#
673CONFIG_PROC_FS=y
674CONFIG_PROC_SYSCTL=y
675CONFIG_SYSFS=y
676CONFIG_TMPFS=y
677# CONFIG_TMPFS_POSIX_ACL is not set
678# CONFIG_HUGETLB_PAGE is not set
679# CONFIG_CONFIGFS_FS is not set
680
681#
682# Miscellaneous filesystems
683#
684# CONFIG_ADFS_FS is not set
685# CONFIG_AFFS_FS is not set
686# CONFIG_HFS_FS is not set
687# CONFIG_HFSPLUS_FS is not set
688# CONFIG_BEFS_FS is not set
689# CONFIG_BFS_FS is not set
690# CONFIG_EFS_FS is not set
691CONFIG_JFFS2_FS=y
692CONFIG_JFFS2_FS_DEBUG=0
693CONFIG_JFFS2_FS_WRITEBUFFER=y
694# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
695# CONFIG_JFFS2_SUMMARY is not set
696# CONFIG_JFFS2_FS_XATTR is not set
697# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
698CONFIG_JFFS2_ZLIB=y
699# CONFIG_JFFS2_LZO is not set
700CONFIG_JFFS2_RTIME=y
701# CONFIG_JFFS2_RUBIN is not set
702# CONFIG_CRAMFS is not set
703# CONFIG_VXFS_FS is not set
704# CONFIG_MINIX_FS is not set
705# CONFIG_OMFS_FS is not set
706# CONFIG_HPFS_FS is not set
707# CONFIG_QNX4FS_FS is not set
708# CONFIG_ROMFS_FS is not set
709# CONFIG_SYSV_FS is not set
710# CONFIG_UFS_FS is not set
711CONFIG_NETWORK_FILESYSTEMS=y
712CONFIG_NFS_FS=y
713# CONFIG_NFS_V3 is not set
714# CONFIG_NFS_V4 is not set
715CONFIG_ROOT_NFS=y
716# CONFIG_NFSD is not set
717CONFIG_LOCKD=y
718CONFIG_NFS_COMMON=y
719CONFIG_SUNRPC=y
720# CONFIG_RPCSEC_GSS_KRB5 is not set
721# CONFIG_RPCSEC_GSS_SPKM3 is not set
722# CONFIG_SMB_FS is not set
723# CONFIG_CIFS is not set
724# CONFIG_NCP_FS is not set
725# CONFIG_CODA_FS is not set
726# CONFIG_AFS_FS is not set
727
728#
729# Partition Types
730#
731# CONFIG_PARTITION_ADVANCED is not set
732CONFIG_MSDOS_PARTITION=y
733# CONFIG_NLS is not set
734# CONFIG_DLM is not set
735
736#
737# Kernel hacking
738#
739# CONFIG_PRINTK_TIME is not set
740# CONFIG_ENABLE_WARN_DEPRECATED is not set
741# CONFIG_ENABLE_MUST_CHECK is not set
742CONFIG_FRAME_WARN=1024
743# CONFIG_MAGIC_SYSRQ is not set
744# CONFIG_UNUSED_SYMBOLS is not set
745# CONFIG_DEBUG_FS is not set
746# CONFIG_HEADERS_CHECK is not set
747# CONFIG_DEBUG_KERNEL is not set
748# CONFIG_DEBUG_BUGVERBOSE is not set
749# CONFIG_DEBUG_MEMORY_INIT is not set
750CONFIG_FRAME_POINTER=y
751# CONFIG_LATENCYTOP is not set
752CONFIG_SYSCTL_SYSCALL_CHECK=y
753CONFIG_HAVE_FTRACE=y
754CONFIG_HAVE_DYNAMIC_FTRACE=y
755# CONFIG_FTRACE is not set
756# CONFIG_IRQSOFF_TRACER is not set
757# CONFIG_PREEMPT_TRACER is not set
758# CONFIG_SCHED_TRACER is not set
759# CONFIG_CONTEXT_SWITCH_TRACER is not set
760# CONFIG_SAMPLES is not set
761CONFIG_HAVE_ARCH_KGDB=y
762# CONFIG_DEBUG_USER is not set
763
764#
765# Security options
766#
767# CONFIG_KEYS is not set
768# CONFIG_SECURITY is not set
769# CONFIG_SECURITY_FILE_CAPABILITIES is not set
770# CONFIG_CRYPTO is not set
771
772#
773# Library routines
774#
775CONFIG_BITREVERSE=y
776# CONFIG_GENERIC_FIND_FIRST_BIT is not set
777# CONFIG_GENERIC_FIND_NEXT_BIT is not set
778# CONFIG_CRC_CCITT is not set
779# CONFIG_CRC16 is not set
780# CONFIG_CRC_T10DIF is not set
781# CONFIG_CRC_ITU_T is not set
782CONFIG_CRC32=y
783# CONFIG_CRC7 is not set
784# CONFIG_LIBCRC32C is not set
785CONFIG_ZLIB_INFLATE=y
786CONFIG_ZLIB_DEFLATE=y
787CONFIG_PLIST=y
788CONFIG_HAS_IOMEM=y
789CONFIG_HAS_IOPORT=y
790CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/mx31pdk_defconfig b/arch/arm/configs/mx31pdk_defconfig
new file mode 100644
index 000000000000..95ffc0db95a0
--- /dev/null
+++ b/arch/arm/configs/mx31pdk_defconfig
@@ -0,0 +1,773 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.28-rc2
4# Sun Oct 26 15:55:29 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_MTD_XIP=y
26CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
27CONFIG_VECTORS_BASE=0xffff0000
28CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
29
30#
31# General setup
32#
33# CONFIG_EXPERIMENTAL is not set
34CONFIG_BROKEN_ON_SMP=y
35CONFIG_INIT_ENV_ARG_LIMIT=32
36CONFIG_LOCALVERSION=""
37# CONFIG_LOCALVERSION_AUTO is not set
38# CONFIG_SWAP is not set
39# CONFIG_SYSVIPC is not set
40# CONFIG_BSD_PROCESS_ACCT is not set
41# CONFIG_TASKSTATS is not set
42# CONFIG_AUDIT is not set
43# CONFIG_IKCONFIG is not set
44CONFIG_LOG_BUF_SHIFT=17
45# CONFIG_CGROUPS is not set
46# CONFIG_SYSFS_DEPRECATED_V2 is not set
47# CONFIG_RELAY is not set
48CONFIG_NAMESPACES=y
49# CONFIG_UTS_NS is not set
50# CONFIG_BLK_DEV_INITRD is not set
51# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
52CONFIG_SYSCTL=y
53# CONFIG_EMBEDDED is not set
54CONFIG_UID16=y
55CONFIG_SYSCTL_SYSCALL=y
56CONFIG_KALLSYMS=y
57# CONFIG_KALLSYMS_EXTRA_PASS is not set
58CONFIG_HOTPLUG=y
59CONFIG_PRINTK=y
60CONFIG_BUG=y
61CONFIG_ELF_CORE=y
62# CONFIG_COMPAT_BRK is not set
63CONFIG_BASE_FULL=y
64CONFIG_FUTEX=y
65CONFIG_ANON_INODES=y
66CONFIG_EPOLL=y
67CONFIG_SIGNALFD=y
68CONFIG_TIMERFD=y
69CONFIG_EVENTFD=y
70CONFIG_SHMEM=y
71CONFIG_AIO=y
72CONFIG_VM_EVENT_COUNTERS=y
73CONFIG_SLUB_DEBUG=y
74# CONFIG_SLAB is not set
75CONFIG_SLUB=y
76# CONFIG_SLOB is not set
77# CONFIG_PROFILING is not set
78# CONFIG_MARKERS is not set
79CONFIG_HAVE_OPROFILE=y
80CONFIG_HAVE_KPROBES=y
81CONFIG_HAVE_KRETPROBES=y
82CONFIG_HAVE_GENERIC_DMA_COHERENT=y
83CONFIG_SLABINFO=y
84CONFIG_RT_MUTEXES=y
85# CONFIG_TINY_SHMEM is not set
86CONFIG_BASE_SMALL=0
87# CONFIG_MODULES is not set
88CONFIG_BLOCK=y
89# CONFIG_LBD is not set
90# CONFIG_BLK_DEV_IO_TRACE is not set
91# CONFIG_LSF is not set
92# CONFIG_BLK_DEV_INTEGRITY is not set
93
94#
95# IO Schedulers
96#
97CONFIG_IOSCHED_NOOP=y
98# CONFIG_IOSCHED_AS is not set
99# CONFIG_IOSCHED_DEADLINE is not set
100# CONFIG_IOSCHED_CFQ is not set
101# CONFIG_DEFAULT_AS is not set
102# CONFIG_DEFAULT_DEADLINE is not set
103# CONFIG_DEFAULT_CFQ is not set
104CONFIG_DEFAULT_NOOP=y
105CONFIG_DEFAULT_IOSCHED="noop"
106CONFIG_CLASSIC_RCU=y
107# CONFIG_FREEZER is not set
108
109#
110# System Type
111#
112# CONFIG_ARCH_AAEC2000 is not set
113# CONFIG_ARCH_INTEGRATOR is not set
114# CONFIG_ARCH_REALVIEW is not set
115# CONFIG_ARCH_VERSATILE is not set
116# CONFIG_ARCH_AT91 is not set
117# CONFIG_ARCH_CLPS7500 is not set
118# CONFIG_ARCH_CLPS711X is not set
119# CONFIG_ARCH_EBSA110 is not set
120# CONFIG_ARCH_EP93XX is not set
121# CONFIG_ARCH_FOOTBRIDGE is not set
122# CONFIG_ARCH_NETX is not set
123# CONFIG_ARCH_H720X is not set
124# CONFIG_ARCH_IMX is not set
125# CONFIG_ARCH_IOP13XX is not set
126# CONFIG_ARCH_IOP32X is not set
127# CONFIG_ARCH_IOP33X is not set
128# CONFIG_ARCH_IXP23XX is not set
129# CONFIG_ARCH_IXP2000 is not set
130# CONFIG_ARCH_IXP4XX is not set
131# CONFIG_ARCH_L7200 is not set
132# CONFIG_ARCH_KIRKWOOD is not set
133# CONFIG_ARCH_KS8695 is not set
134# CONFIG_ARCH_NS9XXX is not set
135# CONFIG_ARCH_LOKI is not set
136# CONFIG_ARCH_MV78XX0 is not set
137CONFIG_ARCH_MXC=y
138# CONFIG_ARCH_ORION5X is not set
139# CONFIG_ARCH_PNX4008 is not set
140# CONFIG_ARCH_PXA is not set
141# CONFIG_ARCH_RPC is not set
142# CONFIG_ARCH_SA1100 is not set
143# CONFIG_ARCH_S3C2410 is not set
144# CONFIG_ARCH_SHARK is not set
145# CONFIG_ARCH_LH7A40X is not set
146# CONFIG_ARCH_DAVINCI is not set
147# CONFIG_ARCH_OMAP is not set
148# CONFIG_ARCH_MSM is not set
149
150#
151# Boot options
152#
153
154#
155# Power management
156#
157
158#
159# Freescale MXC Implementations
160#
161# CONFIG_ARCH_MX2 is not set
162CONFIG_ARCH_MX3=y
163
164#
165# MX3 Options
166#
167# CONFIG_MACH_MX31ADS is not set
168# CONFIG_MACH_PCM037 is not set
169# CONFIG_MACH_MX31LITE is not set
170CONFIG_MACH_MX31_3DS=y
171# CONFIG_MXC_IRQ_PRIOR is not set
172
173#
174# Processor Type
175#
176CONFIG_CPU_32=y
177CONFIG_CPU_V6=y
178# CONFIG_CPU_32v6K is not set
179CONFIG_CPU_32v6=y
180CONFIG_CPU_ABRT_EV6=y
181CONFIG_CPU_PABRT_NOIFAR=y
182CONFIG_CPU_CACHE_V6=y
183CONFIG_CPU_CACHE_VIPT=y
184CONFIG_CPU_COPY_V6=y
185CONFIG_CPU_TLB_V6=y
186CONFIG_CPU_HAS_ASID=y
187CONFIG_CPU_CP15=y
188CONFIG_CPU_CP15_MMU=y
189
190#
191# Processor Features
192#
193CONFIG_ARM_THUMB=y
194# CONFIG_CPU_ICACHE_DISABLE is not set
195# CONFIG_CPU_DCACHE_DISABLE is not set
196# CONFIG_CPU_BPREDICT_DISABLE is not set
197# CONFIG_OUTER_CACHE is not set
198
199#
200# Bus support
201#
202# CONFIG_PCI_SYSCALL is not set
203# CONFIG_ARCH_SUPPORTS_MSI is not set
204# CONFIG_PCCARD is not set
205
206#
207# Kernel Features
208#
209# CONFIG_NO_HZ is not set
210# CONFIG_HIGH_RES_TIMERS is not set
211CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
212CONFIG_VMSPLIT_3G=y
213# CONFIG_VMSPLIT_2G is not set
214# CONFIG_VMSPLIT_1G is not set
215CONFIG_PAGE_OFFSET=0xC0000000
216CONFIG_HZ=100
217CONFIG_AEABI=y
218CONFIG_ARCH_FLATMEM_HAS_HOLES=y
219# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
220# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
221CONFIG_FLATMEM=y
222CONFIG_FLAT_NODE_MEM_MAP=y
223CONFIG_PAGEFLAGS_EXTENDED=y
224CONFIG_SPLIT_PTLOCK_CPUS=4
225# CONFIG_RESOURCES_64BIT is not set
226# CONFIG_PHYS_ADDR_T_64BIT is not set
227CONFIG_ZONE_DMA_FLAG=0
228CONFIG_VIRT_TO_BUS=y
229# CONFIG_UNEVICTABLE_LRU is not set
230CONFIG_ALIGNMENT_TRAP=y
231
232#
233# Boot options
234#
235CONFIG_ZBOOT_ROM_TEXT=0
236CONFIG_ZBOOT_ROM_BSS=0
237CONFIG_CMDLINE=""
238# CONFIG_XIP_KERNEL is not set
239
240#
241# CPU Power Management
242#
243# CONFIG_CPU_IDLE is not set
244
245#
246# Floating point emulation
247#
248
249#
250# At least one emulation must be selected
251#
252# CONFIG_VFP is not set
253
254#
255# Userspace binary formats
256#
257CONFIG_BINFMT_ELF=y
258# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
259CONFIG_HAVE_AOUT=y
260# CONFIG_BINFMT_AOUT is not set
261# CONFIG_BINFMT_MISC is not set
262
263#
264# Power management options
265#
266# CONFIG_PM is not set
267CONFIG_ARCH_SUSPEND_POSSIBLE=y
268CONFIG_NET=y
269
270#
271# Networking options
272#
273CONFIG_PACKET=y
274# CONFIG_PACKET_MMAP is not set
275CONFIG_UNIX=y
276CONFIG_XFRM=y
277# CONFIG_XFRM_USER is not set
278CONFIG_NET_KEY=y
279CONFIG_INET=y
280# CONFIG_IP_MULTICAST is not set
281# CONFIG_IP_ADVANCED_ROUTER is not set
282CONFIG_IP_FIB_HASH=y
283CONFIG_IP_PNP=y
284CONFIG_IP_PNP_DHCP=y
285# CONFIG_IP_PNP_BOOTP is not set
286# CONFIG_IP_PNP_RARP is not set
287# CONFIG_NET_IPIP is not set
288# CONFIG_NET_IPGRE is not set
289# CONFIG_SYN_COOKIES is not set
290# CONFIG_INET_AH is not set
291# CONFIG_INET_ESP is not set
292# CONFIG_INET_IPCOMP is not set
293# CONFIG_INET_XFRM_TUNNEL is not set
294CONFIG_INET_TUNNEL=y
295CONFIG_INET_XFRM_MODE_TRANSPORT=y
296CONFIG_INET_XFRM_MODE_TUNNEL=y
297CONFIG_INET_XFRM_MODE_BEET=y
298# CONFIG_INET_LRO is not set
299CONFIG_INET_DIAG=y
300CONFIG_INET_TCP_DIAG=y
301# CONFIG_TCP_CONG_ADVANCED is not set
302CONFIG_TCP_CONG_CUBIC=y
303CONFIG_DEFAULT_TCP_CONG="cubic"
304CONFIG_IPV6=y
305# CONFIG_IPV6_PRIVACY is not set
306# CONFIG_IPV6_ROUTER_PREF is not set
307# CONFIG_INET6_AH is not set
308# CONFIG_INET6_ESP is not set
309# CONFIG_INET6_IPCOMP is not set
310# CONFIG_INET6_XFRM_TUNNEL is not set
311# CONFIG_INET6_TUNNEL is not set
312CONFIG_INET6_XFRM_MODE_TRANSPORT=y
313CONFIG_INET6_XFRM_MODE_TUNNEL=y
314CONFIG_INET6_XFRM_MODE_BEET=y
315CONFIG_IPV6_SIT=y
316CONFIG_IPV6_NDISC_NODETYPE=y
317# CONFIG_IPV6_TUNNEL is not set
318# CONFIG_NETWORK_SECMARK is not set
319# CONFIG_NETFILTER is not set
320# CONFIG_ATM is not set
321# CONFIG_BRIDGE is not set
322# CONFIG_VLAN_8021Q is not set
323# CONFIG_DECNET is not set
324# CONFIG_LLC2 is not set
325# CONFIG_IPX is not set
326# CONFIG_ATALK is not set
327# CONFIG_NET_SCHED is not set
328
329#
330# Network testing
331#
332# CONFIG_NET_PKTGEN is not set
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_PHONET is not set
338CONFIG_WIRELESS=y
339# CONFIG_CFG80211 is not set
340CONFIG_WIRELESS_OLD_REGULATORY=y
341# CONFIG_WIRELESS_EXT is not set
342# CONFIG_MAC80211 is not set
343# CONFIG_IEEE80211 is not set
344# CONFIG_RFKILL is not set
345
346#
347# Device Drivers
348#
349
350#
351# Generic Driver Options
352#
353CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
354CONFIG_STANDALONE=y
355# CONFIG_PREVENT_FIRMWARE_BUILD is not set
356CONFIG_FW_LOADER=y
357# CONFIG_FIRMWARE_IN_KERNEL is not set
358CONFIG_EXTRA_FIRMWARE=""
359# CONFIG_SYS_HYPERVISOR is not set
360# CONFIG_CONNECTOR is not set
361# CONFIG_MTD is not set
362# CONFIG_PARPORT is not set
363# CONFIG_BLK_DEV is not set
364# CONFIG_MISC_DEVICES is not set
365CONFIG_HAVE_IDE=y
366# CONFIG_IDE is not set
367
368#
369# SCSI device support
370#
371# CONFIG_RAID_ATTRS is not set
372# CONFIG_SCSI is not set
373# CONFIG_SCSI_DMA is not set
374# CONFIG_SCSI_NETLINK is not set
375# CONFIG_ATA is not set
376# CONFIG_MD is not set
377CONFIG_NETDEVICES=y
378# CONFIG_DUMMY is not set
379# CONFIG_BONDING is not set
380# CONFIG_EQUALIZER is not set
381# CONFIG_TUN is not set
382# CONFIG_VETH is not set
383# CONFIG_PHYLIB is not set
384CONFIG_NET_ETHERNET=y
385# CONFIG_MII is not set
386# CONFIG_AX88796 is not set
387# CONFIG_SMC91X is not set
388# CONFIG_DM9000 is not set
389# CONFIG_SMC911X is not set
390# CONFIG_IBM_NEW_EMAC_ZMII is not set
391# CONFIG_IBM_NEW_EMAC_RGMII is not set
392# CONFIG_IBM_NEW_EMAC_TAH is not set
393# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
394# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
395# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
396# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
397# CONFIG_B44 is not set
398CONFIG_NETDEV_1000=y
399CONFIG_NETDEV_10000=y
400
401#
402# Wireless LAN
403#
404# CONFIG_WLAN_PRE80211 is not set
405# CONFIG_WLAN_80211 is not set
406# CONFIG_IWLWIFI_LEDS is not set
407# CONFIG_WAN is not set
408# CONFIG_PPP is not set
409# CONFIG_SLIP is not set
410# CONFIG_NETPOLL is not set
411# CONFIG_NET_POLL_CONTROLLER is not set
412# CONFIG_ISDN is not set
413
414#
415# Input device support
416#
417CONFIG_INPUT=y
418# CONFIG_INPUT_FF_MEMLESS is not set
419# CONFIG_INPUT_POLLDEV is not set
420
421#
422# Userland interfaces
423#
424CONFIG_INPUT_MOUSEDEV=y
425# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
426CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
427CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
428# CONFIG_INPUT_JOYDEV is not set
429# CONFIG_INPUT_EVDEV is not set
430# CONFIG_INPUT_EVBUG is not set
431
432#
433# Input Device Drivers
434#
435# CONFIG_INPUT_KEYBOARD is not set
436# CONFIG_INPUT_MOUSE is not set
437# CONFIG_INPUT_JOYSTICK is not set
438# CONFIG_INPUT_TABLET is not set
439# CONFIG_INPUT_TOUCHSCREEN is not set
440# CONFIG_INPUT_MISC is not set
441
442#
443# Hardware I/O ports
444#
445# CONFIG_SERIO is not set
446# CONFIG_GAMEPORT is not set
447
448#
449# Character devices
450#
451CONFIG_VT=y
452CONFIG_CONSOLE_TRANSLATIONS=y
453CONFIG_VT_CONSOLE=y
454CONFIG_HW_CONSOLE=y
455# CONFIG_VT_HW_CONSOLE_BINDING is not set
456# CONFIG_DEVKMEM is not set
457# CONFIG_SERIAL_NONSTANDARD is not set
458
459#
460# Serial drivers
461#
462# CONFIG_SERIAL_8250 is not set
463
464#
465# Non-8250 serial port support
466#
467CONFIG_SERIAL_IMX=y
468CONFIG_SERIAL_IMX_CONSOLE=y
469CONFIG_SERIAL_CORE=y
470CONFIG_SERIAL_CORE_CONSOLE=y
471CONFIG_UNIX98_PTYS=y
472# CONFIG_LEGACY_PTYS is not set
473# CONFIG_IPMI_HANDLER is not set
474# CONFIG_HW_RANDOM is not set
475# CONFIG_NVRAM is not set
476# CONFIG_R3964 is not set
477# CONFIG_RAW_DRIVER is not set
478# CONFIG_I2C is not set
479# CONFIG_SPI is not set
480CONFIG_ARCH_REQUIRE_GPIOLIB=y
481CONFIG_GPIOLIB=y
482
483#
484# I2C GPIO expanders:
485#
486
487#
488# PCI GPIO expanders:
489#
490
491#
492# SPI GPIO expanders:
493#
494# CONFIG_W1 is not set
495# CONFIG_POWER_SUPPLY is not set
496# CONFIG_HWMON is not set
497# CONFIG_THERMAL is not set
498# CONFIG_THERMAL_HWMON is not set
499# CONFIG_WATCHDOG is not set
500
501#
502# Sonics Silicon Backplane
503#
504CONFIG_SSB_POSSIBLE=y
505# CONFIG_SSB is not set
506
507#
508# Multifunction device drivers
509#
510# CONFIG_MFD_CORE is not set
511# CONFIG_MFD_SM501 is not set
512# CONFIG_MFD_ASIC3 is not set
513# CONFIG_HTC_EGPIO is not set
514# CONFIG_HTC_PASIC3 is not set
515# CONFIG_MFD_TMIO is not set
516# CONFIG_MFD_T7L66XB is not set
517# CONFIG_MFD_TC6387XB is not set
518# CONFIG_MFD_TC6393XB is not set
519# CONFIG_MFD_WM8400 is not set
520
521#
522# Multimedia devices
523#
524
525#
526# Multimedia core support
527#
528# CONFIG_VIDEO_DEV is not set
529# CONFIG_DVB_CORE is not set
530# CONFIG_VIDEO_MEDIA is not set
531
532#
533# Multimedia drivers
534#
535# CONFIG_DAB is not set
536
537#
538# Graphics support
539#
540# CONFIG_VGASTATE is not set
541# CONFIG_VIDEO_OUTPUT_CONTROL is not set
542# CONFIG_FB is not set
543# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
544
545#
546# Display device support
547#
548# CONFIG_DISPLAY_SUPPORT is not set
549
550#
551# Console display driver support
552#
553# CONFIG_VGA_CONSOLE is not set
554CONFIG_DUMMY_CONSOLE=y
555# CONFIG_SOUND is not set
556# CONFIG_HID_SUPPORT is not set
557# CONFIG_USB_SUPPORT is not set
558# CONFIG_MMC is not set
559# CONFIG_MEMSTICK is not set
560# CONFIG_ACCESSIBILITY is not set
561# CONFIG_NEW_LEDS is not set
562CONFIG_RTC_LIB=y
563# CONFIG_RTC_CLASS is not set
564# CONFIG_DMADEVICES is not set
565
566#
567# Voltage and Current regulators
568#
569# CONFIG_REGULATOR is not set
570# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
571# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
572# CONFIG_REGULATOR_BQ24022 is not set
573# CONFIG_UIO is not set
574
575#
576# File systems
577#
578# CONFIG_EXT2_FS is not set
579# CONFIG_EXT3_FS is not set
580# CONFIG_EXT4_FS is not set
581# CONFIG_REISERFS_FS is not set
582# CONFIG_JFS_FS is not set
583# CONFIG_FS_POSIX_ACL is not set
584CONFIG_FILE_LOCKING=y
585# CONFIG_XFS_FS is not set
586# CONFIG_OCFS2_FS is not set
587# CONFIG_DNOTIFY is not set
588# CONFIG_INOTIFY is not set
589# CONFIG_QUOTA is not set
590# CONFIG_AUTOFS_FS is not set
591# CONFIG_AUTOFS4_FS is not set
592# CONFIG_FUSE_FS is not set
593
594#
595# CD-ROM/DVD Filesystems
596#
597# CONFIG_ISO9660_FS is not set
598# CONFIG_UDF_FS is not set
599
600#
601# DOS/FAT/NT Filesystems
602#
603# CONFIG_MSDOS_FS is not set
604# CONFIG_VFAT_FS is not set
605# CONFIG_NTFS_FS is not set
606
607#
608# Pseudo filesystems
609#
610CONFIG_PROC_FS=y
611CONFIG_PROC_SYSCTL=y
612CONFIG_PROC_PAGE_MONITOR=y
613CONFIG_SYSFS=y
614# CONFIG_TMPFS is not set
615# CONFIG_HUGETLB_PAGE is not set
616# CONFIG_CONFIGFS_FS is not set
617
618#
619# Miscellaneous filesystems
620#
621# CONFIG_HFSPLUS_FS is not set
622# CONFIG_CRAMFS is not set
623# CONFIG_VXFS_FS is not set
624# CONFIG_MINIX_FS is not set
625# CONFIG_OMFS_FS is not set
626# CONFIG_HPFS_FS is not set
627# CONFIG_QNX4FS_FS is not set
628# CONFIG_ROMFS_FS is not set
629# CONFIG_SYSV_FS is not set
630# CONFIG_UFS_FS is not set
631CONFIG_NETWORK_FILESYSTEMS=y
632# CONFIG_NFS_FS is not set
633# CONFIG_NFSD is not set
634# CONFIG_SMB_FS is not set
635# CONFIG_CIFS is not set
636# CONFIG_NCP_FS is not set
637# CONFIG_CODA_FS is not set
638
639#
640# Partition Types
641#
642# CONFIG_PARTITION_ADVANCED is not set
643CONFIG_MSDOS_PARTITION=y
644# CONFIG_NLS is not set
645
646#
647# Kernel hacking
648#
649# CONFIG_PRINTK_TIME is not set
650# CONFIG_ENABLE_WARN_DEPRECATED is not set
651# CONFIG_ENABLE_MUST_CHECK is not set
652CONFIG_FRAME_WARN=1024
653# CONFIG_MAGIC_SYSRQ is not set
654# CONFIG_UNUSED_SYMBOLS is not set
655# CONFIG_DEBUG_FS is not set
656# CONFIG_HEADERS_CHECK is not set
657# CONFIG_DEBUG_KERNEL is not set
658# CONFIG_SLUB_DEBUG_ON is not set
659# CONFIG_SLUB_STATS is not set
660CONFIG_DEBUG_BUGVERBOSE=y
661CONFIG_DEBUG_MEMORY_INIT=y
662CONFIG_FRAME_POINTER=y
663# CONFIG_RCU_CPU_STALL_DETECTOR is not set
664# CONFIG_LATENCYTOP is not set
665# CONFIG_SYSCTL_SYSCALL_CHECK is not set
666CONFIG_NOP_TRACER=y
667CONFIG_HAVE_FTRACE=y
668CONFIG_HAVE_DYNAMIC_FTRACE=y
669# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
670# CONFIG_SAMPLES is not set
671CONFIG_HAVE_ARCH_KGDB=y
672# CONFIG_DEBUG_USER is not set
673
674#
675# Security options
676#
677# CONFIG_KEYS is not set
678# CONFIG_SECURITY is not set
679# CONFIG_SECURITYFS is not set
680# CONFIG_SECURITY_FILE_CAPABILITIES is not set
681CONFIG_CRYPTO=y
682
683#
684# Crypto core or helper
685#
686# CONFIG_CRYPTO_FIPS is not set
687# CONFIG_CRYPTO_MANAGER is not set
688# CONFIG_CRYPTO_NULL is not set
689# CONFIG_CRYPTO_CRYPTD is not set
690# CONFIG_CRYPTO_AUTHENC is not set
691
692#
693# Authenticated Encryption with Associated Data
694#
695# CONFIG_CRYPTO_CCM is not set
696# CONFIG_CRYPTO_GCM is not set
697# CONFIG_CRYPTO_SEQIV is not set
698
699#
700# Block modes
701#
702# CONFIG_CRYPTO_CBC is not set
703# CONFIG_CRYPTO_CTR is not set
704# CONFIG_CRYPTO_CTS is not set
705# CONFIG_CRYPTO_ECB is not set
706# CONFIG_CRYPTO_PCBC is not set
707
708#
709# Hash modes
710#
711# CONFIG_CRYPTO_HMAC is not set
712
713#
714# Digest
715#
716# CONFIG_CRYPTO_CRC32C is not set
717# CONFIG_CRYPTO_MD4 is not set
718# CONFIG_CRYPTO_MD5 is not set
719# CONFIG_CRYPTO_MICHAEL_MIC is not set
720# CONFIG_CRYPTO_RMD128 is not set
721# CONFIG_CRYPTO_RMD160 is not set
722# CONFIG_CRYPTO_RMD256 is not set
723# CONFIG_CRYPTO_RMD320 is not set
724# CONFIG_CRYPTO_SHA1 is not set
725# CONFIG_CRYPTO_SHA256 is not set
726# CONFIG_CRYPTO_SHA512 is not set
727# CONFIG_CRYPTO_TGR192 is not set
728# CONFIG_CRYPTO_WP512 is not set
729
730#
731# Ciphers
732#
733# CONFIG_CRYPTO_AES is not set
734# CONFIG_CRYPTO_ANUBIS is not set
735# CONFIG_CRYPTO_ARC4 is not set
736# CONFIG_CRYPTO_BLOWFISH is not set
737# CONFIG_CRYPTO_CAMELLIA is not set
738# CONFIG_CRYPTO_CAST5 is not set
739# CONFIG_CRYPTO_CAST6 is not set
740# CONFIG_CRYPTO_DES is not set
741# CONFIG_CRYPTO_FCRYPT is not set
742# CONFIG_CRYPTO_KHAZAD is not set
743# CONFIG_CRYPTO_SEED is not set
744# CONFIG_CRYPTO_SERPENT is not set
745# CONFIG_CRYPTO_TEA is not set
746# CONFIG_CRYPTO_TWOFISH is not set
747
748#
749# Compression
750#
751# CONFIG_CRYPTO_DEFLATE is not set
752# CONFIG_CRYPTO_LZO is not set
753
754#
755# Random Number Generation
756#
757# CONFIG_CRYPTO_ANSI_CPRNG is not set
758CONFIG_CRYPTO_HW=y
759
760#
761# Library routines
762#
763# CONFIG_CRC_CCITT is not set
764# CONFIG_CRC16 is not set
765# CONFIG_CRC_T10DIF is not set
766# CONFIG_CRC_ITU_T is not set
767# CONFIG_CRC32 is not set
768# CONFIG_CRC7 is not set
769# CONFIG_LIBCRC32C is not set
770CONFIG_PLIST=y
771CONFIG_HAS_IOMEM=y
772CONFIG_HAS_IOPORT=y
773CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/neocore926_defconfig b/arch/arm/configs/neocore926_defconfig
new file mode 100644
index 000000000000..325f1e105f69
--- /dev/null
+++ b/arch/arm/configs/neocore926_defconfig
@@ -0,0 +1,1302 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.27-rc1
4# Tue Jul 29 10:46:54 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_GENERIC_HARDIRQS_NO__DO_IRQ=y
28CONFIG_VECTORS_BASE=0xffff0000
29CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
30
31#
32# General setup
33#
34CONFIG_EXPERIMENTAL=y
35CONFIG_BROKEN_ON_SMP=y
36CONFIG_INIT_ENV_ARG_LIMIT=32
37CONFIG_LOCALVERSION=""
38# CONFIG_LOCALVERSION_AUTO is not set
39# CONFIG_SWAP is not set
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=17
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
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
57CONFIG_BLK_DEV_INITRD=y
58CONFIG_INITRAMFS_SOURCE=""
59CONFIG_CC_OPTIMIZE_FOR_SIZE=y
60CONFIG_SYSCTL=y
61# CONFIG_EMBEDDED is not set
62CONFIG_UID16=y
63CONFIG_SYSCTL_SYSCALL=y
64CONFIG_SYSCTL_SYSCALL_CHECK=y
65CONFIG_KALLSYMS=y
66# CONFIG_KALLSYMS_EXTRA_PASS is not set
67CONFIG_HOTPLUG=y
68CONFIG_PRINTK=y
69CONFIG_BUG=y
70CONFIG_ELF_CORE=y
71# CONFIG_COMPAT_BRK is not set
72CONFIG_BASE_FULL=y
73CONFIG_FUTEX=y
74CONFIG_ANON_INODES=y
75CONFIG_EPOLL=y
76CONFIG_SIGNALFD=y
77CONFIG_TIMERFD=y
78CONFIG_EVENTFD=y
79CONFIG_SHMEM=y
80CONFIG_VM_EVENT_COUNTERS=y
81CONFIG_SLUB_DEBUG=y
82# CONFIG_SLAB is not set
83CONFIG_SLUB=y
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
89# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
90# CONFIG_HAVE_IOREMAP_PROT is not set
91CONFIG_HAVE_KPROBES=y
92CONFIG_HAVE_KRETPROBES=y
93# CONFIG_HAVE_ARCH_TRACEHOOK is not set
94# CONFIG_HAVE_DMA_ATTRS is not set
95# CONFIG_USE_GENERIC_SMP_HELPERS is not set
96CONFIG_HAVE_CLK=y
97CONFIG_PROC_PAGE_MONITOR=y
98CONFIG_HAVE_GENERIC_DMA_COHERENT=y
99CONFIG_SLABINFO=y
100CONFIG_RT_MUTEXES=y
101# CONFIG_TINY_SHMEM is not set
102CONFIG_BASE_SMALL=0
103CONFIG_MODULES=y
104# CONFIG_MODULE_FORCE_LOAD is not set
105CONFIG_MODULE_UNLOAD=y
106# CONFIG_MODULE_FORCE_UNLOAD is not set
107# CONFIG_MODVERSIONS is not set
108# CONFIG_MODULE_SRCVERSION_ALL is not set
109CONFIG_KMOD=y
110CONFIG_BLOCK=y
111# CONFIG_LBD is not set
112# CONFIG_BLK_DEV_IO_TRACE is not set
113# CONFIG_LSF is not set
114# CONFIG_BLK_DEV_BSG is not set
115# CONFIG_BLK_DEV_INTEGRITY is not set
116
117#
118# IO Schedulers
119#
120CONFIG_IOSCHED_NOOP=y
121# CONFIG_IOSCHED_AS is not set
122# CONFIG_IOSCHED_DEADLINE is not set
123# CONFIG_IOSCHED_CFQ is not set
124# CONFIG_DEFAULT_AS is not set
125# CONFIG_DEFAULT_DEADLINE is not set
126# CONFIG_DEFAULT_CFQ is not set
127CONFIG_DEFAULT_NOOP=y
128CONFIG_DEFAULT_IOSCHED="noop"
129CONFIG_CLASSIC_RCU=y
130
131#
132# System Type
133#
134# CONFIG_ARCH_AAEC2000 is not set
135# CONFIG_ARCH_INTEGRATOR is not set
136# CONFIG_ARCH_REALVIEW is not set
137# CONFIG_ARCH_VERSATILE is not set
138CONFIG_ARCH_AT91=y
139# CONFIG_ARCH_CLPS7500 is not set
140# CONFIG_ARCH_CLPS711X is not set
141# CONFIG_ARCH_EBSA110 is not set
142# CONFIG_ARCH_EP93XX is not set
143# CONFIG_ARCH_FOOTBRIDGE is not set
144# CONFIG_ARCH_NETX is not set
145# CONFIG_ARCH_H720X is not set
146# CONFIG_ARCH_IMX is not set
147# CONFIG_ARCH_IOP13XX is not set
148# CONFIG_ARCH_IOP32X is not set
149# CONFIG_ARCH_IOP33X is not set
150# CONFIG_ARCH_IXP23XX is not set
151# CONFIG_ARCH_IXP2000 is not set
152# CONFIG_ARCH_IXP4XX is not set
153# CONFIG_ARCH_L7200 is not set
154# CONFIG_ARCH_KIRKWOOD is not set
155# CONFIG_ARCH_KS8695 is not set
156# CONFIG_ARCH_NS9XXX is not set
157# CONFIG_ARCH_LOKI is not set
158# CONFIG_ARCH_MV78XX0 is not set
159# CONFIG_ARCH_MXC is not set
160# CONFIG_ARCH_ORION5X is not set
161# CONFIG_ARCH_PNX4008 is not set
162# CONFIG_ARCH_PXA is not set
163# CONFIG_ARCH_RPC is not set
164# CONFIG_ARCH_SA1100 is not set
165# CONFIG_ARCH_S3C2410 is not set
166# CONFIG_ARCH_SHARK is not set
167# CONFIG_ARCH_LH7A40X is not set
168# CONFIG_ARCH_DAVINCI is not set
169# CONFIG_ARCH_OMAP is not set
170# CONFIG_ARCH_MSM7X00A is not set
171
172#
173# Boot options
174#
175
176#
177# Power management
178#
179
180#
181# Atmel AT91 System-on-Chip
182#
183# CONFIG_ARCH_AT91RM9200 is not set
184# CONFIG_ARCH_AT91SAM9260 is not set
185# CONFIG_ARCH_AT91SAM9261 is not set
186CONFIG_ARCH_AT91SAM9263=y
187# CONFIG_ARCH_AT91SAM9RL is not set
188# CONFIG_ARCH_AT91SAM9G20 is not set
189# CONFIG_ARCH_AT91CAP9 is not set
190# CONFIG_ARCH_AT91X40 is not set
191CONFIG_AT91_PMC_UNIT=y
192
193#
194# AT91SAM9263 Board Type
195#
196# CONFIG_MACH_AT91SAM9263EK is not set
197# CONFIG_MACH_USB_A9263 is not set
198CONFIG_MACH_NEOCORE926=y
199
200#
201# AT91 Board Options
202#
203CONFIG_MTD_AT91_DATAFLASH_CARD=y
204
205#
206# AT91 Feature Selections
207#
208# CONFIG_AT91_PROGRAMMABLE_CLOCKS is not set
209CONFIG_AT91_TIMER_HZ=100
210CONFIG_AT91_EARLY_DBGU=y
211# CONFIG_AT91_EARLY_USART0 is not set
212# CONFIG_AT91_EARLY_USART1 is not set
213# CONFIG_AT91_EARLY_USART2 is not set
214# CONFIG_AT91_EARLY_USART3 is not set
215# CONFIG_AT91_EARLY_USART4 is not set
216# CONFIG_AT91_EARLY_USART5 is not set
217
218#
219# Processor Type
220#
221CONFIG_CPU_32=y
222CONFIG_CPU_ARM926T=y
223CONFIG_CPU_32v5=y
224CONFIG_CPU_ABRT_EV5TJ=y
225CONFIG_CPU_PABRT_NOIFAR=y
226CONFIG_CPU_CACHE_VIVT=y
227CONFIG_CPU_COPY_V4WB=y
228CONFIG_CPU_TLB_V4WBI=y
229CONFIG_CPU_CP15=y
230CONFIG_CPU_CP15_MMU=y
231
232#
233# Processor Features
234#
235CONFIG_ARM_THUMB=y
236# CONFIG_CPU_ICACHE_DISABLE is not set
237# CONFIG_CPU_DCACHE_DISABLE is not set
238# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
239# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
240# CONFIG_OUTER_CACHE is not set
241
242#
243# Bus support
244#
245# CONFIG_PCI_SYSCALL is not set
246# CONFIG_ARCH_SUPPORTS_MSI is not set
247# CONFIG_PCCARD is not set
248
249#
250# Kernel Features
251#
252# CONFIG_TICK_ONESHOT is not set
253# CONFIG_NO_HZ is not set
254# CONFIG_HIGH_RES_TIMERS is not set
255CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
256# CONFIG_PREEMPT is not set
257CONFIG_HZ=100
258# CONFIG_AEABI is not set
259# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
260CONFIG_SELECT_MEMORY_MODEL=y
261CONFIG_FLATMEM_MANUAL=y
262# CONFIG_DISCONTIGMEM_MANUAL is not set
263# CONFIG_SPARSEMEM_MANUAL is not set
264CONFIG_FLATMEM=y
265CONFIG_FLAT_NODE_MEM_MAP=y
266# CONFIG_SPARSEMEM_STATIC is not set
267# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
268CONFIG_PAGEFLAGS_EXTENDED=y
269CONFIG_SPLIT_PTLOCK_CPUS=4096
270# CONFIG_RESOURCES_64BIT is not set
271CONFIG_ZONE_DMA_FLAG=1
272CONFIG_BOUNCE=y
273CONFIG_VIRT_TO_BUS=y
274# CONFIG_LEDS is not set
275CONFIG_ALIGNMENT_TRAP=y
276
277#
278# Boot options
279#
280CONFIG_ZBOOT_ROM_TEXT=0x0
281CONFIG_ZBOOT_ROM_BSS=0x0
282CONFIG_CMDLINE=""
283# CONFIG_XIP_KERNEL is not set
284# CONFIG_KEXEC is not set
285
286#
287# Floating point emulation
288#
289
290#
291# At least one emulation must be selected
292#
293CONFIG_FPE_NWFPE=y
294# CONFIG_FPE_NWFPE_XP is not set
295# CONFIG_FPE_FASTFPE is not set
296# CONFIG_VFP is not set
297
298#
299# Userspace binary formats
300#
301CONFIG_BINFMT_ELF=y
302# CONFIG_BINFMT_AOUT is not set
303# CONFIG_BINFMT_MISC is not set
304# CONFIG_ARTHUR is not set
305
306#
307# Power management options
308#
309# CONFIG_PM is not set
310CONFIG_ARCH_SUSPEND_POSSIBLE=y
311
312#
313# Networking
314#
315CONFIG_NET=y
316
317#
318# Networking options
319#
320CONFIG_PACKET=y
321# CONFIG_PACKET_MMAP is not set
322CONFIG_UNIX=y
323CONFIG_XFRM=y
324# CONFIG_XFRM_USER is not set
325# CONFIG_XFRM_SUB_POLICY is not set
326# CONFIG_XFRM_MIGRATE is not set
327# CONFIG_XFRM_STATISTICS is not set
328CONFIG_NET_KEY=y
329# CONFIG_NET_KEY_MIGRATE is not set
330CONFIG_INET=y
331# CONFIG_IP_MULTICAST is not set
332# CONFIG_IP_ADVANCED_ROUTER is not set
333CONFIG_IP_FIB_HASH=y
334CONFIG_IP_PNP=y
335CONFIG_IP_PNP_DHCP=y
336CONFIG_IP_PNP_BOOTP=y
337CONFIG_IP_PNP_RARP=y
338CONFIG_NET_IPIP=y
339# CONFIG_NET_IPGRE is not set
340# CONFIG_ARPD is not set
341# CONFIG_SYN_COOKIES is not set
342# CONFIG_INET_AH is not set
343# CONFIG_INET_ESP is not set
344# CONFIG_INET_IPCOMP is not set
345# CONFIG_INET_XFRM_TUNNEL is not set
346CONFIG_INET_TUNNEL=y
347CONFIG_INET_XFRM_MODE_TRANSPORT=y
348CONFIG_INET_XFRM_MODE_TUNNEL=y
349CONFIG_INET_XFRM_MODE_BEET=y
350# CONFIG_INET_LRO is not set
351CONFIG_INET_DIAG=y
352CONFIG_INET_TCP_DIAG=y
353# CONFIG_TCP_CONG_ADVANCED is not set
354CONFIG_TCP_CONG_CUBIC=y
355CONFIG_DEFAULT_TCP_CONG="cubic"
356# CONFIG_TCP_MD5SIG is not set
357CONFIG_IPV6=y
358# CONFIG_IPV6_PRIVACY is not set
359# CONFIG_IPV6_ROUTER_PREF is not set
360# CONFIG_IPV6_OPTIMISTIC_DAD is not set
361# CONFIG_INET6_AH is not set
362# CONFIG_INET6_ESP is not set
363# CONFIG_INET6_IPCOMP is not set
364# CONFIG_IPV6_MIP6 is not set
365# CONFIG_INET6_XFRM_TUNNEL is not set
366# CONFIG_INET6_TUNNEL is not set
367CONFIG_INET6_XFRM_MODE_TRANSPORT=y
368CONFIG_INET6_XFRM_MODE_TUNNEL=y
369CONFIG_INET6_XFRM_MODE_BEET=y
370# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
371CONFIG_IPV6_SIT=y
372CONFIG_IPV6_NDISC_NODETYPE=y
373# CONFIG_IPV6_TUNNEL is not set
374# CONFIG_IPV6_MULTIPLE_TABLES is not set
375# CONFIG_IPV6_MROUTE is not set
376# CONFIG_NETWORK_SECMARK is not set
377# CONFIG_NETFILTER is not set
378# CONFIG_IP_DCCP is not set
379# CONFIG_IP_SCTP is not set
380# CONFIG_TIPC is not set
381# CONFIG_ATM is not set
382# CONFIG_BRIDGE is not set
383# CONFIG_VLAN_8021Q is not set
384# CONFIG_DECNET is not set
385# CONFIG_LLC2 is not set
386# CONFIG_IPX is not set
387# CONFIG_ATALK is not set
388# CONFIG_X25 is not set
389# CONFIG_LAPB is not set
390# CONFIG_ECONET is not set
391# CONFIG_WAN_ROUTER is not set
392# CONFIG_NET_SCHED is not set
393
394#
395# Network testing
396#
397# CONFIG_NET_PKTGEN is not set
398# CONFIG_HAMRADIO is not set
399# CONFIG_CAN is not set
400# CONFIG_IRDA is not set
401# CONFIG_BT is not set
402# CONFIG_AF_RXRPC is not set
403
404#
405# Wireless
406#
407# CONFIG_CFG80211 is not set
408# CONFIG_WIRELESS_EXT is not set
409# CONFIG_MAC80211 is not set
410# CONFIG_IEEE80211 is not set
411# CONFIG_RFKILL is not set
412# CONFIG_NET_9P is not set
413
414#
415# Device Drivers
416#
417
418#
419# Generic Driver Options
420#
421CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
422CONFIG_STANDALONE=y
423# CONFIG_PREVENT_FIRMWARE_BUILD is not set
424CONFIG_FW_LOADER=y
425CONFIG_FIRMWARE_IN_KERNEL=y
426CONFIG_EXTRA_FIRMWARE=""
427# CONFIG_SYS_HYPERVISOR is not set
428# CONFIG_CONNECTOR is not set
429CONFIG_MTD=y
430# CONFIG_MTD_DEBUG is not set
431# CONFIG_MTD_CONCAT is not set
432CONFIG_MTD_PARTITIONS=y
433# CONFIG_MTD_REDBOOT_PARTS is not set
434# CONFIG_MTD_CMDLINE_PARTS is not set
435# CONFIG_MTD_AFS_PARTS is not set
436# CONFIG_MTD_AR7_PARTS is not set
437
438#
439# User Modules And Translation Layers
440#
441CONFIG_MTD_CHAR=y
442CONFIG_MTD_BLKDEVS=y
443CONFIG_MTD_BLOCK=y
444# CONFIG_FTL is not set
445CONFIG_NFTL=y
446CONFIG_NFTL_RW=y
447# CONFIG_INFTL is not set
448# CONFIG_RFD_FTL is not set
449# CONFIG_SSFDC is not set
450# CONFIG_MTD_OOPS is not set
451
452#
453# RAM/ROM/Flash chip drivers
454#
455# CONFIG_MTD_CFI is not set
456# CONFIG_MTD_JEDECPROBE is not set
457CONFIG_MTD_MAP_BANK_WIDTH_1=y
458CONFIG_MTD_MAP_BANK_WIDTH_2=y
459CONFIG_MTD_MAP_BANK_WIDTH_4=y
460# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
461# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
462# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
463CONFIG_MTD_CFI_I1=y
464CONFIG_MTD_CFI_I2=y
465# CONFIG_MTD_CFI_I4 is not set
466# CONFIG_MTD_CFI_I8 is not set
467# CONFIG_MTD_RAM is not set
468# CONFIG_MTD_ROM is not set
469# CONFIG_MTD_ABSENT is not set
470
471#
472# Mapping drivers for chip access
473#
474# CONFIG_MTD_COMPLEX_MAPPINGS is not set
475# CONFIG_MTD_PLATRAM is not set
476
477#
478# Self-contained MTD device drivers
479#
480# CONFIG_MTD_DATAFLASH is not set
481# CONFIG_MTD_M25P80 is not set
482# CONFIG_MTD_SLRAM is not set
483# CONFIG_MTD_PHRAM is not set
484# CONFIG_MTD_MTDRAM is not set
485CONFIG_MTD_BLOCK2MTD=y
486
487#
488# Disk-On-Chip Device Drivers
489#
490# CONFIG_MTD_DOC2000 is not set
491# CONFIG_MTD_DOC2001 is not set
492# CONFIG_MTD_DOC2001PLUS is not set
493CONFIG_MTD_NAND=y
494CONFIG_MTD_NAND_VERIFY_WRITE=y
495CONFIG_MTD_NAND_ECC_SMC=y
496# CONFIG_MTD_NAND_MUSEUM_IDS is not set
497CONFIG_MTD_NAND_IDS=y
498# CONFIG_MTD_NAND_DISKONCHIP is not set
499CONFIG_MTD_NAND_ATMEL=y
500CONFIG_MTD_NAND_ATMEL_ECC_HW=y
501# CONFIG_MTD_NAND_ATMEL_ECC_SOFT is not set
502# CONFIG_MTD_NAND_ATMEL_ECC_NONE is not set
503# CONFIG_MTD_NAND_NANDSIM is not set
504CONFIG_MTD_NAND_PLATFORM=y
505# CONFIG_MTD_ALAUDA is not set
506# CONFIG_MTD_ONENAND is not set
507
508#
509# UBI - Unsorted block images
510#
511# CONFIG_MTD_UBI is not set
512# CONFIG_PARPORT is not set
513CONFIG_BLK_DEV=y
514# CONFIG_BLK_DEV_COW_COMMON is not set
515CONFIG_BLK_DEV_LOOP=y
516# CONFIG_BLK_DEV_CRYPTOLOOP is not set
517CONFIG_BLK_DEV_NBD=y
518# CONFIG_BLK_DEV_UB is not set
519# CONFIG_BLK_DEV_RAM is not set
520# CONFIG_CDROM_PKTCDVD is not set
521# CONFIG_ATA_OVER_ETH is not set
522CONFIG_MISC_DEVICES=y
523CONFIG_ATMEL_PWM=y
524CONFIG_ATMEL_TCLIB=y
525CONFIG_ATMEL_TCB_CLKSRC=y
526CONFIG_ATMEL_TCB_CLKSRC_BLOCK=0
527# CONFIG_EEPROM_93CX6 is not set
528# CONFIG_ATMEL_SSC is not set
529# CONFIG_ENCLOSURE_SERVICES is not set
530CONFIG_HAVE_IDE=y
531# CONFIG_IDE is not set
532
533#
534# SCSI device support
535#
536# CONFIG_RAID_ATTRS is not set
537CONFIG_SCSI=y
538CONFIG_SCSI_DMA=y
539# CONFIG_SCSI_TGT is not set
540# CONFIG_SCSI_NETLINK is not set
541CONFIG_SCSI_PROC_FS=y
542
543#
544# SCSI support type (disk, tape, CD-ROM)
545#
546# CONFIG_BLK_DEV_SD is not set
547# CONFIG_CHR_DEV_ST is not set
548# CONFIG_CHR_DEV_OSST is not set
549# CONFIG_BLK_DEV_SR is not set
550CONFIG_CHR_DEV_SG=y
551# CONFIG_CHR_DEV_SCH is not set
552
553#
554# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
555#
556# CONFIG_SCSI_MULTI_LUN is not set
557# CONFIG_SCSI_CONSTANTS is not set
558# CONFIG_SCSI_LOGGING is not set
559# CONFIG_SCSI_SCAN_ASYNC is not set
560CONFIG_SCSI_WAIT_SCAN=m
561
562#
563# SCSI Transports
564#
565# CONFIG_SCSI_SPI_ATTRS is not set
566# CONFIG_SCSI_FC_ATTRS is not set
567# CONFIG_SCSI_ISCSI_ATTRS is not set
568# CONFIG_SCSI_SAS_LIBSAS is not set
569# CONFIG_SCSI_SRP_ATTRS is not set
570CONFIG_SCSI_LOWLEVEL=y
571# CONFIG_ISCSI_TCP is not set
572# CONFIG_SCSI_DEBUG is not set
573# CONFIG_SCSI_DH is not set
574# CONFIG_ATA is not set
575# CONFIG_MD is not set
576CONFIG_NETDEVICES=y
577# CONFIG_DUMMY is not set
578# CONFIG_BONDING is not set
579# CONFIG_MACVLAN is not set
580# CONFIG_EQUALIZER is not set
581# CONFIG_TUN is not set
582# CONFIG_VETH is not set
583CONFIG_PHYLIB=y
584
585#
586# MII PHY device drivers
587#
588# CONFIG_MARVELL_PHY is not set
589# CONFIG_DAVICOM_PHY is not set
590# CONFIG_QSEMI_PHY is not set
591# CONFIG_LXT_PHY is not set
592# CONFIG_CICADA_PHY is not set
593# CONFIG_VITESSE_PHY is not set
594CONFIG_SMSC_PHY=y
595# CONFIG_BROADCOM_PHY is not set
596# CONFIG_ICPLUS_PHY is not set
597# CONFIG_REALTEK_PHY is not set
598# CONFIG_FIXED_PHY is not set
599# CONFIG_MDIO_BITBANG is not set
600CONFIG_NET_ETHERNET=y
601# CONFIG_MII is not set
602CONFIG_MACB=y
603# CONFIG_AX88796 is not set
604# CONFIG_SMC91X is not set
605# CONFIG_DM9000 is not set
606# CONFIG_ENC28J60 is not set
607# CONFIG_IBM_NEW_EMAC_ZMII is not set
608# CONFIG_IBM_NEW_EMAC_RGMII is not set
609# CONFIG_IBM_NEW_EMAC_TAH is not set
610# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
611# CONFIG_B44 is not set
612# CONFIG_NETDEV_1000 is not set
613# CONFIG_NETDEV_10000 is not set
614
615#
616# Wireless LAN
617#
618# CONFIG_WLAN_PRE80211 is not set
619# CONFIG_WLAN_80211 is not set
620# CONFIG_IWLWIFI_LEDS is not set
621
622#
623# USB Network Adapters
624#
625# CONFIG_USB_CATC is not set
626# CONFIG_USB_KAWETH is not set
627# CONFIG_USB_PEGASUS is not set
628# CONFIG_USB_RTL8150 is not set
629# CONFIG_USB_USBNET is not set
630# CONFIG_WAN is not set
631# CONFIG_PPP is not set
632# CONFIG_SLIP is not set
633# CONFIG_NETCONSOLE is not set
634# CONFIG_NETPOLL is not set
635# CONFIG_NET_POLL_CONTROLLER is not set
636# CONFIG_ISDN is not set
637
638#
639# Input device support
640#
641CONFIG_INPUT=y
642# CONFIG_INPUT_FF_MEMLESS is not set
643# CONFIG_INPUT_POLLDEV is not set
644
645#
646# Userland interfaces
647#
648CONFIG_INPUT_MOUSEDEV=y
649# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
650CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
651CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
652# CONFIG_INPUT_JOYDEV is not set
653CONFIG_INPUT_EVDEV=y
654# CONFIG_INPUT_EVBUG is not set
655
656#
657# Input Device Drivers
658#
659CONFIG_INPUT_KEYBOARD=y
660CONFIG_KEYBOARD_ATKBD=y
661# CONFIG_KEYBOARD_SUNKBD is not set
662# CONFIG_KEYBOARD_LKKBD is not set
663# CONFIG_KEYBOARD_XTKBD is not set
664# CONFIG_KEYBOARD_NEWTON is not set
665# CONFIG_KEYBOARD_STOWAWAY is not set
666# CONFIG_KEYBOARD_GPIO is not set
667CONFIG_INPUT_MOUSE=y
668CONFIG_MOUSE_PS2=y
669CONFIG_MOUSE_PS2_ALPS=y
670CONFIG_MOUSE_PS2_LOGIPS2PP=y
671CONFIG_MOUSE_PS2_SYNAPTICS=y
672CONFIG_MOUSE_PS2_LIFEBOOK=y
673CONFIG_MOUSE_PS2_TRACKPOINT=y
674# CONFIG_MOUSE_PS2_TOUCHKIT is not set
675# CONFIG_MOUSE_SERIAL is not set
676# CONFIG_MOUSE_APPLETOUCH is not set
677# CONFIG_MOUSE_VSXXXAA is not set
678# CONFIG_MOUSE_GPIO is not set
679# CONFIG_INPUT_JOYSTICK is not set
680# CONFIG_INPUT_TABLET is not set
681CONFIG_INPUT_TOUCHSCREEN=y
682CONFIG_TOUCHSCREEN_ADS7846=y
683# CONFIG_TOUCHSCREEN_FUJITSU is not set
684# CONFIG_TOUCHSCREEN_GUNZE is not set
685# CONFIG_TOUCHSCREEN_ELO is not set
686# CONFIG_TOUCHSCREEN_MTOUCH is not set
687# CONFIG_TOUCHSCREEN_INEXIO is not set
688# CONFIG_TOUCHSCREEN_MK712 is not set
689# CONFIG_TOUCHSCREEN_PENMOUNT is not set
690# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
691# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
692# CONFIG_TOUCHSCREEN_UCB1400 is not set
693# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
694# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
695# CONFIG_INPUT_MISC is not set
696
697#
698# Hardware I/O ports
699#
700CONFIG_SERIO=y
701CONFIG_SERIO_SERPORT=y
702CONFIG_SERIO_LIBPS2=y
703# CONFIG_SERIO_RAW is not set
704# CONFIG_GAMEPORT is not set
705
706#
707# Character devices
708#
709CONFIG_VT=y
710CONFIG_CONSOLE_TRANSLATIONS=y
711CONFIG_VT_CONSOLE=y
712CONFIG_HW_CONSOLE=y
713CONFIG_VT_HW_CONSOLE_BINDING=y
714# CONFIG_DEVKMEM is not set
715CONFIG_SERIAL_NONSTANDARD=y
716# CONFIG_N_HDLC is not set
717# CONFIG_RISCOM8 is not set
718# CONFIG_SPECIALIX is not set
719# CONFIG_RIO is not set
720# CONFIG_STALDRV is not set
721
722#
723# Serial drivers
724#
725# CONFIG_SERIAL_8250 is not set
726
727#
728# Non-8250 serial port support
729#
730CONFIG_SERIAL_ATMEL=y
731CONFIG_SERIAL_ATMEL_CONSOLE=y
732# CONFIG_SERIAL_ATMEL_PDC is not set
733# CONFIG_SERIAL_ATMEL_TTYAT is not set
734CONFIG_SERIAL_CORE=y
735CONFIG_SERIAL_CORE_CONSOLE=y
736CONFIG_UNIX98_PTYS=y
737CONFIG_LEGACY_PTYS=y
738CONFIG_LEGACY_PTY_COUNT=256
739# CONFIG_IPMI_HANDLER is not set
740# CONFIG_HW_RANDOM is not set
741# CONFIG_NVRAM is not set
742# CONFIG_R3964 is not set
743# CONFIG_RAW_DRIVER is not set
744# CONFIG_TCG_TPM is not set
745CONFIG_I2C=y
746CONFIG_I2C_BOARDINFO=y
747CONFIG_I2C_CHARDEV=y
748
749#
750# I2C Hardware Bus support
751#
752
753#
754# I2C system bus drivers (mostly embedded / system-on-chip)
755#
756# CONFIG_I2C_GPIO is not set
757# CONFIG_I2C_OCORES is not set
758# CONFIG_I2C_SIMTEC is not set
759
760#
761# External I2C/SMBus adapter drivers
762#
763# CONFIG_I2C_PARPORT_LIGHT is not set
764# CONFIG_I2C_TAOS_EVM is not set
765# CONFIG_I2C_TINY_USB is not set
766
767#
768# Other I2C/SMBus bus drivers
769#
770# CONFIG_I2C_PCA_PLATFORM is not set
771# CONFIG_I2C_STUB is not set
772
773#
774# Miscellaneous I2C Chip support
775#
776# CONFIG_DS1682 is not set
777# CONFIG_AT24 is not set
778# CONFIG_SENSORS_EEPROM is not set
779# CONFIG_SENSORS_PCF8574 is not set
780# CONFIG_PCF8575 is not set
781# CONFIG_SENSORS_PCA9539 is not set
782# CONFIG_SENSORS_PCF8591 is not set
783# CONFIG_SENSORS_MAX6875 is not set
784# CONFIG_SENSORS_TSL2550 is not set
785# CONFIG_I2C_DEBUG_CORE is not set
786# CONFIG_I2C_DEBUG_ALGO is not set
787# CONFIG_I2C_DEBUG_BUS is not set
788# CONFIG_I2C_DEBUG_CHIP is not set
789CONFIG_SPI=y
790CONFIG_SPI_MASTER=y
791
792#
793# SPI Master Controller Drivers
794#
795CONFIG_SPI_ATMEL=y
796# CONFIG_SPI_BITBANG is not set
797
798#
799# SPI Protocol Masters
800#
801# CONFIG_SPI_AT25 is not set
802# CONFIG_SPI_SPIDEV is not set
803# CONFIG_SPI_TLE62X0 is not set
804# CONFIG_W1 is not set
805# CONFIG_POWER_SUPPLY is not set
806# CONFIG_HWMON is not set
807# CONFIG_WATCHDOG is not set
808
809#
810# Sonics Silicon Backplane
811#
812CONFIG_SSB_POSSIBLE=y
813# CONFIG_SSB is not set
814
815#
816# Multifunction device drivers
817#
818# CONFIG_MFD_CORE is not set
819# CONFIG_MFD_SM501 is not set
820# CONFIG_HTC_PASIC3 is not set
821
822#
823# Multimedia devices
824#
825
826#
827# Multimedia core support
828#
829# CONFIG_VIDEO_DEV is not set
830# CONFIG_DVB_CORE is not set
831# CONFIG_VIDEO_MEDIA is not set
832
833#
834# Multimedia drivers
835#
836# CONFIG_DAB is not set
837
838#
839# Graphics support
840#
841# CONFIG_VGASTATE is not set
842CONFIG_VIDEO_OUTPUT_CONTROL=y
843CONFIG_FB=y
844# CONFIG_FIRMWARE_EDID is not set
845# CONFIG_FB_DDC is not set
846CONFIG_FB_CFB_FILLRECT=y
847CONFIG_FB_CFB_COPYAREA=y
848CONFIG_FB_CFB_IMAGEBLIT=y
849# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
850# CONFIG_FB_SYS_FILLRECT is not set
851# CONFIG_FB_SYS_COPYAREA is not set
852# CONFIG_FB_SYS_IMAGEBLIT is not set
853# CONFIG_FB_FOREIGN_ENDIAN is not set
854# CONFIG_FB_SYS_FOPS is not set
855# CONFIG_FB_SVGALIB is not set
856# CONFIG_FB_MACMODES is not set
857# CONFIG_FB_BACKLIGHT is not set
858# CONFIG_FB_MODE_HELPERS is not set
859# CONFIG_FB_TILEBLITTING is not set
860
861#
862# Frame buffer hardware drivers
863#
864# CONFIG_FB_S1D13XXX is not set
865CONFIG_FB_ATMEL=y
866# CONFIG_FB_VIRTUAL is not set
867CONFIG_BACKLIGHT_LCD_SUPPORT=y
868CONFIG_LCD_CLASS_DEVICE=y
869# CONFIG_LCD_LTV350QV is not set
870# CONFIG_LCD_ILI9320 is not set
871# CONFIG_LCD_VGG2432A4 is not set
872# CONFIG_LCD_PLATFORM is not set
873CONFIG_BACKLIGHT_CLASS_DEVICE=y
874CONFIG_BACKLIGHT_ATMEL_LCDC=y
875# CONFIG_BACKLIGHT_ATMEL_PWM is not set
876# CONFIG_BACKLIGHT_CORGI is not set
877
878#
879# Display device support
880#
881# CONFIG_DISPLAY_SUPPORT is not set
882
883#
884# Console display driver support
885#
886# CONFIG_VGA_CONSOLE is not set
887CONFIG_DUMMY_CONSOLE=y
888CONFIG_FRAMEBUFFER_CONSOLE=y
889CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
890# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
891# CONFIG_FONTS is not set
892CONFIG_FONT_8x8=y
893CONFIG_FONT_8x16=y
894CONFIG_LOGO=y
895CONFIG_LOGO_LINUX_MONO=y
896CONFIG_LOGO_LINUX_VGA16=y
897CONFIG_LOGO_LINUX_CLUT224=y
898# CONFIG_SOUND is not set
899CONFIG_HID_SUPPORT=y
900CONFIG_HID=y
901CONFIG_HID_DEBUG=y
902# CONFIG_HIDRAW is not set
903
904#
905# USB Input Devices
906#
907CONFIG_USB_HID=y
908# CONFIG_USB_HIDINPUT_POWERBOOK is not set
909# CONFIG_HID_FF is not set
910# CONFIG_USB_HIDDEV is not set
911CONFIG_USB_SUPPORT=y
912CONFIG_USB_ARCH_HAS_HCD=y
913CONFIG_USB_ARCH_HAS_OHCI=y
914# CONFIG_USB_ARCH_HAS_EHCI is not set
915CONFIG_USB=y
916# CONFIG_USB_DEBUG is not set
917# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
918
919#
920# Miscellaneous USB options
921#
922CONFIG_USB_DEVICEFS=y
923CONFIG_USB_DEVICE_CLASS=y
924# CONFIG_USB_DYNAMIC_MINORS is not set
925# CONFIG_USB_OTG is not set
926
927#
928# USB Host Controller Drivers
929#
930# CONFIG_USB_C67X00_HCD is not set
931# CONFIG_USB_ISP116X_HCD is not set
932# CONFIG_USB_ISP1760_HCD is not set
933CONFIG_USB_OHCI_HCD=y
934# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
935# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
936CONFIG_USB_OHCI_LITTLE_ENDIAN=y
937# CONFIG_USB_SL811_HCD is not set
938# CONFIG_USB_R8A66597_HCD is not set
939
940#
941# USB Device Class drivers
942#
943# CONFIG_USB_ACM is not set
944# CONFIG_USB_PRINTER is not set
945# CONFIG_USB_WDM is not set
946
947#
948# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
949#
950
951#
952# may also be needed; see USB_STORAGE Help for more information
953#
954CONFIG_USB_STORAGE=y
955# CONFIG_USB_STORAGE_DEBUG is not set
956# CONFIG_USB_STORAGE_DATAFAB is not set
957# CONFIG_USB_STORAGE_FREECOM is not set
958# CONFIG_USB_STORAGE_ISD200 is not set
959# CONFIG_USB_STORAGE_DPCM is not set
960# CONFIG_USB_STORAGE_USBAT is not set
961# CONFIG_USB_STORAGE_SDDR09 is not set
962# CONFIG_USB_STORAGE_SDDR55 is not set
963# CONFIG_USB_STORAGE_JUMPSHOT is not set
964# CONFIG_USB_STORAGE_ALAUDA is not set
965# CONFIG_USB_STORAGE_ONETOUCH is not set
966# CONFIG_USB_STORAGE_KARMA is not set
967# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
968# CONFIG_USB_LIBUSUAL is not set
969
970#
971# USB Imaging devices
972#
973# CONFIG_USB_MDC800 is not set
974# CONFIG_USB_MICROTEK is not set
975CONFIG_USB_MON=y
976
977#
978# USB port drivers
979#
980# CONFIG_USB_SERIAL is not set
981
982#
983# USB Miscellaneous drivers
984#
985# CONFIG_USB_EMI62 is not set
986# CONFIG_USB_EMI26 is not set
987# CONFIG_USB_ADUTUX is not set
988# CONFIG_USB_AUERSWALD is not set
989# CONFIG_USB_RIO500 is not set
990# CONFIG_USB_LEGOTOWER is not set
991# CONFIG_USB_LCD is not set
992# CONFIG_USB_BERRY_CHARGE is not set
993# CONFIG_USB_LED is not set
994# CONFIG_USB_CYPRESS_CY7C63 is not set
995# CONFIG_USB_CYTHERM is not set
996# CONFIG_USB_PHIDGET is not set
997# CONFIG_USB_IDMOUSE is not set
998# CONFIG_USB_FTDI_ELAN is not set
999# CONFIG_USB_APPLEDISPLAY is not set
1000# CONFIG_USB_LD is not set
1001# CONFIG_USB_TRANCEVIBRATOR is not set
1002# CONFIG_USB_IOWARRIOR is not set
1003# CONFIG_USB_TEST is not set
1004# CONFIG_USB_ISIGHTFW is not set
1005# CONFIG_USB_GADGET is not set
1006CONFIG_MMC=y
1007# CONFIG_MMC_DEBUG is not set
1008# CONFIG_MMC_UNSAFE_RESUME is not set
1009
1010#
1011# MMC/SD Card Drivers
1012#
1013CONFIG_MMC_BLOCK=y
1014CONFIG_MMC_BLOCK_BOUNCE=y
1015CONFIG_SDIO_UART=y
1016# CONFIG_MMC_TEST is not set
1017
1018#
1019# MMC/SD Host Controller Drivers
1020#
1021# CONFIG_MMC_SDHCI is not set
1022CONFIG_MMC_AT91=y
1023# CONFIG_MMC_SPI is not set
1024# CONFIG_NEW_LEDS is not set
1025CONFIG_RTC_LIB=y
1026# CONFIG_RTC_CLASS is not set
1027# CONFIG_DMADEVICES is not set
1028# CONFIG_UIO is not set
1029
1030#
1031# File systems
1032#
1033CONFIG_EXT2_FS=y
1034# CONFIG_EXT2_FS_XATTR is not set
1035# CONFIG_EXT2_FS_XIP is not set
1036# CONFIG_EXT3_FS is not set
1037# CONFIG_EXT4DEV_FS is not set
1038# CONFIG_REISERFS_FS is not set
1039# CONFIG_JFS_FS is not set
1040# CONFIG_FS_POSIX_ACL is not set
1041# CONFIG_XFS_FS is not set
1042# CONFIG_OCFS2_FS is not set
1043# CONFIG_DNOTIFY is not set
1044# CONFIG_INOTIFY is not set
1045# CONFIG_QUOTA is not set
1046CONFIG_AUTOFS_FS=y
1047# CONFIG_AUTOFS4_FS is not set
1048# CONFIG_FUSE_FS is not set
1049
1050#
1051# CD-ROM/DVD Filesystems
1052#
1053# CONFIG_ISO9660_FS is not set
1054# CONFIG_UDF_FS is not set
1055
1056#
1057# DOS/FAT/NT Filesystems
1058#
1059CONFIG_FAT_FS=y
1060# CONFIG_MSDOS_FS is not set
1061CONFIG_VFAT_FS=y
1062CONFIG_FAT_DEFAULT_CODEPAGE=437
1063CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1064# CONFIG_NTFS_FS is not set
1065
1066#
1067# Pseudo filesystems
1068#
1069CONFIG_PROC_FS=y
1070CONFIG_PROC_SYSCTL=y
1071CONFIG_SYSFS=y
1072CONFIG_TMPFS=y
1073# CONFIG_TMPFS_POSIX_ACL is not set
1074# CONFIG_HUGETLB_PAGE is not set
1075# CONFIG_CONFIGFS_FS is not set
1076
1077#
1078# Miscellaneous filesystems
1079#
1080# CONFIG_ADFS_FS is not set
1081# CONFIG_AFFS_FS is not set
1082# CONFIG_HFS_FS is not set
1083# CONFIG_HFSPLUS_FS is not set
1084# CONFIG_BEFS_FS is not set
1085# CONFIG_BFS_FS is not set
1086# CONFIG_EFS_FS is not set
1087CONFIG_JFFS2_FS=y
1088CONFIG_JFFS2_FS_DEBUG=0
1089CONFIG_JFFS2_FS_WRITEBUFFER=y
1090CONFIG_JFFS2_FS_WBUF_VERIFY=y
1091# CONFIG_JFFS2_SUMMARY is not set
1092# CONFIG_JFFS2_FS_XATTR is not set
1093# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1094CONFIG_JFFS2_ZLIB=y
1095# CONFIG_JFFS2_LZO is not set
1096CONFIG_JFFS2_RTIME=y
1097# CONFIG_JFFS2_RUBIN is not set
1098# CONFIG_CRAMFS is not set
1099# CONFIG_VXFS_FS is not set
1100# CONFIG_MINIX_FS is not set
1101# CONFIG_OMFS_FS is not set
1102# CONFIG_HPFS_FS is not set
1103# CONFIG_QNX4FS_FS is not set
1104# CONFIG_ROMFS_FS is not set
1105# CONFIG_SYSV_FS is not set
1106# CONFIG_UFS_FS is not set
1107CONFIG_NETWORK_FILESYSTEMS=y
1108CONFIG_NFS_FS=y
1109# CONFIG_NFS_V3 is not set
1110# CONFIG_NFS_V4 is not set
1111CONFIG_ROOT_NFS=y
1112# CONFIG_NFSD is not set
1113CONFIG_LOCKD=y
1114CONFIG_NFS_COMMON=y
1115CONFIG_SUNRPC=y
1116# CONFIG_RPCSEC_GSS_KRB5 is not set
1117# CONFIG_RPCSEC_GSS_SPKM3 is not set
1118# CONFIG_SMB_FS is not set
1119# CONFIG_CIFS is not set
1120# CONFIG_NCP_FS is not set
1121# CONFIG_CODA_FS is not set
1122# CONFIG_AFS_FS is not set
1123
1124#
1125# Partition Types
1126#
1127# CONFIG_PARTITION_ADVANCED is not set
1128CONFIG_MSDOS_PARTITION=y
1129CONFIG_NLS=y
1130CONFIG_NLS_DEFAULT="iso8859-1"
1131# CONFIG_NLS_CODEPAGE_437 is not set
1132# CONFIG_NLS_CODEPAGE_737 is not set
1133# CONFIG_NLS_CODEPAGE_775 is not set
1134# CONFIG_NLS_CODEPAGE_850 is not set
1135# CONFIG_NLS_CODEPAGE_852 is not set
1136# CONFIG_NLS_CODEPAGE_855 is not set
1137# CONFIG_NLS_CODEPAGE_857 is not set
1138# CONFIG_NLS_CODEPAGE_860 is not set
1139# CONFIG_NLS_CODEPAGE_861 is not set
1140# CONFIG_NLS_CODEPAGE_862 is not set
1141# CONFIG_NLS_CODEPAGE_863 is not set
1142# CONFIG_NLS_CODEPAGE_864 is not set
1143# CONFIG_NLS_CODEPAGE_865 is not set
1144# CONFIG_NLS_CODEPAGE_866 is not set
1145# CONFIG_NLS_CODEPAGE_869 is not set
1146# CONFIG_NLS_CODEPAGE_936 is not set
1147# CONFIG_NLS_CODEPAGE_950 is not set
1148# CONFIG_NLS_CODEPAGE_932 is not set
1149# CONFIG_NLS_CODEPAGE_949 is not set
1150# CONFIG_NLS_CODEPAGE_874 is not set
1151# CONFIG_NLS_ISO8859_8 is not set
1152# CONFIG_NLS_CODEPAGE_1250 is not set
1153# CONFIG_NLS_CODEPAGE_1251 is not set
1154# CONFIG_NLS_ASCII is not set
1155# CONFIG_NLS_ISO8859_1 is not set
1156# CONFIG_NLS_ISO8859_2 is not set
1157# CONFIG_NLS_ISO8859_3 is not set
1158# CONFIG_NLS_ISO8859_4 is not set
1159# CONFIG_NLS_ISO8859_5 is not set
1160# CONFIG_NLS_ISO8859_6 is not set
1161# CONFIG_NLS_ISO8859_7 is not set
1162# CONFIG_NLS_ISO8859_9 is not set
1163# CONFIG_NLS_ISO8859_13 is not set
1164# CONFIG_NLS_ISO8859_14 is not set
1165# CONFIG_NLS_ISO8859_15 is not set
1166# CONFIG_NLS_KOI8_R is not set
1167# CONFIG_NLS_KOI8_U is not set
1168# CONFIG_NLS_UTF8 is not set
1169# CONFIG_DLM is not set
1170
1171#
1172# Kernel hacking
1173#
1174# CONFIG_PRINTK_TIME is not set
1175# CONFIG_ENABLE_WARN_DEPRECATED is not set
1176# CONFIG_ENABLE_MUST_CHECK is not set
1177CONFIG_FRAME_WARN=1024
1178# CONFIG_MAGIC_SYSRQ is not set
1179# CONFIG_UNUSED_SYMBOLS is not set
1180# CONFIG_DEBUG_FS is not set
1181# CONFIG_HEADERS_CHECK is not set
1182# CONFIG_DEBUG_KERNEL is not set
1183# CONFIG_SLUB_DEBUG_ON is not set
1184# CONFIG_SLUB_STATS is not set
1185CONFIG_DEBUG_BUGVERBOSE=y
1186CONFIG_DEBUG_MEMORY_INIT=y
1187CONFIG_FRAME_POINTER=y
1188# CONFIG_LATENCYTOP is not set
1189CONFIG_HAVE_FTRACE=y
1190CONFIG_HAVE_DYNAMIC_FTRACE=y
1191# CONFIG_FTRACE is not set
1192# CONFIG_IRQSOFF_TRACER is not set
1193# CONFIG_SCHED_TRACER is not set
1194# CONFIG_CONTEXT_SWITCH_TRACER is not set
1195# CONFIG_SAMPLES is not set
1196CONFIG_HAVE_ARCH_KGDB=y
1197# CONFIG_DEBUG_USER is not set
1198
1199#
1200# Security options
1201#
1202# CONFIG_KEYS is not set
1203# CONFIG_SECURITY is not set
1204# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1205CONFIG_CRYPTO=y
1206
1207#
1208# Crypto core or helper
1209#
1210# CONFIG_CRYPTO_MANAGER is not set
1211# CONFIG_CRYPTO_GF128MUL is not set
1212# CONFIG_CRYPTO_NULL is not set
1213# CONFIG_CRYPTO_CRYPTD is not set
1214# CONFIG_CRYPTO_AUTHENC is not set
1215# CONFIG_CRYPTO_TEST is not set
1216
1217#
1218# Authenticated Encryption with Associated Data
1219#
1220# CONFIG_CRYPTO_CCM is not set
1221# CONFIG_CRYPTO_GCM is not set
1222# CONFIG_CRYPTO_SEQIV is not set
1223
1224#
1225# Block modes
1226#
1227# CONFIG_CRYPTO_CBC is not set
1228# CONFIG_CRYPTO_CTR is not set
1229# CONFIG_CRYPTO_CTS is not set
1230# CONFIG_CRYPTO_ECB is not set
1231# CONFIG_CRYPTO_LRW is not set
1232# CONFIG_CRYPTO_PCBC is not set
1233# CONFIG_CRYPTO_XTS is not set
1234
1235#
1236# Hash modes
1237#
1238# CONFIG_CRYPTO_HMAC is not set
1239# CONFIG_CRYPTO_XCBC is not set
1240
1241#
1242# Digest
1243#
1244# CONFIG_CRYPTO_CRC32C is not set
1245# CONFIG_CRYPTO_MD4 is not set
1246# CONFIG_CRYPTO_MD5 is not set
1247# CONFIG_CRYPTO_MICHAEL_MIC is not set
1248# CONFIG_CRYPTO_RMD128 is not set
1249# CONFIG_CRYPTO_RMD160 is not set
1250# CONFIG_CRYPTO_RMD256 is not set
1251# CONFIG_CRYPTO_RMD320 is not set
1252# CONFIG_CRYPTO_SHA1 is not set
1253# CONFIG_CRYPTO_SHA256 is not set
1254# CONFIG_CRYPTO_SHA512 is not set
1255# CONFIG_CRYPTO_TGR192 is not set
1256# CONFIG_CRYPTO_WP512 is not set
1257
1258#
1259# Ciphers
1260#
1261# CONFIG_CRYPTO_AES is not set
1262# CONFIG_CRYPTO_ANUBIS is not set
1263# CONFIG_CRYPTO_ARC4 is not set
1264# CONFIG_CRYPTO_BLOWFISH is not set
1265# CONFIG_CRYPTO_CAMELLIA is not set
1266# CONFIG_CRYPTO_CAST5 is not set
1267# CONFIG_CRYPTO_CAST6 is not set
1268# CONFIG_CRYPTO_DES is not set
1269# CONFIG_CRYPTO_FCRYPT is not set
1270# CONFIG_CRYPTO_KHAZAD is not set
1271# CONFIG_CRYPTO_SALSA20 is not set
1272# CONFIG_CRYPTO_SEED is not set
1273# CONFIG_CRYPTO_SERPENT is not set
1274# CONFIG_CRYPTO_TEA is not set
1275# CONFIG_CRYPTO_TWOFISH is not set
1276
1277#
1278# Compression
1279#
1280# CONFIG_CRYPTO_DEFLATE is not set
1281# CONFIG_CRYPTO_LZO is not set
1282# CONFIG_CRYPTO_HW is not set
1283
1284#
1285# Library routines
1286#
1287CONFIG_BITREVERSE=y
1288# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1289# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1290# CONFIG_CRC_CCITT is not set
1291# CONFIG_CRC16 is not set
1292# CONFIG_CRC_T10DIF is not set
1293# CONFIG_CRC_ITU_T is not set
1294CONFIG_CRC32=y
1295# CONFIG_CRC7 is not set
1296# CONFIG_LIBCRC32C is not set
1297CONFIG_ZLIB_INFLATE=y
1298CONFIG_ZLIB_DEFLATE=y
1299CONFIG_PLIST=y
1300CONFIG_HAS_IOMEM=y
1301CONFIG_HAS_IOPORT=y
1302CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/netx_defconfig b/arch/arm/configs/netx_defconfig
index 0884f2370c3a..61d0fc5b2417 100644
--- a/arch/arm/configs/netx_defconfig
+++ b/arch/arm/configs/netx_defconfig
@@ -728,9 +728,9 @@ CONFIG_RTC_CLASS=m
728# 728#
729# RTC interfaces 729# RTC interfaces
730# 730#
731CONFIG_RTC_INTF_SYSFS=m 731CONFIG_RTC_INTF_SYSFS=y
732CONFIG_RTC_INTF_PROC=m 732CONFIG_RTC_INTF_PROC=y
733CONFIG_RTC_INTF_DEV=m 733CONFIG_RTC_INTF_DEV=y
734 734
735# 735#
736# RTC drivers 736# RTC drivers
diff --git a/arch/arm/configs/omap3_pandora_defconfig b/arch/arm/configs/omap3_pandora_defconfig
new file mode 100644
index 000000000000..09543f4de5bc
--- /dev/null
+++ b/arch/arm/configs/omap3_pandora_defconfig
@@ -0,0 +1,1409 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.28-rc7
4# Fri Dec 5 11:54:09 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_GENERIC_HARDIRQS_NO__DO_IRQ=y
26CONFIG_VECTORS_BASE=0xffff0000
27CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
28
29#
30# General setup
31#
32CONFIG_EXPERIMENTAL=y
33CONFIG_BROKEN_ON_SMP=y
34CONFIG_INIT_ENV_ARG_LIMIT=32
35CONFIG_LOCALVERSION=""
36CONFIG_LOCALVERSION_AUTO=y
37CONFIG_SWAP=y
38CONFIG_SYSVIPC=y
39CONFIG_SYSVIPC_SYSCTL=y
40# CONFIG_POSIX_MQUEUE is not set
41CONFIG_BSD_PROCESS_ACCT=y
42# CONFIG_BSD_PROCESS_ACCT_V3 is not set
43# CONFIG_TASKSTATS is not set
44# CONFIG_AUDIT is not set
45CONFIG_IKCONFIG=y
46CONFIG_IKCONFIG_PROC=y
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
54CONFIG_SYSFS_DEPRECATED=y
55CONFIG_SYSFS_DEPRECATED_V2=y
56# CONFIG_RELAY is not set
57# CONFIG_NAMESPACES is not set
58CONFIG_BLK_DEV_INITRD=y
59CONFIG_INITRAMFS_SOURCE=""
60CONFIG_CC_OPTIMIZE_FOR_SIZE=y
61CONFIG_SYSCTL=y
62CONFIG_EMBEDDED=y
63CONFIG_UID16=y
64# CONFIG_SYSCTL_SYSCALL is not set
65CONFIG_KALLSYMS=y
66# CONFIG_KALLSYMS_ALL is not set
67CONFIG_KALLSYMS_EXTRA_PASS=y
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_AIO=y
82CONFIG_VM_EVENT_COUNTERS=y
83CONFIG_SLAB=y
84# CONFIG_SLUB is not set
85# CONFIG_SLOB is not set
86# CONFIG_PROFILING is not set
87# CONFIG_MARKERS is not set
88CONFIG_HAVE_OPROFILE=y
89# CONFIG_KPROBES is not set
90CONFIG_HAVE_KPROBES=y
91CONFIG_HAVE_KRETPROBES=y
92CONFIG_HAVE_CLK=y
93CONFIG_HAVE_GENERIC_DMA_COHERENT=y
94CONFIG_SLABINFO=y
95CONFIG_RT_MUTEXES=y
96# CONFIG_TINY_SHMEM is not set
97CONFIG_BASE_SMALL=0
98CONFIG_MODULES=y
99# CONFIG_MODULE_FORCE_LOAD is not set
100CONFIG_MODULE_UNLOAD=y
101# CONFIG_MODULE_FORCE_UNLOAD is not set
102CONFIG_MODVERSIONS=y
103CONFIG_MODULE_SRCVERSION_ALL=y
104CONFIG_KMOD=y
105CONFIG_BLOCK=y
106# CONFIG_LBD is not set
107# CONFIG_BLK_DEV_IO_TRACE is not set
108# CONFIG_LSF is not set
109# CONFIG_BLK_DEV_BSG is not set
110# CONFIG_BLK_DEV_INTEGRITY is not set
111
112#
113# IO Schedulers
114#
115CONFIG_IOSCHED_NOOP=y
116CONFIG_IOSCHED_AS=y
117CONFIG_IOSCHED_DEADLINE=y
118CONFIG_IOSCHED_CFQ=y
119CONFIG_DEFAULT_AS=y
120# CONFIG_DEFAULT_DEADLINE is not set
121# CONFIG_DEFAULT_CFQ is not set
122# CONFIG_DEFAULT_NOOP is not set
123CONFIG_DEFAULT_IOSCHED="anticipatory"
124CONFIG_CLASSIC_RCU=y
125# CONFIG_FREEZER is not set
126
127#
128# System Type
129#
130# CONFIG_ARCH_AAEC2000 is not set
131# CONFIG_ARCH_INTEGRATOR is not set
132# CONFIG_ARCH_REALVIEW is not set
133# CONFIG_ARCH_VERSATILE is not set
134# CONFIG_ARCH_AT91 is not set
135# CONFIG_ARCH_CLPS7500 is not set
136# CONFIG_ARCH_CLPS711X is not set
137# CONFIG_ARCH_EBSA110 is not set
138# CONFIG_ARCH_EP93XX is not set
139# CONFIG_ARCH_FOOTBRIDGE is not set
140# CONFIG_ARCH_NETX is not set
141# CONFIG_ARCH_H720X is not set
142# CONFIG_ARCH_IMX is not set
143# CONFIG_ARCH_IOP13XX is not set
144# CONFIG_ARCH_IOP32X is not set
145# CONFIG_ARCH_IOP33X is not set
146# CONFIG_ARCH_IXP23XX is not set
147# CONFIG_ARCH_IXP2000 is not set
148# CONFIG_ARCH_IXP4XX is not set
149# CONFIG_ARCH_L7200 is not set
150# CONFIG_ARCH_KIRKWOOD is not set
151# CONFIG_ARCH_KS8695 is not set
152# CONFIG_ARCH_NS9XXX is not set
153# CONFIG_ARCH_LOKI is not set
154# CONFIG_ARCH_MV78XX0 is not set
155# CONFIG_ARCH_MXC is not set
156# CONFIG_ARCH_ORION5X is not set
157# CONFIG_ARCH_PNX4008 is not set
158# CONFIG_ARCH_PXA is not set
159# CONFIG_ARCH_RPC is not set
160# CONFIG_ARCH_SA1100 is not set
161# CONFIG_ARCH_S3C2410 is not set
162# CONFIG_ARCH_SHARK is not set
163# CONFIG_ARCH_LH7A40X is not set
164# CONFIG_ARCH_DAVINCI is not set
165CONFIG_ARCH_OMAP=y
166# CONFIG_ARCH_MSM is not set
167
168#
169# TI OMAP Implementations
170#
171CONFIG_ARCH_OMAP_OTG=y
172# CONFIG_ARCH_OMAP1 is not set
173# CONFIG_ARCH_OMAP2 is not set
174CONFIG_ARCH_OMAP3=y
175
176#
177# OMAP Feature Selections
178#
179# CONFIG_OMAP_DEBUG_POWERDOMAIN is not set
180# CONFIG_OMAP_DEBUG_CLOCKDOMAIN is not set
181# CONFIG_OMAP_RESET_CLOCKS is not set
182# CONFIG_OMAP_MUX is not set
183CONFIG_OMAP_MCBSP=y
184# CONFIG_OMAP_MPU_TIMER is not set
185CONFIG_OMAP_32K_TIMER=y
186CONFIG_OMAP_32K_TIMER_HZ=128
187CONFIG_OMAP_DM_TIMER=y
188# CONFIG_OMAP_LL_DEBUG_UART1 is not set
189# CONFIG_OMAP_LL_DEBUG_UART2 is not set
190CONFIG_OMAP_LL_DEBUG_UART3=y
191CONFIG_ARCH_OMAP34XX=y
192CONFIG_ARCH_OMAP3430=y
193
194#
195# OMAP Board Type
196#
197# CONFIG_MACH_OMAP3_BEAGLE is not set
198# CONFIG_MACH_OMAP_LDP is not set
199# CONFIG_MACH_OVERO is not set
200CONFIG_MACH_OMAP3_PANDORA=y
201
202#
203# Boot options
204#
205
206#
207# Power management
208#
209
210#
211# Processor Type
212#
213CONFIG_CPU_32=y
214CONFIG_CPU_32v6K=y
215CONFIG_CPU_V7=y
216CONFIG_CPU_32v7=y
217CONFIG_CPU_ABRT_EV7=y
218CONFIG_CPU_PABRT_IFAR=y
219CONFIG_CPU_CACHE_V7=y
220CONFIG_CPU_CACHE_VIPT=y
221CONFIG_CPU_COPY_V6=y
222CONFIG_CPU_TLB_V7=y
223CONFIG_CPU_HAS_ASID=y
224CONFIG_CPU_CP15=y
225CONFIG_CPU_CP15_MMU=y
226
227#
228# Processor Features
229#
230CONFIG_ARM_THUMB=y
231CONFIG_ARM_THUMBEE=y
232# CONFIG_CPU_ICACHE_DISABLE is not set
233# CONFIG_CPU_DCACHE_DISABLE is not set
234# CONFIG_CPU_BPREDICT_DISABLE is not set
235CONFIG_HAS_TLS_REG=y
236# CONFIG_OUTER_CACHE is not set
237
238#
239# Bus support
240#
241# CONFIG_PCI_SYSCALL is not set
242# CONFIG_ARCH_SUPPORTS_MSI is not set
243# CONFIG_PCCARD is not set
244
245#
246# Kernel Features
247#
248CONFIG_TICK_ONESHOT=y
249CONFIG_NO_HZ=y
250CONFIG_HIGH_RES_TIMERS=y
251CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
252CONFIG_VMSPLIT_3G=y
253# CONFIG_VMSPLIT_2G is not set
254# CONFIG_VMSPLIT_1G is not set
255CONFIG_PAGE_OFFSET=0xC0000000
256# CONFIG_PREEMPT is not set
257CONFIG_HZ=128
258CONFIG_AEABI=y
259CONFIG_OABI_COMPAT=y
260CONFIG_ARCH_FLATMEM_HAS_HOLES=y
261# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
262# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
263CONFIG_SELECT_MEMORY_MODEL=y
264CONFIG_FLATMEM_MANUAL=y
265# CONFIG_DISCONTIGMEM_MANUAL is not set
266# CONFIG_SPARSEMEM_MANUAL is not set
267CONFIG_FLATMEM=y
268CONFIG_FLAT_NODE_MEM_MAP=y
269CONFIG_PAGEFLAGS_EXTENDED=y
270CONFIG_SPLIT_PTLOCK_CPUS=4
271# CONFIG_RESOURCES_64BIT is not set
272# CONFIG_PHYS_ADDR_T_64BIT is not set
273CONFIG_ZONE_DMA_FLAG=0
274CONFIG_VIRT_TO_BUS=y
275CONFIG_UNEVICTABLE_LRU=y
276# CONFIG_LEDS is not set
277CONFIG_ALIGNMENT_TRAP=y
278
279#
280# Boot options
281#
282CONFIG_ZBOOT_ROM_TEXT=0x0
283CONFIG_ZBOOT_ROM_BSS=0x0
284CONFIG_CMDLINE=" debug "
285# CONFIG_XIP_KERNEL is not set
286# CONFIG_KEXEC is not set
287
288#
289# CPU Power Management
290#
291# CONFIG_CPU_FREQ is not set
292# CONFIG_CPU_IDLE is not set
293
294#
295# Floating point emulation
296#
297
298#
299# At least one emulation must be selected
300#
301CONFIG_FPE_NWFPE=y
302# CONFIG_FPE_NWFPE_XP is not set
303# CONFIG_FPE_FASTFPE is not set
304CONFIG_VFP=y
305CONFIG_VFPv3=y
306CONFIG_NEON=y
307
308#
309# Userspace binary formats
310#
311CONFIG_BINFMT_ELF=y
312# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
313CONFIG_HAVE_AOUT=y
314# CONFIG_BINFMT_AOUT is not set
315CONFIG_BINFMT_MISC=y
316
317#
318# Power management options
319#
320# CONFIG_PM is not set
321CONFIG_ARCH_SUSPEND_POSSIBLE=y
322CONFIG_NET=y
323
324#
325# Networking options
326#
327CONFIG_PACKET=y
328# CONFIG_PACKET_MMAP is not set
329CONFIG_UNIX=y
330CONFIG_XFRM=y
331# CONFIG_XFRM_USER is not set
332# CONFIG_XFRM_SUB_POLICY is not set
333# CONFIG_XFRM_MIGRATE is not set
334# CONFIG_XFRM_STATISTICS is not set
335CONFIG_NET_KEY=y
336# CONFIG_NET_KEY_MIGRATE is not set
337CONFIG_INET=y
338# CONFIG_IP_MULTICAST is not set
339# CONFIG_IP_ADVANCED_ROUTER is not set
340CONFIG_IP_FIB_HASH=y
341CONFIG_IP_PNP=y
342CONFIG_IP_PNP_DHCP=y
343CONFIG_IP_PNP_BOOTP=y
344CONFIG_IP_PNP_RARP=y
345# CONFIG_NET_IPIP is not set
346# CONFIG_NET_IPGRE is not set
347# CONFIG_ARPD is not set
348# CONFIG_SYN_COOKIES is not set
349# CONFIG_INET_AH is not set
350# CONFIG_INET_ESP is not set
351# CONFIG_INET_IPCOMP is not set
352# CONFIG_INET_XFRM_TUNNEL is not set
353# CONFIG_INET_TUNNEL is not set
354CONFIG_INET_XFRM_MODE_TRANSPORT=y
355CONFIG_INET_XFRM_MODE_TUNNEL=y
356CONFIG_INET_XFRM_MODE_BEET=y
357# CONFIG_INET_LRO is not set
358CONFIG_INET_DIAG=y
359CONFIG_INET_TCP_DIAG=y
360# CONFIG_TCP_CONG_ADVANCED is not set
361CONFIG_TCP_CONG_CUBIC=y
362CONFIG_DEFAULT_TCP_CONG="cubic"
363# CONFIG_TCP_MD5SIG is not set
364# CONFIG_IPV6 is not set
365# CONFIG_NETWORK_SECMARK is not set
366# CONFIG_NETFILTER is not set
367# CONFIG_IP_DCCP is not set
368# CONFIG_IP_SCTP is not set
369# CONFIG_TIPC is not set
370# CONFIG_ATM is not set
371# CONFIG_BRIDGE is not set
372# CONFIG_NET_DSA is not set
373# CONFIG_VLAN_8021Q is not set
374# CONFIG_DECNET is not set
375# CONFIG_LLC2 is not set
376# CONFIG_IPX is not set
377# CONFIG_ATALK is not set
378# CONFIG_X25 is not set
379# CONFIG_LAPB is not set
380# CONFIG_ECONET is not set
381# CONFIG_WAN_ROUTER is not set
382# CONFIG_NET_SCHED is not set
383
384#
385# Network testing
386#
387# CONFIG_NET_PKTGEN is not set
388# CONFIG_HAMRADIO is not set
389# CONFIG_CAN is not set
390# CONFIG_IRDA is not set
391# CONFIG_BT is not set
392# CONFIG_AF_RXRPC is not set
393# CONFIG_PHONET is not set
394# CONFIG_WIRELESS is not set
395# CONFIG_RFKILL is not set
396# CONFIG_NET_9P is not set
397
398#
399# Device Drivers
400#
401
402#
403# Generic Driver Options
404#
405CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
406CONFIG_STANDALONE=y
407CONFIG_PREVENT_FIRMWARE_BUILD=y
408# CONFIG_FW_LOADER is not set
409# CONFIG_DEBUG_DRIVER is not set
410# CONFIG_DEBUG_DEVRES is not set
411# CONFIG_SYS_HYPERVISOR is not set
412# CONFIG_CONNECTOR is not set
413CONFIG_MTD=y
414# CONFIG_MTD_DEBUG is not set
415# CONFIG_MTD_CONCAT is not set
416CONFIG_MTD_PARTITIONS=y
417# CONFIG_MTD_REDBOOT_PARTS is not set
418# CONFIG_MTD_CMDLINE_PARTS is not set
419# CONFIG_MTD_AFS_PARTS is not set
420# CONFIG_MTD_AR7_PARTS is not set
421
422#
423# User Modules And Translation Layers
424#
425CONFIG_MTD_CHAR=y
426CONFIG_MTD_BLKDEVS=y
427CONFIG_MTD_BLOCK=y
428# CONFIG_FTL is not set
429# CONFIG_NFTL is not set
430# CONFIG_INFTL is not set
431# CONFIG_RFD_FTL is not set
432# CONFIG_SSFDC is not set
433# CONFIG_MTD_OOPS is not set
434
435#
436# RAM/ROM/Flash chip drivers
437#
438# CONFIG_MTD_CFI is not set
439# CONFIG_MTD_JEDECPROBE is not set
440CONFIG_MTD_MAP_BANK_WIDTH_1=y
441CONFIG_MTD_MAP_BANK_WIDTH_2=y
442CONFIG_MTD_MAP_BANK_WIDTH_4=y
443# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
444# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
445# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
446CONFIG_MTD_CFI_I1=y
447CONFIG_MTD_CFI_I2=y
448# CONFIG_MTD_CFI_I4 is not set
449# CONFIG_MTD_CFI_I8 is not set
450# CONFIG_MTD_RAM is not set
451# CONFIG_MTD_ROM is not set
452# CONFIG_MTD_ABSENT is not set
453
454#
455# Mapping drivers for chip access
456#
457# CONFIG_MTD_COMPLEX_MAPPINGS is not set
458# CONFIG_MTD_PLATRAM is not set
459
460#
461# Self-contained MTD device drivers
462#
463# CONFIG_MTD_DATAFLASH is not set
464# CONFIG_MTD_M25P80 is not set
465# CONFIG_MTD_SLRAM is not set
466# CONFIG_MTD_PHRAM is not set
467# CONFIG_MTD_MTDRAM is not set
468# CONFIG_MTD_BLOCK2MTD is not set
469
470#
471# Disk-On-Chip Device Drivers
472#
473# CONFIG_MTD_DOC2000 is not set
474# CONFIG_MTD_DOC2001 is not set
475# CONFIG_MTD_DOC2001PLUS is not set
476CONFIG_MTD_NAND=y
477# CONFIG_MTD_NAND_VERIFY_WRITE is not set
478# CONFIG_MTD_NAND_ECC_SMC is not set
479# CONFIG_MTD_NAND_MUSEUM_IDS is not set
480# CONFIG_MTD_NAND_GPIO is not set
481CONFIG_MTD_NAND_IDS=y
482# CONFIG_MTD_NAND_DISKONCHIP is not set
483# CONFIG_MTD_NAND_NANDSIM is not set
484# CONFIG_MTD_NAND_PLATFORM is not set
485# CONFIG_MTD_ALAUDA is not set
486# CONFIG_MTD_ONENAND is not set
487
488#
489# UBI - Unsorted block images
490#
491# CONFIG_MTD_UBI is not set
492# CONFIG_PARPORT is not set
493CONFIG_BLK_DEV=y
494# CONFIG_BLK_DEV_COW_COMMON is not set
495CONFIG_BLK_DEV_LOOP=y
496# CONFIG_BLK_DEV_CRYPTOLOOP is not set
497# CONFIG_BLK_DEV_NBD is not set
498# CONFIG_BLK_DEV_UB is not set
499CONFIG_BLK_DEV_RAM=y
500CONFIG_BLK_DEV_RAM_COUNT=16
501CONFIG_BLK_DEV_RAM_SIZE=16384
502# CONFIG_BLK_DEV_XIP is not set
503# CONFIG_CDROM_PKTCDVD is not set
504# CONFIG_ATA_OVER_ETH is not set
505# CONFIG_MISC_DEVICES is not set
506CONFIG_HAVE_IDE=y
507# CONFIG_IDE is not set
508
509#
510# SCSI device support
511#
512# CONFIG_RAID_ATTRS is not set
513CONFIG_SCSI=y
514CONFIG_SCSI_DMA=y
515# CONFIG_SCSI_TGT is not set
516# CONFIG_SCSI_NETLINK is not set
517CONFIG_SCSI_PROC_FS=y
518
519#
520# SCSI support type (disk, tape, CD-ROM)
521#
522CONFIG_BLK_DEV_SD=y
523# CONFIG_CHR_DEV_ST is not set
524# CONFIG_CHR_DEV_OSST is not set
525# CONFIG_BLK_DEV_SR is not set
526# CONFIG_CHR_DEV_SG is not set
527# CONFIG_CHR_DEV_SCH is not set
528
529#
530# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
531#
532# CONFIG_SCSI_MULTI_LUN is not set
533# CONFIG_SCSI_CONSTANTS is not set
534# CONFIG_SCSI_LOGGING is not set
535# CONFIG_SCSI_SCAN_ASYNC is not set
536CONFIG_SCSI_WAIT_SCAN=m
537
538#
539# SCSI Transports
540#
541# CONFIG_SCSI_SPI_ATTRS is not set
542# CONFIG_SCSI_FC_ATTRS is not set
543# CONFIG_SCSI_ISCSI_ATTRS is not set
544# CONFIG_SCSI_SAS_LIBSAS is not set
545# CONFIG_SCSI_SRP_ATTRS is not set
546CONFIG_SCSI_LOWLEVEL=y
547# CONFIG_ISCSI_TCP is not set
548# CONFIG_SCSI_DEBUG is not set
549# CONFIG_SCSI_DH is not set
550# CONFIG_ATA is not set
551# CONFIG_MD is not set
552CONFIG_NETDEVICES=y
553# CONFIG_DUMMY is not set
554# CONFIG_BONDING is not set
555# CONFIG_MACVLAN is not set
556# CONFIG_EQUALIZER is not set
557# CONFIG_TUN is not set
558# CONFIG_VETH is not set
559# CONFIG_NET_ETHERNET is not set
560# CONFIG_NETDEV_1000 is not set
561# CONFIG_NETDEV_10000 is not set
562
563#
564# Wireless LAN
565#
566# CONFIG_WLAN_PRE80211 is not set
567# CONFIG_WLAN_80211 is not set
568# CONFIG_IWLWIFI_LEDS is not set
569
570#
571# USB Network Adapters
572#
573# CONFIG_USB_CATC is not set
574# CONFIG_USB_KAWETH is not set
575# CONFIG_USB_PEGASUS is not set
576# CONFIG_USB_RTL8150 is not set
577# CONFIG_USB_USBNET is not set
578# CONFIG_WAN is not set
579# CONFIG_PPP is not set
580# CONFIG_SLIP is not set
581# CONFIG_NETCONSOLE is not set
582# CONFIG_NETPOLL is not set
583# CONFIG_NET_POLL_CONTROLLER is not set
584# CONFIG_ISDN is not set
585
586#
587# Input device support
588#
589CONFIG_INPUT=y
590# CONFIG_INPUT_FF_MEMLESS is not set
591# CONFIG_INPUT_POLLDEV is not set
592
593#
594# Userland interfaces
595#
596CONFIG_INPUT_MOUSEDEV=y
597CONFIG_INPUT_MOUSEDEV_PSAUX=y
598CONFIG_INPUT_MOUSEDEV_SCREEN_X=800
599CONFIG_INPUT_MOUSEDEV_SCREEN_Y=480
600CONFIG_INPUT_JOYDEV=y
601CONFIG_INPUT_EVDEV=y
602# CONFIG_INPUT_EVBUG is not set
603
604#
605# Input Device Drivers
606#
607CONFIG_INPUT_KEYBOARD=y
608# CONFIG_KEYBOARD_ATKBD is not set
609# CONFIG_KEYBOARD_SUNKBD is not set
610# CONFIG_KEYBOARD_LKKBD is not set
611# CONFIG_KEYBOARD_XTKBD is not set
612# CONFIG_KEYBOARD_NEWTON is not set
613# CONFIG_KEYBOARD_STOWAWAY is not set
614# CONFIG_KEYBOARD_GPIO is not set
615CONFIG_INPUT_MOUSE=y
616# CONFIG_MOUSE_PS2 is not set
617# CONFIG_MOUSE_SERIAL is not set
618# CONFIG_MOUSE_APPLETOUCH is not set
619# CONFIG_MOUSE_BCM5974 is not set
620# CONFIG_MOUSE_VSXXXAA is not set
621# CONFIG_MOUSE_GPIO is not set
622# CONFIG_INPUT_JOYSTICK is not set
623# CONFIG_INPUT_TABLET is not set
624CONFIG_INPUT_TOUCHSCREEN=y
625CONFIG_TOUCHSCREEN_ADS7846=y
626# CONFIG_TOUCHSCREEN_FUJITSU is not set
627# CONFIG_TOUCHSCREEN_GUNZE is not set
628# CONFIG_TOUCHSCREEN_ELO is not set
629# CONFIG_TOUCHSCREEN_MTOUCH is not set
630# CONFIG_TOUCHSCREEN_INEXIO is not set
631# CONFIG_TOUCHSCREEN_MK712 is not set
632# CONFIG_TOUCHSCREEN_PENMOUNT is not set
633# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
634# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
635# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
636# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
637# CONFIG_INPUT_MISC is not set
638
639#
640# Hardware I/O ports
641#
642# CONFIG_SERIO is not set
643# CONFIG_GAMEPORT is not set
644
645#
646# Character devices
647#
648CONFIG_VT=y
649CONFIG_CONSOLE_TRANSLATIONS=y
650CONFIG_VT_CONSOLE=y
651CONFIG_HW_CONSOLE=y
652# CONFIG_VT_HW_CONSOLE_BINDING is not set
653CONFIG_DEVKMEM=y
654# CONFIG_SERIAL_NONSTANDARD is not set
655
656#
657# Serial drivers
658#
659CONFIG_SERIAL_8250=y
660CONFIG_SERIAL_8250_CONSOLE=y
661CONFIG_SERIAL_8250_NR_UARTS=32
662CONFIG_SERIAL_8250_RUNTIME_UARTS=4
663CONFIG_SERIAL_8250_EXTENDED=y
664CONFIG_SERIAL_8250_MANY_PORTS=y
665CONFIG_SERIAL_8250_SHARE_IRQ=y
666CONFIG_SERIAL_8250_DETECT_IRQ=y
667CONFIG_SERIAL_8250_RSA=y
668
669#
670# Non-8250 serial port support
671#
672CONFIG_SERIAL_CORE=y
673CONFIG_SERIAL_CORE_CONSOLE=y
674CONFIG_UNIX98_PTYS=y
675# CONFIG_LEGACY_PTYS is not set
676# CONFIG_IPMI_HANDLER is not set
677CONFIG_HW_RANDOM=y
678# CONFIG_NVRAM is not set
679# CONFIG_R3964 is not set
680# CONFIG_RAW_DRIVER is not set
681# CONFIG_TCG_TPM is not set
682CONFIG_I2C=y
683CONFIG_I2C_BOARDINFO=y
684CONFIG_I2C_CHARDEV=y
685CONFIG_I2C_HELPER_AUTO=y
686
687#
688# I2C Hardware Bus support
689#
690
691#
692# I2C system bus drivers (mostly embedded / system-on-chip)
693#
694# CONFIG_I2C_GPIO is not set
695# CONFIG_I2C_OCORES is not set
696CONFIG_I2C_OMAP=y
697# CONFIG_I2C_SIMTEC is not set
698
699#
700# External I2C/SMBus adapter drivers
701#
702# CONFIG_I2C_PARPORT_LIGHT is not set
703# CONFIG_I2C_TAOS_EVM is not set
704# CONFIG_I2C_TINY_USB is not set
705
706#
707# Other I2C/SMBus bus drivers
708#
709# CONFIG_I2C_PCA_PLATFORM is not set
710# CONFIG_I2C_STUB is not set
711
712#
713# Miscellaneous I2C Chip support
714#
715# CONFIG_DS1682 is not set
716# CONFIG_AT24 is not set
717# CONFIG_SENSORS_EEPROM is not set
718# CONFIG_SENSORS_PCF8574 is not set
719# CONFIG_PCF8575 is not set
720# CONFIG_SENSORS_PCA9539 is not set
721# CONFIG_SENSORS_PCF8591 is not set
722# CONFIG_ISP1301_OMAP is not set
723# CONFIG_TPS65010 is not set
724# CONFIG_SENSORS_MAX6875 is not set
725# CONFIG_SENSORS_TSL2550 is not set
726# CONFIG_I2C_DEBUG_CORE is not set
727# CONFIG_I2C_DEBUG_ALGO is not set
728# CONFIG_I2C_DEBUG_BUS is not set
729# CONFIG_I2C_DEBUG_CHIP is not set
730CONFIG_SPI=y
731# CONFIG_SPI_DEBUG is not set
732CONFIG_SPI_MASTER=y
733
734#
735# SPI Master Controller Drivers
736#
737# CONFIG_SPI_BITBANG is not set
738CONFIG_SPI_OMAP24XX=y
739
740#
741# SPI Protocol Masters
742#
743# CONFIG_SPI_AT25 is not set
744# CONFIG_SPI_SPIDEV is not set
745# CONFIG_SPI_TLE62X0 is not set
746CONFIG_ARCH_REQUIRE_GPIOLIB=y
747CONFIG_GPIOLIB=y
748# CONFIG_DEBUG_GPIO is not set
749# CONFIG_GPIO_SYSFS is not set
750
751#
752# Memory mapped GPIO expanders:
753#
754
755#
756# I2C GPIO expanders:
757#
758# CONFIG_GPIO_MAX732X is not set
759# CONFIG_GPIO_PCA953X is not set
760# CONFIG_GPIO_PCF857X is not set
761CONFIG_GPIO_TWL4030=y
762
763#
764# PCI GPIO expanders:
765#
766
767#
768# SPI GPIO expanders:
769#
770# CONFIG_GPIO_MAX7301 is not set
771# CONFIG_GPIO_MCP23S08 is not set
772# CONFIG_W1 is not set
773# CONFIG_POWER_SUPPLY is not set
774# CONFIG_HWMON is not set
775# CONFIG_THERMAL is not set
776# CONFIG_THERMAL_HWMON is not set
777# CONFIG_WATCHDOG is not set
778CONFIG_SSB_POSSIBLE=y
779
780#
781# Sonics Silicon Backplane
782#
783# CONFIG_SSB is not set
784
785#
786# Multifunction device drivers
787#
788# CONFIG_MFD_CORE is not set
789# CONFIG_MFD_SM501 is not set
790# CONFIG_MFD_ASIC3 is not set
791# CONFIG_HTC_EGPIO is not set
792# CONFIG_HTC_PASIC3 is not set
793CONFIG_TWL4030_CORE=y
794# CONFIG_MFD_TMIO is not set
795# CONFIG_MFD_T7L66XB is not set
796# CONFIG_MFD_TC6387XB is not set
797# CONFIG_MFD_TC6393XB is not set
798# CONFIG_PMIC_DA903X is not set
799# CONFIG_MFD_WM8400 is not set
800# CONFIG_MFD_WM8350_I2C is not set
801
802#
803# Multimedia devices
804#
805
806#
807# Multimedia core support
808#
809# CONFIG_VIDEO_DEV is not set
810# CONFIG_DVB_CORE is not set
811# CONFIG_VIDEO_MEDIA is not set
812
813#
814# Multimedia drivers
815#
816CONFIG_DAB=y
817# CONFIG_USB_DABUSB is not set
818
819#
820# Graphics support
821#
822# CONFIG_VGASTATE is not set
823# CONFIG_VIDEO_OUTPUT_CONTROL is not set
824# CONFIG_FB is not set
825# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
826
827#
828# Display device support
829#
830# CONFIG_DISPLAY_SUPPORT is not set
831
832#
833# Console display driver support
834#
835# CONFIG_VGA_CONSOLE is not set
836CONFIG_DUMMY_CONSOLE=y
837# CONFIG_SOUND is not set
838CONFIG_HID_SUPPORT=y
839CONFIG_HID=y
840# CONFIG_HID_DEBUG is not set
841# CONFIG_HIDRAW is not set
842
843#
844# USB Input Devices
845#
846CONFIG_USB_HID=y
847# CONFIG_HID_PID is not set
848# CONFIG_USB_HIDDEV is not set
849
850#
851# Special HID drivers
852#
853# CONFIG_HID_COMPAT is not set
854# CONFIG_HID_A4TECH is not set
855# CONFIG_HID_APPLE is not set
856# CONFIG_HID_BELKIN is not set
857# CONFIG_HID_BRIGHT is not set
858# CONFIG_HID_CHERRY is not set
859# CONFIG_HID_CHICONY is not set
860# CONFIG_HID_CYPRESS is not set
861# CONFIG_HID_DELL is not set
862# CONFIG_HID_EZKEY is not set
863# CONFIG_HID_GYRATION is not set
864# CONFIG_HID_LOGITECH is not set
865# CONFIG_HID_MICROSOFT is not set
866# CONFIG_HID_MONTEREY is not set
867# CONFIG_HID_PANTHERLORD is not set
868# CONFIG_HID_PETALYNX is not set
869# CONFIG_HID_SAMSUNG is not set
870# CONFIG_HID_SONY is not set
871# CONFIG_HID_SUNPLUS is not set
872# CONFIG_THRUSTMASTER_FF is not set
873# CONFIG_ZEROPLUS_FF is not set
874CONFIG_USB_SUPPORT=y
875CONFIG_USB_ARCH_HAS_HCD=y
876CONFIG_USB_ARCH_HAS_OHCI=y
877# CONFIG_USB_ARCH_HAS_EHCI is not set
878CONFIG_USB=y
879# CONFIG_USB_DEBUG is not set
880# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
881
882#
883# Miscellaneous USB options
884#
885CONFIG_USB_DEVICEFS=y
886CONFIG_USB_DEVICE_CLASS=y
887# CONFIG_USB_DYNAMIC_MINORS is not set
888# CONFIG_USB_OTG is not set
889# CONFIG_USB_OTG_WHITELIST is not set
890# CONFIG_USB_OTG_BLACKLIST_HUB is not set
891CONFIG_USB_MON=y
892# CONFIG_USB_WUSB is not set
893# CONFIG_USB_WUSB_CBAF is not set
894
895#
896# USB Host Controller Drivers
897#
898# CONFIG_USB_C67X00_HCD is not set
899# CONFIG_USB_ISP116X_HCD is not set
900# CONFIG_USB_OHCI_HCD is not set
901# CONFIG_USB_SL811_HCD is not set
902# CONFIG_USB_R8A66597_HCD is not set
903# CONFIG_USB_HWA_HCD is not set
904CONFIG_USB_MUSB_HDRC=y
905CONFIG_USB_MUSB_SOC=y
906
907#
908# OMAP 343x high speed USB support
909#
910CONFIG_USB_MUSB_HOST=y
911# CONFIG_USB_MUSB_PERIPHERAL is not set
912# CONFIG_USB_MUSB_OTG is not set
913# CONFIG_USB_GADGET_MUSB_HDRC is not set
914CONFIG_USB_MUSB_HDRC_HCD=y
915# CONFIG_MUSB_PIO_ONLY is not set
916CONFIG_USB_INVENTRA_DMA=y
917# CONFIG_USB_TI_CPPI_DMA is not set
918# CONFIG_USB_MUSB_DEBUG is not set
919
920#
921# USB Device Class drivers
922#
923# CONFIG_USB_ACM is not set
924# CONFIG_USB_PRINTER is not set
925# CONFIG_USB_WDM is not set
926# CONFIG_USB_TMC is not set
927
928#
929# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
930#
931
932#
933# see USB_STORAGE Help for more information
934#
935# CONFIG_USB_STORAGE is not set
936# CONFIG_USB_LIBUSUAL is not set
937
938#
939# USB Imaging devices
940#
941# CONFIG_USB_MDC800 is not set
942# CONFIG_USB_MICROTEK is not set
943
944#
945# USB port drivers
946#
947# CONFIG_USB_SERIAL is not set
948
949#
950# USB Miscellaneous drivers
951#
952# CONFIG_USB_EMI62 is not set
953# CONFIG_USB_EMI26 is not set
954# CONFIG_USB_ADUTUX is not set
955# CONFIG_USB_SEVSEG is not set
956# CONFIG_USB_RIO500 is not set
957# CONFIG_USB_LEGOTOWER is not set
958# CONFIG_USB_LCD is not set
959# CONFIG_USB_BERRY_CHARGE is not set
960# CONFIG_USB_LED is not set
961# CONFIG_USB_CYPRESS_CY7C63 is not set
962# CONFIG_USB_CYTHERM is not set
963# CONFIG_USB_PHIDGET is not set
964# CONFIG_USB_IDMOUSE is not set
965# CONFIG_USB_FTDI_ELAN is not set
966# CONFIG_USB_APPLEDISPLAY is not set
967# CONFIG_USB_LD is not set
968# CONFIG_USB_TRANCEVIBRATOR is not set
969# CONFIG_USB_IOWARRIOR is not set
970# CONFIG_USB_TEST is not set
971# CONFIG_USB_ISIGHTFW is not set
972# CONFIG_USB_VST is not set
973CONFIG_USB_GADGET=y
974# CONFIG_USB_GADGET_DEBUG is not set
975# CONFIG_USB_GADGET_DEBUG_FILES is not set
976CONFIG_USB_GADGET_VBUS_DRAW=2
977CONFIG_USB_GADGET_SELECTED=y
978# CONFIG_USB_GADGET_AT91 is not set
979# CONFIG_USB_GADGET_ATMEL_USBA is not set
980# CONFIG_USB_GADGET_FSL_USB2 is not set
981# CONFIG_USB_GADGET_LH7A40X is not set
982CONFIG_USB_GADGET_OMAP=y
983CONFIG_USB_OMAP=y
984# CONFIG_USB_GADGET_PXA25X is not set
985# CONFIG_USB_GADGET_PXA27X is not set
986# CONFIG_USB_GADGET_S3C2410 is not set
987# CONFIG_USB_GADGET_M66592 is not set
988# CONFIG_USB_GADGET_AMD5536UDC is not set
989# CONFIG_USB_GADGET_FSL_QE is not set
990# CONFIG_USB_GADGET_NET2280 is not set
991# CONFIG_USB_GADGET_GOKU is not set
992# CONFIG_USB_GADGET_DUMMY_HCD is not set
993# CONFIG_USB_GADGET_DUALSPEED is not set
994# CONFIG_USB_ZERO is not set
995CONFIG_USB_ETH=y
996CONFIG_USB_ETH_RNDIS=y
997# CONFIG_USB_GADGETFS is not set
998# CONFIG_USB_FILE_STORAGE is not set
999# CONFIG_USB_G_SERIAL is not set
1000# CONFIG_USB_MIDI_GADGET is not set
1001# CONFIG_USB_G_PRINTER is not set
1002# CONFIG_USB_CDC_COMPOSITE is not set
1003CONFIG_MMC=y
1004# CONFIG_MMC_DEBUG is not set
1005# CONFIG_MMC_UNSAFE_RESUME is not set
1006
1007#
1008# MMC/SD/SDIO Card Drivers
1009#
1010CONFIG_MMC_BLOCK=y
1011CONFIG_MMC_BLOCK_BOUNCE=y
1012# CONFIG_SDIO_UART is not set
1013# CONFIG_MMC_TEST is not set
1014
1015#
1016# MMC/SD/SDIO Host Controller Drivers
1017#
1018# CONFIG_MMC_SDHCI is not set
1019# CONFIG_MMC_OMAP is not set
1020# CONFIG_MMC_SPI is not set
1021# CONFIG_MEMSTICK is not set
1022# CONFIG_ACCESSIBILITY is not set
1023# CONFIG_NEW_LEDS is not set
1024CONFIG_RTC_LIB=y
1025CONFIG_RTC_CLASS=y
1026CONFIG_RTC_HCTOSYS=y
1027CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
1028# CONFIG_RTC_DEBUG is not set
1029
1030#
1031# RTC interfaces
1032#
1033CONFIG_RTC_INTF_SYSFS=y
1034CONFIG_RTC_INTF_PROC=y
1035CONFIG_RTC_INTF_DEV=y
1036# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1037# CONFIG_RTC_DRV_TEST is not set
1038
1039#
1040# I2C RTC drivers
1041#
1042# CONFIG_RTC_DRV_DS1307 is not set
1043# CONFIG_RTC_DRV_DS1374 is not set
1044# CONFIG_RTC_DRV_DS1672 is not set
1045# CONFIG_RTC_DRV_MAX6900 is not set
1046# CONFIG_RTC_DRV_RS5C372 is not set
1047# CONFIG_RTC_DRV_ISL1208 is not set
1048# CONFIG_RTC_DRV_X1205 is not set
1049# CONFIG_RTC_DRV_PCF8563 is not set
1050# CONFIG_RTC_DRV_PCF8583 is not set
1051# CONFIG_RTC_DRV_M41T80 is not set
1052CONFIG_RTC_DRV_TWL4030=y
1053# CONFIG_RTC_DRV_S35390A is not set
1054# CONFIG_RTC_DRV_FM3130 is not set
1055# CONFIG_RTC_DRV_RX8581 is not set
1056
1057#
1058# SPI RTC drivers
1059#
1060# CONFIG_RTC_DRV_M41T94 is not set
1061# CONFIG_RTC_DRV_DS1305 is not set
1062# CONFIG_RTC_DRV_DS1390 is not set
1063# CONFIG_RTC_DRV_MAX6902 is not set
1064# CONFIG_RTC_DRV_R9701 is not set
1065# CONFIG_RTC_DRV_RS5C348 is not set
1066# CONFIG_RTC_DRV_DS3234 is not set
1067
1068#
1069# Platform RTC drivers
1070#
1071# CONFIG_RTC_DRV_CMOS is not set
1072# CONFIG_RTC_DRV_DS1286 is not set
1073# CONFIG_RTC_DRV_DS1511 is not set
1074# CONFIG_RTC_DRV_DS1553 is not set
1075# CONFIG_RTC_DRV_DS1742 is not set
1076# CONFIG_RTC_DRV_STK17TA8 is not set
1077# CONFIG_RTC_DRV_M48T86 is not set
1078# CONFIG_RTC_DRV_M48T35 is not set
1079# CONFIG_RTC_DRV_M48T59 is not set
1080# CONFIG_RTC_DRV_BQ4802 is not set
1081# CONFIG_RTC_DRV_V3020 is not set
1082
1083#
1084# on-CPU RTC drivers
1085#
1086# CONFIG_DMADEVICES is not set
1087# CONFIG_REGULATOR is not set
1088# CONFIG_UIO is not set
1089
1090#
1091# File systems
1092#
1093CONFIG_EXT2_FS=y
1094# CONFIG_EXT2_FS_XATTR is not set
1095# CONFIG_EXT2_FS_XIP is not set
1096CONFIG_EXT3_FS=y
1097# CONFIG_EXT3_FS_XATTR is not set
1098# CONFIG_EXT4_FS is not set
1099CONFIG_JBD=y
1100# CONFIG_REISERFS_FS is not set
1101# CONFIG_JFS_FS is not set
1102# CONFIG_FS_POSIX_ACL is not set
1103CONFIG_FILE_LOCKING=y
1104# CONFIG_XFS_FS is not set
1105# CONFIG_OCFS2_FS is not set
1106CONFIG_DNOTIFY=y
1107CONFIG_INOTIFY=y
1108CONFIG_INOTIFY_USER=y
1109CONFIG_QUOTA=y
1110# CONFIG_QUOTA_NETLINK_INTERFACE is not set
1111CONFIG_PRINT_QUOTA_WARNING=y
1112# CONFIG_QFMT_V1 is not set
1113CONFIG_QFMT_V2=y
1114CONFIG_QUOTACTL=y
1115# CONFIG_AUTOFS_FS is not set
1116# CONFIG_AUTOFS4_FS is not set
1117# CONFIG_FUSE_FS is not set
1118
1119#
1120# CD-ROM/DVD Filesystems
1121#
1122# CONFIG_ISO9660_FS is not set
1123# CONFIG_UDF_FS is not set
1124
1125#
1126# DOS/FAT/NT Filesystems
1127#
1128CONFIG_FAT_FS=y
1129CONFIG_MSDOS_FS=y
1130CONFIG_VFAT_FS=y
1131CONFIG_FAT_DEFAULT_CODEPAGE=437
1132CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1133# CONFIG_NTFS_FS is not set
1134
1135#
1136# Pseudo filesystems
1137#
1138CONFIG_PROC_FS=y
1139CONFIG_PROC_SYSCTL=y
1140CONFIG_PROC_PAGE_MONITOR=y
1141CONFIG_SYSFS=y
1142CONFIG_TMPFS=y
1143# CONFIG_TMPFS_POSIX_ACL is not set
1144# CONFIG_HUGETLB_PAGE is not set
1145# CONFIG_CONFIGFS_FS is not set
1146
1147#
1148# Miscellaneous filesystems
1149#
1150# CONFIG_ADFS_FS is not set
1151# CONFIG_AFFS_FS is not set
1152# CONFIG_HFS_FS is not set
1153# CONFIG_HFSPLUS_FS is not set
1154# CONFIG_BEFS_FS is not set
1155# CONFIG_BFS_FS is not set
1156# CONFIG_EFS_FS is not set
1157# CONFIG_JFFS2_FS is not set
1158# CONFIG_CRAMFS is not set
1159# CONFIG_VXFS_FS is not set
1160# CONFIG_MINIX_FS is not set
1161# CONFIG_OMFS_FS is not set
1162# CONFIG_HPFS_FS is not set
1163# CONFIG_QNX4FS_FS is not set
1164# CONFIG_ROMFS_FS is not set
1165# CONFIG_SYSV_FS is not set
1166# CONFIG_UFS_FS is not set
1167# CONFIG_NETWORK_FILESYSTEMS is not set
1168
1169#
1170# Partition Types
1171#
1172CONFIG_PARTITION_ADVANCED=y
1173# CONFIG_ACORN_PARTITION is not set
1174# CONFIG_OSF_PARTITION is not set
1175# CONFIG_AMIGA_PARTITION is not set
1176# CONFIG_ATARI_PARTITION is not set
1177# CONFIG_MAC_PARTITION is not set
1178CONFIG_MSDOS_PARTITION=y
1179# CONFIG_BSD_DISKLABEL is not set
1180# CONFIG_MINIX_SUBPARTITION is not set
1181# CONFIG_SOLARIS_X86_PARTITION is not set
1182# CONFIG_UNIXWARE_DISKLABEL is not set
1183# CONFIG_LDM_PARTITION is not set
1184# CONFIG_SGI_PARTITION is not set
1185# CONFIG_ULTRIX_PARTITION is not set
1186# CONFIG_SUN_PARTITION is not set
1187# CONFIG_KARMA_PARTITION is not set
1188# CONFIG_EFI_PARTITION is not set
1189# CONFIG_SYSV68_PARTITION is not set
1190CONFIG_NLS=y
1191CONFIG_NLS_DEFAULT="iso8859-1"
1192CONFIG_NLS_CODEPAGE_437=y
1193# CONFIG_NLS_CODEPAGE_737 is not set
1194# CONFIG_NLS_CODEPAGE_775 is not set
1195# CONFIG_NLS_CODEPAGE_850 is not set
1196# CONFIG_NLS_CODEPAGE_852 is not set
1197# CONFIG_NLS_CODEPAGE_855 is not set
1198# CONFIG_NLS_CODEPAGE_857 is not set
1199# CONFIG_NLS_CODEPAGE_860 is not set
1200# CONFIG_NLS_CODEPAGE_861 is not set
1201# CONFIG_NLS_CODEPAGE_862 is not set
1202# CONFIG_NLS_CODEPAGE_863 is not set
1203# CONFIG_NLS_CODEPAGE_864 is not set
1204# CONFIG_NLS_CODEPAGE_865 is not set
1205# CONFIG_NLS_CODEPAGE_866 is not set
1206# CONFIG_NLS_CODEPAGE_869 is not set
1207# CONFIG_NLS_CODEPAGE_936 is not set
1208# CONFIG_NLS_CODEPAGE_950 is not set
1209# CONFIG_NLS_CODEPAGE_932 is not set
1210# CONFIG_NLS_CODEPAGE_949 is not set
1211# CONFIG_NLS_CODEPAGE_874 is not set
1212# CONFIG_NLS_ISO8859_8 is not set
1213# CONFIG_NLS_CODEPAGE_1250 is not set
1214# CONFIG_NLS_CODEPAGE_1251 is not set
1215# CONFIG_NLS_ASCII is not set
1216CONFIG_NLS_ISO8859_1=y
1217# CONFIG_NLS_ISO8859_2 is not set
1218# CONFIG_NLS_ISO8859_3 is not set
1219# CONFIG_NLS_ISO8859_4 is not set
1220# CONFIG_NLS_ISO8859_5 is not set
1221# CONFIG_NLS_ISO8859_6 is not set
1222# CONFIG_NLS_ISO8859_7 is not set
1223# CONFIG_NLS_ISO8859_9 is not set
1224# CONFIG_NLS_ISO8859_13 is not set
1225# CONFIG_NLS_ISO8859_14 is not set
1226# CONFIG_NLS_ISO8859_15 is not set
1227# CONFIG_NLS_KOI8_R is not set
1228# CONFIG_NLS_KOI8_U is not set
1229# CONFIG_NLS_UTF8 is not set
1230# CONFIG_DLM is not set
1231
1232#
1233# Kernel hacking
1234#
1235# CONFIG_PRINTK_TIME is not set
1236CONFIG_ENABLE_WARN_DEPRECATED=y
1237CONFIG_ENABLE_MUST_CHECK=y
1238CONFIG_FRAME_WARN=1024
1239CONFIG_MAGIC_SYSRQ=y
1240# CONFIG_UNUSED_SYMBOLS is not set
1241# CONFIG_DEBUG_FS is not set
1242# CONFIG_HEADERS_CHECK is not set
1243CONFIG_DEBUG_KERNEL=y
1244# CONFIG_DEBUG_SHIRQ is not set
1245CONFIG_DETECT_SOFTLOCKUP=y
1246# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1247CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1248CONFIG_SCHED_DEBUG=y
1249# CONFIG_SCHEDSTATS is not set
1250# CONFIG_TIMER_STATS is not set
1251# CONFIG_DEBUG_OBJECTS is not set
1252# CONFIG_DEBUG_SLAB is not set
1253# CONFIG_DEBUG_RT_MUTEXES is not set
1254# CONFIG_RT_MUTEX_TESTER is not set
1255# CONFIG_DEBUG_SPINLOCK is not set
1256CONFIG_DEBUG_MUTEXES=y
1257# CONFIG_DEBUG_LOCK_ALLOC is not set
1258# CONFIG_PROVE_LOCKING is not set
1259# CONFIG_LOCK_STAT is not set
1260# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1261# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1262# CONFIG_DEBUG_KOBJECT is not set
1263# CONFIG_DEBUG_BUGVERBOSE is not set
1264CONFIG_DEBUG_INFO=y
1265# CONFIG_DEBUG_VM is not set
1266# CONFIG_DEBUG_WRITECOUNT is not set
1267# CONFIG_DEBUG_MEMORY_INIT is not set
1268# CONFIG_DEBUG_LIST is not set
1269# CONFIG_DEBUG_SG is not set
1270CONFIG_FRAME_POINTER=y
1271# CONFIG_BOOT_PRINTK_DELAY is not set
1272# CONFIG_RCU_TORTURE_TEST is not set
1273# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1274# CONFIG_BACKTRACE_SELF_TEST is not set
1275# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1276# CONFIG_FAULT_INJECTION is not set
1277# CONFIG_LATENCYTOP is not set
1278CONFIG_HAVE_FUNCTION_TRACER=y
1279
1280#
1281# Tracers
1282#
1283# CONFIG_FUNCTION_TRACER is not set
1284# CONFIG_IRQSOFF_TRACER is not set
1285# CONFIG_SCHED_TRACER is not set
1286# CONFIG_CONTEXT_SWITCH_TRACER is not set
1287# CONFIG_BOOT_TRACER is not set
1288# CONFIG_STACK_TRACER is not set
1289# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1290# CONFIG_SAMPLES is not set
1291CONFIG_HAVE_ARCH_KGDB=y
1292# CONFIG_KGDB is not set
1293# CONFIG_DEBUG_USER is not set
1294# CONFIG_DEBUG_ERRORS is not set
1295# CONFIG_DEBUG_STACK_USAGE is not set
1296# CONFIG_DEBUG_LL is not set
1297
1298#
1299# Security options
1300#
1301# CONFIG_KEYS is not set
1302# CONFIG_SECURITY is not set
1303# CONFIG_SECURITYFS is not set
1304# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1305CONFIG_CRYPTO=y
1306
1307#
1308# Crypto core or helper
1309#
1310# CONFIG_CRYPTO_FIPS is not set
1311CONFIG_CRYPTO_ALGAPI=y
1312CONFIG_CRYPTO_AEAD=y
1313CONFIG_CRYPTO_BLKCIPHER=y
1314CONFIG_CRYPTO_HASH=y
1315CONFIG_CRYPTO_RNG=y
1316CONFIG_CRYPTO_MANAGER=y
1317# CONFIG_CRYPTO_GF128MUL is not set
1318# CONFIG_CRYPTO_NULL is not set
1319# CONFIG_CRYPTO_CRYPTD is not set
1320# CONFIG_CRYPTO_AUTHENC is not set
1321# CONFIG_CRYPTO_TEST is not set
1322
1323#
1324# Authenticated Encryption with Associated Data
1325#
1326# CONFIG_CRYPTO_CCM is not set
1327# CONFIG_CRYPTO_GCM is not set
1328# CONFIG_CRYPTO_SEQIV is not set
1329
1330#
1331# Block modes
1332#
1333CONFIG_CRYPTO_CBC=y
1334# CONFIG_CRYPTO_CTR is not set
1335# CONFIG_CRYPTO_CTS is not set
1336CONFIG_CRYPTO_ECB=m
1337# CONFIG_CRYPTO_LRW is not set
1338CONFIG_CRYPTO_PCBC=m
1339# CONFIG_CRYPTO_XTS is not set
1340
1341#
1342# Hash modes
1343#
1344# CONFIG_CRYPTO_HMAC is not set
1345# CONFIG_CRYPTO_XCBC is not set
1346
1347#
1348# Digest
1349#
1350# CONFIG_CRYPTO_CRC32C is not set
1351# CONFIG_CRYPTO_MD4 is not set
1352CONFIG_CRYPTO_MD5=y
1353# CONFIG_CRYPTO_MICHAEL_MIC is not set
1354# CONFIG_CRYPTO_RMD128 is not set
1355# CONFIG_CRYPTO_RMD160 is not set
1356# CONFIG_CRYPTO_RMD256 is not set
1357# CONFIG_CRYPTO_RMD320 is not set
1358# CONFIG_CRYPTO_SHA1 is not set
1359# CONFIG_CRYPTO_SHA256 is not set
1360# CONFIG_CRYPTO_SHA512 is not set
1361# CONFIG_CRYPTO_TGR192 is not set
1362# CONFIG_CRYPTO_WP512 is not set
1363
1364#
1365# Ciphers
1366#
1367# CONFIG_CRYPTO_AES is not set
1368# CONFIG_CRYPTO_ANUBIS is not set
1369# CONFIG_CRYPTO_ARC4 is not set
1370# CONFIG_CRYPTO_BLOWFISH is not set
1371# CONFIG_CRYPTO_CAMELLIA is not set
1372# CONFIG_CRYPTO_CAST5 is not set
1373# CONFIG_CRYPTO_CAST6 is not set
1374CONFIG_CRYPTO_DES=y
1375# CONFIG_CRYPTO_FCRYPT is not set
1376# CONFIG_CRYPTO_KHAZAD is not set
1377# CONFIG_CRYPTO_SALSA20 is not set
1378# CONFIG_CRYPTO_SEED is not set
1379# CONFIG_CRYPTO_SERPENT is not set
1380# CONFIG_CRYPTO_TEA is not set
1381# CONFIG_CRYPTO_TWOFISH is not set
1382
1383#
1384# Compression
1385#
1386# CONFIG_CRYPTO_DEFLATE is not set
1387# CONFIG_CRYPTO_LZO is not set
1388
1389#
1390# Random Number Generation
1391#
1392# CONFIG_CRYPTO_ANSI_CPRNG is not set
1393CONFIG_CRYPTO_HW=y
1394
1395#
1396# Library routines
1397#
1398CONFIG_BITREVERSE=y
1399CONFIG_CRC_CCITT=y
1400# CONFIG_CRC16 is not set
1401# CONFIG_CRC_T10DIF is not set
1402# CONFIG_CRC_ITU_T is not set
1403CONFIG_CRC32=y
1404# CONFIG_CRC7 is not set
1405CONFIG_LIBCRC32C=y
1406CONFIG_PLIST=y
1407CONFIG_HAS_IOMEM=y
1408CONFIG_HAS_IOPORT=y
1409CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/omap_ldp_defconfig b/arch/arm/configs/omap_ldp_defconfig
index 948a212fb1cc..b77d054169ee 100644
--- a/arch/arm/configs/omap_ldp_defconfig
+++ b/arch/arm/configs/omap_ldp_defconfig
@@ -316,7 +316,82 @@ CONFIG_BINFMT_MISC=y
316# 316#
317# CONFIG_PM is not set 317# CONFIG_PM is not set
318CONFIG_ARCH_SUSPEND_POSSIBLE=y 318CONFIG_ARCH_SUSPEND_POSSIBLE=y
319# CONFIG_NET is not set 319CONFIG_NET=y
320
321#
322# Networking options
323#
324CONFIG_PACKET=y
325# CONFIG_PACKET_MMAP is not set
326CONFIG_UNIX=y
327CONFIG_XFRM=y
328CONFIG_XFRM_USER=y
329# CONFIG_XFRM_SUB_POLICY is not set
330CONFIG_XFRM_MIGRATE=y
331# CONFIG_XFRM_STATISTICS is not set
332CONFIG_NET_KEY=y
333CONFIG_NET_KEY_MIGRATE=y
334CONFIG_INET=y
335CONFIG_IP_MULTICAST=y
336# CONFIG_IP_ADVANCED_ROUTER is not set
337CONFIG_IP_FIB_HASH=y
338CONFIG_IP_PNP=y
339CONFIG_IP_PNP_DHCP=y
340CONFIG_IP_PNP_BOOTP=y
341CONFIG_IP_PNP_RARP=y
342# CONFIG_NET_IPIP is not set
343# CONFIG_NET_IPGRE is not set
344# CONFIG_IP_MROUTE is not set
345# CONFIG_ARPD is not set
346# CONFIG_SYN_COOKIES is not set
347# CONFIG_INET_AH is not set
348# CONFIG_INET_ESP is not set
349# CONFIG_INET_IPCOMP is not set
350# CONFIG_INET_XFRM_TUNNEL is not set
351# CONFIG_INET_TUNNEL is not set
352CONFIG_INET_XFRM_MODE_TRANSPORT=y
353CONFIG_INET_XFRM_MODE_TUNNEL=y
354CONFIG_INET_XFRM_MODE_BEET=y
355# CONFIG_INET_LRO is not set
356CONFIG_INET_DIAG=y
357CONFIG_INET_TCP_DIAG=y
358# CONFIG_TCP_CONG_ADVANCED is not set
359CONFIG_TCP_CONG_CUBIC=y
360CONFIG_DEFAULT_TCP_CONG="cubic"
361# CONFIG_TCP_MD5SIG is not set
362# CONFIG_IPV6 is not set
363# CONFIG_NETWORK_SECMARK is not set
364# CONFIG_NETFILTER is not set
365# CONFIG_IP_DCCP is not set
366# CONFIG_IP_SCTP is not set
367# CONFIG_TIPC is not set
368# CONFIG_ATM is not set
369# CONFIG_BRIDGE is not set
370# CONFIG_NET_DSA is not set
371# CONFIG_VLAN_8021Q is not set
372# CONFIG_DECNET is not set
373# CONFIG_LLC2 is not set
374# CONFIG_IPX is not set
375# CONFIG_ATALK is not set
376# CONFIG_X25 is not set
377# CONFIG_LAPB is not set
378# CONFIG_ECONET is not set
379# CONFIG_WAN_ROUTER is not set
380# CONFIG_NET_SCHED is not set
381
382#
383# Network testing
384#
385# CONFIG_NET_PKTGEN is not set
386# CONFIG_HAMRADIO is not set
387# CONFIG_CAN is not set
388# CONFIG_IRDA is not set
389# CONFIG_BT is not set
390# CONFIG_AF_RXRPC is not set
391# CONFIG_PHONET is not set
392# CONFIG_WIRELESS is not set
393# CONFIG_RFKILL is not set
394# CONFIG_NET_9P is not set
320 395
321# 396#
322# Device Drivers 397# Device Drivers
@@ -332,6 +407,8 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
332# CONFIG_DEBUG_DRIVER is not set 407# CONFIG_DEBUG_DRIVER is not set
333# CONFIG_DEBUG_DEVRES is not set 408# CONFIG_DEBUG_DEVRES is not set
334# CONFIG_SYS_HYPERVISOR is not set 409# CONFIG_SYS_HYPERVISOR is not set
410CONFIG_CONNECTOR=y
411CONFIG_PROC_EVENTS=y
335# CONFIG_MTD is not set 412# CONFIG_MTD is not set
336# CONFIG_PARPORT is not set 413# CONFIG_PARPORT is not set
337CONFIG_BLK_DEV=y 414CONFIG_BLK_DEV=y
@@ -390,6 +467,54 @@ CONFIG_SCSI_LOWLEVEL=y
390# CONFIG_SCSI_DH is not set 467# CONFIG_SCSI_DH is not set
391# CONFIG_ATA is not set 468# CONFIG_ATA is not set
392# CONFIG_MD is not set 469# CONFIG_MD is not set
470CONFIG_NETDEVICES=y
471# CONFIG_DUMMY is not set
472# CONFIG_BONDING is not set
473# CONFIG_MACVLAN is not set
474# CONFIG_EQUALIZER is not set
475# CONFIG_TUN is not set
476# CONFIG_VETH is not set
477# CONFIG_PHYLIB is not set
478CONFIG_NET_ETHERNET=y
479CONFIG_MII=y
480# CONFIG_AX88796 is not set
481# CONFIG_SMC91X is not set
482# CONFIG_DM9000 is not set
483# CONFIG_ENC28J60 is not set
484CONFIG_SMC911X=y
485# CONFIG_IBM_NEW_EMAC_ZMII is not set
486# CONFIG_IBM_NEW_EMAC_RGMII is not set
487# CONFIG_IBM_NEW_EMAC_TAH is not set
488# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
489# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
490# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
491# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
492# CONFIG_B44 is not set
493CONFIG_NETDEV_1000=y
494CONFIG_NETDEV_10000=y
495
496#
497# Wireless LAN
498#
499# CONFIG_WLAN_PRE80211 is not set
500# CONFIG_WLAN_80211 is not set
501# CONFIG_IWLWIFI_LEDS is not set
502
503#
504# USB Network Adapters
505#
506# CONFIG_USB_CATC is not set
507# CONFIG_USB_KAWETH is not set
508# CONFIG_USB_PEGASUS is not set
509# CONFIG_USB_RTL8150 is not set
510# CONFIG_USB_USBNET is not set
511# CONFIG_WAN is not set
512# CONFIG_PPP is not set
513# CONFIG_SLIP is not set
514# CONFIG_NETCONSOLE is not set
515# CONFIG_NETPOLL is not set
516# CONFIG_NET_POLL_CONTROLLER is not set
517# CONFIG_ISDN is not set
393 518
394# 519#
395# Input device support 520# Input device support
@@ -816,6 +941,27 @@ CONFIG_TMPFS=y
816# CONFIG_ROMFS_FS is not set 941# CONFIG_ROMFS_FS is not set
817# CONFIG_SYSV_FS is not set 942# CONFIG_SYSV_FS is not set
818# CONFIG_UFS_FS is not set 943# CONFIG_UFS_FS is not set
944CONFIG_NETWORK_FILESYSTEMS=y
945CONFIG_NFS_FS=y
946CONFIG_NFS_V3=y
947CONFIG_NFS_V3_ACL=y
948CONFIG_NFS_V4=y
949CONFIG_ROOT_NFS=y
950# CONFIG_NFSD is not set
951CONFIG_LOCKD=y
952CONFIG_LOCKD_V4=y
953CONFIG_NFS_ACL_SUPPORT=y
954CONFIG_NFS_COMMON=y
955CONFIG_SUNRPC=y
956CONFIG_SUNRPC_GSS=y
957# CONFIG_SUNRPC_REGISTER_V4 is not set
958CONFIG_RPCSEC_GSS_KRB5=y
959# CONFIG_RPCSEC_GSS_SPKM3 is not set
960# CONFIG_SMB_FS is not set
961# CONFIG_CIFS is not set
962# CONFIG_NCP_FS is not set
963# CONFIG_CODA_FS is not set
964# CONFIG_AFS_FS is not set
819 965
820# 966#
821# Partition Types 967# Partition Types
diff --git a/arch/arm/configs/picotux200_defconfig b/arch/arm/configs/picotux200_defconfig
index 14826f0dabde..59e4463c2da2 100644
--- a/arch/arm/configs/picotux200_defconfig
+++ b/arch/arm/configs/picotux200_defconfig
@@ -1069,9 +1069,9 @@ CONFIG_RTC_CLASS=m
1069# 1069#
1070# RTC interfaces 1070# RTC interfaces
1071# 1071#
1072CONFIG_RTC_INTF_SYSFS=m 1072CONFIG_RTC_INTF_SYSFS=y
1073CONFIG_RTC_INTF_PROC=m 1073CONFIG_RTC_INTF_PROC=y
1074CONFIG_RTC_INTF_DEV=m 1074CONFIG_RTC_INTF_DEV=y
1075# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set 1075# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1076 1076
1077# 1077#
diff --git a/arch/arm/configs/realview-smp_defconfig b/arch/arm/configs/realview-smp_defconfig
index 0c09b23167ec..cd29824d791c 100644
--- a/arch/arm/configs/realview-smp_defconfig
+++ b/arch/arm/configs/realview-smp_defconfig
@@ -1,84 +1,111 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.19-rc3 3# Linux kernel version: 2.6.28-rc2
4# Wed Oct 25 14:12:00 2006 4# Mon Nov 10 14:41:47 2008
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7# CONFIG_GENERIC_TIME is not set 7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8# CONFIG_GENERIC_GPIO is not set
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
8CONFIG_MMU=y 11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
9CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
10CONFIG_TRACE_IRQFLAGS_SUPPORT=y 16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
11CONFIG_HARDIRQS_SW_RESEND=y 17CONFIG_HARDIRQS_SW_RESEND=y
12CONFIG_GENERIC_IRQ_PROBE=y 18CONFIG_GENERIC_IRQ_PROBE=y
13CONFIG_RWSEM_GENERIC_SPINLOCK=y 19CONFIG_RWSEM_GENERIC_SPINLOCK=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
14CONFIG_GENERIC_HWEIGHT=y 22CONFIG_GENERIC_HWEIGHT=y
15CONFIG_GENERIC_CALIBRATE_DELAY=y 23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
16CONFIG_VECTORS_BASE=0xffff0000 25CONFIG_VECTORS_BASE=0xffff0000
17CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
18 27
19# 28#
20# Code maturity level options 29# General setup
21# 30#
22CONFIG_EXPERIMENTAL=y 31CONFIG_EXPERIMENTAL=y
23CONFIG_LOCK_KERNEL=y 32CONFIG_LOCK_KERNEL=y
24CONFIG_INIT_ENV_ARG_LIMIT=32 33CONFIG_INIT_ENV_ARG_LIMIT=32
25
26#
27# General setup
28#
29CONFIG_LOCALVERSION="" 34CONFIG_LOCALVERSION=""
30CONFIG_LOCALVERSION_AUTO=y 35CONFIG_LOCALVERSION_AUTO=y
31# CONFIG_SWAP is not set 36# CONFIG_SWAP is not set
32CONFIG_SYSVIPC=y 37CONFIG_SYSVIPC=y
33# CONFIG_IPC_NS is not set 38CONFIG_SYSVIPC_SYSCTL=y
34# CONFIG_POSIX_MQUEUE is not set 39# CONFIG_POSIX_MQUEUE is not set
35# CONFIG_BSD_PROCESS_ACCT is not set 40# CONFIG_BSD_PROCESS_ACCT is not set
36# CONFIG_TASKSTATS is not set 41# CONFIG_TASKSTATS is not set
37# CONFIG_UTS_NS is not set
38# CONFIG_AUDIT is not set 42# CONFIG_AUDIT is not set
39# CONFIG_IKCONFIG is not set 43# CONFIG_IKCONFIG is not set
40# CONFIG_CPUSETS is not set 44CONFIG_LOG_BUF_SHIFT=14
45# CONFIG_CGROUPS is not set
46# CONFIG_GROUP_SCHED is not set
47CONFIG_SYSFS_DEPRECATED=y
48CONFIG_SYSFS_DEPRECATED_V2=y
41# CONFIG_RELAY is not set 49# CONFIG_RELAY is not set
42CONFIG_INITRAMFS_SOURCE="" 50CONFIG_NAMESPACES=y
51# CONFIG_UTS_NS is not set
52# CONFIG_IPC_NS is not set
53# CONFIG_USER_NS is not set
54# CONFIG_PID_NS is not set
55# CONFIG_BLK_DEV_INITRD is not set
43CONFIG_CC_OPTIMIZE_FOR_SIZE=y 56CONFIG_CC_OPTIMIZE_FOR_SIZE=y
44CONFIG_SYSCTL=y 57CONFIG_SYSCTL=y
45# CONFIG_EMBEDDED is not set 58# CONFIG_EMBEDDED is not set
46CONFIG_UID16=y 59CONFIG_UID16=y
47# CONFIG_SYSCTL_SYSCALL is not set 60CONFIG_SYSCTL_SYSCALL=y
48CONFIG_KALLSYMS=y 61CONFIG_KALLSYMS=y
49CONFIG_KALLSYMS_ALL=y 62# CONFIG_KALLSYMS_ALL is not set
50# CONFIG_KALLSYMS_EXTRA_PASS is not set 63# CONFIG_KALLSYMS_EXTRA_PASS is not set
51CONFIG_HOTPLUG=y 64CONFIG_HOTPLUG=y
52CONFIG_PRINTK=y 65CONFIG_PRINTK=y
53CONFIG_BUG=y 66CONFIG_BUG=y
54CONFIG_ELF_CORE=y 67CONFIG_ELF_CORE=y
68CONFIG_COMPAT_BRK=y
55CONFIG_BASE_FULL=y 69CONFIG_BASE_FULL=y
56CONFIG_FUTEX=y 70CONFIG_FUTEX=y
71CONFIG_ANON_INODES=y
57CONFIG_EPOLL=y 72CONFIG_EPOLL=y
73CONFIG_SIGNALFD=y
74CONFIG_TIMERFD=y
75CONFIG_EVENTFD=y
58CONFIG_SHMEM=y 76CONFIG_SHMEM=y
59CONFIG_SLAB=y 77CONFIG_AIO=y
60CONFIG_VM_EVENT_COUNTERS=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
88CONFIG_USE_GENERIC_SMP_HELPERS=y
89CONFIG_HAVE_CLK=y
90CONFIG_HAVE_GENERIC_DMA_COHERENT=y
91CONFIG_SLABINFO=y
61CONFIG_RT_MUTEXES=y 92CONFIG_RT_MUTEXES=y
62# CONFIG_TINY_SHMEM is not set 93# CONFIG_TINY_SHMEM is not set
63CONFIG_BASE_SMALL=0 94CONFIG_BASE_SMALL=0
64# CONFIG_SLOB is not set
65
66#
67# Loadable module support
68#
69CONFIG_MODULES=y 95CONFIG_MODULES=y
96# CONFIG_MODULE_FORCE_LOAD is not set
70CONFIG_MODULE_UNLOAD=y 97CONFIG_MODULE_UNLOAD=y
71# CONFIG_MODULE_FORCE_UNLOAD is not set 98# CONFIG_MODULE_FORCE_UNLOAD is not set
72# CONFIG_MODVERSIONS is not set 99# CONFIG_MODVERSIONS is not set
73# CONFIG_MODULE_SRCVERSION_ALL is not set 100# CONFIG_MODULE_SRCVERSION_ALL is not set
74# CONFIG_KMOD is not set 101CONFIG_KMOD=y
75CONFIG_STOP_MACHINE=y 102CONFIG_STOP_MACHINE=y
76
77#
78# Block layer
79#
80CONFIG_BLOCK=y 103CONFIG_BLOCK=y
104# CONFIG_LBD is not set
81# CONFIG_BLK_DEV_IO_TRACE is not set 105# CONFIG_BLK_DEV_IO_TRACE is not set
106# CONFIG_LSF is not set
107# CONFIG_BLK_DEV_BSG is not set
108# CONFIG_BLK_DEV_INTEGRITY is not set
82 109
83# 110#
84# IO Schedulers 111# IO Schedulers
@@ -92,6 +119,8 @@ CONFIG_DEFAULT_DEADLINE=y
92# CONFIG_DEFAULT_CFQ is not set 119# CONFIG_DEFAULT_CFQ is not set
93# CONFIG_DEFAULT_NOOP is not set 120# CONFIG_DEFAULT_NOOP is not set
94CONFIG_DEFAULT_IOSCHED="deadline" 121CONFIG_DEFAULT_IOSCHED="deadline"
122CONFIG_CLASSIC_RCU=y
123# CONFIG_FREEZER is not set
95 124
96# 125#
97# System Type 126# System Type
@@ -103,19 +132,26 @@ CONFIG_ARCH_REALVIEW=y
103# CONFIG_ARCH_AT91 is not set 132# CONFIG_ARCH_AT91 is not set
104# CONFIG_ARCH_CLPS7500 is not set 133# CONFIG_ARCH_CLPS7500 is not set
105# CONFIG_ARCH_CLPS711X is not set 134# CONFIG_ARCH_CLPS711X is not set
106# CONFIG_ARCH_CO285 is not set
107# CONFIG_ARCH_EBSA110 is not set 135# CONFIG_ARCH_EBSA110 is not set
108# CONFIG_ARCH_EP93XX is not set 136# CONFIG_ARCH_EP93XX is not set
109# CONFIG_ARCH_FOOTBRIDGE is not set 137# CONFIG_ARCH_FOOTBRIDGE is not set
110# CONFIG_ARCH_NETX is not set 138# CONFIG_ARCH_NETX is not set
111# CONFIG_ARCH_H720X is not set 139# CONFIG_ARCH_H720X is not set
112# CONFIG_ARCH_IMX is not set 140# CONFIG_ARCH_IMX is not set
141# CONFIG_ARCH_IOP13XX is not set
113# CONFIG_ARCH_IOP32X is not set 142# CONFIG_ARCH_IOP32X is not set
114# CONFIG_ARCH_IOP33X is not set 143# CONFIG_ARCH_IOP33X is not set
115# CONFIG_ARCH_IXP4XX is not set
116# CONFIG_ARCH_IXP2000 is not set
117# 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
118# CONFIG_ARCH_L7200 is not set 147# CONFIG_ARCH_L7200 is not set
148# CONFIG_ARCH_KIRKWOOD is not set
149# CONFIG_ARCH_KS8695 is not set
150# CONFIG_ARCH_NS9XXX is not set
151# CONFIG_ARCH_LOKI is not set
152# CONFIG_ARCH_MV78XX0 is not set
153# CONFIG_ARCH_MXC is not set
154# CONFIG_ARCH_ORION5X is not set
119# CONFIG_ARCH_PNX4008 is not set 155# CONFIG_ARCH_PNX4008 is not set
120# CONFIG_ARCH_PXA is not set 156# CONFIG_ARCH_PXA is not set
121# CONFIG_ARCH_RPC is not set 157# CONFIG_ARCH_RPC is not set
@@ -123,13 +159,29 @@ CONFIG_ARCH_REALVIEW=y
123# CONFIG_ARCH_S3C2410 is not set 159# CONFIG_ARCH_S3C2410 is not set
124# CONFIG_ARCH_SHARK is not set 160# CONFIG_ARCH_SHARK is not set
125# CONFIG_ARCH_LH7A40X is not set 161# CONFIG_ARCH_LH7A40X is not set
162# CONFIG_ARCH_DAVINCI is not set
126# CONFIG_ARCH_OMAP is not set 163# CONFIG_ARCH_OMAP is not set
164# CONFIG_ARCH_MSM is not set
165
166#
167# Boot options
168#
169
170#
171# Power management
172#
127 173
128# 174#
129# RealView platform type 175# RealView platform type
130# 176#
131CONFIG_MACH_REALVIEW_EB=y 177CONFIG_MACH_REALVIEW_EB=y
132CONFIG_REALVIEW_MPCORE=y 178# CONFIG_REALVIEW_EB_A9MP is not set
179CONFIG_REALVIEW_EB_ARM11MP=y
180# CONFIG_REALVIEW_EB_ARM11MP_REVB is not set
181CONFIG_MACH_REALVIEW_PB11MP=y
182# CONFIG_MACH_REALVIEW_PB1176 is not set
183# CONFIG_MACH_REALVIEW_PBA8 is not set
184CONFIG_REALVIEW_HIGH_PHYS_OFFSET=y
133 185
134# 186#
135# Processor Type 187# Processor Type
@@ -138,12 +190,15 @@ CONFIG_CPU_32=y
138# CONFIG_CPU_ARM926T is not set 190# CONFIG_CPU_ARM926T is not set
139CONFIG_CPU_V6=y 191CONFIG_CPU_V6=y
140CONFIG_CPU_32v6K=y 192CONFIG_CPU_32v6K=y
193# CONFIG_CPU_V7 is not set
141CONFIG_CPU_32v6=y 194CONFIG_CPU_32v6=y
142CONFIG_CPU_ABRT_EV6=y 195CONFIG_CPU_ABRT_EV6=y
196CONFIG_CPU_PABRT_NOIFAR=y
143CONFIG_CPU_CACHE_V6=y 197CONFIG_CPU_CACHE_V6=y
144CONFIG_CPU_CACHE_VIPT=y 198CONFIG_CPU_CACHE_VIPT=y
145CONFIG_CPU_COPY_V6=y 199CONFIG_CPU_COPY_V6=y
146CONFIG_CPU_TLB_V6=y 200CONFIG_CPU_TLB_V6=y
201CONFIG_CPU_HAS_ASID=y
147CONFIG_CPU_CP15=y 202CONFIG_CPU_CP15=y
148CONFIG_CPU_CP15_MMU=y 203CONFIG_CPU_CP15_MMU=y
149 204
@@ -153,9 +208,10 @@ CONFIG_CPU_CP15_MMU=y
153CONFIG_ARM_THUMB=y 208CONFIG_ARM_THUMB=y
154# CONFIG_CPU_ICACHE_DISABLE is not set 209# CONFIG_CPU_ICACHE_DISABLE is not set
155# CONFIG_CPU_DCACHE_DISABLE is not set 210# CONFIG_CPU_DCACHE_DISABLE is not set
156# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
157# CONFIG_CPU_BPREDICT_DISABLE is not set 211# CONFIG_CPU_BPREDICT_DISABLE is not set
158CONFIG_HAS_TLS_REG=y 212CONFIG_HAS_TLS_REG=y
213CONFIG_OUTER_CACHE=y
214CONFIG_CACHE_L2X0=y
159CONFIG_ARM_GIC=y 215CONFIG_ARM_GIC=y
160CONFIG_ICST307=y 216CONFIG_ICST307=y
161 217
@@ -163,32 +219,44 @@ CONFIG_ICST307=y
163# Bus support 219# Bus support
164# 220#
165CONFIG_ARM_AMBA=y 221CONFIG_ARM_AMBA=y
166 222# CONFIG_PCI_SYSCALL is not set
167# 223# CONFIG_ARCH_SUPPORTS_MSI is not set
168# PCCARD (PCMCIA/CardBus) support
169#
170# CONFIG_PCCARD is not set 224# CONFIG_PCCARD is not set
171 225
172# 226#
173# Kernel Features 227# Kernel Features
174# 228#
229# CONFIG_NO_HZ is not set
230# CONFIG_HIGH_RES_TIMERS is not set
231CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
175CONFIG_SMP=y 232CONFIG_SMP=y
233CONFIG_VMSPLIT_3G=y
234# CONFIG_VMSPLIT_2G is not set
235# CONFIG_VMSPLIT_1G is not set
236CONFIG_PAGE_OFFSET=0xC0000000
176CONFIG_NR_CPUS=4 237CONFIG_NR_CPUS=4
177CONFIG_HOTPLUG_CPU=y 238CONFIG_HOTPLUG_CPU=y
178CONFIG_LOCAL_TIMERS=y 239CONFIG_LOCAL_TIMERS=y
179# CONFIG_PREEMPT is not set 240# CONFIG_PREEMPT is not set
180CONFIG_HZ=100 241CONFIG_HZ=100
181# CONFIG_AEABI is not set 242CONFIG_AEABI=y
182# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 243CONFIG_OABI_COMPAT=y
244CONFIG_ARCH_FLATMEM_HAS_HOLES=y
245# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
246# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
183CONFIG_SELECT_MEMORY_MODEL=y 247CONFIG_SELECT_MEMORY_MODEL=y
184CONFIG_FLATMEM_MANUAL=y 248CONFIG_FLATMEM_MANUAL=y
185# CONFIG_DISCONTIGMEM_MANUAL is not set 249# CONFIG_DISCONTIGMEM_MANUAL is not set
186# CONFIG_SPARSEMEM_MANUAL is not set 250# CONFIG_SPARSEMEM_MANUAL is not set
187CONFIG_FLATMEM=y 251CONFIG_FLATMEM=y
188CONFIG_FLAT_NODE_MEM_MAP=y 252CONFIG_FLAT_NODE_MEM_MAP=y
189# CONFIG_SPARSEMEM_STATIC is not set 253CONFIG_PAGEFLAGS_EXTENDED=y
190CONFIG_SPLIT_PTLOCK_CPUS=4 254CONFIG_SPLIT_PTLOCK_CPUS=4
191# CONFIG_RESOURCES_64BIT is not set 255# CONFIG_RESOURCES_64BIT is not set
256# CONFIG_PHYS_ADDR_T_64BIT is not set
257CONFIG_ZONE_DMA_FLAG=0
258CONFIG_VIRT_TO_BUS=y
259CONFIG_UNEVICTABLE_LRU=y
192CONFIG_ALIGNMENT_TRAP=y 260CONFIG_ALIGNMENT_TRAP=y
193 261
194# 262#
@@ -198,6 +266,12 @@ CONFIG_ZBOOT_ROM_TEXT=0x0
198CONFIG_ZBOOT_ROM_BSS=0x0 266CONFIG_ZBOOT_ROM_BSS=0x0
199CONFIG_CMDLINE="root=/dev/nfs nfsroot=10.1.69.3:/work/nfsroot ip=dhcp console=ttyAMA0 mem=128M" 267CONFIG_CMDLINE="root=/dev/nfs nfsroot=10.1.69.3:/work/nfsroot ip=dhcp console=ttyAMA0 mem=128M"
200# CONFIG_XIP_KERNEL is not set 268# CONFIG_XIP_KERNEL is not set
269# CONFIG_KEXEC is not set
270
271#
272# CPU Power Management
273#
274# CONFIG_CPU_IDLE is not set
201 275
202# 276#
203# Floating point emulation 277# Floating point emulation
@@ -206,8 +280,7 @@ CONFIG_CMDLINE="root=/dev/nfs nfsroot=10.1.69.3:/work/nfsroot ip=dhcp console=tt
206# 280#
207# At least one emulation must be selected 281# At least one emulation must be selected
208# 282#
209CONFIG_FPE_NWFPE=y 283# CONFIG_FPE_NWFPE is not set
210# CONFIG_FPE_NWFPE_XP is not set
211# CONFIG_FPE_FASTFPE is not set 284# CONFIG_FPE_FASTFPE is not set
212CONFIG_VFP=y 285CONFIG_VFP=y
213 286
@@ -215,28 +288,29 @@ CONFIG_VFP=y
215# Userspace binary formats 288# Userspace binary formats
216# 289#
217CONFIG_BINFMT_ELF=y 290CONFIG_BINFMT_ELF=y
291# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
292CONFIG_HAVE_AOUT=y
218# CONFIG_BINFMT_AOUT is not set 293# CONFIG_BINFMT_AOUT is not set
219# CONFIG_BINFMT_MISC is not set 294# CONFIG_BINFMT_MISC is not set
220# CONFIG_ARTHUR is not set
221 295
222# 296#
223# Power management options 297# Power management options
224# 298#
225# CONFIG_PM is not set 299# CONFIG_PM is not set
226# CONFIG_APM is not set 300CONFIG_ARCH_SUSPEND_POSSIBLE=y
227
228#
229# Networking
230#
231CONFIG_NET=y 301CONFIG_NET=y
232 302
233# 303#
234# Networking options 304# Networking options
235# 305#
236# CONFIG_NETDEBUG is not set
237CONFIG_PACKET=y 306CONFIG_PACKET=y
238# CONFIG_PACKET_MMAP is not set 307# CONFIG_PACKET_MMAP is not set
239CONFIG_UNIX=y 308CONFIG_UNIX=y
309CONFIG_XFRM=y
310# CONFIG_XFRM_USER is not set
311# CONFIG_XFRM_SUB_POLICY is not set
312# CONFIG_XFRM_MIGRATE is not set
313# CONFIG_XFRM_STATISTICS is not set
240# CONFIG_NET_KEY is not set 314# CONFIG_NET_KEY is not set
241CONFIG_INET=y 315CONFIG_INET=y
242# CONFIG_IP_MULTICAST is not set 316# CONFIG_IP_MULTICAST is not set
@@ -255,36 +329,25 @@ CONFIG_IP_PNP_BOOTP=y
255# CONFIG_INET_IPCOMP is not set 329# CONFIG_INET_IPCOMP is not set
256# CONFIG_INET_XFRM_TUNNEL is not set 330# CONFIG_INET_XFRM_TUNNEL is not set
257# CONFIG_INET_TUNNEL is not set 331# CONFIG_INET_TUNNEL is not set
258# CONFIG_INET_XFRM_MODE_TRANSPORT is not set 332CONFIG_INET_XFRM_MODE_TRANSPORT=y
259# CONFIG_INET_XFRM_MODE_TUNNEL is not set 333CONFIG_INET_XFRM_MODE_TUNNEL=y
260# CONFIG_INET_XFRM_MODE_BEET is not set 334CONFIG_INET_XFRM_MODE_BEET=y
335# CONFIG_INET_LRO is not set
261CONFIG_INET_DIAG=y 336CONFIG_INET_DIAG=y
262CONFIG_INET_TCP_DIAG=y 337CONFIG_INET_TCP_DIAG=y
263# CONFIG_TCP_CONG_ADVANCED is not set 338# CONFIG_TCP_CONG_ADVANCED is not set
264CONFIG_TCP_CONG_CUBIC=y 339CONFIG_TCP_CONG_CUBIC=y
265CONFIG_DEFAULT_TCP_CONG="cubic" 340CONFIG_DEFAULT_TCP_CONG="cubic"
341# CONFIG_TCP_MD5SIG is not set
266# CONFIG_IPV6 is not set 342# CONFIG_IPV6 is not set
267# CONFIG_INET6_XFRM_TUNNEL is not set
268# CONFIG_INET6_TUNNEL is not set
269# CONFIG_NETWORK_SECMARK is not set 343# CONFIG_NETWORK_SECMARK is not set
270# CONFIG_NETFILTER is not set 344# CONFIG_NETFILTER is not set
271
272#
273# DCCP Configuration (EXPERIMENTAL)
274#
275# CONFIG_IP_DCCP is not set 345# CONFIG_IP_DCCP is not set
276
277#
278# SCTP Configuration (EXPERIMENTAL)
279#
280# CONFIG_IP_SCTP is not set 346# CONFIG_IP_SCTP is not set
281
282#
283# TIPC Configuration (EXPERIMENTAL)
284#
285# CONFIG_TIPC is not set 347# CONFIG_TIPC is not set
286# CONFIG_ATM is not set 348# CONFIG_ATM is not set
287# CONFIG_BRIDGE is not set 349# CONFIG_BRIDGE is not set
350# CONFIG_NET_DSA is not set
288# CONFIG_VLAN_8021Q is not set 351# CONFIG_VLAN_8021Q is not set
289# CONFIG_DECNET is not set 352# CONFIG_DECNET is not set
290# CONFIG_LLC2 is not set 353# CONFIG_LLC2 is not set
@@ -294,10 +357,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
294# CONFIG_LAPB is not set 357# CONFIG_LAPB is not set
295# CONFIG_ECONET is not set 358# CONFIG_ECONET is not set
296# CONFIG_WAN_ROUTER is not set 359# CONFIG_WAN_ROUTER is not set
297
298#
299# QoS and/or fair queueing
300#
301# CONFIG_NET_SCHED is not set 360# CONFIG_NET_SCHED is not set
302 361
303# 362#
@@ -305,9 +364,14 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
305# 364#
306# CONFIG_NET_PKTGEN is not set 365# CONFIG_NET_PKTGEN is not set
307# CONFIG_HAMRADIO is not set 366# CONFIG_HAMRADIO is not set
367# CONFIG_CAN is not set
308# CONFIG_IRDA is not set 368# CONFIG_IRDA is not set
309# CONFIG_BT is not set 369# CONFIG_BT is not set
310# CONFIG_IEEE80211 is not set 370# CONFIG_AF_RXRPC is not set
371# CONFIG_PHONET is not set
372# CONFIG_WIRELESS is not set
373# CONFIG_RFKILL is not set
374# CONFIG_NET_9P is not set
311 375
312# 376#
313# Device Drivers 377# Device Drivers
@@ -316,38 +380,37 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
316# 380#
317# Generic Driver Options 381# Generic Driver Options
318# 382#
383CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
319CONFIG_STANDALONE=y 384CONFIG_STANDALONE=y
320CONFIG_PREVENT_FIRMWARE_BUILD=y 385CONFIG_PREVENT_FIRMWARE_BUILD=y
321# CONFIG_FW_LOADER is not set 386CONFIG_FW_LOADER=y
387CONFIG_FIRMWARE_IN_KERNEL=y
388CONFIG_EXTRA_FIRMWARE=""
322# CONFIG_DEBUG_DRIVER is not set 389# CONFIG_DEBUG_DRIVER is not set
390# CONFIG_DEBUG_DEVRES is not set
323# CONFIG_SYS_HYPERVISOR is not set 391# CONFIG_SYS_HYPERVISOR is not set
324
325#
326# Connector - unified userspace <-> kernelspace linker
327#
328# CONFIG_CONNECTOR is not set 392# CONFIG_CONNECTOR is not set
329
330#
331# Memory Technology Devices (MTD)
332#
333CONFIG_MTD=y 393CONFIG_MTD=y
334# CONFIG_MTD_DEBUG is not set 394# CONFIG_MTD_DEBUG is not set
335# CONFIG_MTD_CONCAT is not set 395CONFIG_MTD_CONCAT=y
336CONFIG_MTD_PARTITIONS=y 396CONFIG_MTD_PARTITIONS=y
337# CONFIG_MTD_REDBOOT_PARTS is not set 397# CONFIG_MTD_REDBOOT_PARTS is not set
338CONFIG_MTD_CMDLINE_PARTS=y 398CONFIG_MTD_CMDLINE_PARTS=y
339# CONFIG_MTD_AFS_PARTS is not set 399# CONFIG_MTD_AFS_PARTS is not set
400# CONFIG_MTD_AR7_PARTS is not set
340 401
341# 402#
342# User Modules And Translation Layers 403# User Modules And Translation Layers
343# 404#
344CONFIG_MTD_CHAR=y 405CONFIG_MTD_CHAR=y
406CONFIG_MTD_BLKDEVS=y
345CONFIG_MTD_BLOCK=y 407CONFIG_MTD_BLOCK=y
346# CONFIG_FTL is not set 408# CONFIG_FTL is not set
347# CONFIG_NFTL is not set 409# CONFIG_NFTL is not set
348# CONFIG_INFTL is not set 410# CONFIG_INFTL is not set
349# CONFIG_RFD_FTL is not set 411# CONFIG_RFD_FTL is not set
350# CONFIG_SSFDC is not set 412# CONFIG_SSFDC is not set
413# CONFIG_MTD_OOPS is not set
351 414
352# 415#
353# RAM/ROM/Flash chip drivers 416# RAM/ROM/Flash chip drivers
@@ -373,7 +436,6 @@ CONFIG_MTD_CFI_UTIL=y
373# CONFIG_MTD_RAM is not set 436# CONFIG_MTD_RAM is not set
374# CONFIG_MTD_ROM is not set 437# CONFIG_MTD_ROM is not set
375# CONFIG_MTD_ABSENT is not set 438# CONFIG_MTD_ABSENT is not set
376# CONFIG_MTD_OBSOLETE_CHIPS is not set
377 439
378# 440#
379# Mapping drivers for chip access 441# Mapping drivers for chip access
@@ -397,115 +459,73 @@ CONFIG_MTD_ARM_INTEGRATOR=y
397# CONFIG_MTD_DOC2000 is not set 459# CONFIG_MTD_DOC2000 is not set
398# CONFIG_MTD_DOC2001 is not set 460# CONFIG_MTD_DOC2001 is not set
399# CONFIG_MTD_DOC2001PLUS is not set 461# CONFIG_MTD_DOC2001PLUS is not set
400
401#
402# NAND Flash Device Drivers
403#
404# CONFIG_MTD_NAND is not set 462# CONFIG_MTD_NAND is not set
405
406#
407# OneNAND Flash Device Drivers
408#
409# CONFIG_MTD_ONENAND is not set 463# CONFIG_MTD_ONENAND is not set
410 464
411# 465#
412# Parallel port support 466# UBI - Unsorted block images
413# 467#
468# CONFIG_MTD_UBI is not set
414# CONFIG_PARPORT is not set 469# CONFIG_PARPORT is not set
415 470CONFIG_BLK_DEV=y
416#
417# Plug and Play support
418#
419
420#
421# Block devices
422#
423# CONFIG_BLK_DEV_COW_COMMON is not set 471# CONFIG_BLK_DEV_COW_COMMON is not set
424# CONFIG_BLK_DEV_LOOP is not set 472# CONFIG_BLK_DEV_LOOP is not set
425# CONFIG_BLK_DEV_NBD is not set 473# CONFIG_BLK_DEV_NBD is not set
426# CONFIG_BLK_DEV_RAM is not set 474# CONFIG_BLK_DEV_RAM is not set
427CONFIG_BLK_DEV_INITRD=y
428# CONFIG_CDROM_PKTCDVD is not set 475# CONFIG_CDROM_PKTCDVD is not set
429# CONFIG_ATA_OVER_ETH is not set 476# CONFIG_ATA_OVER_ETH is not set
477CONFIG_MISC_DEVICES=y
478# CONFIG_EEPROM_93CX6 is not set
479# CONFIG_ENCLOSURE_SERVICES is not set
480CONFIG_HAVE_IDE=y
481# CONFIG_IDE is not set
430 482
431# 483#
432# SCSI device support 484# SCSI device support
433# 485#
434# CONFIG_RAID_ATTRS is not set 486# CONFIG_RAID_ATTRS is not set
435# CONFIG_SCSI is not set 487# CONFIG_SCSI is not set
488# CONFIG_SCSI_DMA is not set
436# CONFIG_SCSI_NETLINK is not set 489# CONFIG_SCSI_NETLINK is not set
437 490# CONFIG_ATA is not set
438#
439# Multi-device support (RAID and LVM)
440#
441# CONFIG_MD is not set 491# CONFIG_MD is not set
442
443#
444# Fusion MPT device support
445#
446# CONFIG_FUSION is not set
447
448#
449# IEEE 1394 (FireWire) support
450#
451
452#
453# I2O device support
454#
455
456#
457# Network device support
458#
459CONFIG_NETDEVICES=y 492CONFIG_NETDEVICES=y
460# CONFIG_DUMMY is not set 493# CONFIG_DUMMY is not set
461# CONFIG_BONDING is not set 494# CONFIG_BONDING is not set
495# CONFIG_MACVLAN is not set
462# CONFIG_EQUALIZER is not set 496# CONFIG_EQUALIZER is not set
463# CONFIG_TUN is not set 497# CONFIG_TUN is not set
464 498# CONFIG_VETH is not set
465#
466# PHY device support
467#
468# CONFIG_PHYLIB is not set 499# CONFIG_PHYLIB is not set
469
470#
471# Ethernet (10 or 100Mbit)
472#
473CONFIG_NET_ETHERNET=y 500CONFIG_NET_ETHERNET=y
474CONFIG_MII=y 501CONFIG_MII=y
502# CONFIG_AX88796 is not set
475CONFIG_SMC91X=y 503CONFIG_SMC91X=y
476# CONFIG_DM9000 is not set 504# CONFIG_DM9000 is not set
477 505CONFIG_SMC911X=y
478# 506# CONFIG_IBM_NEW_EMAC_ZMII is not set
479# Ethernet (1000 Mbit) 507# CONFIG_IBM_NEW_EMAC_RGMII is not set
480# 508# CONFIG_IBM_NEW_EMAC_TAH is not set
481 509# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
482# 510# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
483# Ethernet (10000 Mbit) 511# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
484# 512# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
485 513# CONFIG_B44 is not set
486# 514# CONFIG_NETDEV_1000 is not set
487# Token Ring devices 515# CONFIG_NETDEV_10000 is not set
488# 516
489 517#
490# 518# Wireless LAN
491# Wireless LAN (non-hamradio) 519#
492# 520# CONFIG_WLAN_PRE80211 is not set
493# CONFIG_NET_RADIO is not set 521# CONFIG_WLAN_80211 is not set
494 522# CONFIG_IWLWIFI_LEDS is not set
495#
496# Wan interfaces
497#
498# CONFIG_WAN is not set 523# CONFIG_WAN is not set
499# CONFIG_PPP is not set 524# CONFIG_PPP is not set
500# CONFIG_SLIP is not set 525# CONFIG_SLIP is not set
501# CONFIG_SHAPER is not set
502# CONFIG_NETCONSOLE is not set 526# CONFIG_NETCONSOLE is not set
503# CONFIG_NETPOLL is not set 527# CONFIG_NETPOLL is not set
504# CONFIG_NET_POLL_CONTROLLER is not set 528# CONFIG_NET_POLL_CONTROLLER is not set
505
506#
507# ISDN subsystem
508#
509# CONFIG_ISDN is not set 529# CONFIG_ISDN is not set
510 530
511# 531#
@@ -513,6 +533,7 @@ CONFIG_SMC91X=y
513# 533#
514CONFIG_INPUT=y 534CONFIG_INPUT=y
515# CONFIG_INPUT_FF_MEMLESS is not set 535# CONFIG_INPUT_FF_MEMLESS is not set
536# CONFIG_INPUT_POLLDEV is not set
516 537
517# 538#
518# Userland interfaces 539# Userland interfaces
@@ -522,7 +543,6 @@ CONFIG_INPUT_MOUSEDEV_PSAUX=y
522CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 543CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
523CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 544CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
524# CONFIG_INPUT_JOYDEV is not set 545# CONFIG_INPUT_JOYDEV is not set
525# CONFIG_INPUT_TSDEV is not set
526# CONFIG_INPUT_EVDEV is not set 546# CONFIG_INPUT_EVDEV is not set
527# CONFIG_INPUT_EVBUG is not set 547# CONFIG_INPUT_EVBUG is not set
528 548
@@ -538,9 +558,16 @@ CONFIG_KEYBOARD_ATKBD=y
538# CONFIG_KEYBOARD_STOWAWAY is not set 558# CONFIG_KEYBOARD_STOWAWAY is not set
539CONFIG_INPUT_MOUSE=y 559CONFIG_INPUT_MOUSE=y
540CONFIG_MOUSE_PS2=y 560CONFIG_MOUSE_PS2=y
561CONFIG_MOUSE_PS2_ALPS=y
562CONFIG_MOUSE_PS2_LOGIPS2PP=y
563CONFIG_MOUSE_PS2_SYNAPTICS=y
564CONFIG_MOUSE_PS2_LIFEBOOK=y
565CONFIG_MOUSE_PS2_TRACKPOINT=y
566# CONFIG_MOUSE_PS2_TOUCHKIT is not set
541# CONFIG_MOUSE_SERIAL is not set 567# CONFIG_MOUSE_SERIAL is not set
542# CONFIG_MOUSE_VSXXXAA is not set 568# CONFIG_MOUSE_VSXXXAA is not set
543# CONFIG_INPUT_JOYSTICK is not set 569# CONFIG_INPUT_JOYSTICK is not set
570# CONFIG_INPUT_TABLET is not set
544# CONFIG_INPUT_TOUCHSCREEN is not set 571# CONFIG_INPUT_TOUCHSCREEN is not set
545# CONFIG_INPUT_MISC is not set 572# CONFIG_INPUT_MISC is not set
546 573
@@ -558,9 +585,11 @@ CONFIG_SERIO_LIBPS2=y
558# Character devices 585# Character devices
559# 586#
560CONFIG_VT=y 587CONFIG_VT=y
588CONFIG_CONSOLE_TRANSLATIONS=y
561CONFIG_VT_CONSOLE=y 589CONFIG_VT_CONSOLE=y
562CONFIG_HW_CONSOLE=y 590CONFIG_HW_CONSOLE=y
563# CONFIG_VT_HW_CONSOLE_BINDING is not set 591# CONFIG_VT_HW_CONSOLE_BINDING is not set
592CONFIG_DEVKMEM=y
564# CONFIG_SERIAL_NONSTANDARD is not set 593# CONFIG_SERIAL_NONSTANDARD is not set
565 594
566# 595#
@@ -579,97 +608,91 @@ CONFIG_SERIAL_CORE_CONSOLE=y
579CONFIG_UNIX98_PTYS=y 608CONFIG_UNIX98_PTYS=y
580CONFIG_LEGACY_PTYS=y 609CONFIG_LEGACY_PTYS=y
581CONFIG_LEGACY_PTY_COUNT=16 610CONFIG_LEGACY_PTY_COUNT=16
582
583#
584# IPMI
585#
586# CONFIG_IPMI_HANDLER is not set 611# CONFIG_IPMI_HANDLER is not set
587
588#
589# Watchdog Cards
590#
591# CONFIG_WATCHDOG is not set
592# CONFIG_HW_RANDOM is not set 612# CONFIG_HW_RANDOM is not set
593# CONFIG_NVRAM is not set 613# CONFIG_NVRAM is not set
594# CONFIG_DTLK is not set
595# CONFIG_R3964 is not set 614# CONFIG_R3964 is not set
596
597#
598# Ftape, the floppy tape device driver
599#
600# CONFIG_RAW_DRIVER is not set 615# CONFIG_RAW_DRIVER is not set
601
602#
603# TPM devices
604#
605# CONFIG_TCG_TPM is not set 616# CONFIG_TCG_TPM is not set
606
607#
608# I2C support
609#
610# CONFIG_I2C is not set 617# CONFIG_I2C is not set
611
612#
613# SPI support
614#
615# CONFIG_SPI is not set 618# CONFIG_SPI is not set
616# CONFIG_SPI_MASTER is not set
617
618#
619# Dallas's 1-wire bus
620#
621# CONFIG_W1 is not set 619# CONFIG_W1 is not set
622 620# CONFIG_POWER_SUPPLY is not set
623#
624# Hardware Monitoring support
625#
626# CONFIG_HWMON is not set 621# CONFIG_HWMON is not set
627# CONFIG_HWMON_VID is not set 622# CONFIG_THERMAL is not set
628 623# CONFIG_THERMAL_HWMON is not set
629# 624# CONFIG_WATCHDOG is not set
630# Misc devices
631#
632# CONFIG_SGI_IOC4 is not set
633# CONFIG_TIFM_CORE is not set
634 625
635# 626#
636# LED devices 627# Sonics Silicon Backplane
637# 628#
638# CONFIG_NEW_LEDS is not set 629CONFIG_SSB_POSSIBLE=y
630# CONFIG_SSB is not set
639 631
640# 632#
641# LED drivers 633# Multifunction device drivers
642# 634#
635# CONFIG_MFD_CORE is not set
636# CONFIG_MFD_SM501 is not set
637# CONFIG_HTC_PASIC3 is not set
638# CONFIG_MFD_TMIO is not set
639# CONFIG_MFD_T7L66XB is not set
640# CONFIG_MFD_TC6387XB is not set
641# CONFIG_MFD_WM8400 is not set
643 642
644# 643#
645# LED Triggers 644# Multimedia devices
646# 645#
647 646
648# 647#
649# Multimedia devices 648# Multimedia core support
650# 649#
651# CONFIG_VIDEO_DEV is not set 650# CONFIG_VIDEO_DEV is not set
651# CONFIG_DVB_CORE is not set
652# CONFIG_VIDEO_MEDIA is not set
652 653
653# 654#
654# Digital Video Broadcasting Devices 655# Multimedia drivers
655# 656#
656# CONFIG_DVB is not set 657# CONFIG_DAB is not set
657 658
658# 659#
659# Graphics support 660# Graphics support
660# 661#
661# CONFIG_FIRMWARE_EDID is not set 662# CONFIG_VGASTATE is not set
663# CONFIG_VIDEO_OUTPUT_CONTROL is not set
662CONFIG_FB=y 664CONFIG_FB=y
665# CONFIG_FIRMWARE_EDID is not set
666# CONFIG_FB_DDC is not set
667# CONFIG_FB_BOOT_VESA_SUPPORT is not set
663CONFIG_FB_CFB_FILLRECT=y 668CONFIG_FB_CFB_FILLRECT=y
664CONFIG_FB_CFB_COPYAREA=y 669CONFIG_FB_CFB_COPYAREA=y
665CONFIG_FB_CFB_IMAGEBLIT=y 670CONFIG_FB_CFB_IMAGEBLIT=y
671# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
672# CONFIG_FB_SYS_FILLRECT is not set
673# CONFIG_FB_SYS_COPYAREA is not set
674# CONFIG_FB_SYS_IMAGEBLIT is not set
675# CONFIG_FB_FOREIGN_ENDIAN is not set
676# CONFIG_FB_SYS_FOPS is not set
677# CONFIG_FB_SVGALIB is not set
666# CONFIG_FB_MACMODES is not set 678# CONFIG_FB_MACMODES is not set
667# CONFIG_FB_BACKLIGHT is not set 679# CONFIG_FB_BACKLIGHT is not set
668# CONFIG_FB_MODE_HELPERS is not set 680# CONFIG_FB_MODE_HELPERS is not set
669# CONFIG_FB_TILEBLITTING is not set 681# CONFIG_FB_TILEBLITTING is not set
682
683#
684# Frame buffer hardware drivers
685#
670CONFIG_FB_ARMCLCD=y 686CONFIG_FB_ARMCLCD=y
671# CONFIG_FB_S1D13XXX is not set 687# CONFIG_FB_S1D13XXX is not set
672# CONFIG_FB_VIRTUAL is not set 688# CONFIG_FB_VIRTUAL is not set
689# CONFIG_FB_METRONOME is not set
690# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
691
692#
693# Display device support
694#
695# CONFIG_DISPLAY_SUPPORT is not set
673 696
674# 697#
675# Console display driver support 698# Console display driver support
@@ -677,28 +700,17 @@ CONFIG_FB_ARMCLCD=y
677# CONFIG_VGA_CONSOLE is not set 700# CONFIG_VGA_CONSOLE is not set
678CONFIG_DUMMY_CONSOLE=y 701CONFIG_DUMMY_CONSOLE=y
679CONFIG_FRAMEBUFFER_CONSOLE=y 702CONFIG_FRAMEBUFFER_CONSOLE=y
703# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
680# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set 704# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
681# CONFIG_FONTS is not set 705# CONFIG_FONTS is not set
682CONFIG_FONT_8x8=y 706CONFIG_FONT_8x8=y
683CONFIG_FONT_8x16=y 707CONFIG_FONT_8x16=y
684
685#
686# Logo configuration
687#
688CONFIG_LOGO=y 708CONFIG_LOGO=y
689# CONFIG_LOGO_LINUX_MONO is not set 709# CONFIG_LOGO_LINUX_MONO is not set
690# CONFIG_LOGO_LINUX_VGA16 is not set 710# CONFIG_LOGO_LINUX_VGA16 is not set
691CONFIG_LOGO_LINUX_CLUT224=y 711CONFIG_LOGO_LINUX_CLUT224=y
692# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
693
694#
695# Sound
696#
697CONFIG_SOUND=y 712CONFIG_SOUND=y
698 713CONFIG_SOUND_OSS_CORE=y
699#
700# Advanced Linux Sound Architecture
701#
702CONFIG_SND=y 714CONFIG_SND=y
703CONFIG_SND_TIMER=y 715CONFIG_SND_TIMER=y
704CONFIG_SND_PCM=y 716CONFIG_SND_PCM=y
@@ -712,100 +724,65 @@ CONFIG_SND_SUPPORT_OLD_API=y
712CONFIG_SND_VERBOSE_PROCFS=y 724CONFIG_SND_VERBOSE_PROCFS=y
713# CONFIG_SND_VERBOSE_PRINTK is not set 725# CONFIG_SND_VERBOSE_PRINTK is not set
714# CONFIG_SND_DEBUG is not set 726# CONFIG_SND_DEBUG is not set
715 727CONFIG_SND_VMASTER=y
716# 728CONFIG_SND_AC97_CODEC=y
717# Generic devices 729# CONFIG_SND_DRIVERS is not set
718# 730CONFIG_SND_ARM=y
719CONFIG_SND_AC97_CODEC=m 731CONFIG_SND_ARMAACI=y
720CONFIG_SND_AC97_BUS=m 732# CONFIG_SND_SOC is not set
721# CONFIG_SND_DUMMY is not set
722# CONFIG_SND_MTPAV is not set
723# CONFIG_SND_SERIAL_U16550 is not set
724# CONFIG_SND_MPU401 is not set
725
726#
727# ALSA ARM devices
728#
729CONFIG_SND_ARMAACI=m
730
731#
732# Open Sound System
733#
734# CONFIG_SOUND_PRIME is not set 733# CONFIG_SOUND_PRIME is not set
735 734CONFIG_AC97_BUS=y
736# 735# CONFIG_HID_SUPPORT is not set
737# USB support 736# CONFIG_USB_SUPPORT is not set
738#
739CONFIG_USB_ARCH_HAS_HCD=y
740# CONFIG_USB_ARCH_HAS_OHCI is not set
741# CONFIG_USB_ARCH_HAS_EHCI is not set
742# CONFIG_USB is not set
743
744#
745# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
746#
747
748#
749# USB Gadget Support
750#
751# CONFIG_USB_GADGET is not set
752
753#
754# MMC/SD Card support
755#
756CONFIG_MMC=y 737CONFIG_MMC=y
757# CONFIG_MMC_DEBUG is not set 738# CONFIG_MMC_DEBUG is not set
758CONFIG_MMC_BLOCK=y 739# CONFIG_MMC_UNSAFE_RESUME is not set
759CONFIG_MMC_ARMMMCI=y
760# CONFIG_MMC_TIFM_SD is not set
761 740
762# 741#
763# Real Time Clock 742# MMC/SD/SDIO Card Drivers
764# 743#
765CONFIG_RTC_LIB=y 744CONFIG_MMC_BLOCK=y
766CONFIG_RTC_CLASS=y 745CONFIG_MMC_BLOCK_BOUNCE=y
767CONFIG_RTC_HCTOSYS=y 746# CONFIG_SDIO_UART is not set
768CONFIG_RTC_HCTOSYS_DEVICE="rtc0" 747# CONFIG_MMC_TEST is not set
769# CONFIG_RTC_DEBUG is not set
770 748
771# 749#
772# RTC interfaces 750# MMC/SD/SDIO Host Controller Drivers
773# 751#
774CONFIG_RTC_INTF_SYSFS=y 752CONFIG_MMC_ARMMMCI=y
775CONFIG_RTC_INTF_PROC=y 753# CONFIG_MMC_SDHCI is not set
776CONFIG_RTC_INTF_DEV=y 754# CONFIG_MEMSTICK is not set
777CONFIG_RTC_INTF_DEV_UIE_EMUL=y 755# CONFIG_ACCESSIBILITY is not set
756# CONFIG_NEW_LEDS is not set
757CONFIG_RTC_LIB=y
758# CONFIG_RTC_CLASS is not set
759# CONFIG_DMADEVICES is not set
778 760
779# 761#
780# RTC drivers 762# Voltage and Current regulators
781# 763#
782# CONFIG_RTC_DRV_DS1553 is not set 764# CONFIG_REGULATOR is not set
783# CONFIG_RTC_DRV_DS1742 is not set 765# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
784# CONFIG_RTC_DRV_M48T86 is not set 766# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
785CONFIG_RTC_DRV_PL031=y 767# CONFIG_REGULATOR_BQ24022 is not set
786# CONFIG_RTC_DRV_TEST is not set 768# CONFIG_UIO is not set
787# CONFIG_RTC_DRV_V3020 is not set
788 769
789# 770#
790# File systems 771# File systems
791# 772#
792CONFIG_EXT2_FS=y 773# CONFIG_EXT2_FS is not set
793# CONFIG_EXT2_FS_XATTR is not set
794# CONFIG_EXT2_FS_XIP is not set
795# CONFIG_EXT3_FS is not set 774# CONFIG_EXT3_FS is not set
796# CONFIG_EXT4DEV_FS is not set 775# CONFIG_EXT4_FS is not set
797# CONFIG_REISERFS_FS is not set 776# CONFIG_REISERFS_FS is not set
798# CONFIG_JFS_FS is not set 777# CONFIG_JFS_FS is not set
799# CONFIG_FS_POSIX_ACL is not set 778# CONFIG_FS_POSIX_ACL is not set
779CONFIG_FILE_LOCKING=y
800# CONFIG_XFS_FS is not set 780# CONFIG_XFS_FS is not set
801# CONFIG_GFS2_FS is not set
802# CONFIG_OCFS2_FS is not set 781# CONFIG_OCFS2_FS is not set
803# CONFIG_MINIX_FS is not set 782CONFIG_DNOTIFY=y
804# CONFIG_ROMFS_FS is not set
805CONFIG_INOTIFY=y 783CONFIG_INOTIFY=y
806# CONFIG_INOTIFY_USER is not set 784CONFIG_INOTIFY_USER=y
807# CONFIG_QUOTA is not set 785# CONFIG_QUOTA is not set
808CONFIG_DNOTIFY=y
809# CONFIG_AUTOFS_FS is not set 786# CONFIG_AUTOFS_FS is not set
810# CONFIG_AUTOFS4_FS is not set 787# CONFIG_AUTOFS4_FS is not set
811# CONFIG_FUSE_FS is not set 788# CONFIG_FUSE_FS is not set
@@ -831,11 +808,11 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
831# 808#
832CONFIG_PROC_FS=y 809CONFIG_PROC_FS=y
833CONFIG_PROC_SYSCTL=y 810CONFIG_PROC_SYSCTL=y
811CONFIG_PROC_PAGE_MONITOR=y
834CONFIG_SYSFS=y 812CONFIG_SYSFS=y
835CONFIG_TMPFS=y 813CONFIG_TMPFS=y
836# CONFIG_TMPFS_POSIX_ACL is not set 814# CONFIG_TMPFS_POSIX_ACL is not set
837# CONFIG_HUGETLB_PAGE is not set 815# CONFIG_HUGETLB_PAGE is not set
838CONFIG_RAMFS=y
839# CONFIG_CONFIGFS_FS is not set 816# CONFIG_CONFIGFS_FS is not set
840 817
841# 818#
@@ -848,29 +825,28 @@ CONFIG_RAMFS=y
848# CONFIG_BEFS_FS is not set 825# CONFIG_BEFS_FS is not set
849# CONFIG_BFS_FS is not set 826# CONFIG_BFS_FS is not set
850# CONFIG_EFS_FS is not set 827# CONFIG_EFS_FS is not set
851# CONFIG_JFFS_FS is not set
852# CONFIG_JFFS2_FS is not set 828# CONFIG_JFFS2_FS is not set
853CONFIG_CRAMFS=y 829CONFIG_CRAMFS=y
854# CONFIG_VXFS_FS is not set 830# CONFIG_VXFS_FS is not set
831# CONFIG_MINIX_FS is not set
832# CONFIG_OMFS_FS is not set
855# CONFIG_HPFS_FS is not set 833# CONFIG_HPFS_FS is not set
856# CONFIG_QNX4FS_FS is not set 834# CONFIG_QNX4FS_FS is not set
835# CONFIG_ROMFS_FS is not set
857# CONFIG_SYSV_FS is not set 836# CONFIG_SYSV_FS is not set
858# CONFIG_UFS_FS is not set 837# CONFIG_UFS_FS is not set
859 838CONFIG_NETWORK_FILESYSTEMS=y
860#
861# Network File Systems
862#
863CONFIG_NFS_FS=y 839CONFIG_NFS_FS=y
864CONFIG_NFS_V3=y 840CONFIG_NFS_V3=y
865# CONFIG_NFS_V3_ACL is not set 841# CONFIG_NFS_V3_ACL is not set
866# CONFIG_NFS_V4 is not set 842# CONFIG_NFS_V4 is not set
867# CONFIG_NFS_DIRECTIO is not set
868# CONFIG_NFSD is not set
869CONFIG_ROOT_NFS=y 843CONFIG_ROOT_NFS=y
844# CONFIG_NFSD is not set
870CONFIG_LOCKD=y 845CONFIG_LOCKD=y
871CONFIG_LOCKD_V4=y 846CONFIG_LOCKD_V4=y
872CONFIG_NFS_COMMON=y 847CONFIG_NFS_COMMON=y
873CONFIG_SUNRPC=y 848CONFIG_SUNRPC=y
849# CONFIG_SUNRPC_REGISTER_V4 is not set
874# CONFIG_RPCSEC_GSS_KRB5 is not set 850# CONFIG_RPCSEC_GSS_KRB5 is not set
875# CONFIG_RPCSEC_GSS_SPKM3 is not set 851# CONFIG_RPCSEC_GSS_SPKM3 is not set
876# CONFIG_SMB_FS is not set 852# CONFIG_SMB_FS is not set
@@ -878,17 +854,12 @@ CONFIG_SUNRPC=y
878# CONFIG_NCP_FS is not set 854# CONFIG_NCP_FS is not set
879# CONFIG_CODA_FS is not set 855# CONFIG_CODA_FS is not set
880# CONFIG_AFS_FS is not set 856# CONFIG_AFS_FS is not set
881# CONFIG_9P_FS is not set
882 857
883# 858#
884# Partition Types 859# Partition Types
885# 860#
886# CONFIG_PARTITION_ADVANCED is not set 861# CONFIG_PARTITION_ADVANCED is not set
887CONFIG_MSDOS_PARTITION=y 862CONFIG_MSDOS_PARTITION=y
888
889#
890# Native Language Support
891#
892CONFIG_NLS=y 863CONFIG_NLS=y
893CONFIG_NLS_DEFAULT="iso8859-1" 864CONFIG_NLS_DEFAULT="iso8859-1"
894CONFIG_NLS_CODEPAGE_437=y 865CONFIG_NLS_CODEPAGE_437=y
@@ -929,64 +900,177 @@ CONFIG_NLS_ISO8859_1=y
929# CONFIG_NLS_KOI8_R is not set 900# CONFIG_NLS_KOI8_R is not set
930# CONFIG_NLS_KOI8_U is not set 901# CONFIG_NLS_KOI8_U is not set
931# CONFIG_NLS_UTF8 is not set 902# CONFIG_NLS_UTF8 is not set
932 903# CONFIG_DLM is not set
933#
934# Profiling support
935#
936# CONFIG_PROFILING is not set
937 904
938# 905#
939# Kernel hacking 906# Kernel hacking
940# 907#
941# CONFIG_PRINTK_TIME is not set 908# CONFIG_PRINTK_TIME is not set
942# CONFIG_ENABLE_MUST_CHECK is not set 909CONFIG_ENABLE_WARN_DEPRECATED=y
910CONFIG_ENABLE_MUST_CHECK=y
911CONFIG_FRAME_WARN=1024
943CONFIG_MAGIC_SYSRQ=y 912CONFIG_MAGIC_SYSRQ=y
944# CONFIG_UNUSED_SYMBOLS is not set 913# CONFIG_UNUSED_SYMBOLS is not set
914# CONFIG_DEBUG_FS is not set
915# CONFIG_HEADERS_CHECK is not set
945CONFIG_DEBUG_KERNEL=y 916CONFIG_DEBUG_KERNEL=y
946CONFIG_LOG_BUF_SHIFT=14 917# CONFIG_DEBUG_SHIRQ is not set
947CONFIG_DETECT_SOFTLOCKUP=y 918CONFIG_DETECT_SOFTLOCKUP=y
919# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
920CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
921# CONFIG_SCHED_DEBUG is not set
948# CONFIG_SCHEDSTATS is not set 922# CONFIG_SCHEDSTATS is not set
923# CONFIG_TIMER_STATS is not set
924# CONFIG_DEBUG_OBJECTS is not set
949# CONFIG_DEBUG_SLAB is not set 925# CONFIG_DEBUG_SLAB is not set
950# CONFIG_DEBUG_RT_MUTEXES is not set 926# CONFIG_DEBUG_RT_MUTEXES is not set
951# CONFIG_RT_MUTEX_TESTER is not set 927# CONFIG_RT_MUTEX_TESTER is not set
952CONFIG_DEBUG_SPINLOCK=y 928# CONFIG_DEBUG_SPINLOCK is not set
953CONFIG_DEBUG_MUTEXES=y 929# CONFIG_DEBUG_MUTEXES is not set
954CONFIG_DEBUG_RWSEMS=y 930# CONFIG_DEBUG_LOCK_ALLOC is not set
931# CONFIG_PROVE_LOCKING is not set
932# CONFIG_LOCK_STAT is not set
955# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 933# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
956# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 934# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
957# CONFIG_DEBUG_KOBJECT is not set 935# CONFIG_DEBUG_KOBJECT is not set
958CONFIG_DEBUG_BUGVERBOSE=y 936CONFIG_DEBUG_BUGVERBOSE=y
959# CONFIG_DEBUG_INFO is not set 937# CONFIG_DEBUG_INFO is not set
960# CONFIG_DEBUG_FS is not set
961# CONFIG_DEBUG_VM is not set 938# CONFIG_DEBUG_VM is not set
939# CONFIG_DEBUG_WRITECOUNT is not set
940CONFIG_DEBUG_MEMORY_INIT=y
962# CONFIG_DEBUG_LIST is not set 941# CONFIG_DEBUG_LIST is not set
942# CONFIG_DEBUG_SG is not set
963CONFIG_FRAME_POINTER=y 943CONFIG_FRAME_POINTER=y
964# CONFIG_UNWIND_INFO is not set 944# CONFIG_BOOT_PRINTK_DELAY is not set
965CONFIG_FORCED_INLINING=y
966# CONFIG_HEADERS_CHECK is not set
967# CONFIG_RCU_TORTURE_TEST is not set 945# CONFIG_RCU_TORTURE_TEST is not set
946# CONFIG_RCU_CPU_STALL_DETECTOR is not set
947# CONFIG_BACKTRACE_SELF_TEST is not set
948# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
949# CONFIG_FAULT_INJECTION is not set
950# CONFIG_SYSCTL_SYSCALL_CHECK is not set
951CONFIG_NOP_TRACER=y
952CONFIG_HAVE_FTRACE=y
953CONFIG_HAVE_DYNAMIC_FTRACE=y
954# CONFIG_FTRACE is not set
955# CONFIG_IRQSOFF_TRACER is not set
956# CONFIG_SCHED_TRACER is not set
957# CONFIG_CONTEXT_SWITCH_TRACER is not set
958# CONFIG_BOOT_TRACER is not set
959# CONFIG_STACK_TRACER is not set
960# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
961# CONFIG_SAMPLES is not set
962CONFIG_HAVE_ARCH_KGDB=y
963# CONFIG_KGDB is not set
968CONFIG_DEBUG_USER=y 964CONFIG_DEBUG_USER=y
969CONFIG_DEBUG_ERRORS=y 965CONFIG_DEBUG_ERRORS=y
970CONFIG_DEBUG_LL=y 966# CONFIG_DEBUG_STACK_USAGE is not set
971# CONFIG_DEBUG_ICEDCC is not set 967# CONFIG_DEBUG_LL is not set
972 968
973# 969#
974# Security options 970# Security options
975# 971#
976# CONFIG_KEYS is not set 972# CONFIG_KEYS is not set
977# CONFIG_SECURITY is not set 973# CONFIG_SECURITY is not set
974# CONFIG_SECURITYFS is not set
975# CONFIG_SECURITY_FILE_CAPABILITIES is not set
976CONFIG_CRYPTO=y
977
978#
979# Crypto core or helper
980#
981# CONFIG_CRYPTO_FIPS is not set
982# CONFIG_CRYPTO_MANAGER is not set
983# CONFIG_CRYPTO_GF128MUL is not set
984# CONFIG_CRYPTO_NULL is not set
985# CONFIG_CRYPTO_CRYPTD is not set
986# CONFIG_CRYPTO_AUTHENC is not set
987# CONFIG_CRYPTO_TEST is not set
988
989#
990# Authenticated Encryption with Associated Data
991#
992# CONFIG_CRYPTO_CCM is not set
993# CONFIG_CRYPTO_GCM is not set
994# CONFIG_CRYPTO_SEQIV is not set
995
996#
997# Block modes
998#
999# CONFIG_CRYPTO_CBC is not set
1000# CONFIG_CRYPTO_CTR is not set
1001# CONFIG_CRYPTO_CTS is not set
1002# CONFIG_CRYPTO_ECB is not set
1003# CONFIG_CRYPTO_LRW is not set
1004# CONFIG_CRYPTO_PCBC is not set
1005# CONFIG_CRYPTO_XTS is not set
1006
1007#
1008# Hash modes
1009#
1010# CONFIG_CRYPTO_HMAC is not set
1011# CONFIG_CRYPTO_XCBC is not set
1012
1013#
1014# Digest
1015#
1016# CONFIG_CRYPTO_CRC32C is not set
1017# CONFIG_CRYPTO_MD4 is not set
1018# CONFIG_CRYPTO_MD5 is not set
1019# CONFIG_CRYPTO_MICHAEL_MIC is not set
1020# CONFIG_CRYPTO_RMD128 is not set
1021# CONFIG_CRYPTO_RMD160 is not set
1022# CONFIG_CRYPTO_RMD256 is not set
1023# CONFIG_CRYPTO_RMD320 is not set
1024# CONFIG_CRYPTO_SHA1 is not set
1025# CONFIG_CRYPTO_SHA256 is not set
1026# CONFIG_CRYPTO_SHA512 is not set
1027# CONFIG_CRYPTO_TGR192 is not set
1028# CONFIG_CRYPTO_WP512 is not set
1029
1030#
1031# Ciphers
1032#
1033# CONFIG_CRYPTO_AES is not set
1034# CONFIG_CRYPTO_ANUBIS is not set
1035# CONFIG_CRYPTO_ARC4 is not set
1036# CONFIG_CRYPTO_BLOWFISH is not set
1037# CONFIG_CRYPTO_CAMELLIA is not set
1038# CONFIG_CRYPTO_CAST5 is not set
1039# CONFIG_CRYPTO_CAST6 is not set
1040# CONFIG_CRYPTO_DES is not set
1041# CONFIG_CRYPTO_FCRYPT is not set
1042# CONFIG_CRYPTO_KHAZAD is not set
1043# CONFIG_CRYPTO_SALSA20 is not set
1044# CONFIG_CRYPTO_SEED is not set
1045# CONFIG_CRYPTO_SERPENT is not set
1046# CONFIG_CRYPTO_TEA is not set
1047# CONFIG_CRYPTO_TWOFISH is not set
1048
1049#
1050# Compression
1051#
1052# CONFIG_CRYPTO_DEFLATE is not set
1053# CONFIG_CRYPTO_LZO is not set
978 1054
979# 1055#
980# Cryptographic options 1056# Random Number Generation
981# 1057#
982# CONFIG_CRYPTO is not set 1058# CONFIG_CRYPTO_ANSI_CPRNG is not set
1059# CONFIG_CRYPTO_HW is not set
983 1060
984# 1061#
985# Library routines 1062# Library routines
986# 1063#
1064CONFIG_BITREVERSE=y
987# CONFIG_CRC_CCITT is not set 1065# CONFIG_CRC_CCITT is not set
988# CONFIG_CRC16 is not set 1066# CONFIG_CRC16 is not set
1067# CONFIG_CRC_T10DIF is not set
1068# CONFIG_CRC_ITU_T is not set
989CONFIG_CRC32=y 1069CONFIG_CRC32=y
1070# CONFIG_CRC7 is not set
990# CONFIG_LIBCRC32C is not set 1071# CONFIG_LIBCRC32C is not set
991CONFIG_ZLIB_INFLATE=y 1072CONFIG_ZLIB_INFLATE=y
992CONFIG_PLIST=y 1073CONFIG_PLIST=y
1074CONFIG_HAS_IOMEM=y
1075CONFIG_HAS_IOPORT=y
1076CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/realview_defconfig b/arch/arm/configs/realview_defconfig
index 907e54344dad..7e253f58ed18 100644
--- a/arch/arm/configs/realview_defconfig
+++ b/arch/arm/configs/realview_defconfig
@@ -1,105 +1,204 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14-rc2 3# Linux kernel version: 2.6.28-rc2
4# Thu Sep 29 14:50:10 2005 4# Mon Nov 10 14:39:48 2008
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8# CONFIG_GENERIC_GPIO is not set
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
7CONFIG_MMU=y 11CONFIG_MMU=y
8CONFIG_UID16=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
9CONFIG_RWSEM_GENERIC_SPINLOCK=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
10CONFIG_GENERIC_CALIBRATE_DELAY=y 24CONFIG_GENERIC_CALIBRATE_DELAY=y
25CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
26CONFIG_VECTORS_BASE=0xffff0000
27CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
11 28
12# 29#
13# Code maturity level options 30# General setup
14# 31#
15# CONFIG_EXPERIMENTAL is not set 32CONFIG_EXPERIMENTAL=y
16CONFIG_CLEAN_COMPILE=y
17CONFIG_BROKEN_ON_SMP=y 33CONFIG_BROKEN_ON_SMP=y
18CONFIG_INIT_ENV_ARG_LIMIT=32 34CONFIG_INIT_ENV_ARG_LIMIT=32
19
20#
21# General setup
22#
23CONFIG_LOCALVERSION="" 35CONFIG_LOCALVERSION=""
24CONFIG_LOCALVERSION_AUTO=y 36CONFIG_LOCALVERSION_AUTO=y
25# CONFIG_SWAP is not set 37# CONFIG_SWAP is not set
26CONFIG_SYSVIPC=y 38CONFIG_SYSVIPC=y
39CONFIG_SYSVIPC_SYSCTL=y
40# CONFIG_POSIX_MQUEUE is not set
27# CONFIG_BSD_PROCESS_ACCT is not set 41# CONFIG_BSD_PROCESS_ACCT is not set
28CONFIG_SYSCTL=y 42# CONFIG_TASKSTATS is not set
29# CONFIG_AUDIT is not set 43# CONFIG_AUDIT is not set
30CONFIG_HOTPLUG=y
31CONFIG_KOBJECT_UEVENT=y
32# CONFIG_IKCONFIG is not set 44# CONFIG_IKCONFIG is not set
33CONFIG_INITRAMFS_SOURCE="" 45CONFIG_LOG_BUF_SHIFT=14
46# CONFIG_CGROUPS is not set
47# CONFIG_GROUP_SCHED is not set
48CONFIG_SYSFS_DEPRECATED=y
49CONFIG_SYSFS_DEPRECATED_V2=y
50# CONFIG_RELAY is not set
51CONFIG_NAMESPACES=y
52# CONFIG_UTS_NS is not set
53# CONFIG_IPC_NS is not set
54# CONFIG_USER_NS is not set
55# CONFIG_PID_NS is not set
56# CONFIG_BLK_DEV_INITRD is not set
57CONFIG_CC_OPTIMIZE_FOR_SIZE=y
58CONFIG_SYSCTL=y
34# CONFIG_EMBEDDED is not set 59# CONFIG_EMBEDDED is not set
60CONFIG_UID16=y
61CONFIG_SYSCTL_SYSCALL=y
35CONFIG_KALLSYMS=y 62CONFIG_KALLSYMS=y
36# CONFIG_KALLSYMS_ALL is not set 63# CONFIG_KALLSYMS_ALL is not set
37# CONFIG_KALLSYMS_EXTRA_PASS is not set 64# CONFIG_KALLSYMS_EXTRA_PASS is not set
65CONFIG_HOTPLUG=y
38CONFIG_PRINTK=y 66CONFIG_PRINTK=y
39CONFIG_BUG=y 67CONFIG_BUG=y
68CONFIG_ELF_CORE=y
69CONFIG_COMPAT_BRK=y
40CONFIG_BASE_FULL=y 70CONFIG_BASE_FULL=y
41CONFIG_FUTEX=y 71CONFIG_FUTEX=y
72CONFIG_ANON_INODES=y
42CONFIG_EPOLL=y 73CONFIG_EPOLL=y
43CONFIG_CC_OPTIMIZE_FOR_SIZE=y 74CONFIG_SIGNALFD=y
75CONFIG_TIMERFD=y
76CONFIG_EVENTFD=y
44CONFIG_SHMEM=y 77CONFIG_SHMEM=y
45CONFIG_CC_ALIGN_FUNCTIONS=0 78CONFIG_AIO=y
46CONFIG_CC_ALIGN_LABELS=0 79CONFIG_VM_EVENT_COUNTERS=y
47CONFIG_CC_ALIGN_LOOPS=0 80CONFIG_SLAB=y
48CONFIG_CC_ALIGN_JUMPS=0 81# CONFIG_SLUB is not set
82# CONFIG_SLOB is not set
83# CONFIG_PROFILING is not set
84# CONFIG_MARKERS is not set
85CONFIG_HAVE_OPROFILE=y
86# CONFIG_KPROBES is not set
87CONFIG_HAVE_KPROBES=y
88CONFIG_HAVE_KRETPROBES=y
89CONFIG_HAVE_CLK=y
90CONFIG_HAVE_GENERIC_DMA_COHERENT=y
91CONFIG_SLABINFO=y
92CONFIG_RT_MUTEXES=y
49# CONFIG_TINY_SHMEM is not set 93# CONFIG_TINY_SHMEM is not set
50CONFIG_BASE_SMALL=0 94CONFIG_BASE_SMALL=0
51
52#
53# Loadable module support
54#
55CONFIG_MODULES=y 95CONFIG_MODULES=y
96# CONFIG_MODULE_FORCE_LOAD is not set
56CONFIG_MODULE_UNLOAD=y 97CONFIG_MODULE_UNLOAD=y
57CONFIG_OBSOLETE_MODPARM=y 98# CONFIG_MODULE_FORCE_UNLOAD is not set
99# CONFIG_MODVERSIONS is not set
58# CONFIG_MODULE_SRCVERSION_ALL is not set 100# CONFIG_MODULE_SRCVERSION_ALL is not set
59# CONFIG_KMOD is not set 101CONFIG_KMOD=y
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# CONFIG_BLK_DEV_INTEGRITY is not set
108
109#
110# IO Schedulers
111#
112CONFIG_IOSCHED_NOOP=y
113# CONFIG_IOSCHED_AS is not set
114CONFIG_IOSCHED_DEADLINE=y
115# CONFIG_IOSCHED_CFQ is not set
116# CONFIG_DEFAULT_AS is not set
117CONFIG_DEFAULT_DEADLINE=y
118# CONFIG_DEFAULT_CFQ is not set
119# CONFIG_DEFAULT_NOOP is not set
120CONFIG_DEFAULT_IOSCHED="deadline"
121CONFIG_CLASSIC_RCU=y
122# CONFIG_FREEZER is not set
60 123
61# 124#
62# System Type 125# System Type
63# 126#
127# CONFIG_ARCH_AAEC2000 is not set
128# CONFIG_ARCH_INTEGRATOR is not set
129CONFIG_ARCH_REALVIEW=y
130# CONFIG_ARCH_VERSATILE is not set
131# CONFIG_ARCH_AT91 is not set
64# CONFIG_ARCH_CLPS7500 is not set 132# CONFIG_ARCH_CLPS7500 is not set
65# CONFIG_ARCH_CLPS711X is not set 133# CONFIG_ARCH_CLPS711X is not set
66# CONFIG_ARCH_CO285 is not set
67# CONFIG_ARCH_EBSA110 is not set 134# CONFIG_ARCH_EBSA110 is not set
135# CONFIG_ARCH_EP93XX is not set
68# CONFIG_ARCH_FOOTBRIDGE is not set 136# CONFIG_ARCH_FOOTBRIDGE is not set
69# CONFIG_ARCH_INTEGRATOR is not set 137# CONFIG_ARCH_NETX is not set
70# CONFIG_ARCH_IOP3XX is not set 138# CONFIG_ARCH_H720X is not set
71# CONFIG_ARCH_IXP4XX is not set 139# CONFIG_ARCH_IMX is not set
140# CONFIG_ARCH_IOP13XX is not set
141# CONFIG_ARCH_IOP32X is not set
142# CONFIG_ARCH_IOP33X is not set
143# CONFIG_ARCH_IXP23XX is not set
72# CONFIG_ARCH_IXP2000 is not set 144# CONFIG_ARCH_IXP2000 is not set
145# CONFIG_ARCH_IXP4XX is not set
73# CONFIG_ARCH_L7200 is not set 146# CONFIG_ARCH_L7200 is not set
147# CONFIG_ARCH_KIRKWOOD is not set
148# CONFIG_ARCH_KS8695 is not set
149# CONFIG_ARCH_NS9XXX is not set
150# CONFIG_ARCH_LOKI is not set
151# CONFIG_ARCH_MV78XX0 is not set
152# CONFIG_ARCH_MXC is not set
153# CONFIG_ARCH_ORION5X is not set
154# CONFIG_ARCH_PNX4008 is not set
74# CONFIG_ARCH_PXA is not set 155# CONFIG_ARCH_PXA is not set
75# CONFIG_ARCH_RPC is not set 156# CONFIG_ARCH_RPC is not set
76# CONFIG_ARCH_SA1100 is not set 157# CONFIG_ARCH_SA1100 is not set
77# CONFIG_ARCH_S3C2410 is not set 158# CONFIG_ARCH_S3C2410 is not set
78# CONFIG_ARCH_SHARK is not set 159# CONFIG_ARCH_SHARK is not set
79# CONFIG_ARCH_LH7A40X is not set 160# CONFIG_ARCH_LH7A40X is not set
161# CONFIG_ARCH_DAVINCI is not set
80# CONFIG_ARCH_OMAP is not set 162# CONFIG_ARCH_OMAP is not set
81# CONFIG_ARCH_VERSATILE is not set 163# CONFIG_ARCH_MSM is not set
82CONFIG_ARCH_REALVIEW=y 164
83# CONFIG_ARCH_IMX is not set 165#
84# CONFIG_ARCH_H720X is not set 166# Boot options
85# CONFIG_ARCH_AAEC2000 is not set 167#
168
169#
170# Power management
171#
86 172
87# 173#
88# RealView platform type 174# RealView platform type
89# 175#
90CONFIG_MACH_REALVIEW_EB=y 176CONFIG_MACH_REALVIEW_EB=y
177# CONFIG_REALVIEW_EB_A9MP is not set
178CONFIG_REALVIEW_EB_ARM11MP=y
179# CONFIG_REALVIEW_EB_ARM11MP_REVB is not set
180CONFIG_MACH_REALVIEW_PB11MP=y
181CONFIG_MACH_REALVIEW_PB1176=y
182# CONFIG_MACH_REALVIEW_PBA8 is not set
91 183
92# 184#
93# Processor Type 185# Processor Type
94# 186#
95CONFIG_CPU_32=y 187CONFIG_CPU_32=y
96CONFIG_CPU_ARM926T=y 188# CONFIG_CPU_ARM926T is not set
97# CONFIG_CPU_V6 is not set 189CONFIG_CPU_V6=y
98CONFIG_CPU_32v5=y 190# CONFIG_CPU_32v6K is not set
99CONFIG_CPU_ABRT_EV5TJ=y 191# CONFIG_CPU_V7 is not set
100CONFIG_CPU_CACHE_VIVT=y 192CONFIG_CPU_32v6=y
101CONFIG_CPU_COPY_V4WB=y 193CONFIG_CPU_ABRT_EV6=y
102CONFIG_CPU_TLB_V4WBI=y 194CONFIG_CPU_PABRT_NOIFAR=y
195CONFIG_CPU_CACHE_V6=y
196CONFIG_CPU_CACHE_VIPT=y
197CONFIG_CPU_COPY_V6=y
198CONFIG_CPU_TLB_V6=y
199CONFIG_CPU_HAS_ASID=y
200CONFIG_CPU_CP15=y
201CONFIG_CPU_CP15_MMU=y
103 202
104# 203#
105# Processor Features 204# Processor Features
@@ -107,8 +206,9 @@ CONFIG_CPU_TLB_V4WBI=y
107CONFIG_ARM_THUMB=y 206CONFIG_ARM_THUMB=y
108# CONFIG_CPU_ICACHE_DISABLE is not set 207# CONFIG_CPU_ICACHE_DISABLE is not set
109# CONFIG_CPU_DCACHE_DISABLE is not set 208# CONFIG_CPU_DCACHE_DISABLE is not set
110# CONFIG_CPU_DCACHE_WRITETHROUGH is not set 209# CONFIG_CPU_BPREDICT_DISABLE is not set
111# CONFIG_CPU_CACHE_ROUND_ROBIN is not set 210CONFIG_OUTER_CACHE=y
211CONFIG_CACHE_L2X0=y
112CONFIG_ARM_GIC=y 212CONFIG_ARM_GIC=y
113CONFIG_ICST307=y 213CONFIG_ICST307=y
114 214
@@ -116,20 +216,41 @@ CONFIG_ICST307=y
116# Bus support 216# Bus support
117# 217#
118CONFIG_ARM_AMBA=y 218CONFIG_ARM_AMBA=y
119CONFIG_ISA_DMA_API=y 219# CONFIG_PCI_SYSCALL is not set
120 220# CONFIG_ARCH_SUPPORTS_MSI is not set
121#
122# PCCARD (PCMCIA/CardBus) support
123#
124# CONFIG_PCCARD is not set 221# CONFIG_PCCARD is not set
125 222
126# 223#
127# Kernel Features 224# Kernel Features
128# 225#
129# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 226# CONFIG_NO_HZ is not set
227# CONFIG_HIGH_RES_TIMERS is not set
228CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
229# CONFIG_SMP is not set
230CONFIG_VMSPLIT_3G=y
231# CONFIG_VMSPLIT_2G is not set
232# CONFIG_VMSPLIT_1G is not set
233CONFIG_PAGE_OFFSET=0xC0000000
234# CONFIG_PREEMPT is not set
235CONFIG_HZ=100
236CONFIG_AEABI=y
237CONFIG_OABI_COMPAT=y
238CONFIG_ARCH_FLATMEM_HAS_HOLES=y
239# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
240# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
241CONFIG_SELECT_MEMORY_MODEL=y
242CONFIG_FLATMEM_MANUAL=y
243# CONFIG_DISCONTIGMEM_MANUAL is not set
244# CONFIG_SPARSEMEM_MANUAL is not set
130CONFIG_FLATMEM=y 245CONFIG_FLATMEM=y
131CONFIG_FLAT_NODE_MEM_MAP=y 246CONFIG_FLAT_NODE_MEM_MAP=y
132# CONFIG_SPARSEMEM_STATIC is not set 247CONFIG_PAGEFLAGS_EXTENDED=y
248CONFIG_SPLIT_PTLOCK_CPUS=4
249# CONFIG_RESOURCES_64BIT is not set
250# CONFIG_PHYS_ADDR_T_64BIT is not set
251CONFIG_ZONE_DMA_FLAG=0
252CONFIG_VIRT_TO_BUS=y
253CONFIG_UNEVICTABLE_LRU=y
133CONFIG_ALIGNMENT_TRAP=y 254CONFIG_ALIGNMENT_TRAP=y
134 255
135# 256#
@@ -139,6 +260,12 @@ CONFIG_ZBOOT_ROM_TEXT=0x0
139CONFIG_ZBOOT_ROM_BSS=0x0 260CONFIG_ZBOOT_ROM_BSS=0x0
140CONFIG_CMDLINE="root=/dev/nfs nfsroot=10.1.69.3:/work/nfsroot ip=dhcp console=ttyAMA0 mem=128M" 261CONFIG_CMDLINE="root=/dev/nfs nfsroot=10.1.69.3:/work/nfsroot ip=dhcp console=ttyAMA0 mem=128M"
141# CONFIG_XIP_KERNEL is not set 262# CONFIG_XIP_KERNEL is not set
263# CONFIG_KEXEC is not set
264
265#
266# CPU Power Management
267#
268# CONFIG_CPU_IDLE is not set
142 269
143# 270#
144# Floating point emulation 271# Floating point emulation
@@ -147,26 +274,24 @@ CONFIG_CMDLINE="root=/dev/nfs nfsroot=10.1.69.3:/work/nfsroot ip=dhcp console=tt
147# 274#
148# At least one emulation must be selected 275# At least one emulation must be selected
149# 276#
150CONFIG_FPE_NWFPE=y 277# CONFIG_FPE_NWFPE is not set
151# CONFIG_FPE_NWFPE_XP is not set 278# CONFIG_FPE_FASTFPE is not set
152# CONFIG_VFP is not set 279CONFIG_VFP=y
153 280
154# 281#
155# Userspace binary formats 282# Userspace binary formats
156# 283#
157CONFIG_BINFMT_ELF=y 284CONFIG_BINFMT_ELF=y
285# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
286CONFIG_HAVE_AOUT=y
158# CONFIG_BINFMT_AOUT is not set 287# CONFIG_BINFMT_AOUT is not set
159# CONFIG_BINFMT_MISC is not set 288# CONFIG_BINFMT_MISC is not set
160# CONFIG_ARTHUR is not set
161 289
162# 290#
163# Power management options 291# Power management options
164# 292#
165# CONFIG_PM is not set 293# CONFIG_PM is not set
166 294CONFIG_ARCH_SUSPEND_POSSIBLE=y
167#
168# Networking
169#
170CONFIG_NET=y 295CONFIG_NET=y
171 296
172# 297#
@@ -175,6 +300,11 @@ CONFIG_NET=y
175CONFIG_PACKET=y 300CONFIG_PACKET=y
176# CONFIG_PACKET_MMAP is not set 301# CONFIG_PACKET_MMAP is not set
177CONFIG_UNIX=y 302CONFIG_UNIX=y
303CONFIG_XFRM=y
304# CONFIG_XFRM_USER is not set
305# CONFIG_XFRM_SUB_POLICY is not set
306# CONFIG_XFRM_MIGRATE is not set
307# CONFIG_XFRM_STATISTICS is not set
178# CONFIG_NET_KEY is not set 308# CONFIG_NET_KEY is not set
179CONFIG_INET=y 309CONFIG_INET=y
180# CONFIG_IP_MULTICAST is not set 310# CONFIG_IP_MULTICAST is not set
@@ -186,34 +316,56 @@ CONFIG_IP_PNP_BOOTP=y
186# CONFIG_IP_PNP_RARP is not set 316# CONFIG_IP_PNP_RARP is not set
187# CONFIG_NET_IPIP is not set 317# CONFIG_NET_IPIP is not set
188# CONFIG_NET_IPGRE is not set 318# CONFIG_NET_IPGRE is not set
319# CONFIG_ARPD is not set
189# CONFIG_SYN_COOKIES is not set 320# CONFIG_SYN_COOKIES is not set
190# CONFIG_INET_AH is not set 321# CONFIG_INET_AH is not set
191# CONFIG_INET_ESP is not set 322# CONFIG_INET_ESP is not set
192# CONFIG_INET_IPCOMP is not set 323# CONFIG_INET_IPCOMP is not set
324# CONFIG_INET_XFRM_TUNNEL is not set
193# CONFIG_INET_TUNNEL is not set 325# CONFIG_INET_TUNNEL is not set
326CONFIG_INET_XFRM_MODE_TRANSPORT=y
327CONFIG_INET_XFRM_MODE_TUNNEL=y
328CONFIG_INET_XFRM_MODE_BEET=y
329# CONFIG_INET_LRO is not set
194CONFIG_INET_DIAG=y 330CONFIG_INET_DIAG=y
195CONFIG_INET_TCP_DIAG=y 331CONFIG_INET_TCP_DIAG=y
196# CONFIG_TCP_CONG_ADVANCED is not set 332# CONFIG_TCP_CONG_ADVANCED is not set
197CONFIG_TCP_CONG_BIC=y 333CONFIG_TCP_CONG_CUBIC=y
334CONFIG_DEFAULT_TCP_CONG="cubic"
335# CONFIG_TCP_MD5SIG is not set
198# CONFIG_IPV6 is not set 336# CONFIG_IPV6 is not set
337# CONFIG_NETWORK_SECMARK is not set
199# CONFIG_NETFILTER is not set 338# CONFIG_NETFILTER is not set
339# CONFIG_IP_DCCP is not set
340# CONFIG_IP_SCTP is not set
341# CONFIG_TIPC is not set
342# CONFIG_ATM is not set
200# CONFIG_BRIDGE is not set 343# CONFIG_BRIDGE is not set
344# CONFIG_NET_DSA is not set
201# CONFIG_VLAN_8021Q is not set 345# CONFIG_VLAN_8021Q is not set
202# CONFIG_DECNET is not set 346# CONFIG_DECNET is not set
203# CONFIG_LLC2 is not set 347# CONFIG_LLC2 is not set
204# CONFIG_IPX is not set 348# CONFIG_IPX is not set
205# CONFIG_ATALK is not set 349# CONFIG_ATALK is not set
350# CONFIG_X25 is not set
351# CONFIG_LAPB is not set
352# CONFIG_ECONET is not set
353# CONFIG_WAN_ROUTER is not set
206# CONFIG_NET_SCHED is not set 354# CONFIG_NET_SCHED is not set
207# CONFIG_NET_CLS_ROUTE is not set
208 355
209# 356#
210# Network testing 357# Network testing
211# 358#
212# CONFIG_NET_PKTGEN is not set 359# CONFIG_NET_PKTGEN is not set
213# CONFIG_HAMRADIO is not set 360# CONFIG_HAMRADIO is not set
361# CONFIG_CAN is not set
214# CONFIG_IRDA is not set 362# CONFIG_IRDA is not set
215# CONFIG_BT is not set 363# CONFIG_BT is not set
216# CONFIG_IEEE80211 is not set 364# CONFIG_AF_RXRPC is not set
365# CONFIG_PHONET is not set
366# CONFIG_WIRELESS is not set
367# CONFIG_RFKILL is not set
368# CONFIG_NET_9P is not set
217 369
218# 370#
219# Device Drivers 371# Device Drivers
@@ -222,30 +374,37 @@ CONFIG_TCP_CONG_BIC=y
222# 374#
223# Generic Driver Options 375# Generic Driver Options
224# 376#
377CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
225CONFIG_STANDALONE=y 378CONFIG_STANDALONE=y
226CONFIG_PREVENT_FIRMWARE_BUILD=y 379CONFIG_PREVENT_FIRMWARE_BUILD=y
227# CONFIG_FW_LOADER is not set 380CONFIG_FW_LOADER=y
381CONFIG_FIRMWARE_IN_KERNEL=y
382CONFIG_EXTRA_FIRMWARE=""
228# CONFIG_DEBUG_DRIVER is not set 383# CONFIG_DEBUG_DRIVER is not set
229 384# CONFIG_DEBUG_DEVRES is not set
230# 385# CONFIG_SYS_HYPERVISOR is not set
231# Memory Technology Devices (MTD) 386# CONFIG_CONNECTOR is not set
232#
233CONFIG_MTD=y 387CONFIG_MTD=y
234# CONFIG_MTD_DEBUG is not set 388# CONFIG_MTD_DEBUG is not set
235# CONFIG_MTD_CONCAT is not set 389CONFIG_MTD_CONCAT=y
236CONFIG_MTD_PARTITIONS=y 390CONFIG_MTD_PARTITIONS=y
237# CONFIG_MTD_REDBOOT_PARTS is not set 391# CONFIG_MTD_REDBOOT_PARTS is not set
238CONFIG_MTD_CMDLINE_PARTS=y 392CONFIG_MTD_CMDLINE_PARTS=y
239# CONFIG_MTD_AFS_PARTS is not set 393# CONFIG_MTD_AFS_PARTS is not set
394# CONFIG_MTD_AR7_PARTS is not set
240 395
241# 396#
242# User Modules And Translation Layers 397# User Modules And Translation Layers
243# 398#
244CONFIG_MTD_CHAR=y 399CONFIG_MTD_CHAR=y
400CONFIG_MTD_BLKDEVS=y
245CONFIG_MTD_BLOCK=y 401CONFIG_MTD_BLOCK=y
246# CONFIG_FTL is not set 402# CONFIG_FTL is not set
247# CONFIG_NFTL is not set 403# CONFIG_NFTL is not set
248# CONFIG_INFTL is not set 404# CONFIG_INFTL is not set
405# CONFIG_RFD_FTL is not set
406# CONFIG_SSFDC is not set
407# CONFIG_MTD_OOPS is not set
249 408
250# 409#
251# RAM/ROM/Flash chip drivers 410# RAM/ROM/Flash chip drivers
@@ -266,7 +425,6 @@ CONFIG_MTD_CFI_I2=y
266# CONFIG_MTD_CFI_I8 is not set 425# CONFIG_MTD_CFI_I8 is not set
267CONFIG_MTD_CFI_INTELEXT=y 426CONFIG_MTD_CFI_INTELEXT=y
268CONFIG_MTD_CFI_AMDSTD=y 427CONFIG_MTD_CFI_AMDSTD=y
269CONFIG_MTD_CFI_AMDSTD_RETRY=0
270# CONFIG_MTD_CFI_STAA is not set 428# CONFIG_MTD_CFI_STAA is not set
271CONFIG_MTD_CFI_UTIL=y 429CONFIG_MTD_CFI_UTIL=y
272# CONFIG_MTD_RAM is not set 430# CONFIG_MTD_RAM is not set
@@ -279,7 +437,6 @@ CONFIG_MTD_CFI_UTIL=y
279# CONFIG_MTD_COMPLEX_MAPPINGS is not set 437# CONFIG_MTD_COMPLEX_MAPPINGS is not set
280# CONFIG_MTD_PHYSMAP is not set 438# CONFIG_MTD_PHYSMAP is not set
281CONFIG_MTD_ARM_INTEGRATOR=y 439CONFIG_MTD_ARM_INTEGRATOR=y
282# CONFIG_MTD_EDB7312 is not set
283# CONFIG_MTD_PLATRAM is not set 440# CONFIG_MTD_PLATRAM is not set
284 441
285# 442#
@@ -288,7 +445,7 @@ CONFIG_MTD_ARM_INTEGRATOR=y
288# CONFIG_MTD_SLRAM is not set 445# CONFIG_MTD_SLRAM is not set
289# CONFIG_MTD_PHRAM is not set 446# CONFIG_MTD_PHRAM is not set
290# CONFIG_MTD_MTDRAM is not set 447# CONFIG_MTD_MTDRAM is not set
291# CONFIG_MTD_BLKMTD is not set 448# CONFIG_MTD_BLOCK2MTD is not set
292 449
293# 450#
294# Disk-On-Chip Device Drivers 451# Disk-On-Chip Device Drivers
@@ -296,121 +453,81 @@ CONFIG_MTD_ARM_INTEGRATOR=y
296# CONFIG_MTD_DOC2000 is not set 453# CONFIG_MTD_DOC2000 is not set
297# CONFIG_MTD_DOC2001 is not set 454# CONFIG_MTD_DOC2001 is not set
298# CONFIG_MTD_DOC2001PLUS is not set 455# CONFIG_MTD_DOC2001PLUS is not set
299
300#
301# NAND Flash Device Drivers
302#
303# CONFIG_MTD_NAND is not set 456# CONFIG_MTD_NAND is not set
457# CONFIG_MTD_ONENAND is not set
304 458
305# 459#
306# Parallel port support 460# UBI - Unsorted block images
307# 461#
462# CONFIG_MTD_UBI is not set
308# CONFIG_PARPORT is not set 463# CONFIG_PARPORT is not set
309 464CONFIG_BLK_DEV=y
310#
311# Plug and Play support
312#
313
314#
315# Block devices
316#
317# CONFIG_BLK_DEV_COW_COMMON is not set 465# CONFIG_BLK_DEV_COW_COMMON is not set
318# CONFIG_BLK_DEV_LOOP is not set 466# CONFIG_BLK_DEV_LOOP is not set
319# CONFIG_BLK_DEV_NBD is not set 467# CONFIG_BLK_DEV_NBD is not set
320# CONFIG_BLK_DEV_RAM is not set 468# CONFIG_BLK_DEV_RAM is not set
321CONFIG_BLK_DEV_RAM_COUNT=16
322# CONFIG_CDROM_PKTCDVD is not set 469# CONFIG_CDROM_PKTCDVD is not set
323
324#
325# IO Schedulers
326#
327CONFIG_IOSCHED_NOOP=y
328# CONFIG_IOSCHED_AS is not set
329CONFIG_IOSCHED_DEADLINE=y
330# CONFIG_IOSCHED_CFQ is not set
331# CONFIG_ATA_OVER_ETH is not set 470# CONFIG_ATA_OVER_ETH is not set
471CONFIG_MISC_DEVICES=y
472# CONFIG_EEPROM_93CX6 is not set
473# CONFIG_ENCLOSURE_SERVICES is not set
474CONFIG_HAVE_IDE=y
475# CONFIG_IDE is not set
332 476
333# 477#
334# SCSI device support 478# SCSI device support
335# 479#
336# CONFIG_RAID_ATTRS is not set 480# CONFIG_RAID_ATTRS is not set
337# CONFIG_SCSI is not set 481# CONFIG_SCSI is not set
338 482# CONFIG_SCSI_DMA is not set
339# 483# CONFIG_SCSI_NETLINK is not set
340# Multi-device support (RAID and LVM) 484# CONFIG_ATA is not set
341#
342# CONFIG_MD is not set 485# CONFIG_MD is not set
343
344#
345# Fusion MPT device support
346#
347# CONFIG_FUSION is not set
348
349#
350# IEEE 1394 (FireWire) support
351#
352
353#
354# I2O device support
355#
356
357#
358# Network device support
359#
360CONFIG_NETDEVICES=y 486CONFIG_NETDEVICES=y
361# CONFIG_DUMMY is not set 487# CONFIG_DUMMY is not set
362# CONFIG_BONDING is not set 488# CONFIG_BONDING is not set
489# CONFIG_MACVLAN is not set
363# CONFIG_EQUALIZER is not set 490# CONFIG_EQUALIZER is not set
364# CONFIG_TUN is not set 491# CONFIG_TUN is not set
365 492# CONFIG_VETH is not set
366#
367# PHY device support
368#
369# CONFIG_PHYLIB is not set 493# CONFIG_PHYLIB is not set
370
371#
372# Ethernet (10 or 100Mbit)
373#
374CONFIG_NET_ETHERNET=y 494CONFIG_NET_ETHERNET=y
375CONFIG_MII=y 495CONFIG_MII=y
496# CONFIG_AX88796 is not set
376CONFIG_SMC91X=y 497CONFIG_SMC91X=y
377# CONFIG_DM9000 is not set 498# CONFIG_DM9000 is not set
378 499CONFIG_SMC911X=y
379# 500# CONFIG_IBM_NEW_EMAC_ZMII is not set
380# Ethernet (1000 Mbit) 501# CONFIG_IBM_NEW_EMAC_RGMII is not set
381# 502# CONFIG_IBM_NEW_EMAC_TAH is not set
382 503# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
383# 504# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
384# Ethernet (10000 Mbit) 505# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
385# 506# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
386 507# CONFIG_B44 is not set
387# 508# CONFIG_NETDEV_1000 is not set
388# Token Ring devices 509# CONFIG_NETDEV_10000 is not set
389# 510
390 511#
391# 512# Wireless LAN
392# Wireless LAN (non-hamradio) 513#
393# 514# CONFIG_WLAN_PRE80211 is not set
394# CONFIG_NET_RADIO is not set 515# CONFIG_WLAN_80211 is not set
395 516# CONFIG_IWLWIFI_LEDS is not set
396#
397# Wan interfaces
398#
399# CONFIG_WAN is not set 517# CONFIG_WAN is not set
400# CONFIG_PPP is not set 518# CONFIG_PPP is not set
401# CONFIG_SLIP is not set 519# CONFIG_SLIP is not set
520# CONFIG_NETCONSOLE is not set
402# CONFIG_NETPOLL is not set 521# CONFIG_NETPOLL is not set
403# CONFIG_NET_POLL_CONTROLLER is not set 522# CONFIG_NET_POLL_CONTROLLER is not set
404
405#
406# ISDN subsystem
407#
408# CONFIG_ISDN is not set 523# CONFIG_ISDN is not set
409 524
410# 525#
411# Input device support 526# Input device support
412# 527#
413CONFIG_INPUT=y 528CONFIG_INPUT=y
529# CONFIG_INPUT_FF_MEMLESS is not set
530# CONFIG_INPUT_POLLDEV is not set
414 531
415# 532#
416# Userland interfaces 533# Userland interfaces
@@ -420,7 +537,6 @@ CONFIG_INPUT_MOUSEDEV_PSAUX=y
420CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 537CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
421CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 538CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
422# CONFIG_INPUT_JOYDEV is not set 539# CONFIG_INPUT_JOYDEV is not set
423# CONFIG_INPUT_TSDEV is not set
424# CONFIG_INPUT_EVDEV is not set 540# CONFIG_INPUT_EVDEV is not set
425# CONFIG_INPUT_EVBUG is not set 541# CONFIG_INPUT_EVBUG is not set
426 542
@@ -433,11 +549,19 @@ CONFIG_KEYBOARD_ATKBD=y
433# CONFIG_KEYBOARD_LKKBD is not set 549# CONFIG_KEYBOARD_LKKBD is not set
434# CONFIG_KEYBOARD_XTKBD is not set 550# CONFIG_KEYBOARD_XTKBD is not set
435# CONFIG_KEYBOARD_NEWTON is not set 551# CONFIG_KEYBOARD_NEWTON is not set
552# CONFIG_KEYBOARD_STOWAWAY is not set
436CONFIG_INPUT_MOUSE=y 553CONFIG_INPUT_MOUSE=y
437CONFIG_MOUSE_PS2=y 554CONFIG_MOUSE_PS2=y
555CONFIG_MOUSE_PS2_ALPS=y
556CONFIG_MOUSE_PS2_LOGIPS2PP=y
557CONFIG_MOUSE_PS2_SYNAPTICS=y
558CONFIG_MOUSE_PS2_LIFEBOOK=y
559CONFIG_MOUSE_PS2_TRACKPOINT=y
560# CONFIG_MOUSE_PS2_TOUCHKIT is not set
438# CONFIG_MOUSE_SERIAL is not set 561# CONFIG_MOUSE_SERIAL is not set
439# CONFIG_MOUSE_VSXXXAA is not set 562# CONFIG_MOUSE_VSXXXAA is not set
440# CONFIG_INPUT_JOYSTICK is not set 563# CONFIG_INPUT_JOYSTICK is not set
564# CONFIG_INPUT_TABLET is not set
441# CONFIG_INPUT_TOUCHSCREEN is not set 565# CONFIG_INPUT_TOUCHSCREEN is not set
442# CONFIG_INPUT_MISC is not set 566# CONFIG_INPUT_MISC is not set
443 567
@@ -455,8 +579,11 @@ CONFIG_SERIO_LIBPS2=y
455# Character devices 579# Character devices
456# 580#
457CONFIG_VT=y 581CONFIG_VT=y
582CONFIG_CONSOLE_TRANSLATIONS=y
458CONFIG_VT_CONSOLE=y 583CONFIG_VT_CONSOLE=y
459CONFIG_HW_CONSOLE=y 584CONFIG_HW_CONSOLE=y
585# CONFIG_VT_HW_CONSOLE_BINDING is not set
586CONFIG_DEVKMEM=y
460# CONFIG_SERIAL_NONSTANDARD is not set 587# CONFIG_SERIAL_NONSTANDARD is not set
461 588
462# 589#
@@ -475,73 +602,91 @@ CONFIG_SERIAL_CORE_CONSOLE=y
475CONFIG_UNIX98_PTYS=y 602CONFIG_UNIX98_PTYS=y
476CONFIG_LEGACY_PTYS=y 603CONFIG_LEGACY_PTYS=y
477CONFIG_LEGACY_PTY_COUNT=16 604CONFIG_LEGACY_PTY_COUNT=16
478
479#
480# IPMI
481#
482# CONFIG_IPMI_HANDLER is not set 605# CONFIG_IPMI_HANDLER is not set
483 606# CONFIG_HW_RANDOM is not set
484#
485# Watchdog Cards
486#
487# CONFIG_WATCHDOG is not set
488# CONFIG_NVRAM is not set 607# CONFIG_NVRAM is not set
489# CONFIG_RTC is not set
490# CONFIG_DTLK is not set
491# CONFIG_R3964 is not set 608# CONFIG_R3964 is not set
492
493#
494# Ftape, the floppy tape device driver
495#
496# CONFIG_RAW_DRIVER is not set 609# CONFIG_RAW_DRIVER is not set
497 610# CONFIG_TCG_TPM is not set
498#
499# TPM devices
500#
501
502#
503# I2C support
504#
505# CONFIG_I2C is not set 611# CONFIG_I2C is not set
612# CONFIG_SPI is not set
613# CONFIG_W1 is not set
614# CONFIG_POWER_SUPPLY is not set
615# CONFIG_HWMON is not set
616# CONFIG_THERMAL is not set
617# CONFIG_THERMAL_HWMON is not set
618# CONFIG_WATCHDOG is not set
506 619
507# 620#
508# Hardware Monitoring support 621# Sonics Silicon Backplane
509# 622#
510# CONFIG_HWMON is not set 623CONFIG_SSB_POSSIBLE=y
511# CONFIG_HWMON_VID is not set 624# CONFIG_SSB is not set
512 625
513# 626#
514# Misc devices 627# Multifunction device drivers
515# 628#
629# CONFIG_MFD_CORE is not set
630# CONFIG_MFD_SM501 is not set
631# CONFIG_HTC_PASIC3 is not set
632# CONFIG_MFD_TMIO is not set
633# CONFIG_MFD_T7L66XB is not set
634# CONFIG_MFD_TC6387XB is not set
635# CONFIG_MFD_WM8400 is not set
516 636
517# 637#
518# Multimedia Capabilities Port drivers 638# Multimedia devices
519# 639#
520 640
521# 641#
522# Multimedia devices 642# Multimedia core support
523# 643#
524# CONFIG_VIDEO_DEV is not set 644# CONFIG_VIDEO_DEV is not set
645# CONFIG_DVB_CORE is not set
646# CONFIG_VIDEO_MEDIA is not set
525 647
526# 648#
527# Digital Video Broadcasting Devices 649# Multimedia drivers
528# 650#
529# CONFIG_DVB is not set 651# CONFIG_DAB is not set
530 652
531# 653#
532# Graphics support 654# Graphics support
533# 655#
656# CONFIG_VGASTATE is not set
657# CONFIG_VIDEO_OUTPUT_CONTROL is not set
534CONFIG_FB=y 658CONFIG_FB=y
659# CONFIG_FIRMWARE_EDID is not set
660# CONFIG_FB_DDC is not set
661# CONFIG_FB_BOOT_VESA_SUPPORT is not set
535CONFIG_FB_CFB_FILLRECT=y 662CONFIG_FB_CFB_FILLRECT=y
536CONFIG_FB_CFB_COPYAREA=y 663CONFIG_FB_CFB_COPYAREA=y
537CONFIG_FB_CFB_IMAGEBLIT=y 664CONFIG_FB_CFB_IMAGEBLIT=y
538CONFIG_FB_SOFT_CURSOR=y 665# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
666# CONFIG_FB_SYS_FILLRECT is not set
667# CONFIG_FB_SYS_COPYAREA is not set
668# CONFIG_FB_SYS_IMAGEBLIT is not set
669# CONFIG_FB_FOREIGN_ENDIAN is not set
670# CONFIG_FB_SYS_FOPS is not set
671# CONFIG_FB_SVGALIB is not set
539# CONFIG_FB_MACMODES is not set 672# CONFIG_FB_MACMODES is not set
673# CONFIG_FB_BACKLIGHT is not set
540# CONFIG_FB_MODE_HELPERS is not set 674# CONFIG_FB_MODE_HELPERS is not set
541# CONFIG_FB_TILEBLITTING is not set 675# CONFIG_FB_TILEBLITTING is not set
676
677#
678# Frame buffer hardware drivers
679#
542CONFIG_FB_ARMCLCD=y 680CONFIG_FB_ARMCLCD=y
543# CONFIG_FB_S1D13XXX is not set 681# CONFIG_FB_S1D13XXX is not set
544# CONFIG_FB_VIRTUAL is not set 682# CONFIG_FB_VIRTUAL is not set
683# CONFIG_FB_METRONOME is not set
684# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
685
686#
687# Display device support
688#
689# CONFIG_DISPLAY_SUPPORT is not set
545 690
546# 691#
547# Console display driver support 692# Console display driver support
@@ -549,27 +694,17 @@ CONFIG_FB_ARMCLCD=y
549# CONFIG_VGA_CONSOLE is not set 694# CONFIG_VGA_CONSOLE is not set
550CONFIG_DUMMY_CONSOLE=y 695CONFIG_DUMMY_CONSOLE=y
551CONFIG_FRAMEBUFFER_CONSOLE=y 696CONFIG_FRAMEBUFFER_CONSOLE=y
697# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
698# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
552# CONFIG_FONTS is not set 699# CONFIG_FONTS is not set
553CONFIG_FONT_8x8=y 700CONFIG_FONT_8x8=y
554CONFIG_FONT_8x16=y 701CONFIG_FONT_8x16=y
555
556#
557# Logo configuration
558#
559CONFIG_LOGO=y 702CONFIG_LOGO=y
560# CONFIG_LOGO_LINUX_MONO is not set 703# CONFIG_LOGO_LINUX_MONO is not set
561# CONFIG_LOGO_LINUX_VGA16 is not set 704# CONFIG_LOGO_LINUX_VGA16 is not set
562CONFIG_LOGO_LINUX_CLUT224=y 705CONFIG_LOGO_LINUX_CLUT224=y
563# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
564
565#
566# Sound
567#
568CONFIG_SOUND=y 706CONFIG_SOUND=y
569 707CONFIG_SOUND_OSS_CORE=y
570#
571# Advanced Linux Sound Architecture
572#
573CONFIG_SND=y 708CONFIG_SND=y
574CONFIG_SND_TIMER=y 709CONFIG_SND_TIMER=y
575CONFIG_SND_PCM=y 710CONFIG_SND_PCM=y
@@ -577,59 +712,71 @@ CONFIG_SND_PCM=y
577CONFIG_SND_OSSEMUL=y 712CONFIG_SND_OSSEMUL=y
578CONFIG_SND_MIXER_OSS=y 713CONFIG_SND_MIXER_OSS=y
579CONFIG_SND_PCM_OSS=y 714CONFIG_SND_PCM_OSS=y
715CONFIG_SND_PCM_OSS_PLUGINS=y
716# CONFIG_SND_DYNAMIC_MINORS is not set
717CONFIG_SND_SUPPORT_OLD_API=y
718CONFIG_SND_VERBOSE_PROCFS=y
580# CONFIG_SND_VERBOSE_PRINTK is not set 719# CONFIG_SND_VERBOSE_PRINTK is not set
581# CONFIG_SND_DEBUG is not set 720# CONFIG_SND_DEBUG is not set
582 721CONFIG_SND_VMASTER=y
583# 722CONFIG_SND_AC97_CODEC=y
584# Generic devices 723# CONFIG_SND_DRIVERS is not set
585# 724CONFIG_SND_ARM=y
586# CONFIG_SND_DUMMY is not set 725CONFIG_SND_ARMAACI=y
587# CONFIG_SND_MTPAV is not set 726# CONFIG_SND_SOC is not set
588# CONFIG_SND_SERIAL_U16550 is not set
589# CONFIG_SND_MPU401 is not set
590
591#
592# ALSA ARM devices
593#
594# CONFIG_SND_ARMAACI is not set
595
596#
597# Open Sound System
598#
599# CONFIG_SOUND_PRIME is not set 727# CONFIG_SOUND_PRIME is not set
728CONFIG_AC97_BUS=y
729# CONFIG_HID_SUPPORT is not set
730# CONFIG_USB_SUPPORT is not set
731CONFIG_MMC=y
732# CONFIG_MMC_DEBUG is not set
733# CONFIG_MMC_UNSAFE_RESUME is not set
600 734
601# 735#
602# USB support 736# MMC/SD/SDIO Card Drivers
603# 737#
604CONFIG_USB_ARCH_HAS_HCD=y 738CONFIG_MMC_BLOCK=y
605# CONFIG_USB_ARCH_HAS_OHCI is not set 739CONFIG_MMC_BLOCK_BOUNCE=y
606# CONFIG_USB is not set 740# CONFIG_SDIO_UART is not set
741# CONFIG_MMC_TEST is not set
607 742
608# 743#
609# USB Gadget Support 744# MMC/SD/SDIO Host Controller Drivers
610# 745#
611# CONFIG_USB_GADGET is not set 746CONFIG_MMC_ARMMMCI=y
747# CONFIG_MMC_SDHCI is not set
748# CONFIG_MEMSTICK is not set
749# CONFIG_ACCESSIBILITY is not set
750# CONFIG_NEW_LEDS is not set
751CONFIG_RTC_LIB=y
752# CONFIG_RTC_CLASS is not set
753# CONFIG_DMADEVICES is not set
612 754
613# 755#
614# MMC/SD Card support 756# Voltage and Current regulators
615# 757#
616# CONFIG_MMC is not set 758# CONFIG_REGULATOR is not set
759# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
760# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
761# CONFIG_REGULATOR_BQ24022 is not set
762# CONFIG_UIO is not set
617 763
618# 764#
619# File systems 765# File systems
620# 766#
621# CONFIG_EXT2_FS is not set 767# CONFIG_EXT2_FS is not set
622# CONFIG_EXT3_FS is not set 768# CONFIG_EXT3_FS is not set
623# CONFIG_JBD is not set 769# CONFIG_EXT4_FS is not set
624# CONFIG_REISERFS_FS is not set 770# CONFIG_REISERFS_FS is not set
625# CONFIG_JFS_FS is not set 771# CONFIG_JFS_FS is not set
626# CONFIG_FS_POSIX_ACL is not set 772# CONFIG_FS_POSIX_ACL is not set
773CONFIG_FILE_LOCKING=y
627# CONFIG_XFS_FS is not set 774# CONFIG_XFS_FS is not set
628# CONFIG_MINIX_FS is not set 775# CONFIG_OCFS2_FS is not set
629# CONFIG_ROMFS_FS is not set 776CONFIG_DNOTIFY=y
630CONFIG_INOTIFY=y 777CONFIG_INOTIFY=y
778CONFIG_INOTIFY_USER=y
631# CONFIG_QUOTA is not set 779# CONFIG_QUOTA is not set
632CONFIG_DNOTIFY=y
633# CONFIG_AUTOFS_FS is not set 780# CONFIG_AUTOFS_FS is not set
634# CONFIG_AUTOFS4_FS is not set 781# CONFIG_AUTOFS4_FS is not set
635# CONFIG_FUSE_FS is not set 782# CONFIG_FUSE_FS is not set
@@ -654,51 +801,59 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
654# Pseudo filesystems 801# Pseudo filesystems
655# 802#
656CONFIG_PROC_FS=y 803CONFIG_PROC_FS=y
804CONFIG_PROC_SYSCTL=y
805CONFIG_PROC_PAGE_MONITOR=y
657CONFIG_SYSFS=y 806CONFIG_SYSFS=y
658CONFIG_TMPFS=y 807CONFIG_TMPFS=y
808# CONFIG_TMPFS_POSIX_ACL is not set
659# CONFIG_HUGETLB_PAGE is not set 809# CONFIG_HUGETLB_PAGE is not set
660CONFIG_RAMFS=y 810# CONFIG_CONFIGFS_FS is not set
661# CONFIG_RELAYFS_FS is not set
662 811
663# 812#
664# Miscellaneous filesystems 813# Miscellaneous filesystems
665# 814#
815# CONFIG_ADFS_FS is not set
816# CONFIG_AFFS_FS is not set
817# CONFIG_HFS_FS is not set
666# CONFIG_HFSPLUS_FS is not set 818# CONFIG_HFSPLUS_FS is not set
667# CONFIG_JFFS_FS is not set 819# CONFIG_BEFS_FS is not set
820# CONFIG_BFS_FS is not set
821# CONFIG_EFS_FS is not set
668# CONFIG_JFFS2_FS is not set 822# CONFIG_JFFS2_FS is not set
669CONFIG_CRAMFS=y 823CONFIG_CRAMFS=y
670# CONFIG_VXFS_FS is not set 824# CONFIG_VXFS_FS is not set
825# CONFIG_MINIX_FS is not set
826# CONFIG_OMFS_FS is not set
671# CONFIG_HPFS_FS is not set 827# CONFIG_HPFS_FS is not set
672# CONFIG_QNX4FS_FS is not set 828# CONFIG_QNX4FS_FS is not set
829# CONFIG_ROMFS_FS is not set
673# CONFIG_SYSV_FS is not set 830# CONFIG_SYSV_FS is not set
674# CONFIG_UFS_FS is not set 831# CONFIG_UFS_FS is not set
675 832CONFIG_NETWORK_FILESYSTEMS=y
676#
677# Network File Systems
678#
679CONFIG_NFS_FS=y 833CONFIG_NFS_FS=y
680CONFIG_NFS_V3=y 834CONFIG_NFS_V3=y
681# CONFIG_NFS_V3_ACL is not set 835# CONFIG_NFS_V3_ACL is not set
682# CONFIG_NFSD is not set 836# CONFIG_NFS_V4 is not set
683CONFIG_ROOT_NFS=y 837CONFIG_ROOT_NFS=y
838# CONFIG_NFSD is not set
684CONFIG_LOCKD=y 839CONFIG_LOCKD=y
685CONFIG_LOCKD_V4=y 840CONFIG_LOCKD_V4=y
686CONFIG_NFS_COMMON=y 841CONFIG_NFS_COMMON=y
687CONFIG_SUNRPC=y 842CONFIG_SUNRPC=y
843# CONFIG_SUNRPC_REGISTER_V4 is not set
844# CONFIG_RPCSEC_GSS_KRB5 is not set
845# CONFIG_RPCSEC_GSS_SPKM3 is not set
688# CONFIG_SMB_FS is not set 846# CONFIG_SMB_FS is not set
689# CONFIG_CIFS is not set 847# CONFIG_CIFS is not set
690# CONFIG_NCP_FS is not set 848# CONFIG_NCP_FS is not set
691# CONFIG_CODA_FS is not set 849# CONFIG_CODA_FS is not set
850# CONFIG_AFS_FS is not set
692 851
693# 852#
694# Partition Types 853# Partition Types
695# 854#
696# CONFIG_PARTITION_ADVANCED is not set 855# CONFIG_PARTITION_ADVANCED is not set
697CONFIG_MSDOS_PARTITION=y 856CONFIG_MSDOS_PARTITION=y
698
699#
700# Native Language Support
701#
702CONFIG_NLS=y 857CONFIG_NLS=y
703CONFIG_NLS_DEFAULT="iso8859-1" 858CONFIG_NLS_DEFAULT="iso8859-1"
704CONFIG_NLS_CODEPAGE_437=y 859CONFIG_NLS_CODEPAGE_437=y
@@ -739,26 +894,71 @@ CONFIG_NLS_ISO8859_1=y
739# CONFIG_NLS_KOI8_R is not set 894# CONFIG_NLS_KOI8_R is not set
740# CONFIG_NLS_KOI8_U is not set 895# CONFIG_NLS_KOI8_U is not set
741# CONFIG_NLS_UTF8 is not set 896# CONFIG_NLS_UTF8 is not set
897# CONFIG_DLM is not set
742 898
743# 899#
744# Kernel hacking 900# Kernel hacking
745# 901#
746# CONFIG_PRINTK_TIME is not set 902# CONFIG_PRINTK_TIME is not set
747CONFIG_DEBUG_KERNEL=y 903CONFIG_ENABLE_WARN_DEPRECATED=y
904CONFIG_ENABLE_MUST_CHECK=y
905CONFIG_FRAME_WARN=1024
748CONFIG_MAGIC_SYSRQ=y 906CONFIG_MAGIC_SYSRQ=y
749CONFIG_LOG_BUF_SHIFT=14 907# CONFIG_UNUSED_SYMBOLS is not set
908# CONFIG_DEBUG_FS is not set
909# CONFIG_HEADERS_CHECK is not set
910CONFIG_DEBUG_KERNEL=y
911# CONFIG_DEBUG_SHIRQ is not set
750CONFIG_DETECT_SOFTLOCKUP=y 912CONFIG_DETECT_SOFTLOCKUP=y
913# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
914CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
915# CONFIG_SCHED_DEBUG is not set
751# CONFIG_SCHEDSTATS is not set 916# CONFIG_SCHEDSTATS is not set
917# CONFIG_TIMER_STATS is not set
918# CONFIG_DEBUG_OBJECTS is not set
752# CONFIG_DEBUG_SLAB is not set 919# CONFIG_DEBUG_SLAB is not set
920# CONFIG_DEBUG_RT_MUTEXES is not set
921# CONFIG_RT_MUTEX_TESTER is not set
753# CONFIG_DEBUG_SPINLOCK is not set 922# CONFIG_DEBUG_SPINLOCK is not set
923# CONFIG_DEBUG_MUTEXES is not set
924# CONFIG_DEBUG_LOCK_ALLOC is not set
925# CONFIG_PROVE_LOCKING is not set
926# CONFIG_LOCK_STAT is not set
754# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 927# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
928# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
755# CONFIG_DEBUG_KOBJECT is not set 929# CONFIG_DEBUG_KOBJECT is not set
756CONFIG_DEBUG_BUGVERBOSE=y 930CONFIG_DEBUG_BUGVERBOSE=y
757# CONFIG_DEBUG_INFO is not set 931# CONFIG_DEBUG_INFO is not set
758# CONFIG_DEBUG_FS is not set 932# CONFIG_DEBUG_VM is not set
933# CONFIG_DEBUG_WRITECOUNT is not set
934CONFIG_DEBUG_MEMORY_INIT=y
935# CONFIG_DEBUG_LIST is not set
936# CONFIG_DEBUG_SG is not set
759CONFIG_FRAME_POINTER=y 937CONFIG_FRAME_POINTER=y
938# CONFIG_BOOT_PRINTK_DELAY is not set
939# CONFIG_RCU_TORTURE_TEST is not set
940# CONFIG_RCU_CPU_STALL_DETECTOR is not set
941# CONFIG_BACKTRACE_SELF_TEST is not set
942# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
943# CONFIG_FAULT_INJECTION is not set
944# CONFIG_LATENCYTOP is not set
945# CONFIG_SYSCTL_SYSCALL_CHECK is not set
946CONFIG_NOP_TRACER=y
947CONFIG_HAVE_FTRACE=y
948CONFIG_HAVE_DYNAMIC_FTRACE=y
949# CONFIG_FTRACE is not set
950# CONFIG_IRQSOFF_TRACER is not set
951# CONFIG_SCHED_TRACER is not set
952# CONFIG_CONTEXT_SWITCH_TRACER is not set
953# CONFIG_BOOT_TRACER is not set
954# CONFIG_STACK_TRACER is not set
955# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
956# CONFIG_SAMPLES is not set
957CONFIG_HAVE_ARCH_KGDB=y
958# CONFIG_KGDB is not set
760CONFIG_DEBUG_USER=y 959CONFIG_DEBUG_USER=y
761CONFIG_DEBUG_ERRORS=y 960CONFIG_DEBUG_ERRORS=y
961# CONFIG_DEBUG_STACK_USAGE is not set
762# CONFIG_DEBUG_LL is not set 962# CONFIG_DEBUG_LL is not set
763 963
764# 964#
@@ -766,21 +966,106 @@ CONFIG_DEBUG_ERRORS=y
766# 966#
767# CONFIG_KEYS is not set 967# CONFIG_KEYS is not set
768# CONFIG_SECURITY is not set 968# CONFIG_SECURITY is not set
969# CONFIG_SECURITYFS is not set
970# CONFIG_SECURITY_FILE_CAPABILITIES is not set
971CONFIG_CRYPTO=y
972
973#
974# Crypto core or helper
975#
976# CONFIG_CRYPTO_FIPS is not set
977# CONFIG_CRYPTO_MANAGER is not set
978# CONFIG_CRYPTO_GF128MUL is not set
979# CONFIG_CRYPTO_NULL is not set
980# CONFIG_CRYPTO_CRYPTD is not set
981# CONFIG_CRYPTO_AUTHENC is not set
982# CONFIG_CRYPTO_TEST is not set
983
984#
985# Authenticated Encryption with Associated Data
986#
987# CONFIG_CRYPTO_CCM is not set
988# CONFIG_CRYPTO_GCM is not set
989# CONFIG_CRYPTO_SEQIV is not set
990
991#
992# Block modes
993#
994# CONFIG_CRYPTO_CBC is not set
995# CONFIG_CRYPTO_CTR is not set
996# CONFIG_CRYPTO_CTS is not set
997# CONFIG_CRYPTO_ECB is not set
998# CONFIG_CRYPTO_LRW is not set
999# CONFIG_CRYPTO_PCBC is not set
1000# CONFIG_CRYPTO_XTS is not set
1001
1002#
1003# Hash modes
1004#
1005# CONFIG_CRYPTO_HMAC is not set
1006# CONFIG_CRYPTO_XCBC is not set
1007
1008#
1009# Digest
1010#
1011# CONFIG_CRYPTO_CRC32C is not set
1012# CONFIG_CRYPTO_MD4 is not set
1013# CONFIG_CRYPTO_MD5 is not set
1014# CONFIG_CRYPTO_MICHAEL_MIC is not set
1015# CONFIG_CRYPTO_RMD128 is not set
1016# CONFIG_CRYPTO_RMD160 is not set
1017# CONFIG_CRYPTO_RMD256 is not set
1018# CONFIG_CRYPTO_RMD320 is not set
1019# CONFIG_CRYPTO_SHA1 is not set
1020# CONFIG_CRYPTO_SHA256 is not set
1021# CONFIG_CRYPTO_SHA512 is not set
1022# CONFIG_CRYPTO_TGR192 is not set
1023# CONFIG_CRYPTO_WP512 is not set
1024
1025#
1026# Ciphers
1027#
1028# CONFIG_CRYPTO_AES is not set
1029# CONFIG_CRYPTO_ANUBIS is not set
1030# CONFIG_CRYPTO_ARC4 is not set
1031# CONFIG_CRYPTO_BLOWFISH is not set
1032# CONFIG_CRYPTO_CAMELLIA is not set
1033# CONFIG_CRYPTO_CAST5 is not set
1034# CONFIG_CRYPTO_CAST6 is not set
1035# CONFIG_CRYPTO_DES is not set
1036# CONFIG_CRYPTO_FCRYPT is not set
1037# CONFIG_CRYPTO_KHAZAD is not set
1038# CONFIG_CRYPTO_SALSA20 is not set
1039# CONFIG_CRYPTO_SEED is not set
1040# CONFIG_CRYPTO_SERPENT is not set
1041# CONFIG_CRYPTO_TEA is not set
1042# CONFIG_CRYPTO_TWOFISH is not set
769 1043
770# 1044#
771# Cryptographic options 1045# Compression
772# 1046#
773# CONFIG_CRYPTO is not set 1047# CONFIG_CRYPTO_DEFLATE is not set
1048# CONFIG_CRYPTO_LZO is not set
774 1049
775# 1050#
776# Hardware crypto devices 1051# Random Number Generation
777# 1052#
1053# CONFIG_CRYPTO_ANSI_CPRNG is not set
1054# CONFIG_CRYPTO_HW is not set
778 1055
779# 1056#
780# Library routines 1057# Library routines
781# 1058#
1059CONFIG_BITREVERSE=y
782# CONFIG_CRC_CCITT is not set 1060# CONFIG_CRC_CCITT is not set
783# CONFIG_CRC16 is not set 1061# CONFIG_CRC16 is not set
1062# CONFIG_CRC_T10DIF is not set
1063# CONFIG_CRC_ITU_T is not set
784CONFIG_CRC32=y 1064CONFIG_CRC32=y
1065# CONFIG_CRC7 is not set
785# CONFIG_LIBCRC32C is not set 1066# CONFIG_LIBCRC32C is not set
786CONFIG_ZLIB_INFLATE=y 1067CONFIG_ZLIB_INFLATE=y
1068CONFIG_PLIST=y
1069CONFIG_HAS_IOMEM=y
1070CONFIG_HAS_IOPORT=y
1071CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/s3c6400_defconfig b/arch/arm/configs/s3c6400_defconfig
new file mode 100644
index 000000000000..cf3c1b5d7048
--- /dev/null
+++ b/arch/arm/configs/s3c6400_defconfig
@@ -0,0 +1,845 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.28-rc3
4# Mon Nov 3 10:10:30 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9# CONFIG_GENERIC_TIME is not set
10# CONFIG_GENERIC_CLOCKEVENTS is not set
11CONFIG_MMU=y
12CONFIG_NO_IOPORT=y
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_GENERIC_HARDIRQS_NO__DO_IRQ=y
26CONFIG_VECTORS_BASE=0xffff0000
27CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
28
29#
30# General setup
31#
32CONFIG_EXPERIMENTAL=y
33CONFIG_BROKEN_ON_SMP=y
34CONFIG_INIT_ENV_ARG_LIMIT=32
35CONFIG_LOCALVERSION=""
36CONFIG_LOCALVERSION_AUTO=y
37CONFIG_SWAP=y
38# CONFIG_SYSVIPC is not set
39# CONFIG_BSD_PROCESS_ACCT is not set
40# CONFIG_IKCONFIG is not set
41CONFIG_LOG_BUF_SHIFT=17
42# CONFIG_CGROUPS is not set
43# CONFIG_GROUP_SCHED is not set
44CONFIG_SYSFS_DEPRECATED=y
45CONFIG_SYSFS_DEPRECATED_V2=y
46# CONFIG_RELAY is not set
47CONFIG_NAMESPACES=y
48# CONFIG_UTS_NS is not set
49# CONFIG_USER_NS is not set
50# CONFIG_PID_NS is not set
51CONFIG_BLK_DEV_INITRD=y
52CONFIG_INITRAMFS_SOURCE=""
53CONFIG_CC_OPTIMIZE_FOR_SIZE=y
54CONFIG_SYSCTL=y
55# CONFIG_EMBEDDED is not set
56CONFIG_UID16=y
57CONFIG_SYSCTL_SYSCALL=y
58CONFIG_KALLSYMS=y
59CONFIG_KALLSYMS_ALL=y
60# CONFIG_KALLSYMS_EXTRA_PASS is not set
61CONFIG_HOTPLUG=y
62CONFIG_PRINTK=y
63CONFIG_BUG=y
64CONFIG_ELF_CORE=y
65CONFIG_COMPAT_BRK=y
66CONFIG_BASE_FULL=y
67CONFIG_FUTEX=y
68CONFIG_ANON_INODES=y
69CONFIG_EPOLL=y
70CONFIG_SIGNALFD=y
71CONFIG_TIMERFD=y
72CONFIG_EVENTFD=y
73CONFIG_SHMEM=y
74CONFIG_AIO=y
75CONFIG_VM_EVENT_COUNTERS=y
76CONFIG_SLUB_DEBUG=y
77# CONFIG_SLAB is not set
78CONFIG_SLUB=y
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
86CONFIG_HAVE_CLK=y
87CONFIG_HAVE_GENERIC_DMA_COHERENT=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
98CONFIG_KMOD=y
99CONFIG_BLOCK=y
100CONFIG_LBD=y
101# CONFIG_BLK_DEV_IO_TRACE is not set
102CONFIG_LSF=y
103# CONFIG_BLK_DEV_BSG is not set
104# CONFIG_BLK_DEV_INTEGRITY is not set
105
106#
107# IO Schedulers
108#
109CONFIG_IOSCHED_NOOP=y
110CONFIG_IOSCHED_AS=y
111CONFIG_IOSCHED_DEADLINE=y
112CONFIG_IOSCHED_CFQ=y
113# CONFIG_DEFAULT_AS is not set
114# CONFIG_DEFAULT_DEADLINE is not set
115CONFIG_DEFAULT_CFQ=y
116# CONFIG_DEFAULT_NOOP is not set
117CONFIG_DEFAULT_IOSCHED="cfq"
118CONFIG_CLASSIC_RCU=y
119# CONFIG_FREEZER is not set
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_EBSA110 is not set
132# CONFIG_ARCH_EP93XX is not set
133# CONFIG_ARCH_FOOTBRIDGE is not set
134# CONFIG_ARCH_NETX is not set
135# CONFIG_ARCH_H720X is not set
136# CONFIG_ARCH_IMX is not set
137# CONFIG_ARCH_IOP13XX is not set
138# CONFIG_ARCH_IOP32X is not set
139# CONFIG_ARCH_IOP33X is not set
140# CONFIG_ARCH_IXP23XX is not set
141# CONFIG_ARCH_IXP2000 is not set
142# CONFIG_ARCH_IXP4XX is not set
143# CONFIG_ARCH_L7200 is not set
144# CONFIG_ARCH_KIRKWOOD is not set
145# CONFIG_ARCH_KS8695 is not set
146# CONFIG_ARCH_NS9XXX is not set
147# CONFIG_ARCH_LOKI is not set
148# CONFIG_ARCH_MV78XX0 is not set
149# CONFIG_ARCH_MXC is not set
150# CONFIG_ARCH_ORION5X is not set
151# CONFIG_ARCH_PNX4008 is not set
152# CONFIG_ARCH_PXA is not set
153# CONFIG_ARCH_RPC is not set
154# CONFIG_ARCH_SA1100 is not set
155# CONFIG_ARCH_S3C2410 is not set
156CONFIG_ARCH_S3C64XX=y
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_MSM is not set
162CONFIG_PLAT_S3C64XX=y
163CONFIG_CPU_S3C6400_INIT=y
164CONFIG_CPU_S3C6400_CLOCK=y
165CONFIG_S3C64XX_SETUP_I2C0=y
166CONFIG_S3C64XX_SETUP_I2C1=y
167CONFIG_PLAT_S3C=y
168
169#
170# Boot options
171#
172CONFIG_S3C_BOOT_ERROR_RESET=y
173
174#
175# Power management
176#
177CONFIG_S3C_LOWLEVEL_UART_PORT=0
178CONFIG_S3C_GPIO_SPACE=0
179CONFIG_S3C_GPIO_TRACK=y
180CONFIG_S3C_GPIO_PULL_UPDOWN=y
181CONFIG_S3C_GPIO_CFG_S3C24XX=y
182CONFIG_S3C_GPIO_CFG_S3C64XX=y
183CONFIG_S3C_DEV_HSMMC=y
184CONFIG_S3C_DEV_HSMMC1=y
185CONFIG_S3C_DEV_I2C1=y
186CONFIG_CPU_S3C6410=y
187CONFIG_S3C6410_SETUP_SDHCI=y
188CONFIG_MACH_SMDK6410=y
189CONFIG_SMDK6410_SD_CH0=y
190# CONFIG_SMDK6410_SD_CH1 is not set
191
192#
193# Processor Type
194#
195CONFIG_CPU_32=y
196CONFIG_CPU_V6=y
197CONFIG_CPU_32v6K=y
198CONFIG_CPU_32v6=y
199CONFIG_CPU_ABRT_EV6=y
200CONFIG_CPU_PABRT_NOIFAR=y
201CONFIG_CPU_CACHE_V6=y
202CONFIG_CPU_CACHE_VIPT=y
203CONFIG_CPU_COPY_V6=y
204CONFIG_CPU_TLB_V6=y
205CONFIG_CPU_HAS_ASID=y
206CONFIG_CPU_CP15=y
207CONFIG_CPU_CP15_MMU=y
208
209#
210# Processor Features
211#
212CONFIG_ARM_THUMB=y
213# CONFIG_CPU_ICACHE_DISABLE is not set
214# CONFIG_CPU_DCACHE_DISABLE is not set
215# CONFIG_CPU_BPREDICT_DISABLE is not set
216# CONFIG_OUTER_CACHE is not set
217CONFIG_ARM_VIC=y
218
219#
220# Bus support
221#
222# CONFIG_PCI_SYSCALL is not set
223# CONFIG_ARCH_SUPPORTS_MSI is not set
224# CONFIG_PCCARD is not set
225
226#
227# Kernel Features
228#
229CONFIG_VMSPLIT_3G=y
230# CONFIG_VMSPLIT_2G is not set
231# CONFIG_VMSPLIT_1G is not set
232CONFIG_PAGE_OFFSET=0xC0000000
233# CONFIG_PREEMPT is not set
234CONFIG_HZ=100
235CONFIG_AEABI=y
236CONFIG_OABI_COMPAT=y
237CONFIG_ARCH_FLATMEM_HAS_HOLES=y
238# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
239# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
240CONFIG_SELECT_MEMORY_MODEL=y
241CONFIG_FLATMEM_MANUAL=y
242# CONFIG_DISCONTIGMEM_MANUAL is not set
243# CONFIG_SPARSEMEM_MANUAL is not set
244CONFIG_FLATMEM=y
245CONFIG_FLAT_NODE_MEM_MAP=y
246CONFIG_PAGEFLAGS_EXTENDED=y
247CONFIG_SPLIT_PTLOCK_CPUS=4
248# CONFIG_RESOURCES_64BIT is not set
249# CONFIG_PHYS_ADDR_T_64BIT is not set
250CONFIG_ZONE_DMA_FLAG=0
251CONFIG_VIRT_TO_BUS=y
252CONFIG_UNEVICTABLE_LRU=y
253CONFIG_ALIGNMENT_TRAP=y
254
255#
256# Boot options
257#
258CONFIG_ZBOOT_ROM_TEXT=0
259CONFIG_ZBOOT_ROM_BSS=0
260CONFIG_CMDLINE="console=ttySAC0,115200 root=/dev/ram init=/bin/bash initrd=0x51000000,4M"
261# CONFIG_XIP_KERNEL is not set
262# CONFIG_KEXEC is not set
263
264#
265# CPU Power Management
266#
267# CONFIG_CPU_IDLE is not set
268
269#
270# Floating point emulation
271#
272
273#
274# At least one emulation must be selected
275#
276# CONFIG_FPE_NWFPE is not set
277# CONFIG_FPE_FASTFPE is not set
278CONFIG_VFP=y
279
280#
281# Userspace binary formats
282#
283CONFIG_BINFMT_ELF=y
284# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
285CONFIG_HAVE_AOUT=y
286# CONFIG_BINFMT_AOUT is not set
287# CONFIG_BINFMT_MISC is not set
288
289#
290# Power management options
291#
292# CONFIG_PM is not set
293CONFIG_ARCH_SUSPEND_POSSIBLE=y
294# CONFIG_NET is not set
295
296#
297# Device Drivers
298#
299
300#
301# Generic Driver Options
302#
303CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
304CONFIG_STANDALONE=y
305CONFIG_PREVENT_FIRMWARE_BUILD=y
306CONFIG_FW_LOADER=y
307CONFIG_FIRMWARE_IN_KERNEL=y
308CONFIG_EXTRA_FIRMWARE=""
309# CONFIG_DEBUG_DRIVER is not set
310# CONFIG_DEBUG_DEVRES is not set
311# CONFIG_SYS_HYPERVISOR is not set
312# CONFIG_MTD is not set
313# CONFIG_PARPORT is not set
314CONFIG_BLK_DEV=y
315# CONFIG_BLK_DEV_COW_COMMON is not set
316CONFIG_BLK_DEV_LOOP=y
317# CONFIG_BLK_DEV_CRYPTOLOOP is not set
318CONFIG_BLK_DEV_RAM=y
319CONFIG_BLK_DEV_RAM_COUNT=16
320CONFIG_BLK_DEV_RAM_SIZE=4096
321# CONFIG_BLK_DEV_XIP is not set
322# CONFIG_CDROM_PKTCDVD is not set
323CONFIG_MISC_DEVICES=y
324# CONFIG_EEPROM_93CX6 is not set
325# CONFIG_ENCLOSURE_SERVICES is not set
326CONFIG_HAVE_IDE=y
327# CONFIG_IDE is not set
328
329#
330# SCSI device support
331#
332# CONFIG_RAID_ATTRS is not set
333# CONFIG_SCSI is not set
334# CONFIG_SCSI_DMA is not set
335# CONFIG_SCSI_NETLINK is not set
336# CONFIG_ATA is not set
337# CONFIG_MD is not set
338
339#
340# Input device support
341#
342CONFIG_INPUT=y
343# CONFIG_INPUT_FF_MEMLESS is not set
344# CONFIG_INPUT_POLLDEV is not set
345
346#
347# Userland interfaces
348#
349CONFIG_INPUT_MOUSEDEV=y
350CONFIG_INPUT_MOUSEDEV_PSAUX=y
351CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
352CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
353# CONFIG_INPUT_JOYDEV is not set
354# CONFIG_INPUT_EVDEV is not set
355# CONFIG_INPUT_EVBUG is not set
356
357#
358# Input Device Drivers
359#
360CONFIG_INPUT_KEYBOARD=y
361CONFIG_KEYBOARD_ATKBD=y
362# CONFIG_KEYBOARD_SUNKBD is not set
363# CONFIG_KEYBOARD_LKKBD is not set
364# CONFIG_KEYBOARD_XTKBD is not set
365# CONFIG_KEYBOARD_NEWTON is not set
366# CONFIG_KEYBOARD_STOWAWAY is not set
367# CONFIG_KEYBOARD_GPIO is not set
368CONFIG_INPUT_MOUSE=y
369CONFIG_MOUSE_PS2=y
370CONFIG_MOUSE_PS2_ALPS=y
371CONFIG_MOUSE_PS2_LOGIPS2PP=y
372CONFIG_MOUSE_PS2_SYNAPTICS=y
373CONFIG_MOUSE_PS2_LIFEBOOK=y
374CONFIG_MOUSE_PS2_TRACKPOINT=y
375# CONFIG_MOUSE_PS2_ELANTECH is not set
376# CONFIG_MOUSE_PS2_TOUCHKIT is not set
377# CONFIG_MOUSE_SERIAL is not set
378# CONFIG_MOUSE_APPLETOUCH is not set
379# CONFIG_MOUSE_BCM5974 is not set
380# CONFIG_MOUSE_VSXXXAA is not set
381# CONFIG_MOUSE_GPIO is not set
382# CONFIG_INPUT_JOYSTICK is not set
383# CONFIG_INPUT_TABLET is not set
384# CONFIG_INPUT_TOUCHSCREEN is not set
385# CONFIG_INPUT_MISC is not set
386
387#
388# Hardware I/O ports
389#
390CONFIG_SERIO=y
391CONFIG_SERIO_SERPORT=y
392CONFIG_SERIO_LIBPS2=y
393# CONFIG_SERIO_RAW is not set
394# CONFIG_GAMEPORT is not set
395
396#
397# Character devices
398#
399CONFIG_VT=y
400CONFIG_CONSOLE_TRANSLATIONS=y
401CONFIG_VT_CONSOLE=y
402CONFIG_HW_CONSOLE=y
403# CONFIG_VT_HW_CONSOLE_BINDING is not set
404CONFIG_DEVKMEM=y
405# CONFIG_SERIAL_NONSTANDARD is not set
406
407#
408# Serial drivers
409#
410CONFIG_SERIAL_8250=y
411# CONFIG_SERIAL_8250_CONSOLE is not set
412CONFIG_SERIAL_8250_NR_UARTS=4
413CONFIG_SERIAL_8250_RUNTIME_UARTS=4
414# CONFIG_SERIAL_8250_EXTENDED is not set
415
416#
417# Non-8250 serial port support
418#
419CONFIG_SERIAL_SAMSUNG=y
420CONFIG_SERIAL_SAMSUNG_UARTS=4
421# CONFIG_SERIAL_SAMSUNG_DEBUG is not set
422CONFIG_SERIAL_SAMSUNG_CONSOLE=y
423CONFIG_SERIAL_S3C6400=y
424CONFIG_SERIAL_CORE=y
425CONFIG_SERIAL_CORE_CONSOLE=y
426CONFIG_UNIX98_PTYS=y
427CONFIG_LEGACY_PTYS=y
428CONFIG_LEGACY_PTY_COUNT=256
429# CONFIG_IPMI_HANDLER is not set
430CONFIG_HW_RANDOM=y
431# CONFIG_NVRAM is not set
432# CONFIG_R3964 is not set
433# CONFIG_RAW_DRIVER is not set
434# CONFIG_TCG_TPM is not set
435CONFIG_I2C=y
436CONFIG_I2C_BOARDINFO=y
437CONFIG_I2C_CHARDEV=y
438CONFIG_I2C_HELPER_AUTO=y
439
440#
441# I2C Hardware Bus support
442#
443
444#
445# I2C system bus drivers (mostly embedded / system-on-chip)
446#
447# CONFIG_I2C_GPIO is not set
448# CONFIG_I2C_OCORES is not set
449CONFIG_I2C_S3C2410=y
450# CONFIG_I2C_SIMTEC is not set
451
452#
453# External I2C/SMBus adapter drivers
454#
455# CONFIG_I2C_PARPORT_LIGHT is not set
456# CONFIG_I2C_TAOS_EVM is not set
457
458#
459# Other I2C/SMBus bus drivers
460#
461# CONFIG_I2C_PCA_PLATFORM is not set
462# CONFIG_I2C_STUB is not set
463
464#
465# Miscellaneous I2C Chip support
466#
467# CONFIG_DS1682 is not set
468CONFIG_AT24=y
469# CONFIG_SENSORS_EEPROM is not set
470# CONFIG_SENSORS_PCF8574 is not set
471# CONFIG_PCF8575 is not set
472# CONFIG_SENSORS_PCA9539 is not set
473# CONFIG_SENSORS_PCF8591 is not set
474# CONFIG_TPS65010 is not set
475# CONFIG_SENSORS_MAX6875 is not set
476# CONFIG_SENSORS_TSL2550 is not set
477# CONFIG_I2C_DEBUG_CORE is not set
478# CONFIG_I2C_DEBUG_ALGO is not set
479# CONFIG_I2C_DEBUG_BUS is not set
480# CONFIG_I2C_DEBUG_CHIP is not set
481# CONFIG_SPI is not set
482CONFIG_ARCH_REQUIRE_GPIOLIB=y
483CONFIG_GPIOLIB=y
484# CONFIG_DEBUG_GPIO is not set
485# CONFIG_GPIO_SYSFS is not set
486
487#
488# I2C GPIO expanders:
489#
490# CONFIG_GPIO_MAX732X is not set
491# CONFIG_GPIO_PCA953X is not set
492# CONFIG_GPIO_PCF857X is not set
493
494#
495# PCI GPIO expanders:
496#
497
498#
499# SPI GPIO expanders:
500#
501# CONFIG_W1 is not set
502# CONFIG_POWER_SUPPLY is not set
503CONFIG_HWMON=y
504# CONFIG_HWMON_VID is not set
505# CONFIG_SENSORS_AD7414 is not set
506# CONFIG_SENSORS_AD7418 is not set
507# CONFIG_SENSORS_ADM1021 is not set
508# CONFIG_SENSORS_ADM1025 is not set
509# CONFIG_SENSORS_ADM1026 is not set
510# CONFIG_SENSORS_ADM1029 is not set
511# CONFIG_SENSORS_ADM1031 is not set
512# CONFIG_SENSORS_ADM9240 is not set
513# CONFIG_SENSORS_ADT7470 is not set
514# CONFIG_SENSORS_ADT7473 is not set
515# CONFIG_SENSORS_ATXP1 is not set
516# CONFIG_SENSORS_DS1621 is not set
517# CONFIG_SENSORS_F71805F is not set
518# CONFIG_SENSORS_F71882FG is not set
519# CONFIG_SENSORS_F75375S is not set
520# CONFIG_SENSORS_GL518SM is not set
521# CONFIG_SENSORS_GL520SM is not set
522# CONFIG_SENSORS_IT87 is not set
523# CONFIG_SENSORS_LM63 is not set
524# CONFIG_SENSORS_LM75 is not set
525# CONFIG_SENSORS_LM77 is not set
526# CONFIG_SENSORS_LM78 is not set
527# CONFIG_SENSORS_LM80 is not set
528# CONFIG_SENSORS_LM83 is not set
529# CONFIG_SENSORS_LM85 is not set
530# CONFIG_SENSORS_LM87 is not set
531# CONFIG_SENSORS_LM90 is not set
532# CONFIG_SENSORS_LM92 is not set
533# CONFIG_SENSORS_LM93 is not set
534# CONFIG_SENSORS_MAX1619 is not set
535# CONFIG_SENSORS_MAX6650 is not set
536# CONFIG_SENSORS_PC87360 is not set
537# CONFIG_SENSORS_PC87427 is not set
538# CONFIG_SENSORS_DME1737 is not set
539# CONFIG_SENSORS_SMSC47M1 is not set
540# CONFIG_SENSORS_SMSC47M192 is not set
541# CONFIG_SENSORS_SMSC47B397 is not set
542# CONFIG_SENSORS_ADS7828 is not set
543# CONFIG_SENSORS_THMC50 is not set
544# CONFIG_SENSORS_VT1211 is not set
545# CONFIG_SENSORS_W83781D is not set
546# CONFIG_SENSORS_W83791D is not set
547# CONFIG_SENSORS_W83792D is not set
548# CONFIG_SENSORS_W83793 is not set
549# CONFIG_SENSORS_W83L785TS is not set
550# CONFIG_SENSORS_W83L786NG is not set
551# CONFIG_SENSORS_W83627HF is not set
552# CONFIG_SENSORS_W83627EHF is not set
553# CONFIG_HWMON_DEBUG_CHIP is not set
554# CONFIG_THERMAL is not set
555# CONFIG_THERMAL_HWMON is not set
556# CONFIG_WATCHDOG is not set
557
558#
559# Sonics Silicon Backplane
560#
561CONFIG_SSB_POSSIBLE=y
562# CONFIG_SSB is not set
563
564#
565# Multifunction device drivers
566#
567# CONFIG_MFD_CORE is not set
568# CONFIG_MFD_SM501 is not set
569# CONFIG_MFD_ASIC3 is not set
570# CONFIG_HTC_EGPIO is not set
571# CONFIG_HTC_PASIC3 is not set
572# CONFIG_MFD_TMIO is not set
573# CONFIG_MFD_T7L66XB is not set
574# CONFIG_MFD_TC6387XB is not set
575# CONFIG_MFD_TC6393XB is not set
576# CONFIG_PMIC_DA903X is not set
577# CONFIG_MFD_WM8400 is not set
578# CONFIG_MFD_WM8350_I2C is not set
579
580#
581# Multimedia devices
582#
583
584#
585# Multimedia core support
586#
587# CONFIG_VIDEO_DEV is not set
588# CONFIG_VIDEO_MEDIA is not set
589
590#
591# Multimedia drivers
592#
593# CONFIG_DAB is not set
594
595#
596# Graphics support
597#
598# CONFIG_VGASTATE is not set
599# CONFIG_VIDEO_OUTPUT_CONTROL is not set
600# CONFIG_FB is not set
601# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
602
603#
604# Display device support
605#
606# CONFIG_DISPLAY_SUPPORT is not set
607
608#
609# Console display driver support
610#
611# CONFIG_VGA_CONSOLE is not set
612CONFIG_DUMMY_CONSOLE=y
613# CONFIG_SOUND is not set
614CONFIG_HID_SUPPORT=y
615CONFIG_HID=y
616CONFIG_HID_DEBUG=y
617# CONFIG_HIDRAW is not set
618# CONFIG_HID_PID is not set
619
620#
621# Special HID drivers
622#
623# CONFIG_HID_COMPAT is not set
624CONFIG_USB_SUPPORT=y
625CONFIG_USB_ARCH_HAS_HCD=y
626# CONFIG_USB_ARCH_HAS_OHCI is not set
627# CONFIG_USB_ARCH_HAS_EHCI is not set
628# CONFIG_USB is not set
629
630#
631# Enable Host or Gadget support to see Inventra options
632#
633
634#
635# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
636#
637# CONFIG_USB_GADGET is not set
638CONFIG_MMC=y
639CONFIG_MMC_DEBUG=y
640CONFIG_MMC_UNSAFE_RESUME=y
641
642#
643# MMC/SD/SDIO Card Drivers
644#
645CONFIG_MMC_BLOCK=y
646CONFIG_MMC_BLOCK_BOUNCE=y
647CONFIG_SDIO_UART=y
648# CONFIG_MMC_TEST is not set
649
650#
651# MMC/SD/SDIO Host Controller Drivers
652#
653CONFIG_MMC_SDHCI=y
654CONFIG_MMC_SDHCI_S3C=y
655# CONFIG_MEMSTICK is not set
656# CONFIG_ACCESSIBILITY is not set
657# CONFIG_NEW_LEDS is not set
658CONFIG_RTC_LIB=y
659# CONFIG_RTC_CLASS is not set
660# CONFIG_DMADEVICES is not set
661
662#
663# Voltage and Current regulators
664#
665# CONFIG_REGULATOR is not set
666# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
667# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
668# CONFIG_REGULATOR_BQ24022 is not set
669# CONFIG_UIO is not set
670
671#
672# File systems
673#
674CONFIG_EXT2_FS=y
675# CONFIG_EXT2_FS_XATTR is not set
676# CONFIG_EXT2_FS_XIP is not set
677CONFIG_EXT3_FS=y
678CONFIG_EXT3_FS_XATTR=y
679CONFIG_EXT3_FS_POSIX_ACL=y
680CONFIG_EXT3_FS_SECURITY=y
681# CONFIG_EXT4_FS is not set
682CONFIG_JBD=y
683CONFIG_FS_MBCACHE=y
684# CONFIG_REISERFS_FS is not set
685# CONFIG_JFS_FS is not set
686CONFIG_FS_POSIX_ACL=y
687CONFIG_FILE_LOCKING=y
688# CONFIG_XFS_FS is not set
689# CONFIG_GFS2_FS is not set
690CONFIG_DNOTIFY=y
691CONFIG_INOTIFY=y
692CONFIG_INOTIFY_USER=y
693# CONFIG_QUOTA is not set
694# CONFIG_AUTOFS_FS is not set
695# CONFIG_AUTOFS4_FS is not set
696# CONFIG_FUSE_FS is not set
697CONFIG_GENERIC_ACL=y
698
699#
700# CD-ROM/DVD Filesystems
701#
702# CONFIG_ISO9660_FS is not set
703# CONFIG_UDF_FS is not set
704
705#
706# DOS/FAT/NT Filesystems
707#
708# CONFIG_MSDOS_FS is not set
709# CONFIG_VFAT_FS is not set
710# CONFIG_NTFS_FS is not set
711
712#
713# Pseudo filesystems
714#
715CONFIG_PROC_FS=y
716CONFIG_PROC_SYSCTL=y
717CONFIG_PROC_PAGE_MONITOR=y
718CONFIG_SYSFS=y
719CONFIG_TMPFS=y
720CONFIG_TMPFS_POSIX_ACL=y
721# CONFIG_HUGETLB_PAGE is not set
722# CONFIG_CONFIGFS_FS is not set
723
724#
725# Miscellaneous filesystems
726#
727# CONFIG_ADFS_FS is not set
728# CONFIG_AFFS_FS is not set
729# CONFIG_HFS_FS is not set
730# CONFIG_HFSPLUS_FS is not set
731# CONFIG_BEFS_FS is not set
732# CONFIG_BFS_FS is not set
733# CONFIG_EFS_FS is not set
734CONFIG_CRAMFS=y
735# CONFIG_VXFS_FS is not set
736# CONFIG_MINIX_FS is not set
737# CONFIG_OMFS_FS is not set
738# CONFIG_HPFS_FS is not set
739# CONFIG_QNX4FS_FS is not set
740CONFIG_ROMFS_FS=y
741# CONFIG_SYSV_FS is not set
742# CONFIG_UFS_FS is not set
743
744#
745# Partition Types
746#
747# CONFIG_PARTITION_ADVANCED is not set
748CONFIG_MSDOS_PARTITION=y
749# CONFIG_NLS is not set
750
751#
752# Kernel hacking
753#
754# CONFIG_PRINTK_TIME is not set
755CONFIG_ENABLE_WARN_DEPRECATED=y
756CONFIG_ENABLE_MUST_CHECK=y
757CONFIG_FRAME_WARN=1024
758CONFIG_MAGIC_SYSRQ=y
759# CONFIG_UNUSED_SYMBOLS is not set
760# CONFIG_DEBUG_FS is not set
761# CONFIG_HEADERS_CHECK is not set
762CONFIG_DEBUG_KERNEL=y
763# CONFIG_DEBUG_SHIRQ is not set
764CONFIG_DETECT_SOFTLOCKUP=y
765# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
766CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
767CONFIG_SCHED_DEBUG=y
768# CONFIG_SCHEDSTATS is not set
769# CONFIG_TIMER_STATS is not set
770# CONFIG_DEBUG_OBJECTS is not set
771# CONFIG_SLUB_DEBUG_ON is not set
772# CONFIG_SLUB_STATS is not set
773CONFIG_DEBUG_RT_MUTEXES=y
774CONFIG_DEBUG_PI_LIST=y
775# CONFIG_RT_MUTEX_TESTER is not set
776CONFIG_DEBUG_SPINLOCK=y
777CONFIG_DEBUG_MUTEXES=y
778# CONFIG_DEBUG_LOCK_ALLOC is not set
779# CONFIG_PROVE_LOCKING is not set
780# CONFIG_LOCK_STAT is not set
781CONFIG_DEBUG_SPINLOCK_SLEEP=y
782# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
783# CONFIG_DEBUG_KOBJECT is not set
784CONFIG_DEBUG_BUGVERBOSE=y
785CONFIG_DEBUG_INFO=y
786# CONFIG_DEBUG_VM is not set
787# CONFIG_DEBUG_WRITECOUNT is not set
788CONFIG_DEBUG_MEMORY_INIT=y
789# CONFIG_DEBUG_LIST is not set
790# CONFIG_DEBUG_SG is not set
791CONFIG_FRAME_POINTER=y
792# CONFIG_BOOT_PRINTK_DELAY is not set
793# CONFIG_RCU_TORTURE_TEST is not set
794# CONFIG_RCU_CPU_STALL_DETECTOR is not set
795# CONFIG_BACKTRACE_SELF_TEST is not set
796# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
797# CONFIG_FAULT_INJECTION is not set
798# CONFIG_LATENCYTOP is not set
799CONFIG_SYSCTL_SYSCALL_CHECK=y
800CONFIG_HAVE_FUNCTION_TRACER=y
801
802#
803# Tracers
804#
805# CONFIG_FUNCTION_TRACER is not set
806# CONFIG_SCHED_TRACER is not set
807# CONFIG_CONTEXT_SWITCH_TRACER is not set
808# CONFIG_BOOT_TRACER is not set
809# CONFIG_STACK_TRACER is not set
810# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
811# CONFIG_SAMPLES is not set
812CONFIG_HAVE_ARCH_KGDB=y
813# CONFIG_KGDB is not set
814CONFIG_DEBUG_USER=y
815CONFIG_DEBUG_ERRORS=y
816# CONFIG_DEBUG_STACK_USAGE is not set
817CONFIG_DEBUG_LL=y
818# CONFIG_DEBUG_ICEDCC is not set
819CONFIG_DEBUG_S3C_PORT=y
820CONFIG_DEBUG_S3C_UART=0
821
822#
823# Security options
824#
825# CONFIG_KEYS is not set
826# CONFIG_SECURITY is not set
827# CONFIG_SECURITYFS is not set
828# CONFIG_SECURITY_FILE_CAPABILITIES is not set
829# CONFIG_CRYPTO is not set
830
831#
832# Library routines
833#
834CONFIG_BITREVERSE=y
835# CONFIG_CRC_CCITT is not set
836# CONFIG_CRC16 is not set
837# CONFIG_CRC_T10DIF is not set
838# CONFIG_CRC_ITU_T is not set
839CONFIG_CRC32=y
840# CONFIG_CRC7 is not set
841# CONFIG_LIBCRC32C is not set
842CONFIG_ZLIB_INFLATE=y
843CONFIG_PLIST=y
844CONFIG_HAS_IOMEM=y
845CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/w90p910_defconfig b/arch/arm/configs/w90p910_defconfig
new file mode 100644
index 000000000000..56bda7c6d670
--- /dev/null
+++ b/arch/arm/configs/w90p910_defconfig
@@ -0,0 +1,626 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.27-rc8-git8
4# Sat Nov 15 10:05:00 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_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_GENERIC_HARDIRQS_NO__DO_IRQ=y
28CONFIG_VECTORS_BASE=0xffff0000
29CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
30
31#
32# General setup
33#
34CONFIG_EXPERIMENTAL=y
35CONFIG_BROKEN_ON_SMP=y
36CONFIG_LOCK_KERNEL=y
37CONFIG_INIT_ENV_ARG_LIMIT=32
38CONFIG_LOCALVERSION=""
39# CONFIG_LOCALVERSION_AUTO is not set
40CONFIG_SWAP=y
41CONFIG_SYSVIPC=y
42CONFIG_SYSVIPC_SYSCTL=y
43CONFIG_BSD_PROCESS_ACCT=y
44# CONFIG_BSD_PROCESS_ACCT_V3 is not set
45# CONFIG_IKCONFIG is not set
46CONFIG_LOG_BUF_SHIFT=17
47# CONFIG_CGROUPS is not set
48# CONFIG_GROUP_SCHED is not set
49CONFIG_SYSFS_DEPRECATED=y
50CONFIG_SYSFS_DEPRECATED_V2=y
51CONFIG_RELAY=y
52CONFIG_NAMESPACES=y
53# CONFIG_UTS_NS is not set
54# CONFIG_IPC_NS is not set
55CONFIG_USER_NS=y
56# CONFIG_PID_NS is not set
57CONFIG_BLK_DEV_INITRD=y
58CONFIG_INITRAMFS_SOURCE=""
59CONFIG_CC_OPTIMIZE_FOR_SIZE=y
60CONFIG_SYSCTL=y
61# CONFIG_EMBEDDED is not set
62CONFIG_UID16=y
63CONFIG_SYSCTL_SYSCALL=y
64CONFIG_KALLSYMS=y
65CONFIG_KALLSYMS_EXTRA_PASS=y
66CONFIG_HOTPLUG=y
67CONFIG_PRINTK=y
68CONFIG_BUG=y
69CONFIG_ELF_CORE=y
70CONFIG_COMPAT_BRK=y
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
83# CONFIG_PROFILING is not set
84# CONFIG_MARKERS is not set
85CONFIG_HAVE_OPROFILE=y
86# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
87# CONFIG_HAVE_IOREMAP_PROT is not set
88CONFIG_HAVE_KPROBES=y
89CONFIG_HAVE_KRETPROBES=y
90# CONFIG_HAVE_ARCH_TRACEHOOK is not set
91# CONFIG_HAVE_DMA_ATTRS is not set
92# CONFIG_USE_GENERIC_SMP_HELPERS is not set
93# CONFIG_HAVE_CLK is not set
94CONFIG_PROC_PAGE_MONITOR=y
95CONFIG_HAVE_GENERIC_DMA_COHERENT=y
96CONFIG_SLABINFO=y
97CONFIG_RT_MUTEXES=y
98# CONFIG_TINY_SHMEM is not set
99CONFIG_BASE_SMALL=0
100# CONFIG_MODULES is not set
101CONFIG_BLOCK=y
102CONFIG_LBD=y
103CONFIG_BLK_DEV_IO_TRACE=y
104CONFIG_LSF=y
105CONFIG_BLK_DEV_BSG=y
106# CONFIG_BLK_DEV_INTEGRITY 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_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_KIRKWOOD is not set
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
162CONFIG_ARCH_W90X900=y
163
164#
165# Boot options
166#
167
168#
169# Power management
170#
171CONFIG_CPU_W90P910=y
172
173#
174# W90P910 Machines
175#
176CONFIG_MACH_W90P910EVB=y
177
178#
179# Processor Type
180#
181CONFIG_CPU_32=y
182CONFIG_CPU_ARM926T=y
183CONFIG_CPU_32v5=y
184CONFIG_CPU_ABRT_EV5TJ=y
185CONFIG_CPU_PABRT_NOIFAR=y
186CONFIG_CPU_CACHE_VIVT=y
187CONFIG_CPU_COPY_V4WB=y
188CONFIG_CPU_TLB_V4WBI=y
189CONFIG_CPU_CP15=y
190CONFIG_CPU_CP15_MMU=y
191
192#
193# Processor Features
194#
195CONFIG_ARM_THUMB=y
196# CONFIG_CPU_ICACHE_DISABLE is not set
197# CONFIG_CPU_DCACHE_DISABLE is not set
198# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
199# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
200# CONFIG_OUTER_CACHE is not set
201
202#
203# Bus support
204#
205# CONFIG_PCI_SYSCALL is not set
206# CONFIG_ARCH_SUPPORTS_MSI is not set
207# CONFIG_PCCARD is not set
208
209#
210# Kernel Features
211#
212# CONFIG_TICK_ONESHOT is not set
213CONFIG_PREEMPT=y
214CONFIG_HZ=100
215CONFIG_AEABI=y
216CONFIG_OABI_COMPAT=y
217CONFIG_ARCH_FLATMEM_HAS_HOLES=y
218# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
219CONFIG_SELECT_MEMORY_MODEL=y
220CONFIG_FLATMEM_MANUAL=y
221# CONFIG_DISCONTIGMEM_MANUAL is not set
222# CONFIG_SPARSEMEM_MANUAL is not set
223CONFIG_FLATMEM=y
224CONFIG_FLAT_NODE_MEM_MAP=y
225# CONFIG_SPARSEMEM_STATIC is not set
226# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
227CONFIG_PAGEFLAGS_EXTENDED=y
228CONFIG_SPLIT_PTLOCK_CPUS=4096
229# CONFIG_RESOURCES_64BIT is not set
230CONFIG_ZONE_DMA_FLAG=1
231CONFIG_BOUNCE=y
232CONFIG_VIRT_TO_BUS=y
233CONFIG_ALIGNMENT_TRAP=y
234
235#
236# Boot options
237#
238CONFIG_ZBOOT_ROM_TEXT=0
239CONFIG_ZBOOT_ROM_BSS=0
240CONFIG_CMDLINE="root=/dev/ram0 console=ttyS0,115200n8 initrd=0xa00000,4000000 mem=64M"
241# CONFIG_XIP_KERNEL is not set
242CONFIG_KEXEC=y
243CONFIG_ATAGS_PROC=y
244
245#
246# Floating point emulation
247#
248
249#
250# At least one emulation must be selected
251#
252CONFIG_FPE_NWFPE=y
253# CONFIG_FPE_NWFPE_XP is not set
254# CONFIG_FPE_FASTFPE is not set
255# CONFIG_VFP is not set
256
257#
258# Userspace binary formats
259#
260CONFIG_BINFMT_ELF=y
261# CONFIG_BINFMT_AOUT is not set
262# CONFIG_BINFMT_MISC is not set
263
264#
265# Power management options
266#
267# CONFIG_PM is not set
268CONFIG_ARCH_SUSPEND_POSSIBLE=y
269# CONFIG_NET is not set
270
271#
272# Device Drivers
273#
274
275#
276# Generic Driver Options
277#
278CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
279CONFIG_STANDALONE=y
280CONFIG_PREVENT_FIRMWARE_BUILD=y
281CONFIG_FW_LOADER=y
282CONFIG_FIRMWARE_IN_KERNEL=y
283CONFIG_EXTRA_FIRMWARE=""
284# CONFIG_SYS_HYPERVISOR is not set
285# CONFIG_MTD is not set
286# CONFIG_PARPORT is not set
287CONFIG_BLK_DEV=y
288# CONFIG_BLK_DEV_COW_COMMON is not set
289# CONFIG_BLK_DEV_LOOP is not set
290CONFIG_BLK_DEV_RAM=y
291CONFIG_BLK_DEV_RAM_COUNT=16
292CONFIG_BLK_DEV_RAM_SIZE=16384
293# CONFIG_BLK_DEV_XIP is not set
294# CONFIG_CDROM_PKTCDVD is not set
295# CONFIG_MISC_DEVICES is not set
296CONFIG_HAVE_IDE=y
297# CONFIG_IDE is not set
298
299#
300# SCSI device support
301#
302# CONFIG_RAID_ATTRS is not set
303# CONFIG_SCSI is not set
304# CONFIG_SCSI_DMA is not set
305# CONFIG_SCSI_NETLINK is not set
306# CONFIG_ATA is not set
307# CONFIG_MD is not set
308
309#
310# Input device support
311#
312CONFIG_INPUT=y
313# CONFIG_INPUT_FF_MEMLESS is not set
314# CONFIG_INPUT_POLLDEV is not set
315
316#
317# Userland interfaces
318#
319CONFIG_INPUT_MOUSEDEV=y
320# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
321CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
322CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
323# CONFIG_INPUT_JOYDEV is not set
324# CONFIG_INPUT_EVDEV is not set
325# CONFIG_INPUT_EVBUG is not set
326
327#
328# Input Device Drivers
329#
330# CONFIG_INPUT_KEYBOARD is not set
331# CONFIG_INPUT_MOUSE is not set
332# CONFIG_INPUT_JOYSTICK is not set
333# CONFIG_INPUT_TABLET is not set
334# CONFIG_INPUT_TOUCHSCREEN is not set
335# CONFIG_INPUT_MISC is not set
336
337#
338# Hardware I/O ports
339#
340# CONFIG_SERIO is not set
341# CONFIG_GAMEPORT is not set
342
343#
344# Character devices
345#
346CONFIG_VT=y
347CONFIG_CONSOLE_TRANSLATIONS=y
348CONFIG_VT_CONSOLE=y
349CONFIG_HW_CONSOLE=y
350# CONFIG_VT_HW_CONSOLE_BINDING is not set
351# CONFIG_DEVKMEM is not set
352# CONFIG_SERIAL_NONSTANDARD is not set
353
354#
355# Serial drivers
356#
357# CONFIG_SERIAL_8250 is not set
358
359#
360# Non-8250 serial port support
361#
362CONFIG_SERIAL_W90X900=y
363# CONFIG_SERIAL_W90X900_PORT1 is not set
364# CONFIG_SERIAL_W90X900_PORT2 is not set
365# CONFIG_SERIAL_W90X900_PORT3 is not set
366# CONFIG_SERIAL_W90X900_PORT4 is not set
367CONFIG_SERIAL_W90X900_CONSOLE=y
368CONFIG_SERIAL_CORE=y
369CONFIG_SERIAL_CORE_CONSOLE=y
370CONFIG_UNIX98_PTYS=y
371# CONFIG_LEGACY_PTYS is not set
372# CONFIG_IPMI_HANDLER is not set
373# CONFIG_HW_RANDOM is not set
374# CONFIG_NVRAM is not set
375# CONFIG_R3964 is not set
376# CONFIG_RAW_DRIVER is not set
377# CONFIG_TCG_TPM is not set
378# CONFIG_I2C is not set
379# CONFIG_SPI is not set
380# CONFIG_W1 is not set
381# CONFIG_POWER_SUPPLY is not set
382# CONFIG_HWMON is not set
383# CONFIG_WATCHDOG is not set
384
385#
386# Sonics Silicon Backplane
387#
388CONFIG_SSB_POSSIBLE=y
389# CONFIG_SSB is not set
390
391#
392# Multifunction device drivers
393#
394# CONFIG_MFD_CORE is not set
395# CONFIG_MFD_SM501 is not set
396# CONFIG_HTC_PASIC3 is not set
397# CONFIG_MFD_TMIO is not set
398# CONFIG_MFD_T7L66XB is not set
399# CONFIG_MFD_TC6387XB is not set
400
401#
402# Multimedia devices
403#
404
405#
406# Multimedia core support
407#
408# CONFIG_VIDEO_DEV is not set
409# CONFIG_VIDEO_MEDIA is not set
410
411#
412# Multimedia drivers
413#
414# CONFIG_DAB is not set
415
416#
417# Graphics support
418#
419# CONFIG_VGASTATE is not set
420# CONFIG_VIDEO_OUTPUT_CONTROL is not set
421# CONFIG_FB is not set
422# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
423
424#
425# Display device support
426#
427# CONFIG_DISPLAY_SUPPORT is not set
428
429#
430# Console display driver support
431#
432# CONFIG_VGA_CONSOLE is not set
433CONFIG_DUMMY_CONSOLE=y
434# CONFIG_SOUND is not set
435# CONFIG_HID_SUPPORT is not set
436# CONFIG_USB_SUPPORT is not set
437# CONFIG_MMC is not set
438# CONFIG_NEW_LEDS is not set
439CONFIG_RTC_LIB=y
440# CONFIG_RTC_CLASS is not set
441# CONFIG_DMADEVICES is not set
442
443#
444# Voltage and Current regulators
445#
446# CONFIG_REGULATOR is not set
447# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
448# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
449# CONFIG_REGULATOR_BQ24022 is not set
450# CONFIG_UIO is not set
451
452#
453# File systems
454#
455# CONFIG_EXT2_FS is not set
456# CONFIG_EXT3_FS is not set
457# CONFIG_EXT4DEV_FS is not set
458# CONFIG_REISERFS_FS is not set
459# CONFIG_JFS_FS is not set
460CONFIG_FS_POSIX_ACL=y
461# CONFIG_XFS_FS is not set
462# CONFIG_GFS2_FS is not set
463# CONFIG_DNOTIFY is not set
464# CONFIG_INOTIFY is not set
465# CONFIG_QUOTA is not set
466# CONFIG_AUTOFS_FS is not set
467# CONFIG_AUTOFS4_FS is not set
468# CONFIG_FUSE_FS is not set
469CONFIG_GENERIC_ACL=y
470
471#
472# CD-ROM/DVD Filesystems
473#
474# CONFIG_ISO9660_FS is not set
475# CONFIG_UDF_FS is not set
476
477#
478# DOS/FAT/NT Filesystems
479#
480# CONFIG_MSDOS_FS is not set
481# CONFIG_VFAT_FS is not set
482# CONFIG_NTFS_FS is not set
483
484#
485# Pseudo filesystems
486#
487CONFIG_PROC_FS=y
488CONFIG_PROC_SYSCTL=y
489CONFIG_SYSFS=y
490CONFIG_TMPFS=y
491CONFIG_TMPFS_POSIX_ACL=y
492# CONFIG_HUGETLB_PAGE is not set
493# CONFIG_CONFIGFS_FS is not set
494
495#
496# Miscellaneous filesystems
497#
498# CONFIG_ADFS_FS is not set
499# CONFIG_AFFS_FS is not set
500# CONFIG_HFS_FS is not set
501# CONFIG_HFSPLUS_FS is not set
502# CONFIG_BEFS_FS is not set
503# CONFIG_BFS_FS is not set
504# CONFIG_EFS_FS is not set
505# CONFIG_CRAMFS is not set
506# CONFIG_VXFS_FS is not set
507# CONFIG_MINIX_FS is not set
508# CONFIG_OMFS_FS is not set
509# CONFIG_HPFS_FS is not set
510# CONFIG_QNX4FS_FS is not set
511CONFIG_ROMFS_FS=y
512# CONFIG_SYSV_FS is not set
513# CONFIG_UFS_FS is not set
514
515#
516# Partition Types
517#
518CONFIG_PARTITION_ADVANCED=y
519# CONFIG_ACORN_PARTITION is not set
520# CONFIG_OSF_PARTITION is not set
521# CONFIG_AMIGA_PARTITION is not set
522# CONFIG_ATARI_PARTITION is not set
523# CONFIG_MAC_PARTITION is not set
524CONFIG_MSDOS_PARTITION=y
525# CONFIG_BSD_DISKLABEL is not set
526# CONFIG_MINIX_SUBPARTITION is not set
527# CONFIG_SOLARIS_X86_PARTITION is not set
528# CONFIG_UNIXWARE_DISKLABEL is not set
529# CONFIG_LDM_PARTITION is not set
530# CONFIG_SGI_PARTITION is not set
531# CONFIG_ULTRIX_PARTITION is not set
532# CONFIG_SUN_PARTITION is not set
533# CONFIG_KARMA_PARTITION is not set
534# CONFIG_EFI_PARTITION is not set
535# CONFIG_SYSV68_PARTITION is not set
536CONFIG_NLS=y
537CONFIG_NLS_DEFAULT="iso8859-1"
538CONFIG_NLS_CODEPAGE_437=y
539# CONFIG_NLS_CODEPAGE_737 is not set
540# CONFIG_NLS_CODEPAGE_775 is not set
541# CONFIG_NLS_CODEPAGE_850 is not set
542# CONFIG_NLS_CODEPAGE_852 is not set
543# CONFIG_NLS_CODEPAGE_855 is not set
544# CONFIG_NLS_CODEPAGE_857 is not set
545# CONFIG_NLS_CODEPAGE_860 is not set
546# CONFIG_NLS_CODEPAGE_861 is not set
547# CONFIG_NLS_CODEPAGE_862 is not set
548# CONFIG_NLS_CODEPAGE_863 is not set
549# CONFIG_NLS_CODEPAGE_864 is not set
550# CONFIG_NLS_CODEPAGE_865 is not set
551# CONFIG_NLS_CODEPAGE_866 is not set
552# CONFIG_NLS_CODEPAGE_869 is not set
553# CONFIG_NLS_CODEPAGE_936 is not set
554# CONFIG_NLS_CODEPAGE_950 is not set
555# CONFIG_NLS_CODEPAGE_932 is not set
556# CONFIG_NLS_CODEPAGE_949 is not set
557# CONFIG_NLS_CODEPAGE_874 is not set
558# CONFIG_NLS_ISO8859_8 is not set
559# CONFIG_NLS_CODEPAGE_1250 is not set
560# CONFIG_NLS_CODEPAGE_1251 is not set
561# CONFIG_NLS_ASCII is not set
562CONFIG_NLS_ISO8859_1=y
563# CONFIG_NLS_ISO8859_2 is not set
564# CONFIG_NLS_ISO8859_3 is not set
565# CONFIG_NLS_ISO8859_4 is not set
566# CONFIG_NLS_ISO8859_5 is not set
567# CONFIG_NLS_ISO8859_6 is not set
568# CONFIG_NLS_ISO8859_7 is not set
569# CONFIG_NLS_ISO8859_9 is not set
570# CONFIG_NLS_ISO8859_13 is not set
571# CONFIG_NLS_ISO8859_14 is not set
572# CONFIG_NLS_ISO8859_15 is not set
573# CONFIG_NLS_KOI8_R is not set
574# CONFIG_NLS_KOI8_U is not set
575# CONFIG_NLS_UTF8 is not set
576
577#
578# Kernel hacking
579#
580# CONFIG_PRINTK_TIME is not set
581# CONFIG_ENABLE_WARN_DEPRECATED is not set
582# CONFIG_ENABLE_MUST_CHECK is not set
583CONFIG_FRAME_WARN=1024
584# CONFIG_MAGIC_SYSRQ is not set
585# CONFIG_UNUSED_SYMBOLS is not set
586CONFIG_DEBUG_FS=y
587# CONFIG_HEADERS_CHECK is not set
588# CONFIG_DEBUG_KERNEL is not set
589CONFIG_DEBUG_BUGVERBOSE=y
590CONFIG_DEBUG_MEMORY_INIT=y
591CONFIG_FRAME_POINTER=y
592# CONFIG_LATENCYTOP is not set
593# CONFIG_SYSCTL_SYSCALL_CHECK is not set
594CONFIG_HAVE_FTRACE=y
595CONFIG_HAVE_DYNAMIC_FTRACE=y
596# CONFIG_FTRACE is not set
597# CONFIG_SCHED_TRACER is not set
598# CONFIG_CONTEXT_SWITCH_TRACER is not set
599# CONFIG_SAMPLES is not set
600CONFIG_HAVE_ARCH_KGDB=y
601# CONFIG_DEBUG_USER is not set
602
603#
604# Security options
605#
606# CONFIG_KEYS is not set
607# CONFIG_SECURITY is not set
608# CONFIG_SECURITY_FILE_CAPABILITIES is not set
609# CONFIG_CRYPTO is not set
610
611#
612# Library routines
613#
614# CONFIG_GENERIC_FIND_FIRST_BIT is not set
615# CONFIG_GENERIC_FIND_NEXT_BIT is not set
616# CONFIG_CRC_CCITT is not set
617# CONFIG_CRC16 is not set
618# CONFIG_CRC_T10DIF is not set
619# CONFIG_CRC_ITU_T is not set
620# CONFIG_CRC32 is not set
621# CONFIG_CRC7 is not set
622# CONFIG_LIBCRC32C is not set
623CONFIG_PLIST=y
624CONFIG_HAS_IOMEM=y
625CONFIG_HAS_IOPORT=y
626CONFIG_HAS_DMA=y
diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h
index 325f881ccb50..ee99723b3a6c 100644
--- a/arch/arm/include/asm/atomic.h
+++ b/arch/arm/include/asm/atomic.h
@@ -12,10 +12,9 @@
12#define __ASM_ARM_ATOMIC_H 12#define __ASM_ARM_ATOMIC_H
13 13
14#include <linux/compiler.h> 14#include <linux/compiler.h>
15#include <linux/types.h>
15#include <asm/system.h> 16#include <asm/system.h>
16 17
17typedef struct { volatile int counter; } atomic_t;
18
19#define ATOMIC_INIT(i) { (i) } 18#define ATOMIC_INIT(i) { (i) }
20 19
21#ifdef __KERNEL__ 20#ifdef __KERNEL__
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index de6c59f814a1..6cbd8fdc9f1f 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -10,11 +10,11 @@
10#ifndef _ASMARM_CACHEFLUSH_H 10#ifndef _ASMARM_CACHEFLUSH_H
11#define _ASMARM_CACHEFLUSH_H 11#define _ASMARM_CACHEFLUSH_H
12 12
13#include <linux/sched.h>
14#include <linux/mm.h> 13#include <linux/mm.h>
15 14
16#include <asm/glue.h> 15#include <asm/glue.h>
17#include <asm/shmparam.h> 16#include <asm/shmparam.h>
17#include <asm/cachetype.h>
18 18
19#define CACHE_COLOUR(vaddr) ((vaddr & (SHMLBA - 1)) >> PAGE_SHIFT) 19#define CACHE_COLOUR(vaddr) ((vaddr & (SHMLBA - 1)) >> PAGE_SHIFT)
20 20
@@ -296,16 +296,6 @@ static inline void outer_flush_range(unsigned long start, unsigned long end)
296#endif 296#endif
297 297
298/* 298/*
299 * flush_cache_vmap() is used when creating mappings (eg, via vmap,
300 * vmalloc, ioremap etc) in kernel space for pages. Since the
301 * direct-mappings of these pages may contain cached data, we need
302 * to do a full cache flush to ensure that writebacks don't corrupt
303 * data placed into these pages via the new mappings.
304 */
305#define flush_cache_vmap(start, end) flush_cache_all()
306#define flush_cache_vunmap(start, end) flush_cache_all()
307
308/*
309 * Copy user data from/to a page which is mapped into a different 299 * Copy user data from/to a page which is mapped into a different
310 * processes address space. Really, we want to allow our "user 300 * processes address space. Really, we want to allow our "user
311 * space" model to handle this. 301 * space" model to handle this.
@@ -444,4 +434,29 @@ static inline void flush_ioremap_region(unsigned long phys, void __iomem *virt,
444 dmac_inv_range(start, start + size); 434 dmac_inv_range(start, start + size);
445} 435}
446 436
437/*
438 * flush_cache_vmap() is used when creating mappings (eg, via vmap,
439 * vmalloc, ioremap etc) in kernel space for pages. On non-VIPT
440 * caches, since the direct-mappings of these pages may contain cached
441 * data, we need to do a full cache flush to ensure that writebacks
442 * don't corrupt data placed into these pages via the new mappings.
443 */
444static inline void flush_cache_vmap(unsigned long start, unsigned long end)
445{
446 if (!cache_is_vipt_nonaliasing())
447 flush_cache_all();
448 else
449 /*
450 * set_pte_at() called from vmap_pte_range() does not
451 * have a DSB after cleaning the cache line.
452 */
453 dsb();
454}
455
456static inline void flush_cache_vunmap(unsigned long start, unsigned long end)
457{
458 if (!cache_is_vipt_nonaliasing())
459 flush_cache_all();
460}
461
447#endif 462#endif
diff --git a/arch/arm/include/asm/clkdev.h b/arch/arm/include/asm/clkdev.h
new file mode 100644
index 000000000000..b6ec7c627b39
--- /dev/null
+++ b/arch/arm/include/asm/clkdev.h
@@ -0,0 +1,30 @@
1/*
2 * arch/arm/include/asm/clkdev.h
3 *
4 * Copyright (C) 2008 Russell King.
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 * Helper for the clk API to assist looking up a struct clk.
11 */
12#ifndef __ASM_CLKDEV_H
13#define __ASM_CLKDEV_H
14
15struct clk;
16
17struct clk_lookup {
18 struct list_head node;
19 const char *dev_id;
20 const char *con_id;
21 struct clk *clk;
22};
23
24struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,
25 const char *dev_fmt, ...);
26
27void clkdev_add(struct clk_lookup *cl);
28void clkdev_drop(struct clk_lookup *cl);
29
30#endif
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index 4ed149cbb32a..22cb14ec3438 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -69,7 +69,9 @@ extern void dma_cache_maint(const void *kaddr, size_t size, int rw);
69 */ 69 */
70static inline int dma_supported(struct device *dev, u64 mask) 70static inline int dma_supported(struct device *dev, u64 mask)
71{ 71{
72 return dev->dma_mask && *dev->dma_mask != 0; 72 if (mask < ISA_DMA_THRESHOLD)
73 return 0;
74 return 1;
73} 75}
74 76
75static inline int dma_set_mask(struct device *dev, u64 dma_mask) 77static inline int dma_set_mask(struct device *dev, u64 dma_mask)
diff --git a/arch/arm/include/asm/dma.h b/arch/arm/include/asm/dma.h
index 75154b193117..df5638f3643a 100644
--- a/arch/arm/include/asm/dma.h
+++ b/arch/arm/include/asm/dma.h
@@ -1,12 +1,7 @@
1#ifndef __ASM_ARM_DMA_H 1#ifndef __ASM_ARM_DMA_H
2#define __ASM_ARM_DMA_H 2#define __ASM_ARM_DMA_H
3 3
4typedef unsigned int dmach_t; 4#include <asm/memory.h>
5
6#include <linux/spinlock.h>
7#include <asm/system.h>
8#include <asm/scatterlist.h>
9#include <mach/dma.h>
10 5
11/* 6/*
12 * This is the maximum virtual address which can be DMA'd from. 7 * This is the maximum virtual address which can be DMA'd from.
@@ -15,6 +10,19 @@ typedef unsigned int dmach_t;
15#define MAX_DMA_ADDRESS 0xffffffff 10#define MAX_DMA_ADDRESS 0xffffffff
16#endif 11#endif
17 12
13#ifdef CONFIG_ISA_DMA_API
14/*
15 * This is used to support drivers written for the x86 ISA DMA API.
16 * It should not be re-used except for that purpose.
17 */
18#include <linux/spinlock.h>
19#include <asm/system.h>
20#include <asm/scatterlist.h>
21
22typedef unsigned int dmach_t;
23
24#include <mach/isa-dma.h>
25
18/* 26/*
19 * DMA modes 27 * DMA modes
20 */ 28 */
@@ -140,4 +148,6 @@ extern int isa_dma_bridge_buggy;
140#define isa_dma_bridge_buggy (0) 148#define isa_dma_bridge_buggy (0)
141#endif 149#endif
142 150
143#endif /* _ARM_DMA_H */ 151#endif /* CONFIG_ISA_DMA_API */
152
153#endif /* __ASM_ARM_DMA_H */
diff --git a/arch/arm/include/asm/hardware/iomd.h b/arch/arm/include/asm/hardware/iomd.h
index 9c5afbd71a69..f9ee69e4f53e 100644
--- a/arch/arm/include/asm/hardware/iomd.h
+++ b/arch/arm/include/asm/hardware/iomd.h
@@ -32,19 +32,11 @@
32#define IOMD_KARTRX (0x004) 32#define IOMD_KARTRX (0x004)
33#define IOMD_KCTRL (0x008) 33#define IOMD_KCTRL (0x008)
34 34
35#ifdef CONFIG_ARCH_CLPS7500
36#define IOMD_IOLINES (0x00C)
37#endif
38
39#define IOMD_IRQSTATA (0x010) 35#define IOMD_IRQSTATA (0x010)
40#define IOMD_IRQREQA (0x014) 36#define IOMD_IRQREQA (0x014)
41#define IOMD_IRQCLRA (0x014) 37#define IOMD_IRQCLRA (0x014)
42#define IOMD_IRQMASKA (0x018) 38#define IOMD_IRQMASKA (0x018)
43 39
44#ifdef CONFIG_ARCH_CLPS7500
45#define IOMD_SUSMODE (0x01C)
46#endif
47
48#define IOMD_IRQSTATB (0x020) 40#define IOMD_IRQSTATB (0x020)
49#define IOMD_IRQREQB (0x024) 41#define IOMD_IRQREQB (0x024)
50#define IOMD_IRQMASKB (0x028) 42#define IOMD_IRQMASKB (0x028)
@@ -53,10 +45,6 @@
53#define IOMD_FIQREQ (0x034) 45#define IOMD_FIQREQ (0x034)
54#define IOMD_FIQMASK (0x038) 46#define IOMD_FIQMASK (0x038)
55 47
56#ifdef CONFIG_ARCH_CLPS7500
57#define IOMD_CLKCTL (0x03C)
58#endif
59
60#define IOMD_T0CNTL (0x040) 48#define IOMD_T0CNTL (0x040)
61#define IOMD_T0LTCHL (0x040) 49#define IOMD_T0LTCHL (0x040)
62#define IOMD_T0CNTH (0x044) 50#define IOMD_T0CNTH (0x044)
@@ -71,18 +59,6 @@
71#define IOMD_T1GO (0x058) 59#define IOMD_T1GO (0x058)
72#define IOMD_T1LATCH (0x05c) 60#define IOMD_T1LATCH (0x05c)
73 61
74#ifdef CONFIG_ARCH_CLPS7500
75#define IOMD_IRQSTATC (0x060)
76#define IOMD_IRQREQC (0x064)
77#define IOMD_IRQMASKC (0x068)
78
79#define IOMD_VIDMUX (0x06c)
80
81#define IOMD_IRQSTATD (0x070)
82#define IOMD_IRQREQD (0x074)
83#define IOMD_IRQMASKD (0x078)
84#endif
85
86#define IOMD_ROMCR0 (0x080) 62#define IOMD_ROMCR0 (0x080)
87#define IOMD_ROMCR1 (0x084) 63#define IOMD_ROMCR1 (0x084)
88#ifdef CONFIG_ARCH_RPC 64#ifdef CONFIG_ARCH_RPC
@@ -100,11 +76,6 @@
100#define IOMD_MOUSEY (0x0A4) 76#define IOMD_MOUSEY (0x0A4)
101#endif 77#endif
102 78
103#ifdef CONFIG_ARCH_CLPS7500
104#define IOMD_MSEDAT (0x0A8)
105#define IOMD_MSECTL (0x0Ac)
106#endif
107
108#ifdef CONFIG_ARCH_RPC 79#ifdef CONFIG_ARCH_RPC
109#define IOMD_DMATCR (0x0C0) 80#define IOMD_DMATCR (0x0C0)
110#endif 81#endif
@@ -113,18 +84,6 @@
113#ifdef CONFIG_ARCH_RPC 84#ifdef CONFIG_ARCH_RPC
114#define IOMD_DMAEXT (0x0CC) 85#define IOMD_DMAEXT (0x0CC)
115#endif 86#endif
116#ifdef CONFIG_ARCH_CLPS7500
117#define IOMD_ASTCR (0x0CC)
118#define IOMD_DRAMCR (0x0D0)
119#define IOMD_SELFREF (0x0D4)
120#define IOMD_ATODICR (0x0E0)
121#define IOMD_ATODSR (0x0E4)
122#define IOMD_ATODCC (0x0E8)
123#define IOMD_ATODCNT1 (0x0EC)
124#define IOMD_ATODCNT2 (0x0F0)
125#define IOMD_ATODCNT3 (0x0F4)
126#define IOMD_ATODCNT4 (0x0F8)
127#endif
128 87
129#ifdef CONFIG_ARCH_RPC 88#ifdef CONFIG_ARCH_RPC
130#define DMA_EXT_IO0 1 89#define DMA_EXT_IO0 1
diff --git a/arch/arm/include/asm/hardware/vic.h b/arch/arm/include/asm/hardware/vic.h
index 263f2c362a30..f87328d4a180 100644
--- a/arch/arm/include/asm/hardware/vic.h
+++ b/arch/arm/include/asm/hardware/vic.h
@@ -29,15 +29,17 @@
29#define VIC_INT_SOFT 0x18 29#define VIC_INT_SOFT 0x18
30#define VIC_INT_SOFT_CLEAR 0x1c 30#define VIC_INT_SOFT_CLEAR 0x1c
31#define VIC_PROTECT 0x20 31#define VIC_PROTECT 0x20
32#define VIC_VECT_ADDR 0x30 32#define VIC_PL190_VECT_ADDR 0x30 /* PL190 only */
33#define VIC_DEF_VECT_ADDR 0x34 33#define VIC_PL190_DEF_VECT_ADDR 0x34 /* PL190 only */
34 34
35#define VIC_VECT_ADDR0 0x100 /* 0 to 15 */ 35#define VIC_VECT_ADDR0 0x100 /* 0 to 15 (0..31 PL192) */
36#define VIC_VECT_CNTL0 0x200 /* 0 to 15 */ 36#define VIC_VECT_CNTL0 0x200 /* 0 to 15 (0..31 PL192) */
37#define VIC_ITCR 0x300 /* VIC test control register */ 37#define VIC_ITCR 0x300 /* VIC test control register */
38 38
39#define VIC_VECT_CNTL_ENABLE (1 << 5) 39#define VIC_VECT_CNTL_ENABLE (1 << 5)
40 40
41#define VIC_PL192_VECT_ADDR 0xF00
42
41#ifndef __ASSEMBLY__ 43#ifndef __ASSEMBLY__
42void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources); 44void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources);
43#endif 45#endif
diff --git a/arch/arm/include/asm/hwcap.h b/arch/arm/include/asm/hwcap.h
index 81f4c899a555..bda489f9f017 100644
--- a/arch/arm/include/asm/hwcap.h
+++ b/arch/arm/include/asm/hwcap.h
@@ -16,6 +16,7 @@
16#define HWCAP_IWMMXT 512 16#define HWCAP_IWMMXT 512
17#define HWCAP_CRUNCH 1024 17#define HWCAP_CRUNCH 1024
18#define HWCAP_THUMBEE 2048 18#define HWCAP_THUMBEE 2048
19#define HWCAP_NEON 4096
19 20
20#if defined(__KERNEL__) && !defined(__ASSEMBLY__) 21#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
21/* 22/*
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index a8094451be57..d2a59cfc30ce 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -80,6 +80,14 @@ extern void __iounmap(volatile void __iomem *addr);
80extern void __readwrite_bug(const char *fn); 80extern void __readwrite_bug(const char *fn);
81 81
82/* 82/*
83 * A typesafe __io() helper
84 */
85static inline void __iomem *__typesafe_io(unsigned long addr)
86{
87 return (void __iomem *)addr;
88}
89
90/*
83 * Now, pick up the machine-defined IO definitions 91 * Now, pick up the machine-defined IO definitions
84 */ 92 */
85#include <mach/io.h> 93#include <mach/io.h>
diff --git a/arch/arm/include/asm/irq.h b/arch/arm/include/asm/irq.h
index a0009aa5d157..328f14a8b790 100644
--- a/arch/arm/include/asm/irq.h
+++ b/arch/arm/include/asm/irq.h
@@ -7,10 +7,6 @@
7#define irq_canonicalize(i) (i) 7#define irq_canonicalize(i) (i)
8#endif 8#endif
9 9
10#ifndef NR_IRQS
11#define NR_IRQS 128
12#endif
13
14/* 10/*
15 * Use this value to indicate lack of interrupt 11 * Use this value to indicate lack of interrupt
16 * capability 12 * capability
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 77764301844b..0202a7c20e62 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -112,10 +112,8 @@
112 * private definitions which should NOT be used outside memory.h 112 * private definitions which should NOT be used outside memory.h
113 * files. Use virt_to_phys/phys_to_virt/__pa/__va instead. 113 * files. Use virt_to_phys/phys_to_virt/__pa/__va instead.
114 */ 114 */
115#ifndef __virt_to_phys
116#define __virt_to_phys(x) ((x) - PAGE_OFFSET + PHYS_OFFSET) 115#define __virt_to_phys(x) ((x) - PAGE_OFFSET + PHYS_OFFSET)
117#define __phys_to_virt(x) ((x) - PHYS_OFFSET + PAGE_OFFSET) 116#define __phys_to_virt(x) ((x) - PHYS_OFFSET + PAGE_OFFSET)
118#endif
119 117
120/* 118/*
121 * Convert a physical address to a Page Frame Number and back 119 * Convert a physical address to a Page Frame Number and back
@@ -180,6 +178,11 @@ static inline void *phys_to_virt(unsigned long x)
180 * memory. Use of these is *deprecated* (and that doesn't mean 178 * memory. Use of these is *deprecated* (and that doesn't mean
181 * use the __ prefixed forms instead.) See dma-mapping.h. 179 * use the __ prefixed forms instead.) See dma-mapping.h.
182 */ 180 */
181#ifndef __virt_to_bus
182#define __virt_to_bus __virt_to_phys
183#define __bus_to_virt __phys_to_virt
184#endif
185
183static inline __deprecated unsigned long virt_to_bus(void *x) 186static inline __deprecated unsigned long virt_to_bus(void *x)
184{ 187{
185 return __virt_to_bus((unsigned long)x); 188 return __virt_to_bus((unsigned long)x);
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h
index 0559f37c2a27..263fed05ea33 100644
--- a/arch/arm/include/asm/mmu_context.h
+++ b/arch/arm/include/asm/mmu_context.h
@@ -14,6 +14,7 @@
14#define __ASM_ARM_MMU_CONTEXT_H 14#define __ASM_ARM_MMU_CONTEXT_H
15 15
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17#include <linux/sched.h>
17#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
18#include <asm/cachetype.h> 19#include <asm/cachetype.h>
19#include <asm/proc-fns.h> 20#include <asm/proc-fns.h>
diff --git a/arch/arm/include/asm/mtd-xip.h b/arch/arm/include/asm/mtd-xip.h
index d8fbe2d9b8b9..d79d66d2cf71 100644
--- a/arch/arm/include/asm/mtd-xip.h
+++ b/arch/arm/include/asm/mtd-xip.h
@@ -15,7 +15,6 @@
15#ifndef __ARM_MTD_XIP_H__ 15#ifndef __ARM_MTD_XIP_H__
16#define __ARM_MTD_XIP_H__ 16#define __ARM_MTD_XIP_H__
17 17
18#include <mach/hardware.h>
19#include <mach/mtd-xip.h> 18#include <mach/mtd-xip.h>
20 19
21/* fill instruction prefetch */ 20/* fill instruction prefetch */
diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h
index bed1c0a00368..f341c9dbd662 100644
--- a/arch/arm/include/asm/page.h
+++ b/arch/arm/include/asm/page.h
@@ -108,32 +108,38 @@
108#error Unknown user operations model 108#error Unknown user operations model
109#endif 109#endif
110 110
111struct page;
112
111struct cpu_user_fns { 113struct cpu_user_fns {
112 void (*cpu_clear_user_page)(void *p, unsigned long user); 114 void (*cpu_clear_user_highpage)(struct page *page, unsigned long vaddr);
113 void (*cpu_copy_user_page)(void *to, const void *from, 115 void (*cpu_copy_user_highpage)(struct page *to, struct page *from,
114 unsigned long user); 116 unsigned long vaddr);
115}; 117};
116 118
117#ifdef MULTI_USER 119#ifdef MULTI_USER
118extern struct cpu_user_fns cpu_user; 120extern struct cpu_user_fns cpu_user;
119 121
120#define __cpu_clear_user_page cpu_user.cpu_clear_user_page 122#define __cpu_clear_user_highpage cpu_user.cpu_clear_user_highpage
121#define __cpu_copy_user_page cpu_user.cpu_copy_user_page 123#define __cpu_copy_user_highpage cpu_user.cpu_copy_user_highpage
122 124
123#else 125#else
124 126
125#define __cpu_clear_user_page __glue(_USER,_clear_user_page) 127#define __cpu_clear_user_highpage __glue(_USER,_clear_user_highpage)
126#define __cpu_copy_user_page __glue(_USER,_copy_user_page) 128#define __cpu_copy_user_highpage __glue(_USER,_copy_user_highpage)
127 129
128extern void __cpu_clear_user_page(void *p, unsigned long user); 130extern void __cpu_clear_user_highpage(struct page *page, unsigned long vaddr);
129extern void __cpu_copy_user_page(void *to, const void *from, 131extern void __cpu_copy_user_highpage(struct page *to, struct page *from,
130 unsigned long user); 132 unsigned long vaddr);
131#endif 133#endif
132 134
133#define clear_user_page(addr,vaddr,pg) __cpu_clear_user_page(addr, vaddr) 135#define clear_user_highpage(page,vaddr) \
134#define copy_user_page(to,from,vaddr,pg) __cpu_copy_user_page(to, from, vaddr) 136 __cpu_clear_user_highpage(page, vaddr)
137
138#define __HAVE_ARCH_COPY_USER_HIGHPAGE
139#define copy_user_highpage(to,from,vaddr,vma) \
140 __cpu_copy_user_highpage(to, from, vaddr)
135 141
136#define clear_page(page) memzero((void *)(page), PAGE_SIZE) 142#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
137extern void copy_page(void *to, const void *from); 143extern void copy_page(void *to, const void *from);
138 144
139#undef STRICT_MM_TYPECHECKS 145#undef STRICT_MM_TYPECHECKS
diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h
index 6ff33790f47b..1845892260e7 100644
--- a/arch/arm/include/asm/processor.h
+++ b/arch/arm/include/asm/processor.h
@@ -64,7 +64,7 @@ struct thread_struct {
64({ \ 64({ \
65 unsigned long *stack = (unsigned long *)sp; \ 65 unsigned long *stack = (unsigned long *)sp; \
66 set_fs(USER_DS); \ 66 set_fs(USER_DS); \
67 memzero(regs->uregs, sizeof(regs->uregs)); \ 67 memset(regs->uregs, 0, sizeof(regs->uregs)); \
68 if (current->personality & ADDR_LIMIT_32BIT) \ 68 if (current->personality & ADDR_LIMIT_32BIT) \
69 regs->ARM_cpsr = USR_MODE; \ 69 regs->ARM_cpsr = USR_MODE; \
70 else \ 70 else \
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h
index a65413ba121d..f2cd18a0932b 100644
--- a/arch/arm/include/asm/setup.h
+++ b/arch/arm/include/asm/setup.h
@@ -209,9 +209,11 @@ struct meminfo {
209 struct membank bank[NR_BANKS]; 209 struct membank bank[NR_BANKS];
210}; 210};
211 211
212extern struct meminfo meminfo;
213
212#define for_each_nodebank(iter,mi,no) \ 214#define for_each_nodebank(iter,mi,no) \
213 for (iter = 0; iter < mi->nr_banks; iter++) \ 215 for (iter = 0; iter < (mi)->nr_banks; iter++) \
214 if (mi->bank[iter].node == no) 216 if ((mi)->bank[iter].node == no)
215 217
216#define bank_pfn_start(bank) __phys_to_pfn((bank)->start) 218#define bank_pfn_start(bank) __phys_to_pfn((bank)->start)
217#define bank_pfn_end(bank) __phys_to_pfn((bank)->start + (bank)->size) 219#define bank_pfn_end(bank) __phys_to_pfn((bank)->start + (bank)->size)
diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h
index 727b5c042e52..fad70da5911d 100644
--- a/arch/arm/include/asm/smp.h
+++ b/arch/arm/include/asm/smp.h
@@ -114,7 +114,7 @@ extern void local_timer_interrupt(void);
114/* 114/*
115 * Stop a local timer interrupt. 115 * Stop a local timer interrupt.
116 */ 116 */
117extern void local_timer_stop(unsigned int cpu); 117extern void local_timer_stop(void);
118 118
119/* 119/*
120 * Platform provides this to acknowledge a local timer IRQ 120 * Platform provides this to acknowledge a local timer IRQ
@@ -123,7 +123,7 @@ extern int local_timer_ack(void);
123 123
124#else 124#else
125 125
126static inline void local_timer_stop(unsigned int cpu) 126static inline void local_timer_stop(void)
127{ 127{
128} 128}
129 129
@@ -132,7 +132,7 @@ static inline void local_timer_stop(unsigned int cpu)
132/* 132/*
133 * Setup a local timer interrupt for a CPU. 133 * Setup a local timer interrupt for a CPU.
134 */ 134 */
135extern void local_timer_setup(unsigned int cpu); 135extern void local_timer_setup(void);
136 136
137/* 137/*
138 * show local interrupt info 138 * show local interrupt info
diff --git a/arch/arm/include/asm/string.h b/arch/arm/include/asm/string.h
index e50c4a39b699..cf4f3aad0fc1 100644
--- a/arch/arm/include/asm/string.h
+++ b/arch/arm/include/asm/string.h
@@ -21,7 +21,6 @@ extern void * memmove(void *, const void *, __kernel_size_t);
21#define __HAVE_ARCH_MEMCHR 21#define __HAVE_ARCH_MEMCHR
22extern void * memchr(const void *, int, __kernel_size_t); 22extern void * memchr(const void *, int, __kernel_size_t);
23 23
24#define __HAVE_ARCH_MEMZERO
25#define __HAVE_ARCH_MEMSET 24#define __HAVE_ARCH_MEMSET
26extern void * memset(void *, int, __kernel_size_t); 25extern void * memset(void *, int, __kernel_size_t);
27 26
@@ -39,12 +38,4 @@ extern void __memzero(void *ptr, __kernel_size_t n);
39 (__p); \ 38 (__p); \
40 }) 39 })
41 40
42#define memzero(p,n) \
43 ({ \
44 void *__p = (p); size_t __n = n; \
45 if ((__n) != 0) \
46 __memzero((__p),(__n)); \
47 (__p); \
48 })
49
50#endif 41#endif
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 568020b34e3e..811be55f338e 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -3,8 +3,6 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <asm/memory.h>
7
8#define CPU_ARCH_UNKNOWN 0 6#define CPU_ARCH_UNKNOWN 0
9#define CPU_ARCH_ARMv3 1 7#define CPU_ARCH_ARMv3 1
10#define CPU_ARCH_ARMv4 2 8#define CPU_ARCH_ARMv4 2
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
index e98ec60b3400..7897464e0c24 100644
--- a/arch/arm/include/asm/uaccess.h
+++ b/arch/arm/include/asm/uaccess.h
@@ -11,7 +11,8 @@
11/* 11/*
12 * User space memory access functions 12 * User space memory access functions
13 */ 13 */
14#include <linux/sched.h> 14#include <linux/string.h>
15#include <linux/thread_info.h>
15#include <asm/errno.h> 16#include <asm/errno.h>
16#include <asm/memory.h> 17#include <asm/memory.h>
17#include <asm/domain.h> 18#include <asm/domain.h>
@@ -400,7 +401,7 @@ static inline unsigned long __must_check copy_from_user(void *to, const void __u
400 if (access_ok(VERIFY_READ, from, n)) 401 if (access_ok(VERIFY_READ, from, n))
401 n = __copy_from_user(to, from, n); 402 n = __copy_from_user(to, from, n);
402 else /* security hole - plug it */ 403 else /* security hole - plug it */
403 memzero(to, n); 404 memset(to, 0, n);
404 return n; 405 return n;
405} 406}
406 407
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
index 23af3c972c9a..531e1860e546 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
@@ -8,6 +8,7 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/sched.h>
11#include <linux/string.h> 12#include <linux/string.h>
12#include <linux/cryptohash.h> 13#include <linux/cryptohash.h>
13#include <linux/delay.h> 14#include <linux/delay.h>
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c
index 60c079d85355..eed2f795e1b3 100644
--- a/arch/arm/kernel/ecard.c
+++ b/arch/arm/kernel/ecard.c
@@ -817,7 +817,7 @@ static struct expansion_card *__init ecard_alloc_card(int type, int slot)
817 ec->dma = NO_DMA; 817 ec->dma = NO_DMA;
818 ec->ops = &ecard_default_ops; 818 ec->ops = &ecard_default_ops;
819 819
820 snprintf(ec->dev.bus_id, sizeof(ec->dev.bus_id), "ecard%d", slot); 820 dev_set_name(&ec->dev, "ecard%d", slot);
821 ec->dev.parent = NULL; 821 ec->dev.parent = NULL;
822 ec->dev.bus = &ecard_bus_type; 822 ec->dev.bus = &ecard_bus_type;
823 ec->dev.dma_mask = &ec->dma_mask; 823 ec->dev.dma_mask = &ec->dma_mask;
diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c
index 6c90479e8974..c63842766229 100644
--- a/arch/arm/kernel/ftrace.c
+++ b/arch/arm/kernel/ftrace.c
@@ -95,7 +95,7 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
95 return ret; 95 return ret;
96} 96}
97 97
98/* run from kstop_machine */ 98/* run from ftrace_init with irqs disabled */
99int __init ftrace_dyn_arch_init(void *data) 99int __init ftrace_dyn_arch_init(void *data)
100{ 100{
101 ftrace_mcount_set(data); 101 ftrace_mcount_set(data);
diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S
index bde52df1c668..991952c644d1 100644
--- a/arch/arm/kernel/head-common.S
+++ b/arch/arm/kernel/head-common.S
@@ -18,7 +18,7 @@
18__switch_data: 18__switch_data:
19 .long __mmap_switched 19 .long __mmap_switched
20 .long __data_loc @ r4 20 .long __data_loc @ r4
21 .long __data_start @ r5 21 .long _data @ r5
22 .long __bss_start @ r6 22 .long __bss_start @ r6
23 .long _end @ r7 23 .long _end @ r7
24 .long processor_id @ r4 24 .long processor_id @ r4
diff --git a/arch/arm/kernel/init_task.c b/arch/arm/kernel/init_task.c
index 0bbf80625395..e859af349467 100644
--- a/arch/arm/kernel/init_task.c
+++ b/arch/arm/kernel/init_task.c
@@ -12,7 +12,6 @@
12 12
13#include <asm/pgtable.h> 13#include <asm/pgtable.h>
14 14
15static struct fs_struct init_fs = INIT_FS;
16static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 15static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
17static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
18struct mm_struct init_mm = INIT_MM(init_mm); 17struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 2f3eb795fa6e..7141cee1fab7 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -174,7 +174,7 @@ static void route_irq(struct irq_desc *desc, unsigned int irq, unsigned int cpu)
174 pr_debug("IRQ%u: moving from cpu%u to cpu%u\n", irq, desc->cpu, cpu); 174 pr_debug("IRQ%u: moving from cpu%u to cpu%u\n", irq, desc->cpu, cpu);
175 175
176 spin_lock_irq(&desc->lock); 176 spin_lock_irq(&desc->lock);
177 desc->chip->set_affinity(irq, cpumask_of_cpu(cpu)); 177 desc->chip->set_affinity(irq, cpumask_of(cpu));
178 spin_unlock_irq(&desc->lock); 178 spin_unlock_irq(&desc->lock);
179} 179}
180 180
diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c
index 3f9abe0e9aff..f692efddd449 100644
--- a/arch/arm/kernel/kprobes.c
+++ b/arch/arm/kernel/kprobes.c
@@ -92,9 +92,7 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
92void __kprobes arch_remove_kprobe(struct kprobe *p) 92void __kprobes arch_remove_kprobe(struct kprobe *p)
93{ 93{
94 if (p->ainsn.insn) { 94 if (p->ainsn.insn) {
95 mutex_lock(&kprobe_mutex);
96 free_insn_slot(p->ainsn.insn, 0); 95 free_insn_slot(p->ainsn.insn, 0);
97 mutex_unlock(&kprobe_mutex);
98 p->ainsn.insn = NULL; 96 p->ainsn.insn = NULL;
99 } 97 }
100} 98}
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index b8d965dcd6fd..dab48f27263f 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -21,6 +21,7 @@
21#include <linux/string.h> 21#include <linux/string.h>
22 22
23#include <asm/pgtable.h> 23#include <asm/pgtable.h>
24#include <asm/sections.h>
24 25
25#ifdef CONFIG_XIP_KERNEL 26#ifdef CONFIG_XIP_KERNEL
26/* 27/*
@@ -29,9 +30,8 @@
29 * MODULES_VADDR is redefined here and not in asm/memory.h to avoid 30 * MODULES_VADDR is redefined here and not in asm/memory.h to avoid
30 * recompiling the whole kernel when CONFIG_XIP_KERNEL is turned on/off. 31 * recompiling the whole kernel when CONFIG_XIP_KERNEL is turned on/off.
31 */ 32 */
32extern void _etext;
33#undef MODULES_VADDR 33#undef MODULES_VADDR
34#define MODULES_VADDR (((unsigned long)&_etext + ~PGDIR_MASK) & PGDIR_MASK) 34#define MODULES_VADDR (((unsigned long)_etext + ~PGDIR_MASK) & PGDIR_MASK)
35#endif 35#endif
36 36
37#ifdef CONFIG_MMU 37#ifdef CONFIG_MMU
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 1f1eecca7f55..7049815d66d5 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -29,6 +29,7 @@
29#include <asm/cputype.h> 29#include <asm/cputype.h>
30#include <asm/elf.h> 30#include <asm/elf.h>
31#include <asm/procinfo.h> 31#include <asm/procinfo.h>
32#include <asm/sections.h>
32#include <asm/setup.h> 33#include <asm/setup.h>
33#include <asm/mach-types.h> 34#include <asm/mach-types.h>
34#include <asm/cacheflush.h> 35#include <asm/cacheflush.h>
@@ -59,9 +60,8 @@ static int __init fpe_setup(char *line)
59__setup("fpe=", fpe_setup); 60__setup("fpe=", fpe_setup);
60#endif 61#endif
61 62
62extern void paging_init(struct meminfo *, struct machine_desc *desc); 63extern void paging_init(struct machine_desc *desc);
63extern void reboot_setup(char *str); 64extern void reboot_setup(char *str);
64extern void _text, _etext, __data_start, _edata, _end;
65 65
66unsigned int processor_id; 66unsigned int processor_id;
67EXPORT_SYMBOL(processor_id); 67EXPORT_SYMBOL(processor_id);
@@ -112,7 +112,6 @@ static struct stack stacks[NR_CPUS];
112char elf_platform[ELF_PLATFORM_SIZE]; 112char elf_platform[ELF_PLATFORM_SIZE];
113EXPORT_SYMBOL(elf_platform); 113EXPORT_SYMBOL(elf_platform);
114 114
115static struct meminfo meminfo __initdata = { 0, };
116static const char *cpu_name; 115static const char *cpu_name;
117static const char *machine_name; 116static const char *machine_name;
118static char __initdata command_line[COMMAND_LINE_SIZE]; 117static char __initdata command_line[COMMAND_LINE_SIZE];
@@ -367,21 +366,34 @@ static struct machine_desc * __init setup_machine(unsigned int nr)
367 return list; 366 return list;
368} 367}
369 368
370static void __init arm_add_memory(unsigned long start, unsigned long size) 369static int __init arm_add_memory(unsigned long start, unsigned long size)
371{ 370{
372 struct membank *bank; 371 struct membank *bank = &meminfo.bank[meminfo.nr_banks];
372
373 if (meminfo.nr_banks >= NR_BANKS) {
374 printk(KERN_CRIT "NR_BANKS too low, "
375 "ignoring memory at %#lx\n", start);
376 return -EINVAL;
377 }
373 378
374 /* 379 /*
375 * Ensure that start/size are aligned to a page boundary. 380 * Ensure that start/size are aligned to a page boundary.
376 * Size is appropriately rounded down, start is rounded up. 381 * Size is appropriately rounded down, start is rounded up.
377 */ 382 */
378 size -= start & ~PAGE_MASK; 383 size -= start & ~PAGE_MASK;
379
380 bank = &meminfo.bank[meminfo.nr_banks++];
381
382 bank->start = PAGE_ALIGN(start); 384 bank->start = PAGE_ALIGN(start);
383 bank->size = size & PAGE_MASK; 385 bank->size = size & PAGE_MASK;
384 bank->node = PHYS_TO_NID(start); 386 bank->node = PHYS_TO_NID(start);
387
388 /*
389 * Check whether this memory region has non-zero size or
390 * invalid node number.
391 */
392 if (bank->size == 0 || bank->node >= MAX_NUMNODES)
393 return -EINVAL;
394
395 meminfo.nr_banks++;
396 return 0;
385} 397}
386 398
387/* 399/*
@@ -472,10 +484,10 @@ request_standard_resources(struct meminfo *mi, struct machine_desc *mdesc)
472 struct resource *res; 484 struct resource *res;
473 int i; 485 int i;
474 486
475 kernel_code.start = virt_to_phys(&_text); 487 kernel_code.start = virt_to_phys(_text);
476 kernel_code.end = virt_to_phys(&_etext - 1); 488 kernel_code.end = virt_to_phys(_etext - 1);
477 kernel_data.start = virt_to_phys(&__data_start); 489 kernel_data.start = virt_to_phys(_data);
478 kernel_data.end = virt_to_phys(&_end - 1); 490 kernel_data.end = virt_to_phys(_end - 1);
479 491
480 for (i = 0; i < mi->nr_banks; i++) { 492 for (i = 0; i < mi->nr_banks; i++) {
481 if (mi->bank[i].size == 0) 493 if (mi->bank[i].size == 0)
@@ -539,14 +551,7 @@ __tagtable(ATAG_CORE, parse_tag_core);
539 551
540static int __init parse_tag_mem32(const struct tag *tag) 552static int __init parse_tag_mem32(const struct tag *tag)
541{ 553{
542 if (meminfo.nr_banks >= NR_BANKS) { 554 return arm_add_memory(tag->u.mem.start, tag->u.mem.size);
543 printk(KERN_WARNING
544 "Ignoring memory bank 0x%08x size %dKB\n",
545 tag->u.mem.start, tag->u.mem.size / 1024);
546 return -EINVAL;
547 }
548 arm_add_memory(tag->u.mem.start, tag->u.mem.size);
549 return 0;
550} 555}
551 556
552__tagtable(ATAG_MEM, parse_tag_mem32); 557__tagtable(ATAG_MEM, parse_tag_mem32);
@@ -710,15 +715,15 @@ void __init setup_arch(char **cmdline_p)
710 parse_tags(tags); 715 parse_tags(tags);
711 } 716 }
712 717
713 init_mm.start_code = (unsigned long) &_text; 718 init_mm.start_code = (unsigned long) _text;
714 init_mm.end_code = (unsigned long) &_etext; 719 init_mm.end_code = (unsigned long) _etext;
715 init_mm.end_data = (unsigned long) &_edata; 720 init_mm.end_data = (unsigned long) _edata;
716 init_mm.brk = (unsigned long) &_end; 721 init_mm.brk = (unsigned long) _end;
717 722
718 memcpy(boot_command_line, from, COMMAND_LINE_SIZE); 723 memcpy(boot_command_line, from, COMMAND_LINE_SIZE);
719 boot_command_line[COMMAND_LINE_SIZE-1] = '\0'; 724 boot_command_line[COMMAND_LINE_SIZE-1] = '\0';
720 parse_cmdline(cmdline_p, from); 725 parse_cmdline(cmdline_p, from);
721 paging_init(&meminfo, mdesc); 726 paging_init(mdesc);
722 request_standard_resources(&meminfo, mdesc); 727 request_standard_resources(&meminfo, mdesc);
723 728
724#ifdef CONFIG_SMP 729#ifdef CONFIG_SMP
@@ -772,6 +777,8 @@ static const char *hwcap_str[] = {
772 "java", 777 "java",
773 "iwmmxt", 778 "iwmmxt",
774 "crunch", 779 "crunch",
780 "thumbee",
781 "neon",
775 NULL 782 NULL
776}; 783};
777 784
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index e42a749a56dd..55fa7ff96a3e 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -34,16 +34,6 @@
34#include <asm/ptrace.h> 34#include <asm/ptrace.h>
35 35
36/* 36/*
37 * bitmask of present and online CPUs.
38 * The present bitmask indicates that the CPU is physically present.
39 * The online bitmask indicates that the CPU is up and running.
40 */
41cpumask_t cpu_possible_map;
42EXPORT_SYMBOL(cpu_possible_map);
43cpumask_t cpu_online_map;
44EXPORT_SYMBOL(cpu_online_map);
45
46/*
47 * as from 2.5, kernels no longer have an init_tasks structure 37 * as from 2.5, kernels no longer have an init_tasks structure
48 * so we need some other way of telling a new secondary core 38 * so we need some other way of telling a new secondary core
49 * where to place its SVC stack 39 * where to place its SVC stack
@@ -181,7 +171,7 @@ int __cpuexit __cpu_disable(void)
181 /* 171 /*
182 * Stop the local timer for this CPU. 172 * Stop the local timer for this CPU.
183 */ 173 */
184 local_timer_stop(cpu); 174 local_timer_stop();
185 175
186 /* 176 /*
187 * Flush user cache and TLB mappings, and then remove this CPU 177 * Flush user cache and TLB mappings, and then remove this CPU
@@ -284,7 +274,7 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
284 /* 274 /*
285 * Setup local timer for this CPU. 275 * Setup local timer for this CPU.
286 */ 276 */
287 local_timer_setup(cpu); 277 local_timer_setup();
288 278
289 calibrate_delay(); 279 calibrate_delay();
290 280
diff --git a/arch/arm/kernel/thumbee.c b/arch/arm/kernel/thumbee.c
index df3f6b7ebcea..9cb7aaca159f 100644
--- a/arch/arm/kernel/thumbee.c
+++ b/arch/arm/kernel/thumbee.c
@@ -25,7 +25,7 @@
25/* 25/*
26 * Access to the ThumbEE Handler Base register 26 * Access to the ThumbEE Handler Base register
27 */ 27 */
28static inline unsigned long teehbr_read() 28static inline unsigned long teehbr_read(void)
29{ 29{
30 unsigned long v; 30 unsigned long v;
31 asm("mrc p14, 6, %0, c1, c0, 0\n" : "=r" (v)); 31 asm("mrc p14, 6, %0, c1, c0, 0\n" : "=r" (v));
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 4898bdcfe7dd..00216071eaf7 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -119,7 +119,7 @@ SECTIONS
119#endif 119#endif
120 120
121 .data : AT(__data_loc) { 121 .data : AT(__data_loc) {
122 __data_start = .; /* address in memory */ 122 _data = .; /* address in memory */
123 123
124 /* 124 /*
125 * first, the init task union, aligned 125 * first, the init task union, aligned
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 30351cd4560d..866f84a586ff 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -38,7 +38,6 @@ else
38endif 38endif
39 39
40lib-$(CONFIG_ARCH_RPC) += ecard.o io-acorn.o floppydma.o 40lib-$(CONFIG_ARCH_RPC) += ecard.o io-acorn.o floppydma.o
41lib-$(CONFIG_ARCH_CLPS7500) += io-acorn.o
42lib-$(CONFIG_ARCH_L7200) += io-acorn.o 41lib-$(CONFIG_ARCH_L7200) += io-acorn.o
43lib-$(CONFIG_ARCH_SHARK) += io-shark.o 42lib-$(CONFIG_ARCH_SHARK) += io-shark.o
44 43
diff --git a/arch/arm/lib/memset.S b/arch/arm/lib/memset.S
index 761eefa76243..650d5923ab83 100644
--- a/arch/arm/lib/memset.S
+++ b/arch/arm/lib/memset.S
@@ -25,7 +25,7 @@
25 add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3)) 25 add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3))
26/* 26/*
27 * The pointer is now aligned and the length is adjusted. Try doing the 27 * The pointer is now aligned and the length is adjusted. Try doing the
28 * memzero again. 28 * memset again.
29 */ 29 */
30 30
31ENTRY(memset) 31ENTRY(memset)
diff --git a/arch/arm/mach-aaec2000/Makefile b/arch/arm/mach-aaec2000/Makefile
index a8e462f58bc9..20ec83896c37 100644
--- a/arch/arm/mach-aaec2000/Makefile
+++ b/arch/arm/mach-aaec2000/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5# Common support (must be linked before board specific support) 5# Common support (must be linked before board specific support)
6obj-y += core.o clock.o 6obj-y += core.o
7 7
8# Specific board support 8# Specific board support
9obj-$(CONFIG_MACH_AAED2000) += aaed2000.o 9obj-$(CONFIG_MACH_AAED2000) += aaed2000.o
diff --git a/arch/arm/mach-aaec2000/clock.c b/arch/arm/mach-aaec2000/clock.c
deleted file mode 100644
index e10ee158d720..000000000000
--- a/arch/arm/mach-aaec2000/clock.c
+++ /dev/null
@@ -1,99 +0,0 @@
1/*
2 * linux/arch/arm/mach-aaec2000/clock.c
3 *
4 * Copyright (C) 2005 Nicolas Bellido Y Ortega
5 *
6 * Based on linux/arch/arm/mach-integrator/clock.c
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/list.h>
15#include <linux/errno.h>
16#include <linux/err.h>
17#include <linux/string.h>
18#include <linux/clk.h>
19#include <linux/mutex.h>
20
21#include "clock.h"
22
23static LIST_HEAD(clocks);
24static DEFINE_MUTEX(clocks_mutex);
25
26struct clk *clk_get(struct device *dev, const char *id)
27{
28 struct clk *p, *clk = ERR_PTR(-ENOENT);
29
30 mutex_lock(&clocks_mutex);
31 list_for_each_entry(p, &clocks, node) {
32 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
33 clk = p;
34 break;
35 }
36 }
37 mutex_unlock(&clocks_mutex);
38
39 return clk;
40}
41EXPORT_SYMBOL(clk_get);
42
43void clk_put(struct clk *clk)
44{
45 module_put(clk->owner);
46}
47EXPORT_SYMBOL(clk_put);
48
49int clk_enable(struct clk *clk)
50{
51 return 0;
52}
53EXPORT_SYMBOL(clk_enable);
54
55void clk_disable(struct clk *clk)
56{
57}
58EXPORT_SYMBOL(clk_disable);
59
60unsigned long clk_get_rate(struct clk *clk)
61{
62 return clk->rate;
63}
64EXPORT_SYMBOL(clk_get_rate);
65
66long clk_round_rate(struct clk *clk, unsigned long rate)
67{
68 return rate;
69}
70EXPORT_SYMBOL(clk_round_rate);
71
72int clk_set_rate(struct clk *clk, unsigned long rate)
73{
74 return 0;
75}
76EXPORT_SYMBOL(clk_set_rate);
77
78int clk_register(struct clk *clk)
79{
80 mutex_lock(&clocks_mutex);
81 list_add(&clk->node, &clocks);
82 mutex_unlock(&clocks_mutex);
83 return 0;
84}
85EXPORT_SYMBOL(clk_register);
86
87void clk_unregister(struct clk *clk)
88{
89 mutex_lock(&clocks_mutex);
90 list_del(&clk->node);
91 mutex_unlock(&clocks_mutex);
92}
93EXPORT_SYMBOL(clk_unregister);
94
95static int __init clk_init(void)
96{
97 return 0;
98}
99arch_initcall(clk_init);
diff --git a/arch/arm/mach-aaec2000/clock.h b/arch/arm/mach-aaec2000/clock.h
deleted file mode 100644
index d4bb74ff613f..000000000000
--- a/arch/arm/mach-aaec2000/clock.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * linux/arch/arm/mach-aaec2000/clock.h
3 *
4 * Copyright (C) 2005 Nicolas Bellido Y Ortega
5 *
6 * Based on linux/arch/arm/mach-integrator/clock.h
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 */
12struct module;
13
14struct clk {
15 struct list_head node;
16 unsigned long rate;
17 struct module *owner;
18 const char *name;
19 void *data;
20};
21
22int clk_register(struct clk *clk);
23void clk_unregister(struct clk *clk);
diff --git a/arch/arm/mach-aaec2000/core.c b/arch/arm/mach-aaec2000/core.c
index dfb26bc23d1a..b5c5fc6ba3a9 100644
--- a/arch/arm/mach-aaec2000/core.c
+++ b/arch/arm/mach-aaec2000/core.c
@@ -19,6 +19,7 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/timex.h> 20#include <linux/timex.h>
21#include <linux/signal.h> 21#include <linux/signal.h>
22#include <linux/clk.h>
22 23
23#include <mach/hardware.h> 24#include <mach/hardware.h>
24#include <asm/irq.h> 25#include <asm/irq.h>
@@ -30,7 +31,6 @@
30#include <asm/mach/map.h> 31#include <asm/mach/map.h>
31 32
32#include "core.h" 33#include "core.h"
33#include "clock.h"
34 34
35/* 35/*
36 * Common I/O mapping: 36 * Common I/O mapping:
@@ -212,7 +212,7 @@ static struct clcd_board clcd_plat_data = {
212 212
213static struct amba_device clcd_device = { 213static struct amba_device clcd_device = {
214 .dev = { 214 .dev = {
215 .bus_id = "mb:16", 215 .init_name = "mb:16",
216 .coherent_dma_mask = ~0, 216 .coherent_dma_mask = ~0,
217 .platform_data = &clcd_plat_data, 217 .platform_data = &clcd_plat_data,
218 }, 218 },
@@ -229,9 +229,28 @@ static struct amba_device *amba_devs[] __initdata = {
229 &clcd_device, 229 &clcd_device,
230}; 230};
231 231
232static struct clk aaec2000_clcd_clk = { 232void clk_disable(struct clk *clk)
233 .name = "CLCDCLK", 233{
234}; 234}
235
236int clk_set_rate(struct clk *clk, unsigned long rate)
237{
238 return 0;
239}
240
241int clk_enable(struct clk *clk)
242{
243 return 0;
244}
245
246struct clk *clk_get(struct device *dev, const char *id)
247{
248 return dev && strcmp(dev_name(dev), "mb:16") == 0 ? NULL : ERR_PTR(-ENOENT);
249}
250
251void clk_put(struct clk *clk)
252{
253}
235 254
236void __init aaec2000_set_clcd_plat_data(struct aaec2000_clcd_info *clcd) 255void __init aaec2000_set_clcd_plat_data(struct aaec2000_clcd_info *clcd)
237{ 256{
@@ -265,8 +284,6 @@ static int __init aaec2000_init(void)
265{ 284{
266 int i; 285 int i;
267 286
268 clk_register(&aaec2000_clcd_clk);
269
270 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 287 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
271 struct amba_device *d = amba_devs[i]; 288 struct amba_device *d = amba_devs[i];
272 amba_device_register(d, &iomem_resource); 289 amba_device_register(d, &iomem_resource);
diff --git a/arch/arm/mach-aaec2000/include/mach/dma.h b/arch/arm/mach-aaec2000/include/mach/dma.h
deleted file mode 100644
index 2da846c72fe7..000000000000
--- a/arch/arm/mach-aaec2000/include/mach/dma.h
+++ /dev/null
@@ -1,9 +0,0 @@
1/*
2 * arch/arm/mach-aaec2000/include/mach/dma.h
3 *
4 * Copyright (c) 2005 Nicolas Bellido Y Ortega
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 */
diff --git a/arch/arm/mach-aaec2000/include/mach/io.h b/arch/arm/mach-aaec2000/include/mach/io.h
index c87c24de1110..ab4fe5d20eaf 100644
--- a/arch/arm/mach-aaec2000/include/mach/io.h
+++ b/arch/arm/mach-aaec2000/include/mach/io.h
@@ -6,15 +6,13 @@
6#ifndef __ASM_ARM_ARCH_IO_H 6#ifndef __ASM_ARM_ARCH_IO_H
7#define __ASM_ARM_ARCH_IO_H 7#define __ASM_ARM_ARCH_IO_H
8 8
9#include <mach/hardware.h>
10
11#define IO_SPACE_LIMIT 0xffffffff 9#define IO_SPACE_LIMIT 0xffffffff
12 10
13/* 11/*
14 * We don't actually have real ISA nor PCI buses, but there is so many 12 * We don't actually have real ISA nor PCI buses, but there is so many
15 * drivers out there that might just work if we fake them... 13 * drivers out there that might just work if we fake them...
16 */ 14 */
17#define __io(a) ((void __iomem *)(a)) 15#define __io(a) __typesafe_io(a)
18#define __mem_pci(a) (a) 16#define __mem_pci(a) (a)
19 17
20#endif 18#endif
diff --git a/arch/arm/mach-aaec2000/include/mach/memory.h b/arch/arm/mach-aaec2000/include/mach/memory.h
index 56ae900a482e..c00822543d9f 100644
--- a/arch/arm/mach-aaec2000/include/mach/memory.h
+++ b/arch/arm/mach-aaec2000/include/mach/memory.h
@@ -14,9 +14,6 @@
14 14
15#define PHYS_OFFSET UL(0xf0000000) 15#define PHYS_OFFSET UL(0xf0000000)
16 16
17#define __virt_to_bus(x) __virt_to_phys(x)
18#define __bus_to_virt(x) __phys_to_virt(x)
19
20/* 17/*
21 * The nodes are the followings: 18 * The nodes are the followings:
22 * 19 *
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 5aafb2e2ca7a..323b47f2b52f 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -7,36 +7,43 @@ choice
7 7
8config ARCH_AT91RM9200 8config ARCH_AT91RM9200
9 bool "AT91RM9200" 9 bool "AT91RM9200"
10 select CPU_ARM920T
10 select GENERIC_TIME 11 select GENERIC_TIME
11 select GENERIC_CLOCKEVENTS 12 select GENERIC_CLOCKEVENTS
12 13
13config ARCH_AT91SAM9260 14config ARCH_AT91SAM9260
14 bool "AT91SAM9260 or AT91SAM9XE" 15 bool "AT91SAM9260 or AT91SAM9XE"
16 select CPU_ARM926T
15 select GENERIC_TIME 17 select GENERIC_TIME
16 select GENERIC_CLOCKEVENTS 18 select GENERIC_CLOCKEVENTS
17 19
18config ARCH_AT91SAM9261 20config ARCH_AT91SAM9261
19 bool "AT91SAM9261" 21 bool "AT91SAM9261"
22 select CPU_ARM926T
20 select GENERIC_TIME 23 select GENERIC_TIME
21 select GENERIC_CLOCKEVENTS 24 select GENERIC_CLOCKEVENTS
22 25
23config ARCH_AT91SAM9263 26config ARCH_AT91SAM9263
24 bool "AT91SAM9263" 27 bool "AT91SAM9263"
28 select CPU_ARM926T
25 select GENERIC_TIME 29 select GENERIC_TIME
26 select GENERIC_CLOCKEVENTS 30 select GENERIC_CLOCKEVENTS
27 31
28config ARCH_AT91SAM9RL 32config ARCH_AT91SAM9RL
29 bool "AT91SAM9RL" 33 bool "AT91SAM9RL"
34 select CPU_ARM926T
30 select GENERIC_TIME 35 select GENERIC_TIME
31 select GENERIC_CLOCKEVENTS 36 select GENERIC_CLOCKEVENTS
32 37
33config ARCH_AT91SAM9G20 38config ARCH_AT91SAM9G20
34 bool "AT91SAM9G20" 39 bool "AT91SAM9G20"
40 select CPU_ARM926T
35 select GENERIC_TIME 41 select GENERIC_TIME
36 select GENERIC_CLOCKEVENTS 42 select GENERIC_CLOCKEVENTS
37 43
38config ARCH_AT91CAP9 44config ARCH_AT91CAP9
39 bool "AT91CAP9" 45 bool "AT91CAP9"
46 select CPU_ARM926T
40 select GENERIC_TIME 47 select GENERIC_TIME
41 select GENERIC_CLOCKEVENTS 48 select GENERIC_CLOCKEVENTS
42 49
@@ -235,6 +242,12 @@ config MACH_USB_A9263
235 Select this if you are using a Calao Systems USB-A9263. 242 Select this if you are using a Calao Systems USB-A9263.
236 <http://www.calao-systems.com> 243 <http://www.calao-systems.com>
237 244
245config MACH_NEOCORE926
246 bool "Adeneo NEOCORE926"
247 depends on ARCH_AT91SAM9263
248 help
249 Select this if you are using the Adeneo Neocore 926 board.
250
238endif 251endif
239 252
240# ---------------------------------------------------------- 253# ----------------------------------------------------------
@@ -302,7 +315,7 @@ comment "AT91 Board Options"
302 315
303config MTD_AT91_DATAFLASH_CARD 316config MTD_AT91_DATAFLASH_CARD
304 bool "Enable DataFlash Card support" 317 bool "Enable DataFlash Card support"
305 depends on (ARCH_AT91RM9200DK || MACH_AT91RM9200EK || MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_AT91SAM9G20EK || MACH_ECBAT91 || MACH_SAM9_L9260 || MACH_AT91CAP9ADK) 318 depends on (ARCH_AT91RM9200DK || MACH_AT91RM9200EK || MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_AT91SAM9G20EK || MACH_ECBAT91 || MACH_SAM9_L9260 || MACH_AT91CAP9ADK || MACH_NEOCORE926)
306 help 319 help
307 Enable support for the DataFlash card. 320 Enable support for the DataFlash card.
308 321
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index cca612d97ca2..c69ff237fd14 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -11,12 +11,12 @@ obj-$(CONFIG_AT91_PMC_UNIT) += clock.o
11 11
12# CPU-specific support 12# CPU-specific support
13obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200.o at91rm9200_time.o at91rm9200_devices.o 13obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200.o at91rm9200_time.o at91rm9200_devices.o
14obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o 14obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o sam9_smc.o
15obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261.o at91sam926x_time.o at91sam9261_devices.o 15obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261.o at91sam926x_time.o at91sam9261_devices.o sam9_smc.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 sam9_smc.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 sam9_smc.o
18obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o 18obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o sam9_smc.o
19obj-$(CONFIG_ARCH_AT91CAP9) += at91cap9.o at91sam926x_time.o at91cap9_devices.o 19obj-$(CONFIG_ARCH_AT91CAP9) += at91cap9.o at91sam926x_time.o at91cap9_devices.o sam9_smc.o
20obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o 20obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o
21 21
22# AT91RM9200 board-specific support 22# AT91RM9200 board-specific support
@@ -47,6 +47,7 @@ obj-$(CONFIG_MACH_AT91SAM9261EK) += board-sam9261ek.o
47# AT91SAM9263 board-specific support 47# AT91SAM9263 board-specific support
48obj-$(CONFIG_MACH_AT91SAM9263EK) += board-sam9263ek.o 48obj-$(CONFIG_MACH_AT91SAM9263EK) += board-sam9263ek.o
49obj-$(CONFIG_MACH_USB_A9263) += board-usb-a9263.o 49obj-$(CONFIG_MACH_USB_A9263) += board-usb-a9263.o
50obj-$(CONFIG_MACH_NEOCORE926) += board-neocore926.o
50 51
51# AT91SAM9RL board-specific support 52# AT91SAM9RL board-specific support
52obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o 53obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o
diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c
index 0fc0adaebd58..0a38c69fdbc4 100644
--- a/arch/arm/mach-at91/at91cap9.c
+++ b/arch/arm/mach-at91/at91cap9.c
@@ -17,6 +17,8 @@
17 17
18#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
19#include <asm/mach/map.h> 19#include <asm/mach/map.h>
20
21#include <mach/cpu.h>
20#include <mach/at91cap9.h> 22#include <mach/at91cap9.h>
21#include <mach/at91_pmc.h> 23#include <mach/at91_pmc.h>
22#include <mach/at91_rstc.h> 24#include <mach/at91_rstc.h>
@@ -317,6 +319,12 @@ void __init at91cap9_initialize(unsigned long main_clock)
317 319
318 /* Register GPIO subsystem */ 320 /* Register GPIO subsystem */
319 at91_gpio_init(at91cap9_gpio, 4); 321 at91_gpio_init(at91cap9_gpio, 4);
322
323 /* Remember the silicon revision */
324 if (cpu_is_at91cap9_revB())
325 system_rev = 0xB;
326 else if (cpu_is_at91cap9_revC())
327 system_rev = 0xC;
320} 328}
321 329
322/* -------------------------------------------------------------------- 330/* --------------------------------------------------------------------
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c
index 5ebd4273d353..9eca2209cde6 100644
--- a/arch/arm/mach-at91/at91cap9_devices.c
+++ b/arch/arm/mach-at91/at91cap9_devices.c
@@ -13,6 +13,7 @@
13 */ 13 */
14#include <asm/mach/arch.h> 14#include <asm/mach/arch.h>
15#include <asm/mach/map.h> 15#include <asm/mach/map.h>
16#include <asm/mach/irq.h>
16 17
17#include <linux/dma-mapping.h> 18#include <linux/dma-mapping.h>
18#include <linux/platform_device.h> 19#include <linux/platform_device.h>
@@ -21,6 +22,7 @@
21#include <video/atmel_lcdc.h> 22#include <video/atmel_lcdc.h>
22 23
23#include <mach/board.h> 24#include <mach/board.h>
25#include <mach/cpu.h>
24#include <mach/gpio.h> 26#include <mach/gpio.h>
25#include <mach/at91cap9.h> 27#include <mach/at91cap9.h>
26#include <mach/at91cap9_matrix.h> 28#include <mach/at91cap9_matrix.h>
@@ -69,6 +71,9 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data)
69 if (!data) 71 if (!data)
70 return; 72 return;
71 73
74 if (cpu_is_at91cap9_revB())
75 set_irq_type(AT91CAP9_ID_UHP, IRQ_TYPE_LEVEL_HIGH);
76
72 /* Enable VBus control for UHP ports */ 77 /* Enable VBus control for UHP ports */
73 for (i = 0; i < data->ports; i++) { 78 for (i = 0; i < data->ports; i++) {
74 if (data->vbus_pin[i]) 79 if (data->vbus_pin[i])
@@ -151,8 +156,13 @@ static struct platform_device at91_usba_udc_device = {
151 156
152void __init at91_add_device_usba(struct usba_platform_data *data) 157void __init at91_add_device_usba(struct usba_platform_data *data)
153{ 158{
154 at91_sys_write(AT91_MATRIX_UDPHS, AT91_MATRIX_SELECT_UDPHS | 159 if (cpu_is_at91cap9_revB()) {
155 AT91_MATRIX_UDPHS_BYPASS_LOCK); 160 set_irq_type(AT91CAP9_ID_UDPHS, IRQ_TYPE_LEVEL_HIGH);
161 at91_sys_write(AT91_MATRIX_UDPHS, AT91_MATRIX_SELECT_UDPHS |
162 AT91_MATRIX_UDPHS_BYPASS_LOCK);
163 }
164 else
165 at91_sys_write(AT91_MATRIX_UDPHS, AT91_MATRIX_SELECT_UDPHS);
156 166
157 /* 167 /*
158 * Invalid pins are 0 on AT91, but the usba driver is shared 168 * Invalid pins are 0 on AT91, but the usba driver is shared
@@ -406,28 +416,13 @@ static struct platform_device at91cap9_nand_device = {
406 416
407void __init at91_add_device_nand(struct atmel_nand_data *data) 417void __init at91_add_device_nand(struct atmel_nand_data *data)
408{ 418{
409 unsigned long csa, mode; 419 unsigned long csa;
410 420
411 if (!data) 421 if (!data)
412 return; 422 return;
413 423
414 csa = at91_sys_read(AT91_MATRIX_EBICSA); 424 csa = at91_sys_read(AT91_MATRIX_EBICSA);
415 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA | AT91_MATRIX_EBI_VDDIOMSEL_3_3V); 425 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA);
416
417 /* set the bus interface characteristics */
418 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(2) | AT91_SMC_NCS_WRSETUP_(1)
419 | AT91_SMC_NRDSETUP_(2) | AT91_SMC_NCS_RDSETUP_(1));
420
421 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(4) | AT91_SMC_NCS_WRPULSE_(6)
422 | AT91_SMC_NRDPULSE_(4) | AT91_SMC_NCS_RDPULSE_(6));
423
424 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(8) | AT91_SMC_NRDCYCLE_(8));
425
426 if (data->bus_width_16)
427 mode = AT91_SMC_DBW_16;
428 else
429 mode = AT91_SMC_DBW_8;
430 at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(1));
431 426
432 /* enable pin */ 427 /* enable pin */
433 if (data->enable_pin) 428 if (data->enable_pin)
@@ -865,6 +860,9 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
865 if (!data) 860 if (!data)
866 return; 861 return;
867 862
863 if (cpu_is_at91cap9_revB())
864 set_irq_type(AT91CAP9_ID_LCDC, IRQ_TYPE_LEVEL_HIGH);
865
868 at91_set_A_periph(AT91_PIN_PC1, 0); /* LCDHSYNC */ 866 at91_set_A_periph(AT91_PIN_PC1, 0); /* LCDHSYNC */
869 at91_set_A_periph(AT91_PIN_PC2, 0); /* LCDDOTCK */ 867 at91_set_A_periph(AT91_PIN_PC2, 0); /* LCDDOTCK */
870 at91_set_A_periph(AT91_PIN_PC3, 0); /* LCDDEN */ 868 at91_set_A_periph(AT91_PIN_PC3, 0); /* LCDDEN */
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c
index a72e798a2a40..1ff1bda0a894 100644
--- a/arch/arm/mach-at91/at91rm9200_time.c
+++ b/arch/arm/mach-at91/at91rm9200_time.c
@@ -141,6 +141,15 @@ clkevt32k_next_event(unsigned long delta, struct clock_event_device *dev)
141 /* Use "raw" primitives so we behave correctly on RT kernels. */ 141 /* Use "raw" primitives so we behave correctly on RT kernels. */
142 raw_local_irq_save(flags); 142 raw_local_irq_save(flags);
143 143
144 /*
145 * According to Thomas Gleixner irqs are already disabled here. Simply
146 * removing raw_local_irq_save above (and the matching
147 * raw_local_irq_restore) was not accepted. See
148 * http://thread.gmane.org/gmane.linux.ports.arm.kernel/41174
149 * So for now (2008-11-20) just warn once if irqs were not disabled ...
150 */
151 WARN_ON_ONCE(!raw_irqs_disabled_flags(flags));
152
144 /* The alarm IRQ uses absolute time (now+delta), not the relative 153 /* The alarm IRQ uses absolute time (now+delta), not the relative
145 * time (delta) in our calling convention. Like all clockevents 154 * time (delta) in our calling convention. Like all clockevents
146 * using such "match" hardware, we have a race to defend against. 155 * using such "match" hardware, we have a race to defend against.
@@ -169,7 +178,6 @@ static struct clock_event_device clkevt = {
169 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 178 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
170 .shift = 32, 179 .shift = 32,
171 .rating = 150, 180 .rating = 150,
172 .cpumask = CPU_MASK_CPU0,
173 .set_next_event = clkevt32k_next_event, 181 .set_next_event = clkevt32k_next_event,
174 .set_mode = clkevt32k_mode, 182 .set_mode = clkevt32k_mode,
175}; 183};
@@ -197,7 +205,7 @@ void __init at91rm9200_timer_init(void)
197 clkevt.mult = div_sc(AT91_SLOW_CLOCK, NSEC_PER_SEC, clkevt.shift); 205 clkevt.mult = div_sc(AT91_SLOW_CLOCK, NSEC_PER_SEC, clkevt.shift);
198 clkevt.max_delta_ns = clockevent_delta2ns(AT91_ST_ALMV, &clkevt); 206 clkevt.max_delta_ns = clockevent_delta2ns(AT91_ST_ALMV, &clkevt);
199 clkevt.min_delta_ns = clockevent_delta2ns(2, &clkevt) + 1; 207 clkevt.min_delta_ns = clockevent_delta2ns(2, &clkevt) + 1;
200 clkevt.cpumask = cpumask_of_cpu(0); 208 clkevt.cpumask = cpumask_of(0);
201 clockevents_register_device(&clkevt); 209 clockevents_register_device(&clkevt);
202 210
203 /* register clocksource */ 211 /* register clocksource */
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 7774d17dde74..fdde1ea21b07 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -313,7 +313,7 @@ static struct platform_device at91sam9260_nand_device = {
313 313
314void __init at91_add_device_nand(struct atmel_nand_data *data) 314void __init at91_add_device_nand(struct atmel_nand_data *data)
315{ 315{
316 unsigned long csa, mode; 316 unsigned long csa;
317 317
318 if (!data) 318 if (!data)
319 return; 319 return;
@@ -321,42 +321,6 @@ void __init at91_add_device_nand(struct atmel_nand_data *data)
321 csa = at91_sys_read(AT91_MATRIX_EBICSA); 321 csa = at91_sys_read(AT91_MATRIX_EBICSA);
322 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);
323 323
324 if (cpu_is_at91sam9260()) {
325 /* Timing for sam9260 */
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));
329
330 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3)
331 | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
332
333 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
334
335 if (data->bus_width_16)
336 mode = AT91_SMC_DBW_16;
337 else
338 mode = AT91_SMC_DBW_8;
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 }
359
360 /* enable pin */ 324 /* enable pin */
361 if (data->enable_pin) 325 if (data->enable_pin)
362 at91_set_gpio_output(data->enable_pin, 1); 326 at91_set_gpio_output(data->enable_pin, 1);
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 6b89172310c7..17289756f80f 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -223,7 +223,7 @@ static struct platform_device atmel_nand_device = {
223 223
224void __init at91_add_device_nand(struct atmel_nand_data *data) 224void __init at91_add_device_nand(struct atmel_nand_data *data)
225{ 225{
226 unsigned long csa, mode; 226 unsigned long csa;
227 227
228 if (!data) 228 if (!data)
229 return; 229 return;
@@ -231,21 +231,6 @@ void __init at91_add_device_nand(struct atmel_nand_data *data)
231 csa = at91_sys_read(AT91_MATRIX_EBICSA); 231 csa = at91_sys_read(AT91_MATRIX_EBICSA);
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 */
235 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0)
236 | AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
237
238 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3)
239 | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
240
241 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
242
243 if (data->bus_width_16)
244 mode = AT91_SMC_DBW_16;
245 else
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_(2));
248
249 /* enable pin */ 234 /* enable pin */
250 if (data->enable_pin) 235 if (data->enable_pin)
251 at91_set_gpio_output(data->enable_pin, 1); 236 at91_set_gpio_output(data->enable_pin, 1);
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 8b884083f76d..b753cb879d8e 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -382,7 +382,7 @@ static struct platform_device at91sam9263_nand_device = {
382 382
383void __init at91_add_device_nand(struct atmel_nand_data *data) 383void __init at91_add_device_nand(struct atmel_nand_data *data)
384{ 384{
385 unsigned long csa, mode; 385 unsigned long csa;
386 386
387 if (!data) 387 if (!data)
388 return; 388 return;
@@ -390,21 +390,6 @@ void __init at91_add_device_nand(struct atmel_nand_data *data)
390 csa = at91_sys_read(AT91_MATRIX_EBI0CSA); 390 csa = at91_sys_read(AT91_MATRIX_EBI0CSA);
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 */
394 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0)
395 | AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
396
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));
399
400 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
401
402 if (data->bus_width_16)
403 mode = AT91_SMC_DBW_16;
404 else
405 mode = AT91_SMC_DBW_8;
406 at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(2));
407
408 /* enable pin */ 393 /* enable pin */
409 if (data->enable_pin) 394 if (data->enable_pin)
410 at91_set_gpio_output(data->enable_pin, 1); 395 at91_set_gpio_output(data->enable_pin, 1);
diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c
index 122fd77ed580..b63e1d5f1bad 100644
--- a/arch/arm/mach-at91/at91sam926x_time.c
+++ b/arch/arm/mach-at91/at91sam926x_time.c
@@ -91,7 +91,6 @@ static struct clock_event_device pit_clkevt = {
91 .features = CLOCK_EVT_FEAT_PERIODIC, 91 .features = CLOCK_EVT_FEAT_PERIODIC,
92 .shift = 32, 92 .shift = 32,
93 .rating = 100, 93 .rating = 100,
94 .cpumask = CPU_MASK_CPU0,
95 .set_mode = pit_clkevt_mode, 94 .set_mode = pit_clkevt_mode,
96}; 95};
97 96
@@ -173,6 +172,7 @@ static void __init at91sam926x_pit_init(void)
173 172
174 /* Set up and register clockevents */ 173 /* Set up and register clockevents */
175 pit_clkevt.mult = div_sc(pit_rate, NSEC_PER_SEC, pit_clkevt.shift); 174 pit_clkevt.mult = div_sc(pit_rate, NSEC_PER_SEC, pit_clkevt.shift);
175 pit_clkevt.cpumask = cpumask_of(0);
176 clockevents_register_device(&pit_clkevt); 176 clockevents_register_device(&pit_clkevt);
177} 177}
178 178
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 87deb1e1b529..145324f4ec56 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -232,17 +232,6 @@ void __init at91_add_device_nand(struct atmel_nand_data *data)
232 csa = at91_sys_read(AT91_MATRIX_EBICSA); 232 csa = at91_sys_read(AT91_MATRIX_EBICSA);
233 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);
234 234
235 /* set the bus interface characteristics */
236 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0)
237 | AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
238
239 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3)
240 | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
241
242 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
243
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));
245
246 /* enable pin */ 235 /* enable pin */
247 if (data->enable_pin) 236 if (data->enable_pin)
248 at91_set_gpio_output(data->enable_pin, 1); 237 at91_set_gpio_output(data->enable_pin, 1);
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c
index cdddca54b938..d3ba29c5d8c8 100644
--- a/arch/arm/mach-at91/board-cam60.c
+++ b/arch/arm/mach-at91/board-cam60.c
@@ -39,7 +39,9 @@
39 39
40#include <mach/board.h> 40#include <mach/board.h>
41#include <mach/gpio.h> 41#include <mach/gpio.h>
42#include <mach/at91sam9_smc.h>
42 43
44#include "sam9_smc.h"
43#include "generic.h" 45#include "generic.h"
44 46
45 47
@@ -151,6 +153,32 @@ static struct atmel_nand_data __initdata cam60_nand_data = {
151 .partition_info = nand_partitions, 153 .partition_info = nand_partitions,
152}; 154};
153 155
156static struct sam9_smc_config __initdata cam60_nand_smc_config = {
157 .ncs_read_setup = 0,
158 .nrd_setup = 1,
159 .ncs_write_setup = 0,
160 .nwe_setup = 1,
161
162 .ncs_read_pulse = 3,
163 .nrd_pulse = 3,
164 .ncs_write_pulse = 3,
165 .nwe_pulse = 3,
166
167 .read_cycle = 5,
168 .write_cycle = 5,
169
170 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
171 .tdf_cycles = 2,
172};
173
174static void __init cam60_add_device_nand(void)
175{
176 /* configure chip-select 3 (NAND) */
177 sam9_smc_configure(3, &cam60_nand_smc_config);
178
179 at91_add_device_nand(&cam60_nand_data);
180}
181
154 182
155static void __init cam60_board_init(void) 183static void __init cam60_board_init(void)
156{ 184{
@@ -165,7 +193,7 @@ static void __init cam60_board_init(void)
165 at91_set_gpio_output(AT91_PIN_PB18, 1); 193 at91_set_gpio_output(AT91_PIN_PB18, 1);
166 at91_add_device_usbh(&cam60_usbh_data); 194 at91_add_device_usbh(&cam60_usbh_data);
167 /* NAND */ 195 /* NAND */
168 at91_add_device_nand(&cam60_nand_data); 196 cam60_add_device_nand();
169} 197}
170 198
171MACHINE_START(CAM60, "KwikByte CAM60") 199MACHINE_START(CAM60, "KwikByte CAM60")
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c
index 201b89392dcc..83a1a0fef47b 100644
--- a/arch/arm/mach-at91/board-cap9adk.c
+++ b/arch/arm/mach-at91/board-cap9adk.c
@@ -36,17 +36,16 @@
36#include <mach/hardware.h> 36#include <mach/hardware.h>
37#include <asm/setup.h> 37#include <asm/setup.h>
38#include <asm/mach-types.h> 38#include <asm/mach-types.h>
39#include <asm/irq.h>
40 39
41#include <asm/mach/arch.h> 40#include <asm/mach/arch.h>
42#include <asm/mach/map.h> 41#include <asm/mach/map.h>
43#include <asm/mach/irq.h>
44 42
45#include <mach/board.h> 43#include <mach/board.h>
46#include <mach/gpio.h> 44#include <mach/gpio.h>
47#include <mach/at91cap9_matrix.h> 45#include <mach/at91cap9_matrix.h>
48#include <mach/at91sam9_smc.h> 46#include <mach/at91sam9_smc.h>
49 47
48#include "sam9_smc.h"
50#include "generic.h" 49#include "generic.h"
51 50
52 51
@@ -195,6 +194,43 @@ static struct atmel_nand_data __initdata cap9adk_nand_data = {
195#endif 194#endif
196}; 195};
197 196
197static struct sam9_smc_config __initdata cap9adk_nand_smc_config = {
198 .ncs_read_setup = 1,
199 .nrd_setup = 2,
200 .ncs_write_setup = 1,
201 .nwe_setup = 2,
202
203 .ncs_read_pulse = 6,
204 .nrd_pulse = 4,
205 .ncs_write_pulse = 6,
206 .nwe_pulse = 4,
207
208 .read_cycle = 8,
209 .write_cycle = 8,
210
211 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
212 .tdf_cycles = 1,
213};
214
215static void __init cap9adk_add_device_nand(void)
216{
217 unsigned long csa;
218
219 csa = at91_sys_read(AT91_MATRIX_EBICSA);
220 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V);
221
222 /* setup bus-width (8 or 16) */
223 if (cap9adk_nand_data.bus_width_16)
224 cap9adk_nand_smc_config.mode |= AT91_SMC_DBW_16;
225 else
226 cap9adk_nand_smc_config.mode |= AT91_SMC_DBW_8;
227
228 /* configure chip-select 3 (NAND) */
229 sam9_smc_configure(3, &cap9adk_nand_smc_config);
230
231 at91_add_device_nand(&cap9adk_nand_data);
232}
233
198 234
199/* 235/*
200 * NOR flash 236 * NOR flash
@@ -234,6 +270,24 @@ static struct platform_device cap9adk_nor_flash = {
234 .num_resources = ARRAY_SIZE(nor_flash_resources), 270 .num_resources = ARRAY_SIZE(nor_flash_resources),
235}; 271};
236 272
273static struct sam9_smc_config __initdata cap9adk_nor_smc_config = {
274 .ncs_read_setup = 2,
275 .nrd_setup = 4,
276 .ncs_write_setup = 2,
277 .nwe_setup = 4,
278
279 .ncs_read_pulse = 10,
280 .nrd_pulse = 8,
281 .ncs_write_pulse = 10,
282 .nwe_pulse = 8,
283
284 .read_cycle = 16,
285 .write_cycle = 16,
286
287 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE | AT91_SMC_DBW_16,
288 .tdf_cycles = 1,
289};
290
237static __init void cap9adk_add_device_nor(void) 291static __init void cap9adk_add_device_nor(void)
238{ 292{
239 unsigned long csa; 293 unsigned long csa;
@@ -241,18 +295,8 @@ static __init void cap9adk_add_device_nor(void)
241 csa = at91_sys_read(AT91_MATRIX_EBICSA); 295 csa = at91_sys_read(AT91_MATRIX_EBICSA);
242 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V); 296 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V);
243 297
244 /* set the bus interface characteristics */ 298 /* configure chip-select 0 (NOR) */
245 at91_sys_write(AT91_SMC_SETUP(0), AT91_SMC_NWESETUP_(4) | AT91_SMC_NCS_WRSETUP_(2) 299 sam9_smc_configure(0, &cap9adk_nor_smc_config);
246 | AT91_SMC_NRDSETUP_(4) | AT91_SMC_NCS_RDSETUP_(2));
247
248 at91_sys_write(AT91_SMC_PULSE(0), AT91_SMC_NWEPULSE_(8) | AT91_SMC_NCS_WRPULSE_(10)
249 | AT91_SMC_NRDPULSE_(8) | AT91_SMC_NCS_RDPULSE_(10));
250
251 at91_sys_write(AT91_SMC_CYCLE(0), AT91_SMC_NWECYCLE_(16) | AT91_SMC_NRDCYCLE_(16));
252
253 at91_sys_write(AT91_SMC_MODE(0), AT91_SMC_READMODE | AT91_SMC_WRITEMODE
254 | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE
255 | AT91_SMC_DBW_16 | AT91_SMC_TDF_(1));
256 300
257 platform_device_register(&cap9adk_nor_flash); 301 platform_device_register(&cap9adk_nor_flash);
258} 302}
@@ -330,10 +374,8 @@ static void __init cap9adk_board_init(void)
330 /* Serial */ 374 /* Serial */
331 at91_add_device_serial(); 375 at91_add_device_serial();
332 /* USB Host */ 376 /* USB Host */
333 set_irq_type(AT91CAP9_ID_UHP, IRQ_TYPE_LEVEL_HIGH);
334 at91_add_device_usbh(&cap9adk_usbh_data); 377 at91_add_device_usbh(&cap9adk_usbh_data);
335 /* USB HS */ 378 /* USB HS */
336 set_irq_type(AT91CAP9_ID_UDPHS, IRQ_TYPE_LEVEL_HIGH);
337 at91_add_device_usba(&cap9adk_usba_udc_data); 379 at91_add_device_usba(&cap9adk_usba_udc_data);
338 /* SPI */ 380 /* SPI */
339 at91_add_device_spi(cap9adk_spi_devices, ARRAY_SIZE(cap9adk_spi_devices)); 381 at91_add_device_spi(cap9adk_spi_devices, ARRAY_SIZE(cap9adk_spi_devices));
@@ -344,13 +386,12 @@ static void __init cap9adk_board_init(void)
344 /* Ethernet */ 386 /* Ethernet */
345 at91_add_device_eth(&cap9adk_macb_data); 387 at91_add_device_eth(&cap9adk_macb_data);
346 /* NAND */ 388 /* NAND */
347 at91_add_device_nand(&cap9adk_nand_data); 389 cap9adk_add_device_nand();
348 /* NOR Flash */ 390 /* NOR Flash */
349 cap9adk_add_device_nor(); 391 cap9adk_add_device_nor();
350 /* I2C */ 392 /* I2C */
351 at91_add_device_i2c(NULL, 0); 393 at91_add_device_i2c(NULL, 0);
352 /* LCD Controller */ 394 /* LCD Controller */
353 set_irq_type(AT91CAP9_ID_LCDC, IRQ_TYPE_LEVEL_HIGH);
354 at91_add_device_lcdc(&cap9adk_lcdc_data); 395 at91_add_device_lcdc(&cap9adk_lcdc_data);
355 /* AC97 */ 396 /* AC97 */
356 at91_add_device_ac97(&cap9adk_ac97_data); 397 at91_add_device_ac97(&cap9adk_ac97_data);
diff --git a/arch/arm/mach-at91/board-neocore926.c b/arch/arm/mach-at91/board-neocore926.c
new file mode 100644
index 000000000000..9ba7ba2cc3b1
--- /dev/null
+++ b/arch/arm/mach-at91/board-neocore926.c
@@ -0,0 +1,397 @@
1/*
2 * linux/arch/arm/mach-at91/board-neocore926.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2007 Atmel Corporation
6 * Copyright (C) 2008 ADENEO.
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/spi/ads7846.h>
30#include <linux/fb.h>
31#include <linux/gpio_keys.h>
32#include <linux/input.h>
33
34#include <video/atmel_lcdc.h>
35
36#include <asm/setup.h>
37#include <asm/mach-types.h>
38#include <asm/irq.h>
39#include <asm/sizes.h>
40
41#include <asm/mach/arch.h>
42#include <asm/mach/map.h>
43#include <asm/mach/irq.h>
44
45#include <mach/hardware.h>
46#include <mach/board.h>
47#include <mach/gpio.h>
48#include <mach/at91sam9_smc.h>
49
50#include "sam9_smc.h"
51#include "generic.h"
52
53
54static void __init neocore926_map_io(void)
55{
56 /* Initialize processor: 20 MHz crystal */
57 at91sam9263_initialize(20000000);
58
59 /* DGBU on ttyS0. (Rx & Tx only) */
60 at91_register_uart(0, 0, 0);
61
62 /* USART0 on ttyS1. (Rx, Tx, RTS, CTS) */
63 at91_register_uart(AT91SAM9263_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS);
64
65 /* set serial console to ttyS0 (ie, DBGU) */
66 at91_set_serial_console(0);
67}
68
69static void __init neocore926_init_irq(void)
70{
71 at91sam9263_init_interrupts(NULL);
72}
73
74
75/*
76 * USB Host port
77 */
78static struct at91_usbh_data __initdata neocore926_usbh_data = {
79 .ports = 2,
80 .vbus_pin = { AT91_PIN_PA24, AT91_PIN_PA21 },
81};
82
83/*
84 * USB Device port
85 */
86static struct at91_udc_data __initdata neocore926_udc_data = {
87 .vbus_pin = AT91_PIN_PA25,
88 .pullup_pin = 0, /* pull-up driven by UDC */
89};
90
91
92/*
93 * ADS7846 Touchscreen
94 */
95#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
96static int ads7843_pendown_state(void)
97{
98 return !at91_get_gpio_value(AT91_PIN_PA15); /* Touchscreen PENIRQ */
99}
100
101static struct ads7846_platform_data ads_info = {
102 .model = 7843,
103 .x_min = 150,
104 .x_max = 3830,
105 .y_min = 190,
106 .y_max = 3830,
107 .vref_delay_usecs = 100,
108 .x_plate_ohms = 450,
109 .y_plate_ohms = 250,
110 .pressure_max = 15000,
111 .debounce_max = 1,
112 .debounce_rep = 0,
113 .debounce_tol = (~0),
114 .get_pendown_state = ads7843_pendown_state,
115};
116
117static void __init neocore926_add_device_ts(void)
118{
119 at91_set_B_periph(AT91_PIN_PA15, 1); /* External IRQ1, with pullup */
120 at91_set_gpio_input(AT91_PIN_PC13, 1); /* Touchscreen BUSY signal */
121}
122#else
123static void __init neocore926_add_device_ts(void) {}
124#endif
125
126/*
127 * SPI devices.
128 */
129static struct spi_board_info neocore926_spi_devices[] = {
130#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
131 { /* DataFlash card */
132 .modalias = "mtd_dataflash",
133 .chip_select = 0,
134 .max_speed_hz = 15 * 1000 * 1000,
135 .bus_num = 0,
136 },
137#endif
138#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
139 {
140 .modalias = "ads7846",
141 .chip_select = 1,
142 .max_speed_hz = 125000 * 16,
143 .bus_num = 0,
144 .platform_data = &ads_info,
145 .irq = AT91SAM9263_ID_IRQ1,
146 },
147#endif
148};
149
150
151/*
152 * MCI (SD/MMC)
153 */
154static struct at91_mmc_data __initdata neocore926_mmc_data = {
155 .wire4 = 1,
156 .det_pin = AT91_PIN_PE18,
157 .wp_pin = AT91_PIN_PE19,
158};
159
160
161/*
162 * MACB Ethernet device
163 */
164static struct at91_eth_data __initdata neocore926_macb_data = {
165 .phy_irq_pin = AT91_PIN_PE31,
166 .is_rmii = 1,
167};
168
169
170/*
171 * NAND flash
172 */
173static struct mtd_partition __initdata neocore926_nand_partition[] = {
174 {
175 .name = "Linux Kernel", /* "Partition 1", */
176 .offset = 0,
177 .size = SZ_8M,
178 },
179 {
180 .name = "Filesystem", /* "Partition 2", */
181 .offset = MTDPART_OFS_NXTBLK,
182 .size = SZ_32M,
183 },
184 {
185 .name = "Free", /* "Partition 3", */
186 .offset = MTDPART_OFS_NXTBLK,
187 .size = MTDPART_SIZ_FULL,
188 },
189};
190
191static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
192{
193 *num_partitions = ARRAY_SIZE(neocore926_nand_partition);
194 return neocore926_nand_partition;
195}
196
197static struct atmel_nand_data __initdata neocore926_nand_data = {
198 .ale = 21,
199 .cle = 22,
200 .rdy_pin = AT91_PIN_PB19,
201 .rdy_pin_active_low = 1,
202 .enable_pin = AT91_PIN_PD15,
203 .partition_info = nand_partitions,
204};
205
206static struct sam9_smc_config __initdata neocore926_nand_smc_config = {
207 .ncs_read_setup = 0,
208 .nrd_setup = 1,
209 .ncs_write_setup = 0,
210 .nwe_setup = 1,
211
212 .ncs_read_pulse = 4,
213 .nrd_pulse = 4,
214 .ncs_write_pulse = 4,
215 .nwe_pulse = 4,
216
217 .read_cycle = 6,
218 .write_cycle = 6,
219
220 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
221 .tdf_cycles = 2,
222};
223
224static void __init neocore926_add_device_nand(void)
225{
226 /* configure chip-select 3 (NAND) */
227 sam9_smc_configure(3, &neocore926_nand_smc_config);
228
229 at91_add_device_nand(&neocore926_nand_data);
230}
231
232
233/*
234 * LCD Controller
235 */
236#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
237static struct fb_videomode at91_tft_vga_modes[] = {
238 {
239 .name = "TX09D50VM1CCA @ 60",
240 .refresh = 60,
241 .xres = 240, .yres = 320,
242 .pixclock = KHZ2PICOS(5000),
243
244 .left_margin = 1, .right_margin = 33,
245 .upper_margin = 1, .lower_margin = 0,
246 .hsync_len = 5, .vsync_len = 1,
247
248 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
249 .vmode = FB_VMODE_NONINTERLACED,
250 },
251};
252
253static struct fb_monspecs at91fb_default_monspecs = {
254 .manufacturer = "HIT",
255 .monitor = "TX09D70VM1CCA",
256
257 .modedb = at91_tft_vga_modes,
258 .modedb_len = ARRAY_SIZE(at91_tft_vga_modes),
259 .hfmin = 15000,
260 .hfmax = 64000,
261 .vfmin = 50,
262 .vfmax = 150,
263};
264
265#define AT91SAM9263_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \
266 | ATMEL_LCDC_DISTYPE_TFT \
267 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
268
269static void at91_lcdc_power_control(int on)
270{
271 at91_set_gpio_value(AT91_PIN_PA30, on);
272}
273
274/* Driver datas */
275static struct atmel_lcdfb_info __initdata neocore926_lcdc_data = {
276 .lcdcon_is_backlight = true,
277 .default_bpp = 16,
278 .default_dmacon = ATMEL_LCDC_DMAEN,
279 .default_lcdcon2 = AT91SAM9263_DEFAULT_LCDCON2,
280 .default_monspecs = &at91fb_default_monspecs,
281 .atmel_lcdfb_power_control = at91_lcdc_power_control,
282 .guard_time = 1,
283 .lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB555,
284};
285
286#else
287static struct atmel_lcdfb_info __initdata neocore926_lcdc_data;
288#endif
289
290
291/*
292 * GPIO Buttons
293 */
294#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
295static struct gpio_keys_button neocore926_buttons[] = {
296 { /* BP1, "leftclic" */
297 .code = BTN_LEFT,
298 .gpio = AT91_PIN_PC5,
299 .active_low = 1,
300 .desc = "left_click",
301 .wakeup = 1,
302 },
303 { /* BP2, "rightclic" */
304 .code = BTN_RIGHT,
305 .gpio = AT91_PIN_PC4,
306 .active_low = 1,
307 .desc = "right_click",
308 .wakeup = 1,
309 },
310};
311
312static struct gpio_keys_platform_data neocore926_button_data = {
313 .buttons = neocore926_buttons,
314 .nbuttons = ARRAY_SIZE(neocore926_buttons),
315};
316
317static struct platform_device neocore926_button_device = {
318 .name = "gpio-keys",
319 .id = -1,
320 .num_resources = 0,
321 .dev = {
322 .platform_data = &neocore926_button_data,
323 }
324};
325
326static void __init neocore926_add_device_buttons(void)
327{
328 at91_set_GPIO_periph(AT91_PIN_PC5, 0); /* left button */
329 at91_set_deglitch(AT91_PIN_PC5, 1);
330 at91_set_GPIO_periph(AT91_PIN_PC4, 0); /* right button */
331 at91_set_deglitch(AT91_PIN_PC4, 1);
332
333 platform_device_register(&neocore926_button_device);
334}
335#else
336static void __init neocore926_add_device_buttons(void) {}
337#endif
338
339
340/*
341 * AC97
342 */
343static struct atmel_ac97_data neocore926_ac97_data = {
344 .reset_pin = AT91_PIN_PA13,
345};
346
347
348static void __init neocore926_board_init(void)
349{
350 /* Serial */
351 at91_add_device_serial();
352
353 /* USB Host */
354 at91_add_device_usbh(&neocore926_usbh_data);
355
356 /* USB Device */
357 at91_add_device_udc(&neocore926_udc_data);
358
359 /* SPI */
360 at91_set_gpio_output(AT91_PIN_PE20, 1); /* select spi0 clock */
361 at91_add_device_spi(neocore926_spi_devices, ARRAY_SIZE(neocore926_spi_devices));
362
363 /* Touchscreen */
364 neocore926_add_device_ts();
365
366 /* MMC */
367 at91_add_device_mmc(1, &neocore926_mmc_data);
368
369 /* Ethernet */
370 at91_add_device_eth(&neocore926_macb_data);
371
372 /* NAND */
373 neocore926_add_device_nand();
374
375 /* I2C */
376 at91_add_device_i2c(NULL, 0);
377
378 /* LCD Controller */
379 at91_add_device_lcdc(&neocore926_lcdc_data);
380
381 /* Push Buttons */
382 neocore926_add_device_buttons();
383
384 /* AC97 */
385 at91_add_device_ac97(&neocore926_ac97_data);
386}
387
388MACHINE_START(NEOCORE926, "ADENEO NEOCORE 926")
389 /* Maintainer: ADENEO */
390 .phys_io = AT91_BASE_SYS,
391 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
392 .boot_params = AT91_SDRAM_BASE + 0x100,
393 .timer = &at91sam926x_timer,
394 .map_io = neocore926_map_io,
395 .init_irq = neocore926_init_irq,
396 .init_machine = neocore926_board_init,
397MACHINE_END
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
index cfb4571a2e27..4cff9a7e61d2 100644
--- a/arch/arm/mach-at91/board-qil-a9260.c
+++ b/arch/arm/mach-at91/board-qil-a9260.c
@@ -41,8 +41,10 @@
41#include <mach/hardware.h> 41#include <mach/hardware.h>
42#include <mach/board.h> 42#include <mach/board.h>
43#include <mach/gpio.h> 43#include <mach/gpio.h>
44#include <mach/at91sam9_smc.h>
44#include <mach/at91_shdwc.h> 45#include <mach/at91_shdwc.h>
45 46
47#include "sam9_smc.h"
46#include "generic.h" 48#include "generic.h"
47 49
48 50
@@ -147,13 +149,34 @@ static struct atmel_nand_data __initdata ek_nand_data = {
147 .rdy_pin = AT91_PIN_PC13, 149 .rdy_pin = AT91_PIN_PC13,
148 .enable_pin = AT91_PIN_PC14, 150 .enable_pin = AT91_PIN_PC14,
149 .partition_info = nand_partitions, 151 .partition_info = nand_partitions,
150#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
151 .bus_width_16 = 1,
152#else
153 .bus_width_16 = 0,
154#endif
155}; 152};
156 153
154static struct sam9_smc_config __initdata ek_nand_smc_config = {
155 .ncs_read_setup = 0,
156 .nrd_setup = 1,
157 .ncs_write_setup = 0,
158 .nwe_setup = 1,
159
160 .ncs_read_pulse = 3,
161 .nrd_pulse = 3,
162 .ncs_write_pulse = 3,
163 .nwe_pulse = 3,
164
165 .read_cycle = 5,
166 .write_cycle = 5,
167
168 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
169 .tdf_cycles = 2,
170};
171
172static void __init ek_add_device_nand(void)
173{
174 /* configure chip-select 3 (NAND) */
175 sam9_smc_configure(3, &ek_nand_smc_config);
176
177 at91_add_device_nand(&ek_nand_data);
178}
179
157/* 180/*
158 * MCI (SD/MMC) 181 * MCI (SD/MMC)
159 */ 182 */
@@ -227,7 +250,7 @@ static void __init ek_board_init(void)
227 /* SPI */ 250 /* SPI */
228 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); 251 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
229 /* NAND */ 252 /* NAND */
230 at91_add_device_nand(&ek_nand_data); 253 ek_add_device_nand();
231 /* I2C */ 254 /* I2C */
232 at91_add_device_i2c(NULL, 0); 255 at91_add_device_i2c(NULL, 0);
233 /* Ethernet */ 256 /* Ethernet */
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c
index 99bb4cc23a09..b48346977534 100644
--- a/arch/arm/mach-at91/board-sam9-l9260.c
+++ b/arch/arm/mach-at91/board-sam9-l9260.c
@@ -38,7 +38,9 @@
38 38
39#include <mach/board.h> 39#include <mach/board.h>
40#include <mach/gpio.h> 40#include <mach/gpio.h>
41#include <mach/at91sam9_smc.h>
41 42
43#include "sam9_smc.h"
42#include "generic.h" 44#include "generic.h"
43 45
44 46
@@ -148,13 +150,34 @@ static struct atmel_nand_data __initdata ek_nand_data = {
148 .rdy_pin = AT91_PIN_PC13, 150 .rdy_pin = AT91_PIN_PC13,
149 .enable_pin = AT91_PIN_PC14, 151 .enable_pin = AT91_PIN_PC14,
150 .partition_info = nand_partitions, 152 .partition_info = nand_partitions,
151#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
152 .bus_width_16 = 1,
153#else
154 .bus_width_16 = 0,
155#endif
156}; 153};
157 154
155static struct sam9_smc_config __initdata ek_nand_smc_config = {
156 .ncs_read_setup = 0,
157 .nrd_setup = 1,
158 .ncs_write_setup = 0,
159 .nwe_setup = 1,
160
161 .ncs_read_pulse = 3,
162 .nrd_pulse = 3,
163 .ncs_write_pulse = 3,
164 .nwe_pulse = 3,
165
166 .read_cycle = 5,
167 .write_cycle = 5,
168
169 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
170 .tdf_cycles = 2,
171};
172
173static void __init ek_add_device_nand(void)
174{
175 /* configure chip-select 3 (NAND) */
176 sam9_smc_configure(3, &ek_nand_smc_config);
177
178 at91_add_device_nand(&ek_nand_data);
179}
180
158 181
159/* 182/*
160 * MCI (SD/MMC) 183 * MCI (SD/MMC)
@@ -178,7 +201,7 @@ static void __init ek_board_init(void)
178 /* SPI */ 201 /* SPI */
179 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); 202 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
180 /* NAND */ 203 /* NAND */
181 at91_add_device_nand(&ek_nand_data); 204 ek_add_device_nand();
182 /* Ethernet */ 205 /* Ethernet */
183 at91_add_device_eth(&ek_macb_data); 206 at91_add_device_eth(&ek_macb_data);
184 /* MMC */ 207 /* MMC */
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index b49eb6e4918a..93a0f8b100eb 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -42,7 +42,10 @@
42#include <mach/hardware.h> 42#include <mach/hardware.h>
43#include <mach/board.h> 43#include <mach/board.h>
44#include <mach/gpio.h> 44#include <mach/gpio.h>
45#include <mach/at91sam9_smc.h>
46#include <mach/at91_shdwc.h>
45 47
48#include "sam9_smc.h"
46#include "generic.h" 49#include "generic.h"
47 50
48 51
@@ -195,6 +198,38 @@ static struct atmel_nand_data __initdata ek_nand_data = {
195#endif 198#endif
196}; 199};
197 200
201static struct sam9_smc_config __initdata ek_nand_smc_config = {
202 .ncs_read_setup = 0,
203 .nrd_setup = 1,
204 .ncs_write_setup = 0,
205 .nwe_setup = 1,
206
207 .ncs_read_pulse = 3,
208 .nrd_pulse = 3,
209 .ncs_write_pulse = 3,
210 .nwe_pulse = 3,
211
212 .read_cycle = 5,
213 .write_cycle = 5,
214
215 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
216 .tdf_cycles = 2,
217};
218
219static void __init ek_add_device_nand(void)
220{
221 /* setup bus-width (8 or 16) */
222 if (ek_nand_data.bus_width_16)
223 ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
224 else
225 ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
226
227 /* configure chip-select 3 (NAND) */
228 sam9_smc_configure(3, &ek_nand_smc_config);
229
230 at91_add_device_nand(&ek_nand_data);
231}
232
198 233
199/* 234/*
200 * MCI (SD/MMC) 235 * MCI (SD/MMC)
@@ -303,7 +338,7 @@ static void __init ek_board_init(void)
303 /* SPI */ 338 /* SPI */
304 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); 339 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
305 /* NAND */ 340 /* NAND */
306 at91_add_device_nand(&ek_nand_data); 341 ek_add_device_nand();
307 /* Ethernet */ 342 /* Ethernet */
308 at91_add_device_eth(&ek_macb_data); 343 at91_add_device_eth(&ek_macb_data);
309 /* MMC */ 344 /* MMC */
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index 4977409d4fc6..d5266da55311 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -47,7 +47,9 @@
47#include <mach/board.h> 47#include <mach/board.h>
48#include <mach/gpio.h> 48#include <mach/gpio.h>
49#include <mach/at91sam9_smc.h> 49#include <mach/at91sam9_smc.h>
50#include <mach/at91_shdwc.h>
50 51
52#include "sam9_smc.h"
51#include "generic.h" 53#include "generic.h"
52 54
53 55
@@ -76,7 +78,7 @@ static void __init ek_init_irq(void)
76 * DM9000 ethernet device 78 * DM9000 ethernet device
77 */ 79 */
78#if defined(CONFIG_DM9000) 80#if defined(CONFIG_DM9000)
79static struct resource at91sam9261_dm9000_resource[] = { 81static struct resource dm9000_resource[] = {
80 [0] = { 82 [0] = {
81 .start = AT91_CHIPSELECT_2, 83 .start = AT91_CHIPSELECT_2,
82 .end = AT91_CHIPSELECT_2 + 3, 84 .end = AT91_CHIPSELECT_2 + 3,
@@ -98,27 +100,42 @@ static struct dm9000_plat_data dm9000_platdata = {
98 .flags = DM9000_PLATF_16BITONLY, 100 .flags = DM9000_PLATF_16BITONLY,
99}; 101};
100 102
101static struct platform_device at91sam9261_dm9000_device = { 103static struct platform_device dm9000_device = {
102 .name = "dm9000", 104 .name = "dm9000",
103 .id = 0, 105 .id = 0,
104 .num_resources = ARRAY_SIZE(at91sam9261_dm9000_resource), 106 .num_resources = ARRAY_SIZE(dm9000_resource),
105 .resource = at91sam9261_dm9000_resource, 107 .resource = dm9000_resource,
106 .dev = { 108 .dev = {
107 .platform_data = &dm9000_platdata, 109 .platform_data = &dm9000_platdata,
108 } 110 }
109}; 111};
110 112
113/*
114 * SMC timings for the DM9000.
115 * Note: These timings were calculated for MASTER_CLOCK = 100000000 according to the DM9000 timings.
116 */
117static struct sam9_smc_config __initdata dm9000_smc_config = {
118 .ncs_read_setup = 0,
119 .nrd_setup = 2,
120 .ncs_write_setup = 0,
121 .nwe_setup = 2,
122
123 .ncs_read_pulse = 8,
124 .nrd_pulse = 4,
125 .ncs_write_pulse = 8,
126 .nwe_pulse = 4,
127
128 .read_cycle = 16,
129 .write_cycle = 16,
130
131 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE | AT91_SMC_DBW_16,
132 .tdf_cycles = 1,
133};
134
111static void __init ek_add_device_dm9000(void) 135static void __init ek_add_device_dm9000(void)
112{ 136{
113 /* 137 /* Configure chip-select 2 (DM9000) */
114 * Configure Chip-Select 2 on SMC for the DM9000. 138 sam9_smc_configure(2, &dm9000_smc_config);
115 * Note: These timings were calculated for MASTER_CLOCK = 100000000
116 * according to the DM9000 timings.
117 */
118 at91_sys_write(AT91_SMC_SETUP(2), AT91_SMC_NWESETUP_(2) | AT91_SMC_NCS_WRSETUP_(0) | AT91_SMC_NRDSETUP_(2) | AT91_SMC_NCS_RDSETUP_(0));
119 at91_sys_write(AT91_SMC_PULSE(2), AT91_SMC_NWEPULSE_(4) | AT91_SMC_NCS_WRPULSE_(8) | AT91_SMC_NRDPULSE_(4) | AT91_SMC_NCS_RDPULSE_(8));
120 at91_sys_write(AT91_SMC_CYCLE(2), AT91_SMC_NWECYCLE_(16) | AT91_SMC_NRDCYCLE_(16));
121 at91_sys_write(AT91_SMC_MODE(2), AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE | AT91_SMC_DBW_16 | AT91_SMC_TDF_(1));
122 139
123 /* Configure Reset signal as output */ 140 /* Configure Reset signal as output */
124 at91_set_gpio_output(AT91_PIN_PC10, 0); 141 at91_set_gpio_output(AT91_PIN_PC10, 0);
@@ -126,7 +143,7 @@ static void __init ek_add_device_dm9000(void)
126 /* Configure Interrupt pin as input, no pull-up */ 143 /* Configure Interrupt pin as input, no pull-up */
127 at91_set_gpio_input(AT91_PIN_PC11, 0); 144 at91_set_gpio_input(AT91_PIN_PC11, 0);
128 145
129 platform_device_register(&at91sam9261_dm9000_device); 146 platform_device_register(&dm9000_device);
130} 147}
131#else 148#else
132static void __init ek_add_device_dm9000(void) {} 149static void __init ek_add_device_dm9000(void) {}
@@ -197,6 +214,39 @@ static struct atmel_nand_data __initdata ek_nand_data = {
197#endif 214#endif
198}; 215};
199 216
217static struct sam9_smc_config __initdata ek_nand_smc_config = {
218 .ncs_read_setup = 0,
219 .nrd_setup = 1,
220 .ncs_write_setup = 0,
221 .nwe_setup = 1,
222
223 .ncs_read_pulse = 3,
224 .nrd_pulse = 3,
225 .ncs_write_pulse = 3,
226 .nwe_pulse = 3,
227
228 .read_cycle = 5,
229 .write_cycle = 5,
230
231 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
232 .tdf_cycles = 2,
233};
234
235static void __init ek_add_device_nand(void)
236{
237 /* setup bus-width (8 or 16) */
238 if (ek_nand_data.bus_width_16)
239 ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
240 else
241 ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
242
243 /* configure chip-select 3 (NAND) */
244 sam9_smc_configure(3, &ek_nand_smc_config);
245
246 at91_add_device_nand(&ek_nand_data);
247}
248
249
200/* 250/*
201 * ADS7846 Touchscreen 251 * ADS7846 Touchscreen
202 */ 252 */
@@ -525,7 +575,7 @@ static void __init ek_board_init(void)
525 /* I2C */ 575 /* I2C */
526 at91_add_device_i2c(NULL, 0); 576 at91_add_device_i2c(NULL, 0);
527 /* NAND */ 577 /* NAND */
528 at91_add_device_nand(&ek_nand_data); 578 ek_add_device_nand();
529 /* DM9000 ethernet */ 579 /* DM9000 ethernet */
530 ek_add_device_dm9000(); 580 ek_add_device_dm9000();
531 581
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 8354015c6a23..57d52528f224 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -46,7 +46,9 @@
46#include <mach/board.h> 46#include <mach/board.h>
47#include <mach/gpio.h> 47#include <mach/gpio.h>
48#include <mach/at91sam9_smc.h> 48#include <mach/at91sam9_smc.h>
49#include <mach/at91_shdwc.h>
49 50
51#include "sam9_smc.h"
50#include "generic.h" 52#include "generic.h"
51 53
52 54
@@ -203,6 +205,38 @@ static struct atmel_nand_data __initdata ek_nand_data = {
203#endif 205#endif
204}; 206};
205 207
208static struct sam9_smc_config __initdata ek_nand_smc_config = {
209 .ncs_read_setup = 0,
210 .nrd_setup = 1,
211 .ncs_write_setup = 0,
212 .nwe_setup = 1,
213
214 .ncs_read_pulse = 3,
215 .nrd_pulse = 3,
216 .ncs_write_pulse = 3,
217 .nwe_pulse = 3,
218
219 .read_cycle = 5,
220 .write_cycle = 5,
221
222 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
223 .tdf_cycles = 2,
224};
225
226static void __init ek_add_device_nand(void)
227{
228 /* setup bus-width (8 or 16) */
229 if (ek_nand_data.bus_width_16)
230 ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
231 else
232 ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
233
234 /* configure chip-select 3 (NAND) */
235 sam9_smc_configure(3, &ek_nand_smc_config);
236
237 at91_add_device_nand(&ek_nand_data);
238}
239
206 240
207/* 241/*
208 * I2C devices 242 * I2C devices
@@ -385,7 +419,7 @@ static void __init ek_board_init(void)
385 /* Ethernet */ 419 /* Ethernet */
386 at91_add_device_eth(&ek_macb_data); 420 at91_add_device_eth(&ek_macb_data);
387 /* NAND */ 421 /* NAND */
388 at91_add_device_nand(&ek_nand_data); 422 ek_add_device_nand();
389 /* I2C */ 423 /* I2C */
390 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices)); 424 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
391 /* LCD Controller */ 425 /* LCD Controller */
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index b588ead14d68..81439fe6fb3d 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -37,7 +37,9 @@
37 37
38#include <mach/board.h> 38#include <mach/board.h>
39#include <mach/gpio.h> 39#include <mach/gpio.h>
40#include <mach/at91sam9_smc.h>
40 41
42#include "sam9_smc.h"
41#include "generic.h" 43#include "generic.h"
42 44
43 45
@@ -156,6 +158,38 @@ static struct atmel_nand_data __initdata ek_nand_data = {
156#endif 158#endif
157}; 159};
158 160
161static struct sam9_smc_config __initdata ek_nand_smc_config = {
162 .ncs_read_setup = 0,
163 .nrd_setup = 2,
164 .ncs_write_setup = 0,
165 .nwe_setup = 2,
166
167 .ncs_read_pulse = 4,
168 .nrd_pulse = 4,
169 .ncs_write_pulse = 4,
170 .nwe_pulse = 4,
171
172 .read_cycle = 7,
173 .write_cycle = 7,
174
175 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
176 .tdf_cycles = 3,
177};
178
179static void __init ek_add_device_nand(void)
180{
181 /* setup bus-width (8 or 16) */
182 if (ek_nand_data.bus_width_16)
183 ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
184 else
185 ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
186
187 /* configure chip-select 3 (NAND) */
188 sam9_smc_configure(3, &ek_nand_smc_config);
189
190 at91_add_device_nand(&ek_nand_data);
191}
192
159 193
160/* 194/*
161 * MCI (SD/MMC) 195 * MCI (SD/MMC)
@@ -195,7 +229,7 @@ static void __init ek_board_init(void)
195 /* SPI */ 229 /* SPI */
196 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); 230 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
197 /* NAND */ 231 /* NAND */
198 at91_add_device_nand(&ek_nand_data); 232 ek_add_device_nand();
199 /* Ethernet */ 233 /* Ethernet */
200 at91_add_device_eth(&ek_macb_data); 234 at91_add_device_eth(&ek_macb_data);
201 /* MMC */ 235 /* MMC */
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index 270851864308..9b937ee4815a 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -29,8 +29,9 @@
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30#include <mach/board.h> 30#include <mach/board.h>
31#include <mach/gpio.h> 31#include <mach/gpio.h>
32#include <mach/at91sam9_smc.h> 32#include <mach/at91_shdwc.h>
33 33
34#include "sam9_smc.h"
34#include "generic.h" 35#include "generic.h"
35 36
36 37
@@ -103,9 +104,34 @@ static struct atmel_nand_data __initdata ek_nand_data = {
103 .rdy_pin = AT91_PIN_PD17, 104 .rdy_pin = AT91_PIN_PD17,
104 .enable_pin = AT91_PIN_PB6, 105 .enable_pin = AT91_PIN_PB6,
105 .partition_info = nand_partitions, 106 .partition_info = nand_partitions,
106 .bus_width_16 = 0,
107}; 107};
108 108
109static struct sam9_smc_config __initdata ek_nand_smc_config = {
110 .ncs_read_setup = 0,
111 .nrd_setup = 1,
112 .ncs_write_setup = 0,
113 .nwe_setup = 1,
114
115 .ncs_read_pulse = 3,
116 .nrd_pulse = 3,
117 .ncs_write_pulse = 3,
118 .nwe_pulse = 3,
119
120 .read_cycle = 5,
121 .write_cycle = 5,
122
123 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
124 .tdf_cycles = 2,
125};
126
127static void __init ek_add_device_nand(void)
128{
129 /* configure chip-select 3 (NAND) */
130 sam9_smc_configure(3, &ek_nand_smc_config);
131
132 at91_add_device_nand(&ek_nand_data);
133}
134
109 135
110/* 136/*
111 * SPI devices 137 * SPI devices
@@ -188,7 +214,7 @@ static void __init ek_board_init(void)
188 /* I2C */ 214 /* I2C */
189 at91_add_device_i2c(NULL, 0); 215 at91_add_device_i2c(NULL, 0);
190 /* NAND */ 216 /* NAND */
191 at91_add_device_nand(&ek_nand_data); 217 ek_add_device_nand();
192 /* SPI */ 218 /* SPI */
193 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); 219 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
194 /* MMC */ 220 /* MMC */
diff --git a/arch/arm/mach-at91/board-usb-a9260.c b/arch/arm/mach-at91/board-usb-a9260.c
index 7c350357333a..d13304c0bc45 100644
--- a/arch/arm/mach-at91/board-usb-a9260.c
+++ b/arch/arm/mach-at91/board-usb-a9260.c
@@ -41,8 +41,10 @@
41#include <mach/hardware.h> 41#include <mach/hardware.h>
42#include <mach/board.h> 42#include <mach/board.h>
43#include <mach/gpio.h> 43#include <mach/gpio.h>
44#include <mach/at91sam9_smc.h>
44#include <mach/at91_shdwc.h> 45#include <mach/at91_shdwc.h>
45 46
47#include "sam9_smc.h"
46#include "generic.h" 48#include "generic.h"
47 49
48 50
@@ -121,13 +123,34 @@ static struct atmel_nand_data __initdata ek_nand_data = {
121 .rdy_pin = AT91_PIN_PC13, 123 .rdy_pin = AT91_PIN_PC13,
122 .enable_pin = AT91_PIN_PC14, 124 .enable_pin = AT91_PIN_PC14,
123 .partition_info = nand_partitions, 125 .partition_info = nand_partitions,
124#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
125 .bus_width_16 = 1,
126#else
127 .bus_width_16 = 0,
128#endif
129}; 126};
130 127
128static struct sam9_smc_config __initdata ek_nand_smc_config = {
129 .ncs_read_setup = 0,
130 .nrd_setup = 1,
131 .ncs_write_setup = 0,
132 .nwe_setup = 1,
133
134 .ncs_read_pulse = 3,
135 .nrd_pulse = 3,
136 .ncs_write_pulse = 3,
137 .nwe_pulse = 3,
138
139 .read_cycle = 5,
140 .write_cycle = 5,
141
142 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
143 .tdf_cycles = 2,
144};
145
146static void __init ek_add_device_nand(void)
147{
148 /* configure chip-select 3 (NAND) */
149 sam9_smc_configure(3, &ek_nand_smc_config);
150
151 at91_add_device_nand(&ek_nand_data);
152}
153
131/* 154/*
132 * GPIO Buttons 155 * GPIO Buttons
133 */ 156 */
@@ -189,7 +212,7 @@ static void __init ek_board_init(void)
189 /* USB Device */ 212 /* USB Device */
190 at91_add_device_udc(&ek_udc_data); 213 at91_add_device_udc(&ek_udc_data);
191 /* NAND */ 214 /* NAND */
192 at91_add_device_nand(&ek_nand_data); 215 ek_add_device_nand();
193 /* I2C */ 216 /* I2C */
194 at91_add_device_i2c(NULL, 0); 217 at91_add_device_i2c(NULL, 0);
195 /* Ethernet */ 218 /* Ethernet */
diff --git a/arch/arm/mach-at91/board-usb-a9263.c b/arch/arm/mach-at91/board-usb-a9263.c
index 391b566c4571..d96405b7d578 100644
--- a/arch/arm/mach-at91/board-usb-a9263.c
+++ b/arch/arm/mach-at91/board-usb-a9263.c
@@ -40,8 +40,10 @@
40#include <mach/hardware.h> 40#include <mach/hardware.h>
41#include <mach/board.h> 41#include <mach/board.h>
42#include <mach/gpio.h> 42#include <mach/gpio.h>
43#include <mach/at91sam9_smc.h>
43#include <mach/at91_shdwc.h> 44#include <mach/at91_shdwc.h>
44 45
46#include "sam9_smc.h"
45#include "generic.h" 47#include "generic.h"
46 48
47 49
@@ -134,13 +136,35 @@ static struct atmel_nand_data __initdata ek_nand_data = {
134 .rdy_pin = AT91_PIN_PA22, 136 .rdy_pin = AT91_PIN_PA22,
135 .enable_pin = AT91_PIN_PD15, 137 .enable_pin = AT91_PIN_PD15,
136 .partition_info = nand_partitions, 138 .partition_info = nand_partitions,
137#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
138 .bus_width_16 = 1,
139#else
140 .bus_width_16 = 0,
141#endif
142}; 139};
143 140
141static struct sam9_smc_config __initdata ek_nand_smc_config = {
142 .ncs_read_setup = 0,
143 .nrd_setup = 1,
144 .ncs_write_setup = 0,
145 .nwe_setup = 1,
146
147 .ncs_read_pulse = 3,
148 .nrd_pulse = 3,
149 .ncs_write_pulse = 3,
150 .nwe_pulse = 3,
151
152 .read_cycle = 5,
153 .write_cycle = 5,
154
155 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
156 .tdf_cycles = 2,
157};
158
159static void __init ek_add_device_nand(void)
160{
161 /* configure chip-select 3 (NAND) */
162 sam9_smc_configure(3, &ek_nand_smc_config);
163
164 at91_add_device_nand(&ek_nand_data);
165}
166
167
144/* 168/*
145 * GPIO Buttons 169 * GPIO Buttons
146 */ 170 */
@@ -206,7 +230,7 @@ static void __init ek_board_init(void)
206 /* Ethernet */ 230 /* Ethernet */
207 at91_add_device_eth(&ek_macb_data); 231 at91_add_device_eth(&ek_macb_data);
208 /* NAND */ 232 /* NAND */
209 at91_add_device_nand(&ek_nand_data); 233 ek_add_device_nand();
210 /* I2C */ 234 /* I2C */
211 at91_add_device_i2c(NULL, 0); 235 at91_add_device_i2c(NULL, 0);
212 /* Push Buttons */ 236 /* Push Buttons */
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-at91/include/mach/at91_pmc.h
index 2e3f2894b704..9561e33b8a9a 100644
--- a/arch/arm/mach-at91/include/mach/at91_pmc.h
+++ b/arch/arm/mach-at91/include/mach/at91_pmc.h
@@ -23,6 +23,7 @@
23#define AT91_PMC_PCK (1 << 0) /* Processor Clock */ 23#define AT91_PMC_PCK (1 << 0) /* Processor Clock */
24#define AT91RM9200_PMC_UDP (1 << 1) /* USB Devcice Port Clock [AT91RM9200 only] */ 24#define AT91RM9200_PMC_UDP (1 << 1) /* USB Devcice Port Clock [AT91RM9200 only] */
25#define AT91RM9200_PMC_MCKUDP (1 << 2) /* USB Device Port Master Clock Automatic Disable on Suspend [AT91RM9200 only] */ 25#define AT91RM9200_PMC_MCKUDP (1 << 2) /* USB Device Port Master Clock Automatic Disable on Suspend [AT91RM9200 only] */
26#define AT91CAP9_PMC_DDR (1 << 2) /* DDR Clock [AT91CAP9 revC only] */
26#define AT91RM9200_PMC_UHP (1 << 4) /* USB Host Port Clock [AT91RM9200 only] */ 27#define AT91RM9200_PMC_UHP (1 << 4) /* USB Host Port Clock [AT91RM9200 only] */
27#define AT91SAM926x_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91SAM926x only] */ 28#define AT91SAM926x_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91SAM926x only] */
28#define AT91CAP9_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91CAP9 only] */ 29#define AT91CAP9_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91CAP9 only] */
@@ -102,10 +103,16 @@
102#define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */ 103#define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */
103#define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */ 104#define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */
104#define AT91_PMC_LOCKU (1 << 6) /* UPLL Lock [AT91CAP9 only] */ 105#define AT91_PMC_LOCKU (1 << 6) /* UPLL Lock [AT91CAP9 only] */
106#define AT91_PMC_OSCSEL (1 << 7) /* Slow Clock Oscillator [AT91CAP9 revC only] */
105#define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */ 107#define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */
106#define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */ 108#define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */
107#define AT91_PMC_PCK2RDY (1 << 10) /* Programmable Clock 2 */ 109#define AT91_PMC_PCK2RDY (1 << 10) /* Programmable Clock 2 */
108#define AT91_PMC_PCK3RDY (1 << 11) /* Programmable Clock 3 */ 110#define AT91_PMC_PCK3RDY (1 << 11) /* Programmable Clock 3 */
109#define AT91_PMC_IMR (AT91_PMC + 0x6c) /* Interrupt Mask Register */ 111#define AT91_PMC_IMR (AT91_PMC + 0x6c) /* Interrupt Mask Register */
110 112
113#define AT91_PMC_PROT (AT91_PMC + 0xe4) /* Protect Register [AT91CAP9 revC only] */
114#define AT91_PMC_PROTKEY 0x504d4301 /* Activation Code */
115
116#define AT91_PMC_VER (AT91_PMC + 0xfc) /* PMC Module Version [AT91CAP9 only] */
117
111#endif 118#endif
diff --git a/arch/arm/mach-at91/include/mach/at91cap9.h b/arch/arm/mach-at91/include/mach/at91cap9.h
index 4a4b64135a92..d8c1ededaa75 100644
--- a/arch/arm/mach-at91/include/mach/at91cap9.h
+++ b/arch/arm/mach-at91/include/mach/at91cap9.h
@@ -101,7 +101,9 @@
101#define AT91_RTT (0xfffffd20 - AT91_BASE_SYS) 101#define AT91_RTT (0xfffffd20 - AT91_BASE_SYS)
102#define AT91_PIT (0xfffffd30 - AT91_BASE_SYS) 102#define AT91_PIT (0xfffffd30 - AT91_BASE_SYS)
103#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) 103#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS)
104#define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) 104#define AT91_GPBR (cpu_is_at91cap9_revB() ? \
105 (0xfffffd50 - AT91_BASE_SYS) : \
106 (0xfffffd60 - AT91_BASE_SYS))
105 107
106#define AT91_USART0 AT91CAP9_BASE_US0 108#define AT91_USART0 AT91CAP9_BASE_US0
107#define AT91_USART1 AT91CAP9_BASE_US1 109#define AT91_USART1 AT91CAP9_BASE_US1
diff --git a/arch/arm/mach-at91/include/mach/cpu.h b/arch/arm/mach-at91/include/mach/cpu.h
index dbfd9f73f80b..c554c3e4d553 100644
--- a/arch/arm/mach-at91/include/mach/cpu.h
+++ b/arch/arm/mach-at91/include/mach/cpu.h
@@ -49,6 +49,17 @@ static inline unsigned long at91_arch_identify(void)
49 return (at91_sys_read(AT91_DBGU_CIDR) & AT91_CIDR_ARCH); 49 return (at91_sys_read(AT91_DBGU_CIDR) & AT91_CIDR_ARCH);
50} 50}
51 51
52#ifdef CONFIG_ARCH_AT91CAP9
53#include <mach/at91_pmc.h>
54
55#define ARCH_REVISION_CAP9_B 0x399
56#define ARCH_REVISION_CAP9_C 0x601
57
58static inline unsigned long at91cap9_rev_identify(void)
59{
60 return (at91_sys_read(AT91_PMC_VER));
61}
62#endif
52 63
53#ifdef CONFIG_ARCH_AT91RM9200 64#ifdef CONFIG_ARCH_AT91RM9200
54#define cpu_is_at91rm9200() (at91_cpu_identify() == ARCH_ID_AT91RM9200) 65#define cpu_is_at91rm9200() (at91_cpu_identify() == ARCH_ID_AT91RM9200)
@@ -90,8 +101,12 @@ static inline unsigned long at91_arch_identify(void)
90 101
91#ifdef CONFIG_ARCH_AT91CAP9 102#ifdef CONFIG_ARCH_AT91CAP9
92#define cpu_is_at91cap9() (at91_cpu_identify() == ARCH_ID_AT91CAP9) 103#define cpu_is_at91cap9() (at91_cpu_identify() == ARCH_ID_AT91CAP9)
104#define cpu_is_at91cap9_revB() (at91cap9_rev_identify() == ARCH_REVISION_CAP9_B)
105#define cpu_is_at91cap9_revC() (at91cap9_rev_identify() == ARCH_REVISION_CAP9_C)
93#else 106#else
94#define cpu_is_at91cap9() (0) 107#define cpu_is_at91cap9() (0)
108#define cpu_is_at91cap9_revB() (0)
109#define cpu_is_at91cap9_revC() (0)
95#endif 110#endif
96 111
97/* 112/*
diff --git a/arch/arm/mach-at91/include/mach/dma.h b/arch/arm/mach-at91/include/mach/dma.h
deleted file mode 100644
index e4f90c177616..000000000000
--- a/arch/arm/mach-at91/include/mach/dma.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/mach-at91/include/mach/dma.h
3 *
4 * Copyright (C) 2003 SAN People
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 */
diff --git a/arch/arm/mach-at91/include/mach/io.h b/arch/arm/mach-at91/include/mach/io.h
index 1611bd03f528..0b0cccc46e68 100644
--- a/arch/arm/mach-at91/include/mach/io.h
+++ b/arch/arm/mach-at91/include/mach/io.h
@@ -23,8 +23,8 @@
23 23
24#define IO_SPACE_LIMIT 0xFFFFFFFF 24#define IO_SPACE_LIMIT 0xFFFFFFFF
25 25
26#define __io(a) ((void __iomem *)(a)) 26#define __io(a) __typesafe_io(a)
27#define __mem_pci(a) (a) 27#define __mem_pci(a) (a)
28 28
29 29
30#ifndef __ASSEMBLY__ 30#ifndef __ASSEMBLY__
diff --git a/arch/arm/mach-at91/include/mach/memory.h b/arch/arm/mach-at91/include/mach/memory.h
index 9dd1b8c79b08..14f4ef4b6a9e 100644
--- a/arch/arm/mach-at91/include/mach/memory.h
+++ b/arch/arm/mach-at91/include/mach/memory.h
@@ -25,15 +25,4 @@
25 25
26#define PHYS_OFFSET (AT91_SDRAM_BASE) 26#define PHYS_OFFSET (AT91_SDRAM_BASE)
27 27
28
29/*
30 * Virtual view <-> DMA view memory address translations
31 * virt_to_bus: Used to translate the virtual address to an
32 * address suitable to be passed to set_dma_addr
33 * bus_to_virt: Used to convert an address for DMA operations
34 * to an address that the kernel can use.
35 */
36#define __virt_to_bus(x) __virt_to_phys(x)
37#define __bus_to_virt(x) __phys_to_virt(x)
38
39#endif 28#endif
diff --git a/arch/arm/mach-at91/sam9_smc.c b/arch/arm/mach-at91/sam9_smc.c
new file mode 100644
index 000000000000..5eab6aa621d0
--- /dev/null
+++ b/arch/arm/mach-at91/sam9_smc.c
@@ -0,0 +1,47 @@
1/*
2 * linux/arch/arm/mach-at91/sam9_smc.c
3 *
4 * Copyright (C) 2008 Andrew Victor
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/module.h>
12#include <linux/io.h>
13
14#include <mach/at91sam9_smc.h>
15
16#include "sam9_smc.h"
17
18void __init sam9_smc_configure(int cs, struct sam9_smc_config* config)
19{
20 /* Setup register */
21 at91_sys_write(AT91_SMC_SETUP(cs),
22 AT91_SMC_NWESETUP_(config->nwe_setup)
23 | AT91_SMC_NCS_WRSETUP_(config->ncs_write_setup)
24 | AT91_SMC_NRDSETUP_(config->nrd_setup)
25 | AT91_SMC_NCS_RDSETUP_(config->ncs_read_setup)
26 );
27
28 /* Pulse register */
29 at91_sys_write(AT91_SMC_PULSE(cs),
30 AT91_SMC_NWEPULSE_(config->nwe_pulse)
31 | AT91_SMC_NCS_WRPULSE_(config->ncs_write_pulse)
32 | AT91_SMC_NRDPULSE_(config->nrd_pulse)
33 | AT91_SMC_NCS_RDPULSE_(config->ncs_read_pulse)
34 );
35
36 /* Cycle register */
37 at91_sys_write(AT91_SMC_CYCLE(cs),
38 AT91_SMC_NWECYCLE_(config->write_cycle)
39 | AT91_SMC_NRDCYCLE_(config->read_cycle)
40 );
41
42 /* Mode register */
43 at91_sys_write(AT91_SMC_MODE(cs),
44 config->mode
45 | AT91_SMC_TDF_(config->tdf_cycles)
46 );
47}
diff --git a/arch/arm/mach-at91/sam9_smc.h b/arch/arm/mach-at91/sam9_smc.h
new file mode 100644
index 000000000000..bf72cfb3455b
--- /dev/null
+++ b/arch/arm/mach-at91/sam9_smc.h
@@ -0,0 +1,33 @@
1/*
2 * linux/arch/arm/mach-at91/sam9_smc.
3 *
4 * Copyright (C) 2008 Andrew Victor
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
11struct sam9_smc_config {
12 /* Setup register */
13 u8 ncs_read_setup;
14 u8 nrd_setup;
15 u8 ncs_write_setup;
16 u8 nwe_setup;
17
18 /* Pulse register */
19 u8 ncs_read_pulse;
20 u8 nrd_pulse;
21 u8 ncs_write_pulse;
22 u8 nwe_pulse;
23
24 /* Cycle register */
25 u16 read_cycle;
26 u16 write_cycle;
27
28 /* Mode register */
29 u32 mode;
30 u8 tdf_cycles:4;
31};
32
33extern void __init sam9_smc_configure(int cs, struct sam9_smc_config* config);
diff --git a/arch/arm/mach-clps711x/include/mach/dma.h b/arch/arm/mach-clps711x/include/mach/dma.h
deleted file mode 100644
index 0d620e869536..000000000000
--- a/arch/arm/mach-clps711x/include/mach/dma.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/mach-clps711x/include/mach/dma.h
3 *
4 * Copyright (C) 1997,1998 Russell King
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 */
diff --git a/arch/arm/mach-clps711x/include/mach/io.h b/arch/arm/mach-clps711x/include/mach/io.h
index 4c8440087679..2e0b3ced8f07 100644
--- a/arch/arm/mach-clps711x/include/mach/io.h
+++ b/arch/arm/mach-clps711x/include/mach/io.h
@@ -20,12 +20,10 @@
20#ifndef __ASM_ARM_ARCH_IO_H 20#ifndef __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H 21#define __ASM_ARM_ARCH_IO_H
22 22
23#include <mach/hardware.h>
24
25#define IO_SPACE_LIMIT 0xffffffff 23#define IO_SPACE_LIMIT 0xffffffff
26 24
27#define __io(a) ((void __iomem *)(a)) 25#define __io(a) __typesafe_io(a)
28#define __mem_pci(a) (a) 26#define __mem_pci(a) (a)
29 27
30/* 28/*
31 * We don't support ins[lb]/outs[lb]. Make them fault. 29 * We don't support ins[lb]/outs[lb]. Make them fault.
diff --git a/arch/arm/mach-clps711x/include/mach/memory.h b/arch/arm/mach-clps711x/include/mach/memory.h
index 98ec30c97bbe..e522b20bcbc2 100644
--- a/arch/arm/mach-clps711x/include/mach/memory.h
+++ b/arch/arm/mach-clps711x/include/mach/memory.h
@@ -26,25 +26,7 @@
26 */ 26 */
27#define PHYS_OFFSET UL(0xc0000000) 27#define PHYS_OFFSET UL(0xc0000000)
28 28
29/* 29#if !defined(CONFIG_ARCH_CDB89712) && !defined (CONFIG_ARCH_AUTCPU12)
30 * Virtual view <-> DMA view memory address translations
31 * virt_to_bus: Used to translate the virtual address to an
32 * address suitable to be passed to set_dma_addr
33 * bus_to_virt: Used to convert an address for DMA operations
34 * to an address that the kernel can use.
35 */
36
37#if defined(CONFIG_ARCH_CDB89712)
38
39#define __virt_to_bus(x) (x)
40#define __bus_to_virt(x) (x)
41
42#elif defined (CONFIG_ARCH_AUTCPU12)
43
44#define __virt_to_bus(x) (x)
45#define __bus_to_virt(x) (x)
46
47#else
48 30
49#define __virt_to_bus(x) ((x) - PAGE_OFFSET) 31#define __virt_to_bus(x) ((x) - PAGE_OFFSET)
50#define __bus_to_virt(x) ((x) + PAGE_OFFSET) 32#define __bus_to_virt(x) ((x) + PAGE_OFFSET)
diff --git a/arch/arm/mach-clps7500/Makefile b/arch/arm/mach-clps7500/Makefile
deleted file mode 100644
index 4bd8ebd70e7b..000000000000
--- a/arch/arm/mach-clps7500/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5# Object file lists.
6
7obj-y := core.o
8obj-m :=
9obj-n :=
10obj- :=
11
diff --git a/arch/arm/mach-clps7500/Makefile.boot b/arch/arm/mach-clps7500/Makefile.boot
deleted file mode 100644
index fe16506c1540..000000000000
--- a/arch/arm/mach-clps7500/Makefile.boot
+++ /dev/null
@@ -1,2 +0,0 @@
1 zreladdr-y := 0x10008000
2
diff --git a/arch/arm/mach-clps7500/core.c b/arch/arm/mach-clps7500/core.c
deleted file mode 100644
index 7e247c04d41c..000000000000
--- a/arch/arm/mach-clps7500/core.c
+++ /dev/null
@@ -1,395 +0,0 @@
1/*
2 * linux/arch/arm/mach-clps7500/core.c
3 *
4 * Copyright (C) 1998 Russell King
5 * Copyright (C) 1999 Nexus Electronics Ltd
6 *
7 * Extra MM routines for CL7500 architecture
8 */
9#include <linux/kernel.h>
10#include <linux/types.h>
11#include <linux/interrupt.h>
12#include <linux/irq.h>
13#include <linux/list.h>
14#include <linux/sched.h>
15#include <linux/init.h>
16#include <linux/device.h>
17#include <linux/serial_8250.h>
18#include <linux/io.h>
19
20#include <asm/mach/arch.h>
21#include <asm/mach/map.h>
22#include <asm/mach/irq.h>
23#include <asm/mach/time.h>
24
25#include <mach/hardware.h>
26#include <asm/hardware/iomd.h>
27#include <asm/irq.h>
28#include <asm/mach-types.h>
29
30unsigned int vram_size;
31
32static void cl7500_ack_irq_a(unsigned int irq)
33{
34 unsigned int val, mask;
35
36 mask = 1 << irq;
37 val = iomd_readb(IOMD_IRQMASKA);
38 iomd_writeb(val & ~mask, IOMD_IRQMASKA);
39 iomd_writeb(mask, IOMD_IRQCLRA);
40}
41
42static void cl7500_mask_irq_a(unsigned int irq)
43{
44 unsigned int val, mask;
45
46 mask = 1 << irq;
47 val = iomd_readb(IOMD_IRQMASKA);
48 iomd_writeb(val & ~mask, IOMD_IRQMASKA);
49}
50
51static void cl7500_unmask_irq_a(unsigned int irq)
52{
53 unsigned int val, mask;
54
55 mask = 1 << irq;
56 val = iomd_readb(IOMD_IRQMASKA);
57 iomd_writeb(val | mask, IOMD_IRQMASKA);
58}
59
60static struct irq_chip clps7500_a_chip = {
61 .ack = cl7500_ack_irq_a,
62 .mask = cl7500_mask_irq_a,
63 .unmask = cl7500_unmask_irq_a,
64};
65
66static void cl7500_mask_irq_b(unsigned int irq)
67{
68 unsigned int val, mask;
69
70 mask = 1 << (irq & 7);
71 val = iomd_readb(IOMD_IRQMASKB);
72 iomd_writeb(val & ~mask, IOMD_IRQMASKB);
73}
74
75static void cl7500_unmask_irq_b(unsigned int irq)
76{
77 unsigned int val, mask;
78
79 mask = 1 << (irq & 7);
80 val = iomd_readb(IOMD_IRQMASKB);
81 iomd_writeb(val | mask, IOMD_IRQMASKB);
82}
83
84static struct irq_chip clps7500_b_chip = {
85 .ack = cl7500_mask_irq_b,
86 .mask = cl7500_mask_irq_b,
87 .unmask = cl7500_unmask_irq_b,
88};
89
90static void cl7500_mask_irq_c(unsigned int irq)
91{
92 unsigned int val, mask;
93
94 mask = 1 << (irq & 7);
95 val = iomd_readb(IOMD_IRQMASKC);
96 iomd_writeb(val & ~mask, IOMD_IRQMASKC);
97}
98
99static void cl7500_unmask_irq_c(unsigned int irq)
100{
101 unsigned int val, mask;
102
103 mask = 1 << (irq & 7);
104 val = iomd_readb(IOMD_IRQMASKC);
105 iomd_writeb(val | mask, IOMD_IRQMASKC);
106}
107
108static struct irq_chip clps7500_c_chip = {
109 .ack = cl7500_mask_irq_c,
110 .mask = cl7500_mask_irq_c,
111 .unmask = cl7500_unmask_irq_c,
112};
113
114static void cl7500_mask_irq_d(unsigned int irq)
115{
116 unsigned int val, mask;
117
118 mask = 1 << (irq & 7);
119 val = iomd_readb(IOMD_IRQMASKD);
120 iomd_writeb(val & ~mask, IOMD_IRQMASKD);
121}
122
123static void cl7500_unmask_irq_d(unsigned int irq)
124{
125 unsigned int val, mask;
126
127 mask = 1 << (irq & 7);
128 val = iomd_readb(IOMD_IRQMASKD);
129 iomd_writeb(val | mask, IOMD_IRQMASKD);
130}
131
132static struct irq_chip clps7500_d_chip = {
133 .ack = cl7500_mask_irq_d,
134 .mask = cl7500_mask_irq_d,
135 .unmask = cl7500_unmask_irq_d,
136};
137
138static void cl7500_mask_irq_dma(unsigned int irq)
139{
140 unsigned int val, mask;
141
142 mask = 1 << (irq & 7);
143 val = iomd_readb(IOMD_DMAMASK);
144 iomd_writeb(val & ~mask, IOMD_DMAMASK);
145}
146
147static void cl7500_unmask_irq_dma(unsigned int irq)
148{
149 unsigned int val, mask;
150
151 mask = 1 << (irq & 7);
152 val = iomd_readb(IOMD_DMAMASK);
153 iomd_writeb(val | mask, IOMD_DMAMASK);
154}
155
156static struct irq_chip clps7500_dma_chip = {
157 .ack = cl7500_mask_irq_dma,
158 .mask = cl7500_mask_irq_dma,
159 .unmask = cl7500_unmask_irq_dma,
160};
161
162static void cl7500_mask_irq_fiq(unsigned int irq)
163{
164 unsigned int val, mask;
165
166 mask = 1 << (irq & 7);
167 val = iomd_readb(IOMD_FIQMASK);
168 iomd_writeb(val & ~mask, IOMD_FIQMASK);
169}
170
171static void cl7500_unmask_irq_fiq(unsigned int irq)
172{
173 unsigned int val, mask;
174
175 mask = 1 << (irq & 7);
176 val = iomd_readb(IOMD_FIQMASK);
177 iomd_writeb(val | mask, IOMD_FIQMASK);
178}
179
180static struct irq_chip clps7500_fiq_chip = {
181 .ack = cl7500_mask_irq_fiq,
182 .mask = cl7500_mask_irq_fiq,
183 .unmask = cl7500_unmask_irq_fiq,
184};
185
186static void cl7500_no_action(unsigned int irq)
187{
188}
189
190static struct irq_chip clps7500_no_chip = {
191 .ack = cl7500_no_action,
192 .mask = cl7500_no_action,
193 .unmask = cl7500_no_action,
194};
195
196static struct irqaction irq_isa = {
197 .handler = no_action,
198 .mask = CPU_MASK_NONE,
199 .name = "isa",
200};
201
202static void __init clps7500_init_irq(void)
203{
204 unsigned int irq, flags;
205
206 iomd_writeb(0, IOMD_IRQMASKA);
207 iomd_writeb(0, IOMD_IRQMASKB);
208 iomd_writeb(0, IOMD_FIQMASK);
209 iomd_writeb(0, IOMD_DMAMASK);
210
211 for (irq = 0; irq < NR_IRQS; irq++) {
212 flags = IRQF_VALID;
213
214 if (irq <= 6 || (irq >= 9 && irq <= 15) ||
215 (irq >= 48 && irq <= 55))
216 flags |= IRQF_PROBE;
217
218 switch (irq) {
219 case 0 ... 7:
220 set_irq_chip(irq, &clps7500_a_chip);
221 set_irq_handler(irq, handle_level_irq);
222 set_irq_flags(irq, flags);
223 break;
224
225 case 8 ... 15:
226 set_irq_chip(irq, &clps7500_b_chip);
227 set_irq_handler(irq, handle_level_irq);
228 set_irq_flags(irq, flags);
229 break;
230
231 case 16 ... 22:
232 set_irq_chip(irq, &clps7500_dma_chip);
233 set_irq_handler(irq, handle_level_irq);
234 set_irq_flags(irq, flags);
235 break;
236
237 case 24 ... 31:
238 set_irq_chip(irq, &clps7500_c_chip);
239 set_irq_handler(irq, handle_level_irq);
240 set_irq_flags(irq, flags);
241 break;
242
243 case 40 ... 47:
244 set_irq_chip(irq, &clps7500_d_chip);
245 set_irq_handler(irq, handle_level_irq);
246 set_irq_flags(irq, flags);
247 break;
248
249 case 48 ... 55:
250 set_irq_chip(irq, &clps7500_no_chip);
251 set_irq_handler(irq, handle_level_irq);
252 set_irq_flags(irq, flags);
253 break;
254
255 case 64 ... 72:
256 set_irq_chip(irq, &clps7500_fiq_chip);
257 set_irq_handler(irq, handle_level_irq);
258 set_irq_flags(irq, flags);
259 break;
260 }
261 }
262
263 setup_irq(IRQ_ISA, &irq_isa);
264}
265
266static struct map_desc cl7500_io_desc[] __initdata = {
267 { /* IO space */
268 .virtual = (unsigned long)IO_BASE,
269 .pfn = __phys_to_pfn(IO_START),
270 .length = IO_SIZE,
271 .type = MT_DEVICE
272 }, { /* ISA space */
273 .virtual = ISA_BASE,
274 .pfn = __phys_to_pfn(ISA_START),
275 .length = ISA_SIZE,
276 .type = MT_DEVICE
277 }, { /* Flash */
278 .virtual = CLPS7500_FLASH_BASE,
279 .pfn = __phys_to_pfn(CLPS7500_FLASH_START),
280 .length = CLPS7500_FLASH_SIZE,
281 .type = MT_DEVICE
282 }, { /* LED */
283 .virtual = LED_BASE,
284 .pfn = __phys_to_pfn(LED_START),
285 .length = LED_SIZE,
286 .type = MT_DEVICE
287 }
288};
289
290static void __init clps7500_map_io(void)
291{
292 iotable_init(cl7500_io_desc, ARRAY_SIZE(cl7500_io_desc));
293}
294
295extern void ioctime_init(void);
296extern unsigned long ioc_timer_gettimeoffset(void);
297
298static irqreturn_t
299clps7500_timer_interrupt(int irq, void *dev_id)
300{
301 timer_tick();
302
303 /* Why not using do_leds interface?? */
304 {
305 /* Twinkle the lights. */
306 static int count, state = 0xff00;
307 if (count-- == 0) {
308 state ^= 0x100;
309 count = 25;
310 *((volatile unsigned int *)LED_ADDRESS) = state;
311 }
312 }
313
314 return IRQ_HANDLED;
315}
316
317static struct irqaction clps7500_timer_irq = {
318 .name = "CLPS7500 Timer Tick",
319 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
320 .handler = clps7500_timer_interrupt,
321};
322
323/*
324 * Set up timer interrupt.
325 */
326static void __init clps7500_timer_init(void)
327{
328 ioctime_init();
329 setup_irq(IRQ_TIMER, &clps7500_timer_irq);
330}
331
332static struct sys_timer clps7500_timer = {
333 .init = clps7500_timer_init,
334 .offset = ioc_timer_gettimeoffset,
335};
336
337static struct plat_serial8250_port serial_platform_data[] = {
338 {
339 .mapbase = 0x03010fe0,
340 .irq = 10,
341 .uartclk = 1843200,
342 .regshift = 2,
343 .iotype = UPIO_MEM,
344 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SKIP_TEST,
345 },
346 {
347 .mapbase = 0x03010be0,
348 .irq = 0,
349 .uartclk = 1843200,
350 .regshift = 2,
351 .iotype = UPIO_MEM,
352 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SKIP_TEST,
353 },
354 {
355 .iobase = ISASLOT_IO + 0x2e8,
356 .irq = 41,
357 .uartclk = 1843200,
358 .regshift = 0,
359 .iotype = UPIO_PORT,
360 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
361 },
362 {
363 .iobase = ISASLOT_IO + 0x3e8,
364 .irq = 40,
365 .uartclk = 1843200,
366 .regshift = 0,
367 .iotype = UPIO_PORT,
368 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
369 },
370 { },
371};
372
373static struct platform_device serial_device = {
374 .name = "serial8250",
375 .id = PLAT8250_DEV_PLATFORM,
376 .dev = {
377 .platform_data = serial_platform_data,
378 },
379};
380
381static void __init clps7500_init(void)
382{
383 platform_device_register(&serial_device);
384}
385
386MACHINE_START(CLPS7500, "CL-PS7500")
387 /* Maintainer: Philip Blundell */
388 .phys_io = 0x03000000,
389 .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc,
390 .map_io = clps7500_map_io,
391 .init_irq = clps7500_init_irq,
392 .init_machine = clps7500_init,
393 .timer = &clps7500_timer,
394MACHINE_END
395
diff --git a/arch/arm/mach-clps7500/include/mach/acornfb.h b/arch/arm/mach-clps7500/include/mach/acornfb.h
deleted file mode 100644
index aea6330c9745..000000000000
--- a/arch/arm/mach-clps7500/include/mach/acornfb.h
+++ /dev/null
@@ -1,33 +0,0 @@
1#define acornfb_valid_pixrate(var) (var->pixclock >= 39325 && var->pixclock <= 40119)
2
3static inline void
4acornfb_vidc20_find_rates(struct vidc_timing *vidc,
5 struct fb_var_screeninfo *var)
6{
7 u_int bandwidth;
8
9 vidc->control |= VIDC20_CTRL_PIX_CK;
10
11 /* Calculate bandwidth */
12 bandwidth = var->pixclock * 8 / var->bits_per_pixel;
13
14 /* Encode bandwidth as VIDC20 setting */
15 if (bandwidth > 16667*2)
16 vidc->control |= VIDC20_CTRL_FIFO_16;
17 else if (bandwidth > 13333*2)
18 vidc->control |= VIDC20_CTRL_FIFO_20;
19 else if (bandwidth > 11111*2)
20 vidc->control |= VIDC20_CTRL_FIFO_24;
21 else
22 vidc->control |= VIDC20_CTRL_FIFO_28;
23
24 vidc->pll_ctl = 0x2020;
25}
26
27#ifdef CONFIG_CHRONTEL_7003
28#define acornfb_default_control() VIDC20_CTRL_PIX_HCLK
29#else
30#define acornfb_default_control() VIDC20_CTRL_PIX_VCLK
31#endif
32
33#define acornfb_default_econtrol() VIDC20_ECTL_DAC | VIDC20_ECTL_REG(3) | VIDC20_ECTL_ECK
diff --git a/arch/arm/mach-clps7500/include/mach/debug-macro.S b/arch/arm/mach-clps7500/include/mach/debug-macro.S
deleted file mode 100644
index af4104e7e84a..000000000000
--- a/arch/arm/mach-clps7500/include/mach/debug-macro.S
+++ /dev/null
@@ -1,21 +0,0 @@
1/* arch/arm/mach-clps7500/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12*/
13
14 .macro addruart,rx
15 mov \rx, #0xe0000000
16 orr \rx, \rx, #0x00010000
17 orr \rx, \rx, #0x00000be0
18 .endm
19
20#define UART_SHIFT 2
21#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-clps7500/include/mach/dma.h b/arch/arm/mach-clps7500/include/mach/dma.h
deleted file mode 100644
index 63fcde505498..000000000000
--- a/arch/arm/mach-clps7500/include/mach/dma.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * arch/arm/mach-clps7500/include/mach/dma.h
3 *
4 * Copyright (C) 1999 Nexus Electronics Ltd.
5 */
6
7#ifndef __ASM_ARCH_DMA_H
8#define __ASM_ARCH_DMA_H
9
10/* DMA is not yet implemented! It should be the same as acorn, copy over.. */
11
12/*
13 * This is the maximum DMA address that can be DMAd to.
14 * There should not be more than (0xd0000000 - 0xc0000000)
15 * bytes of RAM.
16 */
17#define MAX_DMA_ADDRESS 0xd0000000
18
19#define DMA_S0 0
20
21#endif /* _ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-clps7500/include/mach/entry-macro.S b/arch/arm/mach-clps7500/include/mach/entry-macro.S
deleted file mode 100644
index 4e7e54144093..000000000000
--- a/arch/arm/mach-clps7500/include/mach/entry-macro.S
+++ /dev/null
@@ -1,16 +0,0 @@
1#include <mach/hardware.h>
2#include <asm/hardware/entry-macro-iomd.S>
3
4 .equ ioc_base_high, IOC_BASE & 0xff000000
5 .equ ioc_base_low, IOC_BASE & 0x00ff0000
6
7 .macro get_irqnr_preamble, base, tmp
8 mov \base, #ioc_base_high @ point at IOC
9 .if ioc_base_low
10 orr \base, \base, #ioc_base_low
11 .endif
12 .endm
13
14 .macro arch_ret_to_user, tmp1, tmp2
15 .endm
16
diff --git a/arch/arm/mach-clps7500/include/mach/hardware.h b/arch/arm/mach-clps7500/include/mach/hardware.h
deleted file mode 100644
index a6ad1d44badf..000000000000
--- a/arch/arm/mach-clps7500/include/mach/hardware.h
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2 * arch/arm/mach-clps7500/include/mach/hardware.h
3 *
4 * Copyright (C) 1996-1999 Russell King.
5 * Copyright (C) 1999 Nexus Electronics Ltd.
6 *
7 * This file contains the hardware definitions of the
8 * CL7500 evaluation board.
9 */
10#ifndef __ASM_ARCH_HARDWARE_H
11#define __ASM_ARCH_HARDWARE_H
12
13#include <mach/memory.h>
14#include <asm/hardware/iomd.h>
15
16#ifdef __ASSEMBLY__
17#define IOMEM(x) x
18#else
19#define IOMEM(x) ((void __iomem *)(x))
20#endif
21
22/*
23 * What hardware must be present
24 */
25#define HAS_IOMD
26#define HAS_VIDC20
27
28/* Hardware addresses of major areas.
29 * *_START is the physical address
30 * *_SIZE is the size of the region
31 * *_BASE is the virtual address
32 */
33
34#define IO_START 0x03000000 /* I/O */
35#define IO_SIZE 0x01000000
36#define IO_BASE IOMEM(0xe0000000)
37
38#define ISA_START 0x0c000000 /* ISA */
39#define ISA_SIZE 0x00010000
40#define ISA_BASE 0xe1000000
41
42#define CLPS7500_FLASH_START 0x01000000 /* XXX */
43#define CLPS7500_FLASH_SIZE 0x01000000
44#define CLPS7500_FLASH_BASE 0xe2000000
45
46#define LED_START 0x0302B000
47#define LED_SIZE 0x00001000
48#define LED_BASE 0xe3000000
49#define LED_ADDRESS (LED_BASE + 0xa00)
50
51/* Let's define SCREEN_START for CL7500, even though it's a lie. */
52#define SCREEN_START 0x02000000 /* VRAM */
53#define SCREEN_END 0xdfc00000
54#define SCREEN_BASE 0xdf800000
55
56#define VIDC_BASE (void __iomem *)0xe0400000
57#define IOMD_BASE IOMEM(0xe0200000)
58#define IOC_BASE IOMEM(0xe0200000)
59#define FLOPPYDMA_BASE IOMEM(0xe002a000)
60#define PCIO_BASE IOMEM(0xe0010000)
61
62#define vidc_writel(val) __raw_writel(val, VIDC_BASE)
63
64/* in/out bias for the ISA slot region */
65#define ISASLOT_IO 0x80400000
66
67#endif
diff --git a/arch/arm/mach-clps7500/include/mach/io.h b/arch/arm/mach-clps7500/include/mach/io.h
deleted file mode 100644
index 2ff2860889ed..000000000000
--- a/arch/arm/mach-clps7500/include/mach/io.h
+++ /dev/null
@@ -1,255 +0,0 @@
1/*
2 * arch/arm/mach-clps7500/include/mach/io.h
3 * from arch/arm/mach-rpc/include/mach/io.h
4 *
5 * Copyright (C) 1997 Russell King
6 *
7 * Modifications:
8 * 06-Dec-1997 RMK Created.
9 */
10#ifndef __ASM_ARM_ARCH_IO_H
11#define __ASM_ARM_ARCH_IO_H
12
13#include <mach/hardware.h>
14
15#define IO_SPACE_LIMIT 0xffffffff
16
17/*
18 * GCC is totally crap at loading/storing data. We try to persuade it
19 * to do the right thing by using these whereever possible instead of
20 * the above.
21 */
22#define __arch_base_getb(b,o) \
23 ({ \
24 unsigned int v, r = (b); \
25 __asm__ __volatile__( \
26 "ldrb %0, [%1, %2]" \
27 : "=r" (v) \
28 : "r" (r), "Ir" (o)); \
29 v; \
30 })
31
32#define __arch_base_getl(b,o) \
33 ({ \
34 unsigned int v, r = (b); \
35 __asm__ __volatile__( \
36 "ldr %0, [%1, %2]" \
37 : "=r" (v) \
38 : "r" (r), "Ir" (o)); \
39 v; \
40 })
41
42#define __arch_base_putb(v,b,o) \
43 ({ \
44 unsigned int r = (b); \
45 __asm__ __volatile__( \
46 "strb %0, [%1, %2]" \
47 : \
48 : "r" (v), "r" (r), "Ir" (o)); \
49 })
50
51#define __arch_base_putl(v,b,o) \
52 ({ \
53 unsigned int r = (b); \
54 __asm__ __volatile__( \
55 "str %0, [%1, %2]" \
56 : \
57 : "r" (v), "r" (r), "Ir" (o)); \
58 })
59
60/*
61 * We use two different types of addressing - PC style addresses, and ARM
62 * addresses. PC style accesses the PC hardware with the normal PC IO
63 * addresses, eg 0x3f8 for serial#1. ARM addresses are 0x80000000+
64 * and are translated to the start of IO. Note that all addresses are
65 * shifted left!
66 */
67#define __PORT_PCIO(x) (!((x) & 0x80000000))
68
69/*
70 * Dynamic IO functions - let the compiler
71 * optimize the expressions
72 */
73static inline void __outb (unsigned int value, unsigned int port)
74{
75 unsigned long temp;
76 __asm__ __volatile__(
77 "tst %2, #0x80000000\n\t"
78 "mov %0, %4\n\t"
79 "addeq %0, %0, %3\n\t"
80 "strb %1, [%0, %2, lsl #2] @ outb"
81 : "=&r" (temp)
82 : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
83 : "cc");
84}
85
86static inline void __outw (unsigned int value, unsigned int port)
87{
88 unsigned long temp;
89 __asm__ __volatile__(
90 "tst %2, #0x80000000\n\t"
91 "mov %0, %4\n\t"
92 "addeq %0, %0, %3\n\t"
93 "str %1, [%0, %2, lsl #2] @ outw"
94 : "=&r" (temp)
95 : "r" (value|value<<16), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
96 : "cc");
97}
98
99static inline void __outl (unsigned int value, unsigned int port)
100{
101 unsigned long temp;
102 __asm__ __volatile__(
103 "tst %2, #0x80000000\n\t"
104 "mov %0, %4\n\t"
105 "addeq %0, %0, %3\n\t"
106 "str %1, [%0, %2, lsl #2] @ outl"
107 : "=&r" (temp)
108 : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
109 : "cc");
110}
111
112#define DECLARE_DYN_IN(sz,fnsuffix,instr) \
113static inline unsigned sz __in##fnsuffix (unsigned int port) \
114{ \
115 unsigned long temp, value; \
116 __asm__ __volatile__( \
117 "tst %2, #0x80000000\n\t" \
118 "mov %0, %4\n\t" \
119 "addeq %0, %0, %3\n\t" \
120 "ldr" instr " %1, [%0, %2, lsl #2] @ in" #fnsuffix \
121 : "=&r" (temp), "=r" (value) \
122 : "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) \
123 : "cc"); \
124 return (unsigned sz)value; \
125}
126
127static inline unsigned int __ioaddr (unsigned int port) \
128{ \
129 if (__PORT_PCIO(port)) \
130 return (unsigned int)(PCIO_BASE + (port << 2)); \
131 else \
132 return (unsigned int)(IO_BASE + (port << 2)); \
133}
134
135#define DECLARE_IO(sz,fnsuffix,instr) \
136 DECLARE_DYN_IN(sz,fnsuffix,instr)
137
138DECLARE_IO(char,b,"b")
139DECLARE_IO(short,w,"")
140DECLARE_IO(int,l,"")
141
142#undef DECLARE_IO
143#undef DECLARE_DYN_IN
144
145/*
146 * Constant address IO functions
147 *
148 * These have to be macros for the 'J' constraint to work -
149 * +/-4096 immediate operand.
150 */
151#define __outbc(value,port) \
152({ \
153 if (__PORT_PCIO((port))) \
154 __asm__ __volatile__( \
155 "strb %0, [%1, %2] @ outbc" \
156 : : "r" (value), "r" (PCIO_BASE), "Jr" ((port) << 2)); \
157 else \
158 __asm__ __volatile__( \
159 "strb %0, [%1, %2] @ outbc" \
160 : : "r" (value), "r" (IO_BASE), "r" ((port) << 2)); \
161})
162
163#define __inbc(port) \
164({ \
165 unsigned char result; \
166 if (__PORT_PCIO((port))) \
167 __asm__ __volatile__( \
168 "ldrb %0, [%1, %2] @ inbc" \
169 : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
170 else \
171 __asm__ __volatile__( \
172 "ldrb %0, [%1, %2] @ inbc" \
173 : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
174 result; \
175})
176
177#define __outwc(value,port) \
178({ \
179 unsigned long v = value; \
180 if (__PORT_PCIO((port))) \
181 __asm__ __volatile__( \
182 "str %0, [%1, %2] @ outwc" \
183 : : "r" (v|v<<16), "r" (PCIO_BASE), "Jr" ((port) << 2)); \
184 else \
185 __asm__ __volatile__( \
186 "str %0, [%1, %2] @ outwc" \
187 : : "r" (v|v<<16), "r" (IO_BASE), "r" ((port) << 2)); \
188})
189
190#define __inwc(port) \
191({ \
192 unsigned short result; \
193 if (__PORT_PCIO((port))) \
194 __asm__ __volatile__( \
195 "ldr %0, [%1, %2] @ inwc" \
196 : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
197 else \
198 __asm__ __volatile__( \
199 "ldr %0, [%1, %2] @ inwc" \
200 : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
201 result & 0xffff; \
202})
203
204#define __outlc(value,port) \
205({ \
206 unsigned long v = value; \
207 if (__PORT_PCIO((port))) \
208 __asm__ __volatile__( \
209 "str %0, [%1, %2] @ outlc" \
210 : : "r" (v), "r" (PCIO_BASE), "Jr" ((port) << 2)); \
211 else \
212 __asm__ __volatile__( \
213 "str %0, [%1, %2] @ outlc" \
214 : : "r" (v), "r" (IO_BASE), "r" ((port) << 2)); \
215})
216
217#define __inlc(port) \
218({ \
219 unsigned long result; \
220 if (__PORT_PCIO((port))) \
221 __asm__ __volatile__( \
222 "ldr %0, [%1, %2] @ inlc" \
223 : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
224 else \
225 __asm__ __volatile__( \
226 "ldr %0, [%1, %2] @ inlc" \
227 : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
228 result; \
229})
230
231#define __ioaddrc(port) \
232 (__PORT_PCIO((port)) ? PCIO_BASE + ((port) << 2) : IO_BASE + ((port) << 2))
233
234#define inb(p) (__builtin_constant_p((p)) ? __inbc(p) : __inb(p))
235#define inw(p) (__builtin_constant_p((p)) ? __inwc(p) : __inw(p))
236#define inl(p) (__builtin_constant_p((p)) ? __inlc(p) : __inl(p))
237#define outb(v,p) (__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p))
238#define outw(v,p) (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p))
239#define outl(v,p) (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p))
240#define __ioaddr(p) (__builtin_constant_p((p)) ? __ioaddr(p) : __ioaddrc(p))
241/* the following macro is deprecated */
242#define ioaddr(port) __ioaddr((port))
243
244#define insb(p,d,l) __raw_readsb(__ioaddr(p),d,l)
245#define insw(p,d,l) __raw_readsw(__ioaddr(p),d,l)
246
247#define outsb(p,d,l) __raw_writesb(__ioaddr(p),d,l)
248#define outsw(p,d,l) __raw_writesw(__ioaddr(p),d,l)
249
250/*
251 * 1:1 mapping for ioremapped regions.
252 */
253#define __mem_pci(x) (x)
254
255#endif
diff --git a/arch/arm/mach-clps7500/include/mach/irq.h b/arch/arm/mach-clps7500/include/mach/irq.h
deleted file mode 100644
index d02fcf28ee05..000000000000
--- a/arch/arm/mach-clps7500/include/mach/irq.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * arch/arm/mach-clps7500/include/mach/irq.h
3 *
4 * Copyright (C) 1996 Russell King
5 * Copyright (C) 1999, 2001 Nexus Electronics Ltd.
6 *
7 * Changelog:
8 * 10-10-1996 RMK Brought up to date with arch-sa110eval
9 * 22-08-1998 RMK Restructured IRQ routines
10 * 11-08-1999 PJB Created ARM7500 version, derived from RiscPC code
11 */
12
13#include <linux/io.h>
14#include <asm/hardware/iomd.h>
15
16static inline int fixup_irq(unsigned int irq)
17{
18 if (irq == IRQ_ISA) {
19 int isabits = *((volatile unsigned int *)0xe002b700);
20 if (isabits == 0) {
21 printk("Spurious ISA IRQ!\n");
22 return irq;
23 }
24 irq = IRQ_ISA_BASE;
25 while (!(isabits & 1)) {
26 irq++;
27 isabits >>= 1;
28 }
29 }
30
31 return irq;
32}
diff --git a/arch/arm/mach-clps7500/include/mach/irqs.h b/arch/arm/mach-clps7500/include/mach/irqs.h
deleted file mode 100644
index bee66b487f59..000000000000
--- a/arch/arm/mach-clps7500/include/mach/irqs.h
+++ /dev/null
@@ -1,66 +0,0 @@
1/*
2 * arch/arm/mach-clps7500/include/mach/irqs.h
3 *
4 * Copyright (C) 1999 Nexus Electronics Ltd
5 */
6
7#define IRQ_INT2 0
8#define IRQ_INT1 2
9#define IRQ_VSYNCPULSE 3
10#define IRQ_POWERON 4
11#define IRQ_TIMER0 5
12#define IRQ_TIMER1 6
13#define IRQ_FORCE 7
14#define IRQ_INT8 8
15#define IRQ_ISA 9
16#define IRQ_INT6 10
17#define IRQ_INT5 11
18#define IRQ_INT4 12
19#define IRQ_INT3 13
20#define IRQ_KEYBOARDTX 14
21#define IRQ_KEYBOARDRX 15
22
23#define IRQ_DMA0 16
24#define IRQ_DMA1 17
25#define IRQ_DMA2 18
26#define IRQ_DMA3 19
27#define IRQ_DMAS0 20
28#define IRQ_DMAS1 21
29
30#define IRQ_IOP0 24
31#define IRQ_IOP1 25
32#define IRQ_IOP2 26
33#define IRQ_IOP3 27
34#define IRQ_IOP4 28
35#define IRQ_IOP5 29
36#define IRQ_IOP6 30
37#define IRQ_IOP7 31
38
39#define IRQ_MOUSERX 40
40#define IRQ_MOUSETX 41
41#define IRQ_ADC 42
42#define IRQ_EVENT1 43
43#define IRQ_EVENT2 44
44
45#define IRQ_ISA_BASE 48
46#define IRQ_ISA_3 48
47#define IRQ_ISA_4 49
48#define IRQ_ISA_5 50
49#define IRQ_ISA_7 51
50#define IRQ_ISA_9 52
51#define IRQ_ISA_10 53
52#define IRQ_ISA_11 54
53#define IRQ_ISA_14 55
54
55#define FIQ_INT9 0
56#define FIQ_INT5 1
57#define FIQ_INT6 4
58#define FIQ_INT8 6
59#define FIQ_FORCE 7
60
61/*
62 * This is the offset of the FIQ "IRQ" numbers
63 */
64#define FIQ_START 64
65
66#define IRQ_TIMER IRQ_TIMER0
diff --git a/arch/arm/mach-clps7500/include/mach/memory.h b/arch/arm/mach-clps7500/include/mach/memory.h
deleted file mode 100644
index 87b32db470c8..000000000000
--- a/arch/arm/mach-clps7500/include/mach/memory.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * arch/arm/mach-clps7500/include/mach/memory.h
3 *
4 * Copyright (c) 1996,1997,1998 Russell King.
5 *
6 * Changelog:
7 * 20-Oct-1996 RMK Created
8 * 31-Dec-1997 RMK Fixed definitions to reduce warnings
9 * 11-Jan-1998 RMK Uninlined to reduce hits on cache
10 * 08-Feb-1998 RMK Added __virt_to_bus and __bus_to_virt
11 * 21-Mar-1999 RMK Renamed to memory.h
12 * RMK Added TASK_SIZE and PAGE_OFFSET
13 */
14#ifndef __ASM_ARCH_MEMORY_H
15#define __ASM_ARCH_MEMORY_H
16
17/*
18 * Physical DRAM offset.
19 */
20#define PHYS_OFFSET UL(0x10000000)
21
22/*
23 * These are exactly the same on the RiscPC as the
24 * physical memory view.
25 */
26#define __virt_to_bus(x) __virt_to_phys(x)
27#define __bus_to_virt(x) __phys_to_virt(x)
28
29/*
30 * Cache flushing area - ROM
31 */
32#define FLUSH_BASE_PHYS 0x00000000
33#define FLUSH_BASE 0xdf000000
34
35/*
36 * Sparsemem support. Each section is a maximum of 64MB. The sections
37 * are offset by 128MB and can cover 128MB, so that gives us a maximum
38 * of 29 physmem bits.
39 */
40#define MAX_PHYSMEM_BITS 29
41#define SECTION_SIZE_BITS 26
42
43#endif
diff --git a/arch/arm/mach-clps7500/include/mach/system.h b/arch/arm/mach-clps7500/include/mach/system.h
deleted file mode 100644
index 6d325fbe8b08..000000000000
--- a/arch/arm/mach-clps7500/include/mach/system.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * arch/arm/mach-clps7500/include/mach/system.h
3 *
4 * Copyright (c) 1999 Nexus Electronics Ltd.
5 */
6#ifndef __ASM_ARCH_SYSTEM_H
7#define __ASM_ARCH_SYSTEM_H
8
9#include <linux/io.h>
10#include <asm/hardware/iomd.h>
11
12static inline void arch_idle(void)
13{
14 iomd_writeb(0, IOMD_SUSMODE);
15}
16
17#define arch_reset(mode) \
18 do { \
19 iomd_writeb(0, IOMD_ROMCR0); \
20 cpu_reset(0); \
21 } while (0)
22
23#endif
diff --git a/arch/arm/mach-clps7500/include/mach/timex.h b/arch/arm/mach-clps7500/include/mach/timex.h
deleted file mode 100644
index dfaa9b425757..000000000000
--- a/arch/arm/mach-clps7500/include/mach/timex.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * arch/arm/mach-clps7500/include/mach/timex.h
3 *
4 * CL7500 architecture timex specifications
5 *
6 * Copyright (C) 1999 Nexus Electronics Ltd
7 */
8
9/*
10 * On the ARM7500, the clock ticks at 2MHz.
11 */
12#define CLOCK_TICK_RATE 2000000
13
diff --git a/arch/arm/mach-clps7500/include/mach/uncompress.h b/arch/arm/mach-clps7500/include/mach/uncompress.h
deleted file mode 100644
index d7d0af4b49fc..000000000000
--- a/arch/arm/mach-clps7500/include/mach/uncompress.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * arch/arm/mach-clps7500/include/mach/uncompress.h
3 *
4 * Copyright (C) 1999, 2000 Nexus Electronics Ltd.
5 */
6#define BASE 0x03010000
7#define SERBASE (BASE + (0x2f8 << 2))
8
9static inline void putc(char c)
10{
11 while (!(*((volatile unsigned int *)(SERBASE + 0x14)) & 0x20))
12 barrier();
13
14 *((volatile unsigned int *)(SERBASE)) = c;
15}
16
17static inline void flush(void)
18{
19}
20
21static __inline__ void arch_decomp_setup(void)
22{
23 int baud = 3686400 / (9600 * 32);
24
25 *((volatile unsigned int *)(SERBASE + 0xC)) = 0x80;
26 *((volatile unsigned int *)(SERBASE + 0x0)) = baud & 0xff;
27 *((volatile unsigned int *)(SERBASE + 0x4)) = (baud & 0xff00) >> 8;
28 *((volatile unsigned int *)(SERBASE + 0xC)) = 3; /* 8 bits */
29 *((volatile unsigned int *)(SERBASE + 0x10)) = 3; /* DTR, RTS */
30}
31
32/*
33 * nothing to do
34 */
35#define arch_decomp_wdog()
diff --git a/arch/arm/mach-clps7500/include/mach/vmalloc.h b/arch/arm/mach-clps7500/include/mach/vmalloc.h
deleted file mode 100644
index 8fc5406d1b6d..000000000000
--- a/arch/arm/mach-clps7500/include/mach/vmalloc.h
+++ /dev/null
@@ -1,4 +0,0 @@
1/*
2 * arch/arm/mach-clps7500/include/mach/vmalloc.h
3 */
4#define VMALLOC_END (PAGE_OFFSET + 0x1c000000)
diff --git a/arch/arm/mach-davinci/include/mach/dma.h b/arch/arm/mach-davinci/include/mach/dma.h
deleted file mode 100644
index 8e2f2d0ba667..000000000000
--- a/arch/arm/mach-davinci/include/mach/dma.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * DaVinci DMA definitions
3 *
4 * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
5 *
6 * 2007 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11#ifndef __ASM_ARCH_DMA_H
12#define __ASM_ARCH_DMA_H
13
14#define MAX_DMA_ADDRESS 0xffffffff
15
16#endif /* __ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-davinci/include/mach/io.h b/arch/arm/mach-davinci/include/mach/io.h
index b78ee9140496..a48795fd2417 100644
--- a/arch/arm/mach-davinci/include/mach/io.h
+++ b/arch/arm/mach-davinci/include/mach/io.h
@@ -29,8 +29,7 @@
29 * We don't actually have real ISA nor PCI buses, but there is so many 29 * We don't actually have real ISA nor PCI buses, but there is so many
30 * drivers out there that might just work if we fake them... 30 * drivers out there that might just work if we fake them...
31 */ 31 */
32#define PCIO_BASE 0 32#define __io(a) __typesafe_io(a)
33#define __io(a) ((void __iomem *)(PCIO_BASE + (a)))
34#define __mem_pci(a) (a) 33#define __mem_pci(a) (a)
35#define __mem_isa(a) (a) 34#define __mem_isa(a) (a)
36 35
diff --git a/arch/arm/mach-davinci/include/mach/memory.h b/arch/arm/mach-davinci/include/mach/memory.h
index dd1625c23cf4..86c25c7f3ce3 100644
--- a/arch/arm/mach-davinci/include/mach/memory.h
+++ b/arch/arm/mach-davinci/include/mach/memory.h
@@ -52,13 +52,8 @@ __arch_adjust_zones(int node, unsigned long *size, unsigned long *holes)
52 if ((meminfo.bank[0].size >> 20) > 128) __arch_adjust_zones(node, zone_size, holes) 52 if ((meminfo.bank[0].size >> 20) > 128) __arch_adjust_zones(node, zone_size, holes)
53 53
54#define ISA_DMA_THRESHOLD (PHYS_OFFSET + (128<<20) - 1) 54#define ISA_DMA_THRESHOLD (PHYS_OFFSET + (128<<20) - 1)
55#define MAX_DMA_ADDRESS (PAGE_OFFSET + (128<<20))
55 56
56#endif 57#endif
57 58
58/*
59 * Bus address is physical address
60 */
61#define __virt_to_bus(x) __virt_to_phys(x)
62#define __bus_to_virt(x) __phys_to_virt(x)
63
64#endif /* __ASM_ARCH_MEMORY_H */ 59#endif /* __ASM_ARCH_MEMORY_H */
diff --git a/arch/arm/mach-davinci/include/mach/vmalloc.h b/arch/arm/mach-davinci/include/mach/vmalloc.h
index b98bd9e92fd6..ad51625b6609 100644
--- a/arch/arm/mach-davinci/include/mach/vmalloc.h
+++ b/arch/arm/mach-davinci/include/mach/vmalloc.h
@@ -8,7 +8,6 @@
8 * is licensed "as is" without any warranty of any kind, whether express 8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied. 9 * or implied.
10 */ 10 */
11#include <asm/memory.h>
12#include <mach/io.h> 11#include <mach/io.h>
13 12
14/* Allow vmalloc range until the IO virtual range minus a 2M "hole" */ 13/* Allow vmalloc range until the IO virtual range minus a 2M "hole" */
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index 3b9a296b5c4b..f8bcd29d17a6 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -322,7 +322,7 @@ static void __init davinci_timer_init(void)
322 clockevent_davinci.min_delta_ns = 322 clockevent_davinci.min_delta_ns =
323 clockevent_delta2ns(1, &clockevent_davinci); 323 clockevent_delta2ns(1, &clockevent_davinci);
324 324
325 clockevent_davinci.cpumask = cpumask_of_cpu(0); 325 clockevent_davinci.cpumask = cpumask_of(0);
326 clockevents_register_device(&clockevent_davinci); 326 clockevents_register_device(&clockevent_davinci);
327} 327}
328 328
diff --git a/arch/arm/mach-ebsa110/include/mach/dma.h b/arch/arm/mach-ebsa110/include/mach/dma.h
deleted file mode 100644
index 780a04c8bbe9..000000000000
--- a/arch/arm/mach-ebsa110/include/mach/dma.h
+++ /dev/null
@@ -1,11 +0,0 @@
1/*
2 * arch/arm/mach-ebsa110/include/mach/dma.h
3 *
4 * Copyright (C) 1997,1998 Russell King
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 * EBSA110 DMA definitions
11 */
diff --git a/arch/arm/mach-ebsa110/include/mach/memory.h b/arch/arm/mach-ebsa110/include/mach/memory.h
index eea4b75b657b..0ca66d080c69 100644
--- a/arch/arm/mach-ebsa110/include/mach/memory.h
+++ b/arch/arm/mach-ebsa110/include/mach/memory.h
@@ -22,13 +22,6 @@
22#define PHYS_OFFSET UL(0x00000000) 22#define PHYS_OFFSET UL(0x00000000)
23 23
24/* 24/*
25 * We keep this 1:1 so that we don't interfere
26 * with the PCMCIA memory regions
27 */
28#define __virt_to_bus(x) (x)
29#define __bus_to_virt(x) (x)
30
31/*
32 * Cache flushing area - SRAM 25 * Cache flushing area - SRAM
33 */ 26 */
34#define FLUSH_BASE_PHYS 0x40000000 27#define FLUSH_BASE_PHYS 0x40000000
diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig
index 5a1b8c05c958..56bddcef6905 100644
--- a/arch/arm/mach-ep93xx/Kconfig
+++ b/arch/arm/mach-ep93xx/Kconfig
@@ -33,6 +33,12 @@ config MACH_EDB9307
33 Say 'Y' here if you want your kernel to support the Cirrus 33 Say 'Y' here if you want your kernel to support the Cirrus
34 Logic EDB9307 Evaluation Board. 34 Logic EDB9307 Evaluation Board.
35 35
36config MACH_EDB9307A
37 bool "Support Cirrus Logic EDB9307A"
38 help
39 Say 'Y' here if you want your kernel to support the Cirrus
40 Logic EDB9307A Evaluation Board.
41
36config MACH_EDB9312 42config MACH_EDB9312
37 bool "Support Cirrus Logic EDB9312" 43 bool "Support Cirrus Logic EDB9312"
38 help 44 help
diff --git a/arch/arm/mach-ep93xx/Makefile b/arch/arm/mach-ep93xx/Makefile
index c1252ca9648e..944e42d51646 100644
--- a/arch/arm/mach-ep93xx/Makefile
+++ b/arch/arm/mach-ep93xx/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_MACH_ADSSPHERE) += adssphere.o
10obj-$(CONFIG_MACH_EDB9302) += edb9302.o 10obj-$(CONFIG_MACH_EDB9302) += edb9302.o
11obj-$(CONFIG_MACH_EDB9302A) += edb9302a.o 11obj-$(CONFIG_MACH_EDB9302A) += edb9302a.o
12obj-$(CONFIG_MACH_EDB9307) += edb9307.o 12obj-$(CONFIG_MACH_EDB9307) += edb9307.o
13obj-$(CONFIG_MACH_EDB9307A) += edb9307a.o
13obj-$(CONFIG_MACH_EDB9312) += edb9312.o 14obj-$(CONFIG_MACH_EDB9312) += edb9312.o
14obj-$(CONFIG_MACH_EDB9315) += edb9315.o 15obj-$(CONFIG_MACH_EDB9315) += edb9315.o
15obj-$(CONFIG_MACH_EDB9315A) += edb9315a.o 16obj-$(CONFIG_MACH_EDB9315A) += edb9315a.o
diff --git a/arch/arm/mach-ep93xx/adssphere.c b/arch/arm/mach-ep93xx/adssphere.c
index 561db73ec1ae..3fbd9b0fbe24 100644
--- a/arch/arm/mach-ep93xx/adssphere.c
+++ b/arch/arm/mach-ep93xx/adssphere.c
@@ -19,6 +19,7 @@
19#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/i2c.h>
22#include <mach/hardware.h> 23#include <mach/hardware.h>
23#include <asm/mach-types.h> 24#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
@@ -28,8 +29,8 @@ static struct physmap_flash_data adssphere_flash_data = {
28}; 29};
29 30
30static struct resource adssphere_flash_resource = { 31static struct resource adssphere_flash_resource = {
31 .start = 0x60000000, 32 .start = EP93XX_CS6_PHYS_BASE,
32 .end = 0x61ffffff, 33 .end = EP93XX_CS6_PHYS_BASE + SZ_32M - 1,
33 .flags = IORESOURCE_MEM, 34 .flags = IORESOURCE_MEM,
34}; 35};
35 36
@@ -59,7 +60,7 @@ MACHINE_START(ADSSPHERE, "ADS Sphere board")
59 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ 60 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
60 .phys_io = EP93XX_APB_PHYS_BASE, 61 .phys_io = EP93XX_APB_PHYS_BASE,
61 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, 62 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
62 .boot_params = 0x00000100, 63 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
63 .map_io = ep93xx_map_io, 64 .map_io = ep93xx_map_io,
64 .init_irq = ep93xx_init_irq, 65 .init_irq = ep93xx_init_irq,
65 .timer = &ep93xx_timer, 66 .timer = &ep93xx_timer,
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index 8c9f2491dccc..96049283a10a 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -16,11 +16,12 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/string.h> 17#include <linux/string.h>
18#include <linux/io.h> 18#include <linux/io.h>
19
20#include <asm/clkdev.h>
19#include <asm/div64.h> 21#include <asm/div64.h>
20#include <mach/hardware.h> 22#include <mach/hardware.h>
21 23
22struct clk { 24struct clk {
23 char *name;
24 unsigned long rate; 25 unsigned long rate;
25 int users; 26 int users;
26 u32 enable_reg; 27 u32 enable_reg;
@@ -28,53 +29,33 @@ struct clk {
28}; 29};
29 30
30static struct clk clk_uart = { 31static struct clk clk_uart = {
31 .name = "UARTCLK",
32 .rate = 14745600, 32 .rate = 14745600,
33}; 33};
34static struct clk clk_pll1 = { 34static struct clk clk_pll1;
35 .name = "pll1", 35static struct clk clk_f;
36}; 36static struct clk clk_h;
37static struct clk clk_f = { 37static struct clk clk_p;
38 .name = "fclk", 38static struct clk clk_pll2;
39};
40static struct clk clk_h = {
41 .name = "hclk",
42};
43static struct clk clk_p = {
44 .name = "pclk",
45};
46static struct clk clk_pll2 = {
47 .name = "pll2",
48};
49static struct clk clk_usb_host = { 39static struct clk clk_usb_host = {
50 .name = "usb_host",
51 .enable_reg = EP93XX_SYSCON_CLOCK_CONTROL, 40 .enable_reg = EP93XX_SYSCON_CLOCK_CONTROL,
52 .enable_mask = EP93XX_SYSCON_CLOCK_USH_EN, 41 .enable_mask = EP93XX_SYSCON_CLOCK_USH_EN,
53}; 42};
54 43
55 44#define INIT_CK(dev,con,ck) \
56static struct clk *clocks[] = { 45 { .dev_id = dev, .con_id = con, .clk = ck }
57 &clk_uart, 46
58 &clk_pll1, 47static struct clk_lookup clocks[] = {
59 &clk_f, 48 INIT_CK("apb:uart1", NULL, &clk_uart),
60 &clk_h, 49 INIT_CK("apb:uart2", NULL, &clk_uart),
61 &clk_p, 50 INIT_CK("apb:uart3", NULL, &clk_uart),
62 &clk_pll2, 51 INIT_CK(NULL, "pll1", &clk_pll1),
63 &clk_usb_host, 52 INIT_CK(NULL, "fclk", &clk_f),
53 INIT_CK(NULL, "hclk", &clk_h),
54 INIT_CK(NULL, "pclk", &clk_p),
55 INIT_CK(NULL, "pll2", &clk_pll2),
56 INIT_CK(NULL, "usb_host", &clk_usb_host),
64}; 57};
65 58
66struct clk *clk_get(struct device *dev, const char *id)
67{
68 int i;
69
70 for (i = 0; i < ARRAY_SIZE(clocks); i++) {
71 if (!strcmp(clocks[i]->name, id))
72 return clocks[i];
73 }
74
75 return ERR_PTR(-ENOENT);
76}
77EXPORT_SYMBOL(clk_get);
78 59
79int clk_enable(struct clk *clk) 60int clk_enable(struct clk *clk)
80{ 61{
@@ -106,12 +87,6 @@ unsigned long clk_get_rate(struct clk *clk)
106} 87}
107EXPORT_SYMBOL(clk_get_rate); 88EXPORT_SYMBOL(clk_get_rate);
108 89
109void clk_put(struct clk *clk)
110{
111}
112EXPORT_SYMBOL(clk_put);
113
114
115 90
116static char fclk_divisors[] = { 1, 2, 4, 8, 16, 1, 1, 1 }; 91static char fclk_divisors[] = { 1, 2, 4, 8, 16, 1, 1, 1 };
117static char hclk_divisors[] = { 1, 2, 4, 5, 6, 8, 16, 32 }; 92static char hclk_divisors[] = { 1, 2, 4, 5, 6, 8, 16, 32 };
@@ -138,6 +113,7 @@ static unsigned long calc_pll_rate(u32 config_word)
138static int __init ep93xx_clock_init(void) 113static int __init ep93xx_clock_init(void)
139{ 114{
140 u32 value; 115 u32 value;
116 int i;
141 117
142 value = __raw_readl(EP93XX_SYSCON_CLOCK_SET1); 118 value = __raw_readl(EP93XX_SYSCON_CLOCK_SET1);
143 if (!(value & 0x00800000)) { /* PLL1 bypassed? */ 119 if (!(value & 0x00800000)) { /* PLL1 bypassed? */
@@ -165,6 +141,8 @@ static int __init ep93xx_clock_init(void)
165 clk_f.rate / 1000000, clk_h.rate / 1000000, 141 clk_f.rate / 1000000, clk_h.rate / 1000000,
166 clk_p.rate / 1000000); 142 clk_p.rate / 1000000);
167 143
144 for (i = 0; i < ARRAY_SIZE(clocks); i++)
145 clkdev_add(&clocks[i]);
168 return 0; 146 return 0;
169} 147}
170arch_initcall(ep93xx_clock_init); 148arch_initcall(ep93xx_clock_init);
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 48345fb34613..6d9152de6074 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -34,6 +34,8 @@
34#include <linux/amba/bus.h> 34#include <linux/amba/bus.h>
35#include <linux/amba/serial.h> 35#include <linux/amba/serial.h>
36#include <linux/io.h> 36#include <linux/io.h>
37#include <linux/i2c.h>
38#include <linux/i2c-gpio.h>
37 39
38#include <asm/types.h> 40#include <asm/types.h>
39#include <asm/setup.h> 41#include <asm/setup.h>
@@ -153,12 +155,14 @@ static unsigned char gpio_int_unmasked[3];
153static unsigned char gpio_int_enabled[3]; 155static unsigned char gpio_int_enabled[3];
154static unsigned char gpio_int_type1[3]; 156static unsigned char gpio_int_type1[3];
155static unsigned char gpio_int_type2[3]; 157static unsigned char gpio_int_type2[3];
158static unsigned char gpio_int_debouce[3];
156 159
157/* Port ordering is: A B F */ 160/* Port ordering is: A B F */
158static const u8 int_type1_register_offset[3] = { 0x90, 0xac, 0x4c }; 161static const u8 int_type1_register_offset[3] = { 0x90, 0xac, 0x4c };
159static const u8 int_type2_register_offset[3] = { 0x94, 0xb0, 0x50 }; 162static const u8 int_type2_register_offset[3] = { 0x94, 0xb0, 0x50 };
160static const u8 eoi_register_offset[3] = { 0x98, 0xb4, 0x54 }; 163static const u8 eoi_register_offset[3] = { 0x98, 0xb4, 0x54 };
161static const u8 int_en_register_offset[3] = { 0x9c, 0xb8, 0x58 }; 164static const u8 int_en_register_offset[3] = { 0x9c, 0xb8, 0x58 };
165static const u8 int_debounce_register_offset[3] = { 0xa8, 0xc4, 0x64 };
162 166
163void ep93xx_gpio_update_int_params(unsigned port) 167void ep93xx_gpio_update_int_params(unsigned port)
164{ 168{
@@ -181,6 +185,22 @@ void ep93xx_gpio_int_mask(unsigned line)
181 gpio_int_unmasked[line >> 3] &= ~(1 << (line & 7)); 185 gpio_int_unmasked[line >> 3] &= ~(1 << (line & 7));
182} 186}
183 187
188void ep93xx_gpio_int_debounce(unsigned int irq, int enable)
189{
190 int line = irq_to_gpio(irq);
191 int port = line >> 3;
192 int port_mask = 1 << (line & 7);
193
194 if (enable)
195 gpio_int_debouce[port] |= port_mask;
196 else
197 gpio_int_debouce[port] &= ~port_mask;
198
199 __raw_writeb(gpio_int_debouce[port],
200 EP93XX_GPIO_REG(int_debounce_register_offset[port]));
201}
202EXPORT_SYMBOL(ep93xx_gpio_int_debounce);
203
184/************************************************************************* 204/*************************************************************************
185 * EP93xx IRQ handling 205 * EP93xx IRQ handling
186 *************************************************************************/ 206 *************************************************************************/
@@ -389,7 +409,7 @@ static struct amba_pl010_data ep93xx_uart_data = {
389 409
390static struct amba_device uart1_device = { 410static struct amba_device uart1_device = {
391 .dev = { 411 .dev = {
392 .bus_id = "apb:uart1", 412 .init_name = "apb:uart1",
393 .platform_data = &ep93xx_uart_data, 413 .platform_data = &ep93xx_uart_data,
394 }, 414 },
395 .res = { 415 .res = {
@@ -403,7 +423,7 @@ static struct amba_device uart1_device = {
403 423
404static struct amba_device uart2_device = { 424static struct amba_device uart2_device = {
405 .dev = { 425 .dev = {
406 .bus_id = "apb:uart2", 426 .init_name = "apb:uart2",
407 .platform_data = &ep93xx_uart_data, 427 .platform_data = &ep93xx_uart_data,
408 }, 428 },
409 .res = { 429 .res = {
@@ -417,7 +437,7 @@ static struct amba_device uart2_device = {
417 437
418static struct amba_device uart3_device = { 438static struct amba_device uart3_device = {
419 .dev = { 439 .dev = {
420 .bus_id = "apb:uart3", 440 .init_name = "apb:uart3",
421 .platform_data = &ep93xx_uart_data, 441 .platform_data = &ep93xx_uart_data,
422 }, 442 },
423 .res = { 443 .res = {
@@ -497,6 +517,26 @@ void __init ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr)
497 platform_device_register(&ep93xx_eth_device); 517 platform_device_register(&ep93xx_eth_device);
498} 518}
499 519
520static struct i2c_gpio_platform_data ep93xx_i2c_data = {
521 .sda_pin = EP93XX_GPIO_LINE_EEDAT,
522 .sda_is_open_drain = 0,
523 .scl_pin = EP93XX_GPIO_LINE_EECLK,
524 .scl_is_open_drain = 0,
525 .udelay = 2,
526};
527
528static struct platform_device ep93xx_i2c_device = {
529 .name = "i2c-gpio",
530 .id = 0,
531 .dev.platform_data = &ep93xx_i2c_data,
532};
533
534void __init ep93xx_register_i2c(struct i2c_board_info *devices, int num)
535{
536 i2c_register_board_info(0, devices, num);
537 platform_device_register(&ep93xx_i2c_device);
538}
539
500extern void ep93xx_gpio_init(void); 540extern void ep93xx_gpio_init(void);
501 541
502void __init ep93xx_init_devices(void) 542void __init ep93xx_init_devices(void)
diff --git a/arch/arm/mach-ep93xx/edb9302.c b/arch/arm/mach-ep93xx/edb9302.c
index e4add5bdccfd..8bf8d7c78f1a 100644
--- a/arch/arm/mach-ep93xx/edb9302.c
+++ b/arch/arm/mach-ep93xx/edb9302.c
@@ -19,6 +19,7 @@
19#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/i2c.h>
22#include <mach/hardware.h> 23#include <mach/hardware.h>
23#include <asm/mach-types.h> 24#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
@@ -28,8 +29,8 @@ static struct physmap_flash_data edb9302_flash_data = {
28}; 29};
29 30
30static struct resource edb9302_flash_resource = { 31static struct resource edb9302_flash_resource = {
31 .start = 0x60000000, 32 .start = EP93XX_CS6_PHYS_BASE,
32 .end = 0x60ffffff, 33 .end = EP93XX_CS6_PHYS_BASE + SZ_16M - 1,
33 .flags = IORESOURCE_MEM, 34 .flags = IORESOURCE_MEM,
34}; 35};
35 36
@@ -59,7 +60,7 @@ MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board")
59 /* Maintainer: George Kashperko <george@chas.com.ua> */ 60 /* Maintainer: George Kashperko <george@chas.com.ua> */
60 .phys_io = EP93XX_APB_PHYS_BASE, 61 .phys_io = EP93XX_APB_PHYS_BASE,
61 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, 62 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
62 .boot_params = 0x00000100, 63 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
63 .map_io = ep93xx_map_io, 64 .map_io = ep93xx_map_io,
64 .init_irq = ep93xx_init_irq, 65 .init_irq = ep93xx_init_irq,
65 .timer = &ep93xx_timer, 66 .timer = &ep93xx_timer,
diff --git a/arch/arm/mach-ep93xx/edb9302a.c b/arch/arm/mach-ep93xx/edb9302a.c
index 02c4405afed7..a352c57c7b46 100644
--- a/arch/arm/mach-ep93xx/edb9302a.c
+++ b/arch/arm/mach-ep93xx/edb9302a.c
@@ -19,6 +19,7 @@
19#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/i2c.h>
22#include <mach/hardware.h> 23#include <mach/hardware.h>
23#include <asm/mach-types.h> 24#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
@@ -28,8 +29,8 @@ static struct physmap_flash_data edb9302a_flash_data = {
28}; 29};
29 30
30static struct resource edb9302a_flash_resource = { 31static struct resource edb9302a_flash_resource = {
31 .start = 0x60000000, 32 .start = EP93XX_CS6_PHYS_BASE,
32 .end = 0x60ffffff, 33 .end = EP93XX_CS6_PHYS_BASE + SZ_16M - 1,
33 .flags = IORESOURCE_MEM, 34 .flags = IORESOURCE_MEM,
34}; 35};
35 36
@@ -44,7 +45,7 @@ static struct platform_device edb9302a_flash = {
44}; 45};
45 46
46static struct ep93xx_eth_data edb9302a_eth_data = { 47static struct ep93xx_eth_data edb9302a_eth_data = {
47 .phy_id = 1, 48 .phy_id = 1,
48}; 49};
49 50
50static void __init edb9302a_init_machine(void) 51static void __init edb9302a_init_machine(void)
@@ -59,7 +60,7 @@ MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board")
59 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ 60 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
60 .phys_io = EP93XX_APB_PHYS_BASE, 61 .phys_io = EP93XX_APB_PHYS_BASE,
61 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, 62 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
62 .boot_params = 0xc0000100, 63 .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
63 .map_io = ep93xx_map_io, 64 .map_io = ep93xx_map_io,
64 .init_irq = ep93xx_init_irq, 65 .init_irq = ep93xx_init_irq,
65 .timer = &ep93xx_timer, 66 .timer = &ep93xx_timer,
diff --git a/arch/arm/mach-ep93xx/edb9307.c b/arch/arm/mach-ep93xx/edb9307.c
index 040edbd2ea05..5ab22f63a4eb 100644
--- a/arch/arm/mach-ep93xx/edb9307.c
+++ b/arch/arm/mach-ep93xx/edb9307.c
@@ -19,6 +19,7 @@
19#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/i2c.h>
22#include <mach/hardware.h> 23#include <mach/hardware.h>
23#include <asm/mach-types.h> 24#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
@@ -28,8 +29,8 @@ static struct physmap_flash_data edb9307_flash_data = {
28}; 29};
29 30
30static struct resource edb9307_flash_resource = { 31static struct resource edb9307_flash_resource = {
31 .start = 0x60000000, 32 .start = EP93XX_CS6_PHYS_BASE,
32 .end = 0x61ffffff, 33 .end = EP93XX_CS6_PHYS_BASE + SZ_32M - 1,
33 .flags = IORESOURCE_MEM, 34 .flags = IORESOURCE_MEM,
34}; 35};
35 36
@@ -44,7 +45,7 @@ static struct platform_device edb9307_flash = {
44}; 45};
45 46
46static struct ep93xx_eth_data edb9307_eth_data = { 47static struct ep93xx_eth_data edb9307_eth_data = {
47 .phy_id = 1, 48 .phy_id = 1,
48}; 49};
49 50
50static void __init edb9307_init_machine(void) 51static void __init edb9307_init_machine(void)
@@ -59,7 +60,7 @@ MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board")
59 /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */ 60 /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */
60 .phys_io = EP93XX_APB_PHYS_BASE, 61 .phys_io = EP93XX_APB_PHYS_BASE,
61 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, 62 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
62 .boot_params = 0x00000100, 63 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
63 .map_io = ep93xx_map_io, 64 .map_io = ep93xx_map_io,
64 .init_irq = ep93xx_init_irq, 65 .init_irq = ep93xx_init_irq,
65 .timer = &ep93xx_timer, 66 .timer = &ep93xx_timer,
diff --git a/arch/arm/mach-ep93xx/edb9307a.c b/arch/arm/mach-ep93xx/edb9307a.c
new file mode 100644
index 000000000000..5b5c22b681be
--- /dev/null
+++ b/arch/arm/mach-ep93xx/edb9307a.c
@@ -0,0 +1,68 @@
1/*
2 * arch/arm/mach-ep93xx/edb9307a.c
3 * Cirrus Logic EDB9307A support.
4 *
5 * Copyright (C) 2008 H Hartley Sweeten <hsweeten@visionengravers.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or (at
10 * your option) any later version.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/mm.h>
16#include <linux/sched.h>
17#include <linux/interrupt.h>
18#include <linux/ioport.h>
19#include <linux/mtd/physmap.h>
20#include <linux/platform_device.h>
21#include <linux/io.h>
22#include <linux/i2c.h>
23#include <mach/hardware.h>
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26
27static struct physmap_flash_data edb9307a_flash_data = {
28 .width = 2,
29};
30
31static struct resource edb9307a_flash_resource = {
32 .start = EP93XX_CS6_PHYS_BASE,
33 .end = EP93XX_CS6_PHYS_BASE + SZ_16M - 1,
34 .flags = IORESOURCE_MEM,
35};
36
37static struct platform_device edb9307a_flash = {
38 .name = "physmap-flash",
39 .id = 0,
40 .dev = {
41 .platform_data = &edb9307a_flash_data,
42 },
43 .num_resources = 1,
44 .resource = &edb9307a_flash_resource,
45};
46
47static struct ep93xx_eth_data edb9307a_eth_data = {
48 .phy_id = 1,
49};
50
51static void __init edb9307a_init_machine(void)
52{
53 ep93xx_init_devices();
54 platform_device_register(&edb9307a_flash);
55
56 ep93xx_register_eth(&edb9307a_eth_data, 1);
57}
58
59MACHINE_START(EDB9307A, "Cirrus Logic EDB9307A Evaluation Board")
60 /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
61 .phys_io = EP93XX_APB_PHYS_BASE,
62 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
63 .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
64 .map_io = ep93xx_map_io,
65 .init_irq = ep93xx_init_irq,
66 .timer = &ep93xx_timer,
67 .init_machine = edb9307a_init_machine,
68MACHINE_END
diff --git a/arch/arm/mach-ep93xx/edb9312.c b/arch/arm/mach-ep93xx/edb9312.c
index 6853e302bc3a..d7179f66d804 100644
--- a/arch/arm/mach-ep93xx/edb9312.c
+++ b/arch/arm/mach-ep93xx/edb9312.c
@@ -20,6 +20,7 @@
20#include <linux/mtd/physmap.h> 20#include <linux/mtd/physmap.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/i2c.h>
23#include <mach/hardware.h> 24#include <mach/hardware.h>
24#include <asm/mach-types.h> 25#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
@@ -29,8 +30,8 @@ static struct physmap_flash_data edb9312_flash_data = {
29}; 30};
30 31
31static struct resource edb9312_flash_resource = { 32static struct resource edb9312_flash_resource = {
32 .start = 0x60000000, 33 .start = EP93XX_CS6_PHYS_BASE,
33 .end = 0x61ffffff, 34 .end = EP93XX_CS6_PHYS_BASE + SZ_32M - 1,
34 .flags = IORESOURCE_MEM, 35 .flags = IORESOURCE_MEM,
35}; 36};
36 37
@@ -45,7 +46,7 @@ static struct platform_device edb9312_flash = {
45}; 46};
46 47
47static struct ep93xx_eth_data edb9312_eth_data = { 48static struct ep93xx_eth_data edb9312_eth_data = {
48 .phy_id = 1, 49 .phy_id = 1,
49}; 50};
50 51
51static void __init edb9312_init_machine(void) 52static void __init edb9312_init_machine(void)
@@ -60,7 +61,7 @@ MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board")
60 /* Maintainer: Toufeeq Hussain <toufeeq_hussain@infosys.com> */ 61 /* Maintainer: Toufeeq Hussain <toufeeq_hussain@infosys.com> */
61 .phys_io = EP93XX_APB_PHYS_BASE, 62 .phys_io = EP93XX_APB_PHYS_BASE,
62 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, 63 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
63 .boot_params = 0x00000100, 64 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
64 .map_io = ep93xx_map_io, 65 .map_io = ep93xx_map_io,
65 .init_irq = ep93xx_init_irq, 66 .init_irq = ep93xx_init_irq,
66 .timer = &ep93xx_timer, 67 .timer = &ep93xx_timer,
diff --git a/arch/arm/mach-ep93xx/edb9315.c b/arch/arm/mach-ep93xx/edb9315.c
index 9469b350d253..025af6eaca10 100644
--- a/arch/arm/mach-ep93xx/edb9315.c
+++ b/arch/arm/mach-ep93xx/edb9315.c
@@ -19,6 +19,7 @@
19#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/i2c.h>
22#include <mach/hardware.h> 23#include <mach/hardware.h>
23#include <asm/mach-types.h> 24#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
@@ -28,8 +29,8 @@ static struct physmap_flash_data edb9315_flash_data = {
28}; 29};
29 30
30static struct resource edb9315_flash_resource = { 31static struct resource edb9315_flash_resource = {
31 .start = 0x60000000, 32 .start = EP93XX_CS6_PHYS_BASE,
32 .end = 0x61ffffff, 33 .end = EP93XX_CS6_PHYS_BASE + SZ_32M - 1,
33 .flags = IORESOURCE_MEM, 34 .flags = IORESOURCE_MEM,
34}; 35};
35 36
@@ -44,7 +45,7 @@ static struct platform_device edb9315_flash = {
44}; 45};
45 46
46static struct ep93xx_eth_data edb9315_eth_data = { 47static struct ep93xx_eth_data edb9315_eth_data = {
47 .phy_id = 1, 48 .phy_id = 1,
48}; 49};
49 50
50static void __init edb9315_init_machine(void) 51static void __init edb9315_init_machine(void)
@@ -59,7 +60,7 @@ MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board")
59 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ 60 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
60 .phys_io = EP93XX_APB_PHYS_BASE, 61 .phys_io = EP93XX_APB_PHYS_BASE,
61 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, 62 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
62 .boot_params = 0x00000100, 63 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
63 .map_io = ep93xx_map_io, 64 .map_io = ep93xx_map_io,
64 .init_irq = ep93xx_init_irq, 65 .init_irq = ep93xx_init_irq,
65 .timer = &ep93xx_timer, 66 .timer = &ep93xx_timer,
diff --git a/arch/arm/mach-ep93xx/edb9315a.c b/arch/arm/mach-ep93xx/edb9315a.c
index 584457ce7c80..4c9cc8a39f5c 100644
--- a/arch/arm/mach-ep93xx/edb9315a.c
+++ b/arch/arm/mach-ep93xx/edb9315a.c
@@ -19,6 +19,7 @@
19#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/i2c.h>
22#include <mach/hardware.h> 23#include <mach/hardware.h>
23#include <asm/mach-types.h> 24#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
@@ -28,8 +29,8 @@ static struct physmap_flash_data edb9315a_flash_data = {
28}; 29};
29 30
30static struct resource edb9315a_flash_resource = { 31static struct resource edb9315a_flash_resource = {
31 .start = 0x60000000, 32 .start = EP93XX_CS6_PHYS_BASE,
32 .end = 0x60ffffff, 33 .end = EP93XX_CS6_PHYS_BASE + SZ_16M - 1,
33 .flags = IORESOURCE_MEM, 34 .flags = IORESOURCE_MEM,
34}; 35};
35 36
@@ -44,7 +45,7 @@ static struct platform_device edb9315a_flash = {
44}; 45};
45 46
46static struct ep93xx_eth_data edb9315a_eth_data = { 47static struct ep93xx_eth_data edb9315a_eth_data = {
47 .phy_id = 1, 48 .phy_id = 1,
48}; 49};
49 50
50static void __init edb9315a_init_machine(void) 51static void __init edb9315a_init_machine(void)
@@ -59,7 +60,7 @@ MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board")
59 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ 60 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
60 .phys_io = EP93XX_APB_PHYS_BASE, 61 .phys_io = EP93XX_APB_PHYS_BASE,
61 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, 62 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
62 .boot_params = 0xc0000100, 63 .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
63 .map_io = ep93xx_map_io, 64 .map_io = ep93xx_map_io,
64 .init_irq = ep93xx_init_irq, 65 .init_irq = ep93xx_init_irq,
65 .timer = &ep93xx_timer, 66 .timer = &ep93xx_timer,
diff --git a/arch/arm/mach-ep93xx/gesbc9312.c b/arch/arm/mach-ep93xx/gesbc9312.c
index 035b24e31b64..3bad500b71b6 100644
--- a/arch/arm/mach-ep93xx/gesbc9312.c
+++ b/arch/arm/mach-ep93xx/gesbc9312.c
@@ -19,6 +19,7 @@
19#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/i2c.h>
22#include <mach/hardware.h> 23#include <mach/hardware.h>
23#include <asm/mach-types.h> 24#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
@@ -28,8 +29,8 @@ static struct physmap_flash_data gesbc9312_flash_data = {
28}; 29};
29 30
30static struct resource gesbc9312_flash_resource = { 31static struct resource gesbc9312_flash_resource = {
31 .start = 0x60000000, 32 .start = EP93XX_CS6_PHYS_BASE,
32 .end = 0x607fffff, 33 .end = EP93XX_CS6_PHYS_BASE + SZ_8M - 1,
33 .flags = IORESOURCE_MEM, 34 .flags = IORESOURCE_MEM,
34}; 35};
35 36
@@ -59,7 +60,7 @@ MACHINE_START(GESBC9312, "Glomation GESBC-9312-sx")
59 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ 60 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
60 .phys_io = EP93XX_APB_PHYS_BASE, 61 .phys_io = EP93XX_APB_PHYS_BASE,
61 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, 62 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
62 .boot_params = 0x00000100, 63 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
63 .map_io = ep93xx_map_io, 64 .map_io = ep93xx_map_io,
64 .init_irq = ep93xx_init_irq, 65 .init_irq = ep93xx_init_irq,
65 .timer = &ep93xx_timer, 66 .timer = &ep93xx_timer,
diff --git a/arch/arm/mach-ep93xx/include/mach/clkdev.h b/arch/arm/mach-ep93xx/include/mach/clkdev.h
new file mode 100644
index 000000000000..04b37a89801c
--- /dev/null
+++ b/arch/arm/mach-ep93xx/include/mach/clkdev.h
@@ -0,0 +1,7 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do { } while (0)
6
7#endif
diff --git a/arch/arm/mach-ep93xx/include/mach/dma.h b/arch/arm/mach-ep93xx/include/mach/dma.h
deleted file mode 100644
index d0fa9656e92f..000000000000
--- a/arch/arm/mach-ep93xx/include/mach/dma.h
+++ /dev/null
@@ -1,3 +0,0 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/dma.h
3 */
diff --git a/arch/arm/mach-ep93xx/include/mach/gpio.h b/arch/arm/mach-ep93xx/include/mach/gpio.h
index f7020414c5df..0a1498ae899a 100644
--- a/arch/arm/mach-ep93xx/include/mach/gpio.h
+++ b/arch/arm/mach-ep93xx/include/mach/gpio.h
@@ -99,6 +99,8 @@
99/* maximum value for irq capable line identifiers */ 99/* maximum value for irq capable line identifiers */
100#define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7) 100#define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7)
101 101
102extern void ep93xx_gpio_int_debounce(unsigned int irq, int enable);
103
102/* new generic GPIO API - see Documentation/gpio.txt */ 104/* new generic GPIO API - see Documentation/gpio.txt */
103 105
104#include <asm-generic/gpio.h> 106#include <asm-generic/gpio.h>
diff --git a/arch/arm/mach-ep93xx/include/mach/io.h b/arch/arm/mach-ep93xx/include/mach/io.h
index 1ab9a90ad339..fd5f081cc8b7 100644
--- a/arch/arm/mach-ep93xx/include/mach/io.h
+++ b/arch/arm/mach-ep93xx/include/mach/io.h
@@ -4,5 +4,5 @@
4 4
5#define IO_SPACE_LIMIT 0xffffffff 5#define IO_SPACE_LIMIT 0xffffffff
6 6
7#define __io(p) ((void __iomem *)(p)) 7#define __io(p) __typesafe_io(p)
8#define __mem_pci(p) (p) 8#define __mem_pci(p) (p)
diff --git a/arch/arm/mach-ep93xx/include/mach/memory.h b/arch/arm/mach-ep93xx/include/mach/memory.h
index f1b633590752..5c80c3c8158d 100644
--- a/arch/arm/mach-ep93xx/include/mach/memory.h
+++ b/arch/arm/mach-ep93xx/include/mach/memory.h
@@ -7,8 +7,4 @@
7 7
8#define PHYS_OFFSET UL(0x00000000) 8#define PHYS_OFFSET UL(0x00000000)
9 9
10#define __bus_to_virt(x) __phys_to_virt(x)
11#define __virt_to_bus(x) __virt_to_phys(x)
12
13
14#endif 10#endif
diff --git a/arch/arm/mach-ep93xx/include/mach/platform.h b/arch/arm/mach-ep93xx/include/mach/platform.h
index db2489d3bda7..88f7e88f152f 100644
--- a/arch/arm/mach-ep93xx/include/mach/platform.h
+++ b/arch/arm/mach-ep93xx/include/mach/platform.h
@@ -14,6 +14,7 @@ void ep93xx_map_io(void);
14void ep93xx_init_irq(void); 14void ep93xx_init_irq(void);
15void ep93xx_init_time(unsigned long); 15void ep93xx_init_time(unsigned long);
16void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr); 16void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr);
17void ep93xx_register_i2c(struct i2c_board_info *devices, int num);
17void ep93xx_init_devices(void); 18void ep93xx_init_devices(void);
18extern struct sys_timer ep93xx_timer; 19extern struct sys_timer ep93xx_timer;
19 20
diff --git a/arch/arm/mach-ep93xx/micro9.c b/arch/arm/mach-ep93xx/micro9.c
index c2197236b632..15d6815d78c4 100644
--- a/arch/arm/mach-ep93xx/micro9.c
+++ b/arch/arm/mach-ep93xx/micro9.c
@@ -17,6 +17,7 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/sched.h> 18#include <linux/sched.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/i2c.h>
20#include <linux/mtd/physmap.h> 21#include <linux/mtd/physmap.h>
21 22
22#include <mach/hardware.h> 23#include <mach/hardware.h>
@@ -25,7 +26,7 @@
25#include <asm/mach-types.h> 26#include <asm/mach-types.h>
26 27
27static struct ep93xx_eth_data micro9_eth_data = { 28static struct ep93xx_eth_data micro9_eth_data = {
28 .phy_id = 0x1f, 29 .phy_id = 0x1f,
29}; 30};
30 31
31static void __init micro9_init(void) 32static void __init micro9_init(void)
@@ -38,46 +39,46 @@ static void __init micro9_init(void)
38 */ 39 */
39#ifdef CONFIG_MACH_MICRO9H 40#ifdef CONFIG_MACH_MICRO9H
40static struct physmap_flash_data micro9h_flash_data = { 41static struct physmap_flash_data micro9h_flash_data = {
41 .width = 4, 42 .width = 4,
42}; 43};
43 44
44static struct resource micro9h_flash_resource = { 45static struct resource micro9h_flash_resource = {
45 .start = 0x10000000, 46 .start = EP93XX_CS1_PHYS_BASE,
46 .end = 0x13ffffff, 47 .end = EP93XX_CS1_PHYS_BASE + SZ_64M - 1,
47 .flags = IORESOURCE_MEM, 48 .flags = IORESOURCE_MEM,
48}; 49};
49 50
50static struct platform_device micro9h_flash = { 51static struct platform_device micro9h_flash = {
51 .name = "physmap-flash", 52 .name = "physmap-flash",
52 .id = 0, 53 .id = 0,
53 .dev = { 54 .dev = {
54 .platform_data = &micro9h_flash_data, 55 .platform_data = &micro9h_flash_data,
55 }, 56 },
56 .num_resources = 1, 57 .num_resources = 1,
57 .resource = &micro9h_flash_resource, 58 .resource = &micro9h_flash_resource,
58}; 59};
59 60
60static void __init micro9h_init(void) 61static void __init micro9h_init(void)
61{ 62{
62 platform_device_register(&micro9h_flash); 63 platform_device_register(&micro9h_flash);
63} 64}
64 65
65static void __init micro9h_init_machine(void) 66static void __init micro9h_init_machine(void)
66{ 67{
67 ep93xx_init_devices(); 68 ep93xx_init_devices();
68 micro9_init(); 69 micro9_init();
69 micro9h_init(); 70 micro9h_init();
70} 71}
71 72
72MACHINE_START(MICRO9, "Contec Hypercontrol Micro9-H") 73MACHINE_START(MICRO9, "Contec Hypercontrol Micro9-H")
73 /* Maintainer: Manfred Gruber <manfred.gruber@contec.at> */ 74 /* Maintainer: Manfred Gruber <manfred.gruber@contec.at> */
74 .phys_io = EP93XX_APB_PHYS_BASE, 75 .phys_io = EP93XX_APB_PHYS_BASE,
75 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, 76 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
76 .boot_params = 0x00000100, 77 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
77 .map_io = ep93xx_map_io, 78 .map_io = ep93xx_map_io,
78 .init_irq = ep93xx_init_irq, 79 .init_irq = ep93xx_init_irq,
79 .timer = &ep93xx_timer, 80 .timer = &ep93xx_timer,
80 .init_machine = micro9h_init_machine, 81 .init_machine = micro9h_init_machine,
81MACHINE_END 82MACHINE_END
82#endif 83#endif
83 84
@@ -87,19 +88,19 @@ MACHINE_END
87#ifdef CONFIG_MACH_MICRO9M 88#ifdef CONFIG_MACH_MICRO9M
88static void __init micro9m_init_machine(void) 89static void __init micro9m_init_machine(void)
89{ 90{
90 ep93xx_init_devices(); 91 ep93xx_init_devices();
91 micro9_init(); 92 micro9_init();
92} 93}
93 94
94MACHINE_START(MICRO9M, "Contec Hypercontrol Micro9-M") 95MACHINE_START(MICRO9M, "Contec Hypercontrol Micro9-M")
95 /* Maintainer: Manfred Gruber <manfred.gruber@contec.at> */ 96 /* Maintainer: Manfred Gruber <manfred.gruber@contec.at> */
96 .phys_io = EP93XX_APB_PHYS_BASE, 97 .phys_io = EP93XX_APB_PHYS_BASE,
97 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, 98 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
98 .boot_params = 0x00000100, 99 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
99 .map_io = ep93xx_map_io, 100 .map_io = ep93xx_map_io,
100 .init_irq = ep93xx_init_irq, 101 .init_irq = ep93xx_init_irq,
101 .timer = &ep93xx_timer, 102 .timer = &ep93xx_timer,
102 .init_machine = micro9m_init_machine, 103 .init_machine = micro9m_init_machine,
103MACHINE_END 104MACHINE_END
104#endif 105#endif
105 106
@@ -109,19 +110,19 @@ MACHINE_END
109#ifdef CONFIG_MACH_MICRO9L 110#ifdef CONFIG_MACH_MICRO9L
110static void __init micro9l_init_machine(void) 111static void __init micro9l_init_machine(void)
111{ 112{
112 ep93xx_init_devices(); 113 ep93xx_init_devices();
113 micro9_init(); 114 micro9_init();
114} 115}
115 116
116MACHINE_START(MICRO9L, "Contec Hypercontrol Micro9-L") 117MACHINE_START(MICRO9L, "Contec Hypercontrol Micro9-L")
117 /* Maintainer: Manfred Gruber <manfred.gruber@contec.at> */ 118 /* Maintainer: Manfred Gruber <manfred.gruber@contec.at> */
118 .phys_io = EP93XX_APB_PHYS_BASE, 119 .phys_io = EP93XX_APB_PHYS_BASE,
119 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, 120 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
120 .boot_params = 0x00000100, 121 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
121 .map_io = ep93xx_map_io, 122 .map_io = ep93xx_map_io,
122 .init_irq = ep93xx_init_irq, 123 .init_irq = ep93xx_init_irq,
123 .timer = &ep93xx_timer, 124 .timer = &ep93xx_timer,
124 .init_machine = micro9l_init_machine, 125 .init_machine = micro9l_init_machine,
125MACHINE_END 126MACHINE_END
126#endif 127#endif
127 128
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index b4aa4c054276..7ee024d34829 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -20,6 +20,7 @@
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/m48t86.h> 21#include <linux/m48t86.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/i2c.h>
23#include <mach/hardware.h> 24#include <mach/hardware.h>
24#include <asm/mach-types.h> 25#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
@@ -117,7 +118,7 @@ static struct physmap_flash_data ts72xx_flash_data = {
117 118
118static struct resource ts72xx_flash_resource = { 119static struct resource ts72xx_flash_resource = {
119 .start = TS72XX_NOR_PHYS_BASE, 120 .start = TS72XX_NOR_PHYS_BASE,
120 .end = TS72XX_NOR_PHYS_BASE + 0x00ffffff, 121 .end = TS72XX_NOR_PHYS_BASE + SZ_16M - 1,
121 .flags = IORESOURCE_MEM, 122 .flags = IORESOURCE_MEM,
122}; 123};
123 124
@@ -144,21 +145,21 @@ static void ts72xx_rtc_writebyte(unsigned char value, unsigned long addr)
144} 145}
145 146
146static struct m48t86_ops ts72xx_rtc_ops = { 147static struct m48t86_ops ts72xx_rtc_ops = {
147 .readbyte = ts72xx_rtc_readbyte, 148 .readbyte = ts72xx_rtc_readbyte,
148 .writebyte = ts72xx_rtc_writebyte, 149 .writebyte = ts72xx_rtc_writebyte,
149}; 150};
150 151
151static struct platform_device ts72xx_rtc_device = { 152static struct platform_device ts72xx_rtc_device = {
152 .name = "rtc-m48t86", 153 .name = "rtc-m48t86",
153 .id = -1, 154 .id = -1,
154 .dev = { 155 .dev = {
155 .platform_data = &ts72xx_rtc_ops, 156 .platform_data = &ts72xx_rtc_ops,
156 }, 157 },
157 .num_resources = 0, 158 .num_resources = 0,
158}; 159};
159 160
160static struct ep93xx_eth_data ts72xx_eth_data = { 161static struct ep93xx_eth_data ts72xx_eth_data = {
161 .phy_id = 1, 162 .phy_id = 1,
162}; 163};
163 164
164static void __init ts72xx_init_machine(void) 165static void __init ts72xx_init_machine(void)
@@ -175,7 +176,7 @@ MACHINE_START(TS72XX, "Technologic Systems TS-72xx SBC")
175 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ 176 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
176 .phys_io = EP93XX_APB_PHYS_BASE, 177 .phys_io = EP93XX_APB_PHYS_BASE,
177 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, 178 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
178 .boot_params = 0x00000100, 179 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
179 .map_io = ts72xx_map_io, 180 .map_io = ts72xx_map_io,
180 .init_irq = ep93xx_init_irq, 181 .init_irq = ep93xx_init_irq,
181 .timer = &ep93xx_timer, 182 .timer = &ep93xx_timer,
diff --git a/arch/arm/mach-footbridge/cats-hw.c b/arch/arm/mach-footbridge/cats-hw.c
index 6a5b437ab86f..1b996b26d2e0 100644
--- a/arch/arm/mach-footbridge/cats-hw.c
+++ b/arch/arm/mach-footbridge/cats-hw.c
@@ -10,6 +10,7 @@
10#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/screen_info.h> 11#include <linux/screen_info.h>
12#include <linux/io.h> 12#include <linux/io.h>
13#include <linux/spinlock.h>
13 14
14#include <asm/hardware/dec21285.h> 15#include <asm/hardware/dec21285.h>
15#include <asm/mach-types.h> 16#include <asm/mach-types.h>
diff --git a/arch/arm/mach-footbridge/common.c b/arch/arm/mach-footbridge/common.c
index 818014e09f4a..36ff06d4df15 100644
--- a/arch/arm/mach-footbridge/common.c
+++ b/arch/arm/mach-footbridge/common.c
@@ -14,6 +14,7 @@
14#include <linux/list.h> 14#include <linux/list.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/spinlock.h>
17 18
18#include <asm/pgtable.h> 19#include <asm/pgtable.h>
19#include <asm/page.h> 20#include <asm/page.h>
diff --git a/arch/arm/mach-footbridge/dc21285-timer.c b/arch/arm/mach-footbridge/dc21285-timer.c
index b2a21189dd81..da35bc5c5ccc 100644
--- a/arch/arm/mach-footbridge/dc21285-timer.c
+++ b/arch/arm/mach-footbridge/dc21285-timer.c
@@ -7,6 +7,7 @@
7#include <linux/init.h> 7#include <linux/init.h>
8#include <linux/interrupt.h> 8#include <linux/interrupt.h>
9#include <linux/irq.h> 9#include <linux/irq.h>
10#include <linux/spinlock.h>
10 11
11#include <asm/irq.h> 12#include <asm/irq.h>
12 13
diff --git a/arch/arm/mach-footbridge/dc21285.c b/arch/arm/mach-footbridge/dc21285.c
index d4c1e526f59c..133086019e3e 100644
--- a/arch/arm/mach-footbridge/dc21285.c
+++ b/arch/arm/mach-footbridge/dc21285.c
@@ -17,6 +17,7 @@
17#include <linux/ioport.h> 17#include <linux/ioport.h>
18#include <linux/irq.h> 18#include <linux/irq.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/spinlock.h>
20 21
21#include <asm/irq.h> 22#include <asm/irq.h>
22#include <asm/system.h> 23#include <asm/system.h>
diff --git a/arch/arm/mach-footbridge/dma.c b/arch/arm/mach-footbridge/dma.c
index b653e9cfa3f7..4f3506346969 100644
--- a/arch/arm/mach-footbridge/dma.c
+++ b/arch/arm/mach-footbridge/dma.c
@@ -12,6 +12,7 @@
12 */ 12 */
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/spinlock.h>
15 16
16#include <asm/dma.h> 17#include <asm/dma.h>
17#include <asm/scatterlist.h> 18#include <asm/scatterlist.h>
diff --git a/arch/arm/mach-footbridge/ebsa285.c b/arch/arm/mach-footbridge/ebsa285.c
index b1d3bf20a41e..30040fd588cc 100644
--- a/arch/arm/mach-footbridge/ebsa285.c
+++ b/arch/arm/mach-footbridge/ebsa285.c
@@ -4,6 +4,7 @@
4 * EBSA285 machine fixup 4 * EBSA285 machine fixup
5 */ 5 */
6#include <linux/init.h> 6#include <linux/init.h>
7#include <linux/spinlock.h>
7 8
8#include <asm/hardware/dec21285.h> 9#include <asm/hardware/dec21285.h>
9#include <asm/mach-types.h> 10#include <asm/mach-types.h>
diff --git a/arch/arm/mach-footbridge/include/mach/hardware.h b/arch/arm/mach-footbridge/include/mach/hardware.h
index ffaea90486f9..51dd902043ad 100644
--- a/arch/arm/mach-footbridge/include/mach/hardware.h
+++ b/arch/arm/mach-footbridge/include/mach/hardware.h
@@ -12,8 +12,6 @@
12#ifndef __ASM_ARCH_HARDWARE_H 12#ifndef __ASM_ARCH_HARDWARE_H
13#define __ASM_ARCH_HARDWARE_H 13#define __ASM_ARCH_HARDWARE_H
14 14
15#include <mach/memory.h>
16
17/* Virtual Physical Size 15/* Virtual Physical Size
18 * 0xff800000 0x40000000 1MB X-Bus 16 * 0xff800000 0x40000000 1MB X-Bus
19 * 0xff000000 0x7c000000 1MB PCI I/O space 17 * 0xff000000 0x7c000000 1MB PCI I/O space
@@ -28,9 +26,6 @@
28#define XBUS_SIZE 0x00100000 26#define XBUS_SIZE 0x00100000
29#define XBUS_BASE 0xff800000 27#define XBUS_BASE 0xff800000
30 28
31#define PCIO_SIZE 0x00100000
32#define PCIO_BASE 0xff000000
33
34#define ARMCSR_SIZE 0x00100000 29#define ARMCSR_SIZE 0x00100000
35#define ARMCSR_BASE 0xfe000000 30#define ARMCSR_BASE 0xfe000000
36 31
@@ -91,10 +86,11 @@
91#define CPLD_FLASH_WR_ENABLE 1 86#define CPLD_FLASH_WR_ENABLE 1
92 87
93#ifndef __ASSEMBLY__ 88#ifndef __ASSEMBLY__
94extern void gpio_modify_op(int mask, int set); 89extern spinlock_t nw_gpio_lock;
95extern void gpio_modify_io(int mask, int in); 90extern void nw_gpio_modify_op(unsigned int mask, unsigned int set);
96extern int gpio_read(void); 91extern void nw_gpio_modify_io(unsigned int mask, unsigned int in);
97extern void cpld_modify(int mask, int set); 92extern unsigned int nw_gpio_read(void);
93extern void nw_cpld_modify(unsigned int mask, unsigned int set);
98#endif 94#endif
99 95
100#define pcibios_assign_all_busses() 1 96#define pcibios_assign_all_busses() 1
diff --git a/arch/arm/mach-footbridge/include/mach/io.h b/arch/arm/mach-footbridge/include/mach/io.h
index a7b066239996..101a4fe90bde 100644
--- a/arch/arm/mach-footbridge/include/mach/io.h
+++ b/arch/arm/mach-footbridge/include/mach/io.h
@@ -14,7 +14,8 @@
14#ifndef __ASM_ARM_ARCH_IO_H 14#ifndef __ASM_ARM_ARCH_IO_H
15#define __ASM_ARM_ARCH_IO_H 15#define __ASM_ARM_ARCH_IO_H
16 16
17#include <mach/hardware.h> 17#define PCIO_SIZE 0x00100000
18#define PCIO_BASE 0xff000000
18 19
19#define IO_SPACE_LIMIT 0xffff 20#define IO_SPACE_LIMIT 0xffff
20 21
diff --git a/arch/arm/mach-footbridge/include/mach/dma.h b/arch/arm/mach-footbridge/include/mach/isa-dma.h
index 62afd213effb..5bd4a0d338a8 100644
--- a/arch/arm/mach-footbridge/include/mach/dma.h
+++ b/arch/arm/mach-footbridge/include/mach/isa-dma.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/arm/mach-footbridge/include/mach/dma.h 2 * arch/arm/mach-footbridge/include/mach/isa-dma.h
3 * 3 *
4 * Architecture DMA routines 4 * Architecture DMA routines
5 * 5 *
diff --git a/arch/arm/mach-footbridge/include/mach/memory.h b/arch/arm/mach-footbridge/include/mach/memory.h
index 6ae2f1a07ab9..cb16e59d87b6 100644
--- a/arch/arm/mach-footbridge/include/mach/memory.h
+++ b/arch/arm/mach-footbridge/include/mach/memory.h
@@ -30,9 +30,18 @@
30extern unsigned long __virt_to_bus(unsigned long); 30extern unsigned long __virt_to_bus(unsigned long);
31extern unsigned long __bus_to_virt(unsigned long); 31extern unsigned long __bus_to_virt(unsigned long);
32#endif 32#endif
33#define __virt_to_bus __virt_to_bus
34#define __bus_to_virt __bus_to_virt
33 35
34#elif defined(CONFIG_FOOTBRIDGE_HOST) 36#elif defined(CONFIG_FOOTBRIDGE_HOST)
35 37
38/*
39 * The footbridge is programmed to expose the system RAM at the corresponding
40 * address. So, if PAGE_OFFSET is 0xc0000000, RAM appears at 0xe0000000.
41 * If 0x80000000, then its exposed at 0xa0000000 on the bus. etc.
42 * The only requirement is that the RAM isn't placed at bus address 0 which
43 * would clash with VGA cards.
44 */
36#define __virt_to_bus(x) ((x) - 0xe0000000) 45#define __virt_to_bus(x) ((x) - 0xe0000000)
37#define __bus_to_virt(x) ((x) + 0xe0000000) 46#define __bus_to_virt(x) ((x) + 0xe0000000)
38 47
diff --git a/arch/arm/mach-footbridge/isa-irq.c b/arch/arm/mach-footbridge/isa-irq.c
index 54fec9ae28b9..9ee80a211d3c 100644
--- a/arch/arm/mach-footbridge/isa-irq.c
+++ b/arch/arm/mach-footbridge/isa-irq.c
@@ -19,6 +19,7 @@
19#include <linux/list.h> 19#include <linux/list.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/spinlock.h>
22 23
23#include <asm/mach/irq.h> 24#include <asm/mach/irq.h>
24 25
diff --git a/arch/arm/mach-footbridge/netwinder-hw.c b/arch/arm/mach-footbridge/netwinder-hw.c
index 00b0ddcac283..ac7ffa6fc413 100644
--- a/arch/arm/mach-footbridge/netwinder-hw.c
+++ b/arch/arm/mach-footbridge/netwinder-hw.c
@@ -11,6 +11,7 @@
11#include <linux/delay.h> 11#include <linux/delay.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/io.h> 13#include <linux/io.h>
14#include <linux/spinlock.h>
14 15
15#include <asm/hardware/dec21285.h> 16#include <asm/hardware/dec21285.h>
16#include <asm/leds.h> 17#include <asm/leds.h>
@@ -67,13 +68,14 @@ static inline void wb977_ww(int reg, int val)
67/* 68/*
68 * This is a lock for accessing ports GP1_IO_BASE and GP2_IO_BASE 69 * This is a lock for accessing ports GP1_IO_BASE and GP2_IO_BASE
69 */ 70 */
70DEFINE_SPINLOCK(gpio_lock); 71DEFINE_SPINLOCK(nw_gpio_lock);
72EXPORT_SYMBOL(nw_gpio_lock);
71 73
72static unsigned int current_gpio_op; 74static unsigned int current_gpio_op;
73static unsigned int current_gpio_io; 75static unsigned int current_gpio_io;
74static unsigned int current_cpld; 76static unsigned int current_cpld;
75 77
76void gpio_modify_op(int mask, int set) 78void nw_gpio_modify_op(unsigned int mask, unsigned int set)
77{ 79{
78 unsigned int new_gpio, changed; 80 unsigned int new_gpio, changed;
79 81
@@ -86,6 +88,7 @@ void gpio_modify_op(int mask, int set)
86 if (changed & 0xff00) 88 if (changed & 0xff00)
87 outb(new_gpio >> 8, GP2_IO_BASE); 89 outb(new_gpio >> 8, GP2_IO_BASE);
88} 90}
91EXPORT_SYMBOL(nw_gpio_modify_op);
89 92
90static inline void __gpio_modify_io(int mask, int in) 93static inline void __gpio_modify_io(int mask, int in)
91{ 94{
@@ -118,7 +121,7 @@ static inline void __gpio_modify_io(int mask, int in)
118 } 121 }
119} 122}
120 123
121void gpio_modify_io(int mask, int in) 124void nw_gpio_modify_io(unsigned int mask, unsigned int in)
122{ 125{
123 /* Open up the SuperIO chip */ 126 /* Open up the SuperIO chip */
124 wb977_open(); 127 wb977_open();
@@ -128,11 +131,13 @@ void gpio_modify_io(int mask, int in)
128 /* Close up the EFER gate */ 131 /* Close up the EFER gate */
129 wb977_close(); 132 wb977_close();
130} 133}
134EXPORT_SYMBOL(nw_gpio_modify_io);
131 135
132int gpio_read(void) 136unsigned int nw_gpio_read(void)
133{ 137{
134 return inb(GP1_IO_BASE) | inb(GP2_IO_BASE) << 8; 138 return inb(GP1_IO_BASE) | inb(GP2_IO_BASE) << 8;
135} 139}
140EXPORT_SYMBOL(nw_gpio_read);
136 141
137/* 142/*
138 * Initialise the Winbond W83977F global registers 143 * Initialise the Winbond W83977F global registers
@@ -322,9 +327,9 @@ static inline void wb977_init_gpio(void)
322 /* 327 /*
323 * Set Group1/Group2 outputs 328 * Set Group1/Group2 outputs
324 */ 329 */
325 spin_lock_irqsave(&gpio_lock, flags); 330 spin_lock_irqsave(&nw_gpio_lock, flags);
326 gpio_modify_op(-1, GPIO_RED_LED | GPIO_FAN); 331 nw_gpio_modify_op(-1, GPIO_RED_LED | GPIO_FAN);
327 spin_unlock_irqrestore(&gpio_lock, flags); 332 spin_unlock_irqrestore(&nw_gpio_lock, flags);
328} 333}
329 334
330/* 335/*
@@ -359,34 +364,35 @@ static void __init wb977_init(void)
359 wb977_close(); 364 wb977_close();
360} 365}
361 366
362void cpld_modify(int mask, int set) 367void nw_cpld_modify(unsigned int mask, unsigned int set)
363{ 368{
364 int msk; 369 int msk;
365 370
366 current_cpld = (current_cpld & ~mask) | set; 371 current_cpld = (current_cpld & ~mask) | set;
367 372
368 gpio_modify_io(GPIO_DATA | GPIO_IOCLK | GPIO_IOLOAD, 0); 373 nw_gpio_modify_io(GPIO_DATA | GPIO_IOCLK | GPIO_IOLOAD, 0);
369 gpio_modify_op(GPIO_IOLOAD, 0); 374 nw_gpio_modify_op(GPIO_IOLOAD, 0);
370 375
371 for (msk = 8; msk; msk >>= 1) { 376 for (msk = 8; msk; msk >>= 1) {
372 int bit = current_cpld & msk; 377 int bit = current_cpld & msk;
373 378
374 gpio_modify_op(GPIO_DATA | GPIO_IOCLK, bit ? GPIO_DATA : 0); 379 nw_gpio_modify_op(GPIO_DATA | GPIO_IOCLK, bit ? GPIO_DATA : 0);
375 gpio_modify_op(GPIO_IOCLK, GPIO_IOCLK); 380 nw_gpio_modify_op(GPIO_IOCLK, GPIO_IOCLK);
376 } 381 }
377 382
378 gpio_modify_op(GPIO_IOCLK|GPIO_DATA, 0); 383 nw_gpio_modify_op(GPIO_IOCLK|GPIO_DATA, 0);
379 gpio_modify_op(GPIO_IOLOAD|GPIO_DSCLK, GPIO_IOLOAD|GPIO_DSCLK); 384 nw_gpio_modify_op(GPIO_IOLOAD|GPIO_DSCLK, GPIO_IOLOAD|GPIO_DSCLK);
380 gpio_modify_op(GPIO_IOLOAD, 0); 385 nw_gpio_modify_op(GPIO_IOLOAD, 0);
381} 386}
387EXPORT_SYMBOL(nw_cpld_modify);
382 388
383static void __init cpld_init(void) 389static void __init cpld_init(void)
384{ 390{
385 unsigned long flags; 391 unsigned long flags;
386 392
387 spin_lock_irqsave(&gpio_lock, flags); 393 spin_lock_irqsave(&nw_gpio_lock, flags);
388 cpld_modify(-1, CPLD_UNMUTE | CPLD_7111_DISABLE); 394 nw_cpld_modify(-1, CPLD_UNMUTE | CPLD_7111_DISABLE);
389 spin_unlock_irqrestore(&gpio_lock, flags); 395 spin_unlock_irqrestore(&nw_gpio_lock, flags);
390} 396}
391 397
392static unsigned char rwa_unlock[] __initdata = 398static unsigned char rwa_unlock[] __initdata =
@@ -596,12 +602,6 @@ static void __init rwa010_init(void)
596 rwa010_soundblaster_reset(); 602 rwa010_soundblaster_reset();
597} 603}
598 604
599EXPORT_SYMBOL(gpio_lock);
600EXPORT_SYMBOL(gpio_modify_op);
601EXPORT_SYMBOL(gpio_modify_io);
602EXPORT_SYMBOL(cpld_modify);
603EXPORT_SYMBOL(gpio_read);
604
605/* 605/*
606 * Initialise any other hardware after we've got the PCI bus 606 * Initialise any other hardware after we've got the PCI bus
607 * initialised. We may need the PCI bus to talk to this other 607 * initialised. We may need the PCI bus to talk to this other
@@ -616,9 +616,9 @@ static int __init nw_hw_init(void)
616 cpld_init(); 616 cpld_init();
617 rwa010_init(); 617 rwa010_init();
618 618
619 spin_lock_irqsave(&gpio_lock, flags); 619 spin_lock_irqsave(&nw_gpio_lock, flags);
620 gpio_modify_op(GPIO_RED_LED|GPIO_GREEN_LED, DEFAULT_LEDS); 620 nw_gpio_modify_op(GPIO_RED_LED|GPIO_GREEN_LED, DEFAULT_LEDS);
621 spin_unlock_irqrestore(&gpio_lock, flags); 621 spin_unlock_irqrestore(&nw_gpio_lock, flags);
622 } 622 }
623 return 0; 623 return 0;
624} 624}
diff --git a/arch/arm/mach-footbridge/netwinder-leds.c b/arch/arm/mach-footbridge/netwinder-leds.c
index d91a4f4a32dc..00269fe0be8a 100644
--- a/arch/arm/mach-footbridge/netwinder-leds.c
+++ b/arch/arm/mach-footbridge/netwinder-leds.c
@@ -32,7 +32,6 @@ static char led_state;
32static char hw_led_state; 32static char hw_led_state;
33 33
34static DEFINE_SPINLOCK(leds_lock); 34static DEFINE_SPINLOCK(leds_lock);
35extern spinlock_t gpio_lock;
36 35
37static void netwinder_leds_event(led_event_t evt) 36static void netwinder_leds_event(led_event_t evt)
38{ 37{
@@ -121,9 +120,9 @@ static void netwinder_leds_event(led_event_t evt)
121 spin_unlock_irqrestore(&leds_lock, flags); 120 spin_unlock_irqrestore(&leds_lock, flags);
122 121
123 if (led_state & LED_STATE_ENABLED) { 122 if (led_state & LED_STATE_ENABLED) {
124 spin_lock_irqsave(&gpio_lock, flags); 123 spin_lock_irqsave(&nw_gpio_lock, flags);
125 gpio_modify_op(GPIO_RED_LED | GPIO_GREEN_LED, hw_led_state); 124 nw_gpio_modify_op(GPIO_RED_LED | GPIO_GREEN_LED, hw_led_state);
126 spin_unlock_irqrestore(&gpio_lock, flags); 125 spin_unlock_irqrestore(&nw_gpio_lock, flags);
127 } 126 }
128} 127}
129 128
diff --git a/arch/arm/mach-footbridge/personal.c b/arch/arm/mach-footbridge/personal.c
index c4f843fc099d..e2c9f0690b16 100644
--- a/arch/arm/mach-footbridge/personal.c
+++ b/arch/arm/mach-footbridge/personal.c
@@ -4,6 +4,7 @@
4 * Personal server (Skiff) machine fixup 4 * Personal server (Skiff) machine fixup
5 */ 5 */
6#include <linux/init.h> 6#include <linux/init.h>
7#include <linux/spinlock.h>
7 8
8#include <asm/hardware/dec21285.h> 9#include <asm/hardware/dec21285.h>
9#include <asm/mach-types.h> 10#include <asm/mach-types.h>
diff --git a/arch/arm/mach-h720x/include/mach/io.h b/arch/arm/mach-h720x/include/mach/io.h
index 1dab74ce88c6..2c8659c21a93 100644
--- a/arch/arm/mach-h720x/include/mach/io.h
+++ b/arch/arm/mach-h720x/include/mach/io.h
@@ -14,11 +14,9 @@
14#ifndef __ASM_ARM_ARCH_IO_H 14#ifndef __ASM_ARM_ARCH_IO_H
15#define __ASM_ARM_ARCH_IO_H 15#define __ASM_ARM_ARCH_IO_H
16 16
17#include <mach/hardware.h>
18
19#define IO_SPACE_LIMIT 0xffffffff 17#define IO_SPACE_LIMIT 0xffffffff
20 18
21#define __io(a) ((void __iomem *)(a)) 19#define __io(a) __typesafe_io(a)
22#define __mem_pci(a) (a) 20#define __mem_pci(a) (a)
23 21
24#endif 22#endif
diff --git a/arch/arm/mach-h720x/include/mach/dma.h b/arch/arm/mach-h720x/include/mach/isa-dma.h
index 0a9d86ee84fe..3eafb3f163c0 100644
--- a/arch/arm/mach-h720x/include/mach/dma.h
+++ b/arch/arm/mach-h720x/include/mach/isa-dma.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/arm/mach-h720x/include/mach/dma.h 2 * arch/arm/mach-h720x/include/mach/isa-dma.h
3 * 3 *
4 * Architecture DMA routes 4 * Architecture DMA routes
5 * 5 *
@@ -8,13 +8,6 @@
8#ifndef __ASM_ARCH_DMA_H 8#ifndef __ASM_ARCH_DMA_H
9#define __ASM_ARCH_DMA_H 9#define __ASM_ARCH_DMA_H
10 10
11/*
12 * This is the maximum DMA address that can be DMAd to.
13 * There should not be more than (0xd0000000 - 0xc0000000)
14 * bytes of RAM.
15 */
16#define MAX_DMA_ADDRESS 0xd0000000
17
18#if defined (CONFIG_CPU_H7201) 11#if defined (CONFIG_CPU_H7201)
19#define MAX_DMA_CHANNELS 3 12#define MAX_DMA_CHANNELS 3
20#elif defined (CONFIG_CPU_H7202) 13#elif defined (CONFIG_CPU_H7202)
diff --git a/arch/arm/mach-h720x/include/mach/memory.h b/arch/arm/mach-h720x/include/mach/memory.h
index cb26f49cc4e1..ef4c1e26f18e 100644
--- a/arch/arm/mach-h720x/include/mach/memory.h
+++ b/arch/arm/mach-h720x/include/mach/memory.h
@@ -7,23 +7,13 @@
7#ifndef __ASM_ARCH_MEMORY_H 7#ifndef __ASM_ARCH_MEMORY_H
8#define __ASM_ARCH_MEMORY_H 8#define __ASM_ARCH_MEMORY_H
9 9
10/*
11 * Page offset:
12 * ( 0xc0000000UL )
13 */
14#define PHYS_OFFSET UL(0x40000000) 10#define PHYS_OFFSET UL(0x40000000)
15
16/* 11/*
17 * Virtual view <-> DMA view memory address translations 12 * This is the maximum DMA address that can be DMAd to.
18 * virt_to_bus: Used to translate the virtual address to an 13 * There should not be more than (0xd0000000 - 0xc0000000)
19 * address suitable to be passed to set_dma_addr 14 * bytes of RAM.
20 * bus_to_virt: Used to convert an address for DMA operations
21 * to an address that the kernel can use.
22 *
23 * There is something to do here later !, Mar 2000, Jungjun Kim
24 */ 15 */
25 16#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_256M - 1)
26#define __virt_to_bus(x) __virt_to_phys(x) 17#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_256M)
27#define __bus_to_virt(x) __phys_to_virt(x)
28 18
29#endif 19#endif
diff --git a/arch/arm/mach-imx/dma.c b/arch/arm/mach-imx/dma.c
index c10810c936b3..1536583eece0 100644
--- a/arch/arm/mach-imx/dma.c
+++ b/arch/arm/mach-imx/dma.c
@@ -28,10 +28,11 @@
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/errno.h> 29#include <linux/errno.h>
30 30
31#include <asm/scatterlist.h>
31#include <asm/system.h> 32#include <asm/system.h>
32#include <asm/irq.h> 33#include <asm/irq.h>
33#include <mach/hardware.h> 34#include <mach/hardware.h>
34#include <asm/dma.h> 35#include <mach/dma.h>
35#include <mach/imx-dma.h> 36#include <mach/imx-dma.h>
36 37
37struct imx_dma_channel imx_dma_channels[IMX_DMA_CHANNELS]; 38struct imx_dma_channel imx_dma_channels[IMX_DMA_CHANNELS];
@@ -138,7 +139,7 @@ imx_dma_setup_sg_base(imx_dmach_t dma_ch,
138int 139int
139imx_dma_setup_single(imx_dmach_t dma_ch, dma_addr_t dma_address, 140imx_dma_setup_single(imx_dmach_t dma_ch, dma_addr_t dma_address,
140 unsigned int dma_length, unsigned int dev_addr, 141 unsigned int dma_length, unsigned int dev_addr,
141 dmamode_t dmamode) 142 unsigned int dmamode)
142{ 143{
143 struct imx_dma_channel *imxdma = &imx_dma_channels[dma_ch]; 144 struct imx_dma_channel *imxdma = &imx_dma_channels[dma_ch];
144 145
@@ -223,7 +224,7 @@ imx_dma_setup_single(imx_dmach_t dma_ch, dma_addr_t dma_address,
223int 224int
224imx_dma_setup_sg(imx_dmach_t dma_ch, 225imx_dma_setup_sg(imx_dmach_t dma_ch,
225 struct scatterlist *sg, unsigned int sgcount, unsigned int dma_length, 226 struct scatterlist *sg, unsigned int sgcount, unsigned int dma_length,
226 unsigned int dev_addr, dmamode_t dmamode) 227 unsigned int dev_addr, unsigned int dmamode)
227{ 228{
228 int res; 229 int res;
229 struct imx_dma_channel *imxdma = &imx_dma_channels[dma_ch]; 230 struct imx_dma_channel *imxdma = &imx_dma_channels[dma_ch];
diff --git a/arch/arm/mach-imx/include/mach/imx-dma.h b/arch/arm/mach-imx/include/mach/imx-dma.h
index 44d89c35539a..bbe54df7f0de 100644
--- a/arch/arm/mach-imx/include/mach/imx-dma.h
+++ b/arch/arm/mach-imx/include/mach/imx-dma.h
@@ -18,7 +18,7 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21#include <asm/dma.h> 21#include <mach/dma.h>
22 22
23#ifndef __ASM_ARCH_IMX_DMA_H 23#ifndef __ASM_ARCH_IMX_DMA_H
24#define __ASM_ARCH_IMX_DMA_H 24#define __ASM_ARCH_IMX_DMA_H
@@ -48,7 +48,7 @@ struct imx_dma_channel {
48 void (*irq_handler) (int, void *); 48 void (*irq_handler) (int, void *);
49 void (*err_handler) (int, void *, int errcode); 49 void (*err_handler) (int, void *, int errcode);
50 void *data; 50 void *data;
51 dmamode_t dma_mode; 51 unsigned int dma_mode;
52 struct scatterlist *sg; 52 struct scatterlist *sg;
53 unsigned int sgbc; 53 unsigned int sgbc;
54 unsigned int sgcount; 54 unsigned int sgcount;
@@ -66,14 +66,18 @@ extern struct imx_dma_channel imx_dma_channels[IMX_DMA_CHANNELS];
66/* The type to distinguish channel numbers parameter from ordinal int type */ 66/* The type to distinguish channel numbers parameter from ordinal int type */
67typedef int imx_dmach_t; 67typedef int imx_dmach_t;
68 68
69#define DMA_MODE_READ 0
70#define DMA_MODE_WRITE 1
71#define DMA_MODE_MASK 1
72
69int 73int
70imx_dma_setup_single(imx_dmach_t dma_ch, dma_addr_t dma_address, 74imx_dma_setup_single(imx_dmach_t dma_ch, dma_addr_t dma_address,
71 unsigned int dma_length, unsigned int dev_addr, dmamode_t dmamode); 75 unsigned int dma_length, unsigned int dev_addr, unsigned int dmamode);
72 76
73int 77int
74imx_dma_setup_sg(imx_dmach_t dma_ch, 78imx_dma_setup_sg(imx_dmach_t dma_ch,
75 struct scatterlist *sg, unsigned int sgcount, unsigned int dma_length, 79 struct scatterlist *sg, unsigned int sgcount, unsigned int dma_length,
76 unsigned int dev_addr, dmamode_t dmamode); 80 unsigned int dev_addr, unsigned int dmamode);
77 81
78int 82int
79imx_dma_setup_handlers(imx_dmach_t dma_ch, 83imx_dma_setup_handlers(imx_dmach_t dma_ch,
diff --git a/arch/arm/mach-imx/include/mach/imxfb.h b/arch/arm/mach-imx/include/mach/imxfb.h
index 3ed9ec8b9f00..870d0d939616 100644
--- a/arch/arm/mach-imx/include/mach/imxfb.h
+++ b/arch/arm/mach-imx/include/mach/imxfb.h
@@ -1,7 +1,52 @@
1/* 1/*
2 * This structure describes the machine which we are running on. 2 * This structure describes the machine which we are running on.
3 */ 3 */
4struct imxfb_mach_info { 4
5#define PCR_TFT (1 << 31)
6#define PCR_COLOR (1 << 30)
7#define PCR_PBSIZ_1 (0 << 28)
8#define PCR_PBSIZ_2 (1 << 28)
9#define PCR_PBSIZ_4 (2 << 28)
10#define PCR_PBSIZ_8 (3 << 28)
11#define PCR_BPIX_1 (0 << 25)
12#define PCR_BPIX_2 (1 << 25)
13#define PCR_BPIX_4 (2 << 25)
14#define PCR_BPIX_8 (3 << 25)
15#define PCR_BPIX_12 (4 << 25)
16#define PCR_BPIX_16 (4 << 25)
17#define PCR_PIXPOL (1 << 24)
18#define PCR_FLMPOL (1 << 23)
19#define PCR_LPPOL (1 << 22)
20#define PCR_CLKPOL (1 << 21)
21#define PCR_OEPOL (1 << 20)
22#define PCR_SCLKIDLE (1 << 19)
23#define PCR_END_SEL (1 << 18)
24#define PCR_END_BYTE_SWAP (1 << 17)
25#define PCR_REV_VS (1 << 16)
26#define PCR_ACD_SEL (1 << 15)
27#define PCR_ACD(x) (((x) & 0x7f) << 8)
28#define PCR_SCLK_SEL (1 << 7)
29#define PCR_SHARP (1 << 6)
30#define PCR_PCD(x) ((x) & 0x3f)
31
32#define PWMR_CLS(x) (((x) & 0x1ff) << 16)
33#define PWMR_LDMSK (1 << 15)
34#define PWMR_SCR1 (1 << 10)
35#define PWMR_SCR0 (1 << 9)
36#define PWMR_CC_EN (1 << 8)
37#define PWMR_PW(x) ((x) & 0xff)
38
39#define LSCR1_PS_RISE_DELAY(x) (((x) & 0x7f) << 26)
40#define LSCR1_CLS_RISE_DELAY(x) (((x) & 0x3f) << 16)
41#define LSCR1_REV_TOGGLE_DELAY(x) (((x) & 0xf) << 8)
42#define LSCR1_GRAY2(x) (((x) & 0xf) << 4)
43#define LSCR1_GRAY1(x) (((x) & 0xf))
44
45#define DMACR_BURST (1 << 31)
46#define DMACR_HM(x) (((x) & 0xf) << 16)
47#define DMACR_TM(x) ((x) & 0xf)
48
49struct imx_fb_platform_data {
5 u_long pixclock; 50 u_long pixclock;
6 51
7 u_short xres; 52 u_short xres;
@@ -34,4 +79,5 @@ struct imxfb_mach_info {
34 void (*lcd_power)(int); 79 void (*lcd_power)(int);
35 void (*backlight_power)(int); 80 void (*backlight_power)(int);
36}; 81};
37void set_imx_fb_info(struct imxfb_mach_info *hard_imx_fb_info); 82
83void set_imx_fb_info(struct imx_fb_platform_data *);
diff --git a/arch/arm/mach-imx/include/mach/io.h b/arch/arm/mach-imx/include/mach/io.h
index c50c5fa6fb81..9e197ae4590f 100644
--- a/arch/arm/mach-imx/include/mach/io.h
+++ b/arch/arm/mach-imx/include/mach/io.h
@@ -20,11 +20,9 @@
20#ifndef __ASM_ARM_ARCH_IO_H 20#ifndef __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H 21#define __ASM_ARM_ARCH_IO_H
22 22
23#include <mach/hardware.h>
24
25#define IO_SPACE_LIMIT 0xffffffff 23#define IO_SPACE_LIMIT 0xffffffff
26 24
27#define __io(a) ((void __iomem *)(a)) 25#define __io(a) __typesafe_io(a)
28#define __mem_pci(a) (a) 26#define __mem_pci(a) (a)
29 27
30#endif 28#endif
diff --git a/arch/arm/mach-imx/include/mach/memory.h b/arch/arm/mach-imx/include/mach/memory.h
index 5c453063c0ed..a93df7cba694 100644
--- a/arch/arm/mach-imx/include/mach/memory.h
+++ b/arch/arm/mach-imx/include/mach/memory.h
@@ -23,14 +23,4 @@
23 23
24#define PHYS_OFFSET UL(0x08000000) 24#define PHYS_OFFSET UL(0x08000000)
25 25
26/*
27 * Virtual view <-> DMA view memory address translations
28 * virt_to_bus: Used to translate the virtual address to an
29 * address suitable to be passed to set_dma_addr
30 * bus_to_virt: Used to convert an address for DMA operations
31 * to an address that the kernel can use.
32 */
33#define __virt_to_bus(x) (x - PAGE_OFFSET + PHYS_OFFSET)
34#define __bus_to_virt(x) (x - PHYS_OFFSET + PAGE_OFFSET)
35
36#endif 26#endif
diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c
index a11765f5f23b..aff0ebcfa847 100644
--- a/arch/arm/mach-imx/time.c
+++ b/arch/arm/mach-imx/time.c
@@ -184,7 +184,7 @@ static int __init imx_clockevent_init(unsigned long rate)
184 clockevent_imx.min_delta_ns = 184 clockevent_imx.min_delta_ns =
185 clockevent_delta2ns(0xf, &clockevent_imx); 185 clockevent_delta2ns(0xf, &clockevent_imx);
186 186
187 clockevent_imx.cpumask = cpumask_of_cpu(0); 187 clockevent_imx.cpumask = cpumask_of(0);
188 188
189 clockevents_register_device(&clockevent_imx); 189 clockevents_register_device(&clockevent_imx);
190 190
diff --git a/arch/arm/mach-integrator/clock.c b/arch/arm/mach-integrator/clock.c
index 8d761fdd2ecd..989ecf5f5c46 100644
--- a/arch/arm/mach-integrator/clock.c
+++ b/arch/arm/mach-integrator/clock.c
@@ -10,42 +10,12 @@
10 */ 10 */
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/list.h>
14#include <linux/errno.h> 13#include <linux/errno.h>
15#include <linux/err.h>
16#include <linux/string.h>
17#include <linux/clk.h> 14#include <linux/clk.h>
18#include <linux/mutex.h> 15#include <linux/mutex.h>
19 16
20#include <asm/hardware/icst525.h> 17#include <asm/clkdev.h>
21 18#include <mach/clkdev.h>
22#include "clock.h"
23
24static LIST_HEAD(clocks);
25static DEFINE_MUTEX(clocks_mutex);
26
27struct clk *clk_get(struct device *dev, const char *id)
28{
29 struct clk *p, *clk = ERR_PTR(-ENOENT);
30
31 mutex_lock(&clocks_mutex);
32 list_for_each_entry(p, &clocks, node) {
33 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
34 clk = p;
35 break;
36 }
37 }
38 mutex_unlock(&clocks_mutex);
39
40 return clk;
41}
42EXPORT_SYMBOL(clk_get);
43
44void clk_put(struct clk *clk)
45{
46 module_put(clk->owner);
47}
48EXPORT_SYMBOL(clk_put);
49 19
50int clk_enable(struct clk *clk) 20int clk_enable(struct clk *clk)
51{ 21{
@@ -67,7 +37,6 @@ EXPORT_SYMBOL(clk_get_rate);
67long clk_round_rate(struct clk *clk, unsigned long rate) 37long clk_round_rate(struct clk *clk, unsigned long rate)
68{ 38{
69 struct icst525_vco vco; 39 struct icst525_vco vco;
70
71 vco = icst525_khz_to_vco(clk->params, rate / 1000); 40 vco = icst525_khz_to_vco(clk->params, rate / 1000);
72 return icst525_khz(clk->params, vco) * 1000; 41 return icst525_khz(clk->params, vco) * 1000;
73} 42}
@@ -76,56 +45,15 @@ EXPORT_SYMBOL(clk_round_rate);
76int clk_set_rate(struct clk *clk, unsigned long rate) 45int clk_set_rate(struct clk *clk, unsigned long rate)
77{ 46{
78 int ret = -EIO; 47 int ret = -EIO;
48
79 if (clk->setvco) { 49 if (clk->setvco) {
80 struct icst525_vco vco; 50 struct icst525_vco vco;
81 51
82 vco = icst525_khz_to_vco(clk->params, rate / 1000); 52 vco = icst525_khz_to_vco(clk->params, rate / 1000);
83 clk->rate = icst525_khz(clk->params, vco) * 1000; 53 clk->rate = icst525_khz(clk->params, vco) * 1000;
84
85 printk("Clock %s: setting VCO reg params: S=%d R=%d V=%d\n",
86 clk->name, vco.s, vco.r, vco.v);
87
88 clk->setvco(clk, vco); 54 clk->setvco(clk, vco);
89 ret = 0; 55 ret = 0;
90 } 56 }
91 return 0; 57 return ret;
92} 58}
93EXPORT_SYMBOL(clk_set_rate); 59EXPORT_SYMBOL(clk_set_rate);
94
95/*
96 * These are fixed clocks.
97 */
98static struct clk kmi_clk = {
99 .name = "KMIREFCLK",
100 .rate = 24000000,
101};
102
103static struct clk uart_clk = {
104 .name = "UARTCLK",
105 .rate = 14745600,
106};
107
108int clk_register(struct clk *clk)
109{
110 mutex_lock(&clocks_mutex);
111 list_add(&clk->node, &clocks);
112 mutex_unlock(&clocks_mutex);
113 return 0;
114}
115EXPORT_SYMBOL(clk_register);
116
117void clk_unregister(struct clk *clk)
118{
119 mutex_lock(&clocks_mutex);
120 list_del(&clk->node);
121 mutex_unlock(&clocks_mutex);
122}
123EXPORT_SYMBOL(clk_unregister);
124
125static int __init clk_init(void)
126{
127 clk_register(&kmi_clk);
128 clk_register(&uart_clk);
129 return 0;
130}
131arch_initcall(clk_init);
diff --git a/arch/arm/mach-integrator/clock.h b/arch/arm/mach-integrator/clock.h
index 09e6328ceba9..e69de29bb2d1 100644
--- a/arch/arm/mach-integrator/clock.h
+++ b/arch/arm/mach-integrator/clock.h
@@ -1,25 +0,0 @@
1/*
2 * linux/arch/arm/mach-integrator/clock.h
3 *
4 * Copyright (C) 2004 ARM Limited.
5 * Written by Deep Blue Solutions Limited.
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 */
11struct module;
12struct icst525_params;
13
14struct clk {
15 struct list_head node;
16 unsigned long rate;
17 struct module *owner;
18 const char *name;
19 const struct icst525_params *params;
20 void *data;
21 void (*setvco)(struct clk *, struct icst525_vco vco);
22};
23
24int clk_register(struct clk *clk);
25void clk_unregister(struct clk *clk);
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index 595b7392ee4e..6f8872913073 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -21,6 +21,8 @@
21#include <linux/amba/serial.h> 21#include <linux/amba/serial.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include <asm/clkdev.h>
25#include <mach/clkdev.h>
24#include <mach/hardware.h> 26#include <mach/hardware.h>
25#include <asm/irq.h> 27#include <asm/irq.h>
26#include <asm/hardware/arm_timer.h> 28#include <asm/hardware/arm_timer.h>
@@ -35,7 +37,7 @@ static struct amba_pl010_data integrator_uart_data;
35 37
36static struct amba_device rtc_device = { 38static struct amba_device rtc_device = {
37 .dev = { 39 .dev = {
38 .bus_id = "mb:15", 40 .init_name = "mb:15",
39 }, 41 },
40 .res = { 42 .res = {
41 .start = INTEGRATOR_RTC_BASE, 43 .start = INTEGRATOR_RTC_BASE,
@@ -48,7 +50,7 @@ static struct amba_device rtc_device = {
48 50
49static struct amba_device uart0_device = { 51static struct amba_device uart0_device = {
50 .dev = { 52 .dev = {
51 .bus_id = "mb:16", 53 .init_name = "mb:16",
52 .platform_data = &integrator_uart_data, 54 .platform_data = &integrator_uart_data,
53 }, 55 },
54 .res = { 56 .res = {
@@ -62,7 +64,7 @@ static struct amba_device uart0_device = {
62 64
63static struct amba_device uart1_device = { 65static struct amba_device uart1_device = {
64 .dev = { 66 .dev = {
65 .bus_id = "mb:17", 67 .init_name = "mb:17",
66 .platform_data = &integrator_uart_data, 68 .platform_data = &integrator_uart_data,
67 }, 69 },
68 .res = { 70 .res = {
@@ -76,7 +78,7 @@ static struct amba_device uart1_device = {
76 78
77static struct amba_device kmi0_device = { 79static struct amba_device kmi0_device = {
78 .dev = { 80 .dev = {
79 .bus_id = "mb:18", 81 .init_name = "mb:18",
80 }, 82 },
81 .res = { 83 .res = {
82 .start = KMI0_BASE, 84 .start = KMI0_BASE,
@@ -89,7 +91,7 @@ static struct amba_device kmi0_device = {
89 91
90static struct amba_device kmi1_device = { 92static struct amba_device kmi1_device = {
91 .dev = { 93 .dev = {
92 .bus_id = "mb:19", 94 .init_name = "mb:19",
93 }, 95 },
94 .res = { 96 .res = {
95 .start = KMI1_BASE, 97 .start = KMI1_BASE,
@@ -108,10 +110,43 @@ static struct amba_device *amba_devs[] __initdata = {
108 &kmi1_device, 110 &kmi1_device,
109}; 111};
110 112
113/*
114 * These are fixed clocks.
115 */
116static struct clk clk24mhz = {
117 .rate = 24000000,
118};
119
120static struct clk uartclk = {
121 .rate = 14745600,
122};
123
124static struct clk_lookup lookups[] __initdata = {
125 { /* UART0 */
126 .dev_id = "mb:16",
127 .clk = &uartclk,
128 }, { /* UART1 */
129 .dev_id = "mb:17",
130 .clk = &uartclk,
131 }, { /* KMI0 */
132 .dev_id = "mb:18",
133 .clk = &clk24mhz,
134 }, { /* KMI1 */
135 .dev_id = "mb:19",
136 .clk = &clk24mhz,
137 }, { /* MMCI - IntegratorCP */
138 .dev_id = "mb:1c",
139 .clk = &uartclk,
140 }
141};
142
111static int __init integrator_init(void) 143static int __init integrator_init(void)
112{ 144{
113 int i; 145 int i;
114 146
147 for (i = 0; i < ARRAY_SIZE(lookups); i++)
148 clkdev_add(&lookups[i]);
149
115 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 150 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
116 struct amba_device *d = amba_devs[i]; 151 struct amba_device *d = amba_devs[i];
117 amba_device_register(d, &iomem_resource); 152 amba_device_register(d, &iomem_resource);
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index 172299a78302..0058c937719e 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -22,13 +22,13 @@
22#include <linux/amba/clcd.h> 22#include <linux/amba/clcd.h>
23#include <linux/io.h> 23#include <linux/io.h>
24 24
25#include <asm/clkdev.h>
26#include <mach/clkdev.h>
25#include <asm/hardware/icst525.h> 27#include <asm/hardware/icst525.h>
26#include <mach/lm.h> 28#include <mach/lm.h>
27#include <mach/impd1.h> 29#include <mach/impd1.h>
28#include <asm/sizes.h> 30#include <asm/sizes.h>
29 31
30#include "clock.h"
31
32static int module_id; 32static int module_id;
33 33
34module_param_named(lmid, module_id, int, 0444); 34module_param_named(lmid, module_id, int, 0444);
@@ -37,6 +37,7 @@ MODULE_PARM_DESC(lmid, "logic module stack position");
37struct impd1_module { 37struct impd1_module {
38 void __iomem *base; 38 void __iomem *base;
39 struct clk vcos[2]; 39 struct clk vcos[2];
40 struct clk_lookup *clks[3];
40}; 41};
41 42
42static const struct icst525_params impd1_vco_params = { 43static const struct icst525_params impd1_vco_params = {
@@ -339,9 +340,8 @@ static struct impd1_device impd1_devs[] = {
339 } 340 }
340}; 341};
341 342
342static const char *impd1_vconames[2] = { 343static struct clk fixed_14745600 = {
343 "CLCDCLK", 344 .rate = 14745600,
344 "AUXVCO2",
345}; 345};
346 346
347static int impd1_probe(struct lm_device *dev) 347static int impd1_probe(struct lm_device *dev)
@@ -374,14 +374,20 @@ static int impd1_probe(struct lm_device *dev)
374 374
375 for (i = 0; i < ARRAY_SIZE(impd1->vcos); i++) { 375 for (i = 0; i < ARRAY_SIZE(impd1->vcos); i++) {
376 impd1->vcos[i].owner = THIS_MODULE, 376 impd1->vcos[i].owner = THIS_MODULE,
377 impd1->vcos[i].name = impd1_vconames[i],
378 impd1->vcos[i].params = &impd1_vco_params, 377 impd1->vcos[i].params = &impd1_vco_params,
379 impd1->vcos[i].data = impd1, 378 impd1->vcos[i].data = impd1,
380 impd1->vcos[i].setvco = impd1_setvco; 379 impd1->vcos[i].setvco = impd1_setvco;
381
382 clk_register(&impd1->vcos[i]);
383 } 380 }
384 381
382 impd1->clks[0] = clkdev_alloc(&impd1->vcos[0], NULL, "lm%x:01000",
383 dev->id);
384 impd1->clks[1] = clkdev_alloc(&fixed_14745600, NULL, "lm%x:00100",
385 dev->id);
386 impd1->clks[2] = clkdev_alloc(&fixed_14745600, NULL, "lm%x:00200",
387 dev->id);
388 for (i = 0; i < ARRAY_SIZE(impd1->clks); i++)
389 clkdev_add(impd1->clks[i]);
390
385 for (i = 0; i < ARRAY_SIZE(impd1_devs); i++) { 391 for (i = 0; i < ARRAY_SIZE(impd1_devs); i++) {
386 struct impd1_device *idev = impd1_devs + i; 392 struct impd1_device *idev = impd1_devs + i;
387 struct amba_device *d; 393 struct amba_device *d;
@@ -434,8 +440,8 @@ static void impd1_remove(struct lm_device *dev)
434 440
435 device_for_each_child(&dev->dev, NULL, impd1_remove_one); 441 device_for_each_child(&dev->dev, NULL, impd1_remove_one);
436 442
437 for (i = 0; i < ARRAY_SIZE(impd1->vcos); i++) 443 for (i = 0; i < ARRAY_SIZE(impd1->clks); i++)
438 clk_unregister(&impd1->vcos[i]); 444 clkdev_drop(impd1->clks[i]);
439 445
440 lm_set_drvdata(dev, NULL); 446 lm_set_drvdata(dev, NULL);
441 447
diff --git a/arch/arm/mach-integrator/include/mach/clkdev.h b/arch/arm/mach-integrator/include/mach/clkdev.h
new file mode 100644
index 000000000000..9293e410832a
--- /dev/null
+++ b/arch/arm/mach-integrator/include/mach/clkdev.h
@@ -0,0 +1,25 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#include <linux/module.h>
5#include <asm/hardware/icst525.h>
6
7struct clk {
8 unsigned long rate;
9 struct module *owner;
10 const struct icst525_params *params;
11 void *data;
12 void (*setvco)(struct clk *, struct icst525_vco vco);
13};
14
15static inline int __clk_get(struct clk *clk)
16{
17 return try_module_get(clk->owner);
18}
19
20static inline void __clk_put(struct clk *clk)
21{
22 module_put(clk->owner);
23}
24
25#endif
diff --git a/arch/arm/mach-integrator/include/mach/memory.h b/arch/arm/mach-integrator/include/mach/memory.h
index be7e63c21d25..2b2e7a110724 100644
--- a/arch/arm/mach-integrator/include/mach/memory.h
+++ b/arch/arm/mach-integrator/include/mach/memory.h
@@ -24,16 +24,9 @@
24 * Physical DRAM offset. 24 * Physical DRAM offset.
25 */ 25 */
26#define PHYS_OFFSET UL(0x00000000) 26#define PHYS_OFFSET UL(0x00000000)
27#define BUS_OFFSET UL(0x80000000)
28 27
29/* 28#define BUS_OFFSET UL(0x80000000)
30 * Virtual view <-> DMA view memory address translations 29#define __virt_to_bus(x) ((x) - PAGE_OFFSET + BUS_OFFSET)
31 * virt_to_bus: Used to translate the virtual address to an 30#define __bus_to_virt(x) ((x) - BUS_OFFSET + PAGE_OFFSET)
32 * address suitable to be passed to set_dma_addr
33 * bus_to_virt: Used to convert an address for DMA operations
34 * to an address that the kernel can use.
35 */
36#define __virt_to_bus(x) (x - PAGE_OFFSET + BUS_OFFSET)
37#define __bus_to_virt(x) (x - BUS_OFFSET + PAGE_OFFSET)
38 31
39#endif 32#endif
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 88026ccd5ac9..4ac04055c2ea 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -21,6 +21,8 @@
21#include <linux/amba/clcd.h> 21#include <linux/amba/clcd.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include <asm/clkdev.h>
25#include <mach/clkdev.h>
24#include <mach/hardware.h> 26#include <mach/hardware.h>
25#include <asm/irq.h> 27#include <asm/irq.h>
26#include <asm/setup.h> 28#include <asm/setup.h>
@@ -38,7 +40,6 @@
38#include <asm/mach/time.h> 40#include <asm/mach/time.h>
39 41
40#include "common.h" 42#include "common.h"
41#include "clock.h"
42 43
43#define INTCP_PA_MMC_BASE 0x1c000000 44#define INTCP_PA_MMC_BASE 0x1c000000
44#define INTCP_PA_AACI_BASE 0x1d000000 45#define INTCP_PA_AACI_BASE 0x1d000000
@@ -289,15 +290,16 @@ static void cp_auxvco_set(struct clk *clk, struct icst525_vco vco)
289 writel(0, CM_LOCK); 290 writel(0, CM_LOCK);
290} 291}
291 292
292static struct clk cp_clcd_clk = { 293static struct clk cp_auxclk = {
293 .name = "CLCDCLK",
294 .params = &cp_auxvco_params, 294 .params = &cp_auxvco_params,
295 .setvco = cp_auxvco_set, 295 .setvco = cp_auxvco_set,
296}; 296};
297 297
298static struct clk cp_mmci_clk = { 298static struct clk_lookup cp_lookups[] = {
299 .name = "MCLK", 299 { /* CLCD */
300 .rate = 14745600, 300 .dev_id = "mb:c0",
301 .clk = &cp_auxclk,
302 },
301}; 303};
302 304
303/* 305/*
@@ -405,7 +407,7 @@ static struct mmc_platform_data mmc_data = {
405 407
406static struct amba_device mmc_device = { 408static struct amba_device mmc_device = {
407 .dev = { 409 .dev = {
408 .bus_id = "mb:1c", 410 .init_name = "mb:1c",
409 .platform_data = &mmc_data, 411 .platform_data = &mmc_data,
410 }, 412 },
411 .res = { 413 .res = {
@@ -419,7 +421,7 @@ static struct amba_device mmc_device = {
419 421
420static struct amba_device aaci_device = { 422static struct amba_device aaci_device = {
421 .dev = { 423 .dev = {
422 .bus_id = "mb:1d", 424 .init_name = "mb:1d",
423 }, 425 },
424 .res = { 426 .res = {
425 .start = INTCP_PA_AACI_BASE, 427 .start = INTCP_PA_AACI_BASE,
@@ -530,7 +532,7 @@ static struct clcd_board clcd_data = {
530 532
531static struct amba_device clcd_device = { 533static struct amba_device clcd_device = {
532 .dev = { 534 .dev = {
533 .bus_id = "mb:c0", 535 .init_name = "mb:c0",
534 .coherent_dma_mask = ~0, 536 .coherent_dma_mask = ~0,
535 .platform_data = &clcd_data, 537 .platform_data = &clcd_data,
536 }, 538 },
@@ -554,8 +556,8 @@ static void __init intcp_init(void)
554{ 556{
555 int i; 557 int i;
556 558
557 clk_register(&cp_clcd_clk); 559 for (i = 0; i < ARRAY_SIZE(cp_lookups); i++)
558 clk_register(&cp_mmci_clk); 560 clkdev_add(&cp_lookups[i]);
559 561
560 platform_add_devices(intcp_devs, ARRAY_SIZE(intcp_devs)); 562 platform_add_devices(intcp_devs, ARRAY_SIZE(intcp_devs));
561 563
diff --git a/arch/arm/mach-iop13xx/include/mach/dma.h b/arch/arm/mach-iop13xx/include/mach/dma.h
deleted file mode 100644
index d79846fbb394..000000000000
--- a/arch/arm/mach-iop13xx/include/mach/dma.h
+++ /dev/null
@@ -1,3 +0,0 @@
1#ifndef _IOP13XX_DMA_H
2#define _IOP13XX_DMA_H
3#endif
diff --git a/arch/arm/mach-iop13xx/include/mach/memory.h b/arch/arm/mach-iop13xx/include/mach/memory.h
index b82602d529bf..e012bf13c955 100644
--- a/arch/arm/mach-iop13xx/include/mach/memory.h
+++ b/arch/arm/mach-iop13xx/include/mach/memory.h
@@ -16,18 +16,6 @@
16#define IOP13XX_PMMR_P_START (IOP13XX_PMMR_PHYS_MEM_BASE) 16#define IOP13XX_PMMR_P_START (IOP13XX_PMMR_PHYS_MEM_BASE)
17#define IOP13XX_PMMR_P_END (IOP13XX_PMMR_PHYS_MEM_BASE + IOP13XX_PMMR_SIZE) 17#define IOP13XX_PMMR_P_END (IOP13XX_PMMR_PHYS_MEM_BASE + IOP13XX_PMMR_SIZE)
18 18
19/*
20 * Virtual view <-> PCI DMA view memory address translations
21 * virt_to_bus: Used to translate the virtual address to an
22 * address suitable to be passed to set_dma_addr
23 * bus_to_virt: Used to convert an address for DMA operations
24 * to an address that the kernel can use.
25 */
26
27/* RAM has 1:1 mapping on the PCIe/x Busses */
28#define __virt_to_bus(x) (__virt_to_phys(x))
29#define __bus_to_virt(x) (__phys_to_virt(x))
30
31static inline dma_addr_t __virt_to_lbus(unsigned long x) 19static inline dma_addr_t __virt_to_lbus(unsigned long x)
32{ 20{
33 return x + IOP13XX_PMMR_PHYS_MEM_BASE - IOP13XX_PMMR_VIRT_MEM_BASE; 21 return x + IOP13XX_PMMR_PHYS_MEM_BASE - IOP13XX_PMMR_VIRT_MEM_BASE;
@@ -55,7 +43,7 @@ static inline unsigned long __lbus_to_virt(dma_addr_t x)
55 if (is_lbus_device(dev) && __is_lbus_dma(__dma)) \ 43 if (is_lbus_device(dev) && __is_lbus_dma(__dma)) \
56 __virt = __lbus_to_virt(__dma); \ 44 __virt = __lbus_to_virt(__dma); \
57 else \ 45 else \
58 __virt = __bus_to_virt(__dma); \ 46 __virt = __phys_to_virt(__dma); \
59 (void *)__virt; \ 47 (void *)__virt; \
60 }) 48 })
61 49
@@ -66,7 +54,7 @@ static inline unsigned long __lbus_to_virt(dma_addr_t x)
66 if (is_lbus_device(dev) && __is_lbus_virt(__virt)) \ 54 if (is_lbus_device(dev) && __is_lbus_virt(__virt)) \
67 __dma = __virt_to_lbus(__virt); \ 55 __dma = __virt_to_lbus(__virt); \
68 else \ 56 else \
69 __dma = __virt_to_bus(__virt); \ 57 __dma = __virt_to_phys(__virt); \
70 __dma; \ 58 __dma; \
71 }) 59 })
72 60
diff --git a/arch/arm/mach-iop13xx/include/mach/timex.h b/arch/arm/mach-iop13xx/include/mach/timex.h
index 5b1f1c8a8270..45fb2745bb54 100644
--- a/arch/arm/mach-iop13xx/include/mach/timex.h
+++ b/arch/arm/mach-iop13xx/include/mach/timex.h
@@ -1,3 +1 @@
1#include <mach/hardware.h>
2
3#define CLOCK_TICK_RATE (100 * HZ) #define CLOCK_TICK_RATE (100 * HZ)
diff --git a/arch/arm/mach-iop32x/include/mach/dma.h b/arch/arm/mach-iop32x/include/mach/dma.h
deleted file mode 100644
index f8bd817f205d..000000000000
--- a/arch/arm/mach-iop32x/include/mach/dma.h
+++ /dev/null
@@ -1,9 +0,0 @@
1/*
2 * arch/arm/mach-iop32x/include/mach/dma.h
3 *
4 * Copyright (C) 2004 Intel Corp.
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 */
diff --git a/arch/arm/mach-iop32x/include/mach/io.h b/arch/arm/mach-iop32x/include/mach/io.h
index ce54705ba3d4..339e5854728b 100644
--- a/arch/arm/mach-iop32x/include/mach/io.h
+++ b/arch/arm/mach-iop32x/include/mach/io.h
@@ -11,7 +11,7 @@
11#ifndef __IO_H 11#ifndef __IO_H
12#define __IO_H 12#define __IO_H
13 13
14#include <mach/hardware.h> 14#include <asm/hardware/iop3xx.h>
15 15
16extern void __iomem *__iop3xx_ioremap(unsigned long cookie, size_t size, 16extern void __iomem *__iop3xx_ioremap(unsigned long cookie, size_t size,
17 unsigned int mtype); 17 unsigned int mtype);
diff --git a/arch/arm/mach-iop32x/include/mach/memory.h b/arch/arm/mach-iop32x/include/mach/memory.h
index 42cd4bf3148c..c30f6450ad50 100644
--- a/arch/arm/mach-iop32x/include/mach/memory.h
+++ b/arch/arm/mach-iop32x/include/mach/memory.h
@@ -5,22 +5,9 @@
5#ifndef __MEMORY_H 5#ifndef __MEMORY_H
6#define __MEMORY_H 6#define __MEMORY_H
7 7
8#include <mach/hardware.h>
9
10/* 8/*
11 * Physical DRAM offset. 9 * Physical DRAM offset.
12 */ 10 */
13#define PHYS_OFFSET UL(0xa0000000) 11#define PHYS_OFFSET UL(0xa0000000)
14 12
15/*
16 * Virtual view <-> PCI DMA view memory address translations
17 * virt_to_bus: Used to translate the virtual address to an
18 * address suitable to be passed to set_dma_addr
19 * bus_to_virt: Used to convert an address for DMA operations
20 * to an address that the kernel can use.
21 */
22#define __virt_to_bus(x) (__virt_to_phys(x))
23#define __bus_to_virt(x) (__phys_to_virt(x))
24
25
26#endif 13#endif
diff --git a/arch/arm/mach-iop32x/include/mach/system.h b/arch/arm/mach-iop32x/include/mach/system.h
index 20f923e54f46..32d9e5b0a28d 100644
--- a/arch/arm/mach-iop32x/include/mach/system.h
+++ b/arch/arm/mach-iop32x/include/mach/system.h
@@ -7,8 +7,9 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10
11#include <asm/mach-types.h> 10#include <asm/mach-types.h>
11#include <asm/hardware/iop3xx.h>
12#include <mach/n2100.h>
12 13
13static inline void arch_idle(void) 14static inline void arch_idle(void)
14{ 15{
diff --git a/arch/arm/mach-iop32x/include/mach/timex.h b/arch/arm/mach-iop32x/include/mach/timex.h
index a541afced3cb..7262ab81419d 100644
--- a/arch/arm/mach-iop32x/include/mach/timex.h
+++ b/arch/arm/mach-iop32x/include/mach/timex.h
@@ -3,7 +3,4 @@
3 * 3 *
4 * IOP32x architecture timex specifications 4 * IOP32x architecture timex specifications
5 */ 5 */
6
7#include <mach/hardware.h>
8
9#define CLOCK_TICK_RATE (100 * HZ) 6#define CLOCK_TICK_RATE (100 * HZ)
diff --git a/arch/arm/mach-iop33x/include/mach/dma.h b/arch/arm/mach-iop33x/include/mach/dma.h
deleted file mode 100644
index d8b42232931d..000000000000
--- a/arch/arm/mach-iop33x/include/mach/dma.h
+++ /dev/null
@@ -1,9 +0,0 @@
1/*
2 * arch/arm/mach-iop33x/include/mach/dma.h
3 *
4 * Copyright (C) 2004 Intel Corp.
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 */
diff --git a/arch/arm/mach-iop33x/include/mach/io.h b/arch/arm/mach-iop33x/include/mach/io.h
index 158874631217..e99a7ed6d050 100644
--- a/arch/arm/mach-iop33x/include/mach/io.h
+++ b/arch/arm/mach-iop33x/include/mach/io.h
@@ -11,7 +11,7 @@
11#ifndef __IO_H 11#ifndef __IO_H
12#define __IO_H 12#define __IO_H
13 13
14#include <mach/hardware.h> 14#include <asm/hardware/iop3xx.h>
15 15
16extern void __iomem *__iop3xx_ioremap(unsigned long cookie, size_t size, 16extern void __iomem *__iop3xx_ioremap(unsigned long cookie, size_t size,
17 unsigned int mtype); 17 unsigned int mtype);
diff --git a/arch/arm/mach-iop33x/include/mach/memory.h b/arch/arm/mach-iop33x/include/mach/memory.h
index 2cef0bbb354f..a30a96aa6d2d 100644
--- a/arch/arm/mach-iop33x/include/mach/memory.h
+++ b/arch/arm/mach-iop33x/include/mach/memory.h
@@ -5,22 +5,9 @@
5#ifndef __MEMORY_H 5#ifndef __MEMORY_H
6#define __MEMORY_H 6#define __MEMORY_H
7 7
8#include <mach/hardware.h>
9
10/* 8/*
11 * Physical DRAM offset. 9 * Physical DRAM offset.
12 */ 10 */
13#define PHYS_OFFSET UL(0x00000000) 11#define PHYS_OFFSET UL(0x00000000)
14 12
15/*
16 * Virtual view <-> PCI DMA view memory address translations
17 * virt_to_bus: Used to translate the virtual address to an
18 * address suitable to be passed to set_dma_addr
19 * bus_to_virt: Used to convert an address for DMA operations
20 * to an address that the kernel can use.
21 */
22#define __virt_to_bus(x) (__virt_to_phys(x))
23#define __bus_to_virt(x) (__phys_to_virt(x))
24
25
26#endif 13#endif
diff --git a/arch/arm/mach-iop33x/include/mach/system.h b/arch/arm/mach-iop33x/include/mach/system.h
index 7bf3bfb49446..0cb3ad862acd 100644
--- a/arch/arm/mach-iop33x/include/mach/system.h
+++ b/arch/arm/mach-iop33x/include/mach/system.h
@@ -7,6 +7,7 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#include <asm/hardware/iop3xx.h>
10 11
11static inline void arch_idle(void) 12static inline void arch_idle(void)
12{ 13{
diff --git a/arch/arm/mach-iop33x/include/mach/timex.h b/arch/arm/mach-iop33x/include/mach/timex.h
index c75760844d49..54c589091d6e 100644
--- a/arch/arm/mach-iop33x/include/mach/timex.h
+++ b/arch/arm/mach-iop33x/include/mach/timex.h
@@ -3,7 +3,4 @@
3 * 3 *
4 * IOP3xx architecture timex specifications 4 * IOP3xx architecture timex specifications
5 */ 5 */
6
7#include <mach/hardware.h>
8
9#define CLOCK_TICK_RATE (100 * HZ) 6#define CLOCK_TICK_RATE (100 * HZ)
diff --git a/arch/arm/mach-ixp2000/include/mach/dma.h b/arch/arm/mach-ixp2000/include/mach/dma.h
deleted file mode 100644
index 26063d60f622..000000000000
--- a/arch/arm/mach-ixp2000/include/mach/dma.h
+++ /dev/null
@@ -1,9 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/dma.h
3 *
4 * Copyright (C) 2002 Intel Corp.
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 */
diff --git a/arch/arm/mach-ixp2000/include/mach/memory.h b/arch/arm/mach-ixp2000/include/mach/memory.h
index 241529a7c52d..aee7eb8a71b2 100644
--- a/arch/arm/mach-ixp2000/include/mach/memory.h
+++ b/arch/arm/mach-ixp2000/include/mach/memory.h
@@ -15,13 +15,6 @@
15 15
16#define PHYS_OFFSET UL(0x00000000) 16#define PHYS_OFFSET UL(0x00000000)
17 17
18/*
19 * Virtual view <-> DMA view memory address translations
20 * virt_to_bus: Used to translate the virtual address to an
21 * address suitable to be passed to set_dma_addr
22 * bus_to_virt: Used to convert an address for DMA operations
23 * to an address that the kernel can use.
24 */
25#include <mach/ixp2000-regs.h> 18#include <mach/ixp2000-regs.h>
26 19
27#define __virt_to_bus(v) \ 20#define __virt_to_bus(v) \
diff --git a/arch/arm/mach-ixp23xx/include/mach/dma.h b/arch/arm/mach-ixp23xx/include/mach/dma.h
deleted file mode 100644
index 8886544b93f7..000000000000
--- a/arch/arm/mach-ixp23xx/include/mach/dma.h
+++ /dev/null
@@ -1,3 +0,0 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/dma.h
3 */
diff --git a/arch/arm/mach-ixp23xx/include/mach/io.h b/arch/arm/mach-ixp23xx/include/mach/io.h
index 305ea1808c71..fd9ef8e519f7 100644
--- a/arch/arm/mach-ixp23xx/include/mach/io.h
+++ b/arch/arm/mach-ixp23xx/include/mach/io.h
@@ -20,8 +20,6 @@
20#define __io(p) ((void __iomem*)((p) + IXP23XX_PCI_IO_VIRT)) 20#define __io(p) ((void __iomem*)((p) + IXP23XX_PCI_IO_VIRT))
21#define __mem_pci(a) (a) 21#define __mem_pci(a) (a)
22 22
23#include <linux/kernel.h> /* For BUG */
24
25static inline void __iomem * 23static inline void __iomem *
26ixp23xx_ioremap(unsigned long addr, unsigned long size, unsigned int mtype) 24ixp23xx_ioremap(unsigned long addr, unsigned long size, unsigned int mtype)
27{ 25{
diff --git a/arch/arm/mach-ixp23xx/include/mach/memory.h b/arch/arm/mach-ixp23xx/include/mach/memory.h
index 9d40115f7ebe..fdd138706c70 100644
--- a/arch/arm/mach-ixp23xx/include/mach/memory.h
+++ b/arch/arm/mach-ixp23xx/include/mach/memory.h
@@ -19,16 +19,6 @@
19 */ 19 */
20#define PHYS_OFFSET (0x00000000) 20#define PHYS_OFFSET (0x00000000)
21 21
22
23/*
24 * Virtual view <-> DMA view memory address translations
25 * virt_to_bus: Used to translate the virtual address to an
26 * address suitable to be passed to set_dma_addr
27 * bus_to_virt: Used to convert an address for DMA operations
28 * to an address that the kernel can use.
29 */
30#ifndef __ASSEMBLY__
31
32#define __virt_to_bus(v) \ 22#define __virt_to_bus(v) \
33 ({ unsigned int ret; \ 23 ({ unsigned int ret; \
34 ret = ((__virt_to_phys(v) - 0x00000000) + \ 24 ret = ((__virt_to_phys(v) - 0x00000000) + \
@@ -43,6 +33,3 @@
43#define arch_is_coherent() 1 33#define arch_is_coherent() 1
44 34
45#endif 35#endif
46
47
48#endif
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 7766f469456b..f4656d2ac8a8 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -487,7 +487,7 @@ static int __init ixp4xx_clockevent_init(void)
487 clockevent_delta2ns(0xfffffffe, &clockevent_ixp4xx); 487 clockevent_delta2ns(0xfffffffe, &clockevent_ixp4xx);
488 clockevent_ixp4xx.min_delta_ns = 488 clockevent_ixp4xx.min_delta_ns =
489 clockevent_delta2ns(0xf, &clockevent_ixp4xx); 489 clockevent_delta2ns(0xf, &clockevent_ixp4xx);
490 clockevent_ixp4xx.cpumask = cpumask_of_cpu(0); 490 clockevent_ixp4xx.cpumask = cpumask_of(0);
491 491
492 clockevents_register_device(&clockevent_ixp4xx); 492 clockevents_register_device(&clockevent_ixp4xx);
493 return 0; 493 return 0;
diff --git a/arch/arm/mach-ixp4xx/fsg-setup.c b/arch/arm/mach-ixp4xx/fsg-setup.c
index e7c6386782ed..5add22fc9899 100644
--- a/arch/arm/mach-ixp4xx/fsg-setup.c
+++ b/arch/arm/mach-ixp4xx/fsg-setup.c
@@ -177,7 +177,6 @@ static irqreturn_t fsg_reset_handler(int irq, void *dev_id)
177 177
178static void __init fsg_init(void) 178static void __init fsg_init(void)
179{ 179{
180 DECLARE_MAC_BUF(mac_buf);
181 uint8_t __iomem *f; 180 uint8_t __iomem *f;
182 181
183 ixp4xx_sys_init(); 182 ixp4xx_sys_init();
@@ -256,10 +255,10 @@ static void __init fsg_init(void)
256#endif 255#endif
257 iounmap(f); 256 iounmap(f);
258 } 257 }
259 printk(KERN_INFO "FSG: Using MAC address %s for port 0\n", 258 printk(KERN_INFO "FSG: Using MAC address %pM for port 0\n",
260 print_mac(mac_buf, fsg_plat_eth[0].hwaddr)); 259 fsg_plat_eth[0].hwaddr);
261 printk(KERN_INFO "FSG: Using MAC address %s for port 1\n", 260 printk(KERN_INFO "FSG: Using MAC address %pM for port 1\n",
262 print_mac(mac_buf, fsg_plat_eth[1].hwaddr)); 261 fsg_plat_eth[1].hwaddr);
263 262
264} 263}
265 264
diff --git a/arch/arm/mach-ixp4xx/include/mach/dma.h b/arch/arm/mach-ixp4xx/include/mach/dma.h
deleted file mode 100644
index 00c5070c0201..000000000000
--- a/arch/arm/mach-ixp4xx/include/mach/dma.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/dma.h
3 *
4 * Copyright (C) 2001-2004 MontaVista Software, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11#ifndef __ASM_ARCH_DMA_H
12#define __ASM_ARCH_DMA_H
13
14#include <linux/device.h>
15#include <asm/page.h>
16#include <asm/sizes.h>
17#include <mach/hardware.h>
18
19#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_64M)
20
21#endif /* _ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h
index 319948e31bec..ce63048d45eb 100644
--- a/arch/arm/mach-ixp4xx/include/mach/io.h
+++ b/arch/arm/mach-ixp4xx/include/mach/io.h
@@ -49,8 +49,6 @@ extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data);
49 49
50#else 50#else
51 51
52#include <linux/mm.h>
53
54/* 52/*
55 * In the case of using indirect PCI, we simply return the actual PCI 53 * In the case of using indirect PCI, we simply return the actual PCI
56 * address and our read/write implementation use that to drive the 54 * address and our read/write implementation use that to drive the
@@ -241,7 +239,7 @@ __ixp4xx_readsl(const volatile void __iomem *bus_addr, u32 *vaddr, u32 count)
241 239
242#ifndef CONFIG_PCI 240#ifndef CONFIG_PCI
243 241
244#define __io(v) v 242#define __io(v) __typesafe_io(v)
245 243
246#else 244#else
247 245
diff --git a/arch/arm/mach-ixp4xx/include/mach/memory.h b/arch/arm/mach-ixp4xx/include/mach/memory.h
index c4d2830ac987..98f5e5e20980 100644
--- a/arch/arm/mach-ixp4xx/include/mach/memory.h
+++ b/arch/arm/mach-ixp4xx/include/mach/memory.h
@@ -22,19 +22,8 @@ void ixp4xx_adjust_zones(int node, unsigned long *size, unsigned long *holes);
22 ixp4xx_adjust_zones(node, size, holes) 22 ixp4xx_adjust_zones(node, size, holes)
23 23
24#define ISA_DMA_THRESHOLD (SZ_64M - 1) 24#define ISA_DMA_THRESHOLD (SZ_64M - 1)
25#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_64M)
25 26
26#endif 27#endif
27 28
28/*
29 * Virtual view <-> DMA view memory address translations
30 * virt_to_bus: Used to translate the virtual address to an
31 * address suitable to be passed to set_dma_addr
32 * bus_to_virt: Used to convert an address for DMA operations
33 * to an address that the kernel can use.
34 *
35 * These are dummies for now.
36 */
37#define __virt_to_bus(x) __virt_to_phys(x)
38#define __bus_to_virt(x) __phys_to_virt(x)
39
40#endif 29#endif
diff --git a/arch/arm/mach-ixp4xx/include/mach/qmgr.h b/arch/arm/mach-ixp4xx/include/mach/qmgr.h
index 1e52b95cede5..0cbe6ceb67c5 100644
--- a/arch/arm/mach-ixp4xx/include/mach/qmgr.h
+++ b/arch/arm/mach-ixp4xx/include/mach/qmgr.h
@@ -12,6 +12,8 @@
12#include <linux/io.h> 12#include <linux/io.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14 14
15#define DEBUG_QMGR 0
16
15#define HALF_QUEUES 32 17#define HALF_QUEUES 32
16#define QUEUES 64 /* only 32 lower queues currently supported */ 18#define QUEUES 64 /* only 32 lower queues currently supported */
17#define MAX_QUEUE_LENGTH 4 /* in dwords */ 19#define MAX_QUEUE_LENGTH 4 /* in dwords */
@@ -61,22 +63,51 @@ void qmgr_enable_irq(unsigned int queue);
61void qmgr_disable_irq(unsigned int queue); 63void qmgr_disable_irq(unsigned int queue);
62 64
63/* request_ and release_queue() must be called from non-IRQ context */ 65/* request_ and release_queue() must be called from non-IRQ context */
66
67#if DEBUG_QMGR
68extern char qmgr_queue_descs[QUEUES][32];
69
64int qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */, 70int qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */,
65 unsigned int nearly_empty_watermark, 71 unsigned int nearly_empty_watermark,
66 unsigned int nearly_full_watermark); 72 unsigned int nearly_full_watermark,
73 const char *desc_format, const char* name);
74#else
75int __qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */,
76 unsigned int nearly_empty_watermark,
77 unsigned int nearly_full_watermark);
78#define qmgr_request_queue(queue, len, nearly_empty_watermark, \
79 nearly_full_watermark, desc_format, name) \
80 __qmgr_request_queue(queue, len, nearly_empty_watermark, \
81 nearly_full_watermark)
82#endif
83
67void qmgr_release_queue(unsigned int queue); 84void qmgr_release_queue(unsigned int queue);
68 85
69 86
70static inline void qmgr_put_entry(unsigned int queue, u32 val) 87static inline void qmgr_put_entry(unsigned int queue, u32 val)
71{ 88{
72 extern struct qmgr_regs __iomem *qmgr_regs; 89 extern struct qmgr_regs __iomem *qmgr_regs;
90#if DEBUG_QMGR
91 BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */
92
93 printk(KERN_DEBUG "Queue %s(%i) put %X\n",
94 qmgr_queue_descs[queue], queue, val);
95#endif
73 __raw_writel(val, &qmgr_regs->acc[queue][0]); 96 __raw_writel(val, &qmgr_regs->acc[queue][0]);
74} 97}
75 98
76static inline u32 qmgr_get_entry(unsigned int queue) 99static inline u32 qmgr_get_entry(unsigned int queue)
77{ 100{
101 u32 val;
78 extern struct qmgr_regs __iomem *qmgr_regs; 102 extern struct qmgr_regs __iomem *qmgr_regs;
79 return __raw_readl(&qmgr_regs->acc[queue][0]); 103 val = __raw_readl(&qmgr_regs->acc[queue][0]);
104#if DEBUG_QMGR
105 BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */
106
107 printk(KERN_DEBUG "Queue %s(%i) get %X\n",
108 qmgr_queue_descs[queue], queue, val);
109#endif
110 return val;
80} 111}
81 112
82static inline int qmgr_get_stat1(unsigned int queue) 113static inline int qmgr_get_stat1(unsigned int queue)
diff --git a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
index c6cb069a5a83..bfddc73d0a20 100644
--- a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
+++ b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
@@ -14,8 +14,6 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <mach/qmgr.h> 15#include <mach/qmgr.h>
16 16
17#define DEBUG 0
18
19struct qmgr_regs __iomem *qmgr_regs; 17struct qmgr_regs __iomem *qmgr_regs;
20static struct resource *mem_res; 18static struct resource *mem_res;
21static spinlock_t qmgr_lock; 19static spinlock_t qmgr_lock;
@@ -23,6 +21,10 @@ static u32 used_sram_bitmap[4]; /* 128 16-dword pages */
23static void (*irq_handlers[HALF_QUEUES])(void *pdev); 21static void (*irq_handlers[HALF_QUEUES])(void *pdev);
24static void *irq_pdevs[HALF_QUEUES]; 22static void *irq_pdevs[HALF_QUEUES];
25 23
24#if DEBUG_QMGR
25char qmgr_queue_descs[QUEUES][32];
26#endif
27
26void qmgr_set_irq(unsigned int queue, int src, 28void qmgr_set_irq(unsigned int queue, int src,
27 void (*handler)(void *pdev), void *pdev) 29 void (*handler)(void *pdev), void *pdev)
28{ 30{
@@ -70,6 +72,7 @@ void qmgr_disable_irq(unsigned int queue)
70 spin_lock_irqsave(&qmgr_lock, flags); 72 spin_lock_irqsave(&qmgr_lock, flags);
71 __raw_writel(__raw_readl(&qmgr_regs->irqen[0]) & ~(1 << queue), 73 __raw_writel(__raw_readl(&qmgr_regs->irqen[0]) & ~(1 << queue),
72 &qmgr_regs->irqen[0]); 74 &qmgr_regs->irqen[0]);
75 __raw_writel(1 << queue, &qmgr_regs->irqstat[0]); /* clear */
73 spin_unlock_irqrestore(&qmgr_lock, flags); 76 spin_unlock_irqrestore(&qmgr_lock, flags);
74} 77}
75 78
@@ -81,9 +84,16 @@ static inline void shift_mask(u32 *mask)
81 mask[0] <<= 1; 84 mask[0] <<= 1;
82} 85}
83 86
87#if DEBUG_QMGR
84int qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */, 88int qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */,
85 unsigned int nearly_empty_watermark, 89 unsigned int nearly_empty_watermark,
86 unsigned int nearly_full_watermark) 90 unsigned int nearly_full_watermark,
91 const char *desc_format, const char* name)
92#else
93int __qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */,
94 unsigned int nearly_empty_watermark,
95 unsigned int nearly_full_watermark)
96#endif
87{ 97{
88 u32 cfg, addr = 0, mask[4]; /* in 16-dwords */ 98 u32 cfg, addr = 0, mask[4]; /* in 16-dwords */
89 int err; 99 int err;
@@ -151,12 +161,13 @@ int qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */,
151 used_sram_bitmap[2] |= mask[2]; 161 used_sram_bitmap[2] |= mask[2];
152 used_sram_bitmap[3] |= mask[3]; 162 used_sram_bitmap[3] |= mask[3];
153 __raw_writel(cfg | (addr << 14), &qmgr_regs->sram[queue]); 163 __raw_writel(cfg | (addr << 14), &qmgr_regs->sram[queue]);
154 spin_unlock_irq(&qmgr_lock); 164#if DEBUG_QMGR
155 165 snprintf(qmgr_queue_descs[queue], sizeof(qmgr_queue_descs[0]),
156#if DEBUG 166 desc_format, name);
157 printk(KERN_DEBUG "qmgr: requested queue %i, addr = 0x%02X\n", 167 printk(KERN_DEBUG "qmgr: requested queue %s(%i) addr = 0x%02X\n",
158 queue, addr); 168 qmgr_queue_descs[queue], queue, addr);
159#endif 169#endif
170 spin_unlock_irq(&qmgr_lock);
160 return 0; 171 return 0;
161 172
162err: 173err:
@@ -189,6 +200,11 @@ void qmgr_release_queue(unsigned int queue)
189 while (addr--) 200 while (addr--)
190 shift_mask(mask); 201 shift_mask(mask);
191 202
203#if DEBUG_QMGR
204 printk(KERN_DEBUG "qmgr: releasing queue %s(%i)\n",
205 qmgr_queue_descs[queue], queue);
206 qmgr_queue_descs[queue][0] = '\x0';
207#endif
192 __raw_writel(0, &qmgr_regs->sram[queue]); 208 __raw_writel(0, &qmgr_regs->sram[queue]);
193 209
194 used_sram_bitmap[0] &= ~mask[0]; 210 used_sram_bitmap[0] &= ~mask[0];
@@ -199,9 +215,10 @@ void qmgr_release_queue(unsigned int queue)
199 spin_unlock_irq(&qmgr_lock); 215 spin_unlock_irq(&qmgr_lock);
200 216
201 module_put(THIS_MODULE); 217 module_put(THIS_MODULE);
202#if DEBUG 218
203 printk(KERN_DEBUG "qmgr: released queue %i\n", queue); 219 while ((addr = qmgr_get_entry(queue)))
204#endif 220 printk(KERN_ERR "qmgr: released queue %i not empty: 0x%08X\n",
221 queue, addr);
205} 222}
206 223
207static int qmgr_init(void) 224static int qmgr_init(void)
@@ -272,5 +289,10 @@ EXPORT_SYMBOL(qmgr_regs);
272EXPORT_SYMBOL(qmgr_set_irq); 289EXPORT_SYMBOL(qmgr_set_irq);
273EXPORT_SYMBOL(qmgr_enable_irq); 290EXPORT_SYMBOL(qmgr_enable_irq);
274EXPORT_SYMBOL(qmgr_disable_irq); 291EXPORT_SYMBOL(qmgr_disable_irq);
292#if DEBUG_QMGR
293EXPORT_SYMBOL(qmgr_queue_descs);
275EXPORT_SYMBOL(qmgr_request_queue); 294EXPORT_SYMBOL(qmgr_request_queue);
295#else
296EXPORT_SYMBOL(__qmgr_request_queue);
297#endif
276EXPORT_SYMBOL(qmgr_release_queue); 298EXPORT_SYMBOL(qmgr_release_queue);
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index 0acd95ecf27e..921c947b5b6b 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -231,7 +231,6 @@ static irqreturn_t nas100d_reset_handler(int irq, void *dev_id)
231 231
232static void __init nas100d_init(void) 232static void __init nas100d_init(void)
233{ 233{
234 DECLARE_MAC_BUF(mac_buf);
235 uint8_t __iomem *f; 234 uint8_t __iomem *f;
236 int i; 235 int i;
237 236
@@ -294,8 +293,8 @@ static void __init nas100d_init(void)
294#endif 293#endif
295 iounmap(f); 294 iounmap(f);
296 } 295 }
297 printk(KERN_INFO "NAS100D: Using MAC address %s for port 0\n", 296 printk(KERN_INFO "NAS100D: Using MAC address %pM for port 0\n",
298 print_mac(mac_buf, nas100d_plat_eth[0].hwaddr)); 297 nas100d_plat_eth[0].hwaddr);
299 298
300} 299}
301 300
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index bc9d920ae54f..ff6a08d02cc4 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -220,7 +220,6 @@ static struct sys_timer nslu2_timer = {
220 220
221static void __init nslu2_init(void) 221static void __init nslu2_init(void)
222{ 222{
223 DECLARE_MAC_BUF(mac_buf);
224 uint8_t __iomem *f; 223 uint8_t __iomem *f;
225 int i; 224 int i;
226 225
@@ -275,8 +274,8 @@ static void __init nslu2_init(void)
275#endif 274#endif
276 iounmap(f); 275 iounmap(f);
277 } 276 }
278 printk(KERN_INFO "NSLU2: Using MAC address %s for port 0\n", 277 printk(KERN_INFO "NSLU2: Using MAC address %pM for port 0\n",
279 print_mac(mac_buf, nslu2_plat_eth[0].hwaddr)); 278 nslu2_plat_eth[0].hwaddr);
280 279
281} 280}
282 281
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 0bb1fbd84ccb..7b8ef97fb501 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -57,6 +57,7 @@ void __init kirkwood_map_io(void)
57 ****************************************************************************/ 57 ****************************************************************************/
58static struct orion_ehci_data kirkwood_ehci_data = { 58static struct orion_ehci_data kirkwood_ehci_data = {
59 .dram = &kirkwood_mbus_dram_info, 59 .dram = &kirkwood_mbus_dram_info,
60 .phy_version = EHCI_PHY_NA,
60}; 61};
61 62
62static u64 ehci_dmamask = 0xffffffffUL; 63static u64 ehci_dmamask = 0xffffffffUL;
@@ -153,6 +154,64 @@ void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data)
153 154
154 155
155/***************************************************************************** 156/*****************************************************************************
157 * GE01
158 ****************************************************************************/
159struct mv643xx_eth_shared_platform_data kirkwood_ge01_shared_data = {
160 .dram = &kirkwood_mbus_dram_info,
161 .shared_smi = &kirkwood_ge00_shared,
162};
163
164static struct resource kirkwood_ge01_shared_resources[] = {
165 {
166 .name = "ge01 base",
167 .start = GE01_PHYS_BASE + 0x2000,
168 .end = GE01_PHYS_BASE + 0x3fff,
169 .flags = IORESOURCE_MEM,
170 }, {
171 .name = "ge01 err irq",
172 .start = IRQ_KIRKWOOD_GE01_ERR,
173 .end = IRQ_KIRKWOOD_GE01_ERR,
174 .flags = IORESOURCE_IRQ,
175 },
176};
177
178static struct platform_device kirkwood_ge01_shared = {
179 .name = MV643XX_ETH_SHARED_NAME,
180 .id = 1,
181 .dev = {
182 .platform_data = &kirkwood_ge01_shared_data,
183 },
184 .num_resources = ARRAY_SIZE(kirkwood_ge01_shared_resources),
185 .resource = kirkwood_ge01_shared_resources,
186};
187
188static struct resource kirkwood_ge01_resources[] = {
189 {
190 .name = "ge01 irq",
191 .start = IRQ_KIRKWOOD_GE01_SUM,
192 .end = IRQ_KIRKWOOD_GE01_SUM,
193 .flags = IORESOURCE_IRQ,
194 },
195};
196
197static struct platform_device kirkwood_ge01 = {
198 .name = MV643XX_ETH_NAME,
199 .id = 1,
200 .num_resources = 1,
201 .resource = kirkwood_ge01_resources,
202};
203
204void __init kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data)
205{
206 eth_data->shared = &kirkwood_ge01_shared;
207 kirkwood_ge01.dev.platform_data = eth_data;
208
209 platform_device_register(&kirkwood_ge01_shared);
210 platform_device_register(&kirkwood_ge01);
211}
212
213
214/*****************************************************************************
156 * Ethernet switch 215 * Ethernet switch
157 ****************************************************************************/ 216 ****************************************************************************/
158static struct resource kirkwood_switch_resources[] = { 217static struct resource kirkwood_switch_resources[] = {
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 5774632a67e3..fe367c18e722 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -30,6 +30,7 @@ void kirkwood_pcie_id(u32 *dev, u32 *rev);
30 30
31void kirkwood_ehci_init(void); 31void kirkwood_ehci_init(void);
32void kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data); 32void kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data);
33void kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data);
33void kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq); 34void kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq);
34void kirkwood_pcie_init(void); 35void kirkwood_pcie_init(void);
35void kirkwood_rtc_init(void); 36void kirkwood_rtc_init(void);
diff --git a/arch/arm/mach-kirkwood/include/mach/dma.h b/arch/arm/mach-kirkwood/include/mach/dma.h
deleted file mode 100644
index 40a8c178f10d..000000000000
--- a/arch/arm/mach-kirkwood/include/mach/dma.h
+++ /dev/null
@@ -1 +0,0 @@
1/* empty */
diff --git a/arch/arm/mach-kirkwood/include/mach/gpio.h b/arch/arm/mach-kirkwood/include/mach/gpio.h
new file mode 100644
index 000000000000..81b335eb62ec
--- /dev/null
+++ b/arch/arm/mach-kirkwood/include/mach/gpio.h
@@ -0,0 +1,38 @@
1/*
2 * arch/asm-arm/mach-kirkwood/include/mach/gpio.h
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#ifndef __ASM_ARCH_GPIO_H
10#define __ASM_ARCH_GPIO_H
11
12#include <mach/irqs.h>
13#include <plat/gpio.h>
14#include <asm-generic/gpio.h> /* cansleep wrappers */
15
16#define GPIO_MAX 50
17#define GPIO_OFF(pin) (((pin) >> 5) ? 0x0140 : 0x0100)
18#define GPIO_OUT(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x00)
19#define GPIO_IO_CONF(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x04)
20#define GPIO_BLINK_EN(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x08)
21#define GPIO_IN_POL(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x0c)
22#define GPIO_DATA_IN(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x10)
23#define GPIO_EDGE_CAUSE(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x14)
24#define GPIO_EDGE_MASK(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x18)
25#define GPIO_LEVEL_MASK(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x1c)
26
27static inline int gpio_to_irq(int pin)
28{
29 return pin + IRQ_KIRKWOOD_GPIO_START;
30}
31
32static inline int irq_to_gpio(int irq)
33{
34 return irq - IRQ_KIRKWOOD_GPIO_START;
35}
36
37
38#endif
diff --git a/arch/arm/mach-kirkwood/include/mach/irqs.h b/arch/arm/mach-kirkwood/include/mach/irqs.h
index ffab89f21c11..f00a0a45a67e 100644
--- a/arch/arm/mach-kirkwood/include/mach/irqs.h
+++ b/arch/arm/mach-kirkwood/include/mach/irqs.h
@@ -11,8 +11,6 @@
11#ifndef __ASM_ARCH_IRQS_H 11#ifndef __ASM_ARCH_IRQS_H
12#define __ASM_ARCH_IRQS_H 12#define __ASM_ARCH_IRQS_H
13 13
14#include "kirkwood.h" /* need GPIO_MAX */
15
16/* 14/*
17 * Low Interrupt Controller 15 * Low Interrupt Controller
18 */ 16 */
@@ -51,12 +49,13 @@
51#define IRQ_KIRKWOOD_GPIO_HIGH_8_15 40 49#define IRQ_KIRKWOOD_GPIO_HIGH_8_15 40
52#define IRQ_KIRKWOOD_GPIO_HIGH_16_23 41 50#define IRQ_KIRKWOOD_GPIO_HIGH_16_23 41
53#define IRQ_KIRKWOOD_GE00_ERR 46 51#define IRQ_KIRKWOOD_GE00_ERR 46
52#define IRQ_KIRKWOOD_GE01_ERR 47
54 53
55/* 54/*
56 * KIRKWOOD General Purpose Pins 55 * KIRKWOOD General Purpose Pins
57 */ 56 */
58#define IRQ_KIRKWOOD_GPIO_START 64 57#define IRQ_KIRKWOOD_GPIO_START 64
59#define NR_GPIO_IRQS GPIO_MAX 58#define NR_GPIO_IRQS 50
60 59
61#define NR_IRQS (IRQ_KIRKWOOD_GPIO_START + NR_GPIO_IRQS) 60#define NR_IRQS (IRQ_KIRKWOOD_GPIO_START + NR_GPIO_IRQS)
62 61
diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
index eae42406fd86..ada480c0e197 100644
--- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h
+++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
@@ -117,7 +117,4 @@
117#define SATA_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x80000) 117#define SATA_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x80000)
118 118
119 119
120#define GPIO_MAX 50
121
122
123#endif 120#endif
diff --git a/arch/arm/mach-kirkwood/include/mach/memory.h b/arch/arm/mach-kirkwood/include/mach/memory.h
index b5fb34bdccd5..45431e131465 100644
--- a/arch/arm/mach-kirkwood/include/mach/memory.h
+++ b/arch/arm/mach-kirkwood/include/mach/memory.h
@@ -7,8 +7,4 @@
7 7
8#define PHYS_OFFSET UL(0x00000000) 8#define PHYS_OFFSET UL(0x00000000)
9 9
10#define __virt_to_bus(x) __virt_to_phys(x)
11#define __bus_to_virt(x) __phys_to_virt(x)
12
13
14#endif 10#endif
diff --git a/arch/arm/mach-kirkwood/irq.c b/arch/arm/mach-kirkwood/irq.c
index 5790643ffe07..efb86b700276 100644
--- a/arch/arm/mach-kirkwood/irq.c
+++ b/arch/arm/mach-kirkwood/irq.c
@@ -13,10 +13,45 @@
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <plat/irq.h> 15#include <plat/irq.h>
16#include <asm/gpio.h>
16#include "common.h" 17#include "common.h"
17 18
19static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
20{
21 BUG_ON(irq < IRQ_KIRKWOOD_GPIO_LOW_0_7);
22 BUG_ON(irq > IRQ_KIRKWOOD_GPIO_HIGH_16_23);
23
24 orion_gpio_irq_handler((irq - IRQ_KIRKWOOD_GPIO_LOW_0_7) << 3);
25}
26
18void __init kirkwood_init_irq(void) 27void __init kirkwood_init_irq(void)
19{ 28{
29 int i;
30
20 orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF)); 31 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)); 32 orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF));
33
34 /*
35 * Mask and clear GPIO IRQ interrupts.
36 */
37 writel(0, GPIO_LEVEL_MASK(0));
38 writel(0, GPIO_EDGE_MASK(0));
39 writel(0, GPIO_EDGE_CAUSE(0));
40 writel(0, GPIO_LEVEL_MASK(32));
41 writel(0, GPIO_EDGE_MASK(32));
42 writel(0, GPIO_EDGE_CAUSE(32));
43
44 for (i = IRQ_KIRKWOOD_GPIO_START; i < NR_IRQS; i++) {
45 set_irq_chip(i, &orion_gpio_irq_level_chip);
46 set_irq_handler(i, handle_level_irq);
47 irq_desc[i].status |= IRQ_LEVEL;
48 set_irq_flags(i, IRQF_VALID);
49 }
50 set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_0_7, gpio_irq_handler);
51 set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_8_15, gpio_irq_handler);
52 set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_16_23, gpio_irq_handler);
53 set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_24_31, gpio_irq_handler);
54 set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_0_7, gpio_irq_handler);
55 set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_8_15, gpio_irq_handler);
56 set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_16_23, gpio_irq_handler);
22} 57}
diff --git a/arch/arm/mach-kirkwood/rd88f6281-setup.c b/arch/arm/mach-kirkwood/rd88f6281-setup.c
index 175054abd630..9a0e905d10cd 100644
--- a/arch/arm/mach-kirkwood/rd88f6281-setup.c
+++ b/arch/arm/mach-kirkwood/rd88f6281-setup.c
@@ -80,24 +80,38 @@ static struct dsa_platform_data rd88f6281_switch_data = {
80 .port_names[1] = "lan2", 80 .port_names[1] = "lan2",
81 .port_names[2] = "lan3", 81 .port_names[2] = "lan3",
82 .port_names[3] = "lan4", 82 .port_names[3] = "lan4",
83 .port_names[4] = "wan",
84 .port_names[5] = "cpu", 83 .port_names[5] = "cpu",
85}; 84};
86 85
86static struct mv643xx_eth_platform_data rd88f6281_ge01_data = {
87 .phy_addr = MV643XX_ETH_PHY_ADDR(11),
88};
89
87static struct mv_sata_platform_data rd88f6281_sata_data = { 90static struct mv_sata_platform_data rd88f6281_sata_data = {
88 .n_ports = 2, 91 .n_ports = 2,
89}; 92};
90 93
91static void __init rd88f6281_init(void) 94static void __init rd88f6281_init(void)
92{ 95{
96 u32 dev, rev;
97
93 /* 98 /*
94 * Basic setup. Needs to be called early. 99 * Basic setup. Needs to be called early.
95 */ 100 */
96 kirkwood_init(); 101 kirkwood_init();
97 102
98 kirkwood_ehci_init(); 103 kirkwood_ehci_init();
104
99 kirkwood_ge00_init(&rd88f6281_ge00_data); 105 kirkwood_ge00_init(&rd88f6281_ge00_data);
106 kirkwood_pcie_id(&dev, &rev);
107 if (rev == MV88F6281_REV_A0) {
108 rd88f6281_switch_data.sw_addr = 10;
109 kirkwood_ge01_init(&rd88f6281_ge01_data);
110 } else {
111 rd88f6281_switch_data.port_names[4] = "wan";
112 }
100 kirkwood_ge00_switch_init(&rd88f6281_switch_data, NO_IRQ); 113 kirkwood_ge00_switch_init(&rd88f6281_switch_data, NO_IRQ);
114
101 kirkwood_rtc_init(); 115 kirkwood_rtc_init();
102 kirkwood_sata_init(&rd88f6281_sata_data); 116 kirkwood_sata_init(&rd88f6281_sata_data);
103 kirkwood_uart0_init(); 117 kirkwood_uart0_init();
diff --git a/arch/arm/mach-ks8695/Kconfig b/arch/arm/mach-ks8695/Kconfig
index ce1cf8de2b4d..2754daabda55 100644
--- a/arch/arm/mach-ks8695/Kconfig
+++ b/arch/arm/mach-ks8695/Kconfig
@@ -8,6 +8,12 @@ config MACH_KS8695
8 Say 'Y' here if you want your kernel to run on the original 8 Say 'Y' here if you want your kernel to run on the original
9 Kendin-Micrel KS8695 development board. 9 Kendin-Micrel KS8695 development board.
10 10
11config MACH_DSM320
12 bool "DSM-320 Wireless Media Player"
13 help
14 Say 'Y' here if you want your kernel to run on the D-Link
15 DSM-320 Wireless Media Player.
16
11endmenu 17endmenu
12 18
13endif 19endif
diff --git a/arch/arm/mach-ks8695/Makefile b/arch/arm/mach-ks8695/Makefile
index ade42b73afbb..f735d2cc0294 100644
--- a/arch/arm/mach-ks8695/Makefile
+++ b/arch/arm/mach-ks8695/Makefile
@@ -16,3 +16,4 @@ obj-$(CONFIG_LEDS) += leds.o
16 16
17# Board-specific support 17# Board-specific support
18obj-$(CONFIG_MACH_KS8695) += board-micrel.o 18obj-$(CONFIG_MACH_KS8695) += board-micrel.o
19obj-$(CONFIG_MACH_DSM320) += board-dsm320.o
diff --git a/arch/arm/mach-ks8695/board-dsm320.c b/arch/arm/mach-ks8695/board-dsm320.c
new file mode 100644
index 000000000000..521ff0789f39
--- /dev/null
+++ b/arch/arm/mach-ks8695/board-dsm320.c
@@ -0,0 +1,131 @@
1/*
2 * arch/arm/mach-ks8695/board-dsm320.c
3 *
4 * DSM-320 D-Link Wireless Media Player, board support.
5 *
6 * Copyright 2008 Simtec Electronics
7 * Daniel Silverstone <dsilvers@simtec.co.uk>
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/kernel.h>
15#include <linux/types.h>
16#include <linux/interrupt.h>
17#include <linux/init.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-types.h>
26
27#include <asm/mach/arch.h>
28#include <asm/mach/map.h>
29#include <asm/mach/irq.h>
30
31#include <mach/devices.h>
32#include <mach/gpio.h>
33
34#include "generic.h"
35
36#ifdef CONFIG_PCI
37static int dsm320_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
38{
39 switch (slot) {
40 case 0:
41 /* PCI-AHB bridge? */
42 return KS8695_IRQ_EXTERN0;
43 case 18:
44 /* Mini PCI slot */
45 return KS8695_IRQ_EXTERN2;
46 case 20:
47 /* RealMAGIC chip */
48 return KS8695_IRQ_EXTERN0;
49 }
50 BUG();
51}
52
53static struct ks8695_pci_cfg __initdata dsm320_pci = {
54 .mode = KS8695_MODE_MINIPCI,
55 .map_irq = dsm320_pci_map_irq,
56};
57
58static void __init dsm320_register_pci(void)
59{
60 /* Initialise the GPIO lines for interrupt mode */
61 /* RealMAGIC */
62 ks8695_gpio_interrupt(KS8695_GPIO_0, IRQ_TYPE_LEVEL_LOW);
63 /* MiniPCI Slot */
64 ks8695_gpio_interrupt(KS8695_GPIO_2, IRQ_TYPE_LEVEL_LOW);
65
66 ks8695_init_pci(&dsm320_pci);
67}
68
69#else
70static inline void __init dsm320_register_pci(void) { }
71#endif
72
73static struct physmap_flash_data dsm320_nor_pdata = {
74 .width = 4,
75 .nr_parts = 0,
76};
77
78static struct resource dsm320_nor_resource[] = {
79 [0] = {
80 .start = SZ_32M, /* We expect the bootloader to map
81 * the flash here.
82 */
83 .end = SZ_32M + SZ_4M - 1,
84 .flags = IORESOURCE_MEM,
85 }
86};
87
88static struct platform_device dsm320_device_nor = {
89 .name = "physmap-flash",
90 .id = -1,
91 .num_resources = ARRAY_SIZE(dsm320_nor_resource),
92 .resource = dsm320_nor_resource,
93 .dev = {
94 .platform_data = &dsm320_nor_pdata,
95 },
96};
97
98void __init dsm320_register_nor(void)
99{
100 int ret;
101
102 ret = platform_device_register(&dsm320_device_nor);
103 if (ret < 0)
104 printk(KERN_ERR "failed to register physmap-flash device\n");
105}
106
107static void __init dsm320_init(void)
108{
109 /* GPIO registration */
110 ks8695_register_gpios();
111
112 /* PCI registration */
113 dsm320_register_pci();
114
115 /* Network device */
116 ks8695_add_device_lan(); /* eth0 = LAN */
117
118 /* NOR devices */
119 dsm320_register_nor();
120}
121
122MACHINE_START(DSM320, "D-Link DSM-320 Wireless Media Player")
123 /* Maintainer: Simtec Electronics. */
124 .phys_io = KS8695_IO_PA,
125 .io_pg_offst = (KS8695_IO_VA >> 18) & 0xfffc,
126 .boot_params = KS8695_SDRAM_PA + 0x100,
127 .map_io = ks8695_map_io,
128 .init_irq = ks8695_init_irq,
129 .init_machine = dsm320_init,
130 .timer = &ks8695_timer,
131MACHINE_END
diff --git a/arch/arm/mach-ks8695/board-micrel.c b/arch/arm/mach-ks8695/board-micrel.c
index 0468e93b7d3b..8ceaf5ac6e2c 100644
--- a/arch/arm/mach-ks8695/board-micrel.c
+++ b/arch/arm/mach-ks8695/board-micrel.c
@@ -18,6 +18,7 @@
18#include <asm/mach/map.h> 18#include <asm/mach/map.h>
19#include <asm/mach/irq.h> 19#include <asm/mach/irq.h>
20 20
21#include <mach/gpio.h>
21#include <mach/devices.h> 22#include <mach/devices.h>
22 23
23#include "generic.h" 24#include "generic.h"
@@ -39,6 +40,8 @@ static void __init micrel_init(void)
39{ 40{
40 printk(KERN_INFO "Micrel KS8695 Development Board initializing\n"); 41 printk(KERN_INFO "Micrel KS8695 Development Board initializing\n");
41 42
43 ks8695_register_gpios();
44
42#ifdef CONFIG_PCI 45#ifdef CONFIG_PCI
43 ks8695_init_pci(&micrel_pci); 46 ks8695_init_pci(&micrel_pci);
44#endif 47#endif
diff --git a/arch/arm/mach-ks8695/devices.c b/arch/arm/mach-ks8695/devices.c
index 4bd251482c8f..36ab0fd3d9b6 100644
--- a/arch/arm/mach-ks8695/devices.c
+++ b/arch/arm/mach-ks8695/devices.c
@@ -25,19 +25,20 @@
25#include <mach/regs-wan.h> 25#include <mach/regs-wan.h>
26#include <mach/regs-lan.h> 26#include <mach/regs-lan.h>
27#include <mach/regs-hpna.h> 27#include <mach/regs-hpna.h>
28#include <mach/regs-switch.h>
29#include <mach/regs-misc.h>
28 30
29 31
30/* -------------------------------------------------------------------- 32/* --------------------------------------------------------------------
31 * Ethernet 33 * Ethernet
32 * -------------------------------------------------------------------- */ 34 * -------------------------------------------------------------------- */
33 35
34#if defined(CONFIG_ARM_KS8695_ETHER) || defined(CONFIG_ARM_KS8695_ETHER_MODULE)
35static u64 eth_dmamask = 0xffffffffUL; 36static u64 eth_dmamask = 0xffffffffUL;
36 37
37static struct resource ks8695_wan_resources[] = { 38static struct resource ks8695_wan_resources[] = {
38 [0] = { 39 [0] = {
39 .start = KS8695_WAN_VA, 40 .start = KS8695_WAN_PA,
40 .end = KS8695_WAN_VA + 0x00ff, 41 .end = KS8695_WAN_PA + 0x00ff,
41 .flags = IORESOURCE_MEM, 42 .flags = IORESOURCE_MEM,
42 }, 43 },
43 [1] = { 44 [1] = {
@@ -58,6 +59,12 @@ static struct resource ks8695_wan_resources[] = {
58 .end = KS8695_IRQ_WAN_LINK, 59 .end = KS8695_IRQ_WAN_LINK,
59 .flags = IORESOURCE_IRQ, 60 .flags = IORESOURCE_IRQ,
60 }, 61 },
62 [4] = {
63 .name = "WAN PHY",
64 .start = KS8695_MISC_PA,
65 .end = KS8695_MISC_PA + 0x1f,
66 .flags = IORESOURCE_MEM,
67 },
61}; 68};
62 69
63static struct platform_device ks8695_wan_device = { 70static struct platform_device ks8695_wan_device = {
@@ -74,8 +81,8 @@ static struct platform_device ks8695_wan_device = {
74 81
75static struct resource ks8695_lan_resources[] = { 82static struct resource ks8695_lan_resources[] = {
76 [0] = { 83 [0] = {
77 .start = KS8695_LAN_VA, 84 .start = KS8695_LAN_PA,
78 .end = KS8695_LAN_VA + 0x00ff, 85 .end = KS8695_LAN_PA + 0x00ff,
79 .flags = IORESOURCE_MEM, 86 .flags = IORESOURCE_MEM,
80 }, 87 },
81 [1] = { 88 [1] = {
@@ -90,6 +97,12 @@ static struct resource ks8695_lan_resources[] = {
90 .end = KS8695_IRQ_LAN_TX_STATUS, 97 .end = KS8695_IRQ_LAN_TX_STATUS,
91 .flags = IORESOURCE_IRQ, 98 .flags = IORESOURCE_IRQ,
92 }, 99 },
100 [3] = {
101 .name = "LAN SWITCH",
102 .start = KS8695_SWITCH_PA,
103 .end = KS8695_SWITCH_PA + 0x4f,
104 .flags = IORESOURCE_MEM,
105 },
93}; 106};
94 107
95static struct platform_device ks8695_lan_device = { 108static struct platform_device ks8695_lan_device = {
@@ -106,8 +119,8 @@ static struct platform_device ks8695_lan_device = {
106 119
107static struct resource ks8695_hpna_resources[] = { 120static struct resource ks8695_hpna_resources[] = {
108 [0] = { 121 [0] = {
109 .start = KS8695_HPNA_VA, 122 .start = KS8695_HPNA_PA,
110 .end = KS8695_HPNA_VA + 0x00ff, 123 .end = KS8695_HPNA_PA + 0x00ff,
111 .flags = IORESOURCE_MEM, 124 .flags = IORESOURCE_MEM,
112 }, 125 },
113 [1] = { 126 [1] = {
@@ -149,18 +162,12 @@ void __init ks8696_add_device_hpna(void)
149{ 162{
150 platform_device_register(&ks8695_hpna_device); 163 platform_device_register(&ks8695_hpna_device);
151} 164}
152#else
153void __init ks8695_add_device_wan(void) {}
154void __init ks8695_add_device_lan(void) {}
155void __init ks8696_add_device_hpna(void) {}
156#endif
157 165
158 166
159/* -------------------------------------------------------------------- 167/* --------------------------------------------------------------------
160 * Watchdog 168 * Watchdog
161 * -------------------------------------------------------------------- */ 169 * -------------------------------------------------------------------- */
162 170
163#if defined(CONFIG_KS8695_WATCHDOG) || defined(CONFIG_KS8695_WATCHDOG_MODULE)
164static struct platform_device ks8695_wdt_device = { 171static struct platform_device ks8695_wdt_device = {
165 .name = "ks8695_wdt", 172 .name = "ks8695_wdt",
166 .id = -1, 173 .id = -1,
@@ -171,9 +178,6 @@ static void __init ks8695_add_device_watchdog(void)
171{ 178{
172 platform_device_register(&ks8695_wdt_device); 179 platform_device_register(&ks8695_wdt_device);
173} 180}
174#else
175static void __init ks8695_add_device_watchdog(void) {}
176#endif
177 181
178 182
179/* -------------------------------------------------------------------- 183/* --------------------------------------------------------------------
@@ -190,7 +194,7 @@ void __init ks8695_init_leds(u8 cpu_led, u8 timer_led)
190 gpio_direction_output(cpu_led, 1); 194 gpio_direction_output(cpu_led, 1);
191 gpio_direction_output(timer_led, 1); 195 gpio_direction_output(timer_led, 1);
192 196
193 ks8695_leds_cpu = cpu_led; 197 ks8695_leds_cpu = cpu_led;
194 ks8695_leds_timer = timer_led; 198 ks8695_leds_timer = timer_led;
195} 199}
196#else 200#else
diff --git a/arch/arm/mach-ks8695/gpio.c b/arch/arm/mach-ks8695/gpio.c
index 9aecf0c4b8b1..55fbf7111a5b 100644
--- a/arch/arm/mach-ks8695/gpio.c
+++ b/arch/arm/mach-ks8695/gpio.c
@@ -2,6 +2,8 @@
2 * arch/arm/mach-ks8695/gpio.c 2 * arch/arm/mach-ks8695/gpio.c
3 * 3 *
4 * Copyright (C) 2006 Andrew Victor 4 * Copyright (C) 2006 Andrew Victor
5 * Updated to GPIOLIB, Copyright 2008 Simtec Electronics
6 * Daniel Silverstone <dsilvers@simtec.co.uk>
5 * 7 *
6 * This program is free software; you can redistribute it and/or modify 8 * 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 9 * it under the terms of the GNU General Public License version 2 as
@@ -35,7 +37,7 @@
35 * Configure a GPIO line for either GPIO function, or its internal 37 * Configure a GPIO line for either GPIO function, or its internal
36 * function (Interrupt, Timer, etc). 38 * function (Interrupt, Timer, etc).
37 */ 39 */
38static void __init_or_module ks8695_gpio_mode(unsigned int pin, short gpio) 40static void ks8695_gpio_mode(unsigned int pin, short gpio)
39{ 41{
40 unsigned int enable[] = { IOPC_IOEINT0EN, IOPC_IOEINT1EN, IOPC_IOEINT2EN, IOPC_IOEINT3EN, IOPC_IOTIM0EN, IOPC_IOTIM1EN }; 42 unsigned int enable[] = { IOPC_IOEINT0EN, IOPC_IOEINT1EN, IOPC_IOEINT2EN, IOPC_IOEINT3EN, IOPC_IOTIM0EN, IOPC_IOTIM1EN };
41 unsigned long x, flags; 43 unsigned long x, flags;
@@ -61,7 +63,7 @@ static unsigned short gpio_irq[] = { KS8695_IRQ_EXTERN0, KS8695_IRQ_EXTERN1, KS8
61/* 63/*
62 * Configure GPIO pin as external interrupt source. 64 * Configure GPIO pin as external interrupt source.
63 */ 65 */
64int __init_or_module ks8695_gpio_interrupt(unsigned int pin, unsigned int type) 66int ks8695_gpio_interrupt(unsigned int pin, unsigned int type)
65{ 67{
66 unsigned long x, flags; 68 unsigned long x, flags;
67 69
@@ -94,7 +96,7 @@ EXPORT_SYMBOL(ks8695_gpio_interrupt);
94/* 96/*
95 * Configure the GPIO line as an input. 97 * Configure the GPIO line as an input.
96 */ 98 */
97int __init_or_module gpio_direction_input(unsigned int pin) 99static int ks8695_gpio_direction_input(struct gpio_chip *gc, unsigned int pin)
98{ 100{
99 unsigned long x, flags; 101 unsigned long x, flags;
100 102
@@ -115,13 +117,13 @@ int __init_or_module gpio_direction_input(unsigned int pin)
115 117
116 return 0; 118 return 0;
117} 119}
118EXPORT_SYMBOL(gpio_direction_input);
119 120
120 121
121/* 122/*
122 * Configure the GPIO line as an output, with default state. 123 * Configure the GPIO line as an output, with default state.
123 */ 124 */
124int __init_or_module gpio_direction_output(unsigned int pin, unsigned int state) 125static int ks8695_gpio_direction_output(struct gpio_chip *gc,
126 unsigned int pin, int state)
125{ 127{
126 unsigned long x, flags; 128 unsigned long x, flags;
127 129
@@ -150,13 +152,13 @@ int __init_or_module gpio_direction_output(unsigned int pin, unsigned int state)
150 152
151 return 0; 153 return 0;
152} 154}
153EXPORT_SYMBOL(gpio_direction_output);
154 155
155 156
156/* 157/*
157 * Set the state of an output GPIO line. 158 * Set the state of an output GPIO line.
158 */ 159 */
159void gpio_set_value(unsigned int pin, unsigned int state) 160static void ks8695_gpio_set_value(struct gpio_chip *gc,
161 unsigned int pin, int state)
160{ 162{
161 unsigned long x, flags; 163 unsigned long x, flags;
162 164
@@ -175,13 +177,12 @@ void gpio_set_value(unsigned int pin, unsigned int state)
175 177
176 local_irq_restore(flags); 178 local_irq_restore(flags);
177} 179}
178EXPORT_SYMBOL(gpio_set_value);
179 180
180 181
181/* 182/*
182 * Read the state of a GPIO line. 183 * Read the state of a GPIO line.
183 */ 184 */
184int gpio_get_value(unsigned int pin) 185static int ks8695_gpio_get_value(struct gpio_chip *gc, unsigned int pin)
185{ 186{
186 unsigned long x; 187 unsigned long x;
187 188
@@ -191,21 +192,18 @@ int gpio_get_value(unsigned int pin)
191 x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPD); 192 x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPD);
192 return (x & IOPD(pin)) != 0; 193 return (x & IOPD(pin)) != 0;
193} 194}
194EXPORT_SYMBOL(gpio_get_value);
195 195
196 196
197/* 197/*
198 * Map GPIO line to IRQ number. 198 * Map GPIO line to IRQ number.
199 */ 199 */
200int gpio_to_irq(unsigned int pin) 200static int ks8695_gpio_to_irq(struct gpio_chip *gc, unsigned int pin)
201{ 201{
202 if (pin > KS8695_GPIO_3) /* only GPIO 0..3 can generate IRQ */ 202 if (pin > KS8695_GPIO_3) /* only GPIO 0..3 can generate IRQ */
203 return -EINVAL; 203 return -EINVAL;
204 204
205 return gpio_irq[pin]; 205 return gpio_irq[pin];
206} 206}
207EXPORT_SYMBOL(gpio_to_irq);
208
209 207
210/* 208/*
211 * Map IRQ number to GPIO line. 209 * Map IRQ number to GPIO line.
@@ -219,6 +217,26 @@ int irq_to_gpio(unsigned int irq)
219} 217}
220EXPORT_SYMBOL(irq_to_gpio); 218EXPORT_SYMBOL(irq_to_gpio);
221 219
220/* GPIOLIB interface */
221
222static struct gpio_chip ks8695_gpio_chip = {
223 .label = "KS8695",
224 .direction_input = ks8695_gpio_direction_input,
225 .direction_output = ks8695_gpio_direction_output,
226 .get = ks8695_gpio_get_value,
227 .set = ks8695_gpio_set_value,
228 .to_irq = ks8695_gpio_to_irq,
229 .base = 0,
230 .ngpio = 16,
231 .can_sleep = 0,
232};
233
234/* Register the GPIOs */
235void ks8695_register_gpios(void)
236{
237 if (gpiochip_add(&ks8695_gpio_chip))
238 printk(KERN_ERR "Unable to register core GPIOs\n");
239}
222 240
223/* .... Debug interface ..................................................... */ 241/* .... Debug interface ..................................................... */
224 242
diff --git a/arch/arm/mach-ks8695/include/mach/dma.h b/arch/arm/mach-ks8695/include/mach/dma.h
deleted file mode 100644
index 561206280089..000000000000
--- a/arch/arm/mach-ks8695/include/mach/dma.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/dma.h
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 */
diff --git a/arch/arm/mach-ks8695/include/mach/gpio.h b/arch/arm/mach-ks8695/include/mach/gpio.h
index d4af5c335f16..86312d476bc6 100644
--- a/arch/arm/mach-ks8695/include/mach/gpio.h
+++ b/arch/arm/mach-ks8695/include/mach/gpio.h
@@ -30,53 +30,28 @@
30#define KS8695_GPIO_14 14 30#define KS8695_GPIO_14 14
31#define KS8695_GPIO_15 15 31#define KS8695_GPIO_15 15
32 32
33
34/* 33/*
35 * Configure GPIO pin as external interrupt source. 34 * Configure GPIO pin as external interrupt source.
36 */ 35 */
37int __init_or_module ks8695_gpio_interrupt(unsigned int pin, unsigned int type); 36extern int ks8695_gpio_interrupt(unsigned int pin, unsigned int type);
38
39/*
40 * Configure the GPIO line as an input.
41 */
42int __init_or_module gpio_direction_input(unsigned int pin);
43
44/*
45 * Configure the GPIO line as an output, with default state.
46 */
47int __init_or_module gpio_direction_output(unsigned int pin, unsigned int state);
48
49/*
50 * Set the state of an output GPIO line.
51 */
52void gpio_set_value(unsigned int pin, unsigned int state);
53
54/*
55 * Read the state of a GPIO line.
56 */
57int gpio_get_value(unsigned int pin);
58
59/*
60 * Map GPIO line to IRQ number.
61 */
62int gpio_to_irq(unsigned int pin);
63 37
64/* 38/*
65 * Map IRQ number to GPIO line. 39 * Map IRQ number to GPIO line.
66 */ 40 */
67int irq_to_gpio(unsigned int irq); 41extern int irq_to_gpio(unsigned int irq);
68
69 42
70#include <asm-generic/gpio.h> 43#include <asm-generic/gpio.h>
71 44
72static inline int gpio_request(unsigned int pin, const char *label) 45/* If it turns out that we need to optimise GPIO access for the
73{ 46 * Micrel's GPIOs, then these can be changed to check their argument
74 return 0; 47 * directly as static inlines. However for now it's probably not
75} 48 * worthwhile.
49 */
50#define gpio_get_value __gpio_get_value
51#define gpio_set_value __gpio_set_value
52#define gpio_to_irq __gpio_to_irq
76 53
77static inline void gpio_free(unsigned int pin) 54/* Register the GPIOs */
78{ 55extern void ks8695_register_gpios(void);
79 might_sleep();
80}
81 56
82#endif 57#endif
diff --git a/arch/arm/mach-ks8695/include/mach/io.h b/arch/arm/mach-ks8695/include/mach/io.h
index f364f24ffe1e..a7a63ac3ba4e 100644
--- a/arch/arm/mach-ks8695/include/mach/io.h
+++ b/arch/arm/mach-ks8695/include/mach/io.h
@@ -13,7 +13,7 @@
13 13
14#define IO_SPACE_LIMIT 0xffffffff 14#define IO_SPACE_LIMIT 0xffffffff
15 15
16#define __io(a) ((void __iomem *)(a)) 16#define __io(a) __typesafe_io(a)
17#define __mem_pci(a) (a) 17#define __mem_pci(a) (a)
18 18
19#endif 19#endif
diff --git a/arch/arm/mach-ks8695/include/mach/memory.h b/arch/arm/mach-ks8695/include/mach/memory.h
index 8fbc4c76c38b..6d5887cf5742 100644
--- a/arch/arm/mach-ks8695/include/mach/memory.h
+++ b/arch/arm/mach-ks8695/include/mach/memory.h
@@ -37,11 +37,6 @@ extern struct bus_type platform_bus_type;
37 (dma_addr_t)__virt_to_phys(x) : (dma_addr_t)__virt_to_bus(x); }) 37 (dma_addr_t)__virt_to_phys(x) : (dma_addr_t)__virt_to_bus(x); })
38#define __arch_page_to_dma(dev, x) __arch_virt_to_dma(dev, page_address(x)) 38#define __arch_page_to_dma(dev, x) __arch_virt_to_dma(dev, page_address(x))
39 39
40#else
41
42#define __virt_to_bus(x) __virt_to_phys(x)
43#define __bus_to_virt(x) __phys_to_virt(x)
44
45#endif 40#endif
46 41
47#endif 42#endif
diff --git a/arch/arm/mach-l7200/include/mach/dma.h b/arch/arm/mach-l7200/include/mach/dma.h
deleted file mode 100644
index c7e48bd4590c..000000000000
--- a/arch/arm/mach-l7200/include/mach/dma.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * arch/arm/mach-l7200/include/mach/dma.h
3 *
4 * Copyright (C) 2000 Steve Hill (sjhill@cotw.com)
5 *
6 * Changelog:
7 * 08-29-2000 SJH Created
8 */
9#ifndef __ASM_ARCH_DMA_H
10#define __ASM_ARCH_DMA_H
11
12/* DMA is not yet implemented! It should be the same as acorn, copy over.. */
13
14/*
15 * This is the maximum DMA address that can be DMAd to.
16 * There should not be more than (0xd0000000 - 0xc0000000)
17 * bytes of RAM.
18 */
19#define MAX_DMA_ADDRESS 0xd0000000
20
21#define DMA_S0 0
22
23#endif /* _ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-l7200/include/mach/io.h b/arch/arm/mach-l7200/include/mach/io.h
index d432ba9e5dff..a770a89fb708 100644
--- a/arch/arm/mach-l7200/include/mach/io.h
+++ b/arch/arm/mach-l7200/include/mach/io.h
@@ -10,18 +10,12 @@
10#ifndef __ASM_ARM_ARCH_IO_H 10#ifndef __ASM_ARM_ARCH_IO_H
11#define __ASM_ARM_ARCH_IO_H 11#define __ASM_ARM_ARCH_IO_H
12 12
13#include <mach/hardware.h>
14
15#define IO_SPACE_LIMIT 0xffffffff 13#define IO_SPACE_LIMIT 0xffffffff
16 14
17/* 15/*
18 * There are not real ISA nor PCI buses, so we fake it. 16 * There are not real ISA nor PCI buses, so we fake it.
19 */ 17 */
20static inline void __iomem *__io(unsigned long addr) 18#define __io(a) __typesafe_io(a)
21{ 19#define __mem_pci(a) (a)
22 return (void __iomem *)addr;
23}
24#define __io(a) __io(a)
25#define __mem_pci(a) (a)
26 20
27#endif 21#endif
diff --git a/arch/arm/mach-l7200/include/mach/memory.h b/arch/arm/mach-l7200/include/mach/memory.h
index f338cf3ffd93..9fb40ed2f03b 100644
--- a/arch/arm/mach-l7200/include/mach/memory.h
+++ b/arch/arm/mach-l7200/include/mach/memory.h
@@ -17,9 +17,6 @@
17 */ 17 */
18#define PHYS_OFFSET UL(0xf0000000) 18#define PHYS_OFFSET UL(0xf0000000)
19 19
20#define __virt_to_bus(x) __virt_to_phys(x)
21#define __bus_to_virt(x) __phys_to_virt(x)
22
23/* 20/*
24 * Cache flushing area - ROM 21 * Cache flushing area - ROM
25 */ 22 */
diff --git a/arch/arm/mach-lh7a40x/clcd.c b/arch/arm/mach-lh7a40x/clcd.c
index a2a543258fc3..c472b9e8b37c 100644
--- a/arch/arm/mach-lh7a40x/clcd.c
+++ b/arch/arm/mach-lh7a40x/clcd.c
@@ -207,7 +207,7 @@ static struct clcd_board clcd_platform_data = {
207static struct amba_device name##_device = { \ 207static struct amba_device name##_device = { \
208 .dev = { \ 208 .dev = { \
209 .coherent_dma_mask = ~0, \ 209 .coherent_dma_mask = ~0, \
210 .bus_id = busid, \ 210 .init_name = busid, \
211 .platform_data = plat, \ 211 .platform_data = plat, \
212 }, \ 212 }, \
213 .res = { \ 213 .res = { \
diff --git a/arch/arm/mach-lh7a40x/clocks.c b/arch/arm/mach-lh7a40x/clocks.c
index 4fb23ac6b5ac..6182f5410b4d 100644
--- a/arch/arm/mach-lh7a40x/clocks.c
+++ b/arch/arm/mach-lh7a40x/clocks.c
@@ -14,21 +14,14 @@
14#include <linux/err.h> 14#include <linux/err.h>
15 15
16struct module; 16struct module;
17struct icst525_params;
18 17
19struct clk { 18struct clk {
20 struct list_head node; 19 struct list_head node;
21 unsigned long rate; 20 unsigned long rate;
22 struct module *owner; 21 struct module *owner;
23 const char *name; 22 const char *name;
24// void *data;
25// const struct icst525_params *params;
26// void (*setvco)(struct clk *, struct icst525_vco vco);
27}; 23};
28 24
29int clk_register(struct clk *clk);
30void clk_unregister(struct clk *clk);
31
32/* ----- */ 25/* ----- */
33 26
34#define MAINDIV1(c) (((c) >> 7) & 0x0f) 27#define MAINDIV1(c) (((c) >> 7) & 0x0f)
@@ -79,31 +72,15 @@ unsigned int pclkfreq_get (void)
79 72
80/* ----- */ 73/* ----- */
81 74
82static LIST_HEAD(clocks);
83static DECLARE_MUTEX(clocks_sem);
84
85struct clk *clk_get (struct device *dev, const char *id) 75struct clk *clk_get (struct device *dev, const char *id)
86{ 76{
87 struct clk *p; 77 return dev && strcmp(dev_name(dev), "cldc-lh7a40x") == 0
88 struct clk *clk = ERR_PTR(-ENOENT); 78 ? NULL : ERR_PTR(-ENOENT);
89
90 down (&clocks_sem);
91 list_for_each_entry (p, &clocks, node) {
92 if (strcmp (id, p->name) == 0
93 && try_module_get(p->owner)) {
94 clk = p;
95 break;
96 }
97 }
98 up (&clocks_sem);
99
100 return clk;
101} 79}
102EXPORT_SYMBOL(clk_get); 80EXPORT_SYMBOL(clk_get);
103 81
104void clk_put (struct clk *clk) 82void clk_put (struct clk *clk)
105{ 83{
106 module_put(clk->owner);
107} 84}
108EXPORT_SYMBOL(clk_put); 85EXPORT_SYMBOL(clk_put);
109 86
@@ -118,20 +95,9 @@ void clk_disable (struct clk *clk)
118} 95}
119EXPORT_SYMBOL(clk_disable); 96EXPORT_SYMBOL(clk_disable);
120 97
121int clk_use (struct clk *clk)
122{
123 return 0;
124}
125EXPORT_SYMBOL(clk_use);
126
127void clk_unuse (struct clk *clk)
128{
129}
130EXPORT_SYMBOL(clk_unuse);
131
132unsigned long clk_get_rate (struct clk *clk) 98unsigned long clk_get_rate (struct clk *clk)
133{ 99{
134 return clk->rate; 100 return 0;
135} 101}
136EXPORT_SYMBOL(clk_get_rate); 102EXPORT_SYMBOL(clk_get_rate);
137 103
@@ -143,56 +109,6 @@ EXPORT_SYMBOL(clk_round_rate);
143 109
144int clk_set_rate (struct clk *clk, unsigned long rate) 110int clk_set_rate (struct clk *clk, unsigned long rate)
145{ 111{
146 int ret = -EIO; 112 return -EIO;
147 return ret;
148} 113}
149EXPORT_SYMBOL(clk_set_rate); 114EXPORT_SYMBOL(clk_set_rate);
150
151#if 0
152/*
153 * These are fixed clocks.
154 */
155static struct clk kmi_clk = {
156 .name = "KMIREFCLK",
157 .rate = 24000000,
158};
159
160static struct clk uart_clk = {
161 .name = "UARTCLK",
162 .rate = 24000000,
163};
164
165static struct clk mmci_clk = {
166 .name = "MCLK",
167 .rate = 33000000,
168};
169#endif
170
171static struct clk clcd_clk = {
172 .name = "CLCDCLK",
173 .rate = 0,
174};
175
176int clk_register (struct clk *clk)
177{
178 down (&clocks_sem);
179 list_add (&clk->node, &clocks);
180 up (&clocks_sem);
181 return 0;
182}
183EXPORT_SYMBOL(clk_register);
184
185void clk_unregister (struct clk *clk)
186{
187 down (&clocks_sem);
188 list_del (&clk->node);
189 up (&clocks_sem);
190}
191EXPORT_SYMBOL(clk_unregister);
192
193static int __init clk_init (void)
194{
195 clk_register(&clcd_clk);
196 return 0;
197}
198arch_initcall(clk_init);
diff --git a/arch/arm/mach-lh7a40x/include/mach/io.h b/arch/arm/mach-lh7a40x/include/mach/io.h
index 031d26f9163c..6ece45911cbc 100644
--- a/arch/arm/mach-lh7a40x/include/mach/io.h
+++ b/arch/arm/mach-lh7a40x/include/mach/io.h
@@ -11,12 +11,10 @@
11#ifndef __ASM_ARCH_IO_H 11#ifndef __ASM_ARCH_IO_H
12#define __ASM_ARCH_IO_H 12#define __ASM_ARCH_IO_H
13 13
14#include <mach/hardware.h>
15
16#define IO_SPACE_LIMIT 0xffffffff 14#define IO_SPACE_LIMIT 0xffffffff
17 15
18/* No ISA or PCI bus on this machine. */ 16/* No ISA or PCI bus on this machine. */
19#define __io(a) ((void __iomem *)(a)) 17#define __io(a) __typesafe_io(a)
20#define __mem_pci(a) (a) 18#define __mem_pci(a) (a)
21 19
22#endif /* __ASM_ARCH_IO_H */ 20#endif /* __ASM_ARCH_IO_H */
diff --git a/arch/arm/mach-lh7a40x/include/mach/memory.h b/arch/arm/mach-lh7a40x/include/mach/memory.h
index 1da14ff66c93..189d20e543e7 100644
--- a/arch/arm/mach-lh7a40x/include/mach/memory.h
+++ b/arch/arm/mach-lh7a40x/include/mach/memory.h
@@ -19,16 +19,6 @@
19 */ 19 */
20#define PHYS_OFFSET UL(0xc0000000) 20#define PHYS_OFFSET UL(0xc0000000)
21 21
22/*
23 * Virtual view <-> DMA view memory address translations
24 * virt_to_bus: Used to translate the virtual address to an
25 * address suitable to be passed to set_dma_addr
26 * bus_to_virt: Used to convert an address for DMA operations
27 * to an address that the kernel can use.
28 */
29#define __virt_to_bus(x) __virt_to_phys(x)
30#define __bus_to_virt(x) __phys_to_virt(x)
31
32#ifdef CONFIG_DISCONTIGMEM 22#ifdef CONFIG_DISCONTIGMEM
33 23
34/* 24/*
diff --git a/arch/arm/mach-loki/include/mach/dma.h b/arch/arm/mach-loki/include/mach/dma.h
deleted file mode 100644
index 40a8c178f10d..000000000000
--- a/arch/arm/mach-loki/include/mach/dma.h
+++ /dev/null
@@ -1 +0,0 @@
1/* empty */
diff --git a/arch/arm/mach-loki/include/mach/memory.h b/arch/arm/mach-loki/include/mach/memory.h
index a39533ab489d..2ed7e6e732c2 100644
--- a/arch/arm/mach-loki/include/mach/memory.h
+++ b/arch/arm/mach-loki/include/mach/memory.h
@@ -7,8 +7,4 @@
7 7
8#define PHYS_OFFSET UL(0x00000000) 8#define PHYS_OFFSET UL(0x00000000)
9 9
10#define __virt_to_bus(x) __virt_to_phys(x)
11#define __bus_to_virt(x) __phys_to_virt(x)
12
13
14#endif 10#endif
diff --git a/arch/arm/mach-msm/include/mach/io.h b/arch/arm/mach-msm/include/mach/io.h
index c6a2feb268b0..aab964591db4 100644
--- a/arch/arm/mach-msm/include/mach/io.h
+++ b/arch/arm/mach-msm/include/mach/io.h
@@ -23,11 +23,7 @@
23 23
24void __iomem *__msm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype); 24void __iomem *__msm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype);
25 25
26static inline void __iomem *__io(unsigned long addr) 26#define __io(a) __typesafe_io(a)
27{
28 return (void __iomem *)addr;
29}
30#define __io(a) __io(a)
31#define __mem_pci(a) (a) 27#define __mem_pci(a) (a)
32 28
33#endif 29#endif
diff --git a/arch/arm/mach-msm/include/mach/memory.h b/arch/arm/mach-msm/include/mach/memory.h
index 63fd47f2e62e..f4698baec976 100644
--- a/arch/arm/mach-msm/include/mach/memory.h
+++ b/arch/arm/mach-msm/include/mach/memory.h
@@ -19,9 +19,5 @@
19/* physical offset of RAM */ 19/* physical offset of RAM */
20#define PHYS_OFFSET UL(0x10000000) 20#define PHYS_OFFSET UL(0x10000000)
21 21
22/* bus address and physical addresses are identical */
23#define __virt_to_bus(x) __virt_to_phys(x)
24#define __bus_to_virt(x) __phys_to_virt(x)
25
26#endif 22#endif
27 23
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
index 345a14cb73c3..444d9c0f5ca6 100644
--- a/arch/arm/mach-msm/timer.c
+++ b/arch/arm/mach-msm/timer.c
@@ -182,7 +182,7 @@ static void __init msm_timer_init(void)
182 clockevent_delta2ns(0xf0000000 >> clock->shift, ce); 182 clockevent_delta2ns(0xf0000000 >> clock->shift, ce);
183 /* 4 gets rounded down to 3 */ 183 /* 4 gets rounded down to 3 */
184 ce->min_delta_ns = clockevent_delta2ns(4, ce); 184 ce->min_delta_ns = clockevent_delta2ns(4, ce);
185 ce->cpumask = cpumask_of_cpu(0); 185 ce->cpumask = cpumask_of(0);
186 186
187 cs->mult = clocksource_hz2mult(clock->freq, cs->shift); 187 cs->mult = clocksource_hz2mult(clock->freq, cs->shift);
188 res = clocksource_register(cs); 188 res = clocksource_register(cs);
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c
index 238a2f8c2d52..b0e4e0d8f506 100644
--- a/arch/arm/mach-mv78xx0/common.c
+++ b/arch/arm/mach-mv78xx0/common.c
@@ -167,6 +167,7 @@ void __init mv78xx0_map_io(void)
167 ****************************************************************************/ 167 ****************************************************************************/
168static struct orion_ehci_data mv78xx0_ehci_data = { 168static struct orion_ehci_data mv78xx0_ehci_data = {
169 .dram = &mv78xx0_mbus_dram_info, 169 .dram = &mv78xx0_mbus_dram_info,
170 .phy_version = EHCI_PHY_NA,
170}; 171};
171 172
172static u64 ehci_dmamask = 0xffffffffUL; 173static u64 ehci_dmamask = 0xffffffffUL;
diff --git a/arch/arm/mach-mv78xx0/include/mach/dma.h b/arch/arm/mach-mv78xx0/include/mach/dma.h
deleted file mode 100644
index 40a8c178f10d..000000000000
--- a/arch/arm/mach-mv78xx0/include/mach/dma.h
+++ /dev/null
@@ -1 +0,0 @@
1/* empty */
diff --git a/arch/arm/mach-mv78xx0/include/mach/gpio.h b/arch/arm/mach-mv78xx0/include/mach/gpio.h
new file mode 100644
index 000000000000..d9d1535ea100
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/include/mach/gpio.h
@@ -0,0 +1,40 @@
1/*
2 * arch/asm-arm/mach-mv78xx0/include/mach/gpio.h
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#ifndef __ASM_ARCH_GPIO_H
10#define __ASM_ARCH_GPIO_H
11
12#include <mach/irqs.h>
13#include <plat/gpio.h>
14#include <asm-generic/gpio.h> /* cansleep wrappers */
15
16extern int mv78xx0_core_index(void);
17
18#define GPIO_MAX 32
19#define GPIO_OUT(pin) (DEV_BUS_VIRT_BASE + 0x0100)
20#define GPIO_IO_CONF(pin) (DEV_BUS_VIRT_BASE + 0x0104)
21#define GPIO_BLINK_EN(pin) (DEV_BUS_VIRT_BASE + 0x0108)
22#define GPIO_IN_POL(pin) (DEV_BUS_VIRT_BASE + 0x010c)
23#define GPIO_DATA_IN(pin) (DEV_BUS_VIRT_BASE + 0x0110)
24#define GPIO_EDGE_CAUSE(pin) (DEV_BUS_VIRT_BASE + 0x0114)
25#define GPIO_MASK_OFF (mv78xx0_core_index() ? 0x18 : 0)
26#define GPIO_EDGE_MASK(pin) (DEV_BUS_VIRT_BASE + 0x0118 + GPIO_MASK_OFF)
27#define GPIO_LEVEL_MASK(pin) (DEV_BUS_VIRT_BASE + 0x011c + GPIO_MASK_OFF)
28
29static inline int gpio_to_irq(int pin)
30{
31 return pin + IRQ_MV78XX0_GPIO_START;
32}
33
34static inline int irq_to_gpio(int irq)
35{
36 return irq - IRQ_MV78XX0_GPIO_START;
37}
38
39
40#endif
diff --git a/arch/arm/mach-mv78xx0/include/mach/irqs.h b/arch/arm/mach-mv78xx0/include/mach/irqs.h
index bebc330281ec..fa1d422196c2 100644
--- a/arch/arm/mach-mv78xx0/include/mach/irqs.h
+++ b/arch/arm/mach-mv78xx0/include/mach/irqs.h
@@ -11,8 +11,6 @@
11#ifndef __ASM_ARCH_IRQS_H 11#ifndef __ASM_ARCH_IRQS_H
12#define __ASM_ARCH_IRQS_H 12#define __ASM_ARCH_IRQS_H
13 13
14#include "mv78xx0.h" /* need GPIO_MAX */
15
16/* 14/*
17 * MV78xx0 Low Interrupt Controller 15 * MV78xx0 Low Interrupt Controller
18 */ 16 */
@@ -88,7 +86,7 @@
88 * MV78XX0 General Purpose Pins 86 * MV78XX0 General Purpose Pins
89 */ 87 */
90#define IRQ_MV78XX0_GPIO_START 96 88#define IRQ_MV78XX0_GPIO_START 96
91#define NR_GPIO_IRQS GPIO_MAX 89#define NR_GPIO_IRQS 32
92 90
93#define NR_IRQS (IRQ_MV78XX0_GPIO_START + NR_GPIO_IRQS) 91#define NR_IRQS (IRQ_MV78XX0_GPIO_START + NR_GPIO_IRQS)
94 92
diff --git a/arch/arm/mach-mv78xx0/include/mach/memory.h b/arch/arm/mach-mv78xx0/include/mach/memory.h
index 9e47a140ff7a..e663042d307f 100644
--- a/arch/arm/mach-mv78xx0/include/mach/memory.h
+++ b/arch/arm/mach-mv78xx0/include/mach/memory.h
@@ -7,8 +7,4 @@
7 7
8#define PHYS_OFFSET UL(0x00000000) 8#define PHYS_OFFSET UL(0x00000000)
9 9
10#define __virt_to_bus(x) __virt_to_phys(x)
11#define __bus_to_virt(x) __phys_to_virt(x)
12
13
14#endif 10#endif
diff --git a/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h b/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
index ee9c5593ee92..e930ea5330a2 100644
--- a/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
+++ b/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
@@ -122,7 +122,4 @@
122#define SATA_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0xa0000) 122#define SATA_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0xa0000)
123 123
124 124
125#define GPIO_MAX 32
126
127
128#endif 125#endif
diff --git a/arch/arm/mach-mv78xx0/irq.c b/arch/arm/mach-mv78xx0/irq.c
index 503e5d195ae5..e273418797b4 100644
--- a/arch/arm/mach-mv78xx0/irq.c
+++ b/arch/arm/mach-mv78xx0/irq.c
@@ -11,13 +11,42 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <linux/irq.h>
15#include <asm/gpio.h>
14#include <mach/mv78xx0.h> 16#include <mach/mv78xx0.h>
15#include <plat/irq.h> 17#include <plat/irq.h>
16#include "common.h" 18#include "common.h"
17 19
20static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
21{
22 BUG_ON(irq < IRQ_MV78XX0_GPIO_0_7 || irq > IRQ_MV78XX0_GPIO_24_31);
23
24 orion_gpio_irq_handler((irq - IRQ_MV78XX0_GPIO_0_7) << 3);
25}
26
18void __init mv78xx0_init_irq(void) 27void __init mv78xx0_init_irq(void)
19{ 28{
29 int i;
30
20 orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF)); 31 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)); 32 orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF));
22 orion_irq_init(64, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_ERR_OFF)); 33 orion_irq_init(64, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_ERR_OFF));
34
35 /*
36 * Mask and clear GPIO IRQ interrupts.
37 */
38 writel(0, GPIO_LEVEL_MASK(0));
39 writel(0, GPIO_EDGE_MASK(0));
40 writel(0, GPIO_EDGE_CAUSE(0));
41
42 for (i = IRQ_MV78XX0_GPIO_START; i < NR_IRQS; i++) {
43 set_irq_chip(i, &orion_gpio_irq_level_chip);
44 set_irq_handler(i, handle_level_irq);
45 irq_desc[i].status |= IRQ_LEVEL;
46 set_irq_flags(i, IRQF_VALID);
47 }
48 set_irq_chained_handler(IRQ_MV78XX0_GPIO_0_7, gpio_irq_handler);
49 set_irq_chained_handler(IRQ_MV78XX0_GPIO_8_15, gpio_irq_handler);
50 set_irq_chained_handler(IRQ_MV78XX0_GPIO_16_23, gpio_irq_handler);
51 set_irq_chained_handler(IRQ_MV78XX0_GPIO_24_31, gpio_irq_handler);
23} 52}
diff --git a/arch/arm/mach-mx1/Kconfig b/arch/arm/mach-mx1/Kconfig
new file mode 100644
index 000000000000..2b59fc74784f
--- /dev/null
+++ b/arch/arm/mach-mx1/Kconfig
@@ -0,0 +1,14 @@
1if ARCH_MX1
2
3comment "MX1 Platforms"
4
5config MACH_MXLADS
6 bool
7
8config ARCH_MX1ADS
9 bool "MX1ADS platform"
10 select MACH_MXLADS
11 help
12 Say Y here if you are using Motorola MX1ADS/MXLADS boards
13
14endif
diff --git a/arch/arm/mach-mx1/Makefile b/arch/arm/mach-mx1/Makefile
new file mode 100644
index 000000000000..b969719011fa
--- /dev/null
+++ b/arch/arm/mach-mx1/Makefile
@@ -0,0 +1,10 @@
1#
2# Makefile for the linux kernel.
3#
4
5# Object file lists.
6
7obj-y += generic.o clock.o devices.o
8
9# Specific board support
10obj-$(CONFIG_ARCH_MX1ADS) += mx1ads.o
diff --git a/arch/arm/mach-mx1/Makefile.boot b/arch/arm/mach-mx1/Makefile.boot
new file mode 100644
index 000000000000..8ed1492288a2
--- /dev/null
+++ b/arch/arm/mach-mx1/Makefile.boot
@@ -0,0 +1,4 @@
1 zreladdr-y := 0x08008000
2params_phys-y := 0x08000100
3initrd_phys-y := 0x08800000
4
diff --git a/arch/arm/mach-mx1/clock.c b/arch/arm/mach-mx1/clock.c
new file mode 100644
index 000000000000..4bcd1ece55f5
--- /dev/null
+++ b/arch/arm/mach-mx1/clock.c
@@ -0,0 +1,656 @@
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/init.h>
21#include <linux/math64.h>
22#include <linux/err.h>
23#include <linux/clk.h>
24#include <linux/io.h>
25
26#include <mach/clock.h>
27#include <mach/hardware.h>
28#include "crm_regs.h"
29
30static int _clk_enable(struct clk *clk)
31{
32 unsigned int reg;
33
34 reg = __raw_readl(clk->enable_reg);
35 reg |= 1 << clk->enable_shift;
36 __raw_writel(reg, clk->enable_reg);
37
38 return 0;
39}
40
41static void _clk_disable(struct clk *clk)
42{
43 unsigned int reg;
44
45 reg = __raw_readl(clk->enable_reg);
46 reg &= ~(1 << clk->enable_shift);
47 __raw_writel(reg, clk->enable_reg);
48}
49
50static int _clk_can_use_parent(const struct clk *clk_arr[], unsigned int size,
51 struct clk *parent)
52{
53 int i;
54
55 for (i = 0; i < size; i++)
56 if (parent == clk_arr[i])
57 return i;
58
59 return -EINVAL;
60}
61
62static unsigned long
63_clk_simple_round_rate(struct clk *clk, unsigned long rate, unsigned int limit)
64{
65 int div;
66 unsigned long parent_rate;
67
68 parent_rate = clk_get_rate(clk->parent);
69
70 div = parent_rate / rate;
71 if (parent_rate % rate)
72 div++;
73
74 if (div > limit)
75 div = limit;
76
77 return parent_rate / div;
78}
79
80static unsigned long _clk_parent_round_rate(struct clk *clk, unsigned long rate)
81{
82 return clk->parent->round_rate(clk->parent, rate);
83}
84
85static int _clk_parent_set_rate(struct clk *clk, unsigned long rate)
86{
87 return clk->parent->set_rate(clk->parent, rate);
88}
89
90/*
91 * get the system pll clock in Hz
92 *
93 * mfi + mfn / (mfd +1)
94 * f = 2 * f_ref * --------------------
95 * pd + 1
96 */
97static unsigned long mx1_decode_pll(unsigned int pll, u32 f_ref)
98{
99 unsigned long long ll;
100 unsigned long quot;
101
102 u32 mfi = (pll >> 10) & 0xf;
103 u32 mfn = pll & 0x3ff;
104 u32 mfd = (pll >> 16) & 0x3ff;
105 u32 pd = (pll >> 26) & 0xf;
106
107 mfi = mfi <= 5 ? 5 : mfi;
108
109 ll = 2 * (unsigned long long)f_ref *
110 ((mfi << 16) + (mfn << 16) / (mfd + 1));
111 quot = (pd + 1) * (1 << 16);
112 ll += quot / 2;
113 do_div(ll, quot);
114 return (unsigned long)ll;
115}
116
117static unsigned long clk16m_get_rate(struct clk *clk)
118{
119 return 16000000;
120}
121
122static struct clk clk16m = {
123 .name = "CLK16M",
124 .get_rate = clk16m_get_rate,
125 .enable = _clk_enable,
126 .enable_reg = CCM_CSCR,
127 .enable_shift = CCM_CSCR_OSC_EN_SHIFT,
128 .disable = _clk_disable,
129};
130
131/* in Hz */
132static unsigned long clk32_rate;
133
134static unsigned long clk32_get_rate(struct clk *clk)
135{
136 return clk32_rate;
137}
138
139static struct clk clk32 = {
140 .name = "CLK32",
141 .get_rate = clk32_get_rate,
142};
143
144static unsigned long clk32_premult_get_rate(struct clk *clk)
145{
146 return clk_get_rate(clk->parent) * 512;
147}
148
149static struct clk clk32_premult = {
150 .name = "CLK32_premultiplier",
151 .parent = &clk32,
152 .get_rate = clk32_premult_get_rate,
153};
154
155static const struct clk *prem_clk_clocks[] = {
156 &clk32_premult,
157 &clk16m,
158};
159
160static int prem_clk_set_parent(struct clk *clk, struct clk *parent)
161{
162 int i;
163 unsigned int reg = __raw_readl(CCM_CSCR);
164
165 i = _clk_can_use_parent(prem_clk_clocks, ARRAY_SIZE(prem_clk_clocks),
166 parent);
167
168 switch (i) {
169 case 0:
170 reg &= ~CCM_CSCR_SYSTEM_SEL;
171 break;
172 case 1:
173 reg |= CCM_CSCR_SYSTEM_SEL;
174 break;
175 default:
176 return i;
177 }
178
179 __raw_writel(reg, CCM_CSCR);
180
181 return 0;
182}
183
184static struct clk prem_clk = {
185 .name = "prem_clk",
186 .set_parent = prem_clk_set_parent,
187};
188
189static unsigned long system_clk_get_rate(struct clk *clk)
190{
191 return mx1_decode_pll(__raw_readl(CCM_SPCTL0),
192 clk_get_rate(clk->parent));
193}
194
195static struct clk system_clk = {
196 .name = "system_clk",
197 .parent = &prem_clk,
198 .get_rate = system_clk_get_rate,
199};
200
201static unsigned long mcu_clk_get_rate(struct clk *clk)
202{
203 return mx1_decode_pll(__raw_readl(CCM_MPCTL0),
204 clk_get_rate(clk->parent));
205}
206
207static struct clk mcu_clk = {
208 .name = "mcu_clk",
209 .parent = &clk32_premult,
210 .get_rate = mcu_clk_get_rate,
211};
212
213static unsigned long fclk_get_rate(struct clk *clk)
214{
215 unsigned long fclk = clk_get_rate(clk->parent);
216
217 if (__raw_readl(CCM_CSCR) & CCM_CSCR_PRESC)
218 fclk /= 2;
219
220 return fclk;
221}
222
223static struct clk fclk = {
224 .name = "fclk",
225 .parent = &mcu_clk,
226 .get_rate = fclk_get_rate,
227};
228
229/*
230 * get hclk ( SDRAM, CSI, Memory Stick, I2C, DMA )
231 */
232static unsigned long hclk_get_rate(struct clk *clk)
233{
234 return clk_get_rate(clk->parent) / (((__raw_readl(CCM_CSCR) &
235 CCM_CSCR_BCLK_MASK) >> CCM_CSCR_BCLK_OFFSET) + 1);
236}
237
238static unsigned long hclk_round_rate(struct clk *clk, unsigned long rate)
239{
240 return _clk_simple_round_rate(clk, rate, 16);
241}
242
243static int hclk_set_rate(struct clk *clk, unsigned long rate)
244{
245 unsigned int div;
246 unsigned int reg;
247 unsigned long parent_rate;
248
249 parent_rate = clk_get_rate(clk->parent);
250
251 div = parent_rate / rate;
252
253 if (div > 16 || div < 1 || ((parent_rate / div) != rate))
254 return -EINVAL;
255
256 div--;
257
258 reg = __raw_readl(CCM_CSCR);
259 reg &= ~CCM_CSCR_BCLK_MASK;
260 reg |= div << CCM_CSCR_BCLK_OFFSET;
261 __raw_writel(reg, CCM_CSCR);
262
263 return 0;
264}
265
266static struct clk hclk = {
267 .name = "hclk",
268 .parent = &system_clk,
269 .get_rate = hclk_get_rate,
270 .round_rate = hclk_round_rate,
271 .set_rate = hclk_set_rate,
272};
273
274static unsigned long clk48m_get_rate(struct clk *clk)
275{
276 return clk_get_rate(clk->parent) / (((__raw_readl(CCM_CSCR) &
277 CCM_CSCR_USB_MASK) >> CCM_CSCR_USB_OFFSET) + 1);
278}
279
280static unsigned long clk48m_round_rate(struct clk *clk, unsigned long rate)
281{
282 return _clk_simple_round_rate(clk, rate, 8);
283}
284
285static int clk48m_set_rate(struct clk *clk, unsigned long rate)
286{
287 unsigned int div;
288 unsigned int reg;
289 unsigned long parent_rate;
290
291 parent_rate = clk_get_rate(clk->parent);
292
293 div = parent_rate / rate;
294
295 if (div > 8 || div < 1 || ((parent_rate / div) != rate))
296 return -EINVAL;
297
298 div--;
299
300 reg = __raw_readl(CCM_CSCR);
301 reg &= ~CCM_CSCR_USB_MASK;
302 reg |= div << CCM_CSCR_USB_OFFSET;
303 __raw_writel(reg, CCM_CSCR);
304
305 return 0;
306}
307
308static struct clk clk48m = {
309 .name = "CLK48M",
310 .parent = &system_clk,
311 .get_rate = clk48m_get_rate,
312 .round_rate = clk48m_round_rate,
313 .set_rate = clk48m_set_rate,
314};
315
316/*
317 * get peripheral clock 1 ( UART[12], Timer[12], PWM )
318 */
319static unsigned long perclk1_get_rate(struct clk *clk)
320{
321 return clk_get_rate(clk->parent) / (((__raw_readl(CCM_PCDR) &
322 CCM_PCDR_PCLK1_MASK) >> CCM_PCDR_PCLK1_OFFSET) + 1);
323}
324
325static unsigned long perclk1_round_rate(struct clk *clk, unsigned long rate)
326{
327 return _clk_simple_round_rate(clk, rate, 16);
328}
329
330static int perclk1_set_rate(struct clk *clk, unsigned long rate)
331{
332 unsigned int div;
333 unsigned int reg;
334 unsigned long parent_rate;
335
336 parent_rate = clk_get_rate(clk->parent);
337
338 div = parent_rate / rate;
339
340 if (div > 16 || div < 1 || ((parent_rate / div) != rate))
341 return -EINVAL;
342
343 div--;
344
345 reg = __raw_readl(CCM_PCDR);
346 reg &= ~CCM_PCDR_PCLK1_MASK;
347 reg |= div << CCM_PCDR_PCLK1_OFFSET;
348 __raw_writel(reg, CCM_PCDR);
349
350 return 0;
351}
352
353/*
354 * get peripheral clock 2 ( LCD, SD, SPI[12] )
355 */
356static unsigned long perclk2_get_rate(struct clk *clk)
357{
358 return clk_get_rate(clk->parent) / (((__raw_readl(CCM_PCDR) &
359 CCM_PCDR_PCLK2_MASK) >> CCM_PCDR_PCLK2_OFFSET) + 1);
360}
361
362static unsigned long perclk2_round_rate(struct clk *clk, unsigned long rate)
363{
364 return _clk_simple_round_rate(clk, rate, 16);
365}
366
367static int perclk2_set_rate(struct clk *clk, unsigned long rate)
368{
369 unsigned int div;
370 unsigned int reg;
371 unsigned long parent_rate;
372
373 parent_rate = clk_get_rate(clk->parent);
374
375 div = parent_rate / rate;
376
377 if (div > 16 || div < 1 || ((parent_rate / div) != rate))
378 return -EINVAL;
379
380 div--;
381
382 reg = __raw_readl(CCM_PCDR);
383 reg &= ~CCM_PCDR_PCLK2_MASK;
384 reg |= div << CCM_PCDR_PCLK2_OFFSET;
385 __raw_writel(reg, CCM_PCDR);
386
387 return 0;
388}
389
390/*
391 * get peripheral clock 3 ( SSI )
392 */
393static unsigned long perclk3_get_rate(struct clk *clk)
394{
395 return clk_get_rate(clk->parent) / (((__raw_readl(CCM_PCDR) &
396 CCM_PCDR_PCLK3_MASK) >> CCM_PCDR_PCLK3_OFFSET) + 1);
397}
398
399static unsigned long perclk3_round_rate(struct clk *clk, unsigned long rate)
400{
401 return _clk_simple_round_rate(clk, rate, 128);
402}
403
404static int perclk3_set_rate(struct clk *clk, unsigned long rate)
405{
406 unsigned int div;
407 unsigned int reg;
408 unsigned long parent_rate;
409
410 parent_rate = clk_get_rate(clk->parent);
411
412 div = parent_rate / rate;
413
414 if (div > 128 || div < 1 || ((parent_rate / div) != rate))
415 return -EINVAL;
416
417 div--;
418
419 reg = __raw_readl(CCM_PCDR);
420 reg &= ~CCM_PCDR_PCLK3_MASK;
421 reg |= div << CCM_PCDR_PCLK3_OFFSET;
422 __raw_writel(reg, CCM_PCDR);
423
424 return 0;
425}
426
427static struct clk perclk[] = {
428 {
429 .name = "perclk",
430 .id = 0,
431 .parent = &system_clk,
432 .get_rate = perclk1_get_rate,
433 .round_rate = perclk1_round_rate,
434 .set_rate = perclk1_set_rate,
435 }, {
436 .name = "perclk",
437 .id = 1,
438 .parent = &system_clk,
439 .get_rate = perclk2_get_rate,
440 .round_rate = perclk2_round_rate,
441 .set_rate = perclk2_set_rate,
442 }, {
443 .name = "perclk",
444 .id = 2,
445 .parent = &system_clk,
446 .get_rate = perclk3_get_rate,
447 .round_rate = perclk3_round_rate,
448 .set_rate = perclk3_set_rate,
449 }
450};
451
452static const struct clk *clko_clocks[] = {
453 &perclk[0],
454 &hclk,
455 &clk48m,
456 &clk16m,
457 &prem_clk,
458 &fclk,
459};
460
461static int clko_set_parent(struct clk *clk, struct clk *parent)
462{
463 int i;
464 unsigned int reg;
465
466 i = _clk_can_use_parent(clko_clocks, ARRAY_SIZE(clko_clocks), parent);
467 if (i < 0)
468 return i;
469
470 reg = __raw_readl(CCM_CSCR) & ~CCM_CSCR_CLKO_MASK;
471 reg |= i << CCM_CSCR_CLKO_OFFSET;
472 __raw_writel(reg, CCM_CSCR);
473
474 if (clko_clocks[i]->set_rate && clko_clocks[i]->round_rate) {
475 clk->set_rate = _clk_parent_set_rate;
476 clk->round_rate = _clk_parent_round_rate;
477 } else {
478 clk->set_rate = NULL;
479 clk->round_rate = NULL;
480 }
481
482 return 0;
483}
484
485static struct clk clko_clk = {
486 .name = "clko_clk",
487 .set_parent = clko_set_parent,
488};
489
490static struct clk dma_clk = {
491 .name = "dma_clk",
492 .parent = &hclk,
493 .round_rate = _clk_parent_round_rate,
494 .set_rate = _clk_parent_set_rate,
495 .enable = _clk_enable,
496 .enable_reg = SCM_GCCR,
497 .enable_shift = SCM_GCCR_DMA_CLK_EN_OFFSET,
498 .disable = _clk_disable,
499};
500
501static struct clk csi_clk = {
502 .name = "csi_clk",
503 .parent = &hclk,
504 .round_rate = _clk_parent_round_rate,
505 .set_rate = _clk_parent_set_rate,
506 .enable = _clk_enable,
507 .enable_reg = SCM_GCCR,
508 .enable_shift = SCM_GCCR_CSI_CLK_EN_OFFSET,
509 .disable = _clk_disable,
510};
511
512static struct clk mma_clk = {
513 .name = "mma_clk",
514 .parent = &hclk,
515 .round_rate = _clk_parent_round_rate,
516 .set_rate = _clk_parent_set_rate,
517 .enable = _clk_enable,
518 .enable_reg = SCM_GCCR,
519 .enable_shift = SCM_GCCR_MMA_CLK_EN_OFFSET,
520 .disable = _clk_disable,
521};
522
523static struct clk usbd_clk = {
524 .name = "usbd_clk",
525 .parent = &clk48m,
526 .round_rate = _clk_parent_round_rate,
527 .set_rate = _clk_parent_set_rate,
528 .enable = _clk_enable,
529 .enable_reg = SCM_GCCR,
530 .enable_shift = SCM_GCCR_USBD_CLK_EN_OFFSET,
531 .disable = _clk_disable,
532};
533
534static struct clk gpt_clk = {
535 .name = "gpt_clk",
536 .parent = &perclk[0],
537 .round_rate = _clk_parent_round_rate,
538 .set_rate = _clk_parent_set_rate,
539};
540
541static struct clk uart_clk = {
542 .name = "uart_clk",
543 .parent = &perclk[0],
544 .round_rate = _clk_parent_round_rate,
545 .set_rate = _clk_parent_set_rate,
546};
547
548static struct clk i2c_clk = {
549 .name = "i2c_clk",
550 .parent = &hclk,
551 .round_rate = _clk_parent_round_rate,
552 .set_rate = _clk_parent_set_rate,
553};
554
555static struct clk spi_clk = {
556 .name = "spi_clk",
557 .parent = &perclk[1],
558 .round_rate = _clk_parent_round_rate,
559 .set_rate = _clk_parent_set_rate,
560};
561
562static struct clk sdhc_clk = {
563 .name = "sdhc_clk",
564 .parent = &perclk[1],
565 .round_rate = _clk_parent_round_rate,
566 .set_rate = _clk_parent_set_rate,
567};
568
569static struct clk lcdc_clk = {
570 .name = "lcdc_clk",
571 .parent = &perclk[1],
572 .round_rate = _clk_parent_round_rate,
573 .set_rate = _clk_parent_set_rate,
574};
575
576static struct clk mshc_clk = {
577 .name = "mshc_clk",
578 .parent = &hclk,
579 .round_rate = _clk_parent_round_rate,
580 .set_rate = _clk_parent_set_rate,
581};
582
583static struct clk ssi_clk = {
584 .name = "ssi_clk",
585 .parent = &perclk[2],
586 .round_rate = _clk_parent_round_rate,
587 .set_rate = _clk_parent_set_rate,
588};
589
590static struct clk rtc_clk = {
591 .name = "rtc_clk",
592 .parent = &clk32,
593};
594
595static struct clk *mxc_clks[] = {
596 &clk16m,
597 &clk32,
598 &clk32_premult,
599 &prem_clk,
600 &system_clk,
601 &mcu_clk,
602 &fclk,
603 &hclk,
604 &clk48m,
605 &perclk[0],
606 &perclk[1],
607 &perclk[2],
608 &clko_clk,
609 &dma_clk,
610 &csi_clk,
611 &mma_clk,
612 &usbd_clk,
613 &gpt_clk,
614 &uart_clk,
615 &i2c_clk,
616 &spi_clk,
617 &sdhc_clk,
618 &lcdc_clk,
619 &mshc_clk,
620 &ssi_clk,
621 &rtc_clk,
622};
623
624int __init mxc_clocks_init(unsigned long fref)
625{
626 struct clk **clkp;
627 unsigned int reg;
628
629 /* disable clocks we are able to */
630 __raw_writel(0, SCM_GCCR);
631
632 clk32_rate = fref;
633 reg = __raw_readl(CCM_CSCR);
634
635 /* detect clock reference for system PLL */
636 if (reg & CCM_CSCR_SYSTEM_SEL) {
637 prem_clk.parent = &clk16m;
638 } else {
639 /* ensure that oscillator is disabled */
640 reg &= ~(1 << CCM_CSCR_OSC_EN_SHIFT);
641 __raw_writel(reg, CCM_CSCR);
642 prem_clk.parent = &clk32_premult;
643 }
644
645 /* detect reference for CLKO */
646 reg = (reg & CCM_CSCR_CLKO_MASK) >> CCM_CSCR_CLKO_OFFSET;
647 clko_clk.parent = (struct clk *)clko_clocks[reg];
648
649 for (clkp = mxc_clks; clkp < mxc_clks + ARRAY_SIZE(mxc_clks); clkp++)
650 clk_register(*clkp);
651
652 clk_enable(&hclk);
653 clk_enable(&fclk);
654
655 return 0;
656}
diff --git a/arch/arm/mach-mx1/crm_regs.h b/arch/arm/mach-mx1/crm_regs.h
new file mode 100644
index 000000000000..22e866ff0c09
--- /dev/null
+++ b/arch/arm/mach-mx1/crm_regs.h
@@ -0,0 +1,55 @@
1/*
2 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright (c) 2008 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
4 *
5 * This file may be distributed under the terms of the GNU General
6 * Public License, version 2.
7 */
8
9#ifndef __ARCH_ARM_MACH_MX1_CRM_REGS_H__
10#define __ARCH_ARM_MACH_MX1_CRM_REGS_H__
11
12#define CCM_BASE IO_ADDRESS(CCM_BASE_ADDR)
13#define SCM_BASE IO_ADDRESS(SCM_BASE_ADDR)
14
15/* CCM register addresses */
16#define CCM_CSCR (CCM_BASE + 0x0)
17#define CCM_MPCTL0 (CCM_BASE + 0x4)
18#define CCM_MPCTL1 (CCM_BASE + 0x8)
19#define CCM_SPCTL0 (CCM_BASE + 0xC)
20#define CCM_SPCTL1 (CCM_BASE + 0x10)
21#define CCM_PCDR (CCM_BASE + 0x20)
22
23#define CCM_CSCR_CLKO_OFFSET 29
24#define CCM_CSCR_CLKO_MASK (0x7 << 29)
25#define CCM_CSCR_USB_OFFSET 26
26#define CCM_CSCR_USB_MASK (0x7 << 26)
27#define CCM_CSCR_SPLL_RESTART (1 << 22)
28#define CCM_CSCR_MPLL_RESTART (1 << 21)
29#define CCM_CSCR_OSC_EN_SHIFT 17
30#define CCM_CSCR_SYSTEM_SEL (1 << 16)
31#define CCM_CSCR_BCLK_OFFSET 10
32#define CCM_CSCR_BCLK_MASK (0xF << 10)
33#define CCM_CSCR_PRESC (1 << 15)
34#define CCM_CSCR_SPEN (1 << 1)
35#define CCM_CSCR_MPEN (1 << 0)
36
37#define CCM_PCDR_PCLK3_OFFSET 16
38#define CCM_PCDR_PCLK3_MASK (0x7F << 16)
39#define CCM_PCDR_PCLK2_OFFSET 4
40#define CCM_PCDR_PCLK2_MASK (0xF << 4)
41#define CCM_PCDR_PCLK1_OFFSET 0
42#define CCM_PCDR_PCLK1_MASK 0xF
43
44/* SCM register addresses */
45#define SCM_SIDR (SCM_BASE + 0x0)
46#define SCM_FMCR (SCM_BASE + 0x4)
47#define SCM_GPCR (SCM_BASE + 0x8)
48#define SCM_GCCR (SCM_BASE + 0xC)
49
50#define SCM_GCCR_DMA_CLK_EN_OFFSET 3
51#define SCM_GCCR_CSI_CLK_EN_OFFSET 2
52#define SCM_GCCR_MMA_CLK_EN_OFFSET 1
53#define SCM_GCCR_USBD_CLK_EN_OFFSET 0
54
55#endif /* __ARCH_ARM_MACH_MX2_CRM_REGS_H__ */
diff --git a/arch/arm/mach-mx1/devices.c b/arch/arm/mach-mx1/devices.c
new file mode 100644
index 000000000000..686d8d2dbb24
--- /dev/null
+++ b/arch/arm/mach-mx1/devices.c
@@ -0,0 +1,260 @@
1/*
2 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
4 * Copyright (c) 2008 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
5 * Copyright (c) 2008 Darius Augulis <darius.augulis@teltonika.lt>
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 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 */
21
22#include <linux/kernel.h>
23#include <linux/init.h>
24#include <linux/platform_device.h>
25#include <linux/gpio.h>
26#include <mach/hardware.h>
27
28static struct resource imx_csi_resources[] = {
29 [0] = {
30 .start = 0x00224000,
31 .end = 0x00224010,
32 .flags = IORESOURCE_MEM,
33 },
34 [1] = {
35 .start = CSI_INT,
36 .end = CSI_INT,
37 .flags = IORESOURCE_IRQ,
38 },
39};
40
41static u64 imx_csi_dmamask = 0xffffffffUL;
42
43struct platform_device imx_csi_device = {
44 .name = "imx-csi",
45 .id = 0, /* This is used to put cameras on this interface */
46 .dev = {
47 .dma_mask = &imx_csi_dmamask,
48 .coherent_dma_mask = 0xffffffff,
49 },
50 .resource = imx_csi_resources,
51 .num_resources = ARRAY_SIZE(imx_csi_resources),
52};
53
54static struct resource imx_i2c_resources[] = {
55 [0] = {
56 .start = 0x00217000,
57 .end = 0x00217010,
58 .flags = IORESOURCE_MEM,
59 },
60 [1] = {
61 .start = I2C_INT,
62 .end = I2C_INT,
63 .flags = IORESOURCE_IRQ,
64 },
65};
66
67struct platform_device imx_i2c_device = {
68 .name = "imx-i2c",
69 .id = 0,
70 .resource = imx_i2c_resources,
71 .num_resources = ARRAY_SIZE(imx_i2c_resources),
72};
73
74static struct resource imx_uart1_resources[] = {
75 [0] = {
76 .start = UART1_BASE_ADDR,
77 .end = UART1_BASE_ADDR + 0xD0,
78 .flags = IORESOURCE_MEM,
79 },
80 [1] = {
81 .start = UART1_MINT_RX,
82 .end = UART1_MINT_RX,
83 .flags = IORESOURCE_IRQ,
84 },
85 [2] = {
86 .start = UART1_MINT_TX,
87 .end = UART1_MINT_TX,
88 .flags = IORESOURCE_IRQ,
89 },
90 [3] = {
91 .start = UART1_MINT_RTS,
92 .end = UART1_MINT_RTS,
93 .flags = IORESOURCE_IRQ,
94 },
95};
96
97struct platform_device imx_uart1_device = {
98 .name = "imx-uart",
99 .id = 0,
100 .num_resources = ARRAY_SIZE(imx_uart1_resources),
101 .resource = imx_uart1_resources,
102};
103
104static struct resource imx_uart2_resources[] = {
105 [0] = {
106 .start = UART2_BASE_ADDR,
107 .end = UART2_BASE_ADDR + 0xD0,
108 .flags = IORESOURCE_MEM,
109 },
110 [1] = {
111 .start = UART2_MINT_RX,
112 .end = UART2_MINT_RX,
113 .flags = IORESOURCE_IRQ,
114 },
115 [2] = {
116 .start = UART2_MINT_TX,
117 .end = UART2_MINT_TX,
118 .flags = IORESOURCE_IRQ,
119 },
120 [3] = {
121 .start = UART2_MINT_RTS,
122 .end = UART2_MINT_RTS,
123 .flags = IORESOURCE_IRQ,
124 },
125};
126
127struct platform_device imx_uart2_device = {
128 .name = "imx-uart",
129 .id = 1,
130 .num_resources = ARRAY_SIZE(imx_uart2_resources),
131 .resource = imx_uart2_resources,
132};
133
134static struct resource imx_rtc_resources[] = {
135 [0] = {
136 .start = 0x00204000,
137 .end = 0x00204024,
138 .flags = IORESOURCE_MEM,
139 },
140 [1] = {
141 .start = RTC_INT,
142 .end = RTC_INT,
143 .flags = IORESOURCE_IRQ,
144 },
145 [2] = {
146 .start = RTC_SAMINT,
147 .end = RTC_SAMINT,
148 .flags = IORESOURCE_IRQ,
149 },
150};
151
152struct platform_device imx_rtc_device = {
153 .name = "rtc-imx",
154 .id = 0,
155 .resource = imx_rtc_resources,
156 .num_resources = ARRAY_SIZE(imx_rtc_resources),
157};
158
159static struct resource imx_wdt_resources[] = {
160 [0] = {
161 .start = 0x00201000,
162 .end = 0x00201008,
163 .flags = IORESOURCE_MEM,
164 },
165 [1] = {
166 .start = WDT_INT,
167 .end = WDT_INT,
168 .flags = IORESOURCE_IRQ,
169 },
170};
171
172struct platform_device imx_wdt_device = {
173 .name = "imx-wdt",
174 .id = 0,
175 .resource = imx_wdt_resources,
176 .num_resources = ARRAY_SIZE(imx_wdt_resources),
177};
178
179static struct resource imx_usb_resources[] = {
180 [0] = {
181 .start = 0x00212000,
182 .end = 0x00212148,
183 .flags = IORESOURCE_MEM,
184 },
185 [1] = {
186 .start = USBD_INT0,
187 .end = USBD_INT0,
188 .flags = IORESOURCE_IRQ,
189 },
190 [2] = {
191 .start = USBD_INT1,
192 .end = USBD_INT1,
193 .flags = IORESOURCE_IRQ,
194 },
195 [3] = {
196 .start = USBD_INT2,
197 .end = USBD_INT2,
198 .flags = IORESOURCE_IRQ,
199 },
200 [4] = {
201 .start = USBD_INT3,
202 .end = USBD_INT3,
203 .flags = IORESOURCE_IRQ,
204 },
205 [5] = {
206 .start = USBD_INT4,
207 .end = USBD_INT4,
208 .flags = IORESOURCE_IRQ,
209 },
210 [6] = {
211 .start = USBD_INT5,
212 .end = USBD_INT5,
213 .flags = IORESOURCE_IRQ,
214 },
215 [7] = {
216 .start = USBD_INT6,
217 .end = USBD_INT6,
218 .flags = IORESOURCE_IRQ,
219 },
220};
221
222struct platform_device imx_usb_device = {
223 .name = "imx_udc",
224 .id = 0,
225 .num_resources = ARRAY_SIZE(imx_usb_resources),
226 .resource = imx_usb_resources,
227};
228
229/* GPIO port description */
230static struct mxc_gpio_port imx_gpio_ports[] = {
231 [0] = {
232 .chip.label = "gpio-0",
233 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR),
234 .irq = GPIO_INT_PORTA,
235 .virtual_irq_start = MXC_GPIO_IRQ_START
236 },
237 [1] = {
238 .chip.label = "gpio-1",
239 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x100),
240 .irq = GPIO_INT_PORTB,
241 .virtual_irq_start = MXC_GPIO_IRQ_START + 32
242 },
243 [2] = {
244 .chip.label = "gpio-2",
245 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x200),
246 .irq = GPIO_INT_PORTC,
247 .virtual_irq_start = MXC_GPIO_IRQ_START + 64
248 },
249 [3] = {
250 .chip.label = "gpio-3",
251 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x300),
252 .irq = GPIO_INT_PORTD,
253 .virtual_irq_start = MXC_GPIO_IRQ_START + 96
254 }
255};
256
257int __init mxc_register_gpios(void)
258{
259 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
260}
diff --git a/arch/arm/mach-mx1/devices.h b/arch/arm/mach-mx1/devices.h
new file mode 100644
index 000000000000..0da5d7cce3a2
--- /dev/null
+++ b/arch/arm/mach-mx1/devices.h
@@ -0,0 +1,7 @@
1extern struct platform_device imx_csi_device;
2extern struct platform_device imx_i2c_device;
3extern struct platform_device imx_uart1_device;
4extern struct platform_device imx_uart2_device;
5extern struct platform_device imx_rtc_device;
6extern struct platform_device imx_wdt_device;
7extern struct platform_device imx_usb_device;
diff --git a/arch/arm/mach-integrator/include/mach/dma.h b/arch/arm/mach-mx1/generic.c
index fbebe85a2db7..0dec6f300ffc 100644
--- a/arch/arm/mach-integrator/include/mach/dma.h
+++ b/arch/arm/mach-mx1/generic.c
@@ -1,7 +1,9 @@
1/* 1/*
2 * arch/arm/mach-integrator/include/mach/dma.h 2 * author: Sascha Hauer
3 * Created: april 20th, 2004
4 * Copyright: Synertronixx GmbH
3 * 5 *
4 * Copyright (C) 1997,1998 Russell King 6 * Common code for i.MX machines
5 * 7 *
6 * This program is free software; you can redistribute it and/or modify 8 * 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 9 * it under the terms of the GNU General Public License as published by
@@ -16,4 +18,26 @@
16 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
19 */ 22 */
23#include <linux/kernel.h>
24#include <linux/init.h>
25#include <linux/io.h>
26
27#include <asm/mach/map.h>
28
29#include <mach/hardware.h>
30
31static struct map_desc imx_io_desc[] __initdata = {
32 {
33 .virtual = IMX_IO_BASE,
34 .pfn = __phys_to_pfn(IMX_IO_PHYS),
35 .length = IMX_IO_SIZE,
36 .type = MT_DEVICE
37 }
38};
39
40void __init mxc_map_io(void)
41{
42 iotable_init(imx_io_desc, ARRAY_SIZE(imx_io_desc));
43}
diff --git a/arch/arm/mach-mx1/mx1ads.c b/arch/arm/mach-mx1/mx1ads.c
new file mode 100644
index 000000000000..2e4b185fe4a9
--- /dev/null
+++ b/arch/arm/mach-mx1/mx1ads.c
@@ -0,0 +1,148 @@
1/*
2 * arch/arm/mach-imx/mx1ads.c
3 *
4 * Initially based on:
5 * linux-2.6.7-imx/arch/arm/mach-imx/scb9328.c
6 * Copyright (c) 2004 Sascha Hauer <sascha@saschahauer.de>
7 *
8 * 2004 (c) MontaVista Software, Inc.
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/mtd/physmap.h>
19
20#include <asm/mach-types.h>
21#include <asm/mach/arch.h>
22#include <asm/mach/time.h>
23
24#include <mach/hardware.h>
25#include <mach/common.h>
26#include <mach/imx-uart.h>
27#include <mach/iomux-mx1-mx2.h>
28#include "devices.h"
29
30/*
31 * UARTs platform data
32 */
33static int mxc_uart1_pins[] = {
34 PC9_PF_UART1_CTS,
35 PC10_PF_UART1_RTS,
36 PC11_PF_UART1_TXD,
37 PC12_PF_UART1_RXD,
38};
39
40static int uart1_mxc_init(struct platform_device *pdev)
41{
42 return mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
43 ARRAY_SIZE(mxc_uart1_pins), "UART1");
44}
45
46static int uart1_mxc_exit(struct platform_device *pdev)
47{
48 mxc_gpio_release_multiple_pins(mxc_uart1_pins,
49 ARRAY_SIZE(mxc_uart1_pins));
50 return 0;
51}
52
53static int mxc_uart2_pins[] = {
54 PB28_PF_UART2_CTS,
55 PB29_PF_UART2_RTS,
56 PB30_PF_UART2_TXD,
57 PB31_PF_UART2_RXD,
58};
59
60static int uart2_mxc_init(struct platform_device *pdev)
61{
62 return mxc_gpio_setup_multiple_pins(mxc_uart2_pins,
63 ARRAY_SIZE(mxc_uart2_pins), "UART2");
64}
65
66static int uart2_mxc_exit(struct platform_device *pdev)
67{
68 mxc_gpio_release_multiple_pins(mxc_uart2_pins,
69 ARRAY_SIZE(mxc_uart2_pins));
70 return 0;
71}
72
73static struct imxuart_platform_data uart_pdata[] = {
74 {
75 .init = uart1_mxc_init,
76 .exit = uart1_mxc_exit,
77 .flags = IMXUART_HAVE_RTSCTS,
78 }, {
79 .init = uart2_mxc_init,
80 .exit = uart2_mxc_exit,
81 .flags = IMXUART_HAVE_RTSCTS,
82 },
83};
84
85/*
86 * Physmap flash
87 */
88
89static struct physmap_flash_data mx1ads_flash_data = {
90 .width = 4, /* bankwidth in bytes */
91};
92
93static struct resource flash_resource = {
94 .start = IMX_CS0_PHYS,
95 .end = IMX_CS0_PHYS + SZ_32M - 1,
96 .flags = IORESOURCE_MEM,
97};
98
99static struct platform_device flash_device = {
100 .name = "physmap-flash",
101 .id = 0,
102 .resource = &flash_resource,
103 .num_resources = 1,
104};
105
106/*
107 * Board init
108 */
109static void __init mx1ads_init(void)
110{
111 /* UART */
112 mxc_register_device(&imx_uart1_device, &uart_pdata[0]);
113 mxc_register_device(&imx_uart2_device, &uart_pdata[1]);
114
115 /* Physmap flash */
116 mxc_register_device(&flash_device, &mx1ads_flash_data);
117}
118
119static void __init mx1ads_timer_init(void)
120{
121 mxc_clocks_init(32000);
122 mxc_timer_init("gpt_clk");
123}
124
125struct sys_timer mx1ads_timer = {
126 .init = mx1ads_timer_init,
127};
128
129MACHINE_START(MX1ADS, "Freescale MX1ADS")
130 /* Maintainer: Sascha Hauer, Pengutronix */
131 .phys_io = IMX_IO_PHYS,
132 .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc,
133 .boot_params = PHYS_OFFSET + 0x100,
134 .map_io = mxc_map_io,
135 .init_irq = mxc_init_irq,
136 .timer = &mx1ads_timer,
137 .init_machine = mx1ads_init,
138MACHINE_END
139
140MACHINE_START(MXLADS, "Freescale MXLADS")
141 .phys_io = IMX_IO_PHYS,
142 .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc,
143 .boot_params = PHYS_OFFSET + 0x100,
144 .map_io = mxc_map_io,
145 .init_irq = mxc_init_irq,
146 .timer = &mx1ads_timer,
147 .init_machine = mx1ads_init,
148MACHINE_END
diff --git a/arch/arm/mach-mx2/devices.c b/arch/arm/mach-mx2/devices.c
index bd0559d5933e..af121f5ab710 100644
--- a/arch/arm/mach-mx2/devices.c
+++ b/arch/arm/mach-mx2/devices.c
@@ -190,38 +190,72 @@ struct platform_device mxc_wdt = {
190 .resource = mxc_wdt_resources, 190 .resource = mxc_wdt_resources,
191}; 191};
192 192
193static struct resource mxc_w1_master_resources[] = {
194 {
195 .start = OWIRE_BASE_ADDR,
196 .end = OWIRE_BASE_ADDR + SZ_4K - 1,
197 .flags = IORESOURCE_MEM,
198 },
199};
200
201struct platform_device mxc_w1_master_device = {
202 .name = "mxc_w1",
203 .id = 0,
204 .num_resources = ARRAY_SIZE(mxc_w1_master_resources),
205 .resource = mxc_w1_master_resources,
206};
207
208static struct resource mxc_nand_resources[] = {
209 {
210 .start = NFC_BASE_ADDR,
211 .end = NFC_BASE_ADDR + 0xfff,
212 .flags = IORESOURCE_MEM
213 }, {
214 .start = MXC_INT_NANDFC,
215 .end = MXC_INT_NANDFC,
216 .flags = IORESOURCE_IRQ
217 },
218};
219
220struct platform_device mxc_nand_device = {
221 .name = "mxc_nand",
222 .id = 0,
223 .num_resources = ARRAY_SIZE(mxc_nand_resources),
224 .resource = mxc_nand_resources,
225};
226
193/* GPIO port description */ 227/* GPIO port description */
194static struct mxc_gpio_port imx_gpio_ports[] = { 228static struct mxc_gpio_port imx_gpio_ports[] = {
195 [0] = { 229 [0] = {
196 .chip.label = "gpio-0", 230 .chip.label = "gpio-0",
197 .irq = MXC_INT_GPIO, 231 .irq = MXC_INT_GPIO,
198 .base = (void*)(AIPI_BASE_ADDR_VIRT + 0x15000 + 0x100 * 0), 232 .base = (void*)(AIPI_BASE_ADDR_VIRT + 0x15000 + 0x100 * 0),
199 .virtual_irq_start = MXC_MAX_INT_LINES, 233 .virtual_irq_start = MXC_GPIO_IRQ_START,
200 }, 234 },
201 [1] = { 235 [1] = {
202 .chip.label = "gpio-1", 236 .chip.label = "gpio-1",
203 .base = (void*)(AIPI_BASE_ADDR_VIRT + 0x15000 + 0x100 * 1), 237 .base = (void*)(AIPI_BASE_ADDR_VIRT + 0x15000 + 0x100 * 1),
204 .virtual_irq_start = MXC_MAX_INT_LINES + 32, 238 .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
205 }, 239 },
206 [2] = { 240 [2] = {
207 .chip.label = "gpio-2", 241 .chip.label = "gpio-2",
208 .base = (void*)(AIPI_BASE_ADDR_VIRT + 0x15000 + 0x100 * 2), 242 .base = (void*)(AIPI_BASE_ADDR_VIRT + 0x15000 + 0x100 * 2),
209 .virtual_irq_start = MXC_MAX_INT_LINES + 64, 243 .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
210 }, 244 },
211 [3] = { 245 [3] = {
212 .chip.label = "gpio-3", 246 .chip.label = "gpio-3",
213 .base = (void*)(AIPI_BASE_ADDR_VIRT + 0x15000 + 0x100 * 3), 247 .base = (void*)(AIPI_BASE_ADDR_VIRT + 0x15000 + 0x100 * 3),
214 .virtual_irq_start = MXC_MAX_INT_LINES + 96, 248 .virtual_irq_start = MXC_GPIO_IRQ_START + 96,
215 }, 249 },
216 [4] = { 250 [4] = {
217 .chip.label = "gpio-4", 251 .chip.label = "gpio-4",
218 .base = (void*)(AIPI_BASE_ADDR_VIRT + 0x15000 + 0x100 * 4), 252 .base = (void*)(AIPI_BASE_ADDR_VIRT + 0x15000 + 0x100 * 4),
219 .virtual_irq_start = MXC_MAX_INT_LINES + 128, 253 .virtual_irq_start = MXC_GPIO_IRQ_START + 128,
220 }, 254 },
221 [5] = { 255 [5] = {
222 .chip.label = "gpio-5", 256 .chip.label = "gpio-5",
223 .base = (void*)(AIPI_BASE_ADDR_VIRT + 0x15000 + 0x100 * 5), 257 .base = (void*)(AIPI_BASE_ADDR_VIRT + 0x15000 + 0x100 * 5),
224 .virtual_irq_start = MXC_MAX_INT_LINES + 160, 258 .virtual_irq_start = MXC_GPIO_IRQ_START + 160,
225 } 259 }
226}; 260};
227 261
diff --git a/arch/arm/mach-mx2/devices.h b/arch/arm/mach-mx2/devices.h
index c77a4b8f73b4..1e8cb577a642 100644
--- a/arch/arm/mach-mx2/devices.h
+++ b/arch/arm/mach-mx2/devices.h
@@ -12,4 +12,5 @@ extern struct platform_device mxc_uart_device2;
12extern struct platform_device mxc_uart_device3; 12extern struct platform_device mxc_uart_device3;
13extern struct platform_device mxc_uart_device4; 13extern struct platform_device mxc_uart_device4;
14extern struct platform_device mxc_uart_device5; 14extern struct platform_device mxc_uart_device5;
15 15extern struct platform_device mxc_w1_master_device;
16extern struct platform_device mxc_nand_device;
diff --git a/arch/arm/mach-mx2/mx27ads.c b/arch/arm/mach-mx2/mx27ads.c
index 56e22d3ca075..2b5c67f54571 100644
--- a/arch/arm/mach-mx2/mx27ads.c
+++ b/arch/arm/mach-mx2/mx27ads.c
@@ -68,15 +68,14 @@ static int mxc_uart0_pins[] = {
68static int uart_mxc_port0_init(struct platform_device *pdev) 68static int uart_mxc_port0_init(struct platform_device *pdev)
69{ 69{
70 return mxc_gpio_setup_multiple_pins(mxc_uart0_pins, 70 return mxc_gpio_setup_multiple_pins(mxc_uart0_pins,
71 ARRAY_SIZE(mxc_uart0_pins), 71 ARRAY_SIZE(mxc_uart0_pins), "UART0");
72 MXC_GPIO_ALLOC_MODE_NORMAL, "UART0");
73} 72}
74 73
75static int uart_mxc_port0_exit(struct platform_device *pdev) 74static int uart_mxc_port0_exit(struct platform_device *pdev)
76{ 75{
77 return mxc_gpio_setup_multiple_pins(mxc_uart0_pins, 76 mxc_gpio_release_multiple_pins(mxc_uart0_pins,
78 ARRAY_SIZE(mxc_uart0_pins), 77 ARRAY_SIZE(mxc_uart0_pins));
79 MXC_GPIO_ALLOC_MODE_RELEASE, "UART0"); 78 return 0;
80} 79}
81 80
82static int mxc_uart1_pins[] = { 81static int mxc_uart1_pins[] = {
@@ -89,15 +88,14 @@ static int mxc_uart1_pins[] = {
89static int uart_mxc_port1_init(struct platform_device *pdev) 88static int uart_mxc_port1_init(struct platform_device *pdev)
90{ 89{
91 return mxc_gpio_setup_multiple_pins(mxc_uart1_pins, 90 return mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
92 ARRAY_SIZE(mxc_uart1_pins), 91 ARRAY_SIZE(mxc_uart1_pins), "UART1");
93 MXC_GPIO_ALLOC_MODE_NORMAL, "UART1");
94} 92}
95 93
96static int uart_mxc_port1_exit(struct platform_device *pdev) 94static int uart_mxc_port1_exit(struct platform_device *pdev)
97{ 95{
98 return mxc_gpio_setup_multiple_pins(mxc_uart1_pins, 96 mxc_gpio_release_multiple_pins(mxc_uart1_pins,
99 ARRAY_SIZE(mxc_uart1_pins), 97 ARRAY_SIZE(mxc_uart1_pins));
100 MXC_GPIO_ALLOC_MODE_RELEASE, "UART1"); 98 return 0;
101} 99}
102 100
103static int mxc_uart2_pins[] = { 101static int mxc_uart2_pins[] = {
@@ -110,15 +108,14 @@ static int mxc_uart2_pins[] = {
110static int uart_mxc_port2_init(struct platform_device *pdev) 108static int uart_mxc_port2_init(struct platform_device *pdev)
111{ 109{
112 return mxc_gpio_setup_multiple_pins(mxc_uart2_pins, 110 return mxc_gpio_setup_multiple_pins(mxc_uart2_pins,
113 ARRAY_SIZE(mxc_uart2_pins), 111 ARRAY_SIZE(mxc_uart2_pins), "UART2");
114 MXC_GPIO_ALLOC_MODE_NORMAL, "UART2");
115} 112}
116 113
117static int uart_mxc_port2_exit(struct platform_device *pdev) 114static int uart_mxc_port2_exit(struct platform_device *pdev)
118{ 115{
119 return mxc_gpio_setup_multiple_pins(mxc_uart2_pins, 116 mxc_gpio_release_multiple_pins(mxc_uart2_pins,
120 ARRAY_SIZE(mxc_uart2_pins), 117 ARRAY_SIZE(mxc_uart2_pins));
121 MXC_GPIO_ALLOC_MODE_RELEASE, "UART2"); 118 return 0;
122} 119}
123 120
124static int mxc_uart3_pins[] = { 121static int mxc_uart3_pins[] = {
@@ -131,15 +128,13 @@ static int mxc_uart3_pins[] = {
131static int uart_mxc_port3_init(struct platform_device *pdev) 128static int uart_mxc_port3_init(struct platform_device *pdev)
132{ 129{
133 return mxc_gpio_setup_multiple_pins(mxc_uart3_pins, 130 return mxc_gpio_setup_multiple_pins(mxc_uart3_pins,
134 ARRAY_SIZE(mxc_uart3_pins), 131 ARRAY_SIZE(mxc_uart3_pins), "UART3");
135 MXC_GPIO_ALLOC_MODE_NORMAL, "UART3");
136} 132}
137 133
138static int uart_mxc_port3_exit(struct platform_device *pdev) 134static int uart_mxc_port3_exit(struct platform_device *pdev)
139{ 135{
140 return mxc_gpio_setup_multiple_pins(mxc_uart3_pins, 136 mxc_gpio_release_multiple_pins(mxc_uart3_pins,
141 ARRAY_SIZE(mxc_uart3_pins), 137 ARRAY_SIZE(mxc_uart3_pins));
142 MXC_GPIO_ALLOC_MODE_RELEASE, "UART3");
143} 138}
144 139
145static int mxc_uart4_pins[] = { 140static int mxc_uart4_pins[] = {
@@ -152,15 +147,14 @@ static int mxc_uart4_pins[] = {
152static int uart_mxc_port4_init(struct platform_device *pdev) 147static int uart_mxc_port4_init(struct platform_device *pdev)
153{ 148{
154 return mxc_gpio_setup_multiple_pins(mxc_uart4_pins, 149 return mxc_gpio_setup_multiple_pins(mxc_uart4_pins,
155 ARRAY_SIZE(mxc_uart4_pins), 150 ARRAY_SIZE(mxc_uart4_pins), "UART4");
156 MXC_GPIO_ALLOC_MODE_NORMAL, "UART4");
157} 151}
158 152
159static int uart_mxc_port4_exit(struct platform_device *pdev) 153static int uart_mxc_port4_exit(struct platform_device *pdev)
160{ 154{
161 return mxc_gpio_setup_multiple_pins(mxc_uart4_pins, 155 mxc_gpio_release_multiple_pins(mxc_uart4_pins,
162 ARRAY_SIZE(mxc_uart4_pins), 156 ARRAY_SIZE(mxc_uart4_pins));
163 MXC_GPIO_ALLOC_MODE_RELEASE, "UART4"); 157 return 0;
164} 158}
165 159
166static int mxc_uart5_pins[] = { 160static int mxc_uart5_pins[] = {
@@ -173,15 +167,14 @@ static int mxc_uart5_pins[] = {
173static int uart_mxc_port5_init(struct platform_device *pdev) 167static int uart_mxc_port5_init(struct platform_device *pdev)
174{ 168{
175 return mxc_gpio_setup_multiple_pins(mxc_uart5_pins, 169 return mxc_gpio_setup_multiple_pins(mxc_uart5_pins,
176 ARRAY_SIZE(mxc_uart5_pins), 170 ARRAY_SIZE(mxc_uart5_pins), "UART5");
177 MXC_GPIO_ALLOC_MODE_NORMAL, "UART5");
178} 171}
179 172
180static int uart_mxc_port5_exit(struct platform_device *pdev) 173static int uart_mxc_port5_exit(struct platform_device *pdev)
181{ 174{
182 return mxc_gpio_setup_multiple_pins(mxc_uart5_pins, 175 mxc_gpio_release_multiple_pins(mxc_uart5_pins,
183 ARRAY_SIZE(mxc_uart5_pins), 176 ARRAY_SIZE(mxc_uart5_pins));
184 MXC_GPIO_ALLOC_MODE_RELEASE, "UART5"); 177 return 0;
185} 178}
186 179
187static struct platform_device *platform_devices[] __initdata = { 180static struct platform_device *platform_devices[] __initdata = {
@@ -212,15 +205,13 @@ static int mxc_fec_pins[] = {
212static void gpio_fec_active(void) 205static void gpio_fec_active(void)
213{ 206{
214 mxc_gpio_setup_multiple_pins(mxc_fec_pins, 207 mxc_gpio_setup_multiple_pins(mxc_fec_pins,
215 ARRAY_SIZE(mxc_fec_pins), 208 ARRAY_SIZE(mxc_fec_pins), "FEC");
216 MXC_GPIO_ALLOC_MODE_NORMAL, "FEC");
217} 209}
218 210
219static void gpio_fec_inactive(void) 211static void gpio_fec_inactive(void)
220{ 212{
221 mxc_gpio_setup_multiple_pins(mxc_fec_pins, 213 mxc_gpio_release_multiple_pins(mxc_fec_pins,
222 ARRAY_SIZE(mxc_fec_pins), 214 ARRAY_SIZE(mxc_fec_pins));
223 MXC_GPIO_ALLOC_MODE_RELEASE, "FEC");
224} 215}
225 216
226static struct imxuart_platform_data uart_pdata[] = { 217static struct imxuart_platform_data uart_pdata[] = {
diff --git a/arch/arm/mach-mx2/pcm038.c b/arch/arm/mach-mx2/pcm038.c
index 7f55746e2591..dfd4156da7d5 100644
--- a/arch/arm/mach-mx2/pcm038.c
+++ b/arch/arm/mach-mx2/pcm038.c
@@ -19,6 +19,7 @@
19 19
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/mtd/physmap.h> 21#include <linux/mtd/physmap.h>
22#include <linux/mtd/plat-ram.h>
22#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
23#include <asm/mach-types.h> 24#include <asm/mach-types.h>
24#include <mach/common.h> 25#include <mach/common.h>
@@ -27,10 +28,36 @@
27#include <asm/mach/time.h> 28#include <asm/mach/time.h>
28#include <mach/imx-uart.h> 29#include <mach/imx-uart.h>
29#include <mach/board-pcm038.h> 30#include <mach/board-pcm038.h>
31#include <mach/mxc_nand.h>
30 32
31#include "devices.h" 33#include "devices.h"
32 34
33/* 35/*
36 * Phytec's PCM038 comes with 2MiB battery buffered SRAM,
37 * 16 bit width
38 */
39
40static struct platdata_mtd_ram pcm038_sram_data = {
41 .bankwidth = 2,
42};
43
44static struct resource pcm038_sram_resource = {
45 .start = CS1_BASE_ADDR,
46 .end = CS1_BASE_ADDR + 512 * 1024 - 1,
47 .flags = IORESOURCE_MEM,
48};
49
50static struct platform_device pcm038_sram_mtd_device = {
51 .name = "mtd-ram",
52 .id = 0,
53 .dev = {
54 .platform_data = &pcm038_sram_data,
55 },
56 .num_resources = 1,
57 .resource = &pcm038_sram_resource,
58};
59
60/*
34 * Phytec's phyCORE-i.MX27 comes with 32MiB flash, 61 * Phytec's phyCORE-i.MX27 comes with 32MiB flash,
35 * 16 bit width 62 * 16 bit width
36 */ 63 */
@@ -64,15 +91,14 @@ static int mxc_uart0_pins[] = {
64static int uart_mxc_port0_init(struct platform_device *pdev) 91static int uart_mxc_port0_init(struct platform_device *pdev)
65{ 92{
66 return mxc_gpio_setup_multiple_pins(mxc_uart0_pins, 93 return mxc_gpio_setup_multiple_pins(mxc_uart0_pins,
67 ARRAY_SIZE(mxc_uart0_pins), 94 ARRAY_SIZE(mxc_uart0_pins), "UART0");
68 MXC_GPIO_ALLOC_MODE_NORMAL, "UART0");
69} 95}
70 96
71static int uart_mxc_port0_exit(struct platform_device *pdev) 97static int uart_mxc_port0_exit(struct platform_device *pdev)
72{ 98{
73 return mxc_gpio_setup_multiple_pins(mxc_uart0_pins, 99 mxc_gpio_release_multiple_pins(mxc_uart0_pins,
74 ARRAY_SIZE(mxc_uart0_pins), 100 ARRAY_SIZE(mxc_uart0_pins));
75 MXC_GPIO_ALLOC_MODE_RELEASE, "UART0"); 101 return 0;
76} 102}
77 103
78static int mxc_uart1_pins[] = { 104static int mxc_uart1_pins[] = {
@@ -85,15 +111,14 @@ static int mxc_uart1_pins[] = {
85static int uart_mxc_port1_init(struct platform_device *pdev) 111static int uart_mxc_port1_init(struct platform_device *pdev)
86{ 112{
87 return mxc_gpio_setup_multiple_pins(mxc_uart1_pins, 113 return mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
88 ARRAY_SIZE(mxc_uart1_pins), 114 ARRAY_SIZE(mxc_uart1_pins), "UART1");
89 MXC_GPIO_ALLOC_MODE_NORMAL, "UART1");
90} 115}
91 116
92static int uart_mxc_port1_exit(struct platform_device *pdev) 117static int uart_mxc_port1_exit(struct platform_device *pdev)
93{ 118{
94 return mxc_gpio_setup_multiple_pins(mxc_uart1_pins, 119 mxc_gpio_release_multiple_pins(mxc_uart1_pins,
95 ARRAY_SIZE(mxc_uart1_pins), 120 ARRAY_SIZE(mxc_uart1_pins));
96 MXC_GPIO_ALLOC_MODE_RELEASE, "UART1"); 121 return 0;
97} 122}
98 123
99static int mxc_uart2_pins[] = { PE10_PF_UART3_CTS, 124static int mxc_uart2_pins[] = { PE10_PF_UART3_CTS,
@@ -104,15 +129,14 @@ static int mxc_uart2_pins[] = { PE10_PF_UART3_CTS,
104static int uart_mxc_port2_init(struct platform_device *pdev) 129static int uart_mxc_port2_init(struct platform_device *pdev)
105{ 130{
106 return mxc_gpio_setup_multiple_pins(mxc_uart2_pins, 131 return mxc_gpio_setup_multiple_pins(mxc_uart2_pins,
107 ARRAY_SIZE(mxc_uart2_pins), 132 ARRAY_SIZE(mxc_uart2_pins), "UART2");
108 MXC_GPIO_ALLOC_MODE_NORMAL, "UART2");
109} 133}
110 134
111static int uart_mxc_port2_exit(struct platform_device *pdev) 135static int uart_mxc_port2_exit(struct platform_device *pdev)
112{ 136{
113 return mxc_gpio_setup_multiple_pins(mxc_uart2_pins, 137 mxc_gpio_release_multiple_pins(mxc_uart2_pins,
114 ARRAY_SIZE(mxc_uart2_pins), 138 ARRAY_SIZE(mxc_uart2_pins));
115 MXC_GPIO_ALLOC_MODE_RELEASE, "UART2"); 139 return 0;
116} 140}
117 141
118static struct imxuart_platform_data uart_pdata[] = { 142static struct imxuart_platform_data uart_pdata[] = {
@@ -155,29 +179,47 @@ static int mxc_fec_pins[] = {
155static void gpio_fec_active(void) 179static void gpio_fec_active(void)
156{ 180{
157 mxc_gpio_setup_multiple_pins(mxc_fec_pins, 181 mxc_gpio_setup_multiple_pins(mxc_fec_pins,
158 ARRAY_SIZE(mxc_fec_pins), 182 ARRAY_SIZE(mxc_fec_pins), "FEC");
159 MXC_GPIO_ALLOC_MODE_NORMAL, "FEC");
160} 183}
161 184
162static void gpio_fec_inactive(void) 185static void gpio_fec_inactive(void)
163{ 186{
164 mxc_gpio_setup_multiple_pins(mxc_fec_pins, 187 mxc_gpio_release_multiple_pins(mxc_fec_pins,
165 ARRAY_SIZE(mxc_fec_pins), 188 ARRAY_SIZE(mxc_fec_pins));
166 MXC_GPIO_ALLOC_MODE_RELEASE, "FEC");
167} 189}
168 190
191static struct mxc_nand_platform_data pcm038_nand_board_info = {
192 .width = 1,
193 .hw_ecc = 1,
194};
195
169static struct platform_device *platform_devices[] __initdata = { 196static struct platform_device *platform_devices[] __initdata = {
170 &pcm038_nor_mtd_device, 197 &pcm038_nor_mtd_device,
198 &mxc_w1_master_device,
199 &pcm038_sram_mtd_device,
171}; 200};
172 201
202/* On pcm038 there's a sram attached to CS1, we enable the chipselect here and
203 * setup other stuffs to access the sram. */
204static void __init pcm038_init_sram(void)
205{
206 __raw_writel(0x0000d843, CSCR_U(1));
207 __raw_writel(0x22252521, CSCR_L(1));
208 __raw_writel(0x22220a00, CSCR_A(1));
209}
210
173static void __init pcm038_init(void) 211static void __init pcm038_init(void)
174{ 212{
175 gpio_fec_active(); 213 gpio_fec_active();
214 pcm038_init_sram();
176 215
177 mxc_register_device(&mxc_uart_device0, &uart_pdata[0]); 216 mxc_register_device(&mxc_uart_device0, &uart_pdata[0]);
178 mxc_register_device(&mxc_uart_device1, &uart_pdata[1]); 217 mxc_register_device(&mxc_uart_device1, &uart_pdata[1]);
179 mxc_register_device(&mxc_uart_device2, &uart_pdata[2]); 218 mxc_register_device(&mxc_uart_device2, &uart_pdata[2]);
180 219
220 mxc_gpio_mode(PE16_AF_RTCK); /* OWIRE */
221 mxc_register_device(&mxc_nand_device, &pcm038_nand_board_info);
222
181 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 223 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
182 224
183#ifdef CONFIG_MACH_PCM970_BASEBOARD 225#ifdef CONFIG_MACH_PCM970_BASEBOARD
diff --git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig
index db9431dee1b4..e79659e8176e 100644
--- a/arch/arm/mach-mx3/Kconfig
+++ b/arch/arm/mach-mx3/Kconfig
@@ -21,5 +21,19 @@ config MACH_MX31LITE
21 Include support for MX31 LITEKIT platform. This includes specific 21 Include support for MX31 LITEKIT platform. This includes specific
22 configurations for the board and its peripherals. 22 configurations for the board and its peripherals.
23 23
24config MACH_MX31_3DS
25 bool "Support MX31PDK (3DS)"
26 default n
27 help
28 Include support for MX31PDK (3DS) platform. This includes specific
29 configurations for the board and its peripherals.
30
31config MACH_MX31MOBOARD
32 bool "Support mx31moboard platforms (EPFL Mobots group)"
33 default n
34 help
35 Include support for mx31moboard platform. This includes specific
36 configurations for the board and its peripherals.
37
24endmenu 38endmenu
25 39
diff --git a/arch/arm/mach-mx3/Makefile b/arch/arm/mach-mx3/Makefile
index 8b21abb71fb0..5a151540fe83 100644
--- a/arch/arm/mach-mx3/Makefile
+++ b/arch/arm/mach-mx3/Makefile
@@ -8,3 +8,5 @@ obj-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 9obj-$(CONFIG_MACH_MX31LITE) += mx31lite.o
10obj-$(CONFIG_MACH_PCM037) += pcm037.o 10obj-$(CONFIG_MACH_PCM037) += pcm037.o
11obj-$(CONFIG_MACH_MX31_3DS) += mx31pdk.o
12obj-$(CONFIG_MACH_MX31MOBOARD) += mx31moboard.o
diff --git a/arch/arm/mach-mx3/clock.c b/arch/arm/mach-mx3/clock.c
index 9f14a871ee7c..b1746aae1f89 100644
--- a/arch/arm/mach-mx3/clock.c
+++ b/arch/arm/mach-mx3/clock.c
@@ -24,6 +24,7 @@
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <mach/clock.h> 26#include <mach/clock.h>
27#include <mach/hardware.h>
27#include <asm/div64.h> 28#include <asm/div64.h>
28 29
29#include "crm_regs.h" 30#include "crm_regs.h"
diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c
index a6bdcc07f3c9..1d46cb4adf96 100644
--- a/arch/arm/mach-mx3/devices.c
+++ b/arch/arm/mach-mx3/devices.c
@@ -125,19 +125,19 @@ static struct mxc_gpio_port imx_gpio_ports[] = {
125 .chip.label = "gpio-0", 125 .chip.label = "gpio-0",
126 .base = IO_ADDRESS(GPIO1_BASE_ADDR), 126 .base = IO_ADDRESS(GPIO1_BASE_ADDR),
127 .irq = MXC_INT_GPIO1, 127 .irq = MXC_INT_GPIO1,
128 .virtual_irq_start = MXC_GPIO_INT_BASE 128 .virtual_irq_start = MXC_GPIO_IRQ_START,
129 }, 129 },
130 [1] = { 130 [1] = {
131 .chip.label = "gpio-1", 131 .chip.label = "gpio-1",
132 .base = IO_ADDRESS(GPIO2_BASE_ADDR), 132 .base = IO_ADDRESS(GPIO2_BASE_ADDR),
133 .irq = MXC_INT_GPIO2, 133 .irq = MXC_INT_GPIO2,
134 .virtual_irq_start = MXC_GPIO_INT_BASE + GPIO_NUM_PIN 134 .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
135 }, 135 },
136 [2] = { 136 [2] = {
137 .chip.label = "gpio-2", 137 .chip.label = "gpio-2",
138 .base = IO_ADDRESS(GPIO3_BASE_ADDR), 138 .base = IO_ADDRESS(GPIO3_BASE_ADDR),
139 .irq = MXC_INT_GPIO3, 139 .irq = MXC_INT_GPIO3,
140 .virtual_irq_start = MXC_GPIO_INT_BASE + GPIO_NUM_PIN * 2 140 .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
141 } 141 }
142}; 142};
143 143
@@ -145,3 +145,37 @@ int __init mxc_register_gpios(void)
145{ 145{
146 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports)); 146 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
147} 147}
148
149static struct resource mxc_w1_master_resources[] = {
150 {
151 .start = OWIRE_BASE_ADDR,
152 .end = OWIRE_BASE_ADDR + SZ_4K - 1,
153 .flags = IORESOURCE_MEM,
154 },
155};
156
157struct platform_device mxc_w1_master_device = {
158 .name = "mxc_w1",
159 .id = 0,
160 .num_resources = ARRAY_SIZE(mxc_w1_master_resources),
161 .resource = mxc_w1_master_resources,
162};
163
164static struct resource mxc_nand_resources[] = {
165 {
166 .start = NFC_BASE_ADDR,
167 .end = NFC_BASE_ADDR + 0xfff,
168 .flags = IORESOURCE_MEM
169 }, {
170 .start = MXC_INT_NANDFC,
171 .end = MXC_INT_NANDFC,
172 .flags = IORESOURCE_IRQ
173 },
174};
175
176struct platform_device mxc_nand_device = {
177 .name = "mxc_nand",
178 .id = 0,
179 .num_resources = ARRAY_SIZE(mxc_nand_resources),
180 .resource = mxc_nand_resources,
181};
diff --git a/arch/arm/mach-mx3/devices.h b/arch/arm/mach-mx3/devices.h
index 4dc03f9e6001..9949ef4e0694 100644
--- a/arch/arm/mach-mx3/devices.h
+++ b/arch/arm/mach-mx3/devices.h
@@ -4,3 +4,5 @@ extern struct platform_device mxc_uart_device1;
4extern struct platform_device mxc_uart_device2; 4extern struct platform_device mxc_uart_device2;
5extern struct platform_device mxc_uart_device3; 5extern struct platform_device mxc_uart_device3;
6extern struct platform_device mxc_uart_device4; 6extern struct platform_device mxc_uart_device4;
7extern struct platform_device mxc_w1_master_device;
8extern struct platform_device mxc_nand_device;
diff --git a/arch/arm/mach-mx3/iomux.c b/arch/arm/mach-mx3/iomux.c
index 6e664be8cc13..7a5088b519a8 100644
--- a/arch/arm/mach-mx3/iomux.c
+++ b/arch/arm/mach-mx3/iomux.c
@@ -74,17 +74,18 @@ void mxc_iomux_set_pad(enum iomux_pins pin, u32 config)
74 u32 field, l; 74 u32 field, l;
75 void __iomem *reg; 75 void __iomem *reg;
76 76
77 reg = IOMUXSW_PAD_CTL + (pin + 2) / 3; 77 pin &= IOMUX_PADNUM_MASK;
78 reg = IOMUXSW_PAD_CTL + (pin + 2) / 3 * 4;
78 field = (pin + 2) % 3; 79 field = (pin + 2) % 3;
79 80
80 pr_debug("%s: reg offset = 0x%x field = %d\n", 81 pr_debug("%s: reg offset = 0x%x, field = %d\n",
81 __func__, (pin + 2) / 3, field); 82 __func__, (pin + 2) / 3, field);
82 83
83 spin_lock(&gpio_mux_lock); 84 spin_lock(&gpio_mux_lock);
84 85
85 l = __raw_readl(reg); 86 l = __raw_readl(reg);
86 l &= ~(0x1ff << (field * 9)); 87 l &= ~(0x1ff << (field * 10));
87 l |= config << (field * 9); 88 l |= config << (field * 10);
88 __raw_writel(l, reg); 89 __raw_writel(l, reg);
89 90
90 spin_unlock(&gpio_mux_lock); 91 spin_unlock(&gpio_mux_lock);
diff --git a/arch/arm/mach-mx3/mx31moboard.c b/arch/arm/mach-mx3/mx31moboard.c
new file mode 100644
index 000000000000..c29098af7394
--- /dev/null
+++ b/arch/arm/mach-mx3/mx31moboard.c
@@ -0,0 +1,141 @@
1/*
2 * Copyright (C) 2008 Valentin Longchamp, EPFL Mobots group
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/mtd/partitions.h>
25#include <linux/memory.h>
26
27#include <mach/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 <mach/common.h>
33#include <mach/imx-uart.h>
34#include <mach/iomux-mx3.h>
35
36#include "devices.h"
37
38static struct physmap_flash_data mx31moboard_flash_data = {
39 .width = 2,
40};
41
42static struct resource mx31moboard_flash_resource = {
43 .start = 0xa0000000,
44 .end = 0xa1ffffff,
45 .flags = IORESOURCE_MEM,
46};
47
48static struct platform_device mx31moboard_flash = {
49 .name = "physmap-flash",
50 .id = 0,
51 .dev = {
52 .platform_data = &mx31moboard_flash_data,
53 },
54 .resource = &mx31moboard_flash_resource,
55 .num_resources = 1,
56};
57
58static struct imxuart_platform_data uart_pdata = {
59 .flags = IMXUART_HAVE_RTSCTS,
60};
61
62static struct platform_device *devices[] __initdata = {
63 &mx31moboard_flash,
64};
65
66/*
67 * Board specific initialization.
68 */
69static void __init mxc_board_init(void)
70{
71 platform_add_devices(devices, ARRAY_SIZE(devices));
72
73 mxc_iomux_mode(MX31_PIN_CTS1__CTS1);
74 mxc_iomux_mode(MX31_PIN_RTS1__RTS1);
75 mxc_iomux_mode(MX31_PIN_TXD1__TXD1);
76 mxc_iomux_mode(MX31_PIN_RXD1__RXD1);
77
78 mxc_register_device(&mxc_uart_device0, &uart_pdata);
79
80 mxc_iomux_mode(MX31_PIN_CTS2__CTS2);
81 mxc_iomux_mode(MX31_PIN_RTS2__RTS2);
82 mxc_iomux_mode(MX31_PIN_TXD2__TXD2);
83 mxc_iomux_mode(MX31_PIN_RXD2__RXD2);
84
85 mxc_register_device(&mxc_uart_device1, &uart_pdata);
86
87 mxc_iomux_mode(MX31_PIN_PC_RST__CTS5);
88 mxc_iomux_mode(MX31_PIN_PC_VS2__RTS5);
89 mxc_iomux_mode(MX31_PIN_PC_BVD2__TXD5);
90 mxc_iomux_mode(MX31_PIN_PC_BVD1__RXD5);
91
92 mxc_register_device(&mxc_uart_device4, &uart_pdata);
93}
94
95/*
96 * This structure defines static mappings for the mx31moboard.
97 */
98static struct map_desc mx31moboard_io_desc[] __initdata = {
99 {
100 .virtual = AIPS1_BASE_ADDR_VIRT,
101 .pfn = __phys_to_pfn(AIPS1_BASE_ADDR),
102 .length = AIPS1_SIZE,
103 .type = MT_DEVICE_NONSHARED
104 }, {
105 .virtual = AIPS2_BASE_ADDR_VIRT,
106 .pfn = __phys_to_pfn(AIPS2_BASE_ADDR),
107 .length = AIPS2_SIZE,
108 .type = MT_DEVICE_NONSHARED
109 },
110};
111
112/*
113 * Set up static virtual mappings.
114 */
115void __init mx31moboard_map_io(void)
116{
117 mxc_map_io();
118 iotable_init(mx31moboard_io_desc, ARRAY_SIZE(mx31moboard_io_desc));
119}
120
121static void __init mx31moboard_timer_init(void)
122{
123 mxc_clocks_init(26000000);
124 mxc_timer_init("ipg_clk.0");
125}
126
127struct sys_timer mx31moboard_timer = {
128 .init = mx31moboard_timer_init,
129};
130
131MACHINE_START(MX31MOBOARD, "EPFL Mobots mx31moboard")
132 /* Maintainer: Valentin Longchamp, EPFL Mobots group */
133 .phys_io = AIPS1_BASE_ADDR,
134 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
135 .boot_params = PHYS_OFFSET + 0x100,
136 .map_io = mx31moboard_map_io,
137 .init_irq = mxc_init_irq,
138 .init_machine = mxc_board_init,
139 .timer = &mx31moboard_timer,
140MACHINE_END
141
diff --git a/arch/arm/mach-mx3/mx31pdk.c b/arch/arm/mach-mx3/mx31pdk.c
new file mode 100644
index 000000000000..d464d068a4a6
--- /dev/null
+++ b/arch/arm/mach-mx3/mx31pdk.c
@@ -0,0 +1,115 @@
1/*
2 * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved.
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#include <linux/clk.h>
22#include <linux/irq.h>
23
24#include <mach/hardware.h>
25#include <asm/mach-types.h>
26#include <asm/mach/arch.h>
27#include <asm/mach/time.h>
28#include <asm/memory.h>
29#include <asm/mach/map.h>
30#include <mach/common.h>
31#include <mach/board-mx31pdk.h>
32#include <mach/imx-uart.h>
33#include <mach/iomux-mx3.h>
34#include "devices.h"
35
36/*!
37 * @file mx31pdk.c
38 *
39 * @brief This file contains the board-specific initialization routines.
40 *
41 * @ingroup System
42 */
43
44static struct imxuart_platform_data uart_pdata = {
45 .flags = IMXUART_HAVE_RTSCTS,
46};
47
48static inline void mxc_init_imx_uart(void)
49{
50 mxc_iomux_mode(MX31_PIN_CTS1__CTS1);
51 mxc_iomux_mode(MX31_PIN_RTS1__RTS1);
52 mxc_iomux_mode(MX31_PIN_TXD1__TXD1);
53 mxc_iomux_mode(MX31_PIN_RXD1__RXD1);
54
55 mxc_register_device(&mxc_uart_device0, &uart_pdata);
56}
57
58/*!
59 * This structure defines static mappings for the i.MX31PDK board.
60 */
61static struct map_desc mx31pdk_io_desc[] __initdata = {
62 {
63 .virtual = AIPS1_BASE_ADDR_VIRT,
64 .pfn = __phys_to_pfn(AIPS1_BASE_ADDR),
65 .length = AIPS1_SIZE,
66 .type = MT_DEVICE_NONSHARED
67 }, {
68 .virtual = AIPS2_BASE_ADDR_VIRT,
69 .pfn = __phys_to_pfn(AIPS2_BASE_ADDR),
70 .length = AIPS2_SIZE,
71 .type = MT_DEVICE_NONSHARED
72 },
73};
74
75/*!
76 * Set up static virtual mappings.
77 */
78static void __init mx31pdk_map_io(void)
79{
80 mxc_map_io();
81 iotable_init(mx31pdk_io_desc, ARRAY_SIZE(mx31pdk_io_desc));
82}
83
84/*!
85 * Board specific initialization.
86 */
87static void __init mxc_board_init(void)
88{
89 mxc_init_imx_uart();
90}
91
92static void __init mx31pdk_timer_init(void)
93{
94 mxc_clocks_init(26000000);
95 mxc_timer_init("ipg_clk.0");
96}
97
98static struct sys_timer mx31pdk_timer = {
99 .init = mx31pdk_timer_init,
100};
101
102/*
103 * The following uses standard kernel macros defined in arch.h in order to
104 * initialize __mach_desc_MX31PDK data structure.
105 */
106MACHINE_START(MX31_3DS, "Freescale MX31PDK (3DS)")
107 /* Maintainer: Freescale Semiconductor, Inc. */
108 .phys_io = AIPS1_BASE_ADDR,
109 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
110 .boot_params = PHYS_OFFSET + 0x100,
111 .map_io = mx31pdk_map_io,
112 .init_irq = mxc_init_irq,
113 .init_machine = mxc_board_init,
114 .timer = &mx31pdk_timer,
115MACHINE_END
diff --git a/arch/arm/mach-mx3/pcm037.c b/arch/arm/mach-mx3/pcm037.c
index 843f68c8ead1..8cea82587222 100644
--- a/arch/arm/mach-mx3/pcm037.c
+++ b/arch/arm/mach-mx3/pcm037.c
@@ -21,7 +21,11 @@
21 21
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/mtd/physmap.h> 23#include <linux/mtd/physmap.h>
24#include <linux/mtd/plat-ram.h>
24#include <linux/memory.h> 25#include <linux/memory.h>
26#include <linux/gpio.h>
27#include <linux/smc911x.h>
28#include <linux/interrupt.h>
25 29
26#include <mach/hardware.h> 30#include <mach/hardware.h>
27#include <asm/mach-types.h> 31#include <asm/mach-types.h>
@@ -32,6 +36,7 @@
32#include <mach/imx-uart.h> 36#include <mach/imx-uart.h>
33#include <mach/iomux-mx3.h> 37#include <mach/iomux-mx3.h>
34#include <mach/board-pcm037.h> 38#include <mach/board-pcm037.h>
39#include <mach/mxc_nand.h>
35 40
36#include "devices.h" 41#include "devices.h"
37 42
@@ -59,8 +64,63 @@ static struct imxuart_platform_data uart_pdata = {
59 .flags = IMXUART_HAVE_RTSCTS, 64 .flags = IMXUART_HAVE_RTSCTS,
60}; 65};
61 66
67static struct resource smc911x_resources[] = {
68 [0] = {
69 .start = CS1_BASE_ADDR + 0x300,
70 .end = CS1_BASE_ADDR + 0x300 + SZ_64K - 1,
71 .flags = IORESOURCE_MEM,
72 },
73 [1] = {
74 .start = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1),
75 .end = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1),
76 .flags = IORESOURCE_IRQ,
77 },
78};
79
80static struct smc911x_platdata smc911x_info = {
81 .flags = SMC911X_USE_32BIT,
82 .irq_flags = IRQF_SHARED | IRQF_TRIGGER_LOW,
83};
84
85static struct platform_device pcm037_eth = {
86 .name = "smc911x",
87 .id = -1,
88 .num_resources = ARRAY_SIZE(smc911x_resources),
89 .resource = smc911x_resources,
90 .dev = {
91 .platform_data = &smc911x_info,
92 },
93};
94
95static struct platdata_mtd_ram pcm038_sram_data = {
96 .bankwidth = 2,
97};
98
99static struct resource pcm038_sram_resource = {
100 .start = CS4_BASE_ADDR,
101 .end = CS4_BASE_ADDR + 512 * 1024 - 1,
102 .flags = IORESOURCE_MEM,
103};
104
105static struct platform_device pcm037_sram_device = {
106 .name = "mtd-ram",
107 .id = 0,
108 .dev = {
109 .platform_data = &pcm038_sram_data,
110 },
111 .num_resources = 1,
112 .resource = &pcm038_sram_resource,
113};
114
115static struct mxc_nand_platform_data pcm037_nand_board_info = {
116 .width = 1,
117 .hw_ecc = 1,
118};
119
62static struct platform_device *devices[] __initdata = { 120static struct platform_device *devices[] __initdata = {
63 &pcm037_flash, 121 &pcm037_flash,
122 &pcm037_eth,
123 &pcm037_sram_device,
64}; 124};
65 125
66/* 126/*
@@ -81,6 +141,16 @@ static void __init mxc_board_init(void)
81 mxc_iomux_mode(MX31_PIN_CSPI3_MISO__TXD3); 141 mxc_iomux_mode(MX31_PIN_CSPI3_MISO__TXD3);
82 142
83 mxc_register_device(&mxc_uart_device2, &uart_pdata); 143 mxc_register_device(&mxc_uart_device2, &uart_pdata);
144
145 mxc_iomux_mode(MX31_PIN_BATT_LINE__OWIRE);
146 mxc_register_device(&mxc_w1_master_device, NULL);
147
148 /* SMSC9215 IRQ pin */
149 mxc_iomux_mode(IOMUX_MODE(MX31_PIN_GPIO3_1, IOMUX_CONFIG_GPIO));
150 if (!gpio_request(MX31_PIN_GPIO3_1, "pcm037-eth"))
151 gpio_direction_input(MX31_PIN_GPIO3_1);
152
153 mxc_register_device(&mxc_nand_device, &pcm037_nand_board_info);
84} 154}
85 155
86/* 156/*
diff --git a/arch/arm/mach-netx/fb.c b/arch/arm/mach-netx/fb.c
index 24c79650f9f3..ea8fa8898fe8 100644
--- a/arch/arm/mach-netx/fb.c
+++ b/arch/arm/mach-netx/fb.c
@@ -22,14 +22,11 @@
22#include <linux/dma-mapping.h> 22#include <linux/dma-mapping.h>
23#include <linux/amba/bus.h> 23#include <linux/amba/bus.h>
24#include <linux/amba/clcd.h> 24#include <linux/amba/clcd.h>
25#include <linux/err.h>
25 26
26#include <mach/netx-regs.h> 27#include <mach/netx-regs.h>
27#include <mach/hardware.h> 28#include <mach/hardware.h>
28 29
29struct clk {};
30
31static struct clk fb_clk;
32
33static struct clcd_panel *netx_panel; 30static struct clcd_panel *netx_panel;
34 31
35void netx_clcd_enable(struct clcd_fb *fb) 32void netx_clcd_enable(struct clcd_fb *fb)
@@ -85,7 +82,7 @@ int clk_enable(struct clk *clk)
85 82
86struct clk *clk_get(struct device *dev, const char *id) 83struct clk *clk_get(struct device *dev, const char *id)
87{ 84{
88 return &fb_clk; 85 return dev && strcmp(dev_name(dev), "fb") == 0 ? NULL : ERR_PTR(-ENOENT);
89} 86}
90 87
91void clk_put(struct clk *clk) 88void clk_put(struct clk *clk)
@@ -94,7 +91,7 @@ void clk_put(struct clk *clk)
94 91
95static struct amba_device fb_device = { 92static struct amba_device fb_device = {
96 .dev = { 93 .dev = {
97 .bus_id = "fb", 94 .init_name = "fb",
98 .coherent_dma_mask = ~0, 95 .coherent_dma_mask = ~0,
99 }, 96 },
100 .res = { 97 .res = {
diff --git a/arch/arm/mach-netx/include/mach/dma.h b/arch/arm/mach-netx/include/mach/dma.h
deleted file mode 100644
index 690b3ebc43ac..000000000000
--- a/arch/arm/mach-netx/include/mach/dma.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * arch/arm/mach-netx/include/mach/dma.h
3 *
4 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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
8 * as published 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#define MAX_DMA_CHANNELS 0
21#define MAX_DMA_ADDRESS ~0
diff --git a/arch/arm/mach-netx/include/mach/io.h b/arch/arm/mach-netx/include/mach/io.h
index 468b92a82585..c3921cb3b6a6 100644
--- a/arch/arm/mach-netx/include/mach/io.h
+++ b/arch/arm/mach-netx/include/mach/io.h
@@ -22,7 +22,7 @@
22 22
23#define IO_SPACE_LIMIT 0xffffffff 23#define IO_SPACE_LIMIT 0xffffffff
24 24
25#define __io(a) ((void __iomem *)(a)) 25#define __io(a) __typesafe_io(a)
26#define __mem_pci(a) (a) 26#define __mem_pci(a) (a)
27 27
28#endif 28#endif
diff --git a/arch/arm/mach-netx/include/mach/memory.h b/arch/arm/mach-netx/include/mach/memory.h
index 53745a1378de..9a363f297f90 100644
--- a/arch/arm/mach-netx/include/mach/memory.h
+++ b/arch/arm/mach-netx/include/mach/memory.h
@@ -22,15 +22,5 @@
22 22
23#define PHYS_OFFSET UL(0x80000000) 23#define PHYS_OFFSET UL(0x80000000)
24 24
25/*
26 * Virtual view <-> DMA view memory address translations
27 * virt_to_bus: Used to translate the virtual address to an
28 * address suitable to be passed to set_dma_addr
29 * bus_to_virt: Used to convert an address for DMA operations
30 * to an address that the kernel can use.
31 */
32#define __virt_to_bus(x) __virt_to_phys(x)
33#define __bus_to_virt(x) __phys_to_virt(x)
34
35#endif 25#endif
36 26
diff --git a/arch/arm/mach-netx/include/mach/netx-regs.h b/arch/arm/mach-netx/include/mach/netx-regs.h
index 5104a00d40f4..08c60ff227be 100644
--- a/arch/arm/mach-netx/include/mach/netx-regs.h
+++ b/arch/arm/mach-netx/include/mach/netx-regs.h
@@ -328,6 +328,28 @@
328#define NETX_PFIFO_FILL_LEVEL(pfifo) NETX_PFIFO_REG(0x180 + ((pfifo)<<2)) 328#define NETX_PFIFO_FILL_LEVEL(pfifo) NETX_PFIFO_REG(0x180 + ((pfifo)<<2))
329#define NETX_PFIFO_XPEC_ISR(xpec) NETX_PFIFO_REG(0x400 + ((xpec) << 2)) 329#define NETX_PFIFO_XPEC_ISR(xpec) NETX_PFIFO_REG(0x400 + ((xpec) << 2))
330 330
331
332/*******************************
333 * Memory Controller *
334 *******************************/
335
336/* Registers */
337#define NETX_MEMCR_REG(ofs) __io(NETX_VA_MEMCR + (ofs))
338#define NETX_MEMCR_SRAM_CTRL(cs) NETX_MEMCR_REG(0x0 + 4 * (cs)) /* SRAM for CS 0..2 */
339#define NETX_MEMCR_SDRAM_CFG_CTRL NETX_MEMCR_REG(0x40)
340#define NETX_MEMCR_SDRAM_TIMING_CTRL NETX_MEMCR_REG(0x44)
341#define NETX_MEMCR_SDRAM_MODE NETX_MEMCR_REG(0x48)
342#define NETX_MEMCR_SDRAM_EXT_MODE NETX_MEMCR_REG(0x4c)
343#define NETX_MEMCR_PRIO_TIMESLOT_CTRL NETX_MEMCR_REG(0x80)
344#define NETX_MEMCR_PRIO_ACCESS_CTRL NETX_MEMCR_REG(0x84)
345
346/* Bits */
347#define NETX_MEMCR_SRAM_CTRL_WIDTHEXTMEM(x) (((x) & 0x3) << 24)
348#define NETX_MEMCR_SRAM_CTRL_WSPOSTPAUSEEXTMEM(x) (((x) & 0x3) << 16)
349#define NETX_MEMCR_SRAM_CTRL_WSPREPASEEXTMEM(x) (((x) & 0x3) << 8)
350#define NETX_MEMCR_SRAM_CTRL_WSEXTMEM(x) (((x) & 0x1f) << 0)
351
352
331/******************************* 353/*******************************
332 * Dual Port Memory * 354 * Dual Port Memory *
333 *******************************/ 355 *******************************/
diff --git a/arch/arm/mach-netx/time.c b/arch/arm/mach-netx/time.c
index 7c540c1f01fa..d51d627ce7cf 100644
--- a/arch/arm/mach-netx/time.c
+++ b/arch/arm/mach-netx/time.c
@@ -21,43 +21,100 @@
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/irq.h> 22#include <linux/irq.h>
23#include <linux/clocksource.h> 23#include <linux/clocksource.h>
24#include <linux/clockchips.h>
24#include <linux/io.h> 25#include <linux/io.h>
25 26
26#include <mach/hardware.h> 27#include <mach/hardware.h>
27#include <asm/mach/time.h> 28#include <asm/mach/time.h>
28#include <mach/netx-regs.h> 29#include <mach/netx-regs.h>
29 30
31#define TIMER_CLOCKEVENT 0
32#define TIMER_CLOCKSOURCE 1
33
34static void netx_set_mode(enum clock_event_mode mode,
35 struct clock_event_device *clk)
36{
37 u32 tmode;
38
39 /* disable timer */
40 writel(0, NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKEVENT));
41
42 switch (mode) {
43 case CLOCK_EVT_MODE_PERIODIC:
44 writel(LATCH, NETX_GPIO_COUNTER_MAX(TIMER_CLOCKEVENT));
45 tmode = NETX_GPIO_COUNTER_CTRL_RST_EN |
46 NETX_GPIO_COUNTER_CTRL_IRQ_EN |
47 NETX_GPIO_COUNTER_CTRL_RUN;
48 break;
49
50 case CLOCK_EVT_MODE_ONESHOT:
51 writel(0, NETX_GPIO_COUNTER_MAX(TIMER_CLOCKEVENT));
52 tmode = NETX_GPIO_COUNTER_CTRL_IRQ_EN |
53 NETX_GPIO_COUNTER_CTRL_RUN;
54 break;
55
56 default:
57 WARN(1, "%s: unhandled mode %d\n", __func__, mode);
58 /* fall through */
59
60 case CLOCK_EVT_MODE_SHUTDOWN:
61 case CLOCK_EVT_MODE_UNUSED:
62 case CLOCK_EVT_MODE_RESUME:
63 tmode = 0;
64 break;
65 }
66
67 writel(tmode, NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKEVENT));
68}
69
70static int netx_set_next_event(unsigned long evt,
71 struct clock_event_device *clk)
72{
73 writel(0 - evt, NETX_GPIO_COUNTER_CURRENT(TIMER_CLOCKEVENT));
74 return 0;
75}
76
77static struct clock_event_device netx_clockevent = {
78 .name = "netx-timer" __stringify(TIMER_CLOCKEVENT),
79 .shift = 32,
80 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
81 .set_next_event = netx_set_next_event,
82 .set_mode = netx_set_mode,
83};
84
30/* 85/*
31 * IRQ handler for the timer 86 * IRQ handler for the timer
32 */ 87 */
33static irqreturn_t 88static irqreturn_t
34netx_timer_interrupt(int irq, void *dev_id) 89netx_timer_interrupt(int irq, void *dev_id)
35{ 90{
36 timer_tick(); 91 struct clock_event_device *evt = &netx_clockevent;
37 92
38 /* acknowledge interrupt */ 93 /* acknowledge interrupt */
39 writel(COUNTER_BIT(0), NETX_GPIO_IRQ); 94 writel(COUNTER_BIT(0), NETX_GPIO_IRQ);
40 95
96 evt->event_handler(evt);
97
41 return IRQ_HANDLED; 98 return IRQ_HANDLED;
42} 99}
43 100
44static struct irqaction netx_timer_irq = { 101static struct irqaction netx_timer_irq = {
45 .name = "NetX Timer Tick", 102 .name = "NetX Timer Tick",
46 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 103 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
47 .handler = netx_timer_interrupt, 104 .handler = netx_timer_interrupt,
48}; 105};
49 106
50cycle_t netx_get_cycles(void) 107cycle_t netx_get_cycles(void)
51{ 108{
52 return readl(NETX_GPIO_COUNTER_CURRENT(1)); 109 return readl(NETX_GPIO_COUNTER_CURRENT(TIMER_CLOCKSOURCE));
53} 110}
54 111
55static struct clocksource clocksource_netx = { 112static struct clocksource clocksource_netx = {
56 .name = "netx_timer", 113 .name = "netx_timer",
57 .rating = 200, 114 .rating = 200,
58 .read = netx_get_cycles, 115 .read = netx_get_cycles,
59 .mask = CLOCKSOURCE_MASK(32), 116 .mask = CLOCKSOURCE_MASK(32),
60 .shift = 20, 117 .shift = 20,
61 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 118 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
62}; 119};
63 120
@@ -77,24 +134,37 @@ static void __init netx_timer_init(void)
77 /* acknowledge interrupt */ 134 /* acknowledge interrupt */
78 writel(COUNTER_BIT(0), NETX_GPIO_IRQ); 135 writel(COUNTER_BIT(0), NETX_GPIO_IRQ);
79 136
80 /* Enable the interrupt in the specific timer register and start timer */ 137 /* Enable the interrupt in the specific timer
138 * register and start timer
139 */
81 writel(COUNTER_BIT(0), NETX_GPIO_IRQ_ENABLE); 140 writel(COUNTER_BIT(0), NETX_GPIO_IRQ_ENABLE);
82 writel(NETX_GPIO_COUNTER_CTRL_IRQ_EN | NETX_GPIO_COUNTER_CTRL_RUN, 141 writel(NETX_GPIO_COUNTER_CTRL_IRQ_EN | NETX_GPIO_COUNTER_CTRL_RUN,
83 NETX_GPIO_COUNTER_CTRL(0)); 142 NETX_GPIO_COUNTER_CTRL(0));
84 143
85 setup_irq(NETX_IRQ_TIMER0, &netx_timer_irq); 144 setup_irq(NETX_IRQ_TIMER0, &netx_timer_irq);
86 145
87 /* Setup timer one for clocksource */ 146 /* Setup timer one for clocksource */
88 writel(0, NETX_GPIO_COUNTER_CTRL(1)); 147 writel(0, NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKSOURCE));
89 writel(0, NETX_GPIO_COUNTER_CURRENT(1)); 148 writel(0, NETX_GPIO_COUNTER_CURRENT(TIMER_CLOCKSOURCE));
90 writel(0xFFFFFFFF, NETX_GPIO_COUNTER_MAX(1)); 149 writel(0xffffffff, NETX_GPIO_COUNTER_MAX(TIMER_CLOCKSOURCE));
91 150
92 writel(NETX_GPIO_COUNTER_CTRL_RUN, 151 writel(NETX_GPIO_COUNTER_CTRL_RUN,
93 NETX_GPIO_COUNTER_CTRL(1)); 152 NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKSOURCE));
94 153
95 clocksource_netx.mult = 154 clocksource_netx.mult =
96 clocksource_hz2mult(CLOCK_TICK_RATE, clocksource_netx.shift); 155 clocksource_hz2mult(CLOCK_TICK_RATE, clocksource_netx.shift);
97 clocksource_register(&clocksource_netx); 156 clocksource_register(&clocksource_netx);
157
158 netx_clockevent.mult = div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC,
159 netx_clockevent.shift);
160 netx_clockevent.max_delta_ns =
161 clockevent_delta2ns(0xfffffffe, &netx_clockevent);
162 /* with max_delta_ns >= delta2ns(0x800) the system currently runs fine.
163 * Adding some safety ... */
164 netx_clockevent.min_delta_ns =
165 clockevent_delta2ns(0xa00, &netx_clockevent);
166 netx_clockevent.cpumask = cpumask_of_cpu(0);
167 clockevents_register_device(&netx_clockevent);
98} 168}
99 169
100struct sys_timer netx_timer = { 170struct sys_timer netx_timer = {
diff --git a/arch/arm/mach-netx/xc.c b/arch/arm/mach-netx/xc.c
index 32eabf5dfa4f..8fc6205dc3a5 100644
--- a/arch/arm/mach-netx/xc.c
+++ b/arch/arm/mach-netx/xc.c
@@ -92,10 +92,10 @@ static int xc_check_ptr(struct xc *x, unsigned long adr, unsigned int size)
92 return -1; 92 return -1;
93} 93}
94 94
95static int xc_patch(struct xc *x, void *patch, int count) 95static int xc_patch(struct xc *x, const void *patch, int count)
96{ 96{
97 unsigned int val, adr; 97 unsigned int val, adr;
98 unsigned int *data = patch; 98 const unsigned int *data = patch;
99 99
100 int i; 100 int i;
101 for (i = 0; i < count; i++) { 101 for (i = 0; i < count; i++) {
@@ -117,7 +117,7 @@ int xc_request_firmware(struct xc *x)
117 struct fw_header *head; 117 struct fw_header *head;
118 unsigned int size; 118 unsigned int size;
119 int i; 119 int i;
120 void *src; 120 const void *src;
121 unsigned long dst; 121 unsigned long dst;
122 122
123 sprintf(name, "xc%d.bin", x->no); 123 sprintf(name, "xc%d.bin", x->no);
diff --git a/arch/arm/mach-ns9xxx/include/mach/dma.h b/arch/arm/mach-ns9xxx/include/mach/dma.h
deleted file mode 100644
index 3f50d8c9e5c7..000000000000
--- a/arch/arm/mach-ns9xxx/include/mach/dma.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/dma.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_DMA_H
12#define __ASM_ARCH_DMA_H
13
14#endif /* ifndef __ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-ns9xxx/include/mach/hardware.h b/arch/arm/mach-ns9xxx/include/mach/hardware.h
index 6dbb2030f563..76631128e11c 100644
--- a/arch/arm/mach-ns9xxx/include/mach/hardware.h
+++ b/arch/arm/mach-ns9xxx/include/mach/hardware.h
@@ -11,8 +11,6 @@
11#ifndef __ASM_ARCH_HARDWARE_H 11#ifndef __ASM_ARCH_HARDWARE_H
12#define __ASM_ARCH_HARDWARE_H 12#define __ASM_ARCH_HARDWARE_H
13 13
14#include <asm/memory.h>
15
16/* 14/*
17 * NetSilicon NS9xxx internal mapping: 15 * NetSilicon NS9xxx internal mapping:
18 * 16 *
diff --git a/arch/arm/mach-ns9xxx/include/mach/io.h b/arch/arm/mach-ns9xxx/include/mach/io.h
index 027bf649645a..f08451d2e1bc 100644
--- a/arch/arm/mach-ns9xxx/include/mach/io.h
+++ b/arch/arm/mach-ns9xxx/include/mach/io.h
@@ -13,7 +13,7 @@
13 13
14#define IO_SPACE_LIMIT 0xffffffff /* XXX */ 14#define IO_SPACE_LIMIT 0xffffffff /* XXX */
15 15
16#define __io(a) ((void __iomem *)(a)) 16#define __io(a) __typesafe_io(a)
17#define __mem_pci(a) (a) 17#define __mem_pci(a) (a)
18#define __mem_isa(a) (IO_BASE + (a)) 18#define __mem_isa(a) (IO_BASE + (a))
19 19
diff --git a/arch/arm/mach-ns9xxx/include/mach/memory.h b/arch/arm/mach-ns9xxx/include/mach/memory.h
index 649ee6235b94..6107193adbfe 100644
--- a/arch/arm/mach-ns9xxx/include/mach/memory.h
+++ b/arch/arm/mach-ns9xxx/include/mach/memory.h
@@ -21,7 +21,4 @@
21 21
22#define PHYS_OFFSET UL(0x00000000) 22#define PHYS_OFFSET UL(0x00000000)
23 23
24#define __virt_to_bus(x) __virt_to_phys(x)
25#define __bus_to_virt(x) __phys_to_virt(x)
26
27#endif 24#endif
diff --git a/arch/arm/mach-ns9xxx/time-ns9360.c b/arch/arm/mach-ns9xxx/time-ns9360.c
index a63424d083d9..41df69721769 100644
--- a/arch/arm/mach-ns9xxx/time-ns9360.c
+++ b/arch/arm/mach-ns9xxx/time-ns9360.c
@@ -173,7 +173,7 @@ static void __init ns9360_timer_init(void)
173 ns9360_clockevent_device.min_delta_ns = 173 ns9360_clockevent_device.min_delta_ns =
174 clockevent_delta2ns(1, &ns9360_clockevent_device); 174 clockevent_delta2ns(1, &ns9360_clockevent_device);
175 175
176 ns9360_clockevent_device.cpumask = cpumask_of_cpu(0); 176 ns9360_clockevent_device.cpumask = cpumask_of(0);
177 clockevents_register_device(&ns9360_clockevent_device); 177 clockevents_register_device(&ns9360_clockevent_device);
178 178
179 setup_irq(IRQ_NS9360_TIMER0 + TIMER_CLOCKEVENT, 179 setup_irq(IRQ_NS9360_TIMER0 + TIMER_CLOCKEVENT,
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
index 79f0b1f8497b..10a301e32434 100644
--- a/arch/arm/mach-omap1/Kconfig
+++ b/arch/arm/mach-omap1/Kconfig
@@ -4,16 +4,19 @@ comment "OMAP Core Type"
4config ARCH_OMAP730 4config ARCH_OMAP730
5 depends on ARCH_OMAP1 5 depends on ARCH_OMAP1
6 bool "OMAP730 Based System" 6 bool "OMAP730 Based System"
7 select CPU_ARM926T
7 select ARCH_OMAP_OTG 8 select ARCH_OMAP_OTG
8 9
9config ARCH_OMAP15XX 10config ARCH_OMAP15XX
10 depends on ARCH_OMAP1 11 depends on ARCH_OMAP1
11 default y 12 default y
12 bool "OMAP15xx Based System" 13 bool "OMAP15xx Based System"
14 select CPU_ARM925T
13 15
14config ARCH_OMAP16XX 16config ARCH_OMAP16XX
15 depends on ARCH_OMAP1 17 depends on ARCH_OMAP1
16 bool "OMAP16xx Based System" 18 bool "OMAP16xx Based System"
19 select CPU_ARM926T
17 select ARCH_OMAP_OTG 20 select ARCH_OMAP_OTG
18 21
19comment "OMAP Board Type" 22comment "OMAP Board Type"
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index db789461fca4..30308294e7c1 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -205,7 +205,7 @@ static struct platform_device *devices[] __initdata = {
205 205
206static int nand_dev_ready(struct omap_nand_platform_data *data) 206static int nand_dev_ready(struct omap_nand_platform_data *data)
207{ 207{
208 return omap_get_gpio_datain(P2_NAND_RB_GPIO_PIN); 208 return gpio_get_value(P2_NAND_RB_GPIO_PIN);
209} 209}
210 210
211static struct omap_uart_config fsample_uart_config __initdata = { 211static struct omap_uart_config fsample_uart_config __initdata = {
@@ -223,8 +223,9 @@ static struct omap_board_config_kernel fsample_config[] = {
223 223
224static void __init omap_fsample_init(void) 224static void __init omap_fsample_init(void)
225{ 225{
226 if (!(omap_request_gpio(P2_NAND_RB_GPIO_PIN))) 226 if (gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0)
227 nand_data.dev_ready = nand_dev_ready; 227 BUG();
228 nand_data.dev_ready = nand_dev_ready;
228 229
229 omap_cfg_reg(L3_1610_FLASH_CS2B_OE); 230 omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
230 omap_cfg_reg(M8_1610_FLASH_CS2B_WE); 231 omap_cfg_reg(M8_1610_FLASH_CS2B_WE);
diff --git a/arch/arm/mach-omap1/board-h2-mmc.c b/arch/arm/mach-omap1/board-h2-mmc.c
index ab9ee5820c48..409fa56d0a87 100644
--- a/arch/arm/mach-omap1/board-h2-mmc.c
+++ b/arch/arm/mach-omap1/board-h2-mmc.c
@@ -12,90 +12,68 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14
15#include <linux/platform_device.h>
16
17#include <linux/i2c/tps65010.h>
18
15#include <mach/mmc.h> 19#include <mach/mmc.h>
16#include <mach/gpio.h> 20#include <mach/gpio.h>
17 21
18#ifdef CONFIG_MMC_OMAP 22#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
19static int slot_cover_open;
20static struct device *mmc_device;
21 23
22static int h2_mmc_set_power(struct device *dev, int slot, int power_on, 24static int mmc_set_power(struct device *dev, int slot, int power_on,
23 int vdd) 25 int vdd)
24{ 26{
25#ifdef CONFIG_MMC_DEBUG 27 if (power_on)
26 dev_dbg(dev, "Set slot %d power: %s (vdd %d)\n", slot + 1, 28 gpio_direction_output(H2_TPS_GPIO_MMC_PWR_EN, 1);
27 power_on ? "on" : "off", vdd); 29 else
28#endif 30 gpio_direction_output(H2_TPS_GPIO_MMC_PWR_EN, 0);
29 if (slot != 0) {
30 dev_err(dev, "No such slot %d\n", slot + 1);
31 return -ENODEV;
32 }
33 31
34 return 0; 32 return 0;
35} 33}
36 34
37static int h2_mmc_set_bus_mode(struct device *dev, int slot, int bus_mode) 35static int mmc_late_init(struct device *dev)
38{ 36{
39#ifdef CONFIG_MMC_DEBUG 37 int ret;
40 dev_dbg(dev, "Set slot %d bus_mode %s\n", slot + 1,
41 bus_mode == MMC_BUSMODE_OPENDRAIN ? "open-drain" : "push-pull");
42#endif
43 if (slot != 0) {
44 dev_err(dev, "No such slot %d\n", slot + 1);
45 return -ENODEV;
46 }
47 38
48 return 0; 39 ret = gpio_request(H2_TPS_GPIO_MMC_PWR_EN, "MMC power");
49} 40 if (ret < 0)
41 return ret;
50 42
51static int h2_mmc_get_cover_state(struct device *dev, int slot) 43 gpio_direction_output(H2_TPS_GPIO_MMC_PWR_EN, 0);
52{
53 BUG_ON(slot != 0);
54
55 return slot_cover_open;
56}
57
58void h2_mmc_slot_cover_handler(void *arg, int state)
59{
60 if (mmc_device == NULL)
61 return;
62
63 slot_cover_open = state;
64 omap_mmc_notify_cover_event(mmc_device, 0, state);
65}
66
67static int h2_mmc_late_init(struct device *dev)
68{
69 int ret = 0;
70
71 mmc_device = dev;
72 44
73 return ret; 45 return ret;
74} 46}
75 47
76static void h2_mmc_cleanup(struct device *dev) 48static void mmc_shutdown(struct device *dev)
77{ 49{
50 gpio_free(H2_TPS_GPIO_MMC_PWR_EN);
78} 51}
79 52
80static struct omap_mmc_platform_data h2_mmc_data = { 53/*
54 * H2 could use the following functions tested:
55 * - mmc_get_cover_state that uses OMAP_MPUIO(1)
56 * - mmc_get_wp that uses OMAP_MPUIO(3)
57 */
58static struct omap_mmc_platform_data mmc1_data = {
81 .nr_slots = 1, 59 .nr_slots = 1,
82 .switch_slot = NULL, 60 .init = mmc_late_init,
83 .init = h2_mmc_late_init, 61 .shutdown = mmc_shutdown,
84 .cleanup = h2_mmc_cleanup, 62 .dma_mask = 0xffffffff,
85 .slots[0] = { 63 .slots[0] = {
86 .set_power = h2_mmc_set_power, 64 .set_power = mmc_set_power,
87 .set_bus_mode = h2_mmc_set_bus_mode,
88 .get_ro = NULL,
89 .get_cover_state = h2_mmc_get_cover_state,
90 .ocr_mask = MMC_VDD_28_29 | MMC_VDD_30_31 | 65 .ocr_mask = MMC_VDD_28_29 | MMC_VDD_30_31 |
91 MMC_VDD_32_33 | MMC_VDD_33_34, 66 MMC_VDD_32_33 | MMC_VDD_33_34,
92 .name = "mmcblk", 67 .name = "mmcblk",
93 }, 68 },
94}; 69};
95 70
71static struct omap_mmc_platform_data *mmc_data[OMAP16XX_NR_MMC];
72
96void __init h2_mmc_init(void) 73void __init h2_mmc_init(void)
97{ 74{
98 omap_set_mmc_info(1, &h2_mmc_data); 75 mmc_data[0] = &mmc1_data;
76 omap1_init_mmc(mmc_data, OMAP16XX_NR_MMC);
99} 77}
100 78
101#else 79#else
@@ -104,7 +82,4 @@ void __init h2_mmc_init(void)
104{ 82{
105} 83}
106 84
107void h2_mmc_slot_cover_handler(void *arg, int state)
108{
109}
110#endif 85#endif
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 3b65914b9141..b240c5f861da 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -250,11 +250,8 @@ static struct platform_device h2_kp_device = {
250#if defined(CONFIG_OMAP_IR) || defined(CONFIG_OMAP_IR_MODULE) 250#if defined(CONFIG_OMAP_IR) || defined(CONFIG_OMAP_IR_MODULE)
251static int h2_transceiver_mode(struct device *dev, int state) 251static int h2_transceiver_mode(struct device *dev, int state)
252{ 252{
253 if (state & IR_SIRMODE) 253 /* SIR when low, else MIR/FIR when HIGH */
254 omap_set_gpio_dataout(H2_IRDA_FIRSEL_GPIO_PIN, 0); 254 gpio_set_value(H2_IRDA_FIRSEL_GPIO_PIN, !(state & IR_SIRMODE));
255 else /* MIR/FIR */
256 omap_set_gpio_dataout(H2_IRDA_FIRSEL_GPIO_PIN, 1);
257
258 return 0; 255 return 0;
259} 256}
260#endif 257#endif
@@ -342,16 +339,31 @@ static struct platform_device *h2_devices[] __initdata = {
342 339
343static void __init h2_init_smc91x(void) 340static void __init h2_init_smc91x(void)
344{ 341{
345 if ((omap_request_gpio(0)) < 0) { 342 if (gpio_request(0, "SMC91x irq") < 0) {
346 printk("Error requesting gpio 0 for smc91x irq\n"); 343 printk("Error requesting gpio 0 for smc91x irq\n");
347 return; 344 return;
348 } 345 }
349} 346}
350 347
348static int tps_setup(struct i2c_client *client, void *context)
349{
350 tps65010_config_vregs1(TPS_LDO2_ENABLE | TPS_VLDO2_3_0V |
351 TPS_LDO1_ENABLE | TPS_VLDO1_3_0V);
352
353 return 0;
354}
355
356static struct tps65010_board tps_board = {
357 .base = H2_TPS_GPIO_BASE,
358 .outmask = 0x0f,
359 .setup = tps_setup,
360};
361
351static struct i2c_board_info __initdata h2_i2c_board_info[] = { 362static struct i2c_board_info __initdata h2_i2c_board_info[] = {
352 { 363 {
353 I2C_BOARD_INFO("tps65010", 0x48), 364 I2C_BOARD_INFO("tps65010", 0x48),
354 .irq = OMAP_GPIO_IRQ(58), 365 .irq = OMAP_GPIO_IRQ(58),
366 .platform_data = &tps_board,
355 }, { 367 }, {
356 I2C_BOARD_INFO("isp1301_omap", 0x2d), 368 I2C_BOARD_INFO("isp1301_omap", 0x2d),
357 .irq = OMAP_GPIO_IRQ(2), 369 .irq = OMAP_GPIO_IRQ(2),
@@ -381,15 +393,6 @@ static struct omap_usb_config h2_usb_config __initdata = {
381 .pins[1] = 3, 393 .pins[1] = 3,
382}; 394};
383 395
384static struct omap_mmc_config h2_mmc_config __initdata = {
385 .mmc[0] = {
386 .enabled = 1,
387 .wire4 = 1,
388 },
389};
390
391extern struct omap_mmc_platform_data h2_mmc_data;
392
393static struct omap_uart_config h2_uart_config __initdata = { 396static struct omap_uart_config h2_uart_config __initdata = {
394 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), 397 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
395}; 398};
@@ -400,7 +403,6 @@ static struct omap_lcd_config h2_lcd_config __initdata = {
400 403
401static struct omap_board_config_kernel h2_config[] __initdata = { 404static struct omap_board_config_kernel h2_config[] __initdata = {
402 { OMAP_TAG_USB, &h2_usb_config }, 405 { OMAP_TAG_USB, &h2_usb_config },
403 { OMAP_TAG_MMC, &h2_mmc_config },
404 { OMAP_TAG_UART, &h2_uart_config }, 406 { OMAP_TAG_UART, &h2_uart_config },
405 { OMAP_TAG_LCD, &h2_lcd_config }, 407 { OMAP_TAG_LCD, &h2_lcd_config },
406}; 408};
@@ -409,7 +411,7 @@ static struct omap_board_config_kernel h2_config[] __initdata = {
409 411
410static int h2_nand_dev_ready(struct omap_nand_platform_data *data) 412static int h2_nand_dev_ready(struct omap_nand_platform_data *data)
411{ 413{
412 return omap_get_gpio_datain(H2_NAND_RB_GPIO_PIN); 414 return gpio_get_value(H2_NAND_RB_GPIO_PIN);
413} 415}
414 416
415static void __init h2_init(void) 417static void __init h2_init(void)
@@ -428,8 +430,9 @@ static void __init h2_init(void)
428 430
429 h2_nand_resource.end = h2_nand_resource.start = OMAP_CS2B_PHYS; 431 h2_nand_resource.end = h2_nand_resource.start = OMAP_CS2B_PHYS;
430 h2_nand_resource.end += SZ_4K - 1; 432 h2_nand_resource.end += SZ_4K - 1;
431 if (!(omap_request_gpio(H2_NAND_RB_GPIO_PIN))) 433 if (gpio_request(H2_NAND_RB_GPIO_PIN, "NAND ready") < 0)
432 h2_nand_data.dev_ready = h2_nand_dev_ready; 434 BUG();
435 gpio_direction_input(H2_NAND_RB_GPIO_PIN);
433 436
434 omap_cfg_reg(L3_1610_FLASH_CS2B_OE); 437 omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
435 omap_cfg_reg(M8_1610_FLASH_CS2B_WE); 438 omap_cfg_reg(M8_1610_FLASH_CS2B_WE);
@@ -441,10 +444,10 @@ static void __init h2_init(void)
441 /* Irda */ 444 /* Irda */
442#if defined(CONFIG_OMAP_IR) || defined(CONFIG_OMAP_IR_MODULE) 445#if defined(CONFIG_OMAP_IR) || defined(CONFIG_OMAP_IR_MODULE)
443 omap_writel(omap_readl(FUNC_MUX_CTRL_A) | 7, FUNC_MUX_CTRL_A); 446 omap_writel(omap_readl(FUNC_MUX_CTRL_A) | 7, FUNC_MUX_CTRL_A);
444 if (!(omap_request_gpio(H2_IRDA_FIRSEL_GPIO_PIN))) { 447 if (gpio_request(H2_IRDA_FIRSEL_GPIO_PIN, "IRDA mode") < 0)
445 omap_set_gpio_direction(H2_IRDA_FIRSEL_GPIO_PIN, 0); 448 BUG();
446 h2_irda_data.transceiver_mode = h2_transceiver_mode; 449 gpio_direction_output(H2_IRDA_FIRSEL_GPIO_PIN, 0);
447 } 450 h2_irda_data.transceiver_mode = h2_transceiver_mode;
448#endif 451#endif
449 452
450 platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices)); 453 platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices));
diff --git a/arch/arm/mach-omap1/board-h3-mmc.c b/arch/arm/mach-omap1/board-h3-mmc.c
index 36085819098c..fdfe793d56f2 100644
--- a/arch/arm/mach-omap1/board-h3-mmc.c
+++ b/arch/arm/mach-omap1/board-h3-mmc.c
@@ -12,94 +12,55 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14
15#include <linux/platform_device.h>
16
17#include <linux/i2c/tps65010.h>
18
15#include <mach/mmc.h> 19#include <mach/mmc.h>
16#include <mach/gpio.h> 20#include <mach/gpio.h>
17 21
18#ifdef CONFIG_MMC_OMAP 22#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
19static int slot_cover_open;
20static struct device *mmc_device;
21 23
22static int h3_mmc_set_power(struct device *dev, int slot, int power_on, 24static int mmc_set_power(struct device *dev, int slot, int power_on,
23 int vdd) 25 int vdd)
24{ 26{
25#ifdef CONFIG_MMC_DEBUG 27 if (power_on)
26 dev_dbg(dev, "Set slot %d power: %s (vdd %d)\n", slot + 1, 28 gpio_direction_output(H3_TPS_GPIO_MMC_PWR_EN, 1);
27 power_on ? "on" : "off", vdd); 29 else
28#endif 30 gpio_direction_output(H3_TPS_GPIO_MMC_PWR_EN, 0);
29 if (slot != 0) {
30 dev_err(dev, "No such slot %d\n", slot + 1);
31 return -ENODEV;
32 }
33 31
34 return 0; 32 return 0;
35} 33}
36 34
37static int h3_mmc_set_bus_mode(struct device *dev, int slot, int bus_mode) 35/*
38{ 36 * H3 could use the following functions tested:
39 int ret = 0; 37 * - mmc_get_cover_state that uses OMAP_MPUIO(1)
40 38 * - mmc_get_wp that maybe uses OMAP_MPUIO(3)
41#ifdef CONFIG_MMC_DEBUG 39 */
42 dev_dbg(dev, "Set slot %d bus_mode %s\n", slot + 1, 40static struct omap_mmc_platform_data mmc1_data = {
43 bus_mode == MMC_BUSMODE_OPENDRAIN ? "open-drain" : "push-pull");
44#endif
45 if (slot != 0) {
46 dev_err(dev, "No such slot %d\n", slot + 1);
47 return -ENODEV;
48 }
49
50 /* Treated on upper level */
51
52 return bus_mode;
53}
54
55static int h3_mmc_get_cover_state(struct device *dev, int slot)
56{
57 BUG_ON(slot != 0);
58
59 return slot_cover_open;
60}
61
62void h3_mmc_slot_cover_handler(void *arg, int state)
63{
64 if (mmc_device == NULL)
65 return;
66
67 slot_cover_open = state;
68 omap_mmc_notify_cover_event(mmc_device, 0, state);
69}
70
71static int h3_mmc_late_init(struct device *dev)
72{
73 int ret = 0;
74
75 mmc_device = dev;
76
77 return ret;
78}
79
80static void h3_mmc_cleanup(struct device *dev)
81{
82}
83
84static struct omap_mmc_platform_data h3_mmc_data = {
85 .nr_slots = 1, 41 .nr_slots = 1,
86 .switch_slot = NULL, 42 .dma_mask = 0xffffffff,
87 .init = h3_mmc_late_init,
88 .cleanup = h3_mmc_cleanup,
89 .slots[0] = { 43 .slots[0] = {
90 .set_power = h3_mmc_set_power, 44 .set_power = mmc_set_power,
91 .set_bus_mode = h3_mmc_set_bus_mode,
92 .get_ro = NULL,
93 .get_cover_state = h3_mmc_get_cover_state,
94 .ocr_mask = MMC_VDD_28_29 | MMC_VDD_30_31 | 45 .ocr_mask = MMC_VDD_28_29 | MMC_VDD_30_31 |
95 MMC_VDD_32_33 | MMC_VDD_33_34, 46 MMC_VDD_32_33 | MMC_VDD_33_34,
96 .name = "mmcblk", 47 .name = "mmcblk",
97 }, 48 },
98}; 49};
99 50
51static struct omap_mmc_platform_data *mmc_data[OMAP16XX_NR_MMC];
52
100void __init h3_mmc_init(void) 53void __init h3_mmc_init(void)
101{ 54{
102 omap_set_mmc_info(1, &h3_mmc_data); 55 int ret;
56
57 ret = gpio_request(H3_TPS_GPIO_MMC_PWR_EN, "MMC power");
58 if (ret < 0)
59 return;
60 gpio_direction_output(H3_TPS_GPIO_MMC_PWR_EN, 0);
61
62 mmc_data[0] = &mmc1_data;
63 omap1_init_mmc(mmc_data, OMAP16XX_NR_MMC);
103} 64}
104 65
105#else 66#else
@@ -108,7 +69,4 @@ void __init h3_mmc_init(void)
108{ 69{
109} 70}
110 71
111void h3_mmc_slot_cover_handler(void *arg, int state)
112{
113}
114#endif 72#endif
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index adfcd7b51393..5157eea9be35 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -447,15 +447,6 @@ static struct omap_usb_config h3_usb_config __initdata = {
447 .pins[1] = 3, 447 .pins[1] = 3,
448}; 448};
449 449
450static struct omap_mmc_config h3_mmc_config __initdata = {
451 .mmc[0] = {
452 .enabled = 1,
453 .wire4 = 1,
454 },
455};
456
457extern struct omap_mmc_platform_data h3_mmc_data;
458
459static struct omap_uart_config h3_uart_config __initdata = { 450static struct omap_uart_config h3_uart_config __initdata = {
460 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), 451 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
461}; 452};
@@ -466,7 +457,6 @@ static struct omap_lcd_config h3_lcd_config __initdata = {
466 457
467static struct omap_board_config_kernel h3_config[] __initdata = { 458static struct omap_board_config_kernel h3_config[] __initdata = {
468 { OMAP_TAG_USB, &h3_usb_config }, 459 { OMAP_TAG_USB, &h3_usb_config },
469 { OMAP_TAG_MMC, &h3_mmc_config },
470 { OMAP_TAG_UART, &h3_uart_config }, 460 { OMAP_TAG_UART, &h3_uart_config },
471 { OMAP_TAG_LCD, &h3_lcd_config }, 461 { OMAP_TAG_LCD, &h3_lcd_config },
472}; 462};
@@ -498,7 +488,7 @@ static struct omap_gpio_switch h3_gpio_switches[] __initdata = {
498 488
499static int nand_dev_ready(struct omap_nand_platform_data *data) 489static int nand_dev_ready(struct omap_nand_platform_data *data)
500{ 490{
501 return omap_get_gpio_datain(H3_NAND_RB_GPIO_PIN); 491 return gpio_get_value(H3_NAND_RB_GPIO_PIN);
502} 492}
503 493
504static void __init h3_init(void) 494static void __init h3_init(void)
@@ -516,8 +506,9 @@ static void __init h3_init(void)
516 506
517 nand_resource.end = nand_resource.start = OMAP_CS2B_PHYS; 507 nand_resource.end = nand_resource.start = OMAP_CS2B_PHYS;
518 nand_resource.end += SZ_4K - 1; 508 nand_resource.end += SZ_4K - 1;
519 if (!(omap_request_gpio(H3_NAND_RB_GPIO_PIN))) 509 if (gpio_request(H3_NAND_RB_GPIO_PIN, "NAND ready") < 0)
520 nand_data.dev_ready = nand_dev_ready; 510 BUG();
511 nand_data.dev_ready = nand_dev_ready;
521 512
522 /* GPIO10 Func_MUX_CTRL reg bit 29:27, Configure V2 to mode1 as GPIO */ 513 /* GPIO10 Func_MUX_CTRL reg bit 29:27, Configure V2 to mode1 as GPIO */
523 /* GPIO10 pullup/down register, Enable pullup on GPIO10 */ 514 /* GPIO10 pullup/down register, Enable pullup on GPIO10 */
@@ -537,7 +528,7 @@ static void __init h3_init(void)
537static void __init h3_init_smc91x(void) 528static void __init h3_init_smc91x(void)
538{ 529{
539 omap_cfg_reg(W15_1710_GPIO40); 530 omap_cfg_reg(W15_1710_GPIO40);
540 if (omap_request_gpio(40) < 0) { 531 if (gpio_request(40, "SMC91x irq") < 0) {
541 printk("Error requesting gpio 40 for smc91x irq\n"); 532 printk("Error requesting gpio 40 for smc91x irq\n");
542 return; 533 return;
543 } 534 }
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index cbc11be5cd2a..af2fb9070083 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -39,6 +39,7 @@
39#include <mach/common.h> 39#include <mach/common.h>
40#include <mach/mcbsp.h> 40#include <mach/mcbsp.h>
41#include <mach/omap-alsa.h> 41#include <mach/omap-alsa.h>
42#include <mach/mmc.h>
42 43
43static int innovator_keymap[] = { 44static int innovator_keymap[] = {
44 KEY(0, 0, KEY_F1), 45 KEY(0, 0, KEY_F1),
@@ -301,7 +302,7 @@ static void __init innovator_init_smc91x(void)
301 OMAP1510_FPGA_RST); 302 OMAP1510_FPGA_RST);
302 udelay(750); 303 udelay(750);
303 } else { 304 } else {
304 if ((omap_request_gpio(0)) < 0) { 305 if (gpio_request(0, "SMC91x irq") < 0) {
305 printk("Error requesting gpio 0 for smc91x irq\n"); 306 printk("Error requesting gpio 0 for smc91x irq\n");
306 return; 307 return;
307 } 308 }
@@ -360,16 +361,49 @@ static struct omap_lcd_config innovator1610_lcd_config __initdata = {
360}; 361};
361#endif 362#endif
362 363
363static struct omap_mmc_config innovator_mmc_config __initdata = { 364#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
364 .mmc [0] = { 365
365 .enabled = 1, 366static int mmc_set_power(struct device *dev, int slot, int power_on,
366 .wire4 = 1, 367 int vdd)
367 .wp_pin = OMAP_MPUIO(3), 368{
368 .power_pin = -1, /* FPGA F3 UIO42 */ 369 if (power_on)
369 .switch_pin = -1, /* FPGA F4 UIO43 */ 370 fpga_write(fpga_read(OMAP1510_FPGA_POWER) | (1 << 3),
371 OMAP1510_FPGA_POWER);
372 else
373 fpga_write(fpga_read(OMAP1510_FPGA_POWER) & ~(1 << 3),
374 OMAP1510_FPGA_POWER);
375
376 return 0;
377}
378
379/*
380 * Innovator could use the following functions tested:
381 * - mmc_get_wp that uses OMAP_MPUIO(3)
382 * - mmc_get_cover_state that uses FPGA F4 UIO43
383 */
384static struct omap_mmc_platform_data mmc1_data = {
385 .nr_slots = 1,
386 .slots[0] = {
387 .set_power = mmc_set_power,
388 .wires = 4,
389 .name = "mmcblk",
370 }, 390 },
371}; 391};
372 392
393static struct omap_mmc_platform_data *mmc_data[OMAP16XX_NR_MMC];
394
395void __init innovator_mmc_init(void)
396{
397 mmc_data[0] = &mmc1_data;
398 omap1_init_mmc(mmc_data, OMAP15XX_NR_MMC);
399}
400
401#else
402static inline void innovator_mmc_init(void)
403{
404}
405#endif
406
373static struct omap_uart_config innovator_uart_config __initdata = { 407static struct omap_uart_config innovator_uart_config __initdata = {
374 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), 408 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
375}; 409};
@@ -377,7 +411,6 @@ static struct omap_uart_config innovator_uart_config __initdata = {
377static struct omap_board_config_kernel innovator_config[] = { 411static struct omap_board_config_kernel innovator_config[] = {
378 { OMAP_TAG_USB, NULL }, 412 { OMAP_TAG_USB, NULL },
379 { OMAP_TAG_LCD, NULL }, 413 { OMAP_TAG_LCD, NULL },
380 { OMAP_TAG_MMC, &innovator_mmc_config },
381 { OMAP_TAG_UART, &innovator_uart_config }, 414 { OMAP_TAG_UART, &innovator_uart_config },
382}; 415};
383 416
@@ -412,6 +445,7 @@ static void __init innovator_init(void)
412 omap_board_config_size = ARRAY_SIZE(innovator_config); 445 omap_board_config_size = ARRAY_SIZE(innovator_config);
413 omap_serial_init(); 446 omap_serial_init();
414 omap_register_i2c_bus(1, 100, NULL, 0); 447 omap_register_i2c_bus(1, 100, NULL, 0);
448 innovator_mmc_init();
415} 449}
416 450
417static void __init innovator_map_io(void) 451static void __init innovator_map_io(void)
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 38d9783ac6d6..4970c402a594 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -35,6 +35,7 @@
35#include <mach/aic23.h> 35#include <mach/aic23.h>
36#include <mach/omapfb.h> 36#include <mach/omapfb.h>
37#include <mach/lcd_mipid.h> 37#include <mach/lcd_mipid.h>
38#include <mach/mmc.h>
38 39
39#define ADS7846_PENDOWN_GPIO 15 40#define ADS7846_PENDOWN_GPIO 15
40 41
@@ -102,7 +103,7 @@ static void mipid_shutdown(struct mipid_platform_data *pdata)
102{ 103{
103 if (pdata->nreset_gpio != -1) { 104 if (pdata->nreset_gpio != -1) {
104 printk(KERN_INFO "shutdown LCD\n"); 105 printk(KERN_INFO "shutdown LCD\n");
105 omap_set_gpio_dataout(pdata->nreset_gpio, 0); 106 gpio_set_value(pdata->nreset_gpio, 0);
106 msleep(120); 107 msleep(120);
107 } 108 }
108} 109}
@@ -124,13 +125,13 @@ static void mipid_dev_init(void)
124 125
125static void ads7846_dev_init(void) 126static void ads7846_dev_init(void)
126{ 127{
127 if (omap_request_gpio(ADS7846_PENDOWN_GPIO) < 0) 128 if (gpio_request(ADS7846_PENDOWN_GPIO, "ADS7846 pendown") < 0)
128 printk(KERN_ERR "can't get ads7846 pen down GPIO\n"); 129 printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
129} 130}
130 131
131static int ads7846_get_pendown_state(void) 132static int ads7846_get_pendown_state(void)
132{ 133{
133 return !omap_get_gpio_datain(ADS7846_PENDOWN_GPIO); 134 return !gpio_get_value(ADS7846_PENDOWN_GPIO);
134} 135}
135 136
136static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata = { 137static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata = {
@@ -173,26 +174,68 @@ static struct omap_usb_config nokia770_usb_config __initdata = {
173 .pins[0] = 6, 174 .pins[0] = 6,
174}; 175};
175 176
176static struct omap_mmc_config nokia770_mmc_config __initdata = { 177#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
177 .mmc[0] = { 178
178 .enabled = 0, 179#define NOKIA770_GPIO_MMC_POWER 41
179 .wire4 = 0, 180#define NOKIA770_GPIO_MMC_SWITCH 23
180 .wp_pin = -1, 181
181 .power_pin = -1, 182static int nokia770_mmc_set_power(struct device *dev, int slot, int power_on,
182 .switch_pin = -1, 183 int vdd)
183 }, 184{
184 .mmc[1] = { 185 if (power_on)
185 .enabled = 0, 186 gpio_set_value(NOKIA770_GPIO_MMC_POWER, 1);
186 .wire4 = 0, 187 else
187 .wp_pin = -1, 188 gpio_set_value(NOKIA770_GPIO_MMC_POWER, 0);
188 .power_pin = -1, 189
189 .switch_pin = -1, 190 return 0;
191}
192
193static int nokia770_mmc_get_cover_state(struct device *dev, int slot)
194{
195 return gpio_get_value(NOKIA770_GPIO_MMC_SWITCH);
196}
197
198static struct omap_mmc_platform_data nokia770_mmc2_data = {
199 .nr_slots = 1,
200 .dma_mask = 0xffffffff,
201 .slots[0] = {
202 .set_power = nokia770_mmc_set_power,
203 .get_cover_state = nokia770_mmc_get_cover_state,
204 .name = "mmcblk",
190 }, 205 },
191}; 206};
192 207
208static struct omap_mmc_platform_data *nokia770_mmc_data[OMAP16XX_NR_MMC];
209
210static void __init nokia770_mmc_init(void)
211{
212 int ret;
213
214 ret = gpio_request(NOKIA770_GPIO_MMC_POWER, "MMC power");
215 if (ret < 0)
216 return;
217 gpio_direction_output(NOKIA770_GPIO_MMC_POWER, 0);
218
219 ret = gpio_request(NOKIA770_GPIO_MMC_SWITCH, "MMC cover");
220 if (ret < 0) {
221 gpio_free(NOKIA770_GPIO_MMC_POWER);
222 return;
223 }
224 gpio_direction_input(NOKIA770_GPIO_MMC_SWITCH);
225
226 /* Only the second MMC controller is used */
227 nokia770_mmc_data[1] = &nokia770_mmc2_data;
228 omap1_init_mmc(nokia770_mmc_data, OMAP16XX_NR_MMC);
229}
230
231#else
232static inline void nokia770_mmc_init(void)
233{
234}
235#endif
236
193static struct omap_board_config_kernel nokia770_config[] __initdata = { 237static struct omap_board_config_kernel nokia770_config[] __initdata = {
194 { OMAP_TAG_USB, NULL }, 238 { OMAP_TAG_USB, NULL },
195 { OMAP_TAG_MMC, &nokia770_mmc_config },
196}; 239};
197 240
198#if defined(CONFIG_OMAP_DSP) 241#if defined(CONFIG_OMAP_DSP)
@@ -228,9 +271,9 @@ static void nokia770_audio_pwr_up(void)
228 /* Turn on codec */ 271 /* Turn on codec */
229 aic23_power_up(); 272 aic23_power_up();
230 273
231 if (omap_get_gpio_datain(HEADPHONE_GPIO)) 274 if (gpio_get_value(HEADPHONE_GPIO))
232 /* HP not connected, turn on amplifier */ 275 /* HP not connected, turn on amplifier */
233 omap_set_gpio_dataout(AMPLIFIER_CTRL_GPIO, 1); 276 gpio_set_value(AMPLIFIER_CTRL_GPIO, 1);
234 else 277 else
235 /* HP connected, do not turn on amplifier */ 278 /* HP connected, do not turn on amplifier */
236 printk("HP connected\n"); 279 printk("HP connected\n");
@@ -250,7 +293,7 @@ static DECLARE_DELAYED_WORK(codec_power_down_work, codec_delayed_power_down);
250static void nokia770_audio_pwr_down(void) 293static void nokia770_audio_pwr_down(void)
251{ 294{
252 /* Turn off amplifier */ 295 /* Turn off amplifier */
253 omap_set_gpio_dataout(AMPLIFIER_CTRL_GPIO, 0); 296 gpio_set_value(AMPLIFIER_CTRL_GPIO, 0);
254 297
255 /* Turn off codec: schedule delayed work */ 298 /* Turn off codec: schedule delayed work */
256 schedule_delayed_work(&codec_power_down_work, HZ / 20); /* 50ms */ 299 schedule_delayed_work(&codec_power_down_work, HZ / 20); /* 50ms */
@@ -335,6 +378,7 @@ static void __init omap_nokia770_init(void)
335 omap_dsp_init(); 378 omap_dsp_init();
336 ads7846_dev_init(); 379 ads7846_dev_init();
337 mipid_dev_init(); 380 mipid_dev_init();
381 nokia770_mmc_init();
338} 382}
339 383
340static void __init omap_nokia770_map_io(void) 384static void __init omap_nokia770_map_io(void)
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 3e766e49f7cc..ff9e67baa5c9 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -188,7 +188,8 @@ static struct gpio_led tps_leds[] = {
188 /* NOTE: D9 and D2 have hardware blink support. 188 /* NOTE: D9 and D2 have hardware blink support.
189 * Also, D9 requires non-battery power. 189 * Also, D9 requires non-battery power.
190 */ 190 */
191 { .gpio = OSK_TPS_GPIO_LED_D9, .name = "d9", }, 191 { .gpio = OSK_TPS_GPIO_LED_D9, .name = "d9",
192 .default_trigger = "ide-disk", },
192 { .gpio = OSK_TPS_GPIO_LED_D2, .name = "d2", }, 193 { .gpio = OSK_TPS_GPIO_LED_D2, .name = "d2", },
193 { .gpio = OSK_TPS_GPIO_LED_D3, .name = "d3", .active_low = 1, 194 { .gpio = OSK_TPS_GPIO_LED_D3, .name = "d3", .active_low = 1,
194 .default_trigger = "heartbeat", }, 195 .default_trigger = "heartbeat", },
@@ -260,7 +261,6 @@ static struct i2c_board_info __initdata osk_i2c_board_info[] = {
260 }, 261 },
261 /* TODO when driver support is ready: 262 /* TODO when driver support is ready:
262 * - aic23 audio chip at 0x1a 263 * - aic23 audio chip at 0x1a
263 * - on Mistral, 24c04 eeprom at 0x50
264 * - optionally on Mistral, ov9640 camera sensor at 0x30 264 * - optionally on Mistral, ov9640 camera sensor at 0x30
265 */ 265 */
266}; 266};
@@ -288,7 +288,7 @@ static void __init osk_init_cf(void)
288 return; 288 return;
289 } 289 }
290 /* the CF I/O IRQ is really active-low */ 290 /* the CF I/O IRQ is really active-low */
291 set_irq_type(OMAP_GPIO_IRQ(62), IRQ_TYPE_EDGE_FALLING); 291 set_irq_type(gpio_to_irq(62), IRQ_TYPE_EDGE_FALLING);
292} 292}
293 293
294static void __init osk_init_irq(void) 294static void __init osk_init_irq(void)
@@ -337,11 +337,28 @@ static struct omap_board_config_kernel osk_config[] __initdata = {
337#ifdef CONFIG_OMAP_OSK_MISTRAL 337#ifdef CONFIG_OMAP_OSK_MISTRAL
338 338
339#include <linux/input.h> 339#include <linux/input.h>
340#include <linux/i2c/at24.h>
340#include <linux/spi/spi.h> 341#include <linux/spi/spi.h>
341#include <linux/spi/ads7846.h> 342#include <linux/spi/ads7846.h>
342 343
343#include <mach/keypad.h> 344#include <mach/keypad.h>
344 345
346static struct at24_platform_data at24c04 = {
347 .byte_len = SZ_4K / 8,
348 .page_size = 16,
349};
350
351static struct i2c_board_info __initdata mistral_i2c_board_info[] = {
352 {
353 /* NOTE: powered from LCD supply */
354 I2C_BOARD_INFO("24c04", 0x50),
355 .platform_data = &at24c04,
356 },
357 /* TODO when driver support is ready:
358 * - optionally ov9640 camera sensor at 0x30
359 */
360};
361
345static const int osk_keymap[] = { 362static const int osk_keymap[] = {
346 /* KEY(col, row, code) */ 363 /* KEY(col, row, code) */
347 KEY(0, 0, KEY_F1), /* SW4 */ 364 KEY(0, 0, KEY_F1), /* SW4 */
@@ -483,23 +500,30 @@ static void __init osk_mistral_init(void)
483 omap_cfg_reg(P20_1610_GPIO4); /* PENIRQ */ 500 omap_cfg_reg(P20_1610_GPIO4); /* PENIRQ */
484 gpio_request(4, "ts_int"); 501 gpio_request(4, "ts_int");
485 gpio_direction_input(4); 502 gpio_direction_input(4);
486 set_irq_type(OMAP_GPIO_IRQ(4), IRQ_TYPE_EDGE_FALLING); 503 set_irq_type(gpio_to_irq(4), IRQ_TYPE_EDGE_FALLING);
487 504
488 spi_register_board_info(mistral_boardinfo, 505 spi_register_board_info(mistral_boardinfo,
489 ARRAY_SIZE(mistral_boardinfo)); 506 ARRAY_SIZE(mistral_boardinfo));
490 507
491 /* the sideways button (SW1) is for use as a "wakeup" button */ 508 /* the sideways button (SW1) is for use as a "wakeup" button
509 *
510 * NOTE: The Mistral board has the wakeup button (SW1) wired
511 * to the LCD 3.3V rail, which is powered down during suspend.
512 * To allow this button to wake up the omap, work around this
513 * HW bug by rewiring SW1 to use the main 3.3V rail.
514 */
492 omap_cfg_reg(N15_1610_MPUIO2); 515 omap_cfg_reg(N15_1610_MPUIO2);
493 if (gpio_request(OMAP_MPUIO(2), "wakeup") == 0) { 516 if (gpio_request(OMAP_MPUIO(2), "wakeup") == 0) {
494 int ret = 0; 517 int ret = 0;
518 int irq = gpio_to_irq(OMAP_MPUIO(2));
495 519
496 gpio_direction_input(OMAP_MPUIO(2)); 520 gpio_direction_input(OMAP_MPUIO(2));
497 set_irq_type(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), IRQ_TYPE_EDGE_RISING); 521 set_irq_type(irq, IRQ_TYPE_EDGE_RISING);
498#ifdef CONFIG_PM 522#ifdef CONFIG_PM
499 /* share the IRQ in case someone wants to use the 523 /* share the IRQ in case someone wants to use the
500 * button for more than wakeup from system sleep. 524 * button for more than wakeup from system sleep.
501 */ 525 */
502 ret = request_irq(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), 526 ret = request_irq(irq,
503 &osk_mistral_wake_interrupt, 527 &osk_mistral_wake_interrupt,
504 IRQF_SHARED, "mistral_wakeup", 528 IRQF_SHARED, "mistral_wakeup",
505 &osk_mistral_wake_interrupt); 529 &osk_mistral_wake_interrupt);
@@ -508,7 +532,7 @@ static void __init osk_mistral_init(void)
508 printk(KERN_ERR "OSK+Mistral: no wakeup irq, %d?\n", 532 printk(KERN_ERR "OSK+Mistral: no wakeup irq, %d?\n",
509 ret); 533 ret);
510 } else 534 } else
511 enable_irq_wake(OMAP_GPIO_IRQ(OMAP_MPUIO(2))); 535 enable_irq_wake(irq);
512#endif 536#endif
513 } else 537 } else
514 printk(KERN_ERR "OSK+Mistral: wakeup button is awol\n"); 538 printk(KERN_ERR "OSK+Mistral: wakeup button is awol\n");
@@ -520,6 +544,9 @@ static void __init osk_mistral_init(void)
520 if (gpio_request(2, "lcd_pwr") == 0) 544 if (gpio_request(2, "lcd_pwr") == 0)
521 gpio_direction_output(2, 1); 545 gpio_direction_output(2, 1);
522 546
547 i2c_register_board_info(1, mistral_i2c_board_info,
548 ARRAY_SIZE(mistral_i2c_board_info));
549
523 platform_add_devices(mistral_devices, ARRAY_SIZE(mistral_devices)); 550 platform_add_devices(mistral_devices, ARRAY_SIZE(mistral_devices));
524} 551}
525#else 552#else
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index b58043644a6f..75e32d35afd9 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -255,7 +255,7 @@ static void palmte_get_power_status(struct apm_power_info *info, int *battery)
255{ 255{
256 int charging, batt, hi, lo, mid; 256 int charging, batt, hi, lo, mid;
257 257
258 charging = !omap_get_gpio_datain(PALMTE_DC_GPIO); 258 charging = !gpio_get_value(PALMTE_DC_GPIO);
259 batt = battery[0]; 259 batt = battery[0];
260 if (charging) 260 if (charging)
261 batt -= 60; 261 batt -= 60;
@@ -316,7 +316,6 @@ static void palmte_get_power_status(struct apm_power_info *info, int *battery)
316 316
317static struct omap_board_config_kernel palmte_config[] __initdata = { 317static struct omap_board_config_kernel palmte_config[] __initdata = {
318 { OMAP_TAG_USB, &palmte_usb_config }, 318 { OMAP_TAG_USB, &palmte_usb_config },
319 { OMAP_TAG_MMC, &palmte_mmc_config },
320 { OMAP_TAG_LCD, &palmte_lcd_config }, 319 { OMAP_TAG_LCD, &palmte_lcd_config },
321 { OMAP_TAG_UART, &palmte_uart_config }, 320 { OMAP_TAG_UART, &palmte_uart_config },
322}; 321};
@@ -335,11 +334,11 @@ static void palmte_headphones_detect(void *data, int state)
335{ 334{
336 if (state) { 335 if (state) {
337 /* Headphones connected, disable speaker */ 336 /* Headphones connected, disable speaker */
338 omap_set_gpio_dataout(PALMTE_SPEAKER_GPIO, 0); 337 gpio_set_value(PALMTE_SPEAKER_GPIO, 0);
339 printk(KERN_INFO "PM: speaker off\n"); 338 printk(KERN_INFO "PM: speaker off\n");
340 } else { 339 } else {
341 /* Headphones unplugged, re-enable speaker */ 340 /* Headphones unplugged, re-enable speaker */
342 omap_set_gpio_dataout(PALMTE_SPEAKER_GPIO, 1); 341 gpio_set_value(PALMTE_SPEAKER_GPIO, 1);
343 printk(KERN_INFO "PM: speaker on\n"); 342 printk(KERN_INFO "PM: speaker on\n");
344 } 343 }
345} 344}
@@ -347,18 +346,18 @@ static void palmte_headphones_detect(void *data, int state)
347static void __init palmte_misc_gpio_setup(void) 346static void __init palmte_misc_gpio_setup(void)
348{ 347{
349 /* Set TSC2102 PINTDAV pin as input (used by TSC2102 driver) */ 348 /* Set TSC2102 PINTDAV pin as input (used by TSC2102 driver) */
350 if (omap_request_gpio(PALMTE_PINTDAV_GPIO)) { 349 if (gpio_request(PALMTE_PINTDAV_GPIO, "TSC2102 PINTDAV") < 0) {
351 printk(KERN_ERR "Could not reserve PINTDAV GPIO!\n"); 350 printk(KERN_ERR "Could not reserve PINTDAV GPIO!\n");
352 return; 351 return;
353 } 352 }
354 omap_set_gpio_direction(PALMTE_PINTDAV_GPIO, 1); 353 gpio_direction_input(PALMTE_PINTDAV_GPIO);
355 354
356 /* Set USB-or-DC-IN pin as input (unused) */ 355 /* Set USB-or-DC-IN pin as input (unused) */
357 if (omap_request_gpio(PALMTE_USB_OR_DC_GPIO)) { 356 if (gpio_request(PALMTE_USB_OR_DC_GPIO, "USB/DC-IN") < 0) {
358 printk(KERN_ERR "Could not reserve cable signal GPIO!\n"); 357 printk(KERN_ERR "Could not reserve cable signal GPIO!\n");
359 return; 358 return;
360 } 359 }
361 omap_set_gpio_direction(PALMTE_USB_OR_DC_GPIO, 1); 360 gpio_direction_input(PALMTE_USB_OR_DC_GPIO);
362} 361}
363 362
364static void __init omap_palmte_init(void) 363static void __init omap_palmte_init(void)
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
index 40f9860a09df..5c001afe8062 100644
--- a/arch/arm/mach-omap1/board-palmtt.c
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -268,7 +268,7 @@ static struct platform_device *palmtt_devices[] __initdata = {
268 268
269static int palmtt_get_pendown_state(void) 269static int palmtt_get_pendown_state(void)
270{ 270{
271 return !omap_get_gpio_datain(6); 271 return !gpio_get_value(6);
272} 272}
273 273
274static const struct ads7846_platform_data palmtt_ts_info = { 274static const struct ads7846_platform_data palmtt_ts_info = {
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index e719294250b1..cc05257eb1cd 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -239,7 +239,7 @@ static struct platform_device *devices[] __initdata = {
239static int 239static int
240palmz71_get_pendown_state(void) 240palmz71_get_pendown_state(void)
241{ 241{
242 return !omap_get_gpio_datain(PALMZ71_PENIRQ_GPIO); 242 return !gpio_get_value(PALMZ71_PENIRQ_GPIO);
243} 243}
244 244
245static const struct ads7846_platform_data palmz71_ts_info = { 245static const struct ads7846_platform_data palmz71_ts_info = {
@@ -267,16 +267,6 @@ static struct omap_usb_config palmz71_usb_config __initdata = {
267 .pins[0] = 2, 267 .pins[0] = 2,
268}; 268};
269 269
270static struct omap_mmc_config palmz71_mmc_config __initdata = {
271 .mmc[0] = {
272 .enabled = 1,
273 .wire4 = 0,
274 .wp_pin = PALMZ71_MMC_WP_GPIO,
275 .power_pin = -1,
276 .switch_pin = PALMZ71_MMC_IN_GPIO,
277 },
278};
279
280static struct omap_lcd_config palmz71_lcd_config __initdata = { 270static struct omap_lcd_config palmz71_lcd_config __initdata = {
281 .ctrl_name = "internal", 271 .ctrl_name = "internal",
282}; 272};
@@ -287,7 +277,6 @@ static struct omap_uart_config palmz71_uart_config __initdata = {
287 277
288static struct omap_board_config_kernel palmz71_config[] __initdata = { 278static struct omap_board_config_kernel palmz71_config[] __initdata = {
289 {OMAP_TAG_USB, &palmz71_usb_config}, 279 {OMAP_TAG_USB, &palmz71_usb_config},
290 {OMAP_TAG_MMC, &palmz71_mmc_config},
291 {OMAP_TAG_LCD, &palmz71_lcd_config}, 280 {OMAP_TAG_LCD, &palmz71_lcd_config},
292 {OMAP_TAG_UART, &palmz71_uart_config}, 281 {OMAP_TAG_UART, &palmz71_uart_config},
293}; 282};
@@ -295,13 +284,13 @@ static struct omap_board_config_kernel palmz71_config[] __initdata = {
295static irqreturn_t 284static irqreturn_t
296palmz71_powercable(int irq, void *dev_id) 285palmz71_powercable(int irq, void *dev_id)
297{ 286{
298 if (omap_get_gpio_datain(PALMZ71_USBDETECT_GPIO)) { 287 if (gpio_get_value(PALMZ71_USBDETECT_GPIO)) {
299 printk(KERN_INFO "PM: Power cable connected\n"); 288 printk(KERN_INFO "PM: Power cable connected\n");
300 set_irq_type(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO), 289 set_irq_type(gpio_to_irq(PALMZ71_USBDETECT_GPIO),
301 IRQ_TYPE_EDGE_FALLING); 290 IRQ_TYPE_EDGE_FALLING);
302 } else { 291 } else {
303 printk(KERN_INFO "PM: Power cable disconnected\n"); 292 printk(KERN_INFO "PM: Power cable disconnected\n");
304 set_irq_type(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO), 293 set_irq_type(gpio_to_irq(PALMZ71_USBDETECT_GPIO),
305 IRQ_TYPE_EDGE_RISING); 294 IRQ_TYPE_EDGE_RISING);
306 } 295 }
307 return IRQ_HANDLED; 296 return IRQ_HANDLED;
@@ -323,29 +312,28 @@ palmz71_gpio_setup(int early)
323{ 312{
324 if (early) { 313 if (early) {
325 /* Only set GPIO1 so we have a working serial */ 314 /* Only set GPIO1 so we have a working serial */
326 omap_set_gpio_dataout(1, 1); 315 gpio_direction_output(1, 1);
327 omap_set_gpio_direction(1, 0);
328 } else { 316 } else {
329 /* Set MMC/SD host WP pin as input */ 317 /* Set MMC/SD host WP pin as input */
330 if (omap_request_gpio(PALMZ71_MMC_WP_GPIO)) { 318 if (gpio_request(PALMZ71_MMC_WP_GPIO, "MMC WP") < 0) {
331 printk(KERN_ERR "Could not reserve WP GPIO!\n"); 319 printk(KERN_ERR "Could not reserve WP GPIO!\n");
332 return; 320 return;
333 } 321 }
334 omap_set_gpio_direction(PALMZ71_MMC_WP_GPIO, 1); 322 gpio_direction_input(PALMZ71_MMC_WP_GPIO);
335 323
336 /* Monitor the Power-cable-connected signal */ 324 /* Monitor the Power-cable-connected signal */
337 if (omap_request_gpio(PALMZ71_USBDETECT_GPIO)) { 325 if (gpio_request(PALMZ71_USBDETECT_GPIO, "USB detect") < 0) {
338 printk(KERN_ERR 326 printk(KERN_ERR
339 "Could not reserve cable signal GPIO!\n"); 327 "Could not reserve cable signal GPIO!\n");
340 return; 328 return;
341 } 329 }
342 omap_set_gpio_direction(PALMZ71_USBDETECT_GPIO, 1); 330 gpio_direction_input(PALMZ71_USBDETECT_GPIO);
343 if (request_irq(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO), 331 if (request_irq(gpio_to_irq(PALMZ71_USBDETECT_GPIO),
344 palmz71_powercable, IRQF_SAMPLE_RANDOM, 332 palmz71_powercable, IRQF_SAMPLE_RANDOM,
345 "palmz71-cable", 0)) 333 "palmz71-cable", 0))
346 printk(KERN_ERR 334 printk(KERN_ERR
347 "IRQ request for power cable failed!\n"); 335 "IRQ request for power cable failed!\n");
348 palmz71_powercable(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO), 0); 336 palmz71_powercable(gpio_to_irq(PALMZ71_USBDETECT_GPIO), 0);
349 } 337 }
350} 338}
351 339
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index b715917bfdaf..3b9f907aa899 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -205,7 +205,7 @@ static struct platform_device *devices[] __initdata = {
205 205
206static int nand_dev_ready(struct omap_nand_platform_data *data) 206static int nand_dev_ready(struct omap_nand_platform_data *data)
207{ 207{
208 return omap_get_gpio_datain(P2_NAND_RB_GPIO_PIN); 208 return gpio_get_value(P2_NAND_RB_GPIO_PIN);
209} 209}
210 210
211static struct omap_uart_config perseus2_uart_config __initdata = { 211static struct omap_uart_config perseus2_uart_config __initdata = {
@@ -223,8 +223,9 @@ static struct omap_board_config_kernel perseus2_config[] __initdata = {
223 223
224static void __init omap_perseus2_init(void) 224static void __init omap_perseus2_init(void)
225{ 225{
226 if (!(omap_request_gpio(P2_NAND_RB_GPIO_PIN))) 226 if (gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0)
227 nand_data.dev_ready = nand_dev_ready; 227 BUG();
228 nand_data.dev_ready = nand_dev_ready;
228 229
229 omap_cfg_reg(L3_1610_FLASH_CS2B_OE); 230 omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
230 omap_cfg_reg(M8_1610_FLASH_CS2B_WE); 231 omap_cfg_reg(M8_1610_FLASH_CS2B_WE);
diff --git a/arch/arm/mach-omap1/board-sx1-mmc.c b/arch/arm/mach-omap1/board-sx1-mmc.c
index 0be4ebaa2842..66a4d7d5255d 100644
--- a/arch/arm/mach-omap1/board-sx1-mmc.c
+++ b/arch/arm/mach-omap1/board-sx1-mmc.c
@@ -12,30 +12,20 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14
15#include <linux/platform_device.h>
16
15#include <mach/hardware.h> 17#include <mach/hardware.h>
16#include <mach/mmc.h> 18#include <mach/mmc.h>
17#include <mach/gpio.h> 19#include <mach/gpio.h>
18 20
19#ifdef CONFIG_MMC_OMAP 21#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
20static int slot_cover_open;
21static struct device *mmc_device;
22 22
23static int sx1_mmc_set_power(struct device *dev, int slot, int power_on, 23static int mmc_set_power(struct device *dev, int slot, int power_on,
24 int vdd) 24 int vdd)
25{ 25{
26 int err; 26 int err;
27 u8 dat = 0; 27 u8 dat = 0;
28 28
29#ifdef CONFIG_MMC_DEBUG
30 dev_dbg(dev, "Set slot %d power: %s (vdd %d)\n", slot + 1,
31 power_on ? "on" : "off", vdd);
32#endif
33
34 if (slot != 0) {
35 dev_err(dev, "No such slot %d\n", slot + 1);
36 return -ENODEV;
37 }
38
39 err = sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat); 29 err = sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat);
40 if (err < 0) 30 if (err < 0)
41 return err; 31 return err;
@@ -48,68 +38,23 @@ static int sx1_mmc_set_power(struct device *dev, int slot, int power_on,
48 return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat); 38 return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat);
49} 39}
50 40
51static int sx1_mmc_set_bus_mode(struct device *dev, int slot, int bus_mode) 41/* Cover switch is at OMAP_MPUIO(3) */
52{ 42static struct omap_mmc_platform_data mmc1_data = {
53#ifdef CONFIG_MMC_DEBUG
54 dev_dbg(dev, "Set slot %d bus_mode %s\n", slot + 1,
55 bus_mode == MMC_BUSMODE_OPENDRAIN ? "open-drain" : "push-pull");
56#endif
57 if (slot != 0) {
58 dev_err(dev, "No such slot %d\n", slot + 1);
59 return -ENODEV;
60 }
61
62 return 0;
63}
64
65static int sx1_mmc_get_cover_state(struct device *dev, int slot)
66{
67 BUG_ON(slot != 0);
68
69 return slot_cover_open;
70}
71
72void sx1_mmc_slot_cover_handler(void *arg, int state)
73{
74 if (mmc_device == NULL)
75 return;
76
77 slot_cover_open = state;
78 omap_mmc_notify_cover_event(mmc_device, 0, state);
79}
80
81static int sx1_mmc_late_init(struct device *dev)
82{
83 int ret = 0;
84
85 mmc_device = dev;
86
87 return ret;
88}
89
90static void sx1_mmc_cleanup(struct device *dev)
91{
92}
93
94static struct omap_mmc_platform_data sx1_mmc_data = {
95 .nr_slots = 1, 43 .nr_slots = 1,
96 .switch_slot = NULL,
97 .init = sx1_mmc_late_init,
98 .cleanup = sx1_mmc_cleanup,
99 .slots[0] = { 44 .slots[0] = {
100 .set_power = sx1_mmc_set_power, 45 .set_power = mmc_set_power,
101 .set_bus_mode = sx1_mmc_set_bus_mode,
102 .get_ro = NULL,
103 .get_cover_state = sx1_mmc_get_cover_state,
104 .ocr_mask = MMC_VDD_28_29 | MMC_VDD_30_31 | 46 .ocr_mask = MMC_VDD_28_29 | MMC_VDD_30_31 |
105 MMC_VDD_32_33 | MMC_VDD_33_34, 47 MMC_VDD_32_33 | MMC_VDD_33_34,
106 .name = "mmcblk", 48 .name = "mmcblk",
107 }, 49 },
108}; 50};
109 51
52static struct omap_mmc_platform_data *mmc_data[OMAP15XX_NR_MMC];
53
110void __init sx1_mmc_init(void) 54void __init sx1_mmc_init(void)
111{ 55{
112 omap_set_mmc_info(1, &sx1_mmc_data); 56 mmc_data[0] = &mmc1_data;
57 omap1_init_mmc(mmc_data, OMAP15XX_NR_MMC);
113} 58}
114 59
115#else 60#else
@@ -118,7 +63,4 @@ void __init sx1_mmc_init(void)
118{ 63{
119} 64}
120 65
121void sx1_mmc_slot_cover_handler(void *arg, int state)
122{
123}
124#endif 66#endif
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index 130bcc6fd082..8171fe0ca082 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -378,15 +378,6 @@ static struct omap_usb_config sx1_usb_config __initdata = {
378 .pins[2] = 0, 378 .pins[2] = 0,
379}; 379};
380 380
381/*----------- MMC -------------------------*/
382
383static struct omap_mmc_config sx1_mmc_config __initdata = {
384 .mmc [0] = {
385 .enabled = 1,
386 .wire4 = 0,
387 },
388};
389
390/*----------- LCD -------------------------*/ 381/*----------- LCD -------------------------*/
391 382
392static struct platform_device sx1_lcd_device = { 383static struct platform_device sx1_lcd_device = {
@@ -414,7 +405,6 @@ static struct omap_uart_config sx1_uart_config __initdata = {
414 405
415static struct omap_board_config_kernel sx1_config[] __initdata = { 406static struct omap_board_config_kernel sx1_config[] __initdata = {
416 { OMAP_TAG_USB, &sx1_usb_config }, 407 { OMAP_TAG_USB, &sx1_usb_config },
417 { OMAP_TAG_MMC, &sx1_mmc_config },
418 { OMAP_TAG_LCD, &sx1_lcd_config }, 408 { OMAP_TAG_LCD, &sx1_lcd_config },
419 { OMAP_TAG_UART, &sx1_uart_config }, 409 { OMAP_TAG_UART, &sx1_uart_config },
420}; 410};
@@ -436,14 +426,9 @@ static void __init omap_sx1_init(void)
436 omap_request_gpio(1); /* A_IRDA_OFF */ 426 omap_request_gpio(1); /* A_IRDA_OFF */
437 omap_request_gpio(11); /* A_SWITCH */ 427 omap_request_gpio(11); /* A_SWITCH */
438 omap_request_gpio(15); /* A_USB_ON */ 428 omap_request_gpio(15); /* A_USB_ON */
439 omap_set_gpio_direction(1, 0);/* gpio1 -> output */ 429 gpio_direction_output(1, 1); /*A_IRDA_OFF = 1 */
440 omap_set_gpio_direction(11, 0);/* gpio11 -> output */ 430 gpio_direction_output(11, 0); /*A_SWITCH = 0 */
441 omap_set_gpio_direction(15, 0);/* gpio15 -> output */ 431 gpio_direction_output(15, 0); /*A_USB_ON = 0 */
442 /* set GPIO data */
443 omap_set_gpio_dataout(1, 1);/*A_IRDA_OFF = 1 */
444 omap_set_gpio_dataout(11, 0);/*A_SWITCH = 0 */
445 omap_set_gpio_dataout(15, 0);/*A_USB_ON = 0 */
446
447} 432}
448/*----------------------------------------*/ 433/*----------------------------------------*/
449static void __init omap_sx1_init_irq(void) 434static void __init omap_sx1_init_irq(void)
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index 45a01311669a..c224f3c64235 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -15,6 +15,7 @@
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/irq.h>
18#include <linux/init.h> 19#include <linux/init.h>
19#include <linux/kernel.h> 20#include <linux/kernel.h>
20#include <linux/notifier.h> 21#include <linux/notifier.h>
@@ -140,21 +141,12 @@ static struct omap_usb_config voiceblue_usb_config __initdata = {
140 .pins[2] = 6, 141 .pins[2] = 6,
141}; 142};
142 143
143static struct omap_mmc_config voiceblue_mmc_config __initdata = {
144 .mmc[0] = {
145 .enabled = 1,
146 .power_pin = 2,
147 .switch_pin = -1,
148 },
149};
150
151static struct omap_uart_config voiceblue_uart_config __initdata = { 144static struct omap_uart_config voiceblue_uart_config __initdata = {
152 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), 145 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
153}; 146};
154 147
155static struct omap_board_config_kernel voiceblue_config[] = { 148static struct omap_board_config_kernel voiceblue_config[] = {
156 { OMAP_TAG_USB, &voiceblue_usb_config }, 149 { OMAP_TAG_USB, &voiceblue_usb_config },
157 { OMAP_TAG_MMC, &voiceblue_mmc_config },
158 { OMAP_TAG_UART, &voiceblue_uart_config }, 150 { OMAP_TAG_UART, &voiceblue_uart_config },
159}; 151};
160 152
@@ -168,29 +160,27 @@ static void __init voiceblue_init_irq(void)
168static void __init voiceblue_init(void) 160static void __init voiceblue_init(void)
169{ 161{
170 /* Watchdog */ 162 /* Watchdog */
171 omap_request_gpio(0); 163 gpio_request(0, "Watchdog");
172 /* smc91x reset */ 164 /* smc91x reset */
173 omap_request_gpio(7); 165 gpio_request(7, "SMC91x reset");
174 omap_set_gpio_direction(7, 0); 166 gpio_direction_output(7, 1);
175 omap_set_gpio_dataout(7, 1);
176 udelay(2); /* wait at least 100ns */ 167 udelay(2); /* wait at least 100ns */
177 omap_set_gpio_dataout(7, 0); 168 gpio_set_value(7, 0);
178 mdelay(50); /* 50ms until PHY ready */ 169 mdelay(50); /* 50ms until PHY ready */
179 /* smc91x interrupt pin */ 170 /* smc91x interrupt pin */
180 omap_request_gpio(8); 171 gpio_request(8, "SMC91x irq");
181 /* 16C554 reset*/ 172 /* 16C554 reset*/
182 omap_request_gpio(6); 173 gpio_request(6, "16C554 reset");
183 omap_set_gpio_direction(6, 0); 174 gpio_direction_output(6, 0);
184 omap_set_gpio_dataout(6, 0);
185 /* 16C554 interrupt pins */ 175 /* 16C554 interrupt pins */
186 omap_request_gpio(12); 176 gpio_request(12, "16C554 irq");
187 omap_request_gpio(13); 177 gpio_request(13, "16C554 irq");
188 omap_request_gpio(14); 178 gpio_request(14, "16C554 irq");
189 omap_request_gpio(15); 179 gpio_request(15, "16C554 irq");
190 set_irq_type(OMAP_GPIO_IRQ(12), IRQ_TYPE_EDGE_RISING); 180 set_irq_type(gpio_to_irq(12), IRQ_TYPE_EDGE_RISING);
191 set_irq_type(OMAP_GPIO_IRQ(13), IRQ_TYPE_EDGE_RISING); 181 set_irq_type(gpio_to_irq(13), IRQ_TYPE_EDGE_RISING);
192 set_irq_type(OMAP_GPIO_IRQ(14), IRQ_TYPE_EDGE_RISING); 182 set_irq_type(gpio_to_irq(14), IRQ_TYPE_EDGE_RISING);
193 set_irq_type(OMAP_GPIO_IRQ(15), IRQ_TYPE_EDGE_RISING); 183 set_irq_type(gpio_to_irq(15), IRQ_TYPE_EDGE_RISING);
194 184
195 platform_add_devices(voiceblue_devices, ARRAY_SIZE(voiceblue_devices)); 185 platform_add_devices(voiceblue_devices, ARRAY_SIZE(voiceblue_devices));
196 omap_board_config = voiceblue_config; 186 omap_board_config = voiceblue_config;
@@ -244,19 +234,18 @@ static int wdt_gpio_state;
244 234
245void voiceblue_wdt_enable(void) 235void voiceblue_wdt_enable(void)
246{ 236{
247 omap_set_gpio_direction(0, 0); 237 gpio_direction_output(0, 0);
248 omap_set_gpio_dataout(0, 0); 238 gpio_set_value(0, 1);
249 omap_set_gpio_dataout(0, 1); 239 gpio_set_value(0, 0);
250 omap_set_gpio_dataout(0, 0);
251 wdt_gpio_state = 0; 240 wdt_gpio_state = 0;
252} 241}
253 242
254void voiceblue_wdt_disable(void) 243void voiceblue_wdt_disable(void)
255{ 244{
256 omap_set_gpio_dataout(0, 0); 245 gpio_set_value(0, 0);
257 omap_set_gpio_dataout(0, 1); 246 gpio_set_value(0, 1);
258 omap_set_gpio_dataout(0, 0); 247 gpio_set_value(0, 0);
259 omap_set_gpio_direction(0, 1); 248 gpio_direction_input(0);
260} 249}
261 250
262void voiceblue_wdt_ping(void) 251void voiceblue_wdt_ping(void)
@@ -265,7 +254,7 @@ void voiceblue_wdt_ping(void)
265 return; 254 return;
266 255
267 wdt_gpio_state = !wdt_gpio_state; 256 wdt_gpio_state = !wdt_gpio_state;
268 omap_set_gpio_dataout(0, wdt_gpio_state); 257 gpio_set_value(0, wdt_gpio_state);
269} 258}
270 259
271void voiceblue_reset(void) 260void voiceblue_reset(void)
diff --git a/arch/arm/mach-omap1/clock.h b/arch/arm/mach-omap1/clock.h
index 5635b511ab6f..c1dcdf18d8dd 100644
--- a/arch/arm/mach-omap1/clock.h
+++ b/arch/arm/mach-omap1/clock.h
@@ -705,7 +705,6 @@ static struct clk bclk_16xx = {
705 705
706static struct clk mmc1_ck = { 706static struct clk mmc1_ck = {
707 .name = "mmc_ck", 707 .name = "mmc_ck",
708 .id = 1,
709 /* Functional clock is direct from ULPD, interface clock is ARMPER */ 708 /* Functional clock is direct from ULPD, interface clock is ARMPER */
710 .parent = &armper_ck.clk, 709 .parent = &armper_ck.clk,
711 .rate = 48000000, 710 .rate = 48000000,
@@ -720,7 +719,7 @@ static struct clk mmc1_ck = {
720 719
721static struct clk mmc2_ck = { 720static struct clk mmc2_ck = {
722 .name = "mmc_ck", 721 .name = "mmc_ck",
723 .id = 2, 722 .id = 1,
724 /* Functional clock is direct from ULPD, interface clock is ARMPER */ 723 /* Functional clock is direct from ULPD, interface clock is ARMPER */
725 .parent = &armper_ck.clk, 724 .parent = &armper_ck.clk,
726 .rate = 48000000, 725 .rate = 48000000,
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index e382b438c64e..77382d8b6b2f 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -22,6 +22,7 @@
22#include <mach/board.h> 22#include <mach/board.h>
23#include <mach/mux.h> 23#include <mach/mux.h>
24#include <mach/gpio.h> 24#include <mach/gpio.h>
25#include <mach/mmc.h>
25 26
26/*-------------------------------------------------------------------------*/ 27/*-------------------------------------------------------------------------*/
27 28
@@ -99,6 +100,95 @@ static inline void omap_init_mbox(void)
99static inline void omap_init_mbox(void) { } 100static inline void omap_init_mbox(void) { }
100#endif 101#endif
101 102
103/*-------------------------------------------------------------------------*/
104
105#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
106
107static inline void omap1_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
108 int controller_nr)
109{
110 if (controller_nr == 0) {
111 omap_cfg_reg(MMC_CMD);
112 omap_cfg_reg(MMC_CLK);
113 omap_cfg_reg(MMC_DAT0);
114 if (cpu_is_omap1710()) {
115 omap_cfg_reg(M15_1710_MMC_CLKI);
116 omap_cfg_reg(P19_1710_MMC_CMDDIR);
117 omap_cfg_reg(P20_1710_MMC_DATDIR0);
118 }
119 if (mmc_controller->slots[0].wires == 4) {
120 omap_cfg_reg(MMC_DAT1);
121 /* NOTE: DAT2 can be on W10 (here) or M15 */
122 if (!mmc_controller->slots[0].nomux)
123 omap_cfg_reg(MMC_DAT2);
124 omap_cfg_reg(MMC_DAT3);
125 }
126 }
127
128 /* Block 2 is on newer chips, and has many pinout options */
129 if (cpu_is_omap16xx() && controller_nr == 1) {
130 if (!mmc_controller->slots[1].nomux) {
131 omap_cfg_reg(Y8_1610_MMC2_CMD);
132 omap_cfg_reg(Y10_1610_MMC2_CLK);
133 omap_cfg_reg(R18_1610_MMC2_CLKIN);
134 omap_cfg_reg(W8_1610_MMC2_DAT0);
135 if (mmc_controller->slots[1].wires == 4) {
136 omap_cfg_reg(V8_1610_MMC2_DAT1);
137 omap_cfg_reg(W15_1610_MMC2_DAT2);
138 omap_cfg_reg(R10_1610_MMC2_DAT3);
139 }
140
141 /* These are needed for the level shifter */
142 omap_cfg_reg(V9_1610_MMC2_CMDDIR);
143 omap_cfg_reg(V5_1610_MMC2_DATDIR0);
144 omap_cfg_reg(W19_1610_MMC2_DATDIR1);
145 }
146
147 /* Feedback clock must be set on OMAP-1710 MMC2 */
148 if (cpu_is_omap1710())
149 omap_writel(omap_readl(MOD_CONF_CTRL_1) | (1 << 24),
150 MOD_CONF_CTRL_1);
151 }
152}
153
154void __init omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
155 int nr_controllers)
156{
157 int i;
158
159 for (i = 0; i < nr_controllers; i++) {
160 unsigned long base, size;
161 unsigned int irq = 0;
162
163 if (!mmc_data[i])
164 continue;
165
166 omap1_mmc_mux(mmc_data[i], i);
167
168 switch (i) {
169 case 0:
170 base = OMAP1_MMC1_BASE;
171 irq = INT_MMC;
172 break;
173 case 1:
174 if (!cpu_is_omap16xx())
175 return;
176 base = OMAP1_MMC2_BASE;
177 irq = INT_1610_MMC2;
178 break;
179 default:
180 continue;
181 }
182 size = OMAP1_MMC_SIZE;
183
184 omap_mmc_add(i, base, size, irq, mmc_data[i]);
185 };
186}
187
188#endif
189
190/*-------------------------------------------------------------------------*/
191
102#if defined(CONFIG_OMAP_STI) 192#if defined(CONFIG_OMAP_STI)
103 193
104#define OMAP1_STI_BASE 0xfffea000 194#define OMAP1_STI_BASE 0xfffea000
diff --git a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c
index 04995381aa5c..4f2b8a7adb19 100644
--- a/arch/arm/mach-omap1/fpga.c
+++ b/arch/arm/mach-omap1/fpga.c
@@ -177,9 +177,9 @@ void omap1510_fpga_init_irq(void)
177 * NOTE: For general GPIO/MPUIO access and interrupts, please see 177 * NOTE: For general GPIO/MPUIO access and interrupts, please see
178 * gpio.[ch] 178 * gpio.[ch]
179 */ 179 */
180 omap_request_gpio(13); 180 gpio_request(13, "FPGA irq");
181 omap_set_gpio_direction(13, 1); 181 gpio_direction_input(13);
182 set_irq_type(OMAP_GPIO_IRQ(13), IRQ_TYPE_EDGE_RISING); 182 set_irq_type(gpio_to_irq(13), IRQ_TYPE_EDGE_RISING);
183 set_irq_chained_handler(OMAP1510_INT_FPGA, innovator_fpga_IRQ_demux); 183 set_irq_chained_handler(OMAP1510_INT_FPGA, innovator_fpga_IRQ_demux);
184} 184}
185 185
diff --git a/arch/arm/mach-omap1/id.c b/arch/arm/mach-omap1/id.c
index 13083d7e692d..89bb8756f450 100644
--- a/arch/arm/mach-omap1/id.c
+++ b/arch/arm/mach-omap1/id.c
@@ -15,6 +15,7 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <mach/cpu.h>
18 19
19#define OMAP_DIE_ID_0 0xfffe1800 20#define OMAP_DIE_ID_0 0xfffe1800
20#define OMAP_DIE_ID_1 0xfffe1804 21#define OMAP_DIE_ID_1 0xfffe1804
@@ -30,6 +31,8 @@ struct omap_id {
30 u32 type; /* Cpu id bits [31:08], cpu class bits [07:00] */ 31 u32 type; /* Cpu id bits [31:08], cpu class bits [07:00] */
31}; 32};
32 33
34static unsigned int omap_revision;
35
33/* Register values to detect the OMAP version */ 36/* Register values to detect the OMAP version */
34static struct omap_id omap_ids[] __initdata = { 37static struct omap_id omap_ids[] __initdata = {
35 { .jtag_id = 0xb574, .die_rev = 0x2, .omap_id = 0x03310315, .type = 0x03100000}, 38 { .jtag_id = 0xb574, .die_rev = 0x2, .omap_id = 0x03310315, .type = 0x03100000},
@@ -53,6 +56,12 @@ static struct omap_id omap_ids[] __initdata = {
53 { .jtag_id = 0xb5f7, .die_rev = 0x2, .omap_id = 0x03330100, .type = 0x17100000}, 56 { .jtag_id = 0xb5f7, .die_rev = 0x2, .omap_id = 0x03330100, .type = 0x17100000},
54}; 57};
55 58
59unsigned int omap_rev(void)
60{
61 return omap_revision;
62}
63EXPORT_SYMBOL(omap_rev);
64
56/* 65/*
57 * Get OMAP type from PROD_ID. 66 * Get OMAP type from PROD_ID.
58 * 1710 has the PROD_ID in bits 15:00, not in 16:01 as documented in TRM. 67 * 1710 has the PROD_ID in bits 15:00, not in 16:01 as documented in TRM.
@@ -121,17 +130,18 @@ void __init omap_check_revision(void)
121 omap_id = omap_readl(OMAP32_ID_0); 130 omap_id = omap_readl(OMAP32_ID_0);
122 131
123#ifdef DEBUG 132#ifdef DEBUG
124 printk("OMAP_DIE_ID_0: 0x%08x\n", omap_readl(OMAP_DIE_ID_0)); 133 printk(KERN_DEBUG "OMAP_DIE_ID_0: 0x%08x\n", omap_readl(OMAP_DIE_ID_0));
125 printk("OMAP_DIE_ID_1: 0x%08x DIE_REV: %i\n", 134 printk(KERN_DEBUG "OMAP_DIE_ID_1: 0x%08x DIE_REV: %i\n",
126 omap_readl(OMAP_DIE_ID_1), 135 omap_readl(OMAP_DIE_ID_1),
127 (omap_readl(OMAP_DIE_ID_1) >> 17) & 0xf); 136 (omap_readl(OMAP_DIE_ID_1) >> 17) & 0xf);
128 printk("OMAP_PRODUCTION_ID_0: 0x%08x\n", omap_readl(OMAP_PRODUCTION_ID_0)); 137 printk(KERN_DEBUG "OMAP_PRODUCTION_ID_0: 0x%08x\n",
129 printk("OMAP_PRODUCTION_ID_1: 0x%08x JTAG_ID: 0x%04x\n", 138 omap_readl(OMAP_PRODUCTION_ID_0));
139 printk(KERN_DEBUG "OMAP_PRODUCTION_ID_1: 0x%08x JTAG_ID: 0x%04x\n",
130 omap_readl(OMAP_PRODUCTION_ID_1), 140 omap_readl(OMAP_PRODUCTION_ID_1),
131 omap_readl(OMAP_PRODUCTION_ID_1) & 0xffff); 141 omap_readl(OMAP_PRODUCTION_ID_1) & 0xffff);
132 printk("OMAP32_ID_0: 0x%08x\n", omap_readl(OMAP32_ID_0)); 142 printk(KERN_DEBUG "OMAP32_ID_0: 0x%08x\n", omap_readl(OMAP32_ID_0));
133 printk("OMAP32_ID_1: 0x%08x\n", omap_readl(OMAP32_ID_1)); 143 printk(KERN_DEBUG "OMAP32_ID_1: 0x%08x\n", omap_readl(OMAP32_ID_1));
134 printk("JTAG_ID: 0x%04x DIE_REV: %i\n", jtag_id, die_rev); 144 printk(KERN_DEBUG "JTAG_ID: 0x%04x DIE_REV: %i\n", jtag_id, die_rev);
135#endif 145#endif
136 146
137 system_serial_high = omap_readl(OMAP_DIE_ID_0); 147 system_serial_high = omap_readl(OMAP_DIE_ID_0);
@@ -140,7 +150,7 @@ void __init omap_check_revision(void)
140 /* First check only the major version in a safe way */ 150 /* First check only the major version in a safe way */
141 for (i = 0; i < ARRAY_SIZE(omap_ids); i++) { 151 for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
142 if (jtag_id == (omap_ids[i].jtag_id)) { 152 if (jtag_id == (omap_ids[i].jtag_id)) {
143 system_rev = omap_ids[i].type; 153 omap_revision = omap_ids[i].type;
144 break; 154 break;
145 } 155 }
146 } 156 }
@@ -148,7 +158,7 @@ void __init omap_check_revision(void)
148 /* Check if we can find the die revision */ 158 /* Check if we can find the die revision */
149 for (i = 0; i < ARRAY_SIZE(omap_ids); i++) { 159 for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
150 if (jtag_id == omap_ids[i].jtag_id && die_rev == omap_ids[i].die_rev) { 160 if (jtag_id == omap_ids[i].jtag_id && die_rev == omap_ids[i].die_rev) {
151 system_rev = omap_ids[i].type; 161 omap_revision = omap_ids[i].type;
152 break; 162 break;
153 } 163 }
154 } 164 }
@@ -158,38 +168,35 @@ void __init omap_check_revision(void)
158 if (jtag_id == omap_ids[i].jtag_id 168 if (jtag_id == omap_ids[i].jtag_id
159 && die_rev == omap_ids[i].die_rev 169 && die_rev == omap_ids[i].die_rev
160 && omap_id == omap_ids[i].omap_id) { 170 && omap_id == omap_ids[i].omap_id) {
161 system_rev = omap_ids[i].type; 171 omap_revision = omap_ids[i].type;
162 break; 172 break;
163 } 173 }
164 } 174 }
165 175
166 /* Add the cpu class info (7xx, 15xx, 16xx, 24xx) */ 176 /* Add the cpu class info (7xx, 15xx, 16xx, 24xx) */
167 cpu_type = system_rev >> 24; 177 cpu_type = omap_revision >> 24;
168 178
169 switch (cpu_type) { 179 switch (cpu_type) {
170 case 0x07: 180 case 0x07:
171 system_rev |= 0x07; 181 omap_revision |= 0x07;
172 break; 182 break;
173 case 0x03: 183 case 0x03:
174 case 0x15: 184 case 0x15:
175 system_rev |= 0x15; 185 omap_revision |= 0x15;
176 break; 186 break;
177 case 0x16: 187 case 0x16:
178 case 0x17: 188 case 0x17:
179 system_rev |= 0x16; 189 omap_revision |= 0x16;
180 break;
181 case 0x24:
182 system_rev |= 0x24;
183 break; 190 break;
184 default: 191 default:
185 printk("Unknown OMAP cpu type: 0x%02x\n", cpu_type); 192 printk(KERN_INFO "Unknown OMAP cpu type: 0x%02x\n", cpu_type);
186 } 193 }
187 194
188 printk("OMAP%04x", system_rev >> 16); 195 printk(KERN_INFO "OMAP%04x", omap_revision >> 16);
189 if ((system_rev >> 8) & 0xff) 196 if ((omap_revision >> 8) & 0xff)
190 printk("%x", (system_rev >> 8) & 0xff); 197 printk(KERN_INFO "%x", (omap_revision >> 8) & 0xff);
191 printk(" revision %i handled as %02xxx id: %08x%08x\n", 198 printk(KERN_INFO " revision %i handled as %02xxx id: %08x%08x\n",
192 die_rev, system_rev & 0xff, system_serial_low, 199 die_rev, omap_revision & 0xff, system_serial_low,
193 system_serial_high); 200 system_serial_high);
194} 201}
195 202
diff --git a/arch/arm/mach-omap1/leds-h2p2-debug.c b/arch/arm/mach-omap1/leds-h2p2-debug.c
index 71fe2cc7f7cf..17c9d0e04216 100644
--- a/arch/arm/mach-omap1/leds-h2p2-debug.c
+++ b/arch/arm/mach-omap1/leds-h2p2-debug.c
@@ -65,8 +65,8 @@ void h2p2_dbg_leds_event(led_event_t evt)
65 /* all leds off during suspend or shutdown */ 65 /* all leds off during suspend or shutdown */
66 66
67 if (! machine_is_omap_perseus2()) { 67 if (! machine_is_omap_perseus2()) {
68 omap_set_gpio_dataout(GPIO_TIMER, 0); 68 gpio_set_value(GPIO_TIMER, 0);
69 omap_set_gpio_dataout(GPIO_IDLE, 0); 69 gpio_set_value(GPIO_IDLE, 0);
70 } 70 }
71 71
72 __raw_writew(~0, &fpga->leds); 72 __raw_writew(~0, &fpga->leds);
@@ -94,7 +94,7 @@ void h2p2_dbg_leds_event(led_event_t evt)
94 if (machine_is_omap_perseus2()) 94 if (machine_is_omap_perseus2())
95 hw_led_state ^= H2P2_DBG_FPGA_P2_LED_TIMER; 95 hw_led_state ^= H2P2_DBG_FPGA_P2_LED_TIMER;
96 else { 96 else {
97 omap_set_gpio_dataout(GPIO_TIMER, led_state & LED_TIMER_ON); 97 gpio_set_value(GPIO_TIMER, led_state & LED_TIMER_ON);
98 goto done; 98 goto done;
99 } 99 }
100 100
@@ -106,7 +106,7 @@ void h2p2_dbg_leds_event(led_event_t evt)
106 if (machine_is_omap_perseus2()) 106 if (machine_is_omap_perseus2())
107 hw_led_state |= H2P2_DBG_FPGA_P2_LED_IDLE; 107 hw_led_state |= H2P2_DBG_FPGA_P2_LED_IDLE;
108 else { 108 else {
109 omap_set_gpio_dataout(GPIO_IDLE, 1); 109 gpio_set_value(GPIO_IDLE, 1);
110 goto done; 110 goto done;
111 } 111 }
112 112
@@ -116,7 +116,7 @@ void h2p2_dbg_leds_event(led_event_t evt)
116 if (machine_is_omap_perseus2()) 116 if (machine_is_omap_perseus2())
117 hw_led_state &= ~H2P2_DBG_FPGA_P2_LED_IDLE; 117 hw_led_state &= ~H2P2_DBG_FPGA_P2_LED_IDLE;
118 else { 118 else {
119 omap_set_gpio_dataout(GPIO_IDLE, 0); 119 gpio_set_value(GPIO_IDLE, 0);
120 goto done; 120 goto done;
121 } 121 }
122 122
diff --git a/arch/arm/mach-omap1/leds-osk.c b/arch/arm/mach-omap1/leds-osk.c
index 98e789622dfd..499d7ad8697d 100644
--- a/arch/arm/mach-omap1/leds-osk.c
+++ b/arch/arm/mach-omap1/leds-osk.c
@@ -44,8 +44,8 @@ static void mistral_setled(void)
44 green = 1; 44 green = 1;
45 /* else both sides are disabled */ 45 /* else both sides are disabled */
46 46
47 omap_set_gpio_dataout(GPIO_LED_GREEN, green); 47 gpio_set_value(GPIO_LED_GREEN, green);
48 omap_set_gpio_dataout(GPIO_LED_RED, red); 48 gpio_set_value(GPIO_LED_RED, red);
49} 49}
50 50
51#endif 51#endif
diff --git a/arch/arm/mach-omap1/leds.c b/arch/arm/mach-omap1/leds.c
index 6cdad93c4a00..8cbf2562dcaa 100644
--- a/arch/arm/mach-omap1/leds.c
+++ b/arch/arm/mach-omap1/leds.c
@@ -47,14 +47,14 @@ omap_leds_init(void)
47 * that's a different kind of LED (just one color at a time). 47 * that's a different kind of LED (just one color at a time).
48 */ 48 */
49 omap_cfg_reg(P18_1610_GPIO3); 49 omap_cfg_reg(P18_1610_GPIO3);
50 if (omap_request_gpio(3) == 0) 50 if (gpio_request(3, "LED red") == 0)
51 omap_set_gpio_direction(3, 0); 51 gpio_direction_output(3, 1);
52 else 52 else
53 printk(KERN_WARNING "LED: can't get GPIO3/red?\n"); 53 printk(KERN_WARNING "LED: can't get GPIO3/red?\n");
54 54
55 omap_cfg_reg(MPUIO4); 55 omap_cfg_reg(MPUIO4);
56 if (omap_request_gpio(OMAP_MPUIO(4)) == 0) 56 if (gpio_request(OMAP_MPUIO(4), "LED green") == 0)
57 omap_set_gpio_direction(OMAP_MPUIO(4), 0); 57 gpio_direction_output(OMAP_MPUIO(4), 1);
58 else 58 else
59 printk(KERN_WARNING "LED: can't get MPUIO4/green?\n"); 59 printk(KERN_WARNING "LED: can't get MPUIO4/green?\n");
60 } 60 }
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 770d256c790b..9774c1f5311e 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -226,7 +226,8 @@ void omap_pm_suspend(void)
226{ 226{
227 unsigned long arg0 = 0, arg1 = 0; 227 unsigned long arg0 = 0, arg1 = 0;
228 228
229 printk("PM: OMAP%x is trying to enter deep sleep...\n", system_rev); 229 printk(KERN_INFO "PM: OMAP%x is trying to enter deep sleep...\n",
230 omap_rev());
230 231
231 omap_serial_wake_trigger(1); 232 omap_serial_wake_trigger(1);
232 233
@@ -421,7 +422,8 @@ void omap_pm_suspend(void)
421 422
422 omap_serial_wake_trigger(0); 423 omap_serial_wake_trigger(0);
423 424
424 printk("PM: OMAP%x is re-starting from deep sleep...\n", system_rev); 425 printk(KERN_INFO "PM: OMAP%x is re-starting from deep sleep...\n",
426 omap_rev());
425} 427}
426 428
427#if defined(DEBUG) && defined(CONFIG_PROC_FS) 429#if defined(DEBUG) && defined(CONFIG_PROC_FS)
diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
index 528691d5cb51..0002084e0655 100644
--- a/arch/arm/mach-omap1/serial.c
+++ b/arch/arm/mach-omap1/serial.c
@@ -244,22 +244,22 @@ static void __init omap_serial_set_port_wakeup(int gpio_nr)
244{ 244{
245 int ret; 245 int ret;
246 246
247 ret = omap_request_gpio(gpio_nr); 247 ret = gpio_request(gpio_nr, "UART wake");
248 if (ret < 0) { 248 if (ret < 0) {
249 printk(KERN_ERR "Could not request UART wake GPIO: %i\n", 249 printk(KERN_ERR "Could not request UART wake GPIO: %i\n",
250 gpio_nr); 250 gpio_nr);
251 return; 251 return;
252 } 252 }
253 omap_set_gpio_direction(gpio_nr, 1); 253 gpio_direction_input(gpio_nr);
254 ret = request_irq(OMAP_GPIO_IRQ(gpio_nr), &omap_serial_wake_interrupt, 254 ret = request_irq(gpio_to_irq(gpio_nr), &omap_serial_wake_interrupt,
255 IRQF_TRIGGER_RISING, "serial wakeup", NULL); 255 IRQF_TRIGGER_RISING, "serial wakeup", NULL);
256 if (ret) { 256 if (ret) {
257 omap_free_gpio(gpio_nr); 257 gpio_free(gpio_nr);
258 printk(KERN_ERR "No interrupt for UART wake GPIO: %i\n", 258 printk(KERN_ERR "No interrupt for UART wake GPIO: %i\n",
259 gpio_nr); 259 gpio_nr);
260 return; 260 return;
261 } 261 }
262 enable_irq_wake(OMAP_GPIO_IRQ(gpio_nr)); 262 enable_irq_wake(gpio_to_irq(gpio_nr));
263} 263}
264 264
265static int __init omap_serial_wakeup_init(void) 265static int __init omap_serial_wakeup_init(void)
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index 2cf7e32bd293..495a32c287b4 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -173,7 +173,7 @@ static __init void omap_init_mpu_timer(unsigned long rate)
173 clockevent_mpu_timer1.min_delta_ns = 173 clockevent_mpu_timer1.min_delta_ns =
174 clockevent_delta2ns(1, &clockevent_mpu_timer1); 174 clockevent_delta2ns(1, &clockevent_mpu_timer1);
175 175
176 clockevent_mpu_timer1.cpumask = cpumask_of_cpu(0); 176 clockevent_mpu_timer1.cpumask = cpumask_of(0);
177 clockevents_register_device(&clockevent_mpu_timer1); 177 clockevents_register_device(&clockevent_mpu_timer1);
178} 178}
179 179
diff --git a/arch/arm/mach-omap1/timer32k.c b/arch/arm/mach-omap1/timer32k.c
index 705367ece174..fd3f7396e162 100644
--- a/arch/arm/mach-omap1/timer32k.c
+++ b/arch/arm/mach-omap1/timer32k.c
@@ -187,7 +187,7 @@ static __init void omap_init_32k_timer(void)
187 clockevent_32k_timer.min_delta_ns = 187 clockevent_32k_timer.min_delta_ns =
188 clockevent_delta2ns(1, &clockevent_32k_timer); 188 clockevent_delta2ns(1, &clockevent_32k_timer);
189 189
190 clockevent_32k_timer.cpumask = cpumask_of_cpu(0); 190 clockevent_32k_timer.cpumask = cpumask_of(0);
191 clockevents_register_device(&clockevent_32k_timer); 191 clockevents_register_device(&clockevent_32k_timer);
192} 192}
193 193
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 4832fcc7d04a..3754b79092ab 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -55,3 +55,7 @@ config MACH_OMAP_LDP
55config MACH_OVERO 55config MACH_OVERO
56 bool "Gumstix Overo board" 56 bool "Gumstix Overo board"
57 depends on ARCH_OMAP3 && ARCH_OMAP34XX 57 depends on ARCH_OMAP3 && ARCH_OMAP34XX
58
59config MACH_OMAP3_PANDORA
60 bool "OMAP3 Pandora"
61 depends on ARCH_OMAP3 && ARCH_OMAP34XX \ No newline at end of file
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index c69392372c99..bbd12bc10fdc 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -27,9 +27,15 @@ obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o
27# Specific board support 27# Specific board support
28obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o 28obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o
29obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o 29obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o
30obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o 30obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o \
31 mmc-twl4030.o
31obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o 32obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o
32obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o 33obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o \
33obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o 34 mmc-twl4030.o
34obj-$(CONFIG_MACH_OVERO) += board-overo.o 35obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o \
36 mmc-twl4030.o
37obj-$(CONFIG_MACH_OVERO) += board-overo.o \
38 mmc-twl4030.o
39obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o \
40 mmc-twl4030.o
35 41
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index 24688efaa445..83fa37211d77 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -19,6 +19,7 @@
19#include <linux/mtd/mtd.h> 19#include <linux/mtd/mtd.h>
20#include <linux/mtd/partitions.h> 20#include <linux/mtd/partitions.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/i2c/twl4030.h>
22#include <linux/err.h> 23#include <linux/err.h>
23#include <linux/clk.h> 24#include <linux/clk.h>
24#include <linux/io.h> 25#include <linux/io.h>
@@ -35,6 +36,7 @@
35#include <mach/common.h> 36#include <mach/common.h>
36#include <mach/gpmc.h> 37#include <mach/gpmc.h>
37 38
39#include "mmc-twl4030.h"
38 40
39#define SDP2430_FLASH_CS 0 41#define SDP2430_FLASH_CS 0
40#define SDP2430_SMC91X_CS 5 42#define SDP2430_SMC91X_CS 5
@@ -168,13 +170,13 @@ static inline void __init sdp2430_init_smc91x(void)
168 sdp2430_smc91x_resources[0].end = cs_mem_base + 0x30f; 170 sdp2430_smc91x_resources[0].end = cs_mem_base + 0x30f;
169 udelay(100); 171 udelay(100);
170 172
171 if (omap_request_gpio(OMAP24XX_ETHR_GPIO_IRQ) < 0) { 173 if (gpio_request(OMAP24XX_ETHR_GPIO_IRQ, "SMC91x irq") < 0) {
172 printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", 174 printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
173 OMAP24XX_ETHR_GPIO_IRQ); 175 OMAP24XX_ETHR_GPIO_IRQ);
174 gpmc_cs_free(eth_cs); 176 gpmc_cs_free(eth_cs);
175 goto out; 177 goto out;
176 } 178 }
177 omap_set_gpio_direction(OMAP24XX_ETHR_GPIO_IRQ, 1); 179 gpio_direction_input(OMAP24XX_ETHR_GPIO_IRQ);
178 180
179out: 181out:
180 clk_disable(gpmc_fck); 182 clk_disable(gpmc_fck);
@@ -197,12 +199,58 @@ static struct omap_board_config_kernel sdp2430_config[] = {
197 {OMAP_TAG_UART, &sdp2430_uart_config}, 199 {OMAP_TAG_UART, &sdp2430_uart_config},
198}; 200};
199 201
202
203static struct twl4030_gpio_platform_data sdp2430_gpio_data = {
204 .gpio_base = OMAP_MAX_GPIO_LINES,
205 .irq_base = TWL4030_GPIO_IRQ_BASE,
206 .irq_end = TWL4030_GPIO_IRQ_END,
207};
208
209static struct twl4030_platform_data sdp2430_twldata = {
210 .irq_base = TWL4030_IRQ_BASE,
211 .irq_end = TWL4030_IRQ_END,
212
213 /* platform_data for children goes here */
214 .gpio = &sdp2430_gpio_data,
215};
216
217static struct i2c_board_info __initdata sdp2430_i2c_boardinfo[] = {
218 {
219 I2C_BOARD_INFO("twl4030", 0x48),
220 .flags = I2C_CLIENT_WAKE,
221 .irq = INT_24XX_SYS_NIRQ,
222 .platform_data = &sdp2430_twldata,
223 },
224};
225
226static int __init omap2430_i2c_init(void)
227{
228 omap_register_i2c_bus(1, 400, NULL, 0);
229 omap_register_i2c_bus(2, 2600, sdp2430_i2c_boardinfo,
230 ARRAY_SIZE(sdp2430_i2c_boardinfo));
231 return 0;
232}
233
234static struct twl4030_hsmmc_info mmc[] __initdata = {
235 {
236 .mmc = 1,
237 .wires = 4,
238 .gpio_cd = -EINVAL,
239 .gpio_wp = -EINVAL,
240 .ext_clock = 1,
241 },
242 {} /* Terminator */
243};
244
200static void __init omap_2430sdp_init(void) 245static void __init omap_2430sdp_init(void)
201{ 246{
247 omap2430_i2c_init();
248
202 platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices)); 249 platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices));
203 omap_board_config = sdp2430_config; 250 omap_board_config = sdp2430_config;
204 omap_board_config_size = ARRAY_SIZE(sdp2430_config); 251 omap_board_config_size = ARRAY_SIZE(sdp2430_config);
205 omap_serial_init(); 252 omap_serial_init();
253 twl4030_mmc_init(mmc);
206} 254}
207 255
208static void __init omap_2430sdp_map_io(void) 256static void __init omap_2430sdp_map_io(void)
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index 989ad152d7f8..bf1e5d32c2a3 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -236,13 +236,13 @@ static inline void __init apollon_init_smc91x(void)
236 udelay(100); 236 udelay(100);
237 237
238 omap_cfg_reg(W4__24XX_GPIO74); 238 omap_cfg_reg(W4__24XX_GPIO74);
239 if (omap_request_gpio(APOLLON_ETHR_GPIO_IRQ) < 0) { 239 if (gpio_request(APOLLON_ETHR_GPIO_IRQ, "SMC91x irq") < 0) {
240 printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", 240 printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
241 APOLLON_ETHR_GPIO_IRQ); 241 APOLLON_ETHR_GPIO_IRQ);
242 gpmc_cs_free(APOLLON_ETH_CS); 242 gpmc_cs_free(APOLLON_ETH_CS);
243 goto out; 243 goto out;
244 } 244 }
245 omap_set_gpio_direction(APOLLON_ETHR_GPIO_IRQ, 1); 245 gpio_direction_input(APOLLON_ETHR_GPIO_IRQ);
246 246
247out: 247out:
248 clk_disable(gpmc_fck); 248 clk_disable(gpmc_fck);
@@ -261,16 +261,6 @@ static struct omap_uart_config apollon_uart_config __initdata = {
261 .enabled_uarts = (1 << 0) | (0 << 1) | (0 << 2), 261 .enabled_uarts = (1 << 0) | (0 << 1) | (0 << 2),
262}; 262};
263 263
264static struct omap_mmc_config apollon_mmc_config __initdata = {
265 .mmc [0] = {
266 .enabled = 1,
267 .wire4 = 1,
268 .wp_pin = -1,
269 .power_pin = -1,
270 .switch_pin = -1,
271 },
272};
273
274static struct omap_usb_config apollon_usb_config __initdata = { 264static struct omap_usb_config apollon_usb_config __initdata = {
275 .register_dev = 1, 265 .register_dev = 1,
276 .hmc_mode = 0x14, /* 0:dev 1:host1 2:disable */ 266 .hmc_mode = 0x14, /* 0:dev 1:host1 2:disable */
@@ -284,7 +274,6 @@ static struct omap_lcd_config apollon_lcd_config __initdata = {
284 274
285static struct omap_board_config_kernel apollon_config[] = { 275static struct omap_board_config_kernel apollon_config[] = {
286 { OMAP_TAG_UART, &apollon_uart_config }, 276 { OMAP_TAG_UART, &apollon_uart_config },
287 { OMAP_TAG_MMC, &apollon_mmc_config },
288 { OMAP_TAG_USB, &apollon_usb_config }, 277 { OMAP_TAG_USB, &apollon_usb_config },
289 { OMAP_TAG_LCD, &apollon_lcd_config }, 278 { OMAP_TAG_LCD, &apollon_lcd_config },
290}; 279};
@@ -327,15 +316,15 @@ static void __init apollon_sw_init(void)
327 /* Enter SW - Y11 */ 316 /* Enter SW - Y11 */
328 omap_cfg_reg(Y11_242X_GPIO16); 317 omap_cfg_reg(Y11_242X_GPIO16);
329 omap_request_gpio(SW_ENTER_GPIO16); 318 omap_request_gpio(SW_ENTER_GPIO16);
330 omap_set_gpio_direction(SW_ENTER_GPIO16, 1); 319 gpio_direction_input(SW_ENTER_GPIO16);
331 /* Up SW - AA12 */ 320 /* Up SW - AA12 */
332 omap_cfg_reg(AA12_242X_GPIO17); 321 omap_cfg_reg(AA12_242X_GPIO17);
333 omap_request_gpio(SW_UP_GPIO17); 322 omap_request_gpio(SW_UP_GPIO17);
334 omap_set_gpio_direction(SW_UP_GPIO17, 1); 323 gpio_direction_input(SW_UP_GPIO17);
335 /* Down SW - AA8 */ 324 /* Down SW - AA8 */
336 omap_cfg_reg(AA8_242X_GPIO58); 325 omap_cfg_reg(AA8_242X_GPIO58);
337 omap_request_gpio(SW_DOWN_GPIO58); 326 omap_request_gpio(SW_DOWN_GPIO58);
338 omap_set_gpio_direction(SW_DOWN_GPIO58, 1); 327 gpio_direction_input(SW_DOWN_GPIO58);
339 328
340 set_irq_type(OMAP_GPIO_IRQ(SW_ENTER_GPIO16), IRQ_TYPE_EDGE_RISING); 329 set_irq_type(OMAP_GPIO_IRQ(SW_ENTER_GPIO16), IRQ_TYPE_EDGE_RISING);
341 if (request_irq(OMAP_GPIO_IRQ(SW_ENTER_GPIO16), &apollon_sw_interrupt, 330 if (request_irq(OMAP_GPIO_IRQ(SW_ENTER_GPIO16), &apollon_sw_interrupt,
@@ -359,9 +348,8 @@ static void __init apollon_usb_init(void)
359 /* USB device */ 348 /* USB device */
360 /* DEVICE_SUSPEND */ 349 /* DEVICE_SUSPEND */
361 omap_cfg_reg(P21_242X_GPIO12); 350 omap_cfg_reg(P21_242X_GPIO12);
362 omap_request_gpio(12); 351 gpio_request(12, "USB suspend");
363 omap_set_gpio_direction(12, 0); /* OUT */ 352 gpio_direction_output(12, 0);
364 omap_set_gpio_dataout(12, 0);
365} 353}
366 354
367static void __init omap_apollon_init(void) 355static void __init omap_apollon_init(void)
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 9ba097868e72..3b34c20d1df4 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -41,19 +41,8 @@ static struct omap_uart_config generic_uart_config __initdata = {
41 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), 41 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
42}; 42};
43 43
44static struct omap_mmc_config generic_mmc_config __initdata = {
45 .mmc [0] = {
46 .enabled = 0,
47 .wire4 = 0,
48 .wp_pin = -1,
49 .power_pin = -1,
50 .switch_pin = -1,
51 },
52};
53
54static struct omap_board_config_kernel generic_config[] = { 44static struct omap_board_config_kernel generic_config[] = {
55 { OMAP_TAG_UART, &generic_uart_config }, 45 { OMAP_TAG_UART, &generic_uart_config },
56 { OMAP_TAG_MMC, &generic_mmc_config },
57}; 46};
58 47
59static void __init omap_generic_init(void) 48static void __init omap_generic_init(void)
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 2fef2c845083..5e9b14675b1e 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -19,6 +19,7 @@
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/workqueue.h> 20#include <linux/workqueue.h>
21#include <linux/i2c.h> 21#include <linux/i2c.h>
22#include <linux/i2c/at24.h>
22#include <linux/input.h> 23#include <linux/input.h>
23#include <linux/err.h> 24#include <linux/err.h>
24#include <linux/clk.h> 25#include <linux/clk.h>
@@ -372,31 +373,33 @@ static struct omap_uart_config h4_uart_config __initdata = {
372 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), 373 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
373}; 374};
374 375
375static struct omap_mmc_config h4_mmc_config __initdata = {
376 .mmc [0] = {
377 .enabled = 1,
378 .wire4 = 1,
379 .wp_pin = -1,
380 .power_pin = -1,
381 .switch_pin = -1,
382 },
383};
384
385static struct omap_lcd_config h4_lcd_config __initdata = { 376static struct omap_lcd_config h4_lcd_config __initdata = {
386 .ctrl_name = "internal", 377 .ctrl_name = "internal",
387}; 378};
388 379
389static struct omap_board_config_kernel h4_config[] = { 380static struct omap_board_config_kernel h4_config[] = {
390 { OMAP_TAG_UART, &h4_uart_config }, 381 { OMAP_TAG_UART, &h4_uart_config },
391 { OMAP_TAG_MMC, &h4_mmc_config },
392 { OMAP_TAG_LCD, &h4_lcd_config }, 382 { OMAP_TAG_LCD, &h4_lcd_config },
393}; 383};
394 384
385static struct at24_platform_data m24c01 = {
386 .byte_len = SZ_1K / 8,
387 .page_size = 16,
388};
389
395static struct i2c_board_info __initdata h4_i2c_board_info[] = { 390static struct i2c_board_info __initdata h4_i2c_board_info[] = {
396 { 391 {
397 I2C_BOARD_INFO("isp1301_omap", 0x2d), 392 I2C_BOARD_INFO("isp1301_omap", 0x2d),
398 .irq = OMAP_GPIO_IRQ(125), 393 .irq = OMAP_GPIO_IRQ(125),
399 }, 394 },
395 { /* EEPROM on mainboard */
396 I2C_BOARD_INFO("24c01", 0x52),
397 .platform_data = &m24c01,
398 },
399 { /* EEPROM on cpu card */
400 I2C_BOARD_INFO("24c01", 0x57),
401 .platform_data = &m24c01,
402 },
400}; 403};
401 404
402static void __init omap_h4_init(void) 405static void __init omap_h4_init(void)
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index 1ea59986aa7a..aa6972781e4a 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -21,6 +21,7 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/spi/spi.h> 22#include <linux/spi/spi.h>
23#include <linux/spi/ads7846.h> 23#include <linux/spi/ads7846.h>
24#include <linux/i2c/twl4030.h>
24 25
25#include <mach/hardware.h> 26#include <mach/hardware.h>
26#include <asm/mach-types.h> 27#include <asm/mach-types.h>
@@ -38,11 +39,69 @@
38#include <asm/delay.h> 39#include <asm/delay.h>
39#include <mach/control.h> 40#include <mach/control.h>
40 41
42#include "mmc-twl4030.h"
43
44#define SDP3430_SMC91X_CS 3
45
46static struct resource ldp_smc911x_resources[] = {
47 [0] = {
48 .start = OMAP34XX_ETHR_START,
49 .end = OMAP34XX_ETHR_START + SZ_4K,
50 .flags = IORESOURCE_MEM,
51 },
52 [1] = {
53 .start = 0,
54 .end = 0,
55 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
56 },
57};
58
59static struct platform_device ldp_smc911x_device = {
60 .name = "smc911x",
61 .id = -1,
62 .num_resources = ARRAY_SIZE(ldp_smc911x_resources),
63 .resource = ldp_smc911x_resources,
64};
65
66static struct platform_device *ldp_devices[] __initdata = {
67 &ldp_smc911x_device,
68};
69
70static inline void __init ldp_init_smc911x(void)
71{
72 int eth_cs;
73 unsigned long cs_mem_base;
74 int eth_gpio = 0;
75
76 eth_cs = LDP_SMC911X_CS;
77
78 if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
79 printk(KERN_ERR "Failed to request GPMC mem for smc911x\n");
80 return;
81 }
82
83 ldp_smc911x_resources[0].start = cs_mem_base + 0x0;
84 ldp_smc911x_resources[0].end = cs_mem_base + 0xf;
85 udelay(100);
86
87 eth_gpio = LDP_SMC911X_GPIO;
88
89 ldp_smc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio);
90
91 if (omap_request_gpio(eth_gpio) < 0) {
92 printk(KERN_ERR "Failed to request GPIO%d for smc911x IRQ\n",
93 eth_gpio);
94 return;
95 }
96 gpio_direction_input(eth_gpio);
97}
98
41static void __init omap_ldp_init_irq(void) 99static void __init omap_ldp_init_irq(void)
42{ 100{
43 omap2_init_common_hw(); 101 omap2_init_common_hw();
44 omap_init_irq(); 102 omap_init_irq();
45 omap_gpio_init(); 103 omap_gpio_init();
104 ldp_init_smc911x();
46} 105}
47 106
48static struct omap_uart_config ldp_uart_config __initdata = { 107static struct omap_uart_config ldp_uart_config __initdata = {
@@ -53,20 +112,56 @@ static struct omap_board_config_kernel ldp_config[] __initdata = {
53 { OMAP_TAG_UART, &ldp_uart_config }, 112 { OMAP_TAG_UART, &ldp_uart_config },
54}; 113};
55 114
115static struct twl4030_gpio_platform_data ldp_gpio_data = {
116 .gpio_base = OMAP_MAX_GPIO_LINES,
117 .irq_base = TWL4030_GPIO_IRQ_BASE,
118 .irq_end = TWL4030_GPIO_IRQ_END,
119};
120
121static struct twl4030_platform_data ldp_twldata = {
122 .irq_base = TWL4030_IRQ_BASE,
123 .irq_end = TWL4030_IRQ_END,
124
125 /* platform_data for children goes here */
126 .gpio = &ldp_gpio_data,
127};
128
129static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = {
130 {
131 I2C_BOARD_INFO("twl4030", 0x48),
132 .flags = I2C_CLIENT_WAKE,
133 .irq = INT_34XX_SYS_NIRQ,
134 .platform_data = &ldp_twldata,
135 },
136};
137
56static int __init omap_i2c_init(void) 138static int __init omap_i2c_init(void)
57{ 139{
58 omap_register_i2c_bus(1, 2600, NULL, 0); 140 omap_register_i2c_bus(1, 2600, ldp_i2c_boardinfo,
141 ARRAY_SIZE(ldp_i2c_boardinfo));
59 omap_register_i2c_bus(2, 400, NULL, 0); 142 omap_register_i2c_bus(2, 400, NULL, 0);
60 omap_register_i2c_bus(3, 400, NULL, 0); 143 omap_register_i2c_bus(3, 400, NULL, 0);
61 return 0; 144 return 0;
62} 145}
63 146
147static struct twl4030_hsmmc_info mmc[] __initdata = {
148 {
149 .mmc = 1,
150 .wires = 4,
151 .gpio_cd = -EINVAL,
152 .gpio_wp = -EINVAL,
153 },
154 {} /* Terminator */
155};
156
64static void __init omap_ldp_init(void) 157static void __init omap_ldp_init(void)
65{ 158{
66 omap_i2c_init(); 159 omap_i2c_init();
160 platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices));
67 omap_board_config = ldp_config; 161 omap_board_config = ldp_config;
68 omap_board_config_size = ARRAY_SIZE(ldp_config); 162 omap_board_config_size = ARRAY_SIZE(ldp_config);
69 omap_serial_init(); 163 omap_serial_init();
164 twl4030_mmc_init(mmc);
70} 165}
71 166
72static void __init omap_ldp_map_io(void) 167static void __init omap_ldp_map_io(void)
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index baa79674e9d5..9e5ada01b5fa 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -38,7 +38,9 @@
38#include <mach/common.h> 38#include <mach/common.h>
39#include <mach/gpmc.h> 39#include <mach/gpmc.h>
40#include <mach/nand.h> 40#include <mach/nand.h>
41#include <mach/mux.h>
41 42
43#include "mmc-twl4030.h"
42 44
43#define GPMC_CS0_BASE 0x60 45#define GPMC_CS0_BASE 0x60
44#define GPMC_CS_SIZE 0x30 46#define GPMC_CS_SIZE 0x30
@@ -103,6 +105,78 @@ static struct omap_uart_config omap3_beagle_uart_config __initdata = {
103 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), 105 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
104}; 106};
105 107
108static struct twl4030_hsmmc_info mmc[] = {
109 {
110 .mmc = 1,
111 .wires = 8,
112 .gpio_wp = 29,
113 },
114 {} /* Terminator */
115};
116
117static struct gpio_led gpio_leds[];
118
119static int beagle_twl_gpio_setup(struct device *dev,
120 unsigned gpio, unsigned ngpio)
121{
122 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
123
124 /* REVISIT: need ehci-omap hooks for external VBUS
125 * power switch and overcurrent detect
126 */
127
128 gpio_request(gpio + 1, "EHCI_nOC");
129 gpio_direction_input(gpio + 1);
130
131 /* TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, active low) */
132 gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR");
133 gpio_direction_output(gpio + TWL4030_GPIO_MAX, 1);
134
135 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
136 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
137
138 return 0;
139}
140
141static struct twl4030_gpio_platform_data beagle_gpio_data = {
142 .gpio_base = OMAP_MAX_GPIO_LINES,
143 .irq_base = TWL4030_GPIO_IRQ_BASE,
144 .irq_end = TWL4030_GPIO_IRQ_END,
145 .use_leds = true,
146 .pullups = BIT(1),
147 .pulldowns = BIT(2) | BIT(6) | BIT(7) | BIT(8) | BIT(13)
148 | BIT(15) | BIT(16) | BIT(17),
149 .setup = beagle_twl_gpio_setup,
150};
151
152static struct twl4030_platform_data beagle_twldata = {
153 .irq_base = TWL4030_IRQ_BASE,
154 .irq_end = TWL4030_IRQ_END,
155
156 /* platform_data for children goes here */
157 .gpio = &beagle_gpio_data,
158};
159
160static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = {
161 {
162 I2C_BOARD_INFO("twl4030", 0x48),
163 .flags = I2C_CLIENT_WAKE,
164 .irq = INT_34XX_SYS_NIRQ,
165 .platform_data = &beagle_twldata,
166 },
167};
168
169static int __init omap3_beagle_i2c_init(void)
170{
171 omap_register_i2c_bus(1, 2600, beagle_i2c_boardinfo,
172 ARRAY_SIZE(beagle_i2c_boardinfo));
173#ifdef CONFIG_I2C2_OMAP_BEAGLE
174 omap_register_i2c_bus(2, 400, NULL, 0);
175#endif
176 omap_register_i2c_bus(3, 400, NULL, 0);
177 return 0;
178}
179
106static void __init omap3_beagle_init_irq(void) 180static void __init omap3_beagle_init_irq(void)
107{ 181{
108 omap2_init_common_hw(); 182 omap2_init_common_hw();
@@ -130,6 +204,11 @@ static struct gpio_led gpio_leds[] = {
130 .default_trigger = "mmc0", 204 .default_trigger = "mmc0",
131 .gpio = 149, 205 .gpio = 149,
132 }, 206 },
207 {
208 .name = "beagleboard::pmu_stat",
209 .gpio = -EINVAL, /* gets replaced */
210 .active_low = true,
211 },
133}; 212};
134 213
135static struct gpio_led_platform_data gpio_led_info = { 214static struct gpio_led_platform_data gpio_led_info = {
@@ -218,11 +297,22 @@ static void __init omap3beagle_flash_init(void)
218 297
219static void __init omap3_beagle_init(void) 298static void __init omap3_beagle_init(void)
220{ 299{
300 omap3_beagle_i2c_init();
221 platform_add_devices(omap3_beagle_devices, 301 platform_add_devices(omap3_beagle_devices,
222 ARRAY_SIZE(omap3_beagle_devices)); 302 ARRAY_SIZE(omap3_beagle_devices));
223 omap_board_config = omap3_beagle_config; 303 omap_board_config = omap3_beagle_config;
224 omap_board_config_size = ARRAY_SIZE(omap3_beagle_config); 304 omap_board_config_size = ARRAY_SIZE(omap3_beagle_config);
225 omap_serial_init(); 305 omap_serial_init();
306
307 omap_cfg_reg(AH8_34XX_GPIO29);
308 mmc[0].gpio_cd = gpio + 0;
309 twl4030_mmc_init(mmc);
310
311 omap_cfg_reg(J25_34XX_GPIO170);
312 gpio_request(170, "DVI_nPD");
313 /* REVISIT leave DVI powered down until it's needed ... */
314 gpio_direction_output(170, true);
315
226 omap3beagle_flash_init(); 316 omap3beagle_flash_init();
227} 317}
228 318
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
new file mode 100644
index 000000000000..b3196107afdb
--- /dev/null
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -0,0 +1,212 @@
1/*
2 * board-omap3pandora.c (Pandora Handheld Console)
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 * version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * 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 St, Fifth Floor, Boston, MA
16 * 02110-1301 USA
17 *
18 */
19
20#include <linux/init.h>
21#include <linux/kernel.h>
22#include <linux/platform_device.h>
23
24#include <linux/spi/spi.h>
25#include <linux/spi/ads7846.h>
26#include <linux/i2c/twl4030.h>
27
28#include <asm/mach-types.h>
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31
32#include <mach/board.h>
33#include <mach/common.h>
34#include <mach/gpio.h>
35#include <mach/hardware.h>
36#include <mach/mcspi.h>
37
38#include "mmc-twl4030.h"
39
40#define OMAP3_PANDORA_TS_GPIO 94
41
42static struct twl4030_hsmmc_info omap3pandora_mmc[] = {
43 {
44 .mmc = 1,
45 .wires = 4,
46 .gpio_cd = -EINVAL,
47 .gpio_wp = 126,
48 .ext_clock = 0,
49 },
50 {
51 .mmc = 2,
52 .wires = 4,
53 .gpio_cd = -EINVAL,
54 .gpio_wp = 127,
55 .ext_clock = 1,
56 },
57 {} /* Terminator */
58};
59
60static struct omap_uart_config omap3pandora_uart_config __initdata = {
61 .enabled_uarts = (1 << 2), /* UART3 */
62};
63
64static int omap3pandora_twl_gpio_setup(struct device *dev,
65 unsigned gpio, unsigned ngpio)
66{
67 /* gpio + {0,1} is "mmc{0,1}_cd" (input/IRQ) */
68 omap3pandora_mmc[0].gpio_cd = gpio + 0;
69 omap3pandora_mmc[1].gpio_cd = gpio + 1;
70 twl4030_mmc_init(omap3pandora_mmc);
71
72 return 0;
73}
74
75static struct twl4030_gpio_platform_data omap3pandora_gpio_data = {
76 .gpio_base = OMAP_MAX_GPIO_LINES,
77 .irq_base = TWL4030_GPIO_IRQ_BASE,
78 .irq_end = TWL4030_GPIO_IRQ_END,
79 .setup = omap3pandora_twl_gpio_setup,
80};
81
82static struct twl4030_usb_data omap3pandora_usb_data = {
83 .usb_mode = T2_USB_MODE_ULPI,
84};
85
86static struct twl4030_platform_data omap3pandora_twldata = {
87 .irq_base = TWL4030_IRQ_BASE,
88 .irq_end = TWL4030_IRQ_END,
89 .gpio = &omap3pandora_gpio_data,
90 .usb = &omap3pandora_usb_data,
91};
92
93static struct i2c_board_info __initdata omap3pandora_i2c_boardinfo[] = {
94 {
95 I2C_BOARD_INFO("tps65950", 0x48),
96 .flags = I2C_CLIENT_WAKE,
97 .irq = INT_34XX_SYS_NIRQ,
98 .platform_data = &omap3pandora_twldata,
99 },
100};
101
102static int __init omap3pandora_i2c_init(void)
103{
104 omap_register_i2c_bus(1, 2600, omap3pandora_i2c_boardinfo,
105 ARRAY_SIZE(omap3pandora_i2c_boardinfo));
106 /* i2c2 pins are not connected */
107 omap_register_i2c_bus(3, 400, NULL, 0);
108 return 0;
109}
110
111static void __init omap3pandora_init_irq(void)
112{
113 omap2_init_common_hw();
114 omap_init_irq();
115 omap_gpio_init();
116}
117
118static void __init omap3pandora_ads7846_init(void)
119{
120 int gpio = OMAP3_PANDORA_TS_GPIO;
121 int ret;
122
123 ret = gpio_request(gpio, "ads7846_pen_down");
124 if (ret < 0) {
125 printk(KERN_ERR "Failed to request GPIO %d for "
126 "ads7846 pen down IRQ\n", gpio);
127 return;
128 }
129
130 gpio_direction_input(gpio);
131}
132
133static int ads7846_get_pendown_state(void)
134{
135 return !gpio_get_value(OMAP3_PANDORA_TS_GPIO);
136}
137
138static struct ads7846_platform_data ads7846_config = {
139 .x_max = 0x0fff,
140 .y_max = 0x0fff,
141 .x_plate_ohms = 180,
142 .pressure_max = 255,
143 .debounce_max = 10,
144 .debounce_tol = 3,
145 .debounce_rep = 1,
146 .get_pendown_state = ads7846_get_pendown_state,
147 .keep_vref_on = 1,
148};
149
150static struct omap2_mcspi_device_config ads7846_mcspi_config = {
151 .turbo_mode = 0,
152 .single_channel = 1, /* 0: slave, 1: master */
153};
154
155static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {
156 {
157 .modalias = "ads7846",
158 .bus_num = 1,
159 .chip_select = 0,
160 .max_speed_hz = 1500000,
161 .controller_data = &ads7846_mcspi_config,
162 .irq = OMAP_GPIO_IRQ(OMAP3_PANDORA_TS_GPIO),
163 .platform_data = &ads7846_config,
164 }
165};
166
167static struct platform_device omap3pandora_lcd_device = {
168 .name = "pandora_lcd",
169 .id = -1,
170};
171
172static struct omap_lcd_config omap3pandora_lcd_config __initdata = {
173 .ctrl_name = "internal",
174};
175
176static struct omap_board_config_kernel omap3pandora_config[] __initdata = {
177 { OMAP_TAG_UART, &omap3pandora_uart_config },
178 { OMAP_TAG_LCD, &omap3pandora_lcd_config },
179};
180
181static struct platform_device *omap3pandora_devices[] __initdata = {
182 &omap3pandora_lcd_device,
183};
184
185static void __init omap3pandora_init(void)
186{
187 omap3pandora_i2c_init();
188 platform_add_devices(omap3pandora_devices,
189 ARRAY_SIZE(omap3pandora_devices));
190 omap_board_config = omap3pandora_config;
191 omap_board_config_size = ARRAY_SIZE(omap3pandora_config);
192 omap_serial_init();
193 spi_register_board_info(omap3pandora_spi_board_info,
194 ARRAY_SIZE(omap3pandora_spi_board_info));
195 omap3pandora_ads7846_init();
196}
197
198static void __init omap3pandora_map_io(void)
199{
200 omap2_set_globals_343x();
201 omap2_map_common_io();
202}
203
204MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
205 .phys_io = 0x48000000,
206 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
207 .boot_params = 0x80000100,
208 .map_io = omap3pandora_map_io,
209 .init_irq = omap3pandora_init_irq,
210 .init_machine = omap3pandora_init,
211 .timer = &omap_timer,
212MACHINE_END
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index e09aa59a399c..82b3dc557c96 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -26,6 +26,7 @@
26#include <linux/io.h> 26#include <linux/io.h>
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/i2c/twl4030.h>
29 30
30#include <linux/mtd/mtd.h> 31#include <linux/mtd/mtd.h>
31#include <linux/mtd/nand.h> 32#include <linux/mtd/nand.h>
@@ -44,6 +45,8 @@
44#include <mach/hardware.h> 45#include <mach/hardware.h>
45#include <mach/nand.h> 46#include <mach/nand.h>
46 47
48#include "mmc-twl4030.h"
49
47#define NAND_BLOCK_SIZE SZ_128K 50#define NAND_BLOCK_SIZE SZ_128K
48#define GPMC_CS0_BASE 0x60 51#define GPMC_CS0_BASE 0x60
49#define GPMC_CS_SIZE 0x30 52#define GPMC_CS_SIZE 0x30
@@ -139,8 +142,31 @@ static struct omap_uart_config overo_uart_config __initdata = {
139 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), 142 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
140}; 143};
141 144
145static struct twl4030_gpio_platform_data overo_gpio_data = {
146 .gpio_base = OMAP_MAX_GPIO_LINES,
147 .irq_base = TWL4030_GPIO_IRQ_BASE,
148 .irq_end = TWL4030_GPIO_IRQ_END,
149};
150
151static struct twl4030_platform_data overo_twldata = {
152 .irq_base = TWL4030_IRQ_BASE,
153 .irq_end = TWL4030_IRQ_END,
154 .gpio = &overo_gpio_data,
155};
156
157static struct i2c_board_info __initdata overo_i2c_boardinfo[] = {
158 {
159 I2C_BOARD_INFO("twl4030", 0x48),
160 .flags = I2C_CLIENT_WAKE,
161 .irq = INT_34XX_SYS_NIRQ,
162 .platform_data = &overo_twldata,
163 },
164};
165
142static int __init overo_i2c_init(void) 166static int __init overo_i2c_init(void)
143{ 167{
168 omap_register_i2c_bus(1, 2600, overo_i2c_boardinfo,
169 ARRAY_SIZE(overo_i2c_boardinfo));
144 /* i2c2 pins are used for gpio */ 170 /* i2c2 pins are used for gpio */
145 omap_register_i2c_bus(3, 400, NULL, 0); 171 omap_register_i2c_bus(3, 400, NULL, 0);
146 return 0; 172 return 0;
@@ -171,6 +197,22 @@ static struct platform_device *overo_devices[] __initdata = {
171 &overo_lcd_device, 197 &overo_lcd_device,
172}; 198};
173 199
200static struct twl4030_hsmmc_info mmc[] __initdata = {
201 {
202 .mmc = 1,
203 .wires = 4,
204 .gpio_cd = -EINVAL,
205 .gpio_wp = -EINVAL,
206 },
207 {
208 .mmc = 2,
209 .wires = 4,
210 .gpio_cd = -EINVAL,
211 .gpio_wp = -EINVAL,
212 },
213 {} /* Terminator */
214};
215
174static void __init overo_init(void) 216static void __init overo_init(void)
175{ 217{
176 overo_i2c_init(); 218 overo_i2c_init();
@@ -178,6 +220,7 @@ static void __init overo_init(void)
178 omap_board_config = overo_config; 220 omap_board_config = overo_config;
179 omap_board_config_size = ARRAY_SIZE(overo_config); 221 omap_board_config_size = ARRAY_SIZE(overo_config);
180 omap_serial_init(); 222 omap_serial_init();
223 twl4030_mmc_init(mmc);
181 overo_flash_init(); 224 overo_flash_init();
182 225
183 if ((gpio_request(OVERO_GPIO_W2W_NRESET, 226 if ((gpio_request(OVERO_GPIO_W2W_NRESET,
diff --git a/arch/arm/mach-omap2/clock24xx.h b/arch/arm/mach-omap2/clock24xx.h
index 242a19d86ccd..ad6d98d177c5 100644
--- a/arch/arm/mach-omap2/clock24xx.h
+++ b/arch/arm/mach-omap2/clock24xx.h
@@ -2321,7 +2321,7 @@ static struct clk i2c2_fck = {
2321}; 2321};
2322 2322
2323static struct clk i2chs2_fck = { 2323static struct clk i2chs2_fck = {
2324 .name = "i2chs_fck", 2324 .name = "i2c_fck",
2325 .id = 2, 2325 .id = 2,
2326 .parent = &func_96m_ck, 2326 .parent = &func_96m_ck,
2327 .flags = CLOCK_IN_OMAP243X, 2327 .flags = CLOCK_IN_OMAP243X,
@@ -2354,7 +2354,7 @@ static struct clk i2c1_fck = {
2354}; 2354};
2355 2355
2356static struct clk i2chs1_fck = { 2356static struct clk i2chs1_fck = {
2357 .name = "i2chs_fck", 2357 .name = "i2c_fck",
2358 .id = 1, 2358 .id = 1,
2359 .parent = &func_96m_ck, 2359 .parent = &func_96m_ck,
2360 .flags = CLOCK_IN_OMAP243X, 2360 .flags = CLOCK_IN_OMAP243X,
@@ -2522,7 +2522,6 @@ static struct clk usbhs_ick = {
2522 2522
2523static struct clk mmchs1_ick = { 2523static struct clk mmchs1_ick = {
2524 .name = "mmchs_ick", 2524 .name = "mmchs_ick",
2525 .id = 1,
2526 .parent = &l4_ck, 2525 .parent = &l4_ck,
2527 .flags = CLOCK_IN_OMAP243X, 2526 .flags = CLOCK_IN_OMAP243X,
2528 .clkdm_name = "core_l4_clkdm", 2527 .clkdm_name = "core_l4_clkdm",
@@ -2533,7 +2532,6 @@ static struct clk mmchs1_ick = {
2533 2532
2534static struct clk mmchs1_fck = { 2533static struct clk mmchs1_fck = {
2535 .name = "mmchs_fck", 2534 .name = "mmchs_fck",
2536 .id = 1,
2537 .parent = &func_96m_ck, 2535 .parent = &func_96m_ck,
2538 .flags = CLOCK_IN_OMAP243X, 2536 .flags = CLOCK_IN_OMAP243X,
2539 .clkdm_name = "core_l3_clkdm", 2537 .clkdm_name = "core_l3_clkdm",
@@ -2544,7 +2542,7 @@ static struct clk mmchs1_fck = {
2544 2542
2545static struct clk mmchs2_ick = { 2543static struct clk mmchs2_ick = {
2546 .name = "mmchs_ick", 2544 .name = "mmchs_ick",
2547 .id = 2, 2545 .id = 1,
2548 .parent = &l4_ck, 2546 .parent = &l4_ck,
2549 .flags = CLOCK_IN_OMAP243X, 2547 .flags = CLOCK_IN_OMAP243X,
2550 .clkdm_name = "core_l4_clkdm", 2548 .clkdm_name = "core_l4_clkdm",
@@ -2555,7 +2553,7 @@ static struct clk mmchs2_ick = {
2555 2553
2556static struct clk mmchs2_fck = { 2554static struct clk mmchs2_fck = {
2557 .name = "mmchs_fck", 2555 .name = "mmchs_fck",
2558 .id = 2, 2556 .id = 1,
2559 .parent = &func_96m_ck, 2557 .parent = &func_96m_ck,
2560 .flags = CLOCK_IN_OMAP243X, 2558 .flags = CLOCK_IN_OMAP243X,
2561 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), 2559 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
@@ -2595,7 +2593,6 @@ static struct clk mdm_intc_ick = {
2595 2593
2596static struct clk mmchsdb1_fck = { 2594static struct clk mmchsdb1_fck = {
2597 .name = "mmchsdb_fck", 2595 .name = "mmchsdb_fck",
2598 .id = 1,
2599 .parent = &func_32k_ck, 2596 .parent = &func_32k_ck,
2600 .flags = CLOCK_IN_OMAP243X, 2597 .flags = CLOCK_IN_OMAP243X,
2601 .clkdm_name = "core_l4_clkdm", 2598 .clkdm_name = "core_l4_clkdm",
@@ -2606,7 +2603,7 @@ static struct clk mmchsdb1_fck = {
2606 2603
2607static struct clk mmchsdb2_fck = { 2604static struct clk mmchsdb2_fck = {
2608 .name = "mmchsdb_fck", 2605 .name = "mmchsdb_fck",
2609 .id = 2, 2606 .id = 1,
2610 .parent = &func_32k_ck, 2607 .parent = &func_32k_ck,
2611 .flags = CLOCK_IN_OMAP243X, 2608 .flags = CLOCK_IN_OMAP243X,
2612 .clkdm_name = "core_l4_clkdm", 2609 .clkdm_name = "core_l4_clkdm",
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index 084e11082f80..31bb7010bd48 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -475,7 +475,7 @@ int __init omap2_clk_init(void)
475 * Update this if there are further clock changes between ES2 475 * Update this if there are further clock changes between ES2
476 * and production parts 476 * and production parts
477 */ 477 */
478 if (is_sil_rev_equal_to(OMAP3430_REV_ES1_0)) { 478 if (omap_rev() == OMAP3430_REV_ES1_0) {
479 /* No 3430ES1-only rates exist, so no RATE_IN_3430ES1 */ 479 /* No 3430ES1-only rates exist, so no RATE_IN_3430ES1 */
480 cpu_clkflg |= CLOCK_IN_OMAP3430ES1; 480 cpu_clkflg |= CLOCK_IN_OMAP3430ES1;
481 } else { 481 } else {
diff --git a/arch/arm/mach-omap2/clock34xx.h b/arch/arm/mach-omap2/clock34xx.h
index c38a8a09692f..a826094d89b5 100644
--- a/arch/arm/mach-omap2/clock34xx.h
+++ b/arch/arm/mach-omap2/clock34xx.h
@@ -1374,7 +1374,7 @@ static struct clk core_96m_fck = {
1374 1374
1375static struct clk mmchs3_fck = { 1375static struct clk mmchs3_fck = {
1376 .name = "mmchs_fck", 1376 .name = "mmchs_fck",
1377 .id = 3, 1377 .id = 2,
1378 .parent = &core_96m_fck, 1378 .parent = &core_96m_fck,
1379 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1379 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1380 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT, 1380 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
@@ -1385,7 +1385,7 @@ static struct clk mmchs3_fck = {
1385 1385
1386static struct clk mmchs2_fck = { 1386static struct clk mmchs2_fck = {
1387 .name = "mmchs_fck", 1387 .name = "mmchs_fck",
1388 .id = 2, 1388 .id = 1,
1389 .parent = &core_96m_fck, 1389 .parent = &core_96m_fck,
1390 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1390 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1391 .enable_bit = OMAP3430_EN_MMC2_SHIFT, 1391 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
@@ -1406,7 +1406,6 @@ static struct clk mspro_fck = {
1406 1406
1407static struct clk mmchs1_fck = { 1407static struct clk mmchs1_fck = {
1408 .name = "mmchs_fck", 1408 .name = "mmchs_fck",
1409 .id = 1,
1410 .parent = &core_96m_fck, 1409 .parent = &core_96m_fck,
1411 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1410 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1412 .enable_bit = OMAP3430_EN_MMC1_SHIFT, 1411 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
@@ -1722,7 +1721,7 @@ static struct clk usbtll_ick = {
1722 1721
1723static struct clk mmchs3_ick = { 1722static struct clk mmchs3_ick = {
1724 .name = "mmchs_ick", 1723 .name = "mmchs_ick",
1725 .id = 3, 1724 .id = 2,
1726 .parent = &core_l4_ick, 1725 .parent = &core_l4_ick,
1727 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1726 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1728 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT, 1727 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
@@ -1774,7 +1773,7 @@ static struct clk des2_ick = {
1774 1773
1775static struct clk mmchs2_ick = { 1774static struct clk mmchs2_ick = {
1776 .name = "mmchs_ick", 1775 .name = "mmchs_ick",
1777 .id = 2, 1776 .id = 1,
1778 .parent = &core_l4_ick, 1777 .parent = &core_l4_ick,
1779 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1778 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1780 .enable_bit = OMAP3430_EN_MMC2_SHIFT, 1779 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
@@ -1785,7 +1784,6 @@ static struct clk mmchs2_ick = {
1785 1784
1786static struct clk mmchs1_ick = { 1785static struct clk mmchs1_ick = {
1787 .name = "mmchs_ick", 1786 .name = "mmchs_ick",
1788 .id = 1,
1789 .parent = &core_l4_ick, 1787 .parent = &core_l4_ick,
1790 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1788 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1791 .enable_bit = OMAP3430_EN_MMC1_SHIFT, 1789 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
@@ -2280,8 +2278,8 @@ static struct clk wkup_32k_fck = {
2280 .recalc = &followparent_recalc, 2278 .recalc = &followparent_recalc,
2281}; 2279};
2282 2280
2283static struct clk gpio1_fck = { 2281static struct clk gpio1_dbck = {
2284 .name = "gpio1_fck", 2282 .name = "gpio1_dbck",
2285 .parent = &wkup_32k_fck, 2283 .parent = &wkup_32k_fck,
2286 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), 2284 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2287 .enable_bit = OMAP3430_EN_GPIO1_SHIFT, 2285 .enable_bit = OMAP3430_EN_GPIO1_SHIFT,
@@ -2527,8 +2525,8 @@ static struct clk per_32k_alwon_fck = {
2527 .recalc = &followparent_recalc, 2525 .recalc = &followparent_recalc,
2528}; 2526};
2529 2527
2530static struct clk gpio6_fck = { 2528static struct clk gpio6_dbck = {
2531 .name = "gpio6_fck", 2529 .name = "gpio6_dbck",
2532 .parent = &per_32k_alwon_fck, 2530 .parent = &per_32k_alwon_fck,
2533 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2531 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2534 .enable_bit = OMAP3430_EN_GPIO6_SHIFT, 2532 .enable_bit = OMAP3430_EN_GPIO6_SHIFT,
@@ -2537,8 +2535,8 @@ static struct clk gpio6_fck = {
2537 .recalc = &followparent_recalc, 2535 .recalc = &followparent_recalc,
2538}; 2536};
2539 2537
2540static struct clk gpio5_fck = { 2538static struct clk gpio5_dbck = {
2541 .name = "gpio5_fck", 2539 .name = "gpio5_dbck",
2542 .parent = &per_32k_alwon_fck, 2540 .parent = &per_32k_alwon_fck,
2543 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2541 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2544 .enable_bit = OMAP3430_EN_GPIO5_SHIFT, 2542 .enable_bit = OMAP3430_EN_GPIO5_SHIFT,
@@ -2547,8 +2545,8 @@ static struct clk gpio5_fck = {
2547 .recalc = &followparent_recalc, 2545 .recalc = &followparent_recalc,
2548}; 2546};
2549 2547
2550static struct clk gpio4_fck = { 2548static struct clk gpio4_dbck = {
2551 .name = "gpio4_fck", 2549 .name = "gpio4_dbck",
2552 .parent = &per_32k_alwon_fck, 2550 .parent = &per_32k_alwon_fck,
2553 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2551 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2554 .enable_bit = OMAP3430_EN_GPIO4_SHIFT, 2552 .enable_bit = OMAP3430_EN_GPIO4_SHIFT,
@@ -2557,8 +2555,8 @@ static struct clk gpio4_fck = {
2557 .recalc = &followparent_recalc, 2555 .recalc = &followparent_recalc,
2558}; 2556};
2559 2557
2560static struct clk gpio3_fck = { 2558static struct clk gpio3_dbck = {
2561 .name = "gpio3_fck", 2559 .name = "gpio3_dbck",
2562 .parent = &per_32k_alwon_fck, 2560 .parent = &per_32k_alwon_fck,
2563 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2561 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2564 .enable_bit = OMAP3430_EN_GPIO3_SHIFT, 2562 .enable_bit = OMAP3430_EN_GPIO3_SHIFT,
@@ -2567,8 +2565,8 @@ static struct clk gpio3_fck = {
2567 .recalc = &followparent_recalc, 2565 .recalc = &followparent_recalc,
2568}; 2566};
2569 2567
2570static struct clk gpio2_fck = { 2568static struct clk gpio2_dbck = {
2571 .name = "gpio2_fck", 2569 .name = "gpio2_dbck",
2572 .parent = &per_32k_alwon_fck, 2570 .parent = &per_32k_alwon_fck,
2573 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2571 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2574 .enable_bit = OMAP3430_EN_GPIO2_SHIFT, 2572 .enable_bit = OMAP3430_EN_GPIO2_SHIFT,
@@ -3170,7 +3168,7 @@ static struct clk *onchip_34xx_clks[] __initdata = {
3170 &usim_fck, 3168 &usim_fck,
3171 &gpt1_fck, 3169 &gpt1_fck,
3172 &wkup_32k_fck, 3170 &wkup_32k_fck,
3173 &gpio1_fck, 3171 &gpio1_dbck,
3174 &wdt2_fck, 3172 &wdt2_fck,
3175 &wkup_l4_ick, 3173 &wkup_l4_ick,
3176 &usim_ick, 3174 &usim_ick,
@@ -3192,11 +3190,11 @@ static struct clk *onchip_34xx_clks[] __initdata = {
3192 &gpt8_fck, 3190 &gpt8_fck,
3193 &gpt9_fck, 3191 &gpt9_fck,
3194 &per_32k_alwon_fck, 3192 &per_32k_alwon_fck,
3195 &gpio6_fck, 3193 &gpio6_dbck,
3196 &gpio5_fck, 3194 &gpio5_dbck,
3197 &gpio4_fck, 3195 &gpio4_dbck,
3198 &gpio3_fck, 3196 &gpio3_dbck,
3199 &gpio2_fck, 3197 &gpio2_dbck,
3200 &wdt3_fck, 3198 &wdt3_fck,
3201 &per_l4_ick, 3199 &per_l4_ick,
3202 &gpio6_ick, 3200 &gpio6_ick,
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 90af2ac469aa..9d7216ff6c9f 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -14,16 +14,19 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/clk.h>
17 18
18#include <mach/hardware.h> 19#include <mach/hardware.h>
19#include <asm/mach-types.h> 20#include <asm/mach-types.h>
20#include <asm/mach/map.h> 21#include <asm/mach/map.h>
21 22
23#include <mach/control.h>
22#include <mach/tc.h> 24#include <mach/tc.h>
23#include <mach/board.h> 25#include <mach/board.h>
24#include <mach/mux.h> 26#include <mach/mux.h>
25#include <mach/gpio.h> 27#include <mach/gpio.h>
26#include <mach/eac.h> 28#include <mach/eac.h>
29#include <mach/mmc.h>
27 30
28#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE) 31#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
29#define OMAP2_MBOX_BASE IO_ADDRESS(OMAP24XX_MAILBOX_BASE) 32#define OMAP2_MBOX_BASE IO_ADDRESS(OMAP24XX_MAILBOX_BASE)
@@ -295,6 +298,171 @@ static void omap_init_sha1_md5(void)
295static inline void omap_init_sha1_md5(void) { } 298static inline void omap_init_sha1_md5(void) { }
296#endif 299#endif
297 300
301/*-------------------------------------------------------------------------*/
302
303#ifdef CONFIG_ARCH_OMAP3
304
305#define MMCHS_SYSCONFIG 0x0010
306#define MMCHS_SYSCONFIG_SWRESET (1 << 1)
307#define MMCHS_SYSSTATUS 0x0014
308#define MMCHS_SYSSTATUS_RESETDONE (1 << 0)
309
310static struct platform_device dummy_pdev = {
311 .dev = {
312 .bus = &platform_bus_type,
313 },
314};
315
316/**
317 * omap_hsmmc_reset() - Full reset of each HS-MMC controller
318 *
319 * Ensure that each MMC controller is fully reset. Controllers
320 * left in an unknown state (by bootloader) may prevent retention
321 * or OFF-mode. This is especially important in cases where the
322 * MMC driver is not enabled, _or_ built as a module.
323 *
324 * In order for reset to work, interface, functional and debounce
325 * clocks must be enabled. The debounce clock comes from func_32k_clk
326 * and is not under SW control, so we only enable i- and f-clocks.
327 **/
328static void __init omap_hsmmc_reset(void)
329{
330 u32 i, nr_controllers = cpu_is_omap34xx() ? OMAP34XX_NR_MMC :
331 OMAP24XX_NR_MMC;
332
333 for (i = 0; i < nr_controllers; i++) {
334 u32 v, base = 0;
335 struct clk *iclk, *fclk;
336 struct device *dev = &dummy_pdev.dev;
337
338 switch (i) {
339 case 0:
340 base = OMAP2_MMC1_BASE;
341 break;
342 case 1:
343 base = OMAP2_MMC2_BASE;
344 break;
345 case 2:
346 base = OMAP3_MMC3_BASE;
347 break;
348 }
349
350 dummy_pdev.id = i;
351 iclk = clk_get(dev, "mmchs_ick");
352 if (iclk && clk_enable(iclk))
353 iclk = NULL;
354
355 fclk = clk_get(dev, "mmchs_fck");
356 if (fclk && clk_enable(fclk))
357 fclk = NULL;
358
359 if (!iclk || !fclk) {
360 printk(KERN_WARNING
361 "%s: Unable to enable clocks for MMC%d, "
362 "cannot reset.\n", __func__, i);
363 break;
364 }
365
366 omap_writel(MMCHS_SYSCONFIG_SWRESET, base + MMCHS_SYSCONFIG);
367 v = omap_readl(base + MMCHS_SYSSTATUS);
368 while (!(omap_readl(base + MMCHS_SYSSTATUS) &
369 MMCHS_SYSSTATUS_RESETDONE))
370 cpu_relax();
371
372 if (fclk) {
373 clk_disable(fclk);
374 clk_put(fclk);
375 }
376 if (iclk) {
377 clk_disable(iclk);
378 clk_put(iclk);
379 }
380 }
381}
382#else
383static inline void omap_hsmmc_reset(void) {}
384#endif
385
386#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
387 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
388
389static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
390 int controller_nr)
391{
392 if (cpu_is_omap2420() && controller_nr == 0) {
393 omap_cfg_reg(H18_24XX_MMC_CMD);
394 omap_cfg_reg(H15_24XX_MMC_CLKI);
395 omap_cfg_reg(G19_24XX_MMC_CLKO);
396 omap_cfg_reg(F20_24XX_MMC_DAT0);
397 omap_cfg_reg(F19_24XX_MMC_DAT_DIR0);
398 omap_cfg_reg(G18_24XX_MMC_CMD_DIR);
399 if (mmc_controller->slots[0].wires == 4) {
400 omap_cfg_reg(H14_24XX_MMC_DAT1);
401 omap_cfg_reg(E19_24XX_MMC_DAT2);
402 omap_cfg_reg(D19_24XX_MMC_DAT3);
403 omap_cfg_reg(E20_24XX_MMC_DAT_DIR1);
404 omap_cfg_reg(F18_24XX_MMC_DAT_DIR2);
405 omap_cfg_reg(E18_24XX_MMC_DAT_DIR3);
406 }
407
408 /*
409 * Use internal loop-back in MMC/SDIO Module Input Clock
410 * selection
411 */
412 if (mmc_controller->slots[0].internal_clock) {
413 u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
414 v |= (1 << 24);
415 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
416 }
417 }
418}
419
420void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
421 int nr_controllers)
422{
423 int i;
424
425 for (i = 0; i < nr_controllers; i++) {
426 unsigned long base, size;
427 unsigned int irq = 0;
428
429 if (!mmc_data[i])
430 continue;
431
432 omap2_mmc_mux(mmc_data[i], i);
433
434 switch (i) {
435 case 0:
436 base = OMAP2_MMC1_BASE;
437 irq = INT_24XX_MMC_IRQ;
438 break;
439 case 1:
440 base = OMAP2_MMC2_BASE;
441 irq = INT_24XX_MMC2_IRQ;
442 break;
443 case 2:
444 if (!cpu_is_omap34xx())
445 return;
446 base = OMAP3_MMC3_BASE;
447 irq = INT_34XX_MMC3_IRQ;
448 break;
449 default:
450 continue;
451 }
452
453 if (cpu_is_omap2420())
454 size = OMAP2420_MMC_SIZE;
455 else
456 size = HSMMC_SIZE;
457
458 omap_mmc_add(i, base, size, irq, mmc_data[i]);
459 };
460}
461
462#endif
463
464/*-------------------------------------------------------------------------*/
465
298#if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE) 466#if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
299#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430) 467#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
300#define OMAP_HDQ_BASE 0x480B2000 468#define OMAP_HDQ_BASE 0x480B2000
@@ -334,6 +502,7 @@ static int __init omap2_init_devices(void)
334 /* please keep these calls, and their implementations above, 502 /* please keep these calls, and their implementations above,
335 * in alphabetical order so they're easier to sort through. 503 * in alphabetical order so they're easier to sort through.
336 */ 504 */
505 omap_hsmmc_reset();
337 omap_init_mbox(); 506 omap_init_mbox();
338 omap_init_mcspi(); 507 omap_init_mcspi();
339 omap_hdq_init(); 508 omap_hdq_init();
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index bf45ff39a7b5..b0f8e7d62798 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -22,40 +22,15 @@
22#include <mach/control.h> 22#include <mach/control.h>
23#include <mach/cpu.h> 23#include <mach/cpu.h>
24 24
25static u32 class; 25static struct omap_chip_id omap_chip;
26static void __iomem *tap_base; 26static unsigned int omap_revision;
27static u16 tap_prod_id;
28
29#define OMAP_TAP_IDCODE 0x0204
30#define OMAP_TAP_DIE_ID_0 0x0218
31#define OMAP_TAP_DIE_ID_1 0x021C
32#define OMAP_TAP_DIE_ID_2 0x0220
33#define OMAP_TAP_DIE_ID_3 0x0224
34
35/* system_rev fields for OMAP2 processors:
36 * CPU id bits [31:16],
37 * CPU device type [15:12], (unprg,normal,POP)
38 * CPU revision [11:08]
39 * CPU class bits [07:00]
40 */
41
42struct omap_id {
43 u16 hawkeye; /* Silicon type (Hawkeye id) */
44 u8 dev; /* Device type from production_id reg */
45 u32 type; /* combined type id copied to system_rev */
46};
47 27
48/* Register values to detect the OMAP version */
49static struct omap_id omap_ids[] __initdata = {
50 { .hawkeye = 0xb5d9, .dev = 0x0, .type = 0x24200000 },
51 { .hawkeye = 0xb5d9, .dev = 0x1, .type = 0x24201000 },
52 { .hawkeye = 0xb5d9, .dev = 0x2, .type = 0x24202000 },
53 { .hawkeye = 0xb5d9, .dev = 0x4, .type = 0x24220000 },
54 { .hawkeye = 0xb5d9, .dev = 0x8, .type = 0x24230000 },
55 { .hawkeye = 0xb68a, .dev = 0x0, .type = 0x24300000 },
56};
57 28
58static struct omap_chip_id omap_chip; 29unsigned int omap_rev(void)
30{
31 return omap_revision;
32}
33EXPORT_SYMBOL(omap_rev);
59 34
60/** 35/**
61 * omap_chip_is - test whether currently running OMAP matches a chip type 36 * omap_chip_is - test whether currently running OMAP matches a chip type
@@ -70,135 +45,41 @@ int omap_chip_is(struct omap_chip_id oci)
70} 45}
71EXPORT_SYMBOL(omap_chip_is); 46EXPORT_SYMBOL(omap_chip_is);
72 47
73static u32 __init read_tap_reg(int reg) 48/*----------------------------------------------------------------------------*/
74{
75 unsigned int regval = 0;
76 u32 cpuid;
77
78 /* Reading the IDCODE register on 3430 ES1 results in a
79 * data abort as the register is not exposed on the OCP
80 * Hence reading the Cortex Rev
81 */
82 cpuid = read_cpuid(CPUID_ID);
83
84 /* If the processor type is Cortex-A8 and the revision is 0x0
85 * it means its Cortex r0p0 which is 3430 ES1
86 */
87 if ((((cpuid >> 4) & 0xFFF) == 0xC08) && ((cpuid & 0xF) == 0x0)) {
88
89 if (reg == tap_prod_id) {
90 regval = 0x000F00F0;
91 goto out;
92 }
93
94 switch (reg) {
95 case OMAP_TAP_IDCODE : regval = 0x0B7AE02F; break;
96 /* Making DevType as 0xF in ES1 to differ from ES2 */
97 case OMAP_TAP_DIE_ID_0: regval = 0x01000000; break;
98 case OMAP_TAP_DIE_ID_1: regval = 0x1012d687; break;
99 case OMAP_TAP_DIE_ID_2: regval = 0x00000000; break;
100 case OMAP_TAP_DIE_ID_3: regval = 0x2d2c0000; break;
101 }
102 } else
103 regval = __raw_readl(tap_base + reg);
104
105out:
106 return regval;
107
108}
109 49
110/* 50#define OMAP_TAP_IDCODE 0x0204
111 * _set_system_rev - set the system_rev global based on current OMAP chip type 51#define OMAP_TAP_DIE_ID_0 0x0218
112 * 52#define OMAP_TAP_DIE_ID_1 0x021C
113 * Set the system_rev global. This is primarily used by the cpu_is_omapxxxx() 53#define OMAP_TAP_DIE_ID_2 0x0220
114 * macros. 54#define OMAP_TAP_DIE_ID_3 0x0224
115 */
116static void __init _set_system_rev(u32 type, u8 rev)
117{
118 u32 i, ctrl_status;
119
120 /*
121 * system_rev encoding is as follows
122 * system_rev & 0xff000000 -> Omap Class (24xx/34xx)
123 * system_rev & 0xfff00000 -> Omap Sub Class (242x/343x)
124 * system_rev & 0xffff0000 -> Omap type (2420/2422/2423/2430/3430)
125 * system_rev & 0x0000f000 -> Silicon revision (ES1, ES2 )
126 * system_rev & 0x00000700 -> Device Type ( EMU/HS/GP/BAD )
127 * system_rev & 0x000000c0 -> IDCODE revision[6:7]
128 * system_rev & 0x0000003f -> sys_boot[0:5]
129 */
130 /* Embedding the ES revision info in type field */
131 system_rev = type;
132 /* Also add IDCODE revision info only two lower bits */
133 system_rev |= ((rev & 0x3) << 6);
134
135 /* Add in the device type and sys_boot fields (see above) */
136 if (cpu_is_omap24xx()) {
137 i = OMAP24XX_CONTROL_STATUS;
138 } else if (cpu_is_omap343x()) {
139 i = OMAP343X_CONTROL_STATUS;
140 } else {
141 printk(KERN_ERR "id: unknown CPU type\n");
142 BUG();
143 }
144 ctrl_status = omap_ctrl_readl(i);
145 system_rev |= (ctrl_status & (OMAP2_SYSBOOT_5_MASK |
146 OMAP2_SYSBOOT_4_MASK |
147 OMAP2_SYSBOOT_3_MASK |
148 OMAP2_SYSBOOT_2_MASK |
149 OMAP2_SYSBOOT_1_MASK |
150 OMAP2_SYSBOOT_0_MASK));
151 system_rev |= (ctrl_status & OMAP2_DEVICETYPE_MASK);
152}
153
154
155/*
156 * _set_omap_chip - set the omap_chip global based on OMAP chip type
157 *
158 * Build the omap_chip bits. This variable is used by powerdomain and
159 * clockdomain code to indicate whether structures are applicable for
160 * the current OMAP chip type by ANDing it against a 'platform' bitfield
161 * in the structure.
162 */
163static void __init _set_omap_chip(void)
164{
165 if (cpu_is_omap343x()) {
166
167 omap_chip.oc = CHIP_IS_OMAP3430;
168 if (is_sil_rev_equal_to(OMAP3430_REV_ES1_0))
169 omap_chip.oc |= CHIP_IS_OMAP3430ES1;
170 else if (is_sil_rev_greater_than(OMAP3430_REV_ES1_0))
171 omap_chip.oc |= CHIP_IS_OMAP3430ES2;
172
173 } else if (cpu_is_omap243x()) {
174
175 /* Currently only supports 2430ES2.1 and 2430-all */
176 omap_chip.oc |= CHIP_IS_OMAP2430;
177
178 } else if (cpu_is_omap242x()) {
179
180 /* Currently only supports 2420ES2.1.1 and 2420-all */
181 omap_chip.oc |= CHIP_IS_OMAP2420;
182 55
183 } else { 56#define read_tap_reg(reg) __raw_readl(tap_base + (reg))
184 57
185 /* Current CPU not supported by this code. */ 58struct omap_id {
186 printk(KERN_WARNING "OMAP chip type code does not yet support " 59 u16 hawkeye; /* Silicon type (Hawkeye id) */
187 "this CPU type.\n"); 60 u8 dev; /* Device type from production_id reg */
188 WARN_ON(1); 61 u32 type; /* Combined type id copied to omap_revision */
62};
189 63
190 } 64/* Register values to detect the OMAP version */
65static struct omap_id omap_ids[] __initdata = {
66 { .hawkeye = 0xb5d9, .dev = 0x0, .type = 0x24200024 },
67 { .hawkeye = 0xb5d9, .dev = 0x1, .type = 0x24201024 },
68 { .hawkeye = 0xb5d9, .dev = 0x2, .type = 0x24202024 },
69 { .hawkeye = 0xb5d9, .dev = 0x4, .type = 0x24220024 },
70 { .hawkeye = 0xb5d9, .dev = 0x8, .type = 0x24230024 },
71 { .hawkeye = 0xb68a, .dev = 0x0, .type = 0x24300024 },
72};
191 73
192} 74static void __iomem *tap_base;
75static u16 tap_prod_id;
193 76
194void __init omap2_check_revision(void) 77void __init omap24xx_check_revision(void)
195{ 78{
196 int i, j; 79 int i, j;
197 u32 idcode; 80 u32 idcode, prod_id;
198 u32 prod_id;
199 u16 hawkeye; 81 u16 hawkeye;
200 u8 dev_type; 82 u8 dev_type, rev;
201 u8 rev;
202 83
203 idcode = read_tap_reg(OMAP_TAP_IDCODE); 84 idcode = read_tap_reg(OMAP_TAP_IDCODE);
204 prod_id = read_tap_reg(tap_prod_id); 85 prod_id = read_tap_reg(tap_prod_id);
@@ -220,18 +101,6 @@ void __init omap2_check_revision(void)
220 pr_debug("OMAP_TAP_PROD_ID_0: 0x%08x DEV_TYPE: %i\n", 101 pr_debug("OMAP_TAP_PROD_ID_0: 0x%08x DEV_TYPE: %i\n",
221 prod_id, dev_type); 102 prod_id, dev_type);
222 103
223 /*
224 * Detection for 34xx ES2.0 and above can be done with just
225 * hawkeye and rev. See TRM 1.5.2 Device Identification.
226 * Note that rev cannot be used directly as ES1.0 uses value 0.
227 */
228 if (hawkeye == 0xb7ae) {
229 system_rev = 0x34300000 | ((1 + rev) << 12);
230 pr_info("OMAP%04x ES2.%i\n", system_rev >> 16, rev);
231 _set_omap_chip();
232 return;
233 }
234
235 /* Check hawkeye ids */ 104 /* Check hawkeye ids */
236 for (i = 0; i < ARRAY_SIZE(omap_ids); i++) { 105 for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
237 if (hawkeye == omap_ids[i].hawkeye) 106 if (hawkeye == omap_ids[i].hawkeye)
@@ -255,23 +124,115 @@ void __init omap2_check_revision(void)
255 j = i; 124 j = i;
256 } 125 }
257 126
258 _set_system_rev(omap_ids[j].type, rev); 127 pr_info("OMAP%04x", omap_rev() >> 16);
128 if ((omap_rev() >> 8) & 0x0f)
129 pr_info("ES%x", (omap_rev() >> 12) & 0xf);
130 pr_info("\n");
131}
259 132
260 _set_omap_chip(); 133void __init omap34xx_check_revision(void)
134{
135 u32 cpuid, idcode;
136 u16 hawkeye;
137 u8 rev;
138 char *rev_name = "ES1.0";
261 139
262 pr_info("OMAP%04x", system_rev >> 16); 140 /*
263 if ((system_rev >> 8) & 0x0f) 141 * We cannot access revision registers on ES1.0.
264 pr_info("ES%x", (system_rev >> 12) & 0xf); 142 * If the processor type is Cortex-A8 and the revision is 0x0
265 pr_info("\n"); 143 * it means its Cortex r0p0 which is 3430 ES1.0.
144 */
145 cpuid = read_cpuid(CPUID_ID);
146 if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) {
147 omap_revision = OMAP3430_REV_ES1_0;
148 goto out;
149 }
266 150
151 /*
152 * Detection for 34xx ES2.0 and above can be done with just
153 * hawkeye and rev. See TRM 1.5.2 Device Identification.
154 * Note that rev does not map directly to our defined processor
155 * revision numbers as ES1.0 uses value 0.
156 */
157 idcode = read_tap_reg(OMAP_TAP_IDCODE);
158 hawkeye = (idcode >> 12) & 0xffff;
159 rev = (idcode >> 28) & 0xff;
160
161 if (hawkeye == 0xb7ae) {
162 switch (rev) {
163 case 0:
164 omap_revision = OMAP3430_REV_ES2_0;
165 rev_name = "ES2.0";
166 break;
167 case 2:
168 omap_revision = OMAP3430_REV_ES2_1;
169 rev_name = "ES2.1";
170 break;
171 case 3:
172 omap_revision = OMAP3430_REV_ES3_0;
173 rev_name = "ES3.0";
174 break;
175 default:
176 /* Use the latest known revision as default */
177 omap_revision = OMAP3430_REV_ES3_0;
178 rev_name = "Unknown revision\n";
179 }
180 }
181
182out:
183 pr_info("OMAP%04x %s\n", omap_rev() >> 16, rev_name);
267} 184}
268 185
186/*
187 * Try to detect the exact revision of the omap we're running on
188 */
189void __init omap2_check_revision(void)
190{
191 /*
192 * At this point we have an idea about the processor revision set
193 * earlier with omap2_set_globals_tap().
194 */
195 if (cpu_is_omap24xx())
196 omap24xx_check_revision();
197 else if (cpu_is_omap34xx())
198 omap34xx_check_revision();
199 else
200 pr_err("OMAP revision unknown, please fix!\n");
201
202 /*
203 * OK, now we know the exact revision. Initialize omap_chip bits
204 * for powerdowmain and clockdomain code.
205 */
206 if (cpu_is_omap243x()) {
207 /* Currently only supports 2430ES2.1 and 2430-all */
208 omap_chip.oc |= CHIP_IS_OMAP2430;
209 } else if (cpu_is_omap242x()) {
210 /* Currently only supports 2420ES2.1.1 and 2420-all */
211 omap_chip.oc |= CHIP_IS_OMAP2420;
212 } else if (cpu_is_omap343x()) {
213 omap_chip.oc = CHIP_IS_OMAP3430;
214 if (omap_rev() == OMAP3430_REV_ES1_0)
215 omap_chip.oc |= CHIP_IS_OMAP3430ES1;
216 else if (omap_rev() > OMAP3430_REV_ES1_0)
217 omap_chip.oc |= CHIP_IS_OMAP3430ES2;
218 } else {
219 pr_err("Uninitialized omap_chip, please fix!\n");
220 }
221}
222
223/*
224 * Set up things for map_io and processor detection later on. Gets called
225 * pretty much first thing from board init. For multi-omap, this gets
226 * cpu_is_omapxxxx() working accurately enough for map_io. Then we'll try to
227 * detect the exact revision later on in omap2_detect_revision() once map_io
228 * is done.
229 */
269void __init omap2_set_globals_tap(struct omap_globals *omap2_globals) 230void __init omap2_set_globals_tap(struct omap_globals *omap2_globals)
270{ 231{
271 class = omap2_globals->class; 232 omap_revision = omap2_globals->class;
272 tap_base = omap2_globals->tap; 233 tap_base = omap2_globals->tap;
273 234
274 if (class == 0x3430) 235 if (cpu_is_omap34xx())
275 tap_prod_id = 0x0210; 236 tap_prod_id = 0x0210;
276 else 237 else
277 tap_prod_id = 0x0208; 238 tap_prod_id = 0x0208;
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index c40fc378a251..636e2821af7d 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -23,6 +23,7 @@
23#define INTC_REVISION 0x0000 23#define INTC_REVISION 0x0000
24#define INTC_SYSCONFIG 0x0010 24#define INTC_SYSCONFIG 0x0010
25#define INTC_SYSSTATUS 0x0014 25#define INTC_SYSSTATUS 0x0014
26#define INTC_SIR 0x0040
26#define INTC_CONTROL 0x0048 27#define INTC_CONTROL 0x0048
27#define INTC_MIR_CLEAR0 0x0088 28#define INTC_MIR_CLEAR0 0x0088
28#define INTC_MIR_SET0 0x008c 29#define INTC_MIR_SET0 0x008c
@@ -60,6 +61,30 @@ static u32 intc_bank_read_reg(struct omap_irq_bank *bank, u16 reg)
60 return __raw_readl(bank->base_reg + reg); 61 return __raw_readl(bank->base_reg + reg);
61} 62}
62 63
64static int previous_irq;
65
66/*
67 * On 34xx we can get occasional spurious interrupts if the ack from
68 * an interrupt handler does not get posted before we unmask. Warn about
69 * the interrupt handlers that need to flush posted writes.
70 */
71static int omap_check_spurious(unsigned int irq)
72{
73 u32 sir, spurious;
74
75 sir = intc_bank_read_reg(&irq_banks[0], INTC_SIR);
76 spurious = sir >> 6;
77
78 if (spurious > 1) {
79 printk(KERN_WARNING "Spurious irq %i: 0x%08x, please flush "
80 "posted write for irq %i\n",
81 irq, sir, previous_irq);
82 return spurious;
83 }
84
85 return 0;
86}
87
63/* XXX: FIQ and additional INTC support (only MPU at the moment) */ 88/* XXX: FIQ and additional INTC support (only MPU at the moment) */
64static void omap_ack_irq(unsigned int irq) 89static void omap_ack_irq(unsigned int irq)
65{ 90{
@@ -70,6 +95,20 @@ static void omap_mask_irq(unsigned int irq)
70{ 95{
71 int offset = irq & (~(IRQ_BITS_PER_REG - 1)); 96 int offset = irq & (~(IRQ_BITS_PER_REG - 1));
72 97
98 if (cpu_is_omap34xx()) {
99 int spurious = 0;
100
101 /*
102 * INT_34XX_GPT12_IRQ is also the spurious irq. Maybe because
103 * it is the highest irq number?
104 */
105 if (irq == INT_34XX_GPT12_IRQ)
106 spurious = omap_check_spurious(irq);
107
108 if (!spurious)
109 previous_irq = irq;
110 }
111
73 irq &= (IRQ_BITS_PER_REG - 1); 112 irq &= (IRQ_BITS_PER_REG - 1);
74 113
75 intc_bank_write_reg(1 << irq, &irq_banks[0], INTC_MIR_SET0 + offset); 114 intc_bank_write_reg(1 << irq, &irq_banks[0], INTC_MIR_SET0 + offset);
diff --git a/arch/arm/mach-omap2/mmc-twl4030.c b/arch/arm/mach-omap2/mmc-twl4030.c
new file mode 100644
index 000000000000..437f52073f6e
--- /dev/null
+++ b/arch/arm/mach-omap2/mmc-twl4030.c
@@ -0,0 +1,408 @@
1/*
2 * linux/arch/arm/mach-omap2/mmc-twl4030.c
3 *
4 * Copyright (C) 2007-2008 Texas Instruments
5 * Copyright (C) 2008 Nokia Corporation
6 * Author: Texas Instruments
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/err.h>
13#include <linux/io.h>
14#include <linux/module.h>
15#include <linux/platform_device.h>
16#include <linux/interrupt.h>
17#include <linux/delay.h>
18#include <linux/gpio.h>
19#include <linux/i2c/twl4030.h>
20
21#include <mach/hardware.h>
22#include <mach/control.h>
23#include <mach/mmc.h>
24#include <mach/board.h>
25
26#include "mmc-twl4030.h"
27
28#if defined(CONFIG_TWL4030_CORE) && \
29 (defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE))
30
31#define LDO_CLR 0x00
32#define VSEL_S2_CLR 0x40
33
34#define VMMC1_DEV_GRP 0x27
35#define VMMC1_CLR 0x00
36#define VMMC1_315V 0x03
37#define VMMC1_300V 0x02
38#define VMMC1_285V 0x01
39#define VMMC1_185V 0x00
40#define VMMC1_DEDICATED 0x2A
41
42#define VMMC2_DEV_GRP 0x2B
43#define VMMC2_CLR 0x40
44#define VMMC2_315V 0x0c
45#define VMMC2_300V 0x0b
46#define VMMC2_285V 0x0a
47#define VMMC2_260V 0x08
48#define VMMC2_185V 0x06
49#define VMMC2_DEDICATED 0x2E
50
51#define VMMC_DEV_GRP_P1 0x20
52
53static u16 control_pbias_offset;
54static u16 control_devconf1_offset;
55
56#define HSMMC_NAME_LEN 9
57
58static struct twl_mmc_controller {
59 struct omap_mmc_platform_data *mmc;
60 u8 twl_vmmc_dev_grp;
61 u8 twl_mmc_dedicated;
62 char name[HSMMC_NAME_LEN];
63} hsmmc[] = {
64 {
65 .twl_vmmc_dev_grp = VMMC1_DEV_GRP,
66 .twl_mmc_dedicated = VMMC1_DEDICATED,
67 },
68 {
69 .twl_vmmc_dev_grp = VMMC2_DEV_GRP,
70 .twl_mmc_dedicated = VMMC2_DEDICATED,
71 },
72};
73
74static int twl_mmc_card_detect(int irq)
75{
76 unsigned i;
77
78 for (i = 0; i < ARRAY_SIZE(hsmmc); i++) {
79 struct omap_mmc_platform_data *mmc;
80
81 mmc = hsmmc[i].mmc;
82 if (!mmc)
83 continue;
84 if (irq != mmc->slots[0].card_detect_irq)
85 continue;
86
87 /* NOTE: assumes card detect signal is active-low */
88 return !gpio_get_value_cansleep(mmc->slots[0].switch_pin);
89 }
90 return -ENOSYS;
91}
92
93static int twl_mmc_get_ro(struct device *dev, int slot)
94{
95 struct omap_mmc_platform_data *mmc = dev->platform_data;
96
97 /* NOTE: assumes write protect signal is active-high */
98 return gpio_get_value_cansleep(mmc->slots[0].gpio_wp);
99}
100
101/*
102 * MMC Slot Initialization.
103 */
104static int twl_mmc_late_init(struct device *dev)
105{
106 struct omap_mmc_platform_data *mmc = dev->platform_data;
107 int ret = 0;
108 int i;
109
110 ret = gpio_request(mmc->slots[0].switch_pin, "mmc_cd");
111 if (ret)
112 goto done;
113 ret = gpio_direction_input(mmc->slots[0].switch_pin);
114 if (ret)
115 goto err;
116
117 for (i = 0; i < ARRAY_SIZE(hsmmc); i++) {
118 if (hsmmc[i].name == mmc->slots[0].name) {
119 hsmmc[i].mmc = mmc;
120 break;
121 }
122 }
123
124 return 0;
125
126err:
127 gpio_free(mmc->slots[0].switch_pin);
128done:
129 mmc->slots[0].card_detect_irq = 0;
130 mmc->slots[0].card_detect = NULL;
131
132 dev_err(dev, "err %d configuring card detect\n", ret);
133 return ret;
134}
135
136static void twl_mmc_cleanup(struct device *dev)
137{
138 struct omap_mmc_platform_data *mmc = dev->platform_data;
139
140 gpio_free(mmc->slots[0].switch_pin);
141}
142
143#ifdef CONFIG_PM
144
145static int twl_mmc_suspend(struct device *dev, int slot)
146{
147 struct omap_mmc_platform_data *mmc = dev->platform_data;
148
149 disable_irq(mmc->slots[0].card_detect_irq);
150 return 0;
151}
152
153static int twl_mmc_resume(struct device *dev, int slot)
154{
155 struct omap_mmc_platform_data *mmc = dev->platform_data;
156
157 enable_irq(mmc->slots[0].card_detect_irq);
158 return 0;
159}
160
161#else
162#define twl_mmc_suspend NULL
163#define twl_mmc_resume NULL
164#endif
165
166/*
167 * Sets the MMC voltage in twl4030
168 */
169static int twl_mmc_set_voltage(struct twl_mmc_controller *c, int vdd)
170{
171 int ret;
172 u8 vmmc, dev_grp_val;
173
174 switch (1 << vdd) {
175 case MMC_VDD_35_36:
176 case MMC_VDD_34_35:
177 case MMC_VDD_33_34:
178 case MMC_VDD_32_33:
179 case MMC_VDD_31_32:
180 case MMC_VDD_30_31:
181 if (c->twl_vmmc_dev_grp == VMMC1_DEV_GRP)
182 vmmc = VMMC1_315V;
183 else
184 vmmc = VMMC2_315V;
185 break;
186 case MMC_VDD_29_30:
187 if (c->twl_vmmc_dev_grp == VMMC1_DEV_GRP)
188 vmmc = VMMC1_315V;
189 else
190 vmmc = VMMC2_300V;
191 break;
192 case MMC_VDD_27_28:
193 case MMC_VDD_26_27:
194 if (c->twl_vmmc_dev_grp == VMMC1_DEV_GRP)
195 vmmc = VMMC1_285V;
196 else
197 vmmc = VMMC2_285V;
198 break;
199 case MMC_VDD_25_26:
200 case MMC_VDD_24_25:
201 case MMC_VDD_23_24:
202 case MMC_VDD_22_23:
203 case MMC_VDD_21_22:
204 case MMC_VDD_20_21:
205 if (c->twl_vmmc_dev_grp == VMMC1_DEV_GRP)
206 vmmc = VMMC1_285V;
207 else
208 vmmc = VMMC2_260V;
209 break;
210 case MMC_VDD_165_195:
211 if (c->twl_vmmc_dev_grp == VMMC1_DEV_GRP)
212 vmmc = VMMC1_185V;
213 else
214 vmmc = VMMC2_185V;
215 break;
216 default:
217 vmmc = 0;
218 break;
219 }
220
221 if (vmmc)
222 dev_grp_val = VMMC_DEV_GRP_P1; /* Power up */
223 else
224 dev_grp_val = LDO_CLR; /* Power down */
225
226 ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
227 dev_grp_val, c->twl_vmmc_dev_grp);
228 if (ret)
229 return ret;
230
231 ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
232 vmmc, c->twl_mmc_dedicated);
233
234 return ret;
235}
236
237static int twl_mmc1_set_power(struct device *dev, int slot, int power_on,
238 int vdd)
239{
240 u32 reg;
241 int ret = 0;
242 struct twl_mmc_controller *c = &hsmmc[0];
243 struct omap_mmc_platform_data *mmc = dev->platform_data;
244
245 if (power_on) {
246 if (cpu_is_omap2430()) {
247 reg = omap_ctrl_readl(OMAP243X_CONTROL_DEVCONF1);
248 if ((1 << vdd) >= MMC_VDD_30_31)
249 reg |= OMAP243X_MMC1_ACTIVE_OVERWRITE;
250 else
251 reg &= ~OMAP243X_MMC1_ACTIVE_OVERWRITE;
252 omap_ctrl_writel(reg, OMAP243X_CONTROL_DEVCONF1);
253 }
254
255 if (mmc->slots[0].internal_clock) {
256 reg = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
257 reg |= OMAP2_MMCSDIO1ADPCLKISEL;
258 omap_ctrl_writel(reg, OMAP2_CONTROL_DEVCONF0);
259 }
260
261 reg = omap_ctrl_readl(control_pbias_offset);
262 reg |= OMAP2_PBIASSPEEDCTRL0;
263 reg &= ~OMAP2_PBIASLITEPWRDNZ0;
264 omap_ctrl_writel(reg, control_pbias_offset);
265
266 ret = twl_mmc_set_voltage(c, vdd);
267
268 /* 100ms delay required for PBIAS configuration */
269 msleep(100);
270 reg = omap_ctrl_readl(control_pbias_offset);
271 reg |= (OMAP2_PBIASLITEPWRDNZ0 | OMAP2_PBIASSPEEDCTRL0);
272 if ((1 << vdd) <= MMC_VDD_165_195)
273 reg &= ~OMAP2_PBIASLITEVMODE0;
274 else
275 reg |= OMAP2_PBIASLITEVMODE0;
276 omap_ctrl_writel(reg, control_pbias_offset);
277 } else {
278 reg = omap_ctrl_readl(control_pbias_offset);
279 reg &= ~OMAP2_PBIASLITEPWRDNZ0;
280 omap_ctrl_writel(reg, control_pbias_offset);
281
282 ret = twl_mmc_set_voltage(c, 0);
283
284 /* 100ms delay required for PBIAS configuration */
285 msleep(100);
286 reg = omap_ctrl_readl(control_pbias_offset);
287 reg |= (OMAP2_PBIASSPEEDCTRL0 | OMAP2_PBIASLITEPWRDNZ0 |
288 OMAP2_PBIASLITEVMODE0);
289 omap_ctrl_writel(reg, control_pbias_offset);
290 }
291
292 return ret;
293}
294
295static int twl_mmc2_set_power(struct device *dev, int slot, int power_on, int vdd)
296{
297 int ret;
298 struct twl_mmc_controller *c = &hsmmc[1];
299 struct omap_mmc_platform_data *mmc = dev->platform_data;
300
301 if (power_on) {
302 if (mmc->slots[0].internal_clock) {
303 u32 reg;
304
305 reg = omap_ctrl_readl(control_devconf1_offset);
306 reg |= OMAP2_MMCSDIO2ADPCLKISEL;
307 omap_ctrl_writel(reg, control_devconf1_offset);
308 }
309 ret = twl_mmc_set_voltage(c, vdd);
310 } else {
311 ret = twl_mmc_set_voltage(c, 0);
312 }
313
314 return ret;
315}
316
317static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC] __initdata;
318
319void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
320{
321 struct twl4030_hsmmc_info *c;
322 int nr_hsmmc = ARRAY_SIZE(hsmmc_data);
323
324 if (cpu_is_omap2430()) {
325 control_pbias_offset = OMAP243X_CONTROL_PBIAS_LITE;
326 control_devconf1_offset = OMAP243X_CONTROL_DEVCONF1;
327 nr_hsmmc = 2;
328 } else {
329 control_pbias_offset = OMAP343X_CONTROL_PBIAS_LITE;
330 control_devconf1_offset = OMAP343X_CONTROL_DEVCONF1;
331 }
332
333 for (c = controllers; c->mmc; c++) {
334 struct twl_mmc_controller *twl = hsmmc + c->mmc - 1;
335 struct omap_mmc_platform_data *mmc = hsmmc_data[c->mmc - 1];
336
337 if (!c->mmc || c->mmc > nr_hsmmc) {
338 pr_debug("MMC%d: no such controller\n", c->mmc);
339 continue;
340 }
341 if (mmc) {
342 pr_debug("MMC%d: already configured\n", c->mmc);
343 continue;
344 }
345
346 mmc = kzalloc(sizeof(struct omap_mmc_platform_data), GFP_KERNEL);
347 if (!mmc) {
348 pr_err("Cannot allocate memory for mmc device!\n");
349 return;
350 }
351
352 sprintf(twl->name, "mmc%islot%i", c->mmc, 1);
353 mmc->slots[0].name = twl->name;
354 mmc->nr_slots = 1;
355 mmc->slots[0].ocr_mask = MMC_VDD_165_195 |
356 MMC_VDD_26_27 | MMC_VDD_27_28 |
357 MMC_VDD_29_30 |
358 MMC_VDD_30_31 | MMC_VDD_31_32;
359 mmc->slots[0].wires = c->wires;
360 mmc->slots[0].internal_clock = !c->ext_clock;
361 mmc->dma_mask = 0xffffffff;
362
363 /* note: twl4030 card detect GPIOs normally switch VMMCx ... */
364 if (gpio_is_valid(c->gpio_cd)) {
365 mmc->init = twl_mmc_late_init;
366 mmc->cleanup = twl_mmc_cleanup;
367 mmc->suspend = twl_mmc_suspend;
368 mmc->resume = twl_mmc_resume;
369
370 mmc->slots[0].switch_pin = c->gpio_cd;
371 mmc->slots[0].card_detect_irq = gpio_to_irq(c->gpio_cd);
372 mmc->slots[0].card_detect = twl_mmc_card_detect;
373 } else
374 mmc->slots[0].switch_pin = -EINVAL;
375
376 /* write protect normally uses an OMAP gpio */
377 if (gpio_is_valid(c->gpio_wp)) {
378 gpio_request(c->gpio_wp, "mmc_wp");
379 gpio_direction_input(c->gpio_wp);
380
381 mmc->slots[0].gpio_wp = c->gpio_wp;
382 mmc->slots[0].get_ro = twl_mmc_get_ro;
383 } else
384 mmc->slots[0].gpio_wp = -EINVAL;
385
386 /* NOTE: we assume OMAP's MMC1 and MMC2 use
387 * the TWL4030's VMMC1 and VMMC2, respectively;
388 * and that OMAP's MMC3 isn't used.
389 */
390
391 switch (c->mmc) {
392 case 1:
393 mmc->slots[0].set_power = twl_mmc1_set_power;
394 break;
395 case 2:
396 mmc->slots[0].set_power = twl_mmc2_set_power;
397 break;
398 default:
399 pr_err("MMC%d configuration not supported!\n", c->mmc);
400 continue;
401 }
402 hsmmc_data[c->mmc - 1] = mmc;
403 }
404
405 omap2_init_mmc(hsmmc_data, OMAP34XX_NR_MMC);
406}
407
408#endif
diff --git a/arch/arm/mach-omap2/mmc-twl4030.h b/arch/arm/mach-omap2/mmc-twl4030.h
new file mode 100644
index 000000000000..e1c8076400ca
--- /dev/null
+++ b/arch/arm/mach-omap2/mmc-twl4030.h
@@ -0,0 +1,29 @@
1/*
2 * MMC definitions for OMAP2
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9struct twl4030_hsmmc_info {
10 u8 mmc; /* controller 1/2/3 */
11 u8 wires; /* 1/4/8 wires */
12 int gpio_cd; /* or -EINVAL */
13 int gpio_wp; /* or -EINVAL */
14 int ext_clock:1; /* use external pin for input clock */
15};
16
17#if defined(CONFIG_TWL4030_CORE) && \
18 (defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
19 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE))
20
21void twl4030_mmc_init(struct twl4030_hsmmc_info *);
22
23#else
24
25static inline void twl4030_mmc_init(struct twl4030_hsmmc_info *info)
26{
27}
28
29#endif
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index b1393673d95d..dacb41f130c0 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -203,6 +203,15 @@ MUX_CFG_24XX("AE9_2430_USB0HS_NXT", 0x13D, 0, 0, 0, 1)
203MUX_CFG_24XX("AC7_2430_USB0HS_DATA7", 0x13E, 0, 0, 0, 1) 203MUX_CFG_24XX("AC7_2430_USB0HS_DATA7", 0x13E, 0, 0, 0, 1)
204 204
205/* 2430 McBSP */ 205/* 2430 McBSP */
206MUX_CFG_24XX("AD6_2430_MCBSP_CLKS", 0x011E, 0, 0, 0, 1)
207
208MUX_CFG_24XX("AB2_2430_MCBSP1_CLKR", 0x011A, 0, 0, 0, 1)
209MUX_CFG_24XX("AD5_2430_MCBSP1_FSR", 0x011B, 0, 0, 0, 1)
210MUX_CFG_24XX("AA1_2430_MCBSP1_DX", 0x011C, 0, 0, 0, 1)
211MUX_CFG_24XX("AF3_2430_MCBSP1_DR", 0x011D, 0, 0, 0, 1)
212MUX_CFG_24XX("AB3_2430_MCBSP1_FSX", 0x011F, 0, 0, 0, 1)
213MUX_CFG_24XX("Y9_2430_MCBSP1_CLKX", 0x0120, 0, 0, 0, 1)
214
206MUX_CFG_24XX("AC10_2430_MCBSP2_FSX", 0x012E, 1, 0, 0, 1) 215MUX_CFG_24XX("AC10_2430_MCBSP2_FSX", 0x012E, 1, 0, 0, 1)
207MUX_CFG_24XX("AD16_2430_MCBSP2_CLX", 0x012F, 1, 0, 0, 1) 216MUX_CFG_24XX("AD16_2430_MCBSP2_CLX", 0x012F, 1, 0, 0, 1)
208MUX_CFG_24XX("AE13_2430_MCBSP2_DX", 0x0130, 1, 0, 0, 1) 217MUX_CFG_24XX("AE13_2430_MCBSP2_DX", 0x0130, 1, 0, 0, 1)
@@ -211,6 +220,31 @@ MUX_CFG_24XX("AC10_2430_MCBSP2_FSX_OFF",0x012E, 0, 0, 0, 1)
211MUX_CFG_24XX("AD16_2430_MCBSP2_CLX_OFF",0x012F, 0, 0, 0, 1) 220MUX_CFG_24XX("AD16_2430_MCBSP2_CLX_OFF",0x012F, 0, 0, 0, 1)
212MUX_CFG_24XX("AE13_2430_MCBSP2_DX_OFF", 0x0130, 0, 0, 0, 1) 221MUX_CFG_24XX("AE13_2430_MCBSP2_DX_OFF", 0x0130, 0, 0, 0, 1)
213MUX_CFG_24XX("AD13_2430_MCBSP2_DR_OFF", 0x0131, 0, 0, 0, 1) 222MUX_CFG_24XX("AD13_2430_MCBSP2_DR_OFF", 0x0131, 0, 0, 0, 1)
223
224MUX_CFG_24XX("AC9_2430_MCBSP3_CLKX", 0x0103, 0, 0, 0, 1)
225MUX_CFG_24XX("AE4_2430_MCBSP3_FSX", 0x0104, 0, 0, 0, 1)
226MUX_CFG_24XX("AE2_2430_MCBSP3_DR", 0x0105, 0, 0, 0, 1)
227MUX_CFG_24XX("AF4_2430_MCBSP3_DX", 0x0106, 0, 0, 0, 1)
228
229MUX_CFG_24XX("N3_2430_MCBSP4_CLKX", 0x010B, 1, 0, 0, 1)
230MUX_CFG_24XX("AD23_2430_MCBSP4_DR", 0x010C, 1, 0, 0, 1)
231MUX_CFG_24XX("AB25_2430_MCBSP4_DX", 0x010D, 1, 0, 0, 1)
232MUX_CFG_24XX("AC25_2430_MCBSP4_FSX", 0x010E, 1, 0, 0, 1)
233
234MUX_CFG_24XX("AE16_2430_MCBSP5_CLKX", 0x00ED, 1, 0, 0, 1)
235MUX_CFG_24XX("AF12_2430_MCBSP5_FSX", 0x00ED, 1, 0, 0, 1)
236MUX_CFG_24XX("K7_2430_MCBSP5_DX", 0x00EF, 1, 0, 0, 1)
237MUX_CFG_24XX("M1_2430_MCBSP5_DR", 0x00F0, 1, 0, 0, 1)
238
239/* 2430 MCSPI1 */
240MUX_CFG_24XX("Y18_2430_MCSPI1_CLK", 0x010F, 0, 0, 0, 1)
241MUX_CFG_24XX("AD15_2430_MCSPI1_SIMO", 0x0110, 0, 0, 0, 1)
242MUX_CFG_24XX("AE17_2430_MCSPI1_SOMI", 0x0111, 0, 0, 0, 1)
243MUX_CFG_24XX("U1_2430_MCSPI1_CS0", 0x0112, 0, 0, 0, 1)
244
245/* Touchscreen GPIO */
246MUX_CFG_24XX("AF19_2430_GPIO_85", 0x0113, 3, 0, 0, 1)
247
214}; 248};
215 249
216#define OMAP24XX_PINS_SZ ARRAY_SIZE(omap24xx_pins) 250#define OMAP24XX_PINS_SZ ARRAY_SIZE(omap24xx_pins)
@@ -417,6 +451,14 @@ MUX_CFG_34XX("AD2_3430_USB3FS_PHY_MM3_TXDAT", 0x188,
417MUX_CFG_34XX("AC1_3430_USB3FS_PHY_MM3_TXEN_N", 0x18a, 451MUX_CFG_34XX("AC1_3430_USB3FS_PHY_MM3_TXEN_N", 0x18a,
418 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_OUTPUT) 452 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_OUTPUT)
419 453
454
455/* 34XX GPIO - bidirectional, unless the name has an "_OUT" suffix.
456 * No internal pullup/pulldown without "_UP" or "_DOWN" suffix.
457 */
458MUX_CFG_34XX("AH8_34XX_GPIO29", 0x5fa,
459 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
460MUX_CFG_34XX("J25_34XX_GPIO170", 0x1c6,
461 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
420}; 462};
421 463
422#define OMAP34XX_PINS_SZ ARRAY_SIZE(omap34xx_pins) 464#define OMAP34XX_PINS_SZ ARRAY_SIZE(omap34xx_pins)
@@ -452,7 +494,7 @@ static void __init_or_module omap2_cfg_debug(const struct pin_config *cfg, u16 r
452#endif 494#endif
453 495
454#ifdef CONFIG_ARCH_OMAP24XX 496#ifdef CONFIG_ARCH_OMAP24XX
455int __init_or_module omap24xx_cfg_reg(const struct pin_config *cfg) 497static int __init_or_module omap24xx_cfg_reg(const struct pin_config *cfg)
456{ 498{
457 static DEFINE_SPINLOCK(mux_spin_lock); 499 static DEFINE_SPINLOCK(mux_spin_lock);
458 unsigned long flags; 500 unsigned long flags;
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index 589393bedade..ae6036300f60 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -120,7 +120,7 @@ static void __init omap2_gp_clockevent_init(void)
120 clockevent_gpt.min_delta_ns = 120 clockevent_gpt.min_delta_ns =
121 clockevent_delta2ns(1, &clockevent_gpt); 121 clockevent_delta2ns(1, &clockevent_gpt);
122 122
123 clockevent_gpt.cpumask = cpumask_of_cpu(0); 123 clockevent_gpt.cpumask = cpumask_of(0);
124 clockevents_register_device(&clockevent_gpt); 124 clockevents_register_device(&clockevent_gpt);
125} 125}
126 126
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c
index 10ef464d6be7..15e509013def 100644
--- a/arch/arm/mach-omap2/usb-tusb6010.c
+++ b/arch/arm/mach-omap2/usb-tusb6010.c
@@ -12,11 +12,11 @@
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/delay.h> 13#include <linux/delay.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/gpio.h>
15 16
16#include <linux/usb/musb.h> 17#include <linux/usb/musb.h>
17 18
18#include <mach/gpmc.h> 19#include <mach/gpmc.h>
19#include <mach/gpio.h>
20#include <mach/mux.h> 20#include <mach/mux.h>
21 21
22 22
@@ -292,12 +292,12 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data *data,
292 ); 292 );
293 293
294 /* IRQ */ 294 /* IRQ */
295 status = omap_request_gpio(irq); 295 status = gpio_request(irq, "TUSB6010 irq");
296 if (status < 0) { 296 if (status < 0) {
297 printk(error, 3, status); 297 printk(error, 3, status);
298 return status; 298 return status;
299 } 299 }
300 omap_set_gpio_direction(irq, 1); 300 gpio_direction_input(irq);
301 tusb_resources[2].start = irq + IH_GPIO_BASE; 301 tusb_resources[2].start = irq + IH_GPIO_BASE;
302 302
303 /* set up memory timings ... can speed them up later */ 303 /* set up memory timings ... can speed them up later */
diff --git a/arch/arm/mach-orion5x/Makefile b/arch/arm/mach-orion5x/Makefile
index 3d4a1bc12355..edc38e2c856f 100644
--- a/arch/arm/mach-orion5x/Makefile
+++ b/arch/arm/mach-orion5x/Makefile
@@ -1,4 +1,4 @@
1obj-y += common.o addr-map.o pci.o gpio.o irq.o mpp.o 1obj-y += common.o addr-map.o pci.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
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 437065c25c9c..0a623379789f 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -72,6 +72,7 @@ void __init orion5x_map_io(void)
72 ****************************************************************************/ 72 ****************************************************************************/
73static struct orion_ehci_data orion5x_ehci_data = { 73static struct orion_ehci_data orion5x_ehci_data = {
74 .dram = &orion5x_mbus_dram_info, 74 .dram = &orion5x_mbus_dram_info,
75 .phy_version = EHCI_PHY_ORION,
75}; 76};
76 77
77static u64 ehci_dmamask = 0xffffffffUL; 78static u64 ehci_dmamask = 0xffffffffUL;
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h
index a000c7c6ee96..798b9a5e3da9 100644
--- a/arch/arm/mach-orion5x/common.h
+++ b/arch/arm/mach-orion5x/common.h
@@ -51,13 +51,6 @@ int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys);
51struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys); 51struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys);
52int orion5x_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin); 52int orion5x_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin);
53 53
54/*
55 * Valid GPIO pins according to MPP setup, used by machine-setup.
56 * (/mach-orion/gpio.c).
57 */
58void orion5x_gpio_set_valid(unsigned pin, int valid);
59void gpio_display(void); /* debug */
60
61struct machine_desc; 54struct machine_desc;
62struct meminfo; 55struct meminfo;
63struct tag; 56struct tag;
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index 3e66098340a5..0722d6510df1 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -21,6 +21,7 @@
21#include <linux/gpio_keys.h> 21#include <linux/gpio_keys.h>
22#include <linux/input.h> 22#include <linux/input.h>
23#include <linux/i2c.h> 23#include <linux/i2c.h>
24#include <linux/ata_platform.h>
24#include <asm/mach-types.h> 25#include <asm/mach-types.h>
25#include <asm/gpio.h> 26#include <asm/gpio.h>
26#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
@@ -64,9 +65,21 @@ static struct hw_pci dns323_pci __initdata = {
64 .map_irq = dns323_pci_map_irq, 65 .map_irq = dns323_pci_map_irq,
65}; 66};
66 67
68static int __init dns323_dev_id(void)
69{
70 u32 dev, rev;
71
72 orion5x_pcie_id(&dev, &rev);
73
74 return dev;
75}
76
67static int __init dns323_pci_init(void) 77static int __init dns323_pci_init(void)
68{ 78{
69 if (machine_is_dns323()) 79 /* The 5182 doesn't really use it's PCI bus, and initialising PCI
80 * gets in the way of initialising the SATA controller.
81 */
82 if (machine_is_dns323() && dns323_dev_id() != MV88F5182_DEV_ID)
70 pci_common_init(&dns323_pci); 83 pci_common_init(&dns323_pci);
71 84
72 return 0; 85 return 0;
@@ -75,14 +88,6 @@ static int __init dns323_pci_init(void)
75subsys_initcall(dns323_pci_init); 88subsys_initcall(dns323_pci_init);
76 89
77/**************************************************************************** 90/****************************************************************************
78 * Ethernet
79 */
80
81static struct mv643xx_eth_platform_data dns323_eth_data = {
82 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
83};
84
85/****************************************************************************
86 * 8MiB NOR flash (Spansion S29GL064M90TFIR4) 91 * 8MiB NOR flash (Spansion S29GL064M90TFIR4)
87 * 92 *
88 * Layout as used by D-Link: 93 * Layout as used by D-Link:
@@ -143,6 +148,90 @@ static struct platform_device dns323_nor_flash = {
143}; 148};
144 149
145/**************************************************************************** 150/****************************************************************************
151 * Ethernet
152 */
153
154static struct mv643xx_eth_platform_data dns323_eth_data = {
155 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
156};
157
158/* dns323_parse_hex_*() taken from tsx09-common.c; should a common copy of these
159 * functions be kept somewhere?
160 */
161static int __init dns323_parse_hex_nibble(char n)
162{
163 if (n >= '0' && n <= '9')
164 return n - '0';
165
166 if (n >= 'A' && n <= 'F')
167 return n - 'A' + 10;
168
169 if (n >= 'a' && n <= 'f')
170 return n - 'a' + 10;
171
172 return -1;
173}
174
175static int __init dns323_parse_hex_byte(const char *b)
176{
177 int hi;
178 int lo;
179
180 hi = dns323_parse_hex_nibble(b[0]);
181 lo = dns323_parse_hex_nibble(b[1]);
182
183 if (hi < 0 || lo < 0)
184 return -1;
185
186 return (hi << 4) | lo;
187}
188
189static int __init dns323_read_mac_addr(void)
190{
191 u_int8_t addr[6];
192 int i;
193 char *mac_page;
194
195 /* MAC address is stored as a regular ol' string in /dev/mtdblock4
196 * (0x007d0000-0x00800000) starting at offset 196480 (0x2ff80).
197 */
198 mac_page = ioremap(DNS323_NOR_BOOT_BASE + 0x7d0000 + 196480, 1024);
199 if (!mac_page)
200 return -ENOMEM;
201
202 /* Sanity check the string we're looking at */
203 for (i = 0; i < 5; i++) {
204 if (*(mac_page + (i * 3) + 2) != ':') {
205 goto error_fail;
206 }
207 }
208
209 for (i = 0; i < 6; i++) {
210 int byte;
211
212 byte = dns323_parse_hex_byte(mac_page + (i * 3));
213 if (byte < 0) {
214 goto error_fail;
215 }
216
217 addr[i] = byte;
218 }
219
220 iounmap(mac_page);
221 printk("DNS323: Found ethernet MAC address: ");
222 for (i = 0; i < 6; i++)
223 printk("%.2x%s", addr[i], (i < 5) ? ":" : ".\n");
224
225 memcpy(dns323_eth_data.mac_addr, addr, 6);
226
227 return 0;
228
229error_fail:
230 iounmap(mac_page);
231 return -EINVAL;
232}
233
234/****************************************************************************
146 * GPIO LEDs (simple - doesn't use hardware blinking support) 235 * GPIO LEDs (simple - doesn't use hardware blinking support)
147 */ 236 */
148 237
@@ -207,10 +296,17 @@ static struct platform_device dns323_button_device = {
207 }, 296 },
208}; 297};
209 298
299/*****************************************************************************
300 * SATA
301 */
302static struct mv_sata_platform_data dns323_sata_data = {
303 .n_ports = 2,
304};
305
210/**************************************************************************** 306/****************************************************************************
211 * General Setup 307 * General Setup
212 */ 308 */
213static struct orion5x_mpp_mode dns323_mpp_modes[] __initdata = { 309static struct orion5x_mpp_mode dns323_mv88f5181_mpp_modes[] __initdata = {
214 { 0, MPP_PCIE_RST_OUTn }, 310 { 0, MPP_PCIE_RST_OUTn },
215 { 1, MPP_GPIO }, /* right amber LED (sata ch0) */ 311 { 1, MPP_GPIO }, /* right amber LED (sata ch0) */
216 { 2, MPP_GPIO }, /* left amber LED (sata ch1) */ 312 { 2, MPP_GPIO }, /* left amber LED (sata ch1) */
@@ -234,6 +330,30 @@ static struct orion5x_mpp_mode dns323_mpp_modes[] __initdata = {
234 { -1 }, 330 { -1 },
235}; 331};
236 332
333static struct orion5x_mpp_mode dns323_mv88f5182_mpp_modes[] __initdata = {
334 { 0, MPP_UNUSED },
335 { 1, MPP_GPIO }, /* right amber LED (sata ch0) */
336 { 2, MPP_GPIO }, /* left amber LED (sata ch1) */
337 { 3, MPP_UNUSED },
338 { 4, MPP_GPIO }, /* power button LED */
339 { 5, MPP_GPIO }, /* power button LED */
340 { 6, MPP_GPIO }, /* GMT G751-2f overtemp */
341 { 7, MPP_GPIO }, /* M41T80 nIRQ/OUT/SQW */
342 { 8, MPP_GPIO }, /* triggers power off */
343 { 9, MPP_GPIO }, /* power button switch */
344 { 10, MPP_GPIO }, /* reset button switch */
345 { 11, MPP_UNUSED },
346 { 12, MPP_SATA_LED },
347 { 13, MPP_SATA_LED },
348 { 14, MPP_SATA_LED },
349 { 15, MPP_SATA_LED },
350 { 16, MPP_UNUSED },
351 { 17, MPP_UNUSED },
352 { 18, MPP_UNUSED },
353 { 19, MPP_UNUSED },
354 { -1 },
355};
356
237/* 357/*
238 * On the DNS-323 the following devices are attached via I2C: 358 * On the DNS-323 the following devices are attached via I2C:
239 * 359 *
@@ -264,16 +384,15 @@ static void __init dns323_init(void)
264 /* Setup basic Orion functions. Need to be called early. */ 384 /* Setup basic Orion functions. Need to be called early. */
265 orion5x_init(); 385 orion5x_init();
266 386
267 orion5x_mpp_conf(dns323_mpp_modes); 387 /* Just to be tricky, the 5182 has a completely different
268 writel(0, MPP_DEV_CTRL); /* DEV_D[31:16] */ 388 * set of MPP modes to the 5181.
269
270 /*
271 * Configure peripherals.
272 */ 389 */
273 orion5x_ehci0_init(); 390 if (dns323_dev_id() == MV88F5182_DEV_ID)
274 orion5x_eth_init(&dns323_eth_data); 391 orion5x_mpp_conf(dns323_mv88f5182_mpp_modes);
275 orion5x_i2c_init(); 392 else {
276 orion5x_uart0_init(); 393 orion5x_mpp_conf(dns323_mv88f5181_mpp_modes);
394 writel(0, MPP_DEV_CTRL); /* DEV_D[31:16] */
395 }
277 396
278 /* setup flash mapping 397 /* setup flash mapping
279 * CS3 holds a 8 MB Spansion S29GL064M90TFIR4 398 * CS3 holds a 8 MB Spansion S29GL064M90TFIR4
@@ -288,6 +407,23 @@ static void __init dns323_init(void)
288 i2c_register_board_info(0, dns323_i2c_devices, 407 i2c_register_board_info(0, dns323_i2c_devices,
289 ARRAY_SIZE(dns323_i2c_devices)); 408 ARRAY_SIZE(dns323_i2c_devices));
290 409
410 /*
411 * Configure peripherals.
412 */
413 if (dns323_read_mac_addr() < 0)
414 printk("DNS323: Failed to read MAC address\n");
415
416 orion5x_ehci0_init();
417 orion5x_eth_init(&dns323_eth_data);
418 orion5x_i2c_init();
419 orion5x_uart0_init();
420
421 /* The 5182 has it's SATA controller on-chip, and needs it's own little
422 * init routine.
423 */
424 if (dns323_dev_id() == MV88F5182_DEV_ID)
425 orion5x_sata_init(&dns323_sata_data);
426
291 /* register dns323 specific power-off method */ 427 /* register dns323 specific power-off method */
292 if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 || 428 if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
293 gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0) 429 gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
diff --git a/arch/arm/mach-orion5x/gpio.c b/arch/arm/mach-orion5x/gpio.c
deleted file mode 100644
index f99d08811e5a..000000000000
--- a/arch/arm/mach-orion5x/gpio.c
+++ /dev/null
@@ -1,231 +0,0 @@
1/*
2 * arch/arm/mach-orion5x/gpio.c
3 *
4 * GPIO functions for Marvell Orion System On Chip
5 *
6 * Maintainer: Tzachi Perelstein <tzachi@marvell.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/module.h>
16#include <linux/spinlock.h>
17#include <linux/bitops.h>
18#include <linux/io.h>
19#include <asm/gpio.h>
20#include <mach/orion5x.h>
21#include "common.h"
22
23static DEFINE_SPINLOCK(gpio_lock);
24static unsigned long gpio_valid[BITS_TO_LONGS(GPIO_MAX)];
25static const char *gpio_label[GPIO_MAX]; /* non null for allocated GPIOs */
26
27void __init orion5x_gpio_set_valid(unsigned pin, int valid)
28{
29 if (valid)
30 __set_bit(pin, gpio_valid);
31 else
32 __clear_bit(pin, gpio_valid);
33}
34
35/*
36 * GENERIC_GPIO primitives
37 */
38int gpio_direction_input(unsigned pin)
39{
40 unsigned long flags;
41
42 if (pin >= GPIO_MAX || !test_bit(pin, gpio_valid)) {
43 pr_debug("%s: invalid GPIO %d\n", __func__, pin);
44 return -EINVAL;
45 }
46
47 spin_lock_irqsave(&gpio_lock, flags);
48
49 /*
50 * Some callers might have not used the gpio_request(),
51 * so flag this pin as requested now.
52 */
53 if (!gpio_label[pin])
54 gpio_label[pin] = "?";
55
56 orion5x_setbits(GPIO_IO_CONF, 1 << pin);
57
58 spin_unlock_irqrestore(&gpio_lock, flags);
59 return 0;
60}
61EXPORT_SYMBOL(gpio_direction_input);
62
63int gpio_direction_output(unsigned pin, int value)
64{
65 unsigned long flags;
66 int mask;
67
68 if (pin >= GPIO_MAX || !test_bit(pin, gpio_valid)) {
69 pr_debug("%s: invalid GPIO %d\n", __func__, pin);
70 return -EINVAL;
71 }
72
73 spin_lock_irqsave(&gpio_lock, flags);
74
75 /*
76 * Some callers might have not used the gpio_request(),
77 * so flag this pin as requested now.
78 */
79 if (!gpio_label[pin])
80 gpio_label[pin] = "?";
81
82 mask = 1 << pin;
83 orion5x_clrbits(GPIO_BLINK_EN, mask);
84 if (value)
85 orion5x_setbits(GPIO_OUT, mask);
86 else
87 orion5x_clrbits(GPIO_OUT, mask);
88 orion5x_clrbits(GPIO_IO_CONF, mask);
89
90 spin_unlock_irqrestore(&gpio_lock, flags);
91 return 0;
92}
93EXPORT_SYMBOL(gpio_direction_output);
94
95int gpio_get_value(unsigned pin)
96{
97 int val, mask = 1 << pin;
98
99 if (readl(GPIO_IO_CONF) & mask)
100 val = readl(GPIO_DATA_IN) ^ readl(GPIO_IN_POL);
101 else
102 val = readl(GPIO_OUT);
103
104 return val & mask;
105}
106EXPORT_SYMBOL(gpio_get_value);
107
108void gpio_set_value(unsigned pin, int value)
109{
110 unsigned long flags;
111 int mask = 1 << pin;
112
113 spin_lock_irqsave(&gpio_lock, flags);
114
115 orion5x_clrbits(GPIO_BLINK_EN, mask);
116 if (value)
117 orion5x_setbits(GPIO_OUT, mask);
118 else
119 orion5x_clrbits(GPIO_OUT, mask);
120
121 spin_unlock_irqrestore(&gpio_lock, flags);
122}
123EXPORT_SYMBOL(gpio_set_value);
124
125void orion5x_gpio_set_blink(unsigned pin, int blink)
126{
127 unsigned long flags;
128 int mask = 1 << pin;
129
130 spin_lock_irqsave(&gpio_lock, flags);
131
132 orion5x_clrbits(GPIO_OUT, mask);
133 if (blink)
134 orion5x_setbits(GPIO_BLINK_EN, mask);
135 else
136 orion5x_clrbits(GPIO_BLINK_EN, mask);
137
138 spin_unlock_irqrestore(&gpio_lock, flags);
139}
140EXPORT_SYMBOL(orion5x_gpio_set_blink);
141
142int gpio_request(unsigned pin, const char *label)
143{
144 int ret = 0;
145 unsigned long flags;
146
147 if (pin >= GPIO_MAX || !test_bit(pin, gpio_valid)) {
148 pr_debug("%s: invalid GPIO %d\n", __func__, pin);
149 return -EINVAL;
150 }
151
152 spin_lock_irqsave(&gpio_lock, flags);
153
154 if (gpio_label[pin]) {
155 pr_debug("%s: GPIO %d already used as %s\n",
156 __func__, pin, gpio_label[pin]);
157 ret = -EBUSY;
158 } else
159 gpio_label[pin] = label ? label : "?";
160
161 spin_unlock_irqrestore(&gpio_lock, flags);
162 return ret;
163}
164EXPORT_SYMBOL(gpio_request);
165
166void gpio_free(unsigned pin)
167{
168 might_sleep();
169
170 if (pin >= GPIO_MAX || !test_bit(pin, gpio_valid)) {
171 pr_debug("%s: invalid GPIO %d\n", __func__, pin);
172 return;
173 }
174
175 if (!gpio_label[pin])
176 pr_warning("%s: GPIO %d already freed\n", __func__, pin);
177 else
178 gpio_label[pin] = NULL;
179}
180EXPORT_SYMBOL(gpio_free);
181
182/* Debug helper */
183void gpio_display(void)
184{
185 int i;
186
187 for (i = 0; i < GPIO_MAX; i++) {
188 printk(KERN_DEBUG "Pin-%d: ", i);
189
190 if (!test_bit(i, gpio_valid)) {
191 printk("non-GPIO\n");
192 } else if (!gpio_label[i]) {
193 printk("GPIO, free\n");
194 } else {
195 printk("GPIO, used by %s, ", gpio_label[i]);
196 if (readl(GPIO_IO_CONF) & (1 << i)) {
197 printk("input, active %s, level %s, edge %s\n",
198 ((readl(GPIO_IN_POL) >> i) & 1) ? "low" : "high",
199 ((readl(GPIO_LEVEL_MASK) >> i) & 1) ? "enabled" : "masked",
200 ((readl(GPIO_EDGE_MASK) >> i) & 1) ? "enabled" : "masked");
201 } else {
202 printk("output, val=%d\n", (readl(GPIO_OUT) >> i) & 1);
203 }
204 }
205 }
206
207 printk(KERN_DEBUG "MPP_0_7_CTRL (0x%08x) = 0x%08x\n",
208 MPP_0_7_CTRL, readl(MPP_0_7_CTRL));
209 printk(KERN_DEBUG "MPP_8_15_CTRL (0x%08x) = 0x%08x\n",
210 MPP_8_15_CTRL, readl(MPP_8_15_CTRL));
211 printk(KERN_DEBUG "MPP_16_19_CTRL (0x%08x) = 0x%08x\n",
212 MPP_16_19_CTRL, readl(MPP_16_19_CTRL));
213 printk(KERN_DEBUG "MPP_DEV_CTRL (0x%08x) = 0x%08x\n",
214 MPP_DEV_CTRL, readl(MPP_DEV_CTRL));
215 printk(KERN_DEBUG "GPIO_OUT (0x%08x) = 0x%08x\n",
216 GPIO_OUT, readl(GPIO_OUT));
217 printk(KERN_DEBUG "GPIO_IO_CONF (0x%08x) = 0x%08x\n",
218 GPIO_IO_CONF, readl(GPIO_IO_CONF));
219 printk(KERN_DEBUG "GPIO_BLINK_EN (0x%08x) = 0x%08x\n",
220 GPIO_BLINK_EN, readl(GPIO_BLINK_EN));
221 printk(KERN_DEBUG "GPIO_IN_POL (0x%08x) = 0x%08x\n",
222 GPIO_IN_POL, readl(GPIO_IN_POL));
223 printk(KERN_DEBUG "GPIO_DATA_IN (0x%08x) = 0x%08x\n",
224 GPIO_DATA_IN, readl(GPIO_DATA_IN));
225 printk(KERN_DEBUG "GPIO_LEVEL_MASK (0x%08x) = 0x%08x\n",
226 GPIO_LEVEL_MASK, readl(GPIO_LEVEL_MASK));
227 printk(KERN_DEBUG "GPIO_EDGE_CAUSE (0x%08x) = 0x%08x\n",
228 GPIO_EDGE_CAUSE, readl(GPIO_EDGE_CAUSE));
229 printk(KERN_DEBUG "GPIO_EDGE_MASK (0x%08x) = 0x%08x\n",
230 GPIO_EDGE_MASK, readl(GPIO_EDGE_MASK));
231}
diff --git a/arch/arm/mach-orion5x/include/mach/dma.h b/arch/arm/mach-orion5x/include/mach/dma.h
deleted file mode 100644
index 40a8c178f10d..000000000000
--- a/arch/arm/mach-orion5x/include/mach/dma.h
+++ /dev/null
@@ -1 +0,0 @@
1/* empty */
diff --git a/arch/arm/mach-orion5x/include/mach/gpio.h b/arch/arm/mach-orion5x/include/mach/gpio.h
index 65dc136a86f7..d8182e87ac16 100644
--- a/arch/arm/mach-orion5x/include/mach/gpio.h
+++ b/arch/arm/mach-orion5x/include/mach/gpio.h
@@ -2,18 +2,26 @@
2 * arch/arm/mach-orion5x/include/mach/gpio.h 2 * arch/arm/mach-orion5x/include/mach/gpio.h
3 * 3 *
4 * This file is licensed under the terms of the GNU General Public 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 5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied. 6 * warranty of any kind, whether express or implied.
7 */ 7 */
8 8
9extern int gpio_request(unsigned pin, const char *label); 9#ifndef __ASM_ARCH_GPIO_H
10extern void gpio_free(unsigned pin); 10#define __ASM_ARCH_GPIO_H
11extern int gpio_direction_input(unsigned pin); 11
12extern int gpio_direction_output(unsigned pin, int value); 12#include <mach/irqs.h>
13extern int gpio_get_value(unsigned pin); 13#include <plat/gpio.h>
14extern void gpio_set_value(unsigned pin, int value); 14#include <asm-generic/gpio.h> /* cansleep wrappers */
15extern void orion5x_gpio_set_blink(unsigned pin, int blink); 15
16extern void gpio_display(void); /* debug */ 16#define GPIO_MAX 32
17#define GPIO_OUT(pin) ORION5X_DEV_BUS_REG(0x100)
18#define GPIO_IO_CONF(pin) ORION5X_DEV_BUS_REG(0x104)
19#define GPIO_BLINK_EN(pin) ORION5X_DEV_BUS_REG(0x108)
20#define GPIO_IN_POL(pin) ORION5X_DEV_BUS_REG(0x10c)
21#define GPIO_DATA_IN(pin) ORION5X_DEV_BUS_REG(0x110)
22#define GPIO_EDGE_CAUSE(pin) ORION5X_DEV_BUS_REG(0x114)
23#define GPIO_EDGE_MASK(pin) ORION5X_DEV_BUS_REG(0x118)
24#define GPIO_LEVEL_MASK(pin) ORION5X_DEV_BUS_REG(0x11c)
17 25
18static inline int gpio_to_irq(int pin) 26static inline int gpio_to_irq(int pin)
19{ 27{
@@ -25,4 +33,5 @@ static inline int irq_to_gpio(int irq)
25 return irq - IRQ_ORION5X_GPIO_START; 33 return irq - IRQ_ORION5X_GPIO_START;
26} 34}
27 35
28#include <asm-generic/gpio.h> /* cansleep wrappers */ 36
37#endif
diff --git a/arch/arm/mach-orion5x/include/mach/io.h b/arch/arm/mach-orion5x/include/mach/io.h
index f24b2513f7f3..c47b033bd999 100644
--- a/arch/arm/mach-orion5x/include/mach/io.h
+++ b/arch/arm/mach-orion5x/include/mach/io.h
@@ -38,14 +38,9 @@ __arch_iounmap(void __iomem *addr)
38 __iounmap(addr); 38 __iounmap(addr);
39} 39}
40 40
41static inline void __iomem *__io(unsigned long addr)
42{
43 return (void __iomem *)addr;
44}
45
46#define __arch_ioremap(p, s, m) __arch_ioremap(p, s, m) 41#define __arch_ioremap(p, s, m) __arch_ioremap(p, s, m)
47#define __arch_iounmap(a) __arch_iounmap(a) 42#define __arch_iounmap(a) __arch_iounmap(a)
48#define __io(a) __io(a) 43#define __io(a) __typesafe_io(a)
49#define __mem_pci(a) (a) 44#define __mem_pci(a) (a)
50 45
51 46
diff --git a/arch/arm/mach-orion5x/include/mach/irqs.h b/arch/arm/mach-orion5x/include/mach/irqs.h
index d5b0fbf6b965..a6fa9d8f12d8 100644
--- a/arch/arm/mach-orion5x/include/mach/irqs.h
+++ b/arch/arm/mach-orion5x/include/mach/irqs.h
@@ -13,8 +13,6 @@
13#ifndef __ASM_ARCH_IRQS_H 13#ifndef __ASM_ARCH_IRQS_H
14#define __ASM_ARCH_IRQS_H 14#define __ASM_ARCH_IRQS_H
15 15
16#include "orion5x.h" /* need GPIO_MAX */
17
18/* 16/*
19 * Orion Main Interrupt Controller 17 * Orion Main Interrupt Controller
20 */ 18 */
@@ -54,7 +52,7 @@
54 * Orion General Purpose Pins 52 * Orion General Purpose Pins
55 */ 53 */
56#define IRQ_ORION5X_GPIO_START 32 54#define IRQ_ORION5X_GPIO_START 32
57#define NR_GPIO_IRQS GPIO_MAX 55#define NR_GPIO_IRQS 32
58 56
59#define NR_IRQS (IRQ_ORION5X_GPIO_START + NR_GPIO_IRQS) 57#define NR_IRQS (IRQ_ORION5X_GPIO_START + NR_GPIO_IRQS)
60 58
diff --git a/arch/arm/mach-orion5x/include/mach/memory.h b/arch/arm/mach-orion5x/include/mach/memory.h
index 54dd76b013f2..52a2955d0f87 100644
--- a/arch/arm/mach-orion5x/include/mach/memory.h
+++ b/arch/arm/mach-orion5x/include/mach/memory.h
@@ -9,8 +9,4 @@
9 9
10#define PHYS_OFFSET UL(0x00000000) 10#define PHYS_OFFSET UL(0x00000000)
11 11
12#define __virt_to_bus(x) __virt_to_phys(x)
13#define __bus_to_virt(x) __phys_to_virt(x)
14
15
16#endif 12#endif
diff --git a/arch/arm/mach-orion5x/include/mach/orion5x.h b/arch/arm/mach-orion5x/include/mach/orion5x.h
index 9f5ce1ce5840..67bda31406dd 100644
--- a/arch/arm/mach-orion5x/include/mach/orion5x.h
+++ b/arch/arm/mach-orion5x/include/mach/orion5x.h
@@ -134,14 +134,6 @@
134#define MPP_16_19_CTRL ORION5X_DEV_BUS_REG(0x050) 134#define MPP_16_19_CTRL ORION5X_DEV_BUS_REG(0x050)
135#define MPP_DEV_CTRL ORION5X_DEV_BUS_REG(0x008) 135#define MPP_DEV_CTRL ORION5X_DEV_BUS_REG(0x008)
136#define MPP_RESET_SAMPLE ORION5X_DEV_BUS_REG(0x010) 136#define MPP_RESET_SAMPLE ORION5X_DEV_BUS_REG(0x010)
137#define GPIO_OUT ORION5X_DEV_BUS_REG(0x100)
138#define GPIO_IO_CONF ORION5X_DEV_BUS_REG(0x104)
139#define GPIO_BLINK_EN ORION5X_DEV_BUS_REG(0x108)
140#define GPIO_IN_POL ORION5X_DEV_BUS_REG(0x10c)
141#define GPIO_DATA_IN ORION5X_DEV_BUS_REG(0x110)
142#define GPIO_EDGE_CAUSE ORION5X_DEV_BUS_REG(0x114)
143#define GPIO_EDGE_MASK ORION5X_DEV_BUS_REG(0x118)
144#define GPIO_LEVEL_MASK ORION5X_DEV_BUS_REG(0x11c)
145#define DEV_BANK_0_PARAM ORION5X_DEV_BUS_REG(0x45c) 137#define DEV_BANK_0_PARAM ORION5X_DEV_BUS_REG(0x45c)
146#define DEV_BANK_1_PARAM ORION5X_DEV_BUS_REG(0x460) 138#define DEV_BANK_1_PARAM ORION5X_DEV_BUS_REG(0x460)
147#define DEV_BANK_2_PARAM ORION5X_DEV_BUS_REG(0x464) 139#define DEV_BANK_2_PARAM ORION5X_DEV_BUS_REG(0x464)
@@ -149,7 +141,6 @@
149#define DEV_BUS_CTRL ORION5X_DEV_BUS_REG(0x4c0) 141#define DEV_BUS_CTRL ORION5X_DEV_BUS_REG(0x4c0)
150#define DEV_BUS_INT_CAUSE ORION5X_DEV_BUS_REG(0x4d0) 142#define DEV_BUS_INT_CAUSE ORION5X_DEV_BUS_REG(0x4d0)
151#define DEV_BUS_INT_MASK ORION5X_DEV_BUS_REG(0x4d4) 143#define DEV_BUS_INT_MASK ORION5X_DEV_BUS_REG(0x4d4)
152#define GPIO_MAX 32
153 144
154/*************************************************************************** 145/***************************************************************************
155 * Orion CPU Bridge Registers 146 * Orion CPU Bridge Registers
diff --git a/arch/arm/mach-orion5x/irq.c b/arch/arm/mach-orion5x/irq.c
index 632a36f5cf14..0caae43301e5 100644
--- a/arch/arm/mach-orion5x/irq.c
+++ b/arch/arm/mach-orion5x/irq.c
@@ -19,193 +19,38 @@
19#include <plat/irq.h> 19#include <plat/irq.h>
20#include "common.h" 20#include "common.h"
21 21
22/***************************************************************************** 22static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
23 * Orion GPIO IRQ
24 *
25 * GPIO_IN_POL register controlls whether GPIO_DATA_IN will hold the same
26 * value of the line or the opposite value.
27 *
28 * Level IRQ handlers: DATA_IN is used directly as cause register.
29 * Interrupt are masked by LEVEL_MASK registers.
30 * Edge IRQ handlers: Change in DATA_IN are latched in EDGE_CAUSE.
31 * Interrupt are masked by EDGE_MASK registers.
32 * Both-edge handlers: Similar to regular Edge handlers, but also swaps
33 * the polarity to catch the next line transaction.
34 * This is a race condition that might not perfectly
35 * work on some use cases.
36 *
37 * Every eight GPIO lines are grouped (OR'ed) before going up to main
38 * cause register.
39 *
40 * EDGE cause mask
41 * data-in /--------| |-----| |----\
42 * -----| |----- ---- to main cause reg
43 * X \----------------| |----/
44 * polarity LEVEL mask
45 *
46 ****************************************************************************/
47static void orion5x_gpio_irq_ack(u32 irq)
48{
49 int pin = irq_to_gpio(irq);
50 if (irq_desc[irq].status & IRQ_LEVEL)
51 /*
52 * Mask bit for level interrupt
53 */
54 orion5x_clrbits(GPIO_LEVEL_MASK, 1 << pin);
55 else
56 /*
57 * Clear casue bit for egde interrupt
58 */
59 orion5x_clrbits(GPIO_EDGE_CAUSE, 1 << pin);
60}
61
62static void orion5x_gpio_irq_mask(u32 irq)
63{
64 int pin = irq_to_gpio(irq);
65 if (irq_desc[irq].status & IRQ_LEVEL)
66 orion5x_clrbits(GPIO_LEVEL_MASK, 1 << pin);
67 else
68 orion5x_clrbits(GPIO_EDGE_MASK, 1 << pin);
69}
70
71static void orion5x_gpio_irq_unmask(u32 irq)
72{ 23{
73 int pin = irq_to_gpio(irq);
74 if (irq_desc[irq].status & IRQ_LEVEL)
75 orion5x_setbits(GPIO_LEVEL_MASK, 1 << pin);
76 else
77 orion5x_setbits(GPIO_EDGE_MASK, 1 << pin);
78}
79
80static int orion5x_gpio_set_irq_type(u32 irq, u32 type)
81{
82 int pin = irq_to_gpio(irq);
83 struct irq_desc *desc;
84
85 if ((readl(GPIO_IO_CONF) & (1 << pin)) == 0) {
86 printk(KERN_ERR "orion5x_gpio_set_irq_type failed "
87 "(irq %d, pin %d).\n", irq, pin);
88 return -EINVAL;
89 }
90
91 desc = irq_desc + irq;
92
93 switch (type) {
94 case IRQ_TYPE_LEVEL_HIGH:
95 desc->handle_irq = handle_level_irq;
96 desc->status |= IRQ_LEVEL;
97 orion5x_clrbits(GPIO_IN_POL, (1 << pin));
98 break;
99 case IRQ_TYPE_LEVEL_LOW:
100 desc->handle_irq = handle_level_irq;
101 desc->status |= IRQ_LEVEL;
102 orion5x_setbits(GPIO_IN_POL, (1 << pin));
103 break;
104 case IRQ_TYPE_EDGE_RISING:
105 desc->handle_irq = handle_edge_irq;
106 desc->status &= ~IRQ_LEVEL;
107 orion5x_clrbits(GPIO_IN_POL, (1 << pin));
108 break;
109 case IRQ_TYPE_EDGE_FALLING:
110 desc->handle_irq = handle_edge_irq;
111 desc->status &= ~IRQ_LEVEL;
112 orion5x_setbits(GPIO_IN_POL, (1 << pin));
113 break;
114 case IRQ_TYPE_EDGE_BOTH:
115 desc->handle_irq = handle_edge_irq;
116 desc->status &= ~IRQ_LEVEL;
117 /*
118 * set initial polarity based on current input level
119 */
120 if ((readl(GPIO_IN_POL) ^ readl(GPIO_DATA_IN))
121 & (1 << pin))
122 orion5x_setbits(GPIO_IN_POL, (1 << pin)); /* falling */
123 else
124 orion5x_clrbits(GPIO_IN_POL, (1 << pin)); /* rising */
125
126 break;
127 default:
128 printk(KERN_ERR "failed to set irq=%d (type=%d)\n", irq, type);
129 return -EINVAL;
130 }
131
132 desc->status &= ~IRQ_TYPE_SENSE_MASK;
133 desc->status |= type & IRQ_TYPE_SENSE_MASK;
134
135 return 0;
136}
137
138static struct irq_chip orion5x_gpio_irq_chip = {
139 .name = "Orion-IRQ-GPIO",
140 .ack = orion5x_gpio_irq_ack,
141 .mask = orion5x_gpio_irq_mask,
142 .unmask = orion5x_gpio_irq_unmask,
143 .set_type = orion5x_gpio_set_irq_type,
144};
145
146static void orion5x_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
147{
148 u32 cause, offs, pin;
149
150 BUG_ON(irq < IRQ_ORION5X_GPIO_0_7 || irq > IRQ_ORION5X_GPIO_24_31); 24 BUG_ON(irq < IRQ_ORION5X_GPIO_0_7 || irq > IRQ_ORION5X_GPIO_24_31);
151 offs = (irq - IRQ_ORION5X_GPIO_0_7) * 8;
152 cause = (readl(GPIO_DATA_IN) & readl(GPIO_LEVEL_MASK)) |
153 (readl(GPIO_EDGE_CAUSE) & readl(GPIO_EDGE_MASK));
154 25
155 for (pin = offs; pin < offs + 8; pin++) { 26 orion_gpio_irq_handler((irq - IRQ_ORION5X_GPIO_0_7) << 3);
156 if (cause & (1 << pin)) {
157 irq = gpio_to_irq(pin);
158 desc = irq_desc + irq;
159 if ((desc->status & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) {
160 /* Swap polarity (race with GPIO line) */
161 u32 polarity = readl(GPIO_IN_POL);
162 polarity ^= 1 << pin;
163 writel(polarity, GPIO_IN_POL);
164 }
165 generic_handle_irq(irq);
166 }
167 }
168} 27}
169 28
170static void __init orion5x_init_gpio_irq(void) 29void __init orion5x_init_irq(void)
171{ 30{
172 int i; 31 int i;
173 struct irq_desc *desc; 32
33 orion_irq_init(0, (void __iomem *)MAIN_IRQ_MASK);
174 34
175 /* 35 /*
176 * Mask and clear GPIO IRQ interrupts 36 * Mask and clear GPIO IRQ interrupts
177 */ 37 */
178 writel(0x0, GPIO_LEVEL_MASK); 38 writel(0x0, GPIO_LEVEL_MASK(0));
179 writel(0x0, GPIO_EDGE_MASK); 39 writel(0x0, GPIO_EDGE_MASK(0));
180 writel(0x0, GPIO_EDGE_CAUSE); 40 writel(0x0, GPIO_EDGE_CAUSE(0));
181 41
182 /* 42 /*
183 * Register chained level handlers for GPIO IRQs by default. 43 * Register chained level handlers for GPIO IRQs by default.
184 * User can use set_type() if he wants to use edge types handlers. 44 * User can use set_type() if he wants to use edge types handlers.
185 */ 45 */
186 for (i = IRQ_ORION5X_GPIO_START; i < NR_IRQS; i++) { 46 for (i = IRQ_ORION5X_GPIO_START; i < NR_IRQS; i++) {
187 set_irq_chip(i, &orion5x_gpio_irq_chip); 47 set_irq_chip(i, &orion_gpio_irq_level_chip);
188 set_irq_handler(i, handle_level_irq); 48 set_irq_handler(i, handle_level_irq);
189 desc = irq_desc + i; 49 irq_desc[i].status |= IRQ_LEVEL;
190 desc->status |= IRQ_LEVEL;
191 set_irq_flags(i, IRQF_VALID); 50 set_irq_flags(i, IRQF_VALID);
192 } 51 }
193 set_irq_chained_handler(IRQ_ORION5X_GPIO_0_7, orion5x_gpio_irq_handler); 52 set_irq_chained_handler(IRQ_ORION5X_GPIO_0_7, gpio_irq_handler);
194 set_irq_chained_handler(IRQ_ORION5X_GPIO_8_15, orion5x_gpio_irq_handler); 53 set_irq_chained_handler(IRQ_ORION5X_GPIO_8_15, gpio_irq_handler);
195 set_irq_chained_handler(IRQ_ORION5X_GPIO_16_23, orion5x_gpio_irq_handler); 54 set_irq_chained_handler(IRQ_ORION5X_GPIO_16_23, gpio_irq_handler);
196 set_irq_chained_handler(IRQ_ORION5X_GPIO_24_31, orion5x_gpio_irq_handler); 55 set_irq_chained_handler(IRQ_ORION5X_GPIO_24_31, gpio_irq_handler);
197}
198
199/*****************************************************************************
200 * Orion Main IRQ
201 ****************************************************************************/
202static void __init orion5x_init_main_irq(void)
203{
204 orion_irq_init(0, (void __iomem *)MAIN_IRQ_MASK);
205}
206
207void __init orion5x_init_irq(void)
208{
209 orion5x_init_main_irq();
210 orion5x_init_gpio_irq();
211} 56}
diff --git a/arch/arm/mach-orion5x/mpp.c b/arch/arm/mach-orion5x/mpp.c
index 640ea2a3fc6c..e23a3f91d6c6 100644
--- a/arch/arm/mach-orion5x/mpp.c
+++ b/arch/arm/mach-orion5x/mpp.c
@@ -12,6 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mbus.h> 13#include <linux/mbus.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <asm/gpio.h>
15#include <mach/hardware.h> 16#include <mach/hardware.h>
16#include "common.h" 17#include "common.h"
17#include "mpp.h" 18#include "mpp.h"
@@ -152,7 +153,10 @@ void __init orion5x_mpp_conf(struct orion5x_mpp_mode *mode)
152 *reg &= ~(0xf << shift); 153 *reg &= ~(0xf << shift);
153 *reg |= (num_type & 0xf) << shift; 154 *reg |= (num_type & 0xf) << shift;
154 155
155 orion5x_gpio_set_valid(mode->mpp, !!(mode->type == MPP_GPIO)); 156 if (mode->type == MPP_UNUSED && (mode->mpp < 16 || is_5182()))
157 orion_gpio_set_unused(mode->mpp);
158
159 orion_gpio_set_valid(mode->mpp, !!(mode->type == MPP_GPIO));
156 160
157 mode++; 161 mode++;
158 } 162 }
diff --git a/arch/arm/mach-pnx4008/dma.c b/arch/arm/mach-pnx4008/dma.c
index ac2f70eddb9e..425f7188505e 100644
--- a/arch/arm/mach-pnx4008/dma.c
+++ b/arch/arm/mach-pnx4008/dma.c
@@ -25,9 +25,8 @@
25 25
26#include <asm/system.h> 26#include <asm/system.h>
27#include <mach/hardware.h> 27#include <mach/hardware.h>
28#include <asm/dma.h> 28#include <mach/dma.h>
29#include <asm/dma-mapping.h> 29#include <asm/dma-mapping.h>
30#include <asm/mach/dma.h>
31#include <mach/clock.h> 30#include <mach/clock.h>
32 31
33static struct dma_channel { 32static struct dma_channel {
diff --git a/arch/arm/mach-pnx4008/include/mach/dma.h b/arch/arm/mach-pnx4008/include/mach/dma.h
index 5442d04fc575..f094bf8bfb18 100644
--- a/arch/arm/mach-pnx4008/include/mach/dma.h
+++ b/arch/arm/mach-pnx4008/include/mach/dma.h
@@ -16,8 +16,6 @@
16 16
17#include "platform.h" 17#include "platform.h"
18 18
19#define MAX_DMA_ADDRESS 0xffffffff
20
21#define MAX_DMA_CHANNELS 8 19#define MAX_DMA_CHANNELS 8
22 20
23#define DMAC_BASE IO_ADDRESS(PNX4008_DMA_CONFIG_BASE) 21#define DMAC_BASE IO_ADDRESS(PNX4008_DMA_CONFIG_BASE)
diff --git a/arch/arm/mach-pnx4008/include/mach/io.h b/arch/arm/mach-pnx4008/include/mach/io.h
index c6206f25839d..cbf0904540ea 100644
--- a/arch/arm/mach-pnx4008/include/mach/io.h
+++ b/arch/arm/mach-pnx4008/include/mach/io.h
@@ -15,7 +15,7 @@
15 15
16#define IO_SPACE_LIMIT 0xffffffff 16#define IO_SPACE_LIMIT 0xffffffff
17 17
18#define __io(a) ((void __iomem *)(a)) 18#define __io(a) __typesafe_io(a)
19#define __mem_pci(a) (a) 19#define __mem_pci(a) (a)
20 20
21#endif 21#endif
diff --git a/arch/arm/mach-pnx4008/include/mach/memory.h b/arch/arm/mach-pnx4008/include/mach/memory.h
index 5789a2d16f5a..0e8770081058 100644
--- a/arch/arm/mach-pnx4008/include/mach/memory.h
+++ b/arch/arm/mach-pnx4008/include/mach/memory.h
@@ -16,9 +16,6 @@
16/* 16/*
17 * Physical DRAM offset. 17 * Physical DRAM offset.
18 */ 18 */
19#define PHYS_OFFSET (0x80000000) 19#define PHYS_OFFSET UL(0x80000000)
20
21#define __virt_to_bus(x) ((x) - PAGE_OFFSET + PHYS_OFFSET)
22#define __bus_to_virt(x) ((x) + PAGE_OFFSET - PHYS_OFFSET)
23 20
24#endif 21#endif
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index a062235e83a8..8eea7306f29b 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -19,20 +19,34 @@ config CPU_PXA320
19config CPU_PXA930 19config CPU_PXA930
20 bool "PXA930 (codename Tavor-P)" 20 bool "PXA930 (codename Tavor-P)"
21 21
22config CPU_PXA935
23 bool "PXA935 (codename Tavor-P65)"
24
22endmenu 25endmenu
23 26
24endif 27endif
25 28
26config ARCH_GUMSTIX 29config ARCH_GUMSTIX
27 bool "Gumstix XScale boards" 30 bool "Gumstix XScale 255 boards"
31 select PXA25x
28 help 32 help
29 Say Y here if you intend to run this kernel on a 33 Say Y here if you intend to run this kernel on
30 Gumstix Full Function Minature Computer. 34 Basix, Connex, ws-200ax, ws-400ax systems
31 35
32config MACH_GUMSTIX_F 36choice
33 bool "Basix, Connex, ws-200ax, ws-400ax systems" 37 prompt "Gumstix Carrier/Expansion Board"
34 depends on ARCH_GUMSTIX 38 depends on ARCH_GUMSTIX
35 select PXA25x 39
40config GUMSTIX_AM200EPD
41 bool "Enable AM200EPD board support"
42
43endchoice
44
45config MACH_INTELMOTE2
46 bool "Intel Mote 2 Platform"
47 select PXA27x
48 select IWMMXT
49 select PXA_HAVE_BOARD_IRQS
36 50
37config ARCH_LUBBOCK 51config ARCH_LUBBOCK
38 bool "Intel DBPXA250 Development Platform" 52 bool "Intel DBPXA250 Development Platform"
@@ -199,6 +213,10 @@ config MACH_E800
199config TRIZEPS_PXA 213config TRIZEPS_PXA
200 bool "PXA based Keith und Koep Trizeps DIMM-Modules" 214 bool "PXA based Keith und Koep Trizeps DIMM-Modules"
201 215
216config MACH_H5000
217 bool "HP iPAQ h5000"
218 select PXA25x
219
202config MACH_TRIZEPS4 220config MACH_TRIZEPS4
203 bool "Keith und Koep Trizeps4 DIMM-Module" 221 bool "Keith und Koep Trizeps4 DIMM-Module"
204 depends on TRIZEPS_PXA 222 depends on TRIZEPS_PXA
@@ -283,7 +301,6 @@ config MACH_MIOA701
283 bool "Mitac Mio A701 Support" 301 bool "Mitac Mio A701 Support"
284 select PXA27x 302 select PXA27x
285 select IWMMXT 303 select IWMMXT
286 select LEDS_GPIO
287 select HAVE_PWM 304 select HAVE_PWM
288 select GPIO_SYSFS 305 select GPIO_SYSFS
289 help 306 help
@@ -342,10 +359,6 @@ config PCM990_DISPLAY_NONE
342 359
343endchoice 360endchoice
344 361
345config MACH_AM200EPD
346 depends on MACH_GUMSTIX_F
347 bool "Enable AM200EPD board support"
348
349config PXA_EZX 362config PXA_EZX
350 bool "Motorola EZX Platform" 363 bool "Motorola EZX Platform"
351 select PXA27x 364 select PXA27x
@@ -386,16 +399,25 @@ endmenu
386 399
387config PXA25x 400config PXA25x
388 bool 401 bool
402 select CPU_XSCALE
389 help 403 help
390 Select code specific to PXA21x/25x/26x variants 404 Select code specific to PXA21x/25x/26x variants
391 405
392config PXA27x 406config PXA27x
393 bool 407 bool
408 select CPU_XSCALE
394 help 409 help
395 Select code specific to PXA27x variants 410 Select code specific to PXA27x variants
396 411
412config CPU_PXA26x
413 bool
414 select PXA25x
415 help
416 Select code specific to PXA26x (codename Dalhart)
417
397config PXA3xx 418config PXA3xx
398 bool 419 bool
420 select CPU_XSC3
399 help 421 help
400 Select code specific to PXA3xx variants 422 Select code specific to PXA3xx variants
401 423
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index d64c68b232e3..7b28bb561d63 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -27,7 +27,7 @@ obj-$(CONFIG_CPU_PXA930) += pxa930.o
27 27
28# Specific board support 28# Specific board support
29obj-$(CONFIG_ARCH_GUMSTIX) += gumstix.o 29obj-$(CONFIG_ARCH_GUMSTIX) += gumstix.o
30obj-$(CONFIG_MACH_AM200EPD) += am200epd.o 30obj-$(CONFIG_GUMSTIX_AM200EPD) += am200epd.o
31obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o 31obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o
32obj-$(CONFIG_MACH_LOGICPD_PXA270) += lpd270.o 32obj-$(CONFIG_MACH_LOGICPD_PXA270) += lpd270.o
33obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o 33obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o
@@ -35,6 +35,7 @@ obj-$(CONFIG_MACH_MP900C) += mp900.o
35obj-$(CONFIG_ARCH_PXA_IDP) += idp.o 35obj-$(CONFIG_ARCH_PXA_IDP) += idp.o
36obj-$(CONFIG_MACH_TRIZEPS4) += trizeps4.o 36obj-$(CONFIG_MACH_TRIZEPS4) += trizeps4.o
37obj-$(CONFIG_MACH_COLIBRI) += colibri.o 37obj-$(CONFIG_MACH_COLIBRI) += colibri.o
38obj-$(CONFIG_MACH_H5000) += h5000.o
38obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o sharpsl_pm.o corgi_pm.o 39obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o sharpsl_pm.o corgi_pm.o
39obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o sharpsl_pm.o spitz_pm.o 40obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o sharpsl_pm.o spitz_pm.o
40obj-$(CONFIG_CORGI_SSP_DEPRECATED) += corgi_ssp.o corgi_lcd.o 41obj-$(CONFIG_CORGI_SSP_DEPRECATED) += corgi_ssp.o corgi_lcd.o
@@ -69,6 +70,8 @@ obj-$(CONFIG_MACH_ARMCORE) += cm-x2xx.o cm-x255.o cm-x270.o
69obj-$(CONFIG_MACH_CM_X300) += cm-x300.o 70obj-$(CONFIG_MACH_CM_X300) += cm-x300.o
70obj-$(CONFIG_PXA_EZX) += ezx.o 71obj-$(CONFIG_PXA_EZX) += ezx.o
71 72
73obj-$(CONFIG_MACH_INTELMOTE2) += imote2.o
74
72# Support for blinky lights 75# Support for blinky lights
73led-y := leds.o 76led-y := leds.o
74led-$(CONFIG_ARCH_LUBBOCK) += leds-lubbock.o 77led-$(CONFIG_ARCH_LUBBOCK) += leds-lubbock.o
diff --git a/arch/arm/mach-pxa/am200epd.c b/arch/arm/mach-pxa/am200epd.c
index b965085a37b9..77ee80e5e47b 100644
--- a/arch/arm/mach-pxa/am200epd.c
+++ b/arch/arm/mach-pxa/am200epd.c
@@ -30,8 +30,12 @@
30#include <linux/irq.h> 30#include <linux/irq.h>
31#include <linux/gpio.h> 31#include <linux/gpio.h>
32 32
33#include <mach/gumstix.h>
34#include <mach/mfp-pxa25x.h>
33#include <mach/pxafb.h> 35#include <mach/pxafb.h>
34 36
37#include "generic.h"
38
35#include <video/metronomefb.h> 39#include <video/metronomefb.h>
36 40
37static unsigned int panel_type = 6; 41static unsigned int panel_type = 6;
@@ -331,7 +335,16 @@ static struct metronome_board am200_board = {
331 .cleanup = am200_cleanup, 335 .cleanup = am200_cleanup,
332}; 336};
333 337
334static int __init am200_init(void) 338static unsigned long am200_pin_config[] __initdata = {
339 GPIO51_GPIO,
340 GPIO49_GPIO,
341 GPIO48_GPIO,
342 GPIO32_GPIO,
343 GPIO17_GPIO,
344 GPIO16_GPIO,
345};
346
347int __init am200_init(void)
335{ 348{
336 int ret; 349 int ret;
337 350
@@ -339,6 +352,8 @@ static int __init am200_init(void)
339 * creation events */ 352 * creation events */
340 fb_register_client(&am200_fb_notif); 353 fb_register_client(&am200_fb_notif);
341 354
355 pxa2xx_mfp_config(ARRAY_AND_SIZE(am200_pin_config));
356
342 /* request our platform independent driver */ 357 /* request our platform independent driver */
343 request_module("metronomefb"); 358 request_module("metronomefb");
344 359
@@ -367,8 +382,6 @@ static int __init am200_init(void)
367module_param(panel_type, uint, 0); 382module_param(panel_type, uint, 0);
368MODULE_PARM_DESC(panel_type, "Select the panel type: 6, 8, 97"); 383MODULE_PARM_DESC(panel_type, "Select the panel type: 6, 8, 97");
369 384
370module_init(am200_init);
371
372MODULE_DESCRIPTION("board driver for am200 metronome epd kit"); 385MODULE_DESCRIPTION("board driver for am200 metronome epd kit");
373MODULE_AUTHOR("Jaya Kumar"); 386MODULE_AUTHOR("Jaya Kumar");
374MODULE_LICENSE("GPL"); 387MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c
index ca8e20538157..40b774084514 100644
--- a/arch/arm/mach-pxa/clock.c
+++ b/arch/arm/mach-pxa/clock.c
@@ -12,53 +12,16 @@
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/clkdev.h>
15#include <mach/pxa2xx-regs.h> 16#include <mach/pxa2xx-regs.h>
16#include <mach/pxa2xx-gpio.h>
17#include <mach/hardware.h> 17#include <mach/hardware.h>
18 18
19#include "devices.h" 19#include "devices.h"
20#include "generic.h" 20#include "generic.h"
21#include "clock.h" 21#include "clock.h"
22 22
23static LIST_HEAD(clocks);
24static DEFINE_MUTEX(clocks_mutex);
25static DEFINE_SPINLOCK(clocks_lock); 23static DEFINE_SPINLOCK(clocks_lock);
26 24
27static struct clk *clk_lookup(struct device *dev, const char *id)
28{
29 struct clk *p;
30
31 list_for_each_entry(p, &clocks, node)
32 if (strcmp(id, p->name) == 0 && p->dev == dev)
33 return p;
34
35 return NULL;
36}
37
38struct clk *clk_get(struct device *dev, const char *id)
39{
40 struct clk *p, *clk = ERR_PTR(-ENOENT);
41
42 mutex_lock(&clocks_mutex);
43 p = clk_lookup(dev, id);
44 if (!p)
45 p = clk_lookup(NULL, id);
46 if (p)
47 clk = p;
48 mutex_unlock(&clocks_mutex);
49
50 if (!IS_ERR(clk) && clk->ops == NULL)
51 clk = clk->other;
52
53 return clk;
54}
55EXPORT_SYMBOL(clk_get);
56
57void clk_put(struct clk *clk)
58{
59}
60EXPORT_SYMBOL(clk_put);
61
62int clk_enable(struct clk *clk) 25int clk_enable(struct clk *clk)
63{ 26{
64 unsigned long flags; 27 unsigned long flags;
@@ -116,37 +79,27 @@ const struct clkops clk_cken_ops = {
116 .disable = clk_cken_disable, 79 .disable = clk_cken_disable,
117}; 80};
118 81
119void clks_register(struct clk *clks, size_t num) 82void clks_register(struct clk_lookup *clks, size_t num)
120{ 83{
121 int i; 84 int i;
122 85
123 mutex_lock(&clocks_mutex);
124 for (i = 0; i < num; i++) 86 for (i = 0; i < num; i++)
125 list_add(&clks[i].node, &clocks); 87 clkdev_add(&clks[i]);
126 mutex_unlock(&clocks_mutex);
127} 88}
128 89
129int clk_add_alias(char *alias, struct device *alias_dev, char *id, 90int clk_add_alias(char *alias, struct device *alias_dev, char *id,
130 struct device *dev) 91 struct device *dev)
131{ 92{
132 struct clk *r = clk_lookup(dev, id); 93 struct clk *r = clk_get(dev, id);
133 struct clk *new; 94 struct clk_lookup *l;
134 95
135 if (!r) 96 if (!r)
136 return -ENODEV; 97 return -ENODEV;
137 98
138 new = kzalloc(sizeof(struct clk), GFP_KERNEL); 99 l = clkdev_alloc(r, alias, alias_dev ? dev_name(alias_dev) : NULL);
139 100 clk_put(r);
140 if (!new) 101 if (!l)
141 return -ENOMEM; 102 return -ENODEV;
142 103 clkdev_add(l);
143 new->name = alias;
144 new->dev = alias_dev;
145 new->other = r;
146
147 mutex_lock(&clocks_mutex);
148 list_add(&new->node, &clocks);
149 mutex_unlock(&clocks_mutex);
150
151 return 0; 104 return 0;
152} 105}
diff --git a/arch/arm/mach-pxa/clock.h b/arch/arm/mach-pxa/clock.h
index 73be795fe3bf..4e9c613c6767 100644
--- a/arch/arm/mach-pxa/clock.h
+++ b/arch/arm/mach-pxa/clock.h
@@ -1,6 +1,4 @@
1#include <linux/list.h> 1#include <asm/clkdev.h>
2
3struct clk;
4 2
5struct clkops { 3struct clkops {
6 void (*enable)(struct clk *); 4 void (*enable)(struct clk *);
@@ -9,9 +7,6 @@ struct clkops {
9}; 7};
10 8
11struct clk { 9struct clk {
12 struct list_head node;
13 const char *name;
14 struct device *dev;
15 const struct clkops *ops; 10 const struct clkops *ops;
16 unsigned long rate; 11 unsigned long rate;
17 unsigned int cken; 12 unsigned int cken;
@@ -20,41 +15,31 @@ struct clk {
20 struct clk *other; 15 struct clk *other;
21}; 16};
22 17
23#define INIT_CKEN(_name, _cken, _rate, _delay, _dev) \ 18#define INIT_CLKREG(_clk,_devname,_conname) \
24 { \ 19 { \
25 .name = _name, \ 20 .clk = _clk, \
26 .dev = _dev, \ 21 .dev_id = _devname, \
22 .con_id = _conname, \
23 }
24
25#define DEFINE_CKEN(_name, _cken, _rate, _delay) \
26struct clk clk_##_name = { \
27 .ops = &clk_cken_ops, \ 27 .ops = &clk_cken_ops, \
28 .rate = _rate, \ 28 .rate = _rate, \
29 .cken = CKEN_##_cken, \ 29 .cken = CKEN_##_cken, \
30 .delay = _delay, \ 30 .delay = _delay, \
31 } 31 }
32 32
33#define INIT_CK(_name, _cken, _ops, _dev) \ 33#define DEFINE_CK(_name, _cken, _ops) \
34 { \ 34struct clk clk_##_name = { \
35 .name = _name, \
36 .dev = _dev, \
37 .ops = _ops, \ 35 .ops = _ops, \
38 .cken = CKEN_##_cken, \ 36 .cken = CKEN_##_cken, \
39 } 37 }
40 38
41/* 39#define DEFINE_CLK(_name, _ops, _rate, _delay) \
42 * This is a placeholder to alias one clock device+name pair 40struct clk clk_##_name = { \
43 * to another struct clk. 41 .ops = _ops, \
44 */ 42 .rate = _rate, \
45#define INIT_CKOTHER(_name, _other, _dev) \
46 { \
47 .name = _name, \
48 .dev = _dev, \
49 .other = _other, \
50 }
51
52#define INIT_CLK(_name, _ops, _rate, _delay, _dev) \
53 { \
54 .name = _name, \
55 .dev = _dev, \
56 .ops = _ops, \
57 .rate = _rate, \
58 .delay = _delay, \ 43 .delay = _delay, \
59 } 44 }
60 45
@@ -64,20 +49,16 @@ void clk_cken_enable(struct clk *clk);
64void clk_cken_disable(struct clk *clk); 49void clk_cken_disable(struct clk *clk);
65 50
66#ifdef CONFIG_PXA3xx 51#ifdef CONFIG_PXA3xx
67#define PXA3xx_CKEN(_name, _cken, _rate, _delay, _dev) \ 52#define DEFINE_PXA3_CKEN(_name, _cken, _rate, _delay) \
68 { \ 53struct clk clk_##_name = { \
69 .name = _name, \
70 .dev = _dev, \
71 .ops = &clk_pxa3xx_cken_ops, \ 54 .ops = &clk_pxa3xx_cken_ops, \
72 .rate = _rate, \ 55 .rate = _rate, \
73 .cken = CKEN_##_cken, \ 56 .cken = CKEN_##_cken, \
74 .delay = _delay, \ 57 .delay = _delay, \
75 } 58 }
76 59
77#define PXA3xx_CK(_name, _cken, _ops, _dev) \ 60#define DEFINE_PXA3_CK(_name, _cken, _ops) \
78 { \ 61struct clk clk_##_name = { \
79 .name = _name, \
80 .dev = _dev, \
81 .ops = _ops, \ 62 .ops = _ops, \
82 .cken = CKEN_##_cken, \ 63 .cken = CKEN_##_cken, \
83 } 64 }
@@ -87,7 +68,7 @@ extern void clk_pxa3xx_cken_enable(struct clk *);
87extern void clk_pxa3xx_cken_disable(struct clk *); 68extern void clk_pxa3xx_cken_disable(struct clk *);
88#endif 69#endif
89 70
90void clks_register(struct clk *clks, size_t num); 71void clks_register(struct clk_lookup *clks, size_t num);
91int clk_add_alias(char *alias, struct device *alias_dev, char *id, 72int clk_add_alias(char *alias, struct device *alias_dev, char *id,
92 struct device *dev); 73 struct device *dev);
93 74
diff --git a/arch/arm/mach-pxa/cm-x2xx.c b/arch/arm/mach-pxa/cm-x2xx.c
index 0b3ce3b6d896..d99fd9e4d888 100644
--- a/arch/arm/mach-pxa/cm-x2xx.c
+++ b/arch/arm/mach-pxa/cm-x2xx.c
@@ -210,10 +210,8 @@ static struct pxafb_mode_info generic_stn_320x240_mode = {
210static struct pxafb_mach_info generic_stn_320x240 = { 210static struct pxafb_mach_info generic_stn_320x240 = {
211 .modes = &generic_stn_320x240_mode, 211 .modes = &generic_stn_320x240_mode,
212 .num_modes = 1, 212 .num_modes = 1,
213 .lccr0 = 0, 213 .lcd_conn = LCD_COLOR_STN_8BPP | LCD_PCLK_EDGE_FALL |\
214 .lccr3 = (LCCR3_PixClkDiv(0x03) | 214 LCD_AC_BIAS_FREQ(0xff),
215 LCCR3_Acb(0xff) |
216 LCCR3_PCP),
217 .cmap_inverse = 0, 215 .cmap_inverse = 0,
218 .cmap_static = 0, 216 .cmap_static = 0,
219}; 217};
@@ -236,10 +234,8 @@ static struct pxafb_mode_info generic_tft_640x480_mode = {
236static struct pxafb_mach_info generic_tft_640x480 = { 234static struct pxafb_mach_info generic_tft_640x480 = {
237 .modes = &generic_tft_640x480_mode, 235 .modes = &generic_tft_640x480_mode,
238 .num_modes = 1, 236 .num_modes = 1,
239 .lccr0 = (LCCR0_PAS), 237 .lcd_conn = LCD_COLOR_TFT_8BPP | LCD_PCLK_EDGE_FALL |\
240 .lccr3 = (LCCR3_PixClkDiv(0x01) | 238 LCD_AC_BIAS_FREQ(0xff),
241 LCCR3_Acb(0xff) |
242 LCCR3_PCP),
243 .cmap_inverse = 0, 239 .cmap_inverse = 0,
244 .cmap_static = 0, 240 .cmap_static = 0,
245}; 241};
@@ -263,9 +259,7 @@ static struct pxafb_mode_info generic_crt_640x480_mode = {
263static struct pxafb_mach_info generic_crt_640x480 = { 259static struct pxafb_mach_info generic_crt_640x480 = {
264 .modes = &generic_crt_640x480_mode, 260 .modes = &generic_crt_640x480_mode,
265 .num_modes = 1, 261 .num_modes = 1,
266 .lccr0 = (LCCR0_PAS), 262 .lcd_conn = LCD_COLOR_TFT_8BPP | LCD_AC_BIAS_FREQ(0xff),
267 .lccr3 = (LCCR3_PixClkDiv(0x01) |
268 LCCR3_Acb(0xff)),
269 .cmap_inverse = 0, 263 .cmap_inverse = 0,
270 .cmap_static = 0, 264 .cmap_static = 0,
271}; 265};
@@ -289,9 +283,7 @@ static struct pxafb_mode_info generic_crt_800x600_mode = {
289static struct pxafb_mach_info generic_crt_800x600 = { 283static struct pxafb_mach_info generic_crt_800x600 = {
290 .modes = &generic_crt_800x600_mode, 284 .modes = &generic_crt_800x600_mode,
291 .num_modes = 1, 285 .num_modes = 1,
292 .lccr0 = (LCCR0_PAS), 286 .lcd_conn = LCD_COLOR_TFT_8BPP | LCD_AC_BIAS_FREQ(0xff),
293 .lccr3 = (LCCR3_PixClkDiv(0x02) |
294 LCCR3_Acb(0xff)),
295 .cmap_inverse = 0, 287 .cmap_inverse = 0,
296 .cmap_static = 0, 288 .cmap_static = 0,
297}; 289};
@@ -314,10 +306,7 @@ static struct pxafb_mode_info generic_tft_320x240_mode = {
314static struct pxafb_mach_info generic_tft_320x240 = { 306static struct pxafb_mach_info generic_tft_320x240 = {
315 .modes = &generic_tft_320x240_mode, 307 .modes = &generic_tft_320x240_mode,
316 .num_modes = 1, 308 .num_modes = 1,
317 .lccr0 = (LCCR0_PAS), 309 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_AC_BIAS_FREQ(0xff),
318 .lccr3 = (LCCR3_PixClkDiv(0x06) |
319 LCCR3_Acb(0xff) |
320 LCCR3_PCP),
321 .cmap_inverse = 0, 310 .cmap_inverse = 0,
322 .cmap_static = 0, 311 .cmap_static = 0,
323}; 312};
@@ -341,9 +330,7 @@ static struct pxafb_mode_info generic_stn_640x480_mode = {
341static struct pxafb_mach_info generic_stn_640x480 = { 330static struct pxafb_mach_info generic_stn_640x480 = {
342 .modes = &generic_stn_640x480_mode, 331 .modes = &generic_stn_640x480_mode,
343 .num_modes = 1, 332 .num_modes = 1,
344 .lccr0 = 0, 333 .lcd_conn = LCD_COLOR_STN_8BPP | LCD_AC_BIAS_FREQ(0xff),
345 .lccr3 = (LCCR3_PixClkDiv(0x02) |
346 LCCR3_Acb(0xff)),
347 .cmap_inverse = 0, 334 .cmap_inverse = 0,
348 .cmap_static = 0, 335 .cmap_static = 0,
349}; 336};
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
index deb46cd144bf..ff0c577cd1ac 100644
--- a/arch/arm/mach-pxa/cm-x300.c
+++ b/arch/arm/mach-pxa/cm-x300.c
@@ -31,7 +31,6 @@
31#include <mach/mfp-pxa300.h> 31#include <mach/mfp-pxa300.h>
32 32
33#include <mach/hardware.h> 33#include <mach/hardware.h>
34#include <mach/gpio.h>
35#include <mach/pxafb.h> 34#include <mach/pxafb.h>
36#include <mach/mmc.h> 35#include <mach/mmc.h>
37#include <mach/ohci.h> 36#include <mach/ohci.h>
@@ -137,6 +136,10 @@ static mfp_cfg_t cm_x300_mfp_cfg[] __initdata = {
137 GPIO82_GPIO | MFP_PULL_HIGH, /* MMC CD */ 136 GPIO82_GPIO | MFP_PULL_HIGH, /* MMC CD */
138 GPIO85_GPIO, /* MMC WP */ 137 GPIO85_GPIO, /* MMC WP */
139 GPIO99_GPIO, /* Ethernet IRQ */ 138 GPIO99_GPIO, /* Ethernet IRQ */
139
140 /* Standard I2C */
141 GPIO21_I2C_SCL,
142 GPIO22_I2C_SDA,
140}; 143};
141 144
142#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) 145#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 65558d6aa220..c5e28a46b292 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -19,6 +19,7 @@
19#include <linux/fs.h> 19#include <linux/fs.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/mmc/host.h> 21#include <linux/mmc/host.h>
22#include <linux/mtd/physmap.h>
22#include <linux/pm.h> 23#include <linux/pm.h>
23#include <linux/gpio.h> 24#include <linux/gpio.h>
24#include <linux/backlight.h> 25#include <linux/backlight.h>
@@ -541,11 +542,42 @@ err_free_1:
541static inline void corgi_init_spi(void) {} 542static inline void corgi_init_spi(void) {}
542#endif 543#endif
543 544
545static struct mtd_partition sharpsl_rom_parts[] = {
546 {
547 .name ="Boot PROM Filesystem",
548 .offset = 0x00120000,
549 .size = MTDPART_SIZ_FULL,
550 },
551};
552
553static struct physmap_flash_data sharpsl_rom_data = {
554 .width = 2,
555 .nr_parts = ARRAY_SIZE(sharpsl_rom_parts),
556 .parts = sharpsl_rom_parts,
557};
558
559static struct resource sharpsl_rom_resources[] = {
560 {
561 .start = 0x00000000,
562 .end = 0x007fffff,
563 .flags = IORESOURCE_MEM,
564 },
565};
566
567static struct platform_device sharpsl_rom_device = {
568 .name = "physmap-flash",
569 .id = -1,
570 .resource = sharpsl_rom_resources,
571 .num_resources = ARRAY_SIZE(sharpsl_rom_resources),
572 .dev.platform_data = &sharpsl_rom_data,
573};
574
544static struct platform_device *devices[] __initdata = { 575static struct platform_device *devices[] __initdata = {
545 &corgiscoop_device, 576 &corgiscoop_device,
546 &corgifb_device, 577 &corgifb_device,
547 &corgikbd_device, 578 &corgikbd_device,
548 &corgiled_device, 579 &corgiled_device,
580 &sharpsl_rom_device,
549}; 581};
550 582
551static void corgi_poweroff(void) 583static void corgi_poweroff(void)
diff --git a/arch/arm/mach-pxa/cpufreq-pxa2xx.c b/arch/arm/mach-pxa/cpufreq-pxa2xx.c
index 1f272ea83f36..771dd4eac935 100644
--- a/arch/arm/mach-pxa/cpufreq-pxa2xx.c
+++ b/arch/arm/mach-pxa/cpufreq-pxa2xx.c
@@ -64,7 +64,7 @@ typedef struct {
64 64
65/* Define the refresh period in mSec for the SDRAM and the number of rows */ 65/* Define the refresh period in mSec for the SDRAM and the number of rows */
66#define SDRAM_TREF 64 /* standard 64ms SDRAM */ 66#define SDRAM_TREF 64 /* standard 64ms SDRAM */
67#define SDRAM_ROWS 4096 /* 64MB=8192 32MB=4096 */ 67static unsigned int sdram_rows;
68 68
69#define CCLKCFG_TURBO 0x1 69#define CCLKCFG_TURBO 0x1
70#define CCLKCFG_FCS 0x2 70#define CCLKCFG_FCS 0x2
@@ -73,6 +73,9 @@ typedef struct {
73#define MDREFR_DB2_MASK (MDREFR_K2DB2 | MDREFR_K1DB2) 73#define MDREFR_DB2_MASK (MDREFR_K2DB2 | MDREFR_K1DB2)
74#define MDREFR_DRI_MASK 0xFFF 74#define MDREFR_DRI_MASK 0xFFF
75 75
76#define MDCNFG_DRAC2(mdcnfg) (((mdcnfg) >> 21) & 0x3)
77#define MDCNFG_DRAC0(mdcnfg) (((mdcnfg) >> 5) & 0x3)
78
76/* 79/*
77 * PXA255 definitions 80 * PXA255 definitions
78 */ 81 */
@@ -109,6 +112,10 @@ static struct cpufreq_frequency_table
109static struct cpufreq_frequency_table 112static struct cpufreq_frequency_table
110 pxa255_turbo_freq_table[NUM_PXA25x_TURBO_FREQS+1]; 113 pxa255_turbo_freq_table[NUM_PXA25x_TURBO_FREQS+1];
111 114
115static unsigned int pxa255_turbo_table;
116module_param(pxa255_turbo_table, uint, 0);
117MODULE_PARM_DESC(pxa255_turbo_table, "Selects the frequency table (0 = run table, !0 = turbo table)");
118
112/* 119/*
113 * PXA270 definitions 120 * PXA270 definitions
114 * 121 *
@@ -158,22 +165,16 @@ static struct cpufreq_frequency_table
158 165
159extern unsigned get_clk_frequency_khz(int info); 166extern unsigned get_clk_frequency_khz(int info);
160 167
161static void find_freq_tables(struct cpufreq_policy *policy, 168static void find_freq_tables(struct cpufreq_frequency_table **freq_table,
162 struct cpufreq_frequency_table **freq_table,
163 pxa_freqs_t **pxa_freqs) 169 pxa_freqs_t **pxa_freqs)
164{ 170{
165 if (cpu_is_pxa25x()) { 171 if (cpu_is_pxa25x()) {
166 if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) { 172 if (!pxa255_turbo_table) {
167 *pxa_freqs = pxa255_run_freqs; 173 *pxa_freqs = pxa255_run_freqs;
168 *freq_table = pxa255_run_freq_table; 174 *freq_table = pxa255_run_freq_table;
169 } else if (policy->policy == CPUFREQ_POLICY_POWERSAVE) { 175 } else {
170 *pxa_freqs = pxa255_turbo_freqs; 176 *pxa_freqs = pxa255_turbo_freqs;
171 *freq_table = pxa255_turbo_freq_table; 177 *freq_table = pxa255_turbo_freq_table;
172 } else {
173 printk("CPU PXA: Unknown policy found. "
174 "Using CPUFREQ_POLICY_PERFORMANCE\n");
175 *pxa_freqs = pxa255_run_freqs;
176 *freq_table = pxa255_run_freq_table;
177 } 178 }
178 } 179 }
179 if (cpu_is_pxa27x()) { 180 if (cpu_is_pxa27x()) {
@@ -194,14 +195,28 @@ static void pxa27x_guess_max_freq(void)
194 } 195 }
195} 196}
196 197
198static void init_sdram_rows(void)
199{
200 uint32_t mdcnfg = MDCNFG;
201 unsigned int drac2 = 0, drac0 = 0;
202
203 if (mdcnfg & (MDCNFG_DE2 | MDCNFG_DE3))
204 drac2 = MDCNFG_DRAC2(mdcnfg);
205
206 if (mdcnfg & (MDCNFG_DE0 | MDCNFG_DE1))
207 drac0 = MDCNFG_DRAC0(mdcnfg);
208
209 sdram_rows = 1 << (11 + max(drac0, drac2));
210}
211
197static u32 mdrefr_dri(unsigned int freq) 212static u32 mdrefr_dri(unsigned int freq)
198{ 213{
199 u32 dri = 0; 214 u32 dri = 0;
200 215
201 if (cpu_is_pxa25x()) 216 if (cpu_is_pxa25x())
202 dri = ((freq * SDRAM_TREF) / (SDRAM_ROWS * 32)); 217 dri = ((freq * SDRAM_TREF) / (sdram_rows * 32));
203 if (cpu_is_pxa27x()) 218 if (cpu_is_pxa27x())
204 dri = ((freq * SDRAM_TREF) / (SDRAM_ROWS - 31)) / 32; 219 dri = ((freq * SDRAM_TREF) / (sdram_rows - 31)) / 32;
205 return dri; 220 return dri;
206} 221}
207 222
@@ -212,7 +227,7 @@ static int pxa_verify_policy(struct cpufreq_policy *policy)
212 pxa_freqs_t *pxa_freqs; 227 pxa_freqs_t *pxa_freqs;
213 int ret; 228 int ret;
214 229
215 find_freq_tables(policy, &pxa_freqs_table, &pxa_freqs); 230 find_freq_tables(&pxa_freqs_table, &pxa_freqs);
216 ret = cpufreq_frequency_table_verify(policy, pxa_freqs_table); 231 ret = cpufreq_frequency_table_verify(policy, pxa_freqs_table);
217 232
218 if (freq_debug) 233 if (freq_debug)
@@ -240,7 +255,7 @@ static int pxa_set_target(struct cpufreq_policy *policy,
240 unsigned int unused, preset_mdrefr, postset_mdrefr, cclkcfg; 255 unsigned int unused, preset_mdrefr, postset_mdrefr, cclkcfg;
241 256
242 /* Get the current policy */ 257 /* Get the current policy */
243 find_freq_tables(policy, &pxa_freqs_table, &pxa_freq_settings); 258 find_freq_tables(&pxa_freqs_table, &pxa_freq_settings);
244 259
245 /* Lookup the next frequency */ 260 /* Lookup the next frequency */
246 if (cpufreq_frequency_table_target(policy, pxa_freqs_table, 261 if (cpufreq_frequency_table_target(policy, pxa_freqs_table,
@@ -329,11 +344,15 @@ static __init int pxa_cpufreq_init(struct cpufreq_policy *policy)
329{ 344{
330 int i; 345 int i;
331 unsigned int freq; 346 unsigned int freq;
347 struct cpufreq_frequency_table *pxa255_freq_table;
348 pxa_freqs_t *pxa255_freqs;
332 349
333 /* try to guess pxa27x cpu */ 350 /* try to guess pxa27x cpu */
334 if (cpu_is_pxa27x()) 351 if (cpu_is_pxa27x())
335 pxa27x_guess_max_freq(); 352 pxa27x_guess_max_freq();
336 353
354 init_sdram_rows();
355
337 /* set default policy and cpuinfo */ 356 /* set default policy and cpuinfo */
338 policy->cpuinfo.transition_latency = 1000; /* FIXME: 1 ms, assumed */ 357 policy->cpuinfo.transition_latency = 1000; /* FIXME: 1 ms, assumed */
339 policy->cur = get_clk_frequency_khz(0); /* current freq */ 358 policy->cur = get_clk_frequency_khz(0); /* current freq */
@@ -354,6 +373,8 @@ static __init int pxa_cpufreq_init(struct cpufreq_policy *policy)
354 } 373 }
355 pxa255_turbo_freq_table[i].frequency = CPUFREQ_TABLE_END; 374 pxa255_turbo_freq_table[i].frequency = CPUFREQ_TABLE_END;
356 375
376 pxa255_turbo_table = !!pxa255_turbo_table;
377
357 /* Generate the pxa27x cpufreq_frequency_table struct */ 378 /* Generate the pxa27x cpufreq_frequency_table struct */
358 for (i = 0; i < NUM_PXA27x_FREQS; i++) { 379 for (i = 0; i < NUM_PXA27x_FREQS; i++) {
359 freq = pxa27x_freqs[i].khz; 380 freq = pxa27x_freqs[i].khz;
@@ -368,8 +389,12 @@ static __init int pxa_cpufreq_init(struct cpufreq_policy *policy)
368 * Set the policy's minimum and maximum frequencies from the tables 389 * Set the policy's minimum and maximum frequencies from the tables
369 * just constructed. This sets cpuinfo.mxx_freq, min and max. 390 * just constructed. This sets cpuinfo.mxx_freq, min and max.
370 */ 391 */
371 if (cpu_is_pxa25x()) 392 if (cpu_is_pxa25x()) {
372 cpufreq_frequency_table_cpuinfo(policy, pxa255_run_freq_table); 393 find_freq_tables(&pxa255_freq_table, &pxa255_freqs);
394 pr_info("PXA255 cpufreq using %s frequency table\n",
395 pxa255_turbo_table ? "turbo" : "run");
396 cpufreq_frequency_table_cpuinfo(policy, pxa255_freq_table);
397 }
373 else if (cpu_is_pxa27x()) 398 else if (cpu_is_pxa27x())
374 cpufreq_frequency_table_cpuinfo(policy, pxa27x_freq_table); 399 cpufreq_frequency_table_cpuinfo(policy, pxa27x_freq_table);
375 400
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index 35736fc08634..e16f8e3d58d3 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -4,13 +4,12 @@
4#include <linux/platform_device.h> 4#include <linux/platform_device.h>
5#include <linux/dma-mapping.h> 5#include <linux/dma-mapping.h>
6 6
7#include <mach/gpio.h> 7#include <mach/pxa-regs.h>
8#include <mach/udc.h> 8#include <mach/udc.h>
9#include <mach/pxafb.h> 9#include <mach/pxafb.h>
10#include <mach/mmc.h> 10#include <mach/mmc.h>
11#include <mach/irda.h> 11#include <mach/irda.h>
12#include <mach/i2c.h> 12#include <mach/i2c.h>
13#include <mach/mfp-pxa27x.h>
14#include <mach/ohci.h> 13#include <mach/ohci.h>
15#include <mach/pxa27x_keypad.h> 14#include <mach/pxa27x_keypad.h>
16#include <mach/pxa2xx_spi.h> 15#include <mach/pxa2xx_spi.h>
@@ -156,8 +155,8 @@ void __init set_pxa_fb_parent(struct device *parent_dev)
156 155
157static struct resource pxa_resource_ffuart[] = { 156static struct resource pxa_resource_ffuart[] = {
158 { 157 {
159 .start = __PREG(FFUART), 158 .start = 0x40100000,
160 .end = __PREG(FFUART) + 35, 159 .end = 0x40100023,
161 .flags = IORESOURCE_MEM, 160 .flags = IORESOURCE_MEM,
162 }, { 161 }, {
163 .start = IRQ_FFUART, 162 .start = IRQ_FFUART,
@@ -175,8 +174,8 @@ struct platform_device pxa_device_ffuart= {
175 174
176static struct resource pxa_resource_btuart[] = { 175static struct resource pxa_resource_btuart[] = {
177 { 176 {
178 .start = __PREG(BTUART), 177 .start = 0x40200000,
179 .end = __PREG(BTUART) + 35, 178 .end = 0x40200023,
180 .flags = IORESOURCE_MEM, 179 .flags = IORESOURCE_MEM,
181 }, { 180 }, {
182 .start = IRQ_BTUART, 181 .start = IRQ_BTUART,
@@ -194,8 +193,8 @@ struct platform_device pxa_device_btuart = {
194 193
195static struct resource pxa_resource_stuart[] = { 194static struct resource pxa_resource_stuart[] = {
196 { 195 {
197 .start = __PREG(STUART), 196 .start = 0x40700000,
198 .end = __PREG(STUART) + 35, 197 .end = 0x40700023,
199 .flags = IORESOURCE_MEM, 198 .flags = IORESOURCE_MEM,
200 }, { 199 }, {
201 .start = IRQ_STUART, 200 .start = IRQ_STUART,
@@ -213,8 +212,8 @@ struct platform_device pxa_device_stuart = {
213 212
214static struct resource pxa_resource_hwuart[] = { 213static struct resource pxa_resource_hwuart[] = {
215 { 214 {
216 .start = __PREG(HWUART), 215 .start = 0x41600000,
217 .end = __PREG(HWUART) + 47, 216 .end = 0x4160002F,
218 .flags = IORESOURCE_MEM, 217 .flags = IORESOURCE_MEM,
219 }, { 218 }, {
220 .start = IRQ_HWUART, 219 .start = IRQ_HWUART,
@@ -249,18 +248,53 @@ struct platform_device pxa_device_i2c = {
249 .num_resources = ARRAY_SIZE(pxai2c_resources), 248 .num_resources = ARRAY_SIZE(pxai2c_resources),
250}; 249};
251 250
252static unsigned long pxa27x_i2c_mfp_cfg[] = {
253 GPIO117_I2C_SCL,
254 GPIO118_I2C_SDA,
255};
256
257void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info) 251void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
258{ 252{
259 if (cpu_is_pxa27x())
260 pxa2xx_mfp_config(ARRAY_AND_SIZE(pxa27x_i2c_mfp_cfg));
261 pxa_register_device(&pxa_device_i2c, info); 253 pxa_register_device(&pxa_device_i2c, info);
262} 254}
263 255
256#ifdef CONFIG_PXA27x
257static struct resource pxa27x_resources_i2c_power[] = {
258 {
259 .start = 0x40f00180,
260 .end = 0x40f001a3,
261 .flags = IORESOURCE_MEM,
262 }, {
263 .start = IRQ_PWRI2C,
264 .end = IRQ_PWRI2C,
265 .flags = IORESOURCE_IRQ,
266 },
267};
268
269struct platform_device pxa27x_device_i2c_power = {
270 .name = "pxa2xx-i2c",
271 .id = 1,
272 .resource = pxa27x_resources_i2c_power,
273 .num_resources = ARRAY_SIZE(pxa27x_resources_i2c_power),
274};
275#endif
276
277#ifdef CONFIG_PXA3xx
278static struct resource pxa3xx_resources_i2c_power[] = {
279 {
280 .start = 0x40f500c0,
281 .end = 0x40f500d3,
282 .flags = IORESOURCE_MEM,
283 }, {
284 .start = IRQ_PWRI2C,
285 .end = IRQ_PWRI2C,
286 .flags = IORESOURCE_IRQ,
287 },
288};
289
290struct platform_device pxa3xx_device_i2c_power = {
291 .name = "pxa2xx-i2c",
292 .id = 1,
293 .resource = pxa3xx_resources_i2c_power,
294 .num_resources = ARRAY_SIZE(pxa3xx_resources_i2c_power),
295};
296#endif
297
264static struct resource pxai2s_resources[] = { 298static struct resource pxai2s_resources[] = {
265 { 299 {
266 .start = 0x40400000, 300 .start = 0x40400000,
@@ -296,11 +330,36 @@ void __init pxa_set_ficp_info(struct pxaficp_platform_data *info)
296 pxa_register_device(&pxa_device_ficp, info); 330 pxa_register_device(&pxa_device_ficp, info);
297} 331}
298 332
299struct platform_device pxa_device_rtc = { 333static struct resource pxa_rtc_resources[] = {
334 [0] = {
335 .start = 0x40900000,
336 .end = 0x40900000 + 0x3b,
337 .flags = IORESOURCE_MEM,
338 },
339 [1] = {
340 .start = IRQ_RTC1Hz,
341 .end = IRQ_RTC1Hz,
342 .flags = IORESOURCE_IRQ,
343 },
344 [2] = {
345 .start = IRQ_RTCAlrm,
346 .end = IRQ_RTCAlrm,
347 .flags = IORESOURCE_IRQ,
348 },
349};
350
351struct platform_device sa1100_device_rtc = {
300 .name = "sa1100-rtc", 352 .name = "sa1100-rtc",
301 .id = -1, 353 .id = -1,
302}; 354};
303 355
356struct platform_device pxa_device_rtc = {
357 .name = "pxa-rtc",
358 .id = -1,
359 .num_resources = ARRAY_SIZE(pxa_rtc_resources),
360 .resource = pxa_rtc_resources,
361};
362
304static struct resource pxa_ac97_resources[] = { 363static struct resource pxa_ac97_resources[] = {
305 [0] = { 364 [0] = {
306 .start = 0x40500000, 365 .start = 0x40500000,
diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h
index bb04af4b0aa3..ecc24a4dca6d 100644
--- a/arch/arm/mach-pxa/devices.h
+++ b/arch/arm/mach-pxa/devices.h
@@ -11,6 +11,7 @@ extern struct platform_device pxa_device_hwuart;
11extern struct platform_device pxa_device_i2c; 11extern struct platform_device pxa_device_i2c;
12extern struct platform_device pxa_device_i2s; 12extern struct platform_device pxa_device_i2s;
13extern struct platform_device pxa_device_ficp; 13extern struct platform_device pxa_device_ficp;
14extern struct platform_device sa1100_device_rtc;
14extern struct platform_device pxa_device_rtc; 15extern struct platform_device pxa_device_rtc;
15extern struct platform_device pxa_device_ac97; 16extern struct platform_device pxa_device_ac97;
16 17
diff --git a/arch/arm/mach-pxa/dma.c b/arch/arm/mach-pxa/dma.c
index c0be17e0ab82..b1514fb20d3a 100644
--- a/arch/arm/mach-pxa/dma.c
+++ b/arch/arm/mach-pxa/dma.c
@@ -21,7 +21,7 @@
21#include <asm/system.h> 21#include <asm/system.h>
22#include <asm/irq.h> 22#include <asm/irq.h>
23#include <mach/hardware.h> 23#include <mach/hardware.h>
24#include <asm/dma.h> 24#include <mach/dma.h>
25 25
26#include <mach/pxa-regs.h> 26#include <mach/pxa-regs.h>
27 27
diff --git a/arch/arm/mach-pxa/e330.c b/arch/arm/mach-pxa/e330.c
index d488eded2058..1bd7f740427c 100644
--- a/arch/arm/mach-pxa/e330.c
+++ b/arch/arm/mach-pxa/e330.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Hardware definitions for the Toshiba eseries PDAs 2 * Hardware definitions for the Toshiba e330 PDAs
3 * 3 *
4 * Copyright (c) 2003 Ian Molton <spyro@f2s.com> 4 * Copyright (c) 2003 Ian Molton <spyro@f2s.com>
5 * 5 *
@@ -12,6 +12,9 @@
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/clk.h>
16#include <linux/platform_device.h>
17#include <linux/mfd/tc6387xb.h>
15 18
16#include <asm/setup.h> 19#include <asm/setup.h>
17#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
@@ -19,13 +22,44 @@
19 22
20#include <mach/mfp-pxa25x.h> 23#include <mach/mfp-pxa25x.h>
21#include <mach/hardware.h> 24#include <mach/hardware.h>
25#include <mach/pxa-regs.h>
26#include <mach/eseries-gpio.h>
22#include <mach/udc.h> 27#include <mach/udc.h>
23 28
24#include "generic.h" 29#include "generic.h"
25#include "eseries.h" 30#include "eseries.h"
31#include "clock.h"
32
33/* -------------------- e330 tc6387xb parameters -------------------- */
34
35static struct tc6387xb_platform_data e330_tc6387xb_info = {
36 .enable = &eseries_tmio_enable,
37 .disable = &eseries_tmio_disable,
38 .suspend = &eseries_tmio_suspend,
39 .resume = &eseries_tmio_resume,
40};
41
42static struct platform_device e330_tc6387xb_device = {
43 .name = "tc6387xb",
44 .id = -1,
45 .dev = {
46 .platform_data = &e330_tc6387xb_info,
47 },
48 .num_resources = 2,
49 .resource = eseries_tmio_resources,
50};
51
52/* --------------------------------------------------------------- */
53
54static struct platform_device *devices[] __initdata = {
55 &e330_tc6387xb_device,
56};
26 57
27static void __init e330_init(void) 58static void __init e330_init(void)
28{ 59{
60 eseries_register_clks();
61 eseries_get_tmio_gpios();
62 platform_add_devices(devices, ARRAY_SIZE(devices));
29 pxa_set_udc_info(&e7xx_udc_mach_info); 63 pxa_set_udc_info(&e7xx_udc_mach_info);
30} 64}
31 65
diff --git a/arch/arm/mach-pxa/e350.c b/arch/arm/mach-pxa/e350.c
index 8ecbc5479828..251129391d7d 100644
--- a/arch/arm/mach-pxa/e350.c
+++ b/arch/arm/mach-pxa/e350.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Hardware definitions for the Toshiba eseries PDAs 2 * Hardware definitions for the Toshiba e350 PDAs
3 * 3 *
4 * Copyright (c) 2003 Ian Molton <spyro@f2s.com> 4 * Copyright (c) 2003 Ian Molton <spyro@f2s.com>
5 * 5 *
@@ -12,20 +12,54 @@
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/clk.h>
16#include <linux/platform_device.h>
17#include <linux/mfd/t7l66xb.h>
15 18
16#include <asm/setup.h> 19#include <asm/setup.h>
17#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
18#include <asm/mach-types.h> 21#include <asm/mach-types.h>
19 22
20#include <mach/mfp-pxa25x.h> 23#include <mach/mfp-pxa25x.h>
24#include <mach/pxa-regs.h>
21#include <mach/hardware.h> 25#include <mach/hardware.h>
26#include <mach/eseries-gpio.h>
22#include <mach/udc.h> 27#include <mach/udc.h>
23 28
24#include "generic.h" 29#include "generic.h"
25#include "eseries.h" 30#include "eseries.h"
31#include "clock.h"
32
33/* -------------------- e350 t7l66xb parameters -------------------- */
34
35static struct t7l66xb_platform_data e350_t7l66xb_info = {
36 .irq_base = IRQ_BOARD_START,
37 .enable = &eseries_tmio_enable,
38 .suspend = &eseries_tmio_suspend,
39 .resume = &eseries_tmio_resume,
40};
41
42static struct platform_device e350_t7l66xb_device = {
43 .name = "t7l66xb",
44 .id = -1,
45 .dev = {
46 .platform_data = &e350_t7l66xb_info,
47 },
48 .num_resources = 2,
49 .resource = eseries_tmio_resources,
50};
51
52/* ---------------------------------------------------------- */
53
54static struct platform_device *devices[] __initdata = {
55 &e350_t7l66xb_device,
56};
26 57
27static void __init e350_init(void) 58static void __init e350_init(void)
28{ 59{
60 eseries_register_clks();
61 eseries_get_tmio_gpios();
62 platform_add_devices(devices, ARRAY_SIZE(devices));
29 pxa_set_udc_info(&e7xx_udc_mach_info); 63 pxa_set_udc_info(&e7xx_udc_mach_info);
30} 64}
31 65
diff --git a/arch/arm/mach-pxa/e400.c b/arch/arm/mach-pxa/e400.c
index 544bbaa20621..bed0336aca3d 100644
--- a/arch/arm/mach-pxa/e400.c
+++ b/arch/arm/mach-pxa/e400.c
@@ -12,20 +12,26 @@
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/clk.h>
16#include <linux/platform_device.h>
17#include <linux/mfd/t7l66xb.h>
18#include <linux/mtd/nand.h>
19#include <linux/mtd/partitions.h>
15 20
16#include <asm/setup.h> 21#include <asm/setup.h>
17#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
18#include <asm/mach-types.h> 23#include <asm/mach-types.h>
19 24
20#include <mach/pxa-regs.h>
21#include <mach/mfp-pxa25x.h> 25#include <mach/mfp-pxa25x.h>
26#include <mach/pxa-regs.h>
22#include <mach/hardware.h> 27#include <mach/hardware.h>
23 28#include <mach/eseries-gpio.h>
24#include <mach/pxafb.h> 29#include <mach/pxafb.h>
25#include <mach/udc.h> 30#include <mach/udc.h>
26 31
27#include "generic.h" 32#include "generic.h"
28#include "eseries.h" 33#include "eseries.h"
34#include "clock.h"
29 35
30/* ------------------------ E400 LCD definitions ------------------------ */ 36/* ------------------------ E400 LCD definitions ------------------------ */
31 37
@@ -46,7 +52,7 @@ static struct pxafb_mode_info e400_pxafb_mode_info = {
46static struct pxafb_mach_info e400_pxafb_mach_info = { 52static struct pxafb_mach_info e400_pxafb_mach_info = {
47 .modes = &e400_pxafb_mode_info, 53 .modes = &e400_pxafb_mode_info,
48 .num_modes = 1, 54 .num_modes = 1,
49 .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, 55 .lcd_conn = LCD_COLOR_TFT_16BPP,
50 .lccr3 = 0, 56 .lccr3 = 0,
51 .pxafb_backlight_power = NULL, 57 .pxafb_backlight_power = NULL,
52}; 58};
@@ -65,7 +71,10 @@ static unsigned long e400_pin_config[] __initdata = {
65 GPIO42_BTUART_RXD, 71 GPIO42_BTUART_RXD,
66 GPIO43_BTUART_TXD, 72 GPIO43_BTUART_TXD,
67 GPIO44_BTUART_CTS, 73 GPIO44_BTUART_CTS,
68 GPIO45_GPIO, /* Used by TMIO for #SUSPEND */ 74
75 /* TMIO controller */
76 GPIO19_GPIO, /* t7l66xb #PCLR */
77 GPIO45_GPIO, /* t7l66xb #SUSPEND (NOT BTUART!) */
69 78
70 /* wakeup */ 79 /* wakeup */
71 GPIO0_GPIO | WAKEUP_ON_EDGE_RISE, 80 GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
@@ -73,10 +82,60 @@ static unsigned long e400_pin_config[] __initdata = {
73 82
74/* ---------------------------------------------------------------------- */ 83/* ---------------------------------------------------------------------- */
75 84
85static struct mtd_partition partition_a = {
86 .name = "Internal NAND flash",
87 .offset = 0,
88 .size = MTDPART_SIZ_FULL,
89};
90
91static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
92
93static struct nand_bbt_descr e400_t7l66xb_nand_bbt = {
94 .options = 0,
95 .offs = 4,
96 .len = 2,
97 .pattern = scan_ff_pattern
98};
99
100static struct tmio_nand_data e400_t7l66xb_nand_config = {
101 .num_partitions = 1,
102 .partition = &partition_a,
103 .badblock_pattern = &e400_t7l66xb_nand_bbt,
104};
105
106static struct t7l66xb_platform_data e400_t7l66xb_info = {
107 .irq_base = IRQ_BOARD_START,
108 .enable = &eseries_tmio_enable,
109 .suspend = &eseries_tmio_suspend,
110 .resume = &eseries_tmio_resume,
111
112 .nand_data = &e400_t7l66xb_nand_config,
113};
114
115static struct platform_device e400_t7l66xb_device = {
116 .name = "t7l66xb",
117 .id = -1,
118 .dev = {
119 .platform_data = &e400_t7l66xb_info,
120 },
121 .num_resources = 2,
122 .resource = eseries_tmio_resources,
123};
124
125/* ---------------------------------------------------------- */
126
127static struct platform_device *devices[] __initdata = {
128 &e400_t7l66xb_device,
129};
130
76static void __init e400_init(void) 131static void __init e400_init(void)
77{ 132{
78 pxa2xx_mfp_config(ARRAY_AND_SIZE(e400_pin_config)); 133 pxa2xx_mfp_config(ARRAY_AND_SIZE(e400_pin_config));
134 /* Fixme - e400 may have a switched clock */
135 eseries_register_clks();
136 eseries_get_tmio_gpios();
79 set_pxa_fb_info(&e400_pxafb_mach_info); 137 set_pxa_fb_info(&e400_pxafb_mach_info);
138 platform_add_devices(devices, ARRAY_SIZE(devices));
80 pxa_set_udc_info(&e7xx_udc_mach_info); 139 pxa_set_udc_info(&e7xx_udc_mach_info);
81} 140}
82 141
diff --git a/arch/arm/mach-pxa/e740.c b/arch/arm/mach-pxa/e740.c
index c57a15b37f0d..b00d670b2ea6 100644
--- a/arch/arm/mach-pxa/e740.c
+++ b/arch/arm/mach-pxa/e740.c
@@ -15,6 +15,8 @@
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/fb.h> 17#include <linux/fb.h>
18#include <linux/clk.h>
19#include <linux/mfd/t7l66xb.h>
18 20
19#include <video/w100fb.h> 21#include <video/w100fb.h>
20 22
@@ -23,12 +25,16 @@
23#include <asm/mach-types.h> 25#include <asm/mach-types.h>
24 26
25#include <mach/mfp-pxa25x.h> 27#include <mach/mfp-pxa25x.h>
28#include <mach/pxa-regs.h>
26#include <mach/hardware.h> 29#include <mach/hardware.h>
30#include <mach/eseries-gpio.h>
27#include <mach/udc.h> 31#include <mach/udc.h>
32#include <mach/irda.h>
28 33
29#include "generic.h" 34#include "generic.h"
30#include "eseries.h" 35#include "eseries.h"
31 36#include "clock.h"
37#include "devices.h"
32 38
33/* ------------------------ e740 video support --------------------------- */ 39/* ------------------------ e740 video support --------------------------- */
34 40
@@ -116,7 +122,17 @@ static unsigned long e740_pin_config[] __initdata = {
116 GPIO42_BTUART_RXD, 122 GPIO42_BTUART_RXD,
117 GPIO43_BTUART_TXD, 123 GPIO43_BTUART_TXD,
118 GPIO44_BTUART_CTS, 124 GPIO44_BTUART_CTS,
119 GPIO45_GPIO, /* Used by TMIO for #SUSPEND */ 125
126 /* TMIO controller */
127 GPIO19_GPIO, /* t7l66xb #PCLR */
128 GPIO45_GPIO, /* t7l66xb #SUSPEND (NOT BTUART!) */
129
130 /* UDC */
131 GPIO13_GPIO,
132 GPIO3_GPIO,
133
134 /* IrDA */
135 GPIO38_GPIO | MFP_LPM_DRIVE_HIGH,
120 136
121 /* PC Card */ 137 /* PC Card */
122 GPIO8_GPIO, /* CD0 */ 138 GPIO8_GPIO, /* CD0 */
@@ -142,17 +158,43 @@ static unsigned long e740_pin_config[] __initdata = {
142 GPIO0_GPIO | WAKEUP_ON_EDGE_RISE, 158 GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
143}; 159};
144 160
161/* -------------------- e740 t7l66xb parameters -------------------- */
162
163static struct t7l66xb_platform_data e740_t7l66xb_info = {
164 .irq_base = IRQ_BOARD_START,
165 .enable = &eseries_tmio_enable,
166 .suspend = &eseries_tmio_suspend,
167 .resume = &eseries_tmio_resume,
168};
169
170static struct platform_device e740_t7l66xb_device = {
171 .name = "t7l66xb",
172 .id = -1,
173 .dev = {
174 .platform_data = &e740_t7l66xb_info,
175 },
176 .num_resources = 2,
177 .resource = eseries_tmio_resources,
178};
179
145/* ----------------------------------------------------------------------- */ 180/* ----------------------------------------------------------------------- */
146 181
147static struct platform_device *devices[] __initdata = { 182static struct platform_device *devices[] __initdata = {
148 &e740_fb_device, 183 &e740_fb_device,
184 &e740_t7l66xb_device,
149}; 185};
150 186
151static void __init e740_init(void) 187static void __init e740_init(void)
152{ 188{
153 pxa2xx_mfp_config(ARRAY_AND_SIZE(e740_pin_config)); 189 pxa2xx_mfp_config(ARRAY_AND_SIZE(e740_pin_config));
190 eseries_register_clks();
191 clk_add_alias("CLK_CK48M", &e740_t7l66xb_device.dev,
192 "UDCCLK", &pxa25x_device_udc.dev),
193 eseries_get_tmio_gpios();
154 platform_add_devices(devices, ARRAY_SIZE(devices)); 194 platform_add_devices(devices, ARRAY_SIZE(devices));
155 pxa_set_udc_info(&e7xx_udc_mach_info); 195 pxa_set_udc_info(&e7xx_udc_mach_info);
196 e7xx_irda_init();
197 pxa_set_ficp_info(&e7xx_ficp_platform_data);
156} 198}
157 199
158MACHINE_START(E740, "Toshiba e740") 200MACHINE_START(E740, "Toshiba e740")
diff --git a/arch/arm/mach-pxa/e750.c b/arch/arm/mach-pxa/e750.c
index 640e738b85df..84d7c1aac58d 100644
--- a/arch/arm/mach-pxa/e750.c
+++ b/arch/arm/mach-pxa/e750.c
@@ -15,6 +15,7 @@
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/fb.h> 17#include <linux/fb.h>
18#include <linux/mfd/tc6393xb.h>
18 19
19#include <video/w100fb.h> 20#include <video/w100fb.h>
20 21
@@ -23,11 +24,15 @@
23#include <asm/mach-types.h> 24#include <asm/mach-types.h>
24 25
25#include <mach/mfp-pxa25x.h> 26#include <mach/mfp-pxa25x.h>
27#include <mach/pxa-regs.h>
26#include <mach/hardware.h> 28#include <mach/hardware.h>
29#include <mach/eseries-gpio.h>
27#include <mach/udc.h> 30#include <mach/udc.h>
31#include <mach/irda.h>
28 32
29#include "generic.h" 33#include "generic.h"
30#include "eseries.h" 34#include "eseries.h"
35#include "clock.h"
31 36
32/* ---------------------- E750 LCD definitions -------------------- */ 37/* ---------------------- E750 LCD definitions -------------------- */
33 38
@@ -100,16 +105,45 @@ static struct platform_device e750_fb_device = {
100 .resource = e750_fb_resources, 105 .resource = e750_fb_resources,
101}; 106};
102 107
103/* ----------------------------------------------------------------------- */ 108/* ----------------- e750 tc6393xb parameters ------------------ */
109
110static struct tc6393xb_platform_data e750_tc6393xb_info = {
111 .irq_base = IRQ_BOARD_START,
112 .scr_pll2cr = 0x0cc1,
113 .scr_gper = 0,
114 .gpio_base = -1,
115 .suspend = &eseries_tmio_suspend,
116 .resume = &eseries_tmio_resume,
117 .enable = &eseries_tmio_enable,
118 .disable = &eseries_tmio_disable,
119};
120
121static struct platform_device e750_tc6393xb_device = {
122 .name = "tc6393xb",
123 .id = -1,
124 .dev = {
125 .platform_data = &e750_tc6393xb_info,
126 },
127 .num_resources = 2,
128 .resource = eseries_tmio_resources,
129};
130
131/* ------------------------------------------------------------- */
104 132
105static struct platform_device *devices[] __initdata = { 133static struct platform_device *devices[] __initdata = {
106 &e750_fb_device, 134 &e750_fb_device,
135 &e750_tc6393xb_device,
107}; 136};
108 137
109static void __init e750_init(void) 138static void __init e750_init(void)
110{ 139{
140 clk_add_alias("CLK_CK3P6MI", &e750_tc6393xb_device.dev,
141 "GPIO11_CLK", NULL),
142 eseries_get_tmio_gpios();
111 platform_add_devices(devices, ARRAY_SIZE(devices)); 143 platform_add_devices(devices, ARRAY_SIZE(devices));
112 pxa_set_udc_info(&e7xx_udc_mach_info); 144 pxa_set_udc_info(&e7xx_udc_mach_info);
145 e7xx_irda_init();
146 pxa_set_ficp_info(&e7xx_ficp_platform_data);
113} 147}
114 148
115MACHINE_START(E750, "Toshiba e750") 149MACHINE_START(E750, "Toshiba e750")
diff --git a/arch/arm/mach-pxa/e800.c b/arch/arm/mach-pxa/e800.c
index a293e09bfe25..9a86a426f924 100644
--- a/arch/arm/mach-pxa/e800.c
+++ b/arch/arm/mach-pxa/e800.c
@@ -15,6 +15,7 @@
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/fb.h> 17#include <linux/fb.h>
18#include <linux/mfd/tc6393xb.h>
18 19
19#include <video/w100fb.h> 20#include <video/w100fb.h>
20 21
@@ -23,12 +24,14 @@
23#include <asm/mach-types.h> 24#include <asm/mach-types.h>
24 25
25#include <mach/mfp-pxa25x.h> 26#include <mach/mfp-pxa25x.h>
27#include <mach/pxa-regs.h>
26#include <mach/hardware.h> 28#include <mach/hardware.h>
27#include <mach/eseries-gpio.h> 29#include <mach/eseries-gpio.h>
28#include <mach/udc.h> 30#include <mach/udc.h>
29 31
30#include "generic.h" 32#include "generic.h"
31#include "eseries.h" 33#include "eseries.h"
34#include "clock.h"
32 35
33/* ------------------------ e800 LCD definitions ------------------------- */ 36/* ------------------------ e800 LCD definitions ------------------------- */
34 37
@@ -160,14 +163,41 @@ static struct pxa2xx_udc_mach_info e800_udc_mach_info = {
160 .gpio_pullup_inverted = 1 163 .gpio_pullup_inverted = 1
161}; 164};
162 165
166/* ----------------- e800 tc6393xb parameters ------------------ */
167
168static struct tc6393xb_platform_data e800_tc6393xb_info = {
169 .irq_base = IRQ_BOARD_START,
170 .scr_pll2cr = 0x0cc1,
171 .scr_gper = 0,
172 .gpio_base = -1,
173 .suspend = &eseries_tmio_suspend,
174 .resume = &eseries_tmio_resume,
175 .enable = &eseries_tmio_enable,
176 .disable = &eseries_tmio_disable,
177};
178
179static struct platform_device e800_tc6393xb_device = {
180 .name = "tc6393xb",
181 .id = -1,
182 .dev = {
183 .platform_data = &e800_tc6393xb_info,
184 },
185 .num_resources = 2,
186 .resource = eseries_tmio_resources,
187};
188
163/* ----------------------------------------------------------------------- */ 189/* ----------------------------------------------------------------------- */
164 190
165static struct platform_device *devices[] __initdata = { 191static struct platform_device *devices[] __initdata = {
166 &e800_fb_device, 192 &e800_fb_device,
193 &e800_tc6393xb_device,
167}; 194};
168 195
169static void __init e800_init(void) 196static void __init e800_init(void)
170{ 197{
198 clk_add_alias("CLK_CK3P6MI", &e800_tc6393xb_device.dev,
199 "GPIO11_CLK", NULL),
200 eseries_get_tmio_gpios();
171 platform_add_devices(devices, ARRAY_SIZE(devices)); 201 platform_add_devices(devices, ARRAY_SIZE(devices));
172 pxa_set_udc_info(&e800_udc_mach_info); 202 pxa_set_udc_info(&e800_udc_mach_info);
173} 203}
diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c
index d28849b50a14..dfce7d5b659e 100644
--- a/arch/arm/mach-pxa/eseries.c
+++ b/arch/arm/mach-pxa/eseries.c
@@ -12,6 +12,9 @@
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/gpio.h>
16#include <linux/delay.h>
17#include <linux/platform_device.h>
15 18
16#include <asm/setup.h> 19#include <asm/setup.h>
17#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
@@ -21,8 +24,10 @@
21#include <mach/hardware.h> 24#include <mach/hardware.h>
22#include <mach/eseries-gpio.h> 25#include <mach/eseries-gpio.h>
23#include <mach/udc.h> 26#include <mach/udc.h>
27#include <mach/irda.h>
24 28
25#include "generic.h" 29#include "generic.h"
30#include "clock.h"
26 31
27/* Only e800 has 128MB RAM */ 32/* Only e800 has 128MB RAM */
28void __init eseries_fixup(struct machine_desc *desc, 33void __init eseries_fixup(struct machine_desc *desc,
@@ -43,3 +48,122 @@ struct pxa2xx_udc_mach_info e7xx_udc_mach_info = {
43 .gpio_pullup_inverted = 1 48 .gpio_pullup_inverted = 1
44}; 49};
45 50
51static void e7xx_irda_transceiver_mode(struct device *dev, int mode)
52{
53 if (mode & IR_OFF) {
54 gpio_set_value(GPIO_E7XX_IR_OFF, 1);
55 pxa2xx_transceiver_mode(dev, mode);
56 } else {
57 pxa2xx_transceiver_mode(dev, mode);
58 gpio_set_value(GPIO_E7XX_IR_OFF, 0);
59 }
60}
61
62int e7xx_irda_init(void)
63{
64 int ret;
65
66 ret = gpio_request(GPIO_E7XX_IR_OFF, "IrDA power");
67 if (ret)
68 goto out;
69
70 ret = gpio_direction_output(GPIO_E7XX_IR_OFF, 0);
71 if (ret)
72 goto out;
73
74 e7xx_irda_transceiver_mode(NULL, IR_SIRMODE | IR_OFF);
75out:
76 return ret;
77}
78
79static void e7xx_irda_shutdown(struct device *dev)
80{
81 e7xx_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
82 gpio_free(GPIO_E7XX_IR_OFF);
83}
84
85struct pxaficp_platform_data e7xx_ficp_platform_data = {
86 .transceiver_cap = IR_SIRMODE | IR_OFF,
87 .transceiver_mode = e7xx_irda_transceiver_mode,
88 .shutdown = e7xx_irda_shutdown,
89};
90
91int eseries_tmio_enable(struct platform_device *dev)
92{
93 /* Reset - bring SUSPEND high before PCLR */
94 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
95 gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
96 msleep(1);
97 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
98 msleep(1);
99 gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 1);
100 msleep(1);
101 return 0;
102}
103
104int eseries_tmio_disable(struct platform_device *dev)
105{
106 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
107 gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
108 return 0;
109}
110
111int eseries_tmio_suspend(struct platform_device *dev)
112{
113 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
114 return 0;
115}
116
117int eseries_tmio_resume(struct platform_device *dev)
118{
119 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
120 msleep(1);
121 return 0;
122}
123
124void eseries_get_tmio_gpios(void)
125{
126 gpio_request(GPIO_ESERIES_TMIO_SUSPEND, NULL);
127 gpio_request(GPIO_ESERIES_TMIO_PCLR, NULL);
128 gpio_direction_output(GPIO_ESERIES_TMIO_SUSPEND, 0);
129 gpio_direction_output(GPIO_ESERIES_TMIO_PCLR, 0);
130}
131
132/* TMIO controller uses the same resources on all e-series machines. */
133struct resource eseries_tmio_resources[] = {
134 [0] = {
135 .start = PXA_CS4_PHYS,
136 .end = PXA_CS4_PHYS + 0x1fffff,
137 .flags = IORESOURCE_MEM,
138 },
139 [1] = {
140 .start = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ),
141 .end = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ),
142 .flags = IORESOURCE_IRQ,
143 },
144};
145
146/* Some e-series hardware cannot control the 32K clock */
147static void clk_32k_dummy(struct clk *clk)
148{
149}
150
151static const struct clkops clk_32k_dummy_ops = {
152 .enable = clk_32k_dummy,
153 .disable = clk_32k_dummy,
154};
155
156static struct clk tmio_dummy_clk = {
157 .ops = &clk_32k_dummy_ops,
158 .rate = 32768,
159};
160
161static struct clk_lookup eseries_clkregs[] = {
162 INIT_CLKREG(&tmio_dummy_clk, NULL, "CLK_CK32K"),
163};
164
165void eseries_register_clks(void)
166{
167 clks_register(eseries_clkregs, ARRAY_SIZE(eseries_clkregs));
168}
169
diff --git a/arch/arm/mach-pxa/eseries.h b/arch/arm/mach-pxa/eseries.h
index a83f88d4b6ad..5930f5e2a123 100644
--- a/arch/arm/mach-pxa/eseries.h
+++ b/arch/arm/mach-pxa/eseries.h
@@ -2,3 +2,15 @@ void __init eseries_fixup(struct machine_desc *desc,
2 struct tag *tags, char **cmdline, struct meminfo *mi); 2 struct tag *tags, char **cmdline, struct meminfo *mi);
3 3
4extern struct pxa2xx_udc_mach_info e7xx_udc_mach_info; 4extern struct pxa2xx_udc_mach_info e7xx_udc_mach_info;
5extern struct pxaficp_platform_data e7xx_ficp_platform_data;
6extern int e7xx_irda_init(void);
7
8extern int eseries_tmio_enable(struct platform_device *dev);
9extern int eseries_tmio_disable(struct platform_device *dev);
10extern int eseries_tmio_suspend(struct platform_device *dev);
11extern int eseries_tmio_resume(struct platform_device *dev);
12extern void eseries_get_tmio_gpios(void);
13extern struct resource eseries_tmio_resources[];
14extern struct platform_device e300_tc6387xb_device;
15extern void eseries_register_clks(void);
16
diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c
index cc3d850cc0b6..df5f822f3b6c 100644
--- a/arch/arm/mach-pxa/ezx.c
+++ b/arch/arm/mach-pxa/ezx.c
@@ -16,11 +16,14 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/pwm_backlight.h> 18#include <linux/pwm_backlight.h>
19#include <linux/input.h>
19 20
20#include <asm/setup.h> 21#include <asm/setup.h>
21#include <mach/pxafb.h> 22#include <mach/pxafb.h>
22#include <mach/ohci.h> 23#include <mach/ohci.h>
23#include <mach/i2c.h> 24#include <mach/i2c.h>
25#include <mach/hardware.h>
26#include <mach/pxa27x_keypad.h>
24 27
25#include <mach/mfp-pxa27x.h> 28#include <mach/mfp-pxa27x.h>
26#include <mach/pxa-regs.h> 29#include <mach/pxa-regs.h>
@@ -101,120 +104,732 @@ static unsigned long ezx_pin_config[] __initdata = {
101 GPIO44_BTUART_CTS, 104 GPIO44_BTUART_CTS,
102 GPIO45_BTUART_RTS, 105 GPIO45_BTUART_RTS,
103 106
104 /* STUART */ 107 /* I2C */
105 GPIO46_STUART_RXD, 108 GPIO117_I2C_SCL,
106 GPIO47_STUART_TXD, 109 GPIO118_I2C_SDA,
107 110
108 /* For A780 support (connected with Neptune GSM chip) */ 111 /* PCAP SSP */
109 GPIO30_USB_P3_2, /* ICL_TXENB */ 112 GPIO29_SSP1_SCLK,
110 GPIO31_USB_P3_6, /* ICL_VPOUT */ 113 GPIO25_SSP1_TXD,
111 GPIO90_USB_P3_5, /* ICL_VPIN */ 114 GPIO26_SSP1_RXD,
112 GPIO91_USB_P3_1, /* ICL_XRXD */ 115 GPIO24_GPIO, /* pcap chip select */
113 GPIO56_USB_P3_4, /* ICL_VMOUT */ 116 GPIO1_GPIO, /* pcap interrupt */
114 GPIO113_USB_P3_3, /* /ICL_VMIN */ 117 GPIO4_GPIO, /* WDI_AP */
118 GPIO55_GPIO, /* SYS_RESTART */
119
120 /* MMC */
121 GPIO32_MMC_CLK,
122 GPIO92_MMC_DAT_0,
123 GPIO109_MMC_DAT_1,
124 GPIO110_MMC_DAT_2,
125 GPIO111_MMC_DAT_3,
126 GPIO112_MMC_CMD,
127 GPIO11_GPIO, /* mmc detect */
128
129 /* usb to external transceiver */
130 GPIO34_USB_P2_2,
131 GPIO35_USB_P2_1,
132 GPIO36_USB_P2_4,
133 GPIO39_USB_P2_6,
134 GPIO40_USB_P2_5,
135 GPIO53_USB_P2_3,
136
137 /* usb to Neptune GSM chip */
138 GPIO30_USB_P3_2,
139 GPIO31_USB_P3_6,
140 GPIO90_USB_P3_5,
141 GPIO91_USB_P3_1,
142 GPIO56_USB_P3_4,
143 GPIO113_USB_P3_3,
144};
145
146#if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_E680)
147static unsigned long gen1_pin_config[] __initdata = {
148 /* flip / lockswitch */
149 GPIO12_GPIO,
150
151 /* bluetooth (bcm2035) */
152 GPIO14_GPIO | WAKEUP_ON_LEVEL_HIGH, /* HOSTWAKE */
153 GPIO48_GPIO, /* RESET */
154 GPIO28_GPIO, /* WAKEUP */
155
156 /* Neptune handshake */
157 GPIO0_GPIO | WAKEUP_ON_LEVEL_HIGH, /* BP_RDY */
158 GPIO57_GPIO, /* AP_RDY */
159 GPIO13_GPIO | WAKEUP_ON_LEVEL_HIGH, /* WDI */
160 GPIO3_GPIO | WAKEUP_ON_LEVEL_HIGH, /* WDI2 */
161 GPIO82_GPIO, /* RESET */
162 GPIO99_GPIO, /* TC_MM_EN */
163
164 /* sound */
165 GPIO52_SSP3_SCLK,
166 GPIO83_SSP3_SFRM,
167 GPIO81_SSP3_TXD,
168 GPIO89_SSP3_RXD,
169
170 /* ssp2 pins to in */
171 GPIO22_GPIO, /* SSP2_SCLK */
172 GPIO37_GPIO, /* SSP2_SFRM */
173 GPIO38_GPIO, /* SSP2_TXD */
174 GPIO88_GPIO, /* SSP2_RXD */
175
176 /* camera */
177 GPIO23_CIF_MCLK,
178 GPIO54_CIF_PCLK,
179 GPIO85_CIF_LV,
180 GPIO84_CIF_FV,
181 GPIO27_CIF_DD_0,
182 GPIO114_CIF_DD_1,
183 GPIO51_CIF_DD_2,
184 GPIO115_CIF_DD_3,
185 GPIO95_CIF_DD_4,
186 GPIO94_CIF_DD_5,
187 GPIO17_CIF_DD_6,
188 GPIO108_CIF_DD_7,
189 GPIO50_GPIO, /* CAM_EN */
190 GPIO19_GPIO, /* CAM_RST */
191
192 /* EMU */
193 GPIO120_GPIO, /* EMU_MUX1 */
194 GPIO119_GPIO, /* EMU_MUX2 */
195 GPIO86_GPIO, /* SNP_INT_CTL */
196 GPIO87_GPIO, /* SNP_INT_IN */
197};
198#endif
199
200#if defined(CONFIG_MACH_EZX_A1200) || defined(CONFIG_MACH_EZX_A910) || \
201 defined(CONFIG_MACH_EZX_E2) || defined(CONFIG_MACH_EZX_E6)
202static unsigned long gen2_pin_config[] __initdata = {
203 /* flip / lockswitch */
204 GPIO15_GPIO,
205
206 /* EOC */
207 GPIO10_GPIO,
208
209 /* bluetooth (bcm2045) */
210 GPIO13_GPIO | WAKEUP_ON_LEVEL_HIGH, /* HOSTWAKE */
211 GPIO37_GPIO, /* RESET */
212 GPIO57_GPIO, /* WAKEUP */
213
214 /* Neptune handshake */
215 GPIO0_GPIO | WAKEUP_ON_LEVEL_HIGH, /* BP_RDY */
216 GPIO96_GPIO, /* AP_RDY */
217 GPIO3_GPIO | WAKEUP_ON_LEVEL_HIGH, /* WDI */
218 GPIO116_GPIO, /* RESET */
219 GPIO41_GPIO, /* BP_FLASH */
220
221 /* sound */
222 GPIO52_SSP3_SCLK,
223 GPIO83_SSP3_SFRM,
224 GPIO81_SSP3_TXD,
225 GPIO82_SSP3_RXD,
226
227 /* ssp2 pins to in */
228 GPIO22_GPIO, /* SSP2_SCLK */
229 GPIO14_GPIO, /* SSP2_SFRM */
230 GPIO38_GPIO, /* SSP2_TXD */
231 GPIO88_GPIO, /* SSP2_RXD */
232
233 /* camera */
234 GPIO23_CIF_MCLK,
235 GPIO54_CIF_PCLK,
236 GPIO85_CIF_LV,
237 GPIO84_CIF_FV,
238 GPIO27_CIF_DD_0,
239 GPIO114_CIF_DD_1,
240 GPIO51_CIF_DD_2,
241 GPIO115_CIF_DD_3,
242 GPIO95_CIF_DD_4,
243 GPIO48_CIF_DD_5,
244 GPIO93_CIF_DD_6,
245 GPIO12_CIF_DD_7,
246 GPIO50_GPIO, /* CAM_EN */
247 GPIO28_GPIO, /* CAM_RST */
248 GPIO17_GPIO, /* CAM_FLASH */
249};
250#endif
251
252#ifdef CONFIG_MACH_EZX_A780
253static unsigned long a780_pin_config[] __initdata = {
254 /* keypad */
255 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
256 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
257 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
258 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
259 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
260 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
261 GPIO103_KP_MKOUT_0,
262 GPIO104_KP_MKOUT_1,
263 GPIO105_KP_MKOUT_2,
264 GPIO106_KP_MKOUT_3,
265 GPIO107_KP_MKOUT_4,
266
267 /* attenuate sound */
268 GPIO96_GPIO,
269};
270#endif
271
272#ifdef CONFIG_MACH_EZX_E680
273static unsigned long e680_pin_config[] __initdata = {
274 /* keypad */
275 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
276 GPIO96_KP_DKIN_3 | WAKEUP_ON_LEVEL_HIGH,
277 GPIO97_KP_DKIN_4 | WAKEUP_ON_LEVEL_HIGH,
278 GPIO98_KP_DKIN_5 | WAKEUP_ON_LEVEL_HIGH,
279 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
280 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
281 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
282 GPIO103_KP_MKOUT_0,
283 GPIO104_KP_MKOUT_1,
284 GPIO105_KP_MKOUT_2,
285 GPIO106_KP_MKOUT_3,
286
287 /* MIDI */
288 GPIO79_GPIO, /* VA_SEL_BUL */
289 GPIO80_GPIO, /* FLT_SEL_BUL */
290 GPIO78_GPIO, /* MIDI_RESET */
291 GPIO33_GPIO, /* MIDI_CS */
292 GPIO15_GPIO, /* MIDI_IRQ */
293 GPIO49_GPIO, /* MIDI_NPWE */
294 GPIO18_GPIO, /* MIDI_RDY */
295
296 /* leds */
297 GPIO46_GPIO,
298 GPIO47_GPIO,
299};
300#endif
301
302#ifdef CONFIG_MACH_EZX_A1200
303static unsigned long a1200_pin_config[] __initdata = {
304 /* keypad */
305 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
306 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
307 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
308 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
309 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
310 GPIO103_KP_MKOUT_0,
311 GPIO104_KP_MKOUT_1,
312 GPIO105_KP_MKOUT_2,
313 GPIO106_KP_MKOUT_3,
314 GPIO107_KP_MKOUT_4,
315 GPIO108_KP_MKOUT_5,
316};
317#endif
318
319#ifdef CONFIG_MACH_EZX_A910
320static unsigned long a910_pin_config[] __initdata = {
321 /* keypad */
322 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
323 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
324 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
325 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
326 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
327 GPIO103_KP_MKOUT_0,
328 GPIO104_KP_MKOUT_1,
329 GPIO105_KP_MKOUT_2,
330 GPIO106_KP_MKOUT_3,
331 GPIO107_KP_MKOUT_4,
332 GPIO108_KP_MKOUT_5,
333
334 /* WLAN */
335 GPIO89_GPIO, /* RESET */
336 GPIO33_GPIO, /* WAKEUP */
337 GPIO94_GPIO | WAKEUP_ON_LEVEL_HIGH, /* HOSTWAKE */
338
339 /* MMC CS */
340 GPIO20_GPIO,
341};
342#endif
343
344#ifdef CONFIG_MACH_EZX_E2
345static unsigned long e2_pin_config[] __initdata = {
346 /* keypad */
347 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
348 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
349 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
350 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
351 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
352 GPIO103_KP_MKOUT_0,
353 GPIO104_KP_MKOUT_1,
354 GPIO105_KP_MKOUT_2,
355 GPIO106_KP_MKOUT_3,
356 GPIO107_KP_MKOUT_4,
357 GPIO108_KP_MKOUT_5,
115}; 358};
359#endif
360
361#ifdef CONFIG_MACH_EZX_E6
362static unsigned long e6_pin_config[] __initdata = {
363 /* keypad */
364 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
365 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
366 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
367 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
368 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
369 GPIO103_KP_MKOUT_0,
370 GPIO104_KP_MKOUT_1,
371 GPIO105_KP_MKOUT_2,
372 GPIO106_KP_MKOUT_3,
373 GPIO107_KP_MKOUT_4,
374 GPIO108_KP_MKOUT_5,
375};
376#endif
377
378/* KEYPAD */
379#ifdef CONFIG_MACH_EZX_A780
380static unsigned int a780_key_map[] = {
381 KEY(0, 0, KEY_SEND),
382 KEY(0, 1, KEY_BACK),
383 KEY(0, 2, KEY_END),
384 KEY(0, 3, KEY_PAGEUP),
385 KEY(0, 4, KEY_UP),
386
387 KEY(1, 0, KEY_NUMERIC_1),
388 KEY(1, 1, KEY_NUMERIC_2),
389 KEY(1, 2, KEY_NUMERIC_3),
390 KEY(1, 3, KEY_SELECT),
391 KEY(1, 4, KEY_KPENTER),
392
393 KEY(2, 0, KEY_NUMERIC_4),
394 KEY(2, 1, KEY_NUMERIC_5),
395 KEY(2, 2, KEY_NUMERIC_6),
396 KEY(2, 3, KEY_RECORD),
397 KEY(2, 4, KEY_LEFT),
398
399 KEY(3, 0, KEY_NUMERIC_7),
400 KEY(3, 1, KEY_NUMERIC_8),
401 KEY(3, 2, KEY_NUMERIC_9),
402 KEY(3, 3, KEY_HOME),
403 KEY(3, 4, KEY_RIGHT),
404
405 KEY(4, 0, KEY_NUMERIC_STAR),
406 KEY(4, 1, KEY_NUMERIC_0),
407 KEY(4, 2, KEY_NUMERIC_POUND),
408 KEY(4, 3, KEY_PAGEDOWN),
409 KEY(4, 4, KEY_DOWN),
410};
411
412static struct pxa27x_keypad_platform_data a780_keypad_platform_data = {
413 .matrix_key_rows = 5,
414 .matrix_key_cols = 5,
415 .matrix_key_map = a780_key_map,
416 .matrix_key_map_size = ARRAY_SIZE(a780_key_map),
417
418 .direct_key_map = { KEY_CAMERA },
419 .direct_key_num = 1,
420
421 .debounce_interval = 30,
422};
423#endif /* CONFIG_MACH_EZX_A780 */
424
425#ifdef CONFIG_MACH_EZX_E680
426static unsigned int e680_key_map[] = {
427 KEY(0, 0, KEY_UP),
428 KEY(0, 1, KEY_RIGHT),
429 KEY(0, 2, KEY_RESERVED),
430 KEY(0, 3, KEY_SEND),
431
432 KEY(1, 0, KEY_DOWN),
433 KEY(1, 1, KEY_LEFT),
434 KEY(1, 2, KEY_PAGEUP),
435 KEY(1, 3, KEY_PAGEDOWN),
436
437 KEY(2, 0, KEY_RESERVED),
438 KEY(2, 1, KEY_RESERVED),
439 KEY(2, 2, KEY_RESERVED),
440 KEY(2, 3, KEY_KPENTER),
441};
442
443static struct pxa27x_keypad_platform_data e680_keypad_platform_data = {
444 .matrix_key_rows = 3,
445 .matrix_key_cols = 4,
446 .matrix_key_map = e680_key_map,
447 .matrix_key_map_size = ARRAY_SIZE(e680_key_map),
448
449 .direct_key_map = {
450 KEY_CAMERA,
451 KEY_RESERVED,
452 KEY_RESERVED,
453 KEY_F1,
454 KEY_CANCEL,
455 KEY_F2,
456 },
457 .direct_key_num = 6,
458
459 .debounce_interval = 30,
460};
461#endif /* CONFIG_MACH_EZX_E680 */
462
463#ifdef CONFIG_MACH_EZX_A1200
464static unsigned int a1200_key_map[] = {
465 KEY(0, 0, KEY_RESERVED),
466 KEY(0, 1, KEY_RIGHT),
467 KEY(0, 2, KEY_PAGEDOWN),
468 KEY(0, 3, KEY_RESERVED),
469 KEY(0, 4, KEY_RESERVED),
470 KEY(0, 5, KEY_RESERVED),
471
472 KEY(1, 0, KEY_RESERVED),
473 KEY(1, 1, KEY_DOWN),
474 KEY(1, 2, KEY_CAMERA),
475 KEY(1, 3, KEY_RESERVED),
476 KEY(1, 4, KEY_RESERVED),
477 KEY(1, 5, KEY_RESERVED),
478
479 KEY(2, 0, KEY_RESERVED),
480 KEY(2, 1, KEY_KPENTER),
481 KEY(2, 2, KEY_RECORD),
482 KEY(2, 3, KEY_RESERVED),
483 KEY(2, 4, KEY_RESERVED),
484 KEY(2, 5, KEY_SELECT),
485
486 KEY(3, 0, KEY_RESERVED),
487 KEY(3, 1, KEY_UP),
488 KEY(3, 2, KEY_SEND),
489 KEY(3, 3, KEY_RESERVED),
490 KEY(3, 4, KEY_RESERVED),
491 KEY(3, 5, KEY_RESERVED),
492
493 KEY(4, 0, KEY_RESERVED),
494 KEY(4, 1, KEY_LEFT),
495 KEY(4, 2, KEY_PAGEUP),
496 KEY(4, 3, KEY_RESERVED),
497 KEY(4, 4, KEY_RESERVED),
498 KEY(4, 5, KEY_RESERVED),
499};
500
501static struct pxa27x_keypad_platform_data a1200_keypad_platform_data = {
502 .matrix_key_rows = 5,
503 .matrix_key_cols = 6,
504 .matrix_key_map = a1200_key_map,
505 .matrix_key_map_size = ARRAY_SIZE(a1200_key_map),
506
507 .debounce_interval = 30,
508};
509#endif /* CONFIG_MACH_EZX_A1200 */
510
511#ifdef CONFIG_MACH_EZX_E6
512static unsigned int e6_key_map[] = {
513 KEY(0, 0, KEY_RESERVED),
514 KEY(0, 1, KEY_RIGHT),
515 KEY(0, 2, KEY_PAGEDOWN),
516 KEY(0, 3, KEY_RESERVED),
517 KEY(0, 4, KEY_RESERVED),
518 KEY(0, 5, KEY_NEXTSONG),
519
520 KEY(1, 0, KEY_RESERVED),
521 KEY(1, 1, KEY_DOWN),
522 KEY(1, 2, KEY_PROG1),
523 KEY(1, 3, KEY_RESERVED),
524 KEY(1, 4, KEY_RESERVED),
525 KEY(1, 5, KEY_RESERVED),
526
527 KEY(2, 0, KEY_RESERVED),
528 KEY(2, 1, KEY_ENTER),
529 KEY(2, 2, KEY_CAMERA),
530 KEY(2, 3, KEY_RESERVED),
531 KEY(2, 4, KEY_RESERVED),
532 KEY(2, 5, KEY_WWW),
533
534 KEY(3, 0, KEY_RESERVED),
535 KEY(3, 1, KEY_UP),
536 KEY(3, 2, KEY_SEND),
537 KEY(3, 3, KEY_RESERVED),
538 KEY(3, 4, KEY_RESERVED),
539 KEY(3, 5, KEY_PLAYPAUSE),
540
541 KEY(4, 0, KEY_RESERVED),
542 KEY(4, 1, KEY_LEFT),
543 KEY(4, 2, KEY_PAGEUP),
544 KEY(4, 3, KEY_RESERVED),
545 KEY(4, 4, KEY_RESERVED),
546 KEY(4, 5, KEY_PREVIOUSSONG),
547};
548
549static struct pxa27x_keypad_platform_data e6_keypad_platform_data = {
550 .matrix_key_rows = 5,
551 .matrix_key_cols = 6,
552 .matrix_key_map = e6_key_map,
553 .matrix_key_map_size = ARRAY_SIZE(e6_key_map),
116 554
117static void __init ezx_init(void) 555 .debounce_interval = 30,
556};
557#endif /* CONFIG_MACH_EZX_E6 */
558
559#ifdef CONFIG_MACH_EZX_A910
560static unsigned int a910_key_map[] = {
561 KEY(0, 0, KEY_NUMERIC_6),
562 KEY(0, 1, KEY_RIGHT),
563 KEY(0, 2, KEY_PAGEDOWN),
564 KEY(0, 3, KEY_KPENTER),
565 KEY(0, 4, KEY_NUMERIC_5),
566 KEY(0, 5, KEY_CAMERA),
567
568 KEY(1, 0, KEY_NUMERIC_8),
569 KEY(1, 1, KEY_DOWN),
570 KEY(1, 2, KEY_RESERVED),
571 KEY(1, 3, KEY_F1), /* Left SoftKey */
572 KEY(1, 4, KEY_NUMERIC_STAR),
573 KEY(1, 5, KEY_RESERVED),
574
575 KEY(2, 0, KEY_NUMERIC_7),
576 KEY(2, 1, KEY_NUMERIC_9),
577 KEY(2, 2, KEY_RECORD),
578 KEY(2, 3, KEY_F2), /* Right SoftKey */
579 KEY(2, 4, KEY_BACK),
580 KEY(2, 5, KEY_SELECT),
581
582 KEY(3, 0, KEY_NUMERIC_2),
583 KEY(3, 1, KEY_UP),
584 KEY(3, 2, KEY_SEND),
585 KEY(3, 3, KEY_NUMERIC_0),
586 KEY(3, 4, KEY_NUMERIC_1),
587 KEY(3, 5, KEY_RECORD),
588
589 KEY(4, 0, KEY_NUMERIC_4),
590 KEY(4, 1, KEY_LEFT),
591 KEY(4, 2, KEY_PAGEUP),
592 KEY(4, 3, KEY_NUMERIC_POUND),
593 KEY(4, 4, KEY_NUMERIC_3),
594 KEY(4, 5, KEY_RESERVED),
595};
596
597static struct pxa27x_keypad_platform_data a910_keypad_platform_data = {
598 .matrix_key_rows = 5,
599 .matrix_key_cols = 6,
600 .matrix_key_map = a910_key_map,
601 .matrix_key_map_size = ARRAY_SIZE(a910_key_map),
602
603 .debounce_interval = 30,
604};
605#endif /* CONFIG_MACH_EZX_A910 */
606
607#ifdef CONFIG_MACH_EZX_E2
608static unsigned int e2_key_map[] = {
609 KEY(0, 0, KEY_NUMERIC_6),
610 KEY(0, 1, KEY_RIGHT),
611 KEY(0, 2, KEY_NUMERIC_9),
612 KEY(0, 3, KEY_NEXTSONG),
613 KEY(0, 4, KEY_NUMERIC_5),
614 KEY(0, 5, KEY_F1), /* Left SoftKey */
615
616 KEY(1, 0, KEY_NUMERIC_8),
617 KEY(1, 1, KEY_DOWN),
618 KEY(1, 2, KEY_RESERVED),
619 KEY(1, 3, KEY_PAGEUP),
620 KEY(1, 4, KEY_NUMERIC_STAR),
621 KEY(1, 5, KEY_F2), /* Right SoftKey */
622
623 KEY(2, 0, KEY_NUMERIC_7),
624 KEY(2, 1, KEY_KPENTER),
625 KEY(2, 2, KEY_RECORD),
626 KEY(2, 3, KEY_PAGEDOWN),
627 KEY(2, 4, KEY_BACK),
628 KEY(2, 5, KEY_NUMERIC_0),
629
630 KEY(3, 0, KEY_NUMERIC_2),
631 KEY(3, 1, KEY_UP),
632 KEY(3, 2, KEY_SEND),
633 KEY(3, 3, KEY_PLAYPAUSE),
634 KEY(3, 4, KEY_NUMERIC_1),
635 KEY(3, 5, KEY_SOUND), /* Music SoftKey */
636
637 KEY(4, 0, KEY_NUMERIC_4),
638 KEY(4, 1, KEY_LEFT),
639 KEY(4, 2, KEY_NUMERIC_POUND),
640 KEY(4, 3, KEY_PREVIOUSSONG),
641 KEY(4, 4, KEY_NUMERIC_3),
642 KEY(4, 5, KEY_RESERVED),
643};
644
645static struct pxa27x_keypad_platform_data e2_keypad_platform_data = {
646 .matrix_key_rows = 5,
647 .matrix_key_cols = 6,
648 .matrix_key_map = e2_key_map,
649 .matrix_key_map_size = ARRAY_SIZE(e2_key_map),
650
651 .debounce_interval = 30,
652};
653#endif /* CONFIG_MACH_EZX_E2 */
654
655#ifdef CONFIG_MACH_EZX_A780
656static void __init a780_init(void)
118{ 657{
119 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); 658 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
659 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
660 pxa2xx_mfp_config(ARRAY_AND_SIZE(a780_pin_config));
661
120 pxa_set_i2c_info(NULL); 662 pxa_set_i2c_info(NULL);
121 if (machine_is_ezx_a780() || machine_is_ezx_e680())
122 set_pxa_fb_info(&ezx_fb_info_1);
123 else
124 set_pxa_fb_info(&ezx_fb_info_2);
125 663
126 platform_add_devices(devices, ARRAY_SIZE(devices)); 664 set_pxa_fb_info(&ezx_fb_info_1);
127}
128 665
129static void __init ezx_fixup(struct machine_desc *desc, struct tag *tags, 666 pxa_set_keypad_info(&a780_keypad_platform_data);
130 char **cmdline, struct meminfo *mi) 667
131{ 668 platform_add_devices(devices, ARRAY_SIZE(devices));
132 /* We have two ram chips. First one with 32MB at 0xA0000000 and a second
133 * 16MB one at 0xAC000000
134 */
135 mi->nr_banks = 2;
136 mi->bank[0].start = 0xa0000000;
137 mi->bank[0].node = 0;
138 mi->bank[0].size = (32*1024*1024);
139 mi->bank[1].start = 0xac000000;
140 mi->bank[1].node = 1;
141 mi->bank[1].size = (16*1024*1024);
142} 669}
143 670
144#ifdef CONFIG_MACH_EZX_A780
145MACHINE_START(EZX_A780, "Motorola EZX A780") 671MACHINE_START(EZX_A780, "Motorola EZX A780")
146 .phys_io = 0x40000000, 672 .phys_io = 0x40000000,
147 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 673 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
148 .fixup = ezx_fixup,
149 .boot_params = 0xa0000100, 674 .boot_params = 0xa0000100,
150 .map_io = pxa_map_io, 675 .map_io = pxa_map_io,
151 .init_irq = pxa27x_init_irq, 676 .init_irq = pxa27x_init_irq,
152 .timer = &pxa_timer, 677 .timer = &pxa_timer,
153 .init_machine = &ezx_init, 678 .init_machine = a780_init,
154MACHINE_END 679MACHINE_END
155#endif 680#endif
156 681
157#ifdef CONFIG_MACH_EZX_E680 682#ifdef CONFIG_MACH_EZX_E680
683static struct i2c_board_info __initdata e680_i2c_board_info[] = {
684 { I2C_BOARD_INFO("tea5767", 0x81) },
685};
686
687static void __init e680_init(void)
688{
689 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
690 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
691 pxa2xx_mfp_config(ARRAY_AND_SIZE(e680_pin_config));
692
693 pxa_set_i2c_info(NULL);
694 i2c_register_board_info(0, ARRAY_AND_SIZE(e680_i2c_board_info));
695
696 set_pxa_fb_info(&ezx_fb_info_1);
697
698 pxa_set_keypad_info(&e680_keypad_platform_data);
699
700 platform_add_devices(devices, ARRAY_SIZE(devices));
701}
702
158MACHINE_START(EZX_E680, "Motorola EZX E680") 703MACHINE_START(EZX_E680, "Motorola EZX E680")
159 .phys_io = 0x40000000, 704 .phys_io = 0x40000000,
160 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 705 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
161 .fixup = ezx_fixup,
162 .boot_params = 0xa0000100, 706 .boot_params = 0xa0000100,
163 .map_io = pxa_map_io, 707 .map_io = pxa_map_io,
164 .init_irq = pxa27x_init_irq, 708 .init_irq = pxa27x_init_irq,
165 .timer = &pxa_timer, 709 .timer = &pxa_timer,
166 .init_machine = &ezx_init, 710 .init_machine = e680_init,
167MACHINE_END 711MACHINE_END
168#endif 712#endif
169 713
170#ifdef CONFIG_MACH_EZX_A1200 714#ifdef CONFIG_MACH_EZX_A1200
715static struct i2c_board_info __initdata a1200_i2c_board_info[] = {
716 { I2C_BOARD_INFO("tea5767", 0x81) },
717};
718
719static void __init a1200_init(void)
720{
721 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
722 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
723 pxa2xx_mfp_config(ARRAY_AND_SIZE(a1200_pin_config));
724
725 pxa_set_i2c_info(NULL);
726 i2c_register_board_info(0, ARRAY_AND_SIZE(a1200_i2c_board_info));
727
728 set_pxa_fb_info(&ezx_fb_info_2);
729
730 pxa_set_keypad_info(&a1200_keypad_platform_data);
731
732 platform_add_devices(devices, ARRAY_SIZE(devices));
733}
734
171MACHINE_START(EZX_A1200, "Motorola EZX A1200") 735MACHINE_START(EZX_A1200, "Motorola EZX A1200")
172 .phys_io = 0x40000000, 736 .phys_io = 0x40000000,
173 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 737 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
174 .fixup = ezx_fixup,
175 .boot_params = 0xa0000100, 738 .boot_params = 0xa0000100,
176 .map_io = pxa_map_io, 739 .map_io = pxa_map_io,
177 .init_irq = pxa27x_init_irq, 740 .init_irq = pxa27x_init_irq,
178 .timer = &pxa_timer, 741 .timer = &pxa_timer,
179 .init_machine = &ezx_init, 742 .init_machine = a1200_init,
180MACHINE_END 743MACHINE_END
181#endif 744#endif
182 745
183#ifdef CONFIG_MACH_EZX_A910 746#ifdef CONFIG_MACH_EZX_A910
747static void __init a910_init(void)
748{
749 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
750 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
751 pxa2xx_mfp_config(ARRAY_AND_SIZE(a910_pin_config));
752
753 pxa_set_i2c_info(NULL);
754
755 set_pxa_fb_info(&ezx_fb_info_2);
756
757 pxa_set_keypad_info(&a910_keypad_platform_data);
758
759 platform_add_devices(devices, ARRAY_SIZE(devices));
760}
761
184MACHINE_START(EZX_A910, "Motorola EZX A910") 762MACHINE_START(EZX_A910, "Motorola EZX A910")
185 .phys_io = 0x40000000, 763 .phys_io = 0x40000000,
186 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 764 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
187 .fixup = ezx_fixup,
188 .boot_params = 0xa0000100, 765 .boot_params = 0xa0000100,
189 .map_io = pxa_map_io, 766 .map_io = pxa_map_io,
190 .init_irq = pxa27x_init_irq, 767 .init_irq = pxa27x_init_irq,
191 .timer = &pxa_timer, 768 .timer = &pxa_timer,
192 .init_machine = &ezx_init, 769 .init_machine = a910_init,
193MACHINE_END 770MACHINE_END
194#endif 771#endif
195 772
196#ifdef CONFIG_MACH_EZX_E6 773#ifdef CONFIG_MACH_EZX_E6
774static struct i2c_board_info __initdata e6_i2c_board_info[] = {
775 { I2C_BOARD_INFO("tea5767", 0x81) },
776};
777
778static void __init e6_init(void)
779{
780 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
781 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
782 pxa2xx_mfp_config(ARRAY_AND_SIZE(e6_pin_config));
783
784 pxa_set_i2c_info(NULL);
785 i2c_register_board_info(0, ARRAY_AND_SIZE(e6_i2c_board_info));
786
787 set_pxa_fb_info(&ezx_fb_info_2);
788
789 pxa_set_keypad_info(&e6_keypad_platform_data);
790
791 platform_add_devices(devices, ARRAY_SIZE(devices));
792}
793
197MACHINE_START(EZX_E6, "Motorola EZX E6") 794MACHINE_START(EZX_E6, "Motorola EZX E6")
198 .phys_io = 0x40000000, 795 .phys_io = 0x40000000,
199 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 796 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
200 .fixup = ezx_fixup,
201 .boot_params = 0xa0000100, 797 .boot_params = 0xa0000100,
202 .map_io = pxa_map_io, 798 .map_io = pxa_map_io,
203 .init_irq = pxa27x_init_irq, 799 .init_irq = pxa27x_init_irq,
204 .timer = &pxa_timer, 800 .timer = &pxa_timer,
205 .init_machine = &ezx_init, 801 .init_machine = e6_init,
206MACHINE_END 802MACHINE_END
207#endif 803#endif
208 804
209#ifdef CONFIG_MACH_EZX_E2 805#ifdef CONFIG_MACH_EZX_E2
806static struct i2c_board_info __initdata e2_i2c_board_info[] = {
807 { I2C_BOARD_INFO("tea5767", 0x81) },
808};
809
810static void __init e2_init(void)
811{
812 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
813 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
814 pxa2xx_mfp_config(ARRAY_AND_SIZE(e2_pin_config));
815
816 pxa_set_i2c_info(NULL);
817 i2c_register_board_info(0, ARRAY_AND_SIZE(e2_i2c_board_info));
818
819 set_pxa_fb_info(&ezx_fb_info_2);
820
821 pxa_set_keypad_info(&e2_keypad_platform_data);
822
823 platform_add_devices(devices, ARRAY_SIZE(devices));
824}
825
210MACHINE_START(EZX_E2, "Motorola EZX E2") 826MACHINE_START(EZX_E2, "Motorola EZX E2")
211 .phys_io = 0x40000000, 827 .phys_io = 0x40000000,
212 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 828 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
213 .fixup = ezx_fixup,
214 .boot_params = 0xa0000100, 829 .boot_params = 0xa0000100,
215 .map_io = pxa_map_io, 830 .map_io = pxa_map_io,
216 .init_irq = pxa27x_init_irq, 831 .init_irq = pxa27x_init_irq,
217 .timer = &pxa_timer, 832 .timer = &pxa_timer,
218 .init_machine = &ezx_init, 833 .init_machine = e2_init,
219MACHINE_END 834MACHINE_END
220#endif 835#endif
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 85ed0b33331f..0ccc91c92c44 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -24,6 +24,7 @@
24#include <asm/system.h> 24#include <asm/system.h>
25#include <asm/pgtable.h> 25#include <asm/pgtable.h>
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27#include <asm/mach-types.h>
27 28
28#include <mach/pxa-regs.h> 29#include <mach/pxa-regs.h>
29#include <mach/reset.h> 30#include <mach/reset.h>
@@ -39,6 +40,21 @@ void clear_reset_status(unsigned int mask)
39 pxa3xx_clear_reset_status(mask); 40 pxa3xx_clear_reset_status(mask);
40} 41}
41 42
43unsigned long get_clock_tick_rate(void)
44{
45 unsigned long clock_tick_rate;
46
47 if (cpu_is_pxa25x())
48 clock_tick_rate = 3686400;
49 else if (machine_is_mainstone())
50 clock_tick_rate = 3249600;
51 else
52 clock_tick_rate = 3250000;
53
54 return clock_tick_rate;
55}
56EXPORT_SYMBOL(get_clock_tick_rate);
57
42/* 58/*
43 * Get the clock frequency as reflected by CCCR and the turbo flag. 59 * Get the clock frequency as reflected by CCCR and the turbo flag.
44 * We assume these values have been applied via a fcs. 60 * We assume these values have been applied via a fcs.
diff --git a/arch/arm/mach-pxa/gpio.c b/arch/arm/mach-pxa/gpio.c
index 14930cf8be7b..5fec1e479cb3 100644
--- a/arch/arm/mach-pxa/gpio.c
+++ b/arch/arm/mach-pxa/gpio.c
@@ -25,6 +25,18 @@
25 25
26#include "generic.h" 26#include "generic.h"
27 27
28#define GPIO0_BASE ((void __iomem *)io_p2v(0x40E00000))
29#define GPIO1_BASE ((void __iomem *)io_p2v(0x40E00004))
30#define GPIO2_BASE ((void __iomem *)io_p2v(0x40E00008))
31#define GPIO3_BASE ((void __iomem *)io_p2v(0x40E00100))
32
33#define GPLR_OFFSET 0x00
34#define GPDR_OFFSET 0x0C
35#define GPSR_OFFSET 0x18
36#define GPCR_OFFSET 0x24
37#define GRER_OFFSET 0x30
38#define GFER_OFFSET 0x3C
39#define GEDR_OFFSET 0x48
28 40
29struct pxa_gpio_chip { 41struct pxa_gpio_chip {
30 struct gpio_chip chip; 42 struct gpio_chip chip;
@@ -33,6 +45,18 @@ struct pxa_gpio_chip {
33 45
34int pxa_last_gpio; 46int pxa_last_gpio;
35 47
48#ifdef CONFIG_CPU_PXA26x
49/* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted,
50 * as well as their Alternate Function value being '1' for GPIO in GAFRx.
51 */
52static int __gpio_is_inverted(unsigned gpio)
53{
54 return cpu_is_pxa25x() && gpio > 85;
55}
56#else
57#define __gpio_is_inverted(gpio) (0)
58#endif
59
36/* 60/*
37 * Configure pins for GPIO or other functions 61 * Configure pins for GPIO or other functions
38 */ 62 */
@@ -75,7 +99,10 @@ static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
75 gpdr = pxa->regbase + GPDR_OFFSET; 99 gpdr = pxa->regbase + GPDR_OFFSET;
76 local_irq_save(flags); 100 local_irq_save(flags);
77 value = __raw_readl(gpdr); 101 value = __raw_readl(gpdr);
78 value &= ~mask; 102 if (__gpio_is_inverted(chip->base + offset))
103 value |= mask;
104 else
105 value &= ~mask;
79 __raw_writel(value, gpdr); 106 __raw_writel(value, gpdr);
80 local_irq_restore(flags); 107 local_irq_restore(flags);
81 108
@@ -97,7 +124,10 @@ static int pxa_gpio_direction_output(struct gpio_chip *chip,
97 gpdr = pxa->regbase + GPDR_OFFSET; 124 gpdr = pxa->regbase + GPDR_OFFSET;
98 local_irq_save(flags); 125 local_irq_save(flags);
99 tmp = __raw_readl(gpdr); 126 tmp = __raw_readl(gpdr);
100 tmp |= mask; 127 if (__gpio_is_inverted(chip->base + offset))
128 tmp &= ~mask;
129 else
130 tmp |= mask;
101 __raw_writel(tmp, gpdr); 131 __raw_writel(tmp, gpdr);
102 local_irq_restore(flags); 132 local_irq_restore(flags);
103 133
@@ -173,10 +203,17 @@ static unsigned long GPIO_IRQ_mask[4];
173 */ 203 */
174static int __gpio_is_occupied(unsigned gpio) 204static int __gpio_is_occupied(unsigned gpio)
175{ 205{
176 if (cpu_is_pxa25x() || cpu_is_pxa27x()) 206 if (cpu_is_pxa27x() || cpu_is_pxa25x()) {
177 return GAFR(gpio) & (0x3 << (((gpio) & 0xf) * 2)); 207 int af = (GAFR(gpio) >> ((gpio & 0xf) * 2)) & 0x3;
178 else 208 int dir = GPDR(gpio) & GPIO_bit(gpio);
179 return 0; 209
210 if (__gpio_is_inverted(gpio))
211 return af != 1 || dir == 0;
212 else
213 return af != 0 || dir != 0;
214 }
215
216 return 0;
180} 217}
181 218
182static int pxa_gpio_irq_type(unsigned int irq, unsigned int type) 219static int pxa_gpio_irq_type(unsigned int irq, unsigned int type)
@@ -190,9 +227,8 @@ static int pxa_gpio_irq_type(unsigned int irq, unsigned int type)
190 /* Don't mess with enabled GPIOs using preconfigured edges or 227 /* Don't mess with enabled GPIOs using preconfigured edges or
191 * GPIOs set to alternate function or to output during probe 228 * GPIOs set to alternate function or to output during probe
192 */ 229 */
193 if ((GPIO_IRQ_rising_edge[idx] | 230 if ((GPIO_IRQ_rising_edge[idx] & GPIO_bit(gpio)) ||
194 GPIO_IRQ_falling_edge[idx] | 231 (GPIO_IRQ_falling_edge[idx] & GPIO_bit(gpio)))
195 GPDR(gpio)) & GPIO_bit(gpio))
196 return 0; 232 return 0;
197 233
198 if (__gpio_is_occupied(gpio)) 234 if (__gpio_is_occupied(gpio))
@@ -201,7 +237,10 @@ static int pxa_gpio_irq_type(unsigned int irq, unsigned int type)
201 type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING; 237 type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
202 } 238 }
203 239
204 GPDR(gpio) &= ~GPIO_bit(gpio); 240 if (__gpio_is_inverted(gpio))
241 GPDR(gpio) |= GPIO_bit(gpio);
242 else
243 GPDR(gpio) &= ~GPIO_bit(gpio);
205 244
206 if (type & IRQ_TYPE_EDGE_RISING) 245 if (type & IRQ_TYPE_EDGE_RISING)
207 __set_bit(gpio, GPIO_IRQ_rising_edge); 246 __set_bit(gpio, GPIO_IRQ_rising_edge);
diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c
index d8962a0fb98d..e296ce11658c 100644
--- a/arch/arm/mach-pxa/gumstix.c
+++ b/arch/arm/mach-pxa/gumstix.c
@@ -184,15 +184,22 @@ static unsigned long gumstix_pin_config[] __initdata = {
184 GPIO6_MMC_CLK, 184 GPIO6_MMC_CLK,
185 GPIO53_MMC_CLK, 185 GPIO53_MMC_CLK,
186 GPIO8_MMC_CS0, 186 GPIO8_MMC_CS0,
187 /* these are used by AM200EPD */
188 GPIO51_GPIO,
189 GPIO49_GPIO,
190 GPIO48_GPIO,
191 GPIO32_GPIO,
192 GPIO17_GPIO,
193 GPIO16_GPIO,
194}; 187};
195 188
189int __attribute__((weak)) am200_init(void)
190{
191 return 0;
192}
193
194static void __init carrier_board_init(void)
195{
196 /*
197 * put carrier/expansion board init here if
198 * they cannot be detected programatically
199 */
200 am200_init();
201}
202
196static void __init gumstix_init(void) 203static void __init gumstix_init(void)
197{ 204{
198 pxa2xx_mfp_config(ARRAY_AND_SIZE(gumstix_pin_config)); 205 pxa2xx_mfp_config(ARRAY_AND_SIZE(gumstix_pin_config));
@@ -201,6 +208,7 @@ static void __init gumstix_init(void)
201 gumstix_udc_init(); 208 gumstix_udc_init();
202 gumstix_mmc_init(); 209 gumstix_mmc_init();
203 (void) platform_add_devices(devices, ARRAY_SIZE(devices)); 210 (void) platform_add_devices(devices, ARRAY_SIZE(devices));
211 carrier_board_init();
204} 212}
205 213
206MACHINE_START(GUMSTIX, "Gumstix") 214MACHINE_START(GUMSTIX, "Gumstix")
diff --git a/arch/arm/mach-pxa/h5000.c b/arch/arm/mach-pxa/h5000.c
new file mode 100644
index 000000000000..da6e4422c0f3
--- /dev/null
+++ b/arch/arm/mach-pxa/h5000.c
@@ -0,0 +1,200 @@
1/*
2 * Hardware definitions for HP iPAQ h5xxx Handheld Computers
3 *
4 * Copyright 2000-2003 Hewlett-Packard Company.
5 * Copyright 2002 Jamey Hicks <jamey.hicks@hp.com>
6 * Copyright 2004-2005 Phil Blundell <pb@handhelds.org>
7 * Copyright 2007-2008 Anton Vorontsov <cbouatmailru@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
15 * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
16 * FITNESS FOR ANY PARTICULAR PURPOSE.
17 *
18 * Author: Jamey Hicks.
19 */
20
21#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/platform_device.h>
24#include <linux/mtd/mtd.h>
25#include <linux/mtd/partitions.h>
26#include <linux/mtd/physmap.h>
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <asm/mach/map.h>
30#include <mach/h5000.h>
31#include <mach/pxa-regs.h>
32#include <mach/pxa2xx-regs.h>
33#include <mach/mfp-pxa25x.h>
34#include <mach/udc.h>
35#include "generic.h"
36
37/*
38 * Flash
39 */
40
41static struct mtd_partition h5000_flash0_partitions[] = {
42 {
43 .name = "bootldr",
44 .size = 0x00040000,
45 .offset = 0,
46 .mask_flags = MTD_WRITEABLE,
47 },
48 {
49 .name = "root",
50 .size = MTDPART_SIZ_FULL,
51 .offset = MTDPART_OFS_APPEND,
52 },
53};
54
55static struct mtd_partition h5000_flash1_partitions[] = {
56 {
57 .name = "second root",
58 .size = SZ_16M - 0x00040000,
59 .offset = 0,
60 },
61 {
62 .name = "asset",
63 .size = MTDPART_SIZ_FULL,
64 .offset = MTDPART_OFS_APPEND,
65 .mask_flags = MTD_WRITEABLE,
66 },
67};
68
69static struct physmap_flash_data h5000_flash0_data = {
70 .width = 4,
71 .parts = h5000_flash0_partitions,
72 .nr_parts = ARRAY_SIZE(h5000_flash0_partitions),
73};
74
75static struct physmap_flash_data h5000_flash1_data = {
76 .width = 4,
77 .parts = h5000_flash1_partitions,
78 .nr_parts = ARRAY_SIZE(h5000_flash1_partitions),
79};
80
81static struct resource h5000_flash0_resources = {
82 .start = PXA_CS0_PHYS,
83 .end = PXA_CS0_PHYS + SZ_32M - 1,
84 .flags = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
85};
86
87static struct resource h5000_flash1_resources = {
88 .start = PXA_CS0_PHYS + SZ_32M,
89 .end = PXA_CS0_PHYS + SZ_32M + SZ_16M - 1,
90 .flags = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
91};
92
93static struct platform_device h5000_flash[] = {
94 {
95 .name = "physmap-flash",
96 .id = 0,
97 .resource = &h5000_flash0_resources,
98 .num_resources = 1,
99 .dev = {
100 .platform_data = &h5000_flash0_data,
101 },
102 },
103 {
104 .name = "physmap-flash",
105 .id = 1,
106 .resource = &h5000_flash1_resources,
107 .num_resources = 1,
108 .dev = {
109 .platform_data = &h5000_flash1_data,
110 },
111 },
112};
113
114/*
115 * USB Device Controller
116 */
117
118static struct pxa2xx_udc_mach_info h5000_udc_mach_info __initdata = {
119 .gpio_pullup = H5000_GPIO_USB_PULLUP,
120};
121
122/*
123 * GPIO setup
124 */
125
126static unsigned long h5000_pin_config[] __initdata = {
127 /* Crystal and Clock Signals */
128 GPIO12_32KHz,
129
130 /* SDRAM and Static Memory I/O Signals */
131 GPIO15_nCS_1,
132 GPIO78_nCS_2,
133 GPIO79_nCS_3,
134 GPIO80_nCS_4,
135
136 /* FFUART */
137 GPIO34_FFUART_RXD,
138 GPIO35_FFUART_CTS,
139 GPIO36_FFUART_DCD,
140 GPIO37_FFUART_DSR,
141 GPIO38_FFUART_RI,
142 GPIO39_FFUART_TXD,
143 GPIO40_FFUART_DTR,
144 GPIO41_FFUART_RTS,
145
146 /* BTUART */
147 GPIO42_BTUART_RXD,
148 GPIO43_BTUART_TXD,
149 GPIO44_BTUART_CTS,
150 GPIO45_BTUART_RTS,
151
152 /* SSP1 */
153 GPIO23_SSP1_SCLK,
154 GPIO25_SSP1_TXD,
155 GPIO26_SSP1_RXD,
156};
157
158/*
159 * Localbus setup:
160 * CS0: Flash;
161 * CS1: MediaQ chip, select 16-bit bus and vlio;
162 * CS5: SAMCOP.
163 */
164
165static void fix_msc(void)
166{
167 MSC0 = 0x129c24f2;
168 MSC1 = 0x7ff424fa;
169 MSC2 = 0x7ff47ff4;
170
171 MDREFR |= 0x02080000;
172}
173
174/*
175 * Platform devices
176 */
177
178static struct platform_device *devices[] __initdata = {
179 &h5000_flash[0],
180 &h5000_flash[1],
181};
182
183static void __init h5000_init(void)
184{
185 fix_msc();
186
187 pxa2xx_mfp_config(ARRAY_AND_SIZE(h5000_pin_config));
188 pxa_set_udc_info(&h5000_udc_mach_info);
189 platform_add_devices(ARRAY_AND_SIZE(devices));
190}
191
192MACHINE_START(H5400, "HP iPAQ H5000")
193 .phys_io = 0x40000000,
194 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
195 .boot_params = 0xa0000100,
196 .map_io = pxa_map_io,
197 .init_irq = pxa25x_init_irq,
198 .timer = &pxa_timer,
199 .init_machine = h5000_init,
200MACHINE_END
diff --git a/arch/arm/mach-pxa/imote2.c b/arch/arm/mach-pxa/imote2.c
new file mode 100644
index 000000000000..364c5e271330
--- /dev/null
+++ b/arch/arm/mach-pxa/imote2.c
@@ -0,0 +1,575 @@
1/*
2 * linux/arch/arm/mach-pxa/imote2.c
3 *
4 * Author: Ed C. Epp
5 * Created: Nov 05, 2002
6 * Copyright: Intel Corp.
7 *
8 * Modified 2008: Jonathan Cameron
9 *
10 * The Imote2 is a wireless sensor node platform sold
11 * by Crossbow (www.xbow.com).
12 */
13
14#include <linux/init.h>
15#include <linux/device.h>
16#include <linux/mtd/mtd.h>
17#include <linux/mtd/partitions.h>
18#include <linux/platform_device.h>
19#include <linux/regulator/machine.h>
20#include <linux/gpio.h>
21#include <linux/leds.h>
22#include <linux/spi/spi.h>
23#include <linux/i2c.h>
24#include <linux/mfd/da903x.h>
25
26#include <asm/mach-types.h>
27#include <asm/mach/arch.h>
28#include <asm/mach/map.h>
29#include <asm/mach/flash.h>
30
31#include <mach/i2c.h>
32#include <mach/pxa-regs.h>
33#include <mach/pxa2xx-regs.h>
34#include <mach/mfp-pxa27x.h>
35#include <mach/regs-ssp.h>
36#include <mach/udc.h>
37#include <mach/mmc.h>
38#include <mach/pxa2xx_spi.h>
39#include <mach/pxa27x-udc.h>
40
41#include "devices.h"
42#include "generic.h"
43
44static unsigned long imote2_pin_config[] __initdata = {
45
46 /* Device Identification for wakeup*/
47 GPIO102_GPIO,
48
49 /* Button */
50 GPIO91_GPIO,
51
52 /* DA9030 */
53 GPIO1_GPIO,
54
55 /* MMC */
56 GPIO32_MMC_CLK,
57 GPIO112_MMC_CMD,
58 GPIO92_MMC_DAT_0,
59 GPIO109_MMC_DAT_1,
60 GPIO110_MMC_DAT_2,
61 GPIO111_MMC_DAT_3,
62
63 /* 802.15.4 radio - driver out of mainline */
64 GPIO22_GPIO, /* CC_RSTN */
65 GPIO114_GPIO, /* CC_FIFO */
66 GPIO116_GPIO, /* CC_CCA */
67 GPIO0_GPIO, /* CC_FIFOP */
68 GPIO16_GPIO, /* CCSFD */
69 GPIO39_GPIO, /* CSn */
70 GPIO115_GPIO, /* Power enable */
71
72 /* I2C */
73 GPIO117_I2C_SCL,
74 GPIO118_I2C_SDA,
75
76 /* SSP 3 - 802.15.4 radio */
77 GPIO39_GPIO, /* Chip Select */
78 GPIO34_SSP3_SCLK,
79 GPIO35_SSP3_TXD,
80 GPIO41_SSP3_RXD,
81
82 /* SSP 2 - to daughter boards */
83 GPIO37_GPIO, /* Chip Select */
84 GPIO36_SSP2_SCLK,
85 GPIO38_SSP2_TXD,
86 GPIO11_SSP2_RXD,
87
88 /* SSP 1 - to daughter boards */
89 GPIO24_GPIO, /* Chip Select */
90 GPIO23_SSP1_SCLK,
91 GPIO25_SSP1_TXD,
92 GPIO26_SSP1_RXD,
93
94 /* BTUART Basic Connector*/
95 GPIO42_BTUART_RXD,
96 GPIO43_BTUART_TXD,
97 GPIO44_BTUART_CTS,
98 GPIO45_BTUART_RTS,
99
100 /* STUART Serial console via debug board*/
101 GPIO46_STUART_RXD,
102 GPIO47_STUART_TXD,
103
104 /* Basic sensor board */
105 GPIO96_GPIO, /* accelerometer interrupt */
106 GPIO99_GPIO, /* ADC interrupt */
107
108 /* Connector pins specified as gpios */
109 GPIO94_GPIO, /* large basic connector pin 14 */
110 GPIO10_GPIO, /* large basic connector pin 23 */
111
112 /* LEDS */
113 GPIO103_GPIO, /* red led */
114 GPIO104_GPIO, /* green led */
115 GPIO105_GPIO, /* blue led */
116};
117
118static struct gpio_led imote2_led_pins[] = {
119 {
120 .name = "imote2:red",
121 .gpio = 103,
122 .active_low = 1,
123 }, {
124 .name = "imote2:green",
125 .gpio = 104,
126 .active_low = 1,
127 }, {
128 .name = "imote2:blue",
129 .gpio = 105,
130 .active_low = 1,
131 },
132};
133
134static struct gpio_led_platform_data imote2_led_data = {
135 .num_leds = ARRAY_SIZE(imote2_led_pins),
136 .leds = imote2_led_pins,
137};
138
139static struct platform_device imote2_leds = {
140 .name = "leds-gpio",
141 .id = -1,
142 .dev = {
143 .platform_data = &imote2_led_data,
144 },
145};
146
147/* Reverse engineered partly from Platformx drivers */
148enum imote2_ldos{
149 vcc_vref,
150 vcc_cc2420,
151 vcc_mica,
152 vcc_bt,
153 /* The two voltages available to sensor boards */
154 vcc_sensor_1_8,
155 vcc_sensor_3,
156
157 vcc_sram_ext, /* directly connected to the pxa271 */
158 vcc_pxa_pll,
159 vcc_pxa_usim, /* Reference voltage for certain gpios */
160 vcc_pxa_mem,
161 vcc_pxa_flash,
162 vcc_pxa_core, /*Dc-Dc buck not yet supported */
163 vcc_lcd,
164 vcc_bb,
165 vcc_bbio,
166 vcc_io, /* cc2420 802.15.4 radio and pxa vcc_io ?*/
167};
168
169/* The values of the various regulator constraints are obviously dependent
170 * on exactly what is wired to each ldo. Unfortunately this information is
171 * not generally available. More information has been requested from Xbow
172 * but as of yet they haven't been forthcoming.
173 *
174 * Some of these are clearly Stargate 2 related (no way of plugging
175 * in an lcd on the IM2 for example!).
176 */
177static struct regulator_init_data imote2_ldo_init_data[] = {
178 [vcc_bbio] = {
179 .constraints = { /* board default 1.8V */
180 .name = "vcc_bbio",
181 .min_uV = 1800000,
182 .max_uV = 1800000,
183 },
184 },
185 [vcc_bb] = {
186 .constraints = { /* board default 2.8V */
187 .name = "vcc_bb",
188 .min_uV = 2700000,
189 .max_uV = 3000000,
190 },
191 },
192 [vcc_pxa_flash] = {
193 .constraints = {/* default is 1.8V */
194 .name = "vcc_pxa_flash",
195 .min_uV = 1800000,
196 .max_uV = 1800000,
197 },
198 },
199 [vcc_cc2420] = { /* also vcc_io */
200 .constraints = {
201 /* board default is 2.8V */
202 .name = "vcc_cc2420",
203 .min_uV = 2700000,
204 .max_uV = 3300000,
205 },
206 },
207 [vcc_vref] = { /* Reference for what? */
208 .constraints = { /* default 1.8V */
209 .name = "vcc_vref",
210 .min_uV = 1800000,
211 .max_uV = 1800000,
212 },
213 },
214 [vcc_sram_ext] = {
215 .constraints = { /* default 2.8V */
216 .name = "vcc_sram_ext",
217 .min_uV = 2800000,
218 .max_uV = 2800000,
219 },
220 },
221 [vcc_mica] = {
222 .constraints = { /* default 2.8V */
223 .name = "vcc_mica",
224 .min_uV = 2800000,
225 .max_uV = 2800000,
226 },
227 },
228 [vcc_bt] = {
229 .constraints = { /* default 2.8V */
230 .name = "vcc_bt",
231 .min_uV = 2800000,
232 .max_uV = 2800000,
233 },
234 },
235 [vcc_lcd] = {
236 .constraints = { /* default 2.8V */
237 .name = "vcc_lcd",
238 .min_uV = 2700000,
239 .max_uV = 3300000,
240 },
241 },
242 [vcc_io] = { /* Same or higher than everything
243 * bar vccbat and vccusb */
244 .constraints = { /* default 2.8V */
245 .name = "vcc_io",
246 .min_uV = 2692000,
247 .max_uV = 3300000,
248 },
249 },
250 [vcc_sensor_1_8] = {
251 .constraints = { /* default 1.8V */
252 .name = "vcc_sensor_1_8",
253 .min_uV = 1800000,
254 .max_uV = 1800000,
255 },
256 },
257 [vcc_sensor_3] = { /* curiously default 2.8V */
258 .constraints = {
259 .name = "vcc_sensor_3",
260 .min_uV = 2800000,
261 .max_uV = 3000000,
262 },
263 },
264 [vcc_pxa_pll] = { /* 1.17V - 1.43V, default 1.3V*/
265 .constraints = {
266 .name = "vcc_pxa_pll",
267 .min_uV = 1170000,
268 .max_uV = 1430000,
269 },
270 },
271 [vcc_pxa_usim] = {
272 .constraints = { /* default 1.8V */
273 .name = "vcc_pxa_usim",
274 .min_uV = 1710000,
275 .max_uV = 2160000,
276 },
277 },
278 [vcc_pxa_mem] = {
279 .constraints = { /* default 1.8V */
280 .name = "vcc_pxa_mem",
281 .min_uV = 1800000,
282 .max_uV = 1800000,
283 },
284 },
285};
286
287static struct da903x_subdev_info imote2_da9030_subdevs[] = {
288 {
289 .name = "da903x-regulator",
290 .id = DA9030_ID_LDO2,
291 .platform_data = &imote2_ldo_init_data[vcc_bbio],
292 }, {
293 .name = "da903x-regulator",
294 .id = DA9030_ID_LDO3,
295 .platform_data = &imote2_ldo_init_data[vcc_bb],
296 }, {
297 .name = "da903x-regulator",
298 .id = DA9030_ID_LDO4,
299 .platform_data = &imote2_ldo_init_data[vcc_pxa_flash],
300 }, {
301 .name = "da903x-regulator",
302 .id = DA9030_ID_LDO5,
303 .platform_data = &imote2_ldo_init_data[vcc_cc2420],
304 }, {
305 .name = "da903x-regulator",
306 .id = DA9030_ID_LDO6,
307 .platform_data = &imote2_ldo_init_data[vcc_vref],
308 }, {
309 .name = "da903x-regulator",
310 .id = DA9030_ID_LDO7,
311 .platform_data = &imote2_ldo_init_data[vcc_sram_ext],
312 }, {
313 .name = "da903x-regulator",
314 .id = DA9030_ID_LDO8,
315 .platform_data = &imote2_ldo_init_data[vcc_mica],
316 }, {
317 .name = "da903x-regulator",
318 .id = DA9030_ID_LDO9,
319 .platform_data = &imote2_ldo_init_data[vcc_bt],
320 }, {
321 .name = "da903x-regulator",
322 .id = DA9030_ID_LDO10,
323 .platform_data = &imote2_ldo_init_data[vcc_sensor_1_8],
324 }, {
325 .name = "da903x-regulator",
326 .id = DA9030_ID_LDO11,
327 .platform_data = &imote2_ldo_init_data[vcc_sensor_3],
328 }, {
329 .name = "da903x-regulator",
330 .id = DA9030_ID_LDO12,
331 .platform_data = &imote2_ldo_init_data[vcc_lcd],
332 }, {
333 .name = "da903x-regulator",
334 .id = DA9030_ID_LDO15,
335 .platform_data = &imote2_ldo_init_data[vcc_pxa_pll],
336 }, {
337 .name = "da903x-regulator",
338 .id = DA9030_ID_LDO17,
339 .platform_data = &imote2_ldo_init_data[vcc_pxa_usim],
340 }, {
341 .name = "da903x-regulator",
342 .id = DA9030_ID_LDO18,
343 .platform_data = &imote2_ldo_init_data[vcc_io],
344 }, {
345 .name = "da903x-regulator",
346 .id = DA9030_ID_LDO19,
347 .platform_data = &imote2_ldo_init_data[vcc_pxa_mem],
348 },
349};
350
351static struct da903x_platform_data imote2_da9030_pdata = {
352 .num_subdevs = ARRAY_SIZE(imote2_da9030_subdevs),
353 .subdevs = imote2_da9030_subdevs,
354};
355
356/* As the the imote2 doesn't currently have a conventional SD slot
357 * there is no option to hotplug cards, making all this rather simple
358 */
359static int imote2_mci_get_ro(struct device *dev)
360{
361 return 0;
362}
363
364/* Rather simple case as hotplugging not possible */
365static struct pxamci_platform_data imote2_mci_platform_data = {
366 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* default anyway */
367 .get_ro = imote2_mci_get_ro,
368};
369
370static struct mtd_partition imote2flash_partitions[] = {
371 {
372 .name = "Bootloader",
373 .size = 0x00040000,
374 .offset = 0,
375 .mask_flags = MTD_WRITEABLE,
376 }, {
377 .name = "Kernel",
378 .size = 0x00200000,
379 .offset = 0x00040000,
380 .mask_flags = 0,
381 }, {
382 .name = "Filesystem",
383 .size = 0x01DC0000,
384 .offset = 0x00240000,
385 .mask_flags = 0,
386 },
387};
388
389static struct resource flash_resources = {
390 .start = PXA_CS0_PHYS,
391 .end = PXA_CS0_PHYS + SZ_32M - 1,
392 .flags = IORESOURCE_MEM,
393};
394
395static struct flash_platform_data imote2_flash_data = {
396 .map_name = "cfi_probe",
397 .parts = imote2flash_partitions,
398 .nr_parts = ARRAY_SIZE(imote2flash_partitions),
399 .name = "PXA27xOnChipROM",
400 .width = 2,
401};
402
403static struct platform_device imote2_flash_device = {
404 .name = "pxa2xx-flash",
405 .id = 0,
406 .dev = {
407 .platform_data = &imote2_flash_data,
408 },
409 .resource = &flash_resources,
410 .num_resources = 1,
411};
412
413/* Some of the drivers here are out of kernel at the moment (parts of IIO)
414 * and it may be a while before they are in the mainline.
415 */
416static struct i2c_board_info __initdata imote2_i2c_board_info[] = {
417 { /* UCAM sensor board */
418 .type = "max1238",
419 .addr = 0x35,
420 }, { /* ITS400 Sensor board only */
421 .type = "max1363",
422 .addr = 0x34,
423 /* Through a nand gate - Also beware, on V2 sensor board the
424 * pull up resistors are missing.
425 */
426 .irq = IRQ_GPIO(99),
427 }, { /* ITS400 Sensor board only */
428 .type = "tsl2561",
429 .addr = 0x49,
430 /* Through a nand gate - Also beware, on V2 sensor board the
431 * pull up resistors are missing.
432 */
433 .irq = IRQ_GPIO(99),
434 }, { /* ITS400 Sensor board only */
435 .type = "tmp175",
436 .addr = 0x4A,
437 .irq = IRQ_GPIO(96),
438 },
439};
440
441static struct i2c_board_info __initdata imote2_pwr_i2c_board_info[] = {
442 {
443 .type = "da9030",
444 .addr = 0x49,
445 .platform_data = &imote2_da9030_pdata,
446 .irq = gpio_to_irq(1),
447 },
448};
449
450static struct pxa2xx_spi_master pxa_ssp_master_0_info = {
451 .num_chipselect = 1,
452};
453
454static struct pxa2xx_spi_master pxa_ssp_master_1_info = {
455 .num_chipselect = 1,
456};
457
458static struct pxa2xx_spi_master pxa_ssp_master_2_info = {
459 .num_chipselect = 1,
460};
461
462/* Patch posted by Eric Miao <eric.miao@marvell.com> will remove
463 * the need for these functions.
464 */
465static void spi1control(u32 command)
466{
467 gpio_set_value(24, command & PXA2XX_CS_ASSERT ? 0 : 1);
468};
469
470static void spi3control(u32 command)
471{
472 gpio_set_value(39, command & PXA2XX_CS_ASSERT ? 0 : 1);
473};
474
475static struct pxa2xx_spi_chip staccel_chip_info = {
476 .tx_threshold = 8,
477 .rx_threshold = 8,
478 .dma_burst_size = 8,
479 .timeout = 235,
480 .cs_control = spi1control,
481};
482
483static struct pxa2xx_spi_chip cc2420_info = {
484 .tx_threshold = 8,
485 .rx_threshold = 8,
486 .dma_burst_size = 8,
487 .timeout = 235,
488 .cs_control = spi3control,
489};
490
491static struct spi_board_info spi_board_info[] __initdata = {
492 { /* Driver in IIO */
493 .modalias = "lis3l02dq",
494 .max_speed_hz = 8000000,/* 8MHz max spi frequency at 3V */
495 .bus_num = 1,
496 .chip_select = 0,
497 .controller_data = &staccel_chip_info,
498 .irq = IRQ_GPIO(96),
499 }, { /* Driver out of kernel as it needs considerable rewriting */
500 .modalias = "cc2420",
501 .max_speed_hz = 6500000,
502 .bus_num = 3,
503 .chip_select = 0,
504 .controller_data = &cc2420_info,
505 },
506};
507
508static void im2_udc_command(int cmd)
509{
510 switch (cmd) {
511 case PXA2XX_UDC_CMD_CONNECT:
512 UP2OCR |= UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE;
513 break;
514 case PXA2XX_UDC_CMD_DISCONNECT:
515 UP2OCR &= ~(UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE);
516 break;
517 }
518}
519
520static struct pxa2xx_udc_mach_info imote2_udc_info __initdata = {
521 .udc_command = im2_udc_command,
522};
523
524static struct platform_device *imote2_devices[] = {
525 &imote2_flash_device,
526 &imote2_leds,
527};
528
529static struct i2c_pxa_platform_data i2c_pwr_pdata = {
530 .fast_mode = 1,
531};
532
533static struct i2c_pxa_platform_data i2c_pdata = {
534 .fast_mode = 1,
535};
536
537static void __init imote2_init(void)
538{
539
540 pxa2xx_mfp_config(ARRAY_AND_SIZE(imote2_pin_config));
541 /* SPI chip select directions - all other directions should
542 * be handled by drivers.*/
543 gpio_direction_output(37, 0);
544 gpio_direction_output(24, 0);
545 gpio_direction_output(39, 0);
546
547 platform_add_devices(imote2_devices, ARRAY_SIZE(imote2_devices));
548
549 pxa2xx_set_spi_info(1, &pxa_ssp_master_0_info);
550 pxa2xx_set_spi_info(2, &pxa_ssp_master_1_info);
551 pxa2xx_set_spi_info(3, &pxa_ssp_master_2_info);
552
553 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
554
555 i2c_register_board_info(0, imote2_i2c_board_info,
556 ARRAY_SIZE(imote2_i2c_board_info));
557 i2c_register_board_info(1, imote2_pwr_i2c_board_info,
558 ARRAY_SIZE(imote2_pwr_i2c_board_info));
559
560 pxa27x_set_i2c_power_info(&i2c_pwr_pdata);
561 pxa_set_i2c_info(&i2c_pdata);
562
563 pxa_set_mci_info(&imote2_mci_platform_data);
564 pxa_set_udc_info(&imote2_udc_info);
565}
566
567MACHINE_START(INTELMOTE2, "IMOTE 2")
568 .phys_io = 0x40000000,
569 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
570 .map_io = pxa_map_io,
571 .init_irq = pxa27x_init_irq,
572 .timer = &pxa_timer,
573 .init_machine = imote2_init,
574 .boot_params = 0xA0000100,
575MACHINE_END
diff --git a/arch/arm/mach-pxa/include/mach/clkdev.h b/arch/arm/mach-pxa/include/mach/clkdev.h
new file mode 100644
index 000000000000..04b37a89801c
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/clkdev.h
@@ -0,0 +1,7 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do { } while (0)
6
7#endif
diff --git a/arch/arm/mach-pxa/include/mach/dma.h b/arch/arm/mach-pxa/include/mach/dma.h
index 955bfe606067..7804637a6df3 100644
--- a/arch/arm/mach-pxa/include/mach/dma.h
+++ b/arch/arm/mach-pxa/include/mach/dma.h
@@ -30,10 +30,6 @@ typedef enum {
30 DMA_PRIO_LOW = 2 30 DMA_PRIO_LOW = 2
31} pxa_dma_prio; 31} pxa_dma_prio;
32 32
33#if defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
34#define HAVE_ARCH_PCI_SET_DMA_MASK 1
35#endif
36
37/* 33/*
38 * DMA registration 34 * DMA registration
39 */ 35 */
diff --git a/arch/arm/mach-pxa/include/mach/eseries-gpio.h b/arch/arm/mach-pxa/include/mach/eseries-gpio.h
index 4c90b1310270..efbd2aa9ecec 100644
--- a/arch/arm/mach-pxa/include/mach/eseries-gpio.h
+++ b/arch/arm/mach-pxa/include/mach/eseries-gpio.h
@@ -43,8 +43,10 @@
43#define GPIO_E800_PCMCIA_PWR1 73 43#define GPIO_E800_PCMCIA_PWR1 73
44 44
45/* e7xx IrDA power control */ 45/* e7xx IrDA power control */
46#define GPIO_E7XX_IR_ON 38 46#define GPIO_E7XX_IR_OFF 38
47 47
48/* ASIC related GPIOs */ 48/* ASIC related GPIOs */
49#define GPIO_ESERIES_TMIO_IRQ 5 49#define GPIO_ESERIES_TMIO_IRQ 5
50#define GPIO_ESERIES_TMIO_PCLR 19
51#define GPIO_ESERIES_TMIO_SUSPEND 45
50#define GPIO_E800_ANGELX_IRQ 8 52#define GPIO_E800_ANGELX_IRQ 8
diff --git a/arch/arm/mach-pxa/include/mach/gumstix.h b/arch/arm/mach-pxa/include/mach/gumstix.h
index 42ee1956750e..099f54a41de4 100644
--- a/arch/arm/mach-pxa/include/mach/gumstix.h
+++ b/arch/arm/mach-pxa/include/mach/gumstix.h
@@ -94,3 +94,7 @@ has detected a cable insertion; driven low otherwise. */
94#define GPIO26_PRDY_nBSY_MD (GPIO26_PRDY_nBSY | GPIO_IN) 94#define GPIO26_PRDY_nBSY_MD (GPIO26_PRDY_nBSY | GPIO_IN)
95#define GPIO27_PRDY_nBSY_MD (GPIO27_PRDY_nBSY | GPIO_IN) 95#define GPIO27_PRDY_nBSY_MD (GPIO27_PRDY_nBSY | GPIO_IN)
96#define GPIO36_nCD_MD (GPIO36_nCD | GPIO_IN) 96#define GPIO36_nCD_MD (GPIO36_nCD | GPIO_IN)
97
98/* for expansion boards that can't be programatically detected */
99extern int am200_init(void);
100
diff --git a/arch/arm/mach-pxa/include/mach/h5000.h b/arch/arm/mach-pxa/include/mach/h5000.h
new file mode 100644
index 000000000000..2a5ae3802787
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/h5000.h
@@ -0,0 +1,113 @@
1/*
2 * Hardware definitions for HP iPAQ h5xxx Handheld Computers
3 *
4 * Copyright(20)02 Hewlett-Packard Company.
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 * COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
12 * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
13 * FITNESS FOR ANY PARTICULAR PURPOSE.
14 *
15 * Author: Jamey Hicks
16 */
17
18#ifndef __ASM_ARCH_H5000_H
19#define __ASM_ARCH_H5000_H
20
21#include <mach/mfp-pxa25x.h>
22
23/*
24 * CPU GPIOs
25 */
26
27#define H5000_GPIO_POWER_BUTTON (0)
28#define H5000_GPIO_RESET_BUTTON_N (1)
29#define H5000_GPIO_OPT_INT (2)
30#define H5000_GPIO_BACKUP_POWER (3)
31#define H5000_GPIO_ACTION_BUTTON (4)
32#define H5000_GPIO_COM_DCD_SOMETHING (5) /* what is this really ? */
33/* 6 not connected */
34#define H5000_GPIO_RESET_BUTTON_AGAIN_N (7) /* connected to gpio 1 as well */
35/* 8 not connected */
36#define H5000_GPIO_RSO_N (9) /* reset output from max1702 which regulates 3.3 and 2.5 */
37#define H5000_GPIO_ASIC_INT_N (10) /* from companion asic */
38#define H5000_GPIO_BT_ENV_0 (11) /* to LMX9814, set to 1 according to regdump */
39/*(12) not connected */
40#define H5000_GPIO_BT_ENV_1 (13) /* to LMX9814, set to 1 according to regdump */
41#define H5000_GPIO_BT_WU (14) /* from LMX9814, Defined as HOST_WAKEUP in the LMX9820 data sheet */
42/*(15) is CS1# */
43/*(16) not connected */
44/*(17) not connected */
45/*(18) is pcmcia ready */
46/*(19) is dreq1 */
47/*(20) is dreq0 */
48#define H5000_GPIO_OE_RD_NWR (21) /* output enable on rd/nwr signal to companion asic */
49/*(22) is not connected */
50#define H5000_GPIO_OPT_SPI_CLK (23) /* to extension pack */
51#define H5000_GPIO_OPT_SPI_CS_N (24) /* to extension pack */
52#define H5000_GPIO_OPT_SPI_DOUT (25) /* to extension pack */
53#define H5000_GPIO_OPT_SPI_DIN (26) /* to extension pack */
54/*(27) not connected */
55#define H5000_GPIO_I2S_BITCLK (28) /* connected to AC97 codec */
56#define H5000_GPIO_I2S_DATAOUT (29) /* connected to AC97 codec */
57#define H5000_GPIO_I2S_DATAIN (30) /* connected to AC97 codec */
58#define H5000_GPIO_I2S_LRCLK (31) /* connected to AC97 codec */
59#define H5000_GPIO_I2S_SYSCLK (32) /* connected to AC97 codec */
60/*(33) is CS5# */
61#define H5000_GPIO_COM_RXD (34) /* connected to cradle/cable connector */
62#define H5000_GPIO_COM_CTS (35) /* connected to cradle/cable connector */
63#define H5000_GPIO_COM_DCD (36) /* connected to cradle/cable connector */
64#define H5000_GPIO_COM_DSR (37) /* connected to cradle/cable connector */
65#define H5000_GPIO_COM_RI (38) /* connected to cradle/cable connector */
66#define H5000_GPIO_COM_TXD (39) /* connected to cradle/cable connector */
67#define H5000_GPIO_COM_DTR (40) /* connected to cradle/cable connector */
68#define H5000_GPIO_COM_RTS (41) /* connected to cradle/cable connector */
69
70#define H5000_GPIO_BT_RXD (42) /* connected to BT (LMX9814) */
71#define H5000_GPIO_BT_TXD (43) /* connected to BT (LMX9814) */
72#define H5000_GPIO_BT_CTS (44) /* connected to BT (LMX9814) */
73#define H5000_GPIO_BT_RTS (45) /* connected to BT (LMX9814) */
74
75#define H5000_GPIO_IRDA_RXD (46)
76#define H5000_GPIO_IRDA_TXD (47)
77
78#define H5000_GPIO_POE_N (48) /* used for pcmcia */
79#define H5000_GPIO_PWE_N (49) /* used for pcmcia */
80#define H5000_GPIO_PIOR_N (50) /* used for pcmcia */
81#define H5000_GPIO_PIOW_N (51) /* used for pcmcia */
82#define H5000_GPIO_PCE1_N (52) /* used for pcmcia */
83#define H5000_GPIO_PCE2_N (53) /* used for pcmcia */
84#define H5000_GPIO_PSKTSEL (54) /* used for pcmcia */
85#define H5000_GPIO_PREG_N (55) /* used for pcmcia */
86#define H5000_GPIO_PWAIT_N (56) /* used for pcmcia */
87#define H5000_GPIO_IOIS16_N (57) /* used for pcmcia */
88
89#define H5000_GPIO_IRDA_SD (58) /* to hsdl3002 sd */
90/*(59) not connected */
91#define H5000_GPIO_POWER_SD_N (60) /* controls power to SD */
92#define H5000_GPIO_POWER_RS232_N (61) /* inverted FORCEON to rs232 transceiver */
93#define H5000_GPIO_POWER_ACCEL_N (62) /* controls power to accel */
94/*(63) is not connected */
95#define H5000_GPIO_OPT_NVRAM (64) /* controls power to expansion pack */
96#define H5000_GPIO_CHG_EN (65) /* to sc801 en */
97#define H5000_GPIO_USB_PULLUP (66) /* USB d+ pullup via 1.5K resistor */
98#define H5000_GPIO_BT_2V8_N (67) /* 2.8V used by bluetooth */
99#define H5000_GPIO_EXT_CHG_RATE (68) /* enables external charging rate */
100/*(69) is not connected */
101#define H5000_GPIO_CIR_RESET (70) /* consumer IR reset */
102#define H5000_GPIO_POWER_LIGHT_SENSOR_N (71)
103#define H5000_GPIO_BT_M_RESET (72)
104#define H5000_GPIO_STD_CHG_RATE (73)
105#define H5000_GPIO_SD_WP_N (74)
106#define H5000_GPIO_MOTOR_ON_N (75) /* external pullup on this */
107#define H5000_GPIO_HEADPHONE_DETECT (76)
108#define H5000_GPIO_USB_CHG_RATE (77) /* select rate for charging via usb */
109/*(78) is CS2# */
110/*(79) is CS3# */
111/*(80) is CS4# */
112
113#endif /* __ASM_ARCH_H5000_H */
diff --git a/arch/arm/mach-pxa/include/mach/hardware.h b/arch/arm/mach-pxa/include/mach/hardware.h
index a582a6d9b92b..16ab79547dae 100644
--- a/arch/arm/mach-pxa/include/mach/hardware.h
+++ b/arch/arm/mach-pxa/include/mach/hardware.h
@@ -102,6 +102,9 @@
102 * PXA930 B0 0x69056835 0x5E643013 102 * PXA930 B0 0x69056835 0x5E643013
103 * PXA930 B1 0x69056837 0x7E643013 103 * PXA930 B1 0x69056837 0x7E643013
104 * PXA930 B2 0x69056838 0x8E643013 104 * PXA930 B2 0x69056838 0x8E643013
105 *
106 * PXA935 A0 0x56056931 0x1E653013
107 * PXA935 B0 0x56056936 0x6E653013
105 */ 108 */
106#ifdef CONFIG_PXA25x 109#ifdef CONFIG_PXA25x
107#define __cpu_is_pxa210(id) \ 110#define __cpu_is_pxa210(id) \
@@ -178,12 +181,22 @@
178#define __cpu_is_pxa930(id) \ 181#define __cpu_is_pxa930(id) \
179 ({ \ 182 ({ \
180 unsigned int _id = (id) >> 4 & 0xfff; \ 183 unsigned int _id = (id) >> 4 & 0xfff; \
181 _id == 0x683; \ 184 _id == 0x683; \
182 }) 185 })
183#else 186#else
184#define __cpu_is_pxa930(id) (0) 187#define __cpu_is_pxa930(id) (0)
185#endif 188#endif
186 189
190#ifdef CONFIG_CPU_PXA935
191#define __cpu_is_pxa935(id) \
192 ({ \
193 unsigned int _id = (id) >> 4 & 0xfff; \
194 _id == 0x693; \
195 })
196#else
197#define __cpu_is_pxa935(id) (0)
198#endif
199
187#define cpu_is_pxa210() \ 200#define cpu_is_pxa210() \
188 ({ \ 201 ({ \
189 __cpu_is_pxa210(read_cpuid_id()); \ 202 __cpu_is_pxa210(read_cpuid_id()); \
@@ -204,8 +217,6 @@
204 __cpu_is_pxa25x(read_cpuid_id()); \ 217 __cpu_is_pxa25x(read_cpuid_id()); \
205 }) 218 })
206 219
207extern int cpu_is_pxa26x(void);
208
209#define cpu_is_pxa27x() \ 220#define cpu_is_pxa27x() \
210 ({ \ 221 ({ \
211 __cpu_is_pxa27x(read_cpuid_id()); \ 222 __cpu_is_pxa27x(read_cpuid_id()); \
@@ -232,6 +243,12 @@ extern int cpu_is_pxa26x(void);
232 __cpu_is_pxa930(id); \ 243 __cpu_is_pxa930(id); \
233 }) 244 })
234 245
246#define cpu_is_pxa935() \
247 ({ \
248 unsigned int id = read_cpuid(CPUID_ID); \
249 __cpu_is_pxa935(id); \
250 })
251
235/* 252/*
236 * CPUID Core Generation Bit 253 * CPUID Core Generation Bit
237 * <= 0x2 for pxa21x/pxa25x/pxa26x/pxa27x 254 * <= 0x2 for pxa21x/pxa25x/pxa26x/pxa27x
@@ -249,6 +266,12 @@ extern int cpu_is_pxa26x(void);
249 _id == 0x3; \ 266 _id == 0x3; \
250 }) 267 })
251 268
269#define __cpu_is_pxa9xx(id) \
270 ({ \
271 unsigned int _id = (id) >> 4 & 0xfff; \
272 _id == 0x683 || _id == 0x693; \
273 })
274
252#define cpu_is_pxa2xx() \ 275#define cpu_is_pxa2xx() \
253 ({ \ 276 ({ \
254 __cpu_is_pxa2xx(read_cpuid_id()); \ 277 __cpu_is_pxa2xx(read_cpuid_id()); \
@@ -259,32 +282,25 @@ extern int cpu_is_pxa26x(void);
259 __cpu_is_pxa3xx(read_cpuid_id()); \ 282 __cpu_is_pxa3xx(read_cpuid_id()); \
260 }) 283 })
261 284
262/* 285#define cpu_is_pxa9xx() \
263 * Handy routine to set GPIO alternate functions 286 ({ \
264 */ 287 __cpu_is_pxa9xx(read_cpuid_id()); \
265extern int pxa_gpio_mode( int gpio_mode ); 288 })
266
267/*
268 * Return GPIO level, nonzero means high, zero is low
269 */
270extern int pxa_gpio_get_value(unsigned gpio);
271
272/*
273 * Set output GPIO level
274 */
275extern void pxa_gpio_set_value(unsigned gpio, int value);
276
277/* 289/*
278 * return current memory and LCD clock frequency in units of 10kHz 290 * return current memory and LCD clock frequency in units of 10kHz
279 */ 291 */
280extern unsigned int get_memclk_frequency_10khz(void); 292extern unsigned int get_memclk_frequency_10khz(void);
281 293
294/* return the clock tick rate of the OS timer */
295extern unsigned long get_clock_tick_rate(void);
282#endif 296#endif
283 297
284#if defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI) 298#if defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
285#define PCIBIOS_MIN_IO 0 299#define PCIBIOS_MIN_IO 0
286#define PCIBIOS_MIN_MEM 0 300#define PCIBIOS_MIN_MEM 0
287#define pcibios_assign_all_busses() 1 301#define pcibios_assign_all_busses() 1
302#define HAVE_ARCH_PCI_SET_DMA_MASK 1
288#endif 303#endif
289 304
305
290#endif /* _ASM_ARCH_HARDWARE_H */ 306#endif /* _ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-pxa/include/mach/io.h b/arch/arm/mach-pxa/include/mach/io.h
index 600fd4f76603..262691fb97d8 100644
--- a/arch/arm/mach-pxa/include/mach/io.h
+++ b/arch/arm/mach-pxa/include/mach/io.h
@@ -6,15 +6,13 @@
6#ifndef __ASM_ARM_ARCH_IO_H 6#ifndef __ASM_ARM_ARCH_IO_H
7#define __ASM_ARM_ARCH_IO_H 7#define __ASM_ARM_ARCH_IO_H
8 8
9#include <mach/hardware.h>
10
11#define IO_SPACE_LIMIT 0xffffffff 9#define IO_SPACE_LIMIT 0xffffffff
12 10
13/* 11/*
14 * We don't actually have real ISA nor PCI buses, but there is so many 12 * We don't actually have real ISA nor PCI buses, but there is so many
15 * drivers out there that might just work if we fake them... 13 * drivers out there that might just work if we fake them...
16 */ 14 */
17#define __io(a) ((void __iomem *)(a)) 15#define __io(a) __typesafe_io(a)
18#define __mem_pci(a) (a) 16#define __mem_pci(a) (a)
19 17
20#endif 18#endif
diff --git a/arch/arm/mach-pxa/include/mach/littleton.h b/arch/arm/mach-pxa/include/mach/littleton.h
index 5c4e320c1437..6c9b21c51322 100644
--- a/arch/arm/mach-pxa/include/mach/littleton.h
+++ b/arch/arm/mach-pxa/include/mach/littleton.h
@@ -1,8 +1,13 @@
1#ifndef __ASM_ARCH_ZYLONITE_H 1#ifndef __ASM_ARCH_LITTLETON_H
2#define __ASM_ARCH_ZYLONITE_H 2#define __ASM_ARCH_LITTLETON_H
3
4#include <mach/gpio.h>
3 5
4#define LITTLETON_ETH_PHYS 0x30000000 6#define LITTLETON_ETH_PHYS 0x30000000
5 7
6#define LITTLETON_GPIO_LCD_CS (17) 8#define LITTLETON_GPIO_LCD_CS (17)
7 9
8#endif /* __ASM_ARCH_ZYLONITE_H */ 10#define EXT0_GPIO_BASE (NR_BUILTIN_GPIO)
11#define EXT0_GPIO(x) (EXT0_GPIO_BASE + (x))
12
13#endif /* __ASM_ARCH_LITTLETON_H */
diff --git a/arch/arm/mach-pxa/include/mach/memory.h b/arch/arm/mach-pxa/include/mach/memory.h
index 59aef89808d6..f626730ee42e 100644
--- a/arch/arm/mach-pxa/include/mach/memory.h
+++ b/arch/arm/mach-pxa/include/mach/memory.h
@@ -18,16 +18,6 @@
18#define PHYS_OFFSET UL(0xa0000000) 18#define PHYS_OFFSET UL(0xa0000000)
19 19
20/* 20/*
21 * Virtual view <-> DMA view memory address translations
22 * virt_to_bus: Used to translate the virtual address to an
23 * address suitable to be passed to set_dma_addr
24 * bus_to_virt: Used to convert an address for DMA operations
25 * to an address that the kernel can use.
26 */
27#define __virt_to_bus(x) __virt_to_phys(x)
28#define __bus_to_virt(x) __phys_to_virt(x)
29
30/*
31 * The nodes are matched with the physical SDRAM banks as follows: 21 * The nodes are matched with the physical SDRAM banks as follows:
32 * 22 *
33 * node 0: 0xa0000000-0xa3ffffff --> 0xc0000000-0xc3ffffff 23 * node 0: 0xa0000000-0xa3ffffff --> 0xc0000000-0xc3ffffff
@@ -47,6 +37,7 @@ void cmx2xx_pci_adjust_zones(int node, unsigned long *size,
47 cmx2xx_pci_adjust_zones(node, size, holes) 37 cmx2xx_pci_adjust_zones(node, size, holes)
48 38
49#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_64M - 1) 39#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_64M - 1)
40#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_64M)
50#endif 41#endif
51 42
52#endif 43#endif
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa25x.h b/arch/arm/mach-pxa/include/mach/mfp-pxa25x.h
index 617cab2cc8d0..a72869b73ee3 100644
--- a/arch/arm/mach-pxa/include/mach/mfp-pxa25x.h
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa25x.h
@@ -158,4 +158,35 @@
158#define GPIO76_LCD_PCLK MFP_CFG_OUT(GPIO76, AF2, DRIVE_LOW) 158#define GPIO76_LCD_PCLK MFP_CFG_OUT(GPIO76, AF2, DRIVE_LOW)
159#define GPIO77_LCD_BIAS MFP_CFG_OUT(GPIO77, AF2, DRIVE_LOW) 159#define GPIO77_LCD_BIAS MFP_CFG_OUT(GPIO77, AF2, DRIVE_LOW)
160 160
161#ifdef CONFIG_CPU_PXA26x
162/* GPIO */
163#define GPIO85_GPIO MFP_CFG_IN(GPIO85, AF0)
164#define GPIO86_GPIO MFP_CFG_IN(GPIO86, AF1)
165#define GPIO87_GPIO MFP_CFG_IN(GPIO87, AF1)
166#define GPIO88_GPIO MFP_CFG_IN(GPIO88, AF1)
167#define GPIO89_GPIO MFP_CFG_IN(GPIO89, AF1)
168
169/* SDRAM */
170#define GPIO86_nSDCS2 MFP_CFG_OUT(GPIO86, AF0, DRIVE_HIGH)
171#define GPIO87_nSDCS3 MFP_CFG_OUT(GPIO87, AF0, DRIVE_HIGH)
172#define GPIO88_RDnWR MFP_CFG_OUT(GPIO88, AF0, DRIVE_HIGH)
173#define GPIO89_nACRESET MFP_CFG_OUT(GPIO89, AF0, DRIVE_HIGH)
174
175/* USB */
176#define GPIO9_USB_RCV MFP_CFG_IN(GPIO9, AF1)
177#define GPIO32_USB_VP MFP_CFG_IN(GPIO32, AF2)
178#define GPIO34_USB_VM MFP_CFG_IN(GPIO34, AF2)
179#define GPIO39_USB_VPO MFP_CFG_OUT(GPIO39, AF3, DRIVE_LOW)
180#define GPIO56_USB_VMO MFP_CFG_OUT(GPIO56, AF1, DRIVE_LOW)
181#define GPIO57_USB_nOE MFP_CFG_OUT(GPIO57, AF1, DRIVE_HIGH)
182
183/* ASSP */
184#define GPIO28_ASSP_BITCLK_IN MFP_CFG_IN(GPIO28, AF3)
185#define GPIO28_ASSP_BITCLK_OUT MFP_CFG_OUT(GPIO28, AF3, DRIVE_LOW)
186#define GPIO29_ASSP_RXD MFP_CFG_IN(GPIO29, AF3)
187#define GPIO30_ASSP_TXD MFP_CFG_OUT(GPIO30, AF3, DRIVE_LOW)
188#define GPIO31_ASSP_SFRM_IN MFP_CFG_IN(GPIO31, AF1)
189#define GPIO31_ASSP_SFRM_OUT MFP_CFG_OUT(GPIO31, AF3, DRIVE_LOW)
190#endif
191
161#endif /* __ASM_ARCH_MFP_PXA25X_H */ 192#endif /* __ASM_ARCH_MFP_PXA25X_H */
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
index 122bdbd53182..da4f85a4f990 100644
--- a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
@@ -11,6 +11,12 @@
11#include <mach/mfp.h> 11#include <mach/mfp.h>
12#include <mach/mfp-pxa2xx.h> 12#include <mach/mfp-pxa2xx.h>
13 13
14/* Note: GPIO3/GPIO4 will be driven by Power I2C when PCFR/PI2C_EN
15 * bit is set, regardless of the GPIO configuration
16 */
17#define GPIO3_GPIO MFP_CFG_IN(GPIO3, AF0)
18#define GPIO4_GPIO MFP_CFG_IN(GPIO4, AF0)
19
14/* GPIO */ 20/* GPIO */
15#define GPIO85_GPIO MFP_CFG_IN(GPIO85, AF0) 21#define GPIO85_GPIO MFP_CFG_IN(GPIO85, AF0)
16#define GPIO86_GPIO MFP_CFG_IN(GPIO86, AF0) 22#define GPIO86_GPIO MFP_CFG_IN(GPIO86, AF0)
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa930.h b/arch/arm/mach-pxa/include/mach/mfp-pxa930.h
index fabd9b4df827..fa73f56a1372 100644
--- a/arch/arm/mach-pxa/include/mach/mfp-pxa930.h
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa930.h
@@ -421,6 +421,7 @@
421#define GPIO20_PWM0 MFP_CFG_LPM(GPIO20, AF2, PULL_LOW) 421#define GPIO20_PWM0 MFP_CFG_LPM(GPIO20, AF2, PULL_LOW)
422#define GPIO21_PWM2 MFP_CFG_LPM(GPIO21, AF3, PULL_LOW) 422#define GPIO21_PWM2 MFP_CFG_LPM(GPIO21, AF3, PULL_LOW)
423#define GPIO22_PWM3 MFP_CFG_LPM(GPIO22, AF3, PULL_LOW) 423#define GPIO22_PWM3 MFP_CFG_LPM(GPIO22, AF3, PULL_LOW)
424#define GPIO32_PWM0 MFP_CFG_LPM(GPIO32, AF4, PULL_LOW)
424 425
425/* CIR */ 426/* CIR */
426#define GPIO46_CIR_OUT MFP_CFG(GPIO46, AF1) 427#define GPIO46_CIR_OUT MFP_CFG(GPIO46, AF1)
diff --git a/arch/arm/mach-pxa/include/mach/mioa701.h b/arch/arm/mach-pxa/include/mach/mioa701.h
index 8483cb511831..02868447b0b1 100644
--- a/arch/arm/mach-pxa/include/mach/mioa701.h
+++ b/arch/arm/mach-pxa/include/mach/mioa701.h
@@ -10,12 +10,14 @@
10 (MFP_PIN(pin) | MFP_##af | MFP_DIR_OUT | MFP_LPM_##state)) 10 (MFP_PIN(pin) | MFP_##af | MFP_DIR_OUT | MFP_LPM_##state))
11 11
12/* Global GPIOs */ 12/* Global GPIOs */
13#define GPIO9_CHARGE_nEN 9 13#define GPIO9_CHARGE_EN 9
14#define GPIO18_POWEROFF 18 14#define GPIO18_POWEROFF 18
15#define GPIO87_LCD_POWER 87 15#define GPIO87_LCD_POWER 87
16#define GPIO96_AC_DETECT 96
17#define GPIO80_MAYBE_CHARGE_VDROP 80 /* Drop of 88mV */
16 18
17/* USB */ 19/* USB */
18#define GPIO13_USB_DETECT 13 20#define GPIO13_nUSB_DETECT 13
19#define GPIO22_USB_ENABLE 22 21#define GPIO22_USB_ENABLE 22
20 22
21/* SDIO bits */ 23/* SDIO bits */
@@ -24,7 +26,10 @@
24#define GPIO91_SDIO_EN 91 26#define GPIO91_SDIO_EN 91
25 27
26/* Bluetooth */ 28/* Bluetooth */
29#define GPIO14_BT_nACTIVITY 14
27#define GPIO83_BT_ON 83 30#define GPIO83_BT_ON 83
31#define GPIO77_BT_UNKNOWN1 77
32#define GPIO86_BT_MAYBE_nRESET 86
28 33
29/* GPS */ 34/* GPS */
30#define GPIO23_GPS_UNKNOWN1 23 35#define GPIO23_GPS_UNKNOWN1 23
diff --git a/arch/arm/mach-pxa/include/mach/mtd-xip.h b/arch/arm/mach-pxa/include/mach/mtd-xip.h
index 4d452fcb1508..cfca8155be72 100644
--- a/arch/arm/mach-pxa/include/mach/mtd-xip.h
+++ b/arch/arm/mach-pxa/include/mach/mtd-xip.h
@@ -15,6 +15,7 @@
15#ifndef __ARCH_PXA_MTD_XIP_H__ 15#ifndef __ARCH_PXA_MTD_XIP_H__
16#define __ARCH_PXA_MTD_XIP_H__ 16#define __ARCH_PXA_MTD_XIP_H__
17 17
18#include <mach/hardware.h>
18#include <mach/pxa-regs.h> 19#include <mach/pxa-regs.h>
19 20
20#define xip_irqpending() (ICIP & ICMR) 21#define xip_irqpending() (ICIP & ICMR)
diff --git a/arch/arm/mach-pxa/include/mach/palmasoc.h b/arch/arm/mach-pxa/include/mach/palmasoc.h
new file mode 100644
index 000000000000..6c4b1f7de20a
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/palmasoc.h
@@ -0,0 +1,13 @@
1#ifndef _INCLUDE_PALMASOC_H_
2#define _INCLUDE_PALMASOC_H_
3struct palm27x_asoc_info {
4 int jack_gpio;
5};
6
7#ifdef CONFIG_SND_PXA2XX_SOC_PALM27X
8void __init palm27x_asoc_set_pdata(struct palm27x_asoc_info *data);
9#else
10static inline void palm27x_asoc_set_pdata(struct palm27x_asoc_info *data) {}
11#endif
12
13#endif
diff --git a/arch/arm/mach-pxa/include/mach/pxa-regs.h b/arch/arm/mach-pxa/include/mach/pxa-regs.h
index 15295d960000..31d615aa7723 100644
--- a/arch/arm/mach-pxa/include/mach/pxa-regs.h
+++ b/arch/arm/mach-pxa/include/mach/pxa-regs.h
@@ -13,6 +13,7 @@
13#ifndef __PXA_REGS_H 13#ifndef __PXA_REGS_H
14#define __PXA_REGS_H 14#define __PXA_REGS_H
15 15
16#include <mach/hardware.h>
16 17
17/* 18/*
18 * PXA Chip selects 19 * PXA Chip selects
@@ -123,298 +124,6 @@
123#define DCMD_WIDTH4 (3 << 14) /* 4 byte width (Word) */ 124#define DCMD_WIDTH4 (3 << 14) /* 4 byte width (Word) */
124#define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */ 125#define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */
125 126
126
127/*
128 * UARTs
129 */
130
131/* Full Function UART (FFUART) */
132#define FFUART FFRBR
133#define FFRBR __REG(0x40100000) /* Receive Buffer Register (read only) */
134#define FFTHR __REG(0x40100000) /* Transmit Holding Register (write only) */
135#define FFIER __REG(0x40100004) /* Interrupt Enable Register (read/write) */
136#define FFIIR __REG(0x40100008) /* Interrupt ID Register (read only) */
137#define FFFCR __REG(0x40100008) /* FIFO Control Register (write only) */
138#define FFLCR __REG(0x4010000C) /* Line Control Register (read/write) */
139#define FFMCR __REG(0x40100010) /* Modem Control Register (read/write) */
140#define FFLSR __REG(0x40100014) /* Line Status Register (read only) */
141#define FFMSR __REG(0x40100018) /* Modem Status Register (read only) */
142#define FFSPR __REG(0x4010001C) /* Scratch Pad Register (read/write) */
143#define FFISR __REG(0x40100020) /* Infrared Selection Register (read/write) */
144#define FFDLL __REG(0x40100000) /* Divisor Latch Low Register (DLAB = 1) (read/write) */
145#define FFDLH __REG(0x40100004) /* Divisor Latch High Register (DLAB = 1) (read/write) */
146
147/* Bluetooth UART (BTUART) */
148#define BTUART BTRBR
149#define BTRBR __REG(0x40200000) /* Receive Buffer Register (read only) */
150#define BTTHR __REG(0x40200000) /* Transmit Holding Register (write only) */
151#define BTIER __REG(0x40200004) /* Interrupt Enable Register (read/write) */
152#define BTIIR __REG(0x40200008) /* Interrupt ID Register (read only) */
153#define BTFCR __REG(0x40200008) /* FIFO Control Register (write only) */
154#define BTLCR __REG(0x4020000C) /* Line Control Register (read/write) */
155#define BTMCR __REG(0x40200010) /* Modem Control Register (read/write) */
156#define BTLSR __REG(0x40200014) /* Line Status Register (read only) */
157#define BTMSR __REG(0x40200018) /* Modem Status Register (read only) */
158#define BTSPR __REG(0x4020001C) /* Scratch Pad Register (read/write) */
159#define BTISR __REG(0x40200020) /* Infrared Selection Register (read/write) */
160#define BTDLL __REG(0x40200000) /* Divisor Latch Low Register (DLAB = 1) (read/write) */
161#define BTDLH __REG(0x40200004) /* Divisor Latch High Register (DLAB = 1) (read/write) */
162
163/* Standard UART (STUART) */
164#define STUART STRBR
165#define STRBR __REG(0x40700000) /* Receive Buffer Register (read only) */
166#define STTHR __REG(0x40700000) /* Transmit Holding Register (write only) */
167#define STIER __REG(0x40700004) /* Interrupt Enable Register (read/write) */
168#define STIIR __REG(0x40700008) /* Interrupt ID Register (read only) */
169#define STFCR __REG(0x40700008) /* FIFO Control Register (write only) */
170#define STLCR __REG(0x4070000C) /* Line Control Register (read/write) */
171#define STMCR __REG(0x40700010) /* Modem Control Register (read/write) */
172#define STLSR __REG(0x40700014) /* Line Status Register (read only) */
173#define STMSR __REG(0x40700018) /* Reserved */
174#define STSPR __REG(0x4070001C) /* Scratch Pad Register (read/write) */
175#define STISR __REG(0x40700020) /* Infrared Selection Register (read/write) */
176#define STDLL __REG(0x40700000) /* Divisor Latch Low Register (DLAB = 1) (read/write) */
177#define STDLH __REG(0x40700004) /* Divisor Latch High Register (DLAB = 1) (read/write) */
178
179/* Hardware UART (HWUART) */
180#define HWUART HWRBR
181#define HWRBR __REG(0x41600000) /* Receive Buffer Register (read only) */
182#define HWTHR __REG(0x41600000) /* Transmit Holding Register (write only) */
183#define HWIER __REG(0x41600004) /* Interrupt Enable Register (read/write) */
184#define HWIIR __REG(0x41600008) /* Interrupt ID Register (read only) */
185#define HWFCR __REG(0x41600008) /* FIFO Control Register (write only) */
186#define HWLCR __REG(0x4160000C) /* Line Control Register (read/write) */
187#define HWMCR __REG(0x41600010) /* Modem Control Register (read/write) */
188#define HWLSR __REG(0x41600014) /* Line Status Register (read only) */
189#define HWMSR __REG(0x41600018) /* Modem Status Register (read only) */
190#define HWSPR __REG(0x4160001C) /* Scratch Pad Register (read/write) */
191#define HWISR __REG(0x41600020) /* Infrared Selection Register (read/write) */
192#define HWFOR __REG(0x41600024) /* Receive FIFO Occupancy Register (read only) */
193#define HWABR __REG(0x41600028) /* Auto-Baud Control Register (read/write) */
194#define HWACR __REG(0x4160002C) /* Auto-Baud Count Register (read only) */
195#define HWDLL __REG(0x41600000) /* Divisor Latch Low Register (DLAB = 1) (read/write) */
196#define HWDLH __REG(0x41600004) /* Divisor Latch High Register (DLAB = 1) (read/write) */
197
198#define IER_DMAE (1 << 7) /* DMA Requests Enable */
199#define IER_UUE (1 << 6) /* UART Unit Enable */
200#define IER_NRZE (1 << 5) /* NRZ coding Enable */
201#define IER_RTIOE (1 << 4) /* Receiver Time Out Interrupt Enable */
202#define IER_MIE (1 << 3) /* Modem Interrupt Enable */
203#define IER_RLSE (1 << 2) /* Receiver Line Status Interrupt Enable */
204#define IER_TIE (1 << 1) /* Transmit Data request Interrupt Enable */
205#define IER_RAVIE (1 << 0) /* Receiver Data Available Interrupt Enable */
206
207#define IIR_FIFOES1 (1 << 7) /* FIFO Mode Enable Status */
208#define IIR_FIFOES0 (1 << 6) /* FIFO Mode Enable Status */
209#define IIR_TOD (1 << 3) /* Time Out Detected */
210#define IIR_IID2 (1 << 2) /* Interrupt Source Encoded */
211#define IIR_IID1 (1 << 1) /* Interrupt Source Encoded */
212#define IIR_IP (1 << 0) /* Interrupt Pending (active low) */
213
214#define FCR_ITL2 (1 << 7) /* Interrupt Trigger Level */
215#define FCR_ITL1 (1 << 6) /* Interrupt Trigger Level */
216#define FCR_RESETTF (1 << 2) /* Reset Transmitter FIFO */
217#define FCR_RESETRF (1 << 1) /* Reset Receiver FIFO */
218#define FCR_TRFIFOE (1 << 0) /* Transmit and Receive FIFO Enable */
219#define FCR_ITL_1 (0)
220#define FCR_ITL_8 (FCR_ITL1)
221#define FCR_ITL_16 (FCR_ITL2)
222#define FCR_ITL_32 (FCR_ITL2|FCR_ITL1)
223
224#define LCR_DLAB (1 << 7) /* Divisor Latch Access Bit */
225#define LCR_SB (1 << 6) /* Set Break */
226#define LCR_STKYP (1 << 5) /* Sticky Parity */
227#define LCR_EPS (1 << 4) /* Even Parity Select */
228#define LCR_PEN (1 << 3) /* Parity Enable */
229#define LCR_STB (1 << 2) /* Stop Bit */
230#define LCR_WLS1 (1 << 1) /* Word Length Select */
231#define LCR_WLS0 (1 << 0) /* Word Length Select */
232
233#define LSR_FIFOE (1 << 7) /* FIFO Error Status */
234#define LSR_TEMT (1 << 6) /* Transmitter Empty */
235#define LSR_TDRQ (1 << 5) /* Transmit Data Request */
236#define LSR_BI (1 << 4) /* Break Interrupt */
237#define LSR_FE (1 << 3) /* Framing Error */
238#define LSR_PE (1 << 2) /* Parity Error */
239#define LSR_OE (1 << 1) /* Overrun Error */
240#define LSR_DR (1 << 0) /* Data Ready */
241
242#define MCR_LOOP (1 << 4)
243#define MCR_OUT2 (1 << 3) /* force MSR_DCD in loopback mode */
244#define MCR_OUT1 (1 << 2) /* force MSR_RI in loopback mode */
245#define MCR_RTS (1 << 1) /* Request to Send */
246#define MCR_DTR (1 << 0) /* Data Terminal Ready */
247
248#define MSR_DCD (1 << 7) /* Data Carrier Detect */
249#define MSR_RI (1 << 6) /* Ring Indicator */
250#define MSR_DSR (1 << 5) /* Data Set Ready */
251#define MSR_CTS (1 << 4) /* Clear To Send */
252#define MSR_DDCD (1 << 3) /* Delta Data Carrier Detect */
253#define MSR_TERI (1 << 2) /* Trailing Edge Ring Indicator */
254#define MSR_DDSR (1 << 1) /* Delta Data Set Ready */
255#define MSR_DCTS (1 << 0) /* Delta Clear To Send */
256
257/*
258 * IrSR (Infrared Selection Register)
259 */
260#define STISR_RXPL (1 << 4) /* Receive Data Polarity */
261#define STISR_TXPL (1 << 3) /* Transmit Data Polarity */
262#define STISR_XMODE (1 << 2) /* Transmit Pulse Width Select */
263#define STISR_RCVEIR (1 << 1) /* Receiver SIR Enable */
264#define STISR_XMITIR (1 << 0) /* Transmitter SIR Enable */
265
266
267/*
268 * I2C registers - moved into drivers/i2c/busses/i2c-pxa.c
269 */
270
271/*
272 * Serial Audio Controller - moved into sound/soc/pxa/pxa2xx-i2s.c
273 */
274
275/*
276 * AC97 Controller registers
277 */
278
279#define POCR __REG(0x40500000) /* PCM Out Control Register */
280#define POCR_FEIE (1 << 3) /* FIFO Error Interrupt Enable */
281#define POCR_FSRIE (1 << 1) /* FIFO Service Request Interrupt Enable */
282
283#define PICR __REG(0x40500004) /* PCM In Control Register */
284#define PICR_FEIE (1 << 3) /* FIFO Error Interrupt Enable */
285#define PICR_FSRIE (1 << 1) /* FIFO Service Request Interrupt Enable */
286
287#define MCCR __REG(0x40500008) /* Mic In Control Register */
288#define MCCR_FEIE (1 << 3) /* FIFO Error Interrupt Enable */
289#define MCCR_FSRIE (1 << 1) /* FIFO Service Request Interrupt Enable */
290
291#define GCR __REG(0x4050000C) /* Global Control Register */
292#ifdef CONFIG_PXA3xx
293#define GCR_CLKBPB (1 << 31) /* Internal clock enable */
294#endif
295#define GCR_nDMAEN (1 << 24) /* non DMA Enable */
296#define GCR_CDONE_IE (1 << 19) /* Command Done Interrupt Enable */
297#define GCR_SDONE_IE (1 << 18) /* Status Done Interrupt Enable */
298#define GCR_SECRDY_IEN (1 << 9) /* Secondary Ready Interrupt Enable */
299#define GCR_PRIRDY_IEN (1 << 8) /* Primary Ready Interrupt Enable */
300#define GCR_SECRES_IEN (1 << 5) /* Secondary Resume Interrupt Enable */
301#define GCR_PRIRES_IEN (1 << 4) /* Primary Resume Interrupt Enable */
302#define GCR_ACLINK_OFF (1 << 3) /* AC-link Shut Off */
303#define GCR_WARM_RST (1 << 2) /* AC97 Warm Reset */
304#define GCR_COLD_RST (1 << 1) /* AC'97 Cold Reset (0 = active) */
305#define GCR_GIE (1 << 0) /* Codec GPI Interrupt Enable */
306
307#define POSR __REG(0x40500010) /* PCM Out Status Register */
308#define POSR_FIFOE (1 << 4) /* FIFO error */
309#define POSR_FSR (1 << 2) /* FIFO Service Request */
310
311#define PISR __REG(0x40500014) /* PCM In Status Register */
312#define PISR_FIFOE (1 << 4) /* FIFO error */
313#define PISR_EOC (1 << 3) /* DMA End-of-Chain (exclusive clear) */
314#define PISR_FSR (1 << 2) /* FIFO Service Request */
315
316#define MCSR __REG(0x40500018) /* Mic In Status Register */
317#define MCSR_FIFOE (1 << 4) /* FIFO error */
318#define MCSR_EOC (1 << 3) /* DMA End-of-Chain (exclusive clear) */
319#define MCSR_FSR (1 << 2) /* FIFO Service Request */
320
321#define GSR __REG(0x4050001C) /* Global Status Register */
322#define GSR_CDONE (1 << 19) /* Command Done */
323#define GSR_SDONE (1 << 18) /* Status Done */
324#define GSR_RDCS (1 << 15) /* Read Completion Status */
325#define GSR_BIT3SLT12 (1 << 14) /* Bit 3 of slot 12 */
326#define GSR_BIT2SLT12 (1 << 13) /* Bit 2 of slot 12 */
327#define GSR_BIT1SLT12 (1 << 12) /* Bit 1 of slot 12 */
328#define GSR_SECRES (1 << 11) /* Secondary Resume Interrupt */
329#define GSR_PRIRES (1 << 10) /* Primary Resume Interrupt */
330#define GSR_SCR (1 << 9) /* Secondary Codec Ready */
331#define GSR_PCR (1 << 8) /* Primary Codec Ready */
332#define GSR_MCINT (1 << 7) /* Mic In Interrupt */
333#define GSR_POINT (1 << 6) /* PCM Out Interrupt */
334#define GSR_PIINT (1 << 5) /* PCM In Interrupt */
335#define GSR_ACOFFD (1 << 3) /* AC-link Shut Off Done */
336#define GSR_MOINT (1 << 2) /* Modem Out Interrupt */
337#define GSR_MIINT (1 << 1) /* Modem In Interrupt */
338#define GSR_GSCI (1 << 0) /* Codec GPI Status Change Interrupt */
339
340#define CAR __REG(0x40500020) /* CODEC Access Register */
341#define CAR_CAIP (1 << 0) /* Codec Access In Progress */
342
343#define PCDR __REG(0x40500040) /* PCM FIFO Data Register */
344#define MCDR __REG(0x40500060) /* Mic-in FIFO Data Register */
345
346#define MOCR __REG(0x40500100) /* Modem Out Control Register */
347#define MOCR_FEIE (1 << 3) /* FIFO Error */
348#define MOCR_FSRIE (1 << 1) /* FIFO Service Request Interrupt Enable */
349
350#define MICR __REG(0x40500108) /* Modem In Control Register */
351#define MICR_FEIE (1 << 3) /* FIFO Error */
352#define MICR_FSRIE (1 << 1) /* FIFO Service Request Interrupt Enable */
353
354#define MOSR __REG(0x40500110) /* Modem Out Status Register */
355#define MOSR_FIFOE (1 << 4) /* FIFO error */
356#define MOSR_FSR (1 << 2) /* FIFO Service Request */
357
358#define MISR __REG(0x40500118) /* Modem In Status Register */
359#define MISR_FIFOE (1 << 4) /* FIFO error */
360#define MISR_EOC (1 << 3) /* DMA End-of-Chain (exclusive clear) */
361#define MISR_FSR (1 << 2) /* FIFO Service Request */
362
363#define MODR __REG(0x40500140) /* Modem FIFO Data Register */
364
365#define PAC_REG_BASE __REG(0x40500200) /* Primary Audio Codec */
366#define SAC_REG_BASE __REG(0x40500300) /* Secondary Audio Codec */
367#define PMC_REG_BASE __REG(0x40500400) /* Primary Modem Codec */
368#define SMC_REG_BASE __REG(0x40500500) /* Secondary Modem Codec */
369
370
371/*
372 * Fast Infrared Communication Port
373 */
374
375#define FICP __REG(0x40800000) /* Start of FICP area */
376#define ICCR0 __REG(0x40800000) /* ICP Control Register 0 */
377#define ICCR1 __REG(0x40800004) /* ICP Control Register 1 */
378#define ICCR2 __REG(0x40800008) /* ICP Control Register 2 */
379#define ICDR __REG(0x4080000c) /* ICP Data Register */
380#define ICSR0 __REG(0x40800014) /* ICP Status Register 0 */
381#define ICSR1 __REG(0x40800018) /* ICP Status Register 1 */
382
383#define ICCR0_AME (1 << 7) /* Address match enable */
384#define ICCR0_TIE (1 << 6) /* Transmit FIFO interrupt enable */
385#define ICCR0_RIE (1 << 5) /* Recieve FIFO interrupt enable */
386#define ICCR0_RXE (1 << 4) /* Receive enable */
387#define ICCR0_TXE (1 << 3) /* Transmit enable */
388#define ICCR0_TUS (1 << 2) /* Transmit FIFO underrun select */
389#define ICCR0_LBM (1 << 1) /* Loopback mode */
390#define ICCR0_ITR (1 << 0) /* IrDA transmission */
391
392#define ICCR2_RXP (1 << 3) /* Receive Pin Polarity select */
393#define ICCR2_TXP (1 << 2) /* Transmit Pin Polarity select */
394#define ICCR2_TRIG (3 << 0) /* Receive FIFO Trigger threshold */
395#define ICCR2_TRIG_8 (0 << 0) /* >= 8 bytes */
396#define ICCR2_TRIG_16 (1 << 0) /* >= 16 bytes */
397#define ICCR2_TRIG_32 (2 << 0) /* >= 32 bytes */
398
399#ifdef CONFIG_PXA27x
400#define ICSR0_EOC (1 << 6) /* DMA End of Descriptor Chain */
401#endif
402#define ICSR0_FRE (1 << 5) /* Framing error */
403#define ICSR0_RFS (1 << 4) /* Receive FIFO service request */
404#define ICSR0_TFS (1 << 3) /* Transnit FIFO service request */
405#define ICSR0_RAB (1 << 2) /* Receiver abort */
406#define ICSR0_TUR (1 << 1) /* Trunsmit FIFO underun */
407#define ICSR0_EIF (1 << 0) /* End/Error in FIFO */
408
409#define ICSR1_ROR (1 << 6) /* Receiver FIFO underrun */
410#define ICSR1_CRE (1 << 5) /* CRC error */
411#define ICSR1_EOF (1 << 4) /* End of frame */
412#define ICSR1_TNF (1 << 3) /* Transmit FIFO not full */
413#define ICSR1_RNE (1 << 2) /* Receive FIFO not empty */
414#define ICSR1_TBY (1 << 1) /* Tramsmiter busy flag */
415#define ICSR1_RSY (1 << 0) /* Recevier synchronized flag */
416
417
418/* 127/*
419 * Real Time Clock 128 * Real Time Clock
420 */ 129 */
@@ -463,19 +172,6 @@
463 172
464 173
465/* 174/*
466 * Pulse Width Modulator
467 */
468
469#define PWM_CTRL0 __REG(0x40B00000) /* PWM 0 Control Register */
470#define PWM_PWDUTY0 __REG(0x40B00004) /* PWM 0 Duty Cycle Register */
471#define PWM_PERVAL0 __REG(0x40B00008) /* PWM 0 Period Control Register */
472
473#define PWM_CTRL1 __REG(0x40C00000) /* PWM 1Control Register */
474#define PWM_PWDUTY1 __REG(0x40C00004) /* PWM 1 Duty Cycle Register */
475#define PWM_PERVAL1 __REG(0x40C00008) /* PWM 1 Period Control Register */
476
477
478/*
479 * Interrupt Controller 175 * Interrupt Controller
480 */ 176 */
481 177
@@ -496,19 +192,6 @@
496 * General Purpose I/O 192 * General Purpose I/O
497 */ 193 */
498 194
499#define GPIO0_BASE ((void __iomem *)io_p2v(0x40E00000))
500#define GPIO1_BASE ((void __iomem *)io_p2v(0x40E00004))
501#define GPIO2_BASE ((void __iomem *)io_p2v(0x40E00008))
502#define GPIO3_BASE ((void __iomem *)io_p2v(0x40E00100))
503
504#define GPLR_OFFSET 0x00
505#define GPDR_OFFSET 0x0C
506#define GPSR_OFFSET 0x18
507#define GPCR_OFFSET 0x24
508#define GRER_OFFSET 0x30
509#define GFER_OFFSET 0x3C
510#define GEDR_OFFSET 0x48
511
512#define GPLR0 __REG(0x40E00000) /* GPIO Pin-Level Register GPIO<31:0> */ 195#define GPLR0 __REG(0x40E00000) /* GPIO Pin-Level Register GPIO<31:0> */
513#define GPLR1 __REG(0x40E00004) /* GPIO Pin-Level Register GPIO<63:32> */ 196#define GPLR1 __REG(0x40E00004) /* GPIO Pin-Level Register GPIO<63:32> */
514#define GPLR2 __REG(0x40E00008) /* GPIO Pin-Level Register GPIO<80:64> */ 197#define GPLR2 __REG(0x40E00008) /* GPIO Pin-Level Register GPIO<80:64> */
@@ -558,10 +241,6 @@
558 241
559#define GPIO_bit(x) (1 << ((x) & 0x1f)) 242#define GPIO_bit(x) (1 << ((x) & 0x1f))
560 243
561#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
562
563/* Interrupt Controller */
564
565#define _GPLR(x) __REG2(0x40E00000, ((x) & 0x60) >> 3) 244#define _GPLR(x) __REG2(0x40E00000, ((x) & 0x60) >> 3)
566#define _GPDR(x) __REG2(0x40E0000C, ((x) & 0x60) >> 3) 245#define _GPDR(x) __REG2(0x40E0000C, ((x) & 0x60) >> 3)
567#define _GPSR(x) __REG2(0x40E00018, ((x) & 0x60) >> 3) 246#define _GPSR(x) __REG2(0x40E00018, ((x) & 0x60) >> 3)
@@ -580,189 +259,5 @@
580#define GEDR(x) (*((((x) & 0x7f) < 96) ? &_GEDR(x) : &GEDR3)) 259#define GEDR(x) (*((((x) & 0x7f) < 96) ? &_GEDR(x) : &GEDR3))
581#define GAFR(x) (*((((x) & 0x7f) < 96) ? &_GAFR(x) : \ 260#define GAFR(x) (*((((x) & 0x7f) < 96) ? &_GAFR(x) : \
582 ((((x) & 0x7f) < 112) ? &GAFR3_L : &GAFR3_U))) 261 ((((x) & 0x7f) < 112) ? &GAFR3_L : &GAFR3_U)))
583#else
584
585#define GPLR(x) __REG2(0x40E00000, ((x) & 0x60) >> 3)
586#define GPDR(x) __REG2(0x40E0000C, ((x) & 0x60) >> 3)
587#define GPSR(x) __REG2(0x40E00018, ((x) & 0x60) >> 3)
588#define GPCR(x) __REG2(0x40E00024, ((x) & 0x60) >> 3)
589#define GRER(x) __REG2(0x40E00030, ((x) & 0x60) >> 3)
590#define GFER(x) __REG2(0x40E0003C, ((x) & 0x60) >> 3)
591#define GEDR(x) __REG2(0x40E00048, ((x) & 0x60) >> 3)
592#define GAFR(x) __REG2(0x40E00054, ((x) & 0x70) >> 2)
593
594#endif
595
596/*
597 * Power Manager - see pxa2xx-regs.h
598 */
599
600/*
601 * SSP Serial Port Registers - see arch/arm/mach-pxa/include/mach/regs-ssp.h
602 */
603
604/*
605 * MultiMediaCard (MMC) controller - see drivers/mmc/host/pxamci.h
606 */
607
608/*
609 * Core Clock - see arch/arm/mach-pxa/include/mach/pxa2xx-regs.h
610 */
611
612#ifdef CONFIG_PXA27x
613
614/* Camera Interface */
615#define CICR0 __REG(0x50000000)
616#define CICR1 __REG(0x50000004)
617#define CICR2 __REG(0x50000008)
618#define CICR3 __REG(0x5000000C)
619#define CICR4 __REG(0x50000010)
620#define CISR __REG(0x50000014)
621#define CIFR __REG(0x50000018)
622#define CITOR __REG(0x5000001C)
623#define CIBR0 __REG(0x50000028)
624#define CIBR1 __REG(0x50000030)
625#define CIBR2 __REG(0x50000038)
626
627#define CICR0_DMAEN (1 << 31) /* DMA request enable */
628#define CICR0_PAR_EN (1 << 30) /* Parity enable */
629#define CICR0_SL_CAP_EN (1 << 29) /* Capture enable for slave mode */
630#define CICR0_ENB (1 << 28) /* Camera interface enable */
631#define CICR0_DIS (1 << 27) /* Camera interface disable */
632#define CICR0_SIM (0x7 << 24) /* Sensor interface mode mask */
633#define CICR0_TOM (1 << 9) /* Time-out mask */
634#define CICR0_RDAVM (1 << 8) /* Receive-data-available mask */
635#define CICR0_FEM (1 << 7) /* FIFO-empty mask */
636#define CICR0_EOLM (1 << 6) /* End-of-line mask */
637#define CICR0_PERRM (1 << 5) /* Parity-error mask */
638#define CICR0_QDM (1 << 4) /* Quick-disable mask */
639#define CICR0_CDM (1 << 3) /* Disable-done mask */
640#define CICR0_SOFM (1 << 2) /* Start-of-frame mask */
641#define CICR0_EOFM (1 << 1) /* End-of-frame mask */
642#define CICR0_FOM (1 << 0) /* FIFO-overrun mask */
643
644#define CICR1_TBIT (1 << 31) /* Transparency bit */
645#define CICR1_RGBT_CONV (0x3 << 29) /* RGBT conversion mask */
646#define CICR1_PPL (0x7ff << 15) /* Pixels per line mask */
647#define CICR1_RGB_CONV (0x7 << 12) /* RGB conversion mask */
648#define CICR1_RGB_F (1 << 11) /* RGB format */
649#define CICR1_YCBCR_F (1 << 10) /* YCbCr format */
650#define CICR1_RGB_BPP (0x7 << 7) /* RGB bis per pixel mask */
651#define CICR1_RAW_BPP (0x3 << 5) /* Raw bis per pixel mask */
652#define CICR1_COLOR_SP (0x3 << 3) /* Color space mask */
653#define CICR1_DW (0x7 << 0) /* Data width mask */
654
655#define CICR2_BLW (0xff << 24) /* Beginning-of-line pixel clock
656 wait count mask */
657#define CICR2_ELW (0xff << 16) /* End-of-line pixel clock
658 wait count mask */
659#define CICR2_HSW (0x3f << 10) /* Horizontal sync pulse width mask */
660#define CICR2_BFPW (0x3f << 3) /* Beginning-of-frame pixel clock
661 wait count mask */
662#define CICR2_FSW (0x7 << 0) /* Frame stabilization
663 wait count mask */
664
665#define CICR3_BFW (0xff << 24) /* Beginning-of-frame line clock
666 wait count mask */
667#define CICR3_EFW (0xff << 16) /* End-of-frame line clock
668 wait count mask */
669#define CICR3_VSW (0x3f << 10) /* Vertical sync pulse width mask */
670#define CICR3_BFPW (0x3f << 3) /* Beginning-of-frame pixel clock
671 wait count mask */
672#define CICR3_LPF (0x7ff << 0) /* Lines per frame mask */
673
674#define CICR4_MCLK_DLY (0x3 << 24) /* MCLK Data Capture Delay mask */
675#define CICR4_PCLK_EN (1 << 23) /* Pixel clock enable */
676#define CICR4_PCP (1 << 22) /* Pixel clock polarity */
677#define CICR4_HSP (1 << 21) /* Horizontal sync polarity */
678#define CICR4_VSP (1 << 20) /* Vertical sync polarity */
679#define CICR4_MCLK_EN (1 << 19) /* MCLK enable */
680#define CICR4_FR_RATE (0x7 << 8) /* Frame rate mask */
681#define CICR4_DIV (0xff << 0) /* Clock divisor mask */
682
683#define CISR_FTO (1 << 15) /* FIFO time-out */
684#define CISR_RDAV_2 (1 << 14) /* Channel 2 receive data available */
685#define CISR_RDAV_1 (1 << 13) /* Channel 1 receive data available */
686#define CISR_RDAV_0 (1 << 12) /* Channel 0 receive data available */
687#define CISR_FEMPTY_2 (1 << 11) /* Channel 2 FIFO empty */
688#define CISR_FEMPTY_1 (1 << 10) /* Channel 1 FIFO empty */
689#define CISR_FEMPTY_0 (1 << 9) /* Channel 0 FIFO empty */
690#define CISR_EOL (1 << 8) /* End of line */
691#define CISR_PAR_ERR (1 << 7) /* Parity error */
692#define CISR_CQD (1 << 6) /* Camera interface quick disable */
693#define CISR_CDD (1 << 5) /* Camera interface disable done */
694#define CISR_SOF (1 << 4) /* Start of frame */
695#define CISR_EOF (1 << 3) /* End of frame */
696#define CISR_IFO_2 (1 << 2) /* FIFO overrun for Channel 2 */
697#define CISR_IFO_1 (1 << 1) /* FIFO overrun for Channel 1 */
698#define CISR_IFO_0 (1 << 0) /* FIFO overrun for Channel 0 */
699
700#define CIFR_FLVL2 (0x7f << 23) /* FIFO 2 level mask */
701#define CIFR_FLVL1 (0x7f << 16) /* FIFO 1 level mask */
702#define CIFR_FLVL0 (0xff << 8) /* FIFO 0 level mask */
703#define CIFR_THL_0 (0x3 << 4) /* Threshold Level for Channel 0 FIFO */
704#define CIFR_RESET_F (1 << 3) /* Reset input FIFOs */
705#define CIFR_FEN2 (1 << 2) /* FIFO enable for channel 2 */
706#define CIFR_FEN1 (1 << 1) /* FIFO enable for channel 1 */
707#define CIFR_FEN0 (1 << 0) /* FIFO enable for channel 0 */
708
709#define SRAM_SIZE 0x40000 /* 4x64K */
710
711#define SRAM_MEM_PHYS 0x5C000000
712
713#define IMPMCR __REG(0x58000000) /* IM Power Management Control Reg */
714#define IMPMSR __REG(0x58000008) /* IM Power Management Status Reg */
715
716#define IMPMCR_PC3 (0x3 << 22) /* Bank 3 Power Control */
717#define IMPMCR_PC3_RUN_MODE (0x0 << 22) /* Run mode */
718#define IMPMCR_PC3_STANDBY_MODE (0x1 << 22) /* Standby mode */
719#define IMPMCR_PC3_AUTO_MODE (0x3 << 22) /* Automatically controlled */
720
721#define IMPMCR_PC2 (0x3 << 20) /* Bank 2 Power Control */
722#define IMPMCR_PC2_RUN_MODE (0x0 << 20) /* Run mode */
723#define IMPMCR_PC2_STANDBY_MODE (0x1 << 20) /* Standby mode */
724#define IMPMCR_PC2_AUTO_MODE (0x3 << 20) /* Automatically controlled */
725
726#define IMPMCR_PC1 (0x3 << 18) /* Bank 1 Power Control */
727#define IMPMCR_PC1_RUN_MODE (0x0 << 18) /* Run mode */
728#define IMPMCR_PC1_STANDBY_MODE (0x1 << 18) /* Standby mode */
729#define IMPMCR_PC1_AUTO_MODE (0x3 << 18) /* Automatically controlled */
730
731#define IMPMCR_PC0 (0x3 << 16) /* Bank 0 Power Control */
732#define IMPMCR_PC0_RUN_MODE (0x0 << 16) /* Run mode */
733#define IMPMCR_PC0_STANDBY_MODE (0x1 << 16) /* Standby mode */
734#define IMPMCR_PC0_AUTO_MODE (0x3 << 16) /* Automatically controlled */
735
736#define IMPMCR_AW3 (1 << 11) /* Bank 3 Automatic Wake-up enable */
737#define IMPMCR_AW2 (1 << 10) /* Bank 2 Automatic Wake-up enable */
738#define IMPMCR_AW1 (1 << 9) /* Bank 1 Automatic Wake-up enable */
739#define IMPMCR_AW0 (1 << 8) /* Bank 0 Automatic Wake-up enable */
740
741#define IMPMCR_DST (0xFF << 0) /* Delay Standby Time, ms */
742
743#define IMPMSR_PS3 (0x3 << 6) /* Bank 3 Power Status: */
744#define IMPMSR_PS3_RUN_MODE (0x0 << 6) /* Run mode */
745#define IMPMSR_PS3_STANDBY_MODE (0x1 << 6) /* Standby mode */
746
747#define IMPMSR_PS2 (0x3 << 4) /* Bank 2 Power Status: */
748#define IMPMSR_PS2_RUN_MODE (0x0 << 4) /* Run mode */
749#define IMPMSR_PS2_STANDBY_MODE (0x1 << 4) /* Standby mode */
750
751#define IMPMSR_PS1 (0x3 << 2) /* Bank 1 Power Status: */
752#define IMPMSR_PS1_RUN_MODE (0x0 << 2) /* Run mode */
753#define IMPMSR_PS1_STANDBY_MODE (0x1 << 2) /* Standby mode */
754
755#define IMPMSR_PS0 (0x3 << 0) /* Bank 0 Power Status: */
756#define IMPMSR_PS0_RUN_MODE (0x0 << 0) /* Run mode */
757#define IMPMSR_PS0_STANDBY_MODE (0x1 << 0) /* Standby mode */
758
759#endif
760
761/* PWRMODE register M field values */
762
763#define PWRMODE_IDLE 0x1
764#define PWRMODE_STANDBY 0x2
765#define PWRMODE_SLEEP 0x3
766#define PWRMODE_DEEPSLEEP 0x7
767 262
768#endif 263#endif
diff --git a/arch/arm/mach-pxa/include/mach/pxa2xx-gpio.h b/arch/arm/mach-pxa/include/mach/pxa2xx-gpio.h
index 6ef1dd09970b..d83393e25273 100644
--- a/arch/arm/mach-pxa/include/mach/pxa2xx-gpio.h
+++ b/arch/arm/mach-pxa/include/mach/pxa2xx-gpio.h
@@ -365,4 +365,9 @@
365#define GPIO117_I2CSCL_MD (117 | GPIO_ALT_FN_1_IN) 365#define GPIO117_I2CSCL_MD (117 | GPIO_ALT_FN_1_IN)
366#define GPIO118_I2CSDA_MD (118 | GPIO_ALT_FN_1_IN) 366#define GPIO118_I2CSDA_MD (118 | GPIO_ALT_FN_1_IN)
367 367
368/*
369 * Handy routine to set GPIO alternate functions
370 */
371extern int pxa_gpio_mode( int gpio_mode );
372
368#endif /* __ASM_ARCH_PXA2XX_GPIO_H */ 373#endif /* __ASM_ARCH_PXA2XX_GPIO_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxa2xx-regs.h b/arch/arm/mach-pxa/include/mach/pxa2xx-regs.h
index 806ecfea44bf..77102d695cc7 100644
--- a/arch/arm/mach-pxa/include/mach/pxa2xx-regs.h
+++ b/arch/arm/mach-pxa/include/mach/pxa2xx-regs.h
@@ -49,6 +49,11 @@
49#define MECR_NOS (1 << 0) /* Number Of Sockets: 0 -> 1 sock, 1 -> 2 sock */ 49#define MECR_NOS (1 << 0) /* Number Of Sockets: 0 -> 1 sock, 1 -> 2 sock */
50#define MECR_CIT (1 << 1) /* Card Is There: 0 -> no card, 1 -> card inserted */ 50#define MECR_CIT (1 << 1) /* Card Is There: 0 -> no card, 1 -> card inserted */
51 51
52#define MDCNFG_DE0 (1 << 0) /* SDRAM Bank 0 Enable */
53#define MDCNFG_DE1 (1 << 1) /* SDRAM Bank 1 Enable */
54#define MDCNFG_DE2 (1 << 16) /* SDRAM Bank 2 Enable */
55#define MDCNFG_DE3 (1 << 17) /* SDRAM Bank 3 Enable */
56
52#define MDREFR_K0DB4 (1 << 29) /* SDCLK0 Divide by 4 Control/Status */ 57#define MDREFR_K0DB4 (1 << 29) /* SDCLK0 Divide by 4 Control/Status */
53#define MDREFR_K2FREE (1 << 25) /* SDRAM Free-Running Control */ 58#define MDREFR_K2FREE (1 << 25) /* SDRAM Free-Running Control */
54#define MDREFR_K1FREE (1 << 24) /* SDRAM Free-Running Control */ 59#define MDREFR_K1FREE (1 << 24) /* SDRAM Free-Running Control */
@@ -243,4 +248,11 @@
243#define OSCC_OON (1 << 1) /* 32.768kHz OON (write-once only bit) */ 248#define OSCC_OON (1 << 1) /* 32.768kHz OON (write-once only bit) */
244#define OSCC_OOK (1 << 0) /* 32.768kHz OOK (read-only bit) */ 249#define OSCC_OOK (1 << 0) /* 32.768kHz OOK (read-only bit) */
245 250
251/* PWRMODE register M field values */
252
253#define PWRMODE_IDLE 0x1
254#define PWRMODE_STANDBY 0x2
255#define PWRMODE_SLEEP 0x3
256#define PWRMODE_DEEPSLEEP 0x7
257
246#endif 258#endif
diff --git a/arch/arm/mach-pxa/include/mach/pxafb.h b/arch/arm/mach-pxa/include/mach/pxafb.h
index cbda4d35c421..6932720ba04e 100644
--- a/arch/arm/mach-pxa/include/mach/pxafb.h
+++ b/arch/arm/mach-pxa/include/mach/pxafb.h
@@ -48,6 +48,7 @@
48#define LCD_MONO_DSTN_8BPP ((8 << 4) | LCD_TYPE_MONO_DSTN) 48#define LCD_MONO_DSTN_8BPP ((8 << 4) | LCD_TYPE_MONO_DSTN)
49#define LCD_COLOR_STN_8BPP ((8 << 4) | LCD_TYPE_COLOR_STN) 49#define LCD_COLOR_STN_8BPP ((8 << 4) | LCD_TYPE_COLOR_STN)
50#define LCD_COLOR_DSTN_16BPP ((16 << 4) | LCD_TYPE_COLOR_DSTN) 50#define LCD_COLOR_DSTN_16BPP ((16 << 4) | LCD_TYPE_COLOR_DSTN)
51#define LCD_COLOR_TFT_8BPP ((8 << 4) | LCD_TYPE_COLOR_TFT)
51#define LCD_COLOR_TFT_16BPP ((16 << 4) | LCD_TYPE_COLOR_TFT) 52#define LCD_COLOR_TFT_16BPP ((16 << 4) | LCD_TYPE_COLOR_TFT)
52#define LCD_COLOR_TFT_18BPP ((18 << 4) | LCD_TYPE_COLOR_TFT) 53#define LCD_COLOR_TFT_18BPP ((18 << 4) | LCD_TYPE_COLOR_TFT)
53#define LCD_SMART_PANEL_8BPP ((8 << 4) | LCD_TYPE_SMART_PANEL) 54#define LCD_SMART_PANEL_8BPP ((8 << 4) | LCD_TYPE_SMART_PANEL)
@@ -94,6 +95,10 @@ struct pxafb_mode_info {
94 * in pxa27x and pxa3xx, initialize them to the same value or 95 * in pxa27x and pxa3xx, initialize them to the same value or
95 * the larger one will be used 96 * the larger one will be used
96 * 3. same to {rd,wr}_pulse_width 97 * 3. same to {rd,wr}_pulse_width
98 *
99 * 4. LCD_PCLK_EDGE_{RISE,FALL} controls the L_PCLK_WR polarity
100 * 5. sync & FB_SYNC_HOR_HIGH_ACT controls the L_LCLK_A0
101 * 6. sync & FB_SYNC_VERT_HIGH_ACT controls the L_LCLK_RD
97 */ 102 */
98 unsigned a0csrd_set_hld; /* A0 and CS Setup/Hold Time before/after L_FCLK_RD */ 103 unsigned a0csrd_set_hld; /* A0 and CS Setup/Hold Time before/after L_FCLK_RD */
99 unsigned a0cswr_set_hld; /* A0 and CS Setup/Hold Time before/after L_PCLK_WR */ 104 unsigned a0cswr_set_hld; /* A0 and CS Setup/Hold Time before/after L_PCLK_WR */
@@ -108,6 +113,7 @@ struct pxafb_mach_info {
108 unsigned int num_modes; 113 unsigned int num_modes;
109 114
110 unsigned int lcd_conn; 115 unsigned int lcd_conn;
116 unsigned long video_mem_size;
111 117
112 u_int fixed_modes:1, 118 u_int fixed_modes:1,
113 cmap_inverse:1, 119 cmap_inverse:1,
diff --git a/arch/arm/mach-pxa/include/mach/regs-ac97.h b/arch/arm/mach-pxa/include/mach/regs-ac97.h
new file mode 100644
index 000000000000..e41b9d202b8c
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/regs-ac97.h
@@ -0,0 +1,99 @@
1#ifndef __ASM_ARCH_REGS_AC97_H
2#define __ASM_ARCH_REGS_AC97_H
3
4/*
5 * AC97 Controller registers
6 */
7
8#define POCR __REG(0x40500000) /* PCM Out Control Register */
9#define POCR_FEIE (1 << 3) /* FIFO Error Interrupt Enable */
10#define POCR_FSRIE (1 << 1) /* FIFO Service Request Interrupt Enable */
11
12#define PICR __REG(0x40500004) /* PCM In Control Register */
13#define PICR_FEIE (1 << 3) /* FIFO Error Interrupt Enable */
14#define PICR_FSRIE (1 << 1) /* FIFO Service Request Interrupt Enable */
15
16#define MCCR __REG(0x40500008) /* Mic In Control Register */
17#define MCCR_FEIE (1 << 3) /* FIFO Error Interrupt Enable */
18#define MCCR_FSRIE (1 << 1) /* FIFO Service Request Interrupt Enable */
19
20#define GCR __REG(0x4050000C) /* Global Control Register */
21#ifdef CONFIG_PXA3xx
22#define GCR_CLKBPB (1 << 31) /* Internal clock enable */
23#endif
24#define GCR_nDMAEN (1 << 24) /* non DMA Enable */
25#define GCR_CDONE_IE (1 << 19) /* Command Done Interrupt Enable */
26#define GCR_SDONE_IE (1 << 18) /* Status Done Interrupt Enable */
27#define GCR_SECRDY_IEN (1 << 9) /* Secondary Ready Interrupt Enable */
28#define GCR_PRIRDY_IEN (1 << 8) /* Primary Ready Interrupt Enable */
29#define GCR_SECRES_IEN (1 << 5) /* Secondary Resume Interrupt Enable */
30#define GCR_PRIRES_IEN (1 << 4) /* Primary Resume Interrupt Enable */
31#define GCR_ACLINK_OFF (1 << 3) /* AC-link Shut Off */
32#define GCR_WARM_RST (1 << 2) /* AC97 Warm Reset */
33#define GCR_COLD_RST (1 << 1) /* AC'97 Cold Reset (0 = active) */
34#define GCR_GIE (1 << 0) /* Codec GPI Interrupt Enable */
35
36#define POSR __REG(0x40500010) /* PCM Out Status Register */
37#define POSR_FIFOE (1 << 4) /* FIFO error */
38#define POSR_FSR (1 << 2) /* FIFO Service Request */
39
40#define PISR __REG(0x40500014) /* PCM In Status Register */
41#define PISR_FIFOE (1 << 4) /* FIFO error */
42#define PISR_EOC (1 << 3) /* DMA End-of-Chain (exclusive clear) */
43#define PISR_FSR (1 << 2) /* FIFO Service Request */
44
45#define MCSR __REG(0x40500018) /* Mic In Status Register */
46#define MCSR_FIFOE (1 << 4) /* FIFO error */
47#define MCSR_EOC (1 << 3) /* DMA End-of-Chain (exclusive clear) */
48#define MCSR_FSR (1 << 2) /* FIFO Service Request */
49
50#define GSR __REG(0x4050001C) /* Global Status Register */
51#define GSR_CDONE (1 << 19) /* Command Done */
52#define GSR_SDONE (1 << 18) /* Status Done */
53#define GSR_RDCS (1 << 15) /* Read Completion Status */
54#define GSR_BIT3SLT12 (1 << 14) /* Bit 3 of slot 12 */
55#define GSR_BIT2SLT12 (1 << 13) /* Bit 2 of slot 12 */
56#define GSR_BIT1SLT12 (1 << 12) /* Bit 1 of slot 12 */
57#define GSR_SECRES (1 << 11) /* Secondary Resume Interrupt */
58#define GSR_PRIRES (1 << 10) /* Primary Resume Interrupt */
59#define GSR_SCR (1 << 9) /* Secondary Codec Ready */
60#define GSR_PCR (1 << 8) /* Primary Codec Ready */
61#define GSR_MCINT (1 << 7) /* Mic In Interrupt */
62#define GSR_POINT (1 << 6) /* PCM Out Interrupt */
63#define GSR_PIINT (1 << 5) /* PCM In Interrupt */
64#define GSR_ACOFFD (1 << 3) /* AC-link Shut Off Done */
65#define GSR_MOINT (1 << 2) /* Modem Out Interrupt */
66#define GSR_MIINT (1 << 1) /* Modem In Interrupt */
67#define GSR_GSCI (1 << 0) /* Codec GPI Status Change Interrupt */
68
69#define CAR __REG(0x40500020) /* CODEC Access Register */
70#define CAR_CAIP (1 << 0) /* Codec Access In Progress */
71
72#define PCDR __REG(0x40500040) /* PCM FIFO Data Register */
73#define MCDR __REG(0x40500060) /* Mic-in FIFO Data Register */
74
75#define MOCR __REG(0x40500100) /* Modem Out Control Register */
76#define MOCR_FEIE (1 << 3) /* FIFO Error */
77#define MOCR_FSRIE (1 << 1) /* FIFO Service Request Interrupt Enable */
78
79#define MICR __REG(0x40500108) /* Modem In Control Register */
80#define MICR_FEIE (1 << 3) /* FIFO Error */
81#define MICR_FSRIE (1 << 1) /* FIFO Service Request Interrupt Enable */
82
83#define MOSR __REG(0x40500110) /* Modem Out Status Register */
84#define MOSR_FIFOE (1 << 4) /* FIFO error */
85#define MOSR_FSR (1 << 2) /* FIFO Service Request */
86
87#define MISR __REG(0x40500118) /* Modem In Status Register */
88#define MISR_FIFOE (1 << 4) /* FIFO error */
89#define MISR_EOC (1 << 3) /* DMA End-of-Chain (exclusive clear) */
90#define MISR_FSR (1 << 2) /* FIFO Service Request */
91
92#define MODR __REG(0x40500140) /* Modem FIFO Data Register */
93
94#define PAC_REG_BASE __REG(0x40500200) /* Primary Audio Codec */
95#define SAC_REG_BASE __REG(0x40500300) /* Secondary Audio Codec */
96#define PMC_REG_BASE __REG(0x40500400) /* Primary Modem Codec */
97#define SMC_REG_BASE __REG(0x40500500) /* Secondary Modem Codec */
98
99#endif /* __ASM_ARCH_REGS_AC97_H */
diff --git a/arch/arm/mach-pxa/include/mach/regs-lcd.h b/arch/arm/mach-pxa/include/mach/regs-lcd.h
index c689c4ea769c..f82dcea792d9 100644
--- a/arch/arm/mach-pxa/include/mach/regs-lcd.h
+++ b/arch/arm/mach-pxa/include/mach/regs-lcd.h
@@ -12,27 +12,29 @@
12#define LCCR3 (0x00C) /* LCD Controller Control Register 3 */ 12#define LCCR3 (0x00C) /* LCD Controller Control Register 3 */
13#define LCCR4 (0x010) /* LCD Controller Control Register 4 */ 13#define LCCR4 (0x010) /* LCD Controller Control Register 4 */
14#define LCCR5 (0x014) /* LCD Controller Control Register 5 */ 14#define LCCR5 (0x014) /* LCD Controller Control Register 5 */
15#define DFBR0 (0x020) /* DMA Channel 0 Frame Branch Register */ 15#define LCSR (0x038) /* LCD Controller Status Register 0 */
16#define DFBR1 (0x024) /* DMA Channel 1 Frame Branch Register */ 16#define LCSR1 (0x034) /* LCD Controller Status Register 1 */
17#define LCSR (0x038) /* LCD Controller Status Register */
18#define LIIDR (0x03C) /* LCD Controller Interrupt ID Register */ 17#define LIIDR (0x03C) /* LCD Controller Interrupt ID Register */
19#define TMEDRGBR (0x040) /* TMED RGB Seed Register */ 18#define TMEDRGBR (0x040) /* TMED RGB Seed Register */
20#define TMEDCR (0x044) /* TMED Control Register */ 19#define TMEDCR (0x044) /* TMED Control Register */
21 20
21#define FBR0 (0x020) /* DMA Channel 0 Frame Branch Register */
22#define FBR1 (0x024) /* DMA Channel 1 Frame Branch Register */
23#define FBR2 (0x028) /* DMA Channel 2 Frame Branch Register */
24#define FBR3 (0x02C) /* DMA Channel 2 Frame Branch Register */
25#define FBR4 (0x030) /* DMA Channel 2 Frame Branch Register */
26#define FBR5 (0x110) /* DMA Channel 2 Frame Branch Register */
27#define FBR6 (0x114) /* DMA Channel 2 Frame Branch Register */
28
29#define OVL1C1 (0x050) /* Overlay 1 Control Register 1 */
30#define OVL1C2 (0x060) /* Overlay 1 Control Register 2 */
31#define OVL2C1 (0x070) /* Overlay 2 Control Register 1 */
32#define OVL2C2 (0x080) /* Overlay 2 Control Register 2 */
33
22#define CMDCR (0x100) /* Command Control Register */ 34#define CMDCR (0x100) /* Command Control Register */
23#define PRSR (0x104) /* Panel Read Status Register */ 35#define PRSR (0x104) /* Panel Read Status Register */
24 36
25#define LCCR3_1BPP (0 << 24) 37#define LCCR3_BPP(x) ((((x) & 0x7) << 24) | (((x) & 0x8) ? (1 << 29) : 0))
26#define LCCR3_2BPP (1 << 24)
27#define LCCR3_4BPP (2 << 24)
28#define LCCR3_8BPP (3 << 24)
29#define LCCR3_16BPP (4 << 24)
30#define LCCR3_18BPP (5 << 24)
31#define LCCR3_18BPP_P (6 << 24)
32#define LCCR3_19BPP (7 << 24)
33#define LCCR3_19BPP_P (1 << 29)
34#define LCCR3_24BPP ((1 << 29) | (1 << 24))
35#define LCCR3_25BPP ((1 << 29) | (2 << 24))
36 38
37#define LCCR3_PDFOR_0 (0 << 30) 39#define LCCR3_PDFOR_0 (0 << 30)
38#define LCCR3_PDFOR_1 (1 << 30) 40#define LCCR3_PDFOR_1 (1 << 30)
@@ -42,19 +44,16 @@
42#define LCCR4_PAL_FOR_0 (0 << 15) 44#define LCCR4_PAL_FOR_0 (0 << 15)
43#define LCCR4_PAL_FOR_1 (1 << 15) 45#define LCCR4_PAL_FOR_1 (1 << 15)
44#define LCCR4_PAL_FOR_2 (2 << 15) 46#define LCCR4_PAL_FOR_2 (2 << 15)
47#define LCCR4_PAL_FOR_3 (3 << 15)
45#define LCCR4_PAL_FOR_MASK (3 << 15) 48#define LCCR4_PAL_FOR_MASK (3 << 15)
46 49
47#define FDADR0 (0x200) /* DMA Channel 0 Frame Descriptor Address Register */ 50#define FDADR0 (0x200) /* DMA Channel 0 Frame Descriptor Address Register */
48#define FSADR0 (0x204) /* DMA Channel 0 Frame Source Address Register */
49#define FIDR0 (0x208) /* DMA Channel 0 Frame ID Register */
50#define LDCMD0 (0x20C) /* DMA Channel 0 Command Register */
51#define FDADR1 (0x210) /* DMA Channel 1 Frame Descriptor Address Register */ 51#define FDADR1 (0x210) /* DMA Channel 1 Frame Descriptor Address Register */
52#define FSADR1 (0x214) /* DMA Channel 1 Frame Source Address Register */ 52#define FDADR2 (0x220) /* DMA Channel 2 Frame Descriptor Address Register */
53#define FIDR1 (0x218) /* DMA Channel 1 Frame ID Register */ 53#define FDADR3 (0x230) /* DMA Channel 3 Frame Descriptor Address Register */
54#define LDCMD1 (0x21C) /* DMA Channel 1 Command Register */ 54#define FDADR4 (0x240) /* DMA Channel 4 Frame Descriptor Address Register */
55#define FDADR5 (0x250) /* DMA Channel 5 Frame Descriptor Address Register */
55#define FDADR6 (0x260) /* DMA Channel 6 Frame Descriptor Address Register */ 56#define FDADR6 (0x260) /* DMA Channel 6 Frame Descriptor Address Register */
56#define FSADR6 (0x264) /* DMA Channel 6 Frame Source Address Register */
57#define FIDR6 (0x268) /* DMA Channel 6 Frame ID Register */
58 57
59#define LCCR0_ENB (1 << 0) /* LCD Controller enable */ 58#define LCCR0_ENB (1 << 0) /* LCD Controller enable */
60#define LCCR0_CMS (1 << 1) /* Color/Monochrome Display Select */ 59#define LCCR0_CMS (1 << 1) /* Color/Monochrome Display Select */
@@ -126,9 +125,6 @@
126#define LCCR3_PCD Fld (8, 0) /* Pixel Clock Divisor */ 125#define LCCR3_PCD Fld (8, 0) /* Pixel Clock Divisor */
127#define LCCR3_PixClkDiv(Div) (((Div) << FShft (LCCR3_PCD))) 126#define LCCR3_PixClkDiv(Div) (((Div) << FShft (LCCR3_PCD)))
128 127
129#define LCCR3_BPP Fld (3, 24) /* Bit Per Pixel */
130#define LCCR3_Bpp(Bpp) (((Bpp) << FShft (LCCR3_BPP)))
131
132#define LCCR3_ACB Fld (8, 8) /* AC Bias */ 128#define LCCR3_ACB Fld (8, 8) /* AC Bias */
133#define LCCR3_Acb(Acb) (((Acb) << FShft (LCCR3_ACB))) 129#define LCCR3_Acb(Acb) (((Acb) << FShft (LCCR3_ACB)))
134 130
@@ -157,8 +153,22 @@
157#define LCSR_RD_ST (1 << 11) /* read status */ 153#define LCSR_RD_ST (1 << 11) /* read status */
158#define LCSR_CMD_INT (1 << 12) /* command interrupt */ 154#define LCSR_CMD_INT (1 << 12) /* command interrupt */
159 155
156#define LCSR1_IU(x) (1 << ((x) + 23)) /* Input FIFO underrun */
157#define LCSR1_BS(x) (1 << ((x) + 15)) /* Branch Status */
158#define LCSR1_EOF(x) (1 << ((x) + 7)) /* End of Frame Status */
159#define LCSR1_SOF(x) (1 << ((x) - 1)) /* Start of Frame Status */
160
160#define LDCMD_PAL (1 << 26) /* instructs DMA to load palette buffer */ 161#define LDCMD_PAL (1 << 26) /* instructs DMA to load palette buffer */
161 162
163/* overlay control registers */
164#define OVLxC1_PPL(x) ((((x) - 1) & 0x3ff) << 0) /* Pixels Per Line */
165#define OVLxC1_LPO(x) ((((x) - 1) & 0x3ff) << 10) /* Number of Lines */
166#define OVLxC1_BPP(x) (((x) & 0xf) << 20) /* Bits Per Pixel */
167#define OVLxC1_OEN (1 << 31) /* Enable bit for Overlay */
168#define OVLxC2_XPOS(x) (((x) & 0x3ff) << 0) /* Horizontal Position */
169#define OVLxC2_YPOS(x) (((x) & 0x3ff) << 10) /* Vertical Position */
170#define OVL2C2_PFOR(x) (((x) & 0x7) << 20) /* Pixel Format */
171
162/* smartpanel related */ 172/* smartpanel related */
163#define PRSR_DATA(x) ((x) & 0xff) /* Panel Data */ 173#define PRSR_DATA(x) ((x) & 0xff) /* Panel Data */
164#define PRSR_A0 (1 << 8) /* Read Data Source */ 174#define PRSR_A0 (1 << 8) /* Read Data Source */
@@ -177,4 +187,11 @@
177 187
178#define SMART_CMD(x) (SMART_CMD_WRITE_COMMAND | ((x) & 0xff)) 188#define SMART_CMD(x) (SMART_CMD_WRITE_COMMAND | ((x) & 0xff))
179#define SMART_DAT(x) (SMART_CMD_WRITE_DATA | ((x) & 0xff)) 189#define SMART_DAT(x) (SMART_CMD_WRITE_DATA | ((x) & 0xff))
190
191/* SMART_DELAY() is introduced for software controlled delay primitive which
192 * can be inserted between command sequences, unused command 0x6 is used here
193 * and delay ranges from 0ms ~ 255ms
194 */
195#define SMART_CMD_DELAY (0x6 << 9)
196#define SMART_DELAY(ms) (SMART_CMD_DELAY | ((ms) & 0xff))
180#endif /* __ASM_ARCH_REGS_LCD_H */ 197#endif /* __ASM_ARCH_REGS_LCD_H */
diff --git a/arch/arm/mach-pxa/include/mach/regs-uart.h b/arch/arm/mach-pxa/include/mach/regs-uart.h
new file mode 100644
index 000000000000..55aeb7fb72f6
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/regs-uart.h
@@ -0,0 +1,143 @@
1#ifndef __ASM_ARCH_REGS_UART_H
2#define __ASM_ARCH_REGS_UART_H
3
4/*
5 * UARTs
6 */
7
8/* Full Function UART (FFUART) */
9#define FFUART FFRBR
10#define FFRBR __REG(0x40100000) /* Receive Buffer Register (read only) */
11#define FFTHR __REG(0x40100000) /* Transmit Holding Register (write only) */
12#define FFIER __REG(0x40100004) /* Interrupt Enable Register (read/write) */
13#define FFIIR __REG(0x40100008) /* Interrupt ID Register (read only) */
14#define FFFCR __REG(0x40100008) /* FIFO Control Register (write only) */
15#define FFLCR __REG(0x4010000C) /* Line Control Register (read/write) */
16#define FFMCR __REG(0x40100010) /* Modem Control Register (read/write) */
17#define FFLSR __REG(0x40100014) /* Line Status Register (read only) */
18#define FFMSR __REG(0x40100018) /* Modem Status Register (read only) */
19#define FFSPR __REG(0x4010001C) /* Scratch Pad Register (read/write) */
20#define FFISR __REG(0x40100020) /* Infrared Selection Register (read/write) */
21#define FFDLL __REG(0x40100000) /* Divisor Latch Low Register (DLAB = 1) (read/write) */
22#define FFDLH __REG(0x40100004) /* Divisor Latch High Register (DLAB = 1) (read/write) */
23
24/* Bluetooth UART (BTUART) */
25#define BTUART BTRBR
26#define BTRBR __REG(0x40200000) /* Receive Buffer Register (read only) */
27#define BTTHR __REG(0x40200000) /* Transmit Holding Register (write only) */
28#define BTIER __REG(0x40200004) /* Interrupt Enable Register (read/write) */
29#define BTIIR __REG(0x40200008) /* Interrupt ID Register (read only) */
30#define BTFCR __REG(0x40200008) /* FIFO Control Register (write only) */
31#define BTLCR __REG(0x4020000C) /* Line Control Register (read/write) */
32#define BTMCR __REG(0x40200010) /* Modem Control Register (read/write) */
33#define BTLSR __REG(0x40200014) /* Line Status Register (read only) */
34#define BTMSR __REG(0x40200018) /* Modem Status Register (read only) */
35#define BTSPR __REG(0x4020001C) /* Scratch Pad Register (read/write) */
36#define BTISR __REG(0x40200020) /* Infrared Selection Register (read/write) */
37#define BTDLL __REG(0x40200000) /* Divisor Latch Low Register (DLAB = 1) (read/write) */
38#define BTDLH __REG(0x40200004) /* Divisor Latch High Register (DLAB = 1) (read/write) */
39
40/* Standard UART (STUART) */
41#define STUART STRBR
42#define STRBR __REG(0x40700000) /* Receive Buffer Register (read only) */
43#define STTHR __REG(0x40700000) /* Transmit Holding Register (write only) */
44#define STIER __REG(0x40700004) /* Interrupt Enable Register (read/write) */
45#define STIIR __REG(0x40700008) /* Interrupt ID Register (read only) */
46#define STFCR __REG(0x40700008) /* FIFO Control Register (write only) */
47#define STLCR __REG(0x4070000C) /* Line Control Register (read/write) */
48#define STMCR __REG(0x40700010) /* Modem Control Register (read/write) */
49#define STLSR __REG(0x40700014) /* Line Status Register (read only) */
50#define STMSR __REG(0x40700018) /* Reserved */
51#define STSPR __REG(0x4070001C) /* Scratch Pad Register (read/write) */
52#define STISR __REG(0x40700020) /* Infrared Selection Register (read/write) */
53#define STDLL __REG(0x40700000) /* Divisor Latch Low Register (DLAB = 1) (read/write) */
54#define STDLH __REG(0x40700004) /* Divisor Latch High Register (DLAB = 1) (read/write) */
55
56/* Hardware UART (HWUART) */
57#define HWUART HWRBR
58#define HWRBR __REG(0x41600000) /* Receive Buffer Register (read only) */
59#define HWTHR __REG(0x41600000) /* Transmit Holding Register (write only) */
60#define HWIER __REG(0x41600004) /* Interrupt Enable Register (read/write) */
61#define HWIIR __REG(0x41600008) /* Interrupt ID Register (read only) */
62#define HWFCR __REG(0x41600008) /* FIFO Control Register (write only) */
63#define HWLCR __REG(0x4160000C) /* Line Control Register (read/write) */
64#define HWMCR __REG(0x41600010) /* Modem Control Register (read/write) */
65#define HWLSR __REG(0x41600014) /* Line Status Register (read only) */
66#define HWMSR __REG(0x41600018) /* Modem Status Register (read only) */
67#define HWSPR __REG(0x4160001C) /* Scratch Pad Register (read/write) */
68#define HWISR __REG(0x41600020) /* Infrared Selection Register (read/write) */
69#define HWFOR __REG(0x41600024) /* Receive FIFO Occupancy Register (read only) */
70#define HWABR __REG(0x41600028) /* Auto-Baud Control Register (read/write) */
71#define HWACR __REG(0x4160002C) /* Auto-Baud Count Register (read only) */
72#define HWDLL __REG(0x41600000) /* Divisor Latch Low Register (DLAB = 1) (read/write) */
73#define HWDLH __REG(0x41600004) /* Divisor Latch High Register (DLAB = 1) (read/write) */
74
75#define IER_DMAE (1 << 7) /* DMA Requests Enable */
76#define IER_UUE (1 << 6) /* UART Unit Enable */
77#define IER_NRZE (1 << 5) /* NRZ coding Enable */
78#define IER_RTIOE (1 << 4) /* Receiver Time Out Interrupt Enable */
79#define IER_MIE (1 << 3) /* Modem Interrupt Enable */
80#define IER_RLSE (1 << 2) /* Receiver Line Status Interrupt Enable */
81#define IER_TIE (1 << 1) /* Transmit Data request Interrupt Enable */
82#define IER_RAVIE (1 << 0) /* Receiver Data Available Interrupt Enable */
83
84#define IIR_FIFOES1 (1 << 7) /* FIFO Mode Enable Status */
85#define IIR_FIFOES0 (1 << 6) /* FIFO Mode Enable Status */
86#define IIR_TOD (1 << 3) /* Time Out Detected */
87#define IIR_IID2 (1 << 2) /* Interrupt Source Encoded */
88#define IIR_IID1 (1 << 1) /* Interrupt Source Encoded */
89#define IIR_IP (1 << 0) /* Interrupt Pending (active low) */
90
91#define FCR_ITL2 (1 << 7) /* Interrupt Trigger Level */
92#define FCR_ITL1 (1 << 6) /* Interrupt Trigger Level */
93#define FCR_RESETTF (1 << 2) /* Reset Transmitter FIFO */
94#define FCR_RESETRF (1 << 1) /* Reset Receiver FIFO */
95#define FCR_TRFIFOE (1 << 0) /* Transmit and Receive FIFO Enable */
96#define FCR_ITL_1 (0)
97#define FCR_ITL_8 (FCR_ITL1)
98#define FCR_ITL_16 (FCR_ITL2)
99#define FCR_ITL_32 (FCR_ITL2|FCR_ITL1)
100
101#define LCR_DLAB (1 << 7) /* Divisor Latch Access Bit */
102#define LCR_SB (1 << 6) /* Set Break */
103#define LCR_STKYP (1 << 5) /* Sticky Parity */
104#define LCR_EPS (1 << 4) /* Even Parity Select */
105#define LCR_PEN (1 << 3) /* Parity Enable */
106#define LCR_STB (1 << 2) /* Stop Bit */
107#define LCR_WLS1 (1 << 1) /* Word Length Select */
108#define LCR_WLS0 (1 << 0) /* Word Length Select */
109
110#define LSR_FIFOE (1 << 7) /* FIFO Error Status */
111#define LSR_TEMT (1 << 6) /* Transmitter Empty */
112#define LSR_TDRQ (1 << 5) /* Transmit Data Request */
113#define LSR_BI (1 << 4) /* Break Interrupt */
114#define LSR_FE (1 << 3) /* Framing Error */
115#define LSR_PE (1 << 2) /* Parity Error */
116#define LSR_OE (1 << 1) /* Overrun Error */
117#define LSR_DR (1 << 0) /* Data Ready */
118
119#define MCR_LOOP (1 << 4)
120#define MCR_OUT2 (1 << 3) /* force MSR_DCD in loopback mode */
121#define MCR_OUT1 (1 << 2) /* force MSR_RI in loopback mode */
122#define MCR_RTS (1 << 1) /* Request to Send */
123#define MCR_DTR (1 << 0) /* Data Terminal Ready */
124
125#define MSR_DCD (1 << 7) /* Data Carrier Detect */
126#define MSR_RI (1 << 6) /* Ring Indicator */
127#define MSR_DSR (1 << 5) /* Data Set Ready */
128#define MSR_CTS (1 << 4) /* Clear To Send */
129#define MSR_DDCD (1 << 3) /* Delta Data Carrier Detect */
130#define MSR_TERI (1 << 2) /* Trailing Edge Ring Indicator */
131#define MSR_DDSR (1 << 1) /* Delta Data Set Ready */
132#define MSR_DCTS (1 << 0) /* Delta Clear To Send */
133
134/*
135 * IrSR (Infrared Selection Register)
136 */
137#define STISR_RXPL (1 << 4) /* Receive Data Polarity */
138#define STISR_TXPL (1 << 3) /* Transmit Data Polarity */
139#define STISR_XMODE (1 << 2) /* Transmit Pulse Width Select */
140#define STISR_RCVEIR (1 << 1) /* Receiver SIR Enable */
141#define STISR_XMITIR (1 << 0) /* Transmitter SIR Enable */
142
143#endif /* __ASM_ARCH_REGS_UART_H */
diff --git a/arch/arm/mach-pxa/include/mach/timex.h b/arch/arm/mach-pxa/include/mach/timex.h
index b05fc6683c47..af6760a50e1a 100644
--- a/arch/arm/mach-pxa/include/mach/timex.h
+++ b/arch/arm/mach-pxa/include/mach/timex.h
@@ -10,6 +10,14 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12 12
13/* Various drivers are still using the constant of CLOCK_TICK_RATE, for
14 * those drivers to at least work, the definition is provided here.
15 *
16 * NOTE: this is no longer accurate when multiple processors and boards
17 * are selected, newer drivers should not depend on this any more. Use
18 * either the clocksource/clockevent or get this at run-time by calling
19 * get_clock_tick_rate() (as defined in generic.c).
20 */
13 21
14#if defined(CONFIG_PXA25x) 22#if defined(CONFIG_PXA25x)
15/* PXA250/210 timer base */ 23/* PXA250/210 timer base */
diff --git a/arch/arm/mach-pxa/include/mach/uncompress.h b/arch/arm/mach-pxa/include/mach/uncompress.h
index 21e3e890af98..f4b029c03957 100644
--- a/arch/arm/mach-pxa/include/mach/uncompress.h
+++ b/arch/arm/mach-pxa/include/mach/uncompress.h
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include <linux/serial_reg.h> 12#include <linux/serial_reg.h>
13#include <mach/pxa-regs.h> 13#include <mach/regs-uart.h>
14#include <asm/mach-types.h> 14#include <asm/mach-types.h>
15 15
16#define __REG(x) ((volatile unsigned long *)x) 16#define __REG(x) ((volatile unsigned long *)x)
@@ -35,7 +35,7 @@ static inline void flush(void)
35 35
36static inline void arch_decomp_setup(void) 36static inline void arch_decomp_setup(void)
37{ 37{
38 if (machine_is_littleton()) 38 if (machine_is_littleton() || machine_is_intelmote2())
39 UART = STUART; 39 UART = STUART;
40} 40}
41 41
diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c
index b4d00aba0e31..31da7f3c06f6 100644
--- a/arch/arm/mach-pxa/littleton.c
+++ b/arch/arm/mach-pxa/littleton.c
@@ -20,8 +20,13 @@
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/gpio.h>
23#include <linux/spi/spi.h> 24#include <linux/spi/spi.h>
24#include <linux/smc91x.h> 25#include <linux/smc91x.h>
26#include <linux/i2c.h>
27#include <linux/leds.h>
28#include <linux/mfd/da903x.h>
29#include <linux/i2c/max732x.h>
25 30
26#include <asm/types.h> 31#include <asm/types.h>
27#include <asm/setup.h> 32#include <asm/setup.h>
@@ -36,10 +41,10 @@
36 41
37#include <mach/pxa-regs.h> 42#include <mach/pxa-regs.h>
38#include <mach/mfp-pxa300.h> 43#include <mach/mfp-pxa300.h>
39#include <mach/gpio.h>
40#include <mach/pxafb.h> 44#include <mach/pxafb.h>
41#include <mach/ssp.h> 45#include <mach/ssp.h>
42#include <mach/pxa2xx_spi.h> 46#include <mach/pxa2xx_spi.h>
47#include <mach/i2c.h>
43#include <mach/pxa27x_keypad.h> 48#include <mach/pxa27x_keypad.h>
44#include <mach/pxa3xx_nand.h> 49#include <mach/pxa3xx_nand.h>
45#include <mach/littleton.h> 50#include <mach/littleton.h>
@@ -314,6 +319,73 @@ static void __init littleton_init_nand(void)
314static inline void littleton_init_nand(void) {} 319static inline void littleton_init_nand(void) {}
315#endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */ 320#endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */
316 321
322#if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
323static struct led_info littleton_da9034_leds[] = {
324 [0] = {
325 .name = "littleton:keypad1",
326 .flags = DA9034_LED_RAMP,
327 },
328 [1] = {
329 .name = "littleton:keypad2",
330 .flags = DA9034_LED_RAMP,
331 },
332 [2] = {
333 .name = "littleton:vibra",
334 .flags = 0,
335 },
336};
337
338static struct da903x_subdev_info littleton_da9034_subdevs[] = {
339 {
340 .name = "da903x-led",
341 .id = DA9034_ID_LED_1,
342 .platform_data = &littleton_da9034_leds[0],
343 }, {
344 .name = "da903x-led",
345 .id = DA9034_ID_LED_2,
346 .platform_data = &littleton_da9034_leds[1],
347 }, {
348 .name = "da903x-led",
349 .id = DA9034_ID_VIBRA,
350 .platform_data = &littleton_da9034_leds[2],
351 }, {
352 .name = "da903x-backlight",
353 .id = DA9034_ID_WLED,
354 },
355};
356
357static struct da903x_platform_data littleton_da9034_info = {
358 .num_subdevs = ARRAY_SIZE(littleton_da9034_subdevs),
359 .subdevs = littleton_da9034_subdevs,
360};
361
362static struct max732x_platform_data littleton_max7320_info = {
363 .gpio_base = EXT0_GPIO_BASE,
364};
365
366static struct i2c_board_info littleton_i2c_info[] = {
367 [0] = {
368 .type = "da9034",
369 .addr = 0x34,
370 .platform_data = &littleton_da9034_info,
371 .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO18)),
372 },
373 [1] = {
374 .type = "max7320",
375 .addr = 0x50,
376 .platform_data = &littleton_max7320_info,
377 },
378};
379
380static void __init littleton_init_i2c(void)
381{
382 pxa_set_i2c_info(NULL);
383 i2c_register_board_info(0, ARRAY_AND_SIZE(littleton_i2c_info));
384}
385#else
386static inline void littleton_init_i2c(void) {}
387#endif /* CONFIG_I2C_PXA || CONFIG_I2C_PXA_MODULE */
388
317static void __init littleton_init(void) 389static void __init littleton_init(void)
318{ 390{
319 /* initialize MFP configurations */ 391 /* initialize MFP configurations */
@@ -326,6 +398,7 @@ static void __init littleton_init(void)
326 platform_device_register(&smc91x_device); 398 platform_device_register(&smc91x_device);
327 399
328 littleton_init_spi(); 400 littleton_init_spi();
401 littleton_init_i2c();
329 littleton_init_lcd(); 402 littleton_init_lcd();
330 littleton_init_keypad(); 403 littleton_init_keypad();
331 littleton_init_nand(); 404 littleton_init_nand();
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 519138bc5f85..21b821e1a60d 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -123,6 +123,10 @@ static unsigned long magician_pin_config[] __initdata = {
123 GPIO107_GPIO, /* DS1WM_IRQ */ 123 GPIO107_GPIO, /* DS1WM_IRQ */
124 GPIO108_GPIO, /* GSM_READY */ 124 GPIO108_GPIO, /* GSM_READY */
125 GPIO115_GPIO, /* nPEN_IRQ */ 125 GPIO115_GPIO, /* nPEN_IRQ */
126
127 /* I2C */
128 GPIO117_I2C_SCL,
129 GPIO118_I2C_SDA,
126}; 130};
127 131
128/* 132/*
@@ -332,8 +336,7 @@ static struct pxafb_mach_info toppoly_info = {
332 .modes = toppoly_modes, 336 .modes = toppoly_modes,
333 .num_modes = 1, 337 .num_modes = 1,
334 .fixed_modes = 1, 338 .fixed_modes = 1,
335 .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, 339 .lcd_conn = LCD_COLOR_TFT_16BPP,
336 .lccr3 = LCCR3_PixRsEdg,
337 .pxafb_lcd_power = toppoly_lcd_power, 340 .pxafb_lcd_power = toppoly_lcd_power,
338}; 341};
339 342
@@ -341,8 +344,8 @@ static struct pxafb_mach_info samsung_info = {
341 .modes = samsung_modes, 344 .modes = samsung_modes,
342 .num_modes = 1, 345 .num_modes = 1,
343 .fixed_modes = 1, 346 .fixed_modes = 1,
344 .lccr0 = LCCR0_LDDALT | LCCR0_Color | LCCR0_Sngl | LCCR0_Act, 347 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL |\
345 .lccr3 = LCCR3_PixFlEdg, 348 LCD_ALTERNATE_MAPPING,
346 .pxafb_lcd_power = samsung_lcd_power, 349 .pxafb_lcd_power = samsung_lcd_power,
347}; 350};
348 351
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index f2c7ad8f2b6b..5f224968043c 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -128,6 +128,10 @@ static unsigned long mainstone_pin_config[] = {
128 GPIO108_KP_MKOUT_5, 128 GPIO108_KP_MKOUT_5,
129 GPIO96_KP_MKOUT_6, 129 GPIO96_KP_MKOUT_6,
130 130
131 /* I2C */
132 GPIO117_I2C_SCL,
133 GPIO118_I2C_SDA,
134
131 /* GPIO */ 135 /* GPIO */
132 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, 136 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH,
133}; 137};
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c
index 2061c00c8ead..33626de8cbf6 100644
--- a/arch/arm/mach-pxa/mfp-pxa2xx.c
+++ b/arch/arm/mach-pxa/mfp-pxa2xx.c
@@ -38,12 +38,13 @@ struct gpio_desc {
38 unsigned valid : 1; 38 unsigned valid : 1;
39 unsigned can_wakeup : 1; 39 unsigned can_wakeup : 1;
40 unsigned keypad_gpio : 1; 40 unsigned keypad_gpio : 1;
41 unsigned dir_inverted : 1;
41 unsigned int mask; /* bit mask in PWER or PKWR */ 42 unsigned int mask; /* bit mask in PWER or PKWR */
43 unsigned int mux_mask; /* bit mask of muxed gpio bits, 0 if no mux */
42 unsigned long config; 44 unsigned long config;
43}; 45};
44 46
45static struct gpio_desc gpio_desc[MFP_PIN_GPIO127 + 1]; 47static struct gpio_desc gpio_desc[MFP_PIN_GPIO127 + 1];
46static int gpio_nr;
47 48
48static unsigned long gpdr_lpm[4]; 49static unsigned long gpdr_lpm[4];
49 50
@@ -54,7 +55,7 @@ static int __mfp_config_gpio(unsigned gpio, unsigned long c)
54 int uorl = !!(gpio & 0x10); /* GAFRx_U or GAFRx_L ? */ 55 int uorl = !!(gpio & 0x10); /* GAFRx_U or GAFRx_L ? */
55 int shft = (gpio & 0xf) << 1; 56 int shft = (gpio & 0xf) << 1;
56 int fn = MFP_AF(c); 57 int fn = MFP_AF(c);
57 int dir = c & MFP_DIR_OUT; 58 int is_out = (c & MFP_DIR_OUT) ? 1 : 0;
58 59
59 if (fn > 3) 60 if (fn > 3)
60 return -EINVAL; 61 return -EINVAL;
@@ -68,7 +69,7 @@ static int __mfp_config_gpio(unsigned gpio, unsigned long c)
68 else 69 else
69 GAFR_U(bank) = gafr; 70 GAFR_U(bank) = gafr;
70 71
71 if (dir == MFP_DIR_OUT) 72 if (is_out ^ gpio_desc[gpio].dir_inverted)
72 GPDR(gpio) |= mask; 73 GPDR(gpio) |= mask;
73 else 74 else
74 GPDR(gpio) &= ~mask; 75 GPDR(gpio) &= ~mask;
@@ -77,11 +78,11 @@ static int __mfp_config_gpio(unsigned gpio, unsigned long c)
77 switch (c & MFP_LPM_STATE_MASK) { 78 switch (c & MFP_LPM_STATE_MASK) {
78 case MFP_LPM_DRIVE_HIGH: 79 case MFP_LPM_DRIVE_HIGH:
79 PGSR(bank) |= mask; 80 PGSR(bank) |= mask;
80 dir = MFP_DIR_OUT; 81 is_out = 1;
81 break; 82 break;
82 case MFP_LPM_DRIVE_LOW: 83 case MFP_LPM_DRIVE_LOW:
83 PGSR(bank) &= ~mask; 84 PGSR(bank) &= ~mask;
84 dir = MFP_DIR_OUT; 85 is_out = 1;
85 break; 86 break;
86 case MFP_LPM_DEFAULT: 87 case MFP_LPM_DEFAULT:
87 break; 88 break;
@@ -92,7 +93,7 @@ static int __mfp_config_gpio(unsigned gpio, unsigned long c)
92 break; 93 break;
93 } 94 }
94 95
95 if (dir == MFP_DIR_OUT) 96 if (is_out ^ gpio_desc[gpio].dir_inverted)
96 gpdr_lpm[bank] |= mask; 97 gpdr_lpm[bank] |= mask;
97 else 98 else
98 gpdr_lpm[bank] &= ~mask; 99 gpdr_lpm[bank] &= ~mask;
@@ -106,7 +107,7 @@ static int __mfp_config_gpio(unsigned gpio, unsigned long c)
106 return -EINVAL; 107 return -EINVAL;
107 } 108 }
108 109
109 if ((c & MFP_LPM_CAN_WAKEUP) && (dir == MFP_DIR_OUT)) { 110 if ((c & MFP_LPM_CAN_WAKEUP) && is_out) {
110 pr_warning("%s: output GPIO%d unable to wakeup\n", 111 pr_warning("%s: output GPIO%d unable to wakeup\n",
111 __func__, gpio); 112 __func__, gpio);
112 return -EINVAL; 113 return -EINVAL;
@@ -169,7 +170,7 @@ void pxa2xx_mfp_set_lpm(int mfp, unsigned long lpm)
169int gpio_set_wake(unsigned int gpio, unsigned int on) 170int gpio_set_wake(unsigned int gpio, unsigned int on)
170{ 171{
171 struct gpio_desc *d; 172 struct gpio_desc *d;
172 unsigned long c; 173 unsigned long c, mux_taken;
173 174
174 if (gpio > mfp_to_gpio(MFP_PIN_GPIO127)) 175 if (gpio > mfp_to_gpio(MFP_PIN_GPIO127))
175 return -EINVAL; 176 return -EINVAL;
@@ -183,9 +184,13 @@ int gpio_set_wake(unsigned int gpio, unsigned int on)
183 if (d->keypad_gpio) 184 if (d->keypad_gpio)
184 return -EINVAL; 185 return -EINVAL;
185 186
187 mux_taken = (PWER & d->mux_mask) & (~d->mask);
188 if (on && mux_taken)
189 return -EBUSY;
190
186 if (d->can_wakeup && (c & MFP_LPM_CAN_WAKEUP)) { 191 if (d->can_wakeup && (c & MFP_LPM_CAN_WAKEUP)) {
187 if (on) { 192 if (on) {
188 PWER |= d->mask; 193 PWER = (PWER & ~d->mux_mask) | d->mask;
189 194
190 if (c & MFP_LPM_EDGE_RISE) 195 if (c & MFP_LPM_EDGE_RISE)
191 PRER |= d->mask; 196 PRER |= d->mask;
@@ -210,7 +215,7 @@ static void __init pxa25x_mfp_init(void)
210{ 215{
211 int i; 216 int i;
212 217
213 for (i = 0; i <= 84; i++) 218 for (i = 0; i <= pxa_last_gpio; i++)
214 gpio_desc[i].valid = 1; 219 gpio_desc[i].valid = 1;
215 220
216 for (i = 0; i <= 15; i++) { 221 for (i = 0; i <= 15; i++) {
@@ -218,7 +223,11 @@ static void __init pxa25x_mfp_init(void)
218 gpio_desc[i].mask = GPIO_bit(i); 223 gpio_desc[i].mask = GPIO_bit(i);
219 } 224 }
220 225
221 gpio_nr = 85; 226 /* PXA26x has additional 4 GPIOs (86/87/88/89) which has the
227 * direction bit inverted in GPDR2. See PXA26x DM 4.1.1.
228 */
229 for (i = 86; i <= pxa_last_gpio; i++)
230 gpio_desc[i].dir_inverted = 1;
222} 231}
223#else 232#else
224static inline void pxa25x_mfp_init(void) {} 233static inline void pxa25x_mfp_init(void) {}
@@ -251,11 +260,27 @@ int keypad_set_wake(unsigned int on)
251 return 0; 260 return 0;
252} 261}
253 262
263#define PWER_WEMUX2_GPIO38 (1 << 16)
264#define PWER_WEMUX2_GPIO53 (2 << 16)
265#define PWER_WEMUX2_GPIO40 (3 << 16)
266#define PWER_WEMUX2_GPIO36 (4 << 16)
267#define PWER_WEMUX2_MASK (7 << 16)
268#define PWER_WEMUX3_GPIO31 (1 << 19)
269#define PWER_WEMUX3_GPIO113 (2 << 19)
270#define PWER_WEMUX3_MASK (3 << 19)
271
272#define INIT_GPIO_DESC_MUXED(mux, gpio) \
273do { \
274 gpio_desc[(gpio)].can_wakeup = 1; \
275 gpio_desc[(gpio)].mask = PWER_ ## mux ## _GPIO ##gpio; \
276 gpio_desc[(gpio)].mux_mask = PWER_ ## mux ## _MASK; \
277} while (0)
278
254static void __init pxa27x_mfp_init(void) 279static void __init pxa27x_mfp_init(void)
255{ 280{
256 int i, gpio; 281 int i, gpio;
257 282
258 for (i = 0; i <= 120; i++) { 283 for (i = 0; i <= pxa_last_gpio; i++) {
259 /* skip GPIO2, 5, 6, 7, 8, they are not 284 /* skip GPIO2, 5, 6, 7, 8, they are not
260 * valid pins allow configuration 285 * valid pins allow configuration
261 */ 286 */
@@ -286,7 +311,12 @@ static void __init pxa27x_mfp_init(void)
286 gpio_desc[35].can_wakeup = 1; 311 gpio_desc[35].can_wakeup = 1;
287 gpio_desc[35].mask = PWER_WE35; 312 gpio_desc[35].mask = PWER_WE35;
288 313
289 gpio_nr = 121; 314 INIT_GPIO_DESC_MUXED(WEMUX3, 31);
315 INIT_GPIO_DESC_MUXED(WEMUX3, 113);
316 INIT_GPIO_DESC_MUXED(WEMUX2, 38);
317 INIT_GPIO_DESC_MUXED(WEMUX2, 53);
318 INIT_GPIO_DESC_MUXED(WEMUX2, 40);
319 INIT_GPIO_DESC_MUXED(WEMUX2, 36);
290} 320}
291#else 321#else
292static inline void pxa27x_mfp_init(void) {} 322static inline void pxa27x_mfp_init(void) {}
@@ -300,7 +330,7 @@ static int pxa2xx_mfp_suspend(struct sys_device *d, pm_message_t state)
300{ 330{
301 int i; 331 int i;
302 332
303 for (i = 0; i <= gpio_to_bank(gpio_nr); i++) { 333 for (i = 0; i <= gpio_to_bank(pxa_last_gpio); i++) {
304 334
305 saved_gafr[0][i] = GAFR_L(i); 335 saved_gafr[0][i] = GAFR_L(i);
306 saved_gafr[1][i] = GAFR_U(i); 336 saved_gafr[1][i] = GAFR_U(i);
@@ -315,7 +345,7 @@ static int pxa2xx_mfp_resume(struct sys_device *d)
315{ 345{
316 int i; 346 int i;
317 347
318 for (i = 0; i <= gpio_to_bank(gpio_nr); i++) { 348 for (i = 0; i <= gpio_to_bank(pxa_last_gpio); i++) {
319 GAFR_L(i) = saved_gafr[0][i]; 349 GAFR_L(i) = saved_gafr[0][i];
320 GAFR_U(i) = saved_gafr[1][i]; 350 GAFR_U(i) = saved_gafr[1][i];
321 GPDR(i * 32) = saved_gpdr[i]; 351 GPDR(i * 32) = saved_gpdr[i];
@@ -348,7 +378,7 @@ static int __init pxa2xx_mfp_init(void)
348 pxa27x_mfp_init(); 378 pxa27x_mfp_init();
349 379
350 /* initialize gafr_run[], pgsr_lpm[] from existing values */ 380 /* initialize gafr_run[], pgsr_lpm[] from existing values */
351 for (i = 0; i <= gpio_to_bank(gpio_nr); i++) 381 for (i = 0; i <= gpio_to_bank(pxa_last_gpio); i++)
352 gpdr_lpm[i] = GPDR(i * 32); 382 gpdr_lpm[i] = GPDR(i * 32);
353 383
354 return sysdev_class_register(&pxa2xx_mfp_sysclass); 384 return sysdev_class_register(&pxa2xx_mfp_sysclass);
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c
index 782903fe9c6c..2b427e015b6f 100644
--- a/arch/arm/mach-pxa/mioa701.c
+++ b/arch/arm/mach-pxa/mioa701.c
@@ -34,7 +34,7 @@
34#include <linux/irq.h> 34#include <linux/irq.h>
35#include <linux/pda_power.h> 35#include <linux/pda_power.h>
36#include <linux/power_supply.h> 36#include <linux/power_supply.h>
37#include <linux/wm97xx.h> 37#include <linux/wm97xx_batt.h>
38#include <linux/mtd/physmap.h> 38#include <linux/mtd/physmap.h>
39 39
40#include <asm/mach-types.h> 40#include <asm/mach-types.h>
@@ -46,6 +46,9 @@
46#include <mach/mmc.h> 46#include <mach/mmc.h>
47#include <mach/udc.h> 47#include <mach/udc.h>
48#include <mach/pxa27x-udc.h> 48#include <mach/pxa27x-udc.h>
49#include <mach/i2c.h>
50#include <mach/camera.h>
51#include <media/soc_camera.h>
49 52
50#include <mach/mioa701.h> 53#include <mach/mioa701.h>
51 54
@@ -54,10 +57,11 @@
54 57
55static unsigned long mioa701_pin_config[] = { 58static unsigned long mioa701_pin_config[] = {
56 /* Mio global */ 59 /* Mio global */
57 MIO_CFG_OUT(GPIO9_CHARGE_nEN, AF0, DRIVE_LOW), 60 MIO_CFG_OUT(GPIO9_CHARGE_EN, AF0, DRIVE_LOW),
58 MIO_CFG_OUT(GPIO18_POWEROFF, AF0, DRIVE_LOW), 61 MIO_CFG_OUT(GPIO18_POWEROFF, AF0, DRIVE_LOW),
59 MFP_CFG_OUT(GPIO3, AF0, DRIVE_HIGH), 62 MFP_CFG_OUT(GPIO3, AF0, DRIVE_HIGH),
60 MFP_CFG_OUT(GPIO4, AF0, DRIVE_HIGH), 63 MFP_CFG_OUT(GPIO4, AF0, DRIVE_HIGH),
64 MIO_CFG_IN(GPIO80_MAYBE_CHARGE_VDROP, AF0),
61 65
62 /* Backlight PWM 0 */ 66 /* Backlight PWM 0 */
63 GPIO16_PWM0_OUT, 67 GPIO16_PWM0_OUT,
@@ -74,7 +78,7 @@ static unsigned long mioa701_pin_config[] = {
74 MIO_CFG_OUT(GPIO91_SDIO_EN, AF0, DRIVE_LOW), 78 MIO_CFG_OUT(GPIO91_SDIO_EN, AF0, DRIVE_LOW),
75 79
76 /* USB */ 80 /* USB */
77 MIO_CFG_IN(GPIO13_USB_DETECT, AF0), 81 MIO_CFG_IN(GPIO13_nUSB_DETECT, AF0),
78 MIO_CFG_OUT(GPIO22_USB_ENABLE, AF0, DRIVE_LOW), 82 MIO_CFG_OUT(GPIO22_USB_ENABLE, AF0, DRIVE_LOW),
79 83
80 /* LCD */ 84 /* LCD */
@@ -98,12 +102,29 @@ static unsigned long mioa701_pin_config[] = {
98 GPIO75_LCD_LCLK, 102 GPIO75_LCD_LCLK,
99 GPIO76_LCD_PCLK, 103 GPIO76_LCD_PCLK,
100 104
105 /* QCI */
106 GPIO12_CIF_DD_7,
107 GPIO17_CIF_DD_6,
108 GPIO50_CIF_DD_3,
109 GPIO51_CIF_DD_2,
110 GPIO52_CIF_DD_4,
111 GPIO53_CIF_MCLK,
112 GPIO54_CIF_PCLK,
113 GPIO55_CIF_DD_1,
114 GPIO81_CIF_DD_0,
115 GPIO82_CIF_DD_5,
116 GPIO84_CIF_FV,
117 GPIO85_CIF_LV,
118
101 /* Bluetooth */ 119 /* Bluetooth */
120 MIO_CFG_IN(GPIO14_BT_nACTIVITY, AF0),
102 GPIO44_BTUART_CTS, 121 GPIO44_BTUART_CTS,
103 GPIO42_BTUART_RXD, 122 GPIO42_BTUART_RXD,
104 GPIO45_BTUART_RTS, 123 GPIO45_BTUART_RTS,
105 GPIO43_BTUART_TXD, 124 GPIO43_BTUART_TXD,
106 MIO_CFG_OUT(GPIO83_BT_ON, AF0, DRIVE_LOW), 125 MIO_CFG_OUT(GPIO83_BT_ON, AF0, DRIVE_LOW),
126 MIO_CFG_OUT(GPIO77_BT_UNKNOWN1, AF0, DRIVE_HIGH),
127 MIO_CFG_OUT(GPIO86_BT_MAYBE_nRESET, AF0, DRIVE_HIGH),
107 128
108 /* GPS */ 129 /* GPS */
109 MIO_CFG_OUT(GPIO23_GPS_UNKNOWN1, AF0, DRIVE_LOW), 130 MIO_CFG_OUT(GPIO23_GPS_UNKNOWN1, AF0, DRIVE_LOW),
@@ -151,16 +172,16 @@ static unsigned long mioa701_pin_config[] = {
151 GPIO104_KP_MKOUT_1, 172 GPIO104_KP_MKOUT_1,
152 GPIO105_KP_MKOUT_2, 173 GPIO105_KP_MKOUT_2,
153 174
175 /* I2C */
176 GPIO117_I2C_SCL,
177 GPIO118_I2C_SDA,
178
154 /* Unknown */ 179 /* Unknown */
155 MFP_CFG_IN(GPIO14, AF0),
156 MFP_CFG_IN(GPIO20, AF0), 180 MFP_CFG_IN(GPIO20, AF0),
157 MFP_CFG_IN(GPIO21, AF0), 181 MFP_CFG_IN(GPIO21, AF0),
158 MFP_CFG_IN(GPIO33, AF0), 182 MFP_CFG_IN(GPIO33, AF0),
159 MFP_CFG_OUT(GPIO49, AF0, DRIVE_HIGH), 183 MFP_CFG_OUT(GPIO49, AF0, DRIVE_HIGH),
160 MFP_CFG_OUT(GPIO57, AF0, DRIVE_HIGH), 184 MFP_CFG_OUT(GPIO57, AF0, DRIVE_HIGH),
161 MFP_CFG_OUT(GPIO77, AF0, DRIVE_HIGH),
162 MFP_CFG_IN(GPIO80, AF0),
163 MFP_CFG_OUT(GPIO86, AF0, DRIVE_HIGH),
164 MFP_CFG_IN(GPIO96, AF0), 185 MFP_CFG_IN(GPIO96, AF0),
165 MFP_CFG_OUT(GPIO116, AF0, DRIVE_HIGH), 186 MFP_CFG_OUT(GPIO116, AF0, DRIVE_HIGH),
166}; 187};
@@ -407,7 +428,7 @@ static void udc_power_command(int cmd)
407 428
408static int is_usb_connected(void) 429static int is_usb_connected(void)
409{ 430{
410 return !!gpio_get_value(GPIO13_USB_DETECT); 431 return !gpio_get_value(GPIO13_nUSB_DETECT);
411} 432}
412 433
413static struct pxa2xx_udc_mach_info mioa701_udc_info = { 434static struct pxa2xx_udc_mach_info mioa701_udc_info = {
@@ -659,13 +680,19 @@ static char *supplicants[] = {
659 "mioa701_battery" 680 "mioa701_battery"
660}; 681};
661 682
683static int is_ac_connected(void)
684{
685 return gpio_get_value(GPIO96_AC_DETECT);
686}
687
662static void mioa701_set_charge(int flags) 688static void mioa701_set_charge(int flags)
663{ 689{
664 gpio_set_value(GPIO9_CHARGE_nEN, !flags); 690 gpio_set_value(GPIO9_CHARGE_EN, (flags == PDA_POWER_CHARGE_USB));
665} 691}
666 692
667static struct pda_power_pdata power_pdata = { 693static struct pda_power_pdata power_pdata = {
668 .is_ac_online = is_usb_connected, 694 .is_ac_online = is_ac_connected,
695 .is_usb_online = is_usb_connected,
669 .set_charge = mioa701_set_charge, 696 .set_charge = mioa701_set_charge,
670 .supplied_to = supplicants, 697 .supplied_to = supplicants,
671 .num_supplicants = ARRAY_SIZE(supplicants), 698 .num_supplicants = ARRAY_SIZE(supplicants),
@@ -674,8 +701,15 @@ static struct pda_power_pdata power_pdata = {
674static struct resource power_resources[] = { 701static struct resource power_resources[] = {
675 [0] = { 702 [0] = {
676 .name = "ac", 703 .name = "ac",
677 .start = gpio_to_irq(GPIO13_USB_DETECT), 704 .start = gpio_to_irq(GPIO96_AC_DETECT),
678 .end = gpio_to_irq(GPIO13_USB_DETECT), 705 .end = gpio_to_irq(GPIO96_AC_DETECT),
706 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
707 IORESOURCE_IRQ_LOWEDGE,
708 },
709 [1] = {
710 .name = "usb",
711 .start = gpio_to_irq(GPIO13_nUSB_DETECT),
712 .end = gpio_to_irq(GPIO13_nUSB_DETECT),
679 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | 713 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
680 IORESOURCE_IRQ_LOWEDGE, 714 IORESOURCE_IRQ_LOWEDGE,
681 }, 715 },
@@ -691,120 +725,43 @@ static struct platform_device power_dev = {
691 }, 725 },
692}; 726};
693 727
694#if defined(CONFIG_PDA_POWER) && defined(CONFIG_TOUCHSCREEN_WM97XX) 728static struct wm97xx_batt_info mioa701_battery_data = {
695static struct wm97xx *battery_wm; 729 .batt_aux = WM97XX_AUX_ID1,
696 730 .temp_aux = -1,
697static enum power_supply_property battery_props[] = { 731 .charge_gpio = -1,
698 POWER_SUPPLY_PROP_STATUS, 732 .min_voltage = 0xc00,
699 POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, 733 .max_voltage = 0xfc0,
700 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, 734 .batt_tech = POWER_SUPPLY_TECHNOLOGY_LION,
701 POWER_SUPPLY_PROP_VOLTAGE_NOW, 735 .batt_div = 1,
702 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, /* Necessary for apm */ 736 .batt_mult = 1,
737 .batt_name = "mioa701_battery",
703}; 738};
704 739
705static int get_battery_voltage(void) 740/*
706{ 741 * Camera interface
707 int adc = -1; 742 */
708 743struct pxacamera_platform_data mioa701_pxacamera_platform_data = {
709 if (battery_wm) 744 .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
710 adc = wm97xx_read_aux_adc(battery_wm, WM97XX_AUX_ID1); 745 PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN,
711 return adc; 746 .mclk_10khz = 5000,
712}
713
714static int get_battery_status(struct power_supply *b)
715{
716 int status;
717
718 if (is_usb_connected())
719 status = POWER_SUPPLY_STATUS_CHARGING;
720 else
721 status = POWER_SUPPLY_STATUS_DISCHARGING;
722
723 return status;
724}
725
726static int get_property(struct power_supply *b,
727 enum power_supply_property psp,
728 union power_supply_propval *val)
729{
730 int rc = 0;
731
732 switch (psp) {
733 case POWER_SUPPLY_PROP_STATUS:
734 val->intval = get_battery_status(b);
735 break;
736 case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
737 val->intval = 0xfd0;
738 break;
739 case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
740 val->intval = 0xc00;
741 break;
742 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
743 val->intval = get_battery_voltage();
744 break;
745 case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
746 val->intval = 100;
747 break;
748 default:
749 val->intval = -1;
750 rc = -1;
751 }
752
753 return rc;
754}; 747};
755 748
756static struct power_supply battery_ps = { 749static struct soc_camera_link iclink = {
757 .name = "mioa701_battery", 750 .bus_id = 0, /* Must match id in pxa27x_device_camera in device.c */
758 .type = POWER_SUPPLY_TYPE_BATTERY,
759 .get_property = get_property,
760 .properties = battery_props,
761 .num_properties = ARRAY_SIZE(battery_props),
762}; 751};
763 752
764static int battery_probe(struct platform_device *pdev) 753/* Board I2C devices. */
765{ 754static struct i2c_board_info __initdata mioa701_i2c_devices[] = {
766 struct wm97xx *wm = platform_get_drvdata(pdev); 755 {
767 int rc; 756 /* Must initialize before the camera(s) */
768 757 I2C_BOARD_INFO("mt9m111", 0x5d),
769 battery_wm = wm; 758 .platform_data = &iclink,
770
771 rc = power_supply_register(NULL, &battery_ps);
772 if (rc)
773 dev_err(&pdev->dev,
774 "Could not register mioa701 battery -> %d\n", rc);
775 return rc;
776}
777
778static int battery_remove(struct platform_device *pdev)
779{
780 battery_wm = NULL;
781 return 0;
782}
783
784static struct platform_driver mioa701_battery_driver = {
785 .driver = {
786 .name = "wm97xx-battery",
787 }, 759 },
788 .probe = battery_probe,
789 .remove = battery_remove
790}; 760};
791 761
792static int __init mioa701_battery_init(void) 762struct i2c_pxa_platform_data i2c_pdata = {
793{ 763 .fast_mode = 1,
794 int rc; 764};
795
796 rc = platform_driver_register(&mioa701_battery_driver);
797 if (rc)
798 printk(KERN_ERR "Could not register mioa701 battery driver\n");
799 return rc;
800}
801
802#else
803static int __init mioa701_battery_init(void)
804{
805 return 0;
806}
807#endif
808 765
809/* 766/*
810 * Mio global 767 * Mio global
@@ -851,17 +808,17 @@ static void mioa701_machine_exit(void);
851static void mioa701_poweroff(void) 808static void mioa701_poweroff(void)
852{ 809{
853 mioa701_machine_exit(); 810 mioa701_machine_exit();
854 gpio_set_value(GPIO18_POWEROFF, 1); 811 arm_machine_restart('s');
855} 812}
856 813
857static void mioa701_restart(char c) 814static void mioa701_restart(char c)
858{ 815{
859 mioa701_machine_exit(); 816 mioa701_machine_exit();
860 arm_machine_restart(c); 817 arm_machine_restart('s');
861} 818}
862 819
863struct gpio_ress global_gpios[] = { 820struct gpio_ress global_gpios[] = {
864 MIO_GPIO_OUT(GPIO9_CHARGE_nEN, 1, "Charger enable"), 821 MIO_GPIO_OUT(GPIO9_CHARGE_EN, 1, "Charger enable"),
865 MIO_GPIO_OUT(GPIO18_POWEROFF, 0, "Power Off"), 822 MIO_GPIO_OUT(GPIO18_POWEROFF, 0, "Power Off"),
866 MIO_GPIO_OUT(GPIO87_LCD_POWER, 0, "LCD Power") 823 MIO_GPIO_OUT(GPIO87_LCD_POWER, 0, "LCD Power")
867}; 824};
@@ -879,12 +836,16 @@ static void __init mioa701_machine_init(void)
879 set_pxa_fb_info(&mioa701_pxafb_info); 836 set_pxa_fb_info(&mioa701_pxafb_info);
880 pxa_set_mci_info(&mioa701_mci_info); 837 pxa_set_mci_info(&mioa701_mci_info);
881 pxa_set_keypad_info(&mioa701_keypad_info); 838 pxa_set_keypad_info(&mioa701_keypad_info);
839 wm97xx_bat_set_pdata(&mioa701_battery_data);
882 udc_init(); 840 udc_init();
883 pm_power_off = mioa701_poweroff; 841 pm_power_off = mioa701_poweroff;
884 arm_pm_restart = mioa701_restart; 842 arm_pm_restart = mioa701_restart;
885 platform_add_devices(devices, ARRAY_SIZE(devices)); 843 platform_add_devices(devices, ARRAY_SIZE(devices));
886 gsm_init(); 844 gsm_init();
887 mioa701_battery_init(); 845
846 pxa_set_i2c_info(&i2c_pdata);
847 pxa_set_camera_info(&mioa701_pxacamera_platform_data);
848 i2c_register_board_info(0, ARRAY_AND_SIZE(mioa701_i2c_devices));
888} 849}
889 850
890static void mioa701_machine_exit(void) 851static void mioa701_machine_exit(void)
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c
index b36cec5c9eed..34841c72815f 100644
--- a/arch/arm/mach-pxa/pcm990-baseboard.c
+++ b/arch/arm/mach-pxa/pcm990-baseboard.c
@@ -55,6 +55,10 @@ static unsigned long pcm990_pin_config[] __initdata = {
55 GPIO89_USBH1_PEN, 55 GPIO89_USBH1_PEN,
56 /* PWM0 */ 56 /* PWM0 */
57 GPIO16_PWM0_OUT, 57 GPIO16_PWM0_OUT,
58
59 /* I2C */
60 GPIO117_I2C_SCL,
61 GPIO118_I2C_SDA,
58}; 62};
59 63
60/* 64/*
@@ -100,8 +104,7 @@ static struct pxafb_mode_info fb_info_sharp_lq084v1dg21 = {
100static struct pxafb_mach_info pcm990_fbinfo __initdata = { 104static struct pxafb_mach_info pcm990_fbinfo __initdata = {
101 .modes = &fb_info_sharp_lq084v1dg21, 105 .modes = &fb_info_sharp_lq084v1dg21,
102 .num_modes = 1, 106 .num_modes = 1,
103 .lccr0 = LCCR0_PAS, 107 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
104 .lccr3 = LCCR3_PCP,
105 .pxafb_lcd_power = pcm990_lcd_power, 108 .pxafb_lcd_power = pcm990_lcd_power,
106}; 109};
107#elif defined(CONFIG_PCM990_DISPLAY_NEC) 110#elif defined(CONFIG_PCM990_DISPLAY_NEC)
@@ -123,8 +126,7 @@ struct pxafb_mode_info fb_info_nec_nl6448bc20_18d = {
123static struct pxafb_mach_info pcm990_fbinfo __initdata = { 126static struct pxafb_mach_info pcm990_fbinfo __initdata = {
124 .modes = &fb_info_nec_nl6448bc20_18d, 127 .modes = &fb_info_nec_nl6448bc20_18d,
125 .num_modes = 1, 128 .num_modes = 1,
126 .lccr0 = LCCR0_Act, 129 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
127 .lccr3 = LCCR3_PixFlEdg,
128 .pxafb_lcd_power = pcm990_lcd_power, 130 .pxafb_lcd_power = pcm990_lcd_power,
129}; 131};
130#endif 132#endif
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 2e3bd8b1523b..ae88855bf974 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -20,6 +20,7 @@
20#include <linux/fb.h> 20#include <linux/fb.h>
21#include <linux/pm.h> 21#include <linux/pm.h>
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/mtd/physmap.h>
23#include <linux/gpio.h> 24#include <linux/gpio.h>
24#include <linux/spi/spi.h> 25#include <linux/spi/spi.h>
25#include <linux/spi/ads7846.h> 26#include <linux/spi/ads7846.h>
@@ -413,9 +414,40 @@ static struct pxafb_mach_info poodle_fb_info = {
413 .lcd_conn = LCD_COLOR_TFT_16BPP, 414 .lcd_conn = LCD_COLOR_TFT_16BPP,
414}; 415};
415 416
417static struct mtd_partition sharpsl_rom_parts[] = {
418 {
419 .name ="Boot PROM Filesystem",
420 .offset = 0x00120000,
421 .size = MTDPART_SIZ_FULL,
422 },
423};
424
425static struct physmap_flash_data sharpsl_rom_data = {
426 .width = 2,
427 .nr_parts = ARRAY_SIZE(sharpsl_rom_parts),
428 .parts = sharpsl_rom_parts,
429};
430
431static struct resource sharpsl_rom_resources[] = {
432 {
433 .start = 0x00000000,
434 .end = 0x007fffff,
435 .flags = IORESOURCE_MEM,
436 },
437};
438
439static struct platform_device sharpsl_rom_device = {
440 .name = "physmap-flash",
441 .id = -1,
442 .resource = sharpsl_rom_resources,
443 .num_resources = ARRAY_SIZE(sharpsl_rom_resources),
444 .dev.platform_data = &sharpsl_rom_data,
445};
446
416static struct platform_device *devices[] __initdata = { 447static struct platform_device *devices[] __initdata = {
417 &poodle_locomo_device, 448 &poodle_locomo_device,
418 &poodle_scoop_device, 449 &poodle_scoop_device,
450 &sharpsl_rom_device,
419}; 451};
420 452
421static void poodle_poweroff(void) 453static void poodle_poweroff(void)
diff --git a/arch/arm/mach-pxa/pwm.c b/arch/arm/mach-pxa/pwm.c
index 74e2ead8cee8..3ca7ffc6904b 100644
--- a/arch/arm/mach-pxa/pwm.c
+++ b/arch/arm/mach-pxa/pwm.c
@@ -173,7 +173,7 @@ static struct pwm_device *pwm_probe(struct platform_device *pdev,
173 return ERR_PTR(-ENOMEM); 173 return ERR_PTR(-ENOMEM);
174 } 174 }
175 175
176 pwm->clk = clk_get(&pdev->dev, "PWMCLK"); 176 pwm->clk = clk_get(&pdev->dev, NULL);
177 if (IS_ERR(pwm->clk)) { 177 if (IS_ERR(pwm->clk)) {
178 ret = PTR_ERR(pwm->clk); 178 ret = PTR_ERR(pwm->clk);
179 goto err_free; 179 goto err_free;
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 25d17a1dab78..6c57522e2469 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -36,12 +36,6 @@
36#include "devices.h" 36#include "devices.h"
37#include "clock.h" 37#include "clock.h"
38 38
39int cpu_is_pxa26x(void)
40{
41 return cpu_is_pxa250() && ((BOOT_DEF & 0x8) == 0);
42}
43EXPORT_SYMBOL_GPL(cpu_is_pxa26x);
44
45/* 39/*
46 * Various clock factors driven by the CCCR register. 40 * Various clock factors driven by the CCCR register.
47 */ 41 */
@@ -167,36 +161,51 @@ static const struct clkops clk_pxa25x_gpio11_ops = {
167 * 95.842MHz -> MMC 19.169MHz, I2C 31.949MHz, FICP 47.923MHz, USB 47.923MHz 161 * 95.842MHz -> MMC 19.169MHz, I2C 31.949MHz, FICP 47.923MHz, USB 47.923MHz
168 * 147.456MHz -> UART 14.7456MHz, AC97 12.288MHz, I2S 5.672MHz (allegedly) 162 * 147.456MHz -> UART 14.7456MHz, AC97 12.288MHz, I2S 5.672MHz (allegedly)
169 */ 163 */
170static struct clk pxa25x_hwuart_clk = 164static DEFINE_CKEN(pxa25x_hwuart, HWUART, 14745600, 1);
171 INIT_CKEN("UARTCLK", HWUART, 14745600, 1, &pxa_device_hwuart.dev) 165
172; 166static struct clk_lookup pxa25x_hwuart_clkreg =
167 INIT_CLKREG(&clk_pxa25x_hwuart, "pxa2xx-uart.3", NULL);
173 168
174/* 169/*
175 * PXA 2xx clock declarations. 170 * PXA 2xx clock declarations.
176 */ 171 */
177static struct clk pxa25x_clks[] = { 172static DEFINE_CK(pxa25x_lcd, LCD, &clk_pxa25x_lcd_ops);
178 INIT_CK("LCDCLK", LCD, &clk_pxa25x_lcd_ops, &pxa_device_fb.dev), 173static DEFINE_CKEN(pxa25x_ffuart, FFUART, 14745600, 1);
179 INIT_CKEN("UARTCLK", FFUART, 14745600, 1, &pxa_device_ffuart.dev), 174static DEFINE_CKEN(pxa25x_btuart, BTUART, 14745600, 1);
180 INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev), 175static DEFINE_CKEN(pxa25x_stuart, STUART, 14745600, 1);
181 INIT_CKEN("UARTCLK", STUART, 14745600, 1, NULL), 176static DEFINE_CKEN(pxa25x_usb, USB, 47923000, 5);
182 INIT_CKEN("UDCCLK", USB, 47923000, 5, &pxa25x_device_udc.dev), 177static DEFINE_CLK(pxa25x_gpio11, &clk_pxa25x_gpio11_ops, 3686400, 0);
183 INIT_CLK("GPIO11_CLK", &clk_pxa25x_gpio11_ops, 3686400, 0, NULL), 178static DEFINE_CLK(pxa25x_gpio12, &clk_pxa25x_gpio12_ops, 32768, 0);
184 INIT_CLK("GPIO12_CLK", &clk_pxa25x_gpio12_ops, 32768, 0, NULL), 179static DEFINE_CKEN(pxa25x_mmc, MMC, 19169000, 0);
185 INIT_CKEN("MMCCLK", MMC, 19169000, 0, &pxa_device_mci.dev), 180static DEFINE_CKEN(pxa25x_i2c, I2C, 31949000, 0);
186 INIT_CKEN("I2CCLK", I2C, 31949000, 0, &pxa_device_i2c.dev), 181static DEFINE_CKEN(pxa25x_ssp, SSP, 3686400, 0);
187 182static DEFINE_CKEN(pxa25x_nssp, NSSP, 3686400, 0);
188 INIT_CKEN("SSPCLK", SSP, 3686400, 0, &pxa25x_device_ssp.dev), 183static DEFINE_CKEN(pxa25x_assp, ASSP, 3686400, 0);
189 INIT_CKEN("SSPCLK", NSSP, 3686400, 0, &pxa25x_device_nssp.dev), 184static DEFINE_CKEN(pxa25x_pwm0, PWM0, 3686400, 0);
190 INIT_CKEN("SSPCLK", ASSP, 3686400, 0, &pxa25x_device_assp.dev), 185static DEFINE_CKEN(pxa25x_pwm1, PWM1, 3686400, 0);
191 INIT_CKEN("PWMCLK", PWM0, 3686400, 0, &pxa25x_device_pwm0.dev), 186static DEFINE_CKEN(pxa25x_ac97, AC97, 24576000, 0);
192 INIT_CKEN("PWMCLK", PWM1, 3686400, 0, &pxa25x_device_pwm1.dev), 187static DEFINE_CKEN(pxa25x_i2s, I2S, 14745600, 0);
193 188static DEFINE_CKEN(pxa25x_ficp, FICP, 47923000, 0);
194 INIT_CKEN("AC97CLK", AC97, 24576000, 0, NULL), 189
195 190static struct clk_lookup pxa25x_clkregs[] = {
196 /* 191 INIT_CLKREG(&clk_pxa25x_lcd, "pxa2xx-fb", NULL),
197 INIT_CKEN("I2SCLK", I2S, 14745600, 0, NULL), 192 INIT_CLKREG(&clk_pxa25x_ffuart, "pxa2xx-uart.0", NULL),
198 */ 193 INIT_CLKREG(&clk_pxa25x_btuart, "pxa2xx-uart.1", NULL),
199 INIT_CKEN("FICPCLK", FICP, 47923000, 0, NULL), 194 INIT_CLKREG(&clk_pxa25x_stuart, "pxa2xx-uart.2", NULL),
195 INIT_CLKREG(&clk_pxa25x_usb, "pxa25x-udc", NULL),
196 INIT_CLKREG(&clk_pxa25x_mmc, "pxa2xx-mci.0", NULL),
197 INIT_CLKREG(&clk_pxa25x_i2c, "pxa2xx-i2c.0", NULL),
198 INIT_CLKREG(&clk_pxa25x_ssp, "pxa25x-ssp.0", NULL),
199 INIT_CLKREG(&clk_pxa25x_nssp, "pxa25x-nssp.1", NULL),
200 INIT_CLKREG(&clk_pxa25x_assp, "pxa25x-nssp.2", NULL),
201 INIT_CLKREG(&clk_pxa25x_pwm0, "pxa25x-pwm.0", NULL),
202 INIT_CLKREG(&clk_pxa25x_pwm1, "pxa25x-pwm.1", NULL),
203 INIT_CLKREG(&clk_pxa25x_i2s, "pxa2xx-i2s", NULL),
204 INIT_CLKREG(&clk_pxa25x_stuart, "pxa2xx-ir", "UARTCLK"),
205 INIT_CLKREG(&clk_pxa25x_ficp, "pxa2xx-ir", "FICPCLK"),
206 INIT_CLKREG(&clk_pxa25x_ac97, NULL, "AC97CLK"),
207 INIT_CLKREG(&clk_pxa25x_gpio11, NULL, "GPIO11_CLK"),
208 INIT_CLKREG(&clk_pxa25x_gpio12, NULL, "GPIO12_CLK"),
200}; 209};
201 210
202#ifdef CONFIG_PM 211#ifdef CONFIG_PM
@@ -304,13 +313,21 @@ void __init pxa25x_init_irq(void)
304 pxa_init_gpio(85, pxa25x_set_wake); 313 pxa_init_gpio(85, pxa25x_set_wake);
305} 314}
306 315
316#ifdef CONFIG_CPU_PXA26x
317void __init pxa26x_init_irq(void)
318{
319 pxa_init_irq(32, pxa25x_set_wake);
320 pxa_init_gpio(90, pxa25x_set_wake);
321}
322#endif
323
307static struct platform_device *pxa25x_devices[] __initdata = { 324static struct platform_device *pxa25x_devices[] __initdata = {
308 &pxa25x_device_udc, 325 &pxa25x_device_udc,
309 &pxa_device_ffuart, 326 &pxa_device_ffuart,
310 &pxa_device_btuart, 327 &pxa_device_btuart,
311 &pxa_device_stuart, 328 &pxa_device_stuart,
312 &pxa_device_i2s, 329 &pxa_device_i2s,
313 &pxa_device_rtc, 330 &sa1100_device_rtc,
314 &pxa25x_device_ssp, 331 &pxa25x_device_ssp,
315 &pxa25x_device_nssp, 332 &pxa25x_device_nssp,
316 &pxa25x_device_assp, 333 &pxa25x_device_assp,
@@ -336,7 +353,7 @@ static int __init pxa25x_init(void)
336 353
337 reset_status = RCSR; 354 reset_status = RCSR;
338 355
339 clks_register(pxa25x_clks, ARRAY_SIZE(pxa25x_clks)); 356 clks_register(pxa25x_clkregs, ARRAY_SIZE(pxa25x_clkregs));
340 357
341 if ((ret = pxa_init_dma(16))) 358 if ((ret = pxa_init_dma(16)))
342 return ret; 359 return ret;
@@ -356,8 +373,8 @@ static int __init pxa25x_init(void)
356 } 373 }
357 374
358 /* Only add HWUART for PXA255/26x; PXA210/250 do not have it. */ 375 /* Only add HWUART for PXA255/26x; PXA210/250 do not have it. */
359 if (cpu_is_pxa255() || cpu_is_pxa26x()) { 376 if (cpu_is_pxa255()) {
360 clks_register(&pxa25x_hwuart_clk, 1); 377 clks_register(&pxa25x_hwuart_clkreg, 1);
361 ret = platform_device_register(&pxa_device_hwuart); 378 ret = platform_device_register(&pxa_device_hwuart);
362 } 379 }
363 380
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 3e4ab2279c99..411bec54fdc4 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -144,40 +144,59 @@ static const struct clkops clk_pxa27x_lcd_ops = {
144 .getrate = clk_pxa27x_lcd_getrate, 144 .getrate = clk_pxa27x_lcd_getrate,
145}; 145};
146 146
147static struct clk pxa27x_clks[] = { 147static DEFINE_CK(pxa27x_lcd, LCD, &clk_pxa27x_lcd_ops);
148 INIT_CK("LCDCLK", LCD, &clk_pxa27x_lcd_ops, &pxa_device_fb.dev), 148static DEFINE_CK(pxa27x_camera, CAMERA, &clk_pxa27x_lcd_ops);
149 INIT_CK("CAMCLK", CAMERA, &clk_pxa27x_lcd_ops, NULL), 149static DEFINE_CKEN(pxa27x_ffuart, FFUART, 14857000, 1);
150 150static DEFINE_CKEN(pxa27x_btuart, BTUART, 14857000, 1);
151 INIT_CKEN("UARTCLK", FFUART, 14857000, 1, &pxa_device_ffuart.dev), 151static DEFINE_CKEN(pxa27x_stuart, STUART, 14857000, 1);
152 INIT_CKEN("UARTCLK", BTUART, 14857000, 1, &pxa_device_btuart.dev), 152static DEFINE_CKEN(pxa27x_i2s, I2S, 14682000, 0);
153 INIT_CKEN("UARTCLK", STUART, 14857000, 1, NULL), 153static DEFINE_CKEN(pxa27x_i2c, I2C, 32842000, 0);
154 154static DEFINE_CKEN(pxa27x_usb, USB, 48000000, 5);
155 INIT_CKEN("I2SCLK", I2S, 14682000, 0, &pxa_device_i2s.dev), 155static DEFINE_CKEN(pxa27x_mmc, MMC, 19500000, 0);
156 INIT_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev), 156static DEFINE_CKEN(pxa27x_ficp, FICP, 48000000, 0);
157 INIT_CKEN("UDCCLK", USB, 48000000, 5, &pxa27x_device_udc.dev), 157static DEFINE_CKEN(pxa27x_usbhost, USBHOST, 48000000, 0);
158 INIT_CKEN("MMCCLK", MMC, 19500000, 0, &pxa_device_mci.dev), 158static DEFINE_CKEN(pxa27x_pwri2c, PWRI2C, 13000000, 0);
159 INIT_CKEN("FICPCLK", FICP, 48000000, 0, &pxa_device_ficp.dev), 159static DEFINE_CKEN(pxa27x_keypad, KEYPAD, 32768, 0);
160 160static DEFINE_CKEN(pxa27x_ssp1, SSP1, 13000000, 0);
161 INIT_CKEN("USBCLK", USBHOST, 48000000, 0, &pxa27x_device_ohci.dev), 161static DEFINE_CKEN(pxa27x_ssp2, SSP2, 13000000, 0);
162 INIT_CKEN("I2CCLK", PWRI2C, 13000000, 0, &pxa27x_device_i2c_power.dev), 162static DEFINE_CKEN(pxa27x_ssp3, SSP3, 13000000, 0);
163 INIT_CKEN("KBDCLK", KEYPAD, 32768, 0, &pxa27x_device_keypad.dev), 163static DEFINE_CKEN(pxa27x_pwm0, PWM0, 13000000, 0);
164 164static DEFINE_CKEN(pxa27x_pwm1, PWM1, 13000000, 0);
165 INIT_CKEN("SSPCLK", SSP1, 13000000, 0, &pxa27x_device_ssp1.dev), 165static DEFINE_CKEN(pxa27x_ac97, AC97, 24576000, 0);
166 INIT_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev), 166static DEFINE_CKEN(pxa27x_ac97conf, AC97CONF, 24576000, 0);
167 INIT_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev), 167static DEFINE_CKEN(pxa27x_msl, MSL, 48000000, 0);
168 INIT_CKEN("PWMCLK", PWM0, 13000000, 0, &pxa27x_device_pwm0.dev), 168static DEFINE_CKEN(pxa27x_usim, USIM, 48000000, 0);
169 INIT_CKEN("PWMCLK", PWM1, 13000000, 0, &pxa27x_device_pwm1.dev), 169static DEFINE_CKEN(pxa27x_memstk, MEMSTK, 19500000, 0);
170 170static DEFINE_CKEN(pxa27x_im, IM, 0, 0);
171 INIT_CKEN("AC97CLK", AC97, 24576000, 0, NULL), 171static DEFINE_CKEN(pxa27x_memc, MEMC, 0, 0);
172 INIT_CKEN("AC97CONFCLK", AC97CONF, 24576000, 0, NULL), 172
173 173static struct clk_lookup pxa27x_clkregs[] = {
174 /* 174 INIT_CLKREG(&clk_pxa27x_lcd, "pxa2xx-fb", NULL),
175 INIT_CKEN("MSLCLK", MSL, 48000000, 0, NULL), 175 INIT_CLKREG(&clk_pxa27x_camera, "pxa27x-camera.0", NULL),
176 INIT_CKEN("USIMCLK", USIM, 48000000, 0, NULL), 176 INIT_CLKREG(&clk_pxa27x_ffuart, "pxa2xx-uart.0", NULL),
177 INIT_CKEN("MSTKCLK", MEMSTK, 19500000, 0, NULL), 177 INIT_CLKREG(&clk_pxa27x_btuart, "pxa2xx-uart.1", NULL),
178 INIT_CKEN("IMCLK", IM, 0, 0, NULL), 178 INIT_CLKREG(&clk_pxa27x_stuart, "pxa2xx-uart.2", NULL),
179 INIT_CKEN("MEMCLK", MEMC, 0, 0, NULL), 179 INIT_CLKREG(&clk_pxa27x_i2s, "pxa2xx-i2s", NULL),
180 */ 180 INIT_CLKREG(&clk_pxa27x_i2c, "pxa2xx-i2c.0", NULL),
181 INIT_CLKREG(&clk_pxa27x_usb, "pxa27x-udc", NULL),
182 INIT_CLKREG(&clk_pxa27x_mmc, "pxa2xx-mci.0", NULL),
183 INIT_CLKREG(&clk_pxa27x_stuart, "pxa2xx-ir", "UARTCLK"),
184 INIT_CLKREG(&clk_pxa27x_ficp, "pxa2xx-ir", "FICPCLK"),
185 INIT_CLKREG(&clk_pxa27x_usbhost, "pxa27x-ohci", NULL),
186 INIT_CLKREG(&clk_pxa27x_pwri2c, "pxa2xx-i2c.1", NULL),
187 INIT_CLKREG(&clk_pxa27x_keypad, "pxa27x-keypad", NULL),
188 INIT_CLKREG(&clk_pxa27x_ssp1, "pxa27x-ssp.0", NULL),
189 INIT_CLKREG(&clk_pxa27x_ssp2, "pxa27x-ssp.1", NULL),
190 INIT_CLKREG(&clk_pxa27x_ssp3, "pxa27x-ssp.2", NULL),
191 INIT_CLKREG(&clk_pxa27x_pwm0, "pxa27x-pwm.0", NULL),
192 INIT_CLKREG(&clk_pxa27x_pwm1, "pxa27x-pwm.1", NULL),
193 INIT_CLKREG(&clk_pxa27x_ac97, NULL, "AC97CLK"),
194 INIT_CLKREG(&clk_pxa27x_ac97conf, NULL, "AC97CONFCLK"),
195 INIT_CLKREG(&clk_pxa27x_msl, NULL, "MSLCLK"),
196 INIT_CLKREG(&clk_pxa27x_usim, NULL, "USIMCLK"),
197 INIT_CLKREG(&clk_pxa27x_memstk, NULL, "MSTKCLK"),
198 INIT_CLKREG(&clk_pxa27x_im, NULL, "IMCLK"),
199 INIT_CLKREG(&clk_pxa27x_memc, NULL, "MEMCLK"),
181}; 200};
182 201
183#ifdef CONFIG_PM 202#ifdef CONFIG_PM
@@ -313,38 +332,18 @@ static int pxa27x_set_wake(unsigned int irq, unsigned int on)
313void __init pxa27x_init_irq(void) 332void __init pxa27x_init_irq(void)
314{ 333{
315 pxa_init_irq(34, pxa27x_set_wake); 334 pxa_init_irq(34, pxa27x_set_wake);
316 pxa_init_gpio(128, pxa27x_set_wake); 335 pxa_init_gpio(121, pxa27x_set_wake);
317} 336}
318 337
319/* 338/*
320 * device registration specific to PXA27x. 339 * device registration specific to PXA27x.
321 */ 340 */
322
323static struct resource i2c_power_resources[] = {
324 {
325 .start = 0x40f00180,
326 .end = 0x40f001a3,
327 .flags = IORESOURCE_MEM,
328 }, {
329 .start = IRQ_PWRI2C,
330 .end = IRQ_PWRI2C,
331 .flags = IORESOURCE_IRQ,
332 },
333};
334
335struct platform_device pxa27x_device_i2c_power = {
336 .name = "pxa2xx-i2c",
337 .id = 1,
338 .resource = i2c_power_resources,
339 .num_resources = ARRAY_SIZE(i2c_power_resources),
340};
341
342void __init pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info) 341void __init pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info)
343{ 342{
344 local_irq_disable(); 343 local_irq_disable();
345 PCFR |= PCFR_PI2CEN; 344 PCFR |= PCFR_PI2CEN;
346 local_irq_enable(); 345 local_irq_enable();
347 pxa27x_device_i2c_power.dev.platform_data = info; 346 pxa_register_device(&pxa27x_device_i2c_power, info);
348} 347}
349 348
350static struct platform_device *devices[] __initdata = { 349static struct platform_device *devices[] __initdata = {
@@ -353,8 +352,8 @@ static struct platform_device *devices[] __initdata = {
353 &pxa_device_btuart, 352 &pxa_device_btuart,
354 &pxa_device_stuart, 353 &pxa_device_stuart,
355 &pxa_device_i2s, 354 &pxa_device_i2s,
355 &sa1100_device_rtc,
356 &pxa_device_rtc, 356 &pxa_device_rtc,
357 &pxa27x_device_i2c_power,
358 &pxa27x_device_ssp1, 357 &pxa27x_device_ssp1,
359 &pxa27x_device_ssp2, 358 &pxa27x_device_ssp2,
360 &pxa27x_device_ssp3, 359 &pxa27x_device_ssp3,
@@ -380,7 +379,7 @@ static int __init pxa27x_init(void)
380 379
381 reset_status = RCSR; 380 reset_status = RCSR;
382 381
383 clks_register(pxa27x_clks, ARRAY_SIZE(pxa27x_clks)); 382 clks_register(pxa27x_clkregs, ARRAY_SIZE(pxa27x_clkregs));
384 383
385 if ((ret = pxa_init_dma(32))) 384 if ((ret = pxa_init_dma(32)))
386 return ret; 385 return ret;
diff --git a/arch/arm/mach-pxa/pxa300.c b/arch/arm/mach-pxa/pxa300.c
index 9adc7fc4618a..f735e58e6669 100644
--- a/arch/arm/mach-pxa/pxa300.c
+++ b/arch/arm/mach-pxa/pxa300.c
@@ -85,14 +85,16 @@ static struct pxa3xx_mfp_addr_map pxa310_mfp_addr_map[] __initdata = {
85 MFP_ADDR_END, 85 MFP_ADDR_END,
86}; 86};
87 87
88static struct clk common_clks[] = { 88static DEFINE_PXA3_CKEN(common_nand, NAND, 156000000, 0);
89 PXA3xx_CKEN("NANDCLK", NAND, 156000000, 0, &pxa3xx_device_nand.dev), 89
90static struct clk_lookup common_clkregs[] = {
91 INIT_CLKREG(&clk_common_nand, "pxa3xx-nand", "NANDCLK"),
90}; 92};
91 93
92static struct clk pxa310_clks[] = { 94static DEFINE_PXA3_CKEN(pxa310_mmc3, MMC3, 19500000, 0);
93#ifdef CONFIG_CPU_PXA310 95
94 PXA3xx_CKEN("MMCCLK", MMC3, 19500000, 0, &pxa3xx_device_mci3.dev), 96static struct clk_lookup pxa310_clkregs[] = {
95#endif 97 INIT_CLKREG(&clk_pxa310_mmc3, "pxa2xx-mci.2", "MMCCLK"),
96}; 98};
97 99
98static int __init pxa300_init(void) 100static int __init pxa300_init(void)
@@ -100,12 +102,12 @@ static int __init pxa300_init(void)
100 if (cpu_is_pxa300() || cpu_is_pxa310()) { 102 if (cpu_is_pxa300() || cpu_is_pxa310()) {
101 pxa3xx_init_mfp(); 103 pxa3xx_init_mfp();
102 pxa3xx_mfp_init_addr(pxa300_mfp_addr_map); 104 pxa3xx_mfp_init_addr(pxa300_mfp_addr_map);
103 clks_register(ARRAY_AND_SIZE(common_clks)); 105 clks_register(ARRAY_AND_SIZE(common_clkregs));
104 } 106 }
105 107
106 if (cpu_is_pxa310()) { 108 if (cpu_is_pxa310()) {
107 pxa3xx_mfp_init_addr(pxa310_mfp_addr_map); 109 pxa3xx_mfp_init_addr(pxa310_mfp_addr_map);
108 clks_register(ARRAY_AND_SIZE(pxa310_clks)); 110 clks_register(ARRAY_AND_SIZE(pxa310_clkregs));
109 } 111 }
110 112
111 return 0; 113 return 0;
diff --git a/arch/arm/mach-pxa/pxa320.c b/arch/arm/mach-pxa/pxa320.c
index 016eb18f01a3..effe408c186f 100644
--- a/arch/arm/mach-pxa/pxa320.c
+++ b/arch/arm/mach-pxa/pxa320.c
@@ -80,8 +80,10 @@ static struct pxa3xx_mfp_addr_map pxa320_mfp_addr_map[] __initdata = {
80 MFP_ADDR_END, 80 MFP_ADDR_END,
81}; 81};
82 82
83static struct clk pxa320_clks[] = { 83static DEFINE_PXA3_CKEN(pxa320_nand, NAND, 104000000, 0);
84 PXA3xx_CKEN("NANDCLK", NAND, 104000000, 0, &pxa3xx_device_nand.dev), 84
85static struct clk_lookup pxa320_clkregs[] = {
86 INIT_CLKREG(&clk_pxa320_nand, "pxa3xx-nand", "NANDCLK"),
85}; 87};
86 88
87static int __init pxa320_init(void) 89static int __init pxa320_init(void)
@@ -89,7 +91,7 @@ static int __init pxa320_init(void)
89 if (cpu_is_pxa320()) { 91 if (cpu_is_pxa320()) {
90 pxa3xx_init_mfp(); 92 pxa3xx_init_mfp();
91 pxa3xx_mfp_init_addr(pxa320_mfp_addr_map); 93 pxa3xx_mfp_init_addr(pxa320_mfp_addr_map);
92 clks_register(ARRAY_AND_SIZE(pxa320_clks)); 94 clks_register(ARRAY_AND_SIZE(pxa320_clkregs));
93 } 95 }
94 96
95 return 0; 97 return 0;
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index b3cd5d0b0f35..490893824e78 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -29,6 +29,7 @@
29#include <mach/pm.h> 29#include <mach/pm.h>
30#include <mach/dma.h> 30#include <mach/dma.h>
31#include <mach/ssp.h> 31#include <mach/ssp.h>
32#include <mach/i2c.h>
32 33
33#include "generic.h" 34#include "generic.h"
34#include "devices.h" 35#include "devices.h"
@@ -216,43 +217,58 @@ static const struct clkops clk_dummy_ops = {
216 .disable = clk_dummy_disable, 217 .disable = clk_dummy_disable,
217}; 218};
218 219
219static struct clk pxa3xx_clks[] = { 220static struct clk clk_pxa3xx_pout = {
220 { 221 .ops = &clk_pout_ops,
221 .name = "CLK_POUT", 222 .rate = 13000000,
222 .ops = &clk_pout_ops, 223 .delay = 70,
223 .rate = 13000000, 224};
224 .delay = 70,
225 },
226
227 /* Power I2C clock is always on */
228 {
229 .name = "I2CCLK",
230 .ops = &clk_dummy_ops,
231 .dev = &pxa3xx_device_i2c_power.dev,
232 },
233
234 PXA3xx_CK("LCDCLK", LCD, &clk_pxa3xx_hsio_ops, &pxa_device_fb.dev),
235 PXA3xx_CK("CAMCLK", CAMERA, &clk_pxa3xx_hsio_ops, NULL),
236 PXA3xx_CK("AC97CLK", AC97, &clk_pxa3xx_ac97_ops, NULL),
237
238 PXA3xx_CKEN("UARTCLK", FFUART, 14857000, 1, &pxa_device_ffuart.dev),
239 PXA3xx_CKEN("UARTCLK", BTUART, 14857000, 1, &pxa_device_btuart.dev),
240 PXA3xx_CKEN("UARTCLK", STUART, 14857000, 1, NULL),
241
242 PXA3xx_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev),
243 PXA3xx_CKEN("UDCCLK", UDC, 48000000, 5, &pxa27x_device_udc.dev),
244 PXA3xx_CKEN("USBCLK", USBH, 48000000, 0, &pxa27x_device_ohci.dev),
245 PXA3xx_CKEN("KBDCLK", KEYPAD, 32768, 0, &pxa27x_device_keypad.dev),
246 225
247 PXA3xx_CKEN("SSPCLK", SSP1, 13000000, 0, &pxa27x_device_ssp1.dev), 226static struct clk clk_dummy = {
248 PXA3xx_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev), 227 .ops = &clk_dummy_ops,
249 PXA3xx_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev), 228};
250 PXA3xx_CKEN("SSPCLK", SSP4, 13000000, 0, &pxa3xx_device_ssp4.dev),
251 PXA3xx_CKEN("PWMCLK", PWM0, 13000000, 0, &pxa27x_device_pwm0.dev),
252 PXA3xx_CKEN("PWMCLK", PWM1, 13000000, 0, &pxa27x_device_pwm1.dev),
253 229
254 PXA3xx_CKEN("MMCCLK", MMC1, 19500000, 0, &pxa_device_mci.dev), 230static DEFINE_PXA3_CK(pxa3xx_lcd, LCD, &clk_pxa3xx_hsio_ops);
255 PXA3xx_CKEN("MMCCLK", MMC2, 19500000, 0, &pxa3xx_device_mci2.dev), 231static DEFINE_PXA3_CK(pxa3xx_camera, CAMERA, &clk_pxa3xx_hsio_ops);
232static DEFINE_PXA3_CK(pxa3xx_ac97, AC97, &clk_pxa3xx_ac97_ops);
233static DEFINE_PXA3_CKEN(pxa3xx_ffuart, FFUART, 14857000, 1);
234static DEFINE_PXA3_CKEN(pxa3xx_btuart, BTUART, 14857000, 1);
235static DEFINE_PXA3_CKEN(pxa3xx_stuart, STUART, 14857000, 1);
236static DEFINE_PXA3_CKEN(pxa3xx_i2c, I2C, 32842000, 0);
237static DEFINE_PXA3_CKEN(pxa3xx_udc, UDC, 48000000, 5);
238static DEFINE_PXA3_CKEN(pxa3xx_usbh, USBH, 48000000, 0);
239static DEFINE_PXA3_CKEN(pxa3xx_keypad, KEYPAD, 32768, 0);
240static DEFINE_PXA3_CKEN(pxa3xx_ssp1, SSP1, 13000000, 0);
241static DEFINE_PXA3_CKEN(pxa3xx_ssp2, SSP2, 13000000, 0);
242static DEFINE_PXA3_CKEN(pxa3xx_ssp3, SSP3, 13000000, 0);
243static DEFINE_PXA3_CKEN(pxa3xx_ssp4, SSP4, 13000000, 0);
244static DEFINE_PXA3_CKEN(pxa3xx_pwm0, PWM0, 13000000, 0);
245static DEFINE_PXA3_CKEN(pxa3xx_pwm1, PWM1, 13000000, 0);
246static DEFINE_PXA3_CKEN(pxa3xx_mmc1, MMC1, 19500000, 0);
247static DEFINE_PXA3_CKEN(pxa3xx_mmc2, MMC2, 19500000, 0);
248
249static struct clk_lookup pxa3xx_clkregs[] = {
250 INIT_CLKREG(&clk_pxa3xx_pout, NULL, "CLK_POUT"),
251 /* Power I2C clock is always on */
252 INIT_CLKREG(&clk_dummy, "pxa2xx-i2c.1", NULL),
253 INIT_CLKREG(&clk_pxa3xx_lcd, "pxa2xx-fb", NULL),
254 INIT_CLKREG(&clk_pxa3xx_camera, NULL, "CAMCLK"),
255 INIT_CLKREG(&clk_pxa3xx_ac97, NULL, "AC97CLK"),
256 INIT_CLKREG(&clk_pxa3xx_ffuart, "pxa2xx-uart.0", NULL),
257 INIT_CLKREG(&clk_pxa3xx_btuart, "pxa2xx-uart.1", NULL),
258 INIT_CLKREG(&clk_pxa3xx_stuart, "pxa2xx-uart.2", NULL),
259 INIT_CLKREG(&clk_pxa3xx_stuart, "pxa2xx-ir", "UARTCLK"),
260 INIT_CLKREG(&clk_pxa3xx_i2c, "pxa2xx-i2c.0", NULL),
261 INIT_CLKREG(&clk_pxa3xx_udc, "pxa27x-udc", NULL),
262 INIT_CLKREG(&clk_pxa3xx_usbh, "pxa27x-ohci", NULL),
263 INIT_CLKREG(&clk_pxa3xx_keypad, "pxa27x-keypad", NULL),
264 INIT_CLKREG(&clk_pxa3xx_ssp1, "pxa27x-ssp.0", NULL),
265 INIT_CLKREG(&clk_pxa3xx_ssp2, "pxa27x-ssp.1", NULL),
266 INIT_CLKREG(&clk_pxa3xx_ssp3, "pxa27x-ssp.2", NULL),
267 INIT_CLKREG(&clk_pxa3xx_ssp4, "pxa27x-ssp.3", NULL),
268 INIT_CLKREG(&clk_pxa3xx_pwm0, "pxa27x-pwm.0", NULL),
269 INIT_CLKREG(&clk_pxa3xx_pwm1, "pxa27x-pwm.1", NULL),
270 INIT_CLKREG(&clk_pxa3xx_mmc1, "pxa2xx-mci.0", NULL),
271 INIT_CLKREG(&clk_pxa3xx_mmc2, "pxa2xx-mci.1", NULL),
256}; 272};
257 273
258#ifdef CONFIG_PM 274#ifdef CONFIG_PM
@@ -529,28 +545,9 @@ void __init pxa3xx_init_irq(void)
529 * device registration specific to PXA3xx. 545 * device registration specific to PXA3xx.
530 */ 546 */
531 547
532static struct resource i2c_power_resources[] = {
533 {
534 .start = 0x40f500c0,
535 .end = 0x40f500d3,
536 .flags = IORESOURCE_MEM,
537 }, {
538 .start = IRQ_PWRI2C,
539 .end = IRQ_PWRI2C,
540 .flags = IORESOURCE_IRQ,
541 },
542};
543
544struct platform_device pxa3xx_device_i2c_power = {
545 .name = "pxa2xx-i2c",
546 .id = 1,
547 .resource = i2c_power_resources,
548 .num_resources = ARRAY_SIZE(i2c_power_resources),
549};
550
551void __init pxa3xx_set_i2c_power_info(struct i2c_pxa_platform_data *info) 548void __init pxa3xx_set_i2c_power_info(struct i2c_pxa_platform_data *info)
552{ 549{
553 pxa3xx_device_i2c_power.dev.platform_data = info; 550 pxa_register_device(&pxa3xx_device_i2c_power, info);
554} 551}
555 552
556static struct platform_device *devices[] __initdata = { 553static struct platform_device *devices[] __initdata = {
@@ -559,6 +556,7 @@ static struct platform_device *devices[] __initdata = {
559 &pxa_device_btuart, 556 &pxa_device_btuart,
560 &pxa_device_stuart, 557 &pxa_device_stuart,
561 &pxa_device_i2s, 558 &pxa_device_i2s,
559 &sa1100_device_rtc,
562 &pxa_device_rtc, 560 &pxa_device_rtc,
563 &pxa27x_device_ssp1, 561 &pxa27x_device_ssp1,
564 &pxa27x_device_ssp2, 562 &pxa27x_device_ssp2,
@@ -566,7 +564,6 @@ static struct platform_device *devices[] __initdata = {
566 &pxa3xx_device_ssp4, 564 &pxa3xx_device_ssp4,
567 &pxa27x_device_pwm0, 565 &pxa27x_device_pwm0,
568 &pxa27x_device_pwm1, 566 &pxa27x_device_pwm1,
569 &pxa3xx_device_i2c_power,
570}; 567};
571 568
572static struct sys_device pxa3xx_sysdev[] = { 569static struct sys_device pxa3xx_sysdev[] = {
@@ -595,7 +592,7 @@ static int __init pxa3xx_init(void)
595 */ 592 */
596 ASCR &= ~(ASCR_RDH | ASCR_D1S | ASCR_D2S | ASCR_D3S); 593 ASCR &= ~(ASCR_RDH | ASCR_D1S | ASCR_D2S | ASCR_D3S);
597 594
598 clks_register(pxa3xx_clks, ARRAY_SIZE(pxa3xx_clks)); 595 clks_register(pxa3xx_clkregs, ARRAY_SIZE(pxa3xx_clkregs));
599 596
600 if ((ret = pxa_init_dma(32))) 597 if ((ret = pxa_init_dma(32)))
601 return ret; 598 return ret;
diff --git a/arch/arm/mach-pxa/saar.c b/arch/arm/mach-pxa/saar.c
index e7ea91ce7f02..5d02a7325586 100644
--- a/arch/arm/mach-pxa/saar.c
+++ b/arch/arm/mach-pxa/saar.c
@@ -17,19 +17,44 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/delay.h>
21#include <linux/fb.h>
22#include <linux/i2c.h>
20#include <linux/smc91x.h> 23#include <linux/smc91x.h>
24#include <linux/mfd/da903x.h>
21 25
22#include <asm/mach-types.h> 26#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
24#include <mach/hardware.h> 28#include <mach/hardware.h>
25#include <mach/pxa3xx-regs.h> 29#include <mach/pxa3xx-regs.h>
26#include <mach/mfp-pxa930.h> 30#include <mach/mfp-pxa930.h>
31#include <mach/i2c.h>
32#include <mach/regs-lcd.h>
33#include <mach/pxafb.h>
27 34
28#include "devices.h" 35#include "devices.h"
29#include "generic.h" 36#include "generic.h"
30 37
38#define GPIO_LCD_RESET (16)
39
31/* SAAR MFP configurations */ 40/* SAAR MFP configurations */
32static mfp_cfg_t saar_mfp_cfg[] __initdata = { 41static mfp_cfg_t saar_mfp_cfg[] __initdata = {
42 /* LCD */
43 GPIO23_LCD_DD0,
44 GPIO24_LCD_DD1,
45 GPIO25_LCD_DD2,
46 GPIO26_LCD_DD3,
47 GPIO27_LCD_DD4,
48 GPIO28_LCD_DD5,
49 GPIO29_LCD_DD6,
50 GPIO44_LCD_DD7,
51 GPIO21_LCD_CS,
52 GPIO22_LCD_VSYNC,
53 GPIO17_LCD_FCLK_RD,
54 GPIO18_LCD_LCLK_A0,
55 GPIO19_LCD_PCLK_WR,
56 GPIO16_GPIO, /* LCD reset */
57
33 /* Ethernet */ 58 /* Ethernet */
34 DF_nCS1_nCS3, 59 DF_nCS1_nCS3,
35 GPIO97_GPIO, 60 GPIO97_GPIO,
@@ -64,12 +89,408 @@ static struct platform_device smc91x_device = {
64 }, 89 },
65}; 90};
66 91
92#if defined(CONFIG_FB_PXA) || (CONFIG_FB_PXA_MODULE)
93static uint16_t lcd_power_on[] = {
94 /* single frame */
95 SMART_CMD_NOOP,
96 SMART_CMD(0x00),
97 SMART_DELAY(0),
98
99 SMART_CMD_NOOP,
100 SMART_CMD(0x00),
101 SMART_DELAY(0),
102
103 SMART_CMD_NOOP,
104 SMART_CMD(0x00),
105 SMART_DELAY(0),
106
107 SMART_CMD_NOOP,
108 SMART_CMD(0x00),
109 SMART_DELAY(10),
110
111 /* calibration control */
112 SMART_CMD(0x00),
113 SMART_CMD(0xA4),
114 SMART_DAT(0x80),
115 SMART_DAT(0x01),
116 SMART_DELAY(150),
117
118 /*Power-On Init sequence*/
119 SMART_CMD(0x00), /* output ctrl */
120 SMART_CMD(0x01),
121 SMART_DAT(0x01),
122 SMART_DAT(0x00),
123 SMART_CMD(0x00), /* wave ctrl */
124 SMART_CMD(0x02),
125 SMART_DAT(0x07),
126 SMART_DAT(0x00),
127 SMART_CMD(0x00),
128 SMART_CMD(0x03), /* entry mode */
129 SMART_DAT(0xD0),
130 SMART_DAT(0x30),
131 SMART_CMD(0x00),
132 SMART_CMD(0x08), /* display ctrl 2 */
133 SMART_DAT(0x08),
134 SMART_DAT(0x08),
135 SMART_CMD(0x00),
136 SMART_CMD(0x09), /* display ctrl 3 */
137 SMART_DAT(0x04),
138 SMART_DAT(0x2F),
139 SMART_CMD(0x00),
140 SMART_CMD(0x0A), /* display ctrl 4 */
141 SMART_DAT(0x00),
142 SMART_DAT(0x08),
143 SMART_CMD(0x00),
144 SMART_CMD(0x0D), /* Frame Marker position */
145 SMART_DAT(0x00),
146 SMART_DAT(0x08),
147 SMART_CMD(0x00),
148 SMART_CMD(0x60), /* Driver output control */
149 SMART_DAT(0x27),
150 SMART_DAT(0x00),
151 SMART_CMD(0x00),
152 SMART_CMD(0x61), /* Base image display control */
153 SMART_DAT(0x00),
154 SMART_DAT(0x01),
155 SMART_CMD(0x00),
156 SMART_CMD(0x30), /* Y settings 30h-3Dh */
157 SMART_DAT(0x07),
158 SMART_DAT(0x07),
159 SMART_CMD(0x00),
160 SMART_CMD(0x31),
161 SMART_DAT(0x00),
162 SMART_DAT(0x07),
163 SMART_CMD(0x00),
164 SMART_CMD(0x32), /* Timing(3), ASW HOLD=0.5CLK */
165 SMART_DAT(0x04),
166 SMART_DAT(0x00),
167 SMART_CMD(0x00),
168 SMART_CMD(0x33), /* Timing(4), CKV ST=0CLK, CKV ED=1CLK */
169 SMART_DAT(0x03),
170 SMART_DAT(0x03),
171 SMART_CMD(0x00),
172 SMART_CMD(0x34),
173 SMART_DAT(0x00),
174 SMART_DAT(0x00),
175 SMART_CMD(0x00),
176 SMART_CMD(0x35),
177 SMART_DAT(0x02),
178 SMART_DAT(0x05),
179 SMART_CMD(0x00),
180 SMART_CMD(0x36),
181 SMART_DAT(0x1F),
182 SMART_DAT(0x1F),
183 SMART_CMD(0x00),
184 SMART_CMD(0x37),
185 SMART_DAT(0x07),
186 SMART_DAT(0x07),
187 SMART_CMD(0x00),
188 SMART_CMD(0x38),
189 SMART_DAT(0x00),
190 SMART_DAT(0x07),
191 SMART_CMD(0x00),
192 SMART_CMD(0x39),
193 SMART_DAT(0x04),
194 SMART_DAT(0x00),
195 SMART_CMD(0x00),
196 SMART_CMD(0x3A),
197 SMART_DAT(0x03),
198 SMART_DAT(0x03),
199 SMART_CMD(0x00),
200 SMART_CMD(0x3B),
201 SMART_DAT(0x00),
202 SMART_DAT(0x00),
203 SMART_CMD(0x00),
204 SMART_CMD(0x3C),
205 SMART_DAT(0x02),
206 SMART_DAT(0x05),
207 SMART_CMD(0x00),
208 SMART_CMD(0x3D),
209 SMART_DAT(0x1F),
210 SMART_DAT(0x1F),
211 SMART_CMD(0x00), /* Display control 1 */
212 SMART_CMD(0x07),
213 SMART_DAT(0x00),
214 SMART_DAT(0x01),
215 SMART_CMD(0x00), /* Power control 5 */
216 SMART_CMD(0x17),
217 SMART_DAT(0x00),
218 SMART_DAT(0x01),
219 SMART_CMD(0x00), /* Power control 1 */
220 SMART_CMD(0x10),
221 SMART_DAT(0x10),
222 SMART_DAT(0xB0),
223 SMART_CMD(0x00), /* Power control 2 */
224 SMART_CMD(0x11),
225 SMART_DAT(0x01),
226 SMART_DAT(0x30),
227 SMART_CMD(0x00), /* Power control 3 */
228 SMART_CMD(0x12),
229 SMART_DAT(0x01),
230 SMART_DAT(0x9E),
231 SMART_CMD(0x00), /* Power control 4 */
232 SMART_CMD(0x13),
233 SMART_DAT(0x17),
234 SMART_DAT(0x00),
235 SMART_CMD(0x00), /* Power control 3 */
236 SMART_CMD(0x12),
237 SMART_DAT(0x01),
238 SMART_DAT(0xBE),
239 SMART_DELAY(100),
240
241 /* display mode : 240*320 */
242 SMART_CMD(0x00), /* RAM address set(H) 0*/
243 SMART_CMD(0x20),
244 SMART_DAT(0x00),
245 SMART_DAT(0x00),
246 SMART_CMD(0x00), /* RAM address set(V) 4*/
247 SMART_CMD(0x21),
248 SMART_DAT(0x00),
249 SMART_DAT(0x00),
250 SMART_CMD(0x00), /* Start of Window RAM address set(H) 8*/
251 SMART_CMD(0x50),
252 SMART_DAT(0x00),
253 SMART_DAT(0x00),
254 SMART_CMD(0x00), /* End of Window RAM address set(H) 12*/
255 SMART_CMD(0x51),
256 SMART_DAT(0x00),
257 SMART_DAT(0xEF),
258 SMART_CMD(0x00), /* Start of Window RAM address set(V) 16*/
259 SMART_CMD(0x52),
260 SMART_DAT(0x00),
261 SMART_DAT(0x00),
262 SMART_CMD(0x00), /* End of Window RAM address set(V) 20*/
263 SMART_CMD(0x53),
264 SMART_DAT(0x01),
265 SMART_DAT(0x3F),
266 SMART_CMD(0x00), /* Panel interface control 1 */
267 SMART_CMD(0x90),
268 SMART_DAT(0x00),
269 SMART_DAT(0x1A),
270 SMART_CMD(0x00), /* Panel interface control 2 */
271 SMART_CMD(0x92),
272 SMART_DAT(0x04),
273 SMART_DAT(0x00),
274 SMART_CMD(0x00), /* Panel interface control 3 */
275 SMART_CMD(0x93),
276 SMART_DAT(0x00),
277 SMART_DAT(0x05),
278 SMART_DELAY(20),
279};
280
281static uint16_t lcd_panel_on[] = {
282 SMART_CMD(0x00),
283 SMART_CMD(0x07),
284 SMART_DAT(0x00),
285 SMART_DAT(0x21),
286 SMART_DELAY(1),
287
288 SMART_CMD(0x00),
289 SMART_CMD(0x07),
290 SMART_DAT(0x00),
291 SMART_DAT(0x61),
292 SMART_DELAY(100),
293
294 SMART_CMD(0x00),
295 SMART_CMD(0x07),
296 SMART_DAT(0x01),
297 SMART_DAT(0x73),
298 SMART_DELAY(1),
299};
300
301static uint16_t lcd_panel_off[] = {
302 SMART_CMD(0x00),
303 SMART_CMD(0x07),
304 SMART_DAT(0x00),
305 SMART_DAT(0x72),
306 SMART_DELAY(40),
307
308 SMART_CMD(0x00),
309 SMART_CMD(0x07),
310 SMART_DAT(0x00),
311 SMART_DAT(0x01),
312 SMART_DELAY(1),
313
314 SMART_CMD(0x00),
315 SMART_CMD(0x07),
316 SMART_DAT(0x00),
317 SMART_DAT(0x00),
318 SMART_DELAY(1),
319};
320
321static uint16_t lcd_power_off[] = {
322 SMART_CMD(0x00),
323 SMART_CMD(0x10),
324 SMART_DAT(0x00),
325 SMART_DAT(0x80),
326
327 SMART_CMD(0x00),
328 SMART_CMD(0x11),
329 SMART_DAT(0x01),
330 SMART_DAT(0x60),
331
332 SMART_CMD(0x00),
333 SMART_CMD(0x12),
334 SMART_DAT(0x01),
335 SMART_DAT(0xAE),
336 SMART_DELAY(40),
337
338 SMART_CMD(0x00),
339 SMART_CMD(0x10),
340 SMART_DAT(0x00),
341 SMART_DAT(0x00),
342};
343
344static uint16_t update_framedata[] = {
345 /* set display ram: 240*320 */
346 SMART_CMD(0x00), /* RAM address set(H) 0*/
347 SMART_CMD(0x20),
348 SMART_DAT(0x00),
349 SMART_DAT(0x00),
350 SMART_CMD(0x00), /* RAM address set(V) 4*/
351 SMART_CMD(0x21),
352 SMART_DAT(0x00),
353 SMART_DAT(0x00),
354 SMART_CMD(0x00), /* Start of Window RAM address set(H) 8 */
355 SMART_CMD(0x50),
356 SMART_DAT(0x00),
357 SMART_DAT(0x00),
358 SMART_CMD(0x00), /* End of Window RAM address set(H) 12 */
359 SMART_CMD(0x51),
360 SMART_DAT(0x00),
361 SMART_DAT(0xEF),
362 SMART_CMD(0x00), /* Start of Window RAM address set(V) 16 */
363 SMART_CMD(0x52),
364 SMART_DAT(0x00),
365 SMART_DAT(0x00),
366 SMART_CMD(0x00), /* End of Window RAM address set(V) 20 */
367 SMART_CMD(0x53),
368 SMART_DAT(0x01),
369 SMART_DAT(0x3F),
370
371 /* wait for vsync cmd before transferring frame data */
372 SMART_CMD_WAIT_FOR_VSYNC,
373
374 /* write ram */
375 SMART_CMD(0x00),
376 SMART_CMD(0x22),
377
378 /* write frame data */
379 SMART_CMD_WRITE_FRAME,
380};
381
382static void ltm022a97a_lcd_power(int on, struct fb_var_screeninfo *var)
383{
384 static int pin_requested = 0;
385 struct fb_info *info = container_of(var, struct fb_info, var);
386 int err;
387
388 if (!pin_requested) {
389 err = gpio_request(GPIO_LCD_RESET, "lcd reset");
390 if (err) {
391 pr_err("failed to request gpio for LCD reset\n");
392 return;
393 }
394
395 gpio_direction_output(GPIO_LCD_RESET, 0);
396 pin_requested = 1;
397 }
398
399 if (on) {
400 gpio_set_value(GPIO_LCD_RESET, 0); msleep(100);
401 gpio_set_value(GPIO_LCD_RESET, 1); msleep(10);
402
403 pxafb_smart_queue(info, ARRAY_AND_SIZE(lcd_power_on));
404 pxafb_smart_queue(info, ARRAY_AND_SIZE(lcd_panel_on));
405 } else {
406 pxafb_smart_queue(info, ARRAY_AND_SIZE(lcd_panel_off));
407 pxafb_smart_queue(info, ARRAY_AND_SIZE(lcd_power_off));
408 }
409
410 err = pxafb_smart_flush(info);
411 if (err)
412 pr_err("%s: timed out\n", __func__);
413}
414
415static void ltm022a97a_update(struct fb_info *info)
416{
417 pxafb_smart_queue(info, ARRAY_AND_SIZE(update_framedata));
418 pxafb_smart_flush(info);
419}
420
421static struct pxafb_mode_info toshiba_ltm022a97a_modes[] = {
422 [0] = {
423 .xres = 240,
424 .yres = 320,
425 .bpp = 16,
426 .a0csrd_set_hld = 30,
427 .a0cswr_set_hld = 30,
428 .wr_pulse_width = 30,
429 .rd_pulse_width = 30,
430 .op_hold_time = 30,
431 .cmd_inh_time = 60,
432
433 /* L_LCLK_A0 and L_LCLK_RD active low */
434 .sync = FB_SYNC_HOR_HIGH_ACT |
435 FB_SYNC_VERT_HIGH_ACT,
436 },
437};
438
439static struct pxafb_mach_info saar_lcd_info = {
440 .modes = toshiba_ltm022a97a_modes,
441 .num_modes = 1,
442 .lcd_conn = LCD_SMART_PANEL_8BPP | LCD_PCLK_EDGE_FALL,
443 .pxafb_lcd_power = ltm022a97a_lcd_power,
444 .smart_update = ltm022a97a_update,
445};
446
447static void __init saar_init_lcd(void)
448{
449 set_pxa_fb_info(&saar_lcd_info);
450}
451#else
452static inline void saar_init_lcd(void) {}
453#endif
454
455#if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
456static struct da903x_subdev_info saar_da9034_subdevs[] = {
457 [0] = {
458 .name = "da903x-backlight",
459 .id = DA9034_ID_WLED,
460 },
461};
462
463static struct da903x_platform_data saar_da9034_info = {
464 .num_subdevs = ARRAY_SIZE(saar_da9034_subdevs),
465 .subdevs = saar_da9034_subdevs,
466};
467
468static struct i2c_board_info saar_i2c_info[] = {
469 [0] = {
470 .type = "da9034",
471 .addr = 0x34,
472 .platform_data = &saar_da9034_info,
473 .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83)),
474 },
475};
476
477static void __init saar_init_i2c(void)
478{
479 pxa_set_i2c_info(NULL);
480 i2c_register_board_info(0, ARRAY_AND_SIZE(saar_i2c_info));
481}
482#else
483static inline void saar_init_i2c(void) {}
484#endif
67static void __init saar_init(void) 485static void __init saar_init(void)
68{ 486{
69 /* initialize MFP configurations */ 487 /* initialize MFP configurations */
70 pxa3xx_mfp_config(ARRAY_AND_SIZE(saar_mfp_cfg)); 488 pxa3xx_mfp_config(ARRAY_AND_SIZE(saar_mfp_cfg));
71 489
72 platform_device_register(&smc91x_device); 490 platform_device_register(&smc91x_device);
491
492 saar_init_i2c();
493 saar_init_lcd();
73} 494}
74 495
75MACHINE_START(SAAR, "PXA930 Handheld Platform (aka SAAR)") 496MACHINE_START(SAAR, "PXA930 Handheld Platform (aka SAAR)")
diff --git a/arch/arm/mach-pxa/smemc.c b/arch/arm/mach-pxa/smemc.c
index ad346addc028..d6f6904132a6 100644
--- a/arch/arm/mach-pxa/smemc.c
+++ b/arch/arm/mach-pxa/smemc.c
@@ -8,6 +8,8 @@
8#include <linux/io.h> 8#include <linux/io.h>
9#include <linux/sysdev.h> 9#include <linux/sysdev.h>
10 10
11#include <mach/hardware.h>
12
11#define SMEMC_PHYS_BASE (0x4A000000) 13#define SMEMC_PHYS_BASE (0x4A000000)
12#define SMEMC_PHYS_SIZE (0x90) 14#define SMEMC_PHYS_SIZE (0x90)
13 15
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 3be76ee2bdbf..7299d87a1cb3 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -22,6 +22,7 @@
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23#include <linux/leds.h> 23#include <linux/leds.h>
24#include <linux/mmc/host.h> 24#include <linux/mmc/host.h>
25#include <linux/mtd/physmap.h>
25#include <linux/pm.h> 26#include <linux/pm.h>
26#include <linux/backlight.h> 27#include <linux/backlight.h>
27#include <linux/io.h> 28#include <linux/io.h>
@@ -122,6 +123,10 @@ static unsigned long spitz_pin_config[] __initdata = {
122 GPIO105_GPIO, /* SPITZ_GPIO_CF_IRQ */ 123 GPIO105_GPIO, /* SPITZ_GPIO_CF_IRQ */
123 GPIO106_GPIO, /* SPITZ_GPIO_CF2_IRQ */ 124 GPIO106_GPIO, /* SPITZ_GPIO_CF2_IRQ */
124 125
126 /* I2C */
127 GPIO117_I2C_SCL,
128 GPIO118_I2C_SDA,
129
125 GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, 130 GPIO1_GPIO | WAKEUP_ON_EDGE_RISE,
126}; 131};
127 132
@@ -609,10 +614,41 @@ static struct pxafb_mach_info spitz_pxafb_info = {
609}; 614};
610 615
611 616
617static struct mtd_partition sharpsl_rom_parts[] = {
618 {
619 .name ="Boot PROM Filesystem",
620 .offset = 0x00140000,
621 .size = MTDPART_SIZ_FULL,
622 },
623};
624
625static struct physmap_flash_data sharpsl_rom_data = {
626 .width = 2,
627 .nr_parts = ARRAY_SIZE(sharpsl_rom_parts),
628 .parts = sharpsl_rom_parts,
629};
630
631static struct resource sharpsl_rom_resources[] = {
632 {
633 .start = 0x00000000,
634 .end = 0x007fffff,
635 .flags = IORESOURCE_MEM,
636 },
637};
638
639static struct platform_device sharpsl_rom_device = {
640 .name = "physmap-flash",
641 .id = -1,
642 .resource = sharpsl_rom_resources,
643 .num_resources = ARRAY_SIZE(sharpsl_rom_resources),
644 .dev.platform_data = &sharpsl_rom_data,
645};
646
612static struct platform_device *devices[] __initdata = { 647static struct platform_device *devices[] __initdata = {
613 &spitzscoop_device, 648 &spitzscoop_device,
614 &spitzkbd_device, 649 &spitzkbd_device,
615 &spitzled_device, 650 &spitzled_device,
651 &sharpsl_rom_device,
616}; 652};
617 653
618static void spitz_poweroff(void) 654static void spitz_poweroff(void)
diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c
index 2c31ec725688..6f42004db3ed 100644
--- a/arch/arm/mach-pxa/ssp.c
+++ b/arch/arm/mach-pxa/ssp.c
@@ -356,7 +356,7 @@ static int __devinit ssp_probe(struct platform_device *pdev, int type)
356 } 356 }
357 ssp->pdev = pdev; 357 ssp->pdev = pdev;
358 358
359 ssp->clk = clk_get(&pdev->dev, "SSPCLK"); 359 ssp->clk = clk_get(&pdev->dev, NULL);
360 if (IS_ERR(ssp->clk)) { 360 if (IS_ERR(ssp->clk)) {
361 ret = PTR_ERR(ssp->clk); 361 ret = PTR_ERR(ssp->clk);
362 goto err_free; 362 goto err_free;
diff --git a/arch/arm/mach-pxa/tavorevb.c b/arch/arm/mach-pxa/tavorevb.c
index 589d32b4fc46..58ef08a5224b 100644
--- a/arch/arm/mach-pxa/tavorevb.c
+++ b/arch/arm/mach-pxa/tavorevb.c
@@ -18,12 +18,15 @@
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/smc91x.h> 20#include <linux/smc91x.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 <mach/hardware.h> 25#include <mach/hardware.h>
25#include <mach/pxa3xx-regs.h> 26#include <mach/pxa3xx-regs.h>
26#include <mach/mfp-pxa930.h> 27#include <mach/mfp-pxa930.h>
28#include <mach/pxafb.h>
29#include <mach/pxa27x_keypad.h>
27 30
28#include "devices.h" 31#include "devices.h"
29#include "generic.h" 32#include "generic.h"
@@ -33,6 +36,45 @@ static mfp_cfg_t tavorevb_mfp_cfg[] __initdata = {
33 /* Ethernet */ 36 /* Ethernet */
34 DF_nCS1_nCS3, 37 DF_nCS1_nCS3,
35 GPIO47_GPIO, 38 GPIO47_GPIO,
39
40 /* LCD */
41 GPIO23_LCD_DD0,
42 GPIO24_LCD_DD1,
43 GPIO25_LCD_DD2,
44 GPIO26_LCD_DD3,
45 GPIO27_LCD_DD4,
46 GPIO28_LCD_DD5,
47 GPIO29_LCD_DD6,
48 GPIO44_LCD_DD7,
49 GPIO21_LCD_CS,
50 GPIO22_LCD_CS2,
51
52 GPIO17_LCD_FCLK_RD,
53 GPIO18_LCD_LCLK_A0,
54 GPIO19_LCD_PCLK_WR,
55
56 /* LCD Backlight */
57 GPIO43_PWM3, /* primary backlight */
58 GPIO32_PWM0, /* secondary backlight */
59
60 /* Keypad */
61 GPIO0_KP_MKIN_0,
62 GPIO2_KP_MKIN_1,
63 GPIO4_KP_MKIN_2,
64 GPIO6_KP_MKIN_3,
65 GPIO8_KP_MKIN_4,
66 GPIO10_KP_MKIN_5,
67 GPIO12_KP_MKIN_6,
68 GPIO1_KP_MKOUT_0,
69 GPIO3_KP_MKOUT_1,
70 GPIO5_KP_MKOUT_2,
71 GPIO7_KP_MKOUT_3,
72 GPIO9_KP_MKOUT_4,
73 GPIO11_KP_MKOUT_5,
74 GPIO13_KP_MKOUT_6,
75
76 GPIO14_KP_DKIN_2,
77 GPIO15_KP_DKIN_3,
36}; 78};
37 79
38#define TAVOREVB_ETH_PHYS (0x14000000) 80#define TAVOREVB_ETH_PHYS (0x14000000)
@@ -64,12 +106,382 @@ static struct platform_device smc91x_device = {
64 }, 106 },
65}; 107};
66 108
109#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
110static unsigned int tavorevb_matrix_key_map[] = {
111 /* KEY(row, col, key_code) */
112 KEY(0, 4, KEY_A), KEY(0, 5, KEY_B), KEY(0, 6, KEY_C),
113 KEY(1, 4, KEY_E), KEY(1, 5, KEY_F), KEY(1, 6, KEY_G),
114 KEY(2, 4, KEY_I), KEY(2, 5, KEY_J), KEY(2, 6, KEY_K),
115 KEY(3, 4, KEY_M), KEY(3, 5, KEY_N), KEY(3, 6, KEY_O),
116 KEY(4, 5, KEY_R), KEY(4, 6, KEY_S),
117 KEY(5, 4, KEY_U), KEY(5, 4, KEY_V), KEY(5, 6, KEY_W),
118
119 KEY(6, 4, KEY_Y), KEY(6, 5, KEY_Z),
120
121 KEY(0, 3, KEY_0), KEY(2, 0, KEY_1), KEY(2, 1, KEY_2), KEY(2, 2, KEY_3),
122 KEY(2, 3, KEY_4), KEY(1, 0, KEY_5), KEY(1, 1, KEY_6), KEY(1, 2, KEY_7),
123 KEY(1, 3, KEY_8), KEY(0, 2, KEY_9),
124
125 KEY(6, 6, KEY_SPACE),
126 KEY(0, 0, KEY_KPASTERISK), /* * */
127 KEY(0, 1, KEY_KPDOT), /* # */
128
129 KEY(4, 1, KEY_UP),
130 KEY(4, 3, KEY_DOWN),
131 KEY(4, 0, KEY_LEFT),
132 KEY(4, 2, KEY_RIGHT),
133 KEY(6, 0, KEY_HOME),
134 KEY(3, 2, KEY_END),
135 KEY(6, 1, KEY_DELETE),
136 KEY(5, 2, KEY_BACK),
137 KEY(6, 3, KEY_CAPSLOCK), /* KEY_LEFTSHIFT), */
138
139 KEY(4, 4, KEY_ENTER), /* scroll push */
140 KEY(6, 2, KEY_ENTER), /* keypad action */
141
142 KEY(3, 1, KEY_SEND),
143 KEY(5, 3, KEY_RECORD),
144 KEY(5, 0, KEY_VOLUMEUP),
145 KEY(5, 1, KEY_VOLUMEDOWN),
146
147 KEY(3, 0, KEY_F22), /* soft1 */
148 KEY(3, 3, KEY_F23), /* soft2 */
149};
150
151static struct pxa27x_keypad_platform_data tavorevb_keypad_info = {
152 .matrix_key_rows = 7,
153 .matrix_key_cols = 7,
154 .matrix_key_map = tavorevb_matrix_key_map,
155 .matrix_key_map_size = ARRAY_SIZE(tavorevb_matrix_key_map),
156 .debounce_interval = 30,
157};
158
159static void __init tavorevb_init_keypad(void)
160{
161 pxa_set_keypad_info(&tavorevb_keypad_info);
162}
163#else
164static inline void tavorevb_init_keypad(void) {}
165#endif /* CONFIG_KEYBOARD_PXA27x || CONFIG_KEYBOARD_PXA27x_MODULE */
166
167#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
168static struct platform_pwm_backlight_data tavorevb_backlight_data[] = {
169 [0] = {
170 /* primary backlight */
171 .pwm_id = 2,
172 .max_brightness = 100,
173 .dft_brightness = 100,
174 .pwm_period_ns = 100000,
175 },
176 [1] = {
177 /* secondary backlight */
178 .pwm_id = 0,
179 .max_brightness = 100,
180 .dft_brightness = 100,
181 .pwm_period_ns = 100000,
182 },
183};
184
185static struct platform_device tavorevb_backlight_devices[] = {
186 [0] = {
187 .name = "pwm-backlight",
188 .id = 0,
189 .dev = {
190 .platform_data = &tavorevb_backlight_data[0],
191 },
192 },
193 [1] = {
194 .name = "pwm-backlight",
195 .id = 1,
196 .dev = {
197 .platform_data = &tavorevb_backlight_data[1],
198 },
199 },
200};
201
202static uint16_t panel_init[] = {
203 /* DSTB OUT */
204 SMART_CMD(0x00),
205 SMART_CMD_NOOP,
206 SMART_DELAY(1),
207
208 SMART_CMD(0x00),
209 SMART_CMD_NOOP,
210 SMART_DELAY(1),
211
212 SMART_CMD(0x00),
213 SMART_CMD_NOOP,
214 SMART_DELAY(1),
215
216 /* STB OUT */
217 SMART_CMD(0x00),
218 SMART_CMD(0x1D),
219 SMART_DAT(0x00),
220 SMART_DAT(0x05),
221 SMART_DELAY(1),
222
223 /* P-ON Init sequence */
224 SMART_CMD(0x00), /* OSC ON */
225 SMART_CMD(0x00),
226 SMART_DAT(0x00),
227 SMART_DAT(0x01),
228 SMART_CMD(0x00),
229 SMART_CMD(0x01), /* SOURCE DRIVER SHIFT DIRECTION and display RAM setting */
230 SMART_DAT(0x01),
231 SMART_DAT(0x27),
232 SMART_CMD(0x00),
233 SMART_CMD(0x02), /* LINE INV */
234 SMART_DAT(0x02),
235 SMART_DAT(0x00),
236 SMART_CMD(0x00),
237 SMART_CMD(0x03), /* IF mode(1) */
238 SMART_DAT(0x01), /* 8bit smart mode(8-8),high speed write mode */
239 SMART_DAT(0x30),
240 SMART_CMD(0x07),
241 SMART_CMD(0x00), /* RAM Write Mode */
242 SMART_DAT(0x00),
243 SMART_DAT(0x03),
244 SMART_CMD(0x00),
245
246 /* DISPLAY Setting, 262K, fixed(NO scroll), no split screen */
247 SMART_CMD(0x07),
248 SMART_DAT(0x40), /* 16/18/19 BPP */
249 SMART_DAT(0x00),
250 SMART_CMD(0x00),
251 SMART_CMD(0x08), /* BP, FP Seting, BP=2H, FP=3H */
252 SMART_DAT(0x03),
253 SMART_DAT(0x02),
254 SMART_CMD(0x00),
255 SMART_CMD(0x0C), /* IF mode(2), using internal clock & MPU */
256 SMART_DAT(0x00),
257 SMART_DAT(0x00),
258 SMART_CMD(0x00),
259 SMART_CMD(0x0D), /* Frame setting, 1Min. Frequence, 16CLK */
260 SMART_DAT(0x00),
261 SMART_DAT(0x10),
262 SMART_CMD(0x00),
263 SMART_CMD(0x12), /* Timing(1),ASW W=4CLK, ASW ST=1CLK */
264 SMART_DAT(0x03),
265 SMART_DAT(0x02),
266 SMART_CMD(0x00),
267 SMART_CMD(0x13), /* Timing(2),OEV ST=0.5CLK, OEV ED=1CLK */
268 SMART_DAT(0x01),
269 SMART_DAT(0x02),
270 SMART_CMD(0x00),
271 SMART_CMD(0x14), /* Timing(3), ASW HOLD=0.5CLK */
272 SMART_DAT(0x00),
273 SMART_DAT(0x00),
274 SMART_CMD(0x00),
275 SMART_CMD(0x15), /* Timing(4), CKV ST=0CLK, CKV ED=1CLK */
276 SMART_DAT(0x20),
277 SMART_DAT(0x00),
278 SMART_CMD(0x00),
279 SMART_CMD(0x1C),
280 SMART_DAT(0x00),
281 SMART_DAT(0x00),
282 SMART_CMD(0x03),
283 SMART_CMD(0x00),
284 SMART_DAT(0x04),
285 SMART_DAT(0x03),
286 SMART_CMD(0x03),
287 SMART_CMD(0x01),
288 SMART_DAT(0x03),
289 SMART_DAT(0x04),
290 SMART_CMD(0x03),
291 SMART_CMD(0x02),
292 SMART_DAT(0x04),
293 SMART_DAT(0x03),
294 SMART_CMD(0x03),
295 SMART_CMD(0x03),
296 SMART_DAT(0x03),
297 SMART_DAT(0x03),
298 SMART_CMD(0x03),
299 SMART_CMD(0x04),
300 SMART_DAT(0x01),
301 SMART_DAT(0x01),
302 SMART_CMD(0x03),
303 SMART_CMD(0x05),
304 SMART_DAT(0x00),
305 SMART_DAT(0x00),
306 SMART_CMD(0x04),
307 SMART_CMD(0x02),
308 SMART_DAT(0x00),
309 SMART_DAT(0x00),
310 SMART_CMD(0x04),
311 SMART_CMD(0x03),
312 SMART_DAT(0x01),
313 SMART_DAT(0x3F),
314 SMART_DELAY(0),
315
316 /* DISP RAM setting: 240*320 */
317 SMART_CMD(0x04), /* HADDR, START 0 */
318 SMART_CMD(0x06),
319 SMART_DAT(0x00),
320 SMART_DAT(0x00), /* x1,3 */
321 SMART_CMD(0x04), /* HADDR, END 4 */
322 SMART_CMD(0x07),
323 SMART_DAT(0x00),
324 SMART_DAT(0xEF), /* x2, 7 */
325 SMART_CMD(0x04), /* VADDR, START 8 */
326 SMART_CMD(0x08),
327 SMART_DAT(0x00), /* y1, 10 */
328 SMART_DAT(0x00), /* y1, 11 */
329 SMART_CMD(0x04), /* VADDR, END 12 */
330 SMART_CMD(0x09),
331 SMART_DAT(0x01), /* y2, 14 */
332 SMART_DAT(0x3F), /* y2, 15 */
333 SMART_CMD(0x02), /* RAM ADDR SETTING 16 */
334 SMART_CMD(0x00),
335 SMART_DAT(0x00),
336 SMART_DAT(0x00), /* x1, 19 */
337 SMART_CMD(0x02), /* RAM ADDR SETTING 20 */
338 SMART_CMD(0x01),
339 SMART_DAT(0x00), /* y1, 22 */
340 SMART_DAT(0x00), /* y1, 23 */
341};
342
343static uint16_t panel_on[] = {
344 /* Power-IC ON */
345 SMART_CMD(0x01),
346 SMART_CMD(0x02),
347 SMART_DAT(0x07),
348 SMART_DAT(0x7D),
349 SMART_CMD(0x01),
350 SMART_CMD(0x03),
351 SMART_DAT(0x00),
352 SMART_DAT(0x05),
353 SMART_CMD(0x01),
354 SMART_CMD(0x04),
355 SMART_DAT(0x00),
356 SMART_DAT(0x00),
357 SMART_CMD(0x01),
358 SMART_CMD(0x05),
359 SMART_DAT(0x00),
360 SMART_DAT(0x15),
361 SMART_CMD(0x01),
362 SMART_CMD(0x00),
363 SMART_DAT(0xC0),
364 SMART_DAT(0x10),
365 SMART_DELAY(30),
366
367 /* DISP ON */
368 SMART_CMD(0x01),
369 SMART_CMD(0x01),
370 SMART_DAT(0x00),
371 SMART_DAT(0x01),
372 SMART_CMD(0x01),
373 SMART_CMD(0x00),
374 SMART_DAT(0xFF),
375 SMART_DAT(0xFE),
376 SMART_DELAY(150),
377};
378
379static uint16_t panel_off[] = {
380 SMART_CMD(0x00),
381 SMART_CMD(0x1E),
382 SMART_DAT(0x00),
383 SMART_DAT(0x0A),
384 SMART_CMD(0x01),
385 SMART_CMD(0x00),
386 SMART_DAT(0xFF),
387 SMART_DAT(0xEE),
388 SMART_CMD(0x01),
389 SMART_CMD(0x00),
390 SMART_DAT(0xF8),
391 SMART_DAT(0x12),
392 SMART_CMD(0x01),
393 SMART_CMD(0x00),
394 SMART_DAT(0xE8),
395 SMART_DAT(0x11),
396 SMART_CMD(0x01),
397 SMART_CMD(0x00),
398 SMART_DAT(0xC0),
399 SMART_DAT(0x11),
400 SMART_CMD(0x01),
401 SMART_CMD(0x00),
402 SMART_DAT(0x40),
403 SMART_DAT(0x11),
404 SMART_CMD(0x01),
405 SMART_CMD(0x00),
406 SMART_DAT(0x00),
407 SMART_DAT(0x10),
408};
409
410static uint16_t update_framedata[] = {
411 /* write ram */
412 SMART_CMD(0x02),
413 SMART_CMD(0x02),
414
415 /* write frame data */
416 SMART_CMD_WRITE_FRAME,
417};
418
419static void ltm020d550_lcd_power(int on, struct fb_var_screeninfo *var)
420{
421 struct fb_info *info = container_of(var, struct fb_info, var);
422
423 if (on) {
424 pxafb_smart_queue(info, ARRAY_AND_SIZE(panel_init));
425 pxafb_smart_queue(info, ARRAY_AND_SIZE(panel_on));
426 } else {
427 pxafb_smart_queue(info, ARRAY_AND_SIZE(panel_off));
428 }
429
430 if (pxafb_smart_flush(info))
431 pr_err("%s: timed out\n", __func__);
432}
433
434static void ltm020d550_update(struct fb_info *info)
435{
436 pxafb_smart_queue(info, ARRAY_AND_SIZE(update_framedata));
437 pxafb_smart_flush(info);
438}
439
440static struct pxafb_mode_info toshiba_ltm020d550_modes[] = {
441 [0] = {
442 .xres = 240,
443 .yres = 320,
444 .bpp = 16,
445 .a0csrd_set_hld = 30,
446 .a0cswr_set_hld = 30,
447 .wr_pulse_width = 30,
448 .rd_pulse_width = 170,
449 .op_hold_time = 30,
450 .cmd_inh_time = 60,
451
452 /* L_LCLK_A0 and L_LCLK_RD active low */
453 .sync = FB_SYNC_HOR_HIGH_ACT |
454 FB_SYNC_VERT_HIGH_ACT,
455 },
456};
457
458static struct pxafb_mach_info tavorevb_lcd_info = {
459 .modes = toshiba_ltm020d550_modes,
460 .num_modes = 1,
461 .lcd_conn = LCD_SMART_PANEL_8BPP | LCD_PCLK_EDGE_FALL,
462 .pxafb_lcd_power = ltm020d550_lcd_power,
463 .smart_update = ltm020d550_update,
464};
465
466static void __init tavorevb_init_lcd(void)
467{
468 platform_device_register(&tavorevb_backlight_devices[0]);
469 platform_device_register(&tavorevb_backlight_devices[1]);
470 set_pxa_fb_info(&tavorevb_lcd_info);
471}
472#else
473static inline void tavorevb_init_lcd(void) {}
474#endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
475
67static void __init tavorevb_init(void) 476static void __init tavorevb_init(void)
68{ 477{
69 /* initialize MFP configurations */ 478 /* initialize MFP configurations */
70 pxa3xx_mfp_config(ARRAY_AND_SIZE(tavorevb_mfp_cfg)); 479 pxa3xx_mfp_config(ARRAY_AND_SIZE(tavorevb_mfp_cfg));
71 480
72 platform_device_register(&smc91x_device); 481 platform_device_register(&smc91x_device);
482
483 tavorevb_init_lcd();
484 tavorevb_init_keypad();
73} 485}
74 486
75MACHINE_START(TAVOREVB, "PXA930 Evaluation Board (aka TavorEVB)") 487MACHINE_START(TAVOREVB, "PXA930 Evaluation Board (aka TavorEVB)")
diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c
index f8a9a62959e5..95656a72268d 100644
--- a/arch/arm/mach-pxa/time.c
+++ b/arch/arm/mach-pxa/time.c
@@ -22,8 +22,8 @@
22#include <asm/div64.h> 22#include <asm/div64.h>
23#include <asm/mach/irq.h> 23#include <asm/mach/irq.h>
24#include <asm/mach/time.h> 24#include <asm/mach/time.h>
25#include <mach/hardware.h>
25#include <mach/pxa-regs.h> 26#include <mach/pxa-regs.h>
26#include <asm/mach-types.h>
27 27
28/* 28/*
29 * This is PXA's sched_clock implementation. This has a resolution 29 * This is PXA's sched_clock implementation. This has a resolution
@@ -122,7 +122,6 @@ static struct clock_event_device ckevt_pxa_osmr0 = {
122 .features = CLOCK_EVT_FEAT_ONESHOT, 122 .features = CLOCK_EVT_FEAT_ONESHOT,
123 .shift = 32, 123 .shift = 32,
124 .rating = 200, 124 .rating = 200,
125 .cpumask = CPU_MASK_CPU0,
126 .set_next_event = pxa_osmr0_set_next_event, 125 .set_next_event = pxa_osmr0_set_next_event,
127 .set_mode = pxa_osmr0_set_mode, 126 .set_mode = pxa_osmr0_set_mode,
128}; 127};
@@ -150,18 +149,11 @@ static struct irqaction pxa_ost0_irq = {
150 149
151static void __init pxa_timer_init(void) 150static void __init pxa_timer_init(void)
152{ 151{
153 unsigned long clock_tick_rate; 152 unsigned long clock_tick_rate = get_clock_tick_rate();
154 153
155 OIER = 0; 154 OIER = 0;
156 OSSR = OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3; 155 OSSR = OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3;
157 156
158 if (cpu_is_pxa25x())
159 clock_tick_rate = 3686400;
160 else if (machine_is_mainstone())
161 clock_tick_rate = 3249600;
162 else
163 clock_tick_rate = 3250000;
164
165 set_oscr2ns_scale(clock_tick_rate); 157 set_oscr2ns_scale(clock_tick_rate);
166 158
167 ckevt_pxa_osmr0.mult = 159 ckevt_pxa_osmr0.mult =
@@ -170,6 +162,7 @@ static void __init pxa_timer_init(void)
170 clockevent_delta2ns(0x7fffffff, &ckevt_pxa_osmr0); 162 clockevent_delta2ns(0x7fffffff, &ckevt_pxa_osmr0);
171 ckevt_pxa_osmr0.min_delta_ns = 163 ckevt_pxa_osmr0.min_delta_ns =
172 clockevent_delta2ns(MIN_OSCR_DELTA * 2, &ckevt_pxa_osmr0) + 1; 164 clockevent_delta2ns(MIN_OSCR_DELTA * 2, &ckevt_pxa_osmr0) + 1;
165 ckevt_pxa_osmr0.cpumask = cpumask_of(0);
173 166
174 cksrc_pxa_oscr0.mult = 167 cksrc_pxa_oscr0.mult =
175 clocksource_hz2mult(clock_tick_rate, cksrc_pxa_oscr0.shift); 168 clocksource_hz2mult(clock_tick_rate, cksrc_pxa_oscr0.shift);
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 224897a67d15..3332e5d0356c 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -25,6 +25,7 @@
25#include <linux/mfd/tmio.h> 25#include <linux/mfd/tmio.h>
26#include <linux/mtd/nand.h> 26#include <linux/mtd/nand.h>
27#include <linux/mtd/partitions.h> 27#include <linux/mtd/partitions.h>
28#include <linux/mtd/physmap.h>
28#include <linux/pm.h> 29#include <linux/pm.h>
29#include <linux/gpio_keys.h> 30#include <linux/gpio_keys.h>
30#include <linux/input.h> 31#include <linux/input.h>
@@ -733,6 +734,45 @@ static void tosa_tc6393xb_teardown(struct platform_device *dev)
733 gpio_free(TOSA_GPIO_CARD_VCC_ON); 734 gpio_free(TOSA_GPIO_CARD_VCC_ON);
734} 735}
735 736
737#ifdef CONFIG_MFD_TC6393XB
738static struct fb_videomode tosa_tc6393xb_lcd_mode[] = {
739 {
740 .xres = 480,
741 .yres = 640,
742 .pixclock = 0x002cdf00,/* PLL divisor */
743 .left_margin = 0x004c,
744 .right_margin = 0x005b,
745 .upper_margin = 0x0001,
746 .lower_margin = 0x000d,
747 .hsync_len = 0x0002,
748 .vsync_len = 0x0001,
749 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
750 .vmode = FB_VMODE_NONINTERLACED,
751 },{
752 .xres = 240,
753 .yres = 320,
754 .pixclock = 0x00e7f203,/* PLL divisor */
755 .left_margin = 0x0024,
756 .right_margin = 0x002f,
757 .upper_margin = 0x0001,
758 .lower_margin = 0x000d,
759 .hsync_len = 0x0002,
760 .vsync_len = 0x0001,
761 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
762 .vmode = FB_VMODE_NONINTERLACED,
763 }
764};
765
766static struct tmio_fb_data tosa_tc6393xb_fb_config = {
767 .lcd_set_power = tc6393xb_lcd_set_power,
768 .lcd_mode = tc6393xb_lcd_mode,
769 .num_modes = ARRAY_SIZE(tosa_tc6393xb_lcd_mode),
770 .modes = &tosa_tc6393xb_lcd_mode[0],
771 .height = 82,
772 .width = 60,
773};
774#endif
775
736static struct tc6393xb_platform_data tosa_tc6393xb_data = { 776static struct tc6393xb_platform_data tosa_tc6393xb_data = {
737 .scr_pll2cr = 0x0cc1, 777 .scr_pll2cr = 0x0cc1,
738 .scr_gper = 0x3300, 778 .scr_gper = 0x3300,
@@ -748,6 +788,9 @@ static struct tc6393xb_platform_data tosa_tc6393xb_data = {
748 .resume = tosa_tc6393xb_resume, 788 .resume = tosa_tc6393xb_resume,
749 789
750 .nand_data = &tosa_tc6393xb_nand_config, 790 .nand_data = &tosa_tc6393xb_nand_config,
791#ifdef CONFIG_MFD_TC6393XB
792 .fb_data = &tosa_tc6393xb_fb_config,
793#endif
751 794
752 .resume_restore = 1, 795 .resume_restore = 1,
753}; 796};
@@ -789,6 +832,36 @@ static struct spi_board_info spi_board_info[] __initdata = {
789 }, 832 },
790}; 833};
791 834
835static struct mtd_partition sharpsl_rom_parts[] = {
836 {
837 .name ="Boot PROM Filesystem",
838 .offset = 0x00160000,
839 .size = MTDPART_SIZ_FULL,
840 },
841};
842
843static struct physmap_flash_data sharpsl_rom_data = {
844 .width = 2,
845 .nr_parts = ARRAY_SIZE(sharpsl_rom_parts),
846 .parts = sharpsl_rom_parts,
847};
848
849static struct resource sharpsl_rom_resources[] = {
850 {
851 .start = 0x00000000,
852 .end = 0x007fffff,
853 .flags = IORESOURCE_MEM,
854 },
855};
856
857static struct platform_device sharpsl_rom_device = {
858 .name = "physmap-flash",
859 .id = -1,
860 .resource = sharpsl_rom_resources,
861 .num_resources = ARRAY_SIZE(sharpsl_rom_resources),
862 .dev.platform_data = &sharpsl_rom_data,
863};
864
792static struct platform_device *devices[] __initdata = { 865static struct platform_device *devices[] __initdata = {
793 &tosascoop_device, 866 &tosascoop_device,
794 &tosascoop_jc_device, 867 &tosascoop_jc_device,
@@ -798,6 +871,7 @@ static struct platform_device *devices[] __initdata = {
798 &tosa_gpio_keys_device, 871 &tosa_gpio_keys_device,
799 &tosaled_device, 872 &tosaled_device,
800 &tosa_bt_device, 873 &tosa_bt_device,
874 &sharpsl_rom_device,
801}; 875};
802 876
803static void tosa_poweroff(void) 877static void tosa_poweroff(void)
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c
index 813804433466..218d2001f1df 100644
--- a/arch/arm/mach-pxa/zylonite.c
+++ b/arch/arm/mach-pxa/zylonite.c
@@ -18,6 +18,7 @@
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/gpio.h>
21#include <linux/pwm_backlight.h> 22#include <linux/pwm_backlight.h>
22#include <linux/smc91x.h> 23#include <linux/smc91x.h>
23 24
@@ -25,7 +26,6 @@
25#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
26#include <mach/hardware.h> 27#include <mach/hardware.h>
27#include <mach/audio.h> 28#include <mach/audio.h>
28#include <mach/gpio.h>
29#include <mach/pxafb.h> 29#include <mach/pxafb.h>
30#include <mach/zylonite.h> 30#include <mach/zylonite.h>
31#include <mach/mmc.h> 31#include <mach/mmc.h>
diff --git a/arch/arm/mach-pxa/zylonite_pxa320.c b/arch/arm/mach-pxa/zylonite_pxa320.c
index 0f244744daae..28e4e623780b 100644
--- a/arch/arm/mach-pxa/zylonite_pxa320.c
+++ b/arch/arm/mach-pxa/zylonite_pxa320.c
@@ -16,8 +16,8 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/gpio.h>
19 20
20#include <mach/gpio.h>
21#include <mach/mfp-pxa320.h> 21#include <mach/mfp-pxa320.h>
22#include <mach/zylonite.h> 22#include <mach/zylonite.h>
23 23
diff --git a/arch/arm/mach-realview/Kconfig b/arch/arm/mach-realview/Kconfig
index 5ccde7cf39e8..ad911854eb4c 100644
--- a/arch/arm/mach-realview/Kconfig
+++ b/arch/arm/mach-realview/Kconfig
@@ -7,9 +7,17 @@ config MACH_REALVIEW_EB
7 help 7 help
8 Include support for the ARM(R) RealView Emulation Baseboard platform. 8 Include support for the ARM(R) RealView Emulation Baseboard platform.
9 9
10config REALVIEW_EB_A9MP
11 bool "Support Multicore Cortex-A9"
12 depends on MACH_REALVIEW_EB
13 select CPU_V7
14 help
15 Enable support for the Cortex-A9MPCore tile on the Realview platform.
16
10config REALVIEW_EB_ARM11MP 17config REALVIEW_EB_ARM11MP
11 bool "Support ARM11MPCore tile" 18 bool "Support ARM11MPCore tile"
12 depends on MACH_REALVIEW_EB 19 depends on MACH_REALVIEW_EB
20 select CPU_V6
13 help 21 help
14 Enable support for the ARM11MPCore tile on the Realview platform. 22 Enable support for the ARM11MPCore tile on the Realview platform.
15 23
@@ -25,6 +33,7 @@ config REALVIEW_EB_ARM11MP_REVB
25 33
26config MACH_REALVIEW_PB11MP 34config MACH_REALVIEW_PB11MP
27 bool "Support RealView/PB11MPCore platform" 35 bool "Support RealView/PB11MPCore platform"
36 select CPU_V6
28 select ARM_GIC 37 select ARM_GIC
29 help 38 help
30 Include support for the ARM(R) RealView MPCore Platform Baseboard. 39 Include support for the ARM(R) RealView MPCore Platform Baseboard.
@@ -33,8 +42,29 @@ config MACH_REALVIEW_PB11MP
33 42
34config MACH_REALVIEW_PB1176 43config MACH_REALVIEW_PB1176
35 bool "Support RealView/PB1176 platform" 44 bool "Support RealView/PB1176 platform"
45 select CPU_V6
36 select ARM_GIC 46 select ARM_GIC
37 help 47 help
38 Include support for the ARM(R) RealView ARM1176 Platform Baseboard. 48 Include support for the ARM(R) RealView ARM1176 Platform Baseboard.
39 49
50config MACH_REALVIEW_PBA8
51 bool "Support RealView/PB-A8 platform"
52 select CPU_V7
53 select ARM_GIC
54 help
55 Include support for the ARM(R) RealView Cortex-A8 Platform Baseboard.
56 PB-A8 is a platform with an on-board Cortex-A8 and has support for
57 PCI-E and Compact Flash.
58
59config REALVIEW_HIGH_PHYS_OFFSET
60 bool "High physical base address for the RealView platform"
61 depends on !MACH_REALVIEW_PB1176
62 default y
63 help
64 RealView boards other than PB1176 have the RAM available at
65 0x70000000, 256MB of which being mirrored at 0x00000000. If
66 the board supports 512MB of RAM, this option allows the
67 memory to be accessed contiguously at the high physical
68 offset.
69
40endmenu 70endmenu
diff --git a/arch/arm/mach-realview/Makefile b/arch/arm/mach-realview/Makefile
index d2ae077431dd..7bea8ffc4b59 100644
--- a/arch/arm/mach-realview/Makefile
+++ b/arch/arm/mach-realview/Makefile
@@ -6,5 +6,6 @@ obj-y := core.o clock.o
6obj-$(CONFIG_MACH_REALVIEW_EB) += realview_eb.o 6obj-$(CONFIG_MACH_REALVIEW_EB) += realview_eb.o
7obj-$(CONFIG_MACH_REALVIEW_PB11MP) += realview_pb11mp.o 7obj-$(CONFIG_MACH_REALVIEW_PB11MP) += realview_pb11mp.o
8obj-$(CONFIG_MACH_REALVIEW_PB1176) += realview_pb1176.o 8obj-$(CONFIG_MACH_REALVIEW_PB1176) += realview_pb1176.o
9obj-$(CONFIG_MACH_REALVIEW_PBA8) += realview_pba8.o
9obj-$(CONFIG_SMP) += platsmp.o headsmp.o localtimer.o 10obj-$(CONFIG_SMP) += platsmp.o headsmp.o localtimer.o
10obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 11obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
diff --git a/arch/arm/mach-realview/Makefile.boot b/arch/arm/mach-realview/Makefile.boot
index c7e75acfe6c9..d97e003d3df4 100644
--- a/arch/arm/mach-realview/Makefile.boot
+++ b/arch/arm/mach-realview/Makefile.boot
@@ -1,4 +1,9 @@
1ifeq ($(CONFIG_REALVIEW_HIGH_PHYS_OFFSET),y)
2 zreladdr-y := 0x70008000
3params_phys-y := 0x70000100
4initrd_phys-y := 0x70800000
5else
1 zreladdr-y := 0x00008000 6 zreladdr-y := 0x00008000
2params_phys-y := 0x00000100 7params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 8initrd_phys-y := 0x00800000
4 9endif
diff --git a/arch/arm/mach-realview/clock.c b/arch/arm/mach-realview/clock.c
index 3347c4236a60..a7043115de72 100644
--- a/arch/arm/mach-realview/clock.c
+++ b/arch/arm/mach-realview/clock.c
@@ -10,9 +10,11 @@
10 */ 10 */
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/device.h>
13#include <linux/list.h> 14#include <linux/list.h>
14#include <linux/errno.h> 15#include <linux/errno.h>
15#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/string.h>
16#include <linux/clk.h> 18#include <linux/clk.h>
17#include <linux/mutex.h> 19#include <linux/mutex.h>
18 20
@@ -20,32 +22,6 @@
20 22
21#include "clock.h" 23#include "clock.h"
22 24
23static LIST_HEAD(clocks);
24static DEFINE_MUTEX(clocks_mutex);
25
26struct clk *clk_get(struct device *dev, const char *id)
27{
28 struct clk *p, *clk = ERR_PTR(-ENOENT);
29
30 mutex_lock(&clocks_mutex);
31 list_for_each_entry(p, &clocks, node) {
32 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
33 clk = p;
34 break;
35 }
36 }
37 mutex_unlock(&clocks_mutex);
38
39 return clk;
40}
41EXPORT_SYMBOL(clk_get);
42
43void clk_put(struct clk *clk)
44{
45 module_put(clk->owner);
46}
47EXPORT_SYMBOL(clk_put);
48
49int clk_enable(struct clk *clk) 25int clk_enable(struct clk *clk)
50{ 26{
51 return 0; 27 return 0;
@@ -65,7 +41,9 @@ EXPORT_SYMBOL(clk_get_rate);
65 41
66long clk_round_rate(struct clk *clk, unsigned long rate) 42long clk_round_rate(struct clk *clk, unsigned long rate)
67{ 43{
68 return rate; 44 struct icst307_vco vco;
45 vco = icst307_khz_to_vco(clk->params, rate / 1000);
46 return icst307_khz(clk->params, vco) * 1000;
69} 47}
70EXPORT_SYMBOL(clk_round_rate); 48EXPORT_SYMBOL(clk_round_rate);
71 49
@@ -78,57 +56,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
78 56
79 vco = icst307_khz_to_vco(clk->params, rate / 1000); 57 vco = icst307_khz_to_vco(clk->params, rate / 1000);
80 clk->rate = icst307_khz(clk->params, vco) * 1000; 58 clk->rate = icst307_khz(clk->params, vco) * 1000;
81
82 printk("Clock %s: setting VCO reg params: S=%d R=%d V=%d\n",
83 clk->name, vco.s, vco.r, vco.v);
84
85 clk->setvco(clk, vco); 59 clk->setvco(clk, vco);
86 ret = 0; 60 ret = 0;
87 } 61 }
88 return ret; 62 return ret;
89} 63}
90EXPORT_SYMBOL(clk_set_rate); 64EXPORT_SYMBOL(clk_set_rate);
91
92/*
93 * These are fixed clocks.
94 */
95static struct clk kmi_clk = {
96 .name = "KMIREFCLK",
97 .rate = 24000000,
98};
99
100static struct clk uart_clk = {
101 .name = "UARTCLK",
102 .rate = 24000000,
103};
104
105static struct clk mmci_clk = {
106 .name = "MCLK",
107 .rate = 24000000,
108};
109
110int clk_register(struct clk *clk)
111{
112 mutex_lock(&clocks_mutex);
113 list_add(&clk->node, &clocks);
114 mutex_unlock(&clocks_mutex);
115 return 0;
116}
117EXPORT_SYMBOL(clk_register);
118
119void clk_unregister(struct clk *clk)
120{
121 mutex_lock(&clocks_mutex);
122 list_del(&clk->node);
123 mutex_unlock(&clocks_mutex);
124}
125EXPORT_SYMBOL(clk_unregister);
126
127static int __init clk_init(void)
128{
129 clk_register(&kmi_clk);
130 clk_register(&uart_clk);
131 clk_register(&mmci_clk);
132 return 0;
133}
134arch_initcall(clk_init);
diff --git a/arch/arm/mach-realview/clock.h b/arch/arm/mach-realview/clock.h
index dadba695e181..ebbb0f06b600 100644
--- a/arch/arm/mach-realview/clock.h
+++ b/arch/arm/mach-realview/clock.h
@@ -12,14 +12,8 @@ struct module;
12struct icst307_params; 12struct icst307_params;
13 13
14struct clk { 14struct clk {
15 struct list_head node;
16 unsigned long rate; 15 unsigned long rate;
17 struct module *owner;
18 const char *name;
19 const struct icst307_params *params; 16 const struct icst307_params *params;
20 void *data; 17 void *data;
21 void (*setvco)(struct clk *, struct icst307_vco vco); 18 void (*setvco)(struct clk *, struct icst307_vco vco);
22}; 19};
23
24int clk_register(struct clk *clk);
25void clk_unregister(struct clk *clk);
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 2f04d54711e7..bd2aa4f16141 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -28,11 +28,14 @@
28#include <linux/clocksource.h> 28#include <linux/clocksource.h>
29#include <linux/clockchips.h> 29#include <linux/clockchips.h>
30#include <linux/io.h> 30#include <linux/io.h>
31#include <linux/smc911x.h>
31 32
33#include <asm/clkdev.h>
32#include <asm/system.h> 34#include <asm/system.h>
33#include <mach/hardware.h> 35#include <mach/hardware.h>
34#include <asm/irq.h> 36#include <asm/irq.h>
35#include <asm/leds.h> 37#include <asm/leds.h>
38#include <asm/mach-types.h>
36#include <asm/hardware/arm_timer.h> 39#include <asm/hardware/arm_timer.h>
37#include <asm/hardware/icst307.h> 40#include <asm/hardware/icst307.h>
38 41
@@ -49,7 +52,7 @@
49 52
50#define REALVIEW_REFCOUNTER (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_24MHz_OFFSET) 53#define REALVIEW_REFCOUNTER (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_24MHz_OFFSET)
51 54
52/* used by entry-macro.S */ 55/* used by entry-macro.S and platsmp.c */
53void __iomem *gic_cpu_base_addr; 56void __iomem *gic_cpu_base_addr;
54 57
55/* 58/*
@@ -124,6 +127,29 @@ int realview_flash_register(struct resource *res, u32 num)
124 return platform_device_register(&realview_flash_device); 127 return platform_device_register(&realview_flash_device);
125} 128}
126 129
130static struct smc911x_platdata realview_smc911x_platdata = {
131 .flags = SMC911X_USE_32BIT,
132 .irq_flags = IRQF_SHARED,
133 .irq_polarity = 1,
134};
135
136static struct platform_device realview_eth_device = {
137 .name = "smc911x",
138 .id = 0,
139 .num_resources = 2,
140};
141
142int realview_eth_register(const char *name, struct resource *res)
143{
144 if (name)
145 realview_eth_device.name = name;
146 realview_eth_device.resource = res;
147 if (strcmp(realview_eth_device.name, "smc911x") == 0)
148 realview_eth_device.dev.platform_data = &realview_smc911x_platdata;
149
150 return platform_device_register(&realview_eth_device);
151}
152
127static struct resource realview_i2c_resource = { 153static struct resource realview_i2c_resource = {
128 .start = REALVIEW_I2C_BASE, 154 .start = REALVIEW_I2C_BASE,
129 .end = REALVIEW_I2C_BASE + SZ_4K - 1, 155 .end = REALVIEW_I2C_BASE + SZ_4K - 1,
@@ -177,9 +203,14 @@ static const struct icst307_params realview_oscvco_params = {
177static void realview_oscvco_set(struct clk *clk, struct icst307_vco vco) 203static void realview_oscvco_set(struct clk *clk, struct icst307_vco vco)
178{ 204{
179 void __iomem *sys_lock = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LOCK_OFFSET; 205 void __iomem *sys_lock = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LOCK_OFFSET;
180 void __iomem *sys_osc = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC4_OFFSET; 206 void __iomem *sys_osc;
181 u32 val; 207 u32 val;
182 208
209 if (machine_is_realview_pb1176())
210 sys_osc = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC0_OFFSET;
211 else
212 sys_osc = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC4_OFFSET;
213
183 val = readl(sys_osc) & ~0x7ffff; 214 val = readl(sys_osc) & ~0x7ffff;
184 val |= vco.v | (vco.r << 9) | (vco.s << 16); 215 val |= vco.v | (vco.r << 9) | (vco.s << 16);
185 216
@@ -188,13 +219,60 @@ static void realview_oscvco_set(struct clk *clk, struct icst307_vco vco)
188 writel(0, sys_lock); 219 writel(0, sys_lock);
189} 220}
190 221
191struct clk realview_clcd_clk = { 222static struct clk oscvco_clk = {
192 .name = "CLCDCLK",
193 .params = &realview_oscvco_params, 223 .params = &realview_oscvco_params,
194 .setvco = realview_oscvco_set, 224 .setvco = realview_oscvco_set,
195}; 225};
196 226
197/* 227/*
228 * These are fixed clocks.
229 */
230static struct clk ref24_clk = {
231 .rate = 24000000,
232};
233
234static struct clk_lookup lookups[] = {
235 { /* UART0 */
236 .dev_id = "dev:f1",
237 .clk = &ref24_clk,
238 }, { /* UART1 */
239 .dev_id = "dev:f2",
240 .clk = &ref24_clk,
241 }, { /* UART2 */
242 .dev_id = "dev:f3",
243 .clk = &ref24_clk,
244 }, { /* UART3 */
245 .dev_id = "fpga:09",
246 .clk = &ref24_clk,
247 }, { /* KMI0 */
248 .dev_id = "fpga:06",
249 .clk = &ref24_clk,
250 }, { /* KMI1 */
251 .dev_id = "fpga:07",
252 .clk = &ref24_clk,
253 }, { /* MMC0 */
254 .dev_id = "fpga:05",
255 .clk = &ref24_clk,
256 }, { /* EB:CLCD */
257 .dev_id = "dev:20",
258 .clk = &oscvco_clk,
259 }, { /* PB:CLCD */
260 .dev_id = "issp:20",
261 .clk = &oscvco_clk,
262 }
263};
264
265static int __init clk_init(void)
266{
267 int i;
268
269 for (i = 0; i < ARRAY_SIZE(lookups); i++)
270 clkdev_add(&lookups[i]);
271 return 0;
272}
273arch_initcall(clk_init);
274
275/*
198 * CLCD support. 276 * CLCD support.
199 */ 277 */
200#define SYS_CLCD_NLCDIOON (1 << 2) 278#define SYS_CLCD_NLCDIOON (1 << 2)
@@ -226,7 +304,30 @@ static struct clcd_panel vga = {
226 .width = -1, 304 .width = -1,
227 .height = -1, 305 .height = -1,
228 .tim2 = TIM2_BCD | TIM2_IPC, 306 .tim2 = TIM2_BCD | TIM2_IPC,
229 .cntl = CNTL_LCDTFT | CNTL_LCDVCOMP(1), 307 .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
308 .bpp = 16,
309};
310
311static struct clcd_panel xvga = {
312 .mode = {
313 .name = "XVGA",
314 .refresh = 60,
315 .xres = 1024,
316 .yres = 768,
317 .pixclock = 15748,
318 .left_margin = 152,
319 .right_margin = 48,
320 .upper_margin = 23,
321 .lower_margin = 3,
322 .hsync_len = 104,
323 .vsync_len = 4,
324 .sync = 0,
325 .vmode = FB_VMODE_NONINTERLACED,
326 },
327 .width = -1,
328 .height = -1,
329 .tim2 = TIM2_BCD | TIM2_IPC,
330 .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
230 .bpp = 16, 331 .bpp = 16,
231}; 332};
232 333
@@ -249,7 +350,7 @@ static struct clcd_panel sanyo_3_8_in = {
249 .width = -1, 350 .width = -1,
250 .height = -1, 351 .height = -1,
251 .tim2 = TIM2_BCD, 352 .tim2 = TIM2_BCD,
252 .cntl = CNTL_LCDTFT | CNTL_LCDVCOMP(1), 353 .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
253 .bpp = 16, 354 .bpp = 16,
254}; 355};
255 356
@@ -272,7 +373,7 @@ static struct clcd_panel sanyo_2_5_in = {
272 .width = -1, 373 .width = -1,
273 .height = -1, 374 .height = -1,
274 .tim2 = TIM2_IVS | TIM2_IHS | TIM2_IPC, 375 .tim2 = TIM2_IVS | TIM2_IHS | TIM2_IPC,
275 .cntl = CNTL_LCDTFT | CNTL_LCDVCOMP(1), 376 .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
276 .bpp = 16, 377 .bpp = 16,
277}; 378};
278 379
@@ -295,7 +396,7 @@ static struct clcd_panel epson_2_2_in = {
295 .width = -1, 396 .width = -1,
296 .height = -1, 397 .height = -1,
297 .tim2 = TIM2_BCD | TIM2_IPC, 398 .tim2 = TIM2_BCD | TIM2_IPC,
298 .cntl = CNTL_LCDTFT | CNTL_LCDVCOMP(1), 399 .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
299 .bpp = 16, 400 .bpp = 16,
300}; 401};
301 402
@@ -308,9 +409,15 @@ static struct clcd_panel epson_2_2_in = {
308static struct clcd_panel *realview_clcd_panel(void) 409static struct clcd_panel *realview_clcd_panel(void)
309{ 410{
310 void __iomem *sys_clcd = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_CLCD_OFFSET; 411 void __iomem *sys_clcd = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_CLCD_OFFSET;
311 struct clcd_panel *panel = &vga; 412 struct clcd_panel *vga_panel;
413 struct clcd_panel *panel;
312 u32 val; 414 u32 val;
313 415
416 if (machine_is_realview_eb())
417 vga_panel = &vga;
418 else
419 vga_panel = &xvga;
420
314 val = readl(sys_clcd) & SYS_CLCD_ID_MASK; 421 val = readl(sys_clcd) & SYS_CLCD_ID_MASK;
315 if (val == SYS_CLCD_ID_SANYO_3_8) 422 if (val == SYS_CLCD_ID_SANYO_3_8)
316 panel = &sanyo_3_8_in; 423 panel = &sanyo_3_8_in;
@@ -319,11 +426,11 @@ static struct clcd_panel *realview_clcd_panel(void)
319 else if (val == SYS_CLCD_ID_EPSON_2_2) 426 else if (val == SYS_CLCD_ID_EPSON_2_2)
320 panel = &epson_2_2_in; 427 panel = &epson_2_2_in;
321 else if (val == SYS_CLCD_ID_VGA) 428 else if (val == SYS_CLCD_ID_VGA)
322 panel = &vga; 429 panel = vga_panel;
323 else { 430 else {
324 printk(KERN_ERR "CLCD: unknown LCD panel ID 0x%08x, using VGA\n", 431 printk(KERN_ERR "CLCD: unknown LCD panel ID 0x%08x, using VGA\n",
325 val); 432 val);
326 panel = &vga; 433 panel = vga_panel;
327 } 434 }
328 435
329 return panel; 436 return panel;
@@ -358,12 +465,18 @@ static void realview_clcd_enable(struct clcd_fb *fb)
358 writel(val, sys_clcd); 465 writel(val, sys_clcd);
359} 466}
360 467
361static unsigned long framesize = SZ_1M;
362
363static int realview_clcd_setup(struct clcd_fb *fb) 468static int realview_clcd_setup(struct clcd_fb *fb)
364{ 469{
470 unsigned long framesize;
365 dma_addr_t dma; 471 dma_addr_t dma;
366 472
473 if (machine_is_realview_eb())
474 /* VGA, 16bpp */
475 framesize = 640 * 480 * 2;
476 else
477 /* XVGA, 16bpp */
478 framesize = 1024 * 768 * 2;
479
367 fb->panel = realview_clcd_panel(); 480 fb->panel = realview_clcd_panel();
368 481
369 fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev, framesize, 482 fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev, framesize,
@@ -511,7 +624,7 @@ static struct clock_event_device timer0_clockevent = {
511 .set_mode = timer_set_mode, 624 .set_mode = timer_set_mode,
512 .set_next_event = timer_set_next_event, 625 .set_next_event = timer_set_next_event,
513 .rating = 300, 626 .rating = 300,
514 .cpumask = CPU_MASK_ALL, 627 .cpumask = cpu_all_mask,
515}; 628};
516 629
517static void __init realview_clockevents_init(unsigned int timer_irq) 630static void __init realview_clockevents_init(unsigned int timer_irq)
@@ -588,7 +701,7 @@ void __init realview_timer_init(unsigned int timer_irq)
588 * The dummy clock device has to be registered before the main device 701 * The dummy clock device has to be registered before the main device
589 * so that the latter will broadcast the clock events 702 * so that the latter will broadcast the clock events
590 */ 703 */
591 local_timer_setup(smp_processor_id()); 704 local_timer_setup();
592#endif 705#endif
593 706
594 /* 707 /*
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
index 3cea92c70d8f..44269b162d49 100644
--- a/arch/arm/mach-realview/core.h
+++ b/arch/arm/mach-realview/core.h
@@ -31,7 +31,7 @@
31static struct amba_device name##_device = { \ 31static struct amba_device name##_device = { \
32 .dev = { \ 32 .dev = { \
33 .coherent_dma_mask = ~0, \ 33 .coherent_dma_mask = ~0, \
34 .bus_id = busid, \ 34 .init_name = busid, \
35 .platform_data = plat, \ 35 .platform_data = plat, \
36 }, \ 36 }, \
37 .res = { \ 37 .res = { \
@@ -48,12 +48,10 @@ extern struct platform_device realview_flash_device;
48extern struct platform_device realview_i2c_device; 48extern struct platform_device realview_i2c_device;
49extern struct mmc_platform_data realview_mmc0_plat_data; 49extern struct mmc_platform_data realview_mmc0_plat_data;
50extern struct mmc_platform_data realview_mmc1_plat_data; 50extern struct mmc_platform_data realview_mmc1_plat_data;
51extern struct clk realview_clcd_clk;
52extern struct clcd_board clcd_plat_data; 51extern struct clcd_board clcd_plat_data;
53extern void __iomem *gic_cpu_base_addr; 52extern void __iomem *gic_cpu_base_addr;
54#ifdef CONFIG_LOCAL_TIMERS 53#ifdef CONFIG_LOCAL_TIMERS
55extern void __iomem *twd_base_addr; 54extern void __iomem *twd_base;
56extern unsigned int twd_size;
57#endif 55#endif
58extern void __iomem *timer0_va_base; 56extern void __iomem *timer0_va_base;
59extern void __iomem *timer1_va_base; 57extern void __iomem *timer1_va_base;
@@ -63,5 +61,6 @@ extern void __iomem *timer3_va_base;
63extern void realview_leds_event(led_event_t ledevt); 61extern void realview_leds_event(led_event_t ledevt);
64extern void realview_timer_init(unsigned int timer_irq); 62extern void realview_timer_init(unsigned int timer_irq);
65extern int realview_flash_register(struct resource *res, u32 num); 63extern int realview_flash_register(struct resource *res, u32 num);
64extern int realview_eth_register(const char *name, struct resource *res);
66 65
67#endif 66#endif
diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c
index 09748cbcd10e..be048e3e8799 100644
--- a/arch/arm/mach-realview/hotplug.c
+++ b/arch/arm/mach-realview/hotplug.c
@@ -13,6 +13,8 @@
13#include <linux/smp.h> 13#include <linux/smp.h>
14#include <linux/completion.h> 14#include <linux/completion.h>
15 15
16#include <asm/cacheflush.h>
17
16extern volatile int pen_release; 18extern volatile int pen_release;
17 19
18static DECLARE_COMPLETION(cpu_killed); 20static DECLARE_COMPLETION(cpu_killed);
@@ -21,7 +23,8 @@ static inline void cpu_enter_lowpower(void)
21{ 23{
22 unsigned int v; 24 unsigned int v;
23 25
24 asm volatile( "mcr p15, 0, %1, c7, c14, 0\n" 26 flush_cache_all();
27 asm volatile(
25 " mcr p15, 0, %1, c7, c5, 0\n" 28 " mcr p15, 0, %1, c7, c5, 0\n"
26 " mcr p15, 0, %1, c7, c10, 4\n" 29 " mcr p15, 0, %1, c7, c10, 4\n"
27 /* 30 /*
diff --git a/arch/arm/mach-realview/include/mach/board-eb.h b/arch/arm/mach-realview/include/mach/board-eb.h
index 8d699fd324d0..268d7701fa9b 100644
--- a/arch/arm/mach-realview/include/mach/board-eb.h
+++ b/arch/arm/mach-realview/include/mach/board-eb.h
@@ -49,16 +49,14 @@
49#ifdef CONFIG_REALVIEW_EB_ARM11MP_REVB 49#ifdef CONFIG_REALVIEW_EB_ARM11MP_REVB
50#define REALVIEW_EB11MP_SCU_BASE 0x10100000 /* SCU registers */ 50#define REALVIEW_EB11MP_SCU_BASE 0x10100000 /* SCU registers */
51#define REALVIEW_EB11MP_GIC_CPU_BASE 0x10100100 /* Generic interrupt controller CPU interface */ 51#define REALVIEW_EB11MP_GIC_CPU_BASE 0x10100100 /* Generic interrupt controller CPU interface */
52#define REALVIEW_EB11MP_TWD_BASE 0x10100700 52#define REALVIEW_EB11MP_TWD_BASE 0x10100600
53#define REALVIEW_EB11MP_TWD_SIZE 0x00000100
54#define REALVIEW_EB11MP_GIC_DIST_BASE 0x10101000 /* Generic interrupt controller distributor */ 53#define REALVIEW_EB11MP_GIC_DIST_BASE 0x10101000 /* Generic interrupt controller distributor */
55#define REALVIEW_EB11MP_L220_BASE 0x10102000 /* L220 registers */ 54#define REALVIEW_EB11MP_L220_BASE 0x10102000 /* L220 registers */
56#define REALVIEW_EB11MP_SYS_PLD_CTRL1 0xD8 /* Register offset for MPCore sysctl */ 55#define REALVIEW_EB11MP_SYS_PLD_CTRL1 0xD8 /* Register offset for MPCore sysctl */
57#else 56#else
58#define REALVIEW_EB11MP_SCU_BASE 0x1F000000 /* SCU registers */ 57#define REALVIEW_EB11MP_SCU_BASE 0x1F000000 /* SCU registers */
59#define REALVIEW_EB11MP_GIC_CPU_BASE 0x1F000100 /* Generic interrupt controller CPU interface */ 58#define REALVIEW_EB11MP_GIC_CPU_BASE 0x1F000100 /* Generic interrupt controller CPU interface */
60#define REALVIEW_EB11MP_TWD_BASE 0x1F000700 59#define REALVIEW_EB11MP_TWD_BASE 0x1F000600
61#define REALVIEW_EB11MP_TWD_SIZE 0x00000100
62#define REALVIEW_EB11MP_GIC_DIST_BASE 0x1F001000 /* Generic interrupt controller distributor */ 60#define REALVIEW_EB11MP_GIC_DIST_BASE 0x1F001000 /* Generic interrupt controller distributor */
63#define REALVIEW_EB11MP_L220_BASE 0x1F002000 /* L220 registers */ 61#define REALVIEW_EB11MP_L220_BASE 0x1F002000 /* L220 registers */
64#define REALVIEW_EB11MP_SYS_PLD_CTRL1 0x74 /* Register offset for MPCore sysctl */ 62#define REALVIEW_EB11MP_SYS_PLD_CTRL1 0x74 /* Register offset for MPCore sysctl */
@@ -163,7 +161,7 @@
163#define NR_IRQS NR_IRQS_EB 161#define NR_IRQS NR_IRQS_EB
164#endif 162#endif
165 163
166#if defined(CONFIG_REALVIEW_EB_ARM11MP) \ 164#if defined(CONFIG_REALVIEW_EB_ARM11MP) || defined(CONFIG_REALVIEW_EB_A9MP) \
167 && (!defined(MAX_GIC_NR) || (MAX_GIC_NR < NR_GIC_EB11MP)) 165 && (!defined(MAX_GIC_NR) || (MAX_GIC_NR < NR_GIC_EB11MP))
168#undef MAX_GIC_NR 166#undef MAX_GIC_NR
169#define MAX_GIC_NR NR_GIC_EB11MP 167#define MAX_GIC_NR NR_GIC_EB11MP
@@ -177,6 +175,7 @@
177#define REALVIEW_EB_PROC_ARM9 0x02000000 175#define REALVIEW_EB_PROC_ARM9 0x02000000
178#define REALVIEW_EB_PROC_ARM11 0x04000000 176#define REALVIEW_EB_PROC_ARM11 0x04000000
179#define REALVIEW_EB_PROC_ARM11MP 0x06000000 177#define REALVIEW_EB_PROC_ARM11MP 0x06000000
178#define REALVIEW_EB_PROC_A9MP 0x0C000000
180 179
181#define check_eb_proc(proc_type) \ 180#define check_eb_proc(proc_type) \
182 ((readl(__io_address(REALVIEW_SYS_PROCID)) & REALVIEW_EB_PROC_MASK) \ 181 ((readl(__io_address(REALVIEW_SYS_PROCID)) & REALVIEW_EB_PROC_MASK) \
@@ -188,4 +187,13 @@
188#define core_tile_eb11mp() 0 187#define core_tile_eb11mp() 0
189#endif 188#endif
190 189
190#ifdef CONFIG_REALVIEW_EB_A9MP
191#define core_tile_a9mp() check_eb_proc(REALVIEW_EB_PROC_A9MP)
192#else
193#define core_tile_a9mp() 0
194#endif
195
196#define machine_is_realview_eb_mp() \
197 (machine_is_realview_eb() && (core_tile_eb11mp() || core_tile_a9mp()))
198
191#endif /* __ASM_ARCH_BOARD_EB_H */ 199#endif /* __ASM_ARCH_BOARD_EB_H */
diff --git a/arch/arm/mach-realview/include/mach/board-pb11mp.h b/arch/arm/mach-realview/include/mach/board-pb11mp.h
index ecd80e58631e..53ea0e7a1267 100644
--- a/arch/arm/mach-realview/include/mach/board-pb11mp.h
+++ b/arch/arm/mach-realview/include/mach/board-pb11mp.h
@@ -77,8 +77,7 @@
77 */ 77 */
78#define REALVIEW_TC11MP_SCU_BASE 0x1F000000 /* IRQ, Test chip */ 78#define REALVIEW_TC11MP_SCU_BASE 0x1F000000 /* IRQ, Test chip */
79#define REALVIEW_TC11MP_GIC_CPU_BASE 0x1F000100 /* Test chip interrupt controller CPU interface */ 79#define REALVIEW_TC11MP_GIC_CPU_BASE 0x1F000100 /* Test chip interrupt controller CPU interface */
80#define REALVIEW_TC11MP_TWD_BASE 0x1F000700 80#define REALVIEW_TC11MP_TWD_BASE 0x1F000600
81#define REALVIEW_TC11MP_TWD_SIZE 0x00000100
82#define REALVIEW_TC11MP_GIC_DIST_BASE 0x1F001000 /* Test chip interrupt controller distributor */ 81#define REALVIEW_TC11MP_GIC_DIST_BASE 0x1F001000 /* Test chip interrupt controller distributor */
83#define REALVIEW_TC11MP_L220_BASE 0x1F002000 /* L220 registers */ 82#define REALVIEW_TC11MP_L220_BASE 0x1F002000 /* L220 registers */
84 83
diff --git a/arch/arm/mach-realview/include/mach/board-pba8.h b/arch/arm/mach-realview/include/mach/board-pba8.h
new file mode 100644
index 000000000000..c8bed8f58bab
--- /dev/null
+++ b/arch/arm/mach-realview/include/mach/board-pba8.h
@@ -0,0 +1,152 @@
1/*
2 * include/asm-arm/arch-realview/board-pba8.h
3 *
4 * Copyright (C) 2008 ARM Limited
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 * 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#ifndef __ASM_ARCH_BOARD_PBA8_H
22#define __ASM_ARCH_BOARD_PBA8_H
23
24#include <mach/platform.h>
25
26/*
27 * Peripheral addresses
28 */
29#define REALVIEW_PBA8_UART0_BASE 0x10009000 /* UART 0 */
30#define REALVIEW_PBA8_UART1_BASE 0x1000A000 /* UART 1 */
31#define REALVIEW_PBA8_UART2_BASE 0x1000B000 /* UART 2 */
32#define REALVIEW_PBA8_UART3_BASE 0x1000C000 /* UART 3 */
33#define REALVIEW_PBA8_SSP_BASE 0x1000D000 /* Synchronous Serial Port */
34#define REALVIEW_PBA8_WATCHDOG0_BASE 0x1000F000 /* Watchdog 0 */
35#define REALVIEW_PBA8_WATCHDOG_BASE 0x10010000 /* watchdog interface */
36#define REALVIEW_PBA8_TIMER0_1_BASE 0x10011000 /* Timer 0 and 1 */
37#define REALVIEW_PBA8_TIMER2_3_BASE 0x10012000 /* Timer 2 and 3 */
38#define REALVIEW_PBA8_GPIO0_BASE 0x10013000 /* GPIO port 0 */
39#define REALVIEW_PBA8_RTC_BASE 0x10017000 /* Real Time Clock */
40#define REALVIEW_PBA8_TIMER4_5_BASE 0x10018000 /* Timer 4/5 */
41#define REALVIEW_PBA8_TIMER6_7_BASE 0x10019000 /* Timer 6/7 */
42#define REALVIEW_PBA8_SCTL_BASE 0x1001A000 /* System Controller */
43#define REALVIEW_PBA8_CLCD_BASE 0x10020000 /* CLCD */
44#define REALVIEW_PBA8_ONB_SRAM_BASE 0x10060000 /* On-board SRAM */
45#define REALVIEW_PBA8_DMC_BASE 0x100E0000 /* DMC configuration */
46#define REALVIEW_PBA8_SMC_BASE 0x100E1000 /* SMC configuration */
47#define REALVIEW_PBA8_CAN_BASE 0x100E2000 /* CAN bus */
48#define REALVIEW_PBA8_CF_BASE 0x18000000 /* Compact flash */
49#define REALVIEW_PBA8_CF_MEM_BASE 0x18003000 /* SMC for Compact flash */
50#define REALVIEW_PBA8_GIC_CPU_BASE 0x1E000000 /* Generic interrupt controller CPU interface */
51#define REALVIEW_PBA8_FLASH0_BASE 0x40000000
52#define REALVIEW_PBA8_FLASH0_SIZE SZ_64M
53#define REALVIEW_PBA8_FLASH1_BASE 0x44000000
54#define REALVIEW_PBA8_FLASH1_SIZE SZ_64M
55#define REALVIEW_PBA8_ETH_BASE 0x4E000000 /* Ethernet */
56#define REALVIEW_PBA8_USB_BASE 0x4F000000 /* USB */
57#define REALVIEW_PBA8_GIC_DIST_BASE 0x1E001000 /* Generic interrupt controller distributor */
58#define REALVIEW_PBA8_LT_BASE 0xC0000000 /* Logic Tile expansion */
59#define REALVIEW_PBA8_SDRAM6_BASE 0x70000000 /* SDRAM bank 6 256MB */
60#define REALVIEW_PBA8_SDRAM7_BASE 0x80000000 /* SDRAM bank 7 256MB */
61
62#define REALVIEW_PBA8_SYS_PLD_CTRL1 0x74
63
64/*
65 * PBA8 PCI regions
66 */
67#define REALVIEW_PBA8_PCI_BASE 0x90040000 /* PCI-X Unit base */
68#define REALVIEW_PBA8_PCI_IO_BASE 0x90050000 /* IO Region on AHB */
69#define REALVIEW_PBA8_PCI_MEM_BASE 0xA0000000 /* MEM Region on AHB */
70
71#define REALVIEW_PBA8_PCI_BASE_SIZE 0x10000 /* 16 Kb */
72#define REALVIEW_PBA8_PCI_IO_SIZE 0x1000 /* 4 Kb */
73#define REALVIEW_PBA8_PCI_MEM_SIZE 0x20000000 /* 512 MB */
74
75/*
76 * Irqs
77 */
78#define IRQ_PBA8_GIC_START 32
79
80/* L220
81#define IRQ_PBA8_L220_EVENT (IRQ_PBA8_GIC_START + 29)
82#define IRQ_PBA8_L220_SLAVE (IRQ_PBA8_GIC_START + 30)
83#define IRQ_PBA8_L220_DECODE (IRQ_PBA8_GIC_START + 31)
84*/
85
86/*
87 * PB-A8 on-board gic irq sources
88 */
89#define IRQ_PBA8_WATCHDOG (IRQ_PBA8_GIC_START + 0) /* Watchdog timer */
90#define IRQ_PBA8_SOFT (IRQ_PBA8_GIC_START + 1) /* Software interrupt */
91#define IRQ_PBA8_COMMRx (IRQ_PBA8_GIC_START + 2) /* Debug Comm Rx interrupt */
92#define IRQ_PBA8_COMMTx (IRQ_PBA8_GIC_START + 3) /* Debug Comm Tx interrupt */
93#define IRQ_PBA8_TIMER0_1 (IRQ_PBA8_GIC_START + 4) /* Timer 0/1 (default timer) */
94#define IRQ_PBA8_TIMER2_3 (IRQ_PBA8_GIC_START + 5) /* Timer 2/3 */
95#define IRQ_PBA8_GPIO0 (IRQ_PBA8_GIC_START + 6) /* GPIO 0 */
96#define IRQ_PBA8_GPIO1 (IRQ_PBA8_GIC_START + 7) /* GPIO 1 */
97#define IRQ_PBA8_GPIO2 (IRQ_PBA8_GIC_START + 8) /* GPIO 2 */
98 /* 9 reserved */
99#define IRQ_PBA8_RTC (IRQ_PBA8_GIC_START + 10) /* Real Time Clock */
100#define IRQ_PBA8_SSP (IRQ_PBA8_GIC_START + 11) /* Synchronous Serial Port */
101#define IRQ_PBA8_UART0 (IRQ_PBA8_GIC_START + 12) /* UART 0 on development chip */
102#define IRQ_PBA8_UART1 (IRQ_PBA8_GIC_START + 13) /* UART 1 on development chip */
103#define IRQ_PBA8_UART2 (IRQ_PBA8_GIC_START + 14) /* UART 2 on development chip */
104#define IRQ_PBA8_UART3 (IRQ_PBA8_GIC_START + 15) /* UART 3 on development chip */
105#define IRQ_PBA8_SCI (IRQ_PBA8_GIC_START + 16) /* Smart Card Interface */
106#define IRQ_PBA8_MMCI0A (IRQ_PBA8_GIC_START + 17) /* Multimedia Card 0A */
107#define IRQ_PBA8_MMCI0B (IRQ_PBA8_GIC_START + 18) /* Multimedia Card 0B */
108#define IRQ_PBA8_AACI (IRQ_PBA8_GIC_START + 19) /* Audio Codec */
109#define IRQ_PBA8_KMI0 (IRQ_PBA8_GIC_START + 20) /* Keyboard/Mouse port 0 */
110#define IRQ_PBA8_KMI1 (IRQ_PBA8_GIC_START + 21) /* Keyboard/Mouse port 1 */
111#define IRQ_PBA8_CHARLCD (IRQ_PBA8_GIC_START + 22) /* Character LCD */
112#define IRQ_PBA8_CLCD (IRQ_PBA8_GIC_START + 23) /* CLCD controller */
113#define IRQ_PBA8_DMAC (IRQ_PBA8_GIC_START + 24) /* DMA controller */
114#define IRQ_PBA8_PWRFAIL (IRQ_PBA8_GIC_START + 25) /* Power failure */
115#define IRQ_PBA8_PISMO (IRQ_PBA8_GIC_START + 26) /* PISMO interface */
116#define IRQ_PBA8_DoC (IRQ_PBA8_GIC_START + 27) /* Disk on Chip memory controller */
117#define IRQ_PBA8_ETH (IRQ_PBA8_GIC_START + 28) /* Ethernet controller */
118#define IRQ_PBA8_USB (IRQ_PBA8_GIC_START + 29) /* USB controller */
119#define IRQ_PBA8_TSPEN (IRQ_PBA8_GIC_START + 30) /* Touchscreen pen */
120#define IRQ_PBA8_TSKPAD (IRQ_PBA8_GIC_START + 31) /* Touchscreen keypad */
121
122/* ... */
123#define IRQ_PBA8_PCI0 (IRQ_PBA8_GIC_START + 50)
124#define IRQ_PBA8_PCI1 (IRQ_PBA8_GIC_START + 51)
125#define IRQ_PBA8_PCI2 (IRQ_PBA8_GIC_START + 52)
126#define IRQ_PBA8_PCI3 (IRQ_PBA8_GIC_START + 53)
127
128#define IRQ_PBA8_SMC -1
129#define IRQ_PBA8_SCTL -1
130
131#define NR_GIC_PBA8 1
132
133/*
134 * Only define NR_IRQS if less than NR_IRQS_PBA8
135 */
136#define NR_IRQS_PBA8 (IRQ_PBA8_GIC_START + 64)
137
138#if defined(CONFIG_MACH_REALVIEW_PBA8)
139
140#if !defined(NR_IRQS) || (NR_IRQS < NR_IRQS_PBA8)
141#undef NR_IRQS
142#define NR_IRQS NR_IRQS_PBA8
143#endif
144
145#if !defined(MAX_GIC_NR) || (MAX_GIC_NR < NR_GIC_PBA8)
146#undef MAX_GIC_NR
147#define MAX_GIC_NR NR_GIC_PBA8
148#endif
149
150#endif /* CONFIG_MACH_REALVIEW_PBA8 */
151
152#endif /* __ASM_ARCH_BOARD_PBA8_H */
diff --git a/arch/arm/mach-realview/include/mach/clkdev.h b/arch/arm/mach-realview/include/mach/clkdev.h
new file mode 100644
index 000000000000..04b37a89801c
--- /dev/null
+++ b/arch/arm/mach-realview/include/mach/clkdev.h
@@ -0,0 +1,7 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do { } while (0)
6
7#endif
diff --git a/arch/arm/mach-realview/include/mach/debug-macro.S b/arch/arm/mach-realview/include/mach/debug-macro.S
index 7196bcadff0c..92dbcb9e1792 100644
--- a/arch/arm/mach-realview/include/mach/debug-macro.S
+++ b/arch/arm/mach-realview/include/mach/debug-macro.S
@@ -8,15 +8,36 @@
8 * This program is free software; you can redistribute it and/or modify 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 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 * 11 */
12*/ 12
13#if defined(CONFIG_MACH_REALVIEW_EB) || \
14 defined(CONFIG_MACH_REALVIEW_PB11MP) || \
15 defined(CONFIG_MACH_REALVIEW_PBA8)
16#ifndef DEBUG_LL_UART_OFFSET
17#define DEBUG_LL_UART_OFFSET 0x00009000
18#elif DEBUG_LL_UART_OFFSET != 0x00009000
19#warning "DEBUG_LL_UART_OFFSET already defined to a different value"
20#endif
21#endif
22
23#ifdef CONFIG_MACH_REALVIEW_PB1176
24#ifndef DEBUG_LL_UART_OFFSET
25#define DEBUG_LL_UART_OFFSET 0x0010c000
26#elif DEBUG_LL_UART_OFFSET != 0x0010c000
27#warning "DEBUG_LL_UART_OFFSET already defined to a different value"
28#endif
29#endif
30
31#ifndef DEBUG_LL_UART_OFFSET
32#error "Unknown RealView platform"
33#endif
13 34
14 .macro addruart,rx 35 .macro addruart,rx
15 mrc p15, 0, \rx, c1, c0 36 mrc p15, 0, \rx, c1, c0
16 tst \rx, #1 @ MMU enabled? 37 tst \rx, #1 @ MMU enabled?
17 moveq \rx, #0x10000000 38 moveq \rx, #0x10000000
18 movne \rx, #0xf0000000 @ virtual base 39 movne \rx, #0xfb000000 @ virtual base
19 orr \rx, \rx, #0x00009000 40 orr \rx, \rx, #DEBUG_LL_UART_OFFSET
20 .endm 41 .endm
21 42
22#include <asm/hardware/debug-pl01x.S> 43#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/mach-realview/include/mach/dma.h b/arch/arm/mach-realview/include/mach/dma.h
deleted file mode 100644
index f1a5a1a10952..000000000000
--- a/arch/arm/mach-realview/include/mach/dma.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * arch/arm/mach-realview/include/mach/dma.h
3 *
4 * Copyright (C) 2003 ARM Limited.
5 * Copyright (C) 1997,1998 Russell King
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 */
diff --git a/arch/arm/mach-realview/include/mach/hardware.h b/arch/arm/mach-realview/include/mach/hardware.h
index 79a93b3dfca9..b42c14f89acb 100644
--- a/arch/arm/mach-realview/include/mach/hardware.h
+++ b/arch/arm/mach-realview/include/mach/hardware.h
@@ -25,7 +25,14 @@
25#include <asm/sizes.h> 25#include <asm/sizes.h>
26 26
27/* macro to get at IO space when running virtually */ 27/* macro to get at IO space when running virtually */
28#define IO_ADDRESS(x) (((x) & 0x0fffffff) + 0xf0000000) 28/*
29 * Statically mapped addresses:
30 *
31 * 10xx xxxx -> fbxx xxxx
32 * 1exx xxxx -> fdxx xxxx
33 * 1fxx xxxx -> fexx xxxx
34 */
35#define IO_ADDRESS(x) (((x) & 0x03ffffff) + 0xfb000000)
29#define __io_address(n) __io(IO_ADDRESS(n)) 36#define __io_address(n) __io(IO_ADDRESS(n))
30 37
31#endif 38#endif
diff --git a/arch/arm/mach-realview/include/mach/io.h b/arch/arm/mach-realview/include/mach/io.h
index aa069424d310..f05bcdf605d8 100644
--- a/arch/arm/mach-realview/include/mach/io.h
+++ b/arch/arm/mach-realview/include/mach/io.h
@@ -22,12 +22,7 @@
22 22
23#define IO_SPACE_LIMIT 0xffffffff 23#define IO_SPACE_LIMIT 0xffffffff
24 24
25static inline void __iomem *__io(unsigned long addr) 25#define __io(a) __typesafe_io(a)
26{ 26#define __mem_pci(a) (a)
27 return (void __iomem *)addr;
28}
29
30#define __io(a) __io(a)
31#define __mem_pci(a) (a)
32 27
33#endif 28#endif
diff --git a/arch/arm/mach-realview/include/mach/irqs.h b/arch/arm/mach-realview/include/mach/irqs.h
index 02a918529db3..fe5cb987aa21 100644
--- a/arch/arm/mach-realview/include/mach/irqs.h
+++ b/arch/arm/mach-realview/include/mach/irqs.h
@@ -25,6 +25,7 @@
25#include <mach/board-eb.h> 25#include <mach/board-eb.h>
26#include <mach/board-pb11mp.h> 26#include <mach/board-pb11mp.h>
27#include <mach/board-pb1176.h> 27#include <mach/board-pb1176.h>
28#include <mach/board-pba8.h>
28 29
29#define IRQ_LOCALTIMER 29 30#define IRQ_LOCALTIMER 29
30#define IRQ_LOCALWDOG 30 31#define IRQ_LOCALWDOG 30
diff --git a/arch/arm/mach-realview/include/mach/memory.h b/arch/arm/mach-realview/include/mach/memory.h
index 0e673483a141..293c30025e7e 100644
--- a/arch/arm/mach-realview/include/mach/memory.h
+++ b/arch/arm/mach-realview/include/mach/memory.h
@@ -23,16 +23,10 @@
23/* 23/*
24 * Physical DRAM offset. 24 * Physical DRAM offset.
25 */ 25 */
26#ifdef CONFIG_REALVIEW_HIGH_PHYS_OFFSET
27#define PHYS_OFFSET UL(0x70000000)
28#else
26#define PHYS_OFFSET UL(0x00000000) 29#define PHYS_OFFSET UL(0x00000000)
27 30#endif
28/*
29 * Virtual view <-> DMA view memory address translations
30 * virt_to_bus: Used to translate the virtual address to an
31 * address suitable to be passed to set_dma_addr
32 * bus_to_virt: Used to convert an address for DMA operations
33 * to an address that the kernel can use.
34 */
35#define __virt_to_bus(x) ((x) - PAGE_OFFSET)
36#define __bus_to_virt(x) ((x) + PAGE_OFFSET)
37 31
38#endif 32#endif
diff --git a/arch/arm/mach-realview/include/mach/uncompress.h b/arch/arm/mach-realview/include/mach/uncompress.h
index 79f50f218e77..415d634d52ab 100644
--- a/arch/arm/mach-realview/include/mach/uncompress.h
+++ b/arch/arm/mach-realview/include/mach/uncompress.h
@@ -23,6 +23,7 @@
23#include <mach/board-eb.h> 23#include <mach/board-eb.h>
24#include <mach/board-pb11mp.h> 24#include <mach/board-pb11mp.h>
25#include <mach/board-pb1176.h> 25#include <mach/board-pb1176.h>
26#include <mach/board-pba8.h>
26 27
27#define AMBA_UART_DR(base) (*(volatile unsigned char *)((base) + 0x00)) 28#define AMBA_UART_DR(base) (*(volatile unsigned char *)((base) + 0x00))
28#define AMBA_UART_LCRH(base) (*(volatile unsigned char *)((base) + 0x2c)) 29#define AMBA_UART_LCRH(base) (*(volatile unsigned char *)((base) + 0x2c))
@@ -40,6 +41,8 @@ static inline unsigned long get_uart_base(void)
40 return REALVIEW_PB11MP_UART0_BASE; 41 return REALVIEW_PB11MP_UART0_BASE;
41 else if (machine_is_realview_pb1176()) 42 else if (machine_is_realview_pb1176())
42 return REALVIEW_PB1176_UART0_BASE; 43 return REALVIEW_PB1176_UART0_BASE;
44 else if (machine_is_realview_pba8())
45 return REALVIEW_PBA8_UART0_BASE;
43 else 46 else
44 return 0; 47 return 0;
45} 48}
diff --git a/arch/arm/mach-realview/include/mach/vmalloc.h b/arch/arm/mach-realview/include/mach/vmalloc.h
index 48cbcc873db2..fe0de1b507ac 100644
--- a/arch/arm/mach-realview/include/mach/vmalloc.h
+++ b/arch/arm/mach-realview/include/mach/vmalloc.h
@@ -18,4 +18,4 @@
18 * along with this program; if not, write to the Free Software 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 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21#define VMALLOC_END (PAGE_OFFSET + 0x18000000) 21#define VMALLOC_END 0xf8000000
diff --git a/arch/arm/mach-realview/localtimer.c b/arch/arm/mach-realview/localtimer.c
index 44d178cd5733..67d6d9cc68b2 100644
--- a/arch/arm/mach-realview/localtimer.c
+++ b/arch/arm/mach-realview/localtimer.c
@@ -38,18 +38,14 @@ void local_timer_interrupt(void)
38 38
39#ifdef CONFIG_LOCAL_TIMERS 39#ifdef CONFIG_LOCAL_TIMERS
40 40
41#define TWD_BASE(cpu) (twd_base_addr + (cpu) * twd_size)
42
43/* set up by the platform code */ 41/* set up by the platform code */
44void __iomem *twd_base_addr; 42void __iomem *twd_base;
45unsigned int twd_size;
46 43
47static unsigned long mpcore_timer_rate; 44static unsigned long mpcore_timer_rate;
48 45
49static void local_timer_set_mode(enum clock_event_mode mode, 46static void local_timer_set_mode(enum clock_event_mode mode,
50 struct clock_event_device *clk) 47 struct clock_event_device *clk)
51{ 48{
52 void __iomem *base = TWD_BASE(smp_processor_id());
53 unsigned long ctrl; 49 unsigned long ctrl;
54 50
55 switch(mode) { 51 switch(mode) {
@@ -68,17 +64,16 @@ static void local_timer_set_mode(enum clock_event_mode mode,
68 ctrl = 0; 64 ctrl = 0;
69 } 65 }
70 66
71 __raw_writel(ctrl, base + TWD_TIMER_CONTROL); 67 __raw_writel(ctrl, twd_base + TWD_TIMER_CONTROL);
72} 68}
73 69
74static int local_timer_set_next_event(unsigned long evt, 70static int local_timer_set_next_event(unsigned long evt,
75 struct clock_event_device *unused) 71 struct clock_event_device *unused)
76{ 72{
77 void __iomem *base = TWD_BASE(smp_processor_id()); 73 unsigned long ctrl = __raw_readl(twd_base + TWD_TIMER_CONTROL);
78 unsigned long ctrl = __raw_readl(base + TWD_TIMER_CONTROL);
79 74
80 __raw_writel(evt, base + TWD_TIMER_COUNTER); 75 __raw_writel(evt, twd_base + TWD_TIMER_COUNTER);
81 __raw_writel(ctrl | TWD_TIMER_CONTROL_ENABLE, base + TWD_TIMER_CONTROL); 76 __raw_writel(ctrl | TWD_TIMER_CONTROL_ENABLE, twd_base + TWD_TIMER_CONTROL);
82 77
83 return 0; 78 return 0;
84} 79}
@@ -91,19 +86,16 @@ static int local_timer_set_next_event(unsigned long evt,
91 */ 86 */
92int local_timer_ack(void) 87int local_timer_ack(void)
93{ 88{
94 void __iomem *base = TWD_BASE(smp_processor_id()); 89 if (__raw_readl(twd_base + TWD_TIMER_INTSTAT)) {
95 90 __raw_writel(1, twd_base + TWD_TIMER_INTSTAT);
96 if (__raw_readl(base + TWD_TIMER_INTSTAT)) {
97 __raw_writel(1, base + TWD_TIMER_INTSTAT);
98 return 1; 91 return 1;
99 } 92 }
100 93
101 return 0; 94 return 0;
102} 95}
103 96
104static void __cpuinit twd_calibrate_rate(unsigned int cpu) 97static void __cpuinit twd_calibrate_rate(void)
105{ 98{
106 void __iomem *base = TWD_BASE(cpu);
107 unsigned long load, count; 99 unsigned long load, count;
108 u64 waitjiffies; 100 u64 waitjiffies;
109 101
@@ -124,15 +116,15 @@ static void __cpuinit twd_calibrate_rate(unsigned int cpu)
124 waitjiffies += 5; 116 waitjiffies += 5;
125 117
126 /* enable, no interrupt or reload */ 118 /* enable, no interrupt or reload */
127 __raw_writel(0x1, base + TWD_TIMER_CONTROL); 119 __raw_writel(0x1, twd_base + TWD_TIMER_CONTROL);
128 120
129 /* maximum value */ 121 /* maximum value */
130 __raw_writel(0xFFFFFFFFU, base + TWD_TIMER_COUNTER); 122 __raw_writel(0xFFFFFFFFU, twd_base + TWD_TIMER_COUNTER);
131 123
132 while (get_jiffies_64() < waitjiffies) 124 while (get_jiffies_64() < waitjiffies)
133 udelay(10); 125 udelay(10);
134 126
135 count = __raw_readl(base + TWD_TIMER_COUNTER); 127 count = __raw_readl(twd_base + TWD_TIMER_COUNTER);
136 128
137 mpcore_timer_rate = (0xFFFFFFFFU - count) * (HZ / 5); 129 mpcore_timer_rate = (0xFFFFFFFFU - count) * (HZ / 5);
138 130
@@ -142,18 +134,19 @@ static void __cpuinit twd_calibrate_rate(unsigned int cpu)
142 134
143 load = mpcore_timer_rate / HZ; 135 load = mpcore_timer_rate / HZ;
144 136
145 __raw_writel(load, base + TWD_TIMER_LOAD); 137 __raw_writel(load, twd_base + TWD_TIMER_LOAD);
146} 138}
147 139
148/* 140/*
149 * Setup the local clock events for a CPU. 141 * Setup the local clock events for a CPU.
150 */ 142 */
151void __cpuinit local_timer_setup(unsigned int cpu) 143void __cpuinit local_timer_setup(void)
152{ 144{
145 unsigned int cpu = smp_processor_id();
153 struct clock_event_device *clk = &per_cpu(local_clockevent, cpu); 146 struct clock_event_device *clk = &per_cpu(local_clockevent, cpu);
154 unsigned long flags; 147 unsigned long flags;
155 148
156 twd_calibrate_rate(cpu); 149 twd_calibrate_rate();
157 150
158 clk->name = "local_timer"; 151 clk->name = "local_timer";
159 clk->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; 152 clk->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT;
@@ -161,7 +154,7 @@ void __cpuinit local_timer_setup(unsigned int cpu)
161 clk->set_mode = local_timer_set_mode; 154 clk->set_mode = local_timer_set_mode;
162 clk->set_next_event = local_timer_set_next_event; 155 clk->set_next_event = local_timer_set_next_event;
163 clk->irq = IRQ_LOCALTIMER; 156 clk->irq = IRQ_LOCALTIMER;
164 clk->cpumask = cpumask_of_cpu(cpu); 157 clk->cpumask = cpumask_of(cpu);
165 clk->shift = 20; 158 clk->shift = 20;
166 clk->mult = div_sc(mpcore_timer_rate, NSEC_PER_SEC, clk->shift); 159 clk->mult = div_sc(mpcore_timer_rate, NSEC_PER_SEC, clk->shift);
167 clk->max_delta_ns = clockevent_delta2ns(0xffffffff, clk); 160 clk->max_delta_ns = clockevent_delta2ns(0xffffffff, clk);
@@ -178,9 +171,9 @@ void __cpuinit local_timer_setup(unsigned int cpu)
178/* 171/*
179 * take a local timer down 172 * take a local timer down
180 */ 173 */
181void __cpuexit local_timer_stop(unsigned int cpu) 174void __cpuexit local_timer_stop(void)
182{ 175{
183 __raw_writel(0, TWD_BASE(cpu) + TWD_TIMER_CONTROL); 176 __raw_writel(0, twd_base + TWD_TIMER_CONTROL);
184} 177}
185 178
186#else /* CONFIG_LOCAL_TIMERS */ 179#else /* CONFIG_LOCAL_TIMERS */
@@ -190,8 +183,9 @@ static void dummy_timer_set_mode(enum clock_event_mode mode,
190{ 183{
191} 184}
192 185
193void __cpuinit local_timer_setup(unsigned int cpu) 186void __cpuinit local_timer_setup(void)
194{ 187{
188 unsigned int cpu = smp_processor_id();
195 struct clock_event_device *clk = &per_cpu(local_clockevent, cpu); 189 struct clock_event_device *clk = &per_cpu(local_clockevent, cpu);
196 190
197 clk->name = "dummy_timer"; 191 clk->name = "dummy_timer";
@@ -199,7 +193,7 @@ void __cpuinit local_timer_setup(unsigned int cpu)
199 clk->rating = 200; 193 clk->rating = 200;
200 clk->set_mode = dummy_timer_set_mode; 194 clk->set_mode = dummy_timer_set_mode;
201 clk->broadcast = smp_timer_broadcast; 195 clk->broadcast = smp_timer_broadcast;
202 clk->cpumask = cpumask_of_cpu(cpu); 196 clk->cpumask = cpumask_of(cpu);
203 197
204 clockevents_register_device(clk); 198 clockevents_register_device(clk);
205} 199}
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c
index e102aeb0f76e..8fce85f33033 100644
--- a/arch/arm/mach-realview/platsmp.c
+++ b/arch/arm/mach-realview/platsmp.c
@@ -23,6 +23,8 @@
23#include <mach/board-pb11mp.h> 23#include <mach/board-pb11mp.h>
24#include <mach/scu.h> 24#include <mach/scu.h>
25 25
26#include "core.h"
27
26extern void realview_secondary_startup(void); 28extern void realview_secondary_startup(void);
27 29
28/* 30/*
@@ -31,15 +33,20 @@ extern void realview_secondary_startup(void);
31 */ 33 */
32volatile int __cpuinitdata pen_release = -1; 34volatile int __cpuinitdata pen_release = -1;
33 35
36static void __iomem *scu_base_addr(void)
37{
38 if (machine_is_realview_eb_mp())
39 return __io_address(REALVIEW_EB11MP_SCU_BASE);
40 else if (machine_is_realview_pb11mp())
41 return __io_address(REALVIEW_TC11MP_SCU_BASE);
42 else
43 return (void __iomem *)0;
44}
45
34static unsigned int __init get_core_count(void) 46static unsigned int __init get_core_count(void)
35{ 47{
36 unsigned int ncores; 48 unsigned int ncores;
37 void __iomem *scu_base = 0; 49 void __iomem *scu_base = scu_base_addr();
38
39 if (machine_is_realview_eb() && core_tile_eb11mp())
40 scu_base = __io_address(REALVIEW_EB11MP_SCU_BASE);
41 else if (machine_is_realview_pb11mp())
42 scu_base = __io_address(REALVIEW_TC11MP_SCU_BASE);
43 50
44 if (scu_base) { 51 if (scu_base) {
45 ncores = __raw_readl(scu_base + SCU_CONFIG); 52 ncores = __raw_readl(scu_base + SCU_CONFIG);
@@ -56,14 +63,7 @@ static unsigned int __init get_core_count(void)
56static void scu_enable(void) 63static void scu_enable(void)
57{ 64{
58 u32 scu_ctrl; 65 u32 scu_ctrl;
59 void __iomem *scu_base; 66 void __iomem *scu_base = scu_base_addr();
60
61 if (machine_is_realview_eb() && core_tile_eb11mp())
62 scu_base = __io_address(REALVIEW_EB11MP_SCU_BASE);
63 else if (machine_is_realview_pb11mp())
64 scu_base = __io_address(REALVIEW_TC11MP_SCU_BASE);
65 else
66 BUG();
67 67
68 scu_ctrl = __raw_readl(scu_base + SCU_CTRL); 68 scu_ctrl = __raw_readl(scu_base + SCU_CTRL);
69 scu_ctrl |= 1; 69 scu_ctrl |= 1;
@@ -88,10 +88,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
88 * core (e.g. timer irq), then they will not have been enabled 88 * core (e.g. timer irq), then they will not have been enabled
89 * for us: do so 89 * for us: do so
90 */ 90 */
91 if (machine_is_realview_eb() && core_tile_eb11mp()) 91 gic_cpu_init(0, gic_cpu_base_addr);
92 gic_cpu_init(0, __io_address(REALVIEW_EB11MP_GIC_CPU_BASE));
93 else if (machine_is_realview_pb11mp())
94 gic_cpu_init(0, __io_address(REALVIEW_TC11MP_GIC_CPU_BASE));
95 92
96 /* 93 /*
97 * let the primary processor know we're out of the 94 * let the primary processor know we're out of the
@@ -232,9 +229,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
232 * dummy (!CONFIG_LOCAL_TIMERS), it was already registers in 229 * dummy (!CONFIG_LOCAL_TIMERS), it was already registers in
233 * realview_timer_init 230 * realview_timer_init
234 */ 231 */
235 if ((machine_is_realview_eb() && core_tile_eb11mp()) || 232 local_timer_setup();
236 machine_is_realview_pb11mp())
237 local_timer_setup(cpu);
238#endif 233#endif
239 234
240 /* 235 /*
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index eb829eb1ebe2..bed39ed97613 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -108,7 +108,7 @@ static struct map_desc realview_eb11mp_io_desc[] __initdata = {
108static void __init realview_eb_map_io(void) 108static void __init realview_eb_map_io(void)
109{ 109{
110 iotable_init(realview_eb_io_desc, ARRAY_SIZE(realview_eb_io_desc)); 110 iotable_init(realview_eb_io_desc, ARRAY_SIZE(realview_eb_io_desc));
111 if (core_tile_eb11mp()) 111 if (core_tile_eb11mp() || core_tile_a9mp())
112 iotable_init(realview_eb11mp_io_desc, ARRAY_SIZE(realview_eb11mp_io_desc)); 112 iotable_init(realview_eb11mp_io_desc, ARRAY_SIZE(realview_eb11mp_io_desc));
113} 113}
114 114
@@ -242,12 +242,6 @@ static struct resource realview_eb_eth_resources[] = {
242 }, 242 },
243}; 243};
244 244
245static struct platform_device realview_eb_eth_device = {
246 .id = 0,
247 .num_resources = ARRAY_SIZE(realview_eb_eth_resources),
248 .resource = realview_eb_eth_resources,
249};
250
251/* 245/*
252 * Detect and register the correct Ethernet device. RealView/EB rev D 246 * Detect and register the correct Ethernet device. RealView/EB rev D
253 * platforms use the newer SMSC LAN9118 Ethernet chip 247 * platforms use the newer SMSC LAN9118 Ethernet chip
@@ -255,26 +249,24 @@ static struct platform_device realview_eb_eth_device = {
255static int eth_device_register(void) 249static int eth_device_register(void)
256{ 250{
257 void __iomem *eth_addr = ioremap(REALVIEW_EB_ETH_BASE, SZ_4K); 251 void __iomem *eth_addr = ioremap(REALVIEW_EB_ETH_BASE, SZ_4K);
252 const char *name = NULL;
258 u32 idrev; 253 u32 idrev;
259 254
260 if (!eth_addr) 255 if (!eth_addr)
261 return -ENOMEM; 256 return -ENOMEM;
262 257
263 idrev = readl(eth_addr + 0x50); 258 idrev = readl(eth_addr + 0x50);
264 if ((idrev & 0xFFFF0000) == 0x01180000) 259 if ((idrev & 0xFFFF0000) != 0x01180000)
265 /* SMSC LAN9118 chip present */ 260 /* SMSC LAN9118 not present, use LAN91C111 instead */
266 realview_eb_eth_device.name = "smc911x"; 261 name = "smc91x";
267 else
268 /* SMSC 91C111 chip present */
269 realview_eb_eth_device.name = "smc91x";
270 262
271 iounmap(eth_addr); 263 iounmap(eth_addr);
272 return platform_device_register(&realview_eb_eth_device); 264 return realview_eth_register(name, realview_eb_eth_resources);
273} 265}
274 266
275static void __init gic_init_irq(void) 267static void __init gic_init_irq(void)
276{ 268{
277 if (core_tile_eb11mp()) { 269 if (core_tile_eb11mp() || core_tile_a9mp()) {
278 unsigned int pldctrl; 270 unsigned int pldctrl;
279 271
280 /* new irq mode */ 272 /* new irq mode */
@@ -342,10 +334,9 @@ static void __init realview_eb_timer_init(void)
342 timer2_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE); 334 timer2_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE);
343 timer3_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE) + 0x20; 335 timer3_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE) + 0x20;
344 336
345 if (core_tile_eb11mp()) { 337 if (core_tile_eb11mp() || core_tile_a9mp()) {
346#ifdef CONFIG_LOCAL_TIMERS 338#ifdef CONFIG_LOCAL_TIMERS
347 twd_base_addr = __io_address(REALVIEW_EB11MP_TWD_BASE); 339 twd_base = __io_address(REALVIEW_EB11MP_TWD_BASE);
348 twd_size = REALVIEW_EB11MP_TWD_SIZE;
349#endif 340#endif
350 timer_irq = IRQ_EB11MP_TIMER0_1; 341 timer_irq = IRQ_EB11MP_TIMER0_1;
351 } else 342 } else
@@ -362,7 +353,7 @@ static void __init realview_eb_init(void)
362{ 353{
363 int i; 354 int i;
364 355
365 if (core_tile_eb11mp()) { 356 if (core_tile_eb11mp() || core_tile_a9mp()) {
366 realview_eb11mp_fixup(); 357 realview_eb11mp_fixup();
367 358
368#ifdef CONFIG_CACHE_L2X0 359#ifdef CONFIG_CACHE_L2X0
@@ -372,8 +363,6 @@ static void __init realview_eb_init(void)
372#endif 363#endif
373 } 364 }
374 365
375 clk_register(&realview_clcd_clk);
376
377 realview_flash_register(&realview_eb_flash_resource, 1); 366 realview_flash_register(&realview_eb_flash_resource, 1);
378 platform_device_register(&realview_i2c_device); 367 platform_device_register(&realview_i2c_device);
379 eth_device_register(); 368 eth_device_register();
@@ -392,7 +381,7 @@ MACHINE_START(REALVIEW_EB, "ARM-RealView EB")
392 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 381 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
393 .phys_io = REALVIEW_EB_UART0_BASE, 382 .phys_io = REALVIEW_EB_UART0_BASE,
394 .io_pg_offst = (IO_ADDRESS(REALVIEW_EB_UART0_BASE) >> 18) & 0xfffc, 383 .io_pg_offst = (IO_ADDRESS(REALVIEW_EB_UART0_BASE) >> 18) & 0xfffc,
395 .boot_params = 0x00000100, 384 .boot_params = PHYS_OFFSET + 0x00000100,
396 .map_io = realview_eb_map_io, 385 .map_io = realview_eb_map_io,
397 .init_irq = gic_init_irq, 386 .init_irq = gic_init_irq,
398 .timer = &realview_eb_timer, 387 .timer = &realview_eb_timer,
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index cccdb3eb90fe..8f0683c22140 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -222,13 +222,6 @@ static struct resource realview_pb1176_smsc911x_resources[] = {
222 }, 222 },
223}; 223};
224 224
225static struct platform_device realview_pb1176_smsc911x_device = {
226 .name = "smc911x",
227 .id = 0,
228 .num_resources = ARRAY_SIZE(realview_pb1176_smsc911x_resources),
229 .resource = realview_pb1176_smsc911x_resources,
230};
231
232static void __init gic_init_irq(void) 225static void __init gic_init_irq(void)
233{ 226{
234 /* ARM1176 DevChip GIC, primary */ 227 /* ARM1176 DevChip GIC, primary */
@@ -265,10 +258,8 @@ static void __init realview_pb1176_init(void)
265 l2x0_init(__io_address(REALVIEW_PB1176_L220_BASE), 0x00730000, 0xfe000fff); 258 l2x0_init(__io_address(REALVIEW_PB1176_L220_BASE), 0x00730000, 0xfe000fff);
266#endif 259#endif
267 260
268 clk_register(&realview_clcd_clk);
269
270 realview_flash_register(&realview_pb1176_flash_resource, 1); 261 realview_flash_register(&realview_pb1176_flash_resource, 1);
271 platform_device_register(&realview_pb1176_smsc911x_device); 262 realview_eth_register(NULL, realview_pb1176_smsc911x_resources);
272 263
273 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 264 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
274 struct amba_device *d = amba_devs[i]; 265 struct amba_device *d = amba_devs[i];
@@ -284,7 +275,7 @@ MACHINE_START(REALVIEW_PB1176, "ARM-RealView PB1176")
284 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 275 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
285 .phys_io = REALVIEW_PB1176_UART0_BASE, 276 .phys_io = REALVIEW_PB1176_UART0_BASE,
286 .io_pg_offst = (IO_ADDRESS(REALVIEW_PB1176_UART0_BASE) >> 18) & 0xfffc, 277 .io_pg_offst = (IO_ADDRESS(REALVIEW_PB1176_UART0_BASE) >> 18) & 0xfffc,
287 .boot_params = 0x00000100, 278 .boot_params = PHYS_OFFSET + 0x00000100,
288 .map_io = realview_pb1176_map_io, 279 .map_io = realview_pb1176_map_io,
289 .init_irq = gic_init_irq, 280 .init_irq = gic_init_irq,
290 .timer = &realview_pb1176_timer, 281 .timer = &realview_pb1176_timer,
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index 8b863148ec18..3ebdb2dadd6f 100644
--- a/arch/arm/mach-realview/realview_pb11mp.c
+++ b/arch/arm/mach-realview/realview_pb11mp.c
@@ -230,13 +230,6 @@ static struct resource realview_pb11mp_smsc911x_resources[] = {
230 }, 230 },
231}; 231};
232 232
233static struct platform_device realview_pb11mp_smsc911x_device = {
234 .name = "smc911x",
235 .id = 0,
236 .num_resources = ARRAY_SIZE(realview_pb11mp_smsc911x_resources),
237 .resource = realview_pb11mp_smsc911x_resources,
238};
239
240struct resource realview_pb11mp_cf_resources[] = { 233struct resource realview_pb11mp_cf_resources[] = {
241 [0] = { 234 [0] = {
242 .start = REALVIEW_PB11MP_CF_BASE, 235 .start = REALVIEW_PB11MP_CF_BASE,
@@ -292,8 +285,7 @@ static void __init realview_pb11mp_timer_init(void)
292 timer3_va_base = __io_address(REALVIEW_PB11MP_TIMER2_3_BASE) + 0x20; 285 timer3_va_base = __io_address(REALVIEW_PB11MP_TIMER2_3_BASE) + 0x20;
293 286
294#ifdef CONFIG_LOCAL_TIMERS 287#ifdef CONFIG_LOCAL_TIMERS
295 twd_base_addr = __io_address(REALVIEW_TC11MP_TWD_BASE); 288 twd_base = __io_address(REALVIEW_TC11MP_TWD_BASE);
296 twd_size = REALVIEW_TC11MP_TWD_SIZE;
297#endif 289#endif
298 realview_timer_init(IRQ_TC11MP_TIMER0_1); 290 realview_timer_init(IRQ_TC11MP_TIMER0_1);
299} 291}
@@ -312,11 +304,9 @@ static void __init realview_pb11mp_init(void)
312 l2x0_init(__io_address(REALVIEW_TC11MP_L220_BASE), 0x00790000, 0xfe000fff); 304 l2x0_init(__io_address(REALVIEW_TC11MP_L220_BASE), 0x00790000, 0xfe000fff);
313#endif 305#endif
314 306
315 clk_register(&realview_clcd_clk);
316
317 realview_flash_register(realview_pb11mp_flash_resource, 307 realview_flash_register(realview_pb11mp_flash_resource,
318 ARRAY_SIZE(realview_pb11mp_flash_resource)); 308 ARRAY_SIZE(realview_pb11mp_flash_resource));
319 platform_device_register(&realview_pb11mp_smsc911x_device); 309 realview_eth_register(NULL, realview_pb11mp_smsc911x_resources);
320 platform_device_register(&realview_i2c_device); 310 platform_device_register(&realview_i2c_device);
321 platform_device_register(&realview_pb11mp_cf_device); 311 platform_device_register(&realview_pb11mp_cf_device);
322 312
@@ -334,7 +324,7 @@ MACHINE_START(REALVIEW_PB11MP, "ARM-RealView PB11MPCore")
334 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 324 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
335 .phys_io = REALVIEW_PB11MP_UART0_BASE, 325 .phys_io = REALVIEW_PB11MP_UART0_BASE,
336 .io_pg_offst = (IO_ADDRESS(REALVIEW_PB11MP_UART0_BASE) >> 18) & 0xfffc, 326 .io_pg_offst = (IO_ADDRESS(REALVIEW_PB11MP_UART0_BASE) >> 18) & 0xfffc,
337 .boot_params = 0x00000100, 327 .boot_params = PHYS_OFFSET + 0x00000100,
338 .map_io = realview_pb11mp_map_io, 328 .map_io = realview_pb11mp_map_io,
339 .init_irq = gic_init_irq, 329 .init_irq = gic_init_irq,
340 .timer = &realview_pb11mp_timer, 330 .timer = &realview_pb11mp_timer,
diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c
new file mode 100644
index 000000000000..34c94435d2d8
--- /dev/null
+++ b/arch/arm/mach-realview/realview_pba8.c
@@ -0,0 +1,300 @@
1/*
2 * linux/arch/arm/mach-realview/realview_pba8.c
3 *
4 * Copyright (C) 2008 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
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/init.h>
23#include <linux/platform_device.h>
24#include <linux/sysdev.h>
25#include <linux/amba/bus.h>
26#include <linux/io.h>
27
28#include <asm/irq.h>
29#include <asm/leds.h>
30#include <asm/mach-types.h>
31#include <asm/hardware/gic.h>
32#include <asm/hardware/icst307.h>
33
34#include <asm/mach/arch.h>
35#include <asm/mach/map.h>
36#include <asm/mach/mmc.h>
37#include <asm/mach/time.h>
38
39#include <mach/hardware.h>
40#include <mach/board-pba8.h>
41#include <mach/irqs.h>
42
43#include "core.h"
44#include "clock.h"
45
46static struct map_desc realview_pba8_io_desc[] __initdata = {
47 {
48 .virtual = IO_ADDRESS(REALVIEW_SYS_BASE),
49 .pfn = __phys_to_pfn(REALVIEW_SYS_BASE),
50 .length = SZ_4K,
51 .type = MT_DEVICE,
52 }, {
53 .virtual = IO_ADDRESS(REALVIEW_PBA8_GIC_CPU_BASE),
54 .pfn = __phys_to_pfn(REALVIEW_PBA8_GIC_CPU_BASE),
55 .length = SZ_4K,
56 .type = MT_DEVICE,
57 }, {
58 .virtual = IO_ADDRESS(REALVIEW_PBA8_GIC_DIST_BASE),
59 .pfn = __phys_to_pfn(REALVIEW_PBA8_GIC_DIST_BASE),
60 .length = SZ_4K,
61 .type = MT_DEVICE,
62 }, {
63 .virtual = IO_ADDRESS(REALVIEW_SCTL_BASE),
64 .pfn = __phys_to_pfn(REALVIEW_SCTL_BASE),
65 .length = SZ_4K,
66 .type = MT_DEVICE,
67 }, {
68 .virtual = IO_ADDRESS(REALVIEW_PBA8_TIMER0_1_BASE),
69 .pfn = __phys_to_pfn(REALVIEW_PBA8_TIMER0_1_BASE),
70 .length = SZ_4K,
71 .type = MT_DEVICE,
72 }, {
73 .virtual = IO_ADDRESS(REALVIEW_PBA8_TIMER2_3_BASE),
74 .pfn = __phys_to_pfn(REALVIEW_PBA8_TIMER2_3_BASE),
75 .length = SZ_4K,
76 .type = MT_DEVICE,
77 },
78#ifdef CONFIG_PCI
79 {
80 .virtual = PCIX_UNIT_BASE,
81 .pfn = __phys_to_pfn(REALVIEW_PBA8_PCI_BASE),
82 .length = REALVIEW_PBA8_PCI_BASE_SIZE,
83 .type = MT_DEVICE
84 },
85#endif
86#ifdef CONFIG_DEBUG_LL
87 {
88 .virtual = IO_ADDRESS(REALVIEW_PBA8_UART0_BASE),
89 .pfn = __phys_to_pfn(REALVIEW_PBA8_UART0_BASE),
90 .length = SZ_4K,
91 .type = MT_DEVICE,
92 },
93#endif
94};
95
96static void __init realview_pba8_map_io(void)
97{
98 iotable_init(realview_pba8_io_desc, ARRAY_SIZE(realview_pba8_io_desc));
99}
100
101/*
102 * RealView PBA8Core AMBA devices
103 */
104
105#define GPIO2_IRQ { IRQ_PBA8_GPIO2, NO_IRQ }
106#define GPIO2_DMA { 0, 0 }
107#define GPIO3_IRQ { IRQ_PBA8_GPIO3, NO_IRQ }
108#define GPIO3_DMA { 0, 0 }
109#define AACI_IRQ { IRQ_PBA8_AACI, NO_IRQ }
110#define AACI_DMA { 0x80, 0x81 }
111#define MMCI0_IRQ { IRQ_PBA8_MMCI0A, IRQ_PBA8_MMCI0B }
112#define MMCI0_DMA { 0x84, 0 }
113#define KMI0_IRQ { IRQ_PBA8_KMI0, NO_IRQ }
114#define KMI0_DMA { 0, 0 }
115#define KMI1_IRQ { IRQ_PBA8_KMI1, NO_IRQ }
116#define KMI1_DMA { 0, 0 }
117#define PBA8_SMC_IRQ { NO_IRQ, NO_IRQ }
118#define PBA8_SMC_DMA { 0, 0 }
119#define MPMC_IRQ { NO_IRQ, NO_IRQ }
120#define MPMC_DMA { 0, 0 }
121#define PBA8_CLCD_IRQ { IRQ_PBA8_CLCD, NO_IRQ }
122#define PBA8_CLCD_DMA { 0, 0 }
123#define DMAC_IRQ { IRQ_PBA8_DMAC, NO_IRQ }
124#define DMAC_DMA { 0, 0 }
125#define SCTL_IRQ { NO_IRQ, NO_IRQ }
126#define SCTL_DMA { 0, 0 }
127#define PBA8_WATCHDOG_IRQ { IRQ_PBA8_WATCHDOG, NO_IRQ }
128#define PBA8_WATCHDOG_DMA { 0, 0 }
129#define PBA8_GPIO0_IRQ { IRQ_PBA8_GPIO0, NO_IRQ }
130#define PBA8_GPIO0_DMA { 0, 0 }
131#define GPIO1_IRQ { IRQ_PBA8_GPIO1, NO_IRQ }
132#define GPIO1_DMA { 0, 0 }
133#define PBA8_RTC_IRQ { IRQ_PBA8_RTC, NO_IRQ }
134#define PBA8_RTC_DMA { 0, 0 }
135#define SCI_IRQ { IRQ_PBA8_SCI, NO_IRQ }
136#define SCI_DMA { 7, 6 }
137#define PBA8_UART0_IRQ { IRQ_PBA8_UART0, NO_IRQ }
138#define PBA8_UART0_DMA { 15, 14 }
139#define PBA8_UART1_IRQ { IRQ_PBA8_UART1, NO_IRQ }
140#define PBA8_UART1_DMA { 13, 12 }
141#define PBA8_UART2_IRQ { IRQ_PBA8_UART2, NO_IRQ }
142#define PBA8_UART2_DMA { 11, 10 }
143#define PBA8_UART3_IRQ { IRQ_PBA8_UART3, NO_IRQ }
144#define PBA8_UART3_DMA { 0x86, 0x87 }
145#define PBA8_SSP_IRQ { IRQ_PBA8_SSP, NO_IRQ }
146#define PBA8_SSP_DMA { 9, 8 }
147
148/* FPGA Primecells */
149AMBA_DEVICE(aaci, "fpga:04", AACI, NULL);
150AMBA_DEVICE(mmc0, "fpga:05", MMCI0, &realview_mmc0_plat_data);
151AMBA_DEVICE(kmi0, "fpga:06", KMI0, NULL);
152AMBA_DEVICE(kmi1, "fpga:07", KMI1, NULL);
153AMBA_DEVICE(uart3, "fpga:09", PBA8_UART3, NULL);
154
155/* DevChip Primecells */
156AMBA_DEVICE(smc, "dev:00", PBA8_SMC, NULL);
157AMBA_DEVICE(sctl, "dev:e0", SCTL, NULL);
158AMBA_DEVICE(wdog, "dev:e1", PBA8_WATCHDOG, NULL);
159AMBA_DEVICE(gpio0, "dev:e4", PBA8_GPIO0, NULL);
160AMBA_DEVICE(gpio1, "dev:e5", GPIO1, NULL);
161AMBA_DEVICE(gpio2, "dev:e6", GPIO2, NULL);
162AMBA_DEVICE(rtc, "dev:e8", PBA8_RTC, NULL);
163AMBA_DEVICE(sci0, "dev:f0", SCI, NULL);
164AMBA_DEVICE(uart0, "dev:f1", PBA8_UART0, NULL);
165AMBA_DEVICE(uart1, "dev:f2", PBA8_UART1, NULL);
166AMBA_DEVICE(uart2, "dev:f3", PBA8_UART2, NULL);
167AMBA_DEVICE(ssp0, "dev:f4", PBA8_SSP, NULL);
168
169/* Primecells on the NEC ISSP chip */
170AMBA_DEVICE(clcd, "issp:20", PBA8_CLCD, &clcd_plat_data);
171AMBA_DEVICE(dmac, "issp:30", DMAC, NULL);
172
173static struct amba_device *amba_devs[] __initdata = {
174 &dmac_device,
175 &uart0_device,
176 &uart1_device,
177 &uart2_device,
178 &uart3_device,
179 &smc_device,
180 &clcd_device,
181 &sctl_device,
182 &wdog_device,
183 &gpio0_device,
184 &gpio1_device,
185 &gpio2_device,
186 &rtc_device,
187 &sci0_device,
188 &ssp0_device,
189 &aaci_device,
190 &mmc0_device,
191 &kmi0_device,
192 &kmi1_device,
193};
194
195/*
196 * RealView PB-A8 platform devices
197 */
198static struct resource realview_pba8_flash_resource[] = {
199 [0] = {
200 .start = REALVIEW_PBA8_FLASH0_BASE,
201 .end = REALVIEW_PBA8_FLASH0_BASE + REALVIEW_PBA8_FLASH0_SIZE - 1,
202 .flags = IORESOURCE_MEM,
203 },
204 [1] = {
205 .start = REALVIEW_PBA8_FLASH1_BASE,
206 .end = REALVIEW_PBA8_FLASH1_BASE + REALVIEW_PBA8_FLASH1_SIZE - 1,
207 .flags = IORESOURCE_MEM,
208 },
209};
210
211static struct resource realview_pba8_smsc911x_resources[] = {
212 [0] = {
213 .start = REALVIEW_PBA8_ETH_BASE,
214 .end = REALVIEW_PBA8_ETH_BASE + SZ_64K - 1,
215 .flags = IORESOURCE_MEM,
216 },
217 [1] = {
218 .start = IRQ_PBA8_ETH,
219 .end = IRQ_PBA8_ETH,
220 .flags = IORESOURCE_IRQ,
221 },
222};
223
224struct resource realview_pba8_cf_resources[] = {
225 [0] = {
226 .start = REALVIEW_PBA8_CF_BASE,
227 .end = REALVIEW_PBA8_CF_BASE + SZ_4K - 1,
228 .flags = IORESOURCE_MEM,
229 },
230 [1] = {
231 .start = REALVIEW_PBA8_CF_MEM_BASE,
232 .end = REALVIEW_PBA8_CF_MEM_BASE + SZ_4K - 1,
233 .flags = IORESOURCE_MEM,
234 },
235 [2] = {
236 .start = -1, /* FIXME: Find correct irq */
237 .end = -1,
238 .flags = IORESOURCE_IRQ,
239 },
240};
241
242struct platform_device realview_pba8_cf_device = {
243 .name = "compactflash",
244 .id = 0,
245 .num_resources = ARRAY_SIZE(realview_pba8_cf_resources),
246 .resource = realview_pba8_cf_resources,
247};
248
249static void __init gic_init_irq(void)
250{
251 /* ARM PB-A8 on-board GIC */
252 gic_cpu_base_addr = __io_address(REALVIEW_PBA8_GIC_CPU_BASE);
253 gic_dist_init(0, __io_address(REALVIEW_PBA8_GIC_DIST_BASE), IRQ_PBA8_GIC_START);
254 gic_cpu_init(0, __io_address(REALVIEW_PBA8_GIC_CPU_BASE));
255}
256
257static void __init realview_pba8_timer_init(void)
258{
259 timer0_va_base = __io_address(REALVIEW_PBA8_TIMER0_1_BASE);
260 timer1_va_base = __io_address(REALVIEW_PBA8_TIMER0_1_BASE) + 0x20;
261 timer2_va_base = __io_address(REALVIEW_PBA8_TIMER2_3_BASE);
262 timer3_va_base = __io_address(REALVIEW_PBA8_TIMER2_3_BASE) + 0x20;
263
264 realview_timer_init(IRQ_PBA8_TIMER0_1);
265}
266
267static struct sys_timer realview_pba8_timer = {
268 .init = realview_pba8_timer_init,
269};
270
271static void __init realview_pba8_init(void)
272{
273 int i;
274
275 realview_flash_register(realview_pba8_flash_resource,
276 ARRAY_SIZE(realview_pba8_flash_resource));
277 realview_eth_register(NULL, realview_pba8_smsc911x_resources);
278 platform_device_register(&realview_i2c_device);
279 platform_device_register(&realview_pba8_cf_device);
280
281 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
282 struct amba_device *d = amba_devs[i];
283 amba_device_register(d, &iomem_resource);
284 }
285
286#ifdef CONFIG_LEDS
287 leds_event = realview_leds_event;
288#endif
289}
290
291MACHINE_START(REALVIEW_PBA8, "ARM-RealView PB-A8")
292 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
293 .phys_io = REALVIEW_PBA8_UART0_BASE,
294 .io_pg_offst = (IO_ADDRESS(REALVIEW_PBA8_UART0_BASE) >> 18) & 0xfffc,
295 .boot_params = PHYS_OFFSET + 0x00000100,
296 .map_io = realview_pba8_map_io,
297 .init_irq = gic_init_irq,
298 .timer = &realview_pba8_timer,
299 .init_machine = realview_pba8_init,
300MACHINE_END
diff --git a/arch/arm/mach-rpc/include/mach/io.h b/arch/arm/mach-rpc/include/mach/io.h
index 9f0553b7ec28..20da7f486e51 100644
--- a/arch/arm/mach-rpc/include/mach/io.h
+++ b/arch/arm/mach-rpc/include/mach/io.h
@@ -18,49 +18,6 @@
18#define IO_SPACE_LIMIT 0xffffffff 18#define IO_SPACE_LIMIT 0xffffffff
19 19
20/* 20/*
21 * GCC is totally crap at loading/storing data. We try to persuade it
22 * to do the right thing by using these whereever possible instead of
23 * the above.
24 */
25#define __arch_base_getb(b,o) \
26 ({ \
27 unsigned int __v, __r = (b); \
28 __asm__ __volatile__( \
29 "ldrb %0, [%1, %2]" \
30 : "=r" (__v) \
31 : "r" (__r), "Ir" (o)); \
32 __v; \
33 })
34
35#define __arch_base_getl(b,o) \
36 ({ \
37 unsigned int __v, __r = (b); \
38 __asm__ __volatile__( \
39 "ldr %0, [%1, %2]" \
40 : "=r" (__v) \
41 : "r" (__r), "Ir" (o)); \
42 __v; \
43 })
44
45#define __arch_base_putb(v,b,o) \
46 ({ \
47 unsigned int __r = (b); \
48 __asm__ __volatile__( \
49 "strb %0, [%1, %2]" \
50 : \
51 : "r" (v), "r" (__r), "Ir" (o));\
52 })
53
54#define __arch_base_putl(v,b,o) \
55 ({ \
56 unsigned int __r = (b); \
57 __asm__ __volatile__( \
58 "str %0, [%1, %2]" \
59 : \
60 : "r" (v), "r" (__r), "Ir" (o));\
61 })
62
63/*
64 * We use two different types of addressing - PC style addresses, and ARM 21 * We use two different types of addressing - PC style addresses, and ARM
65 * addresses. PC style accesses the PC hardware with the normal PC IO 22 * addresses. PC style accesses the PC hardware with the normal PC IO
66 * addresses, eg 0x3f8 for serial#1. ARM addresses are 0x80000000+ 23 * addresses, eg 0x3f8 for serial#1. ARM addresses are 0x80000000+
@@ -232,15 +189,13 @@ DECLARE_IO(int,l,"")
232 result; \ 189 result; \
233}) 190})
234 191
235#define __ioaddrc(port) __ioaddr(port)
236
237#define inb(p) (__builtin_constant_p((p)) ? __inbc(p) : __inb(p)) 192#define inb(p) (__builtin_constant_p((p)) ? __inbc(p) : __inb(p))
238#define inw(p) (__builtin_constant_p((p)) ? __inwc(p) : __inw(p)) 193#define inw(p) (__builtin_constant_p((p)) ? __inwc(p) : __inw(p))
239#define inl(p) (__builtin_constant_p((p)) ? __inlc(p) : __inl(p)) 194#define inl(p) (__builtin_constant_p((p)) ? __inlc(p) : __inl(p))
240#define outb(v,p) (__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p)) 195#define outb(v,p) (__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p))
241#define outw(v,p) (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p)) 196#define outw(v,p) (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p))
242#define outl(v,p) (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p)) 197#define outl(v,p) (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p))
243#define __ioaddr(p) (__builtin_constant_p((p)) ? __ioaddr(p) : __ioaddrc(p)) 198
244/* the following macro is deprecated */ 199/* the following macro is deprecated */
245#define ioaddr(port) ((unsigned long)__ioaddr((port))) 200#define ioaddr(port) ((unsigned long)__ioaddr((port)))
246 201
diff --git a/arch/arm/mach-rpc/include/mach/irqs.h b/arch/arm/mach-rpc/include/mach/irqs.h
index 4ce6ca97f669..3d2037496e38 100644
--- a/arch/arm/mach-rpc/include/mach/irqs.h
+++ b/arch/arm/mach-rpc/include/mach/irqs.h
@@ -44,3 +44,4 @@
44 44
45#define IRQ_TIMER IRQ_TIMER0 45#define IRQ_TIMER IRQ_TIMER0
46 46
47#define NR_IRQS 128
diff --git a/arch/arm/mach-rpc/include/mach/dma.h b/arch/arm/mach-rpc/include/mach/isa-dma.h
index 360b56f8f29f..bad720548587 100644
--- a/arch/arm/mach-rpc/include/mach/dma.h
+++ b/arch/arm/mach-rpc/include/mach/isa-dma.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/arm/mach-rpc/include/mach/dma.h 2 * arch/arm/mach-rpc/include/mach/isa-dma.h
3 * 3 *
4 * Copyright (C) 1997 Russell King 4 * Copyright (C) 1997 Russell King
5 * 5 *
@@ -10,12 +10,6 @@
10#ifndef __ASM_ARCH_DMA_H 10#ifndef __ASM_ARCH_DMA_H
11#define __ASM_ARCH_DMA_H 11#define __ASM_ARCH_DMA_H
12 12
13/*
14 * This is the maximum DMA address that can be DMAd to.
15 * There should not be more than (0xd0000000 - 0xc0000000)
16 * bytes of RAM.
17 */
18#define MAX_DMA_ADDRESS 0xd0000000
19#define MAX_DMA_CHANNELS 8 13#define MAX_DMA_CHANNELS 8
20 14
21#define DMA_0 0 15#define DMA_0 0
diff --git a/arch/arm/mach-rpc/include/mach/memory.h b/arch/arm/mach-rpc/include/mach/memory.h
index 9bf7e43e2863..78191bf25192 100644
--- a/arch/arm/mach-rpc/include/mach/memory.h
+++ b/arch/arm/mach-rpc/include/mach/memory.h
@@ -24,13 +24,6 @@
24#define PHYS_OFFSET UL(0x10000000) 24#define PHYS_OFFSET UL(0x10000000)
25 25
26/* 26/*
27 * These are exactly the same on the RiscPC as the
28 * physical memory view.
29 */
30#define __virt_to_bus(x) __virt_to_phys(x)
31#define __bus_to_virt(x) __phys_to_virt(x)
32
33/*
34 * Cache flushing area - ROM 27 * Cache flushing area - ROM
35 */ 28 */
36#define FLUSH_BASE_PHYS 0x00000000 29#define FLUSH_BASE_PHYS 0x00000000
diff --git a/arch/arm/mach-s3c2400/include/mach/memory.h b/arch/arm/mach-s3c2400/include/mach/memory.h
index 8f4878e4f591..cf5901ffd385 100644
--- a/arch/arm/mach-s3c2400/include/mach/memory.h
+++ b/arch/arm/mach-s3c2400/include/mach/memory.h
@@ -17,7 +17,4 @@
17 17
18#define PHYS_OFFSET UL(0x0C000000) 18#define PHYS_OFFSET UL(0x0C000000)
19 19
20#define __virt_to_bus(x) __virt_to_phys(x)
21#define __bus_to_virt(x) __phys_to_virt(x)
22
23#endif 20#endif
diff --git a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig
index 99fdc736698c..63a30d1dd425 100644
--- a/arch/arm/mach-s3c2410/Kconfig
+++ b/arch/arm/mach-s3c2410/Kconfig
@@ -7,6 +7,7 @@
7config CPU_S3C2410 7config CPU_S3C2410
8 bool 8 bool
9 depends on ARCH_S3C2410 9 depends on ARCH_S3C2410
10 select CPU_ARM920T
10 select S3C2410_CLOCK 11 select S3C2410_CLOCK
11 select S3C2410_GPIO 12 select S3C2410_GPIO
12 select CPU_LLSERIAL_S3C2410 13 select CPU_LLSERIAL_S3C2410
@@ -32,11 +33,6 @@ config S3C2410_GPIO
32 help 33 help
33 GPIO code for S3C2410 and similar processors 34 GPIO code for S3C2410 and similar processors
34 35
35config S3C2410_CLOCK
36 bool
37 help
38 Clock code for the S3C2410, and similar processors
39
40config SIMTEC_NOR 36config SIMTEC_NOR
41 bool 37 bool
42 help 38 help
@@ -84,6 +80,7 @@ config ARCH_BAST
84 select PM_SIMTEC if PM 80 select PM_SIMTEC if PM
85 select SIMTEC_NOR 81 select SIMTEC_NOR
86 select MACH_BAST_IDE 82 select MACH_BAST_IDE
83 select S3C24XX_DCLK
87 select ISA 84 select ISA
88 help 85 help
89 Say Y here if you are using the Simtec Electronics EB2410ITX 86 Say Y here if you are using the Simtec Electronics EB2410ITX
@@ -121,6 +118,7 @@ config MACH_TCT_HAMMER
121config MACH_VR1000 118config MACH_VR1000
122 bool "Thorcom VR1000" 119 bool "Thorcom VR1000"
123 select PM_SIMTEC if PM 120 select PM_SIMTEC if PM
121 select S3C24XX_DCLK
124 select SIMTEC_NOR 122 select SIMTEC_NOR
125 select MACH_BAST_IDE 123 select MACH_BAST_IDE
126 select CPU_S3C2410 124 select CPU_S3C2410
diff --git a/arch/arm/mach-s3c2410/Makefile b/arch/arm/mach-s3c2410/Makefile
index 00f31f8c4e78..fca02f82711c 100644
--- a/arch/arm/mach-s3c2410/Makefile
+++ b/arch/arm/mach-s3c2410/Makefile
@@ -15,7 +15,6 @@ obj-$(CONFIG_CPU_S3C2410_DMA) += dma.o
15obj-$(CONFIG_CPU_S3C2410_DMA) += dma.o 15obj-$(CONFIG_CPU_S3C2410_DMA) += dma.o
16obj-$(CONFIG_S3C2410_PM) += pm.o sleep.o 16obj-$(CONFIG_S3C2410_PM) += pm.o sleep.o
17obj-$(CONFIG_S3C2410_GPIO) += gpio.o 17obj-$(CONFIG_S3C2410_GPIO) += gpio.o
18obj-$(CONFIG_S3C2410_CLOCK) += clock.o
19 18
20# Machine support 19# Machine support
21 20
diff --git a/arch/arm/mach-s3c2410/dma.c b/arch/arm/mach-s3c2410/dma.c
index 7d914a470b6c..552b4c778fdc 100644
--- a/arch/arm/mach-s3c2410/dma.c
+++ b/arch/arm/mach-s3c2410/dma.c
@@ -17,7 +17,6 @@
17#include <linux/sysdev.h> 17#include <linux/sysdev.h>
18#include <linux/serial_core.h> 18#include <linux/serial_core.h>
19 19
20#include <asm/dma.h>
21#include <mach/dma.h> 20#include <mach/dma.h>
22 21
23#include <plat/cpu.h> 22#include <plat/cpu.h>
@@ -25,12 +24,12 @@
25 24
26#include <plat/regs-serial.h> 25#include <plat/regs-serial.h>
27#include <mach/regs-gpio.h> 26#include <mach/regs-gpio.h>
28#include <asm/plat-s3c/regs-ac97.h> 27#include <plat/regs-ac97.h>
29#include <mach/regs-mem.h> 28#include <mach/regs-mem.h>
30#include <mach/regs-lcd.h> 29#include <mach/regs-lcd.h>
31#include <mach/regs-sdi.h> 30#include <mach/regs-sdi.h>
32#include <asm/plat-s3c24xx/regs-iis.h> 31#include <asm/plat-s3c24xx/regs-iis.h>
33#include <asm/plat-s3c24xx/regs-spi.h> 32#include <plat/regs-spi.h>
34 33
35static struct s3c24xx_dma_map __initdata s3c2410_dma_mappings[] = { 34static struct s3c24xx_dma_map __initdata s3c2410_dma_mappings[] = {
36 [DMACH_XD0] = { 35 [DMACH_XD0] = {
diff --git a/arch/arm/mach-s3c2410/include/mach/dma.h b/arch/arm/mach-s3c2410/include/mach/dma.h
index 891b53cd69b8..13358ce2128c 100644
--- a/arch/arm/mach-s3c2410/include/mach/dma.h
+++ b/arch/arm/mach-s3c2410/include/mach/dma.h
@@ -16,11 +16,6 @@
16#include <linux/sysdev.h> 16#include <linux/sysdev.h>
17#include <mach/hardware.h> 17#include <mach/hardware.h>
18 18
19/*
20 * This is the maximum DMA address(physical address) that can be DMAd to.
21 *
22 */
23#define MAX_DMA_ADDRESS 0x40000000
24#define MAX_DMA_TRANSFER_SIZE 0x100000 /* Data Unit is half word */ 19#define MAX_DMA_TRANSFER_SIZE 0x100000 /* Data Unit is half word */
25 20
26/* We use `virtual` dma channels to hide the fact we have only a limited 21/* We use `virtual` dma channels to hide the fact we have only a limited
@@ -254,7 +249,7 @@ typedef unsigned long dma_device_t;
254 * request a dma channel exclusivley 249 * request a dma channel exclusivley
255*/ 250*/
256 251
257extern int s3c2410_dma_request(dmach_t channel, 252extern int s3c2410_dma_request(unsigned int channel,
258 struct s3c2410_dma_client *, void *dev); 253 struct s3c2410_dma_client *, void *dev);
259 254
260 255
@@ -263,14 +258,14 @@ extern int s3c2410_dma_request(dmach_t channel,
263 * change the state of the dma channel 258 * change the state of the dma channel
264*/ 259*/
265 260
266extern int s3c2410_dma_ctrl(dmach_t channel, enum s3c2410_chan_op op); 261extern int s3c2410_dma_ctrl(unsigned int channel, enum s3c2410_chan_op op);
267 262
268/* s3c2410_dma_setflags 263/* s3c2410_dma_setflags
269 * 264 *
270 * set the channel's flags to a given state 265 * set the channel's flags to a given state
271*/ 266*/
272 267
273extern int s3c2410_dma_setflags(dmach_t channel, 268extern int s3c2410_dma_setflags(unsigned int channel,
274 unsigned int flags); 269 unsigned int flags);
275 270
276/* s3c2410_dma_free 271/* s3c2410_dma_free
@@ -278,7 +273,7 @@ extern int s3c2410_dma_setflags(dmach_t channel,
278 * free the dma channel (will also abort any outstanding operations) 273 * free the dma channel (will also abort any outstanding operations)
279*/ 274*/
280 275
281extern int s3c2410_dma_free(dmach_t channel, struct s3c2410_dma_client *); 276extern int s3c2410_dma_free(unsigned int channel, struct s3c2410_dma_client *);
282 277
283/* s3c2410_dma_enqueue 278/* s3c2410_dma_enqueue
284 * 279 *
@@ -287,7 +282,7 @@ extern int s3c2410_dma_free(dmach_t channel, struct s3c2410_dma_client *);
287 * drained before the buffer is given to the DMA system. 282 * drained before the buffer is given to the DMA system.
288*/ 283*/
289 284
290extern int s3c2410_dma_enqueue(dmach_t channel, void *id, 285extern int s3c2410_dma_enqueue(unsigned int channel, void *id,
291 dma_addr_t data, int size); 286 dma_addr_t data, int size);
292 287
293/* s3c2410_dma_config 288/* s3c2410_dma_config
@@ -295,7 +290,7 @@ extern int s3c2410_dma_enqueue(dmach_t channel, void *id,
295 * configure the dma channel 290 * configure the dma channel
296*/ 291*/
297 292
298extern int s3c2410_dma_config(dmach_t channel, int xferunit, int dcon); 293extern int s3c2410_dma_config(unsigned int channel, int xferunit, int dcon);
299 294
300/* s3c2410_dma_devconfig 295/* s3c2410_dma_devconfig
301 * 296 *
@@ -310,11 +305,11 @@ extern int s3c2410_dma_devconfig(int channel, enum s3c2410_dmasrc source,
310 * get the position that the dma transfer is currently at 305 * get the position that the dma transfer is currently at
311*/ 306*/
312 307
313extern int s3c2410_dma_getposition(dmach_t channel, 308extern int s3c2410_dma_getposition(unsigned int channel,
314 dma_addr_t *src, dma_addr_t *dest); 309 dma_addr_t *src, dma_addr_t *dest);
315 310
316extern int s3c2410_dma_set_opfn(dmach_t, s3c2410_dma_opfn_t rtn); 311extern int s3c2410_dma_set_opfn(unsigned int, s3c2410_dma_opfn_t rtn);
317extern int s3c2410_dma_set_buffdone_fn(dmach_t, s3c2410_dma_cbfn_t rtn); 312extern int s3c2410_dma_set_buffdone_fn(unsigned int, s3c2410_dma_cbfn_t rtn);
318 313
319/* DMA Register definitions */ 314/* DMA Register definitions */
320 315
diff --git a/arch/arm/mach-s3c2410/include/mach/gpio-core.h b/arch/arm/mach-s3c2410/include/mach/gpio-core.h
new file mode 100644
index 000000000000..6c9fbb99ef14
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/gpio-core.h
@@ -0,0 +1,34 @@
1/* arch/arm/mach-s3c24100/include/mach/gpio-core.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C2410 - GPIO core support
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#ifndef __ASM_ARCH_GPIO_CORE_H
16#define __ASM_ARCH_GPIO_CORE_H __FILE__
17
18#include <plat/gpio-core.h>
19#include <mach/regs-gpio.h>
20
21extern struct s3c_gpio_chip s3c24xx_gpios[];
22
23static inline struct s3c_gpio_chip *s3c_gpiolib_getchip(unsigned int pin)
24{
25 struct s3c_gpio_chip *chip;
26
27 if (pin > S3C2410_GPG10)
28 return NULL;
29
30 chip = &s3c24xx_gpios[pin/32];
31 return (S3C2410_GPIO_OFFSET(pin) > chip->chip.ngpio) ? chip : NULL;
32}
33
34#endif /* __ASM_ARCH_GPIO_CORE_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/gpio.h b/arch/arm/mach-s3c2410/include/mach/gpio.h
index 3b52b86498a6..e0349af8a483 100644
--- a/arch/arm/mach-s3c2410/include/mach/gpio.h
+++ b/arch/arm/mach-s3c2410/include/mach/gpio.h
@@ -15,4 +15,10 @@
15#define gpio_set_value __gpio_set_value 15#define gpio_set_value __gpio_set_value
16#define gpio_cansleep __gpio_cansleep 16#define gpio_cansleep __gpio_cansleep
17 17
18/* some boards require extra gpio capacity to support external
19 * devices that need GPIO.
20 */
21
22#define ARCH_NR_GPIOS (256 + CONFIG_S3C24XX_GPIO_EXTRA)
23
18#include <asm-generic/gpio.h> 24#include <asm-generic/gpio.h>
diff --git a/arch/arm/mach-s3c2410/include/mach/irqs.h b/arch/arm/mach-s3c2410/include/mach/irqs.h
index 950c71bf1489..9565903d490b 100644
--- a/arch/arm/mach-s3c2410/include/mach/irqs.h
+++ b/arch/arm/mach-s3c2410/include/mach/irqs.h
@@ -134,6 +134,8 @@
134#define IRQ_S3C2443_HSMMC S3C2410_IRQ(20) /* IRQ_SDI */ 134#define IRQ_S3C2443_HSMMC S3C2410_IRQ(20) /* IRQ_SDI */
135#define IRQ_S3C2443_NAND S3C2410_IRQ(24) /* reserved */ 135#define IRQ_S3C2443_NAND S3C2410_IRQ(24) /* reserved */
136 136
137#define IRQ_HSMMC0 IRQ_S3C2443_HSMMC
138
137#define IRQ_S3C2443_LCD1 S3C2410_IRQSUB(14) 139#define IRQ_S3C2443_LCD1 S3C2410_IRQSUB(14)
138#define IRQ_S3C2443_LCD2 S3C2410_IRQSUB(15) 140#define IRQ_S3C2443_LCD2 S3C2410_IRQSUB(15)
139#define IRQ_S3C2443_LCD3 S3C2410_IRQSUB(16) 141#define IRQ_S3C2443_LCD3 S3C2410_IRQSUB(16)
@@ -160,6 +162,12 @@
160#define NR_IRQS (IRQ_S3C2440_AC97+1) 162#define NR_IRQS (IRQ_S3C2440_AC97+1)
161#endif 163#endif
162 164
165/* compatibility define. */
166#define IRQ_UART3 IRQ_S3C2443_UART3
167#define IRQ_S3CUART_RX3 IRQ_S3C2443_RX3
168#define IRQ_S3CUART_TX3 IRQ_S3C2443_TX3
169#define IRQ_S3CUART_ERR3 IRQ_S3C2443_ERR3
170
163/* Our FIQs are routable from IRQ_EINT0 to IRQ_ADCPARENT */ 171/* Our FIQs are routable from IRQ_EINT0 to IRQ_ADCPARENT */
164#define FIQ_START IRQ_EINT0 172#define FIQ_START IRQ_EINT0
165 173
diff --git a/arch/arm/mach-s3c2410/include/mach/map.h b/arch/arm/mach-s3c2410/include/mach/map.h
index 23c470c2e5b1..255fdfeaf957 100644
--- a/arch/arm/mach-s3c2410/include/mach/map.h
+++ b/arch/arm/mach-s3c2410/include/mach/map.h
@@ -13,34 +13,20 @@
13#ifndef __ASM_ARCH_MAP_H 13#ifndef __ASM_ARCH_MAP_H
14#define __ASM_ARCH_MAP_H 14#define __ASM_ARCH_MAP_H
15 15
16#include <plat/map-base.h>
16#include <plat/map.h> 17#include <plat/map.h>
17 18
18#define S3C2410_ADDR(x) S3C_ADDR(x) 19#define S3C2410_ADDR(x) S3C_ADDR(x)
19 20
20/* interrupt controller is the first thing we put in, to make
21 * the assembly code for the irq detection easier
22 */
23#define S3C24XX_VA_IRQ S3C_VA_IRQ
24#define S3C2410_PA_IRQ (0x4A000000)
25#define S3C24XX_SZ_IRQ SZ_1M
26
27/* memory controller registers */
28#define S3C24XX_VA_MEMCTRL S3C_VA_MEM
29#define S3C2410_PA_MEMCTRL (0x48000000)
30#define S3C24XX_SZ_MEMCTRL SZ_1M
31
32/* USB host controller */ 21/* USB host controller */
33#define S3C2410_PA_USBHOST (0x49000000) 22#define S3C2410_PA_USBHOST (0x49000000)
34#define S3C24XX_SZ_USBHOST SZ_1M
35 23
36/* DMA controller */ 24/* DMA controller */
37#define S3C2410_PA_DMA (0x4B000000) 25#define S3C2410_PA_DMA (0x4B000000)
38#define S3C24XX_SZ_DMA SZ_1M 26#define S3C24XX_SZ_DMA SZ_1M
39 27
40/* Clock and Power management */ 28/* Clock and Power management */
41#define S3C24XX_VA_CLKPWR S3C_VA_SYS
42#define S3C2410_PA_CLKPWR (0x4C000000) 29#define S3C2410_PA_CLKPWR (0x4C000000)
43#define S3C24XX_SZ_CLKPWR SZ_1M
44 30
45/* LCD controller */ 31/* LCD controller */
46#define S3C2410_PA_LCD (0x4D000000) 32#define S3C2410_PA_LCD (0x4D000000)
@@ -48,48 +34,12 @@
48 34
49/* NAND flash controller */ 35/* NAND flash controller */
50#define S3C2410_PA_NAND (0x4E000000) 36#define S3C2410_PA_NAND (0x4E000000)
51#define S3C24XX_SZ_NAND SZ_1M
52
53/* UARTs */
54#define S3C24XX_VA_UART S3C_VA_UART
55#define S3C2410_PA_UART (0x50000000)
56#define S3C24XX_SZ_UART SZ_1M
57
58/* Timers */
59#define S3C24XX_VA_TIMER S3C_VA_TIMER
60#define S3C2410_PA_TIMER (0x51000000)
61#define S3C24XX_SZ_TIMER SZ_1M
62
63/* USB Device port */
64#define S3C2410_PA_USBDEV (0x52000000)
65#define S3C24XX_SZ_USBDEV SZ_1M
66
67/* Watchdog */
68#define S3C24XX_VA_WATCHDOG S3C_VA_WATCHDOG
69#define S3C2410_PA_WATCHDOG (0x53000000)
70#define S3C24XX_SZ_WATCHDOG SZ_1M
71 37
72/* IIC hardware controller */ 38/* IIC hardware controller */
73#define S3C2410_PA_IIC (0x54000000) 39#define S3C2410_PA_IIC (0x54000000)
74#define S3C24XX_SZ_IIC SZ_1M
75 40
76/* IIS controller */ 41/* IIS controller */
77#define S3C2410_PA_IIS (0x55000000) 42#define S3C2410_PA_IIS (0x55000000)
78#define S3C24XX_SZ_IIS SZ_1M
79
80/* GPIO ports */
81
82/* the calculation for the VA of this must ensure that
83 * it is the same distance apart from the UART in the
84 * phsyical address space, as the initial mapping for the IO
85 * is done as a 1:1 maping. This puts it (currently) at
86 * 0xFA800000, which is not in the way of any current mapping
87 * by the base system.
88*/
89
90#define S3C2410_PA_GPIO (0x56000000)
91#define S3C24XX_VA_GPIO ((S3C2410_PA_GPIO - S3C24XX_PA_UART) + S3C24XX_VA_UART)
92#define S3C24XX_SZ_GPIO SZ_1M
93 43
94/* RTC */ 44/* RTC */
95#define S3C2410_PA_RTC (0x57000000) 45#define S3C2410_PA_RTC (0x57000000)
@@ -97,15 +47,12 @@
97 47
98/* ADC */ 48/* ADC */
99#define S3C2410_PA_ADC (0x58000000) 49#define S3C2410_PA_ADC (0x58000000)
100#define S3C24XX_SZ_ADC SZ_1M
101 50
102/* SPI */ 51/* SPI */
103#define S3C2410_PA_SPI (0x59000000) 52#define S3C2410_PA_SPI (0x59000000)
104#define S3C24XX_SZ_SPI SZ_1M
105 53
106/* SDI */ 54/* SDI */
107#define S3C2410_PA_SDI (0x5A000000) 55#define S3C2410_PA_SDI (0x5A000000)
108#define S3C24XX_SZ_SDI SZ_1M
109 56
110/* CAMIF */ 57/* CAMIF */
111#define S3C2440_PA_CAMIF (0x4F000000) 58#define S3C2440_PA_CAMIF (0x4F000000)
@@ -120,13 +67,6 @@
120#define S3C2443_PA_HSMMC (0x4A800000) 67#define S3C2443_PA_HSMMC (0x4A800000)
121#define S3C2443_SZ_HSMMC (256) 68#define S3C2443_SZ_HSMMC (256)
122 69
123/* ISA style IO, for each machine to sort out mappings for, if it
124 * implements it. We reserve two 16M regions for ISA.
125 */
126
127#define S3C24XX_VA_ISA_WORD S3C2410_ADDR(0x02000000)
128#define S3C24XX_VA_ISA_BYTE S3C2410_ADDR(0x03000000)
129
130/* physical addresses of all the chip-select areas */ 70/* physical addresses of all the chip-select areas */
131 71
132#define S3C2410_CS0 (0x00000000) 72#define S3C2410_CS0 (0x00000000)
@@ -152,27 +92,16 @@
152#define S3C24XX_PA_TIMER S3C2410_PA_TIMER 92#define S3C24XX_PA_TIMER S3C2410_PA_TIMER
153#define S3C24XX_PA_USBDEV S3C2410_PA_USBDEV 93#define S3C24XX_PA_USBDEV S3C2410_PA_USBDEV
154#define S3C24XX_PA_WATCHDOG S3C2410_PA_WATCHDOG 94#define S3C24XX_PA_WATCHDOG S3C2410_PA_WATCHDOG
155#define S3C24XX_PA_IIC S3C2410_PA_IIC
156#define S3C24XX_PA_IIS S3C2410_PA_IIS 95#define S3C24XX_PA_IIS S3C2410_PA_IIS
157#define S3C24XX_PA_GPIO S3C2410_PA_GPIO 96#define S3C24XX_PA_GPIO S3C2410_PA_GPIO
158#define S3C24XX_PA_RTC S3C2410_PA_RTC 97#define S3C24XX_PA_RTC S3C2410_PA_RTC
159#define S3C24XX_PA_ADC S3C2410_PA_ADC 98#define S3C24XX_PA_ADC S3C2410_PA_ADC
160#define S3C24XX_PA_SPI S3C2410_PA_SPI 99#define S3C24XX_PA_SPI S3C2410_PA_SPI
100#define S3C24XX_PA_SDI S3C2410_PA_SDI
101#define S3C24XX_PA_NAND S3C2410_PA_NAND
161 102
162/* deal with the registers that move under the 2412/2413 */ 103#define S3C_PA_IIC S3C2410_PA_IIC
163 104#define S3C_PA_UART S3C24XX_PA_UART
164#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413) 105#define S3C_PA_HSMMC0 S3C2443_PA_HSMMC
165#ifndef __ASSEMBLY__
166extern void __iomem *s3c24xx_va_gpio2;
167#endif
168#ifdef CONFIG_CPU_S3C2412_ONLY
169#define S3C24XX_VA_GPIO2 (S3C24XX_VA_GPIO + 0x10)
170#else
171#define S3C24XX_VA_GPIO2 s3c24xx_va_gpio2
172#endif
173#else
174#define s3c24xx_va_gpio2 S3C24XX_VA_GPIO
175#define S3C24XX_VA_GPIO2 S3C24XX_VA_GPIO
176#endif
177 106
178#endif /* __ASM_ARCH_MAP_H */ 107#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/memory.h b/arch/arm/mach-s3c2410/include/mach/memory.h
index 93782628a786..6f1e5871ae4b 100644
--- a/arch/arm/mach-s3c2410/include/mach/memory.h
+++ b/arch/arm/mach-s3c2410/include/mach/memory.h
@@ -13,7 +13,4 @@
13 13
14#define PHYS_OFFSET UL(0x30000000) 14#define PHYS_OFFSET UL(0x30000000)
15 15
16#define __virt_to_bus(x) __virt_to_phys(x)
17#define __bus_to_virt(x) __phys_to_virt(x)
18
19#endif 16#endif
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-clock.h b/arch/arm/mach-s3c2410/include/mach/regs-clock.h
index b3f90aa78076..2a5d90e957fb 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-clock.h
+++ b/arch/arm/mach-s3c2410/include/mach/regs-clock.h
@@ -42,13 +42,6 @@
42#define S3C2410_CLKCON_IIS (1<<17) 42#define S3C2410_CLKCON_IIS (1<<17)
43#define S3C2410_CLKCON_SPI (1<<18) 43#define S3C2410_CLKCON_SPI (1<<18)
44 44
45#define S3C2410_PLLCON_MDIVSHIFT 12
46#define S3C2410_PLLCON_PDIVSHIFT 4
47#define S3C2410_PLLCON_SDIVSHIFT 0
48#define S3C2410_PLLCON_MDIVMASK ((1<<(1+(19-12)))-1)
49#define S3C2410_PLLCON_PDIVMASK ((1<<5)-1)
50#define S3C2410_PLLCON_SDIVMASK 3
51
52/* DCLKCON register addresses in gpio.h */ 45/* DCLKCON register addresses in gpio.h */
53 46
54#define S3C2410_DCLKCON_DCLK0EN (1<<0) 47#define S3C2410_DCLKCON_DCLK0EN (1<<0)
@@ -76,32 +69,6 @@
76#define S3C2410_CLKSLOW_SLOWVAL(x) (x) 69#define S3C2410_CLKSLOW_SLOWVAL(x) (x)
77#define S3C2410_CLKSLOW_GET_SLOWVAL(x) ((x) & 7) 70#define S3C2410_CLKSLOW_GET_SLOWVAL(x) ((x) & 7)
78 71
79#ifndef __ASSEMBLY__
80
81#include <asm/div64.h>
82
83static inline unsigned int
84s3c2410_get_pll(unsigned int pllval, unsigned int baseclk)
85{
86 unsigned int mdiv, pdiv, sdiv;
87 uint64_t fvco;
88
89 mdiv = pllval >> S3C2410_PLLCON_MDIVSHIFT;
90 pdiv = pllval >> S3C2410_PLLCON_PDIVSHIFT;
91 sdiv = pllval >> S3C2410_PLLCON_SDIVSHIFT;
92
93 mdiv &= S3C2410_PLLCON_MDIVMASK;
94 pdiv &= S3C2410_PLLCON_PDIVMASK;
95 sdiv &= S3C2410_PLLCON_SDIVMASK;
96
97 fvco = (uint64_t)baseclk * (mdiv + 8);
98 do_div(fvco, (pdiv + 2) << sdiv);
99
100 return (unsigned int)fvco;
101}
102
103#endif /* __ASSEMBLY__ */
104
105#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442) 72#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
106 73
107/* extra registers */ 74/* extra registers */
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-gpio.h b/arch/arm/mach-s3c2410/include/mach/regs-gpio.h
index 528080ceac44..321077613067 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-gpio.h
+++ b/arch/arm/mach-s3c2410/include/mach/regs-gpio.h
@@ -1053,13 +1053,6 @@
1053#define S3C24XX_EXTINT1 S3C24XX_GPIOREG2(0x8C) 1053#define S3C24XX_EXTINT1 S3C24XX_GPIOREG2(0x8C)
1054#define S3C24XX_EXTINT2 S3C24XX_GPIOREG2(0x90) 1054#define S3C24XX_EXTINT2 S3C24XX_GPIOREG2(0x90)
1055 1055
1056/* values for S3C2410_EXTINT0/1/2 */
1057#define S3C2410_EXTINT_LOWLEV (0x00)
1058#define S3C2410_EXTINT_HILEV (0x01)
1059#define S3C2410_EXTINT_FALLEDGE (0x02)
1060#define S3C2410_EXTINT_RISEEDGE (0x04)
1061#define S3C2410_EXTINT_BOTHEDGE (0x06)
1062
1063/* interrupt filtering conrrol for EINT16..EINT23 */ 1056/* interrupt filtering conrrol for EINT16..EINT23 */
1064#define S3C2410_EINFLT0 S3C2410_GPIOREG(0x94) 1057#define S3C2410_EINFLT0 S3C2410_GPIOREG(0x94)
1065#define S3C2410_EINFLT1 S3C2410_GPIOREG(0x98) 1058#define S3C2410_EINFLT1 S3C2410_GPIOREG(0x98)
diff --git a/arch/arm/mach-s3c2410/include/mach/spi.h b/arch/arm/mach-s3c2410/include/mach/spi.h
index 46d46f5b99f2..1d300fb112b1 100644
--- a/arch/arm/mach-s3c2410/include/mach/spi.h
+++ b/arch/arm/mach-s3c2410/include/mach/spi.h
@@ -14,7 +14,7 @@
14#define __ASM_ARCH_SPI_H __FILE__ 14#define __ASM_ARCH_SPI_H __FILE__
15 15
16struct s3c2410_spi_info { 16struct s3c2410_spi_info {
17 unsigned long pin_cs; /* simple gpio cs */ 17 int pin_cs; /* simple gpio cs */
18 unsigned int num_cs; /* total chipselects */ 18 unsigned int num_cs; /* total chipselects */
19 int bus_num; /* bus number to use. */ 19 int bus_num; /* bus number to use. */
20 20
@@ -22,5 +22,12 @@ struct s3c2410_spi_info {
22 void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol); 22 void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol);
23}; 23};
24 24
25/* Standard setup / suspend routines for SPI GPIO pins. */
26
27extern void s3c24xx_spi_gpiocfg_bus0_gpe11_12_13(struct s3c2410_spi_info *spi,
28 int enable);
29
30extern void s3c24xx_spi_gpiocfg_bus1_gpg5_6_7(struct s3c2410_spi_info *spi,
31 int enable);
25 32
26#endif /* __ASM_ARCH_SPI_H */ 33#endif /* __ASM_ARCH_SPI_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/system-reset.h b/arch/arm/mach-s3c2410/include/mach/system-reset.h
index 43535a0e7186..7613d0a384ba 100644
--- a/arch/arm/mach-s3c2410/include/mach/system-reset.h
+++ b/arch/arm/mach-s3c2410/include/mach/system-reset.h
@@ -13,7 +13,7 @@
13#include <mach/hardware.h> 13#include <mach/hardware.h>
14#include <linux/io.h> 14#include <linux/io.h>
15 15
16#include <asm/plat-s3c/regs-watchdog.h> 16#include <plat/regs-watchdog.h>
17#include <mach/regs-clock.h> 17#include <mach/regs-clock.h>
18 18
19#include <linux/clk.h> 19#include <linux/clk.h>
diff --git a/arch/arm/mach-s3c2410/include/mach/tick.h b/arch/arm/mach-s3c2410/include/mach/tick.h
new file mode 100644
index 000000000000..544da41979db
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/tick.h
@@ -0,0 +1,15 @@
1/* linux/arch/arm/mach-s3c2410/include/mach/tick.h
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * S3C2410 - timer tick support
8 */
9
10#define SRCPND_TIMER4 (1<<(IRQ_TIMER4 - IRQ_EINT0))
11
12static inline int s3c24xx_ostimer_pending(void)
13{
14 return __raw_readl(S3C2410_SRCPND) & SRCPND_TIMER4;
15}
diff --git a/arch/arm/mach-s3c2410/include/mach/uncompress.h b/arch/arm/mach-s3c2410/include/mach/uncompress.h
index ab39491beee2..c9432103750d 100644
--- a/arch/arm/mach-s3c2410/include/mach/uncompress.h
+++ b/arch/arm/mach-s3c2410/include/mach/uncompress.h
@@ -1,3 +1,4 @@
1
1/* arch/arm/mach-s3c2410/include/mach/uncompress.h 2/* arch/arm/mach-s3c2410/include/mach/uncompress.h
2 * 3 *
3 * Copyright (c) 2003, 2007 Simtec Electronics 4 * Copyright (c) 2003, 2007 Simtec Electronics
diff --git a/arch/arm/mach-s3c2410/mach-amlm5900.c b/arch/arm/mach-s3c2410/mach-amlm5900.c
index d061fea01900..6d6995afeb43 100644
--- a/arch/arm/mach-s3c2410/mach-amlm5900.c
+++ b/arch/arm/mach-s3c2410/mach-amlm5900.c
@@ -52,6 +52,7 @@
52#include <mach/regs-lcd.h> 52#include <mach/regs-lcd.h>
53#include <mach/regs-gpio.h> 53#include <mach/regs-gpio.h>
54 54
55#include <plat/iic.h>
55#include <plat/devs.h> 56#include <plat/devs.h>
56#include <plat/cpu.h> 57#include <plat/cpu.h>
57 58
@@ -150,7 +151,7 @@ static struct platform_device *amlm5900_devices[] __initdata = {
150#endif 151#endif
151 &s3c_device_adc, 152 &s3c_device_adc,
152 &s3c_device_wdt, 153 &s3c_device_wdt,
153 &s3c_device_i2c, 154 &s3c_device_i2c0,
154 &s3c_device_usb, 155 &s3c_device_usb,
155 &s3c_device_rtc, 156 &s3c_device_rtc,
156 &s3c_device_usbgadget, 157 &s3c_device_usbgadget,
@@ -233,6 +234,7 @@ static void __init amlm5900_init(void)
233#ifdef CONFIG_FB_S3C2410 234#ifdef CONFIG_FB_S3C2410
234 s3c24xx_fb_set_platdata(&amlm5900_fb_info); 235 s3c24xx_fb_set_platdata(&amlm5900_fb_info);
235#endif 236#endif
237 s3c_i2c0_set_platdata(NULL);
236 platform_add_devices(amlm5900_devices, ARRAY_SIZE(amlm5900_devices)); 238 platform_add_devices(amlm5900_devices, ARRAY_SIZE(amlm5900_devices));
237} 239}
238 240
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c
index 8db9c700e3c2..01bd76725b92 100644
--- a/arch/arm/mach-s3c2410/mach-bast.c
+++ b/arch/arm/mach-s3c2410/mach-bast.c
@@ -44,8 +44,8 @@
44#include <mach/regs-mem.h> 44#include <mach/regs-mem.h>
45#include <mach/regs-lcd.h> 45#include <mach/regs-lcd.h>
46 46
47#include <asm/plat-s3c/nand.h> 47#include <plat/nand.h>
48#include <asm/plat-s3c/iic.h> 48#include <plat/iic.h>
49#include <mach/fb.h> 49#include <mach/fb.h>
50 50
51#include <linux/mtd/mtd.h> 51#include <linux/mtd/mtd.h>
@@ -406,7 +406,7 @@ static struct platform_device bast_sio = {
406 * standard 100KHz i2c bus frequency 406 * standard 100KHz i2c bus frequency
407*/ 407*/
408 408
409static struct s3c2410_platform_i2c bast_i2c_info = { 409static struct s3c2410_platform_i2c __initdata bast_i2c_info = {
410 .flags = 0, 410 .flags = 0,
411 .slave_addr = 0x10, 411 .slave_addr = 0x10,
412 .bus_freq = 100*1000, 412 .bus_freq = 100*1000,
@@ -553,7 +553,7 @@ static struct platform_device *bast_devices[] __initdata = {
553 &s3c_device_usb, 553 &s3c_device_usb,
554 &s3c_device_lcd, 554 &s3c_device_lcd,
555 &s3c_device_wdt, 555 &s3c_device_wdt,
556 &s3c_device_i2c, 556 &s3c_device_i2c0,
557 &s3c_device_rtc, 557 &s3c_device_rtc,
558 &s3c_device_nand, 558 &s3c_device_nand,
559 &bast_device_dm9k, 559 &bast_device_dm9k,
@@ -588,7 +588,8 @@ static void __init bast_map_io(void)
588 s3c24xx_register_clocks(bast_clocks, ARRAY_SIZE(bast_clocks)); 588 s3c24xx_register_clocks(bast_clocks, ARRAY_SIZE(bast_clocks));
589 589
590 s3c_device_nand.dev.platform_data = &bast_nand_info; 590 s3c_device_nand.dev.platform_data = &bast_nand_info;
591 s3c_device_i2c.dev.platform_data = &bast_i2c_info; 591
592 s3c_i2c0_set_platdata(&bast_i2c_info);
592 593
593 s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); 594 s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
594 s3c24xx_init_clocks(0); 595 s3c24xx_init_clocks(0);
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index 98716d0108e9..821a1668c3ac 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -38,11 +38,13 @@
38#include <mach/h1940.h> 38#include <mach/h1940.h>
39#include <mach/h1940-latch.h> 39#include <mach/h1940-latch.h>
40#include <mach/fb.h> 40#include <mach/fb.h>
41#include <asm/plat-s3c24xx/udc.h> 41#include <plat/udc.h>
42#include <plat/iic.h>
42 43
43#include <plat/clock.h> 44#include <plat/clock.h>
44#include <plat/devs.h> 45#include <plat/devs.h>
45#include <plat/cpu.h> 46#include <plat/cpu.h>
47#include <plat/pll.h>
46#include <plat/pm.h> 48#include <plat/pm.h>
47 49
48static struct map_desc h1940_iodesc[] __initdata = { 50static struct map_desc h1940_iodesc[] __initdata = {
@@ -183,7 +185,7 @@ static struct platform_device *h1940_devices[] __initdata = {
183 &s3c_device_usb, 185 &s3c_device_usb,
184 &s3c_device_lcd, 186 &s3c_device_lcd,
185 &s3c_device_wdt, 187 &s3c_device_wdt,
186 &s3c_device_i2c, 188 &s3c_device_i2c0,
187 &s3c_device_iis, 189 &s3c_device_iis,
188 &s3c_device_usbgadget, 190 &s3c_device_usbgadget,
189 &s3c_device_leds, 191 &s3c_device_leds,
@@ -215,6 +217,7 @@ static void __init h1940_init(void)
215 217
216 s3c24xx_fb_set_platdata(&h1940_fb_info); 218 s3c24xx_fb_set_platdata(&h1940_fb_info);
217 s3c24xx_udc_set_platdata(&h1940_udc_cfg); 219 s3c24xx_udc_set_platdata(&h1940_udc_cfg);
220 s3c_i2c0_set_platdata(NULL);
218 221
219 /* Turn off suspend on both USB ports, and switch the 222 /* Turn off suspend on both USB ports, and switch the
220 * selectable USB port to USB device mode. */ 223 * selectable USB port to USB device mode. */
@@ -223,10 +226,9 @@ static void __init h1940_init(void)
223 S3C2410_MISCCR_USBSUSPND0 | 226 S3C2410_MISCCR_USBSUSPND0 |
224 S3C2410_MISCCR_USBSUSPND1, 0x0); 227 S3C2410_MISCCR_USBSUSPND1, 0x0);
225 228
226 tmp = ( 229 tmp = (0x78 << S3C24XX_PLLCON_MDIVSHIFT)
227 0x78 << S3C2410_PLLCON_MDIVSHIFT) 230 | (0x02 << S3C24XX_PLLCON_PDIVSHIFT)
228 | (0x02 << S3C2410_PLLCON_PDIVSHIFT) 231 | (0x03 << S3C24XX_PLLCON_SDIVSHIFT);
229 | (0x03 << S3C2410_PLLCON_SDIVSHIFT);
230 writel(tmp, S3C2410_UPLLCON); 232 writel(tmp, S3C2410_UPLLCON);
231 233
232 platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices)); 234 platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
diff --git a/arch/arm/mach-s3c2410/mach-n30.c b/arch/arm/mach-s3c2410/mach-n30.c
index 82505517846c..05a5e877b49b 100644
--- a/arch/arm/mach-s3c2410/mach-n30.c
+++ b/arch/arm/mach-s3c2410/mach-n30.c
@@ -17,7 +17,6 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/types.h> 18#include <linux/types.h>
19 19
20#include <linux/delay.h>
21#include <linux/gpio_keys.h> 20#include <linux/gpio_keys.h>
22#include <linux/init.h> 21#include <linux/init.h>
23#include <linux/input.h> 22#include <linux/input.h>
@@ -40,14 +39,14 @@
40#include <asm/mach/irq.h> 39#include <asm/mach/irq.h>
41#include <asm/mach/map.h> 40#include <asm/mach/map.h>
42 41
43#include <asm/plat-s3c/iic.h> 42#include <plat/iic.h>
44#include <plat/regs-serial.h> 43#include <plat/regs-serial.h>
45 44
46#include <plat/clock.h> 45#include <plat/clock.h>
47#include <plat/cpu.h> 46#include <plat/cpu.h>
48#include <plat/devs.h> 47#include <plat/devs.h>
49#include <plat/s3c2410.h> 48#include <plat/s3c2410.h>
50#include <asm/plat-s3c24xx/udc.h> 49#include <plat/udc.h>
51 50
52static struct map_desc n30_iodesc[] __initdata = { 51static struct map_desc n30_iodesc[] __initdata = {
53 /* nothing here yet */ 52 /* nothing here yet */
@@ -320,7 +319,7 @@ static struct s3c2410fb_mach_info n30_fb_info __initdata = {
320static struct platform_device *n30_devices[] __initdata = { 319static struct platform_device *n30_devices[] __initdata = {
321 &s3c_device_lcd, 320 &s3c_device_lcd,
322 &s3c_device_wdt, 321 &s3c_device_wdt,
323 &s3c_device_i2c, 322 &s3c_device_i2c0,
324 &s3c_device_iis, 323 &s3c_device_iis,
325 &s3c_device_usb, 324 &s3c_device_usb,
326 &s3c_device_usbgadget, 325 &s3c_device_usbgadget,
@@ -332,7 +331,7 @@ static struct platform_device *n30_devices[] __initdata = {
332static struct platform_device *n35_devices[] __initdata = { 331static struct platform_device *n35_devices[] __initdata = {
333 &s3c_device_lcd, 332 &s3c_device_lcd,
334 &s3c_device_wdt, 333 &s3c_device_wdt,
335 &s3c_device_i2c, 334 &s3c_device_i2c0,
336 &s3c_device_iis, 335 &s3c_device_iis,
337 &s3c_device_usbgadget, 336 &s3c_device_usbgadget,
338 &n35_button_device, 337 &n35_button_device,
@@ -501,7 +500,7 @@ static void __init n30_init_irq(void)
501static void __init n30_init(void) 500static void __init n30_init(void)
502{ 501{
503 s3c24xx_fb_set_platdata(&n30_fb_info); 502 s3c24xx_fb_set_platdata(&n30_fb_info);
504 s3c_device_i2c.dev.platform_data = &n30_i2ccfg; 503 s3c_device_i2c0.dev.platform_data = &n30_i2ccfg;
505 s3c24xx_udc_set_platdata(&n30_udc_cfg); 504 s3c24xx_udc_set_platdata(&n30_udc_cfg);
506 505
507 /* Turn off suspend on both USB ports, and switch the 506 /* Turn off suspend on both USB ports, and switch the
diff --git a/arch/arm/mach-s3c2410/mach-otom.c b/arch/arm/mach-s3c2410/mach-otom.c
index d8255cf87e44..f6c7261a4a12 100644
--- a/arch/arm/mach-s3c2410/mach-otom.c
+++ b/arch/arm/mach-s3c2410/mach-otom.c
@@ -35,6 +35,7 @@
35#include <plat/s3c2410.h> 35#include <plat/s3c2410.h>
36#include <plat/clock.h> 36#include <plat/clock.h>
37#include <plat/devs.h> 37#include <plat/devs.h>
38#include <plat/iic.h>
38#include <plat/cpu.h> 39#include <plat/cpu.h>
39 40
40static struct map_desc otom11_iodesc[] __initdata = { 41static struct map_desc otom11_iodesc[] __initdata = {
@@ -94,7 +95,7 @@ static struct platform_device *otom11_devices[] __initdata = {
94 &s3c_device_usb, 95 &s3c_device_usb,
95 &s3c_device_lcd, 96 &s3c_device_lcd,
96 &s3c_device_wdt, 97 &s3c_device_wdt,
97 &s3c_device_i2c, 98 &s3c_device_i2c0,
98 &s3c_device_iis, 99 &s3c_device_iis,
99 &s3c_device_rtc, 100 &s3c_device_rtc,
100 &otom_device_nor, 101 &otom_device_nor,
@@ -109,6 +110,7 @@ static void __init otom11_map_io(void)
109 110
110static void __init otom11_init(void) 111static void __init otom11_init(void)
111{ 112{
113 s3c_i2c0_set_platdata(NULL);
112 platform_add_devices(otom11_devices, ARRAY_SIZE(otom11_devices)); 114 platform_add_devices(otom11_devices, ARRAY_SIZE(otom11_devices));
113} 115}
114 116
diff --git a/arch/arm/mach-s3c2410/mach-qt2410.c b/arch/arm/mach-s3c2410/mach-qt2410.c
index 661807e14e8a..9678a53ceeb1 100644
--- a/arch/arm/mach-s3c2410/mach-qt2410.c
+++ b/arch/arm/mach-s3c2410/mach-qt2410.c
@@ -50,10 +50,11 @@
50#include <mach/leds-gpio.h> 50#include <mach/leds-gpio.h>
51#include <plat/regs-serial.h> 51#include <plat/regs-serial.h>
52#include <mach/fb.h> 52#include <mach/fb.h>
53#include <asm/plat-s3c/nand.h> 53#include <plat/nand.h>
54#include <asm/plat-s3c24xx/udc.h> 54#include <plat/udc.h>
55#include <mach/spi.h> 55#include <mach/spi.h>
56#include <mach/spi-gpio.h> 56#include <mach/spi-gpio.h>
57#include <plat/iic.h>
57 58
58#include <plat/common-smdk.h> 59#include <plat/common-smdk.h>
59#include <plat/devs.h> 60#include <plat/devs.h>
@@ -247,7 +248,7 @@ static struct platform_device *qt2410_devices[] __initdata = {
247 &s3c_device_usb, 248 &s3c_device_usb,
248 &s3c_device_lcd, 249 &s3c_device_lcd,
249 &s3c_device_wdt, 250 &s3c_device_wdt,
250 &s3c_device_i2c, 251 &s3c_device_i2c0,
251 &s3c_device_iis, 252 &s3c_device_iis,
252 &s3c_device_sdi, 253 &s3c_device_sdi,
253 &s3c_device_usbgadget, 254 &s3c_device_usbgadget,
@@ -349,6 +350,7 @@ static void __init qt2410_machine_init(void)
349 s3c2410_gpio_setpin(S3C2410_GPB0, 1); 350 s3c2410_gpio_setpin(S3C2410_GPB0, 1);
350 351
351 s3c24xx_udc_set_platdata(&qt2410_udc_cfg); 352 s3c24xx_udc_set_platdata(&qt2410_udc_cfg);
353 s3c_i2c0_set_platdata(NULL);
352 354
353 s3c2410_gpio_cfgpin(S3C2410_GPB5, S3C2410_GPIO_OUTPUT); 355 s3c2410_gpio_cfgpin(S3C2410_GPB5, S3C2410_GPIO_OUTPUT);
354 356
diff --git a/arch/arm/mach-s3c2410/mach-smdk2410.c b/arch/arm/mach-s3c2410/mach-smdk2410.c
index 152527bb2872..c49126ccb1d5 100644
--- a/arch/arm/mach-s3c2410/mach-smdk2410.c
+++ b/arch/arm/mach-s3c2410/mach-smdk2410.c
@@ -47,6 +47,7 @@
47#include <asm/mach-types.h> 47#include <asm/mach-types.h>
48 48
49#include <plat/regs-serial.h> 49#include <plat/regs-serial.h>
50#include <plat/iic.h>
50 51
51#include <plat/devs.h> 52#include <plat/devs.h>
52#include <plat/cpu.h> 53#include <plat/cpu.h>
@@ -89,7 +90,7 @@ static struct platform_device *smdk2410_devices[] __initdata = {
89 &s3c_device_usb, 90 &s3c_device_usb,
90 &s3c_device_lcd, 91 &s3c_device_lcd,
91 &s3c_device_wdt, 92 &s3c_device_wdt,
92 &s3c_device_i2c, 93 &s3c_device_i2c0,
93 &s3c_device_iis, 94 &s3c_device_iis,
94}; 95};
95 96
@@ -102,6 +103,7 @@ static void __init smdk2410_map_io(void)
102 103
103static void __init smdk2410_init(void) 104static void __init smdk2410_init(void)
104{ 105{
106 s3c_i2c0_set_platdata(NULL);
105 platform_add_devices(smdk2410_devices, ARRAY_SIZE(smdk2410_devices)); 107 platform_add_devices(smdk2410_devices, ARRAY_SIZE(smdk2410_devices));
106 smdk_machine_init(); 108 smdk_machine_init();
107} 109}
diff --git a/arch/arm/mach-s3c2410/mach-tct_hammer.c b/arch/arm/mach-s3c2410/mach-tct_hammer.c
index 309dcf4c870a..8fdb0430bd48 100644
--- a/arch/arm/mach-s3c2410/mach-tct_hammer.c
+++ b/arch/arm/mach-s3c2410/mach-tct_hammer.c
@@ -45,6 +45,7 @@
45#include <asm/mach-types.h> 45#include <asm/mach-types.h>
46 46
47#include <plat/regs-serial.h> 47#include <plat/regs-serial.h>
48#include <plat/iic.h>
48#include <plat/devs.h> 49#include <plat/devs.h>
49#include <plat/cpu.h> 50#include <plat/cpu.h>
50 51
@@ -127,7 +128,7 @@ static struct s3c2410_uartcfg tct_hammer_uartcfgs[] = {
127static struct platform_device *tct_hammer_devices[] __initdata = { 128static struct platform_device *tct_hammer_devices[] __initdata = {
128 &s3c_device_adc, 129 &s3c_device_adc,
129 &s3c_device_wdt, 130 &s3c_device_wdt,
130 &s3c_device_i2c, 131 &s3c_device_i2c0,
131 &s3c_device_usb, 132 &s3c_device_usb,
132 &s3c_device_rtc, 133 &s3c_device_rtc,
133 &s3c_device_usbgadget, 134 &s3c_device_usbgadget,
@@ -146,6 +147,7 @@ static void __init tct_hammer_map_io(void)
146 147
147static void __init tct_hammer_init(void) 148static void __init tct_hammer_init(void)
148{ 149{
150 s3c_i2c0_set_platdata(NULL);
149 platform_add_devices(tct_hammer_devices, ARRAY_SIZE(tct_hammer_devices)); 151 platform_add_devices(tct_hammer_devices, ARRAY_SIZE(tct_hammer_devices));
150} 152}
151 153
diff --git a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c2410/mach-vr1000.c
index 941353af16dc..61a1ea9c5c5c 100644
--- a/arch/arm/mach-s3c2410/mach-vr1000.c
+++ b/arch/arm/mach-s3c2410/mach-vr1000.c
@@ -47,6 +47,7 @@
47#include <plat/clock.h> 47#include <plat/clock.h>
48#include <plat/devs.h> 48#include <plat/devs.h>
49#include <plat/cpu.h> 49#include <plat/cpu.h>
50#include <plat/iic.h>
50 51
51#include "usb-simtec.h" 52#include "usb-simtec.h"
52#include "nor-simtec.h" 53#include "nor-simtec.h"
@@ -334,7 +335,7 @@ static struct platform_device *vr1000_devices[] __initdata = {
334 &s3c_device_usb, 335 &s3c_device_usb,
335 &s3c_device_lcd, 336 &s3c_device_lcd,
336 &s3c_device_wdt, 337 &s3c_device_wdt,
337 &s3c_device_i2c, 338 &s3c_device_i2c0,
338 &s3c_device_adc, 339 &s3c_device_adc,
339 &serial_device, 340 &serial_device,
340 &vr1000_dm9k0, 341 &vr1000_dm9k0,
@@ -384,6 +385,7 @@ static void __init vr1000_map_io(void)
384 385
385static void __init vr1000_init(void) 386static void __init vr1000_init(void)
386{ 387{
388 s3c_i2c0_set_platdata(NULL);
387 platform_add_devices(vr1000_devices, ARRAY_SIZE(vr1000_devices)); 389 platform_add_devices(vr1000_devices, ARRAY_SIZE(vr1000_devices));
388 390
389 i2c_register_board_info(0, vr1000_i2c_devs, 391 i2c_register_board_info(0, vr1000_i2c_devs,
diff --git a/arch/arm/mach-s3c2410/s3c2410.c b/arch/arm/mach-s3c2410/s3c2410.c
index ac79b536c4c3..feb141b1f915 100644
--- a/arch/arm/mach-s3c2410/s3c2410.c
+++ b/arch/arm/mach-s3c2410/s3c2410.c
@@ -16,6 +16,7 @@
16#include <linux/list.h> 16#include <linux/list.h>
17#include <linux/timer.h> 17#include <linux/timer.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/clk.h>
19#include <linux/sysdev.h> 20#include <linux/sysdev.h>
20#include <linux/serial_core.h> 21#include <linux/serial_core.h>
21#include <linux/platform_device.h> 22#include <linux/platform_device.h>
@@ -28,6 +29,8 @@
28#include <mach/hardware.h> 29#include <mach/hardware.h>
29#include <asm/irq.h> 30#include <asm/irq.h>
30 31
32#include <plat/cpu-freq.h>
33
31#include <mach/regs-clock.h> 34#include <mach/regs-clock.h>
32#include <plat/regs-serial.h> 35#include <plat/regs-serial.h>
33 36
@@ -35,6 +38,7 @@
35#include <plat/cpu.h> 38#include <plat/cpu.h>
36#include <plat/devs.h> 39#include <plat/devs.h>
37#include <plat/clock.h> 40#include <plat/clock.h>
41#include <plat/pll.h>
38 42
39/* Initial IO mappings */ 43/* Initial IO mappings */
40 44
@@ -59,25 +63,28 @@ void __init s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no)
59 * machine specific initialisation. 63 * machine specific initialisation.
60*/ 64*/
61 65
62void __init s3c2410_map_io(struct map_desc *mach_desc, int mach_size) 66void __init s3c2410_map_io(void)
63{ 67{
64 /* register our io-tables */
65
66 iotable_init(s3c2410_iodesc, ARRAY_SIZE(s3c2410_iodesc)); 68 iotable_init(s3c2410_iodesc, ARRAY_SIZE(s3c2410_iodesc));
67 iotable_init(mach_desc, mach_size);
68} 69}
69 70
70void __init s3c2410_init_clocks(int xtal) 71void __init_or_cpufreq s3c2410_setup_clocks(void)
71{ 72{
73 struct clk *xtal_clk;
72 unsigned long tmp; 74 unsigned long tmp;
75 unsigned long xtal;
73 unsigned long fclk; 76 unsigned long fclk;
74 unsigned long hclk; 77 unsigned long hclk;
75 unsigned long pclk; 78 unsigned long pclk;
76 79
80 xtal_clk = clk_get(NULL, "xtal");
81 xtal = clk_get_rate(xtal_clk);
82 clk_put(xtal_clk);
83
77 /* now we've got our machine bits initialised, work out what 84 /* now we've got our machine bits initialised, work out what
78 * clocks we've got */ 85 * clocks we've got */
79 86
80 fclk = s3c2410_get_pll(__raw_readl(S3C2410_MPLLCON), xtal); 87 fclk = s3c24xx_get_pll(__raw_readl(S3C2410_MPLLCON), xtal);
81 88
82 tmp = __raw_readl(S3C2410_CLKDIVN); 89 tmp = __raw_readl(S3C2410_CLKDIVN);
83 90
@@ -95,7 +102,13 @@ void __init s3c2410_init_clocks(int xtal)
95 * console to use them 102 * console to use them
96 */ 103 */
97 104
98 s3c24xx_setup_clocks(xtal, fclk, hclk, pclk); 105 s3c24xx_setup_clocks(fclk, hclk, pclk);
106}
107
108void __init s3c2410_init_clocks(int xtal)
109{
110 s3c24xx_register_baseclocks(xtal);
111 s3c2410_setup_clocks();
99 s3c2410_baseclk_add(); 112 s3c2410_baseclk_add();
100} 113}
101 114
diff --git a/arch/arm/mach-s3c2412/Kconfig b/arch/arm/mach-s3c2412/Kconfig
index c59a9d2ee9a6..ca99564ae4b5 100644
--- a/arch/arm/mach-s3c2412/Kconfig
+++ b/arch/arm/mach-s3c2412/Kconfig
@@ -7,6 +7,7 @@
7config CPU_S3C2412 7config CPU_S3C2412
8 bool 8 bool
9 depends on ARCH_S3C2410 9 depends on ARCH_S3C2410
10 select CPU_ARM926T
10 select CPU_LLSERIAL_S3C2440 11 select CPU_LLSERIAL_S3C2440
11 select S3C2412_PM if PM 12 select S3C2412_PM if PM
12 select S3C2412_DMA if S3C2410_DMA 13 select S3C2412_DMA if S3C2410_DMA
diff --git a/arch/arm/mach-s3c2412/clock.c b/arch/arm/mach-s3c2412/clock.c
index 96d9eb15424f..a037df5e1c2d 100644
--- a/arch/arm/mach-s3c2412/clock.c
+++ b/arch/arm/mach-s3c2412/clock.c
@@ -93,12 +93,6 @@ static int s3c2412_upll_enable(struct clk *clk, int enable)
93 93
94/* clock selections */ 94/* clock selections */
95 95
96/* CPU EXTCLK input */
97static struct clk clk_ext = {
98 .name = "extclk",
99 .id = -1,
100};
101
102static struct clk clk_erefclk = { 96static struct clk clk_erefclk = {
103 .name = "erefclk", 97 .name = "erefclk",
104 .id = -1, 98 .id = -1,
@@ -773,5 +767,6 @@ int __init s3c2412_baseclk_add(void)
773 s3c2412_clkcon_enable(clkp, 0); 767 s3c2412_clkcon_enable(clkp, 0);
774 } 768 }
775 769
770 s3c_pwmclk_init();
776 return 0; 771 return 0;
777} 772}
diff --git a/arch/arm/mach-s3c2412/dma.c b/arch/arm/mach-s3c2412/dma.c
index ba0591e71f32..919856c9433f 100644
--- a/arch/arm/mach-s3c2412/dma.c
+++ b/arch/arm/mach-s3c2412/dma.c
@@ -18,7 +18,6 @@
18#include <linux/serial_core.h> 18#include <linux/serial_core.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20
21#include <asm/dma.h>
22#include <mach/dma.h> 21#include <mach/dma.h>
23 22
24#include <plat/dma.h> 23#include <plat/dma.h>
@@ -26,13 +25,13 @@
26 25
27#include <plat/regs-serial.h> 26#include <plat/regs-serial.h>
28#include <mach/regs-gpio.h> 27#include <mach/regs-gpio.h>
29#include <asm/plat-s3c/regs-ac97.h> 28#include <plat/regs-ac97.h>
30#include <mach/regs-mem.h> 29#include <mach/regs-mem.h>
31#include <mach/regs-lcd.h> 30#include <mach/regs-lcd.h>
32#include <mach/regs-sdi.h> 31#include <mach/regs-sdi.h>
33#include <asm/plat-s3c24xx/regs-s3c2412-iis.h> 32#include <asm/plat-s3c24xx/regs-s3c2412-iis.h>
34#include <asm/plat-s3c24xx/regs-iis.h> 33#include <asm/plat-s3c24xx/regs-iis.h>
35#include <asm/plat-s3c24xx/regs-spi.h> 34#include <plat/regs-spi.h>
36 35
37#define MAP(x) { (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID } 36#define MAP(x) { (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID }
38 37
diff --git a/arch/arm/mach-s3c2412/mach-jive.c b/arch/arm/mach-s3c2412/mach-jive.c
index b08f18c8c47a..ecddbbb34832 100644
--- a/arch/arm/mach-s3c2412/mach-jive.c
+++ b/arch/arm/mach-s3c2412/mach-jive.c
@@ -17,7 +17,6 @@
17#include <linux/timer.h> 17#include <linux/timer.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/sysdev.h> 19#include <linux/sysdev.h>
20#include <linux/delay.h>
21#include <linux/serial_core.h> 20#include <linux/serial_core.h>
22#include <linux/platform_device.h> 21#include <linux/platform_device.h>
23#include <linux/i2c.h> 22#include <linux/i2c.h>
@@ -31,8 +30,8 @@
31#include <asm/mach/irq.h> 30#include <asm/mach/irq.h>
32 31
33#include <plat/regs-serial.h> 32#include <plat/regs-serial.h>
34#include <asm/plat-s3c/nand.h> 33#include <plat/nand.h>
35#include <asm/plat-s3c/iic.h> 34#include <plat/iic.h>
36 35
37#include <mach/regs-power.h> 36#include <mach/regs-power.h>
38#include <mach/regs-gpio.h> 37#include <mach/regs-gpio.h>
@@ -52,7 +51,8 @@
52#include <plat/devs.h> 51#include <plat/devs.h>
53#include <plat/cpu.h> 52#include <plat/cpu.h>
54#include <plat/pm.h> 53#include <plat/pm.h>
55#include <asm/plat-s3c24xx/udc.h> 54#include <plat/udc.h>
55#include <plat/iic.h>
56 56
57static struct map_desc jive_iodesc[] __initdata = { 57static struct map_desc jive_iodesc[] __initdata = {
58}; 58};
@@ -398,11 +398,12 @@ static struct s3c2410_spigpio_info jive_lcd_spi = {
398 .bus_num = 1, 398 .bus_num = 1,
399 .pin_clk = S3C2410_GPG8, 399 .pin_clk = S3C2410_GPG8,
400 .pin_mosi = S3C2410_GPB8, 400 .pin_mosi = S3C2410_GPB8,
401 .num_chipselect = 1,
401 .chip_select = jive_lcd_spi_chipselect, 402 .chip_select = jive_lcd_spi_chipselect,
402}; 403};
403 404
404static struct platform_device jive_device_lcdspi = { 405static struct platform_device jive_device_lcdspi = {
405 .name = "s3c24xx-spi-gpio", 406 .name = "spi_s3c24xx_gpio",
406 .id = 1, 407 .id = 1,
407 .num_resources = 0, 408 .num_resources = 0,
408 .dev.platform_data = &jive_lcd_spi, 409 .dev.platform_data = &jive_lcd_spi,
@@ -419,11 +420,12 @@ static struct s3c2410_spigpio_info jive_wm8750_spi = {
419 .bus_num = 2, 420 .bus_num = 2,
420 .pin_clk = S3C2410_GPB4, 421 .pin_clk = S3C2410_GPB4,
421 .pin_mosi = S3C2410_GPB9, 422 .pin_mosi = S3C2410_GPB9,
423 .num_chipselect = 1,
422 .chip_select = jive_wm8750_chipselect, 424 .chip_select = jive_wm8750_chipselect,
423}; 425};
424 426
425static struct platform_device jive_device_wm8750 = { 427static struct platform_device jive_device_wm8750 = {
426 .name = "s3c24xx-spi-gpio", 428 .name = "spi_s3c24xx_gpio",
427 .id = 2, 429 .id = 2,
428 .num_resources = 0, 430 .num_resources = 0,
429 .dev.platform_data = &jive_wm8750_spi, 431 .dev.platform_data = &jive_wm8750_spi,
@@ -450,14 +452,14 @@ static struct spi_board_info __initdata jive_spi_devs[] = {
450 452
451/* I2C bus and device configuration. */ 453/* I2C bus and device configuration. */
452 454
453static struct s3c2410_platform_i2c jive_i2c_cfg = { 455static struct s3c2410_platform_i2c jive_i2c_cfg __initdata = {
454 .max_freq = 80 * 1000, 456 .max_freq = 80 * 1000,
455 .bus_freq = 50 * 1000, 457 .bus_freq = 50 * 1000,
456 .flags = S3C_IICFLG_FILTER, 458 .flags = S3C_IICFLG_FILTER,
457 .sda_delay = 2, 459 .sda_delay = 2,
458}; 460};
459 461
460static struct i2c_board_info jive_i2c_devs[] = { 462static struct i2c_board_info jive_i2c_devs[] __initdata = {
461 [0] = { 463 [0] = {
462 I2C_BOARD_INFO("lis302dl", 0x1c), 464 I2C_BOARD_INFO("lis302dl", 0x1c),
463 .irq = IRQ_EINT14, 465 .irq = IRQ_EINT14,
@@ -470,7 +472,7 @@ static struct platform_device *jive_devices[] __initdata = {
470 &s3c_device_usb, 472 &s3c_device_usb,
471 &s3c_device_rtc, 473 &s3c_device_rtc,
472 &s3c_device_wdt, 474 &s3c_device_wdt,
473 &s3c_device_i2c, 475 &s3c_device_i2c0,
474 &s3c_device_lcd, 476 &s3c_device_lcd,
475 &jive_device_lcdspi, 477 &jive_device_lcdspi,
476 &jive_device_wm8750, 478 &jive_device_wm8750,
@@ -663,7 +665,7 @@ static void __init jive_machine_init(void)
663 665
664 spi_register_board_info(jive_spi_devs, ARRAY_SIZE(jive_spi_devs)); 666 spi_register_board_info(jive_spi_devs, ARRAY_SIZE(jive_spi_devs));
665 667
666 s3c_device_i2c.dev.platform_data = &jive_i2c_cfg; 668 s3c_i2c0_set_platdata(&jive_i2c_cfg);
667 i2c_register_board_info(0, jive_i2c_devs, ARRAY_SIZE(jive_i2c_devs)); 669 i2c_register_board_info(0, jive_i2c_devs, ARRAY_SIZE(jive_i2c_devs));
668 670
669 pm_power_off = jive_power_off; 671 pm_power_off = jive_power_off;
diff --git a/arch/arm/mach-s3c2412/mach-smdk2413.c b/arch/arm/mach-s3c2412/mach-smdk2413.c
index c719b5a740a9..eba66aa6bd20 100644
--- a/arch/arm/mach-s3c2412/mach-smdk2413.c
+++ b/arch/arm/mach-s3c2412/mach-smdk2413.c
@@ -37,7 +37,8 @@
37#include <mach/regs-lcd.h> 37#include <mach/regs-lcd.h>
38 38
39#include <mach/idle.h> 39#include <mach/idle.h>
40#include <asm/plat-s3c24xx/udc.h> 40#include <plat/udc.h>
41#include <plat/iic.h>
41#include <mach/fb.h> 42#include <mach/fb.h>
42 43
43#include <plat/s3c2410.h> 44#include <plat/s3c2410.h>
@@ -105,7 +106,7 @@ static struct platform_device *smdk2413_devices[] __initdata = {
105 &s3c_device_usb, 106 &s3c_device_usb,
106 //&s3c_device_lcd, 107 //&s3c_device_lcd,
107 &s3c_device_wdt, 108 &s3c_device_wdt,
108 &s3c_device_i2c, 109 &s3c_device_i2c0,
109 &s3c_device_iis, 110 &s3c_device_iis,
110 &s3c_device_usbgadget, 111 &s3c_device_usbgadget,
111}; 112};
@@ -142,6 +143,7 @@ static void __init smdk2413_machine_init(void)
142 143
143 144
144 s3c24xx_udc_set_platdata(&smdk2413_udc_cfg); 145 s3c24xx_udc_set_platdata(&smdk2413_udc_cfg);
146 s3c_i2c0_set_platdata(NULL);
145 147
146 platform_add_devices(smdk2413_devices, ARRAY_SIZE(smdk2413_devices)); 148 platform_add_devices(smdk2413_devices, ARRAY_SIZE(smdk2413_devices));
147 smdk_machine_init(); 149 smdk_machine_init();
diff --git a/arch/arm/mach-s3c2412/mach-vstms.c b/arch/arm/mach-s3c2412/mach-vstms.c
index 4cfa19ad9be0..11e8ad49fc7b 100644
--- a/arch/arm/mach-s3c2412/mach-vstms.c
+++ b/arch/arm/mach-s3c2412/mach-vstms.c
@@ -39,7 +39,8 @@
39#include <mach/idle.h> 39#include <mach/idle.h>
40#include <mach/fb.h> 40#include <mach/fb.h>
41 41
42#include <asm/plat-s3c/nand.h> 42#include <plat/iic.h>
43#include <plat/nand.h>
43 44
44#include <plat/s3c2410.h> 45#include <plat/s3c2410.h>
45#include <plat/s3c2412.h> 46#include <plat/s3c2412.h>
@@ -122,7 +123,7 @@ static struct s3c2410_platform_nand vstms_nand_info = {
122static struct platform_device *vstms_devices[] __initdata = { 123static struct platform_device *vstms_devices[] __initdata = {
123 &s3c_device_usb, 124 &s3c_device_usb,
124 &s3c_device_wdt, 125 &s3c_device_wdt,
125 &s3c_device_i2c, 126 &s3c_device_i2c0,
126 &s3c_device_iis, 127 &s3c_device_iis,
127 &s3c_device_rtc, 128 &s3c_device_rtc,
128 &s3c_device_nand, 129 &s3c_device_nand,
@@ -151,6 +152,7 @@ static void __init vstms_map_io(void)
151 152
152static void __init vstms_init(void) 153static void __init vstms_init(void)
153{ 154{
155 s3c_i2c0_set_platdata(NULL);
154 platform_add_devices(vstms_devices, ARRAY_SIZE(vstms_devices)); 156 platform_add_devices(vstms_devices, ARRAY_SIZE(vstms_devices));
155} 157}
156 158
diff --git a/arch/arm/mach-s3c2412/s3c2412.c b/arch/arm/mach-s3c2412/s3c2412.c
index 313759c3da69..5b5aba69ec3f 100644
--- a/arch/arm/mach-s3c2412/s3c2412.c
+++ b/arch/arm/mach-s3c2412/s3c2412.c
@@ -16,6 +16,7 @@
16#include <linux/list.h> 16#include <linux/list.h>
17#include <linux/timer.h> 17#include <linux/timer.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/clk.h>
19#include <linux/delay.h> 20#include <linux/delay.h>
20#include <linux/sysdev.h> 21#include <linux/sysdev.h>
21#include <linux/serial_core.h> 22#include <linux/serial_core.h>
@@ -33,13 +34,15 @@
33#include <mach/reset.h> 34#include <mach/reset.h>
34#include <mach/idle.h> 35#include <mach/idle.h>
35 36
37#include <plat/cpu-freq.h>
38
36#include <mach/regs-clock.h> 39#include <mach/regs-clock.h>
37#include <plat/regs-serial.h> 40#include <plat/regs-serial.h>
38#include <mach/regs-power.h> 41#include <mach/regs-power.h>
39#include <mach/regs-gpio.h> 42#include <mach/regs-gpio.h>
40#include <mach/regs-gpioj.h> 43#include <mach/regs-gpioj.h>
41#include <mach/regs-dsc.h> 44#include <mach/regs-dsc.h>
42#include <asm/plat-s3c24xx/regs-spi.h> 45#include <plat/regs-spi.h>
43#include <mach/regs-s3c2412.h> 46#include <mach/regs-s3c2412.h>
44 47
45#include <plat/s3c2412.h> 48#include <plat/s3c2412.h>
@@ -47,6 +50,7 @@
47#include <plat/devs.h> 50#include <plat/devs.h>
48#include <plat/clock.h> 51#include <plat/clock.h>
49#include <plat/pm.h> 52#include <plat/pm.h>
53#include <plat/pll.h>
50 54
51#ifndef CONFIG_CPU_S3C2412_ONLY 55#ifndef CONFIG_CPU_S3C2412_ONLY
52void __iomem *s3c24xx_va_gpio2 = S3C24XX_VA_GPIO; 56void __iomem *s3c24xx_va_gpio2 = S3C24XX_VA_GPIO;
@@ -136,7 +140,7 @@ static void s3c2412_hard_reset(void)
136 * machine specific initialisation. 140 * machine specific initialisation.
137*/ 141*/
138 142
139void __init s3c2412_map_io(struct map_desc *mach_desc, int mach_size) 143void __init s3c2412_map_io(void)
140{ 144{
141 /* move base of IO */ 145 /* move base of IO */
142 146
@@ -153,20 +157,25 @@ void __init s3c2412_map_io(struct map_desc *mach_desc, int mach_size)
153 /* register our io-tables */ 157 /* register our io-tables */
154 158
155 iotable_init(s3c2412_iodesc, ARRAY_SIZE(s3c2412_iodesc)); 159 iotable_init(s3c2412_iodesc, ARRAY_SIZE(s3c2412_iodesc));
156 iotable_init(mach_desc, mach_size);
157} 160}
158 161
159void __init s3c2412_init_clocks(int xtal) 162void __init_or_cpufreq s3c2412_setup_clocks(void)
160{ 163{
164 struct clk *xtal_clk;
161 unsigned long tmp; 165 unsigned long tmp;
166 unsigned long xtal;
162 unsigned long fclk; 167 unsigned long fclk;
163 unsigned long hclk; 168 unsigned long hclk;
164 unsigned long pclk; 169 unsigned long pclk;
165 170
171 xtal_clk = clk_get(NULL, "xtal");
172 xtal = clk_get_rate(xtal_clk);
173 clk_put(xtal_clk);
174
166 /* now we've got our machine bits initialised, work out what 175 /* now we've got our machine bits initialised, work out what
167 * clocks we've got */ 176 * clocks we've got */
168 177
169 fclk = s3c2410_get_pll(__raw_readl(S3C2410_MPLLCON), xtal*2); 178 fclk = s3c24xx_get_pll(__raw_readl(S3C2410_MPLLCON), xtal * 2);
170 179
171 clk_mpll.rate = fclk; 180 clk_mpll.rate = fclk;
172 181
@@ -183,11 +192,17 @@ void __init s3c2412_init_clocks(int xtal)
183 printk("S3C2412: core %ld.%03ld MHz, memory %ld.%03ld MHz, peripheral %ld.%03ld MHz\n", 192 printk("S3C2412: core %ld.%03ld MHz, memory %ld.%03ld MHz, peripheral %ld.%03ld MHz\n",
184 print_mhz(fclk), print_mhz(hclk), print_mhz(pclk)); 193 print_mhz(fclk), print_mhz(hclk), print_mhz(pclk));
185 194
195 s3c24xx_setup_clocks(fclk, hclk, pclk);
196}
197
198void __init s3c2412_init_clocks(int xtal)
199{
186 /* initialise the clocks here, to allow other things like the 200 /* initialise the clocks here, to allow other things like the
187 * console to use them 201 * console to use them
188 */ 202 */
189 203
190 s3c24xx_setup_clocks(xtal, fclk, hclk, pclk); 204 s3c24xx_register_baseclocks(xtal);
205 s3c2412_setup_clocks();
191 s3c2412_baseclk_add(); 206 s3c2412_baseclk_add();
192} 207}
193 208
diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig
index 25de042ab996..cde5ae9a4340 100644
--- a/arch/arm/mach-s3c2440/Kconfig
+++ b/arch/arm/mach-s3c2440/Kconfig
@@ -7,6 +7,7 @@
7config CPU_S3C2440 7config CPU_S3C2440
8 bool 8 bool
9 depends on ARCH_S3C2410 9 depends on ARCH_S3C2410
10 select CPU_ARM920T
10 select S3C2410_CLOCK 11 select S3C2410_CLOCK
11 select S3C2410_PM if PM 12 select S3C2410_PM if PM
12 select S3C2410_GPIO 13 select S3C2410_GPIO
@@ -28,8 +29,10 @@ menu "S3C2440 Machines"
28config MACH_ANUBIS 29config MACH_ANUBIS
29 bool "Simtec Electronics ANUBIS" 30 bool "Simtec Electronics ANUBIS"
30 select CPU_S3C2440 31 select CPU_S3C2440
32 select S3C24XX_DCLK
31 select PM_SIMTEC if PM 33 select PM_SIMTEC if PM
32 select HAVE_PATA_PLATFORM 34 select HAVE_PATA_PLATFORM
35 select S3C24XX_GPIO_EXTRA64
33 help 36 help
34 Say Y here if you are using the Simtec Electronics ANUBIS 37 Say Y here if you are using the Simtec Electronics ANUBIS
35 development system 38 development system
@@ -37,7 +40,9 @@ config MACH_ANUBIS
37config MACH_OSIRIS 40config MACH_OSIRIS
38 bool "Simtec IM2440D20 (OSIRIS) module" 41 bool "Simtec IM2440D20 (OSIRIS) module"
39 select CPU_S3C2440 42 select CPU_S3C2440
43 select S3C24XX_DCLK
40 select PM_SIMTEC if PM 44 select PM_SIMTEC if PM
45 select S3C24XX_GPIO_EXTRA128
41 help 46 help
42 Say Y here if you are using the Simtec IM2440D20 module, also 47 Say Y here if you are using the Simtec IM2440D20 module, also
43 known as the Osiris. 48 known as the Osiris.
diff --git a/arch/arm/mach-s3c2440/dma.c b/arch/arm/mach-s3c2440/dma.c
index 32303f6a8321..5b5ee0b8f4e0 100644
--- a/arch/arm/mach-s3c2440/dma.c
+++ b/arch/arm/mach-s3c2440/dma.c
@@ -17,7 +17,6 @@
17#include <linux/sysdev.h> 17#include <linux/sysdev.h>
18#include <linux/serial_core.h> 18#include <linux/serial_core.h>
19 19
20#include <asm/dma.h>
21#include <mach/dma.h> 20#include <mach/dma.h>
22 21
23#include <plat/dma.h> 22#include <plat/dma.h>
@@ -25,12 +24,12 @@
25 24
26#include <plat/regs-serial.h> 25#include <plat/regs-serial.h>
27#include <mach/regs-gpio.h> 26#include <mach/regs-gpio.h>
28#include <asm/plat-s3c/regs-ac97.h> 27#include <plat/regs-ac97.h>
29#include <mach/regs-mem.h> 28#include <mach/regs-mem.h>
30#include <mach/regs-lcd.h> 29#include <mach/regs-lcd.h>
31#include <mach/regs-sdi.h> 30#include <mach/regs-sdi.h>
32#include <asm/plat-s3c24xx/regs-iis.h> 31#include <asm/plat-s3c24xx/regs-iis.h>
33#include <asm/plat-s3c24xx/regs-spi.h> 32#include <plat/regs-spi.h>
34 33
35static struct s3c24xx_dma_map __initdata s3c2440_dma_mappings[] = { 34static struct s3c24xx_dma_map __initdata s3c2440_dma_mappings[] = {
36 [DMACH_XD0] = { 35 [DMACH_XD0] = {
diff --git a/arch/arm/mach-s3c2440/mach-anubis.c b/arch/arm/mach-s3c2440/mach-anubis.c
index e2beca470484..b05d56e230a1 100644
--- a/arch/arm/mach-s3c2440/mach-anubis.c
+++ b/arch/arm/mach-s3c2440/mach-anubis.c
@@ -39,7 +39,8 @@
39#include <mach/regs-gpio.h> 39#include <mach/regs-gpio.h>
40#include <mach/regs-mem.h> 40#include <mach/regs-mem.h>
41#include <mach/regs-lcd.h> 41#include <mach/regs-lcd.h>
42#include <asm/plat-s3c/nand.h> 42#include <plat/nand.h>
43#include <plat/iic.h>
43 44
44#include <linux/mtd/mtd.h> 45#include <linux/mtd/mtd.h>
45#include <linux/mtd/nand.h> 46#include <linux/mtd/nand.h>
@@ -366,6 +367,8 @@ static struct sm501_initdata anubis_sm501_initdata = {
366 .mask = 0, 367 .mask = 0,
367 }, 368 },
368 369
370 .devices = SM501_USE_GPIO,
371
369 /* set the SDRAM and bus clocks */ 372 /* set the SDRAM and bus clocks */
370 .mclk = 72 * MHZ, 373 .mclk = 72 * MHZ,
371 .m1xclk = 144 * MHZ, 374 .m1xclk = 144 * MHZ,
@@ -373,10 +376,12 @@ static struct sm501_initdata anubis_sm501_initdata = {
373 376
374static struct sm501_platdata_gpio_i2c anubis_sm501_gpio_i2c[] = { 377static struct sm501_platdata_gpio_i2c anubis_sm501_gpio_i2c[] = {
375 [0] = { 378 [0] = {
379 .bus_num = 1,
376 .pin_scl = 44, 380 .pin_scl = 44,
377 .pin_sda = 45, 381 .pin_sda = 45,
378 }, 382 },
379 [1] = { 383 [1] = {
384 .bus_num = 2,
380 .pin_scl = 40, 385 .pin_scl = 40,
381 .pin_sda = 41, 386 .pin_sda = 41,
382 }, 387 },
@@ -384,6 +389,7 @@ static struct sm501_platdata_gpio_i2c anubis_sm501_gpio_i2c[] = {
384 389
385static struct sm501_platdata anubis_sm501_platdata = { 390static struct sm501_platdata anubis_sm501_platdata = {
386 .init = &anubis_sm501_initdata, 391 .init = &anubis_sm501_initdata,
392 .gpio_base = -1,
387 .gpio_i2c = anubis_sm501_gpio_i2c, 393 .gpio_i2c = anubis_sm501_gpio_i2c,
388 .gpio_i2c_nr = ARRAY_SIZE(anubis_sm501_gpio_i2c), 394 .gpio_i2c_nr = ARRAY_SIZE(anubis_sm501_gpio_i2c),
389}; 395};
@@ -404,7 +410,7 @@ static struct platform_device *anubis_devices[] __initdata = {
404 &s3c_device_usb, 410 &s3c_device_usb,
405 &s3c_device_wdt, 411 &s3c_device_wdt,
406 &s3c_device_adc, 412 &s3c_device_adc,
407 &s3c_device_i2c, 413 &s3c_device_i2c0,
408 &s3c_device_rtc, 414 &s3c_device_rtc,
409 &s3c_device_nand, 415 &s3c_device_nand,
410 &anubis_device_ide0, 416 &anubis_device_ide0,
@@ -468,6 +474,7 @@ static void __init anubis_map_io(void)
468 474
469static void __init anubis_init(void) 475static void __init anubis_init(void)
470{ 476{
477 s3c_i2c0_set_platdata(NULL);
471 platform_add_devices(anubis_devices, ARRAY_SIZE(anubis_devices)); 478 platform_add_devices(anubis_devices, ARRAY_SIZE(anubis_devices));
472 479
473 i2c_register_board_info(0, anubis_i2c_devs, 480 i2c_register_board_info(0, anubis_i2c_devs,
diff --git a/arch/arm/mach-s3c2440/mach-at2440evb.c b/arch/arm/mach-s3c2440/mach-at2440evb.c
index 66876c6f2f1c..0a6d0a5d961b 100644
--- a/arch/arm/mach-s3c2440/mach-at2440evb.c
+++ b/arch/arm/mach-s3c2440/mach-at2440evb.c
@@ -28,6 +28,7 @@
28#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
29 29
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31#include <mach/fb.h>
31#include <asm/irq.h> 32#include <asm/irq.h>
32#include <asm/mach-types.h> 33#include <asm/mach-types.h>
33 34
@@ -35,7 +36,8 @@
35#include <mach/regs-gpio.h> 36#include <mach/regs-gpio.h>
36#include <mach/regs-mem.h> 37#include <mach/regs-mem.h>
37#include <mach/regs-lcd.h> 38#include <mach/regs-lcd.h>
38#include <asm/plat-s3c/nand.h> 39#include <plat/nand.h>
40#include <plat/iic.h>
39 41
40#include <linux/mtd/mtd.h> 42#include <linux/mtd/mtd.h>
41#include <linux/mtd/nand.h> 43#include <linux/mtd/nand.h>
@@ -45,6 +47,7 @@
45#include <plat/clock.h> 47#include <plat/clock.h>
46#include <plat/devs.h> 48#include <plat/devs.h>
47#include <plat/cpu.h> 49#include <plat/cpu.h>
50#include <asm/plat-s3c24xx/mci.h>
48 51
49static struct map_desc at2440evb_iodesc[] __initdata = { 52static struct map_desc at2440evb_iodesc[] __initdata = {
50 /* Nothing here */ 53 /* Nothing here */
@@ -162,19 +165,60 @@ static struct platform_device at2440evb_device_eth = {
162 }, 165 },
163}; 166};
164 167
168static struct s3c24xx_mci_pdata at2440evb_mci_pdata = {
169 .gpio_detect = S3C2410_GPG10,
170};
171
172/* 7" LCD panel */
173
174static struct s3c2410fb_display at2440evb_lcd_cfg __initdata = {
175
176 .lcdcon5 = S3C2410_LCDCON5_FRM565 |
177 S3C2410_LCDCON5_INVVLINE |
178 S3C2410_LCDCON5_INVVFRAME |
179 S3C2410_LCDCON5_PWREN |
180 S3C2410_LCDCON5_HWSWP,
181
182 .type = S3C2410_LCDCON1_TFT,
183
184 .width = 800,
185 .height = 480,
186
187 .pixclock = 33333, /* HCLK 60 MHz, divisor 2 */
188 .xres = 800,
189 .yres = 480,
190 .bpp = 16,
191 .left_margin = 88,
192 .right_margin = 40,
193 .hsync_len = 128,
194 .upper_margin = 32,
195 .lower_margin = 11,
196 .vsync_len = 2,
197};
198
199static struct s3c2410fb_mach_info at2440evb_fb_info __initdata = {
200 .displays = &at2440evb_lcd_cfg,
201 .num_displays = 1,
202 .default_display = 0,
203};
204
165static struct platform_device *at2440evb_devices[] __initdata = { 205static struct platform_device *at2440evb_devices[] __initdata = {
166 &s3c_device_usb, 206 &s3c_device_usb,
167 &s3c_device_wdt, 207 &s3c_device_wdt,
168 &s3c_device_adc, 208 &s3c_device_adc,
169 &s3c_device_i2c, 209 &s3c_device_i2c0,
170 &s3c_device_rtc, 210 &s3c_device_rtc,
171 &s3c_device_nand, 211 &s3c_device_nand,
212 &s3c_device_sdi,
213 &s3c_device_lcd,
172 &at2440evb_device_eth, 214 &at2440evb_device_eth,
173}; 215};
174 216
175static void __init at2440evb_map_io(void) 217static void __init at2440evb_map_io(void)
176{ 218{
177 s3c_device_nand.dev.platform_data = &at2440evb_nand_info; 219 s3c_device_nand.dev.platform_data = &at2440evb_nand_info;
220 s3c_device_sdi.name = "s3c2440-sdi";
221 s3c_device_sdi.dev.platform_data = &at2440evb_mci_pdata;
178 222
179 s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc)); 223 s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc));
180 s3c24xx_init_clocks(16934400); 224 s3c24xx_init_clocks(16934400);
@@ -183,6 +227,9 @@ static void __init at2440evb_map_io(void)
183 227
184static void __init at2440evb_init(void) 228static void __init at2440evb_init(void)
185{ 229{
230 s3c24xx_fb_set_platdata(&at2440evb_fb_info);
231 s3c_i2c0_set_platdata(NULL);
232
186 platform_add_devices(at2440evb_devices, ARRAY_SIZE(at2440evb_devices)); 233 platform_add_devices(at2440evb_devices, ARRAY_SIZE(at2440evb_devices));
187} 234}
188 235
diff --git a/arch/arm/mach-s3c2440/mach-nexcoder.c b/arch/arm/mach-s3c2440/mach-nexcoder.c
index a546307fd53d..7aeaa972d7f5 100644
--- a/arch/arm/mach-s3c2440/mach-nexcoder.c
+++ b/arch/arm/mach-s3c2440/mach-nexcoder.c
@@ -37,6 +37,7 @@
37//#include <asm/debug-ll.h> 37//#include <asm/debug-ll.h>
38#include <mach/regs-gpio.h> 38#include <mach/regs-gpio.h>
39#include <plat/regs-serial.h> 39#include <plat/regs-serial.h>
40#include <plat/iic.h>
40 41
41#include <plat/s3c2410.h> 42#include <plat/s3c2410.h>
42#include <plat/s3c2440.h> 43#include <plat/s3c2440.h>
@@ -107,7 +108,7 @@ static struct platform_device *nexcoder_devices[] __initdata = {
107 &s3c_device_usb, 108 &s3c_device_usb,
108 &s3c_device_lcd, 109 &s3c_device_lcd,
109 &s3c_device_wdt, 110 &s3c_device_wdt,
110 &s3c_device_i2c, 111 &s3c_device_i2c0,
111 &s3c_device_iis, 112 &s3c_device_iis,
112 &s3c_device_rtc, 113 &s3c_device_rtc,
113 &s3c_device_camif, 114 &s3c_device_camif,
@@ -142,6 +143,7 @@ static void __init nexcoder_map_io(void)
142 143
143static void __init nexcoder_init(void) 144static void __init nexcoder_init(void)
144{ 145{
146 s3c_i2c0_set_platdata(NULL);
145 platform_add_devices(nexcoder_devices, ARRAY_SIZE(nexcoder_devices)); 147 platform_add_devices(nexcoder_devices, ARRAY_SIZE(nexcoder_devices));
146}; 148};
147 149
diff --git a/arch/arm/mach-s3c2440/mach-osiris.c b/arch/arm/mach-s3c2440/mach-osiris.c
index 2361d606abc5..41a00f57e5da 100644
--- a/arch/arm/mach-s3c2440/mach-osiris.c
+++ b/arch/arm/mach-s3c2440/mach-osiris.c
@@ -37,7 +37,8 @@
37#include <mach/regs-gpio.h> 37#include <mach/regs-gpio.h>
38#include <mach/regs-mem.h> 38#include <mach/regs-mem.h>
39#include <mach/regs-lcd.h> 39#include <mach/regs-lcd.h>
40#include <asm/plat-s3c/nand.h> 40#include <plat/nand.h>
41#include <plat/iic.h>
41 42
42#include <linux/mtd/mtd.h> 43#include <linux/mtd/mtd.h>
43#include <linux/mtd/nand.h> 44#include <linux/mtd/nand.h>
@@ -335,7 +336,7 @@ static struct i2c_board_info osiris_i2c_devs[] __initdata = {
335/* Standard Osiris devices */ 336/* Standard Osiris devices */
336 337
337static struct platform_device *osiris_devices[] __initdata = { 338static struct platform_device *osiris_devices[] __initdata = {
338 &s3c_device_i2c, 339 &s3c_device_i2c0,
339 &s3c_device_wdt, 340 &s3c_device_wdt,
340 &s3c_device_nand, 341 &s3c_device_nand,
341 &osiris_pcmcia, 342 &osiris_pcmcia,
@@ -398,6 +399,8 @@ static void __init osiris_init(void)
398 sysdev_class_register(&osiris_pm_sysclass); 399 sysdev_class_register(&osiris_pm_sysclass);
399 sysdev_register(&osiris_pm_sysdev); 400 sysdev_register(&osiris_pm_sysdev);
400 401
402 s3c_i2c0_set_platdata(NULL);
403
401 i2c_register_board_info(0, osiris_i2c_devs, 404 i2c_register_board_info(0, osiris_i2c_devs,
402 ARRAY_SIZE(osiris_i2c_devs)); 405 ARRAY_SIZE(osiris_i2c_devs));
403 406
diff --git a/arch/arm/mach-s3c2440/mach-rx3715.c b/arch/arm/mach-s3c2440/mach-rx3715.c
index 4d14c7cff892..12d378f84ad2 100644
--- a/arch/arm/mach-s3c2440/mach-rx3715.c
+++ b/arch/arm/mach-s3c2440/mach-rx3715.c
@@ -42,7 +42,7 @@
42#include <mach/regs-lcd.h> 42#include <mach/regs-lcd.h>
43 43
44#include <mach/h1940.h> 44#include <mach/h1940.h>
45#include <asm/plat-s3c/nand.h> 45#include <plat/nand.h>
46#include <mach/fb.h> 46#include <mach/fb.h>
47 47
48#include <plat/clock.h> 48#include <plat/clock.h>
@@ -179,7 +179,7 @@ static struct platform_device *rx3715_devices[] __initdata = {
179 &s3c_device_usb, 179 &s3c_device_usb,
180 &s3c_device_lcd, 180 &s3c_device_lcd,
181 &s3c_device_wdt, 181 &s3c_device_wdt,
182 &s3c_device_i2c, 182 &s3c_device_i2c0,
183 &s3c_device_iis, 183 &s3c_device_iis,
184 &s3c_device_nand, 184 &s3c_device_nand,
185}; 185};
diff --git a/arch/arm/mach-s3c2440/mach-smdk2440.c b/arch/arm/mach-s3c2440/mach-smdk2440.c
index fefeaaa4155f..db6eafbd4d90 100644
--- a/arch/arm/mach-s3c2440/mach-smdk2440.c
+++ b/arch/arm/mach-s3c2440/mach-smdk2440.c
@@ -37,6 +37,7 @@
37 37
38#include <mach/idle.h> 38#include <mach/idle.h>
39#include <mach/fb.h> 39#include <mach/fb.h>
40#include <plat/iic.h>
40 41
41#include <plat/s3c2410.h> 42#include <plat/s3c2410.h>
42#include <plat/s3c2440.h> 43#include <plat/s3c2440.h>
@@ -152,7 +153,7 @@ static struct platform_device *smdk2440_devices[] __initdata = {
152 &s3c_device_usb, 153 &s3c_device_usb,
153 &s3c_device_lcd, 154 &s3c_device_lcd,
154 &s3c_device_wdt, 155 &s3c_device_wdt,
155 &s3c_device_i2c, 156 &s3c_device_i2c0,
156 &s3c_device_iis, 157 &s3c_device_iis,
157}; 158};
158 159
@@ -166,6 +167,7 @@ static void __init smdk2440_map_io(void)
166static void __init smdk2440_machine_init(void) 167static void __init smdk2440_machine_init(void)
167{ 168{
168 s3c24xx_fb_set_platdata(&smdk2440_fb_info); 169 s3c24xx_fb_set_platdata(&smdk2440_fb_info);
170 s3c_i2c0_set_platdata(NULL);
169 171
170 platform_add_devices(smdk2440_devices, ARRAY_SIZE(smdk2440_devices)); 172 platform_add_devices(smdk2440_devices, ARRAY_SIZE(smdk2440_devices));
171 smdk_machine_init(); 173 smdk_machine_init();
diff --git a/arch/arm/mach-s3c2442/Kconfig b/arch/arm/mach-s3c2442/Kconfig
index 26d131a77074..b289d198020e 100644
--- a/arch/arm/mach-s3c2442/Kconfig
+++ b/arch/arm/mach-s3c2442/Kconfig
@@ -7,6 +7,7 @@
7config CPU_S3C2442 7config CPU_S3C2442
8 bool 8 bool
9 depends on ARCH_S3C2410 9 depends on ARCH_S3C2410
10 select CPU_ARM920T
10 select S3C2410_CLOCK 11 select S3C2410_CLOCK
11 select S3C2410_GPIO 12 select S3C2410_GPIO
12 select S3C2410_PM if PM 13 select S3C2410_PM if PM
diff --git a/arch/arm/mach-s3c2443/Kconfig b/arch/arm/mach-s3c2443/Kconfig
index 14252f573754..212141baebec 100644
--- a/arch/arm/mach-s3c2443/Kconfig
+++ b/arch/arm/mach-s3c2443/Kconfig
@@ -24,6 +24,7 @@ config MACH_SMDK2443
24 bool "SMDK2443" 24 bool "SMDK2443"
25 select CPU_S3C2443 25 select CPU_S3C2443
26 select MACH_SMDK 26 select MACH_SMDK
27 select S3C_DEV_HSMMC
27 help 28 help
28 Say Y here if you are using an SMDK2443 29 Say Y here if you are using an SMDK2443
29 30
diff --git a/arch/arm/mach-s3c2443/clock.c b/arch/arm/mach-s3c2443/clock.c
index f854e7385e3c..2785d69c95b0 100644
--- a/arch/arm/mach-s3c2443/clock.c
+++ b/arch/arm/mach-s3c2443/clock.c
@@ -29,7 +29,6 @@
29#include <linux/sysdev.h> 29#include <linux/sysdev.h>
30#include <linux/clk.h> 30#include <linux/clk.h>
31#include <linux/mutex.h> 31#include <linux/mutex.h>
32#include <linux/delay.h>
33#include <linux/serial_core.h> 32#include <linux/serial_core.h>
34#include <linux/io.h> 33#include <linux/io.h>
35 34
@@ -39,6 +38,8 @@
39 38
40#include <mach/regs-s3c2443-clock.h> 39#include <mach/regs-s3c2443-clock.h>
41 40
41#include <plat/cpu-freq.h>
42
42#include <plat/s3c2443.h> 43#include <plat/s3c2443.h>
43#include <plat/clock.h> 44#include <plat/clock.h>
44#include <plat/cpu.h> 45#include <plat/cpu.h>
@@ -145,12 +146,6 @@ static unsigned long s3c2443_roundrate_clksrc256(struct clk *clk,
145 146
146/* clock selections */ 147/* clock selections */
147 148
148/* CPU EXTCLK input */
149static struct clk clk_ext = {
150 .name = "ext",
151 .id = -1,
152};
153
154static struct clk clk_mpllref = { 149static struct clk clk_mpllref = {
155 .name = "mpllref", 150 .name = "mpllref",
156 .parent = &clk_xtal, 151 .parent = &clk_xtal,
@@ -165,14 +160,6 @@ static struct clk clk_mpll = {
165}; 160};
166#endif 161#endif
167 162
168static struct clk clk_epllref;
169
170static struct clk clk_epll = {
171 .name = "epll",
172 .parent = &clk_epllref,
173 .id = -1,
174};
175
176static struct clk clk_i2s_ext = { 163static struct clk clk_i2s_ext = {
177 .name = "i2s-ext", 164 .name = "i2s-ext",
178 .id = -1, 165 .id = -1,
@@ -1011,22 +998,20 @@ static struct clk *clks[] __initdata = {
1011 &clk_prediv, 998 &clk_prediv,
1012}; 999};
1013 1000
1014void __init s3c2443_init_clocks(int xtal) 1001void __init_or_cpufreq s3c2443_setup_clocks(void)
1015{ 1002{
1016 unsigned long epllcon = __raw_readl(S3C2443_EPLLCON);
1017 unsigned long mpllcon = __raw_readl(S3C2443_MPLLCON); 1003 unsigned long mpllcon = __raw_readl(S3C2443_MPLLCON);
1018 unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0); 1004 unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
1005 struct clk *xtal_clk;
1006 unsigned long xtal;
1019 unsigned long pll; 1007 unsigned long pll;
1020 unsigned long fclk; 1008 unsigned long fclk;
1021 unsigned long hclk; 1009 unsigned long hclk;
1022 unsigned long pclk; 1010 unsigned long pclk;
1023 struct clk *clkp;
1024 int ret;
1025 int ptr;
1026 1011
1027 /* s3c2443 parents h and p clocks from prediv */ 1012 xtal_clk = clk_get(NULL, "xtal");
1028 clk_h.parent = &clk_prediv; 1013 xtal = clk_get_rate(xtal_clk);
1029 clk_p.parent = &clk_prediv; 1014 clk_put(xtal_clk);
1030 1015
1031 pll = s3c2443_get_mpll(mpllcon, xtal); 1016 pll = s3c2443_get_mpll(mpllcon, xtal);
1032 clk_msysclk.rate = pll; 1017 clk_msysclk.rate = pll;
@@ -1036,13 +1021,29 @@ void __init s3c2443_init_clocks(int xtal)
1036 hclk /= s3c2443_get_hdiv(clkdiv0); 1021 hclk /= s3c2443_get_hdiv(clkdiv0);
1037 pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1); 1022 pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1);
1038 1023
1039 s3c24xx_setup_clocks(xtal, fclk, hclk, pclk); 1024 s3c24xx_setup_clocks(fclk, hclk, pclk);
1040 1025
1041 printk("S3C2443: mpll %s %ld.%03ld MHz, cpu %ld.%03ld MHz, mem %ld.%03ld MHz, pclk %ld.%03ld MHz\n", 1026 printk("S3C2443: mpll %s %ld.%03ld MHz, cpu %ld.%03ld MHz, mem %ld.%03ld MHz, pclk %ld.%03ld MHz\n",
1042 (mpllcon & S3C2443_PLLCON_OFF) ? "off":"on", 1027 (mpllcon & S3C2443_PLLCON_OFF) ? "off":"on",
1043 print_mhz(pll), print_mhz(fclk), 1028 print_mhz(pll), print_mhz(fclk),
1044 print_mhz(hclk), print_mhz(pclk)); 1029 print_mhz(hclk), print_mhz(pclk));
1045 1030
1031 s3c24xx_setup_clocks(fclk, hclk, pclk);
1032}
1033
1034void __init s3c2443_init_clocks(int xtal)
1035{
1036 struct clk *clkp;
1037 unsigned long epllcon = __raw_readl(S3C2443_EPLLCON);
1038 int ret;
1039 int ptr;
1040
1041 /* s3c2443 parents h and p clocks from prediv */
1042 clk_h.parent = &clk_prediv;
1043 clk_p.parent = &clk_prediv;
1044
1045 s3c24xx_register_baseclocks(xtal);
1046 s3c2443_setup_clocks();
1046 s3c2443_clk_initparents(); 1047 s3c2443_clk_initparents();
1047 1048
1048 for (ptr = 0; ptr < ARRAY_SIZE(clks); ptr++) { 1049 for (ptr = 0; ptr < ARRAY_SIZE(clks); ptr++) {
@@ -1056,7 +1057,7 @@ void __init s3c2443_init_clocks(int xtal)
1056 } 1057 }
1057 1058
1058 clk_epll.rate = s3c2443_get_epll(epllcon, xtal); 1059 clk_epll.rate = s3c2443_get_epll(epllcon, xtal);
1059 1060 clk_epll.parent = &clk_epllref;
1060 clk_usb_bus.parent = &clk_usb_bus_host; 1061 clk_usb_bus.parent = &clk_usb_bus_host;
1061 1062
1062 /* ensure usb bus clock is within correct rate of 48MHz */ 1063 /* ensure usb bus clock is within correct rate of 48MHz */
@@ -1105,4 +1106,6 @@ void __init s3c2443_init_clocks(int xtal)
1105 1106
1106 (clkp->enable)(clkp, 0); 1107 (clkp->enable)(clkp, 0);
1107 } 1108 }
1109
1110 s3c_pwmclk_init();
1108} 1111}
diff --git a/arch/arm/mach-s3c2443/dma.c b/arch/arm/mach-s3c2443/dma.c
index f73ccb25ff94..2a58a4d5aa5a 100644
--- a/arch/arm/mach-s3c2443/dma.c
+++ b/arch/arm/mach-s3c2443/dma.c
@@ -18,7 +18,6 @@
18#include <linux/serial_core.h> 18#include <linux/serial_core.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20
21#include <asm/dma.h>
22#include <mach/dma.h> 21#include <mach/dma.h>
23 22
24#include <plat/dma.h> 23#include <plat/dma.h>
@@ -26,12 +25,12 @@
26 25
27#include <plat/regs-serial.h> 26#include <plat/regs-serial.h>
28#include <mach/regs-gpio.h> 27#include <mach/regs-gpio.h>
29#include <asm/plat-s3c/regs-ac97.h> 28#include <plat/regs-ac97.h>
30#include <mach/regs-mem.h> 29#include <mach/regs-mem.h>
31#include <mach/regs-lcd.h> 30#include <mach/regs-lcd.h>
32#include <mach/regs-sdi.h> 31#include <mach/regs-sdi.h>
33#include <asm/plat-s3c24xx/regs-iis.h> 32#include <asm/plat-s3c24xx/regs-iis.h>
34#include <asm/plat-s3c24xx/regs-spi.h> 33#include <plat/regs-spi.h>
35 34
36#define MAP(x) { \ 35#define MAP(x) { \
37 [0] = (x) | DMA_CH_VALID, \ 36 [0] = (x) | DMA_CH_VALID, \
diff --git a/arch/arm/mach-s3c2443/mach-smdk2443.c b/arch/arm/mach-s3c2443/mach-smdk2443.c
index a7fe65f3dcc1..039a46243105 100644
--- a/arch/arm/mach-s3c2443/mach-smdk2443.c
+++ b/arch/arm/mach-s3c2443/mach-smdk2443.c
@@ -37,6 +37,7 @@
37 37
38#include <mach/idle.h> 38#include <mach/idle.h>
39#include <mach/fb.h> 39#include <mach/fb.h>
40#include <plat/iic.h>
40 41
41#include <plat/s3c2410.h> 42#include <plat/s3c2410.h>
42#include <plat/s3c2440.h> 43#include <plat/s3c2440.h>
@@ -103,8 +104,8 @@ static struct s3c2410_uartcfg smdk2443_uartcfgs[] __initdata = {
103 104
104static struct platform_device *smdk2443_devices[] __initdata = { 105static struct platform_device *smdk2443_devices[] __initdata = {
105 &s3c_device_wdt, 106 &s3c_device_wdt,
106 &s3c_device_i2c, 107 &s3c_device_i2c0,
107 &s3c_device_hsmmc, 108 &s3c_device_hsmmc0,
108}; 109};
109 110
110static void __init smdk2443_map_io(void) 111static void __init smdk2443_map_io(void)
@@ -116,6 +117,7 @@ static void __init smdk2443_map_io(void)
116 117
117static void __init smdk2443_machine_init(void) 118static void __init smdk2443_machine_init(void)
118{ 119{
120 s3c_i2c0_set_platdata(NULL);
119 platform_add_devices(smdk2443_devices, ARRAY_SIZE(smdk2443_devices)); 121 platform_add_devices(smdk2443_devices, ARRAY_SIZE(smdk2443_devices));
120 smdk_machine_init(); 122 smdk_machine_init();
121} 123}
diff --git a/arch/arm/mach-s3c2443/s3c2443.c b/arch/arm/mach-s3c2443/s3c2443.c
index bbeddf9ddcb1..ce2ec3298930 100644
--- a/arch/arm/mach-s3c2443/s3c2443.c
+++ b/arch/arm/mach-s3c2443/s3c2443.c
@@ -81,10 +81,9 @@ void __init s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no)
81 * machine specific initialisation. 81 * machine specific initialisation.
82 */ 82 */
83 83
84void __init s3c2443_map_io(struct map_desc *mach_desc, int mach_size) 84void __init s3c2443_map_io(void)
85{ 85{
86 iotable_init(s3c2443_iodesc, ARRAY_SIZE(s3c2443_iodesc)); 86 iotable_init(s3c2443_iodesc, ARRAY_SIZE(s3c2443_iodesc));
87 iotable_init(mach_desc, mach_size);
88} 87}
89 88
90/* need to register class before we actually register the device, and 89/* need to register class before we actually register the device, and
diff --git a/arch/arm/mach-s3c24a0/include/mach/debug-macro.S b/arch/arm/mach-s3c24a0/include/mach/debug-macro.S
new file mode 100644
index 000000000000..f0ef0ab475f6
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/debug-macro.S
@@ -0,0 +1,28 @@
1/* arch/arm/mach-s3c2410/include/mach/debug-macro.S
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 as
5 * published by the Free Software Foundation.
6*/
7
8/* pull in the relevant register and map files. */
9
10#include <mach/map.h>
11#include <plat/regs-serial.h>
12
13 .macro addruart, rx
14 mrc p15, 0, \rx, c1, c0
15 tst \rx, #1
16 ldreq \rx, = S3C24XX_PA_UART
17 ldrne \rx, = S3C24XX_VA_UART
18#if CONFIG_DEBUG_S3C_UART != 0
19 add \rx, \rx, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C_UART)
20#endif
21 .endm
22
23/* include the reset of the code which will do the work, we're only
24 * compiling for a single cpu processor type so the default of s3c2440
25 * will be fine with us.
26 */
27
28#include <plat/debug-macro.S>
diff --git a/arch/arm/mach-s3c24a0/include/mach/irqs.h b/arch/arm/mach-s3c24a0/include/mach/irqs.h
new file mode 100644
index 000000000000..ae8c0e359783
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/irqs.h
@@ -0,0 +1,115 @@
1/* linux/arch/arm/mach-s3c24a0/include/mach/irqs.h
2 *
3 * Copyright (c) 2003-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11
12#ifndef __ASM_ARCH_24A0_IRQS_H
13#define __ASM_ARCH_24A0_IRQS_H __FILE__
14
15#define IRQ_EINT0t2 S3C2410_IRQ(0) /* 16 */
16/* for generic entry-macro.S */
17#define IRQ_EINT0 IRQ_EINT0t2
18
19#define IRQ_EINT3t6 S3C2410_IRQ(1)
20#define IRQ_EINT7t10 S3C2410_IRQ(2)
21#define IRQ_EINT11t14 S3C2410_IRQ(3)
22#define IRQ_EINT15t18 S3C2410_IRQ(4) /* 20 */
23#define IRQ_TICK S3C2410_IRQ(5)
24#define IRQ_DCTQ S3C2410_IRQ(6)
25#define IRQ_MC S3C2410_IRQ(7)
26#define IRQ_ME S3C2410_IRQ(8) /* 24 */
27#define IRQ_KEYPAD S3C2410_IRQ(9)
28#define IRQ_TIMER0 S3C2410_IRQ(10)
29#define IRQ_TIMER1 S3C2410_IRQ(11)
30#define IRQ_TIMER2 S3C2410_IRQ(12)
31#define IRQ_TIMER3_4 S3C2410_IRQ(13)
32#define IRQ_OS_TIMER IRQ_TIMER3_4
33#define IRQ_LCD S3C2410_IRQ(14)
34#define IRQ_CAM_C S3C2410_IRQ(15)
35#define IRQ_WDT_BATFLT S3C2410_IRQ(16) /* 32 */
36#define IRQ_UART0 S3C2410_IRQ(17)
37#define IRQ_CAM_P S3C2410_IRQ(18)
38#define IRQ_MODEM S3C2410_IRQ(19)
39#define IRQ_DMA S3C2410_IRQ(20)
40#define IRQ_SDI S3C2410_IRQ(21)
41#define IRQ_SPI0 S3C2410_IRQ(22)
42#define IRQ_UART1 S3C2410_IRQ(23)
43#define IRQ_AC97_NFLASH S3C2410_IRQ(24) /* 40 */
44#define IRQ_USBD S3C2410_IRQ(25)
45#define IRQ_USBH S3C2410_IRQ(26)
46#define IRQ_IIC S3C2410_IRQ(27)
47#define IRQ_IRDA_MSTICK S3C2410_IRQ(28) /* 44 */
48#define IRQ_VLX_SPI1 S3C2410_IRQ(29)
49#define IRQ_RTC S3C2410_IRQ(30) /* 46 */
50#define IRQ_ADC_PEN S3C2410_IRQ(31)
51
52/* interrupts generated from the external interrupts sources */
53#define IRQ_EINT00 S3C2410_IRQ(32) /* 48 */
54#define IRQ_EINT1 S3C2410_IRQ(33)
55#define IRQ_EINT2 S3C2410_IRQ(34)
56#define IRQ_EINT3 S3C2410_IRQ(35)
57#define IRQ_EINT4 S3C2410_IRQ(36)
58#define IRQ_EINT5 S3C2410_IRQ(37)
59#define IRQ_EINT6 S3C2410_IRQ(38)
60#define IRQ_EINT7 S3C2410_IRQ(39)
61#define IRQ_EINT8 S3C2410_IRQ(40)
62#define IRQ_EINT9 S3C2410_IRQ(41)
63#define IRQ_EINT10 S3C2410_IRQ(42)
64#define IRQ_EINT11 S3C2410_IRQ(43)
65#define IRQ_EINT12 S3C2410_IRQ(44)
66#define IRQ_EINT13 S3C2410_IRQ(45)
67#define IRQ_EINT14 S3C2410_IRQ(46)
68#define IRQ_EINT15 S3C2410_IRQ(47)
69#define IRQ_EINT16 S3C2410_IRQ(48)
70#define IRQ_EINT17 S3C2410_IRQ(49)
71#define IRQ_EINT18 S3C2410_IRQ(50)
72
73/* SUB IRQS */
74#define IRQ_S3CUART_RX0 S3C2410_IRQ(51) /* 67 */
75#define IRQ_S3CUART_TX0 S3C2410_IRQ(52)
76#define IRQ_S3CUART_ERR0 S3C2410_IRQ(53)
77
78#define IRQ_S3CUART_RX1 S3C2410_IRQ(54)
79#define IRQ_S3CUART_TX1 S3C2410_IRQ(55)
80#define IRQ_S3CUART_ERR1 S3C2410_IRQ(56)
81
82#define IRQ_S3CUART_RX2 (0x0)
83#define IRQ_S3CUART_TX2 (0x0)
84#define IRQ_S3CUART_ERR2 (0x0)
85
86
87#define IRQ_IRDA S3C2410_IRQ(57)
88#define IRQ_MSTICK S3C2410_IRQ(58)
89#define IRQ_RESERVED0 S3C2410_IRQ(59)
90#define IRQ_RESERVED1 S3C2410_IRQ(60)
91#define IRQ_RESERVED2 S3C2410_IRQ(61)
92#define IRQ_TIMER3 S3C2410_IRQ(62)
93#define IRQ_TIMER4 S3C2410_IRQ(63)
94#define IRQ_WDT S3C2410_IRQ(64)
95#define IRQ_BATFLT S3C2410_IRQ(65)
96#define IRQ_POST S3C2410_IRQ(66)
97#define IRQ_DISP_FIFO S3C2410_IRQ(67)
98#define IRQ_PENUP S3C2410_IRQ(68)
99#define IRQ_PENDN S3C2410_IRQ(69)
100#define IRQ_ADC S3C2410_IRQ(70)
101#define IRQ_DISP_FRAME S3C2410_IRQ(71)
102#define IRQ_NFLASH S3C2410_IRQ(72)
103#define IRQ_AC97 S3C2410_IRQ(73)
104#define IRQ_SPI1 S3C2410_IRQ(74)
105#define IRQ_VLX S3C2410_IRQ(75)
106#define IRQ_DMA0 S3C2410_IRQ(76)
107#define IRQ_DMA1 S3C2410_IRQ(77)
108#define IRQ_DMA2 S3C2410_IRQ(78)
109#define IRQ_DMA3 S3C2410_IRQ(79)
110
111#define IRQ_TC (0x0)
112
113#define NR_IRQS (IRQ_DMA3+1)
114
115#endif /* __ASM_ARCH_24A0_IRQS_H */
diff --git a/arch/arm/mach-s3c24a0/include/mach/map.h b/arch/arm/mach-s3c24a0/include/mach/map.h
new file mode 100644
index 000000000000..a01132717e34
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/map.h
@@ -0,0 +1,85 @@
1/* linux/arch/arm/mach-s3c24a0/include/mach/map.h
2 *
3 * Copyright 2003,2007 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C24A0 - Memory map definitions
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#ifndef __ASM_ARCH_24A0_MAP_H
15#define __ASM_ARCH_24A0_MAP_H __FILE__
16
17#include <plat/map-base.h>
18#include <plat/map.h>
19
20#define S3C24A0_PA_IO_BASE (0x40000000)
21#define S3C24A0_PA_CLKPWR (0x40000000)
22#define S3C24A0_PA_IRQ (0x40200000)
23#define S3C24A0_PA_DMA (0x40400000)
24#define S3C24A0_PA_MEMCTRL (0x40C00000)
25#define S3C24A0_PA_NAND (0x40C00000)
26#define S3C24A0_PA_SROM (0x40C20000)
27#define S3C24A0_PA_SDRAM (0x40C40000)
28#define S3C24A0_PA_BUSM (0x40CE0000)
29#define S3C24A0_PA_USBHOST (0x41000000)
30#define S3C24A0_PA_MODEMIF (0x41180000)
31#define S3C24A0_PA_IRDA (0x41800000)
32#define S3C24A0_PA_TIMER (0x44000000)
33#define S3C24A0_PA_WATCHDOG (0x44100000)
34#define S3C24A0_PA_RTC (0x44200000)
35#define S3C24A0_PA_UART (0x44400000)
36#define S3C24A0_PA_UART0 (S3C24A0_PA_UART)
37#define S3C24A0_PA_UART1 (S3C24A0_PA_UART + 0x4000)
38#define S3C24A0_PA_SPI (0x44500000)
39#define S3C24A0_PA_IIC (0x44600000)
40#define S3C24A0_PA_IIS (0x44700000)
41#define S3C24A0_PA_GPIO (0x44800000)
42#define S3C24A0_PA_KEYIF (0x44900000)
43#define S3C24A0_PA_USBDEV (0x44A00000)
44#define S3C24A0_PA_AC97 (0x45000000)
45#define S3C24A0_PA_ADC (0x45800000)
46#define S3C24A0_PA_SDI (0x46000000)
47#define S3C24A0_PA_MS (0x46100000)
48#define S3C24A0_PA_LCD (0x4A000000)
49#define S3C24A0_PA_VPOST (0x4A100000)
50
51/* physical addresses of all the chip-select areas */
52
53#define S3C24A0_CS0 (0x00000000)
54#define S3C24A0_CS1 (0x04000000)
55#define S3C24A0_CS2 (0x08000000)
56#define S3C24A0_CS3 (0x0C000000)
57#define S3C24A0_CS4 (0x10000000)
58#define S3C24A0_CS5 (0x40000000)
59
60#define S3C24A0_SDRAM_PA (S3C24A0_CS4)
61
62/* Use a single interface for common resources between S3C24XX cpus */
63
64#define S3C24XX_PA_IRQ S3C24A0_PA_IRQ
65#define S3C24XX_PA_MEMCTRL S3C24A0_PA_MEMCTRL
66#define S3C24XX_PA_USBHOST S3C24A0_PA_USBHOST
67#define S3C24XX_PA_DMA S3C24A0_PA_DMA
68#define S3C24XX_PA_CLKPWR S3C24A0_PA_CLKPWR
69#define S3C24XX_PA_LCD S3C24A0_PA_LCD
70#define S3C24XX_PA_UART S3C24A0_PA_UART
71#define S3C24XX_PA_TIMER S3C24A0_PA_TIMER
72#define S3C24XX_PA_USBDEV S3C24A0_PA_USBDEV
73#define S3C24XX_PA_WATCHDOG S3C24A0_PA_WATCHDOG
74#define S3C24XX_PA_IIS S3C24A0_PA_IIS
75#define S3C24XX_PA_GPIO S3C24A0_PA_GPIO
76#define S3C24XX_PA_RTC S3C24A0_PA_RTC
77#define S3C24XX_PA_ADC S3C24A0_PA_ADC
78#define S3C24XX_PA_SPI S3C24A0_PA_SPI
79#define S3C24XX_PA_SDI S3C24A0_PA_SDI
80#define S3C24XX_PA_NAND S3C24A0_PA_NAND
81
82#define S3C_PA_UART S3C24A0_PA_UART
83#define S3C_PA_IIC S3C24A0_PA_IIC
84
85#endif /* __ASM_ARCH_24A0_MAP_H */
diff --git a/arch/arm/mach-s3c24a0/include/mach/memory.h b/arch/arm/mach-s3c24a0/include/mach/memory.h
new file mode 100644
index 000000000000..585211ca0187
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/memory.h
@@ -0,0 +1,19 @@
1/* linux/arch/arm/mach-s3c24a0/include/mach/memory.h
2 * from linux/include/asm-arm/arch-rpc/memory.h
3 *
4 * Copyright (C) 1996,1997,1998 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#ifndef __ASM_ARCH_24A0_MEMORY_H
12#define __ASM_ARCH_24A0_MEMORY_H __FILE__
13
14#define PHYS_OFFSET UL(0x10000000)
15
16#define __virt_to_bus(x) __virt_to_phys(x)
17#define __bus_to_virt(x) __phys_to_virt(x)
18
19#endif
diff --git a/arch/arm/mach-s3c24a0/include/mach/regs-clock.h b/arch/arm/mach-s3c24a0/include/mach/regs-clock.h
new file mode 100644
index 000000000000..af2abd756c30
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/regs-clock.h
@@ -0,0 +1,88 @@
1/* linux/arch/arm/mach-s3c24a0/include/mach/regs-clock.h
2 *
3 * Copyright (c) 2003,2004,2005,2006 Simtec Electronics <linux@simtec.co.uk>
4 * http://armlinux.simtec.co.uk/
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 * S3C24A0 clock register definitions
11*/
12
13#ifndef __ASM_ARCH_24A0_REGS_CLOCK_H
14#define __ASM_ARCH_24A0_REGS_CLOCK_H __FILE__
15
16#define S3C24A0_MPLLCON S3C2410_CLKREG(0x10)
17#define S3C24A0_UPLLCON S3C2410_CLKREG(0x14)
18#define S3C24A0_CLKCON S3C2410_CLKREG(0x20)
19#define S3C24A0_CLKSRC S3C2410_CLKREG(0x24)
20#define S3C24A0_CLKDIVN S3C2410_CLKREG(0x28)
21
22/* CLKCON register bits */
23
24#define S3C24A0_CLKCON_VLX (1<<29)
25#define S3C24A0_CLKCON_VPOST (1<<28)
26#define S3C24A0_CLKCON_WDT (1<<27) /* reserved */
27#define S3C24A0_CLKCON_MPEGDCTQ (1<<26)
28#define S3C24A0_CLKCON_VPOSTIF (1<<25)
29#define S3C24A0_CLKCON_MPEG4IF (1<<24)
30#define S3C24A0_CLKCON_CAM_UPLL (1<<23)
31#define S3C24A0_CLKCON_LCDC (1<<22)
32#define S3C24A0_CLKCON_CAM_HCLK (1<<21)
33#define S3C24A0_CLKCON_MPEG4 (1<<20)
34#define S3C24A0_CLKCON_KEYPAD (1<<19)
35#define S3C24A0_CLKCON_ADC (1<<18)
36#define S3C24A0_CLKCON_SDI (1<<17)
37#define S3C24A0_CLKCON_MS (1<<16) /* memory stick */
38#define S3C24A0_CLKCON_USBD (1<<15)
39#define S3C24A0_CLKCON_GPIO (1<<14)
40#define S3C24A0_CLKCON_IIS (1<<13)
41#define S3C24A0_CLKCON_IIC (1<<12)
42#define S3C24A0_CLKCON_SPI (1<<11)
43#define S3C24A0_CLKCON_UART1 (1<<10)
44#define S3C24A0_CLKCON_UART0 (1<<9)
45#define S3C24A0_CLKCON_PWMT (1<<8)
46#define S3C24A0_CLKCON_USBH (1<<7)
47#define S3C24A0_CLKCON_AC97 (1<<6)
48#define S3C24A0_CLKCON_IrDA (1<<4)
49#define S3C24A0_CLKCON_IDLE (1<<2)
50#define S3C24A0_CLKCON_MON (1<<1)
51#define S3C24A0_CLKCON_STOP (1<<0)
52
53/* CLKSRC register bits */
54
55#define S3C24A0_CLKSRC_OSC (1<<8) /* CLKSRC */
56#define S3C24A0_CLKSRC_UPLL (1<<7)
57#define S3C24A0_CLKSRC_MPLL (1<<5)
58#define S3C24A0_CLKSRC_EXT (1<<4)
59
60/* Use a single interface with the common code, for s3c24xx */
61
62#define S3C2410_MPLLCON S3C24A0_MPLLCON
63#define S3C2410_UPLLCON S3C24A0_UPLLCON
64#define S3C2410_CLKCON S3C24A0_CLKCON
65#define S3C2410_CLKSLOW S3C24A0_CLKSRC
66#define S3C2410_CLKDIVN S3C24A0_CLKDIVN
67
68#define S3C2410_CLKCON_IDLE S3C24A0_CLKCON_IDLE
69#define S3C2410_CLKCON_POWER S3C24A0_CLKCON_STOP
70#define S3C2410_CLKCON_LCDC S3C24A0_CLKCON_LCDC
71#define S3C2410_CLKCON_USBH S3C24A0_CLKCON_USBH
72#define S3C2410_CLKCON_USBD S3C24A0_CLKCON_USBD
73#define S3C2410_CLKCON_PWMT S3C24A0_CLKCON_PWMT
74#define S3C2410_CLKCON_SDI S3C24A0_CLKCON_SDI
75#define S3C2410_CLKCON_UART0 S3C24A0_CLKCON_UART0
76#define S3C2410_CLKCON_UART1 S3C24A0_CLKCON_UART1
77#define S3C2410_CLKCON_GPIO S3C24A0_CLKCON_GPIO
78#define S3C2410_CLKCON_ADC S3C24A0_CLKCON_ADC
79#define S3C2410_CLKCON_IIC S3C24A0_CLKCON_IIC
80#define S3C2410_CLKCON_IIS S3C24A0_CLKCON_IIS
81#define S3C2410_CLKCON_SPI S3C24A0_CLKCON_SPI
82
83#define S3C2410_CLKSLOW_UCLK_OFF S3C24A0_CLKSRC_UPLL
84#define S3C2410_CLKSLOW_MPLL_OFF S3C24A0_CLKSRC_MPLL
85#define S3C2410_CLKSLOW_SLOW (0xFF)
86#define S3C2410_CLKSLOW_GET_SLOWVAL(x) (0x1)
87
88#endif /* __ASM_ARCH_24A0_REGS_CLOCK_H */
diff --git a/arch/arm/mach-s3c24a0/include/mach/regs-irq.h b/arch/arm/mach-s3c24a0/include/mach/regs-irq.h
new file mode 100644
index 000000000000..6086f6f189eb
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/regs-irq.h
@@ -0,0 +1,25 @@
1/* linux/arch/arm/mach-s3c24a0/include/mach/regs-irq.h
2 *
3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11
12#ifndef ___ASM_ARCH_24A0_REGS_IRQ_H
13#define ___ASM_ARCH_24A0_REGS_IRQ_H __FILE__
14
15
16#define S3C2410_EINTMASK S3C2410_EINTREG(0x034)
17#define S3C2410_EINTPEND S3C2410_EINTREG(0X038)
18
19#define S3C24XX_EINTMASK S3C24XX_EINTREG(0x034)
20#define S3C24XX_EINTPEND S3C24XX_EINTREG(0X038)
21
22#endif /* __ASM_ARCH_24A0_REGS_IRQ_H */
23
24
25
diff --git a/arch/arm/mach-s3c24a0/include/mach/system.h b/arch/arm/mach-s3c24a0/include/mach/system.h
new file mode 100644
index 000000000000..bd1bd1957656
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/system.h
@@ -0,0 +1,25 @@
1/* linux/arch/arm/mach-s3c24a0/include/mach/system.h
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C24A0 - System function defines and includes
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 <mach/hardware.h>
14#include <asm/io.h>
15
16#include <mach/map.h>
17
18static void arch_idle(void)
19{
20 /* currently no specific idle support. */
21}
22
23void (*s3c24xx_reset_hook)(void);
24
25#include <asm/plat-s3c24xx/system-reset.h>
diff --git a/arch/arm/mach-s3c24a0/include/mach/tick.h b/arch/arm/mach-s3c24a0/include/mach/tick.h
new file mode 100644
index 000000000000..9dea8ba6fb72
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/tick.h
@@ -0,0 +1,15 @@
1/* linux/arch/arm/mach-s3c24a0/include/mach/tick.h
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * S3C24A0 - timer tick support
8 */
9
10#define SUBSRC_TIMER4 (1 << (IRQ_TIMER4 - IRQ_S3CUART_RX0))
11
12static inline int s3c24xx_ostimer_pending(void)
13{
14 return __raw_readl(S3C2410_SUBSRCPND) & SUBSRC_TIMER4;
15}
diff --git a/arch/arm/mach-s3c24a0/include/mach/timex.h b/arch/arm/mach-s3c24a0/include/mach/timex.h
new file mode 100644
index 000000000000..98573424a016
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/timex.h
@@ -0,0 +1,18 @@
1/* linux/arch/arm/mach-s3c24a0/include/mach/timex.h
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 - time parameters
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#ifndef __ASM_ARCH_TIMEX_H
14#define __ASM_ARCH_TIMEX_H
15
16#define CLOCK_TICK_RATE 12000000
17
18#endif /* __ASM_ARCH_TIMEX_H */
diff --git a/arch/arm/mach-s3c24a0/include/mach/vmalloc.h b/arch/arm/mach-s3c24a0/include/mach/vmalloc.h
new file mode 100644
index 000000000000..4d4fe4849589
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/vmalloc.h
@@ -0,0 +1,17 @@
1/* linux/include/asm-arm/arch-s3c24ao/vmalloc.h
2 *
3 * Copyright 2008 Simtec Electronics <linux@simtec.co.uk>
4
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * S3C24A0 vmalloc definition
10*/
11
12#ifndef __ASM_ARCH_VMALLOC_H
13#define __ASM_ARCH_VMALLOC_H
14
15#define VMALLOC_END (0xE0000000)
16
17#endif /* __ASM_ARCH_VMALLOC_H */
diff --git a/arch/arm/mach-s3c6400/Kconfig b/arch/arm/mach-s3c6400/Kconfig
new file mode 100644
index 000000000000..6da82b5c09ba
--- /dev/null
+++ b/arch/arm/mach-s3c6400/Kconfig
@@ -0,0 +1,8 @@
1# arch/arm/mach-s3c6400/Kconfig
2#
3# Copyright 2008 Openmoko, Inc.
4# Simtec Electronics, Ben Dooks <ben@simtec.co.uk>
5#
6# Licensed under GPLv2
7
8# Currently nothing here, this will be added later
diff --git a/arch/arm/mach-s3c6400/Makefile b/arch/arm/mach-s3c6400/Makefile
new file mode 100644
index 000000000000..8f397db25b87
--- /dev/null
+++ b/arch/arm/mach-s3c6400/Makefile
@@ -0,0 +1,15 @@
1# arch/arm/mach-s3c6400/Makefile
2#
3# Copyright 2008 Openmoko, Inc.
4# Copyright 2008 Simtec Electronics
5#
6# Licensed under GPLv2
7
8obj-y :=
9obj-m :=
10obj-n :=
11obj- :=
12
13# Core support for S3C6400 system
14
15obj-n += blank.o
diff --git a/arch/arm/mach-s3c6400/Makefile.boot b/arch/arm/mach-s3c6400/Makefile.boot
new file mode 100644
index 000000000000..ba41fdc0a586
--- /dev/null
+++ b/arch/arm/mach-s3c6400/Makefile.boot
@@ -0,0 +1,2 @@
1 zreladdr-y := 0x50008000
2params_phys-y := 0x50000100
diff --git a/arch/arm/mach-s3c6400/include/mach/debug-macro.S b/arch/arm/mach-s3c6400/include/mach/debug-macro.S
new file mode 100644
index 000000000000..b18ac5266dfc
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/debug-macro.S
@@ -0,0 +1,39 @@
1/* arch/arm/mach-s3c6400/include/mach/debug-macro.S
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
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/* pull in the relevant register and map files. */
14
15#include <mach/map.h>
16#include <plat/regs-serial.h>
17
18 /* note, for the boot process to work we have to keep the UART
19 * virtual address aligned to an 1MiB boundary for the L1
20 * mapping the head code makes. We keep the UART virtual address
21 * aligned and add in the offset when we load the value here.
22 */
23
24 .macro addruart, rx
25 mrc p15, 0, \rx, c1, c0
26 tst \rx, #1
27 ldreq \rx, = S3C_PA_UART
28 ldrne \rx, = (S3C_VA_UART + S3C_PA_UART & 0xfffff)
29#if CONFIG_DEBUG_S3C_UART != 0
30 add \rx, \rx, #(0x400 * CONFIG_DEBUG_S3C_UART)
31#endif
32 .endm
33
34/* include the reset of the code which will do the work, we're only
35 * compiling for a single cpu processor type so the default of s3c2440
36 * will be fine with us.
37 */
38
39#include <plat/debug-macro.S>
diff --git a/arch/arm/mach-s3c6400/include/mach/dma.h b/arch/arm/mach-s3c6400/include/mach/dma.h
new file mode 100644
index 000000000000..9771ac2cb07e
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/dma.h
@@ -0,0 +1,16 @@
1/* linux/arch/arm/mach-s3c6400/include/mach/dma.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C6400 - DMA support
9 */
10
11#ifndef __ASM_ARCH_DMA_H
12#define __ASM_ARCH_DMA_H __FILE__
13
14/* currently nothing here, placeholder */
15
16#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s3c6400/include/mach/entry-macro.S b/arch/arm/mach-s3c6400/include/mach/entry-macro.S
new file mode 100644
index 000000000000..fbd90d2cf355
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/entry-macro.S
@@ -0,0 +1,44 @@
1/* arch/arm/mach-s3c6400/include/mach/entry-macro.S
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * Low-level IRQ helper macros for the Samsung S3C64XX series
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13*/
14
15#include <asm/hardware/vic.h>
16#include <mach/map.h>
17#include <plat/irqs.h>
18
19 .macro disable_fiq
20 .endm
21
22 .macro get_irqnr_preamble, base, tmp
23 ldr \base, =S3C_VA_VIC0
24 .endm
25
26 .macro arch_ret_to_user, tmp1, tmp2
27 .endm
28
29 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
30
31 @ check the vic0
32 mov \irqnr, # S3C_IRQ_OFFSET + 31
33 ldr \irqstat, [ \base, # VIC_IRQ_STATUS ]
34 teq \irqstat, #0
35
36 @ otherwise try vic1
37 addeq \tmp, \base, #(S3C_VA_VIC1 - S3C_VA_VIC0)
38 addeq \irqnr, \irqnr, #32
39 ldreq \irqstat, [ \tmp, # VIC_IRQ_STATUS ]
40 teqeq \irqstat, #0
41
42 clzne \irqstat, \irqstat
43 subne \irqnr, \irqnr, \irqstat
44 .endm
diff --git a/arch/arm/mach-s3c6400/include/mach/gpio-core.h b/arch/arm/mach-s3c6400/include/mach/gpio-core.h
new file mode 100644
index 000000000000..d89aae68b0a5
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/gpio-core.h
@@ -0,0 +1,21 @@
1/* arch/arm/mach-s3c6400/include/mach/gpio-core.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX - GPIO core support
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#ifndef __ASM_ARCH_GPIO_CORE_H
16#define __ASM_ARCH_GPIO_CORE_H __FILE__
17
18/* currently we just include the platform support */
19#include <plat/gpio-core.h>
20
21#endif /* __ASM_ARCH_GPIO_CORE_H */
diff --git a/arch/arm/mach-s3c6400/include/mach/gpio.h b/arch/arm/mach-s3c6400/include/mach/gpio.h
new file mode 100644
index 000000000000..e8e35e8fe731
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/gpio.h
@@ -0,0 +1,96 @@
1/* arch/arm/mach-s3c6400/include/mach/gpio.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * S3C6400 - GPIO lib support
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#define gpio_get_value __gpio_get_value
16#define gpio_set_value __gpio_set_value
17#define gpio_cansleep __gpio_cansleep
18#define gpio_to_irq __gpio_to_irq
19
20/* GPIO bank sizes */
21#define S3C64XX_GPIO_A_NR (8)
22#define S3C64XX_GPIO_B_NR (7)
23#define S3C64XX_GPIO_C_NR (8)
24#define S3C64XX_GPIO_D_NR (5)
25#define S3C64XX_GPIO_E_NR (5)
26#define S3C64XX_GPIO_F_NR (16)
27#define S3C64XX_GPIO_G_NR (7)
28#define S3C64XX_GPIO_H_NR (10)
29#define S3C64XX_GPIO_I_NR (16)
30#define S3C64XX_GPIO_J_NR (12)
31#define S3C64XX_GPIO_K_NR (16)
32#define S3C64XX_GPIO_L_NR (15)
33#define S3C64XX_GPIO_M_NR (6)
34#define S3C64XX_GPIO_N_NR (16)
35#define S3C64XX_GPIO_O_NR (16)
36#define S3C64XX_GPIO_P_NR (15)
37#define S3C64XX_GPIO_Q_NR (9)
38
39/* GPIO bank numbes */
40
41/* CONFIG_S3C_GPIO_SPACE allows the user to select extra
42 * space for debugging purposes so that any accidental
43 * change from one gpio bank to another can be caught.
44*/
45
46#define S3C64XX_GPIO_NEXT(__gpio) \
47 ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
48
49enum s3c_gpio_number {
50 S3C64XX_GPIO_A_START = 0,
51 S3C64XX_GPIO_B_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_A),
52 S3C64XX_GPIO_C_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_B),
53 S3C64XX_GPIO_D_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_C),
54 S3C64XX_GPIO_E_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_D),
55 S3C64XX_GPIO_F_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_E),
56 S3C64XX_GPIO_G_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_F),
57 S3C64XX_GPIO_H_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_G),
58 S3C64XX_GPIO_I_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_H),
59 S3C64XX_GPIO_J_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_I),
60 S3C64XX_GPIO_K_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_J),
61 S3C64XX_GPIO_L_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_K),
62 S3C64XX_GPIO_M_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_L),
63 S3C64XX_GPIO_N_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_M),
64 S3C64XX_GPIO_O_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_N),
65 S3C64XX_GPIO_P_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_O),
66 S3C64XX_GPIO_Q_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_P),
67};
68
69/* S3C64XX GPIO number definitions. */
70
71#define S3C64XX_GPA(_nr) (S3C64XX_GPIO_A_START + (_nr))
72#define S3C64XX_GPB(_nr) (S3C64XX_GPIO_B_START + (_nr))
73#define S3C64XX_GPC(_nr) (S3C64XX_GPIO_C_START + (_nr))
74#define S3C64XX_GPD(_nr) (S3C64XX_GPIO_D_START + (_nr))
75#define S3C64XX_GPE(_nr) (S3C64XX_GPIO_E_START + (_nr))
76#define S3C64XX_GPF(_nr) (S3C64XX_GPIO_F_START + (_nr))
77#define S3C64XX_GPG(_nr) (S3C64XX_GPIO_G_START + (_nr))
78#define S3C64XX_GPH(_nr) (S3C64XX_GPIO_H_START + (_nr))
79#define S3C64XX_GPI(_nr) (S3C64XX_GPIO_I_START + (_nr))
80#define S3C64XX_GPJ(_nr) (S3C64XX_GPIO_J_START + (_nr))
81#define S3C64XX_GPK(_nr) (S3C64XX_GPIO_K_START + (_nr))
82#define S3C64XX_GPL(_nr) (S3C64XX_GPIO_L_START + (_nr))
83#define S3C64XX_GPM(_nr) (S3C64XX_GPIO_M_START + (_nr))
84#define S3C64XX_GPN(_nr) (S3C64XX_GPIO_N_START + (_nr))
85#define S3C64XX_GPO(_nr) (S3C64XX_GPIO_O_START + (_nr))
86#define S3C64XX_GPP(_nr) (S3C64XX_GPIO_P_START + (_nr))
87#define S3C64XX_GPQ(_nr) (S3C64XX_GPIO_Q_START + (_nr))
88
89/* the end of the S3C64XX specific gpios */
90#define S3C64XX_GPIO_END (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)
91#define S3C_GPIO_END S3C64XX_GPIO_END
92
93/* define the number of gpios we need to the one after the GPQ() range */
94#define ARCH_NR_GPIOS (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)
95
96#include <asm-generic/gpio.h>
diff --git a/arch/arm/mach-s3c6400/include/mach/hardware.h b/arch/arm/mach-s3c6400/include/mach/hardware.h
new file mode 100644
index 000000000000..862d033e57a4
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/hardware.h
@@ -0,0 +1,16 @@
1/* linux/arch/arm/mach-s3c6400/include/mach/hardware.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C6400 - Hardware support
9 */
10
11#ifndef __ASM_ARCH_HARDWARE_H
12#define __ASM_ARCH_HARDWARE_H __FILE__
13
14/* currently nothing here, placeholder */
15
16#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s3c6400/include/mach/irqs.h b/arch/arm/mach-s3c6400/include/mach/irqs.h
new file mode 100644
index 000000000000..b38c47cffc28
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/irqs.h
@@ -0,0 +1,20 @@
1/* linux/arch/arm/mach-s3c6400/include/mach/irqs.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C6400 - IRQ definitions
9 */
10
11#ifndef __ASM_ARCH_IRQS_H
12#define __ASM_ARCH_IRQS_H __FILE__
13
14#ifndef __ASM_ARM_IRQ_H
15#error "Do not include this directly, instead #include <asm/irq.h>"
16#endif
17
18#include <plat/irqs.h>
19
20#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s3c6400/include/mach/map.h b/arch/arm/mach-s3c6400/include/mach/map.h
new file mode 100644
index 000000000000..cff27d813fc6
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/map.h
@@ -0,0 +1,68 @@
1/* linux/arch/arm/mach-s3c6400/include/mach/map.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * S3C64XX - Memory map definitions
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#ifndef __ASM_ARCH_MAP_H
16#define __ASM_ARCH_MAP_H __FILE__
17
18#include <plat/map-base.h>
19
20/* HSMMC units */
21#define S3C64XX_PA_HSMMC(x) (0x7C200000 + ((x) * 0x100000))
22#define S3C64XX_PA_HSMMC0 S3C64XX_PA_HSMMC(0)
23#define S3C64XX_PA_HSMMC1 S3C64XX_PA_HSMMC(1)
24#define S3C64XX_PA_HSMMC2 S3C64XX_PA_HSMMC(2)
25
26#define S3C_PA_UART (0x7F005000)
27#define S3C_PA_UART0 (S3C_PA_UART + 0x00)
28#define S3C_PA_UART1 (S3C_PA_UART + 0x400)
29#define S3C_PA_UART2 (S3C_PA_UART + 0x800)
30#define S3C_PA_UART3 (S3C_PA_UART + 0xC00)
31#define S3C_UART_OFFSET (0x400)
32
33/* See notes on UART VA mapping in debug-macro.S */
34#define S3C_VA_UARTx(x) (S3C_VA_UART + (S3C_PA_UART & 0xfffff) + ((x) * S3C_UART_OFFSET))
35
36#define S3C_VA_UART0 S3C_VA_UARTx(0)
37#define S3C_VA_UART1 S3C_VA_UARTx(1)
38#define S3C_VA_UART2 S3C_VA_UARTx(2)
39#define S3C_VA_UART3 S3C_VA_UARTx(3)
40
41#define S3C64XX_PA_FB (0x77100000)
42#define S3C64XX_PA_SYSCON (0x7E00F000)
43#define S3C64XX_PA_TIMER (0x7F006000)
44#define S3C64XX_PA_IIC0 (0x7F004000)
45#define S3C64XX_PA_IIC1 (0x7F00F000)
46
47#define S3C64XX_PA_GPIO (0x7F008000)
48#define S3C64XX_VA_GPIO S3C_ADDR(0x00500000)
49#define S3C64XX_SZ_GPIO SZ_4K
50
51#define S3C64XX_PA_SDRAM (0x50000000)
52#define S3C64XX_PA_VIC0 (0x71200000)
53#define S3C64XX_PA_VIC1 (0x71300000)
54
55/* place VICs close together */
56#define S3C_VA_VIC0 (S3C_VA_IRQ + 0x00)
57#define S3C_VA_VIC1 (S3C_VA_IRQ + 0x10000)
58
59/* compatibiltiy defines. */
60#define S3C_PA_TIMER S3C64XX_PA_TIMER
61#define S3C_PA_HSMMC0 S3C64XX_PA_HSMMC0
62#define S3C_PA_HSMMC1 S3C64XX_PA_HSMMC1
63#define S3C_PA_HSMMC2 S3C64XX_PA_HSMMC2
64#define S3C_PA_IIC S3C64XX_PA_IIC0
65#define S3C_PA_IIC1 S3C64XX_PA_IIC1
66#define S3C_PA_FB S3C64XX_PA_FB
67
68#endif /* __ASM_ARCH_6400_MAP_H */
diff --git a/arch/arm/mach-s3c6400/include/mach/memory.h b/arch/arm/mach-s3c6400/include/mach/memory.h
new file mode 100644
index 000000000000..a3ac84a65480
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/memory.h
@@ -0,0 +1,18 @@
1/* arch/arm/mach-s3c6400/include/mach/memory.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
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#ifndef __ASM_ARCH_MEMORY_H
14#define __ASM_ARCH_MEMORY_H
15
16#define PHYS_OFFSET UL(0x50000000)
17
18#endif
diff --git a/arch/arm/mach-s3c6400/include/mach/pwm-clock.h b/arch/arm/mach-s3c6400/include/mach/pwm-clock.h
new file mode 100644
index 000000000000..b25bedee0d52
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/pwm-clock.h
@@ -0,0 +1,56 @@
1/* linux/arch/arm/mach-s3c6400/include/mach/pwm-clock.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64xx - pwm clock and timer support
9 */
10
11/**
12 * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk
13 * @tcfg: The timer TCFG1 register bits shifted down to 0.
14 *
15 * Return true if the given configuration from TCFG1 is a TCLK instead
16 * any of the TDIV clocks.
17 */
18static inline int pwm_cfg_src_is_tclk(unsigned long tcfg)
19{
20 return tcfg >= S3C64XX_TCFG1_MUX_TCLK;
21}
22
23/**
24 * tcfg_to_divisor() - convert tcfg1 setting to a divisor
25 * @tcfg1: The tcfg1 setting, shifted down.
26 *
27 * Get the divisor value for the given tcfg1 setting. We assume the
28 * caller has already checked to see if this is not a TCLK source.
29 */
30static inline unsigned long tcfg_to_divisor(unsigned long tcfg1)
31{
32 return 1 << tcfg1;
33}
34
35/**
36 * pwm_tdiv_has_div1() - does the tdiv setting have a /1
37 *
38 * Return true if we have a /1 in the tdiv setting.
39 */
40static inline unsigned int pwm_tdiv_has_div1(void)
41{
42 return 1;
43}
44
45/**
46 * pwm_tdiv_div_bits() - calculate TCFG1 divisor value.
47 * @div: The divisor to calculate the bit information for.
48 *
49 * Turn a divisor into the necessary bit field for TCFG1.
50 */
51static inline unsigned long pwm_tdiv_div_bits(unsigned int div)
52{
53 return ilog2(div);
54}
55
56#define S3C_TCFG1_MUX_TCLK S3C64XX_TCFG1_MUX_TCLK
diff --git a/arch/arm/mach-s3c6400/include/mach/regs-fb.h b/arch/arm/mach-s3c6400/include/mach/regs-fb.h
new file mode 100644
index 000000000000..47019795ce06
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/regs-fb.h
@@ -0,0 +1,259 @@
1/* arch/arm/mach-s3c6400/include/mach/regs-fb.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * S3C64XX - new-style framebuffer register definitions
9 *
10 * This is the register set for the new style framebuffer interface
11 * found from the S3C2443 onwards and specifically the S3C64XX series
12 * S3C6400 and S3C6410.
13 *
14 * The file contains the cpu specific items which change between whichever
15 * architecture is selected. See <plat/regs-fb.h> for the core definitions
16 * that are the same.
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License version 2 as
20 * published by the Free Software Foundation.
21*/
22
23/* include the core definitions here, in case we really do need to
24 * override them at a later date.
25*/
26
27#include <plat/regs-fb.h>
28
29#define S3C_FB_MAX_WIN (5) /* number of hardware windows available. */
30#define VIDCON1_FSTATUS_EVEN (1 << 15)
31
32/* Video timing controls */
33#define VIDTCON0 (0x10)
34#define VIDTCON1 (0x14)
35#define VIDTCON2 (0x18)
36
37/* Window position controls */
38
39#define WINCON(_win) (0x20 + ((_win) * 4))
40
41/* OSD1 and OSD4 do not have register D */
42
43#define VIDOSD_A(_win) (0x40 + ((_win) * 16))
44#define VIDOSD_B(_win) (0x44 + ((_win) * 16))
45#define VIDOSD_C(_win) (0x48 + ((_win) * 16))
46#define VIDOSD_D(_win) (0x4C + ((_win) * 16))
47
48/* Video buffer addresses */
49
50#define VIDW_BUF_START(_buff) (0xA0 + ((_buff) * 8))
51#define VIDW_BUF_START1(_buff) (0xA4 + ((_buff) * 8))
52#define VIDW_BUF_END(_buff) (0xD0 + ((_buff) * 8))
53#define VIDW_BUF_END1(_buff) (0xD4 + ((_buff) * 8))
54#define VIDW_BUF_SIZE(_buff) (0x100 + ((_buff) * 4))
55
56#define VIDINTCON0 (0x130)
57
58#define WxKEYCONy(_win, _con) ((0x140 + ((_win) * 8)) + ((_con) * 4))
59
60/* WINCONx */
61
62#define WINCONx_CSCWIDTH_MASK (0x3 << 26)
63#define WINCONx_CSCWIDTH_SHIFT (26)
64#define WINCONx_CSCWIDTH_WIDE (0x0 << 26)
65#define WINCONx_CSCWIDTH_NARROW (0x3 << 26)
66
67#define WINCONx_ENLOCAL (1 << 22)
68#define WINCONx_BUFSTATUS (1 << 21)
69#define WINCONx_BUFSEL (1 << 20)
70#define WINCONx_BUFAUTOEN (1 << 19)
71#define WINCONx_YCbCr (1 << 13)
72
73#define WINCON1_LOCALSEL_CAMIF (1 << 23)
74
75#define WINCON2_LOCALSEL_CAMIF (1 << 23)
76#define WINCON2_BLD_PIX (1 << 6)
77
78#define WINCON2_ALPHA_SEL (1 << 1)
79#define WINCON2_BPPMODE_MASK (0xf << 2)
80#define WINCON2_BPPMODE_SHIFT (2)
81#define WINCON2_BPPMODE_1BPP (0x0 << 2)
82#define WINCON2_BPPMODE_2BPP (0x1 << 2)
83#define WINCON2_BPPMODE_4BPP (0x2 << 2)
84#define WINCON2_BPPMODE_8BPP_1232 (0x4 << 2)
85#define WINCON2_BPPMODE_16BPP_565 (0x5 << 2)
86#define WINCON2_BPPMODE_16BPP_A1555 (0x6 << 2)
87#define WINCON2_BPPMODE_16BPP_I1555 (0x7 << 2)
88#define WINCON2_BPPMODE_18BPP_666 (0x8 << 2)
89#define WINCON2_BPPMODE_18BPP_A1665 (0x9 << 2)
90#define WINCON2_BPPMODE_19BPP_A1666 (0xa << 2)
91#define WINCON2_BPPMODE_24BPP_888 (0xb << 2)
92#define WINCON2_BPPMODE_24BPP_A1887 (0xc << 2)
93#define WINCON2_BPPMODE_25BPP_A1888 (0xd << 2)
94#define WINCON2_BPPMODE_28BPP_A4888 (0xd << 2)
95
96#define WINCON3_BLD_PIX (1 << 6)
97
98#define WINCON3_ALPHA_SEL (1 << 1)
99#define WINCON3_BPPMODE_MASK (0xf << 2)
100#define WINCON3_BPPMODE_SHIFT (2)
101#define WINCON3_BPPMODE_1BPP (0x0 << 2)
102#define WINCON3_BPPMODE_2BPP (0x1 << 2)
103#define WINCON3_BPPMODE_4BPP (0x2 << 2)
104#define WINCON3_BPPMODE_16BPP_565 (0x5 << 2)
105#define WINCON3_BPPMODE_16BPP_A1555 (0x6 << 2)
106#define WINCON3_BPPMODE_16BPP_I1555 (0x7 << 2)
107#define WINCON3_BPPMODE_18BPP_666 (0x8 << 2)
108#define WINCON3_BPPMODE_18BPP_A1665 (0x9 << 2)
109#define WINCON3_BPPMODE_19BPP_A1666 (0xa << 2)
110#define WINCON3_BPPMODE_24BPP_888 (0xb << 2)
111#define WINCON3_BPPMODE_24BPP_A1887 (0xc << 2)
112#define WINCON3_BPPMODE_25BPP_A1888 (0xd << 2)
113#define WINCON3_BPPMODE_28BPP_A4888 (0xd << 2)
114
115#define VIDINTCON0_FIFIOSEL_WINDOW2 (0x10 << 5)
116#define VIDINTCON0_FIFIOSEL_WINDOW3 (0x20 << 5)
117#define VIDINTCON0_FIFIOSEL_WINDOW4 (0x40 << 5)
118
119#define DITHMODE (0x170)
120#define WINxMAP(_win) (0x180 + ((_win) * 4))
121
122
123#define DITHMODE_R_POS_MASK (0x3 << 5)
124#define DITHMODE_R_POS_SHIFT (5)
125#define DITHMODE_R_POS_8BIT (0x0 << 5)
126#define DITHMODE_R_POS_6BIT (0x1 << 5)
127#define DITHMODE_R_POS_5BIT (0x2 << 5)
128
129#define DITHMODE_G_POS_MASK (0x3 << 3)
130#define DITHMODE_G_POS_SHIFT (3)
131#define DITHMODE_G_POS_8BIT (0x0 << 3)
132#define DITHMODE_G_POS_6BIT (0x1 << 3)
133#define DITHMODE_G_POS_5BIT (0x2 << 3)
134
135#define DITHMODE_B_POS_MASK (0x3 << 1)
136#define DITHMODE_B_POS_SHIFT (1)
137#define DITHMODE_B_POS_8BIT (0x0 << 1)
138#define DITHMODE_B_POS_6BIT (0x1 << 1)
139#define DITHMODE_B_POS_5BIT (0x2 << 1)
140
141#define DITHMODE_DITH_EN (1 << 0)
142
143#define WPALCON (0x1A0)
144
145#define WPALCON_W4PAL_16BPP_A555 (1 << 8)
146#define WPALCON_W3PAL_16BPP_A555 (1 << 7)
147#define WPALCON_W2PAL_16BPP_A555 (1 << 6)
148
149/* Palette registers */
150
151#define WIN2_PAL(_entry) (0x300 + ((_entry) * 2))
152#define WIN3_PAL(_entry) (0x320 + ((_entry) * 2))
153#define WIN4_PAL(_entry) (0x340 + ((_entry) * 2))
154#define WIN0_PAL(_entry) (0x400 + ((_entry) * 4))
155#define WIN1_PAL(_entry) (0x800 + ((_entry) * 4))
156
157/* system specific implementation code for palette sizes, and other
158 * information that changes depending on which architecture is being
159 * compiled.
160*/
161
162/* return true if window _win has OSD register D */
163#define s3c_fb_has_osd_d(_win) ((_win) != 4 && (_win) != 0)
164
165static inline unsigned int s3c_fb_win_pal_size(unsigned int win)
166{
167 if (win < 2)
168 return 256;
169 if (win < 4)
170 return 16;
171 if (win == 4)
172 return 4;
173
174 BUG(); /* shouldn't get here */
175}
176
177static inline int s3c_fb_validate_win_bpp(unsigned int win, unsigned int bpp)
178{
179 /* all windows can do 1/2 bpp */
180
181 if ((bpp == 25 || bpp == 19) && win == 0)
182 return 0; /* win 0 does not have 19 or 25bpp modes */
183
184 if (bpp == 4 && win == 4)
185 return 0;
186
187 if (bpp == 8 && (win >= 3))
188 return 0; /* win 3/4 cannot do 8bpp in any mode */
189
190 return 1;
191}
192
193static inline unsigned int s3c_fb_pal_reg(unsigned int window, int reg)
194{
195 switch (window) {
196 case 0: return WIN0_PAL(reg);
197 case 1: return WIN1_PAL(reg);
198 case 2: return WIN2_PAL(reg);
199 case 3: return WIN3_PAL(reg);
200 case 4: return WIN4_PAL(reg);
201 }
202
203 BUG();
204}
205
206static inline int s3c_fb_pal_is16(unsigned int window)
207{
208 return window > 1;
209}
210
211struct s3c_fb_palette {
212 struct fb_bitfield r;
213 struct fb_bitfield g;
214 struct fb_bitfield b;
215 struct fb_bitfield a;
216};
217
218static inline void s3c_fb_init_palette(unsigned int window,
219 struct s3c_fb_palette *palette)
220{
221 if (window < 2) {
222 /* Windows 0/1 are 8/8/8 or A/8/8/8 */
223 palette->r.offset = 16;
224 palette->r.length = 8;
225 palette->g.offset = 8;
226 palette->g.length = 8;
227 palette->b.offset = 0;
228 palette->b.length = 8;
229 } else {
230 /* currently we assume RGB 5/6/5 */
231 palette->r.offset = 11;
232 palette->r.length = 5;
233 palette->g.offset = 5;
234 palette->g.length = 6;
235 palette->b.offset = 0;
236 palette->b.length = 5;
237 }
238}
239
240/* Notes on per-window bpp settings
241 *
242 * Value Win0 Win1 Win2 Win3 Win 4
243 * 0000 1(P) 1(P) 1(P) 1(P) 1(P)
244 * 0001 2(P) 2(P) 2(P) 2(P) 2(P)
245 * 0010 4(P) 4(P) 4(P) 4(P) -none-
246 * 0011 8(P) 8(P) -none- -none- -none-
247 * 0100 -none- 8(A232) 8(A232) -none- -none-
248 * 0101 16(565) 16(565) 16(565) 16(565) 16(565)
249 * 0110 -none- 16(A555) 16(A555) 16(A555) 16(A555)
250 * 0111 16(I555) 16(I565) 16(I555) 16(I555) 16(I555)
251 * 1000 18(666) 18(666) 18(666) 18(666) 18(666)
252 * 1001 -none- 18(A665) 18(A665) 18(A665) 16(A665)
253 * 1010 -none- 19(A666) 19(A666) 19(A666) 19(A666)
254 * 1011 24(888) 24(888) 24(888) 24(888) 24(888)
255 * 1100 -none- 24(A887) 24(A887) 24(A887) 24(A887)
256 * 1101 -none- 25(A888) 25(A888) 25(A888) 25(A888)
257 * 1110 -none- -none- -none- -none- -none-
258 * 1111 -none- -none- -none- -none- -none-
259*/
diff --git a/arch/arm/mach-s3c6400/include/mach/regs-irq.h b/arch/arm/mach-s3c6400/include/mach/regs-irq.h
new file mode 100644
index 000000000000..bcce68a0bb75
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/regs-irq.h
@@ -0,0 +1,20 @@
1/* linux/arch/arm/mach-s3c6400/include/mach/regs-irq.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * S3C64XX - IRQ register definitions
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#ifndef __ASM_ARCH_REGS_IRQ_H
16#define __ASM_ARCH_REGS_IRQ_H __FILE__
17
18#include <asm/hardware/vic.h>
19
20#endif /* __ASM_ARCH_6400_REGS_IRQ_H */
diff --git a/arch/arm/mach-s3c6400/include/mach/system.h b/arch/arm/mach-s3c6400/include/mach/system.h
new file mode 100644
index 000000000000..652bbc403f0b
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/system.h
@@ -0,0 +1,24 @@
1/* linux/arch/arm/mach-s3c6400/include/mach/system.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C6400 - system implementation
9 */
10
11#ifndef __ASM_ARCH_SYSTEM_H
12#define __ASM_ARCH_SYSTEM_H __FILE__
13
14static void arch_idle(void)
15{
16 /* nothing here yet */
17}
18
19static void arch_reset(char mode)
20{
21 /* nothing here yet */
22}
23
24#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s3c6400/include/mach/tick.h b/arch/arm/mach-s3c6400/include/mach/tick.h
new file mode 100644
index 000000000000..d9c0dc7014ec
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/tick.h
@@ -0,0 +1,29 @@
1/* linux/arch/arm/mach-s3c6400/include/mach/tick.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * S3C64XX - Timer tick support definitions
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#ifndef __ASM_ARCH_TICK_H
16#define __ASM_ARCH_TICK_H __FILE__
17
18/* note, the timer interrutps turn up in 2 places, the vic and then
19 * the timer block. We take the VIC as the base at the moment.
20 */
21static inline u32 s3c24xx_ostimer_pending(void)
22{
23 u32 pend = __raw_readl(S3C_VA_VIC0 + VIC_RAW_STATUS);
24 return pend & 1 << (IRQ_TIMER4_VIC - S3C64XX_IRQ_VIC0(0));
25}
26
27#define TICK_MAX (0xffffffff)
28
29#endif /* __ASM_ARCH_6400_TICK_H */
diff --git a/arch/arm/mach-s3c6400/include/mach/uncompress.h b/arch/arm/mach-s3c6400/include/mach/uncompress.h
new file mode 100644
index 000000000000..c6a82a20bf2a
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/uncompress.h
@@ -0,0 +1,28 @@
1/* arch/arm/mach-s3c6400/include/mach/uncompress.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * S3C6400 - uncompress code
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#ifndef __ASM_ARCH_UNCOMPRESS_H
16#define __ASM_ARCH_UNCOMPRESS_H
17
18#include <mach/map.h>
19#include <plat/uncompress.h>
20
21static void arch_detect_cpu(void)
22{
23 /* we do not need to do any cpu detection here at the moment. */
24 fifo_mask = S3C2440_UFSTAT_TXMASK;
25 fifo_max = 63 << S3C2440_UFSTAT_TXSHIFT;
26}
27
28#endif /* __ASM_ARCH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-s3c6410/Kconfig b/arch/arm/mach-s3c6410/Kconfig
new file mode 100644
index 000000000000..1d5010070027
--- /dev/null
+++ b/arch/arm/mach-s3c6410/Kconfig
@@ -0,0 +1,62 @@
1# arch/arm/mach-s3c6410/Kconfig
2#
3# Copyright 2008 Openmoko, Inc.
4# Copyright 2008 Simtec Electronics
5#
6# Licensed under GPLv2
7
8# Configuration options for the S3C6410 CPU
9
10config CPU_S3C6410
11 bool
12 select CPU_S3C6400_INIT
13 select CPU_S3C6400_CLOCK
14 help
15 Enable S3C6410 CPU support
16
17config S3C6410_SETUP_SDHCI
18 bool
19 help
20 Internal helper functions for S3C6410 based SDHCI systems
21
22config MACH_SMDK6410
23 bool "SMDK6410"
24 select CPU_S3C6410
25 select S3C_DEV_HSMMC
26 select S3C_DEV_HSMMC1
27 select S3C_DEV_I2C1
28 select S3C_DEV_FB
29 select S3C6410_SETUP_SDHCI
30 select S3C64XX_SETUP_I2C1
31 select S3C64XX_SETUP_FB_24BPP
32 help
33 Machine support for the Samsung SMDK6410
34
35# At least some of the SMDK6410s were shipped with the card detect
36# for the MMC/SD slots connected to the same input. This means that
37# either the boards need to be altered to have channel0 to an alternate
38# configuration or that only one slot can be used.
39
40choice
41 prompt "SMDK6410 MMC/SD slot setup"
42 depends on MACH_SMDK6410
43
44config SMDK6410_SD_CH0
45 bool "Use channel 0 only"
46 depends on MACH_SMDK6410
47 help
48 Select CON7 (channel 0) as the MMC/SD slot, as
49 at least some SMDK6410 boards come with the
50 resistors fitted so that the card detects for
51 channels 0 and 1 are the same.
52
53config SMDK6410_SD_CH1
54 bool "Use channel 1 only"
55 depends on MACH_SMDK6410
56 help
57 Select CON6 (channel 1) as the MMC/SD slot, as
58 at least some SMDK6410 boards come with the
59 resistors fitted so that the card detects for
60 channels 0 and 1 are the same.
61
62endchoice
diff --git a/arch/arm/mach-s3c6410/Makefile b/arch/arm/mach-s3c6410/Makefile
new file mode 100644
index 000000000000..2cd4f189036b
--- /dev/null
+++ b/arch/arm/mach-s3c6410/Makefile
@@ -0,0 +1,23 @@
1# arch/arm/plat-s3c6410/Makefile
2#
3# Copyright 2008 Openmoko, Inc.
4# Copyright 2008 Simtec Electronics
5#
6# Licensed under GPLv2
7
8obj-y :=
9obj-m :=
10obj-n :=
11obj- :=
12
13# Core support for S3C6410 system
14
15obj-$(CONFIG_CPU_S3C6410) += cpu.o
16
17# Helper and device support
18
19obj-$(CONFIG_S3C6410_SETUP_SDHCI) += setup-sdhci.o
20
21# machine support
22
23obj-$(CONFIG_MACH_SMDK6410) += mach-smdk6410.o
diff --git a/arch/arm/mach-s3c6410/cpu.c b/arch/arm/mach-s3c6410/cpu.c
new file mode 100644
index 000000000000..6a73ca6b7a3a
--- /dev/null
+++ b/arch/arm/mach-s3c6410/cpu.c
@@ -0,0 +1,101 @@
1/* linux/arch/arm/mach-s3c6410/cpu.c
2 *
3 * Copyright 2008 Simtec Electronics
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
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/clk.h>
20#include <linux/io.h>
21#include <linux/sysdev.h>
22#include <linux/serial_core.h>
23#include <linux/platform_device.h>
24
25#include <asm/mach/arch.h>
26#include <asm/mach/map.h>
27#include <asm/mach/irq.h>
28
29#include <mach/hardware.h>
30#include <asm/irq.h>
31
32#include <plat/cpu-freq.h>
33#include <plat/regs-serial.h>
34
35#include <plat/cpu.h>
36#include <plat/devs.h>
37#include <plat/clock.h>
38#include <plat/sdhci.h>
39#include <plat/iic-core.h>
40#include <plat/s3c6400.h>
41#include <plat/s3c6410.h>
42
43/* Initial IO mappings */
44
45static struct map_desc s3c6410_iodesc[] __initdata = {
46};
47
48/* s3c6410_map_io
49 *
50 * register the standard cpu IO areas
51*/
52
53void __init s3c6410_map_io(void)
54{
55 iotable_init(s3c6410_iodesc, ARRAY_SIZE(s3c6410_iodesc));
56
57 /* initialise device information early */
58 s3c6410_default_sdhci0();
59 s3c6410_default_sdhci1();
60
61 /* the i2c devices are directly compatible with s3c2440 */
62 s3c_i2c0_setname("s3c2440-i2c");
63 s3c_i2c1_setname("s3c2440-i2c");
64}
65
66void __init s3c6410_init_clocks(int xtal)
67{
68 printk(KERN_DEBUG "%s: initialising clocks\n", __func__);
69 s3c24xx_register_baseclocks(xtal);
70 s3c64xx_register_clocks();
71 s3c6400_register_clocks();
72 s3c6400_setup_clocks();
73}
74
75void __init s3c6410_init_irq(void)
76{
77 /* VIC0 is missing IRQ7, VIC1 is fully populated. */
78 s3c64xx_init_irq(~0 & ~(1 << 7), ~0);
79}
80
81struct sysdev_class s3c6410_sysclass = {
82 .name = "s3c6410-core",
83};
84
85static struct sys_device s3c6410_sysdev = {
86 .cls = &s3c6410_sysclass,
87};
88
89static int __init s3c6410_core_init(void)
90{
91 return sysdev_class_register(&s3c6410_sysclass);
92}
93
94core_initcall(s3c6410_core_init);
95
96int __init s3c6410_init(void)
97{
98 printk("S3C6410: Initialising architecture\n");
99
100 return sysdev_register(&s3c6410_sysdev);
101}
diff --git a/arch/arm/mach-s3c6410/mach-smdk6410.c b/arch/arm/mach-s3c6410/mach-smdk6410.c
new file mode 100644
index 000000000000..3c4d47145c83
--- /dev/null
+++ b/arch/arm/mach-s3c6410/mach-smdk6410.c
@@ -0,0 +1,185 @@
1/* linux/arch/arm/mach-s3c6410/mach-smdk6410.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
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
14#include <linux/kernel.h>
15#include <linux/types.h>
16#include <linux/interrupt.h>
17#include <linux/list.h>
18#include <linux/timer.h>
19#include <linux/init.h>
20#include <linux/serial_core.h>
21#include <linux/platform_device.h>
22#include <linux/io.h>
23#include <linux/i2c.h>
24#include <linux/fb.h>
25#include <linux/gpio.h>
26#include <linux/delay.h>
27
28#include <video/platform_lcd.h>
29
30#include <asm/mach/arch.h>
31#include <asm/mach/map.h>
32#include <asm/mach/irq.h>
33
34#include <mach/hardware.h>
35#include <mach/regs-fb.h>
36#include <mach/map.h>
37
38#include <asm/irq.h>
39#include <asm/mach-types.h>
40
41#include <plat/regs-serial.h>
42#include <plat/iic.h>
43#include <plat/fb.h>
44
45#include <plat/s3c6410.h>
46#include <plat/clock.h>
47#include <plat/devs.h>
48#include <plat/cpu.h>
49
50#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
51#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
52#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
53
54static struct s3c2410_uartcfg smdk6410_uartcfgs[] __initdata = {
55 [0] = {
56 .hwport = 0,
57 .flags = 0,
58 .ucon = 0x3c5,
59 .ulcon = 0x03,
60 .ufcon = 0x51,
61 },
62 [1] = {
63 .hwport = 1,
64 .flags = 0,
65 .ucon = 0x3c5,
66 .ulcon = 0x03,
67 .ufcon = 0x51,
68 },
69};
70
71/* framebuffer and LCD setup. */
72
73/* GPF15 = LCD backlight control
74 * GPF13 => Panel power
75 * GPN5 = LCD nRESET signal
76 * PWM_TOUT1 => backlight brightness
77 */
78
79static void smdk6410_lcd_power_set(struct plat_lcd_data *pd,
80 unsigned int power)
81{
82 if (power) {
83 gpio_direction_output(S3C64XX_GPF(13), 1);
84 gpio_direction_output(S3C64XX_GPF(15), 1);
85
86 /* fire nRESET on power up */
87 gpio_direction_output(S3C64XX_GPN(5), 0);
88 msleep(10);
89 gpio_direction_output(S3C64XX_GPN(5), 1);
90 msleep(1);
91 } else {
92 gpio_direction_output(S3C64XX_GPF(15), 0);
93 gpio_direction_output(S3C64XX_GPF(13), 0);
94 }
95}
96
97static struct plat_lcd_data smdk6410_lcd_power_data = {
98 .set_power = smdk6410_lcd_power_set,
99};
100
101static struct platform_device smdk6410_lcd_powerdev = {
102 .name = "platform-lcd",
103 .dev.parent = &s3c_device_fb.dev,
104 .dev.platform_data = &smdk6410_lcd_power_data,
105};
106
107static struct s3c_fb_pd_win smdk6410_fb_win0 = {
108 /* this is to ensure we use win0 */
109 .win_mode = {
110 .pixclock = 41094,
111 .left_margin = 8,
112 .right_margin = 13,
113 .upper_margin = 7,
114 .lower_margin = 5,
115 .hsync_len = 3,
116 .vsync_len = 1,
117 .xres = 800,
118 .yres = 480,
119 },
120 .max_bpp = 32,
121 .default_bpp = 16,
122};
123
124/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
125static struct s3c_fb_platdata smdk6410_lcd_pdata __initdata = {
126 .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
127 .win[0] = &smdk6410_fb_win0,
128 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
129 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
130};
131
132struct map_desc smdk6410_iodesc[] = {};
133
134static struct platform_device *smdk6410_devices[] __initdata = {
135#ifdef CONFIG_SMDK6410_SD_CH0
136 &s3c_device_hsmmc0,
137#endif
138#ifdef CONFIG_SMDK6410_SD_CH1
139 &s3c_device_hsmmc1,
140#endif
141 &s3c_device_i2c0,
142 &s3c_device_i2c1,
143 &s3c_device_fb,
144 &smdk6410_lcd_powerdev,
145};
146
147static struct i2c_board_info i2c_devs0[] __initdata = {
148 { I2C_BOARD_INFO("24c08", 0x50), },
149 { I2C_BOARD_INFO("WM8580", 0X1b), },
150};
151
152static struct i2c_board_info i2c_devs1[] __initdata = {
153 { I2C_BOARD_INFO("24c128", 0x57), }, /* Samsung S524AD0XD1 */
154};
155
156static void __init smdk6410_map_io(void)
157{
158 s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc));
159 s3c24xx_init_clocks(12000000);
160 s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs));
161}
162
163static void __init smdk6410_machine_init(void)
164{
165 s3c_i2c0_set_platdata(NULL);
166 s3c_i2c1_set_platdata(NULL);
167 s3c_fb_set_platdata(&smdk6410_lcd_pdata);
168
169 i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
170 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
171
172 platform_add_devices(smdk6410_devices, ARRAY_SIZE(smdk6410_devices));
173}
174
175MACHINE_START(SMDK6410, "SMDK6410")
176 /* Maintainer: Ben Dooks <ben@fluff.org> */
177 .phys_io = S3C_PA_UART & 0xfff00000,
178 .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
179 .boot_params = S3C64XX_PA_SDRAM + 0x100,
180
181 .init_irq = s3c6410_init_irq,
182 .map_io = smdk6410_map_io,
183 .init_machine = smdk6410_machine_init,
184 .timer = &s3c24xx_timer,
185MACHINE_END
diff --git a/arch/arm/mach-s3c6410/setup-sdhci.c b/arch/arm/mach-s3c6410/setup-sdhci.c
new file mode 100644
index 000000000000..0b5788bd5985
--- /dev/null
+++ b/arch/arm/mach-s3c6410/setup-sdhci.c
@@ -0,0 +1,102 @@
1/* linux/arch/arm/mach-s3c6410/setup-sdhci.c
2 *
3 * Copyright 2008 Simtec Electronics
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C6410 - Helper functions for settign up SDHCI device(s) (HSMMC)
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/platform_device.h>
19#include <linux/io.h>
20
21#include <linux/mmc/card.h>
22#include <linux/mmc/host.h>
23
24#include <mach/gpio.h>
25#include <plat/gpio-cfg.h>
26#include <plat/regs-sdhci.h>
27#include <plat/sdhci.h>
28
29/* clock sources for the mmc bus clock, order as for the ctrl2[5..4] */
30
31char *s3c6410_hsmmc_clksrcs[4] = {
32 [0] = "hsmmc",
33 [1] = "hsmmc",
34 [2] = "mmc_bus",
35 /* [3] = "48m", - note not succesfully used yet */
36};
37
38void s3c6410_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
39{
40 unsigned int gpio;
41 unsigned int end;
42
43 end = S3C64XX_GPG(2 + width);
44
45 /* Set all the necessary GPG pins to special-function 0 */
46 for (gpio = S3C64XX_GPG(0); gpio < end; gpio++) {
47 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
48 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
49 }
50
51 s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);
52 s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(2));
53}
54
55void s3c6410_setup_sdhci0_cfg_card(struct platform_device *dev,
56 void __iomem *r,
57 struct mmc_ios *ios,
58 struct mmc_card *card)
59{
60 u32 ctrl2, ctrl3;
61
62 /* don't need to alter anything acording to card-type */
63
64 writel(S3C64XX_SDHCI_CONTROL4_DRIVE_9mA, r + S3C64XX_SDHCI_CONTROL4);
65
66 ctrl2 = readl(r + S3C_SDHCI_CONTROL2);
67 ctrl2 &= S3C_SDHCI_CTRL2_SELBASECLK_MASK;
68 ctrl2 |= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR |
69 S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK |
70 S3C_SDHCI_CTRL2_ENFBCLKRX |
71 S3C_SDHCI_CTRL2_DFCNT_NONE |
72 S3C_SDHCI_CTRL2_ENCLKOUTHOLD);
73
74 if (ios->clock < 25 * 1000000)
75 ctrl3 = (S3C_SDHCI_CTRL3_FCSEL3 |
76 S3C_SDHCI_CTRL3_FCSEL2 |
77 S3C_SDHCI_CTRL3_FCSEL1 |
78 S3C_SDHCI_CTRL3_FCSEL0);
79 else
80 ctrl3 = (S3C_SDHCI_CTRL3_FCSEL1 | S3C_SDHCI_CTRL3_FCSEL0);
81
82 printk(KERN_INFO "%s: CTRL 2=%08x, 3=%08x\n", __func__, ctrl2, ctrl3);
83 writel(ctrl2, r + S3C_SDHCI_CONTROL2);
84 writel(ctrl3, r + S3C_SDHCI_CONTROL3);
85}
86
87void s3c6410_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
88{
89 unsigned int gpio;
90 unsigned int end;
91
92 end = S3C64XX_GPH(2 + width);
93
94 /* Set all the necessary GPG pins to special-function 0 */
95 for (gpio = S3C64XX_GPH(0); gpio < end; gpio++) {
96 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
97 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
98 }
99
100 s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);
101 s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(3));
102}
diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c
index 43c30f84abf2..dab3c6347a8f 100644
--- a/arch/arm/mach-sa1100/clock.c
+++ b/arch/arm/mach-sa1100/clock.c
@@ -3,6 +3,7 @@
3 */ 3 */
4#include <linux/module.h> 4#include <linux/module.h>
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/device.h>
6#include <linux/list.h> 7#include <linux/list.h>
7#include <linux/errno.h> 8#include <linux/errno.h>
8#include <linux/err.h> 9#include <linux/err.h>
@@ -14,36 +15,39 @@
14#include <mach/hardware.h> 15#include <mach/hardware.h>
15 16
16/* 17/*
17 * Very simple clock implementation - we only have one clock to 18 * Very simple clock implementation - we only have one clock to deal with.
18 * deal with at the moment, so we only match using the "name".
19 */ 19 */
20struct clk { 20struct clk {
21 struct list_head node;
22 unsigned long rate;
23 const char *name;
24 unsigned int enabled; 21 unsigned int enabled;
25 void (*enable)(void);
26 void (*disable)(void);
27}; 22};
28 23
29static LIST_HEAD(clocks); 24static void clk_gpio27_enable(void)
30static DEFINE_MUTEX(clocks_mutex); 25{
26 /*
27 * First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111:
28 * (SA-1110 Developer's Manual, section 9.1.2.1)
29 */
30 GAFR |= GPIO_32_768kHz;
31 GPDR |= GPIO_32_768kHz;
32 TUCR = TUCR_3_6864MHz;
33}
34
35static void clk_gpio27_disable(void)
36{
37 TUCR = 0;
38 GPDR &= ~GPIO_32_768kHz;
39 GAFR &= ~GPIO_32_768kHz;
40}
41
42static struct clk clk_gpio27;
43
31static DEFINE_SPINLOCK(clocks_lock); 44static DEFINE_SPINLOCK(clocks_lock);
32 45
33struct clk *clk_get(struct device *dev, const char *id) 46struct clk *clk_get(struct device *dev, const char *id)
34{ 47{
35 struct clk *p, *clk = ERR_PTR(-ENOENT); 48 const char *devname = dev_name(dev);
36
37 mutex_lock(&clocks_mutex);
38 list_for_each_entry(p, &clocks, node) {
39 if (strcmp(id, p->name) == 0) {
40 clk = p;
41 break;
42 }
43 }
44 mutex_unlock(&clocks_mutex);
45 49
46 return clk; 50 return strcmp(devname, "sa1111.0") ? ERR_PTR(-ENOENT) : &clk_gpio27;
47} 51}
48EXPORT_SYMBOL(clk_get); 52EXPORT_SYMBOL(clk_get);
49 53
@@ -58,7 +62,7 @@ int clk_enable(struct clk *clk)
58 62
59 spin_lock_irqsave(&clocks_lock, flags); 63 spin_lock_irqsave(&clocks_lock, flags);
60 if (clk->enabled++ == 0) 64 if (clk->enabled++ == 0)
61 clk->enable(); 65 clk_gpio27_enable();
62 spin_unlock_irqrestore(&clocks_lock, flags); 66 spin_unlock_irqrestore(&clocks_lock, flags);
63 return 0; 67 return 0;
64} 68}
@@ -72,63 +76,13 @@ void clk_disable(struct clk *clk)
72 76
73 spin_lock_irqsave(&clocks_lock, flags); 77 spin_lock_irqsave(&clocks_lock, flags);
74 if (--clk->enabled == 0) 78 if (--clk->enabled == 0)
75 clk->disable(); 79 clk_gpio27_disable();
76 spin_unlock_irqrestore(&clocks_lock, flags); 80 spin_unlock_irqrestore(&clocks_lock, flags);
77} 81}
78EXPORT_SYMBOL(clk_disable); 82EXPORT_SYMBOL(clk_disable);
79 83
80unsigned long clk_get_rate(struct clk *clk) 84unsigned long clk_get_rate(struct clk *clk)
81{ 85{
82 return clk->rate; 86 return 3686400;
83} 87}
84EXPORT_SYMBOL(clk_get_rate); 88EXPORT_SYMBOL(clk_get_rate);
85
86
87static void clk_gpio27_enable(void)
88{
89 /*
90 * First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111:
91 * (SA-1110 Developer's Manual, section 9.1.2.1)
92 */
93 GAFR |= GPIO_32_768kHz;
94 GPDR |= GPIO_32_768kHz;
95 TUCR = TUCR_3_6864MHz;
96}
97
98static void clk_gpio27_disable(void)
99{
100 TUCR = 0;
101 GPDR &= ~GPIO_32_768kHz;
102 GAFR &= ~GPIO_32_768kHz;
103}
104
105static struct clk clk_gpio27 = {
106 .name = "SA1111_CLK",
107 .rate = 3686400,
108 .enable = clk_gpio27_enable,
109 .disable = clk_gpio27_disable,
110};
111
112int clk_register(struct clk *clk)
113{
114 mutex_lock(&clocks_mutex);
115 list_add(&clk->node, &clocks);
116 mutex_unlock(&clocks_mutex);
117 return 0;
118}
119EXPORT_SYMBOL(clk_register);
120
121void clk_unregister(struct clk *clk)
122{
123 mutex_lock(&clocks_mutex);
124 list_del(&clk->node);
125 mutex_unlock(&clocks_mutex);
126}
127EXPORT_SYMBOL(clk_unregister);
128
129static int __init clk_init(void)
130{
131 clk_register(&clk_gpio27);
132 return 0;
133}
134arch_initcall(clk_init);
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index fe289997cfaf..2052eb88c961 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -68,23 +68,22 @@ struct platform_device colliescoop_device = {
68}; 68};
69 69
70static struct scoop_pcmcia_dev collie_pcmcia_scoop[] = { 70static struct scoop_pcmcia_dev collie_pcmcia_scoop[] = {
71{ 71 {
72 .dev = &colliescoop_device.dev, 72 .dev = &colliescoop_device.dev,
73 .irq = COLLIE_IRQ_GPIO_CF_IRQ, 73 .irq = COLLIE_IRQ_GPIO_CF_IRQ,
74 .cd_irq = COLLIE_IRQ_GPIO_CF_CD, 74 .cd_irq = COLLIE_IRQ_GPIO_CF_CD,
75 .cd_irq_str = "PCMCIA0 CD", 75 .cd_irq_str = "PCMCIA0 CD",
76}, 76 },
77}; 77};
78 78
79static struct scoop_pcmcia_config collie_pcmcia_config = { 79static struct scoop_pcmcia_config collie_pcmcia_config = {
80 .devs = &collie_pcmcia_scoop[0], 80 .devs = &collie_pcmcia_scoop[0],
81 .num_devs = 1, 81 .num_devs = 1,
82}; 82};
83 83
84
85static struct mcp_plat_data collie_mcp_data = { 84static struct mcp_plat_data collie_mcp_data = {
86 .mccr0 = MCCR0_ADM | MCCR0_ExtClk, 85 .mccr0 = MCCR0_ADM | MCCR0_ExtClk,
87 .sclk_rate = 9216000, 86 .sclk_rate = 9216000,
88}; 87};
89 88
90#ifdef CONFIG_SHARP_LOCOMO 89#ifdef CONFIG_SHARP_LOCOMO
@@ -95,14 +94,14 @@ struct platform_device collie_locomo_device;
95 94
96static void collie_uart_set_mctrl(struct uart_port *port, u_int mctrl) 95static void collie_uart_set_mctrl(struct uart_port *port, u_int mctrl)
97{ 96{
98 if (mctrl & TIOCM_RTS) 97 if (mctrl & TIOCM_RTS)
99 locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_RTS, 0); 98 locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_RTS, 0);
100 else 99 else
101 locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_RTS, 1); 100 locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_RTS, 1);
102 101
103 if (mctrl & TIOCM_DTR) 102 if (mctrl & TIOCM_DTR)
104 locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_DTR, 0); 103 locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_DTR, 0);
105 else 104 else
106 locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_DTR, 1); 105 locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_DTR, 1);
107} 106}
108 107
diff --git a/arch/arm/mach-sa1100/collie_pm.c b/arch/arm/mach-sa1100/collie_pm.c
index b1161fc80602..b39307f26b52 100644
--- a/arch/arm/mach-sa1100/collie_pm.c
+++ b/arch/arm/mach-sa1100/collie_pm.c
@@ -26,7 +26,7 @@
26#include <asm/irq.h> 26#include <asm/irq.h>
27#include <mach/hardware.h> 27#include <mach/hardware.h>
28#include <asm/hardware/scoop.h> 28#include <asm/hardware/scoop.h>
29#include <asm/dma.h> 29#include <mach/dma.h>
30#include <mach/collie.h> 30#include <mach/collie.h>
31#include <asm/mach/sharpsl_param.h> 31#include <asm/mach/sharpsl_param.h>
32#include <asm/hardware/sharpsl_pm.h> 32#include <asm/hardware/sharpsl_pm.h>
@@ -263,24 +263,24 @@ static int __init collie_pm_ucb_add(struct ucb1x00_dev *pdev)
263} 263}
264 264
265static struct ucb1x00_driver collie_pm_ucb_driver = { 265static struct ucb1x00_driver collie_pm_ucb_driver = {
266 .add = collie_pm_ucb_add, 266 .add = collie_pm_ucb_add,
267}; 267};
268 268
269static struct platform_device *collie_pm_device; 269static struct platform_device *collie_pm_device;
270 270
271static int __init collie_pm_init(void) 271static int __init collie_pm_init(void)
272{ 272{
273 int ret; 273 int ret;
274 274
275 collie_pm_device = platform_device_alloc("sharpsl-pm", -1); 275 collie_pm_device = platform_device_alloc("sharpsl-pm", -1);
276 if (!collie_pm_device) 276 if (!collie_pm_device)
277 return -ENOMEM; 277 return -ENOMEM;
278 278
279 collie_pm_device->dev.platform_data = &collie_pm_machinfo; 279 collie_pm_device->dev.platform_data = &collie_pm_machinfo;
280 ret = platform_device_add(collie_pm_device); 280 ret = platform_device_add(collie_pm_device);
281 281
282 if (ret) 282 if (ret)
283 platform_device_put(collie_pm_device); 283 platform_device_put(collie_pm_device);
284 284
285 if (!ret) 285 if (!ret)
286 ret = ucb1x00_register_driver(&collie_pm_ucb_driver); 286 ret = ucb1x00_register_driver(&collie_pm_ucb_driver);
@@ -291,7 +291,7 @@ static int __init collie_pm_init(void)
291static void __exit collie_pm_exit(void) 291static void __exit collie_pm_exit(void)
292{ 292{
293 ucb1x00_unregister_driver(&collie_pm_ucb_driver); 293 ucb1x00_unregister_driver(&collie_pm_ucb_driver);
294 platform_device_unregister(collie_pm_device); 294 platform_device_unregister(collie_pm_device);
295} 295}
296 296
297module_init(collie_pm_init); 297module_init(collie_pm_init);
diff --git a/arch/arm/mach-sa1100/cpu-sa1100.c b/arch/arm/mach-sa1100/cpu-sa1100.c
index 244d5956312c..ef817876a5d6 100644
--- a/arch/arm/mach-sa1100/cpu-sa1100.c
+++ b/arch/arm/mach-sa1100/cpu-sa1100.c
@@ -3,17 +3,17 @@
3 * 3 *
4 * Copyright (C) 2000 2001, The Delft University of Technology 4 * Copyright (C) 2000 2001, The Delft University of Technology
5 * 5 *
6 * Authors: 6 * Authors:
7 * - Johan Pouwelse (J.A.Pouwelse@its.tudelft.nl): initial version 7 * - Johan Pouwelse (J.A.Pouwelse@its.tudelft.nl): initial version
8 * - Erik Mouw (J.A.K.Mouw@its.tudelft.nl): 8 * - Erik Mouw (J.A.K.Mouw@its.tudelft.nl):
9 * - major rewrite for linux-2.3.99 9 * - major rewrite for linux-2.3.99
10 * - rewritten for the more generic power management scheme in 10 * - rewritten for the more generic power management scheme in
11 * linux-2.4.5-rmk1 11 * linux-2.4.5-rmk1
12 * 12 *
13 * This software has been developed while working on the LART 13 * This software has been developed while working on the LART
14 * computing board (http://www.lartmaker.nl/), which is 14 * computing board (http://www.lartmaker.nl/), which is
15 * sponsored by the Mobile Multi-media Communications 15 * sponsored by the Mobile Multi-media Communications
16 * (http://www.mmc.tudelft.nl/) and Ubiquitous Communications 16 * (http://www.mmc.tudelft.nl/) and Ubiquitous Communications
17 * (http://www.ubicom.tudelft.nl/) projects. 17 * (http://www.ubicom.tudelft.nl/) projects.
18 * 18 *
19 * The authors can be reached at: 19 * The authors can be reached at:
@@ -36,7 +36,7 @@
36 * but WITHOUT ANY WARRANTY; without even the implied warranty of 36 * but WITHOUT ANY WARRANTY; without even the implied warranty of
37 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 37 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38 * GNU General Public License for more details. 38 * GNU General Public License for more details.
39 * 39 *
40 * You should have received a copy of the GNU General Public License 40 * You should have received a copy of the GNU General Public License
41 * along with this program; if not, write to the Free Software 41 * along with this program; if not, write to the Free Software
42 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 42 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -44,7 +44,7 @@
44 * 44 *
45 * Theory of operations 45 * Theory of operations
46 * ==================== 46 * ====================
47 * 47 *
48 * Clock scaling can be used to lower the power consumption of the CPU 48 * Clock scaling can be used to lower the power consumption of the CPU
49 * core. This will give you a somewhat longer running time. 49 * core. This will give you a somewhat longer running time.
50 * 50 *
@@ -58,11 +58,11 @@
58 * MDCNFG 0xA0000000 DRAM config 58 * MDCNFG 0xA0000000 DRAM config
59 * MDCAS0 0xA0000004 Access waveform 59 * MDCAS0 0xA0000004 Access waveform
60 * MDCAS1 0xA0000008 Access waveform 60 * MDCAS1 0xA0000008 Access waveform
61 * MDCAS2 0xA000000C Access waveform 61 * MDCAS2 0xA000000C Access waveform
62 * 62 *
63 * Care must be taken to change the DRAM parameters the correct way, 63 * Care must be taken to change the DRAM parameters the correct way,
64 * because otherwise the DRAM becomes unusable and the kernel will 64 * because otherwise the DRAM becomes unusable and the kernel will
65 * crash. 65 * crash.
66 * 66 *
67 * The simple solution to avoid a kernel crash is to put the actual 67 * The simple solution to avoid a kernel crash is to put the actual
68 * clock change in ROM and jump to that code from the kernel. The main 68 * clock change in ROM and jump to that code from the kernel. The main
@@ -75,7 +75,7 @@
75 * as long as all re-configuration steps yield a valid DRAM 75 * as long as all re-configuration steps yield a valid DRAM
76 * configuration. The advantages are clear: it will run on all SA-1100 76 * configuration. The advantages are clear: it will run on all SA-1100
77 * platforms, and the code is very simple. 77 * platforms, and the code is very simple.
78 * 78 *
79 * If you really want to understand what is going on in 79 * If you really want to understand what is going on in
80 * sa1100_update_dram_timings(), you'll have to read sections 8.2, 80 * sa1100_update_dram_timings(), you'll have to read sections 8.2,
81 * 9.5.7.3, and 10.2 from the "Intel StrongARM SA-1100 Microprocessor 81 * 9.5.7.3, and 10.2 from the "Intel StrongARM SA-1100 Microprocessor
@@ -97,7 +97,7 @@
97typedef struct { 97typedef struct {
98 int speed; 98 int speed;
99 u32 mdcnfg; 99 u32 mdcnfg;
100 u32 mdcas0; 100 u32 mdcas0;
101 u32 mdcas1; 101 u32 mdcas1;
102 u32 mdcas2; 102 u32 mdcas2;
103} sa1100_dram_regs_t; 103} sa1100_dram_regs_t;
@@ -147,7 +147,7 @@ static void sa1100_update_dram_timings(int current_speed, int new_speed)
147 /* No risk, no fun: run with interrupts on! */ 147 /* No risk, no fun: run with interrupts on! */
148 if (new_speed > current_speed) { 148 if (new_speed > current_speed) {
149 /* We're going FASTER, so first relax the memory 149 /* We're going FASTER, so first relax the memory
150 * timings before changing the core frequency 150 * timings before changing the core frequency
151 */ 151 */
152 152
153 /* Half the memory access clock */ 153 /* Half the memory access clock */
diff --git a/arch/arm/mach-sa1100/cpu-sa1110.c b/arch/arm/mach-sa1100/cpu-sa1110.c
index 3e4fb214eada..63b32b68b296 100644
--- a/arch/arm/mach-sa1100/cpu-sa1110.c
+++ b/arch/arm/mach-sa1100/cpu-sa1110.c
@@ -81,14 +81,14 @@ static struct sdram_params sdram_tbl[] __initdata = {
81 .twr = 9, 81 .twr = 9,
82 .refresh = 64000, 82 .refresh = 64000,
83 .cas_latency = 3, 83 .cas_latency = 3,
84 }, { /* Samsung K4S281632B-1H */ 84 }, { /* Samsung K4S281632B-1H */
85 .name = "K4S281632B-1H", 85 .name = "K4S281632B-1H",
86 .rows = 12, 86 .rows = 12,
87 .tck = 10, 87 .tck = 10,
88 .trp = 20, 88 .trp = 20,
89 .twr = 10, 89 .twr = 10,
90 .refresh = 64000, 90 .refresh = 64000,
91 .cas_latency = 3, 91 .cas_latency = 3,
92 }, { /* Samsung KM416S4030CT */ 92 }, { /* Samsung KM416S4030CT */
93 .name = "KM416S4030CT", 93 .name = "KM416S4030CT",
94 .rows = 13, 94 .rows = 13,
@@ -220,7 +220,7 @@ sdram_update_refresh(u_int cpu_khz, struct sdram_params *sdram)
220} 220}
221 221
222/* 222/*
223 * Ok, set the CPU frequency. 223 * Ok, set the CPU frequency.
224 */ 224 */
225static int sa1110_target(struct cpufreq_policy *policy, 225static int sa1110_target(struct cpufreq_policy *policy,
226 unsigned int target_freq, 226 unsigned int target_freq,
diff --git a/arch/arm/mach-sa1100/dma.c b/arch/arm/mach-sa1100/dma.c
index f990a3e85846..95f9c5a6d6d5 100644
--- a/arch/arm/mach-sa1100/dma.c
+++ b/arch/arm/mach-sa1100/dma.c
@@ -19,7 +19,7 @@
19#include <asm/system.h> 19#include <asm/system.h>
20#include <asm/irq.h> 20#include <asm/irq.h>
21#include <mach/hardware.h> 21#include <mach/hardware.h>
22#include <asm/dma.h> 22#include <mach/dma.h>
23 23
24 24
25#undef DEBUG 25#undef DEBUG
@@ -113,10 +113,10 @@ int sa1100_request_dma (dma_device_t device, const char *device_id,
113 } 113 }
114 } 114 }
115 if (!err) { 115 if (!err) {
116 if (dma) 116 if (dma)
117 dma->device = device; 117 dma->device = device;
118 else 118 else
119 err = -ENOSR; 119 err = -ENOSR;
120 } 120 }
121 spin_unlock(&dma_list_lock); 121 spin_unlock(&dma_list_lock);
122 if (err) 122 if (err)
diff --git a/arch/arm/mach-sa1100/include/mach/h3600.h b/arch/arm/mach-sa1100/include/mach/h3600.h
index 3ca0ecf095e6..9cc47fddb335 100644
--- a/arch/arm/mach-sa1100/include/mach/h3600.h
+++ b/arch/arm/mach-sa1100/include/mach/h3600.h
@@ -32,14 +32,14 @@ typedef int __bitwise pm_request_t;
32#define machine_is_h3xxx() (machine_is_h3100() || machine_is_h3600() || machine_is_h3800()) 32#define machine_is_h3xxx() (machine_is_h3100() || machine_is_h3600() || machine_is_h3800())
33 33
34/* Physical memory regions corresponding to chip selects */ 34/* Physical memory regions corresponding to chip selects */
35#define H3600_EGPIO_PHYS (SA1100_CS5_PHYS + 0x01000000) 35#define H3600_EGPIO_PHYS (SA1100_CS5_PHYS + 0x01000000)
36#define H3600_BANK_2_PHYS SA1100_CS2_PHYS 36#define H3600_BANK_2_PHYS SA1100_CS2_PHYS
37#define H3600_BANK_4_PHYS SA1100_CS4_PHYS 37#define H3600_BANK_4_PHYS SA1100_CS4_PHYS
38 38
39/* Virtual memory regions corresponding to chip selects 2 & 4 (used on sleeves) */ 39/* Virtual memory regions corresponding to chip selects 2 & 4 (used on sleeves) */
40#define H3600_EGPIO_VIRT 0xf0000000 40#define H3600_EGPIO_VIRT 0xf0000000
41#define H3600_BANK_2_VIRT 0xf1000000 41#define H3600_BANK_2_VIRT 0xf1000000
42#define H3600_BANK_4_VIRT 0xf3800000 42#define H3600_BANK_4_VIRT 0xf3800000
43 43
44/* 44/*
45 Machine-independent GPIO definitions 45 Machine-independent GPIO definitions
diff --git a/arch/arm/mach-sa1100/include/mach/hardware.h b/arch/arm/mach-sa1100/include/mach/hardware.h
index b70846c096aa..60711822b125 100644
--- a/arch/arm/mach-sa1100/include/mach/hardware.h
+++ b/arch/arm/mach-sa1100/include/mach/hardware.h
@@ -59,6 +59,10 @@
59# define __REG(x) (*((volatile unsigned long *)io_p2v(x))) 59# define __REG(x) (*((volatile unsigned long *)io_p2v(x)))
60# define __PREG(x) (io_v2p((unsigned long)&(x))) 60# define __PREG(x) (io_v2p((unsigned long)&(x)))
61 61
62static inline unsigned long get_clock_tick_rate(void)
63{
64 return 3686400;
65}
62#else 66#else
63 67
64# define __REG(x) io_p2v(x) 68# define __REG(x) io_p2v(x)
diff --git a/arch/arm/mach-sa1100/include/mach/io.h b/arch/arm/mach-sa1100/include/mach/io.h
index 0c070a6149bc..d8b43f3dcd2d 100644
--- a/arch/arm/mach-sa1100/include/mach/io.h
+++ b/arch/arm/mach-sa1100/include/mach/io.h
@@ -16,11 +16,7 @@
16 * We don't actually have real ISA nor PCI buses, but there is so many 16 * We don't actually have real ISA nor PCI buses, but there is so many
17 * drivers out there that might just work if we fake them... 17 * drivers out there that might just work if we fake them...
18 */ 18 */
19static inline void __iomem *__io(unsigned long addr) 19#define __io(a) __typesafe_io(a)
20{ 20#define __mem_pci(a) (a)
21 return (void __iomem *)addr;
22}
23#define __io(a) __io(a)
24#define __mem_pci(a) (a)
25 21
26#endif 22#endif
diff --git a/arch/arm/mach-sa1100/include/mach/memory.h b/arch/arm/mach-sa1100/include/mach/memory.h
index 1c127b68581d..e9f8eed900f5 100644
--- a/arch/arm/mach-sa1100/include/mach/memory.h
+++ b/arch/arm/mach-sa1100/include/mach/memory.h
@@ -23,23 +23,12 @@ void sa1111_adjust_zones(int node, unsigned long *size, unsigned long *holes);
23 sa1111_adjust_zones(node, size, holes) 23 sa1111_adjust_zones(node, size, holes)
24 24
25#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_1M - 1) 25#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_1M - 1)
26#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_1M)
26 27
27#endif 28#endif
28#endif 29#endif
29 30
30/* 31/*
31 * Virtual view <-> DMA view memory address translations
32 * virt_to_bus: Used to translate the virtual address to an
33 * address suitable to be passed to set_dma_addr
34 * bus_to_virt: Used to convert an address for DMA operations
35 * to an address that the kernel can use.
36 *
37 * On the SA1100, bus addresses are equivalent to physical addresses.
38 */
39#define __virt_to_bus(x) __virt_to_phys(x)
40#define __bus_to_virt(x) __phys_to_virt(x)
41
42/*
43 * Because of the wide memory address space between physical RAM banks on the 32 * Because of the wide memory address space between physical RAM banks on the
44 * SA1100, it's much convenient to use Linux's SparseMEM support to implement 33 * SA1100, it's much convenient to use Linux's SparseMEM support to implement
45 * our memory map representation. Assuming all memory nodes have equal access 34 * our memory map representation. Assuming all memory nodes have equal access
diff --git a/arch/arm/mach-sa1100/include/mach/mtd-xip.h b/arch/arm/mach-sa1100/include/mach/mtd-xip.h
index eaa09e86ad16..b3d684098fbf 100644
--- a/arch/arm/mach-sa1100/include/mach/mtd-xip.h
+++ b/arch/arm/mach-sa1100/include/mach/mtd-xip.h
@@ -15,6 +15,8 @@
15#ifndef __ARCH_SA1100_MTD_XIP_H__ 15#ifndef __ARCH_SA1100_MTD_XIP_H__
16#define __ARCH_SA1100_MTD_XIP_H__ 16#define __ARCH_SA1100_MTD_XIP_H__
17 17
18#include <mach/hardware.h>
19
18#define xip_irqpending() (ICIP & ICMR) 20#define xip_irqpending() (ICIP & ICMR)
19 21
20/* we sample OSCR and convert desired delta to usec (1/4 ~= 1000000/3686400) */ 22/* we sample OSCR and convert desired delta to usec (1/4 ~= 1000000/3686400) */
diff --git a/arch/arm/mach-sa1100/pleb.c b/arch/arm/mach-sa1100/pleb.c
index e45d3a1890bc..e1458bc1868e 100644
--- a/arch/arm/mach-sa1100/pleb.c
+++ b/arch/arm/mach-sa1100/pleb.c
@@ -122,12 +122,12 @@ static void __init pleb_map_io(void)
122 sa1100_map_io(); 122 sa1100_map_io();
123 123
124 sa1100_register_uart(0, 3); 124 sa1100_register_uart(0, 3);
125 sa1100_register_uart(1, 1); 125 sa1100_register_uart(1, 1);
126 126
127 GAFR |= (GPIO_UART_TXD | GPIO_UART_RXD); 127 GAFR |= (GPIO_UART_TXD | GPIO_UART_RXD);
128 GPDR |= GPIO_UART_TXD; 128 GPDR |= GPIO_UART_TXD;
129 GPDR &= ~GPIO_UART_RXD; 129 GPDR &= ~GPIO_UART_RXD;
130 PPAR |= PPAR_UPR; 130 PPAR |= PPAR_UPR;
131 131
132 /* 132 /*
133 * Fix expansion memory timing for network card 133 * Fix expansion memory timing for network card
diff --git a/arch/arm/mach-sa1100/shannon.c b/arch/arm/mach-sa1100/shannon.c
index 9ccdd09cf69f..ddd917d1083d 100644
--- a/arch/arm/mach-sa1100/shannon.c
+++ b/arch/arm/mach-sa1100/shannon.c
@@ -33,7 +33,7 @@ static struct mtd_partition shannon_partitions[] = {
33 .offset = MTDPART_OFS_APPEND, 33 .offset = MTDPART_OFS_APPEND,
34 .size = 0xe0000 34 .size = 0xe0000
35 }, 35 },
36 { 36 {
37 .name = "initrd", 37 .name = "initrd",
38 .offset = MTDPART_OFS_APPEND, 38 .offset = MTDPART_OFS_APPEND,
39 .size = MTDPART_SIZ_FULL 39 .size = MTDPART_SIZ_FULL
diff --git a/arch/arm/mach-sa1100/sleep.S b/arch/arm/mach-sa1100/sleep.S
index 171441f96710..80f31bad707c 100644
--- a/arch/arm/mach-sa1100/sleep.S
+++ b/arch/arm/mach-sa1100/sleep.S
@@ -100,36 +100,36 @@ ENTRY(sa1100_cpu_suspend)
100 ldr r1, =MSC1 100 ldr r1, =MSC1
101 ldr r2, =MSC2 101 ldr r2, =MSC2
102 102
103 ldr r3, [r0] 103 ldr r3, [r0]
104 bic r3, r3, #FMsk(MSC_RT) 104 bic r3, r3, #FMsk(MSC_RT)
105 bic r3, r3, #FMsk(MSC_RT)<<16 105 bic r3, r3, #FMsk(MSC_RT)<<16
106 106
107 ldr r4, [r1] 107 ldr r4, [r1]
108 bic r4, r4, #FMsk(MSC_RT) 108 bic r4, r4, #FMsk(MSC_RT)
109 bic r4, r4, #FMsk(MSC_RT)<<16 109 bic r4, r4, #FMsk(MSC_RT)<<16
110 110
111 ldr r5, [r2] 111 ldr r5, [r2]
112 bic r5, r5, #FMsk(MSC_RT) 112 bic r5, r5, #FMsk(MSC_RT)
113 bic r5, r5, #FMsk(MSC_RT)<<16 113 bic r5, r5, #FMsk(MSC_RT)<<16
114 114
115 ldr r6, =MDREFR 115 ldr r6, =MDREFR
116 116
117 ldr r7, [r6] 117 ldr r7, [r6]
118 bic r7, r7, #0x0000FF00 118bic r7, r7, #0x0000FF00
119 bic r7, r7, #0x000000F0 119bic r7, r7, #0x000000F0
120 orr r8, r7, #MDREFR_SLFRSH 120orr r8, r7, #MDREFR_SLFRSH
121 121
122 ldr r9, =MDCNFG 122 ldr r9, =MDCNFG
123 ldr r10, [r9] 123 ldr r10, [r9]
124 bic r10, r10, #(MDCNFG_DE0+MDCNFG_DE1) 124 bic r10, r10, #(MDCNFG_DE0+MDCNFG_DE1)
125 bic r10, r10, #(MDCNFG_DE2+MDCNFG_DE3) 125 bic r10, r10, #(MDCNFG_DE2+MDCNFG_DE3)
126 126
127 bic r11, r8, #MDREFR_SLFRSH 127 bic r11, r8, #MDREFR_SLFRSH
128 bic r11, r11, #MDREFR_E1PIN 128 bic r11, r11, #MDREFR_E1PIN
129 129
130 ldr r12, =PMCR 130 ldr r12, =PMCR
131 131
132 mov r13, #PMCR_SF 132 mov r13, #PMCR_SF
133 133
134 b sa1110_sdram_controller_fix 134 b sa1110_sdram_controller_fix
135 135
@@ -188,10 +188,10 @@ ENTRY(sa1100_cpu_resume)
188 mcr p15, 0, r1, c8, c7, 0 @ flush I+D TLBs 188 mcr p15, 0, r1, c8, c7, 0 @ flush I+D TLBs
189 mcr p15, 0, r1, c7, c7, 0 @ flush I&D cache 189 mcr p15, 0, r1, c7, c7, 0 @ flush I&D cache
190 mcr p15, 0, r1, c9, c0, 0 @ invalidate RB 190 mcr p15, 0, r1, c9, c0, 0 @ invalidate RB
191 mcr p15, 0, r1, c9, c0, 5 @ allow user space to use RB 191 mcr p15, 0, r1, c9, c0, 5 @ allow user space to use RB
192 192
193 mcr p15, 0, r4, c3, c0, 0 @ domain ID 193 mcr p15, 0, r4, c3, c0, 0 @ domain ID
194 mcr p15, 0, r5, c2, c0, 0 @ translation table base addr 194 mcr p15, 0, r5, c2, c0, 0 @ translation table base addr
195 mcr p15, 0, r6, c13, c0, 0 @ PID 195 mcr p15, 0, r6, c13, c0, 0 @ PID
196 b resume_turn_on_mmu @ cache align execution 196 b resume_turn_on_mmu @ cache align execution
197 197
@@ -209,7 +209,7 @@ sleep_save_sp:
209 209
210 .text 210 .text
211resume_after_mmu: 211resume_after_mmu:
212 mcr p15, 0, r1, c15, c1, 2 @ enable clock switching 212 mcr p15, 0, r1, c15, c1, 2 @ enable clock switching
213 ldmfd sp!, {r4 - r12, pc} @ return to caller 213 ldmfd sp!, {r4 - r12, pc} @ return to caller
214 214
215 215
diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c
index 24c0a4bae850..711c0295c66f 100644
--- a/arch/arm/mach-sa1100/time.c
+++ b/arch/arm/mach-sa1100/time.c
@@ -2,8 +2,8 @@
2 * linux/arch/arm/mach-sa1100/time.c 2 * linux/arch/arm/mach-sa1100/time.c
3 * 3 *
4 * Copyright (C) 1998 Deborah Wallach. 4 * Copyright (C) 1998 Deborah Wallach.
5 * Twiddles (C) 1999 Hugo Fiennes <hugo@empeg.com> 5 * Twiddles (C) 1999 Hugo Fiennes <hugo@empeg.com>
6 * 6 *
7 * 2000/03/29 (C) Nicolas Pitre <nico@cam.org> 7 * 2000/03/29 (C) Nicolas Pitre <nico@cam.org>
8 * Rewritten: big cleanup, much simpler, better HZ accuracy. 8 * Rewritten: big cleanup, much simpler, better HZ accuracy.
9 * 9 *
@@ -73,7 +73,6 @@ static struct clock_event_device ckevt_sa1100_osmr0 = {
73 .features = CLOCK_EVT_FEAT_ONESHOT, 73 .features = CLOCK_EVT_FEAT_ONESHOT,
74 .shift = 32, 74 .shift = 32,
75 .rating = 200, 75 .rating = 200,
76 .cpumask = CPU_MASK_CPU0,
77 .set_next_event = sa1100_osmr0_set_next_event, 76 .set_next_event = sa1100_osmr0_set_next_event,
78 .set_mode = sa1100_osmr0_set_mode, 77 .set_mode = sa1100_osmr0_set_mode,
79}; 78};
@@ -110,6 +109,7 @@ static void __init sa1100_timer_init(void)
110 clockevent_delta2ns(0x7fffffff, &ckevt_sa1100_osmr0); 109 clockevent_delta2ns(0x7fffffff, &ckevt_sa1100_osmr0);
111 ckevt_sa1100_osmr0.min_delta_ns = 110 ckevt_sa1100_osmr0.min_delta_ns =
112 clockevent_delta2ns(MIN_OSCR_DELTA * 2, &ckevt_sa1100_osmr0) + 1; 111 clockevent_delta2ns(MIN_OSCR_DELTA * 2, &ckevt_sa1100_osmr0) + 1;
112 ckevt_sa1100_osmr0.cpumask = cpumask_of(0);
113 113
114 cksrc_sa1100_oscr.mult = 114 cksrc_sa1100_oscr.mult =
115 clocksource_hz2mult(CLOCK_TICK_RATE, cksrc_sa1100_oscr.shift); 115 clocksource_hz2mult(CLOCK_TICK_RATE, cksrc_sa1100_oscr.shift);
diff --git a/arch/arm/mach-shark/core.c b/arch/arm/mach-shark/core.c
index a9400d984451..a23fd3d0163a 100644
--- a/arch/arm/mach-shark/core.c
+++ b/arch/arm/mach-shark/core.c
@@ -16,6 +16,8 @@
16#include <asm/leds.h> 16#include <asm/leds.h>
17#include <asm/param.h> 17#include <asm/param.h>
18 18
19#include <mach/hardware.h>
20
19#include <asm/mach/map.h> 21#include <asm/mach/map.h>
20#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
21#include <asm/mach/time.h> 23#include <asm/mach/time.h>
diff --git a/arch/arm/mach-shark/include/mach/hardware.h b/arch/arm/mach-shark/include/mach/hardware.h
index cb0ee2943c1a..01bf76099ce5 100644
--- a/arch/arm/mach-shark/include/mach/hardware.h
+++ b/arch/arm/mach-shark/include/mach/hardware.h
@@ -28,8 +28,6 @@
28#define ROMCARD_SIZE 0x08000000 28#define ROMCARD_SIZE 0x08000000
29#define ROMCARD_START 0x10000000 29#define ROMCARD_START 0x10000000
30 30
31#define PCIO_BASE 0xe0000000
32
33 31
34/* defines for the Framebuffer */ 32/* defines for the Framebuffer */
35#define FB_START 0x06000000 33#define FB_START 0x06000000
diff --git a/arch/arm/mach-shark/include/mach/io.h b/arch/arm/mach-shark/include/mach/io.h
index 92475922c068..c5cee829fc87 100644
--- a/arch/arm/mach-shark/include/mach/io.h
+++ b/arch/arm/mach-shark/include/mach/io.h
@@ -11,46 +11,10 @@
11#ifndef __ASM_ARM_ARCH_IO_H 11#ifndef __ASM_ARM_ARCH_IO_H
12#define __ASM_ARM_ARCH_IO_H 12#define __ASM_ARM_ARCH_IO_H
13 13
14#include <mach/hardware.h> 14#define PCIO_BASE 0xe0000000
15#define IO_SPACE_LIMIT 0xffffffff
15 16
16#define IO_SPACE_LIMIT 0xffffffff 17#define __io(a) ((void __iomem *)(PCIO_BASE + (a)))
17 18#define __mem_pci(addr) (addr)
18/*
19 * We use two different types of addressing - PC style addresses, and ARM
20 * addresses. PC style accesses the PC hardware with the normal PC IO
21 * addresses, eg 0x3f8 for serial#1. ARM addresses are 0x80000000+
22 * and are translated to the start of IO.
23 */
24#define __PORT_PCIO(x) (!((x) & 0x80000000))
25
26#define __io(a) ((void __iomem *)(PCIO_BASE + (a)))
27
28
29static inline unsigned int __ioaddr (unsigned int port) \
30{ \
31 if (__PORT_PCIO(port)) \
32 return (unsigned int)(PCIO_BASE + (port)); \
33 else \
34 return (unsigned int)(IO_BASE + (port)); \
35}
36
37#define __mem_pci(addr) (addr)
38
39/*
40 * Translated address IO functions
41 *
42 * IO address has already been translated to a virtual address
43 */
44#define outb_t(v,p) \
45 (*(volatile unsigned char *)(p) = (v))
46
47#define inb_t(p) \
48 (*(volatile unsigned char *)(p))
49
50#define outl_t(v,p) \
51 (*(volatile unsigned long *)(p) = (v))
52
53#define inl_t(p) \
54 (*(volatile unsigned long *)(p))
55 19
56#endif 20#endif
diff --git a/arch/arm/mach-shark/include/mach/dma.h b/arch/arm/mach-shark/include/mach/isa-dma.h
index c0a29bd2a74f..864298ff3927 100644
--- a/arch/arm/mach-shark/include/mach/dma.h
+++ b/arch/arm/mach-shark/include/mach/isa-dma.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/arm/mach-shark/include/mach/dma.h 2 * arch/arm/mach-shark/include/mach/isa-dma.h
3 * 3 *
4 * by Alexander Schulz 4 * by Alexander Schulz
5 */ 5 */
@@ -10,7 +10,6 @@
10 * The rest is not DMAable. See dev / .properties 10 * The rest is not DMAable. See dev / .properties
11 * in OpenFirmware. 11 * in OpenFirmware.
12 */ 12 */
13#define MAX_DMA_ADDRESS 0xC0400000
14#define MAX_DMA_CHANNELS 8 13#define MAX_DMA_CHANNELS 8
15#define DMA_ISA_CASCADE 4 14#define DMA_ISA_CASCADE 4
16 15
diff --git a/arch/arm/mach-shark/include/mach/memory.h b/arch/arm/mach-shark/include/mach/memory.h
index b7874ad9f9f6..c5ab038925d6 100644
--- a/arch/arm/mach-shark/include/mach/memory.h
+++ b/arch/arm/mach-shark/include/mach/memory.h
@@ -33,12 +33,10 @@ static inline void __arch_adjust_zones(int node, unsigned long *zone_size, unsig
33 __arch_adjust_zones(node, size, holes) 33 __arch_adjust_zones(node, size, holes)
34 34
35#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_4M - 1) 35#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_4M - 1)
36#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_4M)
36 37
37#endif 38#endif
38 39
39#define __virt_to_bus(x) __virt_to_phys(x)
40#define __bus_to_virt(x) __phys_to_virt(x)
41
42/* 40/*
43 * Cache flushing area 41 * Cache flushing area
44 */ 42 */
diff --git a/arch/arm/mach-versatile/Kconfig b/arch/arm/mach-versatile/Kconfig
index 95096afd5271..c781f30c8368 100644
--- a/arch/arm/mach-versatile/Kconfig
+++ b/arch/arm/mach-versatile/Kconfig
@@ -3,12 +3,14 @@ menu "Versatile platform type"
3 3
4config ARCH_VERSATILE_PB 4config ARCH_VERSATILE_PB
5 bool "Support Versatile/PB platform" 5 bool "Support Versatile/PB platform"
6 select CPU_ARM926T
6 default y 7 default y
7 help 8 help
8 Include support for the ARM(R) Versatile/PB platform. 9 Include support for the ARM(R) Versatile/PB platform.
9 10
10config MACH_VERSATILE_AB 11config MACH_VERSATILE_AB
11 bool "Support Versatile/AB platform" 12 bool "Support Versatile/AB platform"
13 select CPU_ARM926T
12 help 14 help
13 Include support for the ARM(R) Versatile/AP platform. 15 Include support for the ARM(R) Versatile/AP platform.
14 16
diff --git a/arch/arm/mach-versatile/clock.c b/arch/arm/mach-versatile/clock.c
index 58937f1fb38c..c50a44ea7ee6 100644
--- a/arch/arm/mach-versatile/clock.c
+++ b/arch/arm/mach-versatile/clock.c
@@ -10,6 +10,7 @@
10 */ 10 */
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/device.h>
13#include <linux/list.h> 14#include <linux/list.h>
14#include <linux/errno.h> 15#include <linux/errno.h>
15#include <linux/err.h> 16#include <linux/err.h>
@@ -17,36 +18,11 @@
17#include <linux/clk.h> 18#include <linux/clk.h>
18#include <linux/mutex.h> 19#include <linux/mutex.h>
19 20
21#include <asm/clkdev.h>
20#include <asm/hardware/icst307.h> 22#include <asm/hardware/icst307.h>
21 23
22#include "clock.h" 24#include "clock.h"
23 25
24static LIST_HEAD(clocks);
25static DEFINE_MUTEX(clocks_mutex);
26
27struct clk *clk_get(struct device *dev, const char *id)
28{
29 struct clk *p, *clk = ERR_PTR(-ENOENT);
30
31 mutex_lock(&clocks_mutex);
32 list_for_each_entry(p, &clocks, node) {
33 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
34 clk = p;
35 break;
36 }
37 }
38 mutex_unlock(&clocks_mutex);
39
40 return clk;
41}
42EXPORT_SYMBOL(clk_get);
43
44void clk_put(struct clk *clk)
45{
46 module_put(clk->owner);
47}
48EXPORT_SYMBOL(clk_put);
49
50int clk_enable(struct clk *clk) 26int clk_enable(struct clk *clk)
51{ 27{
52 return 0; 28 return 0;
@@ -66,7 +42,9 @@ EXPORT_SYMBOL(clk_get_rate);
66 42
67long clk_round_rate(struct clk *clk, unsigned long rate) 43long clk_round_rate(struct clk *clk, unsigned long rate)
68{ 44{
69 return rate; 45 struct icst307_vco vco;
46 vco = icst307_khz_to_vco(clk->params, rate / 1000);
47 return icst307_khz(clk->params, vco) * 1000;
70} 48}
71EXPORT_SYMBOL(clk_round_rate); 49EXPORT_SYMBOL(clk_round_rate);
72 50
@@ -79,57 +57,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
79 57
80 vco = icst307_khz_to_vco(clk->params, rate / 1000); 58 vco = icst307_khz_to_vco(clk->params, rate / 1000);
81 clk->rate = icst307_khz(clk->params, vco) * 1000; 59 clk->rate = icst307_khz(clk->params, vco) * 1000;
82
83 printk("Clock %s: setting VCO reg params: S=%d R=%d V=%d\n",
84 clk->name, vco.s, vco.r, vco.v);
85
86 clk->setvco(clk, vco); 60 clk->setvco(clk, vco);
87 ret = 0; 61 ret = 0;
88 } 62 }
89 return ret; 63 return ret;
90} 64}
91EXPORT_SYMBOL(clk_set_rate); 65EXPORT_SYMBOL(clk_set_rate);
92
93/*
94 * These are fixed clocks.
95 */
96static struct clk kmi_clk = {
97 .name = "KMIREFCLK",
98 .rate = 24000000,
99};
100
101static struct clk uart_clk = {
102 .name = "UARTCLK",
103 .rate = 24000000,
104};
105
106static struct clk mmci_clk = {
107 .name = "MCLK",
108 .rate = 24000000,
109};
110
111int clk_register(struct clk *clk)
112{
113 mutex_lock(&clocks_mutex);
114 list_add(&clk->node, &clocks);
115 mutex_unlock(&clocks_mutex);
116 return 0;
117}
118EXPORT_SYMBOL(clk_register);
119
120void clk_unregister(struct clk *clk)
121{
122 mutex_lock(&clocks_mutex);
123 list_del(&clk->node);
124 mutex_unlock(&clocks_mutex);
125}
126EXPORT_SYMBOL(clk_unregister);
127
128static int __init clk_init(void)
129{
130 clk_register(&kmi_clk);
131 clk_register(&uart_clk);
132 clk_register(&mmci_clk);
133 return 0;
134}
135arch_initcall(clk_init);
diff --git a/arch/arm/mach-versatile/clock.h b/arch/arm/mach-versatile/clock.h
index 8b0b61dd17e4..03468fdc3e58 100644
--- a/arch/arm/mach-versatile/clock.h
+++ b/arch/arm/mach-versatile/clock.h
@@ -12,14 +12,9 @@ struct module;
12struct icst307_params; 12struct icst307_params;
13 13
14struct clk { 14struct clk {
15 struct list_head node;
16 unsigned long rate; 15 unsigned long rate;
17 struct module *owner;
18 const char *name;
19 const struct icst307_params *params; 16 const struct icst307_params *params;
17 u32 oscoff;
20 void *data; 18 void *data;
21 void (*setvco)(struct clk *, struct icst307_vco vco); 19 void (*setvco)(struct clk *, struct icst307_vco vco);
22}; 20};
23
24int clk_register(struct clk *clk);
25void clk_unregister(struct clk *clk);
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 565e0ba0d67e..1c43494f5c42 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -31,6 +31,7 @@
31#include <linux/cnt32_to_63.h> 31#include <linux/cnt32_to_63.h>
32#include <linux/io.h> 32#include <linux/io.h>
33 33
34#include <asm/clkdev.h>
34#include <asm/system.h> 35#include <asm/system.h>
35#include <mach/hardware.h> 36#include <mach/hardware.h>
36#include <asm/irq.h> 37#include <asm/irq.h>
@@ -373,22 +374,60 @@ static const struct icst307_params versatile_oscvco_params = {
373 374
374static void versatile_oscvco_set(struct clk *clk, struct icst307_vco vco) 375static void versatile_oscvco_set(struct clk *clk, struct icst307_vco vco)
375{ 376{
376 void __iomem *sys_lock = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LOCK_OFFSET; 377 void __iomem *sys = __io_address(VERSATILE_SYS_BASE);
377 void __iomem *sys_osc = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_OSCCLCD_OFFSET; 378 void __iomem *sys_lock = sys + VERSATILE_SYS_LOCK_OFFSET;
378 u32 val; 379 u32 val;
379 380
380 val = readl(sys_osc) & ~0x7ffff; 381 val = readl(sys + clk->oscoff) & ~0x7ffff;
381 val |= vco.v | (vco.r << 9) | (vco.s << 16); 382 val |= vco.v | (vco.r << 9) | (vco.s << 16);
382 383
383 writel(0xa05f, sys_lock); 384 writel(0xa05f, sys_lock);
384 writel(val, sys_osc); 385 writel(val, sys + clk->oscoff);
385 writel(0, sys_lock); 386 writel(0, sys_lock);
386} 387}
387 388
388static struct clk versatile_clcd_clk = { 389static struct clk osc4_clk = {
389 .name = "CLCDCLK",
390 .params = &versatile_oscvco_params, 390 .params = &versatile_oscvco_params,
391 .setvco = versatile_oscvco_set, 391 .oscoff = VERSATILE_SYS_OSCCLCD_OFFSET,
392 .setvco = versatile_oscvco_set,
393};
394
395/*
396 * These are fixed clocks.
397 */
398static struct clk ref24_clk = {
399 .rate = 24000000,
400};
401
402static struct clk_lookup lookups[] __initdata = {
403 { /* UART0 */
404 .dev_id = "dev:f1",
405 .clk = &ref24_clk,
406 }, { /* UART1 */
407 .dev_id = "dev:f2",
408 .clk = &ref24_clk,
409 }, { /* UART2 */
410 .dev_id = "dev:f3",
411 .clk = &ref24_clk,
412 }, { /* UART3 */
413 .dev_id = "fpga:09",
414 .clk = &ref24_clk,
415 }, { /* KMI0 */
416 .dev_id = "fpga:06",
417 .clk = &ref24_clk,
418 }, { /* KMI1 */
419 .dev_id = "fpga:07",
420 .clk = &ref24_clk,
421 }, { /* MMC0 */
422 .dev_id = "fpga:05",
423 .clk = &ref24_clk,
424 }, { /* MMC1 */
425 .dev_id = "fpga:0b",
426 .clk = &ref24_clk,
427 }, { /* CLCD */
428 .dev_id = "dev:20",
429 .clk = &osc4_clk,
430 }
392}; 431};
393 432
394/* 433/*
@@ -786,7 +825,8 @@ void __init versatile_init(void)
786{ 825{
787 int i; 826 int i;
788 827
789 clk_register(&versatile_clcd_clk); 828 for (i = 0; i < ARRAY_SIZE(lookups); i++)
829 clkdev_add(&lookups[i]);
790 830
791 platform_device_register(&versatile_flash_device); 831 platform_device_register(&versatile_flash_device);
792 platform_device_register(&versatile_i2c_device); 832 platform_device_register(&versatile_i2c_device);
@@ -965,7 +1005,7 @@ static void __init versatile_timer_init(void)
965 timer0_clockevent.min_delta_ns = 1005 timer0_clockevent.min_delta_ns =
966 clockevent_delta2ns(0xf, &timer0_clockevent); 1006 clockevent_delta2ns(0xf, &timer0_clockevent);
967 1007
968 timer0_clockevent.cpumask = cpumask_of_cpu(0); 1008 timer0_clockevent.cpumask = cpumask_of(0);
969 clockevents_register_device(&timer0_clockevent); 1009 clockevents_register_device(&timer0_clockevent);
970} 1010}
971 1011
diff --git a/arch/arm/mach-versatile/core.h b/arch/arm/mach-versatile/core.h
index afcaa858eb1f..9d39886a8351 100644
--- a/arch/arm/mach-versatile/core.h
+++ b/arch/arm/mach-versatile/core.h
@@ -34,7 +34,7 @@ extern unsigned int mmc_status(struct device *dev);
34static struct amba_device name##_device = { \ 34static struct amba_device name##_device = { \
35 .dev = { \ 35 .dev = { \
36 .coherent_dma_mask = ~0, \ 36 .coherent_dma_mask = ~0, \
37 .bus_id = busid, \ 37 .init_name = busid, \
38 .platform_data = plat, \ 38 .platform_data = plat, \
39 }, \ 39 }, \
40 .res = { \ 40 .res = { \
diff --git a/arch/arm/mach-versatile/include/mach/clkdev.h b/arch/arm/mach-versatile/include/mach/clkdev.h
new file mode 100644
index 000000000000..04b37a89801c
--- /dev/null
+++ b/arch/arm/mach-versatile/include/mach/clkdev.h
@@ -0,0 +1,7 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do { } while (0)
6
7#endif
diff --git a/arch/arm/mach-versatile/include/mach/dma.h b/arch/arm/mach-versatile/include/mach/dma.h
deleted file mode 100644
index 0aabf12c8834..000000000000
--- a/arch/arm/mach-versatile/include/mach/dma.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * arch/arm/mach-versatile/include/mach/dma.h
3 *
4 * Copyright (C) 2003 ARM Limited.
5 * Copyright (C) 1997,1998 Russell King
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 */
diff --git a/arch/arm/mach-versatile/include/mach/io.h b/arch/arm/mach-versatile/include/mach/io.h
index c0b9dd1d0257..f067c14c7182 100644
--- a/arch/arm/mach-versatile/include/mach/io.h
+++ b/arch/arm/mach-versatile/include/mach/io.h
@@ -22,11 +22,7 @@
22 22
23#define IO_SPACE_LIMIT 0xffffffff 23#define IO_SPACE_LIMIT 0xffffffff
24 24
25static inline void __iomem *__io(unsigned long addr) 25#define __io(a) __typesafe_io(a)
26{ 26#define __mem_pci(a) (a)
27 return (void __iomem *)addr;
28}
29#define __io(a) __io(a)
30#define __mem_pci(a) (a)
31 27
32#endif 28#endif
diff --git a/arch/arm/mach-versatile/include/mach/irqs.h b/arch/arm/mach-versatile/include/mach/irqs.h
index 216a1312e62e..9bfdb30e1f3f 100644
--- a/arch/arm/mach-versatile/include/mach/irqs.h
+++ b/arch/arm/mach-versatile/include/mach/irqs.h
@@ -60,39 +60,6 @@
60#define IRQ_VICSOURCE31 (IRQ_VIC_START + INT_VICSOURCE31) 60#define IRQ_VICSOURCE31 (IRQ_VIC_START + INT_VICSOURCE31)
61#define IRQ_VIC_END (IRQ_VIC_START + 31) 61#define IRQ_VIC_END (IRQ_VIC_START + 31)
62 62
63#define IRQMASK_WDOGINT INTMASK_WDOGINT
64#define IRQMASK_SOFTINT INTMASK_SOFTINT
65#define IRQMASK_COMMRx INTMASK_COMMRx
66#define IRQMASK_COMMTx INTMASK_COMMTx
67#define IRQMASK_TIMERINT0_1 INTMASK_TIMERINT0_1
68#define IRQMASK_TIMERINT2_3 INTMASK_TIMERINT2_3
69#define IRQMASK_GPIOINT0 INTMASK_GPIOINT0
70#define IRQMASK_GPIOINT1 INTMASK_GPIOINT1
71#define IRQMASK_GPIOINT2 INTMASK_GPIOINT2
72#define IRQMASK_GPIOINT3 INTMASK_GPIOINT3
73#define IRQMASK_RTCINT INTMASK_RTCINT
74#define IRQMASK_SSPINT INTMASK_SSPINT
75#define IRQMASK_UARTINT0 INTMASK_UARTINT0
76#define IRQMASK_UARTINT1 INTMASK_UARTINT1
77#define IRQMASK_UARTINT2 INTMASK_UARTINT2
78#define IRQMASK_SCIINT INTMASK_SCIINT
79#define IRQMASK_CLCDINT INTMASK_CLCDINT
80#define IRQMASK_DMAINT INTMASK_DMAINT
81#define IRQMASK_PWRFAILINT INTMASK_PWRFAILINT
82#define IRQMASK_MBXINT INTMASK_MBXINT
83#define IRQMASK_GNDINT INTMASK_GNDINT
84#define IRQMASK_VICSOURCE21 INTMASK_VICSOURCE21
85#define IRQMASK_VICSOURCE22 INTMASK_VICSOURCE22
86#define IRQMASK_VICSOURCE23 INTMASK_VICSOURCE23
87#define IRQMASK_VICSOURCE24 INTMASK_VICSOURCE24
88#define IRQMASK_VICSOURCE25 INTMASK_VICSOURCE25
89#define IRQMASK_VICSOURCE26 INTMASK_VICSOURCE26
90#define IRQMASK_VICSOURCE27 INTMASK_VICSOURCE27
91#define IRQMASK_VICSOURCE28 INTMASK_VICSOURCE28
92#define IRQMASK_VICSOURCE29 INTMASK_VICSOURCE29
93#define IRQMASK_VICSOURCE30 INTMASK_VICSOURCE30
94#define IRQMASK_VICSOURCE31 INTMASK_VICSOURCE31
95
96/* 63/*
97 * FIQ interrupts definitions are the same as the INT definitions. 64 * FIQ interrupts definitions are the same as the INT definitions.
98 */ 65 */
@@ -130,39 +97,6 @@
130#define FIQ_VICSOURCE31 INT_VICSOURCE31 97#define FIQ_VICSOURCE31 INT_VICSOURCE31
131 98
132 99
133#define FIQMASK_WDOGINT INTMASK_WDOGINT
134#define FIQMASK_SOFTINT INTMASK_SOFTINT
135#define FIQMASK_COMMRx INTMASK_COMMRx
136#define FIQMASK_COMMTx INTMASK_COMMTx
137#define FIQMASK_TIMERINT0_1 INTMASK_TIMERINT0_1
138#define FIQMASK_TIMERINT2_3 INTMASK_TIMERINT2_3
139#define FIQMASK_GPIOINT0 INTMASK_GPIOINT0
140#define FIQMASK_GPIOINT1 INTMASK_GPIOINT1
141#define FIQMASK_GPIOINT2 INTMASK_GPIOINT2
142#define FIQMASK_GPIOINT3 INTMASK_GPIOINT3
143#define FIQMASK_RTCINT INTMASK_RTCINT
144#define FIQMASK_SSPINT INTMASK_SSPINT
145#define FIQMASK_UARTINT0 INTMASK_UARTINT0
146#define FIQMASK_UARTINT1 INTMASK_UARTINT1
147#define FIQMASK_UARTINT2 INTMASK_UARTINT2
148#define FIQMASK_SCIINT INTMASK_SCIINT
149#define FIQMASK_CLCDINT INTMASK_CLCDINT
150#define FIQMASK_DMAINT INTMASK_DMAINT
151#define FIQMASK_PWRFAILINT INTMASK_PWRFAILINT
152#define FIQMASK_MBXINT INTMASK_MBXINT
153#define FIQMASK_GNDINT INTMASK_GNDINT
154#define FIQMASK_VICSOURCE21 INTMASK_VICSOURCE21
155#define FIQMASK_VICSOURCE22 INTMASK_VICSOURCE22
156#define FIQMASK_VICSOURCE23 INTMASK_VICSOURCE23
157#define FIQMASK_VICSOURCE24 INTMASK_VICSOURCE24
158#define FIQMASK_VICSOURCE25 INTMASK_VICSOURCE25
159#define FIQMASK_VICSOURCE26 INTMASK_VICSOURCE26
160#define FIQMASK_VICSOURCE27 INTMASK_VICSOURCE27
161#define FIQMASK_VICSOURCE28 INTMASK_VICSOURCE28
162#define FIQMASK_VICSOURCE29 INTMASK_VICSOURCE29
163#define FIQMASK_VICSOURCE30 INTMASK_VICSOURCE30
164#define FIQMASK_VICSOURCE31 INTMASK_VICSOURCE31
165
166/* 100/*
167 * Secondary interrupt controller 101 * Secondary interrupt controller
168 */ 102 */
@@ -188,24 +122,4 @@
188#define IRQ_SIC_PCI3 (IRQ_SIC_START + SIC_INT_PCI3) 122#define IRQ_SIC_PCI3 (IRQ_SIC_START + SIC_INT_PCI3)
189#define IRQ_SIC_END 63 123#define IRQ_SIC_END 63
190 124
191#define SIC_IRQMASK_MMCI0B SIC_INTMASK_MMCI0B
192#define SIC_IRQMASK_MMCI1B SIC_INTMASK_MMCI1B
193#define SIC_IRQMASK_KMI0 SIC_INTMASK_KMI0
194#define SIC_IRQMASK_KMI1 SIC_INTMASK_KMI1
195#define SIC_IRQMASK_SCI3 SIC_INTMASK_SCI3
196#define SIC_IRQMASK_UART3 SIC_INTMASK_UART3
197#define SIC_IRQMASK_CLCD SIC_INTMASK_CLCD
198#define SIC_IRQMASK_TOUCH SIC_INTMASK_TOUCH
199#define SIC_IRQMASK_KEYPAD SIC_INTMASK_KEYPAD
200#define SIC_IRQMASK_DoC SIC_INTMASK_DoC
201#define SIC_IRQMASK_MMCI0A SIC_INTMASK_MMCI0A
202#define SIC_IRQMASK_MMCI1A SIC_INTMASK_MMCI1A
203#define SIC_IRQMASK_AACI SIC_INTMASK_AACI
204#define SIC_IRQMASK_ETH SIC_INTMASK_ETH
205#define SIC_IRQMASK_USB SIC_INTMASK_USB
206#define SIC_IRQMASK_PCI0 SIC_INTMASK_PCI0
207#define SIC_IRQMASK_PCI1 SIC_INTMASK_PCI1
208#define SIC_IRQMASK_PCI2 SIC_INTMASK_PCI2
209#define SIC_IRQMASK_PCI3 SIC_INTMASK_PCI3
210
211#define NR_IRQS 64 125#define NR_IRQS 64
diff --git a/arch/arm/mach-versatile/include/mach/memory.h b/arch/arm/mach-versatile/include/mach/memory.h
index b6315c0602ac..79aeab86b903 100644
--- a/arch/arm/mach-versatile/include/mach/memory.h
+++ b/arch/arm/mach-versatile/include/mach/memory.h
@@ -25,14 +25,4 @@
25 */ 25 */
26#define PHYS_OFFSET UL(0x00000000) 26#define PHYS_OFFSET UL(0x00000000)
27 27
28/*
29 * Virtual view <-> DMA view memory address translations
30 * virt_to_bus: Used to translate the virtual address to an
31 * address suitable to be passed to set_dma_addr
32 * bus_to_virt: Used to convert an address for DMA operations
33 * to an address that the kernel can use.
34 */
35#define __virt_to_bus(x) ((x) - PAGE_OFFSET)
36#define __bus_to_virt(x) ((x) + PAGE_OFFSET)
37
38#endif 28#endif
diff --git a/arch/arm/mach-versatile/include/mach/platform.h b/arch/arm/mach-versatile/include/mach/platform.h
index f91ba930ca8a..83207395191a 100644
--- a/arch/arm/mach-versatile/include/mach/platform.h
+++ b/arch/arm/mach-versatile/include/mach/platform.h
@@ -347,44 +347,6 @@
347#define INT_VICSOURCE30 30 /* PCI 3 */ 347#define INT_VICSOURCE30 30 /* PCI 3 */
348#define INT_VICSOURCE31 31 /* SIC source */ 348#define INT_VICSOURCE31 31 /* SIC source */
349 349
350/*
351 * Interrupt bit positions
352 *
353 */
354#define INTMASK_WDOGINT (1 << INT_WDOGINT)
355#define INTMASK_SOFTINT (1 << INT_SOFTINT)
356#define INTMASK_COMMRx (1 << INT_COMMRx)
357#define INTMASK_COMMTx (1 << INT_COMMTx)
358#define INTMASK_TIMERINT0_1 (1 << INT_TIMERINT0_1)
359#define INTMASK_TIMERINT2_3 (1 << INT_TIMERINT2_3)
360#define INTMASK_GPIOINT0 (1 << INT_GPIOINT0)
361#define INTMASK_GPIOINT1 (1 << INT_GPIOINT1)
362#define INTMASK_GPIOINT2 (1 << INT_GPIOINT2)
363#define INTMASK_GPIOINT3 (1 << INT_GPIOINT3)
364#define INTMASK_RTCINT (1 << INT_RTCINT)
365#define INTMASK_SSPINT (1 << INT_SSPINT)
366#define INTMASK_UARTINT0 (1 << INT_UARTINT0)
367#define INTMASK_UARTINT1 (1 << INT_UARTINT1)
368#define INTMASK_UARTINT2 (1 << INT_UARTINT2)
369#define INTMASK_SCIINT (1 << INT_SCIINT)
370#define INTMASK_CLCDINT (1 << INT_CLCDINT)
371#define INTMASK_DMAINT (1 << INT_DMAINT)
372#define INTMASK_PWRFAILINT (1 << INT_PWRFAILINT)
373#define INTMASK_MBXINT (1 << INT_MBXINT)
374#define INTMASK_GNDINT (1 << INT_GNDINT)
375#define INTMASK_VICSOURCE21 (1 << INT_VICSOURCE21)
376#define INTMASK_VICSOURCE22 (1 << INT_VICSOURCE22)
377#define INTMASK_VICSOURCE23 (1 << INT_VICSOURCE23)
378#define INTMASK_VICSOURCE24 (1 << INT_VICSOURCE24)
379#define INTMASK_VICSOURCE25 (1 << INT_VICSOURCE25)
380#define INTMASK_VICSOURCE26 (1 << INT_VICSOURCE26)
381#define INTMASK_VICSOURCE27 (1 << INT_VICSOURCE27)
382#define INTMASK_VICSOURCE28 (1 << INT_VICSOURCE28)
383#define INTMASK_VICSOURCE29 (1 << INT_VICSOURCE29)
384#define INTMASK_VICSOURCE30 (1 << INT_VICSOURCE30)
385#define INTMASK_VICSOURCE31 (1 << INT_VICSOURCE31)
386
387
388#define VERSATILE_SC_VALID_INT 0x003FFFFF 350#define VERSATILE_SC_VALID_INT 0x003FFFFF
389 351
390#define MAXIRQNUM 31 352#define MAXIRQNUM 31
@@ -417,26 +379,6 @@
417#define SIC_INT_PCI3 30 379#define SIC_INT_PCI3 30
418 380
419 381
420#define SIC_INTMASK_MMCI0B (1 << SIC_INT_MMCI0B)
421#define SIC_INTMASK_MMCI1B (1 << SIC_INT_MMCI1B)
422#define SIC_INTMASK_KMI0 (1 << SIC_INT_KMI0)
423#define SIC_INTMASK_KMI1 (1 << SIC_INT_KMI1)
424#define SIC_INTMASK_SCI3 (1 << SIC_INT_SCI3)
425#define SIC_INTMASK_UART3 (1 << SIC_INT_UART3)
426#define SIC_INTMASK_CLCD (1 << SIC_INT_CLCD)
427#define SIC_INTMASK_TOUCH (1 << SIC_INT_TOUCH)
428#define SIC_INTMASK_KEYPAD (1 << SIC_INT_KEYPAD)
429#define SIC_INTMASK_DoC (1 << SIC_INT_DoC)
430#define SIC_INTMASK_MMCI0A (1 << SIC_INT_MMCI0A)
431#define SIC_INTMASK_MMCI1A (1 << SIC_INT_MMCI1A)
432#define SIC_INTMASK_AACI (1 << SIC_INT_AACI)
433#define SIC_INTMASK_ETH (1 << SIC_INT_ETH)
434#define SIC_INTMASK_USB (1 << SIC_INT_USB)
435#define SIC_INTMASK_PCI0 (1 << SIC_INT_PCI0)
436#define SIC_INTMASK_PCI1 (1 << SIC_INT_PCI1)
437#define SIC_INTMASK_PCI2 (1 << SIC_INT_PCI2)
438#define SIC_INTMASK_PCI3 (1 << SIC_INT_PCI3)
439
440/* 382/*
441 * Clean base - dummy 383 * Clean base - dummy
442 * 384 *
diff --git a/arch/arm/mach-w90x900/Kconfig b/arch/arm/mach-w90x900/Kconfig
new file mode 100644
index 000000000000..8e4178fe5ec2
--- /dev/null
+++ b/arch/arm/mach-w90x900/Kconfig
@@ -0,0 +1,19 @@
1if ARCH_W90X900
2
3config CPU_W90P910
4 bool
5 help
6 Support for W90P910 of Nuvoton W90X900 CPUs.
7
8menu "W90P910 Machines"
9
10config MACH_W90P910EVB
11 bool "Nuvoton W90P910 Evaluation Board"
12 default y
13 select CPU_W90P910
14 help
15 Say Y here if you are using the Nuvoton W90P910EVB
16
17endmenu
18
19endif
diff --git a/arch/arm/mach-w90x900/Makefile b/arch/arm/mach-w90x900/Makefile
new file mode 100644
index 000000000000..0c0c1d63f1c7
--- /dev/null
+++ b/arch/arm/mach-w90x900/Makefile
@@ -0,0 +1,15 @@
1#
2# Makefile for the linux kernel.
3#
4
5# Object file lists.
6
7obj-y := irq.o time.o
8
9# W90X900 CPU support files
10
11obj-$(CONFIG_CPU_W90P910) += w90p910.o
12
13# machine support
14
15obj-$(CONFIG_MACH_W90P910EVB) += mach-w90p910evb.o
diff --git a/arch/arm/mach-w90x900/Makefile.boot b/arch/arm/mach-w90x900/Makefile.boot
new file mode 100644
index 000000000000..a057b546b6e5
--- /dev/null
+++ b/arch/arm/mach-w90x900/Makefile.boot
@@ -0,0 +1,3 @@
1zreladdr-y := 0x00008000
2params_phys-y := 0x00000100
3
diff --git a/arch/arm/mach-w90x900/cpu.h b/arch/arm/mach-w90x900/cpu.h
new file mode 100644
index 000000000000..40ff40845df0
--- /dev/null
+++ b/arch/arm/mach-w90x900/cpu.h
@@ -0,0 +1,77 @@
1/*
2 * arch/arm/mach-w90x900/cpu.h
3 *
4 * Based on linux/include/asm-arm/plat-s3c24xx/cpu.h by Ben Dooks
5 *
6 * Copyright (c) 2008 Nuvoton technology corporation
7 * All rights reserved.
8 *
9 * Header file for W90X900 CPU support
10 *
11 * Wan ZongShun <mcuos.com@gmail.com>
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#define IODESC_ENT(y) \
20{ \
21 .virtual = (unsigned long)W90X900_VA_##y, \
22 .pfn = __phys_to_pfn(W90X900_PA_##y), \
23 .length = W90X900_SZ_##y, \
24 .type = MT_DEVICE, \
25}
26
27/*Cpu identifier register*/
28
29#define W90X900PDID W90X900_VA_GCR
30#define W90P910_CPUID 0x02900910
31#define W90P920_CPUID 0x02900920
32#define W90P950_CPUID 0x02900950
33#define W90N960_CPUID 0x02900960
34
35struct w90x900_uartcfg;
36struct map_desc;
37struct sys_timer;
38
39/* core initialisation functions */
40
41extern void w90x900_init_irq(void);
42extern void w90p910_init_io(struct map_desc *mach_desc, int size);
43extern void w90p910_init_uarts(struct w90x900_uartcfg *cfg, int no);
44extern void w90p910_init_clocks(int xtal);
45extern void w90p910_map_io(struct map_desc *mach_desc, int size);
46extern struct sys_timer w90x900_timer;
47
48#define W90X900_RES(name) \
49struct resource w90x900_##name##_resource[] = { \
50 [0] = { \
51 .start = name##_PA, \
52 .end = name##_PA + 0x0ff, \
53 .flags = IORESOURCE_MEM, \
54 }, \
55 [1] = { \
56 .start = IRQ_##name, \
57 .end = IRQ_##name, \
58 .flags = IORESOURCE_IRQ, \
59 } \
60}
61
62#define W90X900_DEVICE(devname, regname, devid, platdevname) \
63struct platform_device w90x900_##devname = { \
64 .name = platdevname, \
65 .id = devid, \
66 .num_resources = ARRAY_SIZE(w90x900_##regname##_resource), \
67 .resource = w90x900_##regname##_resource, \
68}
69
70#define W90X900_UARTCFG(port, flag, uc, ulc, ufc) \
71{ \
72 .hwport = port, \
73 .flags = flag, \
74 .ucon = uc, \
75 .ulcon = ulc, \
76 .ufcon = ufc, \
77}
diff --git a/arch/arm/mach-w90x900/include/mach/entry-macro.S b/arch/arm/mach-w90x900/include/mach/entry-macro.S
new file mode 100644
index 000000000000..d39aca5be9ee
--- /dev/null
+++ b/arch/arm/mach-w90x900/include/mach/entry-macro.S
@@ -0,0 +1,34 @@
1/*
2 * arch/arm/mach-w90x900/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for W90P910-based platforms
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
12#include <mach/hardware.h>
13#include <mach/regs-irq.h>
14
15 .macro get_irqnr_preamble, base, tmp
16 .endm
17
18 .macro arch_ret_to_user, tmp1, tmp2
19 .endm
20
21 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
22
23 mov \base, #AIC_BA
24
25 ldr \irqnr, [ \base, #AIC_IPER]
26 ldr \irqnr, [ \base, #AIC_ISNR]
27 cmp \irqnr, #0
28
29 .endm
30
31 /* currently don't need an disable_fiq macro */
32
33 .macro disable_fiq
34 .endm
diff --git a/arch/arm/mach-w90x900/include/mach/hardware.h b/arch/arm/mach-w90x900/include/mach/hardware.h
new file mode 100644
index 000000000000..fe3c6265a466
--- /dev/null
+++ b/arch/arm/mach-w90x900/include/mach/hardware.h
@@ -0,0 +1,24 @@
1/*
2 * arch/arm/mach-w90x900/include/mach/hardware.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * Based on arch/arm/mach-s3c2410/include/mach/hardware.h
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 */
17
18#ifndef __ASM_ARCH_HARDWARE_H
19#define __ASM_ARCH_HARDWARE_H
20
21#include <asm/sizes.h>
22#include <mach/map.h>
23
24#endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-w90x900/include/mach/io.h b/arch/arm/mach-w90x900/include/mach/io.h
new file mode 100644
index 000000000000..d96ab99df05b
--- /dev/null
+++ b/arch/arm/mach-w90x900/include/mach/io.h
@@ -0,0 +1,30 @@
1/*
2 * arch/arm/mach-w90x900/include/mach/io.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * Based on arch/arm/mach-s3c2410/include/mach/io.h
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 */
17
18#ifndef __ASM_ARM_ARCH_IO_H
19#define __ASM_ARM_ARCH_IO_H
20
21#define IO_SPACE_LIMIT 0xffffffff
22
23/*
24 * 1:1 mapping for ioremapped regions.
25 */
26
27#define __mem_pci(a) (a)
28#define __io(a) __typesafe_io(a)
29
30#endif
diff --git a/arch/arm/mach-w90x900/include/mach/irqs.h b/arch/arm/mach-w90x900/include/mach/irqs.h
new file mode 100644
index 000000000000..1c583f9cbcde
--- /dev/null
+++ b/arch/arm/mach-w90x900/include/mach/irqs.h
@@ -0,0 +1,45 @@
1/*
2 * arch/arm/mach-w90x900/include/mach/irqs.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * Based on arch/arm/mach-s3c2410/include/mach/irqs.h
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 */
17
18#ifndef __ASM_ARCH_IRQS_H
19#define __ASM_ARCH_IRQS_H
20
21/*
22 * we keep the first set of CPU IRQs out of the range of
23 * the ISA space, so that the PC104 has them to itself
24 * and we don't end up having to do horrible things to the
25 * standard ISA drivers....
26 *
27 */
28
29#define W90X900_IRQ(x) (x)
30
31/* Main cpu interrupts */
32
33#define IRQ_WDT W90X900_IRQ(1)
34#define IRQ_UART0 W90X900_IRQ(7)
35#define IRQ_UART1 W90X900_IRQ(8)
36#define IRQ_UART2 W90X900_IRQ(9)
37#define IRQ_UART3 W90X900_IRQ(10)
38#define IRQ_UART4 W90X900_IRQ(11)
39#define IRQ_TIMER0 W90X900_IRQ(12)
40#define IRQ_TIMER1 W90X900_IRQ(13)
41#define IRQ_T_INT_GROUP W90X900_IRQ(14)
42#define IRQ_ADC W90X900_IRQ(31)
43#define NR_IRQS (IRQ_ADC+1)
44
45#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-w90x900/include/mach/map.h b/arch/arm/mach-w90x900/include/mach/map.h
new file mode 100644
index 000000000000..79320ebe614b
--- /dev/null
+++ b/arch/arm/mach-w90x900/include/mach/map.h
@@ -0,0 +1,76 @@
1/*
2 * arch/arm/mach-w90x900/include/mach/map.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * Based on arch/arm/mach-s3c2410/include/mach/map.h
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 */
17
18#ifndef __ASM_ARCH_MAP_H
19#define __ASM_ARCH_MAP_H
20
21#ifndef __ASSEMBLY__
22#define W90X900_ADDR(x) ((void __iomem *)(0xF0000000 + (x)))
23#else
24#define W90X900_ADDR(x) (0xF0000000 + (x))
25#endif
26
27#define AHB_IO_BASE 0xB0000000
28#define APB_IO_BASE 0xB8000000
29#define CLOCKPW_BASE (APB_IO_BASE+0x200)
30#define AIC_IO_BASE (APB_IO_BASE+0x2000)
31#define TIMER_IO_BASE (APB_IO_BASE+0x1000)
32
33/*
34 * interrupt controller is the first thing we put in, to make
35 * the assembly code for the irq detection easier
36 */
37
38#define W90X900_VA_IRQ W90X900_ADDR(0x00000000)
39#define W90X900_PA_IRQ (0xB8002000)
40#define W90X900_SZ_IRQ SZ_4K
41
42#define W90X900_VA_GCR W90X900_ADDR(0x08002000)
43#define W90X900_PA_GCR (0xB0000000)
44#define W90X900_SZ_GCR SZ_4K
45
46/* Clock and Power management */
47
48#define W90X900_VA_CLKPWR (W90X900_VA_GCR+0x200)
49#define W90X900_PA_CLKPWR (0xB0000200)
50#define W90X900_SZ_CLKPWR SZ_4K
51
52/* EBI management */
53
54#define W90X900_VA_EBI W90X900_ADDR(0x00001000)
55#define W90X900_PA_EBI (0xB0001000)
56#define W90X900_SZ_EBI SZ_4K
57
58/* UARTs */
59
60#define W90X900_VA_UART W90X900_ADDR(0x08000000)
61#define W90X900_PA_UART (0xB8000000)
62#define W90X900_SZ_UART SZ_4K
63
64/* Timers */
65
66#define W90X900_VA_TIMER W90X900_ADDR(0x08001000)
67#define W90X900_PA_TIMER (0xB8001000)
68#define W90X900_SZ_TIMER SZ_4K
69
70/* GPIO ports */
71
72#define W90X900_VA_GPIO W90X900_ADDR(0x08003000)
73#define W90X900_PA_GPIO (0xB8003000)
74#define W90X900_SZ_GPIO SZ_4K
75
76#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-w90x900/include/mach/memory.h b/arch/arm/mach-w90x900/include/mach/memory.h
new file mode 100644
index 000000000000..971b80702c27
--- /dev/null
+++ b/arch/arm/mach-w90x900/include/mach/memory.h
@@ -0,0 +1,23 @@
1/*
2 * arch/arm/mach-w90x900/include/mach/memory.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * Based on arch/arm/mach-s3c2410/include/mach/memory.h
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 */
17
18#ifndef __ASM_ARCH_MEMORY_H
19#define __ASM_ARCH_MEMORY_H
20
21#define PHYS_OFFSET UL(0x00000000)
22
23#endif
diff --git a/arch/arm/mach-w90x900/include/mach/regs-irq.h b/arch/arm/mach-w90x900/include/mach/regs-irq.h
new file mode 100644
index 000000000000..8a3185fbc9cf
--- /dev/null
+++ b/arch/arm/mach-w90x900/include/mach/regs-irq.h
@@ -0,0 +1,51 @@
1/*
2 * arch/arm/mach-w90x900/include/mach/regs-irq.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * Based on arch/arm/mach-s3c2410/include/mach/regs-irq.h
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 */
17
18#ifndef ___ASM_ARCH_REGS_IRQ_H
19#define ___ASM_ARCH_REGS_IRQ_H
20
21/* Advance Interrupt Controller (AIC) Registers */
22
23#define AIC_BA W90X900_VA_IRQ
24
25#define REG_AIC_IRQSC (AIC_BA+0x80)
26#define REG_AIC_GEN (AIC_BA+0x84)
27#define REG_AIC_GASR (AIC_BA+0x88)
28#define REG_AIC_GSCR (AIC_BA+0x8C)
29#define REG_AIC_IRSR (AIC_BA+0x100)
30#define REG_AIC_IASR (AIC_BA+0x104)
31#define REG_AIC_ISR (AIC_BA+0x108)
32#define REG_AIC_IPER (AIC_BA+0x10C)
33#define REG_AIC_ISNR (AIC_BA+0x110)
34#define REG_AIC_IMR (AIC_BA+0x114)
35#define REG_AIC_OISR (AIC_BA+0x118)
36#define REG_AIC_MECR (AIC_BA+0x120)
37#define REG_AIC_MDCR (AIC_BA+0x124)
38#define REG_AIC_SSCR (AIC_BA+0x128)
39#define REG_AIC_SCCR (AIC_BA+0x12C)
40#define REG_AIC_EOSCR (AIC_BA+0x130)
41#define AIC_IPER (0x10C)
42#define AIC_ISNR (0x110)
43
44/*16-18 bits of REG_AIC_GEN define irq(2-4) group*/
45
46#define TIMER2_IRQ (1 << 16)
47#define TIMER3_IRQ (1 << 17)
48#define TIMER4_IRQ (1 << 18)
49#define TIME_GROUP_IRQ (TIMER2_IRQ|TIMER3_IRQ|TIMER4_IRQ)
50
51#endif /* ___ASM_ARCH_REGS_IRQ_H */
diff --git a/arch/arm/mach-w90x900/include/mach/regs-serial.h b/arch/arm/mach-w90x900/include/mach/regs-serial.h
new file mode 100644
index 000000000000..f08fa0d75e11
--- /dev/null
+++ b/arch/arm/mach-w90x900/include/mach/regs-serial.h
@@ -0,0 +1,59 @@
1/*
2 * arch/arm/mach-w90x900/include/mach/regs-serial.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * Based on arch/arm/mach-s3c2410/include/mach/regs-serial.h
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 */
17
18#ifndef __ASM_ARM_REGS_SERIAL_H
19#define __ASM_ARM_REGS_SERIAL_H
20
21#define UART0_BA W90X900_VA_UART
22#define UART1_BA (W90X900_VA_UART+0x100)
23#define UART2_BA (W90X900_VA_UART+0x200)
24#define UART3_BA (W90X900_VA_UART+0x300)
25#define UART4_BA (W90X900_VA_UART+0x400)
26
27#define UART0_PA W90X900_PA_UART
28#define UART1_PA (W90X900_PA_UART+0x100)
29#define UART2_PA (W90X900_PA_UART+0x200)
30#define UART3_PA (W90X900_PA_UART+0x300)
31#define UART4_PA (W90X900_PA_UART+0x400)
32
33#ifndef __ASSEMBLY__
34
35struct w90x900_uart_clksrc {
36 const char *name;
37 unsigned int divisor;
38 unsigned int min_baud;
39 unsigned int max_baud;
40};
41
42struct w90x900_uartcfg {
43 unsigned char hwport;
44 unsigned char unused;
45 unsigned short flags;
46 unsigned long uart_flags;
47
48 unsigned long ucon;
49 unsigned long ulcon;
50 unsigned long ufcon;
51
52 struct w90x900_uart_clksrc *clocks;
53 unsigned int clocks_size;
54};
55
56#endif /* __ASSEMBLY__ */
57
58#endif /* __ASM_ARM_REGS_SERIAL_H */
59
diff --git a/arch/arm/mach-w90x900/include/mach/regs-timer.h b/arch/arm/mach-w90x900/include/mach/regs-timer.h
new file mode 100644
index 000000000000..8f390620c0e4
--- /dev/null
+++ b/arch/arm/mach-w90x900/include/mach/regs-timer.h
@@ -0,0 +1,42 @@
1/*
2 * arch/arm/mach-w90x900/include/mach/regs-timer.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * Based on arch/arm/mach-s3c2410/include/mach/regs-timer.h
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 */
17
18#ifndef __ASM_ARCH_REGS_TIMER_H
19#define __ASM_ARCH_REGS_TIMER_H
20
21/* Timer Registers */
22
23#define TMR_BA W90X900_VA_TIMER
24#define REG_TCSR0 (TMR_BA+0x00)
25#define REG_TCSR1 (TMR_BA+0x04)
26#define REG_TICR0 (TMR_BA+0x08)
27#define REG_TICR1 (TMR_BA+0x0C)
28#define REG_TDR0 (TMR_BA+0x10)
29#define REG_TDR1 (TMR_BA+0x14)
30#define REG_TISR (TMR_BA+0x18)
31#define REG_WTCR (TMR_BA+0x1C)
32#define REG_TCSR2 (TMR_BA+0x20)
33#define REG_TCSR3 (TMR_BA+0x24)
34#define REG_TICR2 (TMR_BA+0x28)
35#define REG_TICR3 (TMR_BA+0x2C)
36#define REG_TDR2 (TMR_BA+0x30)
37#define REG_TDR3 (TMR_BA+0x34)
38#define REG_TCSR4 (TMR_BA+0x40)
39#define REG_TICR4 (TMR_BA+0x48)
40#define REG_TDR4 (TMR_BA+0x50)
41
42#endif /* __ASM_ARCH_REGS_TIMER_H */
diff --git a/arch/arm/mach-w90x900/include/mach/system.h b/arch/arm/mach-w90x900/include/mach/system.h
new file mode 100644
index 000000000000..93753f922618
--- /dev/null
+++ b/arch/arm/mach-w90x900/include/mach/system.h
@@ -0,0 +1,28 @@
1/*
2 * arch/arm/mach-w90x900/include/mach/system.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * Based on arch/arm/mach-s3c2410/include/mach/system.h
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 */
17
18#include <asm/proc-fns.h>
19
20static void arch_idle(void)
21{
22}
23
24static void arch_reset(char mode)
25{
26 cpu_reset(0);
27}
28
diff --git a/arch/arm/mach-w90x900/include/mach/timex.h b/arch/arm/mach-w90x900/include/mach/timex.h
new file mode 100644
index 000000000000..164dce0b64db
--- /dev/null
+++ b/arch/arm/mach-w90x900/include/mach/timex.h
@@ -0,0 +1,25 @@
1/*
2 * arch/arm/mach-w90x900/include/mach/timex.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * Based on arch/arm/mach-s3c2410/include/mach/timex.h
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 */
17
18#ifndef __ASM_ARCH_TIMEX_H
19#define __ASM_ARCH_TIMEX_H
20
21/* CLOCK_TICK_RATE Now, I don't use it. */
22
23#define CLOCK_TICK_RATE 15000000
24
25#endif /* __ASM_ARCH_TIMEX_H */
diff --git a/arch/arm/mach-w90x900/include/mach/uncompress.h b/arch/arm/mach-w90x900/include/mach/uncompress.h
new file mode 100644
index 000000000000..050d9fe5ae1b
--- /dev/null
+++ b/arch/arm/mach-w90x900/include/mach/uncompress.h
@@ -0,0 +1,40 @@
1/*
2 * arch/arm/mach-w90x900/include/mach/uncompress.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * Based on arch/arm/mach-s3c2410/include/mach/uncompress.h
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 */
17
18#ifndef __ASM_ARCH_UNCOMPRESS_H
19#define __ASM_ARCH_UNCOMPRESS_H
20
21/* Defines for UART registers */
22
23#include <mach/regs-serial.h>
24#include <mach/map.h>
25
26#define arch_decomp_wdog()
27
28static void putc(int ch)
29{
30}
31
32static inline void flush(void)
33{
34}
35
36static void arch_decomp_setup(void)
37{
38}
39
40#endif/* __ASM_W90X900_UNCOMPRESS_H */
diff --git a/arch/arm/mach-w90x900/include/mach/vmalloc.h b/arch/arm/mach-w90x900/include/mach/vmalloc.h
new file mode 100644
index 000000000000..2f9dfb928533
--- /dev/null
+++ b/arch/arm/mach-w90x900/include/mach/vmalloc.h
@@ -0,0 +1,23 @@
1/*
2 * arch/arm/mach-w90x900/include/mach/vmalloc.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * Based on arch/arm/mach-s3c2410/include/mach/vmalloc.h
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 */
17
18#ifndef __ASM_ARCH_VMALLOC_H
19#define __ASM_ARCH_VMALLOC_H
20
21#define VMALLOC_END (0xE0000000)
22
23#endif /* __ASM_ARCH_VMALLOC_H */
diff --git a/arch/arm/mach-w90x900/irq.c b/arch/arm/mach-w90x900/irq.c
new file mode 100644
index 000000000000..0b4fc194729c
--- /dev/null
+++ b/arch/arm/mach-w90x900/irq.c
@@ -0,0 +1,76 @@
1/*
2 * linux/arch/arm/mach-w90x900/irq.c
3 *
4 * based on linux/arch/arm/plat-s3c24xx/irq.c by Ben Dooks
5 *
6 * Copyright (c) 2008 Nuvoton technology corporation
7 * All rights reserved.
8 *
9 * Wan ZongShun <mcuos.com@gmail.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 */
17
18#include <linux/init.h>
19#include <linux/module.h>
20#include <linux/interrupt.h>
21#include <linux/ioport.h>
22#include <linux/ptrace.h>
23#include <linux/sysdev.h>
24#include <linux/io.h>
25
26#include <asm/irq.h>
27#include <asm/mach/irq.h>
28
29#include <mach/hardware.h>
30#include <mach/regs-irq.h>
31
32static void w90x900_irq_mask(unsigned int irq)
33{
34 __raw_writel(1 << irq, REG_AIC_MDCR);
35}
36
37/*
38 * By the w90p910 spec,any irq,only write 1
39 * to REG_AIC_EOSCR for ACK
40 */
41
42static void w90x900_irq_ack(unsigned int irq)
43{
44 __raw_writel(0x01, REG_AIC_EOSCR);
45}
46
47static void w90x900_irq_unmask(unsigned int irq)
48{
49 unsigned long mask;
50
51 if (irq == IRQ_T_INT_GROUP) {
52 mask = __raw_readl(REG_AIC_GEN);
53 __raw_writel(TIME_GROUP_IRQ | mask, REG_AIC_GEN);
54 __raw_writel(1 << IRQ_T_INT_GROUP, REG_AIC_MECR);
55 }
56 __raw_writel(1 << irq, REG_AIC_MECR);
57}
58
59static struct irq_chip w90x900_irq_chip = {
60 .ack = w90x900_irq_ack,
61 .mask = w90x900_irq_mask,
62 .unmask = w90x900_irq_unmask,
63};
64
65void __init w90x900_init_irq(void)
66{
67 int irqno;
68
69 __raw_writel(0xFFFFFFFE, REG_AIC_MDCR);
70
71 for (irqno = IRQ_WDT; irqno <= IRQ_ADC; irqno++) {
72 set_irq_chip(irqno, &w90x900_irq_chip);
73 set_irq_handler(irqno, handle_level_irq);
74 set_irq_flags(irqno, IRQF_VALID);
75 }
76}
diff --git a/arch/arm/mach-w90x900/mach-w90p910evb.c b/arch/arm/mach-w90x900/mach-w90p910evb.c
new file mode 100644
index 000000000000..9307a2475438
--- /dev/null
+++ b/arch/arm/mach-w90x900/mach-w90p910evb.c
@@ -0,0 +1,72 @@
1/*
2 * linux/arch/arm/mach-w90x900/mach-w90p910evb.c
3 *
4 * Based on mach-s3c2410/mach-smdk2410.c by Jonas Dietsche
5 *
6 * Copyright (C) 2008 Nuvoton technology corporation
7 * All rights reserved.
8 *
9 * Wan ZongShun <mcuos.com@gmail.com>
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version.
15 *
16 */
17
18#include <linux/kernel.h>
19#include <linux/types.h>
20#include <linux/interrupt.h>
21#include <linux/list.h>
22#include <linux/timer.h>
23#include <linux/init.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#include <asm/mach-types.h>
30
31#include <mach/regs-serial.h>
32
33#include "cpu.h"
34
35static struct map_desc w90p910_iodesc[] __initdata = {
36};
37
38static struct w90x900_uartcfg w90p910_uartcfgs[] = {
39 W90X900_UARTCFG(0, 0, 0, 0, 0),
40 W90X900_UARTCFG(1, 0, 0, 0, 0),
41 W90X900_UARTCFG(2, 0, 0, 0, 0),
42 W90X900_UARTCFG(3, 0, 0, 0, 0),
43 W90X900_UARTCFG(4, 0, 0, 0, 0),
44};
45
46/*Here should be your evb resourse,such as LCD*/
47
48static struct platform_device *w90p910evb_dev[] __initdata = {
49};
50
51static void __init w90p910evb_map_io(void)
52{
53 w90p910_map_io(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc));
54 w90p910_init_clocks(0);
55 w90p910_init_uarts(w90p910_uartcfgs, ARRAY_SIZE(w90p910_uartcfgs));
56}
57
58static void __init w90p910evb_init(void)
59{
60 platform_add_devices(w90p910evb_dev, ARRAY_SIZE(w90p910evb_dev));
61}
62
63MACHINE_START(W90P910EVB, "W90P910EVB")
64 /* Maintainer: Wan ZongShun */
65 .phys_io = W90X900_PA_UART,
66 .io_pg_offst = (((u32)W90X900_VA_UART) >> 18) & 0xfffc,
67 .boot_params = 0,
68 .map_io = w90p910evb_map_io,
69 .init_irq = w90x900_init_irq,
70 .init_machine = w90p910evb_init,
71 .timer = &w90x900_timer,
72MACHINE_END
diff --git a/arch/arm/mach-w90x900/time.c b/arch/arm/mach-w90x900/time.c
new file mode 100644
index 000000000000..3a69e381f316
--- /dev/null
+++ b/arch/arm/mach-w90x900/time.c
@@ -0,0 +1,80 @@
1/*
2 * linux/arch/arm/mach-w90x900/time.c
3 *
4 * Based on linux/arch/arm/plat-s3c24xx/time.c by Ben Dooks
5 *
6 * Copyright (c) 2008 Nuvoton technology corporation
7 * All rights reserved.
8 *
9 * Wan ZongShun <mcuos.com@gmail.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 */
17
18#include <linux/kernel.h>
19#include <linux/sched.h>
20#include <linux/init.h>
21#include <linux/interrupt.h>
22#include <linux/err.h>
23#include <linux/clk.h>
24#include <linux/io.h>
25#include <linux/leds.h>
26
27#include <asm/mach-types.h>
28#include <asm/mach/irq.h>
29#include <asm/mach/time.h>
30
31#include <mach/system.h>
32#include <mach/map.h>
33#include <mach/regs-timer.h>
34
35static unsigned long w90x900_gettimeoffset(void)
36{
37 return 0;
38}
39
40/*IRQ handler for the timer*/
41
42static irqreturn_t
43w90x900_timer_interrupt(int irq, void *dev_id)
44{
45 timer_tick();
46 __raw_writel(0x01, REG_TISR); /* clear TIF0 */
47 return IRQ_HANDLED;
48}
49
50static struct irqaction w90x900_timer_irq = {
51 .name = "w90x900 Timer Tick",
52 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
53 .handler = w90x900_timer_interrupt,
54};
55
56/*Set up timer reg.*/
57
58static void w90x900_timer_setup(void)
59{
60 __raw_writel(0, REG_TCSR0);
61 __raw_writel(0, REG_TCSR1);
62 __raw_writel(0, REG_TCSR2);
63 __raw_writel(0, REG_TCSR3);
64 __raw_writel(0, REG_TCSR4);
65 __raw_writel(0x1F, REG_TISR);
66 __raw_writel(15000000/(100 * 100), REG_TICR0);
67 __raw_writel(0x68000063, REG_TCSR0);
68}
69
70static void __init w90x900_timer_init(void)
71{
72 w90x900_timer_setup();
73 setup_irq(IRQ_TIMER0, &w90x900_timer_irq);
74}
75
76struct sys_timer w90x900_timer = {
77 .init = w90x900_timer_init,
78 .offset = w90x900_gettimeoffset,
79 .resume = w90x900_timer_setup
80};
diff --git a/arch/arm/mach-w90x900/w90p910.c b/arch/arm/mach-w90x900/w90p910.c
new file mode 100644
index 000000000000..aa783bc94310
--- /dev/null
+++ b/arch/arm/mach-w90x900/w90p910.c
@@ -0,0 +1,134 @@
1/*
2 * linux/arch/arm/mach-w90x900/w90p910.c
3 *
4 * Based on linux/arch/arm/plat-s3c24xx/s3c244x.c by Ben Dooks
5 *
6 * Copyright (c) 2008 Nuvoton technology corporation
7 * All rights reserved.
8 *
9 * Wan ZongShun <mcuos.com@gmail.com>
10 *
11 * W90P910 cpu support
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 as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 */
19
20#include <linux/kernel.h>
21#include <linux/types.h>
22#include <linux/interrupt.h>
23#include <linux/list.h>
24#include <linux/timer.h>
25#include <linux/init.h>
26#include <linux/platform_device.h>
27#include <linux/io.h>
28
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31#include <asm/mach/irq.h>
32#include <asm/irq.h>
33
34#include <mach/hardware.h>
35#include <mach/regs-serial.h>
36
37#include "cpu.h"
38
39/*W90P910 has five uarts*/
40
41#define MAX_UART_COUNT 5
42static int uart_count;
43static struct platform_device *uart_devs[MAX_UART_COUNT-1];
44
45/* Initial IO mappings */
46
47static struct map_desc w90p910_iodesc[] __initdata = {
48 IODESC_ENT(IRQ),
49 IODESC_ENT(GCR),
50 IODESC_ENT(UART),
51 IODESC_ENT(TIMER),
52 IODESC_ENT(EBI),
53 /*IODESC_ENT(LCD),*/
54};
55
56/*Init the dev resource*/
57
58static W90X900_RES(UART0);
59static W90X900_RES(UART1);
60static W90X900_RES(UART2);
61static W90X900_RES(UART3);
62static W90X900_RES(UART4);
63static W90X900_DEVICE(uart0, UART0, 0, "w90x900-uart");
64static W90X900_DEVICE(uart1, UART1, 1, "w90x900-uart");
65static W90X900_DEVICE(uart2, UART2, 2, "w90x900-uart");
66static W90X900_DEVICE(uart3, UART3, 3, "w90x900-uart");
67static W90X900_DEVICE(uart4, UART4, 4, "w90x900-uart");
68
69static struct platform_device *uart_devices[] __initdata = {
70 &w90x900_uart0,
71 &w90x900_uart1,
72 &w90x900_uart2,
73 &w90x900_uart3,
74 &w90x900_uart4
75};
76
77/*Init W90P910 uart device*/
78
79void __init w90p910_init_uarts(struct w90x900_uartcfg *cfg, int no)
80{
81 struct platform_device *platdev;
82 int uart, uartdev;
83
84 /*By min() to judge count of uart be used indeed*/
85
86 uartdev = ARRAY_SIZE(uart_devices);
87 no = min(uartdev, no);
88
89 for (uart = 0; uart < no; uart++, cfg++) {
90 if (cfg->hwport != uart)
91 printk(KERN_ERR "w90x900_uartcfg[%d] error\n", uart);
92 platdev = uart_devices[cfg->hwport];
93 uart_devs[uart] = platdev;
94 platdev->dev.platform_data = cfg;
95 }
96 uart_count = uart;
97}
98
99/*Init W90P910 evb io*/
100
101void __init w90p910_map_io(struct map_desc *mach_desc, int mach_size)
102{
103 unsigned long idcode = 0x0;
104
105 iotable_init(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc));
106
107 idcode = __raw_readl(W90X900PDID);
108 if (idcode != W90P910_CPUID)
109 printk(KERN_ERR "CPU type 0x%08lx is not W90P910\n", idcode);
110}
111
112/*Init W90P910 clock*/
113
114void __init w90p910_init_clocks(int xtal)
115{
116}
117
118static int __init w90p910_init_cpu(void)
119{
120 return 0;
121}
122
123static int __init w90x900_arch_init(void)
124{
125 int ret;
126
127 ret = w90p910_init_cpu();
128 if (ret != 0)
129 return ret;
130
131 return platform_add_devices(uart_devs, uart_count);
132
133}
134arch_initcall(w90x900_arch_init);
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index ab5f7a21350b..d490f3773c01 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -10,8 +10,7 @@ config CPU_32
10 10
11# ARM610 11# ARM610
12config CPU_ARM610 12config CPU_ARM610
13 bool "Support ARM610 processor" 13 bool "Support ARM610 processor" if ARCH_RPC
14 depends on ARCH_RPC
15 select CPU_32v3 14 select CPU_32v3
16 select CPU_CACHE_V3 15 select CPU_CACHE_V3
17 select CPU_CACHE_VIVT 16 select CPU_CACHE_VIVT
@@ -43,8 +42,7 @@ config CPU_ARM7TDMI
43 42
44# ARM710 43# ARM710
45config CPU_ARM710 44config CPU_ARM710
46 bool "Support ARM710 processor" if !ARCH_CLPS7500 && ARCH_RPC 45 bool "Support ARM710 processor" if ARCH_RPC
47 default y if ARCH_CLPS7500
48 select CPU_32v3 46 select CPU_32v3
49 select CPU_CACHE_V3 47 select CPU_CACHE_V3
50 select CPU_CACHE_VIVT 48 select CPU_CACHE_VIVT
@@ -63,8 +61,7 @@ config CPU_ARM710
63 61
64# ARM720T 62# ARM720T
65config CPU_ARM720T 63config CPU_ARM720T
66 bool "Support ARM720T processor" if !ARCH_CLPS711X && !ARCH_L7200 && !ARCH_CDB89712 && ARCH_INTEGRATOR 64 bool "Support ARM720T processor" if ARCH_INTEGRATOR
67 default y if ARCH_CLPS711X || ARCH_L7200 || ARCH_CDB89712 || ARCH_H720X
68 select CPU_32v4T 65 select CPU_32v4T
69 select CPU_ABRT_LV4T 66 select CPU_ABRT_LV4T
70 select CPU_PABRT_NOIFAR 67 select CPU_PABRT_NOIFAR
@@ -114,9 +111,7 @@ config CPU_ARM9TDMI
114 111
115# ARM920T 112# ARM920T
116config CPU_ARM920T 113config CPU_ARM920T
117 bool "Support ARM920T processor" 114 bool "Support ARM920T processor" if ARCH_INTEGRATOR
118 depends on ARCH_EP93XX || ARCH_INTEGRATOR || CPU_S3C2410 || CPU_S3C2440 || CPU_S3C2442 || ARCH_IMX || ARCH_AAEC2000 || ARCH_AT91RM9200
119 default y if CPU_S3C2410 || CPU_S3C2440 || CPU_S3C2442 || ARCH_AT91RM9200
120 select CPU_32v4T 115 select CPU_32v4T
121 select CPU_ABRT_EV4T 116 select CPU_ABRT_EV4T
122 select CPU_PABRT_NOIFAR 117 select CPU_PABRT_NOIFAR
@@ -138,8 +133,6 @@ config CPU_ARM920T
138# ARM922T 133# ARM922T
139config CPU_ARM922T 134config CPU_ARM922T
140 bool "Support ARM922T processor" if ARCH_INTEGRATOR 135 bool "Support ARM922T processor" if ARCH_INTEGRATOR
141 depends on ARCH_LH7A40X || ARCH_INTEGRATOR || ARCH_KS8695
142 default y if ARCH_LH7A40X || ARCH_KS8695
143 select CPU_32v4T 136 select CPU_32v4T
144 select CPU_ABRT_EV4T 137 select CPU_ABRT_EV4T
145 select CPU_PABRT_NOIFAR 138 select CPU_PABRT_NOIFAR
@@ -159,8 +152,6 @@ config CPU_ARM922T
159# ARM925T 152# ARM925T
160config CPU_ARM925T 153config CPU_ARM925T
161 bool "Support ARM925T processor" if ARCH_OMAP1 154 bool "Support ARM925T processor" if ARCH_OMAP1
162 depends on ARCH_OMAP15XX
163 default y if ARCH_OMAP15XX
164 select CPU_32v4T 155 select CPU_32v4T
165 select CPU_ABRT_EV4T 156 select CPU_ABRT_EV4T
166 select CPU_PABRT_NOIFAR 157 select CPU_PABRT_NOIFAR
@@ -179,22 +170,7 @@ config CPU_ARM925T
179 170
180# ARM926T 171# ARM926T
181config CPU_ARM926T 172config CPU_ARM926T
182 bool "Support ARM926T processor" 173 bool "Support ARM926T processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB
183 depends on ARCH_INTEGRATOR || ARCH_VERSATILE_PB || \
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 || ARCH_MX2
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
198 select CPU_32v5 174 select CPU_32v5
199 select CPU_ABRT_EV5TJ 175 select CPU_ABRT_EV5TJ
200 select CPU_PABRT_NOIFAR 176 select CPU_PABRT_NOIFAR
@@ -247,8 +223,7 @@ config CPU_ARM946E
247 223
248# ARM1020 - needs validating 224# ARM1020 - needs validating
249config CPU_ARM1020 225config CPU_ARM1020
250 bool "Support ARM1020T (rev 0) processor" 226 bool "Support ARM1020T (rev 0) processor" if ARCH_INTEGRATOR
251 depends on ARCH_INTEGRATOR
252 select CPU_32v5 227 select CPU_32v5
253 select CPU_ABRT_EV4T 228 select CPU_ABRT_EV4T
254 select CPU_PABRT_NOIFAR 229 select CPU_PABRT_NOIFAR
@@ -266,8 +241,7 @@ config CPU_ARM1020
266 241
267# ARM1020E - needs validating 242# ARM1020E - needs validating
268config CPU_ARM1020E 243config CPU_ARM1020E
269 bool "Support ARM1020E processor" 244 bool "Support ARM1020E processor" if ARCH_INTEGRATOR
270 depends on ARCH_INTEGRATOR
271 select CPU_32v5 245 select CPU_32v5
272 select CPU_ABRT_EV4T 246 select CPU_ABRT_EV4T
273 select CPU_PABRT_NOIFAR 247 select CPU_PABRT_NOIFAR
@@ -280,8 +254,7 @@ config CPU_ARM1020E
280 254
281# ARM1022E 255# ARM1022E
282config CPU_ARM1022 256config CPU_ARM1022
283 bool "Support ARM1022E processor" 257 bool "Support ARM1022E processor" if ARCH_INTEGRATOR
284 depends on ARCH_INTEGRATOR
285 select CPU_32v5 258 select CPU_32v5
286 select CPU_ABRT_EV4T 259 select CPU_ABRT_EV4T
287 select CPU_PABRT_NOIFAR 260 select CPU_PABRT_NOIFAR
@@ -299,8 +272,7 @@ config CPU_ARM1022
299 272
300# ARM1026EJ-S 273# ARM1026EJ-S
301config CPU_ARM1026 274config CPU_ARM1026
302 bool "Support ARM1026EJ-S processor" 275 bool "Support ARM1026EJ-S processor" if ARCH_INTEGRATOR
303 depends on ARCH_INTEGRATOR
304 select CPU_32v5 276 select CPU_32v5
305 select CPU_ABRT_EV5T # But need Jazelle, but EV5TJ ignores bit 10 277 select CPU_ABRT_EV5T # But need Jazelle, but EV5TJ ignores bit 10
306 select CPU_PABRT_NOIFAR 278 select CPU_PABRT_NOIFAR
@@ -317,8 +289,7 @@ config CPU_ARM1026
317 289
318# SA110 290# SA110
319config CPU_SA110 291config CPU_SA110
320 bool "Support StrongARM(R) SA-110 processor" if !ARCH_EBSA110 && !FOOTBRIDGE && !ARCH_TBOX && !ARCH_SHARK && !ARCH_NEXUSPCI && ARCH_RPC 292 bool "Support StrongARM(R) SA-110 processor" if ARCH_RPC
321 default y if ARCH_EBSA110 || FOOTBRIDGE || ARCH_TBOX || ARCH_SHARK || ARCH_NEXUSPCI
322 select CPU_32v3 if ARCH_RPC 293 select CPU_32v3 if ARCH_RPC
323 select CPU_32v4 if !ARCH_RPC 294 select CPU_32v4 if !ARCH_RPC
324 select CPU_ABRT_EV4 295 select CPU_ABRT_EV4
@@ -340,8 +311,6 @@ config CPU_SA110
340# SA1100 311# SA1100
341config CPU_SA1100 312config CPU_SA1100
342 bool 313 bool
343 depends on ARCH_SA1100
344 default y
345 select CPU_32v4 314 select CPU_32v4
346 select CPU_ABRT_EV4 315 select CPU_ABRT_EV4
347 select CPU_PABRT_NOIFAR 316 select CPU_PABRT_NOIFAR
@@ -353,8 +322,6 @@ config CPU_SA1100
353# XScale 322# XScale
354config CPU_XSCALE 323config CPU_XSCALE
355 bool 324 bool
356 depends on ARCH_IOP32X || ARCH_IOP33X || PXA25x || PXA27x || ARCH_IXP4XX || ARCH_IXP2000
357 default y
358 select CPU_32v5 325 select CPU_32v5
359 select CPU_ABRT_EV5T 326 select CPU_ABRT_EV5T
360 select CPU_PABRT_NOIFAR 327 select CPU_PABRT_NOIFAR
@@ -365,8 +332,6 @@ config CPU_XSCALE
365# XScale Core Version 3 332# XScale Core Version 3
366config CPU_XSC3 333config CPU_XSC3
367 bool 334 bool
368 depends on ARCH_IXP23XX || ARCH_IOP13XX || PXA3xx
369 default y
370 select CPU_32v5 335 select CPU_32v5
371 select CPU_ABRT_EV5T 336 select CPU_ABRT_EV5T
372 select CPU_PABRT_NOIFAR 337 select CPU_PABRT_NOIFAR
@@ -378,8 +343,6 @@ config CPU_XSC3
378# Feroceon 343# Feroceon
379config CPU_FEROCEON 344config CPU_FEROCEON
380 bool 345 bool
381 depends on ARCH_ORION5X || ARCH_LOKI || ARCH_KIRKWOOD || ARCH_MV78XX0
382 default y
383 select CPU_32v5 346 select CPU_32v5
384 select CPU_ABRT_EV5T 347 select CPU_ABRT_EV5T
385 select CPU_PABRT_NOIFAR 348 select CPU_PABRT_NOIFAR
@@ -399,10 +362,7 @@ config CPU_FEROCEON_OLD_ID
399 362
400# ARMv6 363# ARMv6
401config CPU_V6 364config CPU_V6
402 bool "Support ARM V6 processor" 365 bool "Support ARM V6 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB
403 depends on ARCH_INTEGRATOR || MACH_REALVIEW_EB || ARCH_OMAP2 || ARCH_MX3 || ARCH_MSM || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176
404 default y if ARCH_MX3
405 default y if ARCH_MSM
406 select CPU_32v6 366 select CPU_32v6
407 select CPU_ABRT_EV6 367 select CPU_ABRT_EV6
408 select CPU_PABRT_NOIFAR 368 select CPU_PABRT_NOIFAR
@@ -427,8 +387,7 @@ config CPU_32v6K
427 387
428# ARMv7 388# ARMv7
429config CPU_V7 389config CPU_V7
430 bool "Support ARM V7 processor" 390 bool "Support ARM V7 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB
431 depends on ARCH_INTEGRATOR || MACH_REALVIEW_EB || ARCH_OMAP3
432 select CPU_32v6K 391 select CPU_32v6K
433 select CPU_32v7 392 select CPU_32v7
434 select CPU_ABRT_EV7 393 select CPU_ABRT_EV7
@@ -745,7 +704,7 @@ config CACHE_FEROCEON_L2_WRITETHROUGH
745 704
746config CACHE_L2X0 705config CACHE_L2X0
747 bool "Enable the L2x0 outer cache controller" 706 bool "Enable the L2x0 outer cache controller"
748 depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176 707 depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176 || REALVIEW_EB_A9MP
749 default y 708 default y
750 select OUTER_CACHE 709 select OUTER_CACHE
751 help 710 help
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index 2d5884ce0435..3a398befed41 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -17,6 +17,7 @@
17#include <linux/string.h> 17#include <linux/string.h>
18#include <linux/proc_fs.h> 18#include <linux/proc_fs.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/sched.h>
20#include <linux/uaccess.h> 21#include <linux/uaccess.h>
21 22
22#include <asm/unaligned.h> 23#include <asm/unaligned.h>
diff --git a/arch/arm/mm/cache-v3.S b/arch/arm/mm/cache-v3.S
index 3b3639eb7ca5..8a4abebc478a 100644
--- a/arch/arm/mm/cache-v3.S
+++ b/arch/arm/mm/cache-v3.S
@@ -9,7 +9,6 @@
9 */ 9 */
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <mach/hardware.h>
13#include <asm/page.h> 12#include <asm/page.h>
14#include "proc-macros.S" 13#include "proc-macros.S"
15 14
diff --git a/arch/arm/mm/cache-v4.S b/arch/arm/mm/cache-v4.S
index 5786adf10040..3668611cb400 100644
--- a/arch/arm/mm/cache-v4.S
+++ b/arch/arm/mm/cache-v4.S
@@ -9,7 +9,6 @@
9 */ 9 */
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <mach/hardware.h>
13#include <asm/page.h> 12#include <asm/page.h>
14#include "proc-macros.S" 13#include "proc-macros.S"
15 14
diff --git a/arch/arm/mm/cache-v4wt.S b/arch/arm/mm/cache-v4wt.S
index 51a9b0b273b6..c54fa2cc40e6 100644
--- a/arch/arm/mm/cache-v4wt.S
+++ b/arch/arm/mm/cache-v4wt.S
@@ -13,7 +13,6 @@
13 */ 13 */
14#include <linux/linkage.h> 14#include <linux/linkage.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <mach/hardware.h>
17#include <asm/page.h> 16#include <asm/page.h>
18#include "proc-macros.S" 17#include "proc-macros.S"
19 18
diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S
index d19c2bec2b1f..be93ff02a98d 100644
--- a/arch/arm/mm/cache-v7.S
+++ b/arch/arm/mm/cache-v7.S
@@ -26,6 +26,7 @@
26 * - mm - mm_struct describing address space 26 * - mm - mm_struct describing address space
27 */ 27 */
28ENTRY(v7_flush_dcache_all) 28ENTRY(v7_flush_dcache_all)
29 dmb @ ensure ordering with previous memory accesses
29 mrc p15, 1, r0, c0, c0, 1 @ read clidr 30 mrc p15, 1, r0, c0, c0, 1 @ read clidr
30 ands r3, r0, #0x7000000 @ extract loc from clidr 31 ands r3, r0, #0x7000000 @ extract loc from clidr
31 mov r3, r3, lsr #23 @ left align loc bit field 32 mov r3, r3, lsr #23 @ left align loc bit field
@@ -64,6 +65,7 @@ skip:
64finished: 65finished:
65 mov r10, #0 @ swith back to cache level 0 66 mov r10, #0 @ swith back to cache level 0
66 mcr p15, 2, r10, c0, c0, 0 @ select current cache level in cssr 67 mcr p15, 2, r10, c0, c0, 0 @ select current cache level in cssr
68 dsb
67 isb 69 isb
68 mov pc, lr 70 mov pc, lr
69ENDPROC(v7_flush_dcache_all) 71ENDPROC(v7_flush_dcache_all)
diff --git a/arch/arm/mm/copypage-feroceon.S b/arch/arm/mm/copypage-feroceon.S
deleted file mode 100644
index 7eb0d320d240..000000000000
--- a/arch/arm/mm/copypage-feroceon.S
+++ /dev/null
@@ -1,95 +0,0 @@
1/*
2 * linux/arch/arm/lib/copypage-feroceon.S
3 *
4 * Copyright (C) 2008 Marvell Semiconductors
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 * This handles copy_user_page and clear_user_page on Feroceon
11 * more optimally than the generic implementations.
12 */
13#include <linux/linkage.h>
14#include <linux/init.h>
15#include <asm/asm-offsets.h>
16
17 .text
18 .align 5
19
20ENTRY(feroceon_copy_user_page)
21 stmfd sp!, {r4-r9, lr}
22 mov ip, #PAGE_SZ
231: mov lr, r1
24 ldmia r1!, {r2 - r9}
25 pld [lr, #32]
26 pld [lr, #64]
27 pld [lr, #96]
28 pld [lr, #128]
29 pld [lr, #160]
30 pld [lr, #192]
31 pld [lr, #224]
32 stmia r0, {r2 - r9}
33 ldmia r1!, {r2 - r9}
34 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line
35 add r0, r0, #32
36 stmia r0, {r2 - r9}
37 ldmia r1!, {r2 - r9}
38 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line
39 add r0, r0, #32
40 stmia r0, {r2 - r9}
41 ldmia r1!, {r2 - r9}
42 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line
43 add r0, r0, #32
44 stmia r0, {r2 - r9}
45 ldmia r1!, {r2 - r9}
46 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line
47 add r0, r0, #32
48 stmia r0, {r2 - r9}
49 ldmia r1!, {r2 - r9}
50 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line
51 add r0, r0, #32
52 stmia r0, {r2 - r9}
53 ldmia r1!, {r2 - r9}
54 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line
55 add r0, r0, #32
56 stmia r0, {r2 - r9}
57 ldmia r1!, {r2 - r9}
58 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line
59 add r0, r0, #32
60 stmia r0, {r2 - r9}
61 subs ip, ip, #(32 * 8)
62 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line
63 add r0, r0, #32
64 bne 1b
65 mcr p15, 0, ip, c7, c10, 4 @ drain WB
66 ldmfd sp!, {r4-r9, pc}
67
68 .align 5
69
70ENTRY(feroceon_clear_user_page)
71 stmfd sp!, {r4-r7, lr}
72 mov r1, #PAGE_SZ/32
73 mov r2, #0
74 mov r3, #0
75 mov r4, #0
76 mov r5, #0
77 mov r6, #0
78 mov r7, #0
79 mov ip, #0
80 mov lr, #0
811: stmia r0, {r2-r7, ip, lr}
82 subs r1, r1, #1
83 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line
84 add r0, r0, #32
85 bne 1b
86 mcr p15, 0, r1, c7, c10, 4 @ drain WB
87 ldmfd sp!, {r4-r7, pc}
88
89 __INITDATA
90
91 .type feroceon_user_fns, #object
92ENTRY(feroceon_user_fns)
93 .long feroceon_clear_user_page
94 .long feroceon_copy_user_page
95 .size feroceon_user_fns, . - feroceon_user_fns
diff --git a/arch/arm/mm/copypage-feroceon.c b/arch/arm/mm/copypage-feroceon.c
new file mode 100644
index 000000000000..c3ba6a94da0c
--- /dev/null
+++ b/arch/arm/mm/copypage-feroceon.c
@@ -0,0 +1,111 @@
1/*
2 * linux/arch/arm/mm/copypage-feroceon.S
3 *
4 * Copyright (C) 2008 Marvell Semiconductors
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 * This handles copy_user_highpage and clear_user_page on Feroceon
11 * more optimally than the generic implementations.
12 */
13#include <linux/init.h>
14#include <linux/highmem.h>
15
16static void __attribute__((naked))
17feroceon_copy_user_page(void *kto, const void *kfrom)
18{
19 asm("\
20 stmfd sp!, {r4-r9, lr} \n\
21 mov ip, %0 \n\
221: mov lr, r1 \n\
23 ldmia r1!, {r2 - r9} \n\
24 pld [lr, #32] \n\
25 pld [lr, #64] \n\
26 pld [lr, #96] \n\
27 pld [lr, #128] \n\
28 pld [lr, #160] \n\
29 pld [lr, #192] \n\
30 pld [lr, #224] \n\
31 stmia r0, {r2 - r9} \n\
32 ldmia r1!, {r2 - r9} \n\
33 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line\n\
34 add r0, r0, #32 \n\
35 stmia r0, {r2 - r9} \n\
36 ldmia r1!, {r2 - r9} \n\
37 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line\n\
38 add r0, r0, #32 \n\
39 stmia r0, {r2 - r9} \n\
40 ldmia r1!, {r2 - r9} \n\
41 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line\n\
42 add r0, r0, #32 \n\
43 stmia r0, {r2 - r9} \n\
44 ldmia r1!, {r2 - r9} \n\
45 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line\n\
46 add r0, r0, #32 \n\
47 stmia r0, {r2 - r9} \n\
48 ldmia r1!, {r2 - r9} \n\
49 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line\n\
50 add r0, r0, #32 \n\
51 stmia r0, {r2 - r9} \n\
52 ldmia r1!, {r2 - r9} \n\
53 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line\n\
54 add r0, r0, #32 \n\
55 stmia r0, {r2 - r9} \n\
56 ldmia r1!, {r2 - r9} \n\
57 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line\n\
58 add r0, r0, #32 \n\
59 stmia r0, {r2 - r9} \n\
60 subs ip, ip, #(32 * 8) \n\
61 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line\n\
62 add r0, r0, #32 \n\
63 bne 1b \n\
64 mcr p15, 0, ip, c7, c10, 4 @ drain WB\n\
65 ldmfd sp!, {r4-r9, pc}"
66 :
67 : "I" (PAGE_SIZE));
68}
69
70void feroceon_copy_user_highpage(struct page *to, struct page *from,
71 unsigned long vaddr)
72{
73 void *kto, *kfrom;
74
75 kto = kmap_atomic(to, KM_USER0);
76 kfrom = kmap_atomic(from, KM_USER1);
77 feroceon_copy_user_page(kto, kfrom);
78 kunmap_atomic(kfrom, KM_USER1);
79 kunmap_atomic(kto, KM_USER0);
80}
81
82void feroceon_clear_user_highpage(struct page *page, unsigned long vaddr)
83{
84 void *ptr, *kaddr = kmap_atomic(page, KM_USER0);
85 asm volatile ("\
86 mov r1, %2 \n\
87 mov r2, #0 \n\
88 mov r3, #0 \n\
89 mov r4, #0 \n\
90 mov r5, #0 \n\
91 mov r6, #0 \n\
92 mov r7, #0 \n\
93 mov ip, #0 \n\
94 mov lr, #0 \n\
951: stmia %0, {r2-r7, ip, lr} \n\
96 subs r1, r1, #1 \n\
97 mcr p15, 0, %0, c7, c14, 1 @ clean and invalidate D line\n\
98 add %0, %0, #32 \n\
99 bne 1b \n\
100 mcr p15, 0, r1, c7, c10, 4 @ drain WB"
101 : "=r" (ptr)
102 : "0" (kaddr), "I" (PAGE_SIZE / 32)
103 : "r1", "r2", "r3", "r4", "r5", "r6", "r7", "ip", "lr");
104 kunmap_atomic(kaddr, KM_USER0);
105}
106
107struct cpu_user_fns feroceon_user_fns __initdata = {
108 .cpu_clear_user_highpage = feroceon_clear_user_highpage,
109 .cpu_copy_user_highpage = feroceon_copy_user_highpage,
110};
111
diff --git a/arch/arm/mm/copypage-v3.S b/arch/arm/mm/copypage-v3.S
deleted file mode 100644
index 2ee394b11bcb..000000000000
--- a/arch/arm/mm/copypage-v3.S
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2 * linux/arch/arm/lib/copypage.S
3 *
4 * Copyright (C) 1995-1999 Russell King
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 * ASM optimised string functions
11 */
12#include <linux/linkage.h>
13#include <linux/init.h>
14#include <asm/assembler.h>
15#include <asm/asm-offsets.h>
16
17 .text
18 .align 5
19/*
20 * ARMv3 optimised copy_user_page
21 *
22 * FIXME: do we need to handle cache stuff...
23 */
24ENTRY(v3_copy_user_page)
25 stmfd sp!, {r4, lr} @ 2
26 mov r2, #PAGE_SZ/64 @ 1
27 ldmia r1!, {r3, r4, ip, lr} @ 4+1
281: stmia r0!, {r3, r4, ip, lr} @ 4
29 ldmia r1!, {r3, r4, ip, lr} @ 4+1
30 stmia r0!, {r3, r4, ip, lr} @ 4
31 ldmia r1!, {r3, r4, ip, lr} @ 4+1
32 stmia r0!, {r3, r4, ip, lr} @ 4
33 ldmia r1!, {r3, r4, ip, lr} @ 4
34 subs r2, r2, #1 @ 1
35 stmia r0!, {r3, r4, ip, lr} @ 4
36 ldmneia r1!, {r3, r4, ip, lr} @ 4
37 bne 1b @ 1
38 ldmfd sp!, {r4, pc} @ 3
39
40 .align 5
41/*
42 * ARMv3 optimised clear_user_page
43 *
44 * FIXME: do we need to handle cache stuff...
45 */
46ENTRY(v3_clear_user_page)
47 str lr, [sp, #-4]!
48 mov r1, #PAGE_SZ/64 @ 1
49 mov r2, #0 @ 1
50 mov r3, #0 @ 1
51 mov ip, #0 @ 1
52 mov lr, #0 @ 1
531: stmia r0!, {r2, r3, ip, lr} @ 4
54 stmia r0!, {r2, r3, ip, lr} @ 4
55 stmia r0!, {r2, r3, ip, lr} @ 4
56 stmia r0!, {r2, r3, ip, lr} @ 4
57 subs r1, r1, #1 @ 1
58 bne 1b @ 1
59 ldr pc, [sp], #4
60
61 __INITDATA
62
63 .type v3_user_fns, #object
64ENTRY(v3_user_fns)
65 .long v3_clear_user_page
66 .long v3_copy_user_page
67 .size v3_user_fns, . - v3_user_fns
diff --git a/arch/arm/mm/copypage-v3.c b/arch/arm/mm/copypage-v3.c
new file mode 100644
index 000000000000..70ed96c8af8e
--- /dev/null
+++ b/arch/arm/mm/copypage-v3.c
@@ -0,0 +1,81 @@
1/*
2 * linux/arch/arm/mm/copypage-v3.c
3 *
4 * Copyright (C) 1995-1999 Russell King
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/init.h>
11#include <linux/highmem.h>
12
13/*
14 * ARMv3 optimised copy_user_highpage
15 *
16 * FIXME: do we need to handle cache stuff...
17 */
18static void __attribute__((naked))
19v3_copy_user_page(void *kto, const void *kfrom)
20{
21 asm("\n\
22 stmfd sp!, {r4, lr} @ 2\n\
23 mov r2, %2 @ 1\n\
24 ldmia %0!, {r3, r4, ip, lr} @ 4+1\n\
251: stmia %1!, {r3, r4, ip, lr} @ 4\n\
26 ldmia %0!, {r3, r4, ip, lr} @ 4+1\n\
27 stmia %1!, {r3, r4, ip, lr} @ 4\n\
28 ldmia %0!, {r3, r4, ip, lr} @ 4+1\n\
29 stmia %1!, {r3, r4, ip, lr} @ 4\n\
30 ldmia %0!, {r3, r4, ip, lr} @ 4\n\
31 subs r2, r2, #1 @ 1\n\
32 stmia %1!, {r3, r4, ip, lr} @ 4\n\
33 ldmneia %0!, {r3, r4, ip, lr} @ 4\n\
34 bne 1b @ 1\n\
35 ldmfd sp!, {r4, pc} @ 3"
36 :
37 : "r" (kfrom), "r" (kto), "I" (PAGE_SIZE / 64));
38}
39
40void v3_copy_user_highpage(struct page *to, struct page *from,
41 unsigned long vaddr)
42{
43 void *kto, *kfrom;
44
45 kto = kmap_atomic(to, KM_USER0);
46 kfrom = kmap_atomic(from, KM_USER1);
47 v3_copy_user_page(kto, kfrom);
48 kunmap_atomic(kfrom, KM_USER1);
49 kunmap_atomic(kto, KM_USER0);
50}
51
52/*
53 * ARMv3 optimised clear_user_page
54 *
55 * FIXME: do we need to handle cache stuff...
56 */
57void v3_clear_user_highpage(struct page *page, unsigned long vaddr)
58{
59 void *ptr, *kaddr = kmap_atomic(page, KM_USER0);
60 asm volatile("\n\
61 mov r1, %2 @ 1\n\
62 mov r2, #0 @ 1\n\
63 mov r3, #0 @ 1\n\
64 mov ip, #0 @ 1\n\
65 mov lr, #0 @ 1\n\
661: stmia %0!, {r2, r3, ip, lr} @ 4\n\
67 stmia %0!, {r2, r3, ip, lr} @ 4\n\
68 stmia %0!, {r2, r3, ip, lr} @ 4\n\
69 stmia %0!, {r2, r3, ip, lr} @ 4\n\
70 subs r1, r1, #1 @ 1\n\
71 bne 1b @ 1"
72 : "=r" (ptr)
73 : "0" (kaddr), "I" (PAGE_SIZE / 64)
74 : "r1", "r2", "r3", "ip", "lr");
75 kunmap_atomic(kaddr, KM_USER0);
76}
77
78struct cpu_user_fns v3_user_fns __initdata = {
79 .cpu_clear_user_highpage = v3_clear_user_highpage,
80 .cpu_copy_user_highpage = v3_copy_user_highpage,
81};
diff --git a/arch/arm/mm/copypage-v4mc.c b/arch/arm/mm/copypage-v4mc.c
index 8d33e2549344..bdb5fd983b15 100644
--- a/arch/arm/mm/copypage-v4mc.c
+++ b/arch/arm/mm/copypage-v4mc.c
@@ -15,8 +15,8 @@
15 */ 15 */
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/highmem.h>
18 19
19#include <asm/page.h>
20#include <asm/pgtable.h> 20#include <asm/pgtable.h>
21#include <asm/tlbflush.h> 21#include <asm/tlbflush.h>
22#include <asm/cacheflush.h> 22#include <asm/cacheflush.h>
@@ -33,7 +33,7 @@
33static DEFINE_SPINLOCK(minicache_lock); 33static DEFINE_SPINLOCK(minicache_lock);
34 34
35/* 35/*
36 * ARMv4 mini-dcache optimised copy_user_page 36 * ARMv4 mini-dcache optimised copy_user_highpage
37 * 37 *
38 * We flush the destination cache lines just before we write the data into the 38 * We flush the destination cache lines just before we write the data into the
39 * corresponding address. Since the Dcache is read-allocate, this removes the 39 * corresponding address. Since the Dcache is read-allocate, this removes the
@@ -42,7 +42,7 @@ static DEFINE_SPINLOCK(minicache_lock);
42 * 42 *
43 * Note: We rely on all ARMv4 processors implementing the "invalidate D line" 43 * Note: We rely on all ARMv4 processors implementing the "invalidate D line"
44 * instruction. If your processor does not supply this, you have to write your 44 * instruction. If your processor does not supply this, you have to write your
45 * own copy_user_page that does the right thing. 45 * own copy_user_highpage that does the right thing.
46 */ 46 */
47static void __attribute__((naked)) 47static void __attribute__((naked))
48mc_copy_user_page(void *from, void *to) 48mc_copy_user_page(void *from, void *to)
@@ -68,50 +68,53 @@ mc_copy_user_page(void *from, void *to)
68 : "r" (from), "r" (to), "I" (PAGE_SIZE / 64)); 68 : "r" (from), "r" (to), "I" (PAGE_SIZE / 64));
69} 69}
70 70
71void v4_mc_copy_user_page(void *kto, const void *kfrom, unsigned long vaddr) 71void v4_mc_copy_user_highpage(struct page *from, struct page *to,
72 unsigned long vaddr)
72{ 73{
73 struct page *page = virt_to_page(kfrom); 74 void *kto = kmap_atomic(to, KM_USER1);
74 75
75 if (test_and_clear_bit(PG_dcache_dirty, &page->flags)) 76 if (test_and_clear_bit(PG_dcache_dirty, &from->flags))
76 __flush_dcache_page(page_mapping(page), page); 77 __flush_dcache_page(page_mapping(from), from);
77 78
78 spin_lock(&minicache_lock); 79 spin_lock(&minicache_lock);
79 80
80 set_pte_ext(TOP_PTE(0xffff8000), pfn_pte(__pa(kfrom) >> PAGE_SHIFT, minicache_pgprot), 0); 81 set_pte_ext(TOP_PTE(0xffff8000), pfn_pte(page_to_pfn(from), minicache_pgprot), 0);
81 flush_tlb_kernel_page(0xffff8000); 82 flush_tlb_kernel_page(0xffff8000);
82 83
83 mc_copy_user_page((void *)0xffff8000, kto); 84 mc_copy_user_page((void *)0xffff8000, kto);
84 85
85 spin_unlock(&minicache_lock); 86 spin_unlock(&minicache_lock);
87
88 kunmap_atomic(kto, KM_USER1);
86} 89}
87 90
88/* 91/*
89 * ARMv4 optimised clear_user_page 92 * ARMv4 optimised clear_user_page
90 */ 93 */
91void __attribute__((naked)) 94void v4_mc_clear_user_highpage(struct page *page, unsigned long vaddr)
92v4_mc_clear_user_page(void *kaddr, unsigned long vaddr)
93{ 95{
94 asm volatile( 96 void *ptr, *kaddr = kmap_atomic(page, KM_USER0);
95 "str lr, [sp, #-4]!\n\ 97 asm volatile("\
96 mov r1, %0 @ 1\n\ 98 mov r1, %2 @ 1\n\
97 mov r2, #0 @ 1\n\ 99 mov r2, #0 @ 1\n\
98 mov r3, #0 @ 1\n\ 100 mov r3, #0 @ 1\n\
99 mov ip, #0 @ 1\n\ 101 mov ip, #0 @ 1\n\
100 mov lr, #0 @ 1\n\ 102 mov lr, #0 @ 1\n\
1011: mcr p15, 0, r0, c7, c6, 1 @ 1 invalidate D line\n\ 1031: mcr p15, 0, %0, c7, c6, 1 @ 1 invalidate D line\n\
102 stmia r0!, {r2, r3, ip, lr} @ 4\n\ 104 stmia %0!, {r2, r3, ip, lr} @ 4\n\
103 stmia r0!, {r2, r3, ip, lr} @ 4\n\ 105 stmia %0!, {r2, r3, ip, lr} @ 4\n\
104 mcr p15, 0, r0, c7, c6, 1 @ 1 invalidate D line\n\ 106 mcr p15, 0, %0, c7, c6, 1 @ 1 invalidate D line\n\
105 stmia r0!, {r2, r3, ip, lr} @ 4\n\ 107 stmia %0!, {r2, r3, ip, lr} @ 4\n\
106 stmia r0!, {r2, r3, ip, lr} @ 4\n\ 108 stmia %0!, {r2, r3, ip, lr} @ 4\n\
107 subs r1, r1, #1 @ 1\n\ 109 subs r1, r1, #1 @ 1\n\
108 bne 1b @ 1\n\ 110 bne 1b @ 1"
109 ldr pc, [sp], #4" 111 : "=r" (ptr)
110 : 112 : "0" (kaddr), "I" (PAGE_SIZE / 64)
111 : "I" (PAGE_SIZE / 64)); 113 : "r1", "r2", "r3", "ip", "lr");
114 kunmap_atomic(kaddr, KM_USER0);
112} 115}
113 116
114struct cpu_user_fns v4_mc_user_fns __initdata = { 117struct cpu_user_fns v4_mc_user_fns __initdata = {
115 .cpu_clear_user_page = v4_mc_clear_user_page, 118 .cpu_clear_user_highpage = v4_mc_clear_user_highpage,
116 .cpu_copy_user_page = v4_mc_copy_user_page, 119 .cpu_copy_user_highpage = v4_mc_copy_user_highpage,
117}; 120};
diff --git a/arch/arm/mm/copypage-v4wb.S b/arch/arm/mm/copypage-v4wb.S
deleted file mode 100644
index 83117354b1cd..000000000000
--- a/arch/arm/mm/copypage-v4wb.S
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * linux/arch/arm/lib/copypage.S
3 *
4 * Copyright (C) 1995-1999 Russell King
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 * ASM optimised string functions
11 */
12#include <linux/linkage.h>
13#include <linux/init.h>
14#include <asm/asm-offsets.h>
15
16 .text
17 .align 5
18/*
19 * ARMv4 optimised copy_user_page
20 *
21 * We flush the destination cache lines just before we write the data into the
22 * corresponding address. Since the Dcache is read-allocate, this removes the
23 * Dcache aliasing issue. The writes will be forwarded to the write buffer,
24 * and merged as appropriate.
25 *
26 * Note: We rely on all ARMv4 processors implementing the "invalidate D line"
27 * instruction. If your processor does not supply this, you have to write your
28 * own copy_user_page that does the right thing.
29 */
30ENTRY(v4wb_copy_user_page)
31 stmfd sp!, {r4, lr} @ 2
32 mov r2, #PAGE_SZ/64 @ 1
33 ldmia r1!, {r3, r4, ip, lr} @ 4
341: mcr p15, 0, r0, c7, c6, 1 @ 1 invalidate D line
35 stmia r0!, {r3, r4, ip, lr} @ 4
36 ldmia r1!, {r3, r4, ip, lr} @ 4+1
37 stmia r0!, {r3, r4, ip, lr} @ 4
38 ldmia r1!, {r3, r4, ip, lr} @ 4
39 mcr p15, 0, r0, c7, c6, 1 @ 1 invalidate D line
40 stmia r0!, {r3, r4, ip, lr} @ 4
41 ldmia r1!, {r3, r4, ip, lr} @ 4
42 subs r2, r2, #1 @ 1
43 stmia r0!, {r3, r4, ip, lr} @ 4
44 ldmneia r1!, {r3, r4, ip, lr} @ 4
45 bne 1b @ 1
46 mcr p15, 0, r1, c7, c10, 4 @ 1 drain WB
47 ldmfd sp!, {r4, pc} @ 3
48
49 .align 5
50/*
51 * ARMv4 optimised clear_user_page
52 *
53 * Same story as above.
54 */
55ENTRY(v4wb_clear_user_page)
56 str lr, [sp, #-4]!
57 mov r1, #PAGE_SZ/64 @ 1
58 mov r2, #0 @ 1
59 mov r3, #0 @ 1
60 mov ip, #0 @ 1
61 mov lr, #0 @ 1
621: mcr p15, 0, r0, c7, c6, 1 @ 1 invalidate D line
63 stmia r0!, {r2, r3, ip, lr} @ 4
64 stmia r0!, {r2, r3, ip, lr} @ 4
65 mcr p15, 0, r0, c7, c6, 1 @ 1 invalidate D line
66 stmia r0!, {r2, r3, ip, lr} @ 4
67 stmia r0!, {r2, r3, ip, lr} @ 4
68 subs r1, r1, #1 @ 1
69 bne 1b @ 1
70 mcr p15, 0, r1, c7, c10, 4 @ 1 drain WB
71 ldr pc, [sp], #4
72
73 __INITDATA
74
75 .type v4wb_user_fns, #object
76ENTRY(v4wb_user_fns)
77 .long v4wb_clear_user_page
78 .long v4wb_copy_user_page
79 .size v4wb_user_fns, . - v4wb_user_fns
diff --git a/arch/arm/mm/copypage-v4wb.c b/arch/arm/mm/copypage-v4wb.c
new file mode 100644
index 000000000000..3ec93dab7656
--- /dev/null
+++ b/arch/arm/mm/copypage-v4wb.c
@@ -0,0 +1,94 @@
1/*
2 * linux/arch/arm/mm/copypage-v4wb.c
3 *
4 * Copyright (C) 1995-1999 Russell King
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/init.h>
11#include <linux/highmem.h>
12
13/*
14 * ARMv4 optimised copy_user_highpage
15 *
16 * We flush the destination cache lines just before we write the data into the
17 * corresponding address. Since the Dcache is read-allocate, this removes the
18 * Dcache aliasing issue. The writes will be forwarded to the write buffer,
19 * and merged as appropriate.
20 *
21 * Note: We rely on all ARMv4 processors implementing the "invalidate D line"
22 * instruction. If your processor does not supply this, you have to write your
23 * own copy_user_highpage that does the right thing.
24 */
25static void __attribute__((naked))
26v4wb_copy_user_page(void *kto, const void *kfrom)
27{
28 asm("\
29 stmfd sp!, {r4, lr} @ 2\n\
30 mov r2, %0 @ 1\n\
31 ldmia r1!, {r3, r4, ip, lr} @ 4\n\
321: mcr p15, 0, r0, c7, c6, 1 @ 1 invalidate D line\n\
33 stmia r0!, {r3, r4, ip, lr} @ 4\n\
34 ldmia r1!, {r3, r4, ip, lr} @ 4+1\n\
35 stmia r0!, {r3, r4, ip, lr} @ 4\n\
36 ldmia r1!, {r3, r4, ip, lr} @ 4\n\
37 mcr p15, 0, r0, c7, c6, 1 @ 1 invalidate D line\n\
38 stmia r0!, {r3, r4, ip, lr} @ 4\n\
39 ldmia r1!, {r3, r4, ip, lr} @ 4\n\
40 subs r2, r2, #1 @ 1\n\
41 stmia r0!, {r3, r4, ip, lr} @ 4\n\
42 ldmneia r1!, {r3, r4, ip, lr} @ 4\n\
43 bne 1b @ 1\n\
44 mcr p15, 0, r1, c7, c10, 4 @ 1 drain WB\n\
45 ldmfd sp!, {r4, pc} @ 3"
46 :
47 : "I" (PAGE_SIZE / 64));
48}
49
50void v4wb_copy_user_highpage(struct page *to, struct page *from,
51 unsigned long vaddr)
52{
53 void *kto, *kfrom;
54
55 kto = kmap_atomic(to, KM_USER0);
56 kfrom = kmap_atomic(from, KM_USER1);
57 v4wb_copy_user_page(kto, kfrom);
58 kunmap_atomic(kfrom, KM_USER1);
59 kunmap_atomic(kto, KM_USER0);
60}
61
62/*
63 * ARMv4 optimised clear_user_page
64 *
65 * Same story as above.
66 */
67void v4wb_clear_user_highpage(struct page *page, unsigned long vaddr)
68{
69 void *ptr, *kaddr = kmap_atomic(page, KM_USER0);
70 asm volatile("\
71 mov r1, %2 @ 1\n\
72 mov r2, #0 @ 1\n\
73 mov r3, #0 @ 1\n\
74 mov ip, #0 @ 1\n\
75 mov lr, #0 @ 1\n\
761: mcr p15, 0, %0, c7, c6, 1 @ 1 invalidate D line\n\
77 stmia %0!, {r2, r3, ip, lr} @ 4\n\
78 stmia %0!, {r2, r3, ip, lr} @ 4\n\
79 mcr p15, 0, %0, c7, c6, 1 @ 1 invalidate D line\n\
80 stmia %0!, {r2, r3, ip, lr} @ 4\n\
81 stmia %0!, {r2, r3, ip, lr} @ 4\n\
82 subs r1, r1, #1 @ 1\n\
83 bne 1b @ 1\n\
84 mcr p15, 0, r1, c7, c10, 4 @ 1 drain WB"
85 : "=r" (ptr)
86 : "0" (kaddr), "I" (PAGE_SIZE / 64)
87 : "r1", "r2", "r3", "ip", "lr");
88 kunmap_atomic(kaddr, KM_USER0);
89}
90
91struct cpu_user_fns v4wb_user_fns __initdata = {
92 .cpu_clear_user_highpage = v4wb_clear_user_highpage,
93 .cpu_copy_user_highpage = v4wb_copy_user_highpage,
94};
diff --git a/arch/arm/mm/copypage-v4wt.S b/arch/arm/mm/copypage-v4wt.S
deleted file mode 100644
index e1f2af28d549..000000000000
--- a/arch/arm/mm/copypage-v4wt.S
+++ /dev/null
@@ -1,73 +0,0 @@
1/*
2 * linux/arch/arm/lib/copypage-v4.S
3 *
4 * Copyright (C) 1995-1999 Russell King
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 * ASM optimised string functions
11 *
12 * This is for CPUs with a writethrough cache and 'flush ID cache' is
13 * the only supported cache operation.
14 */
15#include <linux/linkage.h>
16#include <linux/init.h>
17#include <asm/asm-offsets.h>
18
19 .text
20 .align 5
21/*
22 * ARMv4 optimised copy_user_page
23 *
24 * Since we have writethrough caches, we don't have to worry about
25 * dirty data in the cache. However, we do have to ensure that
26 * subsequent reads are up to date.
27 */
28ENTRY(v4wt_copy_user_page)
29 stmfd sp!, {r4, lr} @ 2
30 mov r2, #PAGE_SZ/64 @ 1
31 ldmia r1!, {r3, r4, ip, lr} @ 4
321: stmia r0!, {r3, r4, ip, lr} @ 4
33 ldmia r1!, {r3, r4, ip, lr} @ 4+1
34 stmia r0!, {r3, r4, ip, lr} @ 4
35 ldmia r1!, {r3, r4, ip, lr} @ 4
36 stmia r0!, {r3, r4, ip, lr} @ 4
37 ldmia r1!, {r3, r4, ip, lr} @ 4
38 subs r2, r2, #1 @ 1
39 stmia r0!, {r3, r4, ip, lr} @ 4
40 ldmneia r1!, {r3, r4, ip, lr} @ 4
41 bne 1b @ 1
42 mcr p15, 0, r2, c7, c7, 0 @ flush ID cache
43 ldmfd sp!, {r4, pc} @ 3
44
45 .align 5
46/*
47 * ARMv4 optimised clear_user_page
48 *
49 * Same story as above.
50 */
51ENTRY(v4wt_clear_user_page)
52 str lr, [sp, #-4]!
53 mov r1, #PAGE_SZ/64 @ 1
54 mov r2, #0 @ 1
55 mov r3, #0 @ 1
56 mov ip, #0 @ 1
57 mov lr, #0 @ 1
581: stmia r0!, {r2, r3, ip, lr} @ 4
59 stmia r0!, {r2, r3, ip, lr} @ 4
60 stmia r0!, {r2, r3, ip, lr} @ 4
61 stmia r0!, {r2, r3, ip, lr} @ 4
62 subs r1, r1, #1 @ 1
63 bne 1b @ 1
64 mcr p15, 0, r2, c7, c7, 0 @ flush ID cache
65 ldr pc, [sp], #4
66
67 __INITDATA
68
69 .type v4wt_user_fns, #object
70ENTRY(v4wt_user_fns)
71 .long v4wt_clear_user_page
72 .long v4wt_copy_user_page
73 .size v4wt_user_fns, . - v4wt_user_fns
diff --git a/arch/arm/mm/copypage-v4wt.c b/arch/arm/mm/copypage-v4wt.c
new file mode 100644
index 000000000000..0f1188efae45
--- /dev/null
+++ b/arch/arm/mm/copypage-v4wt.c
@@ -0,0 +1,88 @@
1/*
2 * linux/arch/arm/mm/copypage-v4wt.S
3 *
4 * Copyright (C) 1995-1999 Russell King
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 * This is for CPUs with a writethrough cache and 'flush ID cache' is
11 * the only supported cache operation.
12 */
13#include <linux/init.h>
14#include <linux/highmem.h>
15
16/*
17 * ARMv4 optimised copy_user_highpage
18 *
19 * Since we have writethrough caches, we don't have to worry about
20 * dirty data in the cache. However, we do have to ensure that
21 * subsequent reads are up to date.
22 */
23static void __attribute__((naked))
24v4wt_copy_user_page(void *kto, const void *kfrom)
25{
26 asm("\
27 stmfd sp!, {r4, lr} @ 2\n\
28 mov r2, %0 @ 1\n\
29 ldmia r1!, {r3, r4, ip, lr} @ 4\n\
301: stmia r0!, {r3, r4, ip, lr} @ 4\n\
31 ldmia r1!, {r3, r4, ip, lr} @ 4+1\n\
32 stmia r0!, {r3, r4, ip, lr} @ 4\n\
33 ldmia r1!, {r3, r4, ip, lr} @ 4\n\
34 stmia r0!, {r3, r4, ip, lr} @ 4\n\
35 ldmia r1!, {r3, r4, ip, lr} @ 4\n\
36 subs r2, r2, #1 @ 1\n\
37 stmia r0!, {r3, r4, ip, lr} @ 4\n\
38 ldmneia r1!, {r3, r4, ip, lr} @ 4\n\
39 bne 1b @ 1\n\
40 mcr p15, 0, r2, c7, c7, 0 @ flush ID cache\n\
41 ldmfd sp!, {r4, pc} @ 3"
42 :
43 : "I" (PAGE_SIZE / 64));
44}
45
46void v4wt_copy_user_highpage(struct page *to, struct page *from,
47 unsigned long vaddr)
48{
49 void *kto, *kfrom;
50
51 kto = kmap_atomic(to, KM_USER0);
52 kfrom = kmap_atomic(from, KM_USER1);
53 v4wt_copy_user_page(kto, kfrom);
54 kunmap_atomic(kfrom, KM_USER1);
55 kunmap_atomic(kto, KM_USER0);
56}
57
58/*
59 * ARMv4 optimised clear_user_page
60 *
61 * Same story as above.
62 */
63void v4wt_clear_user_highpage(struct page *page, unsigned long vaddr)
64{
65 void *ptr, *kaddr = kmap_atomic(page, KM_USER0);
66 asm volatile("\
67 mov r1, %2 @ 1\n\
68 mov r2, #0 @ 1\n\
69 mov r3, #0 @ 1\n\
70 mov ip, #0 @ 1\n\
71 mov lr, #0 @ 1\n\
721: stmia %0!, {r2, r3, ip, lr} @ 4\n\
73 stmia %0!, {r2, r3, ip, lr} @ 4\n\
74 stmia %0!, {r2, r3, ip, lr} @ 4\n\
75 stmia %0!, {r2, r3, ip, lr} @ 4\n\
76 subs r1, r1, #1 @ 1\n\
77 bne 1b @ 1\n\
78 mcr p15, 0, r2, c7, c7, 0 @ flush ID cache"
79 : "=r" (ptr)
80 : "0" (kaddr), "I" (PAGE_SIZE / 64)
81 : "r1", "r2", "r3", "ip", "lr");
82 kunmap_atomic(kaddr, KM_USER0);
83}
84
85struct cpu_user_fns v4wt_user_fns __initdata = {
86 .cpu_clear_user_highpage = v4wt_clear_user_highpage,
87 .cpu_copy_user_highpage = v4wt_copy_user_highpage,
88};
diff --git a/arch/arm/mm/copypage-v6.c b/arch/arm/mm/copypage-v6.c
index 0e21c0767580..4127a7bddfe5 100644
--- a/arch/arm/mm/copypage-v6.c
+++ b/arch/arm/mm/copypage-v6.c
@@ -10,8 +10,8 @@
10#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/spinlock.h> 11#include <linux/spinlock.h>
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/highmem.h>
13 14
14#include <asm/page.h>
15#include <asm/pgtable.h> 15#include <asm/pgtable.h>
16#include <asm/shmparam.h> 16#include <asm/shmparam.h>
17#include <asm/tlbflush.h> 17#include <asm/tlbflush.h>
@@ -33,41 +33,56 @@ static DEFINE_SPINLOCK(v6_lock);
33 * Copy the user page. No aliasing to deal with so we can just 33 * Copy the user page. No aliasing to deal with so we can just
34 * attack the kernel's existing mapping of these pages. 34 * attack the kernel's existing mapping of these pages.
35 */ 35 */
36static void v6_copy_user_page_nonaliasing(void *kto, const void *kfrom, unsigned long vaddr) 36static void v6_copy_user_highpage_nonaliasing(struct page *to,
37 struct page *from, unsigned long vaddr)
37{ 38{
39 void *kto, *kfrom;
40
41 kfrom = kmap_atomic(from, KM_USER0);
42 kto = kmap_atomic(to, KM_USER1);
38 copy_page(kto, kfrom); 43 copy_page(kto, kfrom);
44 kunmap_atomic(kto, KM_USER1);
45 kunmap_atomic(kfrom, KM_USER0);
39} 46}
40 47
41/* 48/*
42 * Clear the user page. No aliasing to deal with so we can just 49 * Clear the user page. No aliasing to deal with so we can just
43 * attack the kernel's existing mapping of this page. 50 * attack the kernel's existing mapping of this page.
44 */ 51 */
45static void v6_clear_user_page_nonaliasing(void *kaddr, unsigned long vaddr) 52static void v6_clear_user_highpage_nonaliasing(struct page *page, unsigned long vaddr)
46{ 53{
54 void *kaddr = kmap_atomic(page, KM_USER0);
47 clear_page(kaddr); 55 clear_page(kaddr);
56 kunmap_atomic(kaddr, KM_USER0);
48} 57}
49 58
50/* 59/*
51 * Copy the page, taking account of the cache colour. 60 * Discard data in the kernel mapping for the new page.
61 * FIXME: needs this MCRR to be supported.
52 */ 62 */
53static void v6_copy_user_page_aliasing(void *kto, const void *kfrom, unsigned long vaddr) 63static void discard_old_kernel_data(void *kto)
54{ 64{
55 unsigned int offset = CACHE_COLOUR(vaddr);
56 unsigned long from, to;
57 struct page *page = virt_to_page(kfrom);
58
59 if (test_and_clear_bit(PG_dcache_dirty, &page->flags))
60 __flush_dcache_page(page_mapping(page), page);
61
62 /*
63 * Discard data in the kernel mapping for the new page.
64 * FIXME: needs this MCRR to be supported.
65 */
66 __asm__("mcrr p15, 0, %1, %0, c6 @ 0xec401f06" 65 __asm__("mcrr p15, 0, %1, %0, c6 @ 0xec401f06"
67 : 66 :
68 : "r" (kto), 67 : "r" (kto),
69 "r" ((unsigned long)kto + PAGE_SIZE - L1_CACHE_BYTES) 68 "r" ((unsigned long)kto + PAGE_SIZE - L1_CACHE_BYTES)
70 : "cc"); 69 : "cc");
70}
71
72/*
73 * Copy the page, taking account of the cache colour.
74 */
75static void v6_copy_user_highpage_aliasing(struct page *to,
76 struct page *from, unsigned long vaddr)
77{
78 unsigned int offset = CACHE_COLOUR(vaddr);
79 unsigned long kfrom, kto;
80
81 if (test_and_clear_bit(PG_dcache_dirty, &from->flags))
82 __flush_dcache_page(page_mapping(from), from);
83
84 /* FIXME: not highmem safe */
85 discard_old_kernel_data(page_address(to));
71 86
72 /* 87 /*
73 * Now copy the page using the same cache colour as the 88 * Now copy the page using the same cache colour as the
@@ -75,16 +90,16 @@ static void v6_copy_user_page_aliasing(void *kto, const void *kfrom, unsigned lo
75 */ 90 */
76 spin_lock(&v6_lock); 91 spin_lock(&v6_lock);
77 92
78 set_pte_ext(TOP_PTE(from_address) + offset, pfn_pte(__pa(kfrom) >> PAGE_SHIFT, PAGE_KERNEL), 0); 93 set_pte_ext(TOP_PTE(from_address) + offset, pfn_pte(page_to_pfn(from), PAGE_KERNEL), 0);
79 set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(__pa(kto) >> PAGE_SHIFT, PAGE_KERNEL), 0); 94 set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(to), PAGE_KERNEL), 0);
80 95
81 from = from_address + (offset << PAGE_SHIFT); 96 kfrom = from_address + (offset << PAGE_SHIFT);
82 to = to_address + (offset << PAGE_SHIFT); 97 kto = to_address + (offset << PAGE_SHIFT);
83 98
84 flush_tlb_kernel_page(from); 99 flush_tlb_kernel_page(kfrom);
85 flush_tlb_kernel_page(to); 100 flush_tlb_kernel_page(kto);
86 101
87 copy_page((void *)to, (void *)from); 102 copy_page((void *)kto, (void *)kfrom);
88 103
89 spin_unlock(&v6_lock); 104 spin_unlock(&v6_lock);
90} 105}
@@ -94,20 +109,13 @@ static void v6_copy_user_page_aliasing(void *kto, const void *kfrom, unsigned lo
94 * so remap the kernel page into the same cache colour as the user 109 * so remap the kernel page into the same cache colour as the user
95 * page. 110 * page.
96 */ 111 */
97static void v6_clear_user_page_aliasing(void *kaddr, unsigned long vaddr) 112static void v6_clear_user_highpage_aliasing(struct page *page, unsigned long vaddr)
98{ 113{
99 unsigned int offset = CACHE_COLOUR(vaddr); 114 unsigned int offset = CACHE_COLOUR(vaddr);
100 unsigned long to = to_address + (offset << PAGE_SHIFT); 115 unsigned long to = to_address + (offset << PAGE_SHIFT);
101 116
102 /* 117 /* FIXME: not highmem safe */
103 * Discard data in the kernel mapping for the new page 118 discard_old_kernel_data(page_address(page));
104 * FIXME: needs this MCRR to be supported.
105 */
106 __asm__("mcrr p15, 0, %1, %0, c6 @ 0xec401f06"
107 :
108 : "r" (kaddr),
109 "r" ((unsigned long)kaddr + PAGE_SIZE - L1_CACHE_BYTES)
110 : "cc");
111 119
112 /* 120 /*
113 * Now clear the page using the same cache colour as 121 * Now clear the page using the same cache colour as
@@ -115,7 +123,7 @@ static void v6_clear_user_page_aliasing(void *kaddr, unsigned long vaddr)
115 */ 123 */
116 spin_lock(&v6_lock); 124 spin_lock(&v6_lock);
117 125
118 set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(__pa(kaddr) >> PAGE_SHIFT, PAGE_KERNEL), 0); 126 set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(page), PAGE_KERNEL), 0);
119 flush_tlb_kernel_page(to); 127 flush_tlb_kernel_page(to);
120 clear_page((void *)to); 128 clear_page((void *)to);
121 129
@@ -123,15 +131,15 @@ static void v6_clear_user_page_aliasing(void *kaddr, unsigned long vaddr)
123} 131}
124 132
125struct cpu_user_fns v6_user_fns __initdata = { 133struct cpu_user_fns v6_user_fns __initdata = {
126 .cpu_clear_user_page = v6_clear_user_page_nonaliasing, 134 .cpu_clear_user_highpage = v6_clear_user_highpage_nonaliasing,
127 .cpu_copy_user_page = v6_copy_user_page_nonaliasing, 135 .cpu_copy_user_highpage = v6_copy_user_highpage_nonaliasing,
128}; 136};
129 137
130static int __init v6_userpage_init(void) 138static int __init v6_userpage_init(void)
131{ 139{
132 if (cache_is_vipt_aliasing()) { 140 if (cache_is_vipt_aliasing()) {
133 cpu_user.cpu_clear_user_page = v6_clear_user_page_aliasing; 141 cpu_user.cpu_clear_user_highpage = v6_clear_user_highpage_aliasing;
134 cpu_user.cpu_copy_user_page = v6_copy_user_page_aliasing; 142 cpu_user.cpu_copy_user_highpage = v6_copy_user_highpage_aliasing;
135 } 143 }
136 144
137 return 0; 145 return 0;
diff --git a/arch/arm/mm/copypage-xsc3.S b/arch/arm/mm/copypage-xsc3.S
deleted file mode 100644
index 9a2cb4332b4c..000000000000
--- a/arch/arm/mm/copypage-xsc3.S
+++ /dev/null
@@ -1,97 +0,0 @@
1/*
2 * linux/arch/arm/lib/copypage-xsc3.S
3 *
4 * Copyright (C) 2004 Intel Corp.
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 * Adapted for 3rd gen XScale core, no more mini-dcache
11 * Author: Matt Gilbert (matthew.m.gilbert@intel.com)
12 */
13
14#include <linux/linkage.h>
15#include <linux/init.h>
16#include <asm/asm-offsets.h>
17
18/*
19 * General note:
20 * We don't really want write-allocate cache behaviour for these functions
21 * since that will just eat through 8K of the cache.
22 */
23
24 .text
25 .align 5
26/*
27 * XSC3 optimised copy_user_page
28 * r0 = destination
29 * r1 = source
30 * r2 = virtual user address of ultimate destination page
31 *
32 * The source page may have some clean entries in the cache already, but we
33 * can safely ignore them - break_cow() will flush them out of the cache
34 * if we eventually end up using our copied page.
35 *
36 */
37ENTRY(xsc3_mc_copy_user_page)
38 stmfd sp!, {r4, r5, lr}
39 mov lr, #PAGE_SZ/64-1
40
41 pld [r1, #0]
42 pld [r1, #32]
431: pld [r1, #64]
44 pld [r1, #96]
45
462: ldrd r2, [r1], #8
47 mov ip, r0
48 ldrd r4, [r1], #8
49 mcr p15, 0, ip, c7, c6, 1 @ invalidate
50 strd r2, [r0], #8
51 ldrd r2, [r1], #8
52 strd r4, [r0], #8
53 ldrd r4, [r1], #8
54 strd r2, [r0], #8
55 strd r4, [r0], #8
56 ldrd r2, [r1], #8
57 mov ip, r0
58 ldrd r4, [r1], #8
59 mcr p15, 0, ip, c7, c6, 1 @ invalidate
60 strd r2, [r0], #8
61 ldrd r2, [r1], #8
62 subs lr, lr, #1
63 strd r4, [r0], #8
64 ldrd r4, [r1], #8
65 strd r2, [r0], #8
66 strd r4, [r0], #8
67 bgt 1b
68 beq 2b
69
70 ldmfd sp!, {r4, r5, pc}
71
72 .align 5
73/*
74 * XScale optimised clear_user_page
75 * r0 = destination
76 * r1 = virtual user address of ultimate destination page
77 */
78ENTRY(xsc3_mc_clear_user_page)
79 mov r1, #PAGE_SZ/32
80 mov r2, #0
81 mov r3, #0
821: mcr p15, 0, r0, c7, c6, 1 @ invalidate line
83 strd r2, [r0], #8
84 strd r2, [r0], #8
85 strd r2, [r0], #8
86 strd r2, [r0], #8
87 subs r1, r1, #1
88 bne 1b
89 mov pc, lr
90
91 __INITDATA
92
93 .type xsc3_mc_user_fns, #object
94ENTRY(xsc3_mc_user_fns)
95 .long xsc3_mc_clear_user_page
96 .long xsc3_mc_copy_user_page
97 .size xsc3_mc_user_fns, . - xsc3_mc_user_fns
diff --git a/arch/arm/mm/copypage-xsc3.c b/arch/arm/mm/copypage-xsc3.c
new file mode 100644
index 000000000000..39a994542cad
--- /dev/null
+++ b/arch/arm/mm/copypage-xsc3.c
@@ -0,0 +1,113 @@
1/*
2 * linux/arch/arm/mm/copypage-xsc3.S
3 *
4 * Copyright (C) 2004 Intel Corp.
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 * Adapted for 3rd gen XScale core, no more mini-dcache
11 * Author: Matt Gilbert (matthew.m.gilbert@intel.com)
12 */
13#include <linux/init.h>
14#include <linux/highmem.h>
15
16/*
17 * General note:
18 * We don't really want write-allocate cache behaviour for these functions
19 * since that will just eat through 8K of the cache.
20 */
21
22/*
23 * XSC3 optimised copy_user_highpage
24 * r0 = destination
25 * r1 = source
26 *
27 * The source page may have some clean entries in the cache already, but we
28 * can safely ignore them - break_cow() will flush them out of the cache
29 * if we eventually end up using our copied page.
30 *
31 */
32static void __attribute__((naked))
33xsc3_mc_copy_user_page(void *kto, const void *kfrom)
34{
35 asm("\
36 stmfd sp!, {r4, r5, lr} \n\
37 mov lr, %0 \n\
38 \n\
39 pld [r1, #0] \n\
40 pld [r1, #32] \n\
411: pld [r1, #64] \n\
42 pld [r1, #96] \n\
43 \n\
442: ldrd r2, [r1], #8 \n\
45 mov ip, r0 \n\
46 ldrd r4, [r1], #8 \n\
47 mcr p15, 0, ip, c7, c6, 1 @ invalidate\n\
48 strd r2, [r0], #8 \n\
49 ldrd r2, [r1], #8 \n\
50 strd r4, [r0], #8 \n\
51 ldrd r4, [r1], #8 \n\
52 strd r2, [r0], #8 \n\
53 strd r4, [r0], #8 \n\
54 ldrd r2, [r1], #8 \n\
55 mov ip, r0 \n\
56 ldrd r4, [r1], #8 \n\
57 mcr p15, 0, ip, c7, c6, 1 @ invalidate\n\
58 strd r2, [r0], #8 \n\
59 ldrd r2, [r1], #8 \n\
60 subs lr, lr, #1 \n\
61 strd r4, [r0], #8 \n\
62 ldrd r4, [r1], #8 \n\
63 strd r2, [r0], #8 \n\
64 strd r4, [r0], #8 \n\
65 bgt 1b \n\
66 beq 2b \n\
67 \n\
68 ldmfd sp!, {r4, r5, pc}"
69 :
70 : "I" (PAGE_SIZE / 64 - 1));
71}
72
73void xsc3_mc_copy_user_highpage(struct page *to, struct page *from,
74 unsigned long vaddr)
75{
76 void *kto, *kfrom;
77
78 kto = kmap_atomic(to, KM_USER0);
79 kfrom = kmap_atomic(from, KM_USER1);
80 xsc3_mc_copy_user_page(kto, kfrom);
81 kunmap_atomic(kfrom, KM_USER1);
82 kunmap_atomic(kto, KM_USER0);
83}
84
85/*
86 * XScale optimised clear_user_page
87 * r0 = destination
88 * r1 = virtual user address of ultimate destination page
89 */
90void xsc3_mc_clear_user_highpage(struct page *page, unsigned long vaddr)
91{
92 void *ptr, *kaddr = kmap_atomic(page, KM_USER0);
93 asm volatile ("\
94 mov r1, %2 \n\
95 mov r2, #0 \n\
96 mov r3, #0 \n\
971: mcr p15, 0, %0, c7, c6, 1 @ invalidate line\n\
98 strd r2, [%0], #8 \n\
99 strd r2, [%0], #8 \n\
100 strd r2, [%0], #8 \n\
101 strd r2, [%0], #8 \n\
102 subs r1, r1, #1 \n\
103 bne 1b"
104 : "=r" (ptr)
105 : "0" (kaddr), "I" (PAGE_SIZE / 32)
106 : "r1", "r2", "r3");
107 kunmap_atomic(kaddr, KM_USER0);
108}
109
110struct cpu_user_fns xsc3_mc_user_fns __initdata = {
111 .cpu_clear_user_highpage = xsc3_mc_clear_user_highpage,
112 .cpu_copy_user_highpage = xsc3_mc_copy_user_highpage,
113};
diff --git a/arch/arm/mm/copypage-xscale.c b/arch/arm/mm/copypage-xscale.c
index bad49331bbf9..d18f2397ee2d 100644
--- a/arch/arm/mm/copypage-xscale.c
+++ b/arch/arm/mm/copypage-xscale.c
@@ -15,8 +15,8 @@
15 */ 15 */
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/highmem.h>
18 19
19#include <asm/page.h>
20#include <asm/pgtable.h> 20#include <asm/pgtable.h>
21#include <asm/tlbflush.h> 21#include <asm/tlbflush.h>
22#include <asm/cacheflush.h> 22#include <asm/cacheflush.h>
@@ -35,7 +35,7 @@
35static DEFINE_SPINLOCK(minicache_lock); 35static DEFINE_SPINLOCK(minicache_lock);
36 36
37/* 37/*
38 * XScale mini-dcache optimised copy_user_page 38 * XScale mini-dcache optimised copy_user_highpage
39 * 39 *
40 * We flush the destination cache lines just before we write the data into the 40 * We flush the destination cache lines just before we write the data into the
41 * corresponding address. Since the Dcache is read-allocate, this removes the 41 * corresponding address. Since the Dcache is read-allocate, this removes the
@@ -90,48 +90,53 @@ mc_copy_user_page(void *from, void *to)
90 : "r" (from), "r" (to), "I" (PAGE_SIZE / 64 - 1)); 90 : "r" (from), "r" (to), "I" (PAGE_SIZE / 64 - 1));
91} 91}
92 92
93void xscale_mc_copy_user_page(void *kto, const void *kfrom, unsigned long vaddr) 93void xscale_mc_copy_user_highpage(struct page *to, struct page *from,
94 unsigned long vaddr)
94{ 95{
95 struct page *page = virt_to_page(kfrom); 96 void *kto = kmap_atomic(to, KM_USER1);
96 97
97 if (test_and_clear_bit(PG_dcache_dirty, &page->flags)) 98 if (test_and_clear_bit(PG_dcache_dirty, &from->flags))
98 __flush_dcache_page(page_mapping(page), page); 99 __flush_dcache_page(page_mapping(from), from);
99 100
100 spin_lock(&minicache_lock); 101 spin_lock(&minicache_lock);
101 102
102 set_pte_ext(TOP_PTE(COPYPAGE_MINICACHE), pfn_pte(__pa(kfrom) >> PAGE_SHIFT, minicache_pgprot), 0); 103 set_pte_ext(TOP_PTE(COPYPAGE_MINICACHE), pfn_pte(page_to_pfn(from), minicache_pgprot), 0);
103 flush_tlb_kernel_page(COPYPAGE_MINICACHE); 104 flush_tlb_kernel_page(COPYPAGE_MINICACHE);
104 105
105 mc_copy_user_page((void *)COPYPAGE_MINICACHE, kto); 106 mc_copy_user_page((void *)COPYPAGE_MINICACHE, kto);
106 107
107 spin_unlock(&minicache_lock); 108 spin_unlock(&minicache_lock);
109
110 kunmap_atomic(kto, KM_USER1);
108} 111}
109 112
110/* 113/*
111 * XScale optimised clear_user_page 114 * XScale optimised clear_user_page
112 */ 115 */
113void __attribute__((naked)) 116void
114xscale_mc_clear_user_page(void *kaddr, unsigned long vaddr) 117xscale_mc_clear_user_highpage(struct page *page, unsigned long vaddr)
115{ 118{
119 void *ptr, *kaddr = kmap_atomic(page, KM_USER0);
116 asm volatile( 120 asm volatile(
117 "mov r1, %0 \n\ 121 "mov r1, %2 \n\
118 mov r2, #0 \n\ 122 mov r2, #0 \n\
119 mov r3, #0 \n\ 123 mov r3, #0 \n\
1201: mov ip, r0 \n\ 1241: mov ip, %0 \n\
121 strd r2, [r0], #8 \n\ 125 strd r2, [%0], #8 \n\
122 strd r2, [r0], #8 \n\ 126 strd r2, [%0], #8 \n\
123 strd r2, [r0], #8 \n\ 127 strd r2, [%0], #8 \n\
124 strd r2, [r0], #8 \n\ 128 strd r2, [%0], #8 \n\
125 mcr p15, 0, ip, c7, c10, 1 @ clean D line\n\ 129 mcr p15, 0, ip, c7, c10, 1 @ clean D line\n\
126 subs r1, r1, #1 \n\ 130 subs r1, r1, #1 \n\
127 mcr p15, 0, ip, c7, c6, 1 @ invalidate D line\n\ 131 mcr p15, 0, ip, c7, c6, 1 @ invalidate D line\n\
128 bne 1b \n\ 132 bne 1b"
129 mov pc, lr" 133 : "=r" (ptr)
130 : 134 : "0" (kaddr), "I" (PAGE_SIZE / 32)
131 : "I" (PAGE_SIZE / 32)); 135 : "r1", "r2", "r3", "ip");
136 kunmap_atomic(kaddr, KM_USER0);
132} 137}
133 138
134struct cpu_user_fns xscale_mc_user_fns __initdata = { 139struct cpu_user_fns xscale_mc_user_fns __initdata = {
135 .cpu_clear_user_page = xscale_mc_clear_user_page, 140 .cpu_clear_user_highpage = xscale_mc_clear_user_highpage,
136 .cpu_copy_user_page = xscale_mc_copy_user_page, 141 .cpu_copy_user_highpage = xscale_mc_copy_user_highpage,
137}; 142};
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index 22c9530e91e2..0455557a2899 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -15,6 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/kprobes.h> 16#include <linux/kprobes.h>
17#include <linux/uaccess.h> 17#include <linux/uaccess.h>
18#include <linux/page-flags.h>
18 19
19#include <asm/system.h> 20#include <asm/system.h>
20#include <asm/pgtable.h> 21#include <asm/pgtable.h>
@@ -84,13 +85,14 @@ void show_pte(struct mm_struct *mm, unsigned long addr)
84 break; 85 break;
85 } 86 }
86 87
87#ifndef CONFIG_HIGHMEM
88 /* We must not map this if we have highmem enabled */ 88 /* We must not map this if we have highmem enabled */
89 if (PageHighMem(pfn_to_page(pmd_val(*pmd) >> PAGE_SHIFT)))
90 break;
91
89 pte = pte_offset_map(pmd, addr); 92 pte = pte_offset_map(pmd, addr);
90 printk(", *pte=%08lx", pte_val(*pte)); 93 printk(", *pte=%08lx", pte_val(*pte));
91 printk(", *ppte=%08lx", pte_val(pte[-PTRS_PER_PTE])); 94 printk(", *ppte=%08lx", pte_val(pte[-PTRS_PER_PTE]));
92 pte_unmap(pte); 95 pte_unmap(pte);
93#endif
94 } while(0); 96 } while(0);
95 97
96 printk("\n"); 98 printk("\n");
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 82c4b4217989..34df4d9d03a6 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -17,6 +17,7 @@
17#include <linux/initrd.h> 17#include <linux/initrd.h>
18 18
19#include <asm/mach-types.h> 19#include <asm/mach-types.h>
20#include <asm/sections.h>
20#include <asm/setup.h> 21#include <asm/setup.h>
21#include <asm/sizes.h> 22#include <asm/sizes.h>
22#include <asm/tlb.h> 23#include <asm/tlb.h>
@@ -64,10 +65,11 @@ static int __init parse_tag_initrd2(const struct tag *tag)
64__tagtable(ATAG_INITRD2, parse_tag_initrd2); 65__tagtable(ATAG_INITRD2, parse_tag_initrd2);
65 66
66/* 67/*
67 * This is used to pass memory configuration data from paging_init 68 * This keeps memory configuration data used by a couple memory
68 * to mem_init, and by show_mem() to skip holes in the memory map. 69 * initialization functions, as well as show_mem() for the skipping
70 * of holes in the memory map. It is populated by arm_add_memory().
69 */ 71 */
70static struct meminfo meminfo = { 0, }; 72struct meminfo meminfo;
71 73
72void show_mem(void) 74void show_mem(void)
73{ 75{
@@ -128,7 +130,7 @@ find_bootmap_pfn(int node, struct meminfo *mi, unsigned int bootmap_pages)
128{ 130{
129 unsigned int start_pfn, i, bootmap_pfn; 131 unsigned int start_pfn, i, bootmap_pfn;
130 132
131 start_pfn = PAGE_ALIGN(__pa(&_end)) >> PAGE_SHIFT; 133 start_pfn = PAGE_ALIGN(__pa(_end)) >> PAGE_SHIFT;
132 bootmap_pfn = 0; 134 bootmap_pfn = 0;
133 135
134 for_each_nodebank(i, mi, node) { 136 for_each_nodebank(i, mi, node) {
@@ -331,13 +333,12 @@ static void __init bootmem_free_node(int node, struct meminfo *mi)
331 free_area_init_node(node, zone_size, start_pfn, zhole_size); 333 free_area_init_node(node, zone_size, start_pfn, zhole_size);
332} 334}
333 335
334void __init bootmem_init(struct meminfo *mi) 336void __init bootmem_init(void)
335{ 337{
338 struct meminfo *mi = &meminfo;
336 unsigned long memend_pfn = 0; 339 unsigned long memend_pfn = 0;
337 int node, initrd_node; 340 int node, initrd_node;
338 341
339 memcpy(&meminfo, mi, sizeof(meminfo));
340
341 /* 342 /*
342 * Locate which node contains the ramdisk image, if any. 343 * Locate which node contains the ramdisk image, if any.
343 */ 344 */
@@ -394,20 +395,22 @@ void __init bootmem_init(struct meminfo *mi)
394 max_pfn = max_low_pfn = memend_pfn - PHYS_PFN_OFFSET; 395 max_pfn = max_low_pfn = memend_pfn - PHYS_PFN_OFFSET;
395} 396}
396 397
397static inline void free_area(unsigned long addr, unsigned long end, char *s) 398static inline int free_area(unsigned long pfn, unsigned long end, char *s)
398{ 399{
399 unsigned int size = (end - addr) >> 10; 400 unsigned int pages = 0, size = (end - pfn) << (PAGE_SHIFT - 10);
400 401
401 for (; addr < end; addr += PAGE_SIZE) { 402 for (; pfn < end; pfn++) {
402 struct page *page = virt_to_page(addr); 403 struct page *page = pfn_to_page(pfn);
403 ClearPageReserved(page); 404 ClearPageReserved(page);
404 init_page_count(page); 405 init_page_count(page);
405 free_page(addr); 406 __free_page(page);
406 totalram_pages++; 407 pages++;
407 } 408 }
408 409
409 if (size && s) 410 if (size && s)
410 printk(KERN_INFO "Freeing %s memory: %dK\n", s, size); 411 printk(KERN_INFO "Freeing %s memory: %dK\n", s, size);
412
413 return pages;
411} 414}
412 415
413static inline void 416static inline void
@@ -478,13 +481,9 @@ static void __init free_unused_memmap_node(int node, struct meminfo *mi)
478 */ 481 */
479void __init mem_init(void) 482void __init mem_init(void)
480{ 483{
481 unsigned int codepages, datapages, initpages; 484 unsigned int codesize, datasize, initsize;
482 int i, node; 485 int i, node;
483 486
484 codepages = &_etext - &_text;
485 datapages = &_end - &__data_start;
486 initpages = &__init_end - &__init_begin;
487
488#ifndef CONFIG_DISCONTIGMEM 487#ifndef CONFIG_DISCONTIGMEM
489 max_mapnr = virt_to_page(high_memory) - mem_map; 488 max_mapnr = virt_to_page(high_memory) - mem_map;
490#endif 489#endif
@@ -501,7 +500,8 @@ void __init mem_init(void)
501 500
502#ifdef CONFIG_SA1111 501#ifdef CONFIG_SA1111
503 /* now that our DMA memory is actually so designated, we can free it */ 502 /* now that our DMA memory is actually so designated, we can free it */
504 free_area(PAGE_OFFSET, (unsigned long)swapper_pg_dir, NULL); 503 totalram_pages += free_area(PHYS_PFN_OFFSET,
504 __phys_to_pfn(__pa(swapper_pg_dir)), NULL);
505#endif 505#endif
506 506
507 /* 507 /*
@@ -509,18 +509,21 @@ void __init mem_init(void)
509 * real number of pages we have in this system 509 * real number of pages we have in this system
510 */ 510 */
511 printk(KERN_INFO "Memory:"); 511 printk(KERN_INFO "Memory:");
512
513 num_physpages = 0; 512 num_physpages = 0;
514 for (i = 0; i < meminfo.nr_banks; i++) { 513 for (i = 0; i < meminfo.nr_banks; i++) {
515 num_physpages += bank_pfn_size(&meminfo.bank[i]); 514 num_physpages += bank_pfn_size(&meminfo.bank[i]);
516 printk(" %ldMB", bank_phys_size(&meminfo.bank[i]) >> 20); 515 printk(" %ldMB", bank_phys_size(&meminfo.bank[i]) >> 20);
517 } 516 }
518
519 printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT)); 517 printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT));
518
519 codesize = _etext - _text;
520 datasize = _end - _data;
521 initsize = __init_end - __init_begin;
522
520 printk(KERN_NOTICE "Memory: %luKB available (%dK code, " 523 printk(KERN_NOTICE "Memory: %luKB available (%dK code, "
521 "%dK data, %dK init)\n", 524 "%dK data, %dK init)\n",
522 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 525 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
523 codepages >> 10, datapages >> 10, initpages >> 10); 526 codesize >> 10, datasize >> 10, initsize >> 10);
524 527
525 if (PAGE_SIZE >= 16384 && num_physpages <= 128) { 528 if (PAGE_SIZE >= 16384 && num_physpages <= 128) {
526 extern int sysctl_overcommit_memory; 529 extern int sysctl_overcommit_memory;
@@ -535,11 +538,10 @@ void __init mem_init(void)
535 538
536void free_initmem(void) 539void free_initmem(void)
537{ 540{
538 if (!machine_is_integrator() && !machine_is_cintegrator()) { 541 if (!machine_is_integrator() && !machine_is_cintegrator())
539 free_area((unsigned long)(&__init_begin), 542 totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)),
540 (unsigned long)(&__init_end), 543 __phys_to_pfn(__pa(__init_end)),
541 "init"); 544 "init");
542 }
543} 545}
544 546
545#ifdef CONFIG_BLK_DEV_INITRD 547#ifdef CONFIG_BLK_DEV_INITRD
@@ -549,7 +551,9 @@ static int keep_initrd;
549void free_initrd_mem(unsigned long start, unsigned long end) 551void free_initrd_mem(unsigned long start, unsigned long end)
550{ 552{
551 if (!keep_initrd) 553 if (!keep_initrd)
552 free_area(start, end, "initrd"); 554 totalram_pages += free_area(__phys_to_pfn(__pa(start)),
555 __phys_to_pfn(__pa(end)),
556 "initrd");
553} 557}
554 558
555static int __init keepinitrd_setup(char *__unused) 559static int __init keepinitrd_setup(char *__unused)
diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h
index 5d9f53907b4e..95bbe112965e 100644
--- a/arch/arm/mm/mm.h
+++ b/arch/arm/mm/mm.h
@@ -32,7 +32,5 @@ struct meminfo;
32struct pglist_data; 32struct pglist_data;
33 33
34void __init create_mapping(struct map_desc *md); 34void __init create_mapping(struct map_desc *md);
35void __init bootmem_init(struct meminfo *mi); 35void __init bootmem_init(void);
36void reserve_node_zero(struct pglist_data *pgdat); 36void reserve_node_zero(struct pglist_data *pgdat);
37
38extern void _text, _stext, _etext, __data_start, _end, __init_begin, __init_end;
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 7f36c825718d..9b36c5cb5e9f 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -17,6 +17,7 @@
17 17
18#include <asm/cputype.h> 18#include <asm/cputype.h>
19#include <asm/mach-types.h> 19#include <asm/mach-types.h>
20#include <asm/sections.h>
20#include <asm/setup.h> 21#include <asm/setup.h>
21#include <asm/sizes.h> 22#include <asm/sizes.h>
22#include <asm/tlb.h> 23#include <asm/tlb.h>
@@ -646,61 +647,79 @@ static void __init early_vmalloc(char **arg)
646 "vmalloc area too small, limiting to %luMB\n", 647 "vmalloc area too small, limiting to %luMB\n",
647 vmalloc_reserve >> 20); 648 vmalloc_reserve >> 20);
648 } 649 }
650
651 if (vmalloc_reserve > VMALLOC_END - (PAGE_OFFSET + SZ_32M)) {
652 vmalloc_reserve = VMALLOC_END - (PAGE_OFFSET + SZ_32M);
653 printk(KERN_WARNING
654 "vmalloc area is too big, limiting to %luMB\n",
655 vmalloc_reserve >> 20);
656 }
649} 657}
650__early_param("vmalloc=", early_vmalloc); 658__early_param("vmalloc=", early_vmalloc);
651 659
652#define VMALLOC_MIN (void *)(VMALLOC_END - vmalloc_reserve) 660#define VMALLOC_MIN (void *)(VMALLOC_END - vmalloc_reserve)
653 661
654static int __init check_membank_valid(struct membank *mb) 662static void __init sanity_check_meminfo(void)
655{ 663{
656 /* 664 int i, j;
657 * Check whether this memory region has non-zero size or
658 * invalid node number.
659 */
660 if (mb->size == 0 || mb->node >= MAX_NUMNODES)
661 return 0;
662
663 /*
664 * Check whether this memory region would entirely overlap
665 * the vmalloc area.
666 */
667 if (phys_to_virt(mb->start) >= VMALLOC_MIN) {
668 printk(KERN_NOTICE "Ignoring RAM at %.8lx-%.8lx "
669 "(vmalloc region overlap).\n",
670 mb->start, mb->start + mb->size - 1);
671 return 0;
672 }
673
674 /*
675 * Check whether this memory region would partially overlap
676 * the vmalloc area.
677 */
678 if (phys_to_virt(mb->start + mb->size) < phys_to_virt(mb->start) ||
679 phys_to_virt(mb->start + mb->size) > VMALLOC_MIN) {
680 unsigned long newsize = VMALLOC_MIN - phys_to_virt(mb->start);
681
682 printk(KERN_NOTICE "Truncating RAM at %.8lx-%.8lx "
683 "to -%.8lx (vmalloc region overlap).\n",
684 mb->start, mb->start + mb->size - 1,
685 mb->start + newsize - 1);
686 mb->size = newsize;
687 }
688 665
689 return 1; 666 for (i = 0, j = 0; i < meminfo.nr_banks; i++) {
690} 667 struct membank *bank = &meminfo.bank[j];
668 *bank = meminfo.bank[i];
691 669
692static void __init sanity_check_meminfo(struct meminfo *mi) 670#ifdef CONFIG_HIGHMEM
693{ 671 /*
694 int i, j; 672 * Split those memory banks which are partially overlapping
673 * the vmalloc area greatly simplifying things later.
674 */
675 if (__va(bank->start) < VMALLOC_MIN &&
676 bank->size > VMALLOC_MIN - __va(bank->start)) {
677 if (meminfo.nr_banks >= NR_BANKS) {
678 printk(KERN_CRIT "NR_BANKS too low, "
679 "ignoring high memory\n");
680 } else {
681 memmove(bank + 1, bank,
682 (meminfo.nr_banks - i) * sizeof(*bank));
683 meminfo.nr_banks++;
684 i++;
685 bank[1].size -= VMALLOC_MIN - __va(bank->start);
686 bank[1].start = __pa(VMALLOC_MIN - 1) + 1;
687 j++;
688 }
689 bank->size = VMALLOC_MIN - __va(bank->start);
690 }
691#else
692 /*
693 * Check whether this memory bank would entirely overlap
694 * the vmalloc area.
695 */
696 if (__va(bank->start) >= VMALLOC_MIN) {
697 printk(KERN_NOTICE "Ignoring RAM at %.8lx-%.8lx "
698 "(vmalloc region overlap).\n",
699 bank->start, bank->start + bank->size - 1);
700 continue;
701 }
695 702
696 for (i = 0, j = 0; i < mi->nr_banks; i++) { 703 /*
697 if (check_membank_valid(&mi->bank[i])) 704 * Check whether this memory bank would partially overlap
698 mi->bank[j++] = mi->bank[i]; 705 * the vmalloc area.
706 */
707 if (__va(bank->start + bank->size) > VMALLOC_MIN ||
708 __va(bank->start + bank->size) < __va(bank->start)) {
709 unsigned long newsize = VMALLOC_MIN - __va(bank->start);
710 printk(KERN_NOTICE "Truncating RAM at %.8lx-%.8lx "
711 "to -%.8lx (vmalloc region overlap).\n",
712 bank->start, bank->start + bank->size - 1,
713 bank->start + newsize - 1);
714 bank->size = newsize;
715 }
716#endif
717 j++;
699 } 718 }
700 mi->nr_banks = j; 719 meminfo.nr_banks = j;
701} 720}
702 721
703static inline void prepare_page_table(struct meminfo *mi) 722static inline void prepare_page_table(void)
704{ 723{
705 unsigned long addr; 724 unsigned long addr;
706 725
@@ -712,7 +731,7 @@ static inline void prepare_page_table(struct meminfo *mi)
712 731
713#ifdef CONFIG_XIP_KERNEL 732#ifdef CONFIG_XIP_KERNEL
714 /* The XIP kernel is mapped in the module area -- skip over it */ 733 /* The XIP kernel is mapped in the module area -- skip over it */
715 addr = ((unsigned long)&_etext + PGDIR_SIZE - 1) & PGDIR_MASK; 734 addr = ((unsigned long)_etext + PGDIR_SIZE - 1) & PGDIR_MASK;
716#endif 735#endif
717 for ( ; addr < PAGE_OFFSET; addr += PGDIR_SIZE) 736 for ( ; addr < PAGE_OFFSET; addr += PGDIR_SIZE)
718 pmd_clear(pmd_off_k(addr)); 737 pmd_clear(pmd_off_k(addr));
@@ -721,7 +740,7 @@ static inline void prepare_page_table(struct meminfo *mi)
721 * Clear out all the kernel space mappings, except for the first 740 * Clear out all the kernel space mappings, except for the first
722 * memory bank, up to the end of the vmalloc region. 741 * memory bank, up to the end of the vmalloc region.
723 */ 742 */
724 for (addr = __phys_to_virt(mi->bank[0].start + mi->bank[0].size); 743 for (addr = __phys_to_virt(bank_phys_end(&meminfo.bank[0]));
725 addr < VMALLOC_END; addr += PGDIR_SIZE) 744 addr < VMALLOC_END; addr += PGDIR_SIZE)
726 pmd_clear(pmd_off_k(addr)); 745 pmd_clear(pmd_off_k(addr));
727} 746}
@@ -738,10 +757,10 @@ void __init reserve_node_zero(pg_data_t *pgdat)
738 * Note that this can only be in node 0. 757 * Note that this can only be in node 0.
739 */ 758 */
740#ifdef CONFIG_XIP_KERNEL 759#ifdef CONFIG_XIP_KERNEL
741 reserve_bootmem_node(pgdat, __pa(&__data_start), &_end - &__data_start, 760 reserve_bootmem_node(pgdat, __pa(_data), _end - _data,
742 BOOTMEM_DEFAULT); 761 BOOTMEM_DEFAULT);
743#else 762#else
744 reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext, 763 reserve_bootmem_node(pgdat, __pa(_stext), _end - _stext,
745 BOOTMEM_DEFAULT); 764 BOOTMEM_DEFAULT);
746#endif 765#endif
747 766
@@ -808,7 +827,6 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
808 * Allocate the vector page early. 827 * Allocate the vector page early.
809 */ 828 */
810 vectors = alloc_bootmem_low_pages(PAGE_SIZE); 829 vectors = alloc_bootmem_low_pages(PAGE_SIZE);
811 BUG_ON(!vectors);
812 830
813 for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE) 831 for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE)
814 pmd_clear(pmd_off_k(addr)); 832 pmd_clear(pmd_off_k(addr));
@@ -820,7 +838,7 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
820#ifdef CONFIG_XIP_KERNEL 838#ifdef CONFIG_XIP_KERNEL
821 map.pfn = __phys_to_pfn(CONFIG_XIP_PHYS_ADDR & SECTION_MASK); 839 map.pfn = __phys_to_pfn(CONFIG_XIP_PHYS_ADDR & SECTION_MASK);
822 map.virtual = MODULES_VADDR; 840 map.virtual = MODULES_VADDR;
823 map.length = ((unsigned long)&_etext - map.virtual + ~SECTION_MASK) & SECTION_MASK; 841 map.length = ((unsigned long)_etext - map.virtual + ~SECTION_MASK) & SECTION_MASK;
824 map.type = MT_ROM; 842 map.type = MT_ROM;
825 create_mapping(&map); 843 create_mapping(&map);
826#endif 844#endif
@@ -880,23 +898,23 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
880 * paging_init() sets up the page tables, initialises the zone memory 898 * paging_init() sets up the page tables, initialises the zone memory
881 * maps, and sets up the zero page, bad page and bad page tables. 899 * maps, and sets up the zero page, bad page and bad page tables.
882 */ 900 */
883void __init paging_init(struct meminfo *mi, struct machine_desc *mdesc) 901void __init paging_init(struct machine_desc *mdesc)
884{ 902{
885 void *zero_page; 903 void *zero_page;
886 904
887 build_mem_type_table(); 905 build_mem_type_table();
888 sanity_check_meminfo(mi); 906 sanity_check_meminfo();
889 prepare_page_table(mi); 907 prepare_page_table();
890 bootmem_init(mi); 908 bootmem_init();
891 devicemaps_init(mdesc); 909 devicemaps_init(mdesc);
892 910
893 top_pmd = pmd_off_k(0xffff0000); 911 top_pmd = pmd_off_k(0xffff0000);
894 912
895 /* 913 /*
896 * allocate the zero page. Note that we count on this going ok. 914 * allocate the zero page. Note that this always succeeds and
915 * returns a zeroed result.
897 */ 916 */
898 zero_page = alloc_bootmem_low_pages(PAGE_SIZE); 917 zero_page = alloc_bootmem_low_pages(PAGE_SIZE);
899 memzero(zero_page, PAGE_SIZE);
900 empty_zero_page = virt_to_page(zero_page); 918 empty_zero_page = virt_to_page(zero_page);
901 flush_dcache_page(empty_zero_page); 919 flush_dcache_page(empty_zero_page);
902} 920}
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 07b62b238979..ad7bacc693b2 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -10,6 +10,7 @@
10#include <linux/io.h> 10#include <linux/io.h>
11 11
12#include <asm/cacheflush.h> 12#include <asm/cacheflush.h>
13#include <asm/sections.h>
13#include <asm/page.h> 14#include <asm/page.h>
14#include <asm/mach/arch.h> 15#include <asm/mach/arch.h>
15 16
@@ -25,10 +26,10 @@ void __init reserve_node_zero(pg_data_t *pgdat)
25 * Note that this can only be in node 0. 26 * Note that this can only be in node 0.
26 */ 27 */
27#ifdef CONFIG_XIP_KERNEL 28#ifdef CONFIG_XIP_KERNEL
28 reserve_bootmem_node(pgdat, __pa(&__data_start), &_end - &__data_start, 29 reserve_bootmem_node(pgdat, __pa(_data), _end - _data,
29 BOOTMEM_DEFAULT); 30 BOOTMEM_DEFAULT);
30#else 31#else
31 reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext, 32 reserve_bootmem_node(pgdat, __pa(_stext), _end - _stext,
32 BOOTMEM_DEFAULT); 33 BOOTMEM_DEFAULT);
33#endif 34#endif
34 35
@@ -41,27 +42,13 @@ void __init reserve_node_zero(pg_data_t *pgdat)
41 BOOTMEM_DEFAULT); 42 BOOTMEM_DEFAULT);
42} 43}
43 44
44static void __init sanity_check_meminfo(struct meminfo *mi)
45{
46 int i, j;
47
48 for (i = 0, j = 0; i < mi->nr_banks; i++) {
49 struct membank *mb = &mi->bank[i];
50
51 if (mb->size != 0 && mb->node < MAX_NUMNODES)
52 mi->bank[j++] = mi->bank[i];
53 }
54 mi->nr_banks = j;
55}
56
57/* 45/*
58 * paging_init() sets up the page tables, initialises the zone memory 46 * paging_init() sets up the page tables, initialises the zone memory
59 * maps, and sets up the zero page, bad page and bad page tables. 47 * maps, and sets up the zero page, bad page and bad page tables.
60 */ 48 */
61void __init paging_init(struct meminfo *mi, struct machine_desc *mdesc) 49void __init paging_init(struct machine_desc *mdesc)
62{ 50{
63 sanity_check_meminfo(mi); 51 bootmem_init();
64 bootmem_init(mi);
65} 52}
66 53
67/* 54/*
diff --git a/arch/arm/mm/pgd.c b/arch/arm/mm/pgd.c
index e0f19ab91163..2690146161ba 100644
--- a/arch/arm/mm/pgd.c
+++ b/arch/arm/mm/pgd.c
@@ -31,7 +31,7 @@ pgd_t *get_pgd_slow(struct mm_struct *mm)
31 if (!new_pgd) 31 if (!new_pgd)
32 goto no_pgd; 32 goto no_pgd;
33 33
34 memzero(new_pgd, FIRST_KERNEL_PGD_NR * sizeof(pgd_t)); 34 memset(new_pgd, 0, FIRST_KERNEL_PGD_NR * sizeof(pgd_t));
35 35
36 /* 36 /*
37 * Copy over the kernel and IO PGD entries 37 * Copy over the kernel and IO PGD entries
diff --git a/arch/arm/mm/proc-syms.c b/arch/arm/mm/proc-syms.c
index 2b5ba396e3a6..4ad3bf291ad3 100644
--- a/arch/arm/mm/proc-syms.c
+++ b/arch/arm/mm/proc-syms.c
@@ -33,8 +33,8 @@ EXPORT_SYMBOL(cpu_cache);
33 33
34#ifdef CONFIG_MMU 34#ifdef CONFIG_MMU
35#ifndef MULTI_USER 35#ifndef MULTI_USER
36EXPORT_SYMBOL(__cpu_clear_user_page); 36EXPORT_SYMBOL(__cpu_clear_user_highpage);
37EXPORT_SYMBOL(__cpu_copy_user_page); 37EXPORT_SYMBOL(__cpu_copy_user_highpage);
38#else 38#else
39EXPORT_SYMBOL(cpu_user); 39EXPORT_SYMBOL(cpu_user);
40#endif 40#endif
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 294943b85973..f0cc599facb7 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -71,6 +71,8 @@ ENTRY(cpu_v6_reset)
71 * IRQs are already disabled. 71 * IRQs are already disabled.
72 */ 72 */
73ENTRY(cpu_v6_do_idle) 73ENTRY(cpu_v6_do_idle)
74 mov r1, #0
75 mcr p15, 0, r1, c7, c10, 4 @ DWB - WFI may enter a low-power mode
74 mcr p15, 0, r1, c7, c0, 4 @ wait for interrupt 76 mcr p15, 0, r1, c7, c0, 4 @ wait for interrupt
75 mov pc, lr 77 mov pc, lr
76 78
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 4d3c0a73e7fb..d1ebec42521d 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -20,9 +20,17 @@
20 20
21#define TTB_C (1 << 0) 21#define TTB_C (1 << 0)
22#define TTB_S (1 << 1) 22#define TTB_S (1 << 1)
23#define TTB_RGN_NC (0 << 3)
24#define TTB_RGN_OC_WBWA (1 << 3)
23#define TTB_RGN_OC_WT (2 << 3) 25#define TTB_RGN_OC_WT (2 << 3)
24#define TTB_RGN_OC_WB (3 << 3) 26#define TTB_RGN_OC_WB (3 << 3)
25 27
28#ifndef CONFIG_SMP
29#define TTB_FLAGS TTB_C|TTB_RGN_OC_WB @ mark PTWs cacheable, outer WB
30#else
31#define TTB_FLAGS TTB_C|TTB_S|TTB_RGN_OC_WBWA @ mark PTWs cacheable and shared, outer WBWA
32#endif
33
26ENTRY(cpu_v7_proc_init) 34ENTRY(cpu_v7_proc_init)
27 mov pc, lr 35 mov pc, lr
28ENDPROC(cpu_v7_proc_init) 36ENDPROC(cpu_v7_proc_init)
@@ -55,6 +63,7 @@ ENDPROC(cpu_v7_reset)
55 * IRQs are already disabled. 63 * IRQs are already disabled.
56 */ 64 */
57ENTRY(cpu_v7_do_idle) 65ENTRY(cpu_v7_do_idle)
66 dsb @ WFI may enter a low-power mode
58 wfi 67 wfi
59 mov pc, lr 68 mov pc, lr
60ENDPROC(cpu_v7_do_idle) 69ENDPROC(cpu_v7_do_idle)
@@ -85,7 +94,7 @@ ENTRY(cpu_v7_switch_mm)
85#ifdef CONFIG_MMU 94#ifdef CONFIG_MMU
86 mov r2, #0 95 mov r2, #0
87 ldr r1, [r1, #MM_CONTEXT_ID] @ get mm->context.id 96 ldr r1, [r1, #MM_CONTEXT_ID] @ get mm->context.id
88 orr r0, r0, #TTB_RGN_OC_WB @ mark PTWs outer cacheable, WB 97 orr r0, r0, #TTB_FLAGS
89 mcr p15, 0, r2, c13, c0, 1 @ set reserved context ID 98 mcr p15, 0, r2, c13, c0, 1 @ set reserved context ID
90 isb 99 isb
911: mcr p15, 0, r0, c2, c0, 0 @ set TTB 0 1001: mcr p15, 0, r0, c2, c0, 0 @ set TTB 0
@@ -162,6 +171,11 @@ cpu_v7_name:
162 * - cache type register is implemented 171 * - cache type register is implemented
163 */ 172 */
164__v7_setup: 173__v7_setup:
174#ifdef CONFIG_SMP
175 mrc p15, 0, r0, c1, c0, 1 @ Enable SMP/nAMP mode
176 orr r0, r0, #(0x1 << 6)
177 mcr p15, 0, r0, c1, c0, 1
178#endif
165 adr r12, __v7_setup_stack @ the local stack 179 adr r12, __v7_setup_stack @ the local stack
166 stmia r12, {r0-r5, r7, r9, r11, lr} 180 stmia r12, {r0-r5, r7, r9, r11, lr}
167 bl v7_flush_dcache_all 181 bl v7_flush_dcache_all
@@ -174,8 +188,7 @@ __v7_setup:
174#ifdef CONFIG_MMU 188#ifdef CONFIG_MMU
175 mcr p15, 0, r10, c8, c7, 0 @ invalidate I + D TLBs 189 mcr p15, 0, r10, c8, c7, 0 @ invalidate I + D TLBs
176 mcr p15, 0, r10, c2, c0, 2 @ TTB control register 190 mcr p15, 0, r10, c2, c0, 2 @ TTB control register
177 orr r4, r4, #TTB_RGN_OC_WB @ mark PTWs outer cacheable, WB 191 orr r4, r4, #TTB_FLAGS
178 mcr p15, 0, r4, c2, c0, 0 @ load TTB0
179 mcr p15, 0, r4, c2, c0, 1 @ load TTB1 192 mcr p15, 0, r4, c2, c0, 1 @ load TTB1
180 mov r10, #0x1f @ domains 0, 1 = manager 193 mov r10, #0x1f @ domains 0, 1 = manager
181 mcr p15, 0, r10, c3, c0, 0 @ load domain access register 194 mcr p15, 0, r10, c3, c0, 0 @ load domain access register
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S
index 8f6cf56c11c0..33515c214b92 100644
--- a/arch/arm/mm/proc-xsc3.S
+++ b/arch/arm/mm/proc-xsc3.S
@@ -481,3 +481,28 @@ __xsc3_proc_info:
481 .long xsc3_mc_user_fns 481 .long xsc3_mc_user_fns
482 .long xsc3_cache_fns 482 .long xsc3_cache_fns
483 .size __xsc3_proc_info, . - __xsc3_proc_info 483 .size __xsc3_proc_info, . - __xsc3_proc_info
484
485/* Note: PXA935 changed its implementor ID from Intel to Marvell */
486
487 .type __xsc3_pxa935_proc_info,#object
488__xsc3_pxa935_proc_info:
489 .long 0x56056000
490 .long 0xffffe000
491 .long PMD_TYPE_SECT | \
492 PMD_SECT_BUFFERABLE | \
493 PMD_SECT_CACHEABLE | \
494 PMD_SECT_AP_WRITE | \
495 PMD_SECT_AP_READ
496 .long PMD_TYPE_SECT | \
497 PMD_SECT_AP_WRITE | \
498 PMD_SECT_AP_READ
499 b __xsc3_setup
500 .long cpu_arch_name
501 .long cpu_elf_name
502 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
503 .long cpu_xsc3_name
504 .long xsc3_processor_functions
505 .long v4wbi_tlb_fns
506 .long xsc3_mc_user_fns
507 .long xsc3_cache_fns
508 .size __xsc3_pxa935_proc_info, . - __xsc3_pxa935_proc_info
diff --git a/arch/arm/oprofile/op_model_mpcore.c b/arch/arm/oprofile/op_model_mpcore.c
index 4de366e8b4c5..6d6bd5899240 100644
--- a/arch/arm/oprofile/op_model_mpcore.c
+++ b/arch/arm/oprofile/op_model_mpcore.c
@@ -260,10 +260,10 @@ static void em_stop(void)
260static void em_route_irq(int irq, unsigned int cpu) 260static void em_route_irq(int irq, unsigned int cpu)
261{ 261{
262 struct irq_desc *desc = irq_desc + irq; 262 struct irq_desc *desc = irq_desc + irq;
263 cpumask_t mask = cpumask_of_cpu(cpu); 263 const struct cpumask *mask = cpumask_of(cpu);
264 264
265 spin_lock_irq(&desc->lock); 265 spin_lock_irq(&desc->lock);
266 desc->affinity = mask; 266 desc->affinity = *mask;
267 desc->chip->set_affinity(irq, mask); 267 desc->chip->set_affinity(irq, mask);
268 spin_unlock_irq(&desc->lock); 268 spin_unlock_irq(&desc->lock);
269} 269}
diff --git a/arch/arm/plat-mxc/Kconfig b/arch/arm/plat-mxc/Kconfig
index b2a7e3fad117..9cc2b16fdf79 100644
--- a/arch/arm/plat-mxc/Kconfig
+++ b/arch/arm/plat-mxc/Kconfig
@@ -6,18 +6,27 @@ choice
6 prompt "MXC/iMX Base Type" 6 prompt "MXC/iMX Base Type"
7 default ARCH_MX3 7 default ARCH_MX3
8 8
9config ARCH_MX1
10 bool "MX1-based"
11 select CPU_ARM920T
12 help
13 This enables support for systems based on the Freescale i.MX1 family
14
9config ARCH_MX2 15config ARCH_MX2
10 bool "MX2-based" 16 bool "MX2-based"
17 select CPU_ARM926T
11 help 18 help
12 This enables support for systems based on the Freescale i.MX2 family 19 This enables support for systems based on the Freescale i.MX2 family
13 20
14config ARCH_MX3 21config ARCH_MX3
15 bool "MX3-based" 22 bool "MX3-based"
23 select CPU_V6
16 help 24 help
17 This enables support for systems based on the Freescale i.MX3 family 25 This enables support for systems based on the Freescale i.MX3 family
18 26
19endchoice 27endchoice
20 28
29source "arch/arm/mach-mx1/Kconfig"
21source "arch/arm/mach-mx2/Kconfig" 30source "arch/arm/mach-mx2/Kconfig"
22source "arch/arm/mach-mx3/Kconfig" 31source "arch/arm/mach-mx3/Kconfig"
23 32
diff --git a/arch/arm/plat-mxc/Makefile b/arch/arm/plat-mxc/Makefile
index 067556f7c91f..db74a929179d 100644
--- a/arch/arm/plat-mxc/Makefile
+++ b/arch/arm/plat-mxc/Makefile
@@ -5,4 +5,5 @@
5# Common support 5# Common support
6obj-y := irq.o clock.o gpio.o time.o devices.o 6obj-y := irq.o clock.o gpio.o time.o devices.o
7 7
8obj-$(CONFIG_ARCH_MX1) += iomux-mx1-mx2.o dma-mx1-mx2.o
8obj-$(CONFIG_ARCH_MX2) += iomux-mx1-mx2.o dma-mx1-mx2.o 9obj-$(CONFIG_ARCH_MX2) += iomux-mx1-mx2.o dma-mx1-mx2.o
diff --git a/arch/arm/plat-mxc/dma-mx1-mx2.c b/arch/arm/plat-mxc/dma-mx1-mx2.c
index b296f19fd89a..2905ec758758 100644
--- a/arch/arm/plat-mxc/dma-mx1-mx2.c
+++ b/arch/arm/plat-mxc/dma-mx1-mx2.c
@@ -34,7 +34,6 @@
34#include <asm/system.h> 34#include <asm/system.h>
35#include <asm/irq.h> 35#include <asm/irq.h>
36#include <mach/hardware.h> 36#include <mach/hardware.h>
37#include <asm/dma.h>
38#include <mach/dma-mx1-mx2.h> 37#include <mach/dma-mx1-mx2.h>
39 38
40#define DMA_DCR 0x00 /* Control Register */ 39#define DMA_DCR 0x00 /* Control Register */
@@ -114,7 +113,7 @@ struct imx_dma_channel {
114 void (*err_handler) (int, void *, int errcode); 113 void (*err_handler) (int, void *, int errcode);
115 void (*prog_handler) (int, void *, struct scatterlist *); 114 void (*prog_handler) (int, void *, struct scatterlist *);
116 void *data; 115 void *data;
117 dmamode_t dma_mode; 116 unsigned int dma_mode;
118 struct scatterlist *sg; 117 struct scatterlist *sg;
119 unsigned int resbytes; 118 unsigned int resbytes;
120 int dma_num; 119 int dma_num;
@@ -193,7 +192,7 @@ static inline int imx_dma_sg_next(int channel, struct scatterlist *sg)
193int 192int
194imx_dma_setup_single(int channel, dma_addr_t dma_address, 193imx_dma_setup_single(int channel, dma_addr_t dma_address,
195 unsigned int dma_length, unsigned int dev_addr, 194 unsigned int dma_length, unsigned int dev_addr,
196 dmamode_t dmamode) 195 unsigned int dmamode)
197{ 196{
198 struct imx_dma_channel *imxdma = &imx_dma_channels[channel]; 197 struct imx_dma_channel *imxdma = &imx_dma_channels[channel];
199 198
@@ -288,7 +287,7 @@ int
288imx_dma_setup_sg(int channel, 287imx_dma_setup_sg(int channel,
289 struct scatterlist *sg, unsigned int sgcount, 288 struct scatterlist *sg, unsigned int sgcount,
290 unsigned int dma_length, unsigned int dev_addr, 289 unsigned int dma_length, unsigned int dev_addr,
291 dmamode_t dmamode) 290 unsigned int dmamode)
292{ 291{
293 struct imx_dma_channel *imxdma = &imx_dma_channels[channel]; 292 struct imx_dma_channel *imxdma = &imx_dma_channels[channel];
294 293
@@ -512,6 +511,7 @@ void imx_dma_disable(int channel)
512} 511}
513EXPORT_SYMBOL(imx_dma_disable); 512EXPORT_SYMBOL(imx_dma_disable);
514 513
514#ifdef CONFIG_ARCH_MX2
515static void imx_dma_watchdog(unsigned long chno) 515static void imx_dma_watchdog(unsigned long chno)
516{ 516{
517 struct imx_dma_channel *imxdma = &imx_dma_channels[chno]; 517 struct imx_dma_channel *imxdma = &imx_dma_channels[chno];
@@ -523,6 +523,7 @@ static void imx_dma_watchdog(unsigned long chno)
523 if (imxdma->err_handler) 523 if (imxdma->err_handler)
524 imxdma->err_handler(chno, imxdma->data, IMX_DMA_ERR_TIMEOUT); 524 imxdma->err_handler(chno, imxdma->data, IMX_DMA_ERR_TIMEOUT);
525} 525}
526#endif
526 527
527static irqreturn_t dma_err_handler(int irq, void *dev_id) 528static irqreturn_t dma_err_handler(int irq, void *dev_id)
528{ 529{
@@ -675,7 +676,7 @@ int imx_dma_request(int channel, const char *name)
675{ 676{
676 struct imx_dma_channel *imxdma = &imx_dma_channels[channel]; 677 struct imx_dma_channel *imxdma = &imx_dma_channels[channel];
677 unsigned long flags; 678 unsigned long flags;
678 int ret; 679 int ret = 0;
679 680
680 /* basic sanity checks */ 681 /* basic sanity checks */
681 if (!name) 682 if (!name)
@@ -697,6 +698,7 @@ int imx_dma_request(int channel, const char *name)
697 ret = request_irq(MXC_INT_DMACH0 + channel, dma_irq_handler, 0, "DMA", 698 ret = request_irq(MXC_INT_DMACH0 + channel, dma_irq_handler, 0, "DMA",
698 NULL); 699 NULL);
699 if (ret) { 700 if (ret) {
701 local_irq_restore(flags);
700 printk(KERN_CRIT "Can't register IRQ %d for DMA channel %d\n", 702 printk(KERN_CRIT "Can't register IRQ %d for DMA channel %d\n",
701 MXC_INT_DMACH0 + channel, channel); 703 MXC_INT_DMACH0 + channel, channel);
702 return ret; 704 return ret;
@@ -713,7 +715,7 @@ int imx_dma_request(int channel, const char *name)
713 imxdma->sg = NULL; 715 imxdma->sg = NULL;
714 716
715 local_irq_restore(flags); 717 local_irq_restore(flags);
716 return 0; 718 return ret;
717} 719}
718EXPORT_SYMBOL(imx_dma_request); 720EXPORT_SYMBOL(imx_dma_request);
719 721
diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
index de5c4747453f..ccbd94adc668 100644
--- a/arch/arm/plat-mxc/gpio.c
+++ b/arch/arm/plat-mxc/gpio.c
@@ -115,8 +115,8 @@ static void mxc_gpio_irq_handler(struct mxc_gpio_port *port, u32 irq_stat)
115 } 115 }
116} 116}
117 117
118#ifdef CONFIG_ARCH_MX3 118#if defined(CONFIG_ARCH_MX3) || defined(CONFIG_ARCH_MX1)
119/* MX3 has one interrupt *per* gpio port */ 119/* MX1 and MX3 has one interrupt *per* gpio port */
120static void mx3_gpio_irq_handler(u32 irq, struct irq_desc *desc) 120static void mx3_gpio_irq_handler(u32 irq, struct irq_desc *desc)
121{ 121{
122 u32 irq_stat; 122 u32 irq_stat;
@@ -237,7 +237,7 @@ int __init mxc_gpio_init(struct mxc_gpio_port *port, int cnt)
237 /* its a serious configuration bug when it fails */ 237 /* its a serious configuration bug when it fails */
238 BUG_ON( gpiochip_add(&port[i].chip) < 0 ); 238 BUG_ON( gpiochip_add(&port[i].chip) < 0 );
239 239
240#ifdef CONFIG_ARCH_MX3 240#if defined(CONFIG_ARCH_MX3) || defined(CONFIG_ARCH_MX1)
241 /* setup one handler for each entry */ 241 /* setup one handler for each entry */
242 set_irq_chained_handler(port[i].irq, mx3_gpio_irq_handler); 242 set_irq_chained_handler(port[i].irq, mx3_gpio_irq_handler);
243 set_irq_data(port[i].irq, &port[i]); 243 set_irq_data(port[i].irq, &port[i]);
diff --git a/arch/arm/plat-mxc/include/mach/board-mx27ads.h b/arch/arm/plat-mxc/include/mach/board-mx27ads.h
index 61e66dac90ef..8f34a05afc87 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx27ads.h
+++ b/arch/arm/plat-mxc/include/mach/board-mx27ads.h
@@ -15,7 +15,7 @@
15#define __ASM_ARCH_MXC_BOARD_MX27ADS_H__ 15#define __ASM_ARCH_MXC_BOARD_MX27ADS_H__
16 16
17/* external interrupt multiplexer */ 17/* external interrupt multiplexer */
18#define MXC_EXP_IO_BASE (MXC_GPIO_BASE + MXC_MAX_GPIO_LINES) 18#define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START)
19 19
20#define MXC_VIRTUAL_INTS_BASE (MXC_EXP_IO_BASE + MXC_MAX_EXP_IO_LINES) 20#define MXC_VIRTUAL_INTS_BASE (MXC_EXP_IO_BASE + MXC_MAX_EXP_IO_LINES)
21#define MXC_SDIO1_CARD_IRQ MXC_VIRTUAL_INTS_BASE 21#define MXC_SDIO1_CARD_IRQ MXC_VIRTUAL_INTS_BASE
@@ -28,11 +28,6 @@
28/* 28/*
29 * MXC UART EVB board level configurations 29 * MXC UART EVB board level configurations
30 */ 30 */
31
32#define MXC_LL_EXTUART_PADDR (CS4_BASE_ADDR + 0x20000)
33#define MXC_LL_EXTUART_VADDR (CS4_BASE_ADDR_VIRT + 0x20000)
34#define MXC_LL_EXTUART_16BIT_BUS
35
36#define MXC_LL_UART_PADDR UART1_BASE_ADDR 31#define MXC_LL_UART_PADDR UART1_BASE_ADDR
37#define MXC_LL_UART_VADDR AIPI_IO_ADDRESS(UART1_BASE_ADDR) 32#define MXC_LL_UART_VADDR AIPI_IO_ADDRESS(UART1_BASE_ADDR)
38 33
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31ads.h b/arch/arm/plat-mxc/include/mach/board-mx31ads.h
index 745b48864f93..451d510d08c3 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx31ads.h
+++ b/arch/arm/plat-mxc/include/mach/board-mx31ads.h
@@ -90,7 +90,7 @@
90#define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS) 90#define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS)
91#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_4) 91#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_4)
92 92
93#define MXC_EXP_IO_BASE (MXC_MAX_INT_LINES + MXC_MAX_GPIO_LINES) 93#define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START)
94#define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE) 94#define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE)
95 95
96#define EXPIO_INT_LOW_BAT (MXC_EXP_IO_BASE + 0) 96#define EXPIO_INT_LOW_BAT (MXC_EXP_IO_BASE + 0)
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31pdk.h b/arch/arm/plat-mxc/include/mach/board-mx31pdk.h
new file mode 100644
index 000000000000..2b6b316d0f51
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/board-mx31pdk.h
@@ -0,0 +1,19 @@
1/*
2 * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_ARCH_MXC_BOARD_MX31PDK_H__
12#define __ASM_ARCH_MXC_BOARD_MX31PDK_H__
13
14/* mandatory for CONFIG_LL_DEBUG */
15
16#define MXC_LL_UART_PADDR UART1_BASE_ADDR
17#define MXC_LL_UART_VADDR AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
18
19#endif /* __ASM_ARCH_MXC_BOARD_MX31PDK_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/debug-macro.S b/arch/arm/plat-mxc/include/mach/debug-macro.S
index b9907bebba3b..602768b427e2 100644
--- a/arch/arm/plat-mxc/include/mach/debug-macro.S
+++ b/arch/arm/plat-mxc/include/mach/debug-macro.S
@@ -28,6 +28,9 @@
28#ifdef CONFIG_MACH_PCM038 28#ifdef CONFIG_MACH_PCM038
29#include <mach/board-pcm038.h> 29#include <mach/board-pcm038.h>
30#endif 30#endif
31#ifdef CONFIG_MACH_MX31_3DS
32#include <mach/board-mx31pdk.h>
33#endif
31 .macro addruart,rx 34 .macro addruart,rx
32 mrc p15, 0, \rx, c1, c0 35 mrc p15, 0, \rx, c1, c0
33 tst \rx, #1 @ MMU enabled? 36 tst \rx, #1 @ MMU enabled?
diff --git a/arch/arm/plat-mxc/include/mach/dma-mx1-mx2.h b/arch/arm/plat-mxc/include/mach/dma-mx1-mx2.h
index e85fd946116c..b3876cc238ca 100644
--- a/arch/arm/plat-mxc/include/mach/dma-mx1-mx2.h
+++ b/arch/arm/plat-mxc/include/mach/dma-mx1-mx2.h
@@ -22,13 +22,15 @@
22 * MA 02110-1301, USA. 22 * MA 02110-1301, USA.
23 */ 23 */
24 24
25#include <asm/dma.h>
26
27#ifndef __ASM_ARCH_MXC_DMA_H 25#ifndef __ASM_ARCH_MXC_DMA_H
28#define __ASM_ARCH_MXC_DMA_H 26#define __ASM_ARCH_MXC_DMA_H
29 27
30#define IMX_DMA_CHANNELS 16 28#define IMX_DMA_CHANNELS 16
31 29
30#define DMA_MODE_READ 0
31#define DMA_MODE_WRITE 1
32#define DMA_MODE_MASK 1
33
32#define DMA_BASE IO_ADDRESS(DMA_BASE_ADDR) 34#define DMA_BASE IO_ADDRESS(DMA_BASE_ADDR)
33 35
34#define IMX_DMA_MEMSIZE_32 (0 << 4) 36#define IMX_DMA_MEMSIZE_32 (0 << 4)
@@ -54,12 +56,12 @@ imx_dma_config_burstlen(int channel, unsigned int burstlen);
54int 56int
55imx_dma_setup_single(int channel, dma_addr_t dma_address, 57imx_dma_setup_single(int channel, dma_addr_t dma_address,
56 unsigned int dma_length, unsigned int dev_addr, 58 unsigned int dma_length, unsigned int dev_addr,
57 dmamode_t dmamode); 59 unsigned int dmamode);
58 60
59int 61int
60imx_dma_setup_sg(int channel, struct scatterlist *sg, 62imx_dma_setup_sg(int channel, struct scatterlist *sg,
61 unsigned int sgcount, unsigned int dma_length, 63 unsigned int sgcount, unsigned int dma_length,
62 unsigned int dev_addr, dmamode_t dmamode); 64 unsigned int dev_addr, unsigned int dmamode);
63 65
64int 66int
65imx_dma_setup_handlers(int channel, 67imx_dma_setup_handlers(int channel,
diff --git a/arch/arm/plat-mxc/include/mach/dma.h b/arch/arm/plat-mxc/include/mach/dma.h
deleted file mode 100644
index c822d569a05e..000000000000
--- a/arch/arm/plat-mxc/include/mach/dma.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_ARCH_MXC_DMA_H__
12#define __ASM_ARCH_MXC_DMA_H__
13
14#endif
diff --git a/arch/arm/plat-mxc/include/mach/entry-macro.S b/arch/arm/plat-mxc/include/mach/entry-macro.S
index 11632028f7d1..5f01d60da845 100644
--- a/arch/arm/plat-mxc/include/mach/entry-macro.S
+++ b/arch/arm/plat-mxc/include/mach/entry-macro.S
@@ -9,6 +9,8 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12#include <mach/hardware.h>
13
12#define AVIC_NIMASK 0x04 14#define AVIC_NIMASK 0x04
13 15
14 @ this macro disables fast irq (not implemented) 16 @ this macro disables fast irq (not implemented)
diff --git a/arch/arm/plat-mxc/include/mach/gpio.h b/arch/arm/plat-mxc/include/mach/gpio.h
index 65eedc0d196f..ea509f1090fb 100644
--- a/arch/arm/plat-mxc/include/mach/gpio.h
+++ b/arch/arm/plat-mxc/include/mach/gpio.h
@@ -27,8 +27,8 @@
27#define gpio_set_value __gpio_set_value 27#define gpio_set_value __gpio_set_value
28#define gpio_cansleep __gpio_cansleep 28#define gpio_cansleep __gpio_cansleep
29 29
30#define gpio_to_irq(gpio) (MXC_MAX_INT_LINES + (gpio)) 30#define gpio_to_irq(gpio) (MXC_GPIO_IRQ_START + (gpio))
31#define irq_to_gpio(irq) ((irq) - MXC_MAX_INT_LINES) 31#define irq_to_gpio(irq) ((irq) - MXC_GPIO_IRQ_START)
32 32
33struct mxc_gpio_port { 33struct mxc_gpio_port {
34 void __iomem *base; 34 void __iomem *base;
diff --git a/arch/arm/plat-mxc/include/mach/hardware.h b/arch/arm/plat-mxc/include/mach/hardware.h
index 3caadeeda701..a612d8bb73c8 100644
--- a/arch/arm/plat-mxc/include/mach/hardware.h
+++ b/arch/arm/plat-mxc/include/mach/hardware.h
@@ -32,6 +32,10 @@
32# endif 32# endif
33#endif 33#endif
34 34
35#ifdef CONFIG_ARCH_MX1
36# include <mach/mx1.h>
37#endif
38
35#include <mach/mxc.h> 39#include <mach/mxc.h>
36 40
37#endif /* __ASM_ARCH_MXC_HARDWARE_H__ */ 41#endif /* __ASM_ARCH_MXC_HARDWARE_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/io.h b/arch/arm/plat-mxc/include/mach/io.h
index 5d4cb1196441..b4f2de769466 100644
--- a/arch/arm/plat-mxc/include/mach/io.h
+++ b/arch/arm/plat-mxc/include/mach/io.h
@@ -25,8 +25,8 @@ __mx3_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
25 /* Access all peripherals below 0x80000000 as nonshared device 25 /* Access all peripherals below 0x80000000 as nonshared device
26 * but leave l2cc alone. 26 * but leave l2cc alone.
27 */ 27 */
28 if ((phys_addr < 0x80000000) && ((phys_addr < L2CC_BASE_ADDR) || 28 if ((phys_addr < 0x80000000) && ((phys_addr < 0x30000000) ||
29 (phys_addr >= L2CC_BASE_ADDR + L2CC_SIZE))) 29 (phys_addr >= 0x30000000 + SZ_1M)))
30 mtype = MT_DEVICE_NONSHARED; 30 mtype = MT_DEVICE_NONSHARED;
31 } 31 }
32 32
@@ -35,8 +35,8 @@ __mx3_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
35#endif 35#endif
36 36
37/* io address mapping macro */ 37/* io address mapping macro */
38#define __io(a) ((void __iomem *)(a)) 38#define __io(a) __typesafe_io(a)
39 39
40#define __mem_pci(a) (a) 40#define __mem_pci(a) (a)
41 41
42#endif 42#endif
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx1-mx2.h b/arch/arm/plat-mxc/include/mach/iomux-mx1-mx2.h
index 3d09bfd6c53d..95a383be628e 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx1-mx2.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx1-mx2.h
@@ -21,12 +21,6 @@
21 21
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#define MXC_GPIO_ALLOC_MODE_NORMAL 0
25#define MXC_GPIO_ALLOC_MODE_NO_ALLOC 1
26#define MXC_GPIO_ALLOC_MODE_TRY_ALLOC 2
27#define MXC_GPIO_ALLOC_MODE_ALLOC_ONLY 4
28#define MXC_GPIO_ALLOC_MODE_RELEASE 8
29
30/* 24/*
31 * GPIO Module and I/O Multiplexer 25 * GPIO Module and I/O Multiplexer
32 * x = 0..3 for reg_A, reg_B, reg_C, reg_D 26 * x = 0..3 for reg_A, reg_B, reg_C, reg_D
@@ -103,7 +97,8 @@
103 97
104extern void mxc_gpio_mode(int gpio_mode); 98extern void mxc_gpio_mode(int gpio_mode);
105extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count, 99extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
106 int alloc_mode, const char *label); 100 const char *label);
101extern void mxc_gpio_release_multiple_pins(const int *pin_list, int count);
107 102
108/*-------------------------------------------------------------------------*/ 103/*-------------------------------------------------------------------------*/
109 104
@@ -113,9 +108,9 @@ extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
113 * missing on some (many) pins 108 * missing on some (many) pins
114 */ 109 */
115#ifdef CONFIG_ARCH_MX1 110#ifdef CONFIG_ARCH_MX1
116#define PA0_AIN_SPI2_CLK (GPIO_GIUS | GPIO_PORTA | GPIO_OUT | 0) 111#define PA0_AIN_SPI2_CLK (GPIO_PORTA | GPIO_OUT | 0)
117#define PA0_AF_ETMTRACESYNC (GPIO_PORTA | GPIO_AF | 0) 112#define PA0_AF_ETMTRACESYNC (GPIO_PORTA | GPIO_AF | 0)
118#define PA1_AOUT_SPI2_RXD (GPIO_GIUS | GPIO_PORTA | GPIO_IN | 1) 113#define PA1_AOUT_SPI2_RXD (GPIO_PORTA | GPIO_IN | 1)
119#define PA1_PF_TIN (GPIO_PORTA | GPIO_PF | 1) 114#define PA1_PF_TIN (GPIO_PORTA | GPIO_PF | 1)
120#define PA2_PF_PWM0 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 2) 115#define PA2_PF_PWM0 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 2)
121#define PA3_PF_CSI_MCLK (GPIO_PORTA | GPIO_PF | 3) 116#define PA3_PF_CSI_MCLK (GPIO_PORTA | GPIO_PF | 3)
@@ -133,7 +128,7 @@ extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
133#define PA15_PF_I2C_SDA (GPIO_PORTA | GPIO_OUT | GPIO_PF | 15) 128#define PA15_PF_I2C_SDA (GPIO_PORTA | GPIO_OUT | GPIO_PF | 15)
134#define PA16_PF_I2C_SCL (GPIO_PORTA | GPIO_OUT | GPIO_PF | 16) 129#define PA16_PF_I2C_SCL (GPIO_PORTA | GPIO_OUT | GPIO_PF | 16)
135#define PA17_AF_ETMTRACEPKT4 (GPIO_PORTA | GPIO_AF | 17) 130#define PA17_AF_ETMTRACEPKT4 (GPIO_PORTA | GPIO_AF | 17)
136#define PA17_AIN_SPI2_SS (GPIO_GIUS | GPIO_PORTA | GPIO_OUT | 17) 131#define PA17_AIN_SPI2_SS (GPIO_PORTA | GPIO_OUT | 17)
137#define PA18_AF_ETMTRACEPKT5 (GPIO_PORTA | GPIO_AF | 18) 132#define PA18_AF_ETMTRACEPKT5 (GPIO_PORTA | GPIO_AF | 18)
138#define PA19_AF_ETMTRACEPKT6 (GPIO_PORTA | GPIO_AF | 19) 133#define PA19_AF_ETMTRACEPKT6 (GPIO_PORTA | GPIO_AF | 19)
139#define PA20_AF_ETMTRACEPKT7 (GPIO_PORTA | GPIO_AF | 20) 134#define PA20_AF_ETMTRACEPKT7 (GPIO_PORTA | GPIO_AF | 20)
@@ -201,27 +196,27 @@ extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
201#define PC15_PF_SPI1_SS (GPIO_PORTC | GPIO_PF | 15) 196#define PC15_PF_SPI1_SS (GPIO_PORTC | GPIO_PF | 15)
202#define PC16_PF_SPI1_MISO (GPIO_PORTC | GPIO_PF | 16) 197#define PC16_PF_SPI1_MISO (GPIO_PORTC | GPIO_PF | 16)
203#define PC17_PF_SPI1_MOSI (GPIO_PORTC | GPIO_PF | 17) 198#define PC17_PF_SPI1_MOSI (GPIO_PORTC | GPIO_PF | 17)
204#define PC24_BIN_UART3_RI (GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 24) 199#define PC24_BIN_UART3_RI (GPIO_PORTC | GPIO_OUT | GPIO_BIN | 24)
205#define PC25_BIN_UART3_DSR (GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 25) 200#define PC25_BIN_UART3_DSR (GPIO_PORTC | GPIO_OUT | GPIO_BIN | 25)
206#define PC26_AOUT_UART3_DTR (GPIO_GIUS | GPIO_PORTC | GPIO_IN | 26) 201#define PC26_AOUT_UART3_DTR (GPIO_PORTC | GPIO_IN | 26)
207#define PC27_BIN_UART3_DCD (GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 27) 202#define PC27_BIN_UART3_DCD (GPIO_PORTC | GPIO_OUT | GPIO_BIN | 27)
208#define PC28_BIN_UART3_CTS (GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 28) 203#define PC28_BIN_UART3_CTS (GPIO_PORTC | GPIO_OUT | GPIO_BIN | 28)
209#define PC29_AOUT_UART3_RTS (GPIO_GIUS | GPIO_PORTC | GPIO_IN | 29) 204#define PC29_AOUT_UART3_RTS (GPIO_PORTC | GPIO_IN | 29)
210#define PC30_BIN_UART3_TX (GPIO_GIUS | GPIO_PORTC | GPIO_BIN | 30) 205#define PC30_BIN_UART3_TX (GPIO_PORTC | GPIO_BIN | 30)
211#define PC31_AOUT_UART3_RX (GPIO_GIUS | GPIO_PORTC | GPIO_IN | 31) 206#define PC31_AOUT_UART3_RX (GPIO_PORTC | GPIO_IN | 31)
212#define PD6_PF_LSCLK (GPIO_PORTD | GPIO_OUT | GPIO_PF | 6) 207#define PD6_PF_LSCLK (GPIO_PORTD | GPIO_OUT | GPIO_PF | 6)
213#define PD7_PF_REV (GPIO_PORTD | GPIO_PF | 7) 208#define PD7_PF_REV (GPIO_PORTD | GPIO_PF | 7)
214#define PD7_AF_UART2_DTR (GPIO_GIUS | GPIO_PORTD | GPIO_IN | GPIO_AF | 7) 209#define PD7_AF_UART2_DTR (GPIO_PORTD | GPIO_IN | GPIO_AF | 7)
215#define PD7_AIN_SPI2_SCLK (GPIO_GIUS | GPIO_PORTD | GPIO_AIN | 7) 210#define PD7_AIN_SPI2_SCLK (GPIO_PORTD | GPIO_AIN | 7)
216#define PD8_PF_CLS (GPIO_PORTD | GPIO_PF | 8) 211#define PD8_PF_CLS (GPIO_PORTD | GPIO_PF | 8)
217#define PD8_AF_UART2_DCD (GPIO_PORTD | GPIO_OUT | GPIO_AF | 8) 212#define PD8_AF_UART2_DCD (GPIO_PORTD | GPIO_OUT | GPIO_AF | 8)
218#define PD8_AIN_SPI2_SS (GPIO_GIUS | GPIO_PORTD | GPIO_AIN | 8) 213#define PD8_AIN_SPI2_SS (GPIO_PORTD | GPIO_AIN | 8)
219#define PD9_PF_PS (GPIO_PORTD | GPIO_PF | 9) 214#define PD9_PF_PS (GPIO_PORTD | GPIO_PF | 9)
220#define PD9_AF_UART2_RI (GPIO_PORTD | GPIO_OUT | GPIO_AF | 9) 215#define PD9_AF_UART2_RI (GPIO_PORTD | GPIO_OUT | GPIO_AF | 9)
221#define PD9_AOUT_SPI2_RXD (GPIO_GIUS | GPIO_PORTD | GPIO_IN | 9) 216#define PD9_AOUT_SPI2_RXD (GPIO_PORTD | GPIO_IN | 9)
222#define PD10_PF_SPL_SPR (GPIO_PORTD | GPIO_OUT | GPIO_PF | 10) 217#define PD10_PF_SPL_SPR (GPIO_PORTD | GPIO_OUT | GPIO_PF | 10)
223#define PD10_AF_UART2_DSR (GPIO_PORTD | GPIO_OUT | GPIO_AF | 10) 218#define PD10_AF_UART2_DSR (GPIO_PORTD | GPIO_OUT | GPIO_AF | 10)
224#define PD10_AIN_SPI2_TXD (GPIO_GIUS | GPIO_PORTD | GPIO_OUT | 10) 219#define PD10_AIN_SPI2_TXD (GPIO_PORTD | GPIO_OUT | 10)
225#define PD11_PF_CONTRAST (GPIO_PORTD | GPIO_OUT | GPIO_PF | 11) 220#define PD11_PF_CONTRAST (GPIO_PORTD | GPIO_OUT | GPIO_PF | 11)
226#define PD12_PF_ACD_OE (GPIO_PORTD | GPIO_OUT | GPIO_PF | 12) 221#define PD12_PF_ACD_OE (GPIO_PORTD | GPIO_OUT | GPIO_PF | 12)
227#define PD13_PF_LP_HSYNC (GPIO_PORTD | GPIO_OUT | GPIO_PF | 13) 222#define PD13_PF_LP_HSYNC (GPIO_PORTD | GPIO_OUT | GPIO_PF | 13)
@@ -243,7 +238,7 @@ extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
243#define PD29_PF_LD14 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 29) 238#define PD29_PF_LD14 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 29)
244#define PD30_PF_LD15 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 30) 239#define PD30_PF_LD15 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 30)
245#define PD31_PF_TMR2OUT (GPIO_PORTD | GPIO_PF | 31) 240#define PD31_PF_TMR2OUT (GPIO_PORTD | GPIO_PF | 31)
246#define PD31_BIN_SPI2_TXD (GPIO_GIUS | GPIO_PORTD | GPIO_BIN | 31) 241#define PD31_BIN_SPI2_TXD (GPIO_PORTD | GPIO_BIN | 31)
247#endif 242#endif
248 243
249#ifdef CONFIG_ARCH_MX2 244#ifdef CONFIG_ARCH_MX2
@@ -279,6 +274,12 @@ extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
279#define PA29_PF_VSYNC (GPIO_PORTA | GPIO_OUT | GPIO_PF | 29) 274#define PA29_PF_VSYNC (GPIO_PORTA | GPIO_OUT | GPIO_PF | 29)
280#define PA30_PF_CONTRAST (GPIO_PORTA | GPIO_OUT | GPIO_PF | 30) 275#define PA30_PF_CONTRAST (GPIO_PORTA | GPIO_OUT | GPIO_PF | 30)
281#define PA31_PF_OE_ACD (GPIO_PORTA | GPIO_OUT | GPIO_PF | 31) 276#define PA31_PF_OE_ACD (GPIO_PORTA | GPIO_OUT | GPIO_PF | 31)
277#define PB4_PF_SD2_D0 (GPIO_PORTB | GPIO_PF | 4)
278#define PB5_PF_SD2_D1 (GPIO_PORTB | GPIO_PF | 5)
279#define PB6_PF_SD2_D2 (GPIO_PORTB | GPIO_PF | 6)
280#define PB7_PF_SD2_D3 (GPIO_PORTB | GPIO_PF | 7)
281#define PB8_PF_SD2_CMD (GPIO_PORTB | GPIO_PF | 8)
282#define PB9_PF_SD2_CLK (GPIO_PORTB | GPIO_PF | 9)
282#define PB10_PF_CSI_D0 (GPIO_PORTB | GPIO_OUT | GPIO_PF | 10) 283#define PB10_PF_CSI_D0 (GPIO_PORTB | GPIO_OUT | GPIO_PF | 10)
283#define PB10_AF_UART6_TXD (GPIO_PORTB | GPIO_OUT | GPIO_AF | 10) 284#define PB10_AF_UART6_TXD (GPIO_PORTB | GPIO_OUT | GPIO_AF | 10)
284#define PB11_PF_CSI_D1 (GPIO_PORTB | GPIO_OUT | GPIO_PF | 11) 285#define PB11_PF_CSI_D1 (GPIO_PORTB | GPIO_OUT | GPIO_PF | 11)
@@ -315,6 +316,13 @@ extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
315#define PB31_AF_UART4_RXD (GPIO_PORTB | GPIO_IN | GPIO_AF | 31) 316#define PB31_AF_UART4_RXD (GPIO_PORTB | GPIO_IN | GPIO_AF | 31)
316#define PC5_PF_I2C2_SDA (GPIO_PORTC | GPIO_IN | GPIO_PF | 5) 317#define PC5_PF_I2C2_SDA (GPIO_PORTC | GPIO_IN | GPIO_PF | 5)
317#define PC6_PF_I2C2_SCL (GPIO_PORTC | GPIO_IN | GPIO_PF | 6) 318#define PC6_PF_I2C2_SCL (GPIO_PORTC | GPIO_IN | GPIO_PF | 6)
319#define PC7_PF_USBOTG_DATA5 (GPIO_PORTC | GPIO_OUT | GPIO_PF | 7)
320#define PC8_PF_USBOTG_DATA6 (GPIO_PORTC | GPIO_OUT | GPIO_PF | 8)
321#define PC9_PF_USBOTG_DATA0 (GPIO_PORTC | GPIO_OUT | GPIO_PF | 9)
322#define PC10_PF_USBOTG_DATA2 (GPIO_PORTC | GPIO_OUT | GPIO_PF | 10)
323#define PC11_PF_USBOTG_DATA1 (GPIO_PORTC | GPIO_OUT | GPIO_PF | 11)
324#define PC12_PF_USBOTG_DATA4 (GPIO_PORTC | GPIO_OUT | GPIO_PF | 12)
325#define PC13_PF_USBOTG_DATA3 (GPIO_PORTC | GPIO_OUT | GPIO_PF | 13)
318#define PC16_PF_SSI4_FS (GPIO_PORTC | GPIO_IN | GPIO_PF | 16) 326#define PC16_PF_SSI4_FS (GPIO_PORTC | GPIO_IN | GPIO_PF | 16)
319#define PC17_PF_SSI4_RXD (GPIO_PORTC | GPIO_IN | GPIO_PF | 17) 327#define PC17_PF_SSI4_RXD (GPIO_PORTC | GPIO_IN | GPIO_PF | 17)
320#define PC18_PF_SSI4_TXD (GPIO_PORTC | GPIO_IN | GPIO_PF | 18) 328#define PC18_PF_SSI4_TXD (GPIO_PORTC | GPIO_IN | GPIO_PF | 18)
@@ -365,6 +373,9 @@ extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
365#define PD30_PF_CSPI1_MISO (GPIO_PORTD | GPIO_IN | GPIO_PF | 30) 373#define PD30_PF_CSPI1_MISO (GPIO_PORTD | GPIO_IN | GPIO_PF | 30)
366#define PD31_PF_CSPI1_MOSI (GPIO_PORTD | GPIO_OUT | GPIO_PF | 31) 374#define PD31_PF_CSPI1_MOSI (GPIO_PORTD | GPIO_OUT | GPIO_PF | 31)
367#define PF23_AIN_FEC_TX_EN (GPIO_PORTF | GPIO_OUT | GPIO_AIN | 23) 375#define PF23_AIN_FEC_TX_EN (GPIO_PORTF | GPIO_OUT | GPIO_AIN | 23)
376#define PE0_PF_USBOTG_NXT (GPIO_PORTE | GPIO_OUT | GPIO_PF | 0)
377#define PE1_PF_USBOTG_STP (GPIO_PORTE | GPIO_OUT | GPIO_PF | 1)
378#define PE2_PF_USBOTG_DIR (GPIO_PORTE | GPIO_OUT | GPIO_PF | 2)
368#define PE3_PF_UART2_CTS (GPIO_PORTE | GPIO_OUT | GPIO_PF | 3) 379#define PE3_PF_UART2_CTS (GPIO_PORTE | GPIO_OUT | GPIO_PF | 3)
369#define PE4_PF_UART2_RTS (GPIO_PORTE | GPIO_IN | GPIO_PF | 4) 380#define PE4_PF_UART2_RTS (GPIO_PORTE | GPIO_IN | GPIO_PF | 4)
370#define PE6_PF_UART2_TXD (GPIO_PORTE | GPIO_OUT | GPIO_PF | 6) 381#define PE6_PF_UART2_TXD (GPIO_PORTE | GPIO_OUT | GPIO_PF | 6)
@@ -379,18 +390,27 @@ extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
379#define PE15_PF_UART1_RTS (GPIO_PORTE | GPIO_IN | GPIO_PF | 15) 390#define PE15_PF_UART1_RTS (GPIO_PORTE | GPIO_IN | GPIO_PF | 15)
380#define PE16_AF_RTCK (GPIO_PORTE | GPIO_OUT | GPIO_AF | 16) 391#define PE16_AF_RTCK (GPIO_PORTE | GPIO_OUT | GPIO_AF | 16)
381#define PE16_PF_RTCK (GPIO_PORTE | GPIO_OUT | GPIO_PF | 16) 392#define PE16_PF_RTCK (GPIO_PORTE | GPIO_OUT | GPIO_PF | 16)
393#define PE18_PF_SDHC1_D0 (GPIO_PORTE | GPIO_PF | 18)
382#define PE18_AF_CSPI3_MISO (GPIO_PORTE | GPIO_IN | GPIO_AF | 18) 394#define PE18_AF_CSPI3_MISO (GPIO_PORTE | GPIO_IN | GPIO_AF | 18)
395#define PE19_PF_SDHC1_D1 (GPIO_PORTE | GPIO_PF | 19)
396#define PE20_PF_SDHC1_D2 (GPIO_PORTE | GPIO_PF | 20)
397#define PE21_PF_SDHC1_D3 (GPIO_PORTE | GPIO_PF | 21)
383#define PE21_AF_CSPI3_SS (GPIO_PORTE | GPIO_OUT | GPIO_AF | 21) 398#define PE21_AF_CSPI3_SS (GPIO_PORTE | GPIO_OUT | GPIO_AF | 21)
399#define PE22_PF_SDHC1_CMD (GPIO_PORTE | GPIO_PF | 22)
384#define PE22_AF_CSPI3_MOSI (GPIO_PORTE | GPIO_OUT | GPIO_AF | 22) 400#define PE22_AF_CSPI3_MOSI (GPIO_PORTE | GPIO_OUT | GPIO_AF | 22)
401#define PE22_PF_SDHC1_CLK (GPIO_PORTE | GPIO_PF | 23)
385#define PE23_AF_CSPI3_SCLK (GPIO_PORTE | GPIO_OUT | GPIO_AF | 23) 402#define PE23_AF_CSPI3_SCLK (GPIO_PORTE | GPIO_OUT | GPIO_AF | 23)
403#define PE24_PF_USBOTG_CLK (GPIO_PORTE | GPIO_OUT | GPIO_PF | 24)
404#define PE25_PF_USBOTG_DATA7 (GPIO_PORTE | GPIO_OUT | GPIO_PF | 25)
386#endif 405#endif
387 406
388/* decode irq number to use with IMR(x), ISR(x) and friends */ 407/* decode irq number to use with IMR(x), ISR(x) and friends */
389#define IRQ_TO_REG(irq) ((irq - MXC_MAX_INT_LINES) >> 5) 408#define IRQ_TO_REG(irq) ((irq - MXC_INTERNAL_IRQS) >> 5)
390 409
391#define IRQ_GPIOA(x) (MXC_MAX_INT_LINES + x) 410#define IRQ_GPIOA(x) (MXC_GPIO_IRQ_START + x)
392#define IRQ_GPIOB(x) (IRQ_GPIOA(32) + x) 411#define IRQ_GPIOB(x) (IRQ_GPIOA(32) + x)
393#define IRQ_GPIOC(x) (IRQ_GPIOB(32) + x) 412#define IRQ_GPIOC(x) (IRQ_GPIOB(32) + x)
394#define IRQ_GPIOD(x) (IRQ_GPIOC(32) + x) 413#define IRQ_GPIOD(x) (IRQ_GPIOC(32) + x)
414#define IRQ_GPIOE(x) (IRQ_GPIOD(32) + x)
395 415
396#endif /* _MXC_GPIO_MX1_MX2_H */ 416#endif /* _MXC_GPIO_MX1_MX2_H */
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx3.h b/arch/arm/plat-mxc/include/mach/iomux-mx3.h
index c9f39c2fb8c6..c9198c0aea18 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx3.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx3.h
@@ -141,7 +141,7 @@ void mxc_iomux_set_gpr(enum iomux_gp_func, bool);
141 ((iomux_pin & IOMUX_GPIONUM_MASK) >> IOMUX_GPIONUM_SHIFT) 141 ((iomux_pin & IOMUX_GPIONUM_MASK) >> IOMUX_GPIONUM_SHIFT)
142#define IOMUX_TO_IRQ(iomux_pin) \ 142#define IOMUX_TO_IRQ(iomux_pin) \
143 (((iomux_pin & IOMUX_GPIONUM_MASK) >> IOMUX_GPIONUM_SHIFT) + \ 143 (((iomux_pin & IOMUX_GPIONUM_MASK) >> IOMUX_GPIONUM_SHIFT) + \
144 MXC_GPIO_INT_BASE) 144 MXC_GPIO_IRQ_START)
145 145
146/* 146/*
147 * This enumeration is constructed based on the Section 147 * This enumeration is constructed based on the Section
@@ -491,6 +491,14 @@ enum iomux_pins {
491#define MX31_PIN_RTS1__RTS1 IOMUX_MODE(MX31_PIN_RTS1, IOMUX_CONFIG_FUNC) 491#define MX31_PIN_RTS1__RTS1 IOMUX_MODE(MX31_PIN_RTS1, IOMUX_CONFIG_FUNC)
492#define MX31_PIN_TXD1__TXD1 IOMUX_MODE(MX31_PIN_TXD1, IOMUX_CONFIG_FUNC) 492#define MX31_PIN_TXD1__TXD1 IOMUX_MODE(MX31_PIN_TXD1, IOMUX_CONFIG_FUNC)
493#define MX31_PIN_RXD1__RXD1 IOMUX_MODE(MX31_PIN_RXD1, IOMUX_CONFIG_FUNC) 493#define MX31_PIN_RXD1__RXD1 IOMUX_MODE(MX31_PIN_RXD1, IOMUX_CONFIG_FUNC)
494#define MX31_PIN_CTS2__CTS2 IOMUX_MODE(MX31_PIN_CTS2, IOMUX_CONFIG_FUNC)
495#define MX31_PIN_RTS2__RTS2 IOMUX_MODE(MX31_PIN_RTS2, IOMUX_CONFIG_FUNC)
496#define MX31_PIN_TXD2__TXD2 IOMUX_MODE(MX31_PIN_TXD2, IOMUX_CONFIG_FUNC)
497#define MX31_PIN_RXD2__RXD2 IOMUX_MODE(MX31_PIN_RXD2, IOMUX_CONFIG_FUNC)
498#define MX31_PIN_PC_RST__CTS5 IOMUX_MODE(MX31_PIN_PC_RST, IOMUX_CONFIG_ALT2)
499#define MX31_PIN_PC_VS2__RTS5 IOMUX_MODE(MX31_PIN_PC_VS2, IOMUX_CONFIG_ALT2)
500#define MX31_PIN_PC_BVD2__TXD5 IOMUX_MODE(MX31_PIN_PC_BVD2, IOMUX_CONFIG_ALT2)
501#define MX31_PIN_PC_BVD1__RXD5 IOMUX_MODE(MX31_PIN_PC_BVD1, IOMUX_CONFIG_ALT2)
494#define MX31_PIN_CSPI1_MOSI__MOSI IOMUX_MODE(MX31_PIN_CSPI1_MOSI, IOMUX_CONFIG_FUNC) 502#define MX31_PIN_CSPI1_MOSI__MOSI IOMUX_MODE(MX31_PIN_CSPI1_MOSI, IOMUX_CONFIG_FUNC)
495#define MX31_PIN_CSPI1_MISO__MISO IOMUX_MODE(MX31_PIN_CSPI1_MISO, IOMUX_CONFIG_FUNC) 503#define MX31_PIN_CSPI1_MISO__MISO IOMUX_MODE(MX31_PIN_CSPI1_MISO, IOMUX_CONFIG_FUNC)
496#define MX31_PIN_CSPI1_SCLK__SCLK IOMUX_MODE(MX31_PIN_CSPI1_SCLK, IOMUX_CONFIG_FUNC) 504#define MX31_PIN_CSPI1_SCLK__SCLK IOMUX_MODE(MX31_PIN_CSPI1_SCLK, IOMUX_CONFIG_FUNC)
@@ -509,6 +517,15 @@ enum iomux_pins {
509#define MX31_PIN_CSPI3_MISO__MISO IOMUX_MODE(MX31_PIN_CSPI3_MISO, IOMUX_CONFIG_FUNC) 517#define MX31_PIN_CSPI3_MISO__MISO IOMUX_MODE(MX31_PIN_CSPI3_MISO, IOMUX_CONFIG_FUNC)
510#define MX31_PIN_CSPI3_SCLK__SCLK IOMUX_MODE(MX31_PIN_CSPI3_SCLK, IOMUX_CONFIG_FUNC) 518#define MX31_PIN_CSPI3_SCLK__SCLK IOMUX_MODE(MX31_PIN_CSPI3_SCLK, IOMUX_CONFIG_FUNC)
511#define MX31_PIN_CSPI3_SPI_RDY__SPI_RDY IOMUX_MODE(MX31_PIN_CSPI3_SPI_RDY, IOMUX_CONFIG_FUNC) 519#define MX31_PIN_CSPI3_SPI_RDY__SPI_RDY IOMUX_MODE(MX31_PIN_CSPI3_SPI_RDY, IOMUX_CONFIG_FUNC)
520#define MX31_PIN_BATT_LINE__OWIRE IOMUX_MODE(MX31_PIN_BATT_LINE, IOMUX_CONFIG_FUNC)
521#define MX31_PIN_CS4__CS4 IOMUX_MODE(MX31_PIN_CS4, IOMUX_CONFIG_FUNC)
522#define MX31_PIN_SD1_DATA3__SD1_DATA3 IOMUX_MODE(MX31_PIN_SD1_DATA3, IOMUX_CONFIG_FUNC)
523#define MX31_PIN_SD1_DATA2__SD1_DATA2 IOMUX_MODE(MX31_PIN_SD1_DATA2, IOMUX_CONFIG_FUNC)
524#define MX31_PIN_SD1_DATA1__SD1_DATA1 IOMUX_MODE(MX31_PIN_SD1_DATA1, IOMUX_CONFIG_FUNC)
525#define MX31_PIN_SD1_DATA0__SD1_DATA0 IOMUX_MODE(MX31_PIN_SD1_DATA0, IOMUX_CONFIG_FUNC)
526#define MX31_PIN_SD1_CLK__SD1_CLK IOMUX_MODE(MX31_PIN_SD1_CLK, IOMUX_CONFIG_FUNC)
527#define MX31_PIN_SD1_CMD__SD1_CMD IOMUX_MODE(MX31_PIN_SD1_CMD, IOMUX_CONFIG_FUNC)
528
512/*XXX: The SS0, SS1, SS2, SS3 lines of spi3 are multiplexed by cspi2_ss0, cspi2_ss1, cspi1_ss0 529/*XXX: The SS0, SS1, SS2, SS3 lines of spi3 are multiplexed by cspi2_ss0, cspi2_ss1, cspi1_ss0
513 * cspi1_ss1*/ 530 * cspi1_ss1*/
514 531
diff --git a/arch/arm/plat-mxc/include/mach/irqs.h b/arch/arm/plat-mxc/include/mach/irqs.h
index b55bba35e18a..e06d3cb0ee11 100644
--- a/arch/arm/plat-mxc/include/mach/irqs.h
+++ b/arch/arm/plat-mxc/include/mach/irqs.h
@@ -11,7 +11,37 @@
11#ifndef __ASM_ARCH_MXC_IRQS_H__ 11#ifndef __ASM_ARCH_MXC_IRQS_H__
12#define __ASM_ARCH_MXC_IRQS_H__ 12#define __ASM_ARCH_MXC_IRQS_H__
13 13
14#include <mach/hardware.h> 14/*
15 * So far all i.MX SoCs have 64 internal interrupts
16 */
17#define MXC_INTERNAL_IRQS 64
18
19#define MXC_GPIO_IRQ_START MXC_INTERNAL_IRQS
20
21#if defined CONFIG_ARCH_MX1
22#define MXC_GPIO_IRQS (32 * 4)
23#elif defined CONFIG_ARCH_MX2
24#define MXC_GPIO_IRQS (32 * 6)
25#elif defined CONFIG_ARCH_MX3
26#define MXC_GPIO_IRQS (32 * 3)
27#endif
28
29/*
30 * The next 16 interrupts are for board specific purposes. Since
31 * the kernel can only run on one machine at a time, we can re-use
32 * these. If you need more, increase MXC_BOARD_IRQS, but keep it
33 * within sensible limits.
34 */
35#define MXC_BOARD_IRQ_START (MXC_INTERNAL_IRQS + MXC_GPIO_IRQS)
36#define MXC_BOARD_IRQS 16
37
38#define NR_IRQS (MXC_BOARD_IRQ_START + MXC_BOARD_IRQS)
39
15extern void imx_irq_set_priority(unsigned char irq, unsigned char prio); 40extern void imx_irq_set_priority(unsigned char irq, unsigned char prio);
16 41
42/* all normal IRQs can be FIQs */
43#define FIQ_START 0
44/* switch betwean IRQ and FIQ */
45extern int mxc_set_irq_fiq(unsigned int irq, unsigned int type);
46
17#endif /* __ASM_ARCH_MXC_IRQS_H__ */ 47#endif /* __ASM_ARCH_MXC_IRQS_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/memory.h b/arch/arm/plat-mxc/include/mach/memory.h
index d7a8d3ebed57..0b808399097f 100644
--- a/arch/arm/plat-mxc/include/mach/memory.h
+++ b/arch/arm/plat-mxc/include/mach/memory.h
@@ -11,19 +11,12 @@
11#ifndef __ASM_ARCH_MXC_MEMORY_H__ 11#ifndef __ASM_ARCH_MXC_MEMORY_H__
12#define __ASM_ARCH_MXC_MEMORY_H__ 12#define __ASM_ARCH_MXC_MEMORY_H__
13 13
14#include <mach/hardware.h> 14#if defined CONFIG_ARCH_MX1
15 15#define PHYS_OFFSET UL(0x08000000)
16/* 16#elif defined CONFIG_ARCH_MX2
17 * Virtual view <-> DMA view memory address translations 17#define PHYS_OFFSET UL(0xA0000000)
18 * This macro is used to translate the virtual address to an address 18#elif defined CONFIG_ARCH_MX3
19 * suitable to be passed to set_dma_addr() 19#define PHYS_OFFSET UL(0x80000000)
20 */ 20#endif
21#define __virt_to_bus(a) __virt_to_phys(a)
22
23/*
24 * Used to convert an address for DMA operations to an address that the
25 * kernel can use.
26 */
27#define __bus_to_virt(a) __phys_to_virt(a)
28 21
29#endif /* __ASM_ARCH_MXC_MEMORY_H__ */ 22#endif /* __ASM_ARCH_MXC_MEMORY_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mtd-xip.h b/arch/arm/plat-mxc/include/mach/mtd-xip.h
new file mode 100644
index 000000000000..1ab1bba5688d
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/mtd-xip.h
@@ -0,0 +1,34 @@
1/*
2 * MTD primitives for XIP support. Architecture specific functions
3 *
4 * Do not include this file directly. It's included from linux/mtd/xip.h
5 *
6 * Copyright (C) 2008 Darius Augulis <augulis.darius@gmail.com>, Teltonika, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13
14#include <mach/mxc_timer.h>
15
16#ifndef __ARCH_IMX_MTD_XIP_H__
17#define __ARCH_IMX_MTD_XIP_H__
18
19#ifdef CONFIG_ARCH_MX1
20/* AITC registers */
21#define AITC_BASE IO_ADDRESS(AVIC_BASE_ADDR)
22#define NIPNDH (AITC_BASE + 0x58)
23#define NIPNDL (AITC_BASE + 0x5C)
24#define INTENABLEH (AITC_BASE + 0x10)
25#define INTENABLEL (AITC_BASE + 0x14)
26/* MTD macros */
27#define xip_irqpending() ((__raw_readl(INTENABLEH) & __raw_readl(NIPNDH)) \
28 || (__raw_readl(INTENABLEL) & __raw_readl(NIPNDL)))
29#define xip_currtime() (__raw_readl(TIMER_BASE + MXC_TCN))
30#define xip_elapsed_since(x) (signed)((__raw_readl(TIMER_BASE + MXC_TCN) - (x)) / 96)
31#define xip_cpu_idle() asm volatile ("mcr p15, 0, %0, c7, c0, 4" :: "r" (0))
32#endif /* CONFIG_ARCH_MX1 */
33
34#endif /* __ARCH_IMX_MTD_XIP_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mx1.h b/arch/arm/plat-mxc/include/mach/mx1.h
new file mode 100644
index 000000000000..b92e02324d8e
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/mx1.h
@@ -0,0 +1,186 @@
1/*
2 * Copyright (C) 1997,1998 Russell King
3 * Copyright (C) 1999 ARM Limited
4 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
5 * Copyright (c) 2008 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
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
12#ifndef __ASM_ARCH_MXC_MX1_H__
13#define __ASM_ARCH_MXC_MX1_H__
14
15#ifndef __ASM_ARCH_MXC_HARDWARE_H__
16#error "Do not include directly."
17#endif
18
19#include <mach/vmalloc.h>
20
21/*
22 * Memory map
23 */
24#define IMX_IO_PHYS 0x00200000
25#define IMX_IO_SIZE 0x00100000
26#define IMX_IO_BASE VMALLOC_END
27
28#define IMX_CS0_PHYS 0x10000000
29#define IMX_CS0_SIZE 0x02000000
30
31#define IMX_CS1_PHYS 0x12000000
32#define IMX_CS1_SIZE 0x01000000
33
34#define IMX_CS2_PHYS 0x13000000
35#define IMX_CS2_SIZE 0x01000000
36
37#define IMX_CS3_PHYS 0x14000000
38#define IMX_CS3_SIZE 0x01000000
39
40#define IMX_CS4_PHYS 0x15000000
41#define IMX_CS4_SIZE 0x01000000
42
43#define IMX_CS5_PHYS 0x16000000
44#define IMX_CS5_SIZE 0x01000000
45
46/*
47 * Register BASEs, based on OFFSETs
48 */
49#define AIPI1_BASE_ADDR (0x00000 + IMX_IO_PHYS)
50#define WDT_BASE_ADDR (0x01000 + IMX_IO_PHYS)
51#define TIM1_BASE_ADDR (0x02000 + IMX_IO_PHYS)
52#define TIM2_BASE_ADDR (0x03000 + IMX_IO_PHYS)
53#define RTC_BASE_ADDR (0x04000 + IMX_IO_PHYS)
54#define LCDC_BASE_ADDR (0x05000 + IMX_IO_PHYS)
55#define UART1_BASE_ADDR (0x06000 + IMX_IO_PHYS)
56#define UART2_BASE_ADDR (0x07000 + IMX_IO_PHYS)
57#define PWM_BASE_ADDR (0x08000 + IMX_IO_PHYS)
58#define DMA_BASE_ADDR (0x09000 + IMX_IO_PHYS)
59#define AIPI2_BASE_ADDR (0x10000 + IMX_IO_PHYS)
60#define SIM_BASE_ADDR (0x11000 + IMX_IO_PHYS)
61#define USBD_BASE_ADDR (0x12000 + IMX_IO_PHYS)
62#define SPI1_BASE_ADDR (0x13000 + IMX_IO_PHYS)
63#define MMC_BASE_ADDR (0x14000 + IMX_IO_PHYS)
64#define ASP_BASE_ADDR (0x15000 + IMX_IO_PHYS)
65#define BTA_BASE_ADDR (0x16000 + IMX_IO_PHYS)
66#define I2C_BASE_ADDR (0x17000 + IMX_IO_PHYS)
67#define SSI_BASE_ADDR (0x18000 + IMX_IO_PHYS)
68#define SPI2_BASE_ADDR (0x19000 + IMX_IO_PHYS)
69#define MSHC_BASE_ADDR (0x1A000 + IMX_IO_PHYS)
70#define CCM_BASE_ADDR (0x1B000 + IMX_IO_PHYS)
71#define SCM_BASE_ADDR (0x1B804 + IMX_IO_PHYS)
72#define GPIO_BASE_ADDR (0x1C000 + IMX_IO_PHYS)
73#define EIM_BASE_ADDR (0x20000 + IMX_IO_PHYS)
74#define SDRAMC_BASE_ADDR (0x21000 + IMX_IO_PHYS)
75#define MMA_BASE_ADDR (0x22000 + IMX_IO_PHYS)
76#define AVIC_BASE_ADDR (0x23000 + IMX_IO_PHYS)
77#define CSI_BASE_ADDR (0x24000 + IMX_IO_PHYS)
78
79/* macro to get at IO space when running virtually */
80#define IO_ADDRESS(x) ((x) - IMX_IO_PHYS + IMX_IO_BASE)
81
82/* define macros needed for entry-macro.S */
83#define AVIC_IO_ADDRESS(x) IO_ADDRESS(x)
84
85/* fixed interrput numbers */
86#define INT_SOFTINT 0
87#define CSI_INT 6
88#define DSPA_MAC_INT 7
89#define DSPA_INT 8
90#define COMP_INT 9
91#define MSHC_XINT 10
92#define GPIO_INT_PORTA 11
93#define GPIO_INT_PORTB 12
94#define GPIO_INT_PORTC 13
95#define LCDC_INT 14
96#define SIM_INT 15
97#define SIM_DATA_INT 16
98#define RTC_INT 17
99#define RTC_SAMINT 18
100#define UART2_MINT_PFERR 19
101#define UART2_MINT_RTS 20
102#define UART2_MINT_DTR 21
103#define UART2_MINT_UARTC 22
104#define UART2_MINT_TX 23
105#define UART2_MINT_RX 24
106#define UART1_MINT_PFERR 25
107#define UART1_MINT_RTS 26
108#define UART1_MINT_DTR 27
109#define UART1_MINT_UARTC 28
110#define UART1_MINT_TX 29
111#define UART1_MINT_RX 30
112#define VOICE_DAC_INT 31
113#define VOICE_ADC_INT 32
114#define PEN_DATA_INT 33
115#define PWM_INT 34
116#define SDHC_INT 35
117#define I2C_INT 39
118#define CSPI_INT 41
119#define SSI_TX_INT 42
120#define SSI_TX_ERR_INT 43
121#define SSI_RX_INT 44
122#define SSI_RX_ERR_INT 45
123#define TOUCH_INT 46
124#define USBD_INT0 47
125#define USBD_INT1 48
126#define USBD_INT2 49
127#define USBD_INT3 50
128#define USBD_INT4 51
129#define USBD_INT5 52
130#define USBD_INT6 53
131#define BTSYS_INT 55
132#define BTTIM_INT 56
133#define BTWUI_INT 57
134#define TIM2_INT 58
135#define TIM1_INT 59
136#define DMA_ERR 60
137#define DMA_INT 61
138#define GPIO_INT_PORTD 62
139#define WDT_INT 63
140
141/* gpio and gpio based interrupt handling */
142#define GPIO_DR 0x1C
143#define GPIO_GDIR 0x00
144#define GPIO_PSR 0x24
145#define GPIO_ICR1 0x28
146#define GPIO_ICR2 0x2C
147#define GPIO_IMR 0x30
148#define GPIO_ISR 0x34
149#define GPIO_INT_LOW_LEV 0x3
150#define GPIO_INT_HIGH_LEV 0x2
151#define GPIO_INT_RISE_EDGE 0x0
152#define GPIO_INT_FALL_EDGE 0x1
153#define GPIO_INT_NONE 0x4
154
155/* DMA */
156#define DMA_REQ_UART3_T 2
157#define DMA_REQ_UART3_R 3
158#define DMA_REQ_SSI2_T 4
159#define DMA_REQ_SSI2_R 5
160#define DMA_REQ_CSI_STAT 6
161#define DMA_REQ_CSI_R 7
162#define DMA_REQ_MSHC 8
163#define DMA_REQ_DSPA_DCT_DOUT 9
164#define DMA_REQ_DSPA_DCT_DIN 10
165#define DMA_REQ_DSPA_MAC 11
166#define DMA_REQ_EXT 12
167#define DMA_REQ_SDHC 13
168#define DMA_REQ_SPI1_R 14
169#define DMA_REQ_SPI1_T 15
170#define DMA_REQ_SSI_T 16
171#define DMA_REQ_SSI_R 17
172#define DMA_REQ_ASP_DAC 18
173#define DMA_REQ_ASP_ADC 19
174#define DMA_REQ_USP_EP(x) (20 + (x))
175#define DMA_REQ_SPI2_R 26
176#define DMA_REQ_SPI2_T 27
177#define DMA_REQ_UART2_T 28
178#define DMA_REQ_UART2_R 29
179#define DMA_REQ_UART1_T 30
180#define DMA_REQ_UART1_R 31
181
182/* mandatory for CONFIG_LL_DEBUG */
183#define MXC_LL_UART_PADDR UART1_BASE_ADDR
184#define MXC_LL_UART_VADDR IO_ADDRESS(UART1_BASE_ADDR)
185
186#endif /* __ASM_ARCH_MXC_MX1_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mx27.h b/arch/arm/plat-mxc/include/mach/mx27.h
index a86db64744a1..0313be720552 100644
--- a/arch/arm/plat-mxc/include/mach/mx27.h
+++ b/arch/arm/plat-mxc/include/mach/mx27.h
@@ -72,7 +72,8 @@
72/* for mx27*/ 72/* for mx27*/
73#define OTG_BASE_ADDR USBOTG_BASE_ADDR 73#define OTG_BASE_ADDR USBOTG_BASE_ADDR
74#define SAHARA_BASE_ADDR (AIPI_BASE_ADDR + 0x25000) 74#define SAHARA_BASE_ADDR (AIPI_BASE_ADDR + 0x25000)
75#define EMMA_BASE_ADDR (AIPI_BASE_ADDR + 0x26400) 75#define EMMA_PP_BASE_ADDR (AIPI_BASE_ADDR + 0x26000)
76#define EMMA_PRP_BASE_ADDR (AIPI_BASE_ADDR + 0x26400)
76#define CCM_BASE_ADDR (AIPI_BASE_ADDR + 0x27000) 77#define CCM_BASE_ADDR (AIPI_BASE_ADDR + 0x27000)
77#define SYSCTRL_BASE_ADDR (AIPI_BASE_ADDR + 0x27800) 78#define SYSCTRL_BASE_ADDR (AIPI_BASE_ADDR + 0x27800)
78#define IIM_BASE_ADDR (AIPI_BASE_ADDR + 0x28000) 79#define IIM_BASE_ADDR (AIPI_BASE_ADDR + 0x28000)
@@ -288,16 +289,4 @@ extern int mx27_revision(void);
288/* this CPU supports up to 192 GPIOs (don't forget the baseboard!) */ 289/* this CPU supports up to 192 GPIOs (don't forget the baseboard!) */
289#define ARCH_NR_GPIOS (192 + 16) 290#define ARCH_NR_GPIOS (192 + 16)
290 291
291/* OS clock tick rate */
292#define CLOCK_TICK_RATE 13300000
293
294/* Start of RAM */
295#define PHYS_OFFSET SDRAM_BASE_ADDR
296
297/* max interrupt lines count */
298#define NR_IRQS 256
299
300/* count of internal interrupt sources */
301#define MXC_MAX_INT_LINES 64
302
303#endif /* __ASM_ARCH_MXC_MX27_H__ */ 292#endif /* __ASM_ARCH_MXC_MX27_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mx31.h b/arch/arm/plat-mxc/include/mach/mx31.h
index 0536f8917bc0..de026654b00e 100644
--- a/arch/arm/plat-mxc/include/mach/mx31.h
+++ b/arch/arm/plat-mxc/include/mach/mx31.h
@@ -15,11 +15,6 @@
15#error "Do not include directly." 15#error "Do not include directly."
16#endif 16#endif
17 17
18/*!
19 * defines the hardware clock tick rate
20 */
21#define CLOCK_TICK_RATE 16625000
22
23/* 18/*
24 * MX31 memory map: 19 * MX31 memory map:
25 * 20 *
@@ -244,9 +239,6 @@
244#define PCMCIA_IO_ADDRESS(x) \ 239#define PCMCIA_IO_ADDRESS(x) \
245 (((x) - X_MEMC_BASE_ADDR) + X_MEMC_BASE_ADDR_VIRT) 240 (((x) - X_MEMC_BASE_ADDR) + X_MEMC_BASE_ADDR_VIRT)
246 241
247/* Start of physical RAM - On many MX31 platforms, this is the first SDRAM bank (CSD0) */
248#define PHYS_OFFSET CSD0_BASE_ADDR
249
250/* 242/*
251 * Interrupt numbers 243 * Interrupt numbers
252 */ 244 */
@@ -315,23 +307,6 @@
315#define MXC_INT_EXT_WDOG 62 307#define MXC_INT_EXT_WDOG 62
316#define MXC_INT_EXT_TV 63 308#define MXC_INT_EXT_TV 63
317 309
318#define MXC_MAX_INT_LINES 64
319
320#define MXC_GPIO_INT_BASE MXC_MAX_INT_LINES
321#define MXC_MAX_GPIO_LINES (GPIO_NUM_PIN * GPIO_PORT_NUM)
322#define MXC_MAX_VIRTUAL_INTS 16
323
324#define NR_IRQS (MXC_MAX_INT_LINES + MXC_MAX_GPIO_LINES + MXC_MAX_VIRTUAL_INTS)
325
326/*!
327 * Number of GPIO port as defined in the IC Spec
328 */
329#define GPIO_PORT_NUM 3
330/*!
331 * Number of GPIO pins per port
332 */
333#define GPIO_NUM_PIN 32
334
335#define PROD_SIGNATURE 0x1 /* For MX31 */ 310#define PROD_SIGNATURE 0x1 /* For MX31 */
336 311
337/* silicon revisions specific to i.MX31 */ 312/* silicon revisions specific to i.MX31 */
diff --git a/arch/arm/plat-mxc/include/mach/mxc_timer.h b/arch/arm/plat-mxc/include/mach/mxc_timer.h
index 130aebfbe168..6c19a134744b 100644
--- a/arch/arm/plat-mxc/include/mach/mxc_timer.h
+++ b/arch/arm/plat-mxc/include/mach/mxc_timer.h
@@ -26,7 +26,7 @@
26#include <linux/clk.h> 26#include <linux/clk.h>
27#include <mach/hardware.h> 27#include <mach/hardware.h>
28 28
29#ifdef CONFIG_ARCH_IMX 29#ifdef CONFIG_ARCH_MX1
30#define TIMER_BASE IO_ADDRESS(TIM1_BASE_ADDR) 30#define TIMER_BASE IO_ADDRESS(TIM1_BASE_ADDR)
31#define TIMER_INTERRUPT TIM1_INT 31#define TIMER_INTERRUPT TIM1_INT
32 32
@@ -65,7 +65,7 @@ static void gpt_irq_acknowledge(void)
65{ 65{
66 __raw_writel(0, TIMER_BASE + MXC_TSTAT); 66 __raw_writel(0, TIMER_BASE + MXC_TSTAT);
67} 67}
68#endif /* CONFIG_ARCH_IMX */ 68#endif /* CONFIG_ARCH_MX1 */
69 69
70#ifdef CONFIG_ARCH_MX2 70#ifdef CONFIG_ARCH_MX2
71#define TIMER_BASE IO_ADDRESS(GPT1_BASE_ADDR) 71#define TIMER_BASE IO_ADDRESS(GPT1_BASE_ADDR)
diff --git a/arch/arm/plat-mxc/include/mach/timex.h b/arch/arm/plat-mxc/include/mach/timex.h
index 0b0af0253e91..07b4a73c9d2f 100644
--- a/arch/arm/plat-mxc/include/mach/timex.h
+++ b/arch/arm/plat-mxc/include/mach/timex.h
@@ -20,6 +20,12 @@
20#ifndef __ASM_ARCH_MXC_TIMEX_H__ 20#ifndef __ASM_ARCH_MXC_TIMEX_H__
21#define __ASM_ARCH_MXC_TIMEX_H__ 21#define __ASM_ARCH_MXC_TIMEX_H__
22 22
23#include <mach/hardware.h> /* for CLOCK_TICK_RATE */ 23#if defined CONFIG_ARCH_MX1
24#define CLOCK_TICK_RATE 16000000
25#elif defined CONFIG_ARCH_MX2
26#define CLOCK_TICK_RATE 13300000
27#elif defined CONFIG_ARCH_MX3
28#define CLOCK_TICK_RATE 16625000
29#endif
24 30
25#endif /* __ASM_ARCH_MXC_TIMEX_H__ */ 31#endif /* __ASM_ARCH_MXC_TIMEX_H__ */
diff --git a/arch/arm/plat-mxc/iomux-mx1-mx2.c b/arch/arm/plat-mxc/iomux-mx1-mx2.c
index d97387aa9a42..df6f18395686 100644
--- a/arch/arm/plat-mxc/iomux-mx1-mx2.c
+++ b/arch/arm/plat-mxc/iomux-mx1-mx2.c
@@ -110,12 +110,13 @@ void mxc_gpio_mode(int gpio_mode)
110EXPORT_SYMBOL(mxc_gpio_mode); 110EXPORT_SYMBOL(mxc_gpio_mode);
111 111
112int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count, 112int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
113 int alloc_mode, const char *label) 113 const char *label)
114{ 114{
115 const int *p = pin_list; 115 const int *p = pin_list;
116 int i; 116 int i;
117 unsigned gpio; 117 unsigned gpio;
118 unsigned mode; 118 unsigned mode;
119 int ret = -EINVAL;
119 120
120 for (i = 0; i < count; i++) { 121 for (i = 0; i < count; i++) {
121 gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK); 122 gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK);
@@ -124,33 +125,33 @@ int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
124 if (gpio >= (GPIO_PORT_MAX + 1) * 32) 125 if (gpio >= (GPIO_PORT_MAX + 1) * 32)
125 goto setup_error; 126 goto setup_error;
126 127
127 if (alloc_mode & MXC_GPIO_ALLOC_MODE_RELEASE) 128 ret = gpio_request(gpio, label);
128 gpio_free(gpio); 129 if (ret)
129 else if (!(alloc_mode & MXC_GPIO_ALLOC_MODE_NO_ALLOC)) 130 goto setup_error;
130 if (gpio_request(gpio, label)
131 && !(alloc_mode & MXC_GPIO_ALLOC_MODE_TRY_ALLOC))
132 goto setup_error;
133 131
134 if (!(alloc_mode & (MXC_GPIO_ALLOC_MODE_ALLOC_ONLY | 132 mxc_gpio_mode(gpio | mode);
135 MXC_GPIO_ALLOC_MODE_RELEASE)))
136 mxc_gpio_mode(gpio | mode);
137 133
138 p++; 134 p++;
139 } 135 }
140 return 0; 136 return 0;
141 137
142setup_error: 138setup_error:
143 if (alloc_mode & (MXC_GPIO_ALLOC_MODE_NO_ALLOC | 139 mxc_gpio_release_multiple_pins(pin_list, i);
144 MXC_GPIO_ALLOC_MODE_TRY_ALLOC)) 140 return ret;
145 return -EINVAL; 141}
142EXPORT_SYMBOL(mxc_gpio_setup_multiple_pins);
146 143
147 while (p != pin_list) { 144void mxc_gpio_release_multiple_pins(const int *pin_list, int count)
148 p--; 145{
149 gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK); 146 const int *p = pin_list;
147 int i;
148
149 for (i = 0; i < count; i++) {
150 unsigned gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK);
150 gpio_free(gpio); 151 gpio_free(gpio);
152 p++;
151 } 153 }
152 154
153 return -EINVAL;
154} 155}
155EXPORT_SYMBOL(mxc_gpio_setup_multiple_pins); 156EXPORT_SYMBOL(mxc_gpio_release_multiple_pins);
156 157
diff --git a/arch/arm/plat-mxc/irq.c b/arch/arm/plat-mxc/irq.c
index d862c9e5f8db..6e7578a3514b 100644
--- a/arch/arm/plat-mxc/irq.c
+++ b/arch/arm/plat-mxc/irq.c
@@ -17,9 +17,12 @@
17 * MA 02110-1301, USA. 17 * MA 02110-1301, USA.
18 */ 18 */
19 19
20#include <linux/module.h>
20#include <linux/irq.h> 21#include <linux/irq.h>
21#include <linux/io.h> 22#include <linux/io.h>
22#include <mach/common.h> 23#include <mach/common.h>
24#include <asm/mach/irq.h>
25#include <mach/hardware.h>
23 26
24#define AVIC_BASE IO_ADDRESS(AVIC_BASE_ADDR) 27#define AVIC_BASE IO_ADDRESS(AVIC_BASE_ADDR)
25#define AVIC_INTCNTL (AVIC_BASE + 0x00) /* int control reg */ 28#define AVIC_INTCNTL (AVIC_BASE + 0x00) /* int control reg */
@@ -65,6 +68,28 @@ void imx_irq_set_priority(unsigned char irq, unsigned char prio)
65EXPORT_SYMBOL(imx_irq_set_priority); 68EXPORT_SYMBOL(imx_irq_set_priority);
66#endif 69#endif
67 70
71#ifdef CONFIG_FIQ
72int mxc_set_irq_fiq(unsigned int irq, unsigned int type)
73{
74 unsigned int irqt;
75
76 if (irq >= MXC_INTERNAL_IRQS)
77 return -EINVAL;
78
79 if (irq < MXC_INTERNAL_IRQS / 2) {
80 irqt = __raw_readl(AVIC_INTTYPEL) & ~(1 << irq);
81 __raw_writel(irqt | (!!type << irq), AVIC_INTTYPEL);
82 } else {
83 irq -= MXC_INTERNAL_IRQS / 2;
84 irqt = __raw_readl(AVIC_INTTYPEH) & ~(1 << irq);
85 __raw_writel(irqt | (!!type << irq), AVIC_INTTYPEH);
86 }
87
88 return 0;
89}
90EXPORT_SYMBOL(mxc_set_irq_fiq);
91#endif /* CONFIG_FIQ */
92
68/* Disable interrupt number "irq" in the AVIC */ 93/* Disable interrupt number "irq" in the AVIC */
69static void mxc_mask_irq(unsigned int irq) 94static void mxc_mask_irq(unsigned int irq)
70{ 95{
@@ -91,7 +116,6 @@ static struct irq_chip mxc_avic_chip = {
91void __init mxc_init_irq(void) 116void __init mxc_init_irq(void)
92{ 117{
93 int i; 118 int i;
94 u32 reg;
95 119
96 /* put the AVIC into the reset value with 120 /* put the AVIC into the reset value with
97 * all interrupts disabled 121 * all interrupts disabled
@@ -106,7 +130,7 @@ void __init mxc_init_irq(void)
106 /* all IRQ no FIQ */ 130 /* all IRQ no FIQ */
107 __raw_writel(0, AVIC_INTTYPEH); 131 __raw_writel(0, AVIC_INTTYPEH);
108 __raw_writel(0, AVIC_INTTYPEL); 132 __raw_writel(0, AVIC_INTTYPEL);
109 for (i = 0; i < MXC_MAX_INT_LINES; i++) { 133 for (i = 0; i < MXC_INTERNAL_IRQS; i++) {
110 set_irq_chip(i, &mxc_avic_chip); 134 set_irq_chip(i, &mxc_avic_chip);
111 set_irq_handler(i, handle_level_irq); 135 set_irq_handler(i, handle_level_irq);
112 set_irq_flags(i, IRQF_VALID); 136 set_irq_flags(i, IRQF_VALID);
@@ -119,5 +143,10 @@ void __init mxc_init_irq(void)
119 /* init architectures chained interrupt handler */ 143 /* init architectures chained interrupt handler */
120 mxc_register_gpios(); 144 mxc_register_gpios();
121 145
146#ifdef CONFIG_FIQ
147 /* Initialize FIQ */
148 init_FIQ();
149#endif
150
122 printk(KERN_INFO "MXC IRQ initialized\n"); 151 printk(KERN_INFO "MXC IRQ initialized\n");
123} 152}
diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
index fd28f5194f71..758a1293bcfa 100644
--- a/arch/arm/plat-mxc/time.c
+++ b/arch/arm/plat-mxc/time.c
@@ -190,7 +190,7 @@ static int __init mxc_clockevent_init(void)
190 clockevent_mxc.min_delta_ns = 190 clockevent_mxc.min_delta_ns =
191 clockevent_delta2ns(0xff, &clockevent_mxc); 191 clockevent_delta2ns(0xff, &clockevent_mxc);
192 192
193 clockevent_mxc.cpumask = cpumask_of_cpu(0); 193 clockevent_mxc.cpumask = cpumask_of(0);
194 194
195 clockevents_register_device(&clockevent_mxc); 195 clockevents_register_device(&clockevent_mxc);
196 196
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index a94f0c44ebc8..46d3b0b9ce69 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -14,9 +14,11 @@ config ARCH_OMAP1
14 14
15config ARCH_OMAP2 15config ARCH_OMAP2
16 bool "TI OMAP2" 16 bool "TI OMAP2"
17 select CPU_V6
17 18
18config ARCH_OMAP3 19config ARCH_OMAP3
19 bool "TI OMAP3" 20 bool "TI OMAP3"
21 select CPU_V7
20 22
21endchoice 23endchoice
22 24
diff --git a/arch/arm/plat-omap/debug-devices.c b/arch/arm/plat-omap/debug-devices.c
index e31154b15d9e..f6684832ca8f 100644
--- a/arch/arm/plat-omap/debug-devices.c
+++ b/arch/arm/plat-omap/debug-devices.c
@@ -69,15 +69,15 @@ int __init debug_card_init(u32 addr, unsigned gpio)
69 smc91x_resources[0].start = addr + 0x300; 69 smc91x_resources[0].start = addr + 0x300;
70 smc91x_resources[0].end = addr + 0x30f; 70 smc91x_resources[0].end = addr + 0x30f;
71 71
72 smc91x_resources[1].start = OMAP_GPIO_IRQ(gpio); 72 smc91x_resources[1].start = gpio_to_irq(gpio);
73 smc91x_resources[1].end = OMAP_GPIO_IRQ(gpio); 73 smc91x_resources[1].end = gpio_to_irq(gpio);
74 74
75 status = omap_request_gpio(gpio); 75 status = gpio_request(gpio, "SMC91x irq");
76 if (status < 0) { 76 if (status < 0) {
77 printk(KERN_ERR "GPIO%d unavailable for smc91x IRQ\n", gpio); 77 printk(KERN_ERR "GPIO%d unavailable for smc91x IRQ\n", gpio);
78 return status; 78 return status;
79 } 79 }
80 omap_set_gpio_direction(gpio, 1); 80 gpio_direction_input(gpio);
81 81
82 led_resources[0].start = addr; 82 led_resources[0].start = addr;
83 led_resources[0].end = addr + SZ_4K - 1; 83 led_resources[0].end = addr + SZ_4K - 1;
diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c
index 2f4c0cabfd34..be4eefda4767 100644
--- a/arch/arm/plat-omap/debug-leds.c
+++ b/arch/arm/plat-omap/debug-leds.c
@@ -83,8 +83,8 @@ static void h2p2_dbg_leds_event(led_event_t evt)
83 /* all leds off during suspend or shutdown */ 83 /* all leds off during suspend or shutdown */
84 84
85 if (!(machine_is_omap_perseus2() || machine_is_omap_h4())) { 85 if (!(machine_is_omap_perseus2() || machine_is_omap_h4())) {
86 omap_set_gpio_dataout(GPIO_TIMER, 0); 86 gpio_set_value(GPIO_TIMER, 0);
87 omap_set_gpio_dataout(GPIO_IDLE, 0); 87 gpio_set_value(GPIO_IDLE, 0);
88 } 88 }
89 89
90 __raw_writew(~0, &fpga->leds); 90 __raw_writew(~0, &fpga->leds);
@@ -107,7 +107,7 @@ static void h2p2_dbg_leds_event(led_event_t evt)
107 if (machine_is_omap_perseus2() || machine_is_omap_h4()) 107 if (machine_is_omap_perseus2() || machine_is_omap_h4())
108 hw_led_state ^= H2P2_DBG_FPGA_P2_LED_TIMER; 108 hw_led_state ^= H2P2_DBG_FPGA_P2_LED_TIMER;
109 else { 109 else {
110 omap_set_gpio_dataout(GPIO_TIMER, 110 gpio_set_value(GPIO_TIMER,
111 led_state & LED_TIMER_ON); 111 led_state & LED_TIMER_ON);
112 goto done; 112 goto done;
113 } 113 }
@@ -121,7 +121,7 @@ static void h2p2_dbg_leds_event(led_event_t evt)
121 if (machine_is_omap_perseus2() || machine_is_omap_h4()) 121 if (machine_is_omap_perseus2() || machine_is_omap_h4())
122 hw_led_state &= ~H2P2_DBG_FPGA_P2_LED_IDLE; 122 hw_led_state &= ~H2P2_DBG_FPGA_P2_LED_IDLE;
123 else { 123 else {
124 omap_set_gpio_dataout(GPIO_IDLE, 1); 124 gpio_set_value(GPIO_IDLE, 1);
125 goto done; 125 goto done;
126 } 126 }
127 127
@@ -131,7 +131,7 @@ static void h2p2_dbg_leds_event(led_event_t evt)
131 if (machine_is_omap_perseus2() || machine_is_omap_h4()) 131 if (machine_is_omap_perseus2() || machine_is_omap_h4())
132 hw_led_state |= H2P2_DBG_FPGA_P2_LED_IDLE; 132 hw_led_state |= H2P2_DBG_FPGA_P2_LED_IDLE;
133 else { 133 else {
134 omap_set_gpio_dataout(GPIO_IDLE, 0); 134 gpio_set_value(GPIO_IDLE, 0);
135 goto done; 135 goto done;
136 } 136 }
137 137
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index 0cb2b22388e9..ac15c23fd5da 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -192,202 +192,48 @@ void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
192 192
193/*-------------------------------------------------------------------------*/ 193/*-------------------------------------------------------------------------*/
194 194
195#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \ 195#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
196 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) 196 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
197 197
198#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 198#define OMAP_MMC_NR_RES 2
199#define OMAP_MMC1_BASE 0x4809c000
200#define OMAP_MMC1_END (OMAP_MMC1_BASE + 0x1fc)
201#define OMAP_MMC1_INT INT_24XX_MMC_IRQ
202 199
203#define OMAP_MMC2_BASE 0x480b4000 200/*
204#define OMAP_MMC2_END (OMAP_MMC2_BASE + 0x1fc) 201 * Register MMC devices. Called from mach-omap1 and mach-omap2 device init.
205#define OMAP_MMC2_INT INT_24XX_MMC2_IRQ 202 */
206 203int __init omap_mmc_add(int id, unsigned long base, unsigned long size,
207#else 204 unsigned int irq, struct omap_mmc_platform_data *data)
208
209#define OMAP_MMC1_BASE 0xfffb7800
210#define OMAP_MMC1_END (OMAP_MMC1_BASE + 0x7f)
211#define OMAP_MMC1_INT INT_MMC
212
213#define OMAP_MMC2_BASE 0xfffb7c00 /* omap16xx only */
214#define OMAP_MMC2_END (OMAP_MMC2_BASE + 0x7f)
215#define OMAP_MMC2_INT INT_1610_MMC2
216
217#endif
218
219static struct omap_mmc_platform_data mmc1_data;
220
221static u64 mmc1_dmamask = 0xffffffff;
222
223static struct resource mmc1_resources[] = {
224 {
225 .start = OMAP_MMC1_BASE,
226 .end = OMAP_MMC1_END,
227 .flags = IORESOURCE_MEM,
228 },
229 {
230 .start = OMAP_MMC1_INT,
231 .flags = IORESOURCE_IRQ,
232 },
233};
234
235static struct platform_device mmc_omap_device1 = {
236 .name = "mmci-omap",
237 .id = 1,
238 .dev = {
239 .dma_mask = &mmc1_dmamask,
240 .platform_data = &mmc1_data,
241 },
242 .num_resources = ARRAY_SIZE(mmc1_resources),
243 .resource = mmc1_resources,
244};
245
246#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2430) || \
247 defined(CONFIG_ARCH_OMAP34XX)
248
249static struct omap_mmc_platform_data mmc2_data;
250
251static u64 mmc2_dmamask = 0xffffffff;
252
253static struct resource mmc2_resources[] = {
254 {
255 .start = OMAP_MMC2_BASE,
256 .end = OMAP_MMC2_END,
257 .flags = IORESOURCE_MEM,
258 },
259 {
260 .start = OMAP_MMC2_INT,
261 .flags = IORESOURCE_IRQ,
262 },
263};
264
265static struct platform_device mmc_omap_device2 = {
266 .name = "mmci-omap",
267 .id = 2,
268 .dev = {
269 .dma_mask = &mmc2_dmamask,
270 .platform_data = &mmc2_data,
271 },
272 .num_resources = ARRAY_SIZE(mmc2_resources),
273 .resource = mmc2_resources,
274};
275#endif
276
277static inline void omap_init_mmc_conf(const struct omap_mmc_config *mmc_conf)
278{
279 if (cpu_is_omap2430() || cpu_is_omap34xx())
280 return;
281
282 if (mmc_conf->mmc[0].enabled) {
283 if (cpu_is_omap24xx()) {
284 omap_cfg_reg(H18_24XX_MMC_CMD);
285 omap_cfg_reg(H15_24XX_MMC_CLKI);
286 omap_cfg_reg(G19_24XX_MMC_CLKO);
287 omap_cfg_reg(F20_24XX_MMC_DAT0);
288 omap_cfg_reg(F19_24XX_MMC_DAT_DIR0);
289 omap_cfg_reg(G18_24XX_MMC_CMD_DIR);
290 } else {
291 omap_cfg_reg(MMC_CMD);
292 omap_cfg_reg(MMC_CLK);
293 omap_cfg_reg(MMC_DAT0);
294 if (cpu_is_omap1710()) {
295 omap_cfg_reg(M15_1710_MMC_CLKI);
296 omap_cfg_reg(P19_1710_MMC_CMDDIR);
297 omap_cfg_reg(P20_1710_MMC_DATDIR0);
298 }
299 }
300 if (mmc_conf->mmc[0].wire4) {
301 if (cpu_is_omap24xx()) {
302 omap_cfg_reg(H14_24XX_MMC_DAT1);
303 omap_cfg_reg(E19_24XX_MMC_DAT2);
304 omap_cfg_reg(D19_24XX_MMC_DAT3);
305 omap_cfg_reg(E20_24XX_MMC_DAT_DIR1);
306 omap_cfg_reg(F18_24XX_MMC_DAT_DIR2);
307 omap_cfg_reg(E18_24XX_MMC_DAT_DIR3);
308 } else {
309 omap_cfg_reg(MMC_DAT1);
310 /* NOTE: DAT2 can be on W10 (here) or M15 */
311 if (!mmc_conf->mmc[0].nomux)
312 omap_cfg_reg(MMC_DAT2);
313 omap_cfg_reg(MMC_DAT3);
314 }
315 }
316 }
317
318#ifdef CONFIG_ARCH_OMAP16XX
319 /* block 2 is on newer chips, and has many pinout options */
320 if (mmc_conf->mmc[1].enabled) {
321 if (!mmc_conf->mmc[1].nomux) {
322 omap_cfg_reg(Y8_1610_MMC2_CMD);
323 omap_cfg_reg(Y10_1610_MMC2_CLK);
324 omap_cfg_reg(R18_1610_MMC2_CLKIN);
325 omap_cfg_reg(W8_1610_MMC2_DAT0);
326 if (mmc_conf->mmc[1].wire4) {
327 omap_cfg_reg(V8_1610_MMC2_DAT1);
328 omap_cfg_reg(W15_1610_MMC2_DAT2);
329 omap_cfg_reg(R10_1610_MMC2_DAT3);
330 }
331
332 /* These are needed for the level shifter */
333 omap_cfg_reg(V9_1610_MMC2_CMDDIR);
334 omap_cfg_reg(V5_1610_MMC2_DATDIR0);
335 omap_cfg_reg(W19_1610_MMC2_DATDIR1);
336 }
337
338 /* Feedback clock must be set on OMAP-1710 MMC2 */
339 if (cpu_is_omap1710())
340 omap_writel(omap_readl(MOD_CONF_CTRL_1) | (1 << 24),
341 MOD_CONF_CTRL_1);
342 }
343#endif
344}
345
346static void __init omap_init_mmc(void)
347{ 205{
348 const struct omap_mmc_config *mmc_conf; 206 struct platform_device *pdev;
349 207 struct resource res[OMAP_MMC_NR_RES];
350 /* NOTE: assumes MMC was never (wrongly) enabled */ 208 int ret;
351 mmc_conf = omap_get_config(OMAP_TAG_MMC, struct omap_mmc_config); 209
352 if (!mmc_conf) 210 pdev = platform_device_alloc("mmci-omap", id);
353 return; 211 if (!pdev)
354 212 return -ENOMEM;
355 omap_init_mmc_conf(mmc_conf); 213
356 214 memset(res, 0, OMAP_MMC_NR_RES * sizeof(struct resource));
357 if (mmc_conf->mmc[0].enabled) { 215 res[0].start = base;
358 mmc1_data.conf = mmc_conf->mmc[0]; 216 res[0].end = base + size - 1;
359 (void) platform_device_register(&mmc_omap_device1); 217 res[0].flags = IORESOURCE_MEM;
360 } 218 res[1].start = res[1].end = irq;
361 219 res[1].flags = IORESOURCE_IRQ;
362#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2430) || \ 220
363 defined(CONFIG_ARCH_OMAP34XX) 221 ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
364 if (mmc_conf->mmc[1].enabled) { 222 if (ret == 0)
365 mmc2_data.conf = mmc_conf->mmc[1]; 223 ret = platform_device_add_data(pdev, data, sizeof(*data));
366 (void) platform_device_register(&mmc_omap_device2); 224 if (ret)
367 } 225 goto fail;
368#endif 226
369} 227 ret = platform_device_add(pdev);
228 if (ret)
229 goto fail;
230 return 0;
370 231
371void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *info) 232fail:
372{ 233 platform_device_put(pdev);
373 switch (host) { 234 return ret;
374 case 1:
375 mmc1_data = *info;
376 break;
377#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2430) || \
378 defined(CONFIG_ARCH_OMAP34XX)
379 case 2:
380 mmc2_data = *info;
381 break;
382#endif
383 default:
384 BUG();
385 }
386} 235}
387 236
388#else
389static inline void omap_init_mmc(void) {}
390void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *info) {}
391#endif 237#endif
392 238
393/*-------------------------------------------------------------------------*/ 239/*-------------------------------------------------------------------------*/
@@ -532,7 +378,6 @@ static int __init omap_init_devices(void)
532 */ 378 */
533 omap_init_dsp(); 379 omap_init_dsp();
534 omap_init_kp(); 380 omap_init_kp();
535 omap_init_mmc();
536 omap_init_uwire(); 381 omap_init_uwire();
537 omap_init_wdt(); 382 omap_init_wdt();
538 omap_init_rng(); 383 omap_init_rng();
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 50f8b4ad9a09..692d2b495af3 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -29,7 +29,7 @@
29 29
30#include <asm/system.h> 30#include <asm/system.h>
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32#include <asm/dma.h> 32#include <mach/dma.h>
33 33
34#include <mach/tc.h> 34#include <mach/tc.h>
35 35
@@ -1848,9 +1848,22 @@ static int omap2_dma_handle_ch(int ch)
1848 printk(KERN_INFO 1848 printk(KERN_INFO
1849 "DMA synchronization event drop occurred with device " 1849 "DMA synchronization event drop occurred with device "
1850 "%d\n", dma_chan[ch].dev_id); 1850 "%d\n", dma_chan[ch].dev_id);
1851 if (unlikely(status & OMAP2_DMA_TRANS_ERR_IRQ)) 1851 if (unlikely(status & OMAP2_DMA_TRANS_ERR_IRQ)) {
1852 printk(KERN_INFO "DMA transaction error with device %d\n", 1852 printk(KERN_INFO "DMA transaction error with device %d\n",
1853 dma_chan[ch].dev_id); 1853 dma_chan[ch].dev_id);
1854 if (cpu_class_is_omap2()) {
1855 /* Errata: sDMA Channel is not disabled
1856 * after a transaction error. So we explicitely
1857 * disable the channel
1858 */
1859 u32 ccr;
1860
1861 ccr = dma_read(CCR(ch));
1862 ccr &= ~OMAP_DMA_CCR_EN;
1863 dma_write(ccr, CCR(ch));
1864 dma_chan[ch].flags &= ~OMAP_DMA_ACTIVE;
1865 }
1866 }
1854 if (unlikely(status & OMAP2_DMA_SECURE_ERR_IRQ)) 1867 if (unlikely(status & OMAP2_DMA_SECURE_ERR_IRQ))
1855 printk(KERN_INFO "DMA secure error with device %d\n", 1868 printk(KERN_INFO "DMA secure error with device %d\n",
1856 dma_chan[ch].dev_id); 1869 dma_chan[ch].dev_id);
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 963c31cd1541..e4f0ce04ba92 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -539,10 +539,6 @@ void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload,
539 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l); 539 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
540 omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load); 540 omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load);
541 541
542 /* REVISIT: hw feature, ttgr overtaking tldr? */
543 while (readl(timer->io_base + (OMAP_TIMER_WRITE_PEND_REG & 0xff)))
544 cpu_relax();
545
546 omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 0); 542 omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 0);
547} 543}
548 544
@@ -553,14 +549,15 @@ void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
553 u32 l; 549 u32 l;
554 550
555 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG); 551 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
556 if (autoreload) 552 if (autoreload) {
557 l |= OMAP_TIMER_CTRL_AR; 553 l |= OMAP_TIMER_CTRL_AR;
558 else 554 omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load);
555 } else {
559 l &= ~OMAP_TIMER_CTRL_AR; 556 l &= ~OMAP_TIMER_CTRL_AR;
557 }
560 l |= OMAP_TIMER_CTRL_ST; 558 l |= OMAP_TIMER_CTRL_ST;
561 559
562 omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, load); 560 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); 561 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
565} 562}
566 563
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 424049d83fbe..07b6968a7d16 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -152,6 +152,7 @@ struct gpio_bank {
152 u32 level_mask; 152 u32 level_mask;
153 spinlock_t lock; 153 spinlock_t lock;
154 struct gpio_chip chip; 154 struct gpio_chip chip;
155 struct clk *dbck;
155}; 156};
156 157
157#define METHOD_MPUIO 0 158#define METHOD_MPUIO 0
@@ -244,6 +245,8 @@ static inline struct gpio_bank *get_gpio_bank(int gpio)
244 return &gpio_bank[gpio >> 5]; 245 return &gpio_bank[gpio >> 5];
245 if (cpu_is_omap34xx()) 246 if (cpu_is_omap34xx())
246 return &gpio_bank[gpio >> 5]; 247 return &gpio_bank[gpio >> 5];
248 BUG();
249 return NULL;
247} 250}
248 251
249static inline int get_gpio_index(int gpio) 252static inline int get_gpio_index(int gpio)
@@ -332,19 +335,6 @@ static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input)
332 __raw_writel(l, reg); 335 __raw_writel(l, reg);
333} 336}
334 337
335void omap_set_gpio_direction(int gpio, int is_input)
336{
337 struct gpio_bank *bank;
338 unsigned long flags;
339
340 if (check_gpio(gpio) < 0)
341 return;
342 bank = get_gpio_bank(gpio);
343 spin_lock_irqsave(&bank->lock, flags);
344 _set_gpio_direction(bank, get_gpio_index(gpio), is_input);
345 spin_unlock_irqrestore(&bank->lock, flags);
346}
347
348static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable) 338static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
349{ 339{
350 void __iomem *reg = bank->base; 340 void __iomem *reg = bank->base;
@@ -406,20 +396,7 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
406 __raw_writel(l, reg); 396 __raw_writel(l, reg);
407} 397}
408 398
409void omap_set_gpio_dataout(int gpio, int enable) 399static int __omap_get_gpio_datain(int gpio)
410{
411 struct gpio_bank *bank;
412 unsigned long flags;
413
414 if (check_gpio(gpio) < 0)
415 return;
416 bank = get_gpio_bank(gpio);
417 spin_lock_irqsave(&bank->lock, flags);
418 _set_gpio_dataout(bank, get_gpio_index(gpio), enable);
419 spin_unlock_irqrestore(&bank->lock, flags);
420}
421
422int omap_get_gpio_datain(int gpio)
423{ 400{
424 struct gpio_bank *bank; 401 struct gpio_bank *bank;
425 void __iomem *reg; 402 void __iomem *reg;
@@ -473,6 +450,7 @@ void omap_set_gpio_debounce(int gpio, int enable)
473{ 450{
474 struct gpio_bank *bank; 451 struct gpio_bank *bank;
475 void __iomem *reg; 452 void __iomem *reg;
453 unsigned long flags;
476 u32 val, l = 1 << get_gpio_index(gpio); 454 u32 val, l = 1 << get_gpio_index(gpio);
477 455
478 if (cpu_class_is_omap1()) 456 if (cpu_class_is_omap1())
@@ -480,16 +458,28 @@ void omap_set_gpio_debounce(int gpio, int enable)
480 458
481 bank = get_gpio_bank(gpio); 459 bank = get_gpio_bank(gpio);
482 reg = bank->base; 460 reg = bank->base;
483
484 reg += OMAP24XX_GPIO_DEBOUNCE_EN; 461 reg += OMAP24XX_GPIO_DEBOUNCE_EN;
462
463 spin_lock_irqsave(&bank->lock, flags);
485 val = __raw_readl(reg); 464 val = __raw_readl(reg);
486 465
487 if (enable) 466 if (enable && !(val & l))
488 val |= l; 467 val |= l;
489 else 468 else if (!enable && (val & l))
490 val &= ~l; 469 val &= ~l;
470 else
471 goto done;
472
473 if (cpu_is_omap34xx()) {
474 if (enable)
475 clk_enable(bank->dbck);
476 else
477 clk_disable(bank->dbck);
478 }
491 479
492 __raw_writel(val, reg); 480 __raw_writel(val, reg);
481done:
482 spin_unlock_irqrestore(&bank->lock, flags);
493} 483}
494EXPORT_SYMBOL(omap_set_gpio_debounce); 484EXPORT_SYMBOL(omap_set_gpio_debounce);
495 485
@@ -906,26 +896,17 @@ static int gpio_wake_enable(unsigned int irq, unsigned int enable)
906 return retval; 896 return retval;
907} 897}
908 898
909int omap_request_gpio(int gpio) 899static int omap_gpio_request(struct gpio_chip *chip, unsigned offset)
910{ 900{
911 struct gpio_bank *bank; 901 struct gpio_bank *bank = container_of(chip, struct gpio_bank, chip);
912 unsigned long flags; 902 unsigned long flags;
913 int status;
914
915 if (check_gpio(gpio) < 0)
916 return -EINVAL;
917 903
918 status = gpio_request(gpio, NULL);
919 if (status < 0)
920 return status;
921
922 bank = get_gpio_bank(gpio);
923 spin_lock_irqsave(&bank->lock, flags); 904 spin_lock_irqsave(&bank->lock, flags);
924 905
925 /* Set trigger to none. You need to enable the desired trigger with 906 /* Set trigger to none. You need to enable the desired trigger with
926 * request_irq() or set_irq_type(). 907 * request_irq() or set_irq_type().
927 */ 908 */
928 _set_gpio_triggering(bank, get_gpio_index(gpio), IRQ_TYPE_NONE); 909 _set_gpio_triggering(bank, offset, IRQ_TYPE_NONE);
929 910
930#ifdef CONFIG_ARCH_OMAP15XX 911#ifdef CONFIG_ARCH_OMAP15XX
931 if (bank->method == METHOD_GPIO_1510) { 912 if (bank->method == METHOD_GPIO_1510) {
@@ -933,7 +914,7 @@ int omap_request_gpio(int gpio)
933 914
934 /* Claim the pin for MPU */ 915 /* Claim the pin for MPU */
935 reg = bank->base + OMAP1510_GPIO_PIN_CONTROL; 916 reg = bank->base + OMAP1510_GPIO_PIN_CONTROL;
936 __raw_writel(__raw_readl(reg) | (1 << get_gpio_index(gpio)), reg); 917 __raw_writel(__raw_readl(reg) | (1 << offset), reg);
937 } 918 }
938#endif 919#endif
939 spin_unlock_irqrestore(&bank->lock, flags); 920 spin_unlock_irqrestore(&bank->lock, flags);
@@ -941,39 +922,28 @@ int omap_request_gpio(int gpio)
941 return 0; 922 return 0;
942} 923}
943 924
944void omap_free_gpio(int gpio) 925static void omap_gpio_free(struct gpio_chip *chip, unsigned offset)
945{ 926{
946 struct gpio_bank *bank; 927 struct gpio_bank *bank = container_of(chip, struct gpio_bank, chip);
947 unsigned long flags; 928 unsigned long flags;
948 929
949 if (check_gpio(gpio) < 0)
950 return;
951 bank = get_gpio_bank(gpio);
952 spin_lock_irqsave(&bank->lock, flags); 930 spin_lock_irqsave(&bank->lock, flags);
953 if (unlikely(!gpiochip_is_requested(&bank->chip,
954 get_gpio_index(gpio)))) {
955 spin_unlock_irqrestore(&bank->lock, flags);
956 printk(KERN_ERR "omap-gpio: GPIO %d wasn't reserved!\n", gpio);
957 dump_stack();
958 return;
959 }
960#ifdef CONFIG_ARCH_OMAP16XX 931#ifdef CONFIG_ARCH_OMAP16XX
961 if (bank->method == METHOD_GPIO_1610) { 932 if (bank->method == METHOD_GPIO_1610) {
962 /* Disable wake-up during idle for dynamic tick */ 933 /* Disable wake-up during idle for dynamic tick */
963 void __iomem *reg = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA; 934 void __iomem *reg = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA;
964 __raw_writel(1 << get_gpio_index(gpio), reg); 935 __raw_writel(1 << offset, reg);
965 } 936 }
966#endif 937#endif
967#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 938#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
968 if (bank->method == METHOD_GPIO_24XX) { 939 if (bank->method == METHOD_GPIO_24XX) {
969 /* Disable wake-up during idle for dynamic tick */ 940 /* Disable wake-up during idle for dynamic tick */
970 void __iomem *reg = bank->base + OMAP24XX_GPIO_CLEARWKUENA; 941 void __iomem *reg = bank->base + OMAP24XX_GPIO_CLEARWKUENA;
971 __raw_writel(1 << get_gpio_index(gpio), reg); 942 __raw_writel(1 << offset, reg);
972 } 943 }
973#endif 944#endif
974 _reset_gpio(bank, gpio); 945 _reset_gpio(bank, bank->chip.base + offset);
975 spin_unlock_irqrestore(&bank->lock, flags); 946 spin_unlock_irqrestore(&bank->lock, flags);
976 gpio_free(gpio);
977} 947}
978 948
979/* 949/*
@@ -1252,7 +1222,7 @@ static int gpio_input(struct gpio_chip *chip, unsigned offset)
1252 1222
1253static int gpio_get(struct gpio_chip *chip, unsigned offset) 1223static int gpio_get(struct gpio_chip *chip, unsigned offset)
1254{ 1224{
1255 return omap_get_gpio_datain(chip->base + offset); 1225 return __omap_get_gpio_datain(chip->base + offset);
1256} 1226}
1257 1227
1258static int gpio_output(struct gpio_chip *chip, unsigned offset, int value) 1228static int gpio_output(struct gpio_chip *chip, unsigned offset, int value)
@@ -1279,6 +1249,14 @@ static void gpio_set(struct gpio_chip *chip, unsigned offset, int value)
1279 spin_unlock_irqrestore(&bank->lock, flags); 1249 spin_unlock_irqrestore(&bank->lock, flags);
1280} 1250}
1281 1251
1252static int gpio_2irq(struct gpio_chip *chip, unsigned offset)
1253{
1254 struct gpio_bank *bank;
1255
1256 bank = container_of(chip, struct gpio_bank, chip);
1257 return bank->virtual_irq_start + offset;
1258}
1259
1282/*---------------------------------------------------------------------*/ 1260/*---------------------------------------------------------------------*/
1283 1261
1284static int initialized; 1262static int initialized;
@@ -1296,7 +1274,6 @@ static struct clk * gpio5_fck;
1296#endif 1274#endif
1297 1275
1298#if defined(CONFIG_ARCH_OMAP3) 1276#if defined(CONFIG_ARCH_OMAP3)
1299static struct clk *gpio_fclks[OMAP34XX_NR_GPIOS];
1300static struct clk *gpio_iclks[OMAP34XX_NR_GPIOS]; 1277static struct clk *gpio_iclks[OMAP34XX_NR_GPIOS];
1301#endif 1278#endif
1302 1279
@@ -1310,9 +1287,7 @@ static int __init _omap_gpio_init(void)
1310 int i; 1287 int i;
1311 int gpio = 0; 1288 int gpio = 0;
1312 struct gpio_bank *bank; 1289 struct gpio_bank *bank;
1313#if defined(CONFIG_ARCH_OMAP3)
1314 char clk_name[11]; 1290 char clk_name[11];
1315#endif
1316 1291
1317 initialized = 1; 1292 initialized = 1;
1318 1293
@@ -1367,12 +1342,6 @@ static int __init _omap_gpio_init(void)
1367 printk(KERN_ERR "Could not get %s\n", clk_name); 1342 printk(KERN_ERR "Could not get %s\n", clk_name);
1368 else 1343 else
1369 clk_enable(gpio_iclks[i]); 1344 clk_enable(gpio_iclks[i]);
1370 sprintf(clk_name, "gpio%d_fck", i + 1);
1371 gpio_fclks[i] = clk_get(NULL, clk_name);
1372 if (IS_ERR(gpio_fclks[i]))
1373 printk(KERN_ERR "Could not get %s\n", clk_name);
1374 else
1375 clk_enable(gpio_fclks[i]);
1376 } 1345 }
1377 } 1346 }
1378#endif 1347#endif
@@ -1479,10 +1448,13 @@ static int __init _omap_gpio_init(void)
1479 /* REVISIT eventually switch from OMAP-specific gpio structs 1448 /* REVISIT eventually switch from OMAP-specific gpio structs
1480 * over to the generic ones 1449 * over to the generic ones
1481 */ 1450 */
1451 bank->chip.request = omap_gpio_request;
1452 bank->chip.free = omap_gpio_free;
1482 bank->chip.direction_input = gpio_input; 1453 bank->chip.direction_input = gpio_input;
1483 bank->chip.get = gpio_get; 1454 bank->chip.get = gpio_get;
1484 bank->chip.direction_output = gpio_output; 1455 bank->chip.direction_output = gpio_output;
1485 bank->chip.set = gpio_set; 1456 bank->chip.set = gpio_set;
1457 bank->chip.to_irq = gpio_2irq;
1486 if (bank_is_mpuio(bank)) { 1458 if (bank_is_mpuio(bank)) {
1487 bank->chip.label = "mpuio"; 1459 bank->chip.label = "mpuio";
1488#ifdef CONFIG_ARCH_OMAP16XX 1460#ifdef CONFIG_ARCH_OMAP16XX
@@ -1511,6 +1483,13 @@ static int __init _omap_gpio_init(void)
1511 } 1483 }
1512 set_irq_chained_handler(bank->irq, gpio_irq_handler); 1484 set_irq_chained_handler(bank->irq, gpio_irq_handler);
1513 set_irq_data(bank->irq, bank); 1485 set_irq_data(bank->irq, bank);
1486
1487 if (cpu_is_omap34xx()) {
1488 sprintf(clk_name, "gpio%d_dbck", i + 1);
1489 bank->dbck = clk_get(NULL, clk_name);
1490 if (IS_ERR(bank->dbck))
1491 printk(KERN_ERR "Could not get %s\n", clk_name);
1492 }
1514 } 1493 }
1515 1494
1516 /* Enable system clock for GPIO module. 1495 /* Enable system clock for GPIO module.
@@ -1739,12 +1718,6 @@ static int __init omap_gpio_sysinit(void)
1739 return ret; 1718 return ret;
1740} 1719}
1741 1720
1742EXPORT_SYMBOL(omap_request_gpio);
1743EXPORT_SYMBOL(omap_free_gpio);
1744EXPORT_SYMBOL(omap_set_gpio_direction);
1745EXPORT_SYMBOL(omap_set_gpio_dataout);
1746EXPORT_SYMBOL(omap_get_gpio_datain);
1747
1748arch_initcall(omap_gpio_sysinit); 1721arch_initcall(omap_gpio_sysinit);
1749 1722
1750 1723
@@ -1801,14 +1774,14 @@ static int dbg_gpio_show(struct seq_file *s, void *unused)
1801 continue; 1774 continue;
1802 1775
1803 irq = bank->virtual_irq_start + j; 1776 irq = bank->virtual_irq_start + j;
1804 value = omap_get_gpio_datain(gpio); 1777 value = gpio_get_value(gpio);
1805 is_in = gpio_is_input(bank, mask); 1778 is_in = gpio_is_input(bank, mask);
1806 1779
1807 if (bank_is_mpuio(bank)) 1780 if (bank_is_mpuio(bank))
1808 seq_printf(s, "MPUIO %2d ", j); 1781 seq_printf(s, "MPUIO %2d ", j);
1809 else 1782 else
1810 seq_printf(s, "GPIO %3d ", gpio); 1783 seq_printf(s, "GPIO %3d ", gpio);
1811 seq_printf(s, "(%10s): %s %s", 1784 seq_printf(s, "(%-20.20s): %s %s",
1812 label, 1785 label,
1813 is_in ? "in " : "out", 1786 is_in ? "in " : "out",
1814 value ? "hi" : "lo"); 1787 value ? "hi" : "lo");
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index 0e6d147ab6f8..89a6ab0b7db8 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -79,26 +79,43 @@ static struct platform_device omap_i2c_devices[] = {
79#endif 79#endif
80}; 80};
81 81
82static void __init omap_i2c_mux_pins(int bus_id) 82#if defined(CONFIG_ARCH_OMAP24XX)
83static const int omap24xx_pins[][2] = {
84 { M19_24XX_I2C1_SCL, L15_24XX_I2C1_SDA },
85 { J15_24XX_I2C2_SCL, H19_24XX_I2C2_SDA },
86};
87#else
88static const int omap24xx_pins[][2] = {};
89#endif
90#if defined(CONFIG_ARCH_OMAP34XX)
91static const int omap34xx_pins[][2] = {
92 { K21_34XX_I2C1_SCL, J21_34XX_I2C1_SDA},
93 { AF15_34XX_I2C2_SCL, AE15_34XX_I2C2_SDA},
94 { AF14_34XX_I2C3_SCL, AG14_34XX_I2C3_SDA},
95};
96#else
97static const int omap34xx_pins[][2] = {};
98#endif
99
100static void __init omap_i2c_mux_pins(int bus)
83{ 101{
84 /* TODO: Muxing for OMAP3 */ 102 int scl, sda;
85 switch (bus_id) { 103
86 case 1: 104 if (cpu_class_is_omap1()) {
87 if (cpu_class_is_omap1()) { 105 scl = I2C_SCL;
88 omap_cfg_reg(I2C_SCL); 106 sda = I2C_SDA;
89 omap_cfg_reg(I2C_SDA); 107 } else if (cpu_is_omap24xx()) {
90 } else if (cpu_is_omap24xx()) { 108 scl = omap24xx_pins[bus][0];
91 omap_cfg_reg(M19_24XX_I2C1_SCL); 109 sda = omap24xx_pins[bus][1];
92 omap_cfg_reg(L15_24XX_I2C1_SDA); 110 } else if (cpu_is_omap34xx()) {
93 } 111 scl = omap34xx_pins[bus][0];
94 break; 112 sda = omap34xx_pins[bus][1];
95 case 2: 113 } else {
96 if (cpu_is_omap24xx()) { 114 return;
97 omap_cfg_reg(J15_24XX_I2C2_SCL);
98 omap_cfg_reg(H19_24XX_I2C2_SDA);
99 }
100 break;
101 } 115 }
116
117 omap_cfg_reg(sda);
118 omap_cfg_reg(scl);
102} 119}
103 120
104int __init omap_register_i2c_bus(int bus_id, u32 clkrate, 121int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
@@ -142,6 +159,6 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
142 res[1].start = irq; 159 res[1].start = irq;
143 } 160 }
144 161
145 omap_i2c_mux_pins(bus_id); 162 omap_i2c_mux_pins(bus_id - 1);
146 return platform_device_register(pdev); 163 return platform_device_register(pdev);
147} 164}
diff --git a/arch/arm/plat-omap/include/mach/board-apollon.h b/arch/arm/plat-omap/include/mach/board-apollon.h
index 731c858cf3fe..61bd5e8f09b1 100644
--- a/arch/arm/plat-omap/include/mach/board-apollon.h
+++ b/arch/arm/plat-omap/include/mach/board-apollon.h
@@ -29,12 +29,14 @@
29#ifndef __ASM_ARCH_OMAP_APOLLON_H 29#ifndef __ASM_ARCH_OMAP_APOLLON_H
30#define __ASM_ARCH_OMAP_APOLLON_H 30#define __ASM_ARCH_OMAP_APOLLON_H
31 31
32#include <mach/cpu.h>
33
32extern void apollon_mmc_init(void); 34extern void apollon_mmc_init(void);
33 35
34static inline int apollon_plus(void) 36static inline int apollon_plus(void)
35{ 37{
36 /* The apollon plus has IDCODE revision 5 */ 38 /* The apollon plus has IDCODE revision 5 */
37 return system_rev & 0xc0; 39 return omap_rev() & 0xc0;
38} 40}
39 41
40/* Placeholder for APOLLON specific defines */ 42/* Placeholder for APOLLON specific defines */
diff --git a/arch/arm/plat-omap/include/mach/board-h2.h b/arch/arm/plat-omap/include/mach/board-h2.h
index 2a050e9be65f..15531c8dc0e6 100644
--- a/arch/arm/plat-omap/include/mach/board-h2.h
+++ b/arch/arm/plat-omap/include/mach/board-h2.h
@@ -29,13 +29,13 @@
29#ifndef __ASM_ARCH_OMAP_H2_H 29#ifndef __ASM_ARCH_OMAP_H2_H
30#define __ASM_ARCH_OMAP_H2_H 30#define __ASM_ARCH_OMAP_H2_H
31 31
32/* Placeholder for H2 specific defines */
33
34/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */ 32/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
35#define OMAP1610_ETHR_START 0x04000300 33#define OMAP1610_ETHR_START 0x04000300
36 34
35#define H2_TPS_GPIO_BASE (OMAP_MAX_GPIO_LINES + 16 /* MPUIO */)
36# define H2_TPS_GPIO_MMC_PWR_EN (H2_TPS_GPIO_BASE + 3)
37
37extern void h2_mmc_init(void); 38extern void h2_mmc_init(void);
38extern void h2_mmc_slot_cover_handler(void *arg, int state);
39 39
40#endif /* __ASM_ARCH_OMAP_H2_H */ 40#endif /* __ASM_ARCH_OMAP_H2_H */
41 41
diff --git a/arch/arm/plat-omap/include/mach/board-ldp.h b/arch/arm/plat-omap/include/mach/board-ldp.h
index 66e2746c04ca..f23399665212 100644
--- a/arch/arm/plat-omap/include/mach/board-ldp.h
+++ b/arch/arm/plat-omap/include/mach/board-ldp.h
@@ -32,5 +32,8 @@
32extern void twl4030_bci_battery_init(void); 32extern void twl4030_bci_battery_init(void);
33 33
34#define TWL4030_IRQNUM INT_34XX_SYS_NIRQ 34#define TWL4030_IRQNUM INT_34XX_SYS_NIRQ
35 35#define LDP_SMC911X_CS 1
36#define LDP_SMC911X_GPIO 152
37#define DEBUG_BASE 0x08000000
38#define OMAP34XX_ETHR_START DEBUG_BASE
36#endif /* __ASM_ARCH_OMAP_LDP_H */ 39#endif /* __ASM_ARCH_OMAP_LDP_H */
diff --git a/arch/arm/plat-omap/include/mach/board.h b/arch/arm/plat-omap/include/mach/board.h
index c23c12ccb353..9466772fc7c8 100644
--- a/arch/arm/plat-omap/include/mach/board.h
+++ b/arch/arm/plat-omap/include/mach/board.h
@@ -16,7 +16,6 @@
16 16
17/* Different peripheral ids */ 17/* Different peripheral ids */
18#define OMAP_TAG_CLOCK 0x4f01 18#define OMAP_TAG_CLOCK 0x4f01
19#define OMAP_TAG_MMC 0x4f02
20#define OMAP_TAG_SERIAL_CONSOLE 0x4f03 19#define OMAP_TAG_SERIAL_CONSOLE 0x4f03
21#define OMAP_TAG_USB 0x4f04 20#define OMAP_TAG_USB 0x4f04
22#define OMAP_TAG_LCD 0x4f05 21#define OMAP_TAG_LCD 0x4f05
@@ -35,27 +34,6 @@ struct omap_clock_config {
35 u8 system_clock_type; 34 u8 system_clock_type;
36}; 35};
37 36
38struct omap_mmc_conf {
39 unsigned enabled:1;
40 /* nomux means "standard" muxing is wrong on this board, and that
41 * board-specific code handled it before common init logic.
42 */
43 unsigned nomux:1;
44 /* switch pin can be for card detect (default) or card cover */
45 unsigned cover:1;
46 /* 4 wire signaling is optional, and is only used for SD/SDIO */
47 unsigned wire4:1;
48 /* use the internal clock */
49 unsigned internal_clock:1;
50 s16 power_pin;
51 s16 switch_pin;
52 s16 wp_pin;
53};
54
55struct omap_mmc_config {
56 struct omap_mmc_conf mmc[2];
57};
58
59struct omap_serial_console_config { 37struct omap_serial_console_config {
60 u8 console_uart; 38 u8 console_uart;
61 u32 console_speed; 39 u32 console_speed;
diff --git a/arch/arm/plat-omap/include/mach/control.h b/arch/arm/plat-omap/include/mach/control.h
index dc9886760577..269147f3836f 100644
--- a/arch/arm/plat-omap/include/mach/control.h
+++ b/arch/arm/plat-omap/include/mach/control.h
@@ -74,6 +74,7 @@
74#define OMAP243X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190) 74#define OMAP243X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190)
75#define OMAP243X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194) 75#define OMAP243X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194)
76#define OMAP243X_CONTROL_IVA2_GEMCFG (OMAP2_CONTROL_GENERAL + 0x0198) 76#define OMAP243X_CONTROL_IVA2_GEMCFG (OMAP2_CONTROL_GENERAL + 0x0198)
77#define OMAP243X_CONTROL_PBIAS_LITE (OMAP2_CONTROL_GENERAL + 0x0230)
77 78
78/* 24xx-only CONTROL_GENERAL register offsets */ 79/* 24xx-only CONTROL_GENERAL register offsets */
79#define OMAP24XX_CONTROL_DEBOBS (OMAP2_CONTROL_GENERAL + 0x0000) 80#define OMAP24XX_CONTROL_DEBOBS (OMAP2_CONTROL_GENERAL + 0x0000)
@@ -140,6 +141,7 @@
140#define OMAP343X_CONTROL_TEST_KEY_13 (OMAP2_CONTROL_GENERAL + 0x00fc) 141#define OMAP343X_CONTROL_TEST_KEY_13 (OMAP2_CONTROL_GENERAL + 0x00fc)
141#define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190) 142#define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190)
142#define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194) 143#define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194)
144#define OMAP343X_CONTROL_PBIAS_LITE (OMAP2_CONTROL_GENERAL + 0x02b0)
143#define OMAP343X_CONTROL_TEMP_SENSOR (OMAP2_CONTROL_GENERAL + 0x02b4) 145#define OMAP343X_CONTROL_TEMP_SENSOR (OMAP2_CONTROL_GENERAL + 0x02b4)
144 146
145/* 147/*
@@ -154,11 +156,14 @@
154 * and the security mode (secure, non-secure, don't care) 156 * and the security mode (secure, non-secure, don't care)
155 */ 157 */
156/* CONTROL_DEVCONF0 bits */ 158/* CONTROL_DEVCONF0 bits */
159#define OMAP2_MMCSDIO1ADPCLKISEL (1 << 24) /* MMC1 loop back clock */
157#define OMAP24XX_USBSTANDBYCTRL (1 << 15) 160#define OMAP24XX_USBSTANDBYCTRL (1 << 15)
158#define OMAP2_MCBSP2_CLKS_MASK (1 << 6) 161#define OMAP2_MCBSP2_CLKS_MASK (1 << 6)
159#define OMAP2_MCBSP1_CLKS_MASK (1 << 2) 162#define OMAP2_MCBSP1_CLKS_MASK (1 << 2)
160 163
161/* CONTROL_DEVCONF1 bits */ 164/* CONTROL_DEVCONF1 bits */
165#define OMAP243X_MMC1_ACTIVE_OVERWRITE (1 << 31)
166#define OMAP2_MMCSDIO2ADPCLKISEL (1 << 6) /* MMC2 loop back clock */
162#define OMAP2_MCBSP5_CLKS_MASK (1 << 4) /* > 242x */ 167#define OMAP2_MCBSP5_CLKS_MASK (1 << 4) /* > 242x */
163#define OMAP2_MCBSP4_CLKS_MASK (1 << 2) /* > 242x */ 168#define OMAP2_MCBSP4_CLKS_MASK (1 << 2) /* > 242x */
164#define OMAP2_MCBSP3_CLKS_MASK (1 << 0) /* > 242x */ 169#define OMAP2_MCBSP3_CLKS_MASK (1 << 0) /* > 242x */
@@ -172,6 +177,18 @@
172#define OMAP2_SYSBOOT_1_MASK (1 << 1) 177#define OMAP2_SYSBOOT_1_MASK (1 << 1)
173#define OMAP2_SYSBOOT_0_MASK (1 << 0) 178#define OMAP2_SYSBOOT_0_MASK (1 << 0)
174 179
180/* CONTROL_PBIAS_LITE bits */
181#define OMAP343X_PBIASLITESUPPLY_HIGH1 (1 << 15)
182#define OMAP343X_PBIASLITEVMODEERROR1 (1 << 11)
183#define OMAP343X_PBIASSPEEDCTRL1 (1 << 10)
184#define OMAP343X_PBIASLITEPWRDNZ1 (1 << 9)
185#define OMAP343X_PBIASLITEVMODE1 (1 << 8)
186#define OMAP343X_PBIASLITESUPPLY_HIGH0 (1 << 7)
187#define OMAP343X_PBIASLITEVMODEERROR0 (1 << 3)
188#define OMAP2_PBIASSPEEDCTRL0 (1 << 2)
189#define OMAP2_PBIASLITEPWRDNZ0 (1 << 1)
190#define OMAP2_PBIASLITEVMODE0 (1 << 0)
191
175#ifndef __ASSEMBLY__ 192#ifndef __ASSEMBLY__
176#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) 193#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
177extern void __iomem *omap_ctrl_base_get(void); 194extern void __iomem *omap_ctrl_base_get(void);
diff --git a/arch/arm/plat-omap/include/mach/cpu.h b/arch/arm/plat-omap/include/mach/cpu.h
index e0464187209d..b2062f1175de 100644
--- a/arch/arm/plat-omap/include/mach/cpu.h
+++ b/arch/arm/plat-omap/include/mach/cpu.h
@@ -28,13 +28,18 @@
28 28
29struct omap_chip_id { 29struct omap_chip_id {
30 u8 oc; 30 u8 oc;
31 u8 type;
31}; 32};
32 33
33#define OMAP_CHIP_INIT(x) { .oc = x } 34#define OMAP_CHIP_INIT(x) { .oc = x }
34 35
35extern unsigned int system_rev; 36/*
36 37 * omap_rev bits:
37#define omap2_cpu_rev() ((system_rev >> 12) & 0x0f) 38 * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
39 * CPU revision (See _REV_ defined in cpu.h) [15:08]
40 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
41 */
42unsigned int omap_rev(void);
38 43
39/* 44/*
40 * Test if multicore OMAP support is needed 45 * Test if multicore OMAP support is needed
@@ -108,7 +113,7 @@ extern unsigned int system_rev;
108 * cpu_is_omap243x(): True for OMAP2430 113 * cpu_is_omap243x(): True for OMAP2430
109 * cpu_is_omap343x(): True for OMAP3430 114 * cpu_is_omap343x(): True for OMAP3430
110 */ 115 */
111#define GET_OMAP_CLASS ((system_rev >> 24) & 0xff) 116#define GET_OMAP_CLASS (omap_rev() & 0xff)
112 117
113#define IS_OMAP_CLASS(class, id) \ 118#define IS_OMAP_CLASS(class, id) \
114static inline int is_omap ##class (void) \ 119static inline int is_omap ##class (void) \
@@ -116,7 +121,7 @@ static inline int is_omap ##class (void) \
116 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \ 121 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
117} 122}
118 123
119#define GET_OMAP_SUBCLASS ((system_rev >> 20) & 0x0fff) 124#define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
120 125
121#define IS_OMAP_SUBCLASS(subclass, id) \ 126#define IS_OMAP_SUBCLASS(subclass, id) \
122static inline int is_omap ##subclass (void) \ 127static inline int is_omap ##subclass (void) \
@@ -226,7 +231,7 @@ IS_OMAP_SUBCLASS(343x, 0x343)
226 * cpu_is_omap2430(): True for OMAP2430 231 * cpu_is_omap2430(): True for OMAP2430
227 * cpu_is_omap3430(): True for OMAP3430 232 * cpu_is_omap3430(): True for OMAP3430
228 */ 233 */
229#define GET_OMAP_TYPE ((system_rev >> 16) & 0xffff) 234#define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
230 235
231#define IS_OMAP_TYPE(type, id) \ 236#define IS_OMAP_TYPE(type, id) \
232static inline int is_omap ##type (void) \ 237static inline int is_omap ##type (void) \
@@ -320,44 +325,20 @@ IS_OMAP_TYPE(3430, 0x3430)
320#define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx()) 325#define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx())
321 326
322#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) 327#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
323/*
324 * Macros to detect silicon revision of OMAP2/3 processors.
325 * is_sil_rev_greater_than: true if passed cpu type & its rev is greater.
326 * is_sil_rev_lesser_than: true if passed cpu type & its rev is lesser.
327 * is_sil_rev_equal_to: true if passed cpu type & its rev is equal.
328 * get_sil_rev: return the silicon rev value.
329 */
330#define get_sil_omap_type(rev) ((rev & 0xffff0000) >> 16)
331#define get_sil_revision(rev) ((rev & 0x0000f000) >> 12)
332 328
333#define is_sil_rev_greater_than(rev) \ 329/* Various silicon revisions for omap2 */
334 ((get_sil_omap_type(system_rev) == get_sil_omap_type(rev)) && \ 330#define OMAP242X_CLASS 0x24200024
335 (get_sil_revision(system_rev) > get_sil_revision(rev))) 331#define OMAP2420_REV_ES1_0 0x24200024
332#define OMAP2420_REV_ES2_0 0x24201024
336 333
337#define is_sil_rev_less_than(rev) \ 334#define OMAP243X_CLASS 0x24300024
338 ((get_sil_omap_type(system_rev) == get_sil_omap_type(rev)) && \ 335#define OMAP2430_REV_ES1_0 0x24300024
339 (get_sil_revision(system_rev) < get_sil_revision(rev)))
340 336
341#define is_sil_rev_equal_to(rev) \ 337#define OMAP343X_CLASS 0x34300034
342 ((get_sil_omap_type(system_rev) == get_sil_omap_type(rev)) && \ 338#define OMAP3430_REV_ES1_0 0x34300034
343 (get_sil_revision(system_rev) == get_sil_revision(rev))) 339#define OMAP3430_REV_ES2_0 0x34301034
344 340#define OMAP3430_REV_ES2_1 0x34302034
345#define get_sil_rev() \ 341#define OMAP3430_REV_ES3_0 0x34303034
346 get_sil_revision(system_rev)
347
348/* Various silicon macros defined here */
349#define OMAP242X_CLASS 0x24200000
350#define OMAP2420_REV_ES1_0 0x24200000
351#define OMAP2420_REV_ES2_0 0x24201000
352
353#define OMAP243X_CLASS 0x24300000
354#define OMAP2430_REV_ES1_0 0x24300000
355
356#define OMAP343X_CLASS 0x34300000
357#define OMAP3430_REV_ES1_0 0x34300000
358#define OMAP3430_REV_ES2_0 0x34301000
359#define OMAP3430_REV_ES2_1 0x34302000
360#define OMAP3430_REV_ES2_2 0x34303000
361 342
362/* 343/*
363 * omap_chip bits 344 * omap_chip bits
@@ -382,23 +363,16 @@ IS_OMAP_TYPE(3430, 0x3430)
382#define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430) 363#define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430)
383 364
384int omap_chip_is(struct omap_chip_id oci); 365int omap_chip_is(struct omap_chip_id oci);
385 366int omap_type(void);
386 367
387/* 368/*
388 * Macro to detect device type i.e. EMU/HS/TST/GP/BAD 369 * Macro to detect device type i.e. EMU/HS/TST/GP/BAD
389 */ 370 */
390#define DEVICE_TYPE_TEST 0 371#define OMAP2_DEVICE_TYPE_TEST 0
391#define DEVICE_TYPE_EMU 1 372#define OMAP2_DEVICE_TYPE_EMU 1
392#define DEVICE_TYPE_SEC 2 373#define OMAP2_DEVICE_TYPE_SEC 2
393#define DEVICE_TYPE_GP 3 374#define OMAP2_DEVICE_TYPE_GP 3
394#define DEVICE_TYPE_BAD 4 375#define OMAP2_DEVICE_TYPE_BAD 4
395
396#define get_device_type() ((system_rev & 0x700) >> 8)
397#define is_device_type_test() (get_device_type() == DEVICE_TYPE_TEST)
398#define is_device_type_emu() (get_device_type() == DEVICE_TYPE_EMU)
399#define is_device_type_sec() (get_device_type() == DEVICE_TYPE_SEC)
400#define is_device_type_gp() (get_device_type() == DEVICE_TYPE_GP)
401#define is_device_type_bad() (get_device_type() == DEVICE_TYPE_BAD)
402 376
403void omap2_check_revision(void); 377void omap2_check_revision(void);
404 378
diff --git a/arch/arm/plat-omap/include/mach/gpio.h b/arch/arm/plat-omap/include/mach/gpio.h
index 98e9008b7e9d..04e68e88f134 100644
--- a/arch/arm/plat-omap/include/mach/gpio.h
+++ b/arch/arm/plat-omap/include/mach/gpio.h
@@ -71,11 +71,6 @@
71 IH_GPIO_BASE + (nr)) 71 IH_GPIO_BASE + (nr))
72 72
73extern int omap_gpio_init(void); /* Call from board init only */ 73extern int omap_gpio_init(void); /* Call from board init only */
74extern int omap_request_gpio(int gpio);
75extern void omap_free_gpio(int gpio);
76extern void omap_set_gpio_direction(int gpio, int is_input);
77extern void omap_set_gpio_dataout(int gpio, int enable);
78extern int omap_get_gpio_datain(int gpio);
79extern void omap2_gpio_prepare_for_retention(void); 74extern void omap2_gpio_prepare_for_retention(void);
80extern void omap2_gpio_resume_after_retention(void); 75extern void omap2_gpio_resume_after_retention(void);
81extern void omap_set_gpio_debounce(int gpio, int enable); 76extern void omap_set_gpio_debounce(int gpio, int enable);
@@ -92,6 +87,16 @@ extern void omap_set_gpio_debounce_time(int gpio, int enable);
92#include <linux/errno.h> 87#include <linux/errno.h>
93#include <asm-generic/gpio.h> 88#include <asm-generic/gpio.h>
94 89
90static inline int omap_request_gpio(int gpio)
91{
92 return gpio_request(gpio, "FIXME");
93}
94
95static inline void omap_free_gpio(int gpio)
96{
97 gpio_free(gpio);
98}
99
95static inline int gpio_get_value(unsigned gpio) 100static inline int gpio_get_value(unsigned gpio)
96{ 101{
97 return __gpio_get_value(gpio); 102 return __gpio_get_value(gpio);
@@ -109,16 +114,24 @@ static inline int gpio_cansleep(unsigned gpio)
109 114
110static inline int gpio_to_irq(unsigned gpio) 115static inline int gpio_to_irq(unsigned gpio)
111{ 116{
112 if (gpio < (OMAP_MAX_GPIO_LINES + 16)) 117 return __gpio_to_irq(gpio);
113 return OMAP_GPIO_IRQ(gpio);
114 return -EINVAL;
115} 118}
116 119
117static inline int irq_to_gpio(unsigned irq) 120static inline int irq_to_gpio(unsigned irq)
118{ 121{
122 int tmp;
123
124 /* omap1 SOC mpuio */
119 if (cpu_class_is_omap1() && (irq < (IH_MPUIO_BASE + 16))) 125 if (cpu_class_is_omap1() && (irq < (IH_MPUIO_BASE + 16)))
120 return (irq - IH_MPUIO_BASE) + OMAP_MAX_GPIO_LINES; 126 return (irq - IH_MPUIO_BASE) + OMAP_MAX_GPIO_LINES;
121 return irq - IH_GPIO_BASE; 127
128 /* SOC gpio */
129 tmp = irq - IH_GPIO_BASE;
130 if (tmp < OMAP_MAX_GPIO_LINES)
131 return tmp;
132
133 /* we don't supply reverse mappings for non-SOC gpios */
134 return -EIO;
122} 135}
123 136
124#endif 137#endif
diff --git a/arch/arm/plat-omap/include/mach/io.h b/arch/arm/plat-omap/include/mach/io.h
index adc83b7b8205..d92bf7964481 100644
--- a/arch/arm/plat-omap/include/mach/io.h
+++ b/arch/arm/plat-omap/include/mach/io.h
@@ -42,8 +42,8 @@
42 * We don't actually have real ISA nor PCI buses, but there is so many 42 * We don't actually have real ISA nor PCI buses, but there is so many
43 * drivers out there that might just work if we fake them... 43 * drivers out there that might just work if we fake them...
44 */ 44 */
45#define __io(a) ((void __iomem *)(PCIO_BASE + (a))) 45#define __io(a) __typesafe_io(a)
46#define __mem_pci(a) (a) 46#define __mem_pci(a) (a)
47 47
48/* 48/*
49 * ---------------------------------------------------------------------------- 49 * ----------------------------------------------------------------------------
@@ -51,8 +51,6 @@
51 * ---------------------------------------------------------------------------- 51 * ----------------------------------------------------------------------------
52 */ 52 */
53 53
54#define PCIO_BASE 0
55
56#if defined(CONFIG_ARCH_OMAP1) 54#if defined(CONFIG_ARCH_OMAP1)
57 55
58#define IO_PHYS 0xFFFB0000 56#define IO_PHYS 0xFFFB0000
diff --git a/arch/arm/plat-omap/include/mach/memory.h b/arch/arm/plat-omap/include/mach/memory.h
index d40cac60b959..d6b5ca6c7da2 100644
--- a/arch/arm/plat-omap/include/mach/memory.h
+++ b/arch/arm/plat-omap/include/mach/memory.h
@@ -43,18 +43,7 @@
43#endif 43#endif
44 44
45/* 45/*
46 * Conversion between SDRAM and fake PCI bus, used by USB
47 * NOTE: Physical address must be converted to Local Bus address
48 * on OMAP-1510 only
49 */
50
51/*
52 * Bus address is physical address, except for OMAP-1510 Local Bus. 46 * Bus address is physical address, except for OMAP-1510 Local Bus.
53 */
54#define __virt_to_bus(x) __virt_to_phys(x)
55#define __bus_to_virt(x) __phys_to_virt(x)
56
57/*
58 * OMAP-1510 bus address is translated into a Local Bus address if the 47 * OMAP-1510 bus address is translated into a Local Bus address if the
59 * OMAP bus type is lbus. We do the address translation based on the 48 * OMAP bus type is lbus. We do the address translation based on the
60 * device overriding the defaults used in the dma-mapping API. 49 * device overriding the defaults used in the dma-mapping API.
@@ -70,20 +59,20 @@
70 59
71#define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET) 60#define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET)
72#define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET) 61#define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET)
73#define is_lbus_device(dev) (cpu_is_omap15xx() && dev && (strncmp(dev->bus_id, "ohci", 4) == 0)) 62#define is_lbus_device(dev) (cpu_is_omap15xx() && dev && (strncmp(dev_name(dev), "ohci", 4) == 0))
74 63
75#define __arch_page_to_dma(dev, page) ({is_lbus_device(dev) ? \ 64#define __arch_page_to_dma(dev, page) ({is_lbus_device(dev) ? \
76 (dma_addr_t)virt_to_lbus(page_address(page)) : \ 65 (dma_addr_t)virt_to_lbus(page_address(page)) : \
77 (dma_addr_t)__virt_to_bus(page_address(page));}) 66 (dma_addr_t)__virt_to_phys(page_address(page));})
78 67
79#define __arch_dma_to_virt(dev, addr) ({ (void *) (is_lbus_device(dev) ? \ 68#define __arch_dma_to_virt(dev, addr) ({ (void *) (is_lbus_device(dev) ? \
80 lbus_to_virt(addr) : \ 69 lbus_to_virt(addr) : \
81 __bus_to_virt(addr)); }) 70 __phys_to_virt(addr)); })
82 71
83#define __arch_virt_to_dma(dev, addr) ({ unsigned long __addr = (unsigned long)(addr); \ 72#define __arch_virt_to_dma(dev, addr) ({ unsigned long __addr = (unsigned long)(addr); \
84 (dma_addr_t) (is_lbus_device(dev) ? \ 73 (dma_addr_t) (is_lbus_device(dev) ? \
85 virt_to_lbus(__addr) : \ 74 virt_to_lbus(__addr) : \
86 __virt_to_bus(__addr)); }) 75 __virt_to_phys(__addr)); })
87 76
88#endif /* CONFIG_ARCH_OMAP15XX */ 77#endif /* CONFIG_ARCH_OMAP15XX */
89 78
diff --git a/arch/arm/plat-omap/include/mach/mmc.h b/arch/arm/plat-omap/include/mach/mmc.h
index fc15d13058fc..031250f02805 100644
--- a/arch/arm/plat-omap/include/mach/mmc.h
+++ b/arch/arm/plat-omap/include/mach/mmc.h
@@ -17,12 +17,28 @@
17 17
18#include <mach/board.h> 18#include <mach/board.h>
19 19
20#define OMAP15XX_NR_MMC 1
21#define OMAP16XX_NR_MMC 2
22#define OMAP1_MMC_SIZE 0x080
23#define OMAP1_MMC1_BASE 0xfffb7800
24#define OMAP1_MMC2_BASE 0xfffb7c00 /* omap16xx only */
25
26#define OMAP24XX_NR_MMC 2
27#define OMAP34XX_NR_MMC 3
28#define OMAP2420_MMC_SIZE OMAP1_MMC_SIZE
29#define HSMMC_SIZE 0x200
30#define OMAP2_MMC1_BASE 0x4809c000
31#define OMAP2_MMC2_BASE 0x480b4000
32#define OMAP3_MMC3_BASE 0x480ad000
33#define HSMMC3 (1 << 2)
34#define HSMMC2 (1 << 1)
35#define HSMMC1 (1 << 0)
36
20#define OMAP_MMC_MAX_SLOTS 2 37#define OMAP_MMC_MAX_SLOTS 2
21 38
22struct omap_mmc_platform_data { 39struct omap_mmc_platform_data {
23 struct omap_mmc_conf conf;
24 40
25 /* number of slots on board */ 41 /* number of slots per controller */
26 unsigned nr_slots:2; 42 unsigned nr_slots:2;
27 43
28 /* set if your board has components or wiring that limits the 44 /* set if your board has components or wiring that limits the
@@ -41,7 +57,31 @@ struct omap_mmc_platform_data {
41 int (*suspend)(struct device *dev, int slot); 57 int (*suspend)(struct device *dev, int slot);
42 int (*resume)(struct device *dev, int slot); 58 int (*resume)(struct device *dev, int slot);
43 59
60 u64 dma_mask;
61
44 struct omap_mmc_slot_data { 62 struct omap_mmc_slot_data {
63
64 /* 4 wire signaling is optional, and is used for SD/SDIO/HSMMC;
65 * 8 wire signaling is also optional, and is used with HSMMC
66 */
67 u8 wires;
68
69 /*
70 * nomux means "standard" muxing is wrong on this board, and
71 * that board-specific code handled it before common init logic.
72 */
73 unsigned nomux:1;
74
75 /* switch pin can be for card detect (default) or card cover */
76 unsigned cover:1;
77
78 /* use the internal clock */
79 unsigned internal_clock:1;
80 s16 power_pin;
81
82 int switch_pin; /* gpio (card detect) */
83 int gpio_wp; /* gpio (write protect) */
84
45 int (* set_bus_mode)(struct device *dev, int slot, int bus_mode); 85 int (* set_bus_mode)(struct device *dev, int slot, int bus_mode);
46 int (* set_power)(struct device *dev, int slot, int power_on, int vdd); 86 int (* set_power)(struct device *dev, int slot, int power_on, int vdd);
47 int (* get_ro)(struct device *dev, int slot); 87 int (* get_ro)(struct device *dev, int slot);
@@ -49,8 +89,8 @@ struct omap_mmc_platform_data {
49 /* return MMC cover switch state, can be NULL if not supported. 89 /* return MMC cover switch state, can be NULL if not supported.
50 * 90 *
51 * possible return values: 91 * possible return values:
52 * 0 - open 92 * 0 - closed
53 * 1 - closed 93 * 1 - open
54 */ 94 */
55 int (* get_cover_state)(struct device *dev, int slot); 95 int (* get_cover_state)(struct device *dev, int slot);
56 96
@@ -66,9 +106,31 @@ struct omap_mmc_platform_data {
66 } slots[OMAP_MMC_MAX_SLOTS]; 106 } slots[OMAP_MMC_MAX_SLOTS];
67}; 107};
68 108
69extern void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *info);
70
71/* called from board-specific card detection service routine */ 109/* called from board-specific card detection service routine */
72extern void omap_mmc_notify_cover_event(struct device *dev, int slot, int is_closed); 110extern void omap_mmc_notify_cover_event(struct device *dev, int slot, int is_closed);
73 111
112#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
113 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
114void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
115 int nr_controllers);
116void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
117 int nr_controllers);
118int omap_mmc_add(int id, unsigned long base, unsigned long size,
119 unsigned int irq, struct omap_mmc_platform_data *data);
120#else
121static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
122 int nr_controllers)
123{
124}
125static inline void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
126 int nr_controllers)
127{
128}
129static inline int omap_mmc_add(int id, unsigned long base, unsigned long size,
130 unsigned int irq, struct omap_mmc_platform_data *data)
131{
132 return 0;
133}
134
135#endif
74#endif 136#endif
diff --git a/arch/arm/plat-omap/include/mach/mux.h b/arch/arm/plat-omap/include/mach/mux.h
index 6bbf1789bed5..f4362b8682c7 100644
--- a/arch/arm/plat-omap/include/mach/mux.h
+++ b/arch/arm/plat-omap/include/mach/mux.h
@@ -632,6 +632,15 @@ enum omap24xx_index {
632 AC7_2430_USB0HS_DATA7, 632 AC7_2430_USB0HS_DATA7,
633 633
634 /* 2430 McBSP */ 634 /* 2430 McBSP */
635 AD6_2430_MCBSP_CLKS,
636
637 AB2_2430_MCBSP1_CLKR,
638 AD5_2430_MCBSP1_FSR,
639 AA1_2430_MCBSP1_DX,
640 AF3_2430_MCBSP1_DR,
641 AB3_2430_MCBSP1_FSX,
642 Y9_2430_MCBSP1_CLKX,
643
635 AC10_2430_MCBSP2_FSX, 644 AC10_2430_MCBSP2_FSX,
636 AD16_2430_MCBSP2_CLX, 645 AD16_2430_MCBSP2_CLX,
637 AE13_2430_MCBSP2_DX, 646 AE13_2430_MCBSP2_DX,
@@ -641,6 +650,30 @@ enum omap24xx_index {
641 AE13_2430_MCBSP2_DX_OFF, 650 AE13_2430_MCBSP2_DX_OFF,
642 AD13_2430_MCBSP2_DR_OFF, 651 AD13_2430_MCBSP2_DR_OFF,
643 652
653 AC9_2430_MCBSP3_CLKX,
654 AE4_2430_MCBSP3_FSX,
655 AE2_2430_MCBSP3_DR,
656 AF4_2430_MCBSP3_DX,
657
658 N3_2430_MCBSP4_CLKX,
659 AD23_2430_MCBSP4_DR,
660 AB25_2430_MCBSP4_DX,
661 AC25_2430_MCBSP4_FSX,
662
663 AE16_2430_MCBSP5_CLKX,
664 AF12_2430_MCBSP5_FSX,
665 K7_2430_MCBSP5_DX,
666 M1_2430_MCBSP5_DR,
667
668 /* 2430 McSPI*/
669 Y18_2430_MCSPI1_CLK,
670 AD15_2430_MCSPI1_SIMO,
671 AE17_2430_MCSPI1_SOMI,
672 U1_2430_MCSPI1_CS0,
673
674 /* Touchscreen GPIO */
675 AF19_2430_GPIO_85,
676
644}; 677};
645 678
646enum omap34xx_index { 679enum omap34xx_index {
@@ -749,6 +782,14 @@ enum omap34xx_index {
749 AD2_3430_USB3FS_PHY_MM3_TXDAT, 782 AD2_3430_USB3FS_PHY_MM3_TXDAT,
750 AC1_3430_USB3FS_PHY_MM3_TXEN_N, 783 AC1_3430_USB3FS_PHY_MM3_TXEN_N,
751 784
785 /* 34xx GPIO
786 * - normally these are bidirectional, no internal pullup/pulldown
787 * - "_UP" suffix (GPIO3_UP) if internal pullup is configured
788 * - "_DOWN" suffix (GPIO3_DOWN) with internal pulldown
789 * - "_OUT" suffix (GPIO3_OUT) for output-only pins (unlike 24xx)
790 */
791 AH8_34XX_GPIO29,
792 J25_34XX_GPIO170,
752}; 793};
753 794
754struct omap_mux_cfg { 795struct omap_mux_cfg {
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index dcd9d16da2e9..be7bcaf2b832 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -24,6 +24,7 @@
24 24
25#include <mach/sram.h> 25#include <mach/sram.h>
26#include <mach/board.h> 26#include <mach/board.h>
27#include <mach/cpu.h>
27 28
28#include <mach/control.h> 29#include <mach/control.h>
29 30
@@ -87,7 +88,7 @@ static int is_sram_locked(void)
87 int type = 0; 88 int type = 0;
88 89
89 if (cpu_is_omap242x()) 90 if (cpu_is_omap242x())
90 type = system_rev & OMAP2_DEVICETYPE_MASK; 91 type = omap_rev() & OMAP2_DEVICETYPE_MASK;
91 92
92 if (type == GP_DEVICE) { 93 if (type == GP_DEVICE) {
93 /* RAMFW: R/W access to all initiators for all qualifier sets */ 94 /* RAMFW: R/W access to all initiators for all qualifier sets */
diff --git a/arch/arm/plat-orion/Makefile b/arch/arm/plat-orion/Makefile
index 198f3dde2be3..56021a72e10c 100644
--- a/arch/arm/plat-orion/Makefile
+++ b/arch/arm/plat-orion/Makefile
@@ -6,3 +6,5 @@ obj-y := irq.o pcie.o time.o
6obj-m := 6obj-m :=
7obj-n := 7obj-n :=
8obj- := 8obj- :=
9
10obj-$(CONFIG_GENERIC_GPIO) += gpio.o
diff --git a/arch/arm/plat-orion/gpio.c b/arch/arm/plat-orion/gpio.c
new file mode 100644
index 000000000000..967186425ca1
--- /dev/null
+++ b/arch/arm/plat-orion/gpio.c
@@ -0,0 +1,415 @@
1/*
2 * arch/arm/plat-orion/gpio.c
3 *
4 * Marvell Orion SoC GPIO 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/module.h>
15#include <linux/spinlock.h>
16#include <linux/bitops.h>
17#include <linux/io.h>
18#include <asm/gpio.h>
19
20static DEFINE_SPINLOCK(gpio_lock);
21static const char *gpio_label[GPIO_MAX]; /* non null for allocated GPIOs */
22static unsigned long gpio_valid[BITS_TO_LONGS(GPIO_MAX)];
23
24static inline void __set_direction(unsigned pin, int input)
25{
26 u32 u;
27
28 u = readl(GPIO_IO_CONF(pin));
29 if (input)
30 u |= 1 << (pin & 31);
31 else
32 u &= ~(1 << (pin & 31));
33 writel(u, GPIO_IO_CONF(pin));
34}
35
36static void __set_level(unsigned pin, int high)
37{
38 u32 u;
39
40 u = readl(GPIO_OUT(pin));
41 if (high)
42 u |= 1 << (pin & 31);
43 else
44 u &= ~(1 << (pin & 31));
45 writel(u, GPIO_OUT(pin));
46}
47
48
49/*
50 * GENERIC_GPIO primitives.
51 */
52int gpio_direction_input(unsigned pin)
53{
54 unsigned long flags;
55
56 if (pin >= GPIO_MAX || !test_bit(pin, gpio_valid)) {
57 pr_debug("%s: invalid GPIO %d\n", __func__, pin);
58 return -EINVAL;
59 }
60
61 spin_lock_irqsave(&gpio_lock, flags);
62
63 /*
64 * Some callers might not have used gpio_request(),
65 * so flag this pin as requested now.
66 */
67 if (gpio_label[pin] == NULL)
68 gpio_label[pin] = "?";
69
70 /*
71 * Configure GPIO direction.
72 */
73 __set_direction(pin, 1);
74
75 spin_unlock_irqrestore(&gpio_lock, flags);
76
77 return 0;
78}
79EXPORT_SYMBOL(gpio_direction_input);
80
81int gpio_direction_output(unsigned pin, int value)
82{
83 unsigned long flags;
84 u32 u;
85
86 if (pin >= GPIO_MAX || !test_bit(pin, gpio_valid)) {
87 pr_debug("%s: invalid GPIO %d\n", __func__, pin);
88 return -EINVAL;
89 }
90
91 spin_lock_irqsave(&gpio_lock, flags);
92
93 /*
94 * Some callers might not have used gpio_request(),
95 * so flag this pin as requested now.
96 */
97 if (gpio_label[pin] == NULL)
98 gpio_label[pin] = "?";
99
100 /*
101 * Disable blinking.
102 */
103 u = readl(GPIO_BLINK_EN(pin));
104 u &= ~(1 << (pin & 31));
105 writel(u, GPIO_BLINK_EN(pin));
106
107 /*
108 * Configure GPIO output value.
109 */
110 __set_level(pin, value);
111
112 /*
113 * Configure GPIO direction.
114 */
115 __set_direction(pin, 0);
116
117 spin_unlock_irqrestore(&gpio_lock, flags);
118
119 return 0;
120}
121EXPORT_SYMBOL(gpio_direction_output);
122
123int gpio_get_value(unsigned pin)
124{
125 int val;
126
127 if (readl(GPIO_IO_CONF(pin)) & (1 << (pin & 31)))
128 val = readl(GPIO_DATA_IN(pin)) ^ readl(GPIO_IN_POL(pin));
129 else
130 val = readl(GPIO_OUT(pin));
131
132 return (val >> (pin & 31)) & 1;
133}
134EXPORT_SYMBOL(gpio_get_value);
135
136void gpio_set_value(unsigned pin, int value)
137{
138 unsigned long flags;
139 u32 u;
140
141 spin_lock_irqsave(&gpio_lock, flags);
142
143 /*
144 * Disable blinking.
145 */
146 u = readl(GPIO_BLINK_EN(pin));
147 u &= ~(1 << (pin & 31));
148 writel(u, GPIO_BLINK_EN(pin));
149
150 /*
151 * Configure GPIO output value.
152 */
153 __set_level(pin, value);
154
155 spin_unlock_irqrestore(&gpio_lock, flags);
156}
157EXPORT_SYMBOL(gpio_set_value);
158
159int gpio_request(unsigned pin, const char *label)
160{
161 unsigned long flags;
162 int ret;
163
164 if (pin >= GPIO_MAX || !test_bit(pin, gpio_valid)) {
165 pr_debug("%s: invalid GPIO %d\n", __func__, pin);
166 return -EINVAL;
167 }
168
169 spin_lock_irqsave(&gpio_lock, flags);
170 if (gpio_label[pin] == NULL) {
171 gpio_label[pin] = label ? label : "?";
172 ret = 0;
173 } else {
174 pr_debug("%s: GPIO %d already used as %s\n",
175 __func__, pin, gpio_label[pin]);
176 ret = -EBUSY;
177 }
178 spin_unlock_irqrestore(&gpio_lock, flags);
179
180 return ret;
181}
182EXPORT_SYMBOL(gpio_request);
183
184void gpio_free(unsigned pin)
185{
186 if (pin >= GPIO_MAX || !test_bit(pin, gpio_valid)) {
187 pr_debug("%s: invalid GPIO %d\n", __func__, pin);
188 return;
189 }
190
191 if (gpio_label[pin] == NULL)
192 pr_warning("%s: GPIO %d already freed\n", __func__, pin);
193 else
194 gpio_label[pin] = NULL;
195}
196EXPORT_SYMBOL(gpio_free);
197
198
199/*
200 * Orion-specific GPIO API extensions.
201 */
202void __init orion_gpio_set_unused(unsigned pin)
203{
204 /*
205 * Configure as output, drive low.
206 */
207 __set_level(pin, 0);
208 __set_direction(pin, 0);
209}
210
211void __init orion_gpio_set_valid(unsigned pin, int valid)
212{
213 if (valid)
214 __set_bit(pin, gpio_valid);
215 else
216 __clear_bit(pin, gpio_valid);
217}
218
219void orion_gpio_set_blink(unsigned pin, int blink)
220{
221 unsigned long flags;
222 u32 u;
223
224 spin_lock_irqsave(&gpio_lock, flags);
225
226 /*
227 * Set output value to zero.
228 */
229 __set_level(pin, 0);
230
231 u = readl(GPIO_BLINK_EN(pin));
232 if (blink)
233 u |= 1 << (pin & 31);
234 else
235 u &= ~(1 << (pin & 31));
236 writel(u, GPIO_BLINK_EN(pin));
237
238 spin_unlock_irqrestore(&gpio_lock, flags);
239}
240EXPORT_SYMBOL(orion_gpio_set_blink);
241
242
243/*****************************************************************************
244 * Orion GPIO IRQ
245 *
246 * GPIO_IN_POL register controls whether GPIO_DATA_IN will hold the same
247 * value of the line or the opposite value.
248 *
249 * Level IRQ handlers: DATA_IN is used directly as cause register.
250 * Interrupt are masked by LEVEL_MASK registers.
251 * Edge IRQ handlers: Change in DATA_IN are latched in EDGE_CAUSE.
252 * Interrupt are masked by EDGE_MASK registers.
253 * Both-edge handlers: Similar to regular Edge handlers, but also swaps
254 * the polarity to catch the next line transaction.
255 * This is a race condition that might not perfectly
256 * work on some use cases.
257 *
258 * Every eight GPIO lines are grouped (OR'ed) before going up to main
259 * cause register.
260 *
261 * EDGE cause mask
262 * data-in /--------| |-----| |----\
263 * -----| |----- ---- to main cause reg
264 * X \----------------| |----/
265 * polarity LEVEL mask
266 *
267 ****************************************************************************/
268static void gpio_irq_edge_ack(u32 irq)
269{
270 int pin = irq_to_gpio(irq);
271
272 writel(~(1 << (pin & 31)), GPIO_EDGE_CAUSE(pin));
273}
274
275static void gpio_irq_edge_mask(u32 irq)
276{
277 int pin = irq_to_gpio(irq);
278 u32 u;
279
280 u = readl(GPIO_EDGE_MASK(pin));
281 u &= ~(1 << (pin & 31));
282 writel(u, GPIO_EDGE_MASK(pin));
283}
284
285static void gpio_irq_edge_unmask(u32 irq)
286{
287 int pin = irq_to_gpio(irq);
288 u32 u;
289
290 u = readl(GPIO_EDGE_MASK(pin));
291 u |= 1 << (pin & 31);
292 writel(u, GPIO_EDGE_MASK(pin));
293}
294
295static void gpio_irq_level_mask(u32 irq)
296{
297 int pin = irq_to_gpio(irq);
298 u32 u;
299
300 u = readl(GPIO_LEVEL_MASK(pin));
301 u &= ~(1 << (pin & 31));
302 writel(u, GPIO_LEVEL_MASK(pin));
303}
304
305static void gpio_irq_level_unmask(u32 irq)
306{
307 int pin = irq_to_gpio(irq);
308 u32 u;
309
310 u = readl(GPIO_LEVEL_MASK(pin));
311 u |= 1 << (pin & 31);
312 writel(u, GPIO_LEVEL_MASK(pin));
313}
314
315static int gpio_irq_set_type(u32 irq, u32 type)
316{
317 int pin = irq_to_gpio(irq);
318 struct irq_desc *desc;
319 u32 u;
320
321 u = readl(GPIO_IO_CONF(pin)) & (1 << (pin & 31));
322 if (!u) {
323 printk(KERN_ERR "orion gpio_irq_set_type failed "
324 "(irq %d, pin %d).\n", irq, pin);
325 return -EINVAL;
326 }
327
328 desc = irq_desc + irq;
329
330 /*
331 * Set edge/level type.
332 */
333 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) {
334 desc->chip = &orion_gpio_irq_edge_chip;
335 } else if (type & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) {
336 desc->chip = &orion_gpio_irq_level_chip;
337 } else {
338 printk(KERN_ERR "failed to set irq=%d (type=%d)\n", irq, type);
339 return -EINVAL;
340 }
341
342 /*
343 * Configure interrupt polarity.
344 */
345 if (type == IRQ_TYPE_EDGE_RISING || type == IRQ_TYPE_LEVEL_HIGH) {
346 u = readl(GPIO_IN_POL(pin));
347 u &= ~(1 << (pin & 31));
348 writel(u, GPIO_IN_POL(pin));
349 } else if (type == IRQ_TYPE_EDGE_FALLING || type == IRQ_TYPE_LEVEL_LOW) {
350 u = readl(GPIO_IN_POL(pin));
351 u |= 1 << (pin & 31);
352 writel(u, GPIO_IN_POL(pin));
353 } else if (type == IRQ_TYPE_EDGE_BOTH) {
354 u32 v;
355
356 v = readl(GPIO_IN_POL(pin)) ^ readl(GPIO_DATA_IN(pin));
357
358 /*
359 * set initial polarity based on current input level
360 */
361 u = readl(GPIO_IN_POL(pin));
362 if (v & (1 << (pin & 31)))
363 u |= 1 << (pin & 31); /* falling */
364 else
365 u &= ~(1 << (pin & 31)); /* rising */
366 writel(u, GPIO_IN_POL(pin));
367 }
368
369 desc->status = (desc->status & ~IRQ_TYPE_SENSE_MASK) | type;
370
371 return 0;
372}
373
374struct irq_chip orion_gpio_irq_edge_chip = {
375 .name = "orion_gpio_irq_edge",
376 .ack = gpio_irq_edge_ack,
377 .mask = gpio_irq_edge_mask,
378 .unmask = gpio_irq_edge_unmask,
379 .set_type = gpio_irq_set_type,
380};
381
382struct irq_chip orion_gpio_irq_level_chip = {
383 .name = "orion_gpio_irq_level",
384 .mask = gpio_irq_level_mask,
385 .mask_ack = gpio_irq_level_mask,
386 .unmask = gpio_irq_level_unmask,
387 .set_type = gpio_irq_set_type,
388};
389
390void orion_gpio_irq_handler(int pinoff)
391{
392 u32 cause;
393 int pin;
394
395 cause = readl(GPIO_DATA_IN(pinoff)) & readl(GPIO_LEVEL_MASK(pinoff));
396 cause |= readl(GPIO_EDGE_CAUSE(pinoff)) & readl(GPIO_EDGE_MASK(pinoff));
397
398 for (pin = pinoff; pin < pinoff + 8; pin++) {
399 int irq = gpio_to_irq(pin);
400 struct irq_desc *desc = irq_desc + irq;
401
402 if (!(cause & (1 << (pin & 31))))
403 continue;
404
405 if ((desc->status & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) {
406 /* Swap polarity (race with GPIO line) */
407 u32 polarity;
408
409 polarity = readl(GPIO_IN_POL(pin));
410 polarity ^= 1 << (pin & 31);
411 writel(polarity, GPIO_IN_POL(pin));
412 }
413 desc_handle_irq(irq, desc);
414 }
415}
diff --git a/arch/arm/plat-orion/include/plat/ehci-orion.h b/arch/arm/plat-orion/include/plat/ehci-orion.h
index 64343051095a..4ec668e77460 100644
--- a/arch/arm/plat-orion/include/plat/ehci-orion.h
+++ b/arch/arm/plat-orion/include/plat/ehci-orion.h
@@ -11,8 +11,16 @@
11 11
12#include <linux/mbus.h> 12#include <linux/mbus.h>
13 13
14enum orion_ehci_phy_ver {
15 EHCI_PHY_ORION,
16 EHCI_PHY_DD,
17 EHCI_PHY_KW,
18 EHCI_PHY_NA,
19};
20
14struct orion_ehci_data { 21struct orion_ehci_data {
15 struct mbus_dram_target_info *dram; 22 struct mbus_dram_target_info *dram;
23 enum orion_ehci_phy_ver phy_version;
16}; 24};
17 25
18 26
diff --git a/arch/arm/plat-orion/include/plat/gpio.h b/arch/arm/plat-orion/include/plat/gpio.h
new file mode 100644
index 000000000000..54deaf274b52
--- /dev/null
+++ b/arch/arm/plat-orion/include/plat/gpio.h
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/plat-orion/include/plat/gpio.h
3 *
4 * Marvell Orion SoC GPIO 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#ifndef __PLAT_GPIO_H
12#define __PLAT_GPIO_H
13
14/*
15 * GENERIC_GPIO primitives.
16 */
17int gpio_request(unsigned pin, const char *label);
18void gpio_free(unsigned pin);
19int gpio_direction_input(unsigned pin);
20int gpio_direction_output(unsigned pin, int value);
21int gpio_get_value(unsigned pin);
22void gpio_set_value(unsigned pin, int value);
23
24/*
25 * Orion-specific GPIO API extensions.
26 */
27void orion_gpio_set_unused(unsigned pin);
28void orion_gpio_set_valid(unsigned pin, int valid);
29void orion_gpio_set_blink(unsigned pin, int blink);
30
31/*
32 * GPIO interrupt handling.
33 */
34extern struct irq_chip orion_gpio_irq_edge_chip;
35extern struct irq_chip orion_gpio_irq_level_chip;
36void orion_gpio_irq_handler(int irqoff);
37
38
39#endif
diff --git a/arch/arm/plat-orion/time.c b/arch/arm/plat-orion/time.c
index 544d6b327f3a..6fa2923e6dca 100644
--- a/arch/arm/plat-orion/time.c
+++ b/arch/arm/plat-orion/time.c
@@ -149,7 +149,6 @@ static struct clock_event_device orion_clkevt = {
149 .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC, 149 .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
150 .shift = 32, 150 .shift = 32,
151 .rating = 300, 151 .rating = 300,
152 .cpumask = CPU_MASK_CPU0,
153 .set_next_event = orion_clkevt_next_event, 152 .set_next_event = orion_clkevt_next_event,
154 .set_mode = orion_clkevt_mode, 153 .set_mode = orion_clkevt_mode,
155}; 154};
@@ -199,5 +198,6 @@ void __init orion_time_init(unsigned int irq, unsigned int tclk)
199 orion_clkevt.mult = div_sc(tclk, NSEC_PER_SEC, orion_clkevt.shift); 198 orion_clkevt.mult = div_sc(tclk, NSEC_PER_SEC, orion_clkevt.shift);
200 orion_clkevt.max_delta_ns = clockevent_delta2ns(0xfffffffe, &orion_clkevt); 199 orion_clkevt.max_delta_ns = clockevent_delta2ns(0xfffffffe, &orion_clkevt);
201 orion_clkevt.min_delta_ns = clockevent_delta2ns(1, &orion_clkevt); 200 orion_clkevt.min_delta_ns = clockevent_delta2ns(1, &orion_clkevt);
201 orion_clkevt.cpumask = cpumask_of(0);
202 clockevents_register_device(&orion_clkevt); 202 clockevents_register_device(&orion_clkevt);
203} 203}
diff --git a/arch/arm/plat-s3c/Kconfig b/arch/arm/plat-s3c/Kconfig
index 31656c33e05e..de9383814e5e 100644
--- a/arch/arm/plat-s3c/Kconfig
+++ b/arch/arm/plat-s3c/Kconfig
@@ -6,34 +6,32 @@
6 6
7config PLAT_S3C 7config PLAT_S3C
8 bool 8 bool
9 depends on ARCH_S3C2410 9 depends on ARCH_S3C2410 || ARCH_S3C24A0 || ARCH_S3C64XX
10 default y if ARCH_S3C2410 10 default y
11 select NO_IOPORT 11 select NO_IOPORT
12 help 12 help
13 Base platform code for any Samsung S3C device 13 Base platform code for any Samsung S3C device
14 14
15# low-level serial option nodes 15# low-level serial option nodes
16 16
17if PLAT_S3C
18
17config CPU_LLSERIAL_S3C2410_ONLY 19config CPU_LLSERIAL_S3C2410_ONLY
18 bool 20 bool
19 depends on ARCH_S3C2410
20 default y if CPU_LLSERIAL_S3C2410 && !CPU_LLSERIAL_S3C2440 21 default y if CPU_LLSERIAL_S3C2410 && !CPU_LLSERIAL_S3C2440
21 22
22config CPU_LLSERIAL_S3C2440_ONLY 23config CPU_LLSERIAL_S3C2440_ONLY
23 bool 24 bool
24 depends on ARCH_S3C2410
25 default y if CPU_LLSERIAL_S3C2440 && !CPU_LLSERIAL_S3C2410 25 default y if CPU_LLSERIAL_S3C2440 && !CPU_LLSERIAL_S3C2410
26 26
27config CPU_LLSERIAL_S3C2410 27config CPU_LLSERIAL_S3C2410
28 bool 28 bool
29 depends on ARCH_S3C2410
30 help 29 help
31 Selected if there is an S3C2410 (or register compatible) serial 30 Selected if there is an S3C2410 (or register compatible) serial
32 low-level implementation needed 31 low-level implementation needed
33 32
34config CPU_LLSERIAL_S3C2440 33config CPU_LLSERIAL_S3C2440
35 bool 34 bool
36 depends on ARCH_S3C2410
37 help 35 help
38 Selected if there is an S3C2440 (or register compatible) serial 36 Selected if there is an S3C2440 (or register compatible) serial
39 low-level implementation needed 37 low-level implementation needed
@@ -44,7 +42,7 @@ comment "Boot options"
44 42
45config S3C_BOOT_WATCHDOG 43config S3C_BOOT_WATCHDOG
46 bool "S3C Initialisation watchdog" 44 bool "S3C Initialisation watchdog"
47 depends on PLAT_S3C && S3C2410_WATCHDOG 45 depends on S3C2410_WATCHDOG
48 help 46 help
49 Say y to enable the watchdog during the kernel decompression 47 Say y to enable the watchdog during the kernel decompression
50 stage. If the kernel fails to uncompress, then the watchdog 48 stage. If the kernel fails to uncompress, then the watchdog
@@ -52,16 +50,22 @@ config S3C_BOOT_WATCHDOG
52 50
53config S3C_BOOT_ERROR_RESET 51config S3C_BOOT_ERROR_RESET
54 bool "S3C Reboot on decompression error" 52 bool "S3C Reboot on decompression error"
55 depends on PLAT_S3C
56 help 53 help
57 Say y here to use the watchdog to reset the system if the 54 Say y here to use the watchdog to reset the system if the
58 kernel decompressor detects an error during decompression. 55 kernel decompressor detects an error during decompression.
59 56
57config S3C_BOOT_UART_FORCE_FIFO
58 bool "Force UART FIFO on during boot process"
59 default y
60 help
61 Say Y here to force the UART FIFOs on during the kernel
62 uncompressor
63
60comment "Power management" 64comment "Power management"
61 65
62config S3C2410_PM_DEBUG 66config S3C2410_PM_DEBUG
63 bool "S3C2410 PM Suspend debug" 67 bool "S3C2410 PM Suspend debug"
64 depends on PLAT_S3C && PM 68 depends on PM
65 help 69 help
66 Say Y here if you want verbose debugging from the PM Suspend and 70 Say Y here if you want verbose debugging from the PM Suspend and
67 Resume code. See <file:Documentation/arm/Samsung-S3C24XX/Suspend.txt> 71 Resume code. See <file:Documentation/arm/Samsung-S3C24XX/Suspend.txt>
@@ -69,7 +73,7 @@ config S3C2410_PM_DEBUG
69 73
70config S3C2410_PM_CHECK 74config S3C2410_PM_CHECK
71 bool "S3C2410 PM Suspend Memory CRC" 75 bool "S3C2410 PM Suspend Memory CRC"
72 depends on PLAT_S3C && PM && CRC32 76 depends on PM && CRC32
73 help 77 help
74 Enable the PM code's memory area checksum over sleep. This option 78 Enable the PM code's memory area checksum over sleep. This option
75 will generate CRCs of all blocks of memory, and store them before 79 will generate CRCs of all blocks of memory, and store them before
@@ -83,7 +87,7 @@ config S3C2410_PM_CHECK
83 87
84config S3C2410_PM_CHECK_CHUNKSIZE 88config S3C2410_PM_CHECK_CHUNKSIZE
85 int "S3C2410 PM Suspend CRC Chunksize (KiB)" 89 int "S3C2410 PM Suspend CRC Chunksize (KiB)"
86 depends on PLAT_S3C && PM && S3C2410_PM_CHECK 90 depends on PM && S3C2410_PM_CHECK
87 default 64 91 default 64
88 help 92 help
89 Set the chunksize in Kilobytes of the CRC for checking memory 93 Set the chunksize in Kilobytes of the CRC for checking memory
@@ -95,10 +99,77 @@ config S3C2410_PM_CHECK_CHUNKSIZE
95 99
96config S3C_LOWLEVEL_UART_PORT 100config S3C_LOWLEVEL_UART_PORT
97 int "S3C UART to use for low-level messages" 101 int "S3C UART to use for low-level messages"
98 depends on PLAT_S3C
99 default 0 102 default 0
100 help 103 help
101 Choice of which UART port to use for the low-level messages, 104 Choice of which UART port to use for the low-level messages,
102 such as the `Uncompressing...` at start time. The value of 105 such as the `Uncompressing...` at start time. The value of
103 this configuration should be between zero and two. The port 106 this configuration should be between zero and two. The port
104 must have been initialised by the boot-loader before use. 107 must have been initialised by the boot-loader before use.
108
109# options for gpiolib support
110
111config S3C_GPIO_SPACE
112 int "Space between gpio banks"
113 default 0
114 help
115 Add a number of spare GPIO entries between each bank for debugging
116 purposes. This allows any problems where an counter overflows from
117 one bank to another to be caught, at the expense of using a little
118 more memory.
119
120config S3C_GPIO_TRACK
121 bool
122 help
123 Internal configuration option to enable the s3c specific gpio
124 chip tracking if the platform requires it.
125
126config S3C_GPIO_PULL_UPDOWN
127 bool
128 help
129 Internal configuration to enable the correct GPIO pull helper
130
131config S3C_GPIO_PULL_DOWN
132 bool
133 help
134 Internal configuration to enable the correct GPIO pull helper
135
136config S3C_GPIO_PULL_UP
137 bool
138 help
139 Internal configuration to enable the correct GPIO pull helper
140
141config S3C_GPIO_CFG_S3C24XX
142 bool
143 help
144 Internal configuration to enable S3C24XX style GPIO configuration
145 functions.
146
147config S3C_GPIO_CFG_S3C64XX
148 bool
149 help
150 Internal configuration to enable S3C64XX style GPIO configuration
151 functions.
152
153# device definitions to compile in
154
155config S3C_DEV_HSMMC
156 bool
157 help
158 Compile in platform device definitions for HSMMC code
159
160config S3C_DEV_HSMMC1
161 bool
162 help
163 Compile in platform device definitions for HSMMC channel 1
164
165config S3C_DEV_I2C1
166 bool
167 help
168 Compile in platform device definitions for I2C channel 1
169
170config S3C_DEV_FB
171 bool
172 help
173 Compile in platform device definition for framebuffer
174
175endif
diff --git a/arch/arm/plat-s3c/Makefile b/arch/arm/plat-s3c/Makefile
index f03d7b35ba37..39195f972d5e 100644
--- a/arch/arm/plat-s3c/Makefile
+++ b/arch/arm/plat-s3c/Makefile
@@ -1,3 +1,27 @@
1# dummy makefile, currently just including asm/arm/plat-s3c/include/plat 1# arch/arm/plat-s3c/Makefile
2#
3# Copyright 2008 Simtec Electronics
4#
5# Licensed under GPLv2
2 6
3obj-n := dummy.o 7obj-y :=
8obj-m :=
9obj-n :=
10obj- :=
11
12# Core support for all Samsung SoCs
13
14obj-y += init.o
15obj-y += time.o
16obj-y += clock.o
17obj-y += pwm-clock.o
18obj-y += gpio.o
19obj-y += gpio-config.o
20
21# devices
22
23obj-$(CONFIG_S3C_DEV_HSMMC) += dev-hsmmc.o
24obj-$(CONFIG_S3C_DEV_HSMMC1) += dev-hsmmc1.o
25obj-y += dev-i2c0.o
26obj-$(CONFIG_S3C_DEV_I2C1) += dev-i2c1.o
27obj-$(CONFIG_S3C_DEV_FB) += dev-fb.o
diff --git a/arch/arm/plat-s3c/clock.c b/arch/arm/plat-s3c/clock.c
new file mode 100644
index 000000000000..b6be76e2fe51
--- /dev/null
+++ b/arch/arm/plat-s3c/clock.c
@@ -0,0 +1,368 @@
1/* linux/arch/arm/plat-s3c24xx/clock.c
2 *
3 * Copyright (c) 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C24XX Core clock control support
7 *
8 * Based on, and code from linux/arch/arm/mach-versatile/clock.c
9 **
10 ** Copyright (C) 2004 ARM Limited.
11 ** Written by Deep Blue Solutions Limited.
12 *
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27*/
28
29#include <linux/init.h>
30#include <linux/module.h>
31#include <linux/kernel.h>
32#include <linux/list.h>
33#include <linux/errno.h>
34#include <linux/err.h>
35#include <linux/platform_device.h>
36#include <linux/sysdev.h>
37#include <linux/interrupt.h>
38#include <linux/ioport.h>
39#include <linux/clk.h>
40#include <linux/spinlock.h>
41#include <linux/io.h>
42
43#include <mach/hardware.h>
44#include <asm/irq.h>
45
46#include <plat/cpu-freq.h>
47
48#include <plat/clock.h>
49#include <plat/cpu.h>
50
51/* clock information */
52
53static LIST_HEAD(clocks);
54
55/* We originally used an mutex here, but some contexts (see resume)
56 * are calling functions such as clk_set_parent() with IRQs disabled
57 * causing an BUG to be triggered.
58 */
59DEFINE_SPINLOCK(clocks_lock);
60
61/* enable and disable calls for use with the clk struct */
62
63static int clk_null_enable(struct clk *clk, int enable)
64{
65 return 0;
66}
67
68/* Clock API calls */
69
70struct clk *clk_get(struct device *dev, const char *id)
71{
72 struct clk *p;
73 struct clk *clk = ERR_PTR(-ENOENT);
74 int idno;
75
76 if (dev == NULL || dev->bus != &platform_bus_type)
77 idno = -1;
78 else
79 idno = to_platform_device(dev)->id;
80
81 spin_lock(&clocks_lock);
82
83 list_for_each_entry(p, &clocks, list) {
84 if (p->id == idno &&
85 strcmp(id, p->name) == 0 &&
86 try_module_get(p->owner)) {
87 clk = p;
88 break;
89 }
90 }
91
92 /* check for the case where a device was supplied, but the
93 * clock that was being searched for is not device specific */
94
95 if (IS_ERR(clk)) {
96 list_for_each_entry(p, &clocks, list) {
97 if (p->id == -1 && strcmp(id, p->name) == 0 &&
98 try_module_get(p->owner)) {
99 clk = p;
100 break;
101 }
102 }
103 }
104
105 spin_unlock(&clocks_lock);
106 return clk;
107}
108
109void clk_put(struct clk *clk)
110{
111 module_put(clk->owner);
112}
113
114int clk_enable(struct clk *clk)
115{
116 if (IS_ERR(clk) || clk == NULL)
117 return -EINVAL;
118
119 clk_enable(clk->parent);
120
121 spin_lock(&clocks_lock);
122
123 if ((clk->usage++) == 0)
124 (clk->enable)(clk, 1);
125
126 spin_unlock(&clocks_lock);
127 return 0;
128}
129
130void clk_disable(struct clk *clk)
131{
132 if (IS_ERR(clk) || clk == NULL)
133 return;
134
135 spin_lock(&clocks_lock);
136
137 if ((--clk->usage) == 0)
138 (clk->enable)(clk, 0);
139
140 spin_unlock(&clocks_lock);
141 clk_disable(clk->parent);
142}
143
144
145unsigned long clk_get_rate(struct clk *clk)
146{
147 if (IS_ERR(clk))
148 return 0;
149
150 if (clk->rate != 0)
151 return clk->rate;
152
153 if (clk->get_rate != NULL)
154 return (clk->get_rate)(clk);
155
156 if (clk->parent != NULL)
157 return clk_get_rate(clk->parent);
158
159 return clk->rate;
160}
161
162long clk_round_rate(struct clk *clk, unsigned long rate)
163{
164 if (!IS_ERR(clk) && clk->round_rate)
165 return (clk->round_rate)(clk, rate);
166
167 return rate;
168}
169
170int clk_set_rate(struct clk *clk, unsigned long rate)
171{
172 int ret;
173
174 if (IS_ERR(clk))
175 return -EINVAL;
176
177 /* We do not default just do a clk->rate = rate as
178 * the clock may have been made this way by choice.
179 */
180
181 WARN_ON(clk->set_rate == NULL);
182
183 if (clk->set_rate == NULL)
184 return -EINVAL;
185
186 spin_lock(&clocks_lock);
187 ret = (clk->set_rate)(clk, rate);
188 spin_unlock(&clocks_lock);
189
190 return ret;
191}
192
193struct clk *clk_get_parent(struct clk *clk)
194{
195 return clk->parent;
196}
197
198int clk_set_parent(struct clk *clk, struct clk *parent)
199{
200 int ret = 0;
201
202 if (IS_ERR(clk))
203 return -EINVAL;
204
205 spin_lock(&clocks_lock);
206
207 if (clk->set_parent)
208 ret = (clk->set_parent)(clk, parent);
209
210 spin_unlock(&clocks_lock);
211
212 return ret;
213}
214
215EXPORT_SYMBOL(clk_get);
216EXPORT_SYMBOL(clk_put);
217EXPORT_SYMBOL(clk_enable);
218EXPORT_SYMBOL(clk_disable);
219EXPORT_SYMBOL(clk_get_rate);
220EXPORT_SYMBOL(clk_round_rate);
221EXPORT_SYMBOL(clk_set_rate);
222EXPORT_SYMBOL(clk_get_parent);
223EXPORT_SYMBOL(clk_set_parent);
224
225/* base clocks */
226
227static int clk_default_setrate(struct clk *clk, unsigned long rate)
228{
229 clk->rate = rate;
230 return 0;
231}
232
233struct clk clk_xtal = {
234 .name = "xtal",
235 .id = -1,
236 .rate = 0,
237 .parent = NULL,
238 .ctrlbit = 0,
239};
240
241struct clk clk_ext = {
242 .name = "ext",
243 .id = -1,
244};
245
246struct clk clk_epll = {
247 .name = "epll",
248 .id = -1,
249};
250
251struct clk clk_mpll = {
252 .name = "mpll",
253 .id = -1,
254 .set_rate = clk_default_setrate,
255};
256
257struct clk clk_upll = {
258 .name = "upll",
259 .id = -1,
260 .parent = NULL,
261 .ctrlbit = 0,
262};
263
264struct clk clk_f = {
265 .name = "fclk",
266 .id = -1,
267 .rate = 0,
268 .parent = &clk_mpll,
269 .ctrlbit = 0,
270 .set_rate = clk_default_setrate,
271};
272
273struct clk clk_h = {
274 .name = "hclk",
275 .id = -1,
276 .rate = 0,
277 .parent = NULL,
278 .ctrlbit = 0,
279 .set_rate = clk_default_setrate,
280};
281
282struct clk clk_p = {
283 .name = "pclk",
284 .id = -1,
285 .rate = 0,
286 .parent = NULL,
287 .ctrlbit = 0,
288 .set_rate = clk_default_setrate,
289};
290
291struct clk clk_usb_bus = {
292 .name = "usb-bus",
293 .id = -1,
294 .rate = 0,
295 .parent = &clk_upll,
296};
297
298
299
300struct clk s3c24xx_uclk = {
301 .name = "uclk",
302 .id = -1,
303};
304
305/* initialise the clock system */
306
307int s3c24xx_register_clock(struct clk *clk)
308{
309 clk->owner = THIS_MODULE;
310
311 if (clk->enable == NULL)
312 clk->enable = clk_null_enable;
313
314 /* add to the list of available clocks */
315
316 /* Quick check to see if this clock has already been registered. */
317 BUG_ON(clk->list.prev != clk->list.next);
318
319 spin_lock(&clocks_lock);
320 list_add(&clk->list, &clocks);
321 spin_unlock(&clocks_lock);
322
323 return 0;
324}
325
326int s3c24xx_register_clocks(struct clk **clks, int nr_clks)
327{
328 int fails = 0;
329
330 for (; nr_clks > 0; nr_clks--, clks++) {
331 if (s3c24xx_register_clock(*clks) < 0)
332 fails++;
333 }
334
335 return fails;
336}
337
338/* initalise all the clocks */
339
340int __init s3c24xx_register_baseclocks(unsigned long xtal)
341{
342 printk(KERN_INFO "S3C24XX Clocks, (c) 2004 Simtec Electronics\n");
343
344 clk_xtal.rate = xtal;
345
346 /* register our clocks */
347
348 if (s3c24xx_register_clock(&clk_xtal) < 0)
349 printk(KERN_ERR "failed to register master xtal\n");
350
351 if (s3c24xx_register_clock(&clk_mpll) < 0)
352 printk(KERN_ERR "failed to register mpll clock\n");
353
354 if (s3c24xx_register_clock(&clk_upll) < 0)
355 printk(KERN_ERR "failed to register upll clock\n");
356
357 if (s3c24xx_register_clock(&clk_f) < 0)
358 printk(KERN_ERR "failed to register cpu fclk\n");
359
360 if (s3c24xx_register_clock(&clk_h) < 0)
361 printk(KERN_ERR "failed to register cpu hclk\n");
362
363 if (s3c24xx_register_clock(&clk_p) < 0)
364 printk(KERN_ERR "failed to register cpu pclk\n");
365
366 return 0;
367}
368
diff --git a/arch/arm/plat-s3c/dev-fb.c b/arch/arm/plat-s3c/dev-fb.c
new file mode 100644
index 000000000000..0454b8ec02e2
--- /dev/null
+++ b/arch/arm/plat-s3c/dev-fb.c
@@ -0,0 +1,72 @@
1/* linux/arch/arm/plat-s3c/dev-fb.c
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * S3C series device definition for framebuffer device
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/kernel.h>
15#include <linux/string.h>
16#include <linux/platform_device.h>
17#include <linux/fb.h>
18
19#include <mach/map.h>
20#include <mach/regs-fb.h>
21
22#include <plat/fb.h>
23#include <plat/devs.h>
24#include <plat/cpu.h>
25
26static struct resource s3c_fb_resource[] = {
27 [0] = {
28 .start = S3C_PA_FB,
29 .end = S3C_PA_FB + SZ_16K - 1,
30 .flags = IORESOURCE_MEM,
31 },
32 [1] = {
33 .start = IRQ_LCD_VSYNC,
34 .end = IRQ_LCD_VSYNC,
35 .flags = IORESOURCE_IRQ,
36 },
37 [2] = {
38 .start = IRQ_LCD_FIFO,
39 .end = IRQ_LCD_FIFO,
40 .flags = IORESOURCE_IRQ,
41 },
42 [3] = {
43 .start = IRQ_LCD_SYSTEM,
44 .end = IRQ_LCD_SYSTEM,
45 .flags = IORESOURCE_IRQ,
46 },
47};
48
49struct platform_device s3c_device_fb = {
50 .name = "s3c-fb",
51 .id = -1,
52 .num_resources = ARRAY_SIZE(s3c_fb_resource),
53 .resource = s3c_fb_resource,
54 .dev.dma_mask = &s3c_device_fb.dev.coherent_dma_mask,
55 .dev.coherent_dma_mask = 0xffffffffUL,
56};
57
58void __init s3c_fb_set_platdata(struct s3c_fb_platdata *pd)
59{
60 struct s3c_fb_platdata *npd;
61
62 if (!pd) {
63 printk(KERN_ERR "%s: no platform data\n", __func__);
64 return;
65 }
66
67 npd = kmemdup(pd, sizeof(struct s3c_fb_platdata), GFP_KERNEL);
68 if (!npd)
69 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
70
71 s3c_device_fb.dev.platform_data = npd;
72}
diff --git a/arch/arm/plat-s3c/dev-hsmmc.c b/arch/arm/plat-s3c/dev-hsmmc.c
new file mode 100644
index 000000000000..4c05b39810e2
--- /dev/null
+++ b/arch/arm/plat-s3c/dev-hsmmc.c
@@ -0,0 +1,68 @@
1/* linux/arch/arm/plat-s3c/dev-hsmmc.c
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * S3C series device definition for hsmmc devices
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/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/mmc/host.h>
17
18#include <mach/map.h>
19#include <plat/sdhci.h>
20#include <plat/devs.h>
21#include <plat/cpu.h>
22
23#define S3C_SZ_HSMMC (0x1000)
24
25static struct resource s3c_hsmmc_resource[] = {
26 [0] = {
27 .start = S3C_PA_HSMMC0,
28 .end = S3C_PA_HSMMC0 + S3C_SZ_HSMMC - 1,
29 .flags = IORESOURCE_MEM,
30 },
31 [1] = {
32 .start = IRQ_HSMMC0,
33 .end = IRQ_HSMMC0,
34 .flags = IORESOURCE_IRQ,
35 }
36};
37
38static u64 s3c_device_hsmmc_dmamask = 0xffffffffUL;
39
40struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata = {
41 .max_width = 4,
42 .host_caps = (MMC_CAP_4_BIT_DATA |
43 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
44};
45
46struct platform_device s3c_device_hsmmc0 = {
47 .name = "s3c-sdhci",
48 .id = 0,
49 .num_resources = ARRAY_SIZE(s3c_hsmmc_resource),
50 .resource = s3c_hsmmc_resource,
51 .dev = {
52 .dma_mask = &s3c_device_hsmmc_dmamask,
53 .coherent_dma_mask = 0xffffffffUL,
54 .platform_data = &s3c_hsmmc0_def_platdata,
55 },
56};
57
58void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd)
59{
60 struct s3c_sdhci_platdata *set = &s3c_hsmmc0_def_platdata;
61
62 set->max_width = pd->max_width;
63
64 if (pd->cfg_gpio)
65 set->cfg_gpio = pd->cfg_gpio;
66 if (pd->cfg_card)
67 set->cfg_card = pd->cfg_card;
68}
diff --git a/arch/arm/plat-s3c/dev-hsmmc1.c b/arch/arm/plat-s3c/dev-hsmmc1.c
new file mode 100644
index 000000000000..e49bc4cd0ee6
--- /dev/null
+++ b/arch/arm/plat-s3c/dev-hsmmc1.c
@@ -0,0 +1,68 @@
1/* linux/arch/arm/plat-s3c/dev-hsmmc1.c
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * S3C series device definition for hsmmc device 1
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/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/mmc/host.h>
17
18#include <mach/map.h>
19#include <plat/sdhci.h>
20#include <plat/devs.h>
21#include <plat/cpu.h>
22
23#define S3C_SZ_HSMMC (0x1000)
24
25static struct resource s3c_hsmmc1_resource[] = {
26 [0] = {
27 .start = S3C_PA_HSMMC1,
28 .end = S3C_PA_HSMMC1 + S3C_SZ_HSMMC - 1,
29 .flags = IORESOURCE_MEM,
30 },
31 [1] = {
32 .start = IRQ_HSMMC1,
33 .end = IRQ_HSMMC1,
34 .flags = IORESOURCE_IRQ,
35 }
36};
37
38static u64 s3c_device_hsmmc1_dmamask = 0xffffffffUL;
39
40struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata = {
41 .max_width = 4,
42 .host_caps = (MMC_CAP_4_BIT_DATA |
43 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
44};
45
46struct platform_device s3c_device_hsmmc1 = {
47 .name = "s3c-sdhci",
48 .id = 1,
49 .num_resources = ARRAY_SIZE(s3c_hsmmc1_resource),
50 .resource = s3c_hsmmc1_resource,
51 .dev = {
52 .dma_mask = &s3c_device_hsmmc1_dmamask,
53 .coherent_dma_mask = 0xffffffffUL,
54 .platform_data = &s3c_hsmmc1_def_platdata,
55 },
56};
57
58void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd)
59{
60 struct s3c_sdhci_platdata *set = &s3c_hsmmc1_def_platdata;
61
62 set->max_width = pd->max_width;
63
64 if (pd->cfg_gpio)
65 set->cfg_gpio = pd->cfg_gpio;
66 if (pd->cfg_card)
67 set->cfg_card = pd->cfg_card;
68}
diff --git a/arch/arm/plat-s3c/dev-i2c0.c b/arch/arm/plat-s3c/dev-i2c0.c
new file mode 100644
index 000000000000..2c0128c77c6e
--- /dev/null
+++ b/arch/arm/plat-s3c/dev-i2c0.c
@@ -0,0 +1,71 @@
1/* linux/arch/arm/plat-s3c/dev-i2c0.c
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * S3C series device definition for i2c device 0
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/kernel.h>
15#include <linux/string.h>
16#include <linux/platform_device.h>
17
18#include <mach/map.h>
19
20#include <plat/regs-iic.h>
21#include <plat/iic.h>
22#include <plat/devs.h>
23#include <plat/cpu.h>
24
25static struct resource s3c_i2c_resource[] = {
26 [0] = {
27 .start = S3C_PA_IIC,
28 .end = S3C_PA_IIC + SZ_4K - 1,
29 .flags = IORESOURCE_MEM,
30 },
31 [1] = {
32 .start = IRQ_IIC,
33 .end = IRQ_IIC,
34 .flags = IORESOURCE_IRQ,
35 },
36};
37
38struct platform_device s3c_device_i2c0 = {
39 .name = "s3c2410-i2c",
40#ifdef CONFIG_S3C_DEV_I2C1
41 .id = 0,
42#else
43 .id = -1,
44#endif
45 .num_resources = ARRAY_SIZE(s3c_i2c_resource),
46 .resource = s3c_i2c_resource,
47};
48
49static struct s3c2410_platform_i2c default_i2c_data0 __initdata = {
50 .flags = 0,
51 .slave_addr = 0x10,
52 .bus_freq = 100*1000,
53 .max_freq = 400*1000,
54 .sda_delay = S3C2410_IICLC_SDA_DELAY5 | S3C2410_IICLC_FILTER_ON,
55};
56
57void __init s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *pd)
58{
59 struct s3c2410_platform_i2c *npd;
60
61 if (!pd)
62 pd = &default_i2c_data0;
63
64 npd = kmemdup(pd, sizeof(struct s3c2410_platform_i2c), GFP_KERNEL);
65 if (!npd)
66 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
67 else if (!npd->cfg_gpio)
68 npd->cfg_gpio = s3c_i2c0_cfg_gpio;
69
70 s3c_device_i2c0.dev.platform_data = npd;
71}
diff --git a/arch/arm/plat-s3c/dev-i2c1.c b/arch/arm/plat-s3c/dev-i2c1.c
new file mode 100644
index 000000000000..9658fb0aec95
--- /dev/null
+++ b/arch/arm/plat-s3c/dev-i2c1.c
@@ -0,0 +1,68 @@
1/* linux/arch/arm/plat-s3c/dev-i2c1.c
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * S3C series device definition for i2c device 1
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/kernel.h>
15#include <linux/string.h>
16#include <linux/platform_device.h>
17
18#include <mach/map.h>
19
20#include <plat/regs-iic.h>
21#include <plat/iic.h>
22#include <plat/devs.h>
23#include <plat/cpu.h>
24
25static struct resource s3c_i2c_resource[] = {
26 [0] = {
27 .start = S3C_PA_IIC1,
28 .end = S3C_PA_IIC1 + SZ_4K - 1,
29 .flags = IORESOURCE_MEM,
30 },
31 [1] = {
32 .start = IRQ_IIC1,
33 .end = IRQ_IIC1,
34 .flags = IORESOURCE_IRQ,
35 },
36};
37
38struct platform_device s3c_device_i2c1 = {
39 .name = "s3c2410-i2c",
40 .id = 1,
41 .num_resources = ARRAY_SIZE(s3c_i2c_resource),
42 .resource = s3c_i2c_resource,
43};
44
45static struct s3c2410_platform_i2c default_i2c_data1 __initdata = {
46 .flags = 0,
47 .bus_num = 1,
48 .slave_addr = 0x10,
49 .bus_freq = 100*1000,
50 .max_freq = 400*1000,
51 .sda_delay = S3C2410_IICLC_SDA_DELAY5 | S3C2410_IICLC_FILTER_ON,
52};
53
54void __init s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *pd)
55{
56 struct s3c2410_platform_i2c *npd;
57
58 if (!pd)
59 pd = &default_i2c_data1;
60
61 npd = kmemdup(pd, sizeof(struct s3c2410_platform_i2c), GFP_KERNEL);
62 if (!npd)
63 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
64 else if (!npd->cfg_gpio)
65 npd->cfg_gpio = s3c_i2c1_cfg_gpio;
66
67 s3c_device_i2c1.dev.platform_data = npd;
68}
diff --git a/arch/arm/plat-s3c/gpio-config.c b/arch/arm/plat-s3c/gpio-config.c
new file mode 100644
index 000000000000..7642b975a998
--- /dev/null
+++ b/arch/arm/plat-s3c/gpio-config.c
@@ -0,0 +1,163 @@
1/* linux/arch/arm/plat-s3c/gpio-config.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C series GPIO configuration core
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/gpio.h>
17#include <linux/io.h>
18
19#include <mach/gpio-core.h>
20#include <plat/gpio-cfg.h>
21#include <plat/gpio-cfg-helpers.h>
22
23int s3c_gpio_cfgpin(unsigned int pin, unsigned int config)
24{
25 struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
26 unsigned long flags;
27 int offset;
28 int ret;
29
30 if (!chip)
31 return -EINVAL;
32
33 offset = pin - chip->chip.base;
34
35 local_irq_save(flags);
36 ret = s3c_gpio_do_setcfg(chip, offset, config);
37 local_irq_restore(flags);
38
39 return ret;
40}
41
42int s3c_gpio_setpull(unsigned int pin, s3c_gpio_pull_t pull)
43{
44 struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
45 unsigned long flags;
46 int offset, ret;
47
48 if (!chip)
49 return -EINVAL;
50
51 offset = pin - chip->chip.base;
52
53 local_irq_save(flags);
54 ret = s3c_gpio_do_setpull(chip, offset, pull);
55 local_irq_restore(flags);
56
57 return ret;
58}
59
60#ifdef CONFIG_S3C_GPIO_CFG_S3C24XX
61int s3c_gpio_setcfg_s3c24xx_banka(struct s3c_gpio_chip *chip,
62 unsigned int off, unsigned int cfg)
63{
64 void __iomem *reg = chip->base;
65 unsigned int shift = off;
66 u32 con;
67
68 if (s3c_gpio_is_cfg_special(cfg)) {
69 cfg &= 0xf;
70
71 /* Map output to 0, and SFN2 to 1 */
72 cfg -= 1;
73 if (cfg > 1)
74 return -EINVAL;
75
76 cfg <<= shift;
77 }
78
79 con = __raw_readl(reg);
80 con &= ~(0x1 << shift);
81 con |= cfg;
82 __raw_writel(con, reg);
83
84 return 0;
85}
86
87int s3c_gpio_setcfg_s3c24xx(struct s3c_gpio_chip *chip,
88 unsigned int off, unsigned int cfg)
89{
90 void __iomem *reg = chip->base;
91 unsigned int shift = off * 2;
92 u32 con;
93
94 if (s3c_gpio_is_cfg_special(cfg)) {
95 cfg &= 0xf;
96 if (cfg > 3)
97 return -EINVAL;
98
99 cfg <<= shift;
100 }
101
102 con = __raw_readl(reg);
103 con &= ~(0x3 << shift);
104 con |= cfg;
105 __raw_writel(con, reg);
106
107 return 0;
108}
109#endif
110
111#ifdef CONFIG_S3C_GPIO_CFG_S3C64XX
112int s3c_gpio_setcfg_s3c64xx_4bit(struct s3c_gpio_chip *chip,
113 unsigned int off, unsigned int cfg)
114{
115 void __iomem *reg = chip->base;
116 unsigned int shift = (off & 7) * 4;
117 u32 con;
118
119 if (off < 8 && chip->chip.ngpio >= 8)
120 reg -= 4;
121
122 if (s3c_gpio_is_cfg_special(cfg)) {
123 cfg &= 0xf;
124 cfg <<= shift;
125 }
126
127 con = __raw_readl(reg);
128 con &= ~(0xf << shift);
129 con |= cfg;
130 __raw_writel(con, reg);
131
132 return 0;
133}
134#endif /* CONFIG_S3C_GPIO_CFG_S3C64XX */
135
136#ifdef CONFIG_S3C_GPIO_PULL_UPDOWN
137int s3c_gpio_setpull_updown(struct s3c_gpio_chip *chip,
138 unsigned int off, s3c_gpio_pull_t pull)
139{
140 void __iomem *reg = chip->base + 0x08;
141 int shift = off * 2;
142 u32 pup;
143
144 pup = __raw_readl(reg);
145 pup &= ~(3 << shift);
146 pup |= pull << shift;
147 __raw_writel(pup, reg);
148
149 return 0;
150}
151
152s3c_gpio_pull_t s3c_gpio_getpull_updown(struct s3c_gpio_chip *chip,
153 unsigned int off)
154{
155 void __iomem *reg = chip->base + 0x08;
156 int shift = off * 2;
157 u32 pup = __raw_readl(reg);
158
159 pup >>= shift;
160 pup &= 0x3;
161 return (__force s3c_gpio_pull_t)pup;
162}
163#endif
diff --git a/arch/arm/plat-s3c/gpio.c b/arch/arm/plat-s3c/gpio.c
new file mode 100644
index 000000000000..d71dd6d9ce5c
--- /dev/null
+++ b/arch/arm/plat-s3c/gpio.c
@@ -0,0 +1,147 @@
1/* linux/arch/arm/plat-s3c/gpio.c
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * S3C series GPIO 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 version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/io.h>
17#include <linux/gpio.h>
18
19#include <plat/gpio-core.h>
20
21#ifdef CONFIG_S3C_GPIO_TRACK
22struct s3c_gpio_chip *s3c_gpios[S3C_GPIO_END];
23
24static __init void s3c_gpiolib_track(struct s3c_gpio_chip *chip)
25{
26 unsigned int gpn;
27 int i;
28
29 gpn = chip->chip.base;
30 for (i = 0; i < chip->chip.ngpio; i++, gpn++) {
31 BUG_ON(gpn > ARRAY_SIZE(s3c_gpios));
32 s3c_gpios[gpn] = chip;
33 }
34}
35#endif /* CONFIG_S3C_GPIO_TRACK */
36
37/* Default routines for controlling GPIO, based on the original S3C24XX
38 * GPIO functions which deal with the case where each gpio bank of the
39 * chip is as following:
40 *
41 * base + 0x00: Control register, 2 bits per gpio
42 * gpio n: 2 bits starting at (2*n)
43 * 00 = input, 01 = output, others mean special-function
44 * base + 0x04: Data register, 1 bit per gpio
45 * bit n: data bit n
46*/
47
48static int s3c_gpiolib_input(struct gpio_chip *chip, unsigned offset)
49{
50 struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip);
51 void __iomem *base = ourchip->base;
52 unsigned long flags;
53 unsigned long con;
54
55 local_irq_save(flags);
56
57 con = __raw_readl(base + 0x00);
58 con &= ~(3 << (offset * 2));
59
60 __raw_writel(con, base + 0x00);
61
62 local_irq_restore(flags);
63 return 0;
64}
65
66static int s3c_gpiolib_output(struct gpio_chip *chip,
67 unsigned offset, int value)
68{
69 struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip);
70 void __iomem *base = ourchip->base;
71 unsigned long flags;
72 unsigned long dat;
73 unsigned long con;
74
75 local_irq_save(flags);
76
77 dat = __raw_readl(base + 0x04);
78 dat &= ~(1 << offset);
79 if (value)
80 dat |= 1 << offset;
81 __raw_writel(dat, base + 0x04);
82
83 con = __raw_readl(base + 0x00);
84 con &= ~(3 << (offset * 2));
85 con |= 1 << (offset * 2);
86
87 __raw_writel(con, base + 0x00);
88 __raw_writel(dat, base + 0x04);
89
90 local_irq_restore(flags);
91 return 0;
92}
93
94static void s3c_gpiolib_set(struct gpio_chip *chip,
95 unsigned offset, int value)
96{
97 struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip);
98 void __iomem *base = ourchip->base;
99 unsigned long flags;
100 unsigned long dat;
101
102 local_irq_save(flags);
103
104 dat = __raw_readl(base + 0x04);
105 dat &= ~(1 << offset);
106 if (value)
107 dat |= 1 << offset;
108 __raw_writel(dat, base + 0x04);
109
110 local_irq_restore(flags);
111}
112
113static int s3c_gpiolib_get(struct gpio_chip *chip, unsigned offset)
114{
115 struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip);
116 unsigned long val;
117
118 val = __raw_readl(ourchip->base + 0x04);
119 val >>= offset;
120 val &= 1;
121
122 return val;
123}
124
125__init void s3c_gpiolib_add(struct s3c_gpio_chip *chip)
126{
127 struct gpio_chip *gc = &chip->chip;
128 int ret;
129
130 BUG_ON(!chip->base);
131 BUG_ON(!gc->label);
132 BUG_ON(!gc->ngpio);
133
134 if (!gc->direction_input)
135 gc->direction_input = s3c_gpiolib_input;
136 if (!gc->direction_output)
137 gc->direction_output = s3c_gpiolib_output;
138 if (!gc->set)
139 gc->set = s3c_gpiolib_set;
140 if (!gc->get)
141 gc->get = s3c_gpiolib_get;
142
143 /* gpiochip_add() prints own failure message on error. */
144 ret = gpiochip_add(gc);
145 if (ret >= 0)
146 s3c_gpiolib_track(chip);
147}
diff --git a/arch/arm/plat-s3c/include/mach/io.h b/arch/arm/plat-s3c/include/mach/io.h
new file mode 100644
index 000000000000..f6a53631b665
--- /dev/null
+++ b/arch/arm/plat-s3c/include/mach/io.h
@@ -0,0 +1,18 @@
1/* arch/arm/plat-s3c/include/mach/io.h
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben-linux@fluff.org>
5 *
6 * Default IO routines for plat-s3c based systems, such as S3C24A0
7 */
8
9#ifndef __ASM_ARM_ARCH_IO_H
10#define __ASM_ARM_ARCH_IO_H
11
12/* No current ISA/PCI bus support. */
13#define __io(a) __typesafe_io(a)
14#define __mem_pci(a) (a)
15
16#define IO_SPACE_LIMIT (0xFFFFFFFF)
17
18#endif
diff --git a/arch/arm/mach-s3c2410/include/mach/timex.h b/arch/arm/plat-s3c/include/mach/timex.h
index 2a425ed0a7e0..2a425ed0a7e0 100644
--- a/arch/arm/mach-s3c2410/include/mach/timex.h
+++ b/arch/arm/plat-s3c/include/mach/timex.h
diff --git a/arch/arm/mach-s3c2410/include/mach/vmalloc.h b/arch/arm/plat-s3c/include/mach/vmalloc.h
index 315b0078a34d..bfd2ca6e3074 100644
--- a/arch/arm/mach-s3c2410/include/mach/vmalloc.h
+++ b/arch/arm/plat-s3c/include/mach/vmalloc.h
@@ -1,4 +1,4 @@
1/* arch/arm/mach-s3c2410/include/mach/vmalloc.h 1/* arch/arm/plat-s3c/include/mach/vmalloc.h
2 * 2 *
3 * from arch/arm/mach-iop3xx/include/mach/vmalloc.h 3 * from arch/arm/mach-iop3xx/include/mach/vmalloc.h
4 * 4 *
diff --git a/arch/arm/plat-s3c/include/plat/adc.h b/arch/arm/plat-s3c/include/plat/adc.h
new file mode 100644
index 000000000000..43df2a404b0b
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/adc.h
@@ -0,0 +1,29 @@
1/* arch/arm/plat-s3c/include/plat/adc.h
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simnte.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C24XX ADC driver information
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#ifndef __ASM_PLAT_ADC_H
15#define __ASM_PLAT_ADC_H __FILE__
16
17struct s3c_adc_client;
18
19extern int s3c_adc_start(struct s3c_adc_client *client,
20 unsigned int channel, unsigned int nr_samples);
21
22extern struct s3c_adc_client *s3c_adc_register(struct platform_device *pdev,
23 void (*select)(unsigned selected),
24 void (*conv)(unsigned d0, unsigned d1),
25 unsigned int is_ts);
26
27extern void s3c_adc_release(struct s3c_adc_client *client);
28
29#endif /* __ASM_PLAT_ADC_H */
diff --git a/arch/arm/plat-s3c24xx/include/plat/clock.h b/arch/arm/plat-s3c/include/plat/clock.h
index 235b753cd877..a10622eed43a 100644
--- a/arch/arm/plat-s3c24xx/include/plat/clock.h
+++ b/arch/arm/plat-s3c/include/plat/clock.h
@@ -1,5 +1,4 @@
1/* linux/include/asm-arm/plat-s3c24xx/clock.h 1/* linux/arch/arm/plat-s3c/include/plat/clock.h
2 * linux/arch/arm/mach-s3c2410/clock.h
3 * 2 *
4 * Copyright (c) 2004-2005 Simtec Electronics 3 * Copyright (c) 2004-2005 Simtec Electronics
5 * http://www.simtec.co.uk/products/SWLINUX/ 4 * http://www.simtec.co.uk/products/SWLINUX/
@@ -10,6 +9,8 @@
10 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
11*/ 10*/
12 11
12#include <linux/spinlock.h>
13
13struct clk { 14struct clk {
14 struct list_head list; 15 struct list_head list;
15 struct module *owner; 16 struct module *owner;
@@ -44,21 +45,44 @@ extern struct clk clk_h;
44extern struct clk clk_p; 45extern struct clk clk_p;
45extern struct clk clk_mpll; 46extern struct clk clk_mpll;
46extern struct clk clk_upll; 47extern struct clk clk_upll;
48extern struct clk clk_epll;
47extern struct clk clk_xtal; 49extern struct clk clk_xtal;
50extern struct clk clk_ext;
51
52/* S3C64XX specific clocks */
53extern struct clk clk_27m;
54extern struct clk clk_48m;
48 55
49/* exports for arch/arm/mach-s3c2410 56/* exports for arch/arm/mach-s3c2410
50 * 57 *
51 * Please DO NOT use these outside of arch/arm/mach-s3c2410 58 * Please DO NOT use these outside of arch/arm/mach-s3c2410
52*/ 59*/
53 60
54extern struct mutex clocks_mutex; 61extern spinlock_t clocks_lock;
55 62
56extern int s3c2410_clkcon_enable(struct clk *clk, int enable); 63extern int s3c2410_clkcon_enable(struct clk *clk, int enable);
57 64
58extern int s3c24xx_register_clock(struct clk *clk); 65extern int s3c24xx_register_clock(struct clk *clk);
59extern int s3c24xx_register_clocks(struct clk **clk, int nr_clks); 66extern int s3c24xx_register_clocks(struct clk **clk, int nr_clks);
60 67
61extern int s3c24xx_setup_clocks(unsigned long xtal, 68extern int s3c24xx_register_baseclocks(unsigned long xtal);
62 unsigned long fclk, 69
63 unsigned long hclk, 70extern void s3c64xx_register_clocks(void);
64 unsigned long pclk); 71
72extern void s3c24xx_setup_clocks(unsigned long fclk,
73 unsigned long hclk,
74 unsigned long pclk);
75
76extern void s3c2410_setup_clocks(void);
77extern void s3c2412_setup_clocks(void);
78extern void s3c244x_setup_clocks(void);
79extern void s3c2443_setup_clocks(void);
80
81/* S3C64XX specific functions and clocks */
82
83extern int s3c64xx_sclk_ctrl(struct clk *clk, int enable);
84
85/* Init for pwm clock code */
86
87extern void s3c_pwmclk_init(void);
88
diff --git a/arch/arm/plat-s3c/include/plat/cpu-freq.h b/arch/arm/plat-s3c/include/plat/cpu-freq.h
new file mode 100644
index 000000000000..c86a13307e90
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/cpu-freq.h
@@ -0,0 +1,94 @@
1/* arch/arm/plat-s3c/include/plat/cpu-freq.h
2 *
3 * Copyright (c) 2006,2007 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C CPU frequency scaling support - driver and board
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/cpufreq.h>
15
16struct s3c_cpufreq_info;
17struct s3c_cpufreq_board;
18struct s3c_iotimings;
19
20struct s3c_freq {
21 unsigned long fclk;
22 unsigned long armclk;
23 unsigned long hclk_tns; /* in 10ths of ns */
24 unsigned long hclk;
25 unsigned long pclk;
26};
27
28/* wrapper 'struct cpufreq_freqs' so that any drivers receiving the
29 * notification can use this information that is not provided by just
30 * having the core frequency alone.
31 */
32
33struct s3c_cpufreq_freqs {
34 struct cpufreq_freqs freqs;
35 struct s3c_freq old;
36 struct s3c_freq new;
37};
38
39#define to_s3c_cpufreq(_cf) container_of(_cf, struct s3c_cpufreq_freqs, freqs)
40
41struct s3c_clkdivs {
42 int p_divisor; /* fclk / pclk */
43 int h_divisor; /* fclk / hclk */
44 int arm_divisor; /* not all cpus have this. */
45 unsigned char dvs; /* using dvs mode to arm. */
46};
47
48#define PLLVAL(_m, _p, _s) (((_m) << 12) | ((_p) << 4) | (_s))
49
50struct s3c_pllval {
51 unsigned long freq;
52 unsigned long pll_reg;
53};
54
55struct s3c_cpufreq_config {
56 struct s3c_freq freq;
57 struct s3c_pllval pll;
58 struct s3c_clkdivs divs;
59 struct s3c_cpufreq_info *info; /* for core, not drivers */
60 struct s3c_cpufreq_board *board;
61};
62
63/* s3c_cpufreq_board
64 *
65 * per-board configuraton information, such as memory refresh and
66 * how to initialise IO timings.
67 */
68struct s3c_cpufreq_board {
69 unsigned int refresh; /* refresh period in ns */
70 unsigned int auto_io:1; /* automatically init io timings. */
71 unsigned int need_io:1; /* set if needs io timing support. */
72
73 /* any non-zero field in here is taken as an upper limit. */
74 struct s3c_freq max; /* frequency limits */
75};
76
77/* Things depending on frequency scaling. */
78#ifdef CONFIG_CPU_FREQ_S3C
79#define __init_or_cpufreq
80#else
81#define __init_or_cpufreq __init
82#endif
83
84/* Board functions */
85
86#ifdef CONFIG_CPU_FREQ_S3C
87extern int s3c_cpufreq_setboard(struct s3c_cpufreq_board *board);
88#else
89
90static inline int s3c_cpufreq_setboard(struct s3c_cpufreq_board *board)
91{
92 return 0;
93}
94#endif /* CONFIG_CPU_FREQ_S3C */
diff --git a/arch/arm/plat-s3c24xx/include/plat/cpu.h b/arch/arm/plat-s3c/include/plat/cpu.h
index 23e420e8bd5b..e62ae0fcfe56 100644
--- a/arch/arm/plat-s3c24xx/include/plat/cpu.h
+++ b/arch/arm/plat-s3c/include/plat/cpu.h
@@ -1,4 +1,4 @@
1/* linux/include/asm-arm/plat-s3c24xx/cpu.h 1/* linux/arch/arm/plat-s3c/include/plat/cpu.h
2 * 2 *
3 * Copyright (c) 2004-2005 Simtec Electronics 3 * Copyright (c) 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
@@ -18,7 +18,7 @@
18#define MHZ (1000*1000) 18#define MHZ (1000*1000)
19#endif 19#endif
20 20
21#define print_mhz(m) ((m) / MHZ), ((m / 1000) % 1000) 21#define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000)
22 22
23/* forward declaration */ 23/* forward declaration */
24struct s3c24xx_uart_resources; 24struct s3c24xx_uart_resources;
@@ -26,11 +26,28 @@ struct platform_device;
26struct s3c2410_uartcfg; 26struct s3c2410_uartcfg;
27struct map_desc; 27struct map_desc;
28 28
29/* per-cpu initialisation function table. */
30
31struct cpu_table {
32 unsigned long idcode;
33 unsigned long idmask;
34 void (*map_io)(void);
35 void (*init_uarts)(struct s3c2410_uartcfg *cfg, int no);
36 void (*init_clocks)(int xtal);
37 int (*init)(void);
38 const char *name;
39};
40
41extern void s3c_init_cpu(unsigned long idcode,
42 struct cpu_table *cpus, unsigned int cputab_size);
43
29/* core initialisation functions */ 44/* core initialisation functions */
30 45
31extern void s3c24xx_init_irq(void); 46extern void s3c24xx_init_irq(void);
47extern void s3c64xx_init_irq(u32 vic0, u32 vic1);
32 48
33extern void s3c24xx_init_io(struct map_desc *mach_desc, int size); 49extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
50extern void s3c64xx_init_io(struct map_desc *mach_desc, int size);
34 51
35extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no); 52extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
36 53
diff --git a/arch/arm/plat-s3c/include/plat/debug-macro.S b/arch/arm/plat-s3c/include/plat/debug-macro.S
index 4aa7e2e6c001..3634d4e3708b 100644
--- a/arch/arm/plat-s3c/include/plat/debug-macro.S
+++ b/arch/arm/plat-s3c/include/plat/debug-macro.S
@@ -20,7 +20,7 @@
20 .endm 20 .endm
21 21
22#ifndef fifo_level 22#ifndef fifo_level
23#define fifo_level fifo_level_s3c2410 23#define fifo_level fifo_level_s3c2440
24#endif 24#endif
25 25
26 .macro fifo_full_s3c2440 rd, rx 26 .macro fifo_full_s3c2440 rd, rx
diff --git a/arch/arm/plat-s3c24xx/include/plat/devs.h b/arch/arm/plat-s3c/include/plat/devs.h
index badaac9d64a8..6b1b5231511c 100644
--- a/arch/arm/plat-s3c24xx/include/plat/devs.h
+++ b/arch/arm/plat-s3c/include/plat/devs.h
@@ -17,21 +17,26 @@ struct s3c24xx_uart_resources {
17}; 17};
18 18
19extern struct s3c24xx_uart_resources s3c2410_uart_resources[]; 19extern struct s3c24xx_uart_resources s3c2410_uart_resources[];
20extern struct s3c24xx_uart_resources s3c64xx_uart_resources[];
20 21
21extern struct platform_device *s3c24xx_uart_devs[]; 22extern struct platform_device *s3c24xx_uart_devs[];
22extern struct platform_device *s3c24xx_uart_src[]; 23extern struct platform_device *s3c24xx_uart_src[];
23 24
24extern struct platform_device s3c_device_timer[]; 25extern struct platform_device s3c_device_timer[];
25 26
27extern struct platform_device s3c_device_fb;
26extern struct platform_device s3c_device_usb; 28extern struct platform_device s3c_device_usb;
27extern struct platform_device s3c_device_lcd; 29extern struct platform_device s3c_device_lcd;
28extern struct platform_device s3c_device_wdt; 30extern struct platform_device s3c_device_wdt;
29extern struct platform_device s3c_device_i2c; 31extern struct platform_device s3c_device_i2c0;
32extern struct platform_device s3c_device_i2c1;
30extern struct platform_device s3c_device_iis; 33extern struct platform_device s3c_device_iis;
31extern struct platform_device s3c_device_rtc; 34extern struct platform_device s3c_device_rtc;
32extern struct platform_device s3c_device_adc; 35extern struct platform_device s3c_device_adc;
33extern struct platform_device s3c_device_sdi; 36extern struct platform_device s3c_device_sdi;
34extern struct platform_device s3c_device_hsmmc; 37extern struct platform_device s3c_device_hsmmc0;
38extern struct platform_device s3c_device_hsmmc1;
39extern struct platform_device s3c_device_hsmmc2;
35 40
36extern struct platform_device s3c_device_spi0; 41extern struct platform_device s3c_device_spi0;
37extern struct platform_device s3c_device_spi1; 42extern struct platform_device s3c_device_spi1;
diff --git a/arch/arm/plat-s3c/include/plat/fb.h b/arch/arm/plat-s3c/include/plat/fb.h
new file mode 100644
index 000000000000..214ff561b0dd
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/fb.h
@@ -0,0 +1,73 @@
1/* linux/arch/arm/plat-s3c/include/plat/fb.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * S3C - FB platform data definitions
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#ifndef __PLAT_S3C_FB_H
16#define __PLAT_S3C_FB_H __FILE__
17
18/**
19 * struct s3c_fb_pd_win - per window setup data
20 * @win_mode: The display parameters to initialise (not for window 0)
21 * @virtual_x: The virtual X size.
22 * @virtual_y: The virtual Y size.
23 */
24struct s3c_fb_pd_win {
25 struct fb_videomode win_mode;
26
27 unsigned short default_bpp;
28 unsigned short max_bpp;
29 unsigned short virtual_x;
30 unsigned short virtual_y;
31};
32
33/**
34 * struct s3c_fb_platdata - S3C driver platform specific information
35 * @setup_gpio: Setup the external GPIO pins to the right state to transfer
36 * the data from the display system to the connected display
37 * device.
38 * @vidcon0: The base vidcon0 values to control the panel data format.
39 * @vidcon1: The base vidcon1 values to control the panel data output.
40 * @win: The setup data for each hardware window, or NULL for unused.
41 * @display_mode: The LCD output display mode.
42 *
43 * The platform data supplies the video driver with all the information
44 * it requires to work with the display(s) attached to the machine. It
45 * controls the initial mode, the number of display windows (0 is always
46 * the base framebuffer) that are initialised etc.
47 *
48 */
49struct s3c_fb_platdata {
50 void (*setup_gpio)(void);
51
52 struct s3c_fb_pd_win *win[S3C_FB_MAX_WIN];
53
54 u32 vidcon0;
55 u32 vidcon1;
56};
57
58/**
59 * s3c_fb_set_platdata() - Setup the FB device with platform data.
60 * @pd: The platform data to set. The data is copied from the passed structure
61 * so the machine data can mark the data __initdata so that any unused
62 * machines will end up dumping their data at runtime.
63 */
64extern void s3c_fb_set_platdata(struct s3c_fb_platdata *pd);
65
66/**
67 * s3c64xx_fb_gpio_setup_24bpp() - S3C64XX setup function for 24bpp LCD
68 *
69 * Initialise the GPIO for an 24bpp LCD display on the RGB interface.
70 */
71extern void s3c64xx_fb_gpio_setup_24bpp(void);
72
73#endif /* __PLAT_S3C_FB_H */
diff --git a/arch/arm/plat-s3c/include/plat/gpio-cfg-helpers.h b/arch/arm/plat-s3c/include/plat/gpio-cfg-helpers.h
new file mode 100644
index 000000000000..652e2bbdaa20
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/gpio-cfg-helpers.h
@@ -0,0 +1,176 @@
1/* linux/arch/arm/plat-s3c/include/plat/gpio-cfg-helper.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * S3C Platform - GPIO pin configuration helper definitions
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/* This is meant for core cpu support, machine or other driver files
16 * should not be including this header.
17 */
18
19#ifndef __PLAT_GPIO_CFG_HELPERS_H
20#define __PLAT_GPIO_CFG_HELPERS_H __FILE__
21
22/* As a note, all gpio configuration functions are entered exclusively, either
23 * with the relevant lock held or the system prevented from doing anything else
24 * by disabling interrupts.
25*/
26
27static inline int s3c_gpio_do_setcfg(struct s3c_gpio_chip *chip,
28 unsigned int off, unsigned int config)
29{
30 return (chip->config->set_config)(chip, off, config);
31}
32
33static inline int s3c_gpio_do_setpull(struct s3c_gpio_chip *chip,
34 unsigned int off, s3c_gpio_pull_t pull)
35{
36 return (chip->config->set_pull)(chip, off, pull);
37}
38
39/**
40 * s3c_gpio_setcfg_s3c24xx - S3C24XX style GPIO configuration.
41 * @chip: The gpio chip that is being configured.
42 * @off: The offset for the GPIO being configured.
43 * @cfg: The configuration value to set.
44 *
45 * This helper deal with the GPIO cases where the control register
46 * has two bits of configuration per gpio, which have the following
47 * functions:
48 * 00 = input
49 * 01 = output
50 * 1x = special function
51*/
52extern int s3c_gpio_setcfg_s3c24xx(struct s3c_gpio_chip *chip,
53 unsigned int off, unsigned int cfg);
54
55/**
56 * s3c_gpio_setcfg_s3c24xx_a - S3C24XX style GPIO configuration (Bank A)
57 * @chip: The gpio chip that is being configured.
58 * @off: The offset for the GPIO being configured.
59 * @cfg: The configuration value to set.
60 *
61 * This helper deal with the GPIO cases where the control register
62 * has one bit of configuration for the gpio, where setting the bit
63 * means the pin is in special function mode and unset means output.
64*/
65extern int s3c_gpio_setcfg_s3c24xx_a(struct s3c_gpio_chip *chip,
66 unsigned int off, unsigned int cfg);
67
68/**
69 * s3c_gpio_setcfg_s3c64xx_4bit - S3C64XX 4bit single register GPIO config.
70 * @chip: The gpio chip that is being configured.
71 * @off: The offset for the GPIO being configured.
72 * @cfg: The configuration value to set.
73 *
74 * This helper deal with the GPIO cases where the control register has 4 bits
75 * of control per GPIO, generally in the form of:
76 * 0000 = Input
77 * 0001 = Output
78 * others = Special functions (dependant on bank)
79 *
80 * Note, since the code to deal with the case where there are two control
81 * registers instead of one, we do not have a seperate set of functions for
82 * each case.
83*/
84extern int s3c_gpio_setcfg_s3c64xx_4bit(struct s3c_gpio_chip *chip,
85 unsigned int off, unsigned int cfg);
86
87
88/* Pull-{up,down} resistor controls.
89 *
90 * S3C2410,S3C2440,S3C24A0 = Pull-UP,
91 * S3C2412,S3C2413 = Pull-Down
92 * S3C6400,S3C6410 = Pull-Both [None,Down,Up,Undef]
93 * S3C2443 = Pull-Both [not same as S3C6400]
94 */
95
96/**
97 * s3c_gpio_setpull_1up() - Pull configuration for choice of up or none.
98 * @chip: The gpio chip that is being configured.
99 * @off: The offset for the GPIO being configured.
100 * @param: pull: The pull mode being requested.
101 *
102 * This is a helper function for the case where we have GPIOs with one
103 * bit configuring the presence of a pull-up resistor.
104 */
105extern int s3c_gpio_setpull_1up(struct s3c_gpio_chip *chip,
106 unsigned int off, s3c_gpio_pull_t pull);
107
108/**
109 * s3c_gpio_setpull_1down() - Pull configuration for choice of down or none
110 * @chip: The gpio chip that is being configured
111 * @off: The offset for the GPIO being configured
112 * @param: pull: The pull mode being requested
113 *
114 * This is a helper function for the case where we have GPIOs with one
115 * bit configuring the presence of a pull-down resistor.
116 */
117extern int s3c_gpio_setpull_1down(struct s3c_gpio_chip *chip,
118 unsigned int off, s3c_gpio_pull_t pull);
119
120/**
121 * s3c_gpio_setpull_upown() - Pull configuration for choice of up, down or none
122 * @chip: The gpio chip that is being configured.
123 * @off: The offset for the GPIO being configured.
124 * @param: pull: The pull mode being requested.
125 *
126 * This is a helper function for the case where we have GPIOs with two
127 * bits configuring the presence of a pull resistor, in the following
128 * order:
129 * 00 = No pull resistor connected
130 * 01 = Pull-up resistor connected
131 * 10 = Pull-down resistor connected
132 */
133extern int s3c_gpio_setpull_updown(struct s3c_gpio_chip *chip,
134 unsigned int off, s3c_gpio_pull_t pull);
135
136
137/**
138 * s3c_gpio_getpull_updown() - Get configuration for choice of up, down or none
139 * @chip: The gpio chip that the GPIO pin belongs to
140 * @off: The offset to the pin to get the configuration of.
141 *
142 * This helper function reads the state of the pull-{up,down} resistor for the
143 * given GPIO in the same case as s3c_gpio_setpull_upown.
144*/
145extern s3c_gpio_pull_t s3c_gpio_getpull_updown(struct s3c_gpio_chip *chip,
146 unsigned int off);
147
148/**
149 * s3c_gpio_setpull_s3c2443() - Pull configuration for s3c2443.
150 * @chip: The gpio chip that is being configured.
151 * @off: The offset for the GPIO being configured.
152 * @param: pull: The pull mode being requested.
153 *
154 * This is a helper function for the case where we have GPIOs with two
155 * bits configuring the presence of a pull resistor, in the following
156 * order:
157 * 00 = Pull-up resistor connected
158 * 10 = Pull-down resistor connected
159 * x1 = No pull up resistor
160 */
161extern int s3c_gpio_setpull_s3c2443(struct s3c_gpio_chip *chip,
162 unsigned int off, s3c_gpio_pull_t pull);
163
164/**
165 * s3c_gpio_getpull_s3c2443() - Get configuration for s3c2443 pull resistors
166 * @chip: The gpio chip that the GPIO pin belongs to.
167 * @off: The offset to the pin to get the configuration of.
168 *
169 * This helper function reads the state of the pull-{up,down} resistor for the
170 * given GPIO in the same case as s3c_gpio_setpull_upown.
171*/
172extern s3c_gpio_pull_t s3c_gpio_getpull_s3c24xx(struct s3c_gpio_chip *chip,
173 unsigned int off);
174
175#endif /* __PLAT_GPIO_CFG_HELPERS_H */
176
diff --git a/arch/arm/plat-s3c/include/plat/gpio-cfg.h b/arch/arm/plat-s3c/include/plat/gpio-cfg.h
new file mode 100644
index 000000000000..29cd6a86cade
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/gpio-cfg.h
@@ -0,0 +1,110 @@
1/* linux/arch/arm/plat-s3c/include/plat/gpio-cfg.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * S3C Platform - GPIO pin configuration
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/* This file contains the necessary definitions to get the basic gpio
16 * pin configuration done such as setting a pin to input or output or
17 * changing the pull-{up,down} configurations.
18 */
19
20/* Note, this interface is being added to the s3c64xx arch first and will
21 * be added to the s3c24xx systems later.
22 */
23
24#ifndef __PLAT_GPIO_CFG_H
25#define __PLAT_GPIO_CFG_H __FILE__
26
27typedef unsigned int __bitwise__ s3c_gpio_pull_t;
28
29/* forward declaration if gpio-core.h hasn't been included */
30struct s3c_gpio_chip;
31
32/**
33 * struct s3c_gpio_cfg GPIO configuration
34 * @cfg_eint: Configuration setting when used for external interrupt source
35 * @get_pull: Read the current pull configuration for the GPIO
36 * @set_pull: Set the current pull configuraiton for the GPIO
37 * @set_config: Set the current configuration for the GPIO
38 * @get_config: Read the current configuration for the GPIO
39 *
40 * Each chip can have more than one type of GPIO bank available and some
41 * have different capabilites even when they have the same control register
42 * layouts. Provide an point to vector control routine and provide any
43 * per-bank configuration information that other systems such as the
44 * external interrupt code will need.
45 */
46struct s3c_gpio_cfg {
47 unsigned int cfg_eint;
48
49 s3c_gpio_pull_t (*get_pull)(struct s3c_gpio_chip *chip, unsigned offs);
50 int (*set_pull)(struct s3c_gpio_chip *chip, unsigned offs,
51 s3c_gpio_pull_t pull);
52
53 unsigned (*get_config)(struct s3c_gpio_chip *chip, unsigned offs);
54 int (*set_config)(struct s3c_gpio_chip *chip, unsigned offs,
55 unsigned config);
56};
57
58#define S3C_GPIO_SPECIAL_MARK (0xfffffff0)
59#define S3C_GPIO_SPECIAL(x) (S3C_GPIO_SPECIAL_MARK | (x))
60
61/* Defines for generic pin configurations */
62#define S3C_GPIO_INPUT (S3C_GPIO_SPECIAL(0))
63#define S3C_GPIO_OUTPUT (S3C_GPIO_SPECIAL(1))
64#define S3C_GPIO_SFN(x) (S3C_GPIO_SPECIAL(x))
65
66#define s3c_gpio_is_cfg_special(_cfg) \
67 (((_cfg) & S3C_GPIO_SPECIAL_MARK) == S3C_GPIO_SPECIAL_MARK)
68
69/**
70 * s3c_gpio_cfgpin() - Change the GPIO function of a pin.
71 * @pin pin The pin number to configure.
72 * @pin to The configuration for the pin's function.
73 *
74 * Configure which function is actually connected to the external
75 * pin, such as an gpio input, output or some form of special function
76 * connected to an internal peripheral block.
77 */
78extern int s3c_gpio_cfgpin(unsigned int pin, unsigned int to);
79
80/* Define values for the pull-{up,down} available for each gpio pin.
81 *
82 * These values control the state of the weak pull-{up,down} resistors
83 * available on most pins on the S3C series. Not all chips support both
84 * up or down settings, and it may be dependant on the chip that is being
85 * used to whether the particular mode is available.
86 */
87#define S3C_GPIO_PULL_NONE ((__force s3c_gpio_pull_t)0x00)
88#define S3C_GPIO_PULL_DOWN ((__force s3c_gpio_pull_t)0x01)
89#define S3C_GPIO_PULL_UP ((__force s3c_gpio_pull_t)0x02)
90
91/**
92 * s3c_gpio_setpull() - set the state of a gpio pin pull resistor
93 * @pin: The pin number to configure the pull resistor.
94 * @pull: The configuration for the pull resistor.
95 *
96 * This function sets the state of the pull-{up,down} resistor for the
97 * specified pin. It will return 0 if successfull, or a negative error
98 * code if the pin cannot support the requested pull setting.
99*/
100extern int s3c_gpio_setpull(unsigned int pin, s3c_gpio_pull_t pull);
101
102/**
103 * s3c_gpio_getpull() - get the pull resistor state of a gpio pin
104 * @pin: The pin number to get the settings for
105 *
106 * Read the pull resistor value for the specified pin.
107*/
108extern s3c_gpio_pull_t s3c_gpio_getpull(unsigned int pin);
109
110#endif /* __PLAT_GPIO_CFG_H */
diff --git a/arch/arm/plat-s3c/include/plat/gpio-core.h b/arch/arm/plat-s3c/include/plat/gpio-core.h
new file mode 100644
index 000000000000..2fc60a580ac8
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/gpio-core.h
@@ -0,0 +1,77 @@
1/* linux/arch/arm/plat-s3c/include/plat/gpio-core.h
2 *
3 * Copyright 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C Platform - GPIO 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 version 2 as
11 * published by the Free Software Foundation.
12*/
13
14/* Define the core gpiolib support functions that the s3c platforms may
15 * need to extend or change depending on the hardware and the s3c chip
16 * selected at build or found at run time.
17 *
18 * These definitions are not intended for driver inclusion, there is
19 * nothing here that should not live outside the platform and core
20 * specific code.
21*/
22
23struct s3c_gpio_cfg;
24
25/**
26 * struct s3c_gpio_chip - wrapper for specific implementation of gpio
27 * @chip: The chip structure to be exported via gpiolib.
28 * @base: The base pointer to the gpio configuration registers.
29 * @config: special function and pull-resistor control information.
30 *
31 * This wrapper provides the necessary information for the Samsung
32 * specific gpios being registered with gpiolib.
33 */
34struct s3c_gpio_chip {
35 struct gpio_chip chip;
36 struct s3c_gpio_cfg *config;
37 void __iomem *base;
38};
39
40static inline struct s3c_gpio_chip *to_s3c_gpio(struct gpio_chip *gpc)
41{
42 return container_of(gpc, struct s3c_gpio_chip, chip);
43}
44
45/** s3c_gpiolib_add() - add the s3c specific version of a gpio_chip.
46 * @chip: The chip to register
47 *
48 * This is a wrapper to gpiochip_add() that takes our specific gpio chip
49 * information and makes the necessary alterations for the platform and
50 * notes the information for use with the configuration systems and any
51 * other parts of the system.
52 */
53extern void s3c_gpiolib_add(struct s3c_gpio_chip *chip);
54
55/* CONFIG_S3C_GPIO_TRACK enables the tracking of the s3c specific gpios
56 * for use with the configuration calls, and other parts of the s3c gpiolib
57 * support code.
58 *
59 * Not all s3c support code will need this, as some configurations of cpu
60 * may only support one or two different configuration options and have an
61 * easy gpio to s3c_gpio_chip mapping function. If this is the case, then
62 * the machine support file should provide its own s3c_gpiolib_getchip()
63 * and any other necessary functions.
64 */
65
66#ifdef CONFIG_S3C_GPIO_TRACK
67extern struct s3c_gpio_chip *s3c_gpios[S3C_GPIO_END];
68
69static inline struct s3c_gpio_chip *s3c_gpiolib_getchip(unsigned int chip)
70{
71 return (chip < S3C_GPIO_END) ? s3c_gpios[chip] : NULL;
72}
73#else
74/* machine specific code should provide s3c_gpiolib_getchip */
75
76static inline void s3c_gpiolib_track(struct s3c_gpio_chip *chip) { }
77#endif
diff --git a/arch/arm/plat-s3c/include/plat/iic-core.h b/arch/arm/plat-s3c/include/plat/iic-core.h
new file mode 100644
index 000000000000..36397ca20962
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/iic-core.h
@@ -0,0 +1,35 @@
1/* arch/arm/mach-s3c2410/include/mach/iic-core.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C - I2C Controller core functions
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#ifndef __ASM_ARCH_IIC_CORE_H
15#define __ASM_ARCH_IIC_CORE_H __FILE__
16
17/* These functions are only for use with the core support code, such as
18 * the cpu specific initialisation code
19 */
20
21/* re-define device name depending on support. */
22static inline void s3c_i2c0_setname(char *name)
23{
24 /* currently this device is always compiled in */
25 s3c_device_i2c0.name = name;
26}
27
28static inline void s3c_i2c1_setname(char *name)
29{
30#ifdef CONFIG_S3C_DEV_I2C1
31 s3c_device_i2c1.name = name;
32#endif
33}
34
35#endif /* __ASM_ARCH_IIC_H */
diff --git a/arch/arm/plat-s3c/include/plat/iic.h b/arch/arm/plat-s3c/include/plat/iic.h
new file mode 100644
index 000000000000..dc1dfcb9bc6c
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/iic.h
@@ -0,0 +1,57 @@
1/* arch/arm/mach-s3c2410/include/mach/iic.h
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 - I2C Controller platfrom_device info
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#ifndef __ASM_ARCH_IIC_H
14#define __ASM_ARCH_IIC_H __FILE__
15
16#define S3C_IICFLG_FILTER (1<<0) /* enable s3c2440 filter */
17
18/* Notes:
19 * 1) All frequencies are expressed in Hz
20 * 2) A value of zero is `do not care`
21*/
22
23struct s3c2410_platform_i2c {
24 int bus_num; /* bus number to use */
25 unsigned int flags;
26 unsigned int slave_addr; /* slave address for controller */
27 unsigned long bus_freq; /* standard bus frequency */
28 unsigned long max_freq; /* max frequency for the bus */
29 unsigned long min_freq; /* min frequency for the bus */
30 unsigned int sda_delay; /* pclks (s3c2440 only) */
31
32 void (*cfg_gpio)(struct platform_device *dev);
33};
34
35/**
36 * s3c_i2c0_set_platdata - set platform data for i2c0 device
37 * @i2c: The platform data to set, or NULL for default data.
38 *
39 * Register the given platform data for use with the i2c0 device. This
40 * call copies the platform data, so the caller can use __initdata for
41 * their copy.
42 *
43 * This call will set cfg_gpio if is null to the default platform
44 * implementation.
45 *
46 * Any user of s3c_device_i2c0 should call this, even if it is with
47 * NULL to ensure that the device is given the default platform data
48 * as the driver will no longer carry defaults.
49 */
50extern void s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *i2c);
51extern void s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *i2c);
52
53/* defined by architecture to configure gpio */
54extern void s3c_i2c0_cfg_gpio(struct platform_device *dev);
55extern void s3c_i2c1_cfg_gpio(struct platform_device *dev);
56
57#endif /* __ASM_ARCH_IIC_H */
diff --git a/arch/arm/plat-s3c/include/plat/map.h b/arch/arm/plat-s3c/include/plat/map-base.h
index b84289d32a54..b84289d32a54 100644
--- a/arch/arm/plat-s3c/include/plat/map.h
+++ b/arch/arm/plat-s3c/include/plat/map-base.h
diff --git a/arch/arm/plat-s3c/include/plat/nand.h b/arch/arm/plat-s3c/include/plat/nand.h
new file mode 100644
index 000000000000..f4dcd14af059
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/nand.h
@@ -0,0 +1,50 @@
1/* arch/arm/mach-s3c2410/include/mach/nand.h
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 - NAND device controller platfrom_device info
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/* struct s3c2410_nand_set
14 *
15 * define an set of one or more nand chips registered with an unique mtd
16 *
17 * nr_chips = number of chips in this set
18 * nr_partitions = number of partitions pointed to be partitoons (or zero)
19 * name = name of set (optional)
20 * nr_map = map for low-layer logical to physical chip numbers (option)
21 * partitions = mtd partition list
22*/
23
24struct s3c2410_nand_set {
25 unsigned int disable_ecc : 1;
26
27 int nr_chips;
28 int nr_partitions;
29 char *name;
30 int *nr_map;
31 struct mtd_partition *partitions;
32 struct nand_ecclayout *ecc_layout;
33};
34
35struct s3c2410_platform_nand {
36 /* timing information for controller, all times in nanoseconds */
37
38 int tacls; /* time for active CLE/ALE to nWE/nOE */
39 int twrph0; /* active time for nWE/nOE */
40 int twrph1; /* time for release CLE/ALE from nWE/nOE inactive */
41
42 unsigned int ignore_unset_ecc : 1;
43
44 int nr_sets;
45 struct s3c2410_nand_set *sets;
46
47 void (*select_chip)(struct s3c2410_nand_set *,
48 int chip);
49};
50
diff --git a/arch/arm/plat-s3c/include/plat/regs-ac97.h b/arch/arm/plat-s3c/include/plat/regs-ac97.h
new file mode 100644
index 000000000000..c3878f7acb83
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/regs-ac97.h
@@ -0,0 +1,67 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-ac97.h
2 *
3 * Copyright (c) 2006 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2440 AC97 Controller
11*/
12
13#ifndef __ASM_ARCH_REGS_AC97_H
14#define __ASM_ARCH_REGS_AC97_H __FILE__
15
16#define S3C_AC97_GLBCTRL (0x00)
17
18#define S3C_AC97_GLBCTRL_CODECREADYIE (1<<22)
19#define S3C_AC97_GLBCTRL_PCMOUTURIE (1<<21)
20#define S3C_AC97_GLBCTRL_PCMINORIE (1<<20)
21#define S3C_AC97_GLBCTRL_MICINORIE (1<<19)
22#define S3C_AC97_GLBCTRL_PCMOUTTIE (1<<18)
23#define S3C_AC97_GLBCTRL_PCMINTIE (1<<17)
24#define S3C_AC97_GLBCTRL_MICINTIE (1<<16)
25#define S3C_AC97_GLBCTRL_PCMOUTTM_OFF (0<<12)
26#define S3C_AC97_GLBCTRL_PCMOUTTM_PIO (1<<12)
27#define S3C_AC97_GLBCTRL_PCMOUTTM_DMA (2<<12)
28#define S3C_AC97_GLBCTRL_PCMOUTTM_MASK (3<<12)
29#define S3C_AC97_GLBCTRL_PCMINTM_OFF (0<<10)
30#define S3C_AC97_GLBCTRL_PCMINTM_PIO (1<<10)
31#define S3C_AC97_GLBCTRL_PCMINTM_DMA (2<<10)
32#define S3C_AC97_GLBCTRL_PCMINTM_MASK (3<<10)
33#define S3C_AC97_GLBCTRL_MICINTM_OFF (0<<8)
34#define S3C_AC97_GLBCTRL_MICINTM_PIO (1<<8)
35#define S3C_AC97_GLBCTRL_MICINTM_DMA (2<<8)
36#define S3C_AC97_GLBCTRL_MICINTM_MASK (3<<8)
37#define S3C_AC97_GLBCTRL_TRANSFERDATAENABLE (1<<3)
38#define S3C_AC97_GLBCTRL_ACLINKON (1<<2)
39#define S3C_AC97_GLBCTRL_WARMRESET (1<<1)
40#define S3C_AC97_GLBCTRL_COLDRESET (1<<0)
41
42#define S3C_AC97_GLBSTAT (0x04)
43
44#define S3C_AC97_GLBSTAT_CODECREADY (1<<22)
45#define S3C_AC97_GLBSTAT_PCMOUTUR (1<<21)
46#define S3C_AC97_GLBSTAT_PCMINORI (1<<20)
47#define S3C_AC97_GLBSTAT_MICINORI (1<<19)
48#define S3C_AC97_GLBSTAT_PCMOUTTI (1<<18)
49#define S3C_AC97_GLBSTAT_PCMINTI (1<<17)
50#define S3C_AC97_GLBSTAT_MICINTI (1<<16)
51#define S3C_AC97_GLBSTAT_MAINSTATE_IDLE (0<<0)
52#define S3C_AC97_GLBSTAT_MAINSTATE_INIT (1<<0)
53#define S3C_AC97_GLBSTAT_MAINSTATE_READY (2<<0)
54#define S3C_AC97_GLBSTAT_MAINSTATE_ACTIVE (3<<0)
55#define S3C_AC97_GLBSTAT_MAINSTATE_LP (4<<0)
56#define S3C_AC97_GLBSTAT_MAINSTATE_WARM (5<<0)
57
58#define S3C_AC97_CODEC_CMD (0x08)
59
60#define S3C_AC97_CODEC_CMD_READ (1<<23)
61
62#define S3C_AC97_STAT (0x0c)
63#define S3C_AC97_PCM_ADDR (0x10)
64#define S3C_AC97_PCM_DATA (0x18)
65#define S3C_AC97_MIC_DATA (0x1C)
66
67#endif /* __ASM_ARCH_REGS_AC97_H */
diff --git a/arch/arm/plat-s3c/include/plat/regs-fb.h b/arch/arm/plat-s3c/include/plat/regs-fb.h
new file mode 100644
index 000000000000..e9ee599d430e
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/regs-fb.h
@@ -0,0 +1,366 @@
1/* arch/arm/plat-s3c/include/plat/regs-fb.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * S3C Platform - new-style framebuffer register definitions
9 *
10 * This is the register set for the new style framebuffer interface
11 * found from the S3C2443 onwards into the S3C2416, S3C2450 and the
12 * S3C64XX series such as the S3C6400 and S3C6410.
13 *
14 * The file does not contain the cpu specific items which are based on
15 * whichever architecture is selected, it only contains the core of the
16 * register set. See <mach/regs-fb.h> to get the specifics.
17 *
18 * Note, we changed to using regs-fb.h as it avoids any clashes with
19 * the original regs-lcd.h so out of the way of regs-lcd.h as well as
20 * indicating the newer block is much more than just an LCD interface.
21 *
22 * This program is free software; you can redistribute it and/or modify
23 * it under the terms of the GNU General Public License version 2 as
24 * published by the Free Software Foundation.
25*/
26
27/* Please do not include this file directly, use <mach/regs-fb.h> to
28 * ensure all the localised SoC support is included as necessary.
29*/
30
31/* VIDCON0 */
32
33#define VIDCON0 (0x00)
34#define VIDCON0_INTERLACE (1 << 29)
35#define VIDCON0_VIDOUT_MASK (0x3 << 26)
36#define VIDCON0_VIDOUT_SHIFT (26)
37#define VIDCON0_VIDOUT_RGB (0x0 << 26)
38#define VIDCON0_VIDOUT_TV (0x1 << 26)
39#define VIDCON0_VIDOUT_I80_LDI0 (0x2 << 26)
40#define VIDCON0_VIDOUT_I80_LDI1 (0x3 << 26)
41
42#define VIDCON0_L1_DATA_MASK (0x7 << 23)
43#define VIDCON0_L1_DATA_SHIFT (23)
44#define VIDCON0_L1_DATA_16BPP (0x0 << 23)
45#define VIDCON0_L1_DATA_18BPP16 (0x1 << 23)
46#define VIDCON0_L1_DATA_18BPP9 (0x2 << 23)
47#define VIDCON0_L1_DATA_24BPP (0x3 << 23)
48#define VIDCON0_L1_DATA_18BPP (0x4 << 23)
49#define VIDCON0_L1_DATA_16BPP8 (0x5 << 23)
50
51#define VIDCON0_L0_DATA_MASK (0x7 << 20)
52#define VIDCON0_L0_DATA_SHIFT (20)
53#define VIDCON0_L0_DATA_16BPP (0x0 << 20)
54#define VIDCON0_L0_DATA_18BPP16 (0x1 << 20)
55#define VIDCON0_L0_DATA_18BPP9 (0x2 << 20)
56#define VIDCON0_L0_DATA_24BPP (0x3 << 20)
57#define VIDCON0_L0_DATA_18BPP (0x4 << 20)
58#define VIDCON0_L0_DATA_16BPP8 (0x5 << 20)
59
60#define VIDCON0_PNRMODE_MASK (0x3 << 17)
61#define VIDCON0_PNRMODE_SHIFT (17)
62#define VIDCON0_PNRMODE_RGB (0x0 << 17)
63#define VIDCON0_PNRMODE_BGR (0x1 << 17)
64#define VIDCON0_PNRMODE_SERIAL_RGB (0x2 << 17)
65#define VIDCON0_PNRMODE_SERIAL_BGR (0x3 << 17)
66
67#define VIDCON0_CLKVALUP (1 << 16)
68#define VIDCON0_CLKVAL_F_MASK (0xff << 6)
69#define VIDCON0_CLKVAL_F_SHIFT (6)
70#define VIDCON0_CLKVAL_F_LIMIT (0xff)
71#define VIDCON0_CLKVAL_F(_x) ((_x) << 6)
72#define VIDCON0_VLCKFREE (1 << 5)
73#define VIDCON0_CLKDIR (1 << 4)
74
75#define VIDCON0_CLKSEL_MASK (0x3 << 2)
76#define VIDCON0_CLKSEL_SHIFT (2)
77#define VIDCON0_CLKSEL_HCLK (0x0 << 2)
78#define VIDCON0_CLKSEL_LCD (0x1 << 2)
79#define VIDCON0_CLKSEL_27M (0x3 << 2)
80
81#define VIDCON0_ENVID (1 << 1)
82#define VIDCON0_ENVID_F (1 << 0)
83
84#define VIDCON1 (0x04)
85#define VIDCON1_LINECNT_MASK (0x7ff << 16)
86#define VIDCON1_LINECNT_SHIFT (16)
87#define VIDCON1_LINECNT_GET(_v) (((_v) >> 16) & 0x7ff)
88#define VIDCON1_VSTATUS_MASK (0x3 << 13)
89#define VIDCON1_VSTATUS_SHIFT (13)
90#define VIDCON1_VSTATUS_VSYNC (0x0 << 13)
91#define VIDCON1_VSTATUS_BACKPORCH (0x1 << 13)
92#define VIDCON1_VSTATUS_ACTIVE (0x2 << 13)
93#define VIDCON1_VSTATUS_FRONTPORCH (0x0 << 13)
94
95#define VIDCON1_INV_VCLK (1 << 7)
96#define VIDCON1_INV_HSYNC (1 << 6)
97#define VIDCON1_INV_VSYNC (1 << 5)
98#define VIDCON1_INV_VDEN (1 << 4)
99
100/* VIDCON2 */
101
102#define VIDCON2 (0x08)
103#define VIDCON2_EN601 (1 << 23)
104#define VIDCON2_TVFMTSEL_SW (1 << 14)
105
106#define VIDCON2_TVFMTSEL1_MASK (0x3 << 12)
107#define VIDCON2_TVFMTSEL1_SHIFT (12)
108#define VIDCON2_TVFMTSEL1_RGB (0x0 << 12)
109#define VIDCON2_TVFMTSEL1_YUV422 (0x1 << 12)
110#define VIDCON2_TVFMTSEL1_YUV444 (0x2 << 12)
111
112#define VIDCON2_ORGYCbCr (1 << 8)
113#define VIDCON2_YUVORDCrCb (1 << 7)
114
115/* VIDTCON0 */
116
117#define VIDTCON0_VBPDE_MASK (0xff << 24)
118#define VIDTCON0_VBPDE_SHIFT (24)
119#define VIDTCON0_VBPDE_LIMIT (0xff)
120#define VIDTCON0_VBPDE(_x) ((_x) << 24)
121
122#define VIDTCON0_VBPD_MASK (0xff << 16)
123#define VIDTCON0_VBPD_SHIFT (16)
124#define VIDTCON0_VBPD_LIMIT (0xff)
125#define VIDTCON0_VBPD(_x) ((_x) << 16)
126
127#define VIDTCON0_VFPD_MASK (0xff << 8)
128#define VIDTCON0_VFPD_SHIFT (8)
129#define VIDTCON0_VFPD_LIMIT (0xff)
130#define VIDTCON0_VFPD(_x) ((_x) << 8)
131
132#define VIDTCON0_VSPW_MASK (0xff << 0)
133#define VIDTCON0_VSPW_SHIFT (0)
134#define VIDTCON0_VSPW_LIMIT (0xff)
135#define VIDTCON0_VSPW(_x) ((_x) << 0)
136
137/* VIDTCON1 */
138
139#define VIDTCON1_VFPDE_MASK (0xff << 24)
140#define VIDTCON1_VFPDE_SHIFT (24)
141#define VIDTCON1_VFPDE_LIMIT (0xff)
142#define VIDTCON1_VFPDE(_x) ((_x) << 24)
143
144#define VIDTCON1_HBPD_MASK (0xff << 16)
145#define VIDTCON1_HBPD_SHIFT (16)
146#define VIDTCON1_HBPD_LIMIT (0xff)
147#define VIDTCON1_HBPD(_x) ((_x) << 16)
148
149#define VIDTCON1_HFPD_MASK (0xff << 8)
150#define VIDTCON1_HFPD_SHIFT (8)
151#define VIDTCON1_HFPD_LIMIT (0xff)
152#define VIDTCON1_HFPD(_x) ((_x) << 8)
153
154#define VIDTCON1_HSPW_MASK (0xff << 0)
155#define VIDTCON1_HSPW_SHIFT (0)
156#define VIDTCON1_HSPW_LIMIT (0xff)
157#define VIDTCON1_HSPW(_x) ((_x) << 0)
158
159#define VIDTCON2 (0x18)
160#define VIDTCON2_LINEVAL_MASK (0x7ff << 11)
161#define VIDTCON2_LINEVAL_SHIFT (11)
162#define VIDTCON2_LINEVAL_LIMIT (0x7ff)
163#define VIDTCON2_LINEVAL(_x) ((_x) << 11)
164
165#define VIDTCON2_HOZVAL_MASK (0x7ff << 0)
166#define VIDTCON2_HOZVAL_SHIFT (0)
167#define VIDTCON2_HOZVAL_LIMIT (0x7ff)
168#define VIDTCON2_HOZVAL(_x) ((_x) << 0)
169
170/* WINCONx */
171
172
173#define WINCONx_BITSWP (1 << 18)
174#define WINCONx_BYTSWP (1 << 17)
175#define WINCONx_HAWSWP (1 << 16)
176#define WINCONx_BURSTLEN_MASK (0x3 << 9)
177#define WINCONx_BURSTLEN_SHIFT (9)
178#define WINCONx_BURSTLEN_16WORD (0x0 << 9)
179#define WINCONx_BURSTLEN_8WORD (0x1 << 9)
180#define WINCONx_BURSTLEN_4WORD (0x2 << 9)
181
182#define WINCONx_ENWIN (1 << 0)
183#define WINCON0_BPPMODE_MASK (0xf << 2)
184#define WINCON0_BPPMODE_SHIFT (2)
185#define WINCON0_BPPMODE_1BPP (0x0 << 2)
186#define WINCON0_BPPMODE_2BPP (0x1 << 2)
187#define WINCON0_BPPMODE_4BPP (0x2 << 2)
188#define WINCON0_BPPMODE_8BPP_PALETTE (0x3 << 2)
189#define WINCON0_BPPMODE_16BPP_565 (0x5 << 2)
190#define WINCON0_BPPMODE_16BPP_1555 (0x7 << 2)
191#define WINCON0_BPPMODE_18BPP_666 (0x8 << 2)
192#define WINCON0_BPPMODE_24BPP_888 (0xb << 2)
193
194#define WINCON1_BLD_PIX (1 << 6)
195
196#define WINCON1_ALPHA_SEL (1 << 1)
197#define WINCON1_BPPMODE_MASK (0xf << 2)
198#define WINCON1_BPPMODE_SHIFT (2)
199#define WINCON1_BPPMODE_1BPP (0x0 << 2)
200#define WINCON1_BPPMODE_2BPP (0x1 << 2)
201#define WINCON1_BPPMODE_4BPP (0x2 << 2)
202#define WINCON1_BPPMODE_8BPP_PALETTE (0x3 << 2)
203#define WINCON1_BPPMODE_8BPP_1232 (0x4 << 2)
204#define WINCON1_BPPMODE_16BPP_565 (0x5 << 2)
205#define WINCON1_BPPMODE_16BPP_A1555 (0x6 << 2)
206#define WINCON1_BPPMODE_16BPP_I1555 (0x7 << 2)
207#define WINCON1_BPPMODE_18BPP_666 (0x8 << 2)
208#define WINCON1_BPPMODE_18BPP_A1665 (0x9 << 2)
209#define WINCON1_BPPMODE_19BPP_A1666 (0xa << 2)
210#define WINCON1_BPPMODE_24BPP_888 (0xb << 2)
211#define WINCON1_BPPMODE_24BPP_A1887 (0xc << 2)
212#define WINCON1_BPPMODE_25BPP_A1888 (0xd << 2)
213#define WINCON1_BPPMODE_28BPP_A4888 (0xd << 2)
214
215
216#define VIDOSDxA_TOPLEFT_X_MASK (0x7ff << 11)
217#define VIDOSDxA_TOPLEFT_X_SHIFT (11)
218#define VIDOSDxA_TOPLEFT_X_LIMIT (0x7ff)
219#define VIDOSDxA_TOPLEFT_X(_x) ((_x) << 11)
220
221#define VIDOSDxA_TOPLEFT_Y_MASK (0x7ff << 0)
222#define VIDOSDxA_TOPLEFT_Y_SHIFT (0)
223#define VIDOSDxA_TOPLEFT_Y_LIMIT (0x7ff)
224#define VIDOSDxA_TOPLEFT_Y(_x) ((_x) << 0)
225
226#define VIDOSDxB_BOTRIGHT_X_MASK (0x7ff << 11)
227#define VIDOSDxB_BOTRIGHT_X_SHIFT (11)
228#define VIDOSDxB_BOTRIGHT_X_LIMIT (0x7ff)
229#define VIDOSDxB_BOTRIGHT_X(_x) ((_x) << 11)
230
231#define VIDOSDxB_BOTRIGHT_Y_MASK (0x7ff << 0)
232#define VIDOSDxB_BOTRIGHT_Y_SHIFT (0)
233#define VIDOSDxB_BOTRIGHT_Y_LIMIT (0x7ff)
234#define VIDOSDxB_BOTRIGHT_Y(_x) ((_x) << 0)
235
236/* For VIDOSD[1..4]C */
237#define VIDISD14C_ALPHA0_R(_x) ((_x) << 20)
238#define VIDISD14C_ALPHA0_G_MASK (0xf << 16)
239#define VIDISD14C_ALPHA0_G_SHIFT (16)
240#define VIDISD14C_ALPHA0_G_LIMIT (0xf)
241#define VIDISD14C_ALPHA0_G(_x) ((_x) << 16)
242#define VIDISD14C_ALPHA0_B_MASK (0xf << 12)
243#define VIDISD14C_ALPHA0_B_SHIFT (12)
244#define VIDISD14C_ALPHA0_B_LIMIT (0xf)
245#define VIDISD14C_ALPHA0_B(_x) ((_x) << 12)
246#define VIDISD14C_ALPHA1_R_MASK (0xf << 8)
247#define VIDISD14C_ALPHA1_R_SHIFT (8)
248#define VIDISD14C_ALPHA1_R_LIMIT (0xf)
249#define VIDISD14C_ALPHA1_R(_x) ((_x) << 8)
250#define VIDISD14C_ALPHA1_G_MASK (0xf << 4)
251#define VIDISD14C_ALPHA1_G_SHIFT (4)
252#define VIDISD14C_ALPHA1_G_LIMIT (0xf)
253#define VIDISD14C_ALPHA1_G(_x) ((_x) << 4)
254#define VIDISD14C_ALPHA1_B_MASK (0xf << 0)
255#define VIDISD14C_ALPHA1_B_SHIFT (0)
256#define VIDISD14C_ALPHA1_B_LIMIT (0xf)
257#define VIDISD14C_ALPHA1_B(_x) ((_x) << 0)
258
259/* Video buffer addresses */
260#define VIDW_BUF_START(_buff) (0xA0 + ((_buff) * 8))
261#define VIDW_BUF_START1(_buff) (0xA4 + ((_buff) * 8))
262#define VIDW_BUF_END(_buff) (0xD0 + ((_buff) * 8))
263#define VIDW_BUF_END1(_buff) (0xD4 + ((_buff) * 8))
264#define VIDW_BUF_SIZE(_buff) (0x100 + ((_buff) * 4))
265
266#define VIDW_BUF_SIZE_OFFSET_MASK (0x1fff << 13)
267#define VIDW_BUF_SIZE_OFFSET_SHIFT (13)
268#define VIDW_BUF_SIZE_OFFSET_LIMIT (0x1fff)
269#define VIDW_BUF_SIZE_OFFSET(_x) ((_x) << 13)
270
271#define VIDW_BUF_SIZE_PAGEWIDTH_MASK (0x1fff << 0)
272#define VIDW_BUF_SIZE_PAGEWIDTH_SHIFT (0)
273#define VIDW_BUF_SIZE_PAGEWIDTH_LIMIT (0x1fff)
274#define VIDW_BUF_SIZE_PAGEWIDTH(_x) ((_x) << 0)
275
276/* Interrupt controls and status */
277
278#define VIDINTCON0_FIFOINTERVAL_MASK (0x3f << 20)
279#define VIDINTCON0_FIFOINTERVAL_SHIFT (20)
280#define VIDINTCON0_FIFOINTERVAL_LIMIT (0x3f)
281#define VIDINTCON0_FIFOINTERVAL(_x) ((_x) << 20)
282
283#define VIDINTCON0_INT_SYSMAINCON (1 << 19)
284#define VIDINTCON0_INT_SYSSUBCON (1 << 18)
285#define VIDINTCON0_INT_I80IFDONE (1 << 17)
286
287#define VIDINTCON0_FRAMESEL0_MASK (0x3 << 15)
288#define VIDINTCON0_FRAMESEL0_SHIFT (15)
289#define VIDINTCON0_FRAMESEL0_BACKPORCH (0x0 << 15)
290#define VIDINTCON0_FRAMESEL0_VSYNC (0x1 << 15)
291#define VIDINTCON0_FRAMESEL0_ACTIVE (0x2 << 15)
292#define VIDINTCON0_FRAMESEL0_FRONTPORCH (0x3 << 15)
293
294#define VIDINTCON0_FRAMESEL1 (1 << 14)
295#define VIDINTCON0_FRAMESEL1_NONE (0x0 << 14)
296#define VIDINTCON0_FRAMESEL1_BACKPORCH (0x1 << 14)
297#define VIDINTCON0_FRAMESEL1_VSYNC (0x2 << 14)
298#define VIDINTCON0_FRAMESEL1_FRONTPORCH (0x3 << 14)
299
300#define VIDINTCON0_INT_FRAME (1 << 12)
301#define VIDINTCON0_FIFIOSEL_MASK (0x7f << 5)
302#define VIDINTCON0_FIFIOSEL_SHIFT (5)
303#define VIDINTCON0_FIFIOSEL_WINDOW0 (0x1 << 5)
304#define VIDINTCON0_FIFIOSEL_WINDOW1 (0x2 << 5)
305
306#define VIDINTCON0_FIFOLEVEL_MASK (0x7 << 2)
307#define VIDINTCON0_FIFOLEVEL_SHIFT (2)
308#define VIDINTCON0_FIFOLEVEL_TO25PC (0x0 << 2)
309#define VIDINTCON0_FIFOLEVEL_TO50PC (0x1 << 2)
310#define VIDINTCON0_FIFOLEVEL_TO75PC (0x2 << 2)
311#define VIDINTCON0_FIFOLEVEL_EMPTY (0x3 << 2)
312#define VIDINTCON0_FIFOLEVEL_FULL (0x4 << 2)
313
314#define VIDINTCON0_INT_FIFO_MASK (0x3 << 0)
315#define VIDINTCON0_INT_FIFO_SHIFT (0)
316#define VIDINTCON0_INT_ENABLE (1 << 0)
317
318#define VIDINTCON1 (0x134)
319#define VIDINTCON1_INT_I180 (1 << 2)
320#define VIDINTCON1_INT_FRAME (1 << 1)
321#define VIDINTCON1_INT_FIFO (1 << 0)
322
323/* Window colour-key control registers */
324
325#define WxKEYCON0_KEYBL_EN (1 << 26)
326#define WxKEYCON0_KEYEN_F (1 << 25)
327#define WxKEYCON0_DIRCON (1 << 24)
328#define WxKEYCON0_COMPKEY_MASK (0xffffff << 0)
329#define WxKEYCON0_COMPKEY_SHIFT (0)
330#define WxKEYCON0_COMPKEY_LIMIT (0xffffff)
331#define WxKEYCON0_COMPKEY(_x) ((_x) << 0)
332#define WxKEYCON1_COLVAL_MASK (0xffffff << 0)
333#define WxKEYCON1_COLVAL_SHIFT (0)
334#define WxKEYCON1_COLVAL_LIMIT (0xffffff)
335#define WxKEYCON1_COLVAL(_x) ((_x) << 0)
336
337
338/* Window blanking (MAP) */
339
340#define WINxMAP_MAP (1 << 24)
341#define WINxMAP_MAP_COLOUR_MASK (0xffffff << 0)
342#define WINxMAP_MAP_COLOUR_SHIFT (0)
343#define WINxMAP_MAP_COLOUR_LIMIT (0xffffff)
344#define WINxMAP_MAP_COLOUR(_x) ((_x) << 0)
345
346#define WPALCON_PAL_UPDATE (1 << 9)
347#define WPALCON_W1PAL_MASK (0x7 << 3)
348#define WPALCON_W1PAL_SHIFT (3)
349#define WPALCON_W1PAL_25BPP_A888 (0x0 << 3)
350#define WPALCON_W1PAL_24BPP (0x1 << 3)
351#define WPALCON_W1PAL_19BPP_A666 (0x2 << 3)
352#define WPALCON_W1PAL_18BPP_A665 (0x3 << 3)
353#define WPALCON_W1PAL_18BPP (0x4 << 3)
354#define WPALCON_W1PAL_16BPP_A555 (0x5 << 3)
355#define WPALCON_W1PAL_16BPP_565 (0x6 << 3)
356
357#define WPALCON_W0PAL_MASK (0x7 << 0)
358#define WPALCON_W0PAL_SHIFT (0)
359#define WPALCON_W0PAL_25BPP_A888 (0x0 << 0)
360#define WPALCON_W0PAL_24BPP (0x1 << 0)
361#define WPALCON_W0PAL_19BPP_A666 (0x2 << 0)
362#define WPALCON_W0PAL_18BPP_A665 (0x3 << 0)
363#define WPALCON_W0PAL_18BPP (0x4 << 0)
364#define WPALCON_W0PAL_16BPP_A555 (0x5 << 0)
365#define WPALCON_W0PAL_16BPP_565 (0x6 << 0)
366
diff --git a/arch/arm/plat-s3c/include/plat/regs-iic.h b/arch/arm/plat-s3c/include/plat/regs-iic.h
new file mode 100644
index 000000000000..2f7c17de8ac8
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/regs-iic.h
@@ -0,0 +1,56 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-iic.h
2 *
3 * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2410 I2C Controller
11*/
12
13#ifndef __ASM_ARCH_REGS_IIC_H
14#define __ASM_ARCH_REGS_IIC_H __FILE__
15
16/* see s3c2410x user guide, v1.1, section 9 (p447) for more info */
17
18#define S3C2410_IICREG(x) (x)
19
20#define S3C2410_IICCON S3C2410_IICREG(0x00)
21#define S3C2410_IICSTAT S3C2410_IICREG(0x04)
22#define S3C2410_IICADD S3C2410_IICREG(0x08)
23#define S3C2410_IICDS S3C2410_IICREG(0x0C)
24#define S3C2440_IICLC S3C2410_IICREG(0x10)
25
26#define S3C2410_IICCON_ACKEN (1<<7)
27#define S3C2410_IICCON_TXDIV_16 (0<<6)
28#define S3C2410_IICCON_TXDIV_512 (1<<6)
29#define S3C2410_IICCON_IRQEN (1<<5)
30#define S3C2410_IICCON_IRQPEND (1<<4)
31#define S3C2410_IICCON_SCALE(x) ((x)&15)
32#define S3C2410_IICCON_SCALEMASK (0xf)
33
34#define S3C2410_IICSTAT_MASTER_RX (2<<6)
35#define S3C2410_IICSTAT_MASTER_TX (3<<6)
36#define S3C2410_IICSTAT_SLAVE_RX (0<<6)
37#define S3C2410_IICSTAT_SLAVE_TX (1<<6)
38#define S3C2410_IICSTAT_MODEMASK (3<<6)
39
40#define S3C2410_IICSTAT_START (1<<5)
41#define S3C2410_IICSTAT_BUSBUSY (1<<5)
42#define S3C2410_IICSTAT_TXRXEN (1<<4)
43#define S3C2410_IICSTAT_ARBITR (1<<3)
44#define S3C2410_IICSTAT_ASSLAVE (1<<2)
45#define S3C2410_IICSTAT_ADDR0 (1<<1)
46#define S3C2410_IICSTAT_LASTBIT (1<<0)
47
48#define S3C2410_IICLC_SDA_DELAY0 (0 << 0)
49#define S3C2410_IICLC_SDA_DELAY5 (1 << 0)
50#define S3C2410_IICLC_SDA_DELAY10 (2 << 0)
51#define S3C2410_IICLC_SDA_DELAY15 (3 << 0)
52#define S3C2410_IICLC_SDA_DELAY_MASK (3 << 0)
53
54#define S3C2410_IICLC_FILTER_ON (1<<2)
55
56#endif /* __ASM_ARCH_REGS_IIC_H */
diff --git a/arch/arm/plat-s3c/include/plat/regs-irqtype.h b/arch/arm/plat-s3c/include/plat/regs-irqtype.h
new file mode 100644
index 000000000000..c63cd3fc5ad3
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/regs-irqtype.h
@@ -0,0 +1,21 @@
1/* arch/arm/plat-s3c/include/plat/regs-irqtype.h
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * S3C - IRQ detection types.
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/* values for S3C2410_EXTINT0/1/2 and other cpus in the series, including
15 * the S3C64XX
16*/
17#define S3C2410_EXTINT_LOWLEV (0x00)
18#define S3C2410_EXTINT_HILEV (0x01)
19#define S3C2410_EXTINT_FALLEDGE (0x02)
20#define S3C2410_EXTINT_RISEEDGE (0x04)
21#define S3C2410_EXTINT_BOTHEDGE (0x06)
diff --git a/arch/arm/plat-s3c/include/plat/regs-nand.h b/arch/arm/plat-s3c/include/plat/regs-nand.h
new file mode 100644
index 000000000000..b2caa4bca270
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/regs-nand.h
@@ -0,0 +1,123 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-nand.h
2 *
3 * Copyright (c) 2004,2005 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2410 NAND register definitions
11*/
12
13#ifndef __ASM_ARM_REGS_NAND
14#define __ASM_ARM_REGS_NAND
15
16
17#define S3C2410_NFREG(x) (x)
18
19#define S3C2410_NFCONF S3C2410_NFREG(0x00)
20#define S3C2410_NFCMD S3C2410_NFREG(0x04)
21#define S3C2410_NFADDR S3C2410_NFREG(0x08)
22#define S3C2410_NFDATA S3C2410_NFREG(0x0C)
23#define S3C2410_NFSTAT S3C2410_NFREG(0x10)
24#define S3C2410_NFECC S3C2410_NFREG(0x14)
25
26#define S3C2440_NFCONT S3C2410_NFREG(0x04)
27#define S3C2440_NFCMD S3C2410_NFREG(0x08)
28#define S3C2440_NFADDR S3C2410_NFREG(0x0C)
29#define S3C2440_NFDATA S3C2410_NFREG(0x10)
30#define S3C2440_NFECCD0 S3C2410_NFREG(0x14)
31#define S3C2440_NFECCD1 S3C2410_NFREG(0x18)
32#define S3C2440_NFECCD S3C2410_NFREG(0x1C)
33#define S3C2440_NFSTAT S3C2410_NFREG(0x20)
34#define S3C2440_NFESTAT0 S3C2410_NFREG(0x24)
35#define S3C2440_NFESTAT1 S3C2410_NFREG(0x28)
36#define S3C2440_NFMECC0 S3C2410_NFREG(0x2C)
37#define S3C2440_NFMECC1 S3C2410_NFREG(0x30)
38#define S3C2440_NFSECC S3C2410_NFREG(0x34)
39#define S3C2440_NFSBLK S3C2410_NFREG(0x38)
40#define S3C2440_NFEBLK S3C2410_NFREG(0x3C)
41
42#define S3C2412_NFSBLK S3C2410_NFREG(0x20)
43#define S3C2412_NFEBLK S3C2410_NFREG(0x24)
44#define S3C2412_NFSTAT S3C2410_NFREG(0x28)
45#define S3C2412_NFMECC_ERR0 S3C2410_NFREG(0x2C)
46#define S3C2412_NFMECC_ERR1 S3C2410_NFREG(0x30)
47#define S3C2412_NFMECC0 S3C2410_NFREG(0x34)
48#define S3C2412_NFMECC1 S3C2410_NFREG(0x38)
49#define S3C2412_NFSECC S3C2410_NFREG(0x3C)
50
51#define S3C2410_NFCONF_EN (1<<15)
52#define S3C2410_NFCONF_512BYTE (1<<14)
53#define S3C2410_NFCONF_4STEP (1<<13)
54#define S3C2410_NFCONF_INITECC (1<<12)
55#define S3C2410_NFCONF_nFCE (1<<11)
56#define S3C2410_NFCONF_TACLS(x) ((x)<<8)
57#define S3C2410_NFCONF_TWRPH0(x) ((x)<<4)
58#define S3C2410_NFCONF_TWRPH1(x) ((x)<<0)
59
60#define S3C2410_NFSTAT_BUSY (1<<0)
61
62#define S3C2440_NFCONF_BUSWIDTH_8 (0<<0)
63#define S3C2440_NFCONF_BUSWIDTH_16 (1<<0)
64#define S3C2440_NFCONF_ADVFLASH (1<<3)
65#define S3C2440_NFCONF_TACLS(x) ((x)<<12)
66#define S3C2440_NFCONF_TWRPH0(x) ((x)<<8)
67#define S3C2440_NFCONF_TWRPH1(x) ((x)<<4)
68
69#define S3C2440_NFCONT_LOCKTIGHT (1<<13)
70#define S3C2440_NFCONT_SOFTLOCK (1<<12)
71#define S3C2440_NFCONT_ILLEGALACC_EN (1<<10)
72#define S3C2440_NFCONT_RNBINT_EN (1<<9)
73#define S3C2440_NFCONT_RN_FALLING (1<<8)
74#define S3C2440_NFCONT_SPARE_ECCLOCK (1<<6)
75#define S3C2440_NFCONT_MAIN_ECCLOCK (1<<5)
76#define S3C2440_NFCONT_INITECC (1<<4)
77#define S3C2440_NFCONT_nFCE (1<<1)
78#define S3C2440_NFCONT_ENABLE (1<<0)
79
80#define S3C2440_NFSTAT_READY (1<<0)
81#define S3C2440_NFSTAT_nCE (1<<1)
82#define S3C2440_NFSTAT_RnB_CHANGE (1<<2)
83#define S3C2440_NFSTAT_ILLEGAL_ACCESS (1<<3)
84
85#define S3C2412_NFCONF_NANDBOOT (1<<31)
86#define S3C2412_NFCONF_ECCCLKCON (1<<30)
87#define S3C2412_NFCONF_ECC_MLC (1<<24)
88#define S3C2412_NFCONF_TACLS_MASK (7<<12) /* 1 extra bit of Tacls */
89
90#define S3C2412_NFCONT_ECC4_DIRWR (1<<18)
91#define S3C2412_NFCONT_LOCKTIGHT (1<<17)
92#define S3C2412_NFCONT_SOFTLOCK (1<<16)
93#define S3C2412_NFCONT_ECC4_ENCINT (1<<13)
94#define S3C2412_NFCONT_ECC4_DECINT (1<<12)
95#define S3C2412_NFCONT_MAIN_ECC_LOCK (1<<7)
96#define S3C2412_NFCONT_INIT_MAIN_ECC (1<<5)
97#define S3C2412_NFCONT_nFCE1 (1<<2)
98#define S3C2412_NFCONT_nFCE0 (1<<1)
99
100#define S3C2412_NFSTAT_ECC_ENCDONE (1<<7)
101#define S3C2412_NFSTAT_ECC_DECDONE (1<<6)
102#define S3C2412_NFSTAT_ILLEGAL_ACCESS (1<<5)
103#define S3C2412_NFSTAT_RnB_CHANGE (1<<4)
104#define S3C2412_NFSTAT_nFCE1 (1<<3)
105#define S3C2412_NFSTAT_nFCE0 (1<<2)
106#define S3C2412_NFSTAT_Res1 (1<<1)
107#define S3C2412_NFSTAT_READY (1<<0)
108
109#define S3C2412_NFECCERR_SERRDATA(x) (((x) >> 21) & 0xf)
110#define S3C2412_NFECCERR_SERRBIT(x) (((x) >> 18) & 0x7)
111#define S3C2412_NFECCERR_MERRDATA(x) (((x) >> 7) & 0x3ff)
112#define S3C2412_NFECCERR_MERRBIT(x) (((x) >> 4) & 0x7)
113#define S3C2412_NFECCERR_SPARE_ERR(x) (((x) >> 2) & 0x3)
114#define S3C2412_NFECCERR_MAIN_ERR(x) (((x) >> 2) & 0x3)
115#define S3C2412_NFECCERR_NONE (0)
116#define S3C2412_NFECCERR_1BIT (1)
117#define S3C2412_NFECCERR_MULTIBIT (2)
118#define S3C2412_NFECCERR_ECCAREA (3)
119
120
121
122#endif /* __ASM_ARM_REGS_NAND */
123
diff --git a/arch/arm/plat-s3c/include/plat/regs-rtc.h b/arch/arm/plat-s3c/include/plat/regs-rtc.h
new file mode 100644
index 000000000000..d5837cf8e402
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/regs-rtc.h
@@ -0,0 +1,61 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-rtc.h
2 *
3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2410 Internal RTC register definition
11*/
12
13#ifndef __ASM_ARCH_REGS_RTC_H
14#define __ASM_ARCH_REGS_RTC_H __FILE__
15
16#define S3C2410_RTCREG(x) (x)
17
18#define S3C2410_RTCCON S3C2410_RTCREG(0x40)
19#define S3C2410_RTCCON_RTCEN (1<<0)
20#define S3C2410_RTCCON_CLKSEL (1<<1)
21#define S3C2410_RTCCON_CNTSEL (1<<2)
22#define S3C2410_RTCCON_CLKRST (1<<3)
23
24#define S3C2410_TICNT S3C2410_RTCREG(0x44)
25#define S3C2410_TICNT_ENABLE (1<<7)
26
27#define S3C2410_RTCALM S3C2410_RTCREG(0x50)
28#define S3C2410_RTCALM_ALMEN (1<<6)
29#define S3C2410_RTCALM_YEAREN (1<<5)
30#define S3C2410_RTCALM_MONEN (1<<4)
31#define S3C2410_RTCALM_DAYEN (1<<3)
32#define S3C2410_RTCALM_HOUREN (1<<2)
33#define S3C2410_RTCALM_MINEN (1<<1)
34#define S3C2410_RTCALM_SECEN (1<<0)
35
36#define S3C2410_RTCALM_ALL \
37 S3C2410_RTCALM_ALMEN | S3C2410_RTCALM_YEAREN | S3C2410_RTCALM_MONEN |\
38 S3C2410_RTCALM_DAYEN | S3C2410_RTCALM_HOUREN | S3C2410_RTCALM_MINEN |\
39 S3C2410_RTCALM_SECEN
40
41
42#define S3C2410_ALMSEC S3C2410_RTCREG(0x54)
43#define S3C2410_ALMMIN S3C2410_RTCREG(0x58)
44#define S3C2410_ALMHOUR S3C2410_RTCREG(0x5c)
45
46#define S3C2410_ALMDATE S3C2410_RTCREG(0x60)
47#define S3C2410_ALMMON S3C2410_RTCREG(0x64)
48#define S3C2410_ALMYEAR S3C2410_RTCREG(0x68)
49
50#define S3C2410_RTCRST S3C2410_RTCREG(0x6c)
51
52#define S3C2410_RTCSEC S3C2410_RTCREG(0x70)
53#define S3C2410_RTCMIN S3C2410_RTCREG(0x74)
54#define S3C2410_RTCHOUR S3C2410_RTCREG(0x78)
55#define S3C2410_RTCDATE S3C2410_RTCREG(0x7c)
56#define S3C2410_RTCDAY S3C2410_RTCREG(0x80)
57#define S3C2410_RTCMON S3C2410_RTCREG(0x84)
58#define S3C2410_RTCYEAR S3C2410_RTCREG(0x88)
59
60
61#endif /* __ASM_ARCH_REGS_RTC_H */
diff --git a/arch/arm/plat-s3c/include/plat/regs-sdhci.h b/arch/arm/plat-s3c/include/plat/regs-sdhci.h
new file mode 100644
index 000000000000..e34049ad44cc
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/regs-sdhci.h
@@ -0,0 +1,87 @@
1/* linux/arch/arm/plat-s3c/include/plat/regs-sdhci.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * S3C Platform - SDHCI (HSMMC) register definitions
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#ifndef __PLAT_S3C_SDHCI_REGS_H
16#define __PLAT_S3C_SDHCI_REGS_H __FILE__
17
18#define S3C_SDHCI_CONTROL2 (0x80)
19#define S3C_SDHCI_CONTROL3 (0x84)
20#define S3C64XX_SDHCI_CONTROL4 (0x8C)
21
22#define S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR (1 << 31)
23#define S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK (1 << 30)
24#define S3C_SDHCI_CTRL2_CDINVRXD3 (1 << 29)
25#define S3C_SDHCI_CTRL2_SLCARDOUT (1 << 28)
26
27#define S3C_SDHCI_CTRL2_FLTCLKSEL_MASK (0xf << 24)
28#define S3C_SDHCI_CTRL2_FLTCLKSEL_SHIFT (24)
29#define S3C_SDHCI_CTRL2_FLTCLKSEL(_x) ((_x) << 24)
30
31#define S3C_SDHCI_CTRL2_LVLDAT_MASK (0xff << 16)
32#define S3C_SDHCI_CTRL2_LVLDAT_SHIFT (16)
33#define S3C_SDHCI_CTRL2_LVLDAT(_x) ((_x) << 16)
34
35#define S3C_SDHCI_CTRL2_ENFBCLKTX (1 << 15)
36#define S3C_SDHCI_CTRL2_ENFBCLKRX (1 << 14)
37#define S3C_SDHCI_CTRL2_SDCDSEL (1 << 13)
38#define S3C_SDHCI_CTRL2_SDSIGPC (1 << 12)
39#define S3C_SDHCI_CTRL2_ENBUSYCHKTXSTART (1 << 11)
40
41#define S3C_SDHCI_CTRL2_DFCNT_MASK (0x3 << 9)
42#define S3C_SDHCI_CTRL2_DFCNT_SHIFT (9)
43#define S3C_SDHCI_CTRL2_DFCNT_NONE (0x0 << 9)
44#define S3C_SDHCI_CTRL2_DFCNT_4SDCLK (0x1 << 9)
45#define S3C_SDHCI_CTRL2_DFCNT_16SDCLK (0x2 << 9)
46#define S3C_SDHCI_CTRL2_DFCNT_64SDCLK (0x3 << 9)
47
48#define S3C_SDHCI_CTRL2_ENCLKOUTHOLD (1 << 8)
49#define S3C_SDHCI_CTRL2_RWAITMODE (1 << 7)
50#define S3C_SDHCI_CTRL2_DISBUFRD (1 << 6)
51#define S3C_SDHCI_CTRL2_SELBASECLK_MASK (0x3 << 4)
52#define S3C_SDHCI_CTRL2_SELBASECLK_SHIFT (4)
53#define S3C_SDHCI_CTRL2_PWRSYNC (1 << 3)
54#define S3C_SDHCI_CTRL2_ENCLKOUTMSKCON (1 << 1)
55#define S3C_SDHCI_CTRL2_HWINITFIN (1 << 0)
56
57#define S3C_SDHCI_CTRL3_FCSEL3 (1 << 31)
58#define S3C_SDHCI_CTRL3_FCSEL2 (1 << 23)
59#define S3C_SDHCI_CTRL3_FCSEL1 (1 << 15)
60#define S3C_SDHCI_CTRL3_FCSEL0 (1 << 7)
61
62#define S3C_SDHCI_CTRL3_FIA3_MASK (0x7f << 24)
63#define S3C_SDHCI_CTRL3_FIA3_SHIFT (24)
64#define S3C_SDHCI_CTRL3_FIA3(_x) ((_x) << 24)
65
66#define S3C_SDHCI_CTRL3_FIA2_MASK (0x7f << 16)
67#define S3C_SDHCI_CTRL3_FIA2_SHIFT (16)
68#define S3C_SDHCI_CTRL3_FIA2(_x) ((_x) << 16)
69
70#define S3C_SDHCI_CTRL3_FIA1_MASK (0x7f << 8)
71#define S3C_SDHCI_CTRL3_FIA1_SHIFT (8)
72#define S3C_SDHCI_CTRL3_FIA1(_x) ((_x) << 8)
73
74#define S3C_SDHCI_CTRL3_FIA0_MASK (0x7f << 0)
75#define S3C_SDHCI_CTRL3_FIA0_SHIFT (0)
76#define S3C_SDHCI_CTRL3_FIA0(_x) ((_x) << 0)
77
78#define S3C64XX_SDHCI_CONTROL4_DRIVE_MASK (0x3 << 16)
79#define S3C64XX_SDHCI_CONTROL4_DRIVE_SHIFT (16)
80#define S3C64XX_SDHCI_CONTROL4_DRIVE_2mA (0x0 << 16)
81#define S3C64XX_SDHCI_CONTROL4_DRIVE_4mA (0x1 << 16)
82#define S3C64XX_SDHCI_CONTROL4_DRIVE_7mA (0x2 << 16)
83#define S3C64XX_SDHCI_CONTROL4_DRIVE_9mA (0x3 << 16)
84
85#define S3C64XX_SDHCI_CONTROL4_BUSY (1)
86
87#endif /* __PLAT_S3C_SDHCI_REGS_H */
diff --git a/arch/arm/plat-s3c/include/plat/regs-serial.h b/arch/arm/plat-s3c/include/plat/regs-serial.h
index a0daa647b92c..487d7d2a7e1d 100644
--- a/arch/arm/plat-s3c/include/plat/regs-serial.h
+++ b/arch/arm/plat-s3c/include/plat/regs-serial.h
@@ -77,6 +77,12 @@
77#define S3C2440_UCON_FCLK (3<<10) 77#define S3C2440_UCON_FCLK (3<<10)
78#define S3C2443_UCON_EPLL (3<<10) 78#define S3C2443_UCON_EPLL (3<<10)
79 79
80#define S3C6400_UCON_CLKMASK (3<<10)
81#define S3C6400_UCON_PCLK (0<<10)
82#define S3C6400_UCON_PCLK2 (2<<10)
83#define S3C6400_UCON_UCLK0 (1<<10)
84#define S3C6400_UCON_UCLK1 (3<<10)
85
80#define S3C2440_UCON2_FCLK_EN (1<<15) 86#define S3C2440_UCON2_FCLK_EN (1<<15)
81#define S3C2440_UCON0_DIVMASK (15 << 12) 87#define S3C2440_UCON0_DIVMASK (15 << 12)
82#define S3C2440_UCON1_DIVMASK (15 << 12) 88#define S3C2440_UCON1_DIVMASK (15 << 12)
@@ -149,6 +155,14 @@
149#define S3C2410_UFSTAT_RXMASK (15<<0) 155#define S3C2410_UFSTAT_RXMASK (15<<0)
150#define S3C2410_UFSTAT_RXSHIFT (0) 156#define S3C2410_UFSTAT_RXSHIFT (0)
151 157
158/* UFSTAT S3C24A0 */
159#define S3C24A0_UFSTAT_TXFULL (1 << 14)
160#define S3C24A0_UFSTAT_RXFULL (1 << 6)
161#define S3C24A0_UFSTAT_TXMASK (63 << 8)
162#define S3C24A0_UFSTAT_TXSHIFT (8)
163#define S3C24A0_UFSTAT_RXMASK (63)
164#define S3C24A0_UFSTAT_RXSHIFT (0)
165
152/* UFSTAT S3C2443 same as S3C2440 */ 166/* UFSTAT S3C2443 same as S3C2440 */
153#define S3C2440_UFSTAT_TXFULL (1<<14) 167#define S3C2440_UFSTAT_TXFULL (1<<14)
154#define S3C2440_UFSTAT_RXFULL (1<<6) 168#define S3C2440_UFSTAT_RXFULL (1<<6)
@@ -224,7 +238,7 @@ struct s3c2410_uartcfg {
224 * or platform_add_device() before the console_initcall() 238 * or platform_add_device() before the console_initcall()
225*/ 239*/
226 240
227extern struct platform_device *s3c24xx_uart_devs[3]; 241extern struct platform_device *s3c24xx_uart_devs[4];
228 242
229#endif /* __ASSEMBLY__ */ 243#endif /* __ASSEMBLY__ */
230 244
diff --git a/arch/arm/plat-s3c/include/plat/regs-timer.h b/arch/arm/plat-s3c/include/plat/regs-timer.h
index cc0eedd53e38..d097d92f8cc7 100644
--- a/arch/arm/plat-s3c/include/plat/regs-timer.h
+++ b/arch/arm/plat-s3c/include/plat/regs-timer.h
@@ -10,7 +10,6 @@
10 * S3C2410 Timer configuration 10 * S3C2410 Timer configuration
11*/ 11*/
12 12
13
14#ifndef __ASM_ARCH_REGS_TIMER_H 13#ifndef __ASM_ARCH_REGS_TIMER_H
15#define __ASM_ARCH_REGS_TIMER_H 14#define __ASM_ARCH_REGS_TIMER_H
16 15
@@ -21,6 +20,8 @@
21#define S3C2410_TCFG1 S3C_TIMERREG(0x04) 20#define S3C2410_TCFG1 S3C_TIMERREG(0x04)
22#define S3C2410_TCON S3C_TIMERREG(0x08) 21#define S3C2410_TCON S3C_TIMERREG(0x08)
23 22
23#define S3C64XX_TINT_CSTAT S3C_TIMERREG(0x44)
24
24#define S3C2410_TCFG_PRESCALER0_MASK (255<<0) 25#define S3C2410_TCFG_PRESCALER0_MASK (255<<0)
25#define S3C2410_TCFG_PRESCALER1_MASK (255<<8) 26#define S3C2410_TCFG_PRESCALER1_MASK (255<<8)
26#define S3C2410_TCFG_PRESCALER1_SHIFT (8) 27#define S3C2410_TCFG_PRESCALER1_SHIFT (8)
@@ -72,6 +73,14 @@
72#define S3C2410_TCFG1_MUX_TCLK (4<<0) 73#define S3C2410_TCFG1_MUX_TCLK (4<<0)
73#define S3C2410_TCFG1_MUX_MASK (15<<0) 74#define S3C2410_TCFG1_MUX_MASK (15<<0)
74 75
76#define S3C64XX_TCFG1_MUX_DIV1 (0<<0)
77#define S3C64XX_TCFG1_MUX_DIV2 (1<<0)
78#define S3C64XX_TCFG1_MUX_DIV4 (2<<0)
79#define S3C64XX_TCFG1_MUX_DIV8 (3<<0)
80#define S3C64XX_TCFG1_MUX_DIV16 (4<<0)
81#define S3C64XX_TCFG1_MUX_TCLK (5<<0) /* 3 sets of TCLK */
82#define S3C64XX_TCFG1_MUX_MASK (15<<0)
83
75#define S3C2410_TCFG1_SHIFT(x) ((x) * 4) 84#define S3C2410_TCFG1_SHIFT(x) ((x) * 4)
76 85
77/* for each timer, we have an count buffer, an compare buffer and 86/* for each timer, we have an count buffer, an compare buffer and
diff --git a/arch/arm/plat-s3c/include/plat/regs-watchdog.h b/arch/arm/plat-s3c/include/plat/regs-watchdog.h
new file mode 100644
index 000000000000..4938492470f7
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/regs-watchdog.h
@@ -0,0 +1,41 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-watchdog.h
2 *
3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2410 Watchdog timer control
11*/
12
13
14#ifndef __ASM_ARCH_REGS_WATCHDOG_H
15#define __ASM_ARCH_REGS_WATCHDOG_H
16
17#define S3C_WDOGREG(x) ((x) + S3C_VA_WATCHDOG)
18
19#define S3C2410_WTCON S3C_WDOGREG(0x00)
20#define S3C2410_WTDAT S3C_WDOGREG(0x04)
21#define S3C2410_WTCNT S3C_WDOGREG(0x08)
22
23/* the watchdog can either generate a reset pulse, or an
24 * interrupt.
25 */
26
27#define S3C2410_WTCON_RSTEN (0x01)
28#define S3C2410_WTCON_INTEN (1<<2)
29#define S3C2410_WTCON_ENABLE (1<<5)
30
31#define S3C2410_WTCON_DIV16 (0<<3)
32#define S3C2410_WTCON_DIV32 (1<<3)
33#define S3C2410_WTCON_DIV64 (2<<3)
34#define S3C2410_WTCON_DIV128 (3<<3)
35
36#define S3C2410_WTCON_PRESCALE(x) ((x) << 8)
37#define S3C2410_WTCON_PRESCALE_MASK (0xff00)
38
39#endif /* __ASM_ARCH_REGS_WATCHDOG_H */
40
41
diff --git a/arch/arm/plat-s3c/include/plat/sdhci.h b/arch/arm/plat-s3c/include/plat/sdhci.h
new file mode 100644
index 000000000000..c4ca3920ca4b
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/sdhci.h
@@ -0,0 +1,108 @@
1/* linux/arch/arm/plat-s3c/include/plat/sdhci.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * S3C Platform - SDHCI (HSMMC) platform data definitions
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#ifndef __PLAT_S3C_SDHCI_H
16#define __PLAT_S3C_SDHCI_H __FILE__
17
18struct platform_device;
19struct mmc_host;
20struct mmc_card;
21struct mmc_ios;
22
23/**
24 * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI
25 * @max_width: The maximum number of data bits supported.
26 * @host_caps: Standard MMC host capabilities bit field.
27 * @cfg_gpio: Configure the GPIO for a specific card bit-width
28 * @cfg_card: Configure the interface for a specific card and speed. This
29 * is necessary the controllers and/or GPIO blocks require the
30 * changing of driver-strength and other controls dependant on
31 * the card and speed of operation.
32 *
33 * Initialisation data specific to either the machine or the platform
34 * for the device driver to use or call-back when configuring gpio or
35 * card speed information.
36*/
37struct s3c_sdhci_platdata {
38 unsigned int max_width;
39 unsigned int host_caps;
40
41 char **clocks; /* set of clock sources */
42
43 void (*cfg_gpio)(struct platform_device *dev, int width);
44 void (*cfg_card)(struct platform_device *dev,
45 void __iomem *regbase,
46 struct mmc_ios *ios,
47 struct mmc_card *card);
48};
49
50/**
51 * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
52 * @pd: Platform data to register to device.
53 *
54 * Register the given platform data for use withe S3C SDHCI device.
55 * The call will copy the platform data, so the board definitions can
56 * make the structure itself __initdata.
57 */
58extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
59extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
60
61/* Default platform data, exported so that per-cpu initialisation can
62 * set the correct one when there are more than one cpu type selected.
63*/
64
65extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
66extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
67
68/* Helper function availablity */
69
70#ifdef CONFIG_S3C6410_SETUP_SDHCI
71extern char *s3c6410_hsmmc_clksrcs[4];
72
73extern void s3c6410_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
74extern void s3c6410_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
75
76extern void s3c6410_setup_sdhci0_cfg_card(struct platform_device *dev,
77 void __iomem *r,
78 struct mmc_ios *ios,
79 struct mmc_card *card);
80
81#ifdef CONFIG_S3C_DEV_HSMMC
82static inline void s3c6410_default_sdhci0(void)
83{
84 s3c_hsmmc0_def_platdata.clocks = s3c6410_hsmmc_clksrcs;
85 s3c_hsmmc0_def_platdata.cfg_gpio = s3c6410_setup_sdhci0_cfg_gpio;
86 s3c_hsmmc0_def_platdata.cfg_card = s3c6410_setup_sdhci0_cfg_card;
87}
88#else
89static inline void s3c6410_default_sdhci0(void) { }
90#endif /* CONFIG_S3C_DEV_HSMMC */
91
92#ifdef CONFIG_S3C_DEV_HSMMC1
93static inline void s3c6410_default_sdhci1(void)
94{
95 s3c_hsmmc1_def_platdata.clocks = s3c6410_hsmmc_clksrcs;
96 s3c_hsmmc1_def_platdata.cfg_gpio = s3c6410_setup_sdhci1_cfg_gpio;
97 s3c_hsmmc1_def_platdata.cfg_card = s3c6410_setup_sdhci0_cfg_card;
98}
99#else
100static inline void s3c6410_default_sdhci1(void) { }
101#endif /* CONFIG_S3C_DEV_HSMMC1 */
102
103#else
104static inline void s3c6410_default_sdhci0(void) { }
105static inline void s3c6410_default_sdhci1(void) { }
106#endif /* CONFIG_S3C6410_SETUP_SDHCI */
107
108#endif /* __PLAT_S3C_SDHCI_H */
diff --git a/arch/arm/plat-s3c/include/plat/uncompress.h b/arch/arm/plat-s3c/include/plat/uncompress.h
index 4df006b9cc10..6061de87f225 100644
--- a/arch/arm/plat-s3c/include/plat/uncompress.h
+++ b/arch/arm/plat-s3c/include/plat/uncompress.h
@@ -28,7 +28,7 @@ static void arch_detect_cpu(void);
28/* defines for UART registers */ 28/* defines for UART registers */
29 29
30#include <plat/regs-serial.h> 30#include <plat/regs-serial.h>
31#include <asm/plat-s3c/regs-watchdog.h> 31#include <plat/regs-watchdog.h>
32 32
33/* working in physical space... */ 33/* working in physical space... */
34#undef S3C2410_WDOGREG 34#undef S3C2410_WDOGREG
@@ -37,7 +37,7 @@ static void arch_detect_cpu(void);
37/* how many bytes we allow into the FIFO at a time in FIFO mode */ 37/* how many bytes we allow into the FIFO at a time in FIFO mode */
38#define FIFO_MAX (14) 38#define FIFO_MAX (14)
39 39
40#define uart_base S3C24XX_PA_UART + (0x4000*CONFIG_S3C_LOWLEVEL_UART_PORT) 40#define uart_base S3C_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT)
41 41
42static __inline__ void 42static __inline__ void
43uart_wr(unsigned int reg, unsigned int val) 43uart_wr(unsigned int reg, unsigned int val)
@@ -139,6 +139,28 @@ static void arch_decomp_error(const char *x)
139 139
140static void error(char *err); 140static void error(char *err);
141 141
142#ifdef CONFIG_S3C_BOOT_UART_FORCE_FIFO
143static inline void arch_enable_uart_fifo(void)
144{
145 u32 fifocon = uart_rd(S3C2410_UFCON);
146
147 if (!(fifocon & S3C2410_UFCON_FIFOMODE)) {
148 fifocon |= S3C2410_UFCON_RESETBOTH;
149 uart_wr(S3C2410_UFCON, fifocon);
150
151 /* wait for fifo reset to complete */
152 while (1) {
153 fifocon = uart_rd(S3C2410_UFCON);
154 if (!(fifocon & S3C2410_UFCON_RESETBOTH))
155 break;
156 }
157 }
158}
159#else
160#define arch_enable_uart_fifo() do { } while(0)
161#endif
162
163
142static void 164static void
143arch_decomp_setup(void) 165arch_decomp_setup(void)
144{ 166{
@@ -149,6 +171,12 @@ arch_decomp_setup(void)
149 171
150 arch_detect_cpu(); 172 arch_detect_cpu();
151 arch_decomp_wdog_start(); 173 arch_decomp_wdog_start();
174
175 /* Enable the UART FIFOs if they where not enabled and our
176 * configuration says we should turn them on.
177 */
178
179 arch_enable_uart_fifo();
152} 180}
153 181
154 182
diff --git a/arch/arm/plat-s3c/init.c b/arch/arm/plat-s3c/init.c
new file mode 100644
index 000000000000..6790edfaca6f
--- /dev/null
+++ b/arch/arm/plat-s3c/init.c
@@ -0,0 +1,160 @@
1/* linux/arch/arm/plat-s3c/init.c
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * S3C series CPU initialisation
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/init.h>
15#include <linux/module.h>
16#include <linux/interrupt.h>
17#include <linux/ioport.h>
18#include <linux/serial_core.h>
19#include <linux/platform_device.h>
20
21#include <mach/hardware.h>
22
23#include <asm/mach/arch.h>
24#include <asm/mach/map.h>
25
26#include <plat/cpu.h>
27#include <plat/devs.h>
28#include <plat/clock.h>
29
30#include <plat/regs-serial.h>
31
32static struct cpu_table *cpu;
33
34static struct cpu_table * __init s3c_lookup_cpu(unsigned long idcode,
35 struct cpu_table *tab,
36 unsigned int count)
37{
38 for (; count != 0; count--, tab++) {
39 if ((idcode & tab->idmask) == tab->idcode)
40 return tab;
41 }
42
43 return NULL;
44}
45
46void __init s3c_init_cpu(unsigned long idcode,
47 struct cpu_table *cputab, unsigned int cputab_size)
48{
49 cpu = s3c_lookup_cpu(idcode, cputab, cputab_size);
50
51 if (cpu == NULL) {
52 printk(KERN_ERR "Unknown CPU type 0x%08lx\n", idcode);
53 panic("Unknown S3C24XX CPU");
54 }
55
56 printk("CPU %s (id 0x%08lx)\n", cpu->name, idcode);
57
58 if (cpu->map_io == NULL || cpu->init == NULL) {
59 printk(KERN_ERR "CPU %s support not enabled\n", cpu->name);
60 panic("Unsupported Samsung CPU");
61 }
62
63 cpu->map_io();
64}
65
66/* s3c24xx_init_clocks
67 *
68 * Initialise the clock subsystem and associated information from the
69 * given master crystal value.
70 *
71 * xtal = 0 -> use default PLL crystal value (normally 12MHz)
72 * != 0 -> PLL crystal value in Hz
73*/
74
75void __init s3c24xx_init_clocks(int xtal)
76{
77 if (xtal == 0)
78 xtal = 12*1000*1000;
79
80 if (cpu == NULL)
81 panic("s3c24xx_init_clocks: no cpu setup?\n");
82
83 if (cpu->init_clocks == NULL)
84 panic("s3c24xx_init_clocks: cpu has no clock init\n");
85 else
86 (cpu->init_clocks)(xtal);
87}
88
89/* uart management */
90
91static int nr_uarts __initdata = 0;
92
93static struct s3c2410_uartcfg uart_cfgs[CONFIG_SERIAL_SAMSUNG_UARTS];
94
95/* s3c24xx_init_uartdevs
96 *
97 * copy the specified platform data and configuration into our central
98 * set of devices, before the data is thrown away after the init process.
99 *
100 * This also fills in the array passed to the serial driver for the
101 * early initialisation of the console.
102*/
103
104void __init s3c24xx_init_uartdevs(char *name,
105 struct s3c24xx_uart_resources *res,
106 struct s3c2410_uartcfg *cfg, int no)
107{
108 struct platform_device *platdev;
109 struct s3c2410_uartcfg *cfgptr = uart_cfgs;
110 struct s3c24xx_uart_resources *resp;
111 int uart;
112
113 memcpy(cfgptr, cfg, sizeof(struct s3c2410_uartcfg) * no);
114
115 for (uart = 0; uart < no; uart++, cfg++, cfgptr++) {
116 platdev = s3c24xx_uart_src[cfgptr->hwport];
117
118 resp = res + cfgptr->hwport;
119
120 s3c24xx_uart_devs[uart] = platdev;
121
122 platdev->name = name;
123 platdev->resource = resp->resources;
124 platdev->num_resources = resp->nr_resources;
125
126 platdev->dev.platform_data = cfgptr;
127 }
128
129 nr_uarts = no;
130}
131
132void __init s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no)
133{
134 if (cpu == NULL)
135 return;
136
137 if (cpu->init_uarts == NULL) {
138 printk(KERN_ERR "s3c24xx_init_uarts: cpu has no uart init\n");
139 } else
140 (cpu->init_uarts)(cfg, no);
141}
142
143static int __init s3c_arch_init(void)
144{
145 int ret;
146
147 // do the correct init for cpu
148
149 if (cpu == NULL)
150 panic("s3c_arch_init: NULL cpu\n");
151
152 ret = (cpu->init)();
153 if (ret != 0)
154 return ret;
155
156 ret = platform_add_devices(s3c24xx_uart_devs, nr_uarts);
157 return ret;
158}
159
160arch_initcall(s3c_arch_init);
diff --git a/arch/arm/plat-s3c24xx/pwm-clock.c b/arch/arm/plat-s3c/pwm-clock.c
index 3fad68a1e6bc..a318215ab535 100644
--- a/arch/arm/plat-s3c24xx/pwm-clock.c
+++ b/arch/arm/plat-s3c/pwm-clock.c
@@ -14,20 +14,20 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/log2.h>
17#include <linux/clk.h> 18#include <linux/clk.h>
18#include <linux/err.h> 19#include <linux/err.h>
19#include <linux/io.h> 20#include <linux/io.h>
20 21
21#include <mach/hardware.h> 22#include <mach/hardware.h>
23#include <mach/map.h>
22#include <asm/irq.h> 24#include <asm/irq.h>
23 25
24#include <mach/regs-clock.h>
25#include <mach/regs-gpio.h>
26
27#include <plat/clock.h> 26#include <plat/clock.h>
28#include <plat/cpu.h> 27#include <plat/cpu.h>
29 28
30#include <plat/regs-timer.h> 29#include <plat/regs-timer.h>
30#include <mach/pwm-clock.h>
31 31
32/* Each of the timers 0 through 5 go through the following 32/* Each of the timers 0 through 5 go through the following
33 * clock tree, with the inputs depending on the timers. 33 * clock tree, with the inputs depending on the timers.
@@ -73,11 +73,13 @@
73 * tclk -------------------------/ 73 * tclk -------------------------/
74*/ 74*/
75 75
76static unsigned long clk_pwm_scaler_getrate(struct clk *clk) 76static struct clk clk_timer_scaler[];
77
78static unsigned long clk_pwm_scaler_get_rate(struct clk *clk)
77{ 79{
78 unsigned long tcfg0 = __raw_readl(S3C2410_TCFG0); 80 unsigned long tcfg0 = __raw_readl(S3C2410_TCFG0);
79 81
80 if (clk->id == 1) { 82 if (clk == &clk_timer_scaler[1]) {
81 tcfg0 &= S3C2410_TCFG_PRESCALER1_MASK; 83 tcfg0 &= S3C2410_TCFG_PRESCALER1_MASK;
82 tcfg0 >>= S3C2410_TCFG_PRESCALER1_SHIFT; 84 tcfg0 >>= S3C2410_TCFG_PRESCALER1_SHIFT;
83 } else { 85 } else {
@@ -87,18 +89,61 @@ static unsigned long clk_pwm_scaler_getrate(struct clk *clk)
87 return clk_get_rate(clk->parent) / (tcfg0 + 1); 89 return clk_get_rate(clk->parent) / (tcfg0 + 1);
88} 90}
89 91
90/* TODO - add set rate calls. */ 92static unsigned long clk_pwm_scaler_round_rate(struct clk *clk,
93 unsigned long rate)
94{
95 unsigned long parent_rate = clk_get_rate(clk->parent);
96 unsigned long divisor = parent_rate / rate;
97
98 if (divisor > 256)
99 divisor = 256;
100 else if (divisor < 2)
101 divisor = 2;
102
103 return parent_rate / divisor;
104}
105
106static int clk_pwm_scaler_set_rate(struct clk *clk, unsigned long rate)
107{
108 unsigned long round = clk_pwm_scaler_round_rate(clk, rate);
109 unsigned long tcfg0;
110 unsigned long divisor;
111 unsigned long flags;
112
113 divisor = clk_get_rate(clk->parent) / round;
114 divisor--;
115
116 local_irq_save(flags);
117 tcfg0 = __raw_readl(S3C2410_TCFG0);
118
119 if (clk == &clk_timer_scaler[1]) {
120 tcfg0 &= ~S3C2410_TCFG_PRESCALER1_MASK;
121 tcfg0 |= divisor << S3C2410_TCFG_PRESCALER1_SHIFT;
122 } else {
123 tcfg0 &= ~S3C2410_TCFG_PRESCALER0_MASK;
124 tcfg0 |= divisor;
125 }
126
127 __raw_writel(tcfg0, S3C2410_TCFG0);
128 local_irq_restore(flags);
129
130 return 0;
131}
91 132
92static struct clk clk_timer_scaler[] = { 133static struct clk clk_timer_scaler[] = {
93 [0] = { 134 [0] = {
94 .name = "pwm-scaler0", 135 .name = "pwm-scaler0",
95 .id = -1, 136 .id = -1,
96 .get_rate = clk_pwm_scaler_getrate, 137 .get_rate = clk_pwm_scaler_get_rate,
138 .set_rate = clk_pwm_scaler_set_rate,
139 .round_rate = clk_pwm_scaler_round_rate,
97 }, 140 },
98 [1] = { 141 [1] = {
99 .name = "pwm-scaler1", 142 .name = "pwm-scaler1",
100 .id = -1, 143 .id = -1,
101 .get_rate = clk_pwm_scaler_getrate, 144 .get_rate = clk_pwm_scaler_get_rate,
145 .set_rate = clk_pwm_scaler_set_rate,
146 .round_rate = clk_pwm_scaler_round_rate,
102 }, 147 },
103}; 148};
104 149
@@ -123,11 +168,6 @@ static inline struct pwm_tdiv_clk *to_tdiv(struct clk *clk)
123 return container_of(clk, struct pwm_tdiv_clk, clk); 168 return container_of(clk, struct pwm_tdiv_clk, clk);
124} 169}
125 170
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) 171static unsigned long clk_pwm_tdiv_get_rate(struct clk *clk)
132{ 172{
133 unsigned long tcfg1 = __raw_readl(S3C2410_TCFG1); 173 unsigned long tcfg1 = __raw_readl(S3C2410_TCFG1);
@@ -136,7 +176,7 @@ static unsigned long clk_pwm_tdiv_get_rate(struct clk *clk)
136 tcfg1 >>= S3C2410_TCFG1_SHIFT(clk->id); 176 tcfg1 >>= S3C2410_TCFG1_SHIFT(clk->id);
137 tcfg1 &= S3C2410_TCFG1_MUX_MASK; 177 tcfg1 &= S3C2410_TCFG1_MUX_MASK;
138 178
139 if (tcfg1 == S3C2410_TCFG1_MUX_TCLK) 179 if (pwm_cfg_src_is_tclk(tcfg1))
140 divisor = to_tdiv(clk)->divisor; 180 divisor = to_tdiv(clk)->divisor;
141 else 181 else
142 divisor = tcfg_to_divisor(tcfg1); 182 divisor = tcfg_to_divisor(tcfg1);
@@ -153,7 +193,9 @@ static unsigned long clk_pwm_tdiv_round_rate(struct clk *clk,
153 parent_rate = clk_get_rate(clk->parent); 193 parent_rate = clk_get_rate(clk->parent);
154 divisor = parent_rate / rate; 194 divisor = parent_rate / rate;
155 195
156 if (divisor <= 2) 196 if (divisor <= 1 && pwm_tdiv_has_div1())
197 divisor = 1;
198 else if (divisor <= 2)
157 divisor = 2; 199 divisor = 2;
158 else if (divisor <= 4) 200 else if (divisor <= 4)
159 divisor = 4; 201 divisor = 4;
@@ -167,25 +209,7 @@ static unsigned long clk_pwm_tdiv_round_rate(struct clk *clk,
167 209
168static unsigned long clk_pwm_tdiv_bits(struct pwm_tdiv_clk *divclk) 210static unsigned long clk_pwm_tdiv_bits(struct pwm_tdiv_clk *divclk)
169{ 211{
170 unsigned long bits; 212 return pwm_tdiv_div_bits(divclk->divisor);
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} 213}
190 214
191static void clk_pwm_tdiv_update(struct pwm_tdiv_clk *divclk) 215static void clk_pwm_tdiv_update(struct pwm_tdiv_clk *divclk)
@@ -226,7 +250,7 @@ static int clk_pwm_tdiv_set_rate(struct clk *clk, unsigned long rate)
226 /* Update the current MUX settings if we are currently 250 /* Update the current MUX settings if we are currently
227 * selected as the clock source for this clock. */ 251 * selected as the clock source for this clock. */
228 252
229 if (tcfg1 != S3C2410_TCFG1_MUX_TCLK) 253 if (!pwm_cfg_src_is_tclk(tcfg1))
230 clk_pwm_tdiv_update(divclk); 254 clk_pwm_tdiv_update(divclk);
231 255
232 return 0; 256 return 0;
@@ -313,7 +337,7 @@ static int clk_pwm_tin_set_parent(struct clk *clk, struct clk *parent)
313 unsigned long shift = S3C2410_TCFG1_SHIFT(id); 337 unsigned long shift = S3C2410_TCFG1_SHIFT(id);
314 338
315 if (parent == s3c24xx_pwmclk_tclk(id)) 339 if (parent == s3c24xx_pwmclk_tclk(id))
316 bits = S3C2410_TCFG1_MUX_TCLK << shift; 340 bits = S3C_TCFG1_MUX_TCLK << shift;
317 else if (parent == s3c24xx_pwmclk_tdiv(id)) 341 else if (parent == s3c24xx_pwmclk_tdiv(id))
318 bits = clk_pwm_tdiv_bits(to_tdiv(parent)) << shift; 342 bits = clk_pwm_tdiv_bits(to_tdiv(parent)) << shift;
319 else 343 else
@@ -375,7 +399,7 @@ static __init int clk_pwm_tin_register(struct clk *pwm)
375 tcfg1 >>= S3C2410_TCFG1_SHIFT(id); 399 tcfg1 >>= S3C2410_TCFG1_SHIFT(id);
376 tcfg1 &= S3C2410_TCFG1_MUX_MASK; 400 tcfg1 &= S3C2410_TCFG1_MUX_MASK;
377 401
378 if (tcfg1 == S3C2410_TCFG1_MUX_TCLK) 402 if (pwm_cfg_src_is_tclk(tcfg1))
379 parent = s3c24xx_pwmclk_tclk(id); 403 parent = s3c24xx_pwmclk_tclk(id);
380 else 404 else
381 parent = s3c24xx_pwmclk_tdiv(id); 405 parent = s3c24xx_pwmclk_tdiv(id);
@@ -383,7 +407,16 @@ static __init int clk_pwm_tin_register(struct clk *pwm)
383 return clk_set_parent(pwm, parent); 407 return clk_set_parent(pwm, parent);
384} 408}
385 409
386static __init int s3c24xx_pwmclk_init(void) 410/**
411 * s3c_pwmclk_init() - initialise pwm clocks
412 *
413 * Initialise and register the clocks which provide the inputs for the
414 * pwm timer blocks.
415 *
416 * Note, this call is required by the time core, so must be called after
417 * the base clocks are added and before any of the initcalls are run.
418 */
419__init void s3c_pwmclk_init(void)
387{ 420{
388 struct clk *clk_timers; 421 struct clk *clk_timers;
389 unsigned int clk; 422 unsigned int clk;
@@ -392,7 +425,7 @@ static __init int s3c24xx_pwmclk_init(void)
392 clk_timers = clk_get(NULL, "timers"); 425 clk_timers = clk_get(NULL, "timers");
393 if (IS_ERR(clk_timers)) { 426 if (IS_ERR(clk_timers)) {
394 printk(KERN_ERR "%s: no parent clock\n", __func__); 427 printk(KERN_ERR "%s: no parent clock\n", __func__);
395 return -EINVAL; 428 return;
396 } 429 }
397 430
398 for (clk = 0; clk < ARRAY_SIZE(clk_timer_scaler); clk++) { 431 for (clk = 0; clk < ARRAY_SIZE(clk_timer_scaler); clk++) {
@@ -400,7 +433,7 @@ static __init int s3c24xx_pwmclk_init(void)
400 ret = s3c24xx_register_clock(&clk_timer_scaler[clk]); 433 ret = s3c24xx_register_clock(&clk_timer_scaler[clk]);
401 if (ret < 0) { 434 if (ret < 0) {
402 printk(KERN_ERR "error adding pwm scaler%d clock\n", clk); 435 printk(KERN_ERR "error adding pwm scaler%d clock\n", clk);
403 goto err; 436 return;
404 } 437 }
405 } 438 }
406 439
@@ -408,7 +441,7 @@ static __init int s3c24xx_pwmclk_init(void)
408 ret = s3c24xx_register_clock(&clk_timer_tclk[clk]); 441 ret = s3c24xx_register_clock(&clk_timer_tclk[clk]);
409 if (ret < 0) { 442 if (ret < 0) {
410 printk(KERN_ERR "error adding pww tclk%d\n", clk); 443 printk(KERN_ERR "error adding pww tclk%d\n", clk);
411 goto err; 444 return;
412 } 445 }
413 } 446 }
414 447
@@ -416,7 +449,7 @@ static __init int s3c24xx_pwmclk_init(void)
416 ret = clk_pwm_tdiv_register(clk); 449 ret = clk_pwm_tdiv_register(clk);
417 if (ret < 0) { 450 if (ret < 0) {
418 printk(KERN_ERR "error adding pwm%d tdiv clock\n", clk); 451 printk(KERN_ERR "error adding pwm%d tdiv clock\n", clk);
419 goto err; 452 return;
420 } 453 }
421 } 454 }
422 455
@@ -424,14 +457,7 @@ static __init int s3c24xx_pwmclk_init(void)
424 ret = clk_pwm_tin_register(&clk_tin[clk]); 457 ret = clk_pwm_tin_register(&clk_tin[clk]);
425 if (ret < 0) { 458 if (ret < 0) {
426 printk(KERN_ERR "error adding pwm%d tin clock\n", clk); 459 printk(KERN_ERR "error adding pwm%d tin clock\n", clk);
427 goto err; 460 return;
428 } 461 }
429 } 462 }
430
431 return 0;
432
433 err:
434 return ret;
435} 463}
436
437arch_initcall(s3c24xx_pwmclk_init);
diff --git a/arch/arm/plat-s3c24xx/time.c b/arch/arm/plat-s3c/time.c
index c51916236ac0..3b27b29da478 100644
--- a/arch/arm/plat-s3c24xx/time.c
+++ b/arch/arm/plat-s3c/time.c
@@ -26,6 +26,7 @@
26#include <linux/err.h> 26#include <linux/err.h>
27#include <linux/clk.h> 27#include <linux/clk.h>
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/platform_device.h>
29 30
30#include <asm/system.h> 31#include <asm/system.h>
31#include <asm/leds.h> 32#include <asm/leds.h>
@@ -36,6 +37,7 @@
36#include <plat/regs-timer.h> 37#include <plat/regs-timer.h>
37#include <mach/regs-irq.h> 38#include <mach/regs-irq.h>
38#include <asm/mach/time.h> 39#include <asm/mach/time.h>
40#include <mach/tick.h>
39 41
40#include <plat/clock.h> 42#include <plat/clock.h>
41#include <plat/cpu.h> 43#include <plat/cpu.h>
@@ -43,6 +45,10 @@
43static unsigned long timer_startval; 45static unsigned long timer_startval;
44static unsigned long timer_usec_ticks; 46static unsigned long timer_usec_ticks;
45 47
48#ifndef TICK_MAX
49#define TICK_MAX (0xffff)
50#endif
51
46#define TIMER_USEC_SHIFT 16 52#define TIMER_USEC_SHIFT 16
47 53
48/* we use the shifted arithmetic to work out the ratio of timer ticks 54/* we use the shifted arithmetic to work out the ratio of timer ticks
@@ -91,23 +97,19 @@ static inline unsigned long timer_ticks_to_usec(unsigned long ticks)
91 * IRQs are disabled before entering here from do_gettimeofday() 97 * IRQs are disabled before entering here from do_gettimeofday()
92 */ 98 */
93 99
94#define SRCPND_TIMER4 (1<<(IRQ_TIMER4 - IRQ_EINT0))
95
96static unsigned long s3c2410_gettimeoffset (void) 100static unsigned long s3c2410_gettimeoffset (void)
97{ 101{
98 unsigned long tdone; 102 unsigned long tdone;
99 unsigned long irqpend;
100 unsigned long tval; 103 unsigned long tval;
101 104
102 /* work out how many ticks have gone since last timer interrupt */ 105 /* work out how many ticks have gone since last timer interrupt */
103 106
104 tval = __raw_readl(S3C2410_TCNTO(4)); 107 tval = __raw_readl(S3C2410_TCNTO(4));
105 tdone = timer_startval - tval; 108 tdone = timer_startval - tval;
106 109
107 /* check to see if there is an interrupt pending */ 110 /* check to see if there is an interrupt pending */
108 111
109 irqpend = __raw_readl(S3C2410_SRCPND); 112 if (s3c24xx_ostimer_pending()) {
110 if (irqpend & SRCPND_TIMER4) {
111 /* re-read the timer, and try and fix up for the missed 113 /* re-read the timer, and try and fix up for the missed
112 * interrupt. Note, the interrupt may go off before the 114 * interrupt. Note, the interrupt may go off before the
113 * timer has re-loaded from wrapping. 115 * timer has re-loaded from wrapping.
@@ -144,7 +146,11 @@ static struct irqaction s3c2410_timer_irq = {
144 machine_is_bast() || \ 146 machine_is_bast() || \
145 machine_is_vr1000() || \ 147 machine_is_vr1000() || \
146 machine_is_anubis() || \ 148 machine_is_anubis() || \
147 machine_is_osiris() ) 149 machine_is_osiris())
150
151static struct clk *tin;
152static struct clk *tdiv;
153static struct clk *timerclk;
148 154
149/* 155/*
150 * Set up timer interrupt, and return the current time in seconds. 156 * Set up timer interrupt, and return the current time in seconds.
@@ -159,13 +165,7 @@ static void s3c2410_timer_setup (void)
159 unsigned long tcfg1; 165 unsigned long tcfg1;
160 unsigned long tcfg0; 166 unsigned long tcfg0;
161 167
162 tcnt = 0xffff; /* default value for tcnt */ 168 tcnt = TICK_MAX; /* default value for tcnt */
163
164 /* read the current timer configuration bits */
165
166 tcon = __raw_readl(S3C2410_TCON);
167 tcfg1 = __raw_readl(S3C2410_TCFG1);
168 tcfg0 = __raw_readl(S3C2410_TCFG0);
169 169
170 /* configure the system for whichever machine is in use */ 170 /* configure the system for whichever machine is in use */
171 171
@@ -174,11 +174,13 @@ static void s3c2410_timer_setup (void)
174 timer_usec_ticks = timer_mask_usec_ticks(1, 12000000); 174 timer_usec_ticks = timer_mask_usec_ticks(1, 12000000);
175 tcnt = 12000000 / HZ; 175 tcnt = 12000000 / HZ;
176 176
177 tcfg1 = __raw_readl(S3C2410_TCFG1);
177 tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK; 178 tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK;
178 tcfg1 |= S3C2410_TCFG1_MUX4_TCLK1; 179 tcfg1 |= S3C2410_TCFG1_MUX4_TCLK1;
180 __raw_writel(tcfg1, S3C2410_TCFG1);
179 } else { 181 } else {
180 unsigned long pclk; 182 unsigned long pclk;
181 struct clk *clk; 183 struct clk *tscaler;
182 184
183 /* for the h1940 (and others), we use the pclk from the core 185 /* for the h1940 (and others), we use the pclk from the core
184 * to generate the timer values. since values around 50 to 186 * to generate the timer values. since values around 50 to
@@ -189,38 +191,34 @@ static void s3c2410_timer_setup (void)
189 * (8.45 ticks per usec) 191 * (8.45 ticks per usec)
190 */ 192 */
191 193
192 /* this is used as default if no other timer can be found */ 194 pclk = clk_get_rate(timerclk);
193
194 clk = clk_get(NULL, "timers");
195 if (IS_ERR(clk))
196 panic("failed to get clock for system timer");
197
198 clk_enable(clk);
199
200 pclk = clk_get_rate(clk);
201 195
202 /* configure clock tick */ 196 /* configure clock tick */
203 197
204 timer_usec_ticks = timer_mask_usec_ticks(6, pclk); 198 timer_usec_ticks = timer_mask_usec_ticks(6, pclk);
205 199
206 tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK; 200 tscaler = clk_get_parent(tdiv);
207 tcfg1 |= S3C2410_TCFG1_MUX4_DIV2;
208 201
209 tcfg0 &= ~S3C2410_TCFG_PRESCALER1_MASK; 202 clk_set_rate(tscaler, pclk / 3);
210 tcfg0 |= ((6 - 1) / 2) << S3C2410_TCFG_PRESCALER1_SHIFT; 203 clk_set_rate(tdiv, pclk / 6);
204 clk_set_parent(tin, tdiv);
211 205
212 tcnt = (pclk / 6) / HZ; 206 tcnt = clk_get_rate(tin) / HZ;
213 } 207 }
214 208
209 tcon = __raw_readl(S3C2410_TCON);
210 tcfg0 = __raw_readl(S3C2410_TCFG0);
211 tcfg1 = __raw_readl(S3C2410_TCFG1);
212
215 /* timers reload after counting zero, so reduce the count by 1 */ 213 /* timers reload after counting zero, so reduce the count by 1 */
216 214
217 tcnt--; 215 tcnt--;
218 216
219 printk("timer tcon=%08lx, tcnt %04lx, tcfg %08lx,%08lx, usec %08lx\n", 217 printk(KERN_DEBUG "timer tcon=%08lx, tcnt %04lx, tcfg %08lx,%08lx, usec %08lx\n",
220 tcon, tcnt, tcfg0, tcfg1, timer_usec_ticks); 218 tcon, tcnt, tcfg0, tcfg1, timer_usec_ticks);
221 219
222 /* check to see if timer is within 16bit range... */ 220 /* check to see if timer is within 16bit range... */
223 if (tcnt > 0xffff) { 221 if (tcnt > TICK_MAX) {
224 panic("setup_timer: HZ is too small, cannot configure timer!"); 222 panic("setup_timer: HZ is too small, cannot configure timer!");
225 return; 223 return;
226 } 224 }
@@ -247,8 +245,35 @@ static void s3c2410_timer_setup (void)
247 __raw_writel(tcon, S3C2410_TCON); 245 __raw_writel(tcon, S3C2410_TCON);
248} 246}
249 247
250static void __init s3c2410_timer_init (void) 248static void __init s3c2410_timer_resources(void)
249{
250 struct platform_device tmpdev;
251
252 tmpdev.dev.bus = &platform_bus_type;
253 tmpdev.id = 4;
254
255 timerclk = clk_get(NULL, "timers");
256 if (IS_ERR(timerclk))
257 panic("failed to get clock for system timer");
258
259 clk_enable(timerclk);
260
261 if (!use_tclk1_12()) {
262 tin = clk_get(&tmpdev.dev, "pwm-tin");
263 if (IS_ERR(tin))
264 panic("failed to get pwm-tin clock for system timer");
265
266 tdiv = clk_get(&tmpdev.dev, "pwm-tdiv");
267 if (IS_ERR(tdiv))
268 panic("failed to get pwm-tdiv clock for system timer");
269 }
270
271 clk_enable(tin);
272}
273
274static void __init s3c2410_timer_init(void)
251{ 275{
276 s3c2410_timer_resources();
252 s3c2410_timer_setup(); 277 s3c2410_timer_setup();
253 setup_irq(IRQ_TIMER4, &s3c2410_timer_irq); 278 setup_irq(IRQ_TIMER4, &s3c2410_timer_irq);
254} 279}
diff --git a/arch/arm/plat-s3c24xx/Kconfig b/arch/arm/plat-s3c24xx/Kconfig
index 0af3872fb763..2c8a2f5d75ff 100644
--- a/arch/arm/plat-s3c24xx/Kconfig
+++ b/arch/arm/plat-s3c24xx/Kconfig
@@ -6,8 +6,8 @@
6 6
7config PLAT_S3C24XX 7config PLAT_S3C24XX
8 bool 8 bool
9 depends on ARCH_S3C2410 9 depends on ARCH_S3C2410 || ARCH_S3C24A0
10 default y if ARCH_S3C2410 10 default y
11 select NO_IOPORT 11 select NO_IOPORT
12 select ARCH_REQUIRE_GPIOLIB 12 select ARCH_REQUIRE_GPIOLIB
13 help 13 help
@@ -15,6 +15,19 @@ config PLAT_S3C24XX
15 15
16if PLAT_S3C24XX 16if PLAT_S3C24XX
17 17
18# code that is shared between a number of the s3c24xx implementations
19
20config S3C2410_CLOCK
21 bool
22 help
23 Clock code for the S3C2410, and similar processors which
24 is currently includes the S3C2410, S3C2440, S3C2442.
25
26config S3C24XX_DCLK
27 bool
28 help
29 Clock code for supporting DCLK/CLKOUT on S3C24XX architectures
30
18config CPU_S3C244X 31config CPU_S3C244X
19 bool 32 bool
20 depends on ARCH_S3C2410 && (CPU_S3C2440 || CPU_S3C2442) 33 depends on ARCH_S3C2410 && (CPU_S3C2440 || CPU_S3C2442)
@@ -28,6 +41,27 @@ config S3C24XX_PWM
28 Support for exporting the PWM timer blocks via the pwm device 41 Support for exporting the PWM timer blocks via the pwm device
29 system. 42 system.
30 43
44
45# gpio configurations
46
47config S3C24XX_GPIO_EXTRA
48 int
49 default 128 if S3C24XX_GPIO_EXTRA128
50 default 64 if S3C24XX_GPIO_EXTRA64
51 default 0
52
53config S3C24XX_GPIO_EXTRA64
54 bool
55 help
56 Add an extra 64 gpio numbers to the available GPIO pool. This is
57 available for boards that need extra gpios for external devices.
58
59config S3C24XX_GPIO_EXTRA128
60 bool
61 help
62 Add an extra 128 gpio numbers to the available GPIO pool. This is
63 available for boards that need extra gpios for external devices.
64
31config PM_SIMTEC 65config PM_SIMTEC
32 bool 66 bool
33 help 67 help
@@ -49,6 +83,29 @@ config S3C2410_DMA_DEBUG
49 Enable debugging output for the DMA code. This option sends info 83 Enable debugging output for the DMA code. This option sends info
50 to the kernel log, at priority KERN_DEBUG. 84 to the kernel log, at priority KERN_DEBUG.
51 85
86config S3C24XX_ADC
87 bool "ADC common driver support"
88 help
89 Core support for the ADC block found in the S3C24XX SoC systems
90 for drivers such as the touchscreen and hwmon to use to share
91 this resource.
92
93# SPI default pin configuration code
94
95config S3C24XX_SPI_BUS0_GPE11_GPE12_GPE13
96 bool
97 help
98 SPI GPIO configuration code for BUS0 when connected to
99 GPE11, GPE12 and GPE13.
100
101config S3C24XX_SPI_BUS1_GPG5_GPG6_GPG7
102 bool
103 help
104 SPI GPIO configuration code for BUS 1 when connected to
105 GPG5, GPG6 and GPG7.
106
107# common code for s3c24xx based machines, such as the SMDKs.
108
52config MACH_SMDK 109config MACH_SMDK
53 bool 110 bool
54 help 111 help
diff --git a/arch/arm/plat-s3c24xx/Makefile b/arch/arm/plat-s3c24xx/Makefile
index d82767b2b833..1e0767b266b8 100644
--- a/arch/arm/plat-s3c24xx/Makefile
+++ b/arch/arm/plat-s3c24xx/Makefile
@@ -17,9 +17,8 @@ obj-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 += gpiolib.o
20obj-y += time.o
21obj-y += clock.o 20obj-y += clock.o
22obj-y += pwm-clock.o 21obj-$(CONFIG_S3C24XX_DCLK) += clock-dclk.o
23 22
24# Architecture dependant builds 23# Architecture dependant builds
25 24
@@ -30,5 +29,18 @@ obj-$(CONFIG_PM_SIMTEC) += pm-simtec.o
30obj-$(CONFIG_PM) += pm.o 29obj-$(CONFIG_PM) += pm.o
31obj-$(CONFIG_PM) += sleep.o 30obj-$(CONFIG_PM) += sleep.o
32obj-$(CONFIG_HAVE_PWM) += pwm.o 31obj-$(CONFIG_HAVE_PWM) += pwm.o
32obj-$(CONFIG_S3C2410_CLOCK) += s3c2410-clock.o
33obj-$(CONFIG_S3C2410_DMA) += dma.o 33obj-$(CONFIG_S3C2410_DMA) += dma.o
34obj-$(CONFIG_S3C24XX_ADC) += adc.o
35
36# device specific setup and/or initialisation
37obj-$(CONFIG_ARCH_S3C2410) += setup-i2c.o
38
39# SPI gpio central GPIO functions
40
41obj-$(CONFIG_S3C24XX_SPI_BUS0_GPE11_GPE12_GPE13) += spi-bus0-gpe11_12_13.o
42obj-$(CONFIG_S3C24XX_SPI_BUS1_GPG5_GPG6_GPG7) += spi-bus1-gpg5_6_7.o
43
44# machine common support
45
34obj-$(CONFIG_MACH_SMDK) += common-smdk.o 46obj-$(CONFIG_MACH_SMDK) += common-smdk.o
diff --git a/arch/arm/plat-s3c24xx/adc.c b/arch/arm/plat-s3c24xx/adc.c
new file mode 100644
index 000000000000..9a5c767e0a42
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/adc.c
@@ -0,0 +1,372 @@
1/* arch/arm/plat-s3c24xx/adc.c
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>, <ben-linux@fluff.org>
6 *
7 * S3C24XX ADC 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/list.h>
18#include <linux/err.h>
19#include <linux/clk.h>
20#include <linux/interrupt.h>
21#include <linux/io.h>
22
23#include <plat/regs-adc.h>
24#include <plat/adc.h>
25
26/* This driver is designed to control the usage of the ADC block between
27 * the touchscreen and any other drivers that may need to use it, such as
28 * the hwmon driver.
29 *
30 * Priority will be given to the touchscreen driver, but as this itself is
31 * rate limited it should not starve other requests which are processed in
32 * order that they are received.
33 *
34 * Each user registers to get a client block which uniquely identifies it
35 * and stores information such as the necessary functions to callback when
36 * action is required.
37 */
38
39struct s3c_adc_client {
40 struct platform_device *pdev;
41 struct list_head pend;
42
43 unsigned int nr_samples;
44 unsigned char is_ts;
45 unsigned char channel;
46
47 void (*select_cb)(unsigned selected);
48 void (*convert_cb)(unsigned val1, unsigned val2);
49};
50
51struct adc_device {
52 struct platform_device *pdev;
53 struct platform_device *owner;
54 struct clk *clk;
55 struct s3c_adc_client *cur;
56 struct s3c_adc_client *ts_pend;
57 void __iomem *regs;
58
59 unsigned int prescale;
60
61 int irq;
62};
63
64static struct adc_device *adc_dev;
65
66static LIST_HEAD(adc_pending);
67
68#define adc_dbg(_adc, msg...) dev_dbg(&(_adc)->pdev->dev, msg)
69
70static inline void s3c_adc_convert(struct adc_device *adc)
71{
72 unsigned con = readl(adc->regs + S3C2410_ADCCON);
73
74 con |= S3C2410_ADCCON_ENABLE_START;
75 writel(con, adc->regs + S3C2410_ADCCON);
76}
77
78static inline void s3c_adc_select(struct adc_device *adc,
79 struct s3c_adc_client *client)
80{
81 unsigned con = readl(adc->regs + S3C2410_ADCCON);
82
83 client->select_cb(1);
84
85 con &= ~S3C2410_ADCCON_MUXMASK;
86 con &= ~S3C2410_ADCCON_STDBM;
87 con &= ~S3C2410_ADCCON_STARTMASK;
88
89 if (!client->is_ts)
90 con |= S3C2410_ADCCON_SELMUX(client->channel);
91
92 writel(con, adc->regs + S3C2410_ADCCON);
93}
94
95static void s3c_adc_dbgshow(struct adc_device *adc)
96{
97 adc_dbg(adc, "CON=%08x, TSC=%08x, DLY=%08x\n",
98 readl(adc->regs + S3C2410_ADCCON),
99 readl(adc->regs + S3C2410_ADCTSC),
100 readl(adc->regs + S3C2410_ADCDLY));
101}
102
103void s3c_adc_try(struct adc_device *adc)
104{
105 struct s3c_adc_client *next = adc->ts_pend;
106
107 if (!next && !list_empty(&adc_pending)) {
108 next = list_first_entry(&adc_pending,
109 struct s3c_adc_client, pend);
110 list_del(&next->pend);
111 } else
112 adc->ts_pend = NULL;
113
114 if (next) {
115 adc_dbg(adc, "new client is %p\n", next);
116 adc->cur = next;
117 s3c_adc_select(adc, next);
118 s3c_adc_convert(adc);
119 s3c_adc_dbgshow(adc);
120 }
121}
122
123int s3c_adc_start(struct s3c_adc_client *client,
124 unsigned int channel, unsigned int nr_samples)
125{
126 struct adc_device *adc = adc_dev;
127 unsigned long flags;
128
129 if (!adc) {
130 printk(KERN_ERR "%s: failed to find adc\n", __func__);
131 return -EINVAL;
132 }
133
134 if (client->is_ts && adc->ts_pend)
135 return -EAGAIN;
136
137 local_irq_save(flags);
138
139 client->channel = channel;
140 client->nr_samples = nr_samples;
141
142 if (client->is_ts)
143 adc->ts_pend = client;
144 else
145 list_add_tail(&client->pend, &adc_pending);
146
147 if (!adc->cur)
148 s3c_adc_try(adc);
149 local_irq_restore(flags);
150
151 return 0;
152}
153EXPORT_SYMBOL_GPL(s3c_adc_start);
154
155static void s3c_adc_default_select(unsigned select)
156{
157}
158
159struct s3c_adc_client *s3c_adc_register(struct platform_device *pdev,
160 void (*select)(unsigned int selected),
161 void (*conv)(unsigned d0, unsigned d1),
162 unsigned int is_ts)
163{
164 struct s3c_adc_client *client;
165
166 WARN_ON(!pdev);
167 WARN_ON(!conv);
168
169 if (!select)
170 select = s3c_adc_default_select;
171
172 if (!conv || !pdev)
173 return ERR_PTR(-EINVAL);
174
175 client = kzalloc(sizeof(struct s3c_adc_client), GFP_KERNEL);
176 if (!client) {
177 dev_err(&pdev->dev, "no memory for adc client\n");
178 return ERR_PTR(-ENOMEM);
179 }
180
181 client->pdev = pdev;
182 client->is_ts = is_ts;
183 client->select_cb = select;
184 client->convert_cb = conv;
185
186 return client;
187}
188EXPORT_SYMBOL_GPL(s3c_adc_register);
189
190void s3c_adc_release(struct s3c_adc_client *client)
191{
192 /* We should really check that nothing is in progress. */
193 kfree(client);
194}
195EXPORT_SYMBOL_GPL(s3c_adc_release);
196
197static irqreturn_t s3c_adc_irq(int irq, void *pw)
198{
199 struct adc_device *adc = pw;
200 struct s3c_adc_client *client = adc->cur;
201 unsigned long flags;
202 unsigned data0, data1;
203
204 if (!client) {
205 dev_warn(&adc->pdev->dev, "%s: no adc pending\n", __func__);
206 return IRQ_HANDLED;
207 }
208
209 data0 = readl(adc->regs + S3C2410_ADCDAT0);
210 data1 = readl(adc->regs + S3C2410_ADCDAT1);
211 adc_dbg(adc, "read %d: 0x%04x, 0x%04x\n", client->nr_samples, data0, data1);
212
213 (client->convert_cb)(data0 & 0x3ff, data1 & 0x3ff);
214
215 if (--client->nr_samples > 0) {
216 /* fire another conversion for this */
217
218 client->select_cb(1);
219 s3c_adc_convert(adc);
220 } else {
221 local_irq_save(flags);
222 (client->select_cb)(0);
223 adc->cur = NULL;
224
225 s3c_adc_try(adc);
226 local_irq_restore(flags);
227 }
228
229 return IRQ_HANDLED;
230}
231
232static int s3c_adc_probe(struct platform_device *pdev)
233{
234 struct device *dev = &pdev->dev;
235 struct adc_device *adc;
236 struct resource *regs;
237 int ret;
238
239 adc = kzalloc(sizeof(struct adc_device), GFP_KERNEL);
240 if (adc == NULL) {
241 dev_err(dev, "failed to allocate adc_device\n");
242 return -ENOMEM;
243 }
244
245 adc->pdev = pdev;
246 adc->prescale = S3C2410_ADCCON_PRSCVL(49);
247
248 adc->irq = platform_get_irq(pdev, 1);
249 if (adc->irq <= 0) {
250 dev_err(dev, "failed to get adc irq\n");
251 ret = -ENOENT;
252 goto err_alloc;
253 }
254
255 ret = request_irq(adc->irq, s3c_adc_irq, 0, dev_name(dev), adc);
256 if (ret < 0) {
257 dev_err(dev, "failed to attach adc irq\n");
258 goto err_alloc;
259 }
260
261 adc->clk = clk_get(dev, "adc");
262 if (IS_ERR(adc->clk)) {
263 dev_err(dev, "failed to get adc clock\n");
264 ret = PTR_ERR(adc->clk);
265 goto err_irq;
266 }
267
268 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
269 if (!regs) {
270 dev_err(dev, "failed to find registers\n");
271 ret = -ENXIO;
272 goto err_clk;
273 }
274
275 adc->regs = ioremap(regs->start, resource_size(regs));
276 if (!adc->regs) {
277 dev_err(dev, "failed to map registers\n");
278 ret = -ENXIO;
279 goto err_clk;
280 }
281
282 clk_enable(adc->clk);
283
284 writel(adc->prescale | S3C2410_ADCCON_PRSCEN,
285 adc->regs + S3C2410_ADCCON);
286
287 dev_info(dev, "attached adc driver\n");
288
289 platform_set_drvdata(pdev, adc);
290 adc_dev = adc;
291
292 return 0;
293
294 err_clk:
295 clk_put(adc->clk);
296
297 err_irq:
298 free_irq(adc->irq, adc);
299
300 err_alloc:
301 kfree(adc);
302 return ret;
303}
304
305static int s3c_adc_remove(struct platform_device *pdev)
306{
307 struct adc_device *adc = platform_get_drvdata(pdev);
308
309 iounmap(adc->regs);
310 free_irq(adc->irq, adc);
311 clk_disable(adc->clk);
312 clk_put(adc->clk);
313 kfree(adc);
314
315 return 0;
316}
317
318#ifdef CONFIG_PM
319static int s3c_adc_suspend(struct platform_device *pdev, pm_message_t state)
320{
321 struct adc_device *adc = platform_get_drvdata(pdev);
322 u32 con;
323
324 con = readl(adc->regs + S3C2410_ADCCON);
325 con |= S3C2410_ADCCON_STDBM;
326 writel(con, adc->regs + S3C2410_ADCCON);
327
328 clk_disable(adc->clk);
329
330 return 0;
331}
332
333static int s3c_adc_resume(struct platform_device *pdev)
334{
335 struct adc_device *adc = platform_get_drvdata(pdev);
336
337 clk_enable(adc->clk);
338
339 writel(adc->prescale | S3C2410_ADCCON_PRSCEN,
340 adc->regs + S3C2410_ADCCON);
341
342 return 0;
343}
344
345#else
346#define s3c_adc_suspend NULL
347#define s3c_adc_resume NULL
348#endif
349
350static struct platform_driver s3c_adc_driver = {
351 .driver = {
352 .name = "s3c24xx-adc",
353 .owner = THIS_MODULE,
354 },
355 .probe = s3c_adc_probe,
356 .remove = __devexit_p(s3c_adc_remove),
357 .suspend = s3c_adc_suspend,
358 .resume = s3c_adc_resume,
359};
360
361static int __init adc_init(void)
362{
363 int ret;
364
365 ret = platform_driver_register(&s3c_adc_driver);
366 if (ret)
367 printk(KERN_ERR "%s: failed to add adc driver\n", __func__);
368
369 return ret;
370}
371
372arch_initcall(adc_init);
diff --git a/arch/arm/plat-s3c24xx/clock-dclk.c b/arch/arm/plat-s3c24xx/clock-dclk.c
new file mode 100644
index 000000000000..5b75a797b5ab
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/clock-dclk.c
@@ -0,0 +1,194 @@
1/* linux/arch/arm/plat-s3c24xx/clock-dclk.c
2 *
3 * Copyright (c) 2004,2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
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 * S3C24XX - definitions for DCLK and CLKOUT registers
12 */
13
14#include <linux/kernel.h>
15#include <linux/errno.h>
16#include <linux/clk.h>
17#include <linux/io.h>
18
19#include <mach/regs-clock.h>
20#include <mach/regs-gpio.h>
21
22#include <plat/clock.h>
23#include <plat/cpu.h>
24
25/* clocks that could be registered by external code */
26
27static int s3c24xx_dclk_enable(struct clk *clk, int enable)
28{
29 unsigned long dclkcon = __raw_readl(S3C24XX_DCLKCON);
30
31 if (enable)
32 dclkcon |= clk->ctrlbit;
33 else
34 dclkcon &= ~clk->ctrlbit;
35
36 __raw_writel(dclkcon, S3C24XX_DCLKCON);
37
38 return 0;
39}
40
41static int s3c24xx_dclk_setparent(struct clk *clk, struct clk *parent)
42{
43 unsigned long dclkcon;
44 unsigned int uclk;
45
46 if (parent == &clk_upll)
47 uclk = 1;
48 else if (parent == &clk_p)
49 uclk = 0;
50 else
51 return -EINVAL;
52
53 clk->parent = parent;
54
55 dclkcon = __raw_readl(S3C24XX_DCLKCON);
56
57 if (clk->ctrlbit == S3C2410_DCLKCON_DCLK0EN) {
58 if (uclk)
59 dclkcon |= S3C2410_DCLKCON_DCLK0_UCLK;
60 else
61 dclkcon &= ~S3C2410_DCLKCON_DCLK0_UCLK;
62 } else {
63 if (uclk)
64 dclkcon |= S3C2410_DCLKCON_DCLK1_UCLK;
65 else
66 dclkcon &= ~S3C2410_DCLKCON_DCLK1_UCLK;
67 }
68
69 __raw_writel(dclkcon, S3C24XX_DCLKCON);
70
71 return 0;
72}
73static unsigned long s3c24xx_calc_div(struct clk *clk, unsigned long rate)
74{
75 unsigned long div;
76
77 if ((rate == 0) || !clk->parent)
78 return 0;
79
80 div = clk_get_rate(clk->parent) / rate;
81 if (div < 2)
82 div = 2;
83 else if (div > 16)
84 div = 16;
85
86 return div;
87}
88
89static unsigned long s3c24xx_round_dclk_rate(struct clk *clk,
90 unsigned long rate)
91{
92 unsigned long div = s3c24xx_calc_div(clk, rate);
93
94 if (div == 0)
95 return 0;
96
97 return clk_get_rate(clk->parent) / div;
98}
99
100static int s3c24xx_set_dclk_rate(struct clk *clk, unsigned long rate)
101{
102 unsigned long mask, data, div = s3c24xx_calc_div(clk, rate);
103
104 if (div == 0)
105 return -EINVAL;
106
107 if (clk == &s3c24xx_dclk0) {
108 mask = S3C2410_DCLKCON_DCLK0_DIV_MASK |
109 S3C2410_DCLKCON_DCLK0_CMP_MASK;
110 data = S3C2410_DCLKCON_DCLK0_DIV(div) |
111 S3C2410_DCLKCON_DCLK0_CMP((div + 1) / 2);
112 } else if (clk == &s3c24xx_dclk1) {
113 mask = S3C2410_DCLKCON_DCLK1_DIV_MASK |
114 S3C2410_DCLKCON_DCLK1_CMP_MASK;
115 data = S3C2410_DCLKCON_DCLK1_DIV(div) |
116 S3C2410_DCLKCON_DCLK1_CMP((div + 1) / 2);
117 } else
118 return -EINVAL;
119
120 clk->rate = clk_get_rate(clk->parent) / div;
121 __raw_writel(((__raw_readl(S3C24XX_DCLKCON) & ~mask) | data),
122 S3C24XX_DCLKCON);
123 return clk->rate;
124}
125static int s3c24xx_clkout_setparent(struct clk *clk, struct clk *parent)
126{
127 unsigned long mask;
128 unsigned long source;
129
130 /* calculate the MISCCR setting for the clock */
131
132 if (parent == &clk_xtal)
133 source = S3C2410_MISCCR_CLK0_MPLL;
134 else if (parent == &clk_upll)
135 source = S3C2410_MISCCR_CLK0_UPLL;
136 else if (parent == &clk_f)
137 source = S3C2410_MISCCR_CLK0_FCLK;
138 else if (parent == &clk_h)
139 source = S3C2410_MISCCR_CLK0_HCLK;
140 else if (parent == &clk_p)
141 source = S3C2410_MISCCR_CLK0_PCLK;
142 else if (clk == &s3c24xx_clkout0 && parent == &s3c24xx_dclk0)
143 source = S3C2410_MISCCR_CLK0_DCLK0;
144 else if (clk == &s3c24xx_clkout1 && parent == &s3c24xx_dclk1)
145 source = S3C2410_MISCCR_CLK0_DCLK0;
146 else
147 return -EINVAL;
148
149 clk->parent = parent;
150
151 if (clk == &s3c24xx_clkout0)
152 mask = S3C2410_MISCCR_CLK0_MASK;
153 else {
154 source <<= 4;
155 mask = S3C2410_MISCCR_CLK1_MASK;
156 }
157
158 s3c2410_modify_misccr(mask, source);
159 return 0;
160}
161
162/* external clock definitions */
163
164struct clk s3c24xx_dclk0 = {
165 .name = "dclk0",
166 .id = -1,
167 .ctrlbit = S3C2410_DCLKCON_DCLK0EN,
168 .enable = s3c24xx_dclk_enable,
169 .set_parent = s3c24xx_dclk_setparent,
170 .set_rate = s3c24xx_set_dclk_rate,
171 .round_rate = s3c24xx_round_dclk_rate,
172};
173
174struct clk s3c24xx_dclk1 = {
175 .name = "dclk1",
176 .id = -1,
177 .ctrlbit = S3C2410_DCLKCON_DCLK1EN,
178 .enable = s3c24xx_dclk_enable,
179 .set_parent = s3c24xx_dclk_setparent,
180 .set_rate = s3c24xx_set_dclk_rate,
181 .round_rate = s3c24xx_round_dclk_rate,
182};
183
184struct clk s3c24xx_clkout0 = {
185 .name = "clkout0",
186 .id = -1,
187 .set_parent = s3c24xx_clkout_setparent,
188};
189
190struct clk s3c24xx_clkout1 = {
191 .name = "clkout1",
192 .id = -1,
193 .set_parent = s3c24xx_clkout_setparent,
194};
diff --git a/arch/arm/plat-s3c24xx/clock.c b/arch/arm/plat-s3c24xx/clock.c
index a005ddbd9ef3..8474d05274bd 100644
--- a/arch/arm/plat-s3c24xx/clock.c
+++ b/arch/arm/plat-s3c24xx/clock.c
@@ -27,18 +27,8 @@
27*/ 27*/
28 28
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/module.h>
31#include <linux/kernel.h> 30#include <linux/kernel.h>
32#include <linux/list.h>
33#include <linux/errno.h>
34#include <linux/err.h>
35#include <linux/platform_device.h>
36#include <linux/sysdev.h>
37#include <linux/interrupt.h>
38#include <linux/ioport.h>
39#include <linux/clk.h> 31#include <linux/clk.h>
40#include <linux/mutex.h>
41#include <linux/delay.h>
42#include <linux/io.h> 32#include <linux/io.h>
43 33
44#include <mach/hardware.h> 34#include <mach/hardware.h>
@@ -47,490 +37,23 @@
47#include <mach/regs-clock.h> 37#include <mach/regs-clock.h>
48#include <mach/regs-gpio.h> 38#include <mach/regs-gpio.h>
49 39
40#include <plat/cpu-freq.h>
41
50#include <plat/clock.h> 42#include <plat/clock.h>
51#include <plat/cpu.h> 43#include <plat/cpu.h>
52 44#include <plat/pll.h>
53/* clock information */
54
55static LIST_HEAD(clocks);
56
57DEFINE_MUTEX(clocks_mutex);
58
59/* enable and disable calls for use with the clk struct */
60
61static int clk_null_enable(struct clk *clk, int enable)
62{
63 return 0;
64}
65
66/* Clock API calls */
67
68struct clk *clk_get(struct device *dev, const char *id)
69{
70 struct clk *p;
71 struct clk *clk = ERR_PTR(-ENOENT);
72 int idno;
73
74 if (dev == NULL || dev->bus != &platform_bus_type)
75 idno = -1;
76 else
77 idno = to_platform_device(dev)->id;
78
79 mutex_lock(&clocks_mutex);
80
81 list_for_each_entry(p, &clocks, list) {
82 if (p->id == idno &&
83 strcmp(id, p->name) == 0 &&
84 try_module_get(p->owner)) {
85 clk = p;
86 break;
87 }
88 }
89
90 /* check for the case where a device was supplied, but the
91 * clock that was being searched for is not device specific */
92
93 if (IS_ERR(clk)) {
94 list_for_each_entry(p, &clocks, list) {
95 if (p->id == -1 && strcmp(id, p->name) == 0 &&
96 try_module_get(p->owner)) {
97 clk = p;
98 break;
99 }
100 }
101 }
102
103 mutex_unlock(&clocks_mutex);
104 return clk;
105}
106
107void clk_put(struct clk *clk)
108{
109 module_put(clk->owner);
110}
111
112int clk_enable(struct clk *clk)
113{
114 if (IS_ERR(clk) || clk == NULL)
115 return -EINVAL;
116
117 clk_enable(clk->parent);
118
119 mutex_lock(&clocks_mutex);
120
121 if ((clk->usage++) == 0)
122 (clk->enable)(clk, 1);
123
124 mutex_unlock(&clocks_mutex);
125 return 0;
126}
127
128void clk_disable(struct clk *clk)
129{
130 if (IS_ERR(clk) || clk == NULL)
131 return;
132
133 mutex_lock(&clocks_mutex);
134
135 if ((--clk->usage) == 0)
136 (clk->enable)(clk, 0);
137
138 mutex_unlock(&clocks_mutex);
139 clk_disable(clk->parent);
140}
141
142
143unsigned long clk_get_rate(struct clk *clk)
144{
145 if (IS_ERR(clk))
146 return 0;
147
148 if (clk->rate != 0)
149 return clk->rate;
150
151 if (clk->get_rate != NULL)
152 return (clk->get_rate)(clk);
153
154 if (clk->parent != NULL)
155 return clk_get_rate(clk->parent);
156
157 return clk->rate;
158}
159
160long clk_round_rate(struct clk *clk, unsigned long rate)
161{
162 if (!IS_ERR(clk) && clk->round_rate)
163 return (clk->round_rate)(clk, rate);
164
165 return rate;
166}
167
168int clk_set_rate(struct clk *clk, unsigned long rate)
169{
170 int ret;
171
172 if (IS_ERR(clk))
173 return -EINVAL;
174
175 /* We do not default just do a clk->rate = rate as
176 * the clock may have been made this way by choice.
177 */
178
179 WARN_ON(clk->set_rate == NULL);
180
181 if (clk->set_rate == NULL)
182 return -EINVAL;
183
184 mutex_lock(&clocks_mutex);
185 ret = (clk->set_rate)(clk, rate);
186 mutex_unlock(&clocks_mutex);
187
188 return ret;
189}
190
191struct clk *clk_get_parent(struct clk *clk)
192{
193 return clk->parent;
194}
195
196int clk_set_parent(struct clk *clk, struct clk *parent)
197{
198 int ret = 0;
199
200 if (IS_ERR(clk))
201 return -EINVAL;
202
203 mutex_lock(&clocks_mutex);
204
205 if (clk->set_parent)
206 ret = (clk->set_parent)(clk, parent);
207
208 mutex_unlock(&clocks_mutex);
209
210 return ret;
211}
212
213EXPORT_SYMBOL(clk_get);
214EXPORT_SYMBOL(clk_put);
215EXPORT_SYMBOL(clk_enable);
216EXPORT_SYMBOL(clk_disable);
217EXPORT_SYMBOL(clk_get_rate);
218EXPORT_SYMBOL(clk_round_rate);
219EXPORT_SYMBOL(clk_set_rate);
220EXPORT_SYMBOL(clk_get_parent);
221EXPORT_SYMBOL(clk_set_parent);
222
223/* base clocks */
224
225static int clk_default_setrate(struct clk *clk, unsigned long rate)
226{
227 clk->rate = rate;
228 return 0;
229}
230
231struct clk clk_xtal = {
232 .name = "xtal",
233 .id = -1,
234 .rate = 0,
235 .parent = NULL,
236 .ctrlbit = 0,
237};
238
239struct clk clk_mpll = {
240 .name = "mpll",
241 .id = -1,
242 .set_rate = clk_default_setrate,
243};
244
245struct clk clk_upll = {
246 .name = "upll",
247 .id = -1,
248 .parent = NULL,
249 .ctrlbit = 0,
250};
251
252struct clk clk_f = {
253 .name = "fclk",
254 .id = -1,
255 .rate = 0,
256 .parent = &clk_mpll,
257 .ctrlbit = 0,
258 .set_rate = clk_default_setrate,
259};
260
261struct clk clk_h = {
262 .name = "hclk",
263 .id = -1,
264 .rate = 0,
265 .parent = NULL,
266 .ctrlbit = 0,
267 .set_rate = clk_default_setrate,
268};
269
270struct clk clk_p = {
271 .name = "pclk",
272 .id = -1,
273 .rate = 0,
274 .parent = NULL,
275 .ctrlbit = 0,
276 .set_rate = clk_default_setrate,
277};
278
279struct clk clk_usb_bus = {
280 .name = "usb-bus",
281 .id = -1,
282 .rate = 0,
283 .parent = &clk_upll,
284};
285
286/* clocks that could be registered by external code */
287
288static int s3c24xx_dclk_enable(struct clk *clk, int enable)
289{
290 unsigned long dclkcon = __raw_readl(S3C24XX_DCLKCON);
291
292 if (enable)
293 dclkcon |= clk->ctrlbit;
294 else
295 dclkcon &= ~clk->ctrlbit;
296
297 __raw_writel(dclkcon, S3C24XX_DCLKCON);
298
299 return 0;
300}
301
302static int s3c24xx_dclk_setparent(struct clk *clk, struct clk *parent)
303{
304 unsigned long dclkcon;
305 unsigned int uclk;
306
307 if (parent == &clk_upll)
308 uclk = 1;
309 else if (parent == &clk_p)
310 uclk = 0;
311 else
312 return -EINVAL;
313
314 clk->parent = parent;
315
316 dclkcon = __raw_readl(S3C24XX_DCLKCON);
317
318 if (clk->ctrlbit == S3C2410_DCLKCON_DCLK0EN) {
319 if (uclk)
320 dclkcon |= S3C2410_DCLKCON_DCLK0_UCLK;
321 else
322 dclkcon &= ~S3C2410_DCLKCON_DCLK0_UCLK;
323 } else {
324 if (uclk)
325 dclkcon |= S3C2410_DCLKCON_DCLK1_UCLK;
326 else
327 dclkcon &= ~S3C2410_DCLKCON_DCLK1_UCLK;
328 }
329
330 __raw_writel(dclkcon, S3C24XX_DCLKCON);
331
332 return 0;
333}
334
335static unsigned long s3c24xx_calc_div(struct clk *clk, unsigned long rate)
336{
337 unsigned long div;
338
339 if ((rate == 0) || !clk->parent)
340 return 0;
341
342 div = clk_get_rate(clk->parent) / rate;
343 if (div < 2)
344 div = 2;
345 else if (div > 16)
346 div = 16;
347
348 return div;
349}
350
351static unsigned long s3c24xx_round_dclk_rate(struct clk *clk,
352 unsigned long rate)
353{
354 unsigned long div = s3c24xx_calc_div(clk, rate);
355
356 if (div == 0)
357 return 0;
358
359 return clk_get_rate(clk->parent) / div;
360}
361
362static int s3c24xx_set_dclk_rate(struct clk *clk, unsigned long rate)
363{
364 unsigned long mask, data, div = s3c24xx_calc_div(clk, rate);
365
366 if (div == 0)
367 return -EINVAL;
368
369 if (clk == &s3c24xx_dclk0) {
370 mask = S3C2410_DCLKCON_DCLK0_DIV_MASK |
371 S3C2410_DCLKCON_DCLK0_CMP_MASK;
372 data = S3C2410_DCLKCON_DCLK0_DIV(div) |
373 S3C2410_DCLKCON_DCLK0_CMP((div + 1) / 2);
374 } else if (clk == &s3c24xx_dclk1) {
375 mask = S3C2410_DCLKCON_DCLK1_DIV_MASK |
376 S3C2410_DCLKCON_DCLK1_CMP_MASK;
377 data = S3C2410_DCLKCON_DCLK1_DIV(div) |
378 S3C2410_DCLKCON_DCLK1_CMP((div + 1) / 2);
379 } else
380 return -EINVAL;
381
382 clk->rate = clk_get_rate(clk->parent) / div;
383 __raw_writel(((__raw_readl(S3C24XX_DCLKCON) & ~mask) | data),
384 S3C24XX_DCLKCON);
385 return clk->rate;
386}
387
388static int s3c24xx_clkout_setparent(struct clk *clk, struct clk *parent)
389{
390 unsigned long mask;
391 unsigned long source;
392
393 /* calculate the MISCCR setting for the clock */
394
395 if (parent == &clk_xtal)
396 source = S3C2410_MISCCR_CLK0_MPLL;
397 else if (parent == &clk_upll)
398 source = S3C2410_MISCCR_CLK0_UPLL;
399 else if (parent == &clk_f)
400 source = S3C2410_MISCCR_CLK0_FCLK;
401 else if (parent == &clk_h)
402 source = S3C2410_MISCCR_CLK0_HCLK;
403 else if (parent == &clk_p)
404 source = S3C2410_MISCCR_CLK0_PCLK;
405 else if (clk == &s3c24xx_clkout0 && parent == &s3c24xx_dclk0)
406 source = S3C2410_MISCCR_CLK0_DCLK0;
407 else if (clk == &s3c24xx_clkout1 && parent == &s3c24xx_dclk1)
408 source = S3C2410_MISCCR_CLK0_DCLK0;
409 else
410 return -EINVAL;
411
412 clk->parent = parent;
413
414 if (clk == &s3c24xx_clkout0)
415 mask = S3C2410_MISCCR_CLK0_MASK;
416 else {
417 source <<= 4;
418 mask = S3C2410_MISCCR_CLK1_MASK;
419 }
420
421 s3c2410_modify_misccr(mask, source);
422 return 0;
423}
424
425/* external clock definitions */
426
427struct clk s3c24xx_dclk0 = {
428 .name = "dclk0",
429 .id = -1,
430 .ctrlbit = S3C2410_DCLKCON_DCLK0EN,
431 .enable = s3c24xx_dclk_enable,
432 .set_parent = s3c24xx_dclk_setparent,
433 .set_rate = s3c24xx_set_dclk_rate,
434 .round_rate = s3c24xx_round_dclk_rate,
435};
436
437struct clk s3c24xx_dclk1 = {
438 .name = "dclk1",
439 .id = -1,
440 .ctrlbit = S3C2410_DCLKCON_DCLK1EN,
441 .enable = s3c24xx_dclk_enable,
442 .set_parent = s3c24xx_dclk_setparent,
443 .set_rate = s3c24xx_set_dclk_rate,
444 .round_rate = s3c24xx_round_dclk_rate,
445};
446
447struct clk s3c24xx_clkout0 = {
448 .name = "clkout0",
449 .id = -1,
450 .set_parent = s3c24xx_clkout_setparent,
451};
452
453struct clk s3c24xx_clkout1 = {
454 .name = "clkout1",
455 .id = -1,
456 .set_parent = s3c24xx_clkout_setparent,
457};
458
459struct clk s3c24xx_uclk = {
460 .name = "uclk",
461 .id = -1,
462};
463
464/* initialise the clock system */
465
466int s3c24xx_register_clock(struct clk *clk)
467{
468 clk->owner = THIS_MODULE;
469
470 if (clk->enable == NULL)
471 clk->enable = clk_null_enable;
472
473 /* add to the list of available clocks */
474
475 mutex_lock(&clocks_mutex);
476 list_add(&clk->list, &clocks);
477 mutex_unlock(&clocks_mutex);
478
479 return 0;
480}
481
482int s3c24xx_register_clocks(struct clk **clks, int nr_clks)
483{
484 int fails = 0;
485
486 for (; nr_clks > 0; nr_clks--, clks++) {
487 if (s3c24xx_register_clock(*clks) < 0)
488 fails++;
489 }
490
491 return fails;
492}
493 45
494/* initalise all the clocks */ 46/* initalise all the clocks */
495 47
496int __init s3c24xx_setup_clocks(unsigned long xtal, 48void __init_or_cpufreq s3c24xx_setup_clocks(unsigned long fclk,
497 unsigned long fclk, 49 unsigned long hclk,
498 unsigned long hclk, 50 unsigned long pclk)
499 unsigned long pclk)
500{ 51{
501 printk(KERN_INFO "S3C24XX Clocks, (c) 2004 Simtec Electronics\n"); 52 clk_upll.rate = s3c24xx_get_pll(__raw_readl(S3C2410_UPLLCON),
502 53 clk_xtal.rate);
503 /* initialise the main system clocks */
504
505 clk_xtal.rate = xtal;
506 clk_upll.rate = s3c2410_get_pll(__raw_readl(S3C2410_UPLLCON), xtal);
507 54
508 clk_mpll.rate = fclk; 55 clk_mpll.rate = fclk;
509 clk_h.rate = hclk; 56 clk_h.rate = hclk;
510 clk_p.rate = pclk; 57 clk_p.rate = pclk;
511 clk_f.rate = fclk; 58 clk_f.rate = fclk;
512
513 /* assume uart clocks are correctly setup */
514
515 /* register our clocks */
516
517 if (s3c24xx_register_clock(&clk_xtal) < 0)
518 printk(KERN_ERR "failed to register master xtal\n");
519
520 if (s3c24xx_register_clock(&clk_mpll) < 0)
521 printk(KERN_ERR "failed to register mpll clock\n");
522
523 if (s3c24xx_register_clock(&clk_upll) < 0)
524 printk(KERN_ERR "failed to register upll clock\n");
525
526 if (s3c24xx_register_clock(&clk_f) < 0)
527 printk(KERN_ERR "failed to register cpu fclk\n");
528
529 if (s3c24xx_register_clock(&clk_h) < 0)
530 printk(KERN_ERR "failed to register cpu hclk\n");
531
532 if (s3c24xx_register_clock(&clk_p) < 0)
533 printk(KERN_ERR "failed to register cpu pclk\n");
534
535 return 0;
536} 59}
diff --git a/arch/arm/plat-s3c24xx/common-smdk.c b/arch/arm/plat-s3c24xx/common-smdk.c
index 3098736c65d9..3d4837021ac7 100644
--- a/arch/arm/plat-s3c24xx/common-smdk.c
+++ b/arch/arm/plat-s3c24xx/common-smdk.c
@@ -38,7 +38,7 @@
38#include <mach/regs-gpio.h> 38#include <mach/regs-gpio.h>
39#include <mach/leds-gpio.h> 39#include <mach/leds-gpio.h>
40 40
41#include <asm/plat-s3c/nand.h> 41#include <plat/nand.h>
42 42
43#include <plat/common-smdk.h> 43#include <plat/common-smdk.h>
44#include <plat/devs.h> 44#include <plat/devs.h>
diff --git a/arch/arm/plat-s3c24xx/cpu.c b/arch/arm/plat-s3c24xx/cpu.c
index 22a329513c0f..542062f8cbc1 100644
--- a/arch/arm/plat-s3c24xx/cpu.c
+++ b/arch/arm/plat-s3c24xx/cpu.c
@@ -30,7 +30,6 @@
30#include <linux/platform_device.h> 30#include <linux/platform_device.h>
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/io.h> 32#include <linux/io.h>
33#include <linux/delay.h>
34 33
35#include <mach/hardware.h> 34#include <mach/hardware.h>
36#include <asm/irq.h> 35#include <asm/irq.h>
@@ -55,16 +54,6 @@
55#include <plat/s3c2442.h> 54#include <plat/s3c2442.h>
56#include <plat/s3c2443.h> 55#include <plat/s3c2443.h>
57 56
58struct cpu_table {
59 unsigned long idcode;
60 unsigned long idmask;
61 void (*map_io)(struct map_desc *mach_desc, int size);
62 void (*init_uarts)(struct s3c2410_uartcfg *cfg, int no);
63 void (*init_clocks)(int xtal);
64 int (*init)(void);
65 const char *name;
66};
67
68/* table of supported CPUs */ 57/* table of supported CPUs */
69 58
70static const char name_s3c2400[] = "S3C2400"; 59static const char name_s3c2400[] = "S3C2400";
@@ -169,23 +158,7 @@ static struct map_desc s3c_iodesc[] __initdata = {
169 IODESC_ENT(UART) 158 IODESC_ENT(UART)
170}; 159};
171 160
172static struct cpu_table * __init s3c_lookup_cpu(unsigned long idcode) 161/* read cpu identificaiton code */
173{
174 struct cpu_table *tab;
175 int count;
176
177 tab = cpu_ids;
178 for (count = 0; count < ARRAY_SIZE(cpu_ids); count++, tab++) {
179 if ((idcode & tab->idmask) == tab->idcode)
180 return tab;
181 }
182
183 return NULL;
184}
185
186/* cpu information */
187
188static struct cpu_table *cpu;
189 162
190static unsigned long s3c24xx_read_idcode_v5(void) 163static unsigned long s3c24xx_read_idcode_v5(void)
191{ 164{
@@ -231,6 +204,7 @@ void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
231 unsigned long idcode = 0x0; 204 unsigned long idcode = 0x0;
232 205
233 /* initialise the io descriptors we need for initialisation */ 206 /* initialise the io descriptors we need for initialisation */
207 iotable_init(mach_desc, size);
234 iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc)); 208 iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
235 209
236 if (cpu_architecture() >= CPU_ARCH_ARMv5) { 210 if (cpu_architecture() >= CPU_ARCH_ARMv5) {
@@ -239,117 +213,7 @@ void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
239 idcode = s3c24xx_read_idcode_v4(); 213 idcode = s3c24xx_read_idcode_v4();
240 } 214 }
241 215
242 cpu = s3c_lookup_cpu(idcode);
243
244 if (cpu == NULL) {
245 printk(KERN_ERR "Unknown CPU type 0x%08lx\n", idcode);
246 panic("Unknown S3C24XX CPU");
247 }
248
249 printk("CPU %s (id 0x%08lx)\n", cpu->name, idcode);
250
251 if (cpu->map_io == NULL || cpu->init == NULL) {
252 printk(KERN_ERR "CPU %s support not enabled\n", cpu->name);
253 panic("Unsupported S3C24XX CPU");
254 }
255
256 arm_pm_restart = s3c24xx_pm_restart; 216 arm_pm_restart = s3c24xx_pm_restart;
257 217
258 (cpu->map_io)(mach_desc, size); 218 s3c_init_cpu(idcode, cpu_ids, ARRAY_SIZE(cpu_ids));
259}
260
261/* s3c24xx_init_clocks
262 *
263 * Initialise the clock subsystem and associated information from the
264 * given master crystal value.
265 *
266 * xtal = 0 -> use default PLL crystal value (normally 12MHz)
267 * != 0 -> PLL crystal value in Hz
268*/
269
270void __init s3c24xx_init_clocks(int xtal)
271{
272 if (xtal == 0)
273 xtal = 12*1000*1000;
274
275 if (cpu == NULL)
276 panic("s3c24xx_init_clocks: no cpu setup?\n");
277
278 if (cpu->init_clocks == NULL)
279 panic("s3c24xx_init_clocks: cpu has no clock init\n");
280 else
281 (cpu->init_clocks)(xtal);
282} 219}
283
284/* uart management */
285
286static int nr_uarts __initdata = 0;
287
288static struct s3c2410_uartcfg uart_cfgs[3];
289
290/* s3c24xx_init_uartdevs
291 *
292 * copy the specified platform data and configuration into our central
293 * set of devices, before the data is thrown away after the init process.
294 *
295 * This also fills in the array passed to the serial driver for the
296 * early initialisation of the console.
297*/
298
299void __init s3c24xx_init_uartdevs(char *name,
300 struct s3c24xx_uart_resources *res,
301 struct s3c2410_uartcfg *cfg, int no)
302{
303 struct platform_device *platdev;
304 struct s3c2410_uartcfg *cfgptr = uart_cfgs;
305 struct s3c24xx_uart_resources *resp;
306 int uart;
307
308 memcpy(cfgptr, cfg, sizeof(struct s3c2410_uartcfg) * no);
309
310 for (uart = 0; uart < no; uart++, cfg++, cfgptr++) {
311 platdev = s3c24xx_uart_src[cfgptr->hwport];
312
313 resp = res + cfgptr->hwport;
314
315 s3c24xx_uart_devs[uart] = platdev;
316
317 platdev->name = name;
318 platdev->resource = resp->resources;
319 platdev->num_resources = resp->nr_resources;
320
321 platdev->dev.platform_data = cfgptr;
322 }
323
324 nr_uarts = no;
325}
326
327void __init s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no)
328{
329 if (cpu == NULL)
330 return;
331
332 if (cpu->init_uarts == NULL) {
333 printk(KERN_ERR "s3c24xx_init_uarts: cpu has no uart init\n");
334 } else
335 (cpu->init_uarts)(cfg, no);
336}
337
338static int __init s3c_arch_init(void)
339{
340 int ret;
341
342 // do the correct init for cpu
343
344 if (cpu == NULL)
345 panic("s3c_arch_init: NULL cpu\n");
346
347 ret = (cpu->init)();
348 if (ret != 0)
349 return ret;
350
351 ret = platform_add_devices(s3c24xx_uart_devs, nr_uarts);
352 return ret;
353}
354
355arch_initcall(s3c_arch_init);
diff --git a/arch/arm/plat-s3c24xx/devs.c b/arch/arm/plat-s3c24xx/devs.c
index e93f8bf6d338..16ac01d9b8ab 100644
--- a/arch/arm/plat-s3c24xx/devs.c
+++ b/arch/arm/plat-s3c24xx/devs.c
@@ -29,11 +29,11 @@
29#include <asm/irq.h> 29#include <asm/irq.h>
30 30
31#include <plat/regs-serial.h> 31#include <plat/regs-serial.h>
32#include <asm/plat-s3c24xx/udc.h> 32#include <plat/udc.h>
33 33
34#include <plat/devs.h> 34#include <plat/devs.h>
35#include <plat/cpu.h> 35#include <plat/cpu.h>
36#include <asm/plat-s3c24xx/regs-spi.h> 36#include <plat/regs-spi.h>
37 37
38/* Serial port registrations */ 38/* Serial port registrations */
39 39
@@ -76,6 +76,19 @@ static struct resource s3c2410_uart2_resource[] = {
76 } 76 }
77}; 77};
78 78
79static struct resource s3c2410_uart3_resource[] = {
80 [0] = {
81 .start = S3C2443_PA_UART3,
82 .end = S3C2443_PA_UART3 + 0x3fff,
83 .flags = IORESOURCE_MEM,
84 },
85 [1] = {
86 .start = IRQ_S3CUART_RX3,
87 .end = IRQ_S3CUART_ERR3,
88 .flags = IORESOURCE_IRQ,
89 },
90};
91
79struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = { 92struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
80 [0] = { 93 [0] = {
81 .resources = s3c2410_uart0_resource, 94 .resources = s3c2410_uart0_resource,
@@ -89,6 +102,10 @@ struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
89 .resources = s3c2410_uart2_resource, 102 .resources = s3c2410_uart2_resource,
90 .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource), 103 .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
91 }, 104 },
105 [3] = {
106 .resources = s3c2410_uart3_resource,
107 .nr_resources = ARRAY_SIZE(s3c2410_uart3_resource),
108 },
92}; 109};
93 110
94/* yart devices */ 111/* yart devices */
@@ -105,13 +122,18 @@ static struct platform_device s3c24xx_uart_device2 = {
105 .id = 2, 122 .id = 2,
106}; 123};
107 124
108struct platform_device *s3c24xx_uart_src[3] = { 125static struct platform_device s3c24xx_uart_device3 = {
126 .id = 3,
127};
128
129struct platform_device *s3c24xx_uart_src[4] = {
109 &s3c24xx_uart_device0, 130 &s3c24xx_uart_device0,
110 &s3c24xx_uart_device1, 131 &s3c24xx_uart_device1,
111 &s3c24xx_uart_device2, 132 &s3c24xx_uart_device2,
133 &s3c24xx_uart_device3,
112}; 134};
113 135
114struct platform_device *s3c24xx_uart_devs[3] = { 136struct platform_device *s3c24xx_uart_devs[4] = {
115}; 137};
116 138
117/* USB Host Controller */ 139/* USB Host Controller */
@@ -192,8 +214,8 @@ void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
192 214
193static struct resource s3c_nand_resource[] = { 215static struct resource s3c_nand_resource[] = {
194 [0] = { 216 [0] = {
195 .start = S3C2410_PA_NAND, 217 .start = S3C24XX_PA_NAND,
196 .end = S3C2410_PA_NAND + S3C24XX_SZ_NAND - 1, 218 .end = S3C24XX_PA_NAND + S3C24XX_SZ_NAND - 1,
197 .flags = IORESOURCE_MEM, 219 .flags = IORESOURCE_MEM,
198 } 220 }
199}; 221};
@@ -271,31 +293,6 @@ struct platform_device s3c_device_wdt = {
271 293
272EXPORT_SYMBOL(s3c_device_wdt); 294EXPORT_SYMBOL(s3c_device_wdt);
273 295
274/* I2C */
275
276static struct resource s3c_i2c_resource[] = {
277 [0] = {
278 .start = S3C24XX_PA_IIC,
279 .end = S3C24XX_PA_IIC + S3C24XX_SZ_IIC - 1,
280 .flags = IORESOURCE_MEM,
281 },
282 [1] = {
283 .start = IRQ_IIC,
284 .end = IRQ_IIC,
285 .flags = IORESOURCE_IRQ,
286 }
287
288};
289
290struct platform_device s3c_device_i2c = {
291 .name = "s3c2410-i2c",
292 .id = -1,
293 .num_resources = ARRAY_SIZE(s3c_i2c_resource),
294 .resource = s3c_i2c_resource,
295};
296
297EXPORT_SYMBOL(s3c_device_i2c);
298
299/* IIS */ 296/* IIS */
300 297
301static struct resource s3c_iis_resource[] = { 298static struct resource s3c_iis_resource[] = {
@@ -372,18 +369,26 @@ static struct resource s3c_adc_resource[] = {
372}; 369};
373 370
374struct platform_device s3c_device_adc = { 371struct platform_device s3c_device_adc = {
375 .name = "s3c2410-adc", 372 .name = "s3c24xx-adc",
376 .id = -1, 373 .id = -1,
377 .num_resources = ARRAY_SIZE(s3c_adc_resource), 374 .num_resources = ARRAY_SIZE(s3c_adc_resource),
378 .resource = s3c_adc_resource, 375 .resource = s3c_adc_resource,
379}; 376};
380 377
378/* HWMON */
379
380struct platform_device s3c_device_hwmon = {
381 .name = "s3c24xx-hwmon",
382 .id = -1,
383 .dev.parent = &s3c_device_adc.dev,
384};
385
381/* SDI */ 386/* SDI */
382 387
383static struct resource s3c_sdi_resource[] = { 388static struct resource s3c_sdi_resource[] = {
384 [0] = { 389 [0] = {
385 .start = S3C2410_PA_SDI, 390 .start = S3C24XX_PA_SDI,
386 .end = S3C2410_PA_SDI + S3C24XX_SZ_SDI - 1, 391 .end = S3C24XX_PA_SDI + S3C24XX_SZ_SDI - 1,
387 .flags = IORESOURCE_MEM, 392 .flags = IORESOURCE_MEM,
388 }, 393 },
389 [1] = { 394 [1] = {
@@ -403,36 +408,6 @@ struct platform_device s3c_device_sdi = {
403 408
404EXPORT_SYMBOL(s3c_device_sdi); 409EXPORT_SYMBOL(s3c_device_sdi);
405 410
406/* High-speed MMC/SD */
407
408static struct resource s3c_hsmmc_resource[] = {
409 [0] = {
410 .start = S3C2443_PA_HSMMC,
411 .end = S3C2443_PA_HSMMC + S3C2443_SZ_HSMMC - 1,
412 .flags = IORESOURCE_MEM,
413 },
414 [1] = {
415 .start = IRQ_S3C2443_HSMMC,
416 .end = IRQ_S3C2443_HSMMC,
417 .flags = IORESOURCE_IRQ,
418 }
419};
420
421static u64 s3c_device_hsmmc_dmamask = 0xffffffffUL;
422
423struct platform_device s3c_device_hsmmc = {
424 .name = "s3c-sdhci",
425 .id = -1,
426 .num_resources = ARRAY_SIZE(s3c_hsmmc_resource),
427 .resource = s3c_hsmmc_resource,
428 .dev = {
429 .dma_mask = &s3c_device_hsmmc_dmamask,
430 .coherent_dma_mask = 0xffffffffUL
431 }
432};
433
434
435
436/* SPI (0) */ 411/* SPI (0) */
437 412
438static struct resource s3c_spi0_resource[] = { 413static struct resource s3c_spi0_resource[] = {
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index 1baf941d1930..aee2aeb46c60 100644
--- a/arch/arm/plat-s3c24xx/dma.c
+++ b/arch/arm/plat-s3c24xx/dma.c
@@ -25,15 +25,13 @@
25#include <linux/sysdev.h> 25#include <linux/sysdev.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/errno.h> 27#include <linux/errno.h>
28#include <linux/delay.h>
29#include <linux/io.h> 28#include <linux/io.h>
30 29
31#include <asm/system.h> 30#include <asm/system.h>
32#include <asm/irq.h> 31#include <asm/irq.h>
33#include <mach/hardware.h> 32#include <mach/hardware.h>
34#include <asm/dma.h> 33#include <mach/dma.h>
35 34
36#include <asm/mach/dma.h>
37#include <mach/map.h> 35#include <mach/map.h>
38 36
39#include <plat/dma.h> 37#include <plat/dma.h>
@@ -804,7 +802,7 @@ EXPORT_SYMBOL(s3c2410_dma_request);
804 * allowed to go through. 802 * allowed to go through.
805*/ 803*/
806 804
807int s3c2410_dma_free(dmach_t channel, struct s3c2410_dma_client *client) 805int s3c2410_dma_free(unsigned int channel, struct s3c2410_dma_client *client)
808{ 806{
809 struct s3c2410_dma_chan *chan = lookup_dma_channel(channel); 807 struct s3c2410_dma_chan *chan = lookup_dma_channel(channel);
810 unsigned long flags; 808 unsigned long flags;
@@ -995,7 +993,7 @@ static int s3c2410_dma_started(struct s3c2410_dma_chan *chan)
995} 993}
996 994
997int 995int
998s3c2410_dma_ctrl(dmach_t channel, enum s3c2410_chan_op op) 996s3c2410_dma_ctrl(unsigned int channel, enum s3c2410_chan_op op)
999{ 997{
1000 struct s3c2410_dma_chan *chan = lookup_dma_channel(channel); 998 struct s3c2410_dma_chan *chan = lookup_dma_channel(channel);
1001 999
@@ -1043,7 +1041,7 @@ EXPORT_SYMBOL(s3c2410_dma_ctrl);
1043 * dcon: base value of the DCONx register 1041 * dcon: base value of the DCONx register
1044*/ 1042*/
1045 1043
1046int s3c2410_dma_config(dmach_t channel, 1044int s3c2410_dma_config(unsigned int channel,
1047 int xferunit, 1045 int xferunit,
1048 int dcon) 1046 int dcon)
1049{ 1047{
@@ -1092,7 +1090,7 @@ int s3c2410_dma_config(dmach_t channel,
1092 1090
1093EXPORT_SYMBOL(s3c2410_dma_config); 1091EXPORT_SYMBOL(s3c2410_dma_config);
1094 1092
1095int s3c2410_dma_setflags(dmach_t channel, unsigned int flags) 1093int s3c2410_dma_setflags(unsigned int channel, unsigned int flags)
1096{ 1094{
1097 struct s3c2410_dma_chan *chan = lookup_dma_channel(channel); 1095 struct s3c2410_dma_chan *chan = lookup_dma_channel(channel);
1098 1096
@@ -1113,7 +1111,7 @@ EXPORT_SYMBOL(s3c2410_dma_setflags);
1113 * irq? 1111 * irq?
1114*/ 1112*/
1115 1113
1116int s3c2410_dma_set_opfn(dmach_t channel, s3c2410_dma_opfn_t rtn) 1114int s3c2410_dma_set_opfn(unsigned int channel, s3c2410_dma_opfn_t rtn)
1117{ 1115{
1118 struct s3c2410_dma_chan *chan = lookup_dma_channel(channel); 1116 struct s3c2410_dma_chan *chan = lookup_dma_channel(channel);
1119 1117
@@ -1129,7 +1127,7 @@ int s3c2410_dma_set_opfn(dmach_t channel, s3c2410_dma_opfn_t rtn)
1129 1127
1130EXPORT_SYMBOL(s3c2410_dma_set_opfn); 1128EXPORT_SYMBOL(s3c2410_dma_set_opfn);
1131 1129
1132int s3c2410_dma_set_buffdone_fn(dmach_t channel, s3c2410_dma_cbfn_t rtn) 1130int s3c2410_dma_set_buffdone_fn(unsigned int channel, s3c2410_dma_cbfn_t rtn)
1133{ 1131{
1134 struct s3c2410_dma_chan *chan = lookup_dma_channel(channel); 1132 struct s3c2410_dma_chan *chan = lookup_dma_channel(channel);
1135 1133
@@ -1219,7 +1217,7 @@ EXPORT_SYMBOL(s3c2410_dma_devconfig);
1219 * returns the current transfer points for the dma source and destination 1217 * returns the current transfer points for the dma source and destination
1220*/ 1218*/
1221 1219
1222int s3c2410_dma_getposition(dmach_t channel, dma_addr_t *src, dma_addr_t *dst) 1220int s3c2410_dma_getposition(unsigned int channel, dma_addr_t *src, dma_addr_t *dst)
1223{ 1221{
1224 struct s3c2410_dma_chan *chan = lookup_dma_channel(channel); 1222 struct s3c2410_dma_chan *chan = lookup_dma_channel(channel);
1225 1223
diff --git a/arch/arm/plat-s3c24xx/gpiolib.c b/arch/arm/plat-s3c24xx/gpiolib.c
index 3caec6bad3eb..f95c6c9d9f1a 100644
--- a/arch/arm/plat-s3c24xx/gpiolib.c
+++ b/arch/arm/plat-s3c24xx/gpiolib.c
@@ -19,104 +19,12 @@
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21 21
22#include <plat/gpio-core.h>
22#include <mach/hardware.h> 23#include <mach/hardware.h>
23#include <asm/irq.h> 24#include <asm/irq.h>
24 25
25#include <mach/regs-gpio.h> 26#include <mach/regs-gpio.h>
26 27
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
42static int 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
61static int 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
89static void s3c24xx_gpiolib_set(struct gpio_chip *chip,
90 unsigned offset, int value)
91{
92 struct s3c24xx_gpio_chip *ourchip = to_s3c_chip(chip);
93 void __iomem *base = ourchip->base;
94 unsigned long flags;
95 unsigned long dat;
96
97 local_irq_save(flags);
98
99 dat = __raw_readl(base + 0x04);
100 dat &= ~(1 << offset);
101 if (value)
102 dat |= 1 << offset;
103 __raw_writel(dat, base + 0x04);
104
105 local_irq_restore(flags);
106}
107
108static int s3c24xx_gpiolib_get(struct gpio_chip *chip, unsigned offset)
109{
110 struct s3c24xx_gpio_chip *ourchip = to_s3c_chip(chip);
111 unsigned long val;
112
113 val = __raw_readl(ourchip->base + 0x04);
114 val >>= offset;
115 val &= 1;
116
117 return val;
118}
119
120static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset) 28static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset)
121{ 29{
122 return -EINVAL; 30 return -EINVAL;
@@ -125,7 +33,7 @@ static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset)
125static int s3c24xx_gpiolib_banka_output(struct gpio_chip *chip, 33static int s3c24xx_gpiolib_banka_output(struct gpio_chip *chip,
126 unsigned offset, int value) 34 unsigned offset, int value)
127{ 35{
128 struct s3c24xx_gpio_chip *ourchip = to_s3c_chip(chip); 36 struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip);
129 void __iomem *base = ourchip->base; 37 void __iomem *base = ourchip->base;
130 unsigned long flags; 38 unsigned long flags;
131 unsigned long dat; 39 unsigned long dat;
@@ -151,7 +59,7 @@ static int s3c24xx_gpiolib_banka_output(struct gpio_chip *chip,
151 return 0; 59 return 0;
152} 60}
153 61
154static struct s3c24xx_gpio_chip gpios[] = { 62struct s3c_gpio_chip s3c24xx_gpios[] = {
155 [0] = { 63 [0] = {
156 .base = S3C24XX_GPIO_BASE(S3C2410_GPA0), 64 .base = S3C24XX_GPIO_BASE(S3C2410_GPA0),
157 .chip = { 65 .chip = {
@@ -161,8 +69,6 @@ static struct s3c24xx_gpio_chip gpios[] = {
161 .ngpio = 24, 69 .ngpio = 24,
162 .direction_input = s3c24xx_gpiolib_banka_input, 70 .direction_input = s3c24xx_gpiolib_banka_input,
163 .direction_output = s3c24xx_gpiolib_banka_output, 71 .direction_output = s3c24xx_gpiolib_banka_output,
164 .set = s3c24xx_gpiolib_set,
165 .get = s3c24xx_gpiolib_get,
166 }, 72 },
167 }, 73 },
168 [1] = { 74 [1] = {
@@ -172,10 +78,6 @@ static struct s3c24xx_gpio_chip gpios[] = {
172 .owner = THIS_MODULE, 78 .owner = THIS_MODULE,
173 .label = "GPIOB", 79 .label = "GPIOB",
174 .ngpio = 16, 80 .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 }, 81 },
180 }, 82 },
181 [2] = { 83 [2] = {
@@ -185,10 +87,6 @@ static struct s3c24xx_gpio_chip gpios[] = {
185 .owner = THIS_MODULE, 87 .owner = THIS_MODULE,
186 .label = "GPIOC", 88 .label = "GPIOC",
187 .ngpio = 16, 89 .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 }, 90 },
193 }, 91 },
194 [3] = { 92 [3] = {
@@ -198,10 +96,6 @@ static struct s3c24xx_gpio_chip gpios[] = {
198 .owner = THIS_MODULE, 96 .owner = THIS_MODULE,
199 .label = "GPIOD", 97 .label = "GPIOD",
200 .ngpio = 16, 98 .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 }, 99 },
206 }, 100 },
207 [4] = { 101 [4] = {
@@ -211,10 +105,6 @@ static struct s3c24xx_gpio_chip gpios[] = {
211 .label = "GPIOE", 105 .label = "GPIOE",
212 .owner = THIS_MODULE, 106 .owner = THIS_MODULE,
213 .ngpio = 16, 107 .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 }, 108 },
219 }, 109 },
220 [5] = { 110 [5] = {
@@ -224,10 +114,6 @@ static struct s3c24xx_gpio_chip gpios[] = {
224 .owner = THIS_MODULE, 114 .owner = THIS_MODULE,
225 .label = "GPIOF", 115 .label = "GPIOF",
226 .ngpio = 8, 116 .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 }, 117 },
232 }, 118 },
233 [6] = { 119 [6] = {
@@ -237,21 +123,17 @@ static struct s3c24xx_gpio_chip gpios[] = {
237 .owner = THIS_MODULE, 123 .owner = THIS_MODULE,
238 .label = "GPIOG", 124 .label = "GPIOG",
239 .ngpio = 10, 125 .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 }, 126 },
245 }, 127 },
246}; 128};
247 129
248static __init int s3c24xx_gpiolib_init(void) 130static __init int s3c24xx_gpiolib_init(void)
249{ 131{
250 struct s3c24xx_gpio_chip *chip = gpios; 132 struct s3c_gpio_chip *chip = s3c24xx_gpios;
251 int gpn; 133 int gpn;
252 134
253 for (gpn = 0; gpn < ARRAY_SIZE(gpios); gpn++, chip++) 135 for (gpn = 0; gpn < ARRAY_SIZE(s3c24xx_gpios); gpn++, chip++)
254 gpiochip_add(&chip->chip); 136 s3c_gpiolib_add(chip);
255 137
256 return 0; 138 return 0;
257} 139}
diff --git a/arch/arm/plat-s3c24xx/include/mach/pwm-clock.h b/arch/arm/plat-s3c24xx/include/mach/pwm-clock.h
new file mode 100644
index 000000000000..a087de21bc20
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/include/mach/pwm-clock.h
@@ -0,0 +1,55 @@
1/* linux/arch/arm/plat-s3c24xx/include/mach/pwm-clock.h
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * S3C24xx - pwm clock and timer support
8 */
9
10/**
11 * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk
12 * @cfg: The timer TCFG1 register bits shifted down to 0.
13 *
14 * Return true if the given configuration from TCFG1 is a TCLK instead
15 * any of the TDIV clocks.
16 */
17static inline int pwm_cfg_src_is_tclk(unsigned long tcfg)
18{
19 return tcfg == S3C2410_TCFG1_MUX_TCLK;
20}
21
22/**
23 * tcfg_to_divisor() - convert tcfg1 setting to a divisor
24 * @tcfg1: The tcfg1 setting, shifted down.
25 *
26 * Get the divisor value for the given tcfg1 setting. We assume the
27 * caller has already checked to see if this is not a TCLK source.
28 */
29static inline unsigned long tcfg_to_divisor(unsigned long tcfg1)
30{
31 return 1 << (1 + tcfg1);
32}
33
34/**
35 * pwm_tdiv_has_div1() - does the tdiv setting have a /1
36 *
37 * Return true if we have a /1 in the tdiv setting.
38 */
39static inline unsigned int pwm_tdiv_has_div1(void)
40{
41 return 0;
42}
43
44/**
45 * pwm_tdiv_div_bits() - calculate TCFG1 divisor value.
46 * @div: The divisor to calculate the bit information for.
47 *
48 * Turn a divisor into the necessary bit field for TCFG1.
49 */
50static inline unsigned long pwm_tdiv_div_bits(unsigned int div)
51{
52 return ilog2(div) - 1;
53}
54
55#define S3C_TCFG1_MUX_TCLK S3C2410_TCFG1_MUX_TCLK
diff --git a/arch/arm/plat-s3c24xx/include/plat/map.h b/arch/arm/plat-s3c24xx/include/plat/map.h
new file mode 100644
index 000000000000..fef8ea8b8e1e
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/include/plat/map.h
@@ -0,0 +1,99 @@
1/* linux/include/asm-arm/plat-s3c24xx/map.h
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C24XX - Memory map definitions
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#ifndef __ASM_PLAT_S3C24XX_MAP_H
14#define __ASM_PLAT_S3C24XX_MAP_H
15
16/* interrupt controller is the first thing we put in, to make
17 * the assembly code for the irq detection easier
18 */
19#define S3C24XX_VA_IRQ S3C_VA_IRQ
20#define S3C2410_PA_IRQ (0x4A000000)
21#define S3C24XX_SZ_IRQ SZ_1M
22
23/* memory controller registers */
24#define S3C24XX_VA_MEMCTRL S3C_VA_MEM
25#define S3C2410_PA_MEMCTRL (0x48000000)
26#define S3C24XX_SZ_MEMCTRL SZ_1M
27
28/* UARTs */
29#define S3C24XX_VA_UART S3C_VA_UART
30#define S3C2410_PA_UART (0x50000000)
31#define S3C24XX_SZ_UART SZ_1M
32#define S3C_UART_OFFSET (0x4000)
33
34/* Timers */
35#define S3C24XX_VA_TIMER S3C_VA_TIMER
36#define S3C2410_PA_TIMER (0x51000000)
37#define S3C24XX_SZ_TIMER SZ_1M
38
39/* Clock and Power management */
40#define S3C24XX_VA_CLKPWR S3C_VA_SYS
41#define S3C24XX_SZ_CLKPWR SZ_1M
42
43/* USB Device port */
44#define S3C2410_PA_USBDEV (0x52000000)
45#define S3C24XX_SZ_USBDEV SZ_1M
46
47/* Watchdog */
48#define S3C24XX_VA_WATCHDOG S3C_VA_WATCHDOG
49#define S3C2410_PA_WATCHDOG (0x53000000)
50#define S3C24XX_SZ_WATCHDOG SZ_1M
51
52/* Standard size definitions for peripheral blocks. */
53
54#define S3C24XX_SZ_IIS SZ_1M
55#define S3C24XX_SZ_ADC SZ_1M
56#define S3C24XX_SZ_SPI SZ_1M
57#define S3C24XX_SZ_SDI SZ_1M
58#define S3C24XX_SZ_NAND SZ_1M
59#define S3C24XX_SZ_USBHOST SZ_1M
60
61/* GPIO ports */
62
63/* the calculation for the VA of this must ensure that
64 * it is the same distance apart from the UART in the
65 * phsyical address space, as the initial mapping for the IO
66 * is done as a 1:1 maping. This puts it (currently) at
67 * 0xFA800000, which is not in the way of any current mapping
68 * by the base system.
69*/
70
71#define S3C2410_PA_GPIO (0x56000000)
72#define S3C24XX_VA_GPIO ((S3C24XX_PA_GPIO - S3C24XX_PA_UART) + S3C24XX_VA_UART)
73#define S3C24XX_SZ_GPIO SZ_1M
74
75
76/* ISA style IO, for each machine to sort out mappings for, if it
77 * implements it. We reserve two 16M regions for ISA.
78 */
79
80#define S3C24XX_VA_ISA_WORD S3C2410_ADDR(0x02000000)
81#define S3C24XX_VA_ISA_BYTE S3C2410_ADDR(0x03000000)
82
83/* deal with the registers that move under the 2412/2413 */
84
85#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
86#ifndef __ASSEMBLY__
87extern void __iomem *s3c24xx_va_gpio2;
88#endif
89#ifdef CONFIG_CPU_S3C2412_ONLY
90#define S3C24XX_VA_GPIO2 (S3C24XX_VA_GPIO + 0x10)
91#else
92#define S3C24XX_VA_GPIO2 s3c24xx_va_gpio2
93#endif
94#else
95#define s3c24xx_va_gpio2 S3C24XX_VA_GPIO
96#define S3C24XX_VA_GPIO2 S3C24XX_VA_GPIO
97#endif
98
99#endif /* __ASM_PLAT_S3C24XX_MAP_H */
diff --git a/arch/arm/plat-s3c24xx/include/plat/mci.h b/arch/arm/plat-s3c24xx/include/plat/mci.h
new file mode 100644
index 000000000000..2d0852ac3b27
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/include/plat/mci.h
@@ -0,0 +1,15 @@
1#ifndef _ARCH_MCI_H
2#define _ARCH_MCI_H
3
4struct s3c24xx_mci_pdata {
5 unsigned int wprotect_invert : 1;
6 unsigned int detect_invert : 1; /* set => detect active high. */
7
8 unsigned int gpio_detect;
9 unsigned int gpio_wprotect;
10 unsigned long ocr_avail;
11 void (*set_power)(unsigned char power_mode,
12 unsigned short vdd);
13};
14
15#endif /* _ARCH_NCI_H */
diff --git a/arch/arm/plat-s3c24xx/include/plat/pll.h b/arch/arm/plat-s3c24xx/include/plat/pll.h
new file mode 100644
index 000000000000..7ea8bffa7a9c
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/include/plat/pll.h
@@ -0,0 +1,37 @@
1/* linux/arch/arm/plat-s3c24xx/include/plat/pll.h
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * S3C24xx - common pll registers and code
8 */
9
10#define S3C24XX_PLLCON_MDIVSHIFT 12
11#define S3C24XX_PLLCON_PDIVSHIFT 4
12#define S3C24XX_PLLCON_SDIVSHIFT 0
13#define S3C24XX_PLLCON_MDIVMASK ((1<<(1+(19-12)))-1)
14#define S3C24XX_PLLCON_PDIVMASK ((1<<5)-1)
15#define S3C24XX_PLLCON_SDIVMASK 3
16
17#include <asm/div64.h>
18
19static inline unsigned int
20s3c24xx_get_pll(unsigned int pllval, unsigned int baseclk)
21{
22 unsigned int mdiv, pdiv, sdiv;
23 uint64_t fvco;
24
25 mdiv = pllval >> S3C24XX_PLLCON_MDIVSHIFT;
26 pdiv = pllval >> S3C24XX_PLLCON_PDIVSHIFT;
27 sdiv = pllval >> S3C24XX_PLLCON_SDIVSHIFT;
28
29 mdiv &= S3C24XX_PLLCON_MDIVMASK;
30 pdiv &= S3C24XX_PLLCON_PDIVMASK;
31 sdiv &= S3C24XX_PLLCON_SDIVMASK;
32
33 fvco = (uint64_t)baseclk * (mdiv + 8);
34 do_div(fvco, (pdiv + 2) << sdiv);
35
36 return (unsigned int)fvco;
37}
diff --git a/arch/arm/plat-s3c24xx/include/plat/regs-spi.h b/arch/arm/plat-s3c24xx/include/plat/regs-spi.h
new file mode 100644
index 000000000000..2b35479ee35c
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/include/plat/regs-spi.h
@@ -0,0 +1,82 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-spi.h
2 *
3 * Copyright (c) 2004 Fetron GmbH
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * S3C2410 SPI register definition
10*/
11
12#ifndef __ASM_ARCH_REGS_SPI_H
13#define __ASM_ARCH_REGS_SPI_H
14
15#define S3C2410_SPI1 (0x20)
16#define S3C2412_SPI1 (0x100)
17
18#define S3C2410_SPCON (0x00)
19
20#define S3C2412_SPCON_RXFIFO_RB2 (0<<14)
21#define S3C2412_SPCON_RXFIFO_RB4 (1<<14)
22#define S3C2412_SPCON_RXFIFO_RB12 (2<<14)
23#define S3C2412_SPCON_RXFIFO_RB14 (3<<14)
24#define S3C2412_SPCON_TXFIFO_RB2 (0<<12)
25#define S3C2412_SPCON_TXFIFO_RB4 (1<<12)
26#define S3C2412_SPCON_TXFIFO_RB12 (2<<12)
27#define S3C2412_SPCON_TXFIFO_RB14 (3<<12)
28#define S3C2412_SPCON_RXFIFO_RESET (1<<11) /* RxFIFO reset */
29#define S3C2412_SPCON_TXFIFO_RESET (1<<10) /* TxFIFO reset */
30#define S3C2412_SPCON_RXFIFO_EN (1<<9) /* RxFIFO Enable */
31#define S3C2412_SPCON_TXFIFO_EN (1<<8) /* TxFIFO Enable */
32
33#define S3C2412_SPCON_DIRC_RX (1<<7)
34
35#define S3C2410_SPCON_SMOD_DMA (2<<5) /* DMA mode */
36#define S3C2410_SPCON_SMOD_INT (1<<5) /* interrupt mode */
37#define S3C2410_SPCON_SMOD_POLL (0<<5) /* polling mode */
38#define S3C2410_SPCON_ENSCK (1<<4) /* Enable SCK */
39#define S3C2410_SPCON_MSTR (1<<3) /* Master/Slave select
40 0: slave, 1: master */
41#define S3C2410_SPCON_CPOL_HIGH (1<<2) /* Clock polarity select */
42#define S3C2410_SPCON_CPOL_LOW (0<<2) /* Clock polarity select */
43
44#define S3C2410_SPCON_CPHA_FMTB (1<<1) /* Clock Phase Select */
45#define S3C2410_SPCON_CPHA_FMTA (0<<1) /* Clock Phase Select */
46
47#define S3C2410_SPCON_TAGD (1<<0) /* Tx auto garbage data mode */
48
49
50#define S3C2410_SPSTA (0x04)
51
52#define S3C2412_SPSTA_RXFIFO_AE (1<<11)
53#define S3C2412_SPSTA_TXFIFO_AE (1<<10)
54#define S3C2412_SPSTA_RXFIFO_ERROR (1<<9)
55#define S3C2412_SPSTA_TXFIFO_ERROR (1<<8)
56#define S3C2412_SPSTA_RXFIFO_FIFO (1<<7)
57#define S3C2412_SPSTA_RXFIFO_EMPTY (1<<6)
58#define S3C2412_SPSTA_TXFIFO_NFULL (1<<5)
59#define S3C2412_SPSTA_TXFIFO_EMPTY (1<<4)
60
61#define S3C2410_SPSTA_DCOL (1<<2) /* Data Collision Error */
62#define S3C2410_SPSTA_MULD (1<<1) /* Multi Master Error */
63#define S3C2410_SPSTA_READY (1<<0) /* Data Tx/Rx ready */
64#define S3C2412_SPSTA_READY_ORG (1<<3)
65
66#define S3C2410_SPPIN (0x08)
67
68#define S3C2410_SPPIN_ENMUL (1<<2) /* Multi Master Error detect */
69#define S3C2410_SPPIN_RESERVED (1<<1)
70#define S3C2400_SPPIN_nCS (1<<1) /* SPI Card Select */
71#define S3C2410_SPPIN_KEEP (1<<0) /* Master Out keep */
72
73#define S3C2410_SPPRE (0x0C)
74#define S3C2410_SPTDAT (0x10)
75#define S3C2410_SPRDAT (0x14)
76
77#define S3C2412_TXFIFO (0x18)
78#define S3C2412_RXFIFO (0x18)
79#define S3C2412_SPFIC (0x24)
80
81
82#endif /* __ASM_ARCH_REGS_SPI_H */
diff --git a/arch/arm/plat-s3c24xx/include/plat/regs-udc.h b/arch/arm/plat-s3c24xx/include/plat/regs-udc.h
new file mode 100644
index 000000000000..f0dd4a41b37b
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/include/plat/regs-udc.h
@@ -0,0 +1,153 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-udc.h
2 *
3 * Copyright (C) 2004 Herbert Poetzl <herbert@13thfloor.at>
4 *
5 * This include file is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or (at your option) any later version.
9*/
10
11#ifndef __ASM_ARCH_REGS_UDC_H
12#define __ASM_ARCH_REGS_UDC_H
13
14#define S3C2410_USBDREG(x) (x)
15
16#define S3C2410_UDC_FUNC_ADDR_REG S3C2410_USBDREG(0x0140)
17#define S3C2410_UDC_PWR_REG S3C2410_USBDREG(0x0144)
18#define S3C2410_UDC_EP_INT_REG S3C2410_USBDREG(0x0148)
19
20#define S3C2410_UDC_USB_INT_REG S3C2410_USBDREG(0x0158)
21#define S3C2410_UDC_EP_INT_EN_REG S3C2410_USBDREG(0x015c)
22
23#define S3C2410_UDC_USB_INT_EN_REG S3C2410_USBDREG(0x016c)
24
25#define S3C2410_UDC_FRAME_NUM1_REG S3C2410_USBDREG(0x0170)
26#define S3C2410_UDC_FRAME_NUM2_REG S3C2410_USBDREG(0x0174)
27
28#define S3C2410_UDC_EP0_FIFO_REG S3C2410_USBDREG(0x01c0)
29#define S3C2410_UDC_EP1_FIFO_REG S3C2410_USBDREG(0x01c4)
30#define S3C2410_UDC_EP2_FIFO_REG S3C2410_USBDREG(0x01c8)
31#define S3C2410_UDC_EP3_FIFO_REG S3C2410_USBDREG(0x01cc)
32#define S3C2410_UDC_EP4_FIFO_REG S3C2410_USBDREG(0x01d0)
33
34#define S3C2410_UDC_EP1_DMA_CON S3C2410_USBDREG(0x0200)
35#define S3C2410_UDC_EP1_DMA_UNIT S3C2410_USBDREG(0x0204)
36#define S3C2410_UDC_EP1_DMA_FIFO S3C2410_USBDREG(0x0208)
37#define S3C2410_UDC_EP1_DMA_TTC_L S3C2410_USBDREG(0x020c)
38#define S3C2410_UDC_EP1_DMA_TTC_M S3C2410_USBDREG(0x0210)
39#define S3C2410_UDC_EP1_DMA_TTC_H S3C2410_USBDREG(0x0214)
40
41#define S3C2410_UDC_EP2_DMA_CON S3C2410_USBDREG(0x0218)
42#define S3C2410_UDC_EP2_DMA_UNIT S3C2410_USBDREG(0x021c)
43#define S3C2410_UDC_EP2_DMA_FIFO S3C2410_USBDREG(0x0220)
44#define S3C2410_UDC_EP2_DMA_TTC_L S3C2410_USBDREG(0x0224)
45#define S3C2410_UDC_EP2_DMA_TTC_M S3C2410_USBDREG(0x0228)
46#define S3C2410_UDC_EP2_DMA_TTC_H S3C2410_USBDREG(0x022c)
47
48#define S3C2410_UDC_EP3_DMA_CON S3C2410_USBDREG(0x0240)
49#define S3C2410_UDC_EP3_DMA_UNIT S3C2410_USBDREG(0x0244)
50#define S3C2410_UDC_EP3_DMA_FIFO S3C2410_USBDREG(0x0248)
51#define S3C2410_UDC_EP3_DMA_TTC_L S3C2410_USBDREG(0x024c)
52#define S3C2410_UDC_EP3_DMA_TTC_M S3C2410_USBDREG(0x0250)
53#define S3C2410_UDC_EP3_DMA_TTC_H S3C2410_USBDREG(0x0254)
54
55#define S3C2410_UDC_EP4_DMA_CON S3C2410_USBDREG(0x0258)
56#define S3C2410_UDC_EP4_DMA_UNIT S3C2410_USBDREG(0x025c)
57#define S3C2410_UDC_EP4_DMA_FIFO S3C2410_USBDREG(0x0260)
58#define S3C2410_UDC_EP4_DMA_TTC_L S3C2410_USBDREG(0x0264)
59#define S3C2410_UDC_EP4_DMA_TTC_M S3C2410_USBDREG(0x0268)
60#define S3C2410_UDC_EP4_DMA_TTC_H S3C2410_USBDREG(0x026c)
61
62#define S3C2410_UDC_INDEX_REG S3C2410_USBDREG(0x0178)
63
64/* indexed registers */
65
66#define S3C2410_UDC_MAXP_REG S3C2410_USBDREG(0x0180)
67
68#define S3C2410_UDC_EP0_CSR_REG S3C2410_USBDREG(0x0184)
69
70#define S3C2410_UDC_IN_CSR1_REG S3C2410_USBDREG(0x0184)
71#define S3C2410_UDC_IN_CSR2_REG S3C2410_USBDREG(0x0188)
72
73#define S3C2410_UDC_OUT_CSR1_REG S3C2410_USBDREG(0x0190)
74#define S3C2410_UDC_OUT_CSR2_REG S3C2410_USBDREG(0x0194)
75#define S3C2410_UDC_OUT_FIFO_CNT1_REG S3C2410_USBDREG(0x0198)
76#define S3C2410_UDC_OUT_FIFO_CNT2_REG S3C2410_USBDREG(0x019c)
77
78#define S3C2410_UDC_FUNCADDR_UPDATE (1<<7)
79
80#define S3C2410_UDC_PWR_ISOUP (1<<7) // R/W
81#define S3C2410_UDC_PWR_RESET (1<<3) // R
82#define S3C2410_UDC_PWR_RESUME (1<<2) // R/W
83#define S3C2410_UDC_PWR_SUSPEND (1<<1) // R
84#define S3C2410_UDC_PWR_ENSUSPEND (1<<0) // R/W
85
86#define S3C2410_UDC_PWR_DEFAULT 0x00
87
88#define S3C2410_UDC_INT_EP4 (1<<4) // R/W (clear only)
89#define S3C2410_UDC_INT_EP3 (1<<3) // R/W (clear only)
90#define S3C2410_UDC_INT_EP2 (1<<2) // R/W (clear only)
91#define S3C2410_UDC_INT_EP1 (1<<1) // R/W (clear only)
92#define S3C2410_UDC_INT_EP0 (1<<0) // R/W (clear only)
93
94#define S3C2410_UDC_USBINT_RESET (1<<2) // R/W (clear only)
95#define S3C2410_UDC_USBINT_RESUME (1<<1) // R/W (clear only)
96#define S3C2410_UDC_USBINT_SUSPEND (1<<0) // R/W (clear only)
97
98#define S3C2410_UDC_INTE_EP4 (1<<4) // R/W
99#define S3C2410_UDC_INTE_EP3 (1<<3) // R/W
100#define S3C2410_UDC_INTE_EP2 (1<<2) // R/W
101#define S3C2410_UDC_INTE_EP1 (1<<1) // R/W
102#define S3C2410_UDC_INTE_EP0 (1<<0) // R/W
103
104#define S3C2410_UDC_USBINTE_RESET (1<<2) // R/W
105#define S3C2410_UDC_USBINTE_SUSPEND (1<<0) // R/W
106
107
108#define S3C2410_UDC_INDEX_EP0 (0x00)
109#define S3C2410_UDC_INDEX_EP1 (0x01) // ??
110#define S3C2410_UDC_INDEX_EP2 (0x02) // ??
111#define S3C2410_UDC_INDEX_EP3 (0x03) // ??
112#define S3C2410_UDC_INDEX_EP4 (0x04) // ??
113
114#define S3C2410_UDC_ICSR1_CLRDT (1<<6) // R/W
115#define S3C2410_UDC_ICSR1_SENTSTL (1<<5) // R/W (clear only)
116#define S3C2410_UDC_ICSR1_SENDSTL (1<<4) // R/W
117#define S3C2410_UDC_ICSR1_FFLUSH (1<<3) // W (set only)
118#define S3C2410_UDC_ICSR1_UNDRUN (1<<2) // R/W (clear only)
119#define S3C2410_UDC_ICSR1_PKTRDY (1<<0) // R/W (set only)
120
121#define S3C2410_UDC_ICSR2_AUTOSET (1<<7) // R/W
122#define S3C2410_UDC_ICSR2_ISO (1<<6) // R/W
123#define S3C2410_UDC_ICSR2_MODEIN (1<<5) // R/W
124#define S3C2410_UDC_ICSR2_DMAIEN (1<<4) // R/W
125
126#define S3C2410_UDC_OCSR1_CLRDT (1<<7) // R/W
127#define S3C2410_UDC_OCSR1_SENTSTL (1<<6) // R/W (clear only)
128#define S3C2410_UDC_OCSR1_SENDSTL (1<<5) // R/W
129#define S3C2410_UDC_OCSR1_FFLUSH (1<<4) // R/W
130#define S3C2410_UDC_OCSR1_DERROR (1<<3) // R
131#define S3C2410_UDC_OCSR1_OVRRUN (1<<2) // R/W (clear only)
132#define S3C2410_UDC_OCSR1_PKTRDY (1<<0) // R/W (clear only)
133
134#define S3C2410_UDC_OCSR2_AUTOCLR (1<<7) // R/W
135#define S3C2410_UDC_OCSR2_ISO (1<<6) // R/W
136#define S3C2410_UDC_OCSR2_DMAIEN (1<<5) // R/W
137
138#define S3C2410_UDC_EP0_CSR_OPKRDY (1<<0)
139#define S3C2410_UDC_EP0_CSR_IPKRDY (1<<1)
140#define S3C2410_UDC_EP0_CSR_SENTSTL (1<<2)
141#define S3C2410_UDC_EP0_CSR_DE (1<<3)
142#define S3C2410_UDC_EP0_CSR_SE (1<<4)
143#define S3C2410_UDC_EP0_CSR_SENDSTL (1<<5)
144#define S3C2410_UDC_EP0_CSR_SOPKTRDY (1<<6)
145#define S3C2410_UDC_EP0_CSR_SSE (1<<7)
146
147#define S3C2410_UDC_MAXP_8 (1<<0)
148#define S3C2410_UDC_MAXP_16 (1<<1)
149#define S3C2410_UDC_MAXP_32 (1<<2)
150#define S3C2410_UDC_MAXP_64 (1<<3)
151
152
153#endif
diff --git a/arch/arm/plat-s3c24xx/include/plat/s3c2400.h b/arch/arm/plat-s3c24xx/include/plat/s3c2400.h
index 3a5a16821af8..b3feaea5c70b 100644
--- a/arch/arm/plat-s3c24xx/include/plat/s3c2400.h
+++ b/arch/arm/plat-s3c24xx/include/plat/s3c2400.h
@@ -17,7 +17,7 @@
17 17
18extern int s3c2400_init(void); 18extern int s3c2400_init(void);
19 19
20extern void s3c2400_map_io(struct map_desc *mach_desc, int size); 20extern void s3c2400_map_io(void);
21 21
22extern void s3c2400_init_uarts(struct s3c2410_uartcfg *cfg, int no); 22extern void s3c2400_init_uarts(struct s3c2410_uartcfg *cfg, int no);
23 23
diff --git a/arch/arm/plat-s3c24xx/include/plat/s3c2410.h b/arch/arm/plat-s3c24xx/include/plat/s3c2410.h
index 3cd1ec677b3f..a9ac9e29759e 100644
--- a/arch/arm/plat-s3c24xx/include/plat/s3c2410.h
+++ b/arch/arm/plat-s3c24xx/include/plat/s3c2410.h
@@ -15,7 +15,7 @@
15 15
16extern int s3c2410_init(void); 16extern int s3c2410_init(void);
17 17
18extern void s3c2410_map_io(struct map_desc *mach_desc, int size); 18extern void s3c2410_map_io(void);
19 19
20extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no); 20extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no);
21 21
diff --git a/arch/arm/plat-s3c24xx/include/plat/s3c2412.h b/arch/arm/plat-s3c24xx/include/plat/s3c2412.h
index 3ec97685e781..bb15d3b68be5 100644
--- a/arch/arm/plat-s3c24xx/include/plat/s3c2412.h
+++ b/arch/arm/plat-s3c24xx/include/plat/s3c2412.h
@@ -14,7 +14,7 @@
14 14
15extern int s3c2412_init(void); 15extern int s3c2412_init(void);
16 16
17extern void s3c2412_map_io(struct map_desc *mach_desc, int size); 17extern void s3c2412_map_io(void);
18 18
19extern void s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no); 19extern void s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no);
20 20
diff --git a/arch/arm/plat-s3c24xx/include/plat/s3c2443.h b/arch/arm/plat-s3c24xx/include/plat/s3c2443.h
index 11d83b5c84e6..815b107ed890 100644
--- a/arch/arm/plat-s3c24xx/include/plat/s3c2443.h
+++ b/arch/arm/plat-s3c24xx/include/plat/s3c2443.h
@@ -16,7 +16,7 @@ struct s3c2410_uartcfg;
16 16
17extern int s3c2443_init(void); 17extern int s3c2443_init(void);
18 18
19extern void s3c2443_map_io(struct map_desc *mach_desc, int size); 19extern void s3c2443_map_io(void);
20 20
21extern void s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no); 21extern void s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no);
22 22
diff --git a/arch/arm/plat-s3c24xx/include/plat/udc.h b/arch/arm/plat-s3c24xx/include/plat/udc.h
new file mode 100644
index 000000000000..546bb4008f49
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/include/plat/udc.h
@@ -0,0 +1,36 @@
1/* arch/arm/mach-s3c2410/include/mach/udc.h
2 *
3 * Copyright (c) 2005 Arnaud Patard <arnaud.patard@rtp-net.org>
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 *
11 * Changelog:
12 * 14-Mar-2005 RTP Created file
13 * 02-Aug-2005 RTP File rename
14 * 07-Sep-2005 BJD Minor cleanups, changed cmd to enum
15 * 18-Jan-2007 HMW Add per-platform vbus_draw function
16*/
17
18#ifndef __ASM_ARM_ARCH_UDC_H
19#define __ASM_ARM_ARCH_UDC_H
20
21enum s3c2410_udc_cmd_e {
22 S3C2410_UDC_P_ENABLE = 1, /* Pull-up enable */
23 S3C2410_UDC_P_DISABLE = 2, /* Pull-up disable */
24 S3C2410_UDC_P_RESET = 3, /* UDC reset, in case of */
25};
26
27struct s3c2410_udc_mach_info {
28 void (*udc_command)(enum s3c2410_udc_cmd_e);
29 void (*vbus_draw)(unsigned int ma);
30 unsigned int vbus_pin;
31 unsigned char vbus_pin_inverted;
32};
33
34extern void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *);
35
36#endif /* __ASM_ARM_ARCH_UDC_H */
diff --git a/arch/arm/plat-s3c24xx/irq.c b/arch/arm/plat-s3c24xx/irq.c
index 963f7a4f26f2..0192ecdc1442 100644
--- a/arch/arm/plat-s3c24xx/irq.c
+++ b/arch/arm/plat-s3c24xx/irq.c
@@ -62,6 +62,7 @@
62 62
63#include <asm/mach/irq.h> 63#include <asm/mach/irq.h>
64 64
65#include <plat/regs-irqtype.h>
65#include <mach/regs-irq.h> 66#include <mach/regs-irq.h>
66#include <mach/regs-gpio.h> 67#include <mach/regs-gpio.h>
67 68
diff --git a/arch/arm/plat-s3c24xx/pm.c b/arch/arm/plat-s3c24xx/pm.c
index 8efb57ad5019..34ef18e5b2a1 100644
--- a/arch/arm/plat-s3c24xx/pm.c
+++ b/arch/arm/plat-s3c24xx/pm.c
@@ -33,7 +33,6 @@
33#include <linux/interrupt.h> 33#include <linux/interrupt.h>
34#include <linux/crc32.h> 34#include <linux/crc32.h>
35#include <linux/ioport.h> 35#include <linux/ioport.h>
36#include <linux/delay.h>
37#include <linux/serial_core.h> 36#include <linux/serial_core.h>
38#include <linux/io.h> 37#include <linux/io.h>
39 38
@@ -76,11 +75,13 @@ static struct sleep_save core_save[] = {
76 SAVE_ITEM(S3C2410_BANKCON4), 75 SAVE_ITEM(S3C2410_BANKCON4),
77 SAVE_ITEM(S3C2410_BANKCON5), 76 SAVE_ITEM(S3C2410_BANKCON5),
78 77
78#ifndef CONFIG_CPU_FREQ
79 SAVE_ITEM(S3C2410_CLKDIVN), 79 SAVE_ITEM(S3C2410_CLKDIVN),
80 SAVE_ITEM(S3C2410_MPLLCON), 80 SAVE_ITEM(S3C2410_MPLLCON),
81 SAVE_ITEM(S3C2410_REFRESH),
82#endif
81 SAVE_ITEM(S3C2410_UPLLCON), 83 SAVE_ITEM(S3C2410_UPLLCON),
82 SAVE_ITEM(S3C2410_CLKSLOW), 84 SAVE_ITEM(S3C2410_CLKSLOW),
83 SAVE_ITEM(S3C2410_REFRESH),
84}; 85};
85 86
86static struct gpio_sleep { 87static struct gpio_sleep {
diff --git a/arch/arm/mach-s3c2410/clock.c b/arch/arm/plat-s3c24xx/s3c2410-clock.c
index 4e07943c1e29..b61bdb793734 100644
--- a/arch/arm/mach-s3c2410/clock.c
+++ b/arch/arm/plat-s3c24xx/s3c2410-clock.c
@@ -272,5 +272,6 @@ int __init s3c2410_baseclk_add(void)
272 (clkslow & S3C2410_CLKSLOW_MPLL_OFF) ? "off" : "on", 272 (clkslow & S3C2410_CLKSLOW_MPLL_OFF) ? "off" : "on",
273 (clkslow & S3C2410_CLKSLOW_UCLK_OFF) ? "off" : "on"); 273 (clkslow & S3C2410_CLKSLOW_UCLK_OFF) ? "off" : "on");
274 274
275 s3c_pwmclk_init();
275 return 0; 276 return 0;
276} 277}
diff --git a/arch/arm/plat-s3c24xx/s3c244x-clock.c b/arch/arm/plat-s3c24xx/s3c244x-clock.c
index 7c09773ff9fc..dde41f171aff 100644
--- a/arch/arm/plat-s3c24xx/s3c244x-clock.c
+++ b/arch/arm/plat-s3c24xx/s3c244x-clock.c
@@ -31,7 +31,6 @@
31#include <linux/sysdev.h> 31#include <linux/sysdev.h>
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/ioport.h> 33#include <linux/ioport.h>
34#include <linux/mutex.h>
35#include <linux/clk.h> 34#include <linux/clk.h>
36#include <linux/io.h> 35#include <linux/io.h>
37 36
@@ -102,13 +101,13 @@ static int s3c244x_clk_add(struct sys_device *sysdev)
102 if (clk_get_rate(clock_upll) > (94 * MHZ)) { 101 if (clk_get_rate(clock_upll) > (94 * MHZ)) {
103 clk_usb_bus.rate = clk_get_rate(clock_upll) / 2; 102 clk_usb_bus.rate = clk_get_rate(clock_upll) / 2;
104 103
105 mutex_lock(&clocks_mutex); 104 spin_lock(&clocks_lock);
106 105
107 clkdivn = __raw_readl(S3C2410_CLKDIVN); 106 clkdivn = __raw_readl(S3C2410_CLKDIVN);
108 clkdivn |= S3C2440_CLKDIVN_UCLK; 107 clkdivn |= S3C2440_CLKDIVN_UCLK;
109 __raw_writel(clkdivn, S3C2410_CLKDIVN); 108 __raw_writel(clkdivn, S3C2410_CLKDIVN);
110 109
111 mutex_unlock(&clocks_mutex); 110 spin_unlock(&clocks_lock);
112 } 111 }
113 112
114 return 0; 113 return 0;
diff --git a/arch/arm/plat-s3c24xx/s3c244x.c b/arch/arm/plat-s3c24xx/s3c244x.c
index c0344fac4a94..c1de6bb0101b 100644
--- a/arch/arm/plat-s3c24xx/s3c244x.c
+++ b/arch/arm/plat-s3c24xx/s3c244x.c
@@ -29,6 +29,8 @@
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30#include <asm/irq.h> 30#include <asm/irq.h>
31 31
32#include <plat/cpu-freq.h>
33
32#include <mach/regs-clock.h> 34#include <mach/regs-clock.h>
33#include <plat/regs-serial.h> 35#include <plat/regs-serial.h>
34#include <mach/regs-gpio.h> 36#include <mach/regs-gpio.h>
@@ -42,6 +44,7 @@
42#include <plat/devs.h> 44#include <plat/devs.h>
43#include <plat/cpu.h> 45#include <plat/cpu.h>
44#include <plat/pm.h> 46#include <plat/pm.h>
47#include <plat/pll.h>
45 48
46static struct map_desc s3c244x_iodesc[] __initdata = { 49static struct map_desc s3c244x_iodesc[] __initdata = {
47 IODESC_ENT(CLKPWR), 50 IODESC_ENT(CLKPWR),
@@ -56,32 +59,34 @@ void __init s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no)
56 s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no); 59 s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);
57} 60}
58 61
59void __init s3c244x_map_io(struct map_desc *mach_desc, int size) 62void __init s3c244x_map_io(void)
60{ 63{
61 /* register our io-tables */ 64 /* register our io-tables */
62 65
63 iotable_init(s3c244x_iodesc, ARRAY_SIZE(s3c244x_iodesc)); 66 iotable_init(s3c244x_iodesc, ARRAY_SIZE(s3c244x_iodesc));
64 iotable_init(mach_desc, size);
65 67
66 /* rename any peripherals used differing from the s3c2410 */ 68 /* rename any peripherals used differing from the s3c2410 */
67 69
68 s3c_device_sdi.name = "s3c2440-sdi"; 70 s3c_device_sdi.name = "s3c2440-sdi";
69 s3c_device_i2c.name = "s3c2440-i2c"; 71 s3c_device_i2c0.name = "s3c2440-i2c";
70 s3c_device_nand.name = "s3c2440-nand"; 72 s3c_device_nand.name = "s3c2440-nand";
71 s3c_device_usbgadget.name = "s3c2440-usbgadget"; 73 s3c_device_usbgadget.name = "s3c2440-usbgadget";
72} 74}
73 75
74void __init s3c244x_init_clocks(int xtal) 76void __init_or_cpufreq s3c244x_setup_clocks(void)
75{ 77{
78 struct clk *xtal_clk;
76 unsigned long clkdiv; 79 unsigned long clkdiv;
77 unsigned long camdiv; 80 unsigned long camdiv;
81 unsigned long xtal;
78 unsigned long hclk, fclk, pclk; 82 unsigned long hclk, fclk, pclk;
79 int hdiv = 1; 83 int hdiv = 1;
80 84
81 /* now we've got our machine bits initialised, work out what 85 xtal_clk = clk_get(NULL, "xtal");
82 * clocks we've got */ 86 xtal = clk_get_rate(xtal_clk);
87 clk_put(xtal_clk);
83 88
84 fclk = s3c2410_get_pll(__raw_readl(S3C2410_MPLLCON), xtal) * 2; 89 fclk = s3c24xx_get_pll(__raw_readl(S3C2410_MPLLCON), xtal) * 2;
85 90
86 clkdiv = __raw_readl(S3C2410_CLKDIVN); 91 clkdiv = __raw_readl(S3C2410_CLKDIVN);
87 camdiv = __raw_readl(S3C2440_CAMDIVN); 92 camdiv = __raw_readl(S3C2440_CAMDIVN);
@@ -107,18 +112,24 @@ void __init s3c244x_init_clocks(int xtal)
107 } 112 }
108 113
109 hclk = fclk / hdiv; 114 hclk = fclk / hdiv;
110 pclk = hclk / ((clkdiv & S3C2440_CLKDIVN_PDIVN)? 2:1); 115 pclk = hclk / ((clkdiv & S3C2440_CLKDIVN_PDIVN) ? 2 : 1);
111 116
112 /* print brief summary of clocks, etc */ 117 /* print brief summary of clocks, etc */
113 118
114 printk("S3C244X: core %ld.%03ld MHz, memory %ld.%03ld MHz, peripheral %ld.%03ld MHz\n", 119 printk("S3C244X: core %ld.%03ld MHz, memory %ld.%03ld MHz, peripheral %ld.%03ld MHz\n",
115 print_mhz(fclk), print_mhz(hclk), print_mhz(pclk)); 120 print_mhz(fclk), print_mhz(hclk), print_mhz(pclk));
116 121
122 s3c24xx_setup_clocks(fclk, hclk, pclk);
123}
124
125void __init s3c244x_init_clocks(int xtal)
126{
117 /* initialise the clocks here, to allow other things like the 127 /* initialise the clocks here, to allow other things like the
118 * console to use them, and to add new ones after the initialisation 128 * console to use them, and to add new ones after the initialisation
119 */ 129 */
120 130
121 s3c24xx_setup_clocks(xtal, fclk, hclk, pclk); 131 s3c24xx_register_baseclocks(xtal);
132 s3c244x_setup_clocks();
122 s3c2410_baseclk_add(); 133 s3c2410_baseclk_add();
123} 134}
124 135
diff --git a/arch/arm/plat-s3c24xx/s3c244x.h b/arch/arm/plat-s3c24xx/s3c244x.h
index f8ed17676a35..6aab5eaae2b4 100644
--- a/arch/arm/plat-s3c24xx/s3c244x.h
+++ b/arch/arm/plat-s3c24xx/s3c244x.h
@@ -12,7 +12,7 @@
12 12
13#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442) 13#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
14 14
15extern void s3c244x_map_io(struct map_desc *mach_desc, int size); 15extern void s3c244x_map_io(void);
16 16
17extern void s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no); 17extern void s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no);
18 18
diff --git a/arch/arm/plat-s3c24xx/setup-i2c.c b/arch/arm/plat-s3c24xx/setup-i2c.c
new file mode 100644
index 000000000000..d62b7e7fb355
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/setup-i2c.c
@@ -0,0 +1,25 @@
1/* linux/arch/arm/plat-s3c24xx/setup-i2c.c
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C24XX Base setup for i2c device
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
15struct platform_device;
16
17#include <plat/iic.h>
18#include <mach/hardware.h>
19#include <mach/regs-gpio.h>
20
21void s3c_i2c0_cfg_gpio(struct platform_device *dev)
22{
23 s3c2410_gpio_cfgpin(S3C2410_GPE15, S3C2410_GPE15_IICSDA);
24 s3c2410_gpio_cfgpin(S3C2410_GPE14, S3C2410_GPE14_IICSCL);
25}
diff --git a/arch/arm/plat-s3c24xx/spi-bus0-gpe11_12_13.c b/arch/arm/plat-s3c24xx/spi-bus0-gpe11_12_13.c
new file mode 100644
index 000000000000..8b403cbb53d2
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/spi-bus0-gpe11_12_13.c
@@ -0,0 +1,37 @@
1/* linux/arch/arm/plat-s3c24xx/spi-bus0-gpe11_12_13.c
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C24XX SPI - gpio configuration for bus 0 on gpe11,12,13
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
16#include <mach/hardware.h>
17
18#include <mach/spi.h>
19#include <mach/regs-gpio.h>
20
21void s3c24xx_spi_gpiocfg_bus0_gpe11_12_13(struct s3c2410_spi_info *spi,
22 int enable)
23{
24 if (enable) {
25 s3c2410_gpio_cfgpin(S3C2410_GPE13, S3C2410_GPE13_SPICLK0);
26 s3c2410_gpio_cfgpin(S3C2410_GPE12, S3C2410_GPE12_SPIMOSI0);
27 s3c2410_gpio_cfgpin(S3C2410_GPE11, S3C2410_GPE11_SPIMISO0);
28 s3c2410_gpio_pullup(S3C2410_GPE11, 0);
29 s3c2410_gpio_pullup(S3C2410_GPE13, 0);
30 } else {
31 s3c2410_gpio_cfgpin(S3C2410_GPE13, S3C2410_GPIO_INPUT);
32 s3c2410_gpio_cfgpin(S3C2410_GPE11, S3C2410_GPIO_INPUT);
33 s3c2410_gpio_pullup(S3C2410_GPE11, 1);
34 s3c2410_gpio_pullup(S3C2410_GPE12, 1);
35 s3c2410_gpio_pullup(S3C2410_GPE13, 1);
36 }
37}
diff --git a/arch/arm/plat-s3c24xx/spi-bus1-gpg5_6_7.c b/arch/arm/plat-s3c24xx/spi-bus1-gpg5_6_7.c
new file mode 100644
index 000000000000..8fccd4e549f0
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/spi-bus1-gpg5_6_7.c
@@ -0,0 +1,37 @@
1/* linux/arch/arm/plat-s3c24xx/spi-bus0-gpg5_6_7.c
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C24XX SPI - gpio configuration for bus 1 on gpg5,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 as published by
11 * the Free Software Foundation; either version 2 of the License.
12*/
13
14#include <linux/kernel.h>
15
16#include <mach/hardware.h>
17
18#include <mach/spi.h>
19#include <mach/regs-gpio.h>
20
21void s3c24xx_spi_gpiocfg_bus1_gpg5_6_7(struct s3c2410_spi_info *spi,
22 int enable)
23{
24 if (enable) {
25 s3c2410_gpio_cfgpin(S3C2410_GPG7, S3C2410_GPG7_SPICLK1);
26 s3c2410_gpio_cfgpin(S3C2410_GPG6, S3C2410_GPG6_SPIMOSI1);
27 s3c2410_gpio_cfgpin(S3C2410_GPG5, S3C2410_GPG5_SPIMISO1);
28 s3c2410_gpio_pullup(S3C2410_GPG5, 0);
29 s3c2410_gpio_pullup(S3C2410_GPG6, 0);
30 } else {
31 s3c2410_gpio_cfgpin(S3C2410_GPG7, S3C2410_GPIO_INPUT);
32 s3c2410_gpio_cfgpin(S3C2410_GPG5, S3C2410_GPIO_INPUT);
33 s3c2410_gpio_pullup(S3C2410_GPG5, 1);
34 s3c2410_gpio_pullup(S3C2410_GPG6, 1);
35 s3c2410_gpio_pullup(S3C2410_GPG7, 1);
36 }
37}
diff --git a/arch/arm/plat-s3c64xx/Kconfig b/arch/arm/plat-s3c64xx/Kconfig
new file mode 100644
index 000000000000..54375a00a7d2
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/Kconfig
@@ -0,0 +1,62 @@
1# arch/arm/plat-s3c64xx/Kconfig
2#
3# Copyright 2008 Openmoko, Inc.
4# Copyright 2008 Simtec Electronics
5# Ben Dooks <ben@simtec.co.uk>
6#
7# Licensed under GPLv2
8
9config PLAT_S3C64XX
10 bool
11 depends on ARCH_S3C64XX
12 default y
13 select CPU_V6
14 select PLAT_S3C
15 select ARM_VIC
16 select NO_IOPORT
17 select ARCH_REQUIRE_GPIOLIB
18 select S3C_GPIO_TRACK
19 select S3C_GPIO_PULL_UPDOWN
20 select S3C_GPIO_CFG_S3C24XX
21 select S3C_GPIO_CFG_S3C64XX
22 help
23 Base platform code for any Samsung S3C64XX device
24
25if PLAT_S3C64XX
26
27# Configuration options shared by all S3C64XX implementations
28
29config CPU_S3C6400_INIT
30 bool
31 help
32 Common initialisation code for the S3C6400 that is shared
33 by other CPUs in the series, such as the S3C6410.
34
35config CPU_S3C6400_CLOCK
36 bool
37 help
38 Common clock support code for the S3C6400 that is shared
39 by other CPUs in the series, such as the S3C6410.
40
41# platform specific device setup
42
43config S3C64XX_SETUP_I2C0
44 bool
45 default y
46 help
47 Common setup code for i2c bus 0.
48
49 Note, currently since i2c0 is always compiled, this setup helper
50 is always compiled with it.
51
52config S3C64XX_SETUP_I2C1
53 bool
54 help
55 Common setup code for i2c bus 1.
56
57config S3C64XX_SETUP_FB_24BPP
58 bool
59 help
60 Common setup code for S3C64XX with an 24bpp RGB display helper.
61
62endif
diff --git a/arch/arm/plat-s3c64xx/Makefile b/arch/arm/plat-s3c64xx/Makefile
new file mode 100644
index 000000000000..2e6d79bf8f33
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/Makefile
@@ -0,0 +1,31 @@
1# arch/arm/plat-s3c64xx/Makefile
2#
3# Copyright 2008 Openmoko, Inc.
4# Copyright 2008 Simtec Electronics
5#
6# Licensed under GPLv2
7
8obj-y :=
9obj-m :=
10obj-n := dummy.o
11obj- :=
12
13# Core files
14
15obj-y += dev-uart.o
16obj-y += cpu.o
17obj-y += irq.o
18obj-y += irq-eint.o
19obj-y += clock.o
20obj-y += gpiolib.o
21
22# CPU support
23
24obj-$(CONFIG_CPU_S3C6400_INIT) += s3c6400-init.o
25obj-$(CONFIG_CPU_S3C6400_CLOCK) += s3c6400-clock.o
26
27# Device setup
28
29obj-$(CONFIG_S3C64XX_SETUP_I2C0) += setup-i2c0.o
30obj-$(CONFIG_S3C64XX_SETUP_I2C1) += setup-i2c1.o
31obj-$(CONFIG_S3C64XX_SETUP_FB_24BPP) += setup-fb-24bpp.o
diff --git a/arch/arm/plat-s3c64xx/clock.c b/arch/arm/plat-s3c64xx/clock.c
new file mode 100644
index 000000000000..136c982c68e1
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/clock.c
@@ -0,0 +1,281 @@
1/* linux/arch/arm/plat-s3c64xx/clock.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX Base clock support
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/init.h>
16#include <linux/module.h>
17#include <linux/interrupt.h>
18#include <linux/ioport.h>
19#include <linux/io.h>
20
21#include <mach/hardware.h>
22#include <mach/map.h>
23
24#include <plat/regs-sys.h>
25#include <plat/regs-clock.h>
26#include <plat/cpu.h>
27#include <plat/devs.h>
28#include <plat/clock.h>
29
30struct clk clk_27m = {
31 .name = "clk_27m",
32 .id = -1,
33 .rate = 27000000,
34};
35
36static int clk_48m_ctrl(struct clk *clk, int enable)
37{
38 unsigned long flags;
39 u32 val;
40
41 /* can't rely on clock lock, this register has other usages */
42 local_irq_save(flags);
43
44 val = __raw_readl(S3C64XX_OTHERS);
45 if (enable)
46 val |= S3C64XX_OTHERS_USBMASK;
47 else
48 val &= ~S3C64XX_OTHERS_USBMASK;
49
50 __raw_writel(val, S3C64XX_OTHERS);
51 local_irq_restore(flags);
52
53 return 0;
54}
55
56struct clk clk_48m = {
57 .name = "clk_48m",
58 .id = -1,
59 .rate = 48000000,
60 .enable = clk_48m_ctrl,
61};
62
63static int inline s3c64xx_gate(void __iomem *reg,
64 struct clk *clk,
65 int enable)
66{
67 unsigned int ctrlbit = clk->ctrlbit;
68 u32 con;
69
70 con = __raw_readl(reg);
71
72 if (enable)
73 con |= ctrlbit;
74 else
75 con &= ~ctrlbit;
76
77 __raw_writel(con, reg);
78 return 0;
79}
80
81static int s3c64xx_pclk_ctrl(struct clk *clk, int enable)
82{
83 return s3c64xx_gate(S3C_PCLK_GATE, clk, enable);
84}
85
86static int s3c64xx_hclk_ctrl(struct clk *clk, int enable)
87{
88 return s3c64xx_gate(S3C_HCLK_GATE, clk, enable);
89}
90
91int s3c64xx_sclk_ctrl(struct clk *clk, int enable)
92{
93 return s3c64xx_gate(S3C_SCLK_GATE, clk, enable);
94}
95
96static struct clk init_clocks_disable[] = {
97 {
98 .name = "nand",
99 .id = -1,
100 .parent = &clk_h,
101 }, {
102 .name = "adc",
103 .id = -1,
104 .parent = &clk_p,
105 .enable = s3c64xx_pclk_ctrl,
106 .ctrlbit = S3C_CLKCON_PCLK_TSADC,
107 }, {
108 .name = "i2c",
109 .id = -1,
110 .parent = &clk_p,
111 .enable = s3c64xx_pclk_ctrl,
112 .ctrlbit = S3C_CLKCON_PCLK_IIC,
113 }, {
114 .name = "iis",
115 .id = 0,
116 .parent = &clk_p,
117 .enable = s3c64xx_pclk_ctrl,
118 .ctrlbit = S3C_CLKCON_PCLK_IIS0,
119 }, {
120 .name = "iis",
121 .id = 1,
122 .parent = &clk_p,
123 .enable = s3c64xx_pclk_ctrl,
124 .ctrlbit = S3C_CLKCON_PCLK_IIS1,
125 }, {
126 .name = "spi",
127 .id = 0,
128 .parent = &clk_p,
129 .enable = s3c64xx_pclk_ctrl,
130 .ctrlbit = S3C_CLKCON_PCLK_SPI0,
131 }, {
132 .name = "spi",
133 .id = 1,
134 .parent = &clk_p,
135 .enable = s3c64xx_pclk_ctrl,
136 .ctrlbit = S3C_CLKCON_PCLK_SPI1,
137 }, {
138 .name = "48m",
139 .id = 0,
140 .parent = &clk_48m,
141 .enable = s3c64xx_sclk_ctrl,
142 .ctrlbit = S3C_CLKCON_SCLK_MMC0_48,
143 }, {
144 .name = "48m",
145 .id = 1,
146 .parent = &clk_48m,
147 .enable = s3c64xx_sclk_ctrl,
148 .ctrlbit = S3C_CLKCON_SCLK_MMC1_48,
149 }, {
150 .name = "48m",
151 .id = 2,
152 .parent = &clk_48m,
153 .enable = s3c64xx_sclk_ctrl,
154 .ctrlbit = S3C_CLKCON_SCLK_MMC2_48,
155 },
156};
157
158static struct clk init_clocks[] = {
159 {
160 .name = "lcd",
161 .id = -1,
162 .parent = &clk_h,
163 .enable = s3c64xx_hclk_ctrl,
164 .ctrlbit = S3C_CLKCON_HCLK_LCD,
165 }, {
166 .name = "gpio",
167 .id = -1,
168 .parent = &clk_p,
169 .enable = s3c64xx_pclk_ctrl,
170 .ctrlbit = S3C_CLKCON_PCLK_GPIO,
171 }, {
172 .name = "usb-host",
173 .id = -1,
174 .parent = &clk_h,
175 .enable = s3c64xx_hclk_ctrl,
176 .ctrlbit = S3C_CLKCON_SCLK_UHOST,
177 }, {
178 .name = "hsmmc",
179 .id = 0,
180 .parent = &clk_h,
181 .enable = s3c64xx_hclk_ctrl,
182 .ctrlbit = S3C_CLKCON_HCLK_HSMMC0,
183 }, {
184 .name = "hsmmc",
185 .id = 1,
186 .parent = &clk_h,
187 .enable = s3c64xx_hclk_ctrl,
188 .ctrlbit = S3C_CLKCON_HCLK_HSMMC1,
189 }, {
190 .name = "hsmmc",
191 .id = 2,
192 .parent = &clk_h,
193 .enable = s3c64xx_hclk_ctrl,
194 .ctrlbit = S3C_CLKCON_HCLK_HSMMC2,
195 }, {
196 .name = "timers",
197 .id = -1,
198 .parent = &clk_p,
199 .enable = s3c64xx_pclk_ctrl,
200 .ctrlbit = S3C_CLKCON_PCLK_PWM,
201 }, {
202 .name = "uart",
203 .id = 0,
204 .parent = &clk_p,
205 .enable = s3c64xx_pclk_ctrl,
206 .ctrlbit = S3C_CLKCON_PCLK_UART0,
207 }, {
208 .name = "uart",
209 .id = 1,
210 .parent = &clk_p,
211 .enable = s3c64xx_pclk_ctrl,
212 .ctrlbit = S3C_CLKCON_PCLK_UART1,
213 }, {
214 .name = "uart",
215 .id = 2,
216 .parent = &clk_p,
217 .enable = s3c64xx_pclk_ctrl,
218 .ctrlbit = S3C_CLKCON_PCLK_UART2,
219 }, {
220 .name = "uart",
221 .id = 3,
222 .parent = &clk_p,
223 .enable = s3c64xx_pclk_ctrl,
224 .ctrlbit = S3C_CLKCON_PCLK_UART3,
225 }, {
226 .name = "rtc",
227 .id = -1,
228 .parent = &clk_p,
229 .enable = s3c64xx_pclk_ctrl,
230 .ctrlbit = S3C_CLKCON_PCLK_RTC,
231 }, {
232 .name = "watchdog",
233 .id = -1,
234 .parent = &clk_p,
235 .ctrlbit = S3C_CLKCON_PCLK_WDT,
236 }, {
237 .name = "ac97",
238 .id = -1,
239 .parent = &clk_p,
240 .ctrlbit = S3C_CLKCON_PCLK_AC97,
241 }
242};
243
244static struct clk *clks[] __initdata = {
245 &clk_ext,
246 &clk_epll,
247 &clk_27m,
248 &clk_48m,
249};
250
251void s3c64xx_register_clocks(void)
252{
253 struct clk *clkp;
254 int ret;
255 int ptr;
256
257 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
258
259 clkp = init_clocks;
260 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++, clkp++) {
261 ret = s3c24xx_register_clock(clkp);
262 if (ret < 0) {
263 printk(KERN_ERR "Failed to register clock %s (%d)\n",
264 clkp->name, ret);
265 }
266 }
267
268 clkp = init_clocks_disable;
269 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) {
270
271 ret = s3c24xx_register_clock(clkp);
272 if (ret < 0) {
273 printk(KERN_ERR "Failed to register clock %s (%d)\n",
274 clkp->name, ret);
275 }
276
277 (clkp->enable)(clkp, 0);
278 }
279
280 s3c_pwmclk_init();
281}
diff --git a/arch/arm/plat-s3c64xx/cpu.c b/arch/arm/plat-s3c64xx/cpu.c
new file mode 100644
index 000000000000..fbde183a4560
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/cpu.c
@@ -0,0 +1,114 @@
1/* linux/arch/arm/plat-s3c64xx/cpu.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX CPU Support
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/init.h>
16#include <linux/module.h>
17#include <linux/interrupt.h>
18#include <linux/ioport.h>
19#include <linux/serial_core.h>
20#include <linux/platform_device.h>
21#include <linux/io.h>
22
23#include <mach/hardware.h>
24#include <mach/map.h>
25
26#include <asm/mach/arch.h>
27#include <asm/mach/map.h>
28
29#include <plat/regs-serial.h>
30
31#include <plat/cpu.h>
32#include <plat/devs.h>
33#include <plat/clock.h>
34
35#include <plat/s3c6400.h>
36#include <plat/s3c6410.h>
37
38/* table of supported CPUs */
39
40static const char name_s3c6400[] = "S3C6400";
41static const char name_s3c6410[] = "S3C6410";
42
43static struct cpu_table cpu_ids[] __initdata = {
44 {
45 .idcode = 0x36400000,
46 .idmask = 0xfffff000,
47 .map_io = s3c6400_map_io,
48 .init_clocks = s3c6400_init_clocks,
49 .init_uarts = s3c6400_init_uarts,
50 .init = s3c6400_init,
51 .name = name_s3c6400,
52 }, {
53 .idcode = 0x36410100,
54 .idmask = 0xffffff00,
55 .map_io = s3c6410_map_io,
56 .init_clocks = s3c6410_init_clocks,
57 .init_uarts = s3c6410_init_uarts,
58 .init = s3c6410_init,
59 .name = name_s3c6410,
60 },
61};
62
63/* minimal IO mapping */
64
65/* see notes on uart map in arch/arm/mach-s3c6400/include/mach/debug-macro.S */
66#define UART_OFFS (S3C_PA_UART & 0xfffff)
67
68static struct map_desc s3c_iodesc[] __initdata = {
69 {
70 .virtual = (unsigned long)S3C_VA_SYS,
71 .pfn = __phys_to_pfn(S3C64XX_PA_SYSCON),
72 .length = SZ_4K,
73 .type = MT_DEVICE,
74 }, {
75 .virtual = (unsigned long)(S3C_VA_UART + UART_OFFS),
76 .pfn = __phys_to_pfn(S3C_PA_UART),
77 .length = SZ_4K,
78 .type = MT_DEVICE,
79 }, {
80 .virtual = (unsigned long)S3C_VA_VIC0,
81 .pfn = __phys_to_pfn(S3C64XX_PA_VIC0),
82 .length = SZ_16K,
83 .type = MT_DEVICE,
84 }, {
85 .virtual = (unsigned long)S3C_VA_VIC1,
86 .pfn = __phys_to_pfn(S3C64XX_PA_VIC1),
87 .length = SZ_16K,
88 .type = MT_DEVICE,
89 }, {
90 .virtual = (unsigned long)S3C_VA_TIMER,
91 .pfn = __phys_to_pfn(S3C_PA_TIMER),
92 .length = SZ_16K,
93 .type = MT_DEVICE,
94 }, {
95 .virtual = (unsigned long)S3C64XX_VA_GPIO,
96 .pfn = __phys_to_pfn(S3C64XX_PA_GPIO),
97 .length = SZ_4K,
98 .type = MT_DEVICE,
99 },
100};
101
102/* read cpu identification code */
103
104void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
105{
106 unsigned long idcode;
107
108 /* initialise the io descriptors we need for initialisation */
109 iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
110 iotable_init(mach_desc, size);
111
112 idcode = __raw_readl(S3C_VA_SYS + 0x118);
113 s3c_init_cpu(idcode, cpu_ids, ARRAY_SIZE(cpu_ids));
114}
diff --git a/arch/arm/plat-s3c64xx/dev-uart.c b/arch/arm/plat-s3c64xx/dev-uart.c
new file mode 100644
index 000000000000..62c11a6fc7ba
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/dev-uart.c
@@ -0,0 +1,176 @@
1/* linux/arch/arm/plat-s3c64xx/dev-uart.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * Base S3C64XX UART resource and device definitions
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
16#include <linux/kernel.h>
17#include <linux/types.h>
18#include <linux/interrupt.h>
19#include <linux/list.h>
20#include <linux/platform_device.h>
21
22#include <asm/mach/arch.h>
23#include <asm/mach/irq.h>
24#include <mach/hardware.h>
25#include <mach/map.h>
26
27#include <plat/devs.h>
28
29/* Serial port registrations */
30
31/* 64xx uarts are closer together */
32
33static struct resource s3c64xx_uart0_resource[] = {
34 [0] = {
35 .start = S3C_PA_UART0,
36 .end = S3C_PA_UART0 + 0x100,
37 .flags = IORESOURCE_MEM,
38 },
39 [1] = {
40 .start = IRQ_S3CUART_RX0,
41 .end = IRQ_S3CUART_RX0,
42 .flags = IORESOURCE_IRQ,
43 },
44 [2] = {
45 .start = IRQ_S3CUART_TX0,
46 .end = IRQ_S3CUART_TX0,
47 .flags = IORESOURCE_IRQ,
48
49 },
50 [3] = {
51 .start = IRQ_S3CUART_ERR0,
52 .end = IRQ_S3CUART_ERR0,
53 .flags = IORESOURCE_IRQ,
54 }
55};
56
57static struct resource s3c64xx_uart1_resource[] = {
58 [0] = {
59 .start = S3C_PA_UART1,
60 .end = S3C_PA_UART1 + 0x100,
61 .flags = IORESOURCE_MEM,
62 },
63 [1] = {
64 .start = IRQ_S3CUART_RX1,
65 .end = IRQ_S3CUART_RX1,
66 .flags = IORESOURCE_IRQ,
67 },
68 [2] = {
69 .start = IRQ_S3CUART_TX1,
70 .end = IRQ_S3CUART_TX1,
71 .flags = IORESOURCE_IRQ,
72
73 },
74 [3] = {
75 .start = IRQ_S3CUART_ERR1,
76 .end = IRQ_S3CUART_ERR1,
77 .flags = IORESOURCE_IRQ,
78 },
79};
80
81static struct resource s3c6xx_uart2_resource[] = {
82 [0] = {
83 .start = S3C_PA_UART2,
84 .end = S3C_PA_UART2 + 0x100,
85 .flags = IORESOURCE_MEM,
86 },
87 [1] = {
88 .start = IRQ_S3CUART_RX2,
89 .end = IRQ_S3CUART_RX2,
90 .flags = IORESOURCE_IRQ,
91 },
92 [2] = {
93 .start = IRQ_S3CUART_TX2,
94 .end = IRQ_S3CUART_TX2,
95 .flags = IORESOURCE_IRQ,
96
97 },
98 [3] = {
99 .start = IRQ_S3CUART_ERR2,
100 .end = IRQ_S3CUART_ERR2,
101 .flags = IORESOURCE_IRQ,
102 },
103};
104
105static struct resource s3c64xx_uart3_resource[] = {
106 [0] = {
107 .start = S3C_PA_UART3,
108 .end = S3C_PA_UART3 + 0x100,
109 .flags = IORESOURCE_MEM,
110 },
111 [1] = {
112 .start = IRQ_S3CUART_RX3,
113 .end = IRQ_S3CUART_RX3,
114 .flags = IORESOURCE_IRQ,
115 },
116 [2] = {
117 .start = IRQ_S3CUART_TX3,
118 .end = IRQ_S3CUART_TX3,
119 .flags = IORESOURCE_IRQ,
120
121 },
122 [3] = {
123 .start = IRQ_S3CUART_ERR3,
124 .end = IRQ_S3CUART_ERR3,
125 .flags = IORESOURCE_IRQ,
126 },
127};
128
129
130struct s3c24xx_uart_resources s3c64xx_uart_resources[] __initdata = {
131 [0] = {
132 .resources = s3c64xx_uart0_resource,
133 .nr_resources = ARRAY_SIZE(s3c64xx_uart0_resource),
134 },
135 [1] = {
136 .resources = s3c64xx_uart1_resource,
137 .nr_resources = ARRAY_SIZE(s3c64xx_uart1_resource),
138 },
139 [2] = {
140 .resources = s3c6xx_uart2_resource,
141 .nr_resources = ARRAY_SIZE(s3c6xx_uart2_resource),
142 },
143 [3] = {
144 .resources = s3c64xx_uart3_resource,
145 .nr_resources = ARRAY_SIZE(s3c64xx_uart3_resource),
146 },
147};
148
149/* uart devices */
150
151static struct platform_device s3c24xx_uart_device0 = {
152 .id = 0,
153};
154
155static struct platform_device s3c24xx_uart_device1 = {
156 .id = 1,
157};
158
159static struct platform_device s3c24xx_uart_device2 = {
160 .id = 2,
161};
162
163static struct platform_device s3c24xx_uart_device3 = {
164 .id = 3,
165};
166
167struct platform_device *s3c24xx_uart_src[4] = {
168 &s3c24xx_uart_device0,
169 &s3c24xx_uart_device1,
170 &s3c24xx_uart_device2,
171 &s3c24xx_uart_device3,
172};
173
174struct platform_device *s3c24xx_uart_devs[4] = {
175};
176
diff --git a/arch/arm/plat-s3c64xx/gpiolib.c b/arch/arm/plat-s3c64xx/gpiolib.c
new file mode 100644
index 000000000000..cc62941d7b5c
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/gpiolib.c
@@ -0,0 +1,420 @@
1/* arch/arm/plat-s3c64xx/gpiolib.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX - GPIOlib support
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/irq.h>
17#include <linux/io.h>
18
19#include <mach/map.h>
20#include <mach/gpio.h>
21#include <mach/gpio-core.h>
22
23#include <plat/gpio-cfg.h>
24#include <plat/gpio-cfg-helpers.h>
25#include <plat/regs-gpio.h>
26
27/* GPIO bank summary:
28 *
29 * Bank GPIOs Style SlpCon ExtInt Group
30 * A 8 4Bit Yes 1
31 * B 7 4Bit Yes 1
32 * C 8 4Bit Yes 2
33 * D 5 4Bit Yes 3
34 * E 5 4Bit Yes None
35 * F 16 2Bit Yes 4 [1]
36 * G 7 4Bit Yes 5
37 * H 10 4Bit[2] Yes 6
38 * I 16 2Bit Yes None
39 * J 12 2Bit Yes None
40 * K 16 4Bit[2] No None
41 * L 15 4Bit[2] No None
42 * M 6 4Bit No IRQ_EINT
43 * N 16 2Bit No IRQ_EINT
44 * O 16 2Bit Yes 7
45 * P 15 2Bit Yes 8
46 * Q 9 2Bit Yes 9
47 *
48 * [1] BANKF pins 14,15 do not form part of the external interrupt sources
49 * [2] BANK has two control registers, GPxCON0 and GPxCON1
50 */
51
52#define OFF_GPCON (0x00)
53#define OFF_GPDAT (0x04)
54
55#define con_4bit_shift(__off) ((__off) * 4)
56
57#if 1
58#define gpio_dbg(x...) do { } while(0)
59#else
60#define gpio_dbg(x...) printk(KERN_DEBUG ## x)
61#endif
62
63/* The s3c64xx_gpiolib_4bit routines are to control the gpio banks where
64 * the gpio configuration register (GPxCON) has 4 bits per GPIO, as the
65 * following example:
66 *
67 * base + 0x00: Control register, 4 bits per gpio
68 * gpio n: 4 bits starting at (4*n)
69 * 0000 = input, 0001 = output, others mean special-function
70 * base + 0x04: Data register, 1 bit per gpio
71 * bit n: data bit n
72 *
73 * Note, since the data register is one bit per gpio and is at base + 0x4
74 * we can use s3c_gpiolib_get and s3c_gpiolib_set to change the state of
75 * the output.
76*/
77
78static int s3c64xx_gpiolib_4bit_input(struct gpio_chip *chip, unsigned offset)
79{
80 struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip);
81 void __iomem *base = ourchip->base;
82 unsigned long con;
83
84 con = __raw_readl(base + OFF_GPCON);
85 con &= ~(0xf << con_4bit_shift(offset));
86 __raw_writel(con, base + OFF_GPCON);
87
88 gpio_dbg("%s: %p: CON now %08lx\n", __func__, base, con);
89
90 return 0;
91}
92
93static int s3c64xx_gpiolib_4bit_output(struct gpio_chip *chip,
94 unsigned offset, int value)
95{
96 struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip);
97 void __iomem *base = ourchip->base;
98 unsigned long con;
99 unsigned long dat;
100
101 con = __raw_readl(base + OFF_GPCON);
102 con &= ~(0xf << con_4bit_shift(offset));
103 con |= 0x1 << con_4bit_shift(offset);
104
105 dat = __raw_readl(base + OFF_GPDAT);
106 if (value)
107 dat |= 1 << offset;
108 else
109 dat &= ~(1 << offset);
110
111 __raw_writel(dat, base + OFF_GPDAT);
112 __raw_writel(con, base + OFF_GPCON);
113 __raw_writel(dat, base + OFF_GPDAT);
114
115 gpio_dbg("%s: %p: CON %08lx, DAT %08lx\n", __func__, base, con, dat);
116
117 return 0;
118}
119
120/* The next set of routines are for the case where the GPIO configuration
121 * registers are 4 bits per GPIO but there is more than one register (the
122 * bank has more than 8 GPIOs.
123 *
124 * This case is the similar to the 4 bit case, but the registers are as
125 * follows:
126 *
127 * base + 0x00: Control register, 4 bits per gpio (lower 8 GPIOs)
128 * gpio n: 4 bits starting at (4*n)
129 * 0000 = input, 0001 = output, others mean special-function
130 * base + 0x04: Control register, 4 bits per gpio (up to 8 additions GPIOs)
131 * gpio n: 4 bits starting at (4*n)
132 * 0000 = input, 0001 = output, others mean special-function
133 * base + 0x08: Data register, 1 bit per gpio
134 * bit n: data bit n
135 *
136 * To allow us to use the s3c_gpiolib_get and s3c_gpiolib_set routines we
137 * store the 'base + 0x4' address so that these routines see the data
138 * register at ourchip->base + 0x04.
139*/
140
141static int s3c64xx_gpiolib_4bit2_input(struct gpio_chip *chip, unsigned offset)
142{
143 struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip);
144 void __iomem *base = ourchip->base;
145 void __iomem *regcon = base;
146 unsigned long con;
147
148 if (offset > 7)
149 offset -= 8;
150 else
151 regcon -= 4;
152
153 con = __raw_readl(regcon);
154 con &= ~(0xf << con_4bit_shift(offset));
155 __raw_writel(con, regcon);
156
157 gpio_dbg("%s: %p: CON %08lx\n", __func__, base, con);
158
159 return 0;
160
161}
162
163static int s3c64xx_gpiolib_4bit2_output(struct gpio_chip *chip,
164 unsigned offset, int value)
165{
166 struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip);
167 void __iomem *base = ourchip->base;
168 void __iomem *regcon = base;
169 unsigned long con;
170 unsigned long dat;
171
172 if (offset > 7)
173 offset -= 8;
174 else
175 regcon -= 4;
176
177 con = __raw_readl(regcon);
178 con &= ~(0xf << con_4bit_shift(offset));
179 con |= 0x1 << con_4bit_shift(offset);
180
181 dat = __raw_readl(base + OFF_GPDAT);
182 if (value)
183 dat |= 1 << offset;
184 else
185 dat &= ~(1 << offset);
186
187 __raw_writel(dat, base + OFF_GPDAT);
188 __raw_writel(con, regcon);
189 __raw_writel(dat, base + OFF_GPDAT);
190
191 gpio_dbg("%s: %p: CON %08lx, DAT %08lx\n", __func__, base, con, dat);
192
193 return 0;
194}
195
196static struct s3c_gpio_cfg gpio_4bit_cfg_noint = {
197 .set_config = s3c_gpio_setcfg_s3c64xx_4bit,
198 .set_pull = s3c_gpio_setpull_updown,
199 .get_pull = s3c_gpio_getpull_updown,
200};
201
202static struct s3c_gpio_cfg gpio_4bit_cfg_eint0111 = {
203 .cfg_eint = 7,
204 .set_config = s3c_gpio_setcfg_s3c64xx_4bit,
205 .set_pull = s3c_gpio_setpull_updown,
206 .get_pull = s3c_gpio_getpull_updown,
207};
208
209static struct s3c_gpio_cfg gpio_4bit_cfg_eint0011 = {
210 .cfg_eint = 3,
211 .set_config = s3c_gpio_setcfg_s3c64xx_4bit,
212 .set_pull = s3c_gpio_setpull_updown,
213 .get_pull = s3c_gpio_getpull_updown,
214};
215
216static struct s3c_gpio_chip gpio_4bit[] = {
217 {
218 .base = S3C64XX_GPA_BASE,
219 .config = &gpio_4bit_cfg_eint0111,
220 .chip = {
221 .base = S3C64XX_GPA(0),
222 .ngpio = S3C64XX_GPIO_A_NR,
223 .label = "GPA",
224 },
225 }, {
226 .base = S3C64XX_GPB_BASE,
227 .config = &gpio_4bit_cfg_eint0111,
228 .chip = {
229 .base = S3C64XX_GPB(0),
230 .ngpio = S3C64XX_GPIO_B_NR,
231 .label = "GPB",
232 },
233 }, {
234 .base = S3C64XX_GPC_BASE,
235 .config = &gpio_4bit_cfg_eint0111,
236 .chip = {
237 .base = S3C64XX_GPC(0),
238 .ngpio = S3C64XX_GPIO_C_NR,
239 .label = "GPC",
240 },
241 }, {
242 .base = S3C64XX_GPD_BASE,
243 .config = &gpio_4bit_cfg_eint0111,
244 .chip = {
245 .base = S3C64XX_GPD(0),
246 .ngpio = S3C64XX_GPIO_D_NR,
247 .label = "GPD",
248 },
249 }, {
250 .base = S3C64XX_GPE_BASE,
251 .config = &gpio_4bit_cfg_noint,
252 .chip = {
253 .base = S3C64XX_GPE(0),
254 .ngpio = S3C64XX_GPIO_E_NR,
255 .label = "GPE",
256 },
257 }, {
258 .base = S3C64XX_GPG_BASE,
259 .config = &gpio_4bit_cfg_eint0111,
260 .chip = {
261 .base = S3C64XX_GPG(0),
262 .ngpio = S3C64XX_GPIO_G_NR,
263 .label = "GPG",
264 },
265 }, {
266 .base = S3C64XX_GPM_BASE,
267 .config = &gpio_4bit_cfg_eint0011,
268 .chip = {
269 .base = S3C64XX_GPM(0),
270 .ngpio = S3C64XX_GPIO_M_NR,
271 .label = "GPM",
272 },
273 },
274};
275
276static struct s3c_gpio_chip gpio_4bit2[] = {
277 {
278 .base = S3C64XX_GPH_BASE + 0x4,
279 .config = &gpio_4bit_cfg_eint0111,
280 .chip = {
281 .base = S3C64XX_GPH(0),
282 .ngpio = S3C64XX_GPIO_H_NR,
283 .label = "GPH",
284 },
285 }, {
286 .base = S3C64XX_GPK_BASE + 0x4,
287 .config = &gpio_4bit_cfg_noint,
288 .chip = {
289 .base = S3C64XX_GPK(0),
290 .ngpio = S3C64XX_GPIO_K_NR,
291 .label = "GPK",
292 },
293 }, {
294 .base = S3C64XX_GPL_BASE + 0x4,
295 .config = &gpio_4bit_cfg_eint0011,
296 .chip = {
297 .base = S3C64XX_GPL(0),
298 .ngpio = S3C64XX_GPIO_L_NR,
299 .label = "GPL",
300 },
301 },
302};
303
304static struct s3c_gpio_cfg gpio_2bit_cfg_noint = {
305 .set_config = s3c_gpio_setcfg_s3c24xx,
306 .set_pull = s3c_gpio_setpull_updown,
307 .get_pull = s3c_gpio_getpull_updown,
308};
309
310static struct s3c_gpio_cfg gpio_2bit_cfg_eint10 = {
311 .cfg_eint = 2,
312 .set_config = s3c_gpio_setcfg_s3c24xx,
313 .set_pull = s3c_gpio_setpull_updown,
314 .get_pull = s3c_gpio_getpull_updown,
315};
316
317static struct s3c_gpio_cfg gpio_2bit_cfg_eint11 = {
318 .cfg_eint = 3,
319 .set_config = s3c_gpio_setcfg_s3c24xx,
320 .set_pull = s3c_gpio_setpull_updown,
321 .get_pull = s3c_gpio_getpull_updown,
322};
323
324static struct s3c_gpio_chip gpio_2bit[] = {
325 {
326 .base = S3C64XX_GPF_BASE,
327 .config = &gpio_2bit_cfg_eint11,
328 .chip = {
329 .base = S3C64XX_GPF(0),
330 .ngpio = S3C64XX_GPIO_F_NR,
331 .label = "GPF",
332 },
333 }, {
334 .base = S3C64XX_GPI_BASE,
335 .config = &gpio_2bit_cfg_noint,
336 .chip = {
337 .base = S3C64XX_GPI(0),
338 .ngpio = S3C64XX_GPIO_I_NR,
339 .label = "GPI",
340 },
341 }, {
342 .base = S3C64XX_GPJ_BASE,
343 .config = &gpio_2bit_cfg_noint,
344 .chip = {
345 .base = S3C64XX_GPJ(0),
346 .ngpio = S3C64XX_GPIO_J_NR,
347 .label = "GPJ",
348 },
349 }, {
350 .base = S3C64XX_GPN_BASE,
351 .config = &gpio_2bit_cfg_eint10,
352 .chip = {
353 .base = S3C64XX_GPN(0),
354 .ngpio = S3C64XX_GPIO_N_NR,
355 .label = "GPN",
356 },
357 }, {
358 .base = S3C64XX_GPO_BASE,
359 .config = &gpio_2bit_cfg_eint11,
360 .chip = {
361 .base = S3C64XX_GPO(0),
362 .ngpio = S3C64XX_GPIO_O_NR,
363 .label = "GPO",
364 },
365 }, {
366 .base = S3C64XX_GPP_BASE,
367 .config = &gpio_2bit_cfg_eint11,
368 .chip = {
369 .base = S3C64XX_GPP(0),
370 .ngpio = S3C64XX_GPIO_P_NR,
371 .label = "GPP",
372 },
373 }, {
374 .base = S3C64XX_GPQ_BASE,
375 .config = &gpio_2bit_cfg_eint11,
376 .chip = {
377 .base = S3C64XX_GPQ(0),
378 .ngpio = S3C64XX_GPIO_Q_NR,
379 .label = "GPQ",
380 },
381 },
382};
383
384static __init void s3c64xx_gpiolib_add_4bit(struct s3c_gpio_chip *chip)
385{
386 chip->chip.direction_input = s3c64xx_gpiolib_4bit_input;
387 chip->chip.direction_output = s3c64xx_gpiolib_4bit_output;
388}
389
390static __init void s3c64xx_gpiolib_add_4bit2(struct s3c_gpio_chip *chip)
391{
392 chip->chip.direction_input = s3c64xx_gpiolib_4bit2_input;
393 chip->chip.direction_output = s3c64xx_gpiolib_4bit2_output;
394}
395
396static __init void s3c64xx_gpiolib_add(struct s3c_gpio_chip *chips,
397 int nr_chips,
398 void (*fn)(struct s3c_gpio_chip *))
399{
400 for (; nr_chips > 0; nr_chips--, chips++) {
401 if (fn)
402 (fn)(chips);
403 s3c_gpiolib_add(chips);
404 }
405}
406
407static __init int s3c64xx_gpiolib_init(void)
408{
409 s3c64xx_gpiolib_add(gpio_4bit, ARRAY_SIZE(gpio_4bit),
410 s3c64xx_gpiolib_add_4bit);
411
412 s3c64xx_gpiolib_add(gpio_4bit2, ARRAY_SIZE(gpio_4bit2),
413 s3c64xx_gpiolib_add_4bit2);
414
415 s3c64xx_gpiolib_add(gpio_2bit, ARRAY_SIZE(gpio_2bit), NULL);
416
417 return 0;
418}
419
420arch_initcall(s3c64xx_gpiolib_init);
diff --git a/arch/arm/plat-s3c64xx/include/plat/gpio-bank-a.h b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-a.h
new file mode 100644
index 000000000000..9aa0e427d113
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-a.h
@@ -0,0 +1,48 @@
1/* linux/arch/arm/plat-s3c64xx/include/plat/gpio-bank-a.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * GPIO Bank A register and configuration definitions
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#define S3C64XX_GPACON (S3C64XX_GPA_BASE + 0x00)
16#define S3C64XX_GPADAT (S3C64XX_GPA_BASE + 0x04)
17#define S3C64XX_GPAPUD (S3C64XX_GPA_BASE + 0x08)
18#define S3C64XX_GPACONSLP (S3C64XX_GPA_BASE + 0x0c)
19#define S3C64XX_GPAPUDSLP (S3C64XX_GPA_BASE + 0x10)
20
21#define S3C64XX_GPA_CONMASK(__gpio) (0xf << ((__gpio) * 4))
22#define S3C64XX_GPA_INPUT(__gpio) (0x0 << ((__gpio) * 4))
23#define S3C64XX_GPA_OUTPUT(__gpio) (0x1 << ((__gpio) * 4))
24
25#define S3C64XX_GPA0_UART_RXD0 (0x02 << 0)
26#define S3C64XX_GPA0_EINT_G1_0 (0x07 << 0)
27
28#define S3C64XX_GPA1_UART_TXD0 (0x02 << 4)
29#define S3C64XX_GPA1_EINT_G1_1 (0x07 << 4)
30
31#define S3C64XX_GPA2_UART_nCTS0 (0x02 << 8)
32#define S3C64XX_GPA2_EINT_G1_2 (0x07 << 8)
33
34#define S3C64XX_GPA3_UART_nRTS0 (0x02 << 12)
35#define S3C64XX_GPA3_EINT_G1_3 (0x07 << 12)
36
37#define S3C64XX_GPA4_UART_RXD1 (0x02 << 16)
38#define S3C64XX_GPA4_EINT_G1_4 (0x07 << 16)
39
40#define S3C64XX_GPA5_UART_TXD1 (0x02 << 20)
41#define S3C64XX_GPA5_EINT_G1_5 (0x07 << 20)
42
43#define S3C64XX_GPA6_UART_nCTS1 (0x02 << 24)
44#define S3C64XX_GPA6_EINT_G1_6 (0x07 << 24)
45
46#define S3C64XX_GPA7_UART_nRTS1 (0x02 << 28)
47#define S3C64XX_GPA7_EINT_G1_7 (0x07 << 28)
48
diff --git a/arch/arm/plat-s3c64xx/include/plat/gpio-bank-b.h b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-b.h
new file mode 100644
index 000000000000..3933adb4d50a
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-b.h
@@ -0,0 +1,60 @@
1/* linux/arch/arm/plat-s3c64xx/include/plat/gpio-bank-b.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * GPIO Bank B register and configuration definitions
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#define S3C64XX_GPBCON (S3C64XX_GPB_BASE + 0x00)
16#define S3C64XX_GPBDAT (S3C64XX_GPB_BASE + 0x04)
17#define S3C64XX_GPBPUD (S3C64XX_GPB_BASE + 0x08)
18#define S3C64XX_GPBCONSLP (S3C64XX_GPB_BASE + 0x0c)
19#define S3C64XX_GPBPUDSLP (S3C64XX_GPB_BASE + 0x10)
20
21#define S3C64XX_GPB_CONMASK(__gpio) (0xf << ((__gpio) * 4))
22#define S3C64XX_GPB_INPUT(__gpio) (0x0 << ((__gpio) * 4))
23#define S3C64XX_GPB_OUTPUT(__gpio) (0x1 << ((__gpio) * 4))
24
25#define S3C64XX_GPB0_UART_RXD2 (0x02 << 0)
26#define S3C64XX_GPB0_EXTDMA_REQ (0x03 << 0)
27#define S3C64XX_GPB0_IrDA_RXD (0x04 << 0)
28#define S3C64XX_GPB0_ADDR_CF0 (0x05 << 0)
29#define S3C64XX_GPB0_EINT_G1_8 (0x07 << 0)
30
31#define S3C64XX_GPB1_UART_TXD2 (0x02 << 4)
32#define S3C64XX_GPB1_EXTDMA_ACK (0x03 << 4)
33#define S3C64XX_GPB1_IrDA_TXD (0x04 << 4)
34#define S3C64XX_GPB1_ADDR_CF1 (0x05 << 4)
35#define S3C64XX_GPB1_EINT_G1_9 (0x07 << 4)
36
37#define S3C64XX_GPB2_UART_RXD3 (0x02 << 8)
38#define S3C64XX_GPB2_IrDA_RXD (0x03 << 8)
39#define S3C64XX_GPB2_EXTDMA_REQ (0x04 << 8)
40#define S3C64XX_GPB2_ADDR_CF2 (0x05 << 8)
41#define S3C64XX_GPB2_I2C_SCL1 (0x06 << 8)
42#define S3C64XX_GPB2_EINT_G1_10 (0x07 << 8)
43
44#define S3C64XX_GPB3_UART_TXD3 (0x02 << 12)
45#define S3C64XX_GPB3_IrDA_TXD (0x03 << 12)
46#define S3C64XX_GPB3_EXTDMA_ACK (0x04 << 12)
47#define S3C64XX_GPB3_I2C_SDA1 (0x06 << 12)
48#define S3C64XX_GPB3_EINT_G1_11 (0x07 << 12)
49
50#define S3C64XX_GPB4_IrDA_SDBW (0x02 << 16)
51#define S3C64XX_GPB4_CAM_FIELD (0x03 << 16)
52#define S3C64XX_GPB4_CF_DATA_DIR (0x04 << 16)
53#define S3C64XX_GPB4_EINT_G1_12 (0x07 << 16)
54
55#define S3C64XX_GPB5_I2C_SCL0 (0x02 << 20)
56#define S3C64XX_GPB5_EINT_G1_13 (0x07 << 20)
57
58#define S3C64XX_GPB6_I2C_SDA0 (0x02 << 24)
59#define S3C64XX_GPB6_EINT_G1_14 (0x07 << 24)
60
diff --git a/arch/arm/plat-s3c64xx/include/plat/gpio-bank-c.h b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-c.h
new file mode 100644
index 000000000000..c47daf7e2723
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-c.h
@@ -0,0 +1,53 @@
1/* linux/arch/arm/plat-s3c64xx/include/plat/gpio-bank-c.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * GPIO Bank C register and configuration definitions
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#define S3C64XX_GPCCON (S3C64XX_GPC_BASE + 0x00)
16#define S3C64XX_GPCDAT (S3C64XX_GPC_BASE + 0x04)
17#define S3C64XX_GPCPUD (S3C64XX_GPC_BASE + 0x08)
18#define S3C64XX_GPCCONSLP (S3C64XX_GPC_BASE + 0x0c)
19#define S3C64XX_GPCPUDSLP (S3C64XX_GPC_BASE + 0x10)
20
21#define S3C64XX_GPC_CONMASK(__gpio) (0xf << ((__gpio) * 4))
22#define S3C64XX_GPC_INPUT(__gpio) (0x0 << ((__gpio) * 4))
23#define S3C64XX_GPC_OUTPUT(__gpio) (0x1 << ((__gpio) * 4))
24
25#define S3C64XX_GPC0_SPI_MISO0 (0x02 << 0)
26#define S3C64XX_GPC0_EINT_G2_0 (0x07 << 0)
27
28#define S3C64XX_GPC1_SPI_CLKO (0x02 << 4)
29#define S3C64XX_GPC1_EINT_G2_1 (0x07 << 4)
30
31#define S3C64XX_GPC2_SPI_MOSIO (0x02 << 8)
32#define S3C64XX_GPC2_EINT_G2_2 (0x07 << 8)
33
34#define S3C64XX_GPC3_SPI_nCSO (0x02 << 12)
35#define S3C64XX_GPC3_EINT_G2_3 (0x07 << 12)
36
37#define S3C64XX_GPC4_SPI_MISO1 (0x02 << 16)
38#define S3C64XX_GPC4_MMC2_CMD (0x03 << 16)
39#define S3C64XX_GPC4_I2S0_V40_DO (0x05 << 16)
40#define S3C64XX_GPC4_EINT_G2_4 (0x07 << 16)
41
42#define S3C64XX_GPC5_SPI_CLK1 (0x02 << 20)
43#define S3C64XX_GPC5_MMC2_CLK (0x03 << 20)
44#define S3C64XX_GPC5_I2S1_V40_DO (0x05 << 20)
45#define S3C64XX_GPC5_EINT_G2_5 (0x07 << 20)
46
47#define S3C64XX_GPC6_SPI_MOSI1 (0x02 << 24)
48#define S3C64XX_GPC6_EINT_G2_6 (0x07 << 24)
49
50#define S3C64XX_GPC7_SPI_nCS1 (0x02 << 28)
51#define S3C64XX_GPC7_I2S2_V40_DO (0x05 << 28)
52#define S3C64XX_GPC7_EINT_G2_7 (0x07 << 28)
53
diff --git a/arch/arm/plat-s3c64xx/include/plat/gpio-bank-d.h b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-d.h
new file mode 100644
index 000000000000..6fe4a49c26f0
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-d.h
@@ -0,0 +1,49 @@
1/* linux/arch/arm/plat-s3c64xx/include/plat/gpio-bank-d.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * GPIO Bank D register and configuration definitions
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#define S3C64XX_GPDCON (S3C64XX_GPD_BASE + 0x00)
16#define S3C64XX_GPDDAT (S3C64XX_GPD_BASE + 0x04)
17#define S3C64XX_GPDPUD (S3C64XX_GPD_BASE + 0x08)
18#define S3C64XX_GPDCONSLP (S3C64XX_GPD_BASE + 0x0c)
19#define S3C64XX_GPDPUDSLP (S3C64XX_GPD_BASE + 0x10)
20
21#define S3C64XX_GPD_CONMASK(__gpio) (0xf << ((__gpio) * 4))
22#define S3C64XX_GPD_INPUT(__gpio) (0x0 << ((__gpio) * 4))
23#define S3C64XX_GPD_OUTPUT(__gpio) (0x1 << ((__gpio) * 4))
24
25#define S3C64XX_GPD0_PCM0_SCLK (0x02 << 0)
26#define S3C64XX_GPD0_I2S0_CLK (0x03 << 0)
27#define S3C64XX_GPD0_AC97_BITCLK (0x04 << 0)
28#define S3C64XX_GPD0_EINT_G3_0 (0x07 << 0)
29
30#define S3C64XX_GPD1_PCM0_EXTCLK (0x02 << 4)
31#define S3C64XX_GPD1_I2S0_CDCLK (0x03 << 4)
32#define S3C64XX_GPD1_AC97_nRESET (0x04 << 4)
33#define S3C64XX_GPD1_EINT_G3_1 (0x07 << 4)
34
35#define S3C64XX_GPD2_PCM0_FSYNC (0x02 << 8)
36#define S3C64XX_GPD2_I2S0_LRCLK (0x03 << 8)
37#define S3C64XX_GPD2_AC97_SYNC (0x04 << 8)
38#define S3C64XX_GPD2_EINT_G3_2 (0x07 << 8)
39
40#define S3C64XX_GPD3_PCM0_SIN (0x02 << 12)
41#define S3C64XX_GPD3_I2S0_DI (0x03 << 12)
42#define S3C64XX_GPD3_AC97_SDI (0x04 << 12)
43#define S3C64XX_GPD3_EINT_G3_3 (0x07 << 12)
44
45#define S3C64XX_GPD4_PCM0_SOUT (0x02 << 16)
46#define S3C64XX_GPD4_I2S0_D0 (0x03 << 16)
47#define S3C64XX_GPD4_AC97_SDO (0x04 << 16)
48#define S3C64XX_GPD4_EINT_G3_4 (0x07 << 16)
49
diff --git a/arch/arm/plat-s3c64xx/include/plat/gpio-bank-e.h b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-e.h
new file mode 100644
index 000000000000..7fcf3d8e0a48
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-e.h
@@ -0,0 +1,44 @@
1/* linux/arch/arm/plat-s3c64xx/include/plat/gpio-bank-e.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * GPIO Bank E register and configuration definitions
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#define S3C64XX_GPECON (S3C64XX_GPE_BASE + 0x00)
16#define S3C64XX_GPEDAT (S3C64XX_GPE_BASE + 0x04)
17#define S3C64XX_GPEPUD (S3C64XX_GPE_BASE + 0x08)
18#define S3C64XX_GPECONSLP (S3C64XX_GPE_BASE + 0x0c)
19#define S3C64XX_GPEPUDSLP (S3C64XX_GPE_BASE + 0x10)
20
21#define S3C64XX_GPE_CONMASK(__gpio) (0xf << ((__gpio) * 4))
22#define S3C64XX_GPE_INPUT(__gpio) (0x0 << ((__gpio) * 4))
23#define S3C64XX_GPE_OUTPUT(__gpio) (0x1 << ((__gpio) * 4))
24
25#define S3C64XX_GPE0_PCM1_SCLK (0x02 << 0)
26#define S3C64XX_GPE0_I2S1_CLK (0x03 << 0)
27#define S3C64XX_GPE0_AC97_BITCLK (0x04 << 0)
28
29#define S3C64XX_GPE1_PCM1_EXTCLK (0x02 << 4)
30#define S3C64XX_GPE1_I2S1_CDCLK (0x03 << 4)
31#define S3C64XX_GPE1_AC97_nRESET (0x04 << 4)
32
33#define S3C64XX_GPE2_PCM1_FSYNC (0x02 << 8)
34#define S3C64XX_GPE2_I2S1_LRCLK (0x03 << 8)
35#define S3C64XX_GPE2_AC97_SYNC (0x04 << 8)
36
37#define S3C64XX_GPE3_PCM1_SIN (0x02 << 12)
38#define S3C64XX_GPE3_I2S1_DI (0x03 << 12)
39#define S3C64XX_GPE3_AC97_SDI (0x04 << 12)
40
41#define S3C64XX_GPE4_PCM1_SOUT (0x02 << 16)
42#define S3C64XX_GPE4_I2S1_D0 (0x03 << 16)
43#define S3C64XX_GPE4_AC97_SDO (0x04 << 16)
44
diff --git a/arch/arm/plat-s3c64xx/include/plat/gpio-bank-f.h b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-f.h
new file mode 100644
index 000000000000..f3faff974a18
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-f.h
@@ -0,0 +1,71 @@
1/* linux/arch/arm/plat-s3c64xx/include/plat/gpio-bank-f.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * GPIO Bank F register and configuration definitions
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#define S3C64XX_GPFCON (S3C64XX_GPF_BASE + 0x00)
16#define S3C64XX_GPFDAT (S3C64XX_GPF_BASE + 0x04)
17#define S3C64XX_GPFPUD (S3C64XX_GPF_BASE + 0x08)
18#define S3C64XX_GPFCONSLP (S3C64XX_GPF_BASE + 0x0c)
19#define S3C64XX_GPFPUDSLP (S3C64XX_GPF_BASE + 0x10)
20
21#define S3C64XX_GPF_CONMASK(__gpio) (0x3 << ((__gpio) * 2))
22#define S3C64XX_GPF_INPUT(__gpio) (0x0 << ((__gpio) * 2))
23#define S3C64XX_GPF_OUTPUT(__gpio) (0x1 << ((__gpio) * 2))
24
25#define S3C64XX_GPF0_CAMIF_CLK (0x02 << 0)
26#define S3C64XX_GPF0_EINT_G4_0 (0x03 << 0)
27
28#define S3C64XX_GPF1_CAMIF_HREF (0x02 << 2)
29#define S3C64XX_GPF1_EINT_G4_1 (0x03 << 2)
30
31#define S3C64XX_GPF2_CAMIF_PCLK (0x02 << 4)
32#define S3C64XX_GPF2_EINT_G4_2 (0x03 << 4)
33
34#define S3C64XX_GPF3_CAMIF_nRST (0x02 << 6)
35#define S3C64XX_GPF3_EINT_G4_3 (0x03 << 6)
36
37#define S3C64XX_GPF4_CAMIF_VSYNC (0x02 << 8)
38#define S3C64XX_GPF4_EINT_G4_4 (0x03 << 8)
39
40#define S3C64XX_GPF5_CAMIF_YDATA0 (0x02 << 10)
41#define S3C64XX_GPF5_EINT_G4_5 (0x03 << 10)
42
43#define S3C64XX_GPF6_CAMIF_YDATA1 (0x02 << 12)
44#define S3C64XX_GPF6_EINT_G4_6 (0x03 << 12)
45
46#define S3C64XX_GPF7_CAMIF_YDATA2 (0x02 << 14)
47#define S3C64XX_GPF7_EINT_G4_7 (0x03 << 14)
48
49#define S3C64XX_GPF8_CAMIF_YDATA3 (0x02 << 16)
50#define S3C64XX_GPF8_EINT_G4_8 (0x03 << 16)
51
52#define S3C64XX_GPF9_CAMIF_YDATA4 (0x02 << 18)
53#define S3C64XX_GPF9_EINT_G4_9 (0x03 << 18)
54
55#define S3C64XX_GPF10_CAMIF_YDATA5 (0x02 << 20)
56#define S3C64XX_GPF10_EINT_G4_10 (0x03 << 20)
57
58#define S3C64XX_GPF11_CAMIF_YDATA6 (0x02 << 22)
59#define S3C64XX_GPF11_EINT_G4_11 (0x03 << 22)
60
61#define S3C64XX_GPF12_CAMIF_YDATA7 (0x02 << 24)
62#define S3C64XX_GPF12_EINT_G4_12 (0x03 << 24)
63
64#define S3C64XX_GPF13_PWM_ECLK (0x02 << 26)
65#define S3C64XX_GPF13_EINT_G4_13 (0x03 << 26)
66
67#define S3C64XX_GPF14_PWM_TOUT0 (0x02 << 28)
68#define S3C64XX_GPF14_CLKOUT0 (0x03 << 28)
69
70#define S3C64XX_GPF15_PWM_TOUT1 (0x02 << 30)
71
diff --git a/arch/arm/plat-s3c64xx/include/plat/gpio-bank-g.h b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-g.h
new file mode 100644
index 000000000000..35bbd2378e55
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-g.h
@@ -0,0 +1,42 @@
1/* linux/arch/arm/plat-s3c64xx/include/plat/gpio-bank-g.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * GPIO Bank G register and configuration definitions
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#define S3C64XX_GPGCON (S3C64XX_GPG_BASE + 0x00)
16#define S3C64XX_GPGDAT (S3C64XX_GPG_BASE + 0x04)
17#define S3C64XX_GPGPUD (S3C64XX_GPG_BASE + 0x08)
18#define S3C64XX_GPGCONSLP (S3C64XX_GPG_BASE + 0x0c)
19#define S3C64XX_GPGPUDSLP (S3C64XX_GPG_BASE + 0x10)
20
21#define S3C64XX_GPG_CONMASK(__gpio) (0xf << ((__gpio) * 4))
22#define S3C64XX_GPG_INPUT(__gpio) (0x0 << ((__gpio) * 4))
23#define S3C64XX_GPG_OUTPUT(__gpio) (0x1 << ((__gpio) * 4))
24
25#define S3C64XX_GPG0_MMC0_CLK (0x02 << 0)
26#define S3C64XX_GPG0_EINT_G5_0 (0x07 << 0)
27
28#define S3C64XX_GPG1_MMC0_CMD (0x02 << 4)
29#define S3C64XX_GPG1_EINT_G5_1 (0x07 << 4)
30
31#define S3C64XX_GPG2_MMC0_DATA0 (0x02 << 8)
32#define S3C64XX_GPG2_EINT_G5_2 (0x07 << 8)
33
34#define S3C64XX_GPG3_MMC0_DATA1 (0x02 << 12)
35#define S3C64XX_GPG3_EINT_G5_3 (0x07 << 12)
36
37#define S3C64XX_GPG4_MMC0_DATA2 (0x02 << 16)
38#define S3C64XX_GPG4_EINT_G5_4 (0x07 << 16)
39
40#define S3C64XX_GPG5_MMC0_DATA3 (0x02 << 20)
41#define S3C64XX_GPG5_EINT_G5_5 (0x07 << 20)
42
diff --git a/arch/arm/plat-s3c64xx/include/plat/gpio-bank-h.h b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-h.h
new file mode 100644
index 000000000000..81549516572f
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-h.h
@@ -0,0 +1,74 @@
1/* linux/arch/arm/plat-s3c64xx/include/plat/gpio-bank-h.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * GPIO Bank H register and configuration definitions
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#define S3C64XX_GPHCON0 (S3C64XX_GPH_BASE + 0x00)
16#define S3C64XX_GPHCON1 (S3C64XX_GPH_BASE + 0x04)
17#define S3C64XX_GPHDAT (S3C64XX_GPH_BASE + 0x08)
18#define S3C64XX_GPHPUD (S3C64XX_GPH_BASE + 0x0c)
19#define S3C64XX_GPHCONSLP (S3C64XX_GPH_BASE + 0x10)
20#define S3C64XX_GPHPUDSLP (S3C64XX_GPH_BASE + 0x14)
21
22#define S3C64XX_GPH_CONMASK(__gpio) (0xf << ((__gpio) * 4))
23#define S3C64XX_GPH_INPUT(__gpio) (0x0 << ((__gpio) * 4))
24#define S3C64XX_GPH_OUTPUT(__gpio) (0x1 << ((__gpio) * 4))
25
26#define S3C64XX_GPH0_MMC1_CLK (0x02 << 0)
27#define S3C64XX_GPH0_KP_COL0 (0x04 << 0)
28#define S3C64XX_GPH0_EINT_G6_0 (0x07 << 0)
29
30#define S3C64XX_GPH1_MMC1_CMD (0x02 << 4)
31#define S3C64XX_GPH1_KP_COL1 (0x04 << 4)
32#define S3C64XX_GPH1_EINT_G6_1 (0x07 << 4)
33
34#define S3C64XX_GPH2_MMC1_DATA0 (0x02 << 8)
35#define S3C64XX_GPH2_KP_COL2 (0x04 << 8)
36#define S3C64XX_GPH2_EINT_G6_2 (0x07 << 8)
37
38#define S3C64XX_GPH3_MMC1_DATA1 (0x02 << 12)
39#define S3C64XX_GPH3_KP_COL3 (0x04 << 12)
40#define S3C64XX_GPH3_EINT_G6_3 (0x07 << 12)
41
42#define S3C64XX_GPH4_MMC1_DATA2 (0x02 << 16)
43#define S3C64XX_GPH4_KP_COL4 (0x04 << 16)
44#define S3C64XX_GPH4_EINT_G6_4 (0x07 << 16)
45
46#define S3C64XX_GPH5_MMC1_DATA3 (0x02 << 20)
47#define S3C64XX_GPH5_KP_COL5 (0x04 << 20)
48#define S3C64XX_GPH5_EINT_G6_5 (0x07 << 20)
49
50#define S3C64XX_GPH6_MMC1_DATA4 (0x02 << 24)
51#define S3C64XX_GPH6_MMC2_DATA0 (0x03 << 24)
52#define S3C64XX_GPH6_KP_COL6 (0x04 << 24)
53#define S3C64XX_GPH6_I2S_V40_BCLK (0x05 << 24)
54#define S3C64XX_GPH6_ADDR_CF0 (0x06 << 24)
55#define S3C64XX_GPH6_EINT_G6_6 (0x07 << 24)
56
57#define S3C64XX_GPH7_MMC1_DATA5 (0x02 << 28)
58#define S3C64XX_GPH7_MMC2_DATA1 (0x03 << 28)
59#define S3C64XX_GPH7_KP_COL7 (0x04 << 28)
60#define S3C64XX_GPH7_I2S_V40_CDCLK (0x05 << 28)
61#define S3C64XX_GPH7_ADDR_CF1 (0x06 << 28)
62#define S3C64XX_GPH7_EINT_G6_7 (0x07 << 28)
63
64#define S3C64XX_GPH8_MMC1_DATA6 (0x02 << 32)
65#define S3C64XX_GPH8_MMC2_DATA2 (0x03 << 32)
66#define S3C64XX_GPH8_I2S_V40_LRCLK (0x05 << 32)
67#define S3C64XX_GPH8_ADDR_CF2 (0x06 << 32)
68#define S3C64XX_GPH8_EINT_G6_8 (0x07 << 32)
69
70#define S3C64XX_GPH9_MMC1_DATA7 (0x02 << 36)
71#define S3C64XX_GPH9_MMC2_DATA3 (0x03 << 36)
72#define S3C64XX_GPH9_I2S_V40_DI (0x05 << 36)
73#define S3C64XX_GPH9_EINT_G6_9 (0x07 << 36)
74
diff --git a/arch/arm/plat-s3c64xx/include/plat/gpio-bank-i.h b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-i.h
new file mode 100644
index 000000000000..ce9ebe335566
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-i.h
@@ -0,0 +1,40 @@
1/* linux/arch/arm/plat-s3c64xx/include/plat/gpio-bank-i.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * GPIO Bank I register and configuration definitions
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#define S3C64XX_GPICON (S3C64XX_GPI_BASE + 0x00)
16#define S3C64XX_GPIDAT (S3C64XX_GPI_BASE + 0x04)
17#define S3C64XX_GPIPUD (S3C64XX_GPI_BASE + 0x08)
18#define S3C64XX_GPICONSLP (S3C64XX_GPI_BASE + 0x0c)
19#define S3C64XX_GPIPUDSLP (S3C64XX_GPI_BASE + 0x10)
20
21#define S3C64XX_GPI_CONMASK(__gpio) (0x3 << ((__gpio) * 2))
22#define S3C64XX_GPI_INPUT(__gpio) (0x0 << ((__gpio) * 2))
23#define S3C64XX_GPI_OUTPUT(__gpio) (0x1 << ((__gpio) * 2))
24
25#define S3C64XX_GPI0_VD0 (0x02 << 0)
26#define S3C64XX_GPI1_VD1 (0x02 << 2)
27#define S3C64XX_GPI2_VD2 (0x02 << 4)
28#define S3C64XX_GPI3_VD3 (0x02 << 6)
29#define S3C64XX_GPI4_VD4 (0x02 << 8)
30#define S3C64XX_GPI5_VD5 (0x02 << 10)
31#define S3C64XX_GPI6_VD6 (0x02 << 12)
32#define S3C64XX_GPI7_VD7 (0x02 << 14)
33#define S3C64XX_GPI8_VD8 (0x02 << 16)
34#define S3C64XX_GPI9_VD9 (0x02 << 18)
35#define S3C64XX_GPI10_VD10 (0x02 << 20)
36#define S3C64XX_GPI11_VD11 (0x02 << 22)
37#define S3C64XX_GPI12_VD12 (0x02 << 24)
38#define S3C64XX_GPI13_VD13 (0x02 << 26)
39#define S3C64XX_GPI14_VD14 (0x02 << 28)
40#define S3C64XX_GPI15_VD15 (0x02 << 30)
diff --git a/arch/arm/plat-s3c64xx/include/plat/gpio-bank-j.h b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-j.h
new file mode 100644
index 000000000000..21a906299d30
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-j.h
@@ -0,0 +1,36 @@
1/* linux/arch/arm/plat-s3c64xx/include/plat/gpio-bank-j.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * GPIO Bank J register and configuration definitions
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#define S3C64XX_GPJCON (S3C64XX_GPJ_BASE + 0x00)
16#define S3C64XX_GPJDAT (S3C64XX_GPJ_BASE + 0x04)
17#define S3C64XX_GPJPUD (S3C64XX_GPJ_BASE + 0x08)
18#define S3C64XX_GPJCONSLP (S3C64XX_GPJ_BASE + 0x0c)
19#define S3C64XX_GPJPUDSLP (S3C64XX_GPJ_BASE + 0x10)
20
21#define S3C64XX_GPJ_CONMASK(__gpio) (0x3 << ((__gpio) * 2))
22#define S3C64XX_GPJ_INPUT(__gpio) (0x0 << ((__gpio) * 2))
23#define S3C64XX_GPJ_OUTPUT(__gpio) (0x1 << ((__gpio) * 2))
24
25#define S3C64XX_GPJ0_VD16 (0x02 << 0)
26#define S3C64XX_GPJ1_VD17 (0x02 << 2)
27#define S3C64XX_GPJ2_VD18 (0x02 << 4)
28#define S3C64XX_GPJ3_VD19 (0x02 << 6)
29#define S3C64XX_GPJ4_VD20 (0x02 << 8)
30#define S3C64XX_GPJ5_VD21 (0x02 << 10)
31#define S3C64XX_GPJ6_VD22 (0x02 << 12)
32#define S3C64XX_GPJ7_VD23 (0x02 << 14)
33#define S3C64XX_GPJ8_LCD_HSYNC (0x02 << 16)
34#define S3C64XX_GPJ9_LCD_VSYNC (0x02 << 18)
35#define S3C64XX_GPJ10_LCD_VDEN (0x02 << 20)
36#define S3C64XX_GPJ11_LCD_VCLK (0x02 << 22)
diff --git a/arch/arm/plat-s3c64xx/include/plat/gpio-bank-n.h b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-n.h
new file mode 100644
index 000000000000..569e76120881
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-n.h
@@ -0,0 +1,54 @@
1/* linux/arch/arm/plat-s3c64xx/include/plat/gpio-bank-n.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * GPIO Bank N register and configuration definitions
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#define S3C64XX_GPNCON (S3C64XX_GPN_BASE + 0x00)
16#define S3C64XX_GPNDAT (S3C64XX_GPN_BASE + 0x04)
17#define S3C64XX_GPNPUD (S3C64XX_GPN_BASE + 0x08)
18
19#define S3C64XX_GPN_CONMASK(__gpio) (0x3 << ((__gpio) * 2))
20#define S3C64XX_GPN_INPUT(__gpio) (0x0 << ((__gpio) * 2))
21#define S3C64XX_GPN_OUTPUT(__gpio) (0x1 << ((__gpio) * 2))
22
23#define S3C64XX_GPN0_EINT0 (0x02 << 0)
24#define S3C64XX_GPN0_KP_ROW0 (0x03 << 0)
25
26#define S3C64XX_GPN1_EINT1 (0x02 << 2)
27#define S3C64XX_GPN1_KP_ROW1 (0x03 << 2)
28
29#define S3C64XX_GPN2_EINT2 (0x02 << 4)
30#define S3C64XX_GPN2_KP_ROW2 (0x03 << 4)
31
32#define S3C64XX_GPN3_EINT3 (0x02 << 6)
33#define S3C64XX_GPN3_KP_ROW3 (0x03 << 6)
34
35#define S3C64XX_GPN4_EINT4 (0x02 << 8)
36#define S3C64XX_GPN4_KP_ROW4 (0x03 << 8)
37
38#define S3C64XX_GPN5_EINT5 (0x02 << 10)
39#define S3C64XX_GPN5_KP_ROW5 (0x03 << 10)
40
41#define S3C64XX_GPN6_EINT6 (0x02 << 12)
42#define S3C64XX_GPN6_KP_ROW6 (0x03 << 12)
43
44#define S3C64XX_GPN7_EINT7 (0x02 << 14)
45#define S3C64XX_GPN7_KP_ROW7 (0x03 << 14)
46
47#define S3C64XX_GPN8_EINT8 (0x02 << 16)
48#define S3C64XX_GPN9_EINT9 (0x02 << 18)
49#define S3C64XX_GPN10_EINT10 (0x02 << 20)
50#define S3C64XX_GPN11_EINT11 (0x02 << 22)
51#define S3C64XX_GPN12_EINT12 (0x02 << 24)
52#define S3C64XX_GPN13_EINT13 (0x02 << 26)
53#define S3C64XX_GPN14_EINT14 (0x02 << 28)
54#define S3C64XX_GPN15_EINT15 (0x02 << 30)
diff --git a/arch/arm/plat-s3c64xx/include/plat/gpio-bank-o.h b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-o.h
new file mode 100644
index 000000000000..b09e12954b57
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-o.h
@@ -0,0 +1,70 @@
1/* linux/arch/arm/plat-s3c64xx/include/plat/gpio-bank-o.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * GPIO Bank O register and configuration definitions
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#define S3C64XX_GPOCON (S3C64XX_GPO_BASE + 0x00)
16#define S3C64XX_GPODAT (S3C64XX_GPO_BASE + 0x04)
17#define S3C64XX_GPOPUD (S3C64XX_GPO_BASE + 0x08)
18#define S3C64XX_GPOCONSLP (S3C64XX_GPO_BASE + 0x0c)
19#define S3C64XX_GPOPUDSLP (S3C64XX_GPO_BASE + 0x10)
20
21#define S3C64XX_GPO_CONMASK(__gpio) (0x3 << ((__gpio) * 2))
22#define S3C64XX_GPO_INPUT(__gpio) (0x0 << ((__gpio) * 2))
23#define S3C64XX_GPO_OUTPUT(__gpio) (0x1 << ((__gpio) * 2))
24
25#define S3C64XX_GPO0_MEM0_nCS2 (0x02 << 0)
26#define S3C64XX_GPO0_EINT_G7_0 (0x03 << 0)
27
28#define S3C64XX_GPO1_MEM0_nCS3 (0x02 << 2)
29#define S3C64XX_GPO1_EINT_G7_1 (0x03 << 2)
30
31#define S3C64XX_GPO2_MEM0_nCS4 (0x02 << 4)
32#define S3C64XX_GPO2_EINT_G7_2 (0x03 << 4)
33
34#define S3C64XX_GPO3_MEM0_nCS5 (0x02 << 6)
35#define S3C64XX_GPO3_EINT_G7_3 (0x03 << 6)
36
37#define S3C64XX_GPO4_EINT_G7_4 (0x03 << 8)
38
39#define S3C64XX_GPO5_EINT_G7_5 (0x03 << 10)
40
41#define S3C64XX_GPO6_MEM0_ADDR6 (0x02 << 12)
42#define S3C64XX_GPO6_EINT_G7_6 (0x03 << 12)
43
44#define S3C64XX_GPO7_MEM0_ADDR7 (0x02 << 14)
45#define S3C64XX_GPO7_EINT_G7_7 (0x03 << 14)
46
47#define S3C64XX_GPO8_MEM0_ADDR8 (0x02 << 16)
48#define S3C64XX_GPO8_EINT_G7_8 (0x03 << 16)
49
50#define S3C64XX_GPO9_MEM0_ADDR9 (0x02 << 18)
51#define S3C64XX_GPO9_EINT_G7_9 (0x03 << 18)
52
53#define S3C64XX_GPO10_MEM0_ADDR10 (0x02 << 20)
54#define S3C64XX_GPO10_EINT_G7_10 (0x03 << 20)
55
56#define S3C64XX_GPO11_MEM0_ADDR11 (0x02 << 22)
57#define S3C64XX_GPO11_EINT_G7_11 (0x03 << 22)
58
59#define S3C64XX_GPO12_MEM0_ADDR12 (0x02 << 24)
60#define S3C64XX_GPO12_EINT_G7_12 (0x03 << 24)
61
62#define S3C64XX_GPO13_MEM0_ADDR13 (0x02 << 26)
63#define S3C64XX_GPO13_EINT_G7_13 (0x03 << 26)
64
65#define S3C64XX_GPO14_MEM0_ADDR14 (0x02 << 28)
66#define S3C64XX_GPO14_EINT_G7_14 (0x03 << 28)
67
68#define S3C64XX_GPO15_MEM0_ADDR15 (0x02 << 30)
69#define S3C64XX_GPO15_EINT_G7_15 (0x03 << 30)
70
diff --git a/arch/arm/plat-s3c64xx/include/plat/gpio-bank-p.h b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-p.h
new file mode 100644
index 000000000000..92f00517926b
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-p.h
@@ -0,0 +1,69 @@
1/* linux/arch/arm/plat-s3c64xx/include/plat/gpio-bank-p.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * GPIO Bank P register and configuration definitions
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#define S3C64XX_GPPCON (S3C64XX_GPP_BASE + 0x00)
16#define S3C64XX_GPPDAT (S3C64XX_GPP_BASE + 0x04)
17#define S3C64XX_GPPPUD (S3C64XX_GPP_BASE + 0x08)
18#define S3C64XX_GPPCONSLP (S3C64XX_GPP_BASE + 0x0c)
19#define S3C64XX_GPPPUDSLP (S3C64XX_GPP_BASE + 0x10)
20
21#define S3C64XX_GPP_CONMASK(__gpio) (0x3 << ((__gpio) * 2))
22#define S3C64XX_GPP_INPUT(__gpio) (0x0 << ((__gpio) * 2))
23#define S3C64XX_GPP_OUTPUT(__gpio) (0x1 << ((__gpio) * 2))
24
25#define S3C64XX_GPP0_MEM0_ADDRV (0x02 << 0)
26#define S3C64XX_GPP0_EINT_G8_0 (0x03 << 0)
27
28#define S3C64XX_GPP1_MEM0_SMCLK (0x02 << 2)
29#define S3C64XX_GPP1_EINT_G8_1 (0x03 << 2)
30
31#define S3C64XX_GPP2_MEM0_nWAIT (0x02 << 4)
32#define S3C64XX_GPP2_EINT_G8_2 (0x03 << 4)
33
34#define S3C64XX_GPP3_MEM0_RDY0_ALE (0x02 << 6)
35#define S3C64XX_GPP3_EINT_G8_3 (0x03 << 6)
36
37#define S3C64XX_GPP4_MEM0_RDY1_CLE (0x02 << 8)
38#define S3C64XX_GPP4_EINT_G8_4 (0x03 << 8)
39
40#define S3C64XX_GPP5_MEM0_INTsm0_FWE (0x02 << 10)
41#define S3C64XX_GPP5_EINT_G8_5 (0x03 << 10)
42
43#define S3C64XX_GPP6_MEM0_(null) (0x02 << 12)
44#define S3C64XX_GPP6_EINT_G8_6 (0x03 << 12)
45
46#define S3C64XX_GPP7_MEM0_INTsm1_FRE (0x02 << 14)
47#define S3C64XX_GPP7_EINT_G8_7 (0x03 << 14)
48
49#define S3C64XX_GPP8_MEM0_RPn_RnB (0x02 << 16)
50#define S3C64XX_GPP8_EINT_G8_8 (0x03 << 16)
51
52#define S3C64XX_GPP9_MEM0_ATA_RESET (0x02 << 18)
53#define S3C64XX_GPP9_EINT_G8_9 (0x03 << 18)
54
55#define S3C64XX_GPP10_MEM0_ATA_INPACK (0x02 << 20)
56#define S3C64XX_GPP10_EINT_G8_10 (0x03 << 20)
57
58#define S3C64XX_GPP11_MEM0_ATA_REG (0x02 << 22)
59#define S3C64XX_GPP11_EINT_G8_11 (0x03 << 22)
60
61#define S3C64XX_GPP12_MEM0_ATA_WE (0x02 << 24)
62#define S3C64XX_GPP12_EINT_G8_12 (0x03 << 24)
63
64#define S3C64XX_GPP13_MEM0_ATA_OE (0x02 << 26)
65#define S3C64XX_GPP13_EINT_G8_13 (0x03 << 26)
66
67#define S3C64XX_GPP14_MEM0_ATA_CD (0x02 << 28)
68#define S3C64XX_GPP14_EINT_G8_14 (0x03 << 28)
69
diff --git a/arch/arm/plat-s3c64xx/include/plat/gpio-bank-q.h b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-q.h
new file mode 100644
index 000000000000..565e60aaee47
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-q.h
@@ -0,0 +1,46 @@
1/* linux/arch/arm/plat-s3c64xx/include/plat/gpio-bank-q.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * GPIO Bank Q register and configuration definitions
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#define S3C64XX_GPQCON (S3C64XX_GPQ_BASE + 0x00)
16#define S3C64XX_GPQDAT (S3C64XX_GPQ_BASE + 0x04)
17#define S3C64XX_GPQPUD (S3C64XX_GPQ_BASE + 0x08)
18#define S3C64XX_GPQCONSLP (S3C64XX_GPQ_BASE + 0x0c)
19#define S3C64XX_GPQPUDSLP (S3C64XX_GPQ_BASE + 0x10)
20
21#define S3C64XX_GPQ_CONMASK(__gpio) (0x3 << ((__gpio) * 2))
22#define S3C64XX_GPQ_INPUT(__gpio) (0x0 << ((__gpio) * 2))
23#define S3C64XX_GPQ_OUTPUT(__gpio) (0x1 << ((__gpio) * 2))
24
25#define S3C64XX_GPQ0_MEM0_ADDR18_RAS (0x02 << 0)
26#define S3C64XX_GPQ0_EINT_G9_0 (0x03 << 0)
27
28#define S3C64XX_GPQ1_MEM0_ADDR19_CAS (0x02 << 2)
29#define S3C64XX_GPQ1_EINT_G9_1 (0x03 << 2)
30
31#define S3C64XX_GPQ2_EINT_G9_2 (0x03 << 4)
32
33#define S3C64XX_GPQ3_EINT_G9_3 (0x03 << 6)
34
35#define S3C64XX_GPQ4_EINT_G9_4 (0x03 << 8)
36
37#define S3C64XX_GPQ5_EINT_G9_5 (0x03 << 10)
38
39#define S3C64XX_GPQ6_EINT_G9_6 (0x03 << 12)
40
41#define S3C64XX_GPQ7_MEM0_ADDR17_WENDMC (0x02 << 14)
42#define S3C64XX_GPQ7_EINT_G9_7 (0x03 << 14)
43
44#define S3C64XX_GPQ8_MEM0_ADDR16_APDMC (0x02 << 16)
45#define S3C64XX_GPQ8_EINT_G9_8 (0x03 << 16)
46
diff --git a/arch/arm/plat-s3c64xx/include/plat/irqs.h b/arch/arm/plat-s3c64xx/include/plat/irqs.h
new file mode 100644
index 000000000000..02e8dd4c97d5
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/irqs.h
@@ -0,0 +1,201 @@
1/* linux/arch/arm/plat-s3c64xx/include/mach/irqs.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX - Common IRQ support
9 */
10
11#ifndef __ASM_PLAT_S3C64XX_IRQS_H
12#define __ASM_PLAT_S3C64XX_IRQS_H __FILE__
13
14/* we keep the first set of CPU IRQs out of the range of
15 * the ISA space, so that the PC104 has them to itself
16 * and we don't end up having to do horrible things to the
17 * standard ISA drivers....
18 *
19 * note, since we're using the VICs, our start must be a
20 * mulitple of 32 to allow the common code to work
21 */
22
23#define S3C_IRQ_OFFSET (32)
24
25#define S3C_IRQ(x) ((x) + S3C_IRQ_OFFSET)
26
27#define S3C_VIC0_BASE S3C_IRQ(0)
28#define S3C_VIC1_BASE S3C_IRQ(32)
29
30/* UART interrupts, each UART has 4 intterupts per channel so
31 * use the space between the ISA and S3C main interrupts. Note, these
32 * are not in the same order as the S3C24XX series! */
33
34#define IRQ_S3CUART_BASE0 (16)
35#define IRQ_S3CUART_BASE1 (20)
36#define IRQ_S3CUART_BASE2 (24)
37#define IRQ_S3CUART_BASE3 (28)
38
39#define UART_IRQ_RXD (0)
40#define UART_IRQ_ERR (1)
41#define UART_IRQ_TXD (2)
42#define UART_IRQ_MODEM (3)
43
44#define IRQ_S3CUART_RX0 (IRQ_S3CUART_BASE0 + UART_IRQ_RXD)
45#define IRQ_S3CUART_TX0 (IRQ_S3CUART_BASE0 + UART_IRQ_TXD)
46#define IRQ_S3CUART_ERR0 (IRQ_S3CUART_BASE0 + UART_IRQ_ERR)
47
48#define IRQ_S3CUART_RX1 (IRQ_S3CUART_BASE1 + UART_IRQ_RXD)
49#define IRQ_S3CUART_TX1 (IRQ_S3CUART_BASE1 + UART_IRQ_TXD)
50#define IRQ_S3CUART_ERR1 (IRQ_S3CUART_BASE1 + UART_IRQ_ERR)
51
52#define IRQ_S3CUART_RX2 (IRQ_S3CUART_BASE2 + UART_IRQ_RXD)
53#define IRQ_S3CUART_TX2 (IRQ_S3CUART_BASE2 + UART_IRQ_TXD)
54#define IRQ_S3CUART_ERR2 (IRQ_S3CUART_BASE2 + UART_IRQ_ERR)
55
56#define IRQ_S3CUART_RX3 (IRQ_S3CUART_BASE3 + UART_IRQ_RXD)
57#define IRQ_S3CUART_TX3 (IRQ_S3CUART_BASE3 + UART_IRQ_TXD)
58#define IRQ_S3CUART_ERR3 (IRQ_S3CUART_BASE3 + UART_IRQ_ERR)
59
60/* VIC based IRQs */
61
62#define S3C64XX_IRQ_VIC0(x) (S3C_VIC0_BASE + (x))
63#define S3C64XX_IRQ_VIC1(x) (S3C_VIC1_BASE + (x))
64
65/* VIC0 */
66
67#define IRQ_EINT0_3 S3C64XX_IRQ_VIC0(0)
68#define IRQ_EINT4_11 S3C64XX_IRQ_VIC0(1)
69#define IRQ_RTC_TIC S3C64XX_IRQ_VIC0(2)
70#define IRQ_CAMIF_C S3C64XX_IRQ_VIC0(3)
71#define IRQ_CAMIF_P S3C64XX_IRQ_VIC0(4)
72#define IRQ_CAMIF_MC S3C64XX_IRQ_VIC0(5)
73#define IRQ_S3C6410_IIC1 S3C64XX_IRQ_VIC0(5)
74#define IRQ_S3C6410_IIS S3C64XX_IRQ_VIC0(6)
75#define IRQ_S3C6400_CAMIF_MP S3C64XX_IRQ_VIC0(6)
76#define IRQ_CAMIF_WE_C S3C64XX_IRQ_VIC0(7)
77#define IRQ_S3C6410_G3D S3C64XX_IRQ_VIC0(8)
78#define IRQ_S3C6400_CAMIF_WE_P S3C64XX_IRQ_VIC0(8)
79#define IRQ_POST0 S3C64XX_IRQ_VIC0(9)
80#define IRQ_ROTATOR S3C64XX_IRQ_VIC0(10)
81#define IRQ_2D S3C64XX_IRQ_VIC0(11)
82#define IRQ_TVENC S3C64XX_IRQ_VIC0(12)
83#define IRQ_SCALER S3C64XX_IRQ_VIC0(13)
84#define IRQ_BATF S3C64XX_IRQ_VIC0(14)
85#define IRQ_JPEG S3C64XX_IRQ_VIC0(15)
86#define IRQ_MFC S3C64XX_IRQ_VIC0(16)
87#define IRQ_SDMA0 S3C64XX_IRQ_VIC0(17)
88#define IRQ_SDMA1 S3C64XX_IRQ_VIC0(18)
89#define IRQ_ARM_DMAERR S3C64XX_IRQ_VIC0(19)
90#define IRQ_ARM_DMA S3C64XX_IRQ_VIC0(20)
91#define IRQ_ARM_DMAS S3C64XX_IRQ_VIC0(21)
92#define IRQ_KEYPAD S3C64XX_IRQ_VIC0(22)
93#define IRQ_TIMER0_VIC S3C64XX_IRQ_VIC0(23)
94#define IRQ_TIMER1_VIC S3C64XX_IRQ_VIC0(24)
95#define IRQ_TIMER2_VIC S3C64XX_IRQ_VIC0(25)
96#define IRQ_WDT S3C64XX_IRQ_VIC0(26)
97#define IRQ_TIMER3_VIC S3C64XX_IRQ_VIC0(27)
98#define IRQ_TIMER4_VIC S3C64XX_IRQ_VIC0(28)
99#define IRQ_LCD_FIFO S3C64XX_IRQ_VIC0(29)
100#define IRQ_LCD_VSYNC S3C64XX_IRQ_VIC0(30)
101#define IRQ_LCD_SYSTEM S3C64XX_IRQ_VIC0(31)
102
103/* VIC1 */
104
105#define IRQ_EINT12_19 S3C64XX_IRQ_VIC1(0)
106#define IRQ_EINT20_27 S3C64XX_IRQ_VIC1(1)
107#define IRQ_PCM0 S3C64XX_IRQ_VIC1(2)
108#define IRQ_PCM1 S3C64XX_IRQ_VIC1(3)
109#define IRQ_AC97 S3C64XX_IRQ_VIC1(4)
110#define IRQ_UART0 S3C64XX_IRQ_VIC1(5)
111#define IRQ_UART1 S3C64XX_IRQ_VIC1(6)
112#define IRQ_UART2 S3C64XX_IRQ_VIC1(7)
113#define IRQ_UART3 S3C64XX_IRQ_VIC1(8)
114#define IRQ_DMA0 S3C64XX_IRQ_VIC1(9)
115#define IRQ_DMA1 S3C64XX_IRQ_VIC1(10)
116#define IRQ_ONENAND0 S3C64XX_IRQ_VIC1(11)
117#define IRQ_ONENAND1 S3C64XX_IRQ_VIC1(12)
118#define IRQ_NFC S3C64XX_IRQ_VIC1(13)
119#define IRQ_CFCON S3C64XX_IRQ_VIC1(14)
120#define IRQ_UHOST S3C64XX_IRQ_VIC1(15)
121#define IRQ_SPI0 S3C64XX_IRQ_VIC1(16)
122#define IRQ_SPI1 S3C64XX_IRQ_VIC1(17)
123#define IRQ_IIC S3C64XX_IRQ_VIC1(18)
124#define IRQ_HSItx S3C64XX_IRQ_VIC1(19)
125#define IRQ_HSIrx S3C64XX_IRQ_VIC1(20)
126#define IRQ_RESERVED S3C64XX_IRQ_VIC1(21)
127#define IRQ_MSM S3C64XX_IRQ_VIC1(22)
128#define IRQ_HOSTIF S3C64XX_IRQ_VIC1(23)
129#define IRQ_HSMMC0 S3C64XX_IRQ_VIC1(24)
130#define IRQ_HSMMC1 S3C64XX_IRQ_VIC1(25)
131#define IRQ_HSMMC2 IRQ_SPI1 /* shared with SPI1 */
132#define IRQ_OTG S3C64XX_IRQ_VIC1(26)
133#define IRQ_IRDA S3C64XX_IRQ_VIC1(27)
134#define IRQ_RTC_ALARM S3C64XX_IRQ_VIC1(28)
135#define IRQ_SEC S3C64XX_IRQ_VIC1(29)
136#define IRQ_PENDN S3C64XX_IRQ_VIC1(30)
137#define IRQ_TC IRQ_PENDN
138#define IRQ_ADC S3C64XX_IRQ_VIC1(31)
139
140#define S3C64XX_TIMER_IRQ(x) S3C_IRQ(64 + (x))
141
142#define IRQ_TIMER0 S3C64XX_TIMER_IRQ(0)
143#define IRQ_TIMER1 S3C64XX_TIMER_IRQ(1)
144#define IRQ_TIMER2 S3C64XX_TIMER_IRQ(2)
145#define IRQ_TIMER3 S3C64XX_TIMER_IRQ(3)
146#define IRQ_TIMER4 S3C64XX_TIMER_IRQ(4)
147
148/* compatibility for device defines */
149
150#define IRQ_IIC1 IRQ_S3C6410_IIC1
151
152/* Since the IRQ_EINT(x) are a linear mapping on current s3c64xx series
153 * we just defined them as an IRQ_EINT(x) macro from S3C_IRQ_EINT_BASE
154 * which we place after the pair of VICs. */
155
156#define S3C_IRQ_EINT_BASE S3C_IRQ(64+5)
157
158#define S3C_EINT(x) ((x) + S3C_IRQ_EINT_BASE)
159#define IRQ_EINT(x) S3C_EINT(x)
160
161/* Next the external interrupt groups. These are similar to the IRQ_EINT(x)
162 * that they are sourced from the GPIO pins but with a different scheme for
163 * priority and source indication.
164 *
165 * The IRQ_EINT(x) can be thought of as 'group 0' of the available GPIO
166 * interrupts, but for historical reasons they are kept apart from these
167 * next interrupts.
168 *
169 * Use IRQ_EINT_GROUP(group, offset) to get the number for use in the
170 * machine specific support files.
171 */
172
173#define IRQ_EINT_GROUP1_NR (15)
174#define IRQ_EINT_GROUP2_NR (8)
175#define IRQ_EINT_GROUP3_NR (5)
176#define IRQ_EINT_GROUP4_NR (14)
177#define IRQ_EINT_GROUP5_NR (7)
178#define IRQ_EINT_GROUP6_NR (10)
179#define IRQ_EINT_GROUP7_NR (16)
180#define IRQ_EINT_GROUP8_NR (15)
181#define IRQ_EINT_GROUP9_NR (9)
182
183#define IRQ_EINT_GROUP_BASE S3C_EINT(28)
184#define IRQ_EINT_GROUP1_BASE (IRQ_EINT_GROUP_BASE + 0x00)
185#define IRQ_EINT_GROUP2_BASE (IRQ_EINT_GROUP1_BASE + IRQ_EINT_GROUP1_NR)
186#define IRQ_EINT_GROUP3_BASE (IRQ_EINT_GROUP2_BASE + IRQ_EINT_GROUP2_NR)
187#define IRQ_EINT_GROUP4_BASE (IRQ_EINT_GROUP3_BASE + IRQ_EINT_GROUP3_NR)
188#define IRQ_EINT_GROUP5_BASE (IRQ_EINT_GROUP4_BASE + IRQ_EINT_GROUP4_NR)
189#define IRQ_EINT_GROUP6_BASE (IRQ_EINT_GROUP5_BASE + IRQ_EINT_GROUP5_NR)
190#define IRQ_EINT_GROUP7_BASE (IRQ_EINT_GROUP6_BASE + IRQ_EINT_GROUP6_NR)
191#define IRQ_EINT_GROUP8_BASE (IRQ_EINT_GROUP7_BASE + IRQ_EINT_GROUP7_NR)
192#define IRQ_EINT_GROUP9_BASE (IRQ_EINT_GROUP8_BASE + IRQ_EINT_GROUP8_NR)
193
194#define IRQ_EINT_GROUP(group, no) (IRQ_EINT_GROUP##group##__BASE + (x))
195
196/* Set the default NR_IRQS */
197
198#define NR_IRQS (IRQ_EINT_GROUP9_BASE + IRQ_EINT_GROUP9_NR + 1)
199
200#endif /* __ASM_PLAT_S3C64XX_IRQS_H */
201
diff --git a/arch/arm/plat-s3c64xx/include/plat/pll.h b/arch/arm/plat-s3c64xx/include/plat/pll.h
new file mode 100644
index 000000000000..90bbd72fdc4e
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/pll.h
@@ -0,0 +1,74 @@
1/* arch/arm/plat-s3c64xx/include/plat/pll.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX PLL code
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#define S3C6400_PLL_MDIV_MASK ((1 << (25-16+1)) - 1)
16#define S3C6400_PLL_PDIV_MASK ((1 << (13-8+1)) - 1)
17#define S3C6400_PLL_SDIV_MASK ((1 << (2-0+1)) - 1)
18#define S3C6400_PLL_MDIV_SHIFT (16)
19#define S3C6400_PLL_PDIV_SHIFT (8)
20#define S3C6400_PLL_SDIV_SHIFT (0)
21
22#include <asm/div64.h>
23
24static inline unsigned long s3c6400_get_pll(unsigned long baseclk,
25 u32 pllcon)
26{
27 u32 mdiv, pdiv, sdiv;
28 u64 fvco = baseclk;
29
30 mdiv = (pllcon >> S3C6400_PLL_MDIV_SHIFT) & S3C6400_PLL_MDIV_MASK;
31 pdiv = (pllcon >> S3C6400_PLL_PDIV_SHIFT) & S3C6400_PLL_PDIV_MASK;
32 sdiv = (pllcon >> S3C6400_PLL_SDIV_SHIFT) & S3C6400_PLL_SDIV_MASK;
33
34 fvco *= mdiv;
35 do_div(fvco, (pdiv << sdiv));
36
37 return (unsigned long)fvco;
38}
39
40#define S3C6400_EPLL_MDIV_MASK ((1 << (23-16)) - 1)
41#define S3C6400_EPLL_PDIV_MASK ((1 << (13-8)) - 1)
42#define S3C6400_EPLL_SDIV_MASK ((1 << (2-0)) - 1)
43#define S3C6400_EPLL_MDIV_SHIFT (16)
44#define S3C6400_EPLL_PDIV_SHIFT (8)
45#define S3C6400_EPLL_SDIV_SHIFT (0)
46#define S3C6400_EPLL_KDIV_MASK (0xffff)
47
48static inline unsigned long s3c6400_get_epll(unsigned long baseclk)
49{
50 unsigned long result;
51 u32 epll0 = __raw_readl(S3C_EPLL_CON0);
52 u32 epll1 = __raw_readl(S3C_EPLL_CON1);
53 u32 mdiv, pdiv, sdiv, kdiv;
54 u64 tmp;
55
56 mdiv = (epll0 >> S3C6400_EPLL_MDIV_SHIFT) & S3C6400_EPLL_MDIV_MASK;
57 pdiv = (epll0 >> S3C6400_EPLL_PDIV_SHIFT) & S3C6400_EPLL_PDIV_MASK;
58 sdiv = (epll0 >> S3C6400_EPLL_SDIV_SHIFT) & S3C6400_EPLL_SDIV_MASK;
59 kdiv = epll1 & S3C6400_EPLL_KDIV_MASK;
60
61 /* We need to multiple baseclk by mdiv (the integer part) and kdiv
62 * which is in 2^16ths, so shift mdiv up (does not overflow) and
63 * add kdiv before multiplying. The use of tmp is to avoid any
64 * overflows before shifting bac down into result when multipling
65 * by the mdiv and kdiv pair.
66 */
67
68 tmp = baseclk;
69 tmp *= (mdiv << 16) + kdiv;
70 do_div(tmp, (pdiv << sdiv));
71 result = tmp >> 16;
72
73 return result;
74}
diff --git a/arch/arm/plat-s3c64xx/include/plat/regs-clock.h b/arch/arm/plat-s3c64xx/include/plat/regs-clock.h
new file mode 100644
index 000000000000..b1082c163247
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/regs-clock.h
@@ -0,0 +1,224 @@
1/* arch/arm/plat-s3c64xx/include/plat/regs-clock.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX clock register definitions
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#ifndef __PLAT_REGS_CLOCK_H
16#define __PLAT_REGS_CLOCK_H __FILE__
17
18#define S3C_CLKREG(x) (S3C_VA_SYS + (x))
19
20#define S3C_APLL_LOCK S3C_CLKREG(0x00)
21#define S3C_MPLL_LOCK S3C_CLKREG(0x04)
22#define S3C_EPLL_LOCK S3C_CLKREG(0x08)
23#define S3C_APLL_CON S3C_CLKREG(0x0C)
24#define S3C_MPLL_CON S3C_CLKREG(0x10)
25#define S3C_EPLL_CON0 S3C_CLKREG(0x14)
26#define S3C_EPLL_CON1 S3C_CLKREG(0x18)
27#define S3C_CLK_SRC S3C_CLKREG(0x1C)
28#define S3C_CLK_DIV0 S3C_CLKREG(0x20)
29#define S3C_CLK_DIV1 S3C_CLKREG(0x24)
30#define S3C_CLK_DIV2 S3C_CLKREG(0x28)
31#define S3C_CLK_OUT S3C_CLKREG(0x2C)
32#define S3C_HCLK_GATE S3C_CLKREG(0x30)
33#define S3C_PCLK_GATE S3C_CLKREG(0x34)
34#define S3C_SCLK_GATE S3C_CLKREG(0x38)
35
36/* CLKDIV0 */
37#define S3C6400_CLKDIV0_MFC_MASK (0xf << 28)
38#define S3C6400_CLKDIV0_MFC_SHIFT (28)
39#define S3C6400_CLKDIV0_JPEG_MASK (0xf << 24)
40#define S3C6400_CLKDIV0_JPEG_SHIFT (24)
41#define S3C6400_CLKDIV0_CAM_MASK (0xf << 20)
42#define S3C6400_CLKDIV0_CAM_SHIFT (20)
43#define S3C6400_CLKDIV0_SECURITY_MASK (0x3 << 18)
44#define S3C6400_CLKDIV0_SECURITY_SHIFT (18)
45#define S3C6400_CLKDIV0_PCLK_MASK (0xf << 12)
46#define S3C6400_CLKDIV0_PCLK_SHIFT (12)
47#define S3C6400_CLKDIV0_HCLK2_MASK (0x7 << 9)
48#define S3C6400_CLKDIV0_HCLK2_SHIFT (9)
49#define S3C6400_CLKDIV0_HCLK_MASK (0x1 << 8)
50#define S3C6400_CLKDIV0_HCLK_SHIFT (8)
51#define S3C6400_CLKDIV0_MPLL_MASK (0x1 << 4)
52#define S3C6400_CLKDIV0_MPLL_SHIFT (4)
53#define S3C6400_CLKDIV0_ARM_MASK (0x3 << 0)
54#define S3C6410_CLKDIV0_ARM_MASK (0x7 << 0)
55#define S3C6400_CLKDIV0_ARM_SHIFT (0)
56
57/* CLKDIV1 */
58#define S3C6410_CLKDIV1_FIMC_MASK (0xf << 24)
59#define S3C6410_CLKDIV1_FIMC_SHIFT (24)
60#define S3C6400_CLKDIV1_UHOST_MASK (0xf << 20)
61#define S3C6400_CLKDIV1_UHOST_SHIFT (20)
62#define S3C6400_CLKDIV1_SCALER_MASK (0xf << 16)
63#define S3C6400_CLKDIV1_SCALER_SHIFT (16)
64#define S3C6400_CLKDIV1_LCD_MASK (0xf << 12)
65#define S3C6400_CLKDIV1_LCD_SHIFT (12)
66#define S3C6400_CLKDIV1_MMC2_MASK (0xf << 8)
67#define S3C6400_CLKDIV1_MMC2_SHIFT (8)
68#define S3C6400_CLKDIV1_MMC1_MASK (0xf << 4)
69#define S3C6400_CLKDIV1_MMC1_SHIFT (4)
70#define S3C6400_CLKDIV1_MMC0_MASK (0xf << 0)
71#define S3C6400_CLKDIV1_MMC0_SHIFT (0)
72
73/* CLKDIV2 */
74#define S3C6410_CLKDIV2_AUDIO2_MASK (0xf << 24)
75#define S3C6410_CLKDIV2_AUDIO2_SHIFT (24)
76#define S3C6400_CLKDIV2_IRDA_MASK (0xf << 20)
77#define S3C6400_CLKDIV2_IRDA_SHIFT (20)
78#define S3C6400_CLKDIV2_UART_MASK (0xf << 16)
79#define S3C6400_CLKDIV2_UART_SHIFT (16)
80#define S3C6400_CLKDIV2_AUDIO1_MASK (0xf << 12)
81#define S3C6400_CLKDIV2_AUDIO1_SHIFT (12)
82#define S3C6400_CLKDIV2_AUDIO0_MASK (0xf << 8)
83#define S3C6400_CLKDIV2_AUDIO0_SHIFT (8)
84#define S3C6400_CLKDIV2_SPI1_MASK (0xf << 4)
85#define S3C6400_CLKDIV2_SPI1_SHIFT (4)
86#define S3C6400_CLKDIV2_SPI0_MASK (0xf << 0)
87#define S3C6400_CLKDIV2_SPI0_SHIFT (0)
88
89/* HCLK GATE Registers */
90#define S3C_CLKCON_HCLK_BUS (1<<30)
91#define S3C_CLKCON_HCLK_SECUR (1<<29)
92#define S3C_CLKCON_HCLK_SDMA1 (1<<28)
93#define S3C_CLKCON_HCLK_SDMA2 (1<<27)
94#define S3C_CLKCON_HCLK_UHOST (1<<26)
95#define S3C_CLKCON_HCLK_IROM (1<<25)
96#define S3C_CLKCON_HCLK_DDR1 (1<<24)
97#define S3C_CLKCON_HCLK_DDR0 (1<<23)
98#define S3C_CLKCON_HCLK_MEM1 (1<<22)
99#define S3C_CLKCON_HCLK_MEM0 (1<<21)
100#define S3C_CLKCON_HCLK_USB (1<<20)
101#define S3C_CLKCON_HCLK_HSMMC2 (1<<19)
102#define S3C_CLKCON_HCLK_HSMMC1 (1<<18)
103#define S3C_CLKCON_HCLK_HSMMC0 (1<<17)
104#define S3C_CLKCON_HCLK_MDP (1<<16)
105#define S3C_CLKCON_HCLK_DHOST (1<<15)
106#define S3C_CLKCON_HCLK_IHOST (1<<14)
107#define S3C_CLKCON_HCLK_DMA1 (1<<13)
108#define S3C_CLKCON_HCLK_DMA0 (1<<12)
109#define S3C_CLKCON_HCLK_JPEG (1<<11)
110#define S3C_CLKCON_HCLK_CAMIF (1<<10)
111#define S3C_CLKCON_HCLK_SCALER (1<<9)
112#define S3C_CLKCON_HCLK_2D (1<<8)
113#define S3C_CLKCON_HCLK_TV (1<<7)
114#define S3C_CLKCON_HCLK_POST0 (1<<5)
115#define S3C_CLKCON_HCLK_ROT (1<<4)
116#define S3C_CLKCON_HCLK_LCD (1<<3)
117#define S3C_CLKCON_HCLK_TZIC (1<<2)
118#define S3C_CLKCON_HCLK_INTC (1<<1)
119#define S3C_CLKCON_HCLK_MFC (1<<0)
120
121/* PCLK GATE Registers */
122#define S3C6410_CLKCON_PCLK_I2C1 (1<<27)
123#define S3C6410_CLKCON_PCLK_IIS2 (1<<26)
124#define S3C_CLKCON_PCLK_SKEY (1<<24)
125#define S3C_CLKCON_PCLK_CHIPID (1<<23)
126#define S3C_CLKCON_PCLK_SPI1 (1<<22)
127#define S3C_CLKCON_PCLK_SPI0 (1<<21)
128#define S3C_CLKCON_PCLK_HSIRX (1<<20)
129#define S3C_CLKCON_PCLK_HSITX (1<<19)
130#define S3C_CLKCON_PCLK_GPIO (1<<18)
131#define S3C_CLKCON_PCLK_IIC (1<<17)
132#define S3C_CLKCON_PCLK_IIS1 (1<<16)
133#define S3C_CLKCON_PCLK_IIS0 (1<<15)
134#define S3C_CLKCON_PCLK_AC97 (1<<14)
135#define S3C_CLKCON_PCLK_TZPC (1<<13)
136#define S3C_CLKCON_PCLK_TSADC (1<<12)
137#define S3C_CLKCON_PCLK_KEYPAD (1<<11)
138#define S3C_CLKCON_PCLK_IRDA (1<<10)
139#define S3C_CLKCON_PCLK_PCM1 (1<<9)
140#define S3C_CLKCON_PCLK_PCM0 (1<<8)
141#define S3C_CLKCON_PCLK_PWM (1<<7)
142#define S3C_CLKCON_PCLK_RTC (1<<6)
143#define S3C_CLKCON_PCLK_WDT (1<<5)
144#define S3C_CLKCON_PCLK_UART3 (1<<4)
145#define S3C_CLKCON_PCLK_UART2 (1<<3)
146#define S3C_CLKCON_PCLK_UART1 (1<<2)
147#define S3C_CLKCON_PCLK_UART0 (1<<1)
148#define S3C_CLKCON_PCLK_MFC (1<<0)
149
150/* SCLK GATE Registers */
151#define S3C_CLKCON_SCLK_UHOST (1<<30)
152#define S3C_CLKCON_SCLK_MMC2_48 (1<<29)
153#define S3C_CLKCON_SCLK_MMC1_48 (1<<28)
154#define S3C_CLKCON_SCLK_MMC0_48 (1<<27)
155#define S3C_CLKCON_SCLK_MMC2 (1<<26)
156#define S3C_CLKCON_SCLK_MMC1 (1<<25)
157#define S3C_CLKCON_SCLK_MMC0 (1<<24)
158#define S3C_CLKCON_SCLK_SPI1_48 (1<<23)
159#define S3C_CLKCON_SCLK_SPI0_48 (1<<22)
160#define S3C_CLKCON_SCLK_SPI1 (1<<21)
161#define S3C_CLKCON_SCLK_SPI0 (1<<20)
162#define S3C_CLKCON_SCLK_DAC27 (1<<19)
163#define S3C_CLKCON_SCLK_TV27 (1<<18)
164#define S3C_CLKCON_SCLK_SCALER27 (1<<17)
165#define S3C_CLKCON_SCLK_SCALER (1<<16)
166#define S3C_CLKCON_SCLK_LCD27 (1<<15)
167#define S3C_CLKCON_SCLK_LCD (1<<14)
168#define S3C6400_CLKCON_SCLK_POST1_27 (1<<13)
169#define S3C6410_CLKCON_FIMC (1<<13)
170#define S3C_CLKCON_SCLK_POST0_27 (1<<12)
171#define S3C6400_CLKCON_SCLK_POST1 (1<<11)
172#define S3C6410_CLKCON_SCLK_AUDIO2 (1<<11)
173#define S3C_CLKCON_SCLK_POST0 (1<<10)
174#define S3C_CLKCON_SCLK_AUDIO1 (1<<9)
175#define S3C_CLKCON_SCLK_AUDIO0 (1<<8)
176#define S3C_CLKCON_SCLK_SECUR (1<<7)
177#define S3C_CLKCON_SCLK_IRDA (1<<6)
178#define S3C_CLKCON_SCLK_UART (1<<5)
179#define S3C_CLKCON_SCLK_ONENAND (1<<4)
180#define S3C_CLKCON_SCLK_MFC (1<<3)
181#define S3C_CLKCON_SCLK_CAM (1<<2)
182#define S3C_CLKCON_SCLK_JPEG (1<<1)
183
184/* CLKSRC */
185
186#define S3C6400_CLKSRC_APLL_MOUT (1 << 0)
187#define S3C6400_CLKSRC_MPLL_MOUT (1 << 1)
188#define S3C6400_CLKSRC_EPLL_MOUT (1 << 2)
189#define S3C6400_CLKSRC_APLL_MOUT_SHIFT (0)
190#define S3C6400_CLKSRC_MPLL_MOUT_SHIFT (1)
191#define S3C6400_CLKSRC_EPLL_MOUT_SHIFT (2)
192#define S3C6400_CLKSRC_MFC (1 << 4)
193
194#define S3C6410_CLKSRC_TV27_MASK (0x1 << 31)
195#define S3C6410_CLKSRC_TV27_SHIFT (31)
196#define S3C6410_CLKSRC_DAC27_MASK (0x1 << 30)
197#define S3C6410_CLKSRC_DAC27_SHIFT (30)
198#define S3C6400_CLKSRC_SCALER_MASK (0x3 << 28)
199#define S3C6400_CLKSRC_SCALER_SHIFT (28)
200#define S3C6400_CLKSRC_LCD_MASK (0x3 << 26)
201#define S3C6400_CLKSRC_LCD_SHIFT (26)
202#define S3C6400_CLKSRC_IRDA_MASK (0x3 << 24)
203#define S3C6400_CLKSRC_IRDA_SHIFT (24)
204#define S3C6400_CLKSRC_MMC2_MASK (0x3 << 22)
205#define S3C6400_CLKSRC_MMC2_SHIFT (22)
206#define S3C6400_CLKSRC_MMC1_MASK (0x3 << 20)
207#define S3C6400_CLKSRC_MMC1_SHIFT (20)
208#define S3C6400_CLKSRC_MMC0_MASK (0x3 << 18)
209#define S3C6400_CLKSRC_MMC0_SHIFT (18)
210#define S3C6400_CLKSRC_SPI1_MASK (0x3 << 16)
211#define S3C6400_CLKSRC_SPI1_SHIFT (16)
212#define S3C6400_CLKSRC_SPI0_MASK (0x3 << 14)
213#define S3C6400_CLKSRC_SPI0_SHIFT (14)
214#define S3C6400_CLKSRC_UART_MASK (0x1 << 13)
215#define S3C6400_CLKSRC_UART_SHIFT (13)
216#define S3C6400_CLKSRC_AUDIO1_MASK (0x7 << 10)
217#define S3C6400_CLKSRC_AUDIO1_SHIFT (10)
218#define S3C6400_CLKSRC_AUDIO0_MASK (0x7 << 7)
219#define S3C6400_CLKSRC_AUDIO0_SHIFT (7)
220#define S3C6400_CLKSRC_UHOST_MASK (0x3 << 5)
221#define S3C6400_CLKSRC_UHOST_SHIFT (5)
222
223
224#endif /* _PLAT_REGS_CLOCK_H */
diff --git a/arch/arm/plat-s3c64xx/include/plat/regs-gpio.h b/arch/arm/plat-s3c64xx/include/plat/regs-gpio.h
new file mode 100644
index 000000000000..75b873d82808
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/regs-gpio.h
@@ -0,0 +1,35 @@
1/* linux/arch/arm/plat-s3c64xx/include/mach/regs-gpio.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX - GPIO register definitions
9 */
10
11#ifndef __ASM_PLAT_S3C64XX_REGS_GPIO_H
12#define __ASM_PLAT_S3C64XX_REGS_GPIO_H __FILE__
13
14/* Base addresses for each of the banks */
15
16#define S3C64XX_GPA_BASE (S3C64XX_VA_GPIO + 0x0000)
17#define S3C64XX_GPB_BASE (S3C64XX_VA_GPIO + 0x0020)
18#define S3C64XX_GPC_BASE (S3C64XX_VA_GPIO + 0x0040)
19#define S3C64XX_GPD_BASE (S3C64XX_VA_GPIO + 0x0060)
20#define S3C64XX_GPE_BASE (S3C64XX_VA_GPIO + 0x0080)
21#define S3C64XX_GPF_BASE (S3C64XX_VA_GPIO + 0x00A0)
22#define S3C64XX_GPG_BASE (S3C64XX_VA_GPIO + 0x00C0)
23#define S3C64XX_GPH_BASE (S3C64XX_VA_GPIO + 0x00E0)
24#define S3C64XX_GPI_BASE (S3C64XX_VA_GPIO + 0x0100)
25#define S3C64XX_GPJ_BASE (S3C64XX_VA_GPIO + 0x0120)
26#define S3C64XX_GPK_BASE (S3C64XX_VA_GPIO + 0x0800)
27#define S3C64XX_GPL_BASE (S3C64XX_VA_GPIO + 0x0810)
28#define S3C64XX_GPM_BASE (S3C64XX_VA_GPIO + 0x0820)
29#define S3C64XX_GPN_BASE (S3C64XX_VA_GPIO + 0x0830)
30#define S3C64XX_GPO_BASE (S3C64XX_VA_GPIO + 0x0140)
31#define S3C64XX_GPP_BASE (S3C64XX_VA_GPIO + 0x0160)
32#define S3C64XX_GPQ_BASE (S3C64XX_VA_GPIO + 0x0180)
33
34#endif /* __ASM_PLAT_S3C64XX_REGS_GPIO_H */
35
diff --git a/arch/arm/plat-s3c64xx/include/plat/regs-sys.h b/arch/arm/plat-s3c64xx/include/plat/regs-sys.h
new file mode 100644
index 000000000000..d8ed82917096
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/regs-sys.h
@@ -0,0 +1,24 @@
1/* arch/arm/plat-s3c64xx/include/plat/regs-sys.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX system register definitions
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#ifndef __PLAT_REGS_SYS_H
16#define __PLAT_REGS_SYS_H __FILE__
17
18#define S3C_SYSREG(x) (S3C_VA_SYS + (x))
19
20#define S3C64XX_OTHERS S3C_SYSREG(0x900)
21
22#define S3C64XX_OTHERS_USBMASK (1 << 16)
23
24#endif /* _PLAT_REGS_SYS_H */
diff --git a/arch/arm/plat-s3c64xx/include/plat/s3c6400.h b/arch/arm/plat-s3c64xx/include/plat/s3c6400.h
new file mode 100644
index 000000000000..571eaa2e54f1
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/s3c6400.h
@@ -0,0 +1,35 @@
1/* arch/arm/plat-s3c64xx/include/plat/s3c6400.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * Header file for s3c6400 cpu support
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/* Common init code for S3C6400 related SoCs */
16
17extern void s3c6400_common_init_uarts(struct s3c2410_uartcfg *cfg, int no);
18extern void s3c6400_register_clocks(void);
19extern void s3c6400_setup_clocks(void);
20
21#ifdef CONFIG_CPU_S3C6400
22
23extern int s3c6400_init(void);
24extern void s3c6400_map_io(void);
25extern void s3c6400_init_clocks(int xtal);
26
27#define s3c6400_init_uarts s3c6400_common_init_uarts
28
29#else
30#define s3c6400_init_clocks NULL
31#define s3c6400_init_uarts NULL
32#define s3c6400_map_io NULL
33#define s3c6400_init NULL
34#endif
35
diff --git a/arch/arm/plat-s3c64xx/include/plat/s3c6410.h b/arch/arm/plat-s3c64xx/include/plat/s3c6410.h
new file mode 100644
index 000000000000..50dcdd6f6800
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/s3c6410.h
@@ -0,0 +1,29 @@
1/* arch/arm/plat-s3c64xx/include/plat/s3c6410.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * Header file for s3c6410 cpu support
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#ifdef CONFIG_CPU_S3C6410
16
17extern int s3c6410_init(void);
18extern void s3c6410_init_irq(void);
19extern void s3c6410_map_io(void);
20extern void s3c6410_init_clocks(int xtal);
21
22#define s3c6410_init_uarts s3c6400_common_init_uarts
23
24#else
25#define s3c6410_init_clocks NULL
26#define s3c6410_init_uarts NULL
27#define s3c6410_map_io NULL
28#define s3c6410_init NULL
29#endif
diff --git a/arch/arm/plat-s3c64xx/irq-eint.c b/arch/arm/plat-s3c64xx/irq-eint.c
new file mode 100644
index 000000000000..1f7cc0067f5c
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/irq-eint.c
@@ -0,0 +1,202 @@
1/* arch/arm/plat-s3c64xx/irq-eint.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX - Interrupt handling for IRQ_EINT(x)
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/interrupt.h>
17#include <linux/irq.h>
18#include <linux/io.h>
19
20#include <asm/hardware/vic.h>
21
22#include <plat/regs-irqtype.h>
23
24#include <mach/map.h>
25#include <plat/cpu.h>
26
27/* GPIO is 0x7F008xxx, */
28#define S3C64XX_GPIOREG(x) (S3C64XX_VA_GPIO + (x))
29
30#define S3C64XX_EINT0CON0 S3C64XX_GPIOREG(0x900)
31#define S3C64XX_EINT0CON1 S3C64XX_GPIOREG(0x904)
32#define S3C64XX_EINT0FLTCON0 S3C64XX_GPIOREG(0x910)
33#define S3C64XX_EINT0FLTCON1 S3C64XX_GPIOREG(0x914)
34#define S3C64XX_EINT0FLTCON2 S3C64XX_GPIOREG(0x918)
35#define S3C64XX_EINT0FLTCON3 S3C64XX_GPIOREG(0x91C)
36
37#define S3C64XX_EINT0MASK S3C64XX_GPIOREG(0x920)
38#define S3C64XX_EINT0PEND S3C64XX_GPIOREG(0x924)
39
40
41#define eint_offset(irq) ((irq) - IRQ_EINT(0))
42#define eint_irq_to_bit(irq) (1 << eint_offset(irq))
43
44static inline void s3c_irq_eint_mask(unsigned int irq)
45{
46 u32 mask;
47
48 mask = __raw_readl(S3C64XX_EINT0MASK);
49 mask |= eint_irq_to_bit(irq);
50 __raw_writel(mask, S3C64XX_EINT0MASK);
51}
52
53static void s3c_irq_eint_unmask(unsigned int irq)
54{
55 u32 mask;
56
57 mask = __raw_readl(S3C64XX_EINT0MASK);
58 mask |= eint_irq_to_bit(irq);
59 __raw_writel(mask, S3C64XX_EINT0MASK);
60}
61
62static inline void s3c_irq_eint_ack(unsigned int irq)
63{
64 __raw_writel(eint_irq_to_bit(irq), S3C64XX_EINT0PEND);
65}
66
67static void s3c_irq_eint_maskack(unsigned int irq)
68{
69 /* compiler should in-line these */
70 s3c_irq_eint_mask(irq);
71 s3c_irq_eint_ack(irq);
72}
73
74static int s3c_irq_eint_set_type(unsigned int irq, unsigned int type)
75{
76 int offs = eint_offset(irq);
77 int shift;
78 u32 ctrl, mask;
79 u32 newvalue = 0;
80 void __iomem *reg;
81
82 if (offs > 27)
83 return -EINVAL;
84
85 if (offs <= 15)
86 reg = S3C64XX_EINT0CON0;
87 else
88 reg = S3C64XX_EINT0CON1;
89
90 switch (type) {
91 case IRQ_TYPE_NONE:
92 printk(KERN_WARNING "No edge setting!\n");
93 break;
94
95 case IRQ_TYPE_EDGE_RISING:
96 newvalue = S3C2410_EXTINT_RISEEDGE;
97 break;
98
99 case IRQ_TYPE_EDGE_FALLING:
100 newvalue = S3C2410_EXTINT_FALLEDGE;
101 break;
102
103 case IRQ_TYPE_EDGE_BOTH:
104 newvalue = S3C2410_EXTINT_BOTHEDGE;
105 break;
106
107 case IRQ_TYPE_LEVEL_LOW:
108 newvalue = S3C2410_EXTINT_LOWLEV;
109 break;
110
111 case IRQ_TYPE_LEVEL_HIGH:
112 newvalue = S3C2410_EXTINT_HILEV;
113 break;
114
115 default:
116 printk(KERN_ERR "No such irq type %d", type);
117 return -1;
118 }
119
120 shift = (offs / 2) * 4;
121 mask = 0x7 << shift;
122
123 ctrl = __raw_readl(reg);
124 ctrl &= ~mask;
125 ctrl |= newvalue << shift;
126 __raw_writel(ctrl, reg);
127
128 return 0;
129}
130
131static struct irq_chip s3c_irq_eint = {
132 .name = "s3c-eint",
133 .mask = s3c_irq_eint_mask,
134 .unmask = s3c_irq_eint_unmask,
135 .mask_ack = s3c_irq_eint_maskack,
136 .ack = s3c_irq_eint_ack,
137 .set_type = s3c_irq_eint_set_type,
138};
139
140/* s3c_irq_demux_eint
141 *
142 * This function demuxes the IRQ from the group0 external interrupts,
143 * from IRQ_EINT(0) to IRQ_EINT(27). It is designed to be inlined into
144 * the specific handlers s3c_irq_demux_eintX_Y.
145 */
146static inline void s3c_irq_demux_eint(unsigned int start, unsigned int end)
147{
148 u32 status = __raw_readl(S3C64XX_EINT0PEND);
149 u32 mask = __raw_readl(S3C64XX_EINT0MASK);
150 unsigned int irq;
151
152 status &= ~mask;
153 status >>= start;
154 status &= (1 << (end - start + 1)) - 1;
155
156 for (irq = IRQ_EINT(start); irq <= IRQ_EINT(end); irq++) {
157 if (status & 1)
158 generic_handle_irq(irq);
159
160 status >>= 1;
161 }
162}
163
164static void s3c_irq_demux_eint0_3(unsigned int irq, struct irq_desc *desc)
165{
166 s3c_irq_demux_eint(0, 3);
167}
168
169static void s3c_irq_demux_eint4_11(unsigned int irq, struct irq_desc *desc)
170{
171 s3c_irq_demux_eint(4, 11);
172}
173
174static void s3c_irq_demux_eint12_19(unsigned int irq, struct irq_desc *desc)
175{
176 s3c_irq_demux_eint(12, 19);
177}
178
179static void s3c_irq_demux_eint20_27(unsigned int irq, struct irq_desc *desc)
180{
181 s3c_irq_demux_eint(20, 27);
182}
183
184int __init s3c64xx_init_irq_eint(void)
185{
186 int irq;
187
188 for (irq = IRQ_EINT(0); irq <= IRQ_EINT(27); irq++) {
189 set_irq_chip(irq, &s3c_irq_eint);
190 set_irq_handler(irq, handle_level_irq);
191 set_irq_flags(irq, IRQF_VALID);
192 }
193
194 set_irq_chained_handler(IRQ_EINT0_3, s3c_irq_demux_eint0_3);
195 set_irq_chained_handler(IRQ_EINT4_11, s3c_irq_demux_eint4_11);
196 set_irq_chained_handler(IRQ_EINT12_19, s3c_irq_demux_eint12_19);
197 set_irq_chained_handler(IRQ_EINT20_27, s3c_irq_demux_eint20_27);
198
199 return 0;
200}
201
202arch_initcall(s3c64xx_init_irq_eint);
diff --git a/arch/arm/plat-s3c64xx/irq.c b/arch/arm/plat-s3c64xx/irq.c
new file mode 100644
index 000000000000..a94f1d5e819d
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/irq.c
@@ -0,0 +1,257 @@
1/* arch/arm/plat-s3c64xx/irq.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX - Interrupt handling
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/interrupt.h>
17#include <linux/irq.h>
18#include <linux/io.h>
19
20#include <asm/hardware/vic.h>
21
22#include <mach/map.h>
23#include <plat/regs-timer.h>
24#include <plat/cpu.h>
25
26/* Timer interrupt handling */
27
28static void s3c_irq_demux_timer(unsigned int base_irq, unsigned int sub_irq)
29{
30 generic_handle_irq(sub_irq);
31}
32
33static void s3c_irq_demux_timer0(unsigned int irq, struct irq_desc *desc)
34{
35 s3c_irq_demux_timer(irq, IRQ_TIMER0);
36}
37
38static void s3c_irq_demux_timer1(unsigned int irq, struct irq_desc *desc)
39{
40 s3c_irq_demux_timer(irq, IRQ_TIMER1);
41}
42
43static void s3c_irq_demux_timer2(unsigned int irq, struct irq_desc *desc)
44{
45 s3c_irq_demux_timer(irq, IRQ_TIMER2);
46}
47
48static void s3c_irq_demux_timer3(unsigned int irq, struct irq_desc *desc)
49{
50 s3c_irq_demux_timer(irq, IRQ_TIMER3);
51}
52
53static void s3c_irq_demux_timer4(unsigned int irq, struct irq_desc *desc)
54{
55 s3c_irq_demux_timer(irq, IRQ_TIMER4);
56}
57
58/* We assume the IRQ_TIMER0..IRQ_TIMER4 range is continuous. */
59
60static void s3c_irq_timer_mask(unsigned int irq)
61{
62 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT);
63
64 reg &= 0x1f; /* mask out pending interrupts */
65 reg &= ~(1 << (irq - IRQ_TIMER0));
66 __raw_writel(reg, S3C64XX_TINT_CSTAT);
67}
68
69static void s3c_irq_timer_unmask(unsigned int irq)
70{
71 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT);
72
73 reg &= 0x1f; /* mask out pending interrupts */
74 reg |= 1 << (irq - IRQ_TIMER0);
75 __raw_writel(reg, S3C64XX_TINT_CSTAT);
76}
77
78static void s3c_irq_timer_ack(unsigned int irq)
79{
80 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT);
81
82 reg &= 0x1f;
83 reg |= (1 << 5) << (irq - IRQ_TIMER0);
84 __raw_writel(reg, S3C64XX_TINT_CSTAT);
85}
86
87static struct irq_chip s3c_irq_timer = {
88 .name = "s3c-timer",
89 .mask = s3c_irq_timer_mask,
90 .unmask = s3c_irq_timer_unmask,
91 .ack = s3c_irq_timer_ack,
92};
93
94struct uart_irq {
95 void __iomem *regs;
96 unsigned int base_irq;
97 unsigned int parent_irq;
98};
99
100/* Note, we make use of the fact that the parent IRQs, IRQ_UART[0..3]
101 * are consecutive when looking up the interrupt in the demux routines.
102 */
103static struct uart_irq uart_irqs[] = {
104 [0] = {
105 .regs = S3C_VA_UART0,
106 .base_irq = IRQ_S3CUART_BASE0,
107 .parent_irq = IRQ_UART0,
108 },
109 [1] = {
110 .regs = S3C_VA_UART1,
111 .base_irq = IRQ_S3CUART_BASE1,
112 .parent_irq = IRQ_UART1,
113 },
114 [2] = {
115 .regs = S3C_VA_UART2,
116 .base_irq = IRQ_S3CUART_BASE2,
117 .parent_irq = IRQ_UART2,
118 },
119 [3] = {
120 .regs = S3C_VA_UART3,
121 .base_irq = IRQ_S3CUART_BASE3,
122 .parent_irq = IRQ_UART3,
123 },
124};
125
126static inline void __iomem *s3c_irq_uart_base(unsigned int irq)
127{
128 struct uart_irq *uirq = get_irq_chip_data(irq);
129 return uirq->regs;
130}
131
132static inline unsigned int s3c_irq_uart_bit(unsigned int irq)
133{
134 return irq & 3;
135}
136
137/* UART interrupt registers, not worth adding to seperate include header */
138#define S3C64XX_UINTP 0x30
139#define S3C64XX_UINTSP 0x34
140#define S3C64XX_UINTM 0x38
141
142static void s3c_irq_uart_mask(unsigned int irq)
143{
144 void __iomem *regs = s3c_irq_uart_base(irq);
145 unsigned int bit = s3c_irq_uart_bit(irq);
146 u32 reg;
147
148 reg = __raw_readl(regs + S3C64XX_UINTM);
149 reg |= (1 << bit);
150 __raw_writel(reg, regs + S3C64XX_UINTM);
151}
152
153static void s3c_irq_uart_maskack(unsigned int irq)
154{
155 void __iomem *regs = s3c_irq_uart_base(irq);
156 unsigned int bit = s3c_irq_uart_bit(irq);
157 u32 reg;
158
159 reg = __raw_readl(regs + S3C64XX_UINTM);
160 reg |= (1 << bit);
161 __raw_writel(reg, regs + S3C64XX_UINTM);
162 __raw_writel(1 << bit, regs + S3C64XX_UINTP);
163}
164
165static void s3c_irq_uart_unmask(unsigned int irq)
166{
167 void __iomem *regs = s3c_irq_uart_base(irq);
168 unsigned int bit = s3c_irq_uart_bit(irq);
169 u32 reg;
170
171 reg = __raw_readl(regs + S3C64XX_UINTM);
172 reg &= ~(1 << bit);
173 __raw_writel(reg, regs + S3C64XX_UINTM);
174}
175
176static void s3c_irq_uart_ack(unsigned int irq)
177{
178 void __iomem *regs = s3c_irq_uart_base(irq);
179 unsigned int bit = s3c_irq_uart_bit(irq);
180
181 __raw_writel(1 << bit, regs + S3C64XX_UINTP);
182}
183
184static void s3c_irq_demux_uart(unsigned int irq, struct irq_desc *desc)
185{
186 struct uart_irq *uirq = &uart_irqs[irq - IRQ_UART0];
187 u32 pend = __raw_readl(uirq->regs + S3C64XX_UINTP);
188 int base = uirq->base_irq;
189
190 if (pend & (1 << 0))
191 generic_handle_irq(base);
192 if (pend & (1 << 1))
193 generic_handle_irq(base + 1);
194 if (pend & (1 << 2))
195 generic_handle_irq(base + 2);
196 if (pend & (1 << 3))
197 generic_handle_irq(base + 3);
198}
199
200static struct irq_chip s3c_irq_uart = {
201 .name = "s3c-uart",
202 .mask = s3c_irq_uart_mask,
203 .unmask = s3c_irq_uart_unmask,
204 .mask_ack = s3c_irq_uart_maskack,
205 .ack = s3c_irq_uart_ack,
206};
207
208static void __init s3c64xx_uart_irq(struct uart_irq *uirq)
209{
210 void *reg_base = uirq->regs;
211 unsigned int irq;
212 int offs;
213
214 /* mask all interrupts at the start. */
215 __raw_writel(0xf, reg_base + S3C64XX_UINTM);
216
217 for (offs = 0; offs < 3; offs++) {
218 irq = uirq->base_irq + offs;
219
220 set_irq_chip(irq, &s3c_irq_uart);
221 set_irq_chip_data(irq, uirq);
222 set_irq_handler(irq, handle_level_irq);
223 set_irq_flags(irq, IRQF_VALID);
224 }
225
226 set_irq_chained_handler(uirq->parent_irq, s3c_irq_demux_uart);
227}
228
229void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid)
230{
231 int uart, irq;
232
233 printk(KERN_DEBUG "%s: initialising interrupts\n", __func__);
234
235 /* initialise the pair of VICs */
236 vic_init(S3C_VA_VIC0, S3C_VIC0_BASE, vic0_valid);
237 vic_init(S3C_VA_VIC1, S3C_VIC1_BASE, vic1_valid);
238
239 /* add the timer sub-irqs */
240
241 set_irq_chained_handler(IRQ_TIMER0_VIC, s3c_irq_demux_timer0);
242 set_irq_chained_handler(IRQ_TIMER1_VIC, s3c_irq_demux_timer1);
243 set_irq_chained_handler(IRQ_TIMER2_VIC, s3c_irq_demux_timer2);
244 set_irq_chained_handler(IRQ_TIMER3_VIC, s3c_irq_demux_timer3);
245 set_irq_chained_handler(IRQ_TIMER4_VIC, s3c_irq_demux_timer4);
246
247 for (irq = IRQ_TIMER0; irq <= IRQ_TIMER4; irq++) {
248 set_irq_chip(irq, &s3c_irq_timer);
249 set_irq_handler(irq, handle_level_irq);
250 set_irq_flags(irq, IRQF_VALID);
251 }
252
253 for (uart = 0; uart < ARRAY_SIZE(uart_irqs); uart++)
254 s3c64xx_uart_irq(&uart_irqs[uart]);
255}
256
257
diff --git a/arch/arm/plat-s3c64xx/s3c6400-clock.c b/arch/arm/plat-s3c64xx/s3c6400-clock.c
new file mode 100644
index 000000000000..8d9a0cada668
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/s3c6400-clock.c
@@ -0,0 +1,655 @@
1/* linux/arch/arm/plat-s3c64xx/s3c6400-clock.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C6400 based common clock support
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/init.h>
16#include <linux/module.h>
17#include <linux/kernel.h>
18#include <linux/list.h>
19#include <linux/errno.h>
20#include <linux/err.h>
21#include <linux/clk.h>
22#include <linux/sysdev.h>
23#include <linux/io.h>
24
25#include <mach/hardware.h>
26#include <mach/map.h>
27
28#include <plat/cpu-freq.h>
29
30#include <plat/regs-clock.h>
31#include <plat/clock.h>
32#include <plat/cpu.h>
33#include <plat/pll.h>
34
35/* fin_apll, fin_mpll and fin_epll are all the same clock, which we call
36 * ext_xtal_mux for want of an actual name from the manual.
37*/
38
39struct clk clk_ext_xtal_mux = {
40 .name = "ext_xtal",
41 .id = -1,
42};
43
44#define clk_fin_apll clk_ext_xtal_mux
45#define clk_fin_mpll clk_ext_xtal_mux
46#define clk_fin_epll clk_ext_xtal_mux
47
48#define clk_fout_mpll clk_mpll
49
50struct clk_sources {
51 unsigned int nr_sources;
52 struct clk **sources;
53};
54
55struct clksrc_clk {
56 struct clk clk;
57 unsigned int mask;
58 unsigned int shift;
59
60 struct clk_sources *sources;
61
62 unsigned int divider_shift;
63 void __iomem *reg_divider;
64};
65
66struct clk clk_fout_apll = {
67 .name = "fout_apll",
68 .id = -1,
69};
70
71static struct clk *clk_src_apll_list[] = {
72 [0] = &clk_fin_apll,
73 [1] = &clk_fout_apll,
74};
75
76static struct clk_sources clk_src_apll = {
77 .sources = clk_src_apll_list,
78 .nr_sources = ARRAY_SIZE(clk_src_apll_list),
79};
80
81struct clksrc_clk clk_mout_apll = {
82 .clk = {
83 .name = "mout_apll",
84 .id = -1,
85 },
86 .shift = S3C6400_CLKSRC_APLL_MOUT_SHIFT,
87 .mask = S3C6400_CLKSRC_APLL_MOUT,
88 .sources = &clk_src_apll,
89};
90
91struct clk clk_fout_epll = {
92 .name = "fout_epll",
93 .id = -1,
94};
95
96static struct clk *clk_src_epll_list[] = {
97 [0] = &clk_fin_epll,
98 [1] = &clk_fout_epll,
99};
100
101static struct clk_sources clk_src_epll = {
102 .sources = clk_src_epll_list,
103 .nr_sources = ARRAY_SIZE(clk_src_epll_list),
104};
105
106struct clksrc_clk clk_mout_epll = {
107 .clk = {
108 .name = "mout_epll",
109 .id = -1,
110 },
111 .shift = S3C6400_CLKSRC_EPLL_MOUT_SHIFT,
112 .mask = S3C6400_CLKSRC_EPLL_MOUT,
113 .sources = &clk_src_epll,
114};
115
116static struct clk *clk_src_mpll_list[] = {
117 [0] = &clk_fin_mpll,
118 [1] = &clk_fout_mpll,
119};
120
121static struct clk_sources clk_src_mpll = {
122 .sources = clk_src_mpll_list,
123 .nr_sources = ARRAY_SIZE(clk_src_mpll_list),
124};
125
126struct clksrc_clk clk_mout_mpll = {
127 .clk = {
128 .name = "mout_mpll",
129 .id = -1,
130 },
131 .shift = S3C6400_CLKSRC_MPLL_MOUT_SHIFT,
132 .mask = S3C6400_CLKSRC_MPLL_MOUT,
133 .sources = &clk_src_mpll,
134};
135
136static unsigned long s3c64xx_clk_doutmpll_get_rate(struct clk *clk)
137{
138 unsigned long rate = clk_get_rate(clk->parent);
139
140 printk(KERN_DEBUG "%s: parent is %ld\n", __func__, rate);
141
142 if (__raw_readl(S3C_CLK_DIV0) & S3C6400_CLKDIV0_MPLL_MASK)
143 rate /= 2;
144
145 return rate;
146}
147
148struct clk clk_dout_mpll = {
149 .name = "dout_mpll",
150 .id = -1,
151 .parent = &clk_mout_mpll.clk,
152 .get_rate = s3c64xx_clk_doutmpll_get_rate,
153};
154
155static struct clk *clkset_spi_mmc_list[] = {
156 &clk_mout_epll.clk,
157 &clk_dout_mpll,
158 &clk_fin_epll,
159 &clk_27m,
160};
161
162static struct clk_sources clkset_spi_mmc = {
163 .sources = clkset_spi_mmc_list,
164 .nr_sources = ARRAY_SIZE(clkset_spi_mmc_list),
165};
166
167static struct clk *clkset_irda_list[] = {
168 &clk_mout_epll.clk,
169 &clk_dout_mpll,
170 NULL,
171 &clk_27m,
172};
173
174static struct clk_sources clkset_irda = {
175 .sources = clkset_irda_list,
176 .nr_sources = ARRAY_SIZE(clkset_irda_list),
177};
178
179static struct clk *clkset_uart_list[] = {
180 &clk_mout_epll.clk,
181 &clk_dout_mpll,
182 NULL,
183 NULL
184};
185
186static struct clk_sources clkset_uart = {
187 .sources = clkset_uart_list,
188 .nr_sources = ARRAY_SIZE(clkset_uart_list),
189};
190
191static struct clk *clkset_uhost_list[] = {
192 &clk_mout_epll.clk,
193 &clk_dout_mpll,
194 &clk_fin_epll,
195 &clk_48m,
196};
197
198static struct clk_sources clkset_uhost = {
199 .sources = clkset_uhost_list,
200 .nr_sources = ARRAY_SIZE(clkset_uhost_list),
201};
202
203
204/* The peripheral clocks are all controlled via clocksource followed
205 * by an optional divider and gate stage. We currently roll this into
206 * one clock which hides the intermediate clock from the mux.
207 *
208 * Note, the JPEG clock can only be an even divider...
209 *
210 * The scaler and LCD clocks depend on the S3C64XX version, and also
211 * have a common parent divisor so are not included here.
212 */
213
214static inline struct clksrc_clk *to_clksrc(struct clk *clk)
215{
216 return container_of(clk, struct clksrc_clk, clk);
217}
218
219static unsigned long s3c64xx_getrate_clksrc(struct clk *clk)
220{
221 struct clksrc_clk *sclk = to_clksrc(clk);
222 unsigned long rate = clk_get_rate(clk->parent);
223 u32 clkdiv = __raw_readl(sclk->reg_divider);
224
225 clkdiv >>= sclk->divider_shift;
226 clkdiv &= 0xf;
227 clkdiv++;
228
229 rate /= clkdiv;
230 return rate;
231}
232
233static int s3c64xx_setrate_clksrc(struct clk *clk, unsigned long rate)
234{
235 struct clksrc_clk *sclk = to_clksrc(clk);
236 void __iomem *reg = sclk->reg_divider;
237 unsigned int div;
238 u32 val;
239
240 rate = clk_round_rate(clk, rate);
241 div = clk_get_rate(clk->parent) / rate;
242
243 val = __raw_readl(reg);
244 val &= ~sclk->mask;
245 val |= (rate - 1) << sclk->shift;
246 __raw_writel(val, reg);
247
248 return 0;
249}
250
251static int s3c64xx_setparent_clksrc(struct clk *clk, struct clk *parent)
252{
253 struct clksrc_clk *sclk = to_clksrc(clk);
254 struct clk_sources *srcs = sclk->sources;
255 u32 clksrc = __raw_readl(S3C_CLK_SRC);
256 int src_nr = -1;
257 int ptr;
258
259 for (ptr = 0; ptr < srcs->nr_sources; ptr++)
260 if (srcs->sources[ptr] == parent) {
261 src_nr = ptr;
262 break;
263 }
264
265 if (src_nr >= 0) {
266 clksrc &= ~sclk->mask;
267 clksrc |= src_nr << sclk->shift;
268
269 __raw_writel(clksrc, S3C_CLK_SRC);
270 return 0;
271 }
272
273 return -EINVAL;
274}
275
276static unsigned long s3c64xx_roundrate_clksrc(struct clk *clk,
277 unsigned long rate)
278{
279 unsigned long parent_rate = clk_get_rate(clk->parent);
280 int div;
281
282 if (rate > parent_rate)
283 rate = parent_rate;
284 else {
285 div = rate / parent_rate;
286
287 if (div == 0)
288 div = 1;
289 if (div > 16)
290 div = 16;
291
292 rate = parent_rate / div;
293 }
294
295 return rate;
296}
297
298static struct clksrc_clk clk_mmc0 = {
299 .clk = {
300 .name = "mmc_bus",
301 .id = 0,
302 .ctrlbit = S3C_CLKCON_SCLK_MMC0,
303 .enable = s3c64xx_sclk_ctrl,
304 .set_parent = s3c64xx_setparent_clksrc,
305 .get_rate = s3c64xx_getrate_clksrc,
306 .set_rate = s3c64xx_setrate_clksrc,
307 .round_rate = s3c64xx_roundrate_clksrc,
308 },
309 .shift = S3C6400_CLKSRC_MMC0_SHIFT,
310 .mask = S3C6400_CLKSRC_MMC0_MASK,
311 .sources = &clkset_spi_mmc,
312 .divider_shift = S3C6400_CLKDIV1_MMC0_SHIFT,
313 .reg_divider = S3C_CLK_DIV1,
314};
315
316static struct clksrc_clk clk_mmc1 = {
317 .clk = {
318 .name = "mmc_bus",
319 .id = 1,
320 .ctrlbit = S3C_CLKCON_SCLK_MMC1,
321 .enable = s3c64xx_sclk_ctrl,
322 .get_rate = s3c64xx_getrate_clksrc,
323 .set_rate = s3c64xx_setrate_clksrc,
324 .set_parent = s3c64xx_setparent_clksrc,
325 .round_rate = s3c64xx_roundrate_clksrc,
326 },
327 .shift = S3C6400_CLKSRC_MMC1_SHIFT,
328 .mask = S3C6400_CLKSRC_MMC1_MASK,
329 .sources = &clkset_spi_mmc,
330 .divider_shift = S3C6400_CLKDIV1_MMC1_SHIFT,
331 .reg_divider = S3C_CLK_DIV1,
332};
333
334static struct clksrc_clk clk_mmc2 = {
335 .clk = {
336 .name = "mmc_bus",
337 .id = 2,
338 .ctrlbit = S3C_CLKCON_SCLK_MMC2,
339 .enable = s3c64xx_sclk_ctrl,
340 .get_rate = s3c64xx_getrate_clksrc,
341 .set_rate = s3c64xx_setrate_clksrc,
342 .set_parent = s3c64xx_setparent_clksrc,
343 .round_rate = s3c64xx_roundrate_clksrc,
344 },
345 .shift = S3C6400_CLKSRC_MMC2_SHIFT,
346 .mask = S3C6400_CLKSRC_MMC2_MASK,
347 .sources = &clkset_spi_mmc,
348 .divider_shift = S3C6400_CLKDIV1_MMC2_SHIFT,
349 .reg_divider = S3C_CLK_DIV1,
350};
351
352static struct clksrc_clk clk_usbhost = {
353 .clk = {
354 .name = "usb-host-bus",
355 .id = -1,
356 .ctrlbit = S3C_CLKCON_SCLK_UHOST,
357 .enable = s3c64xx_sclk_ctrl,
358 .set_parent = s3c64xx_setparent_clksrc,
359 .get_rate = s3c64xx_getrate_clksrc,
360 .set_rate = s3c64xx_setrate_clksrc,
361 .round_rate = s3c64xx_roundrate_clksrc,
362 },
363 .shift = S3C6400_CLKSRC_UHOST_SHIFT,
364 .mask = S3C6400_CLKSRC_UHOST_MASK,
365 .sources = &clkset_uhost,
366 .divider_shift = S3C6400_CLKDIV1_UHOST_SHIFT,
367 .reg_divider = S3C_CLK_DIV1,
368};
369
370static struct clksrc_clk clk_uart_uclk1 = {
371 .clk = {
372 .name = "uclk1",
373 .id = -1,
374 .ctrlbit = S3C_CLKCON_SCLK_UART,
375 .enable = s3c64xx_sclk_ctrl,
376 .set_parent = s3c64xx_setparent_clksrc,
377 .get_rate = s3c64xx_getrate_clksrc,
378 .set_rate = s3c64xx_setrate_clksrc,
379 .round_rate = s3c64xx_roundrate_clksrc,
380 },
381 .shift = S3C6400_CLKSRC_UART_SHIFT,
382 .mask = S3C6400_CLKSRC_UART_MASK,
383 .sources = &clkset_uart,
384 .divider_shift = S3C6400_CLKDIV2_UART_SHIFT,
385 .reg_divider = S3C_CLK_DIV2,
386};
387
388/* Where does UCLK0 come from? */
389
390static struct clksrc_clk clk_spi0 = {
391 .clk = {
392 .name = "spi-bus",
393 .id = 0,
394 .ctrlbit = S3C_CLKCON_SCLK_SPI0,
395 .enable = s3c64xx_sclk_ctrl,
396 .set_parent = s3c64xx_setparent_clksrc,
397 .get_rate = s3c64xx_getrate_clksrc,
398 .set_rate = s3c64xx_setrate_clksrc,
399 .round_rate = s3c64xx_roundrate_clksrc,
400 },
401 .shift = S3C6400_CLKSRC_SPI0_SHIFT,
402 .mask = S3C6400_CLKSRC_SPI0_MASK,
403 .sources = &clkset_spi_mmc,
404 .divider_shift = S3C6400_CLKDIV2_SPI0_SHIFT,
405 .reg_divider = S3C_CLK_DIV2,
406};
407
408static struct clksrc_clk clk_spi1 = {
409 .clk = {
410 .name = "spi-bus",
411 .id = 1,
412 .ctrlbit = S3C_CLKCON_SCLK_SPI1,
413 .enable = s3c64xx_sclk_ctrl,
414 .set_parent = s3c64xx_setparent_clksrc,
415 .get_rate = s3c64xx_getrate_clksrc,
416 .set_rate = s3c64xx_setrate_clksrc,
417 .round_rate = s3c64xx_roundrate_clksrc,
418 },
419 .shift = S3C6400_CLKSRC_SPI1_SHIFT,
420 .mask = S3C6400_CLKSRC_SPI1_MASK,
421 .sources = &clkset_spi_mmc,
422 .divider_shift = S3C6400_CLKDIV2_SPI1_SHIFT,
423 .reg_divider = S3C_CLK_DIV2,
424};
425
426static struct clk clk_iis_cd0 = {
427 .name = "iis_cdclk0",
428 .id = -1,
429};
430
431static struct clk clk_iis_cd1 = {
432 .name = "iis_cdclk1",
433 .id = -1,
434};
435
436static struct clk clk_pcm_cd = {
437 .name = "pcm_cdclk",
438 .id = -1,
439};
440
441static struct clk *clkset_audio0_list[] = {
442 [0] = &clk_mout_epll.clk,
443 [1] = &clk_dout_mpll,
444 [2] = &clk_fin_epll,
445 [3] = &clk_iis_cd0,
446 [4] = &clk_pcm_cd,
447};
448
449static struct clk_sources clkset_audio0 = {
450 .sources = clkset_audio0_list,
451 .nr_sources = ARRAY_SIZE(clkset_audio0_list),
452};
453
454static struct clksrc_clk clk_audio0 = {
455 .clk = {
456 .name = "audio-bus",
457 .id = 0,
458 .ctrlbit = S3C_CLKCON_SCLK_AUDIO0,
459 .enable = s3c64xx_sclk_ctrl,
460 .set_parent = s3c64xx_setparent_clksrc,
461 .get_rate = s3c64xx_getrate_clksrc,
462 .set_rate = s3c64xx_setrate_clksrc,
463 .round_rate = s3c64xx_roundrate_clksrc,
464 },
465 .shift = S3C6400_CLKSRC_AUDIO0_SHIFT,
466 .mask = S3C6400_CLKSRC_AUDIO0_MASK,
467 .sources = &clkset_audio0,
468 .divider_shift = S3C6400_CLKDIV2_AUDIO0_SHIFT,
469 .reg_divider = S3C_CLK_DIV2,
470};
471
472static struct clk *clkset_audio1_list[] = {
473 [0] = &clk_mout_epll.clk,
474 [1] = &clk_dout_mpll,
475 [2] = &clk_fin_epll,
476 [3] = &clk_iis_cd1,
477 [4] = &clk_pcm_cd,
478};
479
480static struct clk_sources clkset_audio1 = {
481 .sources = clkset_audio1_list,
482 .nr_sources = ARRAY_SIZE(clkset_audio1_list),
483};
484
485static struct clksrc_clk clk_audio1 = {
486 .clk = {
487 .name = "audio-bus",
488 .id = 1,
489 .ctrlbit = S3C_CLKCON_SCLK_AUDIO1,
490 .enable = s3c64xx_sclk_ctrl,
491 .set_parent = s3c64xx_setparent_clksrc,
492 .get_rate = s3c64xx_getrate_clksrc,
493 .set_rate = s3c64xx_setrate_clksrc,
494 .round_rate = s3c64xx_roundrate_clksrc,
495 },
496 .shift = S3C6400_CLKSRC_AUDIO1_SHIFT,
497 .mask = S3C6400_CLKSRC_AUDIO1_MASK,
498 .sources = &clkset_audio1,
499 .divider_shift = S3C6400_CLKDIV2_AUDIO1_SHIFT,
500 .reg_divider = S3C_CLK_DIV2,
501};
502
503static struct clksrc_clk clk_irda = {
504 .clk = {
505 .name = "irda-bus",
506 .id = 0,
507 .ctrlbit = S3C_CLKCON_SCLK_IRDA,
508 .enable = s3c64xx_sclk_ctrl,
509 .set_parent = s3c64xx_setparent_clksrc,
510 .get_rate = s3c64xx_getrate_clksrc,
511 .set_rate = s3c64xx_setrate_clksrc,
512 .round_rate = s3c64xx_roundrate_clksrc,
513 },
514 .shift = S3C6400_CLKSRC_IRDA_SHIFT,
515 .mask = S3C6400_CLKSRC_IRDA_MASK,
516 .sources = &clkset_irda,
517 .divider_shift = S3C6400_CLKDIV2_IRDA_SHIFT,
518 .reg_divider = S3C_CLK_DIV2,
519};
520
521/* Clock initialisation code */
522
523static struct clksrc_clk *init_parents[] = {
524 &clk_mout_apll,
525 &clk_mout_epll,
526 &clk_mout_mpll,
527 &clk_mmc0,
528 &clk_mmc1,
529 &clk_mmc2,
530 &clk_usbhost,
531 &clk_uart_uclk1,
532 &clk_spi0,
533 &clk_spi1,
534 &clk_audio0,
535 &clk_audio1,
536 &clk_irda,
537};
538
539static void __init_or_cpufreq s3c6400_set_clksrc(struct clksrc_clk *clk)
540{
541 struct clk_sources *srcs = clk->sources;
542 u32 clksrc = __raw_readl(S3C_CLK_SRC);
543
544 clksrc &= clk->mask;
545 clksrc >>= clk->shift;
546
547 if (clksrc > srcs->nr_sources || !srcs->sources[clksrc]) {
548 printk(KERN_ERR "%s: bad source %d\n",
549 clk->clk.name, clksrc);
550 return;
551 }
552
553 clk->clk.parent = srcs->sources[clksrc];
554
555 printk(KERN_INFO "%s: source is %s (%d), rate is %ld\n",
556 clk->clk.name, clk->clk.parent->name, clksrc,
557 clk_get_rate(&clk->clk));
558}
559
560#define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1)
561
562void __init_or_cpufreq s3c6400_setup_clocks(void)
563{
564 struct clk *xtal_clk;
565 unsigned long xtal;
566 unsigned long fclk;
567 unsigned long hclk;
568 unsigned long hclk2;
569 unsigned long pclk;
570 unsigned long epll;
571 unsigned long apll;
572 unsigned long mpll;
573 unsigned int ptr;
574 u32 clkdiv0;
575
576 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
577
578 clkdiv0 = __raw_readl(S3C_CLK_DIV0);
579 printk(KERN_DEBUG "%s: clkdiv0 = %08x\n", __func__, clkdiv0);
580
581 xtal_clk = clk_get(NULL, "xtal");
582 BUG_ON(IS_ERR(xtal_clk));
583
584 xtal = clk_get_rate(xtal_clk);
585 clk_put(xtal_clk);
586
587 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
588
589 epll = s3c6400_get_epll(xtal);
590 mpll = s3c6400_get_pll(xtal, __raw_readl(S3C_MPLL_CON));
591 apll = s3c6400_get_pll(xtal, __raw_readl(S3C_APLL_CON));
592
593 fclk = mpll;
594
595 printk(KERN_INFO "S3C64XX: PLL settings, A=%ld, M=%ld, E=%ld\n",
596 apll, mpll, epll);
597
598 hclk2 = mpll / GET_DIV(clkdiv0, S3C6400_CLKDIV0_HCLK2);
599 hclk = hclk2 / GET_DIV(clkdiv0, S3C6400_CLKDIV0_HCLK);
600 pclk = hclk2 / GET_DIV(clkdiv0, S3C6400_CLKDIV0_PCLK);
601
602 printk(KERN_INFO "S3C64XX: HCLK2=%ld, HCLK=%ld, PCLK=%ld\n",
603 hclk2, hclk, pclk);
604
605 clk_fout_mpll.rate = mpll;
606 clk_fout_epll.rate = epll;
607 clk_fout_apll.rate = apll;
608
609 clk_h.rate = hclk;
610 clk_p.rate = pclk;
611 clk_f.rate = fclk;
612
613 for (ptr = 0; ptr < ARRAY_SIZE(init_parents); ptr++)
614 s3c6400_set_clksrc(init_parents[ptr]);
615}
616
617static struct clk *clks[] __initdata = {
618 &clk_ext_xtal_mux,
619 &clk_iis_cd0,
620 &clk_iis_cd1,
621 &clk_pcm_cd,
622 &clk_mout_epll.clk,
623 &clk_fout_epll,
624 &clk_mout_mpll.clk,
625 &clk_dout_mpll,
626 &clk_mmc0.clk,
627 &clk_mmc1.clk,
628 &clk_mmc2.clk,
629 &clk_usbhost.clk,
630 &clk_uart_uclk1.clk,
631 &clk_spi0.clk,
632 &clk_spi1.clk,
633 &clk_audio0.clk,
634 &clk_audio1.clk,
635 &clk_irda.clk,
636};
637
638void __init s3c6400_register_clocks(void)
639{
640 struct clk *clkp;
641 int ret;
642 int ptr;
643
644 for (ptr = 0; ptr < ARRAY_SIZE(clks); ptr++) {
645 clkp = clks[ptr];
646 ret = s3c24xx_register_clock(clkp);
647 if (ret < 0) {
648 printk(KERN_ERR "Failed to register clock %s (%d)\n",
649 clkp->name, ret);
650 }
651 }
652
653 clk_mpll.parent = &clk_mout_mpll.clk;
654 clk_epll.parent = &clk_mout_epll.clk;
655}
diff --git a/arch/arm/plat-s3c64xx/s3c6400-init.c b/arch/arm/plat-s3c64xx/s3c6400-init.c
new file mode 100644
index 000000000000..6c28f39df097
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/s3c6400-init.c
@@ -0,0 +1,29 @@
1/* linux/arch/arm/plat-s3c64xx/s3c6400-init.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C6400 - CPU initialisation (common with other S3C64XX chips)
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/init.h>
18
19#include <plat/cpu.h>
20#include <plat/devs.h>
21#include <plat/s3c6400.h>
22#include <plat/s3c6410.h>
23
24/* uart registration process */
25
26void __init s3c6400_common_init_uarts(struct s3c2410_uartcfg *cfg, int no)
27{
28 s3c24xx_init_uartdevs("s3c6400-uart", s3c64xx_uart_resources, cfg, no);
29}
diff --git a/arch/arm/plat-s3c64xx/setup-fb-24bpp.c b/arch/arm/plat-s3c64xx/setup-fb-24bpp.c
new file mode 100644
index 000000000000..8e28e448dd20
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/setup-fb-24bpp.c
@@ -0,0 +1,37 @@
1/* linux/arch/arm/plat-s3c64xx/setup-fb-24bpp.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * Base S3C64XX setup information for 24bpp LCD framebuffer
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/fb.h>
18
19#include <mach/regs-fb.h>
20#include <mach/gpio.h>
21#include <plat/fb.h>
22#include <plat/gpio-cfg.h>
23
24extern void s3c64xx_fb_gpio_setup_24bpp(void)
25{
26 unsigned int gpio;
27
28 for (gpio = S3C64XX_GPI(0); gpio <= S3C64XX_GPI(15); gpio++) {
29 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
30 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
31 }
32
33 for (gpio = S3C64XX_GPJ(0); gpio <= S3C64XX_GPJ(11); gpio++) {
34 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
35 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
36 }
37}
diff --git a/arch/arm/plat-s3c64xx/setup-i2c0.c b/arch/arm/plat-s3c64xx/setup-i2c0.c
new file mode 100644
index 000000000000..364480763728
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/setup-i2c0.c
@@ -0,0 +1,31 @@
1/* linux/arch/arm/plat-s3c64xx/setup-i2c0.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * Base S3C64XX I2C bus 0 gpio configuration
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
18struct platform_device; /* don't need the contents */
19
20#include <mach/gpio.h>
21#include <plat/iic.h>
22#include <plat/gpio-bank-b.h>
23#include <plat/gpio-cfg.h>
24
25void s3c_i2c0_cfg_gpio(struct platform_device *dev)
26{
27 s3c_gpio_cfgpin(S3C64XX_GPB(5), S3C64XX_GPB5_I2C_SCL0);
28 s3c_gpio_cfgpin(S3C64XX_GPB(6), S3C64XX_GPB6_I2C_SDA0);
29 s3c_gpio_setpull(S3C64XX_GPB(5), S3C_GPIO_PULL_UP);
30 s3c_gpio_setpull(S3C64XX_GPB(6), S3C_GPIO_PULL_UP);
31}
diff --git a/arch/arm/plat-s3c64xx/setup-i2c1.c b/arch/arm/plat-s3c64xx/setup-i2c1.c
new file mode 100644
index 000000000000..bbe229bd90ca
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/setup-i2c1.c
@@ -0,0 +1,31 @@
1/* linux/arch/arm/plat-s3c64xx/setup-i2c1.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * Base S3C64XX I2C bus 1 gpio configuration
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
18struct platform_device; /* don't need the contents */
19
20#include <mach/gpio.h>
21#include <plat/iic.h>
22#include <plat/gpio-bank-b.h>
23#include <plat/gpio-cfg.h>
24
25void s3c_i2c1_cfg_gpio(struct platform_device *dev)
26{
27 s3c_gpio_cfgpin(S3C64XX_GPB(2), S3C64XX_GPB2_I2C_SCL1);
28 s3c_gpio_cfgpin(S3C64XX_GPB(3), S3C64XX_GPB3_I2C_SDA1);
29 s3c_gpio_setpull(S3C64XX_GPB(2), S3C_GPIO_PULL_UP);
30 s3c_gpio_setpull(S3C64XX_GPB(3), S3C_GPIO_PULL_UP);
31}
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index 43aa2020f85c..fd23c0e9e698 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: Thu Sep 25 10:10:50 2008 15# Last update: Sun Nov 30 16:39:36 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#
@@ -1380,7 +1380,7 @@ holon MACH_HOLON HOLON 1377
1380olip8 MACH_OLIP8 OLIP8 1378 1380olip8 MACH_OLIP8 OLIP8 1378
1381ghi270hg MACH_GHI270HG GHI270HG 1379 1381ghi270hg MACH_GHI270HG GHI270HG 1379
1382davinci_dm6467_evm MACH_DAVINCI_DM6467_EVM DAVINCI_DM6467_EVM 1380 1382davinci_dm6467_evm MACH_DAVINCI_DM6467_EVM DAVINCI_DM6467_EVM 1380
1383davinci_dm355_evm MACH_DAVINCI_DM350_EVM DAVINCI_DM350_EVM 1381 1383davinci_dm355_evm MACH_DAVINCI_DM355_EVM DAVINCI_DM355_EVM 1381
1384blackriver MACH_BLACKRIVER BLACKRIVER 1383 1384blackriver MACH_BLACKRIVER BLACKRIVER 1383
1385sandgate_wp MACH_SANDGATEWP SANDGATEWP 1384 1385sandgate_wp MACH_SANDGATEWP SANDGATEWP 1384
1386cdotbwsg MACH_CDOTBWSG CDOTBWSG 1385 1386cdotbwsg MACH_CDOTBWSG CDOTBWSG 1385
@@ -1771,7 +1771,7 @@ axs_ultrax MACH_AXS_ULTRAX AXS_ULTRAX 1779
1771at572d940deb MACH_AT572D940DEB AT572D940DEB 1780 1771at572d940deb MACH_AT572D940DEB AT572D940DEB 1780
1772davinci_da8xx_evm MACH_DAVINCI_DA8XX_EVM DAVINCI_DA8XX_EVM 1781 1772davinci_da8xx_evm MACH_DAVINCI_DA8XX_EVM DAVINCI_DA8XX_EVM 1781
1773ep9302 MACH_EP9302 EP9302 1782 1773ep9302 MACH_EP9302 EP9302 1782
1774at572d940hfeb MACH_AT572D940HFEB AT572D940HFEB 1783 1774at572d940hfek MACH_AT572D940HFEB AT572D940HFEB 1783
1775cybook3 MACH_CYBOOK3 CYBOOK3 1784 1775cybook3 MACH_CYBOOK3 CYBOOK3 1784
1776wdg002 MACH_WDG002 WDG002 1785 1776wdg002 MACH_WDG002 WDG002 1785
1777sg560adsl MACH_SG560ADSL SG560ADSL 1786 1777sg560adsl MACH_SG560ADSL SG560ADSL 1786
@@ -1899,3 +1899,98 @@ rut100 MACH_RUT100 RUT100 1908
1899asusp535 MACH_ASUSP535 ASUSP535 1909 1899asusp535 MACH_ASUSP535 ASUSP535 1909
1900htcraphael MACH_HTCRAPHAEL HTCRAPHAEL 1910 1900htcraphael MACH_HTCRAPHAEL HTCRAPHAEL 1910
1901sygdg1 MACH_SYGDG1 SYGDG1 1911 1901sygdg1 MACH_SYGDG1 SYGDG1 1911
1902sygdg2 MACH_SYGDG2 SYGDG2 1912
1903seoul MACH_SEOUL SEOUL 1913
1904salerno MACH_SALERNO SALERNO 1914
1905ucn_s3c64xx MACH_UCN_S3C64XX UCN_S3C64XX 1915
1906msm7201a MACH_MSM7201A MSM7201A 1916
1907lpr1 MACH_LPR1 LPR1 1917
1908armadillo500fx MACH_ARMADILLO500FX ARMADILLO500FX 1918
1909g3evm MACH_G3EVM G3EVM 1919
1910z3_dm355 MACH_Z3_DM355 Z3_DM355 1920
1911w90p910evb MACH_W90P910EVB W90P910EVB 1921
1912w90p920evb MACH_W90P920EVB W90P920EVB 1922
1913w90p950evb MACH_W90P950EVB W90P950EVB 1923
1914w90n960evb MACH_W90N960EVB W90N960EVB 1924
1915camhd MACH_CAMHD CAMHD 1925
1916mvc100 MACH_MVC100 MVC100 1926
1917electrum_200 MACH_ELECTRUM_200 ELECTRUM_200 1927
1918htcjade MACH_HTCJADE HTCJADE 1928
1919memphis MACH_MEMPHIS MEMPHIS 1929
1920imx27sbc MACH_IMX27SBC IMX27SBC 1930
1921lextar MACH_LEXTAR LEXTAR 1931
1922mv88f6281gtw_ge MACH_MV88F6281GTW_GE MV88F6281GTW_GE 1932
1923ncp MACH_NCP NCP 1933
1924z32an_series MACH_Z32AN Z32AN 1934
1925tmq_capd MACH_TMQ_CAPD TMQ_CAPD 1935
1926omap3_wl MACH_OMAP3_WL OMAP3_WL 1936
1927chumby MACH_CHUMBY CHUMBY 1937
1928atsarm9 MACH_ATSARM9 ATSARM9 1938
1929davinci_dm365_evm MACH_DAVINCI_DM365_EVM DAVINCI_DM365_EVM 1939
1930bahamas MACH_BAHAMAS BAHAMAS 1940
1931das MACH_DAS DAS 1941
1932minidas MACH_MINIDAS MINIDAS 1942
1933vk1000 MACH_VK1000 VK1000 1943
1934centro MACH_CENTRO CENTRO 1944
1935ctera_2bay MACH_CTERA_2BAY CTERA_2BAY 1945
1936edgeconnect MACH_EDGECONNECT EDGECONNECT 1946
1937nd27000 MACH_ND27000 ND27000 1947
1938cobra MACH_GEMALTO_COBRA GEMALTO_COBRA 1948
1939ingelabs_comet MACH_INGELABS_COMET INGELABS_COMET 1949
1940pollux_wiz MACH_POLLUX_WIZ POLLUX_WIZ 1950
1941blackstone MACH_BLACKSTONE BLACKSTONE 1951
1942topaz MACH_TOPAZ TOPAZ 1952
1943aixle MACH_AIXLE AIXLE 1953
1944mw998 MACH_MW998 MW998 1954
1945nokia_rx51 MACH_NOKIA_RX51 NOKIA_RX51 1955
1946vsc5605ev MACH_VSC5605EV VSC5605EV 1956
1947nt98700dk MACH_NT98700DK NT98700DK 1957
1948icontact MACH_ICONTACT ICONTACT 1958
1949swarco_frcpu MACH_SWARCO_FRCPU SWARCO_FRCPU 1959
1950swarco_scpu MACH_SWARCO_SCPU SWARCO_SCPU 1960
1951bbox_p16 MACH_BBOX_P16 BBOX_P16 1961
1952bstd MACH_BSTD BSTD 1962
1953sbc2440ii MACH_SBC2440II SBC2440II 1963
1954pcm034 MACH_PCM034 PCM034 1964
1955neso MACH_NESO NESO 1965
1956wlnx_9g20 MACH_WLNX_9G20 WLNX_9G20 1966
1957omap_zoom2 MACH_OMAP_ZOOM2 OMAP_ZOOM2 1967
1958totemnova MACH_TOTEMNOVA TOTEMNOVA 1968
1959c5000 MACH_C5000 C5000 1969
1960unipo_at91sam9263 MACH_UNIPO_AT91SAM9263 UNIPO_AT91SAM9263 1970
1961ethernut5 MACH_ETHERNUT5 ETHERNUT5 1971
1962arm11 MACH_ARM11 ARM11 1972
1963cpuat9260 MACH_CPUAT9260 CPUAT9260 1973
1964cpupxa255 MACH_CPUPXA255 CPUPXA255 1974
1965cpuimx27 MACH_CPUIMX27 CPUIMX27 1975
1966cheflux MACH_CHEFLUX CHEFLUX 1976
1967eb_cpux9k2 MACH_EB_CPUX9K2 EB_CPUX9K2 1977
1968opcotec MACH_OPCOTEC OPCOTEC 1978
1969yt MACH_YT YT 1979
1970motoq MACH_MOTOQ MOTOQ 1980
1971bsb1 MACH_BSB1 BSB1 1981
1972acs5k MACH_ACS5K ACS5K 1982
1973milan MACH_MILAN MILAN 1983
1974quartzv2 MACH_QUARTZV2 QUARTZV2 1984
1975rsvp MACH_RSVP RSVP 1985
1976rmp200 MACH_RMP200 RMP200 1986
1977snapper_9260 MACH_SNAPPER_9260 SNAPPER_9260 1987
1978dsm320 MACH_DSM320 DSM320 1988
1979adsgcm MACH_ADSGCM ADSGCM 1989
1980ase2_400 MACH_ASE2_400 ASE2_400 1990
1981pizza MACH_PIZZA PIZZA 1991
1982spot_ngpl MACH_SPOT_NGPL SPOT_NGPL 1992
1983armata MACH_ARMATA ARMATA 1993
1984exeda MACH_EXEDA EXEDA 1994
1985mx31sf005 MACH_MX31SF005 MX31SF005 1995
1986f5d8231_4_v2 MACH_F5D8231_4_V2 F5D8231_4_V2 1996
1987q2440 MACH_Q2440 Q2440 1997
1988qq2440 MACH_QQ2440 QQ2440 1998
1989mini2440 MACH_MINI2440 MINI2440 1999
1990colibri300 MACH_COLIBRI300 COLIBRI300 2000
1991jades MACH_JADES JADES 2001
1992spark MACH_SPARK SPARK 2002
1993benzina MACH_BENZINA BENZINA 2003
1994blaze MACH_BLAZE BLAZE 2004
1995linkstation_ls_hgl MACH_LINKSTATION_LS_HGL LINKSTATION_LS_HGL 2005
1996htcvenus MACH_HTCVENUS HTCVENUS 2006
diff --git a/arch/arm/vfp/vfp.h b/arch/arm/vfp/vfp.h
index c85860bad585..8de86e4feada 100644
--- a/arch/arm/vfp/vfp.h
+++ b/arch/arm/vfp/vfp.h
@@ -377,6 +377,6 @@ struct op {
377 u32 flags; 377 u32 flags;
378}; 378};
379 379
380#ifdef CONFIG_SMP 380#if defined(CONFIG_SMP) || defined(CONFIG_PM)
381extern void vfp_save_state(void *location, u32 fpexc); 381extern void vfp_save_state(void *location, u32 fpexc);
382#endif 382#endif
diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S
index a62dcf7098ba..c92a08bd6a86 100644
--- a/arch/arm/vfp/vfphw.S
+++ b/arch/arm/vfp/vfphw.S
@@ -101,9 +101,12 @@ ENTRY(vfp_support_entry)
101 VFPFSTMIA r4, r5 @ save the working registers 101 VFPFSTMIA r4, r5 @ save the working registers
102 VFPFMRX r5, FPSCR @ current status 102 VFPFMRX r5, FPSCR @ current status
103 tst r1, #FPEXC_EX @ is there additional state to save? 103 tst r1, #FPEXC_EX @ is there additional state to save?
104 VFPFMRX r6, FPINST, NE @ FPINST (only if FPEXC.EX is set) 104 beq 1f
105 tstne r1, #FPEXC_FP2V @ is there an FPINST2 to read? 105 VFPFMRX r6, FPINST @ FPINST (only if FPEXC.EX is set)
106 VFPFMRX r8, FPINST2, NE @ FPINST2 if needed (and present) 106 tst r1, #FPEXC_FP2V @ is there an FPINST2 to read?
107 beq 1f
108 VFPFMRX r8, FPINST2 @ FPINST2 if needed (and present)
1091:
107 stmia r4, {r1, r5, r6, r8} @ save FPEXC, FPSCR, FPINST, FPINST2 110 stmia r4, {r1, r5, r6, r8} @ save FPEXC, FPSCR, FPINST, FPINST2
108 @ and point r4 at the word at the 111 @ and point r4 at the word at the
109 @ start of the register dump 112 @ start of the register dump
@@ -117,9 +120,12 @@ no_old_VFP_process:
117 @ FPEXC is in a safe state 120 @ FPEXC is in a safe state
118 ldmia r10, {r1, r5, r6, r8} @ load FPEXC, FPSCR, FPINST, FPINST2 121 ldmia r10, {r1, r5, r6, r8} @ load FPEXC, FPSCR, FPINST, FPINST2
119 tst r1, #FPEXC_EX @ is there additional state to restore? 122 tst r1, #FPEXC_EX @ is there additional state to restore?
120 VFPFMXR FPINST, r6, NE @ restore FPINST (only if FPEXC.EX is set) 123 beq 1f
121 tstne r1, #FPEXC_FP2V @ is there an FPINST2 to write? 124 VFPFMXR FPINST, r6 @ restore FPINST (only if FPEXC.EX is set)
122 VFPFMXR FPINST2, r8, NE @ FPINST2 if needed (and present) 125 tst r1, #FPEXC_FP2V @ is there an FPINST2 to write?
126 beq 1f
127 VFPFMXR FPINST2, r8 @ FPINST2 if needed (and present)
1281:
123 VFPFMXR FPSCR, r5 @ restore status 129 VFPFMXR FPSCR, r5 @ restore status
124 130
125check_for_exception: 131check_for_exception:
@@ -166,7 +172,7 @@ process_exception:
166 @ retry the faulted instruction 172 @ retry the faulted instruction
167ENDPROC(vfp_support_entry) 173ENDPROC(vfp_support_entry)
168 174
169#ifdef CONFIG_SMP 175#if defined(CONFIG_SMP) || defined(CONFIG_PM)
170ENTRY(vfp_save_state) 176ENTRY(vfp_save_state)
171 @ Save the current VFP state 177 @ Save the current VFP state
172 @ r0 - save location 178 @ r0 - save location
@@ -175,9 +181,12 @@ ENTRY(vfp_save_state)
175 VFPFSTMIA r0, r2 @ save the working registers 181 VFPFSTMIA r0, r2 @ save the working registers
176 VFPFMRX r2, FPSCR @ current status 182 VFPFMRX r2, FPSCR @ current status
177 tst r1, #FPEXC_EX @ is there additional state to save? 183 tst r1, #FPEXC_EX @ is there additional state to save?
178 VFPFMRX r3, FPINST, NE @ FPINST (only if FPEXC.EX is set) 184 beq 1f
179 tstne r1, #FPEXC_FP2V @ is there an FPINST2 to read? 185 VFPFMRX r3, FPINST @ FPINST (only if FPEXC.EX is set)
180 VFPFMRX r12, FPINST2, NE @ FPINST2 if needed (and present) 186 tst r1, #FPEXC_FP2V @ is there an FPINST2 to read?
187 beq 1f
188 VFPFMRX r12, FPINST2 @ FPINST2 if needed (and present)
1891:
181 stmia r0, {r1, r2, r3, r12} @ save FPEXC, FPSCR, FPINST, FPINST2 190 stmia r0, {r1, r2, r3, r12} @ save FPEXC, FPSCR, FPINST, FPINST2
182 mov pc, lr 191 mov pc, lr
183ENDPROC(vfp_save_state) 192ENDPROC(vfp_save_state)
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index c0d2c9bb952b..9f476a1be2ca 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -322,6 +322,61 @@ static void vfp_enable(void *unused)
322 set_copro_access(access | CPACC_FULL(10) | CPACC_FULL(11)); 322 set_copro_access(access | CPACC_FULL(10) | CPACC_FULL(11));
323} 323}
324 324
325#ifdef CONFIG_PM
326#include <linux/sysdev.h>
327
328static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)
329{
330 struct thread_info *ti = current_thread_info();
331 u32 fpexc = fmrx(FPEXC);
332
333 /* if vfp is on, then save state for resumption */
334 if (fpexc & FPEXC_EN) {
335 printk(KERN_DEBUG "%s: saving vfp state\n", __func__);
336 vfp_save_state(&ti->vfpstate, fpexc);
337
338 /* disable, just in case */
339 fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
340 }
341
342 /* clear any information we had about last context state */
343 memset(last_VFP_context, 0, sizeof(last_VFP_context));
344
345 return 0;
346}
347
348static int vfp_pm_resume(struct sys_device *dev)
349{
350 /* ensure we have access to the vfp */
351 vfp_enable(NULL);
352
353 /* and disable it to ensure the next usage restores the state */
354 fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
355
356 return 0;
357}
358
359static struct sysdev_class vfp_pm_sysclass = {
360 .name = "vfp",
361 .suspend = vfp_pm_suspend,
362 .resume = vfp_pm_resume,
363};
364
365static struct sys_device vfp_pm_sysdev = {
366 .cls = &vfp_pm_sysclass,
367};
368
369static void vfp_pm_init(void)
370{
371 sysdev_class_register(&vfp_pm_sysclass);
372 sysdev_register(&vfp_pm_sysdev);
373}
374
375
376#else
377static inline void vfp_pm_init(void) { }
378#endif /* CONFIG_PM */
379
325#include <linux/smp.h> 380#include <linux/smp.h>
326 381
327/* 382/*
@@ -365,12 +420,22 @@ static int __init vfp_init(void)
365 vfp_vector = vfp_support_entry; 420 vfp_vector = vfp_support_entry;
366 421
367 thread_register_notifier(&vfp_notifier_block); 422 thread_register_notifier(&vfp_notifier_block);
423 vfp_pm_init();
368 424
369 /* 425 /*
370 * We detected VFP, and the support code is 426 * We detected VFP, and the support code is
371 * in place; report VFP support to userspace. 427 * in place; report VFP support to userspace.
372 */ 428 */
373 elf_hwcap |= HWCAP_VFP; 429 elf_hwcap |= HWCAP_VFP;
430#ifdef CONFIG_NEON
431 /*
432 * Check for the presence of the Advanced SIMD
433 * load/store instructions, integer and single
434 * precision floating point operations.
435 */
436 if ((fmrx(MVFR1) & 0x000fff00) == 0x00011100)
437 elf_hwcap |= HWCAP_NEON;
438#endif
374 } 439 }
375 return 0; 440 return 0;
376} 441}
diff --git a/arch/avr32/include/asm/atomic.h b/arch/avr32/include/asm/atomic.h
index 7ef3862a73d0..318815107748 100644
--- a/arch/avr32/include/asm/atomic.h
+++ b/arch/avr32/include/asm/atomic.h
@@ -14,9 +14,9 @@
14#ifndef __ASM_AVR32_ATOMIC_H 14#ifndef __ASM_AVR32_ATOMIC_H
15#define __ASM_AVR32_ATOMIC_H 15#define __ASM_AVR32_ATOMIC_H
16 16
17#include <linux/types.h>
17#include <asm/system.h> 18#include <asm/system.h>
18 19
19typedef struct { volatile int counter; } atomic_t;
20#define ATOMIC_INIT(i) { (i) } 20#define ATOMIC_INIT(i) { (i) }
21 21
22#define atomic_read(v) ((v)->counter) 22#define atomic_read(v) ((v)->counter)
diff --git a/arch/avr32/include/asm/bitops.h b/arch/avr32/include/asm/bitops.h
index 1a50b69b1a19..f7dd5f71edf7 100644
--- a/arch/avr32/include/asm/bitops.h
+++ b/arch/avr32/include/asm/bitops.h
@@ -263,6 +263,11 @@ static inline int fls(unsigned long word)
263 return 32 - result; 263 return 32 - result;
264} 264}
265 265
266static inline int __fls(unsigned long word)
267{
268 return fls(word) - 1;
269}
270
266unsigned long find_first_zero_bit(const unsigned long *addr, 271unsigned long find_first_zero_bit(const unsigned long *addr,
267 unsigned long size); 272 unsigned long size);
268unsigned long find_next_zero_bit(const unsigned long *addr, 273unsigned long find_next_zero_bit(const unsigned long *addr,
diff --git a/arch/avr32/kernel/init_task.c b/arch/avr32/kernel/init_task.c
index 44058469c6ec..993d56ee3cf3 100644
--- a/arch/avr32/kernel/init_task.c
+++ b/arch/avr32/kernel/init_task.c
@@ -13,7 +13,6 @@
13 13
14#include <asm/pgtable.h> 14#include <asm/pgtable.h>
15 15
16static struct fs_struct init_fs = INIT_FS;
17static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 16static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
18static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 17static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
19struct mm_struct init_mm = INIT_MM(init_mm); 18struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c
index 283481d74a5b..0ff46bf873b0 100644
--- a/arch/avr32/kernel/time.c
+++ b/arch/avr32/kernel/time.c
@@ -106,7 +106,6 @@ static struct clock_event_device comparator = {
106 .features = CLOCK_EVT_FEAT_ONESHOT, 106 .features = CLOCK_EVT_FEAT_ONESHOT,
107 .shift = 16, 107 .shift = 16,
108 .rating = 50, 108 .rating = 50,
109 .cpumask = CPU_MASK_CPU0,
110 .set_next_event = comparator_next_event, 109 .set_next_event = comparator_next_event,
111 .set_mode = comparator_mode, 110 .set_mode = comparator_mode,
112}; 111};
@@ -134,6 +133,7 @@ void __init time_init(void)
134 comparator.mult = div_sc(counter_hz, NSEC_PER_SEC, comparator.shift); 133 comparator.mult = div_sc(counter_hz, NSEC_PER_SEC, comparator.shift);
135 comparator.max_delta_ns = clockevent_delta2ns((u32)~0, &comparator); 134 comparator.max_delta_ns = clockevent_delta2ns((u32)~0, &comparator);
136 comparator.min_delta_ns = clockevent_delta2ns(50, &comparator) + 1; 135 comparator.min_delta_ns = clockevent_delta2ns(50, &comparator) + 1;
136 comparator.cpumask = cpumask_of(0);
137 137
138 sysreg_write(COMPARE, 0); 138 sysreg_write(COMPARE, 0);
139 timer_irqaction.dev_id = &comparator; 139 timer_irqaction.dev_id = &comparator;
diff --git a/arch/avr32/kernel/traps.c b/arch/avr32/kernel/traps.c
index 0d987373bc01..d547c8df157d 100644
--- a/arch/avr32/kernel/traps.c
+++ b/arch/avr32/kernel/traps.c
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9#include <linux/bug.h> 9#include <linux/bug.h>
10#include <linux/hardirq.h>
10#include <linux/init.h> 11#include <linux/init.h>
11#include <linux/kallsyms.h> 12#include <linux/kallsyms.h>
12#include <linux/kdebug.h> 13#include <linux/kdebug.h>
diff --git a/arch/avr32/mach-at32ap/clock.c b/arch/avr32/mach-at32ap/clock.c
index 138a00a2a2d0..442f08c5e641 100644
--- a/arch/avr32/mach-at32ap/clock.c
+++ b/arch/avr32/mach-at32ap/clock.c
@@ -198,7 +198,7 @@ dump_clock(struct clk *parent, struct clkinf *r)
198 unsigned i; 198 unsigned i;
199 199
200 /* skip clocks coupled to devices that aren't registered */ 200 /* skip clocks coupled to devices that aren't registered */
201 if (parent->dev && !parent->dev->bus_id[0] && !parent->users) 201 if (parent->dev && !dev_name(parent->dev) && !parent->users)
202 return; 202 return;
203 203
204 /* <nest spaces> name <pad to end> */ 204 /* <nest spaces> name <pad to end> */
@@ -214,7 +214,7 @@ dump_clock(struct clk *parent, struct clkinf *r)
214 parent->users ? "on" : "off", /* NOTE: not-paranoid!! */ 214 parent->users ? "on" : "off", /* NOTE: not-paranoid!! */
215 clk_get_rate(parent)); 215 clk_get_rate(parent));
216 if (parent->dev) 216 if (parent->dev)
217 seq_printf(r->s, ", for %s", parent->dev->bus_id); 217 seq_printf(r->s, ", for %s", dev_name(parent->dev));
218 seq_printf(r->s, "\n"); 218 seq_printf(r->s, "\n");
219 219
220 /* cost of this scan is small, but not linear... */ 220 /* cost of this scan is small, but not linear... */
diff --git a/arch/blackfin/boot/Makefile b/arch/blackfin/boot/Makefile
index 522f3c124060..e028d13481a9 100644
--- a/arch/blackfin/boot/Makefile
+++ b/arch/blackfin/boot/Makefile
@@ -25,7 +25,7 @@ $(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
25 25
26$(obj)/vmImage: $(obj)/vmlinux.gz 26$(obj)/vmImage: $(obj)/vmlinux.gz
27 $(call if_changed,uimage) 27 $(call if_changed,uimage)
28 @echo 'Kernel: $@ is ready' 28 @$(kecho) 'Kernel: $@ is ready'
29 29
30install: 30install:
31 sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" 31 sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
diff --git a/arch/blackfin/include/asm/atomic.h b/arch/blackfin/include/asm/atomic.h
index 7cf508718605..25776c19064b 100644
--- a/arch/blackfin/include/asm/atomic.h
+++ b/arch/blackfin/include/asm/atomic.h
@@ -1,6 +1,7 @@
1#ifndef __ARCH_BLACKFIN_ATOMIC__ 1#ifndef __ARCH_BLACKFIN_ATOMIC__
2#define __ARCH_BLACKFIN_ATOMIC__ 2#define __ARCH_BLACKFIN_ATOMIC__
3 3
4#include <linux/types.h>
4#include <asm/system.h> /* local_irq_XXX() */ 5#include <asm/system.h> /* local_irq_XXX() */
5 6
6/* 7/*
@@ -13,9 +14,6 @@
13 * Tony Kou (tonyko@lineo.ca) Lineo Inc. 2001 14 * Tony Kou (tonyko@lineo.ca) Lineo Inc. 2001
14 */ 15 */
15 16
16typedef struct {
17 int counter;
18} atomic_t;
19#define ATOMIC_INIT(i) { (i) } 17#define ATOMIC_INIT(i) { (i) }
20 18
21#define atomic_read(v) ((v)->counter) 19#define atomic_read(v) ((v)->counter)
diff --git a/arch/blackfin/include/asm/bitops.h b/arch/blackfin/include/asm/bitops.h
index b39a175c79c1..c428e4106f89 100644
--- a/arch/blackfin/include/asm/bitops.h
+++ b/arch/blackfin/include/asm/bitops.h
@@ -213,6 +213,7 @@ static __inline__ int __test_bit(int nr, const void *addr)
213#endif /* __KERNEL__ */ 213#endif /* __KERNEL__ */
214 214
215#include <asm-generic/bitops/fls.h> 215#include <asm-generic/bitops/fls.h>
216#include <asm-generic/bitops/__fls.h>
216#include <asm-generic/bitops/fls64.h> 217#include <asm-generic/bitops/fls64.h>
217 218
218#endif /* _BLACKFIN_BITOPS_H */ 219#endif /* _BLACKFIN_BITOPS_H */
diff --git a/arch/blackfin/kernel/init_task.c b/arch/blackfin/kernel/init_task.c
index 6bdba7b21109..2c228c020978 100644
--- a/arch/blackfin/kernel/init_task.c
+++ b/arch/blackfin/kernel/init_task.c
@@ -33,7 +33,6 @@
33#include <linux/mqueue.h> 33#include <linux/mqueue.h>
34#include <linux/fs.h> 34#include <linux/fs.h>
35 35
36static struct fs_struct init_fs = INIT_FS;
37static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 36static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
38static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 37static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
39 38
diff --git a/arch/blackfin/kernel/time-ts.c b/arch/blackfin/kernel/time-ts.c
index e887efc86c29..0ed2badfd746 100644
--- a/arch/blackfin/kernel/time-ts.c
+++ b/arch/blackfin/kernel/time-ts.c
@@ -162,7 +162,6 @@ static struct clock_event_device clockevent_bfin = {
162 .name = "bfin_core_timer", 162 .name = "bfin_core_timer",
163 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 163 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
164 .shift = 32, 164 .shift = 32,
165 .cpumask = CPU_MASK_CPU0,
166 .set_next_event = bfin_timer_set_next_event, 165 .set_next_event = bfin_timer_set_next_event,
167 .set_mode = bfin_timer_set_mode, 166 .set_mode = bfin_timer_set_mode,
168}; 167};
@@ -193,6 +192,7 @@ static int __init bfin_clockevent_init(void)
193 clockevent_bfin.mult = div_sc(timer_clk, NSEC_PER_SEC, clockevent_bfin.shift); 192 clockevent_bfin.mult = div_sc(timer_clk, NSEC_PER_SEC, clockevent_bfin.shift);
194 clockevent_bfin.max_delta_ns = clockevent_delta2ns(-1, &clockevent_bfin); 193 clockevent_bfin.max_delta_ns = clockevent_delta2ns(-1, &clockevent_bfin);
195 clockevent_bfin.min_delta_ns = clockevent_delta2ns(100, &clockevent_bfin); 194 clockevent_bfin.min_delta_ns = clockevent_delta2ns(100, &clockevent_bfin);
195 clockevent_bfin.cpumask = cpumask_of(0);
196 clockevents_register_device(&clockevent_bfin); 196 clockevents_register_device(&clockevent_bfin);
197 197
198 return 0; 198 return 0;
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index b17aeea8d620..3462245fe9fb 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -681,6 +681,8 @@ source "drivers/usb/Kconfig"
681 681
682source "drivers/uwb/Kconfig" 682source "drivers/uwb/Kconfig"
683 683
684source "drivers/staging/Kconfig"
685
684source "arch/cris/Kconfig.debug" 686source "arch/cris/Kconfig.debug"
685 687
686source "security/Kconfig" 688source "security/Kconfig"
diff --git a/arch/cris/arch-v32/drivers/iop_fw_load.c b/arch/cris/arch-v32/drivers/iop_fw_load.c
index 3b3857ec1f15..2f8ea0f7a63c 100644
--- a/arch/cris/arch-v32/drivers/iop_fw_load.c
+++ b/arch/cris/arch-v32/drivers/iop_fw_load.c
@@ -24,12 +24,12 @@
24#error "Please contact <greg@kroah.com> for details on how to fix it properly." 24#error "Please contact <greg@kroah.com> for details on how to fix it properly."
25 25
26static struct device iop_spu_device[2] = { 26static struct device iop_spu_device[2] = {
27 { .bus_id = "iop-spu0", }, 27 { .init_name = "iop-spu0", },
28 { .bus_id = "iop-spu1", }, 28 { .init_name = "iop-spu1", },
29}; 29};
30 30
31static struct device iop_mpu_device = { 31static struct device iop_mpu_device = {
32 .bus_id = "iop-mpu", 32 .init_name = "iop-mpu",
33}; 33};
34 34
35static int wait_mpu_idle(void) 35static int wait_mpu_idle(void)
diff --git a/arch/cris/arch-v32/kernel/irq.c b/arch/cris/arch-v32/kernel/irq.c
index 173c141ac9ba..295131fee710 100644
--- a/arch/cris/arch-v32/kernel/irq.c
+++ b/arch/cris/arch-v32/kernel/irq.c
@@ -325,11 +325,11 @@ static void end_crisv32_irq(unsigned int irq)
325{ 325{
326} 326}
327 327
328void set_affinity_crisv32_irq(unsigned int irq, cpumask_t dest) 328void set_affinity_crisv32_irq(unsigned int irq, const struct cpumask *dest)
329{ 329{
330 unsigned long flags; 330 unsigned long flags;
331 spin_lock_irqsave(&irq_lock, flags); 331 spin_lock_irqsave(&irq_lock, flags);
332 irq_allocations[irq - FIRST_IRQ].mask = dest; 332 irq_allocations[irq - FIRST_IRQ].mask = *dest;
333 spin_unlock_irqrestore(&irq_lock, flags); 333 spin_unlock_irqrestore(&irq_lock, flags);
334} 334}
335 335
diff --git a/arch/cris/arch-v32/kernel/smp.c b/arch/cris/arch-v32/kernel/smp.c
index 52e16c6436f9..9dac17334640 100644
--- a/arch/cris/arch-v32/kernel/smp.c
+++ b/arch/cris/arch-v32/kernel/smp.c
@@ -29,11 +29,7 @@
29spinlock_t cris_atomic_locks[] = { [0 ... LOCK_COUNT - 1] = SPIN_LOCK_UNLOCKED}; 29spinlock_t cris_atomic_locks[] = { [0 ... LOCK_COUNT - 1] = SPIN_LOCK_UNLOCKED};
30 30
31/* CPU masks */ 31/* CPU masks */
32cpumask_t cpu_online_map = CPU_MASK_NONE;
33EXPORT_SYMBOL(cpu_online_map);
34cpumask_t phys_cpu_present_map = CPU_MASK_NONE; 32cpumask_t phys_cpu_present_map = CPU_MASK_NONE;
35cpumask_t cpu_possible_map;
36EXPORT_SYMBOL(cpu_possible_map);
37EXPORT_SYMBOL(phys_cpu_present_map); 33EXPORT_SYMBOL(phys_cpu_present_map);
38 34
39/* Variables used during SMP boot */ 35/* Variables used during SMP boot */
diff --git a/arch/cris/include/asm/atomic.h b/arch/cris/include/asm/atomic.h
index f71ea686a2ea..5718dd8902a1 100644
--- a/arch/cris/include/asm/atomic.h
+++ b/arch/cris/include/asm/atomic.h
@@ -4,7 +4,7 @@
4#define __ASM_CRIS_ATOMIC__ 4#define __ASM_CRIS_ATOMIC__
5 5
6#include <linux/compiler.h> 6#include <linux/compiler.h>
7 7#include <linux/types.h>
8#include <asm/system.h> 8#include <asm/system.h>
9#include <arch/atomic.h> 9#include <arch/atomic.h>
10 10
@@ -13,8 +13,6 @@
13 * resource counting etc.. 13 * resource counting etc..
14 */ 14 */
15 15
16typedef struct { volatile int counter; } atomic_t;
17
18#define ATOMIC_INIT(i) { (i) } 16#define ATOMIC_INIT(i) { (i) }
19 17
20#define atomic_read(v) ((v)->counter) 18#define atomic_read(v) ((v)->counter)
diff --git a/arch/cris/include/asm/bitops.h b/arch/cris/include/asm/bitops.h
index c0e62f811e09..9e69cfb7f134 100644
--- a/arch/cris/include/asm/bitops.h
+++ b/arch/cris/include/asm/bitops.h
@@ -148,6 +148,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
148#define ffs kernel_ffs 148#define ffs kernel_ffs
149 149
150#include <asm-generic/bitops/fls.h> 150#include <asm-generic/bitops/fls.h>
151#include <asm-generic/bitops/__fls.h>
151#include <asm-generic/bitops/fls64.h> 152#include <asm-generic/bitops/fls64.h>
152#include <asm-generic/bitops/hweight.h> 153#include <asm-generic/bitops/hweight.h>
153#include <asm-generic/bitops/find.h> 154#include <asm-generic/bitops/find.h>
diff --git a/arch/cris/include/asm/smp.h b/arch/cris/include/asm/smp.h
index dba33aba3e95..c615a06dd757 100644
--- a/arch/cris/include/asm/smp.h
+++ b/arch/cris/include/asm/smp.h
@@ -4,7 +4,6 @@
4#include <linux/cpumask.h> 4#include <linux/cpumask.h>
5 5
6extern cpumask_t phys_cpu_present_map; 6extern cpumask_t phys_cpu_present_map;
7extern cpumask_t cpu_possible_map;
8 7
9#define raw_smp_processor_id() (current_thread_info()->cpu) 8#define raw_smp_processor_id() (current_thread_info()->cpu)
10 9
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index 5933656db5a2..60816e876455 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -37,7 +37,6 @@
37 * setup. 37 * setup.
38 */ 38 */
39 39
40static struct fs_struct init_fs = INIT_FS;
41static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 40static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
42static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 41static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
43struct mm_struct init_mm = INIT_MM(init_mm); 42struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/frv/kernel/init_task.c b/arch/frv/kernel/init_task.c
index e2198815b630..29429a8b7f6a 100644
--- a/arch/frv/kernel/init_task.c
+++ b/arch/frv/kernel/init_task.c
@@ -10,7 +10,6 @@
10#include <asm/pgtable.h> 10#include <asm/pgtable.h>
11 11
12 12
13static struct fs_struct init_fs = INIT_FS;
14static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 13static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
15static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 14static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
16struct mm_struct init_mm = INIT_MM(init_mm); 15struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 28f06fd9b7b7..9420648352b8 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -220,6 +220,8 @@ source "drivers/uwb/Kconfig"
220 220
221endmenu 221endmenu
222 222
223source "drivers/staging/Kconfig"
224
223source "fs/Kconfig" 225source "fs/Kconfig"
224 226
225source "arch/h8300/Kconfig.debug" 227source "arch/h8300/Kconfig.debug"
diff --git a/arch/h8300/include/asm/atomic.h b/arch/h8300/include/asm/atomic.h
index b4cf0ea97ede..833186c8dc3b 100644
--- a/arch/h8300/include/asm/atomic.h
+++ b/arch/h8300/include/asm/atomic.h
@@ -1,12 +1,13 @@
1#ifndef __ARCH_H8300_ATOMIC__ 1#ifndef __ARCH_H8300_ATOMIC__
2#define __ARCH_H8300_ATOMIC__ 2#define __ARCH_H8300_ATOMIC__
3 3
4#include <linux/types.h>
5
4/* 6/*
5 * Atomic operations that C can't guarantee us. Useful for 7 * Atomic operations that C can't guarantee us. Useful for
6 * resource counting etc.. 8 * resource counting etc..
7 */ 9 */
8 10
9typedef struct { int counter; } atomic_t;
10#define ATOMIC_INIT(i) { (i) } 11#define ATOMIC_INIT(i) { (i) }
11 12
12#define atomic_read(v) ((v)->counter) 13#define atomic_read(v) ((v)->counter)
diff --git a/arch/h8300/include/asm/bitops.h b/arch/h8300/include/asm/bitops.h
index cb18e3b0aa94..cb9ddf5fc54f 100644
--- a/arch/h8300/include/asm/bitops.h
+++ b/arch/h8300/include/asm/bitops.h
@@ -207,6 +207,7 @@ static __inline__ unsigned long __ffs(unsigned long word)
207#endif /* __KERNEL__ */ 207#endif /* __KERNEL__ */
208 208
209#include <asm-generic/bitops/fls.h> 209#include <asm-generic/bitops/fls.h>
210#include <asm-generic/bitops/__fls.h>
210#include <asm-generic/bitops/fls64.h> 211#include <asm-generic/bitops/fls64.h>
211 212
212#endif /* _H8300_BITOPS_H */ 213#endif /* _H8300_BITOPS_H */
diff --git a/arch/h8300/kernel/init_task.c b/arch/h8300/kernel/init_task.c
index 93a4899e46c2..cb5dc552da97 100644
--- a/arch/h8300/kernel/init_task.c
+++ b/arch/h8300/kernel/init_task.c
@@ -12,7 +12,6 @@
12#include <asm/uaccess.h> 12#include <asm/uaccess.h>
13#include <asm/pgtable.h> 13#include <asm/pgtable.h>
14 14
15static struct fs_struct init_fs = INIT_FS;
16static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 15static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
17static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
18struct mm_struct init_mm = INIT_MM(init_mm); 17struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 6bd91ed7cd03..3d31636cbafb 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -99,7 +99,7 @@ config GENERIC_IOMAP
99 bool 99 bool
100 default y 100 default y
101 101
102config SCHED_NO_NO_OMIT_FRAME_POINTER 102config SCHED_OMIT_FRAME_POINTER
103 bool 103 bool
104 default y 104 default y
105 105
@@ -687,3 +687,6 @@ config IRQ_PER_CPU
687 687
688config IOMMU_HELPER 688config IOMMU_HELPER
689 def_bool (IA64_HP_ZX1 || IA64_HP_ZX1_SWIOTLB || IA64_GENERIC || SWIOTLB) 689 def_bool (IA64_HP_ZX1 || IA64_HP_ZX1_SWIOTLB || IA64_GENERIC || SWIOTLB)
690
691config IOMMU_API
692 def_bool (DMAR)
diff --git a/arch/ia64/hp/sim/hpsim_irq.c b/arch/ia64/hp/sim/hpsim_irq.c
index c2f58ff364e7..cc0a3182db3c 100644
--- a/arch/ia64/hp/sim/hpsim_irq.c
+++ b/arch/ia64/hp/sim/hpsim_irq.c
@@ -22,7 +22,7 @@ hpsim_irq_noop (unsigned int irq)
22} 22}
23 23
24static void 24static void
25hpsim_set_affinity_noop (unsigned int a, cpumask_t b) 25hpsim_set_affinity_noop(unsigned int a, const struct cpumask *b)
26{ 26{
27} 27}
28 28
diff --git a/arch/ia64/hp/sim/simeth.c b/arch/ia64/hp/sim/simeth.c
index 3d47839a0c48..e4d8fde68103 100644
--- a/arch/ia64/hp/sim/simeth.c
+++ b/arch/ia64/hp/sim/simeth.c
@@ -167,6 +167,15 @@ netdev_read(int fd, unsigned char *buf, unsigned int len)
167 return ia64_ssc(fd, __pa(buf), len, 0, SSC_NETDEV_RECV); 167 return ia64_ssc(fd, __pa(buf), len, 0, SSC_NETDEV_RECV);
168} 168}
169 169
170static const struct net_device_ops simeth_netdev_ops = {
171 .ndo_open = simeth_open,
172 .ndo_stop = simeth_close,
173 .ndo_start_xmit = simeth_tx,
174 .ndo_get_stats = simeth_get_stats,
175 .ndo_set_multicast_list = set_multicast_list, /* not yet used */
176
177};
178
170/* 179/*
171 * Function shared with module code, so cannot be in init section 180 * Function shared with module code, so cannot be in init section
172 * 181 *
@@ -206,14 +215,10 @@ simeth_probe1(void)
206 215
207 memcpy(dev->dev_addr, mac_addr, sizeof(mac_addr)); 216 memcpy(dev->dev_addr, mac_addr, sizeof(mac_addr));
208 217
209 local = dev->priv; 218 local = netdev_priv(dev);
210 local->simfd = fd; /* keep track of underlying file descriptor */ 219 local->simfd = fd; /* keep track of underlying file descriptor */
211 220
212 dev->open = simeth_open; 221 dev->netdev_ops = &simeth_netdev_ops;
213 dev->stop = simeth_close;
214 dev->hard_start_xmit = simeth_tx;
215 dev->get_stats = simeth_get_stats;
216 dev->set_multicast_list = set_multicast_list; /* no yet used */
217 222
218 err = register_netdev(dev); 223 err = register_netdev(dev);
219 if (err) { 224 if (err) {
@@ -325,7 +330,7 @@ simeth_device_event(struct notifier_block *this,unsigned long event, void *ptr)
325 * we get DOWN then UP. 330 * we get DOWN then UP.
326 */ 331 */
327 332
328 local = dev->priv; 333 local = netdev_priv(dev);
329 /* now do it for real */ 334 /* now do it for real */
330 r = event == NETDEV_UP ? 335 r = event == NETDEV_UP ?
331 netdev_attach(local->simfd, dev->irq, ntohl(ifa->ifa_local)): 336 netdev_attach(local->simfd, dev->irq, ntohl(ifa->ifa_local)):
@@ -380,7 +385,7 @@ frame_print(unsigned char *from, unsigned char *frame, int len)
380static int 385static int
381simeth_tx(struct sk_buff *skb, struct net_device *dev) 386simeth_tx(struct sk_buff *skb, struct net_device *dev)
382{ 387{
383 struct simeth_local *local = dev->priv; 388 struct simeth_local *local = netdev_priv(dev);
384 389
385#if 0 390#if 0
386 /* ensure we have at least ETH_ZLEN bytes (min frame size) */ 391 /* ensure we have at least ETH_ZLEN bytes (min frame size) */
@@ -443,7 +448,7 @@ simeth_rx(struct net_device *dev)
443 int len; 448 int len;
444 int rcv_count = SIMETH_RECV_MAX; 449 int rcv_count = SIMETH_RECV_MAX;
445 450
446 local = dev->priv; 451 local = netdev_priv(dev);
447 /* 452 /*
448 * the loop concept has been borrowed from other drivers 453 * the loop concept has been borrowed from other drivers
449 * looks to me like it's a throttling thing to avoid pushing to many 454 * looks to me like it's a throttling thing to avoid pushing to many
@@ -507,7 +512,7 @@ simeth_interrupt(int irq, void *dev_id)
507static struct net_device_stats * 512static struct net_device_stats *
508simeth_get_stats(struct net_device *dev) 513simeth_get_stats(struct net_device *dev)
509{ 514{
510 struct simeth_local *local = dev->priv; 515 struct simeth_local *local = netdev_priv(dev);
511 516
512 return &local->stats; 517 return &local->stats;
513} 518}
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index 5e92ae00bdbb..16ef61a91d95 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -1767,25 +1767,24 @@ groups16_from_user(struct group_info *group_info, short __user *grouplist)
1767asmlinkage long 1767asmlinkage long
1768sys32_getgroups16 (int gidsetsize, short __user *grouplist) 1768sys32_getgroups16 (int gidsetsize, short __user *grouplist)
1769{ 1769{
1770 const struct cred *cred = current_cred();
1770 int i; 1771 int i;
1771 1772
1772 if (gidsetsize < 0) 1773 if (gidsetsize < 0)
1773 return -EINVAL; 1774 return -EINVAL;
1774 1775
1775 get_group_info(current->group_info); 1776 i = cred->group_info->ngroups;
1776 i = current->group_info->ngroups;
1777 if (gidsetsize) { 1777 if (gidsetsize) {
1778 if (i > gidsetsize) { 1778 if (i > gidsetsize) {
1779 i = -EINVAL; 1779 i = -EINVAL;
1780 goto out; 1780 goto out;
1781 } 1781 }
1782 if (groups16_to_user(grouplist, current->group_info)) { 1782 if (groups16_to_user(grouplist, cred->group_info)) {
1783 i = -EFAULT; 1783 i = -EFAULT;
1784 goto out; 1784 goto out;
1785 } 1785 }
1786 } 1786 }
1787out: 1787out:
1788 put_group_info(current->group_info);
1789 return i; 1788 return i;
1790} 1789}
1791 1790
diff --git a/arch/ia64/include/asm/atomic.h b/arch/ia64/include/asm/atomic.h
index 50c2b83fd5a0..d37292bd9875 100644
--- a/arch/ia64/include/asm/atomic.h
+++ b/arch/ia64/include/asm/atomic.h
@@ -17,12 +17,6 @@
17#include <asm/intrinsics.h> 17#include <asm/intrinsics.h>
18#include <asm/system.h> 18#include <asm/system.h>
19 19
20/*
21 * On IA-64, counter must always be volatile to ensure that that the
22 * memory accesses are ordered.
23 */
24typedef struct { volatile __s32 counter; } atomic_t;
25typedef struct { volatile __s64 counter; } atomic64_t;
26 20
27#define ATOMIC_INIT(i) ((atomic_t) { (i) }) 21#define ATOMIC_INIT(i) ((atomic_t) { (i) })
28#define ATOMIC64_INIT(i) ((atomic64_t) { (i) }) 22#define ATOMIC64_INIT(i) ((atomic64_t) { (i) })
diff --git a/arch/ia64/include/asm/irq.h b/arch/ia64/include/asm/irq.h
index 3627116fb0e2..36429a532630 100644
--- a/arch/ia64/include/asm/irq.h
+++ b/arch/ia64/include/asm/irq.h
@@ -27,7 +27,7 @@ irq_canonicalize (int irq)
27} 27}
28 28
29extern void set_irq_affinity_info (unsigned int irq, int dest, int redir); 29extern void set_irq_affinity_info (unsigned int irq, int dest, int redir);
30bool is_affinity_mask_valid(cpumask_t cpumask); 30bool is_affinity_mask_valid(cpumask_var_t cpumask);
31 31
32#define is_affinity_mask_valid is_affinity_mask_valid 32#define is_affinity_mask_valid is_affinity_mask_valid
33 33
diff --git a/arch/ia64/include/asm/kvm.h b/arch/ia64/include/asm/kvm.h
index f38472ac2267..68aa6da807c1 100644
--- a/arch/ia64/include/asm/kvm.h
+++ b/arch/ia64/include/asm/kvm.h
@@ -166,8 +166,6 @@ struct saved_vpd {
166}; 166};
167 167
168struct kvm_regs { 168struct kvm_regs {
169 char *saved_guest;
170 char *saved_stack;
171 struct saved_vpd vpd; 169 struct saved_vpd vpd;
172 /*Arch-regs*/ 170 /*Arch-regs*/
173 int mp_state; 171 int mp_state;
@@ -200,6 +198,10 @@ struct kvm_regs {
200 unsigned long fp_psr; /*used for lazy float register */ 198 unsigned long fp_psr; /*used for lazy float register */
201 unsigned long saved_gp; 199 unsigned long saved_gp;
202 /*for phycial emulation */ 200 /*for phycial emulation */
201
202 union context saved_guest;
203
204 unsigned long reserved[64]; /* for future use */
203}; 205};
204 206
205struct kvm_sregs { 207struct kvm_sregs {
diff --git a/arch/ia64/include/asm/kvm_host.h b/arch/ia64/include/asm/kvm_host.h
index c60d324da540..348663661659 100644
--- a/arch/ia64/include/asm/kvm_host.h
+++ b/arch/ia64/include/asm/kvm_host.h
@@ -23,17 +23,6 @@
23#ifndef __ASM_KVM_HOST_H 23#ifndef __ASM_KVM_HOST_H
24#define __ASM_KVM_HOST_H 24#define __ASM_KVM_HOST_H
25 25
26
27#include <linux/types.h>
28#include <linux/mm.h>
29#include <linux/kvm.h>
30#include <linux/kvm_para.h>
31#include <linux/kvm_types.h>
32
33#include <asm/pal.h>
34#include <asm/sal.h>
35
36#define KVM_MAX_VCPUS 4
37#define KVM_MEMORY_SLOTS 32 26#define KVM_MEMORY_SLOTS 32
38/* memory slots that does not exposed to userspace */ 27/* memory slots that does not exposed to userspace */
39#define KVM_PRIVATE_MEM_SLOTS 4 28#define KVM_PRIVATE_MEM_SLOTS 4
@@ -50,70 +39,132 @@
50#define EXIT_REASON_EXTERNAL_INTERRUPT 6 39#define EXIT_REASON_EXTERNAL_INTERRUPT 6
51#define EXIT_REASON_IPI 7 40#define EXIT_REASON_IPI 7
52#define EXIT_REASON_PTC_G 8 41#define EXIT_REASON_PTC_G 8
42#define EXIT_REASON_DEBUG 20
53 43
54/*Define vmm address space and vm data space.*/ 44/*Define vmm address space and vm data space.*/
55#define KVM_VMM_SIZE (16UL<<20) 45#define KVM_VMM_SIZE (__IA64_UL_CONST(16)<<20)
56#define KVM_VMM_SHIFT 24 46#define KVM_VMM_SHIFT 24
57#define KVM_VMM_BASE 0xD000000000000000UL 47#define KVM_VMM_BASE 0xD000000000000000
58#define VMM_SIZE (8UL<<20) 48#define VMM_SIZE (__IA64_UL_CONST(8)<<20)
59 49
60/* 50/*
61 * Define vm_buffer, used by PAL Services, base address. 51 * Define vm_buffer, used by PAL Services, base address.
62 * Note: vmbuffer is in the VMM-BLOCK, the size must be < 8M 52 * Note: vm_buffer is in the VMM-BLOCK, the size must be < 8M
63 */ 53 */
64#define KVM_VM_BUFFER_BASE (KVM_VMM_BASE + VMM_SIZE) 54#define KVM_VM_BUFFER_BASE (KVM_VMM_BASE + VMM_SIZE)
65#define KVM_VM_BUFFER_SIZE (8UL<<20) 55#define KVM_VM_BUFFER_SIZE (__IA64_UL_CONST(8)<<20)
66 56
67/*Define Virtual machine data layout.*/ 57/*
68#define KVM_VM_DATA_SHIFT 24 58 * kvm guest's data area looks as follow:
69#define KVM_VM_DATA_SIZE (1UL << KVM_VM_DATA_SHIFT) 59 *
70#define KVM_VM_DATA_BASE (KVM_VMM_BASE + KVM_VMM_SIZE) 60 * +----------------------+ ------- KVM_VM_DATA_SIZE
71 61 * | vcpu[n]'s data | | ___________________KVM_STK_OFFSET
72 62 * | | | / |
73#define KVM_P2M_BASE KVM_VM_DATA_BASE 63 * | .......... | | /vcpu's struct&stack |
74#define KVM_P2M_OFS 0 64 * | .......... | | /---------------------|---- 0
75#define KVM_P2M_SIZE (8UL << 20) 65 * | vcpu[5]'s data | | / vpd |
76 66 * | vcpu[4]'s data | |/-----------------------|
77#define KVM_VHPT_BASE (KVM_P2M_BASE + KVM_P2M_SIZE) 67 * | vcpu[3]'s data | / vtlb |
78#define KVM_VHPT_OFS KVM_P2M_SIZE 68 * | vcpu[2]'s data | /|------------------------|
79#define KVM_VHPT_BLOCK_SIZE (2UL << 20) 69 * | vcpu[1]'s data |/ | vhpt |
80#define VHPT_SHIFT 18 70 * | vcpu[0]'s data |____________________________|
81#define VHPT_SIZE (1UL << VHPT_SHIFT) 71 * +----------------------+ |
82#define VHPT_NUM_ENTRIES (1<<(VHPT_SHIFT-5)) 72 * | memory dirty log | |
83 73 * +----------------------+ |
84#define KVM_VTLB_BASE (KVM_VHPT_BASE+KVM_VHPT_BLOCK_SIZE) 74 * | vm's data struct | |
85#define KVM_VTLB_OFS (KVM_VHPT_OFS+KVM_VHPT_BLOCK_SIZE) 75 * +----------------------+ |
86#define KVM_VTLB_BLOCK_SIZE (1UL<<20) 76 * | | |
87#define VTLB_SHIFT 17 77 * | | |
88#define VTLB_SIZE (1UL<<VTLB_SHIFT) 78 * | | |
89#define VTLB_NUM_ENTRIES (1<<(VTLB_SHIFT-5)) 79 * | | |
90 80 * | | |
91#define KVM_VPD_BASE (KVM_VTLB_BASE+KVM_VTLB_BLOCK_SIZE) 81 * | | |
92#define KVM_VPD_OFS (KVM_VTLB_OFS+KVM_VTLB_BLOCK_SIZE) 82 * | | |
93#define KVM_VPD_BLOCK_SIZE (2UL<<20) 83 * | vm's p2m table | |
94#define VPD_SHIFT 16 84 * | | |
95#define VPD_SIZE (1UL<<VPD_SHIFT) 85 * | | |
96 86 * | | | |
97#define KVM_VCPU_BASE (KVM_VPD_BASE+KVM_VPD_BLOCK_SIZE) 87 * vm's data->| | | |
98#define KVM_VCPU_OFS (KVM_VPD_OFS+KVM_VPD_BLOCK_SIZE) 88 * +----------------------+ ------- 0
99#define KVM_VCPU_BLOCK_SIZE (2UL<<20) 89 * To support large memory, needs to increase the size of p2m.
100#define VCPU_SHIFT 18 90 * To support more vcpus, needs to ensure it has enough space to
101#define VCPU_SIZE (1UL<<VCPU_SHIFT) 91 * hold vcpus' data.
102#define MAX_VCPU_NUM KVM_VCPU_BLOCK_SIZE/VCPU_SIZE 92 */
103 93
104#define KVM_VM_BASE (KVM_VCPU_BASE+KVM_VCPU_BLOCK_SIZE) 94#define KVM_VM_DATA_SHIFT 26
105#define KVM_VM_OFS (KVM_VCPU_OFS+KVM_VCPU_BLOCK_SIZE) 95#define KVM_VM_DATA_SIZE (__IA64_UL_CONST(1) << KVM_VM_DATA_SHIFT)
106#define KVM_VM_BLOCK_SIZE (1UL<<19) 96#define KVM_VM_DATA_BASE (KVM_VMM_BASE + KVM_VM_DATA_SIZE)
107 97
108#define KVM_MEM_DIRTY_LOG_BASE (KVM_VM_BASE+KVM_VM_BLOCK_SIZE) 98#define KVM_P2M_BASE KVM_VM_DATA_BASE
109#define KVM_MEM_DIRTY_LOG_OFS (KVM_VM_OFS+KVM_VM_BLOCK_SIZE) 99#define KVM_P2M_SIZE (__IA64_UL_CONST(24) << 20)
110#define KVM_MEM_DIRTY_LOG_SIZE (1UL<<19) 100
111 101#define VHPT_SHIFT 16
112/* Get vpd, vhpt, tlb, vcpu, base*/ 102#define VHPT_SIZE (__IA64_UL_CONST(1) << VHPT_SHIFT)
113#define VPD_ADDR(n) (KVM_VPD_BASE+n*VPD_SIZE) 103#define VHPT_NUM_ENTRIES (__IA64_UL_CONST(1) << (VHPT_SHIFT-5))
114#define VHPT_ADDR(n) (KVM_VHPT_BASE+n*VHPT_SIZE) 104
115#define VTLB_ADDR(n) (KVM_VTLB_BASE+n*VTLB_SIZE) 105#define VTLB_SHIFT 16
116#define VCPU_ADDR(n) (KVM_VCPU_BASE+n*VCPU_SIZE) 106#define VTLB_SIZE (__IA64_UL_CONST(1) << VTLB_SHIFT)
107#define VTLB_NUM_ENTRIES (1UL << (VHPT_SHIFT-5))
108
109#define VPD_SHIFT 16
110#define VPD_SIZE (__IA64_UL_CONST(1) << VPD_SHIFT)
111
112#define VCPU_STRUCT_SHIFT 16
113#define VCPU_STRUCT_SIZE (__IA64_UL_CONST(1) << VCPU_STRUCT_SHIFT)
114
115#define KVM_STK_OFFSET VCPU_STRUCT_SIZE
116
117#define KVM_VM_STRUCT_SHIFT 19
118#define KVM_VM_STRUCT_SIZE (__IA64_UL_CONST(1) << KVM_VM_STRUCT_SHIFT)
119
120#define KVM_MEM_DIRY_LOG_SHIFT 19
121#define KVM_MEM_DIRTY_LOG_SIZE (__IA64_UL_CONST(1) << KVM_MEM_DIRY_LOG_SHIFT)
122
123#ifndef __ASSEMBLY__
124
125/*Define the max vcpus and memory for Guests.*/
126#define KVM_MAX_VCPUS (KVM_VM_DATA_SIZE - KVM_P2M_SIZE - KVM_VM_STRUCT_SIZE -\
127 KVM_MEM_DIRTY_LOG_SIZE) / sizeof(struct kvm_vcpu_data)
128#define KVM_MAX_MEM_SIZE (KVM_P2M_SIZE >> 3 << PAGE_SHIFT)
129
130#define VMM_LOG_LEN 256
131
132#include <linux/types.h>
133#include <linux/mm.h>
134#include <linux/kvm.h>
135#include <linux/kvm_para.h>
136#include <linux/kvm_types.h>
137
138#include <asm/pal.h>
139#include <asm/sal.h>
140#include <asm/page.h>
141
142struct kvm_vcpu_data {
143 char vcpu_vhpt[VHPT_SIZE];
144 char vcpu_vtlb[VTLB_SIZE];
145 char vcpu_vpd[VPD_SIZE];
146 char vcpu_struct[VCPU_STRUCT_SIZE];
147};
148
149struct kvm_vm_data {
150 char kvm_p2m[KVM_P2M_SIZE];
151 char kvm_vm_struct[KVM_VM_STRUCT_SIZE];
152 char kvm_mem_dirty_log[KVM_MEM_DIRTY_LOG_SIZE];
153 struct kvm_vcpu_data vcpu_data[KVM_MAX_VCPUS];
154};
155
156#define VCPU_BASE(n) KVM_VM_DATA_BASE + \
157 offsetof(struct kvm_vm_data, vcpu_data[n])
158#define VM_BASE KVM_VM_DATA_BASE + \
159 offsetof(struct kvm_vm_data, kvm_vm_struct)
160#define KVM_MEM_DIRTY_LOG_BASE KVM_VM_DATA_BASE + \
161 offsetof(struct kvm_vm_data, kvm_mem_dirty_log)
162
163#define VHPT_BASE(n) (VCPU_BASE(n) + offsetof(struct kvm_vcpu_data, vcpu_vhpt))
164#define VTLB_BASE(n) (VCPU_BASE(n) + offsetof(struct kvm_vcpu_data, vcpu_vtlb))
165#define VPD_BASE(n) (VCPU_BASE(n) + offsetof(struct kvm_vcpu_data, vcpu_vpd))
166#define VCPU_STRUCT_BASE(n) (VCPU_BASE(n) + \
167 offsetof(struct kvm_vcpu_data, vcpu_struct))
117 168
118/*IO section definitions*/ 169/*IO section definitions*/
119#define IOREQ_READ 1 170#define IOREQ_READ 1
@@ -389,6 +440,7 @@ struct kvm_vcpu_arch {
389 440
390 unsigned long opcode; 441 unsigned long opcode;
391 unsigned long cause; 442 unsigned long cause;
443 char log_buf[VMM_LOG_LEN];
392 union context host; 444 union context host;
393 union context guest; 445 union context guest;
394}; 446};
@@ -403,20 +455,19 @@ struct kvm_sal_data {
403}; 455};
404 456
405struct kvm_arch { 457struct kvm_arch {
458 spinlock_t dirty_log_lock;
459
406 unsigned long vm_base; 460 unsigned long vm_base;
407 unsigned long metaphysical_rr0; 461 unsigned long metaphysical_rr0;
408 unsigned long metaphysical_rr4; 462 unsigned long metaphysical_rr4;
409 unsigned long vmm_init_rr; 463 unsigned long vmm_init_rr;
410 unsigned long vhpt_base; 464
411 unsigned long vtlb_base;
412 unsigned long vpd_base;
413 spinlock_t dirty_log_lock;
414 struct kvm_ioapic *vioapic; 465 struct kvm_ioapic *vioapic;
415 struct kvm_vm_stat stat; 466 struct kvm_vm_stat stat;
416 struct kvm_sal_data rdv_sal_data; 467 struct kvm_sal_data rdv_sal_data;
417 468
418 struct list_head assigned_dev_head; 469 struct list_head assigned_dev_head;
419 struct dmar_domain *intel_iommu_domain; 470 struct iommu_domain *iommu_domain;
420 struct hlist_head irq_ack_notifier_list; 471 struct hlist_head irq_ack_notifier_list;
421 472
422 unsigned long irq_sources_bitmap; 473 unsigned long irq_sources_bitmap;
@@ -512,7 +563,7 @@ struct kvm_pt_regs {
512 563
513static inline struct kvm_pt_regs *vcpu_regs(struct kvm_vcpu *v) 564static inline struct kvm_pt_regs *vcpu_regs(struct kvm_vcpu *v)
514{ 565{
515 return (struct kvm_pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1; 566 return (struct kvm_pt_regs *) ((unsigned long) v + KVM_STK_OFFSET) - 1;
516} 567}
517 568
518typedef int kvm_vmm_entry(void); 569typedef int kvm_vmm_entry(void);
@@ -531,5 +582,6 @@ int kvm_pal_emul(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run);
531void kvm_sal_emul(struct kvm_vcpu *vcpu); 582void kvm_sal_emul(struct kvm_vcpu *vcpu);
532 583
533static inline void kvm_inject_nmi(struct kvm_vcpu *vcpu) {} 584static inline void kvm_inject_nmi(struct kvm_vcpu *vcpu) {}
585#endif /* __ASSEMBLY__*/
534 586
535#endif 587#endif
diff --git a/arch/ia64/include/asm/smp.h b/arch/ia64/include/asm/smp.h
index 12d96e0cd513..21c402365d0e 100644
--- a/arch/ia64/include/asm/smp.h
+++ b/arch/ia64/include/asm/smp.h
@@ -57,7 +57,6 @@ extern struct smp_boot_data {
57 57
58extern char no_int_routing __devinitdata; 58extern char no_int_routing __devinitdata;
59 59
60extern cpumask_t cpu_online_map;
61extern cpumask_t cpu_core_map[NR_CPUS]; 60extern cpumask_t cpu_core_map[NR_CPUS];
62DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); 61DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
63extern int smp_num_siblings; 62extern int smp_num_siblings;
diff --git a/arch/ia64/include/asm/swiotlb.h b/arch/ia64/include/asm/swiotlb.h
index fb79423834d0..dcbaea7ce128 100644
--- a/arch/ia64/include/asm/swiotlb.h
+++ b/arch/ia64/include/asm/swiotlb.h
@@ -2,44 +2,7 @@
2#define ASM_IA64__SWIOTLB_H 2#define ASM_IA64__SWIOTLB_H
3 3
4#include <linux/dma-mapping.h> 4#include <linux/dma-mapping.h>
5 5#include <linux/swiotlb.h>
6/* SWIOTLB interface */
7
8extern dma_addr_t swiotlb_map_single(struct device *hwdev, void *ptr,
9 size_t size, int dir);
10extern void *swiotlb_alloc_coherent(struct device *hwdev, size_t size,
11 dma_addr_t *dma_handle, gfp_t flags);
12extern void swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr,
13 size_t size, int dir);
14extern void swiotlb_sync_single_for_cpu(struct device *hwdev,
15 dma_addr_t dev_addr,
16 size_t size, int dir);
17extern void swiotlb_sync_single_for_device(struct device *hwdev,
18 dma_addr_t dev_addr,
19 size_t size, int dir);
20extern void swiotlb_sync_single_range_for_cpu(struct device *hwdev,
21 dma_addr_t dev_addr,
22 unsigned long offset,
23 size_t size, int dir);
24extern void swiotlb_sync_single_range_for_device(struct device *hwdev,
25 dma_addr_t dev_addr,
26 unsigned long offset,
27 size_t size, int dir);
28extern void swiotlb_sync_sg_for_cpu(struct device *hwdev,
29 struct scatterlist *sg, int nelems,
30 int dir);
31extern void swiotlb_sync_sg_for_device(struct device *hwdev,
32 struct scatterlist *sg, int nelems,
33 int dir);
34extern int swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg,
35 int nents, int direction);
36extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg,
37 int nents, int direction);
38extern int swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
39extern void swiotlb_free_coherent(struct device *hwdev, size_t size,
40 void *vaddr, dma_addr_t dma_handle);
41extern int swiotlb_dma_supported(struct device *hwdev, u64 mask);
42extern void swiotlb_init(void);
43 6
44extern int swiotlb_force; 7extern int swiotlb_force;
45 8
diff --git a/arch/ia64/include/asm/topology.h b/arch/ia64/include/asm/topology.h
index 35bcb641c9e5..76a33a91ca69 100644
--- a/arch/ia64/include/asm/topology.h
+++ b/arch/ia64/include/asm/topology.h
@@ -34,6 +34,7 @@
34 * Returns a bitmask of CPUs on Node 'node'. 34 * Returns a bitmask of CPUs on Node 'node'.
35 */ 35 */
36#define node_to_cpumask(node) (node_to_cpu_mask[node]) 36#define node_to_cpumask(node) (node_to_cpu_mask[node])
37#define cpumask_of_node(node) (&node_to_cpu_mask[node])
37 38
38/* 39/*
39 * Returns the number of the node containing Node 'nid'. 40 * Returns the number of the node containing Node 'nid'.
@@ -45,7 +46,7 @@
45/* 46/*
46 * Returns the number of the first CPU on Node 'node'. 47 * Returns the number of the first CPU on Node 'node'.
47 */ 48 */
48#define node_to_first_cpu(node) (first_cpu(node_to_cpumask(node))) 49#define node_to_first_cpu(node) (cpumask_first(cpumask_of_node(node)))
49 50
50/* 51/*
51 * Determines the node for a given pci bus 52 * Determines the node for a given pci bus
@@ -55,7 +56,6 @@
55void build_cpu_to_node_map(void); 56void build_cpu_to_node_map(void);
56 57
57#define SD_CPU_INIT (struct sched_domain) { \ 58#define SD_CPU_INIT (struct sched_domain) { \
58 .span = CPU_MASK_NONE, \
59 .parent = NULL, \ 59 .parent = NULL, \
60 .child = NULL, \ 60 .child = NULL, \
61 .groups = NULL, \ 61 .groups = NULL, \
@@ -80,7 +80,6 @@ void build_cpu_to_node_map(void);
80 80
81/* sched_domains SD_NODE_INIT for IA64 NUMA machines */ 81/* sched_domains SD_NODE_INIT for IA64 NUMA machines */
82#define SD_NODE_INIT (struct sched_domain) { \ 82#define SD_NODE_INIT (struct sched_domain) { \
83 .span = CPU_MASK_NONE, \
84 .parent = NULL, \ 83 .parent = NULL, \
85 .child = NULL, \ 84 .child = NULL, \
86 .groups = NULL, \ 85 .groups = NULL, \
@@ -111,6 +110,8 @@ void build_cpu_to_node_map(void);
111#define topology_core_id(cpu) (cpu_data(cpu)->core_id) 110#define topology_core_id(cpu) (cpu_data(cpu)->core_id)
112#define topology_core_siblings(cpu) (cpu_core_map[cpu]) 111#define topology_core_siblings(cpu) (cpu_core_map[cpu])
113#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) 112#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu))
113#define topology_core_cpumask(cpu) (&cpu_core_map[cpu])
114#define topology_thread_cpumask(cpu) (&per_cpu(cpu_sibling_map, cpu))
114#define smt_capable() (smp_num_siblings > 1) 115#define smt_capable() (smp_num_siblings > 1)
115#endif 116#endif
116 117
@@ -121,6 +122,10 @@ extern void arch_fix_phys_package_id(int num, u32 slot);
121 node_to_cpumask(pcibus_to_node(bus)) \ 122 node_to_cpumask(pcibus_to_node(bus)) \
122 ) 123 )
123 124
125#define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \
126 cpu_all_mask : \
127 cpumask_from_node(pcibus_to_node(bus)))
128
124#include <asm-generic/topology.h> 129#include <asm-generic/topology.h>
125 130
126#endif /* _ASM_IA64_TOPOLOGY_H */ 131#endif /* _ASM_IA64_TOPOLOGY_H */
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index bd7acc71e8a9..0553648b7595 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -202,7 +202,6 @@ char *__init __acpi_map_table(unsigned long phys_addr, unsigned long size)
202 Boot-time Table Parsing 202 Boot-time Table Parsing
203 -------------------------------------------------------------------------- */ 203 -------------------------------------------------------------------------- */
204 204
205static int total_cpus __initdata;
206static int available_cpus __initdata; 205static int available_cpus __initdata;
207struct acpi_table_madt *acpi_madt __initdata; 206struct acpi_table_madt *acpi_madt __initdata;
208static u8 has_8259; 207static u8 has_8259;
@@ -1001,7 +1000,7 @@ acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)
1001 node = pxm_to_node(pxm); 1000 node = pxm_to_node(pxm);
1002 1001
1003 if (node >= MAX_NUMNODES || !node_online(node) || 1002 if (node >= MAX_NUMNODES || !node_online(node) ||
1004 cpus_empty(node_to_cpumask(node))) 1003 cpumask_empty(cpumask_of_node(node)))
1005 return AE_OK; 1004 return AE_OK;
1006 1005
1007 /* We know a gsi to node mapping! */ 1006 /* We know a gsi to node mapping! */
diff --git a/arch/ia64/kernel/init_task.c b/arch/ia64/kernel/init_task.c
index 9d7e1c66faf4..5b0e830c6f33 100644
--- a/arch/ia64/kernel/init_task.c
+++ b/arch/ia64/kernel/init_task.c
@@ -17,7 +17,6 @@
17#include <asm/uaccess.h> 17#include <asm/uaccess.h>
18#include <asm/pgtable.h> 18#include <asm/pgtable.h>
19 19
20static struct fs_struct init_fs = INIT_FS;
21static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 20static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
22static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 21static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
23struct mm_struct init_mm = INIT_MM(init_mm); 22struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c
index 5c4674ae8aea..5cfd3d91001a 100644
--- a/arch/ia64/kernel/iosapic.c
+++ b/arch/ia64/kernel/iosapic.c
@@ -330,25 +330,25 @@ unmask_irq (unsigned int irq)
330 330
331 331
332static void 332static void
333iosapic_set_affinity (unsigned int irq, cpumask_t mask) 333iosapic_set_affinity(unsigned int irq, const struct cpumask *mask)
334{ 334{
335#ifdef CONFIG_SMP 335#ifdef CONFIG_SMP
336 u32 high32, low32; 336 u32 high32, low32;
337 int dest, rte_index; 337 int cpu, dest, rte_index;
338 int redir = (irq & IA64_IRQ_REDIRECTED) ? 1 : 0; 338 int redir = (irq & IA64_IRQ_REDIRECTED) ? 1 : 0;
339 struct iosapic_rte_info *rte; 339 struct iosapic_rte_info *rte;
340 struct iosapic *iosapic; 340 struct iosapic *iosapic;
341 341
342 irq &= (~IA64_IRQ_REDIRECTED); 342 irq &= (~IA64_IRQ_REDIRECTED);
343 343
344 cpus_and(mask, mask, cpu_online_map); 344 cpu = cpumask_first_and(cpu_online_mask, mask);
345 if (cpus_empty(mask)) 345 if (cpu >= nr_cpu_ids)
346 return; 346 return;
347 347
348 if (irq_prepare_move(irq, first_cpu(mask))) 348 if (irq_prepare_move(irq, cpu))
349 return; 349 return;
350 350
351 dest = cpu_physical_id(first_cpu(mask)); 351 dest = cpu_physical_id(cpu);
352 352
353 if (!iosapic_intr_info[irq].count) 353 if (!iosapic_intr_info[irq].count)
354 return; /* not an IOSAPIC interrupt */ 354 return; /* not an IOSAPIC interrupt */
@@ -695,32 +695,31 @@ get_target_cpu (unsigned int gsi, int irq)
695#ifdef CONFIG_NUMA 695#ifdef CONFIG_NUMA
696 { 696 {
697 int num_cpus, cpu_index, iosapic_index, numa_cpu, i = 0; 697 int num_cpus, cpu_index, iosapic_index, numa_cpu, i = 0;
698 cpumask_t cpu_mask; 698 const struct cpumask *cpu_mask;
699 699
700 iosapic_index = find_iosapic(gsi); 700 iosapic_index = find_iosapic(gsi);
701 if (iosapic_index < 0 || 701 if (iosapic_index < 0 ||
702 iosapic_lists[iosapic_index].node == MAX_NUMNODES) 702 iosapic_lists[iosapic_index].node == MAX_NUMNODES)
703 goto skip_numa_setup; 703 goto skip_numa_setup;
704 704
705 cpu_mask = node_to_cpumask(iosapic_lists[iosapic_index].node); 705 cpu_mask = cpumask_of_node(iosapic_lists[iosapic_index].node);
706 cpus_and(cpu_mask, cpu_mask, domain); 706 num_cpus = 0;
707 for_each_cpu_mask(numa_cpu, cpu_mask) { 707 for_each_cpu_and(numa_cpu, cpu_mask, &domain) {
708 if (!cpu_online(numa_cpu)) 708 if (cpu_online(numa_cpu))
709 cpu_clear(numa_cpu, cpu_mask); 709 num_cpus++;
710 } 710 }
711 711
712 num_cpus = cpus_weight(cpu_mask);
713
714 if (!num_cpus) 712 if (!num_cpus)
715 goto skip_numa_setup; 713 goto skip_numa_setup;
716 714
717 /* Use irq assignment to distribute across cpus in node */ 715 /* Use irq assignment to distribute across cpus in node */
718 cpu_index = irq % num_cpus; 716 cpu_index = irq % num_cpus;
719 717
720 for (numa_cpu = first_cpu(cpu_mask) ; i < cpu_index ; i++) 718 for_each_cpu_and(numa_cpu, cpu_mask, &domain)
721 numa_cpu = next_cpu(numa_cpu, cpu_mask); 719 if (cpu_online(numa_cpu) && i++ >= cpu_index)
720 break;
722 721
723 if (numa_cpu != NR_CPUS) 722 if (numa_cpu < nr_cpu_ids)
724 return cpu_physical_id(numa_cpu); 723 return cpu_physical_id(numa_cpu);
725 } 724 }
726skip_numa_setup: 725skip_numa_setup:
@@ -731,7 +730,7 @@ skip_numa_setup:
731 * case of NUMA.) 730 * case of NUMA.)
732 */ 731 */
733 do { 732 do {
734 if (++cpu >= NR_CPUS) 733 if (++cpu >= nr_cpu_ids)
735 cpu = 0; 734 cpu = 0;
736 } while (!cpu_online(cpu) || !cpu_isset(cpu, domain)); 735 } while (!cpu_online(cpu) || !cpu_isset(cpu, domain));
737 736
diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c
index 7fd18f54c056..95ff16cb05d8 100644
--- a/arch/ia64/kernel/irq.c
+++ b/arch/ia64/kernel/irq.c
@@ -112,11 +112,11 @@ void set_irq_affinity_info (unsigned int irq, int hwid, int redir)
112 } 112 }
113} 113}
114 114
115bool is_affinity_mask_valid(cpumask_t cpumask) 115bool is_affinity_mask_valid(cpumask_var_t cpumask)
116{ 116{
117 if (ia64_platform_is("sn2")) { 117 if (ia64_platform_is("sn2")) {
118 /* Only allow one CPU to be specified in the smp_affinity mask */ 118 /* Only allow one CPU to be specified in the smp_affinity mask */
119 if (cpus_weight(cpumask) != 1) 119 if (cpumask_weight(cpumask) != 1)
120 return false; 120 return false;
121 } 121 }
122 return true; 122 return true;
@@ -133,7 +133,6 @@ unsigned int vectors_in_migration[NR_IRQS];
133 */ 133 */
134static void migrate_irqs(void) 134static void migrate_irqs(void)
135{ 135{
136 cpumask_t mask;
137 irq_desc_t *desc; 136 irq_desc_t *desc;
138 int irq, new_cpu; 137 int irq, new_cpu;
139 138
@@ -152,15 +151,14 @@ static void migrate_irqs(void)
152 if (desc->status == IRQ_PER_CPU) 151 if (desc->status == IRQ_PER_CPU)
153 continue; 152 continue;
154 153
155 cpus_and(mask, irq_desc[irq].affinity, cpu_online_map); 154 if (cpumask_any_and(&irq_desc[irq].affinity, cpu_online_mask)
156 if (any_online_cpu(mask) == NR_CPUS) { 155 >= nr_cpu_ids) {
157 /* 156 /*
158 * Save it for phase 2 processing 157 * Save it for phase 2 processing
159 */ 158 */
160 vectors_in_migration[irq] = irq; 159 vectors_in_migration[irq] = irq;
161 160
162 new_cpu = any_online_cpu(cpu_online_map); 161 new_cpu = any_online_cpu(cpu_online_map);
163 mask = cpumask_of_cpu(new_cpu);
164 162
165 /* 163 /*
166 * Al three are essential, currently WARN_ON.. maybe panic? 164 * Al three are essential, currently WARN_ON.. maybe panic?
@@ -168,7 +166,8 @@ static void migrate_irqs(void)
168 if (desc->chip && desc->chip->disable && 166 if (desc->chip && desc->chip->disable &&
169 desc->chip->enable && desc->chip->set_affinity) { 167 desc->chip->enable && desc->chip->set_affinity) {
170 desc->chip->disable(irq); 168 desc->chip->disable(irq);
171 desc->chip->set_affinity(irq, mask); 169 desc->chip->set_affinity(irq,
170 cpumask_of(new_cpu));
172 desc->chip->enable(irq); 171 desc->chip->enable(irq);
173 } else { 172 } else {
174 WARN_ON((!(desc->chip) || !(desc->chip->disable) || 173 WARN_ON((!(desc->chip) || !(desc->chip->disable) ||
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c
index f07688da947c..097b84d54e73 100644
--- a/arch/ia64/kernel/kprobes.c
+++ b/arch/ia64/kernel/kprobes.c
@@ -670,9 +670,11 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
670 670
671void __kprobes arch_remove_kprobe(struct kprobe *p) 671void __kprobes arch_remove_kprobe(struct kprobe *p)
672{ 672{
673 mutex_lock(&kprobe_mutex); 673 if (p->ainsn.insn) {
674 free_insn_slot(p->ainsn.insn, p->ainsn.inst_flag & INST_FLAG_BOOSTABLE); 674 free_insn_slot(p->ainsn.insn,
675 mutex_unlock(&kprobe_mutex); 675 p->ainsn.inst_flag & INST_FLAG_BOOSTABLE);
676 p->ainsn.insn = NULL;
677 }
676} 678}
677/* 679/*
678 * We are resuming execution after a single step fault, so the pt_regs 680 * We are resuming execution after a single step fault, so the pt_regs
diff --git a/arch/ia64/kernel/mca_drv.c b/arch/ia64/kernel/mca_drv.c
index fab1d21a4f2c..f94aaa86933f 100644
--- a/arch/ia64/kernel/mca_drv.c
+++ b/arch/ia64/kernel/mca_drv.c
@@ -158,7 +158,7 @@ mca_handler_bh(unsigned long paddr, void *iip, unsigned long ipsr)
158 ia64_mlogbuf_dump(); 158 ia64_mlogbuf_dump();
159 printk(KERN_ERR "OS_MCA: process [cpu %d, pid: %d, uid: %d, " 159 printk(KERN_ERR "OS_MCA: process [cpu %d, pid: %d, uid: %d, "
160 "iip: %p, psr: 0x%lx,paddr: 0x%lx](%s) encounters MCA.\n", 160 "iip: %p, psr: 0x%lx,paddr: 0x%lx](%s) encounters MCA.\n",
161 raw_smp_processor_id(), current->pid, current->uid, 161 raw_smp_processor_id(), current->pid, current_uid(),
162 iip, ipsr, paddr, current->comm); 162 iip, ipsr, paddr, current->comm);
163 163
164 spin_lock(&mca_bh_lock); 164 spin_lock(&mca_bh_lock);
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c
index 702a09c13238..890339339035 100644
--- a/arch/ia64/kernel/msi_ia64.c
+++ b/arch/ia64/kernel/msi_ia64.c
@@ -49,11 +49,12 @@
49static struct irq_chip ia64_msi_chip; 49static struct irq_chip ia64_msi_chip;
50 50
51#ifdef CONFIG_SMP 51#ifdef CONFIG_SMP
52static void ia64_set_msi_irq_affinity(unsigned int irq, cpumask_t cpu_mask) 52static void ia64_set_msi_irq_affinity(unsigned int irq,
53 const cpumask_t *cpu_mask)
53{ 54{
54 struct msi_msg msg; 55 struct msi_msg msg;
55 u32 addr, data; 56 u32 addr, data;
56 int cpu = first_cpu(cpu_mask); 57 int cpu = first_cpu(*cpu_mask);
57 58
58 if (!cpu_online(cpu)) 59 if (!cpu_online(cpu))
59 return; 60 return;
@@ -166,12 +167,11 @@ void arch_teardown_msi_irq(unsigned int irq)
166 167
167#ifdef CONFIG_DMAR 168#ifdef CONFIG_DMAR
168#ifdef CONFIG_SMP 169#ifdef CONFIG_SMP
169static void dmar_msi_set_affinity(unsigned int irq, cpumask_t mask) 170static void dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask)
170{ 171{
171 struct irq_cfg *cfg = irq_cfg + irq; 172 struct irq_cfg *cfg = irq_cfg + irq;
172 struct msi_msg msg; 173 struct msi_msg msg;
173 int cpu = first_cpu(mask); 174 int cpu = cpumask_first(mask);
174
175 175
176 if (!cpu_online(cpu)) 176 if (!cpu_online(cpu))
177 return; 177 return;
@@ -187,7 +187,7 @@ static void dmar_msi_set_affinity(unsigned int irq, cpumask_t mask)
187 msg.address_lo |= MSI_ADDR_DESTID_CPU(cpu_physical_id(cpu)); 187 msg.address_lo |= MSI_ADDR_DESTID_CPU(cpu_physical_id(cpu));
188 188
189 dmar_msi_write(irq, &msg); 189 dmar_msi_write(irq, &msg);
190 irq_desc[irq].affinity = mask; 190 irq_desc[irq].affinity = *mask;
191} 191}
192#endif /* CONFIG_SMP */ 192#endif /* CONFIG_SMP */
193 193
diff --git a/arch/ia64/kernel/pci-dma.c b/arch/ia64/kernel/pci-dma.c
index 2a92f637431d..d0ada067a4af 100644
--- a/arch/ia64/kernel/pci-dma.c
+++ b/arch/ia64/kernel/pci-dma.c
@@ -39,7 +39,7 @@ int iommu_detected __read_mostly;
39 be probably a smaller DMA mask, but this is bug-to-bug compatible 39 be probably a smaller DMA mask, but this is bug-to-bug compatible
40 to i386. */ 40 to i386. */
41struct device fallback_dev = { 41struct device fallback_dev = {
42 .bus_id = "fallback device", 42 .init_name = "fallback device",
43 .coherent_dma_mask = DMA_32BIT_MASK, 43 .coherent_dma_mask = DMA_32BIT_MASK,
44 .dma_mask = &fallback_dev.coherent_dma_mask, 44 .dma_mask = &fallback_dev.coherent_dma_mask,
45}; 45};
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 6543a5547c84..0e499757309b 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -2220,8 +2220,8 @@ pfm_alloc_file(pfm_context_t *ctx)
2220 DPRINT(("new inode ino=%ld @%p\n", inode->i_ino, inode)); 2220 DPRINT(("new inode ino=%ld @%p\n", inode->i_ino, inode));
2221 2221
2222 inode->i_mode = S_IFCHR|S_IRUGO; 2222 inode->i_mode = S_IFCHR|S_IRUGO;
2223 inode->i_uid = current->fsuid; 2223 inode->i_uid = current_fsuid();
2224 inode->i_gid = current->fsgid; 2224 inode->i_gid = current_fsgid();
2225 2225
2226 sprintf(name, "[%lu]", inode->i_ino); 2226 sprintf(name, "[%lu]", inode->i_ino);
2227 this.name = name; 2227 this.name = name;
@@ -2399,22 +2399,33 @@ error_kmem:
2399static int 2399static int
2400pfm_bad_permissions(struct task_struct *task) 2400pfm_bad_permissions(struct task_struct *task)
2401{ 2401{
2402 const struct cred *tcred;
2403 uid_t uid = current_uid();
2404 gid_t gid = current_gid();
2405 int ret;
2406
2407 rcu_read_lock();
2408 tcred = __task_cred(task);
2409
2402 /* inspired by ptrace_attach() */ 2410 /* inspired by ptrace_attach() */
2403 DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n", 2411 DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n",
2404 current->uid, 2412 uid,
2405 current->gid, 2413 gid,
2406 task->euid, 2414 tcred->euid,
2407 task->suid, 2415 tcred->suid,
2408 task->uid, 2416 tcred->uid,
2409 task->egid, 2417 tcred->egid,
2410 task->sgid)); 2418 tcred->sgid));
2411 2419
2412 return ((current->uid != task->euid) 2420 ret = ((uid != tcred->euid)
2413 || (current->uid != task->suid) 2421 || (uid != tcred->suid)
2414 || (current->uid != task->uid) 2422 || (uid != tcred->uid)
2415 || (current->gid != task->egid) 2423 || (gid != tcred->egid)
2416 || (current->gid != task->sgid) 2424 || (gid != tcred->sgid)
2417 || (current->gid != task->gid)) && !capable(CAP_SYS_PTRACE); 2425 || (gid != tcred->gid)) && !capable(CAP_SYS_PTRACE);
2426
2427 rcu_read_unlock();
2428 return ret;
2418} 2429}
2419 2430
2420static int 2431static int
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
index e12500a9c443..e1821ca4c7df 100644
--- a/arch/ia64/kernel/signal.c
+++ b/arch/ia64/kernel/signal.c
@@ -229,7 +229,7 @@ ia64_rt_sigreturn (struct sigscratch *scr)
229 si.si_errno = 0; 229 si.si_errno = 0;
230 si.si_code = SI_KERNEL; 230 si.si_code = SI_KERNEL;
231 si.si_pid = task_pid_vnr(current); 231 si.si_pid = task_pid_vnr(current);
232 si.si_uid = current->uid; 232 si.si_uid = current_uid();
233 si.si_addr = sc; 233 si.si_addr = sc;
234 force_sig_info(SIGSEGV, &si, current); 234 force_sig_info(SIGSEGV, &si, current);
235 return retval; 235 return retval;
@@ -326,7 +326,7 @@ force_sigsegv_info (int sig, void __user *addr)
326 si.si_errno = 0; 326 si.si_errno = 0;
327 si.si_code = SI_KERNEL; 327 si.si_code = SI_KERNEL;
328 si.si_pid = task_pid_vnr(current); 328 si.si_pid = task_pid_vnr(current);
329 si.si_uid = current->uid; 329 si.si_uid = current_uid();
330 si.si_addr = addr; 330 si.si_addr = addr;
331 force_sig_info(SIGSEGV, &si, current); 331 force_sig_info(SIGSEGV, &si, current);
332 return 0; 332 return 0;
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 1dcbb85fc4ee..11463994a7d5 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -131,12 +131,6 @@ struct task_struct *task_for_booting_cpu;
131 */ 131 */
132DEFINE_PER_CPU(int, cpu_state); 132DEFINE_PER_CPU(int, cpu_state);
133 133
134/* Bitmasks of currently online, and possible CPUs */
135cpumask_t cpu_online_map;
136EXPORT_SYMBOL(cpu_online_map);
137cpumask_t cpu_possible_map = CPU_MASK_NONE;
138EXPORT_SYMBOL(cpu_possible_map);
139
140cpumask_t cpu_core_map[NR_CPUS] __cacheline_aligned; 134cpumask_t cpu_core_map[NR_CPUS] __cacheline_aligned;
141EXPORT_SYMBOL(cpu_core_map); 135EXPORT_SYMBOL(cpu_core_map);
142DEFINE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map); 136DEFINE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map);
@@ -688,7 +682,7 @@ int migrate_platform_irqs(unsigned int cpu)
688{ 682{
689 int new_cpei_cpu; 683 int new_cpei_cpu;
690 irq_desc_t *desc = NULL; 684 irq_desc_t *desc = NULL;
691 cpumask_t mask; 685 const struct cpumask *mask;
692 int retval = 0; 686 int retval = 0;
693 687
694 /* 688 /*
@@ -701,7 +695,7 @@ int migrate_platform_irqs(unsigned int cpu)
701 * Now re-target the CPEI to a different processor 695 * Now re-target the CPEI to a different processor
702 */ 696 */
703 new_cpei_cpu = any_online_cpu(cpu_online_map); 697 new_cpei_cpu = any_online_cpu(cpu_online_map);
704 mask = cpumask_of_cpu(new_cpei_cpu); 698 mask = cpumask_of(new_cpei_cpu);
705 set_cpei_target_cpu(new_cpei_cpu); 699 set_cpei_target_cpu(new_cpei_cpu);
706 desc = irq_desc + ia64_cpe_irq; 700 desc = irq_desc + ia64_cpe_irq;
707 /* 701 /*
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 65c10a42c88f..f0ebb342409d 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -93,13 +93,14 @@ void ia64_account_on_switch(struct task_struct *prev, struct task_struct *next)
93 now = ia64_get_itc(); 93 now = ia64_get_itc();
94 94
95 delta_stime = cycle_to_cputime(pi->ac_stime + (now - pi->ac_stamp)); 95 delta_stime = cycle_to_cputime(pi->ac_stime + (now - pi->ac_stamp));
96 account_system_time(prev, 0, delta_stime); 96 if (idle_task(smp_processor_id()) != prev)
97 account_system_time_scaled(prev, delta_stime); 97 account_system_time(prev, 0, delta_stime, delta_stime);
98 else
99 account_idle_time(delta_stime);
98 100
99 if (pi->ac_utime) { 101 if (pi->ac_utime) {
100 delta_utime = cycle_to_cputime(pi->ac_utime); 102 delta_utime = cycle_to_cputime(pi->ac_utime);
101 account_user_time(prev, delta_utime); 103 account_user_time(prev, delta_utime, delta_utime);
102 account_user_time_scaled(prev, delta_utime);
103 } 104 }
104 105
105 pi->ac_stamp = ni->ac_stamp = now; 106 pi->ac_stamp = ni->ac_stamp = now;
@@ -122,8 +123,10 @@ void account_system_vtime(struct task_struct *tsk)
122 now = ia64_get_itc(); 123 now = ia64_get_itc();
123 124
124 delta_stime = cycle_to_cputime(ti->ac_stime + (now - ti->ac_stamp)); 125 delta_stime = cycle_to_cputime(ti->ac_stime + (now - ti->ac_stamp));
125 account_system_time(tsk, 0, delta_stime); 126 if (irq_count() || idle_task(smp_processor_id()) != tsk)
126 account_system_time_scaled(tsk, delta_stime); 127 account_system_time(tsk, 0, delta_stime, delta_stime);
128 else
129 account_idle_time(delta_stime);
127 ti->ac_stime = 0; 130 ti->ac_stime = 0;
128 131
129 ti->ac_stamp = now; 132 ti->ac_stamp = now;
@@ -143,8 +146,7 @@ void account_process_tick(struct task_struct *p, int user_tick)
143 146
144 if (ti->ac_utime) { 147 if (ti->ac_utime) {
145 delta_utime = cycle_to_cputime(ti->ac_utime); 148 delta_utime = cycle_to_cputime(ti->ac_utime);
146 account_user_time(p, delta_utime); 149 account_user_time(p, delta_utime, delta_utime);
147 account_user_time_scaled(p, delta_utime);
148 ti->ac_utime = 0; 150 ti->ac_utime = 0;
149 } 151 }
150} 152}
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index c75b914f2d6b..a8d61a3e9a94 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -219,7 +219,7 @@ static ssize_t show_shared_cpu_map(struct cache_info *this_leaf, char *buf)
219 cpumask_t shared_cpu_map; 219 cpumask_t shared_cpu_map;
220 220
221 cpus_and(shared_cpu_map, this_leaf->shared_cpu_map, cpu_online_map); 221 cpus_and(shared_cpu_map, this_leaf->shared_cpu_map, cpu_online_map);
222 len = cpumask_scnprintf(buf, NR_CPUS+1, shared_cpu_map); 222 len = cpumask_scnprintf(buf, NR_CPUS+1, &shared_cpu_map);
223 len += sprintf(buf+len, "\n"); 223 len += sprintf(buf+len, "\n");
224 return len; 224 return len;
225} 225}
diff --git a/arch/ia64/kvm/Makefile b/arch/ia64/kvm/Makefile
index 92cef66ca268..0bb99b732908 100644
--- a/arch/ia64/kvm/Makefile
+++ b/arch/ia64/kvm/Makefile
@@ -51,8 +51,8 @@ EXTRA_AFLAGS += -Ivirt/kvm -Iarch/ia64/kvm/
51common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \ 51common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \
52 coalesced_mmio.o irq_comm.o) 52 coalesced_mmio.o irq_comm.o)
53 53
54ifeq ($(CONFIG_DMAR),y) 54ifeq ($(CONFIG_IOMMU_API),y)
55common-objs += $(addprefix ../../../virt/kvm/, vtd.o) 55common-objs += $(addprefix ../../../virt/kvm/, iommu.o)
56endif 56endif
57 57
58kvm-objs := $(common-objs) kvm-ia64.o kvm_fw.o 58kvm-objs := $(common-objs) kvm-ia64.o kvm_fw.o
@@ -60,7 +60,7 @@ obj-$(CONFIG_KVM) += kvm.o
60 60
61CFLAGS_vcpu.o += -mfixed-range=f2-f5,f12-f127 61CFLAGS_vcpu.o += -mfixed-range=f2-f5,f12-f127
62kvm-intel-objs = vmm.o vmm_ivt.o trampoline.o vcpu.o optvfault.o mmio.o \ 62kvm-intel-objs = vmm.o vmm_ivt.o trampoline.o vcpu.o optvfault.o mmio.o \
63 vtlb.o process.o 63 vtlb.o process.o kvm_lib.o
64#Add link memcpy and memset to avoid possible structure assignment error 64#Add link memcpy and memset to avoid possible structure assignment error
65kvm-intel-objs += memcpy.o memset.o 65kvm-intel-objs += memcpy.o memset.o
66obj-$(CONFIG_KVM_INTEL) += kvm-intel.o 66obj-$(CONFIG_KVM_INTEL) += kvm-intel.o
diff --git a/arch/ia64/kvm/asm-offsets.c b/arch/ia64/kvm/asm-offsets.c
index 4e3dc13a619c..0c3564a7a033 100644
--- a/arch/ia64/kvm/asm-offsets.c
+++ b/arch/ia64/kvm/asm-offsets.c
@@ -24,19 +24,10 @@
24 24
25#include <linux/autoconf.h> 25#include <linux/autoconf.h>
26#include <linux/kvm_host.h> 26#include <linux/kvm_host.h>
27#include <linux/kbuild.h>
27 28
28#include "vcpu.h" 29#include "vcpu.h"
29 30
30#define task_struct kvm_vcpu
31
32#define DEFINE(sym, val) \
33 asm volatile("\n->" #sym " (%0) " #val : : "i" (val))
34
35#define BLANK() asm volatile("\n->" : :)
36
37#define OFFSET(_sym, _str, _mem) \
38 DEFINE(_sym, offsetof(_str, _mem));
39
40void foo(void) 31void foo(void)
41{ 32{
42 DEFINE(VMM_TASK_SIZE, sizeof(struct kvm_vcpu)); 33 DEFINE(VMM_TASK_SIZE, sizeof(struct kvm_vcpu));
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index af1464f7a6ad..4e586f6110aa 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -31,6 +31,7 @@
31#include <linux/bitops.h> 31#include <linux/bitops.h>
32#include <linux/hrtimer.h> 32#include <linux/hrtimer.h>
33#include <linux/uaccess.h> 33#include <linux/uaccess.h>
34#include <linux/iommu.h>
34#include <linux/intel-iommu.h> 35#include <linux/intel-iommu.h>
35 36
36#include <asm/pgtable.h> 37#include <asm/pgtable.h>
@@ -180,7 +181,6 @@ int kvm_dev_ioctl_check_extension(long ext)
180 181
181 switch (ext) { 182 switch (ext) {
182 case KVM_CAP_IRQCHIP: 183 case KVM_CAP_IRQCHIP:
183 case KVM_CAP_USER_MEMORY:
184 case KVM_CAP_MP_STATE: 184 case KVM_CAP_MP_STATE:
185 185
186 r = 1; 186 r = 1;
@@ -189,7 +189,7 @@ int kvm_dev_ioctl_check_extension(long ext)
189 r = KVM_COALESCED_MMIO_PAGE_OFFSET; 189 r = KVM_COALESCED_MMIO_PAGE_OFFSET;
190 break; 190 break;
191 case KVM_CAP_IOMMU: 191 case KVM_CAP_IOMMU:
192 r = intel_iommu_found(); 192 r = iommu_found();
193 break; 193 break;
194 default: 194 default:
195 r = 0; 195 r = 0;
@@ -439,7 +439,6 @@ int kvm_emulate_halt(struct kvm_vcpu *vcpu)
439 expires = div64_u64(itc_diff, cyc_per_usec); 439 expires = div64_u64(itc_diff, cyc_per_usec);
440 kt = ktime_set(0, 1000 * expires); 440 kt = ktime_set(0, 1000 * expires);
441 441
442 down_read(&vcpu->kvm->slots_lock);
443 vcpu->arch.ht_active = 1; 442 vcpu->arch.ht_active = 1;
444 hrtimer_start(p_ht, kt, HRTIMER_MODE_ABS); 443 hrtimer_start(p_ht, kt, HRTIMER_MODE_ABS);
445 444
@@ -452,7 +451,6 @@ int kvm_emulate_halt(struct kvm_vcpu *vcpu)
452 if (vcpu->arch.mp_state == KVM_MP_STATE_HALTED) 451 if (vcpu->arch.mp_state == KVM_MP_STATE_HALTED)
453 vcpu->arch.mp_state = 452 vcpu->arch.mp_state =
454 KVM_MP_STATE_RUNNABLE; 453 KVM_MP_STATE_RUNNABLE;
455 up_read(&vcpu->kvm->slots_lock);
456 454
457 if (vcpu->arch.mp_state != KVM_MP_STATE_RUNNABLE) 455 if (vcpu->arch.mp_state != KVM_MP_STATE_RUNNABLE)
458 return -EINTR; 456 return -EINTR;
@@ -476,6 +474,13 @@ static int handle_external_interrupt(struct kvm_vcpu *vcpu,
476 return 1; 474 return 1;
477} 475}
478 476
477static int handle_vcpu_debug(struct kvm_vcpu *vcpu,
478 struct kvm_run *kvm_run)
479{
480 printk("VMM: %s", vcpu->arch.log_buf);
481 return 1;
482}
483
479static int (*kvm_vti_exit_handlers[])(struct kvm_vcpu *vcpu, 484static int (*kvm_vti_exit_handlers[])(struct kvm_vcpu *vcpu,
480 struct kvm_run *kvm_run) = { 485 struct kvm_run *kvm_run) = {
481 [EXIT_REASON_VM_PANIC] = handle_vm_error, 486 [EXIT_REASON_VM_PANIC] = handle_vm_error,
@@ -487,6 +492,7 @@ static int (*kvm_vti_exit_handlers[])(struct kvm_vcpu *vcpu,
487 [EXIT_REASON_EXTERNAL_INTERRUPT] = handle_external_interrupt, 492 [EXIT_REASON_EXTERNAL_INTERRUPT] = handle_external_interrupt,
488 [EXIT_REASON_IPI] = handle_ipi, 493 [EXIT_REASON_IPI] = handle_ipi,
489 [EXIT_REASON_PTC_G] = handle_global_purge, 494 [EXIT_REASON_PTC_G] = handle_global_purge,
495 [EXIT_REASON_DEBUG] = handle_vcpu_debug,
490 496
491}; 497};
492 498
@@ -698,27 +704,24 @@ out:
698 return r; 704 return r;
699} 705}
700 706
701/*
702 * Allocate 16M memory for every vm to hold its specific data.
703 * Its memory map is defined in kvm_host.h.
704 */
705static struct kvm *kvm_alloc_kvm(void) 707static struct kvm *kvm_alloc_kvm(void)
706{ 708{
707 709
708 struct kvm *kvm; 710 struct kvm *kvm;
709 uint64_t vm_base; 711 uint64_t vm_base;
710 712
713 BUG_ON(sizeof(struct kvm) > KVM_VM_STRUCT_SIZE);
714
711 vm_base = __get_free_pages(GFP_KERNEL, get_order(KVM_VM_DATA_SIZE)); 715 vm_base = __get_free_pages(GFP_KERNEL, get_order(KVM_VM_DATA_SIZE));
712 716
713 if (!vm_base) 717 if (!vm_base)
714 return ERR_PTR(-ENOMEM); 718 return ERR_PTR(-ENOMEM);
715 printk(KERN_DEBUG"kvm: VM data's base Address:0x%lx\n", vm_base);
716 719
717 /* Zero all pages before use! */
718 memset((void *)vm_base, 0, KVM_VM_DATA_SIZE); 720 memset((void *)vm_base, 0, KVM_VM_DATA_SIZE);
719 721 kvm = (struct kvm *)(vm_base +
720 kvm = (struct kvm *)(vm_base + KVM_VM_OFS); 722 offsetof(struct kvm_vm_data, kvm_vm_struct));
721 kvm->arch.vm_base = vm_base; 723 kvm->arch.vm_base = vm_base;
724 printk(KERN_DEBUG"kvm: vm's data area:0x%lx\n", vm_base);
722 725
723 return kvm; 726 return kvm;
724} 727}
@@ -760,21 +763,12 @@ static void kvm_build_io_pmt(struct kvm *kvm)
760 763
761static void kvm_init_vm(struct kvm *kvm) 764static void kvm_init_vm(struct kvm *kvm)
762{ 765{
763 long vm_base;
764
765 BUG_ON(!kvm); 766 BUG_ON(!kvm);
766 767
767 kvm->arch.metaphysical_rr0 = GUEST_PHYSICAL_RR0; 768 kvm->arch.metaphysical_rr0 = GUEST_PHYSICAL_RR0;
768 kvm->arch.metaphysical_rr4 = GUEST_PHYSICAL_RR4; 769 kvm->arch.metaphysical_rr4 = GUEST_PHYSICAL_RR4;
769 kvm->arch.vmm_init_rr = VMM_INIT_RR; 770 kvm->arch.vmm_init_rr = VMM_INIT_RR;
770 771
771 vm_base = kvm->arch.vm_base;
772 if (vm_base) {
773 kvm->arch.vhpt_base = vm_base + KVM_VHPT_OFS;
774 kvm->arch.vtlb_base = vm_base + KVM_VTLB_OFS;
775 kvm->arch.vpd_base = vm_base + KVM_VPD_OFS;
776 }
777
778 /* 772 /*
779 *Fill P2M entries for MMIO/IO ranges 773 *Fill P2M entries for MMIO/IO ranges
780 */ 774 */
@@ -838,9 +832,8 @@ static int kvm_vm_ioctl_set_irqchip(struct kvm *kvm, struct kvm_irqchip *chip)
838 832
839int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) 833int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
840{ 834{
841 int i;
842 struct vpd *vpd = to_host(vcpu->kvm, vcpu->arch.vpd); 835 struct vpd *vpd = to_host(vcpu->kvm, vcpu->arch.vpd);
843 int r; 836 int i;
844 837
845 vcpu_load(vcpu); 838 vcpu_load(vcpu);
846 839
@@ -857,18 +850,7 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
857 850
858 vpd->vpr = regs->vpd.vpr; 851 vpd->vpr = regs->vpd.vpr;
859 852
860 r = -EFAULT; 853 memcpy(&vcpu->arch.guest, &regs->saved_guest, sizeof(union context));
861 r = copy_from_user(&vcpu->arch.guest, regs->saved_guest,
862 sizeof(union context));
863 if (r)
864 goto out;
865 r = copy_from_user(vcpu + 1, regs->saved_stack +
866 sizeof(struct kvm_vcpu),
867 IA64_STK_OFFSET - sizeof(struct kvm_vcpu));
868 if (r)
869 goto out;
870 vcpu->arch.exit_data =
871 ((struct kvm_vcpu *)(regs->saved_stack))->arch.exit_data;
872 854
873 RESTORE_REGS(mp_state); 855 RESTORE_REGS(mp_state);
874 RESTORE_REGS(vmm_rr); 856 RESTORE_REGS(vmm_rr);
@@ -902,9 +884,8 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
902 set_bit(KVM_REQ_RESUME, &vcpu->requests); 884 set_bit(KVM_REQ_RESUME, &vcpu->requests);
903 885
904 vcpu_put(vcpu); 886 vcpu_put(vcpu);
905 r = 0; 887
906out: 888 return 0;
907 return r;
908} 889}
909 890
910long kvm_arch_vm_ioctl(struct file *filp, 891long kvm_arch_vm_ioctl(struct file *filp,
@@ -1166,10 +1147,11 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
1166 /*Set entry address for first run.*/ 1147 /*Set entry address for first run.*/
1167 regs->cr_iip = PALE_RESET_ENTRY; 1148 regs->cr_iip = PALE_RESET_ENTRY;
1168 1149
1169 /*Initilize itc offset for vcpus*/ 1150 /*Initialize itc offset for vcpus*/
1170 itc_offset = 0UL - ia64_getreg(_IA64_REG_AR_ITC); 1151 itc_offset = 0UL - ia64_getreg(_IA64_REG_AR_ITC);
1171 for (i = 0; i < MAX_VCPU_NUM; i++) { 1152 for (i = 0; i < KVM_MAX_VCPUS; i++) {
1172 v = (struct kvm_vcpu *)((char *)vcpu + VCPU_SIZE * i); 1153 v = (struct kvm_vcpu *)((char *)vcpu +
1154 sizeof(struct kvm_vcpu_data) * i);
1173 v->arch.itc_offset = itc_offset; 1155 v->arch.itc_offset = itc_offset;
1174 v->arch.last_itc = 0; 1156 v->arch.last_itc = 0;
1175 } 1157 }
@@ -1183,7 +1165,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
1183 vcpu->arch.apic->vcpu = vcpu; 1165 vcpu->arch.apic->vcpu = vcpu;
1184 1166
1185 p_ctx->gr[1] = 0; 1167 p_ctx->gr[1] = 0;
1186 p_ctx->gr[12] = (unsigned long)((char *)vmm_vcpu + IA64_STK_OFFSET); 1168 p_ctx->gr[12] = (unsigned long)((char *)vmm_vcpu + KVM_STK_OFFSET);
1187 p_ctx->gr[13] = (unsigned long)vmm_vcpu; 1169 p_ctx->gr[13] = (unsigned long)vmm_vcpu;
1188 p_ctx->psr = 0x1008522000UL; 1170 p_ctx->psr = 0x1008522000UL;
1189 p_ctx->ar[40] = FPSR_DEFAULT; /*fpsr*/ 1171 p_ctx->ar[40] = FPSR_DEFAULT; /*fpsr*/
@@ -1218,12 +1200,12 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
1218 vcpu->arch.hlt_timer.function = hlt_timer_fn; 1200 vcpu->arch.hlt_timer.function = hlt_timer_fn;
1219 1201
1220 vcpu->arch.last_run_cpu = -1; 1202 vcpu->arch.last_run_cpu = -1;
1221 vcpu->arch.vpd = (struct vpd *)VPD_ADDR(vcpu->vcpu_id); 1203 vcpu->arch.vpd = (struct vpd *)VPD_BASE(vcpu->vcpu_id);
1222 vcpu->arch.vsa_base = kvm_vsa_base; 1204 vcpu->arch.vsa_base = kvm_vsa_base;
1223 vcpu->arch.__gp = kvm_vmm_gp; 1205 vcpu->arch.__gp = kvm_vmm_gp;
1224 vcpu->arch.dirty_log_lock_pa = __pa(&kvm->arch.dirty_log_lock); 1206 vcpu->arch.dirty_log_lock_pa = __pa(&kvm->arch.dirty_log_lock);
1225 vcpu->arch.vhpt.hash = (struct thash_data *)VHPT_ADDR(vcpu->vcpu_id); 1207 vcpu->arch.vhpt.hash = (struct thash_data *)VHPT_BASE(vcpu->vcpu_id);
1226 vcpu->arch.vtlb.hash = (struct thash_data *)VTLB_ADDR(vcpu->vcpu_id); 1208 vcpu->arch.vtlb.hash = (struct thash_data *)VTLB_BASE(vcpu->vcpu_id);
1227 init_ptce_info(vcpu); 1209 init_ptce_info(vcpu);
1228 1210
1229 r = 0; 1211 r = 0;
@@ -1273,12 +1255,22 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
1273 int r; 1255 int r;
1274 int cpu; 1256 int cpu;
1275 1257
1258 BUG_ON(sizeof(struct kvm_vcpu) > VCPU_STRUCT_SIZE/2);
1259
1260 r = -EINVAL;
1261 if (id >= KVM_MAX_VCPUS) {
1262 printk(KERN_ERR"kvm: Can't configure vcpus > %ld",
1263 KVM_MAX_VCPUS);
1264 goto fail;
1265 }
1266
1276 r = -ENOMEM; 1267 r = -ENOMEM;
1277 if (!vm_base) { 1268 if (!vm_base) {
1278 printk(KERN_ERR"kvm: Create vcpu[%d] error!\n", id); 1269 printk(KERN_ERR"kvm: Create vcpu[%d] error!\n", id);
1279 goto fail; 1270 goto fail;
1280 } 1271 }
1281 vcpu = (struct kvm_vcpu *)(vm_base + KVM_VCPU_OFS + VCPU_SIZE * id); 1272 vcpu = (struct kvm_vcpu *)(vm_base + offsetof(struct kvm_vm_data,
1273 vcpu_data[id].vcpu_struct));
1282 vcpu->kvm = kvm; 1274 vcpu->kvm = kvm;
1283 1275
1284 cpu = get_cpu(); 1276 cpu = get_cpu();
@@ -1374,9 +1366,9 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
1374 1366
1375int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) 1367int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
1376{ 1368{
1377 int i;
1378 int r;
1379 struct vpd *vpd = to_host(vcpu->kvm, vcpu->arch.vpd); 1369 struct vpd *vpd = to_host(vcpu->kvm, vcpu->arch.vpd);
1370 int i;
1371
1380 vcpu_load(vcpu); 1372 vcpu_load(vcpu);
1381 1373
1382 for (i = 0; i < 16; i++) { 1374 for (i = 0; i < 16; i++) {
@@ -1391,14 +1383,8 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
1391 regs->vpd.vpsr = vpd->vpsr; 1383 regs->vpd.vpsr = vpd->vpsr;
1392 regs->vpd.vpr = vpd->vpr; 1384 regs->vpd.vpr = vpd->vpr;
1393 1385
1394 r = -EFAULT; 1386 memcpy(&regs->saved_guest, &vcpu->arch.guest, sizeof(union context));
1395 r = copy_to_user(regs->saved_guest, &vcpu->arch.guest, 1387
1396 sizeof(union context));
1397 if (r)
1398 goto out;
1399 r = copy_to_user(regs->saved_stack, (void *)vcpu, IA64_STK_OFFSET);
1400 if (r)
1401 goto out;
1402 SAVE_REGS(mp_state); 1388 SAVE_REGS(mp_state);
1403 SAVE_REGS(vmm_rr); 1389 SAVE_REGS(vmm_rr);
1404 memcpy(regs->itrs, vcpu->arch.itrs, sizeof(struct thash_data) * NITRS); 1390 memcpy(regs->itrs, vcpu->arch.itrs, sizeof(struct thash_data) * NITRS);
@@ -1426,10 +1412,9 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
1426 SAVE_REGS(metaphysical_saved_rr4); 1412 SAVE_REGS(metaphysical_saved_rr4);
1427 SAVE_REGS(fp_psr); 1413 SAVE_REGS(fp_psr);
1428 SAVE_REGS(saved_gp); 1414 SAVE_REGS(saved_gp);
1415
1429 vcpu_put(vcpu); 1416 vcpu_put(vcpu);
1430 r = 0; 1417 return 0;
1431out:
1432 return r;
1433} 1418}
1434 1419
1435void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) 1420void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
@@ -1457,6 +1442,9 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
1457 struct kvm_memory_slot *memslot = &kvm->memslots[mem->slot]; 1442 struct kvm_memory_slot *memslot = &kvm->memslots[mem->slot];
1458 unsigned long base_gfn = memslot->base_gfn; 1443 unsigned long base_gfn = memslot->base_gfn;
1459 1444
1445 if (base_gfn + npages > (KVM_MAX_MEM_SIZE >> PAGE_SHIFT))
1446 return -ENOMEM;
1447
1460 for (i = 0; i < npages; i++) { 1448 for (i = 0; i < npages; i++) {
1461 pfn = gfn_to_pfn(kvm, base_gfn + i); 1449 pfn = gfn_to_pfn(kvm, base_gfn + i);
1462 if (!kvm_is_mmio_pfn(pfn)) { 1450 if (!kvm_is_mmio_pfn(pfn)) {
@@ -1631,8 +1619,8 @@ static int kvm_ia64_sync_dirty_log(struct kvm *kvm,
1631 struct kvm_memory_slot *memslot; 1619 struct kvm_memory_slot *memslot;
1632 int r, i; 1620 int r, i;
1633 long n, base; 1621 long n, base;
1634 unsigned long *dirty_bitmap = (unsigned long *)((void *)kvm - KVM_VM_OFS 1622 unsigned long *dirty_bitmap = (unsigned long *)(kvm->arch.vm_base +
1635 + KVM_MEM_DIRTY_LOG_OFS); 1623 offsetof(struct kvm_vm_data, kvm_mem_dirty_log));
1636 1624
1637 r = -EINVAL; 1625 r = -EINVAL;
1638 if (log->slot >= KVM_MEMORY_SLOTS) 1626 if (log->slot >= KVM_MEMORY_SLOTS)
diff --git a/arch/ia64/kvm/kvm_lib.c b/arch/ia64/kvm/kvm_lib.c
new file mode 100644
index 000000000000..a85cb611ecd7
--- /dev/null
+++ b/arch/ia64/kvm/kvm_lib.c
@@ -0,0 +1,15 @@
1/*
2 * kvm_lib.c: Compile some libraries for kvm-intel module.
3 *
4 * Just include kernel's library, and disable symbols export.
5 * Copyright (C) 2008, Intel Corporation.
6 * Xiantao Zhang (xiantao.zhang@intel.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13#undef CONFIG_MODULES
14#include "../../../lib/vsprintf.c"
15#include "../../../lib/ctype.c"
diff --git a/arch/ia64/kvm/kvm_minstate.h b/arch/ia64/kvm/kvm_minstate.h
index 2cc41d17cf99..b2bcaa2787aa 100644
--- a/arch/ia64/kvm/kvm_minstate.h
+++ b/arch/ia64/kvm/kvm_minstate.h
@@ -24,6 +24,8 @@
24#include <asm/asmmacro.h> 24#include <asm/asmmacro.h>
25#include <asm/types.h> 25#include <asm/types.h>
26#include <asm/kregs.h> 26#include <asm/kregs.h>
27#include <asm/kvm_host.h>
28
27#include "asm-offsets.h" 29#include "asm-offsets.h"
28 30
29#define KVM_MINSTATE_START_SAVE_MIN \ 31#define KVM_MINSTATE_START_SAVE_MIN \
@@ -33,7 +35,7 @@
33 addl r22 = VMM_RBS_OFFSET,r1; /* compute base of RBS */ \ 35 addl r22 = VMM_RBS_OFFSET,r1; /* compute base of RBS */ \
34 ;; \ 36 ;; \
35 lfetch.fault.excl.nt1 [r22]; \ 37 lfetch.fault.excl.nt1 [r22]; \
36 addl r1 = IA64_STK_OFFSET-VMM_PT_REGS_SIZE,r1; /* compute base of memory stack */ \ 38 addl r1 = KVM_STK_OFFSET-VMM_PT_REGS_SIZE, r1; \
37 mov r23 = ar.bspstore; /* save ar.bspstore */ \ 39 mov r23 = ar.bspstore; /* save ar.bspstore */ \
38 ;; \ 40 ;; \
39 mov ar.bspstore = r22; /* switch to kernel RBS */\ 41 mov ar.bspstore = r22; /* switch to kernel RBS */\
diff --git a/arch/ia64/kvm/misc.h b/arch/ia64/kvm/misc.h
index e585c4607344..dd979e00b574 100644
--- a/arch/ia64/kvm/misc.h
+++ b/arch/ia64/kvm/misc.h
@@ -27,7 +27,8 @@
27 */ 27 */
28static inline uint64_t *kvm_host_get_pmt(struct kvm *kvm) 28static inline uint64_t *kvm_host_get_pmt(struct kvm *kvm)
29{ 29{
30 return (uint64_t *)(kvm->arch.vm_base + KVM_P2M_OFS); 30 return (uint64_t *)(kvm->arch.vm_base +
31 offsetof(struct kvm_vm_data, kvm_p2m));
31} 32}
32 33
33static inline void kvm_set_pmt_entry(struct kvm *kvm, gfn_t gfn, 34static inline void kvm_set_pmt_entry(struct kvm *kvm, gfn_t gfn,
diff --git a/arch/ia64/kvm/mmio.c b/arch/ia64/kvm/mmio.c
index 7f1a858bc69f..21f63fffc379 100644
--- a/arch/ia64/kvm/mmio.c
+++ b/arch/ia64/kvm/mmio.c
@@ -66,31 +66,25 @@ void lsapic_write(struct kvm_vcpu *v, unsigned long addr,
66 66
67 switch (addr) { 67 switch (addr) {
68 case PIB_OFST_INTA: 68 case PIB_OFST_INTA:
69 /*panic_domain(NULL, "Undefined write on PIB INTA\n");*/ 69 panic_vm(v, "Undefined write on PIB INTA\n");
70 panic_vm(v);
71 break; 70 break;
72 case PIB_OFST_XTP: 71 case PIB_OFST_XTP:
73 if (length == 1) { 72 if (length == 1) {
74 vlsapic_write_xtp(v, val); 73 vlsapic_write_xtp(v, val);
75 } else { 74 } else {
76 /*panic_domain(NULL, 75 panic_vm(v, "Undefined write on PIB XTP\n");
77 "Undefined write on PIB XTP\n");*/
78 panic_vm(v);
79 } 76 }
80 break; 77 break;
81 default: 78 default:
82 if (PIB_LOW_HALF(addr)) { 79 if (PIB_LOW_HALF(addr)) {
83 /*lower half */ 80 /*Lower half */
84 if (length != 8) 81 if (length != 8)
85 /*panic_domain(NULL, 82 panic_vm(v, "Can't LHF write with size %ld!\n",
86 "Can't LHF write with size %ld!\n", 83 length);
87 length);*/
88 panic_vm(v);
89 else 84 else
90 vlsapic_write_ipi(v, addr, val); 85 vlsapic_write_ipi(v, addr, val);
91 } else { /* upper half 86 } else { /*Upper half */
92 printk("IPI-UHF write %lx\n",addr);*/ 87 panic_vm(v, "IPI-UHF write %lx\n", addr);
93 panic_vm(v);
94 } 88 }
95 break; 89 break;
96 } 90 }
@@ -108,22 +102,18 @@ unsigned long lsapic_read(struct kvm_vcpu *v, unsigned long addr,
108 if (length == 1) /* 1 byte load */ 102 if (length == 1) /* 1 byte load */
109 ; /* There is no i8259, there is no INTA access*/ 103 ; /* There is no i8259, there is no INTA access*/
110 else 104 else
111 /*panic_domain(NULL,"Undefined read on PIB INTA\n"); */ 105 panic_vm(v, "Undefined read on PIB INTA\n");
112 panic_vm(v);
113 106
114 break; 107 break;
115 case PIB_OFST_XTP: 108 case PIB_OFST_XTP:
116 if (length == 1) { 109 if (length == 1) {
117 result = VLSAPIC_XTP(v); 110 result = VLSAPIC_XTP(v);
118 /* printk("read xtp %lx\n", result); */
119 } else { 111 } else {
120 /*panic_domain(NULL, 112 panic_vm(v, "Undefined read on PIB XTP\n");
121 "Undefined read on PIB XTP\n");*/
122 panic_vm(v);
123 } 113 }
124 break; 114 break;
125 default: 115 default:
126 panic_vm(v); 116 panic_vm(v, "Undefined addr access for lsapic!\n");
127 break; 117 break;
128 } 118 }
129 return result; 119 return result;
@@ -162,7 +152,7 @@ static void mmio_access(struct kvm_vcpu *vcpu, u64 src_pa, u64 *dest,
162 /* it's necessary to ensure zero extending */ 152 /* it's necessary to ensure zero extending */
163 *dest = p->u.ioreq.data & (~0UL >> (64-(s*8))); 153 *dest = p->u.ioreq.data & (~0UL >> (64-(s*8)));
164 } else 154 } else
165 panic_vm(vcpu); 155 panic_vm(vcpu, "Unhandled mmio access returned!\n");
166out: 156out:
167 local_irq_restore(psr); 157 local_irq_restore(psr);
168 return ; 158 return ;
@@ -324,7 +314,9 @@ void emulate_io_inst(struct kvm_vcpu *vcpu, u64 padr, u64 ma)
324 return; 314 return;
325 } else { 315 } else {
326 inst_type = -1; 316 inst_type = -1;
327 panic_vm(vcpu); 317 panic_vm(vcpu, "Unsupported MMIO access instruction! \
318 Bunld[0]=0x%lx, Bundle[1]=0x%lx\n",
319 bundle.i64[0], bundle.i64[1]);
328 } 320 }
329 321
330 size = 1 << size; 322 size = 1 << size;
@@ -335,7 +327,7 @@ void emulate_io_inst(struct kvm_vcpu *vcpu, u64 padr, u64 ma)
335 if (inst_type == SL_INTEGER) 327 if (inst_type == SL_INTEGER)
336 vcpu_set_gr(vcpu, inst.M1.r1, data, 0); 328 vcpu_set_gr(vcpu, inst.M1.r1, data, 0);
337 else 329 else
338 panic_vm(vcpu); 330 panic_vm(vcpu, "Unsupported instruction type!\n");
339 331
340 } 332 }
341 vcpu_increment_iip(vcpu); 333 vcpu_increment_iip(vcpu);
diff --git a/arch/ia64/kvm/process.c b/arch/ia64/kvm/process.c
index 800817307b7b..552d07724207 100644
--- a/arch/ia64/kvm/process.c
+++ b/arch/ia64/kvm/process.c
@@ -527,7 +527,8 @@ void reflect_interruption(u64 ifa, u64 isr, u64 iim,
527 vector = vec2off[vec]; 527 vector = vec2off[vec];
528 528
529 if (!(vpsr & IA64_PSR_IC) && (vector != IA64_DATA_NESTED_TLB_VECTOR)) { 529 if (!(vpsr & IA64_PSR_IC) && (vector != IA64_DATA_NESTED_TLB_VECTOR)) {
530 panic_vm(vcpu); 530 panic_vm(vcpu, "Interruption with vector :0x%lx occurs "
531 "with psr.ic = 0\n", vector);
531 return; 532 return;
532 } 533 }
533 534
@@ -586,7 +587,7 @@ static void set_pal_call_result(struct kvm_vcpu *vcpu)
586 vcpu_set_gr(vcpu, 10, p->u.pal_data.ret.v1, 0); 587 vcpu_set_gr(vcpu, 10, p->u.pal_data.ret.v1, 0);
587 vcpu_set_gr(vcpu, 11, p->u.pal_data.ret.v2, 0); 588 vcpu_set_gr(vcpu, 11, p->u.pal_data.ret.v2, 0);
588 } else 589 } else
589 panic_vm(vcpu); 590 panic_vm(vcpu, "Mis-set for exit reason!\n");
590} 591}
591 592
592static void set_sal_call_data(struct kvm_vcpu *vcpu) 593static void set_sal_call_data(struct kvm_vcpu *vcpu)
@@ -614,7 +615,7 @@ static void set_sal_call_result(struct kvm_vcpu *vcpu)
614 vcpu_set_gr(vcpu, 10, p->u.sal_data.ret.r10, 0); 615 vcpu_set_gr(vcpu, 10, p->u.sal_data.ret.r10, 0);
615 vcpu_set_gr(vcpu, 11, p->u.sal_data.ret.r11, 0); 616 vcpu_set_gr(vcpu, 11, p->u.sal_data.ret.r11, 0);
616 } else 617 } else
617 panic_vm(vcpu); 618 panic_vm(vcpu, "Mis-set for exit reason!\n");
618} 619}
619 620
620void kvm_ia64_handle_break(unsigned long ifa, struct kvm_pt_regs *regs, 621void kvm_ia64_handle_break(unsigned long ifa, struct kvm_pt_regs *regs,
@@ -680,7 +681,7 @@ static void generate_exirq(struct kvm_vcpu *vcpu)
680 vpsr = VCPU(vcpu, vpsr); 681 vpsr = VCPU(vcpu, vpsr);
681 isr = vpsr & IA64_PSR_RI; 682 isr = vpsr & IA64_PSR_RI;
682 if (!(vpsr & IA64_PSR_IC)) 683 if (!(vpsr & IA64_PSR_IC))
683 panic_vm(vcpu); 684 panic_vm(vcpu, "Trying to inject one IRQ with psr.ic=0\n");
684 reflect_interruption(0, isr, 0, 12, regs); /* EXT IRQ */ 685 reflect_interruption(0, isr, 0, 12, regs); /* EXT IRQ */
685} 686}
686 687
@@ -941,8 +942,20 @@ static void vcpu_do_resume(struct kvm_vcpu *vcpu)
941 ia64_set_pta(vcpu->arch.vhpt.pta.val); 942 ia64_set_pta(vcpu->arch.vhpt.pta.val);
942} 943}
943 944
945static void vmm_sanity_check(struct kvm_vcpu *vcpu)
946{
947 struct exit_ctl_data *p = &vcpu->arch.exit_data;
948
949 if (!vmm_sanity && p->exit_reason != EXIT_REASON_DEBUG) {
950 panic_vm(vcpu, "Failed to do vmm sanity check,"
951 "it maybe caused by crashed vmm!!\n\n");
952 }
953}
954
944static void kvm_do_resume_op(struct kvm_vcpu *vcpu) 955static void kvm_do_resume_op(struct kvm_vcpu *vcpu)
945{ 956{
957 vmm_sanity_check(vcpu); /*Guarantee vcpu runing on healthy vmm!*/
958
946 if (test_and_clear_bit(KVM_REQ_RESUME, &vcpu->requests)) { 959 if (test_and_clear_bit(KVM_REQ_RESUME, &vcpu->requests)) {
947 vcpu_do_resume(vcpu); 960 vcpu_do_resume(vcpu);
948 return; 961 return;
@@ -968,3 +981,11 @@ void vmm_transition(struct kvm_vcpu *vcpu)
968 1, 0, 0, 0, 0, 0); 981 1, 0, 0, 0, 0, 0);
969 kvm_do_resume_op(vcpu); 982 kvm_do_resume_op(vcpu);
970} 983}
984
985void vmm_panic_handler(u64 vec)
986{
987 struct kvm_vcpu *vcpu = current_vcpu;
988 vmm_sanity = 0;
989 panic_vm(vcpu, "Unexpected interruption occurs in VMM, vector:0x%lx\n",
990 vec2off[vec]);
991}
diff --git a/arch/ia64/kvm/vcpu.c b/arch/ia64/kvm/vcpu.c
index e44027ce5667..ecd526b55323 100644
--- a/arch/ia64/kvm/vcpu.c
+++ b/arch/ia64/kvm/vcpu.c
@@ -816,8 +816,9 @@ static void vcpu_set_itc(struct kvm_vcpu *vcpu, u64 val)
816 unsigned long vitv = VCPU(vcpu, itv); 816 unsigned long vitv = VCPU(vcpu, itv);
817 817
818 if (vcpu->vcpu_id == 0) { 818 if (vcpu->vcpu_id == 0) {
819 for (i = 0; i < MAX_VCPU_NUM; i++) { 819 for (i = 0; i < KVM_MAX_VCPUS; i++) {
820 v = (struct kvm_vcpu *)((char *)vcpu + VCPU_SIZE * i); 820 v = (struct kvm_vcpu *)((char *)vcpu +
821 sizeof(struct kvm_vcpu_data) * i);
821 VMX(v, itc_offset) = itc_offset; 822 VMX(v, itc_offset) = itc_offset;
822 VMX(v, last_itc) = 0; 823 VMX(v, last_itc) = 0;
823 } 824 }
@@ -1650,7 +1651,8 @@ void vcpu_set_psr(struct kvm_vcpu *vcpu, unsigned long val)
1650 * Otherwise panic 1651 * Otherwise panic
1651 */ 1652 */
1652 if (val & (IA64_PSR_PK | IA64_PSR_IS | IA64_PSR_VM)) 1653 if (val & (IA64_PSR_PK | IA64_PSR_IS | IA64_PSR_VM))
1653 panic_vm(vcpu); 1654 panic_vm(vcpu, "Only support guests with vpsr.pk =0 \
1655 & vpsr.is=0\n");
1654 1656
1655 /* 1657 /*
1656 * For those IA64_PSR bits: id/da/dd/ss/ed/ia 1658 * For those IA64_PSR bits: id/da/dd/ss/ed/ia
@@ -2103,7 +2105,7 @@ void kvm_init_all_rr(struct kvm_vcpu *vcpu)
2103 2105
2104 if (is_physical_mode(vcpu)) { 2106 if (is_physical_mode(vcpu)) {
2105 if (vcpu->arch.mode_flags & GUEST_PHY_EMUL) 2107 if (vcpu->arch.mode_flags & GUEST_PHY_EMUL)
2106 panic_vm(vcpu); 2108 panic_vm(vcpu, "Machine Status conflicts!\n");
2107 2109
2108 ia64_set_rr((VRN0 << VRN_SHIFT), vcpu->arch.metaphysical_rr0); 2110 ia64_set_rr((VRN0 << VRN_SHIFT), vcpu->arch.metaphysical_rr0);
2109 ia64_dv_serialize_data(); 2111 ia64_dv_serialize_data();
@@ -2152,10 +2154,70 @@ int vmm_entry(void)
2152 return 0; 2154 return 0;
2153} 2155}
2154 2156
2155void panic_vm(struct kvm_vcpu *v) 2157static void kvm_show_registers(struct kvm_pt_regs *regs)
2156{ 2158{
2159 unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri;
2160
2161 struct kvm_vcpu *vcpu = current_vcpu;
2162 if (vcpu != NULL)
2163 printk("vcpu 0x%p vcpu %d\n",
2164 vcpu, vcpu->vcpu_id);
2165
2166 printk("psr : %016lx ifs : %016lx ip : [<%016lx>]\n",
2167 regs->cr_ipsr, regs->cr_ifs, ip);
2168
2169 printk("unat: %016lx pfs : %016lx rsc : %016lx\n",
2170 regs->ar_unat, regs->ar_pfs, regs->ar_rsc);
2171 printk("rnat: %016lx bspstore: %016lx pr : %016lx\n",
2172 regs->ar_rnat, regs->ar_bspstore, regs->pr);
2173 printk("ldrs: %016lx ccv : %016lx fpsr: %016lx\n",
2174 regs->loadrs, regs->ar_ccv, regs->ar_fpsr);
2175 printk("csd : %016lx ssd : %016lx\n", regs->ar_csd, regs->ar_ssd);
2176 printk("b0 : %016lx b6 : %016lx b7 : %016lx\n", regs->b0,
2177 regs->b6, regs->b7);
2178 printk("f6 : %05lx%016lx f7 : %05lx%016lx\n",
2179 regs->f6.u.bits[1], regs->f6.u.bits[0],
2180 regs->f7.u.bits[1], regs->f7.u.bits[0]);
2181 printk("f8 : %05lx%016lx f9 : %05lx%016lx\n",
2182 regs->f8.u.bits[1], regs->f8.u.bits[0],
2183 regs->f9.u.bits[1], regs->f9.u.bits[0]);
2184 printk("f10 : %05lx%016lx f11 : %05lx%016lx\n",
2185 regs->f10.u.bits[1], regs->f10.u.bits[0],
2186 regs->f11.u.bits[1], regs->f11.u.bits[0]);
2187
2188 printk("r1 : %016lx r2 : %016lx r3 : %016lx\n", regs->r1,
2189 regs->r2, regs->r3);
2190 printk("r8 : %016lx r9 : %016lx r10 : %016lx\n", regs->r8,
2191 regs->r9, regs->r10);
2192 printk("r11 : %016lx r12 : %016lx r13 : %016lx\n", regs->r11,
2193 regs->r12, regs->r13);
2194 printk("r14 : %016lx r15 : %016lx r16 : %016lx\n", regs->r14,
2195 regs->r15, regs->r16);
2196 printk("r17 : %016lx r18 : %016lx r19 : %016lx\n", regs->r17,
2197 regs->r18, regs->r19);
2198 printk("r20 : %016lx r21 : %016lx r22 : %016lx\n", regs->r20,
2199 regs->r21, regs->r22);
2200 printk("r23 : %016lx r24 : %016lx r25 : %016lx\n", regs->r23,
2201 regs->r24, regs->r25);
2202 printk("r26 : %016lx r27 : %016lx r28 : %016lx\n", regs->r26,
2203 regs->r27, regs->r28);
2204 printk("r29 : %016lx r30 : %016lx r31 : %016lx\n", regs->r29,
2205 regs->r30, regs->r31);
2206
2207}
2208
2209void panic_vm(struct kvm_vcpu *v, const char *fmt, ...)
2210{
2211 va_list args;
2212 char buf[256];
2213
2214 struct kvm_pt_regs *regs = vcpu_regs(v);
2157 struct exit_ctl_data *p = &v->arch.exit_data; 2215 struct exit_ctl_data *p = &v->arch.exit_data;
2158 2216 va_start(args, fmt);
2217 vsnprintf(buf, sizeof(buf), fmt, args);
2218 va_end(args);
2219 printk(buf);
2220 kvm_show_registers(regs);
2159 p->exit_reason = EXIT_REASON_VM_PANIC; 2221 p->exit_reason = EXIT_REASON_VM_PANIC;
2160 vmm_transition(v); 2222 vmm_transition(v);
2161 /*Never to return*/ 2223 /*Never to return*/
diff --git a/arch/ia64/kvm/vcpu.h b/arch/ia64/kvm/vcpu.h
index e9b2a4e121c0..b2f12a562bdf 100644
--- a/arch/ia64/kvm/vcpu.h
+++ b/arch/ia64/kvm/vcpu.h
@@ -737,9 +737,12 @@ void kvm_init_vtlb(struct kvm_vcpu *v);
737void kvm_init_vhpt(struct kvm_vcpu *v); 737void kvm_init_vhpt(struct kvm_vcpu *v);
738void thash_init(struct thash_cb *hcb, u64 sz); 738void thash_init(struct thash_cb *hcb, u64 sz);
739 739
740void panic_vm(struct kvm_vcpu *v); 740void panic_vm(struct kvm_vcpu *v, const char *fmt, ...);
741 741
742extern u64 ia64_call_vsa(u64 proc, u64 arg1, u64 arg2, u64 arg3, 742extern u64 ia64_call_vsa(u64 proc, u64 arg1, u64 arg2, u64 arg3,
743 u64 arg4, u64 arg5, u64 arg6, u64 arg7); 743 u64 arg4, u64 arg5, u64 arg6, u64 arg7);
744
745extern long vmm_sanity;
746
744#endif 747#endif
745#endif /* __VCPU_H__ */ 748#endif /* __VCPU_H__ */
diff --git a/arch/ia64/kvm/vmm.c b/arch/ia64/kvm/vmm.c
index 2275bf4e681a..9eee5c04bacc 100644
--- a/arch/ia64/kvm/vmm.c
+++ b/arch/ia64/kvm/vmm.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22 22
23#include<linux/kernel.h>
23#include<linux/module.h> 24#include<linux/module.h>
24#include<asm/fpswa.h> 25#include<asm/fpswa.h>
25 26
@@ -31,6 +32,8 @@ MODULE_LICENSE("GPL");
31extern char kvm_ia64_ivt; 32extern char kvm_ia64_ivt;
32extern fpswa_interface_t *vmm_fpswa_interface; 33extern fpswa_interface_t *vmm_fpswa_interface;
33 34
35long vmm_sanity = 1;
36
34struct kvm_vmm_info vmm_info = { 37struct kvm_vmm_info vmm_info = {
35 .module = THIS_MODULE, 38 .module = THIS_MODULE,
36 .vmm_entry = vmm_entry, 39 .vmm_entry = vmm_entry,
@@ -62,5 +65,31 @@ void vmm_spin_unlock(spinlock_t *lock)
62{ 65{
63 _vmm_raw_spin_unlock(lock); 66 _vmm_raw_spin_unlock(lock);
64} 67}
68
69static void vcpu_debug_exit(struct kvm_vcpu *vcpu)
70{
71 struct exit_ctl_data *p = &vcpu->arch.exit_data;
72 long psr;
73
74 local_irq_save(psr);
75 p->exit_reason = EXIT_REASON_DEBUG;
76 vmm_transition(vcpu);
77 local_irq_restore(psr);
78}
79
80asmlinkage int printk(const char *fmt, ...)
81{
82 struct kvm_vcpu *vcpu = current_vcpu;
83 va_list args;
84 int r;
85
86 memset(vcpu->arch.log_buf, 0, VMM_LOG_LEN);
87 va_start(args, fmt);
88 r = vsnprintf(vcpu->arch.log_buf, VMM_LOG_LEN, fmt, args);
89 va_end(args);
90 vcpu_debug_exit(vcpu);
91 return r;
92}
93
65module_init(kvm_vmm_init) 94module_init(kvm_vmm_init)
66module_exit(kvm_vmm_exit) 95module_exit(kvm_vmm_exit)
diff --git a/arch/ia64/kvm/vmm_ivt.S b/arch/ia64/kvm/vmm_ivt.S
index c1d7251a1480..3ef1a017a318 100644
--- a/arch/ia64/kvm/vmm_ivt.S
+++ b/arch/ia64/kvm/vmm_ivt.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * /ia64/kvm_ivt.S 2 * arch/ia64/kvm/vmm_ivt.S
3 * 3 *
4 * Copyright (C) 1998-2001, 2003 Hewlett-Packard Co 4 * Copyright (C) 1998-2001, 2003 Hewlett-Packard Co
5 * Stephane Eranian <eranian@hpl.hp.com> 5 * Stephane Eranian <eranian@hpl.hp.com>
@@ -70,32 +70,39 @@
70# define PSR_DEFAULT_BITS 0 70# define PSR_DEFAULT_BITS 0
71#endif 71#endif
72 72
73
74#define KVM_FAULT(n) \ 73#define KVM_FAULT(n) \
75 kvm_fault_##n:; \ 74 kvm_fault_##n:; \
76 mov r19=n;; \ 75 mov r19=n;; \
77 br.sptk.many kvm_fault_##n; \ 76 br.sptk.many kvm_vmm_panic; \
78 ;; \ 77 ;; \
79
80 78
81#define KVM_REFLECT(n) \ 79#define KVM_REFLECT(n) \
82 mov r31=pr; \ 80 mov r31=pr; \
83 mov r19=n; /* prepare to save predicates */ \ 81 mov r19=n; /* prepare to save predicates */ \
84 mov r29=cr.ipsr; \ 82 mov r29=cr.ipsr; \
85 ;; \ 83 ;; \
86 tbit.z p6,p7=r29,IA64_PSR_VM_BIT; \ 84 tbit.z p6,p7=r29,IA64_PSR_VM_BIT; \
87(p7)br.sptk.many kvm_dispatch_reflection; \ 85(p7) br.sptk.many kvm_dispatch_reflection; \
88 br.sptk.many kvm_panic; \ 86 br.sptk.many kvm_vmm_panic; \
89 87
90 88GLOBAL_ENTRY(kvm_vmm_panic)
91GLOBAL_ENTRY(kvm_panic) 89 KVM_SAVE_MIN_WITH_COVER_R19
92 br.sptk.many kvm_panic 90 alloc r14=ar.pfs,0,0,1,0
93 ;; 91 mov out0=r15
94END(kvm_panic) 92 adds r3=8,r2 // set up second base pointer
95 93 ;;
96 94 ssm psr.ic
97 95 ;;
98 96 srlz.i // guarantee that interruption collection is on
97 ;;
98 //(p15) ssm psr.i // restore psr.i
99 addl r14=@gprel(ia64_leave_hypervisor),gp
100 ;;
101 KVM_SAVE_REST
102 mov rp=r14
103 ;;
104 br.call.sptk.many b6=vmm_panic_handler;
105END(kvm_vmm_panic)
99 106
100 .section .text.ivt,"ax" 107 .section .text.ivt,"ax"
101 108
@@ -105,308 +112,307 @@ kvm_ia64_ivt:
105/////////////////////////////////////////////////////////////// 112///////////////////////////////////////////////////////////////
106// 0x0000 Entry 0 (size 64 bundles) VHPT Translation (8,20,47) 113// 0x0000 Entry 0 (size 64 bundles) VHPT Translation (8,20,47)
107ENTRY(kvm_vhpt_miss) 114ENTRY(kvm_vhpt_miss)
108 KVM_FAULT(0) 115 KVM_FAULT(0)
109END(kvm_vhpt_miss) 116END(kvm_vhpt_miss)
110 117
111
112 .org kvm_ia64_ivt+0x400 118 .org kvm_ia64_ivt+0x400
113//////////////////////////////////////////////////////////////// 119////////////////////////////////////////////////////////////////
114// 0x0400 Entry 1 (size 64 bundles) ITLB (21) 120// 0x0400 Entry 1 (size 64 bundles) ITLB (21)
115ENTRY(kvm_itlb_miss) 121ENTRY(kvm_itlb_miss)
116 mov r31 = pr 122 mov r31 = pr
117 mov r29=cr.ipsr; 123 mov r29=cr.ipsr;
118 ;; 124 ;;
119 tbit.z p6,p7=r29,IA64_PSR_VM_BIT; 125 tbit.z p6,p7=r29,IA64_PSR_VM_BIT;
120 (p6) br.sptk kvm_alt_itlb_miss 126(p6) br.sptk kvm_alt_itlb_miss
121 mov r19 = 1 127 mov r19 = 1
122 br.sptk kvm_itlb_miss_dispatch 128 br.sptk kvm_itlb_miss_dispatch
123 KVM_FAULT(1); 129 KVM_FAULT(1);
124END(kvm_itlb_miss) 130END(kvm_itlb_miss)
125 131
126 .org kvm_ia64_ivt+0x0800 132 .org kvm_ia64_ivt+0x0800
127////////////////////////////////////////////////////////////////// 133//////////////////////////////////////////////////////////////////
128// 0x0800 Entry 2 (size 64 bundles) DTLB (9,48) 134// 0x0800 Entry 2 (size 64 bundles) DTLB (9,48)
129ENTRY(kvm_dtlb_miss) 135ENTRY(kvm_dtlb_miss)
130 mov r31 = pr 136 mov r31 = pr
131 mov r29=cr.ipsr; 137 mov r29=cr.ipsr;
132 ;; 138 ;;
133 tbit.z p6,p7=r29,IA64_PSR_VM_BIT; 139 tbit.z p6,p7=r29,IA64_PSR_VM_BIT;
134(p6)br.sptk kvm_alt_dtlb_miss 140(p6) br.sptk kvm_alt_dtlb_miss
135 br.sptk kvm_dtlb_miss_dispatch 141 br.sptk kvm_dtlb_miss_dispatch
136END(kvm_dtlb_miss) 142END(kvm_dtlb_miss)
137 143
138 .org kvm_ia64_ivt+0x0c00 144 .org kvm_ia64_ivt+0x0c00
139//////////////////////////////////////////////////////////////////// 145////////////////////////////////////////////////////////////////////
140// 0x0c00 Entry 3 (size 64 bundles) Alt ITLB (19) 146// 0x0c00 Entry 3 (size 64 bundles) Alt ITLB (19)
141ENTRY(kvm_alt_itlb_miss) 147ENTRY(kvm_alt_itlb_miss)
142 mov r16=cr.ifa // get address that caused the TLB miss 148 mov r16=cr.ifa // get address that caused the TLB miss
143 ;; 149 ;;
144 movl r17=PAGE_KERNEL 150 movl r17=PAGE_KERNEL
145 mov r24=cr.ipsr 151 mov r24=cr.ipsr
146 movl r19=(((1 << IA64_MAX_PHYS_BITS) - 1) & ~0xfff) 152 movl r19=(((1 << IA64_MAX_PHYS_BITS) - 1) & ~0xfff)
147 ;; 153 ;;
148 and r19=r19,r16 // clear ed, reserved bits, and PTE control bits 154 and r19=r19,r16 // clear ed, reserved bits, and PTE control bits
149 ;; 155 ;;
150 or r19=r17,r19 // insert PTE control bits into r19 156 or r19=r17,r19 // insert PTE control bits into r19
151 ;; 157 ;;
152 movl r20=IA64_GRANULE_SHIFT<<2 158 movl r20=IA64_GRANULE_SHIFT<<2
153 ;; 159 ;;
154 mov cr.itir=r20 160 mov cr.itir=r20
155 ;; 161 ;;
156 itc.i r19 // insert the TLB entry 162 itc.i r19 // insert the TLB entry
157 mov pr=r31,-1 163 mov pr=r31,-1
158 rfi 164 rfi
159END(kvm_alt_itlb_miss) 165END(kvm_alt_itlb_miss)
160 166
161 .org kvm_ia64_ivt+0x1000 167 .org kvm_ia64_ivt+0x1000
162///////////////////////////////////////////////////////////////////// 168/////////////////////////////////////////////////////////////////////
163// 0x1000 Entry 4 (size 64 bundles) Alt DTLB (7,46) 169// 0x1000 Entry 4 (size 64 bundles) Alt DTLB (7,46)
164ENTRY(kvm_alt_dtlb_miss) 170ENTRY(kvm_alt_dtlb_miss)
165 mov r16=cr.ifa // get address that caused the TLB miss 171 mov r16=cr.ifa // get address that caused the TLB miss
166 ;; 172 ;;
167 movl r17=PAGE_KERNEL 173 movl r17=PAGE_KERNEL
168 movl r19=(((1 << IA64_MAX_PHYS_BITS) - 1) & ~0xfff) 174 movl r19=(((1 << IA64_MAX_PHYS_BITS) - 1) & ~0xfff)
169 mov r24=cr.ipsr 175 mov r24=cr.ipsr
170 ;; 176 ;;
171 and r19=r19,r16 // clear ed, reserved bits, and PTE control bits 177 and r19=r19,r16 // clear ed, reserved bits, and PTE control bits
172 ;; 178 ;;
173 or r19=r19,r17 // insert PTE control bits into r19 179 or r19=r19,r17 // insert PTE control bits into r19
174 ;; 180 ;;
175 movl r20=IA64_GRANULE_SHIFT<<2 181 movl r20=IA64_GRANULE_SHIFT<<2
176 ;; 182 ;;
177 mov cr.itir=r20 183 mov cr.itir=r20
178 ;; 184 ;;
179 itc.d r19 // insert the TLB entry 185 itc.d r19 // insert the TLB entry
180 mov pr=r31,-1 186 mov pr=r31,-1
181 rfi 187 rfi
182END(kvm_alt_dtlb_miss) 188END(kvm_alt_dtlb_miss)
183 189
184 .org kvm_ia64_ivt+0x1400 190 .org kvm_ia64_ivt+0x1400
185////////////////////////////////////////////////////////////////////// 191//////////////////////////////////////////////////////////////////////
186// 0x1400 Entry 5 (size 64 bundles) Data nested TLB (6,45) 192// 0x1400 Entry 5 (size 64 bundles) Data nested TLB (6,45)
187ENTRY(kvm_nested_dtlb_miss) 193ENTRY(kvm_nested_dtlb_miss)
188 KVM_FAULT(5) 194 KVM_FAULT(5)
189END(kvm_nested_dtlb_miss) 195END(kvm_nested_dtlb_miss)
190 196
191 .org kvm_ia64_ivt+0x1800 197 .org kvm_ia64_ivt+0x1800
192///////////////////////////////////////////////////////////////////// 198/////////////////////////////////////////////////////////////////////
193// 0x1800 Entry 6 (size 64 bundles) Instruction Key Miss (24) 199// 0x1800 Entry 6 (size 64 bundles) Instruction Key Miss (24)
194ENTRY(kvm_ikey_miss) 200ENTRY(kvm_ikey_miss)
195 KVM_REFLECT(6) 201 KVM_REFLECT(6)
196END(kvm_ikey_miss) 202END(kvm_ikey_miss)
197 203
198 .org kvm_ia64_ivt+0x1c00 204 .org kvm_ia64_ivt+0x1c00
199///////////////////////////////////////////////////////////////////// 205/////////////////////////////////////////////////////////////////////
200// 0x1c00 Entry 7 (size 64 bundles) Data Key Miss (12,51) 206// 0x1c00 Entry 7 (size 64 bundles) Data Key Miss (12,51)
201ENTRY(kvm_dkey_miss) 207ENTRY(kvm_dkey_miss)
202 KVM_REFLECT(7) 208 KVM_REFLECT(7)
203END(kvm_dkey_miss) 209END(kvm_dkey_miss)
204 210
205 .org kvm_ia64_ivt+0x2000 211 .org kvm_ia64_ivt+0x2000
206//////////////////////////////////////////////////////////////////// 212////////////////////////////////////////////////////////////////////
207// 0x2000 Entry 8 (size 64 bundles) Dirty-bit (54) 213// 0x2000 Entry 8 (size 64 bundles) Dirty-bit (54)
208ENTRY(kvm_dirty_bit) 214ENTRY(kvm_dirty_bit)
209 KVM_REFLECT(8) 215 KVM_REFLECT(8)
210END(kvm_dirty_bit) 216END(kvm_dirty_bit)
211 217
212 .org kvm_ia64_ivt+0x2400 218 .org kvm_ia64_ivt+0x2400
213//////////////////////////////////////////////////////////////////// 219////////////////////////////////////////////////////////////////////
214// 0x2400 Entry 9 (size 64 bundles) Instruction Access-bit (27) 220// 0x2400 Entry 9 (size 64 bundles) Instruction Access-bit (27)
215ENTRY(kvm_iaccess_bit) 221ENTRY(kvm_iaccess_bit)
216 KVM_REFLECT(9) 222 KVM_REFLECT(9)
217END(kvm_iaccess_bit) 223END(kvm_iaccess_bit)
218 224
219 .org kvm_ia64_ivt+0x2800 225 .org kvm_ia64_ivt+0x2800
220/////////////////////////////////////////////////////////////////// 226///////////////////////////////////////////////////////////////////
221// 0x2800 Entry 10 (size 64 bundles) Data Access-bit (15,55) 227// 0x2800 Entry 10 (size 64 bundles) Data Access-bit (15,55)
222ENTRY(kvm_daccess_bit) 228ENTRY(kvm_daccess_bit)
223 KVM_REFLECT(10) 229 KVM_REFLECT(10)
224END(kvm_daccess_bit) 230END(kvm_daccess_bit)
225 231
226 .org kvm_ia64_ivt+0x2c00 232 .org kvm_ia64_ivt+0x2c00
227///////////////////////////////////////////////////////////////// 233/////////////////////////////////////////////////////////////////
228// 0x2c00 Entry 11 (size 64 bundles) Break instruction (33) 234// 0x2c00 Entry 11 (size 64 bundles) Break instruction (33)
229ENTRY(kvm_break_fault) 235ENTRY(kvm_break_fault)
230 mov r31=pr 236 mov r31=pr
231 mov r19=11 237 mov r19=11
232 mov r29=cr.ipsr 238 mov r29=cr.ipsr
233 ;; 239 ;;
234 KVM_SAVE_MIN_WITH_COVER_R19 240 KVM_SAVE_MIN_WITH_COVER_R19
235 ;; 241 ;;
236 alloc r14=ar.pfs,0,0,4,0 // now it's safe (must be first in insn group!) 242 alloc r14=ar.pfs,0,0,4,0 //(must be first in insn group!)
237 mov out0=cr.ifa 243 mov out0=cr.ifa
238 mov out2=cr.isr // FIXME: pity to make this slow access twice 244 mov out2=cr.isr // FIXME: pity to make this slow access twice
239 mov out3=cr.iim // FIXME: pity to make this slow access twice 245 mov out3=cr.iim // FIXME: pity to make this slow access twice
240 adds r3=8,r2 // set up second base pointer 246 adds r3=8,r2 // set up second base pointer
241 ;; 247 ;;
242 ssm psr.ic 248 ssm psr.ic
243 ;; 249 ;;
244 srlz.i // guarantee that interruption collection is on 250 srlz.i // guarantee that interruption collection is on
245 ;; 251 ;;
246 //(p15)ssm psr.i // restore psr.i 252 //(p15)ssm psr.i // restore psr.i
247 addl r14=@gprel(ia64_leave_hypervisor),gp 253 addl r14=@gprel(ia64_leave_hypervisor),gp
248 ;; 254 ;;
249 KVM_SAVE_REST 255 KVM_SAVE_REST
250 mov rp=r14 256 mov rp=r14
251 ;; 257 ;;
252 adds out1=16,sp 258 adds out1=16,sp
253 br.call.sptk.many b6=kvm_ia64_handle_break 259 br.call.sptk.many b6=kvm_ia64_handle_break
254 ;; 260 ;;
255END(kvm_break_fault) 261END(kvm_break_fault)
256 262
257 .org kvm_ia64_ivt+0x3000 263 .org kvm_ia64_ivt+0x3000
258///////////////////////////////////////////////////////////////// 264/////////////////////////////////////////////////////////////////
259// 0x3000 Entry 12 (size 64 bundles) External Interrupt (4) 265// 0x3000 Entry 12 (size 64 bundles) External Interrupt (4)
260ENTRY(kvm_interrupt) 266ENTRY(kvm_interrupt)
261 mov r31=pr // prepare to save predicates 267 mov r31=pr // prepare to save predicates
262 mov r19=12 268 mov r19=12
263 mov r29=cr.ipsr 269 mov r29=cr.ipsr
264 ;; 270 ;;
265 tbit.z p6,p7=r29,IA64_PSR_VM_BIT 271 tbit.z p6,p7=r29,IA64_PSR_VM_BIT
266 tbit.z p0,p15=r29,IA64_PSR_I_BIT 272 tbit.z p0,p15=r29,IA64_PSR_I_BIT
267 ;; 273 ;;
268(p7) br.sptk kvm_dispatch_interrupt 274(p7) br.sptk kvm_dispatch_interrupt
269 ;; 275 ;;
270 mov r27=ar.rsc /* M */ 276 mov r27=ar.rsc /* M */
271 mov r20=r1 /* A */ 277 mov r20=r1 /* A */
272 mov r25=ar.unat /* M */ 278 mov r25=ar.unat /* M */
273 mov r26=ar.pfs /* I */ 279 mov r26=ar.pfs /* I */
274 mov r28=cr.iip /* M */ 280 mov r28=cr.iip /* M */
275 cover /* B (or nothing) */ 281 cover /* B (or nothing) */
276 ;; 282 ;;
277 mov r1=sp 283 mov r1=sp
278 ;; 284 ;;
279 invala /* M */ 285 invala /* M */
280 mov r30=cr.ifs 286 mov r30=cr.ifs
281 ;; 287 ;;
282 addl r1=-VMM_PT_REGS_SIZE,r1 288 addl r1=-VMM_PT_REGS_SIZE,r1
283 ;; 289 ;;
284 adds r17=2*L1_CACHE_BYTES,r1 /* really: biggest cache-line size */ 290 adds r17=2*L1_CACHE_BYTES,r1 /* really: biggest cache-line size */
285 adds r16=PT(CR_IPSR),r1 291 adds r16=PT(CR_IPSR),r1
286 ;; 292 ;;
287 lfetch.fault.excl.nt1 [r17],L1_CACHE_BYTES 293 lfetch.fault.excl.nt1 [r17],L1_CACHE_BYTES
288 st8 [r16]=r29 /* save cr.ipsr */ 294 st8 [r16]=r29 /* save cr.ipsr */
289 ;; 295 ;;
290 lfetch.fault.excl.nt1 [r17] 296 lfetch.fault.excl.nt1 [r17]
291 mov r29=b0 297 mov r29=b0
292 ;; 298 ;;
293 adds r16=PT(R8),r1 /* initialize first base pointer */ 299 adds r16=PT(R8),r1 /* initialize first base pointer */
294 adds r17=PT(R9),r1 /* initialize second base pointer */ 300 adds r17=PT(R9),r1 /* initialize second base pointer */
295 mov r18=r0 /* make sure r18 isn't NaT */ 301 mov r18=r0 /* make sure r18 isn't NaT */
296 ;; 302 ;;
297.mem.offset 0,0; st8.spill [r16]=r8,16 303.mem.offset 0,0; st8.spill [r16]=r8,16
298.mem.offset 8,0; st8.spill [r17]=r9,16 304.mem.offset 8,0; st8.spill [r17]=r9,16
299 ;; 305 ;;
300.mem.offset 0,0; st8.spill [r16]=r10,24 306.mem.offset 0,0; st8.spill [r16]=r10,24
301.mem.offset 8,0; st8.spill [r17]=r11,24 307.mem.offset 8,0; st8.spill [r17]=r11,24
302 ;; 308 ;;
303 st8 [r16]=r28,16 /* save cr.iip */ 309 st8 [r16]=r28,16 /* save cr.iip */
304 st8 [r17]=r30,16 /* save cr.ifs */ 310 st8 [r17]=r30,16 /* save cr.ifs */
305 mov r8=ar.fpsr /* M */ 311 mov r8=ar.fpsr /* M */
306 mov r9=ar.csd 312 mov r9=ar.csd
307 mov r10=ar.ssd 313 mov r10=ar.ssd
308 movl r11=FPSR_DEFAULT /* L-unit */ 314 movl r11=FPSR_DEFAULT /* L-unit */
309 ;; 315 ;;
310 st8 [r16]=r25,16 /* save ar.unat */ 316 st8 [r16]=r25,16 /* save ar.unat */
311 st8 [r17]=r26,16 /* save ar.pfs */ 317 st8 [r17]=r26,16 /* save ar.pfs */
312 shl r18=r18,16 /* compute ar.rsc to be used for "loadrs" */ 318 shl r18=r18,16 /* compute ar.rsc to be used for "loadrs" */
313 ;; 319 ;;
314 st8 [r16]=r27,16 /* save ar.rsc */ 320 st8 [r16]=r27,16 /* save ar.rsc */
315 adds r17=16,r17 /* skip over ar_rnat field */ 321 adds r17=16,r17 /* skip over ar_rnat field */
316 ;; 322 ;;
317 st8 [r17]=r31,16 /* save predicates */ 323 st8 [r17]=r31,16 /* save predicates */
318 adds r16=16,r16 /* skip over ar_bspstore field */ 324 adds r16=16,r16 /* skip over ar_bspstore field */
319 ;; 325 ;;
320 st8 [r16]=r29,16 /* save b0 */ 326 st8 [r16]=r29,16 /* save b0 */
321 st8 [r17]=r18,16 /* save ar.rsc value for "loadrs" */ 327 st8 [r17]=r18,16 /* save ar.rsc value for "loadrs" */
322 ;; 328 ;;
323.mem.offset 0,0; st8.spill [r16]=r20,16 /* save original r1 */ 329.mem.offset 0,0; st8.spill [r16]=r20,16 /* save original r1 */
324.mem.offset 8,0; st8.spill [r17]=r12,16 330.mem.offset 8,0; st8.spill [r17]=r12,16
325 adds r12=-16,r1 331 adds r12=-16,r1
326 /* switch to kernel memory stack (with 16 bytes of scratch) */ 332 /* switch to kernel memory stack (with 16 bytes of scratch) */
327 ;; 333 ;;
328.mem.offset 0,0; st8.spill [r16]=r13,16 334.mem.offset 0,0; st8.spill [r16]=r13,16
329.mem.offset 8,0; st8.spill [r17]=r8,16 /* save ar.fpsr */ 335.mem.offset 8,0; st8.spill [r17]=r8,16 /* save ar.fpsr */
330 ;; 336 ;;
331.mem.offset 0,0; st8.spill [r16]=r15,16 337.mem.offset 0,0; st8.spill [r16]=r15,16
332.mem.offset 8,0; st8.spill [r17]=r14,16 338.mem.offset 8,0; st8.spill [r17]=r14,16
333 dep r14=-1,r0,60,4 339 dep r14=-1,r0,60,4
334 ;; 340 ;;
335.mem.offset 0,0; st8.spill [r16]=r2,16 341.mem.offset 0,0; st8.spill [r16]=r2,16
336.mem.offset 8,0; st8.spill [r17]=r3,16 342.mem.offset 8,0; st8.spill [r17]=r3,16
337 adds r2=VMM_PT_REGS_R16_OFFSET,r1 343 adds r2=VMM_PT_REGS_R16_OFFSET,r1
338 adds r14 = VMM_VCPU_GP_OFFSET,r13 344 adds r14 = VMM_VCPU_GP_OFFSET,r13
339 ;; 345 ;;
340 mov r8=ar.ccv 346 mov r8=ar.ccv
341 ld8 r14 = [r14] 347 ld8 r14 = [r14]
342 ;; 348 ;;
343 mov r1=r14 /* establish kernel global pointer */ 349 mov r1=r14 /* establish kernel global pointer */
344 ;; \ 350 ;; \
345 bsw.1 351 bsw.1
346 ;; 352 ;;
347 alloc r14=ar.pfs,0,0,1,0 // must be first in an insn group 353 alloc r14=ar.pfs,0,0,1,0 // must be first in an insn group
348 mov out0=r13 354 mov out0=r13
349 ;; 355 ;;
350 ssm psr.ic 356 ssm psr.ic
351 ;; 357 ;;
352 srlz.i 358 srlz.i
353 ;; 359 ;;
354 //(p15) ssm psr.i 360 //(p15) ssm psr.i
355 adds r3=8,r2 // set up second base pointer for SAVE_REST 361 adds r3=8,r2 // set up second base pointer for SAVE_REST
356 srlz.i // ensure everybody knows psr.ic is back on 362 srlz.i // ensure everybody knows psr.ic is back on
357 ;; 363 ;;
358.mem.offset 0,0; st8.spill [r2]=r16,16 364.mem.offset 0,0; st8.spill [r2]=r16,16
359.mem.offset 8,0; st8.spill [r3]=r17,16 365.mem.offset 8,0; st8.spill [r3]=r17,16
360 ;; 366 ;;
361.mem.offset 0,0; st8.spill [r2]=r18,16 367.mem.offset 0,0; st8.spill [r2]=r18,16
362.mem.offset 8,0; st8.spill [r3]=r19,16 368.mem.offset 8,0; st8.spill [r3]=r19,16
363 ;; 369 ;;
364.mem.offset 0,0; st8.spill [r2]=r20,16 370.mem.offset 0,0; st8.spill [r2]=r20,16
365.mem.offset 8,0; st8.spill [r3]=r21,16 371.mem.offset 8,0; st8.spill [r3]=r21,16
366 mov r18=b6 372 mov r18=b6
367 ;; 373 ;;
368.mem.offset 0,0; st8.spill [r2]=r22,16 374.mem.offset 0,0; st8.spill [r2]=r22,16
369.mem.offset 8,0; st8.spill [r3]=r23,16 375.mem.offset 8,0; st8.spill [r3]=r23,16
370 mov r19=b7 376 mov r19=b7
371 ;; 377 ;;
372.mem.offset 0,0; st8.spill [r2]=r24,16 378.mem.offset 0,0; st8.spill [r2]=r24,16
373.mem.offset 8,0; st8.spill [r3]=r25,16 379.mem.offset 8,0; st8.spill [r3]=r25,16
374 ;; 380 ;;
375.mem.offset 0,0; st8.spill [r2]=r26,16 381.mem.offset 0,0; st8.spill [r2]=r26,16
376.mem.offset 8,0; st8.spill [r3]=r27,16 382.mem.offset 8,0; st8.spill [r3]=r27,16
377 ;; 383 ;;
378.mem.offset 0,0; st8.spill [r2]=r28,16 384.mem.offset 0,0; st8.spill [r2]=r28,16
379.mem.offset 8,0; st8.spill [r3]=r29,16 385.mem.offset 8,0; st8.spill [r3]=r29,16
380 ;; 386 ;;
381.mem.offset 0,0; st8.spill [r2]=r30,16 387.mem.offset 0,0; st8.spill [r2]=r30,16
382.mem.offset 8,0; st8.spill [r3]=r31,32 388.mem.offset 8,0; st8.spill [r3]=r31,32
383 ;; 389 ;;
384 mov ar.fpsr=r11 /* M-unit */ 390 mov ar.fpsr=r11 /* M-unit */
385 st8 [r2]=r8,8 /* ar.ccv */ 391 st8 [r2]=r8,8 /* ar.ccv */
386 adds r24=PT(B6)-PT(F7),r3 392 adds r24=PT(B6)-PT(F7),r3
387 ;; 393 ;;
388 stf.spill [r2]=f6,32 394 stf.spill [r2]=f6,32
389 stf.spill [r3]=f7,32 395 stf.spill [r3]=f7,32
390 ;; 396 ;;
391 stf.spill [r2]=f8,32 397 stf.spill [r2]=f8,32
392 stf.spill [r3]=f9,32 398 stf.spill [r3]=f9,32
393 ;; 399 ;;
394 stf.spill [r2]=f10 400 stf.spill [r2]=f10
395 stf.spill [r3]=f11 401 stf.spill [r3]=f11
396 adds r25=PT(B7)-PT(F11),r3 402 adds r25=PT(B7)-PT(F11),r3
397 ;; 403 ;;
398 st8 [r24]=r18,16 /* b6 */ 404 st8 [r24]=r18,16 /* b6 */
399 st8 [r25]=r19,16 /* b7 */ 405 st8 [r25]=r19,16 /* b7 */
400 ;; 406 ;;
401 st8 [r24]=r9 /* ar.csd */ 407 st8 [r24]=r9 /* ar.csd */
402 st8 [r25]=r10 /* ar.ssd */ 408 st8 [r25]=r10 /* ar.ssd */
403 ;; 409 ;;
404 srlz.d // make sure we see the effect of cr.ivr 410 srlz.d // make sure we see the effect of cr.ivr
405 addl r14=@gprel(ia64_leave_nested),gp 411 addl r14=@gprel(ia64_leave_nested),gp
406 ;; 412 ;;
407 mov rp=r14 413 mov rp=r14
408 br.call.sptk.many b6=kvm_ia64_handle_irq 414 br.call.sptk.many b6=kvm_ia64_handle_irq
409 ;; 415 ;;
410END(kvm_interrupt) 416END(kvm_interrupt)
411 417
412 .global kvm_dispatch_vexirq 418 .global kvm_dispatch_vexirq
@@ -414,387 +420,385 @@ END(kvm_interrupt)
414////////////////////////////////////////////////////////////////////// 420//////////////////////////////////////////////////////////////////////
415// 0x3400 Entry 13 (size 64 bundles) Reserved 421// 0x3400 Entry 13 (size 64 bundles) Reserved
416ENTRY(kvm_virtual_exirq) 422ENTRY(kvm_virtual_exirq)
417 mov r31=pr 423 mov r31=pr
418 mov r19=13 424 mov r19=13
419 mov r30 =r0 425 mov r30 =r0
420 ;; 426 ;;
421kvm_dispatch_vexirq: 427kvm_dispatch_vexirq:
422 cmp.eq p6,p0 = 1,r30 428 cmp.eq p6,p0 = 1,r30
423 ;; 429 ;;
424(p6)add r29 = VMM_VCPU_SAVED_GP_OFFSET,r21 430(p6) add r29 = VMM_VCPU_SAVED_GP_OFFSET,r21
425 ;; 431 ;;
426(p6)ld8 r1 = [r29] 432(p6) ld8 r1 = [r29]
427 ;; 433 ;;
428 KVM_SAVE_MIN_WITH_COVER_R19 434 KVM_SAVE_MIN_WITH_COVER_R19
429 alloc r14=ar.pfs,0,0,1,0 435 alloc r14=ar.pfs,0,0,1,0
430 mov out0=r13 436 mov out0=r13
431 437
432 ssm psr.ic 438 ssm psr.ic
433 ;; 439 ;;
434 srlz.i // guarantee that interruption collection is on 440 srlz.i // guarantee that interruption collection is on
435 ;; 441 ;;
436 //(p15) ssm psr.i // restore psr.i 442 //(p15) ssm psr.i // restore psr.i
437 adds r3=8,r2 // set up second base pointer 443 adds r3=8,r2 // set up second base pointer
438 ;; 444 ;;
439 KVM_SAVE_REST 445 KVM_SAVE_REST
440 addl r14=@gprel(ia64_leave_hypervisor),gp 446 addl r14=@gprel(ia64_leave_hypervisor),gp
441 ;; 447 ;;
442 mov rp=r14 448 mov rp=r14
443 br.call.sptk.many b6=kvm_vexirq 449 br.call.sptk.many b6=kvm_vexirq
444END(kvm_virtual_exirq) 450END(kvm_virtual_exirq)
445 451
446 .org kvm_ia64_ivt+0x3800 452 .org kvm_ia64_ivt+0x3800
447///////////////////////////////////////////////////////////////////// 453/////////////////////////////////////////////////////////////////////
448// 0x3800 Entry 14 (size 64 bundles) Reserved 454// 0x3800 Entry 14 (size 64 bundles) Reserved
449 KVM_FAULT(14) 455 KVM_FAULT(14)
450 // this code segment is from 2.6.16.13 456 // this code segment is from 2.6.16.13
451
452 457
453 .org kvm_ia64_ivt+0x3c00 458 .org kvm_ia64_ivt+0x3c00
454/////////////////////////////////////////////////////////////////////// 459///////////////////////////////////////////////////////////////////////
455// 0x3c00 Entry 15 (size 64 bundles) Reserved 460// 0x3c00 Entry 15 (size 64 bundles) Reserved
456 KVM_FAULT(15) 461 KVM_FAULT(15)
457
458 462
459 .org kvm_ia64_ivt+0x4000 463 .org kvm_ia64_ivt+0x4000
460/////////////////////////////////////////////////////////////////////// 464///////////////////////////////////////////////////////////////////////
461// 0x4000 Entry 16 (size 64 bundles) Reserved 465// 0x4000 Entry 16 (size 64 bundles) Reserved
462 KVM_FAULT(16) 466 KVM_FAULT(16)
463 467
464 .org kvm_ia64_ivt+0x4400 468 .org kvm_ia64_ivt+0x4400
465////////////////////////////////////////////////////////////////////// 469//////////////////////////////////////////////////////////////////////
466// 0x4400 Entry 17 (size 64 bundles) Reserved 470// 0x4400 Entry 17 (size 64 bundles) Reserved
467 KVM_FAULT(17) 471 KVM_FAULT(17)
468 472
469 .org kvm_ia64_ivt+0x4800 473 .org kvm_ia64_ivt+0x4800
470////////////////////////////////////////////////////////////////////// 474//////////////////////////////////////////////////////////////////////
471// 0x4800 Entry 18 (size 64 bundles) Reserved 475// 0x4800 Entry 18 (size 64 bundles) Reserved
472 KVM_FAULT(18) 476 KVM_FAULT(18)
473 477
474 .org kvm_ia64_ivt+0x4c00 478 .org kvm_ia64_ivt+0x4c00
475////////////////////////////////////////////////////////////////////// 479//////////////////////////////////////////////////////////////////////
476// 0x4c00 Entry 19 (size 64 bundles) Reserved 480// 0x4c00 Entry 19 (size 64 bundles) Reserved
477 KVM_FAULT(19) 481 KVM_FAULT(19)
478 482
479 .org kvm_ia64_ivt+0x5000 483 .org kvm_ia64_ivt+0x5000
480////////////////////////////////////////////////////////////////////// 484//////////////////////////////////////////////////////////////////////
481// 0x5000 Entry 20 (size 16 bundles) Page Not Present 485// 0x5000 Entry 20 (size 16 bundles) Page Not Present
482ENTRY(kvm_page_not_present) 486ENTRY(kvm_page_not_present)
483 KVM_REFLECT(20) 487 KVM_REFLECT(20)
484END(kvm_page_not_present) 488END(kvm_page_not_present)
485 489
486 .org kvm_ia64_ivt+0x5100 490 .org kvm_ia64_ivt+0x5100
487/////////////////////////////////////////////////////////////////////// 491///////////////////////////////////////////////////////////////////////
488// 0x5100 Entry 21 (size 16 bundles) Key Permission vector 492// 0x5100 Entry 21 (size 16 bundles) Key Permission vector
489ENTRY(kvm_key_permission) 493ENTRY(kvm_key_permission)
490 KVM_REFLECT(21) 494 KVM_REFLECT(21)
491END(kvm_key_permission) 495END(kvm_key_permission)
492 496
493 .org kvm_ia64_ivt+0x5200 497 .org kvm_ia64_ivt+0x5200
494////////////////////////////////////////////////////////////////////// 498//////////////////////////////////////////////////////////////////////
495// 0x5200 Entry 22 (size 16 bundles) Instruction Access Rights (26) 499// 0x5200 Entry 22 (size 16 bundles) Instruction Access Rights (26)
496ENTRY(kvm_iaccess_rights) 500ENTRY(kvm_iaccess_rights)
497 KVM_REFLECT(22) 501 KVM_REFLECT(22)
498END(kvm_iaccess_rights) 502END(kvm_iaccess_rights)
499 503
500 .org kvm_ia64_ivt+0x5300 504 .org kvm_ia64_ivt+0x5300
501////////////////////////////////////////////////////////////////////// 505//////////////////////////////////////////////////////////////////////
502// 0x5300 Entry 23 (size 16 bundles) Data Access Rights (14,53) 506// 0x5300 Entry 23 (size 16 bundles) Data Access Rights (14,53)
503ENTRY(kvm_daccess_rights) 507ENTRY(kvm_daccess_rights)
504 KVM_REFLECT(23) 508 KVM_REFLECT(23)
505END(kvm_daccess_rights) 509END(kvm_daccess_rights)
506 510
507 .org kvm_ia64_ivt+0x5400 511 .org kvm_ia64_ivt+0x5400
508///////////////////////////////////////////////////////////////////// 512/////////////////////////////////////////////////////////////////////
509// 0x5400 Entry 24 (size 16 bundles) General Exception (5,32,34,36,38,39) 513// 0x5400 Entry 24 (size 16 bundles) General Exception (5,32,34,36,38,39)
510ENTRY(kvm_general_exception) 514ENTRY(kvm_general_exception)
511 KVM_REFLECT(24) 515 KVM_REFLECT(24)
512 KVM_FAULT(24) 516 KVM_FAULT(24)
513END(kvm_general_exception) 517END(kvm_general_exception)
514 518
515 .org kvm_ia64_ivt+0x5500 519 .org kvm_ia64_ivt+0x5500
516////////////////////////////////////////////////////////////////////// 520//////////////////////////////////////////////////////////////////////
517// 0x5500 Entry 25 (size 16 bundles) Disabled FP-Register (35) 521// 0x5500 Entry 25 (size 16 bundles) Disabled FP-Register (35)
518ENTRY(kvm_disabled_fp_reg) 522ENTRY(kvm_disabled_fp_reg)
519 KVM_REFLECT(25) 523 KVM_REFLECT(25)
520END(kvm_disabled_fp_reg) 524END(kvm_disabled_fp_reg)
521 525
522 .org kvm_ia64_ivt+0x5600 526 .org kvm_ia64_ivt+0x5600
523//////////////////////////////////////////////////////////////////// 527////////////////////////////////////////////////////////////////////
524// 0x5600 Entry 26 (size 16 bundles) Nat Consumption (11,23,37,50) 528// 0x5600 Entry 26 (size 16 bundles) Nat Consumption (11,23,37,50)
525ENTRY(kvm_nat_consumption) 529ENTRY(kvm_nat_consumption)
526 KVM_REFLECT(26) 530 KVM_REFLECT(26)
527END(kvm_nat_consumption) 531END(kvm_nat_consumption)
528 532
529 .org kvm_ia64_ivt+0x5700 533 .org kvm_ia64_ivt+0x5700
530///////////////////////////////////////////////////////////////////// 534/////////////////////////////////////////////////////////////////////
531// 0x5700 Entry 27 (size 16 bundles) Speculation (40) 535// 0x5700 Entry 27 (size 16 bundles) Speculation (40)
532ENTRY(kvm_speculation_vector) 536ENTRY(kvm_speculation_vector)
533 KVM_REFLECT(27) 537 KVM_REFLECT(27)
534END(kvm_speculation_vector) 538END(kvm_speculation_vector)
535 539
536 .org kvm_ia64_ivt+0x5800 540 .org kvm_ia64_ivt+0x5800
537///////////////////////////////////////////////////////////////////// 541/////////////////////////////////////////////////////////////////////
538// 0x5800 Entry 28 (size 16 bundles) Reserved 542// 0x5800 Entry 28 (size 16 bundles) Reserved
539 KVM_FAULT(28) 543 KVM_FAULT(28)
540 544
541 .org kvm_ia64_ivt+0x5900 545 .org kvm_ia64_ivt+0x5900
542/////////////////////////////////////////////////////////////////// 546///////////////////////////////////////////////////////////////////
543// 0x5900 Entry 29 (size 16 bundles) Debug (16,28,56) 547// 0x5900 Entry 29 (size 16 bundles) Debug (16,28,56)
544ENTRY(kvm_debug_vector) 548ENTRY(kvm_debug_vector)
545 KVM_FAULT(29) 549 KVM_FAULT(29)
546END(kvm_debug_vector) 550END(kvm_debug_vector)
547 551
548 .org kvm_ia64_ivt+0x5a00 552 .org kvm_ia64_ivt+0x5a00
549/////////////////////////////////////////////////////////////// 553///////////////////////////////////////////////////////////////
550// 0x5a00 Entry 30 (size 16 bundles) Unaligned Reference (57) 554// 0x5a00 Entry 30 (size 16 bundles) Unaligned Reference (57)
551ENTRY(kvm_unaligned_access) 555ENTRY(kvm_unaligned_access)
552 KVM_REFLECT(30) 556 KVM_REFLECT(30)
553END(kvm_unaligned_access) 557END(kvm_unaligned_access)
554 558
555 .org kvm_ia64_ivt+0x5b00 559 .org kvm_ia64_ivt+0x5b00
556////////////////////////////////////////////////////////////////////// 560//////////////////////////////////////////////////////////////////////
557// 0x5b00 Entry 31 (size 16 bundles) Unsupported Data Reference (57) 561// 0x5b00 Entry 31 (size 16 bundles) Unsupported Data Reference (57)
558ENTRY(kvm_unsupported_data_reference) 562ENTRY(kvm_unsupported_data_reference)
559 KVM_REFLECT(31) 563 KVM_REFLECT(31)
560END(kvm_unsupported_data_reference) 564END(kvm_unsupported_data_reference)
561 565
562 .org kvm_ia64_ivt+0x5c00 566 .org kvm_ia64_ivt+0x5c00
563//////////////////////////////////////////////////////////////////// 567////////////////////////////////////////////////////////////////////
564// 0x5c00 Entry 32 (size 16 bundles) Floating Point FAULT (65) 568// 0x5c00 Entry 32 (size 16 bundles) Floating Point FAULT (65)
565ENTRY(kvm_floating_point_fault) 569ENTRY(kvm_floating_point_fault)
566 KVM_REFLECT(32) 570 KVM_REFLECT(32)
567END(kvm_floating_point_fault) 571END(kvm_floating_point_fault)
568 572
569 .org kvm_ia64_ivt+0x5d00 573 .org kvm_ia64_ivt+0x5d00
570///////////////////////////////////////////////////////////////////// 574/////////////////////////////////////////////////////////////////////
571// 0x5d00 Entry 33 (size 16 bundles) Floating Point Trap (66) 575// 0x5d00 Entry 33 (size 16 bundles) Floating Point Trap (66)
572ENTRY(kvm_floating_point_trap) 576ENTRY(kvm_floating_point_trap)
573 KVM_REFLECT(33) 577 KVM_REFLECT(33)
574END(kvm_floating_point_trap) 578END(kvm_floating_point_trap)
575 579
576 .org kvm_ia64_ivt+0x5e00 580 .org kvm_ia64_ivt+0x5e00
577////////////////////////////////////////////////////////////////////// 581//////////////////////////////////////////////////////////////////////
578// 0x5e00 Entry 34 (size 16 bundles) Lower Privilege Transfer Trap (66) 582// 0x5e00 Entry 34 (size 16 bundles) Lower Privilege Transfer Trap (66)
579ENTRY(kvm_lower_privilege_trap) 583ENTRY(kvm_lower_privilege_trap)
580 KVM_REFLECT(34) 584 KVM_REFLECT(34)
581END(kvm_lower_privilege_trap) 585END(kvm_lower_privilege_trap)
582 586
583 .org kvm_ia64_ivt+0x5f00 587 .org kvm_ia64_ivt+0x5f00
584////////////////////////////////////////////////////////////////////// 588//////////////////////////////////////////////////////////////////////
585// 0x5f00 Entry 35 (size 16 bundles) Taken Branch Trap (68) 589// 0x5f00 Entry 35 (size 16 bundles) Taken Branch Trap (68)
586ENTRY(kvm_taken_branch_trap) 590ENTRY(kvm_taken_branch_trap)
587 KVM_REFLECT(35) 591 KVM_REFLECT(35)
588END(kvm_taken_branch_trap) 592END(kvm_taken_branch_trap)
589 593
590 .org kvm_ia64_ivt+0x6000 594 .org kvm_ia64_ivt+0x6000
591//////////////////////////////////////////////////////////////////// 595////////////////////////////////////////////////////////////////////
592// 0x6000 Entry 36 (size 16 bundles) Single Step Trap (69) 596// 0x6000 Entry 36 (size 16 bundles) Single Step Trap (69)
593ENTRY(kvm_single_step_trap) 597ENTRY(kvm_single_step_trap)
594 KVM_REFLECT(36) 598 KVM_REFLECT(36)
595END(kvm_single_step_trap) 599END(kvm_single_step_trap)
596 .global kvm_virtualization_fault_back 600 .global kvm_virtualization_fault_back
597 .org kvm_ia64_ivt+0x6100 601 .org kvm_ia64_ivt+0x6100
598///////////////////////////////////////////////////////////////////// 602/////////////////////////////////////////////////////////////////////
599// 0x6100 Entry 37 (size 16 bundles) Virtualization Fault 603// 0x6100 Entry 37 (size 16 bundles) Virtualization Fault
600ENTRY(kvm_virtualization_fault) 604ENTRY(kvm_virtualization_fault)
601 mov r31=pr 605 mov r31=pr
602 adds r16 = VMM_VCPU_SAVED_GP_OFFSET,r21 606 adds r16 = VMM_VCPU_SAVED_GP_OFFSET,r21
603 ;; 607 ;;
604 st8 [r16] = r1 608 st8 [r16] = r1
605 adds r17 = VMM_VCPU_GP_OFFSET, r21 609 adds r17 = VMM_VCPU_GP_OFFSET, r21
606 ;; 610 ;;
607 ld8 r1 = [r17] 611 ld8 r1 = [r17]
608 cmp.eq p6,p0=EVENT_MOV_FROM_AR,r24 612 cmp.eq p6,p0=EVENT_MOV_FROM_AR,r24
609 cmp.eq p7,p0=EVENT_MOV_FROM_RR,r24 613 cmp.eq p7,p0=EVENT_MOV_FROM_RR,r24
610 cmp.eq p8,p0=EVENT_MOV_TO_RR,r24 614 cmp.eq p8,p0=EVENT_MOV_TO_RR,r24
611 cmp.eq p9,p0=EVENT_RSM,r24 615 cmp.eq p9,p0=EVENT_RSM,r24
612 cmp.eq p10,p0=EVENT_SSM,r24 616 cmp.eq p10,p0=EVENT_SSM,r24
613 cmp.eq p11,p0=EVENT_MOV_TO_PSR,r24 617 cmp.eq p11,p0=EVENT_MOV_TO_PSR,r24
614 cmp.eq p12,p0=EVENT_THASH,r24 618 cmp.eq p12,p0=EVENT_THASH,r24
615 (p6) br.dptk.many kvm_asm_mov_from_ar 619(p6) br.dptk.many kvm_asm_mov_from_ar
616 (p7) br.dptk.many kvm_asm_mov_from_rr 620(p7) br.dptk.many kvm_asm_mov_from_rr
617 (p8) br.dptk.many kvm_asm_mov_to_rr 621(p8) br.dptk.many kvm_asm_mov_to_rr
618 (p9) br.dptk.many kvm_asm_rsm 622(p9) br.dptk.many kvm_asm_rsm
619 (p10) br.dptk.many kvm_asm_ssm 623(p10) br.dptk.many kvm_asm_ssm
620 (p11) br.dptk.many kvm_asm_mov_to_psr 624(p11) br.dptk.many kvm_asm_mov_to_psr
621 (p12) br.dptk.many kvm_asm_thash 625(p12) br.dptk.many kvm_asm_thash
622 ;; 626 ;;
623kvm_virtualization_fault_back: 627kvm_virtualization_fault_back:
624 adds r16 = VMM_VCPU_SAVED_GP_OFFSET,r21 628 adds r16 = VMM_VCPU_SAVED_GP_OFFSET,r21
625 ;; 629 ;;
626 ld8 r1 = [r16] 630 ld8 r1 = [r16]
627 ;; 631 ;;
628 mov r19=37 632 mov r19=37
629 adds r16 = VMM_VCPU_CAUSE_OFFSET,r21 633 adds r16 = VMM_VCPU_CAUSE_OFFSET,r21
630 adds r17 = VMM_VCPU_OPCODE_OFFSET,r21 634 adds r17 = VMM_VCPU_OPCODE_OFFSET,r21
631 ;; 635 ;;
632 st8 [r16] = r24 636 st8 [r16] = r24
633 st8 [r17] = r25 637 st8 [r17] = r25
634 ;; 638 ;;
635 cmp.ne p6,p0=EVENT_RFI, r24 639 cmp.ne p6,p0=EVENT_RFI, r24
636 (p6) br.sptk kvm_dispatch_virtualization_fault 640(p6) br.sptk kvm_dispatch_virtualization_fault
637 ;; 641 ;;
638 adds r18=VMM_VPD_BASE_OFFSET,r21 642 adds r18=VMM_VPD_BASE_OFFSET,r21
639 ;; 643 ;;
640 ld8 r18=[r18] 644 ld8 r18=[r18]
641 ;; 645 ;;
642 adds r18=VMM_VPD_VIFS_OFFSET,r18 646 adds r18=VMM_VPD_VIFS_OFFSET,r18
643 ;; 647 ;;
644 ld8 r18=[r18] 648 ld8 r18=[r18]
645 ;; 649 ;;
646 tbit.z p6,p0=r18,63 650 tbit.z p6,p0=r18,63
647 (p6) br.sptk kvm_dispatch_virtualization_fault 651(p6) br.sptk kvm_dispatch_virtualization_fault
648 ;; 652 ;;
649 //if vifs.v=1 desert current register frame 653//if vifs.v=1 desert current register frame
650 alloc r18=ar.pfs,0,0,0,0 654 alloc r18=ar.pfs,0,0,0,0
651 br.sptk kvm_dispatch_virtualization_fault 655 br.sptk kvm_dispatch_virtualization_fault
652END(kvm_virtualization_fault) 656END(kvm_virtualization_fault)
653 657
654 .org kvm_ia64_ivt+0x6200 658 .org kvm_ia64_ivt+0x6200
655////////////////////////////////////////////////////////////// 659//////////////////////////////////////////////////////////////
656// 0x6200 Entry 38 (size 16 bundles) Reserved 660// 0x6200 Entry 38 (size 16 bundles) Reserved
657 KVM_FAULT(38) 661 KVM_FAULT(38)
658 662
659 .org kvm_ia64_ivt+0x6300 663 .org kvm_ia64_ivt+0x6300
660///////////////////////////////////////////////////////////////// 664/////////////////////////////////////////////////////////////////
661// 0x6300 Entry 39 (size 16 bundles) Reserved 665// 0x6300 Entry 39 (size 16 bundles) Reserved
662 KVM_FAULT(39) 666 KVM_FAULT(39)
663 667
664 .org kvm_ia64_ivt+0x6400 668 .org kvm_ia64_ivt+0x6400
665///////////////////////////////////////////////////////////////// 669/////////////////////////////////////////////////////////////////
666// 0x6400 Entry 40 (size 16 bundles) Reserved 670// 0x6400 Entry 40 (size 16 bundles) Reserved
667 KVM_FAULT(40) 671 KVM_FAULT(40)
668 672
669 .org kvm_ia64_ivt+0x6500 673 .org kvm_ia64_ivt+0x6500
670////////////////////////////////////////////////////////////////// 674//////////////////////////////////////////////////////////////////
671// 0x6500 Entry 41 (size 16 bundles) Reserved 675// 0x6500 Entry 41 (size 16 bundles) Reserved
672 KVM_FAULT(41) 676 KVM_FAULT(41)
673 677
674 .org kvm_ia64_ivt+0x6600 678 .org kvm_ia64_ivt+0x6600
675////////////////////////////////////////////////////////////////// 679//////////////////////////////////////////////////////////////////
676// 0x6600 Entry 42 (size 16 bundles) Reserved 680// 0x6600 Entry 42 (size 16 bundles) Reserved
677 KVM_FAULT(42) 681 KVM_FAULT(42)
678 682
679 .org kvm_ia64_ivt+0x6700 683 .org kvm_ia64_ivt+0x6700
680////////////////////////////////////////////////////////////////// 684//////////////////////////////////////////////////////////////////
681// 0x6700 Entry 43 (size 16 bundles) Reserved 685// 0x6700 Entry 43 (size 16 bundles) Reserved
682 KVM_FAULT(43) 686 KVM_FAULT(43)
683 687
684 .org kvm_ia64_ivt+0x6800 688 .org kvm_ia64_ivt+0x6800
685////////////////////////////////////////////////////////////////// 689//////////////////////////////////////////////////////////////////
686// 0x6800 Entry 44 (size 16 bundles) Reserved 690// 0x6800 Entry 44 (size 16 bundles) Reserved
687 KVM_FAULT(44) 691 KVM_FAULT(44)
688 692
689 .org kvm_ia64_ivt+0x6900 693 .org kvm_ia64_ivt+0x6900
690/////////////////////////////////////////////////////////////////// 694///////////////////////////////////////////////////////////////////
691// 0x6900 Entry 45 (size 16 bundles) IA-32 Exeception 695// 0x6900 Entry 45 (size 16 bundles) IA-32 Exeception
692//(17,18,29,41,42,43,44,58,60,61,62,72,73,75,76,77) 696//(17,18,29,41,42,43,44,58,60,61,62,72,73,75,76,77)
693ENTRY(kvm_ia32_exception) 697ENTRY(kvm_ia32_exception)
694 KVM_FAULT(45) 698 KVM_FAULT(45)
695END(kvm_ia32_exception) 699END(kvm_ia32_exception)
696 700
697 .org kvm_ia64_ivt+0x6a00 701 .org kvm_ia64_ivt+0x6a00
698//////////////////////////////////////////////////////////////////// 702////////////////////////////////////////////////////////////////////
699// 0x6a00 Entry 46 (size 16 bundles) IA-32 Intercept (30,31,59,70,71) 703// 0x6a00 Entry 46 (size 16 bundles) IA-32 Intercept (30,31,59,70,71)
700ENTRY(kvm_ia32_intercept) 704ENTRY(kvm_ia32_intercept)
701 KVM_FAULT(47) 705 KVM_FAULT(47)
702END(kvm_ia32_intercept) 706END(kvm_ia32_intercept)
703 707
704 .org kvm_ia64_ivt+0x6c00 708 .org kvm_ia64_ivt+0x6c00
705///////////////////////////////////////////////////////////////////// 709/////////////////////////////////////////////////////////////////////
706// 0x6c00 Entry 48 (size 16 bundles) Reserved 710// 0x6c00 Entry 48 (size 16 bundles) Reserved
707 KVM_FAULT(48) 711 KVM_FAULT(48)
708 712
709 .org kvm_ia64_ivt+0x6d00 713 .org kvm_ia64_ivt+0x6d00
710////////////////////////////////////////////////////////////////////// 714//////////////////////////////////////////////////////////////////////
711// 0x6d00 Entry 49 (size 16 bundles) Reserved 715// 0x6d00 Entry 49 (size 16 bundles) Reserved
712 KVM_FAULT(49) 716 KVM_FAULT(49)
713 717
714 .org kvm_ia64_ivt+0x6e00 718 .org kvm_ia64_ivt+0x6e00
715////////////////////////////////////////////////////////////////////// 719//////////////////////////////////////////////////////////////////////
716// 0x6e00 Entry 50 (size 16 bundles) Reserved 720// 0x6e00 Entry 50 (size 16 bundles) Reserved
717 KVM_FAULT(50) 721 KVM_FAULT(50)
718 722
719 .org kvm_ia64_ivt+0x6f00 723 .org kvm_ia64_ivt+0x6f00
720///////////////////////////////////////////////////////////////////// 724/////////////////////////////////////////////////////////////////////
721// 0x6f00 Entry 51 (size 16 bundles) Reserved 725// 0x6f00 Entry 51 (size 16 bundles) Reserved
722 KVM_FAULT(52) 726 KVM_FAULT(52)
723 727
724 .org kvm_ia64_ivt+0x7100 728 .org kvm_ia64_ivt+0x7100
725//////////////////////////////////////////////////////////////////// 729////////////////////////////////////////////////////////////////////
726// 0x7100 Entry 53 (size 16 bundles) Reserved 730// 0x7100 Entry 53 (size 16 bundles) Reserved
727 KVM_FAULT(53) 731 KVM_FAULT(53)
728 732
729 .org kvm_ia64_ivt+0x7200 733 .org kvm_ia64_ivt+0x7200
730///////////////////////////////////////////////////////////////////// 734/////////////////////////////////////////////////////////////////////
731// 0x7200 Entry 54 (size 16 bundles) Reserved 735// 0x7200 Entry 54 (size 16 bundles) Reserved
732 KVM_FAULT(54) 736 KVM_FAULT(54)
733 737
734 .org kvm_ia64_ivt+0x7300 738 .org kvm_ia64_ivt+0x7300
735//////////////////////////////////////////////////////////////////// 739////////////////////////////////////////////////////////////////////
736// 0x7300 Entry 55 (size 16 bundles) Reserved 740// 0x7300 Entry 55 (size 16 bundles) Reserved
737 KVM_FAULT(55) 741 KVM_FAULT(55)
738 742
739 .org kvm_ia64_ivt+0x7400 743 .org kvm_ia64_ivt+0x7400
740//////////////////////////////////////////////////////////////////// 744////////////////////////////////////////////////////////////////////
741// 0x7400 Entry 56 (size 16 bundles) Reserved 745// 0x7400 Entry 56 (size 16 bundles) Reserved
742 KVM_FAULT(56) 746 KVM_FAULT(56)
743 747
744 .org kvm_ia64_ivt+0x7500 748 .org kvm_ia64_ivt+0x7500
745///////////////////////////////////////////////////////////////////// 749/////////////////////////////////////////////////////////////////////
746// 0x7500 Entry 57 (size 16 bundles) Reserved 750// 0x7500 Entry 57 (size 16 bundles) Reserved
747 KVM_FAULT(57) 751 KVM_FAULT(57)
748 752
749 .org kvm_ia64_ivt+0x7600 753 .org kvm_ia64_ivt+0x7600
750///////////////////////////////////////////////////////////////////// 754/////////////////////////////////////////////////////////////////////
751// 0x7600 Entry 58 (size 16 bundles) Reserved 755// 0x7600 Entry 58 (size 16 bundles) Reserved
752 KVM_FAULT(58) 756 KVM_FAULT(58)
753 757
754 .org kvm_ia64_ivt+0x7700 758 .org kvm_ia64_ivt+0x7700
755//////////////////////////////////////////////////////////////////// 759////////////////////////////////////////////////////////////////////
756// 0x7700 Entry 59 (size 16 bundles) Reserved 760// 0x7700 Entry 59 (size 16 bundles) Reserved
757 KVM_FAULT(59) 761 KVM_FAULT(59)
758 762
759 .org kvm_ia64_ivt+0x7800 763 .org kvm_ia64_ivt+0x7800
760//////////////////////////////////////////////////////////////////// 764////////////////////////////////////////////////////////////////////
761// 0x7800 Entry 60 (size 16 bundles) Reserved 765// 0x7800 Entry 60 (size 16 bundles) Reserved
762 KVM_FAULT(60) 766 KVM_FAULT(60)
763 767
764 .org kvm_ia64_ivt+0x7900 768 .org kvm_ia64_ivt+0x7900
765///////////////////////////////////////////////////////////////////// 769/////////////////////////////////////////////////////////////////////
766// 0x7900 Entry 61 (size 16 bundles) Reserved 770// 0x7900 Entry 61 (size 16 bundles) Reserved
767 KVM_FAULT(61) 771 KVM_FAULT(61)
768 772
769 .org kvm_ia64_ivt+0x7a00 773 .org kvm_ia64_ivt+0x7a00
770///////////////////////////////////////////////////////////////////// 774/////////////////////////////////////////////////////////////////////
771// 0x7a00 Entry 62 (size 16 bundles) Reserved 775// 0x7a00 Entry 62 (size 16 bundles) Reserved
772 KVM_FAULT(62) 776 KVM_FAULT(62)
773 777
774 .org kvm_ia64_ivt+0x7b00 778 .org kvm_ia64_ivt+0x7b00
775///////////////////////////////////////////////////////////////////// 779/////////////////////////////////////////////////////////////////////
776// 0x7b00 Entry 63 (size 16 bundles) Reserved 780// 0x7b00 Entry 63 (size 16 bundles) Reserved
777 KVM_FAULT(63) 781 KVM_FAULT(63)
778 782
779 .org kvm_ia64_ivt+0x7c00 783 .org kvm_ia64_ivt+0x7c00
780//////////////////////////////////////////////////////////////////// 784////////////////////////////////////////////////////////////////////
781// 0x7c00 Entry 64 (size 16 bundles) Reserved 785// 0x7c00 Entry 64 (size 16 bundles) Reserved
782 KVM_FAULT(64) 786 KVM_FAULT(64)
783 787
784 .org kvm_ia64_ivt+0x7d00 788 .org kvm_ia64_ivt+0x7d00
785///////////////////////////////////////////////////////////////////// 789/////////////////////////////////////////////////////////////////////
786// 0x7d00 Entry 65 (size 16 bundles) Reserved 790// 0x7d00 Entry 65 (size 16 bundles) Reserved
787 KVM_FAULT(65) 791 KVM_FAULT(65)
788 792
789 .org kvm_ia64_ivt+0x7e00 793 .org kvm_ia64_ivt+0x7e00
790///////////////////////////////////////////////////////////////////// 794/////////////////////////////////////////////////////////////////////
791// 0x7e00 Entry 66 (size 16 bundles) Reserved 795// 0x7e00 Entry 66 (size 16 bundles) Reserved
792 KVM_FAULT(66) 796 KVM_FAULT(66)
793 797
794 .org kvm_ia64_ivt+0x7f00 798 .org kvm_ia64_ivt+0x7f00
795//////////////////////////////////////////////////////////////////// 799////////////////////////////////////////////////////////////////////
796// 0x7f00 Entry 67 (size 16 bundles) Reserved 800// 0x7f00 Entry 67 (size 16 bundles) Reserved
797 KVM_FAULT(67) 801 KVM_FAULT(67)
798 802
799 .org kvm_ia64_ivt+0x8000 803 .org kvm_ia64_ivt+0x8000
800// There is no particular reason for this code to be here, other than that 804// There is no particular reason for this code to be here, other than that
@@ -804,132 +808,128 @@ END(kvm_ia32_intercept)
804 808
805 809
806ENTRY(kvm_dtlb_miss_dispatch) 810ENTRY(kvm_dtlb_miss_dispatch)
807 mov r19 = 2 811 mov r19 = 2
808 KVM_SAVE_MIN_WITH_COVER_R19 812 KVM_SAVE_MIN_WITH_COVER_R19
809 alloc r14=ar.pfs,0,0,3,0 813 alloc r14=ar.pfs,0,0,3,0
810 mov out0=cr.ifa 814 mov out0=cr.ifa
811 mov out1=r15 815 mov out1=r15
812 adds r3=8,r2 // set up second base pointer 816 adds r3=8,r2 // set up second base pointer
813 ;; 817 ;;
814 ssm psr.ic 818 ssm psr.ic
815 ;; 819 ;;
816 srlz.i // guarantee that interruption collection is on 820 srlz.i // guarantee that interruption collection is on
817 ;; 821 ;;
818 //(p15) ssm psr.i // restore psr.i 822 //(p15) ssm psr.i // restore psr.i
819 addl r14=@gprel(ia64_leave_hypervisor_prepare),gp 823 addl r14=@gprel(ia64_leave_hypervisor_prepare),gp
820 ;; 824 ;;
821 KVM_SAVE_REST 825 KVM_SAVE_REST
822 KVM_SAVE_EXTRA 826 KVM_SAVE_EXTRA
823 mov rp=r14 827 mov rp=r14
824 ;; 828 ;;
825 adds out2=16,r12 829 adds out2=16,r12
826 br.call.sptk.many b6=kvm_page_fault 830 br.call.sptk.many b6=kvm_page_fault
827END(kvm_dtlb_miss_dispatch) 831END(kvm_dtlb_miss_dispatch)
828 832
829ENTRY(kvm_itlb_miss_dispatch) 833ENTRY(kvm_itlb_miss_dispatch)
830 834
831 KVM_SAVE_MIN_WITH_COVER_R19 835 KVM_SAVE_MIN_WITH_COVER_R19
832 alloc r14=ar.pfs,0,0,3,0 836 alloc r14=ar.pfs,0,0,3,0
833 mov out0=cr.ifa 837 mov out0=cr.ifa
834 mov out1=r15 838 mov out1=r15
835 adds r3=8,r2 // set up second base pointer 839 adds r3=8,r2 // set up second base pointer
836 ;; 840 ;;
837 ssm psr.ic 841 ssm psr.ic
838 ;; 842 ;;
839 srlz.i // guarantee that interruption collection is on 843 srlz.i // guarantee that interruption collection is on
840 ;; 844 ;;
841 //(p15) ssm psr.i // restore psr.i 845 //(p15) ssm psr.i // restore psr.i
842 addl r14=@gprel(ia64_leave_hypervisor),gp 846 addl r14=@gprel(ia64_leave_hypervisor),gp
843 ;; 847 ;;
844 KVM_SAVE_REST 848 KVM_SAVE_REST
845 mov rp=r14 849 mov rp=r14
846 ;; 850 ;;
847 adds out2=16,r12 851 adds out2=16,r12
848 br.call.sptk.many b6=kvm_page_fault 852 br.call.sptk.many b6=kvm_page_fault
849END(kvm_itlb_miss_dispatch) 853END(kvm_itlb_miss_dispatch)
850 854
851ENTRY(kvm_dispatch_reflection) 855ENTRY(kvm_dispatch_reflection)
852 /* 856/*
853 * Input: 857 * Input:
854 * psr.ic: off 858 * psr.ic: off
855 * r19: intr type (offset into ivt, see ia64_int.h) 859 * r19: intr type (offset into ivt, see ia64_int.h)
856 * r31: contains saved predicates (pr) 860 * r31: contains saved predicates (pr)
857 */ 861 */
858 KVM_SAVE_MIN_WITH_COVER_R19 862 KVM_SAVE_MIN_WITH_COVER_R19
859 alloc r14=ar.pfs,0,0,5,0 863 alloc r14=ar.pfs,0,0,5,0
860 mov out0=cr.ifa 864 mov out0=cr.ifa
861 mov out1=cr.isr 865 mov out1=cr.isr
862 mov out2=cr.iim 866 mov out2=cr.iim
863 mov out3=r15 867 mov out3=r15
864 adds r3=8,r2 // set up second base pointer 868 adds r3=8,r2 // set up second base pointer
865 ;; 869 ;;
866 ssm psr.ic 870 ssm psr.ic
867 ;; 871 ;;
868 srlz.i // guarantee that interruption collection is on 872 srlz.i // guarantee that interruption collection is on
869 ;; 873 ;;
870 //(p15) ssm psr.i // restore psr.i 874 //(p15) ssm psr.i // restore psr.i
871 addl r14=@gprel(ia64_leave_hypervisor),gp 875 addl r14=@gprel(ia64_leave_hypervisor),gp
872 ;; 876 ;;
873 KVM_SAVE_REST 877 KVM_SAVE_REST
874 mov rp=r14 878 mov rp=r14
875 ;; 879 ;;
876 adds out4=16,r12 880 adds out4=16,r12
877 br.call.sptk.many b6=reflect_interruption 881 br.call.sptk.many b6=reflect_interruption
878END(kvm_dispatch_reflection) 882END(kvm_dispatch_reflection)
879 883
880ENTRY(kvm_dispatch_virtualization_fault) 884ENTRY(kvm_dispatch_virtualization_fault)
881 adds r16 = VMM_VCPU_CAUSE_OFFSET,r21 885 adds r16 = VMM_VCPU_CAUSE_OFFSET,r21
882 adds r17 = VMM_VCPU_OPCODE_OFFSET,r21 886 adds r17 = VMM_VCPU_OPCODE_OFFSET,r21
883 ;; 887 ;;
884 st8 [r16] = r24 888 st8 [r16] = r24
885 st8 [r17] = r25 889 st8 [r17] = r25
886 ;; 890 ;;
887 KVM_SAVE_MIN_WITH_COVER_R19 891 KVM_SAVE_MIN_WITH_COVER_R19
888 ;; 892 ;;
889 alloc r14=ar.pfs,0,0,2,0 // now it's safe (must be first in insn group!) 893 alloc r14=ar.pfs,0,0,2,0 // (must be first in insn group!)
890 mov out0=r13 //vcpu 894 mov out0=r13 //vcpu
891 adds r3=8,r2 // set up second base pointer 895 adds r3=8,r2 // set up second base pointer
892 ;; 896 ;;
893 ssm psr.ic 897 ssm psr.ic
894 ;; 898 ;;
895 srlz.i // guarantee that interruption collection is on 899 srlz.i // guarantee that interruption collection is on
896 ;; 900 ;;
897 //(p15) ssm psr.i // restore psr.i 901 //(p15) ssm psr.i // restore psr.i
898 addl r14=@gprel(ia64_leave_hypervisor_prepare),gp 902 addl r14=@gprel(ia64_leave_hypervisor_prepare),gp
899 ;; 903 ;;
900 KVM_SAVE_REST 904 KVM_SAVE_REST
901 KVM_SAVE_EXTRA 905 KVM_SAVE_EXTRA
902 mov rp=r14 906 mov rp=r14
903 ;; 907 ;;
904 adds out1=16,sp //regs 908 adds out1=16,sp //regs
905 br.call.sptk.many b6=kvm_emulate 909 br.call.sptk.many b6=kvm_emulate
906END(kvm_dispatch_virtualization_fault) 910END(kvm_dispatch_virtualization_fault)
907 911
908 912
909ENTRY(kvm_dispatch_interrupt) 913ENTRY(kvm_dispatch_interrupt)
910 KVM_SAVE_MIN_WITH_COVER_R19 // uses r31; defines r2 and r3 914 KVM_SAVE_MIN_WITH_COVER_R19 // uses r31; defines r2 and r3
911 ;; 915 ;;
912 alloc r14=ar.pfs,0,0,1,0 // must be first in an insn group 916 alloc r14=ar.pfs,0,0,1,0 // must be first in an insn group
913 //mov out0=cr.ivr // pass cr.ivr as first arg 917 adds r3=8,r2 // set up second base pointer for SAVE_REST
914 adds r3=8,r2 // set up second base pointer for SAVE_REST 918 ;;
915 ;; 919 ssm psr.ic
916 ssm psr.ic 920 ;;
917 ;; 921 srlz.i
918 srlz.i 922 ;;
919 ;; 923 //(p15) ssm psr.i
920 //(p15) ssm psr.i 924 addl r14=@gprel(ia64_leave_hypervisor),gp
921 addl r14=@gprel(ia64_leave_hypervisor),gp 925 ;;
922 ;; 926 KVM_SAVE_REST
923 KVM_SAVE_REST 927 mov rp=r14
924 mov rp=r14 928 ;;
925 ;; 929 mov out0=r13 // pass pointer to pt_regs as second arg
926 mov out0=r13 // pass pointer to pt_regs as second arg 930 br.call.sptk.many b6=kvm_ia64_handle_irq
927 br.call.sptk.many b6=kvm_ia64_handle_irq
928END(kvm_dispatch_interrupt) 931END(kvm_dispatch_interrupt)
929 932
930
931
932
933GLOBAL_ENTRY(ia64_leave_nested) 933GLOBAL_ENTRY(ia64_leave_nested)
934 rsm psr.i 934 rsm psr.i
935 ;; 935 ;;
@@ -1008,7 +1008,7 @@ GLOBAL_ENTRY(ia64_leave_nested)
1008 ;; 1008 ;;
1009 ldf.fill f11=[r2] 1009 ldf.fill f11=[r2]
1010// mov r18=r13 1010// mov r18=r13
1011// mov r21=r13 1011// mov r21=r13
1012 adds r16=PT(CR_IPSR)+16,r12 1012 adds r16=PT(CR_IPSR)+16,r12
1013 adds r17=PT(CR_IIP)+16,r12 1013 adds r17=PT(CR_IIP)+16,r12
1014 ;; 1014 ;;
@@ -1058,138 +1058,135 @@ GLOBAL_ENTRY(ia64_leave_nested)
1058 rfi 1058 rfi
1059END(ia64_leave_nested) 1059END(ia64_leave_nested)
1060 1060
1061
1062
1063GLOBAL_ENTRY(ia64_leave_hypervisor_prepare) 1061GLOBAL_ENTRY(ia64_leave_hypervisor_prepare)
1064 /* 1062/*
1065 * work.need_resched etc. mustn't get changed 1063 * work.need_resched etc. mustn't get changed
1066 *by this CPU before it returns to 1064 *by this CPU before it returns to
1067 ;; 1065 * user- or fsys-mode, hence we disable interrupts early on:
1068 * user- or fsys-mode, hence we disable interrupts early on: 1066 */
1069 */ 1067 adds r2 = PT(R4)+16,r12
1070 adds r2 = PT(R4)+16,r12 1068 adds r3 = PT(R5)+16,r12
1071 adds r3 = PT(R5)+16,r12 1069 adds r8 = PT(EML_UNAT)+16,r12
1072 adds r8 = PT(EML_UNAT)+16,r12 1070 ;;
1073 ;; 1071 ld8 r8 = [r8]
1074 ld8 r8 = [r8] 1072 ;;
1075 ;; 1073 mov ar.unat=r8
1076 mov ar.unat=r8 1074 ;;
1077 ;; 1075 ld8.fill r4=[r2],16 //load r4
1078 ld8.fill r4=[r2],16 //load r4 1076 ld8.fill r5=[r3],16 //load r5
1079 ld8.fill r5=[r3],16 //load r5 1077 ;;
1080 ;; 1078 ld8.fill r6=[r2] //load r6
1081 ld8.fill r6=[r2] //load r6 1079 ld8.fill r7=[r3] //load r7
1082 ld8.fill r7=[r3] //load r7 1080 ;;
1083 ;;
1084END(ia64_leave_hypervisor_prepare) 1081END(ia64_leave_hypervisor_prepare)
1085//fall through 1082//fall through
1086GLOBAL_ENTRY(ia64_leave_hypervisor) 1083GLOBAL_ENTRY(ia64_leave_hypervisor)
1087 rsm psr.i 1084 rsm psr.i
1088 ;; 1085 ;;
1089 br.call.sptk.many b0=leave_hypervisor_tail 1086 br.call.sptk.many b0=leave_hypervisor_tail
1090 ;; 1087 ;;
1091 adds r20=PT(PR)+16,r12 1088 adds r20=PT(PR)+16,r12
1092 adds r8=PT(EML_UNAT)+16,r12 1089 adds r8=PT(EML_UNAT)+16,r12
1093 ;; 1090 ;;
1094 ld8 r8=[r8] 1091 ld8 r8=[r8]
1095 ;; 1092 ;;
1096 mov ar.unat=r8 1093 mov ar.unat=r8
1097 ;; 1094 ;;
1098 lfetch [r20],PT(CR_IPSR)-PT(PR) 1095 lfetch [r20],PT(CR_IPSR)-PT(PR)
1099 adds r2 = PT(B6)+16,r12 1096 adds r2 = PT(B6)+16,r12
1100 adds r3 = PT(B7)+16,r12 1097 adds r3 = PT(B7)+16,r12
1101 ;; 1098 ;;
1102 lfetch [r20] 1099 lfetch [r20]
1103 ;; 1100 ;;
1104 ld8 r24=[r2],16 /* B6 */ 1101 ld8 r24=[r2],16 /* B6 */
1105 ld8 r25=[r3],16 /* B7 */ 1102 ld8 r25=[r3],16 /* B7 */
1106 ;; 1103 ;;
1107 ld8 r26=[r2],16 /* ar_csd */ 1104 ld8 r26=[r2],16 /* ar_csd */
1108 ld8 r27=[r3],16 /* ar_ssd */ 1105 ld8 r27=[r3],16 /* ar_ssd */
1109 mov b6 = r24 1106 mov b6 = r24
1110 ;; 1107 ;;
1111 ld8.fill r8=[r2],16 1108 ld8.fill r8=[r2],16
1112 ld8.fill r9=[r3],16 1109 ld8.fill r9=[r3],16
1113 mov b7 = r25 1110 mov b7 = r25
1114 ;; 1111 ;;
1115 mov ar.csd = r26 1112 mov ar.csd = r26
1116 mov ar.ssd = r27 1113 mov ar.ssd = r27
1117 ;; 1114 ;;
1118 ld8.fill r10=[r2],PT(R15)-PT(R10) 1115 ld8.fill r10=[r2],PT(R15)-PT(R10)
1119 ld8.fill r11=[r3],PT(R14)-PT(R11) 1116 ld8.fill r11=[r3],PT(R14)-PT(R11)
1120 ;; 1117 ;;
1121 ld8.fill r15=[r2],PT(R16)-PT(R15) 1118 ld8.fill r15=[r2],PT(R16)-PT(R15)
1122 ld8.fill r14=[r3],PT(R17)-PT(R14) 1119 ld8.fill r14=[r3],PT(R17)-PT(R14)
1123 ;; 1120 ;;
1124 ld8.fill r16=[r2],16 1121 ld8.fill r16=[r2],16
1125 ld8.fill r17=[r3],16 1122 ld8.fill r17=[r3],16
1126 ;; 1123 ;;
1127 ld8.fill r18=[r2],16 1124 ld8.fill r18=[r2],16
1128 ld8.fill r19=[r3],16 1125 ld8.fill r19=[r3],16
1129 ;; 1126 ;;
1130 ld8.fill r20=[r2],16 1127 ld8.fill r20=[r2],16
1131 ld8.fill r21=[r3],16 1128 ld8.fill r21=[r3],16
1132 ;; 1129 ;;
1133 ld8.fill r22=[r2],16 1130 ld8.fill r22=[r2],16
1134 ld8.fill r23=[r3],16 1131 ld8.fill r23=[r3],16
1135 ;; 1132 ;;
1136 ld8.fill r24=[r2],16 1133 ld8.fill r24=[r2],16
1137 ld8.fill r25=[r3],16 1134 ld8.fill r25=[r3],16
1138 ;; 1135 ;;
1139 ld8.fill r26=[r2],16 1136 ld8.fill r26=[r2],16
1140 ld8.fill r27=[r3],16 1137 ld8.fill r27=[r3],16
1141 ;; 1138 ;;
1142 ld8.fill r28=[r2],16 1139 ld8.fill r28=[r2],16
1143 ld8.fill r29=[r3],16 1140 ld8.fill r29=[r3],16
1144 ;; 1141 ;;
1145 ld8.fill r30=[r2],PT(F6)-PT(R30) 1142 ld8.fill r30=[r2],PT(F6)-PT(R30)
1146 ld8.fill r31=[r3],PT(F7)-PT(R31) 1143 ld8.fill r31=[r3],PT(F7)-PT(R31)
1147 ;; 1144 ;;
1148 rsm psr.i | psr.ic 1145 rsm psr.i | psr.ic
1149 // initiate turning off of interrupt and interruption collection 1146 // initiate turning off of interrupt and interruption collection
1150 invala // invalidate ALAT 1147 invala // invalidate ALAT
1151 ;; 1148 ;;
1152 srlz.i // ensure interruption collection is off 1149 srlz.i // ensure interruption collection is off
1153 ;; 1150 ;;
1154 bsw.0 1151 bsw.0
1155 ;; 1152 ;;
1156 adds r16 = PT(CR_IPSR)+16,r12 1153 adds r16 = PT(CR_IPSR)+16,r12
1157 adds r17 = PT(CR_IIP)+16,r12 1154 adds r17 = PT(CR_IIP)+16,r12
1158 mov r21=r13 // get current 1155 mov r21=r13 // get current
1159 ;; 1156 ;;
1160 ld8 r31=[r16],16 // load cr.ipsr 1157 ld8 r31=[r16],16 // load cr.ipsr
1161 ld8 r30=[r17],16 // load cr.iip 1158 ld8 r30=[r17],16 // load cr.iip
1162 ;; 1159 ;;
1163 ld8 r29=[r16],16 // load cr.ifs 1160 ld8 r29=[r16],16 // load cr.ifs
1164 ld8 r28=[r17],16 // load ar.unat 1161 ld8 r28=[r17],16 // load ar.unat
1165 ;; 1162 ;;
1166 ld8 r27=[r16],16 // load ar.pfs 1163 ld8 r27=[r16],16 // load ar.pfs
1167 ld8 r26=[r17],16 // load ar.rsc 1164 ld8 r26=[r17],16 // load ar.rsc
1168 ;; 1165 ;;
1169 ld8 r25=[r16],16 // load ar.rnat 1166 ld8 r25=[r16],16 // load ar.rnat
1170 ld8 r24=[r17],16 // load ar.bspstore 1167 ld8 r24=[r17],16 // load ar.bspstore
1171 ;; 1168 ;;
1172 ld8 r23=[r16],16 // load predicates 1169 ld8 r23=[r16],16 // load predicates
1173 ld8 r22=[r17],16 // load b0 1170 ld8 r22=[r17],16 // load b0
1174 ;; 1171 ;;
1175 ld8 r20=[r16],16 // load ar.rsc value for "loadrs" 1172 ld8 r20=[r16],16 // load ar.rsc value for "loadrs"
1176 ld8.fill r1=[r17],16 //load r1 1173 ld8.fill r1=[r17],16 //load r1
1177 ;; 1174 ;;
1178 ld8.fill r12=[r16],16 //load r12 1175 ld8.fill r12=[r16],16 //load r12
1179 ld8.fill r13=[r17],PT(R2)-PT(R13) //load r13 1176 ld8.fill r13=[r17],PT(R2)-PT(R13) //load r13
1180 ;; 1177 ;;
1181 ld8 r19=[r16],PT(R3)-PT(AR_FPSR) //load ar_fpsr 1178 ld8 r19=[r16],PT(R3)-PT(AR_FPSR) //load ar_fpsr
1182 ld8.fill r2=[r17],PT(AR_CCV)-PT(R2) //load r2 1179 ld8.fill r2=[r17],PT(AR_CCV)-PT(R2) //load r2
1183 ;; 1180 ;;
1184 ld8.fill r3=[r16] //load r3 1181 ld8.fill r3=[r16] //load r3
1185 ld8 r18=[r17] //load ar_ccv 1182 ld8 r18=[r17] //load ar_ccv
1186 ;; 1183 ;;
1187 mov ar.fpsr=r19 1184 mov ar.fpsr=r19
1188 mov ar.ccv=r18 1185 mov ar.ccv=r18
1189 shr.u r18=r20,16 1186 shr.u r18=r20,16
1190 ;; 1187 ;;
1191kvm_rbs_switch: 1188kvm_rbs_switch:
1192 mov r19=96 1189 mov r19=96
1193 1190
1194kvm_dont_preserve_current_frame: 1191kvm_dont_preserve_current_frame:
1195/* 1192/*
@@ -1201,76 +1198,76 @@ kvm_dont_preserve_current_frame:
1201# define pReturn p7 1198# define pReturn p7
1202# define Nregs 14 1199# define Nregs 14
1203 1200
1204 alloc loc0=ar.pfs,2,Nregs-2,2,0 1201 alloc loc0=ar.pfs,2,Nregs-2,2,0
1205 shr.u loc1=r18,9 // RNaTslots <= floor(dirtySize / (64*8)) 1202 shr.u loc1=r18,9 // RNaTslots <= floor(dirtySize / (64*8))
1206 sub r19=r19,r18 // r19 = (physStackedSize + 8) - dirtySize 1203 sub r19=r19,r18 // r19 = (physStackedSize + 8) - dirtySize
1207 ;; 1204 ;;
1208 mov ar.rsc=r20 // load ar.rsc to be used for "loadrs" 1205 mov ar.rsc=r20 // load ar.rsc to be used for "loadrs"
1209 shladd in0=loc1,3,r19 1206 shladd in0=loc1,3,r19
1210 mov in1=0 1207 mov in1=0
1211 ;; 1208 ;;
1212 TEXT_ALIGN(32) 1209 TEXT_ALIGN(32)
1213kvm_rse_clear_invalid: 1210kvm_rse_clear_invalid:
1214 alloc loc0=ar.pfs,2,Nregs-2,2,0 1211 alloc loc0=ar.pfs,2,Nregs-2,2,0
1215 cmp.lt pRecurse,p0=Nregs*8,in0 1212 cmp.lt pRecurse,p0=Nregs*8,in0
1216 // if more than Nregs regs left to clear, (re)curse 1213 // if more than Nregs regs left to clear, (re)curse
1217 add out0=-Nregs*8,in0 1214 add out0=-Nregs*8,in0
1218 add out1=1,in1 // increment recursion count 1215 add out1=1,in1 // increment recursion count
1219 mov loc1=0 1216 mov loc1=0
1220 mov loc2=0 1217 mov loc2=0
1221 ;; 1218 ;;
1222 mov loc3=0 1219 mov loc3=0
1223 mov loc4=0 1220 mov loc4=0
1224 mov loc5=0 1221 mov loc5=0
1225 mov loc6=0 1222 mov loc6=0
1226 mov loc7=0 1223 mov loc7=0
1227(pRecurse) br.call.dptk.few b0=kvm_rse_clear_invalid 1224(pRecurse) br.call.dptk.few b0=kvm_rse_clear_invalid
1228 ;; 1225 ;;
1229 mov loc8=0 1226 mov loc8=0
1230 mov loc9=0 1227 mov loc9=0
1231 cmp.ne pReturn,p0=r0,in1 1228 cmp.ne pReturn,p0=r0,in1
1232 // if recursion count != 0, we need to do a br.ret 1229 // if recursion count != 0, we need to do a br.ret
1233 mov loc10=0 1230 mov loc10=0
1234 mov loc11=0 1231 mov loc11=0
1235(pReturn) br.ret.dptk.many b0 1232(pReturn) br.ret.dptk.many b0
1236 1233
1237# undef pRecurse 1234# undef pRecurse
1238# undef pReturn 1235# undef pReturn
1239 1236
1240// loadrs has already been shifted 1237// loadrs has already been shifted
1241 alloc r16=ar.pfs,0,0,0,0 // drop current register frame 1238 alloc r16=ar.pfs,0,0,0,0 // drop current register frame
1242 ;; 1239 ;;
1243 loadrs 1240 loadrs
1244 ;; 1241 ;;
1245 mov ar.bspstore=r24 1242 mov ar.bspstore=r24
1246 ;; 1243 ;;
1247 mov ar.unat=r28 1244 mov ar.unat=r28
1248 mov ar.rnat=r25 1245 mov ar.rnat=r25
1249 mov ar.rsc=r26 1246 mov ar.rsc=r26
1250 ;; 1247 ;;
1251 mov cr.ipsr=r31 1248 mov cr.ipsr=r31
1252 mov cr.iip=r30 1249 mov cr.iip=r30
1253 mov cr.ifs=r29 1250 mov cr.ifs=r29
1254 mov ar.pfs=r27 1251 mov ar.pfs=r27
1255 adds r18=VMM_VPD_BASE_OFFSET,r21 1252 adds r18=VMM_VPD_BASE_OFFSET,r21
1256 ;; 1253 ;;
1257 ld8 r18=[r18] //vpd 1254 ld8 r18=[r18] //vpd
1258 adds r17=VMM_VCPU_ISR_OFFSET,r21 1255 adds r17=VMM_VCPU_ISR_OFFSET,r21
1259 ;; 1256 ;;
1260 ld8 r17=[r17] 1257 ld8 r17=[r17]
1261 adds r19=VMM_VPD_VPSR_OFFSET,r18 1258 adds r19=VMM_VPD_VPSR_OFFSET,r18
1262 ;; 1259 ;;
1263 ld8 r19=[r19] //vpsr 1260 ld8 r19=[r19] //vpsr
1264 mov r25=r18 1261 mov r25=r18
1265 adds r16= VMM_VCPU_GP_OFFSET,r21 1262 adds r16= VMM_VCPU_GP_OFFSET,r21
1266 ;; 1263 ;;
1267 ld8 r16= [r16] // Put gp in r24 1264 ld8 r16= [r16] // Put gp in r24
1268 movl r24=@gprel(ia64_vmm_entry) // calculate return address 1265 movl r24=@gprel(ia64_vmm_entry) // calculate return address
1269 ;; 1266 ;;
1270 add r24=r24,r16 1267 add r24=r24,r16
1271 ;; 1268 ;;
1272 br.sptk.many kvm_vps_sync_write // call the service 1269 br.sptk.many kvm_vps_sync_write // call the service
1273 ;; 1270 ;;
1274END(ia64_leave_hypervisor) 1271END(ia64_leave_hypervisor)
1275// fall through 1272// fall through
1276GLOBAL_ENTRY(ia64_vmm_entry) 1273GLOBAL_ENTRY(ia64_vmm_entry)
@@ -1283,16 +1280,14 @@ GLOBAL_ENTRY(ia64_vmm_entry)
1283 * r22:b0 1280 * r22:b0
1284 * r23:predicate 1281 * r23:predicate
1285 */ 1282 */
1286 mov r24=r22 1283 mov r24=r22
1287 mov r25=r18 1284 mov r25=r18
1288 tbit.nz p1,p2 = r19,IA64_PSR_IC_BIT // p1=vpsr.ic 1285 tbit.nz p1,p2 = r19,IA64_PSR_IC_BIT // p1=vpsr.ic
1289 (p1) br.cond.sptk.few kvm_vps_resume_normal 1286(p1) br.cond.sptk.few kvm_vps_resume_normal
1290 (p2) br.cond.sptk.many kvm_vps_resume_handler 1287(p2) br.cond.sptk.many kvm_vps_resume_handler
1291 ;; 1288 ;;
1292END(ia64_vmm_entry) 1289END(ia64_vmm_entry)
1293 1290
1294
1295
1296/* 1291/*
1297 * extern u64 ia64_call_vsa(u64 proc, u64 arg1, u64 arg2, 1292 * extern u64 ia64_call_vsa(u64 proc, u64 arg1, u64 arg2,
1298 * u64 arg3, u64 arg4, u64 arg5, 1293 * u64 arg3, u64 arg4, u64 arg5,
@@ -1310,88 +1305,88 @@ psrsave = loc2
1310entry = loc3 1305entry = loc3
1311hostret = r24 1306hostret = r24
1312 1307
1313 alloc pfssave=ar.pfs,4,4,0,0 1308 alloc pfssave=ar.pfs,4,4,0,0
1314 mov rpsave=rp 1309 mov rpsave=rp
1315 adds entry=VMM_VCPU_VSA_BASE_OFFSET, r13 1310 adds entry=VMM_VCPU_VSA_BASE_OFFSET, r13
1316 ;; 1311 ;;
1317 ld8 entry=[entry] 1312 ld8 entry=[entry]
13181: mov hostret=ip 13131: mov hostret=ip
1319 mov r25=in1 // copy arguments 1314 mov r25=in1 // copy arguments
1320 mov r26=in2 1315 mov r26=in2
1321 mov r27=in3 1316 mov r27=in3
1322 mov psrsave=psr 1317 mov psrsave=psr
1323 ;; 1318 ;;
1324 tbit.nz p6,p0=psrsave,14 // IA64_PSR_I 1319 tbit.nz p6,p0=psrsave,14 // IA64_PSR_I
1325 tbit.nz p7,p0=psrsave,13 // IA64_PSR_IC 1320 tbit.nz p7,p0=psrsave,13 // IA64_PSR_IC
1326 ;; 1321 ;;
1327 add hostret=2f-1b,hostret // calculate return address 1322 add hostret=2f-1b,hostret // calculate return address
1328 add entry=entry,in0 1323 add entry=entry,in0
1329 ;; 1324 ;;
1330 rsm psr.i | psr.ic 1325 rsm psr.i | psr.ic
1331 ;; 1326 ;;
1332 srlz.i 1327 srlz.i
1333 mov b6=entry 1328 mov b6=entry
1334 br.cond.sptk b6 // call the service 1329 br.cond.sptk b6 // call the service
13352: 13302:
1336 // Architectural sequence for enabling interrupts if necessary 1331// Architectural sequence for enabling interrupts if necessary
1337(p7) ssm psr.ic 1332(p7) ssm psr.ic
1338 ;; 1333 ;;
1339(p7) srlz.i 1334(p7) srlz.i
1340 ;; 1335 ;;
1341//(p6) ssm psr.i 1336//(p6) ssm psr.i
1342 ;; 1337 ;;
1343 mov rp=rpsave 1338 mov rp=rpsave
1344 mov ar.pfs=pfssave 1339 mov ar.pfs=pfssave
1345 mov r8=r31 1340 mov r8=r31
1346 ;; 1341 ;;
1347 srlz.d 1342 srlz.d
1348 br.ret.sptk rp 1343 br.ret.sptk rp
1349 1344
1350END(ia64_call_vsa) 1345END(ia64_call_vsa)
1351 1346
1352#define INIT_BSPSTORE ((4<<30)-(12<<20)-0x100) 1347#define INIT_BSPSTORE ((4<<30)-(12<<20)-0x100)
1353 1348
1354GLOBAL_ENTRY(vmm_reset_entry) 1349GLOBAL_ENTRY(vmm_reset_entry)
1355 //set up ipsr, iip, vpd.vpsr, dcr 1350 //set up ipsr, iip, vpd.vpsr, dcr
1356 // For IPSR: it/dt/rt=1, i/ic=1, si=1, vm/bn=1 1351 // For IPSR: it/dt/rt=1, i/ic=1, si=1, vm/bn=1
1357 // For DCR: all bits 0 1352 // For DCR: all bits 0
1358 bsw.0 1353 bsw.0
1359 ;; 1354 ;;
1360 mov r21 =r13 1355 mov r21 =r13
1361 adds r14=-VMM_PT_REGS_SIZE, r12 1356 adds r14=-VMM_PT_REGS_SIZE, r12
1362 ;; 1357 ;;
1363 movl r6=0x501008826000 // IPSR dt/rt/it:1;i/ic:1, si:1, vm/bn:1 1358 movl r6=0x501008826000 // IPSR dt/rt/it:1;i/ic:1, si:1, vm/bn:1
1364 movl r10=0x8000000000000000 1359 movl r10=0x8000000000000000
1365 adds r16=PT(CR_IIP), r14 1360 adds r16=PT(CR_IIP), r14
1366 adds r20=PT(R1), r14 1361 adds r20=PT(R1), r14
1367 ;; 1362 ;;
1368 rsm psr.ic | psr.i 1363 rsm psr.ic | psr.i
1369 ;; 1364 ;;
1370 srlz.i 1365 srlz.i
1371 ;; 1366 ;;
1372 mov ar.rsc = 0 1367 mov ar.rsc = 0
1373 ;; 1368 ;;
1374 flushrs 1369 flushrs
1375 ;; 1370 ;;
1376 mov ar.bspstore = 0 1371 mov ar.bspstore = 0
1377 // clear BSPSTORE 1372 // clear BSPSTORE
1378 ;; 1373 ;;
1379 mov cr.ipsr=r6 1374 mov cr.ipsr=r6
1380 mov cr.ifs=r10 1375 mov cr.ifs=r10
1381 ld8 r4 = [r16] // Set init iip for first run. 1376 ld8 r4 = [r16] // Set init iip for first run.
1382 ld8 r1 = [r20] 1377 ld8 r1 = [r20]
1383 ;; 1378 ;;
1384 mov cr.iip=r4 1379 mov cr.iip=r4
1385 adds r16=VMM_VPD_BASE_OFFSET,r13 1380 adds r16=VMM_VPD_BASE_OFFSET,r13
1386 ;; 1381 ;;
1387 ld8 r18=[r16] 1382 ld8 r18=[r16]
1388 ;; 1383 ;;
1389 adds r19=VMM_VPD_VPSR_OFFSET,r18 1384 adds r19=VMM_VPD_VPSR_OFFSET,r18
1390 ;; 1385 ;;
1391 ld8 r19=[r19] 1386 ld8 r19=[r19]
1392 mov r17=r0 1387 mov r17=r0
1393 mov r22=r0 1388 mov r22=r0
1394 mov r23=r0 1389 mov r23=r0
1395 br.cond.sptk ia64_vmm_entry 1390 br.cond.sptk ia64_vmm_entry
1396 br.ret.sptk b0 1391 br.ret.sptk b0
1397END(vmm_reset_entry) 1392END(vmm_reset_entry)
diff --git a/arch/ia64/kvm/vtlb.c b/arch/ia64/kvm/vtlb.c
index e22b93361e08..6b6307a3bd55 100644
--- a/arch/ia64/kvm/vtlb.c
+++ b/arch/ia64/kvm/vtlb.c
@@ -183,8 +183,8 @@ void mark_pages_dirty(struct kvm_vcpu *v, u64 pte, u64 ps)
183 u64 i, dirty_pages = 1; 183 u64 i, dirty_pages = 1;
184 u64 base_gfn = (pte&_PAGE_PPN_MASK) >> PAGE_SHIFT; 184 u64 base_gfn = (pte&_PAGE_PPN_MASK) >> PAGE_SHIFT;
185 spinlock_t *lock = __kvm_va(v->arch.dirty_log_lock_pa); 185 spinlock_t *lock = __kvm_va(v->arch.dirty_log_lock_pa);
186 void *dirty_bitmap = (void *)v - (KVM_VCPU_OFS + v->vcpu_id * VCPU_SIZE) 186 void *dirty_bitmap = (void *)KVM_MEM_DIRTY_LOG_BASE;
187 + KVM_MEM_DIRTY_LOG_OFS; 187
188 dirty_pages <<= ps <= PAGE_SHIFT ? 0 : ps - PAGE_SHIFT; 188 dirty_pages <<= ps <= PAGE_SHIFT ? 0 : ps - PAGE_SHIFT;
189 189
190 vmm_spin_lock(lock); 190 vmm_spin_lock(lock);
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 054bcd9439aa..56e12903973c 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -692,7 +692,7 @@ int arch_add_memory(int nid, u64 start, u64 size)
692 pgdat = NODE_DATA(nid); 692 pgdat = NODE_DATA(nid);
693 693
694 zone = pgdat->node_zones + ZONE_NORMAL; 694 zone = pgdat->node_zones + ZONE_NORMAL;
695 ret = __add_pages(zone, start_pfn, nr_pages); 695 ret = __add_pages(nid, zone, start_pfn, nr_pages);
696 696
697 if (ret) 697 if (ret)
698 printk("%s: Problem encountered in __add_pages() as ret=%d\n", 698 printk("%s: Problem encountered in __add_pages() as ret=%d\n",
diff --git a/arch/ia64/sn/kernel/irq.c b/arch/ia64/sn/kernel/irq.c
index 0c66dbdd1d72..66fd705e82c0 100644
--- a/arch/ia64/sn/kernel/irq.c
+++ b/arch/ia64/sn/kernel/irq.c
@@ -227,14 +227,14 @@ finish_up:
227 return new_irq_info; 227 return new_irq_info;
228} 228}
229 229
230static void sn_set_affinity_irq(unsigned int irq, cpumask_t mask) 230static void sn_set_affinity_irq(unsigned int irq, const struct cpumask *mask)
231{ 231{
232 struct sn_irq_info *sn_irq_info, *sn_irq_info_safe; 232 struct sn_irq_info *sn_irq_info, *sn_irq_info_safe;
233 nasid_t nasid; 233 nasid_t nasid;
234 int slice; 234 int slice;
235 235
236 nasid = cpuid_to_nasid(first_cpu(mask)); 236 nasid = cpuid_to_nasid(cpumask_first(mask));
237 slice = cpuid_to_slice(first_cpu(mask)); 237 slice = cpuid_to_slice(cpumask_first(mask));
238 238
239 list_for_each_entry_safe(sn_irq_info, sn_irq_info_safe, 239 list_for_each_entry_safe(sn_irq_info, sn_irq_info_safe,
240 sn_irq_lh[irq], list) 240 sn_irq_lh[irq], list)
diff --git a/arch/ia64/sn/kernel/msi_sn.c b/arch/ia64/sn/kernel/msi_sn.c
index 83f190ffe350..ca553b0429ce 100644
--- a/arch/ia64/sn/kernel/msi_sn.c
+++ b/arch/ia64/sn/kernel/msi_sn.c
@@ -151,7 +151,8 @@ int sn_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *entry)
151} 151}
152 152
153#ifdef CONFIG_SMP 153#ifdef CONFIG_SMP
154static void sn_set_msi_irq_affinity(unsigned int irq, cpumask_t cpu_mask) 154static void sn_set_msi_irq_affinity(unsigned int irq,
155 const struct cpumask *cpu_mask)
155{ 156{
156 struct msi_msg msg; 157 struct msi_msg msg;
157 int slice; 158 int slice;
@@ -164,7 +165,7 @@ static void sn_set_msi_irq_affinity(unsigned int irq, cpumask_t cpu_mask)
164 struct sn_pcibus_provider *provider; 165 struct sn_pcibus_provider *provider;
165 unsigned int cpu; 166 unsigned int cpu;
166 167
167 cpu = first_cpu(cpu_mask); 168 cpu = cpumask_first(cpu_mask);
168 sn_irq_info = sn_msi_info[irq].sn_irq_info; 169 sn_irq_info = sn_msi_info[irq].sn_irq_info;
169 if (sn_irq_info == NULL || sn_irq_info->irq_int_bit >= 0) 170 if (sn_irq_info == NULL || sn_irq_info->irq_int_bit >= 0)
170 return; 171 return;
@@ -204,7 +205,7 @@ static void sn_set_msi_irq_affinity(unsigned int irq, cpumask_t cpu_mask)
204 msg.address_lo = (u32)(bus_addr & 0x00000000ffffffff); 205 msg.address_lo = (u32)(bus_addr & 0x00000000ffffffff);
205 206
206 write_msi_msg(irq, &msg); 207 write_msi_msg(irq, &msg);
207 irq_desc[irq].affinity = cpu_mask; 208 irq_desc[irq].affinity = *cpu_mask;
208} 209}
209#endif /* CONFIG_SMP */ 210#endif /* CONFIG_SMP */
210 211
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index 636588e7e068..be339477f906 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -385,7 +385,6 @@ static int sn_topology_show(struct seq_file *s, void *d)
385 int j; 385 int j;
386 const char *slabname; 386 const char *slabname;
387 int ordinal; 387 int ordinal;
388 cpumask_t cpumask;
389 char slice; 388 char slice;
390 struct cpuinfo_ia64 *c; 389 struct cpuinfo_ia64 *c;
391 struct sn_hwperf_port_info *ptdata; 390 struct sn_hwperf_port_info *ptdata;
@@ -473,23 +472,21 @@ static int sn_topology_show(struct seq_file *s, void *d)
473 * CPUs on this node, if any 472 * CPUs on this node, if any
474 */ 473 */
475 if (!SN_HWPERF_IS_IONODE(obj)) { 474 if (!SN_HWPERF_IS_IONODE(obj)) {
476 cpumask = node_to_cpumask(ordinal); 475 for_each_cpu_and(i, cpu_online_mask,
477 for_each_online_cpu(i) { 476 cpumask_of_node(ordinal)) {
478 if (cpu_isset(i, cpumask)) { 477 slice = 'a' + cpuid_to_slice(i);
479 slice = 'a' + cpuid_to_slice(i); 478 c = cpu_data(i);
480 c = cpu_data(i); 479 seq_printf(s, "cpu %d %s%c local"
481 seq_printf(s, "cpu %d %s%c local" 480 " freq %luMHz, arch ia64",
482 " freq %luMHz, arch ia64", 481 i, obj->location, slice,
483 i, obj->location, slice, 482 c->proc_freq / 1000000);
484 c->proc_freq / 1000000); 483 for_each_online_cpu(j) {
485 for_each_online_cpu(j) { 484 seq_printf(s, j ? ":%d" : ", dist %d",
486 seq_printf(s, j ? ":%d" : ", dist %d", 485 node_distance(
487 node_distance(
488 cpu_to_node(i), 486 cpu_to_node(i),
489 cpu_to_node(j))); 487 cpu_to_node(j)));
490 }
491 seq_putc(s, '\n');
492 } 488 }
489 seq_putc(s, '\n');
493 } 490 }
494 } 491 }
495 } 492 }
diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c
index a88eba3314d7..3f864238566d 100644
--- a/arch/ia64/sn/kernel/tiocx.c
+++ b/arch/ia64/sn/kernel/tiocx.c
@@ -206,8 +206,7 @@ cx_device_register(nasid_t nasid, int part_num, int mfg_num,
206 cx_dev->dev.parent = NULL; 206 cx_dev->dev.parent = NULL;
207 cx_dev->dev.bus = &tiocx_bus_type; 207 cx_dev->dev.bus = &tiocx_bus_type;
208 cx_dev->dev.release = tiocx_bus_release; 208 cx_dev->dev.release = tiocx_bus_release;
209 snprintf(cx_dev->dev.bus_id, BUS_ID_SIZE, "%d", 209 dev_set_name(&cx_dev->dev, "%d", cx_dev->cx_id.nasid);
210 cx_dev->cx_id.nasid);
211 device_register(&cx_dev->dev); 210 device_register(&cx_dev->dev);
212 get_device(&cx_dev->dev); 211 get_device(&cx_dev->dev);
213 212
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index dbaed4a63815..cabba332cc48 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -10,6 +10,7 @@ config M32R
10 default y 10 default y
11 select HAVE_IDE 11 select HAVE_IDE
12 select HAVE_OPROFILE 12 select HAVE_OPROFILE
13 select INIT_ALL_POSSIBLE
13 14
14config SBUS 15config SBUS
15 bool 16 bool
@@ -273,7 +274,7 @@ config GENERIC_CALIBRATE_DELAY
273 bool 274 bool
274 default y 275 default y
275 276
276config SCHED_NO_NO_OMIT_FRAME_POINTER 277config SCHED_OMIT_FRAME_POINTER
277 bool 278 bool
278 default y 279 default y
279 280
diff --git a/arch/m32r/kernel/init_task.c b/arch/m32r/kernel/init_task.c
index 0d658dbb6766..016885c6f260 100644
--- a/arch/m32r/kernel/init_task.c
+++ b/arch/m32r/kernel/init_task.c
@@ -11,7 +11,6 @@
11#include <asm/uaccess.h> 11#include <asm/uaccess.h>
12#include <asm/pgtable.h> 12#include <asm/pgtable.h>
13 13
14static struct fs_struct init_fs = INIT_FS;
15static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 14static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 15static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
17struct mm_struct init_mm = INIT_MM(init_mm); 16struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/m32r/kernel/smpboot.c b/arch/m32r/kernel/smpboot.c
index 39cb6da72dcb..2547d6c4a827 100644
--- a/arch/m32r/kernel/smpboot.c
+++ b/arch/m32r/kernel/smpboot.c
@@ -73,17 +73,11 @@ static unsigned int bsp_phys_id = -1;
73/* Bitmask of physically existing CPUs */ 73/* Bitmask of physically existing CPUs */
74physid_mask_t phys_cpu_present_map; 74physid_mask_t phys_cpu_present_map;
75 75
76/* Bitmask of currently online CPUs */
77cpumask_t cpu_online_map;
78EXPORT_SYMBOL(cpu_online_map);
79
80cpumask_t cpu_bootout_map; 76cpumask_t cpu_bootout_map;
81cpumask_t cpu_bootin_map; 77cpumask_t cpu_bootin_map;
82static cpumask_t cpu_callin_map; 78static cpumask_t cpu_callin_map;
83cpumask_t cpu_callout_map; 79cpumask_t cpu_callout_map;
84EXPORT_SYMBOL(cpu_callout_map); 80EXPORT_SYMBOL(cpu_callout_map);
85cpumask_t cpu_possible_map = CPU_MASK_ALL;
86EXPORT_SYMBOL(cpu_possible_map);
87 81
88/* Per CPU bogomips and other parameters */ 82/* Per CPU bogomips and other parameters */
89struct cpuinfo_m32r cpu_data[NR_CPUS] __cacheline_aligned; 83struct cpuinfo_m32r cpu_data[NR_CPUS] __cacheline_aligned;
@@ -598,7 +592,7 @@ int setup_profiling_timer(unsigned int multiplier)
598 * accounting. At that time they also adjust their APIC timers 592 * accounting. At that time they also adjust their APIC timers
599 * accordingly. 593 * accordingly.
600 */ 594 */
601 for (i = 0; i < NR_CPUS; ++i) 595 for_each_possible_cpu(i)
602 per_cpu(prof_multiplier, i) = multiplier; 596 per_cpu(prof_multiplier, i) = multiplier;
603 597
604 return 0; 598 return 0;
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 836fb66f080d..c825bde17cb3 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -280,7 +280,6 @@ config M68060
280 280
281config MMU_MOTOROLA 281config MMU_MOTOROLA
282 bool 282 bool
283 depends on MMU && !MMU_SUN3
284 283
285config MMU_SUN3 284config MMU_SUN3
286 bool 285 bool
diff --git a/arch/m68k/fpsp040/setox.S b/arch/m68k/fpsp040/setox.S
index 145af5447581..f1acf7e36d6b 100644
--- a/arch/m68k/fpsp040/setox.S
+++ b/arch/m68k/fpsp040/setox.S
@@ -36,9 +36,9 @@
36| depending on their values, the program may run faster or slower -- 36| depending on their values, the program may run faster or slower --
37| but no worse than 10% slower even in the extreme cases. 37| but no worse than 10% slower even in the extreme cases.
38| 38|
39| The program setoxm1 takes approximately ???/??? cycles for input 39| The program setoxm1 takes approximately ??? / ??? cycles for input
40| argument X, 0.25 <= |X| < 70log2. For |X| < 0.25, it takes 40| argument X, 0.25 <= |X| < 70log2. For |X| < 0.25, it takes
41| approximately ???/??? cycles. For the less common arguments, 41| approximately ??? / ??? cycles. For the less common arguments,
42| depending on their values, the program may run faster or slower -- 42| depending on their values, the program may run faster or slower --
43| but no worse than 10% slower even in the extreme cases. 43| but no worse than 10% slower even in the extreme cases.
44| 44|
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index 3042c2bc8c58..632ce016014d 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -40,7 +40,6 @@
40 * alignment requirements and potentially different initial 40 * alignment requirements and potentially different initial
41 * setup. 41 * setup.
42 */ 42 */
43static struct fs_struct init_fs = INIT_FS;
44static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 43static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
45static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 44static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
46struct mm_struct init_mm = INIT_MM(init_mm); 45struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/m68k/mac/baboon.c b/arch/m68k/mac/baboon.c
index c7b25b0aacff..245d16d078ad 100644
--- a/arch/m68k/mac/baboon.c
+++ b/arch/m68k/mac/baboon.c
@@ -18,11 +18,14 @@
18#include <asm/macints.h> 18#include <asm/macints.h>
19#include <asm/mac_baboon.h> 19#include <asm/mac_baboon.h>
20 20
21/* #define DEBUG_BABOON */
22/* #define DEBUG_IRQS */ 21/* #define DEBUG_IRQS */
23 22
23extern void mac_enable_irq(unsigned int);
24extern void mac_disable_irq(unsigned int);
25
24int baboon_present; 26int baboon_present;
25static volatile struct baboon *baboon; 27static volatile struct baboon *baboon;
28static unsigned char baboon_disabled;
26 29
27#if 0 30#if 0
28extern int macide_ack_intr(struct ata_channel *); 31extern int macide_ack_intr(struct ata_channel *);
@@ -88,34 +91,51 @@ static irqreturn_t baboon_irq(int irq, void *dev_id)
88 91
89void __init baboon_register_interrupts(void) 92void __init baboon_register_interrupts(void)
90{ 93{
91 request_irq(IRQ_NUBUS_C, baboon_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST, 94 baboon_disabled = 0;
92 "baboon", (void *) baboon); 95 request_irq(IRQ_NUBUS_C, baboon_irq, 0, "baboon", (void *)baboon);
93} 96}
94 97
95void baboon_irq_enable(int irq) { 98/*
99 * The means for masking individual baboon interrupts remains a mystery, so
100 * enable the umbrella interrupt only when no baboon interrupt is disabled.
101 */
102
103void baboon_irq_enable(int irq)
104{
105 int irq_idx = IRQ_IDX(irq);
106
96#ifdef DEBUG_IRQUSE 107#ifdef DEBUG_IRQUSE
97 printk("baboon_irq_enable(%d)\n", irq); 108 printk("baboon_irq_enable(%d)\n", irq);
98#endif 109#endif
99 /* FIXME: figure out how to mask and unmask baboon interrupt sources */ 110
100 enable_irq(IRQ_NUBUS_C); 111 baboon_disabled &= ~(1 << irq_idx);
112 if (!baboon_disabled)
113 mac_enable_irq(IRQ_NUBUS_C);
101} 114}
102 115
103void baboon_irq_disable(int irq) { 116void baboon_irq_disable(int irq)
117{
118 int irq_idx = IRQ_IDX(irq);
119
104#ifdef DEBUG_IRQUSE 120#ifdef DEBUG_IRQUSE
105 printk("baboon_irq_disable(%d)\n", irq); 121 printk("baboon_irq_disable(%d)\n", irq);
106#endif 122#endif
107 disable_irq(IRQ_NUBUS_C); 123
124 baboon_disabled |= 1 << irq_idx;
125 if (baboon_disabled)
126 mac_disable_irq(IRQ_NUBUS_C);
108} 127}
109 128
110void baboon_irq_clear(int irq) { 129void baboon_irq_clear(int irq)
111 int irq_idx = IRQ_IDX(irq); 130{
131 int irq_idx = IRQ_IDX(irq);
112 132
113 baboon->mb_ifr &= ~(1 << irq_idx); 133 baboon->mb_ifr &= ~(1 << irq_idx);
114} 134}
115 135
116int baboon_irq_pending(int irq) 136int baboon_irq_pending(int irq)
117{ 137{
118 int irq_idx = IRQ_IDX(irq); 138 int irq_idx = IRQ_IDX(irq);
119 139
120 return baboon->mb_ifr & (1 << irq_idx); 140 return baboon->mb_ifr & (1 << irq_idx);
121} 141}
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index c45e18449f32..8819b97be324 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -162,10 +162,7 @@ void __init config_mac(void)
162 mach_init_IRQ = mac_init_IRQ; 162 mach_init_IRQ = mac_init_IRQ;
163 mach_get_model = mac_get_model; 163 mach_get_model = mac_get_model;
164 mach_gettimeoffset = mac_gettimeoffset; 164 mach_gettimeoffset = mac_gettimeoffset;
165#warning move to adb/via init
166#if 0
167 mach_hwclk = mac_hwclk; 165 mach_hwclk = mac_hwclk;
168#endif
169 mach_set_clock_mmss = mac_set_clock_mmss; 166 mach_set_clock_mmss = mac_set_clock_mmss;
170 mach_reset = mac_reset; 167 mach_reset = mac_reset;
171 mach_halt = mac_poweroff; 168 mach_halt = mac_poweroff;
diff --git a/arch/m68k/mac/debug.c b/arch/m68k/mac/debug.c
index 2165740786a5..65dd77a742a3 100644
--- a/arch/m68k/mac/debug.c
+++ b/arch/m68k/mac/debug.c
@@ -24,7 +24,6 @@
24#define BOOTINFO_COMPAT_1_0 24#define BOOTINFO_COMPAT_1_0
25#include <asm/setup.h> 25#include <asm/setup.h>
26#include <asm/bootinfo.h> 26#include <asm/bootinfo.h>
27#include <asm/machw.h>
28#include <asm/macints.h> 27#include <asm/macints.h>
29 28
30extern unsigned long mac_videobase; 29extern unsigned long mac_videobase;
diff --git a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c
index ecddac4a02b9..82e560c076ce 100644
--- a/arch/m68k/mac/macints.c
+++ b/arch/m68k/mac/macints.c
@@ -127,7 +127,6 @@
127#include <asm/irq.h> 127#include <asm/irq.h>
128#include <asm/traps.h> 128#include <asm/traps.h>
129#include <asm/bootinfo.h> 129#include <asm/bootinfo.h>
130#include <asm/machw.h>
131#include <asm/macintosh.h> 130#include <asm/macintosh.h>
132#include <asm/mac_via.h> 131#include <asm/mac_via.h>
133#include <asm/mac_psc.h> 132#include <asm/mac_psc.h>
@@ -215,8 +214,8 @@ irqreturn_t mac_debug_handler(int, void *);
215 214
216/* #define DEBUG_MACINTS */ 215/* #define DEBUG_MACINTS */
217 216
218static void mac_enable_irq(unsigned int irq); 217void mac_enable_irq(unsigned int irq);
219static void mac_disable_irq(unsigned int irq); 218void mac_disable_irq(unsigned int irq);
220 219
221static struct irq_controller mac_irq_controller = { 220static struct irq_controller mac_irq_controller = {
222 .name = "mac", 221 .name = "mac",
@@ -275,7 +274,7 @@ void __init mac_init_IRQ(void)
275 * These routines are just dispatchers to the VIA/OSS/PSC routines. 274 * These routines are just dispatchers to the VIA/OSS/PSC routines.
276 */ 275 */
277 276
278static void mac_enable_irq(unsigned int irq) 277void mac_enable_irq(unsigned int irq)
279{ 278{
280 int irq_src = IRQ_SRC(irq); 279 int irq_src = IRQ_SRC(irq);
281 280
@@ -308,7 +307,7 @@ static void mac_enable_irq(unsigned int irq)
308 } 307 }
309} 308}
310 309
311static void mac_disable_irq(unsigned int irq) 310void mac_disable_irq(unsigned int irq)
312{ 311{
313 int irq_src = IRQ_SRC(irq); 312 int irq_src = IRQ_SRC(irq);
314 313
diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c
index 56d1f5676ade..a44c7086ab39 100644
--- a/arch/m68k/mac/misc.c
+++ b/arch/m68k/mac/misc.c
@@ -93,7 +93,7 @@ static void cuda_write_pram(int offset, __u8 data)
93#define cuda_write_pram NULL 93#define cuda_write_pram NULL
94#endif 94#endif
95 95
96#ifdef CONFIG_ADB_PMU68K 96#if 0 /* def CONFIG_ADB_PMU68K */
97static long pmu_read_time(void) 97static long pmu_read_time(void)
98{ 98{
99 struct adb_request req; 99 struct adb_request req;
@@ -148,7 +148,7 @@ static void pmu_write_pram(int offset, __u8 data)
148#define pmu_write_pram NULL 148#define pmu_write_pram NULL
149#endif 149#endif
150 150
151#ifdef CONFIG_ADB_MACIISI 151#if 0 /* def CONFIG_ADB_MACIISI */
152extern int maciisi_request(struct adb_request *req, 152extern int maciisi_request(struct adb_request *req,
153 void (*done)(struct adb_request *), int nbytes, ...); 153 void (*done)(struct adb_request *), int nbytes, ...);
154 154
@@ -717,13 +717,18 @@ int mac_hwclk(int op, struct rtc_time *t)
717 unmktime(now, 0, 717 unmktime(now, 0,
718 &t->tm_year, &t->tm_mon, &t->tm_mday, 718 &t->tm_year, &t->tm_mon, &t->tm_mday,
719 &t->tm_hour, &t->tm_min, &t->tm_sec); 719 &t->tm_hour, &t->tm_min, &t->tm_sec);
720#if 0
720 printk("mac_hwclk: read %04d-%02d-%-2d %02d:%02d:%02d\n", 721 printk("mac_hwclk: read %04d-%02d-%-2d %02d:%02d:%02d\n",
721 t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); 722 t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
723 t->tm_hour, t->tm_min, t->tm_sec);
724#endif
722 } else { /* write */ 725 } else { /* write */
726#if 0
723 printk("mac_hwclk: tried to write %04d-%02d-%-2d %02d:%02d:%02d\n", 727 printk("mac_hwclk: tried to write %04d-%02d-%-2d %02d:%02d:%02d\n",
724 t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); 728 t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
729 t->tm_hour, t->tm_min, t->tm_sec);
730#endif
725 731
726#if 0 /* it trashes my rtc */
727 now = mktime(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, 732 now = mktime(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
728 t->tm_hour, t->tm_min, t->tm_sec); 733 t->tm_hour, t->tm_min, t->tm_sec);
729 734
@@ -742,7 +747,6 @@ int mac_hwclk(int op, struct rtc_time *t)
742 case MAC_ADB_IISI: 747 case MAC_ADB_IISI:
743 maciisi_write_time(now); 748 maciisi_write_time(now);
744 } 749 }
745#endif
746 } 750 }
747 return 0; 751 return 0;
748} 752}
diff --git a/arch/m68k/mac/oss.c b/arch/m68k/mac/oss.c
index 43d83e054b8e..8426501119ca 100644
--- a/arch/m68k/mac/oss.c
+++ b/arch/m68k/mac/oss.c
@@ -21,7 +21,6 @@
21#include <linux/init.h> 21#include <linux/init.h>
22 22
23#include <asm/bootinfo.h> 23#include <asm/bootinfo.h>
24#include <asm/machw.h>
25#include <asm/macintosh.h> 24#include <asm/macintosh.h>
26#include <asm/macints.h> 25#include <asm/macints.h>
27#include <asm/mac_via.h> 26#include <asm/mac_via.h>
diff --git a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c
index 1bdb03c73c0f..f01d418e64fe 100644
--- a/arch/m68k/mac/via.c
+++ b/arch/m68k/mac/via.c
@@ -32,15 +32,10 @@
32#include <asm/bootinfo.h> 32#include <asm/bootinfo.h>
33#include <asm/macintosh.h> 33#include <asm/macintosh.h>
34#include <asm/macints.h> 34#include <asm/macints.h>
35#include <asm/machw.h>
36#include <asm/mac_via.h> 35#include <asm/mac_via.h>
37#include <asm/mac_psc.h> 36#include <asm/mac_psc.h>
38 37
39volatile __u8 *via1, *via2; 38volatile __u8 *via1, *via2;
40#if 0
41/* See note in mac_via.h about how this is possibly not useful */
42volatile long *via_memory_bogon=(long *)&via_memory_bogon;
43#endif
44int rbv_present; 39int rbv_present;
45int via_alt_mapping; 40int via_alt_mapping;
46EXPORT_SYMBOL(via_alt_mapping); 41EXPORT_SYMBOL(via_alt_mapping);
@@ -66,7 +61,7 @@ static int gIER,gIFR,gBufA,gBufB;
66#define MAC_CLOCK_LOW (MAC_CLOCK_TICK&0xFF) 61#define MAC_CLOCK_LOW (MAC_CLOCK_TICK&0xFF)
67#define MAC_CLOCK_HIGH (MAC_CLOCK_TICK>>8) 62#define MAC_CLOCK_HIGH (MAC_CLOCK_TICK>>8)
68 63
69/* To disable a NuBus slot on Quadras we make the slot IRQ lines outputs, set 64/* To disable a NuBus slot on Quadras we make that slot IRQ line an output set
70 * high. On RBV we just use the slot interrupt enable register. On Macs with 65 * high. On RBV we just use the slot interrupt enable register. On Macs with
71 * genuine VIA chips we must use nubus_disabled to keep track of disabled slot 66 * genuine VIA chips we must use nubus_disabled to keep track of disabled slot
72 * interrupts. When any slot IRQ is disabled we mask the (edge triggered) CA1 67 * interrupts. When any slot IRQ is disabled we mask the (edge triggered) CA1
@@ -180,7 +175,7 @@ void __init via_init(void)
180 via1[vT1CH] = 0; 175 via1[vT1CH] = 0;
181 via1[vT2CL] = 0; 176 via1[vT2CL] = 0;
182 via1[vT2CH] = 0; 177 via1[vT2CH] = 0;
183 via1[vACR] &= 0x3F; 178 via1[vACR] &= ~0xC0; /* setup T1 timer with no PB7 output */
184 via1[vACR] &= ~0x03; /* disable port A & B latches */ 179 via1[vACR] &= ~0x03; /* disable port A & B latches */
185 180
186 /* 181 /*
@@ -203,40 +198,41 @@ void __init via_init(void)
203 198
204 /* Everything below this point is VIA2/RBV only... */ 199 /* Everything below this point is VIA2/RBV only... */
205 200
206 if (oss_present) return; 201 if (oss_present)
202 return;
207 203
208#if 1
209 /* Some machines support an alternate IRQ mapping that spreads */ 204 /* Some machines support an alternate IRQ mapping that spreads */
210 /* Ethernet and Sound out to their own autolevel IRQs and moves */ 205 /* Ethernet and Sound out to their own autolevel IRQs and moves */
211 /* VIA1 to level 6. A/UX uses this mapping and we do too. Note */ 206 /* VIA1 to level 6. A/UX uses this mapping and we do too. Note */
212 /* that the IIfx emulates this alternate mapping using the OSS. */ 207 /* that the IIfx emulates this alternate mapping using the OSS. */
213 208
214 switch(macintosh_config->ident) { 209 via_alt_mapping = 0;
215 case MAC_MODEL_P475: 210 if (macintosh_config->via_type == MAC_VIA_QUADRA)
216 case MAC_MODEL_P475F: 211 switch (macintosh_config->ident) {
217 case MAC_MODEL_P575: 212 case MAC_MODEL_C660:
218 case MAC_MODEL_Q605: 213 case MAC_MODEL_Q840:
219 case MAC_MODEL_Q605_ACC: 214 /* not applicable */
220 case MAC_MODEL_C610: 215 break;
221 case MAC_MODEL_Q610: 216 case MAC_MODEL_P588:
222 case MAC_MODEL_Q630: 217 case MAC_MODEL_TV:
223 case MAC_MODEL_C650: 218 case MAC_MODEL_PB140:
224 case MAC_MODEL_Q650: 219 case MAC_MODEL_PB145:
225 case MAC_MODEL_Q700: 220 case MAC_MODEL_PB160:
226 case MAC_MODEL_Q800: 221 case MAC_MODEL_PB165:
227 case MAC_MODEL_Q900: 222 case MAC_MODEL_PB165C:
228 case MAC_MODEL_Q950: 223 case MAC_MODEL_PB170:
224 case MAC_MODEL_PB180:
225 case MAC_MODEL_PB180C:
226 case MAC_MODEL_PB190:
227 case MAC_MODEL_PB520:
228 /* not yet tested */
229 break;
230 default:
229 via_alt_mapping = 1; 231 via_alt_mapping = 1;
230 via1[vDirB] |= 0x40; 232 via1[vDirB] |= 0x40;
231 via1[vBufB] &= ~0x40; 233 via1[vBufB] &= ~0x40;
232 break; 234 break;
233 default: 235 }
234 via_alt_mapping = 0;
235 break;
236 }
237#else
238 via_alt_mapping = 0;
239#endif
240 236
241 /* 237 /*
242 * Now initialize VIA2. For RBV we just kill all interrupts; 238 * Now initialize VIA2. For RBV we just kill all interrupts;
@@ -252,14 +248,17 @@ void __init via_init(void)
252 via2[vT1CH] = 0; 248 via2[vT1CH] = 0;
253 via2[vT2CL] = 0; 249 via2[vT2CL] = 0;
254 via2[vT2CH] = 0; 250 via2[vT2CH] = 0;
255 via2[vACR] &= 0x3F; 251 via2[vACR] &= ~0xC0; /* setup T1 timer with no PB7 output */
256 via2[vACR] &= ~0x03; /* disable port A & B latches */ 252 via2[vACR] &= ~0x03; /* disable port A & B latches */
257 } 253 }
258 254
259 /* 255 /*
260 * Set vPCR for SCSI interrupts (but not on RBV) 256 * Set vPCR for control line interrupts (but not on RBV)
261 */ 257 */
262 if (!rbv_present) { 258 if (!rbv_present) {
259 /* For all VIA types, CA1 (SLOTS IRQ) and CB1 (ASC IRQ)
260 * are made negative edge triggered here.
261 */
263 if (macintosh_config->scsi_type == MAC_SCSI_OLD) { 262 if (macintosh_config->scsi_type == MAC_SCSI_OLD) {
264 /* CB2 (IRQ) indep. input, positive edge */ 263 /* CB2 (IRQ) indep. input, positive edge */
265 /* CA2 (DRQ) indep. input, positive edge */ 264 /* CA2 (DRQ) indep. input, positive edge */
@@ -466,21 +465,6 @@ irqreturn_t via1_irq(int irq, void *dev_id)
466 ++irq_num; 465 ++irq_num;
467 irq_bit <<= 1; 466 irq_bit <<= 1;
468 } while (events >= irq_bit); 467 } while (events >= irq_bit);
469
470#if 0 /* freakin' pmu is doing weird stuff */
471 if (!oss_present) {
472 /* This (still) seems to be necessary to get IDE
473 working. However, if you enable VBL interrupts,
474 you're screwed... */
475 /* FIXME: should we check the SLOTIRQ bit before
476 pulling this stunt? */
477 /* No, it won't be set. that's why we're doing this. */
478 via_irq_disable(IRQ_MAC_NUBUS);
479 via_irq_clear(IRQ_MAC_NUBUS);
480 m68k_handle_int(IRQ_MAC_NUBUS);
481 via_irq_enable(IRQ_MAC_NUBUS);
482 }
483#endif
484 return IRQ_HANDLED; 468 return IRQ_HANDLED;
485} 469}
486 470
diff --git a/arch/m68knommu/include/asm/atomic.h b/arch/m68knommu/include/asm/atomic.h
index d5632a305dae..6bb674855a3f 100644
--- a/arch/m68knommu/include/asm/atomic.h
+++ b/arch/m68knommu/include/asm/atomic.h
@@ -1,6 +1,7 @@
1#ifndef __ARCH_M68KNOMMU_ATOMIC__ 1#ifndef __ARCH_M68KNOMMU_ATOMIC__
2#define __ARCH_M68KNOMMU_ATOMIC__ 2#define __ARCH_M68KNOMMU_ATOMIC__
3 3
4#include <linux/types.h>
4#include <asm/system.h> 5#include <asm/system.h>
5 6
6/* 7/*
@@ -12,7 +13,6 @@
12 * We do not have SMP m68k systems, so we don't have to deal with that. 13 * We do not have SMP m68k systems, so we don't have to deal with that.
13 */ 14 */
14 15
15typedef struct { int counter; } atomic_t;
16#define ATOMIC_INIT(i) { (i) } 16#define ATOMIC_INIT(i) { (i) }
17 17
18#define atomic_read(v) ((v)->counter) 18#define atomic_read(v) ((v)->counter)
diff --git a/arch/m68knommu/include/asm/bitops.h b/arch/m68knommu/include/asm/bitops.h
index 6f3685eab44c..9d3cbe5fad1e 100644
--- a/arch/m68knommu/include/asm/bitops.h
+++ b/arch/m68knommu/include/asm/bitops.h
@@ -331,6 +331,7 @@ found_middle:
331#endif /* __KERNEL__ */ 331#endif /* __KERNEL__ */
332 332
333#include <asm-generic/bitops/fls.h> 333#include <asm-generic/bitops/fls.h>
334#include <asm-generic/bitops/__fls.h>
334#include <asm-generic/bitops/fls64.h> 335#include <asm-generic/bitops/fls64.h>
335 336
336#endif /* _M68KNOMMU_BITOPS_H */ 337#endif /* _M68KNOMMU_BITOPS_H */
diff --git a/arch/m68knommu/kernel/init_task.c b/arch/m68knommu/kernel/init_task.c
index 344c01aede08..fe282de1d596 100644
--- a/arch/m68knommu/kernel/init_task.c
+++ b/arch/m68knommu/kernel/init_task.c
@@ -12,7 +12,6 @@
12#include <asm/uaccess.h> 12#include <asm/uaccess.h>
13#include <asm/pgtable.h> 13#include <asm/pgtable.h>
14 14
15static struct fs_struct init_fs = INIT_FS;
16static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 15static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
17static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
18struct mm_struct init_mm = INIT_MM(init_mm); 17struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/m68knommu/platform/coldfire/pit.c b/arch/m68knommu/platform/coldfire/pit.c
index c5b916700b22..2a12e7fa9748 100644
--- a/arch/m68knommu/platform/coldfire/pit.c
+++ b/arch/m68knommu/platform/coldfire/pit.c
@@ -156,7 +156,7 @@ void hw_timer_init(void)
156{ 156{
157 u32 imr; 157 u32 imr;
158 158
159 cf_pit_clockevent.cpumask = cpumask_of_cpu(smp_processor_id()); 159 cf_pit_clockevent.cpumask = cpumask_of(smp_processor_id());
160 cf_pit_clockevent.mult = div_sc(FREQ, NSEC_PER_SEC, 32); 160 cf_pit_clockevent.mult = div_sc(FREQ, NSEC_PER_SEC, 32);
161 cf_pit_clockevent.max_delta_ns = 161 cf_pit_clockevent.max_delta_ns =
162 clockevent_delta2ns(0xFFFF, &cf_pit_clockevent); 162 clockevent_delta2ns(0xFFFF, &cf_pit_clockevent);
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index f4af967a6b30..a5255e7c79e0 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -653,7 +653,7 @@ config GENERIC_CMOS_UPDATE
653 bool 653 bool
654 default y 654 default y
655 655
656config SCHED_NO_NO_OMIT_FRAME_POINTER 656config SCHED_OMIT_FRAME_POINTER
657 bool 657 bool
658 default y 658 default y
659 659
diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h
index 1232be3885b0..c996c3b4d074 100644
--- a/arch/mips/include/asm/atomic.h
+++ b/arch/mips/include/asm/atomic.h
@@ -15,13 +15,12 @@
15#define _ASM_ATOMIC_H 15#define _ASM_ATOMIC_H
16 16
17#include <linux/irqflags.h> 17#include <linux/irqflags.h>
18#include <linux/types.h>
18#include <asm/barrier.h> 19#include <asm/barrier.h>
19#include <asm/cpu-features.h> 20#include <asm/cpu-features.h>
20#include <asm/war.h> 21#include <asm/war.h>
21#include <asm/system.h> 22#include <asm/system.h>
22 23
23typedef struct { volatile int counter; } atomic_t;
24
25#define ATOMIC_INIT(i) { (i) } 24#define ATOMIC_INIT(i) { (i) }
26 25
27/* 26/*
@@ -404,8 +403,6 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
404 403
405#ifdef CONFIG_64BIT 404#ifdef CONFIG_64BIT
406 405
407typedef struct { volatile long counter; } atomic64_t;
408
409#define ATOMIC64_INIT(i) { (i) } 406#define ATOMIC64_INIT(i) { (i) }
410 407
411/* 408/*
diff --git a/arch/mips/include/asm/irq.h b/arch/mips/include/asm/irq.h
index a58f0eecc68f..abc62aa744ac 100644
--- a/arch/mips/include/asm/irq.h
+++ b/arch/mips/include/asm/irq.h
@@ -49,7 +49,8 @@ static inline void smtc_im_ack_irq(unsigned int irq)
49#ifdef CONFIG_MIPS_MT_SMTC_IRQAFF 49#ifdef CONFIG_MIPS_MT_SMTC_IRQAFF
50#include <linux/cpumask.h> 50#include <linux/cpumask.h>
51 51
52extern void plat_set_irq_affinity(unsigned int irq, cpumask_t affinity); 52extern void plat_set_irq_affinity(unsigned int irq,
53 const struct cpumask *affinity);
53extern void smtc_forward_irq(unsigned int irq); 54extern void smtc_forward_irq(unsigned int irq);
54 55
55/* 56/*
diff --git a/arch/mips/include/asm/mach-ip27/topology.h b/arch/mips/include/asm/mach-ip27/topology.h
index 7785bec732f2..55d481569a1f 100644
--- a/arch/mips/include/asm/mach-ip27/topology.h
+++ b/arch/mips/include/asm/mach-ip27/topology.h
@@ -25,11 +25,13 @@ extern struct cpuinfo_ip27 sn_cpu_info[NR_CPUS];
25#define cpu_to_node(cpu) (sn_cpu_info[(cpu)].p_nodeid) 25#define cpu_to_node(cpu) (sn_cpu_info[(cpu)].p_nodeid)
26#define parent_node(node) (node) 26#define parent_node(node) (node)
27#define node_to_cpumask(node) (hub_data(node)->h_cpus) 27#define node_to_cpumask(node) (hub_data(node)->h_cpus)
28#define node_to_first_cpu(node) (first_cpu(node_to_cpumask(node))) 28#define cpumask_of_node(node) (&hub_data(node)->h_cpus)
29#define node_to_first_cpu(node) (cpumask_first(cpumask_of_node(node)))
29struct pci_bus; 30struct pci_bus;
30extern int pcibus_to_node(struct pci_bus *); 31extern int pcibus_to_node(struct pci_bus *);
31 32
32#define pcibus_to_cpumask(bus) (cpu_online_map) 33#define pcibus_to_cpumask(bus) (cpu_online_map)
34#define cpumask_of_pcibus(bus) (cpu_online_mask)
33 35
34extern unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES]; 36extern unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES];
35 37
@@ -37,7 +39,6 @@ extern unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES];
37 39
38/* sched_domains SD_NODE_INIT for SGI IP27 machines */ 40/* sched_domains SD_NODE_INIT for SGI IP27 machines */
39#define SD_NODE_INIT (struct sched_domain) { \ 41#define SD_NODE_INIT (struct sched_domain) { \
40 .span = CPU_MASK_NONE, \
41 .parent = NULL, \ 42 .parent = NULL, \
42 .child = NULL, \ 43 .child = NULL, \
43 .groups = NULL, \ 44 .groups = NULL, \
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h
index 0ff5b523ea77..86557b5d1b3f 100644
--- a/arch/mips/include/asm/smp.h
+++ b/arch/mips/include/asm/smp.h
@@ -38,9 +38,6 @@ extern int __cpu_logical_map[NR_CPUS];
38#define SMP_RESCHEDULE_YOURSELF 0x1 /* XXX braindead */ 38#define SMP_RESCHEDULE_YOURSELF 0x1 /* XXX braindead */
39#define SMP_CALL_FUNCTION 0x2 39#define SMP_CALL_FUNCTION 0x2
40 40
41extern cpumask_t phys_cpu_present_map;
42#define cpu_possible_map phys_cpu_present_map
43
44extern void asmlinkage smp_bootstrap(void); 41extern void asmlinkage smp_bootstrap(void);
45 42
46/* 43/*
diff --git a/arch/mips/jazz/irq.c b/arch/mips/jazz/irq.c
index d7f8a782aae4..03965cb1b252 100644
--- a/arch/mips/jazz/irq.c
+++ b/arch/mips/jazz/irq.c
@@ -146,7 +146,7 @@ void __init plat_time_init(void)
146 146
147 BUG_ON(HZ != 100); 147 BUG_ON(HZ != 100);
148 148
149 cd->cpumask = cpumask_of_cpu(cpu); 149 cd->cpumask = cpumask_of(cpu);
150 clockevents_register_device(cd); 150 clockevents_register_device(cd);
151 action->dev_id = cd; 151 action->dev_id = cd;
152 setup_irq(JAZZ_TIMER_IRQ, action); 152 setup_irq(JAZZ_TIMER_IRQ, action);
diff --git a/arch/mips/kernel/cevt-bcm1480.c b/arch/mips/kernel/cevt-bcm1480.c
index 0a57f86945f1..b820661678b0 100644
--- a/arch/mips/kernel/cevt-bcm1480.c
+++ b/arch/mips/kernel/cevt-bcm1480.c
@@ -126,7 +126,7 @@ void __cpuinit sb1480_clockevent_init(void)
126 cd->min_delta_ns = clockevent_delta2ns(2, cd); 126 cd->min_delta_ns = clockevent_delta2ns(2, cd);
127 cd->rating = 200; 127 cd->rating = 200;
128 cd->irq = irq; 128 cd->irq = irq;
129 cd->cpumask = cpumask_of_cpu(cpu); 129 cd->cpumask = cpumask_of(cpu);
130 cd->set_next_event = sibyte_next_event; 130 cd->set_next_event = sibyte_next_event;
131 cd->set_mode = sibyte_set_mode; 131 cd->set_mode = sibyte_set_mode;
132 clockevents_register_device(cd); 132 clockevents_register_device(cd);
@@ -148,6 +148,6 @@ void __cpuinit sb1480_clockevent_init(void)
148 action->name = name; 148 action->name = name;
149 action->dev_id = cd; 149 action->dev_id = cd;
150 150
151 irq_set_affinity(irq, cpumask_of_cpu(cpu)); 151 irq_set_affinity(irq, cpumask_of(cpu));
152 setup_irq(irq, action); 152 setup_irq(irq, action);
153} 153}
diff --git a/arch/mips/kernel/cevt-ds1287.c b/arch/mips/kernel/cevt-ds1287.c
index df4acb68bfb5..1ada45ea0700 100644
--- a/arch/mips/kernel/cevt-ds1287.c
+++ b/arch/mips/kernel/cevt-ds1287.c
@@ -88,7 +88,6 @@ static void ds1287_event_handler(struct clock_event_device *dev)
88static struct clock_event_device ds1287_clockevent = { 88static struct clock_event_device ds1287_clockevent = {
89 .name = "ds1287", 89 .name = "ds1287",
90 .features = CLOCK_EVT_FEAT_PERIODIC, 90 .features = CLOCK_EVT_FEAT_PERIODIC,
91 .cpumask = CPU_MASK_CPU0,
92 .set_next_event = ds1287_set_next_event, 91 .set_next_event = ds1287_set_next_event,
93 .set_mode = ds1287_set_mode, 92 .set_mode = ds1287_set_mode,
94 .event_handler = ds1287_event_handler, 93 .event_handler = ds1287_event_handler,
@@ -122,6 +121,7 @@ int __init ds1287_clockevent_init(int irq)
122 clockevent_set_clock(cd, 32768); 121 clockevent_set_clock(cd, 32768);
123 cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd); 122 cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd);
124 cd->min_delta_ns = clockevent_delta2ns(0x300, cd); 123 cd->min_delta_ns = clockevent_delta2ns(0x300, cd);
124 cd->cpumask = cpumask_of(0);
125 125
126 clockevents_register_device(&ds1287_clockevent); 126 clockevents_register_device(&ds1287_clockevent);
127 127
diff --git a/arch/mips/kernel/cevt-gt641xx.c b/arch/mips/kernel/cevt-gt641xx.c
index 6e2f58520afb..e9b787feedcb 100644
--- a/arch/mips/kernel/cevt-gt641xx.c
+++ b/arch/mips/kernel/cevt-gt641xx.c
@@ -96,7 +96,6 @@ static void gt641xx_timer0_event_handler(struct clock_event_device *dev)
96static struct clock_event_device gt641xx_timer0_clockevent = { 96static struct clock_event_device gt641xx_timer0_clockevent = {
97 .name = "gt641xx-timer0", 97 .name = "gt641xx-timer0",
98 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 98 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
99 .cpumask = CPU_MASK_CPU0,
100 .irq = GT641XX_TIMER0_IRQ, 99 .irq = GT641XX_TIMER0_IRQ,
101 .set_next_event = gt641xx_timer0_set_next_event, 100 .set_next_event = gt641xx_timer0_set_next_event,
102 .set_mode = gt641xx_timer0_set_mode, 101 .set_mode = gt641xx_timer0_set_mode,
@@ -132,6 +131,7 @@ static int __init gt641xx_timer0_clockevent_init(void)
132 clockevent_set_clock(cd, gt641xx_base_clock); 131 clockevent_set_clock(cd, gt641xx_base_clock);
133 cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd); 132 cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd);
134 cd->min_delta_ns = clockevent_delta2ns(0x300, cd); 133 cd->min_delta_ns = clockevent_delta2ns(0x300, cd);
134 cd->cpumask = cpumask_of(0);
135 135
136 clockevents_register_device(&gt641xx_timer0_clockevent); 136 clockevents_register_device(&gt641xx_timer0_clockevent);
137 137
diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c
index 4a4c59f2737a..e1ec83b68031 100644
--- a/arch/mips/kernel/cevt-r4k.c
+++ b/arch/mips/kernel/cevt-r4k.c
@@ -195,7 +195,7 @@ int __cpuinit mips_clockevent_init(void)
195 195
196 cd->rating = 300; 196 cd->rating = 300;
197 cd->irq = irq; 197 cd->irq = irq;
198 cd->cpumask = cpumask_of_cpu(cpu); 198 cd->cpumask = cpumask_of(cpu);
199 cd->set_next_event = mips_next_event; 199 cd->set_next_event = mips_next_event;
200 cd->set_mode = mips_set_clock_mode; 200 cd->set_mode = mips_set_clock_mode;
201 cd->event_handler = mips_event_handler; 201 cd->event_handler = mips_event_handler;
diff --git a/arch/mips/kernel/cevt-sb1250.c b/arch/mips/kernel/cevt-sb1250.c
index 63ac3ad462bc..a2eebaafda52 100644
--- a/arch/mips/kernel/cevt-sb1250.c
+++ b/arch/mips/kernel/cevt-sb1250.c
@@ -125,7 +125,7 @@ void __cpuinit sb1250_clockevent_init(void)
125 cd->min_delta_ns = clockevent_delta2ns(2, cd); 125 cd->min_delta_ns = clockevent_delta2ns(2, cd);
126 cd->rating = 200; 126 cd->rating = 200;
127 cd->irq = irq; 127 cd->irq = irq;
128 cd->cpumask = cpumask_of_cpu(cpu); 128 cd->cpumask = cpumask_of(cpu);
129 cd->set_next_event = sibyte_next_event; 129 cd->set_next_event = sibyte_next_event;
130 cd->set_mode = sibyte_set_mode; 130 cd->set_mode = sibyte_set_mode;
131 clockevents_register_device(cd); 131 clockevents_register_device(cd);
@@ -147,6 +147,6 @@ void __cpuinit sb1250_clockevent_init(void)
147 action->name = name; 147 action->name = name;
148 action->dev_id = cd; 148 action->dev_id = cd;
149 149
150 irq_set_affinity(irq, cpumask_of_cpu(cpu)); 150 irq_set_affinity(irq, cpumask_of(cpu));
151 setup_irq(irq, action); 151 setup_irq(irq, action);
152} 152}
diff --git a/arch/mips/kernel/cevt-smtc.c b/arch/mips/kernel/cevt-smtc.c
index 5162fe4b5952..6d45e24db5bf 100644
--- a/arch/mips/kernel/cevt-smtc.c
+++ b/arch/mips/kernel/cevt-smtc.c
@@ -292,7 +292,7 @@ int __cpuinit mips_clockevent_init(void)
292 292
293 cd->rating = 300; 293 cd->rating = 300;
294 cd->irq = irq; 294 cd->irq = irq;
295 cd->cpumask = cpumask_of_cpu(cpu); 295 cd->cpumask = cpumask_of(cpu);
296 cd->set_next_event = mips_next_event; 296 cd->set_next_event = mips_next_event;
297 cd->set_mode = mips_set_clock_mode; 297 cd->set_mode = mips_set_clock_mode;
298 cd->event_handler = mips_event_handler; 298 cd->event_handler = mips_event_handler;
diff --git a/arch/mips/kernel/cevt-txx9.c b/arch/mips/kernel/cevt-txx9.c
index b5fc4eb412d2..eccf7d6096bd 100644
--- a/arch/mips/kernel/cevt-txx9.c
+++ b/arch/mips/kernel/cevt-txx9.c
@@ -112,7 +112,6 @@ static struct clock_event_device txx9tmr_clock_event_device = {
112 .name = "TXx9", 112 .name = "TXx9",
113 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 113 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
114 .rating = 200, 114 .rating = 200,
115 .cpumask = CPU_MASK_CPU0,
116 .set_mode = txx9tmr_set_mode, 115 .set_mode = txx9tmr_set_mode,
117 .set_next_event = txx9tmr_set_next_event, 116 .set_next_event = txx9tmr_set_next_event,
118}; 117};
@@ -150,6 +149,7 @@ void __init txx9_clockevent_init(unsigned long baseaddr, int irq,
150 clockevent_delta2ns(0xffffffff >> (32 - TXX9_TIMER_BITS), cd); 149 clockevent_delta2ns(0xffffffff >> (32 - TXX9_TIMER_BITS), cd);
151 cd->min_delta_ns = clockevent_delta2ns(0xf, cd); 150 cd->min_delta_ns = clockevent_delta2ns(0xf, cd);
152 cd->irq = irq; 151 cd->irq = irq;
152 cd->cpumask = cpumask_of(0),
153 clockevents_register_device(cd); 153 clockevents_register_device(cd);
154 setup_irq(irq, &txx9tmr_irq); 154 setup_irq(irq, &txx9tmr_irq);
155 printk(KERN_INFO "TXx9: clockevent device at 0x%lx, irq %d\n", 155 printk(KERN_INFO "TXx9: clockevent device at 0x%lx, irq %d\n",
diff --git a/arch/mips/kernel/i8253.c b/arch/mips/kernel/i8253.c
index b6ac55162b9a..f4d187825f96 100644
--- a/arch/mips/kernel/i8253.c
+++ b/arch/mips/kernel/i8253.c
@@ -115,7 +115,7 @@ void __init setup_pit_timer(void)
115 * Start pit with the boot cpu mask and make it global after the 115 * Start pit with the boot cpu mask and make it global after the
116 * IO_APIC has been initialized. 116 * IO_APIC has been initialized.
117 */ 117 */
118 cd->cpumask = cpumask_of_cpu(cpu); 118 cd->cpumask = cpumask_of(cpu);
119 clockevent_set_clock(cd, CLOCK_TICK_RATE); 119 clockevent_set_clock(cd, CLOCK_TICK_RATE);
120 cd->max_delta_ns = clockevent_delta2ns(0x7FFF, cd); 120 cd->max_delta_ns = clockevent_delta2ns(0x7FFF, cd);
121 cd->min_delta_ns = clockevent_delta2ns(0xF, cd); 121 cd->min_delta_ns = clockevent_delta2ns(0xF, cd);
diff --git a/arch/mips/kernel/init_task.c b/arch/mips/kernel/init_task.c
index d72487ad7c15..149cd914526e 100644
--- a/arch/mips/kernel/init_task.c
+++ b/arch/mips/kernel/init_task.c
@@ -9,7 +9,6 @@
9#include <asm/uaccess.h> 9#include <asm/uaccess.h>
10#include <asm/pgtable.h> 10#include <asm/pgtable.h>
11 11
12static struct fs_struct init_fs = INIT_FS;
13static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 12static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
14static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 13static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
15struct mm_struct init_mm = INIT_MM(init_mm); 14struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/mips/kernel/irq-gic.c b/arch/mips/kernel/irq-gic.c
index f0a4bb19e096..494a49a317e9 100644
--- a/arch/mips/kernel/irq-gic.c
+++ b/arch/mips/kernel/irq-gic.c
@@ -155,7 +155,7 @@ static void gic_unmask_irq(unsigned int irq)
155 155
156static DEFINE_SPINLOCK(gic_lock); 156static DEFINE_SPINLOCK(gic_lock);
157 157
158static void gic_set_affinity(unsigned int irq, cpumask_t cpumask) 158static void gic_set_affinity(unsigned int irq, const struct cpumask *cpumask)
159{ 159{
160 cpumask_t tmp = CPU_MASK_NONE; 160 cpumask_t tmp = CPU_MASK_NONE;
161 unsigned long flags; 161 unsigned long flags;
@@ -164,7 +164,7 @@ static void gic_set_affinity(unsigned int irq, cpumask_t cpumask)
164 pr_debug(KERN_DEBUG "%s called\n", __func__); 164 pr_debug(KERN_DEBUG "%s called\n", __func__);
165 irq -= _irqbase; 165 irq -= _irqbase;
166 166
167 cpus_and(tmp, cpumask, cpu_online_map); 167 cpumask_and(&tmp, cpumask, cpu_online_mask);
168 if (cpus_empty(tmp)) 168 if (cpus_empty(tmp))
169 return; 169 return;
170 170
@@ -187,7 +187,7 @@ static void gic_set_affinity(unsigned int irq, cpumask_t cpumask)
187 set_bit(irq, pcpu_masks[first_cpu(tmp)].pcpu_mask); 187 set_bit(irq, pcpu_masks[first_cpu(tmp)].pcpu_mask);
188 188
189 } 189 }
190 irq_desc[irq].affinity = cpumask; 190 irq_desc[irq].affinity = *cpumask;
191 spin_unlock_irqrestore(&gic_lock, flags); 191 spin_unlock_irqrestore(&gic_lock, flags);
192 192
193} 193}
diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c
index b0591ae0ce56..fd6e51224034 100644
--- a/arch/mips/kernel/kspd.c
+++ b/arch/mips/kernel/kspd.c
@@ -174,8 +174,8 @@ static unsigned int translate_open_flags(int flags)
174 174
175static void sp_setfsuidgid( uid_t uid, gid_t gid) 175static void sp_setfsuidgid( uid_t uid, gid_t gid)
176{ 176{
177 current->fsuid = uid; 177 current->cred->fsuid = uid;
178 current->fsgid = gid; 178 current->cred->fsgid = gid;
179 179
180 key_fsuid_changed(current); 180 key_fsuid_changed(current);
181 key_fsgid_changed(current); 181 key_fsgid_changed(current);
diff --git a/arch/mips/kernel/mips-mt-fpaff.c b/arch/mips/kernel/mips-mt-fpaff.c
index dc9eb72ed9de..5e77a3a21f98 100644
--- a/arch/mips/kernel/mips-mt-fpaff.c
+++ b/arch/mips/kernel/mips-mt-fpaff.c
@@ -51,6 +51,7 @@ asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len,
51 int retval; 51 int retval;
52 struct task_struct *p; 52 struct task_struct *p;
53 struct thread_info *ti; 53 struct thread_info *ti;
54 uid_t euid;
54 55
55 if (len < sizeof(new_mask)) 56 if (len < sizeof(new_mask))
56 return -EINVAL; 57 return -EINVAL;
@@ -76,9 +77,9 @@ asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len,
76 */ 77 */
77 get_task_struct(p); 78 get_task_struct(p);
78 79
80 euid = current_euid();
79 retval = -EPERM; 81 retval = -EPERM;
80 if ((current->euid != p->euid) && (current->euid != p->uid) && 82 if (euid != p->euid && euid != p->uid && !capable(CAP_SYS_NICE)) {
81 !capable(CAP_SYS_NICE)) {
82 read_unlock(&tasklist_lock); 83 read_unlock(&tasklist_lock);
83 goto out_unlock; 84 goto out_unlock;
84 } 85 }
diff --git a/arch/mips/kernel/smp-cmp.c b/arch/mips/kernel/smp-cmp.c
index ca476c4f62a5..f27beca4b26d 100644
--- a/arch/mips/kernel/smp-cmp.c
+++ b/arch/mips/kernel/smp-cmp.c
@@ -51,10 +51,10 @@ static int __init allowcpus(char *str)
51 int len; 51 int len;
52 52
53 cpus_clear(cpu_allow_map); 53 cpus_clear(cpu_allow_map);
54 if (cpulist_parse(str, cpu_allow_map) == 0) { 54 if (cpulist_parse(str, &cpu_allow_map) == 0) {
55 cpu_set(0, cpu_allow_map); 55 cpu_set(0, cpu_allow_map);
56 cpus_and(cpu_possible_map, cpu_possible_map, cpu_allow_map); 56 cpus_and(cpu_possible_map, cpu_possible_map, cpu_allow_map);
57 len = cpulist_scnprintf(buf, sizeof(buf)-1, cpu_possible_map); 57 len = cpulist_scnprintf(buf, sizeof(buf)-1, &cpu_possible_map);
58 buf[len] = '\0'; 58 buf[len] = '\0';
59 pr_debug("Allowable CPUs: %s\n", buf); 59 pr_debug("Allowable CPUs: %s\n", buf);
60 return 1; 60 return 1;
@@ -226,7 +226,7 @@ void __init cmp_smp_setup(void)
226 226
227 for (i = 1; i < NR_CPUS; i++) { 227 for (i = 1; i < NR_CPUS; i++) {
228 if (amon_cpu_avail(i)) { 228 if (amon_cpu_avail(i)) {
229 cpu_set(i, phys_cpu_present_map); 229 cpu_set(i, cpu_possible_map);
230 __cpu_number_map[i] = ++ncpu; 230 __cpu_number_map[i] = ++ncpu;
231 __cpu_logical_map[ncpu] = i; 231 __cpu_logical_map[ncpu] = i;
232 } 232 }
diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c
index 87a1816c1f45..6f7ee5ac46ee 100644
--- a/arch/mips/kernel/smp-mt.c
+++ b/arch/mips/kernel/smp-mt.c
@@ -70,7 +70,7 @@ static unsigned int __init smvp_vpe_init(unsigned int tc, unsigned int mvpconf0,
70 write_vpe_c0_vpeconf0(tmp); 70 write_vpe_c0_vpeconf0(tmp);
71 71
72 /* Record this as available CPU */ 72 /* Record this as available CPU */
73 cpu_set(tc, phys_cpu_present_map); 73 cpu_set(tc, cpu_possible_map);
74 __cpu_number_map[tc] = ++ncpu; 74 __cpu_number_map[tc] = ++ncpu;
75 __cpu_logical_map[ncpu] = tc; 75 __cpu_logical_map[ncpu] = tc;
76 } 76 }
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 8bf88faf5afd..3da94704f816 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -44,15 +44,10 @@
44#include <asm/mipsmtregs.h> 44#include <asm/mipsmtregs.h>
45#endif /* CONFIG_MIPS_MT_SMTC */ 45#endif /* CONFIG_MIPS_MT_SMTC */
46 46
47cpumask_t phys_cpu_present_map; /* Bitmask of available CPUs */
48volatile cpumask_t cpu_callin_map; /* Bitmask of started secondaries */ 47volatile cpumask_t cpu_callin_map; /* Bitmask of started secondaries */
49cpumask_t cpu_online_map; /* Bitmask of currently online CPUs */
50int __cpu_number_map[NR_CPUS]; /* Map physical to logical */ 48int __cpu_number_map[NR_CPUS]; /* Map physical to logical */
51int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */ 49int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */
52 50
53EXPORT_SYMBOL(phys_cpu_present_map);
54EXPORT_SYMBOL(cpu_online_map);
55
56extern void cpu_idle(void); 51extern void cpu_idle(void);
57 52
58/* Number of TCs (or siblings in Intel speak) per CPU core */ 53/* Number of TCs (or siblings in Intel speak) per CPU core */
@@ -195,7 +190,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
195/* preload SMP state for boot cpu */ 190/* preload SMP state for boot cpu */
196void __devinit smp_prepare_boot_cpu(void) 191void __devinit smp_prepare_boot_cpu(void)
197{ 192{
198 cpu_set(0, phys_cpu_present_map); 193 cpu_set(0, cpu_possible_map);
199 cpu_set(0, cpu_online_map); 194 cpu_set(0, cpu_online_map);
200 cpu_set(0, cpu_callin_map); 195 cpu_set(0, cpu_callin_map);
201} 196}
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index 897fb2b4751c..b6cca01ff82b 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -290,7 +290,7 @@ static void smtc_configure_tlb(void)
290 * possibly leave some TCs/VPEs as "slave" processors. 290 * possibly leave some TCs/VPEs as "slave" processors.
291 * 291 *
292 * Use c0_MVPConf0 to find out how many TCs are available, setting up 292 * Use c0_MVPConf0 to find out how many TCs are available, setting up
293 * phys_cpu_present_map and the logical/physical mappings. 293 * cpu_possible_map and the logical/physical mappings.
294 */ 294 */
295 295
296int __init smtc_build_cpu_map(int start_cpu_slot) 296int __init smtc_build_cpu_map(int start_cpu_slot)
@@ -304,7 +304,7 @@ int __init smtc_build_cpu_map(int start_cpu_slot)
304 */ 304 */
305 ntcs = ((read_c0_mvpconf0() & MVPCONF0_PTC) >> MVPCONF0_PTC_SHIFT) + 1; 305 ntcs = ((read_c0_mvpconf0() & MVPCONF0_PTC) >> MVPCONF0_PTC_SHIFT) + 1;
306 for (i=start_cpu_slot; i<NR_CPUS && i<ntcs; i++) { 306 for (i=start_cpu_slot; i<NR_CPUS && i<ntcs; i++) {
307 cpu_set(i, phys_cpu_present_map); 307 cpu_set(i, cpu_possible_map);
308 __cpu_number_map[i] = i; 308 __cpu_number_map[i] = i;
309 __cpu_logical_map[i] = i; 309 __cpu_logical_map[i] = i;
310 } 310 }
@@ -521,7 +521,7 @@ void smtc_prepare_cpus(int cpus)
521 * Pull any physically present but unused TCs out of circulation. 521 * Pull any physically present but unused TCs out of circulation.
522 */ 522 */
523 while (tc < (((val & MVPCONF0_PTC) >> MVPCONF0_PTC_SHIFT) + 1)) { 523 while (tc < (((val & MVPCONF0_PTC) >> MVPCONF0_PTC_SHIFT) + 1)) {
524 cpu_clear(tc, phys_cpu_present_map); 524 cpu_clear(tc, cpu_possible_map);
525 cpu_clear(tc, cpu_present_map); 525 cpu_clear(tc, cpu_present_map);
526 tc++; 526 tc++;
527 } 527 }
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index a1b3da6bad5c..3ca5f42e819d 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -1085,8 +1085,8 @@ static int vpe_open(struct inode *inode, struct file *filp)
1085 v->load_addr = NULL; 1085 v->load_addr = NULL;
1086 v->len = 0; 1086 v->len = 0;
1087 1087
1088 v->uid = filp->f_uid; 1088 v->uid = filp->f_cred->fsuid;
1089 v->gid = filp->f_gid; 1089 v->gid = filp->f_cred->fsgid;
1090 1090
1091#ifdef CONFIG_MIPS_APSP_KSPD 1091#ifdef CONFIG_MIPS_APSP_KSPD
1092 /* get kspd to tell us when a syscall_exit happens */ 1092 /* get kspd to tell us when a syscall_exit happens */
@@ -1454,7 +1454,7 @@ static int __init vpe_module_init(void)
1454 device_initialize(&vpe_device); 1454 device_initialize(&vpe_device);
1455 vpe_device.class = &vpe_class, 1455 vpe_device.class = &vpe_class,
1456 vpe_device.parent = NULL, 1456 vpe_device.parent = NULL,
1457 strlcpy(vpe_device.bus_id, "vpe1", BUS_ID_SIZE); 1457 dev_set_name(&vpe_device, "vpe1");
1458 vpe_device.devt = MKDEV(major, minor); 1458 vpe_device.devt = MKDEV(major, minor);
1459 err = device_add(&vpe_device); 1459 err = device_add(&vpe_device);
1460 if (err) { 1460 if (err) {
diff --git a/arch/mips/mti-malta/malta-smtc.c b/arch/mips/mti-malta/malta-smtc.c
index f84a46a8ae6e..aabd7274507b 100644
--- a/arch/mips/mti-malta/malta-smtc.c
+++ b/arch/mips/mti-malta/malta-smtc.c
@@ -114,9 +114,9 @@ struct plat_smp_ops msmtc_smp_ops = {
114 */ 114 */
115 115
116 116
117void plat_set_irq_affinity(unsigned int irq, cpumask_t affinity) 117void plat_set_irq_affinity(unsigned int irq, const struct cpumask *affinity)
118{ 118{
119 cpumask_t tmask = affinity; 119 cpumask_t tmask = *affinity;
120 int cpu = 0; 120 int cpu = 0;
121 void smtc_set_irq_affinity(unsigned int irq, cpumask_t aff); 121 void smtc_set_irq_affinity(unsigned int irq, cpumask_t aff);
122 122
@@ -139,7 +139,7 @@ void plat_set_irq_affinity(unsigned int irq, cpumask_t affinity)
139 * be made to forward to an offline "CPU". 139 * be made to forward to an offline "CPU".
140 */ 140 */
141 141
142 for_each_cpu_mask(cpu, affinity) { 142 for_each_cpu(cpu, affinity) {
143 if ((cpu_data[cpu].vpe_id != 0) || !cpu_online(cpu)) 143 if ((cpu_data[cpu].vpe_id != 0) || !cpu_online(cpu))
144 cpu_clear(cpu, tmask); 144 cpu_clear(cpu, tmask);
145 } 145 }
diff --git a/arch/mips/nxp/pnx8550/common/time.c b/arch/mips/nxp/pnx8550/common/time.c
index 62f495b57f93..cf293b279098 100644
--- a/arch/mips/nxp/pnx8550/common/time.c
+++ b/arch/mips/nxp/pnx8550/common/time.c
@@ -102,6 +102,7 @@ __init void plat_time_init(void)
102 unsigned int p; 102 unsigned int p;
103 unsigned int pow2p; 103 unsigned int pow2p;
104 104
105 pnx8xxx_clockevent.cpumask = cpu_none_mask;
105 clockevents_register_device(&pnx8xxx_clockevent); 106 clockevents_register_device(&pnx8xxx_clockevent);
106 clocksource_register(&pnx_clocksource); 107 clocksource_register(&pnx_clocksource);
107 108
diff --git a/arch/mips/pmc-sierra/yosemite/smp.c b/arch/mips/pmc-sierra/yosemite/smp.c
index 3a7df647ca77..f78c29b68d77 100644
--- a/arch/mips/pmc-sierra/yosemite/smp.c
+++ b/arch/mips/pmc-sierra/yosemite/smp.c
@@ -141,7 +141,7 @@ static void __cpuinit yos_boot_secondary(int cpu, struct task_struct *idle)
141} 141}
142 142
143/* 143/*
144 * Detect available CPUs, populate phys_cpu_present_map before smp_init 144 * Detect available CPUs, populate cpu_possible_map before smp_init
145 * 145 *
146 * We don't want to start the secondary CPU yet nor do we have a nice probing 146 * We don't want to start the secondary CPU yet nor do we have a nice probing
147 * feature in PMON so we just assume presence of the secondary core. 147 * feature in PMON so we just assume presence of the secondary core.
@@ -150,10 +150,10 @@ static void __init yos_smp_setup(void)
150{ 150{
151 int i; 151 int i;
152 152
153 cpus_clear(phys_cpu_present_map); 153 cpus_clear(cpu_possible_map);
154 154
155 for (i = 0; i < 2; i++) { 155 for (i = 0; i < 2; i++) {
156 cpu_set(i, phys_cpu_present_map); 156 cpu_set(i, cpu_possible_map);
157 __cpu_number_map[i] = i; 157 __cpu_number_map[i] = i;
158 __cpu_logical_map[i] = i; 158 __cpu_logical_map[i] = i;
159 } 159 }
diff --git a/arch/mips/sgi-ip27/ip27-smp.c b/arch/mips/sgi-ip27/ip27-smp.c
index ba5cdebeaf0d..5b47d6b65275 100644
--- a/arch/mips/sgi-ip27/ip27-smp.c
+++ b/arch/mips/sgi-ip27/ip27-smp.c
@@ -76,7 +76,7 @@ static int do_cpumask(cnodeid_t cnode, nasid_t nasid, int highest)
76 /* Only let it join in if it's marked enabled */ 76 /* Only let it join in if it's marked enabled */
77 if ((acpu->cpu_info.flags & KLINFO_ENABLE) && 77 if ((acpu->cpu_info.flags & KLINFO_ENABLE) &&
78 (tot_cpus_found != NR_CPUS)) { 78 (tot_cpus_found != NR_CPUS)) {
79 cpu_set(cpuid, phys_cpu_present_map); 79 cpu_set(cpuid, cpu_possible_map);
80 alloc_cpupda(cpuid, tot_cpus_found); 80 alloc_cpupda(cpuid, tot_cpus_found);
81 cpus_found++; 81 cpus_found++;
82 tot_cpus_found++; 82 tot_cpus_found++;
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index 1327c2746fb7..f024057a35f8 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -134,7 +134,7 @@ void __cpuinit hub_rt_clock_event_init(void)
134 cd->min_delta_ns = clockevent_delta2ns(0x300, cd); 134 cd->min_delta_ns = clockevent_delta2ns(0x300, cd);
135 cd->rating = 200; 135 cd->rating = 200;
136 cd->irq = irq; 136 cd->irq = irq;
137 cd->cpumask = cpumask_of_cpu(cpu); 137 cd->cpumask = cpumask_of(cpu);
138 cd->set_next_event = rt_next_event; 138 cd->set_next_event = rt_next_event;
139 cd->set_mode = rt_set_mode; 139 cd->set_mode = rt_set_mode;
140 clockevents_register_device(cd); 140 clockevents_register_device(cd);
diff --git a/arch/mips/sibyte/bcm1480/irq.c b/arch/mips/sibyte/bcm1480/irq.c
index a35818ed4263..12b465d404df 100644
--- a/arch/mips/sibyte/bcm1480/irq.c
+++ b/arch/mips/sibyte/bcm1480/irq.c
@@ -50,7 +50,7 @@ static void enable_bcm1480_irq(unsigned int irq);
50static void disable_bcm1480_irq(unsigned int irq); 50static void disable_bcm1480_irq(unsigned int irq);
51static void ack_bcm1480_irq(unsigned int irq); 51static void ack_bcm1480_irq(unsigned int irq);
52#ifdef CONFIG_SMP 52#ifdef CONFIG_SMP
53static void bcm1480_set_affinity(unsigned int irq, cpumask_t mask); 53static void bcm1480_set_affinity(unsigned int irq, const struct cpumask *mask);
54#endif 54#endif
55 55
56#ifdef CONFIG_PCI 56#ifdef CONFIG_PCI
@@ -109,7 +109,7 @@ void bcm1480_unmask_irq(int cpu, int irq)
109} 109}
110 110
111#ifdef CONFIG_SMP 111#ifdef CONFIG_SMP
112static void bcm1480_set_affinity(unsigned int irq, cpumask_t mask) 112static void bcm1480_set_affinity(unsigned int irq, const struct cpumask *mask)
113{ 113{
114 int i = 0, old_cpu, cpu, int_on, k; 114 int i = 0, old_cpu, cpu, int_on, k;
115 u64 cur_ints; 115 u64 cur_ints;
@@ -117,11 +117,11 @@ static void bcm1480_set_affinity(unsigned int irq, cpumask_t mask)
117 unsigned long flags; 117 unsigned long flags;
118 unsigned int irq_dirty; 118 unsigned int irq_dirty;
119 119
120 if (cpus_weight(mask) != 1) { 120 if (cpumask_weight(mask) != 1) {
121 printk("attempted to set irq affinity for irq %d to multiple CPUs\n", irq); 121 printk("attempted to set irq affinity for irq %d to multiple CPUs\n", irq);
122 return; 122 return;
123 } 123 }
124 i = first_cpu(mask); 124 i = cpumask_first(mask);
125 125
126 /* Convert logical CPU to physical CPU */ 126 /* Convert logical CPU to physical CPU */
127 cpu = cpu_logical_map(i); 127 cpu = cpu_logical_map(i);
diff --git a/arch/mips/sibyte/bcm1480/smp.c b/arch/mips/sibyte/bcm1480/smp.c
index bd9eeb43ed0e..dddfda8e8294 100644
--- a/arch/mips/sibyte/bcm1480/smp.c
+++ b/arch/mips/sibyte/bcm1480/smp.c
@@ -136,7 +136,7 @@ static void __cpuinit bcm1480_boot_secondary(int cpu, struct task_struct *idle)
136 136
137/* 137/*
138 * Use CFE to find out how many CPUs are available, setting up 138 * Use CFE to find out how many CPUs are available, setting up
139 * phys_cpu_present_map and the logical/physical mappings. 139 * cpu_possible_map and the logical/physical mappings.
140 * XXXKW will the boot CPU ever not be physical 0? 140 * XXXKW will the boot CPU ever not be physical 0?
141 * 141 *
142 * Common setup before any secondaries are started 142 * Common setup before any secondaries are started
@@ -145,14 +145,14 @@ static void __init bcm1480_smp_setup(void)
145{ 145{
146 int i, num; 146 int i, num;
147 147
148 cpus_clear(phys_cpu_present_map); 148 cpus_clear(cpu_possible_map);
149 cpu_set(0, phys_cpu_present_map); 149 cpu_set(0, cpu_possible_map);
150 __cpu_number_map[0] = 0; 150 __cpu_number_map[0] = 0;
151 __cpu_logical_map[0] = 0; 151 __cpu_logical_map[0] = 0;
152 152
153 for (i = 1, num = 0; i < NR_CPUS; i++) { 153 for (i = 1, num = 0; i < NR_CPUS; i++) {
154 if (cfe_cpu_stop(i) == 0) { 154 if (cfe_cpu_stop(i) == 0) {
155 cpu_set(i, phys_cpu_present_map); 155 cpu_set(i, cpu_possible_map);
156 __cpu_number_map[i] = ++num; 156 __cpu_number_map[i] = ++num;
157 __cpu_logical_map[num] = i; 157 __cpu_logical_map[num] = i;
158 } 158 }
diff --git a/arch/mips/sibyte/sb1250/irq.c b/arch/mips/sibyte/sb1250/irq.c
index a5158483986e..808ac2959b8c 100644
--- a/arch/mips/sibyte/sb1250/irq.c
+++ b/arch/mips/sibyte/sb1250/irq.c
@@ -50,7 +50,7 @@ static void enable_sb1250_irq(unsigned int irq);
50static void disable_sb1250_irq(unsigned int irq); 50static void disable_sb1250_irq(unsigned int irq);
51static void ack_sb1250_irq(unsigned int irq); 51static void ack_sb1250_irq(unsigned int irq);
52#ifdef CONFIG_SMP 52#ifdef CONFIG_SMP
53static void sb1250_set_affinity(unsigned int irq, cpumask_t mask); 53static void sb1250_set_affinity(unsigned int irq, const struct cpumask *mask);
54#endif 54#endif
55 55
56#ifdef CONFIG_SIBYTE_HAS_LDT 56#ifdef CONFIG_SIBYTE_HAS_LDT
@@ -103,16 +103,16 @@ void sb1250_unmask_irq(int cpu, int irq)
103} 103}
104 104
105#ifdef CONFIG_SMP 105#ifdef CONFIG_SMP
106static void sb1250_set_affinity(unsigned int irq, cpumask_t mask) 106static void sb1250_set_affinity(unsigned int irq, const struct cpumask *mask)
107{ 107{
108 int i = 0, old_cpu, cpu, int_on; 108 int i = 0, old_cpu, cpu, int_on;
109 u64 cur_ints; 109 u64 cur_ints;
110 struct irq_desc *desc = irq_desc + irq; 110 struct irq_desc *desc = irq_desc + irq;
111 unsigned long flags; 111 unsigned long flags;
112 112
113 i = first_cpu(mask); 113 i = cpumask_first(mask);
114 114
115 if (cpus_weight(mask) > 1) { 115 if (cpumask_weight(mask) > 1) {
116 printk("attempted to set irq affinity for irq %d to multiple CPUs\n", irq); 116 printk("attempted to set irq affinity for irq %d to multiple CPUs\n", irq);
117 return; 117 return;
118 } 118 }
diff --git a/arch/mips/sibyte/sb1250/smp.c b/arch/mips/sibyte/sb1250/smp.c
index 0734b933e969..5950a288a7da 100644
--- a/arch/mips/sibyte/sb1250/smp.c
+++ b/arch/mips/sibyte/sb1250/smp.c
@@ -124,7 +124,7 @@ static void __cpuinit sb1250_boot_secondary(int cpu, struct task_struct *idle)
124 124
125/* 125/*
126 * Use CFE to find out how many CPUs are available, setting up 126 * Use CFE to find out how many CPUs are available, setting up
127 * phys_cpu_present_map and the logical/physical mappings. 127 * cpu_possible_map and the logical/physical mappings.
128 * XXXKW will the boot CPU ever not be physical 0? 128 * XXXKW will the boot CPU ever not be physical 0?
129 * 129 *
130 * Common setup before any secondaries are started 130 * Common setup before any secondaries are started
@@ -133,14 +133,14 @@ static void __init sb1250_smp_setup(void)
133{ 133{
134 int i, num; 134 int i, num;
135 135
136 cpus_clear(phys_cpu_present_map); 136 cpus_clear(cpu_possible_map);
137 cpu_set(0, phys_cpu_present_map); 137 cpu_set(0, cpu_possible_map);
138 __cpu_number_map[0] = 0; 138 __cpu_number_map[0] = 0;
139 __cpu_logical_map[0] = 0; 139 __cpu_logical_map[0] = 0;
140 140
141 for (i = 1, num = 0; i < NR_CPUS; i++) { 141 for (i = 1, num = 0; i < NR_CPUS; i++) {
142 if (cfe_cpu_stop(i) == 0) { 142 if (cfe_cpu_stop(i) == 0) {
143 cpu_set(i, phys_cpu_present_map); 143 cpu_set(i, cpu_possible_map);
144 __cpu_number_map[i] = ++num; 144 __cpu_number_map[i] = ++num;
145 __cpu_logical_map[num] = i; 145 __cpu_logical_map[num] = i;
146 } 146 }
diff --git a/arch/mips/sni/time.c b/arch/mips/sni/time.c
index 796e3ce28720..69f5f88711cc 100644
--- a/arch/mips/sni/time.c
+++ b/arch/mips/sni/time.c
@@ -80,7 +80,7 @@ static void __init sni_a20r_timer_setup(void)
80 struct irqaction *action = &a20r_irqaction; 80 struct irqaction *action = &a20r_irqaction;
81 unsigned int cpu = smp_processor_id(); 81 unsigned int cpu = smp_processor_id();
82 82
83 cd->cpumask = cpumask_of_cpu(cpu); 83 cd->cpumask = cpumask_of(cpu);
84 clockevents_register_device(cd); 84 clockevents_register_device(cd);
85 action->dev_id = cd; 85 action->dev_id = cd;
86 setup_irq(SNI_A20R_IRQ_TIMER, &a20r_irqaction); 86 setup_irq(SNI_A20R_IRQ_TIMER, &a20r_irqaction);
diff --git a/arch/mn10300/kernel/init_task.c b/arch/mn10300/kernel/init_task.c
index af16f6e5c918..5ac3566f8c98 100644
--- a/arch/mn10300/kernel/init_task.c
+++ b/arch/mn10300/kernel/init_task.c
@@ -18,7 +18,6 @@
18#include <asm/uaccess.h> 18#include <asm/uaccess.h>
19#include <asm/pgtable.h> 19#include <asm/pgtable.h>
20 20
21static struct fs_struct init_fs = INIT_FS;
22static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 21static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
23static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 22static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
24struct mm_struct init_mm = INIT_MM(init_mm); 23struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 644a70b1b04e..aacf11d33723 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -11,6 +11,7 @@ config PARISC
11 select HAVE_OPROFILE 11 select HAVE_OPROFILE
12 select RTC_CLASS 12 select RTC_CLASS
13 select RTC_DRV_PARISC 13 select RTC_DRV_PARISC
14 select INIT_ALL_POSSIBLE
14 help 15 help
15 The PA-RISC microprocessor is designed by Hewlett-Packard and used 16 The PA-RISC microprocessor is designed by Hewlett-Packard and used
16 in many of their workstations & servers (HP9000 700 and 800 series, 17 in many of their workstations & servers (HP9000 700 and 800 series,
diff --git a/arch/parisc/include/asm/atomic.h b/arch/parisc/include/asm/atomic.h
index 57fcc4a5ebb4..edbfe25c5fc1 100644
--- a/arch/parisc/include/asm/atomic.h
+++ b/arch/parisc/include/asm/atomic.h
@@ -155,14 +155,11 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
155#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) 155#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
156#endif 156#endif
157 157
158/* Note that we need not lock read accesses - aligned word writes/reads 158/*
159 * are atomic, so a reader never sees unconsistent values. 159 * Note that we need not lock read accesses - aligned word writes/reads
160 * 160 * are atomic, so a reader never sees inconsistent values.
161 * Cache-line alignment would conflict with, for example, linux/module.h
162 */ 161 */
163 162
164typedef struct { volatile int counter; } atomic_t;
165
166/* It's possible to reduce all atomic operations to either 163/* It's possible to reduce all atomic operations to either
167 * __atomic_add_return, atomic_set and atomic_read (the latter 164 * __atomic_add_return, atomic_set and atomic_read (the latter
168 * is there only for consistency). 165 * is there only for consistency).
@@ -260,8 +257,6 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
260 257
261#ifdef CONFIG_64BIT 258#ifdef CONFIG_64BIT
262 259
263typedef struct { volatile s64 counter; } atomic64_t;
264
265#define ATOMIC64_INIT(i) ((atomic64_t) { (i) }) 260#define ATOMIC64_INIT(i) ((atomic64_t) { (i) })
266 261
267static __inline__ int 262static __inline__ int
diff --git a/arch/parisc/include/asm/module.h b/arch/parisc/include/asm/module.h
index c2cb49e934c1..1f4123427ea0 100644
--- a/arch/parisc/include/asm/module.h
+++ b/arch/parisc/include/asm/module.h
@@ -23,8 +23,10 @@ struct mod_arch_specific
23{ 23{
24 unsigned long got_offset, got_count, got_max; 24 unsigned long got_offset, got_count, got_max;
25 unsigned long fdesc_offset, fdesc_count, fdesc_max; 25 unsigned long fdesc_offset, fdesc_count, fdesc_max;
26 unsigned long stub_offset, stub_count, stub_max; 26 struct {
27 unsigned long init_stub_offset, init_stub_count, init_stub_max; 27 unsigned long stub_offset;
28 unsigned int stub_entries;
29 } *section;
28 int unwind_section; 30 int unwind_section;
29 struct unwind_table *unwind; 31 struct unwind_table *unwind;
30}; 32};
diff --git a/arch/parisc/include/asm/smp.h b/arch/parisc/include/asm/smp.h
index 409e698f4361..6ef4b7867b1b 100644
--- a/arch/parisc/include/asm/smp.h
+++ b/arch/parisc/include/asm/smp.h
@@ -16,8 +16,6 @@
16#include <linux/cpumask.h> 16#include <linux/cpumask.h>
17typedef unsigned long address_t; 17typedef unsigned long address_t;
18 18
19extern cpumask_t cpu_online_map;
20
21 19
22/* 20/*
23 * Private routines/data 21 * Private routines/data
diff --git a/arch/parisc/kernel/init_task.c b/arch/parisc/kernel/init_task.c
index f5941c086551..1e25a45d64c1 100644
--- a/arch/parisc/kernel/init_task.c
+++ b/arch/parisc/kernel/init_task.c
@@ -34,7 +34,6 @@
34#include <asm/pgtable.h> 34#include <asm/pgtable.h>
35#include <asm/pgalloc.h> 35#include <asm/pgalloc.h>
36 36
37static struct fs_struct init_fs = INIT_FS;
38static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 37static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
39static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 38static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
40struct mm_struct init_mm = INIT_MM(init_mm); 39struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c
index 23ef950df008..4cea935e2f99 100644
--- a/arch/parisc/kernel/irq.c
+++ b/arch/parisc/kernel/irq.c
@@ -131,12 +131,12 @@ int cpu_check_affinity(unsigned int irq, cpumask_t *dest)
131 return 0; 131 return 0;
132} 132}
133 133
134static void cpu_set_affinity_irq(unsigned int irq, cpumask_t dest) 134static void cpu_set_affinity_irq(unsigned int irq, const struct cpumask *dest)
135{ 135{
136 if (cpu_check_affinity(irq, &dest)) 136 if (cpu_check_affinity(irq, dest))
137 return; 137 return;
138 138
139 irq_desc[irq].affinity = dest; 139 irq_desc[irq].affinity = *dest;
140} 140}
141#endif 141#endif
142 142
diff --git a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c
index 44138c3e6ea7..9013243cecca 100644
--- a/arch/parisc/kernel/module.c
+++ b/arch/parisc/kernel/module.c
@@ -6,6 +6,7 @@
6 * 6 *
7 * Linux/PA-RISC Project (http://www.parisc-linux.org/) 7 * Linux/PA-RISC Project (http://www.parisc-linux.org/)
8 * Copyright (C) 2003 Randolph Chung <tausq at debian . org> 8 * Copyright (C) 2003 Randolph Chung <tausq at debian . org>
9 * Copyright (C) 2008 Helge Deller <deller@gmx.de>
9 * 10 *
10 * 11 *
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
@@ -24,6 +25,19 @@
24 * 25 *
25 * 26 *
26 * Notes: 27 * Notes:
28 * - PLT stub handling
29 * On 32bit (and sometimes 64bit) and with big kernel modules like xfs or
30 * ipv6 the relocation types R_PARISC_PCREL17F and R_PARISC_PCREL22F may
31 * fail to reach their PLT stub if we only create one big stub array for
32 * all sections at the beginning of the core or init section.
33 * Instead we now insert individual PLT stub entries directly in front of
34 * of the code sections where the stubs are actually called.
35 * This reduces the distance between the PCREL location and the stub entry
36 * so that the relocations can be fulfilled.
37 * While calculating the final layout of the kernel module in memory, the
38 * kernel module loader calls arch_mod_section_prepend() to request the
39 * to be reserved amount of memory in front of each individual section.
40 *
27 * - SEGREL32 handling 41 * - SEGREL32 handling
28 * We are not doing SEGREL32 handling correctly. According to the ABI, we 42 * We are not doing SEGREL32 handling correctly. According to the ABI, we
29 * should do a value offset, like this: 43 * should do a value offset, like this:
@@ -58,9 +72,13 @@
58#define DEBUGP(fmt...) 72#define DEBUGP(fmt...)
59#endif 73#endif
60 74
75#define RELOC_REACHABLE(val, bits) \
76 (( ( !((val) & (1<<((bits)-1))) && ((val)>>(bits)) != 0 ) || \
77 ( ((val) & (1<<((bits)-1))) && ((val)>>(bits)) != (((__typeof__(val))(~0))>>((bits)+2)))) ? \
78 0 : 1)
79
61#define CHECK_RELOC(val, bits) \ 80#define CHECK_RELOC(val, bits) \
62 if ( ( !((val) & (1<<((bits)-1))) && ((val)>>(bits)) != 0 ) || \ 81 if (!RELOC_REACHABLE(val, bits)) { \
63 ( ((val) & (1<<((bits)-1))) && ((val)>>(bits)) != (((__typeof__(val))(~0))>>((bits)+2)))) { \
64 printk(KERN_ERR "module %s relocation of symbol %s is out of range (0x%lx in %d bits)\n", \ 82 printk(KERN_ERR "module %s relocation of symbol %s is out of range (0x%lx in %d bits)\n", \
65 me->name, strtab + sym->st_name, (unsigned long)val, bits); \ 83 me->name, strtab + sym->st_name, (unsigned long)val, bits); \
66 return -ENOEXEC; \ 84 return -ENOEXEC; \
@@ -92,13 +110,6 @@ static inline int in_local(struct module *me, void *loc)
92 return in_init(me, loc) || in_core(me, loc); 110 return in_init(me, loc) || in_core(me, loc);
93} 111}
94 112
95static inline int in_local_section(struct module *me, void *loc, void *dot)
96{
97 return (in_init(me, loc) && in_init(me, dot)) ||
98 (in_core(me, loc) && in_core(me, dot));
99}
100
101
102#ifndef CONFIG_64BIT 113#ifndef CONFIG_64BIT
103struct got_entry { 114struct got_entry {
104 Elf32_Addr addr; 115 Elf32_Addr addr;
@@ -258,23 +269,42 @@ static inline unsigned long count_stubs(const Elf_Rela *rela, unsigned long n)
258/* Free memory returned from module_alloc */ 269/* Free memory returned from module_alloc */
259void module_free(struct module *mod, void *module_region) 270void module_free(struct module *mod, void *module_region)
260{ 271{
272 kfree(mod->arch.section);
273 mod->arch.section = NULL;
274
261 vfree(module_region); 275 vfree(module_region);
262 /* FIXME: If module_region == mod->init_region, trim exception 276 /* FIXME: If module_region == mod->init_region, trim exception
263 table entries. */ 277 table entries. */
264} 278}
265 279
280/* Additional bytes needed in front of individual sections */
281unsigned int arch_mod_section_prepend(struct module *mod,
282 unsigned int section)
283{
284 /* size needed for all stubs of this section (including
285 * one additional for correct alignment of the stubs) */
286 return (mod->arch.section[section].stub_entries + 1)
287 * sizeof(struct stub_entry);
288}
289
266#define CONST 290#define CONST
267int module_frob_arch_sections(CONST Elf_Ehdr *hdr, 291int module_frob_arch_sections(CONST Elf_Ehdr *hdr,
268 CONST Elf_Shdr *sechdrs, 292 CONST Elf_Shdr *sechdrs,
269 CONST char *secstrings, 293 CONST char *secstrings,
270 struct module *me) 294 struct module *me)
271{ 295{
272 unsigned long gots = 0, fdescs = 0, stubs = 0, init_stubs = 0; 296 unsigned long gots = 0, fdescs = 0, len;
273 unsigned int i; 297 unsigned int i;
274 298
299 len = hdr->e_shnum * sizeof(me->arch.section[0]);
300 me->arch.section = kzalloc(len, GFP_KERNEL);
301 if (!me->arch.section)
302 return -ENOMEM;
303
275 for (i = 1; i < hdr->e_shnum; i++) { 304 for (i = 1; i < hdr->e_shnum; i++) {
276 const Elf_Rela *rels = (void *)hdr + sechdrs[i].sh_offset; 305 const Elf_Rela *rels = (void *)sechdrs[i].sh_addr;
277 unsigned long nrels = sechdrs[i].sh_size / sizeof(*rels); 306 unsigned long nrels = sechdrs[i].sh_size / sizeof(*rels);
307 unsigned int count, s;
278 308
279 if (strncmp(secstrings + sechdrs[i].sh_name, 309 if (strncmp(secstrings + sechdrs[i].sh_name,
280 ".PARISC.unwind", 14) == 0) 310 ".PARISC.unwind", 14) == 0)
@@ -290,11 +320,23 @@ int module_frob_arch_sections(CONST Elf_Ehdr *hdr,
290 */ 320 */
291 gots += count_gots(rels, nrels); 321 gots += count_gots(rels, nrels);
292 fdescs += count_fdescs(rels, nrels); 322 fdescs += count_fdescs(rels, nrels);
293 if(strncmp(secstrings + sechdrs[i].sh_name, 323
294 ".rela.init", 10) == 0) 324 /* XXX: By sorting the relocs and finding duplicate entries
295 init_stubs += count_stubs(rels, nrels); 325 * we could reduce the number of necessary stubs and save
296 else 326 * some memory. */
297 stubs += count_stubs(rels, nrels); 327 count = count_stubs(rels, nrels);
328 if (!count)
329 continue;
330
331 /* so we need relocation stubs. reserve necessary memory. */
332 /* sh_info gives the section for which we need to add stubs. */
333 s = sechdrs[i].sh_info;
334
335 /* each code section should only have one relocation section */
336 WARN_ON(me->arch.section[s].stub_entries);
337
338 /* store number of stubs we need for this section */
339 me->arch.section[s].stub_entries += count;
298 } 340 }
299 341
300 /* align things a bit */ 342 /* align things a bit */
@@ -306,18 +348,8 @@ int module_frob_arch_sections(CONST Elf_Ehdr *hdr,
306 me->arch.fdesc_offset = me->core_size; 348 me->arch.fdesc_offset = me->core_size;
307 me->core_size += fdescs * sizeof(Elf_Fdesc); 349 me->core_size += fdescs * sizeof(Elf_Fdesc);
308 350
309 me->core_size = ALIGN(me->core_size, 16);
310 me->arch.stub_offset = me->core_size;
311 me->core_size += stubs * sizeof(struct stub_entry);
312
313 me->init_size = ALIGN(me->init_size, 16);
314 me->arch.init_stub_offset = me->init_size;
315 me->init_size += init_stubs * sizeof(struct stub_entry);
316
317 me->arch.got_max = gots; 351 me->arch.got_max = gots;
318 me->arch.fdesc_max = fdescs; 352 me->arch.fdesc_max = fdescs;
319 me->arch.stub_max = stubs;
320 me->arch.init_stub_max = init_stubs;
321 353
322 return 0; 354 return 0;
323} 355}
@@ -380,23 +412,27 @@ enum elf_stub_type {
380}; 412};
381 413
382static Elf_Addr get_stub(struct module *me, unsigned long value, long addend, 414static Elf_Addr get_stub(struct module *me, unsigned long value, long addend,
383 enum elf_stub_type stub_type, int init_section) 415 enum elf_stub_type stub_type, Elf_Addr loc0, unsigned int targetsec)
384{ 416{
385 unsigned long i;
386 struct stub_entry *stub; 417 struct stub_entry *stub;
387 418
388 if(init_section) { 419 /* initialize stub_offset to point in front of the section */
389 i = me->arch.init_stub_count++; 420 if (!me->arch.section[targetsec].stub_offset) {
390 BUG_ON(me->arch.init_stub_count > me->arch.init_stub_max); 421 loc0 -= (me->arch.section[targetsec].stub_entries + 1) *
391 stub = me->module_init + me->arch.init_stub_offset + 422 sizeof(struct stub_entry);
392 i * sizeof(struct stub_entry); 423 /* get correct alignment for the stubs */
393 } else { 424 loc0 = ALIGN(loc0, sizeof(struct stub_entry));
394 i = me->arch.stub_count++; 425 me->arch.section[targetsec].stub_offset = loc0;
395 BUG_ON(me->arch.stub_count > me->arch.stub_max);
396 stub = me->module_core + me->arch.stub_offset +
397 i * sizeof(struct stub_entry);
398 } 426 }
399 427
428 /* get address of stub entry */
429 stub = (void *) me->arch.section[targetsec].stub_offset;
430 me->arch.section[targetsec].stub_offset += sizeof(struct stub_entry);
431
432 /* do not write outside available stub area */
433 BUG_ON(0 == me->arch.section[targetsec].stub_entries--);
434
435
400#ifndef CONFIG_64BIT 436#ifndef CONFIG_64BIT
401/* for 32-bit the stub looks like this: 437/* for 32-bit the stub looks like this:
402 * ldil L'XXX,%r1 438 * ldil L'XXX,%r1
@@ -489,15 +525,19 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
489 Elf32_Addr val; 525 Elf32_Addr val;
490 Elf32_Sword addend; 526 Elf32_Sword addend;
491 Elf32_Addr dot; 527 Elf32_Addr dot;
528 Elf_Addr loc0;
529 unsigned int targetsec = sechdrs[relsec].sh_info;
492 //unsigned long dp = (unsigned long)$global$; 530 //unsigned long dp = (unsigned long)$global$;
493 register unsigned long dp asm ("r27"); 531 register unsigned long dp asm ("r27");
494 532
495 DEBUGP("Applying relocate section %u to %u\n", relsec, 533 DEBUGP("Applying relocate section %u to %u\n", relsec,
496 sechdrs[relsec].sh_info); 534 targetsec);
497 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { 535 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
498 /* This is where to make the change */ 536 /* This is where to make the change */
499 loc = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr 537 loc = (void *)sechdrs[targetsec].sh_addr
500 + rel[i].r_offset; 538 + rel[i].r_offset;
539 /* This is the start of the target section */
540 loc0 = sechdrs[targetsec].sh_addr;
501 /* This is the symbol it is referring to */ 541 /* This is the symbol it is referring to */
502 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr 542 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
503 + ELF32_R_SYM(rel[i].r_info); 543 + ELF32_R_SYM(rel[i].r_info);
@@ -569,19 +609,32 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
569 break; 609 break;
570 case R_PARISC_PCREL17F: 610 case R_PARISC_PCREL17F:
571 /* 17-bit PC relative address */ 611 /* 17-bit PC relative address */
572 val = get_stub(me, val, addend, ELF_STUB_GOT, in_init(me, loc)); 612 /* calculate direct call offset */
613 val += addend;
573 val = (val - dot - 8)/4; 614 val = (val - dot - 8)/4;
574 CHECK_RELOC(val, 17) 615 if (!RELOC_REACHABLE(val, 17)) {
616 /* direct distance too far, create
617 * stub entry instead */
618 val = get_stub(me, sym->st_value, addend,
619 ELF_STUB_DIRECT, loc0, targetsec);
620 val = (val - dot - 8)/4;
621 CHECK_RELOC(val, 17);
622 }
575 *loc = (*loc & ~0x1f1ffd) | reassemble_17(val); 623 *loc = (*loc & ~0x1f1ffd) | reassemble_17(val);
576 break; 624 break;
577 case R_PARISC_PCREL22F: 625 case R_PARISC_PCREL22F:
578 /* 22-bit PC relative address; only defined for pa20 */ 626 /* 22-bit PC relative address; only defined for pa20 */
579 val = get_stub(me, val, addend, ELF_STUB_GOT, in_init(me, loc)); 627 /* calculate direct call offset */
580 DEBUGP("STUB FOR %s loc %lx+%lx at %lx\n", 628 val += addend;
581 strtab + sym->st_name, (unsigned long)loc, addend,
582 val)
583 val = (val - dot - 8)/4; 629 val = (val - dot - 8)/4;
584 CHECK_RELOC(val, 22); 630 if (!RELOC_REACHABLE(val, 22)) {
631 /* direct distance too far, create
632 * stub entry instead */
633 val = get_stub(me, sym->st_value, addend,
634 ELF_STUB_DIRECT, loc0, targetsec);
635 val = (val - dot - 8)/4;
636 CHECK_RELOC(val, 22);
637 }
585 *loc = (*loc & ~0x3ff1ffd) | reassemble_22(val); 638 *loc = (*loc & ~0x3ff1ffd) | reassemble_22(val);
586 break; 639 break;
587 640
@@ -610,13 +663,17 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
610 Elf64_Addr val; 663 Elf64_Addr val;
611 Elf64_Sxword addend; 664 Elf64_Sxword addend;
612 Elf64_Addr dot; 665 Elf64_Addr dot;
666 Elf_Addr loc0;
667 unsigned int targetsec = sechdrs[relsec].sh_info;
613 668
614 DEBUGP("Applying relocate section %u to %u\n", relsec, 669 DEBUGP("Applying relocate section %u to %u\n", relsec,
615 sechdrs[relsec].sh_info); 670 targetsec);
616 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { 671 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
617 /* This is where to make the change */ 672 /* This is where to make the change */
618 loc = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr 673 loc = (void *)sechdrs[targetsec].sh_addr
619 + rel[i].r_offset; 674 + rel[i].r_offset;
675 /* This is the start of the target section */
676 loc0 = sechdrs[targetsec].sh_addr;
620 /* This is the symbol it is referring to */ 677 /* This is the symbol it is referring to */
621 sym = (Elf64_Sym *)sechdrs[symindex].sh_addr 678 sym = (Elf64_Sym *)sechdrs[symindex].sh_addr
622 + ELF64_R_SYM(rel[i].r_info); 679 + ELF64_R_SYM(rel[i].r_info);
@@ -672,42 +729,40 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
672 DEBUGP("PCREL22F Symbol %s loc %p val %lx\n", 729 DEBUGP("PCREL22F Symbol %s loc %p val %lx\n",
673 strtab + sym->st_name, 730 strtab + sym->st_name,
674 loc, val); 731 loc, val);
732 val += addend;
675 /* can we reach it locally? */ 733 /* can we reach it locally? */
676 if(!in_local_section(me, (void *)val, (void *)dot)) { 734 if (in_local(me, (void *)val)) {
677 735 /* this is the case where the symbol is local
678 if (in_local(me, (void *)val)) 736 * to the module, but in a different section,
679 /* this is the case where the 737 * so stub the jump in case it's more than 22
680 * symbol is local to the 738 * bits away */
681 * module, but in a different 739 val = (val - dot - 8)/4;
682 * section, so stub the jump 740 if (!RELOC_REACHABLE(val, 22)) {
683 * in case it's more than 22 741 /* direct distance too far, create
684 * bits away */ 742 * stub entry instead */
685 val = get_stub(me, val, addend, ELF_STUB_DIRECT, 743 val = get_stub(me, sym->st_value,
686 in_init(me, loc)); 744 addend, ELF_STUB_DIRECT,
687 else if (strncmp(strtab + sym->st_name, "$$", 2) 745 loc0, targetsec);
746 } else {
747 /* Ok, we can reach it directly. */
748 val = sym->st_value;
749 val += addend;
750 }
751 } else {
752 val = sym->st_value;
753 if (strncmp(strtab + sym->st_name, "$$", 2)
688 == 0) 754 == 0)
689 val = get_stub(me, val, addend, ELF_STUB_MILLI, 755 val = get_stub(me, val, addend, ELF_STUB_MILLI,
690 in_init(me, loc)); 756 loc0, targetsec);
691 else 757 else
692 val = get_stub(me, val, addend, ELF_STUB_GOT, 758 val = get_stub(me, val, addend, ELF_STUB_GOT,
693 in_init(me, loc)); 759 loc0, targetsec);
694 } 760 }
695 DEBUGP("STUB FOR %s loc %lx, val %lx+%lx at %lx\n", 761 DEBUGP("STUB FOR %s loc %lx, val %lx+%lx at %lx\n",
696 strtab + sym->st_name, loc, sym->st_value, 762 strtab + sym->st_name, loc, sym->st_value,
697 addend, val); 763 addend, val);
698 /* FIXME: local symbols work as long as the
699 * core and init pieces aren't separated too
700 * far. If this is ever broken, you will trip
701 * the check below. The way to fix it would
702 * be to generate local stubs to go between init
703 * and core */
704 if((Elf64_Sxword)(val - dot - 8) > 0x800000 -1 ||
705 (Elf64_Sxword)(val - dot - 8) < -0x800000) {
706 printk(KERN_ERR "Module %s, symbol %s is out of range for PCREL22F relocation\n",
707 me->name, strtab + sym->st_name);
708 return -ENOEXEC;
709 }
710 val = (val - dot - 8)/4; 764 val = (val - dot - 8)/4;
765 CHECK_RELOC(val, 22);
711 *loc = (*loc & ~0x3ff1ffd) | reassemble_22(val); 766 *loc = (*loc & ~0x3ff1ffd) | reassemble_22(val);
712 break; 767 break;
713 case R_PARISC_DIR64: 768 case R_PARISC_DIR64:
@@ -794,12 +849,8 @@ int module_finalize(const Elf_Ehdr *hdr,
794 addr = (u32 *)entry->addr; 849 addr = (u32 *)entry->addr;
795 printk("INSNS: %x %x %x %x\n", 850 printk("INSNS: %x %x %x %x\n",
796 addr[0], addr[1], addr[2], addr[3]); 851 addr[0], addr[1], addr[2], addr[3]);
797 printk("stubs used %ld, stubs max %ld\n" 852 printk("got entries used %ld, gots max %ld\n"
798 "init_stubs used %ld, init stubs max %ld\n"
799 "got entries used %ld, gots max %ld\n"
800 "fdescs used %ld, fdescs max %ld\n", 853 "fdescs used %ld, fdescs max %ld\n",
801 me->arch.stub_count, me->arch.stub_max,
802 me->arch.init_stub_count, me->arch.init_stub_max,
803 me->arch.got_count, me->arch.got_max, 854 me->arch.got_count, me->arch.got_max,
804 me->arch.fdesc_count, me->arch.fdesc_max); 855 me->arch.fdesc_count, me->arch.fdesc_max);
805#endif 856#endif
@@ -829,7 +880,10 @@ int module_finalize(const Elf_Ehdr *hdr,
829 me->name, me->arch.got_count, MAX_GOTS); 880 me->name, me->arch.got_count, MAX_GOTS);
830 return -EINVAL; 881 return -EINVAL;
831 } 882 }
832 883
884 kfree(me->arch.section);
885 me->arch.section = NULL;
886
833 /* no symbol table */ 887 /* no symbol table */
834 if(symhdr == NULL) 888 if(symhdr == NULL)
835 return 0; 889 return 0;
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c
index 06213d1d6d95..f82544225e8e 100644
--- a/arch/parisc/kernel/signal.c
+++ b/arch/parisc/kernel/signal.c
@@ -182,7 +182,7 @@ give_sigsegv:
182 si.si_errno = 0; 182 si.si_errno = 0;
183 si.si_code = SI_KERNEL; 183 si.si_code = SI_KERNEL;
184 si.si_pid = task_pid_vnr(current); 184 si.si_pid = task_pid_vnr(current);
185 si.si_uid = current->uid; 185 si.si_uid = current_uid();
186 si.si_addr = &frame->uc; 186 si.si_addr = &frame->uc;
187 force_sig_info(SIGSEGV, &si, current); 187 force_sig_info(SIGSEGV, &si, current);
188 return; 188 return;
diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c
index d47f3975c9c6..80bc000523fa 100644
--- a/arch/parisc/kernel/smp.c
+++ b/arch/parisc/kernel/smp.c
@@ -67,21 +67,6 @@ static volatile int cpu_now_booting __read_mostly = 0; /* track which CPU is boo
67 67
68static int parisc_max_cpus __read_mostly = 1; 68static int parisc_max_cpus __read_mostly = 1;
69 69
70/* online cpus are ones that we've managed to bring up completely
71 * possible cpus are all valid cpu
72 * present cpus are all detected cpu
73 *
74 * On startup we bring up the "possible" cpus. Since we discover
75 * CPUs later, we add them as hotplug, so the possible cpu mask is
76 * empty in the beginning.
77 */
78
79cpumask_t cpu_online_map __read_mostly = CPU_MASK_NONE; /* Bitmap of online CPUs */
80cpumask_t cpu_possible_map __read_mostly = CPU_MASK_ALL; /* Bitmap of Present CPUs */
81
82EXPORT_SYMBOL(cpu_online_map);
83EXPORT_SYMBOL(cpu_possible_map);
84
85DEFINE_PER_CPU(spinlock_t, ipi_lock) = SPIN_LOCK_UNLOCKED; 70DEFINE_PER_CPU(spinlock_t, ipi_lock) = SPIN_LOCK_UNLOCKED;
86 71
87enum ipi_message_type { 72enum ipi_message_type {
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 525c13a4de93..79f25cef32df 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -141,7 +141,7 @@ config GENERIC_NVRAM
141 bool 141 bool
142 default y if PPC32 142 default y if PPC32
143 143
144config SCHED_NO_NO_OMIT_FRAME_POINTER 144config SCHED_OMIT_FRAME_POINTER
145 bool 145 bool
146 default y 146 default y
147 147
@@ -285,6 +285,10 @@ config IOMMU_VMERGE
285config IOMMU_HELPER 285config IOMMU_HELPER
286 def_bool PPC64 286 def_bool PPC64
287 287
288config PPC_NEED_DMA_SYNC_OPS
289 def_bool y
290 depends on NOT_COHERENT_CACHE
291
288config HOTPLUG_CPU 292config HOTPLUG_CPU
289 bool "Support for enabling/disabling CPUs" 293 bool "Support for enabling/disabling CPUs"
290 depends on SMP && HOTPLUG && EXPERIMENTAL && (PPC_PSERIES || PPC_PMAC) 294 depends on SMP && HOTPLUG && EXPERIMENTAL && (PPC_PSERIES || PPC_PMAC)
@@ -322,7 +326,7 @@ config KEXEC
322 326
323config CRASH_DUMP 327config CRASH_DUMP
324 bool "Build a kdump crash kernel" 328 bool "Build a kdump crash kernel"
325 depends on PPC_MULTIPLATFORM && PPC64 && RELOCATABLE 329 depends on (PPC64 && RELOCATABLE) || 6xx
326 help 330 help
327 Build a kernel suitable for use as a kdump capture kernel. 331 Build a kernel suitable for use as a kdump capture kernel.
328 The same kernel binary can be used as production kernel and dump 332 The same kernel binary can be used as production kernel and dump
@@ -401,23 +405,53 @@ config PPC_HAS_HASH_64K
401 depends on PPC64 405 depends on PPC64
402 default n 406 default n
403 407
404config PPC_64K_PAGES 408choice
405 bool "64k page size" 409 prompt "Page size"
406 depends on PPC64 410 default PPC_4K_PAGES
407 select PPC_HAS_HASH_64K
408 help 411 help
409 This option changes the kernel logical page size to 64k. On machines 412 Select the kernel logical page size. Increasing the page size
410 without processor support for 64k pages, the kernel will simulate 413 will reduce software overhead at each page boundary, allow
411 them by loading each individual 4k page on demand transparently, 414 hardware prefetch mechanisms to be more effective, and allow
412 while on hardware with such support, it will be used to map 415 larger dma transfers increasing IO efficiency and reducing
413 normal application pages. 416 overhead. However the utilization of memory will increase.
417 For example, each cached file will using a multiple of the
418 page size to hold its contents and the difference between the
419 end of file and the end of page is wasted.
420
421 Some dedicated systems, such as software raid serving with
422 accelerated calculations, have shown significant increases.
423
424 If you configure a 64 bit kernel for 64k pages but the
425 processor does not support them, then the kernel will simulate
426 them with 4k pages, loading them on demand, but with the
427 reduced software overhead and larger internal fragmentation.
428 For the 32 bit kernel, a large page option will not be offered
429 unless it is supported by the configured processor.
430
431 If unsure, choose 4K_PAGES.
432
433config PPC_4K_PAGES
434 bool "4k page size"
435
436config PPC_16K_PAGES
437 bool "16k page size" if 44x
438
439config PPC_64K_PAGES
440 bool "64k page size" if 44x || PPC_STD_MMU_64
441 select PPC_HAS_HASH_64K if PPC_STD_MMU_64
442
443endchoice
414 444
415config FORCE_MAX_ZONEORDER 445config FORCE_MAX_ZONEORDER
416 int "Maximum zone order" 446 int "Maximum zone order"
417 range 9 64 if PPC_64K_PAGES 447 range 9 64 if PPC_STD_MMU_64 && PPC_64K_PAGES
418 default "9" if PPC_64K_PAGES 448 default "9" if PPC_STD_MMU_64 && PPC_64K_PAGES
419 range 13 64 if PPC64 && !PPC_64K_PAGES 449 range 13 64 if PPC_STD_MMU_64 && !PPC_64K_PAGES
420 default "13" if PPC64 && !PPC_64K_PAGES 450 default "13" if PPC_STD_MMU_64 && !PPC_64K_PAGES
451 range 9 64 if PPC_STD_MMU_32 && PPC_16K_PAGES
452 default "9" if PPC_STD_MMU_32 && PPC_16K_PAGES
453 range 7 64 if PPC_STD_MMU_32 && PPC_64K_PAGES
454 default "7" if PPC_STD_MMU_32 && PPC_64K_PAGES
421 range 11 64 455 range 11 64
422 default "11" 456 default "11"
423 help 457 help
@@ -437,7 +471,7 @@ config FORCE_MAX_ZONEORDER
437 471
438config PPC_SUBPAGE_PROT 472config PPC_SUBPAGE_PROT
439 bool "Support setting protections for 4k subpages" 473 bool "Support setting protections for 4k subpages"
440 depends on PPC_64K_PAGES 474 depends on PPC_STD_MMU_64 && PPC_64K_PAGES
441 help 475 help
442 This option adds support for a system call to allow user programs 476 This option adds support for a system call to allow user programs
443 to set access permissions (read/write, readonly, or no access) 477 to set access permissions (read/write, readonly, or no access)
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 15eb27861fc7..08f7cc0a1953 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -2,6 +2,15 @@ menu "Kernel hacking"
2 2
3source "lib/Kconfig.debug" 3source "lib/Kconfig.debug"
4 4
5config PRINT_STACK_DEPTH
6 int "Stack depth to print" if DEBUG_KERNEL
7 default 64
8 help
9 This option allows you to set the stack depth that the kernel
10 prints in stack traces. This can be useful if your display is
11 too small and stack traces cause important information to
12 scroll off the screen.
13
5config DEBUG_STACKOVERFLOW 14config DEBUG_STACKOVERFLOW
6 bool "Check for stack overflows" 15 bool "Check for stack overflows"
7 depends on DEBUG_KERNEL 16 depends on DEBUG_KERNEL
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 1f0667069940..72d17f50e54f 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -107,7 +107,6 @@ KBUILD_CFLAGS += $(call cc-option,-mno-altivec)
107# (We use all available options to help semi-broken compilers) 107# (We use all available options to help semi-broken compilers)
108KBUILD_CFLAGS += $(call cc-option,-mno-spe) 108KBUILD_CFLAGS += $(call cc-option,-mno-spe)
109KBUILD_CFLAGS += $(call cc-option,-mspe=no) 109KBUILD_CFLAGS += $(call cc-option,-mspe=no)
110KBUILD_CFLAGS += $(call cc-option,-mabi=no-spe)
111 110
112# Enable unit-at-a-time mode when possible. It shrinks the 111# Enable unit-at-a-time mode when possible. It shrinks the
113# kernel considerably. 112# kernel considerably.
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 3d3daa674299..f32829937aad 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -194,6 +194,7 @@ image-$(CONFIG_PPC_MAPLE) += zImage.pseries
194image-$(CONFIG_PPC_IBM_CELL_BLADE) += zImage.pseries 194image-$(CONFIG_PPC_IBM_CELL_BLADE) += zImage.pseries
195image-$(CONFIG_PPC_PS3) += dtbImage.ps3 195image-$(CONFIG_PPC_PS3) += dtbImage.ps3
196image-$(CONFIG_PPC_CELLEB) += zImage.pseries 196image-$(CONFIG_PPC_CELLEB) += zImage.pseries
197image-$(CONFIG_PPC_CELL_QPACE) += zImage.pseries
197image-$(CONFIG_PPC_CHRP) += zImage.chrp 198image-$(CONFIG_PPC_CHRP) += zImage.chrp
198image-$(CONFIG_PPC_EFIKA) += zImage.chrp 199image-$(CONFIG_PPC_EFIKA) += zImage.chrp
199image-$(CONFIG_PPC_PMAC) += zImage.pmac 200image-$(CONFIG_PPC_PMAC) += zImage.pmac
diff --git a/arch/powerpc/boot/devtree.c b/arch/powerpc/boot/devtree.c
index 5d12336dc360..a7e21a35c03a 100644
--- a/arch/powerpc/boot/devtree.c
+++ b/arch/powerpc/boot/devtree.c
@@ -213,7 +213,7 @@ static int find_range(u32 *reg, u32 *ranges, int nregaddr,
213 u32 range_addr[MAX_ADDR_CELLS]; 213 u32 range_addr[MAX_ADDR_CELLS];
214 u32 range_size[MAX_ADDR_CELLS]; 214 u32 range_size[MAX_ADDR_CELLS];
215 215
216 copy_val(range_addr, ranges + i, naddr); 216 copy_val(range_addr, ranges + i, nregaddr);
217 copy_val(range_size, ranges + i + nregaddr + naddr, nsize); 217 copy_val(range_size, ranges + i + nregaddr + naddr, nsize);
218 218
219 if (compare_reg(reg, range_addr, range_size)) 219 if (compare_reg(reg, range_addr, range_size))
diff --git a/arch/powerpc/boot/dts/asp834x-redboot.dts b/arch/powerpc/boot/dts/asp834x-redboot.dts
index 6235fca445de..524af7ef9f26 100644
--- a/arch/powerpc/boot/dts/asp834x-redboot.dts
+++ b/arch/powerpc/boot/dts/asp834x-redboot.dts
@@ -199,8 +199,26 @@
199 reg = <0x2>; 199 reg = <0x2>;
200 device_type = "ethernet-phy"; 200 device_type = "ethernet-phy";
201 }; 201 };
202
203 tbi0: tbi-phy@11 {
204 reg = <0x11>;
205 device_type = "tbi-phy";
206 };
202 }; 207 };
203 208
209 mdio@25520 {
210 #address-cells = <1>;
211 #size-cells = <0>;
212 compatible = "fsl,gianfar-tbi";
213 reg = <0x25520 0x20>;
214
215 tbi1: tbi-phy@11 {
216 reg = <0x11>;
217 device_type = "tbi-phy";
218 };
219 };
220
221
204 enet0: ethernet@24000 { 222 enet0: ethernet@24000 {
205 cell-index = <0>; 223 cell-index = <0>;
206 device_type = "network"; 224 device_type = "network";
@@ -210,6 +228,7 @@
210 local-mac-address = [ 00 08 e5 11 32 33 ]; 228 local-mac-address = [ 00 08 e5 11 32 33 ];
211 interrupts = <32 0x8 33 0x8 34 0x8>; 229 interrupts = <32 0x8 33 0x8 34 0x8>;
212 interrupt-parent = <&ipic>; 230 interrupt-parent = <&ipic>;
231 tbi-handle = <&tbi0>;
213 phy-handle = <&phy0>; 232 phy-handle = <&phy0>;
214 linux,network-index = <0>; 233 linux,network-index = <0>;
215 }; 234 };
@@ -223,6 +242,7 @@
223 local-mac-address = [ 00 08 e5 11 32 34 ]; 242 local-mac-address = [ 00 08 e5 11 32 34 ];
224 interrupts = <35 0x8 36 0x8 37 0x8>; 243 interrupts = <35 0x8 36 0x8 37 0x8>;
225 interrupt-parent = <&ipic>; 244 interrupt-parent = <&ipic>;
245 tbi-handle = <&tbi1>;
226 phy-handle = <&phy1>; 246 phy-handle = <&phy1>;
227 linux,network-index = <1>; 247 linux,network-index = <1>;
228 }; 248 };
diff --git a/arch/powerpc/boot/dts/bamboo.dts b/arch/powerpc/boot/dts/bamboo.dts
index 6ce0cc2c0208..aa68911f6560 100644
--- a/arch/powerpc/boot/dts/bamboo.dts
+++ b/arch/powerpc/boot/dts/bamboo.dts
@@ -269,7 +269,8 @@
269 * later cannot be changed. Chip supports a second 269 * later cannot be changed. Chip supports a second
270 * IO range but we don't use it for now 270 * IO range but we don't use it for now
271 */ 271 */
272 ranges = <0x02000000 0x00000000 0xa0000000 0x00000000 0xa0000000 0x00000000 0x20000000 272 ranges = <0x02000000 0x00000000 0xa0000000 0x00000000 0xa0000000 0x00000000 0x40000000
273 0x02000000 0x00000000 0x00000000 0x00000000 0xe0000000 0x00000000 0x00100000
273 0x01000000 0x00000000 0x00000000 0x00000000 0xe8000000 0x00000000 0x00010000>; 274 0x01000000 0x00000000 0x00000000 0x00000000 0xe8000000 0x00000000 0x00010000>;
274 275
275 /* Inbound 2GB range starting at 0 */ 276 /* Inbound 2GB range starting at 0 */
diff --git a/arch/powerpc/boot/dts/canyonlands.dts b/arch/powerpc/boot/dts/canyonlands.dts
index 79fe412c11c9..8b5ba8261a36 100644
--- a/arch/powerpc/boot/dts/canyonlands.dts
+++ b/arch/powerpc/boot/dts/canyonlands.dts
@@ -40,6 +40,7 @@
40 d-cache-size = <32768>; 40 d-cache-size = <32768>;
41 dcr-controller; 41 dcr-controller;
42 dcr-access-method = "native"; 42 dcr-access-method = "native";
43 next-level-cache = <&L2C0>;
43 }; 44 };
44 }; 45 };
45 46
@@ -104,6 +105,16 @@
104 dcr-reg = <0x00c 0x002>; 105 dcr-reg = <0x00c 0x002>;
105 }; 106 };
106 107
108 L2C0: l2c {
109 compatible = "ibm,l2-cache-460ex", "ibm,l2-cache";
110 dcr-reg = <0x020 0x008 /* Internal SRAM DCR's */
111 0x030 0x008>; /* L2 cache DCR's */
112 cache-line-size = <32>; /* 32 bytes */
113 cache-size = <262144>; /* L2, 256K */
114 interrupt-parent = <&UIC1>;
115 interrupts = <11 1>;
116 };
117
107 plb { 118 plb {
108 compatible = "ibm,plb-460ex", "ibm,plb4"; 119 compatible = "ibm,plb-460ex", "ibm,plb4";
109 #address-cells = <2>; 120 #address-cells = <2>;
@@ -343,6 +354,7 @@
343 * later cannot be changed 354 * later cannot be changed
344 */ 355 */
345 ranges = <0x02000000 0x00000000 0x80000000 0x0000000d 0x80000000 0x00000000 0x80000000 356 ranges = <0x02000000 0x00000000 0x80000000 0x0000000d 0x80000000 0x00000000 0x80000000
357 0x02000000 0x00000000 0x00000000 0x0000000c 0x0ee00000 0x00000000 0x00100000
346 0x01000000 0x00000000 0x00000000 0x0000000c 0x08000000 0x00000000 0x00010000>; 358 0x01000000 0x00000000 0x00000000 0x0000000c 0x08000000 0x00000000 0x00010000>;
347 359
348 /* Inbound 2GB range starting at 0 */ 360 /* Inbound 2GB range starting at 0 */
@@ -373,6 +385,7 @@
373 * later cannot be changed 385 * later cannot be changed
374 */ 386 */
375 ranges = <0x02000000 0x00000000 0x80000000 0x0000000e 0x00000000 0x00000000 0x80000000 387 ranges = <0x02000000 0x00000000 0x80000000 0x0000000e 0x00000000 0x00000000 0x80000000
388 0x02000000 0x00000000 0x00000000 0x0000000f 0x00000000 0x00000000 0x00100000
376 0x01000000 0x00000000 0x00000000 0x0000000f 0x80000000 0x00000000 0x00010000>; 389 0x01000000 0x00000000 0x00000000 0x0000000f 0x80000000 0x00000000 0x00010000>;
377 390
378 /* Inbound 2GB range starting at 0 */ 391 /* Inbound 2GB range starting at 0 */
@@ -414,6 +427,7 @@
414 * later cannot be changed 427 * later cannot be changed
415 */ 428 */
416 ranges = <0x02000000 0x00000000 0x80000000 0x0000000e 0x80000000 0x00000000 0x80000000 429 ranges = <0x02000000 0x00000000 0x80000000 0x0000000e 0x80000000 0x00000000 0x80000000
430 0x02000000 0x00000000 0x00000000 0x0000000f 0x00100000 0x00000000 0x00100000
417 0x01000000 0x00000000 0x00000000 0x0000000f 0x80010000 0x00000000 0x00010000>; 431 0x01000000 0x00000000 0x00000000 0x0000000f 0x80010000 0x00000000 0x00010000>;
418 432
419 /* Inbound 2GB range starting at 0 */ 433 /* Inbound 2GB range starting at 0 */
diff --git a/arch/powerpc/boot/dts/gef_sbc610.dts b/arch/powerpc/boot/dts/gef_sbc610.dts
index e48cfa740c8a..9708b3423bbd 100644
--- a/arch/powerpc/boot/dts/gef_sbc610.dts
+++ b/arch/powerpc/boot/dts/gef_sbc610.dts
@@ -98,6 +98,12 @@
98 interrupt-parent = <&mpic>; 98 interrupt-parent = <&mpic>;
99 99
100 }; 100 };
101 gef_gpio: gpio@7,14000 {
102 #gpio-cells = <2>;
103 compatible = "gef,sbc610-gpio";
104 reg = <0x7 0x14000 0x24>;
105 gpio-controller;
106 };
101 }; 107 };
102 108
103 soc@fef00000 { 109 soc@fef00000 {
@@ -119,6 +125,11 @@
119 interrupt-parent = <&mpic>; 125 interrupt-parent = <&mpic>;
120 dfsrr; 126 dfsrr;
121 127
128 rtc@51 {
129 compatible = "epson,rx8581";
130 reg = <0x00000051>;
131 };
132
122 eti@6b { 133 eti@6b {
123 compatible = "dallas,ds1682"; 134 compatible = "dallas,ds1682";
124 reg = <0x6b>; 135 reg = <0x6b>;
diff --git a/arch/powerpc/boot/dts/ksi8560.dts b/arch/powerpc/boot/dts/ksi8560.dts
index 49737589ffc8..3bfff47418db 100644
--- a/arch/powerpc/boot/dts/ksi8560.dts
+++ b/arch/powerpc/boot/dts/ksi8560.dts
@@ -141,8 +141,26 @@
141 reg = <0x2>; 141 reg = <0x2>;
142 device_type = "ethernet-phy"; 142 device_type = "ethernet-phy";
143 }; 143 };
144
145 tbi0: tbi-phy@11 {
146 reg = <0x11>;
147 device_type = "tbi-phy";
148 };
144 }; 149 };
145 150
151 mdio@25520 {
152 #address-cells = <1>;
153 #size-cells = <0>;
154 compatible = "fsl,gianfar-tbi";
155 reg = <0x25520 0x20>;
156
157 tbi1: tbi-phy@11 {
158 reg = <0x11>;
159 device_type = "tbi-phy";
160 };
161 };
162
163
146 enet0: ethernet@24000 { 164 enet0: ethernet@24000 {
147 device_type = "network"; 165 device_type = "network";
148 model = "TSEC"; 166 model = "TSEC";
@@ -152,6 +170,7 @@
152 local-mac-address = [ 00 00 00 00 00 00 ]; 170 local-mac-address = [ 00 00 00 00 00 00 ];
153 interrupts = <0x1d 0x2 0x1e 0x2 0x22 0x2>; 171 interrupts = <0x1d 0x2 0x1e 0x2 0x22 0x2>;
154 interrupt-parent = <&mpic>; 172 interrupt-parent = <&mpic>;
173 tbi-handle = <&tbi0>;
155 phy-handle = <&PHY1>; 174 phy-handle = <&PHY1>;
156 }; 175 };
157 176
@@ -164,6 +183,7 @@
164 local-mac-address = [ 00 00 00 00 00 00 ]; 183 local-mac-address = [ 00 00 00 00 00 00 ];
165 interrupts = <0x23 0x2 0x24 0x2 0x28 0x2>; 184 interrupts = <0x23 0x2 0x24 0x2 0x28 0x2>;
166 interrupt-parent = <&mpic>; 185 interrupt-parent = <&mpic>;
186 tbi-handle = <&tbi1>;
167 phy-handle = <&PHY2>; 187 phy-handle = <&PHY2>;
168 }; 188 };
169 189
diff --git a/arch/powerpc/boot/dts/kuroboxHD.dts b/arch/powerpc/boot/dts/kuroboxHD.dts
index 2e5a1a1812b6..8d725d10882f 100644
--- a/arch/powerpc/boot/dts/kuroboxHD.dts
+++ b/arch/powerpc/boot/dts/kuroboxHD.dts
@@ -76,7 +76,6 @@ XXXX add flash parts, rtc, ??
76 interrupt-parent = <&mpic>; 76 interrupt-parent = <&mpic>;
77 77
78 rtc@32 { 78 rtc@32 {
79 device_type = "rtc";
80 compatible = "ricoh,rs5c372a"; 79 compatible = "ricoh,rs5c372a";
81 reg = <0x32>; 80 reg = <0x32>;
82 }; 81 };
diff --git a/arch/powerpc/boot/dts/kuroboxHG.dts b/arch/powerpc/boot/dts/kuroboxHG.dts
index e4916e69ad31..b13a11eb81b0 100644
--- a/arch/powerpc/boot/dts/kuroboxHG.dts
+++ b/arch/powerpc/boot/dts/kuroboxHG.dts
@@ -76,7 +76,6 @@ XXXX add flash parts, rtc, ??
76 interrupt-parent = <&mpic>; 76 interrupt-parent = <&mpic>;
77 77
78 rtc@32 { 78 rtc@32 {
79 device_type = "rtc";
80 compatible = "ricoh,rs5c372a"; 79 compatible = "ricoh,rs5c372a";
81 reg = <0x32>; 80 reg = <0x32>;
82 }; 81 };
diff --git a/arch/powerpc/boot/dts/lite5200.dts b/arch/powerpc/boot/dts/lite5200.dts
index 2cf9a8768f44..3f7a5dce8de0 100644
--- a/arch/powerpc/boot/dts/lite5200.dts
+++ b/arch/powerpc/boot/dts/lite5200.dts
@@ -130,7 +130,6 @@
130 130
131 rtc@800 { // Real time clock 131 rtc@800 { // Real time clock
132 compatible = "fsl,mpc5200-rtc"; 132 compatible = "fsl,mpc5200-rtc";
133 device_type = "rtc";
134 reg = <0x800 0x100>; 133 reg = <0x800 0x100>;
135 interrupts = <1 5 0 1 6 0>; 134 interrupts = <1 5 0 1 6 0>;
136 interrupt-parent = <&mpc5200_pic>; 135 interrupt-parent = <&mpc5200_pic>;
diff --git a/arch/powerpc/boot/dts/lite5200b.dts b/arch/powerpc/boot/dts/lite5200b.dts
index 7bd5b9c399b8..63e3bb48e843 100644
--- a/arch/powerpc/boot/dts/lite5200b.dts
+++ b/arch/powerpc/boot/dts/lite5200b.dts
@@ -130,7 +130,6 @@
130 130
131 rtc@800 { // Real time clock 131 rtc@800 { // Real time clock
132 compatible = "fsl,mpc5200b-rtc","fsl,mpc5200-rtc"; 132 compatible = "fsl,mpc5200b-rtc","fsl,mpc5200-rtc";
133 device_type = "rtc";
134 reg = <0x800 0x100>; 133 reg = <0x800 0x100>;
135 interrupts = <1 5 0 1 6 0>; 134 interrupts = <1 5 0 1 6 0>;
136 interrupt-parent = <&mpc5200_pic>; 135 interrupt-parent = <&mpc5200_pic>;
diff --git a/arch/powerpc/boot/dts/motionpro.dts b/arch/powerpc/boot/dts/motionpro.dts
index 9e3c921be164..52ba6f98b273 100644
--- a/arch/powerpc/boot/dts/motionpro.dts
+++ b/arch/powerpc/boot/dts/motionpro.dts
@@ -248,7 +248,6 @@
248 fsl5200-clocking; 248 fsl5200-clocking;
249 249
250 rtc@68 { 250 rtc@68 {
251 device_type = "rtc";
252 compatible = "dallas,ds1339"; 251 compatible = "dallas,ds1339";
253 reg = <0x68>; 252 reg = <0x68>;
254 }; 253 };
diff --git a/arch/powerpc/boot/dts/mpc8313erdb.dts b/arch/powerpc/boot/dts/mpc8313erdb.dts
index 503031766825..d4df8b6857a4 100644
--- a/arch/powerpc/boot/dts/mpc8313erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8313erdb.dts
@@ -190,6 +190,7 @@
190 local-mac-address = [ 00 00 00 00 00 00 ]; 190 local-mac-address = [ 00 00 00 00 00 00 ];
191 interrupts = <37 0x8 36 0x8 35 0x8>; 191 interrupts = <37 0x8 36 0x8 35 0x8>;
192 interrupt-parent = <&ipic>; 192 interrupt-parent = <&ipic>;
193 tbi-handle = < &tbi0 >;
193 phy-handle = < &phy1 >; 194 phy-handle = < &phy1 >;
194 fsl,magic-packet; 195 fsl,magic-packet;
195 196
@@ -210,6 +211,10 @@
210 reg = <0x4>; 211 reg = <0x4>;
211 device_type = "ethernet-phy"; 212 device_type = "ethernet-phy";
212 }; 213 };
214 tbi0: tbi-phy@11 {
215 reg = <0x11>;
216 device_type = "tbi-phy";
217 };
213 }; 218 };
214 }; 219 };
215 220
@@ -222,9 +227,24 @@
222 local-mac-address = [ 00 00 00 00 00 00 ]; 227 local-mac-address = [ 00 00 00 00 00 00 ];
223 interrupts = <34 0x8 33 0x8 32 0x8>; 228 interrupts = <34 0x8 33 0x8 32 0x8>;
224 interrupt-parent = <&ipic>; 229 interrupt-parent = <&ipic>;
230 tbi-handle = < &tbi1 >;
225 phy-handle = < &phy4 >; 231 phy-handle = < &phy4 >;
226 sleep = <&pmc 0x10000000>; 232 sleep = <&pmc 0x10000000>;
227 fsl,magic-packet; 233 fsl,magic-packet;
234
235 mdio@25520 {
236 #address-cells = <1>;
237 #size-cells = <0>;
238 compatible = "fsl,gianfar-tbi";
239 reg = <0x25520 0x20>;
240
241 tbi1: tbi-phy@11 {
242 reg = <0x11>;
243 device_type = "tbi-phy";
244 };
245 };
246
247
228 }; 248 };
229 249
230 serial0: serial@4500 { 250 serial0: serial@4500 {
diff --git a/arch/powerpc/boot/dts/mpc8315erdb.dts b/arch/powerpc/boot/dts/mpc8315erdb.dts
index 6b850670de1d..072c9b0f8c8e 100644
--- a/arch/powerpc/boot/dts/mpc8315erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8315erdb.dts
@@ -117,7 +117,6 @@
117 interrupt-parent = <&ipic>; 117 interrupt-parent = <&ipic>;
118 dfsrr; 118 dfsrr;
119 rtc@68 { 119 rtc@68 {
120 device_type = "rtc";
121 compatible = "dallas,ds1339"; 120 compatible = "dallas,ds1339";
122 reg = <0x68>; 121 reg = <0x68>;
123 }; 122 };
@@ -206,8 +205,25 @@
206 reg = <0x1>; 205 reg = <0x1>;
207 device_type = "ethernet-phy"; 206 device_type = "ethernet-phy";
208 }; 207 };
208 tbi0: tbi-phy@11 {
209 reg = <0x11>;
210 device_type = "tbi-phy";
211 };
212 };
213
214 mdio@25520 {
215 #address-cells = <1>;
216 #size-cells = <0>;
217 compatible = "fsl,gianfar-tbi";
218 reg = <0x25520 0x20>;
219
220 tbi1: tbi-phy@11 {
221 reg = <0x11>;
222 device_type = "tbi-phy";
223 };
209 }; 224 };
210 225
226
211 enet0: ethernet@24000 { 227 enet0: ethernet@24000 {
212 cell-index = <0>; 228 cell-index = <0>;
213 device_type = "network"; 229 device_type = "network";
@@ -217,6 +233,7 @@
217 local-mac-address = [ 00 00 00 00 00 00 ]; 233 local-mac-address = [ 00 00 00 00 00 00 ];
218 interrupts = <32 0x8 33 0x8 34 0x8>; 234 interrupts = <32 0x8 33 0x8 34 0x8>;
219 interrupt-parent = <&ipic>; 235 interrupt-parent = <&ipic>;
236 tbi-handle = <&tbi0>;
220 phy-handle = < &phy0 >; 237 phy-handle = < &phy0 >;
221 }; 238 };
222 239
@@ -229,6 +246,7 @@
229 local-mac-address = [ 00 00 00 00 00 00 ]; 246 local-mac-address = [ 00 00 00 00 00 00 ];
230 interrupts = <35 0x8 36 0x8 37 0x8>; 247 interrupts = <35 0x8 36 0x8 37 0x8>;
231 interrupt-parent = <&ipic>; 248 interrupt-parent = <&ipic>;
249 tbi-handle = <&tbi1>;
232 phy-handle = < &phy1 >; 250 phy-handle = < &phy1 >;
233 }; 251 };
234 252
diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts
index 4bdbaf4993a1..b5eda94a8e2a 100644
--- a/arch/powerpc/boot/dts/mpc8349emitx.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
@@ -85,7 +85,6 @@
85 dfsrr; 85 dfsrr;
86 86
87 rtc@68 { 87 rtc@68 {
88 device_type = "rtc";
89 compatible = "dallas,ds1339"; 88 compatible = "dallas,ds1339";
90 reg = <0x68>; 89 reg = <0x68>;
91 interrupts = <18 0x8>; 90 interrupts = <18 0x8>;
@@ -184,6 +183,22 @@
184 reg = <0x1c>; 183 reg = <0x1c>;
185 device_type = "ethernet-phy"; 184 device_type = "ethernet-phy";
186 }; 185 };
186 tbi0: tbi-phy@11 {
187 reg = <0x11>;
188 device_type = "tbi-phy";
189 };
190 };
191
192 mdio@25520 {
193 #address-cells = <1>;
194 #size-cells = <0>;
195 compatible = "fsl,gianfar-tbi";
196 reg = <0x25520 0x20>;
197
198 tbi1: tbi-phy@11 {
199 reg = <0x11>;
200 device_type = "tbi-phy";
201 };
187 }; 202 };
188 203
189 enet0: ethernet@24000 { 204 enet0: ethernet@24000 {
@@ -195,6 +210,7 @@
195 local-mac-address = [ 00 00 00 00 00 00 ]; 210 local-mac-address = [ 00 00 00 00 00 00 ];
196 interrupts = <32 0x8 33 0x8 34 0x8>; 211 interrupts = <32 0x8 33 0x8 34 0x8>;
197 interrupt-parent = <&ipic>; 212 interrupt-parent = <&ipic>;
213 tbi-handle = <&tbi0>;
198 phy-handle = <&phy1c>; 214 phy-handle = <&phy1c>;
199 linux,network-index = <0>; 215 linux,network-index = <0>;
200 }; 216 };
@@ -211,6 +227,7 @@
211 /* Vitesse 7385 isn't on the MDIO bus */ 227 /* Vitesse 7385 isn't on the MDIO bus */
212 fixed-link = <1 1 1000 0 0>; 228 fixed-link = <1 1 1000 0 0>;
213 linux,network-index = <1>; 229 linux,network-index = <1>;
230 tbi-handle = <&tbi1>;
214 }; 231 };
215 232
216 serial0: serial@4500 { 233 serial0: serial@4500 {
diff --git a/arch/powerpc/boot/dts/mpc8349emitxgp.dts b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
index fa40647ee62e..c87a6015e165 100644
--- a/arch/powerpc/boot/dts/mpc8349emitxgp.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
@@ -83,7 +83,6 @@
83 dfsrr; 83 dfsrr;
84 84
85 rtc@68 { 85 rtc@68 {
86 device_type = "rtc";
87 compatible = "dallas,ds1339"; 86 compatible = "dallas,ds1339";
88 reg = <0x68>; 87 reg = <0x68>;
89 interrupts = <18 0x8>; 88 interrupts = <18 0x8>;
@@ -163,6 +162,10 @@
163 reg = <0x1c>; 162 reg = <0x1c>;
164 device_type = "ethernet-phy"; 163 device_type = "ethernet-phy";
165 }; 164 };
165 tbi0: tbi-phy@11 {
166 reg = <0x11>;
167 device_type = "tbi-phy";
168 };
166 }; 169 };
167 170
168 enet0: ethernet@24000 { 171 enet0: ethernet@24000 {
@@ -174,6 +177,7 @@
174 local-mac-address = [ 00 00 00 00 00 00 ]; 177 local-mac-address = [ 00 00 00 00 00 00 ];
175 interrupts = <32 0x8 33 0x8 34 0x8>; 178 interrupts = <32 0x8 33 0x8 34 0x8>;
176 interrupt-parent = <&ipic>; 179 interrupt-parent = <&ipic>;
180 tbi-handle = <&tbi0>;
177 phy-handle = <&phy1c>; 181 phy-handle = <&phy1c>;
178 linux,network-index = <0>; 182 linux,network-index = <0>;
179 }; 183 };
diff --git a/arch/powerpc/boot/dts/mpc834x_mds.dts b/arch/powerpc/boot/dts/mpc834x_mds.dts
index c986c541e9bb..d9adba01c09c 100644
--- a/arch/powerpc/boot/dts/mpc834x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc834x_mds.dts
@@ -185,8 +185,25 @@
185 reg = <0x1>; 185 reg = <0x1>;
186 device_type = "ethernet-phy"; 186 device_type = "ethernet-phy";
187 }; 187 };
188 tbi0: tbi-phy@11 {
189 reg = <0x11>;
190 device_type = "tbi-phy";
191 };
192 };
193
194 mdio@25520 {
195 #address-cells = <1>;
196 #size-cells = <0>;
197 compatible = "fsl,gianfar-tbi";
198 reg = <0x25520 0x20>;
199
200 tbi1: tbi-phy@11 {
201 reg = <0x11>;
202 device_type = "tbi-phy";
203 };
188 }; 204 };
189 205
206
190 enet0: ethernet@24000 { 207 enet0: ethernet@24000 {
191 cell-index = <0>; 208 cell-index = <0>;
192 device_type = "network"; 209 device_type = "network";
@@ -196,6 +213,7 @@
196 local-mac-address = [ 00 00 00 00 00 00 ]; 213 local-mac-address = [ 00 00 00 00 00 00 ];
197 interrupts = <32 0x8 33 0x8 34 0x8>; 214 interrupts = <32 0x8 33 0x8 34 0x8>;
198 interrupt-parent = <&ipic>; 215 interrupt-parent = <&ipic>;
216 tbi-handle = <&tbi0>;
199 phy-handle = <&phy0>; 217 phy-handle = <&phy0>;
200 linux,network-index = <0>; 218 linux,network-index = <0>;
201 }; 219 };
@@ -209,6 +227,7 @@
209 local-mac-address = [ 00 00 00 00 00 00 ]; 227 local-mac-address = [ 00 00 00 00 00 00 ];
210 interrupts = <35 0x8 36 0x8 37 0x8>; 228 interrupts = <35 0x8 36 0x8 37 0x8>;
211 interrupt-parent = <&ipic>; 229 interrupt-parent = <&ipic>;
230 tbi-handle = <&tbi1>;
212 phy-handle = <&phy1>; 231 phy-handle = <&phy1>;
213 linux,network-index = <1>; 232 linux,network-index = <1>;
214 }; 233 };
diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts b/arch/powerpc/boot/dts/mpc8377_mds.dts
index 0484561bd2c0..1d14d7052e6d 100644
--- a/arch/powerpc/boot/dts/mpc8377_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8377_mds.dts
@@ -193,8 +193,25 @@
193 reg = <0x3>; 193 reg = <0x3>;
194 device_type = "ethernet-phy"; 194 device_type = "ethernet-phy";
195 }; 195 };
196 tbi0: tbi-phy@11 {
197 reg = <0x11>;
198 device_type = "tbi-phy";
199 };
200 };
201
202 mdio@25520 {
203 #address-cells = <1>;
204 #size-cells = <0>;
205 compatible = "fsl,gianfar-tbi";
206 reg = <0x25520 0x20>;
207
208 tbi1: tbi-phy@11 {
209 reg = <0x11>;
210 device_type = "tbi-phy";
211 };
196 }; 212 };
197 213
214
198 enet0: ethernet@24000 { 215 enet0: ethernet@24000 {
199 cell-index = <0>; 216 cell-index = <0>;
200 device_type = "network"; 217 device_type = "network";
@@ -205,6 +222,7 @@
205 interrupts = <32 0x8 33 0x8 34 0x8>; 222 interrupts = <32 0x8 33 0x8 34 0x8>;
206 phy-connection-type = "mii"; 223 phy-connection-type = "mii";
207 interrupt-parent = <&ipic>; 224 interrupt-parent = <&ipic>;
225 tbi-handle = <&tbi0>;
208 phy-handle = <&phy2>; 226 phy-handle = <&phy2>;
209 }; 227 };
210 228
@@ -218,6 +236,7 @@
218 interrupts = <35 0x8 36 0x8 37 0x8>; 236 interrupts = <35 0x8 36 0x8 37 0x8>;
219 phy-connection-type = "mii"; 237 phy-connection-type = "mii";
220 interrupt-parent = <&ipic>; 238 interrupt-parent = <&ipic>;
239 tbi-handle = <&tbi1>;
221 phy-handle = <&phy3>; 240 phy-handle = <&phy3>;
222 }; 241 };
223 242
diff --git a/arch/powerpc/boot/dts/mpc8377_rdb.dts b/arch/powerpc/boot/dts/mpc8377_rdb.dts
index 435ef3dd022d..9413af3b9925 100644
--- a/arch/powerpc/boot/dts/mpc8377_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc8377_rdb.dts
@@ -117,7 +117,6 @@
117 interrupt-parent = <&ipic>; 117 interrupt-parent = <&ipic>;
118 dfsrr; 118 dfsrr;
119 rtc@68 { 119 rtc@68 {
120 device_type = "rtc";
121 compatible = "dallas,ds1339"; 120 compatible = "dallas,ds1339";
122 reg = <0x68>; 121 reg = <0x68>;
123 }; 122 };
@@ -211,8 +210,25 @@
211 reg = <0x2>; 210 reg = <0x2>;
212 device_type = "ethernet-phy"; 211 device_type = "ethernet-phy";
213 }; 212 };
213 tbi0: tbi-phy@11 {
214 reg = <0x11>;
215 device_type = "tbi-phy";
216 };
217 };
218
219 mdio@25520 {
220 #address-cells = <1>;
221 #size-cells = <0>;
222 compatible = "fsl,gianfar-tbi";
223 reg = <0x25520 0x20>;
224
225 tbi1: tbi-phy@11 {
226 reg = <0x11>;
227 device_type = "tbi-phy";
228 };
214 }; 229 };
215 230
231
216 enet0: ethernet@24000 { 232 enet0: ethernet@24000 {
217 cell-index = <0>; 233 cell-index = <0>;
218 device_type = "network"; 234 device_type = "network";
@@ -223,6 +239,7 @@
223 interrupts = <32 0x8 33 0x8 34 0x8>; 239 interrupts = <32 0x8 33 0x8 34 0x8>;
224 phy-connection-type = "mii"; 240 phy-connection-type = "mii";
225 interrupt-parent = <&ipic>; 241 interrupt-parent = <&ipic>;
242 tbi-handle = <&tbi0>;
226 phy-handle = <&phy2>; 243 phy-handle = <&phy2>;
227 }; 244 };
228 245
@@ -237,6 +254,7 @@
237 phy-connection-type = "mii"; 254 phy-connection-type = "mii";
238 interrupt-parent = <&ipic>; 255 interrupt-parent = <&ipic>;
239 fixed-link = <1 1 1000 0 0>; 256 fixed-link = <1 1 1000 0 0>;
257 tbi-handle = <&tbi1>;
240 }; 258 };
241 259
242 serial0: serial@4500 { 260 serial0: serial@4500 {
diff --git a/arch/powerpc/boot/dts/mpc8378_mds.dts b/arch/powerpc/boot/dts/mpc8378_mds.dts
index 67a08d2e2ff2..b85fc02682d2 100644
--- a/arch/powerpc/boot/dts/mpc8378_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8378_mds.dts
@@ -232,8 +232,25 @@
232 reg = <0x3>; 232 reg = <0x3>;
233 device_type = "ethernet-phy"; 233 device_type = "ethernet-phy";
234 }; 234 };
235 tbi0: tbi-phy@11 {
236 reg = <0x11>;
237 device_type = "tbi-phy";
238 };
239 };
240
241 mdio@25520 {
242 #address-cells = <1>;
243 #size-cells = <0>;
244 compatible = "fsl,gianfar-tbi";
245 reg = <0x25520 0x20>;
246
247 tbi1: tbi-phy@11 {
248 reg = <0x11>;
249 device_type = "tbi-phy";
250 };
235 }; 251 };
236 252
253
237 enet0: ethernet@24000 { 254 enet0: ethernet@24000 {
238 cell-index = <0>; 255 cell-index = <0>;
239 device_type = "network"; 256 device_type = "network";
@@ -244,6 +261,7 @@
244 interrupts = <32 0x8 33 0x8 34 0x8>; 261 interrupts = <32 0x8 33 0x8 34 0x8>;
245 phy-connection-type = "mii"; 262 phy-connection-type = "mii";
246 interrupt-parent = <&ipic>; 263 interrupt-parent = <&ipic>;
264 tbi-handle = <&tbi0>;
247 phy-handle = <&phy2>; 265 phy-handle = <&phy2>;
248 }; 266 };
249 267
@@ -257,6 +275,7 @@
257 interrupts = <35 0x8 36 0x8 37 0x8>; 275 interrupts = <35 0x8 36 0x8 37 0x8>;
258 phy-connection-type = "mii"; 276 phy-connection-type = "mii";
259 interrupt-parent = <&ipic>; 277 interrupt-parent = <&ipic>;
278 tbi-handle = <&tbi1>;
260 phy-handle = <&phy3>; 279 phy-handle = <&phy3>;
261 }; 280 };
262 281
diff --git a/arch/powerpc/boot/dts/mpc8378_rdb.dts b/arch/powerpc/boot/dts/mpc8378_rdb.dts
index b11e68f56a06..23c10ce22c2c 100644
--- a/arch/powerpc/boot/dts/mpc8378_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc8378_rdb.dts
@@ -117,7 +117,6 @@
117 interrupt-parent = <&ipic>; 117 interrupt-parent = <&ipic>;
118 dfsrr; 118 dfsrr;
119 rtc@68 { 119 rtc@68 {
120 device_type = "rtc";
121 compatible = "dallas,ds1339"; 120 compatible = "dallas,ds1339";
122 reg = <0x68>; 121 reg = <0x68>;
123 }; 122 };
@@ -211,8 +210,25 @@
211 reg = <0x2>; 210 reg = <0x2>;
212 device_type = "ethernet-phy"; 211 device_type = "ethernet-phy";
213 }; 212 };
213 tbi0: tbi-phy@11 {
214 reg = <0x11>;
215 device_type = "tbi-phy";
216 };
217 };
218
219 mdio@25520 {
220 #address-cells = <1>;
221 #size-cells = <0>;
222 compatible = "fsl,gianfar-tbi";
223 reg = <0x25520 0x20>;
224
225 tbi1: tbi-phy@11 {
226 reg = <0x11>;
227 device_type = "tbi-phy";
228 };
214 }; 229 };
215 230
231
216 enet0: ethernet@24000 { 232 enet0: ethernet@24000 {
217 cell-index = <0>; 233 cell-index = <0>;
218 device_type = "network"; 234 device_type = "network";
diff --git a/arch/powerpc/boot/dts/mpc8379_mds.dts b/arch/powerpc/boot/dts/mpc8379_mds.dts
index 323370a2b5ff..acf06c438dbf 100644
--- a/arch/powerpc/boot/dts/mpc8379_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8379_mds.dts
@@ -232,6 +232,22 @@
232 reg = <0x3>; 232 reg = <0x3>;
233 device_type = "ethernet-phy"; 233 device_type = "ethernet-phy";
234 }; 234 };
235 tbi0: tbi-phy@11 {
236 reg = <0x11>;
237 device_type = "tbi-phy";
238 };
239 };
240
241 mdio@25520 {
242 #address-cells = <1>;
243 #size-cells = <0>;
244 compatible = "fsl,gianfar-tbi";
245 reg = <0x25520 0x20>;
246
247 tbi1: tbi-phy@11 {
248 reg = <0x11>;
249 device_type = "tbi-phy";
250 };
235 }; 251 };
236 252
237 enet0: ethernet@24000 { 253 enet0: ethernet@24000 {
@@ -244,6 +260,7 @@
244 interrupts = <32 0x8 33 0x8 34 0x8>; 260 interrupts = <32 0x8 33 0x8 34 0x8>;
245 phy-connection-type = "mii"; 261 phy-connection-type = "mii";
246 interrupt-parent = <&ipic>; 262 interrupt-parent = <&ipic>;
263 tbi-handle = <&tbi0>;
247 phy-handle = <&phy2>; 264 phy-handle = <&phy2>;
248 }; 265 };
249 266
@@ -257,6 +274,7 @@
257 interrupts = <35 0x8 36 0x8 37 0x8>; 274 interrupts = <35 0x8 36 0x8 37 0x8>;
258 phy-connection-type = "mii"; 275 phy-connection-type = "mii";
259 interrupt-parent = <&ipic>; 276 interrupt-parent = <&ipic>;
277 tbi-handle = <&tbi1>;
260 phy-handle = <&phy3>; 278 phy-handle = <&phy3>;
261 }; 279 };
262 280
diff --git a/arch/powerpc/boot/dts/mpc8379_rdb.dts b/arch/powerpc/boot/dts/mpc8379_rdb.dts
index 337af6ea26d3..72cdc3c4c7e3 100644
--- a/arch/powerpc/boot/dts/mpc8379_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc8379_rdb.dts
@@ -117,7 +117,6 @@
117 interrupt-parent = <&ipic>; 117 interrupt-parent = <&ipic>;
118 dfsrr; 118 dfsrr;
119 rtc@68 { 119 rtc@68 {
120 device_type = "rtc";
121 compatible = "dallas,ds1339"; 120 compatible = "dallas,ds1339";
122 reg = <0x68>; 121 reg = <0x68>;
123 }; 122 };
@@ -211,6 +210,22 @@
211 reg = <0x2>; 210 reg = <0x2>;
212 device_type = "ethernet-phy"; 211 device_type = "ethernet-phy";
213 }; 212 };
213 tbi0: tbi-phy@11 {
214 reg = <0x11>;
215 device_type = "tbi-phy";
216 };
217 };
218
219 mdio@25520 {
220 #address-cells = <1>;
221 #size-cells = <0>;
222 compatible = "fsl,gianfar-tbi";
223 reg = <0x25520 0x20>;
224
225 tbi1: tbi-phy@11 {
226 reg = <0x11>;
227 device_type = "tbi-phy";
228 };
214 }; 229 };
215 230
216 enet0: ethernet@24000 { 231 enet0: ethernet@24000 {
@@ -223,6 +238,7 @@
223 interrupts = <32 0x8 33 0x8 34 0x8>; 238 interrupts = <32 0x8 33 0x8 34 0x8>;
224 phy-connection-type = "mii"; 239 phy-connection-type = "mii";
225 interrupt-parent = <&ipic>; 240 interrupt-parent = <&ipic>;
241 tbi-handle = <&tbi0>;
226 phy-handle = <&phy2>; 242 phy-handle = <&phy2>;
227 }; 243 };
228 244
@@ -237,6 +253,7 @@
237 phy-connection-type = "mii"; 253 phy-connection-type = "mii";
238 interrupt-parent = <&ipic>; 254 interrupt-parent = <&ipic>;
239 fixed-link = <1 1 1000 0 0>; 255 fixed-link = <1 1 1000 0 0>;
256 tbi-handle = <&tbi1>;
240 }; 257 };
241 258
242 serial0: serial@4500 { 259 serial0: serial@4500 {
diff --git a/arch/powerpc/boot/dts/mpc8536ds.dts b/arch/powerpc/boot/dts/mpc8536ds.dts
index 35db1e5440c7..3c905df1812c 100644
--- a/arch/powerpc/boot/dts/mpc8536ds.dts
+++ b/arch/powerpc/boot/dts/mpc8536ds.dts
@@ -155,6 +155,22 @@
155 reg = <1>; 155 reg = <1>;
156 device_type = "ethernet-phy"; 156 device_type = "ethernet-phy";
157 }; 157 };
158 tbi0: tbi-phy@11 {
159 reg = <0x11>;
160 device_type = "tbi-phy";
161 };
162 };
163
164 mdio@26520 {
165 #address-cells = <1>;
166 #size-cells = <0>;
167 compatible = "fsl,gianfar-tbi";
168 reg = <0x26520 0x20>;
169
170 tbi1: tbi-phy@11 {
171 reg = <0x11>;
172 device_type = "tbi-phy";
173 };
158 }; 174 };
159 175
160 usb@22000 { 176 usb@22000 {
@@ -186,6 +202,7 @@
186 local-mac-address = [ 00 00 00 00 00 00 ]; 202 local-mac-address = [ 00 00 00 00 00 00 ];
187 interrupts = <29 2 30 2 34 2>; 203 interrupts = <29 2 30 2 34 2>;
188 interrupt-parent = <&mpic>; 204 interrupt-parent = <&mpic>;
205 tbi-handle = <&tbi0>;
189 phy-handle = <&phy1>; 206 phy-handle = <&phy1>;
190 phy-connection-type = "rgmii-id"; 207 phy-connection-type = "rgmii-id";
191 }; 208 };
@@ -199,6 +216,7 @@
199 local-mac-address = [ 00 00 00 00 00 00 ]; 216 local-mac-address = [ 00 00 00 00 00 00 ];
200 interrupts = <31 2 32 2 33 2>; 217 interrupts = <31 2 32 2 33 2>;
201 interrupt-parent = <&mpic>; 218 interrupt-parent = <&mpic>;
219 tbi-handle = <&tbi1>;
202 phy-handle = <&phy0>; 220 phy-handle = <&phy0>;
203 phy-connection-type = "rgmii-id"; 221 phy-connection-type = "rgmii-id";
204 }; 222 };
diff --git a/arch/powerpc/boot/dts/mpc8540ads.dts b/arch/powerpc/boot/dts/mpc8540ads.dts
index 9568bfaff8f7..79570ffe41b9 100644
--- a/arch/powerpc/boot/dts/mpc8540ads.dts
+++ b/arch/powerpc/boot/dts/mpc8540ads.dts
@@ -150,6 +150,34 @@
150 reg = <0x3>; 150 reg = <0x3>;
151 device_type = "ethernet-phy"; 151 device_type = "ethernet-phy";
152 }; 152 };
153 tbi0: tbi-phy@11 {
154 reg = <0x11>;
155 device_type = "tbi-phy";
156 };
157 };
158
159 mdio@25520 {
160 #address-cells = <1>;
161 #size-cells = <0>;
162 compatible = "fsl,gianfar-tbi";
163 reg = <0x25520 0x20>;
164
165 tbi1: tbi-phy@11 {
166 reg = <0x11>;
167 device_type = "tbi-phy";
168 };
169 };
170
171 mdio@26520 {
172 #address-cells = <1>;
173 #size-cells = <0>;
174 compatible = "fsl,gianfar-tbi";
175 reg = <0x26520 0x20>;
176
177 tbi2: tbi-phy@11 {
178 reg = <0x11>;
179 device_type = "tbi-phy";
180 };
153 }; 181 };
154 182
155 enet0: ethernet@24000 { 183 enet0: ethernet@24000 {
@@ -161,6 +189,7 @@
161 local-mac-address = [ 00 00 00 00 00 00 ]; 189 local-mac-address = [ 00 00 00 00 00 00 ];
162 interrupts = <29 2 30 2 34 2>; 190 interrupts = <29 2 30 2 34 2>;
163 interrupt-parent = <&mpic>; 191 interrupt-parent = <&mpic>;
192 tbi-handle = <&tbi0>;
164 phy-handle = <&phy0>; 193 phy-handle = <&phy0>;
165 }; 194 };
166 195
@@ -173,6 +202,7 @@
173 local-mac-address = [ 00 00 00 00 00 00 ]; 202 local-mac-address = [ 00 00 00 00 00 00 ];
174 interrupts = <35 2 36 2 40 2>; 203 interrupts = <35 2 36 2 40 2>;
175 interrupt-parent = <&mpic>; 204 interrupt-parent = <&mpic>;
205 tbi-handle = <&tbi1>;
176 phy-handle = <&phy1>; 206 phy-handle = <&phy1>;
177 }; 207 };
178 208
@@ -185,6 +215,7 @@
185 local-mac-address = [ 00 00 00 00 00 00 ]; 215 local-mac-address = [ 00 00 00 00 00 00 ];
186 interrupts = <41 2>; 216 interrupts = <41 2>;
187 interrupt-parent = <&mpic>; 217 interrupt-parent = <&mpic>;
218 tbi-handle = <&tbi2>;
188 phy-handle = <&phy3>; 219 phy-handle = <&phy3>;
189 }; 220 };
190 221
diff --git a/arch/powerpc/boot/dts/mpc8541cds.dts b/arch/powerpc/boot/dts/mpc8541cds.dts
index 6480f4fd96e0..221036a8ce23 100644
--- a/arch/powerpc/boot/dts/mpc8541cds.dts
+++ b/arch/powerpc/boot/dts/mpc8541cds.dts
@@ -144,6 +144,22 @@
144 reg = <0x1>; 144 reg = <0x1>;
145 device_type = "ethernet-phy"; 145 device_type = "ethernet-phy";
146 }; 146 };
147 tbi0: tbi-phy@11 {
148 reg = <0x11>;
149 device_type = "tbi-phy";
150 };
151 };
152
153 mdio@25520 {
154 #address-cells = <1>;
155 #size-cells = <0>;
156 compatible = "fsl,gianfar-tbi";
157 reg = <0x25520 0x20>;
158
159 tbi1: tbi-phy@11 {
160 reg = <0x11>;
161 device_type = "tbi-phy";
162 };
147 }; 163 };
148 164
149 enet0: ethernet@24000 { 165 enet0: ethernet@24000 {
@@ -155,6 +171,7 @@
155 local-mac-address = [ 00 00 00 00 00 00 ]; 171 local-mac-address = [ 00 00 00 00 00 00 ];
156 interrupts = <29 2 30 2 34 2>; 172 interrupts = <29 2 30 2 34 2>;
157 interrupt-parent = <&mpic>; 173 interrupt-parent = <&mpic>;
174 tbi-handle = <&tbi0>;
158 phy-handle = <&phy0>; 175 phy-handle = <&phy0>;
159 }; 176 };
160 177
@@ -167,6 +184,7 @@
167 local-mac-address = [ 00 00 00 00 00 00 ]; 184 local-mac-address = [ 00 00 00 00 00 00 ];
168 interrupts = <35 2 36 2 40 2>; 185 interrupts = <35 2 36 2 40 2>;
169 interrupt-parent = <&mpic>; 186 interrupt-parent = <&mpic>;
187 tbi-handle = <&tbi1>;
170 phy-handle = <&phy1>; 188 phy-handle = <&phy1>;
171 }; 189 };
172 190
diff --git a/arch/powerpc/boot/dts/mpc8544ds.dts b/arch/powerpc/boot/dts/mpc8544ds.dts
index f1fb20737e3e..b9da42105066 100644
--- a/arch/powerpc/boot/dts/mpc8544ds.dts
+++ b/arch/powerpc/boot/dts/mpc8544ds.dts
@@ -116,8 +116,26 @@
116 reg = <0x1>; 116 reg = <0x1>;
117 device_type = "ethernet-phy"; 117 device_type = "ethernet-phy";
118 }; 118 };
119
120 tbi0: tbi-phy@11 {
121 reg = <0x11>;
122 device_type = "tbi-phy";
123 };
119 }; 124 };
120 125
126 mdio@26520 {
127 #address-cells = <1>;
128 #size-cells = <0>;
129 compatible = "fsl,gianfar-tbi";
130 reg = <0x26520 0x20>;
131
132 tbi1: tbi-phy@11 {
133 reg = <0x11>;
134 device_type = "tbi-phy";
135 };
136 };
137
138
121 dma@21300 { 139 dma@21300 {
122 #address-cells = <1>; 140 #address-cells = <1>;
123 #size-cells = <1>; 141 #size-cells = <1>;
@@ -169,6 +187,7 @@
169 interrupts = <29 2 30 2 34 2>; 187 interrupts = <29 2 30 2 34 2>;
170 interrupt-parent = <&mpic>; 188 interrupt-parent = <&mpic>;
171 phy-handle = <&phy0>; 189 phy-handle = <&phy0>;
190 tbi-handle = <&tbi0>;
172 phy-connection-type = "rgmii-id"; 191 phy-connection-type = "rgmii-id";
173 }; 192 };
174 193
@@ -182,6 +201,7 @@
182 interrupts = <31 2 32 2 33 2>; 201 interrupts = <31 2 32 2 33 2>;
183 interrupt-parent = <&mpic>; 202 interrupt-parent = <&mpic>;
184 phy-handle = <&phy1>; 203 phy-handle = <&phy1>;
204 tbi-handle = <&tbi1>;
185 phy-connection-type = "rgmii-id"; 205 phy-connection-type = "rgmii-id";
186 }; 206 };
187 207
diff --git a/arch/powerpc/boot/dts/mpc8548cds.dts b/arch/powerpc/boot/dts/mpc8548cds.dts
index 431b496270dc..df774a7088ff 100644
--- a/arch/powerpc/boot/dts/mpc8548cds.dts
+++ b/arch/powerpc/boot/dts/mpc8548cds.dts
@@ -172,6 +172,46 @@
172 reg = <0x3>; 172 reg = <0x3>;
173 device_type = "ethernet-phy"; 173 device_type = "ethernet-phy";
174 }; 174 };
175 tbi0: tbi-phy@11 {
176 reg = <0x11>;
177 device_type = "tbi-phy";
178 };
179 };
180
181 mdio@25520 {
182 #address-cells = <1>;
183 #size-cells = <0>;
184 compatible = "fsl,gianfar-tbi";
185 reg = <0x25520 0x20>;
186
187 tbi1: tbi-phy@11 {
188 reg = <0x11>;
189 device_type = "tbi-phy";
190 };
191 };
192
193 mdio@26520 {
194 #address-cells = <1>;
195 #size-cells = <0>;
196 compatible = "fsl,gianfar-tbi";
197 reg = <0x26520 0x20>;
198
199 tbi2: tbi-phy@11 {
200 reg = <0x11>;
201 device_type = "tbi-phy";
202 };
203 };
204
205 mdio@27520 {
206 #address-cells = <1>;
207 #size-cells = <0>;
208 compatible = "fsl,gianfar-tbi";
209 reg = <0x27520 0x20>;
210
211 tbi3: tbi-phy@11 {
212 reg = <0x11>;
213 device_type = "tbi-phy";
214 };
175 }; 215 };
176 216
177 enet0: ethernet@24000 { 217 enet0: ethernet@24000 {
@@ -183,6 +223,7 @@
183 local-mac-address = [ 00 00 00 00 00 00 ]; 223 local-mac-address = [ 00 00 00 00 00 00 ];
184 interrupts = <29 2 30 2 34 2>; 224 interrupts = <29 2 30 2 34 2>;
185 interrupt-parent = <&mpic>; 225 interrupt-parent = <&mpic>;
226 tbi-handle = <&tbi0>;
186 phy-handle = <&phy0>; 227 phy-handle = <&phy0>;
187 }; 228 };
188 229
@@ -195,6 +236,7 @@
195 local-mac-address = [ 00 00 00 00 00 00 ]; 236 local-mac-address = [ 00 00 00 00 00 00 ];
196 interrupts = <35 2 36 2 40 2>; 237 interrupts = <35 2 36 2 40 2>;
197 interrupt-parent = <&mpic>; 238 interrupt-parent = <&mpic>;
239 tbi-handle = <&tbi1>;
198 phy-handle = <&phy1>; 240 phy-handle = <&phy1>;
199 }; 241 };
200 242
@@ -208,6 +250,7 @@
208 local-mac-address = [ 00 00 00 00 00 00 ]; 250 local-mac-address = [ 00 00 00 00 00 00 ];
209 interrupts = <31 2 32 2 33 2>; 251 interrupts = <31 2 32 2 33 2>;
210 interrupt-parent = <&mpic>; 252 interrupt-parent = <&mpic>;
253 tbi-handle = <&tbi2>;
211 phy-handle = <&phy2>; 254 phy-handle = <&phy2>;
212 }; 255 };
213 256
@@ -220,6 +263,7 @@
220 local-mac-address = [ 00 00 00 00 00 00 ]; 263 local-mac-address = [ 00 00 00 00 00 00 ];
221 interrupts = <37 2 38 2 39 2>; 264 interrupts = <37 2 38 2 39 2>;
222 interrupt-parent = <&mpic>; 265 interrupt-parent = <&mpic>;
266 tbi-handle = <&tbi3>;
223 phy-handle = <&phy3>; 267 phy-handle = <&phy3>;
224 }; 268 };
225 */ 269 */
diff --git a/arch/powerpc/boot/dts/mpc8555cds.dts b/arch/powerpc/boot/dts/mpc8555cds.dts
index d833a5c4f476..053b01e1c93b 100644
--- a/arch/powerpc/boot/dts/mpc8555cds.dts
+++ b/arch/powerpc/boot/dts/mpc8555cds.dts
@@ -144,6 +144,22 @@
144 reg = <0x1>; 144 reg = <0x1>;
145 device_type = "ethernet-phy"; 145 device_type = "ethernet-phy";
146 }; 146 };
147 tbi0: tbi-phy@11 {
148 reg = <0x11>;
149 device_type = "tbi-phy";
150 };
151 };
152
153 mdio@25520 {
154 #address-cells = <1>;
155 #size-cells = <0>;
156 compatible = "fsl,gianfar-tbi";
157 reg = <0x25520 0x20>;
158
159 tbi1: tbi-phy@11 {
160 reg = <0x11>;
161 device_type = "tbi-phy";
162 };
147 }; 163 };
148 164
149 enet0: ethernet@24000 { 165 enet0: ethernet@24000 {
@@ -155,6 +171,7 @@
155 local-mac-address = [ 00 00 00 00 00 00 ]; 171 local-mac-address = [ 00 00 00 00 00 00 ];
156 interrupts = <29 2 30 2 34 2>; 172 interrupts = <29 2 30 2 34 2>;
157 interrupt-parent = <&mpic>; 173 interrupt-parent = <&mpic>;
174 tbi-handle = <&tbi0>;
158 phy-handle = <&phy0>; 175 phy-handle = <&phy0>;
159 }; 176 };
160 177
@@ -167,6 +184,7 @@
167 local-mac-address = [ 00 00 00 00 00 00 ]; 184 local-mac-address = [ 00 00 00 00 00 00 ];
168 interrupts = <35 2 36 2 40 2>; 185 interrupts = <35 2 36 2 40 2>;
169 interrupt-parent = <&mpic>; 186 interrupt-parent = <&mpic>;
187 tbi-handle = <&tbi1>;
170 phy-handle = <&phy1>; 188 phy-handle = <&phy1>;
171 }; 189 };
172 190
diff --git a/arch/powerpc/boot/dts/mpc8560ads.dts b/arch/powerpc/boot/dts/mpc8560ads.dts
index 4d1f2f284094..11b1bcbe14ce 100644
--- a/arch/powerpc/boot/dts/mpc8560ads.dts
+++ b/arch/powerpc/boot/dts/mpc8560ads.dts
@@ -145,6 +145,22 @@
145 reg = <0x3>; 145 reg = <0x3>;
146 device_type = "ethernet-phy"; 146 device_type = "ethernet-phy";
147 }; 147 };
148 tbi0: tbi-phy@11 {
149 reg = <0x11>;
150 device_type = "tbi-phy";
151 };
152 };
153
154 mdio@25520 {
155 #address-cells = <1>;
156 #size-cells = <0>;
157 compatible = "fsl,gianfar-tbi";
158 reg = <0x25520 0x20>;
159
160 tbi1: tbi-phy@11 {
161 reg = <0x11>;
162 device_type = "tbi-phy";
163 };
148 }; 164 };
149 165
150 enet0: ethernet@24000 { 166 enet0: ethernet@24000 {
@@ -156,6 +172,7 @@
156 local-mac-address = [ 00 00 00 00 00 00 ]; 172 local-mac-address = [ 00 00 00 00 00 00 ];
157 interrupts = <29 2 30 2 34 2>; 173 interrupts = <29 2 30 2 34 2>;
158 interrupt-parent = <&mpic>; 174 interrupt-parent = <&mpic>;
175 tbi-handle = <&tbi0>;
159 phy-handle = <&phy0>; 176 phy-handle = <&phy0>;
160 }; 177 };
161 178
@@ -168,6 +185,7 @@
168 local-mac-address = [ 00 00 00 00 00 00 ]; 185 local-mac-address = [ 00 00 00 00 00 00 ];
169 interrupts = <35 2 36 2 40 2>; 186 interrupts = <35 2 36 2 40 2>;
170 interrupt-parent = <&mpic>; 187 interrupt-parent = <&mpic>;
188 tbi-handle = <&tbi1>;
171 phy-handle = <&phy1>; 189 phy-handle = <&phy1>;
172 }; 190 };
173 191
diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts
index c80158f7741d..1955bd9e113d 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -179,6 +179,22 @@
179 reg = <0x3>; 179 reg = <0x3>;
180 device_type = "ethernet-phy"; 180 device_type = "ethernet-phy";
181 }; 181 };
182 tbi0: tbi-phy@11 {
183 reg = <0x11>;
184 device_type = "tbi-phy";
185 };
186 };
187
188 mdio@25520 {
189 #address-cells = <1>;
190 #size-cells = <0>;
191 compatible = "fsl,gianfar-tbi";
192 reg = <0x25520 0x20>;
193
194 tbi1: tbi-phy@11 {
195 reg = <0x11>;
196 device_type = "tbi-phy";
197 };
182 }; 198 };
183 199
184 enet0: ethernet@24000 { 200 enet0: ethernet@24000 {
@@ -190,6 +206,7 @@
190 local-mac-address = [ 00 00 00 00 00 00 ]; 206 local-mac-address = [ 00 00 00 00 00 00 ];
191 interrupts = <29 2 30 2 34 2>; 207 interrupts = <29 2 30 2 34 2>;
192 interrupt-parent = <&mpic>; 208 interrupt-parent = <&mpic>;
209 tbi-handle = <&tbi0>;
193 phy-handle = <&phy2>; 210 phy-handle = <&phy2>;
194 }; 211 };
195 212
@@ -202,6 +219,7 @@
202 local-mac-address = [ 00 00 00 00 00 00 ]; 219 local-mac-address = [ 00 00 00 00 00 00 ];
203 interrupts = <35 2 36 2 40 2>; 220 interrupts = <35 2 36 2 40 2>;
204 interrupt-parent = <&mpic>; 221 interrupt-parent = <&mpic>;
222 tbi-handle = <&tbi1>;
205 phy-handle = <&phy3>; 223 phy-handle = <&phy3>;
206 }; 224 };
207 225
diff --git a/arch/powerpc/boot/dts/mpc8572ds.dts b/arch/powerpc/boot/dts/mpc8572ds.dts
index 5c69b2fafd32..21459e161d02 100644
--- a/arch/powerpc/boot/dts/mpc8572ds.dts
+++ b/arch/powerpc/boot/dts/mpc8572ds.dts
@@ -63,6 +63,119 @@
63 device_type = "memory"; 63 device_type = "memory";
64 }; 64 };
65 65
66 localbus@ffe05000 {
67 #address-cells = <2>;
68 #size-cells = <1>;
69 compatible = "fsl,mpc8572-elbc", "fsl,elbc", "simple-bus";
70 reg = <0 0xffe05000 0 0x1000>;
71 interrupts = <19 2>;
72 interrupt-parent = <&mpic>;
73
74 ranges = <0x0 0x0 0x0 0xe8000000 0x08000000
75 0x1 0x0 0x0 0xe0000000 0x08000000
76 0x2 0x0 0x0 0xffa00000 0x00040000
77 0x3 0x0 0x0 0xffdf0000 0x00008000
78 0x4 0x0 0x0 0xffa40000 0x00040000
79 0x5 0x0 0x0 0xffa80000 0x00040000
80 0x6 0x0 0x0 0xffac0000 0x00040000>;
81
82 nor@0,0 {
83 #address-cells = <1>;
84 #size-cells = <1>;
85 compatible = "cfi-flash";
86 reg = <0x0 0x0 0x8000000>;
87 bank-width = <2>;
88 device-width = <1>;
89
90 ramdisk@0 {
91 reg = <0x0 0x03000000>;
92 readl-only;
93 };
94
95 diagnostic@3000000 {
96 reg = <0x03000000 0x00e00000>;
97 read-only;
98 };
99
100 dink@3e00000 {
101 reg = <0x03e00000 0x00200000>;
102 read-only;
103 };
104
105 kernel@4000000 {
106 reg = <0x04000000 0x00400000>;
107 read-only;
108 };
109
110 jffs2@4400000 {
111 reg = <0x04400000 0x03b00000>;
112 };
113
114 dtb@7f00000 {
115 reg = <0x07f00000 0x00080000>;
116 read-only;
117 };
118
119 u-boot@7f80000 {
120 reg = <0x07f80000 0x00080000>;
121 read-only;
122 };
123 };
124
125 nand@2,0 {
126 #address-cells = <1>;
127 #size-cells = <1>;
128 compatible = "fsl,mpc8572-fcm-nand",
129 "fsl,elbc-fcm-nand";
130 reg = <0x2 0x0 0x40000>;
131
132 u-boot@0 {
133 reg = <0x0 0x02000000>;
134 read-only;
135 };
136
137 jffs2@2000000 {
138 reg = <0x02000000 0x10000000>;
139 };
140
141 ramdisk@12000000 {
142 reg = <0x12000000 0x08000000>;
143 read-only;
144 };
145
146 kernel@1a000000 {
147 reg = <0x1a000000 0x04000000>;
148 };
149
150 dtb@1e000000 {
151 reg = <0x1e000000 0x01000000>;
152 read-only;
153 };
154
155 empty@1f000000 {
156 reg = <0x1f000000 0x21000000>;
157 };
158 };
159
160 nand@4,0 {
161 compatible = "fsl,mpc8572-fcm-nand",
162 "fsl,elbc-fcm-nand";
163 reg = <0x4 0x0 0x40000>;
164 };
165
166 nand@5,0 {
167 compatible = "fsl,mpc8572-fcm-nand",
168 "fsl,elbc-fcm-nand";
169 reg = <0x5 0x0 0x40000>;
170 };
171
172 nand@6,0 {
173 compatible = "fsl,mpc8572-fcm-nand",
174 "fsl,elbc-fcm-nand";
175 reg = <0x6 0x0 0x40000>;
176 };
177 };
178
66 soc8572@ffe00000 { 179 soc8572@ffe00000 {
67 #address-cells = <1>; 180 #address-cells = <1>;
68 #size-cells = <1>; 181 #size-cells = <1>;
@@ -225,6 +338,47 @@
225 interrupts = <10 1>; 338 interrupts = <10 1>;
226 reg = <0x3>; 339 reg = <0x3>;
227 }; 340 };
341
342 tbi0: tbi-phy@11 {
343 reg = <0x11>;
344 device_type = "tbi-phy";
345 };
346 };
347
348 mdio@25520 {
349 #address-cells = <1>;
350 #size-cells = <0>;
351 compatible = "fsl,gianfar-tbi";
352 reg = <0x25520 0x20>;
353
354 tbi1: tbi-phy@11 {
355 reg = <0x11>;
356 device_type = "tbi-phy";
357 };
358 };
359
360 mdio@26520 {
361 #address-cells = <1>;
362 #size-cells = <0>;
363 compatible = "fsl,gianfar-tbi";
364 reg = <0x26520 0x20>;
365
366 tbi2: tbi-phy@11 {
367 reg = <0x11>;
368 device_type = "tbi-phy";
369 };
370 };
371
372 mdio@27520 {
373 #address-cells = <1>;
374 #size-cells = <0>;
375 compatible = "fsl,gianfar-tbi";
376 reg = <0x27520 0x20>;
377
378 tbi3: tbi-phy@11 {
379 reg = <0x11>;
380 device_type = "tbi-phy";
381 };
228 }; 382 };
229 383
230 enet0: ethernet@24000 { 384 enet0: ethernet@24000 {
@@ -236,6 +390,7 @@
236 local-mac-address = [ 00 00 00 00 00 00 ]; 390 local-mac-address = [ 00 00 00 00 00 00 ];
237 interrupts = <29 2 30 2 34 2>; 391 interrupts = <29 2 30 2 34 2>;
238 interrupt-parent = <&mpic>; 392 interrupt-parent = <&mpic>;
393 tbi-handle = <&tbi0>;
239 phy-handle = <&phy0>; 394 phy-handle = <&phy0>;
240 phy-connection-type = "rgmii-id"; 395 phy-connection-type = "rgmii-id";
241 }; 396 };
@@ -249,6 +404,7 @@
249 local-mac-address = [ 00 00 00 00 00 00 ]; 404 local-mac-address = [ 00 00 00 00 00 00 ];
250 interrupts = <35 2 36 2 40 2>; 405 interrupts = <35 2 36 2 40 2>;
251 interrupt-parent = <&mpic>; 406 interrupt-parent = <&mpic>;
407 tbi-handle = <&tbi1>;
252 phy-handle = <&phy1>; 408 phy-handle = <&phy1>;
253 phy-connection-type = "rgmii-id"; 409 phy-connection-type = "rgmii-id";
254 }; 410 };
@@ -262,6 +418,7 @@
262 local-mac-address = [ 00 00 00 00 00 00 ]; 418 local-mac-address = [ 00 00 00 00 00 00 ];
263 interrupts = <31 2 32 2 33 2>; 419 interrupts = <31 2 32 2 33 2>;
264 interrupt-parent = <&mpic>; 420 interrupt-parent = <&mpic>;
421 tbi-handle = <&tbi2>;
265 phy-handle = <&phy2>; 422 phy-handle = <&phy2>;
266 phy-connection-type = "rgmii-id"; 423 phy-connection-type = "rgmii-id";
267 }; 424 };
@@ -275,6 +432,7 @@
275 local-mac-address = [ 00 00 00 00 00 00 ]; 432 local-mac-address = [ 00 00 00 00 00 00 ];
276 interrupts = <37 2 38 2 39 2>; 433 interrupts = <37 2 38 2 39 2>;
277 interrupt-parent = <&mpic>; 434 interrupt-parent = <&mpic>;
435 tbi-handle = <&tbi3>;
278 phy-handle = <&phy3>; 436 phy-handle = <&phy3>;
279 phy-connection-type = "rgmii-id"; 437 phy-connection-type = "rgmii-id";
280 }; 438 };
diff --git a/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts b/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts
new file mode 100644
index 000000000000..c114c4ee9931
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts
@@ -0,0 +1,483 @@
1/*
2 * MPC8572 DS Core0 Device Tree Source in CAMP mode.
3 *
4 * In CAMP mode, each core needs to have its own dts. Only mpic and L2 cache
5 * can be shared, all the other devices must be assigned to one core only.
6 * This dts file allows core0 to have memory, l2, i2c, dma1, global-util, eth0,
7 * eth1, crypto, pci0, pci1.
8 *
9 * Copyright 2007, 2008 Freescale Semiconductor Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 */
16
17/dts-v1/;
18/ {
19 model = "fsl,MPC8572DS";
20 compatible = "fsl,MPC8572DS", "fsl,MPC8572DS-CAMP";
21 #address-cells = <1>;
22 #size-cells = <1>;
23
24 aliases {
25 ethernet0 = &enet0;
26 ethernet1 = &enet1;
27 serial0 = &serial0;
28 pci0 = &pci0;
29 pci1 = &pci1;
30 };
31
32 cpus {
33 #address-cells = <1>;
34 #size-cells = <0>;
35
36 PowerPC,8572@0 {
37 device_type = "cpu";
38 reg = <0x0>;
39 d-cache-line-size = <32>; // 32 bytes
40 i-cache-line-size = <32>; // 32 bytes
41 d-cache-size = <0x8000>; // L1, 32K
42 i-cache-size = <0x8000>; // L1, 32K
43 timebase-frequency = <0>;
44 bus-frequency = <0>;
45 clock-frequency = <0>;
46 next-level-cache = <&L2>;
47 };
48
49 };
50
51 memory {
52 device_type = "memory";
53 reg = <0x0 0x0>; // Filled by U-Boot
54 };
55
56 soc8572@ffe00000 {
57 #address-cells = <1>;
58 #size-cells = <1>;
59 device_type = "soc";
60 compatible = "simple-bus";
61 ranges = <0x0 0xffe00000 0x100000>;
62 reg = <0xffe00000 0x1000>; // CCSRBAR & soc regs, remove once parse code for immrbase fixed
63 bus-frequency = <0>; // Filled out by uboot.
64
65 memory-controller@2000 {
66 compatible = "fsl,mpc8572-memory-controller";
67 reg = <0x2000 0x1000>;
68 interrupt-parent = <&mpic>;
69 interrupts = <18 2>;
70 };
71
72 memory-controller@6000 {
73 compatible = "fsl,mpc8572-memory-controller";
74 reg = <0x6000 0x1000>;
75 interrupt-parent = <&mpic>;
76 interrupts = <18 2>;
77 };
78
79 L2: l2-cache-controller@20000 {
80 compatible = "fsl,mpc8572-l2-cache-controller";
81 reg = <0x20000 0x1000>;
82 cache-line-size = <32>; // 32 bytes
83 cache-size = <0x80000>; // L2, 512K
84 interrupt-parent = <&mpic>;
85 interrupts = <16 2>;
86 };
87
88 i2c@3000 {
89 #address-cells = <1>;
90 #size-cells = <0>;
91 cell-index = <0>;
92 compatible = "fsl-i2c";
93 reg = <0x3000 0x100>;
94 interrupts = <43 2>;
95 interrupt-parent = <&mpic>;
96 dfsrr;
97 };
98
99 i2c@3100 {
100 #address-cells = <1>;
101 #size-cells = <0>;
102 cell-index = <1>;
103 compatible = "fsl-i2c";
104 reg = <0x3100 0x100>;
105 interrupts = <43 2>;
106 interrupt-parent = <&mpic>;
107 dfsrr;
108 };
109
110 dma@21300 {
111 #address-cells = <1>;
112 #size-cells = <1>;
113 compatible = "fsl,mpc8572-dma", "fsl,eloplus-dma";
114 reg = <0x21300 0x4>;
115 ranges = <0x0 0x21100 0x200>;
116 cell-index = <0>;
117 dma-channel@0 {
118 compatible = "fsl,mpc8572-dma-channel",
119 "fsl,eloplus-dma-channel";
120 reg = <0x0 0x80>;
121 cell-index = <0>;
122 interrupt-parent = <&mpic>;
123 interrupts = <20 2>;
124 };
125 dma-channel@80 {
126 compatible = "fsl,mpc8572-dma-channel",
127 "fsl,eloplus-dma-channel";
128 reg = <0x80 0x80>;
129 cell-index = <1>;
130 interrupt-parent = <&mpic>;
131 interrupts = <21 2>;
132 };
133 dma-channel@100 {
134 compatible = "fsl,mpc8572-dma-channel",
135 "fsl,eloplus-dma-channel";
136 reg = <0x100 0x80>;
137 cell-index = <2>;
138 interrupt-parent = <&mpic>;
139 interrupts = <22 2>;
140 };
141 dma-channel@180 {
142 compatible = "fsl,mpc8572-dma-channel",
143 "fsl,eloplus-dma-channel";
144 reg = <0x180 0x80>;
145 cell-index = <3>;
146 interrupt-parent = <&mpic>;
147 interrupts = <23 2>;
148 };
149 };
150
151 mdio@24520 {
152 #address-cells = <1>;
153 #size-cells = <0>;
154 compatible = "fsl,gianfar-mdio";
155 reg = <0x24520 0x20>;
156
157 phy0: ethernet-phy@0 {
158 interrupt-parent = <&mpic>;
159 interrupts = <10 1>;
160 reg = <0x0>;
161 };
162 phy1: ethernet-phy@1 {
163 interrupt-parent = <&mpic>;
164 interrupts = <10 1>;
165 reg = <0x1>;
166 };
167 };
168
169 enet0: ethernet@24000 {
170 cell-index = <0>;
171 device_type = "network";
172 model = "eTSEC";
173 compatible = "gianfar";
174 reg = <0x24000 0x1000>;
175 local-mac-address = [ 00 00 00 00 00 00 ];
176 interrupts = <29 2 30 2 34 2>;
177 interrupt-parent = <&mpic>;
178 phy-handle = <&phy0>;
179 phy-connection-type = "rgmii-id";
180 };
181
182 enet1: ethernet@25000 {
183 cell-index = <1>;
184 device_type = "network";
185 model = "eTSEC";
186 compatible = "gianfar";
187 reg = <0x25000 0x1000>;
188 local-mac-address = [ 00 00 00 00 00 00 ];
189 interrupts = <35 2 36 2 40 2>;
190 interrupt-parent = <&mpic>;
191 phy-handle = <&phy1>;
192 phy-connection-type = "rgmii-id";
193 };
194
195 serial0: serial@4500 {
196 cell-index = <0>;
197 device_type = "serial";
198 compatible = "ns16550";
199 reg = <0x4500 0x100>;
200 clock-frequency = <0>;
201 };
202
203 global-utilities@e0000 { //global utilities block
204 compatible = "fsl,mpc8572-guts";
205 reg = <0xe0000 0x1000>;
206 fsl,has-rstcr;
207 };
208
209 crypto@30000 {
210 compatible = "fsl,sec3.0", "fsl,sec2.4", "fsl,sec2.2",
211 "fsl,sec2.1", "fsl,sec2.0";
212 reg = <0x30000 0x10000>;
213 interrupts = <45 2 58 2>;
214 interrupt-parent = <&mpic>;
215 fsl,num-channels = <4>;
216 fsl,channel-fifo-len = <24>;
217 fsl,exec-units-mask = <0x9fe>;
218 fsl,descriptor-types-mask = <0x3ab0ebf>;
219 };
220
221 mpic: pic@40000 {
222 interrupt-controller;
223 #address-cells = <0>;
224 #interrupt-cells = <2>;
225 reg = <0x40000 0x40000>;
226 compatible = "chrp,open-pic";
227 device_type = "open-pic";
228 protected-sources = <
229 31 32 33 37 38 39 /* enet2 enet3 */
230 76 77 78 79 27 42 /* dma2 pci2 serial*/
231 0xe0 0xe1 0xe2 0xe3 /* msi */
232 0xe4 0xe5 0xe6 0xe7
233 >;
234 };
235 };
236
237 pci0: pcie@ffe08000 {
238 cell-index = <0>;
239 compatible = "fsl,mpc8548-pcie";
240 device_type = "pci";
241 #interrupt-cells = <1>;
242 #size-cells = <2>;
243 #address-cells = <3>;
244 reg = <0xffe08000 0x1000>;
245 bus-range = <0 255>;
246 ranges = <0x2000000 0x0 0x80000000 0x80000000 0x0 0x20000000
247 0x1000000 0x0 0x0 0xffc00000 0x0 0x10000>;
248 clock-frequency = <33333333>;
249 interrupt-parent = <&mpic>;
250 interrupts = <24 2>;
251 interrupt-map-mask = <0xff00 0x0 0x0 0x7>;
252 interrupt-map = <
253 /* IDSEL 0x11 func 0 - PCI slot 1 */
254 0x8800 0x0 0x0 0x1 &mpic 0x2 0x1
255 0x8800 0x0 0x0 0x2 &mpic 0x3 0x1
256 0x8800 0x0 0x0 0x3 &mpic 0x4 0x1
257 0x8800 0x0 0x0 0x4 &mpic 0x1 0x1
258
259 /* IDSEL 0x11 func 1 - PCI slot 1 */
260 0x8900 0x0 0x0 0x1 &mpic 0x2 0x1
261 0x8900 0x0 0x0 0x2 &mpic 0x3 0x1
262 0x8900 0x0 0x0 0x3 &mpic 0x4 0x1
263 0x8900 0x0 0x0 0x4 &mpic 0x1 0x1
264
265 /* IDSEL 0x11 func 2 - PCI slot 1 */
266 0x8a00 0x0 0x0 0x1 &mpic 0x2 0x1
267 0x8a00 0x0 0x0 0x2 &mpic 0x3 0x1
268 0x8a00 0x0 0x0 0x3 &mpic 0x4 0x1
269 0x8a00 0x0 0x0 0x4 &mpic 0x1 0x1
270
271 /* IDSEL 0x11 func 3 - PCI slot 1 */
272 0x8b00 0x0 0x0 0x1 &mpic 0x2 0x1
273 0x8b00 0x0 0x0 0x2 &mpic 0x3 0x1
274 0x8b00 0x0 0x0 0x3 &mpic 0x4 0x1
275 0x8b00 0x0 0x0 0x4 &mpic 0x1 0x1
276
277 /* IDSEL 0x11 func 4 - PCI slot 1 */
278 0x8c00 0x0 0x0 0x1 &mpic 0x2 0x1
279 0x8c00 0x0 0x0 0x2 &mpic 0x3 0x1
280 0x8c00 0x0 0x0 0x3 &mpic 0x4 0x1
281 0x8c00 0x0 0x0 0x4 &mpic 0x1 0x1
282
283 /* IDSEL 0x11 func 5 - PCI slot 1 */
284 0x8d00 0x0 0x0 0x1 &mpic 0x2 0x1
285 0x8d00 0x0 0x0 0x2 &mpic 0x3 0x1
286 0x8d00 0x0 0x0 0x3 &mpic 0x4 0x1
287 0x8d00 0x0 0x0 0x4 &mpic 0x1 0x1
288
289 /* IDSEL 0x11 func 6 - PCI slot 1 */
290 0x8e00 0x0 0x0 0x1 &mpic 0x2 0x1
291 0x8e00 0x0 0x0 0x2 &mpic 0x3 0x1
292 0x8e00 0x0 0x0 0x3 &mpic 0x4 0x1
293 0x8e00 0x0 0x0 0x4 &mpic 0x1 0x1
294
295 /* IDSEL 0x11 func 7 - PCI slot 1 */
296 0x8f00 0x0 0x0 0x1 &mpic 0x2 0x1
297 0x8f00 0x0 0x0 0x2 &mpic 0x3 0x1
298 0x8f00 0x0 0x0 0x3 &mpic 0x4 0x1
299 0x8f00 0x0 0x0 0x4 &mpic 0x1 0x1
300
301 /* IDSEL 0x12 func 0 - PCI slot 2 */
302 0x9000 0x0 0x0 0x1 &mpic 0x3 0x1
303 0x9000 0x0 0x0 0x2 &mpic 0x4 0x1
304 0x9000 0x0 0x0 0x3 &mpic 0x1 0x1
305 0x9000 0x0 0x0 0x4 &mpic 0x2 0x1
306
307 /* IDSEL 0x12 func 1 - PCI slot 2 */
308 0x9100 0x0 0x0 0x1 &mpic 0x3 0x1
309 0x9100 0x0 0x0 0x2 &mpic 0x4 0x1
310 0x9100 0x0 0x0 0x3 &mpic 0x1 0x1
311 0x9100 0x0 0x0 0x4 &mpic 0x2 0x1
312
313 /* IDSEL 0x12 func 2 - PCI slot 2 */
314 0x9200 0x0 0x0 0x1 &mpic 0x3 0x1
315 0x9200 0x0 0x0 0x2 &mpic 0x4 0x1
316 0x9200 0x0 0x0 0x3 &mpic 0x1 0x1
317 0x9200 0x0 0x0 0x4 &mpic 0x2 0x1
318
319 /* IDSEL 0x12 func 3 - PCI slot 2 */
320 0x9300 0x0 0x0 0x1 &mpic 0x3 0x1
321 0x9300 0x0 0x0 0x2 &mpic 0x4 0x1
322 0x9300 0x0 0x0 0x3 &mpic 0x1 0x1
323 0x9300 0x0 0x0 0x4 &mpic 0x2 0x1
324
325 /* IDSEL 0x12 func 4 - PCI slot 2 */
326 0x9400 0x0 0x0 0x1 &mpic 0x3 0x1
327 0x9400 0x0 0x0 0x2 &mpic 0x4 0x1
328 0x9400 0x0 0x0 0x3 &mpic 0x1 0x1
329 0x9400 0x0 0x0 0x4 &mpic 0x2 0x1
330
331 /* IDSEL 0x12 func 5 - PCI slot 2 */
332 0x9500 0x0 0x0 0x1 &mpic 0x3 0x1
333 0x9500 0x0 0x0 0x2 &mpic 0x4 0x1
334 0x9500 0x0 0x0 0x3 &mpic 0x1 0x1
335 0x9500 0x0 0x0 0x4 &mpic 0x2 0x1
336
337 /* IDSEL 0x12 func 6 - PCI slot 2 */
338 0x9600 0x0 0x0 0x1 &mpic 0x3 0x1
339 0x9600 0x0 0x0 0x2 &mpic 0x4 0x1
340 0x9600 0x0 0x0 0x3 &mpic 0x1 0x1
341 0x9600 0x0 0x0 0x4 &mpic 0x2 0x1
342
343 /* IDSEL 0x12 func 7 - PCI slot 2 */
344 0x9700 0x0 0x0 0x1 &mpic 0x3 0x1
345 0x9700 0x0 0x0 0x2 &mpic 0x4 0x1
346 0x9700 0x0 0x0 0x3 &mpic 0x1 0x1
347 0x9700 0x0 0x0 0x4 &mpic 0x2 0x1
348
349 // IDSEL 0x1c USB
350 0xe000 0x0 0x0 0x1 &i8259 0xc 0x2
351 0xe100 0x0 0x0 0x2 &i8259 0x9 0x2
352 0xe200 0x0 0x0 0x3 &i8259 0xa 0x2
353 0xe300 0x0 0x0 0x4 &i8259 0xb 0x2
354
355 // IDSEL 0x1d Audio
356 0xe800 0x0 0x0 0x1 &i8259 0x6 0x2
357
358 // IDSEL 0x1e Legacy
359 0xf000 0x0 0x0 0x1 &i8259 0x7 0x2
360 0xf100 0x0 0x0 0x1 &i8259 0x7 0x2
361
362 // IDSEL 0x1f IDE/SATA
363 0xf800 0x0 0x0 0x1 &i8259 0xe 0x2
364 0xf900 0x0 0x0 0x1 &i8259 0x5 0x2
365
366 >;
367
368 pcie@0 {
369 reg = <0x0 0x0 0x0 0x0 0x0>;
370 #size-cells = <2>;
371 #address-cells = <3>;
372 device_type = "pci";
373 ranges = <0x2000000 0x0 0x80000000
374 0x2000000 0x0 0x80000000
375 0x0 0x20000000
376
377 0x1000000 0x0 0x0
378 0x1000000 0x0 0x0
379 0x0 0x100000>;
380 uli1575@0 {
381 reg = <0x0 0x0 0x0 0x0 0x0>;
382 #size-cells = <2>;
383 #address-cells = <3>;
384 ranges = <0x2000000 0x0 0x80000000
385 0x2000000 0x0 0x80000000
386 0x0 0x20000000
387
388 0x1000000 0x0 0x0
389 0x1000000 0x0 0x0
390 0x0 0x100000>;
391 isa@1e {
392 device_type = "isa";
393 #interrupt-cells = <2>;
394 #size-cells = <1>;
395 #address-cells = <2>;
396 reg = <0xf000 0x0 0x0 0x0 0x0>;
397 ranges = <0x1 0x0 0x1000000 0x0 0x0
398 0x1000>;
399 interrupt-parent = <&i8259>;
400
401 i8259: interrupt-controller@20 {
402 reg = <0x1 0x20 0x2
403 0x1 0xa0 0x2
404 0x1 0x4d0 0x2>;
405 interrupt-controller;
406 device_type = "interrupt-controller";
407 #address-cells = <0>;
408 #interrupt-cells = <2>;
409 compatible = "chrp,iic";
410 interrupts = <9 2>;
411 interrupt-parent = <&mpic>;
412 };
413
414 i8042@60 {
415 #size-cells = <0>;
416 #address-cells = <1>;
417 reg = <0x1 0x60 0x1 0x1 0x64 0x1>;
418 interrupts = <1 3 12 3>;
419 interrupt-parent =
420 <&i8259>;
421
422 keyboard@0 {
423 reg = <0x0>;
424 compatible = "pnpPNP,303";
425 };
426
427 mouse@1 {
428 reg = <0x1>;
429 compatible = "pnpPNP,f03";
430 };
431 };
432
433 rtc@70 {
434 compatible = "pnpPNP,b00";
435 reg = <0x1 0x70 0x2>;
436 };
437
438 gpio@400 {
439 reg = <0x1 0x400 0x80>;
440 };
441 };
442 };
443 };
444
445 };
446
447 pci1: pcie@ffe09000 {
448 cell-index = <1>;
449 compatible = "fsl,mpc8548-pcie";
450 device_type = "pci";
451 #interrupt-cells = <1>;
452 #size-cells = <2>;
453 #address-cells = <3>;
454 reg = <0xffe09000 0x1000>;
455 bus-range = <0 255>;
456 ranges = <0x2000000 0x0 0xa0000000 0xa0000000 0x0 0x20000000
457 0x1000000 0x0 0x0 0xffc10000 0x0 0x10000>;
458 clock-frequency = <33333333>;
459 interrupt-parent = <&mpic>;
460 interrupts = <26 2>;
461 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
462 interrupt-map = <
463 /* IDSEL 0x0 */
464 0000 0x0 0x0 0x1 &mpic 0x4 0x1
465 0000 0x0 0x0 0x2 &mpic 0x5 0x1
466 0000 0x0 0x0 0x3 &mpic 0x6 0x1
467 0000 0x0 0x0 0x4 &mpic 0x7 0x1
468 >;
469 pcie@0 {
470 reg = <0x0 0x0 0x0 0x0 0x0>;
471 #size-cells = <2>;
472 #address-cells = <3>;
473 device_type = "pci";
474 ranges = <0x2000000 0x0 0xa0000000
475 0x2000000 0x0 0xa0000000
476 0x0 0x20000000
477
478 0x1000000 0x0 0x0
479 0x1000000 0x0 0x0
480 0x0 0x100000>;
481 };
482 };
483};
diff --git a/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts b/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts
new file mode 100644
index 000000000000..04ecda18d206
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts
@@ -0,0 +1,234 @@
1/*
2 * MPC8572 DS Core1 Device Tree Source in CAMP mode.
3 *
4 * In CAMP mode, each core needs to have its own dts. Only mpic and L2 cache
5 * can be shared, all the other devices must be assigned to one core only.
6 * This dts allows core1 to have l2, dma2, eth2, eth3, pci2, msi.
7 *
8 * Please note to add "-b 1" for core1's dts compiling.
9 *
10 * Copyright 2007, 2008 Freescale Semiconductor Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17
18/dts-v1/;
19/ {
20 model = "fsl,MPC8572DS";
21 compatible = "fsl,MPC8572DS", "fsl,MPC8572DS-CAMP";
22 #address-cells = <1>;
23 #size-cells = <1>;
24
25 aliases {
26 ethernet2 = &enet2;
27 ethernet3 = &enet3;
28 serial0 = &serial0;
29 pci2 = &pci2;
30 };
31
32 cpus {
33 #address-cells = <1>;
34 #size-cells = <0>;
35
36 PowerPC,8572@1 {
37 device_type = "cpu";
38 reg = <0x1>;
39 d-cache-line-size = <32>; // 32 bytes
40 i-cache-line-size = <32>; // 32 bytes
41 d-cache-size = <0x8000>; // L1, 32K
42 i-cache-size = <0x8000>; // L1, 32K
43 timebase-frequency = <0>;
44 bus-frequency = <0>;
45 clock-frequency = <0>;
46 next-level-cache = <&L2>;
47 };
48 };
49
50 memory {
51 device_type = "memory";
52 reg = <0x0 0x0>; // Filled by U-Boot
53 };
54
55 soc8572@ffe00000 {
56 #address-cells = <1>;
57 #size-cells = <1>;
58 device_type = "soc";
59 compatible = "simple-bus";
60 ranges = <0x0 0xffe00000 0x100000>;
61 reg = <0xffe00000 0x1000>; // CCSRBAR & soc regs, remove once parse code for immrbase fixed
62 bus-frequency = <0>; // Filled out by uboot.
63
64 L2: l2-cache-controller@20000 {
65 compatible = "fsl,mpc8572-l2-cache-controller";
66 reg = <0x20000 0x1000>;
67 cache-line-size = <32>; // 32 bytes
68 cache-size = <0x80000>; // L2, 512K
69 interrupt-parent = <&mpic>;
70 };
71
72 dma@c300 {
73 #address-cells = <1>;
74 #size-cells = <1>;
75 compatible = "fsl,mpc8572-dma", "fsl,eloplus-dma";
76 reg = <0xc300 0x4>;
77 ranges = <0x0 0xc100 0x200>;
78 cell-index = <0>;
79 dma-channel@0 {
80 compatible = "fsl,mpc8572-dma-channel",
81 "fsl,eloplus-dma-channel";
82 reg = <0x0 0x80>;
83 cell-index = <0>;
84 interrupt-parent = <&mpic>;
85 interrupts = <76 2>;
86 };
87 dma-channel@80 {
88 compatible = "fsl,mpc8572-dma-channel",
89 "fsl,eloplus-dma-channel";
90 reg = <0x80 0x80>;
91 cell-index = <1>;
92 interrupt-parent = <&mpic>;
93 interrupts = <77 2>;
94 };
95 dma-channel@100 {
96 compatible = "fsl,mpc8572-dma-channel",
97 "fsl,eloplus-dma-channel";
98 reg = <0x100 0x80>;
99 cell-index = <2>;
100 interrupt-parent = <&mpic>;
101 interrupts = <78 2>;
102 };
103 dma-channel@180 {
104 compatible = "fsl,mpc8572-dma-channel",
105 "fsl,eloplus-dma-channel";
106 reg = <0x180 0x80>;
107 cell-index = <3>;
108 interrupt-parent = <&mpic>;
109 interrupts = <79 2>;
110 };
111 };
112
113 mdio@24520 {
114 #address-cells = <1>;
115 #size-cells = <0>;
116 compatible = "fsl,gianfar-mdio";
117 reg = <0x24520 0x20>;
118
119 phy2: ethernet-phy@2 {
120 interrupt-parent = <&mpic>;
121 reg = <0x2>;
122 };
123 phy3: ethernet-phy@3 {
124 interrupt-parent = <&mpic>;
125 reg = <0x3>;
126 };
127 };
128
129 enet2: ethernet@26000 {
130 cell-index = <2>;
131 device_type = "network";
132 model = "eTSEC";
133 compatible = "gianfar";
134 reg = <0x26000 0x1000>;
135 local-mac-address = [ 00 00 00 00 00 00 ];
136 interrupts = <31 2 32 2 33 2>;
137 interrupt-parent = <&mpic>;
138 phy-handle = <&phy2>;
139 phy-connection-type = "rgmii-id";
140 };
141
142 enet3: ethernet@27000 {
143 cell-index = <3>;
144 device_type = "network";
145 model = "eTSEC";
146 compatible = "gianfar";
147 reg = <0x27000 0x1000>;
148 local-mac-address = [ 00 00 00 00 00 00 ];
149 interrupts = <37 2 38 2 39 2>;
150 interrupt-parent = <&mpic>;
151 phy-handle = <&phy3>;
152 phy-connection-type = "rgmii-id";
153 };
154
155 msi@41600 {
156 compatible = "fsl,mpc8572-msi", "fsl,mpic-msi";
157 reg = <0x41600 0x80>;
158 msi-available-ranges = <0 0x100>;
159 interrupts = <
160 0xe0 0
161 0xe1 0
162 0xe2 0
163 0xe3 0
164 0xe4 0
165 0xe5 0
166 0xe6 0
167 0xe7 0>;
168 interrupt-parent = <&mpic>;
169 };
170
171 serial0: serial@4600 {
172 cell-index = <1>;
173 device_type = "serial";
174 compatible = "ns16550";
175 reg = <0x4600 0x100>;
176 clock-frequency = <0>;
177 };
178
179 mpic: pic@40000 {
180 interrupt-controller;
181 #address-cells = <0>;
182 #interrupt-cells = <2>;
183 reg = <0x40000 0x40000>;
184 compatible = "chrp,open-pic";
185 device_type = "open-pic";
186 protected-sources = <
187 18 16 10 42 45 58 /* MEM L2 mdio serial crypto */
188 29 30 34 35 36 40 /* enet0 enet1 */
189 24 26 20 21 22 23 /* pcie0 pcie1 dma1 */
190 43 /* i2c */
191 0x1 0x2 0x3 0x4 /* pci slot */
192 0x9 0xa 0xb 0xc /* usb */
193 0x6 0x7 0xe 0x5 /* Audio elgacy SATA */
194 >;
195 };
196 };
197
198 pci2: pcie@ffe0a000 {
199 cell-index = <2>;
200 compatible = "fsl,mpc8548-pcie";
201 device_type = "pci";
202 #interrupt-cells = <1>;
203 #size-cells = <2>;
204 #address-cells = <3>;
205 reg = <0xffe0a000 0x1000>;
206 bus-range = <0 255>;
207 ranges = <0x2000000 0x0 0xc0000000 0xc0000000 0x0 0x20000000
208 0x1000000 0x0 0x0 0xffc20000 0x0 0x10000>;
209 clock-frequency = <33333333>;
210 interrupt-parent = <&mpic>;
211 interrupts = <27 2>;
212 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
213 interrupt-map = <
214 /* IDSEL 0x0 */
215 0000 0x0 0x0 0x1 &mpic 0x0 0x1
216 0000 0x0 0x0 0x2 &mpic 0x1 0x1
217 0000 0x0 0x0 0x3 &mpic 0x2 0x1
218 0000 0x0 0x0 0x4 &mpic 0x3 0x1
219 >;
220 pcie@0 {
221 reg = <0x0 0x0 0x0 0x0 0x0>;
222 #size-cells = <2>;
223 #address-cells = <3>;
224 device_type = "pci";
225 ranges = <0x2000000 0x0 0xc0000000
226 0x2000000 0x0 0xc0000000
227 0x0 0x20000000
228
229 0x1000000 0x0 0x0
230 0x1000000 0x0 0x0
231 0x0 0x100000>;
232 };
233 };
234};
diff --git a/arch/powerpc/boot/dts/mpc8641_hpcn.dts b/arch/powerpc/boot/dts/mpc8641_hpcn.dts
index d665e767822a..35d5e248ccd7 100644
--- a/arch/powerpc/boot/dts/mpc8641_hpcn.dts
+++ b/arch/powerpc/boot/dts/mpc8641_hpcn.dts
@@ -205,8 +205,49 @@
205 reg = <3>; 205 reg = <3>;
206 device_type = "ethernet-phy"; 206 device_type = "ethernet-phy";
207 }; 207 };
208 tbi0: tbi-phy@11 {
209 reg = <0x11>;
210 device_type = "tbi-phy";
211 };
212 };
213
214 mdio@25520 {
215 #address-cells = <1>;
216 #size-cells = <0>;
217 compatible = "fsl,gianfar-tbi";
218 reg = <0x25520 0x20>;
219
220 tbi1: tbi-phy@11 {
221 reg = <0x11>;
222 device_type = "tbi-phy";
223 };
224 };
225
226 mdio@26520 {
227 #address-cells = <1>;
228 #size-cells = <0>;
229 compatible = "fsl,gianfar-tbi";
230 reg = <0x26520 0x20>;
231
232 tbi2: tbi-phy@11 {
233 reg = <0x11>;
234 device_type = "tbi-phy";
235 };
236 };
237
238 mdio@27520 {
239 #address-cells = <1>;
240 #size-cells = <0>;
241 compatible = "fsl,gianfar-tbi";
242 reg = <0x27520 0x20>;
243
244 tbi3: tbi-phy@11 {
245 reg = <0x11>;
246 device_type = "tbi-phy";
247 };
208 }; 248 };
209 249
250
210 enet0: ethernet@24000 { 251 enet0: ethernet@24000 {
211 cell-index = <0>; 252 cell-index = <0>;
212 device_type = "network"; 253 device_type = "network";
@@ -216,6 +257,7 @@
216 local-mac-address = [ 00 00 00 00 00 00 ]; 257 local-mac-address = [ 00 00 00 00 00 00 ];
217 interrupts = <29 2 30 2 34 2>; 258 interrupts = <29 2 30 2 34 2>;
218 interrupt-parent = <&mpic>; 259 interrupt-parent = <&mpic>;
260 tbi-handle = <&tbi0>;
219 phy-handle = <&phy0>; 261 phy-handle = <&phy0>;
220 phy-connection-type = "rgmii-id"; 262 phy-connection-type = "rgmii-id";
221 }; 263 };
@@ -229,6 +271,7 @@
229 local-mac-address = [ 00 00 00 00 00 00 ]; 271 local-mac-address = [ 00 00 00 00 00 00 ];
230 interrupts = <35 2 36 2 40 2>; 272 interrupts = <35 2 36 2 40 2>;
231 interrupt-parent = <&mpic>; 273 interrupt-parent = <&mpic>;
274 tbi-handle = <&tbi1>;
232 phy-handle = <&phy1>; 275 phy-handle = <&phy1>;
233 phy-connection-type = "rgmii-id"; 276 phy-connection-type = "rgmii-id";
234 }; 277 };
@@ -242,6 +285,7 @@
242 local-mac-address = [ 00 00 00 00 00 00 ]; 285 local-mac-address = [ 00 00 00 00 00 00 ];
243 interrupts = <31 2 32 2 33 2>; 286 interrupts = <31 2 32 2 33 2>;
244 interrupt-parent = <&mpic>; 287 interrupt-parent = <&mpic>;
288 tbi-handle = <&tbi2>;
245 phy-handle = <&phy2>; 289 phy-handle = <&phy2>;
246 phy-connection-type = "rgmii-id"; 290 phy-connection-type = "rgmii-id";
247 }; 291 };
@@ -255,6 +299,7 @@
255 local-mac-address = [ 00 00 00 00 00 00 ]; 299 local-mac-address = [ 00 00 00 00 00 00 ];
256 interrupts = <37 2 38 2 39 2>; 300 interrupts = <37 2 38 2 39 2>;
257 interrupt-parent = <&mpic>; 301 interrupt-parent = <&mpic>;
302 tbi-handle = <&tbi3>;
258 phy-handle = <&phy3>; 303 phy-handle = <&phy3>;
259 phy-connection-type = "rgmii-id"; 304 phy-connection-type = "rgmii-id";
260 }; 305 };
diff --git a/arch/powerpc/boot/dts/pcm030.dts b/arch/powerpc/boot/dts/pcm030.dts
index 7c1bb952360c..be2c11ca0594 100644
--- a/arch/powerpc/boot/dts/pcm030.dts
+++ b/arch/powerpc/boot/dts/pcm030.dts
@@ -143,7 +143,6 @@
143 143
144 rtc@800 { // Real time clock 144 rtc@800 { // Real time clock
145 compatible = "fsl,mpc5200b-rtc","fsl,mpc5200-rtc"; 145 compatible = "fsl,mpc5200b-rtc","fsl,mpc5200-rtc";
146 device_type = "rtc";
147 reg = <0x800 0x100>; 146 reg = <0x800 0x100>;
148 interrupts = <0x1 0x5 0x0 0x1 0x6 0x0>; 147 interrupts = <0x1 0x5 0x0 0x1 0x6 0x0>;
149 interrupt-parent = <&mpc5200_pic>; 148 interrupt-parent = <&mpc5200_pic>;
@@ -301,7 +300,6 @@
301 interrupt-parent = <&mpc5200_pic>; 300 interrupt-parent = <&mpc5200_pic>;
302 fsl5200-clocking; 301 fsl5200-clocking;
303 rtc@51 { 302 rtc@51 {
304 device_type = "rtc";
305 compatible = "nxp,pcf8563"; 303 compatible = "nxp,pcf8563";
306 reg = <0x51>; 304 reg = <0x51>;
307 }; 305 };
diff --git a/arch/powerpc/boot/dts/sbc8349.dts b/arch/powerpc/boot/dts/sbc8349.dts
index 0f941f310e44..8d365a57ebc1 100644
--- a/arch/powerpc/boot/dts/sbc8349.dts
+++ b/arch/powerpc/boot/dts/sbc8349.dts
@@ -177,6 +177,22 @@
177 reg = <0x1a>; 177 reg = <0x1a>;
178 device_type = "ethernet-phy"; 178 device_type = "ethernet-phy";
179 }; 179 };
180 tbi0: tbi-phy@11 {
181 reg = <0x11>;
182 device_type = "tbi-phy";
183 };
184 };
185
186 mdio@25520 {
187 #address-cells = <1>;
188 #size-cells = <0>;
189 compatible = "fsl,gianfar-tbi";
190 reg = <0x25520 0x20>;
191
192 tbi1: tbi-phy@11 {
193 reg = <0x11>;
194 device_type = "tbi-phy";
195 };
180 }; 196 };
181 197
182 enet0: ethernet@24000 { 198 enet0: ethernet@24000 {
@@ -188,6 +204,7 @@
188 local-mac-address = [ 00 00 00 00 00 00 ]; 204 local-mac-address = [ 00 00 00 00 00 00 ];
189 interrupts = <32 0x8 33 0x8 34 0x8>; 205 interrupts = <32 0x8 33 0x8 34 0x8>;
190 interrupt-parent = <&ipic>; 206 interrupt-parent = <&ipic>;
207 tbi-handle = <&tbi0>;
191 phy-handle = <&phy0>; 208 phy-handle = <&phy0>;
192 linux,network-index = <0>; 209 linux,network-index = <0>;
193 }; 210 };
@@ -201,6 +218,7 @@
201 local-mac-address = [ 00 00 00 00 00 00 ]; 218 local-mac-address = [ 00 00 00 00 00 00 ];
202 interrupts = <35 0x8 36 0x8 37 0x8>; 219 interrupts = <35 0x8 36 0x8 37 0x8>;
203 interrupt-parent = <&ipic>; 220 interrupt-parent = <&ipic>;
221 tbi-handle = <&tbi1>;
204 phy-handle = <&phy1>; 222 phy-handle = <&phy1>;
205 linux,network-index = <1>; 223 linux,network-index = <1>;
206 }; 224 };
diff --git a/arch/powerpc/boot/dts/sbc8548.dts b/arch/powerpc/boot/dts/sbc8548.dts
index 333552b4e90d..2baf4a51f224 100644
--- a/arch/powerpc/boot/dts/sbc8548.dts
+++ b/arch/powerpc/boot/dts/sbc8548.dts
@@ -252,6 +252,22 @@
252 reg = <0x1a>; 252 reg = <0x1a>;
253 device_type = "ethernet-phy"; 253 device_type = "ethernet-phy";
254 }; 254 };
255 tbi0: tbi-phy@11 {
256 reg = <0x11>;
257 device_type = "tbi-phy";
258 };
259 };
260
261 mdio@25520 {
262 #address-cells = <1>;
263 #size-cells = <0>;
264 compatible = "fsl,gianfar-tbi";
265 reg = <0x25520 0x20>;
266
267 tbi1: tbi-phy@11 {
268 reg = <0x11>;
269 device_type = "tbi-phy";
270 };
255 }; 271 };
256 272
257 enet0: ethernet@24000 { 273 enet0: ethernet@24000 {
@@ -263,6 +279,7 @@
263 local-mac-address = [ 00 00 00 00 00 00 ]; 279 local-mac-address = [ 00 00 00 00 00 00 ];
264 interrupts = <0x1d 0x2 0x1e 0x2 0x22 0x2>; 280 interrupts = <0x1d 0x2 0x1e 0x2 0x22 0x2>;
265 interrupt-parent = <&mpic>; 281 interrupt-parent = <&mpic>;
282 tbi-handle = <&tbi0>;
266 phy-handle = <&phy0>; 283 phy-handle = <&phy0>;
267 }; 284 };
268 285
@@ -275,6 +292,7 @@
275 local-mac-address = [ 00 00 00 00 00 00 ]; 292 local-mac-address = [ 00 00 00 00 00 00 ];
276 interrupts = <0x23 0x2 0x24 0x2 0x28 0x2>; 293 interrupts = <0x23 0x2 0x24 0x2 0x28 0x2>;
277 interrupt-parent = <&mpic>; 294 interrupt-parent = <&mpic>;
295 tbi-handle = <&tbi1>;
278 phy-handle = <&phy1>; 296 phy-handle = <&phy1>;
279 }; 297 };
280 298
diff --git a/arch/powerpc/boot/dts/sbc8560.dts b/arch/powerpc/boot/dts/sbc8560.dts
index db3632ef9888..01542f7062ab 100644
--- a/arch/powerpc/boot/dts/sbc8560.dts
+++ b/arch/powerpc/boot/dts/sbc8560.dts
@@ -168,6 +168,22 @@
168 reg = <0x1c>; 168 reg = <0x1c>;
169 device_type = "ethernet-phy"; 169 device_type = "ethernet-phy";
170 }; 170 };
171 tbi0: tbi-phy@11 {
172 reg = <0x11>;
173 device_type = "tbi-phy";
174 };
175 };
176
177 mdio@25520 {
178 #address-cells = <1>;
179 #size-cells = <0>;
180 compatible = "fsl,gianfar-tbi";
181 reg = <0x25520 0x20>;
182
183 tbi1: tbi-phy@11 {
184 reg = <0x11>;
185 device_type = "tbi-phy";
186 };
171 }; 187 };
172 188
173 enet0: ethernet@24000 { 189 enet0: ethernet@24000 {
@@ -179,6 +195,7 @@
179 local-mac-address = [ 00 00 00 00 00 00 ]; 195 local-mac-address = [ 00 00 00 00 00 00 ];
180 interrupts = <0x1d 0x2 0x1e 0x2 0x22 0x2>; 196 interrupts = <0x1d 0x2 0x1e 0x2 0x22 0x2>;
181 interrupt-parent = <&mpic>; 197 interrupt-parent = <&mpic>;
198 tbi-handle = <&tbi0>;
182 phy-handle = <&phy0>; 199 phy-handle = <&phy0>;
183 }; 200 };
184 201
@@ -191,6 +208,7 @@
191 local-mac-address = [ 00 00 00 00 00 00 ]; 208 local-mac-address = [ 00 00 00 00 00 00 ];
192 interrupts = <0x23 0x2 0x24 0x2 0x28 0x2>; 209 interrupts = <0x23 0x2 0x24 0x2 0x28 0x2>;
193 interrupt-parent = <&mpic>; 210 interrupt-parent = <&mpic>;
211 tbi-handle = <&tbi1>;
194 phy-handle = <&phy1>; 212 phy-handle = <&phy1>;
195 }; 213 };
196 214
diff --git a/arch/powerpc/boot/dts/sbc8641d.dts b/arch/powerpc/boot/dts/sbc8641d.dts
index 9652456158fb..36db981548e4 100644
--- a/arch/powerpc/boot/dts/sbc8641d.dts
+++ b/arch/powerpc/boot/dts/sbc8641d.dts
@@ -222,6 +222,46 @@
222 reg = <2>; 222 reg = <2>;
223 device_type = "ethernet-phy"; 223 device_type = "ethernet-phy";
224 }; 224 };
225 tbi0: tbi-phy@11 {
226 reg = <0x11>;
227 device_type = "tbi-phy";
228 };
229 };
230
231 mdio@25520 {
232 #address-cells = <1>;
233 #size-cells = <0>;
234 compatible = "fsl,gianfar-tbi";
235 reg = <0x25520 0x20>;
236
237 tbi1: tbi-phy@11 {
238 reg = <0x11>;
239 device_type = "tbi-phy";
240 };
241 };
242
243 mdio@26520 {
244 #address-cells = <1>;
245 #size-cells = <0>;
246 compatible = "fsl,gianfar-tbi";
247 reg = <0x26520 0x20>;
248
249 tbi2: tbi-phy@11 {
250 reg = <0x11>;
251 device_type = "tbi-phy";
252 };
253 };
254
255 mdio@27520 {
256 #address-cells = <1>;
257 #size-cells = <0>;
258 compatible = "fsl,gianfar-tbi";
259 reg = <0x27520 0x20>;
260
261 tbi3: tbi-phy@11 {
262 reg = <0x11>;
263 device_type = "tbi-phy";
264 };
225 }; 265 };
226 266
227 enet0: ethernet@24000 { 267 enet0: ethernet@24000 {
@@ -233,6 +273,7 @@
233 local-mac-address = [ 00 00 00 00 00 00 ]; 273 local-mac-address = [ 00 00 00 00 00 00 ];
234 interrupts = <29 2 30 2 34 2>; 274 interrupts = <29 2 30 2 34 2>;
235 interrupt-parent = <&mpic>; 275 interrupt-parent = <&mpic>;
276 tbi-handle = <&tbi0>;
236 phy-handle = <&phy0>; 277 phy-handle = <&phy0>;
237 phy-connection-type = "rgmii-id"; 278 phy-connection-type = "rgmii-id";
238 }; 279 };
@@ -246,6 +287,7 @@
246 local-mac-address = [ 00 00 00 00 00 00 ]; 287 local-mac-address = [ 00 00 00 00 00 00 ];
247 interrupts = <35 2 36 2 40 2>; 288 interrupts = <35 2 36 2 40 2>;
248 interrupt-parent = <&mpic>; 289 interrupt-parent = <&mpic>;
290 tbi-handle = <&tbi1>;
249 phy-handle = <&phy1>; 291 phy-handle = <&phy1>;
250 phy-connection-type = "rgmii-id"; 292 phy-connection-type = "rgmii-id";
251 }; 293 };
@@ -259,6 +301,7 @@
259 local-mac-address = [ 00 00 00 00 00 00 ]; 301 local-mac-address = [ 00 00 00 00 00 00 ];
260 interrupts = <31 2 32 2 33 2>; 302 interrupts = <31 2 32 2 33 2>;
261 interrupt-parent = <&mpic>; 303 interrupt-parent = <&mpic>;
304 tbi-handle = <&tbi2>;
262 phy-handle = <&phy2>; 305 phy-handle = <&phy2>;
263 phy-connection-type = "rgmii-id"; 306 phy-connection-type = "rgmii-id";
264 }; 307 };
@@ -272,6 +315,7 @@
272 local-mac-address = [ 00 00 00 00 00 00 ]; 315 local-mac-address = [ 00 00 00 00 00 00 ];
273 interrupts = <37 2 38 2 39 2>; 316 interrupts = <37 2 38 2 39 2>;
274 interrupt-parent = <&mpic>; 317 interrupt-parent = <&mpic>;
318 tbi-handle = <&tbi3>;
275 phy-handle = <&phy3>; 319 phy-handle = <&phy3>;
276 phy-connection-type = "rgmii-id"; 320 phy-connection-type = "rgmii-id";
277 }; 321 };
diff --git a/arch/powerpc/boot/dts/stx_gp3_8560.dts b/arch/powerpc/boot/dts/stx_gp3_8560.dts
index fcd1db6ca0a8..fff33fe6efc6 100644
--- a/arch/powerpc/boot/dts/stx_gp3_8560.dts
+++ b/arch/powerpc/boot/dts/stx_gp3_8560.dts
@@ -142,6 +142,22 @@
142 reg = <4>; 142 reg = <4>;
143 device_type = "ethernet-phy"; 143 device_type = "ethernet-phy";
144 }; 144 };
145 tbi0: tbi-phy@11 {
146 reg = <0x11>;
147 device_type = "tbi-phy";
148 };
149 };
150
151 mdio@25520 {
152 #address-cells = <1>;
153 #size-cells = <0>;
154 compatible = "fsl,gianfar-tbi";
155 reg = <0x25520 0x20>;
156
157 tbi1: tbi-phy@11 {
158 reg = <0x11>;
159 device_type = "tbi-phy";
160 };
145 }; 161 };
146 162
147 enet0: ethernet@24000 { 163 enet0: ethernet@24000 {
@@ -153,6 +169,7 @@
153 local-mac-address = [ 00 00 00 00 00 00 ]; 169 local-mac-address = [ 00 00 00 00 00 00 ];
154 interrupts = <29 2 30 2 34 2>; 170 interrupts = <29 2 30 2 34 2>;
155 interrupt-parent = <&mpic>; 171 interrupt-parent = <&mpic>;
172 tbi-handle = <&tbi0>;
156 phy-handle = <&phy2>; 173 phy-handle = <&phy2>;
157 }; 174 };
158 175
@@ -165,6 +182,7 @@
165 local-mac-address = [ 00 00 00 00 00 00 ]; 182 local-mac-address = [ 00 00 00 00 00 00 ];
166 interrupts = <35 2 36 2 40 2>; 183 interrupts = <35 2 36 2 40 2>;
167 interrupt-parent = <&mpic>; 184 interrupt-parent = <&mpic>;
185 tbi-handle = <&tbi1>;
168 phy-handle = <&phy4>; 186 phy-handle = <&phy4>;
169 }; 187 };
170 188
diff --git a/arch/powerpc/boot/dts/tqm5200.dts b/arch/powerpc/boot/dts/tqm5200.dts
index 3008bf8830c1..906302e26a62 100644
--- a/arch/powerpc/boot/dts/tqm5200.dts
+++ b/arch/powerpc/boot/dts/tqm5200.dts
@@ -181,7 +181,6 @@
181 fsl5200-clocking; 181 fsl5200-clocking;
182 182
183 rtc@68 { 183 rtc@68 {
184 device_type = "rtc";
185 compatible = "dallas,ds1307"; 184 compatible = "dallas,ds1307";
186 reg = <0x68>; 185 reg = <0x68>;
187 }; 186 };
diff --git a/arch/powerpc/boot/dts/tqm8540.dts b/arch/powerpc/boot/dts/tqm8540.dts
index e1d260b9085e..a693f01c21aa 100644
--- a/arch/powerpc/boot/dts/tqm8540.dts
+++ b/arch/powerpc/boot/dts/tqm8540.dts
@@ -155,6 +155,34 @@
155 reg = <3>; 155 reg = <3>;
156 device_type = "ethernet-phy"; 156 device_type = "ethernet-phy";
157 }; 157 };
158 tbi0: tbi-phy@11 {
159 reg = <0x11>;
160 device_type = "tbi-phy";
161 };
162 };
163
164 mdio@25520 {
165 #address-cells = <1>;
166 #size-cells = <0>;
167 compatible = "fsl,gianfar-tbi";
168 reg = <0x25520 0x20>;
169
170 tbi1: tbi-phy@11 {
171 reg = <0x11>;
172 device_type = "tbi-phy";
173 };
174 };
175
176 mdio@26520 {
177 #address-cells = <1>;
178 #size-cells = <0>;
179 compatible = "fsl,gianfar-tbi";
180 reg = <0x26520 0x20>;
181
182 tbi2: tbi-phy@11 {
183 reg = <0x11>;
184 device_type = "tbi-phy";
185 };
158 }; 186 };
159 187
160 enet0: ethernet@24000 { 188 enet0: ethernet@24000 {
diff --git a/arch/powerpc/boot/dts/tqm8541.dts b/arch/powerpc/boot/dts/tqm8541.dts
index d76441ec5dc7..9e3f5f0dde20 100644
--- a/arch/powerpc/boot/dts/tqm8541.dts
+++ b/arch/powerpc/boot/dts/tqm8541.dts
@@ -154,6 +154,22 @@
154 reg = <3>; 154 reg = <3>;
155 device_type = "ethernet-phy"; 155 device_type = "ethernet-phy";
156 }; 156 };
157 tbi0: tbi-phy@11 {
158 reg = <0x11>;
159 device_type = "tbi-phy";
160 };
161 };
162
163 mdio@25520 {
164 #address-cells = <1>;
165 #size-cells = <0>;
166 compatible = "fsl,gianfar-tbi";
167 reg = <0x25520 0x20>;
168
169 tbi1: tbi-phy@11 {
170 reg = <0x11>;
171 device_type = "tbi-phy";
172 };
157 }; 173 };
158 174
159 enet0: ethernet@24000 { 175 enet0: ethernet@24000 {
@@ -165,6 +181,7 @@
165 local-mac-address = [ 00 00 00 00 00 00 ]; 181 local-mac-address = [ 00 00 00 00 00 00 ];
166 interrupts = <29 2 30 2 34 2>; 182 interrupts = <29 2 30 2 34 2>;
167 interrupt-parent = <&mpic>; 183 interrupt-parent = <&mpic>;
184 tbi-handle = <&tbi0>;
168 phy-handle = <&phy2>; 185 phy-handle = <&phy2>;
169 }; 186 };
170 187
@@ -177,6 +194,7 @@
177 local-mac-address = [ 00 00 00 00 00 00 ]; 194 local-mac-address = [ 00 00 00 00 00 00 ];
178 interrupts = <35 2 36 2 40 2>; 195 interrupts = <35 2 36 2 40 2>;
179 interrupt-parent = <&mpic>; 196 interrupt-parent = <&mpic>;
197 tbi-handle = <&tbi1>;
180 phy-handle = <&phy1>; 198 phy-handle = <&phy1>;
181 }; 199 };
182 200
diff --git a/arch/powerpc/boot/dts/tqm8548-bigflash.dts b/arch/powerpc/boot/dts/tqm8548-bigflash.dts
index 4199e89b4e50..15086eb65c50 100644
--- a/arch/powerpc/boot/dts/tqm8548-bigflash.dts
+++ b/arch/powerpc/boot/dts/tqm8548-bigflash.dts
@@ -179,6 +179,46 @@
179 reg = <5>; 179 reg = <5>;
180 device_type = "ethernet-phy"; 180 device_type = "ethernet-phy";
181 }; 181 };
182 tbi0: tbi-phy@11 {
183 reg = <0x11>;
184 device_type = "tbi-phy";
185 };
186 };
187
188 mdio@25520 {
189 #address-cells = <1>;
190 #size-cells = <0>;
191 compatible = "fsl,gianfar-tbi";
192 reg = <0x25520 0x20>;
193
194 tbi1: tbi-phy@11 {
195 reg = <0x11>;
196 device_type = "tbi-phy";
197 };
198 };
199
200 mdio@26520 {
201 #address-cells = <1>;
202 #size-cells = <0>;
203 compatible = "fsl,gianfar-tbi";
204 reg = <0x26520 0x20>;
205
206 tbi2: tbi-phy@11 {
207 reg = <0x11>;
208 device_type = "tbi-phy";
209 };
210 };
211
212 mdio@27520 {
213 #address-cells = <1>;
214 #size-cells = <0>;
215 compatible = "fsl,gianfar-tbi";
216 reg = <0x27520 0x20>;
217
218 tbi3: tbi-phy@11 {
219 reg = <0x11>;
220 device_type = "tbi-phy";
221 };
182 }; 222 };
183 223
184 enet0: ethernet@24000 { 224 enet0: ethernet@24000 {
@@ -190,6 +230,7 @@
190 local-mac-address = [ 00 00 00 00 00 00 ]; 230 local-mac-address = [ 00 00 00 00 00 00 ];
191 interrupts = <29 2 30 2 34 2>; 231 interrupts = <29 2 30 2 34 2>;
192 interrupt-parent = <&mpic>; 232 interrupt-parent = <&mpic>;
233 tbi-handle = <&tbi0>;
193 phy-handle = <&phy2>; 234 phy-handle = <&phy2>;
194 }; 235 };
195 236
@@ -202,6 +243,7 @@
202 local-mac-address = [ 00 00 00 00 00 00 ]; 243 local-mac-address = [ 00 00 00 00 00 00 ];
203 interrupts = <35 2 36 2 40 2>; 244 interrupts = <35 2 36 2 40 2>;
204 interrupt-parent = <&mpic>; 245 interrupt-parent = <&mpic>;
246 tbi-handle = <&tbi1>;
205 phy-handle = <&phy1>; 247 phy-handle = <&phy1>;
206 }; 248 };
207 249
@@ -214,6 +256,7 @@
214 local-mac-address = [ 00 00 00 00 00 00 ]; 256 local-mac-address = [ 00 00 00 00 00 00 ];
215 interrupts = <31 2 32 2 33 2>; 257 interrupts = <31 2 32 2 33 2>;
216 interrupt-parent = <&mpic>; 258 interrupt-parent = <&mpic>;
259 tbi-handle = <&tbi2>;
217 phy-handle = <&phy3>; 260 phy-handle = <&phy3>;
218 }; 261 };
219 262
@@ -226,6 +269,7 @@
226 local-mac-address = [ 00 00 00 00 00 00 ]; 269 local-mac-address = [ 00 00 00 00 00 00 ];
227 interrupts = <37 2 38 2 39 2>; 270 interrupts = <37 2 38 2 39 2>;
228 interrupt-parent = <&mpic>; 271 interrupt-parent = <&mpic>;
272 tbi-handle = <&tbi3>;
229 phy-handle = <&phy4>; 273 phy-handle = <&phy4>;
230 }; 274 };
231 275
diff --git a/arch/powerpc/boot/dts/tqm8548.dts b/arch/powerpc/boot/dts/tqm8548.dts
index 58ee4185454b..b7b65f5e79b6 100644
--- a/arch/powerpc/boot/dts/tqm8548.dts
+++ b/arch/powerpc/boot/dts/tqm8548.dts
@@ -179,6 +179,46 @@
179 reg = <5>; 179 reg = <5>;
180 device_type = "ethernet-phy"; 180 device_type = "ethernet-phy";
181 }; 181 };
182 tbi0: tbi-phy@11 {
183 reg = <0x11>;
184 device_type = "tbi-phy";
185 };
186 };
187
188 mdio@25520 {
189 #address-cells = <1>;
190 #size-cells = <0>;
191 compatible = "fsl,gianfar-tbi";
192 reg = <0x25520 0x20>;
193
194 tbi1: tbi-phy@11 {
195 reg = <0x11>;
196 device_type = "tbi-phy";
197 };
198 };
199
200 mdio@26520 {
201 #address-cells = <1>;
202 #size-cells = <0>;
203 compatible = "fsl,gianfar-tbi";
204 reg = <0x26520 0x20>;
205
206 tbi2: tbi-phy@11 {
207 reg = <0x11>;
208 device_type = "tbi-phy";
209 };
210 };
211
212 mdio@27520 {
213 #address-cells = <1>;
214 #size-cells = <0>;
215 compatible = "fsl,gianfar-tbi";
216 reg = <0x27520 0x20>;
217
218 tbi3: tbi-phy@11 {
219 reg = <0x11>;
220 device_type = "tbi-phy";
221 };
182 }; 222 };
183 223
184 enet0: ethernet@24000 { 224 enet0: ethernet@24000 {
@@ -190,6 +230,7 @@
190 local-mac-address = [ 00 00 00 00 00 00 ]; 230 local-mac-address = [ 00 00 00 00 00 00 ];
191 interrupts = <29 2 30 2 34 2>; 231 interrupts = <29 2 30 2 34 2>;
192 interrupt-parent = <&mpic>; 232 interrupt-parent = <&mpic>;
233 tbi-handle = <&tbi0>;
193 phy-handle = <&phy2>; 234 phy-handle = <&phy2>;
194 }; 235 };
195 236
@@ -202,6 +243,7 @@
202 local-mac-address = [ 00 00 00 00 00 00 ]; 243 local-mac-address = [ 00 00 00 00 00 00 ];
203 interrupts = <35 2 36 2 40 2>; 244 interrupts = <35 2 36 2 40 2>;
204 interrupt-parent = <&mpic>; 245 interrupt-parent = <&mpic>;
246 tbi-handle = <&tbi1>;
205 phy-handle = <&phy1>; 247 phy-handle = <&phy1>;
206 }; 248 };
207 249
@@ -214,6 +256,7 @@
214 local-mac-address = [ 00 00 00 00 00 00 ]; 256 local-mac-address = [ 00 00 00 00 00 00 ];
215 interrupts = <31 2 32 2 33 2>; 257 interrupts = <31 2 32 2 33 2>;
216 interrupt-parent = <&mpic>; 258 interrupt-parent = <&mpic>;
259 tbi-handle = <&tbi2>;
217 phy-handle = <&phy3>; 260 phy-handle = <&phy3>;
218 }; 261 };
219 262
@@ -226,6 +269,7 @@
226 local-mac-address = [ 00 00 00 00 00 00 ]; 269 local-mac-address = [ 00 00 00 00 00 00 ];
227 interrupts = <37 2 38 2 39 2>; 270 interrupts = <37 2 38 2 39 2>;
228 interrupt-parent = <&mpic>; 271 interrupt-parent = <&mpic>;
272 tbi-handle = <&tbi3>;
229 phy-handle = <&phy4>; 273 phy-handle = <&phy4>;
230 }; 274 };
231 275
diff --git a/arch/powerpc/boot/dts/tqm8555.dts b/arch/powerpc/boot/dts/tqm8555.dts
index 6f7ea59c4846..cf92b4e7945e 100644
--- a/arch/powerpc/boot/dts/tqm8555.dts
+++ b/arch/powerpc/boot/dts/tqm8555.dts
@@ -154,6 +154,22 @@
154 reg = <3>; 154 reg = <3>;
155 device_type = "ethernet-phy"; 155 device_type = "ethernet-phy";
156 }; 156 };
157 tbi0: tbi-phy@11 {
158 reg = <0x11>;
159 device_type = "tbi-phy";
160 };
161 };
162
163 mdio@25520 {
164 #address-cells = <1>;
165 #size-cells = <0>;
166 compatible = "fsl,gianfar-tbi";
167 reg = <0x25520 0x20>;
168
169 tbi1: tbi-phy@11 {
170 reg = <0x11>;
171 device_type = "tbi-phy";
172 };
157 }; 173 };
158 174
159 enet0: ethernet@24000 { 175 enet0: ethernet@24000 {
@@ -165,6 +181,7 @@
165 local-mac-address = [ 00 00 00 00 00 00 ]; 181 local-mac-address = [ 00 00 00 00 00 00 ];
166 interrupts = <29 2 30 2 34 2>; 182 interrupts = <29 2 30 2 34 2>;
167 interrupt-parent = <&mpic>; 183 interrupt-parent = <&mpic>;
184 tbi-handle = <&tbi0>;
168 phy-handle = <&phy2>; 185 phy-handle = <&phy2>;
169 }; 186 };
170 187
@@ -177,6 +194,7 @@
177 local-mac-address = [ 00 00 00 00 00 00 ]; 194 local-mac-address = [ 00 00 00 00 00 00 ];
178 interrupts = <35 2 36 2 40 2>; 195 interrupts = <35 2 36 2 40 2>;
179 interrupt-parent = <&mpic>; 196 interrupt-parent = <&mpic>;
197 tbi-handle = <&tbi1>;
180 phy-handle = <&phy1>; 198 phy-handle = <&phy1>;
181 }; 199 };
182 200
diff --git a/arch/powerpc/boot/dts/tqm8560.dts b/arch/powerpc/boot/dts/tqm8560.dts
index 3fe35208907b..9e1ab2d2f669 100644
--- a/arch/powerpc/boot/dts/tqm8560.dts
+++ b/arch/powerpc/boot/dts/tqm8560.dts
@@ -156,6 +156,22 @@
156 reg = <3>; 156 reg = <3>;
157 device_type = "ethernet-phy"; 157 device_type = "ethernet-phy";
158 }; 158 };
159 tbi0: tbi-phy@11 {
160 reg = <0x11>;
161 device_type = "tbi-phy";
162 };
163 };
164
165 mdio@25520 {
166 #address-cells = <1>;
167 #size-cells = <0>;
168 compatible = "fsl,gianfar-tbi";
169 reg = <0x25520 0x20>;
170
171 tbi1: tbi-phy@11 {
172 reg = <0x11>;
173 device_type = "tbi-phy";
174 };
159 }; 175 };
160 176
161 enet0: ethernet@24000 { 177 enet0: ethernet@24000 {
@@ -167,6 +183,7 @@
167 local-mac-address = [ 00 00 00 00 00 00 ]; 183 local-mac-address = [ 00 00 00 00 00 00 ];
168 interrupts = <29 2 30 2 34 2>; 184 interrupts = <29 2 30 2 34 2>;
169 interrupt-parent = <&mpic>; 185 interrupt-parent = <&mpic>;
186 tbi-handle = <&tbi0>;
170 phy-handle = <&phy2>; 187 phy-handle = <&phy2>;
171 }; 188 };
172 189
@@ -179,6 +196,7 @@
179 local-mac-address = [ 00 00 00 00 00 00 ]; 196 local-mac-address = [ 00 00 00 00 00 00 ];
180 interrupts = <35 2 36 2 40 2>; 197 interrupts = <35 2 36 2 40 2>;
181 interrupt-parent = <&mpic>; 198 interrupt-parent = <&mpic>;
199 tbi-handle = <&tbi1>;
182 phy-handle = <&phy1>; 200 phy-handle = <&phy1>;
183 }; 201 };
184 202
diff --git a/arch/powerpc/boot/libfdt-wrapper.c b/arch/powerpc/boot/libfdt-wrapper.c
index 9276327bc2bb..bb8b9b3505ee 100644
--- a/arch/powerpc/boot/libfdt-wrapper.c
+++ b/arch/powerpc/boot/libfdt-wrapper.c
@@ -185,7 +185,7 @@ void fdt_init(void *blob)
185 185
186 /* Make sure the dt blob is the right version and so forth */ 186 /* Make sure the dt blob is the right version and so forth */
187 fdt = blob; 187 fdt = blob;
188 bufsize = fdt_totalsize(fdt) + 4; 188 bufsize = fdt_totalsize(fdt) + EXPAND_GRANULARITY;
189 buf = malloc(bufsize); 189 buf = malloc(bufsize);
190 if(!buf) 190 if(!buf)
191 fatal("malloc failed. can't relocate the device tree\n\r"); 191 fatal("malloc failed. can't relocate the device tree\n\r");
diff --git a/arch/powerpc/configs/86xx/gef_sbc610_defconfig b/arch/powerpc/configs/86xx/gef_sbc610_defconfig
index 07ccaf89f379..cd1ffa449327 100644
--- a/arch/powerpc/configs/86xx/gef_sbc610_defconfig
+++ b/arch/powerpc/configs/86xx/gef_sbc610_defconfig
@@ -1397,8 +1397,11 @@ CONFIG_USB_STORAGE=y
1397# CONFIG_ACCESSIBILITY is not set 1397# CONFIG_ACCESSIBILITY is not set
1398# CONFIG_INFINIBAND is not set 1398# CONFIG_INFINIBAND is not set
1399# CONFIG_EDAC is not set 1399# CONFIG_EDAC is not set
1400CONFIG_RTC_LIB=m 1400CONFIG_RTC_LIB=y
1401CONFIG_RTC_CLASS=m 1401CONFIG_RTC_CLASS=y
1402CONFIG_RTC_HCTOSYS=y
1403CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
1404# CONFIG_RTC_DEBUG is not set
1402 1405
1403# 1406#
1404# RTC interfaces 1407# RTC interfaces
@@ -1424,6 +1427,7 @@ CONFIG_RTC_INTF_DEV=y
1424# CONFIG_RTC_DRV_M41T80 is not set 1427# CONFIG_RTC_DRV_M41T80 is not set
1425# CONFIG_RTC_DRV_S35390A is not set 1428# CONFIG_RTC_DRV_S35390A is not set
1426# CONFIG_RTC_DRV_FM3130 is not set 1429# CONFIG_RTC_DRV_FM3130 is not set
1430CONFIG_RTC_DRV_RX8581=y
1427 1431
1428# 1432#
1429# SPI RTC drivers 1433# SPI RTC drivers
diff --git a/arch/powerpc/configs/ppc44x_defconfig b/arch/powerpc/configs/ppc44x_defconfig
index cfc94cfcf4cb..034a1fbdc887 100644
--- a/arch/powerpc/configs/ppc44x_defconfig
+++ b/arch/powerpc/configs/ppc44x_defconfig
@@ -267,7 +267,7 @@ CONFIG_PCI_SYSCALL=y
267# CONFIG_PCIEPORTBUS is not set 267# CONFIG_PCIEPORTBUS is not set
268CONFIG_ARCH_SUPPORTS_MSI=y 268CONFIG_ARCH_SUPPORTS_MSI=y
269# CONFIG_PCI_MSI is not set 269# CONFIG_PCI_MSI is not set
270CONFIG_PCI_LEGACY=y 270# CONFIG_PCI_LEGACY is not set
271# CONFIG_PCI_DEBUG is not set 271# CONFIG_PCI_DEBUG is not set
272# CONFIG_PCCARD is not set 272# CONFIG_PCCARD is not set
273# CONFIG_HOTPLUG_PCI is not set 273# CONFIG_HOTPLUG_PCI is not set
@@ -354,7 +354,7 @@ CONFIG_IPV6_NDISC_NODETYPE=y
354# CONFIG_IP_SCTP is not set 354# CONFIG_IP_SCTP is not set
355# CONFIG_TIPC is not set 355# CONFIG_TIPC is not set
356# CONFIG_ATM is not set 356# CONFIG_ATM is not set
357# CONFIG_BRIDGE is not set 357CONFIG_BRIDGE=m
358# CONFIG_NET_DSA is not set 358# CONFIG_NET_DSA is not set
359# CONFIG_VLAN_8021Q is not set 359# CONFIG_VLAN_8021Q is not set
360# CONFIG_DECNET is not set 360# CONFIG_DECNET is not set
@@ -579,7 +579,7 @@ CONFIG_NETDEVICES=y
579# CONFIG_BONDING is not set 579# CONFIG_BONDING is not set
580# CONFIG_MACVLAN is not set 580# CONFIG_MACVLAN is not set
581# CONFIG_EQUALIZER is not set 581# CONFIG_EQUALIZER is not set
582# CONFIG_TUN is not set 582CONFIG_TUN=m
583# CONFIG_VETH is not set 583# CONFIG_VETH is not set
584# CONFIG_ARCNET is not set 584# CONFIG_ARCNET is not set
585# CONFIG_PHYLIB is not set 585# CONFIG_PHYLIB is not set
@@ -1001,11 +1001,11 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1001# CONFIG_USB_TMC is not set 1001# CONFIG_USB_TMC is not set
1002 1002
1003# 1003#
1004# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1004# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
1005# 1005#
1006 1006
1007# 1007#
1008# may also be needed; see USB_STORAGE Help for more information 1008# see USB_STORAGE Help for more information
1009# 1009#
1010CONFIG_USB_STORAGE=m 1010CONFIG_USB_STORAGE=m
1011# CONFIG_USB_STORAGE_DEBUG is not set 1011# CONFIG_USB_STORAGE_DEBUG is not set
@@ -1418,6 +1418,6 @@ CONFIG_CRYPTO_LZO=m
1418# CONFIG_PPC_CLOCK is not set 1418# CONFIG_PPC_CLOCK is not set
1419CONFIG_VIRTUALIZATION=y 1419CONFIG_VIRTUALIZATION=y
1420CONFIG_KVM=y 1420CONFIG_KVM=y
1421CONFIG_KVM_BOOKE_HOST=y 1421CONFIG_KVM_440=y
1422# CONFIG_VIRTIO_PCI is not set 1422# CONFIG_VIRTIO_PCI is not set
1423# CONFIG_VIRTIO_BALLOON is not set 1423# CONFIG_VIRTIO_BALLOON is not set
diff --git a/arch/powerpc/include/asm/atomic.h b/arch/powerpc/include/asm/atomic.h
index f3fc733758f5..b401950f5259 100644
--- a/arch/powerpc/include/asm/atomic.h
+++ b/arch/powerpc/include/asm/atomic.h
@@ -5,7 +5,7 @@
5 * PowerPC atomic operations 5 * PowerPC atomic operations
6 */ 6 */
7 7
8typedef struct { int counter; } atomic_t; 8#include <linux/types.h>
9 9
10#ifdef __KERNEL__ 10#ifdef __KERNEL__
11#include <linux/compiler.h> 11#include <linux/compiler.h>
@@ -111,7 +111,7 @@ static __inline__ void atomic_inc(atomic_t *v)
111 bne- 1b" 111 bne- 1b"
112 : "=&r" (t), "+m" (v->counter) 112 : "=&r" (t), "+m" (v->counter)
113 : "r" (&v->counter) 113 : "r" (&v->counter)
114 : "cc"); 114 : "cc", "xer");
115} 115}
116 116
117static __inline__ int atomic_inc_return(atomic_t *v) 117static __inline__ int atomic_inc_return(atomic_t *v)
@@ -128,7 +128,7 @@ static __inline__ int atomic_inc_return(atomic_t *v)
128 ISYNC_ON_SMP 128 ISYNC_ON_SMP
129 : "=&r" (t) 129 : "=&r" (t)
130 : "r" (&v->counter) 130 : "r" (&v->counter)
131 : "cc", "memory"); 131 : "cc", "xer", "memory");
132 132
133 return t; 133 return t;
134} 134}
@@ -155,7 +155,7 @@ static __inline__ void atomic_dec(atomic_t *v)
155 bne- 1b" 155 bne- 1b"
156 : "=&r" (t), "+m" (v->counter) 156 : "=&r" (t), "+m" (v->counter)
157 : "r" (&v->counter) 157 : "r" (&v->counter)
158 : "cc"); 158 : "cc", "xer");
159} 159}
160 160
161static __inline__ int atomic_dec_return(atomic_t *v) 161static __inline__ int atomic_dec_return(atomic_t *v)
@@ -172,7 +172,7 @@ static __inline__ int atomic_dec_return(atomic_t *v)
172 ISYNC_ON_SMP 172 ISYNC_ON_SMP
173 : "=&r" (t) 173 : "=&r" (t)
174 : "r" (&v->counter) 174 : "r" (&v->counter)
175 : "cc", "memory"); 175 : "cc", "xer", "memory");
176 176
177 return t; 177 return t;
178} 178}
@@ -251,8 +251,6 @@ static __inline__ int atomic_dec_if_positive(atomic_t *v)
251 251
252#ifdef __powerpc64__ 252#ifdef __powerpc64__
253 253
254typedef struct { long counter; } atomic64_t;
255
256#define ATOMIC64_INIT(i) { (i) } 254#define ATOMIC64_INIT(i) { (i) }
257 255
258static __inline__ long atomic64_read(const atomic64_t *v) 256static __inline__ long atomic64_read(const atomic64_t *v)
@@ -346,7 +344,7 @@ static __inline__ void atomic64_inc(atomic64_t *v)
346 bne- 1b" 344 bne- 1b"
347 : "=&r" (t), "+m" (v->counter) 345 : "=&r" (t), "+m" (v->counter)
348 : "r" (&v->counter) 346 : "r" (&v->counter)
349 : "cc"); 347 : "cc", "xer");
350} 348}
351 349
352static __inline__ long atomic64_inc_return(atomic64_t *v) 350static __inline__ long atomic64_inc_return(atomic64_t *v)
@@ -362,7 +360,7 @@ static __inline__ long atomic64_inc_return(atomic64_t *v)
362 ISYNC_ON_SMP 360 ISYNC_ON_SMP
363 : "=&r" (t) 361 : "=&r" (t)
364 : "r" (&v->counter) 362 : "r" (&v->counter)
365 : "cc", "memory"); 363 : "cc", "xer", "memory");
366 364
367 return t; 365 return t;
368} 366}
@@ -388,7 +386,7 @@ static __inline__ void atomic64_dec(atomic64_t *v)
388 bne- 1b" 386 bne- 1b"
389 : "=&r" (t), "+m" (v->counter) 387 : "=&r" (t), "+m" (v->counter)
390 : "r" (&v->counter) 388 : "r" (&v->counter)
391 : "cc"); 389 : "cc", "xer");
392} 390}
393 391
394static __inline__ long atomic64_dec_return(atomic64_t *v) 392static __inline__ long atomic64_dec_return(atomic64_t *v)
@@ -404,7 +402,7 @@ static __inline__ long atomic64_dec_return(atomic64_t *v)
404 ISYNC_ON_SMP 402 ISYNC_ON_SMP
405 : "=&r" (t) 403 : "=&r" (t)
406 : "r" (&v->counter) 404 : "r" (&v->counter)
407 : "cc", "memory"); 405 : "cc", "xer", "memory");
408 406
409 return t; 407 return t;
410} 408}
@@ -431,7 +429,7 @@ static __inline__ long atomic64_dec_if_positive(atomic64_t *v)
431 "\n\ 429 "\n\
4322:" : "=&r" (t) 4302:" : "=&r" (t)
433 : "r" (&v->counter) 431 : "r" (&v->counter)
434 : "cc", "memory"); 432 : "cc", "xer", "memory");
435 433
436 return t; 434 return t;
437} 435}
diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h
index e55d1f66b86f..64e1fdca233e 100644
--- a/arch/powerpc/include/asm/bug.h
+++ b/arch/powerpc/include/asm/bug.h
@@ -3,6 +3,7 @@
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <asm/asm-compat.h> 5#include <asm/asm-compat.h>
6
6/* 7/*
7 * Define an illegal instr to trap on the bug. 8 * Define an illegal instr to trap on the bug.
8 * We don't use 0 because that marks the end of a function 9 * We don't use 0 because that marks the end of a function
@@ -14,6 +15,7 @@
14#ifdef CONFIG_BUG 15#ifdef CONFIG_BUG
15 16
16#ifdef __ASSEMBLY__ 17#ifdef __ASSEMBLY__
18#include <asm/asm-offsets.h>
17#ifdef CONFIG_DEBUG_BUGVERBOSE 19#ifdef CONFIG_DEBUG_BUGVERBOSE
18.macro EMIT_BUG_ENTRY addr,file,line,flags 20.macro EMIT_BUG_ENTRY addr,file,line,flags
19 .section __bug_table,"a" 21 .section __bug_table,"a"
@@ -26,7 +28,7 @@
26 .previous 28 .previous
27.endm 29.endm
28#else 30#else
29 .macro EMIT_BUG_ENTRY addr,file,line,flags 31.macro EMIT_BUG_ENTRY addr,file,line,flags
30 .section __bug_table,"a" 32 .section __bug_table,"a"
315001: PPC_LONG \addr 335001: PPC_LONG \addr
32 .short \flags 34 .short \flags
@@ -113,6 +115,13 @@
113#define HAVE_ARCH_BUG_ON 115#define HAVE_ARCH_BUG_ON
114#define HAVE_ARCH_WARN_ON 116#define HAVE_ARCH_WARN_ON
115#endif /* __ASSEMBLY __ */ 117#endif /* __ASSEMBLY __ */
118#else
119#ifdef __ASSEMBLY__
120.macro EMIT_BUG_ENTRY addr,file,line,flags
121.endm
122#else /* !__ASSEMBLY__ */
123#define _EMIT_BUG_ENTRY
124#endif
116#endif /* CONFIG_BUG */ 125#endif /* CONFIG_BUG */
117 126
118#include <asm-generic/bug.h> 127#include <asm-generic/bug.h>
diff --git a/arch/powerpc/include/asm/byteorder.h b/arch/powerpc/include/asm/byteorder.h
index b37752214a16..d5de325472e9 100644
--- a/arch/powerpc/include/asm/byteorder.h
+++ b/arch/powerpc/include/asm/byteorder.h
@@ -11,6 +11,8 @@
11#include <asm/types.h> 11#include <asm/types.h>
12#include <linux/compiler.h> 12#include <linux/compiler.h>
13 13
14#define __BIG_ENDIAN
15
14#ifdef __GNUC__ 16#ifdef __GNUC__
15#ifdef __KERNEL__ 17#ifdef __KERNEL__
16 18
@@ -21,12 +23,19 @@ static __inline__ __u16 ld_le16(const volatile __u16 *addr)
21 __asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr)); 23 __asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr));
22 return val; 24 return val;
23} 25}
26#define __arch_swab16p ld_le16
24 27
25static __inline__ void st_le16(volatile __u16 *addr, const __u16 val) 28static __inline__ void st_le16(volatile __u16 *addr, const __u16 val)
26{ 29{
27 __asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); 30 __asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
28} 31}
29 32
33static inline void __arch_swab16s(__u16 *addr)
34{
35 st_le16(addr, *addr);
36}
37#define __arch_swab16s __arch_swab16s
38
30static __inline__ __u32 ld_le32(const volatile __u32 *addr) 39static __inline__ __u32 ld_le32(const volatile __u32 *addr)
31{ 40{
32 __u32 val; 41 __u32 val;
@@ -34,13 +43,20 @@ static __inline__ __u32 ld_le32(const volatile __u32 *addr)
34 __asm__ __volatile__ ("lwbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr)); 43 __asm__ __volatile__ ("lwbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr));
35 return val; 44 return val;
36} 45}
46#define __arch_swab32p ld_le32
37 47
38static __inline__ void st_le32(volatile __u32 *addr, const __u32 val) 48static __inline__ void st_le32(volatile __u32 *addr, const __u32 val)
39{ 49{
40 __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); 50 __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
41} 51}
42 52
43static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 value) 53static inline void __arch_swab32s(__u32 *addr)
54{
55 st_le32(addr, *addr);
56}
57#define __arch_swab32s __arch_swab32s
58
59static inline __attribute_const__ __u16 __arch_swab16(__u16 value)
44{ 60{
45 __u16 result; 61 __u16 result;
46 62
@@ -49,8 +65,9 @@ static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 value)
49 : "r" (value), "0" (value >> 8)); 65 : "r" (value), "0" (value >> 8));
50 return result; 66 return result;
51} 67}
68#define __arch_swab16 __arch_swab16
52 69
53static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 value) 70static inline __attribute_const__ __u32 __arch_swab32(__u32 value)
54{ 71{
55 __u32 result; 72 __u32 result;
56 73
@@ -61,29 +78,16 @@ static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 value)
61 : "r" (value), "0" (value >> 24)); 78 : "r" (value), "0" (value >> 24));
62 return result; 79 return result;
63} 80}
64 81#define __arch_swab32 __arch_swab32
65#define __arch__swab16(x) ___arch__swab16(x)
66#define __arch__swab32(x) ___arch__swab32(x)
67
68/* The same, but returns converted value from the location pointer by addr. */
69#define __arch__swab16p(addr) ld_le16(addr)
70#define __arch__swab32p(addr) ld_le32(addr)
71
72/* The same, but do the conversion in situ, ie. put the value back to addr. */
73#define __arch__swab16s(addr) st_le16(addr,*addr)
74#define __arch__swab32s(addr) st_le32(addr,*addr)
75 82
76#endif /* __KERNEL__ */ 83#endif /* __KERNEL__ */
77 84
78#ifndef __STRICT_ANSI__
79#define __BYTEORDER_HAS_U64__
80#ifndef __powerpc64__ 85#ifndef __powerpc64__
81#define __SWAB_64_THRU_32__ 86#define __SWAB_64_THRU_32__
82#endif /* __powerpc64__ */ 87#endif /* __powerpc64__ */
83#endif /* __STRICT_ANSI__ */
84 88
85#endif /* __GNUC__ */ 89#endif /* __GNUC__ */
86 90
87#include <linux/byteorder/big_endian.h> 91#include <linux/byteorder.h>
88 92
89#endif /* _ASM_POWERPC_BYTEORDER_H */ 93#endif /* _ASM_POWERPC_BYTEORDER_H */
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index 1e94b07a020e..4911104791c3 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -82,6 +82,7 @@ struct cpu_spec {
82 char *cpu_name; 82 char *cpu_name;
83 unsigned long cpu_features; /* Kernel features */ 83 unsigned long cpu_features; /* Kernel features */
84 unsigned int cpu_user_features; /* Userland features */ 84 unsigned int cpu_user_features; /* Userland features */
85 unsigned int mmu_features; /* MMU features */
85 86
86 /* cache line sizes */ 87 /* cache line sizes */
87 unsigned int icache_bsize; 88 unsigned int icache_bsize;
@@ -144,17 +145,14 @@ extern const char *powerpc_base_platform;
144#define CPU_FTR_USE_TB ASM_CONST(0x0000000000000040) 145#define CPU_FTR_USE_TB ASM_CONST(0x0000000000000040)
145#define CPU_FTR_L2CSR ASM_CONST(0x0000000000000080) 146#define CPU_FTR_L2CSR ASM_CONST(0x0000000000000080)
146#define CPU_FTR_601 ASM_CONST(0x0000000000000100) 147#define CPU_FTR_601 ASM_CONST(0x0000000000000100)
147#define CPU_FTR_HPTE_TABLE ASM_CONST(0x0000000000000200)
148#define CPU_FTR_CAN_NAP ASM_CONST(0x0000000000000400) 148#define CPU_FTR_CAN_NAP ASM_CONST(0x0000000000000400)
149#define CPU_FTR_L3CR ASM_CONST(0x0000000000000800) 149#define CPU_FTR_L3CR ASM_CONST(0x0000000000000800)
150#define CPU_FTR_L3_DISABLE_NAP ASM_CONST(0x0000000000001000) 150#define CPU_FTR_L3_DISABLE_NAP ASM_CONST(0x0000000000001000)
151#define CPU_FTR_NAP_DISABLE_L2_PR ASM_CONST(0x0000000000002000) 151#define CPU_FTR_NAP_DISABLE_L2_PR ASM_CONST(0x0000000000002000)
152#define CPU_FTR_DUAL_PLL_750FX ASM_CONST(0x0000000000004000) 152#define CPU_FTR_DUAL_PLL_750FX ASM_CONST(0x0000000000004000)
153#define CPU_FTR_NO_DPM ASM_CONST(0x0000000000008000) 153#define CPU_FTR_NO_DPM ASM_CONST(0x0000000000008000)
154#define CPU_FTR_HAS_HIGH_BATS ASM_CONST(0x0000000000010000)
155#define CPU_FTR_NEED_COHERENT ASM_CONST(0x0000000000020000) 154#define CPU_FTR_NEED_COHERENT ASM_CONST(0x0000000000020000)
156#define CPU_FTR_NO_BTIC ASM_CONST(0x0000000000040000) 155#define CPU_FTR_NO_BTIC ASM_CONST(0x0000000000040000)
157#define CPU_FTR_BIG_PHYS ASM_CONST(0x0000000000080000)
158#define CPU_FTR_NODSISRALIGN ASM_CONST(0x0000000000100000) 156#define CPU_FTR_NODSISRALIGN ASM_CONST(0x0000000000100000)
159#define CPU_FTR_PPC_LE ASM_CONST(0x0000000000200000) 157#define CPU_FTR_PPC_LE ASM_CONST(0x0000000000200000)
160#define CPU_FTR_REAL_LE ASM_CONST(0x0000000000400000) 158#define CPU_FTR_REAL_LE ASM_CONST(0x0000000000400000)
@@ -163,6 +161,8 @@ extern const char *powerpc_base_platform;
163#define CPU_FTR_SPE ASM_CONST(0x0000000002000000) 161#define CPU_FTR_SPE ASM_CONST(0x0000000002000000)
164#define CPU_FTR_NEED_PAIRED_STWCX ASM_CONST(0x0000000004000000) 162#define CPU_FTR_NEED_PAIRED_STWCX ASM_CONST(0x0000000004000000)
165#define CPU_FTR_LWSYNC ASM_CONST(0x0000000008000000) 163#define CPU_FTR_LWSYNC ASM_CONST(0x0000000008000000)
164#define CPU_FTR_NOEXECUTE ASM_CONST(0x0000000010000000)
165#define CPU_FTR_INDEXED_DCR ASM_CONST(0x0000000020000000)
166 166
167/* 167/*
168 * Add the 64-bit processor unique features in the top half of the word; 168 * Add the 64-bit processor unique features in the top half of the word;
@@ -177,7 +177,6 @@ extern const char *powerpc_base_platform;
177#define CPU_FTR_SLB LONG_ASM_CONST(0x0000000100000000) 177#define CPU_FTR_SLB LONG_ASM_CONST(0x0000000100000000)
178#define CPU_FTR_16M_PAGE LONG_ASM_CONST(0x0000000200000000) 178#define CPU_FTR_16M_PAGE LONG_ASM_CONST(0x0000000200000000)
179#define CPU_FTR_TLBIEL LONG_ASM_CONST(0x0000000400000000) 179#define CPU_FTR_TLBIEL LONG_ASM_CONST(0x0000000400000000)
180#define CPU_FTR_NOEXECUTE LONG_ASM_CONST(0x0000000800000000)
181#define CPU_FTR_IABR LONG_ASM_CONST(0x0000002000000000) 180#define CPU_FTR_IABR LONG_ASM_CONST(0x0000002000000000)
182#define CPU_FTR_MMCRA LONG_ASM_CONST(0x0000004000000000) 181#define CPU_FTR_MMCRA LONG_ASM_CONST(0x0000004000000000)
183#define CPU_FTR_CTRL LONG_ASM_CONST(0x0000008000000000) 182#define CPU_FTR_CTRL LONG_ASM_CONST(0x0000008000000000)
@@ -194,6 +193,7 @@ extern const char *powerpc_base_platform;
194#define CPU_FTR_VSX LONG_ASM_CONST(0x0010000000000000) 193#define CPU_FTR_VSX LONG_ASM_CONST(0x0010000000000000)
195#define CPU_FTR_SAO LONG_ASM_CONST(0x0020000000000000) 194#define CPU_FTR_SAO LONG_ASM_CONST(0x0020000000000000)
196#define CPU_FTR_CP_USE_DCBTZ LONG_ASM_CONST(0x0040000000000000) 195#define CPU_FTR_CP_USE_DCBTZ LONG_ASM_CONST(0x0040000000000000)
196#define CPU_FTR_UNALIGNED_LD_STD LONG_ASM_CONST(0x0080000000000000)
197 197
198#ifndef __ASSEMBLY__ 198#ifndef __ASSEMBLY__
199 199
@@ -264,164 +264,159 @@ extern const char *powerpc_base_platform;
264 !defined(CONFIG_POWER3) && !defined(CONFIG_POWER4) && \ 264 !defined(CONFIG_POWER3) && !defined(CONFIG_POWER4) && \
265 !defined(CONFIG_BOOKE)) 265 !defined(CONFIG_BOOKE))
266 266
267#define CPU_FTRS_PPC601 (CPU_FTR_COMMON | CPU_FTR_601 | CPU_FTR_HPTE_TABLE | \ 267#define CPU_FTRS_PPC601 (CPU_FTR_COMMON | CPU_FTR_601 | \
268 CPU_FTR_COHERENT_ICACHE | CPU_FTR_UNIFIED_ID_CACHE) 268 CPU_FTR_COHERENT_ICACHE | CPU_FTR_UNIFIED_ID_CACHE)
269#define CPU_FTRS_603 (CPU_FTR_COMMON | \ 269#define CPU_FTRS_603 (CPU_FTR_COMMON | \
270 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | \ 270 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | \
271 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE) 271 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE)
272#define CPU_FTRS_604 (CPU_FTR_COMMON | \ 272#define CPU_FTRS_604 (CPU_FTR_COMMON | \
273 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_PPC_LE) 273 CPU_FTR_USE_TB | CPU_FTR_PPC_LE)
274#define CPU_FTRS_740_NOTAU (CPU_FTR_COMMON | \ 274#define CPU_FTRS_740_NOTAU (CPU_FTR_COMMON | \
275 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 275 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
276 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE) 276 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE)
277#define CPU_FTRS_740 (CPU_FTR_COMMON | \ 277#define CPU_FTRS_740 (CPU_FTR_COMMON | \
278 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 278 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
279 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \ 279 CPU_FTR_TAU | CPU_FTR_MAYBE_CAN_NAP | \
280 CPU_FTR_PPC_LE) 280 CPU_FTR_PPC_LE)
281#define CPU_FTRS_750 (CPU_FTR_COMMON | \ 281#define CPU_FTRS_750 (CPU_FTR_COMMON | \
282 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 282 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
283 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \ 283 CPU_FTR_TAU | CPU_FTR_MAYBE_CAN_NAP | \
284 CPU_FTR_PPC_LE) 284 CPU_FTR_PPC_LE)
285#define CPU_FTRS_750CL (CPU_FTRS_750 | CPU_FTR_HAS_HIGH_BATS) 285#define CPU_FTRS_750CL (CPU_FTRS_750)
286#define CPU_FTRS_750FX1 (CPU_FTRS_750 | CPU_FTR_DUAL_PLL_750FX | CPU_FTR_NO_DPM) 286#define CPU_FTRS_750FX1 (CPU_FTRS_750 | CPU_FTR_DUAL_PLL_750FX | CPU_FTR_NO_DPM)
287#define CPU_FTRS_750FX2 (CPU_FTRS_750 | CPU_FTR_NO_DPM) 287#define CPU_FTRS_750FX2 (CPU_FTRS_750 | CPU_FTR_NO_DPM)
288#define CPU_FTRS_750FX (CPU_FTRS_750 | CPU_FTR_DUAL_PLL_750FX | \ 288#define CPU_FTRS_750FX (CPU_FTRS_750 | CPU_FTR_DUAL_PLL_750FX)
289 CPU_FTR_HAS_HIGH_BATS)
290#define CPU_FTRS_750GX (CPU_FTRS_750FX) 289#define CPU_FTRS_750GX (CPU_FTRS_750FX)
291#define CPU_FTRS_7400_NOTAU (CPU_FTR_COMMON | \ 290#define CPU_FTRS_7400_NOTAU (CPU_FTR_COMMON | \
292 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 291 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
293 CPU_FTR_ALTIVEC_COMP | CPU_FTR_HPTE_TABLE | \ 292 CPU_FTR_ALTIVEC_COMP | \
294 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE) 293 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE)
295#define CPU_FTRS_7400 (CPU_FTR_COMMON | \ 294#define CPU_FTRS_7400 (CPU_FTR_COMMON | \
296 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 295 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
297 CPU_FTR_TAU | CPU_FTR_ALTIVEC_COMP | CPU_FTR_HPTE_TABLE | \ 296 CPU_FTR_TAU | CPU_FTR_ALTIVEC_COMP | \
298 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE) 297 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE)
299#define CPU_FTRS_7450_20 (CPU_FTR_COMMON | \ 298#define CPU_FTRS_7450_20 (CPU_FTR_COMMON | \
300 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 299 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
301 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 300 CPU_FTR_L3CR | CPU_FTR_SPEC7450 | \
302 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX) 301 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX)
303#define CPU_FTRS_7450_21 (CPU_FTR_COMMON | \ 302#define CPU_FTRS_7450_21 (CPU_FTR_COMMON | \
304 CPU_FTR_USE_TB | \ 303 CPU_FTR_USE_TB | \
305 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 304 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
306 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 305 CPU_FTR_L3CR | CPU_FTR_SPEC7450 | \
307 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \ 306 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \
308 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX) 307 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX)
309#define CPU_FTRS_7450_23 (CPU_FTR_COMMON | \ 308#define CPU_FTRS_7450_23 (CPU_FTR_COMMON | \
310 CPU_FTR_USE_TB | CPU_FTR_NEED_PAIRED_STWCX | \ 309 CPU_FTR_USE_TB | CPU_FTR_NEED_PAIRED_STWCX | \
311 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 310 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
312 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 311 CPU_FTR_L3CR | CPU_FTR_SPEC7450 | \
313 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) 312 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
314#define CPU_FTRS_7455_1 (CPU_FTR_COMMON | \ 313#define CPU_FTRS_7455_1 (CPU_FTR_COMMON | \
315 CPU_FTR_USE_TB | CPU_FTR_NEED_PAIRED_STWCX | \ 314 CPU_FTR_USE_TB | CPU_FTR_NEED_PAIRED_STWCX | \
316 CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR | \ 315 CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR | \
317 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_HAS_HIGH_BATS | \ 316 CPU_FTR_SPEC7450 | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
318 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
319#define CPU_FTRS_7455_20 (CPU_FTR_COMMON | \ 317#define CPU_FTRS_7455_20 (CPU_FTR_COMMON | \
320 CPU_FTR_USE_TB | CPU_FTR_NEED_PAIRED_STWCX | \ 318 CPU_FTR_USE_TB | CPU_FTR_NEED_PAIRED_STWCX | \
321 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 319 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
322 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 320 CPU_FTR_L3CR | CPU_FTR_SPEC7450 | \
323 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \ 321 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \
324 CPU_FTR_NEED_COHERENT | CPU_FTR_HAS_HIGH_BATS | CPU_FTR_PPC_LE) 322 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
325#define CPU_FTRS_7455 (CPU_FTR_COMMON | \ 323#define CPU_FTRS_7455 (CPU_FTR_COMMON | \
326 CPU_FTR_USE_TB | \ 324 CPU_FTR_USE_TB | \
327 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 325 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
328 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 326 CPU_FTR_L3CR | CPU_FTR_SPEC7450 | CPU_FTR_NAP_DISABLE_L2_PR | \
329 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
330 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX) 327 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX)
331#define CPU_FTRS_7447_10 (CPU_FTR_COMMON | \ 328#define CPU_FTRS_7447_10 (CPU_FTR_COMMON | \
332 CPU_FTR_USE_TB | \ 329 CPU_FTR_USE_TB | \
333 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 330 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
334 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 331 CPU_FTR_L3CR | CPU_FTR_SPEC7450 | CPU_FTR_NAP_DISABLE_L2_PR | \
335 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
336 CPU_FTR_NEED_COHERENT | CPU_FTR_NO_BTIC | CPU_FTR_PPC_LE | \ 332 CPU_FTR_NEED_COHERENT | CPU_FTR_NO_BTIC | CPU_FTR_PPC_LE | \
337 CPU_FTR_NEED_PAIRED_STWCX) 333 CPU_FTR_NEED_PAIRED_STWCX)
338#define CPU_FTRS_7447 (CPU_FTR_COMMON | \ 334#define CPU_FTRS_7447 (CPU_FTR_COMMON | \
339 CPU_FTR_USE_TB | \ 335 CPU_FTR_USE_TB | \
340 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 336 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
341 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 337 CPU_FTR_L3CR | CPU_FTR_SPEC7450 | CPU_FTR_NAP_DISABLE_L2_PR | \
342 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
343 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX) 338 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX)
344#define CPU_FTRS_7447A (CPU_FTR_COMMON | \ 339#define CPU_FTRS_7447A (CPU_FTR_COMMON | \
345 CPU_FTR_USE_TB | \ 340 CPU_FTR_USE_TB | \
346 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 341 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
347 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 342 CPU_FTR_SPEC7450 | CPU_FTR_NAP_DISABLE_L2_PR | \
348 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
349 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX) 343 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX)
350#define CPU_FTRS_7448 (CPU_FTR_COMMON | \ 344#define CPU_FTRS_7448 (CPU_FTR_COMMON | \
351 CPU_FTR_USE_TB | \ 345 CPU_FTR_USE_TB | \
352 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 346 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
353 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 347 CPU_FTR_SPEC7450 | CPU_FTR_NAP_DISABLE_L2_PR | \
354 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
355 CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX) 348 CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX)
356#define CPU_FTRS_82XX (CPU_FTR_COMMON | \ 349#define CPU_FTRS_82XX (CPU_FTR_COMMON | \
357 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB) 350 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB)
358#define CPU_FTRS_G2_LE (CPU_FTR_COMMON | CPU_FTR_MAYBE_CAN_DOZE | \ 351#define CPU_FTRS_G2_LE (CPU_FTR_COMMON | CPU_FTR_MAYBE_CAN_DOZE | \
359 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS) 352 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP)
360#define CPU_FTRS_E300 (CPU_FTR_MAYBE_CAN_DOZE | \ 353#define CPU_FTRS_E300 (CPU_FTR_MAYBE_CAN_DOZE | \
361 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS | \ 354 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | \
362 CPU_FTR_COMMON) 355 CPU_FTR_COMMON)
363#define CPU_FTRS_E300C2 (CPU_FTR_MAYBE_CAN_DOZE | \ 356#define CPU_FTRS_E300C2 (CPU_FTR_MAYBE_CAN_DOZE | \
364 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS | \ 357 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | \
365 CPU_FTR_COMMON | CPU_FTR_FPU_UNAVAILABLE) 358 CPU_FTR_COMMON | CPU_FTR_FPU_UNAVAILABLE)
366#define CPU_FTRS_CLASSIC32 (CPU_FTR_COMMON | \ 359#define CPU_FTRS_CLASSIC32 (CPU_FTR_COMMON | CPU_FTR_USE_TB)
367 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE)
368#define CPU_FTRS_8XX (CPU_FTR_USE_TB) 360#define CPU_FTRS_8XX (CPU_FTR_USE_TB)
369#define CPU_FTRS_40X (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN) 361#define CPU_FTRS_40X (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN | CPU_FTR_NOEXECUTE)
370#define CPU_FTRS_44X (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN) 362#define CPU_FTRS_44X (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN | CPU_FTR_NOEXECUTE)
363#define CPU_FTRS_440x6 (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN | CPU_FTR_NOEXECUTE | \
364 CPU_FTR_INDEXED_DCR)
371#define CPU_FTRS_E200 (CPU_FTR_USE_TB | CPU_FTR_SPE_COMP | \ 365#define CPU_FTRS_E200 (CPU_FTR_USE_TB | CPU_FTR_SPE_COMP | \
372 CPU_FTR_NODSISRALIGN | CPU_FTR_COHERENT_ICACHE | \ 366 CPU_FTR_NODSISRALIGN | CPU_FTR_COHERENT_ICACHE | \
373 CPU_FTR_UNIFIED_ID_CACHE) 367 CPU_FTR_UNIFIED_ID_CACHE | CPU_FTR_NOEXECUTE)
374#define CPU_FTRS_E500 (CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | \ 368#define CPU_FTRS_E500 (CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | \
375 CPU_FTR_SPE_COMP | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_NODSISRALIGN) 369 CPU_FTR_SPE_COMP | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_NODSISRALIGN | \
370 CPU_FTR_NOEXECUTE)
376#define CPU_FTRS_E500_2 (CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | \ 371#define CPU_FTRS_E500_2 (CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | \
377 CPU_FTR_SPE_COMP | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_BIG_PHYS | \ 372 CPU_FTR_SPE_COMP | CPU_FTR_MAYBE_CAN_NAP | \
378 CPU_FTR_NODSISRALIGN) 373 CPU_FTR_NODSISRALIGN | CPU_FTR_NOEXECUTE)
379#define CPU_FTRS_E500MC (CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | \ 374#define CPU_FTRS_E500MC (CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | \
380 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_BIG_PHYS | CPU_FTR_NODSISRALIGN | \ 375 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_NODSISRALIGN | \
381 CPU_FTR_L2CSR | CPU_FTR_LWSYNC) 376 CPU_FTR_L2CSR | CPU_FTR_LWSYNC | CPU_FTR_NOEXECUTE)
382#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN) 377#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN)
383 378
384/* 64-bit CPUs */ 379/* 64-bit CPUs */
385#define CPU_FTRS_POWER3 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 380#define CPU_FTRS_POWER3 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
386 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | CPU_FTR_PPC_LE) 381 CPU_FTR_IABR | CPU_FTR_PPC_LE)
387#define CPU_FTRS_RS64 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 382#define CPU_FTRS_RS64 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
388 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | \ 383 CPU_FTR_IABR | \
389 CPU_FTR_MMCRA | CPU_FTR_CTRL) 384 CPU_FTR_MMCRA | CPU_FTR_CTRL)
390#define CPU_FTRS_POWER4 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 385#define CPU_FTRS_POWER4 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
391 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 386 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
392 CPU_FTR_MMCRA | CPU_FTR_CP_USE_DCBTZ) 387 CPU_FTR_MMCRA | CPU_FTR_CP_USE_DCBTZ)
393#define CPU_FTRS_PPC970 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 388#define CPU_FTRS_PPC970 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
394 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 389 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
395 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA | \ 390 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA | \
396 CPU_FTR_CP_USE_DCBTZ) 391 CPU_FTR_CP_USE_DCBTZ)
397#define CPU_FTRS_POWER5 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 392#define CPU_FTRS_POWER5 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
398 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 393 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
399 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 394 CPU_FTR_MMCRA | CPU_FTR_SMT | \
400 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ 395 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
401 CPU_FTR_PURR) 396 CPU_FTR_PURR)
402#define CPU_FTRS_POWER6 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 397#define CPU_FTRS_POWER6 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
403 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 398 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
404 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 399 CPU_FTR_MMCRA | CPU_FTR_SMT | \
405 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ 400 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
406 CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ 401 CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
407 CPU_FTR_DSCR) 402 CPU_FTR_DSCR | CPU_FTR_UNALIGNED_LD_STD)
408#define CPU_FTRS_POWER7 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 403#define CPU_FTRS_POWER7 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
409 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 404 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
410 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 405 CPU_FTR_MMCRA | CPU_FTR_SMT | \
411 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ 406 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
412 CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ 407 CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
413 CPU_FTR_DSCR | CPU_FTR_SAO) 408 CPU_FTR_DSCR | CPU_FTR_SAO)
414#define CPU_FTRS_CELL (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 409#define CPU_FTRS_CELL (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
415 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 410 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
416 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ 411 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
417 CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE | \ 412 CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE | \
418 CPU_FTR_CELL_TB_BUG | CPU_FTR_CP_USE_DCBTZ) 413 CPU_FTR_CELL_TB_BUG | CPU_FTR_CP_USE_DCBTZ | \
414 CPU_FTR_UNALIGNED_LD_STD)
419#define CPU_FTRS_PA6T (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 415#define CPU_FTRS_PA6T (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
420 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 416 CPU_FTR_PPCAS_ARCH_V2 | \
421 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CI_LARGE_PAGE | \ 417 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CI_LARGE_PAGE | \
422 CPU_FTR_PURR | CPU_FTR_REAL_LE | CPU_FTR_NO_SLBIE_B) 418 CPU_FTR_PURR | CPU_FTR_REAL_LE | CPU_FTR_NO_SLBIE_B)
423#define CPU_FTRS_COMPATIBLE (CPU_FTR_USE_TB | \ 419#define CPU_FTRS_COMPATIBLE (CPU_FTR_USE_TB | CPU_FTR_PPCAS_ARCH_V2)
424 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2)
425 420
426#ifdef __powerpc64__ 421#ifdef __powerpc64__
427#define CPU_FTRS_POSSIBLE \ 422#define CPU_FTRS_POSSIBLE \
@@ -452,7 +447,7 @@ enum {
452 CPU_FTRS_40X | 447 CPU_FTRS_40X |
453#endif 448#endif
454#ifdef CONFIG_44x 449#ifdef CONFIG_44x
455 CPU_FTRS_44X | 450 CPU_FTRS_44X | CPU_FTRS_440x6 |
456#endif 451#endif
457#ifdef CONFIG_E200 452#ifdef CONFIG_E200
458 CPU_FTRS_E200 | 453 CPU_FTRS_E200 |
@@ -492,7 +487,7 @@ enum {
492 CPU_FTRS_40X & 487 CPU_FTRS_40X &
493#endif 488#endif
494#ifdef CONFIG_44x 489#ifdef CONFIG_44x
495 CPU_FTRS_44X & 490 CPU_FTRS_44X & CPU_FTRS_440x6 &
496#endif 491#endif
497#ifdef CONFIG_E200 492#ifdef CONFIG_E200
498 CPU_FTRS_E200 & 493 CPU_FTRS_E200 &
diff --git a/arch/powerpc/include/asm/dcr-native.h b/arch/powerpc/include/asm/dcr-native.h
index 72d2b72c7390..7d2e6235726d 100644
--- a/arch/powerpc/include/asm/dcr-native.h
+++ b/arch/powerpc/include/asm/dcr-native.h
@@ -23,6 +23,7 @@
23#ifndef __ASSEMBLY__ 23#ifndef __ASSEMBLY__
24 24
25#include <linux/spinlock.h> 25#include <linux/spinlock.h>
26#include <asm/cputable.h>
26 27
27typedef struct { 28typedef struct {
28 unsigned int base; 29 unsigned int base;
@@ -39,23 +40,45 @@ static inline bool dcr_map_ok_native(dcr_host_native_t host)
39#define dcr_read_native(host, dcr_n) mfdcr(dcr_n + host.base) 40#define dcr_read_native(host, dcr_n) mfdcr(dcr_n + host.base)
40#define dcr_write_native(host, dcr_n, value) mtdcr(dcr_n + host.base, value) 41#define dcr_write_native(host, dcr_n, value) mtdcr(dcr_n + host.base, value)
41 42
42/* Device Control Registers */ 43/* Table based DCR accessors */
43void __mtdcr(int reg, unsigned int val); 44extern void __mtdcr(unsigned int reg, unsigned int val);
44unsigned int __mfdcr(int reg); 45extern unsigned int __mfdcr(unsigned int reg);
46
47/* mfdcrx/mtdcrx instruction based accessors. We hand code
48 * the opcodes in order not to depend on newer binutils
49 */
50static inline unsigned int mfdcrx(unsigned int reg)
51{
52 unsigned int ret;
53 asm volatile(".long 0x7c000206 | (%0 << 21) | (%1 << 16)"
54 : "=r" (ret) : "r" (reg));
55 return ret;
56}
57
58static inline void mtdcrx(unsigned int reg, unsigned int val)
59{
60 asm volatile(".long 0x7c000306 | (%0 << 21) | (%1 << 16)"
61 : : "r" (val), "r" (reg));
62}
63
45#define mfdcr(rn) \ 64#define mfdcr(rn) \
46 ({unsigned int rval; \ 65 ({unsigned int rval; \
47 if (__builtin_constant_p(rn)) \ 66 if (__builtin_constant_p(rn) && rn < 1024) \
48 asm volatile("mfdcr %0," __stringify(rn) \ 67 asm volatile("mfdcr %0," __stringify(rn) \
49 : "=r" (rval)); \ 68 : "=r" (rval)); \
69 else if (likely(cpu_has_feature(CPU_FTR_INDEXED_DCR))) \
70 rval = mfdcrx(rn); \
50 else \ 71 else \
51 rval = __mfdcr(rn); \ 72 rval = __mfdcr(rn); \
52 rval;}) 73 rval;})
53 74
54#define mtdcr(rn, v) \ 75#define mtdcr(rn, v) \
55do { \ 76do { \
56 if (__builtin_constant_p(rn)) \ 77 if (__builtin_constant_p(rn) && rn < 1024) \
57 asm volatile("mtdcr " __stringify(rn) ",%0" \ 78 asm volatile("mtdcr " __stringify(rn) ",%0" \
58 : : "r" (v)); \ 79 : : "r" (v)); \
80 else if (likely(cpu_has_feature(CPU_FTR_INDEXED_DCR))) \
81 mtdcrx(rn, v); \
59 else \ 82 else \
60 __mtdcr(rn, v); \ 83 __mtdcr(rn, v); \
61} while (0) 84} while (0)
@@ -69,8 +92,13 @@ static inline unsigned __mfdcri(int base_addr, int base_data, int reg)
69 unsigned int val; 92 unsigned int val;
70 93
71 spin_lock_irqsave(&dcr_ind_lock, flags); 94 spin_lock_irqsave(&dcr_ind_lock, flags);
72 __mtdcr(base_addr, reg); 95 if (cpu_has_feature(CPU_FTR_INDEXED_DCR)) {
73 val = __mfdcr(base_data); 96 mtdcrx(base_addr, reg);
97 val = mfdcrx(base_data);
98 } else {
99 __mtdcr(base_addr, reg);
100 val = __mfdcr(base_data);
101 }
74 spin_unlock_irqrestore(&dcr_ind_lock, flags); 102 spin_unlock_irqrestore(&dcr_ind_lock, flags);
75 return val; 103 return val;
76} 104}
@@ -81,8 +109,13 @@ static inline void __mtdcri(int base_addr, int base_data, int reg,
81 unsigned long flags; 109 unsigned long flags;
82 110
83 spin_lock_irqsave(&dcr_ind_lock, flags); 111 spin_lock_irqsave(&dcr_ind_lock, flags);
84 __mtdcr(base_addr, reg); 112 if (cpu_has_feature(CPU_FTR_INDEXED_DCR)) {
85 __mtdcr(base_data, val); 113 mtdcrx(base_addr, reg);
114 mtdcrx(base_data, val);
115 } else {
116 __mtdcr(base_addr, reg);
117 __mtdcr(base_data, val);
118 }
86 spin_unlock_irqrestore(&dcr_ind_lock, flags); 119 spin_unlock_irqrestore(&dcr_ind_lock, flags);
87} 120}
88 121
@@ -93,9 +126,15 @@ static inline void __dcri_clrset(int base_addr, int base_data, int reg,
93 unsigned int val; 126 unsigned int val;
94 127
95 spin_lock_irqsave(&dcr_ind_lock, flags); 128 spin_lock_irqsave(&dcr_ind_lock, flags);
96 __mtdcr(base_addr, reg); 129 if (cpu_has_feature(CPU_FTR_INDEXED_DCR)) {
97 val = (__mfdcr(base_data) & ~clr) | set; 130 mtdcrx(base_addr, reg);
98 __mtdcr(base_data, val); 131 val = (mfdcrx(base_data) & ~clr) | set;
132 mtdcrx(base_data, val);
133 } else {
134 __mtdcr(base_addr, reg);
135 val = (__mfdcr(base_data) & ~clr) | set;
136 __mtdcr(base_data, val);
137 }
99 spin_unlock_irqrestore(&dcr_ind_lock, flags); 138 spin_unlock_irqrestore(&dcr_ind_lock, flags);
100} 139}
101 140
diff --git a/arch/powerpc/include/asm/dcr.h b/arch/powerpc/include/asm/dcr.h
index d13fb68bb5c0..9d6851cfb841 100644
--- a/arch/powerpc/include/asm/dcr.h
+++ b/arch/powerpc/include/asm/dcr.h
@@ -68,9 +68,9 @@ typedef dcr_host_mmio_t dcr_host_t;
68 * additional helpers to read the DCR * base from the device-tree 68 * additional helpers to read the DCR * base from the device-tree
69 */ 69 */
70struct device_node; 70struct device_node;
71extern unsigned int dcr_resource_start(struct device_node *np, 71extern unsigned int dcr_resource_start(const struct device_node *np,
72 unsigned int index); 72 unsigned int index);
73extern unsigned int dcr_resource_len(struct device_node *np, 73extern unsigned int dcr_resource_len(const struct device_node *np,
74 unsigned int index); 74 unsigned int index);
75#endif /* CONFIG_PPC_DCR */ 75#endif /* CONFIG_PPC_DCR */
76#endif /* __ASSEMBLY__ */ 76#endif /* __ASSEMBLY__ */
diff --git a/arch/powerpc/include/asm/device.h b/arch/powerpc/include/asm/device.h
index dfd504caccc1..7d2277cef09a 100644
--- a/arch/powerpc/include/asm/device.h
+++ b/arch/powerpc/include/asm/device.h
@@ -18,4 +18,16 @@ struct dev_archdata {
18 void *dma_data; 18 void *dma_data;
19}; 19};
20 20
21static inline void dev_archdata_set_node(struct dev_archdata *ad,
22 struct device_node *np)
23{
24 ad->of_node = np;
25}
26
27static inline struct device_node *
28dev_archdata_get_node(const struct dev_archdata *ad)
29{
30 return ad->of_node;
31}
32
21#endif /* _ASM_POWERPC_DEVICE_H */ 33#endif /* _ASM_POWERPC_DEVICE_H */
diff --git a/arch/powerpc/include/asm/disassemble.h b/arch/powerpc/include/asm/disassemble.h
new file mode 100644
index 000000000000..9b198d1b3b2b
--- /dev/null
+++ b/arch/powerpc/include/asm/disassemble.h
@@ -0,0 +1,80 @@
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, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2008
16 *
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18 */
19
20#ifndef __ASM_PPC_DISASSEMBLE_H__
21#define __ASM_PPC_DISASSEMBLE_H__
22
23#include <linux/types.h>
24
25static inline unsigned int get_op(u32 inst)
26{
27 return inst >> 26;
28}
29
30static inline unsigned int get_xop(u32 inst)
31{
32 return (inst >> 1) & 0x3ff;
33}
34
35static inline unsigned int get_sprn(u32 inst)
36{
37 return ((inst >> 16) & 0x1f) | ((inst >> 6) & 0x3e0);
38}
39
40static inline unsigned int get_dcrn(u32 inst)
41{
42 return ((inst >> 16) & 0x1f) | ((inst >> 6) & 0x3e0);
43}
44
45static inline unsigned int get_rt(u32 inst)
46{
47 return (inst >> 21) & 0x1f;
48}
49
50static inline unsigned int get_rs(u32 inst)
51{
52 return (inst >> 21) & 0x1f;
53}
54
55static inline unsigned int get_ra(u32 inst)
56{
57 return (inst >> 16) & 0x1f;
58}
59
60static inline unsigned int get_rb(u32 inst)
61{
62 return (inst >> 11) & 0x1f;
63}
64
65static inline unsigned int get_rc(u32 inst)
66{
67 return inst & 0x1;
68}
69
70static inline unsigned int get_ws(u32 inst)
71{
72 return (inst >> 11) & 0x1f;
73}
74
75static inline unsigned int get_d(u32 inst)
76{
77 return inst & 0xffff;
78}
79
80#endif /* __ASM_PPC_DISASSEMBLE_H__ */
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index fddb229bd74f..86cef7ddc8d5 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -60,12 +60,6 @@ struct dma_mapping_ops {
60 dma_addr_t *dma_handle, gfp_t flag); 60 dma_addr_t *dma_handle, gfp_t flag);
61 void (*free_coherent)(struct device *dev, size_t size, 61 void (*free_coherent)(struct device *dev, size_t size,
62 void *vaddr, dma_addr_t dma_handle); 62 void *vaddr, dma_addr_t dma_handle);
63 dma_addr_t (*map_single)(struct device *dev, void *ptr,
64 size_t size, enum dma_data_direction direction,
65 struct dma_attrs *attrs);
66 void (*unmap_single)(struct device *dev, dma_addr_t dma_addr,
67 size_t size, enum dma_data_direction direction,
68 struct dma_attrs *attrs);
69 int (*map_sg)(struct device *dev, struct scatterlist *sg, 63 int (*map_sg)(struct device *dev, struct scatterlist *sg,
70 int nents, enum dma_data_direction direction, 64 int nents, enum dma_data_direction direction,
71 struct dma_attrs *attrs); 65 struct dma_attrs *attrs);
@@ -82,6 +76,22 @@ struct dma_mapping_ops {
82 dma_addr_t dma_address, size_t size, 76 dma_addr_t dma_address, size_t size,
83 enum dma_data_direction direction, 77 enum dma_data_direction direction,
84 struct dma_attrs *attrs); 78 struct dma_attrs *attrs);
79#ifdef CONFIG_PPC_NEED_DMA_SYNC_OPS
80 void (*sync_single_range_for_cpu)(struct device *hwdev,
81 dma_addr_t dma_handle, unsigned long offset,
82 size_t size,
83 enum dma_data_direction direction);
84 void (*sync_single_range_for_device)(struct device *hwdev,
85 dma_addr_t dma_handle, unsigned long offset,
86 size_t size,
87 enum dma_data_direction direction);
88 void (*sync_sg_for_cpu)(struct device *hwdev,
89 struct scatterlist *sg, int nelems,
90 enum dma_data_direction direction);
91 void (*sync_sg_for_device)(struct device *hwdev,
92 struct scatterlist *sg, int nelems,
93 enum dma_data_direction direction);
94#endif
85}; 95};
86 96
87/* 97/*
@@ -149,10 +159,9 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)
149} 159}
150 160
151/* 161/*
152 * TODO: map_/unmap_single will ideally go away, to be completely 162 * map_/unmap_single actually call through to map/unmap_page now that all the
153 * replaced by map/unmap_page. Until then, we allow dma_ops to have 163 * dma_mapping_ops have been converted over. We just have to get the page and
154 * one or the other, or both by checking to see if the specific 164 * offset to pass through to map_page
155 * function requested exists; and if not, falling back on the other set.
156 */ 165 */
157static inline dma_addr_t dma_map_single_attrs(struct device *dev, 166static inline dma_addr_t dma_map_single_attrs(struct device *dev,
158 void *cpu_addr, 167 void *cpu_addr,
@@ -164,10 +173,6 @@ static inline dma_addr_t dma_map_single_attrs(struct device *dev,
164 173
165 BUG_ON(!dma_ops); 174 BUG_ON(!dma_ops);
166 175
167 if (dma_ops->map_single)
168 return dma_ops->map_single(dev, cpu_addr, size, direction,
169 attrs);
170
171 return dma_ops->map_page(dev, virt_to_page(cpu_addr), 176 return dma_ops->map_page(dev, virt_to_page(cpu_addr),
172 (unsigned long)cpu_addr % PAGE_SIZE, size, 177 (unsigned long)cpu_addr % PAGE_SIZE, size,
173 direction, attrs); 178 direction, attrs);
@@ -183,11 +188,6 @@ static inline void dma_unmap_single_attrs(struct device *dev,
183 188
184 BUG_ON(!dma_ops); 189 BUG_ON(!dma_ops);
185 190
186 if (dma_ops->unmap_single) {
187 dma_ops->unmap_single(dev, dma_addr, size, direction, attrs);
188 return;
189 }
190
191 dma_ops->unmap_page(dev, dma_addr, size, direction, attrs); 191 dma_ops->unmap_page(dev, dma_addr, size, direction, attrs);
192} 192}
193 193
@@ -201,12 +201,7 @@ static inline dma_addr_t dma_map_page_attrs(struct device *dev,
201 201
202 BUG_ON(!dma_ops); 202 BUG_ON(!dma_ops);
203 203
204 if (dma_ops->map_page) 204 return dma_ops->map_page(dev, page, offset, size, direction, attrs);
205 return dma_ops->map_page(dev, page, offset, size, direction,
206 attrs);
207
208 return dma_ops->map_single(dev, page_address(page) + offset, size,
209 direction, attrs);
210} 205}
211 206
212static inline void dma_unmap_page_attrs(struct device *dev, 207static inline void dma_unmap_page_attrs(struct device *dev,
@@ -219,12 +214,7 @@ static inline void dma_unmap_page_attrs(struct device *dev,
219 214
220 BUG_ON(!dma_ops); 215 BUG_ON(!dma_ops);
221 216
222 if (dma_ops->unmap_page) { 217 dma_ops->unmap_page(dev, dma_address, size, direction, attrs);
223 dma_ops->unmap_page(dev, dma_address, size, direction, attrs);
224 return;
225 }
226
227 dma_ops->unmap_single(dev, dma_address, size, direction, attrs);
228} 218}
229 219
230static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, 220static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
@@ -308,47 +298,107 @@ static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
308 dma_unmap_sg_attrs(dev, sg, nhwentries, direction, NULL); 298 dma_unmap_sg_attrs(dev, sg, nhwentries, direction, NULL);
309} 299}
310 300
301#ifdef CONFIG_PPC_NEED_DMA_SYNC_OPS
311static inline void dma_sync_single_for_cpu(struct device *dev, 302static inline void dma_sync_single_for_cpu(struct device *dev,
312 dma_addr_t dma_handle, size_t size, 303 dma_addr_t dma_handle, size_t size,
313 enum dma_data_direction direction) 304 enum dma_data_direction direction)
314{ 305{
315 BUG_ON(direction == DMA_NONE); 306 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
316 __dma_sync(bus_to_virt(dma_handle), size, direction); 307
308 BUG_ON(!dma_ops);
309 dma_ops->sync_single_range_for_cpu(dev, dma_handle, 0,
310 size, direction);
317} 311}
318 312
319static inline void dma_sync_single_for_device(struct device *dev, 313static inline void dma_sync_single_for_device(struct device *dev,
320 dma_addr_t dma_handle, size_t size, 314 dma_addr_t dma_handle, size_t size,
321 enum dma_data_direction direction) 315 enum dma_data_direction direction)
322{ 316{
323 BUG_ON(direction == DMA_NONE); 317 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
324 __dma_sync(bus_to_virt(dma_handle), size, direction); 318
319 BUG_ON(!dma_ops);
320 dma_ops->sync_single_range_for_device(dev, dma_handle,
321 0, size, direction);
325} 322}
326 323
327static inline void dma_sync_sg_for_cpu(struct device *dev, 324static inline void dma_sync_sg_for_cpu(struct device *dev,
328 struct scatterlist *sgl, int nents, 325 struct scatterlist *sgl, int nents,
329 enum dma_data_direction direction) 326 enum dma_data_direction direction)
330{ 327{
331 struct scatterlist *sg; 328 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
332 int i;
333 329
334 BUG_ON(direction == DMA_NONE); 330 BUG_ON(!dma_ops);
331 dma_ops->sync_sg_for_cpu(dev, sgl, nents, direction);
332}
333
334static inline void dma_sync_sg_for_device(struct device *dev,
335 struct scatterlist *sgl, int nents,
336 enum dma_data_direction direction)
337{
338 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
339
340 BUG_ON(!dma_ops);
341 dma_ops->sync_sg_for_device(dev, sgl, nents, direction);
342}
343
344static inline void dma_sync_single_range_for_cpu(struct device *dev,
345 dma_addr_t dma_handle, unsigned long offset, size_t size,
346 enum dma_data_direction direction)
347{
348 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
335 349
336 for_each_sg(sgl, sg, nents, i) 350 BUG_ON(!dma_ops);
337 __dma_sync_page(sg_page(sg), sg->offset, sg->length, direction); 351 dma_ops->sync_single_range_for_cpu(dev, dma_handle,
352 offset, size, direction);
353}
354
355static inline void dma_sync_single_range_for_device(struct device *dev,
356 dma_addr_t dma_handle, unsigned long offset, size_t size,
357 enum dma_data_direction direction)
358{
359 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
360
361 BUG_ON(!dma_ops);
362 dma_ops->sync_single_range_for_device(dev, dma_handle, offset,
363 size, direction);
364}
365#else /* CONFIG_PPC_NEED_DMA_SYNC_OPS */
366static inline void dma_sync_single_for_cpu(struct device *dev,
367 dma_addr_t dma_handle, size_t size,
368 enum dma_data_direction direction)
369{
370}
371
372static inline void dma_sync_single_for_device(struct device *dev,
373 dma_addr_t dma_handle, size_t size,
374 enum dma_data_direction direction)
375{
376}
377
378static inline void dma_sync_sg_for_cpu(struct device *dev,
379 struct scatterlist *sgl, int nents,
380 enum dma_data_direction direction)
381{
338} 382}
339 383
340static inline void dma_sync_sg_for_device(struct device *dev, 384static inline void dma_sync_sg_for_device(struct device *dev,
341 struct scatterlist *sgl, int nents, 385 struct scatterlist *sgl, int nents,
342 enum dma_data_direction direction) 386 enum dma_data_direction direction)
343{ 387{
344 struct scatterlist *sg; 388}
345 int i;
346 389
347 BUG_ON(direction == DMA_NONE); 390static inline void dma_sync_single_range_for_cpu(struct device *dev,
391 dma_addr_t dma_handle, unsigned long offset, size_t size,
392 enum dma_data_direction direction)
393{
394}
348 395
349 for_each_sg(sgl, sg, nents, i) 396static inline void dma_sync_single_range_for_device(struct device *dev,
350 __dma_sync_page(sg_page(sg), sg->offset, sg->length, direction); 397 dma_addr_t dma_handle, unsigned long offset, size_t size,
398 enum dma_data_direction direction)
399{
351} 400}
401#endif
352 402
353static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) 403static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
354{ 404{
@@ -382,22 +432,6 @@ static inline int dma_get_cache_alignment(void)
382#endif 432#endif
383} 433}
384 434
385static inline void dma_sync_single_range_for_cpu(struct device *dev,
386 dma_addr_t dma_handle, unsigned long offset, size_t size,
387 enum dma_data_direction direction)
388{
389 /* just sync everything for now */
390 dma_sync_single_for_cpu(dev, dma_handle, offset + size, direction);
391}
392
393static inline void dma_sync_single_range_for_device(struct device *dev,
394 dma_addr_t dma_handle, unsigned long offset, size_t size,
395 enum dma_data_direction direction)
396{
397 /* just sync everything for now */
398 dma_sync_single_for_device(dev, dma_handle, offset + size, direction);
399}
400
401static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, 435static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
402 enum dma_data_direction direction) 436 enum dma_data_direction direction)
403{ 437{
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index b886bec67016..66ea9b8b95c5 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -17,8 +17,8 @@
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19 19
20#ifndef _PPC64_EEH_H 20#ifndef _POWERPC_EEH_H
21#define _PPC64_EEH_H 21#define _POWERPC_EEH_H
22#ifdef __KERNEL__ 22#ifdef __KERNEL__
23 23
24#include <linux/init.h> 24#include <linux/init.h>
@@ -110,6 +110,7 @@ static inline void eeh_remove_bus_device(struct pci_dev *dev) { }
110#define EEH_IO_ERROR_VALUE(size) (-1UL) 110#define EEH_IO_ERROR_VALUE(size) (-1UL)
111#endif /* CONFIG_EEH */ 111#endif /* CONFIG_EEH */
112 112
113#ifdef CONFIG_PPC64
113/* 114/*
114 * MMIO read/write operations with EEH support. 115 * MMIO read/write operations with EEH support.
115 */ 116 */
@@ -207,5 +208,6 @@ static inline void eeh_readsl(const volatile void __iomem *addr, void * buf,
207 eeh_check_failure(addr, *(u32*)buf); 208 eeh_check_failure(addr, *(u32*)buf);
208} 209}
209 210
211#endif /* CONFIG_PPC64 */
210#endif /* __KERNEL__ */ 212#endif /* __KERNEL__ */
211#endif /* _PPC64_EEH_H */ 213#endif /* _POWERPC_EEH_H */
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index d812929390e4..cd46f023ec6d 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -267,7 +267,7 @@ extern int ucache_bsize;
267#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 267#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
268struct linux_binprm; 268struct linux_binprm;
269extern int arch_setup_additional_pages(struct linux_binprm *bprm, 269extern int arch_setup_additional_pages(struct linux_binprm *bprm,
270 int executable_stack); 270 int uses_interp);
271#define VDSO_AUX_ENT(a,b) NEW_AUX_ENT(a,b); 271#define VDSO_AUX_ENT(a,b) NEW_AUX_ENT(a,b);
272 272
273#endif /* __KERNEL__ */ 273#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/feature-fixups.h b/arch/powerpc/include/asm/feature-fixups.h
index a1029967620b..e4094a5cb05b 100644
--- a/arch/powerpc/include/asm/feature-fixups.h
+++ b/arch/powerpc/include/asm/feature-fixups.h
@@ -81,6 +81,36 @@ label##5: \
81#define ALT_FTR_SECTION_END_IFCLR(msk) \ 81#define ALT_FTR_SECTION_END_IFCLR(msk) \
82 ALT_FTR_SECTION_END_NESTED_IFCLR(msk, 97) 82 ALT_FTR_SECTION_END_NESTED_IFCLR(msk, 97)
83 83
84/* MMU feature dependent sections */
85#define BEGIN_MMU_FTR_SECTION_NESTED(label) START_FTR_SECTION(label)
86#define BEGIN_MMU_FTR_SECTION START_FTR_SECTION(97)
87
88#define END_MMU_FTR_SECTION_NESTED(msk, val, label) \
89 FTR_SECTION_ELSE_NESTED(label) \
90 MAKE_FTR_SECTION_ENTRY(msk, val, label, __mmu_ftr_fixup)
91
92#define END_MMU_FTR_SECTION(msk, val) \
93 END_MMU_FTR_SECTION_NESTED(msk, val, 97)
94
95#define END_MMU_FTR_SECTION_IFSET(msk) END_MMU_FTR_SECTION((msk), (msk))
96#define END_MMU_FTR_SECTION_IFCLR(msk) END_MMU_FTR_SECTION((msk), 0)
97
98/* MMU feature sections with alternatives, use BEGIN_FTR_SECTION to start */
99#define MMU_FTR_SECTION_ELSE_NESTED(label) FTR_SECTION_ELSE_NESTED(label)
100#define MMU_FTR_SECTION_ELSE MMU_FTR_SECTION_ELSE_NESTED(97)
101#define ALT_MMU_FTR_SECTION_END_NESTED(msk, val, label) \
102 MAKE_FTR_SECTION_ENTRY(msk, val, label, __mmu_ftr_fixup)
103#define ALT_MMU_FTR_SECTION_END_NESTED_IFSET(msk, label) \
104 ALT_MMU_FTR_SECTION_END_NESTED(msk, msk, label)
105#define ALT_MMU_FTR_SECTION_END_NESTED_IFCLR(msk, label) \
106 ALT_MMU_FTR_SECTION_END_NESTED(msk, 0, label)
107#define ALT_MMU_FTR_SECTION_END(msk, val) \
108 ALT_MMU_FTR_SECTION_END_NESTED(msk, val, 97)
109#define ALT_MMU_FTR_SECTION_END_IFSET(msk) \
110 ALT_MMU_FTR_SECTION_END_NESTED_IFSET(msk, 97)
111#define ALT_MMU_FTR_SECTION_END_IFCLR(msk) \
112 ALT_MMU_FTR_SECTION_END_NESTED_IFCLR(msk, 97)
113
84/* Firmware feature dependent sections */ 114/* Firmware feature dependent sections */
85#define BEGIN_FW_FTR_SECTION_NESTED(label) START_FTR_SECTION(label) 115#define BEGIN_FW_FTR_SECTION_NESTED(label) START_FTR_SECTION(label)
86#define BEGIN_FW_FTR_SECTION START_FTR_SECTION(97) 116#define BEGIN_FW_FTR_SECTION START_FTR_SECTION(97)
diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h
index b298f7a631e6..e5f2ae8362f7 100644
--- a/arch/powerpc/include/asm/ftrace.h
+++ b/arch/powerpc/include/asm/ftrace.h
@@ -7,7 +7,19 @@
7 7
8#ifndef __ASSEMBLY__ 8#ifndef __ASSEMBLY__
9extern void _mcount(void); 9extern void _mcount(void);
10#endif 10
11#ifdef CONFIG_DYNAMIC_FTRACE
12static inline unsigned long ftrace_call_adjust(unsigned long addr)
13{
14 /* reloction of mcount call site is the same as the address */
15 return addr;
16}
17
18struct dyn_arch_ftrace {
19 struct module *mod;
20};
21#endif /* CONFIG_DYNAMIC_FTRACE */
22#endif /* __ASSEMBLY__ */
11 23
12#endif 24#endif
13 25
diff --git a/arch/powerpc/include/asm/highmem.h b/arch/powerpc/include/asm/highmem.h
index 91c589520c0a..04e4a620952e 100644
--- a/arch/powerpc/include/asm/highmem.h
+++ b/arch/powerpc/include/asm/highmem.h
@@ -38,9 +38,24 @@ extern pte_t *pkmap_page_table;
38 * easily, subsequent pte tables have to be allocated in one physical 38 * easily, subsequent pte tables have to be allocated in one physical
39 * chunk of RAM. 39 * chunk of RAM.
40 */ 40 */
41#define LAST_PKMAP (1 << PTE_SHIFT) 41/*
42#define LAST_PKMAP_MASK (LAST_PKMAP-1) 42 * We use one full pte table with 4K pages. And with 16K/64K pages pte
43 * table covers enough memory (32MB and 512MB resp.) that both FIXMAP
44 * and PKMAP can be placed in single pte table. We use 1024 pages for
45 * PKMAP in case of 16K/64K pages.
46 */
47#ifdef CONFIG_PPC_4K_PAGES
48#define PKMAP_ORDER PTE_SHIFT
49#else
50#define PKMAP_ORDER 10
51#endif
52#define LAST_PKMAP (1 << PKMAP_ORDER)
53#ifndef CONFIG_PPC_4K_PAGES
54#define PKMAP_BASE (FIXADDR_START - PAGE_SIZE*(LAST_PKMAP + 1))
55#else
43#define PKMAP_BASE ((FIXADDR_START - PAGE_SIZE*(LAST_PKMAP + 1)) & PMD_MASK) 56#define PKMAP_BASE ((FIXADDR_START - PAGE_SIZE*(LAST_PKMAP + 1)) & PMD_MASK)
57#endif
58#define LAST_PKMAP_MASK (LAST_PKMAP-1)
44#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT) 59#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT)
45#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) 60#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
46 61
@@ -85,7 +100,7 @@ static inline void *kmap_atomic_prot(struct page *page, enum km_type type, pgpro
85 BUG_ON(!pte_none(*(kmap_pte-idx))); 100 BUG_ON(!pte_none(*(kmap_pte-idx)));
86#endif 101#endif
87 __set_pte_at(&init_mm, vaddr, kmap_pte-idx, mk_pte(page, prot)); 102 __set_pte_at(&init_mm, vaddr, kmap_pte-idx, mk_pte(page, prot));
88 flush_tlb_page(NULL, vaddr); 103 local_flush_tlb_page(NULL, vaddr);
89 104
90 return (void*) vaddr; 105 return (void*) vaddr;
91} 106}
@@ -113,7 +128,7 @@ static inline void kunmap_atomic(void *kvaddr, enum km_type type)
113 * this pte without first remap it 128 * this pte without first remap it
114 */ 129 */
115 pte_clear(&init_mm, vaddr, kmap_pte-idx); 130 pte_clear(&init_mm, vaddr, kmap_pte-idx);
116 flush_tlb_page(NULL, vaddr); 131 local_flush_tlb_page(NULL, vaddr);
117#endif 132#endif
118 pagefault_enable(); 133 pagefault_enable();
119} 134}
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h
index 26f0d0ab27a5..b1dafb6a9743 100644
--- a/arch/powerpc/include/asm/hugetlb.h
+++ b/arch/powerpc/include/asm/hugetlb.h
@@ -18,6 +18,12 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
18 pte_t *ptep); 18 pte_t *ptep);
19 19
20/* 20/*
21 * The version of vma_mmu_pagesize() in arch/powerpc/mm/hugetlbpage.c needs
22 * to override the version in mm/hugetlb.c
23 */
24#define vma_mmu_pagesize vma_mmu_pagesize
25
26/*
21 * If the arch doesn't supply something else, assume that hugepage 27 * If the arch doesn't supply something else, assume that hugepage
22 * size aligned regions are ok without further preparation. 28 * size aligned regions are ok without further preparation.
23 */ 29 */
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index 08266d2728b3..494cd8b0a278 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -713,13 +713,6 @@ static inline void * phys_to_virt(unsigned long address)
713 */ 713 */
714#define page_to_phys(page) ((phys_addr_t)page_to_pfn(page) << PAGE_SHIFT) 714#define page_to_phys(page) ((phys_addr_t)page_to_pfn(page) << PAGE_SHIFT)
715 715
716/* We do NOT want virtual merging, it would put too much pressure on
717 * our iommu allocator. Instead, we want drivers to be smart enough
718 * to coalesce sglists that happen to have been mapped in a contiguous
719 * way by the iommu
720 */
721#define BIO_VMERGE_BOUNDARY 0
722
723/* 716/*
724 * 32 bits still uses virt_to_bus() for it's implementation of DMA 717 * 32 bits still uses virt_to_bus() for it's implementation of DMA
725 * mappings se we have to keep it defined here. We also have some old 718 * mappings se we have to keep it defined here. We also have some old
diff --git a/arch/powerpc/include/asm/kdump.h b/arch/powerpc/include/asm/kdump.h
index b07ebb9784d3..5ebfe5d3c61f 100644
--- a/arch/powerpc/include/asm/kdump.h
+++ b/arch/powerpc/include/asm/kdump.h
@@ -1,6 +1,8 @@
1#ifndef _PPC64_KDUMP_H 1#ifndef _PPC64_KDUMP_H
2#define _PPC64_KDUMP_H 2#define _PPC64_KDUMP_H
3 3
4#include <asm/page.h>
5
4/* Kdump kernel runs at 32 MB, change at your peril. */ 6/* Kdump kernel runs at 32 MB, change at your peril. */
5#define KDUMP_KERNELBASE 0x2000000 7#define KDUMP_KERNELBASE 0x2000000
6 8
@@ -11,8 +13,19 @@
11 13
12#ifdef CONFIG_CRASH_DUMP 14#ifdef CONFIG_CRASH_DUMP
13 15
16/*
17 * On PPC64 translation is disabled during trampoline setup, so we use
18 * physical addresses. Though on PPC32 translation is already enabled,
19 * so we can't do the same. Luckily create_trampoline() creates relative
20 * branches, so we can just add the PAGE_OFFSET and don't worry about it.
21 */
22#ifdef __powerpc64__
14#define KDUMP_TRAMPOLINE_START 0x0100 23#define KDUMP_TRAMPOLINE_START 0x0100
15#define KDUMP_TRAMPOLINE_END 0x3000 24#define KDUMP_TRAMPOLINE_END 0x3000
25#else
26#define KDUMP_TRAMPOLINE_START (0x0100 + PAGE_OFFSET)
27#define KDUMP_TRAMPOLINE_END (0x3000 + PAGE_OFFSET)
28#endif /* __powerpc64__ */
16 29
17#define KDUMP_MIN_TCE_ENTRIES 2048 30#define KDUMP_MIN_TCE_ENTRIES 2048
18 31
diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h
index 3736d9b33289..6dbffc981702 100644
--- a/arch/powerpc/include/asm/kexec.h
+++ b/arch/powerpc/include/asm/kexec.h
@@ -33,12 +33,12 @@
33 33
34#ifndef __ASSEMBLY__ 34#ifndef __ASSEMBLY__
35#include <linux/cpumask.h> 35#include <linux/cpumask.h>
36#include <asm/reg.h>
36 37
37typedef void (*crash_shutdown_t)(void); 38typedef void (*crash_shutdown_t)(void);
38 39
39#ifdef CONFIG_KEXEC 40#ifdef CONFIG_KEXEC
40 41
41#ifdef __powerpc64__
42/* 42/*
43 * This function is responsible for capturing register states if coming 43 * This function is responsible for capturing register states if coming
44 * via panic or invoking dump using sysrq-trigger. 44 * via panic or invoking dump using sysrq-trigger.
@@ -48,6 +48,7 @@ static inline void crash_setup_regs(struct pt_regs *newregs,
48{ 48{
49 if (oldregs) 49 if (oldregs)
50 memcpy(newregs, oldregs, sizeof(*newregs)); 50 memcpy(newregs, oldregs, sizeof(*newregs));
51#ifdef __powerpc64__
51 else { 52 else {
52 /* FIXME Merge this with xmon_save_regs ?? */ 53 /* FIXME Merge this with xmon_save_regs ?? */
53 unsigned long tmp1, tmp2; 54 unsigned long tmp1, tmp2;
@@ -100,15 +101,11 @@ static inline void crash_setup_regs(struct pt_regs *newregs,
100 : "b" (newregs) 101 : "b" (newregs)
101 : "memory"); 102 : "memory");
102 } 103 }
103}
104#else 104#else
105/* 105 else
106 * Provide a dummy definition to avoid build failures. Will remain 106 ppc_save_regs(newregs);
107 * empty till crash dump support is enabled. 107#endif /* __powerpc64__ */
108 */ 108}
109static inline void crash_setup_regs(struct pt_regs *newregs,
110 struct pt_regs *oldregs) { }
111#endif /* !__powerpc64 __ */
112 109
113extern void kexec_smp_wait(void); /* get and clear naca physid, wait for 110extern void kexec_smp_wait(void); /* get and clear naca physid, wait for
114 master to copy new code to 0 */ 111 master to copy new code to 0 */
diff --git a/arch/powerpc/include/asm/kvm_44x.h b/arch/powerpc/include/asm/kvm_44x.h
new file mode 100644
index 000000000000..f49031b632ca
--- /dev/null
+++ b/arch/powerpc/include/asm/kvm_44x.h
@@ -0,0 +1,61 @@
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, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2008
16 *
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18 */
19
20#ifndef __ASM_44X_H__
21#define __ASM_44X_H__
22
23#include <linux/kvm_host.h>
24
25#define PPC44x_TLB_SIZE 64
26
27/* If the guest is expecting it, this can be as large as we like; we'd just
28 * need to find some way of advertising it. */
29#define KVM44x_GUEST_TLB_SIZE 64
30
31struct kvmppc_44x_shadow_ref {
32 struct page *page;
33 u16 gtlb_index;
34 u8 writeable;
35 u8 tid;
36};
37
38struct kvmppc_vcpu_44x {
39 /* Unmodified copy of the guest's TLB. */
40 struct kvmppc_44x_tlbe guest_tlb[KVM44x_GUEST_TLB_SIZE];
41
42 /* References to guest pages in the hardware TLB. */
43 struct kvmppc_44x_shadow_ref shadow_refs[PPC44x_TLB_SIZE];
44
45 /* State of the shadow TLB at guest context switch time. */
46 struct kvmppc_44x_tlbe shadow_tlb[PPC44x_TLB_SIZE];
47 u8 shadow_tlb_mod[PPC44x_TLB_SIZE];
48
49 struct kvm_vcpu vcpu;
50};
51
52static inline struct kvmppc_vcpu_44x *to_44x(struct kvm_vcpu *vcpu)
53{
54 return container_of(vcpu, struct kvmppc_vcpu_44x, vcpu);
55}
56
57void kvmppc_set_pid(struct kvm_vcpu *vcpu, u32 new_pid);
58void kvmppc_44x_tlb_put(struct kvm_vcpu *vcpu);
59void kvmppc_44x_tlb_load(struct kvm_vcpu *vcpu);
60
61#endif /* __ASM_44X_H__ */
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 34b52b7180cd..c1e436fe7738 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -64,27 +64,58 @@ struct kvm_vcpu_stat {
64 u32 halt_wakeup; 64 u32 halt_wakeup;
65}; 65};
66 66
67struct tlbe { 67struct kvmppc_44x_tlbe {
68 u32 tid; /* Only the low 8 bits are used. */ 68 u32 tid; /* Only the low 8 bits are used. */
69 u32 word0; 69 u32 word0;
70 u32 word1; 70 u32 word1;
71 u32 word2; 71 u32 word2;
72}; 72};
73 73
74struct kvm_arch { 74enum kvm_exit_types {
75 MMIO_EXITS,
76 DCR_EXITS,
77 SIGNAL_EXITS,
78 ITLB_REAL_MISS_EXITS,
79 ITLB_VIRT_MISS_EXITS,
80 DTLB_REAL_MISS_EXITS,
81 DTLB_VIRT_MISS_EXITS,
82 SYSCALL_EXITS,
83 ISI_EXITS,
84 DSI_EXITS,
85 EMULATED_INST_EXITS,
86 EMULATED_MTMSRWE_EXITS,
87 EMULATED_WRTEE_EXITS,
88 EMULATED_MTSPR_EXITS,
89 EMULATED_MFSPR_EXITS,
90 EMULATED_MTMSR_EXITS,
91 EMULATED_MFMSR_EXITS,
92 EMULATED_TLBSX_EXITS,
93 EMULATED_TLBWE_EXITS,
94 EMULATED_RFI_EXITS,
95 DEC_EXITS,
96 EXT_INTR_EXITS,
97 HALT_WAKEUP,
98 USR_PR_INST,
99 FP_UNAVAIL,
100 DEBUG_EXITS,
101 TIMEINGUEST,
102 __NUMBER_OF_KVM_EXIT_TYPES
75}; 103};
76 104
77struct kvm_vcpu_arch { 105/* allow access to big endian 32bit upper/lower parts and 64bit var */
78 /* Unmodified copy of the guest's TLB. */ 106struct kvmppc_exit_timing {
79 struct tlbe guest_tlb[PPC44x_TLB_SIZE]; 107 union {
80 /* TLB that's actually used when the guest is running. */ 108 u64 tv64;
81 struct tlbe shadow_tlb[PPC44x_TLB_SIZE]; 109 struct {
82 /* Pages which are referenced in the shadow TLB. */ 110 u32 tbu, tbl;
83 struct page *shadow_pages[PPC44x_TLB_SIZE]; 111 } tv32;
112 };
113};
84 114
85 /* Track which TLB entries we've modified in the current exit. */ 115struct kvm_arch {
86 u8 shadow_tlb_mod[PPC44x_TLB_SIZE]; 116};
87 117
118struct kvm_vcpu_arch {
88 u32 host_stack; 119 u32 host_stack;
89 u32 host_pid; 120 u32 host_pid;
90 u32 host_dbcr0; 121 u32 host_dbcr0;
@@ -94,32 +125,32 @@ struct kvm_vcpu_arch {
94 u32 host_msr; 125 u32 host_msr;
95 126
96 u64 fpr[32]; 127 u64 fpr[32];
97 u32 gpr[32]; 128 ulong gpr[32];
98 129
99 u32 pc; 130 ulong pc;
100 u32 cr; 131 u32 cr;
101 u32 ctr; 132 ulong ctr;
102 u32 lr; 133 ulong lr;
103 u32 xer; 134 ulong xer;
104 135
105 u32 msr; 136 ulong msr;
106 u32 mmucr; 137 u32 mmucr;
107 u32 sprg0; 138 ulong sprg0;
108 u32 sprg1; 139 ulong sprg1;
109 u32 sprg2; 140 ulong sprg2;
110 u32 sprg3; 141 ulong sprg3;
111 u32 sprg4; 142 ulong sprg4;
112 u32 sprg5; 143 ulong sprg5;
113 u32 sprg6; 144 ulong sprg6;
114 u32 sprg7; 145 ulong sprg7;
115 u32 srr0; 146 ulong srr0;
116 u32 srr1; 147 ulong srr1;
117 u32 csrr0; 148 ulong csrr0;
118 u32 csrr1; 149 ulong csrr1;
119 u32 dsrr0; 150 ulong dsrr0;
120 u32 dsrr1; 151 ulong dsrr1;
121 u32 dear; 152 ulong dear;
122 u32 esr; 153 ulong esr;
123 u32 dec; 154 u32 dec;
124 u32 decar; 155 u32 decar;
125 u32 tbl; 156 u32 tbl;
@@ -127,7 +158,7 @@ struct kvm_vcpu_arch {
127 u32 tcr; 158 u32 tcr;
128 u32 tsr; 159 u32 tsr;
129 u32 ivor[16]; 160 u32 ivor[16];
130 u32 ivpr; 161 ulong ivpr;
131 u32 pir; 162 u32 pir;
132 163
133 u32 shadow_pid; 164 u32 shadow_pid;
@@ -140,9 +171,22 @@ struct kvm_vcpu_arch {
140 u32 dbcr0; 171 u32 dbcr0;
141 u32 dbcr1; 172 u32 dbcr1;
142 173
174#ifdef CONFIG_KVM_EXIT_TIMING
175 struct kvmppc_exit_timing timing_exit;
176 struct kvmppc_exit_timing timing_last_enter;
177 u32 last_exit_type;
178 u32 timing_count_type[__NUMBER_OF_KVM_EXIT_TYPES];
179 u64 timing_sum_duration[__NUMBER_OF_KVM_EXIT_TYPES];
180 u64 timing_sum_quad_duration[__NUMBER_OF_KVM_EXIT_TYPES];
181 u64 timing_min_duration[__NUMBER_OF_KVM_EXIT_TYPES];
182 u64 timing_max_duration[__NUMBER_OF_KVM_EXIT_TYPES];
183 u64 timing_last_exit;
184 struct dentry *debugfs_exit_timing;
185#endif
186
143 u32 last_inst; 187 u32 last_inst;
144 u32 fault_dear; 188 ulong fault_dear;
145 u32 fault_esr; 189 ulong fault_esr;
146 gpa_t paddr_accessed; 190 gpa_t paddr_accessed;
147 191
148 u8 io_gpr; /* GPR used as IO source/target */ 192 u8 io_gpr; /* GPR used as IO source/target */
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index bb62ad876de3..36d2a50a8487 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -29,11 +29,6 @@
29#include <linux/kvm_types.h> 29#include <linux/kvm_types.h>
30#include <linux/kvm_host.h> 30#include <linux/kvm_host.h>
31 31
32struct kvm_tlb {
33 struct tlbe guest_tlb[PPC44x_TLB_SIZE];
34 struct tlbe shadow_tlb[PPC44x_TLB_SIZE];
35};
36
37enum emulation_result { 32enum emulation_result {
38 EMULATE_DONE, /* no further processing */ 33 EMULATE_DONE, /* no further processing */
39 EMULATE_DO_MMIO, /* kvm_run filled with MMIO request */ 34 EMULATE_DO_MMIO, /* kvm_run filled with MMIO request */
@@ -41,9 +36,6 @@ enum emulation_result {
41 EMULATE_FAIL, /* can't emulate this instruction */ 36 EMULATE_FAIL, /* can't emulate this instruction */
42}; 37};
43 38
44extern const unsigned char exception_priority[];
45extern const unsigned char priority_exception[];
46
47extern int __kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu); 39extern int __kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu);
48extern char kvmppc_handlers_start[]; 40extern char kvmppc_handlers_start[];
49extern unsigned long kvmppc_handler_len; 41extern unsigned long kvmppc_handler_len;
@@ -58,51 +50,44 @@ extern int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
58extern int kvmppc_emulate_instruction(struct kvm_run *run, 50extern int kvmppc_emulate_instruction(struct kvm_run *run,
59 struct kvm_vcpu *vcpu); 51 struct kvm_vcpu *vcpu);
60extern int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu); 52extern int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu);
53extern void kvmppc_emulate_dec(struct kvm_vcpu *vcpu);
61 54
62extern void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gfn_t gfn, 55extern void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gpa_t gpaddr,
63 u64 asid, u32 flags); 56 u64 asid, u32 flags, u32 max_bytes,
64extern void kvmppc_mmu_invalidate(struct kvm_vcpu *vcpu, gva_t eaddr, 57 unsigned int gtlb_idx);
65 gva_t eend, u32 asid);
66extern void kvmppc_mmu_priv_switch(struct kvm_vcpu *vcpu, int usermode); 58extern void kvmppc_mmu_priv_switch(struct kvm_vcpu *vcpu, int usermode);
67extern void kvmppc_mmu_switch_pid(struct kvm_vcpu *vcpu, u32 pid); 59extern void kvmppc_mmu_switch_pid(struct kvm_vcpu *vcpu, u32 pid);
68 60
69/* XXX Book E specific */ 61/* Core-specific hooks */
70extern void kvmppc_tlbe_set_modified(struct kvm_vcpu *vcpu, unsigned int i); 62
71 63extern struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm,
72extern void kvmppc_check_and_deliver_interrupts(struct kvm_vcpu *vcpu); 64 unsigned int id);
73 65extern void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu);
74static inline void kvmppc_queue_exception(struct kvm_vcpu *vcpu, int exception) 66extern int kvmppc_core_vcpu_setup(struct kvm_vcpu *vcpu);
75{ 67extern int kvmppc_core_check_processor_compat(void);
76 unsigned int priority = exception_priority[exception]; 68extern int kvmppc_core_vcpu_translate(struct kvm_vcpu *vcpu,
77 set_bit(priority, &vcpu->arch.pending_exceptions); 69 struct kvm_translation *tr);
78} 70
79 71extern void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
80static inline void kvmppc_clear_exception(struct kvm_vcpu *vcpu, int exception) 72extern void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu);
81{ 73
82 unsigned int priority = exception_priority[exception]; 74extern void kvmppc_core_load_guest_debugstate(struct kvm_vcpu *vcpu);
83 clear_bit(priority, &vcpu->arch.pending_exceptions); 75extern void kvmppc_core_load_host_debugstate(struct kvm_vcpu *vcpu);
84} 76
85 77extern void kvmppc_core_deliver_interrupts(struct kvm_vcpu *vcpu);
86/* Helper function for "full" MSR writes. No need to call this if only EE is 78extern int kvmppc_core_pending_dec(struct kvm_vcpu *vcpu);
87 * changing. */ 79extern void kvmppc_core_queue_program(struct kvm_vcpu *vcpu);
88static inline void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr) 80extern void kvmppc_core_queue_dec(struct kvm_vcpu *vcpu);
89{ 81extern void kvmppc_core_queue_external(struct kvm_vcpu *vcpu,
90 if ((new_msr & MSR_PR) != (vcpu->arch.msr & MSR_PR)) 82 struct kvm_interrupt *irq);
91 kvmppc_mmu_priv_switch(vcpu, new_msr & MSR_PR); 83
92 84extern int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
93 vcpu->arch.msr = new_msr; 85 unsigned int op, int *advance);
94 86extern int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, int rs);
95 if (vcpu->arch.msr & MSR_WE) 87extern int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt);
96 kvm_vcpu_block(vcpu); 88
97} 89extern int kvmppc_booke_init(void);
98 90extern void kvmppc_booke_exit(void);
99static inline void kvmppc_set_pid(struct kvm_vcpu *vcpu, u32 new_pid)
100{
101 if (vcpu->arch.pid != new_pid) {
102 vcpu->arch.pid = new_pid;
103 vcpu->arch.swap_pid = 1;
104 }
105}
106 91
107extern void kvmppc_core_destroy_mmu(struct kvm_vcpu *vcpu); 92extern void kvmppc_core_destroy_mmu(struct kvm_vcpu *vcpu);
108 93
diff --git a/arch/powerpc/include/asm/local.h b/arch/powerpc/include/asm/local.h
index 612d83276653..84b457a3c1bc 100644
--- a/arch/powerpc/include/asm/local.h
+++ b/arch/powerpc/include/asm/local.h
@@ -67,7 +67,7 @@ static __inline__ long local_inc_return(local_t *l)
67 bne- 1b" 67 bne- 1b"
68 : "=&r" (t) 68 : "=&r" (t)
69 : "r" (&(l->a.counter)) 69 : "r" (&(l->a.counter))
70 : "cc", "memory"); 70 : "cc", "xer", "memory");
71 71
72 return t; 72 return t;
73} 73}
@@ -94,7 +94,7 @@ static __inline__ long local_dec_return(local_t *l)
94 bne- 1b" 94 bne- 1b"
95 : "=&r" (t) 95 : "=&r" (t)
96 : "r" (&(l->a.counter)) 96 : "r" (&(l->a.counter))
97 : "cc", "memory"); 97 : "cc", "xer", "memory");
98 98
99 return t; 99 return t;
100} 100}
diff --git a/arch/powerpc/include/asm/lppaca.h b/arch/powerpc/include/asm/lppaca.h
index 2fe268b10333..25aaa97facd8 100644
--- a/arch/powerpc/include/asm/lppaca.h
+++ b/arch/powerpc/include/asm/lppaca.h
@@ -133,7 +133,8 @@ struct lppaca {
133//============================================================================= 133//=============================================================================
134// CACHE_LINE_4-5 0x0180 - 0x027F Contains PMC interrupt data 134// CACHE_LINE_4-5 0x0180 - 0x027F Contains PMC interrupt data
135//============================================================================= 135//=============================================================================
136 u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF 136 u32 page_ins; // CMO Hint - # page ins by OS x00-x04
137 u8 pmc_save_area[252]; // PMC interrupt Area x04-xFF
137} __attribute__((__aligned__(0x400))); 138} __attribute__((__aligned__(0x400)));
138 139
139extern struct lppaca lppaca[]; 140extern struct lppaca lppaca[];
diff --git a/arch/powerpc/include/asm/mmu-40x.h b/arch/powerpc/include/asm/mmu-40x.h
index 3d108676584c..776f415a36aa 100644
--- a/arch/powerpc/include/asm/mmu-40x.h
+++ b/arch/powerpc/include/asm/mmu-40x.h
@@ -54,8 +54,9 @@
54#ifndef __ASSEMBLY__ 54#ifndef __ASSEMBLY__
55 55
56typedef struct { 56typedef struct {
57 unsigned long id; 57 unsigned int id;
58 unsigned long vdso_base; 58 unsigned int active;
59 unsigned long vdso_base;
59} mm_context_t; 60} mm_context_t;
60 61
61#endif /* !__ASSEMBLY__ */ 62#endif /* !__ASSEMBLY__ */
diff --git a/arch/powerpc/include/asm/mmu-44x.h b/arch/powerpc/include/asm/mmu-44x.h
index a825524c981a..27cc6fdcd3b7 100644
--- a/arch/powerpc/include/asm/mmu-44x.h
+++ b/arch/powerpc/include/asm/mmu-44x.h
@@ -4,6 +4,8 @@
4 * PPC440 support 4 * PPC440 support
5 */ 5 */
6 6
7#include <asm/page.h>
8
7#define PPC44x_MMUCR_TID 0x000000ff 9#define PPC44x_MMUCR_TID 0x000000ff
8#define PPC44x_MMUCR_STS 0x00010000 10#define PPC44x_MMUCR_STS 0x00010000
9 11
@@ -54,10 +56,12 @@
54#ifndef __ASSEMBLY__ 56#ifndef __ASSEMBLY__
55 57
56extern unsigned int tlb_44x_hwater; 58extern unsigned int tlb_44x_hwater;
59extern unsigned int tlb_44x_index;
57 60
58typedef struct { 61typedef struct {
59 unsigned long id; 62 unsigned int id;
60 unsigned long vdso_base; 63 unsigned int active;
64 unsigned long vdso_base;
61} mm_context_t; 65} mm_context_t;
62 66
63#endif /* !__ASSEMBLY__ */ 67#endif /* !__ASSEMBLY__ */
@@ -73,4 +77,19 @@ typedef struct {
73/* Size of the TLBs used for pinning in lowmem */ 77/* Size of the TLBs used for pinning in lowmem */
74#define PPC_PIN_SIZE (1 << 28) /* 256M */ 78#define PPC_PIN_SIZE (1 << 28) /* 256M */
75 79
80#if (PAGE_SHIFT == 12)
81#define PPC44x_TLBE_SIZE PPC44x_TLB_4K
82#elif (PAGE_SHIFT == 14)
83#define PPC44x_TLBE_SIZE PPC44x_TLB_16K
84#elif (PAGE_SHIFT == 16)
85#define PPC44x_TLBE_SIZE PPC44x_TLB_64K
86#else
87#error "Unsupported PAGE_SIZE"
88#endif
89
90#define PPC44x_PGD_OFF_SHIFT (32 - PGDIR_SHIFT + PGD_T_LOG2)
91#define PPC44x_PGD_OFF_MASK_BIT (PGDIR_SHIFT - PGD_T_LOG2)
92#define PPC44x_PTE_ADD_SHIFT (32 - PGDIR_SHIFT + PTE_SHIFT + PTE_T_LOG2)
93#define PPC44x_PTE_ADD_MASK_BIT (32 - PTE_T_LOG2 - PTE_SHIFT)
94
76#endif /* _ASM_POWERPC_MMU_44X_H_ */ 95#endif /* _ASM_POWERPC_MMU_44X_H_ */
diff --git a/arch/powerpc/include/asm/mmu-8xx.h b/arch/powerpc/include/asm/mmu-8xx.h
index 9db877eb88db..07865a357848 100644
--- a/arch/powerpc/include/asm/mmu-8xx.h
+++ b/arch/powerpc/include/asm/mmu-8xx.h
@@ -137,7 +137,8 @@
137 137
138#ifndef __ASSEMBLY__ 138#ifndef __ASSEMBLY__
139typedef struct { 139typedef struct {
140 unsigned long id; 140 unsigned int id;
141 unsigned int active;
141 unsigned long vdso_base; 142 unsigned long vdso_base;
142} mm_context_t; 143} mm_context_t;
143#endif /* !__ASSEMBLY__ */ 144#endif /* !__ASSEMBLY__ */
diff --git a/arch/powerpc/include/asm/mmu-fsl-booke.h b/arch/powerpc/include/asm/mmu-fsl-booke.h
index 925d93cf64d8..3f941c0f7e8e 100644
--- a/arch/powerpc/include/asm/mmu-fsl-booke.h
+++ b/arch/powerpc/include/asm/mmu-fsl-booke.h
@@ -40,6 +40,8 @@
40#define MAS2_M 0x00000004 40#define MAS2_M 0x00000004
41#define MAS2_G 0x00000002 41#define MAS2_G 0x00000002
42#define MAS2_E 0x00000001 42#define MAS2_E 0x00000001
43#define MAS2_EPN_MASK(size) (~0 << (2*(size) + 10))
44#define MAS2_VAL(addr, size, flags) ((addr) & MAS2_EPN_MASK(size) | (flags))
43 45
44#define MAS3_RPN 0xFFFFF000 46#define MAS3_RPN 0xFFFFF000
45#define MAS3_U0 0x00000200 47#define MAS3_U0 0x00000200
@@ -74,8 +76,9 @@
74#ifndef __ASSEMBLY__ 76#ifndef __ASSEMBLY__
75 77
76typedef struct { 78typedef struct {
77 unsigned long id; 79 unsigned int id;
78 unsigned long vdso_base; 80 unsigned int active;
81 unsigned long vdso_base;
79} mm_context_t; 82} mm_context_t;
80#endif /* !__ASSEMBLY__ */ 83#endif /* !__ASSEMBLY__ */
81 84
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
index 4c0e1b4f975c..6e7639911318 100644
--- a/arch/powerpc/include/asm/mmu.h
+++ b/arch/powerpc/include/asm/mmu.h
@@ -2,6 +2,63 @@
2#define _ASM_POWERPC_MMU_H_ 2#define _ASM_POWERPC_MMU_H_
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <asm/asm-compat.h>
6#include <asm/feature-fixups.h>
7
8/*
9 * MMU features bit definitions
10 */
11
12/*
13 * First half is MMU families
14 */
15#define MMU_FTR_HPTE_TABLE ASM_CONST(0x00000001)
16#define MMU_FTR_TYPE_8xx ASM_CONST(0x00000002)
17#define MMU_FTR_TYPE_40x ASM_CONST(0x00000004)
18#define MMU_FTR_TYPE_44x ASM_CONST(0x00000008)
19#define MMU_FTR_TYPE_FSL_E ASM_CONST(0x00000010)
20
21/*
22 * This is individual features
23 */
24
25/* Enable use of high BAT registers */
26#define MMU_FTR_USE_HIGH_BATS ASM_CONST(0x00010000)
27
28/* Enable >32-bit physical addresses on 32-bit processor, only used
29 * by CONFIG_6xx currently as BookE supports that from day 1
30 */
31#define MMU_FTR_BIG_PHYS ASM_CONST(0x00020000)
32
33/* Enable use of broadcast TLB invalidations. We don't always set it
34 * on processors that support it due to other constraints with the
35 * use of such invalidations
36 */
37#define MMU_FTR_USE_TLBIVAX_BCAST ASM_CONST(0x00040000)
38
39/* Enable use of tlbilx invalidate-by-PID variant.
40 */
41#define MMU_FTR_USE_TLBILX_PID ASM_CONST(0x00080000)
42
43/* This indicates that the processor cannot handle multiple outstanding
44 * broadcast tlbivax or tlbsync. This makes the code use a spinlock
45 * around such invalidate forms.
46 */
47#define MMU_FTR_LOCK_BCAST_INVAL ASM_CONST(0x00100000)
48
49#ifndef __ASSEMBLY__
50#include <asm/cputable.h>
51
52static inline int mmu_has_feature(unsigned long feature)
53{
54 return (cur_cpu_spec->mmu_features & feature);
55}
56
57extern unsigned int __start___mmu_ftr_fixup, __stop___mmu_ftr_fixup;
58
59#endif /* !__ASSEMBLY__ */
60
61
5#ifdef CONFIG_PPC64 62#ifdef CONFIG_PPC64
6/* 64-bit classic hash table MMU */ 63/* 64-bit classic hash table MMU */
7# include <asm/mmu-hash64.h> 64# include <asm/mmu-hash64.h>
diff --git a/arch/powerpc/include/asm/mmu_context.h b/arch/powerpc/include/asm/mmu_context.h
index 6b993ef452ff..ab4f19263c42 100644
--- a/arch/powerpc/include/asm/mmu_context.h
+++ b/arch/powerpc/include/asm/mmu_context.h
@@ -2,237 +2,26 @@
2#define __ASM_POWERPC_MMU_CONTEXT_H 2#define __ASM_POWERPC_MMU_CONTEXT_H
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/kernel.h>
6#include <linux/mm.h>
7#include <linux/sched.h>
8#include <linux/spinlock.h>
5#include <asm/mmu.h> 9#include <asm/mmu.h>
6#include <asm/cputable.h> 10#include <asm/cputable.h>
7#include <asm-generic/mm_hooks.h> 11#include <asm-generic/mm_hooks.h>
8 12#include <asm/cputhreads.h>
9#ifndef CONFIG_PPC64
10#include <asm/atomic.h>
11#include <linux/bitops.h>
12
13/*
14 * On 32-bit PowerPC 6xx/7xx/7xxx CPUs, we use a set of 16 VSIDs
15 * (virtual segment identifiers) for each context. Although the
16 * hardware supports 24-bit VSIDs, and thus >1 million contexts,
17 * we only use 32,768 of them. That is ample, since there can be
18 * at most around 30,000 tasks in the system anyway, and it means
19 * that we can use a bitmap to indicate which contexts are in use.
20 * Using a bitmap means that we entirely avoid all of the problems
21 * that we used to have when the context number overflowed,
22 * particularly on SMP systems.
23 * -- paulus.
24 */
25
26/*
27 * This function defines the mapping from contexts to VSIDs (virtual
28 * segment IDs). We use a skew on both the context and the high 4 bits
29 * of the 32-bit virtual address (the "effective segment ID") in order
30 * to spread out the entries in the MMU hash table. Note, if this
31 * function is changed then arch/ppc/mm/hashtable.S will have to be
32 * changed to correspond.
33 */
34#define CTX_TO_VSID(ctx, va) (((ctx) * (897 * 16) + ((va) >> 28) * 0x111) \
35 & 0xffffff)
36
37/*
38 The MPC8xx has only 16 contexts. We rotate through them on each
39 task switch. A better way would be to keep track of tasks that
40 own contexts, and implement an LRU usage. That way very active
41 tasks don't always have to pay the TLB reload overhead. The
42 kernel pages are mapped shared, so the kernel can run on behalf
43 of any task that makes a kernel entry. Shared does not mean they
44 are not protected, just that the ASID comparison is not performed.
45 -- Dan
46
47 The IBM4xx has 256 contexts, so we can just rotate through these
48 as a way of "switching" contexts. If the TID of the TLB is zero,
49 the PID/TID comparison is disabled, so we can use a TID of zero
50 to represent all kernel pages as shared among all contexts.
51 -- Dan
52 */
53
54static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
55{
56}
57
58#ifdef CONFIG_8xx
59#define NO_CONTEXT 16
60#define LAST_CONTEXT 15
61#define FIRST_CONTEXT 0
62
63#elif defined(CONFIG_4xx)
64#define NO_CONTEXT 256
65#define LAST_CONTEXT 255
66#define FIRST_CONTEXT 1
67
68#elif defined(CONFIG_E200) || defined(CONFIG_E500)
69#define NO_CONTEXT 256
70#define LAST_CONTEXT 255
71#define FIRST_CONTEXT 1
72
73#else
74
75/* PPC 6xx, 7xx CPUs */
76#define NO_CONTEXT ((unsigned long) -1)
77#define LAST_CONTEXT 32767
78#define FIRST_CONTEXT 1
79#endif
80
81/*
82 * Set the current MMU context.
83 * On 32-bit PowerPCs (other than the 8xx embedded chips), this is done by
84 * loading up the segment registers for the user part of the address space.
85 *
86 * Since the PGD is immediately available, it is much faster to simply
87 * pass this along as a second parameter, which is required for 8xx and
88 * can be used for debugging on all processors (if you happen to have
89 * an Abatron).
90 */
91extern void set_context(unsigned long contextid, pgd_t *pgd);
92
93/*
94 * Bitmap of contexts in use.
95 * The size of this bitmap is LAST_CONTEXT + 1 bits.
96 */
97extern unsigned long context_map[];
98
99/*
100 * This caches the next context number that we expect to be free.
101 * Its use is an optimization only, we can't rely on this context
102 * number to be free, but it usually will be.
103 */
104extern unsigned long next_mmu_context;
105
106/*
107 * If we don't have sufficient contexts to give one to every task
108 * that could be in the system, we need to be able to steal contexts.
109 * These variables support that.
110 */
111#if LAST_CONTEXT < 30000
112#define FEW_CONTEXTS 1
113extern atomic_t nr_free_contexts;
114extern struct mm_struct *context_mm[LAST_CONTEXT+1];
115extern void steal_context(void);
116#endif
117
118/*
119 * Get a new mmu context for the address space described by `mm'.
120 */
121static inline void get_mmu_context(struct mm_struct *mm)
122{
123 unsigned long ctx;
124
125 if (mm->context.id != NO_CONTEXT)
126 return;
127#ifdef FEW_CONTEXTS
128 while (atomic_dec_if_positive(&nr_free_contexts) < 0)
129 steal_context();
130#endif
131 ctx = next_mmu_context;
132 while (test_and_set_bit(ctx, context_map)) {
133 ctx = find_next_zero_bit(context_map, LAST_CONTEXT+1, ctx);
134 if (ctx > LAST_CONTEXT)
135 ctx = 0;
136 }
137 next_mmu_context = (ctx + 1) & LAST_CONTEXT;
138 mm->context.id = ctx;
139#ifdef FEW_CONTEXTS
140 context_mm[ctx] = mm;
141#endif
142}
143
144/*
145 * Set up the context for a new address space.
146 */
147static inline int init_new_context(struct task_struct *t, struct mm_struct *mm)
148{
149 mm->context.id = NO_CONTEXT;
150 return 0;
151}
152
153/*
154 * We're finished using the context for an address space.
155 */
156static inline void destroy_context(struct mm_struct *mm)
157{
158 preempt_disable();
159 if (mm->context.id != NO_CONTEXT) {
160 clear_bit(mm->context.id, context_map);
161 mm->context.id = NO_CONTEXT;
162#ifdef FEW_CONTEXTS
163 atomic_inc(&nr_free_contexts);
164#endif
165 }
166 preempt_enable();
167}
168
169static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
170 struct task_struct *tsk)
171{
172#ifdef CONFIG_ALTIVEC
173 if (cpu_has_feature(CPU_FTR_ALTIVEC))
174 asm volatile ("dssall;\n"
175#ifndef CONFIG_POWER4
176 "sync;\n" /* G4 needs a sync here, G5 apparently not */
177#endif
178 : : );
179#endif /* CONFIG_ALTIVEC */
180
181 tsk->thread.pgdir = next->pgd;
182
183 /* No need to flush userspace segments if the mm doesnt change */
184 if (prev == next)
185 return;
186
187 /* Setup new userspace context */
188 get_mmu_context(next);
189 set_context(next->context.id, next->pgd);
190}
191
192#define deactivate_mm(tsk,mm) do { } while (0)
193 13
194/* 14/*
195 * After we have set current->mm to a new value, this activates 15 * Most if the context management is out of line
196 * the context for the new mm so we see the new mappings.
197 */ 16 */
198#define activate_mm(active_mm, mm) switch_mm(active_mm, mm, current)
199
200extern void mmu_context_init(void); 17extern void mmu_context_init(void);
201
202
203#else
204
205#include <linux/kernel.h>
206#include <linux/mm.h>
207#include <linux/sched.h>
208
209/*
210 * Copyright (C) 2001 PPC 64 Team, IBM Corp
211 *
212 * This program is free software; you can redistribute it and/or
213 * modify it under the terms of the GNU General Public License
214 * as published by the Free Software Foundation; either version
215 * 2 of the License, or (at your option) any later version.
216 */
217
218static inline void enter_lazy_tlb(struct mm_struct *mm,
219 struct task_struct *tsk)
220{
221}
222
223/*
224 * The proto-VSID space has 2^35 - 1 segments available for user mappings.
225 * Each segment contains 2^28 bytes. Each context maps 2^44 bytes,
226 * so we can support 2^19-1 contexts (19 == 35 + 28 - 44).
227 */
228#define NO_CONTEXT 0
229#define MAX_CONTEXT ((1UL << 19) - 1)
230
231extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm); 18extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
232extern void destroy_context(struct mm_struct *mm); 19extern void destroy_context(struct mm_struct *mm);
233 20
21extern void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next);
234extern void switch_stab(struct task_struct *tsk, struct mm_struct *mm); 22extern void switch_stab(struct task_struct *tsk, struct mm_struct *mm);
235extern void switch_slb(struct task_struct *tsk, struct mm_struct *mm); 23extern void switch_slb(struct task_struct *tsk, struct mm_struct *mm);
24extern void set_context(unsigned long id, pgd_t *pgd);
236 25
237/* 26/*
238 * switch_mm is the entry point called from the architecture independent 27 * switch_mm is the entry point called from the architecture independent
@@ -241,22 +30,39 @@ extern void switch_slb(struct task_struct *tsk, struct mm_struct *mm);
241static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 30static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
242 struct task_struct *tsk) 31 struct task_struct *tsk)
243{ 32{
244 if (!cpu_isset(smp_processor_id(), next->cpu_vm_mask)) 33 /* Mark this context has been used on the new CPU */
245 cpu_set(smp_processor_id(), next->cpu_vm_mask); 34 cpu_set(smp_processor_id(), next->cpu_vm_mask);
35
36 /* 32-bit keeps track of the current PGDIR in the thread struct */
37#ifdef CONFIG_PPC32
38 tsk->thread.pgdir = next->pgd;
39#endif /* CONFIG_PPC32 */
246 40
247 /* No need to flush userspace segments if the mm doesnt change */ 41 /* Nothing else to do if we aren't actually switching */
248 if (prev == next) 42 if (prev == next)
249 return; 43 return;
250 44
45 /* We must stop all altivec streams before changing the HW
46 * context
47 */
251#ifdef CONFIG_ALTIVEC 48#ifdef CONFIG_ALTIVEC
252 if (cpu_has_feature(CPU_FTR_ALTIVEC)) 49 if (cpu_has_feature(CPU_FTR_ALTIVEC))
253 asm volatile ("dssall"); 50 asm volatile ("dssall");
254#endif /* CONFIG_ALTIVEC */ 51#endif /* CONFIG_ALTIVEC */
255 52
53 /* The actual HW switching method differs between the various
54 * sub architectures.
55 */
56#ifdef CONFIG_PPC_STD_MMU_64
256 if (cpu_has_feature(CPU_FTR_SLB)) 57 if (cpu_has_feature(CPU_FTR_SLB))
257 switch_slb(tsk, next); 58 switch_slb(tsk, next);
258 else 59 else
259 switch_stab(tsk, next); 60 switch_stab(tsk, next);
61#else
62 /* Out of line for now */
63 switch_mmu_context(prev, next);
64#endif
65
260} 66}
261 67
262#define deactivate_mm(tsk,mm) do { } while (0) 68#define deactivate_mm(tsk,mm) do { } while (0)
@@ -274,6 +80,11 @@ static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
274 local_irq_restore(flags); 80 local_irq_restore(flags);
275} 81}
276 82
277#endif /* CONFIG_PPC64 */ 83/* We don't currently use enter_lazy_tlb() for anything */
84static inline void enter_lazy_tlb(struct mm_struct *mm,
85 struct task_struct *tsk)
86{
87}
88
278#endif /* __KERNEL__ */ 89#endif /* __KERNEL__ */
279#endif /* __ASM_POWERPC_MMU_CONTEXT_H */ 90#endif /* __ASM_POWERPC_MMU_CONTEXT_H */
diff --git a/arch/powerpc/include/asm/module.h b/arch/powerpc/include/asm/module.h
index e5f14b13ccf0..08454880a2c0 100644
--- a/arch/powerpc/include/asm/module.h
+++ b/arch/powerpc/include/asm/module.h
@@ -34,11 +34,19 @@ struct mod_arch_specific {
34#ifdef __powerpc64__ 34#ifdef __powerpc64__
35 unsigned int stubs_section; /* Index of stubs section in module */ 35 unsigned int stubs_section; /* Index of stubs section in module */
36 unsigned int toc_section; /* What section is the TOC? */ 36 unsigned int toc_section; /* What section is the TOC? */
37#else 37#ifdef CONFIG_DYNAMIC_FTRACE
38 unsigned long toc;
39 unsigned long tramp;
40#endif
41
42#else /* powerpc64 */
38 /* Indices of PLT sections within module. */ 43 /* Indices of PLT sections within module. */
39 unsigned int core_plt_section; 44 unsigned int core_plt_section;
40 unsigned int init_plt_section; 45 unsigned int init_plt_section;
46#ifdef CONFIG_DYNAMIC_FTRACE
47 unsigned long tramp;
41#endif 48#endif
49#endif /* powerpc64 */
42 50
43 /* List of BUG addresses, source line numbers and filenames */ 51 /* List of BUG addresses, source line numbers and filenames */
44 struct list_head bug_list; 52 struct list_head bug_list;
@@ -68,6 +76,12 @@ struct mod_arch_specific {
68# endif /* MODULE */ 76# endif /* MODULE */
69#endif 77#endif
70 78
79#ifdef CONFIG_DYNAMIC_FTRACE
80# ifdef MODULE
81 asm(".section .ftrace.tramp,\"ax\",@nobits; .align 3; .previous");
82# endif /* MODULE */
83#endif
84
71 85
72struct exception_table_entry; 86struct exception_table_entry;
73void sort_ex_table(struct exception_table_entry *start, 87void sort_ex_table(struct exception_table_entry *start,
diff --git a/arch/powerpc/include/asm/mpc52xx.h b/arch/powerpc/include/asm/mpc52xx.h
index 81ef10b6b672..81a23932a160 100644
--- a/arch/powerpc/include/asm/mpc52xx.h
+++ b/arch/powerpc/include/asm/mpc52xx.h
@@ -239,6 +239,25 @@ struct mpc52xx_cdm {
239 u16 mclken_div_psc6; /* CDM + 0x36 reg13 byte2,3 */ 239 u16 mclken_div_psc6; /* CDM + 0x36 reg13 byte2,3 */
240}; 240};
241 241
242/* Interrupt controller Register set */
243struct mpc52xx_intr {
244 u32 per_mask; /* INTR + 0x00 */
245 u32 per_pri1; /* INTR + 0x04 */
246 u32 per_pri2; /* INTR + 0x08 */
247 u32 per_pri3; /* INTR + 0x0c */
248 u32 ctrl; /* INTR + 0x10 */
249 u32 main_mask; /* INTR + 0x14 */
250 u32 main_pri1; /* INTR + 0x18 */
251 u32 main_pri2; /* INTR + 0x1c */
252 u32 reserved1; /* INTR + 0x20 */
253 u32 enc_status; /* INTR + 0x24 */
254 u32 crit_status; /* INTR + 0x28 */
255 u32 main_status; /* INTR + 0x2c */
256 u32 per_status; /* INTR + 0x30 */
257 u32 reserved2; /* INTR + 0x34 */
258 u32 per_error; /* INTR + 0x38 */
259};
260
242#endif /* __ASSEMBLY__ */ 261#endif /* __ASSEMBLY__ */
243 262
244 263
diff --git a/arch/powerpc/include/asm/mpc52xx_psc.h b/arch/powerpc/include/asm/mpc52xx_psc.h
index 8917ed630565..a218da6bec7c 100644
--- a/arch/powerpc/include/asm/mpc52xx_psc.h
+++ b/arch/powerpc/include/asm/mpc52xx_psc.h
@@ -68,12 +68,20 @@
68#define MPC52xx_PSC_IMR_ORERR 0x1000 68#define MPC52xx_PSC_IMR_ORERR 0x1000
69#define MPC52xx_PSC_IMR_IPC 0x8000 69#define MPC52xx_PSC_IMR_IPC 0x8000
70 70
71/* PSC input port change bit */ 71/* PSC input port change bits */
72#define MPC52xx_PSC_CTS 0x01 72#define MPC52xx_PSC_CTS 0x01
73#define MPC52xx_PSC_DCD 0x02 73#define MPC52xx_PSC_DCD 0x02
74#define MPC52xx_PSC_D_CTS 0x10 74#define MPC52xx_PSC_D_CTS 0x10
75#define MPC52xx_PSC_D_DCD 0x20 75#define MPC52xx_PSC_D_DCD 0x20
76 76
77/* PSC acr bits */
78#define MPC52xx_PSC_IEC_CTS 0x01
79#define MPC52xx_PSC_IEC_DCD 0x02
80
81/* PSC output port bits */
82#define MPC52xx_PSC_OP_RTS 0x01
83#define MPC52xx_PSC_OP_RES 0x02
84
77/* PSC mode fields */ 85/* PSC mode fields */
78#define MPC52xx_PSC_MODE_5_BITS 0x00 86#define MPC52xx_PSC_MODE_5_BITS 0x00
79#define MPC52xx_PSC_MODE_6_BITS 0x01 87#define MPC52xx_PSC_MODE_6_BITS 0x01
@@ -91,6 +99,7 @@
91#define MPC52xx_PSC_MODE_ONE_STOP_5_BITS 0x00 99#define MPC52xx_PSC_MODE_ONE_STOP_5_BITS 0x00
92#define MPC52xx_PSC_MODE_ONE_STOP 0x07 100#define MPC52xx_PSC_MODE_ONE_STOP 0x07
93#define MPC52xx_PSC_MODE_TWO_STOP 0x0f 101#define MPC52xx_PSC_MODE_TWO_STOP 0x0f
102#define MPC52xx_PSC_MODE_TXCTS 0x10
94 103
95#define MPC52xx_PSC_RFNUM_MASK 0x01ff 104#define MPC52xx_PSC_RFNUM_MASK 0x01ff
96 105
diff --git a/arch/powerpc/include/asm/mutex.h b/arch/powerpc/include/asm/mutex.h
index 458c1f7fbc18..dabc01c727b8 100644
--- a/arch/powerpc/include/asm/mutex.h
+++ b/arch/powerpc/include/asm/mutex.h
@@ -1,9 +1,134 @@
1/* 1/*
2 * Pull in the generic implementation for the mutex fastpath. 2 * Optimised mutex implementation of include/asm-generic/mutex-dec.h algorithm
3 */
4#ifndef _ASM_POWERPC_MUTEX_H
5#define _ASM_POWERPC_MUTEX_H
6
7static inline int __mutex_cmpxchg_lock(atomic_t *v, int old, int new)
8{
9 int t;
10
11 __asm__ __volatile__ (
12"1: lwarx %0,0,%1 # mutex trylock\n\
13 cmpw 0,%0,%2\n\
14 bne- 2f\n"
15 PPC405_ERR77(0,%1)
16" stwcx. %3,0,%1\n\
17 bne- 1b"
18 ISYNC_ON_SMP
19 "\n\
202:"
21 : "=&r" (t)
22 : "r" (&v->counter), "r" (old), "r" (new)
23 : "cc", "memory");
24
25 return t;
26}
27
28static inline int __mutex_dec_return_lock(atomic_t *v)
29{
30 int t;
31
32 __asm__ __volatile__(
33"1: lwarx %0,0,%1 # mutex lock\n\
34 addic %0,%0,-1\n"
35 PPC405_ERR77(0,%1)
36" stwcx. %0,0,%1\n\
37 bne- 1b"
38 ISYNC_ON_SMP
39 : "=&r" (t)
40 : "r" (&v->counter)
41 : "cc", "memory");
42
43 return t;
44}
45
46static inline int __mutex_inc_return_unlock(atomic_t *v)
47{
48 int t;
49
50 __asm__ __volatile__(
51 LWSYNC_ON_SMP
52"1: lwarx %0,0,%1 # mutex unlock\n\
53 addic %0,%0,1\n"
54 PPC405_ERR77(0,%1)
55" stwcx. %0,0,%1 \n\
56 bne- 1b"
57 : "=&r" (t)
58 : "r" (&v->counter)
59 : "cc", "memory");
60
61 return t;
62}
63
64/**
65 * __mutex_fastpath_lock - try to take the lock by moving the count
66 * from 1 to a 0 value
67 * @count: pointer of type atomic_t
68 * @fail_fn: function to call if the original value was not 1
69 *
70 * Change the count from 1 to a value lower than 1, and call <fail_fn> if
71 * it wasn't 1 originally. This function MUST leave the value lower than
72 * 1 even when the "1" assertion wasn't true.
73 */
74static inline void
75__mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
76{
77 if (unlikely(__mutex_dec_return_lock(count) < 0))
78 fail_fn(count);
79}
80
81/**
82 * __mutex_fastpath_lock_retval - try to take the lock by moving the count
83 * from 1 to a 0 value
84 * @count: pointer of type atomic_t
85 * @fail_fn: function to call if the original value was not 1
86 *
87 * Change the count from 1 to a value lower than 1, and call <fail_fn> if
88 * it wasn't 1 originally. This function returns 0 if the fastpath succeeds,
89 * or anything the slow path function returns.
90 */
91static inline int
92__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
93{
94 if (unlikely(__mutex_dec_return_lock(count) < 0))
95 return fail_fn(count);
96 return 0;
97}
98
99/**
100 * __mutex_fastpath_unlock - try to promote the count from 0 to 1
101 * @count: pointer of type atomic_t
102 * @fail_fn: function to call if the original value was not 0
103 *
104 * Try to promote the count from 0 to 1. If it wasn't 0, call <fail_fn>.
105 * In the failure case, this function is allowed to either set the value to
106 * 1, or to set it to a value lower than 1.
107 */
108static inline void
109__mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *))
110{
111 if (unlikely(__mutex_inc_return_unlock(count) <= 0))
112 fail_fn(count);
113}
114
115#define __mutex_slowpath_needs_to_unlock() 1
116
117/**
118 * __mutex_fastpath_trylock - try to acquire the mutex, without waiting
119 *
120 * @count: pointer of type atomic_t
121 * @fail_fn: fallback function
3 * 122 *
4 * TODO: implement optimized primitives instead, or leave the generic 123 * Change the count from 1 to 0, and return 1 (success), or if the count
5 * implementation in place, or pick the atomic_xchg() based generic 124 * was not 1, then return 0 (failure).
6 * implementation. (see asm-generic/mutex-xchg.h for details)
7 */ 125 */
126static inline int
127__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
128{
129 if (likely(__mutex_cmpxchg_lock(count, 1, 0) == 1))
130 return 1;
131 return 0;
132}
8 133
9#include <asm-generic/mutex-dec.h> 134#endif
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index c0b8d4a29a91..197d569f5bd3 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -19,12 +19,15 @@
19#include <asm/kdump.h> 19#include <asm/kdump.h>
20 20
21/* 21/*
22 * On PPC32 page size is 4K. For PPC64 we support either 4K or 64K software 22 * On regular PPC32 page size is 4K (but we support 4K/16K/64K pages
23 * on PPC44x). For PPC64 we support either 4K or 64K software
23 * page size. When using 64K pages however, whether we are really supporting 24 * page size. When using 64K pages however, whether we are really supporting
24 * 64K pages in HW or not is irrelevant to those definitions. 25 * 64K pages in HW or not is irrelevant to those definitions.
25 */ 26 */
26#ifdef CONFIG_PPC_64K_PAGES 27#if defined(CONFIG_PPC_64K_PAGES)
27#define PAGE_SHIFT 16 28#define PAGE_SHIFT 16
29#elif defined(CONFIG_PPC_16K_PAGES)
30#define PAGE_SHIFT 14
28#else 31#else
29#define PAGE_SHIFT 12 32#define PAGE_SHIFT 12
30#endif 33#endif
@@ -151,7 +154,7 @@ typedef struct { pte_basic_t pte; } pte_t;
151/* 64k pages additionally define a bigger "real PTE" type that gathers 154/* 64k pages additionally define a bigger "real PTE" type that gathers
152 * the "second half" part of the PTE for pseudo 64k pages 155 * the "second half" part of the PTE for pseudo 64k pages
153 */ 156 */
154#ifdef CONFIG_PPC_64K_PAGES 157#if defined(CONFIG_PPC_64K_PAGES) && defined(CONFIG_PPC_STD_MMU_64)
155typedef struct { pte_t pte; unsigned long hidx; } real_pte_t; 158typedef struct { pte_t pte; unsigned long hidx; } real_pte_t;
156#else 159#else
157typedef struct { pte_t pte; } real_pte_t; 160typedef struct { pte_t pte; } real_pte_t;
@@ -191,10 +194,10 @@ typedef pte_basic_t pte_t;
191#define pte_val(x) (x) 194#define pte_val(x) (x)
192#define __pte(x) (x) 195#define __pte(x) (x)
193 196
194#ifdef CONFIG_PPC_64K_PAGES 197#if defined(CONFIG_PPC_64K_PAGES) && defined(CONFIG_PPC_STD_MMU_64)
195typedef struct { pte_t pte; unsigned long hidx; } real_pte_t; 198typedef struct { pte_t pte; unsigned long hidx; } real_pte_t;
196#else 199#else
197typedef unsigned long real_pte_t; 200typedef pte_t real_pte_t;
198#endif 201#endif
199 202
200 203
diff --git a/arch/powerpc/include/asm/page_32.h b/arch/powerpc/include/asm/page_32.h
index d77072a32cc6..1458d9500381 100644
--- a/arch/powerpc/include/asm/page_32.h
+++ b/arch/powerpc/include/asm/page_32.h
@@ -19,6 +19,8 @@
19#define PTE_FLAGS_OFFSET 0 19#define PTE_FLAGS_OFFSET 0
20#endif 20#endif
21 21
22#define PTE_SHIFT (PAGE_SHIFT - PTE_T_LOG2) /* full page */
23
22#ifndef __ASSEMBLY__ 24#ifndef __ASSEMBLY__
23/* 25/*
24 * The basic type of a PTE - 64 bits for those CPUs with > 32 bit 26 * The basic type of a PTE - 64 bits for those CPUs with > 32 bit
@@ -26,10 +28,8 @@
26 */ 28 */
27#ifdef CONFIG_PTE_64BIT 29#ifdef CONFIG_PTE_64BIT
28typedef unsigned long long pte_basic_t; 30typedef unsigned long long pte_basic_t;
29#define PTE_SHIFT (PAGE_SHIFT - 3) /* 512 ptes per page */
30#else 31#else
31typedef unsigned long pte_basic_t; 32typedef unsigned long pte_basic_t;
32#define PTE_SHIFT (PAGE_SHIFT - 2) /* 1024 ptes per page */
33#endif 33#endif
34 34
35struct page; 35struct page;
@@ -39,6 +39,9 @@ extern void copy_page(void *to, void *from);
39 39
40#include <asm-generic/page.h> 40#include <asm-generic/page.h>
41 41
42#define PGD_T_LOG2 (__builtin_ffs(sizeof(pgd_t)) - 1)
43#define PTE_T_LOG2 (__builtin_ffs(sizeof(pte_t)) - 1)
44
42#endif /* __ASSEMBLY__ */ 45#endif /* __ASSEMBLY__ */
43 46
44#endif /* _ASM_POWERPC_PAGE_32_H */ 47#endif /* _ASM_POWERPC_PAGE_32_H */
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 9047af7baa69..84007afabdb5 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -13,7 +13,6 @@
13 13
14struct device_node; 14struct device_node;
15 15
16extern unsigned int ppc_pci_flags;
17enum { 16enum {
18 /* Force re-assigning all resources (ignore firmware 17 /* Force re-assigning all resources (ignore firmware
19 * setup completely) 18 * setup completely)
@@ -36,6 +35,31 @@ enum {
36 /* ... except for domain 0 */ 35 /* ... except for domain 0 */
37 PPC_PCI_COMPAT_DOMAIN_0 = 0x00000020, 36 PPC_PCI_COMPAT_DOMAIN_0 = 0x00000020,
38}; 37};
38#ifdef CONFIG_PCI
39extern unsigned int ppc_pci_flags;
40
41static inline void ppc_pci_set_flags(int flags)
42{
43 ppc_pci_flags = flags;
44}
45
46static inline void ppc_pci_add_flags(int flags)
47{
48 ppc_pci_flags |= flags;
49}
50
51static inline int ppc_pci_has_flag(int flag)
52{
53 return (ppc_pci_flags & flag);
54}
55#else
56static inline void ppc_pci_set_flags(int flags) { }
57static inline void ppc_pci_add_flags(int flags) { }
58static inline int ppc_pci_has_flag(int flag)
59{
60 return 0;
61}
62#endif
39 63
40 64
41/* 65/*
@@ -241,9 +265,6 @@ extern void pcibios_remove_pci_devices(struct pci_bus *bus);
241 265
242/** Discover new pci devices under this bus, and add them */ 266/** Discover new pci devices under this bus, and add them */
243extern void pcibios_add_pci_devices(struct pci_bus *bus); 267extern void pcibios_add_pci_devices(struct pci_bus *bus);
244extern void pcibios_fixup_new_pci_devices(struct pci_bus *bus);
245
246extern int pcibios_remove_root_bus(struct pci_controller *phb);
247 268
248static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus) 269static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
249{ 270{
@@ -290,6 +311,7 @@ extern void pci_process_bridge_OF_ranges(struct pci_controller *hose,
290/* Allocate & free a PCI host bridge structure */ 311/* Allocate & free a PCI host bridge structure */
291extern struct pci_controller *pcibios_alloc_controller(struct device_node *dev); 312extern struct pci_controller *pcibios_alloc_controller(struct device_node *dev);
292extern void pcibios_free_controller(struct pci_controller *phb); 313extern void pcibios_free_controller(struct pci_controller *phb);
314extern void pcibios_setup_phb_resources(struct pci_controller *hose);
293 315
294#ifdef CONFIG_PCI 316#ifdef CONFIG_PCI
295extern unsigned long pci_address_to_pio(phys_addr_t address); 317extern unsigned long pci_address_to_pio(phys_addr_t address);
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index 57a2a494886b..3548159a1beb 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -38,8 +38,8 @@ struct pci_dev;
38 * Set this to 1 if you want the kernel to re-assign all PCI 38 * Set this to 1 if you want the kernel to re-assign all PCI
39 * bus numbers (don't do that on ppc64 yet !) 39 * bus numbers (don't do that on ppc64 yet !)
40 */ 40 */
41#define pcibios_assign_all_busses() (ppc_pci_flags & \ 41#define pcibios_assign_all_busses() \
42 PPC_PCI_REASSIGN_ALL_BUS) 42 (ppc_pci_has_flag(PPC_PCI_REASSIGN_ALL_BUS))
43#define pcibios_scan_all_fns(a, b) 0 43#define pcibios_scan_all_fns(a, b) 0
44 44
45static inline void pcibios_set_master(struct pci_dev *dev) 45static inline void pcibios_set_master(struct pci_dev *dev)
@@ -204,15 +204,14 @@ static inline struct resource *pcibios_select_root(struct pci_dev *pdev,
204 return root; 204 return root;
205} 205}
206 206
207extern void pcibios_setup_new_device(struct pci_dev *dev);
208
209extern void pcibios_claim_one_bus(struct pci_bus *b); 207extern void pcibios_claim_one_bus(struct pci_bus *b);
210 208
211extern void pcibios_allocate_bus_resources(struct pci_bus *bus); 209extern void pcibios_finish_adding_to_bus(struct pci_bus *bus);
212 210
213extern void pcibios_resource_survey(void); 211extern void pcibios_resource_survey(void);
214 212
215extern struct pci_controller *init_phb_dynamic(struct device_node *dn); 213extern struct pci_controller *init_phb_dynamic(struct device_node *dn);
214extern int remove_phb_dynamic(struct pci_controller *phb);
216 215
217extern struct pci_dev *of_create_pci_dev(struct device_node *node, 216extern struct pci_dev *of_create_pci_dev(struct device_node *node,
218 struct pci_bus *bus, int devfn); 217 struct pci_bus *bus, int devfn);
@@ -221,6 +220,7 @@ extern void of_scan_pci_bridge(struct device_node *node,
221 struct pci_dev *dev); 220 struct pci_dev *dev);
222 221
223extern void of_scan_bus(struct device_node *node, struct pci_bus *bus); 222extern void of_scan_bus(struct device_node *node, struct pci_bus *bus);
223extern void of_rescan_bus(struct device_node *node, struct pci_bus *bus);
224 224
225extern int pci_read_irq_line(struct pci_dev *dev); 225extern int pci_read_irq_line(struct pci_dev *dev);
226 226
@@ -235,9 +235,8 @@ extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
235 const struct resource *rsrc, 235 const struct resource *rsrc,
236 resource_size_t *start, resource_size_t *end); 236 resource_size_t *start, resource_size_t *end);
237 237
238extern void pcibios_do_bus_setup(struct pci_bus *bus); 238extern void pcibios_setup_bus_devices(struct pci_bus *bus);
239extern void pcibios_fixup_of_probed_bus(struct pci_bus *bus); 239extern void pcibios_setup_bus_self(struct pci_bus *bus);
240
241 240
242#endif /* __KERNEL__ */ 241#endif /* __KERNEL__ */
243#endif /* __ASM_POWERPC_PCI_H */ 242#endif /* __ASM_POWERPC_PCI_H */
diff --git a/arch/powerpc/include/asm/pgalloc-32.h b/arch/powerpc/include/asm/pgalloc-32.h
index 58c07147b3ea..0815eb40acae 100644
--- a/arch/powerpc/include/asm/pgalloc-32.h
+++ b/arch/powerpc/include/asm/pgalloc-32.h
@@ -3,6 +3,8 @@
3 3
4#include <linux/threads.h> 4#include <linux/threads.h>
5 5
6#define PTE_NONCACHE_NUM 0 /* dummy for now to share code w/ppc64 */
7
6extern void __bad_pte(pmd_t *pmd); 8extern void __bad_pte(pmd_t *pmd);
7 9
8extern pgd_t *pgd_alloc(struct mm_struct *mm); 10extern pgd_t *pgd_alloc(struct mm_struct *mm);
@@ -33,10 +35,13 @@ extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
33 35
34extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr); 36extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr);
35extern pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addr); 37extern pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addr);
36extern void pte_free_kernel(struct mm_struct *mm, pte_t *pte);
37extern void pte_free(struct mm_struct *mm, pgtable_t pte);
38 38
39#define __pte_free_tlb(tlb, pte) pte_free((tlb)->mm, (pte)) 39static inline void pgtable_free(pgtable_free_t pgf)
40{
41 void *p = (void *)(pgf.val & ~PGF_CACHENUM_MASK);
42
43 free_page((unsigned long)p);
44}
40 45
41#define check_pgt_cache() do { } while (0) 46#define check_pgt_cache() do { } while (0)
42 47
diff --git a/arch/powerpc/include/asm/pgalloc-64.h b/arch/powerpc/include/asm/pgalloc-64.h
index 812a1d8f35cb..afda2bdd860f 100644
--- a/arch/powerpc/include/asm/pgalloc-64.h
+++ b/arch/powerpc/include/asm/pgalloc-64.h
@@ -7,7 +7,6 @@
7 * 2 of the License, or (at your option) any later version. 7 * 2 of the License, or (at your option) any later version.
8 */ 8 */
9 9
10#include <linux/mm.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <linux/cpumask.h> 11#include <linux/cpumask.h>
13#include <linux/percpu.h> 12#include <linux/percpu.h>
@@ -108,31 +107,6 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
108 return page; 107 return page;
109} 108}
110 109
111static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
112{
113 free_page((unsigned long)pte);
114}
115
116static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)
117{
118 pgtable_page_dtor(ptepage);
119 __free_page(ptepage);
120}
121
122#define PGF_CACHENUM_MASK 0x7
123
124typedef struct pgtable_free {
125 unsigned long val;
126} pgtable_free_t;
127
128static inline pgtable_free_t pgtable_free_cache(void *p, int cachenum,
129 unsigned long mask)
130{
131 BUG_ON(cachenum > PGF_CACHENUM_MASK);
132
133 return (pgtable_free_t){.val = ((unsigned long) p & ~mask) | cachenum};
134}
135
136static inline void pgtable_free(pgtable_free_t pgf) 110static inline void pgtable_free(pgtable_free_t pgf)
137{ 111{
138 void *p = (void *)(pgf.val & ~PGF_CACHENUM_MASK); 112 void *p = (void *)(pgf.val & ~PGF_CACHENUM_MASK);
@@ -144,14 +118,6 @@ static inline void pgtable_free(pgtable_free_t pgf)
144 kmem_cache_free(pgtable_cache[cachenum], p); 118 kmem_cache_free(pgtable_cache[cachenum], p);
145} 119}
146 120
147extern void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf);
148
149#define __pte_free_tlb(tlb,ptepage) \
150do { \
151 pgtable_page_dtor(ptepage); \
152 pgtable_free_tlb(tlb, pgtable_free_cache(page_address(ptepage), \
153 PTE_NONCACHE_NUM, PTE_TABLE_SIZE-1)); \
154} while (0)
155#define __pmd_free_tlb(tlb, pmd) \ 121#define __pmd_free_tlb(tlb, pmd) \
156 pgtable_free_tlb(tlb, pgtable_free_cache(pmd, \ 122 pgtable_free_tlb(tlb, pgtable_free_cache(pmd, \
157 PMD_CACHE_NUM, PMD_TABLE_SIZE-1)) 123 PMD_CACHE_NUM, PMD_TABLE_SIZE-1))
diff --git a/arch/powerpc/include/asm/pgalloc.h b/arch/powerpc/include/asm/pgalloc.h
index b4505ed0f0f2..5d8480265a77 100644
--- a/arch/powerpc/include/asm/pgalloc.h
+++ b/arch/powerpc/include/asm/pgalloc.h
@@ -2,11 +2,52 @@
2#define _ASM_POWERPC_PGALLOC_H 2#define _ASM_POWERPC_PGALLOC_H
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/mm.h>
6
7static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
8{
9 free_page((unsigned long)pte);
10}
11
12static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)
13{
14 pgtable_page_dtor(ptepage);
15 __free_page(ptepage);
16}
17
18typedef struct pgtable_free {
19 unsigned long val;
20} pgtable_free_t;
21
22#define PGF_CACHENUM_MASK 0x7
23
24static inline pgtable_free_t pgtable_free_cache(void *p, int cachenum,
25 unsigned long mask)
26{
27 BUG_ON(cachenum > PGF_CACHENUM_MASK);
28
29 return (pgtable_free_t){.val = ((unsigned long) p & ~mask) | cachenum};
30}
31
5#ifdef CONFIG_PPC64 32#ifdef CONFIG_PPC64
6#include <asm/pgalloc-64.h> 33#include <asm/pgalloc-64.h>
7#else 34#else
8#include <asm/pgalloc-32.h> 35#include <asm/pgalloc-32.h>
9#endif 36#endif
10 37
38extern void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf);
39
40#ifdef CONFIG_SMP
41#define __pte_free_tlb(tlb,ptepage) \
42do { \
43 pgtable_page_dtor(ptepage); \
44 pgtable_free_tlb(tlb, pgtable_free_cache(page_address(ptepage), \
45 PTE_NONCACHE_NUM, PTE_TABLE_SIZE-1)); \
46} while (0)
47#else
48#define __pte_free_tlb(tlb, pte) pte_free((tlb)->mm, (pte))
49#endif
50
51
11#endif /* __KERNEL__ */ 52#endif /* __KERNEL__ */
12#endif /* _ASM_POWERPC_PGALLOC_H */ 53#endif /* _ASM_POWERPC_PGALLOC_H */
diff --git a/arch/powerpc/include/asm/pgtable-ppc32.h b/arch/powerpc/include/asm/pgtable-ppc32.h
index 6ab7c67cb5ab..f69a4d977729 100644
--- a/arch/powerpc/include/asm/pgtable-ppc32.h
+++ b/arch/powerpc/include/asm/pgtable-ppc32.h
@@ -228,9 +228,10 @@ extern int icache_44x_need_flush;
228 * - FILE *must* be in the bottom three bits because swap cache 228 * - FILE *must* be in the bottom three bits because swap cache
229 * entries use the top 29 bits for TLB2. 229 * entries use the top 29 bits for TLB2.
230 * 230 *
231 * - CACHE COHERENT bit (M) has no effect on PPC440 core, because it 231 * - CACHE COHERENT bit (M) has no effect on original PPC440 cores,
232 * doesn't support SMP. So we can use this as software bit, like 232 * because it doesn't support SMP. However, some later 460 variants
233 * DIRTY. 233 * have -some- form of SMP support and so I keep the bit there for
234 * future use
234 * 235 *
235 * With the PPC 44x Linux implementation, the 0-11th LSBs of the PTE are used 236 * With the PPC 44x Linux implementation, the 0-11th LSBs of the PTE are used
236 * for memory protection related functions (see PTE structure in 237 * for memory protection related functions (see PTE structure in
@@ -436,20 +437,23 @@ extern int icache_44x_need_flush;
436 _PAGE_USER | _PAGE_ACCESSED | \ 437 _PAGE_USER | _PAGE_ACCESSED | \
437 _PAGE_RW | _PAGE_HWWRITE | _PAGE_DIRTY | \ 438 _PAGE_RW | _PAGE_HWWRITE | _PAGE_DIRTY | \
438 _PAGE_EXEC | _PAGE_HWEXEC) 439 _PAGE_EXEC | _PAGE_HWEXEC)
440
439/* 441/*
440 * Note: the _PAGE_COHERENT bit automatically gets set in the hardware 442 * We define 2 sets of base prot bits, one for basic pages (ie,
441 * PTE if CONFIG_SMP is defined (hash_page does this); there is no need 443 * cacheable kernel and user pages) and one for non cacheable
442 * to have it in the Linux PTE, and in fact the bit could be reused for 444 * pages. We always set _PAGE_COHERENT when SMP is enabled or
443 * another purpose. -- paulus. 445 * the processor might need it for DMA coherency.
444 */ 446 */
445 447#if defined(CONFIG_SMP) || defined(CONFIG_PPC_STD_MMU)
446#ifdef CONFIG_44x 448#define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_COHERENT)
447#define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_GUARDED)
448#else 449#else
449#define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED) 450#define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED)
450#endif 451#endif
452#define _PAGE_BASE_NC (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_NO_CACHE)
453
451#define _PAGE_WRENABLE (_PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE) 454#define _PAGE_WRENABLE (_PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE)
452#define _PAGE_KERNEL (_PAGE_BASE | _PAGE_SHARED | _PAGE_WRENABLE) 455#define _PAGE_KERNEL (_PAGE_BASE | _PAGE_SHARED | _PAGE_WRENABLE)
456#define _PAGE_KERNEL_NC (_PAGE_BASE_NC | _PAGE_SHARED | _PAGE_WRENABLE)
453 457
454#ifdef CONFIG_PPC_STD_MMU 458#ifdef CONFIG_PPC_STD_MMU
455/* On standard PPC MMU, no user access implies kernel read/write access, 459/* On standard PPC MMU, no user access implies kernel read/write access,
@@ -459,7 +463,7 @@ extern int icache_44x_need_flush;
459#define _PAGE_KERNEL_RO (_PAGE_BASE | _PAGE_SHARED) 463#define _PAGE_KERNEL_RO (_PAGE_BASE | _PAGE_SHARED)
460#endif 464#endif
461 465
462#define _PAGE_IO (_PAGE_KERNEL | _PAGE_NO_CACHE | _PAGE_GUARDED) 466#define _PAGE_IO (_PAGE_KERNEL_NC | _PAGE_GUARDED)
463#define _PAGE_RAM (_PAGE_KERNEL | _PAGE_HWEXEC) 467#define _PAGE_RAM (_PAGE_KERNEL | _PAGE_HWEXEC)
464 468
465#if defined(CONFIG_KGDB) || defined(CONFIG_XMON) || defined(CONFIG_BDI_SWITCH) ||\ 469#if defined(CONFIG_KGDB) || defined(CONFIG_XMON) || defined(CONFIG_BDI_SWITCH) ||\
@@ -552,9 +556,6 @@ static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;
552static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 556static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
553static inline int pte_special(pte_t pte) { return pte_val(pte) & _PAGE_SPECIAL; } 557static inline int pte_special(pte_t pte) { return pte_val(pte) & _PAGE_SPECIAL; }
554 558
555static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; }
556static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; }
557
558static inline pte_t pte_wrprotect(pte_t pte) { 559static inline pte_t pte_wrprotect(pte_t pte) {
559 pte_val(pte) &= ~(_PAGE_RW | _PAGE_HWWRITE); return pte; } 560 pte_val(pte) &= ~(_PAGE_RW | _PAGE_HWWRITE); return pte; }
560static inline pte_t pte_mkclean(pte_t pte) { 561static inline pte_t pte_mkclean(pte_t pte) {
@@ -693,10 +694,11 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr,
693#endif 694#endif
694} 695}
695 696
697
696static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, 698static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
697 pte_t *ptep, pte_t pte) 699 pte_t *ptep, pte_t pte)
698{ 700{
699#if defined(CONFIG_PTE_64BIT) && defined(CONFIG_SMP) 701#if defined(CONFIG_PTE_64BIT) && defined(CONFIG_SMP) && defined(CONFIG_DEBUG_VM)
700 WARN_ON(pte_present(*ptep)); 702 WARN_ON(pte_present(*ptep));
701#endif 703#endif
702 __set_pte_at(mm, addr, ptep, pte); 704 __set_pte_at(mm, addr, ptep, pte);
@@ -760,16 +762,6 @@ static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry, int dirty)
760 __changed; \ 762 __changed; \
761}) 763})
762 764
763/*
764 * Macro to mark a page protection value as "uncacheable".
765 */
766#define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_NO_CACHE | _PAGE_GUARDED))
767
768struct file;
769extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
770 unsigned long size, pgprot_t vma_prot);
771#define __HAVE_PHYS_MEM_ACCESS_PROT
772
773#define __HAVE_ARCH_PTE_SAME 765#define __HAVE_ARCH_PTE_SAME
774#define pte_same(A,B) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HASHPTE) == 0) 766#define pte_same(A,B) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HASHPTE) == 0)
775 767
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index 4c0a8c62859d..b0f18be81d9f 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -100,7 +100,7 @@
100 100
101#define _PAGE_WRENABLE (_PAGE_RW | _PAGE_DIRTY) 101#define _PAGE_WRENABLE (_PAGE_RW | _PAGE_DIRTY)
102 102
103/* __pgprot defined in arch/powerpc/incliude/asm/page.h */ 103/* __pgprot defined in arch/powerpc/include/asm/page.h */
104#define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED) 104#define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED)
105 105
106#define PAGE_SHARED __pgprot(_PAGE_BASE | _PAGE_RW | _PAGE_USER) 106#define PAGE_SHARED __pgprot(_PAGE_BASE | _PAGE_RW | _PAGE_USER)
@@ -245,9 +245,6 @@ static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;}
245static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;} 245static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;}
246static inline int pte_special(pte_t pte) { return pte_val(pte) & _PAGE_SPECIAL; } 246static inline int pte_special(pte_t pte) { return pte_val(pte) & _PAGE_SPECIAL; }
247 247
248static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; }
249static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; }
250
251static inline pte_t pte_wrprotect(pte_t pte) { 248static inline pte_t pte_wrprotect(pte_t pte) {
252 pte_val(pte) &= ~(_PAGE_RW); return pte; } 249 pte_val(pte) &= ~(_PAGE_RW); return pte; }
253static inline pte_t pte_mkclean(pte_t pte) { 250static inline pte_t pte_mkclean(pte_t pte) {
@@ -405,16 +402,6 @@ static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry, int dirty)
405 __changed; \ 402 __changed; \
406}) 403})
407 404
408/*
409 * Macro to mark a page protection value as "uncacheable".
410 */
411#define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_NO_CACHE | _PAGE_GUARDED))
412
413struct file;
414extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
415 unsigned long size, pgprot_t vma_prot);
416#define __HAVE_PHYS_MEM_ACCESS_PROT
417
418#define __HAVE_ARCH_PTE_SAME 405#define __HAVE_ARCH_PTE_SAME
419#define pte_same(A,B) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HPTEFLAGS) == 0) 406#define pte_same(A,B) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HPTEFLAGS) == 0)
420 407
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index dbb8ca172e44..07f55e601696 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -16,6 +16,32 @@ struct mm_struct;
16#endif 16#endif
17 17
18#ifndef __ASSEMBLY__ 18#ifndef __ASSEMBLY__
19
20/*
21 * Macro to mark a page protection value as "uncacheable".
22 */
23
24#define _PAGE_CACHE_CTL (_PAGE_COHERENT | _PAGE_GUARDED | _PAGE_NO_CACHE | \
25 _PAGE_WRITETHRU)
26
27#define pgprot_noncached(prot) (__pgprot((pgprot_val(prot) & ~_PAGE_CACHE_CTL) | \
28 _PAGE_NO_CACHE | _PAGE_GUARDED))
29
30#define pgprot_noncached_wc(prot) (__pgprot((pgprot_val(prot) & ~_PAGE_CACHE_CTL) | \
31 _PAGE_NO_CACHE))
32
33#define pgprot_cached(prot) (__pgprot((pgprot_val(prot) & ~_PAGE_CACHE_CTL) | \
34 _PAGE_COHERENT))
35
36#define pgprot_cached_wthru(prot) (__pgprot((pgprot_val(prot) & ~_PAGE_CACHE_CTL) | \
37 _PAGE_COHERENT | _PAGE_WRITETHRU))
38
39
40struct file;
41extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
42 unsigned long size, pgprot_t vma_prot);
43#define __HAVE_PHYS_MEM_ACCESS_PROT
44
19/* 45/*
20 * ZERO_PAGE is a global shared page that is always zero: used 46 * ZERO_PAGE is a global shared page that is always zero: used
21 * for zero-mapped memory areas etc.. 47 * for zero-mapped memory areas etc..
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
index c4a029ccb4d3..1a0d628eb114 100644
--- a/arch/powerpc/include/asm/ppc_asm.h
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -425,14 +425,14 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601)
425#define fromreal(rd) tovirt(rd,rd) 425#define fromreal(rd) tovirt(rd,rd)
426 426
427#define tophys(rd,rs) \ 427#define tophys(rd,rs) \
4280: addis rd,rs,-KERNELBASE@h; \ 4280: addis rd,rs,-PAGE_OFFSET@h; \
429 .section ".vtop_fixup","aw"; \ 429 .section ".vtop_fixup","aw"; \
430 .align 1; \ 430 .align 1; \
431 .long 0b; \ 431 .long 0b; \
432 .previous 432 .previous
433 433
434#define tovirt(rd,rs) \ 434#define tovirt(rd,rs) \
4350: addis rd,rs,KERNELBASE@h; \ 4350: addis rd,rs,PAGE_OFFSET@h; \
436 .section ".ptov_fixup","aw"; \ 436 .section ".ptov_fixup","aw"; \
437 .align 1; \ 437 .align 1; \
438 .long 0b; \ 438 .long 0b; \
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index 101ed87f7d84..d3466490104a 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -69,8 +69,6 @@ extern int _prep_type;
69 69
70#ifdef __KERNEL__ 70#ifdef __KERNEL__
71 71
72extern int have_of;
73
74struct task_struct; 72struct task_struct;
75void start_thread(struct pt_regs *regs, unsigned long fdptr, unsigned long sp); 73void start_thread(struct pt_regs *regs, unsigned long fdptr, unsigned long sp);
76void release_thread(struct task_struct *); 74void release_thread(struct task_struct *);
@@ -207,6 +205,11 @@ struct thread_struct {
207#define INIT_SP_LIMIT \ 205#define INIT_SP_LIMIT \
208 (_ALIGN_UP(sizeof(init_thread_info), 16) + (unsigned long) &init_stack) 206 (_ALIGN_UP(sizeof(init_thread_info), 16) + (unsigned long) &init_stack)
209 207
208#ifdef CONFIG_SPE
209#define SPEFSCR_INIT .spefscr = SPEFSCR_FINVE | SPEFSCR_FDBZE | SPEFSCR_FUNFE | SPEFSCR_FOVFE,
210#else
211#define SPEFSCR_INIT
212#endif
210 213
211#ifdef CONFIG_PPC32 214#ifdef CONFIG_PPC32
212#define INIT_THREAD { \ 215#define INIT_THREAD { \
@@ -215,6 +218,7 @@ struct thread_struct {
215 .fs = KERNEL_DS, \ 218 .fs = KERNEL_DS, \
216 .pgdir = swapper_pg_dir, \ 219 .pgdir = swapper_pg_dir, \
217 .fpexc_mode = MSR_FE0 | MSR_FE1, \ 220 .fpexc_mode = MSR_FE0 | MSR_FE1, \
221 SPEFSCR_INIT \
218} 222}
219#else 223#else
220#define INIT_THREAD { \ 224#define INIT_THREAD { \
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index eb3bd2e1c7f6..6ff04185d2aa 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -253,6 +253,9 @@ extern void kdump_move_device_tree(void);
253/* CPU OF node matching */ 253/* CPU OF node matching */
254struct device_node *of_get_cpu_node(int cpu, unsigned int *thread); 254struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
255 255
256/* cache lookup */
257struct device_node *of_find_next_cache_node(struct device_node *np);
258
256/* Get the MAC address */ 259/* Get the MAC address */
257extern const void *of_get_mac_address(struct device_node *np); 260extern const void *of_get_mac_address(struct device_node *np);
258 261
diff --git a/arch/powerpc/include/asm/ps3.h b/arch/powerpc/include/asm/ps3.h
index f9e34c493cbb..cff30c0ef1ff 100644
--- a/arch/powerpc/include/asm/ps3.h
+++ b/arch/powerpc/include/asm/ps3.h
@@ -305,30 +305,34 @@ static inline const char* ps3_result(int result)
305/* system bus routines */ 305/* system bus routines */
306 306
307enum ps3_match_id { 307enum ps3_match_id {
308 PS3_MATCH_ID_EHCI = 1, 308 PS3_MATCH_ID_EHCI = 1,
309 PS3_MATCH_ID_OHCI = 2, 309 PS3_MATCH_ID_OHCI = 2,
310 PS3_MATCH_ID_GELIC = 3, 310 PS3_MATCH_ID_GELIC = 3,
311 PS3_MATCH_ID_AV_SETTINGS = 4, 311 PS3_MATCH_ID_AV_SETTINGS = 4,
312 PS3_MATCH_ID_SYSTEM_MANAGER = 5, 312 PS3_MATCH_ID_SYSTEM_MANAGER = 5,
313 PS3_MATCH_ID_STOR_DISK = 6, 313 PS3_MATCH_ID_STOR_DISK = 6,
314 PS3_MATCH_ID_STOR_ROM = 7, 314 PS3_MATCH_ID_STOR_ROM = 7,
315 PS3_MATCH_ID_STOR_FLASH = 8, 315 PS3_MATCH_ID_STOR_FLASH = 8,
316 PS3_MATCH_ID_SOUND = 9, 316 PS3_MATCH_ID_SOUND = 9,
317 PS3_MATCH_ID_GRAPHICS = 10, 317 PS3_MATCH_ID_GPU = 10,
318 PS3_MATCH_ID_LPM = 11, 318 PS3_MATCH_ID_LPM = 11,
319}; 319};
320 320
321#define PS3_MODULE_ALIAS_EHCI "ps3:1" 321enum ps3_match_sub_id {
322#define PS3_MODULE_ALIAS_OHCI "ps3:2" 322 PS3_MATCH_SUB_ID_GPU_FB = 1,
323#define PS3_MODULE_ALIAS_GELIC "ps3:3" 323};
324#define PS3_MODULE_ALIAS_AV_SETTINGS "ps3:4" 324
325#define PS3_MODULE_ALIAS_SYSTEM_MANAGER "ps3:5" 325#define PS3_MODULE_ALIAS_EHCI "ps3:1:0"
326#define PS3_MODULE_ALIAS_STOR_DISK "ps3:6" 326#define PS3_MODULE_ALIAS_OHCI "ps3:2:0"
327#define PS3_MODULE_ALIAS_STOR_ROM "ps3:7" 327#define PS3_MODULE_ALIAS_GELIC "ps3:3:0"
328#define PS3_MODULE_ALIAS_STOR_FLASH "ps3:8" 328#define PS3_MODULE_ALIAS_AV_SETTINGS "ps3:4:0"
329#define PS3_MODULE_ALIAS_SOUND "ps3:9" 329#define PS3_MODULE_ALIAS_SYSTEM_MANAGER "ps3:5:0"
330#define PS3_MODULE_ALIAS_GRAPHICS "ps3:10" 330#define PS3_MODULE_ALIAS_STOR_DISK "ps3:6:0"
331#define PS3_MODULE_ALIAS_LPM "ps3:11" 331#define PS3_MODULE_ALIAS_STOR_ROM "ps3:7:0"
332#define PS3_MODULE_ALIAS_STOR_FLASH "ps3:8:0"
333#define PS3_MODULE_ALIAS_SOUND "ps3:9:0"
334#define PS3_MODULE_ALIAS_GPU_FB "ps3:10:1"
335#define PS3_MODULE_ALIAS_LPM "ps3:11:0"
332 336
333enum ps3_system_bus_device_type { 337enum ps3_system_bus_device_type {
334 PS3_DEVICE_TYPE_IOC0 = 1, 338 PS3_DEVICE_TYPE_IOC0 = 1,
@@ -337,11 +341,6 @@ enum ps3_system_bus_device_type {
337 PS3_DEVICE_TYPE_LPM, 341 PS3_DEVICE_TYPE_LPM,
338}; 342};
339 343
340enum ps3_match_sub_id {
341 /* for PS3_MATCH_ID_GRAPHICS */
342 PS3_MATCH_SUB_ID_FB = 1,
343};
344
345/** 344/**
346 * struct ps3_system_bus_device - a device on the system bus 345 * struct ps3_system_bus_device - a device on the system bus
347 */ 346 */
@@ -516,4 +515,7 @@ void ps3_sync_irq(int node);
516u32 ps3_get_hw_thread_id(int cpu); 515u32 ps3_get_hw_thread_id(int cpu);
517u64 ps3_get_spe_id(void *arg); 516u64 ps3_get_spe_id(void *arg);
518 517
518/* mutex synchronizing GPU accesses and video mode changes */
519extern struct mutex ps3_gpu_mutex;
520
519#endif 521#endif
diff --git a/arch/powerpc/include/asm/ps3av.h b/arch/powerpc/include/asm/ps3av.h
index 5aa22cffdbd6..cd24ac16660a 100644
--- a/arch/powerpc/include/asm/ps3av.h
+++ b/arch/powerpc/include/asm/ps3av.h
@@ -740,8 +740,4 @@ extern int ps3av_audio_mute(int);
740extern int ps3av_audio_mute_analog(int); 740extern int ps3av_audio_mute_analog(int);
741extern int ps3av_dev_open(void); 741extern int ps3av_dev_open(void);
742extern int ps3av_dev_close(void); 742extern int ps3av_dev_close(void);
743extern void ps3av_register_flip_ctl(void (*flip_ctl)(int on, void *data),
744 void *flip_data);
745extern void ps3av_flip_ctl(int on);
746
747#endif /* _ASM_POWERPC_PS3AV_H_ */ 743#endif /* _ASM_POWERPC_PS3AV_H_ */
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index c6d1ab650778..f484a343efba 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -783,6 +783,10 @@ extern void scom970_write(unsigned int address, unsigned long value);
783#define __get_SP() ({unsigned long sp; \ 783#define __get_SP() ({unsigned long sp; \
784 asm volatile("mr %0,1": "=r" (sp)); sp;}) 784 asm volatile("mr %0,1": "=r" (sp)); sp;})
785 785
786struct pt_regs;
787
788extern void ppc_save_regs(struct pt_regs *regs);
789
786#endif /* __ASSEMBLY__ */ 790#endif /* __ASSEMBLY__ */
787#endif /* __KERNEL__ */ 791#endif /* __KERNEL__ */
788#endif /* _ASM_POWERPC_REG_H */ 792#endif /* _ASM_POWERPC_REG_H */
diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
index 8eaa7b28d9d0..e0175beb4462 100644
--- a/arch/powerpc/include/asm/rtas.h
+++ b/arch/powerpc/include/asm/rtas.h
@@ -168,6 +168,7 @@ extern void rtas_os_term(char *str);
168extern int rtas_get_sensor(int sensor, int index, int *state); 168extern int rtas_get_sensor(int sensor, int index, int *state);
169extern int rtas_get_power_level(int powerdomain, int *level); 169extern int rtas_get_power_level(int powerdomain, int *level);
170extern int rtas_set_power_level(int powerdomain, int level, int *setlevel); 170extern int rtas_set_power_level(int powerdomain, int level, int *setlevel);
171extern bool rtas_indicator_present(int token, int *maxindex);
171extern int rtas_set_indicator(int indicator, int index, int new_value); 172extern int rtas_set_indicator(int indicator, int index, int new_value);
172extern int rtas_set_indicator_fast(int indicator, int index, int new_value); 173extern int rtas_set_indicator_fast(int indicator, int index, int new_value);
173extern void rtas_progress(char *s, unsigned short hex); 174extern void rtas_progress(char *s, unsigned short hex);
diff --git a/arch/powerpc/include/asm/sfp-machine.h b/arch/powerpc/include/asm/sfp-machine.h
index ced34f1dc8f8..3d9f831c3c55 100644
--- a/arch/powerpc/include/asm/sfp-machine.h
+++ b/arch/powerpc/include/asm/sfp-machine.h
@@ -82,7 +82,7 @@
82#define _FP_MUL_MEAT_S(R,X,Y) _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) 82#define _FP_MUL_MEAT_S(R,X,Y) _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
83#define _FP_MUL_MEAT_D(R,X,Y) _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) 83#define _FP_MUL_MEAT_D(R,X,Y) _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
84 84
85#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y) 85#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(S,R,X,Y)
86#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) 86#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y)
87 87
88/* These macros define what NaN looks like. They're supposed to expand to 88/* These macros define what NaN looks like. They're supposed to expand to
@@ -97,6 +97,20 @@
97 97
98#define _FP_KEEPNANFRACP 1 98#define _FP_KEEPNANFRACP 1
99 99
100#ifdef FP_EX_BOOKE_E500_SPE
101#define FP_EX_INEXACT (1 << 21)
102#define FP_EX_INVALID (1 << 20)
103#define FP_EX_DIVZERO (1 << 19)
104#define FP_EX_UNDERFLOW (1 << 18)
105#define FP_EX_OVERFLOW (1 << 17)
106#define FP_INHIBIT_RESULTS 0
107
108#define __FPU_FPSCR (current->thread.spefscr)
109#define __FPU_ENABLED_EXC \
110({ \
111 (__FPU_FPSCR >> 2) & 0x1f; \
112})
113#else
100/* Exception flags. We use the bit positions of the appropriate bits 114/* Exception flags. We use the bit positions of the appropriate bits
101 in the FPSCR, which also correspond to the FE_* bits. This makes 115 in the FPSCR, which also correspond to the FE_* bits. This makes
102 everything easier ;-). */ 116 everything easier ;-). */
@@ -111,22 +125,6 @@
111#define FP_EX_DIVZERO (1 << (31 - 5)) 125#define FP_EX_DIVZERO (1 << (31 - 5))
112#define FP_EX_INEXACT (1 << (31 - 6)) 126#define FP_EX_INEXACT (1 << (31 - 6))
113 127
114/* This macro appears to be called when both X and Y are NaNs, and
115 * has to choose one and copy it to R. i386 goes for the larger of the
116 * two, sparc64 just picks Y. I don't understand this at all so I'll
117 * go with sparc64 because it's shorter :-> -- PMM
118 */
119#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
120 do { \
121 R##_s = Y##_s; \
122 _FP_FRAC_COPY_##wc(R,Y); \
123 R##_c = FP_CLS_NAN; \
124 } while (0)
125
126
127#include <linux/kernel.h>
128#include <linux/sched.h>
129
130#define __FPU_FPSCR (current->thread.fpscr.val) 128#define __FPU_FPSCR (current->thread.fpscr.val)
131 129
132/* We only actually write to the destination register 130/* We only actually write to the destination register
@@ -137,6 +135,32 @@
137 (__FPU_FPSCR >> 3) & 0x1f; \ 135 (__FPU_FPSCR >> 3) & 0x1f; \
138}) 136})
139 137
138#endif
139
140/*
141 * If one NaN is signaling and the other is not,
142 * we choose that one, otherwise we choose X.
143 */
144#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
145 do { \
146 if ((_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs) \
147 && !(_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)) \
148 { \
149 R##_s = X##_s; \
150 _FP_FRAC_COPY_##wc(R,X); \
151 } \
152 else \
153 { \
154 R##_s = Y##_s; \
155 _FP_FRAC_COPY_##wc(R,Y); \
156 } \
157 R##_c = FP_CLS_NAN; \
158 } while (0)
159
160
161#include <linux/kernel.h>
162#include <linux/sched.h>
163
140#define __FPU_TRAP_P(bits) \ 164#define __FPU_TRAP_P(bits) \
141 ((__FPU_ENABLED_EXC & (bits)) != 0) 165 ((__FPU_ENABLED_EXC & (bits)) != 0)
142 166
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index 1866cec4f967..c25f73d1d842 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -81,6 +81,13 @@ extern int cpu_to_core_id(int cpu);
81#define PPC_MSG_CALL_FUNC_SINGLE 2 81#define PPC_MSG_CALL_FUNC_SINGLE 2
82#define PPC_MSG_DEBUGGER_BREAK 3 82#define PPC_MSG_DEBUGGER_BREAK 3
83 83
84/*
85 * irq controllers that have dedicated ipis per message and don't
86 * need additional code in the action handler may use this
87 */
88extern int smp_request_message_ipi(int virq, int message);
89extern const char *smp_ipi_name[];
90
84void smp_init_iSeries(void); 91void smp_init_iSeries(void);
85void smp_init_pSeries(void); 92void smp_init_pSeries(void);
86void smp_init_cell(void); 93void smp_init_cell(void);
diff --git a/arch/powerpc/include/asm/spinlock.h b/arch/powerpc/include/asm/spinlock.h
index f56a843f4705..36864364e601 100644
--- a/arch/powerpc/include/asm/spinlock.h
+++ b/arch/powerpc/include/asm/spinlock.h
@@ -277,7 +277,7 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw)
277 bne- 1b" 277 bne- 1b"
278 : "=&r"(tmp) 278 : "=&r"(tmp)
279 : "r"(&rw->lock) 279 : "r"(&rw->lock)
280 : "cr0", "memory"); 280 : "cr0", "xer", "memory");
281} 281}
282 282
283static inline void __raw_write_unlock(raw_rwlock_t *rw) 283static inline void __raw_write_unlock(raw_rwlock_t *rw)
diff --git a/arch/powerpc/include/asm/synch.h b/arch/powerpc/include/asm/synch.h
index 45963e80f557..28f6ddbff4cf 100644
--- a/arch/powerpc/include/asm/synch.h
+++ b/arch/powerpc/include/asm/synch.h
@@ -5,6 +5,10 @@
5#include <linux/stringify.h> 5#include <linux/stringify.h>
6#include <asm/feature-fixups.h> 6#include <asm/feature-fixups.h>
7 7
8#if defined(__powerpc64__) || defined(CONFIG_PPC_E500MC)
9#define __SUBARCH_HAS_LWSYNC
10#endif
11
8#ifndef __ASSEMBLY__ 12#ifndef __ASSEMBLY__
9extern unsigned int __start___lwsync_fixup, __stop___lwsync_fixup; 13extern unsigned int __start___lwsync_fixup, __stop___lwsync_fixup;
10extern void do_lwsync_fixups(unsigned long value, void *fixup_start, 14extern void do_lwsync_fixups(unsigned long value, void *fixup_start,
diff --git a/arch/powerpc/include/asm/system.h b/arch/powerpc/include/asm/system.h
index d6648c143322..2a4be19a92c4 100644
--- a/arch/powerpc/include/asm/system.h
+++ b/arch/powerpc/include/asm/system.h
@@ -23,15 +23,17 @@
23 * read_barrier_depends() prevents data-dependent loads being reordered 23 * read_barrier_depends() prevents data-dependent loads being reordered
24 * across this point (nop on PPC). 24 * across this point (nop on PPC).
25 * 25 *
26 * We have to use the sync instructions for mb(), since lwsync doesn't 26 * *mb() variants without smp_ prefix must order all types of memory
27 * order loads with respect to previous stores. Lwsync is fine for 27 * operations with one another. sync is the only instruction sufficient
28 * rmb(), though. Note that rmb() actually uses a sync on 32-bit 28 * to do this.
29 * architectures.
30 * 29 *
31 * For wmb(), we use sync since wmb is used in drivers to order 30 * For the smp_ barriers, ordering is for cacheable memory operations
32 * stores to system memory with respect to writes to the device. 31 * only. We have to use the sync instruction for smp_mb(), since lwsync
33 * However, smp_wmb() can be a lighter-weight lwsync or eieio barrier 32 * doesn't order loads with respect to previous stores. Lwsync can be
34 * on SMP since it is only used to order updates to system memory. 33 * used for smp_rmb() and smp_wmb().
34 *
35 * However, on CPUs that don't support lwsync, lwsync actually maps to a
36 * heavy-weight sync, so smp_wmb() can be a lighter-weight eieio.
35 */ 37 */
36#define mb() __asm__ __volatile__ ("sync" : : : "memory") 38#define mb() __asm__ __volatile__ ("sync" : : : "memory")
37#define rmb() __asm__ __volatile__ ("sync" : : : "memory") 39#define rmb() __asm__ __volatile__ ("sync" : : : "memory")
@@ -45,14 +47,14 @@
45#ifdef CONFIG_SMP 47#ifdef CONFIG_SMP
46 48
47#ifdef __SUBARCH_HAS_LWSYNC 49#ifdef __SUBARCH_HAS_LWSYNC
48# define SMPWMB lwsync 50# define SMPWMB LWSYNC
49#else 51#else
50# define SMPWMB eieio 52# define SMPWMB eieio
51#endif 53#endif
52 54
53#define smp_mb() mb() 55#define smp_mb() mb()
54#define smp_rmb() rmb() 56#define smp_rmb() __asm__ __volatile__ (stringify_in_c(LWSYNC) : : :"memory")
55#define smp_wmb() __asm__ __volatile__ (__stringify(SMPWMB) : : :"memory") 57#define smp_wmb() __asm__ __volatile__ (stringify_in_c(SMPWMB) : : :"memory")
56#define smp_read_barrier_depends() read_barrier_depends() 58#define smp_read_barrier_depends() read_barrier_depends()
57#else 59#else
58#define smp_mb() barrier() 60#define smp_mb() barrier()
diff --git a/arch/powerpc/include/asm/time.h b/arch/powerpc/include/asm/time.h
index febd581ec9b0..27ccb764fdab 100644
--- a/arch/powerpc/include/asm/time.h
+++ b/arch/powerpc/include/asm/time.h
@@ -48,26 +48,6 @@ extern unsigned long ppc_proc_freq;
48extern unsigned long ppc_tb_freq; 48extern unsigned long ppc_tb_freq;
49#define DEFAULT_TB_FREQ 125000000UL 49#define DEFAULT_TB_FREQ 125000000UL
50 50
51/*
52 * By putting all of this stuff into a single struct we
53 * reduce the number of cache lines touched by do_gettimeofday.
54 * Both by collecting all of the data in one cache line and
55 * by touching only one TOC entry on ppc64.
56 */
57struct gettimeofday_vars {
58 u64 tb_to_xs;
59 u64 stamp_xsec;
60 u64 tb_orig_stamp;
61};
62
63struct gettimeofday_struct {
64 unsigned long tb_ticks_per_sec;
65 struct gettimeofday_vars vars[2];
66 struct gettimeofday_vars * volatile varp;
67 unsigned var_idx;
68 unsigned tb_to_us;
69};
70
71struct div_result { 51struct div_result {
72 u64 result_high; 52 u64 result_high;
73 u64 result_low; 53 u64 result_low;
diff --git a/arch/powerpc/include/asm/tlbflush.h b/arch/powerpc/include/asm/tlbflush.h
index a2c6bfd85fb7..abbe3419d1dd 100644
--- a/arch/powerpc/include/asm/tlbflush.h
+++ b/arch/powerpc/include/asm/tlbflush.h
@@ -6,6 +6,9 @@
6 * 6 *
7 * - flush_tlb_mm(mm) flushes the specified mm context TLB's 7 * - flush_tlb_mm(mm) flushes the specified mm context TLB's
8 * - flush_tlb_page(vma, vmaddr) flushes one page 8 * - flush_tlb_page(vma, vmaddr) flushes one page
9 * - local_flush_tlb_mm(mm) flushes the specified mm context on
10 * the local processor
11 * - local_flush_tlb_page(vma, vmaddr) flushes one page on the local processor
9 * - flush_tlb_page_nohash(vma, vmaddr) flushes one page if SW loaded TLB 12 * - flush_tlb_page_nohash(vma, vmaddr) flushes one page if SW loaded TLB
10 * - flush_tlb_range(vma, start, end) flushes a range of pages 13 * - flush_tlb_range(vma, start, end) flushes a range of pages
11 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages 14 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
@@ -17,7 +20,7 @@
17 */ 20 */
18#ifdef __KERNEL__ 21#ifdef __KERNEL__
19 22
20#if defined(CONFIG_4xx) || defined(CONFIG_8xx) || defined(CONFIG_FSL_BOOKE) 23#ifdef CONFIG_PPC_MMU_NOHASH
21/* 24/*
22 * TLB flushing for software loaded TLB chips 25 * TLB flushing for software loaded TLB chips
23 * 26 *
@@ -28,63 +31,49 @@
28 31
29#include <linux/mm.h> 32#include <linux/mm.h>
30 33
31extern void _tlbie(unsigned long address, unsigned int pid); 34#define MMU_NO_CONTEXT ((unsigned int)-1)
32extern void _tlbil_all(void);
33extern void _tlbil_pid(unsigned int pid);
34extern void _tlbil_va(unsigned long address, unsigned int pid);
35 35
36#if defined(CONFIG_40x) || defined(CONFIG_8xx) 36extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
37#define _tlbia() asm volatile ("tlbia; sync" : : : "memory") 37 unsigned long end);
38#else /* CONFIG_44x || CONFIG_FSL_BOOKE */ 38extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
39extern void _tlbia(void);
40#endif
41
42static inline void flush_tlb_mm(struct mm_struct *mm)
43{
44 _tlbil_pid(mm->context.id);
45}
46
47static inline void flush_tlb_page(struct vm_area_struct *vma,
48 unsigned long vmaddr)
49{
50 _tlbil_va(vmaddr, vma ? vma->vm_mm->context.id : 0);
51}
52 39
53static inline void flush_tlb_page_nohash(struct vm_area_struct *vma, 40extern void local_flush_tlb_mm(struct mm_struct *mm);
54 unsigned long vmaddr) 41extern void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
55{
56 flush_tlb_page(vma, vmaddr);
57}
58 42
59static inline void flush_tlb_range(struct vm_area_struct *vma, 43#ifdef CONFIG_SMP
60 unsigned long start, unsigned long end) 44extern void flush_tlb_mm(struct mm_struct *mm);
61{ 45extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
62 _tlbil_pid(vma->vm_mm->context.id); 46#else
63} 47#define flush_tlb_mm(mm) local_flush_tlb_mm(mm)
48#define flush_tlb_page(vma,addr) local_flush_tlb_page(vma,addr)
49#endif
50#define flush_tlb_page_nohash(vma,addr) flush_tlb_page(vma,addr)
64 51
65static inline void flush_tlb_kernel_range(unsigned long start, 52#elif defined(CONFIG_PPC_STD_MMU_32)
66 unsigned long end)
67{
68 _tlbil_pid(0);
69}
70 53
71#elif defined(CONFIG_PPC32)
72/* 54/*
73 * TLB flushing for "classic" hash-MMMU 32-bit CPUs, 6xx, 7xx, 7xxx 55 * TLB flushing for "classic" hash-MMU 32-bit CPUs, 6xx, 7xx, 7xxx
74 */ 56 */
75extern void _tlbie(unsigned long address);
76extern void _tlbia(void);
77
78extern void flush_tlb_mm(struct mm_struct *mm); 57extern void flush_tlb_mm(struct mm_struct *mm);
79extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr); 58extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
80extern void flush_tlb_page_nohash(struct vm_area_struct *vma, unsigned long addr); 59extern void flush_tlb_page_nohash(struct vm_area_struct *vma, unsigned long addr);
81extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, 60extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
82 unsigned long end); 61 unsigned long end);
83extern void flush_tlb_kernel_range(unsigned long start, unsigned long end); 62extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
63static inline void local_flush_tlb_page(struct vm_area_struct *vma,
64 unsigned long vmaddr)
65{
66 flush_tlb_page(vma, vmaddr);
67}
68static inline void local_flush_tlb_mm(struct mm_struct *mm)
69{
70 flush_tlb_mm(mm);
71}
72
73#elif defined(CONFIG_PPC_STD_MMU_64)
84 74
85#else
86/* 75/*
87 * TLB flushing for 64-bit has-MMU CPUs 76 * TLB flushing for 64-bit hash-MMU CPUs
88 */ 77 */
89 78
90#include <linux/percpu.h> 79#include <linux/percpu.h>
@@ -134,10 +123,19 @@ extern void flush_hash_page(unsigned long va, real_pte_t pte, int psize,
134extern void flush_hash_range(unsigned long number, int local); 123extern void flush_hash_range(unsigned long number, int local);
135 124
136 125
126static inline void local_flush_tlb_mm(struct mm_struct *mm)
127{
128}
129
137static inline void flush_tlb_mm(struct mm_struct *mm) 130static inline void flush_tlb_mm(struct mm_struct *mm)
138{ 131{
139} 132}
140 133
134static inline void local_flush_tlb_page(struct vm_area_struct *vma,
135 unsigned long vmaddr)
136{
137}
138
141static inline void flush_tlb_page(struct vm_area_struct *vma, 139static inline void flush_tlb_page(struct vm_area_struct *vma,
142 unsigned long vmaddr) 140 unsigned long vmaddr)
143{ 141{
@@ -162,7 +160,8 @@ static inline void flush_tlb_kernel_range(unsigned long start,
162extern void __flush_hash_table_range(struct mm_struct *mm, unsigned long start, 160extern void __flush_hash_table_range(struct mm_struct *mm, unsigned long start,
163 unsigned long end); 161 unsigned long end);
164 162
165 163#else
164#error Unsupported MMU type
166#endif 165#endif
167 166
168#endif /*__KERNEL__ */ 167#endif /*__KERNEL__ */
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index c32da6f97999..375258559ae6 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -22,11 +22,11 @@ static inline cpumask_t node_to_cpumask(int node)
22 return numa_cpumask_lookup_table[node]; 22 return numa_cpumask_lookup_table[node];
23} 23}
24 24
25#define cpumask_of_node(node) (&numa_cpumask_lookup_table[node])
26
25static inline int node_to_first_cpu(int node) 27static inline int node_to_first_cpu(int node)
26{ 28{
27 cpumask_t tmp; 29 return cpumask_first(cpumask_of_node(node));
28 tmp = node_to_cpumask(node);
29 return first_cpu(tmp);
30} 30}
31 31
32int of_node_to_nid(struct device_node *device); 32int of_node_to_nid(struct device_node *device);
@@ -46,9 +46,12 @@ static inline int pcibus_to_node(struct pci_bus *bus)
46 node_to_cpumask(pcibus_to_node(bus)) \ 46 node_to_cpumask(pcibus_to_node(bus)) \
47 ) 47 )
48 48
49#define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \
50 cpu_all_mask : \
51 cpumask_of_node(pcibus_to_node(bus)))
52
49/* sched_domains SD_NODE_INIT for PPC64 machines */ 53/* sched_domains SD_NODE_INIT for PPC64 machines */
50#define SD_NODE_INIT (struct sched_domain) { \ 54#define SD_NODE_INIT (struct sched_domain) { \
51 .span = CPU_MASK_NONE, \
52 .parent = NULL, \ 55 .parent = NULL, \
53 .child = NULL, \ 56 .child = NULL, \
54 .groups = NULL, \ 57 .groups = NULL, \
@@ -109,6 +112,8 @@ static inline void sysfs_remove_device_from_node(struct sys_device *dev,
109 112
110#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) 113#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu))
111#define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) 114#define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu))
115#define topology_thread_cpumask(cpu) (&per_cpu(cpu_sibling_map, cpu))
116#define topology_core_cpumask(cpu) (&per_cpu(cpu_core_map, cpu))
112#define topology_core_id(cpu) (cpu_to_core_id(cpu)) 117#define topology_core_id(cpu) (cpu_to_core_id(cpu))
113#endif 118#endif
114#endif 119#endif
diff --git a/arch/powerpc/include/asm/vdso_datapage.h b/arch/powerpc/include/asm/vdso_datapage.h
index f01393224b52..13c2c283e178 100644
--- a/arch/powerpc/include/asm/vdso_datapage.h
+++ b/arch/powerpc/include/asm/vdso_datapage.h
@@ -39,6 +39,7 @@
39#ifndef __ASSEMBLY__ 39#ifndef __ASSEMBLY__
40 40
41#include <linux/unistd.h> 41#include <linux/unistd.h>
42#include <linux/time.h>
42 43
43#define SYSCALL_MAP_SIZE ((__NR_syscalls + 31) / 32) 44#define SYSCALL_MAP_SIZE ((__NR_syscalls + 31) / 32)
44 45
@@ -83,6 +84,7 @@ struct vdso_data {
83 __u32 icache_log_block_size; /* L1 i-cache log block size */ 84 __u32 icache_log_block_size; /* L1 i-cache log block size */
84 __s32 wtom_clock_sec; /* Wall to monotonic clock */ 85 __s32 wtom_clock_sec; /* Wall to monotonic clock */
85 __s32 wtom_clock_nsec; 86 __s32 wtom_clock_nsec;
87 struct timespec stamp_xtime; /* xtime as at tb_orig_stamp */
86 __u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls */ 88 __u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls */
87 __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */ 89 __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */
88}; 90};
@@ -102,6 +104,7 @@ struct vdso_data {
102 __u32 tz_dsttime; /* Type of dst correction 0x5C */ 104 __u32 tz_dsttime; /* Type of dst correction 0x5C */
103 __s32 wtom_clock_sec; /* Wall to monotonic clock */ 105 __s32 wtom_clock_sec; /* Wall to monotonic clock */
104 __s32 wtom_clock_nsec; 106 __s32 wtom_clock_nsec;
107 struct timespec stamp_xtime; /* xtime as at tb_orig_stamp */
105 __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */ 108 __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */
106 __u32 dcache_block_size; /* L1 d-cache block size */ 109 __u32 dcache_block_size; /* L1 d-cache block size */
107 __u32 icache_block_size; /* L1 i-cache block size */ 110 __u32 icache_block_size; /* L1 i-cache block size */
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 92673b43858d..1308a86e9070 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -17,6 +17,7 @@ ifdef CONFIG_FUNCTION_TRACER
17CFLAGS_REMOVE_cputable.o = -pg -mno-sched-epilog 17CFLAGS_REMOVE_cputable.o = -pg -mno-sched-epilog
18CFLAGS_REMOVE_prom_init.o = -pg -mno-sched-epilog 18CFLAGS_REMOVE_prom_init.o = -pg -mno-sched-epilog
19CFLAGS_REMOVE_btext.o = -pg -mno-sched-epilog 19CFLAGS_REMOVE_btext.o = -pg -mno-sched-epilog
20CFLAGS_REMOVE_prom.o = -pg -mno-sched-epilog
20 21
21ifdef CONFIG_DYNAMIC_FTRACE 22ifdef CONFIG_DYNAMIC_FTRACE
22# dynamic ftrace setup. 23# dynamic ftrace setup.
@@ -102,6 +103,10 @@ endif
102 103
103obj-$(CONFIG_PPC64) += $(obj64-y) 104obj-$(CONFIG_PPC64) += $(obj64-y)
104 105
106ifneq ($(CONFIG_XMON)$(CONFIG_KEXEC),)
107obj-y += ppc_save_regs.o
108endif
109
105extra-$(CONFIG_PPC_FPU) += fpu.o 110extra-$(CONFIG_PPC_FPU) += fpu.o
106extra-$(CONFIG_PPC64) += entry_64.o 111extra-$(CONFIG_PPC64) += entry_64.o
107 112
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 75c5dd0138fd..9937fe44555f 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -23,9 +23,6 @@
23#include <linux/mm.h> 23#include <linux/mm.h>
24#include <linux/suspend.h> 24#include <linux/suspend.h>
25#include <linux/hrtimer.h> 25#include <linux/hrtimer.h>
26#ifdef CONFIG_KVM
27#include <linux/kvm_host.h>
28#endif
29#ifdef CONFIG_PPC64 26#ifdef CONFIG_PPC64
30#include <linux/time.h> 27#include <linux/time.h>
31#include <linux/hardirq.h> 28#include <linux/hardirq.h>
@@ -51,6 +48,9 @@
51#ifdef CONFIG_PPC_ISERIES 48#ifdef CONFIG_PPC_ISERIES
52#include <asm/iseries/alpaca.h> 49#include <asm/iseries/alpaca.h>
53#endif 50#endif
51#ifdef CONFIG_KVM
52#include <asm/kvm_44x.h>
53#endif
54 54
55#if defined(CONFIG_BOOKE) || defined(CONFIG_40x) 55#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
56#include "head_booke.h" 56#include "head_booke.h"
@@ -60,6 +60,7 @@ int main(void)
60{ 60{
61 DEFINE(THREAD, offsetof(struct task_struct, thread)); 61 DEFINE(THREAD, offsetof(struct task_struct, thread));
62 DEFINE(MM, offsetof(struct task_struct, mm)); 62 DEFINE(MM, offsetof(struct task_struct, mm));
63 DEFINE(MMCONTEXTID, offsetof(struct mm_struct, context.id));
63#ifdef CONFIG_PPC64 64#ifdef CONFIG_PPC64
64 DEFINE(AUDITCONTEXT, offsetof(struct task_struct, audit_context)); 65 DEFINE(AUDITCONTEXT, offsetof(struct task_struct, audit_context));
65#else 66#else
@@ -306,6 +307,7 @@ int main(void)
306 DEFINE(CFG_SYSCALL_MAP32, offsetof(struct vdso_data, syscall_map_32)); 307 DEFINE(CFG_SYSCALL_MAP32, offsetof(struct vdso_data, syscall_map_32));
307 DEFINE(WTOM_CLOCK_SEC, offsetof(struct vdso_data, wtom_clock_sec)); 308 DEFINE(WTOM_CLOCK_SEC, offsetof(struct vdso_data, wtom_clock_sec));
308 DEFINE(WTOM_CLOCK_NSEC, offsetof(struct vdso_data, wtom_clock_nsec)); 309 DEFINE(WTOM_CLOCK_NSEC, offsetof(struct vdso_data, wtom_clock_nsec));
310 DEFINE(STAMP_XTIME, offsetof(struct vdso_data, stamp_xtime));
309 DEFINE(CFG_ICACHE_BLOCKSZ, offsetof(struct vdso_data, icache_block_size)); 311 DEFINE(CFG_ICACHE_BLOCKSZ, offsetof(struct vdso_data, icache_block_size));
310 DEFINE(CFG_DCACHE_BLOCKSZ, offsetof(struct vdso_data, dcache_block_size)); 312 DEFINE(CFG_DCACHE_BLOCKSZ, offsetof(struct vdso_data, dcache_block_size));
311 DEFINE(CFG_ICACHE_LOGBLOCKSZ, offsetof(struct vdso_data, icache_log_block_size)); 313 DEFINE(CFG_ICACHE_LOGBLOCKSZ, offsetof(struct vdso_data, icache_log_block_size));
@@ -355,12 +357,10 @@ int main(void)
355 DEFINE(PTE_SIZE, sizeof(pte_t)); 357 DEFINE(PTE_SIZE, sizeof(pte_t));
356 358
357#ifdef CONFIG_KVM 359#ifdef CONFIG_KVM
358 DEFINE(TLBE_BYTES, sizeof(struct tlbe)); 360 DEFINE(TLBE_BYTES, sizeof(struct kvmppc_44x_tlbe));
359 361
360 DEFINE(VCPU_HOST_STACK, offsetof(struct kvm_vcpu, arch.host_stack)); 362 DEFINE(VCPU_HOST_STACK, offsetof(struct kvm_vcpu, arch.host_stack));
361 DEFINE(VCPU_HOST_PID, offsetof(struct kvm_vcpu, arch.host_pid)); 363 DEFINE(VCPU_HOST_PID, offsetof(struct kvm_vcpu, arch.host_pid));
362 DEFINE(VCPU_SHADOW_TLB, offsetof(struct kvm_vcpu, arch.shadow_tlb));
363 DEFINE(VCPU_SHADOW_MOD, offsetof(struct kvm_vcpu, arch.shadow_tlb_mod));
364 DEFINE(VCPU_GPRS, offsetof(struct kvm_vcpu, arch.gpr)); 364 DEFINE(VCPU_GPRS, offsetof(struct kvm_vcpu, arch.gpr));
365 DEFINE(VCPU_LR, offsetof(struct kvm_vcpu, arch.lr)); 365 DEFINE(VCPU_LR, offsetof(struct kvm_vcpu, arch.lr));
366 DEFINE(VCPU_CR, offsetof(struct kvm_vcpu, arch.cr)); 366 DEFINE(VCPU_CR, offsetof(struct kvm_vcpu, arch.cr));
@@ -378,6 +378,21 @@ int main(void)
378 DEFINE(VCPU_FAULT_DEAR, offsetof(struct kvm_vcpu, arch.fault_dear)); 378 DEFINE(VCPU_FAULT_DEAR, offsetof(struct kvm_vcpu, arch.fault_dear));
379 DEFINE(VCPU_FAULT_ESR, offsetof(struct kvm_vcpu, arch.fault_esr)); 379 DEFINE(VCPU_FAULT_ESR, offsetof(struct kvm_vcpu, arch.fault_esr));
380#endif 380#endif
381#ifdef CONFIG_44x
382 DEFINE(PGD_T_LOG2, PGD_T_LOG2);
383 DEFINE(PTE_T_LOG2, PTE_T_LOG2);
384#endif
385
386#ifdef CONFIG_KVM_EXIT_TIMING
387 DEFINE(VCPU_TIMING_EXIT_TBU, offsetof(struct kvm_vcpu,
388 arch.timing_exit.tv32.tbu));
389 DEFINE(VCPU_TIMING_EXIT_TBL, offsetof(struct kvm_vcpu,
390 arch.timing_exit.tv32.tbl));
391 DEFINE(VCPU_TIMING_LAST_ENTER_TBU, offsetof(struct kvm_vcpu,
392 arch.timing_last_enter.tv32.tbu));
393 DEFINE(VCPU_TIMING_LAST_ENTER_TBL, offsetof(struct kvm_vcpu,
394 arch.timing_last_enter.tv32.tbl));
395#endif
381 396
382 return 0; 397 return 0;
383} 398}
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 7e8719504f39..923f87aff20a 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -19,6 +19,7 @@
19#include <asm/oprofile_impl.h> 19#include <asm/oprofile_impl.h>
20#include <asm/cputable.h> 20#include <asm/cputable.h>
21#include <asm/prom.h> /* for PTRRELOC on ARCH=ppc */ 21#include <asm/prom.h> /* for PTRRELOC on ARCH=ppc */
22#include <asm/mmu.h>
22 23
23struct cpu_spec* cur_cpu_spec = NULL; 24struct cpu_spec* cur_cpu_spec = NULL;
24EXPORT_SYMBOL(cur_cpu_spec); 25EXPORT_SYMBOL(cur_cpu_spec);
@@ -94,6 +95,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
94 .cpu_name = "POWER3 (630)", 95 .cpu_name = "POWER3 (630)",
95 .cpu_features = CPU_FTRS_POWER3, 96 .cpu_features = CPU_FTRS_POWER3,
96 .cpu_user_features = COMMON_USER_PPC64|PPC_FEATURE_PPC_LE, 97 .cpu_user_features = COMMON_USER_PPC64|PPC_FEATURE_PPC_LE,
98 .mmu_features = MMU_FTR_HPTE_TABLE,
97 .icache_bsize = 128, 99 .icache_bsize = 128,
98 .dcache_bsize = 128, 100 .dcache_bsize = 128,
99 .num_pmcs = 8, 101 .num_pmcs = 8,
@@ -109,6 +111,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
109 .cpu_name = "POWER3 (630+)", 111 .cpu_name = "POWER3 (630+)",
110 .cpu_features = CPU_FTRS_POWER3, 112 .cpu_features = CPU_FTRS_POWER3,
111 .cpu_user_features = COMMON_USER_PPC64|PPC_FEATURE_PPC_LE, 113 .cpu_user_features = COMMON_USER_PPC64|PPC_FEATURE_PPC_LE,
114 .mmu_features = MMU_FTR_HPTE_TABLE,
112 .icache_bsize = 128, 115 .icache_bsize = 128,
113 .dcache_bsize = 128, 116 .dcache_bsize = 128,
114 .num_pmcs = 8, 117 .num_pmcs = 8,
@@ -124,6 +127,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
124 .cpu_name = "RS64-II (northstar)", 127 .cpu_name = "RS64-II (northstar)",
125 .cpu_features = CPU_FTRS_RS64, 128 .cpu_features = CPU_FTRS_RS64,
126 .cpu_user_features = COMMON_USER_PPC64, 129 .cpu_user_features = COMMON_USER_PPC64,
130 .mmu_features = MMU_FTR_HPTE_TABLE,
127 .icache_bsize = 128, 131 .icache_bsize = 128,
128 .dcache_bsize = 128, 132 .dcache_bsize = 128,
129 .num_pmcs = 8, 133 .num_pmcs = 8,
@@ -139,6 +143,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
139 .cpu_name = "RS64-III (pulsar)", 143 .cpu_name = "RS64-III (pulsar)",
140 .cpu_features = CPU_FTRS_RS64, 144 .cpu_features = CPU_FTRS_RS64,
141 .cpu_user_features = COMMON_USER_PPC64, 145 .cpu_user_features = COMMON_USER_PPC64,
146 .mmu_features = MMU_FTR_HPTE_TABLE,
142 .icache_bsize = 128, 147 .icache_bsize = 128,
143 .dcache_bsize = 128, 148 .dcache_bsize = 128,
144 .num_pmcs = 8, 149 .num_pmcs = 8,
@@ -154,6 +159,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
154 .cpu_name = "RS64-III (icestar)", 159 .cpu_name = "RS64-III (icestar)",
155 .cpu_features = CPU_FTRS_RS64, 160 .cpu_features = CPU_FTRS_RS64,
156 .cpu_user_features = COMMON_USER_PPC64, 161 .cpu_user_features = COMMON_USER_PPC64,
162 .mmu_features = MMU_FTR_HPTE_TABLE,
157 .icache_bsize = 128, 163 .icache_bsize = 128,
158 .dcache_bsize = 128, 164 .dcache_bsize = 128,
159 .num_pmcs = 8, 165 .num_pmcs = 8,
@@ -169,6 +175,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
169 .cpu_name = "RS64-IV (sstar)", 175 .cpu_name = "RS64-IV (sstar)",
170 .cpu_features = CPU_FTRS_RS64, 176 .cpu_features = CPU_FTRS_RS64,
171 .cpu_user_features = COMMON_USER_PPC64, 177 .cpu_user_features = COMMON_USER_PPC64,
178 .mmu_features = MMU_FTR_HPTE_TABLE,
172 .icache_bsize = 128, 179 .icache_bsize = 128,
173 .dcache_bsize = 128, 180 .dcache_bsize = 128,
174 .num_pmcs = 8, 181 .num_pmcs = 8,
@@ -184,6 +191,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
184 .cpu_name = "POWER4 (gp)", 191 .cpu_name = "POWER4 (gp)",
185 .cpu_features = CPU_FTRS_POWER4, 192 .cpu_features = CPU_FTRS_POWER4,
186 .cpu_user_features = COMMON_USER_POWER4, 193 .cpu_user_features = COMMON_USER_POWER4,
194 .mmu_features = MMU_FTR_HPTE_TABLE,
187 .icache_bsize = 128, 195 .icache_bsize = 128,
188 .dcache_bsize = 128, 196 .dcache_bsize = 128,
189 .num_pmcs = 8, 197 .num_pmcs = 8,
@@ -199,6 +207,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
199 .cpu_name = "POWER4+ (gq)", 207 .cpu_name = "POWER4+ (gq)",
200 .cpu_features = CPU_FTRS_POWER4, 208 .cpu_features = CPU_FTRS_POWER4,
201 .cpu_user_features = COMMON_USER_POWER4, 209 .cpu_user_features = COMMON_USER_POWER4,
210 .mmu_features = MMU_FTR_HPTE_TABLE,
202 .icache_bsize = 128, 211 .icache_bsize = 128,
203 .dcache_bsize = 128, 212 .dcache_bsize = 128,
204 .num_pmcs = 8, 213 .num_pmcs = 8,
@@ -215,6 +224,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
215 .cpu_features = CPU_FTRS_PPC970, 224 .cpu_features = CPU_FTRS_PPC970,
216 .cpu_user_features = COMMON_USER_POWER4 | 225 .cpu_user_features = COMMON_USER_POWER4 |
217 PPC_FEATURE_HAS_ALTIVEC_COMP, 226 PPC_FEATURE_HAS_ALTIVEC_COMP,
227 .mmu_features = MMU_FTR_HPTE_TABLE,
218 .icache_bsize = 128, 228 .icache_bsize = 128,
219 .dcache_bsize = 128, 229 .dcache_bsize = 128,
220 .num_pmcs = 8, 230 .num_pmcs = 8,
@@ -233,6 +243,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
233 .cpu_features = CPU_FTRS_PPC970, 243 .cpu_features = CPU_FTRS_PPC970,
234 .cpu_user_features = COMMON_USER_POWER4 | 244 .cpu_user_features = COMMON_USER_POWER4 |
235 PPC_FEATURE_HAS_ALTIVEC_COMP, 245 PPC_FEATURE_HAS_ALTIVEC_COMP,
246 .mmu_features = MMU_FTR_HPTE_TABLE,
236 .icache_bsize = 128, 247 .icache_bsize = 128,
237 .dcache_bsize = 128, 248 .dcache_bsize = 128,
238 .num_pmcs = 8, 249 .num_pmcs = 8,
@@ -251,6 +262,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
251 .cpu_features = CPU_FTRS_PPC970, 262 .cpu_features = CPU_FTRS_PPC970,
252 .cpu_user_features = COMMON_USER_POWER4 | 263 .cpu_user_features = COMMON_USER_POWER4 |
253 PPC_FEATURE_HAS_ALTIVEC_COMP, 264 PPC_FEATURE_HAS_ALTIVEC_COMP,
265 .mmu_features = MMU_FTR_HPTE_TABLE,
254 .icache_bsize = 128, 266 .icache_bsize = 128,
255 .dcache_bsize = 128, 267 .dcache_bsize = 128,
256 .num_pmcs = 8, 268 .num_pmcs = 8,
@@ -269,6 +281,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
269 .cpu_features = CPU_FTRS_PPC970, 281 .cpu_features = CPU_FTRS_PPC970,
270 .cpu_user_features = COMMON_USER_POWER4 | 282 .cpu_user_features = COMMON_USER_POWER4 |
271 PPC_FEATURE_HAS_ALTIVEC_COMP, 283 PPC_FEATURE_HAS_ALTIVEC_COMP,
284 .mmu_features = MMU_FTR_HPTE_TABLE,
272 .icache_bsize = 128, 285 .icache_bsize = 128,
273 .dcache_bsize = 128, 286 .dcache_bsize = 128,
274 .num_pmcs = 8, 287 .num_pmcs = 8,
@@ -287,6 +300,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
287 .cpu_features = CPU_FTRS_PPC970, 300 .cpu_features = CPU_FTRS_PPC970,
288 .cpu_user_features = COMMON_USER_POWER4 | 301 .cpu_user_features = COMMON_USER_POWER4 |
289 PPC_FEATURE_HAS_ALTIVEC_COMP, 302 PPC_FEATURE_HAS_ALTIVEC_COMP,
303 .mmu_features = MMU_FTR_HPTE_TABLE,
290 .icache_bsize = 128, 304 .icache_bsize = 128,
291 .dcache_bsize = 128, 305 .dcache_bsize = 128,
292 .num_pmcs = 8, 306 .num_pmcs = 8,
@@ -303,6 +317,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
303 .cpu_name = "POWER5 (gr)", 317 .cpu_name = "POWER5 (gr)",
304 .cpu_features = CPU_FTRS_POWER5, 318 .cpu_features = CPU_FTRS_POWER5,
305 .cpu_user_features = COMMON_USER_POWER5, 319 .cpu_user_features = COMMON_USER_POWER5,
320 .mmu_features = MMU_FTR_HPTE_TABLE,
306 .icache_bsize = 128, 321 .icache_bsize = 128,
307 .dcache_bsize = 128, 322 .dcache_bsize = 128,
308 .num_pmcs = 6, 323 .num_pmcs = 6,
@@ -323,6 +338,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
323 .cpu_name = "POWER5+ (gs)", 338 .cpu_name = "POWER5+ (gs)",
324 .cpu_features = CPU_FTRS_POWER5, 339 .cpu_features = CPU_FTRS_POWER5,
325 .cpu_user_features = COMMON_USER_POWER5_PLUS, 340 .cpu_user_features = COMMON_USER_POWER5_PLUS,
341 .mmu_features = MMU_FTR_HPTE_TABLE,
326 .icache_bsize = 128, 342 .icache_bsize = 128,
327 .dcache_bsize = 128, 343 .dcache_bsize = 128,
328 .num_pmcs = 6, 344 .num_pmcs = 6,
@@ -339,6 +355,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
339 .cpu_name = "POWER5+ (gs)", 355 .cpu_name = "POWER5+ (gs)",
340 .cpu_features = CPU_FTRS_POWER5, 356 .cpu_features = CPU_FTRS_POWER5,
341 .cpu_user_features = COMMON_USER_POWER5_PLUS, 357 .cpu_user_features = COMMON_USER_POWER5_PLUS,
358 .mmu_features = MMU_FTR_HPTE_TABLE,
342 .icache_bsize = 128, 359 .icache_bsize = 128,
343 .dcache_bsize = 128, 360 .dcache_bsize = 128,
344 .num_pmcs = 6, 361 .num_pmcs = 6,
@@ -356,6 +373,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
356 .cpu_name = "POWER5+", 373 .cpu_name = "POWER5+",
357 .cpu_features = CPU_FTRS_POWER5, 374 .cpu_features = CPU_FTRS_POWER5,
358 .cpu_user_features = COMMON_USER_POWER5_PLUS, 375 .cpu_user_features = COMMON_USER_POWER5_PLUS,
376 .mmu_features = MMU_FTR_HPTE_TABLE,
359 .icache_bsize = 128, 377 .icache_bsize = 128,
360 .dcache_bsize = 128, 378 .dcache_bsize = 128,
361 .machine_check = machine_check_generic, 379 .machine_check = machine_check_generic,
@@ -369,6 +387,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
369 .cpu_features = CPU_FTRS_POWER6, 387 .cpu_features = CPU_FTRS_POWER6,
370 .cpu_user_features = COMMON_USER_POWER6 | 388 .cpu_user_features = COMMON_USER_POWER6 |
371 PPC_FEATURE_POWER6_EXT, 389 PPC_FEATURE_POWER6_EXT,
390 .mmu_features = MMU_FTR_HPTE_TABLE,
372 .icache_bsize = 128, 391 .icache_bsize = 128,
373 .dcache_bsize = 128, 392 .dcache_bsize = 128,
374 .num_pmcs = 6, 393 .num_pmcs = 6,
@@ -388,6 +407,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
388 .cpu_name = "POWER6 (architected)", 407 .cpu_name = "POWER6 (architected)",
389 .cpu_features = CPU_FTRS_POWER6, 408 .cpu_features = CPU_FTRS_POWER6,
390 .cpu_user_features = COMMON_USER_POWER6, 409 .cpu_user_features = COMMON_USER_POWER6,
410 .mmu_features = MMU_FTR_HPTE_TABLE,
391 .icache_bsize = 128, 411 .icache_bsize = 128,
392 .dcache_bsize = 128, 412 .dcache_bsize = 128,
393 .machine_check = machine_check_generic, 413 .machine_check = machine_check_generic,
@@ -400,6 +420,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
400 .cpu_name = "POWER7 (architected)", 420 .cpu_name = "POWER7 (architected)",
401 .cpu_features = CPU_FTRS_POWER7, 421 .cpu_features = CPU_FTRS_POWER7,
402 .cpu_user_features = COMMON_USER_POWER7, 422 .cpu_user_features = COMMON_USER_POWER7,
423 .mmu_features = MMU_FTR_HPTE_TABLE,
403 .icache_bsize = 128, 424 .icache_bsize = 128,
404 .dcache_bsize = 128, 425 .dcache_bsize = 128,
405 .machine_check = machine_check_generic, 426 .machine_check = machine_check_generic,
@@ -412,6 +433,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
412 .cpu_name = "POWER7 (raw)", 433 .cpu_name = "POWER7 (raw)",
413 .cpu_features = CPU_FTRS_POWER7, 434 .cpu_features = CPU_FTRS_POWER7,
414 .cpu_user_features = COMMON_USER_POWER7, 435 .cpu_user_features = COMMON_USER_POWER7,
436 .mmu_features = MMU_FTR_HPTE_TABLE,
415 .icache_bsize = 128, 437 .icache_bsize = 128,
416 .dcache_bsize = 128, 438 .dcache_bsize = 128,
417 .num_pmcs = 6, 439 .num_pmcs = 6,
@@ -434,6 +456,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
434 .cpu_user_features = COMMON_USER_PPC64 | 456 .cpu_user_features = COMMON_USER_PPC64 |
435 PPC_FEATURE_CELL | PPC_FEATURE_HAS_ALTIVEC_COMP | 457 PPC_FEATURE_CELL | PPC_FEATURE_HAS_ALTIVEC_COMP |
436 PPC_FEATURE_SMT, 458 PPC_FEATURE_SMT,
459 .mmu_features = MMU_FTR_HPTE_TABLE,
437 .icache_bsize = 128, 460 .icache_bsize = 128,
438 .dcache_bsize = 128, 461 .dcache_bsize = 128,
439 .num_pmcs = 4, 462 .num_pmcs = 4,
@@ -449,6 +472,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
449 .cpu_name = "PA6T", 472 .cpu_name = "PA6T",
450 .cpu_features = CPU_FTRS_PA6T, 473 .cpu_features = CPU_FTRS_PA6T,
451 .cpu_user_features = COMMON_USER_PA6T, 474 .cpu_user_features = COMMON_USER_PA6T,
475 .mmu_features = MMU_FTR_HPTE_TABLE,
452 .icache_bsize = 64, 476 .icache_bsize = 64,
453 .dcache_bsize = 64, 477 .dcache_bsize = 64,
454 .num_pmcs = 6, 478 .num_pmcs = 6,
@@ -466,6 +490,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
466 .cpu_name = "POWER4 (compatible)", 490 .cpu_name = "POWER4 (compatible)",
467 .cpu_features = CPU_FTRS_COMPATIBLE, 491 .cpu_features = CPU_FTRS_COMPATIBLE,
468 .cpu_user_features = COMMON_USER_PPC64, 492 .cpu_user_features = COMMON_USER_PPC64,
493 .mmu_features = MMU_FTR_HPTE_TABLE,
469 .icache_bsize = 128, 494 .icache_bsize = 128,
470 .dcache_bsize = 128, 495 .dcache_bsize = 128,
471 .num_pmcs = 6, 496 .num_pmcs = 6,
@@ -483,6 +508,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
483 .cpu_features = CPU_FTRS_PPC601, 508 .cpu_features = CPU_FTRS_PPC601,
484 .cpu_user_features = COMMON_USER | PPC_FEATURE_601_INSTR | 509 .cpu_user_features = COMMON_USER | PPC_FEATURE_601_INSTR |
485 PPC_FEATURE_UNIFIED_CACHE | PPC_FEATURE_NO_TB, 510 PPC_FEATURE_UNIFIED_CACHE | PPC_FEATURE_NO_TB,
511 .mmu_features = MMU_FTR_HPTE_TABLE,
486 .icache_bsize = 32, 512 .icache_bsize = 32,
487 .dcache_bsize = 32, 513 .dcache_bsize = 32,
488 .machine_check = machine_check_generic, 514 .machine_check = machine_check_generic,
@@ -494,6 +520,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
494 .cpu_name = "603", 520 .cpu_name = "603",
495 .cpu_features = CPU_FTRS_603, 521 .cpu_features = CPU_FTRS_603,
496 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE, 522 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
523 .mmu_features = 0,
497 .icache_bsize = 32, 524 .icache_bsize = 32,
498 .dcache_bsize = 32, 525 .dcache_bsize = 32,
499 .cpu_setup = __setup_cpu_603, 526 .cpu_setup = __setup_cpu_603,
@@ -506,6 +533,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
506 .cpu_name = "603e", 533 .cpu_name = "603e",
507 .cpu_features = CPU_FTRS_603, 534 .cpu_features = CPU_FTRS_603,
508 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE, 535 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
536 .mmu_features = 0,
509 .icache_bsize = 32, 537 .icache_bsize = 32,
510 .dcache_bsize = 32, 538 .dcache_bsize = 32,
511 .cpu_setup = __setup_cpu_603, 539 .cpu_setup = __setup_cpu_603,
@@ -518,6 +546,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
518 .cpu_name = "603ev", 546 .cpu_name = "603ev",
519 .cpu_features = CPU_FTRS_603, 547 .cpu_features = CPU_FTRS_603,
520 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE, 548 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
549 .mmu_features = 0,
521 .icache_bsize = 32, 550 .icache_bsize = 32,
522 .dcache_bsize = 32, 551 .dcache_bsize = 32,
523 .cpu_setup = __setup_cpu_603, 552 .cpu_setup = __setup_cpu_603,
@@ -530,6 +559,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
530 .cpu_name = "604", 559 .cpu_name = "604",
531 .cpu_features = CPU_FTRS_604, 560 .cpu_features = CPU_FTRS_604,
532 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE, 561 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
562 .mmu_features = MMU_FTR_HPTE_TABLE,
533 .icache_bsize = 32, 563 .icache_bsize = 32,
534 .dcache_bsize = 32, 564 .dcache_bsize = 32,
535 .num_pmcs = 2, 565 .num_pmcs = 2,
@@ -543,6 +573,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
543 .cpu_name = "604e", 573 .cpu_name = "604e",
544 .cpu_features = CPU_FTRS_604, 574 .cpu_features = CPU_FTRS_604,
545 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE, 575 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
576 .mmu_features = MMU_FTR_HPTE_TABLE,
546 .icache_bsize = 32, 577 .icache_bsize = 32,
547 .dcache_bsize = 32, 578 .dcache_bsize = 32,
548 .num_pmcs = 4, 579 .num_pmcs = 4,
@@ -556,6 +587,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
556 .cpu_name = "604r", 587 .cpu_name = "604r",
557 .cpu_features = CPU_FTRS_604, 588 .cpu_features = CPU_FTRS_604,
558 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE, 589 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
590 .mmu_features = MMU_FTR_HPTE_TABLE,
559 .icache_bsize = 32, 591 .icache_bsize = 32,
560 .dcache_bsize = 32, 592 .dcache_bsize = 32,
561 .num_pmcs = 4, 593 .num_pmcs = 4,
@@ -569,6 +601,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
569 .cpu_name = "604ev", 601 .cpu_name = "604ev",
570 .cpu_features = CPU_FTRS_604, 602 .cpu_features = CPU_FTRS_604,
571 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE, 603 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
604 .mmu_features = MMU_FTR_HPTE_TABLE,
572 .icache_bsize = 32, 605 .icache_bsize = 32,
573 .dcache_bsize = 32, 606 .dcache_bsize = 32,
574 .num_pmcs = 4, 607 .num_pmcs = 4,
@@ -582,6 +615,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
582 .cpu_name = "740/750", 615 .cpu_name = "740/750",
583 .cpu_features = CPU_FTRS_740_NOTAU, 616 .cpu_features = CPU_FTRS_740_NOTAU,
584 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE, 617 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
618 .mmu_features = MMU_FTR_HPTE_TABLE,
585 .icache_bsize = 32, 619 .icache_bsize = 32,
586 .dcache_bsize = 32, 620 .dcache_bsize = 32,
587 .num_pmcs = 4, 621 .num_pmcs = 4,
@@ -595,6 +629,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
595 .cpu_name = "750CX", 629 .cpu_name = "750CX",
596 .cpu_features = CPU_FTRS_750, 630 .cpu_features = CPU_FTRS_750,
597 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE, 631 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
632 .mmu_features = MMU_FTR_HPTE_TABLE,
598 .icache_bsize = 32, 633 .icache_bsize = 32,
599 .dcache_bsize = 32, 634 .dcache_bsize = 32,
600 .num_pmcs = 4, 635 .num_pmcs = 4,
@@ -608,6 +643,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
608 .cpu_name = "750CX", 643 .cpu_name = "750CX",
609 .cpu_features = CPU_FTRS_750, 644 .cpu_features = CPU_FTRS_750,
610 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE, 645 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
646 .mmu_features = MMU_FTR_HPTE_TABLE,
611 .icache_bsize = 32, 647 .icache_bsize = 32,
612 .dcache_bsize = 32, 648 .dcache_bsize = 32,
613 .num_pmcs = 4, 649 .num_pmcs = 4,
@@ -622,6 +658,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
622 .cpu_name = "750CXe", 658 .cpu_name = "750CXe",
623 .cpu_features = CPU_FTRS_750, 659 .cpu_features = CPU_FTRS_750,
624 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE, 660 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
661 .mmu_features = MMU_FTR_HPTE_TABLE,
625 .icache_bsize = 32, 662 .icache_bsize = 32,
626 .dcache_bsize = 32, 663 .dcache_bsize = 32,
627 .num_pmcs = 4, 664 .num_pmcs = 4,
@@ -636,6 +673,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
636 .cpu_name = "750CXe", 673 .cpu_name = "750CXe",
637 .cpu_features = CPU_FTRS_750, 674 .cpu_features = CPU_FTRS_750,
638 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE, 675 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
676 .mmu_features = MMU_FTR_HPTE_TABLE,
639 .icache_bsize = 32, 677 .icache_bsize = 32,
640 .dcache_bsize = 32, 678 .dcache_bsize = 32,
641 .num_pmcs = 4, 679 .num_pmcs = 4,
@@ -650,6 +688,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
650 .cpu_name = "750CL", 688 .cpu_name = "750CL",
651 .cpu_features = CPU_FTRS_750CL, 689 .cpu_features = CPU_FTRS_750CL,
652 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE, 690 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
691 .mmu_features = MMU_FTR_HPTE_TABLE | MMU_FTR_USE_HIGH_BATS,
653 .icache_bsize = 32, 692 .icache_bsize = 32,
654 .dcache_bsize = 32, 693 .dcache_bsize = 32,
655 .num_pmcs = 4, 694 .num_pmcs = 4,
@@ -664,6 +703,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
664 .cpu_name = "745/755", 703 .cpu_name = "745/755",
665 .cpu_features = CPU_FTRS_750, 704 .cpu_features = CPU_FTRS_750,
666 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE, 705 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
706 .mmu_features = MMU_FTR_HPTE_TABLE,
667 .icache_bsize = 32, 707 .icache_bsize = 32,
668 .dcache_bsize = 32, 708 .dcache_bsize = 32,
669 .num_pmcs = 4, 709 .num_pmcs = 4,
@@ -678,6 +718,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
678 .cpu_name = "750FX", 718 .cpu_name = "750FX",
679 .cpu_features = CPU_FTRS_750FX1, 719 .cpu_features = CPU_FTRS_750FX1,
680 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE, 720 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
721 .mmu_features = MMU_FTR_HPTE_TABLE,
681 .icache_bsize = 32, 722 .icache_bsize = 32,
682 .dcache_bsize = 32, 723 .dcache_bsize = 32,
683 .num_pmcs = 4, 724 .num_pmcs = 4,
@@ -692,6 +733,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
692 .cpu_name = "750FX", 733 .cpu_name = "750FX",
693 .cpu_features = CPU_FTRS_750FX2, 734 .cpu_features = CPU_FTRS_750FX2,
694 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE, 735 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
736 .mmu_features = MMU_FTR_HPTE_TABLE,
695 .icache_bsize = 32, 737 .icache_bsize = 32,
696 .dcache_bsize = 32, 738 .dcache_bsize = 32,
697 .num_pmcs = 4, 739 .num_pmcs = 4,
@@ -706,6 +748,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
706 .cpu_name = "750FX", 748 .cpu_name = "750FX",
707 .cpu_features = CPU_FTRS_750FX, 749 .cpu_features = CPU_FTRS_750FX,
708 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE, 750 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
751 .mmu_features = MMU_FTR_HPTE_TABLE | MMU_FTR_USE_HIGH_BATS,
709 .icache_bsize = 32, 752 .icache_bsize = 32,
710 .dcache_bsize = 32, 753 .dcache_bsize = 32,
711 .num_pmcs = 4, 754 .num_pmcs = 4,
@@ -720,6 +763,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
720 .cpu_name = "750GX", 763 .cpu_name = "750GX",
721 .cpu_features = CPU_FTRS_750GX, 764 .cpu_features = CPU_FTRS_750GX,
722 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE, 765 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
766 .mmu_features = MMU_FTR_HPTE_TABLE | MMU_FTR_USE_HIGH_BATS,
723 .icache_bsize = 32, 767 .icache_bsize = 32,
724 .dcache_bsize = 32, 768 .dcache_bsize = 32,
725 .num_pmcs = 4, 769 .num_pmcs = 4,
@@ -734,6 +778,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
734 .cpu_name = "740/750", 778 .cpu_name = "740/750",
735 .cpu_features = CPU_FTRS_740, 779 .cpu_features = CPU_FTRS_740,
736 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE, 780 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
781 .mmu_features = MMU_FTR_HPTE_TABLE,
737 .icache_bsize = 32, 782 .icache_bsize = 32,
738 .dcache_bsize = 32, 783 .dcache_bsize = 32,
739 .num_pmcs = 4, 784 .num_pmcs = 4,
@@ -749,6 +794,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
749 .cpu_features = CPU_FTRS_7400_NOTAU, 794 .cpu_features = CPU_FTRS_7400_NOTAU,
750 .cpu_user_features = COMMON_USER | 795 .cpu_user_features = COMMON_USER |
751 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE, 796 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
797 .mmu_features = MMU_FTR_HPTE_TABLE,
752 .icache_bsize = 32, 798 .icache_bsize = 32,
753 .dcache_bsize = 32, 799 .dcache_bsize = 32,
754 .num_pmcs = 4, 800 .num_pmcs = 4,
@@ -764,6 +810,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
764 .cpu_features = CPU_FTRS_7400, 810 .cpu_features = CPU_FTRS_7400,
765 .cpu_user_features = COMMON_USER | 811 .cpu_user_features = COMMON_USER |
766 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE, 812 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
813 .mmu_features = MMU_FTR_HPTE_TABLE,
767 .icache_bsize = 32, 814 .icache_bsize = 32,
768 .dcache_bsize = 32, 815 .dcache_bsize = 32,
769 .num_pmcs = 4, 816 .num_pmcs = 4,
@@ -779,6 +826,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
779 .cpu_features = CPU_FTRS_7400, 826 .cpu_features = CPU_FTRS_7400,
780 .cpu_user_features = COMMON_USER | 827 .cpu_user_features = COMMON_USER |
781 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE, 828 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
829 .mmu_features = MMU_FTR_HPTE_TABLE,
782 .icache_bsize = 32, 830 .icache_bsize = 32,
783 .dcache_bsize = 32, 831 .dcache_bsize = 32,
784 .num_pmcs = 4, 832 .num_pmcs = 4,
@@ -794,6 +842,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
794 .cpu_features = CPU_FTRS_7450_20, 842 .cpu_features = CPU_FTRS_7450_20,
795 .cpu_user_features = COMMON_USER | 843 .cpu_user_features = COMMON_USER |
796 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE, 844 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
845 .mmu_features = MMU_FTR_HPTE_TABLE,
797 .icache_bsize = 32, 846 .icache_bsize = 32,
798 .dcache_bsize = 32, 847 .dcache_bsize = 32,
799 .num_pmcs = 6, 848 .num_pmcs = 6,
@@ -811,6 +860,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
811 .cpu_features = CPU_FTRS_7450_21, 860 .cpu_features = CPU_FTRS_7450_21,
812 .cpu_user_features = COMMON_USER | 861 .cpu_user_features = COMMON_USER |
813 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE, 862 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
863 .mmu_features = MMU_FTR_HPTE_TABLE,
814 .icache_bsize = 32, 864 .icache_bsize = 32,
815 .dcache_bsize = 32, 865 .dcache_bsize = 32,
816 .num_pmcs = 6, 866 .num_pmcs = 6,
@@ -828,6 +878,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
828 .cpu_features = CPU_FTRS_7450_23, 878 .cpu_features = CPU_FTRS_7450_23,
829 .cpu_user_features = COMMON_USER | 879 .cpu_user_features = COMMON_USER |
830 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE, 880 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
881 .mmu_features = MMU_FTR_HPTE_TABLE,
831 .icache_bsize = 32, 882 .icache_bsize = 32,
832 .dcache_bsize = 32, 883 .dcache_bsize = 32,
833 .num_pmcs = 6, 884 .num_pmcs = 6,
@@ -845,6 +896,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
845 .cpu_features = CPU_FTRS_7455_1, 896 .cpu_features = CPU_FTRS_7455_1,
846 .cpu_user_features = COMMON_USER | 897 .cpu_user_features = COMMON_USER |
847 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE, 898 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
899 .mmu_features = MMU_FTR_HPTE_TABLE | MMU_FTR_USE_HIGH_BATS,
848 .icache_bsize = 32, 900 .icache_bsize = 32,
849 .dcache_bsize = 32, 901 .dcache_bsize = 32,
850 .num_pmcs = 6, 902 .num_pmcs = 6,
@@ -862,6 +914,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
862 .cpu_features = CPU_FTRS_7455_20, 914 .cpu_features = CPU_FTRS_7455_20,
863 .cpu_user_features = COMMON_USER | 915 .cpu_user_features = COMMON_USER |
864 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE, 916 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
917 .mmu_features = MMU_FTR_HPTE_TABLE | MMU_FTR_USE_HIGH_BATS,
865 .icache_bsize = 32, 918 .icache_bsize = 32,
866 .dcache_bsize = 32, 919 .dcache_bsize = 32,
867 .num_pmcs = 6, 920 .num_pmcs = 6,
@@ -879,6 +932,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
879 .cpu_features = CPU_FTRS_7455, 932 .cpu_features = CPU_FTRS_7455,
880 .cpu_user_features = COMMON_USER | 933 .cpu_user_features = COMMON_USER |
881 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE, 934 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
935 .mmu_features = MMU_FTR_HPTE_TABLE | MMU_FTR_USE_HIGH_BATS,
882 .icache_bsize = 32, 936 .icache_bsize = 32,
883 .dcache_bsize = 32, 937 .dcache_bsize = 32,
884 .num_pmcs = 6, 938 .num_pmcs = 6,
@@ -896,6 +950,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
896 .cpu_features = CPU_FTRS_7447_10, 950 .cpu_features = CPU_FTRS_7447_10,
897 .cpu_user_features = COMMON_USER | 951 .cpu_user_features = COMMON_USER |
898 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE, 952 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
953 .mmu_features = MMU_FTR_HPTE_TABLE | MMU_FTR_USE_HIGH_BATS,
899 .icache_bsize = 32, 954 .icache_bsize = 32,
900 .dcache_bsize = 32, 955 .dcache_bsize = 32,
901 .num_pmcs = 6, 956 .num_pmcs = 6,
@@ -913,6 +968,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
913 .cpu_features = CPU_FTRS_7447_10, 968 .cpu_features = CPU_FTRS_7447_10,
914 .cpu_user_features = COMMON_USER | 969 .cpu_user_features = COMMON_USER |
915 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE, 970 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
971 .mmu_features = MMU_FTR_HPTE_TABLE | MMU_FTR_USE_HIGH_BATS,
916 .icache_bsize = 32, 972 .icache_bsize = 32,
917 .dcache_bsize = 32, 973 .dcache_bsize = 32,
918 .num_pmcs = 6, 974 .num_pmcs = 6,
@@ -929,6 +985,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
929 .cpu_name = "7447/7457", 985 .cpu_name = "7447/7457",
930 .cpu_features = CPU_FTRS_7447, 986 .cpu_features = CPU_FTRS_7447,
931 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE, 987 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
988 .mmu_features = MMU_FTR_HPTE_TABLE | MMU_FTR_USE_HIGH_BATS,
932 .icache_bsize = 32, 989 .icache_bsize = 32,
933 .dcache_bsize = 32, 990 .dcache_bsize = 32,
934 .num_pmcs = 6, 991 .num_pmcs = 6,
@@ -946,6 +1003,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
946 .cpu_features = CPU_FTRS_7447A, 1003 .cpu_features = CPU_FTRS_7447A,
947 .cpu_user_features = COMMON_USER | 1004 .cpu_user_features = COMMON_USER |
948 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE, 1005 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
1006 .mmu_features = MMU_FTR_HPTE_TABLE | MMU_FTR_USE_HIGH_BATS,
949 .icache_bsize = 32, 1007 .icache_bsize = 32,
950 .dcache_bsize = 32, 1008 .dcache_bsize = 32,
951 .num_pmcs = 6, 1009 .num_pmcs = 6,
@@ -963,6 +1021,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
963 .cpu_features = CPU_FTRS_7448, 1021 .cpu_features = CPU_FTRS_7448,
964 .cpu_user_features = COMMON_USER | 1022 .cpu_user_features = COMMON_USER |
965 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE, 1023 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
1024 .mmu_features = MMU_FTR_HPTE_TABLE | MMU_FTR_USE_HIGH_BATS,
966 .icache_bsize = 32, 1025 .icache_bsize = 32,
967 .dcache_bsize = 32, 1026 .dcache_bsize = 32,
968 .num_pmcs = 6, 1027 .num_pmcs = 6,
@@ -979,6 +1038,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
979 .cpu_name = "82xx", 1038 .cpu_name = "82xx",
980 .cpu_features = CPU_FTRS_82XX, 1039 .cpu_features = CPU_FTRS_82XX,
981 .cpu_user_features = COMMON_USER, 1040 .cpu_user_features = COMMON_USER,
1041 .mmu_features = 0,
982 .icache_bsize = 32, 1042 .icache_bsize = 32,
983 .dcache_bsize = 32, 1043 .dcache_bsize = 32,
984 .cpu_setup = __setup_cpu_603, 1044 .cpu_setup = __setup_cpu_603,
@@ -991,6 +1051,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
991 .cpu_name = "G2_LE", 1051 .cpu_name = "G2_LE",
992 .cpu_features = CPU_FTRS_G2_LE, 1052 .cpu_features = CPU_FTRS_G2_LE,
993 .cpu_user_features = COMMON_USER, 1053 .cpu_user_features = COMMON_USER,
1054 .mmu_features = MMU_FTR_USE_HIGH_BATS,
994 .icache_bsize = 32, 1055 .icache_bsize = 32,
995 .dcache_bsize = 32, 1056 .dcache_bsize = 32,
996 .cpu_setup = __setup_cpu_603, 1057 .cpu_setup = __setup_cpu_603,
@@ -1003,6 +1064,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1003 .cpu_name = "e300c1", 1064 .cpu_name = "e300c1",
1004 .cpu_features = CPU_FTRS_E300, 1065 .cpu_features = CPU_FTRS_E300,
1005 .cpu_user_features = COMMON_USER, 1066 .cpu_user_features = COMMON_USER,
1067 .mmu_features = MMU_FTR_USE_HIGH_BATS,
1006 .icache_bsize = 32, 1068 .icache_bsize = 32,
1007 .dcache_bsize = 32, 1069 .dcache_bsize = 32,
1008 .cpu_setup = __setup_cpu_603, 1070 .cpu_setup = __setup_cpu_603,
@@ -1015,6 +1077,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1015 .cpu_name = "e300c2", 1077 .cpu_name = "e300c2",
1016 .cpu_features = CPU_FTRS_E300C2, 1078 .cpu_features = CPU_FTRS_E300C2,
1017 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 1079 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
1080 .mmu_features = MMU_FTR_USE_HIGH_BATS,
1018 .icache_bsize = 32, 1081 .icache_bsize = 32,
1019 .dcache_bsize = 32, 1082 .dcache_bsize = 32,
1020 .cpu_setup = __setup_cpu_603, 1083 .cpu_setup = __setup_cpu_603,
@@ -1027,6 +1090,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1027 .cpu_name = "e300c3", 1090 .cpu_name = "e300c3",
1028 .cpu_features = CPU_FTRS_E300, 1091 .cpu_features = CPU_FTRS_E300,
1029 .cpu_user_features = COMMON_USER, 1092 .cpu_user_features = COMMON_USER,
1093 .mmu_features = MMU_FTR_USE_HIGH_BATS,
1030 .icache_bsize = 32, 1094 .icache_bsize = 32,
1031 .dcache_bsize = 32, 1095 .dcache_bsize = 32,
1032 .cpu_setup = __setup_cpu_603, 1096 .cpu_setup = __setup_cpu_603,
@@ -1041,6 +1105,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1041 .cpu_name = "e300c4", 1105 .cpu_name = "e300c4",
1042 .cpu_features = CPU_FTRS_E300, 1106 .cpu_features = CPU_FTRS_E300,
1043 .cpu_user_features = COMMON_USER, 1107 .cpu_user_features = COMMON_USER,
1108 .mmu_features = MMU_FTR_USE_HIGH_BATS,
1044 .icache_bsize = 32, 1109 .icache_bsize = 32,
1045 .dcache_bsize = 32, 1110 .dcache_bsize = 32,
1046 .cpu_setup = __setup_cpu_603, 1111 .cpu_setup = __setup_cpu_603,
@@ -1056,6 +1121,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1056 .cpu_name = "(generic PPC)", 1121 .cpu_name = "(generic PPC)",
1057 .cpu_features = CPU_FTRS_CLASSIC32, 1122 .cpu_features = CPU_FTRS_CLASSIC32,
1058 .cpu_user_features = COMMON_USER, 1123 .cpu_user_features = COMMON_USER,
1124 .mmu_features = MMU_FTR_HPTE_TABLE,
1059 .icache_bsize = 32, 1125 .icache_bsize = 32,
1060 .dcache_bsize = 32, 1126 .dcache_bsize = 32,
1061 .machine_check = machine_check_generic, 1127 .machine_check = machine_check_generic,
@@ -1071,6 +1137,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1071 * if the 8xx code is there.... */ 1137 * if the 8xx code is there.... */
1072 .cpu_features = CPU_FTRS_8XX, 1138 .cpu_features = CPU_FTRS_8XX,
1073 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 1139 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
1140 .mmu_features = MMU_FTR_TYPE_8xx,
1074 .icache_bsize = 16, 1141 .icache_bsize = 16,
1075 .dcache_bsize = 16, 1142 .dcache_bsize = 16,
1076 .platform = "ppc823", 1143 .platform = "ppc823",
@@ -1083,6 +1150,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1083 .cpu_name = "403GC", 1150 .cpu_name = "403GC",
1084 .cpu_features = CPU_FTRS_40X, 1151 .cpu_features = CPU_FTRS_40X,
1085 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 1152 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
1153 .mmu_features = MMU_FTR_TYPE_40x,
1086 .icache_bsize = 16, 1154 .icache_bsize = 16,
1087 .dcache_bsize = 16, 1155 .dcache_bsize = 16,
1088 .machine_check = machine_check_4xx, 1156 .machine_check = machine_check_4xx,
@@ -1095,6 +1163,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1095 .cpu_features = CPU_FTRS_40X, 1163 .cpu_features = CPU_FTRS_40X,
1096 .cpu_user_features = PPC_FEATURE_32 | 1164 .cpu_user_features = PPC_FEATURE_32 |
1097 PPC_FEATURE_HAS_MMU | PPC_FEATURE_NO_TB, 1165 PPC_FEATURE_HAS_MMU | PPC_FEATURE_NO_TB,
1166 .mmu_features = MMU_FTR_TYPE_40x,
1098 .icache_bsize = 16, 1167 .icache_bsize = 16,
1099 .dcache_bsize = 16, 1168 .dcache_bsize = 16,
1100 .machine_check = machine_check_4xx, 1169 .machine_check = machine_check_4xx,
@@ -1106,6 +1175,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1106 .cpu_name = "403G ??", 1175 .cpu_name = "403G ??",
1107 .cpu_features = CPU_FTRS_40X, 1176 .cpu_features = CPU_FTRS_40X,
1108 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 1177 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
1178 .mmu_features = MMU_FTR_TYPE_40x,
1109 .icache_bsize = 16, 1179 .icache_bsize = 16,
1110 .dcache_bsize = 16, 1180 .dcache_bsize = 16,
1111 .machine_check = machine_check_4xx, 1181 .machine_check = machine_check_4xx,
@@ -1118,6 +1188,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1118 .cpu_features = CPU_FTRS_40X, 1188 .cpu_features = CPU_FTRS_40X,
1119 .cpu_user_features = PPC_FEATURE_32 | 1189 .cpu_user_features = PPC_FEATURE_32 |
1120 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 1190 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1191 .mmu_features = MMU_FTR_TYPE_40x,
1121 .icache_bsize = 32, 1192 .icache_bsize = 32,
1122 .dcache_bsize = 32, 1193 .dcache_bsize = 32,
1123 .machine_check = machine_check_4xx, 1194 .machine_check = machine_check_4xx,
@@ -1130,6 +1201,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1130 .cpu_features = CPU_FTRS_40X, 1201 .cpu_features = CPU_FTRS_40X,
1131 .cpu_user_features = PPC_FEATURE_32 | 1202 .cpu_user_features = PPC_FEATURE_32 |
1132 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 1203 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1204 .mmu_features = MMU_FTR_TYPE_40x,
1133 .icache_bsize = 32, 1205 .icache_bsize = 32,
1134 .dcache_bsize = 32, 1206 .dcache_bsize = 32,
1135 .machine_check = machine_check_4xx, 1207 .machine_check = machine_check_4xx,
@@ -1142,6 +1214,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1142 .cpu_features = CPU_FTRS_40X, 1214 .cpu_features = CPU_FTRS_40X,
1143 .cpu_user_features = PPC_FEATURE_32 | 1215 .cpu_user_features = PPC_FEATURE_32 |
1144 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 1216 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1217 .mmu_features = MMU_FTR_TYPE_40x,
1145 .icache_bsize = 32, 1218 .icache_bsize = 32,
1146 .dcache_bsize = 32, 1219 .dcache_bsize = 32,
1147 .machine_check = machine_check_4xx, 1220 .machine_check = machine_check_4xx,
@@ -1154,6 +1227,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1154 .cpu_features = CPU_FTRS_40X, 1227 .cpu_features = CPU_FTRS_40X,
1155 .cpu_user_features = PPC_FEATURE_32 | 1228 .cpu_user_features = PPC_FEATURE_32 |
1156 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 1229 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1230 .mmu_features = MMU_FTR_TYPE_40x,
1157 .icache_bsize = 32, 1231 .icache_bsize = 32,
1158 .dcache_bsize = 32, 1232 .dcache_bsize = 32,
1159 .machine_check = machine_check_4xx, 1233 .machine_check = machine_check_4xx,
@@ -1166,6 +1240,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1166 .cpu_features = CPU_FTRS_40X, 1240 .cpu_features = CPU_FTRS_40X,
1167 .cpu_user_features = PPC_FEATURE_32 | 1241 .cpu_user_features = PPC_FEATURE_32 |
1168 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 1242 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1243 .mmu_features = MMU_FTR_TYPE_40x,
1169 .icache_bsize = 32, 1244 .icache_bsize = 32,
1170 .dcache_bsize = 32, 1245 .dcache_bsize = 32,
1171 .machine_check = machine_check_4xx, 1246 .machine_check = machine_check_4xx,
@@ -1178,6 +1253,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1178 .cpu_features = CPU_FTRS_40X, 1253 .cpu_features = CPU_FTRS_40X,
1179 .cpu_user_features = PPC_FEATURE_32 | 1254 .cpu_user_features = PPC_FEATURE_32 |
1180 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 1255 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1256 .mmu_features = MMU_FTR_TYPE_40x,
1181 .icache_bsize = 32, 1257 .icache_bsize = 32,
1182 .dcache_bsize = 32, 1258 .dcache_bsize = 32,
1183 .machine_check = machine_check_4xx, 1259 .machine_check = machine_check_4xx,
@@ -1190,6 +1266,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1190 .cpu_features = CPU_FTRS_40X, 1266 .cpu_features = CPU_FTRS_40X,
1191 .cpu_user_features = PPC_FEATURE_32 | 1267 .cpu_user_features = PPC_FEATURE_32 |
1192 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 1268 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1269 .mmu_features = MMU_FTR_TYPE_40x,
1193 .icache_bsize = 32, 1270 .icache_bsize = 32,
1194 .dcache_bsize = 32, 1271 .dcache_bsize = 32,
1195 .machine_check = machine_check_4xx, 1272 .machine_check = machine_check_4xx,
@@ -1202,6 +1279,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1202 .cpu_features = CPU_FTRS_40X, 1279 .cpu_features = CPU_FTRS_40X,
1203 .cpu_user_features = PPC_FEATURE_32 | 1280 .cpu_user_features = PPC_FEATURE_32 |
1204 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 1281 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1282 .mmu_features = MMU_FTR_TYPE_40x,
1205 .icache_bsize = 32, 1283 .icache_bsize = 32,
1206 .dcache_bsize = 32, 1284 .dcache_bsize = 32,
1207 .machine_check = machine_check_4xx, 1285 .machine_check = machine_check_4xx,
@@ -1213,6 +1291,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1213 .cpu_name = "405LP", 1291 .cpu_name = "405LP",
1214 .cpu_features = CPU_FTRS_40X, 1292 .cpu_features = CPU_FTRS_40X,
1215 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 1293 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
1294 .mmu_features = MMU_FTR_TYPE_40x,
1216 .icache_bsize = 32, 1295 .icache_bsize = 32,
1217 .dcache_bsize = 32, 1296 .dcache_bsize = 32,
1218 .machine_check = machine_check_4xx, 1297 .machine_check = machine_check_4xx,
@@ -1225,6 +1304,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1225 .cpu_features = CPU_FTRS_40X, 1304 .cpu_features = CPU_FTRS_40X,
1226 .cpu_user_features = PPC_FEATURE_32 | 1305 .cpu_user_features = PPC_FEATURE_32 |
1227 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 1306 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1307 .mmu_features = MMU_FTR_TYPE_40x,
1228 .icache_bsize = 32, 1308 .icache_bsize = 32,
1229 .dcache_bsize = 32, 1309 .dcache_bsize = 32,
1230 .machine_check = machine_check_4xx, 1310 .machine_check = machine_check_4xx,
@@ -1237,6 +1317,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1237 .cpu_features = CPU_FTRS_40X, 1317 .cpu_features = CPU_FTRS_40X,
1238 .cpu_user_features = PPC_FEATURE_32 | 1318 .cpu_user_features = PPC_FEATURE_32 |
1239 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 1319 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1320 .mmu_features = MMU_FTR_TYPE_40x,
1240 .icache_bsize = 32, 1321 .icache_bsize = 32,
1241 .dcache_bsize = 32, 1322 .dcache_bsize = 32,
1242 .machine_check = machine_check_4xx, 1323 .machine_check = machine_check_4xx,
@@ -1249,6 +1330,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1249 .cpu_features = CPU_FTRS_40X, 1330 .cpu_features = CPU_FTRS_40X,
1250 .cpu_user_features = PPC_FEATURE_32 | 1331 .cpu_user_features = PPC_FEATURE_32 |
1251 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 1332 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1333 .mmu_features = MMU_FTR_TYPE_40x,
1252 .icache_bsize = 32, 1334 .icache_bsize = 32,
1253 .dcache_bsize = 32, 1335 .dcache_bsize = 32,
1254 .machine_check = machine_check_4xx, 1336 .machine_check = machine_check_4xx,
@@ -1261,6 +1343,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1261 .cpu_features = CPU_FTRS_40X, 1343 .cpu_features = CPU_FTRS_40X,
1262 .cpu_user_features = PPC_FEATURE_32 | 1344 .cpu_user_features = PPC_FEATURE_32 |
1263 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 1345 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1346 .mmu_features = MMU_FTR_TYPE_40x,
1264 .icache_bsize = 32, 1347 .icache_bsize = 32,
1265 .dcache_bsize = 32, 1348 .dcache_bsize = 32,
1266 .machine_check = machine_check_4xx, 1349 .machine_check = machine_check_4xx,
@@ -1273,6 +1356,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1273 .cpu_features = CPU_FTRS_40X, 1356 .cpu_features = CPU_FTRS_40X,
1274 .cpu_user_features = PPC_FEATURE_32 | 1357 .cpu_user_features = PPC_FEATURE_32 |
1275 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 1358 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1359 .mmu_features = MMU_FTR_TYPE_40x,
1276 .icache_bsize = 32, 1360 .icache_bsize = 32,
1277 .dcache_bsize = 32, 1361 .dcache_bsize = 32,
1278 .machine_check = machine_check_4xx, 1362 .machine_check = machine_check_4xx,
@@ -1286,6 +1370,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1286 .cpu_features = CPU_FTRS_40X, 1370 .cpu_features = CPU_FTRS_40X,
1287 .cpu_user_features = PPC_FEATURE_32 | 1371 .cpu_user_features = PPC_FEATURE_32 |
1288 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 1372 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1373 .mmu_features = MMU_FTR_TYPE_40x,
1289 .icache_bsize = 32, 1374 .icache_bsize = 32,
1290 .dcache_bsize = 32, 1375 .dcache_bsize = 32,
1291 .machine_check = machine_check_4xx, 1376 .machine_check = machine_check_4xx,
@@ -1298,6 +1383,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1298 .cpu_features = CPU_FTRS_40X, 1383 .cpu_features = CPU_FTRS_40X,
1299 .cpu_user_features = PPC_FEATURE_32 | 1384 .cpu_user_features = PPC_FEATURE_32 |
1300 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 1385 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1386 .mmu_features = MMU_FTR_TYPE_40x,
1301 .icache_bsize = 32, 1387 .icache_bsize = 32,
1302 .dcache_bsize = 32, 1388 .dcache_bsize = 32,
1303 .machine_check = machine_check_4xx, 1389 .machine_check = machine_check_4xx,
@@ -1312,6 +1398,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1312 .cpu_name = "440GR Rev. A", 1398 .cpu_name = "440GR Rev. A",
1313 .cpu_features = CPU_FTRS_44X, 1399 .cpu_features = CPU_FTRS_44X,
1314 .cpu_user_features = COMMON_USER_BOOKE, 1400 .cpu_user_features = COMMON_USER_BOOKE,
1401 .mmu_features = MMU_FTR_TYPE_44x,
1315 .icache_bsize = 32, 1402 .icache_bsize = 32,
1316 .dcache_bsize = 32, 1403 .dcache_bsize = 32,
1317 .machine_check = machine_check_4xx, 1404 .machine_check = machine_check_4xx,
@@ -1323,6 +1410,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1323 .cpu_name = "440EP Rev. A", 1410 .cpu_name = "440EP Rev. A",
1324 .cpu_features = CPU_FTRS_44X, 1411 .cpu_features = CPU_FTRS_44X,
1325 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU, 1412 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
1413 .mmu_features = MMU_FTR_TYPE_44x,
1326 .icache_bsize = 32, 1414 .icache_bsize = 32,
1327 .dcache_bsize = 32, 1415 .dcache_bsize = 32,
1328 .cpu_setup = __setup_cpu_440ep, 1416 .cpu_setup = __setup_cpu_440ep,
@@ -1335,6 +1423,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1335 .cpu_name = "440GR Rev. B", 1423 .cpu_name = "440GR Rev. B",
1336 .cpu_features = CPU_FTRS_44X, 1424 .cpu_features = CPU_FTRS_44X,
1337 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU, 1425 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
1426 .mmu_features = MMU_FTR_TYPE_44x,
1338 .icache_bsize = 32, 1427 .icache_bsize = 32,
1339 .dcache_bsize = 32, 1428 .dcache_bsize = 32,
1340 .machine_check = machine_check_4xx, 1429 .machine_check = machine_check_4xx,
@@ -1346,6 +1435,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1346 .cpu_name = "440EP Rev. C", 1435 .cpu_name = "440EP Rev. C",
1347 .cpu_features = CPU_FTRS_44X, 1436 .cpu_features = CPU_FTRS_44X,
1348 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU, 1437 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
1438 .mmu_features = MMU_FTR_TYPE_44x,
1349 .icache_bsize = 32, 1439 .icache_bsize = 32,
1350 .dcache_bsize = 32, 1440 .dcache_bsize = 32,
1351 .cpu_setup = __setup_cpu_440ep, 1441 .cpu_setup = __setup_cpu_440ep,
@@ -1358,6 +1448,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1358 .cpu_name = "440EP Rev. B", 1448 .cpu_name = "440EP Rev. B",
1359 .cpu_features = CPU_FTRS_44X, 1449 .cpu_features = CPU_FTRS_44X,
1360 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU, 1450 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
1451 .mmu_features = MMU_FTR_TYPE_44x,
1361 .icache_bsize = 32, 1452 .icache_bsize = 32,
1362 .dcache_bsize = 32, 1453 .dcache_bsize = 32,
1363 .cpu_setup = __setup_cpu_440ep, 1454 .cpu_setup = __setup_cpu_440ep,
@@ -1370,6 +1461,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1370 .cpu_name = "440GRX", 1461 .cpu_name = "440GRX",
1371 .cpu_features = CPU_FTRS_44X, 1462 .cpu_features = CPU_FTRS_44X,
1372 .cpu_user_features = COMMON_USER_BOOKE, 1463 .cpu_user_features = COMMON_USER_BOOKE,
1464 .mmu_features = MMU_FTR_TYPE_44x,
1373 .icache_bsize = 32, 1465 .icache_bsize = 32,
1374 .dcache_bsize = 32, 1466 .dcache_bsize = 32,
1375 .cpu_setup = __setup_cpu_440grx, 1467 .cpu_setup = __setup_cpu_440grx,
@@ -1382,6 +1474,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1382 .cpu_name = "440EPX", 1474 .cpu_name = "440EPX",
1383 .cpu_features = CPU_FTRS_44X, 1475 .cpu_features = CPU_FTRS_44X,
1384 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU, 1476 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
1477 .mmu_features = MMU_FTR_TYPE_44x,
1385 .icache_bsize = 32, 1478 .icache_bsize = 32,
1386 .dcache_bsize = 32, 1479 .dcache_bsize = 32,
1387 .cpu_setup = __setup_cpu_440epx, 1480 .cpu_setup = __setup_cpu_440epx,
@@ -1394,6 +1487,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1394 .cpu_name = "440GP Rev. B", 1487 .cpu_name = "440GP Rev. B",
1395 .cpu_features = CPU_FTRS_44X, 1488 .cpu_features = CPU_FTRS_44X,
1396 .cpu_user_features = COMMON_USER_BOOKE, 1489 .cpu_user_features = COMMON_USER_BOOKE,
1490 .mmu_features = MMU_FTR_TYPE_44x,
1397 .icache_bsize = 32, 1491 .icache_bsize = 32,
1398 .dcache_bsize = 32, 1492 .dcache_bsize = 32,
1399 .machine_check = machine_check_4xx, 1493 .machine_check = machine_check_4xx,
@@ -1405,6 +1499,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1405 .cpu_name = "440GP Rev. C", 1499 .cpu_name = "440GP Rev. C",
1406 .cpu_features = CPU_FTRS_44X, 1500 .cpu_features = CPU_FTRS_44X,
1407 .cpu_user_features = COMMON_USER_BOOKE, 1501 .cpu_user_features = COMMON_USER_BOOKE,
1502 .mmu_features = MMU_FTR_TYPE_44x,
1408 .icache_bsize = 32, 1503 .icache_bsize = 32,
1409 .dcache_bsize = 32, 1504 .dcache_bsize = 32,
1410 .machine_check = machine_check_4xx, 1505 .machine_check = machine_check_4xx,
@@ -1416,6 +1511,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1416 .cpu_name = "440GX Rev. A", 1511 .cpu_name = "440GX Rev. A",
1417 .cpu_features = CPU_FTRS_44X, 1512 .cpu_features = CPU_FTRS_44X,
1418 .cpu_user_features = COMMON_USER_BOOKE, 1513 .cpu_user_features = COMMON_USER_BOOKE,
1514 .mmu_features = MMU_FTR_TYPE_44x,
1419 .icache_bsize = 32, 1515 .icache_bsize = 32,
1420 .dcache_bsize = 32, 1516 .dcache_bsize = 32,
1421 .cpu_setup = __setup_cpu_440gx, 1517 .cpu_setup = __setup_cpu_440gx,
@@ -1428,6 +1524,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1428 .cpu_name = "440GX Rev. B", 1524 .cpu_name = "440GX Rev. B",
1429 .cpu_features = CPU_FTRS_44X, 1525 .cpu_features = CPU_FTRS_44X,
1430 .cpu_user_features = COMMON_USER_BOOKE, 1526 .cpu_user_features = COMMON_USER_BOOKE,
1527 .mmu_features = MMU_FTR_TYPE_44x,
1431 .icache_bsize = 32, 1528 .icache_bsize = 32,
1432 .dcache_bsize = 32, 1529 .dcache_bsize = 32,
1433 .cpu_setup = __setup_cpu_440gx, 1530 .cpu_setup = __setup_cpu_440gx,
@@ -1440,6 +1537,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1440 .cpu_name = "440GX Rev. C", 1537 .cpu_name = "440GX Rev. C",
1441 .cpu_features = CPU_FTRS_44X, 1538 .cpu_features = CPU_FTRS_44X,
1442 .cpu_user_features = COMMON_USER_BOOKE, 1539 .cpu_user_features = COMMON_USER_BOOKE,
1540 .mmu_features = MMU_FTR_TYPE_44x,
1443 .icache_bsize = 32, 1541 .icache_bsize = 32,
1444 .dcache_bsize = 32, 1542 .dcache_bsize = 32,
1445 .cpu_setup = __setup_cpu_440gx, 1543 .cpu_setup = __setup_cpu_440gx,
@@ -1452,6 +1550,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1452 .cpu_name = "440GX Rev. F", 1550 .cpu_name = "440GX Rev. F",
1453 .cpu_features = CPU_FTRS_44X, 1551 .cpu_features = CPU_FTRS_44X,
1454 .cpu_user_features = COMMON_USER_BOOKE, 1552 .cpu_user_features = COMMON_USER_BOOKE,
1553 .mmu_features = MMU_FTR_TYPE_44x,
1455 .icache_bsize = 32, 1554 .icache_bsize = 32,
1456 .dcache_bsize = 32, 1555 .dcache_bsize = 32,
1457 .cpu_setup = __setup_cpu_440gx, 1556 .cpu_setup = __setup_cpu_440gx,
@@ -1464,6 +1563,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1464 .cpu_name = "440SP Rev. A", 1563 .cpu_name = "440SP Rev. A",
1465 .cpu_features = CPU_FTRS_44X, 1564 .cpu_features = CPU_FTRS_44X,
1466 .cpu_user_features = COMMON_USER_BOOKE, 1565 .cpu_user_features = COMMON_USER_BOOKE,
1566 .mmu_features = MMU_FTR_TYPE_44x,
1467 .icache_bsize = 32, 1567 .icache_bsize = 32,
1468 .dcache_bsize = 32, 1568 .dcache_bsize = 32,
1469 .machine_check = machine_check_4xx, 1569 .machine_check = machine_check_4xx,
@@ -1475,6 +1575,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1475 .cpu_name = "440SPe Rev. A", 1575 .cpu_name = "440SPe Rev. A",
1476 .cpu_features = CPU_FTRS_44X, 1576 .cpu_features = CPU_FTRS_44X,
1477 .cpu_user_features = COMMON_USER_BOOKE, 1577 .cpu_user_features = COMMON_USER_BOOKE,
1578 .mmu_features = MMU_FTR_TYPE_44x,
1478 .icache_bsize = 32, 1579 .icache_bsize = 32,
1479 .dcache_bsize = 32, 1580 .dcache_bsize = 32,
1480 .cpu_setup = __setup_cpu_440spe, 1581 .cpu_setup = __setup_cpu_440spe,
@@ -1487,6 +1588,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1487 .cpu_name = "440SPe Rev. B", 1588 .cpu_name = "440SPe Rev. B",
1488 .cpu_features = CPU_FTRS_44X, 1589 .cpu_features = CPU_FTRS_44X,
1489 .cpu_user_features = COMMON_USER_BOOKE, 1590 .cpu_user_features = COMMON_USER_BOOKE,
1591 .mmu_features = MMU_FTR_TYPE_44x,
1490 .icache_bsize = 32, 1592 .icache_bsize = 32,
1491 .dcache_bsize = 32, 1593 .dcache_bsize = 32,
1492 .cpu_setup = __setup_cpu_440spe, 1594 .cpu_setup = __setup_cpu_440spe,
@@ -1499,6 +1601,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1499 .cpu_name = "440 in Virtex-5 FXT", 1601 .cpu_name = "440 in Virtex-5 FXT",
1500 .cpu_features = CPU_FTRS_44X, 1602 .cpu_features = CPU_FTRS_44X,
1501 .cpu_user_features = COMMON_USER_BOOKE, 1603 .cpu_user_features = COMMON_USER_BOOKE,
1604 .mmu_features = MMU_FTR_TYPE_44x,
1502 .icache_bsize = 32, 1605 .icache_bsize = 32,
1503 .dcache_bsize = 32, 1606 .dcache_bsize = 32,
1504 .cpu_setup = __setup_cpu_440x5, 1607 .cpu_setup = __setup_cpu_440x5,
@@ -1509,8 +1612,9 @@ static struct cpu_spec __initdata cpu_specs[] = {
1509 .pvr_mask = 0xffff0002, 1612 .pvr_mask = 0xffff0002,
1510 .pvr_value = 0x13020002, 1613 .pvr_value = 0x13020002,
1511 .cpu_name = "460EX", 1614 .cpu_name = "460EX",
1512 .cpu_features = CPU_FTRS_44X, 1615 .cpu_features = CPU_FTRS_440x6,
1513 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU, 1616 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
1617 .mmu_features = MMU_FTR_TYPE_44x,
1514 .icache_bsize = 32, 1618 .icache_bsize = 32,
1515 .dcache_bsize = 32, 1619 .dcache_bsize = 32,
1516 .cpu_setup = __setup_cpu_460ex, 1620 .cpu_setup = __setup_cpu_460ex,
@@ -1521,8 +1625,9 @@ static struct cpu_spec __initdata cpu_specs[] = {
1521 .pvr_mask = 0xffff0002, 1625 .pvr_mask = 0xffff0002,
1522 .pvr_value = 0x13020000, 1626 .pvr_value = 0x13020000,
1523 .cpu_name = "460GT", 1627 .cpu_name = "460GT",
1524 .cpu_features = CPU_FTRS_44X, 1628 .cpu_features = CPU_FTRS_440x6,
1525 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU, 1629 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
1630 .mmu_features = MMU_FTR_TYPE_44x,
1526 .icache_bsize = 32, 1631 .icache_bsize = 32,
1527 .dcache_bsize = 32, 1632 .dcache_bsize = 32,
1528 .cpu_setup = __setup_cpu_460gt, 1633 .cpu_setup = __setup_cpu_460gt,
@@ -1535,6 +1640,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1535 .cpu_name = "(generic 44x PPC)", 1640 .cpu_name = "(generic 44x PPC)",
1536 .cpu_features = CPU_FTRS_44X, 1641 .cpu_features = CPU_FTRS_44X,
1537 .cpu_user_features = COMMON_USER_BOOKE, 1642 .cpu_user_features = COMMON_USER_BOOKE,
1643 .mmu_features = MMU_FTR_TYPE_44x,
1538 .icache_bsize = 32, 1644 .icache_bsize = 32,
1539 .dcache_bsize = 32, 1645 .dcache_bsize = 32,
1540 .machine_check = machine_check_4xx, 1646 .machine_check = machine_check_4xx,
@@ -1551,6 +1657,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1551 .cpu_user_features = COMMON_USER_BOOKE | 1657 .cpu_user_features = COMMON_USER_BOOKE |
1552 PPC_FEATURE_HAS_EFP_SINGLE | 1658 PPC_FEATURE_HAS_EFP_SINGLE |
1553 PPC_FEATURE_UNIFIED_CACHE, 1659 PPC_FEATURE_UNIFIED_CACHE,
1660 .mmu_features = MMU_FTR_TYPE_FSL_E,
1554 .dcache_bsize = 32, 1661 .dcache_bsize = 32,
1555 .machine_check = machine_check_e200, 1662 .machine_check = machine_check_e200,
1556 .platform = "ppc5554", 1663 .platform = "ppc5554",
@@ -1565,6 +1672,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1565 PPC_FEATURE_HAS_SPE_COMP | 1672 PPC_FEATURE_HAS_SPE_COMP |
1566 PPC_FEATURE_HAS_EFP_SINGLE_COMP | 1673 PPC_FEATURE_HAS_EFP_SINGLE_COMP |
1567 PPC_FEATURE_UNIFIED_CACHE, 1674 PPC_FEATURE_UNIFIED_CACHE,
1675 .mmu_features = MMU_FTR_TYPE_FSL_E,
1568 .dcache_bsize = 32, 1676 .dcache_bsize = 32,
1569 .machine_check = machine_check_e200, 1677 .machine_check = machine_check_e200,
1570 .platform = "ppc5554", 1678 .platform = "ppc5554",
@@ -1577,6 +1685,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1577 .cpu_user_features = COMMON_USER_BOOKE | 1685 .cpu_user_features = COMMON_USER_BOOKE |
1578 PPC_FEATURE_HAS_EFP_SINGLE | 1686 PPC_FEATURE_HAS_EFP_SINGLE |
1579 PPC_FEATURE_UNIFIED_CACHE, 1687 PPC_FEATURE_UNIFIED_CACHE,
1688 .mmu_features = MMU_FTR_TYPE_FSL_E,
1580 .dcache_bsize = 32, 1689 .dcache_bsize = 32,
1581 .machine_check = machine_check_e200, 1690 .machine_check = machine_check_e200,
1582 .platform = "ppc5554", 1691 .platform = "ppc5554",
@@ -1591,6 +1700,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1591 .cpu_user_features = COMMON_USER_BOOKE | 1700 .cpu_user_features = COMMON_USER_BOOKE |
1592 PPC_FEATURE_HAS_SPE_COMP | 1701 PPC_FEATURE_HAS_SPE_COMP |
1593 PPC_FEATURE_HAS_EFP_SINGLE_COMP, 1702 PPC_FEATURE_HAS_EFP_SINGLE_COMP,
1703 .mmu_features = MMU_FTR_TYPE_FSL_E,
1594 .icache_bsize = 32, 1704 .icache_bsize = 32,
1595 .dcache_bsize = 32, 1705 .dcache_bsize = 32,
1596 .num_pmcs = 4, 1706 .num_pmcs = 4,
@@ -1608,6 +1718,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1608 PPC_FEATURE_HAS_SPE_COMP | 1718 PPC_FEATURE_HAS_SPE_COMP |
1609 PPC_FEATURE_HAS_EFP_SINGLE_COMP | 1719 PPC_FEATURE_HAS_EFP_SINGLE_COMP |
1610 PPC_FEATURE_HAS_EFP_DOUBLE_COMP, 1720 PPC_FEATURE_HAS_EFP_DOUBLE_COMP,
1721 .mmu_features = MMU_FTR_TYPE_FSL_E | MMU_FTR_BIG_PHYS,
1611 .icache_bsize = 32, 1722 .icache_bsize = 32,
1612 .dcache_bsize = 32, 1723 .dcache_bsize = 32,
1613 .num_pmcs = 4, 1724 .num_pmcs = 4,
@@ -1622,6 +1733,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1622 .cpu_name = "e500mc", 1733 .cpu_name = "e500mc",
1623 .cpu_features = CPU_FTRS_E500MC, 1734 .cpu_features = CPU_FTRS_E500MC,
1624 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU, 1735 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
1736 .mmu_features = MMU_FTR_TYPE_FSL_E | MMU_FTR_BIG_PHYS,
1625 .icache_bsize = 64, 1737 .icache_bsize = 64,
1626 .dcache_bsize = 64, 1738 .dcache_bsize = 64,
1627 .num_pmcs = 4, 1739 .num_pmcs = 4,
@@ -1638,6 +1750,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1638 .cpu_user_features = COMMON_USER_BOOKE | 1750 .cpu_user_features = COMMON_USER_BOOKE |
1639 PPC_FEATURE_HAS_SPE_COMP | 1751 PPC_FEATURE_HAS_SPE_COMP |
1640 PPC_FEATURE_HAS_EFP_SINGLE_COMP, 1752 PPC_FEATURE_HAS_EFP_SINGLE_COMP,
1753 .mmu_features = MMU_FTR_TYPE_FSL_E,
1641 .icache_bsize = 32, 1754 .icache_bsize = 32,
1642 .dcache_bsize = 32, 1755 .dcache_bsize = 32,
1643 .machine_check = machine_check_e500, 1756 .machine_check = machine_check_e500,
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index 3a6eaa876ee1..1c5c8a6fc129 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -120,6 +120,26 @@ static inline void dma_direct_unmap_page(struct device *dev,
120{ 120{
121} 121}
122 122
123#ifdef CONFIG_NOT_COHERENT_CACHE
124static inline void dma_direct_sync_sg(struct device *dev,
125 struct scatterlist *sgl, int nents,
126 enum dma_data_direction direction)
127{
128 struct scatterlist *sg;
129 int i;
130
131 for_each_sg(sgl, sg, nents, i)
132 __dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
133}
134
135static inline void dma_direct_sync_single_range(struct device *dev,
136 dma_addr_t dma_handle, unsigned long offset, size_t size,
137 enum dma_data_direction direction)
138{
139 __dma_sync(bus_to_virt(dma_handle+offset), size, direction);
140}
141#endif
142
123struct dma_mapping_ops dma_direct_ops = { 143struct dma_mapping_ops dma_direct_ops = {
124 .alloc_coherent = dma_direct_alloc_coherent, 144 .alloc_coherent = dma_direct_alloc_coherent,
125 .free_coherent = dma_direct_free_coherent, 145 .free_coherent = dma_direct_free_coherent,
@@ -128,5 +148,11 @@ struct dma_mapping_ops dma_direct_ops = {
128 .dma_supported = dma_direct_dma_supported, 148 .dma_supported = dma_direct_dma_supported,
129 .map_page = dma_direct_map_page, 149 .map_page = dma_direct_map_page,
130 .unmap_page = dma_direct_unmap_page, 150 .unmap_page = dma_direct_unmap_page,
151#ifdef CONFIG_NOT_COHERENT_CACHE
152 .sync_single_range_for_cpu = dma_direct_sync_single_range,
153 .sync_single_range_for_device = dma_direct_sync_single_range,
154 .sync_sg_for_cpu = dma_direct_sync_sg,
155 .sync_sg_for_device = dma_direct_sync_sg,
156#endif
131}; 157};
132EXPORT_SYMBOL(dma_direct_ops); 158EXPORT_SYMBOL(dma_direct_ops);
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 7ecc0d1855c3..6f7eb7e00c79 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -1162,39 +1162,17 @@ machine_check_in_rtas:
1162#ifdef CONFIG_DYNAMIC_FTRACE 1162#ifdef CONFIG_DYNAMIC_FTRACE
1163_GLOBAL(mcount) 1163_GLOBAL(mcount)
1164_GLOBAL(_mcount) 1164_GLOBAL(_mcount)
1165 stwu r1,-48(r1) 1165 /*
1166 stw r3, 12(r1) 1166 * It is required that _mcount on PPC32 must preserve the
1167 stw r4, 16(r1) 1167 * link register. But we have r0 to play with. We use r0
1168 stw r5, 20(r1) 1168 * to push the return address back to the caller of mcount
1169 stw r6, 24(r1) 1169 * into the ctr register, restore the link register and
1170 mflr r3 1170 * then jump back using the ctr register.
1171 stw r7, 28(r1) 1171 */
1172 mfcr r5 1172 mflr r0
1173 stw r8, 32(r1)
1174 stw r9, 36(r1)
1175 stw r10,40(r1)
1176 stw r3, 44(r1)
1177 stw r5, 8(r1)
1178 subi r3, r3, MCOUNT_INSN_SIZE
1179 .globl mcount_call
1180mcount_call:
1181 bl ftrace_stub
1182 nop
1183 lwz r6, 8(r1)
1184 lwz r0, 44(r1)
1185 lwz r3, 12(r1)
1186 mtctr r0 1173 mtctr r0
1187 lwz r4, 16(r1) 1174 lwz r0, 4(r1)
1188 mtcr r6
1189 lwz r5, 20(r1)
1190 lwz r6, 24(r1)
1191 lwz r0, 52(r1)
1192 lwz r7, 28(r1)
1193 lwz r8, 32(r1)
1194 mtlr r0 1175 mtlr r0
1195 lwz r9, 36(r1)
1196 lwz r10,40(r1)
1197 addi r1, r1, 48
1198 bctr 1176 bctr
1199 1177
1200_GLOBAL(ftrace_caller) 1178_GLOBAL(ftrace_caller)
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index e0bcf9354286..383ed6eb0085 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -894,18 +894,6 @@ _GLOBAL(enter_prom)
894#ifdef CONFIG_DYNAMIC_FTRACE 894#ifdef CONFIG_DYNAMIC_FTRACE
895_GLOBAL(mcount) 895_GLOBAL(mcount)
896_GLOBAL(_mcount) 896_GLOBAL(_mcount)
897 /* Taken from output of objdump from lib64/glibc */
898 mflr r3
899 stdu r1, -112(r1)
900 std r3, 128(r1)
901 subi r3, r3, MCOUNT_INSN_SIZE
902 .globl mcount_call
903mcount_call:
904 bl ftrace_stub
905 nop
906 ld r0, 128(r1)
907 mtlr r0
908 addi r1, r1, 112
909 blr 897 blr
910 898
911_GLOBAL(ftrace_caller) 899_GLOBAL(ftrace_caller)
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c
index f4b006ed0ab1..5355244c99ff 100644
--- a/arch/powerpc/kernel/ftrace.c
+++ b/arch/powerpc/kernel/ftrace.c
@@ -9,22 +9,30 @@
9 9
10#include <linux/spinlock.h> 10#include <linux/spinlock.h>
11#include <linux/hardirq.h> 11#include <linux/hardirq.h>
12#include <linux/uaccess.h>
13#include <linux/module.h>
12#include <linux/ftrace.h> 14#include <linux/ftrace.h>
13#include <linux/percpu.h> 15#include <linux/percpu.h>
14#include <linux/init.h> 16#include <linux/init.h>
15#include <linux/list.h> 17#include <linux/list.h>
16 18
17#include <asm/cacheflush.h> 19#include <asm/cacheflush.h>
20#include <asm/code-patching.h>
18#include <asm/ftrace.h> 21#include <asm/ftrace.h>
19 22
23#if 0
24#define DEBUGP printk
25#else
26#define DEBUGP(fmt , ...) do { } while (0)
27#endif
20 28
21static unsigned int ftrace_nop = 0x60000000; 29static unsigned int ftrace_nop = PPC_NOP_INSTR;
22 30
23#ifdef CONFIG_PPC32 31#ifdef CONFIG_PPC32
24# define GET_ADDR(addr) addr 32# define GET_ADDR(addr) addr
25#else 33#else
26/* PowerPC64's functions are data that points to the functions */ 34/* PowerPC64's functions are data that points to the functions */
27# define GET_ADDR(addr) *(unsigned long *)addr 35# define GET_ADDR(addr) (*(unsigned long *)addr)
28#endif 36#endif
29 37
30 38
@@ -33,12 +41,12 @@ static unsigned int ftrace_calc_offset(long ip, long addr)
33 return (int)(addr - ip); 41 return (int)(addr - ip);
34} 42}
35 43
36unsigned char *ftrace_nop_replace(void) 44static unsigned char *ftrace_nop_replace(void)
37{ 45{
38 return (char *)&ftrace_nop; 46 return (char *)&ftrace_nop;
39} 47}
40 48
41unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr) 49static unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
42{ 50{
43 static unsigned int op; 51 static unsigned int op;
44 52
@@ -68,49 +76,422 @@ unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
68# define _ASM_PTR " .long " 76# define _ASM_PTR " .long "
69#endif 77#endif
70 78
71int 79static int
72ftrace_modify_code(unsigned long ip, unsigned char *old_code, 80ftrace_modify_code(unsigned long ip, unsigned char *old_code,
73 unsigned char *new_code) 81 unsigned char *new_code)
74{ 82{
75 unsigned replaced; 83 unsigned char replaced[MCOUNT_INSN_SIZE];
76 unsigned old = *(unsigned *)old_code;
77 unsigned new = *(unsigned *)new_code;
78 int faulted = 0;
79 84
80 /* 85 /*
81 * Note: Due to modules and __init, code can 86 * Note: Due to modules and __init, code can
82 * disappear and change, we need to protect against faulting 87 * disappear and change, we need to protect against faulting
83 * as well as code changing. 88 * as well as code changing. We do this by using the
89 * probe_kernel_* functions.
84 * 90 *
85 * No real locking needed, this code is run through 91 * No real locking needed, this code is run through
86 * kstop_machine. 92 * kstop_machine, or before SMP starts.
87 */ 93 */
88 asm volatile ( 94
89 "1: lwz %1, 0(%2)\n" 95 /* read the text we want to modify */
90 " cmpw %1, %5\n" 96 if (probe_kernel_read(replaced, (void *)ip, MCOUNT_INSN_SIZE))
91 " bne 2f\n" 97 return -EFAULT;
92 " stwu %3, 0(%2)\n" 98
93 "2:\n" 99 /* Make sure it is what we expect it to be */
94 ".section .fixup, \"ax\"\n" 100 if (memcmp(replaced, old_code, MCOUNT_INSN_SIZE) != 0)
95 "3: li %0, 1\n" 101 return -EINVAL;
96 " b 2b\n" 102
97 ".previous\n" 103 /* replace the text with the new text */
98 ".section __ex_table,\"a\"\n" 104 if (probe_kernel_write((void *)ip, new_code, MCOUNT_INSN_SIZE))
99 _ASM_ALIGN "\n" 105 return -EPERM;
100 _ASM_PTR "1b, 3b\n" 106
101 ".previous" 107 flush_icache_range(ip, ip + 8);
102 : "=r"(faulted), "=r"(replaced) 108
103 : "r"(ip), "r"(new), 109 return 0;
104 "0"(faulted), "r"(old) 110}
105 : "memory"); 111
106 112/*
107 if (replaced != old && replaced != new) 113 * Helper functions that are the same for both PPC64 and PPC32.
108 faulted = 2; 114 */
109 115static int test_24bit_addr(unsigned long ip, unsigned long addr)
110 if (!faulted) 116{
111 flush_icache_range(ip, ip + 8); 117
112 118 /* use the create_branch to verify that this offset can be branched */
113 return faulted; 119 return create_branch((unsigned int *)ip, addr, 0);
120}
121
122static int is_bl_op(unsigned int op)
123{
124 return (op & 0xfc000003) == 0x48000001;
125}
126
127static unsigned long find_bl_target(unsigned long ip, unsigned int op)
128{
129 static int offset;
130
131 offset = (op & 0x03fffffc);
132 /* make it signed */
133 if (offset & 0x02000000)
134 offset |= 0xfe000000;
135
136 return ip + (long)offset;
137}
138
139#ifdef CONFIG_PPC64
140static int
141__ftrace_make_nop(struct module *mod,
142 struct dyn_ftrace *rec, unsigned long addr)
143{
144 unsigned int op;
145 unsigned int jmp[5];
146 unsigned long ptr;
147 unsigned long ip = rec->ip;
148 unsigned long tramp;
149 int offset;
150
151 /* read where this goes */
152 if (probe_kernel_read(&op, (void *)ip, sizeof(int)))
153 return -EFAULT;
154
155 /* Make sure that that this is still a 24bit jump */
156 if (!is_bl_op(op)) {
157 printk(KERN_ERR "Not expected bl: opcode is %x\n", op);
158 return -EINVAL;
159 }
160
161 /* lets find where the pointer goes */
162 tramp = find_bl_target(ip, op);
163
164 /*
165 * On PPC64 the trampoline looks like:
166 * 0x3d, 0x82, 0x00, 0x00, addis r12,r2, <high>
167 * 0x39, 0x8c, 0x00, 0x00, addi r12,r12, <low>
168 * Where the bytes 2,3,6 and 7 make up the 32bit offset
169 * to the TOC that holds the pointer.
170 * to jump to.
171 * 0xf8, 0x41, 0x00, 0x28, std r2,40(r1)
172 * 0xe9, 0x6c, 0x00, 0x20, ld r11,32(r12)
173 * The actually address is 32 bytes from the offset
174 * into the TOC.
175 * 0xe8, 0x4c, 0x00, 0x28, ld r2,40(r12)
176 */
177
178 DEBUGP("ip:%lx jumps to %lx r2: %lx", ip, tramp, mod->arch.toc);
179
180 /* Find where the trampoline jumps to */
181 if (probe_kernel_read(jmp, (void *)tramp, sizeof(jmp))) {
182 printk(KERN_ERR "Failed to read %lx\n", tramp);
183 return -EFAULT;
184 }
185
186 DEBUGP(" %08x %08x", jmp[0], jmp[1]);
187
188 /* verify that this is what we expect it to be */
189 if (((jmp[0] & 0xffff0000) != 0x3d820000) ||
190 ((jmp[1] & 0xffff0000) != 0x398c0000) ||
191 (jmp[2] != 0xf8410028) ||
192 (jmp[3] != 0xe96c0020) ||
193 (jmp[4] != 0xe84c0028)) {
194 printk(KERN_ERR "Not a trampoline\n");
195 return -EINVAL;
196 }
197
198 offset = (unsigned)((unsigned short)jmp[0]) << 16 |
199 (unsigned)((unsigned short)jmp[1]);
200
201 DEBUGP(" %x ", offset);
202
203 /* get the address this jumps too */
204 tramp = mod->arch.toc + offset + 32;
205 DEBUGP("toc: %lx", tramp);
206
207 if (probe_kernel_read(jmp, (void *)tramp, 8)) {
208 printk(KERN_ERR "Failed to read %lx\n", tramp);
209 return -EFAULT;
210 }
211
212 DEBUGP(" %08x %08x\n", jmp[0], jmp[1]);
213
214 ptr = ((unsigned long)jmp[0] << 32) + jmp[1];
215
216 /* This should match what was called */
217 if (ptr != GET_ADDR(addr)) {
218 printk(KERN_ERR "addr does not match %lx\n", ptr);
219 return -EINVAL;
220 }
221
222 /*
223 * We want to nop the line, but the next line is
224 * 0xe8, 0x41, 0x00, 0x28 ld r2,40(r1)
225 * This needs to be turned to a nop too.
226 */
227 if (probe_kernel_read(&op, (void *)(ip+4), MCOUNT_INSN_SIZE))
228 return -EFAULT;
229
230 if (op != 0xe8410028) {
231 printk(KERN_ERR "Next line is not ld! (%08x)\n", op);
232 return -EINVAL;
233 }
234
235 /*
236 * Milton Miller pointed out that we can not blindly do nops.
237 * If a task was preempted when calling a trace function,
238 * the nops will remove the way to restore the TOC in r2
239 * and the r2 TOC will get corrupted.
240 */
241
242 /*
243 * Replace:
244 * bl <tramp> <==== will be replaced with "b 1f"
245 * ld r2,40(r1)
246 * 1:
247 */
248 op = 0x48000008; /* b +8 */
249
250 if (probe_kernel_write((void *)ip, &op, MCOUNT_INSN_SIZE))
251 return -EPERM;
252
253
254 flush_icache_range(ip, ip + 8);
255
256 return 0;
257}
258
259#else /* !PPC64 */
260static int
261__ftrace_make_nop(struct module *mod,
262 struct dyn_ftrace *rec, unsigned long addr)
263{
264 unsigned int op;
265 unsigned int jmp[4];
266 unsigned long ip = rec->ip;
267 unsigned long tramp;
268
269 if (probe_kernel_read(&op, (void *)ip, MCOUNT_INSN_SIZE))
270 return -EFAULT;
271
272 /* Make sure that that this is still a 24bit jump */
273 if (!is_bl_op(op)) {
274 printk(KERN_ERR "Not expected bl: opcode is %x\n", op);
275 return -EINVAL;
276 }
277
278 /* lets find where the pointer goes */
279 tramp = find_bl_target(ip, op);
280
281 /*
282 * On PPC32 the trampoline looks like:
283 * 0x3d, 0x60, 0x00, 0x00 lis r11,sym@ha
284 * 0x39, 0x6b, 0x00, 0x00 addi r11,r11,sym@l
285 * 0x7d, 0x69, 0x03, 0xa6 mtctr r11
286 * 0x4e, 0x80, 0x04, 0x20 bctr
287 */
288
289 DEBUGP("ip:%lx jumps to %lx", ip, tramp);
290
291 /* Find where the trampoline jumps to */
292 if (probe_kernel_read(jmp, (void *)tramp, sizeof(jmp))) {
293 printk(KERN_ERR "Failed to read %lx\n", tramp);
294 return -EFAULT;
295 }
296
297 DEBUGP(" %08x %08x ", jmp[0], jmp[1]);
298
299 /* verify that this is what we expect it to be */
300 if (((jmp[0] & 0xffff0000) != 0x3d600000) ||
301 ((jmp[1] & 0xffff0000) != 0x396b0000) ||
302 (jmp[2] != 0x7d6903a6) ||
303 (jmp[3] != 0x4e800420)) {
304 printk(KERN_ERR "Not a trampoline\n");
305 return -EINVAL;
306 }
307
308 tramp = (jmp[1] & 0xffff) |
309 ((jmp[0] & 0xffff) << 16);
310 if (tramp & 0x8000)
311 tramp -= 0x10000;
312
313 DEBUGP(" %x ", tramp);
314
315 if (tramp != addr) {
316 printk(KERN_ERR
317 "Trampoline location %08lx does not match addr\n",
318 tramp);
319 return -EINVAL;
320 }
321
322 op = PPC_NOP_INSTR;
323
324 if (probe_kernel_write((void *)ip, &op, MCOUNT_INSN_SIZE))
325 return -EPERM;
326
327 flush_icache_range(ip, ip + 8);
328
329 return 0;
330}
331#endif /* PPC64 */
332
333int ftrace_make_nop(struct module *mod,
334 struct dyn_ftrace *rec, unsigned long addr)
335{
336 unsigned char *old, *new;
337 unsigned long ip = rec->ip;
338
339 /*
340 * If the calling address is more that 24 bits away,
341 * then we had to use a trampoline to make the call.
342 * Otherwise just update the call site.
343 */
344 if (test_24bit_addr(ip, addr)) {
345 /* within range */
346 old = ftrace_call_replace(ip, addr);
347 new = ftrace_nop_replace();
348 return ftrace_modify_code(ip, old, new);
349 }
350
351 /*
352 * Out of range jumps are called from modules.
353 * We should either already have a pointer to the module
354 * or it has been passed in.
355 */
356 if (!rec->arch.mod) {
357 if (!mod) {
358 printk(KERN_ERR "No module loaded addr=%lx\n",
359 addr);
360 return -EFAULT;
361 }
362 rec->arch.mod = mod;
363 } else if (mod) {
364 if (mod != rec->arch.mod) {
365 printk(KERN_ERR
366 "Record mod %p not equal to passed in mod %p\n",
367 rec->arch.mod, mod);
368 return -EINVAL;
369 }
370 /* nothing to do if mod == rec->arch.mod */
371 } else
372 mod = rec->arch.mod;
373
374 return __ftrace_make_nop(mod, rec, addr);
375
376}
377
378#ifdef CONFIG_PPC64
379static int
380__ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
381{
382 unsigned int op[2];
383 unsigned long ip = rec->ip;
384
385 /* read where this goes */
386 if (probe_kernel_read(op, (void *)ip, MCOUNT_INSN_SIZE * 2))
387 return -EFAULT;
388
389 /*
390 * It should be pointing to two nops or
391 * b +8; ld r2,40(r1)
392 */
393 if (((op[0] != 0x48000008) || (op[1] != 0xe8410028)) &&
394 ((op[0] != PPC_NOP_INSTR) || (op[1] != PPC_NOP_INSTR))) {
395 printk(KERN_ERR "Expected NOPs but have %x %x\n", op[0], op[1]);
396 return -EINVAL;
397 }
398
399 /* If we never set up a trampoline to ftrace_caller, then bail */
400 if (!rec->arch.mod->arch.tramp) {
401 printk(KERN_ERR "No ftrace trampoline\n");
402 return -EINVAL;
403 }
404
405 /* create the branch to the trampoline */
406 op[0] = create_branch((unsigned int *)ip,
407 rec->arch.mod->arch.tramp, BRANCH_SET_LINK);
408 if (!op[0]) {
409 printk(KERN_ERR "REL24 out of range!\n");
410 return -EINVAL;
411 }
412
413 /* ld r2,40(r1) */
414 op[1] = 0xe8410028;
415
416 DEBUGP("write to %lx\n", rec->ip);
417
418 if (probe_kernel_write((void *)ip, op, MCOUNT_INSN_SIZE * 2))
419 return -EPERM;
420
421 flush_icache_range(ip, ip + 8);
422
423 return 0;
424}
425#else
426static int
427__ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
428{
429 unsigned int op;
430 unsigned long ip = rec->ip;
431
432 /* read where this goes */
433 if (probe_kernel_read(&op, (void *)ip, MCOUNT_INSN_SIZE))
434 return -EFAULT;
435
436 /* It should be pointing to a nop */
437 if (op != PPC_NOP_INSTR) {
438 printk(KERN_ERR "Expected NOP but have %x\n", op);
439 return -EINVAL;
440 }
441
442 /* If we never set up a trampoline to ftrace_caller, then bail */
443 if (!rec->arch.mod->arch.tramp) {
444 printk(KERN_ERR "No ftrace trampoline\n");
445 return -EINVAL;
446 }
447
448 /* create the branch to the trampoline */
449 op = create_branch((unsigned int *)ip,
450 rec->arch.mod->arch.tramp, BRANCH_SET_LINK);
451 if (!op) {
452 printk(KERN_ERR "REL24 out of range!\n");
453 return -EINVAL;
454 }
455
456 DEBUGP("write to %lx\n", rec->ip);
457
458 if (probe_kernel_write((void *)ip, &op, MCOUNT_INSN_SIZE))
459 return -EPERM;
460
461 flush_icache_range(ip, ip + 8);
462
463 return 0;
464}
465#endif /* CONFIG_PPC64 */
466
467int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
468{
469 unsigned char *old, *new;
470 unsigned long ip = rec->ip;
471
472 /*
473 * If the calling address is more that 24 bits away,
474 * then we had to use a trampoline to make the call.
475 * Otherwise just update the call site.
476 */
477 if (test_24bit_addr(ip, addr)) {
478 /* within range */
479 old = ftrace_nop_replace();
480 new = ftrace_call_replace(ip, addr);
481 return ftrace_modify_code(ip, old, new);
482 }
483
484 /*
485 * Out of range jumps are called from modules.
486 * Being that we are converting from nop, it had better
487 * already have a module defined.
488 */
489 if (!rec->arch.mod) {
490 printk(KERN_ERR "No module loaded\n");
491 return -EINVAL;
492 }
493
494 return __ftrace_make_call(rec, addr);
114} 495}
115 496
116int ftrace_update_ftrace_func(ftrace_func_t func) 497int ftrace_update_ftrace_func(ftrace_func_t func)
@@ -128,10 +509,10 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
128 509
129int __init ftrace_dyn_arch_init(void *data) 510int __init ftrace_dyn_arch_init(void *data)
130{ 511{
131 /* This is running in kstop_machine */ 512 /* caller expects data to be zero */
513 unsigned long *p = data;
132 514
133 ftrace_mcount_set(data); 515 *p = 0;
134 516
135 return 0; 517 return 0;
136} 518}
137
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index 0c326823c6d4..a1c4cfd25ded 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -31,6 +31,7 @@
31#include <asm/ppc_asm.h> 31#include <asm/ppc_asm.h>
32#include <asm/asm-offsets.h> 32#include <asm/asm-offsets.h>
33#include <asm/ptrace.h> 33#include <asm/ptrace.h>
34#include <asm/bug.h>
34 35
35/* 601 only have IBAT; cr0.eq is set on 601 when using this macro */ 36/* 601 only have IBAT; cr0.eq is set on 601 when using this macro */
36#define LOAD_BAT(n, reg, RA, RB) \ 37#define LOAD_BAT(n, reg, RA, RB) \
@@ -182,7 +183,8 @@ __after_mmu_off:
182 bl reloc_offset 183 bl reloc_offset
183 mr r26,r3 184 mr r26,r3
184 addis r4,r3,KERNELBASE@h /* current address of _start */ 185 addis r4,r3,KERNELBASE@h /* current address of _start */
185 cmpwi 0,r4,0 /* are we already running at 0? */ 186 lis r5,PHYSICAL_START@h
187 cmplw 0,r4,r5 /* already running at PHYSICAL_START? */
186 bne relocate_kernel 188 bne relocate_kernel
187/* 189/*
188 * we now have the 1st 16M of ram mapped with the bats. 190 * we now have the 1st 16M of ram mapped with the bats.
@@ -810,13 +812,13 @@ giveup_altivec:
810 812
811/* 813/*
812 * This code is jumped to from the startup code to copy 814 * This code is jumped to from the startup code to copy
813 * the kernel image to physical address 0. 815 * the kernel image to physical address PHYSICAL_START.
814 */ 816 */
815relocate_kernel: 817relocate_kernel:
816 addis r9,r26,klimit@ha /* fetch klimit */ 818 addis r9,r26,klimit@ha /* fetch klimit */
817 lwz r25,klimit@l(r9) 819 lwz r25,klimit@l(r9)
818 addis r25,r25,-KERNELBASE@h 820 addis r25,r25,-KERNELBASE@h
819 li r3,0 /* Destination base address */ 821 lis r3,PHYSICAL_START@h /* Destination base address */
820 li r6,0 /* Destination offset */ 822 li r6,0 /* Destination offset */
821 li r5,0x4000 /* # bytes of memory to copy */ 823 li r5,0x4000 /* # bytes of memory to copy */
822 bl copy_and_flush /* copy the first 0x4000 bytes */ 824 bl copy_and_flush /* copy the first 0x4000 bytes */
@@ -989,12 +991,12 @@ load_up_mmu:
989 LOAD_BAT(1,r3,r4,r5) 991 LOAD_BAT(1,r3,r4,r5)
990 LOAD_BAT(2,r3,r4,r5) 992 LOAD_BAT(2,r3,r4,r5)
991 LOAD_BAT(3,r3,r4,r5) 993 LOAD_BAT(3,r3,r4,r5)
992BEGIN_FTR_SECTION 994BEGIN_MMU_FTR_SECTION
993 LOAD_BAT(4,r3,r4,r5) 995 LOAD_BAT(4,r3,r4,r5)
994 LOAD_BAT(5,r3,r4,r5) 996 LOAD_BAT(5,r3,r4,r5)
995 LOAD_BAT(6,r3,r4,r5) 997 LOAD_BAT(6,r3,r4,r5)
996 LOAD_BAT(7,r3,r4,r5) 998 LOAD_BAT(7,r3,r4,r5)
997END_FTR_SECTION_IFSET(CPU_FTR_HAS_HIGH_BATS) 999END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_HIGH_BATS)
998 blr 1000 blr
999 1001
1000/* 1002/*
@@ -1070,9 +1072,14 @@ start_here:
1070 RFI 1072 RFI
1071 1073
1072/* 1074/*
1075 * void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next);
1076 *
1073 * Set up the segment registers for a new context. 1077 * Set up the segment registers for a new context.
1074 */ 1078 */
1075_ENTRY(set_context) 1079_ENTRY(switch_mmu_context)
1080 lwz r3,MMCONTEXTID(r4)
1081 cmpwi cr0,r3,0
1082 blt- 4f
1076 mulli r3,r3,897 /* multiply context by skew factor */ 1083 mulli r3,r3,897 /* multiply context by skew factor */
1077 rlwinm r3,r3,4,8,27 /* VSID = (context & 0xfffff) << 4 */ 1084 rlwinm r3,r3,4,8,27 /* VSID = (context & 0xfffff) << 4 */
1078 addis r3,r3,0x6000 /* Set Ks, Ku bits */ 1085 addis r3,r3,0x6000 /* Set Ks, Ku bits */
@@ -1083,6 +1090,7 @@ _ENTRY(set_context)
1083 /* Context switch the PTE pointer for the Abatron BDI2000. 1090 /* Context switch the PTE pointer for the Abatron BDI2000.
1084 * The PGDIR is passed as second argument. 1091 * The PGDIR is passed as second argument.
1085 */ 1092 */
1093 lwz r4,MM_PGD(r4)
1086 lis r5, KERNELBASE@h 1094 lis r5, KERNELBASE@h
1087 lwz r5, 0xf0(r5) 1095 lwz r5, 0xf0(r5)
1088 stw r4, 0x4(r5) 1096 stw r4, 0x4(r5)
@@ -1098,6 +1106,9 @@ _ENTRY(set_context)
1098 sync 1106 sync
1099 isync 1107 isync
1100 blr 1108 blr
11094: trap
1110 EMIT_BUG_ENTRY 4b,__FILE__,__LINE__,0
1111 blr
1101 1112
1102/* 1113/*
1103 * An undocumented "feature" of 604e requires that the v bit 1114 * An undocumented "feature" of 604e requires that the v bit
@@ -1131,7 +1142,7 @@ clear_bats:
1131 mtspr SPRN_IBAT2L,r10 1142 mtspr SPRN_IBAT2L,r10
1132 mtspr SPRN_IBAT3U,r10 1143 mtspr SPRN_IBAT3U,r10
1133 mtspr SPRN_IBAT3L,r10 1144 mtspr SPRN_IBAT3L,r10
1134BEGIN_FTR_SECTION 1145BEGIN_MMU_FTR_SECTION
1135 /* Here's a tweak: at this point, CPU setup have 1146 /* Here's a tweak: at this point, CPU setup have
1136 * not been called yet, so HIGH_BAT_EN may not be 1147 * not been called yet, so HIGH_BAT_EN may not be
1137 * set in HID0 for the 745x processors. However, it 1148 * set in HID0 for the 745x processors. However, it
@@ -1154,7 +1165,7 @@ BEGIN_FTR_SECTION
1154 mtspr SPRN_IBAT6L,r10 1165 mtspr SPRN_IBAT6L,r10
1155 mtspr SPRN_IBAT7U,r10 1166 mtspr SPRN_IBAT7U,r10
1156 mtspr SPRN_IBAT7L,r10 1167 mtspr SPRN_IBAT7L,r10
1157END_FTR_SECTION_IFSET(CPU_FTR_HAS_HIGH_BATS) 1168END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_HIGH_BATS)
1158 blr 1169 blr
1159 1170
1160flush_tlbs: 1171flush_tlbs:
@@ -1178,11 +1189,11 @@ mmu_off:
1178 1189
1179/* 1190/*
1180 * Use the first pair of BAT registers to map the 1st 16MB 1191 * Use the first pair of BAT registers to map the 1st 16MB
1181 * of RAM to KERNELBASE. From this point on we can't safely 1192 * of RAM to PAGE_OFFSET. From this point on we can't safely
1182 * call OF any more. 1193 * call OF any more.
1183 */ 1194 */
1184initial_bats: 1195initial_bats:
1185 lis r11,KERNELBASE@h 1196 lis r11,PAGE_OFFSET@h
1186 mfspr r9,SPRN_PVR 1197 mfspr r9,SPRN_PVR
1187 rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */ 1198 rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */
1188 cmpwi 0,r9,1 1199 cmpwi 0,r9,1
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index f3a1ea9d7fe4..b56fecc93a16 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -69,6 +69,17 @@ _ENTRY(_start);
69 li r24,0 /* CPU number */ 69 li r24,0 /* CPU number */
70 70
71/* 71/*
72 * In case the firmware didn't do it, we apply some workarounds
73 * that are good for all 440 core variants here
74 */
75 mfspr r3,SPRN_CCR0
76 rlwinm r3,r3,0,0,27 /* disable icache prefetch */
77 isync
78 mtspr SPRN_CCR0,r3
79 isync
80 sync
81
82/*
72 * Set up the initial MMU state 83 * Set up the initial MMU state
73 * 84 *
74 * We are still executing code at the virtual address 85 * We are still executing code at the virtual address
@@ -391,12 +402,14 @@ interrupt_base:
391 rlwimi r13,r12,10,30,30 402 rlwimi r13,r12,10,30,30
392 403
393 /* Load the PTE */ 404 /* Load the PTE */
394 rlwinm r12, r10, 13, 19, 29 /* Compute pgdir/pmd offset */ 405 /* Compute pgdir/pmd offset */
406 rlwinm r12, r10, PPC44x_PGD_OFF_SHIFT, PPC44x_PGD_OFF_MASK_BIT, 29
395 lwzx r11, r12, r11 /* Get pgd/pmd entry */ 407 lwzx r11, r12, r11 /* Get pgd/pmd entry */
396 rlwinm. r12, r11, 0, 0, 20 /* Extract pt base address */ 408 rlwinm. r12, r11, 0, 0, 20 /* Extract pt base address */
397 beq 2f /* Bail if no table */ 409 beq 2f /* Bail if no table */
398 410
399 rlwimi r12, r10, 23, 20, 28 /* Compute pte address */ 411 /* Compute pte address */
412 rlwimi r12, r10, PPC44x_PTE_ADD_SHIFT, PPC44x_PTE_ADD_MASK_BIT, 28
400 lwz r11, 0(r12) /* Get high word of pte entry */ 413 lwz r11, 0(r12) /* Get high word of pte entry */
401 lwz r12, 4(r12) /* Get low word of pte entry */ 414 lwz r12, 4(r12) /* Get low word of pte entry */
402 415
@@ -485,12 +498,14 @@ tlb_44x_patch_hwater_D:
485 /* Make up the required permissions */ 498 /* Make up the required permissions */
486 li r13,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_HWEXEC 499 li r13,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_HWEXEC
487 500
488 rlwinm r12, r10, 13, 19, 29 /* Compute pgdir/pmd offset */ 501 /* Compute pgdir/pmd offset */
502 rlwinm r12, r10, PPC44x_PGD_OFF_SHIFT, PPC44x_PGD_OFF_MASK_BIT, 29
489 lwzx r11, r12, r11 /* Get pgd/pmd entry */ 503 lwzx r11, r12, r11 /* Get pgd/pmd entry */
490 rlwinm. r12, r11, 0, 0, 20 /* Extract pt base address */ 504 rlwinm. r12, r11, 0, 0, 20 /* Extract pt base address */
491 beq 2f /* Bail if no table */ 505 beq 2f /* Bail if no table */
492 506
493 rlwimi r12, r10, 23, 20, 28 /* Compute pte address */ 507 /* Compute pte address */
508 rlwimi r12, r10, PPC44x_PTE_ADD_SHIFT, PPC44x_PTE_ADD_MASK_BIT, 28
494 lwz r11, 0(r12) /* Get high word of pte entry */ 509 lwz r11, 0(r12) /* Get high word of pte entry */
495 lwz r12, 4(r12) /* Get low word of pte entry */ 510 lwz r12, 4(r12) /* Get low word of pte entry */
496 511
@@ -554,15 +569,16 @@ tlb_44x_patch_hwater_I:
554 */ 569 */
555finish_tlb_load: 570finish_tlb_load:
556 /* Combine RPN & ERPN an write WS 0 */ 571 /* Combine RPN & ERPN an write WS 0 */
557 rlwimi r11,r12,0,0,19 572 rlwimi r11,r12,0,0,31-PAGE_SHIFT
558 tlbwe r11,r13,PPC44x_TLB_XLAT 573 tlbwe r11,r13,PPC44x_TLB_XLAT
559 574
560 /* 575 /*
561 * Create WS1. This is the faulting address (EPN), 576 * Create WS1. This is the faulting address (EPN),
562 * page size, and valid flag. 577 * page size, and valid flag.
563 */ 578 */
564 li r11,PPC44x_TLB_VALID | PPC44x_TLB_4K 579 li r11,PPC44x_TLB_VALID | PPC44x_TLBE_SIZE
565 rlwimi r10,r11,0,20,31 /* Insert valid and page size*/ 580 /* Insert valid and page size */
581 rlwimi r10,r11,0,PPC44x_PTE_ADD_MASK_BIT,31
566 tlbwe r10,r13,PPC44x_TLB_PAGEID /* Write PAGEID */ 582 tlbwe r10,r13,PPC44x_TLB_PAGEID /* Write PAGEID */
567 583
568 /* And WS 2 */ 584 /* And WS 2 */
@@ -634,12 +650,12 @@ _GLOBAL(set_context)
634 * goes at the beginning of the data segment, which is page-aligned. 650 * goes at the beginning of the data segment, which is page-aligned.
635 */ 651 */
636 .data 652 .data
637 .align 12 653 .align PAGE_SHIFT
638 .globl sdata 654 .globl sdata
639sdata: 655sdata:
640 .globl empty_zero_page 656 .globl empty_zero_page
641empty_zero_page: 657empty_zero_page:
642 .space 4096 658 .space PAGE_SIZE
643 659
644/* 660/*
645 * To support >32-bit physical addresses, we use an 8KB pgdir. 661 * To support >32-bit physical addresses, we use an 8KB pgdir.
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 590304c24dad..11b549acc034 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -92,6 +92,7 @@ _ENTRY(_start);
92 * if needed 92 * if needed
93 */ 93 */
94 94
95_ENTRY(__early_start)
95/* 1. Find the index of the entry we're executing in */ 96/* 1. Find the index of the entry we're executing in */
96 bl invstr /* Find our address */ 97 bl invstr /* Find our address */
97invstr: mflr r6 /* Make it accessible */ 98invstr: mflr r6 /* Make it accessible */
@@ -235,36 +236,40 @@ skpinv: addi r6,r6,1 /* Increment */
235 tlbivax 0,r9 236 tlbivax 0,r9
236 TLBSYNC 237 TLBSYNC
237 238
239/* The mapping only needs to be cache-coherent on SMP */
240#ifdef CONFIG_SMP
241#define M_IF_SMP MAS2_M
242#else
243#define M_IF_SMP 0
244#endif
245
238/* 6. Setup KERNELBASE mapping in TLB1[0] */ 246/* 6. Setup KERNELBASE mapping in TLB1[0] */
239 lis r6,0x1000 /* Set MAS0(TLBSEL) = TLB1(1), ESEL = 0 */ 247 lis r6,0x1000 /* Set MAS0(TLBSEL) = TLB1(1), ESEL = 0 */
240 mtspr SPRN_MAS0,r6 248 mtspr SPRN_MAS0,r6
241 lis r6,(MAS1_VALID|MAS1_IPROT)@h 249 lis r6,(MAS1_VALID|MAS1_IPROT)@h
242 ori r6,r6,(MAS1_TSIZE(BOOKE_PAGESZ_64M))@l 250 ori r6,r6,(MAS1_TSIZE(BOOKE_PAGESZ_64M))@l
243 mtspr SPRN_MAS1,r6 251 mtspr SPRN_MAS1,r6
244 li r7,0 252 lis r6,MAS2_VAL(PAGE_OFFSET, BOOKE_PAGESZ_64M, M_IF_SMP)@h
245 lis r6,PAGE_OFFSET@h 253 ori r6,r6,MAS2_VAL(PAGE_OFFSET, BOOKE_PAGESZ_64M, M_IF_SMP)@l
246 ori r6,r6,PAGE_OFFSET@l
247 rlwimi r6,r7,0,20,31
248 mtspr SPRN_MAS2,r6 254 mtspr SPRN_MAS2,r6
249 mtspr SPRN_MAS3,r8 255 mtspr SPRN_MAS3,r8
250 tlbwe 256 tlbwe
251 257
252/* 7. Jump to KERNELBASE mapping */ 258/* 7. Jump to KERNELBASE mapping */
253 lis r6,KERNELBASE@h 259 lis r6,(KERNELBASE & ~0xfff)@h
254 ori r6,r6,KERNELBASE@l 260 ori r6,r6,(KERNELBASE & ~0xfff)@l
255 rlwimi r6,r7,0,20,31
256 lis r7,MSR_KERNEL@h 261 lis r7,MSR_KERNEL@h
257 ori r7,r7,MSR_KERNEL@l 262 ori r7,r7,MSR_KERNEL@l
258 bl 1f /* Find our address */ 263 bl 1f /* Find our address */
2591: mflr r9 2641: mflr r9
260 rlwimi r6,r9,0,20,31 265 rlwimi r6,r9,0,20,31
261 addi r6,r6,24 266 addi r6,r6,(2f - 1b)
262 mtspr SPRN_SRR0,r6 267 mtspr SPRN_SRR0,r6
263 mtspr SPRN_SRR1,r7 268 mtspr SPRN_SRR1,r7
264 rfi /* start execution out of TLB1[0] entry */ 269 rfi /* start execution out of TLB1[0] entry */
265 270
266/* 8. Clear out the temp mapping */ 271/* 8. Clear out the temp mapping */
267 lis r7,0x1000 /* Set MAS0(TLBSEL) = 1 */ 2722: lis r7,0x1000 /* Set MAS0(TLBSEL) = 1 */
268 rlwimi r7,r5,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r5) */ 273 rlwimi r7,r5,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r5) */
269 mtspr SPRN_MAS0,r7 274 mtspr SPRN_MAS0,r7
270 tlbre 275 tlbre
@@ -344,6 +349,15 @@ skpinv: addi r6,r6,1 /* Increment */
344 mtspr SPRN_DBSR,r2 349 mtspr SPRN_DBSR,r2
345#endif 350#endif
346 351
352#ifdef CONFIG_SMP
353 /* Check to see if we're the second processor, and jump
354 * to the secondary_start code if so
355 */
356 mfspr r24,SPRN_PIR
357 cmpwi r24,0
358 bne __secondary_start
359#endif
360
347 /* 361 /*
348 * This is where the main kernel code starts. 362 * This is where the main kernel code starts.
349 */ 363 */
@@ -685,12 +699,13 @@ interrupt_base:
685 /* SPE Floating Point Data */ 699 /* SPE Floating Point Data */
686#ifdef CONFIG_SPE 700#ifdef CONFIG_SPE
687 EXCEPTION(0x2030, SPEFloatingPointData, SPEFloatingPointException, EXC_XFER_EE); 701 EXCEPTION(0x2030, SPEFloatingPointData, SPEFloatingPointException, EXC_XFER_EE);
688#else
689 EXCEPTION(0x2040, SPEFloatingPointData, unknown_exception, EXC_XFER_EE)
690#endif /* CONFIG_SPE */
691 702
692 /* SPE Floating Point Round */ 703 /* SPE Floating Point Round */
704 EXCEPTION(0x2050, SPEFloatingPointRound, SPEFloatingPointRoundException, EXC_XFER_EE)
705#else
706 EXCEPTION(0x2040, SPEFloatingPointData, unknown_exception, EXC_XFER_EE)
693 EXCEPTION(0x2050, SPEFloatingPointRound, unknown_exception, EXC_XFER_EE) 707 EXCEPTION(0x2050, SPEFloatingPointRound, unknown_exception, EXC_XFER_EE)
708#endif /* CONFIG_SPE */
694 709
695 /* Performance Monitor */ 710 /* Performance Monitor */
696 EXCEPTION(0x2060, PerformanceMonitor, performance_monitor_exception, EXC_XFER_STD) 711 EXCEPTION(0x2060, PerformanceMonitor, performance_monitor_exception, EXC_XFER_STD)
@@ -735,6 +750,9 @@ finish_tlb_load:
735#else 750#else
736 rlwimi r12, r11, 26, 27, 31 /* extract WIMGE from pte */ 751 rlwimi r12, r11, 26, 27, 31 /* extract WIMGE from pte */
737#endif 752#endif
753#ifdef CONFIG_SMP
754 ori r12, r12, MAS2_M
755#endif
738 mtspr SPRN_MAS2, r12 756 mtspr SPRN_MAS2, r12
739 757
740 li r10, (_PAGE_HWEXEC | _PAGE_PRESENT) 758 li r10, (_PAGE_HWEXEC | _PAGE_PRESENT)
@@ -746,15 +764,15 @@ finish_tlb_load:
746 iseleq r12, r12, r10 764 iseleq r12, r12, r10
747 765
748#ifdef CONFIG_PTE_64BIT 766#ifdef CONFIG_PTE_64BIT
7492: rlwimi r12, r13, 24, 0, 7 /* grab RPN[32:39] */ 767 rlwimi r12, r13, 24, 0, 7 /* grab RPN[32:39] */
750 rlwimi r12, r11, 24, 8, 19 /* grab RPN[40:51] */ 768 rlwimi r12, r11, 24, 8, 19 /* grab RPN[40:51] */
751 mtspr SPRN_MAS3, r12 769 mtspr SPRN_MAS3, r12
752BEGIN_FTR_SECTION 770BEGIN_MMU_FTR_SECTION
753 srwi r10, r13, 8 /* grab RPN[8:31] */ 771 srwi r10, r13, 8 /* grab RPN[8:31] */
754 mtspr SPRN_MAS7, r10 772 mtspr SPRN_MAS7, r10
755END_FTR_SECTION_IFSET(CPU_FTR_BIG_PHYS) 773END_MMU_FTR_SECTION_IFSET(MMU_FTR_BIG_PHYS)
756#else 774#else
7572: rlwimi r11, r12, 0, 20, 31 /* Extract RPN from PTE and merge with perms */ 775 rlwimi r11, r12, 0, 20, 31 /* Extract RPN from PTE and merge with perms */
758 mtspr SPRN_MAS3, r11 776 mtspr SPRN_MAS3, r11
759#endif 777#endif
760#ifdef CONFIG_E200 778#ifdef CONFIG_E200
@@ -1037,6 +1055,63 @@ _GLOBAL(flush_dcache_L1)
1037 1055
1038 blr 1056 blr
1039 1057
1058#ifdef CONFIG_SMP
1059/* When we get here, r24 needs to hold the CPU # */
1060 .globl __secondary_start
1061__secondary_start:
1062 lis r3,__secondary_hold_acknowledge@h
1063 ori r3,r3,__secondary_hold_acknowledge@l
1064 stw r24,0(r3)
1065
1066 li r3,0
1067 mr r4,r24 /* Why? */
1068 bl call_setup_cpu
1069
1070 lis r3,tlbcam_index@ha
1071 lwz r3,tlbcam_index@l(r3)
1072 mtctr r3
1073 li r26,0 /* r26 safe? */
1074
1075 /* Load each CAM entry */
10761: mr r3,r26
1077 bl loadcam_entry
1078 addi r26,r26,1
1079 bdnz 1b
1080
1081 /* get current_thread_info and current */
1082 lis r1,secondary_ti@ha
1083 lwz r1,secondary_ti@l(r1)
1084 lwz r2,TI_TASK(r1)
1085
1086 /* stack */
1087 addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
1088 li r0,0
1089 stw r0,0(r1)
1090
1091 /* ptr to current thread */
1092 addi r4,r2,THREAD /* address of our thread_struct */
1093 mtspr SPRN_SPRG3,r4
1094
1095 /* Setup the defaults for TLB entries */
1096 li r4,(MAS4_TSIZED(BOOKE_PAGESZ_4K))@l
1097 mtspr SPRN_MAS4,r4
1098
1099 /* Jump to start_secondary */
1100 lis r4,MSR_KERNEL@h
1101 ori r4,r4,MSR_KERNEL@l
1102 lis r3,start_secondary@h
1103 ori r3,r3,start_secondary@l
1104 mtspr SPRN_SRR0,r3
1105 mtspr SPRN_SRR1,r4
1106 sync
1107 rfi
1108 sync
1109
1110 .globl __secondary_hold_acknowledge
1111__secondary_hold_acknowledge:
1112 .long -1
1113#endif
1114
1040/* 1115/*
1041 * We put a few things here that have to be page-aligned. This stuff 1116 * We put a few things here that have to be page-aligned. This stuff
1042 * goes at the beginning of the data segment, which is page-aligned. 1117 * goes at the beginning of the data segment, which is page-aligned.
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 64299d28f364..6e3f62493659 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -47,7 +47,7 @@
47#include <asm/abs_addr.h> 47#include <asm/abs_addr.h>
48 48
49static struct device ibmebus_bus_device = { /* fake "parent" device */ 49static struct device ibmebus_bus_device = { /* fake "parent" device */
50 .bus_id = "ibmebus", 50 .init_name = "ibmebus",
51}; 51};
52 52
53struct bus_type ibmebus_bus_type; 53struct bus_type ibmebus_bus_type;
@@ -231,6 +231,7 @@ void ibmebus_free_irq(u32 ist, void *dev_id)
231 unsigned int irq = irq_find_mapping(NULL, ist); 231 unsigned int irq = irq_find_mapping(NULL, ist);
232 232
233 free_irq(irq, dev_id); 233 free_irq(irq, dev_id);
234 irq_dispose_mapping(irq);
234} 235}
235EXPORT_SYMBOL(ibmebus_free_irq); 236EXPORT_SYMBOL(ibmebus_free_irq);
236 237
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index 31982d05d81a..88d9c1d5e5fb 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -69,10 +69,15 @@ void cpu_idle(void)
69 smp_mb(); 69 smp_mb();
70 local_irq_disable(); 70 local_irq_disable();
71 71
72 /* Don't trace irqs off for idle */
73 stop_critical_timings();
74
72 /* check again after disabling irqs */ 75 /* check again after disabling irqs */
73 if (!need_resched() && !cpu_should_die()) 76 if (!need_resched() && !cpu_should_die())
74 ppc_md.power_save(); 77 ppc_md.power_save();
75 78
79 start_critical_timings();
80
76 local_irq_enable(); 81 local_irq_enable();
77 set_thread_flag(TIF_POLLING_NRFLAG); 82 set_thread_flag(TIF_POLLING_NRFLAG);
78 83
diff --git a/arch/powerpc/kernel/init_task.c b/arch/powerpc/kernel/init_task.c
index 4c85b8d56478..688b329800bd 100644
--- a/arch/powerpc/kernel/init_task.c
+++ b/arch/powerpc/kernel/init_task.c
@@ -7,7 +7,6 @@
7#include <linux/mqueue.h> 7#include <linux/mqueue.h>
8#include <asm/uaccess.h> 8#include <asm/uaccess.h>
9 9
10static struct fs_struct init_fs = INIT_FS;
11static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 10static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
12static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 11static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
13struct mm_struct init_mm = INIT_MM(init_mm); 12struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index ac222d0ab12e..23b8b5e36f98 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -237,7 +237,7 @@ void fixup_irqs(cpumask_t map)
237 mask = map; 237 mask = map;
238 } 238 }
239 if (irq_desc[irq].chip->set_affinity) 239 if (irq_desc[irq].chip->set_affinity)
240 irq_desc[irq].chip->set_affinity(irq, mask); 240 irq_desc[irq].chip->set_affinity(irq, &mask);
241 else if (irq_desc[irq].action && !(warned++)) 241 else if (irq_desc[irq].action && !(warned++))
242 printk("Cannot set affinity for irq %i\n", irq); 242 printk("Cannot set affinity for irq %i\n", irq);
243 } 243 }
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index de79915452c8..989edcdf0297 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -96,9 +96,10 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
96 96
97void __kprobes arch_remove_kprobe(struct kprobe *p) 97void __kprobes arch_remove_kprobe(struct kprobe *p)
98{ 98{
99 mutex_lock(&kprobe_mutex); 99 if (p->ainsn.insn) {
100 free_insn_slot(p->ainsn.insn, 0); 100 free_insn_slot(p->ainsn.insn, 0);
101 mutex_unlock(&kprobe_mutex); 101 p->ainsn.insn = NULL;
102 }
102} 103}
103 104
104static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs) 105static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index ac2a21f45c75..b3abebb7ee64 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -13,13 +13,17 @@
13#include <linux/reboot.h> 13#include <linux/reboot.h>
14#include <linux/threads.h> 14#include <linux/threads.h>
15#include <linux/lmb.h> 15#include <linux/lmb.h>
16#include <linux/of.h>
16#include <asm/machdep.h> 17#include <asm/machdep.h>
17#include <asm/prom.h> 18#include <asm/prom.h>
19#include <asm/sections.h>
18 20
19void machine_crash_shutdown(struct pt_regs *regs) 21void machine_crash_shutdown(struct pt_regs *regs)
20{ 22{
21 if (ppc_md.machine_crash_shutdown) 23 if (ppc_md.machine_crash_shutdown)
22 ppc_md.machine_crash_shutdown(regs); 24 ppc_md.machine_crash_shutdown(regs);
25 else
26 default_machine_crash_shutdown(regs);
23} 27}
24 28
25/* 29/*
@@ -31,11 +35,8 @@ int machine_kexec_prepare(struct kimage *image)
31{ 35{
32 if (ppc_md.machine_kexec_prepare) 36 if (ppc_md.machine_kexec_prepare)
33 return ppc_md.machine_kexec_prepare(image); 37 return ppc_md.machine_kexec_prepare(image);
34 /* 38 else
35 * Fail if platform doesn't provide its own machine_kexec_prepare 39 return default_machine_kexec_prepare(image);
36 * implementation.
37 */
38 return -ENOSYS;
39} 40}
40 41
41void machine_kexec_cleanup(struct kimage *image) 42void machine_kexec_cleanup(struct kimage *image)
@@ -52,13 +53,11 @@ void machine_kexec(struct kimage *image)
52{ 53{
53 if (ppc_md.machine_kexec) 54 if (ppc_md.machine_kexec)
54 ppc_md.machine_kexec(image); 55 ppc_md.machine_kexec(image);
55 else { 56 else
56 /* 57 default_machine_kexec(image);
57 * Fall back to normal restart if platform doesn't provide 58
58 * its own kexec function, and user insist to kexec... 59 /* Fall back to normal restart if we're still alive. */
59 */ 60 machine_restart(NULL);
60 machine_restart(NULL);
61 }
62 for(;;); 61 for(;;);
63} 62}
64 63
@@ -118,3 +117,71 @@ int overlaps_crashkernel(unsigned long start, unsigned long size)
118{ 117{
119 return (start + size) > crashk_res.start && start <= crashk_res.end; 118 return (start + size) > crashk_res.start && start <= crashk_res.end;
120} 119}
120
121/* Values we need to export to the second kernel via the device tree. */
122static unsigned long kernel_end;
123static unsigned long crashk_size;
124
125static struct property kernel_end_prop = {
126 .name = "linux,kernel-end",
127 .length = sizeof(unsigned long),
128 .value = &kernel_end,
129};
130
131static struct property crashk_base_prop = {
132 .name = "linux,crashkernel-base",
133 .length = sizeof(unsigned long),
134 .value = &crashk_res.start,
135};
136
137static struct property crashk_size_prop = {
138 .name = "linux,crashkernel-size",
139 .length = sizeof(unsigned long),
140 .value = &crashk_size,
141};
142
143static void __init export_crashk_values(struct device_node *node)
144{
145 struct property *prop;
146
147 /* There might be existing crash kernel properties, but we can't
148 * be sure what's in them, so remove them. */
149 prop = of_find_property(node, "linux,crashkernel-base", NULL);
150 if (prop)
151 prom_remove_property(node, prop);
152
153 prop = of_find_property(node, "linux,crashkernel-size", NULL);
154 if (prop)
155 prom_remove_property(node, prop);
156
157 if (crashk_res.start != 0) {
158 prom_add_property(node, &crashk_base_prop);
159 crashk_size = crashk_res.end - crashk_res.start + 1;
160 prom_add_property(node, &crashk_size_prop);
161 }
162}
163
164static int __init kexec_setup(void)
165{
166 struct device_node *node;
167 struct property *prop;
168
169 node = of_find_node_by_path("/chosen");
170 if (!node)
171 return -ENOENT;
172
173 /* remove any stale properties so ours can be found */
174 prop = of_find_property(node, kernel_end_prop.name, NULL);
175 if (prop)
176 prom_remove_property(node, prop);
177
178 /* information needed by userspace when using default_machine_kexec */
179 kernel_end = __pa(_end);
180 prom_add_property(node, &kernel_end_prop);
181
182 export_crashk_values(node);
183
184 of_node_put(node);
185 return 0;
186}
187late_initcall(kexec_setup);
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index 3c4ca046e854..49e705fcee6d 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -289,7 +289,7 @@ void default_machine_kexec(struct kimage *image)
289} 289}
290 290
291/* Values we need to export to the second kernel via the device tree. */ 291/* Values we need to export to the second kernel via the device tree. */
292static unsigned long htab_base, kernel_end; 292static unsigned long htab_base;
293 293
294static struct property htab_base_prop = { 294static struct property htab_base_prop = {
295 .name = "linux,htab-base", 295 .name = "linux,htab-base",
@@ -303,25 +303,20 @@ static struct property htab_size_prop = {
303 .value = &htab_size_bytes, 303 .value = &htab_size_bytes,
304}; 304};
305 305
306static struct property kernel_end_prop = { 306static int __init export_htab_values(void)
307 .name = "linux,kernel-end",
308 .length = sizeof(unsigned long),
309 .value = &kernel_end,
310};
311
312static void __init export_htab_values(void)
313{ 307{
314 struct device_node *node; 308 struct device_node *node;
315 struct property *prop; 309 struct property *prop;
316 310
311 /* On machines with no htab htab_address is NULL */
312 if (!htab_address)
313 return -ENODEV;
314
317 node = of_find_node_by_path("/chosen"); 315 node = of_find_node_by_path("/chosen");
318 if (!node) 316 if (!node)
319 return; 317 return -ENODEV;
320 318
321 /* remove any stale propertys so ours can be found */ 319 /* remove any stale propertys so ours can be found */
322 prop = of_find_property(node, kernel_end_prop.name, NULL);
323 if (prop)
324 prom_remove_property(node, prop);
325 prop = of_find_property(node, htab_base_prop.name, NULL); 320 prop = of_find_property(node, htab_base_prop.name, NULL);
326 if (prop) 321 if (prop)
327 prom_remove_property(node, prop); 322 prom_remove_property(node, prop);
@@ -329,68 +324,11 @@ static void __init export_htab_values(void)
329 if (prop) 324 if (prop)
330 prom_remove_property(node, prop); 325 prom_remove_property(node, prop);
331 326
332 /* information needed by userspace when using default_machine_kexec */
333 kernel_end = __pa(_end);
334 prom_add_property(node, &kernel_end_prop);
335
336 /* On machines with no htab htab_address is NULL */
337 if (NULL == htab_address)
338 goto out;
339
340 htab_base = __pa(htab_address); 327 htab_base = __pa(htab_address);
341 prom_add_property(node, &htab_base_prop); 328 prom_add_property(node, &htab_base_prop);
342 prom_add_property(node, &htab_size_prop); 329 prom_add_property(node, &htab_size_prop);
343 330
344 out:
345 of_node_put(node);
346}
347
348static struct property crashk_base_prop = {
349 .name = "linux,crashkernel-base",
350 .length = sizeof(unsigned long),
351 .value = &crashk_res.start,
352};
353
354static unsigned long crashk_size;
355
356static struct property crashk_size_prop = {
357 .name = "linux,crashkernel-size",
358 .length = sizeof(unsigned long),
359 .value = &crashk_size,
360};
361
362static void __init export_crashk_values(void)
363{
364 struct device_node *node;
365 struct property *prop;
366
367 node = of_find_node_by_path("/chosen");
368 if (!node)
369 return;
370
371 /* There might be existing crash kernel properties, but we can't
372 * be sure what's in them, so remove them. */
373 prop = of_find_property(node, "linux,crashkernel-base", NULL);
374 if (prop)
375 prom_remove_property(node, prop);
376
377 prop = of_find_property(node, "linux,crashkernel-size", NULL);
378 if (prop)
379 prom_remove_property(node, prop);
380
381 if (crashk_res.start != 0) {
382 prom_add_property(node, &crashk_base_prop);
383 crashk_size = crashk_res.end - crashk_res.start + 1;
384 prom_add_property(node, &crashk_size_prop);
385 }
386
387 of_node_put(node); 331 of_node_put(node);
388}
389
390static int __init kexec_setup(void)
391{
392 export_htab_values();
393 export_crashk_values();
394 return 0; 332 return 0;
395} 333}
396__initcall(kexec_setup); 334late_initcall(export_htab_values);
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 5c33bc14bd9f..15f28e0de78d 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -29,6 +29,7 @@
29#include <asm/asm-offsets.h> 29#include <asm/asm-offsets.h>
30#include <asm/processor.h> 30#include <asm/processor.h>
31#include <asm/kexec.h> 31#include <asm/kexec.h>
32#include <asm/bug.h>
32 33
33 .text 34 .text
34 35
@@ -271,231 +272,6 @@ _GLOBAL(real_writeb)
271 272
272#endif /* CONFIG_40x */ 273#endif /* CONFIG_40x */
273 274
274/*
275 * Flush MMU TLB
276 */
277#ifndef CONFIG_FSL_BOOKE
278_GLOBAL(_tlbil_all)
279_GLOBAL(_tlbil_pid)
280#endif
281_GLOBAL(_tlbia)
282#if defined(CONFIG_40x)
283 sync /* Flush to memory before changing mapping */
284 tlbia
285 isync /* Flush shadow TLB */
286#elif defined(CONFIG_44x)
287 li r3,0
288 sync
289
290 /* Load high watermark */
291 lis r4,tlb_44x_hwater@ha
292 lwz r5,tlb_44x_hwater@l(r4)
293
2941: tlbwe r3,r3,PPC44x_TLB_PAGEID
295 addi r3,r3,1
296 cmpw 0,r3,r5
297 ble 1b
298
299 isync
300#elif defined(CONFIG_FSL_BOOKE)
301 /* Invalidate all entries in TLB0 */
302 li r3, 0x04
303 tlbivax 0,3
304 /* Invalidate all entries in TLB1 */
305 li r3, 0x0c
306 tlbivax 0,3
307 msync
308#ifdef CONFIG_SMP
309 tlbsync
310#endif /* CONFIG_SMP */
311#else /* !(CONFIG_40x || CONFIG_44x || CONFIG_FSL_BOOKE) */
312#if defined(CONFIG_SMP)
313 rlwinm r8,r1,0,0,(31-THREAD_SHIFT)
314 lwz r8,TI_CPU(r8)
315 oris r8,r8,10
316 mfmsr r10
317 SYNC
318 rlwinm r0,r10,0,17,15 /* clear bit 16 (MSR_EE) */
319 rlwinm r0,r0,0,28,26 /* clear DR */
320 mtmsr r0
321 SYNC_601
322 isync
323 lis r9,mmu_hash_lock@h
324 ori r9,r9,mmu_hash_lock@l
325 tophys(r9,r9)
32610: lwarx r7,0,r9
327 cmpwi 0,r7,0
328 bne- 10b
329 stwcx. r8,0,r9
330 bne- 10b
331 sync
332 tlbia
333 sync
334 TLBSYNC
335 li r0,0
336 stw r0,0(r9) /* clear mmu_hash_lock */
337 mtmsr r10
338 SYNC_601
339 isync
340#else /* CONFIG_SMP */
341 sync
342 tlbia
343 sync
344#endif /* CONFIG_SMP */
345#endif /* ! defined(CONFIG_40x) */
346 blr
347
348/*
349 * Flush MMU TLB for a particular address
350 */
351#ifndef CONFIG_FSL_BOOKE
352_GLOBAL(_tlbil_va)
353#endif
354_GLOBAL(_tlbie)
355#if defined(CONFIG_40x)
356 /* We run the search with interrupts disabled because we have to change
357 * the PID and I don't want to preempt when that happens.
358 */
359 mfmsr r5
360 mfspr r6,SPRN_PID
361 wrteei 0
362 mtspr SPRN_PID,r4
363 tlbsx. r3, 0, r3
364 mtspr SPRN_PID,r6
365 wrtee r5
366 bne 10f
367 sync
368 /* There are only 64 TLB entries, so r3 < 64, which means bit 25 is clear.
369 * Since 25 is the V bit in the TLB_TAG, loading this value will invalidate
370 * the TLB entry. */
371 tlbwe r3, r3, TLB_TAG
372 isync
37310:
374
375#elif defined(CONFIG_44x)
376 mfspr r5,SPRN_MMUCR
377 rlwimi r5,r4,0,24,31 /* Set TID */
378
379 /* We have to run the search with interrupts disabled, even critical
380 * and debug interrupts (in fact the only critical exceptions we have
381 * are debug and machine check). Otherwise an interrupt which causes
382 * a TLB miss can clobber the MMUCR between the mtspr and the tlbsx. */
383 mfmsr r4
384 lis r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@ha
385 addi r6,r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@l
386 andc r6,r4,r6
387 mtmsr r6
388 mtspr SPRN_MMUCR,r5
389 tlbsx. r3, 0, r3
390 mtmsr r4
391 bne 10f
392 sync
393 /* There are only 64 TLB entries, so r3 < 64,
394 * which means bit 22, is clear. Since 22 is
395 * the V bit in the TLB_PAGEID, loading this
396 * value will invalidate the TLB entry.
397 */
398 tlbwe r3, r3, PPC44x_TLB_PAGEID
399 isync
40010:
401#elif defined(CONFIG_FSL_BOOKE)
402 rlwinm r4, r3, 0, 0, 19
403 ori r5, r4, 0x08 /* TLBSEL = 1 */
404 tlbivax 0, r4
405 tlbivax 0, r5
406 msync
407#if defined(CONFIG_SMP)
408 tlbsync
409#endif /* CONFIG_SMP */
410#else /* !(CONFIG_40x || CONFIG_44x || CONFIG_FSL_BOOKE) */
411#if defined(CONFIG_SMP)
412 rlwinm r8,r1,0,0,(31-THREAD_SHIFT)
413 lwz r8,TI_CPU(r8)
414 oris r8,r8,11
415 mfmsr r10
416 SYNC
417 rlwinm r0,r10,0,17,15 /* clear bit 16 (MSR_EE) */
418 rlwinm r0,r0,0,28,26 /* clear DR */
419 mtmsr r0
420 SYNC_601
421 isync
422 lis r9,mmu_hash_lock@h
423 ori r9,r9,mmu_hash_lock@l
424 tophys(r9,r9)
42510: lwarx r7,0,r9
426 cmpwi 0,r7,0
427 bne- 10b
428 stwcx. r8,0,r9
429 bne- 10b
430 eieio
431 tlbie r3
432 sync
433 TLBSYNC
434 li r0,0
435 stw r0,0(r9) /* clear mmu_hash_lock */
436 mtmsr r10
437 SYNC_601
438 isync
439#else /* CONFIG_SMP */
440 tlbie r3
441 sync
442#endif /* CONFIG_SMP */
443#endif /* ! CONFIG_40x */
444 blr
445
446#if defined(CONFIG_FSL_BOOKE)
447/*
448 * Flush MMU TLB, but only on the local processor (no broadcast)
449 */
450_GLOBAL(_tlbil_all)
451#define MMUCSR0_TLBFI (MMUCSR0_TLB0FI | MMUCSR0_TLB1FI | \
452 MMUCSR0_TLB2FI | MMUCSR0_TLB3FI)
453 li r3,(MMUCSR0_TLBFI)@l
454 mtspr SPRN_MMUCSR0, r3
4551:
456 mfspr r3,SPRN_MMUCSR0
457 andi. r3,r3,MMUCSR0_TLBFI@l
458 bne 1b
459 blr
460
461/*
462 * Flush MMU TLB for a particular process id, but only on the local processor
463 * (no broadcast)
464 */
465_GLOBAL(_tlbil_pid)
466/* we currently do an invalidate all since we don't have per pid invalidate */
467 li r3,(MMUCSR0_TLBFI)@l
468 mtspr SPRN_MMUCSR0, r3
4691:
470 mfspr r3,SPRN_MMUCSR0
471 andi. r3,r3,MMUCSR0_TLBFI@l
472 bne 1b
473 msync
474 isync
475 blr
476
477/*
478 * Flush MMU TLB for a particular address, but only on the local processor
479 * (no broadcast)
480 */
481_GLOBAL(_tlbil_va)
482 mfmsr r10
483 wrteei 0
484 slwi r4,r4,16
485 mtspr SPRN_MAS6,r4 /* assume AS=0 for now */
486 tlbsx 0,r3
487 mfspr r4,SPRN_MAS1 /* check valid */
488 andis. r3,r4,MAS1_VALID@h
489 beq 1f
490 rlwinm r4,r4,0,1,31
491 mtspr SPRN_MAS1,r4
492 tlbwe
493 msync
494 isync
4951: wrtee r10
496 blr
497#endif /* CONFIG_FSL_BOOKE */
498
499 275
500/* 276/*
501 * Flush instruction cache. 277 * Flush instruction cache.
@@ -650,8 +426,8 @@ _GLOBAL(__flush_dcache_icache)
650BEGIN_FTR_SECTION 426BEGIN_FTR_SECTION
651 blr 427 blr
652END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE) 428END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
653 rlwinm r3,r3,0,0,19 /* Get page base address */ 429 rlwinm r3,r3,0,0,31-PAGE_SHIFT /* Get page base address */
654 li r4,4096/L1_CACHE_BYTES /* Number of lines in a page */ 430 li r4,PAGE_SIZE/L1_CACHE_BYTES /* Number of lines in a page */
655 mtctr r4 431 mtctr r4
656 mr r6,r3 432 mr r6,r3
6570: dcbst 0,r3 /* Write line to ram */ 4330: dcbst 0,r3 /* Write line to ram */
@@ -691,8 +467,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
691 rlwinm r0,r10,0,28,26 /* clear DR */ 467 rlwinm r0,r10,0,28,26 /* clear DR */
692 mtmsr r0 468 mtmsr r0
693 isync 469 isync
694 rlwinm r3,r3,0,0,19 /* Get page base address */ 470 rlwinm r3,r3,0,0,31-PAGE_SHIFT /* Get page base address */
695 li r4,4096/L1_CACHE_BYTES /* Number of lines in a page */ 471 li r4,PAGE_SIZE/L1_CACHE_BYTES /* Number of lines in a page */
696 mtctr r4 472 mtctr r4
697 mr r6,r3 473 mr r6,r3
6980: dcbst 0,r3 /* Write line to ram */ 4740: dcbst 0,r3 /* Write line to ram */
@@ -716,7 +492,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
716 * void clear_pages(void *page, int order) ; 492 * void clear_pages(void *page, int order) ;
717 */ 493 */
718_GLOBAL(clear_pages) 494_GLOBAL(clear_pages)
719 li r0,4096/L1_CACHE_BYTES 495 li r0,PAGE_SIZE/L1_CACHE_BYTES
720 slw r0,r0,r4 496 slw r0,r0,r4
721 mtctr r0 497 mtctr r0
722#ifdef CONFIG_8xx 498#ifdef CONFIG_8xx
@@ -774,7 +550,7 @@ _GLOBAL(copy_page)
774 dcbt r5,r4 550 dcbt r5,r4
775 li r11,L1_CACHE_BYTES+4 551 li r11,L1_CACHE_BYTES+4
776#endif /* MAX_COPY_PREFETCH */ 552#endif /* MAX_COPY_PREFETCH */
777 li r0,4096/L1_CACHE_BYTES - MAX_COPY_PREFETCH 553 li r0,PAGE_SIZE/L1_CACHE_BYTES - MAX_COPY_PREFETCH
778 crclr 4*cr0+eq 554 crclr 4*cr0+eq
7792: 5552:
780 mtctr r0 556 mtctr r0
diff --git a/arch/powerpc/kernel/module.c b/arch/powerpc/kernel/module.c
index 7ff292475269..43e7e3a7f130 100644
--- a/arch/powerpc/kernel/module.c
+++ b/arch/powerpc/kernel/module.c
@@ -78,6 +78,12 @@ int module_finalize(const Elf_Ehdr *hdr,
78 (void *)sect->sh_addr, 78 (void *)sect->sh_addr,
79 (void *)sect->sh_addr + sect->sh_size); 79 (void *)sect->sh_addr + sect->sh_size);
80 80
81 sect = find_section(hdr, sechdrs, "__mmu_ftr_fixup");
82 if (sect != NULL)
83 do_feature_fixups(cur_cpu_spec->mmu_features,
84 (void *)sect->sh_addr,
85 (void *)sect->sh_addr + sect->sh_size);
86
81#ifdef CONFIG_PPC64 87#ifdef CONFIG_PPC64
82 sect = find_section(hdr, sechdrs, "__fw_ftr_fixup"); 88 sect = find_section(hdr, sechdrs, "__fw_ftr_fixup");
83 if (sect != NULL) 89 if (sect != NULL)
diff --git a/arch/powerpc/kernel/module_32.c b/arch/powerpc/kernel/module_32.c
index 2df91a03462a..f832773fc28e 100644
--- a/arch/powerpc/kernel/module_32.c
+++ b/arch/powerpc/kernel/module_32.c
@@ -22,6 +22,7 @@
22#include <linux/fs.h> 22#include <linux/fs.h>
23#include <linux/string.h> 23#include <linux/string.h>
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/ftrace.h>
25#include <linux/cache.h> 26#include <linux/cache.h>
26#include <linux/bug.h> 27#include <linux/bug.h>
27#include <linux/sort.h> 28#include <linux/sort.h>
@@ -53,6 +54,9 @@ static unsigned int count_relocs(const Elf32_Rela *rela, unsigned int num)
53 r_addend = rela[i].r_addend; 54 r_addend = rela[i].r_addend;
54 } 55 }
55 56
57#ifdef CONFIG_DYNAMIC_FTRACE
58 _count_relocs++; /* add one for ftrace_caller */
59#endif
56 return _count_relocs; 60 return _count_relocs;
57} 61}
58 62
@@ -306,5 +310,11 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
306 return -ENOEXEC; 310 return -ENOEXEC;
307 } 311 }
308 } 312 }
313#ifdef CONFIG_DYNAMIC_FTRACE
314 module->arch.tramp =
315 do_plt_call(module->module_core,
316 (unsigned long)ftrace_caller,
317 sechdrs, module);
318#endif
309 return 0; 319 return 0;
310} 320}
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
index 1af2377e4992..8992b031a7b6 100644
--- a/arch/powerpc/kernel/module_64.c
+++ b/arch/powerpc/kernel/module_64.c
@@ -20,6 +20,7 @@
20#include <linux/moduleloader.h> 20#include <linux/moduleloader.h>
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/vmalloc.h> 22#include <linux/vmalloc.h>
23#include <linux/ftrace.h>
23#include <linux/bug.h> 24#include <linux/bug.h>
24#include <asm/module.h> 25#include <asm/module.h>
25#include <asm/firmware.h> 26#include <asm/firmware.h>
@@ -163,6 +164,11 @@ static unsigned long get_stubs_size(const Elf64_Ehdr *hdr,
163 } 164 }
164 } 165 }
165 166
167#ifdef CONFIG_DYNAMIC_FTRACE
168 /* make the trampoline to the ftrace_caller */
169 relocs++;
170#endif
171
166 DEBUGP("Looks like a total of %lu stubs, max\n", relocs); 172 DEBUGP("Looks like a total of %lu stubs, max\n", relocs);
167 return relocs * sizeof(struct ppc64_stub_entry); 173 return relocs * sizeof(struct ppc64_stub_entry);
168} 174}
@@ -441,5 +447,12 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
441 } 447 }
442 } 448 }
443 449
450#ifdef CONFIG_DYNAMIC_FTRACE
451 me->arch.toc = my_r2(sechdrs, me);
452 me->arch.tramp = stub_for_addr(sechdrs,
453 (unsigned long)ftrace_caller,
454 me);
455#endif
456
444 return 0; 457 return 0;
445} 458}
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
index f3c9cae01dd5..fa983a59c4ce 100644
--- a/arch/powerpc/kernel/of_device.c
+++ b/arch/powerpc/kernel/of_device.c
@@ -14,7 +14,6 @@ static void of_device_make_bus_id(struct of_device *dev)
14{ 14{
15 static atomic_t bus_no_reg_magic; 15 static atomic_t bus_no_reg_magic;
16 struct device_node *node = dev->node; 16 struct device_node *node = dev->node;
17 char *name = dev->dev.bus_id;
18 const u32 *reg; 17 const u32 *reg;
19 u64 addr; 18 u64 addr;
20 int magic; 19 int magic;
@@ -27,14 +26,12 @@ static void of_device_make_bus_id(struct of_device *dev)
27 reg = of_get_property(node, "dcr-reg", NULL); 26 reg = of_get_property(node, "dcr-reg", NULL);
28 if (reg) { 27 if (reg) {
29#ifdef CONFIG_PPC_DCR_NATIVE 28#ifdef CONFIG_PPC_DCR_NATIVE
30 snprintf(name, BUS_ID_SIZE, "d%x.%s", 29 dev_set_name(&dev->dev, "d%x.%s", *reg, node->name);
31 *reg, node->name);
32#else /* CONFIG_PPC_DCR_NATIVE */ 30#else /* CONFIG_PPC_DCR_NATIVE */
33 addr = of_translate_dcr_address(node, *reg, NULL); 31 addr = of_translate_dcr_address(node, *reg, NULL);
34 if (addr != OF_BAD_ADDR) { 32 if (addr != OF_BAD_ADDR) {
35 snprintf(name, BUS_ID_SIZE, 33 dev_set_name(&dev->dev, "D%llx.%s",
36 "D%llx.%s", (unsigned long long)addr, 34 (unsigned long long)addr, node->name);
37 node->name);
38 return; 35 return;
39 } 36 }
40#endif /* !CONFIG_PPC_DCR_NATIVE */ 37#endif /* !CONFIG_PPC_DCR_NATIVE */
@@ -48,9 +45,8 @@ static void of_device_make_bus_id(struct of_device *dev)
48 if (reg) { 45 if (reg) {
49 addr = of_translate_address(node, reg); 46 addr = of_translate_address(node, reg);
50 if (addr != OF_BAD_ADDR) { 47 if (addr != OF_BAD_ADDR) {
51 snprintf(name, BUS_ID_SIZE, 48 dev_set_name(&dev->dev, "%llx.%s",
52 "%llx.%s", (unsigned long long)addr, 49 (unsigned long long)addr, node->name);
53 node->name);
54 return; 50 return;
55 } 51 }
56 } 52 }
@@ -60,7 +56,7 @@ static void of_device_make_bus_id(struct of_device *dev)
60 * counter (and pray...) 56 * counter (and pray...)
61 */ 57 */
62 magic = atomic_add_return(1, &bus_no_reg_magic); 58 magic = atomic_add_return(1, &bus_no_reg_magic);
63 snprintf(name, BUS_ID_SIZE, "%s.%d", node->name, magic - 1); 59 dev_set_name(&dev->dev, "%s.%d", node->name, magic - 1);
64} 60}
65 61
66struct of_device *of_device_alloc(struct device_node *np, 62struct of_device *of_device_alloc(struct device_node *np,
@@ -80,7 +76,7 @@ struct of_device *of_device_alloc(struct device_node *np,
80 dev->dev.archdata.of_node = np; 76 dev->dev.archdata.of_node = np;
81 77
82 if (bus_id) 78 if (bus_id)
83 strlcpy(dev->dev.bus_id, bus_id, BUS_ID_SIZE); 79 dev_set_name(&dev->dev, bus_id);
84 else 80 else
85 of_device_make_bus_id(dev); 81 of_device_make_bus_id(dev);
86 82
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 48a347133f41..c744b327bcab 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -37,6 +37,7 @@ struct lppaca lppaca[] = {
37 .end_of_quantum = 0xfffffffffffffffful, 37 .end_of_quantum = 0xfffffffffffffffful,
38 .slb_count = 64, 38 .slb_count = 64,
39 .vmxregs_in_use = 0, 39 .vmxregs_in_use = 0,
40 .page_ins = 0,
40 }, 41 },
41}; 42};
42 43
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index f36936d9fda3..2538030954d8 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -37,13 +37,7 @@
37#include <asm/machdep.h> 37#include <asm/machdep.h>
38#include <asm/ppc-pci.h> 38#include <asm/ppc-pci.h>
39#include <asm/firmware.h> 39#include <asm/firmware.h>
40 40#include <asm/eeh.h>
41#ifdef DEBUG
42#include <asm/udbg.h>
43#define DBG(fmt...) printk(fmt)
44#else
45#define DBG(fmt...)
46#endif
47 41
48static DEFINE_SPINLOCK(hose_spinlock); 42static DEFINE_SPINLOCK(hose_spinlock);
49 43
@@ -53,8 +47,9 @@ static int global_phb_number; /* Global phb counter */
53/* ISA Memory physical address */ 47/* ISA Memory physical address */
54resource_size_t isa_mem_base; 48resource_size_t isa_mem_base;
55 49
56/* Default PCI flags is 0 */ 50/* Default PCI flags is 0 on ppc32, modified at boot on ppc64 */
57unsigned int ppc_pci_flags; 51unsigned int ppc_pci_flags = 0;
52
58 53
59static struct dma_mapping_ops *pci_dma_ops; 54static struct dma_mapping_ops *pci_dma_ops;
60 55
@@ -165,8 +160,6 @@ EXPORT_SYMBOL(pci_domain_nr);
165 */ 160 */
166struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node) 161struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node)
167{ 162{
168 if (!have_of)
169 return NULL;
170 while(node) { 163 while(node) {
171 struct pci_controller *hose, *tmp; 164 struct pci_controller *hose, *tmp;
172 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) 165 list_for_each_entry_safe(hose, tmp, &hose_list, list_node)
@@ -208,26 +201,6 @@ char __devinit *pcibios_setup(char *str)
208 return str; 201 return str;
209} 202}
210 203
211void __devinit pcibios_setup_new_device(struct pci_dev *dev)
212{
213 struct dev_archdata *sd = &dev->dev.archdata;
214
215 sd->of_node = pci_device_to_OF_node(dev);
216
217 DBG("PCI: device %s OF node: %s\n", pci_name(dev),
218 sd->of_node ? sd->of_node->full_name : "<none>");
219
220 sd->dma_ops = pci_dma_ops;
221#ifdef CONFIG_PPC32
222 sd->dma_data = (void *)PCI_DRAM_OFFSET;
223#endif
224 set_dev_node(&dev->dev, pcibus_to_node(dev->bus));
225
226 if (ppc_md.pci_dma_dev_setup)
227 ppc_md.pci_dma_dev_setup(dev);
228}
229EXPORT_SYMBOL(pcibios_setup_new_device);
230
231/* 204/*
232 * Reads the interrupt pin to determine if interrupt is use by card. 205 * Reads the interrupt pin to determine if interrupt is use by card.
233 * If the interrupt is used, then gets the interrupt line from the 206 * If the interrupt is used, then gets the interrupt line from the
@@ -252,7 +225,7 @@ int pci_read_irq_line(struct pci_dev *pci_dev)
252 return -1; 225 return -1;
253#endif 226#endif
254 227
255 DBG("Try to map irq for %s...\n", pci_name(pci_dev)); 228 pr_debug("PCI: Try to map irq for %s...\n", pci_name(pci_dev));
256 229
257#ifdef DEBUG 230#ifdef DEBUG
258 memset(&oirq, 0xff, sizeof(oirq)); 231 memset(&oirq, 0xff, sizeof(oirq));
@@ -276,26 +249,26 @@ int pci_read_irq_line(struct pci_dev *pci_dev)
276 line == 0xff || line == 0) { 249 line == 0xff || line == 0) {
277 return -1; 250 return -1;
278 } 251 }
279 DBG(" -> no map ! Using line %d (pin %d) from PCI config\n", 252 pr_debug(" No map ! Using line %d (pin %d) from PCI config\n",
280 line, pin); 253 line, pin);
281 254
282 virq = irq_create_mapping(NULL, line); 255 virq = irq_create_mapping(NULL, line);
283 if (virq != NO_IRQ) 256 if (virq != NO_IRQ)
284 set_irq_type(virq, IRQ_TYPE_LEVEL_LOW); 257 set_irq_type(virq, IRQ_TYPE_LEVEL_LOW);
285 } else { 258 } else {
286 DBG(" -> got one, spec %d cells (0x%08x 0x%08x...) on %s\n", 259 pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n",
287 oirq.size, oirq.specifier[0], oirq.specifier[1], 260 oirq.size, oirq.specifier[0], oirq.specifier[1],
288 oirq.controller->full_name); 261 oirq.controller->full_name);
289 262
290 virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 263 virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
291 oirq.size); 264 oirq.size);
292 } 265 }
293 if(virq == NO_IRQ) { 266 if(virq == NO_IRQ) {
294 DBG(" -> failed to map !\n"); 267 pr_debug(" Failed to map !\n");
295 return -1; 268 return -1;
296 } 269 }
297 270
298 DBG(" -> mapped to linux irq %d\n", virq); 271 pr_debug(" Mapped to linux irq %d\n", virq);
299 272
300 pci_dev->irq = virq; 273 pci_dev->irq = virq;
301 274
@@ -397,13 +370,10 @@ static pgprot_t __pci_mmap_set_pgprot(struct pci_dev *dev, struct resource *rp,
397 } 370 }
398 371
399 /* XXX would be nice to have a way to ask for write-through */ 372 /* XXX would be nice to have a way to ask for write-through */
400 prot |= _PAGE_NO_CACHE;
401 if (write_combine) 373 if (write_combine)
402 prot &= ~_PAGE_GUARDED; 374 return pgprot_noncached_wc(prot);
403 else 375 else
404 prot |= _PAGE_GUARDED; 376 return pgprot_noncached(prot);
405
406 return __pgprot(prot);
407} 377}
408 378
409/* 379/*
@@ -414,19 +384,17 @@ static pgprot_t __pci_mmap_set_pgprot(struct pci_dev *dev, struct resource *rp,
414pgprot_t pci_phys_mem_access_prot(struct file *file, 384pgprot_t pci_phys_mem_access_prot(struct file *file,
415 unsigned long pfn, 385 unsigned long pfn,
416 unsigned long size, 386 unsigned long size,
417 pgprot_t protection) 387 pgprot_t prot)
418{ 388{
419 struct pci_dev *pdev = NULL; 389 struct pci_dev *pdev = NULL;
420 struct resource *found = NULL; 390 struct resource *found = NULL;
421 unsigned long prot = pgprot_val(protection);
422 resource_size_t offset = ((resource_size_t)pfn) << PAGE_SHIFT; 391 resource_size_t offset = ((resource_size_t)pfn) << PAGE_SHIFT;
423 int i; 392 int i;
424 393
425 if (page_is_ram(pfn)) 394 if (page_is_ram(pfn))
426 return __pgprot(prot); 395 return prot;
427
428 prot |= _PAGE_NO_CACHE | _PAGE_GUARDED;
429 396
397 prot = pgprot_noncached(prot);
430 for_each_pci_dev(pdev) { 398 for_each_pci_dev(pdev) {
431 for (i = 0; i <= PCI_ROM_RESOURCE; i++) { 399 for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
432 struct resource *rp = &pdev->resource[i]; 400 struct resource *rp = &pdev->resource[i];
@@ -447,14 +415,14 @@ pgprot_t pci_phys_mem_access_prot(struct file *file,
447 } 415 }
448 if (found) { 416 if (found) {
449 if (found->flags & IORESOURCE_PREFETCH) 417 if (found->flags & IORESOURCE_PREFETCH)
450 prot &= ~_PAGE_GUARDED; 418 prot = pgprot_noncached_wc(prot);
451 pci_dev_put(pdev); 419 pci_dev_put(pdev);
452 } 420 }
453 421
454 DBG("non-PCI map for %llx, prot: %lx\n", 422 pr_debug("PCI: Non-PCI map for %llx, prot: %lx\n",
455 (unsigned long long)offset, prot); 423 (unsigned long long)offset, pgprot_val(prot));
456 424
457 return __pgprot(prot); 425 return prot;
458} 426}
459 427
460 428
@@ -610,8 +578,7 @@ int pci_mmap_legacy_page_range(struct pci_bus *bus,
610 pr_debug(" -> mapping phys %llx\n", (unsigned long long)offset); 578 pr_debug(" -> mapping phys %llx\n", (unsigned long long)offset);
611 579
612 vma->vm_pgoff = offset >> PAGE_SHIFT; 580 vma->vm_pgoff = offset >> PAGE_SHIFT;
613 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 581 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
614 | _PAGE_NO_CACHE | _PAGE_GUARDED);
615 return remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, 582 return remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
616 vma->vm_end - vma->vm_start, 583 vma->vm_end - vma->vm_start,
617 vma->vm_page_prot); 584 vma->vm_page_prot);
@@ -853,15 +820,12 @@ void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
853int pci_proc_domain(struct pci_bus *bus) 820int pci_proc_domain(struct pci_bus *bus)
854{ 821{
855 struct pci_controller *hose = pci_bus_to_host(bus); 822 struct pci_controller *hose = pci_bus_to_host(bus);
856#ifdef CONFIG_PPC64 823
857 return hose->buid != 0;
858#else
859 if (!(ppc_pci_flags & PPC_PCI_ENABLE_PROC_DOMAINS)) 824 if (!(ppc_pci_flags & PPC_PCI_ENABLE_PROC_DOMAINS))
860 return 0; 825 return 0;
861 if (ppc_pci_flags & PPC_PCI_COMPAT_DOMAIN_0) 826 if (ppc_pci_flags & PPC_PCI_COMPAT_DOMAIN_0)
862 return hose->global_number != 0; 827 return hose->global_number != 0;
863 return 1; 828 return 1;
864#endif
865} 829}
866 830
867void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, 831void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
@@ -1083,27 +1047,50 @@ static void __devinit pcibios_fixup_bridge(struct pci_bus *bus)
1083 } 1047 }
1084} 1048}
1085 1049
1086static void __devinit __pcibios_fixup_bus(struct pci_bus *bus) 1050void __devinit pcibios_setup_bus_self(struct pci_bus *bus)
1087{ 1051{
1088 struct pci_dev *dev = bus->self; 1052 /* Fix up the bus resources for P2P bridges */
1089 1053 if (bus->self != NULL)
1090 pr_debug("PCI: Fixup bus %d (%s)\n", bus->number, dev ? pci_name(dev) : "PHB");
1091
1092 /* Fixup PCI<->PCI bridges. Host bridges are handled separately, for
1093 * now differently between 32 and 64 bits.
1094 */
1095 if (dev != NULL)
1096 pcibios_fixup_bridge(bus); 1054 pcibios_fixup_bridge(bus);
1097 1055
1098 /* Additional setup that is different between 32 and 64 bits for now */ 1056 /* Platform specific bus fixups. This is currently only used
1099 pcibios_do_bus_setup(bus); 1057 * by fsl_pci and I'm hoping to get rid of it at some point
1100 1058 */
1101 /* Platform specific bus fixups */
1102 if (ppc_md.pcibios_fixup_bus) 1059 if (ppc_md.pcibios_fixup_bus)
1103 ppc_md.pcibios_fixup_bus(bus); 1060 ppc_md.pcibios_fixup_bus(bus);
1104 1061
1105 /* Read default IRQs and fixup if necessary */ 1062 /* Setup bus DMA mappings */
1063 if (ppc_md.pci_dma_bus_setup)
1064 ppc_md.pci_dma_bus_setup(bus);
1065}
1066
1067void __devinit pcibios_setup_bus_devices(struct pci_bus *bus)
1068{
1069 struct pci_dev *dev;
1070
1071 pr_debug("PCI: Fixup bus devices %d (%s)\n",
1072 bus->number, bus->self ? pci_name(bus->self) : "PHB");
1073
1106 list_for_each_entry(dev, &bus->devices, bus_list) { 1074 list_for_each_entry(dev, &bus->devices, bus_list) {
1075 struct dev_archdata *sd = &dev->dev.archdata;
1076
1077 /* Setup OF node pointer in archdata */
1078 sd->of_node = pci_device_to_OF_node(dev);
1079
1080 /* Fixup NUMA node as it may not be setup yet by the generic
1081 * code and is needed by the DMA init
1082 */
1083 set_dev_node(&dev->dev, pcibus_to_node(dev->bus));
1084
1085 /* Hook up default DMA ops */
1086 sd->dma_ops = pci_dma_ops;
1087 sd->dma_data = (void *)PCI_DRAM_OFFSET;
1088
1089 /* Additional platform DMA/iommu setup */
1090 if (ppc_md.pci_dma_dev_setup)
1091 ppc_md.pci_dma_dev_setup(dev);
1092
1093 /* Read default IRQs and fixup if necessary */
1107 pci_read_irq_line(dev); 1094 pci_read_irq_line(dev);
1108 if (ppc_md.pci_irq_fixup) 1095 if (ppc_md.pci_irq_fixup)
1109 ppc_md.pci_irq_fixup(dev); 1096 ppc_md.pci_irq_fixup(dev);
@@ -1113,22 +1100,19 @@ static void __devinit __pcibios_fixup_bus(struct pci_bus *bus)
1113void __devinit pcibios_fixup_bus(struct pci_bus *bus) 1100void __devinit pcibios_fixup_bus(struct pci_bus *bus)
1114{ 1101{
1115 /* When called from the generic PCI probe, read PCI<->PCI bridge 1102 /* When called from the generic PCI probe, read PCI<->PCI bridge
1116 * bases before proceeding 1103 * bases. This is -not- called when generating the PCI tree from
1104 * the OF device-tree.
1117 */ 1105 */
1118 if (bus->self != NULL) 1106 if (bus->self != NULL)
1119 pci_read_bridge_bases(bus); 1107 pci_read_bridge_bases(bus);
1120 __pcibios_fixup_bus(bus);
1121}
1122EXPORT_SYMBOL(pcibios_fixup_bus);
1123 1108
1124/* When building a bus from the OF tree rather than probing, we need a 1109 /* Now fixup the bus bus */
1125 * slightly different version of the fixup which doesn't read the 1110 pcibios_setup_bus_self(bus);
1126 * bridge bases using config space accesses 1111
1127 */ 1112 /* Now fixup devices on that bus */
1128void __devinit pcibios_fixup_of_probed_bus(struct pci_bus *bus) 1113 pcibios_setup_bus_devices(bus);
1129{
1130 __pcibios_fixup_bus(bus);
1131} 1114}
1115EXPORT_SYMBOL(pcibios_fixup_bus);
1132 1116
1133static int skip_isa_ioresource_align(struct pci_dev *dev) 1117static int skip_isa_ioresource_align(struct pci_dev *dev)
1134{ 1118{
@@ -1198,10 +1182,10 @@ static int __init reparent_resources(struct resource *parent,
1198 *pp = NULL; 1182 *pp = NULL;
1199 for (p = res->child; p != NULL; p = p->sibling) { 1183 for (p = res->child; p != NULL; p = p->sibling) {
1200 p->parent = res; 1184 p->parent = res;
1201 DBG(KERN_INFO "PCI: reparented %s [%llx..%llx] under %s\n", 1185 pr_debug("PCI: Reparented %s [%llx..%llx] under %s\n",
1202 p->name, 1186 p->name,
1203 (unsigned long long)p->start, 1187 (unsigned long long)p->start,
1204 (unsigned long long)p->end, res->name); 1188 (unsigned long long)p->end, res->name);
1205 } 1189 }
1206 return 0; 1190 return 0;
1207} 1191}
@@ -1245,9 +1229,12 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus)
1245 int i; 1229 int i;
1246 struct resource *res, *pr; 1230 struct resource *res, *pr;
1247 1231
1232 pr_debug("PCI: Allocating bus resources for %04x:%02x...\n",
1233 pci_domain_nr(bus), bus->number);
1234
1248 for (i = 0; i < PCI_BUS_NUM_RESOURCES; ++i) { 1235 for (i = 0; i < PCI_BUS_NUM_RESOURCES; ++i) {
1249 if ((res = bus->resource[i]) == NULL || !res->flags 1236 if ((res = bus->resource[i]) == NULL || !res->flags
1250 || res->start > res->end) 1237 || res->start > res->end || res->parent)
1251 continue; 1238 continue;
1252 if (bus->parent == NULL) 1239 if (bus->parent == NULL)
1253 pr = (res->flags & IORESOURCE_IO) ? 1240 pr = (res->flags & IORESOURCE_IO) ?
@@ -1271,14 +1258,14 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus)
1271 } 1258 }
1272 } 1259 }
1273 1260
1274 DBG("PCI: %s (bus %d) bridge rsrc %d: %016llx-%016llx " 1261 pr_debug("PCI: %s (bus %d) bridge rsrc %d: %016llx-%016llx "
1275 "[0x%x], parent %p (%s)\n", 1262 "[0x%x], parent %p (%s)\n",
1276 bus->self ? pci_name(bus->self) : "PHB", 1263 bus->self ? pci_name(bus->self) : "PHB",
1277 bus->number, i, 1264 bus->number, i,
1278 (unsigned long long)res->start, 1265 (unsigned long long)res->start,
1279 (unsigned long long)res->end, 1266 (unsigned long long)res->end,
1280 (unsigned int)res->flags, 1267 (unsigned int)res->flags,
1281 pr, (pr && pr->name) ? pr->name : "nil"); 1268 pr, (pr && pr->name) ? pr->name : "nil");
1282 1269
1283 if (pr && !(pr->flags & IORESOURCE_UNSET)) { 1270 if (pr && !(pr->flags & IORESOURCE_UNSET)) {
1284 if (request_resource(pr, res) == 0) 1271 if (request_resource(pr, res) == 0)
@@ -1305,11 +1292,11 @@ static inline void __devinit alloc_resource(struct pci_dev *dev, int idx)
1305{ 1292{
1306 struct resource *pr, *r = &dev->resource[idx]; 1293 struct resource *pr, *r = &dev->resource[idx];
1307 1294
1308 DBG("PCI: Allocating %s: Resource %d: %016llx..%016llx [%x]\n", 1295 pr_debug("PCI: Allocating %s: Resource %d: %016llx..%016llx [%x]\n",
1309 pci_name(dev), idx, 1296 pci_name(dev), idx,
1310 (unsigned long long)r->start, 1297 (unsigned long long)r->start,
1311 (unsigned long long)r->end, 1298 (unsigned long long)r->end,
1312 (unsigned int)r->flags); 1299 (unsigned int)r->flags);
1313 1300
1314 pr = pci_find_parent_resource(dev, r); 1301 pr = pci_find_parent_resource(dev, r);
1315 if (!pr || (pr->flags & IORESOURCE_UNSET) || 1302 if (!pr || (pr->flags & IORESOURCE_UNSET) ||
@@ -1317,10 +1304,11 @@ static inline void __devinit alloc_resource(struct pci_dev *dev, int idx)
1317 printk(KERN_WARNING "PCI: Cannot allocate resource region %d" 1304 printk(KERN_WARNING "PCI: Cannot allocate resource region %d"
1318 " of device %s, will remap\n", idx, pci_name(dev)); 1305 " of device %s, will remap\n", idx, pci_name(dev));
1319 if (pr) 1306 if (pr)
1320 DBG("PCI: parent is %p: %016llx-%016llx [%x]\n", pr, 1307 pr_debug("PCI: parent is %p: %016llx-%016llx [%x]\n",
1321 (unsigned long long)pr->start, 1308 pr,
1322 (unsigned long long)pr->end, 1309 (unsigned long long)pr->start,
1323 (unsigned int)pr->flags); 1310 (unsigned long long)pr->end,
1311 (unsigned int)pr->flags);
1324 /* We'll assign a new address later */ 1312 /* We'll assign a new address later */
1325 r->flags |= IORESOURCE_UNSET; 1313 r->flags |= IORESOURCE_UNSET;
1326 r->end -= r->start; 1314 r->end -= r->start;
@@ -1358,7 +1346,8 @@ static void __init pcibios_allocate_resources(int pass)
1358 * but keep it unregistered. 1346 * but keep it unregistered.
1359 */ 1347 */
1360 u32 reg; 1348 u32 reg;
1361 DBG("PCI: Switching off ROM of %s\n", pci_name(dev)); 1349 pr_debug("PCI: Switching off ROM of %s\n",
1350 pci_name(dev));
1362 r->flags &= ~IORESOURCE_ROM_ENABLE; 1351 r->flags &= ~IORESOURCE_ROM_ENABLE;
1363 pci_read_config_dword(dev, dev->rom_base_reg, &reg); 1352 pci_read_config_dword(dev, dev->rom_base_reg, &reg);
1364 pci_write_config_dword(dev, dev->rom_base_reg, 1353 pci_write_config_dword(dev, dev->rom_base_reg,
@@ -1383,7 +1372,7 @@ void __init pcibios_resource_survey(void)
1383 } 1372 }
1384 1373
1385 if (!(ppc_pci_flags & PPC_PCI_PROBE_ONLY)) { 1374 if (!(ppc_pci_flags & PPC_PCI_PROBE_ONLY)) {
1386 DBG("PCI: Assigning unassigned resouces...\n"); 1375 pr_debug("PCI: Assigning unassigned resouces...\n");
1387 pci_assign_unassigned_resources(); 1376 pci_assign_unassigned_resources();
1388 } 1377 }
1389 1378
@@ -1393,9 +1382,11 @@ void __init pcibios_resource_survey(void)
1393} 1382}
1394 1383
1395#ifdef CONFIG_HOTPLUG 1384#ifdef CONFIG_HOTPLUG
1396/* This is used by the pSeries hotplug driver to allocate resource 1385
1386/* This is used by the PCI hotplug driver to allocate resource
1397 * of newly plugged busses. We can try to consolidate with the 1387 * of newly plugged busses. We can try to consolidate with the
1398 * rest of the code later, for now, keep it as-is 1388 * rest of the code later, for now, keep it as-is as our main
1389 * resource allocation function doesn't deal with sub-trees yet.
1399 */ 1390 */
1400void __devinit pcibios_claim_one_bus(struct pci_bus *bus) 1391void __devinit pcibios_claim_one_bus(struct pci_bus *bus)
1401{ 1392{
@@ -1410,6 +1401,14 @@ void __devinit pcibios_claim_one_bus(struct pci_bus *bus)
1410 1401
1411 if (r->parent || !r->start || !r->flags) 1402 if (r->parent || !r->start || !r->flags)
1412 continue; 1403 continue;
1404
1405 pr_debug("PCI: Claiming %s: "
1406 "Resource %d: %016llx..%016llx [%x]\n",
1407 pci_name(dev), i,
1408 (unsigned long long)r->start,
1409 (unsigned long long)r->end,
1410 (unsigned int)r->flags);
1411
1413 pci_claim_resource(dev, i); 1412 pci_claim_resource(dev, i);
1414 } 1413 }
1415 } 1414 }
@@ -1418,6 +1417,31 @@ void __devinit pcibios_claim_one_bus(struct pci_bus *bus)
1418 pcibios_claim_one_bus(child_bus); 1417 pcibios_claim_one_bus(child_bus);
1419} 1418}
1420EXPORT_SYMBOL_GPL(pcibios_claim_one_bus); 1419EXPORT_SYMBOL_GPL(pcibios_claim_one_bus);
1420
1421
1422/* pcibios_finish_adding_to_bus
1423 *
1424 * This is to be called by the hotplug code after devices have been
1425 * added to a bus, this include calling it for a PHB that is just
1426 * being added
1427 */
1428void pcibios_finish_adding_to_bus(struct pci_bus *bus)
1429{
1430 pr_debug("PCI: Finishing adding to hotplug bus %04x:%02x\n",
1431 pci_domain_nr(bus), bus->number);
1432
1433 /* Allocate bus and devices resources */
1434 pcibios_allocate_bus_resources(bus);
1435 pcibios_claim_one_bus(bus);
1436
1437 /* Add new devices to global lists. Register in proc, sysfs. */
1438 pci_bus_add_devices(bus);
1439
1440 /* Fixup EEH */
1441 eeh_add_device_tree_late(bus);
1442}
1443EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus);
1444
1421#endif /* CONFIG_HOTPLUG */ 1445#endif /* CONFIG_HOTPLUG */
1422 1446
1423int pcibios_enable_device(struct pci_dev *dev, int mask) 1447int pcibios_enable_device(struct pci_dev *dev, int mask)
@@ -1428,3 +1452,61 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
1428 1452
1429 return pci_enable_resources(dev, mask); 1453 return pci_enable_resources(dev, mask);
1430} 1454}
1455
1456void __devinit pcibios_setup_phb_resources(struct pci_controller *hose)
1457{
1458 struct pci_bus *bus = hose->bus;
1459 struct resource *res;
1460 int i;
1461
1462 /* Hookup PHB IO resource */
1463 bus->resource[0] = res = &hose->io_resource;
1464
1465 if (!res->flags) {
1466 printk(KERN_WARNING "PCI: I/O resource not set for host"
1467 " bridge %s (domain %d)\n",
1468 hose->dn->full_name, hose->global_number);
1469#ifdef CONFIG_PPC32
1470 /* Workaround for lack of IO resource only on 32-bit */
1471 res->start = (unsigned long)hose->io_base_virt - isa_io_base;
1472 res->end = res->start + IO_SPACE_LIMIT;
1473 res->flags = IORESOURCE_IO;
1474#endif /* CONFIG_PPC32 */
1475 }
1476
1477 pr_debug("PCI: PHB IO resource = %016llx-%016llx [%lx]\n",
1478 (unsigned long long)res->start,
1479 (unsigned long long)res->end,
1480 (unsigned long)res->flags);
1481
1482 /* Hookup PHB Memory resources */
1483 for (i = 0; i < 3; ++i) {
1484 res = &hose->mem_resources[i];
1485 if (!res->flags) {
1486 if (i > 0)
1487 continue;
1488 printk(KERN_ERR "PCI: Memory resource 0 not set for "
1489 "host bridge %s (domain %d)\n",
1490 hose->dn->full_name, hose->global_number);
1491#ifdef CONFIG_PPC32
1492 /* Workaround for lack of MEM resource only on 32-bit */
1493 res->start = hose->pci_mem_offset;
1494 res->end = (resource_size_t)-1LL;
1495 res->flags = IORESOURCE_MEM;
1496#endif /* CONFIG_PPC32 */
1497 }
1498 bus->resource[i+1] = res;
1499
1500 pr_debug("PCI: PHB MEM resource %d = %016llx-%016llx [%lx]\n", i,
1501 (unsigned long long)res->start,
1502 (unsigned long long)res->end,
1503 (unsigned long)res->flags);
1504 }
1505
1506 pr_debug("PCI: PHB MEM offset = %016llx\n",
1507 (unsigned long long)hose->pci_mem_offset);
1508 pr_debug("PCI: PHB IO offset = %08lx\n",
1509 (unsigned long)hose->io_base_virt - _IO_BASE);
1510
1511}
1512
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index 131b1dfa68c6..132cd80afa21 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -26,12 +26,6 @@
26 26
27#undef DEBUG 27#undef DEBUG
28 28
29#ifdef DEBUG
30#define DBG(x...) printk(x)
31#else
32#define DBG(x...)
33#endif
34
35unsigned long isa_io_base = 0; 29unsigned long isa_io_base = 0;
36unsigned long pci_dram_offset = 0; 30unsigned long pci_dram_offset = 0;
37int pcibios_assign_bus_offset = 1; 31int pcibios_assign_bus_offset = 1;
@@ -272,17 +266,14 @@ pci_busdev_to_OF_node(struct pci_bus *bus, int devfn)
272{ 266{
273 struct device_node *parent, *np; 267 struct device_node *parent, *np;
274 268
275 if (!have_of) 269 pr_debug("pci_busdev_to_OF_node(%d,0x%x)\n", bus->number, devfn);
276 return NULL;
277
278 DBG("pci_busdev_to_OF_node(%d,0x%x)\n", bus->number, devfn);
279 parent = scan_OF_for_pci_bus(bus); 270 parent = scan_OF_for_pci_bus(bus);
280 if (parent == NULL) 271 if (parent == NULL)
281 return NULL; 272 return NULL;
282 DBG(" parent is %s\n", parent ? parent->full_name : "<NULL>"); 273 pr_debug(" parent is %s\n", parent ? parent->full_name : "<NULL>");
283 np = scan_OF_for_pci_dev(parent, devfn); 274 np = scan_OF_for_pci_dev(parent, devfn);
284 of_node_put(parent); 275 of_node_put(parent);
285 DBG(" result is %s\n", np ? np->full_name : "<NULL>"); 276 pr_debug(" result is %s\n", np ? np->full_name : "<NULL>");
286 277
287 /* XXX most callers don't release the returned node 278 /* XXX most callers don't release the returned node
288 * mostly because ppc64 doesn't increase the refcount, 279 * mostly because ppc64 doesn't increase the refcount,
@@ -315,8 +306,6 @@ pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn)
315 struct pci_controller* hose; 306 struct pci_controller* hose;
316 struct pci_dev* dev = NULL; 307 struct pci_dev* dev = NULL;
317 308
318 if (!have_of)
319 return -ENODEV;
320 /* Make sure it's really a PCI device */ 309 /* Make sure it's really a PCI device */
321 hose = pci_find_hose_for_OF_device(node); 310 hose = pci_find_hose_for_OF_device(node);
322 if (!hose || !hose->dn) 311 if (!hose || !hose->dn)
@@ -379,10 +368,41 @@ void pcibios_make_OF_bus_map(void)
379} 368}
380#endif /* CONFIG_PPC_OF */ 369#endif /* CONFIG_PPC_OF */
381 370
371static void __devinit pcibios_scan_phb(struct pci_controller *hose)
372{
373 struct pci_bus *bus;
374 struct device_node *node = hose->dn;
375 unsigned long io_offset;
376 struct resource *res = &hose->io_resource;
377
378 pr_debug("PCI: Scanning PHB %s\n",
379 node ? node->full_name : "<NO NAME>");
380
381 /* Create an empty bus for the toplevel */
382 bus = pci_create_bus(hose->parent, hose->first_busno, hose->ops, hose);
383 if (bus == NULL) {
384 printk(KERN_ERR "Failed to create bus for PCI domain %04x\n",
385 hose->global_number);
386 return;
387 }
388 bus->secondary = hose->first_busno;
389 hose->bus = bus;
390
391 /* Fixup IO space offset */
392 io_offset = (unsigned long)hose->io_base_virt - isa_io_base;
393 res->start = (res->start + io_offset) & 0xffffffffu;
394 res->end = (res->end + io_offset) & 0xffffffffu;
395
396 /* Wire up PHB bus resources */
397 pcibios_setup_phb_resources(hose);
398
399 /* Scan children */
400 hose->last_busno = bus->subordinate = pci_scan_child_bus(bus);
401}
402
382static int __init pcibios_init(void) 403static int __init pcibios_init(void)
383{ 404{
384 struct pci_controller *hose, *tmp; 405 struct pci_controller *hose, *tmp;
385 struct pci_bus *bus;
386 int next_busno = 0; 406 int next_busno = 0;
387 407
388 printk(KERN_INFO "PCI: Probing PCI hardware\n"); 408 printk(KERN_INFO "PCI: Probing PCI hardware\n");
@@ -395,12 +415,8 @@ static int __init pcibios_init(void)
395 if (pci_assign_all_buses) 415 if (pci_assign_all_buses)
396 hose->first_busno = next_busno; 416 hose->first_busno = next_busno;
397 hose->last_busno = 0xff; 417 hose->last_busno = 0xff;
398 bus = pci_scan_bus_parented(hose->parent, hose->first_busno, 418 pcibios_scan_phb(hose);
399 hose->ops, hose); 419 pci_bus_add_devices(hose->bus);
400 if (bus) {
401 pci_bus_add_devices(bus);
402 hose->last_busno = bus->subordinate;
403 }
404 if (pci_assign_all_buses || next_busno <= hose->last_busno) 420 if (pci_assign_all_buses || next_busno <= hose->last_busno)
405 next_busno = hose->last_busno + pcibios_assign_bus_offset; 421 next_busno = hose->last_busno + pcibios_assign_bus_offset;
406 } 422 }
@@ -410,7 +426,7 @@ static int __init pcibios_init(void)
410 * numbers vs. kernel bus numbers since we may have to 426 * numbers vs. kernel bus numbers since we may have to
411 * remap them. 427 * remap them.
412 */ 428 */
413 if (pci_assign_all_buses && have_of) 429 if (pci_assign_all_buses)
414 pcibios_make_OF_bus_map(); 430 pcibios_make_OF_bus_map();
415 431
416 /* Call common code to handle resource allocation */ 432 /* Call common code to handle resource allocation */
@@ -425,54 +441,6 @@ static int __init pcibios_init(void)
425 441
426subsys_initcall(pcibios_init); 442subsys_initcall(pcibios_init);
427 443
428void __devinit pcibios_do_bus_setup(struct pci_bus *bus)
429{
430 struct pci_controller *hose = (struct pci_controller *) bus->sysdata;
431 unsigned long io_offset;
432 struct resource *res;
433 int i;
434 struct pci_dev *dev;
435
436 /* Hookup PHB resources */
437 io_offset = (unsigned long)hose->io_base_virt - isa_io_base;
438 if (bus->parent == NULL) {
439 /* This is a host bridge - fill in its resources */
440 hose->bus = bus;
441
442 bus->resource[0] = res = &hose->io_resource;
443 if (!res->flags) {
444 if (io_offset)
445 printk(KERN_ERR "I/O resource not set for host"
446 " bridge %d\n", hose->global_number);
447 res->start = 0;
448 res->end = IO_SPACE_LIMIT;
449 res->flags = IORESOURCE_IO;
450 }
451 res->start = (res->start + io_offset) & 0xffffffffu;
452 res->end = (res->end + io_offset) & 0xffffffffu;
453
454 for (i = 0; i < 3; ++i) {
455 res = &hose->mem_resources[i];
456 if (!res->flags) {
457 if (i > 0)
458 continue;
459 printk(KERN_ERR "Memory resource not set for "
460 "host bridge %d\n", hose->global_number);
461 res->start = hose->pci_mem_offset;
462 res->end = ~0U;
463 res->flags = IORESOURCE_MEM;
464 }
465 bus->resource[i+1] = res;
466 }
467 }
468
469 if (ppc_md.pci_dma_bus_setup)
470 ppc_md.pci_dma_bus_setup(bus);
471
472 list_for_each_entry(dev, &bus->devices, bus_list)
473 pcibios_setup_new_device(dev);
474}
475
476/* the next one is stolen from the alpha port... */ 444/* the next one is stolen from the alpha port... */
477void __init 445void __init
478pcibios_update_irq(struct pci_dev *dev, int irq) 446pcibios_update_irq(struct pci_dev *dev, int irq)
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 3502b9101e6b..39fadc6e1492 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -32,13 +32,6 @@
32#include <asm/machdep.h> 32#include <asm/machdep.h>
33#include <asm/ppc-pci.h> 33#include <asm/ppc-pci.h>
34 34
35#ifdef DEBUG
36#include <asm/udbg.h>
37#define DBG(fmt...) printk(fmt)
38#else
39#define DBG(fmt...)
40#endif
41
42unsigned long pci_probe_only = 1; 35unsigned long pci_probe_only = 1;
43 36
44/* pci_io_base -- the base address from which io bars are offsets. 37/* pci_io_base -- the base address from which io bars are offsets.
@@ -102,7 +95,7 @@ static void pci_parse_of_addrs(struct device_node *node, struct pci_dev *dev)
102 addrs = of_get_property(node, "assigned-addresses", &proplen); 95 addrs = of_get_property(node, "assigned-addresses", &proplen);
103 if (!addrs) 96 if (!addrs)
104 return; 97 return;
105 DBG(" parse addresses (%d bytes) @ %p\n", proplen, addrs); 98 pr_debug(" parse addresses (%d bytes) @ %p\n", proplen, addrs);
106 for (; proplen >= 20; proplen -= 20, addrs += 5) { 99 for (; proplen >= 20; proplen -= 20, addrs += 5) {
107 flags = pci_parse_of_flags(addrs[0]); 100 flags = pci_parse_of_flags(addrs[0]);
108 if (!flags) 101 if (!flags)
@@ -112,8 +105,9 @@ static void pci_parse_of_addrs(struct device_node *node, struct pci_dev *dev)
112 if (!size) 105 if (!size)
113 continue; 106 continue;
114 i = addrs[0] & 0xff; 107 i = addrs[0] & 0xff;
115 DBG(" base: %llx, size: %llx, i: %x\n", 108 pr_debug(" base: %llx, size: %llx, i: %x\n",
116 (unsigned long long)base, (unsigned long long)size, i); 109 (unsigned long long)base,
110 (unsigned long long)size, i);
117 111
118 if (PCI_BASE_ADDRESS_0 <= i && i <= PCI_BASE_ADDRESS_5) { 112 if (PCI_BASE_ADDRESS_0 <= i && i <= PCI_BASE_ADDRESS_5) {
119 res = &dev->resource[(i - PCI_BASE_ADDRESS_0) >> 2]; 113 res = &dev->resource[(i - PCI_BASE_ADDRESS_0) >> 2];
@@ -144,7 +138,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
144 if (type == NULL) 138 if (type == NULL)
145 type = ""; 139 type = "";
146 140
147 DBG(" create device, devfn: %x, type: %s\n", devfn, type); 141 pr_debug(" create device, devfn: %x, type: %s\n", devfn, type);
148 142
149 dev->bus = bus; 143 dev->bus = bus;
150 dev->sysdata = node; 144 dev->sysdata = node;
@@ -165,8 +159,8 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
165 dev->class = get_int_prop(node, "class-code", 0); 159 dev->class = get_int_prop(node, "class-code", 0);
166 dev->revision = get_int_prop(node, "revision-id", 0); 160 dev->revision = get_int_prop(node, "revision-id", 0);
167 161
168 DBG(" class: 0x%x\n", dev->class); 162 pr_debug(" class: 0x%x\n", dev->class);
169 DBG(" revision: 0x%x\n", dev->revision); 163 pr_debug(" revision: 0x%x\n", dev->revision);
170 164
171 dev->current_state = 4; /* unknown power state */ 165 dev->current_state = 4; /* unknown power state */
172 dev->error_state = pci_channel_io_normal; 166 dev->error_state = pci_channel_io_normal;
@@ -187,7 +181,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
187 181
188 pci_parse_of_addrs(node, dev); 182 pci_parse_of_addrs(node, dev);
189 183
190 DBG(" adding to system ...\n"); 184 pr_debug(" adding to system ...\n");
191 185
192 pci_device_add(dev, bus); 186 pci_device_add(dev, bus);
193 187
@@ -195,19 +189,20 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
195} 189}
196EXPORT_SYMBOL(of_create_pci_dev); 190EXPORT_SYMBOL(of_create_pci_dev);
197 191
198void __devinit of_scan_bus(struct device_node *node, 192static void __devinit __of_scan_bus(struct device_node *node,
199 struct pci_bus *bus) 193 struct pci_bus *bus, int rescan_existing)
200{ 194{
201 struct device_node *child; 195 struct device_node *child;
202 const u32 *reg; 196 const u32 *reg;
203 int reglen, devfn; 197 int reglen, devfn;
204 struct pci_dev *dev; 198 struct pci_dev *dev;
205 199
206 DBG("of_scan_bus(%s) bus no %d... \n", node->full_name, bus->number); 200 pr_debug("of_scan_bus(%s) bus no %d... \n",
201 node->full_name, bus->number);
207 202
208 /* Scan direct children */ 203 /* Scan direct children */
209 for_each_child_of_node(node, child) { 204 for_each_child_of_node(node, child) {
210 DBG(" * %s\n", child->full_name); 205 pr_debug(" * %s\n", child->full_name);
211 reg = of_get_property(child, "reg", &reglen); 206 reg = of_get_property(child, "reg", &reglen);
212 if (reg == NULL || reglen < 20) 207 if (reg == NULL || reglen < 20)
213 continue; 208 continue;
@@ -217,11 +212,15 @@ void __devinit of_scan_bus(struct device_node *node,
217 dev = of_create_pci_dev(child, bus, devfn); 212 dev = of_create_pci_dev(child, bus, devfn);
218 if (!dev) 213 if (!dev)
219 continue; 214 continue;
220 DBG(" dev header type: %x\n", dev->hdr_type); 215 pr_debug(" dev header type: %x\n", dev->hdr_type);
221 } 216 }
222 217
223 /* Ally all fixups */ 218 /* Apply all fixups necessary. We don't fixup the bus "self"
224 pcibios_fixup_of_probed_bus(bus); 219 * for an existing bridge that is being rescanned
220 */
221 if (!rescan_existing)
222 pcibios_setup_bus_self(bus);
223 pcibios_setup_bus_devices(bus);
225 224
226 /* Now scan child busses */ 225 /* Now scan child busses */
227 list_for_each_entry(dev, &bus->devices, bus_list) { 226 list_for_each_entry(dev, &bus->devices, bus_list) {
@@ -233,7 +232,20 @@ void __devinit of_scan_bus(struct device_node *node,
233 } 232 }
234 } 233 }
235} 234}
236EXPORT_SYMBOL(of_scan_bus); 235
236void __devinit of_scan_bus(struct device_node *node,
237 struct pci_bus *bus)
238{
239 __of_scan_bus(node, bus, 0);
240}
241EXPORT_SYMBOL_GPL(of_scan_bus);
242
243void __devinit of_rescan_bus(struct device_node *node,
244 struct pci_bus *bus)
245{
246 __of_scan_bus(node, bus, 1);
247}
248EXPORT_SYMBOL_GPL(of_rescan_bus);
237 249
238void __devinit of_scan_pci_bridge(struct device_node *node, 250void __devinit of_scan_pci_bridge(struct device_node *node,
239 struct pci_dev *dev) 251 struct pci_dev *dev)
@@ -245,7 +257,7 @@ void __devinit of_scan_pci_bridge(struct device_node *node,
245 unsigned int flags; 257 unsigned int flags;
246 u64 size; 258 u64 size;
247 259
248 DBG("of_scan_pci_bridge(%s)\n", node->full_name); 260 pr_debug("of_scan_pci_bridge(%s)\n", node->full_name);
249 261
250 /* parse bus-range property */ 262 /* parse bus-range property */
251 busrange = of_get_property(node, "bus-range", &len); 263 busrange = of_get_property(node, "bus-range", &len);
@@ -309,12 +321,12 @@ void __devinit of_scan_pci_bridge(struct device_node *node,
309 } 321 }
310 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), 322 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
311 bus->number); 323 bus->number);
312 DBG(" bus name: %s\n", bus->name); 324 pr_debug(" bus name: %s\n", bus->name);
313 325
314 mode = PCI_PROBE_NORMAL; 326 mode = PCI_PROBE_NORMAL;
315 if (ppc_md.pci_probe_mode) 327 if (ppc_md.pci_probe_mode)
316 mode = ppc_md.pci_probe_mode(bus); 328 mode = ppc_md.pci_probe_mode(bus);
317 DBG(" probe mode: %d\n", mode); 329 pr_debug(" probe mode: %d\n", mode);
318 330
319 if (mode == PCI_PROBE_DEVTREE) 331 if (mode == PCI_PROBE_DEVTREE)
320 of_scan_bus(node, bus); 332 of_scan_bus(node, bus);
@@ -327,9 +339,10 @@ void __devinit scan_phb(struct pci_controller *hose)
327{ 339{
328 struct pci_bus *bus; 340 struct pci_bus *bus;
329 struct device_node *node = hose->dn; 341 struct device_node *node = hose->dn;
330 int i, mode; 342 int mode;
331 343
332 DBG("PCI: Scanning PHB %s\n", node ? node->full_name : "<NO NAME>"); 344 pr_debug("PCI: Scanning PHB %s\n",
345 node ? node->full_name : "<NO NAME>");
333 346
334 /* Create an empty bus for the toplevel */ 347 /* Create an empty bus for the toplevel */
335 bus = pci_create_bus(hose->parent, hose->first_busno, hose->ops, node); 348 bus = pci_create_bus(hose->parent, hose->first_busno, hose->ops, node);
@@ -345,26 +358,13 @@ void __devinit scan_phb(struct pci_controller *hose)
345 pcibios_map_io_space(bus); 358 pcibios_map_io_space(bus);
346 359
347 /* Wire up PHB bus resources */ 360 /* Wire up PHB bus resources */
348 DBG("PCI: PHB IO resource = %016lx-%016lx [%lx]\n", 361 pcibios_setup_phb_resources(hose);
349 hose->io_resource.start, hose->io_resource.end,
350 hose->io_resource.flags);
351 bus->resource[0] = &hose->io_resource;
352 for (i = 0; i < 3; ++i) {
353 DBG("PCI: PHB MEM resource %d = %016lx-%016lx [%lx]\n", i,
354 hose->mem_resources[i].start,
355 hose->mem_resources[i].end,
356 hose->mem_resources[i].flags);
357 bus->resource[i+1] = &hose->mem_resources[i];
358 }
359 DBG("PCI: PHB MEM offset = %016lx\n", hose->pci_mem_offset);
360 DBG("PCI: PHB IO offset = %08lx\n",
361 (unsigned long)hose->io_base_virt - _IO_BASE);
362 362
363 /* Get probe mode and perform scan */ 363 /* Get probe mode and perform scan */
364 mode = PCI_PROBE_NORMAL; 364 mode = PCI_PROBE_NORMAL;
365 if (node && ppc_md.pci_probe_mode) 365 if (node && ppc_md.pci_probe_mode)
366 mode = ppc_md.pci_probe_mode(bus); 366 mode = ppc_md.pci_probe_mode(bus);
367 DBG(" probe mode: %d\n", mode); 367 pr_debug(" probe mode: %d\n", mode);
368 if (mode == PCI_PROBE_DEVTREE) { 368 if (mode == PCI_PROBE_DEVTREE) {
369 bus->subordinate = hose->last_busno; 369 bus->subordinate = hose->last_busno;
370 of_scan_bus(node, bus); 370 of_scan_bus(node, bus);
@@ -380,7 +380,7 @@ static int __init pcibios_init(void)
380 380
381 printk(KERN_INFO "PCI: Probing PCI hardware\n"); 381 printk(KERN_INFO "PCI: Probing PCI hardware\n");
382 382
383 /* For now, override phys_mem_access_prot. If we need it, 383 /* For now, override phys_mem_access_prot. If we need it,g
384 * later, we may move that initialization to each ppc_md 384 * later, we may move that initialization to each ppc_md
385 */ 385 */
386 ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot; 386 ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot;
@@ -388,6 +388,11 @@ static int __init pcibios_init(void)
388 if (pci_probe_only) 388 if (pci_probe_only)
389 ppc_pci_flags |= PPC_PCI_PROBE_ONLY; 389 ppc_pci_flags |= PPC_PCI_PROBE_ONLY;
390 390
391 /* On ppc64, we always enable PCI domains and we keep domain 0
392 * backward compatible in /proc for video cards
393 */
394 ppc_pci_flags |= PPC_PCI_ENABLE_PROC_DOMAINS | PPC_PCI_COMPAT_DOMAIN_0;
395
391 /* Scan all of the recorded PCI controllers. */ 396 /* Scan all of the recorded PCI controllers. */
392 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { 397 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
393 scan_phb(hose); 398 scan_phb(hose);
@@ -422,8 +427,8 @@ int pcibios_unmap_io_space(struct pci_bus *bus)
422 if (bus->self) { 427 if (bus->self) {
423 struct resource *res = bus->resource[0]; 428 struct resource *res = bus->resource[0];
424 429
425 DBG("IO unmapping for PCI-PCI bridge %s\n", 430 pr_debug("IO unmapping for PCI-PCI bridge %s\n",
426 pci_name(bus->self)); 431 pci_name(bus->self));
427 432
428 __flush_hash_table_range(&init_mm, res->start + _IO_BASE, 433 __flush_hash_table_range(&init_mm, res->start + _IO_BASE,
429 res->end + _IO_BASE + 1); 434 res->end + _IO_BASE + 1);
@@ -437,8 +442,8 @@ int pcibios_unmap_io_space(struct pci_bus *bus)
437 if (hose->io_base_alloc == 0) 442 if (hose->io_base_alloc == 0)
438 return 0; 443 return 0;
439 444
440 DBG("IO unmapping for PHB %s\n", hose->dn->full_name); 445 pr_debug("IO unmapping for PHB %s\n", hose->dn->full_name);
441 DBG(" alloc=0x%p\n", hose->io_base_alloc); 446 pr_debug(" alloc=0x%p\n", hose->io_base_alloc);
442 447
443 /* This is a PHB, we fully unmap the IO area */ 448 /* This is a PHB, we fully unmap the IO area */
444 vunmap(hose->io_base_alloc); 449 vunmap(hose->io_base_alloc);
@@ -463,11 +468,11 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
463 * thus HPTEs will be faulted in when needed 468 * thus HPTEs will be faulted in when needed
464 */ 469 */
465 if (bus->self) { 470 if (bus->self) {
466 DBG("IO mapping for PCI-PCI bridge %s\n", 471 pr_debug("IO mapping for PCI-PCI bridge %s\n",
467 pci_name(bus->self)); 472 pci_name(bus->self));
468 DBG(" virt=0x%016lx...0x%016lx\n", 473 pr_debug(" virt=0x%016lx...0x%016lx\n",
469 bus->resource[0]->start + _IO_BASE, 474 bus->resource[0]->start + _IO_BASE,
470 bus->resource[0]->end + _IO_BASE); 475 bus->resource[0]->end + _IO_BASE);
471 return 0; 476 return 0;
472 } 477 }
473 478
@@ -496,11 +501,11 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
496 hose->io_base_virt = (void __iomem *)(area->addr + 501 hose->io_base_virt = (void __iomem *)(area->addr +
497 hose->io_base_phys - phys_page); 502 hose->io_base_phys - phys_page);
498 503
499 DBG("IO mapping for PHB %s\n", hose->dn->full_name); 504 pr_debug("IO mapping for PHB %s\n", hose->dn->full_name);
500 DBG(" phys=0x%016lx, virt=0x%p (alloc=0x%p)\n", 505 pr_debug(" phys=0x%016lx, virt=0x%p (alloc=0x%p)\n",
501 hose->io_base_phys, hose->io_base_virt, hose->io_base_alloc); 506 hose->io_base_phys, hose->io_base_virt, hose->io_base_alloc);
502 DBG(" size=0x%016lx (alloc=0x%016lx)\n", 507 pr_debug(" size=0x%016lx (alloc=0x%016lx)\n",
503 hose->pci_io_size, size_page); 508 hose->pci_io_size, size_page);
504 509
505 /* Establish the mapping */ 510 /* Establish the mapping */
506 if (__ioremap_at(phys_page, area->addr, size_page, 511 if (__ioremap_at(phys_page, area->addr, size_page,
@@ -512,24 +517,13 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
512 hose->io_resource.start += io_virt_offset; 517 hose->io_resource.start += io_virt_offset;
513 hose->io_resource.end += io_virt_offset; 518 hose->io_resource.end += io_virt_offset;
514 519
515 DBG(" hose->io_resource=0x%016lx...0x%016lx\n", 520 pr_debug(" hose->io_resource=0x%016lx...0x%016lx\n",
516 hose->io_resource.start, hose->io_resource.end); 521 hose->io_resource.start, hose->io_resource.end);
517 522
518 return 0; 523 return 0;
519} 524}
520EXPORT_SYMBOL_GPL(pcibios_map_io_space); 525EXPORT_SYMBOL_GPL(pcibios_map_io_space);
521 526
522void __devinit pcibios_do_bus_setup(struct pci_bus *bus)
523{
524 struct pci_dev *dev;
525
526 if (ppc_md.pci_dma_bus_setup)
527 ppc_md.pci_dma_bus_setup(bus);
528
529 list_for_each_entry(dev, &bus->devices, bus_list)
530 pcibios_setup_new_device(dev);
531}
532
533unsigned long pci_address_to_pio(phys_addr_t address) 527unsigned long pci_address_to_pio(phys_addr_t address)
534{ 528{
535 struct pci_controller *hose, *tmp; 529 struct pci_controller *hose, *tmp;
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 260089dccfb0..dcec1325d340 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -116,12 +116,6 @@ EXPORT_SYMBOL(giveup_spe);
116 116
117#ifndef CONFIG_PPC64 117#ifndef CONFIG_PPC64
118EXPORT_SYMBOL(flush_instruction_cache); 118EXPORT_SYMBOL(flush_instruction_cache);
119EXPORT_SYMBOL(flush_tlb_kernel_range);
120EXPORT_SYMBOL(flush_tlb_page);
121EXPORT_SYMBOL(_tlbie);
122#if defined(CONFIG_4xx) || defined(CONFIG_8xx) || defined(CONFIG_FSL_BOOKE)
123EXPORT_SYMBOL(_tlbil_va);
124#endif
125#endif 119#endif
126EXPORT_SYMBOL(__flush_icache_range); 120EXPORT_SYMBOL(__flush_icache_range);
127EXPORT_SYMBOL(flush_dcache_range); 121EXPORT_SYMBOL(flush_dcache_range);
@@ -174,8 +168,7 @@ EXPORT_SYMBOL(cacheable_memcpy);
174#endif 168#endif
175 169
176#ifdef CONFIG_PPC32 170#ifdef CONFIG_PPC32
177EXPORT_SYMBOL(next_mmu_context); 171EXPORT_SYMBOL(switch_mmu_context);
178EXPORT_SYMBOL(set_context);
179#endif 172#endif
180 173
181#ifdef CONFIG_PPC_STD_MMU_32 174#ifdef CONFIG_PPC_STD_MMU_32
diff --git a/arch/powerpc/xmon/setjmp.S b/arch/powerpc/kernel/ppc_save_regs.S
index 04c0b305ad4a..5113bd2285e1 100644
--- a/arch/powerpc/xmon/setjmp.S
+++ b/arch/powerpc/kernel/ppc_save_regs.S
@@ -22,7 +22,7 @@
22 * that will be different for 32-bit and 64-bit, because of the 22 * that will be different for 32-bit and 64-bit, because of the
23 * different ABIs, though). 23 * different ABIs, though).
24 */ 24 */
25_GLOBAL(xmon_save_regs) 25_GLOBAL(ppc_save_regs)
26 PPC_STL r0,0*SZL(r3) 26 PPC_STL r0,0*SZL(r3)
27 PPC_STL r2,2*SZL(r3) 27 PPC_STL r2,2*SZL(r3)
28 PPC_STL r3,3*SZL(r3) 28 PPC_STL r3,3*SZL(r3)
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 957bded0020d..fb7049c054c0 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -33,6 +33,7 @@
33#include <linux/mqueue.h> 33#include <linux/mqueue.h>
34#include <linux/hardirq.h> 34#include <linux/hardirq.h>
35#include <linux/utsname.h> 35#include <linux/utsname.h>
36#include <linux/kernel_stat.h>
36 37
37#include <asm/pgtable.h> 38#include <asm/pgtable.h>
38#include <asm/uaccess.h> 39#include <asm/uaccess.h>
@@ -467,6 +468,8 @@ static struct regbit {
467 {MSR_VEC, "VEC"}, 468 {MSR_VEC, "VEC"},
468 {MSR_VSX, "VSX"}, 469 {MSR_VSX, "VSX"},
469 {MSR_ME, "ME"}, 470 {MSR_ME, "ME"},
471 {MSR_CE, "CE"},
472 {MSR_DE, "DE"},
470 {MSR_IR, "IR"}, 473 {MSR_IR, "IR"},
471 {MSR_DR, "DR"}, 474 {MSR_DR, "DR"},
472 {0, NULL} 475 {0, NULL}
@@ -998,7 +1001,7 @@ unsigned long get_wchan(struct task_struct *p)
998 return 0; 1001 return 0;
999} 1002}
1000 1003
1001static int kstack_depth_to_print = 64; 1004static int kstack_depth_to_print = CONFIG_PRINT_STACK_DEPTH;
1002 1005
1003void show_stack(struct task_struct *tsk, unsigned long *stack) 1006void show_stack(struct task_struct *tsk, unsigned long *stack)
1004{ 1007{
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 3a2dc7e6586a..6f73c739f1e2 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1160,6 +1160,8 @@ static inline void __init phyp_dump_reserve_mem(void) {}
1160 1160
1161void __init early_init_devtree(void *params) 1161void __init early_init_devtree(void *params)
1162{ 1162{
1163 unsigned long limit;
1164
1163 DBG(" -> early_init_devtree(%p)\n", params); 1165 DBG(" -> early_init_devtree(%p)\n", params);
1164 1166
1165 /* Setup flat device-tree pointer */ 1167 /* Setup flat device-tree pointer */
@@ -1200,7 +1202,19 @@ void __init early_init_devtree(void *params)
1200 early_reserve_mem(); 1202 early_reserve_mem();
1201 phyp_dump_reserve_mem(); 1203 phyp_dump_reserve_mem();
1202 1204
1203 lmb_enforce_memory_limit(memory_limit); 1205 limit = memory_limit;
1206 if (! limit) {
1207 unsigned long memsize;
1208
1209 /* Ensure that total memory size is page-aligned, because
1210 * otherwise mark_bootmem() gets upset. */
1211 lmb_analyze();
1212 memsize = lmb_phys_mem_size();
1213 if ((memsize & PAGE_MASK) != memsize)
1214 limit = memsize & PAGE_MASK;
1215 }
1216 lmb_enforce_memory_limit(limit);
1217
1204 lmb_analyze(); 1218 lmb_analyze();
1205 1219
1206 DBG("Phys. mem: %lx\n", lmb_phys_mem_size()); 1220 DBG("Phys. mem: %lx\n", lmb_phys_mem_size());
@@ -1271,6 +1285,37 @@ struct device_node *of_find_node_by_phandle(phandle handle)
1271EXPORT_SYMBOL(of_find_node_by_phandle); 1285EXPORT_SYMBOL(of_find_node_by_phandle);
1272 1286
1273/** 1287/**
1288 * of_find_next_cache_node - Find a node's subsidiary cache
1289 * @np: node of type "cpu" or "cache"
1290 *
1291 * Returns a node pointer with refcount incremented, use
1292 * of_node_put() on it when done. Caller should hold a reference
1293 * to np.
1294 */
1295struct device_node *of_find_next_cache_node(struct device_node *np)
1296{
1297 struct device_node *child;
1298 const phandle *handle;
1299
1300 handle = of_get_property(np, "l2-cache", NULL);
1301 if (!handle)
1302 handle = of_get_property(np, "next-level-cache", NULL);
1303
1304 if (handle)
1305 return of_find_node_by_phandle(*handle);
1306
1307 /* OF on pmac has nodes instead of properties named "l2-cache"
1308 * beneath CPU nodes.
1309 */
1310 if (!strcmp(np->type, "cpu"))
1311 for_each_child_of_node(np, child)
1312 if (!strcmp(child->type, "cache"))
1313 return child;
1314
1315 return NULL;
1316}
1317
1318/**
1274 * of_find_all_nodes - Get next node in global list 1319 * of_find_all_nodes - Get next node in global list
1275 * @prev: Previous node or NULL to start iteration 1320 * @prev: Previous node or NULL to start iteration
1276 * of_node_put() will be called on it 1321 * of_node_put() will be called on it
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index a11d68976dc8..8c1335566089 100644
--- a/arch/powerpc/kernel/prom_parse.c
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -734,10 +734,7 @@ void of_irq_map_init(unsigned int flags)
734 if (flags & OF_IMAP_NO_PHANDLE) { 734 if (flags & OF_IMAP_NO_PHANDLE) {
735 struct device_node *np; 735 struct device_node *np;
736 736
737 for(np = NULL; (np = of_find_all_nodes(np)) != NULL;) { 737 for_each_node_with_property(np, "interrupt-controller") {
738 if (of_get_property(np, "interrupt-controller", NULL)
739 == NULL)
740 continue;
741 /* Skip /chosen/interrupt-controller */ 738 /* Skip /chosen/interrupt-controller */
742 if (strcmp(np->name, "chosen") == 0) 739 if (strcmp(np->name, "chosen") == 0)
743 continue; 740 continue;
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 1f8505c23548..fdfe14c4bdef 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -566,6 +566,32 @@ int rtas_get_sensor(int sensor, int index, int *state)
566} 566}
567EXPORT_SYMBOL(rtas_get_sensor); 567EXPORT_SYMBOL(rtas_get_sensor);
568 568
569bool rtas_indicator_present(int token, int *maxindex)
570{
571 int proplen, count, i;
572 const struct indicator_elem {
573 u32 token;
574 u32 maxindex;
575 } *indicators;
576
577 indicators = of_get_property(rtas.dev, "rtas-indicators", &proplen);
578 if (!indicators)
579 return false;
580
581 count = proplen / sizeof(struct indicator_elem);
582
583 for (i = 0; i < count; i++) {
584 if (indicators[i].token != token)
585 continue;
586 if (maxindex)
587 *maxindex = indicators[i].maxindex;
588 return true;
589 }
590
591 return false;
592}
593EXPORT_SYMBOL(rtas_indicator_present);
594
569int rtas_set_indicator(int indicator, int index, int new_value) 595int rtas_set_indicator(int indicator, int index, int new_value)
570{ 596{
571 int token = rtas_token("set-indicator"); 597 int token = rtas_token("set-indicator");
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index 589a2797eac2..8869001ab5d7 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -301,51 +301,3 @@ void __init find_and_init_phbs(void)
301#endif /* CONFIG_PPC32 */ 301#endif /* CONFIG_PPC32 */
302 } 302 }
303} 303}
304
305/* RPA-specific bits for removing PHBs */
306int pcibios_remove_root_bus(struct pci_controller *phb)
307{
308 struct pci_bus *b = phb->bus;
309 struct resource *res;
310 int rc, i;
311
312 res = b->resource[0];
313 if (!res->flags) {
314 printk(KERN_ERR "%s: no IO resource for PHB %s\n", __func__,
315 b->name);
316 return 1;
317 }
318
319 rc = pcibios_unmap_io_space(b);
320 if (rc) {
321 printk(KERN_ERR "%s: failed to unmap IO on bus %s\n",
322 __func__, b->name);
323 return 1;
324 }
325
326 if (release_resource(res)) {
327 printk(KERN_ERR "%s: failed to release IO on bus %s\n",
328 __func__, b->name);
329 return 1;
330 }
331
332 for (i = 1; i < 3; ++i) {
333 res = b->resource[i];
334 if (!res->flags && i == 0) {
335 printk(KERN_ERR "%s: no MEM resource for PHB %s\n",
336 __func__, b->name);
337 return 1;
338 }
339 if (res->flags && release_resource(res)) {
340 printk(KERN_ERR
341 "%s: failed to release IO %d on bus %s\n",
342 __func__, i, b->name);
343 return 1;
344 }
345 }
346
347 pcibios_free_controller(phb);
348
349 return 0;
350}
351EXPORT_SYMBOL(pcibios_remove_root_bus);
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index c1a27626a940..9e1ca745d8f0 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -38,6 +38,7 @@
38#include <asm/time.h> 38#include <asm/time.h>
39#include <asm/serial.h> 39#include <asm/serial.h>
40#include <asm/udbg.h> 40#include <asm/udbg.h>
41#include <asm/mmu_context.h>
41 42
42#include "setup.h" 43#include "setup.h"
43 44
@@ -49,12 +50,12 @@ int boot_cpuid;
49EXPORT_SYMBOL_GPL(boot_cpuid); 50EXPORT_SYMBOL_GPL(boot_cpuid);
50int boot_cpuid_phys; 51int boot_cpuid_phys;
51 52
53int smp_hw_index[NR_CPUS];
54
52unsigned long ISA_DMA_THRESHOLD; 55unsigned long ISA_DMA_THRESHOLD;
53unsigned int DMA_MODE_READ; 56unsigned int DMA_MODE_READ;
54unsigned int DMA_MODE_WRITE; 57unsigned int DMA_MODE_WRITE;
55 58
56int have_of = 1;
57
58#ifdef CONFIG_VGA_CONSOLE 59#ifdef CONFIG_VGA_CONSOLE
59unsigned long vgacon_remap_base; 60unsigned long vgacon_remap_base;
60EXPORT_SYMBOL(vgacon_remap_base); 61EXPORT_SYMBOL(vgacon_remap_base);
@@ -97,6 +98,10 @@ notrace unsigned long __init early_init(unsigned long dt_ptr)
97 PTRRELOC(&__start___ftr_fixup), 98 PTRRELOC(&__start___ftr_fixup),
98 PTRRELOC(&__stop___ftr_fixup)); 99 PTRRELOC(&__stop___ftr_fixup));
99 100
101 do_feature_fixups(spec->mmu_features,
102 PTRRELOC(&__start___mmu_ftr_fixup),
103 PTRRELOC(&__stop___mmu_ftr_fixup));
104
100 do_lwsync_fixups(spec->cpu_features, 105 do_lwsync_fixups(spec->cpu_features,
101 PTRRELOC(&__start___lwsync_fixup), 106 PTRRELOC(&__start___lwsync_fixup),
102 PTRRELOC(&__stop___lwsync_fixup)); 107 PTRRELOC(&__stop___lwsync_fixup));
@@ -121,6 +126,8 @@ notrace void __init machine_init(unsigned long dt_ptr)
121 126
122 probe_machine(); 127 probe_machine();
123 128
129 setup_kdump_trampoline();
130
124#ifdef CONFIG_6xx 131#ifdef CONFIG_6xx
125 if (cpu_has_feature(CPU_FTR_CAN_DOZE) || 132 if (cpu_has_feature(CPU_FTR_CAN_DOZE) ||
126 cpu_has_feature(CPU_FTR_CAN_NAP)) 133 cpu_has_feature(CPU_FTR_CAN_NAP))
@@ -326,4 +333,8 @@ void __init setup_arch(char **cmdline_p)
326 if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab); 333 if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab);
327 334
328 paging_init(); 335 paging_init();
336
337 /* Initialize the MMU context management stuff */
338 mmu_context_init();
339
329} 340}
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 169d74cef157..d8bd2161e738 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -70,7 +70,6 @@
70#define DBG(fmt...) 70#define DBG(fmt...)
71#endif 71#endif
72 72
73int have_of = 1;
74int boot_cpuid = 0; 73int boot_cpuid = 0;
75u64 ppc64_pft_size; 74u64 ppc64_pft_size;
76 75
@@ -362,6 +361,8 @@ void __init setup_system(void)
362 */ 361 */
363 do_feature_fixups(cur_cpu_spec->cpu_features, 362 do_feature_fixups(cur_cpu_spec->cpu_features,
364 &__start___ftr_fixup, &__stop___ftr_fixup); 363 &__start___ftr_fixup, &__stop___ftr_fixup);
364 do_feature_fixups(cur_cpu_spec->mmu_features,
365 &__start___mmu_ftr_fixup, &__stop___mmu_ftr_fixup);
365 do_feature_fixups(powerpc_firmware_features, 366 do_feature_fixups(powerpc_firmware_features,
366 &__start___fw_ftr_fixup, &__stop___fw_ftr_fixup); 367 &__start___fw_ftr_fixup, &__stop___fw_ftr_fixup);
367 do_lwsync_fixups(cur_cpu_spec->cpu_features, 368 do_lwsync_fixups(cur_cpu_spec->cpu_features,
@@ -606,8 +607,6 @@ void __init setup_per_cpu_areas(void)
606 607
607 for_each_possible_cpu(i) { 608 for_each_possible_cpu(i) {
608 ptr = alloc_bootmem_pages_node(NODE_DATA(cpu_to_node(i)), size); 609 ptr = alloc_bootmem_pages_node(NODE_DATA(cpu_to_node(i)), size);
609 if (!ptr)
610 panic("Cannot allocate cpu data for CPU %d\n", i);
611 610
612 paca[i].data_offset = ptr - __per_cpu_start; 611 paca[i].data_offset = ptr - __per_cpu_start;
613 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); 612 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
diff --git a/arch/powerpc/kernel/smp-tbsync.c b/arch/powerpc/kernel/smp-tbsync.c
index bc892e69b4f7..a5e54526403d 100644
--- a/arch/powerpc/kernel/smp-tbsync.c
+++ b/arch/powerpc/kernel/smp-tbsync.c
@@ -113,7 +113,7 @@ void __devinit smp_generic_give_timebase(void)
113{ 113{
114 int i, score, score2, old, min=0, max=5000, offset=1000; 114 int i, score, score2, old, min=0, max=5000, offset=1000;
115 115
116 printk("Synchronizing timebase\n"); 116 pr_debug("Software timebase sync\n");
117 117
118 /* if this fails then this kernel won't work anyway... */ 118 /* if this fails then this kernel won't work anyway... */
119 tbsync = kzalloc( sizeof(*tbsync), GFP_KERNEL ); 119 tbsync = kzalloc( sizeof(*tbsync), GFP_KERNEL );
@@ -123,13 +123,13 @@ void __devinit smp_generic_give_timebase(void)
123 while (!tbsync->ack) 123 while (!tbsync->ack)
124 barrier(); 124 barrier();
125 125
126 printk("Got ack\n"); 126 pr_debug("Got ack\n");
127 127
128 /* binary search */ 128 /* binary search */
129 for (old = -1; old != offset ; offset = (min+max) / 2) { 129 for (old = -1; old != offset ; offset = (min+max) / 2) {
130 score = start_contest(kSetAndTest, offset, NUM_ITER); 130 score = start_contest(kSetAndTest, offset, NUM_ITER);
131 131
132 printk("score %d, offset %d\n", score, offset ); 132 pr_debug("score %d, offset %d\n", score, offset );
133 133
134 if( score > 0 ) 134 if( score > 0 )
135 max = offset; 135 max = offset;
@@ -140,8 +140,8 @@ void __devinit smp_generic_give_timebase(void)
140 score = start_contest(kSetAndTest, min, NUM_ITER); 140 score = start_contest(kSetAndTest, min, NUM_ITER);
141 score2 = start_contest(kSetAndTest, max, NUM_ITER); 141 score2 = start_contest(kSetAndTest, max, NUM_ITER);
142 142
143 printk("Min %d (score %d), Max %d (score %d)\n", 143 pr_debug("Min %d (score %d), Max %d (score %d)\n",
144 min, score, max, score2); 144 min, score, max, score2);
145 score = abs(score); 145 score = abs(score);
146 score2 = abs(score2); 146 score2 = abs(score2);
147 offset = (score < score2) ? min : max; 147 offset = (score < score2) ? min : max;
@@ -155,7 +155,7 @@ void __devinit smp_generic_give_timebase(void)
155 if (score2 <= score || score2 < 20) 155 if (score2 <= score || score2 < 20)
156 break; 156 break;
157 } 157 }
158 printk("Final offset: %d (%d/%d)\n", offset, score2, NUM_ITER ); 158 pr_debug("Final offset: %d (%d/%d)\n", offset, score2, NUM_ITER );
159 159
160 /* exiting */ 160 /* exiting */
161 tbsync->cmd = kExit; 161 tbsync->cmd = kExit;
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index ff9f7010097d..65484b2200b3 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -57,16 +57,11 @@
57#define DBG(fmt...) 57#define DBG(fmt...)
58#endif 58#endif
59 59
60int smp_hw_index[NR_CPUS];
61struct thread_info *secondary_ti; 60struct thread_info *secondary_ti;
62 61
63cpumask_t cpu_possible_map = CPU_MASK_NONE;
64cpumask_t cpu_online_map = CPU_MASK_NONE;
65DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE; 62DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE;
66DEFINE_PER_CPU(cpumask_t, cpu_core_map) = CPU_MASK_NONE; 63DEFINE_PER_CPU(cpumask_t, cpu_core_map) = CPU_MASK_NONE;
67 64
68EXPORT_SYMBOL(cpu_online_map);
69EXPORT_SYMBOL(cpu_possible_map);
70EXPORT_PER_CPU_SYMBOL(cpu_sibling_map); 65EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
71EXPORT_PER_CPU_SYMBOL(cpu_core_map); 66EXPORT_PER_CPU_SYMBOL(cpu_core_map);
72 67
@@ -123,6 +118,65 @@ void smp_message_recv(int msg)
123 } 118 }
124} 119}
125 120
121static irqreturn_t call_function_action(int irq, void *data)
122{
123 generic_smp_call_function_interrupt();
124 return IRQ_HANDLED;
125}
126
127static irqreturn_t reschedule_action(int irq, void *data)
128{
129 /* we just need the return path side effect of checking need_resched */
130 return IRQ_HANDLED;
131}
132
133static irqreturn_t call_function_single_action(int irq, void *data)
134{
135 generic_smp_call_function_single_interrupt();
136 return IRQ_HANDLED;
137}
138
139static irqreturn_t debug_ipi_action(int irq, void *data)
140{
141 smp_message_recv(PPC_MSG_DEBUGGER_BREAK);
142 return IRQ_HANDLED;
143}
144
145static irq_handler_t smp_ipi_action[] = {
146 [PPC_MSG_CALL_FUNCTION] = call_function_action,
147 [PPC_MSG_RESCHEDULE] = reschedule_action,
148 [PPC_MSG_CALL_FUNC_SINGLE] = call_function_single_action,
149 [PPC_MSG_DEBUGGER_BREAK] = debug_ipi_action,
150};
151
152const char *smp_ipi_name[] = {
153 [PPC_MSG_CALL_FUNCTION] = "ipi call function",
154 [PPC_MSG_RESCHEDULE] = "ipi reschedule",
155 [PPC_MSG_CALL_FUNC_SINGLE] = "ipi call function single",
156 [PPC_MSG_DEBUGGER_BREAK] = "ipi debugger",
157};
158
159/* optional function to request ipi, for controllers with >= 4 ipis */
160int smp_request_message_ipi(int virq, int msg)
161{
162 int err;
163
164 if (msg < 0 || msg > PPC_MSG_DEBUGGER_BREAK) {
165 return -EINVAL;
166 }
167#if !defined(CONFIG_DEBUGGER) && !defined(CONFIG_KEXEC)
168 if (msg == PPC_MSG_DEBUGGER_BREAK) {
169 return 1;
170 }
171#endif
172 err = request_irq(virq, smp_ipi_action[msg], IRQF_DISABLED|IRQF_PERCPU,
173 smp_ipi_name[msg], 0);
174 WARN(err < 0, "unable to request_irq %d for %s (rc %d)\n",
175 virq, smp_ipi_name[msg], err);
176
177 return err;
178}
179
126void smp_send_reschedule(int cpu) 180void smp_send_reschedule(int cpu)
127{ 181{
128 if (likely(smp_ops)) 182 if (likely(smp_ops))
@@ -408,8 +462,7 @@ out:
408static struct device_node *cpu_to_l2cache(int cpu) 462static struct device_node *cpu_to_l2cache(int cpu)
409{ 463{
410 struct device_node *np; 464 struct device_node *np;
411 const phandle *php; 465 struct device_node *cache;
412 phandle ph;
413 466
414 if (!cpu_present(cpu)) 467 if (!cpu_present(cpu))
415 return NULL; 468 return NULL;
@@ -418,13 +471,11 @@ static struct device_node *cpu_to_l2cache(int cpu)
418 if (np == NULL) 471 if (np == NULL)
419 return NULL; 472 return NULL;
420 473
421 php = of_get_property(np, "l2-cache", NULL); 474 cache = of_find_next_cache_node(np);
422 if (php == NULL) 475
423 return NULL;
424 ph = *php;
425 of_node_put(np); 476 of_node_put(np);
426 477
427 return of_find_node_by_phandle(ph); 478 return cache;
428} 479}
429 480
430/* Activate a secondary processor. */ 481/* Activate a secondary processor. */
diff --git a/arch/powerpc/kernel/swsusp.c b/arch/powerpc/kernel/swsusp.c
index 77b7b34b5955..560c96119501 100644
--- a/arch/powerpc/kernel/swsusp.c
+++ b/arch/powerpc/kernel/swsusp.c
@@ -34,6 +34,6 @@ void save_processor_state(void)
34void restore_processor_state(void) 34void restore_processor_state(void)
35{ 35{
36#ifdef CONFIG_PPC32 36#ifdef CONFIG_PPC32
37 set_context(current->active_mm->context.id, current->active_mm->pgd); 37 switch_mmu_context(NULL, current->active_mm);
38#endif 38#endif
39} 39}
diff --git a/arch/powerpc/kernel/swsusp_32.S b/arch/powerpc/kernel/swsusp_32.S
index 77fc76607ab2..b47d8ceffb52 100644
--- a/arch/powerpc/kernel/swsusp_32.S
+++ b/arch/powerpc/kernel/swsusp_32.S
@@ -5,7 +5,7 @@
5#include <asm/thread_info.h> 5#include <asm/thread_info.h>
6#include <asm/ppc_asm.h> 6#include <asm/ppc_asm.h>
7#include <asm/asm-offsets.h> 7#include <asm/asm-offsets.h>
8 8#include <asm/mmu.h>
9 9
10/* 10/*
11 * Structure for storing CPU registers on the save area. 11 * Structure for storing CPU registers on the save area.
@@ -279,7 +279,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
279 mtibatl 3,r4 279 mtibatl 3,r4
280#endif 280#endif
281 281
282BEGIN_FTR_SECTION 282BEGIN_MMU_FTR_SECTION
283 li r4,0 283 li r4,0
284 mtspr SPRN_DBAT4U,r4 284 mtspr SPRN_DBAT4U,r4
285 mtspr SPRN_DBAT4L,r4 285 mtspr SPRN_DBAT4L,r4
@@ -297,7 +297,7 @@ BEGIN_FTR_SECTION
297 mtspr SPRN_IBAT6L,r4 297 mtspr SPRN_IBAT6L,r4
298 mtspr SPRN_IBAT7U,r4 298 mtspr SPRN_IBAT7U,r4
299 mtspr SPRN_IBAT7L,r4 299 mtspr SPRN_IBAT7L,r4
300END_FTR_SECTION_IFSET(CPU_FTR_HAS_HIGH_BATS) 300END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_HIGH_BATS)
301 301
302 /* Flush all TLBs */ 302 /* Flush all TLBs */
303 lis r4,0x1000 303 lis r4,0x1000
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 20885a38237a..0c64f10087b9 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -566,7 +566,6 @@ static bool cache_is_unified(struct device_node *np)
566 566
567static struct cache_desc * __cpuinit create_cache_index_info(struct device_node *np, struct kobject *parent, int index, int level) 567static struct cache_desc * __cpuinit create_cache_index_info(struct device_node *np, struct kobject *parent, int index, int level)
568{ 568{
569 const phandle *next_cache_phandle;
570 struct device_node *next_cache; 569 struct device_node *next_cache;
571 struct cache_desc *new, **end; 570 struct cache_desc *new, **end;
572 571
@@ -591,11 +590,7 @@ static struct cache_desc * __cpuinit create_cache_index_info(struct device_node
591 while (*end) 590 while (*end)
592 end = &(*end)->next; 591 end = &(*end)->next;
593 592
594 next_cache_phandle = of_get_property(np, "l2-cache", NULL); 593 next_cache = of_find_next_cache_node(np);
595 if (!next_cache_phandle)
596 goto out;
597
598 next_cache = of_find_node_by_phandle(*next_cache_phandle);
599 if (!next_cache) 594 if (!next_cache)
600 goto out; 595 goto out;
601 596
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index e2ee66b5831d..c9564031a2a9 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -164,8 +164,6 @@ static u64 tb_to_ns_scale __read_mostly;
164static unsigned tb_to_ns_shift __read_mostly; 164static unsigned tb_to_ns_shift __read_mostly;
165static unsigned long boot_tb __read_mostly; 165static unsigned long boot_tb __read_mostly;
166 166
167static struct gettimeofday_struct do_gtod;
168
169extern struct timezone sys_tz; 167extern struct timezone sys_tz;
170static long timezone_offset; 168static long timezone_offset;
171 169
@@ -258,8 +256,10 @@ void account_system_vtime(struct task_struct *tsk)
258 delta += sys_time; 256 delta += sys_time;
259 get_paca()->system_time = 0; 257 get_paca()->system_time = 0;
260 } 258 }
261 account_system_time(tsk, 0, delta); 259 if (in_irq() || idle_task(smp_processor_id()) != tsk)
262 account_system_time_scaled(tsk, deltascaled); 260 account_system_time(tsk, 0, delta, deltascaled);
261 else
262 account_idle_time(delta);
263 per_cpu(cputime_last_delta, smp_processor_id()) = delta; 263 per_cpu(cputime_last_delta, smp_processor_id()) = delta;
264 per_cpu(cputime_scaled_last_delta, smp_processor_id()) = deltascaled; 264 per_cpu(cputime_scaled_last_delta, smp_processor_id()) = deltascaled;
265 local_irq_restore(flags); 265 local_irq_restore(flags);
@@ -277,10 +277,8 @@ void account_process_tick(struct task_struct *tsk, int user_tick)
277 277
278 utime = get_paca()->user_time; 278 utime = get_paca()->user_time;
279 get_paca()->user_time = 0; 279 get_paca()->user_time = 0;
280 account_user_time(tsk, utime);
281
282 utimescaled = cputime_to_scaled(utime); 280 utimescaled = cputime_to_scaled(utime);
283 account_user_time_scaled(tsk, utimescaled); 281 account_user_time(tsk, utime, utimescaled);
284} 282}
285 283
286/* 284/*
@@ -340,8 +338,12 @@ void calculate_steal_time(void)
340 tb = mftb(); 338 tb = mftb();
341 purr = mfspr(SPRN_PURR); 339 purr = mfspr(SPRN_PURR);
342 stolen = (tb - pme->tb) - (purr - pme->purr); 340 stolen = (tb - pme->tb) - (purr - pme->purr);
343 if (stolen > 0) 341 if (stolen > 0) {
344 account_steal_time(current, stolen); 342 if (idle_task(smp_processor_id()) != current)
343 account_steal_time(stolen);
344 else
345 account_idle_time(stolen);
346 }
345 pme->tb = tb; 347 pme->tb = tb;
346 pme->purr = purr; 348 pme->purr = purr;
347} 349}
@@ -415,31 +417,9 @@ void udelay(unsigned long usecs)
415} 417}
416EXPORT_SYMBOL(udelay); 418EXPORT_SYMBOL(udelay);
417 419
418
419/*
420 * There are two copies of tb_to_xs and stamp_xsec so that no
421 * lock is needed to access and use these values in
422 * do_gettimeofday. We alternate the copies and as long as a
423 * reasonable time elapses between changes, there will never
424 * be inconsistent values. ntpd has a minimum of one minute
425 * between updates.
426 */
427static inline void update_gtod(u64 new_tb_stamp, u64 new_stamp_xsec, 420static inline void update_gtod(u64 new_tb_stamp, u64 new_stamp_xsec,
428 u64 new_tb_to_xs) 421 u64 new_tb_to_xs)
429{ 422{
430 unsigned temp_idx;
431 struct gettimeofday_vars *temp_varp;
432
433 temp_idx = (do_gtod.var_idx == 0);
434 temp_varp = &do_gtod.vars[temp_idx];
435
436 temp_varp->tb_to_xs = new_tb_to_xs;
437 temp_varp->tb_orig_stamp = new_tb_stamp;
438 temp_varp->stamp_xsec = new_stamp_xsec;
439 smp_mb();
440 do_gtod.varp = temp_varp;
441 do_gtod.var_idx = temp_idx;
442
443 /* 423 /*
444 * tb_update_count is used to allow the userspace gettimeofday code 424 * tb_update_count is used to allow the userspace gettimeofday code
445 * to assure itself that it sees a consistent view of the tb_to_xs and 425 * to assure itself that it sees a consistent view of the tb_to_xs and
@@ -456,6 +436,7 @@ static inline void update_gtod(u64 new_tb_stamp, u64 new_stamp_xsec,
456 vdso_data->tb_to_xs = new_tb_to_xs; 436 vdso_data->tb_to_xs = new_tb_to_xs;
457 vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec; 437 vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec;
458 vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec; 438 vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec;
439 vdso_data->stamp_xtime = xtime;
459 smp_wmb(); 440 smp_wmb();
460 ++(vdso_data->tb_update_count); 441 ++(vdso_data->tb_update_count);
461} 442}
@@ -514,9 +495,7 @@ static int __init iSeries_tb_recal(void)
514 tb_ticks_per_sec = new_tb_ticks_per_sec; 495 tb_ticks_per_sec = new_tb_ticks_per_sec;
515 calc_cputime_factors(); 496 calc_cputime_factors();
516 div128_by_32( XSEC_PER_SEC, 0, tb_ticks_per_sec, &divres ); 497 div128_by_32( XSEC_PER_SEC, 0, tb_ticks_per_sec, &divres );
517 do_gtod.tb_ticks_per_sec = tb_ticks_per_sec;
518 tb_to_xs = divres.result_low; 498 tb_to_xs = divres.result_low;
519 do_gtod.varp->tb_to_xs = tb_to_xs;
520 vdso_data->tb_ticks_per_sec = tb_ticks_per_sec; 499 vdso_data->tb_ticks_per_sec = tb_ticks_per_sec;
521 vdso_data->tb_to_xs = tb_to_xs; 500 vdso_data->tb_to_xs = tb_to_xs;
522 } 501 }
@@ -869,7 +848,7 @@ static void register_decrementer_clockevent(int cpu)
869 struct clock_event_device *dec = &per_cpu(decrementers, cpu).event; 848 struct clock_event_device *dec = &per_cpu(decrementers, cpu).event;
870 849
871 *dec = decrementer_clockevent; 850 *dec = decrementer_clockevent;
872 dec->cpumask = cpumask_of_cpu(cpu); 851 dec->cpumask = cpumask_of(cpu);
873 852
874 printk(KERN_DEBUG "clockevent: %s mult[%lx] shift[%d] cpu[%d]\n", 853 printk(KERN_DEBUG "clockevent: %s mult[%lx] shift[%d] cpu[%d]\n",
875 dec->name, dec->mult, dec->shift, cpu); 854 dec->name, dec->mult, dec->shift, cpu);
@@ -988,15 +967,6 @@ void __init time_init(void)
988 sys_tz.tz_dsttime = 0; 967 sys_tz.tz_dsttime = 0;
989 } 968 }
990 969
991 do_gtod.varp = &do_gtod.vars[0];
992 do_gtod.var_idx = 0;
993 do_gtod.varp->tb_orig_stamp = tb_last_jiffy;
994 __get_cpu_var(last_jiffy) = tb_last_jiffy;
995 do_gtod.varp->stamp_xsec = (u64) xtime.tv_sec * XSEC_PER_SEC;
996 do_gtod.tb_ticks_per_sec = tb_ticks_per_sec;
997 do_gtod.varp->tb_to_xs = tb_to_xs;
998 do_gtod.tb_to_us = tb_to_us;
999
1000 vdso_data->tb_orig_stamp = tb_last_jiffy; 970 vdso_data->tb_orig_stamp = tb_last_jiffy;
1001 vdso_data->tb_update_count = 0; 971 vdso_data->tb_update_count = 0;
1002 vdso_data->tb_ticks_per_sec = tb_ticks_per_sec; 972 vdso_data->tb_ticks_per_sec = tb_ticks_per_sec;
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index f5def6cf5cd6..5457e9575685 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -1160,37 +1160,85 @@ void CacheLockingException(struct pt_regs *regs, unsigned long address,
1160#ifdef CONFIG_SPE 1160#ifdef CONFIG_SPE
1161void SPEFloatingPointException(struct pt_regs *regs) 1161void SPEFloatingPointException(struct pt_regs *regs)
1162{ 1162{
1163 extern int do_spe_mathemu(struct pt_regs *regs);
1163 unsigned long spefscr; 1164 unsigned long spefscr;
1164 int fpexc_mode; 1165 int fpexc_mode;
1165 int code = 0; 1166 int code = 0;
1167 int err;
1168
1169 preempt_disable();
1170 if (regs->msr & MSR_SPE)
1171 giveup_spe(current);
1172 preempt_enable();
1166 1173
1167 spefscr = current->thread.spefscr; 1174 spefscr = current->thread.spefscr;
1168 fpexc_mode = current->thread.fpexc_mode; 1175 fpexc_mode = current->thread.fpexc_mode;
1169 1176
1170 /* Hardware does not neccessarily set sticky
1171 * underflow/overflow/invalid flags */
1172 if ((spefscr & SPEFSCR_FOVF) && (fpexc_mode & PR_FP_EXC_OVF)) { 1177 if ((spefscr & SPEFSCR_FOVF) && (fpexc_mode & PR_FP_EXC_OVF)) {
1173 code = FPE_FLTOVF; 1178 code = FPE_FLTOVF;
1174 spefscr |= SPEFSCR_FOVFS;
1175 } 1179 }
1176 else if ((spefscr & SPEFSCR_FUNF) && (fpexc_mode & PR_FP_EXC_UND)) { 1180 else if ((spefscr & SPEFSCR_FUNF) && (fpexc_mode & PR_FP_EXC_UND)) {
1177 code = FPE_FLTUND; 1181 code = FPE_FLTUND;
1178 spefscr |= SPEFSCR_FUNFS;
1179 } 1182 }
1180 else if ((spefscr & SPEFSCR_FDBZ) && (fpexc_mode & PR_FP_EXC_DIV)) 1183 else if ((spefscr & SPEFSCR_FDBZ) && (fpexc_mode & PR_FP_EXC_DIV))
1181 code = FPE_FLTDIV; 1184 code = FPE_FLTDIV;
1182 else if ((spefscr & SPEFSCR_FINV) && (fpexc_mode & PR_FP_EXC_INV)) { 1185 else if ((spefscr & SPEFSCR_FINV) && (fpexc_mode & PR_FP_EXC_INV)) {
1183 code = FPE_FLTINV; 1186 code = FPE_FLTINV;
1184 spefscr |= SPEFSCR_FINVS;
1185 } 1187 }
1186 else if ((spefscr & (SPEFSCR_FG | SPEFSCR_FX)) && (fpexc_mode & PR_FP_EXC_RES)) 1188 else if ((spefscr & (SPEFSCR_FG | SPEFSCR_FX)) && (fpexc_mode & PR_FP_EXC_RES))
1187 code = FPE_FLTRES; 1189 code = FPE_FLTRES;
1188 1190
1189 current->thread.spefscr = spefscr; 1191 err = do_spe_mathemu(regs);
1192 if (err == 0) {
1193 regs->nip += 4; /* skip emulated instruction */
1194 emulate_single_step(regs);
1195 return;
1196 }
1197
1198 if (err == -EFAULT) {
1199 /* got an error reading the instruction */
1200 _exception(SIGSEGV, regs, SEGV_ACCERR, regs->nip);
1201 } else if (err == -EINVAL) {
1202 /* didn't recognize the instruction */
1203 printk(KERN_ERR "unrecognized spe instruction "
1204 "in %s at %lx\n", current->comm, regs->nip);
1205 } else {
1206 _exception(SIGFPE, regs, code, regs->nip);
1207 }
1190 1208
1191 _exception(SIGFPE, regs, code, regs->nip);
1192 return; 1209 return;
1193} 1210}
1211
1212void SPEFloatingPointRoundException(struct pt_regs *regs)
1213{
1214 extern int speround_handler(struct pt_regs *regs);
1215 int err;
1216
1217 preempt_disable();
1218 if (regs->msr & MSR_SPE)
1219 giveup_spe(current);
1220 preempt_enable();
1221
1222 regs->nip -= 4;
1223 err = speround_handler(regs);
1224 if (err == 0) {
1225 regs->nip += 4; /* skip emulated instruction */
1226 emulate_single_step(regs);
1227 return;
1228 }
1229
1230 if (err == -EFAULT) {
1231 /* got an error reading the instruction */
1232 _exception(SIGSEGV, regs, SEGV_ACCERR, regs->nip);
1233 } else if (err == -EINVAL) {
1234 /* didn't recognize the instruction */
1235 printk(KERN_ERR "unrecognized spe instruction "
1236 "in %s at %lx\n", current->comm, regs->nip);
1237 } else {
1238 _exception(SIGFPE, regs, 0, regs->nip);
1239 return;
1240 }
1241}
1194#endif 1242#endif
1195 1243
1196/* 1244/*
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 65639a43e644..ad06d5c75b15 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -184,8 +184,7 @@ static void dump_vdso_pages(struct vm_area_struct * vma)
184 * This is called from binfmt_elf, we create the special vma for the 184 * This is called from binfmt_elf, we create the special vma for the
185 * vDSO and insert it into the mm struct tree 185 * vDSO and insert it into the mm struct tree
186 */ 186 */
187int arch_setup_additional_pages(struct linux_binprm *bprm, 187int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
188 int executable_stack)
189{ 188{
190 struct mm_struct *mm = current->mm; 189 struct mm_struct *mm = current->mm;
191 struct page **vdso_pagelist; 190 struct page **vdso_pagelist;
@@ -567,6 +566,11 @@ static __init int vdso_fixup_features(struct lib32_elfinfo *v32,
567 do_feature_fixups(cur_cpu_spec->cpu_features, 566 do_feature_fixups(cur_cpu_spec->cpu_features,
568 start64, start64 + size64); 567 start64, start64 + size64);
569 568
569 start64 = find_section64(v64->hdr, "__mmu_ftr_fixup", &size64);
570 if (start64)
571 do_feature_fixups(cur_cpu_spec->mmu_features,
572 start64, start64 + size64);
573
570 start64 = find_section64(v64->hdr, "__fw_ftr_fixup", &size64); 574 start64 = find_section64(v64->hdr, "__fw_ftr_fixup", &size64);
571 if (start64) 575 if (start64)
572 do_feature_fixups(powerpc_firmware_features, 576 do_feature_fixups(powerpc_firmware_features,
@@ -583,6 +587,11 @@ static __init int vdso_fixup_features(struct lib32_elfinfo *v32,
583 do_feature_fixups(cur_cpu_spec->cpu_features, 587 do_feature_fixups(cur_cpu_spec->cpu_features,
584 start32, start32 + size32); 588 start32, start32 + size32);
585 589
590 start32 = find_section32(v32->hdr, "__mmu_ftr_fixup", &size32);
591 if (start32)
592 do_feature_fixups(cur_cpu_spec->mmu_features,
593 start32, start32 + size32);
594
586#ifdef CONFIG_PPC64 595#ifdef CONFIG_PPC64
587 start32 = find_section32(v32->hdr, "__fw_ftr_fixup", &size32); 596 start32 = find_section32(v32->hdr, "__fw_ftr_fixup", &size32);
588 if (start32) 597 if (start32)
diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S b/arch/powerpc/kernel/vdso32/gettimeofday.S
index 72ca26df457e..ee038d4bf252 100644
--- a/arch/powerpc/kernel/vdso32/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso32/gettimeofday.S
@@ -16,6 +16,13 @@
16#include <asm/asm-offsets.h> 16#include <asm/asm-offsets.h>
17#include <asm/unistd.h> 17#include <asm/unistd.h>
18 18
19/* Offset for the low 32-bit part of a field of long type */
20#ifdef CONFIG_PPC64
21#define LOPART 4
22#else
23#define LOPART 0
24#endif
25
19 .text 26 .text
20/* 27/*
21 * Exact prototype of gettimeofday 28 * Exact prototype of gettimeofday
@@ -90,101 +97,53 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
90 97
91 mflr r12 /* r12 saves lr */ 98 mflr r12 /* r12 saves lr */
92 .cfi_register lr,r12 99 .cfi_register lr,r12
93 mr r10,r3 /* r10 saves id */
94 mr r11,r4 /* r11 saves tp */ 100 mr r11,r4 /* r11 saves tp */
95 bl __get_datapage@local /* get data page */ 101 bl __get_datapage@local /* get data page */
96 mr r9,r3 /* datapage ptr in r9 */ 102 mr r9,r3 /* datapage ptr in r9 */
97 beq cr1,50f /* if monotonic -> jump there */
98
99 /*
100 * CLOCK_REALTIME
101 */
102
103 bl __do_get_xsec@local /* get xsec from tb & kernel */
104 bne- 98f /* out of line -> do syscall */
105
106 /* seconds are xsec >> 20 */
107 rlwinm r5,r4,12,20,31
108 rlwimi r5,r3,12,0,19
109 stw r5,TSPC32_TV_SEC(r11)
110 103
111 /* get remaining xsec and convert to nsec. we scale 10450: bl __do_get_tspec@local /* get sec/nsec from tb & kernel */
112 * up remaining xsec by 12 bits and get the top 32 bits 105 bne cr1,80f /* not monotonic -> all done */
113 * of the multiplication, then we multiply by 1000
114 */
115 rlwinm r5,r4,12,0,19
116 lis r6,1000000@h
117 ori r6,r6,1000000@l
118 mulhwu r5,r5,r6
119 mulli r5,r5,1000
120 stw r5,TSPC32_TV_NSEC(r11)
121 mtlr r12
122 crclr cr0*4+so
123 li r3,0
124 blr
125 106
126 /* 107 /*
127 * CLOCK_MONOTONIC 108 * CLOCK_MONOTONIC
128 */ 109 */
129 110
13050: bl __do_get_xsec@local /* get xsec from tb & kernel */
131 bne- 98f /* out of line -> do syscall */
132
133 /* seconds are xsec >> 20 */
134 rlwinm r6,r4,12,20,31
135 rlwimi r6,r3,12,0,19
136
137 /* get remaining xsec and convert to nsec. we scale
138 * up remaining xsec by 12 bits and get the top 32 bits
139 * of the multiplication, then we multiply by 1000
140 */
141 rlwinm r7,r4,12,0,19
142 lis r5,1000000@h
143 ori r5,r5,1000000@l
144 mulhwu r7,r7,r5
145 mulli r7,r7,1000
146
147 /* now we must fixup using wall to monotonic. We need to snapshot 111 /* now we must fixup using wall to monotonic. We need to snapshot
148 * that value and do the counter trick again. Fortunately, we still 112 * that value and do the counter trick again. Fortunately, we still
149 * have the counter value in r8 that was returned by __do_get_xsec. 113 * have the counter value in r8 that was returned by __do_get_xsec.
150 * At this point, r6,r7 contain our sec/nsec values, r3,r4 and r5 114 * At this point, r3,r4 contain our sec/nsec values, r5 and r6
151 * can be used 115 * can be used, r7 contains NSEC_PER_SEC.
152 */ 116 */
153 117
154 lwz r3,WTOM_CLOCK_SEC(r9) 118 lwz r5,WTOM_CLOCK_SEC(r9)
155 lwz r4,WTOM_CLOCK_NSEC(r9) 119 lwz r6,WTOM_CLOCK_NSEC(r9)
156 120
157 /* We now have our result in r3,r4. We create a fake dependency 121 /* We now have our offset in r5,r6. We create a fake dependency
158 * on that result and re-check the counter 122 * on that value and re-check the counter
159 */ 123 */
160 or r5,r4,r3 124 or r0,r6,r5
161 xor r0,r5,r5 125 xor r0,r0,r0
162 add r9,r9,r0 126 add r9,r9,r0
163#ifdef CONFIG_PPC64 127 lwz r0,(CFG_TB_UPDATE_COUNT+LOPART)(r9)
164 lwz r0,(CFG_TB_UPDATE_COUNT+4)(r9)
165#else
166 lwz r0,(CFG_TB_UPDATE_COUNT)(r9)
167#endif
168 cmpl cr0,r8,r0 /* check if updated */ 128 cmpl cr0,r8,r0 /* check if updated */
169 bne- 50b 129 bne- 50b
170 130
171 /* Calculate and store result. Note that this mimmics the C code, 131 /* Calculate and store result. Note that this mimics the C code,
172 * which may cause funny results if nsec goes negative... is that 132 * which may cause funny results if nsec goes negative... is that
173 * possible at all ? 133 * possible at all ?
174 */ 134 */
175 add r3,r3,r6 135 add r3,r3,r5
176 add r4,r4,r7 136 add r4,r4,r6
177 lis r5,NSEC_PER_SEC@h 137 cmpw cr0,r4,r7
178 ori r5,r5,NSEC_PER_SEC@l 138 cmpwi cr1,r4,0
179 cmpl cr0,r4,r5
180 cmpli cr1,r4,0
181 blt 1f 139 blt 1f
182 subf r4,r5,r4 140 subf r4,r7,r4
183 addi r3,r3,1 141 addi r3,r3,1
1841: bge cr1,1f 1421: bge cr1,80f
185 addi r3,r3,-1 143 addi r3,r3,-1
186 add r4,r4,r5 144 add r4,r4,r7
1871: stw r3,TSPC32_TV_SEC(r11) 145
14680: stw r3,TSPC32_TV_SEC(r11)
188 stw r4,TSPC32_TV_NSEC(r11) 147 stw r4,TSPC32_TV_NSEC(r11)
189 148
190 mtlr r12 149 mtlr r12
@@ -195,10 +154,6 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
195 /* 154 /*
196 * syscall fallback 155 * syscall fallback
197 */ 156 */
19898:
199 mtlr r12
200 mr r3,r10
201 mr r4,r11
20299: 15799:
203 li r0,__NR_clock_gettime 158 li r0,__NR_clock_gettime
204 sc 159 sc
@@ -254,11 +209,7 @@ __do_get_xsec:
254 /* Check for update count & load values. We use the low 209 /* Check for update count & load values. We use the low
255 * order 32 bits of the update count 210 * order 32 bits of the update count
256 */ 211 */
257#ifdef CONFIG_PPC64 2121: lwz r8,(CFG_TB_UPDATE_COUNT+LOPART)(r9)
2581: lwz r8,(CFG_TB_UPDATE_COUNT+4)(r9)
259#else
2601: lwz r8,(CFG_TB_UPDATE_COUNT)(r9)
261#endif
262 andi. r0,r8,1 /* pending update ? loop */ 213 andi. r0,r8,1 /* pending update ? loop */
263 bne- 1b 214 bne- 1b
264 xor r0,r8,r8 /* create dependency */ 215 xor r0,r8,r8 /* create dependency */
@@ -305,11 +256,7 @@ __do_get_xsec:
305 or r6,r4,r3 256 or r6,r4,r3
306 xor r0,r6,r6 257 xor r0,r6,r6
307 add r9,r9,r0 258 add r9,r9,r0
308#ifdef CONFIG_PPC64 259 lwz r0,(CFG_TB_UPDATE_COUNT+LOPART)(r9)
309 lwz r0,(CFG_TB_UPDATE_COUNT+4)(r9)
310#else
311 lwz r0,(CFG_TB_UPDATE_COUNT)(r9)
312#endif
313 cmpl cr0,r8,r0 /* check if updated */ 260 cmpl cr0,r8,r0 /* check if updated */
314 bne- 1b 261 bne- 1b
315 262
@@ -322,3 +269,98 @@ __do_get_xsec:
322 */ 269 */
3233: blr 2703: blr
324 .cfi_endproc 271 .cfi_endproc
272
273/*
274 * This is the core of clock_gettime(), it returns the current
275 * time in seconds and nanoseconds in r3 and r4.
276 * It expects the datapage ptr in r9 and doesn't clobber it.
277 * It clobbers r0, r5, r6, r10 and returns NSEC_PER_SEC in r7.
278 * On return, r8 contains the counter value that can be reused.
279 * This clobbers cr0 but not any other cr field.
280 */
281__do_get_tspec:
282 .cfi_startproc
283 /* Check for update count & load values. We use the low
284 * order 32 bits of the update count
285 */
2861: lwz r8,(CFG_TB_UPDATE_COUNT+LOPART)(r9)
287 andi. r0,r8,1 /* pending update ? loop */
288 bne- 1b
289 xor r0,r8,r8 /* create dependency */
290 add r9,r9,r0
291
292 /* Load orig stamp (offset to TB) */
293 lwz r5,CFG_TB_ORIG_STAMP(r9)
294 lwz r6,(CFG_TB_ORIG_STAMP+4)(r9)
295
296 /* Get a stable TB value */
2972: mftbu r3
298 mftbl r4
299 mftbu r0
300 cmpl cr0,r3,r0
301 bne- 2b
302
303 /* Subtract tb orig stamp and shift left 12 bits.
304 */
305 subfc r7,r6,r4
306 subfe r0,r5,r3
307 slwi r0,r0,12
308 rlwimi. r0,r7,12,20,31
309 slwi r7,r7,12
310
311 /* Load scale factor & do multiplication */
312 lwz r5,CFG_TB_TO_XS(r9) /* load values */
313 lwz r6,(CFG_TB_TO_XS+4)(r9)
314 mulhwu r3,r7,r6
315 mullw r10,r7,r5
316 mulhwu r4,r7,r5
317 addc r10,r3,r10
318 li r3,0
319
320 beq+ 4f /* skip high part computation if 0 */
321 mulhwu r3,r0,r5
322 mullw r7,r0,r5
323 mulhwu r5,r0,r6
324 mullw r6,r0,r6
325 adde r4,r4,r7
326 addze r3,r3
327 addc r4,r4,r5
328 addze r3,r3
329 addc r10,r10,r6
330
3314: addze r4,r4 /* add in carry */
332 lis r7,NSEC_PER_SEC@h
333 ori r7,r7,NSEC_PER_SEC@l
334 mulhwu r4,r4,r7 /* convert to nanoseconds */
335
336 /* At this point, we have seconds & nanoseconds since the xtime
337 * stamp in r3+CA and r4. Load & add the xtime stamp.
338 */
339#ifdef CONFIG_PPC64
340 lwz r5,STAMP_XTIME+TSPC64_TV_SEC+LOPART(r9)
341 lwz r6,STAMP_XTIME+TSPC64_TV_NSEC+LOPART(r9)
342#else
343 lwz r5,STAMP_XTIME+TSPC32_TV_SEC(r9)
344 lwz r6,STAMP_XTIME+TSPC32_TV_NSEC(r9)
345#endif
346 add r4,r4,r6
347 adde r3,r3,r5
348
349 /* We now have our result in r3,r4. We create a fake dependency
350 * on that result and re-check the counter
351 */
352 or r6,r4,r3
353 xor r0,r6,r6
354 add r9,r9,r0
355 lwz r0,(CFG_TB_UPDATE_COUNT+LOPART)(r9)
356 cmpl cr0,r8,r0 /* check if updated */
357 bne- 1b
358
359 /* check for nanosecond overflow and adjust if necessary */
360 cmpw r4,r7
361 bltlr /* all done if no overflow */
362 subf r4,r7,r4 /* adjust if overflow */
363 addi r3,r3,1
364
365 blr
366 .cfi_endproc
diff --git a/arch/powerpc/kernel/vdso32/vdso32.lds.S b/arch/powerpc/kernel/vdso32/vdso32.lds.S
index be3b6a41dc09..904ef1360dd7 100644
--- a/arch/powerpc/kernel/vdso32/vdso32.lds.S
+++ b/arch/powerpc/kernel/vdso32/vdso32.lds.S
@@ -34,6 +34,9 @@ SECTIONS
34 __ftr_fixup : { *(__ftr_fixup) } 34 __ftr_fixup : { *(__ftr_fixup) }
35 35
36 . = ALIGN(8); 36 . = ALIGN(8);
37 __mmu_ftr_fixup : { *(__mmu_ftr_fixup) }
38
39 . = ALIGN(8);
37 __lwsync_fixup : { *(__lwsync_fixup) } 40 __lwsync_fixup : { *(__lwsync_fixup) }
38 41
39#ifdef CONFIG_PPC64 42#ifdef CONFIG_PPC64
diff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S
index c6401f9e37f1..262cd5857a56 100644
--- a/arch/powerpc/kernel/vdso64/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso64/gettimeofday.S
@@ -75,90 +75,49 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
75 75
76 mflr r12 /* r12 saves lr */ 76 mflr r12 /* r12 saves lr */
77 .cfi_register lr,r12 77 .cfi_register lr,r12
78 mr r10,r3 /* r10 saves id */
79 mr r11,r4 /* r11 saves tp */ 78 mr r11,r4 /* r11 saves tp */
80 bl V_LOCAL_FUNC(__get_datapage) /* get data page */ 79 bl V_LOCAL_FUNC(__get_datapage) /* get data page */
81 beq cr1,50f /* if monotonic -> jump there */ 8050: bl V_LOCAL_FUNC(__do_get_tspec) /* get time from tb & kernel */
82 81 bne cr1,80f /* if not monotonic, all done */
83 /*
84 * CLOCK_REALTIME
85 */
86
87 bl V_LOCAL_FUNC(__do_get_xsec) /* get xsec from tb & kernel */
88
89 lis r7,15 /* r7 = 1000000 = USEC_PER_SEC */
90 ori r7,r7,16960
91 rldicl r5,r4,44,20 /* r5 = sec = xsec / XSEC_PER_SEC */
92 rldicr r6,r5,20,43 /* r6 = sec * XSEC_PER_SEC */
93 std r5,TSPC64_TV_SEC(r11) /* store sec in tv */
94 subf r0,r6,r4 /* r0 = xsec = (xsec - r6) */
95 mulld r0,r0,r7 /* usec = (xsec * USEC_PER_SEC) /
96 * XSEC_PER_SEC
97 */
98 rldicl r0,r0,44,20
99 mulli r0,r0,1000 /* nsec = usec * 1000 */
100 std r0,TSPC64_TV_NSEC(r11) /* store nsec in tp */
101
102 mtlr r12
103 crclr cr0*4+so
104 li r3,0
105 blr
106 82
107 /* 83 /*
108 * CLOCK_MONOTONIC 84 * CLOCK_MONOTONIC
109 */ 85 */
110 86
11150: bl V_LOCAL_FUNC(__do_get_xsec) /* get xsec from tb & kernel */
112
113 lis r7,15 /* r7 = 1000000 = USEC_PER_SEC */
114 ori r7,r7,16960
115 rldicl r5,r4,44,20 /* r5 = sec = xsec / XSEC_PER_SEC */
116 rldicr r6,r5,20,43 /* r6 = sec * XSEC_PER_SEC */
117 subf r0,r6,r4 /* r0 = xsec = (xsec - r6) */
118 mulld r0,r0,r7 /* usec = (xsec * USEC_PER_SEC) /
119 * XSEC_PER_SEC
120 */
121 rldicl r6,r0,44,20
122 mulli r6,r6,1000 /* nsec = usec * 1000 */
123
124 /* now we must fixup using wall to monotonic. We need to snapshot 87 /* now we must fixup using wall to monotonic. We need to snapshot
125 * that value and do the counter trick again. Fortunately, we still 88 * that value and do the counter trick again. Fortunately, we still
126 * have the counter value in r8 that was returned by __do_get_xsec. 89 * have the counter value in r8 that was returned by __do_get_tspec.
127 * At this point, r5,r6 contain our sec/nsec values. 90 * At this point, r4,r5 contain our sec/nsec values.
128 * can be used
129 */ 91 */
130 92
131 lwa r4,WTOM_CLOCK_SEC(r3) 93 lwa r6,WTOM_CLOCK_SEC(r3)
132 lwa r7,WTOM_CLOCK_NSEC(r3) 94 lwa r9,WTOM_CLOCK_NSEC(r3)
133 95
134 /* We now have our result in r4,r7. We create a fake dependency 96 /* We now have our result in r6,r9. We create a fake dependency
135 * on that result and re-check the counter 97 * on that result and re-check the counter
136 */ 98 */
137 or r9,r4,r7 99 or r0,r6,r9
138 xor r0,r9,r9 100 xor r0,r0,r0
139 add r3,r3,r0 101 add r3,r3,r0
140 ld r0,CFG_TB_UPDATE_COUNT(r3) 102 ld r0,CFG_TB_UPDATE_COUNT(r3)
141 cmpld cr0,r0,r8 /* check if updated */ 103 cmpld cr0,r0,r8 /* check if updated */
142 bne- 50b 104 bne- 50b
143 105
144 /* Calculate and store result. Note that this mimmics the C code, 106 /* Add wall->monotonic offset and check for overflow or underflow.
145 * which may cause funny results if nsec goes negative... is that
146 * possible at all ?
147 */ 107 */
148 add r4,r4,r5 108 add r4,r4,r6
149 add r7,r7,r6 109 add r5,r5,r9
150 lis r9,NSEC_PER_SEC@h 110 cmpd cr0,r5,r7
151 ori r9,r9,NSEC_PER_SEC@l 111 cmpdi cr1,r5,0
152 cmpl cr0,r7,r9
153 cmpli cr1,r7,0
154 blt 1f 112 blt 1f
155 subf r7,r9,r7 113 subf r5,r7,r5
156 addi r4,r4,1 114 addi r4,r4,1
1571: bge cr1,1f 1151: bge cr1,80f
158 addi r4,r4,-1 116 addi r4,r4,-1
159 add r7,r7,r9 117 add r5,r5,r7
1601: std r4,TSPC64_TV_SEC(r11) 118
161 std r7,TSPC64_TV_NSEC(r11) 11980: std r4,TSPC64_TV_SEC(r11)
120 std r5,TSPC64_TV_NSEC(r11)
162 121
163 mtlr r12 122 mtlr r12
164 crclr cr0*4+so 123 crclr cr0*4+so
@@ -168,10 +127,6 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
168 /* 127 /*
169 * syscall fallback 128 * syscall fallback
170 */ 129 */
17198:
172 mtlr r12
173 mr r3,r10
174 mr r4,r11
17599: 13099:
176 li r0,__NR_clock_gettime 131 li r0,__NR_clock_gettime
177 sc 132 sc
@@ -253,3 +208,59 @@ V_FUNCTION_BEGIN(__do_get_xsec)
253 blr 208 blr
254 .cfi_endproc 209 .cfi_endproc
255V_FUNCTION_END(__do_get_xsec) 210V_FUNCTION_END(__do_get_xsec)
211
212/*
213 * This is the core of clock_gettime(), it returns the current
214 * time in seconds and nanoseconds in r4 and r5.
215 * It expects the datapage ptr in r3 and doesn't clobber it.
216 * It clobbers r0 and r6 and returns NSEC_PER_SEC in r7.
217 * On return, r8 contains the counter value that can be reused.
218 * This clobbers cr0 but not any other cr field.
219 */
220V_FUNCTION_BEGIN(__do_get_tspec)
221 .cfi_startproc
222 /* check for update count & load values */
2231: ld r8,CFG_TB_UPDATE_COUNT(r3)
224 andi. r0,r8,1 /* pending update ? loop */
225 bne- 1b
226 xor r0,r8,r8 /* create dependency */
227 add r3,r3,r0
228
229 /* Get TB & offset it. We use the MFTB macro which will generate
230 * workaround code for Cell.
231 */
232 MFTB(r7)
233 ld r9,CFG_TB_ORIG_STAMP(r3)
234 subf r7,r9,r7
235
236 /* Scale result */
237 ld r5,CFG_TB_TO_XS(r3)
238 sldi r7,r7,12 /* compute time since stamp_xtime */
239 mulhdu r6,r7,r5 /* in units of 2^-32 seconds */
240
241 /* Add stamp since epoch */
242 ld r4,STAMP_XTIME+TSPC64_TV_SEC(r3)
243 ld r5,STAMP_XTIME+TSPC64_TV_NSEC(r3)
244 or r0,r4,r5
245 or r0,r0,r6
246 xor r0,r0,r0
247 add r3,r3,r0
248 ld r0,CFG_TB_UPDATE_COUNT(r3)
249 cmpld r0,r8 /* check if updated */
250 bne- 1b /* reload if so */
251
252 /* convert to seconds & nanoseconds and add to stamp */
253 lis r7,NSEC_PER_SEC@h
254 ori r7,r7,NSEC_PER_SEC@l
255 mulhwu r0,r6,r7 /* compute nanoseconds and */
256 srdi r6,r6,32 /* seconds since stamp_xtime */
257 clrldi r0,r0,32
258 add r5,r5,r0 /* add nanoseconds together */
259 cmpd r5,r7 /* overflow? */
260 add r4,r4,r6
261 bltlr /* all done if no overflow */
262 subf r5,r7,r5 /* if overflow, adjust */
263 addi r4,r4,1
264 blr
265 .cfi_endproc
266V_FUNCTION_END(__do_get_tspec)
diff --git a/arch/powerpc/kernel/vdso64/vdso64.lds.S b/arch/powerpc/kernel/vdso64/vdso64.lds.S
index d0b2526dd38d..0e615404e247 100644
--- a/arch/powerpc/kernel/vdso64/vdso64.lds.S
+++ b/arch/powerpc/kernel/vdso64/vdso64.lds.S
@@ -35,6 +35,9 @@ SECTIONS
35 __ftr_fixup : { *(__ftr_fixup) } 35 __ftr_fixup : { *(__ftr_fixup) }
36 36
37 . = ALIGN(8); 37 . = ALIGN(8);
38 __mmu_ftr_fixup : { *(__mmu_ftr_fixup) }
39
40 . = ALIGN(8);
38 __lwsync_fixup : { *(__lwsync_fixup) } 41 __lwsync_fixup : { *(__lwsync_fixup) }
39 42
40 . = ALIGN(8); 43 . = ALIGN(8);
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index a11e6bc59b30..94aa7b011b27 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -41,9 +41,9 @@
41static struct bus_type vio_bus_type; 41static struct bus_type vio_bus_type;
42 42
43static struct vio_dev vio_bus_device = { /* fake "parent" device */ 43static struct vio_dev vio_bus_device = { /* fake "parent" device */
44 .name = vio_bus_device.dev.bus_id, 44 .name = "vio",
45 .type = "", 45 .type = "",
46 .dev.bus_id = "vio", 46 .dev.init_name = "vio",
47 .dev.bus = &vio_bus_type, 47 .dev.bus = &vio_bus_type,
48}; 48};
49 49
@@ -1216,7 +1216,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
1216 1216
1217 viodev->irq = irq_of_parse_and_map(of_node, 0); 1217 viodev->irq = irq_of_parse_and_map(of_node, 0);
1218 1218
1219 snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%x", *unit_address); 1219 dev_set_name(&viodev->dev, "%x", *unit_address);
1220 viodev->name = of_node->name; 1220 viodev->name = of_node->name;
1221 viodev->type = of_node->type; 1221 viodev->type = of_node->type;
1222 viodev->unit_address = *unit_address; 1222 viodev->unit_address = *unit_address;
@@ -1243,7 +1243,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
1243 /* register with generic device framework */ 1243 /* register with generic device framework */
1244 if (device_register(&viodev->dev)) { 1244 if (device_register(&viodev->dev)) {
1245 printk(KERN_ERR "%s: failed to register device %s\n", 1245 printk(KERN_ERR "%s: failed to register device %s\n",
1246 __func__, viodev->dev.bus_id); 1246 __func__, dev_name(&viodev->dev));
1247 /* XXX free TCE table */ 1247 /* XXX free TCE table */
1248 kfree(viodev); 1248 kfree(viodev);
1249 return NULL; 1249 return NULL;
@@ -1400,13 +1400,13 @@ static struct vio_dev *vio_find_name(const char *name)
1400struct vio_dev *vio_find_node(struct device_node *vnode) 1400struct vio_dev *vio_find_node(struct device_node *vnode)
1401{ 1401{
1402 const uint32_t *unit_address; 1402 const uint32_t *unit_address;
1403 char kobj_name[BUS_ID_SIZE]; 1403 char kobj_name[20];
1404 1404
1405 /* construct the kobject name from the device node */ 1405 /* construct the kobject name from the device node */
1406 unit_address = of_get_property(vnode, "reg", NULL); 1406 unit_address = of_get_property(vnode, "reg", NULL);
1407 if (!unit_address) 1407 if (!unit_address)
1408 return NULL; 1408 return NULL;
1409 snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address); 1409 snprintf(kobj_name, sizeof(kobj_name), "%x", *unit_address);
1410 1410
1411 return vio_find_name(kobj_name); 1411 return vio_find_name(kobj_name);
1412} 1412}
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 2412c056baa4..47bf15cd2c9e 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -152,6 +152,12 @@ SECTIONS
152 __stop___ftr_fixup = .; 152 __stop___ftr_fixup = .;
153 } 153 }
154 . = ALIGN(8); 154 . = ALIGN(8);
155 __mmu_ftr_fixup : AT(ADDR(__mmu_ftr_fixup) - LOAD_OFFSET) {
156 __start___mmu_ftr_fixup = .;
157 *(__mmu_ftr_fixup)
158 __stop___mmu_ftr_fixup = .;
159 }
160 . = ALIGN(8);
155 __lwsync_fixup : AT(ADDR(__lwsync_fixup) - LOAD_OFFSET) { 161 __lwsync_fixup : AT(ADDR(__lwsync_fixup) - LOAD_OFFSET) {
156 __start___lwsync_fixup = .; 162 __start___lwsync_fixup = .;
157 *(__lwsync_fixup) 163 *(__lwsync_fixup)
diff --git a/arch/powerpc/kvm/44x.c b/arch/powerpc/kvm/44x.c
new file mode 100644
index 000000000000..a66bec57265a
--- /dev/null
+++ b/arch/powerpc/kvm/44x.c
@@ -0,0 +1,228 @@
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, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2008
16 *
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18 */
19
20#include <linux/kvm_host.h>
21#include <linux/err.h>
22
23#include <asm/reg.h>
24#include <asm/cputable.h>
25#include <asm/tlbflush.h>
26#include <asm/kvm_44x.h>
27#include <asm/kvm_ppc.h>
28
29#include "44x_tlb.h"
30
31/* Note: clearing MSR[DE] just means that the debug interrupt will not be
32 * delivered *immediately*. Instead, it simply sets the appropriate DBSR bits.
33 * If those DBSR bits are still set when MSR[DE] is re-enabled, the interrupt
34 * will be delivered as an "imprecise debug event" (which is indicated by
35 * DBSR[IDE].
36 */
37static void kvm44x_disable_debug_interrupts(void)
38{
39 mtmsr(mfmsr() & ~MSR_DE);
40}
41
42void kvmppc_core_load_host_debugstate(struct kvm_vcpu *vcpu)
43{
44 kvm44x_disable_debug_interrupts();
45
46 mtspr(SPRN_IAC1, vcpu->arch.host_iac[0]);
47 mtspr(SPRN_IAC2, vcpu->arch.host_iac[1]);
48 mtspr(SPRN_IAC3, vcpu->arch.host_iac[2]);
49 mtspr(SPRN_IAC4, vcpu->arch.host_iac[3]);
50 mtspr(SPRN_DBCR1, vcpu->arch.host_dbcr1);
51 mtspr(SPRN_DBCR2, vcpu->arch.host_dbcr2);
52 mtspr(SPRN_DBCR0, vcpu->arch.host_dbcr0);
53 mtmsr(vcpu->arch.host_msr);
54}
55
56void kvmppc_core_load_guest_debugstate(struct kvm_vcpu *vcpu)
57{
58 struct kvm_guest_debug *dbg = &vcpu->guest_debug;
59 u32 dbcr0 = 0;
60
61 vcpu->arch.host_msr = mfmsr();
62 kvm44x_disable_debug_interrupts();
63
64 /* Save host debug register state. */
65 vcpu->arch.host_iac[0] = mfspr(SPRN_IAC1);
66 vcpu->arch.host_iac[1] = mfspr(SPRN_IAC2);
67 vcpu->arch.host_iac[2] = mfspr(SPRN_IAC3);
68 vcpu->arch.host_iac[3] = mfspr(SPRN_IAC4);
69 vcpu->arch.host_dbcr0 = mfspr(SPRN_DBCR0);
70 vcpu->arch.host_dbcr1 = mfspr(SPRN_DBCR1);
71 vcpu->arch.host_dbcr2 = mfspr(SPRN_DBCR2);
72
73 /* set registers up for guest */
74
75 if (dbg->bp[0]) {
76 mtspr(SPRN_IAC1, dbg->bp[0]);
77 dbcr0 |= DBCR0_IAC1 | DBCR0_IDM;
78 }
79 if (dbg->bp[1]) {
80 mtspr(SPRN_IAC2, dbg->bp[1]);
81 dbcr0 |= DBCR0_IAC2 | DBCR0_IDM;
82 }
83 if (dbg->bp[2]) {
84 mtspr(SPRN_IAC3, dbg->bp[2]);
85 dbcr0 |= DBCR0_IAC3 | DBCR0_IDM;
86 }
87 if (dbg->bp[3]) {
88 mtspr(SPRN_IAC4, dbg->bp[3]);
89 dbcr0 |= DBCR0_IAC4 | DBCR0_IDM;
90 }
91
92 mtspr(SPRN_DBCR0, dbcr0);
93 mtspr(SPRN_DBCR1, 0);
94 mtspr(SPRN_DBCR2, 0);
95}
96
97void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
98{
99 kvmppc_44x_tlb_load(vcpu);
100}
101
102void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu)
103{
104 kvmppc_44x_tlb_put(vcpu);
105}
106
107int kvmppc_core_check_processor_compat(void)
108{
109 int r;
110
111 if (strcmp(cur_cpu_spec->platform, "ppc440") == 0)
112 r = 0;
113 else
114 r = -ENOTSUPP;
115
116 return r;
117}
118
119int kvmppc_core_vcpu_setup(struct kvm_vcpu *vcpu)
120{
121 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
122 struct kvmppc_44x_tlbe *tlbe = &vcpu_44x->guest_tlb[0];
123 int i;
124
125 tlbe->tid = 0;
126 tlbe->word0 = PPC44x_TLB_16M | PPC44x_TLB_VALID;
127 tlbe->word1 = 0;
128 tlbe->word2 = PPC44x_TLB_SX | PPC44x_TLB_SW | PPC44x_TLB_SR;
129
130 tlbe++;
131 tlbe->tid = 0;
132 tlbe->word0 = 0xef600000 | PPC44x_TLB_4K | PPC44x_TLB_VALID;
133 tlbe->word1 = 0xef600000;
134 tlbe->word2 = PPC44x_TLB_SX | PPC44x_TLB_SW | PPC44x_TLB_SR
135 | PPC44x_TLB_I | PPC44x_TLB_G;
136
137 /* Since the guest can directly access the timebase, it must know the
138 * real timebase frequency. Accordingly, it must see the state of
139 * CCR1[TCS]. */
140 vcpu->arch.ccr1 = mfspr(SPRN_CCR1);
141
142 for (i = 0; i < ARRAY_SIZE(vcpu_44x->shadow_refs); i++)
143 vcpu_44x->shadow_refs[i].gtlb_index = -1;
144
145 return 0;
146}
147
148/* 'linear_address' is actually an encoding of AS|PID|EADDR . */
149int kvmppc_core_vcpu_translate(struct kvm_vcpu *vcpu,
150 struct kvm_translation *tr)
151{
152 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
153 struct kvmppc_44x_tlbe *gtlbe;
154 int index;
155 gva_t eaddr;
156 u8 pid;
157 u8 as;
158
159 eaddr = tr->linear_address;
160 pid = (tr->linear_address >> 32) & 0xff;
161 as = (tr->linear_address >> 40) & 0x1;
162
163 index = kvmppc_44x_tlb_index(vcpu, eaddr, pid, as);
164 if (index == -1) {
165 tr->valid = 0;
166 return 0;
167 }
168
169 gtlbe = &vcpu_44x->guest_tlb[index];
170
171 tr->physical_address = tlb_xlate(gtlbe, eaddr);
172 /* XXX what does "writeable" and "usermode" even mean? */
173 tr->valid = 1;
174
175 return 0;
176}
177
178struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
179{
180 struct kvmppc_vcpu_44x *vcpu_44x;
181 struct kvm_vcpu *vcpu;
182 int err;
183
184 vcpu_44x = kmem_cache_zalloc(kvm_vcpu_cache, GFP_KERNEL);
185 if (!vcpu_44x) {
186 err = -ENOMEM;
187 goto out;
188 }
189
190 vcpu = &vcpu_44x->vcpu;
191 err = kvm_vcpu_init(vcpu, kvm, id);
192 if (err)
193 goto free_vcpu;
194
195 return vcpu;
196
197free_vcpu:
198 kmem_cache_free(kvm_vcpu_cache, vcpu_44x);
199out:
200 return ERR_PTR(err);
201}
202
203void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu)
204{
205 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
206
207 kvm_vcpu_uninit(vcpu);
208 kmem_cache_free(kvm_vcpu_cache, vcpu_44x);
209}
210
211static int kvmppc_44x_init(void)
212{
213 int r;
214
215 r = kvmppc_booke_init();
216 if (r)
217 return r;
218
219 return kvm_init(NULL, sizeof(struct kvmppc_vcpu_44x), THIS_MODULE);
220}
221
222static void kvmppc_44x_exit(void)
223{
224 kvmppc_booke_exit();
225}
226
227module_init(kvmppc_44x_init);
228module_exit(kvmppc_44x_exit);
diff --git a/arch/powerpc/kvm/44x_emulate.c b/arch/powerpc/kvm/44x_emulate.c
new file mode 100644
index 000000000000..82489a743a6f
--- /dev/null
+++ b/arch/powerpc/kvm/44x_emulate.c
@@ -0,0 +1,371 @@
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, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2008
16 *
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18 */
19
20#include <asm/kvm_ppc.h>
21#include <asm/dcr.h>
22#include <asm/dcr-regs.h>
23#include <asm/disassemble.h>
24#include <asm/kvm_44x.h>
25#include "timing.h"
26
27#include "booke.h"
28#include "44x_tlb.h"
29
30#define OP_RFI 19
31
32#define XOP_RFI 50
33#define XOP_MFMSR 83
34#define XOP_WRTEE 131
35#define XOP_MTMSR 146
36#define XOP_WRTEEI 163
37#define XOP_MFDCR 323
38#define XOP_MTDCR 451
39#define XOP_TLBSX 914
40#define XOP_ICCCI 966
41#define XOP_TLBWE 978
42
43static void kvmppc_emul_rfi(struct kvm_vcpu *vcpu)
44{
45 vcpu->arch.pc = vcpu->arch.srr0;
46 kvmppc_set_msr(vcpu, vcpu->arch.srr1);
47}
48
49int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
50 unsigned int inst, int *advance)
51{
52 int emulated = EMULATE_DONE;
53 int dcrn;
54 int ra;
55 int rb;
56 int rc;
57 int rs;
58 int rt;
59 int ws;
60
61 switch (get_op(inst)) {
62 case OP_RFI:
63 switch (get_xop(inst)) {
64 case XOP_RFI:
65 kvmppc_emul_rfi(vcpu);
66 kvmppc_set_exit_type(vcpu, EMULATED_RFI_EXITS);
67 *advance = 0;
68 break;
69
70 default:
71 emulated = EMULATE_FAIL;
72 break;
73 }
74 break;
75
76 case 31:
77 switch (get_xop(inst)) {
78
79 case XOP_MFMSR:
80 rt = get_rt(inst);
81 vcpu->arch.gpr[rt] = vcpu->arch.msr;
82 kvmppc_set_exit_type(vcpu, EMULATED_MFMSR_EXITS);
83 break;
84
85 case XOP_MTMSR:
86 rs = get_rs(inst);
87 kvmppc_set_exit_type(vcpu, EMULATED_MTMSR_EXITS);
88 kvmppc_set_msr(vcpu, vcpu->arch.gpr[rs]);
89 break;
90
91 case XOP_WRTEE:
92 rs = get_rs(inst);
93 vcpu->arch.msr = (vcpu->arch.msr & ~MSR_EE)
94 | (vcpu->arch.gpr[rs] & MSR_EE);
95 kvmppc_set_exit_type(vcpu, EMULATED_WRTEE_EXITS);
96 break;
97
98 case XOP_WRTEEI:
99 vcpu->arch.msr = (vcpu->arch.msr & ~MSR_EE)
100 | (inst & MSR_EE);
101 kvmppc_set_exit_type(vcpu, EMULATED_WRTEE_EXITS);
102 break;
103
104 case XOP_MFDCR:
105 dcrn = get_dcrn(inst);
106 rt = get_rt(inst);
107
108 /* The guest may access CPR0 registers to determine the timebase
109 * frequency, and it must know the real host frequency because it
110 * can directly access the timebase registers.
111 *
112 * It would be possible to emulate those accesses in userspace,
113 * but userspace can really only figure out the end frequency.
114 * We could decompose that into the factors that compute it, but
115 * that's tricky math, and it's easier to just report the real
116 * CPR0 values.
117 */
118 switch (dcrn) {
119 case DCRN_CPR0_CONFIG_ADDR:
120 vcpu->arch.gpr[rt] = vcpu->arch.cpr0_cfgaddr;
121 break;
122 case DCRN_CPR0_CONFIG_DATA:
123 local_irq_disable();
124 mtdcr(DCRN_CPR0_CONFIG_ADDR,
125 vcpu->arch.cpr0_cfgaddr);
126 vcpu->arch.gpr[rt] = mfdcr(DCRN_CPR0_CONFIG_DATA);
127 local_irq_enable();
128 break;
129 default:
130 run->dcr.dcrn = dcrn;
131 run->dcr.data = 0;
132 run->dcr.is_write = 0;
133 vcpu->arch.io_gpr = rt;
134 vcpu->arch.dcr_needed = 1;
135 kvmppc_account_exit(vcpu, DCR_EXITS);
136 emulated = EMULATE_DO_DCR;
137 }
138
139 break;
140
141 case XOP_MTDCR:
142 dcrn = get_dcrn(inst);
143 rs = get_rs(inst);
144
145 /* emulate some access in kernel */
146 switch (dcrn) {
147 case DCRN_CPR0_CONFIG_ADDR:
148 vcpu->arch.cpr0_cfgaddr = vcpu->arch.gpr[rs];
149 break;
150 default:
151 run->dcr.dcrn = dcrn;
152 run->dcr.data = vcpu->arch.gpr[rs];
153 run->dcr.is_write = 1;
154 vcpu->arch.dcr_needed = 1;
155 kvmppc_account_exit(vcpu, DCR_EXITS);
156 emulated = EMULATE_DO_DCR;
157 }
158
159 break;
160
161 case XOP_TLBWE:
162 ra = get_ra(inst);
163 rs = get_rs(inst);
164 ws = get_ws(inst);
165 emulated = kvmppc_44x_emul_tlbwe(vcpu, ra, rs, ws);
166 break;
167
168 case XOP_TLBSX:
169 rt = get_rt(inst);
170 ra = get_ra(inst);
171 rb = get_rb(inst);
172 rc = get_rc(inst);
173 emulated = kvmppc_44x_emul_tlbsx(vcpu, rt, ra, rb, rc);
174 break;
175
176 case XOP_ICCCI:
177 break;
178
179 default:
180 emulated = EMULATE_FAIL;
181 }
182
183 break;
184
185 default:
186 emulated = EMULATE_FAIL;
187 }
188
189 return emulated;
190}
191
192int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, int rs)
193{
194 switch (sprn) {
195 case SPRN_MMUCR:
196 vcpu->arch.mmucr = vcpu->arch.gpr[rs]; break;
197 case SPRN_PID:
198 kvmppc_set_pid(vcpu, vcpu->arch.gpr[rs]); break;
199 case SPRN_CCR0:
200 vcpu->arch.ccr0 = vcpu->arch.gpr[rs]; break;
201 case SPRN_CCR1:
202 vcpu->arch.ccr1 = vcpu->arch.gpr[rs]; break;
203 case SPRN_DEAR:
204 vcpu->arch.dear = vcpu->arch.gpr[rs]; break;
205 case SPRN_ESR:
206 vcpu->arch.esr = vcpu->arch.gpr[rs]; break;
207 case SPRN_DBCR0:
208 vcpu->arch.dbcr0 = vcpu->arch.gpr[rs]; break;
209 case SPRN_DBCR1:
210 vcpu->arch.dbcr1 = vcpu->arch.gpr[rs]; break;
211 case SPRN_TSR:
212 vcpu->arch.tsr &= ~vcpu->arch.gpr[rs]; break;
213 case SPRN_TCR:
214 vcpu->arch.tcr = vcpu->arch.gpr[rs];
215 kvmppc_emulate_dec(vcpu);
216 break;
217
218 /* Note: SPRG4-7 are user-readable. These values are
219 * loaded into the real SPRGs when resuming the
220 * guest. */
221 case SPRN_SPRG4:
222 vcpu->arch.sprg4 = vcpu->arch.gpr[rs]; break;
223 case SPRN_SPRG5:
224 vcpu->arch.sprg5 = vcpu->arch.gpr[rs]; break;
225 case SPRN_SPRG6:
226 vcpu->arch.sprg6 = vcpu->arch.gpr[rs]; break;
227 case SPRN_SPRG7:
228 vcpu->arch.sprg7 = vcpu->arch.gpr[rs]; break;
229
230 case SPRN_IVPR:
231 vcpu->arch.ivpr = vcpu->arch.gpr[rs];
232 break;
233 case SPRN_IVOR0:
234 vcpu->arch.ivor[BOOKE_IRQPRIO_CRITICAL] = vcpu->arch.gpr[rs];
235 break;
236 case SPRN_IVOR1:
237 vcpu->arch.ivor[BOOKE_IRQPRIO_MACHINE_CHECK] = vcpu->arch.gpr[rs];
238 break;
239 case SPRN_IVOR2:
240 vcpu->arch.ivor[BOOKE_IRQPRIO_DATA_STORAGE] = vcpu->arch.gpr[rs];
241 break;
242 case SPRN_IVOR3:
243 vcpu->arch.ivor[BOOKE_IRQPRIO_INST_STORAGE] = vcpu->arch.gpr[rs];
244 break;
245 case SPRN_IVOR4:
246 vcpu->arch.ivor[BOOKE_IRQPRIO_EXTERNAL] = vcpu->arch.gpr[rs];
247 break;
248 case SPRN_IVOR5:
249 vcpu->arch.ivor[BOOKE_IRQPRIO_ALIGNMENT] = vcpu->arch.gpr[rs];
250 break;
251 case SPRN_IVOR6:
252 vcpu->arch.ivor[BOOKE_IRQPRIO_PROGRAM] = vcpu->arch.gpr[rs];
253 break;
254 case SPRN_IVOR7:
255 vcpu->arch.ivor[BOOKE_IRQPRIO_FP_UNAVAIL] = vcpu->arch.gpr[rs];
256 break;
257 case SPRN_IVOR8:
258 vcpu->arch.ivor[BOOKE_IRQPRIO_SYSCALL] = vcpu->arch.gpr[rs];
259 break;
260 case SPRN_IVOR9:
261 vcpu->arch.ivor[BOOKE_IRQPRIO_AP_UNAVAIL] = vcpu->arch.gpr[rs];
262 break;
263 case SPRN_IVOR10:
264 vcpu->arch.ivor[BOOKE_IRQPRIO_DECREMENTER] = vcpu->arch.gpr[rs];
265 break;
266 case SPRN_IVOR11:
267 vcpu->arch.ivor[BOOKE_IRQPRIO_FIT] = vcpu->arch.gpr[rs];
268 break;
269 case SPRN_IVOR12:
270 vcpu->arch.ivor[BOOKE_IRQPRIO_WATCHDOG] = vcpu->arch.gpr[rs];
271 break;
272 case SPRN_IVOR13:
273 vcpu->arch.ivor[BOOKE_IRQPRIO_DTLB_MISS] = vcpu->arch.gpr[rs];
274 break;
275 case SPRN_IVOR14:
276 vcpu->arch.ivor[BOOKE_IRQPRIO_ITLB_MISS] = vcpu->arch.gpr[rs];
277 break;
278 case SPRN_IVOR15:
279 vcpu->arch.ivor[BOOKE_IRQPRIO_DEBUG] = vcpu->arch.gpr[rs];
280 break;
281
282 default:
283 return EMULATE_FAIL;
284 }
285
286 kvmppc_set_exit_type(vcpu, EMULATED_MTSPR_EXITS);
287 return EMULATE_DONE;
288}
289
290int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt)
291{
292 switch (sprn) {
293 /* 440 */
294 case SPRN_MMUCR:
295 vcpu->arch.gpr[rt] = vcpu->arch.mmucr; break;
296 case SPRN_CCR0:
297 vcpu->arch.gpr[rt] = vcpu->arch.ccr0; break;
298 case SPRN_CCR1:
299 vcpu->arch.gpr[rt] = vcpu->arch.ccr1; break;
300
301 /* Book E */
302 case SPRN_PID:
303 vcpu->arch.gpr[rt] = vcpu->arch.pid; break;
304 case SPRN_IVPR:
305 vcpu->arch.gpr[rt] = vcpu->arch.ivpr; break;
306 case SPRN_DEAR:
307 vcpu->arch.gpr[rt] = vcpu->arch.dear; break;
308 case SPRN_ESR:
309 vcpu->arch.gpr[rt] = vcpu->arch.esr; break;
310 case SPRN_DBCR0:
311 vcpu->arch.gpr[rt] = vcpu->arch.dbcr0; break;
312 case SPRN_DBCR1:
313 vcpu->arch.gpr[rt] = vcpu->arch.dbcr1; break;
314
315 case SPRN_IVOR0:
316 vcpu->arch.gpr[rt] = vcpu->arch.ivor[BOOKE_IRQPRIO_CRITICAL];
317 break;
318 case SPRN_IVOR1:
319 vcpu->arch.gpr[rt] = vcpu->arch.ivor[BOOKE_IRQPRIO_MACHINE_CHECK];
320 break;
321 case SPRN_IVOR2:
322 vcpu->arch.gpr[rt] = vcpu->arch.ivor[BOOKE_IRQPRIO_DATA_STORAGE];
323 break;
324 case SPRN_IVOR3:
325 vcpu->arch.gpr[rt] = vcpu->arch.ivor[BOOKE_IRQPRIO_INST_STORAGE];
326 break;
327 case SPRN_IVOR4:
328 vcpu->arch.gpr[rt] = vcpu->arch.ivor[BOOKE_IRQPRIO_EXTERNAL];
329 break;
330 case SPRN_IVOR5:
331 vcpu->arch.gpr[rt] = vcpu->arch.ivor[BOOKE_IRQPRIO_ALIGNMENT];
332 break;
333 case SPRN_IVOR6:
334 vcpu->arch.gpr[rt] = vcpu->arch.ivor[BOOKE_IRQPRIO_PROGRAM];
335 break;
336 case SPRN_IVOR7:
337 vcpu->arch.gpr[rt] = vcpu->arch.ivor[BOOKE_IRQPRIO_FP_UNAVAIL];
338 break;
339 case SPRN_IVOR8:
340 vcpu->arch.gpr[rt] = vcpu->arch.ivor[BOOKE_IRQPRIO_SYSCALL];
341 break;
342 case SPRN_IVOR9:
343 vcpu->arch.gpr[rt] = vcpu->arch.ivor[BOOKE_IRQPRIO_AP_UNAVAIL];
344 break;
345 case SPRN_IVOR10:
346 vcpu->arch.gpr[rt] = vcpu->arch.ivor[BOOKE_IRQPRIO_DECREMENTER];
347 break;
348 case SPRN_IVOR11:
349 vcpu->arch.gpr[rt] = vcpu->arch.ivor[BOOKE_IRQPRIO_FIT];
350 break;
351 case SPRN_IVOR12:
352 vcpu->arch.gpr[rt] = vcpu->arch.ivor[BOOKE_IRQPRIO_WATCHDOG];
353 break;
354 case SPRN_IVOR13:
355 vcpu->arch.gpr[rt] = vcpu->arch.ivor[BOOKE_IRQPRIO_DTLB_MISS];
356 break;
357 case SPRN_IVOR14:
358 vcpu->arch.gpr[rt] = vcpu->arch.ivor[BOOKE_IRQPRIO_ITLB_MISS];
359 break;
360 case SPRN_IVOR15:
361 vcpu->arch.gpr[rt] = vcpu->arch.ivor[BOOKE_IRQPRIO_DEBUG];
362 break;
363
364 default:
365 return EMULATE_FAIL;
366 }
367
368 kvmppc_set_exit_type(vcpu, EMULATED_MFSPR_EXITS);
369 return EMULATE_DONE;
370}
371
diff --git a/arch/powerpc/kvm/44x_tlb.c b/arch/powerpc/kvm/44x_tlb.c
index ad72c6f9811f..9a34b8edb9e2 100644
--- a/arch/powerpc/kvm/44x_tlb.c
+++ b/arch/powerpc/kvm/44x_tlb.c
@@ -22,20 +22,103 @@
22#include <linux/kvm.h> 22#include <linux/kvm.h>
23#include <linux/kvm_host.h> 23#include <linux/kvm_host.h>
24#include <linux/highmem.h> 24#include <linux/highmem.h>
25
26#include <asm/tlbflush.h>
25#include <asm/mmu-44x.h> 27#include <asm/mmu-44x.h>
26#include <asm/kvm_ppc.h> 28#include <asm/kvm_ppc.h>
29#include <asm/kvm_44x.h>
30#include "timing.h"
27 31
28#include "44x_tlb.h" 32#include "44x_tlb.h"
29 33
34#ifndef PPC44x_TLBE_SIZE
35#define PPC44x_TLBE_SIZE PPC44x_TLB_4K
36#endif
37
38#define PAGE_SIZE_4K (1<<12)
39#define PAGE_MASK_4K (~(PAGE_SIZE_4K - 1))
40
41#define PPC44x_TLB_UATTR_MASK \
42 (PPC44x_TLB_U0|PPC44x_TLB_U1|PPC44x_TLB_U2|PPC44x_TLB_U3)
30#define PPC44x_TLB_USER_PERM_MASK (PPC44x_TLB_UX|PPC44x_TLB_UR|PPC44x_TLB_UW) 43#define PPC44x_TLB_USER_PERM_MASK (PPC44x_TLB_UX|PPC44x_TLB_UR|PPC44x_TLB_UW)
31#define PPC44x_TLB_SUPER_PERM_MASK (PPC44x_TLB_SX|PPC44x_TLB_SR|PPC44x_TLB_SW) 44#define PPC44x_TLB_SUPER_PERM_MASK (PPC44x_TLB_SX|PPC44x_TLB_SR|PPC44x_TLB_SW)
32 45
33static unsigned int kvmppc_tlb_44x_pos; 46#ifdef DEBUG
47void kvmppc_dump_tlbs(struct kvm_vcpu *vcpu)
48{
49 struct kvmppc_44x_tlbe *tlbe;
50 int i;
51
52 printk("vcpu %d TLB dump:\n", vcpu->vcpu_id);
53 printk("| %2s | %3s | %8s | %8s | %8s |\n",
54 "nr", "tid", "word0", "word1", "word2");
55
56 for (i = 0; i < ARRAY_SIZE(vcpu_44x->guest_tlb); i++) {
57 tlbe = &vcpu_44x->guest_tlb[i];
58 if (tlbe->word0 & PPC44x_TLB_VALID)
59 printk(" G%2d | %02X | %08X | %08X | %08X |\n",
60 i, tlbe->tid, tlbe->word0, tlbe->word1,
61 tlbe->word2);
62 }
63}
64#endif
65
66static inline void kvmppc_44x_tlbie(unsigned int index)
67{
68 /* 0 <= index < 64, so the V bit is clear and we can use the index as
69 * word0. */
70 asm volatile(
71 "tlbwe %[index], %[index], 0\n"
72 :
73 : [index] "r"(index)
74 );
75}
76
77static inline void kvmppc_44x_tlbre(unsigned int index,
78 struct kvmppc_44x_tlbe *tlbe)
79{
80 asm volatile(
81 "tlbre %[word0], %[index], 0\n"
82 "mfspr %[tid], %[sprn_mmucr]\n"
83 "andi. %[tid], %[tid], 0xff\n"
84 "tlbre %[word1], %[index], 1\n"
85 "tlbre %[word2], %[index], 2\n"
86 : [word0] "=r"(tlbe->word0),
87 [word1] "=r"(tlbe->word1),
88 [word2] "=r"(tlbe->word2),
89 [tid] "=r"(tlbe->tid)
90 : [index] "r"(index),
91 [sprn_mmucr] "i"(SPRN_MMUCR)
92 : "cc"
93 );
94}
95
96static inline void kvmppc_44x_tlbwe(unsigned int index,
97 struct kvmppc_44x_tlbe *stlbe)
98{
99 unsigned long tmp;
100
101 asm volatile(
102 "mfspr %[tmp], %[sprn_mmucr]\n"
103 "rlwimi %[tmp], %[tid], 0, 0xff\n"
104 "mtspr %[sprn_mmucr], %[tmp]\n"
105 "tlbwe %[word0], %[index], 0\n"
106 "tlbwe %[word1], %[index], 1\n"
107 "tlbwe %[word2], %[index], 2\n"
108 : [tmp] "=&r"(tmp)
109 : [word0] "r"(stlbe->word0),
110 [word1] "r"(stlbe->word1),
111 [word2] "r"(stlbe->word2),
112 [tid] "r"(stlbe->tid),
113 [index] "r"(index),
114 [sprn_mmucr] "i"(SPRN_MMUCR)
115 );
116}
34 117
35static u32 kvmppc_44x_tlb_shadow_attrib(u32 attrib, int usermode) 118static u32 kvmppc_44x_tlb_shadow_attrib(u32 attrib, int usermode)
36{ 119{
37 /* Mask off reserved bits. */ 120 /* We only care about the guest's permission and user bits. */
38 attrib &= PPC44x_TLB_PERM_MASK|PPC44x_TLB_ATTR_MASK; 121 attrib &= PPC44x_TLB_PERM_MASK|PPC44x_TLB_UATTR_MASK;
39 122
40 if (!usermode) { 123 if (!usermode) {
41 /* Guest is in supervisor mode, so we need to translate guest 124 /* Guest is in supervisor mode, so we need to translate guest
@@ -47,18 +130,60 @@ static u32 kvmppc_44x_tlb_shadow_attrib(u32 attrib, int usermode)
47 /* Make sure host can always access this memory. */ 130 /* Make sure host can always access this memory. */
48 attrib |= PPC44x_TLB_SX|PPC44x_TLB_SR|PPC44x_TLB_SW; 131 attrib |= PPC44x_TLB_SX|PPC44x_TLB_SR|PPC44x_TLB_SW;
49 132
133 /* WIMGE = 0b00100 */
134 attrib |= PPC44x_TLB_M;
135
50 return attrib; 136 return attrib;
51} 137}
52 138
139/* Load shadow TLB back into hardware. */
140void kvmppc_44x_tlb_load(struct kvm_vcpu *vcpu)
141{
142 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
143 int i;
144
145 for (i = 0; i <= tlb_44x_hwater; i++) {
146 struct kvmppc_44x_tlbe *stlbe = &vcpu_44x->shadow_tlb[i];
147
148 if (get_tlb_v(stlbe) && get_tlb_ts(stlbe))
149 kvmppc_44x_tlbwe(i, stlbe);
150 }
151}
152
153static void kvmppc_44x_tlbe_set_modified(struct kvmppc_vcpu_44x *vcpu_44x,
154 unsigned int i)
155{
156 vcpu_44x->shadow_tlb_mod[i] = 1;
157}
158
159/* Save hardware TLB to the vcpu, and invalidate all guest mappings. */
160void kvmppc_44x_tlb_put(struct kvm_vcpu *vcpu)
161{
162 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
163 int i;
164
165 for (i = 0; i <= tlb_44x_hwater; i++) {
166 struct kvmppc_44x_tlbe *stlbe = &vcpu_44x->shadow_tlb[i];
167
168 if (vcpu_44x->shadow_tlb_mod[i])
169 kvmppc_44x_tlbre(i, stlbe);
170
171 if (get_tlb_v(stlbe) && get_tlb_ts(stlbe))
172 kvmppc_44x_tlbie(i);
173 }
174}
175
176
53/* Search the guest TLB for a matching entry. */ 177/* Search the guest TLB for a matching entry. */
54int kvmppc_44x_tlb_index(struct kvm_vcpu *vcpu, gva_t eaddr, unsigned int pid, 178int kvmppc_44x_tlb_index(struct kvm_vcpu *vcpu, gva_t eaddr, unsigned int pid,
55 unsigned int as) 179 unsigned int as)
56{ 180{
181 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
57 int i; 182 int i;
58 183
59 /* XXX Replace loop with fancy data structures. */ 184 /* XXX Replace loop with fancy data structures. */
60 for (i = 0; i < PPC44x_TLB_SIZE; i++) { 185 for (i = 0; i < ARRAY_SIZE(vcpu_44x->guest_tlb); i++) {
61 struct tlbe *tlbe = &vcpu->arch.guest_tlb[i]; 186 struct kvmppc_44x_tlbe *tlbe = &vcpu_44x->guest_tlb[i];
62 unsigned int tid; 187 unsigned int tid;
63 188
64 if (eaddr < get_tlb_eaddr(tlbe)) 189 if (eaddr < get_tlb_eaddr(tlbe))
@@ -83,78 +208,89 @@ int kvmppc_44x_tlb_index(struct kvm_vcpu *vcpu, gva_t eaddr, unsigned int pid,
83 return -1; 208 return -1;
84} 209}
85 210
86struct tlbe *kvmppc_44x_itlb_search(struct kvm_vcpu *vcpu, gva_t eaddr) 211int kvmppc_44x_itlb_index(struct kvm_vcpu *vcpu, gva_t eaddr)
87{ 212{
88 unsigned int as = !!(vcpu->arch.msr & MSR_IS); 213 unsigned int as = !!(vcpu->arch.msr & MSR_IS);
89 unsigned int index;
90 214
91 index = kvmppc_44x_tlb_index(vcpu, eaddr, vcpu->arch.pid, as); 215 return kvmppc_44x_tlb_index(vcpu, eaddr, vcpu->arch.pid, as);
92 if (index == -1)
93 return NULL;
94 return &vcpu->arch.guest_tlb[index];
95} 216}
96 217
97struct tlbe *kvmppc_44x_dtlb_search(struct kvm_vcpu *vcpu, gva_t eaddr) 218int kvmppc_44x_dtlb_index(struct kvm_vcpu *vcpu, gva_t eaddr)
98{ 219{
99 unsigned int as = !!(vcpu->arch.msr & MSR_DS); 220 unsigned int as = !!(vcpu->arch.msr & MSR_DS);
100 unsigned int index;
101 221
102 index = kvmppc_44x_tlb_index(vcpu, eaddr, vcpu->arch.pid, as); 222 return kvmppc_44x_tlb_index(vcpu, eaddr, vcpu->arch.pid, as);
103 if (index == -1)
104 return NULL;
105 return &vcpu->arch.guest_tlb[index];
106} 223}
107 224
108static int kvmppc_44x_tlbe_is_writable(struct tlbe *tlbe) 225static void kvmppc_44x_shadow_release(struct kvmppc_vcpu_44x *vcpu_44x,
226 unsigned int stlb_index)
109{ 227{
110 return tlbe->word2 & (PPC44x_TLB_SW|PPC44x_TLB_UW); 228 struct kvmppc_44x_shadow_ref *ref = &vcpu_44x->shadow_refs[stlb_index];
111}
112 229
113static void kvmppc_44x_shadow_release(struct kvm_vcpu *vcpu, 230 if (!ref->page)
114 unsigned int index) 231 return;
115{
116 struct tlbe *stlbe = &vcpu->arch.shadow_tlb[index];
117 struct page *page = vcpu->arch.shadow_pages[index];
118 232
119 if (get_tlb_v(stlbe)) { 233 /* Discard from the TLB. */
120 if (kvmppc_44x_tlbe_is_writable(stlbe)) 234 /* Note: we could actually invalidate a host mapping, if the host overwrote
121 kvm_release_page_dirty(page); 235 * this TLB entry since we inserted a guest mapping. */
122 else 236 kvmppc_44x_tlbie(stlb_index);
123 kvm_release_page_clean(page); 237
124 } 238 /* Now release the page. */
239 if (ref->writeable)
240 kvm_release_page_dirty(ref->page);
241 else
242 kvm_release_page_clean(ref->page);
243
244 ref->page = NULL;
245
246 /* XXX set tlb_44x_index to stlb_index? */
247
248 KVMTRACE_1D(STLB_INVAL, &vcpu_44x->vcpu, stlb_index, handler);
125} 249}
126 250
127void kvmppc_core_destroy_mmu(struct kvm_vcpu *vcpu) 251void kvmppc_core_destroy_mmu(struct kvm_vcpu *vcpu)
128{ 252{
253 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
129 int i; 254 int i;
130 255
131 for (i = 0; i <= tlb_44x_hwater; i++) 256 for (i = 0; i <= tlb_44x_hwater; i++)
132 kvmppc_44x_shadow_release(vcpu, i); 257 kvmppc_44x_shadow_release(vcpu_44x, i);
133}
134
135void kvmppc_tlbe_set_modified(struct kvm_vcpu *vcpu, unsigned int i)
136{
137 vcpu->arch.shadow_tlb_mod[i] = 1;
138} 258}
139 259
140/* Caller must ensure that the specified guest TLB entry is safe to insert into 260/**
141 * the shadow TLB. */ 261 * kvmppc_mmu_map -- create a host mapping for guest memory
142void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gfn_t gfn, u64 asid, 262 *
143 u32 flags) 263 * If the guest wanted a larger page than the host supports, only the first
264 * host page is mapped here and the rest are demand faulted.
265 *
266 * If the guest wanted a smaller page than the host page size, we map only the
267 * guest-size page (i.e. not a full host page mapping).
268 *
269 * Caller must ensure that the specified guest TLB entry is safe to insert into
270 * the shadow TLB.
271 */
272void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gpa_t gpaddr, u64 asid,
273 u32 flags, u32 max_bytes, unsigned int gtlb_index)
144{ 274{
275 struct kvmppc_44x_tlbe stlbe;
276 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
277 struct kvmppc_44x_shadow_ref *ref;
145 struct page *new_page; 278 struct page *new_page;
146 struct tlbe *stlbe;
147 hpa_t hpaddr; 279 hpa_t hpaddr;
280 gfn_t gfn;
148 unsigned int victim; 281 unsigned int victim;
149 282
150 /* Future optimization: don't overwrite the TLB entry containing the 283 /* Select TLB entry to clobber. Indirectly guard against races with the TLB
151 * current PC (or stack?). */ 284 * miss handler by disabling interrupts. */
152 victim = kvmppc_tlb_44x_pos++; 285 local_irq_disable();
153 if (kvmppc_tlb_44x_pos > tlb_44x_hwater) 286 victim = ++tlb_44x_index;
154 kvmppc_tlb_44x_pos = 0; 287 if (victim > tlb_44x_hwater)
155 stlbe = &vcpu->arch.shadow_tlb[victim]; 288 victim = 0;
289 tlb_44x_index = victim;
290 local_irq_enable();
156 291
157 /* Get reference to new page. */ 292 /* Get reference to new page. */
293 gfn = gpaddr >> PAGE_SHIFT;
158 new_page = gfn_to_page(vcpu->kvm, gfn); 294 new_page = gfn_to_page(vcpu->kvm, gfn);
159 if (is_error_page(new_page)) { 295 if (is_error_page(new_page)) {
160 printk(KERN_ERR "Couldn't get guest page for gfn %lx!\n", gfn); 296 printk(KERN_ERR "Couldn't get guest page for gfn %lx!\n", gfn);
@@ -163,10 +299,8 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gfn_t gfn, u64 asid,
163 } 299 }
164 hpaddr = page_to_phys(new_page); 300 hpaddr = page_to_phys(new_page);
165 301
166 /* Drop reference to old page. */ 302 /* Invalidate any previous shadow mappings. */
167 kvmppc_44x_shadow_release(vcpu, victim); 303 kvmppc_44x_shadow_release(vcpu_44x, victim);
168
169 vcpu->arch.shadow_pages[victim] = new_page;
170 304
171 /* XXX Make sure (va, size) doesn't overlap any other 305 /* XXX Make sure (va, size) doesn't overlap any other
172 * entries. 440x6 user manual says the result would be 306 * entries. 440x6 user manual says the result would be
@@ -174,78 +308,193 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gfn_t gfn, u64 asid,
174 308
175 /* XXX what about AS? */ 309 /* XXX what about AS? */
176 310
177 stlbe->tid = !(asid & 0xff);
178
179 /* Force TS=1 for all guest mappings. */ 311 /* Force TS=1 for all guest mappings. */
180 /* For now we hardcode 4KB mappings, but it will be important to 312 stlbe.word0 = PPC44x_TLB_VALID | PPC44x_TLB_TS;
181 * use host large pages in the future. */ 313
182 stlbe->word0 = (gvaddr & PAGE_MASK) | PPC44x_TLB_VALID | PPC44x_TLB_TS 314 if (max_bytes >= PAGE_SIZE) {
183 | PPC44x_TLB_4K; 315 /* Guest mapping is larger than or equal to host page size. We can use
184 stlbe->word1 = (hpaddr & 0xfffffc00) | ((hpaddr >> 32) & 0xf); 316 * a "native" host mapping. */
185 stlbe->word2 = kvmppc_44x_tlb_shadow_attrib(flags, 317 stlbe.word0 |= (gvaddr & PAGE_MASK) | PPC44x_TLBE_SIZE;
186 vcpu->arch.msr & MSR_PR); 318 } else {
187 kvmppc_tlbe_set_modified(vcpu, victim); 319 /* Guest mapping is smaller than host page size. We must restrict the
320 * size of the mapping to be at most the smaller of the two, but for
321 * simplicity we fall back to a 4K mapping (this is probably what the
322 * guest is using anyways). */
323 stlbe.word0 |= (gvaddr & PAGE_MASK_4K) | PPC44x_TLB_4K;
324
325 /* 'hpaddr' is a host page, which is larger than the mapping we're
326 * inserting here. To compensate, we must add the in-page offset to the
327 * sub-page. */
328 hpaddr |= gpaddr & (PAGE_MASK ^ PAGE_MASK_4K);
329 }
188 330
189 KVMTRACE_5D(STLB_WRITE, vcpu, victim, 331 stlbe.word1 = (hpaddr & 0xfffffc00) | ((hpaddr >> 32) & 0xf);
190 stlbe->tid, stlbe->word0, stlbe->word1, stlbe->word2, 332 stlbe.word2 = kvmppc_44x_tlb_shadow_attrib(flags,
191 handler); 333 vcpu->arch.msr & MSR_PR);
334 stlbe.tid = !(asid & 0xff);
335
336 /* Keep track of the reference so we can properly release it later. */
337 ref = &vcpu_44x->shadow_refs[victim];
338 ref->page = new_page;
339 ref->gtlb_index = gtlb_index;
340 ref->writeable = !!(stlbe.word2 & PPC44x_TLB_UW);
341 ref->tid = stlbe.tid;
342
343 /* Insert shadow mapping into hardware TLB. */
344 kvmppc_44x_tlbe_set_modified(vcpu_44x, victim);
345 kvmppc_44x_tlbwe(victim, &stlbe);
346 KVMTRACE_5D(STLB_WRITE, vcpu, victim, stlbe.tid, stlbe.word0, stlbe.word1,
347 stlbe.word2, handler);
192} 348}
193 349
194void kvmppc_mmu_invalidate(struct kvm_vcpu *vcpu, gva_t eaddr, 350/* For a particular guest TLB entry, invalidate the corresponding host TLB
195 gva_t eend, u32 asid) 351 * mappings and release the host pages. */
352static void kvmppc_44x_invalidate(struct kvm_vcpu *vcpu,
353 unsigned int gtlb_index)
196{ 354{
197 unsigned int pid = !(asid & 0xff); 355 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
198 int i; 356 int i;
199 357
200 /* XXX Replace loop with fancy data structures. */ 358 for (i = 0; i < ARRAY_SIZE(vcpu_44x->shadow_refs); i++) {
201 for (i = 0; i <= tlb_44x_hwater; i++) { 359 struct kvmppc_44x_shadow_ref *ref = &vcpu_44x->shadow_refs[i];
202 struct tlbe *stlbe = &vcpu->arch.shadow_tlb[i]; 360 if (ref->gtlb_index == gtlb_index)
203 unsigned int tid; 361 kvmppc_44x_shadow_release(vcpu_44x, i);
362 }
363}
204 364
205 if (!get_tlb_v(stlbe)) 365void kvmppc_mmu_priv_switch(struct kvm_vcpu *vcpu, int usermode)
206 continue; 366{
367 vcpu->arch.shadow_pid = !usermode;
368}
207 369
208 if (eend < get_tlb_eaddr(stlbe)) 370void kvmppc_set_pid(struct kvm_vcpu *vcpu, u32 new_pid)
209 continue; 371{
372 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
373 int i;
210 374
211 if (eaddr > get_tlb_end(stlbe)) 375 if (unlikely(vcpu->arch.pid == new_pid))
212 continue; 376 return;
213 377
214 tid = get_tlb_tid(stlbe); 378 vcpu->arch.pid = new_pid;
215 if (tid && (tid != pid))
216 continue;
217 379
218 kvmppc_44x_shadow_release(vcpu, i); 380 /* Guest userspace runs with TID=0 mappings and PID=0, to make sure it
219 stlbe->word0 = 0; 381 * can't access guest kernel mappings (TID=1). When we switch to a new
220 kvmppc_tlbe_set_modified(vcpu, i); 382 * guest PID, which will also use host PID=0, we must discard the old guest
221 KVMTRACE_5D(STLB_INVAL, vcpu, i, 383 * userspace mappings. */
222 stlbe->tid, stlbe->word0, stlbe->word1, 384 for (i = 0; i < ARRAY_SIZE(vcpu_44x->shadow_refs); i++) {
223 stlbe->word2, handler); 385 struct kvmppc_44x_shadow_ref *ref = &vcpu_44x->shadow_refs[i];
386
387 if (ref->tid == 0)
388 kvmppc_44x_shadow_release(vcpu_44x, i);
224 } 389 }
225} 390}
226 391
227/* Invalidate all mappings on the privilege switch after PID has been changed. 392static int tlbe_is_host_safe(const struct kvm_vcpu *vcpu,
228 * The guest always runs with PID=1, so we must clear the entire TLB when 393 const struct kvmppc_44x_tlbe *tlbe)
229 * switching address spaces. */
230void kvmppc_mmu_priv_switch(struct kvm_vcpu *vcpu, int usermode)
231{ 394{
232 int i; 395 gpa_t gpa;
233 396
234 if (vcpu->arch.swap_pid) { 397 if (!get_tlb_v(tlbe))
235 /* XXX Replace loop with fancy data structures. */ 398 return 0;
236 for (i = 0; i <= tlb_44x_hwater; i++) { 399
237 struct tlbe *stlbe = &vcpu->arch.shadow_tlb[i]; 400 /* Does it match current guest AS? */
238 401 /* XXX what about IS != DS? */
239 /* Future optimization: clear only userspace mappings. */ 402 if (get_tlb_ts(tlbe) != !!(vcpu->arch.msr & MSR_IS))
240 kvmppc_44x_shadow_release(vcpu, i); 403 return 0;
241 stlbe->word0 = 0; 404
242 kvmppc_tlbe_set_modified(vcpu, i); 405 gpa = get_tlb_raddr(tlbe);
243 KVMTRACE_5D(STLB_INVAL, vcpu, i, 406 if (!gfn_to_memslot(vcpu->kvm, gpa >> PAGE_SHIFT))
244 stlbe->tid, stlbe->word0, stlbe->word1, 407 /* Mapping is not for RAM. */
245 stlbe->word2, handler); 408 return 0;
246 } 409
247 vcpu->arch.swap_pid = 0; 410 return 1;
411}
412
413int kvmppc_44x_emul_tlbwe(struct kvm_vcpu *vcpu, u8 ra, u8 rs, u8 ws)
414{
415 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
416 struct kvmppc_44x_tlbe *tlbe;
417 unsigned int gtlb_index;
418
419 gtlb_index = vcpu->arch.gpr[ra];
420 if (gtlb_index > KVM44x_GUEST_TLB_SIZE) {
421 printk("%s: index %d\n", __func__, gtlb_index);
422 kvmppc_dump_vcpu(vcpu);
423 return EMULATE_FAIL;
248 } 424 }
249 425
250 vcpu->arch.shadow_pid = !usermode; 426 tlbe = &vcpu_44x->guest_tlb[gtlb_index];
427
428 /* Invalidate shadow mappings for the about-to-be-clobbered TLB entry. */
429 if (tlbe->word0 & PPC44x_TLB_VALID)
430 kvmppc_44x_invalidate(vcpu, gtlb_index);
431
432 switch (ws) {
433 case PPC44x_TLB_PAGEID:
434 tlbe->tid = get_mmucr_stid(vcpu);
435 tlbe->word0 = vcpu->arch.gpr[rs];
436 break;
437
438 case PPC44x_TLB_XLAT:
439 tlbe->word1 = vcpu->arch.gpr[rs];
440 break;
441
442 case PPC44x_TLB_ATTRIB:
443 tlbe->word2 = vcpu->arch.gpr[rs];
444 break;
445
446 default:
447 return EMULATE_FAIL;
448 }
449
450 if (tlbe_is_host_safe(vcpu, tlbe)) {
451 u64 asid;
452 gva_t eaddr;
453 gpa_t gpaddr;
454 u32 flags;
455 u32 bytes;
456
457 eaddr = get_tlb_eaddr(tlbe);
458 gpaddr = get_tlb_raddr(tlbe);
459
460 /* Use the advertised page size to mask effective and real addrs. */
461 bytes = get_tlb_bytes(tlbe);
462 eaddr &= ~(bytes - 1);
463 gpaddr &= ~(bytes - 1);
464
465 asid = (tlbe->word0 & PPC44x_TLB_TS) | tlbe->tid;
466 flags = tlbe->word2 & 0xffff;
467
468 kvmppc_mmu_map(vcpu, eaddr, gpaddr, asid, flags, bytes, gtlb_index);
469 }
470
471 KVMTRACE_5D(GTLB_WRITE, vcpu, gtlb_index, tlbe->tid, tlbe->word0,
472 tlbe->word1, tlbe->word2, handler);
473
474 kvmppc_set_exit_type(vcpu, EMULATED_TLBWE_EXITS);
475 return EMULATE_DONE;
476}
477
478int kvmppc_44x_emul_tlbsx(struct kvm_vcpu *vcpu, u8 rt, u8 ra, u8 rb, u8 rc)
479{
480 u32 ea;
481 int gtlb_index;
482 unsigned int as = get_mmucr_sts(vcpu);
483 unsigned int pid = get_mmucr_stid(vcpu);
484
485 ea = vcpu->arch.gpr[rb];
486 if (ra)
487 ea += vcpu->arch.gpr[ra];
488
489 gtlb_index = kvmppc_44x_tlb_index(vcpu, ea, pid, as);
490 if (rc) {
491 if (gtlb_index < 0)
492 vcpu->arch.cr &= ~0x20000000;
493 else
494 vcpu->arch.cr |= 0x20000000;
495 }
496 vcpu->arch.gpr[rt] = gtlb_index;
497
498 kvmppc_set_exit_type(vcpu, EMULATED_TLBSX_EXITS);
499 return EMULATE_DONE;
251} 500}
diff --git a/arch/powerpc/kvm/44x_tlb.h b/arch/powerpc/kvm/44x_tlb.h
index 2ccd46b6f6b7..772191f29e62 100644
--- a/arch/powerpc/kvm/44x_tlb.h
+++ b/arch/powerpc/kvm/44x_tlb.h
@@ -25,48 +25,52 @@
25 25
26extern int kvmppc_44x_tlb_index(struct kvm_vcpu *vcpu, gva_t eaddr, 26extern int kvmppc_44x_tlb_index(struct kvm_vcpu *vcpu, gva_t eaddr,
27 unsigned int pid, unsigned int as); 27 unsigned int pid, unsigned int as);
28extern struct tlbe *kvmppc_44x_dtlb_search(struct kvm_vcpu *vcpu, gva_t eaddr); 28extern int kvmppc_44x_dtlb_index(struct kvm_vcpu *vcpu, gva_t eaddr);
29extern struct tlbe *kvmppc_44x_itlb_search(struct kvm_vcpu *vcpu, gva_t eaddr); 29extern int kvmppc_44x_itlb_index(struct kvm_vcpu *vcpu, gva_t eaddr);
30
31extern int kvmppc_44x_emul_tlbsx(struct kvm_vcpu *vcpu, u8 rt, u8 ra, u8 rb,
32 u8 rc);
33extern int kvmppc_44x_emul_tlbwe(struct kvm_vcpu *vcpu, u8 ra, u8 rs, u8 ws);
30 34
31/* TLB helper functions */ 35/* TLB helper functions */
32static inline unsigned int get_tlb_size(const struct tlbe *tlbe) 36static inline unsigned int get_tlb_size(const struct kvmppc_44x_tlbe *tlbe)
33{ 37{
34 return (tlbe->word0 >> 4) & 0xf; 38 return (tlbe->word0 >> 4) & 0xf;
35} 39}
36 40
37static inline gva_t get_tlb_eaddr(const struct tlbe *tlbe) 41static inline gva_t get_tlb_eaddr(const struct kvmppc_44x_tlbe *tlbe)
38{ 42{
39 return tlbe->word0 & 0xfffffc00; 43 return tlbe->word0 & 0xfffffc00;
40} 44}
41 45
42static inline gva_t get_tlb_bytes(const struct tlbe *tlbe) 46static inline gva_t get_tlb_bytes(const struct kvmppc_44x_tlbe *tlbe)
43{ 47{
44 unsigned int pgsize = get_tlb_size(tlbe); 48 unsigned int pgsize = get_tlb_size(tlbe);
45 return 1 << 10 << (pgsize << 1); 49 return 1 << 10 << (pgsize << 1);
46} 50}
47 51
48static inline gva_t get_tlb_end(const struct tlbe *tlbe) 52static inline gva_t get_tlb_end(const struct kvmppc_44x_tlbe *tlbe)
49{ 53{
50 return get_tlb_eaddr(tlbe) + get_tlb_bytes(tlbe) - 1; 54 return get_tlb_eaddr(tlbe) + get_tlb_bytes(tlbe) - 1;
51} 55}
52 56
53static inline u64 get_tlb_raddr(const struct tlbe *tlbe) 57static inline u64 get_tlb_raddr(const struct kvmppc_44x_tlbe *tlbe)
54{ 58{
55 u64 word1 = tlbe->word1; 59 u64 word1 = tlbe->word1;
56 return ((word1 & 0xf) << 32) | (word1 & 0xfffffc00); 60 return ((word1 & 0xf) << 32) | (word1 & 0xfffffc00);
57} 61}
58 62
59static inline unsigned int get_tlb_tid(const struct tlbe *tlbe) 63static inline unsigned int get_tlb_tid(const struct kvmppc_44x_tlbe *tlbe)
60{ 64{
61 return tlbe->tid & 0xff; 65 return tlbe->tid & 0xff;
62} 66}
63 67
64static inline unsigned int get_tlb_ts(const struct tlbe *tlbe) 68static inline unsigned int get_tlb_ts(const struct kvmppc_44x_tlbe *tlbe)
65{ 69{
66 return (tlbe->word0 >> 8) & 0x1; 70 return (tlbe->word0 >> 8) & 0x1;
67} 71}
68 72
69static inline unsigned int get_tlb_v(const struct tlbe *tlbe) 73static inline unsigned int get_tlb_v(const struct kvmppc_44x_tlbe *tlbe)
70{ 74{
71 return (tlbe->word0 >> 9) & 0x1; 75 return (tlbe->word0 >> 9) & 0x1;
72} 76}
@@ -81,7 +85,7 @@ static inline unsigned int get_mmucr_sts(const struct kvm_vcpu *vcpu)
81 return (vcpu->arch.mmucr >> 16) & 0x1; 85 return (vcpu->arch.mmucr >> 16) & 0x1;
82} 86}
83 87
84static inline gpa_t tlb_xlate(struct tlbe *tlbe, gva_t eaddr) 88static inline gpa_t tlb_xlate(struct kvmppc_44x_tlbe *tlbe, gva_t eaddr)
85{ 89{
86 unsigned int pgmask = get_tlb_bytes(tlbe) - 1; 90 unsigned int pgmask = get_tlb_bytes(tlbe) - 1;
87 91
diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig
index 53aaa66b25e5..6dbdc4817d80 100644
--- a/arch/powerpc/kvm/Kconfig
+++ b/arch/powerpc/kvm/Kconfig
@@ -15,27 +15,33 @@ menuconfig VIRTUALIZATION
15if VIRTUALIZATION 15if VIRTUALIZATION
16 16
17config KVM 17config KVM
18 bool "Kernel-based Virtual Machine (KVM) support" 18 bool
19 depends on 44x && EXPERIMENTAL
20 select PREEMPT_NOTIFIERS 19 select PREEMPT_NOTIFIERS
21 select ANON_INODES 20 select ANON_INODES
22 # We can only run on Book E hosts so far 21
23 select KVM_BOOKE_HOST 22config KVM_440
23 bool "KVM support for PowerPC 440 processors"
24 depends on EXPERIMENTAL && 44x
25 select KVM
24 ---help--- 26 ---help---
25 Support hosting virtualized guest machines. You will also 27 Support running unmodified 440 guest kernels in virtual machines on
26 need to select one or more of the processor modules below. 28 440 host processors.
27 29
28 This module provides access to the hardware capabilities through 30 This module provides access to the hardware capabilities through
29 a character device node named /dev/kvm. 31 a character device node named /dev/kvm.
30 32
31 If unsure, say N. 33 If unsure, say N.
32 34
33config KVM_BOOKE_HOST 35config KVM_EXIT_TIMING
34 bool "KVM host support for Book E PowerPC processors" 36 bool "Detailed exit timing"
35 depends on KVM && 44x 37 depends on KVM
36 ---help--- 38 ---help---
37 Provides host support for KVM on Book E PowerPC processors. Currently 39 Calculate elapsed time for every exit/enter cycle. A per-vcpu
38 this works on 440 processors only. 40 report is available in debugfs kvm/vm#_vcpu#_timing.
41 The overhead is relatively small, however it is not recommended for
42 production environments.
43
44 If unsure, say N.
39 45
40config KVM_TRACE 46config KVM_TRACE
41 bool "KVM trace support" 47 bool "KVM trace support"
diff --git a/arch/powerpc/kvm/Makefile b/arch/powerpc/kvm/Makefile
index 2a5d4397ac4b..df7ba59e6d53 100644
--- a/arch/powerpc/kvm/Makefile
+++ b/arch/powerpc/kvm/Makefile
@@ -8,10 +8,16 @@ common-objs-y = $(addprefix ../../../virt/kvm/, kvm_main.o coalesced_mmio.o)
8 8
9common-objs-$(CONFIG_KVM_TRACE) += $(addprefix ../../../virt/kvm/, kvm_trace.o) 9common-objs-$(CONFIG_KVM_TRACE) += $(addprefix ../../../virt/kvm/, kvm_trace.o)
10 10
11kvm-objs := $(common-objs-y) powerpc.o emulate.o booke_guest.o 11kvm-objs := $(common-objs-y) powerpc.o emulate.o
12obj-$(CONFIG_KVM_EXIT_TIMING) += timing.o
12obj-$(CONFIG_KVM) += kvm.o 13obj-$(CONFIG_KVM) += kvm.o
13 14
14AFLAGS_booke_interrupts.o := -I$(obj) 15AFLAGS_booke_interrupts.o := -I$(obj)
15 16
16kvm-booke-host-objs := booke_host.o booke_interrupts.o 44x_tlb.o 17kvm-440-objs := \
17obj-$(CONFIG_KVM_BOOKE_HOST) += kvm-booke-host.o 18 booke.o \
19 booke_interrupts.o \
20 44x.o \
21 44x_tlb.o \
22 44x_emulate.o
23obj-$(CONFIG_KVM_440) += kvm-440.o
diff --git a/arch/powerpc/kvm/booke_guest.c b/arch/powerpc/kvm/booke.c
index 7b2591e26bae..35485dd6927e 100644
--- a/arch/powerpc/kvm/booke_guest.c
+++ b/arch/powerpc/kvm/booke.c
@@ -24,21 +24,26 @@
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/vmalloc.h> 25#include <linux/vmalloc.h>
26#include <linux/fs.h> 26#include <linux/fs.h>
27
27#include <asm/cputable.h> 28#include <asm/cputable.h>
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
29#include <asm/kvm_ppc.h> 30#include <asm/kvm_ppc.h>
31#include "timing.h"
32#include <asm/cacheflush.h>
33#include <asm/kvm_44x.h>
30 34
35#include "booke.h"
31#include "44x_tlb.h" 36#include "44x_tlb.h"
32 37
38unsigned long kvmppc_booke_handlers;
39
33#define VM_STAT(x) offsetof(struct kvm, stat.x), KVM_STAT_VM 40#define VM_STAT(x) offsetof(struct kvm, stat.x), KVM_STAT_VM
34#define VCPU_STAT(x) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU 41#define VCPU_STAT(x) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU
35 42
36struct kvm_stats_debugfs_item debugfs_entries[] = { 43struct kvm_stats_debugfs_item debugfs_entries[] = {
37 { "exits", VCPU_STAT(sum_exits) },
38 { "mmio", VCPU_STAT(mmio_exits) }, 44 { "mmio", VCPU_STAT(mmio_exits) },
39 { "dcr", VCPU_STAT(dcr_exits) }, 45 { "dcr", VCPU_STAT(dcr_exits) },
40 { "sig", VCPU_STAT(signal_exits) }, 46 { "sig", VCPU_STAT(signal_exits) },
41 { "light", VCPU_STAT(light_exits) },
42 { "itlb_r", VCPU_STAT(itlb_real_miss_exits) }, 47 { "itlb_r", VCPU_STAT(itlb_real_miss_exits) },
43 { "itlb_v", VCPU_STAT(itlb_virt_miss_exits) }, 48 { "itlb_v", VCPU_STAT(itlb_virt_miss_exits) },
44 { "dtlb_r", VCPU_STAT(dtlb_real_miss_exits) }, 49 { "dtlb_r", VCPU_STAT(dtlb_real_miss_exits) },
@@ -53,103 +58,19 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
53 { NULL } 58 { NULL }
54}; 59};
55 60
56static const u32 interrupt_msr_mask[16] = {
57 [BOOKE_INTERRUPT_CRITICAL] = MSR_ME,
58 [BOOKE_INTERRUPT_MACHINE_CHECK] = 0,
59 [BOOKE_INTERRUPT_DATA_STORAGE] = MSR_CE|MSR_ME|MSR_DE,
60 [BOOKE_INTERRUPT_INST_STORAGE] = MSR_CE|MSR_ME|MSR_DE,
61 [BOOKE_INTERRUPT_EXTERNAL] = MSR_CE|MSR_ME|MSR_DE,
62 [BOOKE_INTERRUPT_ALIGNMENT] = MSR_CE|MSR_ME|MSR_DE,
63 [BOOKE_INTERRUPT_PROGRAM] = MSR_CE|MSR_ME|MSR_DE,
64 [BOOKE_INTERRUPT_FP_UNAVAIL] = MSR_CE|MSR_ME|MSR_DE,
65 [BOOKE_INTERRUPT_SYSCALL] = MSR_CE|MSR_ME|MSR_DE,
66 [BOOKE_INTERRUPT_AP_UNAVAIL] = MSR_CE|MSR_ME|MSR_DE,
67 [BOOKE_INTERRUPT_DECREMENTER] = MSR_CE|MSR_ME|MSR_DE,
68 [BOOKE_INTERRUPT_FIT] = MSR_CE|MSR_ME|MSR_DE,
69 [BOOKE_INTERRUPT_WATCHDOG] = MSR_ME,
70 [BOOKE_INTERRUPT_DTLB_MISS] = MSR_CE|MSR_ME|MSR_DE,
71 [BOOKE_INTERRUPT_ITLB_MISS] = MSR_CE|MSR_ME|MSR_DE,
72 [BOOKE_INTERRUPT_DEBUG] = MSR_ME,
73};
74
75const unsigned char exception_priority[] = {
76 [BOOKE_INTERRUPT_DATA_STORAGE] = 0,
77 [BOOKE_INTERRUPT_INST_STORAGE] = 1,
78 [BOOKE_INTERRUPT_ALIGNMENT] = 2,
79 [BOOKE_INTERRUPT_PROGRAM] = 3,
80 [BOOKE_INTERRUPT_FP_UNAVAIL] = 4,
81 [BOOKE_INTERRUPT_SYSCALL] = 5,
82 [BOOKE_INTERRUPT_AP_UNAVAIL] = 6,
83 [BOOKE_INTERRUPT_DTLB_MISS] = 7,
84 [BOOKE_INTERRUPT_ITLB_MISS] = 8,
85 [BOOKE_INTERRUPT_MACHINE_CHECK] = 9,
86 [BOOKE_INTERRUPT_DEBUG] = 10,
87 [BOOKE_INTERRUPT_CRITICAL] = 11,
88 [BOOKE_INTERRUPT_WATCHDOG] = 12,
89 [BOOKE_INTERRUPT_EXTERNAL] = 13,
90 [BOOKE_INTERRUPT_FIT] = 14,
91 [BOOKE_INTERRUPT_DECREMENTER] = 15,
92};
93
94const unsigned char priority_exception[] = {
95 BOOKE_INTERRUPT_DATA_STORAGE,
96 BOOKE_INTERRUPT_INST_STORAGE,
97 BOOKE_INTERRUPT_ALIGNMENT,
98 BOOKE_INTERRUPT_PROGRAM,
99 BOOKE_INTERRUPT_FP_UNAVAIL,
100 BOOKE_INTERRUPT_SYSCALL,
101 BOOKE_INTERRUPT_AP_UNAVAIL,
102 BOOKE_INTERRUPT_DTLB_MISS,
103 BOOKE_INTERRUPT_ITLB_MISS,
104 BOOKE_INTERRUPT_MACHINE_CHECK,
105 BOOKE_INTERRUPT_DEBUG,
106 BOOKE_INTERRUPT_CRITICAL,
107 BOOKE_INTERRUPT_WATCHDOG,
108 BOOKE_INTERRUPT_EXTERNAL,
109 BOOKE_INTERRUPT_FIT,
110 BOOKE_INTERRUPT_DECREMENTER,
111};
112
113
114void kvmppc_dump_tlbs(struct kvm_vcpu *vcpu)
115{
116 struct tlbe *tlbe;
117 int i;
118
119 printk("vcpu %d TLB dump:\n", vcpu->vcpu_id);
120 printk("| %2s | %3s | %8s | %8s | %8s |\n",
121 "nr", "tid", "word0", "word1", "word2");
122
123 for (i = 0; i < PPC44x_TLB_SIZE; i++) {
124 tlbe = &vcpu->arch.guest_tlb[i];
125 if (tlbe->word0 & PPC44x_TLB_VALID)
126 printk(" G%2d | %02X | %08X | %08X | %08X |\n",
127 i, tlbe->tid, tlbe->word0, tlbe->word1,
128 tlbe->word2);
129 }
130
131 for (i = 0; i < PPC44x_TLB_SIZE; i++) {
132 tlbe = &vcpu->arch.shadow_tlb[i];
133 if (tlbe->word0 & PPC44x_TLB_VALID)
134 printk(" S%2d | %02X | %08X | %08X | %08X |\n",
135 i, tlbe->tid, tlbe->word0, tlbe->word1,
136 tlbe->word2);
137 }
138}
139
140/* TODO: use vcpu_printf() */ 61/* TODO: use vcpu_printf() */
141void kvmppc_dump_vcpu(struct kvm_vcpu *vcpu) 62void kvmppc_dump_vcpu(struct kvm_vcpu *vcpu)
142{ 63{
143 int i; 64 int i;
144 65
145 printk("pc: %08x msr: %08x\n", vcpu->arch.pc, vcpu->arch.msr); 66 printk("pc: %08lx msr: %08lx\n", vcpu->arch.pc, vcpu->arch.msr);
146 printk("lr: %08x ctr: %08x\n", vcpu->arch.lr, vcpu->arch.ctr); 67 printk("lr: %08lx ctr: %08lx\n", vcpu->arch.lr, vcpu->arch.ctr);
147 printk("srr0: %08x srr1: %08x\n", vcpu->arch.srr0, vcpu->arch.srr1); 68 printk("srr0: %08lx srr1: %08lx\n", vcpu->arch.srr0, vcpu->arch.srr1);
148 69
149 printk("exceptions: %08lx\n", vcpu->arch.pending_exceptions); 70 printk("exceptions: %08lx\n", vcpu->arch.pending_exceptions);
150 71
151 for (i = 0; i < 32; i += 4) { 72 for (i = 0; i < 32; i += 4) {
152 printk("gpr%02d: %08x %08x %08x %08x\n", i, 73 printk("gpr%02d: %08lx %08lx %08lx %08lx\n", i,
153 vcpu->arch.gpr[i], 74 vcpu->arch.gpr[i],
154 vcpu->arch.gpr[i+1], 75 vcpu->arch.gpr[i+1],
155 vcpu->arch.gpr[i+2], 76 vcpu->arch.gpr[i+2],
@@ -157,69 +78,96 @@ void kvmppc_dump_vcpu(struct kvm_vcpu *vcpu)
157 } 78 }
158} 79}
159 80
160/* Check if we are ready to deliver the interrupt */ 81static void kvmppc_booke_queue_irqprio(struct kvm_vcpu *vcpu,
161static int kvmppc_can_deliver_interrupt(struct kvm_vcpu *vcpu, int interrupt) 82 unsigned int priority)
162{ 83{
163 int r; 84 set_bit(priority, &vcpu->arch.pending_exceptions);
85}
164 86
165 switch (interrupt) { 87void kvmppc_core_queue_program(struct kvm_vcpu *vcpu)
166 case BOOKE_INTERRUPT_CRITICAL: 88{
167 r = vcpu->arch.msr & MSR_CE; 89 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_PROGRAM);
168 break; 90}
169 case BOOKE_INTERRUPT_MACHINE_CHECK: 91
170 r = vcpu->arch.msr & MSR_ME; 92void kvmppc_core_queue_dec(struct kvm_vcpu *vcpu)
171 break; 93{
172 case BOOKE_INTERRUPT_EXTERNAL: 94 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_DECREMENTER);
173 r = vcpu->arch.msr & MSR_EE; 95}
96
97int kvmppc_core_pending_dec(struct kvm_vcpu *vcpu)
98{
99 return test_bit(BOOKE_IRQPRIO_DECREMENTER, &vcpu->arch.pending_exceptions);
100}
101
102void kvmppc_core_queue_external(struct kvm_vcpu *vcpu,
103 struct kvm_interrupt *irq)
104{
105 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_EXTERNAL);
106}
107
108/* Deliver the interrupt of the corresponding priority, if possible. */
109static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu,
110 unsigned int priority)
111{
112 int allowed = 0;
113 ulong msr_mask;
114
115 switch (priority) {
116 case BOOKE_IRQPRIO_PROGRAM:
117 case BOOKE_IRQPRIO_DTLB_MISS:
118 case BOOKE_IRQPRIO_ITLB_MISS:
119 case BOOKE_IRQPRIO_SYSCALL:
120 case BOOKE_IRQPRIO_DATA_STORAGE:
121 case BOOKE_IRQPRIO_INST_STORAGE:
122 case BOOKE_IRQPRIO_FP_UNAVAIL:
123 case BOOKE_IRQPRIO_AP_UNAVAIL:
124 case BOOKE_IRQPRIO_ALIGNMENT:
125 allowed = 1;
126 msr_mask = MSR_CE|MSR_ME|MSR_DE;
174 break; 127 break;
175 case BOOKE_INTERRUPT_DECREMENTER: 128 case BOOKE_IRQPRIO_CRITICAL:
176 r = vcpu->arch.msr & MSR_EE; 129 case BOOKE_IRQPRIO_WATCHDOG:
130 allowed = vcpu->arch.msr & MSR_CE;
131 msr_mask = MSR_ME;
177 break; 132 break;
178 case BOOKE_INTERRUPT_FIT: 133 case BOOKE_IRQPRIO_MACHINE_CHECK:
179 r = vcpu->arch.msr & MSR_EE; 134 allowed = vcpu->arch.msr & MSR_ME;
135 msr_mask = 0;
180 break; 136 break;
181 case BOOKE_INTERRUPT_WATCHDOG: 137 case BOOKE_IRQPRIO_EXTERNAL:
182 r = vcpu->arch.msr & MSR_CE; 138 case BOOKE_IRQPRIO_DECREMENTER:
139 case BOOKE_IRQPRIO_FIT:
140 allowed = vcpu->arch.msr & MSR_EE;
141 msr_mask = MSR_CE|MSR_ME|MSR_DE;
183 break; 142 break;
184 case BOOKE_INTERRUPT_DEBUG: 143 case BOOKE_IRQPRIO_DEBUG:
185 r = vcpu->arch.msr & MSR_DE; 144 allowed = vcpu->arch.msr & MSR_DE;
145 msr_mask = MSR_ME;
186 break; 146 break;
187 default:
188 r = 1;
189 } 147 }
190 148
191 return r; 149 if (allowed) {
192} 150 vcpu->arch.srr0 = vcpu->arch.pc;
151 vcpu->arch.srr1 = vcpu->arch.msr;
152 vcpu->arch.pc = vcpu->arch.ivpr | vcpu->arch.ivor[priority];
153 kvmppc_set_msr(vcpu, vcpu->arch.msr & msr_mask);
193 154
194static void kvmppc_deliver_interrupt(struct kvm_vcpu *vcpu, int interrupt) 155 clear_bit(priority, &vcpu->arch.pending_exceptions);
195{
196 switch (interrupt) {
197 case BOOKE_INTERRUPT_DECREMENTER:
198 vcpu->arch.tsr |= TSR_DIS;
199 break;
200 } 156 }
201 157
202 vcpu->arch.srr0 = vcpu->arch.pc; 158 return allowed;
203 vcpu->arch.srr1 = vcpu->arch.msr;
204 vcpu->arch.pc = vcpu->arch.ivpr | vcpu->arch.ivor[interrupt];
205 kvmppc_set_msr(vcpu, vcpu->arch.msr & interrupt_msr_mask[interrupt]);
206} 159}
207 160
208/* Check pending exceptions and deliver one, if possible. */ 161/* Check pending exceptions and deliver one, if possible. */
209void kvmppc_check_and_deliver_interrupts(struct kvm_vcpu *vcpu) 162void kvmppc_core_deliver_interrupts(struct kvm_vcpu *vcpu)
210{ 163{
211 unsigned long *pending = &vcpu->arch.pending_exceptions; 164 unsigned long *pending = &vcpu->arch.pending_exceptions;
212 unsigned int exception;
213 unsigned int priority; 165 unsigned int priority;
214 166
215 priority = find_first_bit(pending, BITS_PER_BYTE * sizeof(*pending)); 167 priority = __ffs(*pending);
216 while (priority <= BOOKE_MAX_INTERRUPT) { 168 while (priority <= BOOKE_MAX_INTERRUPT) {
217 exception = priority_exception[priority]; 169 if (kvmppc_booke_irqprio_deliver(vcpu, priority))
218 if (kvmppc_can_deliver_interrupt(vcpu, exception)) {
219 kvmppc_clear_exception(vcpu, exception);
220 kvmppc_deliver_interrupt(vcpu, exception);
221 break; 170 break;
222 }
223 171
224 priority = find_next_bit(pending, 172 priority = find_next_bit(pending,
225 BITS_PER_BYTE * sizeof(*pending), 173 BITS_PER_BYTE * sizeof(*pending),
@@ -238,6 +186,9 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
238 enum emulation_result er; 186 enum emulation_result er;
239 int r = RESUME_HOST; 187 int r = RESUME_HOST;
240 188
189 /* update before a new last_exit_type is rewritten */
190 kvmppc_update_timing_stats(vcpu);
191
241 local_irq_enable(); 192 local_irq_enable();
242 193
243 run->exit_reason = KVM_EXIT_UNKNOWN; 194 run->exit_reason = KVM_EXIT_UNKNOWN;
@@ -251,21 +202,19 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
251 break; 202 break;
252 203
253 case BOOKE_INTERRUPT_EXTERNAL: 204 case BOOKE_INTERRUPT_EXTERNAL:
205 kvmppc_account_exit(vcpu, EXT_INTR_EXITS);
206 if (need_resched())
207 cond_resched();
208 r = RESUME_GUEST;
209 break;
210
254 case BOOKE_INTERRUPT_DECREMENTER: 211 case BOOKE_INTERRUPT_DECREMENTER:
255 /* Since we switched IVPR back to the host's value, the host 212 /* Since we switched IVPR back to the host's value, the host
256 * handled this interrupt the moment we enabled interrupts. 213 * handled this interrupt the moment we enabled interrupts.
257 * Now we just offer it a chance to reschedule the guest. */ 214 * Now we just offer it a chance to reschedule the guest. */
258 215 kvmppc_account_exit(vcpu, DEC_EXITS);
259 /* XXX At this point the TLB still holds our shadow TLB, so if
260 * we do reschedule the host will fault over it. Perhaps we
261 * should politely restore the host's entries to minimize
262 * misses before ceding control. */
263 if (need_resched()) 216 if (need_resched())
264 cond_resched(); 217 cond_resched();
265 if (exit_nr == BOOKE_INTERRUPT_DECREMENTER)
266 vcpu->stat.dec_exits++;
267 else
268 vcpu->stat.ext_intr_exits++;
269 r = RESUME_GUEST; 218 r = RESUME_GUEST;
270 break; 219 break;
271 220
@@ -274,17 +223,19 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
274 /* Program traps generated by user-level software must be handled 223 /* Program traps generated by user-level software must be handled
275 * by the guest kernel. */ 224 * by the guest kernel. */
276 vcpu->arch.esr = vcpu->arch.fault_esr; 225 vcpu->arch.esr = vcpu->arch.fault_esr;
277 kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_PROGRAM); 226 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_PROGRAM);
278 r = RESUME_GUEST; 227 r = RESUME_GUEST;
228 kvmppc_account_exit(vcpu, USR_PR_INST);
279 break; 229 break;
280 } 230 }
281 231
282 er = kvmppc_emulate_instruction(run, vcpu); 232 er = kvmppc_emulate_instruction(run, vcpu);
283 switch (er) { 233 switch (er) {
284 case EMULATE_DONE: 234 case EMULATE_DONE:
235 /* don't overwrite subtypes, just account kvm_stats */
236 kvmppc_account_exit_stat(vcpu, EMULATED_INST_EXITS);
285 /* Future optimization: only reload non-volatiles if 237 /* Future optimization: only reload non-volatiles if
286 * they were actually modified by emulation. */ 238 * they were actually modified by emulation. */
287 vcpu->stat.emulated_inst_exits++;
288 r = RESUME_GUEST_NV; 239 r = RESUME_GUEST_NV;
289 break; 240 break;
290 case EMULATE_DO_DCR: 241 case EMULATE_DO_DCR:
@@ -293,7 +244,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
293 break; 244 break;
294 case EMULATE_FAIL: 245 case EMULATE_FAIL:
295 /* XXX Deliver Program interrupt to guest. */ 246 /* XXX Deliver Program interrupt to guest. */
296 printk(KERN_CRIT "%s: emulation at %x failed (%08x)\n", 247 printk(KERN_CRIT "%s: emulation at %lx failed (%08x)\n",
297 __func__, vcpu->arch.pc, vcpu->arch.last_inst); 248 __func__, vcpu->arch.pc, vcpu->arch.last_inst);
298 /* For debugging, encode the failing instruction and 249 /* For debugging, encode the failing instruction and
299 * report it to userspace. */ 250 * report it to userspace. */
@@ -307,48 +258,53 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
307 break; 258 break;
308 259
309 case BOOKE_INTERRUPT_FP_UNAVAIL: 260 case BOOKE_INTERRUPT_FP_UNAVAIL:
310 kvmppc_queue_exception(vcpu, exit_nr); 261 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_FP_UNAVAIL);
262 kvmppc_account_exit(vcpu, FP_UNAVAIL);
311 r = RESUME_GUEST; 263 r = RESUME_GUEST;
312 break; 264 break;
313 265
314 case BOOKE_INTERRUPT_DATA_STORAGE: 266 case BOOKE_INTERRUPT_DATA_STORAGE:
315 vcpu->arch.dear = vcpu->arch.fault_dear; 267 vcpu->arch.dear = vcpu->arch.fault_dear;
316 vcpu->arch.esr = vcpu->arch.fault_esr; 268 vcpu->arch.esr = vcpu->arch.fault_esr;
317 kvmppc_queue_exception(vcpu, exit_nr); 269 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_DATA_STORAGE);
318 vcpu->stat.dsi_exits++; 270 kvmppc_account_exit(vcpu, DSI_EXITS);
319 r = RESUME_GUEST; 271 r = RESUME_GUEST;
320 break; 272 break;
321 273
322 case BOOKE_INTERRUPT_INST_STORAGE: 274 case BOOKE_INTERRUPT_INST_STORAGE:
323 vcpu->arch.esr = vcpu->arch.fault_esr; 275 vcpu->arch.esr = vcpu->arch.fault_esr;
324 kvmppc_queue_exception(vcpu, exit_nr); 276 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_INST_STORAGE);
325 vcpu->stat.isi_exits++; 277 kvmppc_account_exit(vcpu, ISI_EXITS);
326 r = RESUME_GUEST; 278 r = RESUME_GUEST;
327 break; 279 break;
328 280
329 case BOOKE_INTERRUPT_SYSCALL: 281 case BOOKE_INTERRUPT_SYSCALL:
330 kvmppc_queue_exception(vcpu, exit_nr); 282 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_SYSCALL);
331 vcpu->stat.syscall_exits++; 283 kvmppc_account_exit(vcpu, SYSCALL_EXITS);
332 r = RESUME_GUEST; 284 r = RESUME_GUEST;
333 break; 285 break;
334 286
287 /* XXX move to a 440-specific file. */
335 case BOOKE_INTERRUPT_DTLB_MISS: { 288 case BOOKE_INTERRUPT_DTLB_MISS: {
336 struct tlbe *gtlbe; 289 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
290 struct kvmppc_44x_tlbe *gtlbe;
337 unsigned long eaddr = vcpu->arch.fault_dear; 291 unsigned long eaddr = vcpu->arch.fault_dear;
292 int gtlb_index;
338 gfn_t gfn; 293 gfn_t gfn;
339 294
340 /* Check the guest TLB. */ 295 /* Check the guest TLB. */
341 gtlbe = kvmppc_44x_dtlb_search(vcpu, eaddr); 296 gtlb_index = kvmppc_44x_dtlb_index(vcpu, eaddr);
342 if (!gtlbe) { 297 if (gtlb_index < 0) {
343 /* The guest didn't have a mapping for it. */ 298 /* The guest didn't have a mapping for it. */
344 kvmppc_queue_exception(vcpu, exit_nr); 299 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_DTLB_MISS);
345 vcpu->arch.dear = vcpu->arch.fault_dear; 300 vcpu->arch.dear = vcpu->arch.fault_dear;
346 vcpu->arch.esr = vcpu->arch.fault_esr; 301 vcpu->arch.esr = vcpu->arch.fault_esr;
347 vcpu->stat.dtlb_real_miss_exits++; 302 kvmppc_account_exit(vcpu, DTLB_REAL_MISS_EXITS);
348 r = RESUME_GUEST; 303 r = RESUME_GUEST;
349 break; 304 break;
350 } 305 }
351 306
307 gtlbe = &vcpu_44x->guest_tlb[gtlb_index];
352 vcpu->arch.paddr_accessed = tlb_xlate(gtlbe, eaddr); 308 vcpu->arch.paddr_accessed = tlb_xlate(gtlbe, eaddr);
353 gfn = vcpu->arch.paddr_accessed >> PAGE_SHIFT; 309 gfn = vcpu->arch.paddr_accessed >> PAGE_SHIFT;
354 310
@@ -359,38 +315,45 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
359 * b) the guest used a large mapping which we're faking 315 * b) the guest used a large mapping which we're faking
360 * Either way, we need to satisfy the fault without 316 * Either way, we need to satisfy the fault without
361 * invoking the guest. */ 317 * invoking the guest. */
362 kvmppc_mmu_map(vcpu, eaddr, gfn, gtlbe->tid, 318 kvmppc_mmu_map(vcpu, eaddr, vcpu->arch.paddr_accessed, gtlbe->tid,
363 gtlbe->word2); 319 gtlbe->word2, get_tlb_bytes(gtlbe), gtlb_index);
364 vcpu->stat.dtlb_virt_miss_exits++; 320 kvmppc_account_exit(vcpu, DTLB_VIRT_MISS_EXITS);
365 r = RESUME_GUEST; 321 r = RESUME_GUEST;
366 } else { 322 } else {
367 /* Guest has mapped and accessed a page which is not 323 /* Guest has mapped and accessed a page which is not
368 * actually RAM. */ 324 * actually RAM. */
369 r = kvmppc_emulate_mmio(run, vcpu); 325 r = kvmppc_emulate_mmio(run, vcpu);
326 kvmppc_account_exit(vcpu, MMIO_EXITS);
370 } 327 }
371 328
372 break; 329 break;
373 } 330 }
374 331
332 /* XXX move to a 440-specific file. */
375 case BOOKE_INTERRUPT_ITLB_MISS: { 333 case BOOKE_INTERRUPT_ITLB_MISS: {
376 struct tlbe *gtlbe; 334 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
335 struct kvmppc_44x_tlbe *gtlbe;
377 unsigned long eaddr = vcpu->arch.pc; 336 unsigned long eaddr = vcpu->arch.pc;
337 gpa_t gpaddr;
378 gfn_t gfn; 338 gfn_t gfn;
339 int gtlb_index;
379 340
380 r = RESUME_GUEST; 341 r = RESUME_GUEST;
381 342
382 /* Check the guest TLB. */ 343 /* Check the guest TLB. */
383 gtlbe = kvmppc_44x_itlb_search(vcpu, eaddr); 344 gtlb_index = kvmppc_44x_itlb_index(vcpu, eaddr);
384 if (!gtlbe) { 345 if (gtlb_index < 0) {
385 /* The guest didn't have a mapping for it. */ 346 /* The guest didn't have a mapping for it. */
386 kvmppc_queue_exception(vcpu, exit_nr); 347 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_ITLB_MISS);
387 vcpu->stat.itlb_real_miss_exits++; 348 kvmppc_account_exit(vcpu, ITLB_REAL_MISS_EXITS);
388 break; 349 break;
389 } 350 }
390 351
391 vcpu->stat.itlb_virt_miss_exits++; 352 kvmppc_account_exit(vcpu, ITLB_VIRT_MISS_EXITS);
392 353
393 gfn = tlb_xlate(gtlbe, eaddr) >> PAGE_SHIFT; 354 gtlbe = &vcpu_44x->guest_tlb[gtlb_index];
355 gpaddr = tlb_xlate(gtlbe, eaddr);
356 gfn = gpaddr >> PAGE_SHIFT;
394 357
395 if (kvm_is_visible_gfn(vcpu->kvm, gfn)) { 358 if (kvm_is_visible_gfn(vcpu->kvm, gfn)) {
396 /* The guest TLB had a mapping, but the shadow TLB 359 /* The guest TLB had a mapping, but the shadow TLB
@@ -399,12 +362,11 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
399 * b) the guest used a large mapping which we're faking 362 * b) the guest used a large mapping which we're faking
400 * Either way, we need to satisfy the fault without 363 * Either way, we need to satisfy the fault without
401 * invoking the guest. */ 364 * invoking the guest. */
402 kvmppc_mmu_map(vcpu, eaddr, gfn, gtlbe->tid, 365 kvmppc_mmu_map(vcpu, eaddr, gpaddr, gtlbe->tid,
403 gtlbe->word2); 366 gtlbe->word2, get_tlb_bytes(gtlbe), gtlb_index);
404 } else { 367 } else {
405 /* Guest mapped and leaped at non-RAM! */ 368 /* Guest mapped and leaped at non-RAM! */
406 kvmppc_queue_exception(vcpu, 369 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_MACHINE_CHECK);
407 BOOKE_INTERRUPT_MACHINE_CHECK);
408 } 370 }
409 371
410 break; 372 break;
@@ -421,6 +383,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
421 mtspr(SPRN_DBSR, dbsr); 383 mtspr(SPRN_DBSR, dbsr);
422 384
423 run->exit_reason = KVM_EXIT_DEBUG; 385 run->exit_reason = KVM_EXIT_DEBUG;
386 kvmppc_account_exit(vcpu, DEBUG_EXITS);
424 r = RESUME_HOST; 387 r = RESUME_HOST;
425 break; 388 break;
426 } 389 }
@@ -432,10 +395,8 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
432 395
433 local_irq_disable(); 396 local_irq_disable();
434 397
435 kvmppc_check_and_deliver_interrupts(vcpu); 398 kvmppc_core_deliver_interrupts(vcpu);
436 399
437 /* Do some exit accounting. */
438 vcpu->stat.sum_exits++;
439 if (!(r & RESUME_HOST)) { 400 if (!(r & RESUME_HOST)) {
440 /* To avoid clobbering exit_reason, only check for signals if 401 /* To avoid clobbering exit_reason, only check for signals if
441 * we aren't already exiting to userspace for some other 402 * we aren't already exiting to userspace for some other
@@ -443,22 +404,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
443 if (signal_pending(current)) { 404 if (signal_pending(current)) {
444 run->exit_reason = KVM_EXIT_INTR; 405 run->exit_reason = KVM_EXIT_INTR;
445 r = (-EINTR << 2) | RESUME_HOST | (r & RESUME_FLAG_NV); 406 r = (-EINTR << 2) | RESUME_HOST | (r & RESUME_FLAG_NV);
446 407 kvmppc_account_exit(vcpu, SIGNAL_EXITS);
447 vcpu->stat.signal_exits++;
448 } else {
449 vcpu->stat.light_exits++;
450 }
451 } else {
452 switch (run->exit_reason) {
453 case KVM_EXIT_MMIO:
454 vcpu->stat.mmio_exits++;
455 break;
456 case KVM_EXIT_DCR:
457 vcpu->stat.dcr_exits++;
458 break;
459 case KVM_EXIT_INTR:
460 vcpu->stat.signal_exits++;
461 break;
462 } 408 }
463 } 409 }
464 410
@@ -468,20 +414,6 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
468/* Initial guest state: 16MB mapping 0 -> 0, PC = 0, MSR = 0, R1 = 16MB */ 414/* Initial guest state: 16MB mapping 0 -> 0, PC = 0, MSR = 0, R1 = 16MB */
469int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) 415int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
470{ 416{
471 struct tlbe *tlbe = &vcpu->arch.guest_tlb[0];
472
473 tlbe->tid = 0;
474 tlbe->word0 = PPC44x_TLB_16M | PPC44x_TLB_VALID;
475 tlbe->word1 = 0;
476 tlbe->word2 = PPC44x_TLB_SX | PPC44x_TLB_SW | PPC44x_TLB_SR;
477
478 tlbe++;
479 tlbe->tid = 0;
480 tlbe->word0 = 0xef600000 | PPC44x_TLB_4K | PPC44x_TLB_VALID;
481 tlbe->word1 = 0xef600000;
482 tlbe->word2 = PPC44x_TLB_SX | PPC44x_TLB_SW | PPC44x_TLB_SR
483 | PPC44x_TLB_I | PPC44x_TLB_G;
484
485 vcpu->arch.pc = 0; 417 vcpu->arch.pc = 0;
486 vcpu->arch.msr = 0; 418 vcpu->arch.msr = 0;
487 vcpu->arch.gpr[1] = (16<<20) - 8; /* -8 for the callee-save LR slot */ 419 vcpu->arch.gpr[1] = (16<<20) - 8; /* -8 for the callee-save LR slot */
@@ -492,12 +424,9 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
492 * before it's programmed its own IVPR. */ 424 * before it's programmed its own IVPR. */
493 vcpu->arch.ivpr = 0x55550000; 425 vcpu->arch.ivpr = 0x55550000;
494 426
495 /* Since the guest can directly access the timebase, it must know the 427 kvmppc_init_timing_stats(vcpu);
496 * real timebase frequency. Accordingly, it must see the state of
497 * CCR1[TCS]. */
498 vcpu->arch.ccr1 = mfspr(SPRN_CCR1);
499 428
500 return 0; 429 return kvmppc_core_vcpu_setup(vcpu);
501} 430}
502 431
503int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) 432int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
@@ -536,7 +465,7 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
536 vcpu->arch.ctr = regs->ctr; 465 vcpu->arch.ctr = regs->ctr;
537 vcpu->arch.lr = regs->lr; 466 vcpu->arch.lr = regs->lr;
538 vcpu->arch.xer = regs->xer; 467 vcpu->arch.xer = regs->xer;
539 vcpu->arch.msr = regs->msr; 468 kvmppc_set_msr(vcpu, regs->msr);
540 vcpu->arch.srr0 = regs->srr0; 469 vcpu->arch.srr0 = regs->srr0;
541 vcpu->arch.srr1 = regs->srr1; 470 vcpu->arch.srr1 = regs->srr1;
542 vcpu->arch.sprg0 = regs->sprg0; 471 vcpu->arch.sprg0 = regs->sprg0;
@@ -575,31 +504,62 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
575 return -ENOTSUPP; 504 return -ENOTSUPP;
576} 505}
577 506
578/* 'linear_address' is actually an encoding of AS|PID|EADDR . */
579int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu, 507int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
580 struct kvm_translation *tr) 508 struct kvm_translation *tr)
581{ 509{
582 struct tlbe *gtlbe; 510 return kvmppc_core_vcpu_translate(vcpu, tr);
583 int index; 511}
584 gva_t eaddr;
585 u8 pid;
586 u8 as;
587
588 eaddr = tr->linear_address;
589 pid = (tr->linear_address >> 32) & 0xff;
590 as = (tr->linear_address >> 40) & 0x1;
591
592 index = kvmppc_44x_tlb_index(vcpu, eaddr, pid, as);
593 if (index == -1) {
594 tr->valid = 0;
595 return 0;
596 }
597 512
598 gtlbe = &vcpu->arch.guest_tlb[index]; 513int kvmppc_booke_init(void)
514{
515 unsigned long ivor[16];
516 unsigned long max_ivor = 0;
517 int i;
599 518
600 tr->physical_address = tlb_xlate(gtlbe, eaddr); 519 /* We install our own exception handlers by hijacking IVPR. IVPR must
601 /* XXX what does "writeable" and "usermode" even mean? */ 520 * be 16-bit aligned, so we need a 64KB allocation. */
602 tr->valid = 1; 521 kvmppc_booke_handlers = __get_free_pages(GFP_KERNEL | __GFP_ZERO,
522 VCPU_SIZE_ORDER);
523 if (!kvmppc_booke_handlers)
524 return -ENOMEM;
525
526 /* XXX make sure our handlers are smaller than Linux's */
527
528 /* Copy our interrupt handlers to match host IVORs. That way we don't
529 * have to swap the IVORs on every guest/host transition. */
530 ivor[0] = mfspr(SPRN_IVOR0);
531 ivor[1] = mfspr(SPRN_IVOR1);
532 ivor[2] = mfspr(SPRN_IVOR2);
533 ivor[3] = mfspr(SPRN_IVOR3);
534 ivor[4] = mfspr(SPRN_IVOR4);
535 ivor[5] = mfspr(SPRN_IVOR5);
536 ivor[6] = mfspr(SPRN_IVOR6);
537 ivor[7] = mfspr(SPRN_IVOR7);
538 ivor[8] = mfspr(SPRN_IVOR8);
539 ivor[9] = mfspr(SPRN_IVOR9);
540 ivor[10] = mfspr(SPRN_IVOR10);
541 ivor[11] = mfspr(SPRN_IVOR11);
542 ivor[12] = mfspr(SPRN_IVOR12);
543 ivor[13] = mfspr(SPRN_IVOR13);
544 ivor[14] = mfspr(SPRN_IVOR14);
545 ivor[15] = mfspr(SPRN_IVOR15);
546
547 for (i = 0; i < 16; i++) {
548 if (ivor[i] > max_ivor)
549 max_ivor = ivor[i];
550
551 memcpy((void *)kvmppc_booke_handlers + ivor[i],
552 kvmppc_handlers_start + i * kvmppc_handler_len,
553 kvmppc_handler_len);
554 }
555 flush_icache_range(kvmppc_booke_handlers,
556 kvmppc_booke_handlers + max_ivor + kvmppc_handler_len);
603 557
604 return 0; 558 return 0;
605} 559}
560
561void __exit kvmppc_booke_exit(void)
562{
563 free_pages(kvmppc_booke_handlers, VCPU_SIZE_ORDER);
564 kvm_exit();
565}
diff --git a/arch/powerpc/kvm/booke.h b/arch/powerpc/kvm/booke.h
new file mode 100644
index 000000000000..cf7c94ca24bf
--- /dev/null
+++ b/arch/powerpc/kvm/booke.h
@@ -0,0 +1,60 @@
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, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2008
16 *
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18 */
19
20#ifndef __KVM_BOOKE_H__
21#define __KVM_BOOKE_H__
22
23#include <linux/types.h>
24#include <linux/kvm_host.h>
25#include "timing.h"
26
27/* interrupt priortity ordering */
28#define BOOKE_IRQPRIO_DATA_STORAGE 0
29#define BOOKE_IRQPRIO_INST_STORAGE 1
30#define BOOKE_IRQPRIO_ALIGNMENT 2
31#define BOOKE_IRQPRIO_PROGRAM 3
32#define BOOKE_IRQPRIO_FP_UNAVAIL 4
33#define BOOKE_IRQPRIO_SYSCALL 5
34#define BOOKE_IRQPRIO_AP_UNAVAIL 6
35#define BOOKE_IRQPRIO_DTLB_MISS 7
36#define BOOKE_IRQPRIO_ITLB_MISS 8
37#define BOOKE_IRQPRIO_MACHINE_CHECK 9
38#define BOOKE_IRQPRIO_DEBUG 10
39#define BOOKE_IRQPRIO_CRITICAL 11
40#define BOOKE_IRQPRIO_WATCHDOG 12
41#define BOOKE_IRQPRIO_EXTERNAL 13
42#define BOOKE_IRQPRIO_FIT 14
43#define BOOKE_IRQPRIO_DECREMENTER 15
44
45/* Helper function for "full" MSR writes. No need to call this if only EE is
46 * changing. */
47static inline void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr)
48{
49 if ((new_msr & MSR_PR) != (vcpu->arch.msr & MSR_PR))
50 kvmppc_mmu_priv_switch(vcpu, new_msr & MSR_PR);
51
52 vcpu->arch.msr = new_msr;
53
54 if (vcpu->arch.msr & MSR_WE) {
55 kvm_vcpu_block(vcpu);
56 kvmppc_set_exit_type(vcpu, EMULATED_MTMSRWE_EXITS);
57 };
58}
59
60#endif /* __KVM_BOOKE_H__ */
diff --git a/arch/powerpc/kvm/booke_host.c b/arch/powerpc/kvm/booke_host.c
deleted file mode 100644
index b480341bc31e..000000000000
--- a/arch/powerpc/kvm/booke_host.c
+++ /dev/null
@@ -1,83 +0,0 @@
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, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2008
16 *
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18 */
19
20#include <linux/errno.h>
21#include <linux/kvm_host.h>
22#include <linux/module.h>
23#include <asm/cacheflush.h>
24#include <asm/kvm_ppc.h>
25
26unsigned long kvmppc_booke_handlers;
27
28static int kvmppc_booke_init(void)
29{
30 unsigned long ivor[16];
31 unsigned long max_ivor = 0;
32 int i;
33
34 /* We install our own exception handlers by hijacking IVPR. IVPR must
35 * be 16-bit aligned, so we need a 64KB allocation. */
36 kvmppc_booke_handlers = __get_free_pages(GFP_KERNEL | __GFP_ZERO,
37 VCPU_SIZE_ORDER);
38 if (!kvmppc_booke_handlers)
39 return -ENOMEM;
40
41 /* XXX make sure our handlers are smaller than Linux's */
42
43 /* Copy our interrupt handlers to match host IVORs. That way we don't
44 * have to swap the IVORs on every guest/host transition. */
45 ivor[0] = mfspr(SPRN_IVOR0);
46 ivor[1] = mfspr(SPRN_IVOR1);
47 ivor[2] = mfspr(SPRN_IVOR2);
48 ivor[3] = mfspr(SPRN_IVOR3);
49 ivor[4] = mfspr(SPRN_IVOR4);
50 ivor[5] = mfspr(SPRN_IVOR5);
51 ivor[6] = mfspr(SPRN_IVOR6);
52 ivor[7] = mfspr(SPRN_IVOR7);
53 ivor[8] = mfspr(SPRN_IVOR8);
54 ivor[9] = mfspr(SPRN_IVOR9);
55 ivor[10] = mfspr(SPRN_IVOR10);
56 ivor[11] = mfspr(SPRN_IVOR11);
57 ivor[12] = mfspr(SPRN_IVOR12);
58 ivor[13] = mfspr(SPRN_IVOR13);
59 ivor[14] = mfspr(SPRN_IVOR14);
60 ivor[15] = mfspr(SPRN_IVOR15);
61
62 for (i = 0; i < 16; i++) {
63 if (ivor[i] > max_ivor)
64 max_ivor = ivor[i];
65
66 memcpy((void *)kvmppc_booke_handlers + ivor[i],
67 kvmppc_handlers_start + i * kvmppc_handler_len,
68 kvmppc_handler_len);
69 }
70 flush_icache_range(kvmppc_booke_handlers,
71 kvmppc_booke_handlers + max_ivor + kvmppc_handler_len);
72
73 return kvm_init(NULL, sizeof(struct kvm_vcpu), THIS_MODULE);
74}
75
76static void __exit kvmppc_booke_exit(void)
77{
78 free_pages(kvmppc_booke_handlers, VCPU_SIZE_ORDER);
79 kvm_exit();
80}
81
82module_init(kvmppc_booke_init)
83module_exit(kvmppc_booke_exit)
diff --git a/arch/powerpc/kvm/booke_interrupts.S b/arch/powerpc/kvm/booke_interrupts.S
index 95e165baf85f..084ebcd7dd83 100644
--- a/arch/powerpc/kvm/booke_interrupts.S
+++ b/arch/powerpc/kvm/booke_interrupts.S
@@ -107,6 +107,18 @@ _GLOBAL(kvmppc_resume_host)
107 li r6, 1 107 li r6, 1
108 slw r6, r6, r5 108 slw r6, r6, r5
109 109
110#ifdef CONFIG_KVM_EXIT_TIMING
111 /* save exit time */
1121:
113 mfspr r7, SPRN_TBRU
114 mfspr r8, SPRN_TBRL
115 mfspr r9, SPRN_TBRU
116 cmpw r9, r7
117 bne 1b
118 stw r8, VCPU_TIMING_EXIT_TBL(r4)
119 stw r9, VCPU_TIMING_EXIT_TBU(r4)
120#endif
121
110 /* Save the faulting instruction and all GPRs for emulation. */ 122 /* Save the faulting instruction and all GPRs for emulation. */
111 andi. r7, r6, NEED_INST_MASK 123 andi. r7, r6, NEED_INST_MASK
112 beq ..skip_inst_copy 124 beq ..skip_inst_copy
@@ -335,54 +347,6 @@ lightweight_exit:
335 lwz r3, VCPU_SHADOW_PID(r4) 347 lwz r3, VCPU_SHADOW_PID(r4)
336 mtspr SPRN_PID, r3 348 mtspr SPRN_PID, r3
337 349
338 /* Prevent all asynchronous TLB updates. */
339 mfmsr r5
340 lis r6, (MSR_EE|MSR_CE|MSR_ME|MSR_DE)@h
341 ori r6, r6, (MSR_EE|MSR_CE|MSR_ME|MSR_DE)@l
342 andc r6, r5, r6
343 mtmsr r6
344
345 /* Load the guest mappings, leaving the host's "pinned" kernel mappings
346 * in place. */
347 mfspr r10, SPRN_MMUCR /* Save host MMUCR. */
348 li r5, PPC44x_TLB_SIZE
349 lis r5, tlb_44x_hwater@ha
350 lwz r5, tlb_44x_hwater@l(r5)
351 mtctr r5
352 addi r9, r4, VCPU_SHADOW_TLB
353 addi r5, r4, VCPU_SHADOW_MOD
354 li r3, 0
3551:
356 lbzx r7, r3, r5
357 cmpwi r7, 0
358 beq 3f
359
360 /* Load guest entry. */
361 mulli r11, r3, TLBE_BYTES
362 add r11, r11, r9
363 lwz r7, 0(r11)
364 mtspr SPRN_MMUCR, r7
365 lwz r7, 4(r11)
366 tlbwe r7, r3, PPC44x_TLB_PAGEID
367 lwz r7, 8(r11)
368 tlbwe r7, r3, PPC44x_TLB_XLAT
369 lwz r7, 12(r11)
370 tlbwe r7, r3, PPC44x_TLB_ATTRIB
3713:
372 addi r3, r3, 1 /* Increment index. */
373 bdnz 1b
374
375 mtspr SPRN_MMUCR, r10 /* Restore host MMUCR. */
376
377 /* Clear bitmap of modified TLB entries */
378 li r5, PPC44x_TLB_SIZE>>2
379 mtctr r5
380 addi r5, r4, VCPU_SHADOW_MOD - 4
381 li r6, 0
3821:
383 stwu r6, 4(r5)
384 bdnz 1b
385
386 iccci 0, 0 /* XXX hack */ 350 iccci 0, 0 /* XXX hack */
387 351
388 /* Load some guest volatiles. */ 352 /* Load some guest volatiles. */
@@ -423,6 +387,18 @@ lightweight_exit:
423 lwz r3, VCPU_SPRG7(r4) 387 lwz r3, VCPU_SPRG7(r4)
424 mtspr SPRN_SPRG7, r3 388 mtspr SPRN_SPRG7, r3
425 389
390#ifdef CONFIG_KVM_EXIT_TIMING
391 /* save enter time */
3921:
393 mfspr r6, SPRN_TBRU
394 mfspr r7, SPRN_TBRL
395 mfspr r8, SPRN_TBRU
396 cmpw r8, r6
397 bne 1b
398 stw r7, VCPU_TIMING_LAST_ENTER_TBL(r4)
399 stw r8, VCPU_TIMING_LAST_ENTER_TBU(r4)
400#endif
401
426 /* Finish loading guest volatiles and jump to guest. */ 402 /* Finish loading guest volatiles and jump to guest. */
427 lwz r3, VCPU_CTR(r4) 403 lwz r3, VCPU_CTR(r4)
428 mtctr r3 404 mtctr r3
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index 0fce4fbdc20d..d1d38daa93fb 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -23,161 +23,14 @@
23#include <linux/string.h> 23#include <linux/string.h>
24#include <linux/kvm_host.h> 24#include <linux/kvm_host.h>
25 25
26#include <asm/dcr.h> 26#include <asm/reg.h>
27#include <asm/dcr-regs.h>
28#include <asm/time.h> 27#include <asm/time.h>
29#include <asm/byteorder.h> 28#include <asm/byteorder.h>
30#include <asm/kvm_ppc.h> 29#include <asm/kvm_ppc.h>
30#include <asm/disassemble.h>
31#include "timing.h"
31 32
32#include "44x_tlb.h" 33void kvmppc_emulate_dec(struct kvm_vcpu *vcpu)
33
34/* Instruction decoding */
35static inline unsigned int get_op(u32 inst)
36{
37 return inst >> 26;
38}
39
40static inline unsigned int get_xop(u32 inst)
41{
42 return (inst >> 1) & 0x3ff;
43}
44
45static inline unsigned int get_sprn(u32 inst)
46{
47 return ((inst >> 16) & 0x1f) | ((inst >> 6) & 0x3e0);
48}
49
50static inline unsigned int get_dcrn(u32 inst)
51{
52 return ((inst >> 16) & 0x1f) | ((inst >> 6) & 0x3e0);
53}
54
55static inline unsigned int get_rt(u32 inst)
56{
57 return (inst >> 21) & 0x1f;
58}
59
60static inline unsigned int get_rs(u32 inst)
61{
62 return (inst >> 21) & 0x1f;
63}
64
65static inline unsigned int get_ra(u32 inst)
66{
67 return (inst >> 16) & 0x1f;
68}
69
70static inline unsigned int get_rb(u32 inst)
71{
72 return (inst >> 11) & 0x1f;
73}
74
75static inline unsigned int get_rc(u32 inst)
76{
77 return inst & 0x1;
78}
79
80static inline unsigned int get_ws(u32 inst)
81{
82 return (inst >> 11) & 0x1f;
83}
84
85static inline unsigned int get_d(u32 inst)
86{
87 return inst & 0xffff;
88}
89
90static int tlbe_is_host_safe(const struct kvm_vcpu *vcpu,
91 const struct tlbe *tlbe)
92{
93 gpa_t gpa;
94
95 if (!get_tlb_v(tlbe))
96 return 0;
97
98 /* Does it match current guest AS? */
99 /* XXX what about IS != DS? */
100 if (get_tlb_ts(tlbe) != !!(vcpu->arch.msr & MSR_IS))
101 return 0;
102
103 gpa = get_tlb_raddr(tlbe);
104 if (!gfn_to_memslot(vcpu->kvm, gpa >> PAGE_SHIFT))
105 /* Mapping is not for RAM. */
106 return 0;
107
108 return 1;
109}
110
111static int kvmppc_emul_tlbwe(struct kvm_vcpu *vcpu, u32 inst)
112{
113 u64 eaddr;
114 u64 raddr;
115 u64 asid;
116 u32 flags;
117 struct tlbe *tlbe;
118 unsigned int ra;
119 unsigned int rs;
120 unsigned int ws;
121 unsigned int index;
122
123 ra = get_ra(inst);
124 rs = get_rs(inst);
125 ws = get_ws(inst);
126
127 index = vcpu->arch.gpr[ra];
128 if (index > PPC44x_TLB_SIZE) {
129 printk("%s: index %d\n", __func__, index);
130 kvmppc_dump_vcpu(vcpu);
131 return EMULATE_FAIL;
132 }
133
134 tlbe = &vcpu->arch.guest_tlb[index];
135
136 /* Invalidate shadow mappings for the about-to-be-clobbered TLBE. */
137 if (tlbe->word0 & PPC44x_TLB_VALID) {
138 eaddr = get_tlb_eaddr(tlbe);
139 asid = (tlbe->word0 & PPC44x_TLB_TS) | tlbe->tid;
140 kvmppc_mmu_invalidate(vcpu, eaddr, get_tlb_end(tlbe), asid);
141 }
142
143 switch (ws) {
144 case PPC44x_TLB_PAGEID:
145 tlbe->tid = vcpu->arch.mmucr & 0xff;
146 tlbe->word0 = vcpu->arch.gpr[rs];
147 break;
148
149 case PPC44x_TLB_XLAT:
150 tlbe->word1 = vcpu->arch.gpr[rs];
151 break;
152
153 case PPC44x_TLB_ATTRIB:
154 tlbe->word2 = vcpu->arch.gpr[rs];
155 break;
156
157 default:
158 return EMULATE_FAIL;
159 }
160
161 if (tlbe_is_host_safe(vcpu, tlbe)) {
162 eaddr = get_tlb_eaddr(tlbe);
163 raddr = get_tlb_raddr(tlbe);
164 asid = (tlbe->word0 & PPC44x_TLB_TS) | tlbe->tid;
165 flags = tlbe->word2 & 0xffff;
166
167 /* Create a 4KB mapping on the host. If the guest wanted a
168 * large page, only the first 4KB is mapped here and the rest
169 * are mapped on the fly. */
170 kvmppc_mmu_map(vcpu, eaddr, raddr >> PAGE_SHIFT, asid, flags);
171 }
172
173 KVMTRACE_5D(GTLB_WRITE, vcpu, index,
174 tlbe->tid, tlbe->word0, tlbe->word1, tlbe->word2,
175 handler);
176
177 return EMULATE_DONE;
178}
179
180static void kvmppc_emulate_dec(struct kvm_vcpu *vcpu)
181{ 34{
182 if (vcpu->arch.tcr & TCR_DIE) { 35 if (vcpu->arch.tcr & TCR_DIE) {
183 /* The decrementer ticks at the same rate as the timebase, so 36 /* The decrementer ticks at the same rate as the timebase, so
@@ -193,12 +46,6 @@ static void kvmppc_emulate_dec(struct kvm_vcpu *vcpu)
193 } 46 }
194} 47}
195 48
196static void kvmppc_emul_rfi(struct kvm_vcpu *vcpu)
197{
198 vcpu->arch.pc = vcpu->arch.srr0;
199 kvmppc_set_msr(vcpu, vcpu->arch.srr1);
200}
201
202/* XXX to do: 49/* XXX to do:
203 * lhax 50 * lhax
204 * lhaux 51 * lhaux
@@ -213,40 +60,30 @@ static void kvmppc_emul_rfi(struct kvm_vcpu *vcpu)
213 * 60 *
214 * XXX is_bigendian should depend on MMU mapping or MSR[LE] 61 * XXX is_bigendian should depend on MMU mapping or MSR[LE]
215 */ 62 */
63/* XXX Should probably auto-generate instruction decoding for a particular core
64 * from opcode tables in the future. */
216int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu) 65int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
217{ 66{
218 u32 inst = vcpu->arch.last_inst; 67 u32 inst = vcpu->arch.last_inst;
219 u32 ea; 68 u32 ea;
220 int ra; 69 int ra;
221 int rb; 70 int rb;
222 int rc;
223 int rs; 71 int rs;
224 int rt; 72 int rt;
225 int sprn; 73 int sprn;
226 int dcrn;
227 enum emulation_result emulated = EMULATE_DONE; 74 enum emulation_result emulated = EMULATE_DONE;
228 int advance = 1; 75 int advance = 1;
229 76
77 /* this default type might be overwritten by subcategories */
78 kvmppc_set_exit_type(vcpu, EMULATED_INST_EXITS);
79
230 switch (get_op(inst)) { 80 switch (get_op(inst)) {
231 case 3: /* trap */ 81 case 3: /* trap */
232 printk("trap!\n"); 82 vcpu->arch.esr |= ESR_PTR;
233 kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_PROGRAM); 83 kvmppc_core_queue_program(vcpu);
234 advance = 0; 84 advance = 0;
235 break; 85 break;
236 86
237 case 19:
238 switch (get_xop(inst)) {
239 case 50: /* rfi */
240 kvmppc_emul_rfi(vcpu);
241 advance = 0;
242 break;
243
244 default:
245 emulated = EMULATE_FAIL;
246 break;
247 }
248 break;
249
250 case 31: 87 case 31:
251 switch (get_xop(inst)) { 88 switch (get_xop(inst)) {
252 89
@@ -255,27 +92,11 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
255 emulated = kvmppc_handle_load(run, vcpu, rt, 4, 1); 92 emulated = kvmppc_handle_load(run, vcpu, rt, 4, 1);
256 break; 93 break;
257 94
258 case 83: /* mfmsr */
259 rt = get_rt(inst);
260 vcpu->arch.gpr[rt] = vcpu->arch.msr;
261 break;
262
263 case 87: /* lbzx */ 95 case 87: /* lbzx */
264 rt = get_rt(inst); 96 rt = get_rt(inst);
265 emulated = kvmppc_handle_load(run, vcpu, rt, 1, 1); 97 emulated = kvmppc_handle_load(run, vcpu, rt, 1, 1);
266 break; 98 break;
267 99
268 case 131: /* wrtee */
269 rs = get_rs(inst);
270 vcpu->arch.msr = (vcpu->arch.msr & ~MSR_EE)
271 | (vcpu->arch.gpr[rs] & MSR_EE);
272 break;
273
274 case 146: /* mtmsr */
275 rs = get_rs(inst);
276 kvmppc_set_msr(vcpu, vcpu->arch.gpr[rs]);
277 break;
278
279 case 151: /* stwx */ 100 case 151: /* stwx */
280 rs = get_rs(inst); 101 rs = get_rs(inst);
281 emulated = kvmppc_handle_store(run, vcpu, 102 emulated = kvmppc_handle_store(run, vcpu,
@@ -283,11 +104,6 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
283 4, 1); 104 4, 1);
284 break; 105 break;
285 106
286 case 163: /* wrteei */
287 vcpu->arch.msr = (vcpu->arch.msr & ~MSR_EE)
288 | (inst & MSR_EE);
289 break;
290
291 case 215: /* stbx */ 107 case 215: /* stbx */
292 rs = get_rs(inst); 108 rs = get_rs(inst);
293 emulated = kvmppc_handle_store(run, vcpu, 109 emulated = kvmppc_handle_store(run, vcpu,
@@ -328,42 +144,6 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
328 vcpu->arch.gpr[ra] = ea; 144 vcpu->arch.gpr[ra] = ea;
329 break; 145 break;
330 146
331 case 323: /* mfdcr */
332 dcrn = get_dcrn(inst);
333 rt = get_rt(inst);
334
335 /* The guest may access CPR0 registers to determine the timebase
336 * frequency, and it must know the real host frequency because it
337 * can directly access the timebase registers.
338 *
339 * It would be possible to emulate those accesses in userspace,
340 * but userspace can really only figure out the end frequency.
341 * We could decompose that into the factors that compute it, but
342 * that's tricky math, and it's easier to just report the real
343 * CPR0 values.
344 */
345 switch (dcrn) {
346 case DCRN_CPR0_CONFIG_ADDR:
347 vcpu->arch.gpr[rt] = vcpu->arch.cpr0_cfgaddr;
348 break;
349 case DCRN_CPR0_CONFIG_DATA:
350 local_irq_disable();
351 mtdcr(DCRN_CPR0_CONFIG_ADDR,
352 vcpu->arch.cpr0_cfgaddr);
353 vcpu->arch.gpr[rt] = mfdcr(DCRN_CPR0_CONFIG_DATA);
354 local_irq_enable();
355 break;
356 default:
357 run->dcr.dcrn = dcrn;
358 run->dcr.data = 0;
359 run->dcr.is_write = 0;
360 vcpu->arch.io_gpr = rt;
361 vcpu->arch.dcr_needed = 1;
362 emulated = EMULATE_DO_DCR;
363 }
364
365 break;
366
367 case 339: /* mfspr */ 147 case 339: /* mfspr */
368 sprn = get_sprn(inst); 148 sprn = get_sprn(inst);
369 rt = get_rt(inst); 149 rt = get_rt(inst);
@@ -373,26 +153,8 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
373 vcpu->arch.gpr[rt] = vcpu->arch.srr0; break; 153 vcpu->arch.gpr[rt] = vcpu->arch.srr0; break;
374 case SPRN_SRR1: 154 case SPRN_SRR1:
375 vcpu->arch.gpr[rt] = vcpu->arch.srr1; break; 155 vcpu->arch.gpr[rt] = vcpu->arch.srr1; break;
376 case SPRN_MMUCR:
377 vcpu->arch.gpr[rt] = vcpu->arch.mmucr; break;
378 case SPRN_PID:
379 vcpu->arch.gpr[rt] = vcpu->arch.pid; break;
380 case SPRN_IVPR:
381 vcpu->arch.gpr[rt] = vcpu->arch.ivpr; break;
382 case SPRN_CCR0:
383 vcpu->arch.gpr[rt] = vcpu->arch.ccr0; break;
384 case SPRN_CCR1:
385 vcpu->arch.gpr[rt] = vcpu->arch.ccr1; break;
386 case SPRN_PVR: 156 case SPRN_PVR:
387 vcpu->arch.gpr[rt] = vcpu->arch.pvr; break; 157 vcpu->arch.gpr[rt] = vcpu->arch.pvr; break;
388 case SPRN_DEAR:
389 vcpu->arch.gpr[rt] = vcpu->arch.dear; break;
390 case SPRN_ESR:
391 vcpu->arch.gpr[rt] = vcpu->arch.esr; break;
392 case SPRN_DBCR0:
393 vcpu->arch.gpr[rt] = vcpu->arch.dbcr0; break;
394 case SPRN_DBCR1:
395 vcpu->arch.gpr[rt] = vcpu->arch.dbcr1; break;
396 158
397 /* Note: mftb and TBRL/TBWL are user-accessible, so 159 /* Note: mftb and TBRL/TBWL are user-accessible, so
398 * the guest can always access the real TB anyways. 160 * the guest can always access the real TB anyways.
@@ -413,42 +175,12 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
413 /* Note: SPRG4-7 are user-readable, so we don't get 175 /* Note: SPRG4-7 are user-readable, so we don't get
414 * a trap. */ 176 * a trap. */
415 177
416 case SPRN_IVOR0:
417 vcpu->arch.gpr[rt] = vcpu->arch.ivor[0]; break;
418 case SPRN_IVOR1:
419 vcpu->arch.gpr[rt] = vcpu->arch.ivor[1]; break;
420 case SPRN_IVOR2:
421 vcpu->arch.gpr[rt] = vcpu->arch.ivor[2]; break;
422 case SPRN_IVOR3:
423 vcpu->arch.gpr[rt] = vcpu->arch.ivor[3]; break;
424 case SPRN_IVOR4:
425 vcpu->arch.gpr[rt] = vcpu->arch.ivor[4]; break;
426 case SPRN_IVOR5:
427 vcpu->arch.gpr[rt] = vcpu->arch.ivor[5]; break;
428 case SPRN_IVOR6:
429 vcpu->arch.gpr[rt] = vcpu->arch.ivor[6]; break;
430 case SPRN_IVOR7:
431 vcpu->arch.gpr[rt] = vcpu->arch.ivor[7]; break;
432 case SPRN_IVOR8:
433 vcpu->arch.gpr[rt] = vcpu->arch.ivor[8]; break;
434 case SPRN_IVOR9:
435 vcpu->arch.gpr[rt] = vcpu->arch.ivor[9]; break;
436 case SPRN_IVOR10:
437 vcpu->arch.gpr[rt] = vcpu->arch.ivor[10]; break;
438 case SPRN_IVOR11:
439 vcpu->arch.gpr[rt] = vcpu->arch.ivor[11]; break;
440 case SPRN_IVOR12:
441 vcpu->arch.gpr[rt] = vcpu->arch.ivor[12]; break;
442 case SPRN_IVOR13:
443 vcpu->arch.gpr[rt] = vcpu->arch.ivor[13]; break;
444 case SPRN_IVOR14:
445 vcpu->arch.gpr[rt] = vcpu->arch.ivor[14]; break;
446 case SPRN_IVOR15:
447 vcpu->arch.gpr[rt] = vcpu->arch.ivor[15]; break;
448
449 default: 178 default:
450 printk("mfspr: unknown spr %x\n", sprn); 179 emulated = kvmppc_core_emulate_mfspr(vcpu, sprn, rt);
451 vcpu->arch.gpr[rt] = 0; 180 if (emulated == EMULATE_FAIL) {
181 printk("mfspr: unknown spr %x\n", sprn);
182 vcpu->arch.gpr[rt] = 0;
183 }
452 break; 184 break;
453 } 185 }
454 break; 186 break;
@@ -478,25 +210,6 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
478 vcpu->arch.gpr[ra] = ea; 210 vcpu->arch.gpr[ra] = ea;
479 break; 211 break;
480 212
481 case 451: /* mtdcr */
482 dcrn = get_dcrn(inst);
483 rs = get_rs(inst);
484
485 /* emulate some access in kernel */
486 switch (dcrn) {
487 case DCRN_CPR0_CONFIG_ADDR:
488 vcpu->arch.cpr0_cfgaddr = vcpu->arch.gpr[rs];
489 break;
490 default:
491 run->dcr.dcrn = dcrn;
492 run->dcr.data = vcpu->arch.gpr[rs];
493 run->dcr.is_write = 1;
494 vcpu->arch.dcr_needed = 1;
495 emulated = EMULATE_DO_DCR;
496 }
497
498 break;
499
500 case 467: /* mtspr */ 213 case 467: /* mtspr */
501 sprn = get_sprn(inst); 214 sprn = get_sprn(inst);
502 rs = get_rs(inst); 215 rs = get_rs(inst);
@@ -505,22 +218,6 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
505 vcpu->arch.srr0 = vcpu->arch.gpr[rs]; break; 218 vcpu->arch.srr0 = vcpu->arch.gpr[rs]; break;
506 case SPRN_SRR1: 219 case SPRN_SRR1:
507 vcpu->arch.srr1 = vcpu->arch.gpr[rs]; break; 220 vcpu->arch.srr1 = vcpu->arch.gpr[rs]; break;
508 case SPRN_MMUCR:
509 vcpu->arch.mmucr = vcpu->arch.gpr[rs]; break;
510 case SPRN_PID:
511 kvmppc_set_pid(vcpu, vcpu->arch.gpr[rs]); break;
512 case SPRN_CCR0:
513 vcpu->arch.ccr0 = vcpu->arch.gpr[rs]; break;
514 case SPRN_CCR1:
515 vcpu->arch.ccr1 = vcpu->arch.gpr[rs]; break;
516 case SPRN_DEAR:
517 vcpu->arch.dear = vcpu->arch.gpr[rs]; break;
518 case SPRN_ESR:
519 vcpu->arch.esr = vcpu->arch.gpr[rs]; break;
520 case SPRN_DBCR0:
521 vcpu->arch.dbcr0 = vcpu->arch.gpr[rs]; break;
522 case SPRN_DBCR1:
523 vcpu->arch.dbcr1 = vcpu->arch.gpr[rs]; break;
524 221
525 /* XXX We need to context-switch the timebase for 222 /* XXX We need to context-switch the timebase for
526 * watchdog and FIT. */ 223 * watchdog and FIT. */
@@ -532,14 +229,6 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
532 kvmppc_emulate_dec(vcpu); 229 kvmppc_emulate_dec(vcpu);
533 break; 230 break;
534 231
535 case SPRN_TSR:
536 vcpu->arch.tsr &= ~vcpu->arch.gpr[rs]; break;
537
538 case SPRN_TCR:
539 vcpu->arch.tcr = vcpu->arch.gpr[rs];
540 kvmppc_emulate_dec(vcpu);
541 break;
542
543 case SPRN_SPRG0: 232 case SPRN_SPRG0:
544 vcpu->arch.sprg0 = vcpu->arch.gpr[rs]; break; 233 vcpu->arch.sprg0 = vcpu->arch.gpr[rs]; break;
545 case SPRN_SPRG1: 234 case SPRN_SPRG1:
@@ -549,56 +238,10 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
549 case SPRN_SPRG3: 238 case SPRN_SPRG3:
550 vcpu->arch.sprg3 = vcpu->arch.gpr[rs]; break; 239 vcpu->arch.sprg3 = vcpu->arch.gpr[rs]; break;
551 240
552 /* Note: SPRG4-7 are user-readable. These values are
553 * loaded into the real SPRGs when resuming the
554 * guest. */
555 case SPRN_SPRG4:
556 vcpu->arch.sprg4 = vcpu->arch.gpr[rs]; break;
557 case SPRN_SPRG5:
558 vcpu->arch.sprg5 = vcpu->arch.gpr[rs]; break;
559 case SPRN_SPRG6:
560 vcpu->arch.sprg6 = vcpu->arch.gpr[rs]; break;
561 case SPRN_SPRG7:
562 vcpu->arch.sprg7 = vcpu->arch.gpr[rs]; break;
563
564 case SPRN_IVPR:
565 vcpu->arch.ivpr = vcpu->arch.gpr[rs]; break;
566 case SPRN_IVOR0:
567 vcpu->arch.ivor[0] = vcpu->arch.gpr[rs]; break;
568 case SPRN_IVOR1:
569 vcpu->arch.ivor[1] = vcpu->arch.gpr[rs]; break;
570 case SPRN_IVOR2:
571 vcpu->arch.ivor[2] = vcpu->arch.gpr[rs]; break;
572 case SPRN_IVOR3:
573 vcpu->arch.ivor[3] = vcpu->arch.gpr[rs]; break;
574 case SPRN_IVOR4:
575 vcpu->arch.ivor[4] = vcpu->arch.gpr[rs]; break;
576 case SPRN_IVOR5:
577 vcpu->arch.ivor[5] = vcpu->arch.gpr[rs]; break;
578 case SPRN_IVOR6:
579 vcpu->arch.ivor[6] = vcpu->arch.gpr[rs]; break;
580 case SPRN_IVOR7:
581 vcpu->arch.ivor[7] = vcpu->arch.gpr[rs]; break;
582 case SPRN_IVOR8:
583 vcpu->arch.ivor[8] = vcpu->arch.gpr[rs]; break;
584 case SPRN_IVOR9:
585 vcpu->arch.ivor[9] = vcpu->arch.gpr[rs]; break;
586 case SPRN_IVOR10:
587 vcpu->arch.ivor[10] = vcpu->arch.gpr[rs]; break;
588 case SPRN_IVOR11:
589 vcpu->arch.ivor[11] = vcpu->arch.gpr[rs]; break;
590 case SPRN_IVOR12:
591 vcpu->arch.ivor[12] = vcpu->arch.gpr[rs]; break;
592 case SPRN_IVOR13:
593 vcpu->arch.ivor[13] = vcpu->arch.gpr[rs]; break;
594 case SPRN_IVOR14:
595 vcpu->arch.ivor[14] = vcpu->arch.gpr[rs]; break;
596 case SPRN_IVOR15:
597 vcpu->arch.ivor[15] = vcpu->arch.gpr[rs]; break;
598
599 default: 241 default:
600 printk("mtspr: unknown spr %x\n", sprn); 242 emulated = kvmppc_core_emulate_mtspr(vcpu, sprn, rs);
601 emulated = EMULATE_FAIL; 243 if (emulated == EMULATE_FAIL)
244 printk("mtspr: unknown spr %x\n", sprn);
602 break; 245 break;
603 } 246 }
604 break; 247 break;
@@ -629,36 +272,6 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
629 4, 0); 272 4, 0);
630 break; 273 break;
631 274
632 case 978: /* tlbwe */
633 emulated = kvmppc_emul_tlbwe(vcpu, inst);
634 break;
635
636 case 914: { /* tlbsx */
637 int index;
638 unsigned int as = get_mmucr_sts(vcpu);
639 unsigned int pid = get_mmucr_stid(vcpu);
640
641 rt = get_rt(inst);
642 ra = get_ra(inst);
643 rb = get_rb(inst);
644 rc = get_rc(inst);
645
646 ea = vcpu->arch.gpr[rb];
647 if (ra)
648 ea += vcpu->arch.gpr[ra];
649
650 index = kvmppc_44x_tlb_index(vcpu, ea, pid, as);
651 if (rc) {
652 if (index < 0)
653 vcpu->arch.cr &= ~0x20000000;
654 else
655 vcpu->arch.cr |= 0x20000000;
656 }
657 vcpu->arch.gpr[rt] = index;
658
659 }
660 break;
661
662 case 790: /* lhbrx */ 275 case 790: /* lhbrx */
663 rt = get_rt(inst); 276 rt = get_rt(inst);
664 emulated = kvmppc_handle_load(run, vcpu, rt, 2, 0); 277 emulated = kvmppc_handle_load(run, vcpu, rt, 2, 0);
@@ -674,14 +287,9 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
674 2, 0); 287 2, 0);
675 break; 288 break;
676 289
677 case 966: /* iccci */
678 break;
679
680 default: 290 default:
681 printk("unknown: op %d xop %d\n", get_op(inst), 291 /* Attempt core-specific emulation below. */
682 get_xop(inst));
683 emulated = EMULATE_FAIL; 292 emulated = EMULATE_FAIL;
684 break;
685 } 293 }
686 break; 294 break;
687 295
@@ -764,12 +372,19 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
764 break; 372 break;
765 373
766 default: 374 default:
767 printk("unknown op %d\n", get_op(inst));
768 emulated = EMULATE_FAIL; 375 emulated = EMULATE_FAIL;
769 break;
770 } 376 }
771 377
772 KVMTRACE_3D(PPC_INSTR, vcpu, inst, vcpu->arch.pc, emulated, entryexit); 378 if (emulated == EMULATE_FAIL) {
379 emulated = kvmppc_core_emulate_op(run, vcpu, inst, &advance);
380 if (emulated == EMULATE_FAIL) {
381 advance = 0;
382 printk(KERN_ERR "Couldn't emulate instruction 0x%08x "
383 "(op %d xop %d)\n", inst, get_op(inst), get_xop(inst));
384 }
385 }
386
387 KVMTRACE_3D(PPC_INSTR, vcpu, inst, (int)vcpu->arch.pc, emulated, entryexit);
773 388
774 if (advance) 389 if (advance)
775 vcpu->arch.pc += 4; /* Advance past emulated instruction. */ 390 vcpu->arch.pc += 4; /* Advance past emulated instruction. */
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index fda9baada132..2822c8ccfaaf 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -28,7 +28,8 @@
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <asm/kvm_ppc.h> 29#include <asm/kvm_ppc.h>
30#include <asm/tlbflush.h> 30#include <asm/tlbflush.h>
31 31#include "timing.h"
32#include "../mm/mmu_decl.h"
32 33
33gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn) 34gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn)
34{ 35{
@@ -98,14 +99,7 @@ void kvm_arch_hardware_unsetup(void)
98 99
99void kvm_arch_check_processor_compat(void *rtn) 100void kvm_arch_check_processor_compat(void *rtn)
100{ 101{
101 int r; 102 *(int *)rtn = kvmppc_core_check_processor_compat();
102
103 if (strcmp(cur_cpu_spec->platform, "ppc440") == 0)
104 r = 0;
105 else
106 r = -ENOTSUPP;
107
108 *(int *)rtn = r;
109} 103}
110 104
111struct kvm *kvm_arch_create_vm(void) 105struct kvm *kvm_arch_create_vm(void)
@@ -143,9 +137,6 @@ int kvm_dev_ioctl_check_extension(long ext)
143 int r; 137 int r;
144 138
145 switch (ext) { 139 switch (ext) {
146 case KVM_CAP_USER_MEMORY:
147 r = 1;
148 break;
149 case KVM_CAP_COALESCED_MMIO: 140 case KVM_CAP_COALESCED_MMIO:
150 r = KVM_COALESCED_MMIO_PAGE_OFFSET; 141 r = KVM_COALESCED_MMIO_PAGE_OFFSET;
151 break; 142 break;
@@ -178,30 +169,15 @@ void kvm_arch_flush_shadow(struct kvm *kvm)
178struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) 169struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
179{ 170{
180 struct kvm_vcpu *vcpu; 171 struct kvm_vcpu *vcpu;
181 int err; 172 vcpu = kvmppc_core_vcpu_create(kvm, id);
182 173 kvmppc_create_vcpu_debugfs(vcpu, id);
183 vcpu = kmem_cache_zalloc(kvm_vcpu_cache, GFP_KERNEL);
184 if (!vcpu) {
185 err = -ENOMEM;
186 goto out;
187 }
188
189 err = kvm_vcpu_init(vcpu, kvm, id);
190 if (err)
191 goto free_vcpu;
192
193 return vcpu; 174 return vcpu;
194
195free_vcpu:
196 kmem_cache_free(kvm_vcpu_cache, vcpu);
197out:
198 return ERR_PTR(err);
199} 175}
200 176
201void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu) 177void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
202{ 178{
203 kvm_vcpu_uninit(vcpu); 179 kvmppc_remove_vcpu_debugfs(vcpu);
204 kmem_cache_free(kvm_vcpu_cache, vcpu); 180 kvmppc_core_vcpu_free(vcpu);
205} 181}
206 182
207void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) 183void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
@@ -211,16 +187,14 @@ void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
211 187
212int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu) 188int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
213{ 189{
214 unsigned int priority = exception_priority[BOOKE_INTERRUPT_DECREMENTER]; 190 return kvmppc_core_pending_dec(vcpu);
215
216 return test_bit(priority, &vcpu->arch.pending_exceptions);
217} 191}
218 192
219static void kvmppc_decrementer_func(unsigned long data) 193static void kvmppc_decrementer_func(unsigned long data)
220{ 194{
221 struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data; 195 struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data;
222 196
223 kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_DECREMENTER); 197 kvmppc_core_queue_dec(vcpu);
224 198
225 if (waitqueue_active(&vcpu->wq)) { 199 if (waitqueue_active(&vcpu->wq)) {
226 wake_up_interruptible(&vcpu->wq); 200 wake_up_interruptible(&vcpu->wq);
@@ -241,96 +215,25 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
241 kvmppc_core_destroy_mmu(vcpu); 215 kvmppc_core_destroy_mmu(vcpu);
242} 216}
243 217
244/* Note: clearing MSR[DE] just means that the debug interrupt will not be
245 * delivered *immediately*. Instead, it simply sets the appropriate DBSR bits.
246 * If those DBSR bits are still set when MSR[DE] is re-enabled, the interrupt
247 * will be delivered as an "imprecise debug event" (which is indicated by
248 * DBSR[IDE].
249 */
250static void kvmppc_disable_debug_interrupts(void)
251{
252 mtmsr(mfmsr() & ~MSR_DE);
253}
254
255static void kvmppc_restore_host_debug_state(struct kvm_vcpu *vcpu)
256{
257 kvmppc_disable_debug_interrupts();
258
259 mtspr(SPRN_IAC1, vcpu->arch.host_iac[0]);
260 mtspr(SPRN_IAC2, vcpu->arch.host_iac[1]);
261 mtspr(SPRN_IAC3, vcpu->arch.host_iac[2]);
262 mtspr(SPRN_IAC4, vcpu->arch.host_iac[3]);
263 mtspr(SPRN_DBCR1, vcpu->arch.host_dbcr1);
264 mtspr(SPRN_DBCR2, vcpu->arch.host_dbcr2);
265 mtspr(SPRN_DBCR0, vcpu->arch.host_dbcr0);
266 mtmsr(vcpu->arch.host_msr);
267}
268
269static void kvmppc_load_guest_debug_registers(struct kvm_vcpu *vcpu)
270{
271 struct kvm_guest_debug *dbg = &vcpu->guest_debug;
272 u32 dbcr0 = 0;
273
274 vcpu->arch.host_msr = mfmsr();
275 kvmppc_disable_debug_interrupts();
276
277 /* Save host debug register state. */
278 vcpu->arch.host_iac[0] = mfspr(SPRN_IAC1);
279 vcpu->arch.host_iac[1] = mfspr(SPRN_IAC2);
280 vcpu->arch.host_iac[2] = mfspr(SPRN_IAC3);
281 vcpu->arch.host_iac[3] = mfspr(SPRN_IAC4);
282 vcpu->arch.host_dbcr0 = mfspr(SPRN_DBCR0);
283 vcpu->arch.host_dbcr1 = mfspr(SPRN_DBCR1);
284 vcpu->arch.host_dbcr2 = mfspr(SPRN_DBCR2);
285
286 /* set registers up for guest */
287
288 if (dbg->bp[0]) {
289 mtspr(SPRN_IAC1, dbg->bp[0]);
290 dbcr0 |= DBCR0_IAC1 | DBCR0_IDM;
291 }
292 if (dbg->bp[1]) {
293 mtspr(SPRN_IAC2, dbg->bp[1]);
294 dbcr0 |= DBCR0_IAC2 | DBCR0_IDM;
295 }
296 if (dbg->bp[2]) {
297 mtspr(SPRN_IAC3, dbg->bp[2]);
298 dbcr0 |= DBCR0_IAC3 | DBCR0_IDM;
299 }
300 if (dbg->bp[3]) {
301 mtspr(SPRN_IAC4, dbg->bp[3]);
302 dbcr0 |= DBCR0_IAC4 | DBCR0_IDM;
303 }
304
305 mtspr(SPRN_DBCR0, dbcr0);
306 mtspr(SPRN_DBCR1, 0);
307 mtspr(SPRN_DBCR2, 0);
308}
309
310void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 218void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
311{ 219{
312 int i;
313
314 if (vcpu->guest_debug.enabled) 220 if (vcpu->guest_debug.enabled)
315 kvmppc_load_guest_debug_registers(vcpu); 221 kvmppc_core_load_guest_debugstate(vcpu);
316 222
317 /* Mark every guest entry in the shadow TLB entry modified, so that they 223 kvmppc_core_vcpu_load(vcpu, cpu);
318 * will all be reloaded on the next vcpu run (instead of being
319 * demand-faulted). */
320 for (i = 0; i <= tlb_44x_hwater; i++)
321 kvmppc_tlbe_set_modified(vcpu, i);
322} 224}
323 225
324void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) 226void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
325{ 227{
326 if (vcpu->guest_debug.enabled) 228 if (vcpu->guest_debug.enabled)
327 kvmppc_restore_host_debug_state(vcpu); 229 kvmppc_core_load_host_debugstate(vcpu);
328 230
329 /* Don't leave guest TLB entries resident when being de-scheduled. */ 231 /* Don't leave guest TLB entries resident when being de-scheduled. */
330 /* XXX It would be nice to differentiate between heavyweight exit and 232 /* XXX It would be nice to differentiate between heavyweight exit and
331 * sched_out here, since we could avoid the TLB flush for heavyweight 233 * sched_out here, since we could avoid the TLB flush for heavyweight
332 * exits. */ 234 * exits. */
333 _tlbia(); 235 _tlbil_all();
236 kvmppc_core_vcpu_put(vcpu);
334} 237}
335 238
336int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu, 239int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu,
@@ -354,14 +257,14 @@ int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu,
354static void kvmppc_complete_dcr_load(struct kvm_vcpu *vcpu, 257static void kvmppc_complete_dcr_load(struct kvm_vcpu *vcpu,
355 struct kvm_run *run) 258 struct kvm_run *run)
356{ 259{
357 u32 *gpr = &vcpu->arch.gpr[vcpu->arch.io_gpr]; 260 ulong *gpr = &vcpu->arch.gpr[vcpu->arch.io_gpr];
358 *gpr = run->dcr.data; 261 *gpr = run->dcr.data;
359} 262}
360 263
361static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu, 264static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu,
362 struct kvm_run *run) 265 struct kvm_run *run)
363{ 266{
364 u32 *gpr = &vcpu->arch.gpr[vcpu->arch.io_gpr]; 267 ulong *gpr = &vcpu->arch.gpr[vcpu->arch.io_gpr];
365 268
366 if (run->mmio.len > sizeof(*gpr)) { 269 if (run->mmio.len > sizeof(*gpr)) {
367 printk(KERN_ERR "bad MMIO length: %d\n", run->mmio.len); 270 printk(KERN_ERR "bad MMIO length: %d\n", run->mmio.len);
@@ -459,7 +362,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
459 vcpu->arch.dcr_needed = 0; 362 vcpu->arch.dcr_needed = 0;
460 } 363 }
461 364
462 kvmppc_check_and_deliver_interrupts(vcpu); 365 kvmppc_core_deliver_interrupts(vcpu);
463 366
464 local_irq_disable(); 367 local_irq_disable();
465 kvm_guest_enter(); 368 kvm_guest_enter();
@@ -477,7 +380,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
477 380
478int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq) 381int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq)
479{ 382{
480 kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_EXTERNAL); 383 kvmppc_core_queue_external(vcpu, irq);
481 384
482 if (waitqueue_active(&vcpu->wq)) { 385 if (waitqueue_active(&vcpu->wq)) {
483 wake_up_interruptible(&vcpu->wq); 386 wake_up_interruptible(&vcpu->wq);
diff --git a/arch/powerpc/kvm/timing.c b/arch/powerpc/kvm/timing.c
new file mode 100644
index 000000000000..47ee603f558e
--- /dev/null
+++ b/arch/powerpc/kvm/timing.c
@@ -0,0 +1,239 @@
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, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2008
16 *
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18 * Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
19 */
20
21#include <linux/kvm_host.h>
22#include <linux/fs.h>
23#include <linux/seq_file.h>
24#include <linux/debugfs.h>
25#include <linux/uaccess.h>
26
27#include <asm/time.h>
28#include <asm-generic/div64.h>
29
30#include "timing.h"
31
32void kvmppc_init_timing_stats(struct kvm_vcpu *vcpu)
33{
34 int i;
35
36 /* pause guest execution to avoid concurrent updates */
37 local_irq_disable();
38 mutex_lock(&vcpu->mutex);
39
40 vcpu->arch.last_exit_type = 0xDEAD;
41 for (i = 0; i < __NUMBER_OF_KVM_EXIT_TYPES; i++) {
42 vcpu->arch.timing_count_type[i] = 0;
43 vcpu->arch.timing_max_duration[i] = 0;
44 vcpu->arch.timing_min_duration[i] = 0xFFFFFFFF;
45 vcpu->arch.timing_sum_duration[i] = 0;
46 vcpu->arch.timing_sum_quad_duration[i] = 0;
47 }
48 vcpu->arch.timing_last_exit = 0;
49 vcpu->arch.timing_exit.tv64 = 0;
50 vcpu->arch.timing_last_enter.tv64 = 0;
51
52 mutex_unlock(&vcpu->mutex);
53 local_irq_enable();
54}
55
56static void add_exit_timing(struct kvm_vcpu *vcpu, u64 duration, int type)
57{
58 u64 old;
59
60 do_div(duration, tb_ticks_per_usec);
61 if (unlikely(duration > 0xFFFFFFFF)) {
62 printk(KERN_ERR"%s - duration too big -> overflow"
63 " duration %lld type %d exit #%d\n",
64 __func__, duration, type,
65 vcpu->arch.timing_count_type[type]);
66 return;
67 }
68
69 vcpu->arch.timing_count_type[type]++;
70
71 /* sum */
72 old = vcpu->arch.timing_sum_duration[type];
73 vcpu->arch.timing_sum_duration[type] += duration;
74 if (unlikely(old > vcpu->arch.timing_sum_duration[type])) {
75 printk(KERN_ERR"%s - wrap adding sum of durations"
76 " old %lld new %lld type %d exit # of type %d\n",
77 __func__, old, vcpu->arch.timing_sum_duration[type],
78 type, vcpu->arch.timing_count_type[type]);
79 }
80
81 /* square sum */
82 old = vcpu->arch.timing_sum_quad_duration[type];
83 vcpu->arch.timing_sum_quad_duration[type] += (duration*duration);
84 if (unlikely(old > vcpu->arch.timing_sum_quad_duration[type])) {
85 printk(KERN_ERR"%s - wrap adding sum of squared durations"
86 " old %lld new %lld type %d exit # of type %d\n",
87 __func__, old,
88 vcpu->arch.timing_sum_quad_duration[type],
89 type, vcpu->arch.timing_count_type[type]);
90 }
91
92 /* set min/max */
93 if (unlikely(duration < vcpu->arch.timing_min_duration[type]))
94 vcpu->arch.timing_min_duration[type] = duration;
95 if (unlikely(duration > vcpu->arch.timing_max_duration[type]))
96 vcpu->arch.timing_max_duration[type] = duration;
97}
98
99void kvmppc_update_timing_stats(struct kvm_vcpu *vcpu)
100{
101 u64 exit = vcpu->arch.timing_last_exit;
102 u64 enter = vcpu->arch.timing_last_enter.tv64;
103
104 /* save exit time, used next exit when the reenter time is known */
105 vcpu->arch.timing_last_exit = vcpu->arch.timing_exit.tv64;
106
107 if (unlikely(vcpu->arch.last_exit_type == 0xDEAD || exit == 0))
108 return; /* skip incomplete cycle (e.g. after reset) */
109
110 /* update statistics for average and standard deviation */
111 add_exit_timing(vcpu, (enter - exit), vcpu->arch.last_exit_type);
112 /* enter -> timing_last_exit is time spent in guest - log this too */
113 add_exit_timing(vcpu, (vcpu->arch.timing_last_exit - enter),
114 TIMEINGUEST);
115}
116
117static const char *kvm_exit_names[__NUMBER_OF_KVM_EXIT_TYPES] = {
118 [MMIO_EXITS] = "MMIO",
119 [DCR_EXITS] = "DCR",
120 [SIGNAL_EXITS] = "SIGNAL",
121 [ITLB_REAL_MISS_EXITS] = "ITLBREAL",
122 [ITLB_VIRT_MISS_EXITS] = "ITLBVIRT",
123 [DTLB_REAL_MISS_EXITS] = "DTLBREAL",
124 [DTLB_VIRT_MISS_EXITS] = "DTLBVIRT",
125 [SYSCALL_EXITS] = "SYSCALL",
126 [ISI_EXITS] = "ISI",
127 [DSI_EXITS] = "DSI",
128 [EMULATED_INST_EXITS] = "EMULINST",
129 [EMULATED_MTMSRWE_EXITS] = "EMUL_WAIT",
130 [EMULATED_WRTEE_EXITS] = "EMUL_WRTEE",
131 [EMULATED_MTSPR_EXITS] = "EMUL_MTSPR",
132 [EMULATED_MFSPR_EXITS] = "EMUL_MFSPR",
133 [EMULATED_MTMSR_EXITS] = "EMUL_MTMSR",
134 [EMULATED_MFMSR_EXITS] = "EMUL_MFMSR",
135 [EMULATED_TLBSX_EXITS] = "EMUL_TLBSX",
136 [EMULATED_TLBWE_EXITS] = "EMUL_TLBWE",
137 [EMULATED_RFI_EXITS] = "EMUL_RFI",
138 [DEC_EXITS] = "DEC",
139 [EXT_INTR_EXITS] = "EXTINT",
140 [HALT_WAKEUP] = "HALT",
141 [USR_PR_INST] = "USR_PR_INST",
142 [FP_UNAVAIL] = "FP_UNAVAIL",
143 [DEBUG_EXITS] = "DEBUG",
144 [TIMEINGUEST] = "TIMEINGUEST"
145};
146
147static int kvmppc_exit_timing_show(struct seq_file *m, void *private)
148{
149 struct kvm_vcpu *vcpu = m->private;
150 int i;
151
152 seq_printf(m, "%s", "type count min max sum sum_squared\n");
153
154 for (i = 0; i < __NUMBER_OF_KVM_EXIT_TYPES; i++) {
155 seq_printf(m, "%12s %10d %10lld %10lld %20lld %20lld\n",
156 kvm_exit_names[i],
157 vcpu->arch.timing_count_type[i],
158 vcpu->arch.timing_min_duration[i],
159 vcpu->arch.timing_max_duration[i],
160 vcpu->arch.timing_sum_duration[i],
161 vcpu->arch.timing_sum_quad_duration[i]);
162 }
163 return 0;
164}
165
166/* Write 'c' to clear the timing statistics. */
167static ssize_t kvmppc_exit_timing_write(struct file *file,
168 const char __user *user_buf,
169 size_t count, loff_t *ppos)
170{
171 int err = -EINVAL;
172 char c;
173
174 if (count > 1) {
175 goto done;
176 }
177
178 if (get_user(c, user_buf)) {
179 err = -EFAULT;
180 goto done;
181 }
182
183 if (c == 'c') {
184 struct seq_file *seqf = (struct seq_file *)file->private_data;
185 struct kvm_vcpu *vcpu = seqf->private;
186 /* Write does not affect our buffers previously generated with
187 * show. seq_file is locked here to prevent races of init with
188 * a show call */
189 mutex_lock(&seqf->lock);
190 kvmppc_init_timing_stats(vcpu);
191 mutex_unlock(&seqf->lock);
192 err = count;
193 }
194
195done:
196 return err;
197}
198
199static int kvmppc_exit_timing_open(struct inode *inode, struct file *file)
200{
201 return single_open(file, kvmppc_exit_timing_show, inode->i_private);
202}
203
204static struct file_operations kvmppc_exit_timing_fops = {
205 .owner = THIS_MODULE,
206 .open = kvmppc_exit_timing_open,
207 .read = seq_read,
208 .write = kvmppc_exit_timing_write,
209 .llseek = seq_lseek,
210 .release = single_release,
211};
212
213void kvmppc_create_vcpu_debugfs(struct kvm_vcpu *vcpu, unsigned int id)
214{
215 static char dbg_fname[50];
216 struct dentry *debugfs_file;
217
218 snprintf(dbg_fname, sizeof(dbg_fname), "vm%u_vcpu%u_timing",
219 current->pid, id);
220 debugfs_file = debugfs_create_file(dbg_fname, 0666,
221 kvm_debugfs_dir, vcpu,
222 &kvmppc_exit_timing_fops);
223
224 if (!debugfs_file) {
225 printk(KERN_ERR"%s: error creating debugfs file %s\n",
226 __func__, dbg_fname);
227 return;
228 }
229
230 vcpu->arch.debugfs_exit_timing = debugfs_file;
231}
232
233void kvmppc_remove_vcpu_debugfs(struct kvm_vcpu *vcpu)
234{
235 if (vcpu->arch.debugfs_exit_timing) {
236 debugfs_remove(vcpu->arch.debugfs_exit_timing);
237 vcpu->arch.debugfs_exit_timing = NULL;
238 }
239}
diff --git a/arch/powerpc/kvm/timing.h b/arch/powerpc/kvm/timing.h
new file mode 100644
index 000000000000..bb13b1f3cd5a
--- /dev/null
+++ b/arch/powerpc/kvm/timing.h
@@ -0,0 +1,102 @@
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, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2008
16 *
17 * Authors: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
18 */
19
20#ifndef __POWERPC_KVM_EXITTIMING_H__
21#define __POWERPC_KVM_EXITTIMING_H__
22
23#include <linux/kvm_host.h>
24#include <asm/kvm_host.h>
25
26#ifdef CONFIG_KVM_EXIT_TIMING
27void kvmppc_init_timing_stats(struct kvm_vcpu *vcpu);
28void kvmppc_update_timing_stats(struct kvm_vcpu *vcpu);
29void kvmppc_create_vcpu_debugfs(struct kvm_vcpu *vcpu, unsigned int id);
30void kvmppc_remove_vcpu_debugfs(struct kvm_vcpu *vcpu);
31
32static inline void kvmppc_set_exit_type(struct kvm_vcpu *vcpu, int type)
33{
34 vcpu->arch.last_exit_type = type;
35}
36
37#else
38/* if exit timing is not configured there is no need to build the c file */
39static inline void kvmppc_init_timing_stats(struct kvm_vcpu *vcpu) {}
40static inline void kvmppc_update_timing_stats(struct kvm_vcpu *vcpu) {}
41static inline void kvmppc_create_vcpu_debugfs(struct kvm_vcpu *vcpu,
42 unsigned int id) {}
43static inline void kvmppc_remove_vcpu_debugfs(struct kvm_vcpu *vcpu) {}
44static inline void kvmppc_set_exit_type(struct kvm_vcpu *vcpu, int type) {}
45#endif /* CONFIG_KVM_EXIT_TIMING */
46
47/* account the exit in kvm_stats */
48static inline void kvmppc_account_exit_stat(struct kvm_vcpu *vcpu, int type)
49{
50 /* type has to be known at build time for optimization */
51 BUILD_BUG_ON(__builtin_constant_p(type));
52 switch (type) {
53 case EXT_INTR_EXITS:
54 vcpu->stat.ext_intr_exits++;
55 break;
56 case DEC_EXITS:
57 vcpu->stat.dec_exits++;
58 break;
59 case EMULATED_INST_EXITS:
60 vcpu->stat.emulated_inst_exits++;
61 break;
62 case DCR_EXITS:
63 vcpu->stat.dcr_exits++;
64 break;
65 case DSI_EXITS:
66 vcpu->stat.dsi_exits++;
67 break;
68 case ISI_EXITS:
69 vcpu->stat.isi_exits++;
70 break;
71 case SYSCALL_EXITS:
72 vcpu->stat.syscall_exits++;
73 break;
74 case DTLB_REAL_MISS_EXITS:
75 vcpu->stat.dtlb_real_miss_exits++;
76 break;
77 case DTLB_VIRT_MISS_EXITS:
78 vcpu->stat.dtlb_virt_miss_exits++;
79 break;
80 case MMIO_EXITS:
81 vcpu->stat.mmio_exits++;
82 break;
83 case ITLB_REAL_MISS_EXITS:
84 vcpu->stat.itlb_real_miss_exits++;
85 break;
86 case ITLB_VIRT_MISS_EXITS:
87 vcpu->stat.itlb_virt_miss_exits++;
88 break;
89 case SIGNAL_EXITS:
90 vcpu->stat.signal_exits++;
91 break;
92 }
93}
94
95/* wrapper to set exit time and account for it in kvm_stats */
96static inline void kvmppc_account_exit(struct kvm_vcpu *vcpu, int type)
97{
98 kvmppc_set_exit_type(vcpu, type);
99 kvmppc_account_exit_stat(vcpu, type);
100}
101
102#endif /* __POWERPC_KVM_EXITTIMING_H__ */
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index d69912c07ce7..8db35278a4b4 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -6,6 +6,9 @@ ifeq ($(CONFIG_PPC64),y)
6EXTRA_CFLAGS += -mno-minimal-toc 6EXTRA_CFLAGS += -mno-minimal-toc
7endif 7endif
8 8
9CFLAGS_REMOVE_code-patching.o = -pg
10CFLAGS_REMOVE_feature-fixups.o = -pg
11
9obj-y := string.o alloc.o \ 12obj-y := string.o alloc.o \
10 checksum_$(CONFIG_WORD_SIZE).o 13 checksum_$(CONFIG_WORD_SIZE).o
11obj-$(CONFIG_PPC32) += div64.o copy_32.o crtsavres.o 14obj-$(CONFIG_PPC32) += div64.o copy_32.o crtsavres.o
diff --git a/arch/powerpc/lib/copyuser_64.S b/arch/powerpc/lib/copyuser_64.S
index 25ec5378afa4..70693a5c12a1 100644
--- a/arch/powerpc/lib/copyuser_64.S
+++ b/arch/powerpc/lib/copyuser_64.S
@@ -26,11 +26,24 @@ _GLOBAL(__copy_tofrom_user)
26 andi. r6,r6,7 26 andi. r6,r6,7
27 PPC_MTOCRF 0x01,r5 27 PPC_MTOCRF 0x01,r5
28 blt cr1,.Lshort_copy 28 blt cr1,.Lshort_copy
29/* Below we want to nop out the bne if we're on a CPU that has the
30 * CPU_FTR_UNALIGNED_LD_STD bit set and the CPU_FTR_CP_USE_DCBTZ bit
31 * cleared.
32 * At the time of writing the only CPU that has this combination of bits
33 * set is Power6.
34 */
35BEGIN_FTR_SECTION
36 nop
37FTR_SECTION_ELSE
29 bne .Ldst_unaligned 38 bne .Ldst_unaligned
39ALT_FTR_SECTION_END(CPU_FTR_UNALIGNED_LD_STD | CPU_FTR_CP_USE_DCBTZ, \
40 CPU_FTR_UNALIGNED_LD_STD)
30.Ldst_aligned: 41.Ldst_aligned:
31 andi. r0,r4,7
32 addi r3,r3,-16 42 addi r3,r3,-16
43BEGIN_FTR_SECTION
44 andi. r0,r4,7
33 bne .Lsrc_unaligned 45 bne .Lsrc_unaligned
46END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
34 srdi r7,r5,4 47 srdi r7,r5,4
3520: ld r9,0(r4) 4820: ld r9,0(r4)
36 addi r4,r4,-8 49 addi r4,r4,-8
@@ -138,7 +151,7 @@ _GLOBAL(__copy_tofrom_user)
138 PPC_MTOCRF 0x01,r6 /* put #bytes to 8B bdry into cr7 */ 151 PPC_MTOCRF 0x01,r6 /* put #bytes to 8B bdry into cr7 */
139 subf r5,r6,r5 152 subf r5,r6,r5
140 li r7,0 153 li r7,0
141 cmpldi r1,r5,16 154 cmpldi cr1,r5,16
142 bf cr7*4+3,1f 155 bf cr7*4+3,1f
14335: lbz r0,0(r4) 15635: lbz r0,0(r4)
14481: stb r0,0(r3) 15781: stb r0,0(r3)
diff --git a/arch/powerpc/lib/dma-noncoherent.c b/arch/powerpc/lib/dma-noncoherent.c
index 31734c0969cd..b7dc4c19f582 100644
--- a/arch/powerpc/lib/dma-noncoherent.c
+++ b/arch/powerpc/lib/dma-noncoherent.c
@@ -77,26 +77,26 @@ static DEFINE_SPINLOCK(consistent_lock);
77 * the amount of RAM found at boot time.) I would imagine that get_vm_area() 77 * the amount of RAM found at boot time.) I would imagine that get_vm_area()
78 * would have to initialise this each time prior to calling vm_region_alloc(). 78 * would have to initialise this each time prior to calling vm_region_alloc().
79 */ 79 */
80struct vm_region { 80struct ppc_vm_region {
81 struct list_head vm_list; 81 struct list_head vm_list;
82 unsigned long vm_start; 82 unsigned long vm_start;
83 unsigned long vm_end; 83 unsigned long vm_end;
84}; 84};
85 85
86static struct vm_region consistent_head = { 86static struct ppc_vm_region consistent_head = {
87 .vm_list = LIST_HEAD_INIT(consistent_head.vm_list), 87 .vm_list = LIST_HEAD_INIT(consistent_head.vm_list),
88 .vm_start = CONSISTENT_BASE, 88 .vm_start = CONSISTENT_BASE,
89 .vm_end = CONSISTENT_END, 89 .vm_end = CONSISTENT_END,
90}; 90};
91 91
92static struct vm_region * 92static struct ppc_vm_region *
93vm_region_alloc(struct vm_region *head, size_t size, gfp_t gfp) 93ppc_vm_region_alloc(struct ppc_vm_region *head, size_t size, gfp_t gfp)
94{ 94{
95 unsigned long addr = head->vm_start, end = head->vm_end - size; 95 unsigned long addr = head->vm_start, end = head->vm_end - size;
96 unsigned long flags; 96 unsigned long flags;
97 struct vm_region *c, *new; 97 struct ppc_vm_region *c, *new;
98 98
99 new = kmalloc(sizeof(struct vm_region), gfp); 99 new = kmalloc(sizeof(struct ppc_vm_region), gfp);
100 if (!new) 100 if (!new)
101 goto out; 101 goto out;
102 102
@@ -130,9 +130,9 @@ vm_region_alloc(struct vm_region *head, size_t size, gfp_t gfp)
130 return NULL; 130 return NULL;
131} 131}
132 132
133static struct vm_region *vm_region_find(struct vm_region *head, unsigned long addr) 133static struct ppc_vm_region *ppc_vm_region_find(struct ppc_vm_region *head, unsigned long addr)
134{ 134{
135 struct vm_region *c; 135 struct ppc_vm_region *c;
136 136
137 list_for_each_entry(c, &head->vm_list, vm_list) { 137 list_for_each_entry(c, &head->vm_list, vm_list) {
138 if (c->vm_start == addr) 138 if (c->vm_start == addr)
@@ -151,7 +151,7 @@ void *
151__dma_alloc_coherent(size_t size, dma_addr_t *handle, gfp_t gfp) 151__dma_alloc_coherent(size_t size, dma_addr_t *handle, gfp_t gfp)
152{ 152{
153 struct page *page; 153 struct page *page;
154 struct vm_region *c; 154 struct ppc_vm_region *c;
155 unsigned long order; 155 unsigned long order;
156 u64 mask = 0x00ffffff, limit; /* ISA default */ 156 u64 mask = 0x00ffffff, limit; /* ISA default */
157 157
@@ -191,7 +191,7 @@ __dma_alloc_coherent(size_t size, dma_addr_t *handle, gfp_t gfp)
191 /* 191 /*
192 * Allocate a virtual address in the consistent mapping region. 192 * Allocate a virtual address in the consistent mapping region.
193 */ 193 */
194 c = vm_region_alloc(&consistent_head, size, 194 c = ppc_vm_region_alloc(&consistent_head, size,
195 gfp & ~(__GFP_DMA | __GFP_HIGHMEM)); 195 gfp & ~(__GFP_DMA | __GFP_HIGHMEM));
196 if (c) { 196 if (c) {
197 unsigned long vaddr = c->vm_start; 197 unsigned long vaddr = c->vm_start;
@@ -239,7 +239,7 @@ EXPORT_SYMBOL(__dma_alloc_coherent);
239 */ 239 */
240void __dma_free_coherent(size_t size, void *vaddr) 240void __dma_free_coherent(size_t size, void *vaddr)
241{ 241{
242 struct vm_region *c; 242 struct ppc_vm_region *c;
243 unsigned long flags, addr; 243 unsigned long flags, addr;
244 pte_t *ptep; 244 pte_t *ptep;
245 245
@@ -247,7 +247,7 @@ void __dma_free_coherent(size_t size, void *vaddr)
247 247
248 spin_lock_irqsave(&consistent_lock, flags); 248 spin_lock_irqsave(&consistent_lock, flags);
249 249
250 c = vm_region_find(&consistent_head, (unsigned long)vaddr); 250 c = ppc_vm_region_find(&consistent_head, (unsigned long)vaddr);
251 if (!c) 251 if (!c)
252 goto no_area; 252 goto no_area;
253 253
@@ -320,7 +320,6 @@ static int __init dma_alloc_init(void)
320 ret = -ENOMEM; 320 ret = -ENOMEM;
321 break; 321 break;
322 } 322 }
323 WARN_ON(!pmd_none(*pmd));
324 323
325 pte = pte_alloc_kernel(pmd, CONSISTENT_BASE); 324 pte = pte_alloc_kernel(pmd, CONSISTENT_BASE);
326 if (!pte) { 325 if (!pte) {
diff --git a/arch/powerpc/lib/memcpy_64.S b/arch/powerpc/lib/memcpy_64.S
index 3f131129d1c1..fe2d34e5332d 100644
--- a/arch/powerpc/lib/memcpy_64.S
+++ b/arch/powerpc/lib/memcpy_64.S
@@ -18,11 +18,23 @@ _GLOBAL(memcpy)
18 andi. r6,r6,7 18 andi. r6,r6,7
19 dcbt 0,r4 19 dcbt 0,r4
20 blt cr1,.Lshort_copy 20 blt cr1,.Lshort_copy
21/* Below we want to nop out the bne if we're on a CPU that has the
22 CPU_FTR_UNALIGNED_LD_STD bit set and the CPU_FTR_CP_USE_DCBTZ bit
23 cleared.
24 At the time of writing the only CPU that has this combination of bits
25 set is Power6. */
26BEGIN_FTR_SECTION
27 nop
28FTR_SECTION_ELSE
21 bne .Ldst_unaligned 29 bne .Ldst_unaligned
30ALT_FTR_SECTION_END(CPU_FTR_UNALIGNED_LD_STD | CPU_FTR_CP_USE_DCBTZ, \
31 CPU_FTR_UNALIGNED_LD_STD)
22.Ldst_aligned: 32.Ldst_aligned:
23 andi. r0,r4,7
24 addi r3,r3,-16 33 addi r3,r3,-16
34BEGIN_FTR_SECTION
35 andi. r0,r4,7
25 bne .Lsrc_unaligned 36 bne .Lsrc_unaligned
37END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
26 srdi r7,r5,4 38 srdi r7,r5,4
27 ld r9,0(r4) 39 ld r9,0(r4)
28 addi r4,r4,-8 40 addi r4,r4,-8
@@ -131,7 +143,7 @@ _GLOBAL(memcpy)
131 PPC_MTOCRF 0x01,r6 # put #bytes to 8B bdry into cr7 143 PPC_MTOCRF 0x01,r6 # put #bytes to 8B bdry into cr7
132 subf r5,r6,r5 144 subf r5,r6,r5
133 li r7,0 145 li r7,0
134 cmpldi r1,r5,16 146 cmpldi cr1,r5,16
135 bf cr7*4+3,1f 147 bf cr7*4+3,1f
136 lbz r0,0(r4) 148 lbz r0,0(r4)
137 stb r0,0(r3) 149 stb r0,0(r3)
diff --git a/arch/powerpc/math-emu/Makefile b/arch/powerpc/math-emu/Makefile
index 03aa98dd9f0a..f9e506a735ae 100644
--- a/arch/powerpc/math-emu/Makefile
+++ b/arch/powerpc/math-emu/Makefile
@@ -11,6 +11,8 @@ obj-$(CONFIG_MATH_EMULATION) += fabs.o fadd.o fadds.o fcmpo.o fcmpu.o \
11 mcrfs.o mffs.o mtfsb0.o mtfsb1.o \ 11 mcrfs.o mffs.o mtfsb0.o mtfsb1.o \
12 mtfsf.o mtfsfi.o stfiwx.o stfs.o 12 mtfsf.o mtfsfi.o stfiwx.o stfs.o
13 13
14obj-$(CONFIG_SPE) += math_efp.o
15
14CFLAGS_fabs.o = -fno-builtin-fabs 16CFLAGS_fabs.o = -fno-builtin-fabs
15CFLAGS_math.o = -fno-builtin-fabs 17CFLAGS_math.o = -fno-builtin-fabs
16 18
diff --git a/arch/powerpc/math-emu/fadd.c b/arch/powerpc/math-emu/fadd.c
index 04d3b4aa32ce..0158a16e2b82 100644
--- a/arch/powerpc/math-emu/fadd.c
+++ b/arch/powerpc/math-emu/fadd.c
@@ -13,7 +13,6 @@ fadd(void *frD, void *frA, void *frB)
13 FP_DECL_D(B); 13 FP_DECL_D(B);
14 FP_DECL_D(R); 14 FP_DECL_D(R);
15 FP_DECL_EX; 15 FP_DECL_EX;
16 int ret = 0;
17 16
18#ifdef DEBUG 17#ifdef DEBUG
19 printk("%s: %p %p %p\n", __func__, frD, frA, frB); 18 printk("%s: %p %p %p\n", __func__, frD, frA, frB);
diff --git a/arch/powerpc/math-emu/fcmpo.c b/arch/powerpc/math-emu/fcmpo.c
index b5dc4498cd71..5bce011c2aec 100644
--- a/arch/powerpc/math-emu/fcmpo.c
+++ b/arch/powerpc/math-emu/fcmpo.c
@@ -14,7 +14,6 @@ fcmpo(u32 *ccr, int crfD, void *frA, void *frB)
14 FP_DECL_EX; 14 FP_DECL_EX;
15 int code[4] = { (1 << 3), (1 << 1), (1 << 2), (1 << 0) }; 15 int code[4] = { (1 << 3), (1 << 1), (1 << 2), (1 << 0) };
16 long cmp; 16 long cmp;
17 int ret = 0;
18 17
19#ifdef DEBUG 18#ifdef DEBUG
20 printk("%s: %p (%08x) %d %p %p\n", __func__, ccr, *ccr, crfD, frA, frB); 19 printk("%s: %p (%08x) %d %p %p\n", __func__, ccr, *ccr, crfD, frA, frB);
@@ -29,7 +28,7 @@ fcmpo(u32 *ccr, int crfD, void *frA, void *frB)
29#endif 28#endif
30 29
31 if (A_c == FP_CLS_NAN || B_c == FP_CLS_NAN) 30 if (A_c == FP_CLS_NAN || B_c == FP_CLS_NAN)
32 ret |= EFLAG_VXVC; 31 FP_SET_EXCEPTION(EFLAG_VXVC);
33 32
34 FP_CMP_D(cmp, A, B, 2); 33 FP_CMP_D(cmp, A, B, 2);
35 cmp = code[(cmp + 1) & 3]; 34 cmp = code[(cmp + 1) & 3];
@@ -44,5 +43,5 @@ fcmpo(u32 *ccr, int crfD, void *frA, void *frB)
44 printk("CR: %08x\n", *ccr); 43 printk("CR: %08x\n", *ccr);
45#endif 44#endif
46 45
47 return ret; 46 return FP_CUR_EXCEPTIONS;
48} 47}
diff --git a/arch/powerpc/math-emu/fdiv.c b/arch/powerpc/math-emu/fdiv.c
index 2db15097d98e..a29239c05e3e 100644
--- a/arch/powerpc/math-emu/fdiv.c
+++ b/arch/powerpc/math-emu/fdiv.c
@@ -13,7 +13,6 @@ fdiv(void *frD, void *frA, void *frB)
13 FP_DECL_D(B); 13 FP_DECL_D(B);
14 FP_DECL_D(R); 14 FP_DECL_D(R);
15 FP_DECL_EX; 15 FP_DECL_EX;
16 int ret = 0;
17 16
18#ifdef DEBUG 17#ifdef DEBUG
19 printk("%s: %p %p %p\n", __func__, frD, frA, frB); 18 printk("%s: %p %p %p\n", __func__, frD, frA, frB);
@@ -28,22 +27,22 @@ fdiv(void *frD, void *frA, void *frB)
28#endif 27#endif
29 28
30 if (A_c == FP_CLS_ZERO && B_c == FP_CLS_ZERO) { 29 if (A_c == FP_CLS_ZERO && B_c == FP_CLS_ZERO) {
31 ret |= EFLAG_VXZDZ; 30 FP_SET_EXCEPTION(EFLAG_VXZDZ);
32#ifdef DEBUG 31#ifdef DEBUG
33 printk("%s: FPSCR_VXZDZ raised\n", __func__); 32 printk("%s: FPSCR_VXZDZ raised\n", __func__);
34#endif 33#endif
35 } 34 }
36 if (A_c == FP_CLS_INF && B_c == FP_CLS_INF) { 35 if (A_c == FP_CLS_INF && B_c == FP_CLS_INF) {
37 ret |= EFLAG_VXIDI; 36 FP_SET_EXCEPTION(EFLAG_VXIDI);
38#ifdef DEBUG 37#ifdef DEBUG
39 printk("%s: FPSCR_VXIDI raised\n", __func__); 38 printk("%s: FPSCR_VXIDI raised\n", __func__);
40#endif 39#endif
41 } 40 }
42 41
43 if (B_c == FP_CLS_ZERO && A_c != FP_CLS_ZERO) { 42 if (B_c == FP_CLS_ZERO && A_c != FP_CLS_ZERO) {
44 ret |= EFLAG_DIVZERO; 43 FP_SET_EXCEPTION(EFLAG_DIVZERO);
45 if (__FPU_TRAP_P(EFLAG_DIVZERO)) 44 if (__FPU_TRAP_P(EFLAG_DIVZERO))
46 return ret; 45 return FP_CUR_EXCEPTIONS;
47 } 46 }
48 FP_DIV_D(R, A, B); 47 FP_DIV_D(R, A, B);
49 48
diff --git a/arch/powerpc/math-emu/fdivs.c b/arch/powerpc/math-emu/fdivs.c
index 797f6a9a20b5..526bc261275f 100644
--- a/arch/powerpc/math-emu/fdivs.c
+++ b/arch/powerpc/math-emu/fdivs.c
@@ -14,7 +14,6 @@ fdivs(void *frD, void *frA, void *frB)
14 FP_DECL_D(B); 14 FP_DECL_D(B);
15 FP_DECL_D(R); 15 FP_DECL_D(R);
16 FP_DECL_EX; 16 FP_DECL_EX;
17 int ret = 0;
18 17
19#ifdef DEBUG 18#ifdef DEBUG
20 printk("%s: %p %p %p\n", __func__, frD, frA, frB); 19 printk("%s: %p %p %p\n", __func__, frD, frA, frB);
@@ -29,22 +28,22 @@ fdivs(void *frD, void *frA, void *frB)
29#endif 28#endif
30 29
31 if (A_c == FP_CLS_ZERO && B_c == FP_CLS_ZERO) { 30 if (A_c == FP_CLS_ZERO && B_c == FP_CLS_ZERO) {
32 ret |= EFLAG_VXZDZ; 31 FP_SET_EXCEPTION(EFLAG_VXZDZ);
33#ifdef DEBUG 32#ifdef DEBUG
34 printk("%s: FPSCR_VXZDZ raised\n", __func__); 33 printk("%s: FPSCR_VXZDZ raised\n", __func__);
35#endif 34#endif
36 } 35 }
37 if (A_c == FP_CLS_INF && B_c == FP_CLS_INF) { 36 if (A_c == FP_CLS_INF && B_c == FP_CLS_INF) {
38 ret |= EFLAG_VXIDI; 37 FP_SET_EXCEPTION(EFLAG_VXIDI);
39#ifdef DEBUG 38#ifdef DEBUG
40 printk("%s: FPSCR_VXIDI raised\n", __func__); 39 printk("%s: FPSCR_VXIDI raised\n", __func__);
41#endif 40#endif
42 } 41 }
43 42
44 if (B_c == FP_CLS_ZERO && A_c != FP_CLS_ZERO) { 43 if (B_c == FP_CLS_ZERO && A_c != FP_CLS_ZERO) {
45 ret |= EFLAG_DIVZERO; 44 FP_SET_EXCEPTION(EFLAG_DIVZERO);
46 if (__FPU_TRAP_P(EFLAG_DIVZERO)) 45 if (__FPU_TRAP_P(EFLAG_DIVZERO))
47 return ret; 46 return FP_CUR_EXCEPTIONS;
48 } 47 }
49 48
50 FP_DIV_D(R, A, B); 49 FP_DIV_D(R, A, B);
diff --git a/arch/powerpc/math-emu/fmadd.c b/arch/powerpc/math-emu/fmadd.c
index 925313aa6f82..8c3f20aa5a95 100644
--- a/arch/powerpc/math-emu/fmadd.c
+++ b/arch/powerpc/math-emu/fmadd.c
@@ -15,7 +15,6 @@ fmadd(void *frD, void *frA, void *frB, void *frC)
15 FP_DECL_D(C); 15 FP_DECL_D(C);
16 FP_DECL_D(T); 16 FP_DECL_D(T);
17 FP_DECL_EX; 17 FP_DECL_EX;
18 int ret = 0;
19 18
20#ifdef DEBUG 19#ifdef DEBUG
21 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC); 20 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC);
@@ -33,12 +32,12 @@ fmadd(void *frD, void *frA, void *frB, void *frC)
33 32
34 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) || 33 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) ||
35 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF)) 34 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF))
36 ret |= EFLAG_VXIMZ; 35 FP_SET_EXCEPTION(EFLAG_VXIMZ);
37 36
38 FP_MUL_D(T, A, C); 37 FP_MUL_D(T, A, C);
39 38
40 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF) 39 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF)
41 ret |= EFLAG_VXISI; 40 FP_SET_EXCEPTION(EFLAG_VXISI);
42 41
43 FP_ADD_D(R, T, B); 42 FP_ADD_D(R, T, B);
44 43
diff --git a/arch/powerpc/math-emu/fmadds.c b/arch/powerpc/math-emu/fmadds.c
index aea80ef79399..794fb31e59d1 100644
--- a/arch/powerpc/math-emu/fmadds.c
+++ b/arch/powerpc/math-emu/fmadds.c
@@ -16,7 +16,6 @@ fmadds(void *frD, void *frA, void *frB, void *frC)
16 FP_DECL_D(C); 16 FP_DECL_D(C);
17 FP_DECL_D(T); 17 FP_DECL_D(T);
18 FP_DECL_EX; 18 FP_DECL_EX;
19 int ret = 0;
20 19
21#ifdef DEBUG 20#ifdef DEBUG
22 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC); 21 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC);
@@ -34,12 +33,12 @@ fmadds(void *frD, void *frA, void *frB, void *frC)
34 33
35 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) || 34 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) ||
36 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF)) 35 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF))
37 ret |= EFLAG_VXIMZ; 36 FP_SET_EXCEPTION(EFLAG_VXIMZ);
38 37
39 FP_MUL_D(T, A, C); 38 FP_MUL_D(T, A, C);
40 39
41 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF) 40 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF)
42 ret |= EFLAG_VXISI; 41 FP_SET_EXCEPTION(EFLAG_VXISI);
43 42
44 FP_ADD_D(R, T, B); 43 FP_ADD_D(R, T, B);
45 44
diff --git a/arch/powerpc/math-emu/fmsub.c b/arch/powerpc/math-emu/fmsub.c
index a644d525fca6..626f6fed84ac 100644
--- a/arch/powerpc/math-emu/fmsub.c
+++ b/arch/powerpc/math-emu/fmsub.c
@@ -15,7 +15,6 @@ fmsub(void *frD, void *frA, void *frB, void *frC)
15 FP_DECL_D(C); 15 FP_DECL_D(C);
16 FP_DECL_D(T); 16 FP_DECL_D(T);
17 FP_DECL_EX; 17 FP_DECL_EX;
18 int ret = 0;
19 18
20#ifdef DEBUG 19#ifdef DEBUG
21 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC); 20 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC);
@@ -33,7 +32,7 @@ fmsub(void *frD, void *frA, void *frB, void *frC)
33 32
34 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) || 33 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) ||
35 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF)) 34 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF))
36 ret |= EFLAG_VXIMZ; 35 FP_SET_EXCEPTION(EFLAG_VXIMZ);
37 36
38 FP_MUL_D(T, A, C); 37 FP_MUL_D(T, A, C);
39 38
@@ -41,7 +40,7 @@ fmsub(void *frD, void *frA, void *frB, void *frC)
41 B_s ^= 1; 40 B_s ^= 1;
42 41
43 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF) 42 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF)
44 ret |= EFLAG_VXISI; 43 FP_SET_EXCEPTION(EFLAG_VXISI);
45 44
46 FP_ADD_D(R, T, B); 45 FP_ADD_D(R, T, B);
47 46
diff --git a/arch/powerpc/math-emu/fmsubs.c b/arch/powerpc/math-emu/fmsubs.c
index 2fdeeb9bb569..3425bc899760 100644
--- a/arch/powerpc/math-emu/fmsubs.c
+++ b/arch/powerpc/math-emu/fmsubs.c
@@ -16,7 +16,6 @@ fmsubs(void *frD, void *frA, void *frB, void *frC)
16 FP_DECL_D(C); 16 FP_DECL_D(C);
17 FP_DECL_D(T); 17 FP_DECL_D(T);
18 FP_DECL_EX; 18 FP_DECL_EX;
19 int ret = 0;
20 19
21#ifdef DEBUG 20#ifdef DEBUG
22 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC); 21 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC);
@@ -34,7 +33,7 @@ fmsubs(void *frD, void *frA, void *frB, void *frC)
34 33
35 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) || 34 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) ||
36 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF)) 35 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF))
37 ret |= EFLAG_VXIMZ; 36 FP_SET_EXCEPTION(EFLAG_VXIMZ);
38 37
39 FP_MUL_D(T, A, C); 38 FP_MUL_D(T, A, C);
40 39
@@ -42,7 +41,7 @@ fmsubs(void *frD, void *frA, void *frB, void *frC)
42 B_s ^= 1; 41 B_s ^= 1;
43 42
44 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF) 43 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF)
45 ret |= EFLAG_VXISI; 44 FP_SET_EXCEPTION(EFLAG_VXISI);
46 45
47 FP_ADD_D(R, T, B); 46 FP_ADD_D(R, T, B);
48 47
diff --git a/arch/powerpc/math-emu/fmul.c b/arch/powerpc/math-emu/fmul.c
index 391fd17d3440..2c1929779892 100644
--- a/arch/powerpc/math-emu/fmul.c
+++ b/arch/powerpc/math-emu/fmul.c
@@ -13,7 +13,6 @@ fmul(void *frD, void *frA, void *frB)
13 FP_DECL_D(B); 13 FP_DECL_D(B);
14 FP_DECL_D(R); 14 FP_DECL_D(R);
15 FP_DECL_EX; 15 FP_DECL_EX;
16 int ret = 0;
17 16
18#ifdef DEBUG 17#ifdef DEBUG
19 printk("%s: %p %p %p\n", __func__, frD, frA, frB); 18 printk("%s: %p %p %p\n", __func__, frD, frA, frB);
@@ -31,7 +30,7 @@ fmul(void *frD, void *frA, void *frB)
31 30
32 if ((A_c == FP_CLS_INF && B_c == FP_CLS_ZERO) || 31 if ((A_c == FP_CLS_INF && B_c == FP_CLS_ZERO) ||
33 (A_c == FP_CLS_ZERO && B_c == FP_CLS_INF)) 32 (A_c == FP_CLS_ZERO && B_c == FP_CLS_INF))
34 ret |= EFLAG_VXIMZ; 33 FP_SET_EXCEPTION(EFLAG_VXIMZ);
35 34
36 FP_MUL_D(R, A, B); 35 FP_MUL_D(R, A, B);
37 36
diff --git a/arch/powerpc/math-emu/fmuls.c b/arch/powerpc/math-emu/fmuls.c
index 2d3ec5f7da20..f5ad5c9c77d0 100644
--- a/arch/powerpc/math-emu/fmuls.c
+++ b/arch/powerpc/math-emu/fmuls.c
@@ -14,7 +14,6 @@ fmuls(void *frD, void *frA, void *frB)
14 FP_DECL_D(B); 14 FP_DECL_D(B);
15 FP_DECL_D(R); 15 FP_DECL_D(R);
16 FP_DECL_EX; 16 FP_DECL_EX;
17 int ret = 0;
18 17
19#ifdef DEBUG 18#ifdef DEBUG
20 printk("%s: %p %p %p\n", __func__, frD, frA, frB); 19 printk("%s: %p %p %p\n", __func__, frD, frA, frB);
@@ -32,7 +31,7 @@ fmuls(void *frD, void *frA, void *frB)
32 31
33 if ((A_c == FP_CLS_INF && B_c == FP_CLS_ZERO) || 32 if ((A_c == FP_CLS_INF && B_c == FP_CLS_ZERO) ||
34 (A_c == FP_CLS_ZERO && B_c == FP_CLS_INF)) 33 (A_c == FP_CLS_ZERO && B_c == FP_CLS_INF))
35 ret |= EFLAG_VXIMZ; 34 FP_SET_EXCEPTION(EFLAG_VXIMZ);
36 35
37 FP_MUL_D(R, A, B); 36 FP_MUL_D(R, A, B);
38 37
diff --git a/arch/powerpc/math-emu/fnmadd.c b/arch/powerpc/math-emu/fnmadd.c
index 2497b86494e5..e817bc5453ef 100644
--- a/arch/powerpc/math-emu/fnmadd.c
+++ b/arch/powerpc/math-emu/fnmadd.c
@@ -15,7 +15,6 @@ fnmadd(void *frD, void *frA, void *frB, void *frC)
15 FP_DECL_D(C); 15 FP_DECL_D(C);
16 FP_DECL_D(T); 16 FP_DECL_D(T);
17 FP_DECL_EX; 17 FP_DECL_EX;
18 int ret = 0;
19 18
20#ifdef DEBUG 19#ifdef DEBUG
21 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC); 20 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC);
@@ -33,12 +32,12 @@ fnmadd(void *frD, void *frA, void *frB, void *frC)
33 32
34 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) || 33 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) ||
35 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF)) 34 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF))
36 ret |= EFLAG_VXIMZ; 35 FP_SET_EXCEPTION(EFLAG_VXIMZ);
37 36
38 FP_MUL_D(T, A, C); 37 FP_MUL_D(T, A, C);
39 38
40 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF) 39 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF)
41 ret |= EFLAG_VXISI; 40 FP_SET_EXCEPTION(EFLAG_VXISI);
42 41
43 FP_ADD_D(R, T, B); 42 FP_ADD_D(R, T, B);
44 43
diff --git a/arch/powerpc/math-emu/fnmadds.c b/arch/powerpc/math-emu/fnmadds.c
index ee9d71e0b376..4db4b7d9ba8d 100644
--- a/arch/powerpc/math-emu/fnmadds.c
+++ b/arch/powerpc/math-emu/fnmadds.c
@@ -16,7 +16,6 @@ fnmadds(void *frD, void *frA, void *frB, void *frC)
16 FP_DECL_D(C); 16 FP_DECL_D(C);
17 FP_DECL_D(T); 17 FP_DECL_D(T);
18 FP_DECL_EX; 18 FP_DECL_EX;
19 int ret = 0;
20 19
21#ifdef DEBUG 20#ifdef DEBUG
22 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC); 21 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC);
@@ -34,12 +33,12 @@ fnmadds(void *frD, void *frA, void *frB, void *frC)
34 33
35 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) || 34 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) ||
36 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF)) 35 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF))
37 ret |= EFLAG_VXIMZ; 36 FP_SET_EXCEPTION(EFLAG_VXIMZ);
38 37
39 FP_MUL_D(T, A, C); 38 FP_MUL_D(T, A, C);
40 39
41 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF) 40 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF)
42 ret |= EFLAG_VXISI; 41 FP_SET_EXCEPTION(EFLAG_VXISI);
43 42
44 FP_ADD_D(R, T, B); 43 FP_ADD_D(R, T, B);
45 44
diff --git a/arch/powerpc/math-emu/fnmsub.c b/arch/powerpc/math-emu/fnmsub.c
index 3885a77acc93..f65979fa770e 100644
--- a/arch/powerpc/math-emu/fnmsub.c
+++ b/arch/powerpc/math-emu/fnmsub.c
@@ -15,7 +15,6 @@ fnmsub(void *frD, void *frA, void *frB, void *frC)
15 FP_DECL_D(C); 15 FP_DECL_D(C);
16 FP_DECL_D(T); 16 FP_DECL_D(T);
17 FP_DECL_EX; 17 FP_DECL_EX;
18 int ret = 0;
19 18
20#ifdef DEBUG 19#ifdef DEBUG
21 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC); 20 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC);
@@ -33,7 +32,7 @@ fnmsub(void *frD, void *frA, void *frB, void *frC)
33 32
34 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) || 33 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) ||
35 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF)) 34 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF))
36 ret |= EFLAG_VXIMZ; 35 FP_SET_EXCEPTION(EFLAG_VXIMZ);
37 36
38 FP_MUL_D(T, A, C); 37 FP_MUL_D(T, A, C);
39 38
@@ -41,7 +40,7 @@ fnmsub(void *frD, void *frA, void *frB, void *frC)
41 B_s ^= 1; 40 B_s ^= 1;
42 41
43 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF) 42 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF)
44 ret |= EFLAG_VXISI; 43 FP_SET_EXCEPTION(EFLAG_VXISI);
45 44
46 FP_ADD_D(R, T, B); 45 FP_ADD_D(R, T, B);
47 46
diff --git a/arch/powerpc/math-emu/fnmsubs.c b/arch/powerpc/math-emu/fnmsubs.c
index f835dfeb0fd1..9021dacc03b8 100644
--- a/arch/powerpc/math-emu/fnmsubs.c
+++ b/arch/powerpc/math-emu/fnmsubs.c
@@ -16,7 +16,6 @@ fnmsubs(void *frD, void *frA, void *frB, void *frC)
16 FP_DECL_D(C); 16 FP_DECL_D(C);
17 FP_DECL_D(T); 17 FP_DECL_D(T);
18 FP_DECL_EX; 18 FP_DECL_EX;
19 int ret = 0;
20 19
21#ifdef DEBUG 20#ifdef DEBUG
22 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC); 21 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC);
@@ -34,7 +33,7 @@ fnmsubs(void *frD, void *frA, void *frB, void *frC)
34 33
35 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) || 34 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) ||
36 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF)) 35 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF))
37 ret |= EFLAG_VXIMZ; 36 FP_SET_EXCEPTION(EFLAG_VXIMZ);
38 37
39 FP_MUL_D(T, A, C); 38 FP_MUL_D(T, A, C);
40 39
@@ -42,7 +41,7 @@ fnmsubs(void *frD, void *frA, void *frB, void *frC)
42 B_s ^= 1; 41 B_s ^= 1;
43 42
44 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF) 43 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF)
45 ret |= EFLAG_VXISI; 44 FP_SET_EXCEPTION(EFLAG_VXISI);
46 45
47 FP_ADD_D(R, T, B); 46 FP_ADD_D(R, T, B);
48 47
diff --git a/arch/powerpc/math-emu/fsqrt.c b/arch/powerpc/math-emu/fsqrt.c
index 3e90072693a0..a55fc7d49983 100644
--- a/arch/powerpc/math-emu/fsqrt.c
+++ b/arch/powerpc/math-emu/fsqrt.c
@@ -12,7 +12,6 @@ fsqrt(void *frD, void *frB)
12 FP_DECL_D(B); 12 FP_DECL_D(B);
13 FP_DECL_D(R); 13 FP_DECL_D(R);
14 FP_DECL_EX; 14 FP_DECL_EX;
15 int ret = 0;
16 15
17#ifdef DEBUG 16#ifdef DEBUG
18 printk("%s: %p %p %p %p\n", __func__, frD, frB); 17 printk("%s: %p %p %p %p\n", __func__, frD, frB);
@@ -25,9 +24,9 @@ fsqrt(void *frD, void *frB)
25#endif 24#endif
26 25
27 if (B_s && B_c != FP_CLS_ZERO) 26 if (B_s && B_c != FP_CLS_ZERO)
28 ret |= EFLAG_VXSQRT; 27 FP_SET_EXCEPTION(EFLAG_VXSQRT);
29 if (B_c == FP_CLS_NAN) 28 if (B_c == FP_CLS_NAN)
30 ret |= EFLAG_VXSNAN; 29 FP_SET_EXCEPTION(EFLAG_VXSNAN);
31 30
32 FP_SQRT_D(R, B); 31 FP_SQRT_D(R, B);
33 32
diff --git a/arch/powerpc/math-emu/fsqrts.c b/arch/powerpc/math-emu/fsqrts.c
index 2843be986e2e..31dccbfc39ff 100644
--- a/arch/powerpc/math-emu/fsqrts.c
+++ b/arch/powerpc/math-emu/fsqrts.c
@@ -13,7 +13,6 @@ fsqrts(void *frD, void *frB)
13 FP_DECL_D(B); 13 FP_DECL_D(B);
14 FP_DECL_D(R); 14 FP_DECL_D(R);
15 FP_DECL_EX; 15 FP_DECL_EX;
16 int ret = 0;
17 16
18#ifdef DEBUG 17#ifdef DEBUG
19 printk("%s: %p %p %p %p\n", __func__, frD, frB); 18 printk("%s: %p %p %p %p\n", __func__, frD, frB);
@@ -26,9 +25,9 @@ fsqrts(void *frD, void *frB)
26#endif 25#endif
27 26
28 if (B_s && B_c != FP_CLS_ZERO) 27 if (B_s && B_c != FP_CLS_ZERO)
29 ret |= EFLAG_VXSQRT; 28 FP_SET_EXCEPTION(EFLAG_VXSQRT);
30 if (B_c == FP_CLS_NAN) 29 if (B_c == FP_CLS_NAN)
31 ret |= EFLAG_VXSNAN; 30 FP_SET_EXCEPTION(EFLAG_VXSNAN);
32 31
33 FP_SQRT_D(R, B); 32 FP_SQRT_D(R, B);
34 33
diff --git a/arch/powerpc/math-emu/fsub.c b/arch/powerpc/math-emu/fsub.c
index 78b09446a0e1..02c5dff458ba 100644
--- a/arch/powerpc/math-emu/fsub.c
+++ b/arch/powerpc/math-emu/fsub.c
@@ -13,7 +13,6 @@ fsub(void *frD, void *frA, void *frB)
13 FP_DECL_D(B); 13 FP_DECL_D(B);
14 FP_DECL_D(R); 14 FP_DECL_D(R);
15 FP_DECL_EX; 15 FP_DECL_EX;
16 int ret = 0;
17 16
18#ifdef DEBUG 17#ifdef DEBUG
19 printk("%s: %p %p %p\n", __func__, frD, frA, frB); 18 printk("%s: %p %p %p\n", __func__, frD, frA, frB);
@@ -31,7 +30,7 @@ fsub(void *frD, void *frA, void *frB)
31 B_s ^= 1; 30 B_s ^= 1;
32 31
33 if (A_s != B_s && A_c == FP_CLS_INF && B_c == FP_CLS_INF) 32 if (A_s != B_s && A_c == FP_CLS_INF && B_c == FP_CLS_INF)
34 ret |= EFLAG_VXISI; 33 FP_SET_EXCEPTION(EFLAG_VXISI);
35 34
36 FP_ADD_D(R, A, B); 35 FP_ADD_D(R, A, B);
37 36
diff --git a/arch/powerpc/math-emu/fsubs.c b/arch/powerpc/math-emu/fsubs.c
index d3bf90863cf2..5d9b18c35e07 100644
--- a/arch/powerpc/math-emu/fsubs.c
+++ b/arch/powerpc/math-emu/fsubs.c
@@ -14,7 +14,6 @@ fsubs(void *frD, void *frA, void *frB)
14 FP_DECL_D(B); 14 FP_DECL_D(B);
15 FP_DECL_D(R); 15 FP_DECL_D(R);
16 FP_DECL_EX; 16 FP_DECL_EX;
17 int ret = 0;
18 17
19#ifdef DEBUG 18#ifdef DEBUG
20 printk("%s: %p %p %p\n", __func__, frD, frA, frB); 19 printk("%s: %p %p %p\n", __func__, frD, frA, frB);
@@ -32,7 +31,7 @@ fsubs(void *frD, void *frA, void *frB)
32 B_s ^= 1; 31 B_s ^= 1;
33 32
34 if (A_s != B_s && A_c == FP_CLS_INF && B_c == FP_CLS_INF) 33 if (A_s != B_s && A_c == FP_CLS_INF && B_c == FP_CLS_INF)
35 ret |= EFLAG_VXISI; 34 FP_SET_EXCEPTION(EFLAG_VXISI);
36 35
37 FP_ADD_D(R, A, B); 36 FP_ADD_D(R, A, B);
38 37
diff --git a/arch/powerpc/math-emu/math_efp.c b/arch/powerpc/math-emu/math_efp.c
new file mode 100644
index 000000000000..41f4ef30e480
--- /dev/null
+++ b/arch/powerpc/math-emu/math_efp.c
@@ -0,0 +1,720 @@
1/*
2 * arch/powerpc/math-emu/math_efp.c
3 *
4 * Copyright (C) 2006-2008 Freescale Semiconductor, Inc. All rights reserved.
5 *
6 * Author: Ebony Zhu, <ebony.zhu@freescale.com>
7 * Yu Liu, <yu.liu@freescale.com>
8 *
9 * Derived from arch/alpha/math-emu/math.c
10 * arch/powerpc/math-emu/math.c
11 *
12 * Description:
13 * This file is the exception handler to make E500 SPE instructions
14 * fully comply with IEEE-754 floating point standard.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version
19 * 2 of the License, or (at your option) any later version.
20 */
21
22#include <linux/types.h>
23
24#include <asm/uaccess.h>
25#include <asm/reg.h>
26
27#define FP_EX_BOOKE_E500_SPE
28#include <asm/sfp-machine.h>
29
30#include <math-emu/soft-fp.h>
31#include <math-emu/single.h>
32#include <math-emu/double.h>
33
34#define EFAPU 0x4
35
36#define VCT 0x4
37#define SPFP 0x6
38#define DPFP 0x7
39
40#define EFSADD 0x2c0
41#define EFSSUB 0x2c1
42#define EFSABS 0x2c4
43#define EFSNABS 0x2c5
44#define EFSNEG 0x2c6
45#define EFSMUL 0x2c8
46#define EFSDIV 0x2c9
47#define EFSCMPGT 0x2cc
48#define EFSCMPLT 0x2cd
49#define EFSCMPEQ 0x2ce
50#define EFSCFD 0x2cf
51#define EFSCFSI 0x2d1
52#define EFSCTUI 0x2d4
53#define EFSCTSI 0x2d5
54#define EFSCTUF 0x2d6
55#define EFSCTSF 0x2d7
56#define EFSCTUIZ 0x2d8
57#define EFSCTSIZ 0x2da
58
59#define EVFSADD 0x280
60#define EVFSSUB 0x281
61#define EVFSABS 0x284
62#define EVFSNABS 0x285
63#define EVFSNEG 0x286
64#define EVFSMUL 0x288
65#define EVFSDIV 0x289
66#define EVFSCMPGT 0x28c
67#define EVFSCMPLT 0x28d
68#define EVFSCMPEQ 0x28e
69#define EVFSCTUI 0x294
70#define EVFSCTSI 0x295
71#define EVFSCTUF 0x296
72#define EVFSCTSF 0x297
73#define EVFSCTUIZ 0x298
74#define EVFSCTSIZ 0x29a
75
76#define EFDADD 0x2e0
77#define EFDSUB 0x2e1
78#define EFDABS 0x2e4
79#define EFDNABS 0x2e5
80#define EFDNEG 0x2e6
81#define EFDMUL 0x2e8
82#define EFDDIV 0x2e9
83#define EFDCTUIDZ 0x2ea
84#define EFDCTSIDZ 0x2eb
85#define EFDCMPGT 0x2ec
86#define EFDCMPLT 0x2ed
87#define EFDCMPEQ 0x2ee
88#define EFDCFS 0x2ef
89#define EFDCTUI 0x2f4
90#define EFDCTSI 0x2f5
91#define EFDCTUF 0x2f6
92#define EFDCTSF 0x2f7
93#define EFDCTUIZ 0x2f8
94#define EFDCTSIZ 0x2fa
95
96#define AB 2
97#define XA 3
98#define XB 4
99#define XCR 5
100#define NOTYPE 0
101
102#define SIGN_BIT_S (1UL << 31)
103#define SIGN_BIT_D (1ULL << 63)
104#define FP_EX_MASK (FP_EX_INEXACT | FP_EX_INVALID | FP_EX_DIVZERO | \
105 FP_EX_UNDERFLOW | FP_EX_OVERFLOW)
106
107union dw_union {
108 u64 dp[1];
109 u32 wp[2];
110};
111
112static unsigned long insn_type(unsigned long speinsn)
113{
114 unsigned long ret = NOTYPE;
115
116 switch (speinsn & 0x7ff) {
117 case EFSABS: ret = XA; break;
118 case EFSADD: ret = AB; break;
119 case EFSCFD: ret = XB; break;
120 case EFSCMPEQ: ret = XCR; break;
121 case EFSCMPGT: ret = XCR; break;
122 case EFSCMPLT: ret = XCR; break;
123 case EFSCTSF: ret = XB; break;
124 case EFSCTSI: ret = XB; break;
125 case EFSCTSIZ: ret = XB; break;
126 case EFSCTUF: ret = XB; break;
127 case EFSCTUI: ret = XB; break;
128 case EFSCTUIZ: ret = XB; break;
129 case EFSDIV: ret = AB; break;
130 case EFSMUL: ret = AB; break;
131 case EFSNABS: ret = XA; break;
132 case EFSNEG: ret = XA; break;
133 case EFSSUB: ret = AB; break;
134 case EFSCFSI: ret = XB; break;
135
136 case EVFSABS: ret = XA; break;
137 case EVFSADD: ret = AB; break;
138 case EVFSCMPEQ: ret = XCR; break;
139 case EVFSCMPGT: ret = XCR; break;
140 case EVFSCMPLT: ret = XCR; break;
141 case EVFSCTSF: ret = XB; break;
142 case EVFSCTSI: ret = XB; break;
143 case EVFSCTSIZ: ret = XB; break;
144 case EVFSCTUF: ret = XB; break;
145 case EVFSCTUI: ret = XB; break;
146 case EVFSCTUIZ: ret = XB; break;
147 case EVFSDIV: ret = AB; break;
148 case EVFSMUL: ret = AB; break;
149 case EVFSNABS: ret = XA; break;
150 case EVFSNEG: ret = XA; break;
151 case EVFSSUB: ret = AB; break;
152
153 case EFDABS: ret = XA; break;
154 case EFDADD: ret = AB; break;
155 case EFDCFS: ret = XB; break;
156 case EFDCMPEQ: ret = XCR; break;
157 case EFDCMPGT: ret = XCR; break;
158 case EFDCMPLT: ret = XCR; break;
159 case EFDCTSF: ret = XB; break;
160 case EFDCTSI: ret = XB; break;
161 case EFDCTSIDZ: ret = XB; break;
162 case EFDCTSIZ: ret = XB; break;
163 case EFDCTUF: ret = XB; break;
164 case EFDCTUI: ret = XB; break;
165 case EFDCTUIDZ: ret = XB; break;
166 case EFDCTUIZ: ret = XB; break;
167 case EFDDIV: ret = AB; break;
168 case EFDMUL: ret = AB; break;
169 case EFDNABS: ret = XA; break;
170 case EFDNEG: ret = XA; break;
171 case EFDSUB: ret = AB; break;
172
173 default:
174 printk(KERN_ERR "\nOoops! SPE instruction no type found.");
175 printk(KERN_ERR "\ninst code: %08lx\n", speinsn);
176 }
177
178 return ret;
179}
180
181int do_spe_mathemu(struct pt_regs *regs)
182{
183 FP_DECL_EX;
184 int IR, cmp;
185
186 unsigned long type, func, fc, fa, fb, src, speinsn;
187 union dw_union vc, va, vb;
188
189 if (get_user(speinsn, (unsigned int __user *) regs->nip))
190 return -EFAULT;
191 if ((speinsn >> 26) != EFAPU)
192 return -EINVAL; /* not an spe instruction */
193
194 type = insn_type(speinsn);
195 if (type == NOTYPE)
196 return -ENOSYS;
197
198 func = speinsn & 0x7ff;
199 fc = (speinsn >> 21) & 0x1f;
200 fa = (speinsn >> 16) & 0x1f;
201 fb = (speinsn >> 11) & 0x1f;
202 src = (speinsn >> 5) & 0x7;
203
204 vc.wp[0] = current->thread.evr[fc];
205 vc.wp[1] = regs->gpr[fc];
206 va.wp[0] = current->thread.evr[fa];
207 va.wp[1] = regs->gpr[fa];
208 vb.wp[0] = current->thread.evr[fb];
209 vb.wp[1] = regs->gpr[fb];
210
211 __FPU_FPSCR = mfspr(SPRN_SPEFSCR);
212
213#ifdef DEBUG
214 printk("speinsn:%08lx spefscr:%08lx\n", speinsn, __FPU_FPSCR);
215 printk("vc: %08x %08x\n", vc.wp[0], vc.wp[1]);
216 printk("va: %08x %08x\n", va.wp[0], va.wp[1]);
217 printk("vb: %08x %08x\n", vb.wp[0], vb.wp[1]);
218#endif
219
220 switch (src) {
221 case SPFP: {
222 FP_DECL_S(SA); FP_DECL_S(SB); FP_DECL_S(SR);
223
224 switch (type) {
225 case AB:
226 case XCR:
227 FP_UNPACK_SP(SA, va.wp + 1);
228 case XB:
229 FP_UNPACK_SP(SB, vb.wp + 1);
230 break;
231 case XA:
232 FP_UNPACK_SP(SA, va.wp + 1);
233 break;
234 }
235
236#ifdef DEBUG
237 printk("SA: %ld %08lx %ld (%ld)\n", SA_s, SA_f, SA_e, SA_c);
238 printk("SB: %ld %08lx %ld (%ld)\n", SB_s, SB_f, SB_e, SB_c);
239#endif
240
241 switch (func) {
242 case EFSABS:
243 vc.wp[1] = va.wp[1] & ~SIGN_BIT_S;
244 goto update_regs;
245
246 case EFSNABS:
247 vc.wp[1] = va.wp[1] | SIGN_BIT_S;
248 goto update_regs;
249
250 case EFSNEG:
251 vc.wp[1] = va.wp[1] ^ SIGN_BIT_S;
252 goto update_regs;
253
254 case EFSADD:
255 FP_ADD_S(SR, SA, SB);
256 goto pack_s;
257
258 case EFSSUB:
259 FP_SUB_S(SR, SA, SB);
260 goto pack_s;
261
262 case EFSMUL:
263 FP_MUL_S(SR, SA, SB);
264 goto pack_s;
265
266 case EFSDIV:
267 FP_DIV_S(SR, SA, SB);
268 goto pack_s;
269
270 case EFSCMPEQ:
271 cmp = 0;
272 goto cmp_s;
273
274 case EFSCMPGT:
275 cmp = 1;
276 goto cmp_s;
277
278 case EFSCMPLT:
279 cmp = -1;
280 goto cmp_s;
281
282 case EFSCTSF:
283 case EFSCTUF:
284 if (!((vb.wp[1] >> 23) == 0xff && ((vb.wp[1] & 0x7fffff) > 0))) {
285 /* NaN */
286 if (((vb.wp[1] >> 23) & 0xff) == 0) {
287 /* denorm */
288 vc.wp[1] = 0x0;
289 } else if ((vb.wp[1] >> 31) == 0) {
290 /* positive normal */
291 vc.wp[1] = (func == EFSCTSF) ?
292 0x7fffffff : 0xffffffff;
293 } else { /* negative normal */
294 vc.wp[1] = (func == EFSCTSF) ?
295 0x80000000 : 0x0;
296 }
297 } else { /* rB is NaN */
298 vc.wp[1] = 0x0;
299 }
300 goto update_regs;
301
302 case EFSCFD: {
303 FP_DECL_D(DB);
304 FP_CLEAR_EXCEPTIONS;
305 FP_UNPACK_DP(DB, vb.dp);
306#ifdef DEBUG
307 printk("DB: %ld %08lx %08lx %ld (%ld)\n",
308 DB_s, DB_f1, DB_f0, DB_e, DB_c);
309#endif
310 FP_CONV(S, D, 1, 2, SR, DB);
311 goto pack_s;
312 }
313
314 case EFSCTSI:
315 case EFSCTSIZ:
316 case EFSCTUI:
317 case EFSCTUIZ:
318 if (func & 0x4) {
319 _FP_ROUND(1, SB);
320 } else {
321 _FP_ROUND_ZERO(1, SB);
322 }
323 FP_TO_INT_S(vc.wp[1], SB, 32, ((func & 0x3) != 0));
324 goto update_regs;
325
326 default:
327 goto illegal;
328 }
329 break;
330
331pack_s:
332#ifdef DEBUG
333 printk("SR: %ld %08lx %ld (%ld)\n", SR_s, SR_f, SR_e, SR_c);
334#endif
335 FP_PACK_SP(vc.wp + 1, SR);
336 goto update_regs;
337
338cmp_s:
339 FP_CMP_S(IR, SA, SB, 3);
340 if (IR == 3 && (FP_ISSIGNAN_S(SA) || FP_ISSIGNAN_S(SB)))
341 FP_SET_EXCEPTION(FP_EX_INVALID);
342 if (IR == cmp) {
343 IR = 0x4;
344 } else {
345 IR = 0;
346 }
347 goto update_ccr;
348 }
349
350 case DPFP: {
351 FP_DECL_D(DA); FP_DECL_D(DB); FP_DECL_D(DR);
352
353 switch (type) {
354 case AB:
355 case XCR:
356 FP_UNPACK_DP(DA, va.dp);
357 case XB:
358 FP_UNPACK_DP(DB, vb.dp);
359 break;
360 case XA:
361 FP_UNPACK_DP(DA, va.dp);
362 break;
363 }
364
365#ifdef DEBUG
366 printk("DA: %ld %08lx %08lx %ld (%ld)\n",
367 DA_s, DA_f1, DA_f0, DA_e, DA_c);
368 printk("DB: %ld %08lx %08lx %ld (%ld)\n",
369 DB_s, DB_f1, DB_f0, DB_e, DB_c);
370#endif
371
372 switch (func) {
373 case EFDABS:
374 vc.dp[0] = va.dp[0] & ~SIGN_BIT_D;
375 goto update_regs;
376
377 case EFDNABS:
378 vc.dp[0] = va.dp[0] | SIGN_BIT_D;
379 goto update_regs;
380
381 case EFDNEG:
382 vc.dp[0] = va.dp[0] ^ SIGN_BIT_D;
383 goto update_regs;
384
385 case EFDADD:
386 FP_ADD_D(DR, DA, DB);
387 goto pack_d;
388
389 case EFDSUB:
390 FP_SUB_D(DR, DA, DB);
391 goto pack_d;
392
393 case EFDMUL:
394 FP_MUL_D(DR, DA, DB);
395 goto pack_d;
396
397 case EFDDIV:
398 FP_DIV_D(DR, DA, DB);
399 goto pack_d;
400
401 case EFDCMPEQ:
402 cmp = 0;
403 goto cmp_d;
404
405 case EFDCMPGT:
406 cmp = 1;
407 goto cmp_d;
408
409 case EFDCMPLT:
410 cmp = -1;
411 goto cmp_d;
412
413 case EFDCTSF:
414 case EFDCTUF:
415 if (!((vb.wp[0] >> 20) == 0x7ff &&
416 ((vb.wp[0] & 0xfffff) > 0 || (vb.wp[1] > 0)))) {
417 /* not a NaN */
418 if (((vb.wp[0] >> 20) & 0x7ff) == 0) {
419 /* denorm */
420 vc.wp[1] = 0x0;
421 } else if ((vb.wp[0] >> 31) == 0) {
422 /* positive normal */
423 vc.wp[1] = (func == EFDCTSF) ?
424 0x7fffffff : 0xffffffff;
425 } else { /* negative normal */
426 vc.wp[1] = (func == EFDCTSF) ?
427 0x80000000 : 0x0;
428 }
429 } else { /* NaN */
430 vc.wp[1] = 0x0;
431 }
432 goto update_regs;
433
434 case EFDCFS: {
435 FP_DECL_S(SB);
436 FP_CLEAR_EXCEPTIONS;
437 FP_UNPACK_SP(SB, vb.wp + 1);
438#ifdef DEBUG
439 printk("SB: %ld %08lx %ld (%ld)\n",
440 SB_s, SB_f, SB_e, SB_c);
441#endif
442 FP_CONV(D, S, 2, 1, DR, SB);
443 goto pack_d;
444 }
445
446 case EFDCTUIDZ:
447 case EFDCTSIDZ:
448 _FP_ROUND_ZERO(2, DB);
449 FP_TO_INT_D(vc.dp[0], DB, 64, ((func & 0x1) == 0));
450 goto update_regs;
451
452 case EFDCTUI:
453 case EFDCTSI:
454 case EFDCTUIZ:
455 case EFDCTSIZ:
456 if (func & 0x4) {
457 _FP_ROUND(2, DB);
458 } else {
459 _FP_ROUND_ZERO(2, DB);
460 }
461 FP_TO_INT_D(vc.wp[1], DB, 32, ((func & 0x3) != 0));
462 goto update_regs;
463
464 default:
465 goto illegal;
466 }
467 break;
468
469pack_d:
470#ifdef DEBUG
471 printk("DR: %ld %08lx %08lx %ld (%ld)\n",
472 DR_s, DR_f1, DR_f0, DR_e, DR_c);
473#endif
474 FP_PACK_DP(vc.dp, DR);
475 goto update_regs;
476
477cmp_d:
478 FP_CMP_D(IR, DA, DB, 3);
479 if (IR == 3 && (FP_ISSIGNAN_D(DA) || FP_ISSIGNAN_D(DB)))
480 FP_SET_EXCEPTION(FP_EX_INVALID);
481 if (IR == cmp) {
482 IR = 0x4;
483 } else {
484 IR = 0;
485 }
486 goto update_ccr;
487
488 }
489
490 case VCT: {
491 FP_DECL_S(SA0); FP_DECL_S(SB0); FP_DECL_S(SR0);
492 FP_DECL_S(SA1); FP_DECL_S(SB1); FP_DECL_S(SR1);
493 int IR0, IR1;
494
495 switch (type) {
496 case AB:
497 case XCR:
498 FP_UNPACK_SP(SA0, va.wp);
499 FP_UNPACK_SP(SA1, va.wp + 1);
500 case XB:
501 FP_UNPACK_SP(SB0, vb.wp);
502 FP_UNPACK_SP(SB1, vb.wp + 1);
503 break;
504 case XA:
505 FP_UNPACK_SP(SA0, va.wp);
506 FP_UNPACK_SP(SA1, va.wp + 1);
507 break;
508 }
509
510#ifdef DEBUG
511 printk("SA0: %ld %08lx %ld (%ld)\n", SA0_s, SA0_f, SA0_e, SA0_c);
512 printk("SA1: %ld %08lx %ld (%ld)\n", SA1_s, SA1_f, SA1_e, SA1_c);
513 printk("SB0: %ld %08lx %ld (%ld)\n", SB0_s, SB0_f, SB0_e, SB0_c);
514 printk("SB1: %ld %08lx %ld (%ld)\n", SB1_s, SB1_f, SB1_e, SB1_c);
515#endif
516
517 switch (func) {
518 case EVFSABS:
519 vc.wp[0] = va.wp[0] & ~SIGN_BIT_S;
520 vc.wp[1] = va.wp[1] & ~SIGN_BIT_S;
521 goto update_regs;
522
523 case EVFSNABS:
524 vc.wp[0] = va.wp[0] | SIGN_BIT_S;
525 vc.wp[1] = va.wp[1] | SIGN_BIT_S;
526 goto update_regs;
527
528 case EVFSNEG:
529 vc.wp[0] = va.wp[0] ^ SIGN_BIT_S;
530 vc.wp[1] = va.wp[1] ^ SIGN_BIT_S;
531 goto update_regs;
532
533 case EVFSADD:
534 FP_ADD_S(SR0, SA0, SB0);
535 FP_ADD_S(SR1, SA1, SB1);
536 goto pack_vs;
537
538 case EVFSSUB:
539 FP_SUB_S(SR0, SA0, SB0);
540 FP_SUB_S(SR1, SA1, SB1);
541 goto pack_vs;
542
543 case EVFSMUL:
544 FP_MUL_S(SR0, SA0, SB0);
545 FP_MUL_S(SR1, SA1, SB1);
546 goto pack_vs;
547
548 case EVFSDIV:
549 FP_DIV_S(SR0, SA0, SB0);
550 FP_DIV_S(SR1, SA1, SB1);
551 goto pack_vs;
552
553 case EVFSCMPEQ:
554 cmp = 0;
555 goto cmp_vs;
556
557 case EVFSCMPGT:
558 cmp = 1;
559 goto cmp_vs;
560
561 case EVFSCMPLT:
562 cmp = -1;
563 goto cmp_vs;
564
565 case EVFSCTSF:
566 __asm__ __volatile__ ("mtspr 512, %4\n"
567 "efsctsf %0, %2\n"
568 "efsctsf %1, %3\n"
569 : "=r" (vc.wp[0]), "=r" (vc.wp[1])
570 : "r" (vb.wp[0]), "r" (vb.wp[1]), "r" (0));
571 goto update_regs;
572
573 case EVFSCTUF:
574 __asm__ __volatile__ ("mtspr 512, %4\n"
575 "efsctuf %0, %2\n"
576 "efsctuf %1, %3\n"
577 : "=r" (vc.wp[0]), "=r" (vc.wp[1])
578 : "r" (vb.wp[0]), "r" (vb.wp[1]), "r" (0));
579 goto update_regs;
580
581 case EVFSCTUI:
582 case EVFSCTSI:
583 case EVFSCTUIZ:
584 case EVFSCTSIZ:
585 if (func & 0x4) {
586 _FP_ROUND(1, SB0);
587 _FP_ROUND(1, SB1);
588 } else {
589 _FP_ROUND_ZERO(1, SB0);
590 _FP_ROUND_ZERO(1, SB1);
591 }
592 FP_TO_INT_S(vc.wp[0], SB0, 32, ((func & 0x3) != 0));
593 FP_TO_INT_S(vc.wp[1], SB1, 32, ((func & 0x3) != 0));
594 goto update_regs;
595
596 default:
597 goto illegal;
598 }
599 break;
600
601pack_vs:
602#ifdef DEBUG
603 printk("SR0: %ld %08lx %ld (%ld)\n", SR0_s, SR0_f, SR0_e, SR0_c);
604 printk("SR1: %ld %08lx %ld (%ld)\n", SR1_s, SR1_f, SR1_e, SR1_c);
605#endif
606 FP_PACK_SP(vc.wp, SR0);
607 FP_PACK_SP(vc.wp + 1, SR1);
608 goto update_regs;
609
610cmp_vs:
611 {
612 int ch, cl;
613
614 FP_CMP_S(IR0, SA0, SB0, 3);
615 FP_CMP_S(IR1, SA1, SB1, 3);
616 if (IR0 == 3 && (FP_ISSIGNAN_S(SA0) || FP_ISSIGNAN_S(SB0)))
617 FP_SET_EXCEPTION(FP_EX_INVALID);
618 if (IR1 == 3 && (FP_ISSIGNAN_S(SA1) || FP_ISSIGNAN_S(SB1)))
619 FP_SET_EXCEPTION(FP_EX_INVALID);
620 ch = (IR0 == cmp) ? 1 : 0;
621 cl = (IR1 == cmp) ? 1 : 0;
622 IR = (ch << 3) | (cl << 2) | ((ch | cl) << 1) |
623 ((ch & cl) << 0);
624 goto update_ccr;
625 }
626 }
627 default:
628 return -EINVAL;
629 }
630
631update_ccr:
632 regs->ccr &= ~(15 << ((7 - ((speinsn >> 23) & 0x7)) << 2));
633 regs->ccr |= (IR << ((7 - ((speinsn >> 23) & 0x7)) << 2));
634
635update_regs:
636 __FPU_FPSCR &= ~FP_EX_MASK;
637 __FPU_FPSCR |= (FP_CUR_EXCEPTIONS & FP_EX_MASK);
638 mtspr(SPRN_SPEFSCR, __FPU_FPSCR);
639
640 current->thread.evr[fc] = vc.wp[0];
641 regs->gpr[fc] = vc.wp[1];
642
643#ifdef DEBUG
644 printk("ccr = %08lx\n", regs->ccr);
645 printk("cur exceptions = %08x spefscr = %08lx\n",
646 FP_CUR_EXCEPTIONS, __FPU_FPSCR);
647 printk("vc: %08x %08x\n", vc.wp[0], vc.wp[1]);
648 printk("va: %08x %08x\n", va.wp[0], va.wp[1]);
649 printk("vb: %08x %08x\n", vb.wp[0], vb.wp[1]);
650#endif
651
652 return 0;
653
654illegal:
655 printk(KERN_ERR "\nOoops! IEEE-754 compliance handler encountered un-supported instruction.\ninst code: %08lx\n", speinsn);
656 return -ENOSYS;
657}
658
659int speround_handler(struct pt_regs *regs)
660{
661 union dw_union fgpr;
662 int s_lo, s_hi;
663 unsigned long speinsn, type, fc;
664
665 if (get_user(speinsn, (unsigned int __user *) regs->nip))
666 return -EFAULT;
667 if ((speinsn >> 26) != 4)
668 return -EINVAL; /* not an spe instruction */
669
670 type = insn_type(speinsn & 0x7ff);
671 if (type == XCR) return -ENOSYS;
672
673 fc = (speinsn >> 21) & 0x1f;
674 s_lo = regs->gpr[fc] & SIGN_BIT_S;
675 s_hi = current->thread.evr[fc] & SIGN_BIT_S;
676 fgpr.wp[0] = current->thread.evr[fc];
677 fgpr.wp[1] = regs->gpr[fc];
678
679 __FPU_FPSCR = mfspr(SPRN_SPEFSCR);
680
681 switch ((speinsn >> 5) & 0x7) {
682 /* Since SPE instructions on E500 core can handle round to nearest
683 * and round toward zero with IEEE-754 complied, we just need
684 * to handle round toward +Inf and round toward -Inf by software.
685 */
686 case SPFP:
687 if ((FP_ROUNDMODE) == FP_RND_PINF) {
688 if (!s_lo) fgpr.wp[1]++; /* Z > 0, choose Z1 */
689 } else { /* round to -Inf */
690 if (s_lo) fgpr.wp[1]++; /* Z < 0, choose Z2 */
691 }
692 break;
693
694 case DPFP:
695 if (FP_ROUNDMODE == FP_RND_PINF) {
696 if (!s_hi) fgpr.dp[0]++; /* Z > 0, choose Z1 */
697 } else { /* round to -Inf */
698 if (s_hi) fgpr.dp[0]++; /* Z < 0, choose Z2 */
699 }
700 break;
701
702 case VCT:
703 if (FP_ROUNDMODE == FP_RND_PINF) {
704 if (!s_lo) fgpr.wp[1]++; /* Z_low > 0, choose Z1 */
705 if (!s_hi) fgpr.wp[0]++; /* Z_high word > 0, choose Z1 */
706 } else { /* round to -Inf */
707 if (s_lo) fgpr.wp[1]++; /* Z_low < 0, choose Z2 */
708 if (s_hi) fgpr.wp[0]++; /* Z_high < 0, choose Z2 */
709 }
710 break;
711
712 default:
713 return -EINVAL;
714 }
715
716 current->thread.evr[fc] = fgpr.wp[0];
717 regs->gpr[fc] = fgpr.wp[1];
718
719 return 0;
720}
diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile
index e7392b45a5ef..953cc4a1cde5 100644
--- a/arch/powerpc/mm/Makefile
+++ b/arch/powerpc/mm/Makefile
@@ -6,17 +6,19 @@ ifeq ($(CONFIG_PPC64),y)
6EXTRA_CFLAGS += -mno-minimal-toc 6EXTRA_CFLAGS += -mno-minimal-toc
7endif 7endif
8 8
9obj-y := fault.o mem.o \ 9obj-y := fault.o mem.o pgtable.o \
10 init_$(CONFIG_WORD_SIZE).o \ 10 init_$(CONFIG_WORD_SIZE).o \
11 pgtable_$(CONFIG_WORD_SIZE).o \ 11 pgtable_$(CONFIG_WORD_SIZE).o
12 mmu_context_$(CONFIG_WORD_SIZE).o 12obj-$(CONFIG_PPC_MMU_NOHASH) += mmu_context_nohash.o tlb_nohash.o \
13 tlb_nohash_low.o
13hash-$(CONFIG_PPC_NATIVE) := hash_native_64.o 14hash-$(CONFIG_PPC_NATIVE) := hash_native_64.o
14obj-$(CONFIG_PPC64) += hash_utils_64.o \ 15obj-$(CONFIG_PPC64) += hash_utils_64.o \
15 slb_low.o slb.o stab.o \ 16 slb_low.o slb.o stab.o \
16 gup.o mmap.o $(hash-y) 17 gup.o mmap.o $(hash-y)
17obj-$(CONFIG_PPC_STD_MMU_32) += ppc_mmu_32.o 18obj-$(CONFIG_PPC_STD_MMU_32) += ppc_mmu_32.o
18obj-$(CONFIG_PPC_STD_MMU) += hash_low_$(CONFIG_WORD_SIZE).o \ 19obj-$(CONFIG_PPC_STD_MMU) += hash_low_$(CONFIG_WORD_SIZE).o \
19 tlb_$(CONFIG_WORD_SIZE).o 20 tlb_hash$(CONFIG_WORD_SIZE).o \
21 mmu_context_hash$(CONFIG_WORD_SIZE).o
20obj-$(CONFIG_40x) += 40x_mmu.o 22obj-$(CONFIG_40x) += 40x_mmu.o
21obj-$(CONFIG_44x) += 44x_mmu.o 23obj-$(CONFIG_44x) += 44x_mmu.o
22obj-$(CONFIG_FSL_BOOKE) += fsl_booke_mmu.o 24obj-$(CONFIG_FSL_BOOKE) += fsl_booke_mmu.o
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 565b7a237c84..91c7b8636b8a 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -30,6 +30,7 @@
30#include <linux/kprobes.h> 30#include <linux/kprobes.h>
31#include <linux/kdebug.h> 31#include <linux/kdebug.h>
32 32
33#include <asm/firmware.h>
33#include <asm/page.h> 34#include <asm/page.h>
34#include <asm/pgtable.h> 35#include <asm/pgtable.h>
35#include <asm/mmu.h> 36#include <asm/mmu.h>
@@ -283,7 +284,7 @@ good_area:
283 } 284 }
284 pte_update(ptep, 0, _PAGE_HWEXEC | 285 pte_update(ptep, 0, _PAGE_HWEXEC |
285 _PAGE_ACCESSED); 286 _PAGE_ACCESSED);
286 _tlbie(address, mm->context.id); 287 local_flush_tlb_page(vma, address);
287 pte_unmap_unlock(ptep, ptl); 288 pte_unmap_unlock(ptep, ptl);
288 up_read(&mm->mmap_sem); 289 up_read(&mm->mmap_sem);
289 return 0; 290 return 0;
@@ -318,9 +319,16 @@ good_area:
318 goto do_sigbus; 319 goto do_sigbus;
319 BUG(); 320 BUG();
320 } 321 }
321 if (ret & VM_FAULT_MAJOR) 322 if (ret & VM_FAULT_MAJOR) {
322 current->maj_flt++; 323 current->maj_flt++;
323 else 324#ifdef CONFIG_PPC_SMLPAR
325 if (firmware_has_feature(FW_FEATURE_CMO)) {
326 preempt_disable();
327 get_lppaca()->page_ins += (1 << PAGE_FACTOR);
328 preempt_enable();
329 }
330#endif
331 } else
324 current->min_flt++; 332 current->min_flt++;
325 up_read(&mm->mmap_sem); 333 up_read(&mm->mmap_sem);
326 return 0; 334 return 0;
@@ -339,7 +347,7 @@ bad_area_nosemaphore:
339 && printk_ratelimit()) 347 && printk_ratelimit())
340 printk(KERN_CRIT "kernel tried to execute NX-protected" 348 printk(KERN_CRIT "kernel tried to execute NX-protected"
341 " page (%lx) - exploit attempt? (uid: %d)\n", 349 " page (%lx) - exploit attempt? (uid: %d)\n",
342 address, current->uid); 350 address, current_uid());
343 351
344 return SIGSEGV; 352 return SIGSEGV;
345 353
diff --git a/arch/powerpc/mm/hash_low_32.S b/arch/powerpc/mm/hash_low_32.S
index 7bffb70b9fe2..67850ec9feb3 100644
--- a/arch/powerpc/mm/hash_low_32.S
+++ b/arch/powerpc/mm/hash_low_32.S
@@ -36,36 +36,6 @@ mmu_hash_lock:
36#endif /* CONFIG_SMP */ 36#endif /* CONFIG_SMP */
37 37
38/* 38/*
39 * Sync CPUs with hash_page taking & releasing the hash
40 * table lock
41 */
42#ifdef CONFIG_SMP
43 .text
44_GLOBAL(hash_page_sync)
45 mfmsr r10
46 rlwinm r0,r10,0,17,15 /* clear bit 16 (MSR_EE) */
47 mtmsr r0
48 lis r8,mmu_hash_lock@h
49 ori r8,r8,mmu_hash_lock@l
50 lis r0,0x0fff
51 b 10f
5211: lwz r6,0(r8)
53 cmpwi 0,r6,0
54 bne 11b
5510: lwarx r6,0,r8
56 cmpwi 0,r6,0
57 bne- 11b
58 stwcx. r0,0,r8
59 bne- 10b
60 isync
61 eieio
62 li r0,0
63 stw r0,0(r8)
64 mtmsr r10
65 blr
66#endif /* CONFIG_SMP */
67
68/*
69 * Load a PTE into the hash table, if possible. 39 * Load a PTE into the hash table, if possible.
70 * The address is in r4, and r3 contains an access flag: 40 * The address is in r4, and r3 contains an access flag:
71 * _PAGE_RW (0x400) if a write. 41 * _PAGE_RW (0x400) if a write.
@@ -353,8 +323,8 @@ _GLOBAL(create_hpte)
353 ori r8,r8,0xe14 /* clear out reserved bits and M */ 323 ori r8,r8,0xe14 /* clear out reserved bits and M */
354 andc r8,r5,r8 /* PP = user? (rw&dirty? 2: 3): 0 */ 324 andc r8,r5,r8 /* PP = user? (rw&dirty? 2: 3): 0 */
355BEGIN_FTR_SECTION 325BEGIN_FTR_SECTION
356 ori r8,r8,_PAGE_COHERENT /* set M (coherence required) */ 326 rlwinm r8,r8,0,~_PAGE_COHERENT /* clear M (coherence not required) */
357END_FTR_SECTION_IFSET(CPU_FTR_NEED_COHERENT) 327END_FTR_SECTION_IFCLR(CPU_FTR_NEED_COHERENT)
358#ifdef CONFIG_PTE_64BIT 328#ifdef CONFIG_PTE_64BIT
359 /* Put the XPN bits into the PTE */ 329 /* Put the XPN bits into the PTE */
360 rlwimi r8,r10,8,20,22 330 rlwimi r8,r10,8,20,22
@@ -663,3 +633,80 @@ _GLOBAL(flush_hash_patch_B)
663 SYNC_601 633 SYNC_601
664 isync 634 isync
665 blr 635 blr
636
637/*
638 * Flush an entry from the TLB
639 */
640_GLOBAL(_tlbie)
641#ifdef CONFIG_SMP
642 rlwinm r8,r1,0,0,(31-THREAD_SHIFT)
643 lwz r8,TI_CPU(r8)
644 oris r8,r8,11
645 mfmsr r10
646 SYNC
647 rlwinm r0,r10,0,17,15 /* clear bit 16 (MSR_EE) */
648 rlwinm r0,r0,0,28,26 /* clear DR */
649 mtmsr r0
650 SYNC_601
651 isync
652 lis r9,mmu_hash_lock@h
653 ori r9,r9,mmu_hash_lock@l
654 tophys(r9,r9)
65510: lwarx r7,0,r9
656 cmpwi 0,r7,0
657 bne- 10b
658 stwcx. r8,0,r9
659 bne- 10b
660 eieio
661 tlbie r3
662 sync
663 TLBSYNC
664 li r0,0
665 stw r0,0(r9) /* clear mmu_hash_lock */
666 mtmsr r10
667 SYNC_601
668 isync
669#else /* CONFIG_SMP */
670 tlbie r3
671 sync
672#endif /* CONFIG_SMP */
673 blr
674
675/*
676 * Flush the entire TLB. 603/603e only
677 */
678_GLOBAL(_tlbia)
679#if defined(CONFIG_SMP)
680 rlwinm r8,r1,0,0,(31-THREAD_SHIFT)
681 lwz r8,TI_CPU(r8)
682 oris r8,r8,10
683 mfmsr r10
684 SYNC
685 rlwinm r0,r10,0,17,15 /* clear bit 16 (MSR_EE) */
686 rlwinm r0,r0,0,28,26 /* clear DR */
687 mtmsr r0
688 SYNC_601
689 isync
690 lis r9,mmu_hash_lock@h
691 ori r9,r9,mmu_hash_lock@l
692 tophys(r9,r9)
69310: lwarx r7,0,r9
694 cmpwi 0,r7,0
695 bne- 10b
696 stwcx. r8,0,r9
697 bne- 10b
698 sync
699 tlbia
700 sync
701 TLBSYNC
702 li r0,0
703 stw r0,0(r9) /* clear mmu_hash_lock */
704 mtmsr r10
705 SYNC_601
706 isync
707#else /* CONFIG_SMP */
708 sync
709 tlbia
710 sync
711#endif /* CONFIG_SMP */
712 blr
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index f0c3b88d50fa..9920d6a7cf29 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -53,8 +53,7 @@ unsigned int mmu_huge_psizes[MMU_PAGE_COUNT] = { }; /* initialize all to 0 */
53 53
54/* Subtract one from array size because we don't need a cache for 4K since 54/* Subtract one from array size because we don't need a cache for 4K since
55 * is not a huge page size */ 55 * is not a huge page size */
56#define huge_pgtable_cache(psize) (pgtable_cache[HUGEPTE_CACHE_NUM \ 56#define HUGE_PGTABLE_INDEX(psize) (HUGEPTE_CACHE_NUM + psize - 1)
57 + psize-1])
58#define HUGEPTE_CACHE_NAME(psize) (huge_pgtable_cache_name[psize]) 57#define HUGEPTE_CACHE_NAME(psize) (huge_pgtable_cache_name[psize])
59 58
60static const char *huge_pgtable_cache_name[MMU_PAGE_COUNT] = { 59static const char *huge_pgtable_cache_name[MMU_PAGE_COUNT] = {
@@ -113,7 +112,7 @@ static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr,
113static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp, 112static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
114 unsigned long address, unsigned int psize) 113 unsigned long address, unsigned int psize)
115{ 114{
116 pte_t *new = kmem_cache_zalloc(huge_pgtable_cache(psize), 115 pte_t *new = kmem_cache_zalloc(pgtable_cache[HUGE_PGTABLE_INDEX(psize)],
117 GFP_KERNEL|__GFP_REPEAT); 116 GFP_KERNEL|__GFP_REPEAT);
118 117
119 if (! new) 118 if (! new)
@@ -121,7 +120,7 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
121 120
122 spin_lock(&mm->page_table_lock); 121 spin_lock(&mm->page_table_lock);
123 if (!hugepd_none(*hpdp)) 122 if (!hugepd_none(*hpdp))
124 kmem_cache_free(huge_pgtable_cache(psize), new); 123 kmem_cache_free(pgtable_cache[HUGE_PGTABLE_INDEX(psize)], new);
125 else 124 else
126 hpdp->pd = (unsigned long)new | HUGEPD_OK; 125 hpdp->pd = (unsigned long)new | HUGEPD_OK;
127 spin_unlock(&mm->page_table_lock); 126 spin_unlock(&mm->page_table_lock);
@@ -513,6 +512,13 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
513 return slice_get_unmapped_area(addr, len, flags, mmu_psize, 1, 0); 512 return slice_get_unmapped_area(addr, len, flags, mmu_psize, 1, 0);
514} 513}
515 514
515unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
516{
517 unsigned int psize = get_slice_psize(vma->vm_mm, vma->vm_start);
518
519 return 1UL << mmu_psize_to_shift(psize);
520}
521
516/* 522/*
517 * Called by asm hashtable.S for doing lazy icache flush 523 * Called by asm hashtable.S for doing lazy icache flush
518 */ 524 */
@@ -763,13 +769,14 @@ static int __init hugetlbpage_init(void)
763 769
764 for (psize = 0; psize < MMU_PAGE_COUNT; ++psize) { 770 for (psize = 0; psize < MMU_PAGE_COUNT; ++psize) {
765 if (mmu_huge_psizes[psize]) { 771 if (mmu_huge_psizes[psize]) {
766 huge_pgtable_cache(psize) = kmem_cache_create( 772 pgtable_cache[HUGE_PGTABLE_INDEX(psize)] =
767 HUGEPTE_CACHE_NAME(psize), 773 kmem_cache_create(
768 HUGEPTE_TABLE_SIZE(psize), 774 HUGEPTE_CACHE_NAME(psize),
769 HUGEPTE_TABLE_SIZE(psize), 775 HUGEPTE_TABLE_SIZE(psize),
770 0, 776 HUGEPTE_TABLE_SIZE(psize),
771 NULL); 777 0,
772 if (!huge_pgtable_cache(psize)) 778 NULL);
779 if (!pgtable_cache[HUGE_PGTABLE_INDEX(psize)])
773 panic("hugetlbpage_init(): could not create %s"\ 780 panic("hugetlbpage_init(): could not create %s"\
774 "\n", HUGEPTE_CACHE_NAME(psize)); 781 "\n", HUGEPTE_CACHE_NAME(psize));
775 } 782 }
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index 388ceda632f3..666a5e8a5be1 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -35,7 +35,6 @@
35#include <asm/pgalloc.h> 35#include <asm/pgalloc.h>
36#include <asm/prom.h> 36#include <asm/prom.h>
37#include <asm/io.h> 37#include <asm/io.h>
38#include <asm/mmu_context.h>
39#include <asm/pgtable.h> 38#include <asm/pgtable.h>
40#include <asm/mmu.h> 39#include <asm/mmu.h>
41#include <asm/smp.h> 40#include <asm/smp.h>
@@ -49,7 +48,7 @@
49 48
50#if defined(CONFIG_KERNEL_START_BOOL) || defined(CONFIG_LOWMEM_SIZE_BOOL) 49#if defined(CONFIG_KERNEL_START_BOOL) || defined(CONFIG_LOWMEM_SIZE_BOOL)
51/* The ammount of lowmem must be within 0xF0000000 - KERNELBASE. */ 50/* The ammount of lowmem must be within 0xF0000000 - KERNELBASE. */
52#if (CONFIG_LOWMEM_SIZE > (0xF0000000 - KERNELBASE)) 51#if (CONFIG_LOWMEM_SIZE > (0xF0000000 - PAGE_OFFSET))
53#error "You must adjust CONFIG_LOWMEM_SIZE or CONFIG_START_KERNEL" 52#error "You must adjust CONFIG_LOWMEM_SIZE or CONFIG_START_KERNEL"
54#endif 53#endif
55#endif 54#endif
@@ -180,9 +179,6 @@ void __init MMU_init(void)
180 if (ppc_md.progress) 179 if (ppc_md.progress)
181 ppc_md.progress("MMU:setio", 0x302); 180 ppc_md.progress("MMU:setio", 0x302);
182 181
183 /* Initialize the context management stuff */
184 mmu_context_init();
185
186 if (ppc_md.progress) 182 if (ppc_md.progress)
187 ppc_md.progress("MMU:exit", 0x211); 183 ppc_md.progress("MMU:exit", 0x211);
188 184
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index b9e1a1da6e52..f00f09a77f12 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -102,8 +102,8 @@ pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
102 return ppc_md.phys_mem_access_prot(file, pfn, size, vma_prot); 102 return ppc_md.phys_mem_access_prot(file, pfn, size, vma_prot);
103 103
104 if (!page_is_ram(pfn)) 104 if (!page_is_ram(pfn))
105 vma_prot = __pgprot(pgprot_val(vma_prot) 105 vma_prot = pgprot_noncached(vma_prot);
106 | _PAGE_GUARDED | _PAGE_NO_CACHE); 106
107 return vma_prot; 107 return vma_prot;
108} 108}
109EXPORT_SYMBOL(phys_mem_access_prot); 109EXPORT_SYMBOL(phys_mem_access_prot);
@@ -132,7 +132,7 @@ int arch_add_memory(int nid, u64 start, u64 size)
132 /* this should work for most non-highmem platforms */ 132 /* this should work for most non-highmem platforms */
133 zone = pgdata->node_zones; 133 zone = pgdata->node_zones;
134 134
135 return __add_pages(zone, start_pfn, nr_pages); 135 return __add_pages(nid, zone, start_pfn, nr_pages);
136} 136}
137#endif /* CONFIG_MEMORY_HOTPLUG */ 137#endif /* CONFIG_MEMORY_HOTPLUG */
138 138
@@ -488,7 +488,7 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
488 * we invalidate the TLB here, thus avoiding dcbst 488 * we invalidate the TLB here, thus avoiding dcbst
489 * misbehaviour. 489 * misbehaviour.
490 */ 490 */
491 _tlbie(address, 0 /* 8xx doesn't care about PID */); 491 _tlbil_va(address, 0 /* 8xx doesn't care about PID */);
492#endif 492#endif
493 /* The _PAGE_USER test should really be _PAGE_EXEC, but 493 /* The _PAGE_USER test should really be _PAGE_EXEC, but
494 * older glibc versions execute some code from no-exec 494 * older glibc versions execute some code from no-exec
diff --git a/arch/powerpc/mm/mmu_context_32.c b/arch/powerpc/mm/mmu_context_32.c
deleted file mode 100644
index cc32ba41d900..000000000000
--- a/arch/powerpc/mm/mmu_context_32.c
+++ /dev/null
@@ -1,84 +0,0 @@
1/*
2 * This file contains the routines for handling the MMU on those
3 * PowerPC implementations where the MMU substantially follows the
4 * architecture specification. This includes the 6xx, 7xx, 7xxx,
5 * 8260, and POWER3 implementations but excludes the 8xx and 4xx.
6 * -- paulus
7 *
8 * Derived from arch/ppc/mm/init.c:
9 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
10 *
11 * Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au)
12 * and Cort Dougan (PReP) (cort@cs.nmt.edu)
13 * Copyright (C) 1996 Paul Mackerras
14 *
15 * Derived from "arch/i386/mm/init.c"
16 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version
21 * 2 of the License, or (at your option) any later version.
22 *
23 */
24
25#include <linux/mm.h>
26#include <linux/init.h>
27
28#include <asm/mmu_context.h>
29#include <asm/tlbflush.h>
30
31unsigned long next_mmu_context;
32unsigned long context_map[LAST_CONTEXT / BITS_PER_LONG + 1];
33#ifdef FEW_CONTEXTS
34atomic_t nr_free_contexts;
35struct mm_struct *context_mm[LAST_CONTEXT+1];
36void steal_context(void);
37#endif /* FEW_CONTEXTS */
38
39/*
40 * Initialize the context management stuff.
41 */
42void __init
43mmu_context_init(void)
44{
45 /*
46 * Some processors have too few contexts to reserve one for
47 * init_mm, and require using context 0 for a normal task.
48 * Other processors reserve the use of context zero for the kernel.
49 * This code assumes FIRST_CONTEXT < 32.
50 */
51 context_map[0] = (1 << FIRST_CONTEXT) - 1;
52 next_mmu_context = FIRST_CONTEXT;
53#ifdef FEW_CONTEXTS
54 atomic_set(&nr_free_contexts, LAST_CONTEXT - FIRST_CONTEXT + 1);
55#endif /* FEW_CONTEXTS */
56}
57
58#ifdef FEW_CONTEXTS
59/*
60 * Steal a context from a task that has one at the moment.
61 * This is only used on 8xx and 4xx and we presently assume that
62 * they don't do SMP. If they do then this will have to check
63 * whether the MM we steal is in use.
64 * We also assume that this is only used on systems that don't
65 * use an MMU hash table - this is true for 8xx and 4xx.
66 * This isn't an LRU system, it just frees up each context in
67 * turn (sort-of pseudo-random replacement :). This would be the
68 * place to implement an LRU scheme if anyone was motivated to do it.
69 * -- paulus
70 */
71void
72steal_context(void)
73{
74 struct mm_struct *mm;
75
76 /* free up context `next_mmu_context' */
77 /* if we shouldn't free context 0, don't... */
78 if (next_mmu_context < FIRST_CONTEXT)
79 next_mmu_context = FIRST_CONTEXT;
80 mm = context_mm[next_mmu_context];
81 flush_tlb_mm(mm);
82 destroy_context(mm);
83}
84#endif /* FEW_CONTEXTS */
diff --git a/arch/powerpc/mm/mmu_context_hash32.c b/arch/powerpc/mm/mmu_context_hash32.c
new file mode 100644
index 000000000000..0dfba2bf7f31
--- /dev/null
+++ b/arch/powerpc/mm/mmu_context_hash32.c
@@ -0,0 +1,103 @@
1/*
2 * This file contains the routines for handling the MMU on those
3 * PowerPC implementations where the MMU substantially follows the
4 * architecture specification. This includes the 6xx, 7xx, 7xxx,
5 * 8260, and POWER3 implementations but excludes the 8xx and 4xx.
6 * -- paulus
7 *
8 * Derived from arch/ppc/mm/init.c:
9 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
10 *
11 * Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au)
12 * and Cort Dougan (PReP) (cort@cs.nmt.edu)
13 * Copyright (C) 1996 Paul Mackerras
14 *
15 * Derived from "arch/i386/mm/init.c"
16 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version
21 * 2 of the License, or (at your option) any later version.
22 *
23 */
24
25#include <linux/mm.h>
26#include <linux/init.h>
27
28#include <asm/mmu_context.h>
29#include <asm/tlbflush.h>
30
31/*
32 * On 32-bit PowerPC 6xx/7xx/7xxx CPUs, we use a set of 16 VSIDs
33 * (virtual segment identifiers) for each context. Although the
34 * hardware supports 24-bit VSIDs, and thus >1 million contexts,
35 * we only use 32,768 of them. That is ample, since there can be
36 * at most around 30,000 tasks in the system anyway, and it means
37 * that we can use a bitmap to indicate which contexts are in use.
38 * Using a bitmap means that we entirely avoid all of the problems
39 * that we used to have when the context number overflowed,
40 * particularly on SMP systems.
41 * -- paulus.
42 */
43#define NO_CONTEXT ((unsigned long) -1)
44#define LAST_CONTEXT 32767
45#define FIRST_CONTEXT 1
46
47/*
48 * This function defines the mapping from contexts to VSIDs (virtual
49 * segment IDs). We use a skew on both the context and the high 4 bits
50 * of the 32-bit virtual address (the "effective segment ID") in order
51 * to spread out the entries in the MMU hash table. Note, if this
52 * function is changed then arch/ppc/mm/hashtable.S will have to be
53 * changed to correspond.
54 *
55 *
56 * CTX_TO_VSID(ctx, va) (((ctx) * (897 * 16) + ((va) >> 28) * 0x111) \
57 * & 0xffffff)
58 */
59
60static unsigned long next_mmu_context;
61static unsigned long context_map[LAST_CONTEXT / BITS_PER_LONG + 1];
62
63
64/*
65 * Set up the context for a new address space.
66 */
67int init_new_context(struct task_struct *t, struct mm_struct *mm)
68{
69 unsigned long ctx = next_mmu_context;
70
71 while (test_and_set_bit(ctx, context_map)) {
72 ctx = find_next_zero_bit(context_map, LAST_CONTEXT+1, ctx);
73 if (ctx > LAST_CONTEXT)
74 ctx = 0;
75 }
76 next_mmu_context = (ctx + 1) & LAST_CONTEXT;
77 mm->context.id = ctx;
78
79 return 0;
80}
81
82/*
83 * We're finished using the context for an address space.
84 */
85void destroy_context(struct mm_struct *mm)
86{
87 preempt_disable();
88 if (mm->context.id != NO_CONTEXT) {
89 clear_bit(mm->context.id, context_map);
90 mm->context.id = NO_CONTEXT;
91 }
92 preempt_enable();
93}
94
95/*
96 * Initialize the context management stuff.
97 */
98void __init mmu_context_init(void)
99{
100 /* Reserve context 0 for kernel use */
101 context_map[0] = (1 << FIRST_CONTEXT) - 1;
102 next_mmu_context = FIRST_CONTEXT;
103}
diff --git a/arch/powerpc/mm/mmu_context_64.c b/arch/powerpc/mm/mmu_context_hash64.c
index 1db38ba1f544..dbeb86ac90cd 100644
--- a/arch/powerpc/mm/mmu_context_64.c
+++ b/arch/powerpc/mm/mmu_context_hash64.c
@@ -24,6 +24,14 @@
24static DEFINE_SPINLOCK(mmu_context_lock); 24static DEFINE_SPINLOCK(mmu_context_lock);
25static DEFINE_IDR(mmu_context_idr); 25static DEFINE_IDR(mmu_context_idr);
26 26
27/*
28 * The proto-VSID space has 2^35 - 1 segments available for user mappings.
29 * Each segment contains 2^28 bytes. Each context maps 2^44 bytes,
30 * so we can support 2^19-1 contexts (19 == 35 + 28 - 44).
31 */
32#define NO_CONTEXT 0
33#define MAX_CONTEXT ((1UL << 19) - 1)
34
27int init_new_context(struct task_struct *tsk, struct mm_struct *mm) 35int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
28{ 36{
29 int index; 37 int index;
diff --git a/arch/powerpc/mm/mmu_context_nohash.c b/arch/powerpc/mm/mmu_context_nohash.c
new file mode 100644
index 000000000000..52a0cfc38b64
--- /dev/null
+++ b/arch/powerpc/mm/mmu_context_nohash.c
@@ -0,0 +1,397 @@
1/*
2 * This file contains the routines for handling the MMU on those
3 * PowerPC implementations where the MMU is not using the hash
4 * table, such as 8xx, 4xx, BookE's etc...
5 *
6 * Copyright 2008 Ben Herrenschmidt <benh@kernel.crashing.org>
7 * IBM Corp.
8 *
9 * Derived from previous arch/powerpc/mm/mmu_context.c
10 * and arch/powerpc/include/asm/mmu_context.h
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 *
17 * TODO:
18 *
19 * - The global context lock will not scale very well
20 * - The maps should be dynamically allocated to allow for processors
21 * that support more PID bits at runtime
22 * - Implement flush_tlb_mm() by making the context stale and picking
23 * a new one
24 * - More aggressively clear stale map bits and maybe find some way to
25 * also clear mm->cpu_vm_mask bits when processes are migrated
26 */
27
28#undef DEBUG
29#define DEBUG_STEAL_ONLY
30#undef DEBUG_MAP_CONSISTENCY
31/*#define DEBUG_CLAMP_LAST_CONTEXT 15 */
32
33#include <linux/kernel.h>
34#include <linux/mm.h>
35#include <linux/init.h>
36#include <linux/spinlock.h>
37#include <linux/bootmem.h>
38#include <linux/notifier.h>
39#include <linux/cpu.h>
40
41#include <asm/mmu_context.h>
42#include <asm/tlbflush.h>
43
44static unsigned int first_context, last_context;
45static unsigned int next_context, nr_free_contexts;
46static unsigned long *context_map;
47static unsigned long *stale_map[NR_CPUS];
48static struct mm_struct **context_mm;
49static spinlock_t context_lock = SPIN_LOCK_UNLOCKED;
50
51#define CTX_MAP_SIZE \
52 (sizeof(unsigned long) * (last_context / BITS_PER_LONG + 1))
53
54
55/* Steal a context from a task that has one at the moment.
56 *
57 * This is used when we are running out of available PID numbers
58 * on the processors.
59 *
60 * This isn't an LRU system, it just frees up each context in
61 * turn (sort-of pseudo-random replacement :). This would be the
62 * place to implement an LRU scheme if anyone was motivated to do it.
63 * -- paulus
64 *
65 * For context stealing, we use a slightly different approach for
66 * SMP and UP. Basically, the UP one is simpler and doesn't use
67 * the stale map as we can just flush the local CPU
68 * -- benh
69 */
70#ifdef CONFIG_SMP
71static unsigned int steal_context_smp(unsigned int id)
72{
73 struct mm_struct *mm;
74 unsigned int cpu, max;
75
76 again:
77 max = last_context - first_context;
78
79 /* Attempt to free next_context first and then loop until we manage */
80 while (max--) {
81 /* Pick up the victim mm */
82 mm = context_mm[id];
83
84 /* We have a candidate victim, check if it's active, on SMP
85 * we cannot steal active contexts
86 */
87 if (mm->context.active) {
88 id++;
89 if (id > last_context)
90 id = first_context;
91 continue;
92 }
93 pr_debug("[%d] steal context %d from mm @%p\n",
94 smp_processor_id(), id, mm);
95
96 /* Mark this mm has having no context anymore */
97 mm->context.id = MMU_NO_CONTEXT;
98
99 /* Mark it stale on all CPUs that used this mm */
100 for_each_cpu_mask_nr(cpu, mm->cpu_vm_mask)
101 __set_bit(id, stale_map[cpu]);
102 return id;
103 }
104
105 /* This will happen if you have more CPUs than available contexts,
106 * all we can do here is wait a bit and try again
107 */
108 spin_unlock(&context_lock);
109 cpu_relax();
110 spin_lock(&context_lock);
111 goto again;
112}
113#endif /* CONFIG_SMP */
114
115/* Note that this will also be called on SMP if all other CPUs are
116 * offlined, which means that it may be called for cpu != 0. For
117 * this to work, we somewhat assume that CPUs that are onlined
118 * come up with a fully clean TLB (or are cleaned when offlined)
119 */
120static unsigned int steal_context_up(unsigned int id)
121{
122 struct mm_struct *mm;
123 int cpu = smp_processor_id();
124
125 /* Pick up the victim mm */
126 mm = context_mm[id];
127
128 pr_debug("[%d] steal context %d from mm @%p\n", cpu, id, mm);
129
130 /* Mark this mm has having no context anymore */
131 mm->context.id = MMU_NO_CONTEXT;
132
133 /* Flush the TLB for that context */
134 local_flush_tlb_mm(mm);
135
136 /* XXX This clear should ultimately be part of local_flush_tlb_mm */
137 __clear_bit(id, stale_map[cpu]);
138
139 return id;
140}
141
142#ifdef DEBUG_MAP_CONSISTENCY
143static void context_check_map(void)
144{
145 unsigned int id, nrf, nact;
146
147 nrf = nact = 0;
148 for (id = first_context; id <= last_context; id++) {
149 int used = test_bit(id, context_map);
150 if (!used)
151 nrf++;
152 if (used != (context_mm[id] != NULL))
153 pr_err("MMU: Context %d is %s and MM is %p !\n",
154 id, used ? "used" : "free", context_mm[id]);
155 if (context_mm[id] != NULL)
156 nact += context_mm[id]->context.active;
157 }
158 if (nrf != nr_free_contexts) {
159 pr_err("MMU: Free context count out of sync ! (%d vs %d)\n",
160 nr_free_contexts, nrf);
161 nr_free_contexts = nrf;
162 }
163 if (nact > num_online_cpus())
164 pr_err("MMU: More active contexts than CPUs ! (%d vs %d)\n",
165 nact, num_online_cpus());
166 if (first_context > 0 && !test_bit(0, context_map))
167 pr_err("MMU: Context 0 has been freed !!!\n");
168}
169#else
170static void context_check_map(void) { }
171#endif
172
173void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next)
174{
175 unsigned int id, cpu = smp_processor_id();
176 unsigned long *map;
177
178 /* No lockless fast path .. yet */
179 spin_lock(&context_lock);
180
181#ifndef DEBUG_STEAL_ONLY
182 pr_debug("[%d] activating context for mm @%p, active=%d, id=%d\n",
183 cpu, next, next->context.active, next->context.id);
184#endif
185
186#ifdef CONFIG_SMP
187 /* Mark us active and the previous one not anymore */
188 next->context.active++;
189 if (prev) {
190#ifndef DEBUG_STEAL_ONLY
191 pr_debug(" old context %p active was: %d\n",
192 prev, prev->context.active);
193#endif
194 WARN_ON(prev->context.active < 1);
195 prev->context.active--;
196 }
197#endif /* CONFIG_SMP */
198
199 /* If we already have a valid assigned context, skip all that */
200 id = next->context.id;
201 if (likely(id != MMU_NO_CONTEXT))
202 goto ctxt_ok;
203
204 /* We really don't have a context, let's try to acquire one */
205 id = next_context;
206 if (id > last_context)
207 id = first_context;
208 map = context_map;
209
210 /* No more free contexts, let's try to steal one */
211 if (nr_free_contexts == 0) {
212#ifdef CONFIG_SMP
213 if (num_online_cpus() > 1) {
214 id = steal_context_smp(id);
215 goto stolen;
216 }
217#endif /* CONFIG_SMP */
218 id = steal_context_up(id);
219 goto stolen;
220 }
221 nr_free_contexts--;
222
223 /* We know there's at least one free context, try to find it */
224 while (__test_and_set_bit(id, map)) {
225 id = find_next_zero_bit(map, last_context+1, id);
226 if (id > last_context)
227 id = first_context;
228 }
229 stolen:
230 next_context = id + 1;
231 context_mm[id] = next;
232 next->context.id = id;
233
234#ifndef DEBUG_STEAL_ONLY
235 pr_debug("[%d] picked up new id %d, nrf is now %d\n",
236 cpu, id, nr_free_contexts);
237#endif
238
239 context_check_map();
240 ctxt_ok:
241
242 /* If that context got marked stale on this CPU, then flush the
243 * local TLB for it and unmark it before we use it
244 */
245 if (test_bit(id, stale_map[cpu])) {
246 pr_debug("[%d] flushing stale context %d for mm @%p !\n",
247 cpu, id, next);
248 local_flush_tlb_mm(next);
249
250 /* XXX This clear should ultimately be part of local_flush_tlb_mm */
251 __clear_bit(id, stale_map[cpu]);
252 }
253
254 /* Flick the MMU and release lock */
255 set_context(id, next->pgd);
256 spin_unlock(&context_lock);
257}
258
259/*
260 * Set up the context for a new address space.
261 */
262int init_new_context(struct task_struct *t, struct mm_struct *mm)
263{
264 mm->context.id = MMU_NO_CONTEXT;
265 mm->context.active = 0;
266
267 return 0;
268}
269
270/*
271 * We're finished using the context for an address space.
272 */
273void destroy_context(struct mm_struct *mm)
274{
275 unsigned int id;
276
277 if (mm->context.id == MMU_NO_CONTEXT)
278 return;
279
280 WARN_ON(mm->context.active != 0);
281
282 spin_lock(&context_lock);
283 id = mm->context.id;
284 if (id != MMU_NO_CONTEXT) {
285 __clear_bit(id, context_map);
286 mm->context.id = MMU_NO_CONTEXT;
287#ifdef DEBUG_MAP_CONSISTENCY
288 mm->context.active = 0;
289 context_mm[id] = NULL;
290#endif
291 nr_free_contexts++;
292 }
293 spin_unlock(&context_lock);
294}
295
296#ifdef CONFIG_SMP
297
298static int __cpuinit mmu_context_cpu_notify(struct notifier_block *self,
299 unsigned long action, void *hcpu)
300{
301 unsigned int cpu = (unsigned int)(long)hcpu;
302
303 /* We don't touch CPU 0 map, it's allocated at aboot and kept
304 * around forever
305 */
306 if (cpu == 0)
307 return NOTIFY_OK;
308
309 switch (action) {
310 case CPU_ONLINE:
311 case CPU_ONLINE_FROZEN:
312 pr_debug("MMU: Allocating stale context map for CPU %d\n", cpu);
313 stale_map[cpu] = kzalloc(CTX_MAP_SIZE, GFP_KERNEL);
314 break;
315#ifdef CONFIG_HOTPLUG_CPU
316 case CPU_DEAD:
317 case CPU_DEAD_FROZEN:
318 pr_debug("MMU: Freeing stale context map for CPU %d\n", cpu);
319 kfree(stale_map[cpu]);
320 stale_map[cpu] = NULL;
321 break;
322#endif
323 }
324 return NOTIFY_OK;
325}
326
327static struct notifier_block __cpuinitdata mmu_context_cpu_nb = {
328 .notifier_call = mmu_context_cpu_notify,
329};
330
331#endif /* CONFIG_SMP */
332
333/*
334 * Initialize the context management stuff.
335 */
336void __init mmu_context_init(void)
337{
338 /* Mark init_mm as being active on all possible CPUs since
339 * we'll get called with prev == init_mm the first time
340 * we schedule on a given CPU
341 */
342 init_mm.context.active = NR_CPUS;
343
344 /*
345 * The MPC8xx has only 16 contexts. We rotate through them on each
346 * task switch. A better way would be to keep track of tasks that
347 * own contexts, and implement an LRU usage. That way very active
348 * tasks don't always have to pay the TLB reload overhead. The
349 * kernel pages are mapped shared, so the kernel can run on behalf
350 * of any task that makes a kernel entry. Shared does not mean they
351 * are not protected, just that the ASID comparison is not performed.
352 * -- Dan
353 *
354 * The IBM4xx has 256 contexts, so we can just rotate through these
355 * as a way of "switching" contexts. If the TID of the TLB is zero,
356 * the PID/TID comparison is disabled, so we can use a TID of zero
357 * to represent all kernel pages as shared among all contexts.
358 * -- Dan
359 */
360 if (mmu_has_feature(MMU_FTR_TYPE_8xx)) {
361 first_context = 0;
362 last_context = 15;
363 } else {
364 first_context = 1;
365 last_context = 255;
366 }
367
368#ifdef DEBUG_CLAMP_LAST_CONTEXT
369 last_context = DEBUG_CLAMP_LAST_CONTEXT;
370#endif
371 /*
372 * Allocate the maps used by context management
373 */
374 context_map = alloc_bootmem(CTX_MAP_SIZE);
375 context_mm = alloc_bootmem(sizeof(void *) * (last_context + 1));
376 stale_map[0] = alloc_bootmem(CTX_MAP_SIZE);
377
378#ifdef CONFIG_SMP
379 register_cpu_notifier(&mmu_context_cpu_nb);
380#endif
381
382 printk(KERN_INFO
383 "MMU: Allocated %d bytes of context maps for %d contexts\n",
384 2 * CTX_MAP_SIZE + (sizeof(void *) * (last_context + 1)),
385 last_context - first_context + 1);
386
387 /*
388 * Some processors have too few contexts to reserve one for
389 * init_mm, and require using context 0 for a normal task.
390 * Other processors reserve the use of context zero for the kernel.
391 * This code assumes first_context < 32.
392 */
393 context_map[0] = (1 << first_context) - 1;
394 next_context = first_context;
395 nr_free_contexts = last_context - first_context + 1;
396}
397
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
index fab3cfad4099..4314b39b6faf 100644
--- a/arch/powerpc/mm/mmu_decl.h
+++ b/arch/powerpc/mm/mmu_decl.h
@@ -22,10 +22,58 @@
22#include <asm/tlbflush.h> 22#include <asm/tlbflush.h>
23#include <asm/mmu.h> 23#include <asm/mmu.h>
24 24
25#ifdef CONFIG_PPC_MMU_NOHASH
26
27/*
28 * On 40x and 8xx, we directly inline tlbia and tlbivax
29 */
30#if defined(CONFIG_40x) || defined(CONFIG_8xx)
31static inline void _tlbil_all(void)
32{
33 asm volatile ("sync; tlbia; isync" : : : "memory")
34}
35static inline void _tlbil_pid(unsigned int pid)
36{
37 asm volatile ("sync; tlbia; isync" : : : "memory")
38}
39#else /* CONFIG_40x || CONFIG_8xx */
40extern void _tlbil_all(void);
41extern void _tlbil_pid(unsigned int pid);
42#endif /* !(CONFIG_40x || CONFIG_8xx) */
43
44/*
45 * On 8xx, we directly inline tlbie, on others, it's extern
46 */
47#ifdef CONFIG_8xx
48static inline void _tlbil_va(unsigned long address, unsigned int pid)
49{
50 asm volatile ("tlbie %0; sync" : : "r" (address) : "memory")
51}
52#else /* CONFIG_8xx */
53extern void _tlbil_va(unsigned long address, unsigned int pid);
54#endif /* CONIFG_8xx */
55
56/*
57 * As of today, we don't support tlbivax broadcast on any
58 * implementation. When that becomes the case, this will be
59 * an extern.
60 */
61static inline void _tlbivax_bcast(unsigned long address, unsigned int pid)
62{
63 BUG();
64}
65
66#else /* CONFIG_PPC_MMU_NOHASH */
67
25extern void hash_preload(struct mm_struct *mm, unsigned long ea, 68extern void hash_preload(struct mm_struct *mm, unsigned long ea,
26 unsigned long access, unsigned long trap); 69 unsigned long access, unsigned long trap);
27 70
28 71
72extern void _tlbie(unsigned long address);
73extern void _tlbia(void);
74
75#endif /* CONFIG_PPC_MMU_NOHASH */
76
29#ifdef CONFIG_PPC32 77#ifdef CONFIG_PPC32
30extern void mapin_ram(void); 78extern void mapin_ram(void);
31extern int map_page(unsigned long va, phys_addr_t pa, int flags); 79extern int map_page(unsigned long va, phys_addr_t pa, int flags);
@@ -58,17 +106,14 @@ extern phys_addr_t lowmem_end_addr;
58 * architectures. -- Dan 106 * architectures. -- Dan
59 */ 107 */
60#if defined(CONFIG_8xx) 108#if defined(CONFIG_8xx)
61#define flush_HPTE(X, va, pg) _tlbie(va, 0 /* 8xx doesn't care about PID */)
62#define MMU_init_hw() do { } while(0) 109#define MMU_init_hw() do { } while(0)
63#define mmu_mapin_ram() (0UL) 110#define mmu_mapin_ram() (0UL)
64 111
65#elif defined(CONFIG_4xx) 112#elif defined(CONFIG_4xx)
66#define flush_HPTE(pid, va, pg) _tlbie(va, pid)
67extern void MMU_init_hw(void); 113extern void MMU_init_hw(void);
68extern unsigned long mmu_mapin_ram(void); 114extern unsigned long mmu_mapin_ram(void);
69 115
70#elif defined(CONFIG_FSL_BOOKE) 116#elif defined(CONFIG_FSL_BOOKE)
71#define flush_HPTE(pid, va, pg) _tlbie(va, pid)
72extern void MMU_init_hw(void); 117extern void MMU_init_hw(void);
73extern unsigned long mmu_mapin_ram(void); 118extern unsigned long mmu_mapin_ram(void);
74extern void adjust_total_lowmem(void); 119extern void adjust_total_lowmem(void);
@@ -77,18 +122,4 @@ extern void adjust_total_lowmem(void);
77/* anything 32-bit except 4xx or 8xx */ 122/* anything 32-bit except 4xx or 8xx */
78extern void MMU_init_hw(void); 123extern void MMU_init_hw(void);
79extern unsigned long mmu_mapin_ram(void); 124extern unsigned long mmu_mapin_ram(void);
80
81/* Be careful....this needs to be updated if we ever encounter 603 SMPs,
82 * which includes all new 82xx processors. We need tlbie/tlbsync here
83 * in that case (I think). -- Dan.
84 */
85static inline void flush_HPTE(unsigned context, unsigned long va,
86 unsigned long pdval)
87{
88 if ((Hash != 0) &&
89 cpu_has_feature(CPU_FTR_HPTE_TABLE))
90 flush_hash_pages(0, va, pdval, 1);
91 else
92 _tlbie(va);
93}
94#endif 125#endif
diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c
new file mode 100644
index 000000000000..6d94116fdea1
--- /dev/null
+++ b/arch/powerpc/mm/pgtable.c
@@ -0,0 +1,117 @@
1/*
2 * This file contains common routines for dealing with free of page tables
3 *
4 * Derived from arch/powerpc/mm/tlb_64.c:
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 *
7 * Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au)
8 * and Cort Dougan (PReP) (cort@cs.nmt.edu)
9 * Copyright (C) 1996 Paul Mackerras
10 *
11 * Derived from "arch/i386/mm/init.c"
12 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
13 *
14 * Dave Engebretsen <engebret@us.ibm.com>
15 * Rework for PPC64 port.
16 *
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation; either version
20 * 2 of the License, or (at your option) any later version.
21 */
22
23#include <linux/kernel.h>
24#include <linux/mm.h>
25#include <linux/init.h>
26#include <linux/percpu.h>
27#include <linux/hardirq.h>
28#include <asm/pgalloc.h>
29#include <asm/tlbflush.h>
30#include <asm/tlb.h>
31
32static DEFINE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur);
33static unsigned long pte_freelist_forced_free;
34
35struct pte_freelist_batch
36{
37 struct rcu_head rcu;
38 unsigned int index;
39 pgtable_free_t tables[0];
40};
41
42#define PTE_FREELIST_SIZE \
43 ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) \
44 / sizeof(pgtable_free_t))
45
46static void pte_free_smp_sync(void *arg)
47{
48 /* Do nothing, just ensure we sync with all CPUs */
49}
50
51/* This is only called when we are critically out of memory
52 * (and fail to get a page in pte_free_tlb).
53 */
54static void pgtable_free_now(pgtable_free_t pgf)
55{
56 pte_freelist_forced_free++;
57
58 smp_call_function(pte_free_smp_sync, NULL, 1);
59
60 pgtable_free(pgf);
61}
62
63static void pte_free_rcu_callback(struct rcu_head *head)
64{
65 struct pte_freelist_batch *batch =
66 container_of(head, struct pte_freelist_batch, rcu);
67 unsigned int i;
68
69 for (i = 0; i < batch->index; i++)
70 pgtable_free(batch->tables[i]);
71
72 free_page((unsigned long)batch);
73}
74
75static void pte_free_submit(struct pte_freelist_batch *batch)
76{
77 INIT_RCU_HEAD(&batch->rcu);
78 call_rcu(&batch->rcu, pte_free_rcu_callback);
79}
80
81void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf)
82{
83 /* This is safe since tlb_gather_mmu has disabled preemption */
84 cpumask_t local_cpumask = cpumask_of_cpu(smp_processor_id());
85 struct pte_freelist_batch **batchp = &__get_cpu_var(pte_freelist_cur);
86
87 if (atomic_read(&tlb->mm->mm_users) < 2 ||
88 cpus_equal(tlb->mm->cpu_vm_mask, local_cpumask)) {
89 pgtable_free(pgf);
90 return;
91 }
92
93 if (*batchp == NULL) {
94 *batchp = (struct pte_freelist_batch *)__get_free_page(GFP_ATOMIC);
95 if (*batchp == NULL) {
96 pgtable_free_now(pgf);
97 return;
98 }
99 (*batchp)->index = 0;
100 }
101 (*batchp)->tables[(*batchp)->index++] = pgf;
102 if ((*batchp)->index == PTE_FREELIST_SIZE) {
103 pte_free_submit(*batchp);
104 *batchp = NULL;
105 }
106}
107
108void pte_free_finish(void)
109{
110 /* This is safe since tlb_gather_mmu has disabled preemption */
111 struct pte_freelist_batch **batchp = &__get_cpu_var(pte_freelist_cur);
112
113 if (*batchp == NULL)
114 return;
115 pte_free_submit(*batchp);
116 *batchp = NULL;
117}
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index c31d6d26f0b5..38ff35f2142a 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -48,10 +48,6 @@ EXPORT_SYMBOL(ioremap_bot); /* aka VMALLOC_END */
48 48
49extern char etext[], _stext[]; 49extern char etext[], _stext[];
50 50
51#ifdef CONFIG_SMP
52extern void hash_page_sync(void);
53#endif
54
55#ifdef HAVE_BATS 51#ifdef HAVE_BATS
56extern phys_addr_t v_mapped_by_bats(unsigned long va); 52extern phys_addr_t v_mapped_by_bats(unsigned long va);
57extern unsigned long p_mapped_by_bats(phys_addr_t pa); 53extern unsigned long p_mapped_by_bats(phys_addr_t pa);
@@ -72,24 +68,29 @@ extern unsigned long p_mapped_by_tlbcam(unsigned long pa);
72#define p_mapped_by_tlbcam(x) (0UL) 68#define p_mapped_by_tlbcam(x) (0UL)
73#endif /* HAVE_TLBCAM */ 69#endif /* HAVE_TLBCAM */
74 70
75#ifdef CONFIG_PTE_64BIT 71#define PGDIR_ORDER (32 + PGD_T_LOG2 - PGDIR_SHIFT)
76/* Some processors use an 8kB pgdir because they have 8-byte Linux PTEs. */
77#define PGDIR_ORDER 1
78#else
79#define PGDIR_ORDER 0
80#endif
81 72
82pgd_t *pgd_alloc(struct mm_struct *mm) 73pgd_t *pgd_alloc(struct mm_struct *mm)
83{ 74{
84 pgd_t *ret; 75 pgd_t *ret;
85 76
86 ret = (pgd_t *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, PGDIR_ORDER); 77 /* pgdir take page or two with 4K pages and a page fraction otherwise */
78#ifndef CONFIG_PPC_4K_PAGES
79 ret = (pgd_t *)kzalloc(1 << PGDIR_ORDER, GFP_KERNEL);
80#else
81 ret = (pgd_t *)__get_free_pages(GFP_KERNEL|__GFP_ZERO,
82 PGDIR_ORDER - PAGE_SHIFT);
83#endif
87 return ret; 84 return ret;
88} 85}
89 86
90void pgd_free(struct mm_struct *mm, pgd_t *pgd) 87void pgd_free(struct mm_struct *mm, pgd_t *pgd)
91{ 88{
92 free_pages((unsigned long)pgd, PGDIR_ORDER); 89#ifndef CONFIG_PPC_4K_PAGES
90 kfree((void *)pgd);
91#else
92 free_pages((unsigned long)pgd, PGDIR_ORDER - PAGE_SHIFT);
93#endif
93} 94}
94 95
95__init_refok pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) 96__init_refok pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
@@ -125,23 +126,6 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
125 return ptepage; 126 return ptepage;
126} 127}
127 128
128void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
129{
130#ifdef CONFIG_SMP
131 hash_page_sync();
132#endif
133 free_page((unsigned long)pte);
134}
135
136void pte_free(struct mm_struct *mm, pgtable_t ptepage)
137{
138#ifdef CONFIG_SMP
139 hash_page_sync();
140#endif
141 pgtable_page_dtor(ptepage);
142 __free_page(ptepage);
143}
144
145void __iomem * 129void __iomem *
146ioremap(phys_addr_t addr, unsigned long size) 130ioremap(phys_addr_t addr, unsigned long size)
147{ 131{
@@ -194,6 +178,7 @@ __ioremap(phys_addr_t addr, unsigned long size, unsigned long flags)
194 if (p < 16*1024*1024) 178 if (p < 16*1024*1024)
195 p += _ISA_MEM_BASE; 179 p += _ISA_MEM_BASE;
196 180
181#ifndef CONFIG_CRASH_DUMP
197 /* 182 /*
198 * Don't allow anybody to remap normal RAM that we're using. 183 * Don't allow anybody to remap normal RAM that we're using.
199 * mem_init() sets high_memory so only do the check after that. 184 * mem_init() sets high_memory so only do the check after that.
@@ -203,6 +188,7 @@ __ioremap(phys_addr_t addr, unsigned long size, unsigned long flags)
203 (unsigned long long)p, __builtin_return_address(0)); 188 (unsigned long long)p, __builtin_return_address(0));
204 return NULL; 189 return NULL;
205 } 190 }
191#endif
206 192
207 if (size == 0) 193 if (size == 0)
208 return NULL; 194 return NULL;
@@ -288,7 +274,7 @@ int map_page(unsigned long va, phys_addr_t pa, int flags)
288} 274}
289 275
290/* 276/*
291 * Map in a big chunk of physical memory starting at KERNELBASE. 277 * Map in a big chunk of physical memory starting at PAGE_OFFSET.
292 */ 278 */
293void __init mapin_ram(void) 279void __init mapin_ram(void)
294{ 280{
@@ -297,7 +283,7 @@ void __init mapin_ram(void)
297 int ktext; 283 int ktext;
298 284
299 s = mmu_mapin_ram(); 285 s = mmu_mapin_ram();
300 v = KERNELBASE + s; 286 v = PAGE_OFFSET + s;
301 p = memstart_addr + s; 287 p = memstart_addr + s;
302 for (; s < total_lowmem; s += PAGE_SIZE) { 288 for (; s < total_lowmem; s += PAGE_SIZE) {
303 ktext = ((char *) v >= _stext && (char *) v < etext); 289 ktext = ((char *) v >= _stext && (char *) v < etext);
@@ -363,7 +349,11 @@ static int __change_page_attr(struct page *page, pgprot_t prot)
363 return -EINVAL; 349 return -EINVAL;
364 set_pte_at(&init_mm, address, kpte, mk_pte(page, prot)); 350 set_pte_at(&init_mm, address, kpte, mk_pte(page, prot));
365 wmb(); 351 wmb();
366 flush_HPTE(0, address, pmd_val(*kpmd)); 352#ifdef CONFIG_PPC_STD_MMU
353 flush_hash_pages(0, address, pmd_val(*kpmd), 1);
354#else
355 flush_tlb_page(NULL, address);
356#endif
367 pte_unmap(kpte); 357 pte_unmap(kpte);
368 358
369 return 0; 359 return 0;
@@ -400,7 +390,7 @@ void kernel_map_pages(struct page *page, int numpages, int enable)
400#endif /* CONFIG_DEBUG_PAGEALLOC */ 390#endif /* CONFIG_DEBUG_PAGEALLOC */
401 391
402static int fixmaps; 392static int fixmaps;
403unsigned long FIXADDR_TOP = 0xfffff000; 393unsigned long FIXADDR_TOP = (-PAGE_SIZE);
404EXPORT_SYMBOL(FIXADDR_TOP); 394EXPORT_SYMBOL(FIXADDR_TOP);
405 395
406void __set_fixmap (enum fixed_addresses idx, phys_addr_t phys, pgprot_t flags) 396void __set_fixmap (enum fixed_addresses idx, phys_addr_t phys, pgprot_t flags)
diff --git a/arch/powerpc/mm/ppc_mmu_32.c b/arch/powerpc/mm/ppc_mmu_32.c
index 6aa120813775..45d925360b89 100644
--- a/arch/powerpc/mm/ppc_mmu_32.c
+++ b/arch/powerpc/mm/ppc_mmu_32.c
@@ -95,16 +95,16 @@ unsigned long __init mmu_mapin_ram(void)
95 break; 95 break;
96 } 96 }
97 97
98 setbat(2, KERNELBASE, 0, bl, _PAGE_RAM); 98 setbat(2, PAGE_OFFSET, 0, bl, _PAGE_RAM);
99 done = (unsigned long)bat_addrs[2].limit - KERNELBASE + 1; 99 done = (unsigned long)bat_addrs[2].limit - PAGE_OFFSET + 1;
100 if ((done < tot) && !bat_addrs[3].limit) { 100 if ((done < tot) && !bat_addrs[3].limit) {
101 /* use BAT3 to cover a bit more */ 101 /* use BAT3 to cover a bit more */
102 tot -= done; 102 tot -= done;
103 for (bl = 128<<10; bl < max_size; bl <<= 1) 103 for (bl = 128<<10; bl < max_size; bl <<= 1)
104 if (bl * 2 > tot) 104 if (bl * 2 > tot)
105 break; 105 break;
106 setbat(3, KERNELBASE+done, done, bl, _PAGE_RAM); 106 setbat(3, PAGE_OFFSET+done, done, bl, _PAGE_RAM);
107 done = (unsigned long)bat_addrs[3].limit - KERNELBASE + 1; 107 done = (unsigned long)bat_addrs[3].limit - PAGE_OFFSET + 1;
108 } 108 }
109 109
110 return done; 110 return done;
@@ -192,7 +192,7 @@ void __init MMU_init_hw(void)
192 extern unsigned int hash_page[]; 192 extern unsigned int hash_page[];
193 extern unsigned int flush_hash_patch_A[], flush_hash_patch_B[]; 193 extern unsigned int flush_hash_patch_A[], flush_hash_patch_B[];
194 194
195 if (!cpu_has_feature(CPU_FTR_HPTE_TABLE)) { 195 if (!mmu_has_feature(MMU_FTR_HPTE_TABLE)) {
196 /* 196 /*
197 * Put a blr (procedure return) instruction at the 197 * Put a blr (procedure return) instruction at the
198 * start of hash_page, since we can still get DSI 198 * start of hash_page, since we can still get DSI
diff --git a/arch/powerpc/mm/tlb_32.c b/arch/powerpc/mm/tlb_hash32.c
index f9a47fee3927..65190587a365 100644
--- a/arch/powerpc/mm/tlb_32.c
+++ b/arch/powerpc/mm/tlb_hash32.c
@@ -137,6 +137,7 @@ void flush_tlb_kernel_range(unsigned long start, unsigned long end)
137 flush_range(&init_mm, start, end); 137 flush_range(&init_mm, start, end);
138 FINISH_FLUSH; 138 FINISH_FLUSH;
139} 139}
140EXPORT_SYMBOL(flush_tlb_kernel_range);
140 141
141/* 142/*
142 * Flush all the (user) entries for the address space described by mm. 143 * Flush all the (user) entries for the address space described by mm.
@@ -160,6 +161,7 @@ void flush_tlb_mm(struct mm_struct *mm)
160 flush_range(mp->vm_mm, mp->vm_start, mp->vm_end); 161 flush_range(mp->vm_mm, mp->vm_start, mp->vm_end);
161 FINISH_FLUSH; 162 FINISH_FLUSH;
162} 163}
164EXPORT_SYMBOL(flush_tlb_mm);
163 165
164void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr) 166void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
165{ 167{
@@ -176,6 +178,7 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
176 flush_hash_pages(mm->context.id, vmaddr, pmd_val(*pmd), 1); 178 flush_hash_pages(mm->context.id, vmaddr, pmd_val(*pmd), 1);
177 FINISH_FLUSH; 179 FINISH_FLUSH;
178} 180}
181EXPORT_SYMBOL(flush_tlb_page);
179 182
180/* 183/*
181 * For each address in the range, find the pte for the address 184 * For each address in the range, find the pte for the address
@@ -188,3 +191,4 @@ void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
188 flush_range(vma->vm_mm, start, end); 191 flush_range(vma->vm_mm, start, end);
189 FINISH_FLUSH; 192 FINISH_FLUSH;
190} 193}
194EXPORT_SYMBOL(flush_tlb_range);
diff --git a/arch/powerpc/mm/tlb_64.c b/arch/powerpc/mm/tlb_hash64.c
index be7dd422c0fa..c931bc7d1079 100644
--- a/arch/powerpc/mm/tlb_64.c
+++ b/arch/powerpc/mm/tlb_hash64.c
@@ -37,81 +37,6 @@ DEFINE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch);
37 * arch/powerpc/include/asm/tlb.h file -- tgall 37 * arch/powerpc/include/asm/tlb.h file -- tgall
38 */ 38 */
39DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 39DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
40static DEFINE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur);
41static unsigned long pte_freelist_forced_free;
42
43struct pte_freelist_batch
44{
45 struct rcu_head rcu;
46 unsigned int index;
47 pgtable_free_t tables[0];
48};
49
50#define PTE_FREELIST_SIZE \
51 ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) \
52 / sizeof(pgtable_free_t))
53
54static void pte_free_smp_sync(void *arg)
55{
56 /* Do nothing, just ensure we sync with all CPUs */
57}
58
59/* This is only called when we are critically out of memory
60 * (and fail to get a page in pte_free_tlb).
61 */
62static void pgtable_free_now(pgtable_free_t pgf)
63{
64 pte_freelist_forced_free++;
65
66 smp_call_function(pte_free_smp_sync, NULL, 1);
67
68 pgtable_free(pgf);
69}
70
71static void pte_free_rcu_callback(struct rcu_head *head)
72{
73 struct pte_freelist_batch *batch =
74 container_of(head, struct pte_freelist_batch, rcu);
75 unsigned int i;
76
77 for (i = 0; i < batch->index; i++)
78 pgtable_free(batch->tables[i]);
79
80 free_page((unsigned long)batch);
81}
82
83static void pte_free_submit(struct pte_freelist_batch *batch)
84{
85 INIT_RCU_HEAD(&batch->rcu);
86 call_rcu(&batch->rcu, pte_free_rcu_callback);
87}
88
89void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf)
90{
91 /* This is safe since tlb_gather_mmu has disabled preemption */
92 cpumask_t local_cpumask = cpumask_of_cpu(smp_processor_id());
93 struct pte_freelist_batch **batchp = &__get_cpu_var(pte_freelist_cur);
94
95 if (atomic_read(&tlb->mm->mm_users) < 2 ||
96 cpus_equal(tlb->mm->cpu_vm_mask, local_cpumask)) {
97 pgtable_free(pgf);
98 return;
99 }
100
101 if (*batchp == NULL) {
102 *batchp = (struct pte_freelist_batch *)__get_free_page(GFP_ATOMIC);
103 if (*batchp == NULL) {
104 pgtable_free_now(pgf);
105 return;
106 }
107 (*batchp)->index = 0;
108 }
109 (*batchp)->tables[(*batchp)->index++] = pgf;
110 if ((*batchp)->index == PTE_FREELIST_SIZE) {
111 pte_free_submit(*batchp);
112 *batchp = NULL;
113 }
114}
115 40
116/* 41/*
117 * A linux PTE was changed and the corresponding hash table entry 42 * A linux PTE was changed and the corresponding hash table entry
@@ -229,17 +154,6 @@ void __flush_tlb_pending(struct ppc64_tlb_batch *batch)
229 batch->index = 0; 154 batch->index = 0;
230} 155}
231 156
232void pte_free_finish(void)
233{
234 /* This is safe since tlb_gather_mmu has disabled preemption */
235 struct pte_freelist_batch **batchp = &__get_cpu_var(pte_freelist_cur);
236
237 if (*batchp == NULL)
238 return;
239 pte_free_submit(*batchp);
240 *batchp = NULL;
241}
242
243/** 157/**
244 * __flush_hash_table_range - Flush all HPTEs for a given address range 158 * __flush_hash_table_range - Flush all HPTEs for a given address range
245 * from the hash table (and the TLB). But keeps 159 * from the hash table (and the TLB). But keeps
diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c
new file mode 100644
index 000000000000..803a64c02b06
--- /dev/null
+++ b/arch/powerpc/mm/tlb_nohash.c
@@ -0,0 +1,209 @@
1/*
2 * This file contains the routines for TLB flushing.
3 * On machines where the MMU does not use a hash table to store virtual to
4 * physical translations (ie, SW loaded TLBs or Book3E compilant processors,
5 * this does -not- include 603 however which shares the implementation with
6 * hash based processors)
7 *
8 * -- BenH
9 *
10 * Copyright 2008 Ben Herrenschmidt <benh@kernel.crashing.org>
11 * IBM Corp.
12 *
13 * Derived from arch/ppc/mm/init.c:
14 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
15 *
16 * Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au)
17 * and Cort Dougan (PReP) (cort@cs.nmt.edu)
18 * Copyright (C) 1996 Paul Mackerras
19 *
20 * Derived from "arch/i386/mm/init.c"
21 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
22 *
23 * This program is free software; you can redistribute it and/or
24 * modify it under the terms of the GNU General Public License
25 * as published by the Free Software Foundation; either version
26 * 2 of the License, or (at your option) any later version.
27 *
28 */
29
30#include <linux/kernel.h>
31#include <linux/mm.h>
32#include <linux/init.h>
33#include <linux/highmem.h>
34#include <linux/pagemap.h>
35#include <linux/preempt.h>
36#include <linux/spinlock.h>
37
38#include <asm/tlbflush.h>
39#include <asm/tlb.h>
40
41#include "mmu_decl.h"
42
43/*
44 * Base TLB flushing operations:
45 *
46 * - flush_tlb_mm(mm) flushes the specified mm context TLB's
47 * - flush_tlb_page(vma, vmaddr) flushes one page
48 * - flush_tlb_range(vma, start, end) flushes a range of pages
49 * - flush_tlb_kernel_range(start, end) flushes kernel pages
50 *
51 * - local_* variants of page and mm only apply to the current
52 * processor
53 */
54
55/*
56 * These are the base non-SMP variants of page and mm flushing
57 */
58void local_flush_tlb_mm(struct mm_struct *mm)
59{
60 unsigned int pid;
61
62 preempt_disable();
63 pid = mm->context.id;
64 if (pid != MMU_NO_CONTEXT)
65 _tlbil_pid(pid);
66 preempt_enable();
67}
68EXPORT_SYMBOL(local_flush_tlb_mm);
69
70void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
71{
72 unsigned int pid;
73
74 preempt_disable();
75 pid = vma ? vma->vm_mm->context.id : 0;
76 if (pid != MMU_NO_CONTEXT)
77 _tlbil_va(vmaddr, pid);
78 preempt_enable();
79}
80EXPORT_SYMBOL(local_flush_tlb_page);
81
82
83/*
84 * And here are the SMP non-local implementations
85 */
86#ifdef CONFIG_SMP
87
88static DEFINE_SPINLOCK(tlbivax_lock);
89
90struct tlb_flush_param {
91 unsigned long addr;
92 unsigned int pid;
93};
94
95static void do_flush_tlb_mm_ipi(void *param)
96{
97 struct tlb_flush_param *p = param;
98
99 _tlbil_pid(p ? p->pid : 0);
100}
101
102static void do_flush_tlb_page_ipi(void *param)
103{
104 struct tlb_flush_param *p = param;
105
106 _tlbil_va(p->addr, p->pid);
107}
108
109
110/* Note on invalidations and PID:
111 *
112 * We snapshot the PID with preempt disabled. At this point, it can still
113 * change either because:
114 * - our context is being stolen (PID -> NO_CONTEXT) on another CPU
115 * - we are invaliating some target that isn't currently running here
116 * and is concurrently acquiring a new PID on another CPU
117 * - some other CPU is re-acquiring a lost PID for this mm
118 * etc...
119 *
120 * However, this shouldn't be a problem as we only guarantee
121 * invalidation of TLB entries present prior to this call, so we
122 * don't care about the PID changing, and invalidating a stale PID
123 * is generally harmless.
124 */
125
126void flush_tlb_mm(struct mm_struct *mm)
127{
128 cpumask_t cpu_mask;
129 unsigned int pid;
130
131 preempt_disable();
132 pid = mm->context.id;
133 if (unlikely(pid == MMU_NO_CONTEXT))
134 goto no_context;
135 cpu_mask = mm->cpu_vm_mask;
136 cpu_clear(smp_processor_id(), cpu_mask);
137 if (!cpus_empty(cpu_mask)) {
138 struct tlb_flush_param p = { .pid = pid };
139 smp_call_function_mask(cpu_mask, do_flush_tlb_mm_ipi, &p, 1);
140 }
141 _tlbil_pid(pid);
142 no_context:
143 preempt_enable();
144}
145EXPORT_SYMBOL(flush_tlb_mm);
146
147void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
148{
149 cpumask_t cpu_mask;
150 unsigned int pid;
151
152 preempt_disable();
153 pid = vma ? vma->vm_mm->context.id : 0;
154 if (unlikely(pid == MMU_NO_CONTEXT))
155 goto bail;
156 cpu_mask = vma->vm_mm->cpu_vm_mask;
157 cpu_clear(smp_processor_id(), cpu_mask);
158 if (!cpus_empty(cpu_mask)) {
159 /* If broadcast tlbivax is supported, use it */
160 if (mmu_has_feature(MMU_FTR_USE_TLBIVAX_BCAST)) {
161 int lock = mmu_has_feature(MMU_FTR_LOCK_BCAST_INVAL);
162 if (lock)
163 spin_lock(&tlbivax_lock);
164 _tlbivax_bcast(vmaddr, pid);
165 if (lock)
166 spin_unlock(&tlbivax_lock);
167 goto bail;
168 } else {
169 struct tlb_flush_param p = { .pid = pid, .addr = vmaddr };
170 smp_call_function_mask(cpu_mask,
171 do_flush_tlb_page_ipi, &p, 1);
172 }
173 }
174 _tlbil_va(vmaddr, pid);
175 bail:
176 preempt_enable();
177}
178EXPORT_SYMBOL(flush_tlb_page);
179
180#endif /* CONFIG_SMP */
181
182/*
183 * Flush kernel TLB entries in the given range
184 */
185void flush_tlb_kernel_range(unsigned long start, unsigned long end)
186{
187#ifdef CONFIG_SMP
188 preempt_disable();
189 smp_call_function(do_flush_tlb_mm_ipi, NULL, 1);
190 _tlbil_pid(0);
191 preempt_enable();
192#endif
193 _tlbil_pid(0);
194}
195EXPORT_SYMBOL(flush_tlb_kernel_range);
196
197/*
198 * Currently, for range flushing, we just do a full mm flush. This should
199 * be optimized based on a threshold on the size of the range, since
200 * some implementation can stack multiple tlbivax before a tlbsync but
201 * for now, we keep it that way
202 */
203void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
204 unsigned long end)
205
206{
207 flush_tlb_mm(vma->vm_mm);
208}
209EXPORT_SYMBOL(flush_tlb_range);
diff --git a/arch/powerpc/mm/tlb_nohash_low.S b/arch/powerpc/mm/tlb_nohash_low.S
new file mode 100644
index 000000000000..f900a39e6ec4
--- /dev/null
+++ b/arch/powerpc/mm/tlb_nohash_low.S
@@ -0,0 +1,166 @@
1/*
2 * This file contains low-level functions for performing various
3 * types of TLB invalidations on various processors with no hash
4 * table.
5 *
6 * This file implements the following functions for all no-hash
7 * processors. Some aren't implemented for some variants. Some
8 * are inline in tlbflush.h
9 *
10 * - tlbil_va
11 * - tlbil_pid
12 * - tlbil_all
13 * - tlbivax_bcast (not yet)
14 *
15 * Code mostly moved over from misc_32.S
16 *
17 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
18 *
19 * Partially rewritten by Cort Dougan (cort@cs.nmt.edu)
20 * Paul Mackerras, Kumar Gala and Benjamin Herrenschmidt.
21 *
22 * This program is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU General Public License
24 * as published by the Free Software Foundation; either version
25 * 2 of the License, or (at your option) any later version.
26 *
27 */
28
29#include <asm/reg.h>
30#include <asm/page.h>
31#include <asm/cputable.h>
32#include <asm/mmu.h>
33#include <asm/ppc_asm.h>
34#include <asm/asm-offsets.h>
35#include <asm/processor.h>
36
37#if defined(CONFIG_40x)
38
39/*
40 * 40x implementation needs only tlbil_va
41 */
42_GLOBAL(_tlbil_va)
43 /* We run the search with interrupts disabled because we have to change
44 * the PID and I don't want to preempt when that happens.
45 */
46 mfmsr r5
47 mfspr r6,SPRN_PID
48 wrteei 0
49 mtspr SPRN_PID,r4
50 tlbsx. r3, 0, r3
51 mtspr SPRN_PID,r6
52 wrtee r5
53 bne 1f
54 sync
55 /* There are only 64 TLB entries, so r3 < 64, which means bit 25 is
56 * clear. Since 25 is the V bit in the TLB_TAG, loading this value
57 * will invalidate the TLB entry. */
58 tlbwe r3, r3, TLB_TAG
59 isync
601: blr
61
62#elif defined(CONFIG_8xx)
63
64/*
65 * Nothing to do for 8xx, everything is inline
66 */
67
68#elif defined(CONFIG_44x)
69
70/*
71 * 440 implementation uses tlbsx/we for tlbil_va and a full sweep
72 * of the TLB for everything else.
73 */
74_GLOBAL(_tlbil_va)
75 mfspr r5,SPRN_MMUCR
76 rlwimi r5,r4,0,24,31 /* Set TID */
77
78 /* We have to run the search with interrupts disabled, otherwise
79 * an interrupt which causes a TLB miss can clobber the MMUCR
80 * between the mtspr and the tlbsx.
81 *
82 * Critical and Machine Check interrupts take care of saving
83 * and restoring MMUCR, so only normal interrupts have to be
84 * taken care of.
85 */
86 mfmsr r4
87 wrteei 0
88 mtspr SPRN_MMUCR,r5
89 tlbsx. r3, 0, r3
90 wrtee r4
91 bne 1f
92 sync
93 /* There are only 64 TLB entries, so r3 < 64,
94 * which means bit 22, is clear. Since 22 is
95 * the V bit in the TLB_PAGEID, loading this
96 * value will invalidate the TLB entry.
97 */
98 tlbwe r3, r3, PPC44x_TLB_PAGEID
99 isync
1001: blr
101
102_GLOBAL(_tlbil_all)
103_GLOBAL(_tlbil_pid)
104 li r3,0
105 sync
106
107 /* Load high watermark */
108 lis r4,tlb_44x_hwater@ha
109 lwz r5,tlb_44x_hwater@l(r4)
110
1111: tlbwe r3,r3,PPC44x_TLB_PAGEID
112 addi r3,r3,1
113 cmpw 0,r3,r5
114 ble 1b
115
116 isync
117 blr
118
119#elif defined(CONFIG_FSL_BOOKE)
120/*
121 * FSL BookE implementations. Currently _pid and _all are the
122 * same. This will change when tlbilx is actually supported and
123 * performs invalidate-by-PID. This change will be driven by
124 * mmu_features conditional
125 */
126
127/*
128 * Flush MMU TLB on the local processor
129 */
130_GLOBAL(_tlbil_pid)
131_GLOBAL(_tlbil_all)
132#define MMUCSR0_TLBFI (MMUCSR0_TLB0FI | MMUCSR0_TLB1FI | \
133 MMUCSR0_TLB2FI | MMUCSR0_TLB3FI)
134 li r3,(MMUCSR0_TLBFI)@l
135 mtspr SPRN_MMUCSR0, r3
1361:
137 mfspr r3,SPRN_MMUCSR0
138 andi. r3,r3,MMUCSR0_TLBFI@l
139 bne 1b
140 msync
141 isync
142 blr
143
144/*
145 * Flush MMU TLB for a particular address, but only on the local processor
146 * (no broadcast)
147 */
148_GLOBAL(_tlbil_va)
149 mfmsr r10
150 wrteei 0
151 slwi r4,r4,16
152 mtspr SPRN_MAS6,r4 /* assume AS=0 for now */
153 tlbsx 0,r3
154 mfspr r4,SPRN_MAS1 /* check valid */
155 andis. r3,r4,MAS1_VALID@h
156 beq 1f
157 rlwinm r4,r4,0,1,31
158 mtspr SPRN_MAS1,r4
159 tlbwe
160 msync
161 isync
1621: wrtee r10
163 blr
164#elif
165#error Unsupported processor type !
166#endif
diff --git a/arch/powerpc/oprofile/cell/spu_task_sync.c b/arch/powerpc/oprofile/cell/spu_task_sync.c
index 2949126d28d1..6b793aeda72e 100644
--- a/arch/powerpc/oprofile/cell/spu_task_sync.c
+++ b/arch/powerpc/oprofile/cell/spu_task_sync.c
@@ -297,7 +297,7 @@ static inline unsigned long fast_get_dcookie(struct path *path)
297{ 297{
298 unsigned long cookie; 298 unsigned long cookie;
299 299
300 if (path->dentry->d_cookie) 300 if (path->dentry->d_flags & DCACHE_COOKIE)
301 return (unsigned long)path->dentry; 301 return (unsigned long)path->dentry;
302 get_dcookie(path, &cookie); 302 get_dcookie(path, &cookie);
303 return cookie; 303 return cookie;
diff --git a/arch/powerpc/platforms/40x/ep405.c b/arch/powerpc/platforms/40x/ep405.c
index ae2e7f67c18e..4058fd1e7fc7 100644
--- a/arch/powerpc/platforms/40x/ep405.c
+++ b/arch/powerpc/platforms/40x/ep405.c
@@ -100,7 +100,7 @@ static void __init ep405_setup_arch(void)
100 /* Find & init the BCSR CPLD */ 100 /* Find & init the BCSR CPLD */
101 ep405_init_bcsr(); 101 ep405_init_bcsr();
102 102
103 ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC; 103 ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC);
104} 104}
105 105
106static int __init ep405_probe(void) 106static int __init ep405_probe(void)
diff --git a/arch/powerpc/platforms/40x/kilauea.c b/arch/powerpc/platforms/40x/kilauea.c
index 1dd24ffc0dc1..fd7d934dac8b 100644
--- a/arch/powerpc/platforms/40x/kilauea.c
+++ b/arch/powerpc/platforms/40x/kilauea.c
@@ -44,7 +44,7 @@ static int __init kilauea_probe(void)
44 if (!of_flat_dt_is_compatible(root, "amcc,kilauea")) 44 if (!of_flat_dt_is_compatible(root, "amcc,kilauea"))
45 return 0; 45 return 0;
46 46
47 ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC; 47 ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC);
48 48
49 return 1; 49 return 1;
50} 50}
diff --git a/arch/powerpc/platforms/40x/ppc40x_simple.c b/arch/powerpc/platforms/40x/ppc40x_simple.c
index 4498a86b46c3..f40ac9b8f99f 100644
--- a/arch/powerpc/platforms/40x/ppc40x_simple.c
+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
@@ -61,7 +61,7 @@ static int __init ppc40x_probe(void)
61 61
62 for (i = 0; i < ARRAY_SIZE(board); i++) { 62 for (i = 0; i < ARRAY_SIZE(board); i++) {
63 if (of_flat_dt_is_compatible(root, board[i])) { 63 if (of_flat_dt_is_compatible(root, board[i])) {
64 ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC; 64 ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC);
65 return 1; 65 return 1;
66 } 66 }
67 } 67 }
diff --git a/arch/powerpc/platforms/44x/ebony.c b/arch/powerpc/platforms/44x/ebony.c
index a0e8fe4662f6..88b9117fa691 100644
--- a/arch/powerpc/platforms/44x/ebony.c
+++ b/arch/powerpc/platforms/44x/ebony.c
@@ -54,7 +54,7 @@ static int __init ebony_probe(void)
54 if (!of_flat_dt_is_compatible(root, "ibm,ebony")) 54 if (!of_flat_dt_is_compatible(root, "ibm,ebony"))
55 return 0; 55 return 0;
56 56
57 ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC; 57 ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC);
58 58
59 return 1; 59 return 1;
60} 60}
diff --git a/arch/powerpc/platforms/44x/ppc44x_simple.c b/arch/powerpc/platforms/44x/ppc44x_simple.c
index 29671262801f..76fdc51dac8b 100644
--- a/arch/powerpc/platforms/44x/ppc44x_simple.c
+++ b/arch/powerpc/platforms/44x/ppc44x_simple.c
@@ -69,7 +69,7 @@ static int __init ppc44x_probe(void)
69 69
70 for (i = 0; i < ARRAY_SIZE(board); i++) { 70 for (i = 0; i < ARRAY_SIZE(board); i++) {
71 if (of_flat_dt_is_compatible(root, board[i])) { 71 if (of_flat_dt_is_compatible(root, board[i])) {
72 ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC; 72 ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC);
73 return 1; 73 return 1;
74 } 74 }
75 } 75 }
diff --git a/arch/powerpc/platforms/44x/sam440ep.c b/arch/powerpc/platforms/44x/sam440ep.c
index 47f10e647735..a78e8eb6da41 100644
--- a/arch/powerpc/platforms/44x/sam440ep.c
+++ b/arch/powerpc/platforms/44x/sam440ep.c
@@ -51,7 +51,7 @@ static int __init sam440ep_probe(void)
51 if (!of_flat_dt_is_compatible(root, "acube,sam440ep")) 51 if (!of_flat_dt_is_compatible(root, "acube,sam440ep"))
52 return 0; 52 return 0;
53 53
54 ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC; 54 ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC);
55 55
56 return 1; 56 return 1;
57} 57}
diff --git a/arch/powerpc/platforms/52xx/lite5200_pm.c b/arch/powerpc/platforms/52xx/lite5200_pm.c
index fe92e65103ed..b5c753db125e 100644
--- a/arch/powerpc/platforms/52xx/lite5200_pm.c
+++ b/arch/powerpc/platforms/52xx/lite5200_pm.c
@@ -3,7 +3,6 @@
3#include <asm/io.h> 3#include <asm/io.h>
4#include <asm/time.h> 4#include <asm/time.h>
5#include <asm/mpc52xx.h> 5#include <asm/mpc52xx.h>
6#include "mpc52xx_pic.h"
7 6
8/* defined in lite5200_sleep.S and only used here */ 7/* defined in lite5200_sleep.S and only used here */
9extern void lite5200_low_power(void __iomem *sram, void __iomem *mbar); 8extern void lite5200_low_power(void __iomem *sram, void __iomem *mbar);
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pci.c b/arch/powerpc/platforms/52xx/mpc52xx_pci.c
index b49a18527661..c3f2c21024e3 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pci.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pci.c
@@ -375,7 +375,7 @@ mpc52xx_add_bridge(struct device_node *node)
375 375
376 pr_debug("Adding MPC52xx PCI host bridge %s\n", node->full_name); 376 pr_debug("Adding MPC52xx PCI host bridge %s\n", node->full_name);
377 377
378 ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; 378 ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS);
379 379
380 if (of_address_to_resource(node, 0, &rsrc) != 0) { 380 if (of_address_to_resource(node, 0, &rsrc) != 0) {
381 printk(KERN_ERR "Can't get %s resources\n", node->full_name); 381 printk(KERN_ERR "Can't get %s resources\n", node->full_name);
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
index 8479394e9ab4..72865e8e4b51 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
@@ -2,20 +2,100 @@
2 * 2 *
3 * Programmable Interrupt Controller functions for the Freescale MPC52xx. 3 * Programmable Interrupt Controller functions for the Freescale MPC52xx.
4 * 4 *
5 * Copyright (C) 2008 Secret Lab Technologies Ltd.
5 * Copyright (C) 2006 bplan GmbH 6 * Copyright (C) 2006 bplan GmbH
7 * Copyright (C) 2004 Sylvain Munaut <tnt@246tNt.com>
8 * Copyright (C) 2003 Montavista Software, Inc
6 * 9 *
7 * Based on the code from the 2.4 kernel by 10 * Based on the code from the 2.4 kernel by
8 * Dale Farnsworth <dfarnsworth@mvista.com> and Kent Borg. 11 * Dale Farnsworth <dfarnsworth@mvista.com> and Kent Borg.
9 * 12 *
10 * Copyright (C) 2004 Sylvain Munaut <tnt@246tNt.com>
11 * Copyright (C) 2003 Montavista Software, Inc
12 *
13 * This file is licensed under the terms of the GNU General Public License 13 * This file is licensed under the terms of the GNU General Public License
14 * version 2. This program is licensed "as is" without any warranty of any 14 * version 2. This program is licensed "as is" without any warranty of any
15 * kind, whether express or implied. 15 * kind, whether express or implied.
16 * 16 *
17 */ 17 */
18 18
19/*
20 * This is the device driver for the MPC5200 interrupt controller.
21 *
22 * hardware overview
23 * -----------------
24 * The MPC5200 interrupt controller groups the all interrupt sources into
25 * three groups called 'critical', 'main', and 'peripheral'. The critical
26 * group has 3 irqs, External IRQ0, slice timer 0 irq, and wake from deep
27 * sleep. Main group include the other 3 external IRQs, slice timer 1, RTC,
28 * gpios, and the general purpose timers. Peripheral group contains the
29 * remaining irq sources from all of the on-chip peripherals (PSCs, Ethernet,
30 * USB, DMA, etc).
31 *
32 * virqs
33 * -----
34 * The Linux IRQ subsystem requires that each irq source be assigned a
35 * system wide unique IRQ number starting at 1 (0 means no irq). Since
36 * systems can have multiple interrupt controllers, the virtual IRQ (virq)
37 * infrastructure lets each interrupt controller to define a local set
38 * of IRQ numbers and the virq infrastructure maps those numbers into
39 * a unique range of the global IRQ# space.
40 *
41 * To define a range of virq numbers for this controller, this driver first
42 * assigns a number to each of the irq groups (called the level 1 or L1
43 * value). Within each group individual irq sources are also assigned a
44 * number, as defined by the MPC5200 user guide, and refers to it as the
45 * level 2 or L2 value. The virq number is determined by shifting up the
46 * L1 value by MPC52xx_IRQ_L1_OFFSET and ORing it with the L2 value.
47 *
48 * For example, the TMR0 interrupt is irq 9 in the main group. The
49 * virq for TMR0 is calculated by ((1 << MPC52xx_IRQ_L1_OFFSET) | 9).
50 *
51 * The observant reader will also notice that this driver defines a 4th
52 * interrupt group called 'bestcomm'. The bestcomm group isn't physically
53 * part of the MPC5200 interrupt controller, but it is used here to assign
54 * a separate virq number for each bestcomm task (since any of the 16
55 * bestcomm tasks can cause the bestcomm interrupt to be raised). When a
56 * bestcomm interrupt occurs (peripheral group, irq 0) this driver determines
57 * which task needs servicing and returns the irq number for that task. This
58 * allows drivers which use bestcomm to define their own interrupt handlers.
59 *
60 * irq_chip structures
61 * -------------------
62 * For actually manipulating IRQs (masking, enabling, clearing, etc) this
63 * driver defines four separate 'irq_chip' structures, one for the main
64 * group, one for the peripherals group, one for the bestcomm group and one
65 * for external interrupts. The irq_chip structures provide the hooks needed
66 * to manipulate each IRQ source, and since each group is has a separate set
67 * of registers for controlling the irq, it makes sense to divide up the
68 * hooks along those lines.
69 *
70 * You'll notice that there is not an irq_chip for the critical group and
71 * you'll also notice that there is an irq_chip defined for external
72 * interrupts even though there is no external interrupt group. The reason
73 * for this is that the four external interrupts are all managed with the same
74 * register even though one of the external IRQs is in the critical group and
75 * the other three are in the main group. For this reason it makes sense for
76 * the 4 external irqs to be managed using a separate set of hooks. The
77 * reason there is no crit irq_chip is that of the 3 irqs in the critical
78 * group, only external interrupt is actually support at this time by this
79 * driver and since external interrupt is the only one used, it can just
80 * be directed to make use of the external irq irq_chip.
81 *
82 * device tree bindings
83 * --------------------
84 * The device tree bindings for this controller reflect the two level
85 * organization of irqs in the device. #interrupt-cells = <3> where the
86 * first cell is the group number [0..3], the second cell is the irq
87 * number in the group, and the third cell is the sense type (level/edge).
88 * For reference, the following is a list of the interrupt property values
89 * associated with external interrupt sources on the MPC5200 (just because
90 * it is non-obvious to determine what the interrupts property should be
91 * when reading the mpc5200 manual and it is a frequently asked question).
92 *
93 * External interrupts:
94 * <0 0 n> external irq0, n is sense (n=0: level high,
95 * <1 1 n> external irq1, n is sense n=1: edge rising,
96 * <1 2 n> external irq2, n is sense n=2: edge falling,
97 * <1 3 n> external irq3, n is sense n=3: level low)
98 */
19#undef DEBUG 99#undef DEBUG
20 100
21#include <linux/interrupt.h> 101#include <linux/interrupt.h>
@@ -24,11 +104,19 @@
24#include <asm/io.h> 104#include <asm/io.h>
25#include <asm/prom.h> 105#include <asm/prom.h>
26#include <asm/mpc52xx.h> 106#include <asm/mpc52xx.h>
27#include "mpc52xx_pic.h"
28 107
29/* 108/* HW IRQ mapping */
30 * 109#define MPC52xx_IRQ_L1_CRIT (0)
31*/ 110#define MPC52xx_IRQ_L1_MAIN (1)
111#define MPC52xx_IRQ_L1_PERP (2)
112#define MPC52xx_IRQ_L1_SDMA (3)
113
114#define MPC52xx_IRQ_L1_OFFSET (6)
115#define MPC52xx_IRQ_L1_MASK (0x00c0)
116#define MPC52xx_IRQ_L2_MASK (0x003f)
117
118#define MPC52xx_IRQ_HIGHTESTHWIRQ (0xd0)
119
32 120
33/* MPC5200 device tree match tables */ 121/* MPC5200 device tree match tables */
34static struct of_device_id mpc52xx_pic_ids[] __initdata = { 122static struct of_device_id mpc52xx_pic_ids[] __initdata = {
@@ -53,10 +141,7 @@ static unsigned char mpc52xx_map_senses[4] = {
53 IRQ_TYPE_LEVEL_LOW, 141 IRQ_TYPE_LEVEL_LOW,
54}; 142};
55 143
56/* 144/* Utility functions */
57 *
58*/
59
60static inline void io_be_setbit(u32 __iomem *addr, int bitno) 145static inline void io_be_setbit(u32 __iomem *addr, int bitno)
61{ 146{
62 out_be32(addr, in_be32(addr) | (1 << bitno)); 147 out_be32(addr, in_be32(addr) | (1 << bitno));
@@ -69,15 +154,14 @@ static inline void io_be_clrbit(u32 __iomem *addr, int bitno)
69 154
70/* 155/*
71 * IRQ[0-3] interrupt irq_chip 156 * IRQ[0-3] interrupt irq_chip
72*/ 157 */
73
74static void mpc52xx_extirq_mask(unsigned int virq) 158static void mpc52xx_extirq_mask(unsigned int virq)
75{ 159{
76 int irq; 160 int irq;
77 int l2irq; 161 int l2irq;
78 162
79 irq = irq_map[virq].hwirq; 163 irq = irq_map[virq].hwirq;
80 l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET; 164 l2irq = irq & MPC52xx_IRQ_L2_MASK;
81 165
82 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq); 166 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
83 167
@@ -90,7 +174,7 @@ static void mpc52xx_extirq_unmask(unsigned int virq)
90 int l2irq; 174 int l2irq;
91 175
92 irq = irq_map[virq].hwirq; 176 irq = irq_map[virq].hwirq;
93 l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET; 177 l2irq = irq & MPC52xx_IRQ_L2_MASK;
94 178
95 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq); 179 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
96 180
@@ -103,7 +187,7 @@ static void mpc52xx_extirq_ack(unsigned int virq)
103 int l2irq; 187 int l2irq;
104 188
105 irq = irq_map[virq].hwirq; 189 irq = irq_map[virq].hwirq;
106 l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET; 190 l2irq = irq & MPC52xx_IRQ_L2_MASK;
107 191
108 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq); 192 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
109 193
@@ -117,7 +201,7 @@ static int mpc52xx_extirq_set_type(unsigned int virq, unsigned int flow_type)
117 int l2irq; 201 int l2irq;
118 202
119 irq = irq_map[virq].hwirq; 203 irq = irq_map[virq].hwirq;
120 l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET; 204 l2irq = irq & MPC52xx_IRQ_L2_MASK;
121 205
122 pr_debug("%s: irq=%x. l2=%d flow_type=%d\n", __func__, irq, l2irq, flow_type); 206 pr_debug("%s: irq=%x. l2=%d flow_type=%d\n", __func__, irq, l2irq, flow_type);
123 207
@@ -156,15 +240,14 @@ static struct irq_chip mpc52xx_extirq_irqchip = {
156 240
157/* 241/*
158 * Main interrupt irq_chip 242 * Main interrupt irq_chip
159*/ 243 */
160
161static void mpc52xx_main_mask(unsigned int virq) 244static void mpc52xx_main_mask(unsigned int virq)
162{ 245{
163 int irq; 246 int irq;
164 int l2irq; 247 int l2irq;
165 248
166 irq = irq_map[virq].hwirq; 249 irq = irq_map[virq].hwirq;
167 l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET; 250 l2irq = irq & MPC52xx_IRQ_L2_MASK;
168 251
169 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq); 252 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
170 253
@@ -177,7 +260,7 @@ static void mpc52xx_main_unmask(unsigned int virq)
177 int l2irq; 260 int l2irq;
178 261
179 irq = irq_map[virq].hwirq; 262 irq = irq_map[virq].hwirq;
180 l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET; 263 l2irq = irq & MPC52xx_IRQ_L2_MASK;
181 264
182 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq); 265 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
183 266
@@ -193,15 +276,14 @@ static struct irq_chip mpc52xx_main_irqchip = {
193 276
194/* 277/*
195 * Peripherals interrupt irq_chip 278 * Peripherals interrupt irq_chip
196*/ 279 */
197
198static void mpc52xx_periph_mask(unsigned int virq) 280static void mpc52xx_periph_mask(unsigned int virq)
199{ 281{
200 int irq; 282 int irq;
201 int l2irq; 283 int l2irq;
202 284
203 irq = irq_map[virq].hwirq; 285 irq = irq_map[virq].hwirq;
204 l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET; 286 l2irq = irq & MPC52xx_IRQ_L2_MASK;
205 287
206 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq); 288 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
207 289
@@ -214,7 +296,7 @@ static void mpc52xx_periph_unmask(unsigned int virq)
214 int l2irq; 296 int l2irq;
215 297
216 irq = irq_map[virq].hwirq; 298 irq = irq_map[virq].hwirq;
217 l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET; 299 l2irq = irq & MPC52xx_IRQ_L2_MASK;
218 300
219 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq); 301 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
220 302
@@ -230,15 +312,14 @@ static struct irq_chip mpc52xx_periph_irqchip = {
230 312
231/* 313/*
232 * SDMA interrupt irq_chip 314 * SDMA interrupt irq_chip
233*/ 315 */
234
235static void mpc52xx_sdma_mask(unsigned int virq) 316static void mpc52xx_sdma_mask(unsigned int virq)
236{ 317{
237 int irq; 318 int irq;
238 int l2irq; 319 int l2irq;
239 320
240 irq = irq_map[virq].hwirq; 321 irq = irq_map[virq].hwirq;
241 l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET; 322 l2irq = irq & MPC52xx_IRQ_L2_MASK;
242 323
243 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq); 324 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
244 325
@@ -251,7 +332,7 @@ static void mpc52xx_sdma_unmask(unsigned int virq)
251 int l2irq; 332 int l2irq;
252 333
253 irq = irq_map[virq].hwirq; 334 irq = irq_map[virq].hwirq;
254 l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET; 335 l2irq = irq & MPC52xx_IRQ_L2_MASK;
255 336
256 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq); 337 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
257 338
@@ -264,7 +345,7 @@ static void mpc52xx_sdma_ack(unsigned int virq)
264 int l2irq; 345 int l2irq;
265 346
266 irq = irq_map[virq].hwirq; 347 irq = irq_map[virq].hwirq;
267 l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET; 348 l2irq = irq & MPC52xx_IRQ_L2_MASK;
268 349
269 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq); 350 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
270 351
@@ -278,13 +359,12 @@ static struct irq_chip mpc52xx_sdma_irqchip = {
278 .ack = mpc52xx_sdma_ack, 359 .ack = mpc52xx_sdma_ack,
279}; 360};
280 361
281/* 362/**
282 * irq_host 363 * mpc52xx_irqhost_xlate - translate virq# from device tree interrupts property
283*/ 364 */
284
285static int mpc52xx_irqhost_xlate(struct irq_host *h, struct device_node *ct, 365static int mpc52xx_irqhost_xlate(struct irq_host *h, struct device_node *ct,
286 u32 * intspec, unsigned int intsize, 366 u32 *intspec, unsigned int intsize,
287 irq_hw_number_t * out_hwirq, 367 irq_hw_number_t *out_hwirq,
288 unsigned int *out_flags) 368 unsigned int *out_flags)
289{ 369{
290 int intrvect_l1; 370 int intrvect_l1;
@@ -299,10 +379,9 @@ static int mpc52xx_irqhost_xlate(struct irq_host *h, struct device_node *ct,
299 intrvect_l2 = (int)intspec[1]; 379 intrvect_l2 = (int)intspec[1];
300 intrvect_type = (int)intspec[2]; 380 intrvect_type = (int)intspec[2];
301 381
302 intrvect_linux = 382 intrvect_linux = (intrvect_l1 << MPC52xx_IRQ_L1_OFFSET) &
303 (intrvect_l1 << MPC52xx_IRQ_L1_OFFSET) & MPC52xx_IRQ_L1_MASK; 383 MPC52xx_IRQ_L1_MASK;
304 intrvect_linux |= 384 intrvect_linux |= intrvect_l2 & MPC52xx_IRQ_L2_MASK;
305 (intrvect_l2 << MPC52xx_IRQ_L2_OFFSET) & MPC52xx_IRQ_L2_MASK;
306 385
307 pr_debug("return %x, l1=%d, l2=%d\n", intrvect_linux, intrvect_l1, 386 pr_debug("return %x, l1=%d, l2=%d\n", intrvect_linux, intrvect_l1,
308 intrvect_l2); 387 intrvect_l2);
@@ -313,11 +392,11 @@ static int mpc52xx_irqhost_xlate(struct irq_host *h, struct device_node *ct,
313 return 0; 392 return 0;
314} 393}
315 394
316/* 395/**
317 * this function retrieves the correct IRQ type out 396 * mpc52xx_irqx_gettype - determine the IRQ sense type (level/edge)
318 * of the MPC regs 397 *
319 * Only externals IRQs needs this 398 * Only external IRQs need this.
320*/ 399 */
321static int mpc52xx_irqx_gettype(int irq) 400static int mpc52xx_irqx_gettype(int irq)
322{ 401{
323 int type; 402 int type;
@@ -329,6 +408,9 @@ static int mpc52xx_irqx_gettype(int irq)
329 return mpc52xx_map_senses[type]; 408 return mpc52xx_map_senses[type];
330} 409}
331 410
411/**
412 * mpc52xx_irqhost_map - Hook to map from virq to an irq_chip structure
413 */
332static int mpc52xx_irqhost_map(struct irq_host *h, unsigned int virq, 414static int mpc52xx_irqhost_map(struct irq_host *h, unsigned int virq,
333 irq_hw_number_t irq) 415 irq_hw_number_t irq)
334{ 416{
@@ -339,7 +421,7 @@ static int mpc52xx_irqhost_map(struct irq_host *h, unsigned int virq,
339 int type; 421 int type;
340 422
341 l1irq = (irq & MPC52xx_IRQ_L1_MASK) >> MPC52xx_IRQ_L1_OFFSET; 423 l1irq = (irq & MPC52xx_IRQ_L1_MASK) >> MPC52xx_IRQ_L1_OFFSET;
342 l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET; 424 l2irq = irq & MPC52xx_IRQ_L2_MASK;
343 425
344 /* 426 /*
345 * Most of ours IRQs will be level low 427 * Most of ours IRQs will be level low
@@ -379,8 +461,7 @@ static int mpc52xx_irqhost_map(struct irq_host *h, unsigned int virq,
379 break; 461 break;
380 462
381 default: 463 default:
382 pr_debug("%s: Error, unknown L1 IRQ (0x%x)\n", __func__, l1irq); 464 pr_err("%s: invalid virq requested (0x%x)\n", __func__, virq);
383 printk(KERN_ERR "Unknow IRQ!\n");
384 return -EINVAL; 465 return -EINVAL;
385 } 466 }
386 467
@@ -406,10 +487,15 @@ static struct irq_host_ops mpc52xx_irqhost_ops = {
406 .map = mpc52xx_irqhost_map, 487 .map = mpc52xx_irqhost_map,
407}; 488};
408 489
409/* 490/**
410 * init (public) 491 * mpc52xx_init_irq - Initialize and register with the virq subsystem
411*/ 492 *
412 493 * Hook for setting up IRQs on an mpc5200 system. A pointer to this function
494 * is to be put into the machine definition structure.
495 *
496 * This function searches the device tree for an MPC5200 interrupt controller,
497 * initializes it, and registers it with the virq subsystem.
498 */
413void __init mpc52xx_init_irq(void) 499void __init mpc52xx_init_irq(void)
414{ 500{
415 u32 intr_ctrl; 501 u32 intr_ctrl;
@@ -454,7 +540,6 @@ void __init mpc52xx_init_irq(void)
454 * As last step, add an irq host to translate the real 540 * As last step, add an irq host to translate the real
455 * hw irq information provided by the ofw to linux virq 541 * hw irq information provided by the ofw to linux virq
456 */ 542 */
457
458 mpc52xx_irqhost = irq_alloc_host(picnode, IRQ_HOST_MAP_LINEAR, 543 mpc52xx_irqhost = irq_alloc_host(picnode, IRQ_HOST_MAP_LINEAR,
459 MPC52xx_IRQ_HIGHTESTHWIRQ, 544 MPC52xx_IRQ_HIGHTESTHWIRQ,
460 &mpc52xx_irqhost_ops, -1); 545 &mpc52xx_irqhost_ops, -1);
@@ -462,12 +547,38 @@ void __init mpc52xx_init_irq(void)
462 if (!mpc52xx_irqhost) 547 if (!mpc52xx_irqhost)
463 panic(__FILE__ ": Cannot allocate the IRQ host\n"); 548 panic(__FILE__ ": Cannot allocate the IRQ host\n");
464 549
465 printk(KERN_INFO "MPC52xx PIC is up and running!\n"); 550 irq_set_default_host(mpc52xx_irqhost);
551
552 pr_info("MPC52xx PIC is up and running!\n");
466} 553}
467 554
468/* 555/**
469 * get_irq (public) 556 * mpc52xx_get_irq - Get pending interrupt number hook function
470*/ 557 *
558 * Called by the interupt handler to determine what IRQ handler needs to be
559 * executed.
560 *
561 * Status of pending interrupts is determined by reading the encoded status
562 * register. The encoded status register has three fields; one for each of the
563 * types of interrupts defined by the controller - 'critical', 'main' and
564 * 'peripheral'. This function reads the status register and returns the IRQ
565 * number associated with the highest priority pending interrupt. 'Critical'
566 * interrupts have the highest priority, followed by 'main' interrupts, and
567 * then 'peripheral'.
568 *
569 * The mpc5200 interrupt controller can be configured to boost the priority
570 * of individual 'peripheral' interrupts. If this is the case then a special
571 * value will appear in either the crit or main fields indicating a high
572 * or medium priority peripheral irq has occurred.
573 *
574 * This function checks each of the 3 irq request fields and returns the
575 * first pending interrupt that it finds.
576 *
577 * This function also identifies a 4th type of interrupt; 'bestcomm'. Each
578 * bestcomm DMA task can raise the bestcomm peripheral interrupt. When this
579 * occurs at task-specific IRQ# is decoded so that each task can have its
580 * own IRQ handler.
581 */
471unsigned int mpc52xx_get_irq(void) 582unsigned int mpc52xx_get_irq(void)
472{ 583{
473 u32 status; 584 u32 status;
@@ -478,25 +589,21 @@ unsigned int mpc52xx_get_irq(void)
478 irq = (status >> 8) & 0x3; 589 irq = (status >> 8) & 0x3;
479 if (irq == 2) /* high priority peripheral */ 590 if (irq == 2) /* high priority peripheral */
480 goto peripheral; 591 goto peripheral;
481 irq |= (MPC52xx_IRQ_L1_CRIT << MPC52xx_IRQ_L1_OFFSET) & 592 irq |= (MPC52xx_IRQ_L1_CRIT << MPC52xx_IRQ_L1_OFFSET);
482 MPC52xx_IRQ_L1_MASK;
483 } else if (status & 0x00200000) { /* main */ 593 } else if (status & 0x00200000) { /* main */
484 irq = (status >> 16) & 0x1f; 594 irq = (status >> 16) & 0x1f;
485 if (irq == 4) /* low priority peripheral */ 595 if (irq == 4) /* low priority peripheral */
486 goto peripheral; 596 goto peripheral;
487 irq |= (MPC52xx_IRQ_L1_MAIN << MPC52xx_IRQ_L1_OFFSET) & 597 irq |= (MPC52xx_IRQ_L1_MAIN << MPC52xx_IRQ_L1_OFFSET);
488 MPC52xx_IRQ_L1_MASK;
489 } else if (status & 0x20000000) { /* peripheral */ 598 } else if (status & 0x20000000) { /* peripheral */
490 peripheral: 599 peripheral:
491 irq = (status >> 24) & 0x1f; 600 irq = (status >> 24) & 0x1f;
492 if (irq == 0) { /* bestcomm */ 601 if (irq == 0) { /* bestcomm */
493 status = in_be32(&sdma->IntPend); 602 status = in_be32(&sdma->IntPend);
494 irq = ffs(status) - 1; 603 irq = ffs(status) - 1;
495 irq |= (MPC52xx_IRQ_L1_SDMA << MPC52xx_IRQ_L1_OFFSET) & 604 irq |= (MPC52xx_IRQ_L1_SDMA << MPC52xx_IRQ_L1_OFFSET);
496 MPC52xx_IRQ_L1_MASK;
497 } else { 605 } else {
498 irq |= (MPC52xx_IRQ_L1_PERP << MPC52xx_IRQ_L1_OFFSET) & 606 irq |= (MPC52xx_IRQ_L1_PERP << MPC52xx_IRQ_L1_OFFSET);
499 MPC52xx_IRQ_L1_MASK;
500 } 607 }
501 } 608 }
502 609
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.h b/arch/powerpc/platforms/52xx/mpc52xx_pic.h
deleted file mode 100644
index 1a26bcdb3049..000000000000
--- a/arch/powerpc/platforms/52xx/mpc52xx_pic.h
+++ /dev/null
@@ -1,53 +0,0 @@
1/*
2 * Header file for Freescale MPC52xx Interrupt controller
3 *
4 * Copyright (C) 2004-2005 Sylvain Munaut <tnt@246tNt.com>
5 * Copyright (C) 2003 MontaVista, Software, Inc.
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12#ifndef __POWERPC_SYSDEV_MPC52xx_PIC_H__
13#define __POWERPC_SYSDEV_MPC52xx_PIC_H__
14
15#include <asm/types.h>
16
17
18/* HW IRQ mapping */
19#define MPC52xx_IRQ_L1_CRIT (0)
20#define MPC52xx_IRQ_L1_MAIN (1)
21#define MPC52xx_IRQ_L1_PERP (2)
22#define MPC52xx_IRQ_L1_SDMA (3)
23
24#define MPC52xx_IRQ_L1_OFFSET (6)
25#define MPC52xx_IRQ_L1_MASK (0x00c0)
26
27#define MPC52xx_IRQ_L2_OFFSET (0)
28#define MPC52xx_IRQ_L2_MASK (0x003f)
29
30#define MPC52xx_IRQ_HIGHTESTHWIRQ (0xd0)
31
32
33/* Interrupt controller Register set */
34struct mpc52xx_intr {
35 u32 per_mask; /* INTR + 0x00 */
36 u32 per_pri1; /* INTR + 0x04 */
37 u32 per_pri2; /* INTR + 0x08 */
38 u32 per_pri3; /* INTR + 0x0c */
39 u32 ctrl; /* INTR + 0x10 */
40 u32 main_mask; /* INTR + 0x14 */
41 u32 main_pri1; /* INTR + 0x18 */
42 u32 main_pri2; /* INTR + 0x1c */
43 u32 reserved1; /* INTR + 0x20 */
44 u32 enc_status; /* INTR + 0x24 */
45 u32 crit_status; /* INTR + 0x28 */
46 u32 main_status; /* INTR + 0x2c */
47 u32 per_status; /* INTR + 0x30 */
48 u32 reserved2; /* INTR + 0x34 */
49 u32 per_error; /* INTR + 0x38 */
50};
51
52#endif /* __POWERPC_SYSDEV_MPC52xx_PIC_H__ */
53
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pm.c b/arch/powerpc/platforms/52xx/mpc52xx_pm.c
index c72d3304387f..a55b0b6813ed 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pm.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pm.c
@@ -5,9 +5,6 @@
5#include <asm/cacheflush.h> 5#include <asm/cacheflush.h>
6#include <asm/mpc52xx.h> 6#include <asm/mpc52xx.h>
7 7
8#include "mpc52xx_pic.h"
9
10
11/* these are defined in mpc52xx_sleep.S, and only used here */ 8/* these are defined in mpc52xx_sleep.S, and only used here */
12extern void mpc52xx_deep_sleep(void __iomem *sram, void __iomem *sdram_regs, 9extern void mpc52xx_deep_sleep(void __iomem *sram, void __iomem *sdram_regs,
13 struct mpc52xx_cdm __iomem *, struct mpc52xx_intr __iomem*); 10 struct mpc52xx_cdm __iomem *, struct mpc52xx_intr __iomem*);
diff --git a/arch/powerpc/platforms/82xx/pq2.c b/arch/powerpc/platforms/82xx/pq2.c
index 1b75902fad64..9761a59f175f 100644
--- a/arch/powerpc/platforms/82xx/pq2.c
+++ b/arch/powerpc/platforms/82xx/pq2.c
@@ -53,7 +53,7 @@ static void __init pq2_pci_add_bridge(struct device_node *np)
53 if (of_address_to_resource(np, 0, &r) || r.end - r.start < 0x10b) 53 if (of_address_to_resource(np, 0, &r) || r.end - r.start < 0x10b)
54 goto err; 54 goto err;
55 55
56 ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; 56 ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS);
57 57
58 hose = pcibios_alloc_controller(np); 58 hose = pcibios_alloc_controller(np);
59 if (!hose) 59 if (!hose)
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index cb3054e1001d..f0798c09980f 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -1,6 +1,8 @@
1# 1#
2# Makefile for the PowerPC 85xx linux kernel. 2# Makefile for the PowerPC 85xx linux kernel.
3# 3#
4obj-$(CONFIG_SMP) += smp.o
5
4obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o 6obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o
5obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o 7obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o
6obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o 8obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 613bf8c2e30d..a8301c8ad537 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -63,6 +63,7 @@ void __init mpc85xx_ds_pic_init(void)
63 struct device_node *cascade_node = NULL; 63 struct device_node *cascade_node = NULL;
64 int cascade_irq; 64 int cascade_irq;
65#endif 65#endif
66 unsigned long root = of_get_flat_dt_root();
66 67
67 np = of_find_node_by_type(NULL, "open-pic"); 68 np = of_find_node_by_type(NULL, "open-pic");
68 if (np == NULL) { 69 if (np == NULL) {
@@ -76,11 +77,19 @@ void __init mpc85xx_ds_pic_init(void)
76 return; 77 return;
77 } 78 }
78 79
79 mpic = mpic_alloc(np, r.start, 80 if (of_flat_dt_is_compatible(root, "fsl,MPC8572DS-CAMP")) {
81 mpic = mpic_alloc(np, r.start,
82 MPIC_PRIMARY |
83 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,
84 0, 256, " OpenPIC ");
85 } else {
86 mpic = mpic_alloc(np, r.start,
80 MPIC_PRIMARY | MPIC_WANTS_RESET | 87 MPIC_PRIMARY | MPIC_WANTS_RESET |
81 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS | 88 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
82 MPIC_SINGLE_DEST_CPU, 89 MPIC_SINGLE_DEST_CPU,
83 0, 256, " OpenPIC "); 90 0, 256, " OpenPIC ");
91 }
92
84 BUG_ON(mpic == NULL); 93 BUG_ON(mpic == NULL);
85 of_node_put(np); 94 of_node_put(np);
86 95
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 2494c5155919..658a36fab3ab 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -231,7 +231,7 @@ static void __init mpc85xx_mds_setup_arch(void)
231 231
232static int __init board_fixups(void) 232static int __init board_fixups(void)
233{ 233{
234 char phy_id[BUS_ID_SIZE]; 234 char phy_id[20];
235 char *compstrs[2] = {"fsl,gianfar-mdio", "fsl,ucc-mdio"}; 235 char *compstrs[2] = {"fsl,gianfar-mdio", "fsl,ucc-mdio"};
236 struct device_node *mdio; 236 struct device_node *mdio;
237 struct resource res; 237 struct resource res;
@@ -241,13 +241,15 @@ static int __init board_fixups(void)
241 mdio = of_find_compatible_node(NULL, NULL, compstrs[i]); 241 mdio = of_find_compatible_node(NULL, NULL, compstrs[i]);
242 242
243 of_address_to_resource(mdio, 0, &res); 243 of_address_to_resource(mdio, 0, &res);
244 snprintf(phy_id, BUS_ID_SIZE, "%x:%02x", res.start, 1); 244 snprintf(phy_id, sizeof(phy_id), "%llx:%02x",
245 (unsigned long long)res.start, 1);
245 246
246 phy_register_fixup_for_id(phy_id, mpc8568_fixup_125_clock); 247 phy_register_fixup_for_id(phy_id, mpc8568_fixup_125_clock);
247 phy_register_fixup_for_id(phy_id, mpc8568_mds_phy_fixups); 248 phy_register_fixup_for_id(phy_id, mpc8568_mds_phy_fixups);
248 249
249 /* Register a workaround for errata */ 250 /* Register a workaround for errata */
250 snprintf(phy_id, BUS_ID_SIZE, "%x:%02x", res.start, 7); 251 snprintf(phy_id, sizeof(phy_id), "%llx:%02x",
252 (unsigned long long)res.start, 7);
251 phy_register_fixup_for_id(phy_id, mpc8568_mds_phy_fixups); 253 phy_register_fixup_for_id(phy_id, mpc8568_mds_phy_fixups);
252 254
253 of_node_put(mdio); 255 of_node_put(mdio);
diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
new file mode 100644
index 000000000000..d652c713f496
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -0,0 +1,104 @@
1/*
2 * Author: Andy Fleming <afleming@freescale.com>
3 * Kumar Gala <galak@kernel.crashing.org>
4 *
5 * Copyright 2006-2008 Freescale Semiconductor Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#include <linux/stddef.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/delay.h>
17#include <linux/of.h>
18
19#include <asm/machdep.h>
20#include <asm/pgtable.h>
21#include <asm/page.h>
22#include <asm/mpic.h>
23#include <asm/cacheflush.h>
24
25#include <sysdev/fsl_soc.h>
26
27extern volatile unsigned long __secondary_hold_acknowledge;
28extern void __early_start(void);
29
30#define BOOT_ENTRY_ADDR_UPPER 0
31#define BOOT_ENTRY_ADDR_LOWER 1
32#define BOOT_ENTRY_R3_UPPER 2
33#define BOOT_ENTRY_R3_LOWER 3
34#define BOOT_ENTRY_RESV 4
35#define BOOT_ENTRY_PIR 5
36#define BOOT_ENTRY_R6_UPPER 6
37#define BOOT_ENTRY_R6_LOWER 7
38#define NUM_BOOT_ENTRY 8
39#define SIZE_BOOT_ENTRY (NUM_BOOT_ENTRY * sizeof(u32))
40
41static void __init
42smp_85xx_kick_cpu(int nr)
43{
44 unsigned long flags;
45 const u64 *cpu_rel_addr;
46 __iomem u32 *bptr_vaddr;
47 struct device_node *np;
48 int n = 0;
49
50 WARN_ON (nr < 0 || nr >= NR_CPUS);
51
52 pr_debug("smp_85xx_kick_cpu: kick CPU #%d\n", nr);
53
54 local_irq_save(flags);
55
56 np = of_get_cpu_node(nr, NULL);
57 cpu_rel_addr = of_get_property(np, "cpu-release-addr", NULL);
58
59 if (cpu_rel_addr == NULL) {
60 printk(KERN_ERR "No cpu-release-addr for cpu %d\n", nr);
61 return;
62 }
63
64 /* Map the spin table */
65 bptr_vaddr = ioremap(*cpu_rel_addr, SIZE_BOOT_ENTRY);
66
67 out_be32(bptr_vaddr + BOOT_ENTRY_PIR, nr);
68 out_be32(bptr_vaddr + BOOT_ENTRY_ADDR_LOWER, __pa(__early_start));
69
70 /* Wait a bit for the CPU to ack. */
71 while ((__secondary_hold_acknowledge != nr) && (++n < 1000))
72 mdelay(1);
73
74 iounmap(bptr_vaddr);
75
76 local_irq_restore(flags);
77
78 pr_debug("waited %d msecs for CPU #%d.\n", n, nr);
79}
80
81static void __init
82smp_85xx_setup_cpu(int cpu_nr)
83{
84 mpic_setup_this_cpu();
85
86 /* Clear any pending timer interrupts */
87 mtspr(SPRN_TSR, TSR_ENW | TSR_WIS | TSR_DIS | TSR_FIS);
88
89 /* Enable decrementer interrupt */
90 mtspr(SPRN_TCR, TCR_DIE);
91}
92
93struct smp_ops_t smp_85xx_ops = {
94 .message_pass = smp_mpic_message_pass,
95 .probe = smp_mpic_probe,
96 .kick_cpu = smp_85xx_kick_cpu,
97 .setup_cpu = smp_85xx_setup_cpu,
98};
99
100void __init
101mpc85xx_smp_init(void)
102{
103 smp_ops = &smp_85xx_ops;
104}
diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig
index 77dd797a2580..8e5693935975 100644
--- a/arch/powerpc/platforms/86xx/Kconfig
+++ b/arch/powerpc/platforms/86xx/Kconfig
@@ -34,6 +34,8 @@ config MPC8610_HPCD
34config GEF_SBC610 34config GEF_SBC610
35 bool "GE Fanuc SBC610" 35 bool "GE Fanuc SBC610"
36 select DEFAULT_UIMAGE 36 select DEFAULT_UIMAGE
37 select GENERIC_GPIO
38 select ARCH_REQUIRE_GPIOLIB
37 select HAS_RAPIDIO 39 select HAS_RAPIDIO
38 help 40 help
39 This option enables support for GE Fanuc's SBC610. 41 This option enables support for GE Fanuc's SBC610.
diff --git a/arch/powerpc/platforms/86xx/Makefile b/arch/powerpc/platforms/86xx/Makefile
index 4a56ff619afd..31e540c2ebbc 100644
--- a/arch/powerpc/platforms/86xx/Makefile
+++ b/arch/powerpc/platforms/86xx/Makefile
@@ -7,4 +7,5 @@ obj-$(CONFIG_SMP) += mpc86xx_smp.o
7obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o 7obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o
8obj-$(CONFIG_SBC8641D) += sbc8641d.o 8obj-$(CONFIG_SBC8641D) += sbc8641d.o
9obj-$(CONFIG_MPC8610_HPCD) += mpc8610_hpcd.o 9obj-$(CONFIG_MPC8610_HPCD) += mpc8610_hpcd.o
10obj-$(CONFIG_GEF_SBC610) += gef_sbc610.o gef_pic.o 10gef-gpio-$(CONFIG_GPIOLIB) += gef_gpio.o
11obj-$(CONFIG_GEF_SBC610) += gef_sbc610.o gef_pic.o $(gef-gpio-y)
diff --git a/arch/powerpc/platforms/86xx/gef_gpio.c b/arch/powerpc/platforms/86xx/gef_gpio.c
new file mode 100644
index 000000000000..85b2800f4cb7
--- /dev/null
+++ b/arch/powerpc/platforms/86xx/gef_gpio.c
@@ -0,0 +1,143 @@
1/*
2 * Driver for GE Fanuc's FPGA based GPIO pins
3 *
4 * Author: Martyn Welch <martyn.welch@gefanuc.com>
5 *
6 * 2008 (c) GE Fanuc Intelligent Platforms Embedded Systems, Inc.
7 *
8 * This file is licensed under the terms of the GNU General Public License
9 * version 2. This program is licensed "as is" without any warranty of any
10 * kind, whether express or implied.
11 */
12
13/* TODO
14 *
15 * Configuration of output modes (totem-pole/open-drain)
16 * Interrupt configuration - interrupts are always generated the FPGA relies on
17 * the I/O interrupt controllers mask to stop them propergating
18 */
19
20#include <linux/kernel.h>
21#include <linux/compiler.h>
22#include <linux/init.h>
23#include <linux/io.h>
24#include <linux/of.h>
25#include <linux/of_device.h>
26#include <linux/of_platform.h>
27#include <linux/of_gpio.h>
28#include <linux/gpio.h>
29
30#define GEF_GPIO_DIRECT 0x00
31#define GEF_GPIO_IN 0x04
32#define GEF_GPIO_OUT 0x08
33#define GEF_GPIO_TRIG 0x0C
34#define GEF_GPIO_POLAR_A 0x10
35#define GEF_GPIO_POLAR_B 0x14
36#define GEF_GPIO_INT_STAT 0x18
37#define GEF_GPIO_OVERRUN 0x1C
38#define GEF_GPIO_MODE 0x20
39
40#define NUM_GPIO 19
41
42static void _gef_gpio_set(void __iomem *reg, unsigned int offset, int value)
43{
44 unsigned int data;
45
46 data = ioread32be(reg);
47 /* value: 0=low; 1=high */
48 if (value & 0x1)
49 data = data | (0x1 << offset);
50 else
51 data = data & ~(0x1 << offset);
52
53 iowrite32be(data, reg);
54}
55
56
57static int gef_gpio_dir_in(struct gpio_chip *chip, unsigned offset)
58{
59 unsigned int data;
60 struct of_mm_gpio_chip *mmchip = to_of_mm_gpio_chip(chip);
61
62 data = ioread32be(mmchip->regs + GEF_GPIO_DIRECT);
63 data = data | (0x1 << offset);
64 iowrite32be(data, mmchip->regs + GEF_GPIO_DIRECT);
65
66 return 0;
67}
68
69static int gef_gpio_dir_out(struct gpio_chip *chip, unsigned offset, int value)
70{
71 unsigned int data;
72 struct of_mm_gpio_chip *mmchip = to_of_mm_gpio_chip(chip);
73
74 /* Set direction before switching to input */
75 _gef_gpio_set(mmchip->regs + GEF_GPIO_OUT, offset, value);
76
77 data = ioread32be(mmchip->regs + GEF_GPIO_DIRECT);
78 data = data & ~(0x1 << offset);
79 iowrite32be(data, mmchip->regs + GEF_GPIO_DIRECT);
80
81 return 0;
82}
83
84static int gef_gpio_get(struct gpio_chip *chip, unsigned offset)
85{
86 unsigned int data;
87 int state = 0;
88 struct of_mm_gpio_chip *mmchip = to_of_mm_gpio_chip(chip);
89
90 data = ioread32be(mmchip->regs + GEF_GPIO_IN);
91 state = (int)((data >> offset) & 0x1);
92
93 return state;
94}
95
96static void gef_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
97{
98 struct of_mm_gpio_chip *mmchip = to_of_mm_gpio_chip(chip);
99
100 _gef_gpio_set(mmchip->regs + GEF_GPIO_OUT, offset, value);
101}
102
103static int __init gef_gpio_init(void)
104{
105 struct device_node *np;
106
107 for_each_compatible_node(np, NULL, "gef,sbc610-gpio") {
108 int retval;
109 struct of_mm_gpio_chip *gef_gpio_chip;
110
111 pr_debug("%s: Initialising GEF GPIO\n", np->full_name);
112
113 /* Allocate chip structure */
114 gef_gpio_chip = kzalloc(sizeof(*gef_gpio_chip), GFP_KERNEL);
115 if (!gef_gpio_chip) {
116 pr_err("%s: Unable to allocate structure\n",
117 np->full_name);
118 continue;
119 }
120
121 /* Setup pointers to chip functions */
122 gef_gpio_chip->of_gc.gpio_cells = 2;
123 gef_gpio_chip->of_gc.gc.ngpio = NUM_GPIO;
124 gef_gpio_chip->of_gc.gc.direction_input = gef_gpio_dir_in;
125 gef_gpio_chip->of_gc.gc.direction_output = gef_gpio_dir_out;
126 gef_gpio_chip->of_gc.gc.get = gef_gpio_get;
127 gef_gpio_chip->of_gc.gc.set = gef_gpio_set;
128
129 /* This function adds a memory mapped GPIO chip */
130 retval = of_mm_gpiochip_add(np, gef_gpio_chip);
131 if (retval) {
132 kfree(gef_gpio_chip);
133 pr_err("%s: Unable to add GPIO\n", np->full_name);
134 }
135 }
136
137 return 0;
138};
139arch_initcall(gef_gpio_init);
140
141MODULE_DESCRIPTION("GE Fanuc I/O FPGA GPIO driver");
142MODULE_AUTHOR("Martyn Welch <martyn.welch@gefanuc.com");
143MODULE_LICENSE("GPL");
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 548efa55c8fe..3d0c776f888d 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -195,16 +195,24 @@ config SPE
195 195
196config PPC_STD_MMU 196config PPC_STD_MMU
197 bool 197 bool
198 depends on 6xx || POWER3 || POWER4 || PPC64 198 depends on 6xx || PPC64
199 default y 199 default y
200 200
201config PPC_STD_MMU_32 201config PPC_STD_MMU_32
202 def_bool y 202 def_bool y
203 depends on PPC_STD_MMU && PPC32 203 depends on PPC_STD_MMU && PPC32
204 204
205config PPC_STD_MMU_64
206 def_bool y
207 depends on PPC_STD_MMU && PPC64
208
209config PPC_MMU_NOHASH
210 def_bool y
211 depends on !PPC_STD_MMU
212
205config PPC_MM_SLICES 213config PPC_MM_SLICES
206 bool 214 bool
207 default y if HUGETLB_PAGE || PPC_64K_PAGES 215 default y if HUGETLB_PAGE || (PPC_STD_MMU_64 && PPC_64K_PAGES)
208 default n 216 default n
209 217
210config VIRT_CPU_ACCOUNTING 218config VIRT_CPU_ACCOUNTING
diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig
index c14d7d8d96c8..5cc3279559a4 100644
--- a/arch/powerpc/platforms/cell/Kconfig
+++ b/arch/powerpc/platforms/cell/Kconfig
@@ -2,13 +2,18 @@ config PPC_CELL
2 bool 2 bool
3 default n 3 default n
4 4
5config PPC_CELL_NATIVE 5config PPC_CELL_COMMON
6 bool 6 bool
7 select PPC_CELL 7 select PPC_CELL
8 select PPC_DCR_MMIO 8 select PPC_DCR_MMIO
9 select PPC_OF_PLATFORM_PCI
10 select PPC_INDIRECT_IO 9 select PPC_INDIRECT_IO
11 select PPC_NATIVE 10 select PPC_NATIVE
11 select PPC_RTAS
12
13config PPC_CELL_NATIVE
14 bool
15 select PPC_CELL_COMMON
16 select PPC_OF_PLATFORM_PCI
12 select MPIC 17 select MPIC
13 select IBM_NEW_EMAC_EMAC4 18 select IBM_NEW_EMAC_EMAC4
14 select IBM_NEW_EMAC_RGMII 19 select IBM_NEW_EMAC_RGMII
@@ -20,7 +25,6 @@ config PPC_IBM_CELL_BLADE
20 bool "IBM Cell Blade" 25 bool "IBM Cell Blade"
21 depends on PPC_MULTIPLATFORM && PPC64 26 depends on PPC_MULTIPLATFORM && PPC64
22 select PPC_CELL_NATIVE 27 select PPC_CELL_NATIVE
23 select PPC_RTAS
24 select MMIO_NVRAM 28 select MMIO_NVRAM
25 select PPC_UDBG_16550 29 select PPC_UDBG_16550
26 select UDBG_RTAS_CONSOLE 30 select UDBG_RTAS_CONSOLE
@@ -28,16 +32,17 @@ config PPC_IBM_CELL_BLADE
28config PPC_CELLEB 32config PPC_CELLEB
29 bool "Toshiba's Cell Reference Set 'Celleb' Architecture" 33 bool "Toshiba's Cell Reference Set 'Celleb' Architecture"
30 depends on PPC_MULTIPLATFORM && PPC64 34 depends on PPC_MULTIPLATFORM && PPC64
31 select PPC_CELL
32 select PPC_CELL_NATIVE 35 select PPC_CELL_NATIVE
33 select PPC_RTAS
34 select PPC_INDIRECT_IO
35 select PPC_OF_PLATFORM_PCI
36 select HAS_TXX9_SERIAL 36 select HAS_TXX9_SERIAL
37 select PPC_UDBG_BEAT 37 select PPC_UDBG_BEAT
38 select USB_OHCI_BIG_ENDIAN_MMIO 38 select USB_OHCI_BIG_ENDIAN_MMIO
39 select USB_EHCI_BIG_ENDIAN_MMIO 39 select USB_EHCI_BIG_ENDIAN_MMIO
40 40
41config PPC_CELL_QPACE
42 bool "IBM Cell - QPACE"
43 depends on PPC_MULTIPLATFORM && PPC64
44 select PPC_CELL_COMMON
45
41menu "Cell Broadband Engine options" 46menu "Cell Broadband Engine options"
42 depends on PPC_CELL 47 depends on PPC_CELL
43 48
@@ -102,7 +107,7 @@ config PPC_IBM_CELL_POWERBUTTON
102config CBE_THERM 107config CBE_THERM
103 tristate "CBE thermal support" 108 tristate "CBE thermal support"
104 default m 109 default m
105 depends on CBE_RAS 110 depends on CBE_RAS && SPU_BASE
106 111
107config CBE_CPUFREQ 112config CBE_CPUFREQ
108 tristate "CBE frequency scaling" 113 tristate "CBE frequency scaling"
@@ -136,5 +141,5 @@ endmenu
136 141
137config OPROFILE_CELL 142config OPROFILE_CELL
138 def_bool y 143 def_bool y
139 depends on PPC_CELL_NATIVE && (OPROFILE = m || OPROFILE = y) 144 depends on PPC_CELL_NATIVE && (OPROFILE = m || OPROFILE = y) && SPU_BASE
140 145
diff --git a/arch/powerpc/platforms/cell/Makefile b/arch/powerpc/platforms/cell/Makefile
index 7fd830872c43..43eccb270301 100644
--- a/arch/powerpc/platforms/cell/Makefile
+++ b/arch/powerpc/platforms/cell/Makefile
@@ -1,7 +1,7 @@
1obj-$(CONFIG_PPC_CELL_NATIVE) += interrupt.o iommu.o setup.o \ 1obj-$(CONFIG_PPC_CELL_COMMON) += cbe_regs.o interrupt.o pervasive.o
2 cbe_regs.o spider-pic.o \ 2
3 pervasive.o pmu.o io-workarounds.o \ 3obj-$(CONFIG_PPC_CELL_NATIVE) += iommu.o setup.o spider-pic.o \
4 spider-pci.o 4 pmu.o io-workarounds.o spider-pci.o
5obj-$(CONFIG_CBE_RAS) += ras.o 5obj-$(CONFIG_CBE_RAS) += ras.o
6 6
7obj-$(CONFIG_CBE_THERM) += cbe_thermal.o 7obj-$(CONFIG_CBE_THERM) += cbe_thermal.o
@@ -14,13 +14,12 @@ obj-$(CONFIG_PPC_IBM_CELL_POWERBUTTON) += cbe_powerbutton.o
14 14
15ifeq ($(CONFIG_SMP),y) 15ifeq ($(CONFIG_SMP),y)
16obj-$(CONFIG_PPC_CELL_NATIVE) += smp.o 16obj-$(CONFIG_PPC_CELL_NATIVE) += smp.o
17obj-$(CONFIG_PPC_CELL_QPACE) += smp.o
17endif 18endif
18 19
19# needed only when building loadable spufs.ko 20# needed only when building loadable spufs.ko
20spu-priv1-$(CONFIG_PPC_CELL_NATIVE) += spu_priv1_mmio.o 21spu-priv1-$(CONFIG_PPC_CELL_COMMON) += spu_priv1_mmio.o
21 22spu-manage-$(CONFIG_PPC_CELL_COMMON) += spu_manage.o
22spu-manage-$(CONFIG_PPC_CELLEB) += spu_manage.o
23spu-manage-$(CONFIG_PPC_CELL_NATIVE) += spu_manage.o
24 23
25obj-$(CONFIG_SPU_BASE) += spu_callbacks.o spu_base.o \ 24obj-$(CONFIG_SPU_BASE) += spu_callbacks.o spu_base.o \
26 spu_notify.o \ 25 spu_notify.o \
@@ -31,6 +30,8 @@ obj-$(CONFIG_SPU_BASE) += spu_callbacks.o spu_base.o \
31 30
32obj-$(CONFIG_PCI_MSI) += axon_msi.o 31obj-$(CONFIG_PCI_MSI) += axon_msi.o
33 32
33# qpace setup
34obj-$(CONFIG_PPC_CELL_QPACE) += qpace_setup.o
34 35
35# celleb stuff 36# celleb stuff
36ifeq ($(CONFIG_PPC_CELLEB),y) 37ifeq ($(CONFIG_PPC_CELLEB),y)
diff --git a/arch/powerpc/platforms/cell/celleb_setup.c b/arch/powerpc/platforms/cell/celleb_setup.c
index b11cb30decb2..07c234f6b2b6 100644
--- a/arch/powerpc/platforms/cell/celleb_setup.c
+++ b/arch/powerpc/platforms/cell/celleb_setup.c
@@ -45,7 +45,6 @@
45#include <asm/mmu.h> 45#include <asm/mmu.h>
46#include <asm/processor.h> 46#include <asm/processor.h>
47#include <asm/io.h> 47#include <asm/io.h>
48#include <asm/kexec.h>
49#include <asm/prom.h> 48#include <asm/prom.h>
50#include <asm/machdep.h> 49#include <asm/machdep.h>
51#include <asm/cputable.h> 50#include <asm/cputable.h>
@@ -226,9 +225,6 @@ define_machine(celleb_beat) {
226 .pci_setup_phb = celleb_setup_phb, 225 .pci_setup_phb = celleb_setup_phb,
227#ifdef CONFIG_KEXEC 226#ifdef CONFIG_KEXEC
228 .kexec_cpu_down = beat_kexec_cpu_down, 227 .kexec_cpu_down = beat_kexec_cpu_down,
229 .machine_kexec = default_machine_kexec,
230 .machine_kexec_prepare = default_machine_kexec_prepare,
231 .machine_crash_shutdown = default_machine_crash_shutdown,
232#endif 228#endif
233}; 229};
234 230
@@ -248,9 +244,4 @@ define_machine(celleb_native) {
248 .pci_probe_mode = celleb_pci_probe_mode, 244 .pci_probe_mode = celleb_pci_probe_mode,
249 .pci_setup_phb = celleb_setup_phb, 245 .pci_setup_phb = celleb_setup_phb,
250 .init_IRQ = celleb_init_IRQ_native, 246 .init_IRQ = celleb_init_IRQ_native,
251#ifdef CONFIG_KEXEC
252 .machine_kexec = default_machine_kexec,
253 .machine_kexec_prepare = default_machine_kexec_prepare,
254 .machine_crash_shutdown = default_machine_crash_shutdown,
255#endif
256}; 247};
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index 3168272ab0d7..86db4dd170a0 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -1053,10 +1053,7 @@ static int __init cell_iommu_fixed_mapping_init(void)
1053 } 1053 }
1054 1054
1055 /* We must have dma-ranges properties for fixed mapping to work */ 1055 /* We must have dma-ranges properties for fixed mapping to work */
1056 for (np = NULL; (np = of_find_all_nodes(np));) { 1056 np = of_find_node_with_property(NULL, "dma-ranges");
1057 if (of_find_property(np, "dma-ranges", NULL))
1058 break;
1059 }
1060 of_node_put(np); 1057 of_node_put(np);
1061 1058
1062 if (!np) { 1059 if (!np) {
diff --git a/arch/powerpc/platforms/cell/qpace_setup.c b/arch/powerpc/platforms/cell/qpace_setup.c
new file mode 100644
index 000000000000..be84e6a16b30
--- /dev/null
+++ b/arch/powerpc/platforms/cell/qpace_setup.c
@@ -0,0 +1,152 @@
1/*
2 * linux/arch/powerpc/platforms/cell/qpace_setup.c
3 *
4 * Copyright (C) 1995 Linus Torvalds
5 * Adapted from 'alpha' version by Gary Thomas
6 * Modified by Cort Dougan (cort@cs.nmt.edu)
7 * Modified by PPC64 Team, IBM Corp
8 * Modified by Cell Team, IBM Deutschland Entwicklung GmbH
9 * Modified by Benjamin Krill <ben@codiert.org>, IBM Corp.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 */
16
17#include <linux/sched.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/delay.h>
21#include <linux/irq.h>
22#include <linux/console.h>
23#include <linux/of_platform.h>
24
25#include <asm/mmu.h>
26#include <asm/processor.h>
27#include <asm/io.h>
28#include <asm/kexec.h>
29#include <asm/pgtable.h>
30#include <asm/prom.h>
31#include <asm/rtas.h>
32#include <asm/dma.h>
33#include <asm/machdep.h>
34#include <asm/time.h>
35#include <asm/cputable.h>
36#include <asm/irq.h>
37#include <asm/spu.h>
38#include <asm/spu_priv1.h>
39#include <asm/udbg.h>
40#include <asm/cell-regs.h>
41
42#include "interrupt.h"
43#include "pervasive.h"
44#include "ras.h"
45#include "io-workarounds.h"
46
47static void qpace_show_cpuinfo(struct seq_file *m)
48{
49 struct device_node *root;
50 const char *model = "";
51
52 root = of_find_node_by_path("/");
53 if (root)
54 model = of_get_property(root, "model", NULL);
55 seq_printf(m, "machine\t\t: CHRP %s\n", model);
56 of_node_put(root);
57}
58
59static void qpace_progress(char *s, unsigned short hex)
60{
61 printk("*** %04x : %s\n", hex, s ? s : "");
62}
63
64static int __init qpace_publish_devices(void)
65{
66 int node;
67
68 /* Publish OF platform devices for southbridge IOs */
69 of_platform_bus_probe(NULL, NULL, NULL);
70
71 /* There is no device for the MIC memory controller, thus we create
72 * a platform device for it to attach the EDAC driver to.
73 */
74 for_each_online_node(node) {
75 if (cbe_get_cpu_mic_tm_regs(cbe_node_to_cpu(node)) == NULL)
76 continue;
77 platform_device_register_simple("cbe-mic", node, NULL, 0);
78 }
79
80 return 0;
81}
82machine_subsys_initcall(qpace, qpace_publish_devices);
83
84extern int qpace_notify(struct device *dev)
85{
86 /* set dma_ops for of_platform bus */
87 if (dev->bus && dev->bus->name
88 && !strcmp(dev->bus->name, "of_platform"))
89 set_dma_ops(dev, &dma_direct_ops);
90
91 return 0;
92}
93
94static void __init qpace_setup_arch(void)
95{
96#ifdef CONFIG_SPU_BASE
97 spu_priv1_ops = &spu_priv1_mmio_ops;
98 spu_management_ops = &spu_management_of_ops;
99#endif
100
101 cbe_regs_init();
102
103#ifdef CONFIG_CBE_RAS
104 cbe_ras_init();
105#endif
106
107#ifdef CONFIG_SMP
108 smp_init_cell();
109#endif
110
111 /* init to some ~sane value until calibrate_delay() runs */
112 loops_per_jiffy = 50000000;
113
114 cbe_pervasive_init();
115#ifdef CONFIG_DUMMY_CONSOLE
116 conswitchp = &dummy_con;
117#endif
118
119 /* set notifier function */
120 platform_notify = &qpace_notify;
121}
122
123static int __init qpace_probe(void)
124{
125 unsigned long root = of_get_flat_dt_root();
126
127 if (!of_flat_dt_is_compatible(root, "IBM,QPACE"))
128 return 0;
129
130 hpte_init_native();
131
132 return 1;
133}
134
135define_machine(qpace) {
136 .name = "QPACE",
137 .probe = qpace_probe,
138 .setup_arch = qpace_setup_arch,
139 .show_cpuinfo = qpace_show_cpuinfo,
140 .restart = rtas_restart,
141 .power_off = rtas_power_off,
142 .halt = rtas_halt,
143 .get_boot_time = rtas_get_boot_time,
144 .calibrate_decr = generic_calibrate_decr,
145 .progress = qpace_progress,
146 .init_IRQ = iic_init_IRQ,
147#ifdef CONFIG_KEXEC
148 .machine_kexec = default_machine_kexec,
149 .machine_kexec_prepare = default_machine_kexec_prepare,
150 .machine_crash_shutdown = default_machine_crash_shutdown,
151#endif
152};
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index ab721b50fbba..59305369f6b2 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -35,7 +35,6 @@
35#include <asm/mmu.h> 35#include <asm/mmu.h>
36#include <asm/processor.h> 36#include <asm/processor.h>
37#include <asm/io.h> 37#include <asm/io.h>
38#include <asm/kexec.h>
39#include <asm/pgtable.h> 38#include <asm/pgtable.h>
40#include <asm/prom.h> 39#include <asm/prom.h>
41#include <asm/rtas.h> 40#include <asm/rtas.h>
@@ -289,9 +288,4 @@ define_machine(cell) {
289 .progress = cell_progress, 288 .progress = cell_progress,
290 .init_IRQ = cell_init_irq, 289 .init_IRQ = cell_init_irq,
291 .pci_setup_phb = cell_setup_phb, 290 .pci_setup_phb = cell_setup_phb,
292#ifdef CONFIG_KEXEC
293 .machine_kexec = default_machine_kexec,
294 .machine_kexec_prepare = default_machine_kexec_prepare,
295 .machine_crash_shutdown = default_machine_crash_shutdown,
296#endif
297}; 291};
diff --git a/arch/powerpc/platforms/cell/spu_priv1_mmio.c b/arch/powerpc/platforms/cell/spu_priv1_mmio.c
index 906a0a2a9fe1..1410443731eb 100644
--- a/arch/powerpc/platforms/cell/spu_priv1_mmio.c
+++ b/arch/powerpc/platforms/cell/spu_priv1_mmio.c
@@ -80,10 +80,10 @@ static void cpu_affinity_set(struct spu *spu, int cpu)
80 u64 route; 80 u64 route;
81 81
82 if (nr_cpus_node(spu->node)) { 82 if (nr_cpus_node(spu->node)) {
83 cpumask_t spumask = node_to_cpumask(spu->node); 83 const struct cpumask *spumask = cpumask_of_node(spu->node),
84 cpumask_t cpumask = node_to_cpumask(cpu_to_node(cpu)); 84 *cpumask = cpumask_of_node(cpu_to_node(cpu));
85 85
86 if (!cpus_intersects(spumask, cpumask)) 86 if (!cpumask_intersects(spumask, cpumask))
87 return; 87 return;
88 } 88 }
89 89
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 1b26071a86ca..7106b63d401b 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -273,12 +273,10 @@ spufs_mem_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
273 return VM_FAULT_NOPAGE; 273 return VM_FAULT_NOPAGE;
274 274
275 if (ctx->state == SPU_STATE_SAVED) { 275 if (ctx->state == SPU_STATE_SAVED) {
276 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 276 vma->vm_page_prot = pgprot_cached(vma->vm_page_prot);
277 & ~_PAGE_NO_CACHE);
278 pfn = vmalloc_to_pfn(ctx->csa.lscsa->ls + offset); 277 pfn = vmalloc_to_pfn(ctx->csa.lscsa->ls + offset);
279 } else { 278 } else {
280 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 279 vma->vm_page_prot = pgprot_noncached_wc(vma->vm_page_prot);
281 | _PAGE_NO_CACHE);
282 pfn = (ctx->spu->local_store_phys + offset) >> PAGE_SHIFT; 280 pfn = (ctx->spu->local_store_phys + offset) >> PAGE_SHIFT;
283 } 281 }
284 vm_insert_pfn(vma, address, pfn); 282 vm_insert_pfn(vma, address, pfn);
@@ -338,8 +336,7 @@ static int spufs_mem_mmap(struct file *file, struct vm_area_struct *vma)
338 return -EINVAL; 336 return -EINVAL;
339 337
340 vma->vm_flags |= VM_IO | VM_PFNMAP; 338 vma->vm_flags |= VM_IO | VM_PFNMAP;
341 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 339 vma->vm_page_prot = pgprot_noncached_wc(vma->vm_page_prot);
342 | _PAGE_NO_CACHE);
343 340
344 vma->vm_ops = &spufs_mem_mmap_vmops; 341 vma->vm_ops = &spufs_mem_mmap_vmops;
345 return 0; 342 return 0;
@@ -452,8 +449,7 @@ static int spufs_cntl_mmap(struct file *file, struct vm_area_struct *vma)
452 return -EINVAL; 449 return -EINVAL;
453 450
454 vma->vm_flags |= VM_IO | VM_PFNMAP; 451 vma->vm_flags |= VM_IO | VM_PFNMAP;
455 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 452 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
456 | _PAGE_NO_CACHE | _PAGE_GUARDED);
457 453
458 vma->vm_ops = &spufs_cntl_mmap_vmops; 454 vma->vm_ops = &spufs_cntl_mmap_vmops;
459 return 0; 455 return 0;
@@ -1155,8 +1151,7 @@ static int spufs_signal1_mmap(struct file *file, struct vm_area_struct *vma)
1155 return -EINVAL; 1151 return -EINVAL;
1156 1152
1157 vma->vm_flags |= VM_IO | VM_PFNMAP; 1153 vma->vm_flags |= VM_IO | VM_PFNMAP;
1158 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 1154 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1159 | _PAGE_NO_CACHE | _PAGE_GUARDED);
1160 1155
1161 vma->vm_ops = &spufs_signal1_mmap_vmops; 1156 vma->vm_ops = &spufs_signal1_mmap_vmops;
1162 return 0; 1157 return 0;
@@ -1292,8 +1287,7 @@ static int spufs_signal2_mmap(struct file *file, struct vm_area_struct *vma)
1292 return -EINVAL; 1287 return -EINVAL;
1293 1288
1294 vma->vm_flags |= VM_IO | VM_PFNMAP; 1289 vma->vm_flags |= VM_IO | VM_PFNMAP;
1295 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 1290 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1296 | _PAGE_NO_CACHE | _PAGE_GUARDED);
1297 1291
1298 vma->vm_ops = &spufs_signal2_mmap_vmops; 1292 vma->vm_ops = &spufs_signal2_mmap_vmops;
1299 return 0; 1293 return 0;
@@ -1414,8 +1408,7 @@ static int spufs_mss_mmap(struct file *file, struct vm_area_struct *vma)
1414 return -EINVAL; 1408 return -EINVAL;
1415 1409
1416 vma->vm_flags |= VM_IO | VM_PFNMAP; 1410 vma->vm_flags |= VM_IO | VM_PFNMAP;
1417 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 1411 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1418 | _PAGE_NO_CACHE | _PAGE_GUARDED);
1419 1412
1420 vma->vm_ops = &spufs_mss_mmap_vmops; 1413 vma->vm_ops = &spufs_mss_mmap_vmops;
1421 return 0; 1414 return 0;
@@ -1476,8 +1469,7 @@ static int spufs_psmap_mmap(struct file *file, struct vm_area_struct *vma)
1476 return -EINVAL; 1469 return -EINVAL;
1477 1470
1478 vma->vm_flags |= VM_IO | VM_PFNMAP; 1471 vma->vm_flags |= VM_IO | VM_PFNMAP;
1479 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 1472 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1480 | _PAGE_NO_CACHE | _PAGE_GUARDED);
1481 1473
1482 vma->vm_ops = &spufs_psmap_mmap_vmops; 1474 vma->vm_ops = &spufs_psmap_mmap_vmops;
1483 return 0; 1475 return 0;
@@ -1536,8 +1528,7 @@ static int spufs_mfc_mmap(struct file *file, struct vm_area_struct *vma)
1536 return -EINVAL; 1528 return -EINVAL;
1537 1529
1538 vma->vm_flags |= VM_IO | VM_PFNMAP; 1530 vma->vm_flags |= VM_IO | VM_PFNMAP;
1539 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 1531 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1540 | _PAGE_NO_CACHE | _PAGE_GUARDED);
1541 1532
1542 vma->vm_ops = &spufs_mfc_mmap_vmops; 1533 vma->vm_ops = &spufs_mfc_mmap_vmops;
1543 return 0; 1534 return 0;
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index cb85d237e492..e309ef70a531 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -95,9 +95,8 @@ spufs_new_inode(struct super_block *sb, int mode)
95 goto out; 95 goto out;
96 96
97 inode->i_mode = mode; 97 inode->i_mode = mode;
98 inode->i_uid = current->fsuid; 98 inode->i_uid = current_fsuid();
99 inode->i_gid = current->fsgid; 99 inode->i_gid = current_fsgid();
100 inode->i_blocks = 0;
101 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 100 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
102out: 101out:
103 return inode; 102 return inode;
@@ -323,7 +322,7 @@ static int spufs_context_open(struct dentry *dentry, struct vfsmount *mnt)
323 goto out; 322 goto out;
324 } 323 }
325 324
326 filp = dentry_open(dentry, mnt, O_RDONLY); 325 filp = dentry_open(dentry, mnt, O_RDONLY, current_cred());
327 if (IS_ERR(filp)) { 326 if (IS_ERR(filp)) {
328 put_unused_fd(ret); 327 put_unused_fd(ret);
329 ret = PTR_ERR(filp); 328 ret = PTR_ERR(filp);
@@ -562,7 +561,7 @@ static int spufs_gang_open(struct dentry *dentry, struct vfsmount *mnt)
562 goto out; 561 goto out;
563 } 562 }
564 563
565 filp = dentry_open(dentry, mnt, O_RDONLY); 564 filp = dentry_open(dentry, mnt, O_RDONLY, current_cred());
566 if (IS_ERR(filp)) { 565 if (IS_ERR(filp)) {
567 put_unused_fd(ret); 566 put_unused_fd(ret);
568 ret = PTR_ERR(filp); 567 ret = PTR_ERR(filp);
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 2ad914c47493..6a0ad196aeb3 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -166,9 +166,9 @@ void spu_update_sched_info(struct spu_context *ctx)
166static int __node_allowed(struct spu_context *ctx, int node) 166static int __node_allowed(struct spu_context *ctx, int node)
167{ 167{
168 if (nr_cpus_node(node)) { 168 if (nr_cpus_node(node)) {
169 cpumask_t mask = node_to_cpumask(node); 169 const struct cpumask *mask = cpumask_of_node(node);
170 170
171 if (cpus_intersects(mask, ctx->cpus_allowed)) 171 if (cpumask_intersects(mask, &ctx->cpus_allowed))
172 return 1; 172 return 1;
173 } 173 }
174 174
diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c
index d3cde6b9d2df..f6b0c519d5a2 100644
--- a/arch/powerpc/platforms/chrp/pci.c
+++ b/arch/powerpc/platforms/chrp/pci.c
@@ -141,6 +141,7 @@ hydra_init(void)
141 of_node_put(np); 141 of_node_put(np);
142 return 0; 142 return 0;
143 } 143 }
144 of_node_put(np);
144 Hydra = ioremap(r.start, r.end-r.start); 145 Hydra = ioremap(r.start, r.end-r.start);
145 printk("Hydra Mac I/O at %llx\n", (unsigned long long)r.start); 146 printk("Hydra Mac I/O at %llx\n", (unsigned long long)r.start);
146 printk("Hydra Feature_Control was %x", 147 printk("Hydra Feature_Control was %x",
@@ -198,7 +199,7 @@ static void __init setup_peg2(struct pci_controller *hose, struct device_node *d
198 printk ("RTAS supporting Pegasos OF not found, please upgrade" 199 printk ("RTAS supporting Pegasos OF not found, please upgrade"
199 " your firmware\n"); 200 " your firmware\n");
200 } 201 }
201 ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; 202 ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS);
202 /* keep the reference to the root node */ 203 /* keep the reference to the root node */
203} 204}
204 205
diff --git a/arch/powerpc/platforms/embedded6xx/c2k.c b/arch/powerpc/platforms/embedded6xx/c2k.c
index 32ba0fa0ad03..8cab5731850f 100644
--- a/arch/powerpc/platforms/embedded6xx/c2k.c
+++ b/arch/powerpc/platforms/embedded6xx/c2k.c
@@ -20,7 +20,6 @@
20#include <linux/seq_file.h> 20#include <linux/seq_file.h>
21#include <linux/time.h> 21#include <linux/time.h>
22#include <linux/of.h> 22#include <linux/of.h>
23#include <linux/kexec.h>
24 23
25#include <asm/machdep.h> 24#include <asm/machdep.h>
26#include <asm/prom.h> 25#include <asm/prom.h>
@@ -147,9 +146,4 @@ define_machine(c2k) {
147 .get_irq = mv64x60_get_irq, 146 .get_irq = mv64x60_get_irq,
148 .restart = c2k_restart, 147 .restart = c2k_restart,
149 .calibrate_decr = generic_calibrate_decr, 148 .calibrate_decr = generic_calibrate_decr,
150#ifdef CONFIG_KEXEC
151 .machine_kexec = default_machine_kexec,
152 .machine_kexec_prepare = default_machine_kexec_prepare,
153 .machine_crash_shutdown = default_machine_crash_shutdown,
154#endif
155}; 149};
diff --git a/arch/powerpc/platforms/embedded6xx/prpmc2800.c b/arch/powerpc/platforms/embedded6xx/prpmc2800.c
index 4c485e984236..670035f49a69 100644
--- a/arch/powerpc/platforms/embedded6xx/prpmc2800.c
+++ b/arch/powerpc/platforms/embedded6xx/prpmc2800.c
@@ -19,7 +19,6 @@
19#include <asm/prom.h> 19#include <asm/prom.h>
20#include <asm/system.h> 20#include <asm/system.h>
21#include <asm/time.h> 21#include <asm/time.h>
22#include <asm/kexec.h>
23 22
24#include <mm/mmu_decl.h> 23#include <mm/mmu_decl.h>
25 24
@@ -155,9 +154,4 @@ define_machine(prpmc2800){
155 .get_irq = mv64x60_get_irq, 154 .get_irq = mv64x60_get_irq,
156 .restart = prpmc2800_restart, 155 .restart = prpmc2800_restart,
157 .calibrate_decr = generic_calibrate_decr, 156 .calibrate_decr = generic_calibrate_decr,
158#ifdef CONFIG_KEXEC
159 .machine_kexec = default_machine_kexec,
160 .machine_kexec_prepare = default_machine_kexec_prepare,
161 .machine_crash_shutdown = default_machine_crash_shutdown,
162#endif
163}; 157};
diff --git a/arch/powerpc/platforms/iseries/Kconfig b/arch/powerpc/platforms/iseries/Kconfig
index 45ffd8e542f4..ed3753d8c109 100644
--- a/arch/powerpc/platforms/iseries/Kconfig
+++ b/arch/powerpc/platforms/iseries/Kconfig
@@ -9,6 +9,7 @@ menu "iSeries device drivers"
9 9
10config VIODASD 10config VIODASD
11 tristate "iSeries Virtual I/O disk support" 11 tristate "iSeries Virtual I/O disk support"
12 depends on BLOCK
12 help 13 help
13 If you are running on an iSeries system and you want to use 14 If you are running on an iSeries system and you want to use
14 virtual disks created and managed by OS/400, say Y. 15 virtual disks created and managed by OS/400, say Y.
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index d4c61c3c9669..bfd60e4accee 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -50,7 +50,6 @@
50#include <asm/system.h> 50#include <asm/system.h>
51#include <asm/pgtable.h> 51#include <asm/pgtable.h>
52#include <asm/io.h> 52#include <asm/io.h>
53#include <asm/kexec.h>
54#include <asm/pci-bridge.h> 53#include <asm/pci-bridge.h>
55#include <asm/iommu.h> 54#include <asm/iommu.h>
56#include <asm/machdep.h> 55#include <asm/machdep.h>
@@ -335,9 +334,4 @@ define_machine(maple) {
335 .calibrate_decr = generic_calibrate_decr, 334 .calibrate_decr = generic_calibrate_decr,
336 .progress = maple_progress, 335 .progress = maple_progress,
337 .power_save = power4_idle, 336 .power_save = power4_idle,
338#ifdef CONFIG_KEXEC
339 .machine_kexec = default_machine_kexec,
340 .machine_kexec_prepare = default_machine_kexec_prepare,
341 .machine_crash_shutdown = default_machine_crash_shutdown,
342#endif
343}; 337};
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c
index 792d3ce8112e..65c585b8b00d 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_32.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_32.c
@@ -310,7 +310,7 @@ static int pmu_set_cpu_speed(int low_speed)
310 _set_L3CR(save_l3cr); 310 _set_L3CR(save_l3cr);
311 311
312 /* Restore userland MMU context */ 312 /* Restore userland MMU context */
313 set_context(current->active_mm->context.id, current->active_mm->pgd); 313 switch_mmu_context(NULL, current->active_mm);
314 314
315#ifdef DEBUG_FREQ 315#ifdef DEBUG_FREQ
316 printk(KERN_DEBUG "HID1, after: %x\n", mfspr(SPRN_HID1)); 316 printk(KERN_DEBUG "HID1, after: %x\n", mfspr(SPRN_HID1));
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index bcf50d7056e9..54b7b76ed4f0 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -729,7 +729,7 @@ static void __init setup_bandit(struct pci_controller *hose,
729static int __init setup_uninorth(struct pci_controller *hose, 729static int __init setup_uninorth(struct pci_controller *hose,
730 struct resource *addr) 730 struct resource *addr)
731{ 731{
732 ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; 732 ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS);
733 has_uninorth = 1; 733 has_uninorth = 1;
734 hose->ops = &macrisc_pci_ops; 734 hose->ops = &macrisc_pci_ops;
735 hose->cfg_addr = ioremap(addr->start + 0x800000, 0x1000); 735 hose->cfg_addr = ioremap(addr->start + 0x800000, 0x1000);
@@ -996,7 +996,7 @@ void __init pmac_pci_init(void)
996 struct device_node *np, *root; 996 struct device_node *np, *root;
997 struct device_node *ht = NULL; 997 struct device_node *ht = NULL;
998 998
999 ppc_pci_flags = PPC_PCI_CAN_SKIP_ISA_ALIGN; 999 ppc_pci_set_flags(PPC_PCI_CAN_SKIP_ISA_ALIGN);
1000 1000
1001 root = of_find_node_by_path("/"); 1001 root = of_find_node_by_path("/");
1002 if (root == NULL) { 1002 if (root == NULL) {
@@ -1055,7 +1055,7 @@ void __init pmac_pci_init(void)
1055 * some offset between bus number and domains for now when we 1055 * some offset between bus number and domains for now when we
1056 * assign all busses should help for now 1056 * assign all busses should help for now
1057 */ 1057 */
1058 if (ppc_pci_flags & PPC_PCI_REASSIGN_ALL_BUS) 1058 if (ppc_pci_has_flag(PPC_PCI_REASSIGN_ALL_BUS))
1059 pcibios_assign_bus_offset = 0x10; 1059 pcibios_assign_bus_offset = 0x10;
1060#endif 1060#endif
1061} 1061}
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 82c14d203d8b..9b78f5300c24 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -60,7 +60,6 @@
60#include <asm/system.h> 60#include <asm/system.h>
61#include <asm/pgtable.h> 61#include <asm/pgtable.h>
62#include <asm/io.h> 62#include <asm/io.h>
63#include <asm/kexec.h>
64#include <asm/pci-bridge.h> 63#include <asm/pci-bridge.h>
65#include <asm/ohare.h> 64#include <asm/ohare.h>
66#include <asm/mediabay.h> 65#include <asm/mediabay.h>
@@ -310,9 +309,7 @@ static void __init pmac_setup_arch(void)
310 } 309 }
311 310
312 /* See if newworld or oldworld */ 311 /* See if newworld or oldworld */
313 for (ic = NULL; (ic = of_find_all_nodes(ic)) != NULL; ) 312 ic = of_find_node_with_property(NULL, "interrupt-controller");
314 if (of_get_property(ic, "interrupt-controller", NULL))
315 break;
316 if (ic) { 313 if (ic) {
317 pmac_newworld = 1; 314 pmac_newworld = 1;
318 of_node_put(ic); 315 of_node_put(ic);
@@ -740,11 +737,6 @@ define_machine(powermac) {
740 .pci_probe_mode = pmac_pci_probe_mode, 737 .pci_probe_mode = pmac_pci_probe_mode,
741 .power_save = power4_idle, 738 .power_save = power4_idle,
742 .enable_pmcs = power4_enable_pmcs, 739 .enable_pmcs = power4_enable_pmcs,
743#ifdef CONFIG_KEXEC
744 .machine_kexec = default_machine_kexec,
745 .machine_kexec_prepare = default_machine_kexec_prepare,
746 .machine_crash_shutdown = default_machine_crash_shutdown,
747#endif
748#endif /* CONFIG_PPC64 */ 740#endif /* CONFIG_PPC64 */
749#ifdef CONFIG_PPC32 741#ifdef CONFIG_PPC32
750 .pcibios_enable_device_hook = pmac_pci_enable_device_hook, 742 .pcibios_enable_device_hook = pmac_pci_enable_device_hook,
diff --git a/arch/powerpc/platforms/powermac/sleep.S b/arch/powerpc/platforms/powermac/sleep.S
index adee28da353f..1c2802fabd57 100644
--- a/arch/powerpc/platforms/powermac/sleep.S
+++ b/arch/powerpc/platforms/powermac/sleep.S
@@ -17,6 +17,7 @@
17#include <asm/cache.h> 17#include <asm/cache.h>
18#include <asm/thread_info.h> 18#include <asm/thread_info.h>
19#include <asm/asm-offsets.h> 19#include <asm/asm-offsets.h>
20#include <asm/mmu.h>
20 21
21#define MAGIC 0x4c617273 /* 'Lars' */ 22#define MAGIC 0x4c617273 /* 'Lars' */
22 23
@@ -323,7 +324,7 @@ grackle_wake_up:
323 lwz r4,SL_IBAT3+4(r1) 324 lwz r4,SL_IBAT3+4(r1)
324 mtibatl 3,r4 325 mtibatl 3,r4
325 326
326BEGIN_FTR_SECTION 327BEGIN_MMU_FTR_SECTION
327 li r4,0 328 li r4,0
328 mtspr SPRN_DBAT4U,r4 329 mtspr SPRN_DBAT4U,r4
329 mtspr SPRN_DBAT4L,r4 330 mtspr SPRN_DBAT4L,r4
@@ -341,7 +342,7 @@ BEGIN_FTR_SECTION
341 mtspr SPRN_IBAT6L,r4 342 mtspr SPRN_IBAT6L,r4
342 mtspr SPRN_IBAT7U,r4 343 mtspr SPRN_IBAT7U,r4
343 mtspr SPRN_IBAT7L,r4 344 mtspr SPRN_IBAT7L,r4
344END_FTR_SECTION_IFSET(CPU_FTR_HAS_HIGH_BATS) 345END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_HIGH_BATS)
345 346
346 /* Flush all TLBs */ 347 /* Flush all TLBs */
347 lis r4,0x1000 348 lis r4,0x1000
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index 40f72c2a4699..6b0711c15eca 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -739,7 +739,7 @@ static void __init smp_core99_setup(int ncpus)
739 739
740 /* XXX should get this from reg properties */ 740 /* XXX should get this from reg properties */
741 for (i = 1; i < ncpus; ++i) 741 for (i = 1; i < ncpus; ++i)
742 smp_hw_index[i] = i; 742 set_hard_smp_processor_id(i, i);
743 } 743 }
744#endif 744#endif
745 745
diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c
index ffdd8e963fbd..dbc124e05646 100644
--- a/arch/powerpc/platforms/ps3/device-init.c
+++ b/arch/powerpc/platforms/ps3/device-init.c
@@ -314,11 +314,17 @@ static int __init ps3_setup_vuart_device(enum ps3_match_id match_id,
314 314
315 result = ps3_system_bus_device_register(&p->dev); 315 result = ps3_system_bus_device_register(&p->dev);
316 316
317 if (result) 317 if (result) {
318 pr_debug("%s:%d ps3_system_bus_device_register failed\n", 318 pr_debug("%s:%d ps3_system_bus_device_register failed\n",
319 __func__, __LINE__); 319 __func__, __LINE__);
320 320 goto fail_device_register;
321 }
321 pr_debug(" <- %s:%d\n", __func__, __LINE__); 322 pr_debug(" <- %s:%d\n", __func__, __LINE__);
323 return 0;
324
325fail_device_register:
326 kfree(p);
327 pr_debug(" <- %s:%d fail\n", __func__, __LINE__);
322 return result; 328 return result;
323} 329}
324 330
@@ -463,11 +469,17 @@ static int __init ps3_register_sound_devices(void)
463 469
464 result = ps3_system_bus_device_register(&p->dev); 470 result = ps3_system_bus_device_register(&p->dev);
465 471
466 if (result) 472 if (result) {
467 pr_debug("%s:%d ps3_system_bus_device_register failed\n", 473 pr_debug("%s:%d ps3_system_bus_device_register failed\n",
468 __func__, __LINE__); 474 __func__, __LINE__);
469 475 goto fail_device_register;
476 }
470 pr_debug(" <- %s:%d\n", __func__, __LINE__); 477 pr_debug(" <- %s:%d\n", __func__, __LINE__);
478 return 0;
479
480fail_device_register:
481 kfree(p);
482 pr_debug(" <- %s:%d failed\n", __func__, __LINE__);
471 return result; 483 return result;
472} 484}
473 485
@@ -485,17 +497,24 @@ static int __init ps3_register_graphics_devices(void)
485 if (!p) 497 if (!p)
486 return -ENOMEM; 498 return -ENOMEM;
487 499
488 p->dev.match_id = PS3_MATCH_ID_GRAPHICS; 500 p->dev.match_id = PS3_MATCH_ID_GPU;
489 p->dev.match_sub_id = PS3_MATCH_SUB_ID_FB; 501 p->dev.match_sub_id = PS3_MATCH_SUB_ID_GPU_FB;
490 p->dev.dev_type = PS3_DEVICE_TYPE_IOC0; 502 p->dev.dev_type = PS3_DEVICE_TYPE_IOC0;
491 503
492 result = ps3_system_bus_device_register(&p->dev); 504 result = ps3_system_bus_device_register(&p->dev);
493 505
494 if (result) 506 if (result) {
495 pr_debug("%s:%d ps3_system_bus_device_register failed\n", 507 pr_debug("%s:%d ps3_system_bus_device_register failed\n",
496 __func__, __LINE__); 508 __func__, __LINE__);
509 goto fail_device_register;
510 }
497 511
498 pr_debug(" <- %s:%d\n", __func__, __LINE__); 512 pr_debug(" <- %s:%d\n", __func__, __LINE__);
513 return 0;
514
515fail_device_register:
516 kfree(p);
517 pr_debug(" <- %s:%d failed\n", __func__, __LINE__);
499 return result; 518 return result;
500} 519}
501 520
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c
index 3a58ffabccd9..a4d49dd9e8a9 100644
--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -649,7 +649,7 @@ static int dma_sb_region_create(struct ps3_dma_region *r)
649{ 649{
650 int result; 650 int result;
651 651
652 pr_info(" -> %s:%d:\n", __func__, __LINE__); 652 DBG(" -> %s:%d:\n", __func__, __LINE__);
653 653
654 BUG_ON(!r); 654 BUG_ON(!r);
655 655
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index 77bc330263c4..35f3e85cf60e 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -23,7 +23,6 @@
23#include <linux/fs.h> 23#include <linux/fs.h>
24#include <linux/root_dev.h> 24#include <linux/root_dev.h>
25#include <linux/console.h> 25#include <linux/console.h>
26#include <linux/kexec.h>
27#include <linux/bootmem.h> 26#include <linux/bootmem.h>
28 27
29#include <asm/machdep.h> 28#include <asm/machdep.h>
@@ -42,6 +41,10 @@
42#define DBG pr_debug 41#define DBG pr_debug
43#endif 42#endif
44 43
44/* mutex synchronizing GPU accesses and video mode changes */
45DEFINE_MUTEX(ps3_gpu_mutex);
46EXPORT_SYMBOL_GPL(ps3_gpu_mutex);
47
45#if !defined(CONFIG_SMP) 48#if !defined(CONFIG_SMP)
46static void smp_send_stop(void) {} 49static void smp_send_stop(void) {}
47#endif 50#endif
@@ -277,8 +280,5 @@ define_machine(ps3) {
277 .halt = ps3_halt, 280 .halt = ps3_halt,
278#if defined(CONFIG_KEXEC) 281#if defined(CONFIG_KEXEC)
279 .kexec_cpu_down = ps3_kexec_cpu_down, 282 .kexec_cpu_down = ps3_kexec_cpu_down,
280 .machine_kexec = default_machine_kexec,
281 .machine_kexec_prepare = default_machine_kexec_prepare,
282 .machine_crash_shutdown = default_machine_crash_shutdown,
283#endif 283#endif
284}; 284};
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
index 661e9f77ebf6..ee0d22911621 100644
--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -31,7 +31,7 @@
31#include "platform.h" 31#include "platform.h"
32 32
33static struct device ps3_system_bus = { 33static struct device ps3_system_bus = {
34 .bus_id = "ps3_system", 34 .init_name = "ps3_system",
35}; 35};
36 36
37/* FIXME: need device usage counters! */ 37/* FIXME: need device usage counters! */
@@ -175,7 +175,7 @@ int ps3_open_hv_device(struct ps3_system_bus_device *dev)
175 return ps3_open_hv_device_sb(dev); 175 return ps3_open_hv_device_sb(dev);
176 176
177 case PS3_MATCH_ID_SOUND: 177 case PS3_MATCH_ID_SOUND:
178 case PS3_MATCH_ID_GRAPHICS: 178 case PS3_MATCH_ID_GPU:
179 return ps3_open_hv_device_gpu(dev); 179 return ps3_open_hv_device_gpu(dev);
180 180
181 case PS3_MATCH_ID_AV_SETTINGS: 181 case PS3_MATCH_ID_AV_SETTINGS:
@@ -213,7 +213,7 @@ int ps3_close_hv_device(struct ps3_system_bus_device *dev)
213 return ps3_close_hv_device_sb(dev); 213 return ps3_close_hv_device_sb(dev);
214 214
215 case PS3_MATCH_ID_SOUND: 215 case PS3_MATCH_ID_SOUND:
216 case PS3_MATCH_ID_GRAPHICS: 216 case PS3_MATCH_ID_GPU:
217 return ps3_close_hv_device_gpu(dev); 217 return ps3_close_hv_device_gpu(dev);
218 218
219 case PS3_MATCH_ID_AV_SETTINGS: 219 case PS3_MATCH_ID_AV_SETTINGS:
@@ -356,12 +356,12 @@ static int ps3_system_bus_match(struct device *_dev,
356 if (result) 356 if (result)
357 pr_info("%s:%d: dev=%u.%u(%s), drv=%u.%u(%s): match\n", 357 pr_info("%s:%d: dev=%u.%u(%s), drv=%u.%u(%s): match\n",
358 __func__, __LINE__, 358 __func__, __LINE__,
359 dev->match_id, dev->match_sub_id, dev->core.bus_id, 359 dev->match_id, dev->match_sub_id, dev_name(&dev->core),
360 drv->match_id, drv->match_sub_id, drv->core.name); 360 drv->match_id, drv->match_sub_id, drv->core.name);
361 else 361 else
362 pr_debug("%s:%d: dev=%u.%u(%s), drv=%u.%u(%s): miss\n", 362 pr_debug("%s:%d: dev=%u.%u(%s), drv=%u.%u(%s): miss\n",
363 __func__, __LINE__, 363 __func__, __LINE__,
364 dev->match_id, dev->match_sub_id, dev->core.bus_id, 364 dev->match_id, dev->match_sub_id, dev_name(&dev->core),
365 drv->match_id, drv->match_sub_id, drv->core.name); 365 drv->match_id, drv->match_sub_id, drv->core.name);
366 366
367 return result; 367 return result;
@@ -383,9 +383,9 @@ static int ps3_system_bus_probe(struct device *_dev)
383 result = drv->probe(dev); 383 result = drv->probe(dev);
384 else 384 else
385 pr_debug("%s:%d: %s no probe method\n", __func__, __LINE__, 385 pr_debug("%s:%d: %s no probe method\n", __func__, __LINE__,
386 dev->core.bus_id); 386 dev_name(&dev->core));
387 387
388 pr_debug(" <- %s:%d: %s\n", __func__, __LINE__, dev->core.bus_id); 388 pr_debug(" <- %s:%d: %s\n", __func__, __LINE__, dev_name(&dev->core));
389 return result; 389 return result;
390} 390}
391 391
@@ -407,7 +407,7 @@ static int ps3_system_bus_remove(struct device *_dev)
407 dev_dbg(&dev->core, "%s:%d %s: no remove method\n", 407 dev_dbg(&dev->core, "%s:%d %s: no remove method\n",
408 __func__, __LINE__, drv->core.name); 408 __func__, __LINE__, drv->core.name);
409 409
410 pr_debug(" <- %s:%d: %s\n", __func__, __LINE__, dev->core.bus_id); 410 pr_debug(" <- %s:%d: %s\n", __func__, __LINE__, dev_name(&dev->core));
411 return result; 411 return result;
412} 412}
413 413
@@ -432,7 +432,7 @@ static void ps3_system_bus_shutdown(struct device *_dev)
432 BUG_ON(!drv); 432 BUG_ON(!drv);
433 433
434 dev_dbg(&dev->core, "%s:%d: %s -> %s\n", __func__, __LINE__, 434 dev_dbg(&dev->core, "%s:%d: %s -> %s\n", __func__, __LINE__,
435 dev->core.bus_id, drv->core.name); 435 dev_name(&dev->core), drv->core.name);
436 436
437 if (drv->shutdown) 437 if (drv->shutdown)
438 drv->shutdown(dev); 438 drv->shutdown(dev);
@@ -453,7 +453,8 @@ static int ps3_system_bus_uevent(struct device *_dev, struct kobj_uevent_env *en
453{ 453{
454 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); 454 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
455 455
456 if (add_uevent_var(env, "MODALIAS=ps3:%d", dev->match_id)) 456 if (add_uevent_var(env, "MODALIAS=ps3:%d:%d", dev->match_id,
457 dev->match_sub_id))
457 return -ENOMEM; 458 return -ENOMEM;
458 return 0; 459 return 0;
459} 460}
@@ -462,7 +463,8 @@ static ssize_t modalias_show(struct device *_dev, struct device_attribute *a,
462 char *buf) 463 char *buf)
463{ 464{
464 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); 465 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
465 int len = snprintf(buf, PAGE_SIZE, "ps3:%d\n", dev->match_id); 466 int len = snprintf(buf, PAGE_SIZE, "ps3:%d:%d\n", dev->match_id,
467 dev->match_sub_id);
466 468
467 return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len; 469 return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
468} 470}
@@ -742,22 +744,18 @@ int ps3_system_bus_device_register(struct ps3_system_bus_device *dev)
742 switch (dev->dev_type) { 744 switch (dev->dev_type) {
743 case PS3_DEVICE_TYPE_IOC0: 745 case PS3_DEVICE_TYPE_IOC0:
744 dev->core.archdata.dma_ops = &ps3_ioc0_dma_ops; 746 dev->core.archdata.dma_ops = &ps3_ioc0_dma_ops;
745 snprintf(dev->core.bus_id, sizeof(dev->core.bus_id), 747 dev_set_name(&dev->core, "ioc0_%02x", ++dev_ioc0_count);
746 "ioc0_%02x", ++dev_ioc0_count);
747 break; 748 break;
748 case PS3_DEVICE_TYPE_SB: 749 case PS3_DEVICE_TYPE_SB:
749 dev->core.archdata.dma_ops = &ps3_sb_dma_ops; 750 dev->core.archdata.dma_ops = &ps3_sb_dma_ops;
750 snprintf(dev->core.bus_id, sizeof(dev->core.bus_id), 751 dev_set_name(&dev->core, "sb_%02x", ++dev_sb_count);
751 "sb_%02x", ++dev_sb_count);
752 752
753 break; 753 break;
754 case PS3_DEVICE_TYPE_VUART: 754 case PS3_DEVICE_TYPE_VUART:
755 snprintf(dev->core.bus_id, sizeof(dev->core.bus_id), 755 dev_set_name(&dev->core, "vuart_%02x", ++dev_vuart_count);
756 "vuart_%02x", ++dev_vuart_count);
757 break; 756 break;
758 case PS3_DEVICE_TYPE_LPM: 757 case PS3_DEVICE_TYPE_LPM:
759 snprintf(dev->core.bus_id, sizeof(dev->core.bus_id), 758 dev_set_name(&dev->core, "lpm_%02x", ++dev_lpm_count);
760 "lpm_%02x", ++dev_lpm_count);
761 break; 759 break;
762 default: 760 default:
763 BUG(); 761 BUG();
@@ -766,7 +764,7 @@ int ps3_system_bus_device_register(struct ps3_system_bus_device *dev)
766 dev->core.archdata.of_node = NULL; 764 dev->core.archdata.of_node = NULL;
767 set_dev_node(&dev->core, 0); 765 set_dev_node(&dev->core, 0);
768 766
769 pr_debug("%s:%d add %s\n", __func__, __LINE__, dev->core.bus_id); 767 pr_debug("%s:%d add %s\n", __func__, __LINE__, dev_name(&dev->core));
770 768
771 result = device_register(&dev->core); 769 result = device_register(&dev->core);
772 return result; 770 return result;
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index 97619fd51e39..ddc2a307cd50 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -54,7 +54,7 @@ config PPC_SMLPAR
54 54
55config CMM 55config CMM
56 tristate "Collaborative memory management" 56 tristate "Collaborative memory management"
57 depends on PPC_SMLPAR 57 depends on PPC_SMLPAR && !CRASH_DUMP
58 default y 58 default y
59 help 59 help
60 Select this option, if you want to enable the kernel interface 60 Select this option, if you want to enable the kernel interface
diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
index 5cd4d2761620..6567439fe78d 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -28,6 +28,7 @@
28#include <linux/kthread.h> 28#include <linux/kthread.h>
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/oom.h> 30#include <linux/oom.h>
31#include <linux/reboot.h>
31#include <linux/sched.h> 32#include <linux/sched.h>
32#include <linux/stringify.h> 33#include <linux/stringify.h>
33#include <linux/swap.h> 34#include <linux/swap.h>
@@ -384,6 +385,26 @@ static void cmm_unregister_sysfs(struct sys_device *sysdev)
384} 385}
385 386
386/** 387/**
388 * cmm_reboot_notifier - Make sure pages are not still marked as "loaned"
389 *
390 **/
391static int cmm_reboot_notifier(struct notifier_block *nb,
392 unsigned long action, void *unused)
393{
394 if (action == SYS_RESTART) {
395 if (cmm_thread_ptr)
396 kthread_stop(cmm_thread_ptr);
397 cmm_thread_ptr = NULL;
398 cmm_free_pages(loaned_pages);
399 }
400 return NOTIFY_DONE;
401}
402
403static struct notifier_block cmm_reboot_nb = {
404 .notifier_call = cmm_reboot_notifier,
405};
406
407/**
387 * cmm_init - Module initialization 408 * cmm_init - Module initialization
388 * 409 *
389 * Return value: 410 * Return value:
@@ -399,9 +420,12 @@ static int cmm_init(void)
399 if ((rc = register_oom_notifier(&cmm_oom_nb)) < 0) 420 if ((rc = register_oom_notifier(&cmm_oom_nb)) < 0)
400 return rc; 421 return rc;
401 422
402 if ((rc = cmm_sysfs_register(&cmm_sysdev))) 423 if ((rc = register_reboot_notifier(&cmm_reboot_nb)))
403 goto out_oom_notifier; 424 goto out_oom_notifier;
404 425
426 if ((rc = cmm_sysfs_register(&cmm_sysdev)))
427 goto out_reboot_notifier;
428
405 if (cmm_disabled) 429 if (cmm_disabled)
406 return rc; 430 return rc;
407 431
@@ -415,6 +439,8 @@ static int cmm_init(void)
415 439
416out_unregister_sysfs: 440out_unregister_sysfs:
417 cmm_unregister_sysfs(&cmm_sysdev); 441 cmm_unregister_sysfs(&cmm_sysdev);
442out_reboot_notifier:
443 unregister_reboot_notifier(&cmm_reboot_nb);
418out_oom_notifier: 444out_oom_notifier:
419 unregister_oom_notifier(&cmm_oom_nb); 445 unregister_oom_notifier(&cmm_oom_nb);
420 return rc; 446 return rc;
@@ -431,6 +457,7 @@ static void cmm_exit(void)
431 if (cmm_thread_ptr) 457 if (cmm_thread_ptr)
432 kthread_stop(cmm_thread_ptr); 458 kthread_stop(cmm_thread_ptr);
433 unregister_oom_notifier(&cmm_oom_nb); 459 unregister_oom_notifier(&cmm_oom_nb);
460 unregister_reboot_notifier(&cmm_reboot_nb);
434 cmm_free_pages(loaned_pages); 461 cmm_free_pages(loaned_pages);
435 cmm_unregister_sysfs(&cmm_sysdev); 462 cmm_unregister_sysfs(&cmm_sysdev);
436} 463}
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index 54816d75b578..989d6462c154 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -21,6 +21,8 @@
21 * Please address comments and feedback to Linas Vepstas <linas@austin.ibm.com> 21 * Please address comments and feedback to Linas Vepstas <linas@austin.ibm.com>
22 */ 22 */
23 23
24#undef DEBUG
25
24#include <linux/delay.h> 26#include <linux/delay.h>
25#include <linux/init.h> 27#include <linux/init.h>
26#include <linux/list.h> 28#include <linux/list.h>
@@ -488,10 +490,8 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
488 if (!(pdn->eeh_mode & EEH_MODE_SUPPORTED) || 490 if (!(pdn->eeh_mode & EEH_MODE_SUPPORTED) ||
489 pdn->eeh_mode & EEH_MODE_NOCHECK) { 491 pdn->eeh_mode & EEH_MODE_NOCHECK) {
490 ignored_check++; 492 ignored_check++;
491#ifdef DEBUG 493 pr_debug("EEH: Ignored check (%x) for %s %s\n",
492 printk ("EEH:ignored check (%x) for %s %s\n", 494 pdn->eeh_mode, pci_name (dev), dn->full_name);
493 pdn->eeh_mode, pci_name (dev), dn->full_name);
494#endif
495 return 0; 495 return 0;
496 } 496 }
497 497
@@ -1014,10 +1014,9 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
1014 eeh_subsystem_enabled = 1; 1014 eeh_subsystem_enabled = 1;
1015 pdn->eeh_mode |= EEH_MODE_SUPPORTED; 1015 pdn->eeh_mode |= EEH_MODE_SUPPORTED;
1016 1016
1017#ifdef DEBUG 1017 pr_debug("EEH: %s: eeh enabled, config=%x pe_config=%x\n",
1018 printk(KERN_DEBUG "EEH: %s: eeh enabled, config=%x pe_config=%x\n", 1018 dn->full_name, pdn->eeh_config_addr,
1019 dn->full_name, pdn->eeh_config_addr, pdn->eeh_pe_config_addr); 1019 pdn->eeh_pe_config_addr);
1020#endif
1021 } else { 1020 } else {
1022 1021
1023 /* This device doesn't support EEH, but it may have an 1022 /* This device doesn't support EEH, but it may have an
@@ -1161,13 +1160,17 @@ static void eeh_add_device_late(struct pci_dev *dev)
1161 if (!dev || !eeh_subsystem_enabled) 1160 if (!dev || !eeh_subsystem_enabled)
1162 return; 1161 return;
1163 1162
1164#ifdef DEBUG 1163 pr_debug("EEH: Adding device %s\n", pci_name(dev));
1165 printk(KERN_DEBUG "EEH: adding device %s\n", pci_name(dev));
1166#endif
1167 1164
1168 pci_dev_get (dev);
1169 dn = pci_device_to_OF_node(dev); 1165 dn = pci_device_to_OF_node(dev);
1170 pdn = PCI_DN(dn); 1166 pdn = PCI_DN(dn);
1167 if (pdn->pcidev == dev) {
1168 pr_debug("EEH: Already referenced !\n");
1169 return;
1170 }
1171 WARN_ON(pdn->pcidev);
1172
1173 pci_dev_get (dev);
1171 pdn->pcidev = dev; 1174 pdn->pcidev = dev;
1172 1175
1173 pci_addr_cache_insert_device(dev); 1176 pci_addr_cache_insert_device(dev);
@@ -1206,17 +1209,18 @@ static void eeh_remove_device(struct pci_dev *dev)
1206 return; 1209 return;
1207 1210
1208 /* Unregister the device with the EEH/PCI address search system */ 1211 /* Unregister the device with the EEH/PCI address search system */
1209#ifdef DEBUG 1212 pr_debug("EEH: Removing device %s\n", pci_name(dev));
1210 printk(KERN_DEBUG "EEH: remove device %s\n", pci_name(dev));
1211#endif
1212 pci_addr_cache_remove_device(dev);
1213 eeh_sysfs_remove_device(dev);
1214 1213
1215 dn = pci_device_to_OF_node(dev); 1214 dn = pci_device_to_OF_node(dev);
1216 if (PCI_DN(dn)->pcidev) { 1215 if (PCI_DN(dn)->pcidev == NULL) {
1217 PCI_DN(dn)->pcidev = NULL; 1216 pr_debug("EEH: Not referenced !\n");
1218 pci_dev_put (dev); 1217 return;
1219 } 1218 }
1219 PCI_DN(dn)->pcidev = NULL;
1220 pci_dev_put (dev);
1221
1222 pci_addr_cache_remove_device(dev);
1223 eeh_sysfs_remove_device(dev);
1220} 1224}
1221 1225
1222void eeh_remove_bus_device(struct pci_dev *dev) 1226void eeh_remove_bus_device(struct pci_dev *dev)
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 1f032483c026..a20ead87153d 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -116,7 +116,7 @@ static void pseries_cpu_die(unsigned int cpu)
116 cpu_status = query_cpu_stopped(pcpu); 116 cpu_status = query_cpu_stopped(pcpu);
117 if (cpu_status == 0 || cpu_status == -1) 117 if (cpu_status == 0 || cpu_status == -1)
118 break; 118 break;
119 msleep(200); 119 cpu_relax();
120 } 120 }
121 if (cpu_status != 0) { 121 if (cpu_status != 0) {
122 printk("Querying DEAD? cpu %i (%i) shows %i\n", 122 printk("Querying DEAD? cpu %i (%i) shows %i\n",
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
index 7190493e9bdc..5e1ed3d60ee5 100644
--- a/arch/powerpc/platforms/pseries/pci_dlpar.c
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -25,6 +25,8 @@
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 */ 26 */
27 27
28#undef DEBUG
29
28#include <linux/pci.h> 30#include <linux/pci.h>
29#include <asm/pci-bridge.h> 31#include <asm/pci-bridge.h>
30#include <asm/ppc-pci.h> 32#include <asm/ppc-pci.h>
@@ -69,74 +71,25 @@ EXPORT_SYMBOL_GPL(pcibios_find_pci_bus);
69 * Remove all of the PCI devices under this bus both from the 71 * Remove all of the PCI devices under this bus both from the
70 * linux pci device tree, and from the powerpc EEH address cache. 72 * linux pci device tree, and from the powerpc EEH address cache.
71 */ 73 */
72void 74void pcibios_remove_pci_devices(struct pci_bus *bus)
73pcibios_remove_pci_devices(struct pci_bus *bus)
74{ 75{
75 struct pci_dev *dev, *tmp; 76 struct pci_dev *dev, *tmp;
77 struct pci_bus *child_bus;
78
79 /* First go down child busses */
80 list_for_each_entry(child_bus, &bus->children, node)
81 pcibios_remove_pci_devices(child_bus);
76 82
83 pr_debug("PCI: Removing devices on bus %04x:%02x\n",
84 pci_domain_nr(bus), bus->number);
77 list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) { 85 list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) {
86 pr_debug(" * Removing %s...\n", pci_name(dev));
78 eeh_remove_bus_device(dev); 87 eeh_remove_bus_device(dev);
79 pci_remove_bus_device(dev); 88 pci_remove_bus_device(dev);
80 } 89 }
81} 90}
82EXPORT_SYMBOL_GPL(pcibios_remove_pci_devices); 91EXPORT_SYMBOL_GPL(pcibios_remove_pci_devices);
83 92
84/* Must be called before pci_bus_add_devices */
85void
86pcibios_fixup_new_pci_devices(struct pci_bus *bus)
87{
88 struct pci_dev *dev;
89
90 list_for_each_entry(dev, &bus->devices, bus_list) {
91 /* Skip already-added devices */
92 if (!dev->is_added) {
93 int i;
94
95 /* Fill device archdata and setup iommu table */
96 pcibios_setup_new_device(dev);
97
98 pci_read_irq_line(dev);
99 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
100 struct resource *r = &dev->resource[i];
101
102 if (r->parent || !r->start || !r->flags)
103 continue;
104 pci_claim_resource(dev, i);
105 }
106 }
107 }
108}
109EXPORT_SYMBOL_GPL(pcibios_fixup_new_pci_devices);
110
111static int
112pcibios_pci_config_bridge(struct pci_dev *dev)
113{
114 u8 sec_busno;
115 struct pci_bus *child_bus;
116
117 /* Get busno of downstream bus */
118 pci_read_config_byte(dev, PCI_SECONDARY_BUS, &sec_busno);
119
120 /* Add to children of PCI bridge dev->bus */
121 child_bus = pci_add_new_bus(dev->bus, dev, sec_busno);
122 if (!child_bus) {
123 printk (KERN_ERR "%s: could not add second bus\n", __func__);
124 return -EIO;
125 }
126 sprintf(child_bus->name, "PCI Bus #%02x", child_bus->number);
127
128 pci_scan_child_bus(child_bus);
129
130 /* Fixup new pci devices */
131 pcibios_fixup_new_pci_devices(child_bus);
132
133 /* Make the discovered devices available */
134 pci_bus_add_devices(child_bus);
135
136 eeh_add_device_tree_late(child_bus);
137 return 0;
138}
139
140/** 93/**
141 * pcibios_add_pci_devices - adds new pci devices to bus 94 * pcibios_add_pci_devices - adds new pci devices to bus
142 * 95 *
@@ -147,10 +100,9 @@ pcibios_pci_config_bridge(struct pci_dev *dev)
147 * is how this routine differs from other, similar pcibios 100 * is how this routine differs from other, similar pcibios
148 * routines.) 101 * routines.)
149 */ 102 */
150void 103void pcibios_add_pci_devices(struct pci_bus * bus)
151pcibios_add_pci_devices(struct pci_bus * bus)
152{ 104{
153 int slotno, num, mode; 105 int slotno, num, mode, pass, max;
154 struct pci_dev *dev; 106 struct pci_dev *dev;
155 struct device_node *dn = pci_bus_to_OF_node(bus); 107 struct device_node *dn = pci_bus_to_OF_node(bus);
156 108
@@ -162,26 +114,23 @@ pcibios_add_pci_devices(struct pci_bus * bus)
162 114
163 if (mode == PCI_PROBE_DEVTREE) { 115 if (mode == PCI_PROBE_DEVTREE) {
164 /* use ofdt-based probe */ 116 /* use ofdt-based probe */
165 of_scan_bus(dn, bus); 117 of_rescan_bus(dn, bus);
166 if (!list_empty(&bus->devices)) {
167 pcibios_fixup_new_pci_devices(bus);
168 pci_bus_add_devices(bus);
169 eeh_add_device_tree_late(bus);
170 }
171 } else if (mode == PCI_PROBE_NORMAL) { 118 } else if (mode == PCI_PROBE_NORMAL) {
172 /* use legacy probe */ 119 /* use legacy probe */
173 slotno = PCI_SLOT(PCI_DN(dn->child)->devfn); 120 slotno = PCI_SLOT(PCI_DN(dn->child)->devfn);
174 num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0)); 121 num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0));
175 if (num) { 122 if (!num)
176 pcibios_fixup_new_pci_devices(bus); 123 return;
177 pci_bus_add_devices(bus); 124 pcibios_setup_bus_devices(bus);
178 eeh_add_device_tree_late(bus); 125 max = bus->secondary;
126 for (pass=0; pass < 2; pass++)
127 list_for_each_entry(dev, &bus->devices, bus_list) {
128 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
129 dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
130 max = pci_scan_bridge(bus, dev, max, pass);
179 } 131 }
180
181 list_for_each_entry(dev, &bus->devices, bus_list)
182 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE)
183 pcibios_pci_config_bridge(dev);
184 } 132 }
133 pcibios_finish_adding_to_bus(bus);
185} 134}
186EXPORT_SYMBOL_GPL(pcibios_add_pci_devices); 135EXPORT_SYMBOL_GPL(pcibios_add_pci_devices);
187 136
@@ -190,6 +139,8 @@ struct pci_controller * __devinit init_phb_dynamic(struct device_node *dn)
190 struct pci_controller *phb; 139 struct pci_controller *phb;
191 int primary; 140 int primary;
192 141
142 pr_debug("PCI: Initializing new hotplug PHB %s\n", dn->full_name);
143
193 primary = list_empty(&hose_list); 144 primary = list_empty(&hose_list);
194 phb = pcibios_alloc_controller(dn); 145 phb = pcibios_alloc_controller(dn);
195 if (!phb) 146 if (!phb)
@@ -203,11 +154,59 @@ struct pci_controller * __devinit init_phb_dynamic(struct device_node *dn)
203 eeh_add_device_tree_early(dn); 154 eeh_add_device_tree_early(dn);
204 155
205 scan_phb(phb); 156 scan_phb(phb);
206 pcibios_allocate_bus_resources(phb->bus); 157 pcibios_finish_adding_to_bus(phb->bus);
207 pcibios_fixup_new_pci_devices(phb->bus);
208 pci_bus_add_devices(phb->bus);
209 eeh_add_device_tree_late(phb->bus);
210 158
211 return phb; 159 return phb;
212} 160}
213EXPORT_SYMBOL_GPL(init_phb_dynamic); 161EXPORT_SYMBOL_GPL(init_phb_dynamic);
162
163/* RPA-specific bits for removing PHBs */
164int remove_phb_dynamic(struct pci_controller *phb)
165{
166 struct pci_bus *b = phb->bus;
167 struct resource *res;
168 int rc, i;
169
170 pr_debug("PCI: Removing PHB %04x:%02x... \n",
171 pci_domain_nr(b), b->number);
172
173 /* We cannot to remove a root bus that has children */
174 if (!(list_empty(&b->children) && list_empty(&b->devices)))
175 return -EBUSY;
176
177 /* We -know- there aren't any child devices anymore at this stage
178 * and thus, we can safely unmap the IO space as it's not in use
179 */
180 res = &phb->io_resource;
181 if (res->flags & IORESOURCE_IO) {
182 rc = pcibios_unmap_io_space(b);
183 if (rc) {
184 printk(KERN_ERR "%s: failed to unmap IO on bus %s\n",
185 __func__, b->name);
186 return 1;
187 }
188 }
189
190 /* Unregister the bridge device from sysfs and remove the PCI bus */
191 device_unregister(b->bridge);
192 phb->bus = NULL;
193 pci_remove_bus(b);
194
195 /* Now release the IO resource */
196 if (res->flags & IORESOURCE_IO)
197 release_resource(res);
198
199 /* Release memory resources */
200 for (i = 0; i < 3; ++i) {
201 res = &phb->mem_resources[i];
202 if (!(res->flags & IORESOURCE_MEM))
203 continue;
204 release_resource(res);
205 }
206
207 /* Free pci_controller data structure */
208 pcibios_free_controller(phb);
209
210 return 0;
211}
212EXPORT_SYMBOL_GPL(remove_phb_dynamic);
diff --git a/arch/powerpc/platforms/pseries/phyp_dump.c b/arch/powerpc/platforms/pseries/phyp_dump.c
index edbc012c2ebc..6cf35cd8d0b5 100644
--- a/arch/powerpc/platforms/pseries/phyp_dump.c
+++ b/arch/powerpc/platforms/pseries/phyp_dump.c
@@ -130,6 +130,9 @@ static unsigned long init_dump_header(struct phyp_dump_header *ph)
130static void print_dump_header(const struct phyp_dump_header *ph) 130static void print_dump_header(const struct phyp_dump_header *ph)
131{ 131{
132#ifdef DEBUG 132#ifdef DEBUG
133 if (ph == NULL)
134 return;
135
133 printk(KERN_INFO "dump header:\n"); 136 printk(KERN_INFO "dump header:\n");
134 /* setup some ph->sections required */ 137 /* setup some ph->sections required */
135 printk(KERN_INFO "version = %d\n", ph->version); 138 printk(KERN_INFO "version = %d\n", ph->version);
@@ -411,6 +414,8 @@ static int __init phyp_dump_setup(void)
411 of_node_put(rtas); 414 of_node_put(rtas);
412 } 415 }
413 416
417 ibm_configure_kernel_dump = rtas_token("ibm,configure-kernel-dump");
418
414 print_dump_header(dump_header); 419 print_dump_header(dump_header);
415 dump_area_length = init_dump_header(&phdr); 420 dump_area_length = init_dump_header(&phdr);
416 /* align down */ 421 /* align down */
diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c
index f4e55be2eea9..afad9f5ac0ac 100644
--- a/arch/powerpc/platforms/pseries/rtasd.c
+++ b/arch/powerpc/platforms/pseries/rtasd.c
@@ -208,6 +208,7 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal)
208 break; 208 break;
209 case ERR_TYPE_KERNEL_PANIC: 209 case ERR_TYPE_KERNEL_PANIC:
210 default: 210 default:
211 WARN_ON_ONCE(!irqs_disabled()); /* @@@ DEBUG @@@ */
211 spin_unlock_irqrestore(&rtasd_log_lock, s); 212 spin_unlock_irqrestore(&rtasd_log_lock, s);
212 return; 213 return;
213 } 214 }
@@ -227,6 +228,7 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal)
227 /* Check to see if we need to or have stopped logging */ 228 /* Check to see if we need to or have stopped logging */
228 if (fatal || !logging_enabled) { 229 if (fatal || !logging_enabled) {
229 logging_enabled = 0; 230 logging_enabled = 0;
231 WARN_ON_ONCE(!irqs_disabled()); /* @@@ DEBUG @@@ */
230 spin_unlock_irqrestore(&rtasd_log_lock, s); 232 spin_unlock_irqrestore(&rtasd_log_lock, s);
231 return; 233 return;
232 } 234 }
@@ -249,11 +251,13 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal)
249 else 251 else
250 rtas_log_start += 1; 252 rtas_log_start += 1;
251 253
254 WARN_ON_ONCE(!irqs_disabled()); /* @@@ DEBUG @@@ */
252 spin_unlock_irqrestore(&rtasd_log_lock, s); 255 spin_unlock_irqrestore(&rtasd_log_lock, s);
253 wake_up_interruptible(&rtas_log_wait); 256 wake_up_interruptible(&rtas_log_wait);
254 break; 257 break;
255 case ERR_TYPE_KERNEL_PANIC: 258 case ERR_TYPE_KERNEL_PANIC:
256 default: 259 default:
260 WARN_ON_ONCE(!irqs_disabled()); /* @@@ DEBUG @@@ */
257 spin_unlock_irqrestore(&rtasd_log_lock, s); 261 spin_unlock_irqrestore(&rtasd_log_lock, s);
258 return; 262 return;
259 } 263 }
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index e1904774a70f..84e058f1e1cc 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -332,7 +332,7 @@ static void xics_eoi_lpar(unsigned int virq)
332 lpar_xirr_info_set((0xff << 24) | irq); 332 lpar_xirr_info_set((0xff << 24) | irq);
333} 333}
334 334
335static void xics_set_affinity(unsigned int virq, cpumask_t cpumask) 335static void xics_set_affinity(unsigned int virq, const struct cpumask *cpumask)
336{ 336{
337 unsigned int irq; 337 unsigned int irq;
338 int status; 338 int status;
@@ -579,7 +579,7 @@ static void xics_update_irq_servers(void)
579 int i, j; 579 int i, j;
580 struct device_node *np; 580 struct device_node *np;
581 u32 ilen; 581 u32 ilen;
582 const u32 *ireg, *isize; 582 const u32 *ireg;
583 u32 hcpuid; 583 u32 hcpuid;
584 584
585 /* Find the server numbers for the boot cpu. */ 585 /* Find the server numbers for the boot cpu. */
@@ -607,11 +607,6 @@ static void xics_update_irq_servers(void)
607 } 607 }
608 } 608 }
609 609
610 /* get the bit size of server numbers */
611 isize = of_get_property(np, "ibm,interrupt-server#-size", NULL);
612 if (isize)
613 interrupt_server_size = *isize;
614
615 of_node_put(np); 610 of_node_put(np);
616} 611}
617 612
@@ -682,6 +677,7 @@ void __init xics_init_IRQ(void)
682 struct device_node *np; 677 struct device_node *np;
683 u32 indx = 0; 678 u32 indx = 0;
684 int found = 0; 679 int found = 0;
680 const u32 *isize;
685 681
686 ppc64_boot_msg(0x20, "XICS Init"); 682 ppc64_boot_msg(0x20, "XICS Init");
687 683
@@ -701,6 +697,26 @@ void __init xics_init_IRQ(void)
701 if (found == 0) 697 if (found == 0)
702 return; 698 return;
703 699
700 /* get the bit size of server numbers */
701 found = 0;
702
703 for_each_compatible_node(np, NULL, "ibm,ppc-xics") {
704 isize = of_get_property(np, "ibm,interrupt-server#-size", NULL);
705
706 if (!isize)
707 continue;
708
709 if (!found) {
710 interrupt_server_size = *isize;
711 found = 1;
712 } else if (*isize != interrupt_server_size) {
713 printk(KERN_WARNING "XICS: "
714 "mismatched ibm,interrupt-server#-size\n");
715 interrupt_server_size = max(*isize,
716 interrupt_server_size);
717 }
718 }
719
704 xics_update_irq_servers(); 720 xics_update_irq_servers();
705 xics_init_host(); 721 xics_init_host();
706 722
@@ -728,9 +744,18 @@ static void xics_set_cpu_priority(unsigned char cppr)
728/* Have the calling processor join or leave the specified global queue */ 744/* Have the calling processor join or leave the specified global queue */
729static void xics_set_cpu_giq(unsigned int gserver, unsigned int join) 745static void xics_set_cpu_giq(unsigned int gserver, unsigned int join)
730{ 746{
731 int status = rtas_set_indicator_fast(GLOBAL_INTERRUPT_QUEUE, 747 int index;
732 (1UL << interrupt_server_size) - 1 - gserver, join); 748 int status;
733 WARN_ON(status < 0); 749
750 if (!rtas_indicator_present(GLOBAL_INTERRUPT_QUEUE, NULL))
751 return;
752
753 index = (1UL << interrupt_server_size) - 1 - gserver;
754
755 status = rtas_set_indicator_fast(GLOBAL_INTERRUPT_QUEUE, index, join);
756
757 WARN(status < 0, "set-indicator(%d, %d, %u) returned %d\n",
758 GLOBAL_INTERRUPT_QUEUE, index, join, status);
734} 759}
735 760
736void xics_setup_cpu(void) 761void xics_setup_cpu(void)
@@ -845,7 +870,7 @@ void xics_migrate_irqs_away(void)
845 870
846 /* Reset affinity to all cpus */ 871 /* Reset affinity to all cpus */
847 irq_desc[virq].affinity = CPU_MASK_ALL; 872 irq_desc[virq].affinity = CPU_MASK_ALL;
848 desc->chip->set_affinity(virq, CPU_MASK_ALL); 873 desc->chip->set_affinity(virq, cpu_all_mask);
849unlock: 874unlock:
850 spin_unlock_irqrestore(&desc->lock, flags); 875 spin_unlock_irqrestore(&desc->lock, flags);
851 } 876 }
diff --git a/arch/powerpc/sysdev/bestcomm/ata.c b/arch/powerpc/sysdev/bestcomm/ata.c
index 1f5258fb38c3..901c9f91e5dd 100644
--- a/arch/powerpc/sysdev/bestcomm/ata.c
+++ b/arch/powerpc/sysdev/bestcomm/ata.c
@@ -61,6 +61,9 @@ bcom_ata_init(int queue_len, int maxbufsize)
61 struct bcom_ata_var *var; 61 struct bcom_ata_var *var;
62 struct bcom_ata_inc *inc; 62 struct bcom_ata_inc *inc;
63 63
64 /* Prefetch breaks ATA DMA. Turn it off for ATA DMA */
65 bcom_disable_prefetch();
66
64 tsk = bcom_task_alloc(queue_len, sizeof(struct bcom_ata_bd), 0); 67 tsk = bcom_task_alloc(queue_len, sizeof(struct bcom_ata_bd), 0);
65 if (!tsk) 68 if (!tsk)
66 return NULL; 69 return NULL;
diff --git a/arch/powerpc/sysdev/bestcomm/ata.h b/arch/powerpc/sysdev/bestcomm/ata.h
index 10982769c465..0b2371811334 100644
--- a/arch/powerpc/sysdev/bestcomm/ata.h
+++ b/arch/powerpc/sysdev/bestcomm/ata.h
@@ -16,22 +16,15 @@
16 16
17struct bcom_ata_bd { 17struct bcom_ata_bd {
18 u32 status; 18 u32 status;
19 u32 dst_pa;
20 u32 src_pa; 19 u32 src_pa;
20 u32 dst_pa;
21}; 21};
22 22
23extern struct bcom_task * 23extern struct bcom_task * bcom_ata_init(int queue_len, int maxbufsize);
24bcom_ata_init(int queue_len, int maxbufsize); 24extern void bcom_ata_rx_prepare(struct bcom_task *tsk);
25 25extern void bcom_ata_tx_prepare(struct bcom_task *tsk);
26extern void 26extern void bcom_ata_reset_bd(struct bcom_task *tsk);
27bcom_ata_rx_prepare(struct bcom_task *tsk); 27extern void bcom_ata_release(struct bcom_task *tsk);
28
29extern void
30bcom_ata_tx_prepare(struct bcom_task *tsk);
31
32extern void
33bcom_ata_reset_bd(struct bcom_task *tsk);
34
35 28
36#endif /* __BESTCOMM_ATA_H__ */ 29#endif /* __BESTCOMM_ATA_H__ */
37 30
diff --git a/arch/powerpc/sysdev/bestcomm/bestcomm.c b/arch/powerpc/sysdev/bestcomm/bestcomm.c
index 446c9ea85b30..378ebd9aac18 100644
--- a/arch/powerpc/sysdev/bestcomm/bestcomm.c
+++ b/arch/powerpc/sysdev/bestcomm/bestcomm.c
@@ -279,7 +279,6 @@ bcom_engine_init(void)
279 int task; 279 int task;
280 phys_addr_t tdt_pa, ctx_pa, var_pa, fdt_pa; 280 phys_addr_t tdt_pa, ctx_pa, var_pa, fdt_pa;
281 unsigned int tdt_size, ctx_size, var_size, fdt_size; 281 unsigned int tdt_size, ctx_size, var_size, fdt_size;
282 u16 regval;
283 282
284 /* Allocate & clear SRAM zones for FDT, TDTs, contexts and vars/incs */ 283 /* Allocate & clear SRAM zones for FDT, TDTs, contexts and vars/incs */
285 tdt_size = BCOM_MAX_TASKS * sizeof(struct bcom_tdt); 284 tdt_size = BCOM_MAX_TASKS * sizeof(struct bcom_tdt);
@@ -331,10 +330,8 @@ bcom_engine_init(void)
331 out_8(&bcom_eng->regs->ipr[BCOM_INITIATOR_ALWAYS], BCOM_IPR_ALWAYS); 330 out_8(&bcom_eng->regs->ipr[BCOM_INITIATOR_ALWAYS], BCOM_IPR_ALWAYS);
332 331
333 /* Disable COMM Bus Prefetch on the original 5200; it's broken */ 332 /* Disable COMM Bus Prefetch on the original 5200; it's broken */
334 if ((mfspr(SPRN_SVR) & MPC5200_SVR_MASK) == MPC5200_SVR) { 333 if ((mfspr(SPRN_SVR) & MPC5200_SVR_MASK) == MPC5200_SVR)
335 regval = in_be16(&bcom_eng->regs->PtdCntrl); 334 bcom_disable_prefetch();
336 out_be16(&bcom_eng->regs->PtdCntrl, regval | 1);
337 }
338 335
339 /* Init lock */ 336 /* Init lock */
340 spin_lock_init(&bcom_eng->lock); 337 spin_lock_init(&bcom_eng->lock);
diff --git a/arch/powerpc/sysdev/bestcomm/bestcomm.h b/arch/powerpc/sysdev/bestcomm/bestcomm.h
index c960a8b49655..23a95f80dfdb 100644
--- a/arch/powerpc/sysdev/bestcomm/bestcomm.h
+++ b/arch/powerpc/sysdev/bestcomm/bestcomm.h
@@ -16,8 +16,19 @@
16#ifndef __BESTCOMM_H__ 16#ifndef __BESTCOMM_H__
17#define __BESTCOMM_H__ 17#define __BESTCOMM_H__
18 18
19struct bcom_bd; /* defined later on ... */ 19/**
20 20 * struct bcom_bd - Structure describing a generic BestComm buffer descriptor
21 * @status: The current status of this buffer. Exact meaning depends on the
22 * task type
23 * @data: An array of u32 extra data. Size of array is task dependant.
24 *
25 * Note: Don't dereference a bcom_bd pointer as an array. The size of the
26 * bcom_bd is variable. Use bcom_get_bd() instead.
27 */
28struct bcom_bd {
29 u32 status;
30 u32 data[0]; /* variable payload size */
31};
21 32
22/* ======================================================================== */ 33/* ======================================================================== */
23/* Generic task management */ 34/* Generic task management */
@@ -84,17 +95,6 @@ bcom_get_task_irq(struct bcom_task *tsk) {
84/* BD based tasks helpers */ 95/* BD based tasks helpers */
85/* ======================================================================== */ 96/* ======================================================================== */
86 97
87/**
88 * struct bcom_bd - Structure describing a generic BestComm buffer descriptor
89 * @status: The current status of this buffer. Exact meaning depends on the
90 * task type
91 * @data: An array of u32 whose meaning depends on the task type.
92 */
93struct bcom_bd {
94 u32 status;
95 u32 data[1]; /* variable, but at least 1 */
96};
97
98#define BCOM_BD_READY 0x40000000ul 98#define BCOM_BD_READY 0x40000000ul
99 99
100/** _bcom_next_index - Get next input index. 100/** _bcom_next_index - Get next input index.
@@ -140,15 +140,31 @@ bcom_queue_full(struct bcom_task *tsk)
140} 140}
141 141
142/** 142/**
143 * bcom_get_bd - Get a BD from the queue
144 * @tsk: The BestComm task structure
145 * index: Index of the BD to fetch
146 */
147static inline struct bcom_bd
148*bcom_get_bd(struct bcom_task *tsk, unsigned int index)
149{
150 /* A cast to (void*) so the address can be incremented by the
151 * real size instead of by sizeof(struct bcom_bd) */
152 return ((void *)tsk->bd) + (index * tsk->bd_size);
153}
154
155/**
143 * bcom_buffer_done - Checks if a BestComm 156 * bcom_buffer_done - Checks if a BestComm
144 * @tsk: The BestComm task structure 157 * @tsk: The BestComm task structure
145 */ 158 */
146static inline int 159static inline int
147bcom_buffer_done(struct bcom_task *tsk) 160bcom_buffer_done(struct bcom_task *tsk)
148{ 161{
162 struct bcom_bd *bd;
149 if (bcom_queue_empty(tsk)) 163 if (bcom_queue_empty(tsk))
150 return 0; 164 return 0;
151 return !(tsk->bd[tsk->outdex].status & BCOM_BD_READY); 165
166 bd = bcom_get_bd(tsk, tsk->outdex);
167 return !(bd->status & BCOM_BD_READY);
152} 168}
153 169
154/** 170/**
@@ -160,16 +176,21 @@ bcom_buffer_done(struct bcom_task *tsk)
160static inline struct bcom_bd * 176static inline struct bcom_bd *
161bcom_prepare_next_buffer(struct bcom_task *tsk) 177bcom_prepare_next_buffer(struct bcom_task *tsk)
162{ 178{
163 tsk->bd[tsk->index].status = 0; /* cleanup last status */ 179 struct bcom_bd *bd;
164 return &tsk->bd[tsk->index]; 180
181 bd = bcom_get_bd(tsk, tsk->index);
182 bd->status = 0; /* cleanup last status */
183 return bd;
165} 184}
166 185
167static inline void 186static inline void
168bcom_submit_next_buffer(struct bcom_task *tsk, void *cookie) 187bcom_submit_next_buffer(struct bcom_task *tsk, void *cookie)
169{ 188{
189 struct bcom_bd *bd = bcom_get_bd(tsk, tsk->index);
190
170 tsk->cookie[tsk->index] = cookie; 191 tsk->cookie[tsk->index] = cookie;
171 mb(); /* ensure the bd is really up-to-date */ 192 mb(); /* ensure the bd is really up-to-date */
172 tsk->bd[tsk->index].status |= BCOM_BD_READY; 193 bd->status |= BCOM_BD_READY;
173 tsk->index = _bcom_next_index(tsk); 194 tsk->index = _bcom_next_index(tsk);
174 if (tsk->flags & BCOM_FLAGS_ENABLE_TASK) 195 if (tsk->flags & BCOM_FLAGS_ENABLE_TASK)
175 bcom_enable(tsk); 196 bcom_enable(tsk);
@@ -179,10 +200,12 @@ static inline void *
179bcom_retrieve_buffer(struct bcom_task *tsk, u32 *p_status, struct bcom_bd **p_bd) 200bcom_retrieve_buffer(struct bcom_task *tsk, u32 *p_status, struct bcom_bd **p_bd)
180{ 201{
181 void *cookie = tsk->cookie[tsk->outdex]; 202 void *cookie = tsk->cookie[tsk->outdex];
203 struct bcom_bd *bd = bcom_get_bd(tsk, tsk->outdex);
204
182 if (p_status) 205 if (p_status)
183 *p_status = tsk->bd[tsk->outdex].status; 206 *p_status = bd->status;
184 if (p_bd) 207 if (p_bd)
185 *p_bd = &tsk->bd[tsk->outdex]; 208 *p_bd = bd;
186 tsk->outdex = _bcom_next_outdex(tsk); 209 tsk->outdex = _bcom_next_outdex(tsk);
187 return cookie; 210 return cookie;
188} 211}
diff --git a/arch/powerpc/sysdev/bestcomm/bestcomm_priv.h b/arch/powerpc/sysdev/bestcomm/bestcomm_priv.h
index 866a2915ef2f..eb0d1c883c31 100644
--- a/arch/powerpc/sysdev/bestcomm/bestcomm_priv.h
+++ b/arch/powerpc/sysdev/bestcomm/bestcomm_priv.h
@@ -198,8 +198,8 @@ struct bcom_task_header {
198#define BCOM_IPR_SCTMR_1 2 198#define BCOM_IPR_SCTMR_1 2
199#define BCOM_IPR_FEC_RX 6 199#define BCOM_IPR_FEC_RX 6
200#define BCOM_IPR_FEC_TX 5 200#define BCOM_IPR_FEC_TX 5
201#define BCOM_IPR_ATA_RX 4 201#define BCOM_IPR_ATA_RX 7
202#define BCOM_IPR_ATA_TX 3 202#define BCOM_IPR_ATA_TX 7
203#define BCOM_IPR_SCPCI_RX 2 203#define BCOM_IPR_SCPCI_RX 2
204#define BCOM_IPR_SCPCI_TX 2 204#define BCOM_IPR_SCPCI_TX 2
205#define BCOM_IPR_PSC3_RX 2 205#define BCOM_IPR_PSC3_RX 2
@@ -241,6 +241,22 @@ extern void bcom_set_initiator(int task, int initiator);
241 241
242#define TASK_ENABLE 0x8000 242#define TASK_ENABLE 0x8000
243 243
244/**
245 * bcom_disable_prefetch - Hook to disable bus prefetching
246 *
247 * ATA DMA and the original MPC5200 need this due to silicon bugs. At the
248 * moment disabling prefetch is a one-way street. There is no mechanism
249 * in place to turn prefetch back on after it has been disabled. There is
250 * no reason it couldn't be done, it would just be more complex to implement.
251 */
252static inline void bcom_disable_prefetch(void)
253{
254 u16 regval;
255
256 regval = in_be16(&bcom_eng->regs->PtdCntrl);
257 out_be16(&bcom_eng->regs->PtdCntrl, regval | 1);
258};
259
244static inline void 260static inline void
245bcom_enable_task(int task) 261bcom_enable_task(int task)
246{ 262{
diff --git a/arch/powerpc/sysdev/dcr-low.S b/arch/powerpc/sysdev/dcr-low.S
index 2078f39e2f17..d3098ef1404a 100644
--- a/arch/powerpc/sysdev/dcr-low.S
+++ b/arch/powerpc/sysdev/dcr-low.S
@@ -11,14 +11,20 @@
11 11
12#include <asm/ppc_asm.h> 12#include <asm/ppc_asm.h>
13#include <asm/processor.h> 13#include <asm/processor.h>
14#include <asm/bug.h>
14 15
15#define DCR_ACCESS_PROLOG(table) \ 16#define DCR_ACCESS_PROLOG(table) \
17 cmpli cr0,r3,1024; \
16 rlwinm r3,r3,4,18,27; \ 18 rlwinm r3,r3,4,18,27; \
17 lis r5,table@h; \ 19 lis r5,table@h; \
18 ori r5,r5,table@l; \ 20 ori r5,r5,table@l; \
19 add r3,r3,r5; \ 21 add r3,r3,r5; \
22 bge- 1f; \
20 mtctr r3; \ 23 mtctr r3; \
21 bctr 24 bctr; \
251: trap; \
26 EMIT_BUG_ENTRY 1b,__FILE__,__LINE__,0; \
27 blr
22 28
23_GLOBAL(__mfdcr) 29_GLOBAL(__mfdcr)
24 DCR_ACCESS_PROLOG(__mfdcr_table) 30 DCR_ACCESS_PROLOG(__mfdcr_table)
diff --git a/arch/powerpc/sysdev/dcr.c b/arch/powerpc/sysdev/dcr.c
index a8ba9983dd5a..bb44aa9fd470 100644
--- a/arch/powerpc/sysdev/dcr.c
+++ b/arch/powerpc/sysdev/dcr.c
@@ -124,7 +124,8 @@ EXPORT_SYMBOL_GPL(dcr_write_generic);
124 124
125#endif /* defined(CONFIG_PPC_DCR_NATIVE) && defined(CONFIG_PPC_DCR_MMIO) */ 125#endif /* defined(CONFIG_PPC_DCR_NATIVE) && defined(CONFIG_PPC_DCR_MMIO) */
126 126
127unsigned int dcr_resource_start(struct device_node *np, unsigned int index) 127unsigned int dcr_resource_start(const struct device_node *np,
128 unsigned int index)
128{ 129{
129 unsigned int ds; 130 unsigned int ds;
130 const u32 *dr = of_get_property(np, "dcr-reg", &ds); 131 const u32 *dr = of_get_property(np, "dcr-reg", &ds);
@@ -136,7 +137,7 @@ unsigned int dcr_resource_start(struct device_node *np, unsigned int index)
136} 137}
137EXPORT_SYMBOL_GPL(dcr_resource_start); 138EXPORT_SYMBOL_GPL(dcr_resource_start);
138 139
139unsigned int dcr_resource_len(struct device_node *np, unsigned int index) 140unsigned int dcr_resource_len(const struct device_node *np, unsigned int index)
140{ 141{
141 unsigned int ds; 142 unsigned int ds;
142 const u32 *dr = of_get_property(np, "dcr-reg", &ds); 143 const u32 *dr = of_get_property(np, "dcr-reg", &ds);
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 5b264eb4b1f7..d5f9ae0f1b75 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -187,7 +187,7 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)
187 printk(KERN_WARNING "Can't get bus-range for %s, assume" 187 printk(KERN_WARNING "Can't get bus-range for %s, assume"
188 " bus 0\n", dev->full_name); 188 " bus 0\n", dev->full_name);
189 189
190 ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; 190 ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS);
191 hose = pcibios_alloc_controller(dev); 191 hose = pcibios_alloc_controller(dev);
192 if (!hose) 192 if (!hose)
193 return -ENOMEM; 193 return -ENOMEM;
@@ -300,7 +300,7 @@ int __init mpc83xx_add_bridge(struct device_node *dev)
300 " bus 0\n", dev->full_name); 300 " bus 0\n", dev->full_name);
301 } 301 }
302 302
303 ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; 303 ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS);
304 hose = pcibios_alloc_controller(dev); 304 hose = pcibios_alloc_controller(dev);
305 if (!hose) 305 if (!hose)
306 return -ENOMEM; 306 return -ENOMEM;
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 26ecb96f9731..115cb16351fd 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -207,236 +207,51 @@ static int __init of_add_fixed_phys(void)
207arch_initcall(of_add_fixed_phys); 207arch_initcall(of_add_fixed_phys);
208#endif /* CONFIG_FIXED_PHY */ 208#endif /* CONFIG_FIXED_PHY */
209 209
210static int gfar_mdio_of_init_one(struct device_node *np) 210#ifdef CONFIG_PPC_83xx
211{ 211static int __init mpc83xx_wdt_init(void)
212 int k;
213 struct device_node *child = NULL;
214 struct gianfar_mdio_data mdio_data;
215 struct platform_device *mdio_dev;
216 struct resource res;
217 int ret;
218
219 memset(&res, 0, sizeof(res));
220 memset(&mdio_data, 0, sizeof(mdio_data));
221
222 ret = of_address_to_resource(np, 0, &res);
223 if (ret)
224 return ret;
225
226 /* The gianfar device will try to use the same ID created below to find
227 * this bus, to coordinate register access (since they share). */
228 mdio_dev = platform_device_register_simple("fsl-gianfar_mdio",
229 res.start&0xfffff, &res, 1);
230 if (IS_ERR(mdio_dev))
231 return PTR_ERR(mdio_dev);
232
233 for (k = 0; k < 32; k++)
234 mdio_data.irq[k] = PHY_POLL;
235
236 while ((child = of_get_next_child(np, child)) != NULL) {
237 int irq = irq_of_parse_and_map(child, 0);
238 if (irq != NO_IRQ) {
239 const u32 *id = of_get_property(child, "reg", NULL);
240 mdio_data.irq[*id] = irq;
241 }
242 }
243
244 ret = platform_device_add_data(mdio_dev, &mdio_data,
245 sizeof(struct gianfar_mdio_data));
246 if (ret)
247 platform_device_unregister(mdio_dev);
248
249 return ret;
250}
251
252static int __init gfar_mdio_of_init(void)
253{
254 struct device_node *np = NULL;
255
256 for_each_compatible_node(np, NULL, "fsl,gianfar-mdio")
257 gfar_mdio_of_init_one(np);
258
259 /* try the deprecated version */
260 for_each_compatible_node(np, "mdio", "gianfar");
261 gfar_mdio_of_init_one(np);
262
263 return 0;
264}
265
266arch_initcall(gfar_mdio_of_init);
267
268static const char *gfar_tx_intr = "tx";
269static const char *gfar_rx_intr = "rx";
270static const char *gfar_err_intr = "error";
271
272static int __init gfar_of_init(void)
273{ 212{
213 struct resource r;
274 struct device_node *np; 214 struct device_node *np;
275 unsigned int i; 215 struct platform_device *dev;
276 struct platform_device *gfar_dev; 216 u32 freq = fsl_get_sys_freq();
277 struct resource res;
278 int ret; 217 int ret;
279 218
280 for (np = NULL, i = 0; 219 np = of_find_compatible_node(NULL, "watchdog", "mpc83xx_wdt");
281 (np = of_find_compatible_node(np, "network", "gianfar")) != NULL;
282 i++) {
283 struct resource r[4];
284 struct device_node *phy, *mdio;
285 struct gianfar_platform_data gfar_data;
286 const unsigned int *id;
287 const char *model;
288 const char *ctype;
289 const void *mac_addr;
290 const phandle *ph;
291 int n_res = 2;
292
293 if (!of_device_is_available(np))
294 continue;
295
296 memset(r, 0, sizeof(r));
297 memset(&gfar_data, 0, sizeof(gfar_data));
298
299 ret = of_address_to_resource(np, 0, &r[0]);
300 if (ret)
301 goto err;
302
303 of_irq_to_resource(np, 0, &r[1]);
304
305 model = of_get_property(np, "model", NULL);
306
307 /* If we aren't the FEC we have multiple interrupts */
308 if (model && strcasecmp(model, "FEC")) {
309 r[1].name = gfar_tx_intr;
310
311 r[2].name = gfar_rx_intr;
312 of_irq_to_resource(np, 1, &r[2]);
313 220
314 r[3].name = gfar_err_intr; 221 if (!np) {
315 of_irq_to_resource(np, 2, &r[3]); 222 ret = -ENODEV;
316 223 goto nodev;
317 n_res += 2; 224 }
318 }
319
320 gfar_dev =
321 platform_device_register_simple("fsl-gianfar", i, &r[0],
322 n_res);
323
324 if (IS_ERR(gfar_dev)) {
325 ret = PTR_ERR(gfar_dev);
326 goto err;
327 }
328
329 mac_addr = of_get_mac_address(np);
330 if (mac_addr)
331 memcpy(gfar_data.mac_addr, mac_addr, 6);
332
333 if (model && !strcasecmp(model, "TSEC"))
334 gfar_data.device_flags =
335 FSL_GIANFAR_DEV_HAS_GIGABIT |
336 FSL_GIANFAR_DEV_HAS_COALESCE |
337 FSL_GIANFAR_DEV_HAS_RMON |
338 FSL_GIANFAR_DEV_HAS_MULTI_INTR;
339 if (model && !strcasecmp(model, "eTSEC"))
340 gfar_data.device_flags =
341 FSL_GIANFAR_DEV_HAS_GIGABIT |
342 FSL_GIANFAR_DEV_HAS_COALESCE |
343 FSL_GIANFAR_DEV_HAS_RMON |
344 FSL_GIANFAR_DEV_HAS_MULTI_INTR |
345 FSL_GIANFAR_DEV_HAS_CSUM |
346 FSL_GIANFAR_DEV_HAS_VLAN |
347 FSL_GIANFAR_DEV_HAS_EXTENDED_HASH;
348
349 ctype = of_get_property(np, "phy-connection-type", NULL);
350
351 /* We only care about rgmii-id. The rest are autodetected */
352 if (ctype && !strcmp(ctype, "rgmii-id"))
353 gfar_data.interface = PHY_INTERFACE_MODE_RGMII_ID;
354 else
355 gfar_data.interface = PHY_INTERFACE_MODE_MII;
356
357 if (of_get_property(np, "fsl,magic-packet", NULL))
358 gfar_data.device_flags |= FSL_GIANFAR_DEV_HAS_MAGIC_PACKET;
359
360 ph = of_get_property(np, "phy-handle", NULL);
361 if (ph == NULL) {
362 u32 *fixed_link;
363
364 fixed_link = (u32 *)of_get_property(np, "fixed-link",
365 NULL);
366 if (!fixed_link) {
367 ret = -ENODEV;
368 goto unreg;
369 }
370
371 snprintf(gfar_data.bus_id, MII_BUS_ID_SIZE, "0");
372 gfar_data.phy_id = fixed_link[0];
373 } else {
374 phy = of_find_node_by_phandle(*ph);
375
376 if (phy == NULL) {
377 ret = -ENODEV;
378 goto unreg;
379 }
380
381 mdio = of_get_parent(phy);
382
383 id = of_get_property(phy, "reg", NULL);
384 ret = of_address_to_resource(mdio, 0, &res);
385 if (ret) {
386 of_node_put(phy);
387 of_node_put(mdio);
388 goto unreg;
389 }
390
391 gfar_data.phy_id = *id;
392 snprintf(gfar_data.bus_id, MII_BUS_ID_SIZE, "%llx",
393 (unsigned long long)res.start&0xfffff);
394 225
395 of_node_put(phy); 226 memset(&r, 0, sizeof(r));
396 of_node_put(mdio);
397 }
398 227
399 /* Get MDIO bus controlled by this eTSEC, if any. Normally only 228 ret = of_address_to_resource(np, 0, &r);
400 * eTSEC 1 will control an MDIO bus, not necessarily the same 229 if (ret)
401 * bus that its PHY is on ('mdio' above), so we can't just use 230 goto err;
402 * that. What we do is look for a gianfar mdio device that has
403 * overlapping registers with this device. That's really the
404 * whole point, to find the device sharing our registers to
405 * coordinate access with it.
406 */
407 for_each_compatible_node(mdio, NULL, "fsl,gianfar-mdio") {
408 if (of_address_to_resource(mdio, 0, &res))
409 continue;
410
411 if (res.start >= r[0].start && res.end <= r[0].end) {
412 /* Get the ID the mdio bus platform device was
413 * registered with. gfar_data.bus_id is
414 * different because it's for finding a PHY,
415 * while this is for finding a MII bus.
416 */
417 gfar_data.mdio_bus = res.start&0xfffff;
418 of_node_put(mdio);
419 break;
420 }
421 }
422 231
423 ret = 232 dev = platform_device_register_simple("mpc83xx_wdt", 0, &r, 1);
424 platform_device_add_data(gfar_dev, &gfar_data, 233 if (IS_ERR(dev)) {
425 sizeof(struct 234 ret = PTR_ERR(dev);
426 gianfar_platform_data)); 235 goto err;
427 if (ret)
428 goto unreg;
429 } 236 }
430 237
238 ret = platform_device_add_data(dev, &freq, sizeof(freq));
239 if (ret)
240 goto unreg;
241
242 of_node_put(np);
431 return 0; 243 return 0;
432 244
433unreg: 245unreg:
434 platform_device_unregister(gfar_dev); 246 platform_device_unregister(dev);
435err: 247err:
248 of_node_put(np);
249nodev:
436 return ret; 250 return ret;
437} 251}
438 252
439arch_initcall(gfar_of_init); 253arch_initcall(mpc83xx_wdt_init);
254#endif
440 255
441static enum fsl_usb2_phy_modes determine_usb_phy(const char *phy_type) 256static enum fsl_usb2_phy_modes determine_usb_phy(const char *phy_type)
442{ 257{
diff --git a/arch/powerpc/sysdev/grackle.c b/arch/powerpc/sysdev/grackle.c
index d502927644c6..5da37c2f22ee 100644
--- a/arch/powerpc/sysdev/grackle.c
+++ b/arch/powerpc/sysdev/grackle.c
@@ -57,7 +57,7 @@ void __init setup_grackle(struct pci_controller *hose)
57{ 57{
58 setup_indirect_pci(hose, 0xfec00000, 0xfee00000, 0); 58 setup_indirect_pci(hose, 0xfec00000, 0xfee00000, 0);
59 if (machine_is_compatible("PowerMac1,1")) 59 if (machine_is_compatible("PowerMac1,1"))
60 ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; 60 ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS);
61 if (machine_is_compatible("AAPL,PowerBook1998")) 61 if (machine_is_compatible("AAPL,PowerBook1998"))
62 grackle_set_loop_snoop(hose, 1); 62 grackle_set_loop_snoop(hose, 1);
63#if 0 /* Disabled for now, HW problems ??? */ 63#if 0 /* Disabled for now, HW problems ??? */
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 1890fb085cde..3e0d89dcdba2 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -661,17 +661,6 @@ static inline void mpic_eoi(struct mpic *mpic)
661 (void)mpic_cpu_read(MPIC_INFO(CPU_WHOAMI)); 661 (void)mpic_cpu_read(MPIC_INFO(CPU_WHOAMI));
662} 662}
663 663
664#ifdef CONFIG_SMP
665static irqreturn_t mpic_ipi_action(int irq, void *data)
666{
667 long ipi = (long)data;
668
669 smp_message_recv(ipi);
670
671 return IRQ_HANDLED;
672}
673#endif /* CONFIG_SMP */
674
675/* 664/*
676 * Linux descriptor level callbacks 665 * Linux descriptor level callbacks
677 */ 666 */
@@ -817,7 +806,7 @@ static void mpic_end_ipi(unsigned int irq)
817 806
818#endif /* CONFIG_SMP */ 807#endif /* CONFIG_SMP */
819 808
820void mpic_set_affinity(unsigned int irq, cpumask_t cpumask) 809void mpic_set_affinity(unsigned int irq, const struct cpumask *cpumask)
821{ 810{
822 struct mpic *mpic = mpic_from_irq(irq); 811 struct mpic *mpic = mpic_from_irq(irq);
823 unsigned int src = mpic_irq_to_hw(irq); 812 unsigned int src = mpic_irq_to_hw(irq);
@@ -829,7 +818,7 @@ void mpic_set_affinity(unsigned int irq, cpumask_t cpumask)
829 } else { 818 } else {
830 cpumask_t tmp; 819 cpumask_t tmp;
831 820
832 cpus_and(tmp, cpumask, cpu_online_map); 821 cpumask_and(&tmp, cpumask, cpu_online_mask);
833 822
834 mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 823 mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION),
835 mpic_physmask(cpus_addr(tmp)[0])); 824 mpic_physmask(cpus_addr(tmp)[0]));
@@ -1548,13 +1537,7 @@ unsigned int mpic_get_mcirq(void)
1548void mpic_request_ipis(void) 1537void mpic_request_ipis(void)
1549{ 1538{
1550 struct mpic *mpic = mpic_primary; 1539 struct mpic *mpic = mpic_primary;
1551 long i, err; 1540 int i;
1552 static char *ipi_names[] = {
1553 "IPI0 (call function)",
1554 "IPI1 (reschedule)",
1555 "IPI2 (call function single)",
1556 "IPI3 (debugger break)",
1557 };
1558 BUG_ON(mpic == NULL); 1541 BUG_ON(mpic == NULL);
1559 1542
1560 printk(KERN_INFO "mpic: requesting IPIs ... \n"); 1543 printk(KERN_INFO "mpic: requesting IPIs ... \n");
@@ -1563,17 +1546,10 @@ void mpic_request_ipis(void)
1563 unsigned int vipi = irq_create_mapping(mpic->irqhost, 1546 unsigned int vipi = irq_create_mapping(mpic->irqhost,
1564 mpic->ipi_vecs[0] + i); 1547 mpic->ipi_vecs[0] + i);
1565 if (vipi == NO_IRQ) { 1548 if (vipi == NO_IRQ) {
1566 printk(KERN_ERR "Failed to map IPI %ld\n", i); 1549 printk(KERN_ERR "Failed to map %s\n", smp_ipi_name[i]);
1567 break; 1550 continue;
1568 }
1569 err = request_irq(vipi, mpic_ipi_action,
1570 IRQF_DISABLED|IRQF_PERCPU,
1571 ipi_names[i], (void *)i);
1572 if (err) {
1573 printk(KERN_ERR "Request of irq %d for IPI %ld failed\n",
1574 vipi, i);
1575 break;
1576 } 1551 }
1552 smp_request_message_ipi(vipi, i);
1577 } 1553 }
1578} 1554}
1579 1555
diff --git a/arch/powerpc/sysdev/mpic.h b/arch/powerpc/sysdev/mpic.h
index 6209c62a426d..3cef2af10f42 100644
--- a/arch/powerpc/sysdev/mpic.h
+++ b/arch/powerpc/sysdev/mpic.h
@@ -36,6 +36,6 @@ static inline int mpic_pasemi_msi_init(struct mpic *mpic)
36 36
37extern int mpic_set_irq_type(unsigned int virq, unsigned int flow_type); 37extern int mpic_set_irq_type(unsigned int virq, unsigned int flow_type);
38extern void mpic_set_vector(unsigned int virq, unsigned int vector); 38extern void mpic_set_vector(unsigned int virq, unsigned int vector);
39extern void mpic_set_affinity(unsigned int irq, cpumask_t cpumask); 39extern void mpic_set_affinity(unsigned int irq, const struct cpumask *cpumask);
40 40
41#endif /* _POWERPC_SYSDEV_MPIC_H */ 41#endif /* _POWERPC_SYSDEV_MPIC_H */
diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c
index d3e4d61030b5..77fae5f64f2e 100644
--- a/arch/powerpc/sysdev/ppc4xx_pci.c
+++ b/arch/powerpc/sysdev/ppc4xx_pci.c
@@ -194,11 +194,41 @@ static int __init ppc4xx_parse_dma_ranges(struct pci_controller *hose,
194 * 4xx PCI 2.x part 194 * 4xx PCI 2.x part
195 */ 195 */
196 196
197static int __init ppc4xx_setup_one_pci_PMM(struct pci_controller *hose,
198 void __iomem *reg,
199 u64 plb_addr,
200 u64 pci_addr,
201 u64 size,
202 unsigned int flags,
203 int index)
204{
205 u32 ma, pcila, pciha;
206
207 if ((plb_addr + size) > 0xffffffffull || !is_power_of_2(size) ||
208 size < 0x1000 || (plb_addr & (size - 1)) != 0) {
209 printk(KERN_WARNING "%s: Resource out of range\n",
210 hose->dn->full_name);
211 return -1;
212 }
213 ma = (0xffffffffu << ilog2(size)) | 1;
214 if (flags & IORESOURCE_PREFETCH)
215 ma |= 2;
216
217 pciha = RES_TO_U32_HIGH(pci_addr);
218 pcila = RES_TO_U32_LOW(pci_addr);
219
220 writel(plb_addr, reg + PCIL0_PMM0LA + (0x10 * index));
221 writel(pcila, reg + PCIL0_PMM0PCILA + (0x10 * index));
222 writel(pciha, reg + PCIL0_PMM0PCIHA + (0x10 * index));
223 writel(ma, reg + PCIL0_PMM0MA + (0x10 * index));
224
225 return 0;
226}
227
197static void __init ppc4xx_configure_pci_PMMs(struct pci_controller *hose, 228static void __init ppc4xx_configure_pci_PMMs(struct pci_controller *hose,
198 void __iomem *reg) 229 void __iomem *reg)
199{ 230{
200 u32 la, ma, pcila, pciha; 231 int i, j, found_isa_hole = 0;
201 int i, j;
202 232
203 /* Setup outbound memory windows */ 233 /* Setup outbound memory windows */
204 for (i = j = 0; i < 3; i++) { 234 for (i = j = 0; i < 3; i++) {
@@ -213,28 +243,29 @@ static void __init ppc4xx_configure_pci_PMMs(struct pci_controller *hose,
213 break; 243 break;
214 } 244 }
215 245
216 /* Calculate register values */ 246 /* Configure the resource */
217 la = res->start; 247 if (ppc4xx_setup_one_pci_PMM(hose, reg,
218 pciha = RES_TO_U32_HIGH(res->start - hose->pci_mem_offset); 248 res->start,
219 pcila = RES_TO_U32_LOW(res->start - hose->pci_mem_offset); 249 res->start - hose->pci_mem_offset,
220 250 res->end + 1 - res->start,
221 ma = res->end + 1 - res->start; 251 res->flags,
222 if (!is_power_of_2(ma) || ma < 0x1000 || ma > 0xffffffffu) { 252 j) == 0) {
223 printk(KERN_WARNING "%s: Resource out of range\n", 253 j++;
224 hose->dn->full_name); 254
225 continue; 255 /* If the resource PCI address is 0 then we have our
256 * ISA memory hole
257 */
258 if (res->start == hose->pci_mem_offset)
259 found_isa_hole = 1;
226 } 260 }
227 ma = (0xffffffffu << ilog2(ma)) | 0x1;
228 if (res->flags & IORESOURCE_PREFETCH)
229 ma |= 0x2;
230
231 /* Program register values */
232 writel(la, reg + PCIL0_PMM0LA + (0x10 * j));
233 writel(pcila, reg + PCIL0_PMM0PCILA + (0x10 * j));
234 writel(pciha, reg + PCIL0_PMM0PCIHA + (0x10 * j));
235 writel(ma, reg + PCIL0_PMM0MA + (0x10 * j));
236 j++;
237 } 261 }
262
263 /* Handle ISA memory hole if not already covered */
264 if (j <= 2 && !found_isa_hole && hose->isa_mem_size)
265 if (ppc4xx_setup_one_pci_PMM(hose, reg, hose->isa_mem_phys, 0,
266 hose->isa_mem_size, 0, j) == 0)
267 printk(KERN_INFO "%s: Legacy ISA memory support enabled\n",
268 hose->dn->full_name);
238} 269}
239 270
240static void __init ppc4xx_configure_pci_PTMs(struct pci_controller *hose, 271static void __init ppc4xx_configure_pci_PTMs(struct pci_controller *hose,
@@ -352,11 +383,52 @@ static void __init ppc4xx_probe_pci_bridge(struct device_node *np)
352 * 4xx PCI-X part 383 * 4xx PCI-X part
353 */ 384 */
354 385
386static int __init ppc4xx_setup_one_pcix_POM(struct pci_controller *hose,
387 void __iomem *reg,
388 u64 plb_addr,
389 u64 pci_addr,
390 u64 size,
391 unsigned int flags,
392 int index)
393{
394 u32 lah, lal, pciah, pcial, sa;
395
396 if (!is_power_of_2(size) || size < 0x1000 ||
397 (plb_addr & (size - 1)) != 0) {
398 printk(KERN_WARNING "%s: Resource out of range\n",
399 hose->dn->full_name);
400 return -1;
401 }
402
403 /* Calculate register values */
404 lah = RES_TO_U32_HIGH(plb_addr);
405 lal = RES_TO_U32_LOW(plb_addr);
406 pciah = RES_TO_U32_HIGH(pci_addr);
407 pcial = RES_TO_U32_LOW(pci_addr);
408 sa = (0xffffffffu << ilog2(size)) | 0x1;
409
410 /* Program register values */
411 if (index == 0) {
412 writel(lah, reg + PCIX0_POM0LAH);
413 writel(lal, reg + PCIX0_POM0LAL);
414 writel(pciah, reg + PCIX0_POM0PCIAH);
415 writel(pcial, reg + PCIX0_POM0PCIAL);
416 writel(sa, reg + PCIX0_POM0SA);
417 } else {
418 writel(lah, reg + PCIX0_POM1LAH);
419 writel(lal, reg + PCIX0_POM1LAL);
420 writel(pciah, reg + PCIX0_POM1PCIAH);
421 writel(pcial, reg + PCIX0_POM1PCIAL);
422 writel(sa, reg + PCIX0_POM1SA);
423 }
424
425 return 0;
426}
427
355static void __init ppc4xx_configure_pcix_POMs(struct pci_controller *hose, 428static void __init ppc4xx_configure_pcix_POMs(struct pci_controller *hose,
356 void __iomem *reg) 429 void __iomem *reg)
357{ 430{
358 u32 lah, lal, pciah, pcial, sa; 431 int i, j, found_isa_hole = 0;
359 int i, j;
360 432
361 /* Setup outbound memory windows */ 433 /* Setup outbound memory windows */
362 for (i = j = 0; i < 3; i++) { 434 for (i = j = 0; i < 3; i++) {
@@ -371,36 +443,29 @@ static void __init ppc4xx_configure_pcix_POMs(struct pci_controller *hose,
371 break; 443 break;
372 } 444 }
373 445
374 /* Calculate register values */ 446 /* Configure the resource */
375 lah = RES_TO_U32_HIGH(res->start); 447 if (ppc4xx_setup_one_pcix_POM(hose, reg,
376 lal = RES_TO_U32_LOW(res->start); 448 res->start,
377 pciah = RES_TO_U32_HIGH(res->start - hose->pci_mem_offset); 449 res->start - hose->pci_mem_offset,
378 pcial = RES_TO_U32_LOW(res->start - hose->pci_mem_offset); 450 res->end + 1 - res->start,
379 sa = res->end + 1 - res->start; 451 res->flags,
380 if (!is_power_of_2(sa) || sa < 0x100000 || 452 j) == 0) {
381 sa > 0xffffffffu) { 453 j++;
382 printk(KERN_WARNING "%s: Resource out of range\n", 454
383 hose->dn->full_name); 455 /* If the resource PCI address is 0 then we have our
384 continue; 456 * ISA memory hole
457 */
458 if (res->start == hose->pci_mem_offset)
459 found_isa_hole = 1;
385 } 460 }
386 sa = (0xffffffffu << ilog2(sa)) | 0x1;
387
388 /* Program register values */
389 if (j == 0) {
390 writel(lah, reg + PCIX0_POM0LAH);
391 writel(lal, reg + PCIX0_POM0LAL);
392 writel(pciah, reg + PCIX0_POM0PCIAH);
393 writel(pcial, reg + PCIX0_POM0PCIAL);
394 writel(sa, reg + PCIX0_POM0SA);
395 } else {
396 writel(lah, reg + PCIX0_POM1LAH);
397 writel(lal, reg + PCIX0_POM1LAL);
398 writel(pciah, reg + PCIX0_POM1PCIAH);
399 writel(pcial, reg + PCIX0_POM1PCIAL);
400 writel(sa, reg + PCIX0_POM1SA);
401 }
402 j++;
403 } 461 }
462
463 /* Handle ISA memory hole if not already covered */
464 if (j <= 1 && !found_isa_hole && hose->isa_mem_size)
465 if (ppc4xx_setup_one_pcix_POM(hose, reg, hose->isa_mem_phys, 0,
466 hose->isa_mem_size, 0, j) == 0)
467 printk(KERN_INFO "%s: Legacy ISA memory support enabled\n",
468 hose->dn->full_name);
404} 469}
405 470
406static void __init ppc4xx_configure_pcix_PIMs(struct pci_controller *hose, 471static void __init ppc4xx_configure_pcix_PIMs(struct pci_controller *hose,
@@ -1317,12 +1382,72 @@ static struct pci_ops ppc4xx_pciex_pci_ops =
1317 .write = ppc4xx_pciex_write_config, 1382 .write = ppc4xx_pciex_write_config,
1318}; 1383};
1319 1384
1385static int __init ppc4xx_setup_one_pciex_POM(struct ppc4xx_pciex_port *port,
1386 struct pci_controller *hose,
1387 void __iomem *mbase,
1388 u64 plb_addr,
1389 u64 pci_addr,
1390 u64 size,
1391 unsigned int flags,
1392 int index)
1393{
1394 u32 lah, lal, pciah, pcial, sa;
1395
1396 if (!is_power_of_2(size) ||
1397 (index < 2 && size < 0x100000) ||
1398 (index == 2 && size < 0x100) ||
1399 (plb_addr & (size - 1)) != 0) {
1400 printk(KERN_WARNING "%s: Resource out of range\n",
1401 hose->dn->full_name);
1402 return -1;
1403 }
1404
1405 /* Calculate register values */
1406 lah = RES_TO_U32_HIGH(plb_addr);
1407 lal = RES_TO_U32_LOW(plb_addr);
1408 pciah = RES_TO_U32_HIGH(pci_addr);
1409 pcial = RES_TO_U32_LOW(pci_addr);
1410 sa = (0xffffffffu << ilog2(size)) | 0x1;
1411
1412 /* Program register values */
1413 switch (index) {
1414 case 0:
1415 out_le32(mbase + PECFG_POM0LAH, pciah);
1416 out_le32(mbase + PECFG_POM0LAL, pcial);
1417 dcr_write(port->dcrs, DCRO_PEGPL_OMR1BAH, lah);
1418 dcr_write(port->dcrs, DCRO_PEGPL_OMR1BAL, lal);
1419 dcr_write(port->dcrs, DCRO_PEGPL_OMR1MSKH, 0x7fffffff);
1420 /* Note that 3 here means enabled | single region */
1421 dcr_write(port->dcrs, DCRO_PEGPL_OMR1MSKL, sa | 3);
1422 break;
1423 case 1:
1424 out_le32(mbase + PECFG_POM1LAH, pciah);
1425 out_le32(mbase + PECFG_POM1LAL, pcial);
1426 dcr_write(port->dcrs, DCRO_PEGPL_OMR2BAH, lah);
1427 dcr_write(port->dcrs, DCRO_PEGPL_OMR2BAL, lal);
1428 dcr_write(port->dcrs, DCRO_PEGPL_OMR2MSKH, 0x7fffffff);
1429 /* Note that 3 here means enabled | single region */
1430 dcr_write(port->dcrs, DCRO_PEGPL_OMR2MSKL, sa | 3);
1431 break;
1432 case 2:
1433 out_le32(mbase + PECFG_POM2LAH, pciah);
1434 out_le32(mbase + PECFG_POM2LAL, pcial);
1435 dcr_write(port->dcrs, DCRO_PEGPL_OMR3BAH, lah);
1436 dcr_write(port->dcrs, DCRO_PEGPL_OMR3BAL, lal);
1437 dcr_write(port->dcrs, DCRO_PEGPL_OMR3MSKH, 0x7fffffff);
1438 /* Note that 3 here means enabled | IO space !!! */
1439 dcr_write(port->dcrs, DCRO_PEGPL_OMR3MSKL, sa | 3);
1440 break;
1441 }
1442
1443 return 0;
1444}
1445
1320static void __init ppc4xx_configure_pciex_POMs(struct ppc4xx_pciex_port *port, 1446static void __init ppc4xx_configure_pciex_POMs(struct ppc4xx_pciex_port *port,
1321 struct pci_controller *hose, 1447 struct pci_controller *hose,
1322 void __iomem *mbase) 1448 void __iomem *mbase)
1323{ 1449{
1324 u32 lah, lal, pciah, pcial, sa; 1450 int i, j, found_isa_hole = 0;
1325 int i, j;
1326 1451
1327 /* Setup outbound memory windows */ 1452 /* Setup outbound memory windows */
1328 for (i = j = 0; i < 3; i++) { 1453 for (i = j = 0; i < 3; i++) {
@@ -1337,53 +1462,38 @@ static void __init ppc4xx_configure_pciex_POMs(struct ppc4xx_pciex_port *port,
1337 break; 1462 break;
1338 } 1463 }
1339 1464
1340 /* Calculate register values */ 1465 /* Configure the resource */
1341 lah = RES_TO_U32_HIGH(res->start); 1466 if (ppc4xx_setup_one_pciex_POM(port, hose, mbase,
1342 lal = RES_TO_U32_LOW(res->start); 1467 res->start,
1343 pciah = RES_TO_U32_HIGH(res->start - hose->pci_mem_offset); 1468 res->start - hose->pci_mem_offset,
1344 pcial = RES_TO_U32_LOW(res->start - hose->pci_mem_offset); 1469 res->end + 1 - res->start,
1345 sa = res->end + 1 - res->start; 1470 res->flags,
1346 if (!is_power_of_2(sa) || sa < 0x100000 || 1471 j) == 0) {
1347 sa > 0xffffffffu) { 1472 j++;
1348 printk(KERN_WARNING "%s: Resource out of range\n", 1473
1349 port->node->full_name); 1474 /* If the resource PCI address is 0 then we have our
1350 continue; 1475 * ISA memory hole
1351 } 1476 */
1352 sa = (0xffffffffu << ilog2(sa)) | 0x1; 1477 if (res->start == hose->pci_mem_offset)
1353 1478 found_isa_hole = 1;
1354 /* Program register values */
1355 switch (j) {
1356 case 0:
1357 out_le32(mbase + PECFG_POM0LAH, pciah);
1358 out_le32(mbase + PECFG_POM0LAL, pcial);
1359 dcr_write(port->dcrs, DCRO_PEGPL_OMR1BAH, lah);
1360 dcr_write(port->dcrs, DCRO_PEGPL_OMR1BAL, lal);
1361 dcr_write(port->dcrs, DCRO_PEGPL_OMR1MSKH, 0x7fffffff);
1362 dcr_write(port->dcrs, DCRO_PEGPL_OMR1MSKL, sa | 3);
1363 break;
1364 case 1:
1365 out_le32(mbase + PECFG_POM1LAH, pciah);
1366 out_le32(mbase + PECFG_POM1LAL, pcial);
1367 dcr_write(port->dcrs, DCRO_PEGPL_OMR2BAH, lah);
1368 dcr_write(port->dcrs, DCRO_PEGPL_OMR2BAL, lal);
1369 dcr_write(port->dcrs, DCRO_PEGPL_OMR2MSKH, 0x7fffffff);
1370 dcr_write(port->dcrs, DCRO_PEGPL_OMR2MSKL, sa | 3);
1371 break;
1372 } 1479 }
1373 j++;
1374 } 1480 }
1375 1481
1376 /* Configure IO, always 64K starting at 0 */ 1482 /* Handle ISA memory hole if not already covered */
1377 if (hose->io_resource.flags & IORESOURCE_IO) { 1483 if (j <= 1 && !found_isa_hole && hose->isa_mem_size)
1378 lah = RES_TO_U32_HIGH(hose->io_base_phys); 1484 if (ppc4xx_setup_one_pciex_POM(port, hose, mbase,
1379 lal = RES_TO_U32_LOW(hose->io_base_phys); 1485 hose->isa_mem_phys, 0,
1380 out_le32(mbase + PECFG_POM2LAH, 0); 1486 hose->isa_mem_size, 0, j) == 0)
1381 out_le32(mbase + PECFG_POM2LAL, 0); 1487 printk(KERN_INFO "%s: Legacy ISA memory support enabled\n",
1382 dcr_write(port->dcrs, DCRO_PEGPL_OMR3BAH, lah); 1488 hose->dn->full_name);
1383 dcr_write(port->dcrs, DCRO_PEGPL_OMR3BAL, lal); 1489
1384 dcr_write(port->dcrs, DCRO_PEGPL_OMR3MSKH, 0x7fffffff); 1490 /* Configure IO, always 64K starting at 0. We hard wire it to 64K !
1385 dcr_write(port->dcrs, DCRO_PEGPL_OMR3MSKL, 0xffff0000 | 3); 1491 * Note also that it -has- to be region index 2 on this HW
1386 } 1492 */
1493 if (hose->io_resource.flags & IORESOURCE_IO)
1494 ppc4xx_setup_one_pciex_POM(port, hose, mbase,
1495 hose->io_base_phys, 0,
1496 0x10000, IORESOURCE_IO, 2);
1387} 1497}
1388 1498
1389static void __init ppc4xx_configure_pciex_PIMs(struct ppc4xx_pciex_port *port, 1499static void __init ppc4xx_configure_pciex_PIMs(struct ppc4xx_pciex_port *port,
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index b3b73ae57d6d..01bce3784b0a 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -19,6 +19,7 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/param.h> 20#include <linux/param.h>
21#include <linux/string.h> 21#include <linux/string.h>
22#include <linux/spinlock.h>
22#include <linux/mm.h> 23#include <linux/mm.h>
23#include <linux/interrupt.h> 24#include <linux/interrupt.h>
24#include <linux/bootmem.h> 25#include <linux/bootmem.h>
@@ -38,6 +39,8 @@ static void qe_snums_init(void);
38static int qe_sdma_init(void); 39static int qe_sdma_init(void);
39 40
40static DEFINE_SPINLOCK(qe_lock); 41static DEFINE_SPINLOCK(qe_lock);
42DEFINE_SPINLOCK(cmxgcr_lock);
43EXPORT_SYMBOL(cmxgcr_lock);
41 44
42/* QE snum state */ 45/* QE snum state */
43enum qe_snum_state { 46enum qe_snum_state {
diff --git a/arch/powerpc/sysdev/qe_lib/ucc.c b/arch/powerpc/sysdev/qe_lib/ucc.c
index 1d78071aad7d..ebb442ea1917 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc.c
+++ b/arch/powerpc/sysdev/qe_lib/ucc.c
@@ -18,6 +18,7 @@
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/stddef.h> 20#include <linux/stddef.h>
21#include <linux/spinlock.h>
21#include <linux/module.h> 22#include <linux/module.h>
22 23
23#include <asm/irq.h> 24#include <asm/irq.h>
@@ -26,9 +27,6 @@
26#include <asm/qe.h> 27#include <asm/qe.h>
27#include <asm/ucc.h> 28#include <asm/ucc.h>
28 29
29DEFINE_SPINLOCK(cmxgcr_lock);
30EXPORT_SYMBOL(cmxgcr_lock);
31
32int ucc_set_qe_mux_mii_mng(unsigned int ucc_num) 30int ucc_set_qe_mux_mii_mng(unsigned int ucc_num)
33{ 31{
34 unsigned long flags; 32 unsigned long flags;
diff --git a/arch/powerpc/xmon/Makefile b/arch/powerpc/xmon/Makefile
index 51d97588e762..9cb03b71b9d6 100644
--- a/arch/powerpc/xmon/Makefile
+++ b/arch/powerpc/xmon/Makefile
@@ -4,7 +4,7 @@ ifdef CONFIG_PPC64
4EXTRA_CFLAGS += -mno-minimal-toc 4EXTRA_CFLAGS += -mno-minimal-toc
5endif 5endif
6 6
7obj-y += xmon.o setjmp.o start.o nonstdio.o 7obj-y += xmon.o start.o nonstdio.o
8 8
9ifdef CONFIG_XMON_DISASSEMBLY 9ifdef CONFIG_XMON_DISASSEMBLY
10obj-y += ppc-dis.o ppc-opc.o 10obj-y += ppc-dis.o ppc-opc.o
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 076368c8b8a9..8dfad7d9a004 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -41,6 +41,7 @@
41#include <asm/spu_priv1.h> 41#include <asm/spu_priv1.h>
42#include <asm/firmware.h> 42#include <asm/firmware.h>
43#include <asm/setjmp.h> 43#include <asm/setjmp.h>
44#include <asm/reg.h>
44 45
45#ifdef CONFIG_PPC64 46#ifdef CONFIG_PPC64
46#include <asm/hvcall.h> 47#include <asm/hvcall.h>
@@ -159,8 +160,6 @@ static int xmon_no_auto_backtrace;
159extern void xmon_enter(void); 160extern void xmon_enter(void);
160extern void xmon_leave(void); 161extern void xmon_leave(void);
161 162
162extern void xmon_save_regs(struct pt_regs *);
163
164#ifdef CONFIG_PPC64 163#ifdef CONFIG_PPC64
165#define REG "%.16lx" 164#define REG "%.16lx"
166#define REGS_PER_LINE 4 165#define REGS_PER_LINE 4
@@ -532,7 +531,7 @@ int xmon(struct pt_regs *excp)
532 struct pt_regs regs; 531 struct pt_regs regs;
533 532
534 if (excp == NULL) { 533 if (excp == NULL) {
535 xmon_save_regs(&regs); 534 ppc_save_regs(&regs);
536 excp = &regs; 535 excp = &regs;
537 } 536 }
538 537
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 8116a3328a19..19577aeffd7b 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -43,6 +43,9 @@ config GENERIC_HWEIGHT
43config GENERIC_TIME 43config GENERIC_TIME
44 def_bool y 44 def_bool y
45 45
46config GENERIC_TIME_VSYSCALL
47 def_bool y
48
46config GENERIC_CLOCKEVENTS 49config GENERIC_CLOCKEVENTS
47 def_bool y 50 def_bool y
48 51
@@ -66,15 +69,21 @@ config PGSTE
66 bool 69 bool
67 default y if KVM 70 default y if KVM
68 71
72config VIRT_CPU_ACCOUNTING
73 def_bool y
74
69mainmenu "Linux Kernel Configuration" 75mainmenu "Linux Kernel Configuration"
70 76
71config S390 77config S390
72 def_bool y 78 def_bool y
79 select USE_GENERIC_SMP_HELPERS if SMP
80 select HAVE_FUNCTION_TRACER
73 select HAVE_OPROFILE 81 select HAVE_OPROFILE
74 select HAVE_KPROBES 82 select HAVE_KPROBES
75 select HAVE_KRETPROBES 83 select HAVE_KRETPROBES
76 select HAVE_KVM if 64BIT 84 select HAVE_KVM if 64BIT
77 select HAVE_ARCH_TRACEHOOK 85 select HAVE_ARCH_TRACEHOOK
86 select INIT_ALL_POSSIBLE
78 87
79source "init/Kconfig" 88source "init/Kconfig"
80 89
@@ -225,6 +234,14 @@ config MARCH_Z9_109
225 Class (z9 BC). The kernel will be slightly faster but will not 234 Class (z9 BC). The kernel will be slightly faster but will not
226 work on older machines such as the z990, z890, z900, and z800. 235 work on older machines such as the z990, z890, z900, and z800.
227 236
237config MARCH_Z10
238 bool "IBM System z10"
239 help
240 Select this to enable optimizations for IBM System z10. The
241 kernel will be slightly faster but will not work on older
242 machines such as the z990, z890, z900, z800, z9-109, z9-ec
243 and z9-bc.
244
228endchoice 245endchoice
229 246
230config PACK_STACK 247config PACK_STACK
@@ -343,16 +360,6 @@ config QDIO
343 360
344 If unsure, say Y. 361 If unsure, say Y.
345 362
346config QDIO_DEBUG
347 bool "Extended debugging information"
348 depends on QDIO
349 help
350 Say Y here to get extended debugging output in
351 /sys/kernel/debug/s390dbf/qdio...
352 Warning: this option reduces the performance of the QDIO module.
353
354 If unsure, say N.
355
356config CHSC_SCH 363config CHSC_SCH
357 tristate "Support for CHSC subchannels" 364 tristate "Support for CHSC subchannels"
358 help 365 help
@@ -466,22 +473,9 @@ config PAGE_STATES
466 hypervisor. The ESSA instruction is used to do the states 473 hypervisor. The ESSA instruction is used to do the states
467 changes between a page that has content and the unused state. 474 changes between a page that has content and the unused state.
468 475
469config VIRT_TIMER
470 bool "Virtual CPU timer support"
471 help
472 This provides a kernel interface for virtual CPU timers.
473 Default is disabled.
474
475config VIRT_CPU_ACCOUNTING
476 bool "Base user process accounting on virtual cpu timer"
477 depends on VIRT_TIMER
478 help
479 Select this option to use CPU timer deltas to do user
480 process accounting.
481
482config APPLDATA_BASE 476config APPLDATA_BASE
483 bool "Linux - VM Monitor Stream, base infrastructure" 477 bool "Linux - VM Monitor Stream, base infrastructure"
484 depends on PROC_FS && VIRT_TIMER=y 478 depends on PROC_FS
485 help 479 help
486 This provides a kernel interface for creating and updating z/VM APPLDATA 480 This provides a kernel interface for creating and updating z/VM APPLDATA
487 monitor records. The monitor records are updated at certain time 481 monitor records. The monitor records are updated at certain time
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index 792a4e7743ce..578c61f15a4b 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -34,6 +34,7 @@ cflags-$(CONFIG_MARCH_G5) += $(call cc-option,-march=g5)
34cflags-$(CONFIG_MARCH_Z900) += $(call cc-option,-march=z900) 34cflags-$(CONFIG_MARCH_Z900) += $(call cc-option,-march=z900)
35cflags-$(CONFIG_MARCH_Z990) += $(call cc-option,-march=z990) 35cflags-$(CONFIG_MARCH_Z990) += $(call cc-option,-march=z990)
36cflags-$(CONFIG_MARCH_Z9_109) += $(call cc-option,-march=z9-109) 36cflags-$(CONFIG_MARCH_Z9_109) += $(call cc-option,-march=z9-109)
37cflags-$(CONFIG_MARCH_Z10) += $(call cc-option,-march=z10)
37 38
38#KBUILD_IMAGE is necessary for make rpm 39#KBUILD_IMAGE is necessary for make rpm
39KBUILD_IMAGE :=arch/s390/boot/image 40KBUILD_IMAGE :=arch/s390/boot/image
diff --git a/arch/s390/appldata/appldata.h b/arch/s390/appldata/appldata.h
index 17a2636fec0a..f0b23fc759ba 100644
--- a/arch/s390/appldata/appldata.h
+++ b/arch/s390/appldata/appldata.h
@@ -26,10 +26,6 @@
26#define CTL_APPLDATA_NET_SUM 2125 26#define CTL_APPLDATA_NET_SUM 2125
27#define CTL_APPLDATA_PROC 2126 27#define CTL_APPLDATA_PROC 2126
28 28
29#define P_INFO(x...) printk(KERN_INFO MY_PRINT_NAME " info: " x)
30#define P_ERROR(x...) printk(KERN_ERR MY_PRINT_NAME " error: " x)
31#define P_WARNING(x...) printk(KERN_WARNING MY_PRINT_NAME " status: " x)
32
33struct appldata_ops { 29struct appldata_ops {
34 struct list_head list; 30 struct list_head list;
35 struct ctl_table_header *sysctl_header; 31 struct ctl_table_header *sysctl_header;
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index a06a47cdd5e0..27b70d8a359c 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -10,6 +10,9 @@
10 * Author: Gerald Schaefer <gerald.schaefer@de.ibm.com> 10 * Author: Gerald Schaefer <gerald.schaefer@de.ibm.com>
11 */ 11 */
12 12
13#define KMSG_COMPONENT "appldata"
14#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
15
13#include <linux/module.h> 16#include <linux/module.h>
14#include <linux/init.h> 17#include <linux/init.h>
15#include <linux/slab.h> 18#include <linux/slab.h>
@@ -32,7 +35,6 @@
32#include "appldata.h" 35#include "appldata.h"
33 36
34 37
35#define MY_PRINT_NAME "appldata" /* for debug messages, etc. */
36#define APPLDATA_CPU_INTERVAL 10000 /* default (CPU) time for 38#define APPLDATA_CPU_INTERVAL 10000 /* default (CPU) time for
37 sampling interval in 39 sampling interval in
38 milliseconds */ 40 milliseconds */
@@ -390,8 +392,8 @@ appldata_generic_handler(ctl_table *ctl, int write, struct file *filp,
390 (unsigned long) ops->data, ops->size, 392 (unsigned long) ops->data, ops->size,
391 ops->mod_lvl); 393 ops->mod_lvl);
392 if (rc != 0) { 394 if (rc != 0) {
393 P_ERROR("START DIAG 0xDC for %s failed, " 395 pr_err("Starting the data collection for %s "
394 "return code: %d\n", ops->name, rc); 396 "failed with rc=%d\n", ops->name, rc);
395 module_put(ops->owner); 397 module_put(ops->owner);
396 } else 398 } else
397 ops->active = 1; 399 ops->active = 1;
@@ -401,8 +403,8 @@ appldata_generic_handler(ctl_table *ctl, int write, struct file *filp,
401 (unsigned long) ops->data, ops->size, 403 (unsigned long) ops->data, ops->size,
402 ops->mod_lvl); 404 ops->mod_lvl);
403 if (rc != 0) 405 if (rc != 0)
404 P_ERROR("STOP DIAG 0xDC for %s failed, " 406 pr_err("Stopping the data collection for %s "
405 "return code: %d\n", ops->name, rc); 407 "failed with rc=%d\n", ops->name, rc);
406 module_put(ops->owner); 408 module_put(ops->owner);
407 } 409 }
408 spin_unlock(&appldata_ops_lock); 410 spin_unlock(&appldata_ops_lock);
diff --git a/arch/s390/appldata/appldata_net_sum.c b/arch/s390/appldata/appldata_net_sum.c
index 3b746556e1a3..fa741f84c5b9 100644
--- a/arch/s390/appldata/appldata_net_sum.c
+++ b/arch/s390/appldata/appldata_net_sum.c
@@ -67,7 +67,6 @@ static void appldata_get_net_sum_data(void *data)
67 int i; 67 int i;
68 struct appldata_net_sum_data *net_data; 68 struct appldata_net_sum_data *net_data;
69 struct net_device *dev; 69 struct net_device *dev;
70 struct net_device_stats *stats;
71 unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes, rx_errors, 70 unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes, rx_errors,
72 tx_errors, rx_dropped, tx_dropped, collisions; 71 tx_errors, rx_dropped, tx_dropped, collisions;
73 72
@@ -86,7 +85,8 @@ static void appldata_get_net_sum_data(void *data)
86 collisions = 0; 85 collisions = 0;
87 read_lock(&dev_base_lock); 86 read_lock(&dev_base_lock);
88 for_each_netdev(&init_net, dev) { 87 for_each_netdev(&init_net, dev) {
89 stats = dev->get_stats(dev); 88 const struct net_device_stats *stats = dev_get_stats(dev);
89
90 rx_packets += stats->rx_packets; 90 rx_packets += stats->rx_packets;
91 tx_packets += stats->tx_packets; 91 tx_packets += stats->tx_packets;
92 rx_bytes += stats->rx_bytes; 92 rx_bytes += stats->rx_bytes;
diff --git a/arch/s390/appldata/appldata_os.c b/arch/s390/appldata/appldata_os.c
index eb44f9f8ab91..55c80ffd42b9 100644
--- a/arch/s390/appldata/appldata_os.c
+++ b/arch/s390/appldata/appldata_os.c
@@ -9,6 +9,9 @@
9 * Author: Gerald Schaefer <gerald.schaefer@de.ibm.com> 9 * Author: Gerald Schaefer <gerald.schaefer@de.ibm.com>
10 */ 10 */
11 11
12#define KMSG_COMPONENT "appldata"
13#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
14
12#include <linux/module.h> 15#include <linux/module.h>
13#include <linux/init.h> 16#include <linux/init.h>
14#include <linux/slab.h> 17#include <linux/slab.h>
@@ -22,7 +25,6 @@
22#include "appldata.h" 25#include "appldata.h"
23 26
24 27
25#define MY_PRINT_NAME "appldata_os" /* for debug messages, etc. */
26#define LOAD_INT(x) ((x) >> FSHIFT) 28#define LOAD_INT(x) ((x) >> FSHIFT)
27#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100) 29#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
28 30
@@ -143,21 +145,16 @@ static void appldata_get_os_data(void *data)
143 (unsigned long) ops.data, new_size, 145 (unsigned long) ops.data, new_size,
144 ops.mod_lvl); 146 ops.mod_lvl);
145 if (rc != 0) 147 if (rc != 0)
146 P_ERROR("os: START NEW DIAG 0xDC failed, " 148 pr_err("Starting a new OS data collection "
147 "return code: %d, new size = %i\n", rc, 149 "failed with rc=%d\n", rc);
148 new_size);
149 150
150 rc = appldata_diag(APPLDATA_RECORD_OS_ID, 151 rc = appldata_diag(APPLDATA_RECORD_OS_ID,
151 APPLDATA_STOP_REC, 152 APPLDATA_STOP_REC,
152 (unsigned long) ops.data, ops.size, 153 (unsigned long) ops.data, ops.size,
153 ops.mod_lvl); 154 ops.mod_lvl);
154 if (rc != 0) 155 if (rc != 0)
155 P_ERROR("os: STOP OLD DIAG 0xDC failed, " 156 pr_err("Stopping a faulty OS data "
156 "return code: %d, old size = %i\n", rc, 157 "collection failed with rc=%d\n", rc);
157 ops.size);
158 else
159 P_INFO("os: old record size = %i stopped\n",
160 ops.size);
161 } 158 }
162 ops.size = new_size; 159 ops.size = new_size;
163 } 160 }
@@ -178,8 +175,8 @@ static int __init appldata_os_init(void)
178 max_size = sizeof(struct appldata_os_data) + 175 max_size = sizeof(struct appldata_os_data) +
179 (NR_CPUS * sizeof(struct appldata_os_per_cpu)); 176 (NR_CPUS * sizeof(struct appldata_os_per_cpu));
180 if (max_size > APPLDATA_MAX_REC_SIZE) { 177 if (max_size > APPLDATA_MAX_REC_SIZE) {
181 P_ERROR("Max. size of OS record = %i, bigger than maximum " 178 pr_err("Maximum OS record size %i exceeds the maximum "
182 "record size (%i)\n", max_size, APPLDATA_MAX_REC_SIZE); 179 "record size %i\n", max_size, APPLDATA_MAX_REC_SIZE);
183 rc = -ENOMEM; 180 rc = -ENOMEM;
184 goto out; 181 goto out;
185 } 182 }
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
index e33f32b54c08..c42cd898f68b 100644
--- a/arch/s390/crypto/aes_s390.c
+++ b/arch/s390/crypto/aes_s390.c
@@ -17,6 +17,9 @@
17 * 17 *
18 */ 18 */
19 19
20#define KMSG_COMPONENT "aes_s390"
21#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
22
20#include <crypto/aes.h> 23#include <crypto/aes.h>
21#include <crypto/algapi.h> 24#include <crypto/algapi.h>
22#include <linux/err.h> 25#include <linux/err.h>
@@ -169,7 +172,8 @@ static int fallback_init_cip(struct crypto_tfm *tfm)
169 CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK); 172 CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK);
170 173
171 if (IS_ERR(sctx->fallback.cip)) { 174 if (IS_ERR(sctx->fallback.cip)) {
172 printk(KERN_ERR "Error allocating fallback algo %s\n", name); 175 pr_err("Allocating AES fallback algorithm %s failed\n",
176 name);
173 return PTR_ERR(sctx->fallback.blk); 177 return PTR_ERR(sctx->fallback.blk);
174 } 178 }
175 179
@@ -349,7 +353,8 @@ static int fallback_init_blk(struct crypto_tfm *tfm)
349 CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK); 353 CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK);
350 354
351 if (IS_ERR(sctx->fallback.blk)) { 355 if (IS_ERR(sctx->fallback.blk)) {
352 printk(KERN_ERR "Error allocating fallback algo %s\n", name); 356 pr_err("Allocating AES fallback algorithm %s failed\n",
357 name);
353 return PTR_ERR(sctx->fallback.blk); 358 return PTR_ERR(sctx->fallback.blk);
354 } 359 }
355 360
@@ -515,9 +520,8 @@ static int __init aes_s390_init(void)
515 520
516 /* z9 109 and z9 BC/EC only support 128 bit key length */ 521 /* z9 109 and z9 BC/EC only support 128 bit key length */
517 if (keylen_flag == AES_KEYLEN_128) 522 if (keylen_flag == AES_KEYLEN_128)
518 printk(KERN_INFO 523 pr_info("AES hardware acceleration is only available for"
519 "aes_s390: hardware acceleration only available for " 524 " 128-bit keys\n");
520 "128 bit keys\n");
521 525
522 ret = crypto_register_alg(&aes_alg); 526 ret = crypto_register_alg(&aes_alg);
523 if (ret) 527 if (ret)
diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c
index b9a1ce1f28e4..b1e892a43816 100644
--- a/arch/s390/hypfs/hypfs_diag.c
+++ b/arch/s390/hypfs/hypfs_diag.c
@@ -3,10 +3,13 @@
3 * Hypervisor filesystem for Linux on s390. Diag 204 and 224 3 * Hypervisor filesystem for Linux on s390. Diag 204 and 224
4 * implementation. 4 * implementation.
5 * 5 *
6 * Copyright (C) IBM Corp. 2006 6 * Copyright IBM Corp. 2006, 2008
7 * Author(s): Michael Holzheu <holzheu@de.ibm.com> 7 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
8 */ 8 */
9 9
10#define KMSG_COMPONENT "hypfs"
11#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
12
10#include <linux/types.h> 13#include <linux/types.h>
11#include <linux/errno.h> 14#include <linux/errno.h>
12#include <linux/string.h> 15#include <linux/string.h>
@@ -527,13 +530,14 @@ __init int hypfs_diag_init(void)
527 int rc; 530 int rc;
528 531
529 if (diag204_probe()) { 532 if (diag204_probe()) {
530 printk(KERN_ERR "hypfs: diag 204 not working."); 533 pr_err("The hardware system does not support hypfs\n");
531 return -ENODATA; 534 return -ENODATA;
532 } 535 }
533 rc = diag224_get_name_table(); 536 rc = diag224_get_name_table();
534 if (rc) { 537 if (rc) {
535 diag204_free_buffer(); 538 diag204_free_buffer();
536 printk(KERN_ERR "hypfs: could not get name table.\n"); 539 pr_err("The hardware system does not provide all "
540 "functions required by hypfs\n");
537 } 541 }
538 return rc; 542 return rc;
539} 543}
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 36313801cd5c..5a805df216bb 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -2,10 +2,13 @@
2 * arch/s390/hypfs/inode.c 2 * arch/s390/hypfs/inode.c
3 * Hypervisor filesystem for Linux on s390. 3 * Hypervisor filesystem for Linux on s390.
4 * 4 *
5 * Copyright (C) IBM Corp. 2006 5 * Copyright IBM Corp. 2006, 2008
6 * Author(s): Michael Holzheu <holzheu@de.ibm.com> 6 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
7 */ 7 */
8 8
9#define KMSG_COMPONENT "hypfs"
10#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
11
9#include <linux/types.h> 12#include <linux/types.h>
10#include <linux/errno.h> 13#include <linux/errno.h>
11#include <linux/fs.h> 14#include <linux/fs.h>
@@ -103,7 +106,6 @@ static struct inode *hypfs_make_inode(struct super_block *sb, int mode)
103 ret->i_mode = mode; 106 ret->i_mode = mode;
104 ret->i_uid = hypfs_info->uid; 107 ret->i_uid = hypfs_info->uid;
105 ret->i_gid = hypfs_info->gid; 108 ret->i_gid = hypfs_info->gid;
106 ret->i_blocks = 0;
107 ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; 109 ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
108 if (mode & S_IFDIR) 110 if (mode & S_IFDIR)
109 ret->i_nlink = 2; 111 ret->i_nlink = 2;
@@ -200,7 +202,7 @@ static ssize_t hypfs_aio_write(struct kiocb *iocb, const struct iovec *iov,
200 else 202 else
201 rc = hypfs_diag_create_files(sb, sb->s_root); 203 rc = hypfs_diag_create_files(sb, sb->s_root);
202 if (rc) { 204 if (rc) {
203 printk(KERN_ERR "hypfs: Update failed\n"); 205 pr_err("Updating the hypfs tree failed\n");
204 hypfs_delete_tree(sb->s_root); 206 hypfs_delete_tree(sb->s_root);
205 goto out; 207 goto out;
206 } 208 }
@@ -252,8 +254,7 @@ static int hypfs_parse_options(char *options, struct super_block *sb)
252 break; 254 break;
253 case opt_err: 255 case opt_err:
254 default: 256 default:
255 printk(KERN_ERR "hypfs: Unrecognized mount option " 257 pr_err("%s is not a valid mount option\n", str);
256 "\"%s\" or missing value\n", str);
257 return -EINVAL; 258 return -EINVAL;
258 } 259 }
259 } 260 }
@@ -280,8 +281,8 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
280 if (!sbi) 281 if (!sbi)
281 return -ENOMEM; 282 return -ENOMEM;
282 mutex_init(&sbi->lock); 283 mutex_init(&sbi->lock);
283 sbi->uid = current->uid; 284 sbi->uid = current_uid();
284 sbi->gid = current->gid; 285 sbi->gid = current_gid();
285 sb->s_fs_info = sbi; 286 sb->s_fs_info = sbi;
286 sb->s_blocksize = PAGE_CACHE_SIZE; 287 sb->s_blocksize = PAGE_CACHE_SIZE;
287 sb->s_blocksize_bits = PAGE_CACHE_SHIFT; 288 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
@@ -317,7 +318,7 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
317 } 318 }
318 hypfs_update_update(sb); 319 hypfs_update_update(sb);
319 sb->s_root = root_dentry; 320 sb->s_root = root_dentry;
320 printk(KERN_INFO "hypfs: Hypervisor filesystem mounted\n"); 321 pr_info("Hypervisor filesystem mounted\n");
321 return 0; 322 return 0;
322 323
323err_tree: 324err_tree:
@@ -513,7 +514,7 @@ fail_sysfs:
513 if (!MACHINE_IS_VM) 514 if (!MACHINE_IS_VM)
514 hypfs_diag_exit(); 515 hypfs_diag_exit();
515fail_diag: 516fail_diag:
516 printk(KERN_ERR "hypfs: Initialization failed with rc = %i.\n", rc); 517 pr_err("Initialization of hypfs failed with rc=%i\n", rc);
517 return rc; 518 return rc;
518} 519}
519 520
diff --git a/arch/s390/include/asm/atomic.h b/arch/s390/include/asm/atomic.h
index 2d184655bc5d..de432f2de2d2 100644
--- a/arch/s390/include/asm/atomic.h
+++ b/arch/s390/include/asm/atomic.h
@@ -2,6 +2,7 @@
2#define __ARCH_S390_ATOMIC__ 2#define __ARCH_S390_ATOMIC__
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/types.h>
5 6
6/* 7/*
7 * include/asm-s390/atomic.h 8 * include/asm-s390/atomic.h
@@ -23,9 +24,6 @@
23 * S390 uses 'Compare And Swap' for atomicity in SMP enviroment 24 * S390 uses 'Compare And Swap' for atomicity in SMP enviroment
24 */ 25 */
25 26
26typedef struct {
27 int counter;
28} __attribute__ ((aligned (4))) atomic_t;
29#define ATOMIC_INIT(i) { (i) } 27#define ATOMIC_INIT(i) { (i) }
30 28
31#ifdef __KERNEL__ 29#ifdef __KERNEL__
@@ -149,9 +147,6 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
149#undef __CS_LOOP 147#undef __CS_LOOP
150 148
151#ifdef __s390x__ 149#ifdef __s390x__
152typedef struct {
153 long long counter;
154} __attribute__ ((aligned (8))) atomic64_t;
155#define ATOMIC64_INIT(i) { (i) } 150#define ATOMIC64_INIT(i) { (i) }
156 151
157#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) 152#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
diff --git a/arch/s390/include/asm/auxvec.h b/arch/s390/include/asm/auxvec.h
index 0d340720fd99..a1f153e89133 100644
--- a/arch/s390/include/asm/auxvec.h
+++ b/arch/s390/include/asm/auxvec.h
@@ -1,4 +1,6 @@
1#ifndef __ASMS390_AUXVEC_H 1#ifndef __ASMS390_AUXVEC_H
2#define __ASMS390_AUXVEC_H 2#define __ASMS390_AUXVEC_H
3 3
4#define AT_SYSINFO_EHDR 33
5
4#endif 6#endif
diff --git a/arch/s390/include/asm/bug.h b/arch/s390/include/asm/bug.h
index 384e3621e341..7efd0abe8887 100644
--- a/arch/s390/include/asm/bug.h
+++ b/arch/s390/include/asm/bug.h
@@ -47,7 +47,10 @@
47 47
48#endif /* CONFIG_DEBUG_BUGVERBOSE */ 48#endif /* CONFIG_DEBUG_BUGVERBOSE */
49 49
50#define BUG() __EMIT_BUG(0) 50#define BUG() do { \
51 __EMIT_BUG(0); \
52 for (;;); \
53} while (0)
51 54
52#define WARN_ON(x) ({ \ 55#define WARN_ON(x) ({ \
53 int __ret_warn_on = !!(x); \ 56 int __ret_warn_on = !!(x); \
diff --git a/arch/s390/include/asm/byteorder.h b/arch/s390/include/asm/byteorder.h
index 1fe2492baa8d..8bcf277c8468 100644
--- a/arch/s390/include/asm/byteorder.h
+++ b/arch/s390/include/asm/byteorder.h
@@ -11,32 +11,39 @@
11 11
12#include <asm/types.h> 12#include <asm/types.h>
13 13
14#ifdef __GNUC__ 14#define __BIG_ENDIAN
15
16#ifndef __s390x__
17# define __SWAB_64_THRU_32__
18#endif
15 19
16#ifdef __s390x__ 20#ifdef __s390x__
17static inline __u64 ___arch__swab64p(const __u64 *x) 21static inline __u64 __arch_swab64p(const __u64 *x)
18{ 22{
19 __u64 result; 23 __u64 result;
20 24
21 asm volatile("lrvg %0,%1" : "=d" (result) : "m" (*x)); 25 asm volatile("lrvg %0,%1" : "=d" (result) : "m" (*x));
22 return result; 26 return result;
23} 27}
28#define __arch_swab64p __arch_swab64p
24 29
25static inline __u64 ___arch__swab64(__u64 x) 30static inline __u64 __arch_swab64(__u64 x)
26{ 31{
27 __u64 result; 32 __u64 result;
28 33
29 asm volatile("lrvgr %0,%1" : "=d" (result) : "d" (x)); 34 asm volatile("lrvgr %0,%1" : "=d" (result) : "d" (x));
30 return result; 35 return result;
31} 36}
37#define __arch_swab64 __arch_swab64
32 38
33static inline void ___arch__swab64s(__u64 *x) 39static inline void __arch_swab64s(__u64 *x)
34{ 40{
35 *x = ___arch__swab64p(x); 41 *x = __arch_swab64p(x);
36} 42}
43#define __arch_swab64s __arch_swab64s
37#endif /* __s390x__ */ 44#endif /* __s390x__ */
38 45
39static inline __u32 ___arch__swab32p(const __u32 *x) 46static inline __u32 __arch_swab32p(const __u32 *x)
40{ 47{
41 __u32 result; 48 __u32 result;
42 49
@@ -53,25 +60,20 @@ static inline __u32 ___arch__swab32p(const __u32 *x)
53#endif /* __s390x__ */ 60#endif /* __s390x__ */
54 return result; 61 return result;
55} 62}
63#define __arch_swab32p __arch_swab32p
56 64
57static inline __u32 ___arch__swab32(__u32 x) 65#ifdef __s390x__
66static inline __u32 __arch_swab32(__u32 x)
58{ 67{
59#ifndef __s390x__
60 return ___arch__swab32p(&x);
61#else /* __s390x__ */
62 __u32 result; 68 __u32 result;
63 69
64 asm volatile("lrvr %0,%1" : "=d" (result) : "d" (x)); 70 asm volatile("lrvr %0,%1" : "=d" (result) : "d" (x));
65 return result; 71 return result;
66#endif /* __s390x__ */
67}
68
69static __inline__ void ___arch__swab32s(__u32 *x)
70{
71 *x = ___arch__swab32p(x);
72} 72}
73#define __arch_swab32 __arch_swab32
74#endif /* __s390x__ */
73 75
74static __inline__ __u16 ___arch__swab16p(const __u16 *x) 76static inline __u16 __arch_swab16p(const __u16 *x)
75{ 77{
76 __u16 result; 78 __u16 result;
77 79
@@ -86,40 +88,8 @@ static __inline__ __u16 ___arch__swab16p(const __u16 *x)
86#endif /* __s390x__ */ 88#endif /* __s390x__ */
87 return result; 89 return result;
88} 90}
91#define __arch_swab16p __arch_swab16p
89 92
90static __inline__ __u16 ___arch__swab16(__u16 x) 93#include <linux/byteorder.h>
91{
92 return ___arch__swab16p(&x);
93}
94
95static __inline__ void ___arch__swab16s(__u16 *x)
96{
97 *x = ___arch__swab16p(x);
98}
99
100#ifdef __s390x__
101#define __arch__swab64(x) ___arch__swab64(x)
102#define __arch__swab64p(x) ___arch__swab64p(x)
103#define __arch__swab64s(x) ___arch__swab64s(x)
104#endif /* __s390x__ */
105#define __arch__swab32(x) ___arch__swab32(x)
106#define __arch__swab16(x) ___arch__swab16(x)
107#define __arch__swab32p(x) ___arch__swab32p(x)
108#define __arch__swab16p(x) ___arch__swab16p(x)
109#define __arch__swab32s(x) ___arch__swab32s(x)
110#define __arch__swab16s(x) ___arch__swab16s(x)
111
112#ifndef __s390x__
113#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
114# define __BYTEORDER_HAS_U64__
115# define __SWAB_64_THRU_32__
116#endif
117#else /* __s390x__ */
118#define __BYTEORDER_HAS_U64__
119#endif /* __s390x__ */
120
121#endif /* __GNUC__ */
122
123#include <linux/byteorder/big_endian.h>
124 94
125#endif /* _S390_BYTEORDER_H */ 95#endif /* _S390_BYTEORDER_H */
diff --git a/arch/s390/include/asm/cpu.h b/arch/s390/include/asm/cpu.h
index e5a6a9ba3adf..d60a2eefb17b 100644
--- a/arch/s390/include/asm/cpu.h
+++ b/arch/s390/include/asm/cpu.h
@@ -14,7 +14,6 @@
14 14
15struct s390_idle_data { 15struct s390_idle_data {
16 spinlock_t lock; 16 spinlock_t lock;
17 unsigned int in_idle;
18 unsigned long long idle_count; 17 unsigned long long idle_count;
19 unsigned long long idle_enter; 18 unsigned long long idle_enter;
20 unsigned long long idle_time; 19 unsigned long long idle_time;
@@ -22,12 +21,12 @@ struct s390_idle_data {
22 21
23DECLARE_PER_CPU(struct s390_idle_data, s390_idle); 22DECLARE_PER_CPU(struct s390_idle_data, s390_idle);
24 23
25void s390_idle_leave(void); 24void vtime_start_cpu(void);
26 25
27static inline void s390_idle_check(void) 26static inline void s390_idle_check(void)
28{ 27{
29 if ((&__get_cpu_var(s390_idle))->in_idle) 28 if ((&__get_cpu_var(s390_idle))->idle_enter != 0ULL)
30 s390_idle_leave(); 29 vtime_start_cpu();
31} 30}
32 31
33#endif /* _ASM_S390_CPU_H_ */ 32#endif /* _ASM_S390_CPU_H_ */
diff --git a/arch/s390/include/asm/cputime.h b/arch/s390/include/asm/cputime.h
index 133ce054fc89..521726430afa 100644
--- a/arch/s390/include/asm/cputime.h
+++ b/arch/s390/include/asm/cputime.h
@@ -11,7 +11,7 @@
11 11
12#include <asm/div64.h> 12#include <asm/div64.h>
13 13
14/* We want to use micro-second resolution. */ 14/* We want to use full resolution of the CPU timer: 2**-12 micro-seconds. */
15 15
16typedef unsigned long long cputime_t; 16typedef unsigned long long cputime_t;
17typedef unsigned long long cputime64_t; 17typedef unsigned long long cputime64_t;
@@ -53,9 +53,9 @@ __div(unsigned long long n, unsigned int base)
53#define cputime_ge(__a, __b) ((__a) >= (__b)) 53#define cputime_ge(__a, __b) ((__a) >= (__b))
54#define cputime_lt(__a, __b) ((__a) < (__b)) 54#define cputime_lt(__a, __b) ((__a) < (__b))
55#define cputime_le(__a, __b) ((__a) <= (__b)) 55#define cputime_le(__a, __b) ((__a) <= (__b))
56#define cputime_to_jiffies(__ct) (__div((__ct), 1000000 / HZ)) 56#define cputime_to_jiffies(__ct) (__div((__ct), 4096000000ULL / HZ))
57#define cputime_to_scaled(__ct) (__ct) 57#define cputime_to_scaled(__ct) (__ct)
58#define jiffies_to_cputime(__hz) ((cputime_t)(__hz) * (1000000 / HZ)) 58#define jiffies_to_cputime(__hz) ((cputime_t)(__hz) * (4096000000ULL / HZ))
59 59
60#define cputime64_zero (0ULL) 60#define cputime64_zero (0ULL)
61#define cputime64_add(__a, __b) ((__a) + (__b)) 61#define cputime64_add(__a, __b) ((__a) + (__b))
@@ -64,7 +64,7 @@ __div(unsigned long long n, unsigned int base)
64static inline u64 64static inline u64
65cputime64_to_jiffies64(cputime64_t cputime) 65cputime64_to_jiffies64(cputime64_t cputime)
66{ 66{
67 do_div(cputime, 1000000 / HZ); 67 do_div(cputime, 4096000000ULL / HZ);
68 return cputime; 68 return cputime;
69} 69}
70 70
@@ -74,13 +74,13 @@ cputime64_to_jiffies64(cputime64_t cputime)
74static inline unsigned int 74static inline unsigned int
75cputime_to_msecs(const cputime_t cputime) 75cputime_to_msecs(const cputime_t cputime)
76{ 76{
77 return __div(cputime, 1000); 77 return __div(cputime, 4096000);
78} 78}
79 79
80static inline cputime_t 80static inline cputime_t
81msecs_to_cputime(const unsigned int m) 81msecs_to_cputime(const unsigned int m)
82{ 82{
83 return (cputime_t) m * 1000; 83 return (cputime_t) m * 4096000;
84} 84}
85 85
86/* 86/*
@@ -89,13 +89,13 @@ msecs_to_cputime(const unsigned int m)
89static inline unsigned int 89static inline unsigned int
90cputime_to_secs(const cputime_t cputime) 90cputime_to_secs(const cputime_t cputime)
91{ 91{
92 return __div(cputime, 1000000); 92 return __div(cputime, 2048000000) >> 1;
93} 93}
94 94
95static inline cputime_t 95static inline cputime_t
96secs_to_cputime(const unsigned int s) 96secs_to_cputime(const unsigned int s)
97{ 97{
98 return (cputime_t) s * 1000000; 98 return (cputime_t) s * 4096000000ULL;
99} 99}
100 100
101/* 101/*
@@ -104,7 +104,7 @@ secs_to_cputime(const unsigned int s)
104static inline cputime_t 104static inline cputime_t
105timespec_to_cputime(const struct timespec *value) 105timespec_to_cputime(const struct timespec *value)
106{ 106{
107 return value->tv_nsec / 1000 + (u64) value->tv_sec * 1000000; 107 return value->tv_nsec * 4096 / 1000 + (u64) value->tv_sec * 4096000000ULL;
108} 108}
109 109
110static inline void 110static inline void
@@ -114,12 +114,12 @@ cputime_to_timespec(const cputime_t cputime, struct timespec *value)
114 register_pair rp; 114 register_pair rp;
115 115
116 rp.pair = cputime >> 1; 116 rp.pair = cputime >> 1;
117 asm ("dr %0,%1" : "+d" (rp) : "d" (1000000 >> 1)); 117 asm ("dr %0,%1" : "+d" (rp) : "d" (2048000000UL));
118 value->tv_nsec = rp.subreg.even * 1000; 118 value->tv_nsec = rp.subreg.even * 1000 / 4096;
119 value->tv_sec = rp.subreg.odd; 119 value->tv_sec = rp.subreg.odd;
120#else 120#else
121 value->tv_nsec = (cputime % 1000000) * 1000; 121 value->tv_nsec = (cputime % 4096000000ULL) * 1000 / 4096;
122 value->tv_sec = cputime / 1000000; 122 value->tv_sec = cputime / 4096000000ULL;
123#endif 123#endif
124} 124}
125 125
@@ -131,7 +131,7 @@ cputime_to_timespec(const cputime_t cputime, struct timespec *value)
131static inline cputime_t 131static inline cputime_t
132timeval_to_cputime(const struct timeval *value) 132timeval_to_cputime(const struct timeval *value)
133{ 133{
134 return value->tv_usec + (u64) value->tv_sec * 1000000; 134 return value->tv_usec * 4096 + (u64) value->tv_sec * 4096000000ULL;
135} 135}
136 136
137static inline void 137static inline void
@@ -141,12 +141,12 @@ cputime_to_timeval(const cputime_t cputime, struct timeval *value)
141 register_pair rp; 141 register_pair rp;
142 142
143 rp.pair = cputime >> 1; 143 rp.pair = cputime >> 1;
144 asm ("dr %0,%1" : "+d" (rp) : "d" (1000000 >> 1)); 144 asm ("dr %0,%1" : "+d" (rp) : "d" (2048000000UL));
145 value->tv_usec = rp.subreg.even; 145 value->tv_usec = rp.subreg.even / 4096;
146 value->tv_sec = rp.subreg.odd; 146 value->tv_sec = rp.subreg.odd;
147#else 147#else
148 value->tv_usec = cputime % 1000000; 148 value->tv_usec = cputime % 4096000000ULL;
149 value->tv_sec = cputime / 1000000; 149 value->tv_sec = cputime / 4096000000ULL;
150#endif 150#endif
151} 151}
152 152
@@ -156,13 +156,13 @@ cputime_to_timeval(const cputime_t cputime, struct timeval *value)
156static inline clock_t 156static inline clock_t
157cputime_to_clock_t(cputime_t cputime) 157cputime_to_clock_t(cputime_t cputime)
158{ 158{
159 return __div(cputime, 1000000 / USER_HZ); 159 return __div(cputime, 4096000000ULL / USER_HZ);
160} 160}
161 161
162static inline cputime_t 162static inline cputime_t
163clock_t_to_cputime(unsigned long x) 163clock_t_to_cputime(unsigned long x)
164{ 164{
165 return (cputime_t) x * (1000000 / USER_HZ); 165 return (cputime_t) x * (4096000000ULL / USER_HZ);
166} 166}
167 167
168/* 168/*
@@ -171,7 +171,7 @@ clock_t_to_cputime(unsigned long x)
171static inline clock_t 171static inline clock_t
172cputime64_to_clock_t(cputime64_t cputime) 172cputime64_to_clock_t(cputime64_t cputime)
173{ 173{
174 return __div(cputime, 1000000 / USER_HZ); 174 return __div(cputime, 4096000000ULL / USER_HZ);
175} 175}
176 176
177#endif /* _S390_CPUTIME_H */ 177#endif /* _S390_CPUTIME_H */
diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h
index 261785ab5b22..d480f39d65e6 100644
--- a/arch/s390/include/asm/elf.h
+++ b/arch/s390/include/asm/elf.h
@@ -120,6 +120,10 @@ typedef s390_compat_regs compat_elf_gregset_t;
120#include <asm/system.h> /* for save_access_regs */ 120#include <asm/system.h> /* for save_access_regs */
121#include <asm/mmu_context.h> 121#include <asm/mmu_context.h>
122 122
123#include <asm/vdso.h>
124
125extern unsigned int vdso_enabled;
126
123/* 127/*
124 * This is used to ensure we don't load something for the wrong architecture. 128 * This is used to ensure we don't load something for the wrong architecture.
125 */ 129 */
@@ -191,4 +195,16 @@ do { \
191 current->mm->context.noexec == 0; \ 195 current->mm->context.noexec == 0; \
192}) 196})
193 197
198#define ARCH_DLINFO \
199do { \
200 if (vdso_enabled) \
201 NEW_AUX_ENT(AT_SYSINFO_EHDR, \
202 (unsigned long)current->mm->context.vdso_base); \
203} while (0)
204
205struct linux_binprm;
206
207#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
208int arch_setup_additional_pages(struct linux_binprm *, int);
209
194#endif 210#endif
diff --git a/arch/s390/include/asm/fcx.h b/arch/s390/include/asm/fcx.h
index 8be1f3a58042..ef6170995076 100644
--- a/arch/s390/include/asm/fcx.h
+++ b/arch/s390/include/asm/fcx.h
@@ -248,8 +248,8 @@ struct dcw {
248#define TCCB_MAX_SIZE (sizeof(struct tccb_tcah) + \ 248#define TCCB_MAX_SIZE (sizeof(struct tccb_tcah) + \
249 TCCB_MAX_DCW * sizeof(struct dcw) + \ 249 TCCB_MAX_DCW * sizeof(struct dcw) + \
250 sizeof(struct tccb_tcat)) 250 sizeof(struct tccb_tcat))
251#define TCCB_SAC_DEFAULT 0xf901 251#define TCCB_SAC_DEFAULT 0x1ffe
252#define TCCB_SAC_INTRG 0xf902 252#define TCCB_SAC_INTRG 0x1fff
253 253
254/** 254/**
255 * struct tccb_tcah - Transport-Command-Area Header (TCAH) 255 * struct tccb_tcah - Transport-Command-Area Header (TCAH)
diff --git a/arch/s390/include/asm/ftrace.h b/arch/s390/include/asm/ftrace.h
new file mode 100644
index 000000000000..5a5bc75e19d4
--- /dev/null
+++ b/arch/s390/include/asm/ftrace.h
@@ -0,0 +1,8 @@
1#ifndef _ASM_S390_FTRACE_H
2#define _ASM_S390_FTRACE_H
3
4#ifndef __ASSEMBLY__
5extern void _mcount(void);
6#endif
7
8#endif /* _ASM_S390_FTRACE_H */
diff --git a/arch/s390/include/asm/isc.h b/arch/s390/include/asm/isc.h
index 34bb8916db4f..1420a1115948 100644
--- a/arch/s390/include/asm/isc.h
+++ b/arch/s390/include/asm/isc.h
@@ -17,6 +17,7 @@
17#define CHSC_SCH_ISC 7 /* CHSC subchannels */ 17#define CHSC_SCH_ISC 7 /* CHSC subchannels */
18/* Adapter interrupts. */ 18/* Adapter interrupts. */
19#define QDIO_AIRQ_ISC IO_SCH_ISC /* I/O subchannel in qdio mode */ 19#define QDIO_AIRQ_ISC IO_SCH_ISC /* I/O subchannel in qdio mode */
20#define AP_ISC 6 /* adjunct processor (crypto) devices */
20 21
21/* Functions for registration of I/O interruption subclasses */ 22/* Functions for registration of I/O interruption subclasses */
22void isc_register(unsigned int isc); 23void isc_register(unsigned int isc);
diff --git a/arch/s390/include/asm/kvm_virtio.h b/arch/s390/include/asm/kvm_virtio.h
index c13568b9351c..0503936f101f 100644
--- a/arch/s390/include/asm/kvm_virtio.h
+++ b/arch/s390/include/asm/kvm_virtio.h
@@ -50,6 +50,10 @@ struct kvm_vqconfig {
50#define KVM_S390_VIRTIO_RESET 1 50#define KVM_S390_VIRTIO_RESET 1
51#define KVM_S390_VIRTIO_SET_STATUS 2 51#define KVM_S390_VIRTIO_SET_STATUS 2
52 52
53/* The alignment to use between consumer and producer parts of vring.
54 * This is pagesize for historical reasons. */
55#define KVM_S390_VIRTIO_RING_ALIGN 4096
56
53#ifdef __KERNEL__ 57#ifdef __KERNEL__
54/* early virtio console setup */ 58/* early virtio console setup */
55#ifdef CONFIG_S390_GUEST 59#ifdef CONFIG_S390_GUEST
diff --git a/arch/s390/include/asm/lowcore.h b/arch/s390/include/asm/lowcore.h
index 0bc51d52a899..ffdef5fe8587 100644
--- a/arch/s390/include/asm/lowcore.h
+++ b/arch/s390/include/asm/lowcore.h
@@ -67,11 +67,11 @@
67#define __LC_SYNC_ENTER_TIMER 0x248 67#define __LC_SYNC_ENTER_TIMER 0x248
68#define __LC_ASYNC_ENTER_TIMER 0x250 68#define __LC_ASYNC_ENTER_TIMER 0x250
69#define __LC_EXIT_TIMER 0x258 69#define __LC_EXIT_TIMER 0x258
70#define __LC_LAST_UPDATE_TIMER 0x260 70#define __LC_USER_TIMER 0x260
71#define __LC_USER_TIMER 0x268 71#define __LC_SYSTEM_TIMER 0x268
72#define __LC_SYSTEM_TIMER 0x270 72#define __LC_STEAL_TIMER 0x270
73#define __LC_LAST_UPDATE_CLOCK 0x278 73#define __LC_LAST_UPDATE_TIMER 0x278
74#define __LC_STEAL_CLOCK 0x280 74#define __LC_LAST_UPDATE_CLOCK 0x280
75#define __LC_RETURN_MCCK_PSW 0x288 75#define __LC_RETURN_MCCK_PSW 0x288
76#define __LC_KERNEL_STACK 0xC40 76#define __LC_KERNEL_STACK 0xC40
77#define __LC_THREAD_INFO 0xC44 77#define __LC_THREAD_INFO 0xC44
@@ -89,11 +89,11 @@
89#define __LC_SYNC_ENTER_TIMER 0x250 89#define __LC_SYNC_ENTER_TIMER 0x250
90#define __LC_ASYNC_ENTER_TIMER 0x258 90#define __LC_ASYNC_ENTER_TIMER 0x258
91#define __LC_EXIT_TIMER 0x260 91#define __LC_EXIT_TIMER 0x260
92#define __LC_LAST_UPDATE_TIMER 0x268 92#define __LC_USER_TIMER 0x268
93#define __LC_USER_TIMER 0x270 93#define __LC_SYSTEM_TIMER 0x270
94#define __LC_SYSTEM_TIMER 0x278 94#define __LC_STEAL_TIMER 0x278
95#define __LC_LAST_UPDATE_CLOCK 0x280 95#define __LC_LAST_UPDATE_TIMER 0x280
96#define __LC_STEAL_CLOCK 0x288 96#define __LC_LAST_UPDATE_CLOCK 0x288
97#define __LC_RETURN_MCCK_PSW 0x290 97#define __LC_RETURN_MCCK_PSW 0x290
98#define __LC_KERNEL_STACK 0xD40 98#define __LC_KERNEL_STACK 0xD40
99#define __LC_THREAD_INFO 0xD48 99#define __LC_THREAD_INFO 0xD48
@@ -106,8 +106,10 @@
106#define __LC_IPLDEV 0xDB8 106#define __LC_IPLDEV 0xDB8
107#define __LC_CURRENT 0xDD8 107#define __LC_CURRENT 0xDD8
108#define __LC_INT_CLOCK 0xDE8 108#define __LC_INT_CLOCK 0xDE8
109#define __LC_VDSO_PER_CPU 0xE38
109#endif /* __s390x__ */ 110#endif /* __s390x__ */
110 111
112#define __LC_PASTE 0xE40
111 113
112#define __LC_PANIC_MAGIC 0xE00 114#define __LC_PANIC_MAGIC 0xE00
113#ifndef __s390x__ 115#ifndef __s390x__
@@ -252,11 +254,11 @@ struct _lowcore
252 __u64 sync_enter_timer; /* 0x248 */ 254 __u64 sync_enter_timer; /* 0x248 */
253 __u64 async_enter_timer; /* 0x250 */ 255 __u64 async_enter_timer; /* 0x250 */
254 __u64 exit_timer; /* 0x258 */ 256 __u64 exit_timer; /* 0x258 */
255 __u64 last_update_timer; /* 0x260 */ 257 __u64 user_timer; /* 0x260 */
256 __u64 user_timer; /* 0x268 */ 258 __u64 system_timer; /* 0x268 */
257 __u64 system_timer; /* 0x270 */ 259 __u64 steal_timer; /* 0x270 */
258 __u64 last_update_clock; /* 0x278 */ 260 __u64 last_update_timer; /* 0x278 */
259 __u64 steal_clock; /* 0x280 */ 261 __u64 last_update_clock; /* 0x280 */
260 psw_t return_mcck_psw; /* 0x288 */ 262 psw_t return_mcck_psw; /* 0x288 */
261 __u8 pad8[0xc00-0x290]; /* 0x290 */ 263 __u8 pad8[0xc00-0x290]; /* 0x290 */
262 264
@@ -343,11 +345,11 @@ struct _lowcore
343 __u64 sync_enter_timer; /* 0x250 */ 345 __u64 sync_enter_timer; /* 0x250 */
344 __u64 async_enter_timer; /* 0x258 */ 346 __u64 async_enter_timer; /* 0x258 */
345 __u64 exit_timer; /* 0x260 */ 347 __u64 exit_timer; /* 0x260 */
346 __u64 last_update_timer; /* 0x268 */ 348 __u64 user_timer; /* 0x268 */
347 __u64 user_timer; /* 0x270 */ 349 __u64 system_timer; /* 0x270 */
348 __u64 system_timer; /* 0x278 */ 350 __u64 steal_timer; /* 0x278 */
349 __u64 last_update_clock; /* 0x280 */ 351 __u64 last_update_timer; /* 0x280 */
350 __u64 steal_clock; /* 0x288 */ 352 __u64 last_update_clock; /* 0x288 */
351 psw_t return_mcck_psw; /* 0x290 */ 353 psw_t return_mcck_psw; /* 0x290 */
352 __u8 pad8[0xc00-0x2a0]; /* 0x2a0 */ 354 __u8 pad8[0xc00-0x2a0]; /* 0x2a0 */
353 /* System info area */ 355 /* System info area */
@@ -381,7 +383,12 @@ struct _lowcore
381 /* whether the kernel died with panic() or not */ 383 /* whether the kernel died with panic() or not */
382 __u32 panic_magic; /* 0xe00 */ 384 __u32 panic_magic; /* 0xe00 */
383 385
384 __u8 pad13[0x11b8-0xe04]; /* 0xe04 */ 386 /* Per cpu primary space access list */
387 __u8 pad_0xe04[0xe3c-0xe04]; /* 0xe04 */
388 __u32 vdso_per_cpu_data; /* 0xe3c */
389 __u32 paste[16]; /* 0xe40 */
390
391 __u8 pad13[0x11b8-0xe80]; /* 0xe80 */
385 392
386 /* 64 bit extparam used for pfault, diag 250 etc */ 393 /* 64 bit extparam used for pfault, diag 250 etc */
387 __u64 ext_params2; /* 0x11B8 */ 394 __u64 ext_params2; /* 0x11B8 */
diff --git a/arch/s390/include/asm/mmu.h b/arch/s390/include/asm/mmu.h
index d2b4ff831477..3b59216e6284 100644
--- a/arch/s390/include/asm/mmu.h
+++ b/arch/s390/include/asm/mmu.h
@@ -6,6 +6,7 @@ typedef struct {
6 struct list_head pgtable_list; 6 struct list_head pgtable_list;
7 unsigned long asce_bits; 7 unsigned long asce_bits;
8 unsigned long asce_limit; 8 unsigned long asce_limit;
9 unsigned long vdso_base;
9 int noexec; 10 int noexec;
10 int has_pgste; /* The mmu context has extended page tables */ 11 int has_pgste; /* The mmu context has extended page tables */
11 int alloc_pgste; /* cloned contexts will have extended page tables */ 12 int alloc_pgste; /* cloned contexts will have extended page tables */
diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h
index 991ba939408c..32e8f6aa4384 100644
--- a/arch/s390/include/asm/page.h
+++ b/arch/s390/include/asm/page.h
@@ -152,4 +152,6 @@ void arch_alloc_page(struct page *page, int order);
152#include <asm-generic/memory_model.h> 152#include <asm-generic/memory_model.h>
153#include <asm-generic/page.h> 153#include <asm-generic/page.h>
154 154
155#define __HAVE_ARCH_GATE_AREA 1
156
155#endif /* _S390_PAGE_H */ 157#endif /* _S390_PAGE_H */
diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h
index f5b2bf3d7c1d..b2658b9220fe 100644
--- a/arch/s390/include/asm/pgalloc.h
+++ b/arch/s390/include/asm/pgalloc.h
@@ -28,6 +28,8 @@ void disable_noexec(struct mm_struct *, struct task_struct *);
28 28
29static inline void clear_table(unsigned long *s, unsigned long val, size_t n) 29static inline void clear_table(unsigned long *s, unsigned long val, size_t n)
30{ 30{
31 typedef struct { char _[n]; } addrtype;
32
31 *s = val; 33 *s = val;
32 n = (n / 256) - 1; 34 n = (n / 256) - 1;
33 asm volatile( 35 asm volatile(
@@ -39,7 +41,8 @@ static inline void clear_table(unsigned long *s, unsigned long val, size_t n)
39 "0: mvc 256(256,%0),0(%0)\n" 41 "0: mvc 256(256,%0),0(%0)\n"
40 " la %0,256(%0)\n" 42 " la %0,256(%0)\n"
41 " brct %1,0b\n" 43 " brct %1,0b\n"
42 : "+a" (s), "+d" (n)); 44 : "+a" (s), "+d" (n), "=m" (*(addrtype *) s)
45 : "m" (*(addrtype *) s));
43} 46}
44 47
45static inline void crst_table_init(unsigned long *crst, unsigned long entry) 48static inline void crst_table_init(unsigned long *crst, unsigned long entry)
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
index 4af80af2a88f..066b99502e09 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -13,6 +13,7 @@
13#ifndef __ASM_S390_PROCESSOR_H 13#ifndef __ASM_S390_PROCESSOR_H
14#define __ASM_S390_PROCESSOR_H 14#define __ASM_S390_PROCESSOR_H
15 15
16#include <linux/linkage.h>
16#include <asm/ptrace.h> 17#include <asm/ptrace.h>
17 18
18#ifdef __KERNEL__ 19#ifdef __KERNEL__
@@ -258,7 +259,7 @@ static inline void enabled_wait(void)
258 * Function to drop a processor into disabled wait state 259 * Function to drop a processor into disabled wait state
259 */ 260 */
260 261
261static inline void disabled_wait(unsigned long code) 262static inline void ATTRIB_NORET disabled_wait(unsigned long code)
262{ 263{
263 unsigned long ctl_buf; 264 unsigned long ctl_buf;
264 psw_t dw_psw; 265 psw_t dw_psw;
@@ -322,6 +323,7 @@ static inline void disabled_wait(unsigned long code)
322 : "=m" (ctl_buf) 323 : "=m" (ctl_buf)
323 : "a" (&dw_psw), "a" (&ctl_buf), "m" (dw_psw) : "cc", "0"); 324 : "a" (&dw_psw), "a" (&ctl_buf), "m" (dw_psw) : "cc", "0");
324#endif /* __s390x__ */ 325#endif /* __s390x__ */
326 while (1);
325} 327}
326 328
327/* 329/*
diff --git a/arch/s390/include/asm/qdio.h b/arch/s390/include/asm/qdio.h
index 4734c3f05354..27fc1746de15 100644
--- a/arch/s390/include/asm/qdio.h
+++ b/arch/s390/include/asm/qdio.h
@@ -373,16 +373,16 @@ struct qdio_initialize {
373#define QDIO_FLAG_SYNC_OUTPUT 0x02 373#define QDIO_FLAG_SYNC_OUTPUT 0x02
374#define QDIO_FLAG_PCI_OUT 0x10 374#define QDIO_FLAG_PCI_OUT 0x10
375 375
376extern int qdio_initialize(struct qdio_initialize *init_data); 376extern int qdio_initialize(struct qdio_initialize *);
377extern int qdio_allocate(struct qdio_initialize *init_data); 377extern int qdio_allocate(struct qdio_initialize *);
378extern int qdio_establish(struct qdio_initialize *init_data); 378extern int qdio_establish(struct qdio_initialize *);
379extern int qdio_activate(struct ccw_device *); 379extern int qdio_activate(struct ccw_device *);
380 380
381extern int do_QDIO(struct ccw_device*, unsigned int flags, 381extern int do_QDIO(struct ccw_device *cdev, unsigned int callflags,
382 int q_nr, int qidx, int count); 382 int q_nr, int bufnr, int count);
383extern int qdio_cleanup(struct ccw_device*, int how); 383extern int qdio_cleanup(struct ccw_device*, int);
384extern int qdio_shutdown(struct ccw_device*, int how); 384extern int qdio_shutdown(struct ccw_device*, int);
385extern int qdio_free(struct ccw_device *); 385extern int qdio_free(struct ccw_device *);
386extern struct qdio_ssqd_desc *qdio_get_ssqd_desc(struct ccw_device *cdev); 386extern int qdio_get_ssqd_desc(struct ccw_device *dev, struct qdio_ssqd_desc*);
387 387
388#endif /* __QDIO_H__ */ 388#endif /* __QDIO_H__ */
diff --git a/arch/s390/include/asm/s390_rdev.h b/arch/s390/include/asm/s390_rdev.h
deleted file mode 100644
index 6fa20442a48c..000000000000
--- a/arch/s390/include/asm/s390_rdev.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * include/asm-s390/ccwdev.h
3 *
4 * Copyright (C) 2002,2005 IBM Deutschland Entwicklung GmbH, IBM Corporation
5 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
6 * Carsten Otte <cotte@de.ibm.com>
7 *
8 * Interface for s390 root device
9 */
10
11#ifndef _S390_RDEV_H_
12#define _S390_RDEV_H_
13extern struct device *s390_root_dev_register(const char *);
14extern void s390_root_dev_unregister(struct device *);
15#endif /* _S390_RDEV_H_ */
diff --git a/arch/s390/include/asm/sigp.h b/arch/s390/include/asm/sigp.h
index e16d56f8dfe1..ec403d4304f8 100644
--- a/arch/s390/include/asm/sigp.h
+++ b/arch/s390/include/asm/sigp.h
@@ -61,6 +61,7 @@ typedef enum
61{ 61{
62 ec_schedule=0, 62 ec_schedule=0,
63 ec_call_function, 63 ec_call_function,
64 ec_call_function_single,
64 ec_bit_last 65 ec_bit_last
65} ec_bit_sig; 66} ec_bit_sig;
66 67
diff --git a/arch/s390/include/asm/smp.h b/arch/s390/include/asm/smp.h
index ae89cf2478fc..024b91e06239 100644
--- a/arch/s390/include/asm/smp.h
+++ b/arch/s390/include/asm/smp.h
@@ -91,8 +91,9 @@ extern int __cpu_up (unsigned int cpu);
91extern struct mutex smp_cpu_state_mutex; 91extern struct mutex smp_cpu_state_mutex;
92extern int smp_cpu_polarization[]; 92extern int smp_cpu_polarization[];
93 93
94extern int smp_call_function_mask(cpumask_t mask, void (*func)(void *), 94extern void arch_send_call_function_single_ipi(int cpu);
95 void *info, int wait); 95extern void arch_send_call_function_ipi(cpumask_t mask);
96
96#endif 97#endif
97 98
98#ifndef CONFIG_SMP 99#ifndef CONFIG_SMP
diff --git a/arch/s390/include/asm/sysinfo.h b/arch/s390/include/asm/sysinfo.h
index 79d01343f8b0..ad93212d9e16 100644
--- a/arch/s390/include/asm/sysinfo.h
+++ b/arch/s390/include/asm/sysinfo.h
@@ -118,4 +118,15 @@ static inline int stsi(void *sysinfo, int fc, int sel1, int sel2)
118 return r0; 118 return r0;
119} 119}
120 120
121/*
122 * Service level reporting interface.
123 */
124struct service_level {
125 struct list_head list;
126 void (*seq_print)(struct seq_file *, struct service_level *);
127};
128
129int register_service_level(struct service_level *);
130int unregister_service_level(struct service_level *);
131
121#endif /* __ASM_S390_SYSINFO_H */ 132#endif /* __ASM_S390_SYSINFO_H */
diff --git a/arch/s390/include/asm/system.h b/arch/s390/include/asm/system.h
index 819e7d99ca0c..3a8b26eb1f2e 100644
--- a/arch/s390/include/asm/system.h
+++ b/arch/s390/include/asm/system.h
@@ -12,6 +12,7 @@
12#define __ASM_SYSTEM_H 12#define __ASM_SYSTEM_H
13 13
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/errno.h>
15#include <asm/types.h> 16#include <asm/types.h>
16#include <asm/ptrace.h> 17#include <asm/ptrace.h>
17#include <asm/setup.h> 18#include <asm/setup.h>
@@ -98,13 +99,9 @@ static inline void restore_access_regs(unsigned int *acrs)
98 prev = __switch_to(prev,next); \ 99 prev = __switch_to(prev,next); \
99} while (0) 100} while (0)
100 101
101#ifdef CONFIG_VIRT_CPU_ACCOUNTING 102extern void account_vtime(struct task_struct *, struct task_struct *);
102extern void account_vtime(struct task_struct *);
103extern void account_tick_vtime(struct task_struct *); 103extern void account_tick_vtime(struct task_struct *);
104extern void account_system_vtime(struct task_struct *); 104extern void account_system_vtime(struct task_struct *);
105#else
106#define account_vtime(x) do { /* empty */ } while (0)
107#endif
108 105
109#ifdef CONFIG_PFAULT 106#ifdef CONFIG_PFAULT
110extern void pfault_irq_init(void); 107extern void pfault_irq_init(void);
@@ -124,7 +121,7 @@ static inline void cmma_init(void) { }
124 121
125#define finish_arch_switch(prev) do { \ 122#define finish_arch_switch(prev) do { \
126 set_fs(current->thread.mm_segment); \ 123 set_fs(current->thread.mm_segment); \
127 account_vtime(prev); \ 124 account_vtime(prev, current); \
128} while (0) 125} while (0)
129 126
130#define nop() asm volatile("nop") 127#define nop() asm volatile("nop")
@@ -413,8 +410,6 @@ __set_psw_mask(unsigned long mask)
413#define local_mcck_enable() __set_psw_mask(psw_kernel_bits) 410#define local_mcck_enable() __set_psw_mask(psw_kernel_bits)
414#define local_mcck_disable() __set_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK) 411#define local_mcck_disable() __set_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK)
415 412
416int stfle(unsigned long long *list, int doublewords);
417
418#ifdef CONFIG_SMP 413#ifdef CONFIG_SMP
419 414
420extern void smp_ctl_set_bit(int cr, int bit); 415extern void smp_ctl_set_bit(int cr, int bit);
@@ -438,6 +433,23 @@ static inline unsigned int stfl(void)
438 return S390_lowcore.stfl_fac_list; 433 return S390_lowcore.stfl_fac_list;
439} 434}
440 435
436static inline int __stfle(unsigned long long *list, int doublewords)
437{
438 typedef struct { unsigned long long _[doublewords]; } addrtype;
439 register unsigned long __nr asm("0") = doublewords - 1;
440
441 asm volatile(".insn s,0xb2b00000,%0" /* stfle */
442 : "=m" (*(addrtype *) list), "+d" (__nr) : : "cc");
443 return __nr + 1;
444}
445
446static inline int stfle(unsigned long long *list, int doublewords)
447{
448 if (!(stfl() & (1UL << 24)))
449 return -EOPNOTSUPP;
450 return __stfle(list, doublewords);
451}
452
441static inline unsigned short stap(void) 453static inline unsigned short stap(void)
442{ 454{
443 unsigned short cpu_address; 455 unsigned short cpu_address;
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h
index c1eaf9604da7..c544aa524535 100644
--- a/arch/s390/include/asm/thread_info.h
+++ b/arch/s390/include/asm/thread_info.h
@@ -47,6 +47,8 @@ struct thread_info {
47 unsigned int cpu; /* current CPU */ 47 unsigned int cpu; /* current CPU */
48 int preempt_count; /* 0 => preemptable, <0 => BUG */ 48 int preempt_count; /* 0 => preemptable, <0 => BUG */
49 struct restart_block restart_block; 49 struct restart_block restart_block;
50 __u64 user_timer;
51 __u64 system_timer;
50}; 52};
51 53
52/* 54/*
diff --git a/arch/s390/include/asm/timer.h b/arch/s390/include/asm/timer.h
index d98d79e35cd6..e4bcab739c19 100644
--- a/arch/s390/include/asm/timer.h
+++ b/arch/s390/include/asm/timer.h
@@ -23,20 +23,18 @@ struct vtimer_list {
23 __u64 expires; 23 __u64 expires;
24 __u64 interval; 24 __u64 interval;
25 25
26 spinlock_t lock;
27 unsigned long magic;
28
29 void (*function)(unsigned long); 26 void (*function)(unsigned long);
30 unsigned long data; 27 unsigned long data;
31}; 28};
32 29
33/* the offset value will wrap after ca. 71 years */ 30/* the vtimer value will wrap after ca. 71 years */
34struct vtimer_queue { 31struct vtimer_queue {
35 struct list_head list; 32 struct list_head list;
36 spinlock_t lock; 33 spinlock_t lock;
37 __u64 to_expire; /* current event expire time */ 34 __u64 timer; /* last programmed timer */
38 __u64 offset; /* list offset to zero */ 35 __u64 elapsed; /* elapsed time of timer expire values */
39 __u64 idle; /* temp var for idle */ 36 __u64 idle; /* temp var for idle */
37 int do_spt; /* =1: reprogram cpu timer in idle */
40}; 38};
41 39
42extern void init_virt_timer(struct vtimer_list *timer); 40extern void init_virt_timer(struct vtimer_list *timer);
@@ -48,17 +46,8 @@ extern int del_virt_timer(struct vtimer_list *timer);
48extern void init_cpu_vtimer(void); 46extern void init_cpu_vtimer(void);
49extern void vtime_init(void); 47extern void vtime_init(void);
50 48
51#ifdef CONFIG_VIRT_TIMER 49extern void vtime_stop_cpu(void);
52 50extern void vtime_start_leave(void);
53extern void vtime_start_cpu_timer(void);
54extern void vtime_stop_cpu_timer(void);
55
56#else
57
58static inline void vtime_start_cpu_timer(void) { }
59static inline void vtime_stop_cpu_timer(void) { }
60
61#endif /* CONFIG_VIRT_TIMER */
62 51
63#endif /* __KERNEL__ */ 52#endif /* __KERNEL__ */
64 53
diff --git a/arch/s390/include/asm/topology.h b/arch/s390/include/asm/topology.h
index d96c91643458..c93eb50e1d09 100644
--- a/arch/s390/include/asm/topology.h
+++ b/arch/s390/include/asm/topology.h
@@ -6,10 +6,12 @@
6#define mc_capable() (1) 6#define mc_capable() (1)
7 7
8cpumask_t cpu_coregroup_map(unsigned int cpu); 8cpumask_t cpu_coregroup_map(unsigned int cpu);
9const struct cpumask *cpu_coregroup_mask(unsigned int cpu);
9 10
10extern cpumask_t cpu_core_map[NR_CPUS]; 11extern cpumask_t cpu_core_map[NR_CPUS];
11 12
12#define topology_core_siblings(cpu) (cpu_core_map[cpu]) 13#define topology_core_siblings(cpu) (cpu_core_map[cpu])
14#define topology_core_cpumask(cpu) (&cpu_core_map[cpu])
13 15
14int topology_set_cpu_management(int fc); 16int topology_set_cpu_management(int fc);
15void topology_schedule_update(void); 17void topology_schedule_update(void);
diff --git a/arch/s390/include/asm/vdso.h b/arch/s390/include/asm/vdso.h
new file mode 100644
index 000000000000..7bdd7c8ebc91
--- /dev/null
+++ b/arch/s390/include/asm/vdso.h
@@ -0,0 +1,50 @@
1#ifndef __S390_VDSO_H__
2#define __S390_VDSO_H__
3
4#ifdef __KERNEL__
5
6/* Default link addresses for the vDSOs */
7#define VDSO32_LBASE 0
8#define VDSO64_LBASE 0
9
10#define VDSO_VERSION_STRING LINUX_2.6.26
11
12#ifndef __ASSEMBLY__
13
14/*
15 * Note about the vdso_data and vdso_per_cpu_data structures:
16 *
17 * NEVER USE THEM IN USERSPACE CODE DIRECTLY. The layout of the
18 * structure is supposed to be known only to the function in the vdso
19 * itself and may change without notice.
20 */
21
22struct vdso_data {
23 __u64 tb_update_count; /* Timebase atomicity ctr 0x00 */
24 __u64 xtime_tod_stamp; /* TOD clock for xtime 0x08 */
25 __u64 xtime_clock_sec; /* Kernel time 0x10 */
26 __u64 xtime_clock_nsec; /* 0x18 */
27 __u64 wtom_clock_sec; /* Wall to monotonic clock 0x20 */
28 __u64 wtom_clock_nsec; /* 0x28 */
29 __u32 tz_minuteswest; /* Minutes west of Greenwich 0x30 */
30 __u32 tz_dsttime; /* Type of dst correction 0x34 */
31 __u32 ectg_available;
32};
33
34struct vdso_per_cpu_data {
35 __u64 ectg_timer_base;
36 __u64 ectg_user_time;
37};
38
39extern struct vdso_data *vdso_data;
40
41#ifdef CONFIG_64BIT
42int vdso_alloc_per_cpu(int cpu, struct _lowcore *lowcore);
43void vdso_free_per_cpu(int cpu, struct _lowcore *lowcore);
44#endif
45
46#endif /* __ASSEMBLY__ */
47
48#endif /* __KERNEL__ */
49
50#endif /* __S390_VDSO_H__ */
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 50f657e77344..3edc6c6f258b 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -2,6 +2,11 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5ifdef CONFIG_FUNCTION_TRACER
6# Do not trace early boot code
7CFLAGS_REMOVE_early.o = -pg
8endif
9
5# 10#
6# Passing null pointers is ok for smp code, since we access the lowcore here. 11# Passing null pointers is ok for smp code, since we access the lowcore here.
7# 12#
@@ -12,9 +17,10 @@ CFLAGS_smp.o := -Wno-nonnull
12# 17#
13CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"' 18CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"'
14 19
15obj-y := bitmap.o traps.o time.o process.o base.o early.o \ 20obj-y := bitmap.o traps.o time.o process.o base.o early.o setup.o \
16 setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \ 21 processor.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \
17 s390_ext.o debug.o irq.o ipl.o dis.o diag.o mem_detect.o 22 s390_ext.o debug.o irq.o ipl.o dis.o diag.o mem_detect.o \
23 vdso.o vtime.o
18 24
19obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o) 25obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o)
20obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o) 26obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o)
@@ -30,12 +36,16 @@ obj-$(CONFIG_COMPAT) += compat_linux.o compat_signal.o \
30 compat_wrapper.o compat_exec_domain.o \ 36 compat_wrapper.o compat_exec_domain.o \
31 $(compat-obj-y) 37 $(compat-obj-y)
32 38
33obj-$(CONFIG_VIRT_TIMER) += vtime.o
34obj-$(CONFIG_STACKTRACE) += stacktrace.o 39obj-$(CONFIG_STACKTRACE) += stacktrace.o
35obj-$(CONFIG_KPROBES) += kprobes.o 40obj-$(CONFIG_KPROBES) += kprobes.o
41obj-$(CONFIG_FUNCTION_TRACER) += mcount.o
36 42
37# Kexec part 43# Kexec part
38S390_KEXEC_OBJS := machine_kexec.o crash.o 44S390_KEXEC_OBJS := machine_kexec.o crash.o
39S390_KEXEC_OBJS += $(if $(CONFIG_64BIT),relocate_kernel64.o,relocate_kernel.o) 45S390_KEXEC_OBJS += $(if $(CONFIG_64BIT),relocate_kernel64.o,relocate_kernel.o)
40obj-$(CONFIG_KEXEC) += $(S390_KEXEC_OBJS) 46obj-$(CONFIG_KEXEC) += $(S390_KEXEC_OBJS)
41 47
48# vdso
49obj-$(CONFIG_64BIT) += vdso64/
50obj-$(CONFIG_32BIT) += vdso32/
51obj-$(CONFIG_COMPAT) += vdso32/
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c
index 3d144e6020c6..67a60016babb 100644
--- a/arch/s390/kernel/asm-offsets.c
+++ b/arch/s390/kernel/asm-offsets.c
@@ -6,6 +6,7 @@
6 6
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/kbuild.h> 8#include <linux/kbuild.h>
9#include <asm/vdso.h>
9 10
10int main(void) 11int main(void)
11{ 12{
@@ -38,5 +39,24 @@ int main(void)
38 DEFINE(__SF_BACKCHAIN, offsetof(struct stack_frame, back_chain)); 39 DEFINE(__SF_BACKCHAIN, offsetof(struct stack_frame, back_chain));
39 DEFINE(__SF_GPRS, offsetof(struct stack_frame, gprs)); 40 DEFINE(__SF_GPRS, offsetof(struct stack_frame, gprs));
40 DEFINE(__SF_EMPTY, offsetof(struct stack_frame, empty1)); 41 DEFINE(__SF_EMPTY, offsetof(struct stack_frame, empty1));
42 BLANK();
43 /* timeval/timezone offsets for use by vdso */
44 DEFINE(__VDSO_UPD_COUNT, offsetof(struct vdso_data, tb_update_count));
45 DEFINE(__VDSO_XTIME_STAMP, offsetof(struct vdso_data, xtime_tod_stamp));
46 DEFINE(__VDSO_XTIME_SEC, offsetof(struct vdso_data, xtime_clock_sec));
47 DEFINE(__VDSO_XTIME_NSEC, offsetof(struct vdso_data, xtime_clock_nsec));
48 DEFINE(__VDSO_WTOM_SEC, offsetof(struct vdso_data, wtom_clock_sec));
49 DEFINE(__VDSO_WTOM_NSEC, offsetof(struct vdso_data, wtom_clock_nsec));
50 DEFINE(__VDSO_TIMEZONE, offsetof(struct vdso_data, tz_minuteswest));
51 DEFINE(__VDSO_ECTG_OK, offsetof(struct vdso_data, ectg_available));
52 DEFINE(__VDSO_ECTG_BASE,
53 offsetof(struct vdso_per_cpu_data, ectg_timer_base));
54 DEFINE(__VDSO_ECTG_USER,
55 offsetof(struct vdso_per_cpu_data, ectg_user_time));
56 /* constants used by the vdso */
57 DEFINE(CLOCK_REALTIME, CLOCK_REALTIME);
58 DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC);
59 DEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC);
60
41 return 0; 61 return 0;
42} 62}
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 4646382af34f..6cc87d8c8682 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -148,9 +148,9 @@ asmlinkage long sys32_getresuid16(u16 __user *ruid, u16 __user *euid, u16 __user
148{ 148{
149 int retval; 149 int retval;
150 150
151 if (!(retval = put_user(high2lowuid(current->uid), ruid)) && 151 if (!(retval = put_user(high2lowuid(current->cred->uid), ruid)) &&
152 !(retval = put_user(high2lowuid(current->euid), euid))) 152 !(retval = put_user(high2lowuid(current->cred->euid), euid)))
153 retval = put_user(high2lowuid(current->suid), suid); 153 retval = put_user(high2lowuid(current->cred->suid), suid);
154 154
155 return retval; 155 return retval;
156} 156}
@@ -165,9 +165,9 @@ asmlinkage long sys32_getresgid16(u16 __user *rgid, u16 __user *egid, u16 __user
165{ 165{
166 int retval; 166 int retval;
167 167
168 if (!(retval = put_user(high2lowgid(current->gid), rgid)) && 168 if (!(retval = put_user(high2lowgid(current->cred->gid), rgid)) &&
169 !(retval = put_user(high2lowgid(current->egid), egid))) 169 !(retval = put_user(high2lowgid(current->cred->egid), egid)))
170 retval = put_user(high2lowgid(current->sgid), sgid); 170 retval = put_user(high2lowgid(current->cred->sgid), sgid);
171 171
172 return retval; 172 return retval;
173} 173}
@@ -217,20 +217,20 @@ asmlinkage long sys32_getgroups16(int gidsetsize, u16 __user *grouplist)
217 if (gidsetsize < 0) 217 if (gidsetsize < 0)
218 return -EINVAL; 218 return -EINVAL;
219 219
220 get_group_info(current->group_info); 220 get_group_info(current->cred->group_info);
221 i = current->group_info->ngroups; 221 i = current->cred->group_info->ngroups;
222 if (gidsetsize) { 222 if (gidsetsize) {
223 if (i > gidsetsize) { 223 if (i > gidsetsize) {
224 i = -EINVAL; 224 i = -EINVAL;
225 goto out; 225 goto out;
226 } 226 }
227 if (groups16_to_user(grouplist, current->group_info)) { 227 if (groups16_to_user(grouplist, current->cred->group_info)) {
228 i = -EFAULT; 228 i = -EFAULT;
229 goto out; 229 goto out;
230 } 230 }
231 } 231 }
232out: 232out:
233 put_group_info(current->group_info); 233 put_group_info(current->cred->group_info);
234 return i; 234 return i;
235} 235}
236 236
@@ -261,22 +261,22 @@ asmlinkage long sys32_setgroups16(int gidsetsize, u16 __user *grouplist)
261 261
262asmlinkage long sys32_getuid16(void) 262asmlinkage long sys32_getuid16(void)
263{ 263{
264 return high2lowuid(current->uid); 264 return high2lowuid(current->cred->uid);
265} 265}
266 266
267asmlinkage long sys32_geteuid16(void) 267asmlinkage long sys32_geteuid16(void)
268{ 268{
269 return high2lowuid(current->euid); 269 return high2lowuid(current->cred->euid);
270} 270}
271 271
272asmlinkage long sys32_getgid16(void) 272asmlinkage long sys32_getgid16(void)
273{ 273{
274 return high2lowgid(current->gid); 274 return high2lowgid(current->cred->gid);
275} 275}
276 276
277asmlinkage long sys32_getegid16(void) 277asmlinkage long sys32_getegid16(void)
278{ 278{
279 return high2lowgid(current->egid); 279 return high2lowgid(current->cred->egid);
280} 280}
281 281
282/* 282/*
diff --git a/arch/s390/kernel/cpcmd.c b/arch/s390/kernel/cpcmd.c
index d8c1131e0815..3e8b8816f309 100644
--- a/arch/s390/kernel/cpcmd.c
+++ b/arch/s390/kernel/cpcmd.c
@@ -7,6 +7,9 @@
7 * Christian Borntraeger (cborntra@de.ibm.com), 7 * Christian Borntraeger (cborntra@de.ibm.com),
8 */ 8 */
9 9
10#define KMSG_COMPONENT "cpcmd"
11#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
12
10#include <linux/kernel.h> 13#include <linux/kernel.h>
11#include <linux/module.h> 14#include <linux/module.h>
12#include <linux/slab.h> 15#include <linux/slab.h>
@@ -104,8 +107,8 @@ int cpcmd(const char *cmd, char *response, int rlen, int *response_code)
104 (((unsigned long)response + rlen) >> 31)) { 107 (((unsigned long)response + rlen) >> 31)) {
105 lowbuf = kmalloc(rlen, GFP_KERNEL | GFP_DMA); 108 lowbuf = kmalloc(rlen, GFP_KERNEL | GFP_DMA);
106 if (!lowbuf) { 109 if (!lowbuf) {
107 printk(KERN_WARNING 110 pr_warning("The cpcmd kernel function failed to "
108 "cpcmd: could not allocate response buffer\n"); 111 "allocate a response buffer\n");
109 return -ENOMEM; 112 return -ENOMEM;
110 } 113 }
111 spin_lock_irqsave(&cpcmd_lock, flags); 114 spin_lock_irqsave(&cpcmd_lock, flags);
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index d80fcd4a7fe1..ba03fc0a3a56 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -10,6 +10,9 @@
10 * Bugreports to: <Linux390@de.ibm.com> 10 * Bugreports to: <Linux390@de.ibm.com>
11 */ 11 */
12 12
13#define KMSG_COMPONENT "s390dbf"
14#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
15
13#include <linux/stddef.h> 16#include <linux/stddef.h>
14#include <linux/kernel.h> 17#include <linux/kernel.h>
15#include <linux/errno.h> 18#include <linux/errno.h>
@@ -388,7 +391,7 @@ debug_info_copy(debug_info_t* in, int mode)
388 debug_info_free(rc); 391 debug_info_free(rc);
389 } while (1); 392 } while (1);
390 393
391 if(!rc || (mode == NO_AREAS)) 394 if (mode == NO_AREAS)
392 goto out; 395 goto out;
393 396
394 for(i = 0; i < in->nr_areas; i++){ 397 for(i = 0; i < in->nr_areas; i++){
@@ -693,8 +696,8 @@ debug_info_t *debug_register_mode(const char *name, int pages_per_area,
693 /* Since debugfs currently does not support uid/gid other than root, */ 696 /* Since debugfs currently does not support uid/gid other than root, */
694 /* we do not allow gid/uid != 0 until we get support for that. */ 697 /* we do not allow gid/uid != 0 until we get support for that. */
695 if ((uid != 0) || (gid != 0)) 698 if ((uid != 0) || (gid != 0))
696 printk(KERN_WARNING "debug: Warning - Currently only uid/gid " 699 pr_warning("Root becomes the owner of all s390dbf files "
697 "= 0 are supported. Using root as owner now!"); 700 "in sysfs\n");
698 if (!initialized) 701 if (!initialized)
699 BUG(); 702 BUG();
700 mutex_lock(&debug_mutex); 703 mutex_lock(&debug_mutex);
@@ -709,7 +712,7 @@ debug_info_t *debug_register_mode(const char *name, int pages_per_area,
709 debug_register_view(rc, &debug_pages_view); 712 debug_register_view(rc, &debug_pages_view);
710out: 713out:
711 if (!rc){ 714 if (!rc){
712 printk(KERN_ERR "debug: debug_register failed for %s\n",name); 715 pr_err("Registering debug feature %s failed\n", name);
713 } 716 }
714 mutex_unlock(&debug_mutex); 717 mutex_unlock(&debug_mutex);
715 return rc; 718 return rc;
@@ -763,8 +766,8 @@ debug_set_size(debug_info_t* id, int nr_areas, int pages_per_area)
763 if(pages_per_area > 0){ 766 if(pages_per_area > 0){
764 new_areas = debug_areas_alloc(pages_per_area, nr_areas); 767 new_areas = debug_areas_alloc(pages_per_area, nr_areas);
765 if(!new_areas) { 768 if(!new_areas) {
766 printk(KERN_WARNING "debug: could not allocate memory "\ 769 pr_info("Allocating memory for %i pages failed\n",
767 "for pagenumber: %i\n",pages_per_area); 770 pages_per_area);
768 rc = -ENOMEM; 771 rc = -ENOMEM;
769 goto out; 772 goto out;
770 } 773 }
@@ -780,8 +783,7 @@ debug_set_size(debug_info_t* id, int nr_areas, int pages_per_area)
780 memset(id->active_entries,0,sizeof(int)*id->nr_areas); 783 memset(id->active_entries,0,sizeof(int)*id->nr_areas);
781 memset(id->active_pages, 0, sizeof(int)*id->nr_areas); 784 memset(id->active_pages, 0, sizeof(int)*id->nr_areas);
782 spin_unlock_irqrestore(&id->lock,flags); 785 spin_unlock_irqrestore(&id->lock,flags);
783 printk(KERN_INFO "debug: %s: set new size (%i pages)\n"\ 786 pr_info("%s: set new size (%i pages)\n" ,id->name, pages_per_area);
784 ,id->name, pages_per_area);
785out: 787out:
786 return rc; 788 return rc;
787} 789}
@@ -800,10 +802,9 @@ debug_set_level(debug_info_t* id, int new_level)
800 spin_lock_irqsave(&id->lock,flags); 802 spin_lock_irqsave(&id->lock,flags);
801 if(new_level == DEBUG_OFF_LEVEL){ 803 if(new_level == DEBUG_OFF_LEVEL){
802 id->level = DEBUG_OFF_LEVEL; 804 id->level = DEBUG_OFF_LEVEL;
803 printk(KERN_INFO "debug: %s: switched off\n",id->name); 805 pr_info("%s: switched off\n",id->name);
804 } else if ((new_level > DEBUG_MAX_LEVEL) || (new_level < 0)) { 806 } else if ((new_level > DEBUG_MAX_LEVEL) || (new_level < 0)) {
805 printk(KERN_INFO 807 pr_info("%s: level %i is out of range (%i - %i)\n",
806 "debug: %s: level %i is out of range (%i - %i)\n",
807 id->name, new_level, 0, DEBUG_MAX_LEVEL); 808 id->name, new_level, 0, DEBUG_MAX_LEVEL);
808 } else { 809 } else {
809 id->level = new_level; 810 id->level = new_level;
@@ -1108,8 +1109,8 @@ debug_register_view(debug_info_t * id, struct debug_view *view)
1108 pde = debugfs_create_file(view->name, mode, id->debugfs_root_entry, 1109 pde = debugfs_create_file(view->name, mode, id->debugfs_root_entry,
1109 id , &debug_file_ops); 1110 id , &debug_file_ops);
1110 if (!pde){ 1111 if (!pde){
1111 printk(KERN_WARNING "debug: debugfs_create_file() failed!"\ 1112 pr_err("Registering view %s/%s failed due to out of "
1112 " Cannot register view %s/%s\n", id->name,view->name); 1113 "memory\n", id->name,view->name);
1113 rc = -1; 1114 rc = -1;
1114 goto out; 1115 goto out;
1115 } 1116 }
@@ -1119,10 +1120,8 @@ debug_register_view(debug_info_t * id, struct debug_view *view)
1119 break; 1120 break;
1120 } 1121 }
1121 if (i == DEBUG_MAX_VIEWS) { 1122 if (i == DEBUG_MAX_VIEWS) {
1122 printk(KERN_WARNING "debug: cannot register view %s/%s\n", 1123 pr_err("Registering view %s/%s would exceed the maximum "
1123 id->name,view->name); 1124 "number of views %i\n", id->name, view->name, i);
1124 printk(KERN_WARNING
1125 "debug: maximum number of views reached (%i)!\n", i);
1126 debugfs_remove(pde); 1125 debugfs_remove(pde);
1127 rc = -1; 1126 rc = -1;
1128 } else { 1127 } else {
@@ -1303,7 +1302,8 @@ debug_input_level_fn(debug_info_t * id, struct debug_view *view,
1303 new_level = debug_get_uint(str); 1302 new_level = debug_get_uint(str);
1304 } 1303 }
1305 if(new_level < 0) { 1304 if(new_level < 0) {
1306 printk(KERN_INFO "debug: level `%s` is not valid\n", str); 1305 pr_warning("%s is not a valid level for a debug "
1306 "feature\n", str);
1307 rc = -EINVAL; 1307 rc = -EINVAL;
1308 } else { 1308 } else {
1309 debug_set_level(id, new_level); 1309 debug_set_level(id, new_level);
@@ -1380,7 +1380,8 @@ debug_input_flush_fn(debug_info_t * id, struct debug_view *view,
1380 goto out; 1380 goto out;
1381 } 1381 }
1382 1382
1383 printk(KERN_INFO "debug: area `%c` is not valid\n", input_buf[0]); 1383 pr_info("Flushing debug data failed because %c is not a valid "
1384 "area\n", input_buf[0]);
1384 1385
1385out: 1386out:
1386 *offset += user_len; 1387 *offset += user_len;
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 198ea18a534d..1268aa2991bf 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -109,13 +109,6 @@ STACK_SIZE = 1 << STACK_SHIFT
109 * R15 - kernel stack pointer 109 * R15 - kernel stack pointer
110 */ 110 */
111 111
112 .macro STORE_TIMER lc_offset
113#ifdef CONFIG_VIRT_CPU_ACCOUNTING
114 stpt \lc_offset
115#endif
116 .endm
117
118#ifdef CONFIG_VIRT_CPU_ACCOUNTING
119 .macro UPDATE_VTIME lc_from,lc_to,lc_sum 112 .macro UPDATE_VTIME lc_from,lc_to,lc_sum
120 lm %r10,%r11,\lc_from 113 lm %r10,%r11,\lc_from
121 sl %r10,\lc_to 114 sl %r10,\lc_to
@@ -128,7 +121,6 @@ STACK_SIZE = 1 << STACK_SHIFT
128 al %r10,BASED(.Lc_1) 121 al %r10,BASED(.Lc_1)
1291: stm %r10,%r11,\lc_sum 1221: stm %r10,%r11,\lc_sum
130 .endm 123 .endm
131#endif
132 124
133 .macro SAVE_ALL_BASE savearea 125 .macro SAVE_ALL_BASE savearea
134 stm %r12,%r15,\savearea 126 stm %r12,%r15,\savearea
@@ -198,7 +190,7 @@ STACK_SIZE = 1 << STACK_SHIFT
198 ni \psworg+1,0xfd # clear wait state bit 190 ni \psworg+1,0xfd # clear wait state bit
199 .endif 191 .endif
200 lm %r0,%r15,SP_R0(%r15) # load gprs 0-15 of user 192 lm %r0,%r15,SP_R0(%r15) # load gprs 0-15 of user
201 STORE_TIMER __LC_EXIT_TIMER 193 stpt __LC_EXIT_TIMER
202 lpsw \psworg # back to caller 194 lpsw \psworg # back to caller
203 .endm 195 .endm
204 196
@@ -247,20 +239,18 @@ __critical_start:
247 239
248 .globl system_call 240 .globl system_call
249system_call: 241system_call:
250 STORE_TIMER __LC_SYNC_ENTER_TIMER 242 stpt __LC_SYNC_ENTER_TIMER
251sysc_saveall: 243sysc_saveall:
252 SAVE_ALL_BASE __LC_SAVE_AREA 244 SAVE_ALL_BASE __LC_SAVE_AREA
253 SAVE_ALL_SVC __LC_SVC_OLD_PSW,__LC_SAVE_AREA 245 SAVE_ALL_SVC __LC_SVC_OLD_PSW,__LC_SAVE_AREA
254 CREATE_STACK_FRAME __LC_SVC_OLD_PSW,__LC_SAVE_AREA 246 CREATE_STACK_FRAME __LC_SVC_OLD_PSW,__LC_SAVE_AREA
255 lh %r7,0x8a # get svc number from lowcore 247 lh %r7,0x8a # get svc number from lowcore
256#ifdef CONFIG_VIRT_CPU_ACCOUNTING
257sysc_vtime: 248sysc_vtime:
258 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 249 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER
259sysc_stime: 250sysc_stime:
260 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 251 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
261sysc_update: 252sysc_update:
262 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 253 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
263#endif
264sysc_do_svc: 254sysc_do_svc:
265 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct 255 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct
266 ltr %r7,%r7 # test for svc 0 256 ltr %r7,%r7 # test for svc 0
@@ -436,7 +426,7 @@ ret_from_fork:
436 basr %r14,%r1 426 basr %r14,%r1
437 TRACE_IRQS_ON 427 TRACE_IRQS_ON
438 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 428 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
439 b BASED(sysc_return) 429 b BASED(sysc_tracenogo)
440 430
441# 431#
442# kernel_execve function needs to deal with pt_regs that is not 432# kernel_execve function needs to deal with pt_regs that is not
@@ -490,20 +480,18 @@ pgm_check_handler:
490 * we just ignore the PER event (FIXME: is there anything we have to do 480 * we just ignore the PER event (FIXME: is there anything we have to do
491 * for LPSW?). 481 * for LPSW?).
492 */ 482 */
493 STORE_TIMER __LC_SYNC_ENTER_TIMER 483 stpt __LC_SYNC_ENTER_TIMER
494 SAVE_ALL_BASE __LC_SAVE_AREA 484 SAVE_ALL_BASE __LC_SAVE_AREA
495 tm __LC_PGM_INT_CODE+1,0x80 # check whether we got a per exception 485 tm __LC_PGM_INT_CODE+1,0x80 # check whether we got a per exception
496 bnz BASED(pgm_per) # got per exception -> special case 486 bnz BASED(pgm_per) # got per exception -> special case
497 SAVE_ALL_SYNC __LC_PGM_OLD_PSW,__LC_SAVE_AREA 487 SAVE_ALL_SYNC __LC_PGM_OLD_PSW,__LC_SAVE_AREA
498 CREATE_STACK_FRAME __LC_PGM_OLD_PSW,__LC_SAVE_AREA 488 CREATE_STACK_FRAME __LC_PGM_OLD_PSW,__LC_SAVE_AREA
499#ifdef CONFIG_VIRT_CPU_ACCOUNTING
500 tm SP_PSW+1(%r15),0x01 # interrupting from user ? 489 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
501 bz BASED(pgm_no_vtime) 490 bz BASED(pgm_no_vtime)
502 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 491 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER
503 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 492 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
504 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 493 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
505pgm_no_vtime: 494pgm_no_vtime:
506#endif
507 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct 495 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct
508 TRACE_IRQS_OFF 496 TRACE_IRQS_OFF
509 l %r3,__LC_PGM_ILC # load program interruption code 497 l %r3,__LC_PGM_ILC # load program interruption code
@@ -536,14 +524,12 @@ pgm_per:
536pgm_per_std: 524pgm_per_std:
537 SAVE_ALL_SYNC __LC_PGM_OLD_PSW,__LC_SAVE_AREA 525 SAVE_ALL_SYNC __LC_PGM_OLD_PSW,__LC_SAVE_AREA
538 CREATE_STACK_FRAME __LC_PGM_OLD_PSW,__LC_SAVE_AREA 526 CREATE_STACK_FRAME __LC_PGM_OLD_PSW,__LC_SAVE_AREA
539#ifdef CONFIG_VIRT_CPU_ACCOUNTING
540 tm SP_PSW+1(%r15),0x01 # interrupting from user ? 527 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
541 bz BASED(pgm_no_vtime2) 528 bz BASED(pgm_no_vtime2)
542 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 529 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER
543 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 530 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
544 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 531 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
545pgm_no_vtime2: 532pgm_no_vtime2:
546#endif
547 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct 533 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct
548 TRACE_IRQS_OFF 534 TRACE_IRQS_OFF
549 l %r1,__TI_task(%r9) 535 l %r1,__TI_task(%r9)
@@ -565,11 +551,9 @@ pgm_no_vtime2:
565pgm_svcper: 551pgm_svcper:
566 SAVE_ALL_SYNC __LC_SVC_OLD_PSW,__LC_SAVE_AREA 552 SAVE_ALL_SYNC __LC_SVC_OLD_PSW,__LC_SAVE_AREA
567 CREATE_STACK_FRAME __LC_SVC_OLD_PSW,__LC_SAVE_AREA 553 CREATE_STACK_FRAME __LC_SVC_OLD_PSW,__LC_SAVE_AREA
568#ifdef CONFIG_VIRT_CPU_ACCOUNTING
569 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 554 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER
570 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 555 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
571 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 556 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
572#endif
573 lh %r7,0x8a # get svc number from lowcore 557 lh %r7,0x8a # get svc number from lowcore
574 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct 558 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct
575 TRACE_IRQS_OFF 559 TRACE_IRQS_OFF
@@ -599,19 +583,17 @@ kernel_per:
599 583
600 .globl io_int_handler 584 .globl io_int_handler
601io_int_handler: 585io_int_handler:
602 STORE_TIMER __LC_ASYNC_ENTER_TIMER
603 stck __LC_INT_CLOCK 586 stck __LC_INT_CLOCK
587 stpt __LC_ASYNC_ENTER_TIMER
604 SAVE_ALL_BASE __LC_SAVE_AREA+16 588 SAVE_ALL_BASE __LC_SAVE_AREA+16
605 SAVE_ALL_ASYNC __LC_IO_OLD_PSW,__LC_SAVE_AREA+16 589 SAVE_ALL_ASYNC __LC_IO_OLD_PSW,__LC_SAVE_AREA+16
606 CREATE_STACK_FRAME __LC_IO_OLD_PSW,__LC_SAVE_AREA+16 590 CREATE_STACK_FRAME __LC_IO_OLD_PSW,__LC_SAVE_AREA+16
607#ifdef CONFIG_VIRT_CPU_ACCOUNTING
608 tm SP_PSW+1(%r15),0x01 # interrupting from user ? 591 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
609 bz BASED(io_no_vtime) 592 bz BASED(io_no_vtime)
610 UPDATE_VTIME __LC_EXIT_TIMER,__LC_ASYNC_ENTER_TIMER,__LC_USER_TIMER 593 UPDATE_VTIME __LC_EXIT_TIMER,__LC_ASYNC_ENTER_TIMER,__LC_USER_TIMER
611 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 594 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
612 mvc __LC_LAST_UPDATE_TIMER(8),__LC_ASYNC_ENTER_TIMER 595 mvc __LC_LAST_UPDATE_TIMER(8),__LC_ASYNC_ENTER_TIMER
613io_no_vtime: 596io_no_vtime:
614#endif
615 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct 597 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct
616 TRACE_IRQS_OFF 598 TRACE_IRQS_OFF
617 l %r1,BASED(.Ldo_IRQ) # load address of do_IRQ 599 l %r1,BASED(.Ldo_IRQ) # load address of do_IRQ
@@ -741,19 +723,17 @@ io_notify_resume:
741 723
742 .globl ext_int_handler 724 .globl ext_int_handler
743ext_int_handler: 725ext_int_handler:
744 STORE_TIMER __LC_ASYNC_ENTER_TIMER
745 stck __LC_INT_CLOCK 726 stck __LC_INT_CLOCK
727 stpt __LC_ASYNC_ENTER_TIMER
746 SAVE_ALL_BASE __LC_SAVE_AREA+16 728 SAVE_ALL_BASE __LC_SAVE_AREA+16
747 SAVE_ALL_ASYNC __LC_EXT_OLD_PSW,__LC_SAVE_AREA+16 729 SAVE_ALL_ASYNC __LC_EXT_OLD_PSW,__LC_SAVE_AREA+16
748 CREATE_STACK_FRAME __LC_EXT_OLD_PSW,__LC_SAVE_AREA+16 730 CREATE_STACK_FRAME __LC_EXT_OLD_PSW,__LC_SAVE_AREA+16
749#ifdef CONFIG_VIRT_CPU_ACCOUNTING
750 tm SP_PSW+1(%r15),0x01 # interrupting from user ? 731 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
751 bz BASED(ext_no_vtime) 732 bz BASED(ext_no_vtime)
752 UPDATE_VTIME __LC_EXIT_TIMER,__LC_ASYNC_ENTER_TIMER,__LC_USER_TIMER 733 UPDATE_VTIME __LC_EXIT_TIMER,__LC_ASYNC_ENTER_TIMER,__LC_USER_TIMER
753 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 734 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
754 mvc __LC_LAST_UPDATE_TIMER(8),__LC_ASYNC_ENTER_TIMER 735 mvc __LC_LAST_UPDATE_TIMER(8),__LC_ASYNC_ENTER_TIMER
755ext_no_vtime: 736ext_no_vtime:
756#endif
757 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct 737 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct
758 TRACE_IRQS_OFF 738 TRACE_IRQS_OFF
759 la %r2,SP_PTREGS(%r15) # address of register-save area 739 la %r2,SP_PTREGS(%r15) # address of register-save area
@@ -770,13 +750,13 @@ __critical_end:
770 750
771 .globl mcck_int_handler 751 .globl mcck_int_handler
772mcck_int_handler: 752mcck_int_handler:
753 stck __LC_INT_CLOCK
773 spt __LC_CPU_TIMER_SAVE_AREA # revalidate cpu timer 754 spt __LC_CPU_TIMER_SAVE_AREA # revalidate cpu timer
774 lm %r0,%r15,__LC_GPREGS_SAVE_AREA # revalidate gprs 755 lm %r0,%r15,__LC_GPREGS_SAVE_AREA # revalidate gprs
775 SAVE_ALL_BASE __LC_SAVE_AREA+32 756 SAVE_ALL_BASE __LC_SAVE_AREA+32
776 la %r12,__LC_MCK_OLD_PSW 757 la %r12,__LC_MCK_OLD_PSW
777 tm __LC_MCCK_CODE,0x80 # system damage? 758 tm __LC_MCCK_CODE,0x80 # system damage?
778 bo BASED(mcck_int_main) # yes -> rest of mcck code invalid 759 bo BASED(mcck_int_main) # yes -> rest of mcck code invalid
779#ifdef CONFIG_VIRT_CPU_ACCOUNTING
780 mvc __LC_SAVE_AREA+52(8),__LC_ASYNC_ENTER_TIMER 760 mvc __LC_SAVE_AREA+52(8),__LC_ASYNC_ENTER_TIMER
781 mvc __LC_ASYNC_ENTER_TIMER(8),__LC_CPU_TIMER_SAVE_AREA 761 mvc __LC_ASYNC_ENTER_TIMER(8),__LC_CPU_TIMER_SAVE_AREA
782 tm __LC_MCCK_CODE+5,0x02 # stored cpu timer value valid? 762 tm __LC_MCCK_CODE+5,0x02 # stored cpu timer value valid?
@@ -793,9 +773,7 @@ mcck_int_handler:
793 la %r14,__LC_LAST_UPDATE_TIMER 773 la %r14,__LC_LAST_UPDATE_TIMER
7940: spt 0(%r14) 7740: spt 0(%r14)
795 mvc __LC_ASYNC_ENTER_TIMER(8),0(%r14) 775 mvc __LC_ASYNC_ENTER_TIMER(8),0(%r14)
7961: 7761: tm __LC_MCCK_CODE+2,0x09 # mwp + ia of old psw valid?
797#endif
798 tm __LC_MCCK_CODE+2,0x09 # mwp + ia of old psw valid?
799 bno BASED(mcck_int_main) # no -> skip cleanup critical 777 bno BASED(mcck_int_main) # no -> skip cleanup critical
800 tm __LC_MCK_OLD_PSW+1,0x01 # test problem state bit 778 tm __LC_MCK_OLD_PSW+1,0x01 # test problem state bit
801 bnz BASED(mcck_int_main) # from user -> load async stack 779 bnz BASED(mcck_int_main) # from user -> load async stack
@@ -812,7 +790,6 @@ mcck_int_main:
812 be BASED(0f) 790 be BASED(0f)
813 l %r15,__LC_PANIC_STACK # load panic stack 791 l %r15,__LC_PANIC_STACK # load panic stack
8140: CREATE_STACK_FRAME __LC_MCK_OLD_PSW,__LC_SAVE_AREA+32 7920: CREATE_STACK_FRAME __LC_MCK_OLD_PSW,__LC_SAVE_AREA+32
815#ifdef CONFIG_VIRT_CPU_ACCOUNTING
816 tm __LC_MCCK_CODE+2,0x08 # mwp of old psw valid? 793 tm __LC_MCCK_CODE+2,0x08 # mwp of old psw valid?
817 bno BASED(mcck_no_vtime) # no -> skip cleanup critical 794 bno BASED(mcck_no_vtime) # no -> skip cleanup critical
818 tm SP_PSW+1(%r15),0x01 # interrupting from user ? 795 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
@@ -821,7 +798,6 @@ mcck_int_main:
821 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 798 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
822 mvc __LC_LAST_UPDATE_TIMER(8),__LC_ASYNC_ENTER_TIMER 799 mvc __LC_LAST_UPDATE_TIMER(8),__LC_ASYNC_ENTER_TIMER
823mcck_no_vtime: 800mcck_no_vtime:
824#endif
825 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct 801 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct
826 la %r2,SP_PTREGS(%r15) # load pt_regs 802 la %r2,SP_PTREGS(%r15) # load pt_regs
827 l %r1,BASED(.Ls390_mcck) 803 l %r1,BASED(.Ls390_mcck)
@@ -843,16 +819,13 @@ mcck_no_vtime:
843mcck_return: 819mcck_return:
844 mvc __LC_RETURN_MCCK_PSW(8),SP_PSW(%r15) # move return PSW 820 mvc __LC_RETURN_MCCK_PSW(8),SP_PSW(%r15) # move return PSW
845 ni __LC_RETURN_MCCK_PSW+1,0xfd # clear wait state bit 821 ni __LC_RETURN_MCCK_PSW+1,0xfd # clear wait state bit
846#ifdef CONFIG_VIRT_CPU_ACCOUNTING
847 mvc __LC_ASYNC_ENTER_TIMER(8),__LC_SAVE_AREA+52 822 mvc __LC_ASYNC_ENTER_TIMER(8),__LC_SAVE_AREA+52
848 tm __LC_RETURN_MCCK_PSW+1,0x01 # returning to user ? 823 tm __LC_RETURN_MCCK_PSW+1,0x01 # returning to user ?
849 bno BASED(0f) 824 bno BASED(0f)
850 lm %r0,%r15,SP_R0(%r15) # load gprs 0-15 825 lm %r0,%r15,SP_R0(%r15) # load gprs 0-15
851 stpt __LC_EXIT_TIMER 826 stpt __LC_EXIT_TIMER
852 lpsw __LC_RETURN_MCCK_PSW # back to caller 827 lpsw __LC_RETURN_MCCK_PSW # back to caller
8530: 8280: lm %r0,%r15,SP_R0(%r15) # load gprs 0-15
854#endif
855 lm %r0,%r15,SP_R0(%r15) # load gprs 0-15
856 lpsw __LC_RETURN_MCCK_PSW # back to caller 829 lpsw __LC_RETURN_MCCK_PSW # back to caller
857 830
858 RESTORE_ALL __LC_RETURN_MCCK_PSW,0 831 RESTORE_ALL __LC_RETURN_MCCK_PSW,0
@@ -976,13 +949,11 @@ cleanup_system_call:
976 b BASED(1f) 949 b BASED(1f)
9770: la %r12,__LC_SAVE_AREA+32 9500: la %r12,__LC_SAVE_AREA+32
9781: 9511:
979#ifdef CONFIG_VIRT_CPU_ACCOUNTING
980 clc __LC_RETURN_PSW+4(4),BASED(cleanup_system_call_insn+4) 952 clc __LC_RETURN_PSW+4(4),BASED(cleanup_system_call_insn+4)
981 bh BASED(0f) 953 bh BASED(0f)
982 mvc __LC_SYNC_ENTER_TIMER(8),__LC_ASYNC_ENTER_TIMER 954 mvc __LC_SYNC_ENTER_TIMER(8),__LC_ASYNC_ENTER_TIMER
9830: clc __LC_RETURN_PSW+4(4),BASED(cleanup_system_call_insn+8) 9550: clc __LC_RETURN_PSW+4(4),BASED(cleanup_system_call_insn+8)
984 bhe BASED(cleanup_vtime) 956 bhe BASED(cleanup_vtime)
985#endif
986 clc __LC_RETURN_PSW+4(4),BASED(cleanup_system_call_insn) 957 clc __LC_RETURN_PSW+4(4),BASED(cleanup_system_call_insn)
987 bh BASED(0f) 958 bh BASED(0f)
988 mvc __LC_SAVE_AREA(16),0(%r12) 959 mvc __LC_SAVE_AREA(16),0(%r12)
@@ -993,7 +964,6 @@ cleanup_system_call:
993 l %r12,__LC_SAVE_AREA+48 # argh 964 l %r12,__LC_SAVE_AREA+48 # argh
994 st %r15,12(%r12) 965 st %r15,12(%r12)
995 lh %r7,0x8a 966 lh %r7,0x8a
996#ifdef CONFIG_VIRT_CPU_ACCOUNTING
997cleanup_vtime: 967cleanup_vtime:
998 clc __LC_RETURN_PSW+4(4),BASED(cleanup_system_call_insn+12) 968 clc __LC_RETURN_PSW+4(4),BASED(cleanup_system_call_insn+12)
999 bhe BASED(cleanup_stime) 969 bhe BASED(cleanup_stime)
@@ -1004,18 +974,15 @@ cleanup_stime:
1004 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 974 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
1005cleanup_update: 975cleanup_update:
1006 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 976 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
1007#endif
1008 mvc __LC_RETURN_PSW+4(4),BASED(cleanup_table_system_call+4) 977 mvc __LC_RETURN_PSW+4(4),BASED(cleanup_table_system_call+4)
1009 la %r12,__LC_RETURN_PSW 978 la %r12,__LC_RETURN_PSW
1010 br %r14 979 br %r14
1011cleanup_system_call_insn: 980cleanup_system_call_insn:
1012 .long sysc_saveall + 0x80000000 981 .long sysc_saveall + 0x80000000
1013#ifdef CONFIG_VIRT_CPU_ACCOUNTING
1014 .long system_call + 0x80000000 982 .long system_call + 0x80000000
1015 .long sysc_vtime + 0x80000000 983 .long sysc_vtime + 0x80000000
1016 .long sysc_stime + 0x80000000 984 .long sysc_stime + 0x80000000
1017 .long sysc_update + 0x80000000 985 .long sysc_update + 0x80000000
1018#endif
1019 986
1020cleanup_sysc_return: 987cleanup_sysc_return:
1021 mvc __LC_RETURN_PSW(4),0(%r12) 988 mvc __LC_RETURN_PSW(4),0(%r12)
@@ -1026,11 +993,9 @@ cleanup_sysc_return:
1026cleanup_sysc_leave: 993cleanup_sysc_leave:
1027 clc 4(4,%r12),BASED(cleanup_sysc_leave_insn) 994 clc 4(4,%r12),BASED(cleanup_sysc_leave_insn)
1028 be BASED(2f) 995 be BASED(2f)
1029#ifdef CONFIG_VIRT_CPU_ACCOUNTING
1030 mvc __LC_EXIT_TIMER(8),__LC_ASYNC_ENTER_TIMER 996 mvc __LC_EXIT_TIMER(8),__LC_ASYNC_ENTER_TIMER
1031 clc 4(4,%r12),BASED(cleanup_sysc_leave_insn+4) 997 clc 4(4,%r12),BASED(cleanup_sysc_leave_insn+4)
1032 be BASED(2f) 998 be BASED(2f)
1033#endif
1034 mvc __LC_RETURN_PSW(8),SP_PSW(%r15) 999 mvc __LC_RETURN_PSW(8),SP_PSW(%r15)
1035 c %r12,BASED(.Lmck_old_psw) 1000 c %r12,BASED(.Lmck_old_psw)
1036 bne BASED(0f) 1001 bne BASED(0f)
@@ -1043,9 +1008,7 @@ cleanup_sysc_leave:
1043 br %r14 1008 br %r14
1044cleanup_sysc_leave_insn: 1009cleanup_sysc_leave_insn:
1045 .long sysc_done - 4 + 0x80000000 1010 .long sysc_done - 4 + 0x80000000
1046#ifdef CONFIG_VIRT_CPU_ACCOUNTING
1047 .long sysc_done - 8 + 0x80000000 1011 .long sysc_done - 8 + 0x80000000
1048#endif
1049 1012
1050cleanup_io_return: 1013cleanup_io_return:
1051 mvc __LC_RETURN_PSW(4),0(%r12) 1014 mvc __LC_RETURN_PSW(4),0(%r12)
@@ -1056,11 +1019,9 @@ cleanup_io_return:
1056cleanup_io_leave: 1019cleanup_io_leave:
1057 clc 4(4,%r12),BASED(cleanup_io_leave_insn) 1020 clc 4(4,%r12),BASED(cleanup_io_leave_insn)
1058 be BASED(2f) 1021 be BASED(2f)
1059#ifdef CONFIG_VIRT_CPU_ACCOUNTING
1060 mvc __LC_EXIT_TIMER(8),__LC_ASYNC_ENTER_TIMER 1022 mvc __LC_EXIT_TIMER(8),__LC_ASYNC_ENTER_TIMER
1061 clc 4(4,%r12),BASED(cleanup_io_leave_insn+4) 1023 clc 4(4,%r12),BASED(cleanup_io_leave_insn+4)
1062 be BASED(2f) 1024 be BASED(2f)
1063#endif
1064 mvc __LC_RETURN_PSW(8),SP_PSW(%r15) 1025 mvc __LC_RETURN_PSW(8),SP_PSW(%r15)
1065 c %r12,BASED(.Lmck_old_psw) 1026 c %r12,BASED(.Lmck_old_psw)
1066 bne BASED(0f) 1027 bne BASED(0f)
@@ -1073,9 +1034,7 @@ cleanup_io_leave:
1073 br %r14 1034 br %r14
1074cleanup_io_leave_insn: 1035cleanup_io_leave_insn:
1075 .long io_done - 4 + 0x80000000 1036 .long io_done - 4 + 0x80000000
1076#ifdef CONFIG_VIRT_CPU_ACCOUNTING
1077 .long io_done - 8 + 0x80000000 1037 .long io_done - 8 + 0x80000000
1078#endif
1079 1038
1080/* 1039/*
1081 * Integer constants 1040 * Integer constants
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 89c121ae6339..c6fbde13971a 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -96,20 +96,12 @@ _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \
96#define LOCKDEP_SYS_EXIT 96#define LOCKDEP_SYS_EXIT
97#endif 97#endif
98 98
99 .macro STORE_TIMER lc_offset
100#ifdef CONFIG_VIRT_CPU_ACCOUNTING
101 stpt \lc_offset
102#endif
103 .endm
104
105#ifdef CONFIG_VIRT_CPU_ACCOUNTING
106 .macro UPDATE_VTIME lc_from,lc_to,lc_sum 99 .macro UPDATE_VTIME lc_from,lc_to,lc_sum
107 lg %r10,\lc_from 100 lg %r10,\lc_from
108 slg %r10,\lc_to 101 slg %r10,\lc_to
109 alg %r10,\lc_sum 102 alg %r10,\lc_sum
110 stg %r10,\lc_sum 103 stg %r10,\lc_sum
111 .endm 104 .endm
112#endif
113 105
114/* 106/*
115 * Register usage in interrupt handlers: 107 * Register usage in interrupt handlers:
@@ -185,8 +177,11 @@ _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \
185 .if !\sync 177 .if !\sync
186 ni \psworg+1,0xfd # clear wait state bit 178 ni \psworg+1,0xfd # clear wait state bit
187 .endif 179 .endif
188 lmg %r0,%r15,SP_R0(%r15) # load gprs 0-15 of user 180 lg %r14,__LC_VDSO_PER_CPU
189 STORE_TIMER __LC_EXIT_TIMER 181 lmg %r0,%r13,SP_R0(%r15) # load gprs 0-13 of user
182 stpt __LC_EXIT_TIMER
183 mvc __VDSO_ECTG_BASE(16,%r14),__LC_EXIT_TIMER
184 lmg %r14,%r15,SP_R14(%r15) # load grps 14-15 of user
190 lpswe \psworg # back to caller 185 lpswe \psworg # back to caller
191 .endm 186 .endm
192 187
@@ -233,20 +228,18 @@ __critical_start:
233 228
234 .globl system_call 229 .globl system_call
235system_call: 230system_call:
236 STORE_TIMER __LC_SYNC_ENTER_TIMER 231 stpt __LC_SYNC_ENTER_TIMER
237sysc_saveall: 232sysc_saveall:
238 SAVE_ALL_BASE __LC_SAVE_AREA 233 SAVE_ALL_BASE __LC_SAVE_AREA
239 SAVE_ALL_SVC __LC_SVC_OLD_PSW,__LC_SAVE_AREA 234 SAVE_ALL_SVC __LC_SVC_OLD_PSW,__LC_SAVE_AREA
240 CREATE_STACK_FRAME __LC_SVC_OLD_PSW,__LC_SAVE_AREA 235 CREATE_STACK_FRAME __LC_SVC_OLD_PSW,__LC_SAVE_AREA
241 llgh %r7,__LC_SVC_INT_CODE # get svc number from lowcore 236 llgh %r7,__LC_SVC_INT_CODE # get svc number from lowcore
242#ifdef CONFIG_VIRT_CPU_ACCOUNTING
243sysc_vtime: 237sysc_vtime:
244 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 238 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER
245sysc_stime: 239sysc_stime:
246 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 240 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
247sysc_update: 241sysc_update:
248 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 242 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
249#endif
250sysc_do_svc: 243sysc_do_svc:
251 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct 244 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct
252 ltgr %r7,%r7 # test for svc 0 245 ltgr %r7,%r7 # test for svc 0
@@ -417,7 +410,7 @@ ret_from_fork:
4170: brasl %r14,schedule_tail 4100: brasl %r14,schedule_tail
418 TRACE_IRQS_ON 411 TRACE_IRQS_ON
419 stosm 24(%r15),0x03 # reenable interrupts 412 stosm 24(%r15),0x03 # reenable interrupts
420 j sysc_return 413 j sysc_tracenogo
421 414
422# 415#
423# kernel_execve function needs to deal with pt_regs that is not 416# kernel_execve function needs to deal with pt_regs that is not
@@ -469,20 +462,18 @@ pgm_check_handler:
469 * we just ignore the PER event (FIXME: is there anything we have to do 462 * we just ignore the PER event (FIXME: is there anything we have to do
470 * for LPSW?). 463 * for LPSW?).
471 */ 464 */
472 STORE_TIMER __LC_SYNC_ENTER_TIMER 465 stpt __LC_SYNC_ENTER_TIMER
473 SAVE_ALL_BASE __LC_SAVE_AREA 466 SAVE_ALL_BASE __LC_SAVE_AREA
474 tm __LC_PGM_INT_CODE+1,0x80 # check whether we got a per exception 467 tm __LC_PGM_INT_CODE+1,0x80 # check whether we got a per exception
475 jnz pgm_per # got per exception -> special case 468 jnz pgm_per # got per exception -> special case
476 SAVE_ALL_SYNC __LC_PGM_OLD_PSW,__LC_SAVE_AREA 469 SAVE_ALL_SYNC __LC_PGM_OLD_PSW,__LC_SAVE_AREA
477 CREATE_STACK_FRAME __LC_PGM_OLD_PSW,__LC_SAVE_AREA 470 CREATE_STACK_FRAME __LC_PGM_OLD_PSW,__LC_SAVE_AREA
478#ifdef CONFIG_VIRT_CPU_ACCOUNTING
479 tm SP_PSW+1(%r15),0x01 # interrupting from user ? 471 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
480 jz pgm_no_vtime 472 jz pgm_no_vtime
481 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 473 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER
482 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 474 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
483 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 475 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
484pgm_no_vtime: 476pgm_no_vtime:
485#endif
486 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct 477 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct
487 mvc SP_ARGS(8,%r15),__LC_LAST_BREAK 478 mvc SP_ARGS(8,%r15),__LC_LAST_BREAK
488 TRACE_IRQS_OFF 479 TRACE_IRQS_OFF
@@ -516,14 +507,12 @@ pgm_per:
516pgm_per_std: 507pgm_per_std:
517 SAVE_ALL_SYNC __LC_PGM_OLD_PSW,__LC_SAVE_AREA 508 SAVE_ALL_SYNC __LC_PGM_OLD_PSW,__LC_SAVE_AREA
518 CREATE_STACK_FRAME __LC_PGM_OLD_PSW,__LC_SAVE_AREA 509 CREATE_STACK_FRAME __LC_PGM_OLD_PSW,__LC_SAVE_AREA
519#ifdef CONFIG_VIRT_CPU_ACCOUNTING
520 tm SP_PSW+1(%r15),0x01 # interrupting from user ? 510 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
521 jz pgm_no_vtime2 511 jz pgm_no_vtime2
522 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 512 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER
523 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 513 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
524 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 514 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
525pgm_no_vtime2: 515pgm_no_vtime2:
526#endif
527 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct 516 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct
528 TRACE_IRQS_OFF 517 TRACE_IRQS_OFF
529 lg %r1,__TI_task(%r9) 518 lg %r1,__TI_task(%r9)
@@ -545,11 +534,9 @@ pgm_no_vtime2:
545pgm_svcper: 534pgm_svcper:
546 SAVE_ALL_SYNC __LC_SVC_OLD_PSW,__LC_SAVE_AREA 535 SAVE_ALL_SYNC __LC_SVC_OLD_PSW,__LC_SAVE_AREA
547 CREATE_STACK_FRAME __LC_SVC_OLD_PSW,__LC_SAVE_AREA 536 CREATE_STACK_FRAME __LC_SVC_OLD_PSW,__LC_SAVE_AREA
548#ifdef CONFIG_VIRT_CPU_ACCOUNTING
549 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 537 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER
550 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 538 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
551 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 539 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
552#endif
553 llgh %r7,__LC_SVC_INT_CODE # get svc number from lowcore 540 llgh %r7,__LC_SVC_INT_CODE # get svc number from lowcore
554 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct 541 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct
555 lg %r1,__TI_task(%r9) 542 lg %r1,__TI_task(%r9)
@@ -575,19 +562,17 @@ kernel_per:
575 */ 562 */
576 .globl io_int_handler 563 .globl io_int_handler
577io_int_handler: 564io_int_handler:
578 STORE_TIMER __LC_ASYNC_ENTER_TIMER
579 stck __LC_INT_CLOCK 565 stck __LC_INT_CLOCK
566 stpt __LC_ASYNC_ENTER_TIMER
580 SAVE_ALL_BASE __LC_SAVE_AREA+32 567 SAVE_ALL_BASE __LC_SAVE_AREA+32
581 SAVE_ALL_ASYNC __LC_IO_OLD_PSW,__LC_SAVE_AREA+32 568 SAVE_ALL_ASYNC __LC_IO_OLD_PSW,__LC_SAVE_AREA+32
582 CREATE_STACK_FRAME __LC_IO_OLD_PSW,__LC_SAVE_AREA+32 569 CREATE_STACK_FRAME __LC_IO_OLD_PSW,__LC_SAVE_AREA+32
583#ifdef CONFIG_VIRT_CPU_ACCOUNTING
584 tm SP_PSW+1(%r15),0x01 # interrupting from user ? 570 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
585 jz io_no_vtime 571 jz io_no_vtime
586 UPDATE_VTIME __LC_EXIT_TIMER,__LC_ASYNC_ENTER_TIMER,__LC_USER_TIMER 572 UPDATE_VTIME __LC_EXIT_TIMER,__LC_ASYNC_ENTER_TIMER,__LC_USER_TIMER
587 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 573 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
588 mvc __LC_LAST_UPDATE_TIMER(8),__LC_ASYNC_ENTER_TIMER 574 mvc __LC_LAST_UPDATE_TIMER(8),__LC_ASYNC_ENTER_TIMER
589io_no_vtime: 575io_no_vtime:
590#endif
591 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct 576 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct
592 TRACE_IRQS_OFF 577 TRACE_IRQS_OFF
593 la %r2,SP_PTREGS(%r15) # address of register-save area 578 la %r2,SP_PTREGS(%r15) # address of register-save area
@@ -739,19 +724,17 @@ io_notify_resume:
739 */ 724 */
740 .globl ext_int_handler 725 .globl ext_int_handler
741ext_int_handler: 726ext_int_handler:
742 STORE_TIMER __LC_ASYNC_ENTER_TIMER
743 stck __LC_INT_CLOCK 727 stck __LC_INT_CLOCK
728 stpt __LC_ASYNC_ENTER_TIMER
744 SAVE_ALL_BASE __LC_SAVE_AREA+32 729 SAVE_ALL_BASE __LC_SAVE_AREA+32
745 SAVE_ALL_ASYNC __LC_EXT_OLD_PSW,__LC_SAVE_AREA+32 730 SAVE_ALL_ASYNC __LC_EXT_OLD_PSW,__LC_SAVE_AREA+32
746 CREATE_STACK_FRAME __LC_EXT_OLD_PSW,__LC_SAVE_AREA+32 731 CREATE_STACK_FRAME __LC_EXT_OLD_PSW,__LC_SAVE_AREA+32
747#ifdef CONFIG_VIRT_CPU_ACCOUNTING
748 tm SP_PSW+1(%r15),0x01 # interrupting from user ? 732 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
749 jz ext_no_vtime 733 jz ext_no_vtime
750 UPDATE_VTIME __LC_EXIT_TIMER,__LC_ASYNC_ENTER_TIMER,__LC_USER_TIMER 734 UPDATE_VTIME __LC_EXIT_TIMER,__LC_ASYNC_ENTER_TIMER,__LC_USER_TIMER
751 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 735 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
752 mvc __LC_LAST_UPDATE_TIMER(8),__LC_ASYNC_ENTER_TIMER 736 mvc __LC_LAST_UPDATE_TIMER(8),__LC_ASYNC_ENTER_TIMER
753ext_no_vtime: 737ext_no_vtime:
754#endif
755 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct 738 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct
756 TRACE_IRQS_OFF 739 TRACE_IRQS_OFF
757 la %r2,SP_PTREGS(%r15) # address of register-save area 740 la %r2,SP_PTREGS(%r15) # address of register-save area
@@ -766,6 +749,7 @@ __critical_end:
766 */ 749 */
767 .globl mcck_int_handler 750 .globl mcck_int_handler
768mcck_int_handler: 751mcck_int_handler:
752 stck __LC_INT_CLOCK
769 la %r1,4095 # revalidate r1 753 la %r1,4095 # revalidate r1
770 spt __LC_CPU_TIMER_SAVE_AREA-4095(%r1) # revalidate cpu timer 754 spt __LC_CPU_TIMER_SAVE_AREA-4095(%r1) # revalidate cpu timer
771 lmg %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1)# revalidate gprs 755 lmg %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1)# revalidate gprs
@@ -773,7 +757,6 @@ mcck_int_handler:
773 la %r12,__LC_MCK_OLD_PSW 757 la %r12,__LC_MCK_OLD_PSW
774 tm __LC_MCCK_CODE,0x80 # system damage? 758 tm __LC_MCCK_CODE,0x80 # system damage?
775 jo mcck_int_main # yes -> rest of mcck code invalid 759 jo mcck_int_main # yes -> rest of mcck code invalid
776#ifdef CONFIG_VIRT_CPU_ACCOUNTING
777 la %r14,4095 760 la %r14,4095
778 mvc __LC_SAVE_AREA+104(8),__LC_ASYNC_ENTER_TIMER 761 mvc __LC_SAVE_AREA+104(8),__LC_ASYNC_ENTER_TIMER
779 mvc __LC_ASYNC_ENTER_TIMER(8),__LC_CPU_TIMER_SAVE_AREA-4095(%r14) 762 mvc __LC_ASYNC_ENTER_TIMER(8),__LC_CPU_TIMER_SAVE_AREA-4095(%r14)
@@ -791,9 +774,7 @@ mcck_int_handler:
791 la %r14,__LC_LAST_UPDATE_TIMER 774 la %r14,__LC_LAST_UPDATE_TIMER
7920: spt 0(%r14) 7750: spt 0(%r14)
793 mvc __LC_ASYNC_ENTER_TIMER(8),0(%r14) 776 mvc __LC_ASYNC_ENTER_TIMER(8),0(%r14)
7941: 7771: tm __LC_MCCK_CODE+2,0x09 # mwp + ia of old psw valid?
795#endif
796 tm __LC_MCCK_CODE+2,0x09 # mwp + ia of old psw valid?
797 jno mcck_int_main # no -> skip cleanup critical 778 jno mcck_int_main # no -> skip cleanup critical
798 tm __LC_MCK_OLD_PSW+1,0x01 # test problem state bit 779 tm __LC_MCK_OLD_PSW+1,0x01 # test problem state bit
799 jnz mcck_int_main # from user -> load kernel stack 780 jnz mcck_int_main # from user -> load kernel stack
@@ -809,7 +790,6 @@ mcck_int_main:
809 jz 0f 790 jz 0f
810 lg %r15,__LC_PANIC_STACK # load panic stack 791 lg %r15,__LC_PANIC_STACK # load panic stack
8110: CREATE_STACK_FRAME __LC_MCK_OLD_PSW,__LC_SAVE_AREA+64 7920: CREATE_STACK_FRAME __LC_MCK_OLD_PSW,__LC_SAVE_AREA+64
812#ifdef CONFIG_VIRT_CPU_ACCOUNTING
813 tm __LC_MCCK_CODE+2,0x08 # mwp of old psw valid? 793 tm __LC_MCCK_CODE+2,0x08 # mwp of old psw valid?
814 jno mcck_no_vtime # no -> no timer update 794 jno mcck_no_vtime # no -> no timer update
815 tm SP_PSW+1(%r15),0x01 # interrupting from user ? 795 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
@@ -818,7 +798,6 @@ mcck_int_main:
818 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 798 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
819 mvc __LC_LAST_UPDATE_TIMER(8),__LC_ASYNC_ENTER_TIMER 799 mvc __LC_LAST_UPDATE_TIMER(8),__LC_ASYNC_ENTER_TIMER
820mcck_no_vtime: 800mcck_no_vtime:
821#endif
822 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct 801 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct
823 la %r2,SP_PTREGS(%r15) # load pt_regs 802 la %r2,SP_PTREGS(%r15) # load pt_regs
824 brasl %r14,s390_do_machine_check 803 brasl %r14,s390_do_machine_check
@@ -839,14 +818,11 @@ mcck_return:
839 mvc __LC_RETURN_MCCK_PSW(16),SP_PSW(%r15) # move return PSW 818 mvc __LC_RETURN_MCCK_PSW(16),SP_PSW(%r15) # move return PSW
840 ni __LC_RETURN_MCCK_PSW+1,0xfd # clear wait state bit 819 ni __LC_RETURN_MCCK_PSW+1,0xfd # clear wait state bit
841 lmg %r0,%r15,SP_R0(%r15) # load gprs 0-15 820 lmg %r0,%r15,SP_R0(%r15) # load gprs 0-15
842#ifdef CONFIG_VIRT_CPU_ACCOUNTING
843 mvc __LC_ASYNC_ENTER_TIMER(8),__LC_SAVE_AREA+104 821 mvc __LC_ASYNC_ENTER_TIMER(8),__LC_SAVE_AREA+104
844 tm __LC_RETURN_MCCK_PSW+1,0x01 # returning to user ? 822 tm __LC_RETURN_MCCK_PSW+1,0x01 # returning to user ?
845 jno 0f 823 jno 0f
846 stpt __LC_EXIT_TIMER 824 stpt __LC_EXIT_TIMER
8470: 8250: lpswe __LC_RETURN_MCCK_PSW # back to caller
848#endif
849 lpswe __LC_RETURN_MCCK_PSW # back to caller
850 826
851/* 827/*
852 * Restart interruption handler, kick starter for additional CPUs 828 * Restart interruption handler, kick starter for additional CPUs
@@ -964,13 +940,11 @@ cleanup_system_call:
964 j 1f 940 j 1f
9650: la %r12,__LC_SAVE_AREA+64 9410: la %r12,__LC_SAVE_AREA+64
9661: 9421:
967#ifdef CONFIG_VIRT_CPU_ACCOUNTING
968 clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn+8) 943 clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn+8)
969 jh 0f 944 jh 0f
970 mvc __LC_SYNC_ENTER_TIMER(8),__LC_ASYNC_ENTER_TIMER 945 mvc __LC_SYNC_ENTER_TIMER(8),__LC_ASYNC_ENTER_TIMER
9710: clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn+16) 9460: clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn+16)
972 jhe cleanup_vtime 947 jhe cleanup_vtime
973#endif
974 clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn) 948 clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn)
975 jh 0f 949 jh 0f
976 mvc __LC_SAVE_AREA(32),0(%r12) 950 mvc __LC_SAVE_AREA(32),0(%r12)
@@ -981,7 +955,6 @@ cleanup_system_call:
981 lg %r12,__LC_SAVE_AREA+96 # argh 955 lg %r12,__LC_SAVE_AREA+96 # argh
982 stg %r15,24(%r12) 956 stg %r15,24(%r12)
983 llgh %r7,__LC_SVC_INT_CODE 957 llgh %r7,__LC_SVC_INT_CODE
984#ifdef CONFIG_VIRT_CPU_ACCOUNTING
985cleanup_vtime: 958cleanup_vtime:
986 clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn+24) 959 clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn+24)
987 jhe cleanup_stime 960 jhe cleanup_stime
@@ -992,18 +965,15 @@ cleanup_stime:
992 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 965 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
993cleanup_update: 966cleanup_update:
994 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 967 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
995#endif
996 mvc __LC_RETURN_PSW+8(8),BASED(cleanup_table_system_call+8) 968 mvc __LC_RETURN_PSW+8(8),BASED(cleanup_table_system_call+8)
997 la %r12,__LC_RETURN_PSW 969 la %r12,__LC_RETURN_PSW
998 br %r14 970 br %r14
999cleanup_system_call_insn: 971cleanup_system_call_insn:
1000 .quad sysc_saveall 972 .quad sysc_saveall
1001#ifdef CONFIG_VIRT_CPU_ACCOUNTING
1002 .quad system_call 973 .quad system_call
1003 .quad sysc_vtime 974 .quad sysc_vtime
1004 .quad sysc_stime 975 .quad sysc_stime
1005 .quad sysc_update 976 .quad sysc_update
1006#endif
1007 977
1008cleanup_sysc_return: 978cleanup_sysc_return:
1009 mvc __LC_RETURN_PSW(8),0(%r12) 979 mvc __LC_RETURN_PSW(8),0(%r12)
@@ -1013,27 +983,23 @@ cleanup_sysc_return:
1013 983
1014cleanup_sysc_leave: 984cleanup_sysc_leave:
1015 clc 8(8,%r12),BASED(cleanup_sysc_leave_insn) 985 clc 8(8,%r12),BASED(cleanup_sysc_leave_insn)
1016 je 2f 986 je 3f
1017#ifdef CONFIG_VIRT_CPU_ACCOUNTING
1018 mvc __LC_EXIT_TIMER(8),__LC_ASYNC_ENTER_TIMER
1019 clc 8(8,%r12),BASED(cleanup_sysc_leave_insn+8) 987 clc 8(8,%r12),BASED(cleanup_sysc_leave_insn+8)
1020 je 2f 988 jhe 0f
1021#endif 989 mvc __LC_EXIT_TIMER(8),__LC_ASYNC_ENTER_TIMER
1022 mvc __LC_RETURN_PSW(16),SP_PSW(%r15) 9900: mvc __LC_RETURN_PSW(16),SP_PSW(%r15)
1023 cghi %r12,__LC_MCK_OLD_PSW 991 cghi %r12,__LC_MCK_OLD_PSW
1024 jne 0f 992 jne 1f
1025 mvc __LC_SAVE_AREA+64(32),SP_R12(%r15) 993 mvc __LC_SAVE_AREA+64(32),SP_R12(%r15)
1026 j 1f 994 j 2f
10270: mvc __LC_SAVE_AREA+32(32),SP_R12(%r15) 9951: mvc __LC_SAVE_AREA+32(32),SP_R12(%r15)
10281: lmg %r0,%r11,SP_R0(%r15) 9962: lmg %r0,%r11,SP_R0(%r15)
1029 lg %r15,SP_R15(%r15) 997 lg %r15,SP_R15(%r15)
10302: la %r12,__LC_RETURN_PSW 9983: la %r12,__LC_RETURN_PSW
1031 br %r14 999 br %r14
1032cleanup_sysc_leave_insn: 1000cleanup_sysc_leave_insn:
1033 .quad sysc_done - 4 1001 .quad sysc_done - 4
1034#ifdef CONFIG_VIRT_CPU_ACCOUNTING 1002 .quad sysc_done - 16
1035 .quad sysc_done - 8
1036#endif
1037 1003
1038cleanup_io_return: 1004cleanup_io_return:
1039 mvc __LC_RETURN_PSW(8),0(%r12) 1005 mvc __LC_RETURN_PSW(8),0(%r12)
@@ -1043,27 +1009,23 @@ cleanup_io_return:
1043 1009
1044cleanup_io_leave: 1010cleanup_io_leave:
1045 clc 8(8,%r12),BASED(cleanup_io_leave_insn) 1011 clc 8(8,%r12),BASED(cleanup_io_leave_insn)
1046 je 2f 1012 je 3f
1047#ifdef CONFIG_VIRT_CPU_ACCOUNTING
1048 mvc __LC_EXIT_TIMER(8),__LC_ASYNC_ENTER_TIMER
1049 clc 8(8,%r12),BASED(cleanup_io_leave_insn+8) 1013 clc 8(8,%r12),BASED(cleanup_io_leave_insn+8)
1050 je 2f 1014 jhe 0f
1051#endif 1015 mvc __LC_EXIT_TIMER(8),__LC_ASYNC_ENTER_TIMER
1052 mvc __LC_RETURN_PSW(16),SP_PSW(%r15) 10160: mvc __LC_RETURN_PSW(16),SP_PSW(%r15)
1053 cghi %r12,__LC_MCK_OLD_PSW 1017 cghi %r12,__LC_MCK_OLD_PSW
1054 jne 0f 1018 jne 1f
1055 mvc __LC_SAVE_AREA+64(32),SP_R12(%r15) 1019 mvc __LC_SAVE_AREA+64(32),SP_R12(%r15)
1056 j 1f 1020 j 2f
10570: mvc __LC_SAVE_AREA+32(32),SP_R12(%r15) 10211: mvc __LC_SAVE_AREA+32(32),SP_R12(%r15)
10581: lmg %r0,%r11,SP_R0(%r15) 10222: lmg %r0,%r11,SP_R0(%r15)
1059 lg %r15,SP_R15(%r15) 1023 lg %r15,SP_R15(%r15)
10602: la %r12,__LC_RETURN_PSW 10243: la %r12,__LC_RETURN_PSW
1061 br %r14 1025 br %r14
1062cleanup_io_leave_insn: 1026cleanup_io_leave_insn:
1063 .quad io_done - 4 1027 .quad io_done - 4
1064#ifdef CONFIG_VIRT_CPU_ACCOUNTING 1028 .quad io_done - 16
1065 .quad io_done - 8
1066#endif
1067 1029
1068/* 1030/*
1069 * Integer constants 1031 * Integer constants
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S
index 83477c7dc743..ec7e35f6055b 100644
--- a/arch/s390/kernel/head.S
+++ b/arch/s390/kernel/head.S
@@ -461,6 +461,55 @@ start:
461 .byte 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7 461 .byte 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7
462 .byte 0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff 462 .byte 0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff
463 463
464#
465# startup-code at 0x10000, running in absolute addressing mode
466# this is called either by the ipl loader or directly by PSW restart
467# or linload or SALIPL
468#
469 .org 0x10000
470startup:basr %r13,0 # get base
471.LPG0:
472
473#ifndef CONFIG_MARCH_G5
474 # check processor version against MARCH_{G5,Z900,Z990,Z9_109,Z10}
475 stidp __LC_CPUID # store cpuid
476 lhi %r0,(3f-2f) / 2
477 la %r1,2f-.LPG0(%r13)
4780: clc __LC_CPUID+4(2),0(%r1)
479 jne 3f
480 lpsw 1f-.LPG0(13) # machine type not good enough, crash
481 .align 16
4821: .long 0x000a0000,0x00000000
4832:
484#if defined(CONFIG_MARCH_Z10)
485 .short 0x9672, 0x2064, 0x2066, 0x2084, 0x2086, 0x2094, 0x2096
486#elif defined(CONFIG_MARCH_Z9_109)
487 .short 0x9672, 0x2064, 0x2066, 0x2084, 0x2086
488#elif defined(CONFIG_MARCH_Z990)
489 .short 0x9672, 0x2064, 0x2066
490#elif defined(CONFIG_MARCH_Z900)
491 .short 0x9672
492#endif
4933: la %r1,2(%r1)
494 brct %r0,0b
495#endif
496
497 l %r13,0f-.LPG0(%r13)
498 b 0(%r13)
4990: .long startup_continue
500
501#
502# params at 10400 (setup.h)
503#
504 .org PARMAREA
505 .long 0,0 # IPL_DEVICE
506 .long 0,0 # INITRD_START
507 .long 0,0 # INITRD_SIZE
508
509 .org COMMAND_LINE
510 .byte "root=/dev/ram0 ro"
511 .byte 0
512
464#ifdef CONFIG_64BIT 513#ifdef CONFIG_64BIT
465#include "head64.S" 514#include "head64.S"
466#else 515#else
diff --git a/arch/s390/kernel/head31.S b/arch/s390/kernel/head31.S
index a816e2de32b9..db476d114caa 100644
--- a/arch/s390/kernel/head31.S
+++ b/arch/s390/kernel/head31.S
@@ -10,34 +10,13 @@
10 * 10 *
11 */ 11 */
12 12
13#
14# startup-code at 0x10000, running in absolute addressing mode
15# this is called either by the ipl loader or directly by PSW restart
16# or linload or SALIPL
17#
18 .org 0x10000
19startup:basr %r13,0 # get base
20.LPG0: l %r13,0f-.LPG0(%r13)
21 b 0(%r13)
220: .long startup_continue
23
24#
25# params at 10400 (setup.h)
26#
27 .org PARMAREA
28 .long 0,0 # IPL_DEVICE
29 .long 0,0 # INITRD_START
30 .long 0,0 # INITRD_SIZE
31
32 .org COMMAND_LINE
33 .byte "root=/dev/ram0 ro"
34 .byte 0
35
36 .org 0x11000 13 .org 0x11000
37 14
38startup_continue: 15startup_continue:
39 basr %r13,0 # get base 16 basr %r13,0 # get base
40.LPG1: mvi __LC_AR_MODE_ID,0 # set ESA flag (mode 0) 17.LPG1:
18
19 mvi __LC_AR_MODE_ID,0 # set ESA flag (mode 0)
41 lctl %c0,%c15,.Lctl-.LPG1(%r13) # load control registers 20 lctl %c0,%c15,.Lctl-.LPG1(%r13) # load control registers
42 l %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area 21 l %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area
43 # move IPL device to lowcore 22 # move IPL device to lowcore
@@ -50,7 +29,6 @@ startup_continue:
50 ahi %r15,1<<(PAGE_SHIFT+THREAD_ORDER) # init_task_union+THREAD_SIZE 29 ahi %r15,1<<(PAGE_SHIFT+THREAD_ORDER) # init_task_union+THREAD_SIZE
51 st %r15,__LC_KERNEL_STACK # set end of kernel stack 30 st %r15,__LC_KERNEL_STACK # set end of kernel stack
52 ahi %r15,-96 31 ahi %r15,-96
53 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) # clear backchain
54# 32#
55# Save ipl parameters, clear bss memory, initialize storage key for kernel pages, 33# Save ipl parameters, clear bss memory, initialize storage key for kernel pages,
56# and create a kernel NSS if the SAVESYS= parm is defined 34# and create a kernel NSS if the SAVESYS= parm is defined
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S
index 1d06961e87b3..f9f70aa15244 100644
--- a/arch/s390/kernel/head64.S
+++ b/arch/s390/kernel/head64.S
@@ -10,29 +10,6 @@
10 * 10 *
11 */ 11 */
12 12
13#
14# startup-code at 0x10000, running in absolute addressing mode
15# this is called either by the ipl loader or directly by PSW restart
16# or linload or SALIPL
17#
18 .org 0x10000
19startup:basr %r13,0 # get base
20.LPG0: l %r13,0f-.LPG0(%r13)
21 b 0(%r13)
220: .long startup_continue
23
24#
25# params at 10400 (setup.h)
26#
27 .org PARMAREA
28 .quad 0 # IPL_DEVICE
29 .quad 0 # INITRD_START
30 .quad 0 # INITRD_SIZE
31
32 .org COMMAND_LINE
33 .byte "root=/dev/ram0 ro"
34 .byte 0
35
36 .org 0x11000 13 .org 0x11000
37 14
38startup_continue: 15startup_continue:
@@ -110,6 +87,8 @@ startup_continue:
110 lg %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area 87 lg %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area
111 # move IPL device to lowcore 88 # move IPL device to lowcore
112 mvc __LC_IPLDEV(4),IPL_DEVICE+4-PARMAREA(%r12) 89 mvc __LC_IPLDEV(4),IPL_DEVICE+4-PARMAREA(%r12)
90 lghi %r0,__LC_PASTE
91 stg %r0,__LC_VDSO_PER_CPU
113# 92#
114# Setup stack 93# Setup stack
115# 94#
@@ -119,7 +98,6 @@ startup_continue:
119 aghi %r15,1<<(PAGE_SHIFT+THREAD_ORDER) # init_task_union + THREAD_SIZE 98 aghi %r15,1<<(PAGE_SHIFT+THREAD_ORDER) # init_task_union + THREAD_SIZE
120 stg %r15,__LC_KERNEL_STACK # set end of kernel stack 99 stg %r15,__LC_KERNEL_STACK # set end of kernel stack
121 aghi %r15,-160 100 aghi %r15,-160
122 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) # clear backchain
123# 101#
124# Save ipl parameters, clear bss memory, initialize storage key for kernel pages, 102# Save ipl parameters, clear bss memory, initialize storage key for kernel pages,
125# and create a kernel NSS if the SAVESYS= parm is defined 103# and create a kernel NSS if the SAVESYS= parm is defined
diff --git a/arch/s390/kernel/init_task.c b/arch/s390/kernel/init_task.c
index e80716843619..7db95c0b8693 100644
--- a/arch/s390/kernel/init_task.c
+++ b/arch/s390/kernel/init_task.c
@@ -16,7 +16,6 @@
16#include <asm/uaccess.h> 16#include <asm/uaccess.h>
17#include <asm/pgtable.h> 17#include <asm/pgtable.h>
18 18
19static struct fs_struct init_fs = INIT_FS;
20static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 19static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
21static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 20static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
22struct mm_struct init_mm = INIT_MM(init_mm); 21struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 569079ec4ff0..9b92856632cf 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -218,9 +218,10 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
218 218
219void __kprobes arch_remove_kprobe(struct kprobe *p) 219void __kprobes arch_remove_kprobe(struct kprobe *p)
220{ 220{
221 mutex_lock(&kprobe_mutex); 221 if (p->ainsn.insn) {
222 free_insn_slot(p->ainsn.insn, 0); 222 free_insn_slot(p->ainsn.insn, 0);
223 mutex_unlock(&kprobe_mutex); 223 p->ainsn.insn = NULL;
224 }
224} 225}
225 226
226static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs) 227static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
diff --git a/arch/s390/kernel/mcount.S b/arch/s390/kernel/mcount.S
new file mode 100644
index 000000000000..397d131a345f
--- /dev/null
+++ b/arch/s390/kernel/mcount.S
@@ -0,0 +1,56 @@
1/*
2 * Copyright IBM Corp. 2008
3 *
4 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>,
5 *
6 */
7
8#ifndef CONFIG_64BIT
9.globl _mcount
10_mcount:
11 stm %r0,%r5,8(%r15)
12 st %r14,56(%r15)
13 lr %r1,%r15
14 ahi %r15,-96
15 l %r3,100(%r15)
16 la %r2,0(%r14)
17 st %r1,0(%r15)
18 la %r3,0(%r3)
19 bras %r14,0f
20 .long ftrace_trace_function
210: l %r14,0(%r14)
22 l %r14,0(%r14)
23 basr %r14,%r14
24 ahi %r15,96
25 lm %r0,%r5,8(%r15)
26 l %r14,56(%r15)
27 br %r14
28
29.globl ftrace_stub
30ftrace_stub:
31 br %r14
32
33#else /* CONFIG_64BIT */
34
35.globl _mcount
36_mcount:
37 stmg %r0,%r5,16(%r15)
38 stg %r14,112(%r15)
39 lgr %r1,%r15
40 aghi %r15,-160
41 stg %r1,0(%r15)
42 lgr %r2,%r14
43 lg %r3,168(%r15)
44 larl %r14,ftrace_trace_function
45 lg %r14,0(%r14)
46 basr %r14,%r14
47 aghi %r15,160
48 lmg %r0,%r5,16(%r15)
49 lg %r14,112(%r15)
50 br %r14
51
52.globl ftrace_stub
53ftrace_stub:
54 br %r14
55
56#endif /* CONFIG_64BIT */
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 04f8c67a6101..b6110bdf8dc2 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -38,6 +38,7 @@
38#include <linux/utsname.h> 38#include <linux/utsname.h>
39#include <linux/tick.h> 39#include <linux/tick.h>
40#include <linux/elfcore.h> 40#include <linux/elfcore.h>
41#include <linux/kernel_stat.h>
41#include <asm/uaccess.h> 42#include <asm/uaccess.h>
42#include <asm/pgtable.h> 43#include <asm/pgtable.h>
43#include <asm/system.h> 44#include <asm/system.h>
@@ -45,7 +46,6 @@
45#include <asm/processor.h> 46#include <asm/processor.h>
46#include <asm/irq.h> 47#include <asm/irq.h>
47#include <asm/timer.h> 48#include <asm/timer.h>
48#include <asm/cpu.h>
49#include "entry.h" 49#include "entry.h"
50 50
51asmlinkage void ret_from_fork(void) asm ("ret_from_fork"); 51asmlinkage void ret_from_fork(void) asm ("ret_from_fork");
@@ -75,36 +75,6 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
75 return sf->gprs[8]; 75 return sf->gprs[8];
76} 76}
77 77
78DEFINE_PER_CPU(struct s390_idle_data, s390_idle) = {
79 .lock = __SPIN_LOCK_UNLOCKED(s390_idle.lock)
80};
81
82static int s390_idle_enter(void)
83{
84 struct s390_idle_data *idle;
85
86 idle = &__get_cpu_var(s390_idle);
87 spin_lock(&idle->lock);
88 idle->idle_count++;
89 idle->in_idle = 1;
90 idle->idle_enter = get_clock();
91 spin_unlock(&idle->lock);
92 vtime_stop_cpu_timer();
93 return NOTIFY_OK;
94}
95
96void s390_idle_leave(void)
97{
98 struct s390_idle_data *idle;
99
100 vtime_start_cpu_timer();
101 idle = &__get_cpu_var(s390_idle);
102 spin_lock(&idle->lock);
103 idle->idle_time += get_clock() - idle->idle_enter;
104 idle->in_idle = 0;
105 spin_unlock(&idle->lock);
106}
107
108extern void s390_handle_mcck(void); 78extern void s390_handle_mcck(void);
109/* 79/*
110 * The idle loop on a S390... 80 * The idle loop on a S390...
@@ -117,10 +87,6 @@ static void default_idle(void)
117 local_irq_enable(); 87 local_irq_enable();
118 return; 88 return;
119 } 89 }
120 if (s390_idle_enter() == NOTIFY_BAD) {
121 local_irq_enable();
122 return;
123 }
124#ifdef CONFIG_HOTPLUG_CPU 90#ifdef CONFIG_HOTPLUG_CPU
125 if (cpu_is_offline(smp_processor_id())) { 91 if (cpu_is_offline(smp_processor_id())) {
126 preempt_enable_no_resched(); 92 preempt_enable_no_resched();
@@ -130,7 +96,6 @@ static void default_idle(void)
130 local_mcck_disable(); 96 local_mcck_disable();
131 if (test_thread_flag(TIF_MCCK_PENDING)) { 97 if (test_thread_flag(TIF_MCCK_PENDING)) {
132 local_mcck_enable(); 98 local_mcck_enable();
133 s390_idle_leave();
134 local_irq_enable(); 99 local_irq_enable();
135 s390_handle_mcck(); 100 s390_handle_mcck();
136 return; 101 return;
@@ -138,9 +103,9 @@ static void default_idle(void)
138 trace_hardirqs_on(); 103 trace_hardirqs_on();
139 /* Don't trace preempt off for idle. */ 104 /* Don't trace preempt off for idle. */
140 stop_critical_timings(); 105 stop_critical_timings();
141 /* Wait for external, I/O or machine check interrupt. */ 106 /* Stop virtual timer and halt the cpu. */
142 __load_psw_mask(psw_kernel_bits | PSW_MASK_WAIT | 107 vtime_stop_cpu();
143 PSW_MASK_IO | PSW_MASK_EXT); 108 /* Reenable preemption tracer. */
144 start_critical_timings(); 109 start_critical_timings();
145} 110}
146 111
diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c
new file mode 100644
index 000000000000..82c1872cfe80
--- /dev/null
+++ b/arch/s390/kernel/processor.c
@@ -0,0 +1,98 @@
1/*
2 * arch/s390/kernel/processor.c
3 *
4 * Copyright IBM Corp. 2008
5 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
6 */
7
8#define KMSG_COMPONENT "cpu"
9#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/smp.h>
14#include <linux/seq_file.h>
15#include <linux/delay.h>
16
17#include <asm/elf.h>
18#include <asm/lowcore.h>
19#include <asm/param.h>
20
21void __cpuinit print_cpu_info(struct cpuinfo_S390 *cpuinfo)
22{
23 pr_info("Processor %d started, address %d, identification %06X\n",
24 cpuinfo->cpu_nr, cpuinfo->cpu_addr, cpuinfo->cpu_id.ident);
25}
26
27/*
28 * show_cpuinfo - Get information on one CPU for use by procfs.
29 */
30
31static int show_cpuinfo(struct seq_file *m, void *v)
32{
33 static const char *hwcap_str[8] = {
34 "esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp",
35 "edat"
36 };
37 struct cpuinfo_S390 *cpuinfo;
38 unsigned long n = (unsigned long) v - 1;
39 int i;
40
41 s390_adjust_jiffies();
42 preempt_disable();
43 if (!n) {
44 seq_printf(m, "vendor_id : IBM/S390\n"
45 "# processors : %i\n"
46 "bogomips per cpu: %lu.%02lu\n",
47 num_online_cpus(), loops_per_jiffy/(500000/HZ),
48 (loops_per_jiffy/(5000/HZ))%100);
49 seq_puts(m, "features\t: ");
50 for (i = 0; i < 8; i++)
51 if (hwcap_str[i] && (elf_hwcap & (1UL << i)))
52 seq_printf(m, "%s ", hwcap_str[i]);
53 seq_puts(m, "\n");
54 }
55
56 if (cpu_online(n)) {
57#ifdef CONFIG_SMP
58 if (smp_processor_id() == n)
59 cpuinfo = &S390_lowcore.cpu_data;
60 else
61 cpuinfo = &lowcore_ptr[n]->cpu_data;
62#else
63 cpuinfo = &S390_lowcore.cpu_data;
64#endif
65 seq_printf(m, "processor %li: "
66 "version = %02X, "
67 "identification = %06X, "
68 "machine = %04X\n",
69 n, cpuinfo->cpu_id.version,
70 cpuinfo->cpu_id.ident,
71 cpuinfo->cpu_id.machine);
72 }
73 preempt_enable();
74 return 0;
75}
76
77static void *c_start(struct seq_file *m, loff_t *pos)
78{
79 return *pos < NR_CPUS ? (void *)((unsigned long) *pos + 1) : NULL;
80}
81
82static void *c_next(struct seq_file *m, void *v, loff_t *pos)
83{
84 ++*pos;
85 return c_start(m, pos);
86}
87
88static void c_stop(struct seq_file *m, void *v)
89{
90}
91
92const struct seq_operations cpuinfo_op = {
93 .start = c_start,
94 .next = c_next,
95 .stop = c_stop,
96 .show = show_cpuinfo,
97};
98
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 38ff2bce1203..75c496f4f16d 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -204,7 +204,6 @@ static unsigned long __peek_user(struct task_struct *child, addr_t addr)
204static int 204static int
205peek_user(struct task_struct *child, addr_t addr, addr_t data) 205peek_user(struct task_struct *child, addr_t addr, addr_t data)
206{ 206{
207 struct user *dummy = NULL;
208 addr_t tmp, mask; 207 addr_t tmp, mask;
209 208
210 /* 209 /*
@@ -213,8 +212,8 @@ peek_user(struct task_struct *child, addr_t addr, addr_t data)
213 */ 212 */
214 mask = __ADDR_MASK; 213 mask = __ADDR_MASK;
215#ifdef CONFIG_64BIT 214#ifdef CONFIG_64BIT
216 if (addr >= (addr_t) &dummy->regs.acrs && 215 if (addr >= (addr_t) &((struct user *) NULL)->regs.acrs &&
217 addr < (addr_t) &dummy->regs.orig_gpr2) 216 addr < (addr_t) &((struct user *) NULL)->regs.orig_gpr2)
218 mask = 3; 217 mask = 3;
219#endif 218#endif
220 if ((addr & mask) || addr > sizeof(struct user) - __ADDR_MASK) 219 if ((addr & mask) || addr > sizeof(struct user) - __ADDR_MASK)
@@ -312,7 +311,6 @@ static int __poke_user(struct task_struct *child, addr_t addr, addr_t data)
312static int 311static int
313poke_user(struct task_struct *child, addr_t addr, addr_t data) 312poke_user(struct task_struct *child, addr_t addr, addr_t data)
314{ 313{
315 struct user *dummy = NULL;
316 addr_t mask; 314 addr_t mask;
317 315
318 /* 316 /*
@@ -321,8 +319,8 @@ poke_user(struct task_struct *child, addr_t addr, addr_t data)
321 */ 319 */
322 mask = __ADDR_MASK; 320 mask = __ADDR_MASK;
323#ifdef CONFIG_64BIT 321#ifdef CONFIG_64BIT
324 if (addr >= (addr_t) &dummy->regs.acrs && 322 if (addr >= (addr_t) &((struct user *) NULL)->regs.acrs &&
325 addr < (addr_t) &dummy->regs.orig_gpr2) 323 addr < (addr_t) &((struct user *) NULL)->regs.orig_gpr2)
326 mask = 3; 324 mask = 3;
327#endif 325#endif
328 if ((addr & mask) || addr > sizeof(struct user) - __ADDR_MASK) 326 if ((addr & mask) || addr > sizeof(struct user) - __ADDR_MASK)
diff --git a/arch/s390/kernel/s390_ext.c b/arch/s390/kernel/s390_ext.c
index e019b419efc6..a0d2d55d7fb3 100644
--- a/arch/s390/kernel/s390_ext.c
+++ b/arch/s390/kernel/s390_ext.c
@@ -119,8 +119,8 @@ void do_extint(struct pt_regs *regs, unsigned short code)
119 struct pt_regs *old_regs; 119 struct pt_regs *old_regs;
120 120
121 old_regs = set_irq_regs(regs); 121 old_regs = set_irq_regs(regs);
122 irq_enter();
123 s390_idle_check(); 122 s390_idle_check();
123 irq_enter();
124 if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) 124 if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator)
125 /* Serve timer interrupts first. */ 125 /* Serve timer interrupts first. */
126 clock_comparator_work(); 126 clock_comparator_work();
diff --git a/arch/s390/kernel/s390_ksyms.c b/arch/s390/kernel/s390_ksyms.c
index 48238a114ce9..46b90cb03707 100644
--- a/arch/s390/kernel/s390_ksyms.c
+++ b/arch/s390/kernel/s390_ksyms.c
@@ -14,6 +14,7 @@
14#include <asm/delay.h> 14#include <asm/delay.h>
15#include <asm/pgalloc.h> 15#include <asm/pgalloc.h>
16#include <asm/setup.h> 16#include <asm/setup.h>
17#include <asm/ftrace.h>
17#ifdef CONFIG_IP_MULTICAST 18#ifdef CONFIG_IP_MULTICAST
18#include <net/arp.h> 19#include <net/arp.h>
19#endif 20#endif
@@ -43,3 +44,7 @@ EXPORT_SYMBOL(csum_fold);
43EXPORT_SYMBOL(console_mode); 44EXPORT_SYMBOL(console_mode);
44EXPORT_SYMBOL(console_devno); 45EXPORT_SYMBOL(console_devno);
45EXPORT_SYMBOL(console_irq); 46EXPORT_SYMBOL(console_irq);
47
48#ifdef CONFIG_FUNCTION_TRACER
49EXPORT_SYMBOL(_mcount);
50#endif
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 400b040df7fa..d825f4950e4e 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -14,6 +14,9 @@
14 * This file handles the architecture-dependent parts of initialization 14 * This file handles the architecture-dependent parts of initialization
15 */ 15 */
16 16
17#define KMSG_COMPONENT "setup"
18#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
19
17#include <linux/errno.h> 20#include <linux/errno.h>
18#include <linux/module.h> 21#include <linux/module.h>
19#include <linux/sched.h> 22#include <linux/sched.h>
@@ -32,7 +35,6 @@
32#include <linux/bootmem.h> 35#include <linux/bootmem.h>
33#include <linux/root_dev.h> 36#include <linux/root_dev.h>
34#include <linux/console.h> 37#include <linux/console.h>
35#include <linux/seq_file.h>
36#include <linux/kernel_stat.h> 38#include <linux/kernel_stat.h>
37#include <linux/device.h> 39#include <linux/device.h>
38#include <linux/notifier.h> 40#include <linux/notifier.h>
@@ -291,8 +293,8 @@ unsigned int switch_amode = 0;
291#endif 293#endif
292EXPORT_SYMBOL_GPL(switch_amode); 294EXPORT_SYMBOL_GPL(switch_amode);
293 295
294static void set_amode_and_uaccess(unsigned long user_amode, 296static int set_amode_and_uaccess(unsigned long user_amode,
295 unsigned long user32_amode) 297 unsigned long user32_amode)
296{ 298{
297 psw_user_bits = PSW_BASE_BITS | PSW_MASK_DAT | user_amode | 299 psw_user_bits = PSW_BASE_BITS | PSW_MASK_DAT | user_amode |
298 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | 300 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK |
@@ -309,11 +311,11 @@ static void set_amode_and_uaccess(unsigned long user_amode,
309 PSW_MASK_MCHECK | PSW_DEFAULT_KEY; 311 PSW_MASK_MCHECK | PSW_DEFAULT_KEY;
310 312
311 if (MACHINE_HAS_MVCOS) { 313 if (MACHINE_HAS_MVCOS) {
312 printk("mvcos available.\n");
313 memcpy(&uaccess, &uaccess_mvcos_switch, sizeof(uaccess)); 314 memcpy(&uaccess, &uaccess_mvcos_switch, sizeof(uaccess));
315 return 1;
314 } else { 316 } else {
315 printk("mvcos not available.\n");
316 memcpy(&uaccess, &uaccess_pt, sizeof(uaccess)); 317 memcpy(&uaccess, &uaccess_pt, sizeof(uaccess));
318 return 0;
317 } 319 }
318} 320}
319 321
@@ -328,9 +330,10 @@ static int __init early_parse_switch_amode(char *p)
328early_param("switch_amode", early_parse_switch_amode); 330early_param("switch_amode", early_parse_switch_amode);
329 331
330#else /* CONFIG_S390_SWITCH_AMODE */ 332#else /* CONFIG_S390_SWITCH_AMODE */
331static inline void set_amode_and_uaccess(unsigned long user_amode, 333static inline int set_amode_and_uaccess(unsigned long user_amode,
332 unsigned long user32_amode) 334 unsigned long user32_amode)
333{ 335{
336 return 0;
334} 337}
335#endif /* CONFIG_S390_SWITCH_AMODE */ 338#endif /* CONFIG_S390_SWITCH_AMODE */
336 339
@@ -355,11 +358,20 @@ early_param("noexec", early_parse_noexec);
355static void setup_addressing_mode(void) 358static void setup_addressing_mode(void)
356{ 359{
357 if (s390_noexec) { 360 if (s390_noexec) {
358 printk("S390 execute protection active, "); 361 if (set_amode_and_uaccess(PSW_ASC_SECONDARY,
359 set_amode_and_uaccess(PSW_ASC_SECONDARY, PSW32_ASC_SECONDARY); 362 PSW32_ASC_SECONDARY))
363 pr_info("Execute protection active, "
364 "mvcos available\n");
365 else
366 pr_info("Execute protection active, "
367 "mvcos not available\n");
360 } else if (switch_amode) { 368 } else if (switch_amode) {
361 printk("S390 address spaces switched, "); 369 if (set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY))
362 set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY); 370 pr_info("Address spaces switched, "
371 "mvcos available\n");
372 else
373 pr_info("Address spaces switched, "
374 "mvcos not available\n");
363 } 375 }
364#ifdef CONFIG_TRACE_IRQFLAGS 376#ifdef CONFIG_TRACE_IRQFLAGS
365 sysc_restore_trace_psw.mask = psw_kernel_bits & ~PSW_MASK_MCHECK; 377 sysc_restore_trace_psw.mask = psw_kernel_bits & ~PSW_MASK_MCHECK;
@@ -415,6 +427,8 @@ setup_lowcore(void)
415 /* enable extended save area */ 427 /* enable extended save area */
416 __ctl_set_bit(14, 29); 428 __ctl_set_bit(14, 29);
417 } 429 }
430#else
431 lc->vdso_per_cpu_data = (unsigned long) &lc->paste[0];
418#endif 432#endif
419 set_prefix((u32)(unsigned long) lc); 433 set_prefix((u32)(unsigned long) lc);
420} 434}
@@ -572,15 +586,15 @@ setup_memory(void)
572 start = PFN_PHYS(start_pfn) + bmap_size + PAGE_SIZE; 586 start = PFN_PHYS(start_pfn) + bmap_size + PAGE_SIZE;
573 587
574 if (start + INITRD_SIZE > memory_end) { 588 if (start + INITRD_SIZE > memory_end) {
575 printk("initrd extends beyond end of memory " 589 pr_err("initrd extends beyond end of "
576 "(0x%08lx > 0x%08lx)\n" 590 "memory (0x%08lx > 0x%08lx) "
577 "disabling initrd\n", 591 "disabling initrd\n",
578 start + INITRD_SIZE, memory_end); 592 start + INITRD_SIZE, memory_end);
579 INITRD_START = INITRD_SIZE = 0; 593 INITRD_START = INITRD_SIZE = 0;
580 } else { 594 } else {
581 printk("Moving initrd (0x%08lx -> 0x%08lx, " 595 pr_info("Moving initrd (0x%08lx -> "
582 "size: %ld)\n", 596 "0x%08lx, size: %ld)\n",
583 INITRD_START, start, INITRD_SIZE); 597 INITRD_START, start, INITRD_SIZE);
584 memmove((void *) start, (void *) INITRD_START, 598 memmove((void *) start, (void *) INITRD_START,
585 INITRD_SIZE); 599 INITRD_SIZE);
586 INITRD_START = start; 600 INITRD_START = start;
@@ -642,8 +656,9 @@ setup_memory(void)
642 initrd_start = INITRD_START; 656 initrd_start = INITRD_START;
643 initrd_end = initrd_start + INITRD_SIZE; 657 initrd_end = initrd_start + INITRD_SIZE;
644 } else { 658 } else {
645 printk("initrd extends beyond end of memory " 659 pr_err("initrd extends beyond end of "
646 "(0x%08lx > 0x%08lx)\ndisabling initrd\n", 660 "memory (0x%08lx > 0x%08lx) "
661 "disabling initrd\n",
647 initrd_start + INITRD_SIZE, memory_end); 662 initrd_start + INITRD_SIZE, memory_end);
648 initrd_start = initrd_end = 0; 663 initrd_start = initrd_end = 0;
649 } 664 }
@@ -651,23 +666,6 @@ setup_memory(void)
651#endif 666#endif
652} 667}
653 668
654static int __init __stfle(unsigned long long *list, int doublewords)
655{
656 typedef struct { unsigned long long _[doublewords]; } addrtype;
657 register unsigned long __nr asm("0") = doublewords - 1;
658
659 asm volatile(".insn s,0xb2b00000,%0" /* stfle */
660 : "=m" (*(addrtype *) list), "+d" (__nr) : : "cc");
661 return __nr + 1;
662}
663
664int __init stfle(unsigned long long *list, int doublewords)
665{
666 if (!(stfl() & (1UL << 24)))
667 return -EOPNOTSUPP;
668 return __stfle(list, doublewords);
669}
670
671/* 669/*
672 * Setup hardware capabilities. 670 * Setup hardware capabilities.
673 */ 671 */
@@ -739,8 +737,13 @@ static void __init setup_hwcaps(void)
739 strcpy(elf_platform, "z990"); 737 strcpy(elf_platform, "z990");
740 break; 738 break;
741 case 0x2094: 739 case 0x2094:
740 case 0x2096:
742 strcpy(elf_platform, "z9-109"); 741 strcpy(elf_platform, "z9-109");
743 break; 742 break;
743 case 0x2097:
744 case 0x2098:
745 strcpy(elf_platform, "z10");
746 break;
744 } 747 }
745} 748}
746 749
@@ -752,25 +755,34 @@ static void __init setup_hwcaps(void)
752void __init 755void __init
753setup_arch(char **cmdline_p) 756setup_arch(char **cmdline_p)
754{ 757{
758 /* set up preferred console */
759 add_preferred_console("ttyS", 0, NULL);
760
755 /* 761 /*
756 * print what head.S has found out about the machine 762 * print what head.S has found out about the machine
757 */ 763 */
758#ifndef CONFIG_64BIT 764#ifndef CONFIG_64BIT
759 printk((MACHINE_IS_VM) ? 765 if (MACHINE_IS_VM)
760 "We are running under VM (31 bit mode)\n" : 766 pr_info("Linux is running as a z/VM "
761 "We are running native (31 bit mode)\n"); 767 "guest operating system in 31-bit mode\n");
762 printk((MACHINE_HAS_IEEE) ? 768 else
763 "This machine has an IEEE fpu\n" : 769 pr_info("Linux is running natively in 31-bit mode\n");
764 "This machine has no IEEE fpu\n"); 770 if (MACHINE_HAS_IEEE)
771 pr_info("The hardware system has IEEE compatible "
772 "floating point units\n");
773 else
774 pr_info("The hardware system has no IEEE compatible "
775 "floating point units\n");
765#else /* CONFIG_64BIT */ 776#else /* CONFIG_64BIT */
766 if (MACHINE_IS_VM) 777 if (MACHINE_IS_VM)
767 printk("We are running under VM (64 bit mode)\n"); 778 pr_info("Linux is running as a z/VM "
779 "guest operating system in 64-bit mode\n");
768 else if (MACHINE_IS_KVM) { 780 else if (MACHINE_IS_KVM) {
769 printk("We are running under KVM (64 bit mode)\n"); 781 pr_info("Linux is running under KVM in 64-bit mode\n");
770 add_preferred_console("hvc", 0, NULL); 782 add_preferred_console("hvc", 0, NULL);
771 s390_virtio_console_init(); 783 s390_virtio_console_init();
772 } else 784 } else
773 printk("We are running native (64 bit mode)\n"); 785 pr_info("Linux is running natively in 64-bit mode\n");
774#endif /* CONFIG_64BIT */ 786#endif /* CONFIG_64BIT */
775 787
776 /* Have one command line that is parsed and saved in /proc/cmdline */ 788 /* Have one command line that is parsed and saved in /proc/cmdline */
@@ -818,90 +830,3 @@ setup_arch(char **cmdline_p)
818 /* Setup zfcpdump support */ 830 /* Setup zfcpdump support */
819 setup_zfcpdump(console_devno); 831 setup_zfcpdump(console_devno);
820} 832}
821
822void __cpuinit print_cpu_info(struct cpuinfo_S390 *cpuinfo)
823{
824 printk(KERN_INFO "cpu %d "
825#ifdef CONFIG_SMP
826 "phys_idx=%d "
827#endif
828 "vers=%02X ident=%06X machine=%04X unused=%04X\n",
829 cpuinfo->cpu_nr,
830#ifdef CONFIG_SMP
831 cpuinfo->cpu_addr,
832#endif
833 cpuinfo->cpu_id.version,
834 cpuinfo->cpu_id.ident,
835 cpuinfo->cpu_id.machine,
836 cpuinfo->cpu_id.unused);
837}
838
839/*
840 * show_cpuinfo - Get information on one CPU for use by procfs.
841 */
842
843static int show_cpuinfo(struct seq_file *m, void *v)
844{
845 static const char *hwcap_str[8] = {
846 "esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp",
847 "edat"
848 };
849 struct cpuinfo_S390 *cpuinfo;
850 unsigned long n = (unsigned long) v - 1;
851 int i;
852
853 s390_adjust_jiffies();
854 preempt_disable();
855 if (!n) {
856 seq_printf(m, "vendor_id : IBM/S390\n"
857 "# processors : %i\n"
858 "bogomips per cpu: %lu.%02lu\n",
859 num_online_cpus(), loops_per_jiffy/(500000/HZ),
860 (loops_per_jiffy/(5000/HZ))%100);
861 seq_puts(m, "features\t: ");
862 for (i = 0; i < 8; i++)
863 if (hwcap_str[i] && (elf_hwcap & (1UL << i)))
864 seq_printf(m, "%s ", hwcap_str[i]);
865 seq_puts(m, "\n");
866 }
867
868 if (cpu_online(n)) {
869#ifdef CONFIG_SMP
870 if (smp_processor_id() == n)
871 cpuinfo = &S390_lowcore.cpu_data;
872 else
873 cpuinfo = &lowcore_ptr[n]->cpu_data;
874#else
875 cpuinfo = &S390_lowcore.cpu_data;
876#endif
877 seq_printf(m, "processor %li: "
878 "version = %02X, "
879 "identification = %06X, "
880 "machine = %04X\n",
881 n, cpuinfo->cpu_id.version,
882 cpuinfo->cpu_id.ident,
883 cpuinfo->cpu_id.machine);
884 }
885 preempt_enable();
886 return 0;
887}
888
889static void *c_start(struct seq_file *m, loff_t *pos)
890{
891 return *pos < NR_CPUS ? (void *)((unsigned long) *pos + 1) : NULL;
892}
893static void *c_next(struct seq_file *m, void *v, loff_t *pos)
894{
895 ++*pos;
896 return c_start(m, pos);
897}
898static void c_stop(struct seq_file *m, void *v)
899{
900}
901const struct seq_operations cpuinfo_op = {
902 .start = c_start,
903 .next = c_next,
904 .stop = c_stop,
905 .show = show_cpuinfo,
906};
907
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index b5595688a477..9c0ccb532a45 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -20,6 +20,9 @@
20 * cpu_number_map in other architectures. 20 * cpu_number_map in other architectures.
21 */ 21 */
22 22
23#define KMSG_COMPONENT "cpu"
24#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
25
23#include <linux/module.h> 26#include <linux/module.h>
24#include <linux/init.h> 27#include <linux/init.h>
25#include <linux/mm.h> 28#include <linux/mm.h>
@@ -44,6 +47,7 @@
44#include <asm/lowcore.h> 47#include <asm/lowcore.h>
45#include <asm/sclp.h> 48#include <asm/sclp.h>
46#include <asm/cpu.h> 49#include <asm/cpu.h>
50#include <asm/vdso.h>
47#include "entry.h" 51#include "entry.h"
48 52
49/* 53/*
@@ -52,12 +56,6 @@
52struct _lowcore *lowcore_ptr[NR_CPUS]; 56struct _lowcore *lowcore_ptr[NR_CPUS];
53EXPORT_SYMBOL(lowcore_ptr); 57EXPORT_SYMBOL(lowcore_ptr);
54 58
55cpumask_t cpu_online_map = CPU_MASK_NONE;
56EXPORT_SYMBOL(cpu_online_map);
57
58cpumask_t cpu_possible_map = CPU_MASK_ALL;
59EXPORT_SYMBOL(cpu_possible_map);
60
61static struct task_struct *current_set[NR_CPUS]; 59static struct task_struct *current_set[NR_CPUS];
62 60
63static u8 smp_cpu_type; 61static u8 smp_cpu_type;
@@ -77,159 +75,6 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices);
77 75
78static void smp_ext_bitcall(int, ec_bit_sig); 76static void smp_ext_bitcall(int, ec_bit_sig);
79 77
80/*
81 * Structure and data for __smp_call_function_map(). This is designed to
82 * minimise static memory requirements. It also looks cleaner.
83 */
84static DEFINE_SPINLOCK(call_lock);
85
86struct call_data_struct {
87 void (*func) (void *info);
88 void *info;
89 cpumask_t started;
90 cpumask_t finished;
91 int wait;
92};
93
94static struct call_data_struct *call_data;
95
96/*
97 * 'Call function' interrupt callback
98 */
99static void do_call_function(void)
100{
101 void (*func) (void *info) = call_data->func;
102 void *info = call_data->info;
103 int wait = call_data->wait;
104
105 cpu_set(smp_processor_id(), call_data->started);
106 (*func)(info);
107 if (wait)
108 cpu_set(smp_processor_id(), call_data->finished);;
109}
110
111static void __smp_call_function_map(void (*func) (void *info), void *info,
112 int wait, cpumask_t map)
113{
114 struct call_data_struct data;
115 int cpu, local = 0;
116
117 /*
118 * Can deadlock when interrupts are disabled or if in wrong context.
119 */
120 WARN_ON(irqs_disabled() || in_irq());
121
122 /*
123 * Check for local function call. We have to have the same call order
124 * as in on_each_cpu() because of machine_restart_smp().
125 */
126 if (cpu_isset(smp_processor_id(), map)) {
127 local = 1;
128 cpu_clear(smp_processor_id(), map);
129 }
130
131 cpus_and(map, map, cpu_online_map);
132 if (cpus_empty(map))
133 goto out;
134
135 data.func = func;
136 data.info = info;
137 data.started = CPU_MASK_NONE;
138 data.wait = wait;
139 if (wait)
140 data.finished = CPU_MASK_NONE;
141
142 call_data = &data;
143
144 for_each_cpu_mask(cpu, map)
145 smp_ext_bitcall(cpu, ec_call_function);
146
147 /* Wait for response */
148 while (!cpus_equal(map, data.started))
149 cpu_relax();
150 if (wait)
151 while (!cpus_equal(map, data.finished))
152 cpu_relax();
153out:
154 if (local) {
155 local_irq_disable();
156 func(info);
157 local_irq_enable();
158 }
159}
160
161/*
162 * smp_call_function:
163 * @func: the function to run; this must be fast and non-blocking
164 * @info: an arbitrary pointer to pass to the function
165 * @wait: if true, wait (atomically) until function has completed on other CPUs
166 *
167 * Run a function on all other CPUs.
168 *
169 * You must not call this function with disabled interrupts, from a
170 * hardware interrupt handler or from a bottom half.
171 */
172int smp_call_function(void (*func) (void *info), void *info, int wait)
173{
174 cpumask_t map;
175
176 spin_lock(&call_lock);
177 map = cpu_online_map;
178 cpu_clear(smp_processor_id(), map);
179 __smp_call_function_map(func, info, wait, map);
180 spin_unlock(&call_lock);
181 return 0;
182}
183EXPORT_SYMBOL(smp_call_function);
184
185/*
186 * smp_call_function_single:
187 * @cpu: the CPU where func should run
188 * @func: the function to run; this must be fast and non-blocking
189 * @info: an arbitrary pointer to pass to the function
190 * @wait: if true, wait (atomically) until function has completed on other CPUs
191 *
192 * Run a function on one processor.
193 *
194 * You must not call this function with disabled interrupts, from a
195 * hardware interrupt handler or from a bottom half.
196 */
197int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
198 int wait)
199{
200 spin_lock(&call_lock);
201 __smp_call_function_map(func, info, wait, cpumask_of_cpu(cpu));
202 spin_unlock(&call_lock);
203 return 0;
204}
205EXPORT_SYMBOL(smp_call_function_single);
206
207/**
208 * smp_call_function_mask(): Run a function on a set of other CPUs.
209 * @mask: The set of cpus to run on. Must not include the current cpu.
210 * @func: The function to run. This must be fast and non-blocking.
211 * @info: An arbitrary pointer to pass to the function.
212 * @wait: If true, wait (atomically) until function has completed on other CPUs.
213 *
214 * Returns 0 on success, else a negative status code.
215 *
216 * If @wait is true, then returns once @func has returned; otherwise
217 * it returns just before the target cpu calls @func.
218 *
219 * You must not call this function with disabled interrupts or from a
220 * hardware interrupt handler or from a bottom half handler.
221 */
222int smp_call_function_mask(cpumask_t mask, void (*func)(void *), void *info,
223 int wait)
224{
225 spin_lock(&call_lock);
226 cpu_clear(smp_processor_id(), mask);
227 __smp_call_function_map(func, info, wait, mask);
228 spin_unlock(&call_lock);
229 return 0;
230}
231EXPORT_SYMBOL(smp_call_function_mask);
232
233void smp_send_stop(void) 78void smp_send_stop(void)
234{ 79{
235 int cpu, rc; 80 int cpu, rc;
@@ -271,7 +116,10 @@ static void do_ext_call_interrupt(__u16 code)
271 bits = xchg(&S390_lowcore.ext_call_fast, 0); 116 bits = xchg(&S390_lowcore.ext_call_fast, 0);
272 117
273 if (test_bit(ec_call_function, &bits)) 118 if (test_bit(ec_call_function, &bits))
274 do_call_function(); 119 generic_smp_call_function_interrupt();
120
121 if (test_bit(ec_call_function_single, &bits))
122 generic_smp_call_function_single_interrupt();
275} 123}
276 124
277/* 125/*
@@ -288,6 +136,19 @@ static void smp_ext_bitcall(int cpu, ec_bit_sig sig)
288 udelay(10); 136 udelay(10);
289} 137}
290 138
139void arch_send_call_function_ipi(cpumask_t mask)
140{
141 int cpu;
142
143 for_each_cpu_mask(cpu, mask)
144 smp_ext_bitcall(cpu, ec_call_function);
145}
146
147void arch_send_call_function_single_ipi(int cpu)
148{
149 smp_ext_bitcall(cpu, ec_call_function_single);
150}
151
291#ifndef CONFIG_64BIT 152#ifndef CONFIG_64BIT
292/* 153/*
293 * this function sends a 'purge tlb' signal to another CPU. 154 * this function sends a 'purge tlb' signal to another CPU.
@@ -388,8 +249,8 @@ static void __init smp_get_save_area(unsigned int cpu, unsigned int phy_cpu)
388 if (ipl_info.type != IPL_TYPE_FCP_DUMP) 249 if (ipl_info.type != IPL_TYPE_FCP_DUMP)
389 return; 250 return;
390 if (cpu >= NR_CPUS) { 251 if (cpu >= NR_CPUS) {
391 printk(KERN_WARNING "Registers for cpu %i not saved since dump " 252 pr_warning("CPU %i exceeds the maximum %i and is excluded from "
392 "kernel was compiled with NR_CPUS=%i\n", cpu, NR_CPUS); 253 "the dump\n", cpu, NR_CPUS - 1);
393 return; 254 return;
394 } 255 }
395 zfcpdump_save_areas[cpu] = kmalloc(sizeof(union save_area), GFP_KERNEL); 256 zfcpdump_save_areas[cpu] = kmalloc(sizeof(union save_area), GFP_KERNEL);
@@ -562,7 +423,7 @@ static void __init smp_detect_cpus(void)
562 } 423 }
563out: 424out:
564 kfree(info); 425 kfree(info);
565 printk(KERN_INFO "CPUs: %d configured, %d standby\n", c_cpus, s_cpus); 426 pr_info("%d configured CPUs, %d standby CPUs\n", c_cpus, s_cpus);
566 get_online_cpus(); 427 get_online_cpus();
567 __smp_rescan_cpus(); 428 __smp_rescan_cpus();
568 put_online_cpus(); 429 put_online_cpus();
@@ -578,19 +439,17 @@ int __cpuinit start_secondary(void *cpuvoid)
578 preempt_disable(); 439 preempt_disable();
579 /* Enable TOD clock interrupts on the secondary cpu. */ 440 /* Enable TOD clock interrupts on the secondary cpu. */
580 init_cpu_timer(); 441 init_cpu_timer();
581#ifdef CONFIG_VIRT_TIMER
582 /* Enable cpu timer interrupts on the secondary cpu. */ 442 /* Enable cpu timer interrupts on the secondary cpu. */
583 init_cpu_vtimer(); 443 init_cpu_vtimer();
584#endif
585 /* Enable pfault pseudo page faults on this cpu. */ 444 /* Enable pfault pseudo page faults on this cpu. */
586 pfault_init(); 445 pfault_init();
587 446
588 /* call cpu notifiers */ 447 /* call cpu notifiers */
589 notify_cpu_starting(smp_processor_id()); 448 notify_cpu_starting(smp_processor_id());
590 /* Mark this cpu as online */ 449 /* Mark this cpu as online */
591 spin_lock(&call_lock); 450 ipi_call_lock();
592 cpu_set(smp_processor_id(), cpu_online_map); 451 cpu_set(smp_processor_id(), cpu_online_map);
593 spin_unlock(&call_lock); 452 ipi_call_unlock();
594 /* Switch on interrupts */ 453 /* Switch on interrupts */
595 local_irq_enable(); 454 local_irq_enable();
596 /* Print info about this processor */ 455 /* Print info about this processor */
@@ -639,18 +498,18 @@ static int __cpuinit smp_alloc_lowcore(int cpu)
639 498
640 save_area = get_zeroed_page(GFP_KERNEL); 499 save_area = get_zeroed_page(GFP_KERNEL);
641 if (!save_area) 500 if (!save_area)
642 goto out_save_area; 501 goto out;
643 lowcore->extended_save_area_addr = (u32) save_area; 502 lowcore->extended_save_area_addr = (u32) save_area;
644 } 503 }
504#else
505 if (vdso_alloc_per_cpu(cpu, lowcore))
506 goto out;
645#endif 507#endif
646 lowcore_ptr[cpu] = lowcore; 508 lowcore_ptr[cpu] = lowcore;
647 return 0; 509 return 0;
648 510
649#ifndef CONFIG_64BIT
650out_save_area:
651 free_page(panic_stack);
652#endif
653out: 511out:
512 free_page(panic_stack);
654 free_pages(async_stack, ASYNC_ORDER); 513 free_pages(async_stack, ASYNC_ORDER);
655 free_pages((unsigned long) lowcore, lc_order); 514 free_pages((unsigned long) lowcore, lc_order);
656 return -ENOMEM; 515 return -ENOMEM;
@@ -667,6 +526,8 @@ static void smp_free_lowcore(int cpu)
667#ifndef CONFIG_64BIT 526#ifndef CONFIG_64BIT
668 if (MACHINE_HAS_IEEE) 527 if (MACHINE_HAS_IEEE)
669 free_page((unsigned long) lowcore->extended_save_area_addr); 528 free_page((unsigned long) lowcore->extended_save_area_addr);
529#else
530 vdso_free_per_cpu(cpu, lowcore);
670#endif 531#endif
671 free_page(lowcore->panic_stack - PAGE_SIZE); 532 free_page(lowcore->panic_stack - PAGE_SIZE);
672 free_pages(lowcore->async_stack - ASYNC_SIZE, ASYNC_ORDER); 533 free_pages(lowcore->async_stack - ASYNC_SIZE, ASYNC_ORDER);
@@ -690,12 +551,8 @@ int __cpuinit __cpu_up(unsigned int cpu)
690 551
691 ccode = signal_processor_p((__u32)(unsigned long)(lowcore_ptr[cpu]), 552 ccode = signal_processor_p((__u32)(unsigned long)(lowcore_ptr[cpu]),
692 cpu, sigp_set_prefix); 553 cpu, sigp_set_prefix);
693 if (ccode) { 554 if (ccode)
694 printk("sigp_set_prefix failed for cpu %d "
695 "with condition code %d\n",
696 (int) cpu, (int) ccode);
697 return -EIO; 555 return -EIO;
698 }
699 556
700 idle = current_set[cpu]; 557 idle = current_set[cpu];
701 cpu_lowcore = lowcore_ptr[cpu]; 558 cpu_lowcore = lowcore_ptr[cpu];
@@ -778,7 +635,7 @@ void __cpu_die(unsigned int cpu)
778 while (!smp_cpu_not_running(cpu)) 635 while (!smp_cpu_not_running(cpu))
779 cpu_relax(); 636 cpu_relax();
780 smp_free_lowcore(cpu); 637 smp_free_lowcore(cpu);
781 printk(KERN_INFO "Processor %d spun down\n", cpu); 638 pr_info("Processor %d stopped\n", cpu);
782} 639}
783 640
784void cpu_die(void) 641void cpu_die(void)
@@ -813,6 +670,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
813 lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, lc_order); 670 lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, lc_order);
814 panic_stack = __get_free_page(GFP_KERNEL); 671 panic_stack = __get_free_page(GFP_KERNEL);
815 async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER); 672 async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER);
673 BUG_ON(!lowcore || !panic_stack || !async_stack);
816#ifndef CONFIG_64BIT 674#ifndef CONFIG_64BIT
817 if (MACHINE_HAS_IEEE) 675 if (MACHINE_HAS_IEEE)
818 save_area = get_zeroed_page(GFP_KERNEL); 676 save_area = get_zeroed_page(GFP_KERNEL);
@@ -826,6 +684,8 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
826#ifndef CONFIG_64BIT 684#ifndef CONFIG_64BIT
827 if (MACHINE_HAS_IEEE) 685 if (MACHINE_HAS_IEEE)
828 lowcore->extended_save_area_addr = (u32) save_area; 686 lowcore->extended_save_area_addr = (u32) save_area;
687#else
688 BUG_ON(vdso_alloc_per_cpu(smp_processor_id(), lowcore));
829#endif 689#endif
830 set_prefix((u32)(unsigned long) lowcore); 690 set_prefix((u32)(unsigned long) lowcore);
831 local_mcck_enable(); 691 local_mcck_enable();
@@ -994,9 +854,11 @@ static ssize_t show_idle_count(struct sys_device *dev,
994 unsigned long long idle_count; 854 unsigned long long idle_count;
995 855
996 idle = &per_cpu(s390_idle, dev->id); 856 idle = &per_cpu(s390_idle, dev->id);
997 spin_lock_irq(&idle->lock); 857 spin_lock(&idle->lock);
998 idle_count = idle->idle_count; 858 idle_count = idle->idle_count;
999 spin_unlock_irq(&idle->lock); 859 if (idle->idle_enter)
860 idle_count++;
861 spin_unlock(&idle->lock);
1000 return sprintf(buf, "%llu\n", idle_count); 862 return sprintf(buf, "%llu\n", idle_count);
1001} 863}
1002static SYSDEV_ATTR(idle_count, 0444, show_idle_count, NULL); 864static SYSDEV_ATTR(idle_count, 0444, show_idle_count, NULL);
@@ -1005,18 +867,17 @@ static ssize_t show_idle_time(struct sys_device *dev,
1005 struct sysdev_attribute *attr, char *buf) 867 struct sysdev_attribute *attr, char *buf)
1006{ 868{
1007 struct s390_idle_data *idle; 869 struct s390_idle_data *idle;
1008 unsigned long long new_time; 870 unsigned long long now, idle_time, idle_enter;
1009 871
1010 idle = &per_cpu(s390_idle, dev->id); 872 idle = &per_cpu(s390_idle, dev->id);
1011 spin_lock_irq(&idle->lock); 873 spin_lock(&idle->lock);
1012 if (idle->in_idle) { 874 now = get_clock();
1013 new_time = get_clock(); 875 idle_time = idle->idle_time;
1014 idle->idle_time += new_time - idle->idle_enter; 876 idle_enter = idle->idle_enter;
1015 idle->idle_enter = new_time; 877 if (idle_enter != 0ULL && idle_enter < now)
1016 } 878 idle_time += now - idle_enter;
1017 new_time = idle->idle_time; 879 spin_unlock(&idle->lock);
1018 spin_unlock_irq(&idle->lock); 880 return sprintf(buf, "%llu\n", idle_time >> 12);
1019 return sprintf(buf, "%llu\n", new_time >> 12);
1020} 881}
1021static SYSDEV_ATTR(idle_time_us, 0444, show_idle_time, NULL); 882static SYSDEV_ATTR(idle_time_us, 0444, show_idle_time, NULL);
1022 883
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index eccefbbff887..d649600df5b9 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -12,6 +12,9 @@
12 * Copyright (C) 1991, 1992, 1995 Linus Torvalds 12 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
13 */ 13 */
14 14
15#define KMSG_COMPONENT "time"
16#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
17
15#include <linux/errno.h> 18#include <linux/errno.h>
16#include <linux/module.h> 19#include <linux/module.h>
17#include <linux/sched.h> 20#include <linux/sched.h>
@@ -20,6 +23,8 @@
20#include <linux/string.h> 23#include <linux/string.h>
21#include <linux/mm.h> 24#include <linux/mm.h>
22#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/cpu.h>
27#include <linux/stop_machine.h>
23#include <linux/time.h> 28#include <linux/time.h>
24#include <linux/sysdev.h> 29#include <linux/sysdev.h>
25#include <linux/delay.h> 30#include <linux/delay.h>
@@ -36,6 +41,7 @@
36#include <asm/delay.h> 41#include <asm/delay.h>
37#include <asm/s390_ext.h> 42#include <asm/s390_ext.h>
38#include <asm/div64.h> 43#include <asm/div64.h>
44#include <asm/vdso.h>
39#include <asm/irq.h> 45#include <asm/irq.h>
40#include <asm/irq_regs.h> 46#include <asm/irq_regs.h>
41#include <asm/timer.h> 47#include <asm/timer.h>
@@ -154,7 +160,7 @@ void init_cpu_timer(void)
154 cd->min_delta_ns = 1; 160 cd->min_delta_ns = 1;
155 cd->max_delta_ns = LONG_MAX; 161 cd->max_delta_ns = LONG_MAX;
156 cd->rating = 400; 162 cd->rating = 400;
157 cd->cpumask = cpumask_of_cpu(cpu); 163 cd->cpumask = cpumask_of(cpu);
158 cd->set_next_event = s390_next_event; 164 cd->set_next_event = s390_next_event;
159 cd->set_mode = s390_set_mode; 165 cd->set_mode = s390_set_mode;
160 166
@@ -223,6 +229,36 @@ static struct clocksource clocksource_tod = {
223}; 229};
224 230
225 231
232void update_vsyscall(struct timespec *wall_time, struct clocksource *clock)
233{
234 if (clock != &clocksource_tod)
235 return;
236
237 /* Make userspace gettimeofday spin until we're done. */
238 ++vdso_data->tb_update_count;
239 smp_wmb();
240 vdso_data->xtime_tod_stamp = clock->cycle_last;
241 vdso_data->xtime_clock_sec = xtime.tv_sec;
242 vdso_data->xtime_clock_nsec = xtime.tv_nsec;
243 vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec;
244 vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec;
245 smp_wmb();
246 ++vdso_data->tb_update_count;
247}
248
249extern struct timezone sys_tz;
250
251void update_vsyscall_tz(void)
252{
253 /* Make userspace gettimeofday spin until we're done. */
254 ++vdso_data->tb_update_count;
255 smp_wmb();
256 vdso_data->tz_minuteswest = sys_tz.tz_minuteswest;
257 vdso_data->tz_dsttime = sys_tz.tz_dsttime;
258 smp_wmb();
259 ++vdso_data->tb_update_count;
260}
261
226/* 262/*
227 * Initialize the TOD clock and the CPU timer of 263 * Initialize the TOD clock and the CPU timer of
228 * the boot cpu. 264 * the boot cpu.
@@ -253,10 +289,8 @@ void __init time_init(void)
253 289
254 /* Enable TOD clock interrupts on the boot cpu. */ 290 /* Enable TOD clock interrupts on the boot cpu. */
255 init_cpu_timer(); 291 init_cpu_timer();
256 292 /* Enable cpu timer interrupts on the boot cpu. */
257#ifdef CONFIG_VIRT_TIMER
258 vtime_init(); 293 vtime_init();
259#endif
260} 294}
261 295
262/* 296/*
@@ -288,8 +322,8 @@ static unsigned long long adjust_time(unsigned long long old,
288 } 322 }
289 sched_clock_base_cc += delta; 323 sched_clock_base_cc += delta;
290 if (adjust.offset != 0) { 324 if (adjust.offset != 0) {
291 printk(KERN_NOTICE "etr: time adjusted by %li micro-seconds\n", 325 pr_notice("The ETR interface has adjusted the clock "
292 adjust.offset); 326 "by %li microseconds\n", adjust.offset);
293 adjust.modes = ADJ_OFFSET_SINGLESHOT; 327 adjust.modes = ADJ_OFFSET_SINGLESHOT;
294 do_adjtimex(&adjust); 328 do_adjtimex(&adjust);
295 } 329 }
@@ -360,6 +394,15 @@ static void enable_sync_clock(void)
360 atomic_set_mask(0x80000000, sw_ptr); 394 atomic_set_mask(0x80000000, sw_ptr);
361} 395}
362 396
397/* Single threaded workqueue used for etr and stp sync events */
398static struct workqueue_struct *time_sync_wq;
399
400static void __init time_init_wq(void)
401{
402 if (!time_sync_wq)
403 time_sync_wq = create_singlethread_workqueue("timesync");
404}
405
363/* 406/*
364 * External Time Reference (ETR) code. 407 * External Time Reference (ETR) code.
365 */ 408 */
@@ -425,6 +468,7 @@ static struct timer_list etr_timer;
425 468
426static void etr_timeout(unsigned long dummy); 469static void etr_timeout(unsigned long dummy);
427static void etr_work_fn(struct work_struct *work); 470static void etr_work_fn(struct work_struct *work);
471static DEFINE_MUTEX(etr_work_mutex);
428static DECLARE_WORK(etr_work, etr_work_fn); 472static DECLARE_WORK(etr_work, etr_work_fn);
429 473
430/* 474/*
@@ -440,8 +484,8 @@ static void etr_reset(void)
440 etr_tolec = get_clock(); 484 etr_tolec = get_clock();
441 set_bit(CLOCK_SYNC_HAS_ETR, &clock_sync_flags); 485 set_bit(CLOCK_SYNC_HAS_ETR, &clock_sync_flags);
442 } else if (etr_port0_online || etr_port1_online) { 486 } else if (etr_port0_online || etr_port1_online) {
443 printk(KERN_WARNING "Running on non ETR capable " 487 pr_warning("The real or virtual hardware system does "
444 "machine, only local mode available.\n"); 488 "not provide an ETR interface\n");
445 etr_port0_online = etr_port1_online = 0; 489 etr_port0_online = etr_port1_online = 0;
446 } 490 }
447} 491}
@@ -452,17 +496,18 @@ static int __init etr_init(void)
452 496
453 if (!test_bit(CLOCK_SYNC_HAS_ETR, &clock_sync_flags)) 497 if (!test_bit(CLOCK_SYNC_HAS_ETR, &clock_sync_flags))
454 return 0; 498 return 0;
499 time_init_wq();
455 /* Check if this machine has the steai instruction. */ 500 /* Check if this machine has the steai instruction. */
456 if (etr_steai(&aib, ETR_STEAI_STEPPING_PORT) == 0) 501 if (etr_steai(&aib, ETR_STEAI_STEPPING_PORT) == 0)
457 etr_steai_available = 1; 502 etr_steai_available = 1;
458 setup_timer(&etr_timer, etr_timeout, 0UL); 503 setup_timer(&etr_timer, etr_timeout, 0UL);
459 if (etr_port0_online) { 504 if (etr_port0_online) {
460 set_bit(ETR_EVENT_PORT0_CHANGE, &etr_events); 505 set_bit(ETR_EVENT_PORT0_CHANGE, &etr_events);
461 schedule_work(&etr_work); 506 queue_work(time_sync_wq, &etr_work);
462 } 507 }
463 if (etr_port1_online) { 508 if (etr_port1_online) {
464 set_bit(ETR_EVENT_PORT1_CHANGE, &etr_events); 509 set_bit(ETR_EVENT_PORT1_CHANGE, &etr_events);
465 schedule_work(&etr_work); 510 queue_work(time_sync_wq, &etr_work);
466 } 511 }
467 return 0; 512 return 0;
468} 513}
@@ -489,7 +534,7 @@ void etr_switch_to_local(void)
489 if (test_bit(CLOCK_SYNC_ETR, &clock_sync_flags)) 534 if (test_bit(CLOCK_SYNC_ETR, &clock_sync_flags))
490 disable_sync_clock(NULL); 535 disable_sync_clock(NULL);
491 set_bit(ETR_EVENT_SWITCH_LOCAL, &etr_events); 536 set_bit(ETR_EVENT_SWITCH_LOCAL, &etr_events);
492 schedule_work(&etr_work); 537 queue_work(time_sync_wq, &etr_work);
493} 538}
494 539
495/* 540/*
@@ -505,7 +550,7 @@ void etr_sync_check(void)
505 if (test_bit(CLOCK_SYNC_ETR, &clock_sync_flags)) 550 if (test_bit(CLOCK_SYNC_ETR, &clock_sync_flags))
506 disable_sync_clock(NULL); 551 disable_sync_clock(NULL);
507 set_bit(ETR_EVENT_SYNC_CHECK, &etr_events); 552 set_bit(ETR_EVENT_SYNC_CHECK, &etr_events);
508 schedule_work(&etr_work); 553 queue_work(time_sync_wq, &etr_work);
509} 554}
510 555
511/* 556/*
@@ -529,13 +574,13 @@ static void etr_timing_alert(struct etr_irq_parm *intparm)
529 * Both ports are not up-to-date now. 574 * Both ports are not up-to-date now.
530 */ 575 */
531 set_bit(ETR_EVENT_PORT_ALERT, &etr_events); 576 set_bit(ETR_EVENT_PORT_ALERT, &etr_events);
532 schedule_work(&etr_work); 577 queue_work(time_sync_wq, &etr_work);
533} 578}
534 579
535static void etr_timeout(unsigned long dummy) 580static void etr_timeout(unsigned long dummy)
536{ 581{
537 set_bit(ETR_EVENT_UPDATE, &etr_events); 582 set_bit(ETR_EVENT_UPDATE, &etr_events);
538 schedule_work(&etr_work); 583 queue_work(time_sync_wq, &etr_work);
539} 584}
540 585
541/* 586/*
@@ -642,14 +687,16 @@ static int etr_aib_follows(struct etr_aib *a1, struct etr_aib *a2, int p)
642} 687}
643 688
644struct clock_sync_data { 689struct clock_sync_data {
690 atomic_t cpus;
645 int in_sync; 691 int in_sync;
646 unsigned long long fixup_cc; 692 unsigned long long fixup_cc;
693 int etr_port;
694 struct etr_aib *etr_aib;
647}; 695};
648 696
649static void clock_sync_cpu_start(void *dummy) 697static void clock_sync_cpu(struct clock_sync_data *sync)
650{ 698{
651 struct clock_sync_data *sync = dummy; 699 atomic_dec(&sync->cpus);
652
653 enable_sync_clock(); 700 enable_sync_clock();
654 /* 701 /*
655 * This looks like a busy wait loop but it isn't. etr_sync_cpus 702 * This looks like a busy wait loop but it isn't. etr_sync_cpus
@@ -675,39 +722,35 @@ static void clock_sync_cpu_start(void *dummy)
675 fixup_clock_comparator(sync->fixup_cc); 722 fixup_clock_comparator(sync->fixup_cc);
676} 723}
677 724
678static void clock_sync_cpu_end(void *dummy)
679{
680}
681
682/* 725/*
683 * Sync the TOD clock using the port refered to by aibp. This port 726 * Sync the TOD clock using the port refered to by aibp. This port
684 * has to be enabled and the other port has to be disabled. The 727 * has to be enabled and the other port has to be disabled. The
685 * last eacr update has to be more than 1.6 seconds in the past. 728 * last eacr update has to be more than 1.6 seconds in the past.
686 */ 729 */
687static int etr_sync_clock(struct etr_aib *aib, int port) 730static int etr_sync_clock(void *data)
688{ 731{
689 struct etr_aib *sync_port; 732 static int first;
690 struct clock_sync_data etr_sync;
691 unsigned long long clock, old_clock, delay, delta; 733 unsigned long long clock, old_clock, delay, delta;
692 int follows; 734 struct clock_sync_data *etr_sync;
735 struct etr_aib *sync_port, *aib;
736 int port;
693 int rc; 737 int rc;
694 738
695 /* Check if the current aib is adjacent to the sync port aib. */ 739 etr_sync = data;
696 sync_port = (port == 0) ? &etr_port0 : &etr_port1;
697 follows = etr_aib_follows(sync_port, aib, port);
698 memcpy(sync_port, aib, sizeof(*aib));
699 if (!follows)
700 return -EAGAIN;
701 740
702 /* 741 if (xchg(&first, 1) == 1) {
703 * Catch all other cpus and make them wait until we have 742 /* Slave */
704 * successfully synced the clock. smp_call_function will 743 clock_sync_cpu(etr_sync);
705 * return after all other cpus are in etr_sync_cpu_start. 744 return 0;
706 */ 745 }
707 memset(&etr_sync, 0, sizeof(etr_sync)); 746
708 preempt_disable(); 747 /* Wait until all other cpus entered the sync function. */
709 smp_call_function(clock_sync_cpu_start, &etr_sync, 0); 748 while (atomic_read(&etr_sync->cpus) != 0)
710 local_irq_disable(); 749 cpu_relax();
750
751 port = etr_sync->etr_port;
752 aib = etr_sync->etr_aib;
753 sync_port = (port == 0) ? &etr_port0 : &etr_port1;
711 enable_sync_clock(); 754 enable_sync_clock();
712 755
713 /* Set clock to next OTE. */ 756 /* Set clock to next OTE. */
@@ -724,16 +767,16 @@ static int etr_sync_clock(struct etr_aib *aib, int port)
724 delay = (unsigned long long) 767 delay = (unsigned long long)
725 (aib->edf2.etv - sync_port->edf2.etv) << 32; 768 (aib->edf2.etv - sync_port->edf2.etv) << 32;
726 delta = adjust_time(old_clock, clock, delay); 769 delta = adjust_time(old_clock, clock, delay);
727 etr_sync.fixup_cc = delta; 770 etr_sync->fixup_cc = delta;
728 fixup_clock_comparator(delta); 771 fixup_clock_comparator(delta);
729 /* Verify that the clock is properly set. */ 772 /* Verify that the clock is properly set. */
730 if (!etr_aib_follows(sync_port, aib, port)) { 773 if (!etr_aib_follows(sync_port, aib, port)) {
731 /* Didn't work. */ 774 /* Didn't work. */
732 disable_sync_clock(NULL); 775 disable_sync_clock(NULL);
733 etr_sync.in_sync = -EAGAIN; 776 etr_sync->in_sync = -EAGAIN;
734 rc = -EAGAIN; 777 rc = -EAGAIN;
735 } else { 778 } else {
736 etr_sync.in_sync = 1; 779 etr_sync->in_sync = 1;
737 rc = 0; 780 rc = 0;
738 } 781 }
739 } else { 782 } else {
@@ -741,12 +784,33 @@ static int etr_sync_clock(struct etr_aib *aib, int port)
741 __ctl_clear_bit(0, 29); 784 __ctl_clear_bit(0, 29);
742 __ctl_clear_bit(14, 21); 785 __ctl_clear_bit(14, 21);
743 disable_sync_clock(NULL); 786 disable_sync_clock(NULL);
744 etr_sync.in_sync = -EAGAIN; 787 etr_sync->in_sync = -EAGAIN;
745 rc = -EAGAIN; 788 rc = -EAGAIN;
746 } 789 }
747 local_irq_enable(); 790 xchg(&first, 0);
748 smp_call_function(clock_sync_cpu_end, NULL, 0); 791 return rc;
749 preempt_enable(); 792}
793
794static int etr_sync_clock_stop(struct etr_aib *aib, int port)
795{
796 struct clock_sync_data etr_sync;
797 struct etr_aib *sync_port;
798 int follows;
799 int rc;
800
801 /* Check if the current aib is adjacent to the sync port aib. */
802 sync_port = (port == 0) ? &etr_port0 : &etr_port1;
803 follows = etr_aib_follows(sync_port, aib, port);
804 memcpy(sync_port, aib, sizeof(*aib));
805 if (!follows)
806 return -EAGAIN;
807 memset(&etr_sync, 0, sizeof(etr_sync));
808 etr_sync.etr_aib = aib;
809 etr_sync.etr_port = port;
810 get_online_cpus();
811 atomic_set(&etr_sync.cpus, num_online_cpus() - 1);
812 rc = stop_machine(etr_sync_clock, &etr_sync, &cpu_online_map);
813 put_online_cpus();
750 return rc; 814 return rc;
751} 815}
752 816
@@ -903,7 +967,7 @@ static void etr_update_eacr(struct etr_eacr eacr)
903} 967}
904 968
905/* 969/*
906 * ETR tasklet. In this function you'll find the main logic. In 970 * ETR work. In this function you'll find the main logic. In
907 * particular this is the only function that calls etr_update_eacr(), 971 * particular this is the only function that calls etr_update_eacr(),
908 * it "controls" the etr control register. 972 * it "controls" the etr control register.
909 */ 973 */
@@ -914,6 +978,9 @@ static void etr_work_fn(struct work_struct *work)
914 struct etr_aib aib; 978 struct etr_aib aib;
915 int sync_port; 979 int sync_port;
916 980
981 /* prevent multiple execution. */
982 mutex_lock(&etr_work_mutex);
983
917 /* Create working copy of etr_eacr. */ 984 /* Create working copy of etr_eacr. */
918 eacr = etr_eacr; 985 eacr = etr_eacr;
919 986
@@ -929,7 +996,7 @@ static void etr_work_fn(struct work_struct *work)
929 del_timer_sync(&etr_timer); 996 del_timer_sync(&etr_timer);
930 etr_update_eacr(eacr); 997 etr_update_eacr(eacr);
931 clear_bit(CLOCK_SYNC_ETR, &clock_sync_flags); 998 clear_bit(CLOCK_SYNC_ETR, &clock_sync_flags);
932 return; 999 goto out_unlock;
933 } 1000 }
934 1001
935 /* Store aib to get the current ETR status word. */ 1002 /* Store aib to get the current ETR status word. */
@@ -1016,7 +1083,7 @@ static void etr_work_fn(struct work_struct *work)
1016 eacr.es || sync_port < 0) { 1083 eacr.es || sync_port < 0) {
1017 etr_update_eacr(eacr); 1084 etr_update_eacr(eacr);
1018 etr_set_tolec_timeout(now); 1085 etr_set_tolec_timeout(now);
1019 return; 1086 goto out_unlock;
1020 } 1087 }
1021 1088
1022 /* 1089 /*
@@ -1036,7 +1103,7 @@ static void etr_work_fn(struct work_struct *work)
1036 etr_update_eacr(eacr); 1103 etr_update_eacr(eacr);
1037 set_bit(CLOCK_SYNC_ETR, &clock_sync_flags); 1104 set_bit(CLOCK_SYNC_ETR, &clock_sync_flags);
1038 if (now < etr_tolec + (1600000 << 12) || 1105 if (now < etr_tolec + (1600000 << 12) ||
1039 etr_sync_clock(&aib, sync_port) != 0) { 1106 etr_sync_clock_stop(&aib, sync_port) != 0) {
1040 /* Sync failed. Try again in 1/2 second. */ 1107 /* Sync failed. Try again in 1/2 second. */
1041 eacr.es = 0; 1108 eacr.es = 0;
1042 etr_update_eacr(eacr); 1109 etr_update_eacr(eacr);
@@ -1044,6 +1111,8 @@ static void etr_work_fn(struct work_struct *work)
1044 etr_set_sync_timeout(); 1111 etr_set_sync_timeout();
1045 } else 1112 } else
1046 etr_set_tolec_timeout(now); 1113 etr_set_tolec_timeout(now);
1114out_unlock:
1115 mutex_unlock(&etr_work_mutex);
1047} 1116}
1048 1117
1049/* 1118/*
@@ -1125,13 +1194,13 @@ static ssize_t etr_online_store(struct sys_device *dev,
1125 return count; /* Nothing to do. */ 1194 return count; /* Nothing to do. */
1126 etr_port0_online = value; 1195 etr_port0_online = value;
1127 set_bit(ETR_EVENT_PORT0_CHANGE, &etr_events); 1196 set_bit(ETR_EVENT_PORT0_CHANGE, &etr_events);
1128 schedule_work(&etr_work); 1197 queue_work(time_sync_wq, &etr_work);
1129 } else { 1198 } else {
1130 if (etr_port1_online == value) 1199 if (etr_port1_online == value)
1131 return count; /* Nothing to do. */ 1200 return count; /* Nothing to do. */
1132 etr_port1_online = value; 1201 etr_port1_online = value;
1133 set_bit(ETR_EVENT_PORT1_CHANGE, &etr_events); 1202 set_bit(ETR_EVENT_PORT1_CHANGE, &etr_events);
1134 schedule_work(&etr_work); 1203 queue_work(time_sync_wq, &etr_work);
1135 } 1204 }
1136 return count; 1205 return count;
1137} 1206}
@@ -1332,6 +1401,7 @@ static struct stp_sstpi stp_info;
1332static void *stp_page; 1401static void *stp_page;
1333 1402
1334static void stp_work_fn(struct work_struct *work); 1403static void stp_work_fn(struct work_struct *work);
1404static DEFINE_MUTEX(stp_work_mutex);
1335static DECLARE_WORK(stp_work, stp_work_fn); 1405static DECLARE_WORK(stp_work, stp_work_fn);
1336 1406
1337static int __init early_parse_stp(char *p) 1407static int __init early_parse_stp(char *p)
@@ -1356,7 +1426,8 @@ static void __init stp_reset(void)
1356 if (rc == 0) 1426 if (rc == 0)
1357 set_bit(CLOCK_SYNC_HAS_STP, &clock_sync_flags); 1427 set_bit(CLOCK_SYNC_HAS_STP, &clock_sync_flags);
1358 else if (stp_online) { 1428 else if (stp_online) {
1359 printk(KERN_WARNING "Running on non STP capable machine.\n"); 1429 pr_warning("The real or virtual hardware system does "
1430 "not provide an STP interface\n");
1360 free_bootmem((unsigned long) stp_page, PAGE_SIZE); 1431 free_bootmem((unsigned long) stp_page, PAGE_SIZE);
1361 stp_page = NULL; 1432 stp_page = NULL;
1362 stp_online = 0; 1433 stp_online = 0;
@@ -1365,8 +1436,12 @@ static void __init stp_reset(void)
1365 1436
1366static int __init stp_init(void) 1437static int __init stp_init(void)
1367{ 1438{
1368 if (test_bit(CLOCK_SYNC_HAS_STP, &clock_sync_flags) && stp_online) 1439 if (!test_bit(CLOCK_SYNC_HAS_STP, &clock_sync_flags))
1369 schedule_work(&stp_work); 1440 return 0;
1441 time_init_wq();
1442 if (!stp_online)
1443 return 0;
1444 queue_work(time_sync_wq, &stp_work);
1370 return 0; 1445 return 0;
1371} 1446}
1372 1447
@@ -1383,7 +1458,7 @@ arch_initcall(stp_init);
1383static void stp_timing_alert(struct stp_irq_parm *intparm) 1458static void stp_timing_alert(struct stp_irq_parm *intparm)
1384{ 1459{
1385 if (intparm->tsc || intparm->lac || intparm->tcpc) 1460 if (intparm->tsc || intparm->lac || intparm->tcpc)
1386 schedule_work(&stp_work); 1461 queue_work(time_sync_wq, &stp_work);
1387} 1462}
1388 1463
1389/* 1464/*
@@ -1397,7 +1472,7 @@ void stp_sync_check(void)
1397 if (!test_bit(CLOCK_SYNC_STP, &clock_sync_flags)) 1472 if (!test_bit(CLOCK_SYNC_STP, &clock_sync_flags))
1398 return; 1473 return;
1399 disable_sync_clock(NULL); 1474 disable_sync_clock(NULL);
1400 schedule_work(&stp_work); 1475 queue_work(time_sync_wq, &stp_work);
1401} 1476}
1402 1477
1403/* 1478/*
@@ -1411,46 +1486,34 @@ void stp_island_check(void)
1411 if (!test_bit(CLOCK_SYNC_STP, &clock_sync_flags)) 1486 if (!test_bit(CLOCK_SYNC_STP, &clock_sync_flags))
1412 return; 1487 return;
1413 disable_sync_clock(NULL); 1488 disable_sync_clock(NULL);
1414 schedule_work(&stp_work); 1489 queue_work(time_sync_wq, &stp_work);
1415} 1490}
1416 1491
1417/* 1492
1418 * STP tasklet. Check for the STP state and take over the clock 1493static int stp_sync_clock(void *data)
1419 * synchronization if the STP clock source is usable.
1420 */
1421static void stp_work_fn(struct work_struct *work)
1422{ 1494{
1423 struct clock_sync_data stp_sync; 1495 static int first;
1424 unsigned long long old_clock, delta; 1496 unsigned long long old_clock, delta;
1497 struct clock_sync_data *stp_sync;
1425 int rc; 1498 int rc;
1426 1499
1427 if (!stp_online) { 1500 stp_sync = data;
1428 chsc_sstpc(stp_page, STP_OP_CTRL, 0x0000);
1429 return;
1430 }
1431 1501
1432 rc = chsc_sstpc(stp_page, STP_OP_CTRL, 0xb0e0); 1502 if (xchg(&first, 1) == 1) {
1433 if (rc) 1503 /* Slave */
1434 return; 1504 clock_sync_cpu(stp_sync);
1505 return 0;
1506 }
1435 1507
1436 rc = chsc_sstpi(stp_page, &stp_info, sizeof(struct stp_sstpi)); 1508 /* Wait until all other cpus entered the sync function. */
1437 if (rc || stp_info.c == 0) 1509 while (atomic_read(&stp_sync->cpus) != 0)
1438 return; 1510 cpu_relax();
1439 1511
1440 /*
1441 * Catch all other cpus and make them wait until we have
1442 * successfully synced the clock. smp_call_function will
1443 * return after all other cpus are in clock_sync_cpu_start.
1444 */
1445 memset(&stp_sync, 0, sizeof(stp_sync));
1446 preempt_disable();
1447 smp_call_function(clock_sync_cpu_start, &stp_sync, 0);
1448 local_irq_disable();
1449 enable_sync_clock(); 1512 enable_sync_clock();
1450 1513
1451 set_bit(CLOCK_SYNC_STP, &clock_sync_flags); 1514 set_bit(CLOCK_SYNC_STP, &clock_sync_flags);
1452 if (test_and_clear_bit(CLOCK_SYNC_ETR, &clock_sync_flags)) 1515 if (test_and_clear_bit(CLOCK_SYNC_ETR, &clock_sync_flags))
1453 schedule_work(&etr_work); 1516 queue_work(time_sync_wq, &etr_work);
1454 1517
1455 rc = 0; 1518 rc = 0;
1456 if (stp_info.todoff[0] || stp_info.todoff[1] || 1519 if (stp_info.todoff[0] || stp_info.todoff[1] ||
@@ -1469,16 +1532,49 @@ static void stp_work_fn(struct work_struct *work)
1469 } 1532 }
1470 if (rc) { 1533 if (rc) {
1471 disable_sync_clock(NULL); 1534 disable_sync_clock(NULL);
1472 stp_sync.in_sync = -EAGAIN; 1535 stp_sync->in_sync = -EAGAIN;
1473 clear_bit(CLOCK_SYNC_STP, &clock_sync_flags); 1536 clear_bit(CLOCK_SYNC_STP, &clock_sync_flags);
1474 if (etr_port0_online || etr_port1_online) 1537 if (etr_port0_online || etr_port1_online)
1475 schedule_work(&etr_work); 1538 queue_work(time_sync_wq, &etr_work);
1476 } else 1539 } else
1477 stp_sync.in_sync = 1; 1540 stp_sync->in_sync = 1;
1541 xchg(&first, 0);
1542 return 0;
1543}
1544
1545/*
1546 * STP work. Check for the STP state and take over the clock
1547 * synchronization if the STP clock source is usable.
1548 */
1549static void stp_work_fn(struct work_struct *work)
1550{
1551 struct clock_sync_data stp_sync;
1552 int rc;
1553
1554 /* prevent multiple execution. */
1555 mutex_lock(&stp_work_mutex);
1556
1557 if (!stp_online) {
1558 chsc_sstpc(stp_page, STP_OP_CTRL, 0x0000);
1559 goto out_unlock;
1560 }
1561
1562 rc = chsc_sstpc(stp_page, STP_OP_CTRL, 0xb0e0);
1563 if (rc)
1564 goto out_unlock;
1565
1566 rc = chsc_sstpi(stp_page, &stp_info, sizeof(struct stp_sstpi));
1567 if (rc || stp_info.c == 0)
1568 goto out_unlock;
1569
1570 memset(&stp_sync, 0, sizeof(stp_sync));
1571 get_online_cpus();
1572 atomic_set(&stp_sync.cpus, num_online_cpus() - 1);
1573 stop_machine(stp_sync_clock, &stp_sync, &cpu_online_map);
1574 put_online_cpus();
1478 1575
1479 local_irq_enable(); 1576out_unlock:
1480 smp_call_function(clock_sync_cpu_end, NULL, 0); 1577 mutex_unlock(&stp_work_mutex);
1481 preempt_enable();
1482} 1578}
1483 1579
1484/* 1580/*
@@ -1587,7 +1683,7 @@ static ssize_t stp_online_store(struct sysdev_class *class,
1587 if (!test_bit(CLOCK_SYNC_HAS_STP, &clock_sync_flags)) 1683 if (!test_bit(CLOCK_SYNC_HAS_STP, &clock_sync_flags))
1588 return -EOPNOTSUPP; 1684 return -EOPNOTSUPP;
1589 stp_online = value; 1685 stp_online = value;
1590 schedule_work(&stp_work); 1686 queue_work(time_sync_wq, &stp_work);
1591 return count; 1687 return count;
1592} 1688}
1593 1689
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index a947899dcba1..cc362c9ea8f1 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -3,6 +3,9 @@
3 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com> 3 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
4 */ 4 */
5 5
6#define KMSG_COMPONENT "cpu"
7#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
8
6#include <linux/kernel.h> 9#include <linux/kernel.h>
7#include <linux/mm.h> 10#include <linux/mm.h>
8#include <linux/init.h> 11#include <linux/init.h>
@@ -12,6 +15,7 @@
12#include <linux/workqueue.h> 15#include <linux/workqueue.h>
13#include <linux/cpu.h> 16#include <linux/cpu.h>
14#include <linux/smp.h> 17#include <linux/smp.h>
18#include <linux/cpuset.h>
15#include <asm/delay.h> 19#include <asm/delay.h>
16#include <asm/s390_ext.h> 20#include <asm/s390_ext.h>
17#include <asm/sysinfo.h> 21#include <asm/sysinfo.h>
@@ -57,11 +61,11 @@ struct core_info {
57 cpumask_t mask; 61 cpumask_t mask;
58}; 62};
59 63
64static int topology_enabled;
60static void topology_work_fn(struct work_struct *work); 65static void topology_work_fn(struct work_struct *work);
61static struct tl_info *tl_info; 66static struct tl_info *tl_info;
62static struct core_info core_info; 67static struct core_info core_info;
63static int machine_has_topology; 68static int machine_has_topology;
64static int machine_has_topology_irq;
65static struct timer_list topology_timer; 69static struct timer_list topology_timer;
66static void set_topology_timer(void); 70static void set_topology_timer(void);
67static DECLARE_WORK(topology_work, topology_work_fn); 71static DECLARE_WORK(topology_work, topology_work_fn);
@@ -77,8 +81,8 @@ cpumask_t cpu_coregroup_map(unsigned int cpu)
77 cpumask_t mask; 81 cpumask_t mask;
78 82
79 cpus_clear(mask); 83 cpus_clear(mask);
80 if (!machine_has_topology) 84 if (!topology_enabled || !machine_has_topology)
81 return cpu_present_map; 85 return cpu_possible_map;
82 spin_lock_irqsave(&topology_lock, flags); 86 spin_lock_irqsave(&topology_lock, flags);
83 while (core) { 87 while (core) {
84 if (cpu_isset(cpu, core->mask)) { 88 if (cpu_isset(cpu, core->mask)) {
@@ -93,6 +97,11 @@ cpumask_t cpu_coregroup_map(unsigned int cpu)
93 return mask; 97 return mask;
94} 98}
95 99
100const struct cpumask *cpu_coregroup_mask(unsigned int cpu)
101{
102 return &cpu_core_map[cpu];
103}
104
96static void add_cpus_to_core(struct tl_cpu *tl_cpu, struct core_info *core) 105static void add_cpus_to_core(struct tl_cpu *tl_cpu, struct core_info *core)
97{ 106{
98 unsigned int cpu; 107 unsigned int cpu;
@@ -168,7 +177,7 @@ static void topology_update_polarization_simple(void)
168 int cpu; 177 int cpu;
169 178
170 mutex_lock(&smp_cpu_state_mutex); 179 mutex_lock(&smp_cpu_state_mutex);
171 for_each_present_cpu(cpu) 180 for_each_possible_cpu(cpu)
172 smp_cpu_polarization[cpu] = POLARIZATION_HRZ; 181 smp_cpu_polarization[cpu] = POLARIZATION_HRZ;
173 mutex_unlock(&smp_cpu_state_mutex); 182 mutex_unlock(&smp_cpu_state_mutex);
174} 183}
@@ -199,7 +208,7 @@ int topology_set_cpu_management(int fc)
199 rc = ptf(PTF_HORIZONTAL); 208 rc = ptf(PTF_HORIZONTAL);
200 if (rc) 209 if (rc)
201 return -EBUSY; 210 return -EBUSY;
202 for_each_present_cpu(cpu) 211 for_each_possible_cpu(cpu)
203 smp_cpu_polarization[cpu] = POLARIZATION_UNKNWN; 212 smp_cpu_polarization[cpu] = POLARIZATION_UNKNWN;
204 return rc; 213 return rc;
205} 214}
@@ -208,11 +217,11 @@ static void update_cpu_core_map(void)
208{ 217{
209 int cpu; 218 int cpu;
210 219
211 for_each_present_cpu(cpu) 220 for_each_possible_cpu(cpu)
212 cpu_core_map[cpu] = cpu_coregroup_map(cpu); 221 cpu_core_map[cpu] = cpu_coregroup_map(cpu);
213} 222}
214 223
215void arch_update_cpu_topology(void) 224int arch_update_cpu_topology(void)
216{ 225{
217 struct tl_info *info = tl_info; 226 struct tl_info *info = tl_info;
218 struct sys_device *sysdev; 227 struct sys_device *sysdev;
@@ -221,7 +230,7 @@ void arch_update_cpu_topology(void)
221 if (!machine_has_topology) { 230 if (!machine_has_topology) {
222 update_cpu_core_map(); 231 update_cpu_core_map();
223 topology_update_polarization_simple(); 232 topology_update_polarization_simple();
224 return; 233 return 0;
225 } 234 }
226 stsi(info, 15, 1, 2); 235 stsi(info, 15, 1, 2);
227 tl_to_cores(info); 236 tl_to_cores(info);
@@ -230,11 +239,12 @@ void arch_update_cpu_topology(void)
230 sysdev = get_cpu_sysdev(cpu); 239 sysdev = get_cpu_sysdev(cpu);
231 kobject_uevent(&sysdev->kobj, KOBJ_CHANGE); 240 kobject_uevent(&sysdev->kobj, KOBJ_CHANGE);
232 } 241 }
242 return 1;
233} 243}
234 244
235static void topology_work_fn(struct work_struct *work) 245static void topology_work_fn(struct work_struct *work)
236{ 246{
237 arch_reinit_sched_domains(); 247 rebuild_sched_domains();
238} 248}
239 249
240void topology_schedule_update(void) 250void topology_schedule_update(void)
@@ -257,10 +267,14 @@ static void set_topology_timer(void)
257 add_timer(&topology_timer); 267 add_timer(&topology_timer);
258} 268}
259 269
260static void topology_interrupt(__u16 code) 270static int __init early_parse_topology(char *p)
261{ 271{
262 schedule_work(&topology_work); 272 if (strncmp(p, "on", 2))
273 return 0;
274 topology_enabled = 1;
275 return 0;
263} 276}
277early_param("topology", early_parse_topology);
264 278
265static int __init init_topology_update(void) 279static int __init init_topology_update(void)
266{ 280{
@@ -272,14 +286,7 @@ static int __init init_topology_update(void)
272 goto out; 286 goto out;
273 } 287 }
274 init_timer_deferrable(&topology_timer); 288 init_timer_deferrable(&topology_timer);
275 if (machine_has_topology_irq) { 289 set_topology_timer();
276 rc = register_external_interrupt(0x2005, topology_interrupt);
277 if (rc)
278 goto out;
279 ctl_set_bit(0, 8);
280 }
281 else
282 set_topology_timer();
283out: 290out:
284 update_cpu_core_map(); 291 update_cpu_core_map();
285 return rc; 292 return rc;
@@ -300,9 +307,6 @@ void __init s390_init_cpu_topology(void)
300 return; 307 return;
301 machine_has_topology = 1; 308 machine_has_topology = 1;
302 309
303 if (facility_bits & (1ULL << 51))
304 machine_has_topology_irq = 1;
305
306 tl_info = alloc_bootmem_pages(PAGE_SIZE); 310 tl_info = alloc_bootmem_pages(PAGE_SIZE);
307 info = tl_info; 311 info = tl_info;
308 stsi(info, 15, 1, 2); 312 stsi(info, 15, 1, 2);
@@ -311,7 +315,7 @@ void __init s390_init_cpu_topology(void)
311 for (i = 0; i < info->mnest - 2; i++) 315 for (i = 0; i < info->mnest - 2; i++)
312 nr_cores *= info->mag[NR_MAG - 3 - i]; 316 nr_cores *= info->mag[NR_MAG - 3 - i];
313 317
314 printk(KERN_INFO "CPU topology:"); 318 pr_info("The CPU configuration topology of the machine is:");
315 for (i = 0; i < NR_MAG; i++) 319 for (i = 0; i < NR_MAG; i++)
316 printk(" %d", info->mag[i]); 320 printk(" %d", info->mag[i]);
317 printk(" / %d\n", info->mnest); 321 printk(" / %d\n", info->mnest);
@@ -326,5 +330,4 @@ void __init s390_init_cpu_topology(void)
326 return; 330 return;
327error: 331error:
328 machine_has_topology = 0; 332 machine_has_topology = 0;
329 machine_has_topology_irq = 0;
330} 333}
diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c
new file mode 100644
index 000000000000..25a6a82f1c02
--- /dev/null
+++ b/arch/s390/kernel/vdso.c
@@ -0,0 +1,351 @@
1/*
2 * vdso setup for s390
3 *
4 * Copyright IBM Corp. 2008
5 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License (version 2 only)
9 * as published by the Free Software Foundation.
10 */
11
12#include <linux/module.h>
13#include <linux/errno.h>
14#include <linux/sched.h>
15#include <linux/kernel.h>
16#include <linux/mm.h>
17#include <linux/smp.h>
18#include <linux/stddef.h>
19#include <linux/unistd.h>
20#include <linux/slab.h>
21#include <linux/user.h>
22#include <linux/elf.h>
23#include <linux/security.h>
24#include <linux/bootmem.h>
25
26#include <asm/pgtable.h>
27#include <asm/system.h>
28#include <asm/processor.h>
29#include <asm/mmu.h>
30#include <asm/mmu_context.h>
31#include <asm/sections.h>
32#include <asm/vdso.h>
33
34#if defined(CONFIG_32BIT) || defined(CONFIG_COMPAT)
35extern char vdso32_start, vdso32_end;
36static void *vdso32_kbase = &vdso32_start;
37static unsigned int vdso32_pages;
38static struct page **vdso32_pagelist;
39#endif
40
41#ifdef CONFIG_64BIT
42extern char vdso64_start, vdso64_end;
43static void *vdso64_kbase = &vdso64_start;
44static unsigned int vdso64_pages;
45static struct page **vdso64_pagelist;
46#endif /* CONFIG_64BIT */
47
48/*
49 * Should the kernel map a VDSO page into processes and pass its
50 * address down to glibc upon exec()?
51 */
52unsigned int __read_mostly vdso_enabled = 1;
53
54static int __init vdso_setup(char *s)
55{
56 vdso_enabled = simple_strtoul(s, NULL, 0);
57 return 1;
58}
59__setup("vdso=", vdso_setup);
60
61/*
62 * The vdso data page
63 */
64static union {
65 struct vdso_data data;
66 u8 page[PAGE_SIZE];
67} vdso_data_store __attribute__((__section__(".data.page_aligned")));
68struct vdso_data *vdso_data = &vdso_data_store.data;
69
70/*
71 * Setup vdso data page.
72 */
73static void vdso_init_data(struct vdso_data *vd)
74{
75 unsigned int facility_list;
76
77 facility_list = stfl();
78 vd->ectg_available = switch_amode && (facility_list & 1);
79}
80
81#ifdef CONFIG_64BIT
82/*
83 * Setup per cpu vdso data page.
84 */
85static void vdso_init_per_cpu_data(int cpu, struct vdso_per_cpu_data *vpcd)
86{
87}
88
89/*
90 * Allocate/free per cpu vdso data.
91 */
92#ifdef CONFIG_64BIT
93#define SEGMENT_ORDER 2
94#else
95#define SEGMENT_ORDER 1
96#endif
97
98int vdso_alloc_per_cpu(int cpu, struct _lowcore *lowcore)
99{
100 unsigned long segment_table, page_table, page_frame;
101 u32 *psal, *aste;
102 int i;
103
104 lowcore->vdso_per_cpu_data = __LC_PASTE;
105
106 if (!switch_amode || !vdso_enabled)
107 return 0;
108
109 segment_table = __get_free_pages(GFP_KERNEL, SEGMENT_ORDER);
110 page_table = get_zeroed_page(GFP_KERNEL | GFP_DMA);
111 page_frame = get_zeroed_page(GFP_KERNEL);
112 if (!segment_table || !page_table || !page_frame)
113 goto out;
114
115 clear_table((unsigned long *) segment_table, _SEGMENT_ENTRY_EMPTY,
116 PAGE_SIZE << SEGMENT_ORDER);
117 clear_table((unsigned long *) page_table, _PAGE_TYPE_EMPTY,
118 256*sizeof(unsigned long));
119
120 *(unsigned long *) segment_table = _SEGMENT_ENTRY + page_table;
121 *(unsigned long *) page_table = _PAGE_RO + page_frame;
122
123 psal = (u32 *) (page_table + 256*sizeof(unsigned long));
124 aste = psal + 32;
125
126 for (i = 4; i < 32; i += 4)
127 psal[i] = 0x80000000;
128
129 lowcore->paste[4] = (u32)(addr_t) psal;
130 psal[0] = 0x20000000;
131 psal[2] = (u32)(addr_t) aste;
132 *(unsigned long *) (aste + 2) = segment_table +
133 _ASCE_TABLE_LENGTH + _ASCE_USER_BITS + _ASCE_TYPE_SEGMENT;
134 aste[4] = (u32)(addr_t) psal;
135 lowcore->vdso_per_cpu_data = page_frame;
136
137 vdso_init_per_cpu_data(cpu, (struct vdso_per_cpu_data *) page_frame);
138 return 0;
139
140out:
141 free_page(page_frame);
142 free_page(page_table);
143 free_pages(segment_table, SEGMENT_ORDER);
144 return -ENOMEM;
145}
146
147#ifdef CONFIG_HOTPLUG_CPU
148void vdso_free_per_cpu(int cpu, struct _lowcore *lowcore)
149{
150 unsigned long segment_table, page_table, page_frame;
151 u32 *psal, *aste;
152
153 if (!switch_amode || !vdso_enabled)
154 return;
155
156 psal = (u32 *)(addr_t) lowcore->paste[4];
157 aste = (u32 *)(addr_t) psal[2];
158 segment_table = *(unsigned long *)(aste + 2) & PAGE_MASK;
159 page_table = *(unsigned long *) segment_table;
160 page_frame = *(unsigned long *) page_table;
161
162 free_page(page_frame);
163 free_page(page_table);
164 free_pages(segment_table, SEGMENT_ORDER);
165}
166#endif /* CONFIG_HOTPLUG_CPU */
167
168static void __vdso_init_cr5(void *dummy)
169{
170 unsigned long cr5;
171
172 cr5 = offsetof(struct _lowcore, paste);
173 __ctl_load(cr5, 5, 5);
174}
175
176static void vdso_init_cr5(void)
177{
178 if (switch_amode && vdso_enabled)
179 on_each_cpu(__vdso_init_cr5, NULL, 1);
180}
181#endif /* CONFIG_64BIT */
182
183/*
184 * This is called from binfmt_elf, we create the special vma for the
185 * vDSO and insert it into the mm struct tree
186 */
187int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
188{
189 struct mm_struct *mm = current->mm;
190 struct page **vdso_pagelist;
191 unsigned long vdso_pages;
192 unsigned long vdso_base;
193 int rc;
194
195 if (!vdso_enabled)
196 return 0;
197 /*
198 * Only map the vdso for dynamically linked elf binaries.
199 */
200 if (!uses_interp)
201 return 0;
202
203 vdso_base = mm->mmap_base;
204#ifdef CONFIG_64BIT
205 vdso_pagelist = vdso64_pagelist;
206 vdso_pages = vdso64_pages;
207#ifdef CONFIG_COMPAT
208 if (test_thread_flag(TIF_31BIT)) {
209 vdso_pagelist = vdso32_pagelist;
210 vdso_pages = vdso32_pages;
211 }
212#endif
213#else
214 vdso_pagelist = vdso32_pagelist;
215 vdso_pages = vdso32_pages;
216#endif
217
218 /*
219 * vDSO has a problem and was disabled, just don't "enable" it for
220 * the process
221 */
222 if (vdso_pages == 0)
223 return 0;
224
225 current->mm->context.vdso_base = 0;
226
227 /*
228 * pick a base address for the vDSO in process space. We try to put
229 * it at vdso_base which is the "natural" base for it, but we might
230 * fail and end up putting it elsewhere.
231 */
232 down_write(&mm->mmap_sem);
233 vdso_base = get_unmapped_area(NULL, vdso_base,
234 vdso_pages << PAGE_SHIFT, 0, 0);
235 if (IS_ERR_VALUE(vdso_base)) {
236 rc = vdso_base;
237 goto out_up;
238 }
239
240 /*
241 * our vma flags don't have VM_WRITE so by default, the process
242 * isn't allowed to write those pages.
243 * gdb can break that with ptrace interface, and thus trigger COW
244 * on those pages but it's then your responsibility to never do that
245 * on the "data" page of the vDSO or you'll stop getting kernel
246 * updates and your nice userland gettimeofday will be totally dead.
247 * It's fine to use that for setting breakpoints in the vDSO code
248 * pages though
249 *
250 * Make sure the vDSO gets into every core dump.
251 * Dumping its contents makes post-mortem fully interpretable later
252 * without matching up the same kernel and hardware config to see
253 * what PC values meant.
254 */
255 rc = install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT,
256 VM_READ|VM_EXEC|
257 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
258 VM_ALWAYSDUMP,
259 vdso_pagelist);
260 if (rc)
261 goto out_up;
262
263 /* Put vDSO base into mm struct */
264 current->mm->context.vdso_base = vdso_base;
265
266 up_write(&mm->mmap_sem);
267 return 0;
268
269out_up:
270 up_write(&mm->mmap_sem);
271 return rc;
272}
273
274const char *arch_vma_name(struct vm_area_struct *vma)
275{
276 if (vma->vm_mm && vma->vm_start == vma->vm_mm->context.vdso_base)
277 return "[vdso]";
278 return NULL;
279}
280
281static int __init vdso_init(void)
282{
283 int i;
284
285 if (!vdso_enabled)
286 return 0;
287 vdso_init_data(vdso_data);
288#if defined(CONFIG_32BIT) || defined(CONFIG_COMPAT)
289 /* Calculate the size of the 32 bit vDSO */
290 vdso32_pages = ((&vdso32_end - &vdso32_start
291 + PAGE_SIZE - 1) >> PAGE_SHIFT) + 1;
292
293 /* Make sure pages are in the correct state */
294 vdso32_pagelist = kzalloc(sizeof(struct page *) * (vdso32_pages + 1),
295 GFP_KERNEL);
296 BUG_ON(vdso32_pagelist == NULL);
297 for (i = 0; i < vdso32_pages - 1; i++) {
298 struct page *pg = virt_to_page(vdso32_kbase + i*PAGE_SIZE);
299 ClearPageReserved(pg);
300 get_page(pg);
301 vdso32_pagelist[i] = pg;
302 }
303 vdso32_pagelist[vdso32_pages - 1] = virt_to_page(vdso_data);
304 vdso32_pagelist[vdso32_pages] = NULL;
305#endif
306
307#ifdef CONFIG_64BIT
308 /* Calculate the size of the 64 bit vDSO */
309 vdso64_pages = ((&vdso64_end - &vdso64_start
310 + PAGE_SIZE - 1) >> PAGE_SHIFT) + 1;
311
312 /* Make sure pages are in the correct state */
313 vdso64_pagelist = kzalloc(sizeof(struct page *) * (vdso64_pages + 1),
314 GFP_KERNEL);
315 BUG_ON(vdso64_pagelist == NULL);
316 for (i = 0; i < vdso64_pages - 1; i++) {
317 struct page *pg = virt_to_page(vdso64_kbase + i*PAGE_SIZE);
318 ClearPageReserved(pg);
319 get_page(pg);
320 vdso64_pagelist[i] = pg;
321 }
322 vdso64_pagelist[vdso64_pages - 1] = virt_to_page(vdso_data);
323 vdso64_pagelist[vdso64_pages] = NULL;
324#ifndef CONFIG_SMP
325 BUG_ON(vdso_alloc_per_cpu(0, S390_lowcore));
326#endif
327 vdso_init_cr5();
328#endif /* CONFIG_64BIT */
329
330 get_page(virt_to_page(vdso_data));
331
332 smp_wmb();
333
334 return 0;
335}
336arch_initcall(vdso_init);
337
338int in_gate_area_no_task(unsigned long addr)
339{
340 return 0;
341}
342
343int in_gate_area(struct task_struct *task, unsigned long addr)
344{
345 return 0;
346}
347
348struct vm_area_struct *get_gate_vma(struct task_struct *tsk)
349{
350 return NULL;
351}
diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile
new file mode 100644
index 000000000000..ca78ad60ba24
--- /dev/null
+++ b/arch/s390/kernel/vdso32/Makefile
@@ -0,0 +1,55 @@
1# List of files in the vdso, has to be asm only for now
2
3obj-vdso32 = gettimeofday.o clock_getres.o clock_gettime.o note.o
4
5# Build rules
6
7targets := $(obj-vdso32) vdso32.so vdso32.so.dbg
8obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
9
10KBUILD_AFLAGS_31 := $(filter-out -m64,$(KBUILD_AFLAGS))
11KBUILD_AFLAGS_31 += -m31 -s
12
13KBUILD_CFLAGS_31 := $(filter-out -m64,$(KBUILD_CFLAGS))
14KBUILD_CFLAGS_31 += -m31 -fPIC -shared -fno-common -fno-builtin
15KBUILD_CFLAGS_31 += -nostdlib -Wl,-soname=linux-vdso32.so.1 \
16 $(call ld-option, -Wl$(comma)--hash-style=sysv)
17
18$(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_31)
19$(targets:%=$(obj)/%.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_31)
20
21obj-y += vdso32_wrapper.o
22extra-y += vdso32.lds
23CPPFLAGS_vdso32.lds += -P -C -U$(ARCH)
24
25# Force dependency (incbin is bad)
26$(obj)/vdso32_wrapper.o : $(obj)/vdso32.so
27
28# link rule for the .so file, .lds has to be first
29$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32)
30 $(call if_changed,vdso32ld)
31
32# strip rule for the .so file
33$(obj)/%.so: OBJCOPYFLAGS := -S
34$(obj)/%.so: $(obj)/%.so.dbg FORCE
35 $(call if_changed,objcopy)
36
37# assembly rules for the .S files
38$(obj-vdso32): %.o: %.S
39 $(call if_changed_dep,vdso32as)
40
41# actual build commands
42quiet_cmd_vdso32ld = VDSO32L $@
43 cmd_vdso32ld = $(CC) $(c_flags) -Wl,-T $^ -o $@
44quiet_cmd_vdso32as = VDSO32A $@
45 cmd_vdso32as = $(CC) $(a_flags) -c -o $@ $<
46
47# install commands for the unstripped file
48quiet_cmd_vdso_install = INSTALL $@
49 cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
50
51vdso32.so: $(obj)/vdso32.so.dbg
52 @mkdir -p $(MODLIB)/vdso
53 $(call cmd,vdso_install)
54
55vdso_install: vdso32.so
diff --git a/arch/s390/kernel/vdso32/clock_getres.S b/arch/s390/kernel/vdso32/clock_getres.S
new file mode 100644
index 000000000000..9532c4e6a9d2
--- /dev/null
+++ b/arch/s390/kernel/vdso32/clock_getres.S
@@ -0,0 +1,39 @@
1/*
2 * Userland implementation of clock_getres() for 32 bits processes in a
3 * s390 kernel for use in the vDSO
4 *
5 * Copyright IBM Corp. 2008
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License (version 2 only)
10 * as published by the Free Software Foundation.
11 */
12#include <asm/vdso.h>
13#include <asm/asm-offsets.h>
14#include <asm/unistd.h>
15
16 .text
17 .align 4
18 .globl __kernel_clock_getres
19 .type __kernel_clock_getres,@function
20__kernel_clock_getres:
21 .cfi_startproc
22 chi %r2,CLOCK_REALTIME
23 je 0f
24 chi %r2,CLOCK_MONOTONIC
25 jne 3f
260: ltr %r3,%r3
27 jz 2f /* res == NULL */
28 basr %r1,0
291: l %r0,4f-1b(%r1)
30 xc 0(4,%r3),0(%r3) /* set tp->tv_sec to zero */
31 st %r0,4(%r3) /* store tp->tv_usec */
322: lhi %r2,0
33 br %r14
343: lhi %r1,__NR_clock_getres /* fallback to svc */
35 svc 0
36 br %r14
374: .long CLOCK_REALTIME_RES
38 .cfi_endproc
39 .size __kernel_clock_getres,.-__kernel_clock_getres
diff --git a/arch/s390/kernel/vdso32/clock_gettime.S b/arch/s390/kernel/vdso32/clock_gettime.S
new file mode 100644
index 000000000000..4a98909a8310
--- /dev/null
+++ b/arch/s390/kernel/vdso32/clock_gettime.S
@@ -0,0 +1,128 @@
1/*
2 * Userland implementation of clock_gettime() for 32 bits processes in a
3 * s390 kernel for use in the vDSO
4 *
5 * Copyright IBM Corp. 2008
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License (version 2 only)
10 * as published by the Free Software Foundation.
11 */
12#include <asm/vdso.h>
13#include <asm/asm-offsets.h>
14#include <asm/unistd.h>
15
16 .text
17 .align 4
18 .globl __kernel_clock_gettime
19 .type __kernel_clock_gettime,@function
20__kernel_clock_gettime:
21 .cfi_startproc
22 basr %r5,0
230: al %r5,21f-0b(%r5) /* get &_vdso_data */
24 chi %r2,CLOCK_REALTIME
25 je 10f
26 chi %r2,CLOCK_MONOTONIC
27 jne 19f
28
29 /* CLOCK_MONOTONIC */
30 ltr %r3,%r3
31 jz 9f /* tp == NULL */
321: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */
33 tml %r4,0x0001 /* pending update ? loop */
34 jnz 1b
35 stck 24(%r15) /* Store TOD clock */
36 lm %r0,%r1,24(%r15)
37 s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
38 sl %r1,__VDSO_XTIME_STAMP+4(%r5)
39 brc 3,2f
40 ahi %r0,-1
412: mhi %r0,1000 /* cyc2ns(clock,cycle_delta) */
42 lr %r2,%r0
43 lhi %r0,1000
44 ltr %r1,%r1
45 mr %r0,%r0
46 jnm 3f
47 ahi %r0,1000
483: alr %r0,%r2
49 srdl %r0,12
50 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */
51 al %r1,__VDSO_XTIME_NSEC+4(%r5)
52 brc 12,4f
53 ahi %r0,1
544: l %r2,__VDSO_XTIME_SEC+4(%r5)
55 al %r0,__VDSO_WTOM_NSEC(%r5) /* + wall_to_monotonic */
56 al %r1,__VDSO_WTOM_NSEC+4(%r5)
57 brc 12,5f
58 ahi %r0,1
595: al %r2,__VDSO_WTOM_SEC+4(%r5)
60 cl %r4,__VDSO_UPD_COUNT+4(%r5) /* check update counter */
61 jne 1b
62 basr %r5,0
636: ltr %r0,%r0
64 jnz 7f
65 cl %r1,20f-6b(%r5)
66 jl 8f
677: ahi %r2,1
68 sl %r1,20f-6b(%r5)
69 brc 3,6b
70 ahi %r0,-1
71 j 6b
728: st %r2,0(%r3) /* store tp->tv_sec */
73 st %r1,4(%r3) /* store tp->tv_nsec */
749: lhi %r2,0
75 br %r14
76
77 /* CLOCK_REALTIME */
7810: ltr %r3,%r3 /* tp == NULL */
79 jz 18f
8011: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */
81 tml %r4,0x0001 /* pending update ? loop */
82 jnz 11b
83 stck 24(%r15) /* Store TOD clock */
84 lm %r0,%r1,24(%r15)
85 s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
86 sl %r1,__VDSO_XTIME_STAMP+4(%r5)
87 brc 3,12f
88 ahi %r0,-1
8912: mhi %r0,1000 /* cyc2ns(clock,cycle_delta) */
90 lr %r2,%r0
91 lhi %r0,1000
92 ltr %r1,%r1
93 mr %r0,%r0
94 jnm 13f
95 ahi %r0,1000
9613: alr %r0,%r2
97 srdl %r0,12
98 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */
99 al %r1,__VDSO_XTIME_NSEC+4(%r5)
100 brc 12,14f
101 ahi %r0,1
10214: l %r2,__VDSO_XTIME_SEC+4(%r5)
103 cl %r4,__VDSO_UPD_COUNT+4(%r5) /* check update counter */
104 jne 11b
105 basr %r5,0
10615: ltr %r0,%r0
107 jnz 16f
108 cl %r1,20f-15b(%r5)
109 jl 17f
11016: ahi %r2,1
111 sl %r1,20f-15b(%r5)
112 brc 3,15b
113 ahi %r0,-1
114 j 15b
11517: st %r2,0(%r3) /* store tp->tv_sec */
116 st %r1,4(%r3) /* store tp->tv_nsec */
11718: lhi %r2,0
118 br %r14
119
120 /* Fallback to system call */
12119: lhi %r1,__NR_clock_gettime
122 svc 0
123 br %r14
124
12520: .long 1000000000
12621: .long _vdso_data - 0b
127 .cfi_endproc
128 .size __kernel_clock_gettime,.-__kernel_clock_gettime
diff --git a/arch/s390/kernel/vdso32/gettimeofday.S b/arch/s390/kernel/vdso32/gettimeofday.S
new file mode 100644
index 000000000000..c32f29c3d70c
--- /dev/null
+++ b/arch/s390/kernel/vdso32/gettimeofday.S
@@ -0,0 +1,82 @@
1/*
2 * Userland implementation of gettimeofday() for 32 bits processes in a
3 * s390 kernel for use in the vDSO
4 *
5 * Copyright IBM Corp. 2008
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License (version 2 only)
10 * as published by the Free Software Foundation.
11 */
12#include <asm/vdso.h>
13#include <asm/asm-offsets.h>
14#include <asm/unistd.h>
15
16#include <asm/vdso.h>
17#include <asm/asm-offsets.h>
18#include <asm/unistd.h>
19
20 .text
21 .align 4
22 .globl __kernel_gettimeofday
23 .type __kernel_gettimeofday,@function
24__kernel_gettimeofday:
25 .cfi_startproc
26 basr %r5,0
270: al %r5,13f-0b(%r5) /* get &_vdso_data */
281: ltr %r3,%r3 /* check if tz is NULL */
29 je 2f
30 mvc 0(8,%r3),__VDSO_TIMEZONE(%r5)
312: ltr %r2,%r2 /* check if tv is NULL */
32 je 10f
33 l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */
34 tml %r4,0x0001 /* pending update ? loop */
35 jnz 1b
36 stck 24(%r15) /* Store TOD clock */
37 lm %r0,%r1,24(%r15)
38 s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
39 sl %r1,__VDSO_XTIME_STAMP+4(%r5)
40 brc 3,3f
41 ahi %r0,-1
423: mhi %r0,1000 /* cyc2ns(clock,cycle_delta) */
43 st %r0,24(%r15)
44 lhi %r0,1000
45 ltr %r1,%r1
46 mr %r0,%r0
47 jnm 4f
48 ahi %r0,1000
494: al %r0,24(%r15)
50 srdl %r0,12
51 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */
52 al %r1,__VDSO_XTIME_NSEC+4(%r5)
53 brc 12,5f
54 ahi %r0,1
555: mvc 24(4,%r15),__VDSO_XTIME_SEC+4(%r5)
56 cl %r4,__VDSO_UPD_COUNT+4(%r5) /* check update counter */
57 jne 1b
58 l %r4,24(%r15) /* get tv_sec from stack */
59 basr %r5,0
606: ltr %r0,%r0
61 jnz 7f
62 cl %r1,11f-6b(%r5)
63 jl 8f
647: ahi %r4,1
65 sl %r1,11f-6b(%r5)
66 brc 3,6b
67 ahi %r0,-1
68 j 6b
698: st %r4,0(%r2) /* store tv->tv_sec */
70 ltr %r1,%r1
71 m %r0,12f-6b(%r5)
72 jnm 9f
73 al %r0,12f-6b(%r5)
749: srl %r0,6
75 st %r0,4(%r2) /* store tv->tv_usec */
7610: slr %r2,%r2
77 br %r14
7811: .long 1000000000
7912: .long 274877907
8013: .long _vdso_data - 0b
81 .cfi_endproc
82 .size __kernel_gettimeofday,.-__kernel_gettimeofday
diff --git a/arch/s390/kernel/vdso32/note.S b/arch/s390/kernel/vdso32/note.S
new file mode 100644
index 000000000000..79a071e4357e
--- /dev/null
+++ b/arch/s390/kernel/vdso32/note.S
@@ -0,0 +1,12 @@
1/*
2 * This supplies .note.* sections to go into the PT_NOTE inside the vDSO text.
3 * Here we can supply some information useful to userland.
4 */
5
6#include <linux/uts.h>
7#include <linux/version.h>
8#include <linux/elfnote.h>
9
10ELFNOTE_START(Linux, 0, "a")
11 .long LINUX_VERSION_CODE
12ELFNOTE_END
diff --git a/arch/s390/kernel/vdso32/vdso32.lds.S b/arch/s390/kernel/vdso32/vdso32.lds.S
new file mode 100644
index 000000000000..a8c379fa1247
--- /dev/null
+++ b/arch/s390/kernel/vdso32/vdso32.lds.S
@@ -0,0 +1,138 @@
1/*
2 * This is the infamous ld script for the 32 bits vdso
3 * library
4 */
5#include <asm/vdso.h>
6
7OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390")
8OUTPUT_ARCH(s390:31-bit)
9ENTRY(_start)
10
11SECTIONS
12{
13 . = VDSO32_LBASE + SIZEOF_HEADERS;
14
15 .hash : { *(.hash) } :text
16 .gnu.hash : { *(.gnu.hash) }
17 .dynsym : { *(.dynsym) }
18 .dynstr : { *(.dynstr) }
19 .gnu.version : { *(.gnu.version) }
20 .gnu.version_d : { *(.gnu.version_d) }
21 .gnu.version_r : { *(.gnu.version_r) }
22
23 .note : { *(.note.*) } :text :note
24
25 . = ALIGN(16);
26 .text : {
27 *(.text .stub .text.* .gnu.linkonce.t.*)
28 } :text
29 PROVIDE(__etext = .);
30 PROVIDE(_etext = .);
31 PROVIDE(etext = .);
32
33 /*
34 * Other stuff is appended to the text segment:
35 */
36 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
37 .rodata1 : { *(.rodata1) }
38
39 .dynamic : { *(.dynamic) } :text :dynamic
40
41 .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
42 .eh_frame : { KEEP (*(.eh_frame)) } :text
43 .gcc_except_table : { *(.gcc_except_table .gcc_except_table.*) }
44
45 .rela.dyn ALIGN(8) : { *(.rela.dyn) }
46 .got ALIGN(8) : { *(.got .toc) }
47
48 _end = .;
49 PROVIDE(end = .);
50
51 /*
52 * Stabs debugging sections are here too.
53 */
54 .stab 0 : { *(.stab) }
55 .stabstr 0 : { *(.stabstr) }
56 .stab.excl 0 : { *(.stab.excl) }
57 .stab.exclstr 0 : { *(.stab.exclstr) }
58 .stab.index 0 : { *(.stab.index) }
59 .stab.indexstr 0 : { *(.stab.indexstr) }
60 .comment 0 : { *(.comment) }
61
62 /*
63 * DWARF debug sections.
64 * Symbols in the DWARF debugging sections are relative to the
65 * beginning of the section so we begin them at 0.
66 */
67 /* DWARF 1 */
68 .debug 0 : { *(.debug) }
69 .line 0 : { *(.line) }
70 /* GNU DWARF 1 extensions */
71 .debug_srcinfo 0 : { *(.debug_srcinfo) }
72 .debug_sfnames 0 : { *(.debug_sfnames) }
73 /* DWARF 1.1 and DWARF 2 */
74 .debug_aranges 0 : { *(.debug_aranges) }
75 .debug_pubnames 0 : { *(.debug_pubnames) }
76 /* DWARF 2 */
77 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
78 .debug_abbrev 0 : { *(.debug_abbrev) }
79 .debug_line 0 : { *(.debug_line) }
80 .debug_frame 0 : { *(.debug_frame) }
81 .debug_str 0 : { *(.debug_str) }
82 .debug_loc 0 : { *(.debug_loc) }
83 .debug_macinfo 0 : { *(.debug_macinfo) }
84 /* SGI/MIPS DWARF 2 extensions */
85 .debug_weaknames 0 : { *(.debug_weaknames) }
86 .debug_funcnames 0 : { *(.debug_funcnames) }
87 .debug_typenames 0 : { *(.debug_typenames) }
88 .debug_varnames 0 : { *(.debug_varnames) }
89 /* DWARF 3 */
90 .debug_pubtypes 0 : { *(.debug_pubtypes) }
91 .debug_ranges 0 : { *(.debug_ranges) }
92 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
93
94 . = ALIGN(4096);
95 PROVIDE(_vdso_data = .);
96
97 /DISCARD/ : {
98 *(.note.GNU-stack)
99 *(.branch_lt)
100 *(.data .data.* .gnu.linkonce.d.* .sdata*)
101 *(.bss .sbss .dynbss .dynsbss)
102 }
103}
104
105/*
106 * Very old versions of ld do not recognize this name token; use the constant.
107 */
108#define PT_GNU_EH_FRAME 0x6474e550
109
110/*
111 * We must supply the ELF program headers explicitly to get just one
112 * PT_LOAD segment, and set the flags explicitly to make segments read-only.
113 */
114PHDRS
115{
116 text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
117 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
118 note PT_NOTE FLAGS(4); /* PF_R */
119 eh_frame_hdr PT_GNU_EH_FRAME;
120}
121
122/*
123 * This controls what symbols we export from the DSO.
124 */
125VERSION
126{
127 VDSO_VERSION_STRING {
128 global:
129 /*
130 * Has to be there for the kernel to find
131 */
132 __kernel_gettimeofday;
133 __kernel_clock_gettime;
134 __kernel_clock_getres;
135
136 local: *;
137 };
138}
diff --git a/arch/s390/kernel/vdso32/vdso32_wrapper.S b/arch/s390/kernel/vdso32/vdso32_wrapper.S
new file mode 100644
index 000000000000..61639a89e70b
--- /dev/null
+++ b/arch/s390/kernel/vdso32/vdso32_wrapper.S
@@ -0,0 +1,13 @@
1#include <linux/init.h>
2#include <asm/page.h>
3
4 .section ".data.page_aligned"
5
6 .globl vdso32_start, vdso32_end
7 .balign PAGE_SIZE
8vdso32_start:
9 .incbin "arch/s390/kernel/vdso32/vdso32.so"
10 .balign PAGE_SIZE
11vdso32_end:
12
13 .previous
diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile
new file mode 100644
index 000000000000..6fc8e829258c
--- /dev/null
+++ b/arch/s390/kernel/vdso64/Makefile
@@ -0,0 +1,55 @@
1# List of files in the vdso, has to be asm only for now
2
3obj-vdso64 = gettimeofday.o clock_getres.o clock_gettime.o note.o
4
5# Build rules
6
7targets := $(obj-vdso64) vdso64.so vdso64.so.dbg
8obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
9
10KBUILD_AFLAGS_64 := $(filter-out -m64,$(KBUILD_AFLAGS))
11KBUILD_AFLAGS_64 += -m64 -s
12
13KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS))
14KBUILD_CFLAGS_64 += -m64 -fPIC -shared -fno-common -fno-builtin
15KBUILD_CFLAGS_64 += -nostdlib -Wl,-soname=linux-vdso64.so.1 \
16 $(call ld-option, -Wl$(comma)--hash-style=sysv)
17
18$(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_64)
19$(targets:%=$(obj)/%.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_64)
20
21obj-y += vdso64_wrapper.o
22extra-y += vdso64.lds
23CPPFLAGS_vdso64.lds += -P -C -U$(ARCH)
24
25# Force dependency (incbin is bad)
26$(obj)/vdso64_wrapper.o : $(obj)/vdso64.so
27
28# link rule for the .so file, .lds has to be first
29$(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64)
30 $(call if_changed,vdso64ld)
31
32# strip rule for the .so file
33$(obj)/%.so: OBJCOPYFLAGS := -S
34$(obj)/%.so: $(obj)/%.so.dbg FORCE
35 $(call if_changed,objcopy)
36
37# assembly rules for the .S files
38$(obj-vdso64): %.o: %.S
39 $(call if_changed_dep,vdso64as)
40
41# actual build commands
42quiet_cmd_vdso64ld = VDSO64L $@
43 cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $^ -o $@
44quiet_cmd_vdso64as = VDSO64A $@
45 cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $<
46
47# install commands for the unstripped file
48quiet_cmd_vdso_install = INSTALL $@
49 cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
50
51vdso64.so: $(obj)/vdso64.so.dbg
52 @mkdir -p $(MODLIB)/vdso
53 $(call cmd,vdso_install)
54
55vdso_install: vdso64.so
diff --git a/arch/s390/kernel/vdso64/clock_getres.S b/arch/s390/kernel/vdso64/clock_getres.S
new file mode 100644
index 000000000000..9ce8caafdb4e
--- /dev/null
+++ b/arch/s390/kernel/vdso64/clock_getres.S
@@ -0,0 +1,44 @@
1/*
2 * Userland implementation of clock_getres() for 64 bits processes in a
3 * s390 kernel for use in the vDSO
4 *
5 * Copyright IBM Corp. 2008
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License (version 2 only)
10 * as published by the Free Software Foundation.
11 */
12#include <asm/vdso.h>
13#include <asm/asm-offsets.h>
14#include <asm/unistd.h>
15
16 .text
17 .align 4
18 .globl __kernel_clock_getres
19 .type __kernel_clock_getres,@function
20__kernel_clock_getres:
21 .cfi_startproc
22 cghi %r2,CLOCK_REALTIME
23 je 0f
24 cghi %r2,CLOCK_MONOTONIC
25 je 0f
26 cghi %r2,-2 /* CLOCK_THREAD_CPUTIME_ID for this thread */
27 jne 2f
28 larl %r5,_vdso_data
29 icm %r0,15,__LC_ECTG_OK(%r5)
30 jz 2f
310: ltgr %r3,%r3
32 jz 1f /* res == NULL */
33 larl %r1,3f
34 lg %r0,0(%r1)
35 xc 0(8,%r3),0(%r3) /* set tp->tv_sec to zero */
36 stg %r0,8(%r3) /* store tp->tv_usec */
371: lghi %r2,0
38 br %r14
392: lghi %r1,__NR_clock_getres /* fallback to svc */
40 svc 0
41 br %r14
423: .quad CLOCK_REALTIME_RES
43 .cfi_endproc
44 .size __kernel_clock_getres,.-__kernel_clock_getres
diff --git a/arch/s390/kernel/vdso64/clock_gettime.S b/arch/s390/kernel/vdso64/clock_gettime.S
new file mode 100644
index 000000000000..79dbfee831ec
--- /dev/null
+++ b/arch/s390/kernel/vdso64/clock_gettime.S
@@ -0,0 +1,118 @@
1/*
2 * Userland implementation of clock_gettime() for 64 bits processes in a
3 * s390 kernel for use in the vDSO
4 *
5 * Copyright IBM Corp. 2008
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License (version 2 only)
10 * as published by the Free Software Foundation.
11 */
12#include <asm/vdso.h>
13#include <asm/asm-offsets.h>
14#include <asm/unistd.h>
15
16 .text
17 .align 4
18 .globl __kernel_clock_gettime
19 .type __kernel_clock_gettime,@function
20__kernel_clock_gettime:
21 .cfi_startproc
22 larl %r5,_vdso_data
23 cghi %r2,CLOCK_REALTIME
24 je 4f
25 cghi %r2,-2 /* CLOCK_THREAD_CPUTIME_ID for this thread */
26 je 9f
27 cghi %r2,CLOCK_MONOTONIC
28 jne 12f
29
30 /* CLOCK_MONOTONIC */
31 ltgr %r3,%r3
32 jz 3f /* tp == NULL */
330: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */
34 tmll %r4,0x0001 /* pending update ? loop */
35 jnz 0b
36 stck 48(%r15) /* Store TOD clock */
37 lg %r1,48(%r15)
38 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
39 mghi %r1,1000
40 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */
41 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime */
42 lg %r0,__VDSO_XTIME_SEC(%r5)
43 alg %r1,__VDSO_WTOM_NSEC(%r5) /* + wall_to_monotonic */
44 alg %r0,__VDSO_WTOM_SEC(%r5)
45 clg %r4,__VDSO_UPD_COUNT(%r5) /* check update counter */
46 jne 0b
47 larl %r5,13f
481: clg %r1,0(%r5)
49 jl 2f
50 slg %r1,0(%r5)
51 aghi %r0,1
52 j 1b
532: stg %r0,0(%r3) /* store tp->tv_sec */
54 stg %r1,8(%r3) /* store tp->tv_nsec */
553: lghi %r2,0
56 br %r14
57
58 /* CLOCK_REALTIME */
594: ltr %r3,%r3 /* tp == NULL */
60 jz 8f
615: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */
62 tmll %r4,0x0001 /* pending update ? loop */
63 jnz 5b
64 stck 48(%r15) /* Store TOD clock */
65 lg %r1,48(%r15)
66 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
67 mghi %r1,1000
68 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */
69 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime */
70 lg %r0,__VDSO_XTIME_SEC(%r5)
71 clg %r4,__VDSO_UPD_COUNT(%r5) /* check update counter */
72 jne 5b
73 larl %r5,13f
746: clg %r1,0(%r5)
75 jl 7f
76 slg %r1,0(%r5)
77 aghi %r0,1
78 j 6b
797: stg %r0,0(%r3) /* store tp->tv_sec */
80 stg %r1,8(%r3) /* store tp->tv_nsec */
818: lghi %r2,0
82 br %r14
83
84 /* CLOCK_THREAD_CPUTIME_ID for this thread */
859: icm %r0,15,__VDSO_ECTG_OK(%r5)
86 jz 12f
87 ear %r2,%a4
88 llilh %r4,0x0100
89 sar %a4,%r4
90 lghi %r4,0
91 sacf 512 /* Magic ectg instruction */
92 .insn ssf,0xc80100000000,__VDSO_ECTG_BASE(4),__VDSO_ECTG_USER(4),4
93 sacf 0
94 sar %a4,%r2
95 algr %r1,%r0 /* r1 = cputime as TOD value */
96 mghi %r1,1000 /* convert to nanoseconds */
97 srlg %r1,%r1,12 /* r1 = cputime in nanosec */
98 lgr %r4,%r1
99 larl %r5,13f
100 srlg %r1,%r1,9 /* divide by 1000000000 */
101 mlg %r0,8(%r5)
102 srlg %r0,%r0,11 /* r0 = tv_sec */
103 stg %r0,0(%r3)
104 msg %r0,0(%r5) /* calculate tv_nsec */
105 slgr %r4,%r0 /* r4 = tv_nsec */
106 stg %r4,8(%r3)
107 lghi %r2,0
108 br %r14
109
110 /* Fallback to system call */
11112: lghi %r1,__NR_clock_gettime
112 svc 0
113 br %r14
114
11513: .quad 1000000000
11614: .quad 19342813113834067
117 .cfi_endproc
118 .size __kernel_clock_gettime,.-__kernel_clock_gettime
diff --git a/arch/s390/kernel/vdso64/gettimeofday.S b/arch/s390/kernel/vdso64/gettimeofday.S
new file mode 100644
index 000000000000..f873e75634e1
--- /dev/null
+++ b/arch/s390/kernel/vdso64/gettimeofday.S
@@ -0,0 +1,56 @@
1/*
2 * Userland implementation of gettimeofday() for 64 bits processes in a
3 * s390 kernel for use in the vDSO
4 *
5 * Copyright IBM Corp. 2008
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License (version 2 only)
10 * as published by the Free Software Foundation.
11 */
12#include <asm/vdso.h>
13#include <asm/asm-offsets.h>
14#include <asm/unistd.h>
15
16 .text
17 .align 4
18 .globl __kernel_gettimeofday
19 .type __kernel_gettimeofday,@function
20__kernel_gettimeofday:
21 .cfi_startproc
22 larl %r5,_vdso_data
230: ltgr %r3,%r3 /* check if tz is NULL */
24 je 1f
25 mvc 0(8,%r3),__VDSO_TIMEZONE(%r5)
261: ltgr %r2,%r2 /* check if tv is NULL */
27 je 4f
28 lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */
29 tmll %r4,0x0001 /* pending update ? loop */
30 jnz 0b
31 stck 48(%r15) /* Store TOD clock */
32 lg %r1,48(%r15)
33 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
34 mghi %r1,1000
35 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */
36 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime.tv_nsec */
37 lg %r0,__VDSO_XTIME_SEC(%r5) /* xtime.tv_sec */
38 clg %r4,__VDSO_UPD_COUNT(%r5) /* check update counter */
39 jne 0b
40 larl %r5,5f
412: clg %r1,0(%r5)
42 jl 3f
43 slg %r1,0(%r5)
44 aghi %r0,1
45 j 2b
463: stg %r0,0(%r2) /* store tv->tv_sec */
47 slgr %r0,%r0 /* tv_nsec -> tv_usec */
48 ml %r0,8(%r5)
49 srlg %r0,%r0,6
50 stg %r0,8(%r2) /* store tv->tv_usec */
514: lghi %r2,0
52 br %r14
535: .quad 1000000000
54 .long 274877907
55 .cfi_endproc
56 .size __kernel_gettimeofday,.-__kernel_gettimeofday
diff --git a/arch/s390/kernel/vdso64/note.S b/arch/s390/kernel/vdso64/note.S
new file mode 100644
index 000000000000..79a071e4357e
--- /dev/null
+++ b/arch/s390/kernel/vdso64/note.S
@@ -0,0 +1,12 @@
1/*
2 * This supplies .note.* sections to go into the PT_NOTE inside the vDSO text.
3 * Here we can supply some information useful to userland.
4 */
5
6#include <linux/uts.h>
7#include <linux/version.h>
8#include <linux/elfnote.h>
9
10ELFNOTE_START(Linux, 0, "a")
11 .long LINUX_VERSION_CODE
12ELFNOTE_END
diff --git a/arch/s390/kernel/vdso64/vdso64.lds.S b/arch/s390/kernel/vdso64/vdso64.lds.S
new file mode 100644
index 000000000000..9f5979d102a9
--- /dev/null
+++ b/arch/s390/kernel/vdso64/vdso64.lds.S
@@ -0,0 +1,138 @@
1/*
2 * This is the infamous ld script for the 64 bits vdso
3 * library
4 */
5#include <asm/vdso.h>
6
7OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
8OUTPUT_ARCH(s390:64-bit)
9ENTRY(_start)
10
11SECTIONS
12{
13 . = VDSO64_LBASE + SIZEOF_HEADERS;
14
15 .hash : { *(.hash) } :text
16 .gnu.hash : { *(.gnu.hash) }
17 .dynsym : { *(.dynsym) }
18 .dynstr : { *(.dynstr) }
19 .gnu.version : { *(.gnu.version) }
20 .gnu.version_d : { *(.gnu.version_d) }
21 .gnu.version_r : { *(.gnu.version_r) }
22
23 .note : { *(.note.*) } :text :note
24
25 . = ALIGN(16);
26 .text : {
27 *(.text .stub .text.* .gnu.linkonce.t.*)
28 } :text
29 PROVIDE(__etext = .);
30 PROVIDE(_etext = .);
31 PROVIDE(etext = .);
32
33 /*
34 * Other stuff is appended to the text segment:
35 */
36 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
37 .rodata1 : { *(.rodata1) }
38
39 .dynamic : { *(.dynamic) } :text :dynamic
40
41 .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
42 .eh_frame : { KEEP (*(.eh_frame)) } :text
43 .gcc_except_table : { *(.gcc_except_table .gcc_except_table.*) }
44
45 .rela.dyn ALIGN(8) : { *(.rela.dyn) }
46 .got ALIGN(8) : { *(.got .toc) }
47
48 _end = .;
49 PROVIDE(end = .);
50
51 /*
52 * Stabs debugging sections are here too.
53 */
54 .stab 0 : { *(.stab) }
55 .stabstr 0 : { *(.stabstr) }
56 .stab.excl 0 : { *(.stab.excl) }
57 .stab.exclstr 0 : { *(.stab.exclstr) }
58 .stab.index 0 : { *(.stab.index) }
59 .stab.indexstr 0 : { *(.stab.indexstr) }
60 .comment 0 : { *(.comment) }
61
62 /*
63 * DWARF debug sections.
64 * Symbols in the DWARF debugging sections are relative to the
65 * beginning of the section so we begin them at 0.
66 */
67 /* DWARF 1 */
68 .debug 0 : { *(.debug) }
69 .line 0 : { *(.line) }
70 /* GNU DWARF 1 extensions */
71 .debug_srcinfo 0 : { *(.debug_srcinfo) }
72 .debug_sfnames 0 : { *(.debug_sfnames) }
73 /* DWARF 1.1 and DWARF 2 */
74 .debug_aranges 0 : { *(.debug_aranges) }
75 .debug_pubnames 0 : { *(.debug_pubnames) }
76 /* DWARF 2 */
77 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
78 .debug_abbrev 0 : { *(.debug_abbrev) }
79 .debug_line 0 : { *(.debug_line) }
80 .debug_frame 0 : { *(.debug_frame) }
81 .debug_str 0 : { *(.debug_str) }
82 .debug_loc 0 : { *(.debug_loc) }
83 .debug_macinfo 0 : { *(.debug_macinfo) }
84 /* SGI/MIPS DWARF 2 extensions */
85 .debug_weaknames 0 : { *(.debug_weaknames) }
86 .debug_funcnames 0 : { *(.debug_funcnames) }
87 .debug_typenames 0 : { *(.debug_typenames) }
88 .debug_varnames 0 : { *(.debug_varnames) }
89 /* DWARF 3 */
90 .debug_pubtypes 0 : { *(.debug_pubtypes) }
91 .debug_ranges 0 : { *(.debug_ranges) }
92 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
93
94 . = ALIGN(4096);
95 PROVIDE(_vdso_data = .);
96
97 /DISCARD/ : {
98 *(.note.GNU-stack)
99 *(.branch_lt)
100 *(.data .data.* .gnu.linkonce.d.* .sdata*)
101 *(.bss .sbss .dynbss .dynsbss)
102 }
103}
104
105/*
106 * Very old versions of ld do not recognize this name token; use the constant.
107 */
108#define PT_GNU_EH_FRAME 0x6474e550
109
110/*
111 * We must supply the ELF program headers explicitly to get just one
112 * PT_LOAD segment, and set the flags explicitly to make segments read-only.
113 */
114PHDRS
115{
116 text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
117 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
118 note PT_NOTE FLAGS(4); /* PF_R */
119 eh_frame_hdr PT_GNU_EH_FRAME;
120}
121
122/*
123 * This controls what symbols we export from the DSO.
124 */
125VERSION
126{
127 VDSO_VERSION_STRING {
128 global:
129 /*
130 * Has to be there for the kernel to find
131 */
132 __kernel_gettimeofday;
133 __kernel_clock_gettime;
134 __kernel_clock_getres;
135
136 local: *;
137 };
138}
diff --git a/arch/s390/kernel/vdso64/vdso64_wrapper.S b/arch/s390/kernel/vdso64/vdso64_wrapper.S
new file mode 100644
index 000000000000..d8e2ac14d564
--- /dev/null
+++ b/arch/s390/kernel/vdso64/vdso64_wrapper.S
@@ -0,0 +1,13 @@
1#include <linux/init.h>
2#include <asm/page.h>
3
4 .section ".data.page_aligned"
5
6 .globl vdso64_start, vdso64_end
7 .balign PAGE_SIZE
8vdso64_start:
9 .incbin "arch/s390/kernel/vdso64/vdso64.so"
10 .balign PAGE_SIZE
11vdso64_end:
12
13 .previous
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index 0fa5dc5d68e1..2fb36e462194 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -23,20 +23,43 @@
23#include <asm/s390_ext.h> 23#include <asm/s390_ext.h>
24#include <asm/timer.h> 24#include <asm/timer.h>
25#include <asm/irq_regs.h> 25#include <asm/irq_regs.h>
26#include <asm/cpu.h>
26 27
27static ext_int_info_t ext_int_info_timer; 28static ext_int_info_t ext_int_info_timer;
29
28static DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer); 30static DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer);
29 31
30#ifdef CONFIG_VIRT_CPU_ACCOUNTING 32DEFINE_PER_CPU(struct s390_idle_data, s390_idle) = {
33 .lock = __SPIN_LOCK_UNLOCKED(s390_idle.lock)
34};
35
36static inline __u64 get_vtimer(void)
37{
38 __u64 timer;
39
40 asm volatile("STPT %0" : "=m" (timer));
41 return timer;
42}
43
44static inline void set_vtimer(__u64 expires)
45{
46 __u64 timer;
47
48 asm volatile (" STPT %0\n" /* Store current cpu timer value */
49 " SPT %1" /* Set new value immediatly afterwards */
50 : "=m" (timer) : "m" (expires) );
51 S390_lowcore.system_timer += S390_lowcore.last_update_timer - timer;
52 S390_lowcore.last_update_timer = expires;
53}
54
31/* 55/*
32 * Update process times based on virtual cpu times stored by entry.S 56 * Update process times based on virtual cpu times stored by entry.S
33 * to the lowcore fields user_timer, system_timer & steal_clock. 57 * to the lowcore fields user_timer, system_timer & steal_clock.
34 */ 58 */
35void account_process_tick(struct task_struct *tsk, int user_tick) 59static void do_account_vtime(struct task_struct *tsk, int hardirq_offset)
36{ 60{
37 cputime_t cputime; 61 struct thread_info *ti = task_thread_info(tsk);
38 __u64 timer, clock; 62 __u64 timer, clock, user, system, steal;
39 int rcu_user_flag;
40 63
41 timer = S390_lowcore.last_update_timer; 64 timer = S390_lowcore.last_update_timer;
42 clock = S390_lowcore.last_update_clock; 65 clock = S390_lowcore.last_update_clock;
@@ -45,50 +68,41 @@ void account_process_tick(struct task_struct *tsk, int user_tick)
45 : "=m" (S390_lowcore.last_update_timer), 68 : "=m" (S390_lowcore.last_update_timer),
46 "=m" (S390_lowcore.last_update_clock) ); 69 "=m" (S390_lowcore.last_update_clock) );
47 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer; 70 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer;
48 S390_lowcore.steal_clock += S390_lowcore.last_update_clock - clock; 71 S390_lowcore.steal_timer += S390_lowcore.last_update_clock - clock;
49 72
50 cputime = S390_lowcore.user_timer >> 12; 73 user = S390_lowcore.user_timer - ti->user_timer;
51 rcu_user_flag = cputime != 0; 74 S390_lowcore.steal_timer -= user;
52 S390_lowcore.user_timer -= cputime << 12; 75 ti->user_timer = S390_lowcore.user_timer;
53 S390_lowcore.steal_clock -= cputime << 12; 76 account_user_time(tsk, user, user);
54 account_user_time(tsk, cputime); 77
55 78 system = S390_lowcore.system_timer - ti->system_timer;
56 cputime = S390_lowcore.system_timer >> 12; 79 S390_lowcore.steal_timer -= system;
57 S390_lowcore.system_timer -= cputime << 12; 80 ti->system_timer = S390_lowcore.system_timer;
58 S390_lowcore.steal_clock -= cputime << 12; 81 account_system_time(tsk, hardirq_offset, system, system);
59 account_system_time(tsk, HARDIRQ_OFFSET, cputime); 82
60 83 steal = S390_lowcore.steal_timer;
61 cputime = S390_lowcore.steal_clock; 84 if ((s64) steal > 0) {
62 if ((__s64) cputime > 0) { 85 S390_lowcore.steal_timer = 0;
63 cputime >>= 12; 86 account_steal_time(steal);
64 S390_lowcore.steal_clock -= cputime << 12;
65 account_steal_time(tsk, cputime);
66 } 87 }
67} 88}
68 89
69/* 90void account_vtime(struct task_struct *prev, struct task_struct *next)
70 * Update process times based on virtual cpu times stored by entry.S
71 * to the lowcore fields user_timer, system_timer & steal_clock.
72 */
73void account_vtime(struct task_struct *tsk)
74{ 91{
75 cputime_t cputime; 92 struct thread_info *ti;
76 __u64 timer; 93
77 94 do_account_vtime(prev, 0);
78 timer = S390_lowcore.last_update_timer; 95 ti = task_thread_info(prev);
79 asm volatile (" STPT %0" /* Store current cpu timer value */ 96 ti->user_timer = S390_lowcore.user_timer;
80 : "=m" (S390_lowcore.last_update_timer) ); 97 ti->system_timer = S390_lowcore.system_timer;
81 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer; 98 ti = task_thread_info(next);
82 99 S390_lowcore.user_timer = ti->user_timer;
83 cputime = S390_lowcore.user_timer >> 12; 100 S390_lowcore.system_timer = ti->system_timer;
84 S390_lowcore.user_timer -= cputime << 12; 101}
85 S390_lowcore.steal_clock -= cputime << 12;
86 account_user_time(tsk, cputime);
87 102
88 cputime = S390_lowcore.system_timer >> 12; 103void account_process_tick(struct task_struct *tsk, int user_tick)
89 S390_lowcore.system_timer -= cputime << 12; 104{
90 S390_lowcore.steal_clock -= cputime << 12; 105 do_account_vtime(tsk, HARDIRQ_OFFSET);
91 account_system_time(tsk, 0, cputime);
92} 106}
93 107
94/* 108/*
@@ -97,90 +111,131 @@ void account_vtime(struct task_struct *tsk)
97 */ 111 */
98void account_system_vtime(struct task_struct *tsk) 112void account_system_vtime(struct task_struct *tsk)
99{ 113{
100 cputime_t cputime; 114 struct thread_info *ti = task_thread_info(tsk);
101 __u64 timer; 115 __u64 timer, system;
102 116
103 timer = S390_lowcore.last_update_timer; 117 timer = S390_lowcore.last_update_timer;
104 asm volatile (" STPT %0" /* Store current cpu timer value */ 118 S390_lowcore.last_update_timer = get_vtimer();
105 : "=m" (S390_lowcore.last_update_timer) );
106 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer; 119 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer;
107 120
108 cputime = S390_lowcore.system_timer >> 12; 121 system = S390_lowcore.system_timer - ti->system_timer;
109 S390_lowcore.system_timer -= cputime << 12; 122 S390_lowcore.steal_timer -= system;
110 S390_lowcore.steal_clock -= cputime << 12; 123 ti->system_timer = S390_lowcore.system_timer;
111 account_system_time(tsk, 0, cputime); 124 account_system_time(tsk, 0, system, system);
112} 125}
113EXPORT_SYMBOL_GPL(account_system_vtime); 126EXPORT_SYMBOL_GPL(account_system_vtime);
114 127
115static inline void set_vtimer(__u64 expires) 128void vtime_start_cpu(void)
116{
117 __u64 timer;
118
119 asm volatile (" STPT %0\n" /* Store current cpu timer value */
120 " SPT %1" /* Set new value immediatly afterwards */
121 : "=m" (timer) : "m" (expires) );
122 S390_lowcore.system_timer += S390_lowcore.last_update_timer - timer;
123 S390_lowcore.last_update_timer = expires;
124
125 /* store expire time for this CPU timer */
126 __get_cpu_var(virt_cpu_timer).to_expire = expires;
127}
128#else
129static inline void set_vtimer(__u64 expires)
130{
131 S390_lowcore.last_update_timer = expires;
132 asm volatile ("SPT %0" : : "m" (S390_lowcore.last_update_timer));
133
134 /* store expire time for this CPU timer */
135 __get_cpu_var(virt_cpu_timer).to_expire = expires;
136}
137#endif
138
139void vtime_start_cpu_timer(void)
140{ 129{
141 struct vtimer_queue *vt_list; 130 struct s390_idle_data *idle = &__get_cpu_var(s390_idle);
142 131 struct vtimer_queue *vq = &__get_cpu_var(virt_cpu_timer);
143 vt_list = &__get_cpu_var(virt_cpu_timer); 132 __u64 idle_time, expires;
144 133
145 /* CPU timer interrupt is pending, don't reprogramm it */ 134 /* Account time spent with enabled wait psw loaded as idle time. */
146 if (vt_list->idle & 1LL<<63) 135 idle_time = S390_lowcore.int_clock - idle->idle_enter;
147 return; 136 account_idle_time(idle_time);
137 S390_lowcore.last_update_clock = S390_lowcore.int_clock;
138
139 /* Account system time spent going idle. */
140 S390_lowcore.system_timer += S390_lowcore.last_update_timer - vq->idle;
141 S390_lowcore.last_update_timer = S390_lowcore.async_enter_timer;
142
143 /* Restart vtime CPU timer */
144 if (vq->do_spt) {
145 /* Program old expire value but first save progress. */
146 expires = vq->idle - S390_lowcore.async_enter_timer;
147 expires += get_vtimer();
148 set_vtimer(expires);
149 } else {
150 /* Don't account the CPU timer delta while the cpu was idle. */
151 vq->elapsed -= vq->idle - S390_lowcore.async_enter_timer;
152 }
148 153
149 if (!list_empty(&vt_list->list)) 154 spin_lock(&idle->lock);
150 set_vtimer(vt_list->idle); 155 idle->idle_time += idle_time;
156 idle->idle_enter = 0ULL;
157 idle->idle_count++;
158 spin_unlock(&idle->lock);
151} 159}
152 160
153void vtime_stop_cpu_timer(void) 161void vtime_stop_cpu(void)
154{ 162{
155 struct vtimer_queue *vt_list; 163 struct s390_idle_data *idle = &__get_cpu_var(s390_idle);
156 164 struct vtimer_queue *vq = &__get_cpu_var(virt_cpu_timer);
157 vt_list = &__get_cpu_var(virt_cpu_timer); 165 psw_t psw;
158 166
159 /* nothing to do */ 167 /* Wait for external, I/O or machine check interrupt. */
160 if (list_empty(&vt_list->list)) { 168 psw.mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_IO | PSW_MASK_EXT;
161 vt_list->idle = VTIMER_MAX_SLICE; 169
162 goto fire; 170 /* Check if the CPU timer needs to be reprogrammed. */
171 if (vq->do_spt) {
172 __u64 vmax = VTIMER_MAX_SLICE;
173 /*
174 * The inline assembly is equivalent to
175 * vq->idle = get_cpu_timer();
176 * set_cpu_timer(VTIMER_MAX_SLICE);
177 * idle->idle_enter = get_clock();
178 * __load_psw_mask(psw_kernel_bits | PSW_MASK_WAIT |
179 * PSW_MASK_IO | PSW_MASK_EXT);
180 * The difference is that the inline assembly makes sure that
181 * the last three instruction are stpt, stck and lpsw in that
182 * order. This is done to increase the precision.
183 */
184 asm volatile(
185#ifndef CONFIG_64BIT
186 " basr 1,0\n"
187 "0: ahi 1,1f-0b\n"
188 " st 1,4(%2)\n"
189#else /* CONFIG_64BIT */
190 " larl 1,1f\n"
191 " stg 1,8(%2)\n"
192#endif /* CONFIG_64BIT */
193 " stpt 0(%4)\n"
194 " spt 0(%5)\n"
195 " stck 0(%3)\n"
196#ifndef CONFIG_64BIT
197 " lpsw 0(%2)\n"
198#else /* CONFIG_64BIT */
199 " lpswe 0(%2)\n"
200#endif /* CONFIG_64BIT */
201 "1:"
202 : "=m" (idle->idle_enter), "=m" (vq->idle)
203 : "a" (&psw), "a" (&idle->idle_enter),
204 "a" (&vq->idle), "a" (&vmax), "m" (vmax), "m" (psw)
205 : "memory", "cc", "1");
206 } else {
207 /*
208 * The inline assembly is equivalent to
209 * vq->idle = get_cpu_timer();
210 * idle->idle_enter = get_clock();
211 * __load_psw_mask(psw_kernel_bits | PSW_MASK_WAIT |
212 * PSW_MASK_IO | PSW_MASK_EXT);
213 * The difference is that the inline assembly makes sure that
214 * the last three instruction are stpt, stck and lpsw in that
215 * order. This is done to increase the precision.
216 */
217 asm volatile(
218#ifndef CONFIG_64BIT
219 " basr 1,0\n"
220 "0: ahi 1,1f-0b\n"
221 " st 1,4(%2)\n"
222#else /* CONFIG_64BIT */
223 " larl 1,1f\n"
224 " stg 1,8(%2)\n"
225#endif /* CONFIG_64BIT */
226 " stpt 0(%4)\n"
227 " stck 0(%3)\n"
228#ifndef CONFIG_64BIT
229 " lpsw 0(%2)\n"
230#else /* CONFIG_64BIT */
231 " lpswe 0(%2)\n"
232#endif /* CONFIG_64BIT */
233 "1:"
234 : "=m" (idle->idle_enter), "=m" (vq->idle)
235 : "a" (&psw), "a" (&idle->idle_enter),
236 "a" (&vq->idle), "m" (psw)
237 : "memory", "cc", "1");
163 } 238 }
164
165 /* store the actual expire value */
166 asm volatile ("STPT %0" : "=m" (vt_list->idle));
167
168 /*
169 * If the CPU timer is negative we don't reprogramm
170 * it because we will get instantly an interrupt.
171 */
172 if (vt_list->idle & 1LL<<63)
173 return;
174
175 vt_list->offset += vt_list->to_expire - vt_list->idle;
176
177 /*
178 * We cannot halt the CPU timer, we just write a value that
179 * nearly never expires (only after 71 years) and re-write
180 * the stored expire value if we continue the timer
181 */
182 fire:
183 set_vtimer(VTIMER_MAX_SLICE);
184} 239}
185 240
186/* 241/*
@@ -206,30 +261,23 @@ static void list_add_sorted(struct vtimer_list *timer, struct list_head *head)
206 */ 261 */
207static void do_callbacks(struct list_head *cb_list) 262static void do_callbacks(struct list_head *cb_list)
208{ 263{
209 struct vtimer_queue *vt_list; 264 struct vtimer_queue *vq;
210 struct vtimer_list *event, *tmp; 265 struct vtimer_list *event, *tmp;
211 void (*fn)(unsigned long);
212 unsigned long data;
213 266
214 if (list_empty(cb_list)) 267 if (list_empty(cb_list))
215 return; 268 return;
216 269
217 vt_list = &__get_cpu_var(virt_cpu_timer); 270 vq = &__get_cpu_var(virt_cpu_timer);
218 271
219 list_for_each_entry_safe(event, tmp, cb_list, entry) { 272 list_for_each_entry_safe(event, tmp, cb_list, entry) {
220 fn = event->function; 273 list_del_init(&event->entry);
221 data = event->data; 274 (event->function)(event->data);
222 fn(data); 275 if (event->interval) {
223 276 /* Recharge interval timer */
224 if (!event->interval) 277 event->expires = event->interval + vq->elapsed;
225 /* delete one shot timer */ 278 spin_lock(&vq->lock);
226 list_del_init(&event->entry); 279 list_add_sorted(event, &vq->list);
227 else { 280 spin_unlock(&vq->lock);
228 /* move interval timer back to list */
229 spin_lock(&vt_list->lock);
230 list_del_init(&event->entry);
231 list_add_sorted(event, &vt_list->list);
232 spin_unlock(&vt_list->lock);
233 } 281 }
234 } 282 }
235} 283}
@@ -239,64 +287,57 @@ static void do_callbacks(struct list_head *cb_list)
239 */ 287 */
240static void do_cpu_timer_interrupt(__u16 error_code) 288static void do_cpu_timer_interrupt(__u16 error_code)
241{ 289{
242 __u64 next, delta; 290 struct vtimer_queue *vq;
243 struct vtimer_queue *vt_list;
244 struct vtimer_list *event, *tmp; 291 struct vtimer_list *event, *tmp;
245 struct list_head *ptr; 292 struct list_head cb_list; /* the callback queue */
246 /* the callback queue */ 293 __u64 elapsed, next;
247 struct list_head cb_list;
248 294
249 INIT_LIST_HEAD(&cb_list); 295 INIT_LIST_HEAD(&cb_list);
250 vt_list = &__get_cpu_var(virt_cpu_timer); 296 vq = &__get_cpu_var(virt_cpu_timer);
251 297
252 /* walk timer list, fire all expired events */ 298 /* walk timer list, fire all expired events */
253 spin_lock(&vt_list->lock); 299 spin_lock(&vq->lock);
254 300
255 if (vt_list->to_expire < VTIMER_MAX_SLICE) 301 elapsed = vq->elapsed + (vq->timer - S390_lowcore.async_enter_timer);
256 vt_list->offset += vt_list->to_expire; 302 BUG_ON((s64) elapsed < 0);
257 303 vq->elapsed = 0;
258 list_for_each_entry_safe(event, tmp, &vt_list->list, entry) { 304 list_for_each_entry_safe(event, tmp, &vq->list, entry) {
259 if (event->expires > vt_list->offset) 305 if (event->expires < elapsed)
260 /* found first unexpired event, leave */ 306 /* move expired timer to the callback queue */
261 break; 307 list_move_tail(&event->entry, &cb_list);
262 308 else
263 /* re-charge interval timer, we have to add the offset */ 309 event->expires -= elapsed;
264 if (event->interval)
265 event->expires = event->interval + vt_list->offset;
266
267 /* move expired timer to the callback queue */
268 list_move_tail(&event->entry, &cb_list);
269 } 310 }
270 spin_unlock(&vt_list->lock); 311 spin_unlock(&vq->lock);
312
313 vq->do_spt = list_empty(&cb_list);
271 do_callbacks(&cb_list); 314 do_callbacks(&cb_list);
272 315
273 /* next event is first in list */ 316 /* next event is first in list */
274 spin_lock(&vt_list->lock); 317 next = VTIMER_MAX_SLICE;
275 if (!list_empty(&vt_list->list)) { 318 spin_lock(&vq->lock);
276 ptr = vt_list->list.next; 319 if (!list_empty(&vq->list)) {
277 event = list_entry(ptr, struct vtimer_list, entry); 320 event = list_first_entry(&vq->list, struct vtimer_list, entry);
278 next = event->expires - vt_list->offset; 321 next = event->expires;
279 322 } else
280 /* add the expired time from this interrupt handler 323 vq->do_spt = 0;
281 * and the callback functions 324 spin_unlock(&vq->lock);
282 */ 325 /*
283 asm volatile ("STPT %0" : "=m" (delta)); 326 * To improve precision add the time spent by the
284 delta = 0xffffffffffffffffLL - delta + 1; 327 * interrupt handler to the elapsed time.
285 vt_list->offset += delta; 328 * Note: CPU timer counts down and we got an interrupt,
286 next -= delta; 329 * the current content is negative
287 } else { 330 */
288 vt_list->offset = 0; 331 elapsed = S390_lowcore.async_enter_timer - get_vtimer();
289 next = VTIMER_MAX_SLICE; 332 set_vtimer(next - elapsed);
290 } 333 vq->timer = next - elapsed;
291 spin_unlock(&vt_list->lock); 334 vq->elapsed = elapsed;
292 set_vtimer(next);
293} 335}
294 336
295void init_virt_timer(struct vtimer_list *timer) 337void init_virt_timer(struct vtimer_list *timer)
296{ 338{
297 timer->function = NULL; 339 timer->function = NULL;
298 INIT_LIST_HEAD(&timer->entry); 340 INIT_LIST_HEAD(&timer->entry);
299 spin_lock_init(&timer->lock);
300} 341}
301EXPORT_SYMBOL(init_virt_timer); 342EXPORT_SYMBOL(init_virt_timer);
302 343
@@ -310,44 +351,40 @@ static inline int vtimer_pending(struct vtimer_list *timer)
310 */ 351 */
311static void internal_add_vtimer(struct vtimer_list *timer) 352static void internal_add_vtimer(struct vtimer_list *timer)
312{ 353{
354 struct vtimer_queue *vq;
313 unsigned long flags; 355 unsigned long flags;
314 __u64 done; 356 __u64 left, expires;
315 struct vtimer_list *event;
316 struct vtimer_queue *vt_list;
317 357
318 vt_list = &per_cpu(virt_cpu_timer, timer->cpu); 358 vq = &per_cpu(virt_cpu_timer, timer->cpu);
319 spin_lock_irqsave(&vt_list->lock, flags); 359 spin_lock_irqsave(&vq->lock, flags);
320 360
321 BUG_ON(timer->cpu != smp_processor_id()); 361 BUG_ON(timer->cpu != smp_processor_id());
322 362
323 /* if list is empty we only have to set the timer */ 363 if (list_empty(&vq->list)) {
324 if (list_empty(&vt_list->list)) { 364 /* First timer on this cpu, just program it. */
325 /* reset the offset, this may happen if the last timer was 365 list_add(&timer->entry, &vq->list);
326 * just deleted by mod_virt_timer and the interrupt 366 set_vtimer(timer->expires);
327 * didn't happen until here 367 vq->timer = timer->expires;
328 */ 368 vq->elapsed = 0;
329 vt_list->offset = 0; 369 } else {
330 goto fire; 370 /* Check progress of old timers. */
371 expires = timer->expires;
372 left = get_vtimer();
373 if (likely((s64) expires < (s64) left)) {
374 /* The new timer expires before the current timer. */
375 set_vtimer(expires);
376 vq->elapsed += vq->timer - left;
377 vq->timer = expires;
378 } else {
379 vq->elapsed += vq->timer - left;
380 vq->timer = left;
381 }
382 /* Insert new timer into per cpu list. */
383 timer->expires += vq->elapsed;
384 list_add_sorted(timer, &vq->list);
331 } 385 }
332 386
333 /* save progress */ 387 spin_unlock_irqrestore(&vq->lock, flags);
334 asm volatile ("STPT %0" : "=m" (done));
335
336 /* calculate completed work */
337 done = vt_list->to_expire - done + vt_list->offset;
338 vt_list->offset = 0;
339
340 list_for_each_entry(event, &vt_list->list, entry)
341 event->expires -= done;
342
343 fire:
344 list_add_sorted(timer, &vt_list->list);
345
346 /* get first element, which is the next vtimer slice */
347 event = list_entry(vt_list->list.next, struct vtimer_list, entry);
348
349 set_vtimer(event->expires);
350 spin_unlock_irqrestore(&vt_list->lock, flags);
351 /* release CPU acquired in prepare_vtimer or mod_virt_timer() */ 388 /* release CPU acquired in prepare_vtimer or mod_virt_timer() */
352 put_cpu(); 389 put_cpu();
353} 390}
@@ -392,14 +429,15 @@ EXPORT_SYMBOL(add_virt_timer_periodic);
392 * If we change a pending timer the function must be called on the CPU 429 * If we change a pending timer the function must be called on the CPU
393 * where the timer is running on, e.g. by smp_call_function_single() 430 * where the timer is running on, e.g. by smp_call_function_single()
394 * 431 *
395 * The original mod_timer adds the timer if it is not pending. For compatibility 432 * The original mod_timer adds the timer if it is not pending. For
396 * we do the same. The timer will be added on the current CPU as a oneshot timer. 433 * compatibility we do the same. The timer will be added on the current
434 * CPU as a oneshot timer.
397 * 435 *
398 * returns whether it has modified a pending timer (1) or not (0) 436 * returns whether it has modified a pending timer (1) or not (0)
399 */ 437 */
400int mod_virt_timer(struct vtimer_list *timer, __u64 expires) 438int mod_virt_timer(struct vtimer_list *timer, __u64 expires)
401{ 439{
402 struct vtimer_queue *vt_list; 440 struct vtimer_queue *vq;
403 unsigned long flags; 441 unsigned long flags;
404 int cpu; 442 int cpu;
405 443
@@ -415,17 +453,17 @@ int mod_virt_timer(struct vtimer_list *timer, __u64 expires)
415 return 1; 453 return 1;
416 454
417 cpu = get_cpu(); 455 cpu = get_cpu();
418 vt_list = &per_cpu(virt_cpu_timer, cpu); 456 vq = &per_cpu(virt_cpu_timer, cpu);
419 457
420 /* check if we run on the right CPU */ 458 /* check if we run on the right CPU */
421 BUG_ON(timer->cpu != cpu); 459 BUG_ON(timer->cpu != cpu);
422 460
423 /* disable interrupts before test if timer is pending */ 461 /* disable interrupts before test if timer is pending */
424 spin_lock_irqsave(&vt_list->lock, flags); 462 spin_lock_irqsave(&vq->lock, flags);
425 463
426 /* if timer isn't pending add it on the current CPU */ 464 /* if timer isn't pending add it on the current CPU */
427 if (!vtimer_pending(timer)) { 465 if (!vtimer_pending(timer)) {
428 spin_unlock_irqrestore(&vt_list->lock, flags); 466 spin_unlock_irqrestore(&vq->lock, flags);
429 /* we do not activate an interval timer with mod_virt_timer */ 467 /* we do not activate an interval timer with mod_virt_timer */
430 timer->interval = 0; 468 timer->interval = 0;
431 timer->expires = expires; 469 timer->expires = expires;
@@ -442,7 +480,7 @@ int mod_virt_timer(struct vtimer_list *timer, __u64 expires)
442 timer->interval = expires; 480 timer->interval = expires;
443 481
444 /* the timer can't expire anymore so we can release the lock */ 482 /* the timer can't expire anymore so we can release the lock */
445 spin_unlock_irqrestore(&vt_list->lock, flags); 483 spin_unlock_irqrestore(&vq->lock, flags);
446 internal_add_vtimer(timer); 484 internal_add_vtimer(timer);
447 return 1; 485 return 1;
448} 486}
@@ -456,25 +494,19 @@ EXPORT_SYMBOL(mod_virt_timer);
456int del_virt_timer(struct vtimer_list *timer) 494int del_virt_timer(struct vtimer_list *timer)
457{ 495{
458 unsigned long flags; 496 unsigned long flags;
459 struct vtimer_queue *vt_list; 497 struct vtimer_queue *vq;
460 498
461 /* check if timer is pending */ 499 /* check if timer is pending */
462 if (!vtimer_pending(timer)) 500 if (!vtimer_pending(timer))
463 return 0; 501 return 0;
464 502
465 vt_list = &per_cpu(virt_cpu_timer, timer->cpu); 503 vq = &per_cpu(virt_cpu_timer, timer->cpu);
466 spin_lock_irqsave(&vt_list->lock, flags); 504 spin_lock_irqsave(&vq->lock, flags);
467 505
468 /* we don't interrupt a running timer, just let it expire! */ 506 /* we don't interrupt a running timer, just let it expire! */
469 list_del_init(&timer->entry); 507 list_del_init(&timer->entry);
470 508
471 /* last timer removed */ 509 spin_unlock_irqrestore(&vq->lock, flags);
472 if (list_empty(&vt_list->list)) {
473 vt_list->to_expire = 0;
474 vt_list->offset = 0;
475 }
476
477 spin_unlock_irqrestore(&vt_list->lock, flags);
478 return 1; 510 return 1;
479} 511}
480EXPORT_SYMBOL(del_virt_timer); 512EXPORT_SYMBOL(del_virt_timer);
@@ -484,24 +516,19 @@ EXPORT_SYMBOL(del_virt_timer);
484 */ 516 */
485void init_cpu_vtimer(void) 517void init_cpu_vtimer(void)
486{ 518{
487 struct vtimer_queue *vt_list; 519 struct vtimer_queue *vq;
488 520
489 /* kick the virtual timer */ 521 /* kick the virtual timer */
490 S390_lowcore.exit_timer = VTIMER_MAX_SLICE;
491 S390_lowcore.last_update_timer = VTIMER_MAX_SLICE;
492 asm volatile ("SPT %0" : : "m" (S390_lowcore.last_update_timer));
493 asm volatile ("STCK %0" : "=m" (S390_lowcore.last_update_clock)); 522 asm volatile ("STCK %0" : "=m" (S390_lowcore.last_update_clock));
523 asm volatile ("STPT %0" : "=m" (S390_lowcore.last_update_timer));
524
525 /* initialize per cpu vtimer structure */
526 vq = &__get_cpu_var(virt_cpu_timer);
527 INIT_LIST_HEAD(&vq->list);
528 spin_lock_init(&vq->lock);
494 529
495 /* enable cpu timer interrupts */ 530 /* enable cpu timer interrupts */
496 __ctl_set_bit(0,10); 531 __ctl_set_bit(0,10);
497
498 vt_list = &__get_cpu_var(virt_cpu_timer);
499 INIT_LIST_HEAD(&vt_list->list);
500 spin_lock_init(&vt_list->lock);
501 vt_list->to_expire = 0;
502 vt_list->offset = 0;
503 vt_list->idle = 0;
504
505} 532}
506 533
507void __init vtime_init(void) 534void __init vtime_init(void)
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 8b00eb2ddf57..be8497186b96 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -113,8 +113,6 @@ long kvm_arch_dev_ioctl(struct file *filp,
113int kvm_dev_ioctl_check_extension(long ext) 113int kvm_dev_ioctl_check_extension(long ext)
114{ 114{
115 switch (ext) { 115 switch (ext) {
116 case KVM_CAP_USER_MEMORY:
117 return 1;
118 default: 116 default:
119 return 0; 117 return 0;
120 } 118 }
@@ -185,8 +183,6 @@ struct kvm *kvm_arch_create_vm(void)
185 debug_register_view(kvm->arch.dbf, &debug_sprintf_view); 183 debug_register_view(kvm->arch.dbf, &debug_sprintf_view);
186 VM_EVENT(kvm, 3, "%s", "vm created"); 184 VM_EVENT(kvm, 3, "%s", "vm created");
187 185
188 try_module_get(THIS_MODULE);
189
190 return kvm; 186 return kvm;
191out_nodbf: 187out_nodbf:
192 free_page((unsigned long)(kvm->arch.sca)); 188 free_page((unsigned long)(kvm->arch.sca));
@@ -196,13 +192,33 @@ out_nokvm:
196 return ERR_PTR(rc); 192 return ERR_PTR(rc);
197} 193}
198 194
195void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
196{
197 VCPU_EVENT(vcpu, 3, "%s", "free cpu");
198 free_page((unsigned long)(vcpu->arch.sie_block));
199 kvm_vcpu_uninit(vcpu);
200 kfree(vcpu);
201}
202
203static void kvm_free_vcpus(struct kvm *kvm)
204{
205 unsigned int i;
206
207 for (i = 0; i < KVM_MAX_VCPUS; ++i) {
208 if (kvm->vcpus[i]) {
209 kvm_arch_vcpu_destroy(kvm->vcpus[i]);
210 kvm->vcpus[i] = NULL;
211 }
212 }
213}
214
199void kvm_arch_destroy_vm(struct kvm *kvm) 215void kvm_arch_destroy_vm(struct kvm *kvm)
200{ 216{
201 debug_unregister(kvm->arch.dbf); 217 kvm_free_vcpus(kvm);
202 kvm_free_physmem(kvm); 218 kvm_free_physmem(kvm);
203 free_page((unsigned long)(kvm->arch.sca)); 219 free_page((unsigned long)(kvm->arch.sca));
220 debug_unregister(kvm->arch.dbf);
204 kfree(kvm); 221 kfree(kvm);
205 module_put(THIS_MODULE);
206} 222}
207 223
208/* Section: vcpu related */ 224/* Section: vcpu related */
@@ -213,8 +229,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
213 229
214void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) 230void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
215{ 231{
216 /* kvm common code refers to this, but does'nt call it */ 232 /* Nothing todo */
217 BUG();
218} 233}
219 234
220void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 235void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
@@ -308,8 +323,6 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
308 VM_EVENT(kvm, 3, "create cpu %d at %p, sie block at %p", id, vcpu, 323 VM_EVENT(kvm, 3, "create cpu %d at %p, sie block at %p", id, vcpu,
309 vcpu->arch.sie_block); 324 vcpu->arch.sie_block);
310 325
311 try_module_get(THIS_MODULE);
312
313 return vcpu; 326 return vcpu;
314out_free_cpu: 327out_free_cpu:
315 kfree(vcpu); 328 kfree(vcpu);
@@ -317,14 +330,6 @@ out_nomem:
317 return ERR_PTR(rc); 330 return ERR_PTR(rc);
318} 331}
319 332
320void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
321{
322 VCPU_EVENT(vcpu, 3, "%s", "destroy cpu");
323 free_page((unsigned long)(vcpu->arch.sie_block));
324 kfree(vcpu);
325 module_put(THIS_MODULE);
326}
327
328int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) 333int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
329{ 334{
330 /* kvm common code refers to this, but never calls it */ 335 /* kvm common code refers to this, but never calls it */
diff --git a/arch/s390/mm/extmem.c b/arch/s390/mm/extmem.c
index 580fc64cc735..5c8457129603 100644
--- a/arch/s390/mm/extmem.c
+++ b/arch/s390/mm/extmem.c
@@ -7,6 +7,9 @@
7 * (C) IBM Corporation 2002-2004 7 * (C) IBM Corporation 2002-2004
8 */ 8 */
9 9
10#define KMSG_COMPONENT "extmem"
11#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
12
10#include <linux/kernel.h> 13#include <linux/kernel.h>
11#include <linux/string.h> 14#include <linux/string.h>
12#include <linux/spinlock.h> 15#include <linux/spinlock.h>
@@ -24,19 +27,6 @@
24#include <asm/cpcmd.h> 27#include <asm/cpcmd.h>
25#include <asm/setup.h> 28#include <asm/setup.h>
26 29
27#define DCSS_DEBUG /* Debug messages on/off */
28
29#define DCSS_NAME "extmem"
30#ifdef DCSS_DEBUG
31#define PRINT_DEBUG(x...) printk(KERN_DEBUG DCSS_NAME " debug:" x)
32#else
33#define PRINT_DEBUG(x...) do {} while (0)
34#endif
35#define PRINT_INFO(x...) printk(KERN_INFO DCSS_NAME " info:" x)
36#define PRINT_WARN(x...) printk(KERN_WARNING DCSS_NAME " warning:" x)
37#define PRINT_ERR(x...) printk(KERN_ERR DCSS_NAME " error:" x)
38
39
40#define DCSS_LOADSHR 0x00 30#define DCSS_LOADSHR 0x00
41#define DCSS_LOADNSR 0x04 31#define DCSS_LOADNSR 0x04
42#define DCSS_PURGESEG 0x08 32#define DCSS_PURGESEG 0x08
@@ -286,7 +276,7 @@ query_segment_type (struct dcss_segment *seg)
286 goto out_free; 276 goto out_free;
287 } 277 }
288 if (diag_cc > 1) { 278 if (diag_cc > 1) {
289 PRINT_WARN ("segment_type: diag returned error %ld\n", vmrc); 279 pr_warning("Querying a DCSS type failed with rc=%ld\n", vmrc);
290 rc = dcss_diag_translate_rc (vmrc); 280 rc = dcss_diag_translate_rc (vmrc);
291 goto out_free; 281 goto out_free;
292 } 282 }
@@ -368,7 +358,6 @@ query_segment_type (struct dcss_segment *seg)
368 * -EIO : could not perform query diagnose 358 * -EIO : could not perform query diagnose
369 * -ENOENT : no such segment 359 * -ENOENT : no such segment
370 * -ENOTSUPP: multi-part segment cannot be used with linux 360 * -ENOTSUPP: multi-part segment cannot be used with linux
371 * -ENOSPC : segment cannot be used (overlaps with storage)
372 * -ENOMEM : out of memory 361 * -ENOMEM : out of memory
373 * 0 .. 6 : type of segment as defined in include/asm-s390/extmem.h 362 * 0 .. 6 : type of segment as defined in include/asm-s390/extmem.h
374 */ 363 */
@@ -480,9 +469,8 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
480 goto out_resource; 469 goto out_resource;
481 } 470 }
482 if (diag_cc > 1) { 471 if (diag_cc > 1) {
483 PRINT_WARN ("segment_load: could not load segment %s - " 472 pr_warning("Loading DCSS %s failed with rc=%ld\n", name,
484 "diag returned error (%ld)\n", 473 end_addr);
485 name, end_addr);
486 rc = dcss_diag_translate_rc(end_addr); 474 rc = dcss_diag_translate_rc(end_addr);
487 dcss_diag(&purgeseg_scode, seg->dcss_name, 475 dcss_diag(&purgeseg_scode, seg->dcss_name,
488 &dummy, &dummy); 476 &dummy, &dummy);
@@ -496,15 +484,13 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
496 *addr = seg->start_addr; 484 *addr = seg->start_addr;
497 *end = seg->end; 485 *end = seg->end;
498 if (do_nonshared) 486 if (do_nonshared)
499 PRINT_INFO ("segment_load: loaded segment %s range %p .. %p " 487 pr_info("DCSS %s of range %p to %p and type %s loaded as "
500 "type %s in non-shared mode\n", name, 488 "exclusive-writable\n", name, (void*) seg->start_addr,
501 (void*)seg->start_addr, (void*)seg->end, 489 (void*) seg->end, segtype_string[seg->vm_segtype]);
502 segtype_string[seg->vm_segtype]);
503 else { 490 else {
504 PRINT_INFO ("segment_load: loaded segment %s range %p .. %p " 491 pr_info("DCSS %s of range %p to %p and type %s loaded in "
505 "type %s in shared mode\n", name, 492 "shared access mode\n", name, (void*) seg->start_addr,
506 (void*)seg->start_addr, (void*)seg->end, 493 (void*) seg->end, segtype_string[seg->vm_segtype]);
507 segtype_string[seg->vm_segtype]);
508 } 494 }
509 goto out; 495 goto out;
510 out_resource: 496 out_resource:
@@ -593,14 +579,14 @@ segment_modify_shared (char *name, int do_nonshared)
593 goto out_unlock; 579 goto out_unlock;
594 } 580 }
595 if (do_nonshared == seg->do_nonshared) { 581 if (do_nonshared == seg->do_nonshared) {
596 PRINT_INFO ("segment_modify_shared: not reloading segment %s" 582 pr_info("DCSS %s is already in the requested access "
597 " - already in requested mode\n",name); 583 "mode\n", name);
598 rc = 0; 584 rc = 0;
599 goto out_unlock; 585 goto out_unlock;
600 } 586 }
601 if (atomic_read (&seg->ref_count) != 1) { 587 if (atomic_read (&seg->ref_count) != 1) {
602 PRINT_WARN ("segment_modify_shared: not reloading segment %s - " 588 pr_warning("DCSS %s is in use and cannot be reloaded\n",
603 "segment is in use by other driver(s)\n",name); 589 name);
604 rc = -EAGAIN; 590 rc = -EAGAIN;
605 goto out_unlock; 591 goto out_unlock;
606 } 592 }
@@ -613,8 +599,8 @@ segment_modify_shared (char *name, int do_nonshared)
613 seg->res->flags |= IORESOURCE_READONLY; 599 seg->res->flags |= IORESOURCE_READONLY;
614 600
615 if (request_resource(&iomem_resource, seg->res)) { 601 if (request_resource(&iomem_resource, seg->res)) {
616 PRINT_WARN("segment_modify_shared: could not reload segment %s" 602 pr_warning("DCSS %s overlaps with used memory resources "
617 " - overlapping resources\n", name); 603 "and cannot be reloaded\n", name);
618 rc = -EBUSY; 604 rc = -EBUSY;
619 kfree(seg->res); 605 kfree(seg->res);
620 goto out_del_mem; 606 goto out_del_mem;
@@ -632,9 +618,8 @@ segment_modify_shared (char *name, int do_nonshared)
632 goto out_del_res; 618 goto out_del_res;
633 } 619 }
634 if (diag_cc > 1) { 620 if (diag_cc > 1) {
635 PRINT_WARN ("segment_modify_shared: could not reload segment %s" 621 pr_warning("Reloading DCSS %s failed with rc=%ld\n", name,
636 " - diag returned error (%ld)\n", 622 end_addr);
637 name, end_addr);
638 rc = dcss_diag_translate_rc(end_addr); 623 rc = dcss_diag_translate_rc(end_addr);
639 goto out_del_res; 624 goto out_del_res;
640 } 625 }
@@ -673,8 +658,7 @@ segment_unload(char *name)
673 mutex_lock(&dcss_lock); 658 mutex_lock(&dcss_lock);
674 seg = segment_by_name (name); 659 seg = segment_by_name (name);
675 if (seg == NULL) { 660 if (seg == NULL) {
676 PRINT_ERR ("could not find segment %s in segment_unload, " 661 pr_err("Unloading unknown DCSS %s failed\n", name);
677 "please report to linux390@de.ibm.com\n",name);
678 goto out_unlock; 662 goto out_unlock;
679 } 663 }
680 if (atomic_dec_return(&seg->ref_count) != 0) 664 if (atomic_dec_return(&seg->ref_count) != 0)
@@ -709,8 +693,7 @@ segment_save(char *name)
709 seg = segment_by_name (name); 693 seg = segment_by_name (name);
710 694
711 if (seg == NULL) { 695 if (seg == NULL) {
712 PRINT_ERR("could not find segment %s in segment_save, please " 696 pr_err("Saving unknown DCSS %s failed\n", name);
713 "report to linux390@de.ibm.com\n", name);
714 goto out; 697 goto out;
715 } 698 }
716 699
@@ -727,14 +710,14 @@ segment_save(char *name)
727 response = 0; 710 response = 0;
728 cpcmd(cmd1, NULL, 0, &response); 711 cpcmd(cmd1, NULL, 0, &response);
729 if (response) { 712 if (response) {
730 PRINT_ERR("segment_save: DEFSEG failed with response code %i\n", 713 pr_err("Saving a DCSS failed with DEFSEG response code "
731 response); 714 "%i\n", response);
732 goto out; 715 goto out;
733 } 716 }
734 cpcmd(cmd2, NULL, 0, &response); 717 cpcmd(cmd2, NULL, 0, &response);
735 if (response) { 718 if (response) {
736 PRINT_ERR("segment_save: SAVESEG failed with response code %i\n", 719 pr_err("Saving a DCSS failed with SAVESEG response code "
737 response); 720 "%i\n", response);
738 goto out; 721 goto out;
739 } 722 }
740out: 723out:
@@ -749,44 +732,41 @@ void segment_warning(int rc, char *seg_name)
749{ 732{
750 switch (rc) { 733 switch (rc) {
751 case -ENOENT: 734 case -ENOENT:
752 PRINT_WARN("cannot load/query segment %s, " 735 pr_err("DCSS %s cannot be loaded or queried\n", seg_name);
753 "does not exist\n", seg_name);
754 break; 736 break;
755 case -ENOSYS: 737 case -ENOSYS:
756 PRINT_WARN("cannot load/query segment %s, " 738 pr_err("DCSS %s cannot be loaded or queried without "
757 "not running on VM\n", seg_name); 739 "z/VM\n", seg_name);
758 break; 740 break;
759 case -EIO: 741 case -EIO:
760 PRINT_WARN("cannot load/query segment %s, " 742 pr_err("Loading or querying DCSS %s resulted in a "
761 "hardware error\n", seg_name); 743 "hardware error\n", seg_name);
762 break; 744 break;
763 case -ENOTSUPP: 745 case -ENOTSUPP:
764 PRINT_WARN("cannot load/query segment %s, " 746 pr_err("DCSS %s has multiple page ranges and cannot be "
765 "is a multi-part segment\n", seg_name); 747 "loaded or queried\n", seg_name);
766 break; 748 break;
767 case -ENOSPC: 749 case -ENOSPC:
768 PRINT_WARN("cannot load/query segment %s, " 750 pr_err("DCSS %s overlaps with used storage and cannot "
769 "overlaps with storage\n", seg_name); 751 "be loaded\n", seg_name);
770 break; 752 break;
771 case -EBUSY: 753 case -EBUSY:
772 PRINT_WARN("cannot load/query segment %s, " 754 pr_err("%s needs used memory resources and cannot be "
773 "overlaps with already loaded dcss\n", seg_name); 755 "loaded or queried\n", seg_name);
774 break; 756 break;
775 case -EPERM: 757 case -EPERM:
776 PRINT_WARN("cannot load/query segment %s, " 758 pr_err("DCSS %s is already loaded in a different access "
777 "already loaded in incompatible mode\n", seg_name); 759 "mode\n", seg_name);
778 break; 760 break;
779 case -ENOMEM: 761 case -ENOMEM:
780 PRINT_WARN("cannot load/query segment %s, " 762 pr_err("There is not enough memory to load or query "
781 "out of memory\n", seg_name); 763 "DCSS %s\n", seg_name);
782 break; 764 break;
783 case -ERANGE: 765 case -ERANGE:
784 PRINT_WARN("cannot load/query segment %s, " 766 pr_err("DCSS %s exceeds the kernel mapping range (%lu) "
785 "exceeds kernel mapping range\n", seg_name); 767 "and cannot be loaded\n", seg_name, VMEM_MAX_PHYS);
786 break; 768 break;
787 default: 769 default:
788 PRINT_WARN("cannot load/query segment %s, "
789 "return value %i\n", seg_name, rc);
790 break; 770 break;
791 } 771 }
792} 772}
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 158b0d6d7046..f0258ca3b17e 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -183,7 +183,7 @@ int arch_add_memory(int nid, u64 start, u64 size)
183 rc = vmem_add_mapping(start, size); 183 rc = vmem_add_mapping(start, size);
184 if (rc) 184 if (rc)
185 return rc; 185 return rc;
186 rc = __add_pages(zone, PFN_DOWN(start), PFN_DOWN(size)); 186 rc = __add_pages(nid, zone, PFN_DOWN(start), PFN_DOWN(size));
187 if (rc) 187 if (rc)
188 vmem_remove_mapping(start, size); 188 vmem_remove_mapping(start, size);
189 return rc; 189 return rc;
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index ef3635b52fc0..0767827540b1 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -263,7 +263,7 @@ int s390_enable_sie(void)
263 /* lets check if we are allowed to replace the mm */ 263 /* lets check if we are allowed to replace the mm */
264 task_lock(tsk); 264 task_lock(tsk);
265 if (!tsk->mm || atomic_read(&tsk->mm->mm_users) > 1 || 265 if (!tsk->mm || atomic_read(&tsk->mm->mm_users) > 1 ||
266 tsk->mm != tsk->active_mm || tsk->mm->ioctx_list) { 266 tsk->mm != tsk->active_mm || !hlist_empty(&tsk->mm->ioctx_list)) {
267 task_unlock(tsk); 267 task_unlock(tsk);
268 return -EINVAL; 268 return -EINVAL;
269 } 269 }
@@ -279,7 +279,7 @@ int s390_enable_sie(void)
279 /* Now lets check again if something happened */ 279 /* Now lets check again if something happened */
280 task_lock(tsk); 280 task_lock(tsk);
281 if (!tsk->mm || atomic_read(&tsk->mm->mm_users) > 1 || 281 if (!tsk->mm || atomic_read(&tsk->mm->mm_users) > 1 ||
282 tsk->mm != tsk->active_mm || tsk->mm->ioctx_list) { 282 tsk->mm != tsk->active_mm || !hlist_empty(&tsk->mm->ioctx_list)) {
283 mmput(mm); 283 mmput(mm);
284 task_unlock(tsk); 284 task_unlock(tsk);
285 return -EINVAL; 285 return -EINVAL;
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 5c9cbfc14c4d..f32a5197128d 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -13,6 +13,7 @@ config SUPERH
13 select HAVE_OPROFILE 13 select HAVE_OPROFILE
14 select HAVE_GENERIC_DMA_COHERENT 14 select HAVE_GENERIC_DMA_COHERENT
15 select HAVE_IOREMAP_PROT if MMU 15 select HAVE_IOREMAP_PROT if MMU
16 select HAVE_ARCH_TRACEHOOK
16 help 17 help
17 The SuperH is a RISC processor targeted for use in embedded systems 18 The SuperH is a RISC processor targeted for use in embedded systems
18 and consumer electronics; it was also used in the Sega Dreamcast 19 and consumer electronics; it was also used in the Sega Dreamcast
@@ -23,8 +24,10 @@ config SUPERH32
23 def_bool !SUPERH64 24 def_bool !SUPERH64
24 select HAVE_KPROBES 25 select HAVE_KPROBES
25 select HAVE_KRETPROBES 26 select HAVE_KRETPROBES
26 select HAVE_ARCH_TRACEHOOK
27 select HAVE_FUNCTION_TRACER 27 select HAVE_FUNCTION_TRACER
28 select HAVE_FTRACE_MCOUNT_RECORD
29 select HAVE_DYNAMIC_FTRACE
30 select HAVE_ARCH_KGDB
28 31
29config SUPERH64 32config SUPERH64
30 def_bool y if CPU_SH5 33 def_bool y if CPU_SH5
@@ -55,8 +58,6 @@ config GENERIC_HARDIRQS
55 58
56config GENERIC_HARDIRQS_NO__DO_IRQ 59config GENERIC_HARDIRQS_NO__DO_IRQ
57 def_bool y 60 def_bool y
58 depends on SUPERH32 && (!SH_DREAMCAST && !SH_SH4202_MICRODEV && \
59 !SH_7751_SYSTEMH && !HD64461)
60 61
61config GENERIC_IRQ_PROBE 62config GENERIC_IRQ_PROBE
62 def_bool y 63 def_bool y
@@ -85,10 +86,17 @@ config GENERIC_LOCKBREAK
85 86
86config SYS_SUPPORTS_PM 87config SYS_SUPPORTS_PM
87 bool 88 bool
89 depends on !SMP
90
91config ARCH_SUSPEND_POSSIBLE
92 def_bool n
93
94config ARCH_HIBERNATION_POSSIBLE
95 def_bool n
88 96
89config SYS_SUPPORTS_APM_EMULATION 97config SYS_SUPPORTS_APM_EMULATION
90 bool 98 bool
91 select SYS_SUPPORTS_PM 99 select ARCH_SUSPEND_POSSIBLE
92 100
93config SYS_SUPPORTS_SMP 101config SYS_SUPPORTS_SMP
94 bool 102 bool
@@ -183,6 +191,11 @@ config CPU_SUBTYPE_SH7619
183 191
184# SH-2A Processor Support 192# SH-2A Processor Support
185 193
194config CPU_SUBTYPE_SH7201
195 bool "Support SH7201 processor"
196 select CPU_SH2A
197 select CPU_HAS_FPU
198
186config CPU_SUBTYPE_SH7203 199config CPU_SUBTYPE_SH7203
187 bool "Support SH7203 processor" 200 bool "Support SH7203 processor"
188 select CPU_SH2A 201 select CPU_SH2A
@@ -456,8 +469,12 @@ config SH_CPU_FREQ
456 depends on CPU_FREQ 469 depends on CPU_FREQ
457 select CPU_FREQ_TABLE 470 select CPU_FREQ_TABLE
458 help 471 help
459 This adds the cpufreq driver for SuperH. At present, only 472 This adds the cpufreq driver for SuperH. Any CPU that supports
460 the SH-4 is supported. 473 clock rate rounding through the clock framework can use this
474 driver. While it will make the kernel slightly larger, this is
475 harmless for CPUs that don't support rate rounding. The driver
476 will also generate a notice in the boot log before disabling
477 itself if the CPU in question is not capable of rate rounding.
461 478
462 For details, take a look at <file:Documentation/cpu-freq>. 479 For details, take a look at <file:Documentation/cpu-freq>.
463 480
@@ -469,9 +486,6 @@ source "arch/sh/drivers/Kconfig"
469 486
470endmenu 487endmenu
471 488
472config ISA_DMA_API
473 bool
474
475menu "Kernel features" 489menu "Kernel features"
476 490
477source kernel/Kconfig.hz 491source kernel/Kconfig.hz
@@ -688,49 +702,6 @@ config MAPLE
688 Dreamcast with a serial line terminal or a remote network 702 Dreamcast with a serial line terminal or a remote network
689 connection. 703 connection.
690 704
691config CF_ENABLER
692 bool "Compact Flash Enabler support"
693 depends on SOLUTION_ENGINE || SH_SH03
694 ---help---
695 Compact Flash is a small, removable mass storage device introduced
696 in 1994 originally as a PCMCIA device. If you say `Y' here, you
697 compile in support for Compact Flash devices directly connected to
698 a SuperH processor. A Compact Flash FAQ is available at
699 <http://www.compactflash.org/faqs/faq.htm>.
700
701 If your board has "Directly Connected" CompactFlash at area 5 or 6,
702 you may want to enable this option. Then, you can use CF as
703 primary IDE drive (only tested for SanDisk).
704
705 If in doubt, select 'N'.
706
707choice
708 prompt "Compact Flash Connection Area"
709 depends on CF_ENABLER
710 default CF_AREA6
711
712config CF_AREA5
713 bool "Area5"
714 help
715 If your board has "Directly Connected" CompactFlash, You should
716 select the area where your CF is connected to.
717
718 - "Area5" if CompactFlash is connected to Area 5 (0x14000000)
719 - "Area6" if it is connected to Area 6 (0x18000000)
720
721 "Area6" will work for most boards.
722
723config CF_AREA6
724 bool "Area6"
725
726endchoice
727
728config CF_BASE_ADDR
729 hex
730 depends on CF_ENABLER
731 default "0xb8000000" if CF_AREA6
732 default "0xb4000000" if CF_AREA5
733
734source "arch/sh/drivers/pci/Kconfig" 705source "arch/sh/drivers/pci/Kconfig"
735 706
736source "drivers/pci/Kconfig" 707source "drivers/pci/Kconfig"
@@ -748,13 +719,11 @@ source "fs/Kconfig.binfmt"
748endmenu 719endmenu
749 720
750menu "Power management options (EXPERIMENTAL)" 721menu "Power management options (EXPERIMENTAL)"
751depends on EXPERIMENTAL && SYS_SUPPORTS_PM 722depends on EXPERIMENTAL
752 723
753config ARCH_SUSPEND_POSSIBLE 724source "kernel/power/Kconfig"
754 def_bool y
755 depends on !SMP
756 725
757source kernel/power/Kconfig 726source "drivers/cpuidle/Kconfig"
758 727
759endmenu 728endmenu
760 729
diff --git a/arch/sh/Kconfig.debug b/arch/sh/Kconfig.debug
index e6d2c8b11abd..0d62681f72a0 100644
--- a/arch/sh/Kconfig.debug
+++ b/arch/sh/Kconfig.debug
@@ -98,18 +98,29 @@ config IRQSTACKS
98 for handling hard and soft interrupts. This can help avoid 98 for handling hard and soft interrupts. This can help avoid
99 overflowing the process kernel stacks. 99 overflowing the process kernel stacks.
100 100
101config SH_KGDB 101config DUMP_CODE
102 bool "Include KGDB kernel debugger" 102 bool "Show disassembly of nearby code in register dumps"
103 select FRAME_POINTER 103 depends on DEBUG_KERNEL && SUPERH32
104 select DEBUG_INFO 104 default y if DEBUG_BUGVERBOSE
105 depends on CPU_SH3 || CPU_SH4 105 default n
106 help
107 This prints out a code trace of the instructions leading up to
108 the faulting instruction as a debugging aid. As this does grow
109 the kernel in size a bit, most users will want to say N here.
110
111 Those looking for more verbose debugging output should say Y.
112
113config SH_NO_BSS_INIT
114 bool "Avoid zeroing BSS (to speed-up startup on suitable platforms)"
115 depends on DEBUG_KERNEL
116 default n
106 help 117 help
107 Include in-kernel hooks for kgdb, the Linux kernel source level 118 If running in painfully slow environments, such as an RTL
108 debugger. See <http://kgdb.sourceforge.net/> for more information. 119 simulation or from remote memory via SHdebug, where the memory
109 Unless you are intending to debug the kernel, say N here. 120 can already be gauranteed to ber zeroed on boot, say Y.
110 121
111menu "KGDB configuration options" 122 For all other cases, say N. If this option seems perplexing, or
112 depends on SH_KGDB 123 you aren't sure, say N.
113 124
114config MORE_COMPILE_OPTIONS 125config MORE_COMPILE_OPTIONS
115 bool "Add any additional compile options" 126 bool "Add any additional compile options"
@@ -122,85 +133,16 @@ config COMPILE_OPTIONS
122 string "Additional compile arguments" 133 string "Additional compile arguments"
123 depends on MORE_COMPILE_OPTIONS 134 depends on MORE_COMPILE_OPTIONS
124 135
125config KGDB_NMI
126 def_bool n
127 prompt "Enter KGDB on NMI"
128
129config SH_KGDB_CONSOLE
130 def_bool n
131 prompt "Console messages through GDB"
132 depends on !SERIAL_SH_SCI_CONSOLE && SERIAL_SH_SCI=y
133 select SERIAL_CORE_CONSOLE
134
135config KGDB_SYSRQ
136 def_bool y
137 prompt "Allow SysRq 'G' to enter KGDB"
138 depends on MAGIC_SYSRQ
139
140comment "Serial port setup"
141
142config KGDB_DEFPORT
143 int "Port number (ttySCn)"
144 default "1"
145
146config KGDB_DEFBAUD
147 int "Baud rate"
148 default "115200"
149
150choice
151 prompt "Parity"
152 depends on SH_KGDB
153 default KGDB_DEFPARITY_N
154
155config KGDB_DEFPARITY_N
156 bool "None"
157
158config KGDB_DEFPARITY_E
159 bool "Even"
160
161config KGDB_DEFPARITY_O
162 bool "Odd"
163
164endchoice
165
166choice
167 prompt "Data bits"
168 depends on SH_KGDB
169 default KGDB_DEFBITS_8
170
171config KGDB_DEFBITS_8
172 bool "8"
173
174config KGDB_DEFBITS_7
175 bool "7"
176
177endchoice
178
179endmenu
180
181if SUPERH64
182
183config SH64_PROC_ASIDS
184 bool "Debug: report ASIDs through /proc/asids"
185 depends on PROC_FS && MMU
186
187config SH64_SR_WATCH 136config SH64_SR_WATCH
188 bool "Debug: set SR.WATCH to enable hardware watchpoints and trace" 137 bool "Debug: set SR.WATCH to enable hardware watchpoints and trace"
138 depends on SUPERH64
189 139
190config POOR_MANS_STRACE 140config POOR_MANS_STRACE
191 bool "Debug: enable rudimentary strace facility" 141 bool "Debug: enable rudimentary strace facility"
142 depends on SUPERH64
192 help 143 help
193 This option allows system calls to be traced to the console. It also 144 This option allows system calls to be traced to the console. It also
194 aids in detecting kernel stack underflow. It is useful for debugging 145 aids in detecting kernel stack underflow. It is useful for debugging
195 early-userland problems (e.g. init incurring fatal exceptions.) 146 early-userland problems (e.g. init incurring fatal exceptions.)
196 147
197config SH_ALPHANUMERIC
198 bool "Enable debug outputs to on-board alphanumeric display"
199 depends on SH_CAYMAN
200
201config SH_NO_BSS_INIT
202 bool "Avoid zeroing BSS (to speed-up startup on suitable platforms)"
203
204endif
205
206endmenu 148endmenu
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index c43eb0d7fa3b..4067b0d9287b 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -32,6 +32,7 @@ cflags-$(CONFIG_CPU_SH4) := $(call cc-option,-m4,) \
32 $(call cc-option,-mno-implicit-fp,-m4-nofpu) 32 $(call cc-option,-mno-implicit-fp,-m4-nofpu)
33cflags-$(CONFIG_CPU_SH4A) += $(call cc-option,-m4a,) \ 33cflags-$(CONFIG_CPU_SH4A) += $(call cc-option,-m4a,) \
34 $(call cc-option,-m4a-nofpu,) 34 $(call cc-option,-m4a-nofpu,)
35cflags-$(CONFIG_CPU_SH4AL_DSP) += $(call cc-option,-m4al,)
35cflags-$(CONFIG_CPU_SH5) := $(call cc-option,-m5-32media-nofpu,) 36cflags-$(CONFIG_CPU_SH5) := $(call cc-option,-m5-32media-nofpu,)
36 37
37ifeq ($(cflags-y),) 38ifeq ($(cflags-y),)
@@ -39,22 +40,16 @@ ifeq ($(cflags-y),)
39# In the case where we are stuck with a compiler that has been uselessly 40# In the case where we are stuck with a compiler that has been uselessly
40# restricted to a particular ISA, a favourite default of newer GCCs when 41# restricted to a particular ISA, a favourite default of newer GCCs when
41# extensive multilib targets are not provided, ensure we get the best fit 42# extensive multilib targets are not provided, ensure we get the best fit
42# regarding FP generation. This is necessary to avoid references to FP 43# regarding FP generation. This is intentionally stupid (albeit many
43# variants in libgcc where integer variants exist, which otherwise result 44# orders of magnitude less than GCC's default behaviour), as anything
44# in link errors. This is intentionally stupid (albeit many orders of 45# with a large number of multilib targets better have been built
45# magnitude less than GCC's default behaviour), as anything with a large 46# correctly for the target in mind.
46# number of multilib targets better have been built correctly for
47# the target in mind.
48# 47#
49cflags-y += $(shell $(CC) $(KBUILD_CFLAGS) -print-multi-lib | \ 48cflags-y += $(shell $(CC) $(KBUILD_CFLAGS) -print-multi-lib | \
50 grep nofpu | sed q | sed -e 's/^/-/;s/;.*$$//') 49 grep nofpu | sed q | sed -e 's/^/-/;s/;.*$$//')
51endif 50# At this point, anything goes.
52 51isaflags-y := $(call as-option,-Wa$(comma)-isa=any,)
53cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mb 52else
54cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -ml
55
56cflags-y += $(call cc-option,-mno-fdpic)
57
58# 53#
59# -Wa,-isa= tuning implies -Wa,-dsp for the versions of binutils that 54# -Wa,-isa= tuning implies -Wa,-dsp for the versions of binutils that
60# support it, while -Wa,-dsp by itself limits the range of usable opcodes 55# support it, while -Wa,-dsp by itself limits the range of usable opcodes
@@ -67,7 +62,12 @@ isaflags-y := $(call as-option,-Wa$(comma)-isa=$(isa-y),)
67 62
68isaflags-$(CONFIG_SH_DSP) := \ 63isaflags-$(CONFIG_SH_DSP) := \
69 $(call as-option,-Wa$(comma)-isa=$(isa-y),-Wa$(comma)-dsp) 64 $(call as-option,-Wa$(comma)-isa=$(isa-y),-Wa$(comma)-dsp)
65endif
70 66
67cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mb
68cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -ml
69
70cflags-y += $(call cc-option,-mno-fdpic)
71cflags-y += $(isaflags-y) -ffreestanding 71cflags-y += $(isaflags-y) -ffreestanding
72 72
73cflags-$(CONFIG_MORE_COMPILE_OPTIONS) += \ 73cflags-$(CONFIG_MORE_COMPILE_OPTIONS) += \
@@ -79,6 +79,9 @@ OBJCOPYFLAGS := -O binary -R .note -R .note.gnu.build-id -R .comment \
79# Give the various platforms the opportunity to set default image types 79# Give the various platforms the opportunity to set default image types
80defaultimage-$(CONFIG_SUPERH32) := zImage 80defaultimage-$(CONFIG_SUPERH32) := zImage
81defaultimage-$(CONFIG_SH_SH7785LCR) := uImage 81defaultimage-$(CONFIG_SH_SH7785LCR) := uImage
82defaultimage-$(CONFIG_SH_RSK) := uImage
83defaultimage-$(CONFIG_SH_7206_SOLUTION_ENGINE) := vmlinux
84defaultimage-$(CONFIG_SH_7619_SOLUTION_ENGINE) := vmlinux
82 85
83# Set some sensible Kbuild defaults 86# Set some sensible Kbuild defaults
84KBUILD_DEFCONFIG := shx3_defconfig 87KBUILD_DEFCONFIG := shx3_defconfig
@@ -132,6 +135,7 @@ machdir-$(CONFIG_SH_LANDISK) += mach-landisk
132machdir-$(CONFIG_SH_TITAN) += mach-titan 135machdir-$(CONFIG_SH_TITAN) += mach-titan
133machdir-$(CONFIG_SH_LBOX_RE2) += mach-lboxre2 136machdir-$(CONFIG_SH_LBOX_RE2) += mach-lboxre2
134machdir-$(CONFIG_SH_CAYMAN) += mach-cayman 137machdir-$(CONFIG_SH_CAYMAN) += mach-cayman
138machdir-$(CONFIG_SH_RSK) += mach-rsk
135 139
136ifneq ($(machdir-y),) 140ifneq ($(machdir-y),)
137core-y += $(addprefix arch/sh/boards/, \ 141core-y += $(addprefix arch/sh/boards/, \
@@ -173,11 +177,8 @@ KBUILD_CFLAGS += -pipe $(cflags-y)
173KBUILD_CPPFLAGS += $(cflags-y) 177KBUILD_CPPFLAGS += $(cflags-y)
174KBUILD_AFLAGS += $(cflags-y) 178KBUILD_AFLAGS += $(cflags-y)
175 179
176LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
177
178libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y) 180libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y)
179libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y) 181libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y)
180libs-y += $(LIBGCC)
181 182
182PHONY += maketools FORCE 183PHONY += maketools FORCE
183 184
diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig
index 50467f9d0d0b..861914747e4e 100644
--- a/arch/sh/boards/Kconfig
+++ b/arch/sh/boards/Kconfig
@@ -126,10 +126,12 @@ config SH_RTS7751R2D
126 Select RTS7751R2D if configuring for a Renesas Technology 126 Select RTS7751R2D if configuring for a Renesas Technology
127 Sales SH-Graphics board. 127 Sales SH-Graphics board.
128 128
129config SH_RSK7203 129config SH_RSK
130 bool "RSK7203" 130 bool "Renesas Starter Kit"
131 select GENERIC_GPIO 131 depends on CPU_SUBTYPE_SH7201 || CPU_SUBTYPE_SH7203
132 depends on CPU_SUBTYPE_SH7203 132 help
133 Select this option if configuring for any of the RSK+ MCU
134 evaluation platforms.
133 135
134config SH_SDK7780 136config SH_SDK7780
135 bool "SDK7780R3" 137 bool "SDK7780R3"
@@ -253,6 +255,7 @@ source "arch/sh/boards/mach-r2d/Kconfig"
253source "arch/sh/boards/mach-highlander/Kconfig" 255source "arch/sh/boards/mach-highlander/Kconfig"
254source "arch/sh/boards/mach-sdk7780/Kconfig" 256source "arch/sh/boards/mach-sdk7780/Kconfig"
255source "arch/sh/boards/mach-migor/Kconfig" 257source "arch/sh/boards/mach-migor/Kconfig"
258source "arch/sh/boards/mach-rsk/Kconfig"
256 259
257if SH_MAGIC_PANEL_R2 260if SH_MAGIC_PANEL_R2
258 261
diff --git a/arch/sh/boards/Makefile b/arch/sh/boards/Makefile
index d9efa3923721..269ae2be49ef 100644
--- a/arch/sh/boards/Makefile
+++ b/arch/sh/boards/Makefile
@@ -3,7 +3,6 @@
3# 3#
4obj-$(CONFIG_SH_AP325RXA) += board-ap325rxa.o 4obj-$(CONFIG_SH_AP325RXA) += board-ap325rxa.o
5obj-$(CONFIG_SH_MAGIC_PANEL_R2) += board-magicpanelr2.o 5obj-$(CONFIG_SH_MAGIC_PANEL_R2) += board-magicpanelr2.o
6obj-$(CONFIG_SH_RSK7203) += board-rsk7203.o
7obj-$(CONFIG_SH_SH7785LCR) += board-sh7785lcr.o 6obj-$(CONFIG_SH_SH7785LCR) += board-sh7785lcr.o
8obj-$(CONFIG_SH_SHMIN) += board-shmin.o 7obj-$(CONFIG_SH_SHMIN) += board-shmin.o
9obj-$(CONFIG_SH_EDOSK7760) += board-edosk7760.o 8obj-$(CONFIG_SH_EDOSK7760) += board-edosk7760.o
diff --git a/arch/sh/boards/board-ap325rxa.c b/arch/sh/boards/board-ap325rxa.c
index 8881a643ac32..1c67cba6e34f 100644
--- a/arch/sh/boards/board-ap325rxa.c
+++ b/arch/sh/boards/board-ap325rxa.c
@@ -197,6 +197,10 @@ static struct resource lcdc_resources[] = {
197 .end = 0xfe941fff, 197 .end = 0xfe941fff,
198 .flags = IORESOURCE_MEM, 198 .flags = IORESOURCE_MEM,
199 }, 199 },
200 [1] = {
201 .start = 28,
202 .flags = IORESOURCE_IRQ,
203 },
200}; 204};
201 205
202static struct platform_device lcdc_device = { 206static struct platform_device lcdc_device = {
@@ -303,6 +307,7 @@ static struct resource ceu_resources[] = {
303 307
304static struct platform_device ceu_device = { 308static struct platform_device ceu_device = {
305 .name = "sh_mobile_ceu", 309 .name = "sh_mobile_ceu",
310 .id = 0, /* "ceu0" clock */
306 .num_resources = ARRAY_SIZE(ceu_resources), 311 .num_resources = ARRAY_SIZE(ceu_resources),
307 .resource = ceu_resources, 312 .resource = ceu_resources,
308 .dev = { 313 .dev = {
@@ -344,7 +349,6 @@ static int __init ap325rxa_devices_setup(void)
344 gpio_export(GPIO_PTF7, 0); 349 gpio_export(GPIO_PTF7, 0);
345 350
346 /* LCDC */ 351 /* LCDC */
347 clk_always_enable("mstp200");
348 gpio_request(GPIO_FN_LCDD15, NULL); 352 gpio_request(GPIO_FN_LCDD15, NULL);
349 gpio_request(GPIO_FN_LCDD14, NULL); 353 gpio_request(GPIO_FN_LCDD14, NULL);
350 gpio_request(GPIO_FN_LCDD13, NULL); 354 gpio_request(GPIO_FN_LCDD13, NULL);
@@ -375,7 +379,6 @@ static int __init ap325rxa_devices_setup(void)
375 gpio_direction_output(GPIO_PTS3, 1); 379 gpio_direction_output(GPIO_PTS3, 1);
376 380
377 /* CEU */ 381 /* CEU */
378 clk_always_enable("mstp203");
379 gpio_request(GPIO_FN_VIO_CLK2, NULL); 382 gpio_request(GPIO_FN_VIO_CLK2, NULL);
380 gpio_request(GPIO_FN_VIO_VD2, NULL); 383 gpio_request(GPIO_FN_VIO_VD2, NULL);
381 gpio_request(GPIO_FN_VIO_HD2, NULL); 384 gpio_request(GPIO_FN_VIO_HD2, NULL);
diff --git a/arch/sh/boards/board-shmin.c b/arch/sh/boards/board-shmin.c
index 5cc0867de5ab..b1dcbbc89188 100644
--- a/arch/sh/boards/board-shmin.c
+++ b/arch/sh/boards/board-shmin.c
@@ -22,21 +22,13 @@ static void __init init_shmin_irq(void)
22 plat_irq_setup_pins(IRQ_MODE_IRQ); 22 plat_irq_setup_pins(IRQ_MODE_IRQ);
23} 23}
24 24
25static void __iomem *shmin_ioport_map(unsigned long port, unsigned int size) 25static void __init shmin_setup(char **cmdline_p)
26{ 26{
27 static int dummy; 27 __set_io_port_base(SHMIN_IO_BASE);
28
29 if ((port & ~0x1f) == SHMIN_NE_BASE)
30 return (void __iomem *)(SHMIN_IO_BASE + port);
31
32 dummy = 0;
33
34 return &dummy;
35
36} 28}
37 29
38static struct sh_machine_vector mv_shmin __initmv = { 30static struct sh_machine_vector mv_shmin __initmv = {
39 .mv_name = "SHMIN", 31 .mv_name = "SHMIN",
32 .mv_setup = shmin_setup,
40 .mv_init_irq = init_shmin_irq, 33 .mv_init_irq = init_shmin_irq,
41 .mv_ioport_map = shmin_ioport_map,
42}; 34};
diff --git a/arch/sh/boards/mach-cayman/Makefile b/arch/sh/boards/mach-cayman/Makefile
index 489a8f867368..cafe1ac3b29c 100644
--- a/arch/sh/boards/mach-cayman/Makefile
+++ b/arch/sh/boards/mach-cayman/Makefile
@@ -2,4 +2,3 @@
2# Makefile for the Hitachi Cayman specific parts of the kernel 2# Makefile for the Hitachi Cayman specific parts of the kernel
3# 3#
4obj-y := setup.o irq.o 4obj-y := setup.o irq.o
5obj-$(CONFIG_HEARTBEAT) += led.o
diff --git a/arch/sh/boards/mach-cayman/irq.c b/arch/sh/boards/mach-cayman/irq.c
index ceb37ae92c70..da62ad516994 100644
--- a/arch/sh/boards/mach-cayman/irq.c
+++ b/arch/sh/boards/mach-cayman/irq.c
@@ -94,31 +94,11 @@ static void ack_cayman_irq(unsigned int irq)
94 disable_cayman_irq(irq); 94 disable_cayman_irq(irq);
95} 95}
96 96
97static void end_cayman_irq(unsigned int irq) 97struct irq_chip cayman_irq_type = {
98{ 98 .name = "Cayman-IRQ",
99 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 99 .unmask = enable_cayman_irq,
100 enable_cayman_irq(irq); 100 .mask = disable_cayman_irq,
101} 101 .mask_ack = ack_cayman_irq,
102
103static unsigned int startup_cayman_irq(unsigned int irq)
104{
105 enable_cayman_irq(irq);
106 return 0; /* never anything pending */
107}
108
109static void shutdown_cayman_irq(unsigned int irq)
110{
111 disable_cayman_irq(irq);
112}
113
114struct hw_interrupt_type cayman_irq_type = {
115 .typename = "Cayman-IRQ",
116 .startup = startup_cayman_irq,
117 .shutdown = shutdown_cayman_irq,
118 .enable = enable_cayman_irq,
119 .disable = disable_cayman_irq,
120 .ack = ack_cayman_irq,
121 .end = end_cayman_irq,
122}; 102};
123 103
124int cayman_irq_demux(int evt) 104int cayman_irq_demux(int evt)
@@ -187,8 +167,9 @@ void init_cayman_irq(void)
187 return; 167 return;
188 } 168 }
189 169
190 for (i=0; i<NR_EXT_IRQS; i++) { 170 for (i = 0; i < NR_EXT_IRQS; i++) {
191 irq_desc[START_EXT_IRQS + i].chip = &cayman_irq_type; 171 set_irq_chip_and_handler(START_EXT_IRQS + i, &cayman_irq_type,
172 handle_level_irq);
192 } 173 }
193 174
194 /* Setup the SMSC interrupt */ 175 /* Setup the SMSC interrupt */
diff --git a/arch/sh/boards/mach-cayman/led.c b/arch/sh/boards/mach-cayman/led.c
deleted file mode 100644
index a808eac4ecd6..000000000000
--- a/arch/sh/boards/mach-cayman/led.c
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 * arch/sh/boards/cayman/led.c
3 *
4 * Copyright (C) 2002 Stuart Menefy <stuart.menefy@st.com>
5 *
6 * May be copied or modified under the terms of the GNU General Public
7 * License. See linux/COPYING for more information.
8 *
9 * Flash the LEDs
10 */
11#include <asm/io.h>
12
13/*
14** It is supposed these functions to be used for a low level
15** debugging (via Cayman LEDs), hence to be available as soon
16** as possible.
17** Unfortunately Cayman LEDs relies on Cayman EPLD to be mapped
18** (this happen when IRQ are initialized... quite late).
19** These triky dependencies should be removed. Temporary, it
20** may be enough to NOP until EPLD is mapped.
21*/
22
23extern unsigned long epld_virt;
24
25#define LED_ADDR (epld_virt + 0x008)
26#define HDSP2534_ADDR (epld_virt + 0x100)
27
28void mach_led(int position, int value)
29{
30 if (!epld_virt)
31 return;
32
33 if (value)
34 ctrl_outl(0, LED_ADDR);
35 else
36 ctrl_outl(1, LED_ADDR);
37
38}
39
40void mach_alphanum(int position, unsigned char value)
41{
42 if (!epld_virt)
43 return;
44
45 ctrl_outb(value, HDSP2534_ADDR + 0xe0 + (position << 2));
46}
47
48void mach_alphanum_brightness(int setting)
49{
50 ctrl_outb(setting & 7, HDSP2534_ADDR + 0xc0);
51}
diff --git a/arch/sh/boards/mach-dreamcast/irq.c b/arch/sh/boards/mach-dreamcast/irq.c
index 67bdc33dd411..f55fc8e795e9 100644
--- a/arch/sh/boards/mach-dreamcast/irq.c
+++ b/arch/sh/boards/mach-dreamcast/irq.c
@@ -10,106 +10,90 @@
10 */ 10 */
11 11
12#include <linux/irq.h> 12#include <linux/irq.h>
13#include <asm/io.h> 13#include <linux/io.h>
14#include <asm/irq.h> 14#include <asm/irq.h>
15#include <mach/sysasic.h> 15#include <mach/sysasic.h>
16 16
17/* Dreamcast System ASIC Hardware Events - 17/*
18 18 * Dreamcast System ASIC Hardware Events -
19 The Dreamcast's System ASIC (a.k.a. Holly) is responsible for receiving 19 *
20 hardware events from system peripherals and triggering an SH7750 IRQ. 20 * The Dreamcast's System ASIC (a.k.a. Holly) is responsible for receiving
21 Hardware events can trigger IRQs 13, 11, or 9 depending on which bits are 21 * hardware events from system peripherals and triggering an SH7750 IRQ.
22 set in the Event Mask Registers (EMRs). When a hardware event is 22 * Hardware events can trigger IRQs 13, 11, or 9 depending on which bits are
23 triggered, it's corresponding bit in the Event Status Registers (ESRs) 23 * set in the Event Mask Registers (EMRs). When a hardware event is
24 is set, and that bit should be rewritten to the ESR to acknowledge that 24 * triggered, its corresponding bit in the Event Status Registers (ESRs)
25 event. 25 * is set, and that bit should be rewritten to the ESR to acknowledge that
26 26 * event.
27 There are three 32-bit ESRs located at 0xa05f8900 - 0xa05f6908. Event 27 *
28 types can be found in include/asm-sh/dreamcast/sysasic.h. There are three 28 * There are three 32-bit ESRs located at 0xa05f6900 - 0xa05f6908. Event
29 groups of EMRs that parallel the ESRs. Each EMR group corresponds to an 29 * types can be found in arch/sh/include/mach-dreamcast/mach/sysasic.h.
30 IRQ, so 0xa05f6910 - 0xa05f6918 triggers IRQ 13, 0xa05f6920 - 0xa05f6928 30 * There are three groups of EMRs that parallel the ESRs. Each EMR group
31 triggers IRQ 11, and 0xa05f6930 - 0xa05f6938 triggers IRQ 9. 31 * corresponds to an IRQ, so 0xa05f6910 - 0xa05f6918 triggers IRQ 13,
32 32 * 0xa05f6920 - 0xa05f6928 triggers IRQ 11, and 0xa05f6930 - 0xa05f6938
33 In the kernel, these events are mapped to virtual IRQs so that drivers can 33 * triggers IRQ 9.
34 respond to them as they would a normal interrupt. In order to keep this 34 *
35 mapping simple, the events are mapped as: 35 * In the kernel, these events are mapped to virtual IRQs so that drivers can
36 36 * respond to them as they would a normal interrupt. In order to keep this
37 6900/6910 - Events 0-31, IRQ 13 37 * mapping simple, the events are mapped as:
38 6904/6924 - Events 32-63, IRQ 11 38 *
39 6908/6938 - Events 64-95, IRQ 9 39 * 6900/6910 - Events 0-31, IRQ 13
40 40 * 6904/6924 - Events 32-63, IRQ 11
41*/ 41 * 6908/6938 - Events 64-95, IRQ 9
42 *
43 */
42 44
43#define ESR_BASE 0x005f6900 /* Base event status register */ 45#define ESR_BASE 0x005f6900 /* Base event status register */
44#define EMR_BASE 0x005f6910 /* Base event mask register */ 46#define EMR_BASE 0x005f6910 /* Base event mask register */
45 47
46/* Helps us determine the EMR group that this event belongs to: 0 = 0x6910, 48/*
47 1 = 0x6920, 2 = 0x6930; also determine the event offset */ 49 * Helps us determine the EMR group that this event belongs to: 0 = 0x6910,
50 * 1 = 0x6920, 2 = 0x6930; also determine the event offset.
51 */
48#define LEVEL(event) (((event) - HW_EVENT_IRQ_BASE) / 32) 52#define LEVEL(event) (((event) - HW_EVENT_IRQ_BASE) / 32)
49 53
50/* Return the hardware event's bit positon within the EMR/ESR */ 54/* Return the hardware event's bit positon within the EMR/ESR */
51#define EVENT_BIT(event) (((event) - HW_EVENT_IRQ_BASE) & 31) 55#define EVENT_BIT(event) (((event) - HW_EVENT_IRQ_BASE) & 31)
52 56
53/* For each of these *_irq routines, the IRQ passed in is the virtual IRQ 57/*
54 (logically mapped to the corresponding bit for the hardware event). */ 58 * For each of these *_irq routines, the IRQ passed in is the virtual IRQ
59 * (logically mapped to the corresponding bit for the hardware event).
60 */
55 61
56/* Disable the hardware event by masking its bit in its EMR */ 62/* Disable the hardware event by masking its bit in its EMR */
57static inline void disable_systemasic_irq(unsigned int irq) 63static inline void disable_systemasic_irq(unsigned int irq)
58{ 64{
59 __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2); 65 __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2);
60 __u32 mask; 66 __u32 mask;
61 67
62 mask = inl(emr); 68 mask = inl(emr);
63 mask &= ~(1 << EVENT_BIT(irq)); 69 mask &= ~(1 << EVENT_BIT(irq));
64 outl(mask, emr); 70 outl(mask, emr);
65} 71}
66 72
67/* Enable the hardware event by setting its bit in its EMR */ 73/* Enable the hardware event by setting its bit in its EMR */
68static inline void enable_systemasic_irq(unsigned int irq) 74static inline void enable_systemasic_irq(unsigned int irq)
69{ 75{
70 __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2); 76 __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2);
71 __u32 mask; 77 __u32 mask;
72 78
73 mask = inl(emr); 79 mask = inl(emr);
74 mask |= (1 << EVENT_BIT(irq)); 80 mask |= (1 << EVENT_BIT(irq));
75 outl(mask, emr); 81 outl(mask, emr);
76} 82}
77 83
78/* Acknowledge a hardware event by writing its bit back to its ESR */ 84/* Acknowledge a hardware event by writing its bit back to its ESR */
79static void ack_systemasic_irq(unsigned int irq) 85static void mask_ack_systemasic_irq(unsigned int irq)
80{
81 __u32 esr = ESR_BASE + (LEVEL(irq) << 2);
82 disable_systemasic_irq(irq);
83 outl((1 << EVENT_BIT(irq)), esr);
84}
85
86/* After a IRQ has been ack'd and responded to, it needs to be renabled */
87static void end_systemasic_irq(unsigned int irq)
88{
89 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
90 enable_systemasic_irq(irq);
91}
92
93static unsigned int startup_systemasic_irq(unsigned int irq)
94{
95 enable_systemasic_irq(irq);
96
97 return 0;
98}
99
100static void shutdown_systemasic_irq(unsigned int irq)
101{ 86{
102 disable_systemasic_irq(irq); 87 __u32 esr = ESR_BASE + (LEVEL(irq) << 2);
88 disable_systemasic_irq(irq);
89 outl((1 << EVENT_BIT(irq)), esr);
103} 90}
104 91
105struct hw_interrupt_type systemasic_int = { 92struct irq_chip systemasic_int = {
106 .typename = "System ASIC", 93 .name = "System ASIC",
107 .startup = startup_systemasic_irq, 94 .mask = disable_systemasic_irq,
108 .shutdown = shutdown_systemasic_irq, 95 .mask_ack = mask_ack_systemasic_irq,
109 .enable = enable_systemasic_irq, 96 .unmask = enable_systemasic_irq,
110 .disable = disable_systemasic_irq,
111 .ack = ack_systemasic_irq,
112 .end = end_systemasic_irq,
113}; 97};
114 98
115/* 99/*
@@ -117,37 +101,37 @@ struct hw_interrupt_type systemasic_int = {
117 */ 101 */
118int systemasic_irq_demux(int irq) 102int systemasic_irq_demux(int irq)
119{ 103{
120 __u32 emr, esr, status, level; 104 __u32 emr, esr, status, level;
121 __u32 j, bit; 105 __u32 j, bit;
122 106
123 switch (irq) { 107 switch (irq) {
124 case 13: 108 case 13:
125 level = 0; 109 level = 0;
126 break; 110 break;
127 case 11: 111 case 11:
128 level = 1; 112 level = 1;
129 break; 113 break;
130 case 9: 114 case 9:
131 level = 2; 115 level = 2;
132 break; 116 break;
133 default: 117 default:
134 return irq; 118 return irq;
135 } 119 }
136 emr = EMR_BASE + (level << 4) + (level << 2); 120 emr = EMR_BASE + (level << 4) + (level << 2);
137 esr = ESR_BASE + (level << 2); 121 esr = ESR_BASE + (level << 2);
138 122
139 /* Mask the ESR to filter any spurious, unwanted interrupts */ 123 /* Mask the ESR to filter any spurious, unwanted interrupts */
140 status = inl(esr); 124 status = inl(esr);
141 status &= inl(emr); 125 status &= inl(emr);
142 126
143 /* Now scan and find the first set bit as the event to map */ 127 /* Now scan and find the first set bit as the event to map */
144 for (bit = 1, j = 0; j < 32; bit <<= 1, j++) { 128 for (bit = 1, j = 0; j < 32; bit <<= 1, j++) {
145 if (status & bit) { 129 if (status & bit) {
146 irq = HW_EVENT_IRQ_BASE + j + (level << 5); 130 irq = HW_EVENT_IRQ_BASE + j + (level << 5);
147 return irq; 131 return irq;
148 } 132 }
149 } 133 }
150 134
151 /* Not reached */ 135 /* Not reached */
152 return irq; 136 return irq;
153} 137}
diff --git a/arch/sh/boards/mach-dreamcast/setup.c b/arch/sh/boards/mach-dreamcast/setup.c
index 7d944fc75e93..d1bee4884cd6 100644
--- a/arch/sh/boards/mach-dreamcast/setup.c
+++ b/arch/sh/boards/mach-dreamcast/setup.c
@@ -28,7 +28,7 @@
28#include <asm/machvec.h> 28#include <asm/machvec.h>
29#include <mach/sysasic.h> 29#include <mach/sysasic.h>
30 30
31extern struct hw_interrupt_type systemasic_int; 31extern struct irq_chip systemasic_int;
32extern void aica_time_init(void); 32extern void aica_time_init(void);
33extern int gapspci_init(void); 33extern int gapspci_init(void);
34extern int systemasic_irq_demux(int); 34extern int systemasic_irq_demux(int);
@@ -47,7 +47,8 @@ static void __init dreamcast_setup(char **cmdline_p)
47 47
48 /* Assign all virtual IRQs to the System ASIC int. handler */ 48 /* Assign all virtual IRQs to the System ASIC int. handler */
49 for (i = HW_EVENT_IRQ_BASE; i < HW_EVENT_IRQ_MAX; i++) 49 for (i = HW_EVENT_IRQ_BASE; i < HW_EVENT_IRQ_MAX; i++)
50 irq_desc[i].chip = &systemasic_int; 50 set_irq_chip_and_handler(i, &systemasic_int,
51 handle_level_irq);
51 52
52 board_time_init = aica_time_init; 53 board_time_init = aica_time_init;
53 54
diff --git a/arch/sh/boards/mach-edosk7705/Makefile b/arch/sh/boards/mach-edosk7705/Makefile
index 14bdd531f116..cd54acb51499 100644
--- a/arch/sh/boards/mach-edosk7705/Makefile
+++ b/arch/sh/boards/mach-edosk7705/Makefile
@@ -3,4 +3,3 @@
3# 3#
4 4
5obj-y := setup.o io.o 5obj-y := setup.o io.o
6
diff --git a/arch/sh/boards/mach-edosk7705/io.c b/arch/sh/boards/mach-edosk7705/io.c
index 7d153e50a01b..5b9c57c43241 100644
--- a/arch/sh/boards/mach-edosk7705/io.c
+++ b/arch/sh/boards/mach-edosk7705/io.c
@@ -10,28 +10,24 @@
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/types.h> 12#include <linux/types.h>
13#include <asm/io.h> 13#include <linux/io.h>
14#include <mach/edosk7705.h> 14#include <mach/edosk7705.h>
15#include <asm/addrspace.h> 15#include <asm/addrspace.h>
16 16
17#define SMC_IOADDR 0xA2000000 17#define SMC_IOADDR 0xA2000000
18 18
19#define maybebadio(name,port) \
20 printk("bad PC-like io %s for port 0x%lx at 0x%08x\n", \
21 #name, (port), (__u32) __builtin_return_address(0))
22
23/* Map the Ethernet addresses as if it is at 0x300 - 0x320 */ 19/* Map the Ethernet addresses as if it is at 0x300 - 0x320 */
24unsigned long sh_edosk7705_isa_port2addr(unsigned long port) 20static unsigned long sh_edosk7705_isa_port2addr(unsigned long port)
25{ 21{
26 if (port >= 0x300 && port < 0x320) { 22 /*
27 /* SMC91C96 registers are 4 byte aligned rather than the 23 * SMC91C96 registers are 4 byte aligned rather than the
28 * usual 2 byte! 24 * usual 2 byte!
29 */ 25 */
30 return SMC_IOADDR + ( (port - 0x300) * 2); 26 if (port >= 0x300 && port < 0x320)
31 } 27 return SMC_IOADDR + ((port - 0x300) * 2);
32 28
33 maybebadio(sh_edosk7705_isa_port2addr, port); 29 maybebadio(port);
34 return port; 30 return port;
35} 31}
36 32
37/* Trying to read / write bytes on odd-byte boundaries to the Ethernet 33/* Trying to read / write bytes on odd-byte boundaries to the Ethernet
@@ -42,53 +38,34 @@ unsigned long sh_edosk7705_isa_port2addr(unsigned long port)
42 */ 38 */
43unsigned char sh_edosk7705_inb(unsigned long port) 39unsigned char sh_edosk7705_inb(unsigned long port)
44{ 40{
45 if (port >= 0x300 && port < 0x320 && port & 0x01) { 41 if (port >= 0x300 && port < 0x320 && port & 0x01)
46 return (volatile unsigned char)(generic_inw(port -1) >> 8); 42 return __raw_readw(port - 1) >> 8;
47 }
48 return *(volatile unsigned char *)sh_edosk7705_isa_port2addr(port);
49}
50 43
51unsigned int sh_edosk7705_inl(unsigned long port) 44 return __raw_readb(sh_edosk7705_isa_port2addr(port));
52{
53 return *(volatile unsigned long *)port;
54} 45}
55 46
56void sh_edosk7705_outb(unsigned char value, unsigned long port) 47void sh_edosk7705_outb(unsigned char value, unsigned long port)
57{ 48{
58 if (port >= 0x300 && port < 0x320 && port & 0x01) { 49 if (port >= 0x300 && port < 0x320 && port & 0x01) {
59 generic_outw(((unsigned short)value << 8), port -1); 50 __raw_writew(((unsigned short)value << 8), port - 1);
60 return; 51 return;
61 } 52 }
62 *(volatile unsigned char *)sh_edosk7705_isa_port2addr(port) = value;
63}
64 53
65void sh_edosk7705_outl(unsigned int value, unsigned long port) 54 __raw_writeb(value, sh_edosk7705_isa_port2addr(port));
66{
67 *(volatile unsigned long *)port = value;
68} 55}
69 56
70void sh_edosk7705_insb(unsigned long port, void *addr, unsigned long count) 57void sh_edosk7705_insb(unsigned long port, void *addr, unsigned long count)
71{ 58{
72 unsigned char *p = addr; 59 unsigned char *p = addr;
73 while (count--) *p++ = sh_edosk7705_inb(port);
74}
75 60
76void sh_edosk7705_insl(unsigned long port, void *addr, unsigned long count)
77{
78 unsigned long *p = (unsigned long*)addr;
79 while (count--) 61 while (count--)
80 *p++ = *(volatile unsigned long *)port; 62 *p++ = sh_edosk7705_inb(port);
81} 63}
82 64
83void sh_edosk7705_outsb(unsigned long port, const void *addr, unsigned long count) 65void sh_edosk7705_outsb(unsigned long port, const void *addr, unsigned long count)
84{ 66{
85 unsigned char *p = (unsigned char*)addr; 67 unsigned char *p = (unsigned char *)addr;
86 while (count--) sh_edosk7705_outb(*p++, port);
87}
88 68
89void sh_edosk7705_outsl(unsigned long port, const void *addr, unsigned long count) 69 while (count--)
90{ 70 sh_edosk7705_outb(*p++, port);
91 unsigned long *p = (unsigned long*)addr;
92 while (count--) sh_edosk7705_outl(*p++, port);
93} 71}
94
diff --git a/arch/sh/boards/mach-edosk7705/setup.c b/arch/sh/boards/mach-edosk7705/setup.c
index ab3f47bffdf3..d59225e26fb9 100644
--- a/arch/sh/boards/mach-edosk7705/setup.c
+++ b/arch/sh/boards/mach-edosk7705/setup.c
@@ -9,6 +9,7 @@
9 * board by S. Dunn, 2003. 9 * board by S. Dunn, 2003.
10 */ 10 */
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/irq.h>
12#include <asm/machvec.h> 13#include <asm/machvec.h>
13#include <mach/edosk7705.h> 14#include <mach/edosk7705.h>
14 15
@@ -26,18 +27,10 @@ static struct sh_machine_vector mv_edosk7705 __initmv = {
26 .mv_nr_irqs = 80, 27 .mv_nr_irqs = 80,
27 28
28 .mv_inb = sh_edosk7705_inb, 29 .mv_inb = sh_edosk7705_inb,
29 .mv_inl = sh_edosk7705_inl,
30 .mv_outb = sh_edosk7705_outb, 30 .mv_outb = sh_edosk7705_outb,
31 .mv_outl = sh_edosk7705_outl,
32
33 .mv_inl_p = sh_edosk7705_inl,
34 .mv_outl_p = sh_edosk7705_outl,
35 31
36 .mv_insb = sh_edosk7705_insb, 32 .mv_insb = sh_edosk7705_insb,
37 .mv_insl = sh_edosk7705_insl,
38 .mv_outsb = sh_edosk7705_outsb, 33 .mv_outsb = sh_edosk7705_outsb,
39 .mv_outsl = sh_edosk7705_outsl,
40 34
41 .mv_isa_port2addr = sh_edosk7705_isa_port2addr,
42 .mv_init_irq = sh_edosk7705_init_irq, 35 .mv_init_irq = sh_edosk7705_init_irq,
43}; 36};
diff --git a/arch/sh/boards/mach-hp6xx/pm.c b/arch/sh/boards/mach-hp6xx/pm.c
index 64af1f2eef05..d936c1af7620 100644
--- a/arch/sh/boards/mach-hp6xx/pm.c
+++ b/arch/sh/boards/mach-hp6xx/pm.c
@@ -10,15 +10,91 @@
10#include <linux/suspend.h> 10#include <linux/suspend.h>
11#include <linux/errno.h> 11#include <linux/errno.h>
12#include <linux/time.h> 12#include <linux/time.h>
13#include <linux/delay.h>
14#include <linux/gfp.h>
13#include <asm/io.h> 15#include <asm/io.h>
14#include <asm/hd64461.h> 16#include <asm/hd64461.h>
15#include <mach/hp6xx.h> 17#include <mach/hp6xx.h>
16#include <cpu/dac.h> 18#include <cpu/dac.h>
17#include <asm/pm.h> 19#include <asm/freq.h>
20#include <asm/watchdog.h>
21
22#define INTR_OFFSET 0x600
18 23
19#define STBCR 0xffffff82 24#define STBCR 0xffffff82
20#define STBCR2 0xffffff88 25#define STBCR2 0xffffff88
21 26
27#define STBCR_STBY 0x80
28#define STBCR_MSTP2 0x04
29
30#define MCR 0xffffff68
31#define RTCNT 0xffffff70
32
33#define MCR_RMODE 2
34#define MCR_RFSH 4
35
36extern u8 wakeup_start;
37extern u8 wakeup_end;
38
39static void pm_enter(void)
40{
41 u8 stbcr, csr;
42 u16 frqcr, mcr;
43 u32 vbr_new, vbr_old;
44
45 set_bl_bit();
46
47 /* set wdt */
48 csr = sh_wdt_read_csr();
49 csr &= ~WTCSR_TME;
50 csr |= WTCSR_CKS_4096;
51 sh_wdt_write_csr(csr);
52 csr = sh_wdt_read_csr();
53 sh_wdt_write_cnt(0);
54
55 /* disable PLL1 */
56 frqcr = ctrl_inw(FRQCR);
57 frqcr &= ~(FRQCR_PLLEN | FRQCR_PSTBY);
58 ctrl_outw(frqcr, FRQCR);
59
60 /* enable standby */
61 stbcr = ctrl_inb(STBCR);
62 ctrl_outb(stbcr | STBCR_STBY | STBCR_MSTP2, STBCR);
63
64 /* set self-refresh */
65 mcr = ctrl_inw(MCR);
66 ctrl_outw(mcr & ~MCR_RFSH, MCR);
67
68 /* set interrupt handler */
69 asm volatile("stc vbr, %0" : "=r" (vbr_old));
70 vbr_new = get_zeroed_page(GFP_ATOMIC);
71 udelay(50);
72 memcpy((void*)(vbr_new + INTR_OFFSET),
73 &wakeup_start, &wakeup_end - &wakeup_start);
74 asm volatile("ldc %0, vbr" : : "r" (vbr_new));
75
76 ctrl_outw(0, RTCNT);
77 ctrl_outw(mcr | MCR_RFSH | MCR_RMODE, MCR);
78
79 cpu_sleep();
80
81 asm volatile("ldc %0, vbr" : : "r" (vbr_old));
82
83 free_page(vbr_new);
84
85 /* enable PLL1 */
86 frqcr = ctrl_inw(FRQCR);
87 frqcr |= FRQCR_PSTBY;
88 ctrl_outw(frqcr, FRQCR);
89 udelay(50);
90 frqcr |= FRQCR_PLLEN;
91 ctrl_outw(frqcr, FRQCR);
92
93 ctrl_outb(stbcr, STBCR);
94
95 clear_bl_bit();
96}
97
22static int hp6x0_pm_enter(suspend_state_t state) 98static int hp6x0_pm_enter(suspend_state_t state)
23{ 99{
24 u8 stbcr, stbcr2; 100 u8 stbcr, stbcr2;
diff --git a/arch/sh/boards/mach-microdev/Makefile b/arch/sh/boards/mach-microdev/Makefile
index 1387dd6c85eb..4e3588e8806b 100644
--- a/arch/sh/boards/mach-microdev/Makefile
+++ b/arch/sh/boards/mach-microdev/Makefile
@@ -2,7 +2,4 @@
2# Makefile for the SuperH MicroDev specific parts of the kernel 2# Makefile for the SuperH MicroDev specific parts of the kernel
3# 3#
4 4
5obj-y := setup.o irq.o io.o 5obj-y := setup.o irq.o io.o fdc37c93xapm.o
6
7obj-$(CONFIG_HEARTBEAT) += led.o
8
diff --git a/arch/sh/boards/mach-microdev/fdc37c93xapm.c b/arch/sh/boards/mach-microdev/fdc37c93xapm.c
new file mode 100644
index 000000000000..458a7cf5fb46
--- /dev/null
+++ b/arch/sh/boards/mach-microdev/fdc37c93xapm.c
@@ -0,0 +1,160 @@
1/*
2 *
3 * Setup for the SMSC FDC37C93xAPM
4 *
5 * Copyright (C) 2003 Sean McGoogan (Sean.McGoogan@superh.com)
6 * Copyright (C) 2003, 2004 SuperH, Inc.
7 * Copyright (C) 2004, 2005 Paul Mundt
8 *
9 * SuperH SH4-202 MicroDev board support.
10 *
11 * May be copied or modified under the terms of the GNU General Public
12 * License. See linux/COPYING for more information.
13 */
14#include <linux/init.h>
15#include <linux/ioport.h>
16#include <linux/io.h>
17#include <linux/err.h>
18#include <mach/microdev.h>
19
20#define SMSC_CONFIG_PORT_ADDR (0x3F0)
21#define SMSC_INDEX_PORT_ADDR SMSC_CONFIG_PORT_ADDR
22#define SMSC_DATA_PORT_ADDR (SMSC_INDEX_PORT_ADDR + 1)
23
24#define SMSC_ENTER_CONFIG_KEY 0x55
25#define SMSC_EXIT_CONFIG_KEY 0xaa
26
27#define SMCS_LOGICAL_DEV_INDEX 0x07 /* Logical Device Number */
28#define SMSC_DEVICE_ID_INDEX 0x20 /* Device ID */
29#define SMSC_DEVICE_REV_INDEX 0x21 /* Device Revision */
30#define SMSC_ACTIVATE_INDEX 0x30 /* Activate */
31#define SMSC_PRIMARY_BASE_INDEX 0x60 /* Primary Base Address */
32#define SMSC_SECONDARY_BASE_INDEX 0x62 /* Secondary Base Address */
33#define SMSC_PRIMARY_INT_INDEX 0x70 /* Primary Interrupt Select */
34#define SMSC_SECONDARY_INT_INDEX 0x72 /* Secondary Interrupt Select */
35#define SMSC_HDCS0_INDEX 0xf0 /* HDCS0 Address Decoder */
36#define SMSC_HDCS1_INDEX 0xf1 /* HDCS1 Address Decoder */
37
38#define SMSC_IDE1_DEVICE 1 /* IDE #1 logical device */
39#define SMSC_IDE2_DEVICE 2 /* IDE #2 logical device */
40#define SMSC_PARALLEL_DEVICE 3 /* Parallel Port logical device */
41#define SMSC_SERIAL1_DEVICE 4 /* Serial #1 logical device */
42#define SMSC_SERIAL2_DEVICE 5 /* Serial #2 logical device */
43#define SMSC_KEYBOARD_DEVICE 7 /* Keyboard logical device */
44#define SMSC_CONFIG_REGISTERS 8 /* Configuration Registers (Aux I/O) */
45
46#define SMSC_READ_INDEXED(index) ({ \
47 outb((index), SMSC_INDEX_PORT_ADDR); \
48 inb(SMSC_DATA_PORT_ADDR); })
49#define SMSC_WRITE_INDEXED(val, index) ({ \
50 outb((index), SMSC_INDEX_PORT_ADDR); \
51 outb((val), SMSC_DATA_PORT_ADDR); })
52
53#define IDE1_PRIMARY_BASE 0x01f0 /* Task File Registe base for IDE #1 */
54#define IDE1_SECONDARY_BASE 0x03f6 /* Miscellaneous AT registers for IDE #1 */
55#define IDE2_PRIMARY_BASE 0x0170 /* Task File Registe base for IDE #2 */
56#define IDE2_SECONDARY_BASE 0x0376 /* Miscellaneous AT registers for IDE #2 */
57
58#define SERIAL1_PRIMARY_BASE 0x03f8
59#define SERIAL2_PRIMARY_BASE 0x02f8
60
61#define MSB(x) ( (x) >> 8 )
62#define LSB(x) ( (x) & 0xff )
63
64 /* General-Purpose base address on CPU-board FPGA */
65#define MICRODEV_FPGA_GP_BASE 0xa6100000ul
66
67static int __init smsc_superio_setup(void)
68{
69
70 unsigned char devid, devrev;
71
72 /* Initially the chip is in run state */
73 /* Put it into configuration state */
74 outb(SMSC_ENTER_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR);
75
76 /* Read device ID info */
77 devid = SMSC_READ_INDEXED(SMSC_DEVICE_ID_INDEX);
78 devrev = SMSC_READ_INDEXED(SMSC_DEVICE_REV_INDEX);
79
80 if ((devid == 0x30) && (devrev == 0x01))
81 printk("SMSC FDC37C93xAPM SuperIO device detected\n");
82 else
83 return -ENODEV;
84
85 /* Select the keyboard device */
86 SMSC_WRITE_INDEXED(SMSC_KEYBOARD_DEVICE, SMCS_LOGICAL_DEV_INDEX);
87 /* enable it */
88 SMSC_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX);
89 /* enable the interrupts */
90 SMSC_WRITE_INDEXED(MICRODEV_FPGA_IRQ_KEYBOARD, SMSC_PRIMARY_INT_INDEX);
91 SMSC_WRITE_INDEXED(MICRODEV_FPGA_IRQ_MOUSE, SMSC_SECONDARY_INT_INDEX);
92
93 /* Select the Serial #1 device */
94 SMSC_WRITE_INDEXED(SMSC_SERIAL1_DEVICE, SMCS_LOGICAL_DEV_INDEX);
95 /* enable it */
96 SMSC_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX);
97 /* program with port addresses */
98 SMSC_WRITE_INDEXED(MSB(SERIAL1_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+0);
99 SMSC_WRITE_INDEXED(LSB(SERIAL1_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+1);
100 SMSC_WRITE_INDEXED(0x00, SMSC_HDCS0_INDEX);
101 /* enable the interrupts */
102 SMSC_WRITE_INDEXED(MICRODEV_FPGA_IRQ_SERIAL1, SMSC_PRIMARY_INT_INDEX);
103
104 /* Select the Serial #2 device */
105 SMSC_WRITE_INDEXED(SMSC_SERIAL2_DEVICE, SMCS_LOGICAL_DEV_INDEX);
106 /* enable it */
107 SMSC_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX);
108 /* program with port addresses */
109 SMSC_WRITE_INDEXED(MSB(SERIAL2_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+0);
110 SMSC_WRITE_INDEXED(LSB(SERIAL2_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+1);
111 SMSC_WRITE_INDEXED(0x00, SMSC_HDCS0_INDEX);
112 /* enable the interrupts */
113 SMSC_WRITE_INDEXED(MICRODEV_FPGA_IRQ_SERIAL2, SMSC_PRIMARY_INT_INDEX);
114
115 /* Select the IDE#1 device */
116 SMSC_WRITE_INDEXED(SMSC_IDE1_DEVICE, SMCS_LOGICAL_DEV_INDEX);
117 /* enable it */
118 SMSC_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX);
119 /* program with port addresses */
120 SMSC_WRITE_INDEXED(MSB(IDE1_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+0);
121 SMSC_WRITE_INDEXED(LSB(IDE1_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+1);
122 SMSC_WRITE_INDEXED(MSB(IDE1_SECONDARY_BASE), SMSC_SECONDARY_BASE_INDEX+0);
123 SMSC_WRITE_INDEXED(LSB(IDE1_SECONDARY_BASE), SMSC_SECONDARY_BASE_INDEX+1);
124 SMSC_WRITE_INDEXED(0x0c, SMSC_HDCS0_INDEX);
125 SMSC_WRITE_INDEXED(0x00, SMSC_HDCS1_INDEX);
126 /* select the interrupt */
127 SMSC_WRITE_INDEXED(MICRODEV_FPGA_IRQ_IDE1, SMSC_PRIMARY_INT_INDEX);
128
129 /* Select the IDE#2 device */
130 SMSC_WRITE_INDEXED(SMSC_IDE2_DEVICE, SMCS_LOGICAL_DEV_INDEX);
131 /* enable it */
132 SMSC_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX);
133 /* program with port addresses */
134 SMSC_WRITE_INDEXED(MSB(IDE2_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+0);
135 SMSC_WRITE_INDEXED(LSB(IDE2_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+1);
136 SMSC_WRITE_INDEXED(MSB(IDE2_SECONDARY_BASE), SMSC_SECONDARY_BASE_INDEX+0);
137 SMSC_WRITE_INDEXED(LSB(IDE2_SECONDARY_BASE), SMSC_SECONDARY_BASE_INDEX+1);
138 /* select the interrupt */
139 SMSC_WRITE_INDEXED(MICRODEV_FPGA_IRQ_IDE2, SMSC_PRIMARY_INT_INDEX);
140
141 /* Select the configuration registers */
142 SMSC_WRITE_INDEXED(SMSC_CONFIG_REGISTERS, SMCS_LOGICAL_DEV_INDEX);
143 /* enable the appropriate GPIO pins for IDE functionality:
144 * bit[0] In/Out 1==input; 0==output
145 * bit[1] Polarity 1==invert; 0==no invert
146 * bit[2] Int Enb #1 1==Enable Combined IRQ #1; 0==disable
147 * bit[3:4] Function Select 00==original; 01==Alternate Function #1
148 */
149 SMSC_WRITE_INDEXED(0x00, 0xc2); /* GP42 = nIDE1_OE */
150 SMSC_WRITE_INDEXED(0x01, 0xc5); /* GP45 = IDE1_IRQ */
151 SMSC_WRITE_INDEXED(0x00, 0xc6); /* GP46 = nIOROP */
152 SMSC_WRITE_INDEXED(0x00, 0xc7); /* GP47 = nIOWOP */
153 SMSC_WRITE_INDEXED(0x08, 0xe8); /* GP20 = nIDE2_OE */
154
155 /* Exit the configuration state */
156 outb(SMSC_EXIT_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR);
157
158 return 0;
159}
160device_initcall(smsc_superio_setup);
diff --git a/arch/sh/boards/mach-microdev/irq.c b/arch/sh/boards/mach-microdev/irq.c
index 702753cbd28f..b551963579c1 100644
--- a/arch/sh/boards/mach-microdev/irq.c
+++ b/arch/sh/boards/mach-microdev/irq.c
@@ -67,27 +67,13 @@ static const struct {
67 67
68static void enable_microdev_irq(unsigned int irq); 68static void enable_microdev_irq(unsigned int irq);
69static void disable_microdev_irq(unsigned int irq); 69static void disable_microdev_irq(unsigned int irq);
70
71 /* shutdown is same as "disable" */
72#define shutdown_microdev_irq disable_microdev_irq
73
74static void mask_and_ack_microdev(unsigned int); 70static void mask_and_ack_microdev(unsigned int);
75static void end_microdev_irq(unsigned int irq);
76
77static unsigned int startup_microdev_irq(unsigned int irq)
78{
79 enable_microdev_irq(irq);
80 return 0; /* never anything pending */
81}
82 71
83static struct hw_interrupt_type microdev_irq_type = { 72static struct irq_chip microdev_irq_type = {
84 .typename = "MicroDev-IRQ", 73 .name = "MicroDev-IRQ",
85 .startup = startup_microdev_irq, 74 .unmask = enable_microdev_irq,
86 .shutdown = shutdown_microdev_irq, 75 .mask = disable_microdev_irq,
87 .enable = enable_microdev_irq,
88 .disable = disable_microdev_irq,
89 .ack = mask_and_ack_microdev, 76 .ack = mask_and_ack_microdev,
90 .end = end_microdev_irq
91}; 77};
92 78
93static void disable_microdev_irq(unsigned int irq) 79static void disable_microdev_irq(unsigned int irq)
@@ -130,11 +116,11 @@ static void enable_microdev_irq(unsigned int irq)
130 ctrl_outl(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTENB_REG); 116 ctrl_outl(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTENB_REG);
131} 117}
132 118
133 /* This functions sets the desired irq handler to be a MicroDev type */ 119/* This function sets the desired irq handler to be a MicroDev type */
134static void __init make_microdev_irq(unsigned int irq) 120static void __init make_microdev_irq(unsigned int irq)
135{ 121{
136 disable_irq_nosync(irq); 122 disable_irq_nosync(irq);
137 irq_desc[irq].chip = &microdev_irq_type; 123 set_irq_chip_and_handler(irq, &microdev_irq_type, handle_level_irq);
138 disable_microdev_irq(irq); 124 disable_microdev_irq(irq);
139} 125}
140 126
@@ -143,17 +129,11 @@ static void mask_and_ack_microdev(unsigned int irq)
143 disable_microdev_irq(irq); 129 disable_microdev_irq(irq);
144} 130}
145 131
146static void end_microdev_irq(unsigned int irq)
147{
148 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
149 enable_microdev_irq(irq);
150}
151
152extern void __init init_microdev_irq(void) 132extern void __init init_microdev_irq(void)
153{ 133{
154 int i; 134 int i;
155 135
156 /* disable interrupts on the FPGA INTC register */ 136 /* disable interrupts on the FPGA INTC register */
157 ctrl_outl(~0ul, MICRODEV_FPGA_INTDSB_REG); 137 ctrl_outl(~0ul, MICRODEV_FPGA_INTDSB_REG);
158 138
159 for (i = 0; i < NUM_EXTERNAL_IRQS; i++) 139 for (i = 0; i < NUM_EXTERNAL_IRQS; i++)
@@ -179,5 +159,3 @@ extern void microdev_print_fpga_intc_status(void)
179 printk("FPGA_INTPRI[3..0] = %08x:%08x:%08x:%08x\n", *intprid, *intpric, *intprib, *intpria); 159 printk("FPGA_INTPRI[3..0] = %08x:%08x:%08x:%08x\n", *intprid, *intpric, *intprib, *intpria);
180 printk("-------------------------------------------------------------------------------\n"); 160 printk("-------------------------------------------------------------------------------\n");
181} 161}
182
183
diff --git a/arch/sh/boards/mach-microdev/led.c b/arch/sh/boards/mach-microdev/led.c
deleted file mode 100644
index 36e54b47a752..000000000000
--- a/arch/sh/boards/mach-microdev/led.c
+++ /dev/null
@@ -1,101 +0,0 @@
1/*
2 * linux/arch/sh/boards/superh/microdev/led.c
3 *
4 * Copyright (C) 2002 Stuart Menefy <stuart.menefy@st.com>
5 * Copyright (C) 2003 Richard Curnow (Richard.Curnow@superh.com)
6 *
7 * May be copied or modified under the terms of the GNU General Public
8 * License. See linux/COPYING for more information.
9 *
10 */
11
12#include <asm/io.h>
13
14#define LED_REGISTER 0xa6104d20
15
16static void mach_led_d9(int value)
17{
18 unsigned long reg;
19 reg = ctrl_inl(LED_REGISTER);
20 reg &= ~1;
21 reg |= (value & 1);
22 ctrl_outl(reg, LED_REGISTER);
23 return;
24}
25
26static void mach_led_d10(int value)
27{
28 unsigned long reg;
29 reg = ctrl_inl(LED_REGISTER);
30 reg &= ~2;
31 reg |= ((value & 1) << 1);
32 ctrl_outl(reg, LED_REGISTER);
33 return;
34}
35
36
37#ifdef CONFIG_HEARTBEAT
38#include <linux/sched.h>
39
40static unsigned char banner_table[] = {
41 0x11, 0x01, 0x11, 0x01, 0x11, 0x03,
42 0x11, 0x01, 0x11, 0x01, 0x13, 0x03,
43 0x11, 0x01, 0x13, 0x01, 0x13, 0x01, 0x11, 0x03,
44 0x11, 0x03,
45 0x11, 0x01, 0x13, 0x01, 0x11, 0x03,
46 0x11, 0x01, 0x11, 0x01, 0x11, 0x01, 0x11, 0x07,
47 0x13, 0x01, 0x13, 0x03,
48 0x11, 0x01, 0x11, 0x03,
49 0x13, 0x01, 0x11, 0x01, 0x13, 0x01, 0x11, 0x03,
50 0x11, 0x01, 0x13, 0x01, 0x11, 0x03,
51 0x13, 0x01, 0x13, 0x01, 0x13, 0x03,
52 0x13, 0x01, 0x11, 0x01, 0x11, 0x03,
53 0x11, 0x03,
54 0x11, 0x01, 0x11, 0x01, 0x11, 0x01, 0x13, 0x07,
55 0xff
56};
57
58static void banner(void)
59{
60 static int pos = 0;
61 static int count = 0;
62
63 if (count) {
64 count--;
65 } else {
66 int val = banner_table[pos];
67 if (val == 0xff) {
68 pos = 0;
69 val = banner_table[pos];
70 }
71 pos++;
72 mach_led_d10((val >> 4) & 1);
73 count = 10 * (val & 0xf);
74 }
75}
76
77/* From heartbeat_harp in the stboards directory */
78/* acts like an actual heart beat -- ie thump-thump-pause... */
79void microdev_heartbeat(void)
80{
81 static unsigned cnt = 0, period = 0, dist = 0;
82
83 if (cnt == 0 || cnt == dist)
84 mach_led_d9(1);
85 else if (cnt == 7 || cnt == dist+7)
86 mach_led_d9(0);
87
88 if (++cnt > period) {
89 cnt = 0;
90 /* The hyperbolic function below modifies the heartbeat period
91 * length in dependency of the current (5min) load. It goes
92 * through the points f(0)=126, f(1)=86, f(5)=51,
93 * f(inf)->30. */
94 period = ((672<<FSHIFT)/(5*avenrun[0]+(7<<FSHIFT))) + 30;
95 dist = period / 4;
96 }
97
98 banner();
99}
100
101#endif
diff --git a/arch/sh/boards/mach-microdev/setup.c b/arch/sh/boards/mach-microdev/setup.c
index a9202fe3cb59..d1df2a4fb9b8 100644
--- a/arch/sh/boards/mach-microdev/setup.c
+++ b/arch/sh/boards/mach-microdev/setup.c
@@ -17,70 +17,12 @@
17#include <mach/microdev.h> 17#include <mach/microdev.h>
18#include <asm/io.h> 18#include <asm/io.h>
19#include <asm/machvec.h> 19#include <asm/machvec.h>
20 20#include <asm/sizes.h>
21extern void microdev_heartbeat(void);
22
23
24/****************************************************************************/
25
26
27 /*
28 * Setup for the SMSC FDC37C93xAPM
29 */
30#define SMSC_CONFIG_PORT_ADDR (0x3F0)
31#define SMSC_INDEX_PORT_ADDR SMSC_CONFIG_PORT_ADDR
32#define SMSC_DATA_PORT_ADDR (SMSC_INDEX_PORT_ADDR + 1)
33
34#define SMSC_ENTER_CONFIG_KEY 0x55
35#define SMSC_EXIT_CONFIG_KEY 0xaa
36
37#define SMCS_LOGICAL_DEV_INDEX 0x07 /* Logical Device Number */
38#define SMSC_DEVICE_ID_INDEX 0x20 /* Device ID */
39#define SMSC_DEVICE_REV_INDEX 0x21 /* Device Revision */
40#define SMSC_ACTIVATE_INDEX 0x30 /* Activate */
41#define SMSC_PRIMARY_BASE_INDEX 0x60 /* Primary Base Address */
42#define SMSC_SECONDARY_BASE_INDEX 0x62 /* Secondary Base Address */
43#define SMSC_PRIMARY_INT_INDEX 0x70 /* Primary Interrupt Select */
44#define SMSC_SECONDARY_INT_INDEX 0x72 /* Secondary Interrupt Select */
45#define SMSC_HDCS0_INDEX 0xf0 /* HDCS0 Address Decoder */
46#define SMSC_HDCS1_INDEX 0xf1 /* HDCS1 Address Decoder */
47
48#define SMSC_IDE1_DEVICE 1 /* IDE #1 logical device */
49#define SMSC_IDE2_DEVICE 2 /* IDE #2 logical device */
50#define SMSC_PARALLEL_DEVICE 3 /* Parallel Port logical device */
51#define SMSC_SERIAL1_DEVICE 4 /* Serial #1 logical device */
52#define SMSC_SERIAL2_DEVICE 5 /* Serial #2 logical device */
53#define SMSC_KEYBOARD_DEVICE 7 /* Keyboard logical device */
54#define SMSC_CONFIG_REGISTERS 8 /* Configuration Registers (Aux I/O) */
55
56#define SMSC_READ_INDEXED(index) ({ \
57 outb((index), SMSC_INDEX_PORT_ADDR); \
58 inb(SMSC_DATA_PORT_ADDR); })
59#define SMSC_WRITE_INDEXED(val, index) ({ \
60 outb((index), SMSC_INDEX_PORT_ADDR); \
61 outb((val), SMSC_DATA_PORT_ADDR); })
62
63#define IDE1_PRIMARY_BASE 0x01f0 /* Task File Registe base for IDE #1 */
64#define IDE1_SECONDARY_BASE 0x03f6 /* Miscellaneous AT registers for IDE #1 */
65#define IDE2_PRIMARY_BASE 0x0170 /* Task File Registe base for IDE #2 */
66#define IDE2_SECONDARY_BASE 0x0376 /* Miscellaneous AT registers for IDE #2 */
67
68#define SERIAL1_PRIMARY_BASE 0x03f8
69#define SERIAL2_PRIMARY_BASE 0x02f8
70
71#define MSB(x) ( (x) >> 8 )
72#define LSB(x) ( (x) & 0xff )
73
74 /* General-Purpose base address on CPU-board FPGA */
75#define MICRODEV_FPGA_GP_BASE 0xa6100000ul
76
77 /* assume a Keyboard Controller is present */
78int microdev_kbd_controller_present = 1;
79 21
80static struct resource smc91x_resources[] = { 22static struct resource smc91x_resources[] = {
81 [0] = { 23 [0] = {
82 .start = 0x300, 24 .start = 0x300,
83 .end = 0x300 + 0x0001000 - 1, 25 .end = 0x300 + SZ_4K - 1,
84 .flags = IORESOURCE_MEM, 26 .flags = IORESOURCE_MEM,
85 }, 27 },
86 [1] = { 28 [1] = {
@@ -97,7 +39,6 @@ static struct platform_device smc91x_device = {
97 .resource = smc91x_resources, 39 .resource = smc91x_resources,
98}; 40};
99 41
100#ifdef CONFIG_FB_S1D13XXX
101static struct s1d13xxxfb_regval s1d13806_initregs[] = { 42static struct s1d13xxxfb_regval s1d13806_initregs[] = {
102 { S1DREG_MISC, 0x00 }, 43 { S1DREG_MISC, 0x00 },
103 { S1DREG_COM_DISP_MODE, 0x00 }, 44 { S1DREG_COM_DISP_MODE, 0x00 },
@@ -216,12 +157,12 @@ static struct s1d13xxxfb_pdata s1d13806_platform_data = {
216static struct resource s1d13806_resources[] = { 157static struct resource s1d13806_resources[] = {
217 [0] = { 158 [0] = {
218 .start = 0x07200000, 159 .start = 0x07200000,
219 .end = 0x07200000 + 0x00200000 - 1, 160 .end = 0x07200000 + SZ_2M - 1,
220 .flags = IORESOURCE_MEM, 161 .flags = IORESOURCE_MEM,
221 }, 162 },
222 [1] = { 163 [1] = {
223 .start = 0x07000000, 164 .start = 0x07000000,
224 .end = 0x07000000 + 0x00200000 - 1, 165 .end = 0x07000000 + SZ_2M - 1,
225 .flags = IORESOURCE_MEM, 166 .flags = IORESOURCE_MEM,
226 }, 167 },
227}; 168};
@@ -236,145 +177,24 @@ static struct platform_device s1d13806_device = {
236 .platform_data = &s1d13806_platform_data, 177 .platform_data = &s1d13806_platform_data,
237 }, 178 },
238}; 179};
239#endif
240 180
241static struct platform_device *microdev_devices[] __initdata = { 181static struct platform_device *microdev_devices[] __initdata = {
242 &smc91x_device, 182 &smc91x_device,
243#ifdef CONFIG_FB_S1D13XXX
244 &s1d13806_device, 183 &s1d13806_device,
245#endif
246}; 184};
247 185
248static int __init microdev_devices_setup(void) 186static int __init microdev_devices_setup(void)
249{ 187{
250 return platform_add_devices(microdev_devices, ARRAY_SIZE(microdev_devices)); 188 return platform_add_devices(microdev_devices, ARRAY_SIZE(microdev_devices));
251} 189}
252 190device_initcall(microdev_devices_setup);
253/*
254 * Setup for the SMSC FDC37C93xAPM
255 */
256static int __init smsc_superio_setup(void)
257{
258
259 unsigned char devid, devrev;
260
261 /* Initially the chip is in run state */
262 /* Put it into configuration state */
263 outb(SMSC_ENTER_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR);
264
265 /* Read device ID info */
266 devid = SMSC_READ_INDEXED(SMSC_DEVICE_ID_INDEX);
267 devrev = SMSC_READ_INDEXED(SMSC_DEVICE_REV_INDEX);
268 if ( (devid==0x30) && (devrev==0x01) )
269 {
270 printk("SMSC FDC37C93xAPM SuperIO device detected\n");
271 }
272 else
273 { /* not the device identity we expected */
274 printk("Not detected a SMSC FDC37C93xAPM SuperIO device (devid=0x%02x, rev=0x%02x)\n",
275 devid, devrev);
276 /* inform the keyboard driver that we have no keyboard controller */
277 microdev_kbd_controller_present = 0;
278 /* little point in doing anything else in this functon */
279 return 0;
280 }
281
282 /* Select the keyboard device */
283 SMSC_WRITE_INDEXED(SMSC_KEYBOARD_DEVICE, SMCS_LOGICAL_DEV_INDEX);
284 /* enable it */
285 SMSC_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX);
286 /* enable the interrupts */
287 SMSC_WRITE_INDEXED(MICRODEV_FPGA_IRQ_KEYBOARD, SMSC_PRIMARY_INT_INDEX);
288 SMSC_WRITE_INDEXED(MICRODEV_FPGA_IRQ_MOUSE, SMSC_SECONDARY_INT_INDEX);
289
290 /* Select the Serial #1 device */
291 SMSC_WRITE_INDEXED(SMSC_SERIAL1_DEVICE, SMCS_LOGICAL_DEV_INDEX);
292 /* enable it */
293 SMSC_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX);
294 /* program with port addresses */
295 SMSC_WRITE_INDEXED(MSB(SERIAL1_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+0);
296 SMSC_WRITE_INDEXED(LSB(SERIAL1_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+1);
297 SMSC_WRITE_INDEXED(0x00, SMSC_HDCS0_INDEX);
298 /* enable the interrupts */
299 SMSC_WRITE_INDEXED(MICRODEV_FPGA_IRQ_SERIAL1, SMSC_PRIMARY_INT_INDEX);
300
301 /* Select the Serial #2 device */
302 SMSC_WRITE_INDEXED(SMSC_SERIAL2_DEVICE, SMCS_LOGICAL_DEV_INDEX);
303 /* enable it */
304 SMSC_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX);
305 /* program with port addresses */
306 SMSC_WRITE_INDEXED(MSB(SERIAL2_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+0);
307 SMSC_WRITE_INDEXED(LSB(SERIAL2_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+1);
308 SMSC_WRITE_INDEXED(0x00, SMSC_HDCS0_INDEX);
309 /* enable the interrupts */
310 SMSC_WRITE_INDEXED(MICRODEV_FPGA_IRQ_SERIAL2, SMSC_PRIMARY_INT_INDEX);
311
312 /* Select the IDE#1 device */
313 SMSC_WRITE_INDEXED(SMSC_IDE1_DEVICE, SMCS_LOGICAL_DEV_INDEX);
314 /* enable it */
315 SMSC_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX);
316 /* program with port addresses */
317 SMSC_WRITE_INDEXED(MSB(IDE1_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+0);
318 SMSC_WRITE_INDEXED(LSB(IDE1_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+1);
319 SMSC_WRITE_INDEXED(MSB(IDE1_SECONDARY_BASE), SMSC_SECONDARY_BASE_INDEX+0);
320 SMSC_WRITE_INDEXED(LSB(IDE1_SECONDARY_BASE), SMSC_SECONDARY_BASE_INDEX+1);
321 SMSC_WRITE_INDEXED(0x0c, SMSC_HDCS0_INDEX);
322 SMSC_WRITE_INDEXED(0x00, SMSC_HDCS1_INDEX);
323 /* select the interrupt */
324 SMSC_WRITE_INDEXED(MICRODEV_FPGA_IRQ_IDE1, SMSC_PRIMARY_INT_INDEX);
325
326 /* Select the IDE#2 device */
327 SMSC_WRITE_INDEXED(SMSC_IDE2_DEVICE, SMCS_LOGICAL_DEV_INDEX);
328 /* enable it */
329 SMSC_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX);
330 /* program with port addresses */
331 SMSC_WRITE_INDEXED(MSB(IDE2_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+0);
332 SMSC_WRITE_INDEXED(LSB(IDE2_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+1);
333 SMSC_WRITE_INDEXED(MSB(IDE2_SECONDARY_BASE), SMSC_SECONDARY_BASE_INDEX+0);
334 SMSC_WRITE_INDEXED(LSB(IDE2_SECONDARY_BASE), SMSC_SECONDARY_BASE_INDEX+1);
335 /* select the interrupt */
336 SMSC_WRITE_INDEXED(MICRODEV_FPGA_IRQ_IDE2, SMSC_PRIMARY_INT_INDEX);
337
338 /* Select the configuration registers */
339 SMSC_WRITE_INDEXED(SMSC_CONFIG_REGISTERS, SMCS_LOGICAL_DEV_INDEX);
340 /* enable the appropriate GPIO pins for IDE functionality:
341 * bit[0] In/Out 1==input; 0==output
342 * bit[1] Polarity 1==invert; 0==no invert
343 * bit[2] Int Enb #1 1==Enable Combined IRQ #1; 0==disable
344 * bit[3:4] Function Select 00==original; 01==Alternate Function #1
345 */
346 SMSC_WRITE_INDEXED(0x00, 0xc2); /* GP42 = nIDE1_OE */
347 SMSC_WRITE_INDEXED(0x01, 0xc5); /* GP45 = IDE1_IRQ */
348 SMSC_WRITE_INDEXED(0x00, 0xc6); /* GP46 = nIOROP */
349 SMSC_WRITE_INDEXED(0x00, 0xc7); /* GP47 = nIOWOP */
350 SMSC_WRITE_INDEXED(0x08, 0xe8); /* GP20 = nIDE2_OE */
351
352 /* Exit the configuration state */
353 outb(SMSC_EXIT_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR);
354
355 return 0;
356}
357
358static void __init microdev_setup(char **cmdline_p)
359{
360 int * const fpgaRevisionRegister = (int*)(MICRODEV_FPGA_GP_BASE + 0x8ul);
361 const int fpgaRevision = *fpgaRevisionRegister;
362 int * const CacheControlRegister = (int*)CCR;
363
364 device_initcall(microdev_devices_setup);
365 device_initcall(smsc_superio_setup);
366
367 printk("SuperH %s board (FPGA rev: 0x%0x, CCR: 0x%0x)\n",
368 get_system_type(), fpgaRevision, *CacheControlRegister);
369}
370 191
371/* 192/*
372 * The Machine Vector 193 * The Machine Vector
373 */ 194 */
374static struct sh_machine_vector mv_sh4202_microdev __initmv = { 195static struct sh_machine_vector mv_sh4202_microdev __initmv = {
375 .mv_name = "SH4-202 MicroDev", 196 .mv_name = "SH4-202 MicroDev",
376 .mv_setup = microdev_setup, 197 .mv_nr_irqs = 72,
377 .mv_nr_irqs = 72, /* QQQ need to check this - use the MACRO */
378 198
379 .mv_inb = microdev_inb, 199 .mv_inb = microdev_inb,
380 .mv_inw = microdev_inw, 200 .mv_inw = microdev_inw,
@@ -398,8 +218,4 @@ static struct sh_machine_vector mv_sh4202_microdev __initmv = {
398 .mv_outsl = microdev_outsl, 218 .mv_outsl = microdev_outsl,
399 219
400 .mv_init_irq = init_microdev_irq, 220 .mv_init_irq = init_microdev_irq,
401
402#ifdef CONFIG_HEARTBEAT
403 .mv_heartbeat = microdev_heartbeat,
404#endif
405}; 221};
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
index 975281980299..cc1408119c24 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -89,6 +89,7 @@ static struct resource sh_keysc_resources[] = {
89 89
90static struct platform_device sh_keysc_device = { 90static struct platform_device sh_keysc_device = {
91 .name = "sh_keysc", 91 .name = "sh_keysc",
92 .id = 0, /* "keysc0" clock */
92 .num_resources = ARRAY_SIZE(sh_keysc_resources), 93 .num_resources = ARRAY_SIZE(sh_keysc_resources),
93 .resource = sh_keysc_resources, 94 .resource = sh_keysc_resources,
94 .dev = { 95 .dev = {
@@ -261,6 +262,8 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
261 .sys_bus_cfg = { 262 .sys_bus_cfg = {
262 .ldmt2r = 0x06000a09, 263 .ldmt2r = 0x06000a09,
263 .ldmt3r = 0x180e3418, 264 .ldmt3r = 0x180e3418,
265 /* set 1s delay to encourage fsync() */
266 .deferred_io_msec = 1000,
264 }, 267 },
265 } 268 }
266#endif 269#endif
@@ -273,6 +276,10 @@ static struct resource migor_lcdc_resources[] = {
273 .end = 0xfe941fff, 276 .end = 0xfe941fff,
274 .flags = IORESOURCE_MEM, 277 .flags = IORESOURCE_MEM,
275 }, 278 },
279 [1] = {
280 .start = 28,
281 .flags = IORESOURCE_IRQ,
282 },
276}; 283};
277 284
278static struct platform_device migor_lcdc_device = { 285static struct platform_device migor_lcdc_device = {
@@ -300,6 +307,7 @@ static void camera_power_on(void)
300 gpio_set_value(GPIO_PTT3, 0); 307 gpio_set_value(GPIO_PTT3, 0);
301 mdelay(10); 308 mdelay(10);
302 gpio_set_value(GPIO_PTT3, 1); 309 gpio_set_value(GPIO_PTT3, 1);
310 mdelay(10); /* wait to let chip come out of reset */
303} 311}
304 312
305static void camera_power_off(void) 313static void camera_power_off(void)
@@ -432,6 +440,7 @@ static struct resource migor_ceu_resources[] = {
432 440
433static struct platform_device migor_ceu_device = { 441static struct platform_device migor_ceu_device = {
434 .name = "sh_mobile_ceu", 442 .name = "sh_mobile_ceu",
443 .id = 0, /* "ceu0" clock */
435 .num_resources = ARRAY_SIZE(migor_ceu_resources), 444 .num_resources = ARRAY_SIZE(migor_ceu_resources),
436 .resource = migor_ceu_resources, 445 .resource = migor_ceu_resources,
437 .dev = { 446 .dev = {
@@ -479,7 +488,6 @@ static int __init migor_devices_setup(void)
479 ctrl_outl(0x00110080, BSC_CS4WCR); 488 ctrl_outl(0x00110080, BSC_CS4WCR);
480 489
481 /* KEYSC */ 490 /* KEYSC */
482 clk_always_enable("mstp214"); /* KEYSC */
483 gpio_request(GPIO_FN_KEYOUT0, NULL); 491 gpio_request(GPIO_FN_KEYOUT0, NULL);
484 gpio_request(GPIO_FN_KEYOUT1, NULL); 492 gpio_request(GPIO_FN_KEYOUT1, NULL);
485 gpio_request(GPIO_FN_KEYOUT2, NULL); 493 gpio_request(GPIO_FN_KEYOUT2, NULL);
@@ -501,7 +509,6 @@ static int __init migor_devices_setup(void)
501 gpio_request(GPIO_FN_IRQ6, NULL); 509 gpio_request(GPIO_FN_IRQ6, NULL);
502 510
503 /* LCD Panel */ 511 /* LCD Panel */
504 clk_always_enable("mstp200"); /* LCDC */
505#ifdef CONFIG_SH_MIGOR_QVGA /* LCDC - QVGA - Enable SYS Interface signals */ 512#ifdef CONFIG_SH_MIGOR_QVGA /* LCDC - QVGA - Enable SYS Interface signals */
506 gpio_request(GPIO_FN_LCDD17, NULL); 513 gpio_request(GPIO_FN_LCDD17, NULL);
507 gpio_request(GPIO_FN_LCDD16, NULL); 514 gpio_request(GPIO_FN_LCDD16, NULL);
@@ -554,7 +561,6 @@ static int __init migor_devices_setup(void)
554#endif 561#endif
555 562
556 /* CEU */ 563 /* CEU */
557 clk_always_enable("mstp203"); /* CEU */
558 gpio_request(GPIO_FN_VIO_CLK2, NULL); 564 gpio_request(GPIO_FN_VIO_CLK2, NULL);
559 gpio_request(GPIO_FN_VIO_VD2, NULL); 565 gpio_request(GPIO_FN_VIO_VD2, NULL);
560 gpio_request(GPIO_FN_VIO_HD2, NULL); 566 gpio_request(GPIO_FN_VIO_HD2, NULL);
@@ -589,12 +595,3 @@ static int __init migor_devices_setup(void)
589 return platform_add_devices(migor_devices, ARRAY_SIZE(migor_devices)); 595 return platform_add_devices(migor_devices, ARRAY_SIZE(migor_devices));
590} 596}
591__initcall(migor_devices_setup); 597__initcall(migor_devices_setup);
592
593static void __init migor_setup(char **cmdline_p)
594{
595}
596
597static struct sh_machine_vector mv_migor __initmv = {
598 .mv_name = "Migo-R",
599 .mv_setup = migor_setup,
600};
diff --git a/arch/sh/boards/mach-rsk/Kconfig b/arch/sh/boards/mach-rsk/Kconfig
new file mode 100644
index 000000000000..bff095dffc02
--- /dev/null
+++ b/arch/sh/boards/mach-rsk/Kconfig
@@ -0,0 +1,18 @@
1if SH_RSK
2
3choice
4 prompt "RSK+ options"
5 default SH_RSK7203
6
7config SH_RSK7201
8 bool "RSK7201"
9 depends on CPU_SUBTYPE_SH7201
10
11config SH_RSK7203
12 bool "RSK7203"
13 select GENERIC_GPIO
14 depends on CPU_SUBTYPE_SH7203
15
16endchoice
17
18endif
diff --git a/arch/sh/boards/mach-rsk/Makefile b/arch/sh/boards/mach-rsk/Makefile
new file mode 100644
index 000000000000..498da75ce38b
--- /dev/null
+++ b/arch/sh/boards/mach-rsk/Makefile
@@ -0,0 +1,2 @@
1obj-y := setup.o
2obj-$(CONFIG_SH_RSK7203) += devices-rsk7203.o
diff --git a/arch/sh/boards/board-rsk7203.c b/arch/sh/boards/mach-rsk/devices-rsk7203.c
index 58266f06134a..73f743b9be8d 100644
--- a/arch/sh/boards/board-rsk7203.c
+++ b/arch/sh/boards/mach-rsk/devices-rsk7203.c
@@ -50,73 +50,6 @@ static struct platform_device smc911x_device = {
50 }, 50 },
51}; 51};
52 52
53static const char *probes[] = { "cmdlinepart", NULL };
54
55static struct mtd_partition *parsed_partitions;
56
57static struct mtd_partition rsk7203_partitions[] = {
58 {
59 .name = "Bootloader",
60 .offset = 0x00000000,
61 .size = 0x00040000,
62 .mask_flags = MTD_WRITEABLE,
63 }, {
64 .name = "Kernel",
65 .offset = MTDPART_OFS_NXTBLK,
66 .size = 0x001c0000,
67 }, {
68 .name = "Flash_FS",
69 .offset = MTDPART_OFS_NXTBLK,
70 .size = MTDPART_SIZ_FULL,
71 }
72};
73
74static struct physmap_flash_data flash_data = {
75 .width = 2,
76};
77
78static struct resource flash_resource = {
79 .start = 0x20000000,
80 .end = 0x20400000,
81 .flags = IORESOURCE_MEM,
82};
83
84static struct platform_device flash_device = {
85 .name = "physmap-flash",
86 .id = -1,
87 .resource = &flash_resource,
88 .num_resources = 1,
89 .dev = {
90 .platform_data = &flash_data,
91 },
92};
93
94static struct mtd_info *flash_mtd;
95
96static struct map_info rsk7203_flash_map = {
97 .name = "RSK+ Flash",
98 .size = 0x400000,
99 .bankwidth = 2,
100};
101
102static void __init set_mtd_partitions(void)
103{
104 int nr_parts = 0;
105
106 simple_map_init(&rsk7203_flash_map);
107 flash_mtd = do_map_probe("cfi_probe", &rsk7203_flash_map);
108 nr_parts = parse_mtd_partitions(flash_mtd, probes,
109 &parsed_partitions, 0);
110 /* If there is no partition table, used the hard coded table */
111 if (nr_parts <= 0) {
112 flash_data.parts = rsk7203_partitions;
113 flash_data.nr_parts = ARRAY_SIZE(rsk7203_partitions);
114 } else {
115 flash_data.nr_parts = nr_parts;
116 flash_data.parts = parsed_partitions;
117 }
118}
119
120static struct gpio_led rsk7203_gpio_leds[] = { 53static struct gpio_led rsk7203_gpio_leds[] = {
121 { 54 {
122 .name = "green", 55 .name = "green",
@@ -155,7 +88,6 @@ static struct platform_device led_device = {
155 88
156static struct platform_device *rsk7203_devices[] __initdata = { 89static struct platform_device *rsk7203_devices[] __initdata = {
157 &smc911x_device, 90 &smc911x_device,
158 &flash_device,
159 &led_device, 91 &led_device,
160}; 92};
161 93
@@ -165,15 +97,7 @@ static int __init rsk7203_devices_setup(void)
165 gpio_request(GPIO_FN_TXD0, NULL); 97 gpio_request(GPIO_FN_TXD0, NULL);
166 gpio_request(GPIO_FN_RXD0, NULL); 98 gpio_request(GPIO_FN_RXD0, NULL);
167 99
168 set_mtd_partitions();
169 return platform_add_devices(rsk7203_devices, 100 return platform_add_devices(rsk7203_devices,
170 ARRAY_SIZE(rsk7203_devices)); 101 ARRAY_SIZE(rsk7203_devices));
171} 102}
172device_initcall(rsk7203_devices_setup); 103device_initcall(rsk7203_devices_setup);
173
174/*
175 * The Machine Vector
176 */
177static struct sh_machine_vector mv_rsk7203 __initmv = {
178 .mv_name = "RSK+7203",
179};
diff --git a/arch/sh/boards/mach-rsk/setup.c b/arch/sh/boards/mach-rsk/setup.c
new file mode 100644
index 000000000000..af64d030a5c7
--- /dev/null
+++ b/arch/sh/boards/mach-rsk/setup.c
@@ -0,0 +1,106 @@
1/*
2 * Renesas Technology Europe RSK+ Support.
3 *
4 * Copyright (C) 2008 Paul Mundt
5 * Copyright (C) 2008 Peter Griffin <pgriffin@mpc-data.co.uk>
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#include <linux/init.h>
12#include <linux/types.h>
13#include <linux/platform_device.h>
14#include <linux/interrupt.h>
15#include <linux/mtd/mtd.h>
16#include <linux/mtd/partitions.h>
17#include <linux/mtd/physmap.h>
18#include <linux/mtd/map.h>
19#include <asm/machvec.h>
20#include <asm/io.h>
21
22static const char *probes[] = { "cmdlinepart", NULL };
23
24static struct mtd_partition *parsed_partitions;
25
26static struct mtd_partition rsk_partitions[] = {
27 {
28 .name = "Bootloader",
29 .offset = 0x00000000,
30 .size = 0x00040000,
31 .mask_flags = MTD_WRITEABLE,
32 }, {
33 .name = "Kernel",
34 .offset = MTDPART_OFS_NXTBLK,
35 .size = 0x001c0000,
36 }, {
37 .name = "Flash_FS",
38 .offset = MTDPART_OFS_NXTBLK,
39 .size = MTDPART_SIZ_FULL,
40 }
41};
42
43static struct physmap_flash_data flash_data = {
44 .width = 2,
45};
46
47static struct resource flash_resource = {
48 .start = 0x20000000,
49 .end = 0x20400000,
50 .flags = IORESOURCE_MEM,
51};
52
53static struct platform_device flash_device = {
54 .name = "physmap-flash",
55 .id = -1,
56 .resource = &flash_resource,
57 .num_resources = 1,
58 .dev = {
59 .platform_data = &flash_data,
60 },
61};
62
63static struct mtd_info *flash_mtd;
64
65static struct map_info rsk_flash_map = {
66 .name = "RSK+ Flash",
67 .size = 0x400000,
68 .bankwidth = 2,
69};
70
71static void __init set_mtd_partitions(void)
72{
73 int nr_parts = 0;
74
75 simple_map_init(&rsk_flash_map);
76 flash_mtd = do_map_probe("cfi_probe", &rsk_flash_map);
77 nr_parts = parse_mtd_partitions(flash_mtd, probes,
78 &parsed_partitions, 0);
79 /* If there is no partition table, used the hard coded table */
80 if (nr_parts <= 0) {
81 flash_data.parts = rsk_partitions;
82 flash_data.nr_parts = ARRAY_SIZE(rsk_partitions);
83 } else {
84 flash_data.nr_parts = nr_parts;
85 flash_data.parts = parsed_partitions;
86 }
87}
88
89static struct platform_device *rsk_devices[] __initdata = {
90 &flash_device,
91};
92
93static int __init rsk_devices_setup(void)
94{
95 set_mtd_partitions();
96 return platform_add_devices(rsk_devices,
97 ARRAY_SIZE(rsk_devices));
98}
99device_initcall(rsk_devices_setup);
100
101/*
102 * The Machine Vector
103 */
104static struct sh_machine_vector mv_rsk __initmv = {
105 .mv_name = "RSK+",
106};
diff --git a/arch/sh/boards/mach-se/7343/Makefile b/arch/sh/boards/mach-se/7343/Makefile
index 3024796c6203..4c3666a93790 100644
--- a/arch/sh/boards/mach-se/7343/Makefile
+++ b/arch/sh/boards/mach-se/7343/Makefile
@@ -2,4 +2,4 @@
2# Makefile for the 7343 SolutionEngine specific parts of the kernel 2# Makefile for the 7343 SolutionEngine specific parts of the kernel
3# 3#
4 4
5obj-y := setup.o io.o irq.o 5obj-y := setup.o irq.o
diff --git a/arch/sh/boards/mach-se/7343/io.c b/arch/sh/boards/mach-se/7343/io.c
deleted file mode 100644
index 8741abc1da7b..000000000000
--- a/arch/sh/boards/mach-se/7343/io.c
+++ /dev/null
@@ -1,273 +0,0 @@
1/*
2 * arch/sh/boards/se/7343/io.c
3 *
4 * I/O routine for SH-Mobile3AS 7343 SolutionEngine.
5 *
6 */
7#include <linux/kernel.h>
8#include <asm/io.h>
9#include <mach-se/mach/se7343.h>
10
11#define badio(fn, a) panic("bad i/o operation %s for %08lx.", #fn, a)
12
13struct iop {
14 unsigned long start, end;
15 unsigned long base;
16 struct iop *(*check) (struct iop * p, unsigned long port);
17 unsigned char (*inb) (struct iop * p, unsigned long port);
18 unsigned short (*inw) (struct iop * p, unsigned long port);
19 void (*outb) (struct iop * p, unsigned char value, unsigned long port);
20 void (*outw) (struct iop * p, unsigned short value, unsigned long port);
21};
22
23struct iop *
24simple_check(struct iop *p, unsigned long port)
25{
26 static int count;
27
28 if (count < 100)
29 count++;
30
31 port &= 0xFFFF;
32
33 if ((p->start <= port) && (port <= p->end))
34 return p;
35 else
36 badio(check, port);
37}
38
39struct iop *
40ide_check(struct iop *p, unsigned long port)
41{
42 if (((0x1f0 <= port) && (port <= 0x1f7)) || (port == 0x3f7))
43 return p;
44 return NULL;
45}
46
47unsigned char
48simple_inb(struct iop *p, unsigned long port)
49{
50 return *(unsigned char *) (p->base + port);
51}
52
53unsigned short
54simple_inw(struct iop *p, unsigned long port)
55{
56 return *(unsigned short *) (p->base + port);
57}
58
59void
60simple_outb(struct iop *p, unsigned char value, unsigned long port)
61{
62 *(unsigned char *) (p->base + port) = value;
63}
64
65void
66simple_outw(struct iop *p, unsigned short value, unsigned long port)
67{
68 *(unsigned short *) (p->base + port) = value;
69}
70
71unsigned char
72pcc_inb(struct iop *p, unsigned long port)
73{
74 unsigned long addr = p->base + port + 0x40000;
75 unsigned long v;
76
77 if (port & 1)
78 addr += 0x00400000;
79 v = *(volatile unsigned char *) addr;
80 return v;
81}
82
83void
84pcc_outb(struct iop *p, unsigned char value, unsigned long port)
85{
86 unsigned long addr = p->base + port + 0x40000;
87
88 if (port & 1)
89 addr += 0x00400000;
90 *(volatile unsigned char *) addr = value;
91}
92
93unsigned char
94bad_inb(struct iop *p, unsigned long port)
95{
96 badio(inb, port);
97}
98
99void
100bad_outb(struct iop *p, unsigned char value, unsigned long port)
101{
102 badio(inw, port);
103}
104
105#ifdef CONFIG_SMC91X
106/* MSTLANEX01 LAN at 0xb400:0000 */
107static struct iop laniop = {
108 .start = 0x00,
109 .end = 0x0F,
110 .base = 0x04000000,
111 .check = simple_check,
112 .inb = simple_inb,
113 .inw = simple_inw,
114 .outb = simple_outb,
115 .outw = simple_outw,
116};
117#endif
118
119#ifdef CONFIG_NE2000
120/* NE2000 pc card NIC */
121static struct iop neiop = {
122 .start = 0x280,
123 .end = 0x29f,
124 .base = 0xb0600000 + 0x80, /* soft 0x280 -> hard 0x300 */
125 .check = simple_check,
126 .inb = pcc_inb,
127 .inw = simple_inw,
128 .outb = pcc_outb,
129 .outw = simple_outw,
130};
131#endif
132
133#ifdef CONFIG_IDE
134/* CF in CF slot */
135static struct iop cfiop = {
136 .base = 0xb0600000,
137 .check = ide_check,
138 .inb = pcc_inb,
139 .inw = simple_inw,
140 .outb = pcc_outb,
141 .outw = simple_outw,
142};
143#endif
144
145static __inline__ struct iop *
146port2iop(unsigned long port)
147{
148 if (0) ;
149#if defined(CONFIG_SMC91X)
150 else if (laniop.check(&laniop, port))
151 return &laniop;
152#endif
153#if defined(CONFIG_NE2000)
154 else if (neiop.check(&neiop, port))
155 return &neiop;
156#endif
157#if defined(CONFIG_IDE)
158 else if (cfiop.check(&cfiop, port))
159 return &cfiop;
160#endif
161 else
162 return NULL;
163}
164
165static inline void
166delay(void)
167{
168 ctrl_inw(0xac000000);
169 ctrl_inw(0xac000000);
170}
171
172unsigned char
173sh7343se_inb(unsigned long port)
174{
175 struct iop *p = port2iop(port);
176 return (p->inb) (p, port);
177}
178
179unsigned char
180sh7343se_inb_p(unsigned long port)
181{
182 unsigned char v = sh7343se_inb(port);
183 delay();
184 return v;
185}
186
187unsigned short
188sh7343se_inw(unsigned long port)
189{
190 struct iop *p = port2iop(port);
191 return (p->inw) (p, port);
192}
193
194unsigned int
195sh7343se_inl(unsigned long port)
196{
197 badio(inl, port);
198}
199
200void
201sh7343se_outb(unsigned char value, unsigned long port)
202{
203 struct iop *p = port2iop(port);
204 (p->outb) (p, value, port);
205}
206
207void
208sh7343se_outb_p(unsigned char value, unsigned long port)
209{
210 sh7343se_outb(value, port);
211 delay();
212}
213
214void
215sh7343se_outw(unsigned short value, unsigned long port)
216{
217 struct iop *p = port2iop(port);
218 (p->outw) (p, value, port);
219}
220
221void
222sh7343se_outl(unsigned int value, unsigned long port)
223{
224 badio(outl, port);
225}
226
227void
228sh7343se_insb(unsigned long port, void *addr, unsigned long count)
229{
230 unsigned char *a = addr;
231 struct iop *p = port2iop(port);
232 while (count--)
233 *a++ = (p->inb) (p, port);
234}
235
236void
237sh7343se_insw(unsigned long port, void *addr, unsigned long count)
238{
239 unsigned short *a = addr;
240 struct iop *p = port2iop(port);
241 while (count--)
242 *a++ = (p->inw) (p, port);
243}
244
245void
246sh7343se_insl(unsigned long port, void *addr, unsigned long count)
247{
248 badio(insl, port);
249}
250
251void
252sh7343se_outsb(unsigned long port, const void *addr, unsigned long count)
253{
254 unsigned char *a = (unsigned char *) addr;
255 struct iop *p = port2iop(port);
256 while (count--)
257 (p->outb) (p, *a++, port);
258}
259
260void
261sh7343se_outsw(unsigned long port, const void *addr, unsigned long count)
262{
263 unsigned short *a = (unsigned short *) addr;
264 struct iop *p = port2iop(port);
265 while (count--)
266 (p->outw) (p, *a++, port);
267}
268
269void
270sh7343se_outsl(unsigned long port, const void *addr, unsigned long count)
271{
272 badio(outsw, port);
273}
diff --git a/arch/sh/boards/mach-se/7343/setup.c b/arch/sh/boards/mach-se/7343/setup.c
index 486f40bf9274..4de56f35f419 100644
--- a/arch/sh/boards/mach-se/7343/setup.c
+++ b/arch/sh/boards/mach-se/7343/setup.c
@@ -1,36 +1,16 @@
1#include <linux/init.h> 1#include <linux/init.h>
2#include <linux/platform_device.h> 2#include <linux/platform_device.h>
3#include <linux/mtd/physmap.h> 3#include <linux/mtd/physmap.h>
4#include <linux/serial_8250.h>
5#include <linux/serial_reg.h>
6#include <linux/usb/isp116x.h>
7#include <linux/delay.h>
4#include <asm/machvec.h> 8#include <asm/machvec.h>
5#include <mach-se/mach/se7343.h> 9#include <mach-se/mach/se7343.h>
6#include <asm/heartbeat.h> 10#include <asm/heartbeat.h>
7#include <asm/irq.h> 11#include <asm/irq.h>
8#include <asm/io.h> 12#include <asm/io.h>
9 13
10static struct resource smc91x_resources[] = {
11 [0] = {
12 .start = 0x10000000,
13 .end = 0x1000000F,
14 .flags = IORESOURCE_MEM,
15 },
16 [1] = {
17 /*
18 * shared with other devices via externel
19 * interrupt controller in FPGA...
20 */
21 .start = SMC_IRQ,
22 .end = SMC_IRQ,
23 .flags = IORESOURCE_IRQ,
24 },
25};
26
27static struct platform_device smc91x_device = {
28 .name = "smc91x",
29 .id = 0,
30 .num_resources = ARRAY_SIZE(smc91x_resources),
31 .resource = smc91x_resources,
32};
33
34static struct resource heartbeat_resources[] = { 14static struct resource heartbeat_resources[] = {
35 [0] = { 15 [0] = {
36 .start = PA_LED, 16 .start = PA_LED,
@@ -94,10 +74,83 @@ static struct platform_device nor_flash_device = {
94 .resource = nor_flash_resources, 74 .resource = nor_flash_resources,
95}; 75};
96 76
77#define ST16C2550C_FLAGS (UPF_BOOT_AUTOCONF | UPF_IOREMAP)
78
79static struct plat_serial8250_port serial_platform_data[] = {
80 [0] = {
81 .iotype = UPIO_MEM,
82 .mapbase = 0x16000000,
83 .regshift = 1,
84 .flags = ST16C2550C_FLAGS,
85 .irq = UARTA_IRQ,
86 .uartclk = 7372800,
87 },
88 [1] = {
89 .iotype = UPIO_MEM,
90 .mapbase = 0x17000000,
91 .regshift = 1,
92 .flags = ST16C2550C_FLAGS,
93 .irq = UARTB_IRQ,
94 .uartclk = 7372800,
95 },
96 { },
97};
98
99static struct platform_device uart_device = {
100 .name = "serial8250",
101 .id = PLAT8250_DEV_PLATFORM,
102 .dev = {
103 .platform_data = serial_platform_data,
104 },
105};
106
107static void isp116x_delay(struct device *dev, int delay)
108{
109 ndelay(delay);
110}
111
112static struct resource usb_resources[] = {
113 [0] = {
114 .start = 0x11800000,
115 .end = 0x11800001,
116 .flags = IORESOURCE_MEM,
117 },
118 [1] = {
119 .start = 0x11800002,
120 .end = 0x11800003,
121 .flags = IORESOURCE_MEM,
122 },
123 [2] = {
124 .start = USB_IRQ,
125 .flags = IORESOURCE_IRQ,
126 },
127};
128
129static struct isp116x_platform_data usb_platform_data = {
130 .sel15Kres = 1,
131 .oc_enable = 1,
132 .int_act_high = 0,
133 .int_edge_triggered = 0,
134 .remote_wakeup_enable = 0,
135 .delay = isp116x_delay,
136};
137
138static struct platform_device usb_device = {
139 .name = "isp116x-hcd",
140 .id = -1,
141 .num_resources = ARRAY_SIZE(usb_resources),
142 .resource = usb_resources,
143 .dev = {
144 .platform_data = &usb_platform_data,
145 },
146
147};
148
97static struct platform_device *sh7343se_platform_devices[] __initdata = { 149static struct platform_device *sh7343se_platform_devices[] __initdata = {
98 &smc91x_device,
99 &heartbeat_device, 150 &heartbeat_device,
100 &nor_flash_device, 151 &nor_flash_device,
152 &uart_device,
153 &usb_device,
101}; 154};
102 155
103static int __init sh7343se_devices_setup(void) 156static int __init sh7343se_devices_setup(void)
@@ -126,27 +179,6 @@ static void __init sh7343se_setup(char **cmdline_p)
126static struct sh_machine_vector mv_7343se __initmv = { 179static struct sh_machine_vector mv_7343se __initmv = {
127 .mv_name = "SolutionEngine 7343", 180 .mv_name = "SolutionEngine 7343",
128 .mv_setup = sh7343se_setup, 181 .mv_setup = sh7343se_setup,
129 .mv_nr_irqs = 108, 182 .mv_nr_irqs = SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_NR,
130 .mv_inb = sh7343se_inb,
131 .mv_inw = sh7343se_inw,
132 .mv_inl = sh7343se_inl,
133 .mv_outb = sh7343se_outb,
134 .mv_outw = sh7343se_outw,
135 .mv_outl = sh7343se_outl,
136
137 .mv_inb_p = sh7343se_inb_p,
138 .mv_inw_p = sh7343se_inw,
139 .mv_inl_p = sh7343se_inl,
140 .mv_outb_p = sh7343se_outb_p,
141 .mv_outw_p = sh7343se_outw,
142 .mv_outl_p = sh7343se_outl,
143
144 .mv_insb = sh7343se_insb,
145 .mv_insw = sh7343se_insw,
146 .mv_insl = sh7343se_insl,
147 .mv_outsb = sh7343se_outsb,
148 .mv_outsw = sh7343se_outsw,
149 .mv_outsl = sh7343se_outsl,
150
151 .mv_init_irq = init_7343se_IRQ, 183 .mv_init_irq = init_7343se_IRQ,
152}; 184};
diff --git a/arch/sh/boards/mach-se/770x/setup.c b/arch/sh/boards/mach-se/770x/setup.c
index 9123d9687bf7..527eb6b12610 100644
--- a/arch/sh/boards/mach-se/770x/setup.c
+++ b/arch/sh/boards/mach-se/770x/setup.c
@@ -8,8 +8,9 @@
8 */ 8 */
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#include <asm/machvec.h>
12#include <mach-se/mach/se.h> 11#include <mach-se/mach/se.h>
12#include <mach-se/mach/mrshpc.h>
13#include <asm/machvec.h>
13#include <asm/io.h> 14#include <asm/io.h>
14#include <asm/smc37c93x.h> 15#include <asm/smc37c93x.h>
15#include <asm/heartbeat.h> 16#include <asm/heartbeat.h>
@@ -175,6 +176,7 @@ static struct platform_device *se_devices[] __initdata = {
175 176
176static int __init se_devices_setup(void) 177static int __init se_devices_setup(void)
177{ 178{
179 mrshpc_setup_windows();
178 return platform_add_devices(se_devices, ARRAY_SIZE(se_devices)); 180 return platform_add_devices(se_devices, ARRAY_SIZE(se_devices));
179} 181}
180device_initcall(se_devices_setup); 182device_initcall(se_devices_setup);
diff --git a/arch/sh/boards/mach-se/7721/setup.c b/arch/sh/boards/mach-se/7721/setup.c
index d3fc80ff4d83..55af4c36b43a 100644
--- a/arch/sh/boards/mach-se/7721/setup.c
+++ b/arch/sh/boards/mach-se/7721/setup.c
@@ -12,8 +12,9 @@
12 */ 12 */
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <asm/machvec.h>
16#include <mach-se/mach/se7721.h> 15#include <mach-se/mach/se7721.h>
16#include <mach-se/mach/mrshpc.h>
17#include <asm/machvec.h>
17#include <asm/io.h> 18#include <asm/io.h>
18#include <asm/heartbeat.h> 19#include <asm/heartbeat.h>
19 20
@@ -74,8 +75,8 @@ static struct platform_device *se7721_devices[] __initdata = {
74 75
75static int __init se7721_devices_setup(void) 76static int __init se7721_devices_setup(void)
76{ 77{
77 return platform_add_devices(se7721_devices, 78 mrshpc_setup_windows();
78 ARRAY_SIZE(se7721_devices)); 79 return platform_add_devices(se7721_devices, ARRAY_SIZE(se7721_devices));
79} 80}
80device_initcall(se7721_devices_setup); 81device_initcall(se7721_devices_setup);
81 82
diff --git a/arch/sh/boards/mach-se/7722/setup.c b/arch/sh/boards/mach-se/7722/setup.c
index fe6f96517e12..af84904ed86f 100644
--- a/arch/sh/boards/mach-se/7722/setup.c
+++ b/arch/sh/boards/mach-se/7722/setup.c
@@ -15,9 +15,10 @@
15#include <linux/ata_platform.h> 15#include <linux/ata_platform.h>
16#include <linux/input.h> 16#include <linux/input.h>
17#include <linux/smc91x.h> 17#include <linux/smc91x.h>
18#include <mach-se/mach/se7722.h>
19#include <mach-se/mach/mrshpc.h>
18#include <asm/machvec.h> 20#include <asm/machvec.h>
19#include <asm/clock.h> 21#include <asm/clock.h>
20#include <mach-se/mach/se7722.h>
21#include <asm/io.h> 22#include <asm/io.h>
22#include <asm/heartbeat.h> 23#include <asm/heartbeat.h>
23#include <asm/sh_keysc.h> 24#include <asm/sh_keysc.h>
@@ -130,6 +131,7 @@ static struct resource sh_keysc_resources[] = {
130 131
131static struct platform_device sh_keysc_device = { 132static struct platform_device sh_keysc_device = {
132 .name = "sh_keysc", 133 .name = "sh_keysc",
134 .id = 0, /* "keysc0" clock */
133 .num_resources = ARRAY_SIZE(sh_keysc_resources), 135 .num_resources = ARRAY_SIZE(sh_keysc_resources),
134 .resource = sh_keysc_resources, 136 .resource = sh_keysc_resources,
135 .dev = { 137 .dev = {
@@ -146,10 +148,8 @@ static struct platform_device *se7722_devices[] __initdata = {
146 148
147static int __init se7722_devices_setup(void) 149static int __init se7722_devices_setup(void)
148{ 150{
149 clk_always_enable("mstp214"); /* KEYSC */ 151 mrshpc_setup_windows();
150 152 return platform_add_devices(se7722_devices, ARRAY_SIZE(se7722_devices));
151 return platform_add_devices(se7722_devices,
152 ARRAY_SIZE(se7722_devices));
153} 153}
154device_initcall(se7722_devices_setup); 154device_initcall(se7722_devices_setup);
155 155
diff --git a/arch/sh/boards/mach-sh03/setup.c b/arch/sh/boards/mach-sh03/setup.c
index 5771219be3fd..74cfb4b8b03d 100644
--- a/arch/sh/boards/mach-sh03/setup.c
+++ b/arch/sh/boards/mach-sh03/setup.c
@@ -9,6 +9,7 @@
9#include <linux/irq.h> 9#include <linux/irq.h>
10#include <linux/pci.h> 10#include <linux/pci.h>
11#include <linux/platform_device.h> 11#include <linux/platform_device.h>
12#include <linux/ata_platform.h>
12#include <asm/io.h> 13#include <asm/io.h>
13#include <asm/rtc.h> 14#include <asm/rtc.h>
14#include <mach-sh03/mach/io.h> 15#include <mach-sh03/mach/io.h>
@@ -20,19 +21,6 @@ static void __init init_sh03_IRQ(void)
20 plat_irq_setup_pins(IRQ_MODE_IRQ); 21 plat_irq_setup_pins(IRQ_MODE_IRQ);
21} 22}
22 23
23extern void *cf_io_base;
24
25static void __iomem *sh03_ioport_map(unsigned long port, unsigned int size)
26{
27 if (PXSEG(port))
28 return (void __iomem *)port;
29 /* CompactFlash (IDE) */
30 if (((port >= 0x1f0) && (port <= 0x1f7)) || (port == 0x3f6))
31 return (void __iomem *)((unsigned long)cf_io_base + port);
32
33 return (void __iomem *)(port + PCI_IO_BASE);
34}
35
36/* arch/sh/boards/sh03/rtc.c */ 24/* arch/sh/boards/sh03/rtc.c */
37void sh03_time_init(void); 25void sh03_time_init(void);
38 26
@@ -41,6 +29,30 @@ static void __init sh03_setup(char **cmdline_p)
41 board_time_init = sh03_time_init; 29 board_time_init = sh03_time_init;
42} 30}
43 31
32static struct resource cf_ide_resources[] = {
33 [0] = {
34 .start = 0x1f0,
35 .end = 0x1f0 + 8,
36 .flags = IORESOURCE_IO,
37 },
38 [1] = {
39 .start = 0x1f0 + 0x206,
40 .end = 0x1f0 +8 + 0x206 + 8,
41 .flags = IORESOURCE_IO,
42 },
43 [2] = {
44 .start = IRL2_IRQ,
45 .flags = IORESOURCE_IRQ,
46 },
47};
48
49static struct platform_device cf_ide_device = {
50 .name = "pata_platform",
51 .id = -1,
52 .num_resources = ARRAY_SIZE(cf_ide_resources),
53 .resource = cf_ide_resources,
54};
55
44static struct resource heartbeat_resources[] = { 56static struct resource heartbeat_resources[] = {
45 [0] = { 57 [0] = {
46 .start = 0xa0800000, 58 .start = 0xa0800000,
@@ -58,10 +70,30 @@ static struct platform_device heartbeat_device = {
58 70
59static struct platform_device *sh03_devices[] __initdata = { 71static struct platform_device *sh03_devices[] __initdata = {
60 &heartbeat_device, 72 &heartbeat_device,
73 &cf_ide_device,
61}; 74};
62 75
63static int __init sh03_devices_setup(void) 76static int __init sh03_devices_setup(void)
64{ 77{
78 pgprot_t prot;
79 unsigned long paddrbase;
80 void *cf_ide_base;
81
82 /* open I/O area window */
83 paddrbase = virt_to_phys((void *)PA_AREA5_IO);
84 prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
85 cf_ide_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot);
86 if (!cf_ide_base) {
87 printk("allocate_cf_area : can't open CF I/O window!\n");
88 return -ENOMEM;
89 }
90
91 /* IDE cmd address : 0x1f0-0x1f7 and 0x3f6 */
92 cf_ide_resources[0].start += (unsigned long)cf_ide_base;
93 cf_ide_resources[0].end += (unsigned long)cf_ide_base;
94 cf_ide_resources[1].start += (unsigned long)cf_ide_base;
95 cf_ide_resources[1].end += (unsigned long)cf_ide_base;
96
65 return platform_add_devices(sh03_devices, ARRAY_SIZE(sh03_devices)); 97 return platform_add_devices(sh03_devices, ARRAY_SIZE(sh03_devices));
66} 98}
67__initcall(sh03_devices_setup); 99__initcall(sh03_devices_setup);
@@ -70,6 +102,5 @@ static struct sh_machine_vector mv_sh03 __initmv = {
70 .mv_name = "Interface (CTP/PCI-SH03)", 102 .mv_name = "Interface (CTP/PCI-SH03)",
71 .mv_setup = sh03_setup, 103 .mv_setup = sh03_setup,
72 .mv_nr_irqs = 48, 104 .mv_nr_irqs = 48,
73 .mv_ioport_map = sh03_ioport_map,
74 .mv_init_irq = init_sh03_IRQ, 105 .mv_init_irq = init_sh03_IRQ,
75}; 106};
diff --git a/arch/sh/boards/mach-systemh/irq.c b/arch/sh/boards/mach-systemh/irq.c
index 538406872a89..986a0e71d220 100644
--- a/arch/sh/boards/mach-systemh/irq.c
+++ b/arch/sh/boards/mach-systemh/irq.c
@@ -12,8 +12,8 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/io.h>
15 16
16#include <asm/io.h>
17#include <mach/systemh7751.h> 17#include <mach/systemh7751.h>
18#include <asm/smc37c93x.h> 18#include <asm/smc37c93x.h>
19 19
@@ -24,35 +24,17 @@ static unsigned long *systemh_irq_mask_register = (unsigned long *)0xB3F10004;
24static unsigned long *systemh_irq_request_register = (unsigned long *)0xB3F10000; 24static unsigned long *systemh_irq_request_register = (unsigned long *)0xB3F10000;
25 25
26/* forward declaration */ 26/* forward declaration */
27static unsigned int startup_systemh_irq(unsigned int irq);
28static void shutdown_systemh_irq(unsigned int irq);
29static void enable_systemh_irq(unsigned int irq); 27static void enable_systemh_irq(unsigned int irq);
30static void disable_systemh_irq(unsigned int irq); 28static void disable_systemh_irq(unsigned int irq);
31static void mask_and_ack_systemh(unsigned int); 29static void mask_and_ack_systemh(unsigned int);
32static void end_systemh_irq(unsigned int irq);
33 30
34/* hw_interrupt_type */ 31static struct irq_chip systemh_irq_type = {
35static struct hw_interrupt_type systemh_irq_type = { 32 .name = " SystemH Register",
36 .typename = " SystemH Register", 33 .unmask = enable_systemh_irq,
37 .startup = startup_systemh_irq, 34 .mask = disable_systemh_irq,
38 .shutdown = shutdown_systemh_irq,
39 .enable = enable_systemh_irq,
40 .disable = disable_systemh_irq,
41 .ack = mask_and_ack_systemh, 35 .ack = mask_and_ack_systemh,
42 .end = end_systemh_irq
43}; 36};
44 37
45static unsigned int startup_systemh_irq(unsigned int irq)
46{
47 enable_systemh_irq(irq);
48 return 0; /* never anything pending */
49}
50
51static void shutdown_systemh_irq(unsigned int irq)
52{
53 disable_systemh_irq(irq);
54}
55
56static void disable_systemh_irq(unsigned int irq) 38static void disable_systemh_irq(unsigned int irq)
57{ 39{
58 if (systemh_irq_mask_register) { 40 if (systemh_irq_mask_register) {
@@ -86,16 +68,9 @@ static void mask_and_ack_systemh(unsigned int irq)
86 disable_systemh_irq(irq); 68 disable_systemh_irq(irq);
87} 69}
88 70
89static void end_systemh_irq(unsigned int irq)
90{
91 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
92 enable_systemh_irq(irq);
93}
94
95void make_systemh_irq(unsigned int irq) 71void make_systemh_irq(unsigned int irq)
96{ 72{
97 disable_irq_nosync(irq); 73 disable_irq_nosync(irq);
98 irq_desc[irq].chip = &systemh_irq_type; 74 set_irq_chip_and_handler(irq, &systemh_irq_type, handle_level_irq);
99 disable_systemh_irq(irq); 75 disable_systemh_irq(irq);
100} 76}
101
diff --git a/arch/sh/cchips/hd6446x/hd64461.c b/arch/sh/cchips/hd6446x/hd64461.c
index f1a4a0763c59..27ceeb948bb1 100644
--- a/arch/sh/cchips/hd6446x/hd64461.c
+++ b/arch/sh/cchips/hd6446x/hd64461.c
@@ -10,99 +10,49 @@
10#include <linux/interrupt.h> 10#include <linux/interrupt.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/irq.h> 12#include <linux/irq.h>
13#include <asm/io.h> 13#include <linux/io.h>
14#include <asm/irq.h> 14#include <asm/irq.h>
15#include <asm/hd64461.h> 15#include <asm/hd64461.h>
16 16
17/* This belongs in cpu specific */ 17/* This belongs in cpu specific */
18#define INTC_ICR1 0xA4140010UL 18#define INTC_ICR1 0xA4140010UL
19 19
20static void disable_hd64461_irq(unsigned int irq) 20static void hd64461_mask_irq(unsigned int irq)
21{ 21{
22 unsigned short nimr; 22 unsigned short nimr;
23 unsigned short mask = 1 << (irq - HD64461_IRQBASE); 23 unsigned short mask = 1 << (irq - HD64461_IRQBASE);
24 24
25 nimr = inw(HD64461_NIMR); 25 nimr = __raw_readw(HD64461_NIMR);
26 nimr |= mask; 26 nimr |= mask;
27 outw(nimr, HD64461_NIMR); 27 __raw_writew(nimr, HD64461_NIMR);
28} 28}
29 29
30static void enable_hd64461_irq(unsigned int irq) 30static void hd64461_unmask_irq(unsigned int irq)
31{ 31{
32 unsigned short nimr; 32 unsigned short nimr;
33 unsigned short mask = 1 << (irq - HD64461_IRQBASE); 33 unsigned short mask = 1 << (irq - HD64461_IRQBASE);
34 34
35 nimr = inw(HD64461_NIMR); 35 nimr = __raw_readw(HD64461_NIMR);
36 nimr &= ~mask; 36 nimr &= ~mask;
37 outw(nimr, HD64461_NIMR); 37 __raw_writew(nimr, HD64461_NIMR);
38} 38}
39 39
40static void mask_and_ack_hd64461(unsigned int irq) 40static void hd64461_mask_and_ack_irq(unsigned int irq)
41{ 41{
42 disable_hd64461_irq(irq); 42 hd64461_mask_irq(irq);
43#ifdef CONFIG_HD64461_ENABLER 43#ifdef CONFIG_HD64461_ENABLER
44 if (irq == HD64461_IRQBASE + 13) 44 if (irq == HD64461_IRQBASE + 13)
45 outb(0x00, HD64461_PCC1CSCR); 45 __raw_writeb(0x00, HD64461_PCC1CSCR);
46#endif 46#endif
47} 47}
48 48
49static void end_hd64461_irq(unsigned int irq) 49static struct irq_chip hd64461_irq_chip = {
50{ 50 .name = "HD64461-IRQ",
51 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 51 .mask = hd64461_mask_irq,
52 enable_hd64461_irq(irq); 52 .mask_ack = hd64461_mask_and_ack_irq,
53} 53 .unmask = hd64461_unmask_irq,
54
55static unsigned int startup_hd64461_irq(unsigned int irq)
56{
57 enable_hd64461_irq(irq);
58 return 0;
59}
60
61static void shutdown_hd64461_irq(unsigned int irq)
62{
63 disable_hd64461_irq(irq);
64}
65
66static struct hw_interrupt_type hd64461_irq_type = {
67 .typename = "HD64461-IRQ",
68 .startup = startup_hd64461_irq,
69 .shutdown = shutdown_hd64461_irq,
70 .enable = enable_hd64461_irq,
71 .disable = disable_hd64461_irq,
72 .ack = mask_and_ack_hd64461,
73 .end = end_hd64461_irq,
74}; 54};
75 55
76static irqreturn_t hd64461_interrupt(int irq, void *dev_id)
77{
78 printk(KERN_INFO
79 "HD64461: spurious interrupt, nirr: 0x%x nimr: 0x%x\n",
80 inw(HD64461_NIRR), inw(HD64461_NIMR));
81
82 return IRQ_NONE;
83}
84
85static struct {
86 int (*func) (int, void *);
87 void *dev;
88} hd64461_demux[HD64461_IRQ_NUM];
89
90void hd64461_register_irq_demux(int irq,
91 int (*demux) (int irq, void *dev), void *dev)
92{
93 hd64461_demux[irq - HD64461_IRQBASE].func = demux;
94 hd64461_demux[irq - HD64461_IRQBASE].dev = dev;
95}
96
97EXPORT_SYMBOL(hd64461_register_irq_demux);
98
99void hd64461_unregister_irq_demux(int irq)
100{
101 hd64461_demux[irq - HD64461_IRQBASE].func = 0;
102}
103
104EXPORT_SYMBOL(hd64461_unregister_irq_demux);
105
106int hd64461_irq_demux(int irq) 56int hd64461_irq_demux(int irq)
107{ 57{
108 if (irq == CONFIG_HD64461_IRQ) { 58 if (irq == CONFIG_HD64461_IRQ) {
@@ -115,25 +65,11 @@ int hd64461_irq_demux(int irq)
115 for (bit = 1, i = 0; i < 16; bit <<= 1, i++) 65 for (bit = 1, i = 0; i < 16; bit <<= 1, i++)
116 if (nirr & bit) 66 if (nirr & bit)
117 break; 67 break;
118 if (i == 16) 68 irq = HD64461_IRQBASE + i;
119 irq = CONFIG_HD64461_IRQ;
120 else {
121 irq = HD64461_IRQBASE + i;
122 if (hd64461_demux[i].func != 0) {
123 irq = hd64461_demux[i].func(irq, hd64461_demux[i].dev);
124 }
125 }
126 } 69 }
127 return irq; 70 return irq;
128} 71}
129 72
130static struct irqaction irq0 = {
131 .handler = hd64461_interrupt,
132 .flags = IRQF_DISABLED,
133 .mask = CPU_MASK_NONE,
134 .name = "HD64461",
135};
136
137int __init setup_hd64461(void) 73int __init setup_hd64461(void)
138{ 74{
139 int i; 75 int i;
@@ -146,22 +82,21 @@ int __init setup_hd64461(void)
146 CONFIG_HD64461_IOBASE, CONFIG_HD64461_IRQ, HD64461_IRQBASE, 82 CONFIG_HD64461_IOBASE, CONFIG_HD64461_IRQ, HD64461_IRQBASE,
147 HD64461_IRQBASE + 15); 83 HD64461_IRQBASE + 15);
148 84
149#if defined(CONFIG_CPU_SUBTYPE_SH7709) /* Should be at processor specific part.. */ 85/* Should be at processor specific part.. */
150 outw(0x2240, INTC_ICR1); 86#if defined(CONFIG_CPU_SUBTYPE_SH7709)
87 __raw_writew(0x2240, INTC_ICR1);
151#endif 88#endif
152 outw(0xffff, HD64461_NIMR); 89 __raw_writew(0xffff, HD64461_NIMR);
153 90
154 /* IRQ 80 -> 95 belongs to HD64461 */ 91 /* IRQ 80 -> 95 belongs to HD64461 */
155 for (i = HD64461_IRQBASE; i < HD64461_IRQBASE + 16; i++) { 92 for (i = HD64461_IRQBASE; i < HD64461_IRQBASE + 16; i++)
156 irq_desc[i].chip = &hd64461_irq_type; 93 set_irq_chip_and_handler(i, &hd64461_irq_chip,
157 } 94 handle_level_irq);
158
159 setup_irq(CONFIG_HD64461_IRQ, &irq0);
160 95
161#ifdef CONFIG_HD64461_ENABLER 96#ifdef CONFIG_HD64461_ENABLER
162 printk(KERN_INFO "HD64461: enabling PCMCIA devices\n"); 97 printk(KERN_INFO "HD64461: enabling PCMCIA devices\n");
163 outb(0x4c, HD64461_PCC1CSCIER); 98 __raw_writeb(0x4c, HD64461_PCC1CSCIER);
164 outb(0x00, HD64461_PCC1CSCR); 99 __raw_writeb(0x00, HD64461_PCC1CSCR);
165#endif 100#endif
166 101
167 return 0; 102 return 0;
diff --git a/arch/sh/configs/edosk7705_defconfig b/arch/sh/configs/edosk7705_defconfig
new file mode 100644
index 000000000000..8f4329fbbd39
--- /dev/null
+++ b/arch/sh/configs/edosk7705_defconfig
@@ -0,0 +1,438 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.28-rc6
4# Wed Dec 17 13:53:02 2008
5#
6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
8CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
9CONFIG_RWSEM_GENERIC_SPINLOCK=y
10CONFIG_GENERIC_FIND_NEXT_BIT=y
11CONFIG_GENERIC_HWEIGHT=y
12CONFIG_GENERIC_HARDIRQS=y
13CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
14CONFIG_GENERIC_IRQ_PROBE=y
15# CONFIG_GENERIC_GPIO is not set
16CONFIG_GENERIC_TIME=y
17CONFIG_GENERIC_CLOCKEVENTS=y
18# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
19# CONFIG_ARCH_HIBERNATION_POSSIBLE is not set
20CONFIG_STACKTRACE_SUPPORT=y
21CONFIG_LOCKDEP_SUPPORT=y
22CONFIG_HAVE_LATENCYTOP_SUPPORT=y
23# CONFIG_ARCH_HAS_ILOG2_U32 is not set
24# CONFIG_ARCH_HAS_ILOG2_U64 is not set
25CONFIG_ARCH_NO_VIRT_TO_BUS=y
26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
27
28#
29# General setup
30#
31# CONFIG_EXPERIMENTAL is not set
32CONFIG_BROKEN_ON_SMP=y
33CONFIG_INIT_ENV_ARG_LIMIT=32
34CONFIG_LOCALVERSION=""
35# CONFIG_LOCALVERSION_AUTO is not set
36# CONFIG_SYSVIPC is not set
37# CONFIG_BSD_PROCESS_ACCT is not set
38# CONFIG_IKCONFIG is not set
39CONFIG_LOG_BUF_SHIFT=17
40# CONFIG_CGROUPS is not set
41# CONFIG_RELAY is not set
42# CONFIG_NAMESPACES is not set
43# CONFIG_BLK_DEV_INITRD is not set
44# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
45CONFIG_EMBEDDED=y
46# CONFIG_UID16 is not set
47# CONFIG_SYSCTL_SYSCALL is not set
48# CONFIG_KALLSYMS is not set
49# CONFIG_HOTPLUG is not set
50# CONFIG_PRINTK is not set
51# CONFIG_BUG is not set
52# CONFIG_ELF_CORE is not set
53# CONFIG_COMPAT_BRK is not set
54# CONFIG_BASE_FULL is not set
55# CONFIG_FUTEX is not set
56# CONFIG_EPOLL is not set
57# CONFIG_SIGNALFD is not set
58# CONFIG_TIMERFD is not set
59# CONFIG_EVENTFD is not set
60CONFIG_SHMEM=y
61# CONFIG_AIO is not set
62# CONFIG_VM_EVENT_COUNTERS is not set
63# CONFIG_SLAB is not set
64CONFIG_SLUB=y
65# CONFIG_SLOB is not set
66# CONFIG_PROFILING is not set
67# CONFIG_MARKERS is not set
68CONFIG_HAVE_OPROFILE=y
69CONFIG_HAVE_IOREMAP_PROT=y
70CONFIG_HAVE_KPROBES=y
71CONFIG_HAVE_KRETPROBES=y
72CONFIG_HAVE_ARCH_TRACEHOOK=y
73CONFIG_HAVE_CLK=y
74CONFIG_HAVE_GENERIC_DMA_COHERENT=y
75# CONFIG_TINY_SHMEM is not set
76CONFIG_BASE_SMALL=1
77# CONFIG_MODULES is not set
78# CONFIG_BLOCK is not set
79CONFIG_CLASSIC_RCU=y
80# CONFIG_FREEZER is not set
81
82#
83# System type
84#
85CONFIG_CPU_SH3=y
86# CONFIG_CPU_SUBTYPE_SH7619 is not set
87# CONFIG_CPU_SUBTYPE_SH7201 is not set
88# CONFIG_CPU_SUBTYPE_SH7203 is not set
89# CONFIG_CPU_SUBTYPE_SH7206 is not set
90# CONFIG_CPU_SUBTYPE_SH7263 is not set
91# CONFIG_CPU_SUBTYPE_MXG is not set
92CONFIG_CPU_SUBTYPE_SH7705=y
93# CONFIG_CPU_SUBTYPE_SH7706 is not set
94# CONFIG_CPU_SUBTYPE_SH7707 is not set
95# CONFIG_CPU_SUBTYPE_SH7708 is not set
96# CONFIG_CPU_SUBTYPE_SH7709 is not set
97# CONFIG_CPU_SUBTYPE_SH7710 is not set
98# CONFIG_CPU_SUBTYPE_SH7712 is not set
99# CONFIG_CPU_SUBTYPE_SH7720 is not set
100# CONFIG_CPU_SUBTYPE_SH7721 is not set
101# CONFIG_CPU_SUBTYPE_SH7750 is not set
102# CONFIG_CPU_SUBTYPE_SH7091 is not set
103# CONFIG_CPU_SUBTYPE_SH7750R is not set
104# CONFIG_CPU_SUBTYPE_SH7750S is not set
105# CONFIG_CPU_SUBTYPE_SH7751 is not set
106# CONFIG_CPU_SUBTYPE_SH7751R is not set
107# CONFIG_CPU_SUBTYPE_SH7760 is not set
108# CONFIG_CPU_SUBTYPE_SH4_202 is not set
109# CONFIG_CPU_SUBTYPE_SH7723 is not set
110# CONFIG_CPU_SUBTYPE_SH7763 is not set
111# CONFIG_CPU_SUBTYPE_SH7770 is not set
112# CONFIG_CPU_SUBTYPE_SH7780 is not set
113# CONFIG_CPU_SUBTYPE_SH7785 is not set
114# CONFIG_CPU_SUBTYPE_SHX3 is not set
115# CONFIG_CPU_SUBTYPE_SH7343 is not set
116# CONFIG_CPU_SUBTYPE_SH7722 is not set
117# CONFIG_CPU_SUBTYPE_SH7366 is not set
118# CONFIG_CPU_SUBTYPE_SH5_101 is not set
119# CONFIG_CPU_SUBTYPE_SH5_103 is not set
120
121#
122# Memory management options
123#
124CONFIG_QUICKLIST=y
125CONFIG_MMU=y
126CONFIG_PAGE_OFFSET=0x80000000
127CONFIG_MEMORY_START=0x08000000
128CONFIG_MEMORY_SIZE=0x04000000
129CONFIG_29BIT=y
130CONFIG_VSYSCALL=y
131CONFIG_ARCH_FLATMEM_ENABLE=y
132CONFIG_ARCH_SPARSEMEM_ENABLE=y
133CONFIG_ARCH_SPARSEMEM_DEFAULT=y
134CONFIG_MAX_ACTIVE_REGIONS=1
135CONFIG_ARCH_POPULATES_NODE_MAP=y
136CONFIG_ARCH_SELECT_MEMORY_MODEL=y
137CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
138CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
139CONFIG_PAGE_SIZE_4KB=y
140# CONFIG_PAGE_SIZE_8KB is not set
141# CONFIG_PAGE_SIZE_16KB is not set
142# CONFIG_PAGE_SIZE_64KB is not set
143CONFIG_ENTRY_OFFSET=0x00001000
144CONFIG_SELECT_MEMORY_MODEL=y
145# CONFIG_FLATMEM_MANUAL is not set
146# CONFIG_DISCONTIGMEM_MANUAL is not set
147CONFIG_SPARSEMEM_MANUAL=y
148CONFIG_SPARSEMEM=y
149CONFIG_HAVE_MEMORY_PRESENT=y
150CONFIG_SPARSEMEM_STATIC=y
151CONFIG_PAGEFLAGS_EXTENDED=y
152CONFIG_SPLIT_PTLOCK_CPUS=4
153CONFIG_MIGRATION=y
154# CONFIG_RESOURCES_64BIT is not set
155# CONFIG_PHYS_ADDR_T_64BIT is not set
156CONFIG_ZONE_DMA_FLAG=0
157CONFIG_NR_QUICK=2
158CONFIG_UNEVICTABLE_LRU=y
159
160#
161# Cache configuration
162#
163CONFIG_SH7705_CACHE_32KB=y
164# CONFIG_SH_DIRECT_MAPPED is not set
165CONFIG_CACHE_WRITEBACK=y
166# CONFIG_CACHE_WRITETHROUGH is not set
167# CONFIG_CACHE_OFF is not set
168
169#
170# Processor features
171#
172CONFIG_CPU_LITTLE_ENDIAN=y
173# CONFIG_CPU_BIG_ENDIAN is not set
174CONFIG_SH_ADC=y
175CONFIG_CPU_HAS_INTEVT=y
176CONFIG_CPU_HAS_SR_RB=y
177
178#
179# Board support
180#
181# CONFIG_SH_SOLUTION_ENGINE is not set
182CONFIG_SH_EDOSK7705=y
183
184#
185# Timer and clock configuration
186#
187CONFIG_SH_TMU=y
188CONFIG_SH_TIMER_IRQ=16
189CONFIG_SH_PCLK_FREQ=31250000
190# CONFIG_NO_HZ is not set
191# CONFIG_HIGH_RES_TIMERS is not set
192CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
193
194#
195# CPU Frequency scaling
196#
197# CONFIG_CPU_FREQ is not set
198
199#
200# DMA support
201#
202# CONFIG_SH_DMA is not set
203
204#
205# Companion Chips
206#
207
208#
209# Additional SuperH Device Drivers
210#
211# CONFIG_HEARTBEAT is not set
212# CONFIG_PUSH_SWITCH is not set
213
214#
215# Kernel features
216#
217# CONFIG_HZ_100 is not set
218CONFIG_HZ_250=y
219# CONFIG_HZ_300 is not set
220# CONFIG_HZ_1000 is not set
221CONFIG_HZ=250
222# CONFIG_SCHED_HRTICK is not set
223CONFIG_PREEMPT_NONE=y
224# CONFIG_PREEMPT_VOLUNTARY is not set
225# CONFIG_PREEMPT is not set
226CONFIG_GUSA=y
227# CONFIG_GUSA_RB is not set
228
229#
230# Boot options
231#
232CONFIG_ZERO_PAGE_OFFSET=0x00001000
233CONFIG_BOOT_LINK_OFFSET=0x00800000
234# CONFIG_CMDLINE_BOOL is not set
235
236#
237# Bus options
238#
239# CONFIG_ARCH_SUPPORTS_MSI is not set
240
241#
242# Executable file formats
243#
244CONFIG_BINFMT_ELF=y
245# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
246# CONFIG_HAVE_AOUT is not set
247# CONFIG_BINFMT_MISC is not set
248# CONFIG_NET is not set
249
250#
251# Device Drivers
252#
253
254#
255# Generic Driver Options
256#
257CONFIG_STANDALONE=y
258# CONFIG_PREVENT_FIRMWARE_BUILD is not set
259# CONFIG_SYS_HYPERVISOR is not set
260# CONFIG_MTD is not set
261# CONFIG_PARPORT is not set
262# CONFIG_MISC_DEVICES is not set
263CONFIG_HAVE_IDE=y
264
265#
266# SCSI device support
267#
268# CONFIG_SCSI_DMA is not set
269# CONFIG_SCSI_NETLINK is not set
270# CONFIG_PHONE is not set
271
272#
273# Input device support
274#
275# CONFIG_INPUT is not set
276
277#
278# Hardware I/O ports
279#
280# CONFIG_SERIO is not set
281# CONFIG_GAMEPORT is not set
282
283#
284# Character devices
285#
286# CONFIG_VT is not set
287# CONFIG_DEVKMEM is not set
288# CONFIG_SERIAL_NONSTANDARD is not set
289
290#
291# Serial drivers
292#
293# CONFIG_SERIAL_8250 is not set
294
295#
296# Non-8250 serial port support
297#
298# CONFIG_SERIAL_SH_SCI is not set
299# CONFIG_UNIX98_PTYS is not set
300# CONFIG_LEGACY_PTYS is not set
301# CONFIG_IPMI_HANDLER is not set
302# CONFIG_HW_RANDOM is not set
303# CONFIG_R3964 is not set
304# CONFIG_I2C is not set
305# CONFIG_SPI is not set
306# CONFIG_W1 is not set
307# CONFIG_POWER_SUPPLY is not set
308# CONFIG_HWMON is not set
309# CONFIG_THERMAL is not set
310# CONFIG_THERMAL_HWMON is not set
311# CONFIG_WATCHDOG is not set
312CONFIG_SSB_POSSIBLE=y
313
314#
315# Sonics Silicon Backplane
316#
317# CONFIG_SSB is not set
318
319#
320# Multifunction device drivers
321#
322# CONFIG_MFD_CORE is not set
323# CONFIG_MFD_SM501 is not set
324# CONFIG_HTC_PASIC3 is not set
325# CONFIG_MFD_TMIO is not set
326# CONFIG_REGULATOR is not set
327
328#
329# Multimedia devices
330#
331
332#
333# Multimedia core support
334#
335# CONFIG_VIDEO_DEV is not set
336# CONFIG_VIDEO_MEDIA is not set
337
338#
339# Multimedia drivers
340#
341# CONFIG_DAB is not set
342
343#
344# Graphics support
345#
346# CONFIG_VGASTATE is not set
347# CONFIG_VIDEO_OUTPUT_CONTROL is not set
348# CONFIG_FB is not set
349# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
350
351#
352# Display device support
353#
354# CONFIG_DISPLAY_SUPPORT is not set
355# CONFIG_SOUND is not set
356# CONFIG_USB_SUPPORT is not set
357# CONFIG_MMC is not set
358# CONFIG_MEMSTICK is not set
359# CONFIG_NEW_LEDS is not set
360# CONFIG_ACCESSIBILITY is not set
361# CONFIG_RTC_CLASS is not set
362# CONFIG_DMADEVICES is not set
363# CONFIG_UIO is not set
364# CONFIG_STAGING is not set
365CONFIG_STAGING_EXCLUDE_BUILD=y
366
367#
368# File systems
369#
370# CONFIG_DNOTIFY is not set
371# CONFIG_INOTIFY is not set
372# CONFIG_QUOTA is not set
373# CONFIG_AUTOFS_FS is not set
374# CONFIG_AUTOFS4_FS is not set
375# CONFIG_FUSE_FS is not set
376
377#
378# Pseudo filesystems
379#
380# CONFIG_PROC_FS is not set
381# CONFIG_SYSFS is not set
382# CONFIG_TMPFS is not set
383# CONFIG_HUGETLBFS is not set
384# CONFIG_HUGETLB_PAGE is not set
385
386#
387# Miscellaneous filesystems
388#
389# CONFIG_NLS is not set
390
391#
392# Kernel hacking
393#
394CONFIG_TRACE_IRQFLAGS_SUPPORT=y
395# CONFIG_ENABLE_WARN_DEPRECATED is not set
396# CONFIG_ENABLE_MUST_CHECK is not set
397CONFIG_FRAME_WARN=1024
398# CONFIG_MAGIC_SYSRQ is not set
399# CONFIG_UNUSED_SYMBOLS is not set
400# CONFIG_HEADERS_CHECK is not set
401# CONFIG_DEBUG_KERNEL is not set
402# CONFIG_DEBUG_MEMORY_INIT is not set
403# CONFIG_RCU_CPU_STALL_DETECTOR is not set
404# CONFIG_LATENCYTOP is not set
405CONFIG_HAVE_FUNCTION_TRACER=y
406CONFIG_HAVE_DYNAMIC_FTRACE=y
407CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
408
409#
410# Tracers
411#
412# CONFIG_SAMPLES is not set
413CONFIG_HAVE_ARCH_KGDB=y
414# CONFIG_SH_STANDARD_BIOS is not set
415# CONFIG_EARLY_SCIF_CONSOLE is not set
416# CONFIG_MORE_COMPILE_OPTIONS is not set
417
418#
419# Security options
420#
421# CONFIG_KEYS is not set
422# CONFIG_SECURITYFS is not set
423# CONFIG_SECURITY_FILE_CAPABILITIES is not set
424# CONFIG_CRYPTO is not set
425
426#
427# Library routines
428#
429# CONFIG_CRC_CCITT is not set
430# CONFIG_CRC16 is not set
431# CONFIG_CRC_T10DIF is not set
432# CONFIG_CRC_ITU_T is not set
433# CONFIG_CRC32 is not set
434# CONFIG_CRC7 is not set
435# CONFIG_LIBCRC32C is not set
436CONFIG_HAS_IOMEM=y
437CONFIG_HAS_IOPORT=y
438CONFIG_HAS_DMA=y
diff --git a/arch/sh/configs/rsk7201_defconfig b/arch/sh/configs/rsk7201_defconfig
new file mode 100644
index 000000000000..014c18cbf46a
--- /dev/null
+++ b/arch/sh/configs/rsk7201_defconfig
@@ -0,0 +1,703 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.28-rc6
4# Mon Dec 8 14:48:02 2008
5#
6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
8CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
9CONFIG_RWSEM_GENERIC_SPINLOCK=y
10CONFIG_GENERIC_BUG=y
11CONFIG_GENERIC_FIND_NEXT_BIT=y
12CONFIG_GENERIC_HWEIGHT=y
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
15CONFIG_GENERIC_IRQ_PROBE=y
16# CONFIG_GENERIC_GPIO is not set
17# CONFIG_GENERIC_TIME is not set
18# CONFIG_GENERIC_CLOCKEVENTS is not set
19# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
20# CONFIG_ARCH_HIBERNATION_POSSIBLE is not set
21CONFIG_STACKTRACE_SUPPORT=y
22CONFIG_LOCKDEP_SUPPORT=y
23CONFIG_HAVE_LATENCYTOP_SUPPORT=y
24# CONFIG_ARCH_HAS_ILOG2_U32 is not set
25# CONFIG_ARCH_HAS_ILOG2_U64 is not set
26CONFIG_ARCH_NO_VIRT_TO_BUS=y
27CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
28
29#
30# General setup
31#
32CONFIG_EXPERIMENTAL=y
33CONFIG_BROKEN_ON_SMP=y
34CONFIG_INIT_ENV_ARG_LIMIT=32
35CONFIG_LOCALVERSION=""
36# CONFIG_LOCALVERSION_AUTO is not set
37CONFIG_SYSVIPC=y
38CONFIG_SYSVIPC_SYSCTL=y
39CONFIG_BSD_PROCESS_ACCT=y
40# CONFIG_BSD_PROCESS_ACCT_V3 is not set
41CONFIG_IKCONFIG=y
42# CONFIG_IKCONFIG_PROC is not set
43CONFIG_LOG_BUF_SHIFT=14
44# CONFIG_CGROUPS is not set
45# CONFIG_GROUP_SCHED is not set
46# CONFIG_SYSFS_DEPRECATED_V2 is not set
47# CONFIG_RELAY is not set
48CONFIG_NAMESPACES=y
49CONFIG_UTS_NS=y
50CONFIG_IPC_NS=y
51CONFIG_USER_NS=y
52CONFIG_PID_NS=y
53CONFIG_BLK_DEV_INITRD=y
54CONFIG_INITRAMFS_SOURCE=""
55CONFIG_CC_OPTIMIZE_FOR_SIZE=y
56CONFIG_SYSCTL=y
57CONFIG_EMBEDDED=y
58CONFIG_UID16=y
59CONFIG_SYSCTL_SYSCALL=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
74# CONFIG_AIO is not set
75CONFIG_VM_EVENT_COUNTERS=y
76# CONFIG_SLAB is not set
77# CONFIG_SLUB is not set
78CONFIG_SLOB=y
79CONFIG_PROFILING=y
80# CONFIG_MARKERS is not set
81CONFIG_OPROFILE=y
82CONFIG_HAVE_OPROFILE=y
83# CONFIG_KPROBES is not set
84CONFIG_HAVE_KPROBES=y
85CONFIG_HAVE_KRETPROBES=y
86CONFIG_HAVE_ARCH_TRACEHOOK=y
87CONFIG_HAVE_CLK=y
88CONFIG_HAVE_GENERIC_DMA_COHERENT=y
89CONFIG_RT_MUTEXES=y
90CONFIG_TINY_SHMEM=y
91CONFIG_BASE_SMALL=0
92CONFIG_MODULES=y
93# CONFIG_MODULE_FORCE_LOAD is not set
94# CONFIG_MODULE_UNLOAD is not set
95# CONFIG_MODVERSIONS is not set
96# CONFIG_MODULE_SRCVERSION_ALL is not set
97CONFIG_KMOD=y
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# CONFIG_BLK_DEV_INTEGRITY 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# CONFIG_FREEZER is not set
119
120#
121# System type
122#
123CONFIG_CPU_SH2=y
124CONFIG_CPU_SH2A=y
125# CONFIG_CPU_SUBTYPE_SH7619 is not set
126CONFIG_CPU_SUBTYPE_SH7201=y
127# CONFIG_CPU_SUBTYPE_SH7203 is not set
128# CONFIG_CPU_SUBTYPE_SH7206 is not set
129# CONFIG_CPU_SUBTYPE_SH7263 is not set
130# CONFIG_CPU_SUBTYPE_MXG is not set
131# CONFIG_CPU_SUBTYPE_SH7705 is not set
132# CONFIG_CPU_SUBTYPE_SH7706 is not set
133# CONFIG_CPU_SUBTYPE_SH7707 is not set
134# CONFIG_CPU_SUBTYPE_SH7708 is not set
135# CONFIG_CPU_SUBTYPE_SH7709 is not set
136# CONFIG_CPU_SUBTYPE_SH7710 is not set
137# CONFIG_CPU_SUBTYPE_SH7712 is not set
138# CONFIG_CPU_SUBTYPE_SH7720 is not set
139# CONFIG_CPU_SUBTYPE_SH7721 is not set
140# CONFIG_CPU_SUBTYPE_SH7750 is not set
141# CONFIG_CPU_SUBTYPE_SH7091 is not set
142# CONFIG_CPU_SUBTYPE_SH7750R is not set
143# CONFIG_CPU_SUBTYPE_SH7750S is not set
144# CONFIG_CPU_SUBTYPE_SH7751 is not set
145# CONFIG_CPU_SUBTYPE_SH7751R is not set
146# CONFIG_CPU_SUBTYPE_SH7760 is not set
147# CONFIG_CPU_SUBTYPE_SH4_202 is not set
148# CONFIG_CPU_SUBTYPE_SH7723 is not set
149# CONFIG_CPU_SUBTYPE_SH7763 is not set
150# CONFIG_CPU_SUBTYPE_SH7770 is not set
151# CONFIG_CPU_SUBTYPE_SH7780 is not set
152# CONFIG_CPU_SUBTYPE_SH7785 is not set
153# CONFIG_CPU_SUBTYPE_SHX3 is not set
154# CONFIG_CPU_SUBTYPE_SH7343 is not set
155# CONFIG_CPU_SUBTYPE_SH7722 is not set
156# CONFIG_CPU_SUBTYPE_SH7366 is not set
157# CONFIG_CPU_SUBTYPE_SH5_101 is not set
158# CONFIG_CPU_SUBTYPE_SH5_103 is not set
159
160#
161# Memory management options
162#
163CONFIG_QUICKLIST=y
164CONFIG_PAGE_OFFSET=0x00000000
165CONFIG_MEMORY_START=0x08000000
166CONFIG_MEMORY_SIZE=0x01000000
167CONFIG_29BIT=y
168CONFIG_ARCH_FLATMEM_ENABLE=y
169CONFIG_ARCH_SPARSEMEM_ENABLE=y
170CONFIG_ARCH_SPARSEMEM_DEFAULT=y
171CONFIG_MAX_ACTIVE_REGIONS=1
172CONFIG_ARCH_POPULATES_NODE_MAP=y
173CONFIG_ARCH_SELECT_MEMORY_MODEL=y
174CONFIG_PAGE_SIZE_4KB=y
175# CONFIG_PAGE_SIZE_8KB is not set
176# CONFIG_PAGE_SIZE_16KB is not set
177# CONFIG_PAGE_SIZE_64KB is not set
178CONFIG_ENTRY_OFFSET=0x00001000
179CONFIG_SELECT_MEMORY_MODEL=y
180CONFIG_FLATMEM_MANUAL=y
181# CONFIG_DISCONTIGMEM_MANUAL is not set
182# CONFIG_SPARSEMEM_MANUAL is not set
183CONFIG_FLATMEM=y
184CONFIG_FLAT_NODE_MEM_MAP=y
185CONFIG_SPARSEMEM_STATIC=y
186CONFIG_PAGEFLAGS_EXTENDED=y
187CONFIG_SPLIT_PTLOCK_CPUS=4
188# CONFIG_RESOURCES_64BIT is not set
189# CONFIG_PHYS_ADDR_T_64BIT is not set
190CONFIG_ZONE_DMA_FLAG=0
191CONFIG_NR_QUICK=2
192
193#
194# Cache configuration
195#
196# CONFIG_SH_DIRECT_MAPPED is not set
197CONFIG_CACHE_WRITEBACK=y
198# CONFIG_CACHE_WRITETHROUGH is not set
199# CONFIG_CACHE_OFF is not set
200
201#
202# Processor features
203#
204# CONFIG_CPU_LITTLE_ENDIAN is not set
205CONFIG_CPU_BIG_ENDIAN=y
206CONFIG_SH_FPU=y
207CONFIG_CPU_HAS_FPU=y
208
209#
210# Board support
211#
212CONFIG_SH_RSK=y
213CONFIG_SH_RSK7201=y
214# CONFIG_SH_RSK7203 is not set
215
216#
217# Timer and clock configuration
218#
219# CONFIG_SH_CMT is not set
220CONFIG_SH_MTU2=y
221CONFIG_SH_TIMER_IRQ=16
222CONFIG_SH_PCLK_FREQ=40000000
223CONFIG_SH_CLK_MD=0
224
225#
226# CPU Frequency scaling
227#
228# CONFIG_CPU_FREQ is not set
229
230#
231# DMA support
232#
233
234#
235# Companion Chips
236#
237
238#
239# Additional SuperH Device Drivers
240#
241# CONFIG_HEARTBEAT is not set
242# CONFIG_PUSH_SWITCH is not set
243
244#
245# Kernel features
246#
247# CONFIG_HZ_100 is not set
248# CONFIG_HZ_250 is not set
249# CONFIG_HZ_300 is not set
250CONFIG_HZ_1000=y
251CONFIG_HZ=1000
252# CONFIG_SCHED_HRTICK is not set
253# CONFIG_KEXEC is not set
254# CONFIG_CRASH_DUMP is not set
255# CONFIG_SECCOMP is not set
256CONFIG_PREEMPT_NONE=y
257# CONFIG_PREEMPT_VOLUNTARY is not set
258# CONFIG_PREEMPT is not set
259CONFIG_GUSA=y
260
261#
262# Boot options
263#
264CONFIG_ZERO_PAGE_OFFSET=0x00001000
265CONFIG_BOOT_LINK_OFFSET=0x00800000
266CONFIG_CMDLINE_BOOL=y
267CONFIG_CMDLINE="console=ttySC0,115200 earlyprintk=serial ignore_loglevel"
268
269#
270# Bus options
271#
272# CONFIG_ARCH_SUPPORTS_MSI is not set
273# CONFIG_PCCARD is not set
274
275#
276# Executable file formats
277#
278CONFIG_BINFMT_ELF_FDPIC=y
279CONFIG_BINFMT_FLAT=y
280CONFIG_BINFMT_ZFLAT=y
281CONFIG_BINFMT_SHARED_FLAT=y
282# CONFIG_HAVE_AOUT is not set
283# CONFIG_BINFMT_MISC is not set
284
285#
286# Power management options (EXPERIMENTAL)
287#
288CONFIG_PM=y
289# CONFIG_PM_DEBUG is not set
290CONFIG_CPU_IDLE=y
291CONFIG_CPU_IDLE_GOV_LADDER=y
292# CONFIG_NET is not set
293
294#
295# Device Drivers
296#
297
298#
299# Generic Driver Options
300#
301CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
302# CONFIG_STANDALONE is not set
303# CONFIG_PREVENT_FIRMWARE_BUILD is not set
304# CONFIG_FW_LOADER is not set
305# CONFIG_SYS_HYPERVISOR is not set
306CONFIG_MTD=y
307# CONFIG_MTD_DEBUG is not set
308CONFIG_MTD_CONCAT=y
309CONFIG_MTD_PARTITIONS=y
310CONFIG_MTD_REDBOOT_PARTS=y
311CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
312# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
313# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
314# CONFIG_MTD_CMDLINE_PARTS is not set
315# CONFIG_MTD_AR7_PARTS is not set
316
317#
318# User Modules And Translation Layers
319#
320CONFIG_MTD_CHAR=y
321CONFIG_MTD_BLKDEVS=y
322CONFIG_MTD_BLOCK=y
323# CONFIG_FTL is not set
324# CONFIG_NFTL is not set
325# CONFIG_INFTL is not set
326# CONFIG_RFD_FTL is not set
327# CONFIG_SSFDC is not set
328# CONFIG_MTD_OOPS is not set
329
330#
331# RAM/ROM/Flash chip drivers
332#
333CONFIG_MTD_CFI=y
334# CONFIG_MTD_JEDECPROBE is not set
335CONFIG_MTD_GEN_PROBE=y
336# CONFIG_MTD_CFI_ADV_OPTIONS is not set
337CONFIG_MTD_MAP_BANK_WIDTH_1=y
338CONFIG_MTD_MAP_BANK_WIDTH_2=y
339CONFIG_MTD_MAP_BANK_WIDTH_4=y
340# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
341# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
342# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
343CONFIG_MTD_CFI_I1=y
344CONFIG_MTD_CFI_I2=y
345# CONFIG_MTD_CFI_I4 is not set
346# CONFIG_MTD_CFI_I8 is not set
347# CONFIG_MTD_CFI_INTELEXT is not set
348CONFIG_MTD_CFI_AMDSTD=y
349# CONFIG_MTD_CFI_STAA is not set
350CONFIG_MTD_CFI_UTIL=y
351# CONFIG_MTD_RAM is not set
352# CONFIG_MTD_ROM is not set
353# CONFIG_MTD_ABSENT is not set
354
355#
356# Mapping drivers for chip access
357#
358# CONFIG_MTD_COMPLEX_MAPPINGS is not set
359CONFIG_MTD_PHYSMAP=y
360CONFIG_MTD_PHYSMAP_START=0x0
361CONFIG_MTD_PHYSMAP_LEN=0x0
362CONFIG_MTD_PHYSMAP_BANKWIDTH=4
363# CONFIG_MTD_PLATRAM is not set
364
365#
366# Self-contained MTD device drivers
367#
368# CONFIG_MTD_SLRAM is not set
369# CONFIG_MTD_PHRAM is not set
370# CONFIG_MTD_MTDRAM is not set
371# CONFIG_MTD_BLOCK2MTD is not set
372
373#
374# Disk-On-Chip Device Drivers
375#
376# CONFIG_MTD_DOC2000 is not set
377# CONFIG_MTD_DOC2001 is not set
378# CONFIG_MTD_DOC2001PLUS is not set
379# CONFIG_MTD_NAND is not set
380# CONFIG_MTD_ONENAND is not set
381
382#
383# UBI - Unsorted block images
384#
385# CONFIG_MTD_UBI is not set
386# CONFIG_PARPORT is not set
387CONFIG_BLK_DEV=y
388# CONFIG_BLK_DEV_COW_COMMON is not set
389# CONFIG_BLK_DEV_LOOP is not set
390# CONFIG_BLK_DEV_RAM is not set
391# CONFIG_CDROM_PKTCDVD is not set
392# CONFIG_BLK_DEV_HD is not set
393CONFIG_MISC_DEVICES=y
394# CONFIG_EEPROM_93CX6 is not set
395# CONFIG_ENCLOSURE_SERVICES is not set
396# CONFIG_C2PORT is not set
397CONFIG_HAVE_IDE=y
398# CONFIG_IDE is not set
399
400#
401# SCSI device support
402#
403# CONFIG_RAID_ATTRS is not set
404# CONFIG_SCSI is not set
405# CONFIG_SCSI_DMA is not set
406# CONFIG_SCSI_NETLINK is not set
407# CONFIG_ATA is not set
408# CONFIG_MD is not set
409# CONFIG_PHONE is not set
410
411#
412# Input device support
413#
414CONFIG_INPUT=y
415# CONFIG_INPUT_FF_MEMLESS is not set
416# CONFIG_INPUT_POLLDEV is not set
417
418#
419# Userland interfaces
420#
421# CONFIG_INPUT_MOUSEDEV is not set
422# CONFIG_INPUT_JOYDEV is not set
423# CONFIG_INPUT_EVDEV is not set
424# CONFIG_INPUT_EVBUG is not set
425
426#
427# Input Device Drivers
428#
429# CONFIG_INPUT_KEYBOARD is not set
430# CONFIG_INPUT_MOUSE is not set
431# CONFIG_INPUT_JOYSTICK is not set
432# CONFIG_INPUT_TABLET is not set
433# CONFIG_INPUT_TOUCHSCREEN is not set
434# CONFIG_INPUT_MISC is not set
435
436#
437# Hardware I/O ports
438#
439# CONFIG_SERIO is not set
440# CONFIG_GAMEPORT is not set
441
442#
443# Character devices
444#
445# CONFIG_VT is not set
446CONFIG_DEVKMEM=y
447# CONFIG_SERIAL_NONSTANDARD is not set
448
449#
450# Serial drivers
451#
452# CONFIG_SERIAL_8250 is not set
453
454#
455# Non-8250 serial port support
456#
457CONFIG_SERIAL_SH_SCI=y
458CONFIG_SERIAL_SH_SCI_NR_UARTS=8
459CONFIG_SERIAL_SH_SCI_CONSOLE=y
460CONFIG_SERIAL_CORE=y
461CONFIG_SERIAL_CORE_CONSOLE=y
462# CONFIG_UNIX98_PTYS is not set
463# CONFIG_LEGACY_PTYS is not set
464# CONFIG_IPMI_HANDLER is not set
465# CONFIG_HW_RANDOM is not set
466# CONFIG_R3964 is not set
467# CONFIG_RAW_DRIVER is not set
468# CONFIG_TCG_TPM is not set
469# CONFIG_I2C is not set
470# CONFIG_SPI is not set
471# CONFIG_W1 is not set
472# CONFIG_POWER_SUPPLY is not set
473# CONFIG_HWMON is not set
474CONFIG_THERMAL=y
475# CONFIG_WATCHDOG is not set
476CONFIG_SSB_POSSIBLE=y
477
478#
479# Sonics Silicon Backplane
480#
481# CONFIG_SSB is not set
482
483#
484# Multifunction device drivers
485#
486# CONFIG_MFD_CORE is not set
487# CONFIG_MFD_SM501 is not set
488# CONFIG_HTC_PASIC3 is not set
489# CONFIG_MFD_TMIO is not set
490# CONFIG_REGULATOR is not set
491
492#
493# Multimedia devices
494#
495
496#
497# Multimedia core support
498#
499# CONFIG_VIDEO_DEV is not set
500# CONFIG_VIDEO_MEDIA is not set
501
502#
503# Multimedia drivers
504#
505CONFIG_DAB=y
506
507#
508# Graphics support
509#
510# CONFIG_VGASTATE is not set
511CONFIG_VIDEO_OUTPUT_CONTROL=y
512# CONFIG_FB is not set
513# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
514
515#
516# Display device support
517#
518# CONFIG_DISPLAY_SUPPORT is not set
519# CONFIG_SOUND is not set
520# CONFIG_HID_SUPPORT is not set
521# CONFIG_USB_SUPPORT is not set
522# CONFIG_MMC is not set
523# CONFIG_MEMSTICK is not set
524# CONFIG_NEW_LEDS is not set
525# CONFIG_ACCESSIBILITY is not set
526CONFIG_RTC_LIB=y
527CONFIG_RTC_CLASS=y
528CONFIG_RTC_HCTOSYS=y
529CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
530# CONFIG_RTC_DEBUG is not set
531
532#
533# RTC interfaces
534#
535CONFIG_RTC_INTF_SYSFS=y
536CONFIG_RTC_INTF_PROC=y
537CONFIG_RTC_INTF_DEV=y
538# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
539# CONFIG_RTC_DRV_TEST is not set
540
541#
542# SPI RTC drivers
543#
544
545#
546# Platform RTC drivers
547#
548# CONFIG_RTC_DRV_DS1286 is not set
549# CONFIG_RTC_DRV_DS1511 is not set
550# CONFIG_RTC_DRV_DS1553 is not set
551# CONFIG_RTC_DRV_DS1742 is not set
552# CONFIG_RTC_DRV_STK17TA8 is not set
553# CONFIG_RTC_DRV_M48T86 is not set
554# CONFIG_RTC_DRV_M48T35 is not set
555# CONFIG_RTC_DRV_M48T59 is not set
556# CONFIG_RTC_DRV_BQ4802 is not set
557# CONFIG_RTC_DRV_V3020 is not set
558
559#
560# on-CPU RTC drivers
561#
562CONFIG_RTC_DRV_SH=y
563# CONFIG_DMADEVICES is not set
564# CONFIG_UIO is not set
565# CONFIG_STAGING is not set
566CONFIG_STAGING_EXCLUDE_BUILD=y
567
568#
569# File systems
570#
571CONFIG_EXT2_FS=y
572# CONFIG_EXT2_FS_XATTR is not set
573# CONFIG_EXT3_FS is not set
574# CONFIG_EXT4_FS is not set
575# CONFIG_REISERFS_FS is not set
576# CONFIG_JFS_FS is not set
577# CONFIG_FS_POSIX_ACL is not set
578# CONFIG_FILE_LOCKING is not set
579# CONFIG_XFS_FS is not set
580# CONFIG_DNOTIFY is not set
581# CONFIG_INOTIFY is not set
582# CONFIG_QUOTA is not set
583# CONFIG_AUTOFS_FS is not set
584# CONFIG_AUTOFS4_FS is not set
585# CONFIG_FUSE_FS is not set
586
587#
588# CD-ROM/DVD Filesystems
589#
590# CONFIG_ISO9660_FS is not set
591# CONFIG_UDF_FS is not set
592
593#
594# DOS/FAT/NT Filesystems
595#
596# CONFIG_MSDOS_FS is not set
597# CONFIG_VFAT_FS is not set
598# CONFIG_NTFS_FS is not set
599
600#
601# Pseudo filesystems
602#
603CONFIG_PROC_FS=y
604CONFIG_PROC_SYSCTL=y
605CONFIG_SYSFS=y
606# CONFIG_TMPFS is not set
607# CONFIG_HUGETLB_PAGE is not set
608# CONFIG_CONFIGFS_FS is not set
609
610#
611# Miscellaneous filesystems
612#
613# CONFIG_ADFS_FS is not set
614# CONFIG_AFFS_FS is not set
615# CONFIG_HFS_FS is not set
616# CONFIG_HFSPLUS_FS is not set
617# CONFIG_BEFS_FS is not set
618# CONFIG_BFS_FS is not set
619# CONFIG_EFS_FS is not set
620CONFIG_JFFS2_FS=y
621CONFIG_JFFS2_FS_DEBUG=0
622CONFIG_JFFS2_FS_WRITEBUFFER=y
623# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
624# CONFIG_JFFS2_SUMMARY is not set
625# CONFIG_JFFS2_FS_XATTR is not set
626# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
627CONFIG_JFFS2_ZLIB=y
628# CONFIG_JFFS2_LZO is not set
629CONFIG_JFFS2_RTIME=y
630# CONFIG_JFFS2_RUBIN is not set
631# CONFIG_CRAMFS is not set
632# CONFIG_VXFS_FS is not set
633# CONFIG_MINIX_FS is not set
634# CONFIG_OMFS_FS is not set
635# CONFIG_HPFS_FS is not set
636# CONFIG_QNX4FS_FS is not set
637CONFIG_ROMFS_FS=y
638# CONFIG_SYSV_FS is not set
639# CONFIG_UFS_FS is not set
640
641#
642# Partition Types
643#
644# CONFIG_PARTITION_ADVANCED is not set
645CONFIG_MSDOS_PARTITION=y
646# CONFIG_NLS is not set
647
648#
649# Kernel hacking
650#
651CONFIG_TRACE_IRQFLAGS_SUPPORT=y
652# CONFIG_PRINTK_TIME is not set
653CONFIG_ENABLE_WARN_DEPRECATED=y
654# CONFIG_ENABLE_MUST_CHECK is not set
655CONFIG_FRAME_WARN=1024
656CONFIG_MAGIC_SYSRQ=y
657# CONFIG_UNUSED_SYMBOLS is not set
658CONFIG_DEBUG_FS=y
659# CONFIG_HEADERS_CHECK is not set
660# CONFIG_DEBUG_KERNEL is not set
661# CONFIG_DEBUG_BUGVERBOSE is not set
662# CONFIG_DEBUG_MEMORY_INIT is not set
663# CONFIG_RCU_CPU_STALL_DETECTOR is not set
664# CONFIG_LATENCYTOP is not set
665CONFIG_SYSCTL_SYSCALL_CHECK=y
666CONFIG_HAVE_FUNCTION_TRACER=y
667CONFIG_HAVE_DYNAMIC_FTRACE=y
668CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
669
670#
671# Tracers
672#
673# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
674# CONFIG_SAMPLES is not set
675# CONFIG_SH_STANDARD_BIOS is not set
676# CONFIG_EARLY_SCIF_CONSOLE is not set
677
678#
679# Security options
680#
681# CONFIG_KEYS is not set
682# CONFIG_SECURITY is not set
683# CONFIG_SECURITYFS is not set
684# CONFIG_SECURITY_FILE_CAPABILITIES is not set
685# CONFIG_CRYPTO is not set
686
687#
688# Library routines
689#
690CONFIG_BITREVERSE=y
691# CONFIG_CRC_CCITT is not set
692# CONFIG_CRC16 is not set
693# CONFIG_CRC_T10DIF is not set
694# CONFIG_CRC_ITU_T is not set
695CONFIG_CRC32=y
696# CONFIG_CRC7 is not set
697# CONFIG_LIBCRC32C is not set
698CONFIG_ZLIB_INFLATE=y
699CONFIG_ZLIB_DEFLATE=y
700CONFIG_PLIST=y
701CONFIG_HAS_IOMEM=y
702CONFIG_HAS_IOPORT=y
703CONFIG_HAS_DMA=y
diff --git a/arch/sh/configs/rsk7203_defconfig b/arch/sh/configs/rsk7203_defconfig
index 85b0ac4fc667..dcdef31cf19b 100644
--- a/arch/sh/configs/rsk7203_defconfig
+++ b/arch/sh/configs/rsk7203_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.27 3# Linux kernel version: 2.6.28-rc6
4# Tue Oct 21 12:58:47 2008 4# Mon Dec 8 14:35:03 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -16,6 +16,8 @@ CONFIG_GENERIC_IRQ_PROBE=y
16CONFIG_GENERIC_GPIO=y 16CONFIG_GENERIC_GPIO=y
17# CONFIG_GENERIC_TIME is not set 17# CONFIG_GENERIC_TIME is not set
18# CONFIG_GENERIC_CLOCKEVENTS is not set 18# CONFIG_GENERIC_CLOCKEVENTS is not set
19# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
20# CONFIG_ARCH_HIBERNATION_POSSIBLE is not set
19CONFIG_STACKTRACE_SUPPORT=y 21CONFIG_STACKTRACE_SUPPORT=y
20CONFIG_LOCKDEP_SUPPORT=y 22CONFIG_LOCKDEP_SUPPORT=y
21CONFIG_HAVE_LATENCYTOP_SUPPORT=y 23CONFIG_HAVE_LATENCYTOP_SUPPORT=y
@@ -75,7 +77,6 @@ CONFIG_TIMERFD=y
75CONFIG_EVENTFD=y 77CONFIG_EVENTFD=y
76CONFIG_AIO=y 78CONFIG_AIO=y
77CONFIG_VM_EVENT_COUNTERS=y 79CONFIG_VM_EVENT_COUNTERS=y
78CONFIG_PCI_QUIRKS=y
79# CONFIG_SLAB is not set 80# CONFIG_SLAB is not set
80# CONFIG_SLUB is not set 81# CONFIG_SLUB is not set
81CONFIG_SLOB=y 82CONFIG_SLOB=y
@@ -126,6 +127,7 @@ CONFIG_CLASSIC_RCU=y
126CONFIG_CPU_SH2=y 127CONFIG_CPU_SH2=y
127CONFIG_CPU_SH2A=y 128CONFIG_CPU_SH2A=y
128# CONFIG_CPU_SUBTYPE_SH7619 is not set 129# CONFIG_CPU_SUBTYPE_SH7619 is not set
130# CONFIG_CPU_SUBTYPE_SH7201 is not set
129CONFIG_CPU_SUBTYPE_SH7203=y 131CONFIG_CPU_SUBTYPE_SH7203=y
130# CONFIG_CPU_SUBTYPE_SH7206 is not set 132# CONFIG_CPU_SUBTYPE_SH7206 is not set
131# CONFIG_CPU_SUBTYPE_SH7263 is not set 133# CONFIG_CPU_SUBTYPE_SH7263 is not set
@@ -211,6 +213,8 @@ CONFIG_CPU_HAS_FPU=y
211# 213#
212# Board support 214# Board support
213# 215#
216CONFIG_SH_RSK=y
217# CONFIG_SH_RSK7201 is not set
214CONFIG_SH_RSK7203=y 218CONFIG_SH_RSK7203=y
215 219
216# 220#
@@ -296,6 +300,14 @@ CONFIG_BINFMT_ZFLAT=y
296CONFIG_BINFMT_SHARED_FLAT=y 300CONFIG_BINFMT_SHARED_FLAT=y
297# CONFIG_HAVE_AOUT is not set 301# CONFIG_HAVE_AOUT is not set
298# CONFIG_BINFMT_MISC is not set 302# CONFIG_BINFMT_MISC is not set
303
304#
305# Power management options (EXPERIMENTAL)
306#
307CONFIG_PM=y
308# CONFIG_PM_DEBUG is not set
309CONFIG_CPU_IDLE=y
310CONFIG_CPU_IDLE_GOV_LADDER=y
299CONFIG_NET=y 311CONFIG_NET=y
300 312
301# 313#
@@ -477,6 +489,7 @@ CONFIG_BLK_DEV=y
477CONFIG_MISC_DEVICES=y 489CONFIG_MISC_DEVICES=y
478# CONFIG_EEPROM_93CX6 is not set 490# CONFIG_EEPROM_93CX6 is not set
479# CONFIG_ENCLOSURE_SERVICES is not set 491# CONFIG_ENCLOSURE_SERVICES is not set
492# CONFIG_C2PORT is not set
480CONFIG_HAVE_IDE=y 493CONFIG_HAVE_IDE=y
481# CONFIG_IDE is not set 494# CONFIG_IDE is not set
482 495
@@ -603,11 +616,11 @@ CONFIG_SERIAL_CORE_CONSOLE=y
603# CONFIG_HWMON is not set 616# CONFIG_HWMON is not set
604CONFIG_THERMAL=y 617CONFIG_THERMAL=y
605# CONFIG_WATCHDOG is not set 618# CONFIG_WATCHDOG is not set
619CONFIG_SSB_POSSIBLE=y
606 620
607# 621#
608# Sonics Silicon Backplane 622# Sonics Silicon Backplane
609# 623#
610CONFIG_SSB_POSSIBLE=y
611# CONFIG_SSB is not set 624# CONFIG_SSB is not set
612 625
613# 626#
@@ -617,7 +630,11 @@ CONFIG_SSB_POSSIBLE=y
617# CONFIG_MFD_SM501 is not set 630# CONFIG_MFD_SM501 is not set
618# CONFIG_HTC_PASIC3 is not set 631# CONFIG_HTC_PASIC3 is not set
619# CONFIG_MFD_TMIO is not set 632# CONFIG_MFD_TMIO is not set
620# CONFIG_MFD_WM8400 is not set 633CONFIG_REGULATOR=y
634# CONFIG_REGULATOR_DEBUG is not set
635# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
636# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
637# CONFIG_REGULATOR_BQ24022 is not set
621 638
622# 639#
623# Multimedia devices 640# Multimedia devices
@@ -702,19 +719,22 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
702CONFIG_USB_DEVICEFS=y 719CONFIG_USB_DEVICEFS=y
703CONFIG_USB_DEVICE_CLASS=y 720CONFIG_USB_DEVICE_CLASS=y
704# CONFIG_USB_DYNAMIC_MINORS is not set 721# CONFIG_USB_DYNAMIC_MINORS is not set
722# CONFIG_USB_SUSPEND is not set
705# CONFIG_USB_OTG is not set 723# CONFIG_USB_OTG is not set
706# CONFIG_USB_OTG_WHITELIST is not set 724# CONFIG_USB_OTG_WHITELIST is not set
707# CONFIG_USB_OTG_BLACKLIST_HUB is not set 725# CONFIG_USB_OTG_BLACKLIST_HUB is not set
708CONFIG_USB_MON=y 726CONFIG_USB_MON=y
727# CONFIG_USB_WUSB is not set
728# CONFIG_USB_WUSB_CBAF is not set
709 729
710# 730#
711# USB Host Controller Drivers 731# USB Host Controller Drivers
712# 732#
713# CONFIG_USB_C67X00_HCD is not set 733# CONFIG_USB_C67X00_HCD is not set
714# CONFIG_USB_ISP116X_HCD is not set 734# CONFIG_USB_ISP116X_HCD is not set
715# CONFIG_USB_ISP1760_HCD is not set
716# CONFIG_USB_SL811_HCD is not set 735# CONFIG_USB_SL811_HCD is not set
717CONFIG_USB_R8A66597_HCD=y 736CONFIG_USB_R8A66597_HCD=y
737# CONFIG_USB_HWA_HCD is not set
718 738
719# 739#
720# USB Device Class drivers 740# USB Device Class drivers
@@ -725,11 +745,11 @@ CONFIG_USB_R8A66597_HCD=y
725# CONFIG_USB_TMC is not set 745# CONFIG_USB_TMC is not set
726 746
727# 747#
728# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 748# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
729# 749#
730 750
731# 751#
732# may also be needed; see USB_STORAGE Help for more information 752# see USB_STORAGE Help for more information
733# 753#
734# CONFIG_USB_LIBUSUAL is not set 754# CONFIG_USB_LIBUSUAL is not set
735 755
@@ -770,7 +790,22 @@ CONFIG_USB_R8A66597_HCD=y
770# CONFIG_USB_GADGET is not set 790# CONFIG_USB_GADGET is not set
771# CONFIG_MMC is not set 791# CONFIG_MMC is not set
772# CONFIG_MEMSTICK is not set 792# CONFIG_MEMSTICK is not set
773# CONFIG_NEW_LEDS is not set 793CONFIG_NEW_LEDS=y
794CONFIG_LEDS_CLASS=y
795
796#
797# LED drivers
798#
799CONFIG_LEDS_GPIO=y
800
801#
802# LED Triggers
803#
804CONFIG_LEDS_TRIGGERS=y
805CONFIG_LEDS_TRIGGER_TIMER=y
806CONFIG_LEDS_TRIGGER_HEARTBEAT=y
807CONFIG_LEDS_TRIGGER_BACKLIGHT=y
808CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
774# CONFIG_ACCESSIBILITY is not set 809# CONFIG_ACCESSIBILITY is not set
775CONFIG_RTC_LIB=y 810CONFIG_RTC_LIB=y
776CONFIG_RTC_CLASS=y 811CONFIG_RTC_CLASS=y
@@ -812,6 +847,7 @@ CONFIG_RTC_DRV_SH=y
812# CONFIG_DMADEVICES is not set 847# CONFIG_DMADEVICES is not set
813# CONFIG_UIO is not set 848# CONFIG_UIO is not set
814# CONFIG_STAGING is not set 849# CONFIG_STAGING is not set
850CONFIG_STAGING_EXCLUDE_BUILD=y
815 851
816# 852#
817# File systems 853# File systems
@@ -950,9 +986,14 @@ CONFIG_FRAME_POINTER=y
950# CONFIG_FAULT_INJECTION is not set 986# CONFIG_FAULT_INJECTION is not set
951# CONFIG_LATENCYTOP is not set 987# CONFIG_LATENCYTOP is not set
952CONFIG_SYSCTL_SYSCALL_CHECK=y 988CONFIG_SYSCTL_SYSCALL_CHECK=y
953CONFIG_NOP_TRACER=y 989CONFIG_HAVE_FUNCTION_TRACER=y
954CONFIG_HAVE_FTRACE=y 990CONFIG_HAVE_DYNAMIC_FTRACE=y
955# CONFIG_FTRACE is not set 991CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
992
993#
994# Tracers
995#
996# CONFIG_FUNCTION_TRACER is not set
956# CONFIG_SCHED_TRACER is not set 997# CONFIG_SCHED_TRACER is not set
957# CONFIG_CONTEXT_SWITCH_TRACER is not set 998# CONFIG_CONTEXT_SWITCH_TRACER is not set
958# CONFIG_BOOT_TRACER is not set 999# CONFIG_BOOT_TRACER is not set
diff --git a/arch/sh/configs/rts7751r2dplus_qemu_defconfig b/arch/sh/configs/rts7751r2dplus_qemu_defconfig
deleted file mode 100644
index ae8f63000fbf..000000000000
--- a/arch/sh/configs/rts7751r2dplus_qemu_defconfig
+++ /dev/null
@@ -1,949 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.27
4# Wed Oct 22 18:51:20 2008
5#
6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
8CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
9CONFIG_RWSEM_GENERIC_SPINLOCK=y
10CONFIG_GENERIC_BUG=y
11CONFIG_GENERIC_FIND_NEXT_BIT=y
12CONFIG_GENERIC_HWEIGHT=y
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
15CONFIG_GENERIC_IRQ_PROBE=y
16# CONFIG_GENERIC_GPIO is not set
17CONFIG_GENERIC_TIME=y
18CONFIG_GENERIC_CLOCKEVENTS=y
19CONFIG_SYS_SUPPORTS_PCI=y
20CONFIG_STACKTRACE_SUPPORT=y
21CONFIG_LOCKDEP_SUPPORT=y
22CONFIG_HAVE_LATENCYTOP_SUPPORT=y
23# CONFIG_ARCH_HAS_ILOG2_U32 is not set
24# CONFIG_ARCH_HAS_ILOG2_U64 is not set
25CONFIG_ARCH_NO_VIRT_TO_BUS=y
26CONFIG_IO_TRAPPED=y
27CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
28
29#
30# General setup
31#
32CONFIG_EXPERIMENTAL=y
33CONFIG_BROKEN_ON_SMP=y
34CONFIG_INIT_ENV_ARG_LIMIT=32
35CONFIG_LOCALVERSION=""
36CONFIG_LOCALVERSION_AUTO=y
37CONFIG_SWAP=y
38CONFIG_SYSVIPC=y
39CONFIG_SYSVIPC_SYSCTL=y
40# CONFIG_BSD_PROCESS_ACCT is not set
41CONFIG_IKCONFIG=y
42CONFIG_IKCONFIG_PROC=y
43CONFIG_LOG_BUF_SHIFT=14
44# CONFIG_CGROUPS is not set
45CONFIG_GROUP_SCHED=y
46CONFIG_FAIR_GROUP_SCHED=y
47# CONFIG_RT_GROUP_SCHED is not set
48CONFIG_USER_SCHED=y
49# CONFIG_CGROUP_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
54CONFIG_BLK_DEV_INITRD=y
55CONFIG_INITRAMFS_SOURCE=""
56# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
57CONFIG_SYSCTL=y
58CONFIG_EMBEDDED=y
59CONFIG_UID16=y
60# CONFIG_SYSCTL_SYSCALL is not set
61CONFIG_KALLSYMS=y
62# CONFIG_KALLSYMS_ALL is not set
63# CONFIG_KALLSYMS_EXTRA_PASS is not set
64# CONFIG_HOTPLUG is not set
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_AIO=y
78CONFIG_VM_EVENT_COUNTERS=y
79CONFIG_PCI_QUIRKS=y
80CONFIG_SLAB=y
81# CONFIG_SLUB is not set
82# CONFIG_SLOB is not set
83CONFIG_PROFILING=y
84# CONFIG_MARKERS is not set
85CONFIG_OPROFILE=y
86CONFIG_HAVE_OPROFILE=y
87# CONFIG_KPROBES is not set
88CONFIG_HAVE_IOREMAP_PROT=y
89CONFIG_HAVE_KPROBES=y
90CONFIG_HAVE_KRETPROBES=y
91CONFIG_HAVE_ARCH_TRACEHOOK=y
92CONFIG_HAVE_CLK=y
93CONFIG_HAVE_GENERIC_DMA_COHERENT=y
94CONFIG_SLABINFO=y
95CONFIG_RT_MUTEXES=y
96# CONFIG_TINY_SHMEM is not set
97CONFIG_BASE_SMALL=0
98CONFIG_MODULES=y
99# CONFIG_MODULE_FORCE_LOAD is not set
100# CONFIG_MODULE_UNLOAD is not set
101# CONFIG_MODVERSIONS is not set
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# CONFIG_BLK_DEV_INTEGRITY is not set
110
111#
112# IO Schedulers
113#
114CONFIG_IOSCHED_NOOP=y
115CONFIG_IOSCHED_AS=y
116CONFIG_IOSCHED_DEADLINE=y
117CONFIG_IOSCHED_CFQ=y
118CONFIG_DEFAULT_AS=y
119# CONFIG_DEFAULT_DEADLINE is not set
120# CONFIG_DEFAULT_CFQ is not set
121# CONFIG_DEFAULT_NOOP is not set
122CONFIG_DEFAULT_IOSCHED="anticipatory"
123CONFIG_CLASSIC_RCU=y
124# CONFIG_FREEZER is not set
125
126#
127# System type
128#
129CONFIG_CPU_SH4=y
130# CONFIG_CPU_SUBTYPE_SH7619 is not set
131# CONFIG_CPU_SUBTYPE_SH7203 is not set
132# CONFIG_CPU_SUBTYPE_SH7206 is not set
133# CONFIG_CPU_SUBTYPE_SH7263 is not set
134# CONFIG_CPU_SUBTYPE_MXG is not set
135# CONFIG_CPU_SUBTYPE_SH7705 is not set
136# CONFIG_CPU_SUBTYPE_SH7706 is not set
137# CONFIG_CPU_SUBTYPE_SH7707 is not set
138# CONFIG_CPU_SUBTYPE_SH7708 is not set
139# CONFIG_CPU_SUBTYPE_SH7709 is not set
140# CONFIG_CPU_SUBTYPE_SH7710 is not set
141# CONFIG_CPU_SUBTYPE_SH7712 is not set
142# CONFIG_CPU_SUBTYPE_SH7720 is not set
143# CONFIG_CPU_SUBTYPE_SH7721 is not set
144# CONFIG_CPU_SUBTYPE_SH7750 is not set
145# CONFIG_CPU_SUBTYPE_SH7091 is not set
146# CONFIG_CPU_SUBTYPE_SH7750R is not set
147# CONFIG_CPU_SUBTYPE_SH7750S is not set
148# CONFIG_CPU_SUBTYPE_SH7751 is not set
149CONFIG_CPU_SUBTYPE_SH7751R=y
150# CONFIG_CPU_SUBTYPE_SH7760 is not set
151# CONFIG_CPU_SUBTYPE_SH4_202 is not set
152# CONFIG_CPU_SUBTYPE_SH7723 is not set
153# CONFIG_CPU_SUBTYPE_SH7763 is not set
154# CONFIG_CPU_SUBTYPE_SH7770 is not set
155# CONFIG_CPU_SUBTYPE_SH7780 is not set
156# CONFIG_CPU_SUBTYPE_SH7785 is not set
157# CONFIG_CPU_SUBTYPE_SHX3 is not set
158# CONFIG_CPU_SUBTYPE_SH7343 is not set
159# CONFIG_CPU_SUBTYPE_SH7722 is not set
160# CONFIG_CPU_SUBTYPE_SH7366 is not set
161# CONFIG_CPU_SUBTYPE_SH5_101 is not set
162# CONFIG_CPU_SUBTYPE_SH5_103 is not set
163
164#
165# Memory management options
166#
167CONFIG_QUICKLIST=y
168CONFIG_MMU=y
169CONFIG_PAGE_OFFSET=0x80000000
170CONFIG_MEMORY_START=0x0c000000
171CONFIG_MEMORY_SIZE=0x04000000
172CONFIG_29BIT=y
173CONFIG_VSYSCALL=y
174CONFIG_ARCH_FLATMEM_ENABLE=y
175CONFIG_ARCH_SPARSEMEM_ENABLE=y
176CONFIG_ARCH_SPARSEMEM_DEFAULT=y
177CONFIG_MAX_ACTIVE_REGIONS=1
178CONFIG_ARCH_POPULATES_NODE_MAP=y
179CONFIG_ARCH_SELECT_MEMORY_MODEL=y
180CONFIG_PAGE_SIZE_4KB=y
181# CONFIG_PAGE_SIZE_8KB is not set
182# CONFIG_PAGE_SIZE_16KB is not set
183# CONFIG_PAGE_SIZE_64KB is not set
184CONFIG_ENTRY_OFFSET=0x00001000
185CONFIG_SELECT_MEMORY_MODEL=y
186CONFIG_FLATMEM_MANUAL=y
187# CONFIG_DISCONTIGMEM_MANUAL is not set
188# CONFIG_SPARSEMEM_MANUAL is not set
189CONFIG_FLATMEM=y
190CONFIG_FLAT_NODE_MEM_MAP=y
191CONFIG_SPARSEMEM_STATIC=y
192CONFIG_PAGEFLAGS_EXTENDED=y
193CONFIG_SPLIT_PTLOCK_CPUS=4
194# CONFIG_RESOURCES_64BIT is not set
195# CONFIG_PHYS_ADDR_T_64BIT is not set
196CONFIG_ZONE_DMA_FLAG=0
197CONFIG_NR_QUICK=2
198CONFIG_UNEVICTABLE_LRU=y
199
200#
201# Cache configuration
202#
203# CONFIG_SH_DIRECT_MAPPED is not set
204CONFIG_CACHE_WRITEBACK=y
205# CONFIG_CACHE_WRITETHROUGH is not set
206# CONFIG_CACHE_OFF is not set
207
208#
209# Processor features
210#
211CONFIG_CPU_LITTLE_ENDIAN=y
212# CONFIG_CPU_BIG_ENDIAN is not set
213CONFIG_SH_FPU=y
214# CONFIG_SH_STORE_QUEUES is not set
215CONFIG_CPU_HAS_INTEVT=y
216CONFIG_CPU_HAS_SR_RB=y
217CONFIG_CPU_HAS_PTEA=y
218CONFIG_CPU_HAS_FPU=y
219
220#
221# Board support
222#
223# CONFIG_SH_7751_SYSTEMH is not set
224# CONFIG_SH_SECUREEDGE5410 is not set
225CONFIG_SH_RTS7751R2D=y
226# CONFIG_SH_LANDISK is not set
227# CONFIG_SH_TITAN is not set
228# CONFIG_SH_LBOX_RE2 is not set
229
230#
231# RTS7751R2D Board Revision
232#
233CONFIG_RTS7751R2D_PLUS=y
234# CONFIG_RTS7751R2D_1 is not set
235
236#
237# Timer and clock configuration
238#
239CONFIG_SH_TMU=y
240CONFIG_SH_TIMER_IRQ=16
241CONFIG_SH_PCLK_FREQ=60000000
242# CONFIG_NO_HZ is not set
243# CONFIG_HIGH_RES_TIMERS is not set
244CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
245
246#
247# CPU Frequency scaling
248#
249# CONFIG_CPU_FREQ is not set
250
251#
252# DMA support
253#
254# CONFIG_SH_DMA is not set
255
256#
257# Companion Chips
258#
259
260#
261# Additional SuperH Device Drivers
262#
263CONFIG_HEARTBEAT=y
264# CONFIG_PUSH_SWITCH is not set
265
266#
267# Kernel features
268#
269# CONFIG_HZ_100 is not set
270CONFIG_HZ_250=y
271# CONFIG_HZ_300 is not set
272# CONFIG_HZ_1000 is not set
273CONFIG_HZ=250
274# CONFIG_SCHED_HRTICK is not set
275# CONFIG_KEXEC is not set
276# CONFIG_CRASH_DUMP is not set
277CONFIG_SECCOMP=y
278CONFIG_PREEMPT_NONE=y
279# CONFIG_PREEMPT_VOLUNTARY is not set
280# CONFIG_PREEMPT is not set
281CONFIG_GUSA=y
282# CONFIG_GUSA_RB is not set
283
284#
285# Boot options
286#
287CONFIG_ZERO_PAGE_OFFSET=0x00010000
288CONFIG_BOOT_LINK_OFFSET=0x00800000
289# CONFIG_UBC_WAKEUP is not set
290CONFIG_CMDLINE_BOOL=y
291CONFIG_CMDLINE="console=tty0 console=ttySC0,115200 root=/dev/sda1 earlyprintk=serial"
292
293#
294# Bus options
295#
296# CONFIG_PCI is not set
297# CONFIG_ARCH_SUPPORTS_MSI is not set
298
299#
300# Executable file formats
301#
302CONFIG_BINFMT_ELF=y
303# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
304# CONFIG_HAVE_AOUT is not set
305# CONFIG_BINFMT_MISC is not set
306# CONFIG_NET is not set
307
308#
309# Device Drivers
310#
311
312#
313# Generic Driver Options
314#
315CONFIG_STANDALONE=y
316CONFIG_PREVENT_FIRMWARE_BUILD=y
317# CONFIG_DEBUG_DRIVER is not set
318# CONFIG_DEBUG_DEVRES is not set
319# CONFIG_SYS_HYPERVISOR is not set
320# CONFIG_MTD is not set
321# CONFIG_PARPORT is not set
322CONFIG_BLK_DEV=y
323# CONFIG_BLK_DEV_COW_COMMON is not set
324# CONFIG_BLK_DEV_LOOP is not set
325CONFIG_BLK_DEV_RAM=y
326CONFIG_BLK_DEV_RAM_COUNT=16
327CONFIG_BLK_DEV_RAM_SIZE=4096
328# CONFIG_BLK_DEV_XIP is not set
329# CONFIG_CDROM_PKTCDVD is not set
330# CONFIG_BLK_DEV_HD is not set
331CONFIG_MISC_DEVICES=y
332# CONFIG_EEPROM_93CX6 is not set
333# CONFIG_ENCLOSURE_SERVICES is not set
334CONFIG_HAVE_IDE=y
335# CONFIG_IDE is not set
336
337#
338# SCSI device support
339#
340# CONFIG_RAID_ATTRS is not set
341CONFIG_SCSI=y
342CONFIG_SCSI_DMA=y
343# CONFIG_SCSI_TGT is not set
344# CONFIG_SCSI_NETLINK is not set
345CONFIG_SCSI_PROC_FS=y
346
347#
348# SCSI support type (disk, tape, CD-ROM)
349#
350CONFIG_BLK_DEV_SD=y
351# CONFIG_CHR_DEV_ST is not set
352# CONFIG_CHR_DEV_OSST is not set
353# CONFIG_BLK_DEV_SR is not set
354# CONFIG_CHR_DEV_SG is not set
355# CONFIG_CHR_DEV_SCH is not set
356
357#
358# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
359#
360# CONFIG_SCSI_MULTI_LUN is not set
361# CONFIG_SCSI_CONSTANTS is not set
362# CONFIG_SCSI_LOGGING is not set
363# CONFIG_SCSI_SCAN_ASYNC is not set
364CONFIG_SCSI_WAIT_SCAN=m
365
366#
367# SCSI Transports
368#
369# CONFIG_SCSI_SPI_ATTRS is not set
370# CONFIG_SCSI_FC_ATTRS is not set
371# CONFIG_SCSI_SAS_LIBSAS is not set
372# CONFIG_SCSI_SRP_ATTRS is not set
373CONFIG_SCSI_LOWLEVEL=y
374# CONFIG_SCSI_DEBUG is not set
375# CONFIG_SCSI_DH is not set
376CONFIG_ATA=y
377# CONFIG_ATA_NONSTANDARD is not set
378CONFIG_SATA_PMP=y
379CONFIG_ATA_SFF=y
380# CONFIG_SATA_MV is not set
381# CONFIG_PATA_PLATFORM is not set
382# CONFIG_MD is not set
383# CONFIG_PHONE is not set
384
385#
386# Input device support
387#
388CONFIG_INPUT=y
389# CONFIG_INPUT_FF_MEMLESS is not set
390# CONFIG_INPUT_POLLDEV is not set
391
392#
393# Userland interfaces
394#
395# CONFIG_INPUT_MOUSEDEV is not set
396# CONFIG_INPUT_JOYDEV is not set
397# CONFIG_INPUT_EVDEV is not set
398# CONFIG_INPUT_EVBUG is not set
399
400#
401# Input Device Drivers
402#
403# CONFIG_INPUT_KEYBOARD is not set
404# CONFIG_INPUT_MOUSE is not set
405# CONFIG_INPUT_JOYSTICK is not set
406# CONFIG_INPUT_TABLET is not set
407# CONFIG_INPUT_TOUCHSCREEN is not set
408# CONFIG_INPUT_MISC is not set
409
410#
411# Hardware I/O ports
412#
413# CONFIG_SERIO is not set
414# CONFIG_GAMEPORT is not set
415
416#
417# Character devices
418#
419CONFIG_VT=y
420CONFIG_CONSOLE_TRANSLATIONS=y
421CONFIG_VT_CONSOLE=y
422CONFIG_HW_CONSOLE=y
423CONFIG_VT_HW_CONSOLE_BINDING=y
424CONFIG_DEVKMEM=y
425# CONFIG_SERIAL_NONSTANDARD is not set
426
427#
428# Serial drivers
429#
430CONFIG_SERIAL_8250=y
431# CONFIG_SERIAL_8250_CONSOLE is not set
432CONFIG_SERIAL_8250_NR_UARTS=4
433CONFIG_SERIAL_8250_RUNTIME_UARTS=4
434# CONFIG_SERIAL_8250_EXTENDED is not set
435
436#
437# Non-8250 serial port support
438#
439CONFIG_SERIAL_SH_SCI=y
440CONFIG_SERIAL_SH_SCI_NR_UARTS=1
441CONFIG_SERIAL_SH_SCI_CONSOLE=y
442CONFIG_SERIAL_CORE=y
443CONFIG_SERIAL_CORE_CONSOLE=y
444CONFIG_UNIX98_PTYS=y
445CONFIG_LEGACY_PTYS=y
446CONFIG_LEGACY_PTY_COUNT=256
447# CONFIG_IPMI_HANDLER is not set
448CONFIG_HW_RANDOM=y
449# CONFIG_R3964 is not set
450# CONFIG_RAW_DRIVER is not set
451# CONFIG_TCG_TPM is not set
452# CONFIG_I2C is not set
453CONFIG_SPI=y
454# CONFIG_SPI_DEBUG is not set
455CONFIG_SPI_MASTER=y
456
457#
458# SPI Master Controller Drivers
459#
460CONFIG_SPI_BITBANG=y
461# CONFIG_SPI_SH_SCI is not set
462
463#
464# SPI Protocol Masters
465#
466# CONFIG_SPI_AT25 is not set
467# CONFIG_SPI_SPIDEV is not set
468# CONFIG_SPI_TLE62X0 is not set
469# CONFIG_W1 is not set
470# CONFIG_POWER_SUPPLY is not set
471CONFIG_HWMON=y
472# CONFIG_HWMON_VID is not set
473# CONFIG_SENSORS_ADCXX is not set
474# CONFIG_SENSORS_F71805F is not set
475# CONFIG_SENSORS_F71882FG is not set
476# CONFIG_SENSORS_IT87 is not set
477# CONFIG_SENSORS_LM70 is not set
478# CONFIG_SENSORS_MAX1111 is not set
479# CONFIG_SENSORS_PC87360 is not set
480# CONFIG_SENSORS_PC87427 is not set
481# CONFIG_SENSORS_SMSC47M1 is not set
482# CONFIG_SENSORS_SMSC47B397 is not set
483# CONFIG_SENSORS_VT1211 is not set
484# CONFIG_SENSORS_W83627HF is not set
485# CONFIG_SENSORS_W83627EHF is not set
486# CONFIG_HWMON_DEBUG_CHIP is not set
487# CONFIG_THERMAL is not set
488# CONFIG_THERMAL_HWMON is not set
489# CONFIG_WATCHDOG is not set
490
491#
492# Sonics Silicon Backplane
493#
494CONFIG_SSB_POSSIBLE=y
495# CONFIG_SSB is not set
496
497#
498# Multifunction device drivers
499#
500# CONFIG_MFD_CORE is not set
501CONFIG_MFD_SM501=y
502# CONFIG_HTC_PASIC3 is not set
503# CONFIG_MFD_TMIO is not set
504# CONFIG_MFD_WM8400 is not set
505
506#
507# Multimedia devices
508#
509
510#
511# Multimedia core support
512#
513# CONFIG_VIDEO_DEV is not set
514# CONFIG_VIDEO_MEDIA is not set
515
516#
517# Multimedia drivers
518#
519CONFIG_DAB=y
520
521#
522# Graphics support
523#
524# CONFIG_VGASTATE is not set
525CONFIG_VIDEO_OUTPUT_CONTROL=m
526CONFIG_FB=y
527# CONFIG_FIRMWARE_EDID is not set
528# CONFIG_FB_DDC is not set
529# CONFIG_FB_BOOT_VESA_SUPPORT is not set
530CONFIG_FB_CFB_FILLRECT=y
531CONFIG_FB_CFB_COPYAREA=y
532CONFIG_FB_CFB_IMAGEBLIT=y
533# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
534# CONFIG_FB_SYS_FILLRECT is not set
535# CONFIG_FB_SYS_COPYAREA is not set
536# CONFIG_FB_SYS_IMAGEBLIT is not set
537# CONFIG_FB_FOREIGN_ENDIAN is not set
538# CONFIG_FB_SYS_FOPS is not set
539# CONFIG_FB_SVGALIB is not set
540# CONFIG_FB_MACMODES is not set
541# CONFIG_FB_BACKLIGHT is not set
542# CONFIG_FB_MODE_HELPERS is not set
543# CONFIG_FB_TILEBLITTING is not set
544
545#
546# Frame buffer hardware drivers
547#
548# CONFIG_FB_S1D13XXX is not set
549CONFIG_FB_SH_MOBILE_LCDC=m
550CONFIG_FB_SM501=y
551# CONFIG_FB_VIRTUAL is not set
552# CONFIG_FB_METRONOME is not set
553# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
554
555#
556# Display device support
557#
558# CONFIG_DISPLAY_SUPPORT is not set
559
560#
561# Console display driver support
562#
563CONFIG_DUMMY_CONSOLE=y
564CONFIG_FRAMEBUFFER_CONSOLE=y
565# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
566# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
567# CONFIG_FONTS is not set
568CONFIG_FONT_8x8=y
569CONFIG_FONT_8x16=y
570CONFIG_LOGO=y
571# CONFIG_LOGO_LINUX_MONO is not set
572# CONFIG_LOGO_LINUX_VGA16 is not set
573# CONFIG_LOGO_LINUX_CLUT224 is not set
574# CONFIG_LOGO_SUPERH_MONO is not set
575# CONFIG_LOGO_SUPERH_VGA16 is not set
576CONFIG_LOGO_SUPERH_CLUT224=y
577CONFIG_SOUND=y
578CONFIG_SOUND_OSS_CORE=y
579CONFIG_SND=m
580# CONFIG_SND_SEQUENCER is not set
581# CONFIG_SND_MIXER_OSS is not set
582# CONFIG_SND_PCM_OSS is not set
583# CONFIG_SND_DYNAMIC_MINORS is not set
584CONFIG_SND_SUPPORT_OLD_API=y
585CONFIG_SND_VERBOSE_PROCFS=y
586# CONFIG_SND_VERBOSE_PRINTK is not set
587# CONFIG_SND_DEBUG is not set
588CONFIG_SND_DRIVERS=y
589# CONFIG_SND_DUMMY is not set
590# CONFIG_SND_MTPAV is not set
591# CONFIG_SND_SERIAL_U16550 is not set
592# CONFIG_SND_MPU401 is not set
593CONFIG_SND_SPI=y
594CONFIG_SND_SUPERH=y
595# CONFIG_SND_SOC is not set
596CONFIG_SOUND_PRIME=m
597CONFIG_HID_SUPPORT=y
598CONFIG_HID=y
599# CONFIG_HID_DEBUG is not set
600# CONFIG_HIDRAW is not set
601# CONFIG_HID_PID is not set
602
603#
604# Special HID drivers
605#
606CONFIG_HID_COMPAT=y
607# CONFIG_USB_SUPPORT is not set
608# CONFIG_MMC is not set
609# CONFIG_MEMSTICK is not set
610# CONFIG_NEW_LEDS is not set
611# CONFIG_ACCESSIBILITY is not set
612CONFIG_RTC_LIB=y
613CONFIG_RTC_CLASS=y
614CONFIG_RTC_HCTOSYS=y
615CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
616# CONFIG_RTC_DEBUG is not set
617
618#
619# RTC interfaces
620#
621CONFIG_RTC_INTF_SYSFS=y
622CONFIG_RTC_INTF_PROC=y
623CONFIG_RTC_INTF_DEV=y
624# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
625# CONFIG_RTC_DRV_TEST is not set
626
627#
628# SPI RTC drivers
629#
630# CONFIG_RTC_DRV_M41T94 is not set
631# CONFIG_RTC_DRV_DS1305 is not set
632# CONFIG_RTC_DRV_MAX6902 is not set
633CONFIG_RTC_DRV_R9701=y
634# CONFIG_RTC_DRV_RS5C348 is not set
635# CONFIG_RTC_DRV_DS3234 is not set
636
637#
638# Platform RTC drivers
639#
640# CONFIG_RTC_DRV_DS1286 is not set
641# CONFIG_RTC_DRV_DS1511 is not set
642# CONFIG_RTC_DRV_DS1553 is not set
643# CONFIG_RTC_DRV_DS1742 is not set
644# CONFIG_RTC_DRV_STK17TA8 is not set
645# CONFIG_RTC_DRV_M48T86 is not set
646# CONFIG_RTC_DRV_M48T35 is not set
647# CONFIG_RTC_DRV_M48T59 is not set
648# CONFIG_RTC_DRV_BQ4802 is not set
649# CONFIG_RTC_DRV_V3020 is not set
650
651#
652# on-CPU RTC drivers
653#
654# CONFIG_RTC_DRV_SH is not set
655# CONFIG_DMADEVICES is not set
656# CONFIG_UIO is not set
657# CONFIG_STAGING is not set
658
659#
660# File systems
661#
662CONFIG_EXT2_FS=y
663# CONFIG_EXT2_FS_XATTR is not set
664# CONFIG_EXT2_FS_XIP is not set
665# CONFIG_EXT3_FS is not set
666# CONFIG_EXT4_FS is not set
667# CONFIG_REISERFS_FS is not set
668# CONFIG_JFS_FS is not set
669# CONFIG_FS_POSIX_ACL is not set
670CONFIG_FILE_LOCKING=y
671# CONFIG_XFS_FS is not set
672CONFIG_DNOTIFY=y
673CONFIG_INOTIFY=y
674CONFIG_INOTIFY_USER=y
675# CONFIG_QUOTA is not set
676# CONFIG_AUTOFS_FS is not set
677# CONFIG_AUTOFS4_FS is not set
678# CONFIG_FUSE_FS is not set
679
680#
681# CD-ROM/DVD Filesystems
682#
683# CONFIG_ISO9660_FS is not set
684# CONFIG_UDF_FS is not set
685
686#
687# DOS/FAT/NT Filesystems
688#
689CONFIG_FAT_FS=y
690CONFIG_MSDOS_FS=y
691CONFIG_VFAT_FS=y
692CONFIG_FAT_DEFAULT_CODEPAGE=437
693CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
694# CONFIG_NTFS_FS is not set
695
696#
697# Pseudo filesystems
698#
699CONFIG_PROC_FS=y
700CONFIG_PROC_KCORE=y
701CONFIG_PROC_SYSCTL=y
702CONFIG_PROC_PAGE_MONITOR=y
703CONFIG_SYSFS=y
704CONFIG_TMPFS=y
705# CONFIG_TMPFS_POSIX_ACL is not set
706# CONFIG_HUGETLBFS is not set
707# CONFIG_HUGETLB_PAGE is not set
708# CONFIG_CONFIGFS_FS is not set
709
710#
711# Miscellaneous filesystems
712#
713# CONFIG_ADFS_FS is not set
714# CONFIG_AFFS_FS is not set
715# CONFIG_HFS_FS is not set
716# CONFIG_HFSPLUS_FS is not set
717# CONFIG_BEFS_FS is not set
718# CONFIG_BFS_FS is not set
719# CONFIG_EFS_FS is not set
720# CONFIG_CRAMFS is not set
721# CONFIG_VXFS_FS is not set
722CONFIG_MINIX_FS=y
723# CONFIG_OMFS_FS is not set
724# CONFIG_HPFS_FS is not set
725# CONFIG_QNX4FS_FS is not set
726# CONFIG_ROMFS_FS is not set
727# CONFIG_SYSV_FS is not set
728# CONFIG_UFS_FS is not set
729
730#
731# Partition Types
732#
733# CONFIG_PARTITION_ADVANCED is not set
734CONFIG_MSDOS_PARTITION=y
735CONFIG_NLS=y
736CONFIG_NLS_DEFAULT="iso8859-1"
737# CONFIG_NLS_CODEPAGE_437 is not set
738# CONFIG_NLS_CODEPAGE_737 is not set
739# CONFIG_NLS_CODEPAGE_775 is not set
740# CONFIG_NLS_CODEPAGE_850 is not set
741# CONFIG_NLS_CODEPAGE_852 is not set
742# CONFIG_NLS_CODEPAGE_855 is not set
743# CONFIG_NLS_CODEPAGE_857 is not set
744# CONFIG_NLS_CODEPAGE_860 is not set
745# CONFIG_NLS_CODEPAGE_861 is not set
746# CONFIG_NLS_CODEPAGE_862 is not set
747# CONFIG_NLS_CODEPAGE_863 is not set
748# CONFIG_NLS_CODEPAGE_864 is not set
749# CONFIG_NLS_CODEPAGE_865 is not set
750# CONFIG_NLS_CODEPAGE_866 is not set
751# CONFIG_NLS_CODEPAGE_869 is not set
752# CONFIG_NLS_CODEPAGE_936 is not set
753# CONFIG_NLS_CODEPAGE_950 is not set
754CONFIG_NLS_CODEPAGE_932=y
755# CONFIG_NLS_CODEPAGE_949 is not set
756# CONFIG_NLS_CODEPAGE_874 is not set
757# CONFIG_NLS_ISO8859_8 is not set
758# CONFIG_NLS_CODEPAGE_1250 is not set
759# CONFIG_NLS_CODEPAGE_1251 is not set
760# CONFIG_NLS_ASCII is not set
761# CONFIG_NLS_ISO8859_1 is not set
762# CONFIG_NLS_ISO8859_2 is not set
763# CONFIG_NLS_ISO8859_3 is not set
764# CONFIG_NLS_ISO8859_4 is not set
765# CONFIG_NLS_ISO8859_5 is not set
766# CONFIG_NLS_ISO8859_6 is not set
767# CONFIG_NLS_ISO8859_7 is not set
768# CONFIG_NLS_ISO8859_9 is not set
769# CONFIG_NLS_ISO8859_13 is not set
770# CONFIG_NLS_ISO8859_14 is not set
771# CONFIG_NLS_ISO8859_15 is not set
772# CONFIG_NLS_KOI8_R is not set
773# CONFIG_NLS_KOI8_U is not set
774# CONFIG_NLS_UTF8 is not set
775
776#
777# Kernel hacking
778#
779CONFIG_TRACE_IRQFLAGS_SUPPORT=y
780# CONFIG_PRINTK_TIME is not set
781CONFIG_ENABLE_WARN_DEPRECATED=y
782CONFIG_ENABLE_MUST_CHECK=y
783CONFIG_FRAME_WARN=1024
784# CONFIG_MAGIC_SYSRQ is not set
785# CONFIG_UNUSED_SYMBOLS is not set
786CONFIG_DEBUG_FS=y
787# CONFIG_HEADERS_CHECK is not set
788CONFIG_DEBUG_KERNEL=y
789# CONFIG_DEBUG_SHIRQ is not set
790CONFIG_DETECT_SOFTLOCKUP=y
791# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
792CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
793CONFIG_SCHED_DEBUG=y
794# CONFIG_SCHEDSTATS is not set
795# CONFIG_TIMER_STATS is not set
796# CONFIG_DEBUG_OBJECTS is not set
797# CONFIG_DEBUG_SLAB is not set
798# CONFIG_DEBUG_RT_MUTEXES is not set
799# CONFIG_RT_MUTEX_TESTER is not set
800# CONFIG_DEBUG_SPINLOCK is not set
801# CONFIG_DEBUG_MUTEXES is not set
802# CONFIG_DEBUG_LOCK_ALLOC is not set
803# CONFIG_PROVE_LOCKING is not set
804# CONFIG_LOCK_STAT is not set
805# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
806# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
807# CONFIG_DEBUG_KOBJECT is not set
808# CONFIG_DEBUG_BUGVERBOSE is not set
809CONFIG_DEBUG_INFO=y
810# CONFIG_DEBUG_VM is not set
811# CONFIG_DEBUG_WRITECOUNT is not set
812# CONFIG_DEBUG_MEMORY_INIT is not set
813# CONFIG_DEBUG_LIST is not set
814# CONFIG_DEBUG_SG is not set
815# CONFIG_FRAME_POINTER is not set
816# CONFIG_RCU_TORTURE_TEST is not set
817# CONFIG_RCU_CPU_STALL_DETECTOR is not set
818# CONFIG_BACKTRACE_SELF_TEST is not set
819# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
820# CONFIG_FAULT_INJECTION is not set
821# CONFIG_LATENCYTOP is not set
822CONFIG_NOP_TRACER=y
823CONFIG_HAVE_FTRACE=y
824# CONFIG_FTRACE is not set
825# CONFIG_IRQSOFF_TRACER is not set
826# CONFIG_SCHED_TRACER is not set
827# CONFIG_CONTEXT_SWITCH_TRACER is not set
828# CONFIG_BOOT_TRACER is not set
829# CONFIG_STACK_TRACER is not set
830# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
831# CONFIG_SAMPLES is not set
832# CONFIG_SH_STANDARD_BIOS is not set
833CONFIG_EARLY_SCIF_CONSOLE=y
834CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe80000
835CONFIG_EARLY_PRINTK=y
836# CONFIG_DEBUG_BOOTMEM is not set
837# CONFIG_DEBUG_STACKOVERFLOW is not set
838# CONFIG_DEBUG_STACK_USAGE is not set
839# CONFIG_4KSTACKS is not set
840# CONFIG_IRQSTACKS is not set
841# CONFIG_SH_KGDB is not set
842
843#
844# Security options
845#
846# CONFIG_KEYS is not set
847# CONFIG_SECURITY is not set
848# CONFIG_SECURITYFS is not set
849# CONFIG_SECURITY_FILE_CAPABILITIES is not set
850CONFIG_CRYPTO=y
851
852#
853# Crypto core or helper
854#
855# CONFIG_CRYPTO_FIPS is not set
856# CONFIG_CRYPTO_MANAGER is not set
857# CONFIG_CRYPTO_GF128MUL is not set
858# CONFIG_CRYPTO_NULL is not set
859# CONFIG_CRYPTO_CRYPTD is not set
860# CONFIG_CRYPTO_AUTHENC is not set
861# CONFIG_CRYPTO_TEST is not set
862
863#
864# Authenticated Encryption with Associated Data
865#
866# CONFIG_CRYPTO_CCM is not set
867# CONFIG_CRYPTO_GCM is not set
868# CONFIG_CRYPTO_SEQIV is not set
869
870#
871# Block modes
872#
873# CONFIG_CRYPTO_CBC is not set
874# CONFIG_CRYPTO_CTR is not set
875# CONFIG_CRYPTO_CTS is not set
876# CONFIG_CRYPTO_ECB is not set
877# CONFIG_CRYPTO_LRW is not set
878# CONFIG_CRYPTO_PCBC is not set
879# CONFIG_CRYPTO_XTS is not set
880
881#
882# Hash modes
883#
884# CONFIG_CRYPTO_HMAC is not set
885# CONFIG_CRYPTO_XCBC is not set
886
887#
888# Digest
889#
890# CONFIG_CRYPTO_CRC32C is not set
891# CONFIG_CRYPTO_MD4 is not set
892# CONFIG_CRYPTO_MD5 is not set
893# CONFIG_CRYPTO_MICHAEL_MIC is not set
894# CONFIG_CRYPTO_RMD128 is not set
895# CONFIG_CRYPTO_RMD160 is not set
896# CONFIG_CRYPTO_RMD256 is not set
897# CONFIG_CRYPTO_RMD320 is not set
898# CONFIG_CRYPTO_SHA1 is not set
899# CONFIG_CRYPTO_SHA256 is not set
900# CONFIG_CRYPTO_SHA512 is not set
901# CONFIG_CRYPTO_TGR192 is not set
902# CONFIG_CRYPTO_WP512 is not set
903
904#
905# Ciphers
906#
907# CONFIG_CRYPTO_AES is not set
908# CONFIG_CRYPTO_ANUBIS is not set
909# CONFIG_CRYPTO_ARC4 is not set
910# CONFIG_CRYPTO_BLOWFISH is not set
911# CONFIG_CRYPTO_CAMELLIA is not set
912# CONFIG_CRYPTO_CAST5 is not set
913# CONFIG_CRYPTO_CAST6 is not set
914# CONFIG_CRYPTO_DES is not set
915# CONFIG_CRYPTO_FCRYPT is not set
916# CONFIG_CRYPTO_KHAZAD is not set
917# CONFIG_CRYPTO_SALSA20 is not set
918# CONFIG_CRYPTO_SEED is not set
919# CONFIG_CRYPTO_SERPENT is not set
920# CONFIG_CRYPTO_TEA is not set
921# CONFIG_CRYPTO_TWOFISH is not set
922
923#
924# Compression
925#
926# CONFIG_CRYPTO_DEFLATE is not set
927# CONFIG_CRYPTO_LZO is not set
928
929#
930# Random Number Generation
931#
932# CONFIG_CRYPTO_ANSI_CPRNG is not set
933CONFIG_CRYPTO_HW=y
934
935#
936# Library routines
937#
938CONFIG_BITREVERSE=y
939# CONFIG_CRC_CCITT is not set
940# CONFIG_CRC16 is not set
941CONFIG_CRC_T10DIF=y
942# CONFIG_CRC_ITU_T is not set
943CONFIG_CRC32=y
944# CONFIG_CRC7 is not set
945# CONFIG_LIBCRC32C is not set
946CONFIG_PLIST=y
947CONFIG_HAS_IOMEM=y
948CONFIG_HAS_IOPORT=y
949CONFIG_HAS_DMA=y
diff --git a/arch/sh/configs/se7343_defconfig b/arch/sh/configs/se7343_defconfig
index 075f42ed5b09..be246f381507 100644
--- a/arch/sh/configs/se7343_defconfig
+++ b/arch/sh/configs/se7343_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.27 3# Linux kernel version: 2.6.28-rc6
4# Wed Oct 22 19:00:21 2008 4# Thu Dec 4 16:40:25 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -74,7 +74,6 @@ CONFIG_EVENTFD=y
74# CONFIG_SHMEM is not set 74# CONFIG_SHMEM is not set
75CONFIG_AIO=y 75CONFIG_AIO=y
76CONFIG_VM_EVENT_COUNTERS=y 76CONFIG_VM_EVENT_COUNTERS=y
77CONFIG_PCI_QUIRKS=y
78CONFIG_SLAB=y 77CONFIG_SLAB=y
79# CONFIG_SLUB is not set 78# CONFIG_SLUB is not set
80# CONFIG_SLOB is not set 79# CONFIG_SLOB is not set
@@ -127,6 +126,7 @@ CONFIG_CPU_SH4=y
127CONFIG_CPU_SH4A=y 126CONFIG_CPU_SH4A=y
128CONFIG_CPU_SH4AL_DSP=y 127CONFIG_CPU_SH4AL_DSP=y
129# CONFIG_CPU_SUBTYPE_SH7619 is not set 128# CONFIG_CPU_SUBTYPE_SH7619 is not set
129# CONFIG_CPU_SUBTYPE_SH7201 is not set
130# CONFIG_CPU_SUBTYPE_SH7203 is not set 130# CONFIG_CPU_SUBTYPE_SH7203 is not set
131# CONFIG_CPU_SUBTYPE_SH7206 is not set 131# CONFIG_CPU_SUBTYPE_SH7206 is not set
132# CONFIG_CPU_SUBTYPE_SH7263 is not set 132# CONFIG_CPU_SUBTYPE_SH7263 is not set
@@ -227,7 +227,7 @@ CONFIG_SH_7343_SOLUTION_ENGINE=y
227# 227#
228CONFIG_SH_TMU=y 228CONFIG_SH_TMU=y
229CONFIG_SH_TIMER_IRQ=16 229CONFIG_SH_TIMER_IRQ=16
230CONFIG_SH_PCLK_FREQ=27000000 230CONFIG_SH_PCLK_FREQ=33333333
231# CONFIG_NO_HZ is not set 231# CONFIG_NO_HZ is not set
232# CONFIG_HIGH_RES_TIMERS is not set 232# CONFIG_HIGH_RES_TIMERS is not set
233CONFIG_GENERIC_CLOCKEVENTS_BUILD=y 233CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
@@ -274,7 +274,8 @@ CONFIG_GUSA=y
274# 274#
275CONFIG_ZERO_PAGE_OFFSET=0x00001000 275CONFIG_ZERO_PAGE_OFFSET=0x00001000
276CONFIG_BOOT_LINK_OFFSET=0x00800000 276CONFIG_BOOT_LINK_OFFSET=0x00800000
277# CONFIG_CMDLINE_BOOL is not set 277CONFIG_CMDLINE_BOOL=y
278CONFIG_CMDLINE="console=ttySC0,115200"
278 279
279# 280#
280# Bus options 281# Bus options
@@ -463,6 +464,7 @@ CONFIG_BLK_DEV=y
463# CONFIG_BLK_DEV_COW_COMMON is not set 464# CONFIG_BLK_DEV_COW_COMMON is not set
464# CONFIG_BLK_DEV_LOOP is not set 465# CONFIG_BLK_DEV_LOOP is not set
465# CONFIG_BLK_DEV_NBD is not set 466# CONFIG_BLK_DEV_NBD is not set
467# CONFIG_BLK_DEV_UB is not set
466# CONFIG_BLK_DEV_RAM is not set 468# CONFIG_BLK_DEV_RAM is not set
467# CONFIG_CDROM_PKTCDVD is not set 469# CONFIG_CDROM_PKTCDVD is not set
468# CONFIG_ATA_OVER_ETH is not set 470# CONFIG_ATA_OVER_ETH is not set
@@ -519,23 +521,10 @@ CONFIG_NETDEVICES=y
519# CONFIG_EQUALIZER is not set 521# CONFIG_EQUALIZER is not set
520# CONFIG_TUN is not set 522# CONFIG_TUN is not set
521# CONFIG_VETH is not set 523# CONFIG_VETH is not set
522# CONFIG_PHYLIB is not set 524# CONFIG_NET_ETHERNET is not set
523CONFIG_NET_ETHERNET=y
524CONFIG_MII=y 525CONFIG_MII=y
525# CONFIG_AX88796 is not set 526# CONFIG_NETDEV_1000 is not set
526# CONFIG_STNIC is not set 527# CONFIG_NETDEV_10000 is not set
527CONFIG_SMC91X=y
528# CONFIG_SMC911X is not set
529# CONFIG_IBM_NEW_EMAC_ZMII is not set
530# CONFIG_IBM_NEW_EMAC_RGMII is not set
531# CONFIG_IBM_NEW_EMAC_TAH is not set
532# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
533# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
534# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
535# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
536# CONFIG_B44 is not set
537CONFIG_NETDEV_1000=y
538CONFIG_NETDEV_10000=y
539 528
540# 529#
541# Wireless LAN 530# Wireless LAN
@@ -543,6 +532,26 @@ CONFIG_NETDEV_10000=y
543# CONFIG_WLAN_PRE80211 is not set 532# CONFIG_WLAN_PRE80211 is not set
544# CONFIG_WLAN_80211 is not set 533# CONFIG_WLAN_80211 is not set
545# CONFIG_IWLWIFI_LEDS is not set 534# CONFIG_IWLWIFI_LEDS is not set
535
536#
537# USB Network Adapters
538#
539# CONFIG_USB_CATC is not set
540# CONFIG_USB_KAWETH is not set
541# CONFIG_USB_PEGASUS is not set
542# CONFIG_USB_RTL8150 is not set
543CONFIG_USB_USBNET=y
544# CONFIG_USB_NET_AX8817X is not set
545CONFIG_USB_NET_CDCETHER=y
546CONFIG_USB_NET_DM9601=y
547# CONFIG_USB_NET_SMSC95XX is not set
548# CONFIG_USB_NET_GL620A is not set
549# CONFIG_USB_NET_NET1080 is not set
550# CONFIG_USB_NET_PLUSB is not set
551# CONFIG_USB_NET_MCS7830 is not set
552# CONFIG_USB_NET_RNDIS_HOST is not set
553# CONFIG_USB_NET_CDC_SUBSET is not set
554# CONFIG_USB_NET_ZAURUS is not set
546# CONFIG_WAN is not set 555# CONFIG_WAN is not set
547# CONFIG_PPP is not set 556# CONFIG_PPP is not set
548# CONFIG_SLIP is not set 557# CONFIG_SLIP is not set
@@ -597,13 +606,17 @@ CONFIG_DEVKMEM=y
597# 606#
598# Serial drivers 607# Serial drivers
599# 608#
600# CONFIG_SERIAL_8250 is not set 609CONFIG_SERIAL_8250=y
610# CONFIG_SERIAL_8250_CONSOLE is not set
611CONFIG_SERIAL_8250_NR_UARTS=2
612CONFIG_SERIAL_8250_RUNTIME_UARTS=2
613# CONFIG_SERIAL_8250_EXTENDED is not set
601 614
602# 615#
603# Non-8250 serial port support 616# Non-8250 serial port support
604# 617#
605CONFIG_SERIAL_SH_SCI=y 618CONFIG_SERIAL_SH_SCI=y
606CONFIG_SERIAL_SH_SCI_NR_UARTS=2 619CONFIG_SERIAL_SH_SCI_NR_UARTS=4
607CONFIG_SERIAL_SH_SCI_CONSOLE=y 620CONFIG_SERIAL_SH_SCI_CONSOLE=y
608CONFIG_SERIAL_CORE=y 621CONFIG_SERIAL_CORE=y
609CONFIG_SERIAL_CORE_CONSOLE=y 622CONFIG_SERIAL_CORE_CONSOLE=y
@@ -615,7 +628,51 @@ CONFIG_HW_RANDOM=y
615# CONFIG_R3964 is not set 628# CONFIG_R3964 is not set
616# CONFIG_RAW_DRIVER is not set 629# CONFIG_RAW_DRIVER is not set
617# CONFIG_TCG_TPM is not set 630# CONFIG_TCG_TPM is not set
618# CONFIG_I2C is not set 631CONFIG_I2C=y
632CONFIG_I2C_BOARDINFO=y
633# CONFIG_I2C_CHARDEV is not set
634CONFIG_I2C_HELPER_AUTO=y
635
636#
637# I2C Hardware Bus support
638#
639
640#
641# I2C system bus drivers (mostly embedded / system-on-chip)
642#
643# CONFIG_I2C_OCORES is not set
644CONFIG_I2C_SH_MOBILE=y
645# CONFIG_I2C_SIMTEC is not set
646
647#
648# External I2C/SMBus adapter drivers
649#
650# CONFIG_I2C_PARPORT_LIGHT is not set
651# CONFIG_I2C_TAOS_EVM is not set
652# CONFIG_I2C_TINY_USB is not set
653
654#
655# Other I2C/SMBus bus drivers
656#
657# CONFIG_I2C_PCA_PLATFORM is not set
658# CONFIG_I2C_STUB is not set
659
660#
661# Miscellaneous I2C Chip support
662#
663# CONFIG_DS1682 is not set
664# CONFIG_AT24 is not set
665# CONFIG_SENSORS_EEPROM is not set
666# CONFIG_SENSORS_PCF8574 is not set
667# CONFIG_PCF8575 is not set
668# CONFIG_SENSORS_PCA9539 is not set
669# CONFIG_SENSORS_PCF8591 is not set
670# CONFIG_SENSORS_MAX6875 is not set
671# CONFIG_SENSORS_TSL2550 is not set
672# CONFIG_I2C_DEBUG_CORE is not set
673# CONFIG_I2C_DEBUG_ALGO is not set
674# CONFIG_I2C_DEBUG_BUS is not set
675# CONFIG_I2C_DEBUG_CHIP is not set
619# CONFIG_SPI is not set 676# CONFIG_SPI is not set
620# CONFIG_W1 is not set 677# CONFIG_W1 is not set
621# CONFIG_POWER_SUPPLY is not set 678# CONFIG_POWER_SUPPLY is not set
@@ -623,11 +680,11 @@ CONFIG_HW_RANDOM=y
623# CONFIG_THERMAL is not set 680# CONFIG_THERMAL is not set
624# CONFIG_THERMAL_HWMON is not set 681# CONFIG_THERMAL_HWMON is not set
625# CONFIG_WATCHDOG is not set 682# CONFIG_WATCHDOG is not set
683CONFIG_SSB_POSSIBLE=y
626 684
627# 685#
628# Sonics Silicon Backplane 686# Sonics Silicon Backplane
629# 687#
630CONFIG_SSB_POSSIBLE=y
631# CONFIG_SSB is not set 688# CONFIG_SSB is not set
632 689
633# 690#
@@ -637,7 +694,10 @@ CONFIG_SSB_POSSIBLE=y
637# CONFIG_MFD_SM501 is not set 694# CONFIG_MFD_SM501 is not set
638# CONFIG_HTC_PASIC3 is not set 695# CONFIG_HTC_PASIC3 is not set
639# CONFIG_MFD_TMIO is not set 696# CONFIG_MFD_TMIO is not set
697# CONFIG_PMIC_DA903X is not set
640# CONFIG_MFD_WM8400 is not set 698# CONFIG_MFD_WM8400 is not set
699# CONFIG_MFD_WM8350_I2C is not set
700# CONFIG_REGULATOR is not set
641 701
642# 702#
643# Multimedia devices 703# Multimedia devices
@@ -657,6 +717,16 @@ CONFIG_VIDEO_MEDIA=y
657# Multimedia drivers 717# Multimedia drivers
658# 718#
659# CONFIG_MEDIA_ATTACH is not set 719# CONFIG_MEDIA_ATTACH is not set
720CONFIG_MEDIA_TUNER=y
721# CONFIG_MEDIA_TUNER_CUSTOMIZE is not set
722CONFIG_MEDIA_TUNER_SIMPLE=y
723CONFIG_MEDIA_TUNER_TDA8290=y
724CONFIG_MEDIA_TUNER_TDA9887=y
725CONFIG_MEDIA_TUNER_TEA5761=y
726CONFIG_MEDIA_TUNER_TEA5767=y
727CONFIG_MEDIA_TUNER_MT20XX=y
728CONFIG_MEDIA_TUNER_XC2028=y
729CONFIG_MEDIA_TUNER_XC5000=y
660CONFIG_VIDEO_V4L2=y 730CONFIG_VIDEO_V4L2=y
661CONFIG_VIDEO_V4L1=y 731CONFIG_VIDEO_V4L1=y
662CONFIG_VIDEO_CAPTURE_DRIVERS=y 732CONFIG_VIDEO_CAPTURE_DRIVERS=y
@@ -665,8 +735,57 @@ CONFIG_VIDEO_CAPTURE_DRIVERS=y
665CONFIG_VIDEO_HELPER_CHIPS_AUTO=y 735CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
666# CONFIG_VIDEO_VIVI is not set 736# CONFIG_VIDEO_VIVI is not set
667# CONFIG_VIDEO_CPIA is not set 737# CONFIG_VIDEO_CPIA is not set
738# CONFIG_VIDEO_CPIA2 is not set
739# CONFIG_VIDEO_SAA5246A is not set
740# CONFIG_VIDEO_SAA5249 is not set
668# CONFIG_SOC_CAMERA is not set 741# CONFIG_SOC_CAMERA is not set
742CONFIG_V4L_USB_DRIVERS=y
743# CONFIG_USB_VIDEO_CLASS is not set
744CONFIG_USB_GSPCA=m
745# CONFIG_USB_M5602 is not set
746# CONFIG_USB_GSPCA_CONEX is not set
747# CONFIG_USB_GSPCA_ETOMS is not set
748# CONFIG_USB_GSPCA_FINEPIX is not set
749# CONFIG_USB_GSPCA_MARS is not set
750# CONFIG_USB_GSPCA_OV519 is not set
751# CONFIG_USB_GSPCA_PAC207 is not set
752# CONFIG_USB_GSPCA_PAC7311 is not set
753# CONFIG_USB_GSPCA_SONIXB is not set
754# CONFIG_USB_GSPCA_SONIXJ is not set
755# CONFIG_USB_GSPCA_SPCA500 is not set
756# CONFIG_USB_GSPCA_SPCA501 is not set
757# CONFIG_USB_GSPCA_SPCA505 is not set
758# CONFIG_USB_GSPCA_SPCA506 is not set
759# CONFIG_USB_GSPCA_SPCA508 is not set
760# CONFIG_USB_GSPCA_SPCA561 is not set
761# CONFIG_USB_GSPCA_STK014 is not set
762# CONFIG_USB_GSPCA_SUNPLUS is not set
763# CONFIG_USB_GSPCA_T613 is not set
764# CONFIG_USB_GSPCA_TV8532 is not set
765# CONFIG_USB_GSPCA_VC032X is not set
766# CONFIG_USB_GSPCA_ZC3XX is not set
767# CONFIG_VIDEO_PVRUSB2 is not set
768# CONFIG_VIDEO_EM28XX is not set
769# CONFIG_VIDEO_USBVISION is not set
770# CONFIG_USB_VICAM is not set
771# CONFIG_USB_IBMCAM is not set
772# CONFIG_USB_KONICAWC is not set
773# CONFIG_USB_QUICKCAM_MESSENGER is not set
774# CONFIG_USB_ET61X251 is not set
775# CONFIG_VIDEO_OVCAMCHIP is not set
776# CONFIG_USB_OV511 is not set
777# CONFIG_USB_SE401 is not set
778# CONFIG_USB_SN9C102 is not set
779# CONFIG_USB_STV680 is not set
780# CONFIG_USB_ZC0301 is not set
781# CONFIG_USB_PWC is not set
782# CONFIG_USB_ZR364XX is not set
783# CONFIG_USB_STKWEBCAM is not set
784# CONFIG_USB_S2255 is not set
669CONFIG_RADIO_ADAPTERS=y 785CONFIG_RADIO_ADAPTERS=y
786# CONFIG_USB_DSBR is not set
787# CONFIG_USB_SI470X is not set
788# CONFIG_USB_MR800 is not set
670# CONFIG_DAB is not set 789# CONFIG_DAB is not set
671 790
672# 791#
@@ -700,6 +819,7 @@ CONFIG_FB_CFB_IMAGEBLIT=m
700CONFIG_FB_SH_MOBILE_LCDC=m 819CONFIG_FB_SH_MOBILE_LCDC=m
701# CONFIG_FB_VIRTUAL is not set 820# CONFIG_FB_VIRTUAL is not set
702# CONFIG_FB_METRONOME is not set 821# CONFIG_FB_METRONOME is not set
822# CONFIG_FB_MB862XX is not set
703# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 823# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
704 824
705# 825#
@@ -737,27 +857,147 @@ CONFIG_SND_DRIVERS=y
737# CONFIG_SND_SERIAL_U16550 is not set 857# CONFIG_SND_SERIAL_U16550 is not set
738# CONFIG_SND_MPU401 is not set 858# CONFIG_SND_MPU401 is not set
739CONFIG_SND_SUPERH=y 859CONFIG_SND_SUPERH=y
860CONFIG_SND_USB=y
861# CONFIG_SND_USB_AUDIO is not set
862# CONFIG_SND_USB_CAIAQ is not set
740# CONFIG_SND_SOC is not set 863# CONFIG_SND_SOC is not set
741# CONFIG_SOUND_PRIME is not set 864# CONFIG_SOUND_PRIME is not set
742CONFIG_HID_SUPPORT=y 865CONFIG_HID_SUPPORT=y
743CONFIG_HID=y 866CONFIG_HID=y
744# CONFIG_HID_DEBUG is not set 867# CONFIG_HID_DEBUG is not set
745# CONFIG_HIDRAW is not set 868# CONFIG_HIDRAW is not set
869
870#
871# USB Input Devices
872#
873CONFIG_USB_HID=y
746# CONFIG_HID_PID is not set 874# CONFIG_HID_PID is not set
875# CONFIG_USB_HIDDEV is not set
747 876
748# 877#
749# Special HID drivers 878# Special HID drivers
750# 879#
751CONFIG_HID_COMPAT=y 880CONFIG_HID_COMPAT=y
752# CONFIG_USB_SUPPORT is not set 881CONFIG_HID_A4TECH=y
882CONFIG_HID_APPLE=y
883CONFIG_HID_BELKIN=y
884CONFIG_HID_BRIGHT=y
885CONFIG_HID_CHERRY=y
886CONFIG_HID_CHICONY=y
887CONFIG_HID_CYPRESS=y
888CONFIG_HID_DELL=y
889CONFIG_HID_EZKEY=y
890CONFIG_HID_GYRATION=y
891CONFIG_HID_LOGITECH=y
892# CONFIG_LOGITECH_FF is not set
893# CONFIG_LOGIRUMBLEPAD2_FF is not set
894CONFIG_HID_MICROSOFT=y
895CONFIG_HID_MONTEREY=y
896CONFIG_HID_PANTHERLORD=y
897# CONFIG_PANTHERLORD_FF is not set
898CONFIG_HID_PETALYNX=y
899CONFIG_HID_SAMSUNG=y
900CONFIG_HID_SONY=y
901CONFIG_HID_SUNPLUS=y
902# CONFIG_THRUSTMASTER_FF is not set
903# CONFIG_ZEROPLUS_FF is not set
904CONFIG_USB_SUPPORT=y
905CONFIG_USB_ARCH_HAS_HCD=y
906# CONFIG_USB_ARCH_HAS_OHCI is not set
907# CONFIG_USB_ARCH_HAS_EHCI is not set
908CONFIG_USB=y
909CONFIG_USB_DEBUG=y
910CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
911
912#
913# Miscellaneous USB options
914#
915CONFIG_USB_DEVICEFS=y
916CONFIG_USB_DEVICE_CLASS=y
917# CONFIG_USB_DYNAMIC_MINORS is not set
918# CONFIG_USB_OTG is not set
919# CONFIG_USB_OTG_WHITELIST is not set
920# CONFIG_USB_OTG_BLACKLIST_HUB is not set
921# CONFIG_USB_MON is not set
922# CONFIG_USB_WUSB is not set
923# CONFIG_USB_WUSB_CBAF is not set
924
925#
926# USB Host Controller Drivers
927#
928# CONFIG_USB_C67X00_HCD is not set
929CONFIG_USB_ISP116X_HCD=y
930# CONFIG_USB_SL811_HCD is not set
931# CONFIG_USB_R8A66597_HCD is not set
932# CONFIG_USB_HWA_HCD is not set
933
934#
935# USB Device Class drivers
936#
937# CONFIG_USB_ACM is not set
938# CONFIG_USB_PRINTER is not set
939# CONFIG_USB_WDM is not set
940# CONFIG_USB_TMC is not set
941
942#
943# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
944#
945
946#
947# see USB_STORAGE Help for more information
948#
949# CONFIG_USB_STORAGE is not set
950# CONFIG_USB_LIBUSUAL is not set
951
952#
953# USB Imaging devices
954#
955# CONFIG_USB_MDC800 is not set
956# CONFIG_USB_MICROTEK is not set
957
958#
959# USB port drivers
960#
961# CONFIG_USB_SERIAL is not set
962
963#
964# USB Miscellaneous drivers
965#
966# CONFIG_USB_EMI62 is not set
967# CONFIG_USB_EMI26 is not set
968# CONFIG_USB_ADUTUX is not set
969# CONFIG_USB_SEVSEG is not set
970# CONFIG_USB_RIO500 is not set
971# CONFIG_USB_LEGOTOWER is not set
972# CONFIG_USB_LCD is not set
973# CONFIG_USB_BERRY_CHARGE is not set
974# CONFIG_USB_LED is not set
975# CONFIG_USB_CYPRESS_CY7C63 is not set
976# CONFIG_USB_CYTHERM is not set
977# CONFIG_USB_PHIDGET is not set
978# CONFIG_USB_IDMOUSE is not set
979# CONFIG_USB_FTDI_ELAN is not set
980# CONFIG_USB_APPLEDISPLAY is not set
981# CONFIG_USB_LD is not set
982# CONFIG_USB_TRANCEVIBRATOR is not set
983# CONFIG_USB_IOWARRIOR is not set
984# CONFIG_USB_TEST is not set
985# CONFIG_USB_ISIGHTFW is not set
986# CONFIG_USB_VST is not set
987# CONFIG_USB_GADGET is not set
753# CONFIG_MMC is not set 988# CONFIG_MMC is not set
754# CONFIG_MEMSTICK is not set 989# CONFIG_MEMSTICK is not set
755# CONFIG_NEW_LEDS is not set 990# CONFIG_NEW_LEDS is not set
756# CONFIG_ACCESSIBILITY is not set 991# CONFIG_ACCESSIBILITY is not set
757# CONFIG_RTC_CLASS is not set 992# CONFIG_RTC_CLASS is not set
758# CONFIG_DMADEVICES is not set 993# CONFIG_DMADEVICES is not set
759# CONFIG_UIO is not set 994CONFIG_UIO=y
995# CONFIG_UIO_PDRV is not set
996# CONFIG_UIO_PDRV_GENIRQ is not set
997# CONFIG_UIO_SMX is not set
998# CONFIG_UIO_SERCOS3 is not set
760# CONFIG_STAGING is not set 999# CONFIG_STAGING is not set
1000CONFIG_STAGING_EXCLUDE_BUILD=y
761 1001
762# 1002#
763# File systems 1003# File systems
@@ -889,8 +1129,13 @@ CONFIG_FRAME_WARN=1024
889# CONFIG_DEBUG_MEMORY_INIT is not set 1129# CONFIG_DEBUG_MEMORY_INIT is not set
890# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1130# CONFIG_RCU_CPU_STALL_DETECTOR is not set
891# CONFIG_LATENCYTOP is not set 1131# CONFIG_LATENCYTOP is not set
892CONFIG_NOP_TRACER=y 1132CONFIG_HAVE_FUNCTION_TRACER=y
893CONFIG_HAVE_FTRACE=y 1133CONFIG_HAVE_DYNAMIC_FTRACE=y
1134CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
1135
1136#
1137# Tracers
1138#
894# CONFIG_DYNAMIC_PRINTK_DEBUG is not set 1139# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
895# CONFIG_SAMPLES is not set 1140# CONFIG_SAMPLES is not set
896# CONFIG_SH_STANDARD_BIOS is not set 1141# CONFIG_SH_STANDARD_BIOS is not set
diff --git a/arch/sh/drivers/dma/Makefile b/arch/sh/drivers/dma/Makefile
index 1ac812d24488..ab956adacb47 100644
--- a/arch/sh/drivers/dma/Makefile
+++ b/arch/sh/drivers/dma/Makefile
@@ -3,7 +3,6 @@
3# 3#
4 4
5obj-$(CONFIG_SH_DMA_API) += dma-api.o dma-sysfs.o 5obj-$(CONFIG_SH_DMA_API) += dma-api.o dma-sysfs.o
6obj-$(CONFIG_ISA_DMA_API) += dma-isa.o
7obj-$(CONFIG_SH_DMA) += dma-sh.o 6obj-$(CONFIG_SH_DMA) += dma-sh.o
8obj-$(CONFIG_SH_DREAMCAST) += dma-pvr2.o dma-g2.o 7obj-$(CONFIG_SH_DREAMCAST) += dma-pvr2.o dma-g2.o
9obj-$(CONFIG_SH_DMABRG) += dmabrg.o 8obj-$(CONFIG_SH_DMABRG) += dmabrg.o
diff --git a/arch/sh/drivers/dma/dma-isa.c b/arch/sh/drivers/dma/dma-isa.c
deleted file mode 100644
index 5fb044b791c3..000000000000
--- a/arch/sh/drivers/dma/dma-isa.c
+++ /dev/null
@@ -1,106 +0,0 @@
1/*
2 * arch/sh/drivers/dma/dma-isa.c
3 *
4 * Generic ISA DMA wrapper for SH DMA API
5 *
6 * Copyright (C) 2003, 2004 Paul Mundt
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/kernel.h>
13#include <linux/module.h>
14#include <asm/dma.h>
15
16/*
17 * This implements a small wrapper set to make code using the old ISA DMA API
18 * work with the SH DMA API. Since most of the work in the new API happens
19 * at ops->xfer() time, we simply use the various set_dma_xxx() routines to
20 * fill in per-channel info, and then hand hand this off to ops->xfer() at
21 * enable_dma() time.
22 *
23 * For channels that are doing on-demand data transfer via cascading, the
24 * channel itself will still need to be configured through the new API. As
25 * such, this code is meant for only the simplest of tasks (and shouldn't be
26 * used in any new drivers at all).
27 *
28 * NOTE: ops->xfer() is the preferred way of doing things. However, there
29 * are some users of the ISA DMA API that exist in common code that we
30 * don't necessarily want to go out of our way to break, so we still
31 * allow for some compatibility at that level. Any new code is strongly
32 * advised to run far away from the ISA DMA API and use the SH DMA API
33 * directly.
34 */
35unsigned long claim_dma_lock(void)
36{
37 unsigned long flags;
38
39 spin_lock_irqsave(&dma_spin_lock, flags);
40
41 return flags;
42}
43EXPORT_SYMBOL(claim_dma_lock);
44
45void release_dma_lock(unsigned long flags)
46{
47 spin_unlock_irqrestore(&dma_spin_lock, flags);
48}
49EXPORT_SYMBOL(release_dma_lock);
50
51void disable_dma(unsigned int chan)
52{
53 /* Nothing */
54}
55EXPORT_SYMBOL(disable_dma);
56
57void enable_dma(unsigned int chan)
58{
59 struct dma_info *info = get_dma_info(chan);
60 struct dma_channel *channel = &info->channels[chan];
61
62 info->ops->xfer(channel);
63}
64EXPORT_SYMBOL(enable_dma);
65
66void clear_dma_ff(unsigned int chan)
67{
68 /* Nothing */
69}
70EXPORT_SYMBOL(clear_dma_ff);
71
72void set_dma_mode(unsigned int chan, char mode)
73{
74 struct dma_info *info = get_dma_info(chan);
75 struct dma_channel *channel = &info->channels[chan];
76
77 channel->mode = mode;
78}
79EXPORT_SYMBOL(set_dma_mode);
80
81void set_dma_addr(unsigned int chan, unsigned int addr)
82{
83 struct dma_info *info = get_dma_info(chan);
84 struct dma_channel *channel = &info->channels[chan];
85
86 /*
87 * Single address mode is the only thing supported through
88 * this interface.
89 */
90 if ((channel->mode & DMA_MODE_MASK) == DMA_MODE_READ) {
91 channel->sar = addr;
92 } else {
93 channel->dar = addr;
94 }
95}
96EXPORT_SYMBOL(set_dma_addr);
97
98void set_dma_count(unsigned int chan, unsigned int count)
99{
100 struct dma_info *info = get_dma_info(chan);
101 struct dma_channel *channel = &info->channels[chan];
102
103 channel->count = count;
104}
105EXPORT_SYMBOL(set_dma_count);
106
diff --git a/arch/sh/drivers/dma/dma-sh.c b/arch/sh/drivers/dma/dma-sh.c
index b2ffe649c7c0..50887a592dd0 100644
--- a/arch/sh/drivers/dma/dma-sh.c
+++ b/arch/sh/drivers/dma/dma-sh.c
@@ -205,7 +205,8 @@ static int sh_dmac_get_dma_residue(struct dma_channel *chan)
205 205
206#if defined(CONFIG_CPU_SUBTYPE_SH7720) || \ 206#if defined(CONFIG_CPU_SUBTYPE_SH7720) || \
207 defined(CONFIG_CPU_SUBTYPE_SH7721) || \ 207 defined(CONFIG_CPU_SUBTYPE_SH7721) || \
208 defined(CONFIG_CPU_SUBTYPE_SH7780) 208 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
209 defined(CONFIG_CPU_SUBTYPE_SH7709)
209#define dmaor_read_reg() ctrl_inw(DMAOR) 210#define dmaor_read_reg() ctrl_inw(DMAOR)
210#define dmaor_write_reg(data) ctrl_outw(data, DMAOR) 211#define dmaor_write_reg(data) ctrl_outw(data, DMAOR)
211#else 212#else
diff --git a/arch/sh/drivers/dma/dma-sh.h b/arch/sh/drivers/dma/dma-sh.h
index b05af34fc15d..05fecd5428e4 100644
--- a/arch/sh/drivers/dma/dma-sh.h
+++ b/arch/sh/drivers/dma/dma-sh.h
@@ -29,6 +29,7 @@
29#define RS_IN 0x00000200 29#define RS_IN 0x00000200
30#define RS_OUT 0x00000300 30#define RS_OUT 0x00000300
31#define TS_BLK 0x00000040 31#define TS_BLK 0x00000040
32#define TM_BUR 0x00000020
32#define CHCR_DE 0x00000001 33#define CHCR_DE 0x00000001
33#define CHCR_TE 0x00000002 34#define CHCR_TE 0x00000002
34#define CHCR_IE 0x00000004 35#define CHCR_IE 0x00000004
diff --git a/arch/sh/drivers/pci/ops-sh03.c b/arch/sh/drivers/pci/ops-sh03.c
index ebb58e605d9d..e1703ff5a4d2 100644
--- a/arch/sh/drivers/pci/ops-sh03.c
+++ b/arch/sh/drivers/pci/ops-sh03.c
@@ -18,7 +18,8 @@
18 */ 18 */
19int __init pcibios_init_platform(void) 19int __init pcibios_init_platform(void)
20{ 20{
21 return 1; 21 __set_io_port_base(SH7751_PCI_IO_BASE);
22 return 1;
22} 23}
23 24
24static struct resource sh7751_io_resource = { 25static struct resource sh7751_io_resource = {
diff --git a/arch/sh/drivers/pci/pci-sh7780.c b/arch/sh/drivers/pci/pci-sh7780.c
index b2a2bfa3c1bd..078dc44d6b08 100644
--- a/arch/sh/drivers/pci/pci-sh7780.c
+++ b/arch/sh/drivers/pci/pci-sh7780.c
@@ -123,16 +123,14 @@ int __init sh7780_pcic_init(struct sh4_pci_address_map *map)
123 * Window0 = map->window0.size @ non-cached area base = SDRAM 123 * Window0 = map->window0.size @ non-cached area base = SDRAM
124 * Window1 = map->window1.size @ cached area base = SDRAM 124 * Window1 = map->window1.size @ cached area base = SDRAM
125 */ 125 */
126 word = ((map->window0.size - 1) & 0x1ff00001) | 0x01; 126 word = (CONFIG_MEMORY_SIZE - 0x00100000) | 0x00000001;
127 pci_write_reg(0x07f00001, SH4_PCILSR0); 127 pci_write_reg(word, SH4_PCILSR0);
128 word = ((map->window1.size - 1) & 0x1ff00001) | 0x01;
129 pci_write_reg(0x00000001, SH4_PCILSR1); 128 pci_write_reg(0x00000001, SH4_PCILSR1);
130 /* Set the values on window 0 PCI config registers */ 129 /* Set the values on window 0 PCI config registers */
131 word = P2SEGADDR(map->window0.base); 130 word = (CONFIG_MEMORY_SIZE > 0x08000000) ? 0x10000000 : 0x08000000;
132 pci_write_reg(0xa8000000, SH4_PCILAR0); 131 pci_write_reg(word | 0xa0000000, SH4_PCILAR0);
133 pci_write_reg(0x08000000, SH7780_PCIMBAR0); 132 pci_write_reg(word, SH7780_PCIMBAR0);
134 /* Set the values on window 1 PCI config registers */ 133 /* Set the values on window 1 PCI config registers */
135 word = P2SEGADDR(map->window1.base);
136 pci_write_reg(0x00000000, SH4_PCILAR1); 134 pci_write_reg(0x00000000, SH4_PCILAR1);
137 pci_write_reg(0x00000000, SH7780_PCIMBAR1); 135 pci_write_reg(0x00000000, SH7780_PCIMBAR1);
138 136
diff --git a/arch/sh/include/asm/addrspace.h b/arch/sh/include/asm/addrspace.h
index 2702d81bfc0d..36736c7e93db 100644
--- a/arch/sh/include/asm/addrspace.h
+++ b/arch/sh/include/asm/addrspace.h
@@ -49,5 +49,16 @@
49/* Check if an address can be reached in 29 bits */ 49/* Check if an address can be reached in 29 bits */
50#define IS_29BIT(a) (((unsigned long)(a)) < 0x20000000) 50#define IS_29BIT(a) (((unsigned long)(a)) < 0x20000000)
51 51
52#ifdef CONFIG_SH_STORE_QUEUES
53/*
54 * This is a special case for the SH-4 store queues, as pages for this
55 * space still need to be faulted in before it's possible to flush the
56 * store queue cache for writeout to the remapped region.
57 */
58#define P3_ADDR_MAX (P4SEG_STORE_QUE + 0x04000000)
59#else
60#define P3_ADDR_MAX P4SEG
61#endif
62
52#endif /* __KERNEL__ */ 63#endif /* __KERNEL__ */
53#endif /* __ASM_SH_ADDRSPACE_H */ 64#endif /* __ASM_SH_ADDRSPACE_H */
diff --git a/arch/sh/include/asm/atomic.h b/arch/sh/include/asm/atomic.h
index c043ef003028..6327ffbb1992 100644
--- a/arch/sh/include/asm/atomic.h
+++ b/arch/sh/include/asm/atomic.h
@@ -7,16 +7,15 @@
7 * 7 *
8 */ 8 */
9 9
10typedef struct { volatile int counter; } atomic_t; 10#include <linux/compiler.h>
11#include <linux/types.h>
12#include <asm/system.h>
11 13
12#define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) 14#define ATOMIC_INIT(i) ( (atomic_t) { (i) } )
13 15
14#define atomic_read(v) ((v)->counter) 16#define atomic_read(v) ((v)->counter)
15#define atomic_set(v,i) ((v)->counter = (i)) 17#define atomic_set(v,i) ((v)->counter = (i))
16 18
17#include <linux/compiler.h>
18#include <asm/system.h>
19
20#if defined(CONFIG_GUSA_RB) 19#if defined(CONFIG_GUSA_RB)
21#include <asm/atomic-grb.h> 20#include <asm/atomic-grb.h>
22#elif defined(CONFIG_CPU_SH4A) 21#elif defined(CONFIG_CPU_SH4A)
diff --git a/arch/sh/include/asm/bitops-grb.h b/arch/sh/include/asm/bitops-grb.h
index a5907b94395b..e73af33acbf4 100644
--- a/arch/sh/include/asm/bitops-grb.h
+++ b/arch/sh/include/asm/bitops-grb.h
@@ -166,4 +166,7 @@ static inline int test_and_change_bit(int nr, volatile void * addr)
166 166
167 return retval; 167 return retval;
168} 168}
169
170#include <asm-generic/bitops/non-atomic.h>
171
169#endif /* __ASM_SH_BITOPS_GRB_H */ 172#endif /* __ASM_SH_BITOPS_GRB_H */
diff --git a/arch/sh/include/asm/bitops-irq.h b/arch/sh/include/asm/bitops-irq.h
deleted file mode 100644
index 653a12750584..000000000000
--- a/arch/sh/include/asm/bitops-irq.h
+++ /dev/null
@@ -1,91 +0,0 @@
1#ifndef __ASM_SH_BITOPS_IRQ_H
2#define __ASM_SH_BITOPS_IRQ_H
3
4static inline void set_bit(int nr, volatile void *addr)
5{
6 int mask;
7 volatile unsigned int *a = addr;
8 unsigned long flags;
9
10 a += nr >> 5;
11 mask = 1 << (nr & 0x1f);
12 local_irq_save(flags);
13 *a |= mask;
14 local_irq_restore(flags);
15}
16
17static inline void clear_bit(int nr, volatile void *addr)
18{
19 int mask;
20 volatile unsigned int *a = addr;
21 unsigned long flags;
22
23 a += nr >> 5;
24 mask = 1 << (nr & 0x1f);
25 local_irq_save(flags);
26 *a &= ~mask;
27 local_irq_restore(flags);
28}
29
30static inline void change_bit(int nr, volatile void *addr)
31{
32 int mask;
33 volatile unsigned int *a = addr;
34 unsigned long flags;
35
36 a += nr >> 5;
37 mask = 1 << (nr & 0x1f);
38 local_irq_save(flags);
39 *a ^= mask;
40 local_irq_restore(flags);
41}
42
43static inline int test_and_set_bit(int nr, volatile void *addr)
44{
45 int mask, retval;
46 volatile unsigned int *a = addr;
47 unsigned long flags;
48
49 a += nr >> 5;
50 mask = 1 << (nr & 0x1f);
51 local_irq_save(flags);
52 retval = (mask & *a) != 0;
53 *a |= mask;
54 local_irq_restore(flags);
55
56 return retval;
57}
58
59static inline int test_and_clear_bit(int nr, volatile void *addr)
60{
61 int mask, retval;
62 volatile unsigned int *a = addr;
63 unsigned long flags;
64
65 a += nr >> 5;
66 mask = 1 << (nr & 0x1f);
67 local_irq_save(flags);
68 retval = (mask & *a) != 0;
69 *a &= ~mask;
70 local_irq_restore(flags);
71
72 return retval;
73}
74
75static inline int test_and_change_bit(int nr, volatile void *addr)
76{
77 int mask, retval;
78 volatile unsigned int *a = addr;
79 unsigned long flags;
80
81 a += nr >> 5;
82 mask = 1 << (nr & 0x1f);
83 local_irq_save(flags);
84 retval = (mask & *a) != 0;
85 *a ^= mask;
86 local_irq_restore(flags);
87
88 return retval;
89}
90
91#endif /* __ASM_SH_BITOPS_IRQ_H */
diff --git a/arch/sh/include/asm/bitops-llsc.h b/arch/sh/include/asm/bitops-llsc.h
index 43b8e1a8239e..1d2fc0b010ad 100644
--- a/arch/sh/include/asm/bitops-llsc.h
+++ b/arch/sh/include/asm/bitops-llsc.h
@@ -141,4 +141,6 @@ static inline int test_and_change_bit(int nr, volatile void * addr)
141 return retval != 0; 141 return retval != 0;
142} 142}
143 143
144#include <asm-generic/bitops/non-atomic.h>
145
144#endif /* __ASM_SH_BITOPS_LLSC_H */ 146#endif /* __ASM_SH_BITOPS_LLSC_H */
diff --git a/arch/sh/include/asm/bitops-op32.h b/arch/sh/include/asm/bitops-op32.h
new file mode 100644
index 000000000000..f0ae7e9218e0
--- /dev/null
+++ b/arch/sh/include/asm/bitops-op32.h
@@ -0,0 +1,142 @@
1#ifndef __ASM_SH_BITOPS_OP32_H
2#define __ASM_SH_BITOPS_OP32_H
3
4/*
5 * The bit modifying instructions on SH-2A are only capable of working
6 * with a 3-bit immediate, which signifies the shift position for the bit
7 * being worked on.
8 */
9#if defined(__BIG_ENDIAN)
10#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
11#define BYTE_NUMBER(nr) ((nr ^ BITOP_LE_SWIZZLE) / BITS_PER_BYTE)
12#define BYTE_OFFSET(nr) ((nr ^ BITOP_LE_SWIZZLE) % BITS_PER_BYTE)
13#else
14#define BYTE_NUMBER(nr) ((nr) / BITS_PER_BYTE)
15#define BYTE_OFFSET(nr) ((nr) % BITS_PER_BYTE)
16#endif
17
18#define IS_IMMEDIATE(nr) (__builtin_constant_p(nr))
19
20static inline void __set_bit(int nr, volatile unsigned long *addr)
21{
22 if (IS_IMMEDIATE(nr)) {
23 __asm__ __volatile__ (
24 "bset.b %1, @(%O2,%0) ! __set_bit\n\t"
25 : "+r" (addr)
26 : "i" (BYTE_OFFSET(nr)), "i" (BYTE_NUMBER(nr))
27 : "t", "memory"
28 );
29 } else {
30 unsigned long mask = BIT_MASK(nr);
31 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
32
33 *p |= mask;
34 }
35}
36
37static inline void __clear_bit(int nr, volatile unsigned long *addr)
38{
39 if (IS_IMMEDIATE(nr)) {
40 __asm__ __volatile__ (
41 "bclr.b %1, @(%O2,%0) ! __clear_bit\n\t"
42 : "+r" (addr)
43 : "i" (BYTE_OFFSET(nr)),
44 "i" (BYTE_NUMBER(nr))
45 : "t", "memory"
46 );
47 } else {
48 unsigned long mask = BIT_MASK(nr);
49 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
50
51 *p &= ~mask;
52 }
53}
54
55/**
56 * __change_bit - Toggle a bit in memory
57 * @nr: the bit to change
58 * @addr: the address to start counting from
59 *
60 * Unlike change_bit(), this function is non-atomic and may be reordered.
61 * If it's called on the same region of memory simultaneously, the effect
62 * may be that only one operation succeeds.
63 */
64static inline void __change_bit(int nr, volatile unsigned long *addr)
65{
66 if (IS_IMMEDIATE(nr)) {
67 __asm__ __volatile__ (
68 "bxor.b %1, @(%O2,%0) ! __change_bit\n\t"
69 : "+r" (addr)
70 : "i" (BYTE_OFFSET(nr)),
71 "i" (BYTE_NUMBER(nr))
72 : "t", "memory"
73 );
74 } else {
75 unsigned long mask = BIT_MASK(nr);
76 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
77
78 *p ^= mask;
79 }
80}
81
82/**
83 * __test_and_set_bit - Set a bit and return its old value
84 * @nr: Bit to set
85 * @addr: Address to count from
86 *
87 * This operation is non-atomic and can be reordered.
88 * If two examples of this operation race, one can appear to succeed
89 * but actually fail. You must protect multiple accesses with a lock.
90 */
91static inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
92{
93 unsigned long mask = BIT_MASK(nr);
94 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
95 unsigned long old = *p;
96
97 *p = old | mask;
98 return (old & mask) != 0;
99}
100
101/**
102 * __test_and_clear_bit - Clear a bit and return its old value
103 * @nr: Bit to clear
104 * @addr: Address to count from
105 *
106 * This operation is non-atomic and can be reordered.
107 * If two examples of this operation race, one can appear to succeed
108 * but actually fail. You must protect multiple accesses with a lock.
109 */
110static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
111{
112 unsigned long mask = BIT_MASK(nr);
113 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
114 unsigned long old = *p;
115
116 *p = old & ~mask;
117 return (old & mask) != 0;
118}
119
120/* WARNING: non atomic and it can be reordered! */
121static inline int __test_and_change_bit(int nr,
122 volatile unsigned long *addr)
123{
124 unsigned long mask = BIT_MASK(nr);
125 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
126 unsigned long old = *p;
127
128 *p = old ^ mask;
129 return (old & mask) != 0;
130}
131
132/**
133 * test_bit - Determine whether a bit is set
134 * @nr: bit number to test
135 * @addr: Address to start counting from
136 */
137static inline int test_bit(int nr, const volatile unsigned long *addr)
138{
139 return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
140}
141
142#endif /* __ASM_SH_BITOPS_OP32_H */
diff --git a/arch/sh/include/asm/bitops.h b/arch/sh/include/asm/bitops.h
index 367930d8e5ae..ebe595b7ab1f 100644
--- a/arch/sh/include/asm/bitops.h
+++ b/arch/sh/include/asm/bitops.h
@@ -13,21 +13,22 @@
13 13
14#ifdef CONFIG_GUSA_RB 14#ifdef CONFIG_GUSA_RB
15#include <asm/bitops-grb.h> 15#include <asm/bitops-grb.h>
16#elif defined(CONFIG_CPU_SH2A)
17#include <asm-generic/bitops/atomic.h>
18#include <asm/bitops-op32.h>
16#elif defined(CONFIG_CPU_SH4A) 19#elif defined(CONFIG_CPU_SH4A)
17#include <asm/bitops-llsc.h> 20#include <asm/bitops-llsc.h>
18#else 21#else
19#include <asm/bitops-irq.h> 22#include <asm-generic/bitops/atomic.h>
23#include <asm-generic/bitops/non-atomic.h>
20#endif 24#endif
21 25
22
23/* 26/*
24 * clear_bit() doesn't provide any barrier for the compiler. 27 * clear_bit() doesn't provide any barrier for the compiler.
25 */ 28 */
26#define smp_mb__before_clear_bit() barrier() 29#define smp_mb__before_clear_bit() barrier()
27#define smp_mb__after_clear_bit() barrier() 30#define smp_mb__after_clear_bit() barrier()
28 31
29#include <asm-generic/bitops/non-atomic.h>
30
31#ifdef CONFIG_SUPERH32 32#ifdef CONFIG_SUPERH32
32static inline unsigned long ffz(unsigned long word) 33static inline unsigned long ffz(unsigned long word)
33{ 34{
diff --git a/arch/sh/include/asm/bugs.h b/arch/sh/include/asm/bugs.h
index 121b2ecddfc3..4924ff6f5439 100644
--- a/arch/sh/include/asm/bugs.h
+++ b/arch/sh/include/asm/bugs.h
@@ -25,7 +25,7 @@ static void __init check_bugs(void)
25 case CPU_SH7619: 25 case CPU_SH7619:
26 *p++ = '2'; 26 *p++ = '2';
27 break; 27 break;
28 case CPU_SH7203 ... CPU_MXG: 28 case CPU_SH7201 ... CPU_MXG:
29 *p++ = '2'; 29 *p++ = '2';
30 *p++ = 'a'; 30 *p++ = 'a';
31 break; 31 break;
diff --git a/arch/sh/include/asm/elf.h b/arch/sh/include/asm/elf.h
index 9eb9036a1bdc..ccb1d93bb043 100644
--- a/arch/sh/include/asm/elf.h
+++ b/arch/sh/include/asm/elf.h
@@ -108,13 +108,11 @@ typedef struct user_fpu_struct elf_fpregset_t;
108#define elf_check_fdpic(x) ((x)->e_flags & EF_SH_FDPIC) 108#define elf_check_fdpic(x) ((x)->e_flags & EF_SH_FDPIC)
109#define elf_check_const_displacement(x) ((x)->e_flags & EF_SH_PIC) 109#define elf_check_const_displacement(x) ((x)->e_flags & EF_SH_PIC)
110 110
111#ifdef CONFIG_SUPERH32
112/* 111/*
113 * Enable dump using regset. 112 * Enable dump using regset.
114 * This covers all of general/DSP/FPU regs. 113 * This covers all of general/DSP/FPU regs.
115 */ 114 */
116#define CORE_DUMP_USE_REGSET 115#define CORE_DUMP_USE_REGSET
117#endif
118 116
119#define USE_ELF_CORE_DUMP 117#define USE_ELF_CORE_DUMP
120#define ELF_FDPIC_CORE_EFLAGS EF_SH_FDPIC 118#define ELF_FDPIC_CORE_EFLAGS EF_SH_FDPIC
@@ -204,7 +202,7 @@ do { \
204#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 202#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
205struct linux_binprm; 203struct linux_binprm;
206extern int arch_setup_additional_pages(struct linux_binprm *bprm, 204extern int arch_setup_additional_pages(struct linux_binprm *bprm,
207 int executable_stack); 205 int uses_interp);
208 206
209extern unsigned int vdso_enabled; 207extern unsigned int vdso_enabled;
210extern void __kernel_vsyscall; 208extern void __kernel_vsyscall;
diff --git a/arch/sh/include/asm/ftrace.h b/arch/sh/include/asm/ftrace.h
index 3aed362c9463..8fea7d8c8258 100644
--- a/arch/sh/include/asm/ftrace.h
+++ b/arch/sh/include/asm/ftrace.h
@@ -1,8 +1,34 @@
1#ifndef __ASM_SH_FTRACE_H 1#ifndef __ASM_SH_FTRACE_H
2#define __ASM_SH_FTRACE_H 2#define __ASM_SH_FTRACE_H
3 3
4#ifdef CONFIG_FUNCTION_TRACER
5
6#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */
7
4#ifndef __ASSEMBLY__ 8#ifndef __ASSEMBLY__
5extern void mcount(void); 9extern void mcount(void);
6#endif 10
11#define MCOUNT_ADDR ((long)(mcount))
12
13#ifdef CONFIG_DYNAMIC_FTRACE
14#define CALLER_ADDR ((long)(ftrace_caller))
15#define STUB_ADDR ((long)(ftrace_stub))
16
17#define MCOUNT_INSN_OFFSET ((STUB_ADDR - CALLER_ADDR) >> 1)
18
19struct dyn_arch_ftrace {
20 /* No extra data needed on sh */
21};
22
23#endif /* CONFIG_DYNAMIC_FTRACE */
24
25static inline unsigned long ftrace_call_adjust(unsigned long addr)
26{
27 /* 'addr' is the memory table address. */
28 return addr;
29}
30
31#endif /* __ASSEMBLY__ */
32#endif /* CONFIG_FUNCTION_TRACER */
7 33
8#endif /* __ASM_SH_FTRACE_H */ 34#endif /* __ASM_SH_FTRACE_H */
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 65eaae34e753..61f6dae40534 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -260,6 +260,10 @@ __ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags)
260 260
261 return (void __iomem *)P2SEGADDR(offset); 261 return (void __iomem *)P2SEGADDR(offset);
262 } 262 }
263
264 /* P4 above the store queues are always mapped. */
265 if (unlikely(offset >= P3_ADDR_MAX))
266 return (void __iomem *)P4SEGADDR(offset);
263#endif 267#endif
264 268
265 return __ioremap(offset, size, flags); 269 return __ioremap(offset, size, flags);
diff --git a/arch/sh/include/asm/kgdb.h b/arch/sh/include/asm/kgdb.h
index 24e42078f36f..72704ed725e5 100644
--- a/arch/sh/include/asm/kgdb.h
+++ b/arch/sh/include/asm/kgdb.h
@@ -1,21 +1,7 @@
1/* 1#ifndef __ASM_SH_KGDB_H
2 * May be copied or modified under the terms of the GNU General Public 2#define __ASM_SH_KGDB_H
3 * License. See linux/COPYING for more information.
4 *
5 * Based on original code by Glenn Engel, Jim Kingdon,
6 * David Grothe <dave@gcom.com>, Tigran Aivazian, <tigran@sco.com> and
7 * Amit S. Kale <akale@veritas.com>
8 *
9 * Super-H port based on sh-stub.c (Ben Lee and Steve Chamberlain) by
10 * Henry Bell <henry.bell@st.com>
11 *
12 * Header file for low-level support for remote debug using GDB.
13 *
14 */
15
16#ifndef __KGDB_H
17#define __KGDB_H
18 3
4#include <asm/cacheflush.h>
19#include <asm/ptrace.h> 5#include <asm/ptrace.h>
20 6
21/* Same as pt_regs but has vbr in place of syscall_nr */ 7/* Same as pt_regs but has vbr in place of syscall_nr */
@@ -30,40 +16,26 @@ struct kgdb_regs {
30 unsigned long vbr; 16 unsigned long vbr;
31}; 17};
32 18
33/* State info */ 19enum regnames {
34extern char kgdb_in_gdb_mode; 20 GDB_R0, GDB_R1, GDB_R2, GDB_R3, GDB_R4, GDB_R5, GDB_R6, GDB_R7,
35extern int kgdb_nofault; /* Ignore bus errors (in gdb mem access) */ 21 GDB_R8, GDB_R9, GDB_R10, GDB_R11, GDB_R12, GDB_R13, GDB_R14, GDB_R15,
36extern char in_nmi; /* Debounce flag to prevent NMI reentry*/
37 22
38/* SCI */ 23 GDB_PC, GDB_PR, GDB_SR, GDB_GBR, GDB_MACH, GDB_MACL, GDB_VBR,
39extern int kgdb_portnum; 24};
40extern int kgdb_baud;
41extern char kgdb_parity;
42extern char kgdb_bits;
43 25
44/* Init and interface stuff */ 26#define NUMREGBYTES ((GDB_VBR + 1) * 4)
45extern int kgdb_init(void);
46extern int (*kgdb_getchar)(void);
47extern void (*kgdb_putchar)(int);
48 27
49/* Trap functions */ 28static inline void arch_kgdb_breakpoint(void)
50typedef void (kgdb_debug_hook_t)(struct pt_regs *regs); 29{
51typedef void (kgdb_bus_error_hook_t)(void); 30 __asm__ __volatile__ ("trapa #0x3c\n");
52extern kgdb_debug_hook_t *kgdb_debug_hook; 31}
53extern kgdb_bus_error_hook_t *kgdb_bus_err_hook;
54 32
55/* Console */ 33/* State info */
56struct console; 34extern char in_nmi; /* Debounce flag to prevent NMI reentry*/
57void kgdb_console_write(struct console *co, const char *s, unsigned count);
58extern int kgdb_console_setup(struct console *, char *);
59 35
60/* Prototypes for jmp fns */ 36#define BUFMAX 2048
61#define _JBLEN 9
62typedef int jmp_buf[_JBLEN];
63extern void longjmp(jmp_buf __jmpb, int __retval);
64extern int setjmp(jmp_buf __jmpb);
65 37
66/* Forced breakpoint */ 38#define CACHE_FLUSH_IS_SAFE 1
67#define breakpoint() __asm__ __volatile__("trapa #0x3c") 39#define BREAK_INSTR_SIZE 2
68 40
69#endif 41#endif /* __ASM_SH_KGDB_H */
diff --git a/arch/sh/include/asm/machvec.h b/arch/sh/include/asm/machvec.h
index f1bae02ef7b6..64b1c16a0f03 100644
--- a/arch/sh/include/asm/machvec.h
+++ b/arch/sh/include/asm/machvec.h
@@ -14,8 +14,6 @@
14#include <linux/time.h> 14#include <linux/time.h>
15#include <asm/machtypes.h> 15#include <asm/machtypes.h>
16 16
17struct device;
18
19struct sh_machine_vector { 17struct sh_machine_vector {
20 void (*mv_setup)(char **cmdline_p); 18 void (*mv_setup)(char **cmdline_p);
21 const char *mv_name; 19 const char *mv_name;
@@ -45,9 +43,6 @@ struct sh_machine_vector {
45 int (*mv_irq_demux)(int irq); 43 int (*mv_irq_demux)(int irq);
46 44
47 void (*mv_init_irq)(void); 45 void (*mv_init_irq)(void);
48 void (*mv_init_pci)(void);
49
50 void (*mv_heartbeat)(void);
51 46
52 void __iomem *(*mv_ioport_map)(unsigned long port, unsigned int size); 47 void __iomem *(*mv_ioport_map)(unsigned long port, unsigned int size);
53 void (*mv_ioport_unmap)(void __iomem *); 48 void (*mv_ioport_unmap)(void __iomem *);
diff --git a/arch/sh/include/asm/mmu_context.h b/arch/sh/include/asm/mmu_context.h
index 04c0c9733ad6..5d9157bd474d 100644
--- a/arch/sh/include/asm/mmu_context.h
+++ b/arch/sh/include/asm/mmu_context.h
@@ -22,7 +22,7 @@
22#define MMU_CONTEXT_ASID_MASK 0x000000ff 22#define MMU_CONTEXT_ASID_MASK 0x000000ff
23#define MMU_CONTEXT_VERSION_MASK 0xffffff00 23#define MMU_CONTEXT_VERSION_MASK 0xffffff00
24#define MMU_CONTEXT_FIRST_VERSION 0x00000100 24#define MMU_CONTEXT_FIRST_VERSION 0x00000100
25#define NO_CONTEXT 0 25#define NO_CONTEXT 0UL
26 26
27/* ASID is 8-bit value, so it can't be 0x100 */ 27/* ASID is 8-bit value, so it can't be 0x100 */
28#define MMU_NO_ASID 0x100 28#define MMU_NO_ASID 0x100
@@ -130,7 +130,7 @@ static inline void switch_mm(struct mm_struct *prev,
130#define destroy_context(mm) do { } while (0) 130#define destroy_context(mm) do { } while (0)
131#define set_asid(asid) do { } while (0) 131#define set_asid(asid) do { } while (0)
132#define get_asid() (0) 132#define get_asid() (0)
133#define cpu_asid(cpu, mm) ({ (void)cpu; 0; }) 133#define cpu_asid(cpu, mm) ({ (void)cpu; NO_CONTEXT; })
134#define switch_and_save_asid(asid) (0) 134#define switch_and_save_asid(asid) (0)
135#define set_TTB(pgd) do { } while (0) 135#define set_TTB(pgd) do { } while (0)
136#define get_TTB() (0) 136#define get_TTB() (0)
diff --git a/arch/sh/include/asm/mutex-llsc.h b/arch/sh/include/asm/mutex-llsc.h
new file mode 100644
index 000000000000..ee839ee58ac8
--- /dev/null
+++ b/arch/sh/include/asm/mutex-llsc.h
@@ -0,0 +1,112 @@
1/*
2 * arch/sh/include/asm/mutex-llsc.h
3 *
4 * SH-4A optimized mutex locking primitives
5 *
6 * Please look into asm-generic/mutex-xchg.h for a formal definition.
7 */
8#ifndef __ASM_SH_MUTEX_LLSC_H
9#define __ASM_SH_MUTEX_LLSC_H
10
11/*
12 * Attempting to lock a mutex on SH4A is done like in ARMv6+ architecure.
13 * with a bastardized atomic decrement (it is not a reliable atomic decrement
14 * but it satisfies the defined semantics for our purpose, while being
15 * smaller and faster than a real atomic decrement or atomic swap.
16 * The idea is to attempt decrementing the lock value only once. If once
17 * decremented it isn't zero, or if its store-back fails due to a dispute
18 * on the exclusive store, we simply bail out immediately through the slow
19 * path where the lock will be reattempted until it succeeds.
20 */
21static inline void
22__mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
23{
24 int __ex_flag, __res;
25
26 __asm__ __volatile__ (
27 "movli.l @%2, %0 \n"
28 "add #-1, %0 \n"
29 "movco.l %0, @%2 \n"
30 "movt %1 \n"
31 : "=&z" (__res), "=&r" (__ex_flag)
32 : "r" (&(count)->counter)
33 : "t");
34
35 __res |= !__ex_flag;
36 if (unlikely(__res != 0))
37 fail_fn(count);
38}
39
40static inline int
41__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
42{
43 int __ex_flag, __res;
44
45 __asm__ __volatile__ (
46 "movli.l @%2, %0 \n"
47 "add #-1, %0 \n"
48 "movco.l %0, @%2 \n"
49 "movt %1 \n"
50 : "=&z" (__res), "=&r" (__ex_flag)
51 : "r" (&(count)->counter)
52 : "t");
53
54 __res |= !__ex_flag;
55 if (unlikely(__res != 0))
56 __res = fail_fn(count);
57
58 return __res;
59}
60
61static inline void
62__mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *))
63{
64 int __ex_flag, __res;
65
66 __asm__ __volatile__ (
67 "movli.l @%2, %0 \n\t"
68 "add #1, %0 \n\t"
69 "movco.l %0, @%2 \n\t"
70 "movt %1 \n\t"
71 : "=&z" (__res), "=&r" (__ex_flag)
72 : "r" (&(count)->counter)
73 : "t");
74
75 __res |= !__ex_flag;
76 if (unlikely(__res <= 0))
77 fail_fn(count);
78}
79
80/*
81 * If the unlock was done on a contended lock, or if the unlock simply fails
82 * then the mutex remains locked.
83 */
84#define __mutex_slowpath_needs_to_unlock() 1
85
86/*
87 * For __mutex_fastpath_trylock we do an atomic decrement and check the
88 * result and put it in the __res variable.
89 */
90static inline int
91__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
92{
93 int __res, __orig;
94
95 __asm__ __volatile__ (
96 "1: movli.l @%2, %0 \n\t"
97 "dt %0 \n\t"
98 "movco.l %0,@%2 \n\t"
99 "bf 1b \n\t"
100 "cmp/eq #0,%0 \n\t"
101 "bt 2f \n\t"
102 "mov #0, %1 \n\t"
103 "bf 3f \n\t"
104 "2: mov #1, %1 \n\t"
105 "3: "
106 : "=&z" (__orig), "=&r" (__res)
107 : "r" (&count->counter)
108 : "t");
109
110 return __res;
111}
112#endif /* __ASM_SH_MUTEX_LLSC_H */
diff --git a/arch/sh/include/asm/mutex.h b/arch/sh/include/asm/mutex.h
index 458c1f7fbc18..d8e37716a4a0 100644
--- a/arch/sh/include/asm/mutex.h
+++ b/arch/sh/include/asm/mutex.h
@@ -5,5 +5,8 @@
5 * implementation in place, or pick the atomic_xchg() based generic 5 * implementation in place, or pick the atomic_xchg() based generic
6 * implementation. (see asm-generic/mutex-xchg.h for details) 6 * implementation. (see asm-generic/mutex-xchg.h for details)
7 */ 7 */
8 8#if defined(CONFIG_CPU_SH4A)
9#include <asm/mutex-llsc.h>
10#else
9#include <asm-generic/mutex-dec.h> 11#include <asm-generic/mutex-dec.h>
12#endif
diff --git a/arch/sh/include/asm/pm.h b/arch/sh/include/asm/pm.h
deleted file mode 100644
index 56fdbd6b1c94..000000000000
--- a/arch/sh/include/asm/pm.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright 2006 (c) Andriy Skulysh <askulysh@gmail.com>
7 *
8 */
9#ifndef __ASM_SH_PM_H
10#define __ASM_SH_PM_H
11
12extern u8 wakeup_start;
13extern u8 wakeup_end;
14
15void pm_enter(void);
16
17#endif
diff --git a/arch/sh/include/asm/processor.h b/arch/sh/include/asm/processor.h
index 693364a20ad7..1ef4b24d7619 100644
--- a/arch/sh/include/asm/processor.h
+++ b/arch/sh/include/asm/processor.h
@@ -18,7 +18,7 @@ enum cpu_type {
18 CPU_SH7619, 18 CPU_SH7619,
19 19
20 /* SH-2A types */ 20 /* SH-2A types */
21 CPU_SH7203, CPU_SH7206, CPU_SH7263, CPU_MXG, 21 CPU_SH7201, CPU_SH7203, CPU_SH7206, CPU_SH7263, CPU_MXG,
22 22
23 /* SH-3 types */ 23 /* SH-3 types */
24 CPU_SH7705, CPU_SH7706, CPU_SH7707, 24 CPU_SH7705, CPU_SH7706, CPU_SH7707,
@@ -82,6 +82,9 @@ extern struct sh_cpuinfo cpu_data[];
82#define current_cpu_data cpu_data[smp_processor_id()] 82#define current_cpu_data cpu_data[smp_processor_id()]
83#define raw_current_cpu_data cpu_data[raw_smp_processor_id()] 83#define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
84 84
85#define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory")
86#define cpu_relax() barrier()
87
85/* Forward decl */ 88/* Forward decl */
86struct seq_operations; 89struct seq_operations;
87 90
diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h
index a46a0207e977..d79063c5eb9c 100644
--- a/arch/sh/include/asm/processor_32.h
+++ b/arch/sh/include/asm/processor_32.h
@@ -175,6 +175,15 @@ static __inline__ void enable_fpu(void)
175 175
176void show_trace(struct task_struct *tsk, unsigned long *sp, 176void show_trace(struct task_struct *tsk, unsigned long *sp,
177 struct pt_regs *regs); 177 struct pt_regs *regs);
178
179#ifdef CONFIG_DUMP_CODE
180void show_code(struct pt_regs *regs);
181#else
182static inline void show_code(struct pt_regs *regs)
183{
184}
185#endif
186
178extern unsigned long get_wchan(struct task_struct *p); 187extern unsigned long get_wchan(struct task_struct *p);
179 188
180#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) 189#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)
@@ -182,9 +191,6 @@ extern unsigned long get_wchan(struct task_struct *p);
182 191
183#define user_stack_pointer(regs) ((regs)->regs[15]) 192#define user_stack_pointer(regs) ((regs)->regs[15])
184 193
185#define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory")
186#define cpu_relax() barrier()
187
188#if defined(CONFIG_CPU_SH2A) || defined(CONFIG_CPU_SH3) || \ 194#if defined(CONFIG_CPU_SH2A) || defined(CONFIG_CPU_SH3) || \
189 defined(CONFIG_CPU_SH4) 195 defined(CONFIG_CPU_SH4)
190#define PREFETCH_STRIDE L1_CACHE_BYTES 196#define PREFETCH_STRIDE L1_CACHE_BYTES
diff --git a/arch/sh/include/asm/processor_64.h b/arch/sh/include/asm/processor_64.h
index b0b4824dfc4c..803177fcf086 100644
--- a/arch/sh/include/asm/processor_64.h
+++ b/arch/sh/include/asm/processor_64.h
@@ -226,9 +226,7 @@ extern unsigned long get_wchan(struct task_struct *p);
226#define KSTK_EIP(tsk) ((tsk)->thread.pc) 226#define KSTK_EIP(tsk) ((tsk)->thread.pc)
227#define KSTK_ESP(tsk) ((tsk)->thread.sp) 227#define KSTK_ESP(tsk) ((tsk)->thread.sp)
228 228
229#define user_stack_pointer(regs) ((regs)->sp) 229#define user_stack_pointer(regs) ((regs)->regs[15])
230
231#define cpu_relax() barrier()
232 230
233#endif /* __ASSEMBLY__ */ 231#endif /* __ASSEMBLY__ */
234#endif /* __ASM_SH_PROCESSOR_64_H */ 232#endif /* __ASM_SH_PROCESSOR_64_H */
diff --git a/arch/sh/include/asm/ptrace.h b/arch/sh/include/asm/ptrace.h
index 3ad18e91bca6..12912ab80c15 100644
--- a/arch/sh/include/asm/ptrace.h
+++ b/arch/sh/include/asm/ptrace.h
@@ -86,6 +86,7 @@ struct pt_dspregs {
86 unsigned long re; 86 unsigned long re;
87 unsigned long mod; 87 unsigned long mod;
88}; 88};
89#endif
89 90
90#define PTRACE_GETREGS 12 /* General registers */ 91#define PTRACE_GETREGS 12 /* General registers */
91#define PTRACE_SETREGS 13 92#define PTRACE_SETREGS 13
@@ -100,7 +101,6 @@ struct pt_dspregs {
100 101
101#define PTRACE_GETDSPREGS 55 /* DSP registers */ 102#define PTRACE_GETDSPREGS 55 /* DSP registers */
102#define PTRACE_SETDSPREGS 56 103#define PTRACE_SETDSPREGS 56
103#endif
104 104
105#ifdef __KERNEL__ 105#ifdef __KERNEL__
106#include <asm/addrspace.h> 106#include <asm/addrspace.h>
diff --git a/arch/sh/include/asm/sh_bios.h b/arch/sh/include/asm/sh_bios.h
index 0ca261956e3d..d9c96d7cf6c7 100644
--- a/arch/sh/include/asm/sh_bios.h
+++ b/arch/sh/include/asm/sh_bios.h
@@ -10,7 +10,6 @@
10 10
11extern void sh_bios_console_write(const char *buf, unsigned int len); 11extern void sh_bios_console_write(const char *buf, unsigned int len);
12extern void sh_bios_char_out(char ch); 12extern void sh_bios_char_out(char ch);
13extern int sh_bios_in_gdb_mode(void);
14extern void sh_bios_gdb_detach(void); 13extern void sh_bios_gdb_detach(void);
15 14
16extern void sh_bios_get_node_addr(unsigned char *node_addr); 15extern void sh_bios_get_node_addr(unsigned char *node_addr);
diff --git a/arch/sh/include/asm/smp.h b/arch/sh/include/asm/smp.h
index 85b660c17eb0..c24e9c6a1736 100644
--- a/arch/sh/include/asm/smp.h
+++ b/arch/sh/include/asm/smp.h
@@ -31,7 +31,7 @@ enum {
31}; 31};
32 32
33void smp_message_recv(unsigned int msg); 33void smp_message_recv(unsigned int msg);
34void smp_timer_broadcast(cpumask_t mask); 34void smp_timer_broadcast(const struct cpumask *mask);
35 35
36void local_timer_interrupt(void); 36void local_timer_interrupt(void);
37void local_timer_setup(unsigned int cpu); 37void local_timer_setup(unsigned int cpu);
diff --git a/arch/sh/include/asm/string_64.h b/arch/sh/include/asm/string_64.h
index aa1fef229c78..742007172624 100644
--- a/arch/sh/include/asm/string_64.h
+++ b/arch/sh/include/asm/string_64.h
@@ -1,17 +1,20 @@
1#ifndef __ASM_SH_STRING_64_H 1#ifndef __ASM_SH_STRING_64_H
2#define __ASM_SH_STRING_64_H 2#define __ASM_SH_STRING_64_H
3 3
4/* 4#ifdef __KERNEL__
5 * include/asm-sh/string_64.h 5
6 * 6#define __HAVE_ARCH_MEMSET
7 * Copyright (C) 2000, 2001 Paolo Alberelli 7extern void *memset(void *__s, int __c, size_t __count);
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
12 */
13 8
14#define __HAVE_ARCH_MEMCPY 9#define __HAVE_ARCH_MEMCPY
15extern void *memcpy(void *dest, const void *src, size_t count); 10extern void *memcpy(void *dest, const void *src, size_t count);
16 11
12#define __HAVE_ARCH_STRLEN
13extern size_t strlen(const char *);
14
15#define __HAVE_ARCH_STRCPY
16extern char *strcpy(char *__dest, const char *__src);
17
18#endif /* __KERNEL__ */
19
17#endif /* __ASM_SH_STRING_64_H */ 20#endif /* __ASM_SH_STRING_64_H */
diff --git a/arch/sh/include/asm/syscall_32.h b/arch/sh/include/asm/syscall_32.h
index 54773f26cd44..05a868a71ef5 100644
--- a/arch/sh/include/asm/syscall_32.h
+++ b/arch/sh/include/asm/syscall_32.h
@@ -5,7 +5,7 @@
5#include <linux/sched.h> 5#include <linux/sched.h>
6#include <asm/ptrace.h> 6#include <asm/ptrace.h>
7 7
8/* The system call number is given by the user in %g1 */ 8/* The system call number is given by the user in R3 */
9static inline long syscall_get_nr(struct task_struct *task, 9static inline long syscall_get_nr(struct task_struct *task,
10 struct pt_regs *regs) 10 struct pt_regs *regs)
11{ 11{
diff --git a/arch/sh/include/asm/syscall_64.h b/arch/sh/include/asm/syscall_64.h
index bcaaa8ca4d70..e1143b9784d6 100644
--- a/arch/sh/include/asm/syscall_64.h
+++ b/arch/sh/include/asm/syscall_64.h
@@ -1,6 +1,80 @@
1#ifndef __ASM_SH_SYSCALL_64_H 1#ifndef __ASM_SH_SYSCALL_64_H
2#define __ASM_SH_SYSCALL_64_H 2#define __ASM_SH_SYSCALL_64_H
3 3
4#include <asm-generic/syscall.h> 4#include <linux/kernel.h>
5#include <linux/sched.h>
6#include <asm/ptrace.h>
7
8/* The system call number is given by the user in R9 */
9static inline long syscall_get_nr(struct task_struct *task,
10 struct pt_regs *regs)
11{
12 return (regs->syscall_nr >= 0) ? regs->regs[9] : -1L;
13}
14
15static inline void syscall_rollback(struct task_struct *task,
16 struct pt_regs *regs)
17{
18 /*
19 * XXX: This needs some thought. On SH we don't
20 * save away the original R9 value anywhere.
21 */
22}
23
24static inline bool syscall_has_error(struct pt_regs *regs)
25{
26 return (regs->sr & 0x1) ? true : false;
27}
28static inline void syscall_set_error(struct pt_regs *regs)
29{
30 regs->sr |= 0x1;
31}
32static inline void syscall_clear_error(struct pt_regs *regs)
33{
34 regs->sr &= ~0x1;
35}
36
37static inline long syscall_get_error(struct task_struct *task,
38 struct pt_regs *regs)
39{
40 return syscall_has_error(regs) ? regs->regs[9] : 0;
41}
42
43static inline long syscall_get_return_value(struct task_struct *task,
44 struct pt_regs *regs)
45{
46 return regs->regs[9];
47}
48
49static inline void syscall_set_return_value(struct task_struct *task,
50 struct pt_regs *regs,
51 int error, long val)
52{
53 if (error) {
54 syscall_set_error(regs);
55 regs->regs[9] = -error;
56 } else {
57 syscall_clear_error(regs);
58 regs->regs[9] = val;
59 }
60}
61
62static inline void syscall_get_arguments(struct task_struct *task,
63 struct pt_regs *regs,
64 unsigned int i, unsigned int n,
65 unsigned long *args)
66{
67 BUG_ON(i + n > 6);
68 memcpy(args, &regs->regs[2 + i], n * sizeof(args[0]));
69}
70
71static inline void syscall_set_arguments(struct task_struct *task,
72 struct pt_regs *regs,
73 unsigned int i, unsigned int n,
74 const unsigned long *args)
75{
76 BUG_ON(i + n > 6);
77 memcpy(&regs->regs[2 + i], args, n * sizeof(args[0]));
78}
5 79
6#endif /* __ASM_SH_SYSCALL_64_H */ 80#endif /* __ASM_SH_SYSCALL_64_H */
diff --git a/arch/sh/include/asm/system.h b/arch/sh/include/asm/system.h
index 6160fe445161..c9ec6af8e745 100644
--- a/arch/sh/include/asm/system.h
+++ b/arch/sh/include/asm/system.h
@@ -175,6 +175,8 @@ asmlinkage void name##_trap_handler(unsigned int vec, struct pt_regs *regs)
175BUILD_TRAP_HANDLER(address_error); 175BUILD_TRAP_HANDLER(address_error);
176BUILD_TRAP_HANDLER(debug); 176BUILD_TRAP_HANDLER(debug);
177BUILD_TRAP_HANDLER(bug); 177BUILD_TRAP_HANDLER(bug);
178BUILD_TRAP_HANDLER(breakpoint);
179BUILD_TRAP_HANDLER(singlestep);
178BUILD_TRAP_HANDLER(fpu_error); 180BUILD_TRAP_HANDLER(fpu_error);
179BUILD_TRAP_HANDLER(fpu_state_restore); 181BUILD_TRAP_HANDLER(fpu_state_restore);
180 182
diff --git a/arch/sh/include/asm/topology.h b/arch/sh/include/asm/topology.h
index 95f0085e098a..066f0fba590e 100644
--- a/arch/sh/include/asm/topology.h
+++ b/arch/sh/include/asm/topology.h
@@ -5,7 +5,6 @@
5 5
6/* sched_domains SD_NODE_INIT for sh machines */ 6/* sched_domains SD_NODE_INIT for sh machines */
7#define SD_NODE_INIT (struct sched_domain) { \ 7#define SD_NODE_INIT (struct sched_domain) { \
8 .span = CPU_MASK_NONE, \
9 .parent = NULL, \ 8 .parent = NULL, \
10 .child = NULL, \ 9 .child = NULL, \
11 .groups = NULL, \ 10 .groups = NULL, \
@@ -33,6 +32,7 @@
33#define parent_node(node) ((void)(node),0) 32#define parent_node(node) ((void)(node),0)
34 33
35#define node_to_cpumask(node) ((void)node, cpu_online_map) 34#define node_to_cpumask(node) ((void)node, cpu_online_map)
35#define cpumask_of_node(node) ((void)node, cpu_online_mask)
36#define node_to_first_cpu(node) ((void)(node),0) 36#define node_to_first_cpu(node) ((void)(node),0)
37 37
38#define pcibus_to_node(bus) ((void)(bus), -1) 38#define pcibus_to_node(bus) ((void)(bus), -1)
diff --git a/arch/sh/include/asm/unaligned-sh4a.h b/arch/sh/include/asm/unaligned-sh4a.h
new file mode 100644
index 000000000000..d8f89770275b
--- /dev/null
+++ b/arch/sh/include/asm/unaligned-sh4a.h
@@ -0,0 +1,258 @@
1#ifndef __ASM_SH_UNALIGNED_SH4A_H
2#define __ASM_SH_UNALIGNED_SH4A_H
3
4/*
5 * SH-4A has support for unaligned 32-bit loads, and 32-bit loads only.
6 * Support for 16 and 64-bit accesses are done through shifting and
7 * masking relative to the endianness. Unaligned stores are not supported
8 * by the instruction encoding, so these continue to use the packed
9 * struct.
10 *
11 * The same note as with the movli.l/movco.l pair applies here, as long
12 * as the load is gauranteed to be inlined, nothing else will hook in to
13 * r0 and we get the return value for free.
14 *
15 * NOTE: Due to the fact we require r0 encoding, care should be taken to
16 * avoid mixing these heavily with other r0 consumers, such as the atomic
17 * ops. Failure to adhere to this can result in the compiler running out
18 * of spill registers and blowing up when building at low optimization
19 * levels. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34777.
20 */
21#include <linux/types.h>
22#include <asm/byteorder.h>
23
24static __always_inline u32 __get_unaligned_cpu32(const u8 *p)
25{
26 unsigned long unaligned;
27
28 __asm__ __volatile__ (
29 "movua.l @%1, %0\n\t"
30 : "=z" (unaligned)
31 : "r" (p)
32 );
33
34 return unaligned;
35}
36
37struct __una_u16 { u16 x __attribute__((packed)); };
38struct __una_u32 { u32 x __attribute__((packed)); };
39struct __una_u64 { u64 x __attribute__((packed)); };
40
41static inline u16 __get_unaligned_cpu16(const u8 *p)
42{
43#ifdef __LITTLE_ENDIAN
44 return __get_unaligned_cpu32(p) & 0xffff;
45#else
46 return __get_unaligned_cpu32(p) >> 16;
47#endif
48}
49
50/*
51 * Even though movua.l supports auto-increment on the read side, it can
52 * only store to r0 due to instruction encoding constraints, so just let
53 * the compiler sort it out on its own.
54 */
55static inline u64 __get_unaligned_cpu64(const u8 *p)
56{
57#ifdef __LITTLE_ENDIAN
58 return (u64)__get_unaligned_cpu32(p + 4) << 32 |
59 __get_unaligned_cpu32(p);
60#else
61 return (u64)__get_unaligned_cpu32(p) << 32 |
62 __get_unaligned_cpu32(p + 4);
63#endif
64}
65
66static inline u16 get_unaligned_le16(const void *p)
67{
68 return le16_to_cpu(__get_unaligned_cpu16(p));
69}
70
71static inline u32 get_unaligned_le32(const void *p)
72{
73 return le32_to_cpu(__get_unaligned_cpu32(p));
74}
75
76static inline u64 get_unaligned_le64(const void *p)
77{
78 return le64_to_cpu(__get_unaligned_cpu64(p));
79}
80
81static inline u16 get_unaligned_be16(const void *p)
82{
83 return be16_to_cpu(__get_unaligned_cpu16(p));
84}
85
86static inline u32 get_unaligned_be32(const void *p)
87{
88 return be32_to_cpu(__get_unaligned_cpu32(p));
89}
90
91static inline u64 get_unaligned_be64(const void *p)
92{
93 return be64_to_cpu(__get_unaligned_cpu64(p));
94}
95
96static inline void __put_le16_noalign(u8 *p, u16 val)
97{
98 *p++ = val;
99 *p++ = val >> 8;
100}
101
102static inline void __put_le32_noalign(u8 *p, u32 val)
103{
104 __put_le16_noalign(p, val);
105 __put_le16_noalign(p + 2, val >> 16);
106}
107
108static inline void __put_le64_noalign(u8 *p, u64 val)
109{
110 __put_le32_noalign(p, val);
111 __put_le32_noalign(p + 4, val >> 32);
112}
113
114static inline void __put_be16_noalign(u8 *p, u16 val)
115{
116 *p++ = val >> 8;
117 *p++ = val;
118}
119
120static inline void __put_be32_noalign(u8 *p, u32 val)
121{
122 __put_be16_noalign(p, val >> 16);
123 __put_be16_noalign(p + 2, val);
124}
125
126static inline void __put_be64_noalign(u8 *p, u64 val)
127{
128 __put_be32_noalign(p, val >> 32);
129 __put_be32_noalign(p + 4, val);
130}
131
132static inline void put_unaligned_le16(u16 val, void *p)
133{
134#ifdef __LITTLE_ENDIAN
135 ((struct __una_u16 *)p)->x = val;
136#else
137 __put_le16_noalign(p, val);
138#endif
139}
140
141static inline void put_unaligned_le32(u32 val, void *p)
142{
143#ifdef __LITTLE_ENDIAN
144 ((struct __una_u32 *)p)->x = val;
145#else
146 __put_le32_noalign(p, val);
147#endif
148}
149
150static inline void put_unaligned_le64(u64 val, void *p)
151{
152#ifdef __LITTLE_ENDIAN
153 ((struct __una_u64 *)p)->x = val;
154#else
155 __put_le64_noalign(p, val);
156#endif
157}
158
159static inline void put_unaligned_be16(u16 val, void *p)
160{
161#ifdef __BIG_ENDIAN
162 ((struct __una_u16 *)p)->x = val;
163#else
164 __put_be16_noalign(p, val);
165#endif
166}
167
168static inline void put_unaligned_be32(u32 val, void *p)
169{
170#ifdef __BIG_ENDIAN
171 ((struct __una_u32 *)p)->x = val;
172#else
173 __put_be32_noalign(p, val);
174#endif
175}
176
177static inline void put_unaligned_be64(u64 val, void *p)
178{
179#ifdef __BIG_ENDIAN
180 ((struct __una_u64 *)p)->x = val;
181#else
182 __put_be64_noalign(p, val);
183#endif
184}
185
186/*
187 * Cause a link-time error if we try an unaligned access other than
188 * 1,2,4 or 8 bytes long
189 */
190extern void __bad_unaligned_access_size(void);
191
192#define __get_unaligned_le(ptr) ((__force typeof(*(ptr)))({ \
193 __builtin_choose_expr(sizeof(*(ptr)) == 1, *(ptr), \
194 __builtin_choose_expr(sizeof(*(ptr)) == 2, get_unaligned_le16((ptr)), \
195 __builtin_choose_expr(sizeof(*(ptr)) == 4, get_unaligned_le32((ptr)), \
196 __builtin_choose_expr(sizeof(*(ptr)) == 8, get_unaligned_le64((ptr)), \
197 __bad_unaligned_access_size())))); \
198 }))
199
200#define __get_unaligned_be(ptr) ((__force typeof(*(ptr)))({ \
201 __builtin_choose_expr(sizeof(*(ptr)) == 1, *(ptr), \
202 __builtin_choose_expr(sizeof(*(ptr)) == 2, get_unaligned_be16((ptr)), \
203 __builtin_choose_expr(sizeof(*(ptr)) == 4, get_unaligned_be32((ptr)), \
204 __builtin_choose_expr(sizeof(*(ptr)) == 8, get_unaligned_be64((ptr)), \
205 __bad_unaligned_access_size())))); \
206 }))
207
208#define __put_unaligned_le(val, ptr) ({ \
209 void *__gu_p = (ptr); \
210 switch (sizeof(*(ptr))) { \
211 case 1: \
212 *(u8 *)__gu_p = (__force u8)(val); \
213 break; \
214 case 2: \
215 put_unaligned_le16((__force u16)(val), __gu_p); \
216 break; \
217 case 4: \
218 put_unaligned_le32((__force u32)(val), __gu_p); \
219 break; \
220 case 8: \
221 put_unaligned_le64((__force u64)(val), __gu_p); \
222 break; \
223 default: \
224 __bad_unaligned_access_size(); \
225 break; \
226 } \
227 (void)0; })
228
229#define __put_unaligned_be(val, ptr) ({ \
230 void *__gu_p = (ptr); \
231 switch (sizeof(*(ptr))) { \
232 case 1: \
233 *(u8 *)__gu_p = (__force u8)(val); \
234 break; \
235 case 2: \
236 put_unaligned_be16((__force u16)(val), __gu_p); \
237 break; \
238 case 4: \
239 put_unaligned_be32((__force u32)(val), __gu_p); \
240 break; \
241 case 8: \
242 put_unaligned_be64((__force u64)(val), __gu_p); \
243 break; \
244 default: \
245 __bad_unaligned_access_size(); \
246 break; \
247 } \
248 (void)0; })
249
250#ifdef __LITTLE_ENDIAN
251# define get_unaligned __get_unaligned_le
252# define put_unaligned __put_unaligned_le
253#else
254# define get_unaligned __get_unaligned_be
255# define put_unaligned __put_unaligned_be
256#endif
257
258#endif /* __ASM_SH_UNALIGNED_SH4A_H */
diff --git a/arch/sh/include/asm/unaligned.h b/arch/sh/include/asm/unaligned.h
index c1641a01d50f..8c0ad5e4487a 100644
--- a/arch/sh/include/asm/unaligned.h
+++ b/arch/sh/include/asm/unaligned.h
@@ -1,7 +1,11 @@
1#ifndef _ASM_SH_UNALIGNED_H 1#ifndef _ASM_SH_UNALIGNED_H
2#define _ASM_SH_UNALIGNED_H 2#define _ASM_SH_UNALIGNED_H
3 3
4/* SH can't handle unaligned accesses. */ 4#ifdef CONFIG_CPU_SH4A
5/* SH-4A can handle unaligned loads in a relatively neutered fashion. */
6#include <asm/unaligned-sh4a.h>
7#else
8/* Otherwise, SH can't handle unaligned accesses. */
5#ifdef __LITTLE_ENDIAN__ 9#ifdef __LITTLE_ENDIAN__
6# include <linux/unaligned/le_struct.h> 10# include <linux/unaligned/le_struct.h>
7# include <linux/unaligned/be_byteshift.h> 11# include <linux/unaligned/be_byteshift.h>
@@ -15,5 +19,6 @@
15# define get_unaligned __get_unaligned_be 19# define get_unaligned __get_unaligned_be
16# define put_unaligned __put_unaligned_be 20# define put_unaligned __put_unaligned_be
17#endif 21#endif
22#endif
18 23
19#endif /* _ASM_SH_UNALIGNED_H */ 24#endif /* _ASM_SH_UNALIGNED_H */
diff --git a/arch/sh/include/cpu-sh3/cpu/gpio.h b/arch/sh/include/cpu-sh3/cpu/gpio.h
index 4e53eb314b8f..9a22b882f3dc 100644
--- a/arch/sh/include/cpu-sh3/cpu/gpio.h
+++ b/arch/sh/include/cpu-sh3/cpu/gpio.h
@@ -62,6 +62,20 @@
62#define PORT_PSELC 0xA4050128UL 62#define PORT_PSELC 0xA4050128UL
63#define PORT_PSELD 0xA405012AUL 63#define PORT_PSELD 0xA405012AUL
64 64
65#elif defined(CONFIG_CPU_SUBTYPE_SH7709)
66
67/* Control registers */
68#define PORT_PACR 0xa4000100UL
69#define PORT_PBCR 0xa4000102UL
70#define PORT_PCCR 0xa4000104UL
71#define PORT_PFCR 0xa400010aUL
72
73/* Data registers */
74#define PORT_PADR 0xa4000120UL
75#define PORT_PBDR 0xa4000122UL
76#define PORT_PCDR 0xa4000124UL
77#define PORT_PFDR 0xa400012aUL
78
65#endif 79#endif
66 80
67#endif 81#endif
diff --git a/arch/sh/include/mach-common/mach/edosk7705.h b/arch/sh/include/mach-common/mach/edosk7705.h
index 5bdc9d9be3de..efc43b323466 100644
--- a/arch/sh/include/mach-common/mach/edosk7705.h
+++ b/arch/sh/include/mach-common/mach/edosk7705.h
@@ -1,30 +1,7 @@
1/* 1#ifndef __ASM_SH_EDOSK7705_H
2 * include/asm-sh/edosk7705.h 2#define __ASM_SH_EDOSK7705_H
3 *
4 * Modified version of io_se.h for the EDOSK7705 specific functions.
5 *
6 * May be copied or modified under the terms of the GNU General Public
7 * License. See linux/COPYING for more information.
8 *
9 * IO functions for an Hitachi EDOSK7705 development board
10 */
11
12#ifndef __ASM_SH_EDOSK7705_IO_H
13#define __ASM_SH_EDOSK7705_IO_H
14 3
4#define __IO_PREFIX sh_edosk7705
15#include <asm/io_generic.h> 5#include <asm/io_generic.h>
16 6
17extern unsigned char sh_edosk7705_inb(unsigned long port); 7#endif /* __ASM_SH_EDOSK7705_H */
18extern unsigned int sh_edosk7705_inl(unsigned long port);
19
20extern void sh_edosk7705_outb(unsigned char value, unsigned long port);
21extern void sh_edosk7705_outl(unsigned int value, unsigned long port);
22
23extern void sh_edosk7705_insb(unsigned long port, void *addr, unsigned long count);
24extern void sh_edosk7705_insl(unsigned long port, void *addr, unsigned long count);
25extern void sh_edosk7705_outsb(unsigned long port, const void *addr, unsigned long count);
26extern void sh_edosk7705_outsl(unsigned long port, const void *addr, unsigned long count);
27
28extern unsigned long sh_edosk7705_isa_port2addr(unsigned long offset);
29
30#endif /* __ASM_SH_EDOSK7705_IO_H */
diff --git a/arch/sh/include/mach-se/mach/mrshpc.h b/arch/sh/include/mach-se/mach/mrshpc.h
new file mode 100644
index 000000000000..56287ee8563a
--- /dev/null
+++ b/arch/sh/include/mach-se/mach/mrshpc.h
@@ -0,0 +1,52 @@
1#ifndef __MACH_SE_MRSHPC_H
2#define __MACH_SE_MRSHPC_H
3
4#include <linux/io.h>
5
6static inline void __init mrshpc_setup_windows(void)
7{
8 if ((__raw_readw(MRSHPC_CSR) & 0x000c) != 0)
9 return; /* Not detected */
10
11 if ((__raw_readw(MRSHPC_CSR) & 0x0080) == 0) {
12 __raw_writew(0x0674, MRSHPC_CPWCR); /* Card Vcc is 3.3v? */
13 } else {
14 __raw_writew(0x0678, MRSHPC_CPWCR); /* Card Vcc is 5V */
15 }
16
17 /*
18 * PC-Card window open
19 * flag == COMMON/ATTRIBUTE/IO
20 */
21 /* common window open */
22 __raw_writew(0x8a84, MRSHPC_MW0CR1);
23 if((__raw_readw(MRSHPC_CSR) & 0x4000) != 0)
24 /* common mode & bus width 16bit SWAP = 1*/
25 __raw_writew(0x0b00, MRSHPC_MW0CR2);
26 else
27 /* common mode & bus width 16bit SWAP = 0*/
28 __raw_writew(0x0300, MRSHPC_MW0CR2);
29
30 /* attribute window open */
31 __raw_writew(0x8a85, MRSHPC_MW1CR1);
32 if ((__raw_readw(MRSHPC_CSR) & 0x4000) != 0)
33 /* attribute mode & bus width 16bit SWAP = 1*/
34 __raw_writew(0x0a00, MRSHPC_MW1CR2);
35 else
36 /* attribute mode & bus width 16bit SWAP = 0*/
37 __raw_writew(0x0200, MRSHPC_MW1CR2);
38
39 /* I/O window open */
40 __raw_writew(0x8a86, MRSHPC_IOWCR1);
41 __raw_writew(0x0008, MRSHPC_CDCR); /* I/O card mode */
42 if ((__raw_readw(MRSHPC_CSR) & 0x4000) != 0)
43 __raw_writew(0x0a00, MRSHPC_IOWCR2); /* bus width 16bit SWAP = 1*/
44 else
45 __raw_writew(0x0200, MRSHPC_IOWCR2); /* bus width 16bit SWAP = 0*/
46
47 __raw_writew(0x2000, MRSHPC_ICR);
48 __raw_writeb(0x00, PA_MRSHPC_MW2 + 0x206);
49 __raw_writeb(0x42, PA_MRSHPC_MW2 + 0x200);
50}
51
52#endif /* __MACH_SE_MRSHPC_H */
diff --git a/arch/sh/include/mach-se/mach/se.h b/arch/sh/include/mach-se/mach/se.h
index eb23000e1bbe..14be91c5a2f0 100644
--- a/arch/sh/include/mach-se/mach/se.h
+++ b/arch/sh/include/mach-se/mach/se.h
@@ -68,6 +68,24 @@
68#define BCR_ILCRF (PA_BCR + 10) 68#define BCR_ILCRF (PA_BCR + 10)
69#define BCR_ILCRG (PA_BCR + 12) 69#define BCR_ILCRG (PA_BCR + 12)
70 70
71#if defined(CONFIG_CPU_SUBTYPE_SH7709)
72#define INTC_IRR0 0xa4000004UL
73#define INTC_IRR1 0xa4000006UL
74#define INTC_IRR2 0xa4000008UL
75
76#define INTC_ICR0 0xfffffee0UL
77#define INTC_ICR1 0xa4000010UL
78#define INTC_ICR2 0xa4000012UL
79#define INTC_INTER 0xa4000014UL
80
81#define INTC_IPRC 0xa4000016UL
82#define INTC_IPRD 0xa4000018UL
83#define INTC_IPRE 0xa400001aUL
84
85#define IRQ0_IRQ 32
86#define IRQ1_IRQ 33
87#endif
88
71#if defined(CONFIG_CPU_SUBTYPE_SH7705) 89#if defined(CONFIG_CPU_SUBTYPE_SH7705)
72#define IRQ_STNIC 12 90#define IRQ_STNIC 12
73#define IRQ_CFCARD 14 91#define IRQ_CFCARD 14
diff --git a/arch/sh/include/mach-se/mach/se7343.h b/arch/sh/include/mach-se/mach/se7343.h
index 98458460e632..749914b400fb 100644
--- a/arch/sh/include/mach-se/mach/se7343.h
+++ b/arch/sh/include/mach-se/mach/se7343.h
@@ -118,9 +118,6 @@
118#define FPGA_IN 0xb1400000 118#define FPGA_IN 0xb1400000
119#define FPGA_OUT 0xb1400002 119#define FPGA_OUT 0xb1400002
120 120
121#define __IO_PREFIX sh7343se
122#include <asm/io_generic.h>
123
124#define IRQ0_IRQ 32 121#define IRQ0_IRQ 32
125#define IRQ1_IRQ 33 122#define IRQ1_IRQ 33
126#define IRQ4_IRQ 36 123#define IRQ4_IRQ 36
@@ -132,8 +129,10 @@
132#define SE7343_FPGA_IRQ_MRSHPC3 3 129#define SE7343_FPGA_IRQ_MRSHPC3 3
133#define SE7343_FPGA_IRQ_SMC 6 /* EXT_IRQ2 */ 130#define SE7343_FPGA_IRQ_SMC 6 /* EXT_IRQ2 */
134#define SE7343_FPGA_IRQ_USB 8 131#define SE7343_FPGA_IRQ_USB 8
132#define SE7343_FPGA_IRQ_UARTA 10
133#define SE7343_FPGA_IRQ_UARTB 11
135 134
136#define SE7343_FPGA_IRQ_NR 11 135#define SE7343_FPGA_IRQ_NR 12
137#define SE7343_FPGA_IRQ_BASE 120 136#define SE7343_FPGA_IRQ_BASE 120
138 137
139#define MRSHPC_IRQ3 (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_MRSHPC3) 138#define MRSHPC_IRQ3 (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_MRSHPC3)
@@ -142,6 +141,8 @@
142#define MRSHPC_IRQ0 (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_MRSHPC0) 141#define MRSHPC_IRQ0 (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_MRSHPC0)
143#define SMC_IRQ (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_SMC) 142#define SMC_IRQ (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_SMC)
144#define USB_IRQ (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_USB) 143#define USB_IRQ (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_USB)
144#define UARTA_IRQ (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_UARTA)
145#define UARTB_IRQ (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_UARTB)
145 146
146/* arch/sh/boards/se/7343/irq.c */ 147/* arch/sh/boards/se/7343/irq.c */
147void init_7343se_IRQ(void); 148void init_7343se_IRQ(void);
diff --git a/arch/sh/kernel/Makefile_32 b/arch/sh/kernel/Makefile_32
index 48edfb145fb4..2e1b86e16ab5 100644
--- a/arch/sh/kernel/Makefile_32
+++ b/arch/sh/kernel/Makefile_32
@@ -4,25 +4,31 @@
4 4
5extra-y := head_32.o init_task.o vmlinux.lds 5extra-y := head_32.o init_task.o vmlinux.lds
6 6
7obj-y := debugtraps.o io.o io_generic.o irq.o machvec.o process_32.o \ 7ifdef CONFIG_FUNCTION_TRACER
8 ptrace_32.o setup.o signal_32.o sys_sh.o sys_sh32.o \ 8# Do not profile debug and lowlevel utilities
9 syscalls_32.o time_32.o topology.o traps.o traps_32.o 9CFLAGS_REMOVE_ftrace.o = -pg
10endif
11
12obj-y := debugtraps.o idle.o io.o io_generic.o irq.o \
13 machvec.o process_32.o ptrace_32.o setup.o signal_32.o \
14 sys_sh.o sys_sh32.o syscalls_32.o time_32.o topology.o \
15 traps.o traps_32.o
10 16
11obj-y += cpu/ timers/ 17obj-y += cpu/ timers/
12obj-$(CONFIG_VSYSCALL) += vsyscall/ 18obj-$(CONFIG_VSYSCALL) += vsyscall/
13obj-$(CONFIG_SMP) += smp.o 19obj-$(CONFIG_SMP) += smp.o
14obj-$(CONFIG_CF_ENABLER) += cf-enabler.o
15obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o 20obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o
16obj-$(CONFIG_SH_KGDB) += kgdb_stub.o kgdb_jmp.o 21obj-$(CONFIG_KGDB) += kgdb.o
17obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o 22obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o
18obj-$(CONFIG_MODULES) += sh_ksyms_32.o module.o 23obj-$(CONFIG_MODULES) += sh_ksyms_32.o module.o
19obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 24obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
20obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o 25obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
21obj-$(CONFIG_CRASH_DUMP) += crash_dump.o 26obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
22obj-$(CONFIG_PM) += pm.o
23obj-$(CONFIG_STACKTRACE) += stacktrace.o 27obj-$(CONFIG_STACKTRACE) += stacktrace.o
24obj-$(CONFIG_IO_TRAPPED) += io_trapped.o 28obj-$(CONFIG_IO_TRAPPED) += io_trapped.o
25obj-$(CONFIG_KPROBES) += kprobes.o 29obj-$(CONFIG_KPROBES) += kprobes.o
26obj-$(CONFIG_GENERIC_GPIO) += gpio.o 30obj-$(CONFIG_GENERIC_GPIO) += gpio.o
31obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
32obj-$(CONFIG_DUMP_CODE) += disassemble.o
27 33
28EXTRA_CFLAGS += -Werror 34EXTRA_CFLAGS += -Werror
diff --git a/arch/sh/kernel/Makefile_64 b/arch/sh/kernel/Makefile_64
index c97660b2b48d..fe425d7f6871 100644
--- a/arch/sh/kernel/Makefile_64
+++ b/arch/sh/kernel/Makefile_64
@@ -1,21 +1,18 @@
1extra-y := head_64.o init_task.o vmlinux.lds 1extra-y := head_64.o init_task.o vmlinux.lds
2 2
3obj-y := debugtraps.o io.o io_generic.o irq.o machvec.o process_64.o \ 3obj-y := debugtraps.o idle.o io.o io_generic.o irq.o machvec.o process_64.o \
4 ptrace_64.o setup.o signal_64.o sys_sh.o sys_sh64.o \ 4 ptrace_64.o setup.o signal_64.o sys_sh.o sys_sh64.o \
5 syscalls_64.o time_64.o topology.o traps.o traps_64.o 5 syscalls_64.o time_64.o topology.o traps.o traps_64.o
6 6
7obj-y += cpu/ timers/ 7obj-y += cpu/ timers/
8obj-$(CONFIG_VSYSCALL) += vsyscall/ 8obj-$(CONFIG_VSYSCALL) += vsyscall/
9obj-$(CONFIG_SMP) += smp.o 9obj-$(CONFIG_SMP) += smp.o
10obj-$(CONFIG_CF_ENABLER) += cf-enabler.o
11obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o 10obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o
12obj-$(CONFIG_SH_KGDB) += kgdb_stub.o kgdb_jmp.o
13obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o 11obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o
14obj-$(CONFIG_MODULES) += sh_ksyms_64.o module.o 12obj-$(CONFIG_MODULES) += sh_ksyms_64.o module.o
15obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 13obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
16obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o 14obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
17obj-$(CONFIG_CRASH_DUMP) += crash_dump.o 15obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
18obj-$(CONFIG_PM) += pm.o
19obj-$(CONFIG_STACKTRACE) += stacktrace.o 16obj-$(CONFIG_STACKTRACE) += stacktrace.o
20obj-$(CONFIG_IO_TRAPPED) += io_trapped.o 17obj-$(CONFIG_IO_TRAPPED) += io_trapped.o
21obj-$(CONFIG_GENERIC_GPIO) += gpio.o 18obj-$(CONFIG_GENERIC_GPIO) += gpio.o
diff --git a/arch/sh/kernel/cf-enabler.c b/arch/sh/kernel/cf-enabler.c
deleted file mode 100644
index bea40339919b..000000000000
--- a/arch/sh/kernel/cf-enabler.c
+++ /dev/null
@@ -1,168 +0,0 @@
1/* $Id: cf-enabler.c,v 1.4 2004/02/22 22:44:36 kkojima Exp $
2 *
3 * linux/drivers/block/cf-enabler.c
4 *
5 * Copyright (C) 1999 Niibe Yutaka
6 * Copyright (C) 2000 Toshiharu Nozawa
7 * Copyright (C) 2001 A&D Co., Ltd.
8 *
9 * Enable the CF configuration.
10 */
11
12#include <linux/init.h>
13#include <linux/mm.h>
14#include <linux/vmalloc.h>
15#include <linux/interrupt.h>
16#include <asm/io.h>
17#include <asm/irq.h>
18
19/*
20 * You can connect Compact Flash directly to the bus of SuperH.
21 * This is the enabler for that.
22 *
23 * SIM: How generic is this really? It looks pretty board, or at
24 * least SH sub-type, specific to me.
25 * I know it doesn't work on the Overdrive!
26 */
27
28/*
29 * 0xB8000000 : Attribute
30 * 0xB8001000 : Common Memory
31 * 0xBA000000 : I/O
32 */
33#if defined(CONFIG_CPU_SH4)
34/* SH4 can't access PCMCIA interface through P2 area.
35 * we must remap it with appropriate attribute bit of the page set.
36 * this part is based on Greg Banks' hd64465_ss.c implementation - Masahiro Abe */
37
38#if defined(CONFIG_CF_AREA6)
39#define slot_no 0
40#else
41#define slot_no 1
42#endif
43
44/* use this pointer to access to directly connected compact flash io area*/
45void *cf_io_base;
46
47static int __init allocate_cf_area(void)
48{
49 pgprot_t prot;
50 unsigned long paddrbase, psize;
51
52 /* open I/O area window */
53 paddrbase = virt_to_phys((void*)CONFIG_CF_BASE_ADDR);
54 psize = PAGE_SIZE;
55 prot = PAGE_KERNEL_PCC(slot_no, _PAGE_PCC_IO16);
56 cf_io_base = p3_ioremap(paddrbase, psize, prot.pgprot);
57 if (!cf_io_base) {
58 printk("allocate_cf_area : can't open CF I/O window!\n");
59 return -ENOMEM;
60 }
61/* printk("p3_ioremap(paddr=0x%08lx, psize=0x%08lx, prot=0x%08lx)=0x%08lx\n",
62 paddrbase, psize, prot.pgprot, cf_io_base);*/
63
64 /* XXX : do we need attribute and common-memory area also? */
65
66 return 0;
67}
68#endif
69
70static int __init cf_init_default(void)
71{
72/* You must have enabled the card, and set the level interrupt
73 * before reaching this point. Possibly in boot ROM or boot loader.
74 */
75#if defined(CONFIG_CPU_SH4)
76 allocate_cf_area();
77#endif
78
79 return 0;
80}
81
82#if defined(CONFIG_SH_SOLUTION_ENGINE)
83#include <mach-se/mach/se.h>
84#elif defined(CONFIG_SH_7722_SOLUTION_ENGINE)
85#include <mach-se/mach/se7722.h>
86#elif defined(CONFIG_SH_7721_SOLUTION_ENGINE)
87#include <mach-se/mach/se7721.h>
88#endif
89
90/*
91 * SolutionEngine Seriese
92 *
93 * about MS770xSE
94 * 0xB8400000 : Common Memory
95 * 0xB8500000 : Attribute
96 * 0xB8600000 : I/O
97 *
98 * about MS7722SE
99 * 0xB0400000 : Common Memory
100 * 0xB0500000 : Attribute
101 * 0xB0600000 : I/O
102 */
103
104#if defined(CONFIG_SH_SOLUTION_ENGINE) || \
105 defined(CONFIG_SH_7722_SOLUTION_ENGINE) || \
106 defined(CONFIG_SH_7721_SOLUTION_ENGINE)
107static int __init cf_init_se(void)
108{
109 if ((ctrl_inw(MRSHPC_CSR) & 0x000c) != 0)
110 return 0; /* Not detected */
111
112 if ((ctrl_inw(MRSHPC_CSR) & 0x0080) == 0) {
113 ctrl_outw(0x0674, MRSHPC_CPWCR); /* Card Vcc is 3.3v? */
114 } else {
115 ctrl_outw(0x0678, MRSHPC_CPWCR); /* Card Vcc is 5V */
116 }
117
118 /*
119 * PC-Card window open
120 * flag == COMMON/ATTRIBUTE/IO
121 */
122 /* common window open */
123 ctrl_outw(0x8a84, MRSHPC_MW0CR1);
124 if((ctrl_inw(MRSHPC_CSR) & 0x4000) != 0)
125 /* common mode & bus width 16bit SWAP = 1*/
126 ctrl_outw(0x0b00, MRSHPC_MW0CR2);
127 else
128 /* common mode & bus width 16bit SWAP = 0*/
129 ctrl_outw(0x0300, MRSHPC_MW0CR2);
130
131 /* attribute window open */
132 ctrl_outw(0x8a85, MRSHPC_MW1CR1);
133 if ((ctrl_inw(MRSHPC_CSR) & 0x4000) != 0)
134 /* attribute mode & bus width 16bit SWAP = 1*/
135 ctrl_outw(0x0a00, MRSHPC_MW1CR2);
136 else
137 /* attribute mode & bus width 16bit SWAP = 0*/
138 ctrl_outw(0x0200, MRSHPC_MW1CR2);
139
140 /* I/O window open */
141 ctrl_outw(0x8a86, MRSHPC_IOWCR1);
142 ctrl_outw(0x0008, MRSHPC_CDCR); /* I/O card mode */
143 if ((ctrl_inw(MRSHPC_CSR) & 0x4000) != 0)
144 ctrl_outw(0x0a00, MRSHPC_IOWCR2); /* bus width 16bit SWAP = 1*/
145 else
146 ctrl_outw(0x0200, MRSHPC_IOWCR2); /* bus width 16bit SWAP = 0*/
147
148 ctrl_outw(0x2000, MRSHPC_ICR);
149 ctrl_outb(0x00, PA_MRSHPC_MW2 + 0x206);
150 ctrl_outb(0x42, PA_MRSHPC_MW2 + 0x200);
151 return 0;
152}
153#else
154static int __init cf_init_se(void)
155{
156 return -1;
157}
158#endif
159
160static int __init cf_init(void)
161{
162 if (mach_is_se() || mach_is_7722se() || mach_is_7721se())
163 return cf_init_se();
164
165 return cf_init_default();
166}
167
168__initcall (cf_init);
diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c
index b7e46d5bba43..7b17137536d6 100644
--- a/arch/sh/kernel/cpu/clock.c
+++ b/arch/sh/kernel/cpu/clock.c
@@ -117,6 +117,11 @@ int clk_enable(struct clk *clk)
117 unsigned long flags; 117 unsigned long flags;
118 int ret; 118 int ret;
119 119
120 if (!clk)
121 return -EINVAL;
122
123 clk_enable(clk->parent);
124
120 spin_lock_irqsave(&clock_lock, flags); 125 spin_lock_irqsave(&clock_lock, flags);
121 ret = __clk_enable(clk); 126 ret = __clk_enable(clk);
122 spin_unlock_irqrestore(&clock_lock, flags); 127 spin_unlock_irqrestore(&clock_lock, flags);
@@ -147,9 +152,14 @@ void clk_disable(struct clk *clk)
147{ 152{
148 unsigned long flags; 153 unsigned long flags;
149 154
155 if (!clk)
156 return;
157
150 spin_lock_irqsave(&clock_lock, flags); 158 spin_lock_irqsave(&clock_lock, flags);
151 __clk_disable(clk); 159 __clk_disable(clk);
152 spin_unlock_irqrestore(&clock_lock, flags); 160 spin_unlock_irqrestore(&clock_lock, flags);
161
162 clk_disable(clk->parent);
153} 163}
154EXPORT_SYMBOL_GPL(clk_disable); 164EXPORT_SYMBOL_GPL(clk_disable);
155 165
diff --git a/arch/sh/kernel/cpu/init.c b/arch/sh/kernel/cpu/init.c
index 75fb03d35670..d29e69c156f0 100644
--- a/arch/sh/kernel/cpu/init.c
+++ b/arch/sh/kernel/cpu/init.c
@@ -261,9 +261,11 @@ asmlinkage void __init sh_cpu_init(void)
261 cache_init(); 261 cache_init();
262 262
263 if (raw_smp_processor_id() == 0) { 263 if (raw_smp_processor_id() == 0) {
264#ifdef CONFIG_MMU
264 shm_align_mask = max_t(unsigned long, 265 shm_align_mask = max_t(unsigned long,
265 current_cpu_data.dcache.way_size - 1, 266 current_cpu_data.dcache.way_size - 1,
266 PAGE_SIZE - 1); 267 PAGE_SIZE - 1);
268#endif
267 269
268 /* Boot CPU sets the cache shape */ 270 /* Boot CPU sets the cache shape */
269 detect_cache_shape(); 271 detect_cache_shape();
diff --git a/arch/sh/kernel/cpu/sh2a/Makefile b/arch/sh/kernel/cpu/sh2a/Makefile
index 428450cc0809..45f85c77ef75 100644
--- a/arch/sh/kernel/cpu/sh2a/Makefile
+++ b/arch/sh/kernel/cpu/sh2a/Makefile
@@ -8,9 +8,10 @@ common-y += ex.o entry.o
8 8
9obj-$(CONFIG_SH_FPU) += fpu.o 9obj-$(CONFIG_SH_FPU) += fpu.o
10 10
11obj-$(CONFIG_CPU_SUBTYPE_SH7206) += setup-sh7206.o clock-sh7206.o 11obj-$(CONFIG_CPU_SUBTYPE_SH7201) += setup-sh7201.o clock-sh7201.o
12obj-$(CONFIG_CPU_SUBTYPE_SH7203) += setup-sh7203.o clock-sh7203.o 12obj-$(CONFIG_CPU_SUBTYPE_SH7203) += setup-sh7203.o clock-sh7203.o
13obj-$(CONFIG_CPU_SUBTYPE_SH7263) += setup-sh7203.o clock-sh7203.o 13obj-$(CONFIG_CPU_SUBTYPE_SH7263) += setup-sh7203.o clock-sh7203.o
14obj-$(CONFIG_CPU_SUBTYPE_SH7206) += setup-sh7206.o clock-sh7206.o
14obj-$(CONFIG_CPU_SUBTYPE_MXG) += setup-mxg.o clock-sh7206.o 15obj-$(CONFIG_CPU_SUBTYPE_MXG) += setup-mxg.o clock-sh7206.o
15 16
16# Pinmux setup 17# Pinmux setup
diff --git a/arch/sh/kernel/cpu/sh2a/clock-sh7201.c b/arch/sh/kernel/cpu/sh2a/clock-sh7201.c
new file mode 100644
index 000000000000..020a96fe961a
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh2a/clock-sh7201.c
@@ -0,0 +1,85 @@
1/*
2 * arch/sh/kernel/cpu/sh2a/clock-sh7201.c
3 *
4 * SH7201 support for the clock framework
5 *
6 * Copyright (C) 2008 Peter Griffin <pgriffin@mpc-data.co.uk>
7 *
8 * Based on clock-sh4.c
9 * Copyright (C) 2005 Paul Mundt
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 */
15#include <linux/init.h>
16#include <linux/kernel.h>
17#include <asm/clock.h>
18#include <asm/freq.h>
19#include <asm/io.h>
20
21const static int pll1rate[]={1,2,3,4,6,8};
22const static int pfc_divisors[]={1,2,3,4,6,8,12};
23#define ifc_divisors pfc_divisors
24
25#if (CONFIG_SH_CLK_MD == 0)
26#define PLL2 (4)
27#elif (CONFIG_SH_CLK_MD == 2)
28#define PLL2 (2)
29#elif (CONFIG_SH_CLK_MD == 3)
30#define PLL2 (1)
31#else
32#error "Illegal Clock Mode!"
33#endif
34
35static void master_clk_init(struct clk *clk)
36{
37 clk->rate = 10000000 * PLL2 * pll1rate[(ctrl_inw(FREQCR) >> 8) & 0x0007];
38}
39
40static struct clk_ops sh7201_master_clk_ops = {
41 .init = master_clk_init,
42};
43
44static void module_clk_recalc(struct clk *clk)
45{
46 int idx = (ctrl_inw(FREQCR) & 0x0007);
47 clk->rate = clk->parent->rate / pfc_divisors[idx];
48}
49
50static struct clk_ops sh7201_module_clk_ops = {
51 .recalc = module_clk_recalc,
52};
53
54static void bus_clk_recalc(struct clk *clk)
55{
56 int idx = (ctrl_inw(FREQCR) & 0x0007);
57 clk->rate = clk->parent->rate / pfc_divisors[idx];
58}
59
60static struct clk_ops sh7201_bus_clk_ops = {
61 .recalc = bus_clk_recalc,
62};
63
64static void cpu_clk_recalc(struct clk *clk)
65{
66 int idx = ((ctrl_inw(FREQCR) >> 4) & 0x0007);
67 clk->rate = clk->parent->rate / ifc_divisors[idx];
68}
69
70static struct clk_ops sh7201_cpu_clk_ops = {
71 .recalc = cpu_clk_recalc,
72};
73
74static struct clk_ops *sh7201_clk_ops[] = {
75 &sh7201_master_clk_ops,
76 &sh7201_module_clk_ops,
77 &sh7201_bus_clk_ops,
78 &sh7201_cpu_clk_ops,
79};
80
81void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
82{
83 if (idx < ARRAY_SIZE(sh7201_clk_ops))
84 *ops = sh7201_clk_ops[idx];
85}
diff --git a/arch/sh/kernel/cpu/sh2a/probe.c b/arch/sh/kernel/cpu/sh2a/probe.c
index 6e79132f6f30..e098e2f6aa08 100644
--- a/arch/sh/kernel/cpu/sh2a/probe.c
+++ b/arch/sh/kernel/cpu/sh2a/probe.c
@@ -18,16 +18,17 @@ int __init detect_cpu_and_cache_system(void)
18 /* All SH-2A CPUs have support for 16 and 32-bit opcodes.. */ 18 /* All SH-2A CPUs have support for 16 and 32-bit opcodes.. */
19 boot_cpu_data.flags |= CPU_HAS_OP32; 19 boot_cpu_data.flags |= CPU_HAS_OP32;
20 20
21#if defined(CONFIG_CPU_SUBTYPE_SH7203) 21#if defined(CONFIG_CPU_SUBTYPE_SH7201)
22 boot_cpu_data.type = CPU_SH7201;
23 boot_cpu_data.flags |= CPU_HAS_FPU;
24#elif defined(CONFIG_CPU_SUBTYPE_SH7203)
22 boot_cpu_data.type = CPU_SH7203; 25 boot_cpu_data.type = CPU_SH7203;
23 /* SH7203 has an FPU.. */
24 boot_cpu_data.flags |= CPU_HAS_FPU; 26 boot_cpu_data.flags |= CPU_HAS_FPU;
25#elif defined(CONFIG_CPU_SUBTYPE_SH7263) 27#elif defined(CONFIG_CPU_SUBTYPE_SH7263)
26 boot_cpu_data.type = CPU_SH7263; 28 boot_cpu_data.type = CPU_SH7263;
27 boot_cpu_data.flags |= CPU_HAS_FPU; 29 boot_cpu_data.flags |= CPU_HAS_FPU;
28#elif defined(CONFIG_CPU_SUBTYPE_SH7206) 30#elif defined(CONFIG_CPU_SUBTYPE_SH7206)
29 boot_cpu_data.type = CPU_SH7206; 31 boot_cpu_data.type = CPU_SH7206;
30 /* While SH7206 has a DSP.. */
31 boot_cpu_data.flags |= CPU_HAS_DSP; 32 boot_cpu_data.flags |= CPU_HAS_DSP;
32#elif defined(CONFIG_CPU_SUBTYPE_MXG) 33#elif defined(CONFIG_CPU_SUBTYPE_MXG)
33 boot_cpu_data.type = CPU_MXG; 34 boot_cpu_data.type = CPU_MXG;
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7201.c b/arch/sh/kernel/cpu/sh2a/setup-sh7201.c
new file mode 100644
index 000000000000..0631e421c022
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh2a/setup-sh7201.c
@@ -0,0 +1,331 @@
1/*
2 * SH7201 setup
3 *
4 * Copyright (C) 2008 Peter Griffin pgriffin@mpc-data.co.uk
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/platform_device.h>
11#include <linux/init.h>
12#include <linux/serial.h>
13#include <linux/serial_sci.h>
14
15enum {
16 UNUSED = 0,
17
18 /* interrupt sources */
19 IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
20 PINT0, PINT1, PINT2, PINT3, PINT4, PINT5, PINT6, PINT7,
21 ADC_ADI,
22 MTU2_TGI0A, MTU2_TGI0B, MTU2_TGI0C, MTU2_TGI0D,
23 MTU2_TCI0V, MTU2_TGI0E, MTU2_TGI0F,
24 MTU2_TGI1A, MTU2_TGI1B, MTU2_TCI1V, MTU2_TCI1U,
25 MTU2_TGI2A, MTU2_TGI2B, MTU2_TCI2V, MTU2_TCI2U,
26 MTU2_TGI3A, MTU2_TGI3B, MTU2_TGI3C, MTU2_TGI3D, MTU2_TCI3V,
27 MTU2_TGI4A, MTU2_TGI4B, MTU2_TGI4C, MTU2_TGI4D, MTU2_TCI4V,
28 MTU2_TGI5U, MTU2_TGI5V, MTU2_TGI5W,
29 RTC_ARM, RTC_PRD, RTC_CUP,
30 WDT,
31 IIC30_STPI, IIC30_NAKI, IIC30_RXI, IIC30_TXI, IIC30_TEI,
32 IIC31_STPI, IIC31_NAKI, IIC31_RXI, IIC31_TXI, IIC31_TEI,
33 IIC32_STPI, IIC32_NAKI, IIC32_RXI, IIC32_TXI, IIC32_TEI,
34
35 DMAC0_DMINT0, DMAC1_DMINT1,
36 DMAC2_DMINT2, DMAC3_DMINT3,
37
38 SCIF0_BRI, SCIF0_ERI, SCIF0_RXI, SCIF0_TXI,
39 SCIF1_BRI, SCIF1_ERI, SCIF1_RXI, SCIF1_TXI,
40 SCIF2_BRI, SCIF2_ERI, SCIF2_RXI, SCIF2_TXI,
41 SCIF3_BRI, SCIF3_ERI, SCIF3_RXI, SCIF3_TXI,
42 SCIF4_BRI, SCIF4_ERI, SCIF4_RXI, SCIF4_TXI,
43 SCIF5_BRI, SCIF5_ERI, SCIF5_RXI, SCIF5_TXI,
44 SCIF6_BRI, SCIF6_ERI, SCIF6_RXI, SCIF6_TXI,
45 SCIF7_BRI, SCIF7_ERI, SCIF7_RXI, SCIF7_TXI,
46
47 DMAC0_DMINTA, DMAC4_DMINT4, DMAC5_DMINT5, DMAC6_DMINT6,
48 DMAC7_DMINT7,
49
50 RCAN0_ERS, RCAN0_OVR,
51 RCAN0_SLE,
52 RCAN0_RM0, RCAN0_RM1,
53
54 RCAN1_ERS, RCAN1_OVR,
55 RCAN1_SLE,
56 RCAN1_RM0, RCAN1_RM1,
57
58 SSI0_SSII, SSI1_SSII,
59
60 TMR0_CMIA0, TMR0_CMIB0, TMR0_OVI0,
61 TMR1_CMIA1, TMR1_CMIB1, TMR1_OVI1,
62
63 /* interrupt groups */
64
65 IRQ, PINT, ADC,
66 MTU20_ABCD, MTU20_VEF, MTU21_AB, MTU21_VU, MTU22_AB, MTU22_VU,
67 MTU23_ABCD, MTU24_ABCD, MTU25_UVW,
68 RTC, IIC30, IIC31, IIC32,
69 SCIF0, SCIF1, SCIF2, SCIF3, SCIF4, SCIF5, SCIF6, SCIF7,
70 RCAN0, RCAN1, TMR0, TMR1
71
72};
73
74static struct intc_vect vectors[] __initdata = {
75 INTC_IRQ(IRQ0, 64), INTC_IRQ(IRQ1, 65),
76 INTC_IRQ(IRQ2, 66), INTC_IRQ(IRQ3, 67),
77 INTC_IRQ(IRQ4, 68), INTC_IRQ(IRQ5, 69),
78 INTC_IRQ(IRQ6, 70), INTC_IRQ(IRQ7, 71),
79 INTC_IRQ(PINT0, 80), INTC_IRQ(PINT1, 81),
80 INTC_IRQ(PINT2, 82), INTC_IRQ(PINT3, 83),
81 INTC_IRQ(PINT4, 84), INTC_IRQ(PINT5, 85),
82 INTC_IRQ(PINT6, 86), INTC_IRQ(PINT7, 87),
83
84 INTC_IRQ(ADC_ADI, 92),
85
86 INTC_IRQ(MTU2_TGI0A, 108), INTC_IRQ(MTU2_TGI0B, 109),
87 INTC_IRQ(MTU2_TGI0C, 110), INTC_IRQ(MTU2_TGI0D, 111),
88 INTC_IRQ(MTU2_TCI0V, 112),
89 INTC_IRQ(MTU2_TGI0E, 113), INTC_IRQ(MTU2_TGI0F, 114),
90
91 INTC_IRQ(MTU2_TGI1A, 116), INTC_IRQ(MTU2_TGI1B, 117),
92 INTC_IRQ(MTU2_TCI1V, 120), INTC_IRQ(MTU2_TCI1U, 121),
93
94 INTC_IRQ(MTU2_TGI2A, 124), INTC_IRQ(MTU2_TGI2B, 125),
95 INTC_IRQ(MTU2_TCI2V, 128), INTC_IRQ(MTU2_TCI2U, 129),
96
97 INTC_IRQ(MTU2_TGI3A, 132), INTC_IRQ(MTU2_TGI3B, 133),
98 INTC_IRQ(MTU2_TGI3C, 134), INTC_IRQ(MTU2_TGI3D, 135),
99 INTC_IRQ(MTU2_TCI3V, 136),
100
101 INTC_IRQ(MTU2_TGI4A, 140), INTC_IRQ(MTU2_TGI4B, 141),
102 INTC_IRQ(MTU2_TGI4C, 142), INTC_IRQ(MTU2_TGI4D, 143),
103 INTC_IRQ(MTU2_TCI4V, 144),
104
105 INTC_IRQ(MTU2_TGI5U, 148), INTC_IRQ(MTU2_TGI5V, 149),
106 INTC_IRQ(MTU2_TGI5W, 150),
107
108 INTC_IRQ(RTC_ARM, 152), INTC_IRQ(RTC_PRD, 153),
109 INTC_IRQ(RTC_CUP, 154), INTC_IRQ(WDT, 156),
110
111 INTC_IRQ(IIC30_STPI, 157), INTC_IRQ(IIC30_NAKI, 158),
112 INTC_IRQ(IIC30_RXI, 159), INTC_IRQ(IIC30_TXI, 160),
113 INTC_IRQ(IIC30_TEI, 161),
114
115 INTC_IRQ(IIC31_STPI, 164), INTC_IRQ(IIC31_NAKI, 165),
116 INTC_IRQ(IIC31_RXI, 166), INTC_IRQ(IIC31_TXI, 167),
117 INTC_IRQ(IIC31_TEI, 168),
118
119 INTC_IRQ(IIC32_STPI, 170), INTC_IRQ(IIC32_NAKI, 171),
120 INTC_IRQ(IIC32_RXI, 172), INTC_IRQ(IIC32_TXI, 173),
121 INTC_IRQ(IIC32_TEI, 174),
122
123 INTC_IRQ(DMAC0_DMINT0, 176), INTC_IRQ(DMAC1_DMINT1, 177),
124 INTC_IRQ(DMAC2_DMINT2, 178), INTC_IRQ(DMAC3_DMINT3, 179),
125
126 INTC_IRQ(SCIF0_BRI, 180), INTC_IRQ(SCIF0_ERI, 181),
127 INTC_IRQ(SCIF0_RXI, 182), INTC_IRQ(SCIF0_TXI, 183),
128 INTC_IRQ(SCIF1_BRI, 184), INTC_IRQ(SCIF1_ERI, 185),
129 INTC_IRQ(SCIF1_RXI, 186), INTC_IRQ(SCIF1_TXI, 187),
130 INTC_IRQ(SCIF2_BRI, 188), INTC_IRQ(SCIF2_ERI, 189),
131 INTC_IRQ(SCIF2_RXI, 190), INTC_IRQ(SCIF2_TXI, 191),
132 INTC_IRQ(SCIF3_BRI, 192), INTC_IRQ(SCIF3_ERI, 193),
133 INTC_IRQ(SCIF3_RXI, 194), INTC_IRQ(SCIF3_TXI, 195),
134 INTC_IRQ(SCIF4_BRI, 196), INTC_IRQ(SCIF4_ERI, 197),
135 INTC_IRQ(SCIF4_RXI, 198), INTC_IRQ(SCIF4_TXI, 199),
136 INTC_IRQ(SCIF5_BRI, 200), INTC_IRQ(SCIF5_ERI, 201),
137 INTC_IRQ(SCIF5_RXI, 202), INTC_IRQ(SCIF5_TXI, 203),
138 INTC_IRQ(SCIF6_BRI, 204), INTC_IRQ(SCIF6_ERI, 205),
139 INTC_IRQ(SCIF6_RXI, 206), INTC_IRQ(SCIF6_TXI, 207),
140 INTC_IRQ(SCIF7_BRI, 208), INTC_IRQ(SCIF7_ERI, 209),
141 INTC_IRQ(SCIF7_RXI, 210), INTC_IRQ(SCIF7_TXI, 211),
142
143 INTC_IRQ(DMAC0_DMINTA, 212), INTC_IRQ(DMAC4_DMINT4, 216),
144 INTC_IRQ(DMAC5_DMINT5, 217), INTC_IRQ(DMAC6_DMINT6, 218),
145 INTC_IRQ(DMAC7_DMINT7, 219),
146
147 INTC_IRQ(RCAN0_ERS, 228), INTC_IRQ(RCAN0_OVR, 229),
148 INTC_IRQ(RCAN0_SLE, 230),
149 INTC_IRQ(RCAN0_RM0, 231), INTC_IRQ(RCAN0_RM1, 232),
150
151 INTC_IRQ(RCAN1_ERS, 234), INTC_IRQ(RCAN1_OVR, 235),
152 INTC_IRQ(RCAN1_SLE, 236),
153 INTC_IRQ(RCAN1_RM0, 237), INTC_IRQ(RCAN1_RM1, 238),
154
155 INTC_IRQ(SSI0_SSII, 244), INTC_IRQ(SSI1_SSII, 245),
156
157 INTC_IRQ(TMR0_CMIA0, 246), INTC_IRQ(TMR0_CMIB0, 247),
158 INTC_IRQ(TMR0_OVI0, 248),
159
160 INTC_IRQ(TMR1_CMIA1, 252), INTC_IRQ(TMR1_CMIB1, 253),
161 INTC_IRQ(TMR1_OVI1, 254),
162
163};
164
165static struct intc_group groups[] __initdata = {
166 INTC_GROUP(PINT, PINT0, PINT1, PINT2, PINT3,
167 PINT4, PINT5, PINT6, PINT7),
168 INTC_GROUP(MTU20_ABCD, MTU2_TGI0A, MTU2_TGI0B, MTU2_TGI0C, MTU2_TGI0D),
169 INTC_GROUP(MTU20_VEF, MTU2_TCI0V, MTU2_TGI0E, MTU2_TGI0F),
170
171 INTC_GROUP(MTU21_AB, MTU2_TGI1A, MTU2_TGI1B),
172 INTC_GROUP(MTU21_VU, MTU2_TCI1V, MTU2_TCI1U),
173 INTC_GROUP(MTU22_AB, MTU2_TGI2A, MTU2_TGI2B),
174 INTC_GROUP(MTU22_VU, MTU2_TCI2V, MTU2_TCI2U),
175 INTC_GROUP(MTU23_ABCD, MTU2_TGI3A, MTU2_TGI3B, MTU2_TGI3C, MTU2_TGI3D),
176 INTC_GROUP(MTU24_ABCD, MTU2_TGI4A, MTU2_TGI4B, MTU2_TGI4C, MTU2_TGI4D),
177 INTC_GROUP(MTU25_UVW, MTU2_TGI5U, MTU2_TGI5V, MTU2_TGI5W),
178 INTC_GROUP(RTC, RTC_ARM, RTC_PRD, RTC_CUP ),
179
180 INTC_GROUP(IIC30, IIC30_STPI, IIC30_NAKI, IIC30_RXI, IIC30_TXI,
181 IIC30_TEI),
182 INTC_GROUP(IIC31, IIC31_STPI, IIC31_NAKI, IIC31_RXI, IIC31_TXI,
183 IIC31_TEI),
184 INTC_GROUP(IIC32, IIC32_STPI, IIC32_NAKI, IIC32_RXI, IIC32_TXI,
185 IIC32_TEI),
186
187 INTC_GROUP(SCIF0, SCIF0_BRI, SCIF0_ERI, SCIF0_RXI, SCIF0_TXI),
188 INTC_GROUP(SCIF1, SCIF1_BRI, SCIF1_ERI, SCIF1_RXI, SCIF1_TXI),
189 INTC_GROUP(SCIF2, SCIF2_BRI, SCIF2_ERI, SCIF2_RXI, SCIF2_TXI),
190 INTC_GROUP(SCIF3, SCIF3_BRI, SCIF3_ERI, SCIF3_RXI, SCIF3_TXI),
191 INTC_GROUP(SCIF4, SCIF4_BRI, SCIF4_ERI, SCIF4_RXI, SCIF4_TXI),
192 INTC_GROUP(SCIF5, SCIF5_BRI, SCIF5_ERI, SCIF5_RXI, SCIF5_TXI),
193 INTC_GROUP(SCIF6, SCIF6_BRI, SCIF6_ERI, SCIF6_RXI, SCIF6_TXI),
194 INTC_GROUP(SCIF7, SCIF7_BRI, SCIF7_ERI, SCIF7_RXI, SCIF7_TXI),
195
196 INTC_GROUP(RCAN0, RCAN0_ERS, RCAN0_OVR, RCAN0_RM0, RCAN0_RM1,
197 RCAN0_SLE),
198 INTC_GROUP(RCAN1, RCAN1_ERS, RCAN1_OVR, RCAN1_RM0, RCAN1_RM1,
199 RCAN1_SLE),
200
201 INTC_GROUP(TMR0, TMR0_CMIA0, TMR0_CMIB0, TMR0_OVI0),
202 INTC_GROUP(TMR1, TMR1_CMIA1, TMR1_CMIB1, TMR1_OVI1),
203};
204
205static struct intc_prio_reg prio_registers[] __initdata = {
206 { 0xfffe9418, 0, 16, 4, /* IPR01 */ { IRQ0, IRQ1, IRQ2, IRQ3 } },
207 { 0xfffe941a, 0, 16, 4, /* IPR02 */ { IRQ4, IRQ5, IRQ6, IRQ7 } },
208 { 0xfffe9420, 0, 16, 4, /* IPR05 */ { PINT, 0, ADC_ADI, 0 } },
209 { 0xfffe9800, 0, 16, 4, /* IPR06 */ { 0, MTU20_ABCD, MTU20_VEF, MTU21_AB } },
210 { 0xfffe9802, 0, 16, 4, /* IPR07 */ { MTU21_VU, MTU22_AB, MTU22_VU, MTU23_ABCD } },
211 { 0xfffe9804, 0, 16, 4, /* IPR08 */ { MTU2_TCI3V, MTU24_ABCD, MTU2_TCI4V, MTU25_UVW } },
212
213 { 0xfffe9806, 0, 16, 4, /* IPR09 */ { RTC, WDT, IIC30, 0 } },
214 { 0xfffe9808, 0, 16, 4, /* IPR10 */ { IIC31, IIC32, DMAC0_DMINT0, DMAC1_DMINT1 } },
215 { 0xfffe980a, 0, 16, 4, /* IPR11 */ { DMAC2_DMINT2, DMAC3_DMINT3, SCIF0 , SCIF1 } },
216 { 0xfffe980c, 0, 16, 4, /* IPR12 */ { SCIF2, SCIF3, SCIF4, SCIF5 } },
217 { 0xfffe980e, 0, 16, 4, /* IPR13 */ { SCIF6, SCIF7, DMAC0_DMINTA, DMAC4_DMINT4 } },
218 { 0xfffe9810, 0, 16, 4, /* IPR14 */ { DMAC5_DMINT5, DMAC6_DMINT6, DMAC7_DMINT7, 0 } },
219 { 0xfffe9812, 0, 16, 4, /* IPR15 */ { 0, RCAN0, RCAN1, 0 } },
220 { 0xfffe9814, 0, 16, 4, /* IPR16 */ { SSI0_SSII, SSI1_SSII, TMR0, TMR1 } },
221};
222
223static struct intc_mask_reg mask_registers[] __initdata = {
224 { 0xfffe9408, 0, 16, /* PINTER */
225 { 0, 0, 0, 0, 0, 0, 0, 0,
226 PINT7, PINT6, PINT5, PINT4, PINT3, PINT2, PINT1, PINT0 } },
227};
228
229static DECLARE_INTC_DESC(intc_desc, "sh7201", vectors, groups,
230 mask_registers, prio_registers, NULL);
231
232static struct plat_sci_port sci_platform_data[] = {
233 {
234 .mapbase = 0xfffe8000,
235 .flags = UPF_BOOT_AUTOCONF,
236 .type = PORT_SCIF,
237 .irqs = { 181, 182, 183, 180}
238 }, {
239 .mapbase = 0xfffe8800,
240 .flags = UPF_BOOT_AUTOCONF,
241 .type = PORT_SCIF,
242 .irqs = { 185, 186, 187, 184}
243 }, {
244 .mapbase = 0xfffe9000,
245 .flags = UPF_BOOT_AUTOCONF,
246 .type = PORT_SCIF,
247 .irqs = { 189, 186, 187, 188}
248 }, {
249 .mapbase = 0xfffe9800,
250 .flags = UPF_BOOT_AUTOCONF,
251 .type = PORT_SCIF,
252 .irqs = { 193, 194, 195, 192}
253 }, {
254 .mapbase = 0xfffea000,
255 .flags = UPF_BOOT_AUTOCONF,
256 .type = PORT_SCIF,
257 .irqs = { 196, 198, 199, 196}
258 }, {
259 .mapbase = 0xfffea800,
260 .flags = UPF_BOOT_AUTOCONF,
261 .type = PORT_SCIF,
262 .irqs = { 201, 202, 203, 200}
263 }, {
264 .mapbase = 0xfffeb000,
265 .flags = UPF_BOOT_AUTOCONF,
266 .type = PORT_SCIF,
267 .irqs = { 205, 206, 207, 204}
268 }, {
269 .mapbase = 0xfffeb800,
270 .flags = UPF_BOOT_AUTOCONF,
271 .type = PORT_SCIF,
272 .irqs = { 209, 210, 211, 208}
273 }, {
274 .flags = 0,
275 }
276};
277
278static struct platform_device sci_device = {
279 .name = "sh-sci",
280 .id = -1,
281 .dev = {
282 .platform_data = sci_platform_data,
283 },
284};
285
286static struct resource rtc_resources[] = {
287 [0] = {
288 .start = 0xffff0800,
289 .end = 0xffff2000 + 0x58 - 1,
290 .flags = IORESOURCE_IO,
291 },
292 [1] = {
293 /* Period IRQ */
294 .start = 153,
295 .flags = IORESOURCE_IRQ,
296 },
297 [2] = {
298 /* Carry IRQ */
299 .start = 154,
300 .flags = IORESOURCE_IRQ,
301 },
302 [3] = {
303 /* Alarm IRQ */
304 .start = 152,
305 .flags = IORESOURCE_IRQ,
306 },
307};
308
309static struct platform_device rtc_device = {
310 .name = "sh-rtc",
311 .id = -1,
312 .num_resources = ARRAY_SIZE(rtc_resources),
313 .resource = rtc_resources,
314};
315
316static struct platform_device *sh7201_devices[] __initdata = {
317 &sci_device,
318 &rtc_device,
319};
320
321static int __init sh7201_devices_setup(void)
322{
323 return platform_add_devices(sh7201_devices,
324 ARRAY_SIZE(sh7201_devices));
325}
326__initcall(sh7201_devices_setup);
327
328void __init plat_irq_setup(void)
329{
330 register_intc_controller(&intc_desc);
331}
diff --git a/arch/sh/kernel/cpu/sh3/entry.S b/arch/sh/kernel/cpu/sh3/entry.S
index 3fe482dd05c1..b4106d0c68ec 100644
--- a/arch/sh/kernel/cpu/sh3/entry.S
+++ b/arch/sh/kernel/cpu/sh3/entry.S
@@ -52,7 +52,7 @@
52 * syscall # 52 * syscall #
53 * 53 *
54 */ 54 */
55#if defined(CONFIG_KGDB_NMI) 55#if defined(CONFIG_KGDB)
56NMI_VEC = 0x1c0 ! Must catch early for debounce 56NMI_VEC = 0x1c0 ! Must catch early for debounce
57#endif 57#endif
58 58
@@ -307,7 +307,7 @@ skip_restore:
3076: or k0, k2 ! Set the IMASK-bits 3076: or k0, k2 ! Set the IMASK-bits
308 ldc k2, ssr 308 ldc k2, ssr
309 ! 309 !
310#if defined(CONFIG_KGDB_NMI) 310#if defined(CONFIG_KGDB)
311 ! Clear in_nmi 311 ! Clear in_nmi
312 mov.l 6f, k0 312 mov.l 6f, k0
313 mov #0, k1 313 mov #0, k1
@@ -320,7 +320,7 @@ skip_restore:
320 320
321 .align 2 321 .align 2
3225: .long 0x00001000 ! DSP 3225: .long 0x00001000 ! DSP
323#ifdef CONFIG_KGDB_NMI 323#ifdef CONFIG_KGDB
3246: .long in_nmi 3246: .long in_nmi
325#endif 325#endif
3267: .long 0x30000000 3267: .long 0x30000000
@@ -376,9 +376,9 @@ tlb_miss:
376! 376!
377 .balign 512,0,512 377 .balign 512,0,512
378interrupt: 378interrupt:
379 mov.l 2f, k2
380 mov.l 3f, k3 379 mov.l 3f, k3
381#if defined(CONFIG_KGDB_NMI) 380#if defined(CONFIG_KGDB)
381 mov.l 2f, k2
382 ! Debounce (filter nested NMI) 382 ! Debounce (filter nested NMI)
383 mov.l @k2, k0 383 mov.l @k2, k0
384 mov.l 5f, k1 384 mov.l 5f, k1
@@ -390,16 +390,16 @@ interrupt:
390 rte 390 rte
391 nop 391 nop
392 .align 2 392 .align 2
3932: .long INTEVT
3935: .long NMI_VEC 3945: .long NMI_VEC
3946: .long in_nmi 3956: .long in_nmi
3950: 3960:
396#endif /* defined(CONFIG_KGDB_NMI) */ 397#endif /* defined(CONFIG_KGDB) */
397 bra handle_exception 398 bra handle_exception
398 mov #-1, k2 ! interrupt exception marker 399 mov #-1, k2 ! interrupt exception marker
399 400
400 .align 2 401 .align 2
4011: .long EXPEVT 4021: .long EXPEVT
4022: .long INTEVT
4033: .long ret_from_irq 4033: .long ret_from_irq
4044: .long ret_from_exception 4044: .long ret_from_exception
405 405
diff --git a/arch/sh/kernel/cpu/sh3/ex.S b/arch/sh/kernel/cpu/sh3/ex.S
index dac429726899..e5a0de39a2db 100644
--- a/arch/sh/kernel/cpu/sh3/ex.S
+++ b/arch/sh/kernel/cpu/sh3/ex.S
@@ -26,7 +26,7 @@
26#define fpu_error_trap_handler exception_error 26#define fpu_error_trap_handler exception_error
27#endif 27#endif
28 28
29#if !defined(CONFIG_KGDB_NMI) 29#if !defined(CONFIG_KGDB)
30#define kgdb_handle_exception exception_error 30#define kgdb_handle_exception exception_error
31#endif 31#endif
32 32
diff --git a/arch/sh/kernel/cpu/sh4/softfloat.c b/arch/sh/kernel/cpu/sh4/softfloat.c
index 2b747f3b02bd..42edf2e54e85 100644
--- a/arch/sh/kernel/cpu/sh4/softfloat.c
+++ b/arch/sh/kernel/cpu/sh4/softfloat.c
@@ -37,6 +37,7 @@
37 */ 37 */
38#include <linux/kernel.h> 38#include <linux/kernel.h>
39#include <cpu/fpu.h> 39#include <cpu/fpu.h>
40#include <asm/div64.h>
40 41
41#define LIT64( a ) a##LL 42#define LIT64( a ) a##LL
42 43
@@ -67,16 +68,16 @@ typedef unsigned long long float64;
67extern void float_raise(unsigned int flags); /* in fpu.c */ 68extern void float_raise(unsigned int flags); /* in fpu.c */
68extern int float_rounding_mode(void); /* in fpu.c */ 69extern int float_rounding_mode(void); /* in fpu.c */
69 70
70inline bits64 extractFloat64Frac(float64 a); 71bits64 extractFloat64Frac(float64 a);
71inline flag extractFloat64Sign(float64 a); 72flag extractFloat64Sign(float64 a);
72inline int16 extractFloat64Exp(float64 a); 73int16 extractFloat64Exp(float64 a);
73inline int16 extractFloat32Exp(float32 a); 74int16 extractFloat32Exp(float32 a);
74inline flag extractFloat32Sign(float32 a); 75flag extractFloat32Sign(float32 a);
75inline bits32 extractFloat32Frac(float32 a); 76bits32 extractFloat32Frac(float32 a);
76inline float64 packFloat64(flag zSign, int16 zExp, bits64 zSig); 77float64 packFloat64(flag zSign, int16 zExp, bits64 zSig);
77inline void shift64RightJamming(bits64 a, int16 count, bits64 * zPtr); 78void shift64RightJamming(bits64 a, int16 count, bits64 * zPtr);
78inline float32 packFloat32(flag zSign, int16 zExp, bits32 zSig); 79float32 packFloat32(flag zSign, int16 zExp, bits32 zSig);
79inline void shift32RightJamming(bits32 a, int16 count, bits32 * zPtr); 80void shift32RightJamming(bits32 a, int16 count, bits32 * zPtr);
80float64 float64_sub(float64 a, float64 b); 81float64 float64_sub(float64 a, float64 b);
81float32 float32_sub(float32 a, float32 b); 82float32 float32_sub(float32 a, float32 b);
82float32 float32_add(float32 a, float32 b); 83float32 float32_add(float32 a, float32 b);
@@ -86,11 +87,11 @@ float32 float32_div(float32 a, float32 b);
86float32 float32_mul(float32 a, float32 b); 87float32 float32_mul(float32 a, float32 b);
87float64 float64_mul(float64 a, float64 b); 88float64 float64_mul(float64 a, float64 b);
88float32 float64_to_float32(float64 a); 89float32 float64_to_float32(float64 a);
89inline void add128(bits64 a0, bits64 a1, bits64 b0, bits64 b1, bits64 * z0Ptr, 90void add128(bits64 a0, bits64 a1, bits64 b0, bits64 b1, bits64 * z0Ptr,
90 bits64 * z1Ptr); 91 bits64 * z1Ptr);
91inline void sub128(bits64 a0, bits64 a1, bits64 b0, bits64 b1, bits64 * z0Ptr, 92void sub128(bits64 a0, bits64 a1, bits64 b0, bits64 b1, bits64 * z0Ptr,
92 bits64 * z1Ptr); 93 bits64 * z1Ptr);
93inline void mul64To128(bits64 a, bits64 b, bits64 * z0Ptr, bits64 * z1Ptr); 94void mul64To128(bits64 a, bits64 b, bits64 * z0Ptr, bits64 * z1Ptr);
94 95
95static int8 countLeadingZeros32(bits32 a); 96static int8 countLeadingZeros32(bits32 a);
96static int8 countLeadingZeros64(bits64 a); 97static int8 countLeadingZeros64(bits64 a);
@@ -110,42 +111,42 @@ static bits64 estimateDiv128To64(bits64 a0, bits64 a1, bits64 b);
110static void normalizeFloat32Subnormal(bits32 aSig, int16 * zExpPtr, 111static void normalizeFloat32Subnormal(bits32 aSig, int16 * zExpPtr,
111 bits32 * zSigPtr); 112 bits32 * zSigPtr);
112 113
113inline bits64 extractFloat64Frac(float64 a) 114bits64 extractFloat64Frac(float64 a)
114{ 115{
115 return a & LIT64(0x000FFFFFFFFFFFFF); 116 return a & LIT64(0x000FFFFFFFFFFFFF);
116} 117}
117 118
118inline flag extractFloat64Sign(float64 a) 119flag extractFloat64Sign(float64 a)
119{ 120{
120 return a >> 63; 121 return a >> 63;
121} 122}
122 123
123inline int16 extractFloat64Exp(float64 a) 124int16 extractFloat64Exp(float64 a)
124{ 125{
125 return (a >> 52) & 0x7FF; 126 return (a >> 52) & 0x7FF;
126} 127}
127 128
128inline int16 extractFloat32Exp(float32 a) 129int16 extractFloat32Exp(float32 a)
129{ 130{
130 return (a >> 23) & 0xFF; 131 return (a >> 23) & 0xFF;
131} 132}
132 133
133inline flag extractFloat32Sign(float32 a) 134flag extractFloat32Sign(float32 a)
134{ 135{
135 return a >> 31; 136 return a >> 31;
136} 137}
137 138
138inline bits32 extractFloat32Frac(float32 a) 139bits32 extractFloat32Frac(float32 a)
139{ 140{
140 return a & 0x007FFFFF; 141 return a & 0x007FFFFF;
141} 142}
142 143
143inline float64 packFloat64(flag zSign, int16 zExp, bits64 zSig) 144float64 packFloat64(flag zSign, int16 zExp, bits64 zSig)
144{ 145{
145 return (((bits64) zSign) << 63) + (((bits64) zExp) << 52) + zSig; 146 return (((bits64) zSign) << 63) + (((bits64) zExp) << 52) + zSig;
146} 147}
147 148
148inline void shift64RightJamming(bits64 a, int16 count, bits64 * zPtr) 149void shift64RightJamming(bits64 a, int16 count, bits64 * zPtr)
149{ 150{
150 bits64 z; 151 bits64 z;
151 152
@@ -338,12 +339,12 @@ static float64 addFloat64Sigs(float64 a, float64 b, flag zSign)
338 339
339} 340}
340 341
341inline float32 packFloat32(flag zSign, int16 zExp, bits32 zSig) 342float32 packFloat32(flag zSign, int16 zExp, bits32 zSig)
342{ 343{
343 return (((bits32) zSign) << 31) + (((bits32) zExp) << 23) + zSig; 344 return (((bits32) zSign) << 31) + (((bits32) zExp) << 23) + zSig;
344} 345}
345 346
346inline void shift32RightJamming(bits32 a, int16 count, bits32 * zPtr) 347void shift32RightJamming(bits32 a, int16 count, bits32 * zPtr)
347{ 348{
348 bits32 z; 349 bits32 z;
349 if (count == 0) { 350 if (count == 0) {
@@ -634,7 +635,7 @@ normalizeFloat64Subnormal(bits64 aSig, int16 * zExpPtr, bits64 * zSigPtr)
634 *zExpPtr = 1 - shiftCount; 635 *zExpPtr = 1 - shiftCount;
635} 636}
636 637
637inline void add128(bits64 a0, bits64 a1, bits64 b0, bits64 b1, bits64 * z0Ptr, 638void add128(bits64 a0, bits64 a1, bits64 b0, bits64 b1, bits64 * z0Ptr,
638 bits64 * z1Ptr) 639 bits64 * z1Ptr)
639{ 640{
640 bits64 z1; 641 bits64 z1;
@@ -644,7 +645,7 @@ inline void add128(bits64 a0, bits64 a1, bits64 b0, bits64 b1, bits64 * z0Ptr,
644 *z0Ptr = a0 + b0 + (z1 < a1); 645 *z0Ptr = a0 + b0 + (z1 < a1);
645} 646}
646 647
647inline void 648void
648sub128(bits64 a0, bits64 a1, bits64 b0, bits64 b1, bits64 * z0Ptr, 649sub128(bits64 a0, bits64 a1, bits64 b0, bits64 b1, bits64 * z0Ptr,
649 bits64 * z1Ptr) 650 bits64 * z1Ptr)
650{ 651{
@@ -656,11 +657,14 @@ static bits64 estimateDiv128To64(bits64 a0, bits64 a1, bits64 b)
656{ 657{
657 bits64 b0, b1; 658 bits64 b0, b1;
658 bits64 rem0, rem1, term0, term1; 659 bits64 rem0, rem1, term0, term1;
659 bits64 z; 660 bits64 z, tmp;
660 if (b <= a0) 661 if (b <= a0)
661 return LIT64(0xFFFFFFFFFFFFFFFF); 662 return LIT64(0xFFFFFFFFFFFFFFFF);
662 b0 = b >> 32; 663 b0 = b >> 32;
663 z = (b0 << 32 <= a0) ? LIT64(0xFFFFFFFF00000000) : (a0 / b0) << 32; 664 tmp = a0;
665 do_div(tmp, b0);
666
667 z = (b0 << 32 <= a0) ? LIT64(0xFFFFFFFF00000000) : tmp << 32;
664 mul64To128(b, z, &term0, &term1); 668 mul64To128(b, z, &term0, &term1);
665 sub128(a0, a1, term0, term1, &rem0, &rem1); 669 sub128(a0, a1, term0, term1, &rem0, &rem1);
666 while (((sbits64) rem0) < 0) { 670 while (((sbits64) rem0) < 0) {
@@ -669,11 +673,13 @@ static bits64 estimateDiv128To64(bits64 a0, bits64 a1, bits64 b)
669 add128(rem0, rem1, b0, b1, &rem0, &rem1); 673 add128(rem0, rem1, b0, b1, &rem0, &rem1);
670 } 674 }
671 rem0 = (rem0 << 32) | (rem1 >> 32); 675 rem0 = (rem0 << 32) | (rem1 >> 32);
672 z |= (b0 << 32 <= rem0) ? 0xFFFFFFFF : rem0 / b0; 676 tmp = rem0;
677 do_div(tmp, b0);
678 z |= (b0 << 32 <= rem0) ? 0xFFFFFFFF : tmp;
673 return z; 679 return z;
674} 680}
675 681
676inline void mul64To128(bits64 a, bits64 b, bits64 * z0Ptr, bits64 * z1Ptr) 682void mul64To128(bits64 a, bits64 b, bits64 * z0Ptr, bits64 * z1Ptr)
677{ 683{
678 bits32 aHigh, aLow, bHigh, bLow; 684 bits32 aHigh, aLow, bHigh, bLow;
679 bits64 z0, zMiddleA, zMiddleB, z1; 685 bits64 z0, zMiddleA, zMiddleB, z1;
@@ -769,7 +775,8 @@ float32 float32_div(float32 a, float32 b)
769{ 775{
770 flag aSign, bSign, zSign; 776 flag aSign, bSign, zSign;
771 int16 aExp, bExp, zExp; 777 int16 aExp, bExp, zExp;
772 bits32 aSig, bSig, zSig; 778 bits32 aSig, bSig;
779 uint64_t zSig;
773 780
774 aSig = extractFloat32Frac(a); 781 aSig = extractFloat32Frac(a);
775 aExp = extractFloat32Exp(a); 782 aExp = extractFloat32Exp(a);
@@ -804,11 +811,13 @@ float32 float32_div(float32 a, float32 b)
804 aSig >>= 1; 811 aSig >>= 1;
805 ++zExp; 812 ++zExp;
806 } 813 }
807 zSig = (((bits64) aSig) << 32) / bSig; 814 zSig = (((bits64) aSig) << 32);
815 do_div(zSig, bSig);
816
808 if ((zSig & 0x3F) == 0) { 817 if ((zSig & 0x3F) == 0) {
809 zSig |= (((bits64) bSig) * zSig != ((bits64) aSig) << 32); 818 zSig |= (((bits64) bSig) * zSig != ((bits64) aSig) << 32);
810 } 819 }
811 return roundAndPackFloat32(zSign, zExp, zSig); 820 return roundAndPackFloat32(zSign, zExp, (bits32)zSig);
812 821
813} 822}
814 823
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
index db913855c2fd..0e174af21874 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
@@ -229,7 +229,7 @@ struct frqcr_context sh7722_get_clk_context(const char *name)
229} 229}
230 230
231/** 231/**
232 * sh7722_find_divisors - find divisor for setting rate 232 * sh7722_find_div_index - find divisor for setting rate
233 * 233 *
234 * All sh7722 clocks use the same set of multipliers/divisors. This function 234 * All sh7722 clocks use the same set of multipliers/divisors. This function
235 * chooses correct divisor to set the rate of clock with parent clock that 235 * chooses correct divisor to set the rate of clock with parent clock that
@@ -238,7 +238,7 @@ struct frqcr_context sh7722_get_clk_context(const char *name)
238 * @parent_rate: rate of parent clock 238 * @parent_rate: rate of parent clock
239 * @rate: requested rate to be set 239 * @rate: requested rate to be set
240 */ 240 */
241static int sh7722_find_divisors(unsigned long parent_rate, unsigned rate) 241static int sh7722_find_div_index(unsigned long parent_rate, unsigned rate)
242{ 242{
243 unsigned div2 = parent_rate * 2 / rate; 243 unsigned div2 = parent_rate * 2 / rate;
244 int index; 244 int index;
@@ -247,12 +247,12 @@ static int sh7722_find_divisors(unsigned long parent_rate, unsigned rate)
247 return -EINVAL; 247 return -EINVAL;
248 248
249 for (index = 1; index < ARRAY_SIZE(divisors2); index++) { 249 for (index = 1; index < ARRAY_SIZE(divisors2); index++) {
250 if (div2 > divisors2[index] && div2 <= divisors2[index]) 250 if (div2 > divisors2[index - 1] && div2 <= divisors2[index])
251 break; 251 break;
252 } 252 }
253 if (index >= ARRAY_SIZE(divisors2)) 253 if (index >= ARRAY_SIZE(divisors2))
254 index = ARRAY_SIZE(divisors2) - 1; 254 index = ARRAY_SIZE(divisors2) - 1;
255 return divisors2[index]; 255 return index;
256} 256}
257 257
258static void sh7722_frqcr_recalc(struct clk *clk) 258static void sh7722_frqcr_recalc(struct clk *clk)
@@ -279,12 +279,12 @@ static int sh7722_frqcr_set_rate(struct clk *clk, unsigned long rate,
279 return -EINVAL; 279 return -EINVAL;
280 280
281 /* look for multiplier/divisor pair */ 281 /* look for multiplier/divisor pair */
282 div = sh7722_find_divisors(parent_rate, rate); 282 div = sh7722_find_div_index(parent_rate, rate);
283 if (div<0) 283 if (div<0)
284 return div; 284 return div;
285 285
286 /* calculate new value of clock rate */ 286 /* calculate new value of clock rate */
287 clk->rate = parent_rate * 2 / div; 287 clk->rate = parent_rate * 2 / divisors2[div];
288 frqcr = ctrl_inl(FRQCR); 288 frqcr = ctrl_inl(FRQCR);
289 289
290 /* FIXME: adjust as algo_id specifies */ 290 /* FIXME: adjust as algo_id specifies */
@@ -353,7 +353,7 @@ static int sh7722_frqcr_set_rate(struct clk *clk, unsigned long rate,
353 int part_div; 353 int part_div;
354 354
355 if (likely(!err)) { 355 if (likely(!err)) {
356 part_div = sh7722_find_divisors(parent_rate, 356 part_div = sh7722_find_div_index(parent_rate,
357 rate); 357 rate);
358 if (part_div > 0) { 358 if (part_div > 0) {
359 part_ctx = sh7722_get_clk_context( 359 part_ctx = sh7722_get_clk_context(
@@ -394,12 +394,12 @@ static long sh7722_frqcr_round_rate(struct clk *clk, unsigned long rate)
394 int div; 394 int div;
395 395
396 /* look for multiplier/divisor pair */ 396 /* look for multiplier/divisor pair */
397 div = sh7722_find_divisors(parent_rate, rate); 397 div = sh7722_find_div_index(parent_rate, rate);
398 if (div < 0) 398 if (div < 0)
399 return clk->rate; 399 return clk->rate;
400 400
401 /* calculate new value of clock rate */ 401 /* calculate new value of clock rate */
402 return parent_rate * 2 / div; 402 return parent_rate * 2 / divisors2[div];
403} 403}
404 404
405static struct clk_ops sh7722_frqcr_clk_ops = { 405static struct clk_ops sh7722_frqcr_clk_ops = {
@@ -421,7 +421,7 @@ static int sh7722_siu_set_rate(struct clk *clk, unsigned long rate, int algo_id)
421 int div; 421 int div;
422 422
423 r = ctrl_inl(clk->arch_flags); 423 r = ctrl_inl(clk->arch_flags);
424 div = sh7722_find_divisors(clk->parent->rate, rate); 424 div = sh7722_find_div_index(clk->parent->rate, rate);
425 if (div < 0) 425 if (div < 0)
426 return div; 426 return div;
427 r = (r & ~0xF) | div; 427 r = (r & ~0xF) | div;
@@ -516,16 +516,19 @@ static struct clk_ops sh7722_video_clk_ops = {
516static struct clk sh7722_umem_clock = { 516static struct clk sh7722_umem_clock = {
517 .name = "umem_clk", 517 .name = "umem_clk",
518 .ops = &sh7722_frqcr_clk_ops, 518 .ops = &sh7722_frqcr_clk_ops,
519 .flags = CLK_RATE_PROPAGATES,
519}; 520};
520 521
521static struct clk sh7722_sh_clock = { 522static struct clk sh7722_sh_clock = {
522 .name = "sh_clk", 523 .name = "sh_clk",
523 .ops = &sh7722_frqcr_clk_ops, 524 .ops = &sh7722_frqcr_clk_ops,
525 .flags = CLK_RATE_PROPAGATES,
524}; 526};
525 527
526static struct clk sh7722_peripheral_clock = { 528static struct clk sh7722_peripheral_clock = {
527 .name = "peripheral_clk", 529 .name = "peripheral_clk",
528 .ops = &sh7722_frqcr_clk_ops, 530 .ops = &sh7722_frqcr_clk_ops,
531 .flags = CLK_RATE_PROPAGATES,
529}; 532};
530 533
531static struct clk sh7722_sdram_clock = { 534static struct clk sh7722_sdram_clock = {
@@ -533,6 +536,11 @@ static struct clk sh7722_sdram_clock = {
533 .ops = &sh7722_frqcr_clk_ops, 536 .ops = &sh7722_frqcr_clk_ops,
534}; 537};
535 538
539static struct clk sh7722_r_clock = {
540 .name = "r_clk",
541 .rate = 32768,
542 .flags = CLK_RATE_PROPAGATES,
543};
536 544
537#ifndef CONFIG_CPU_SUBTYPE_SH7343 545#ifndef CONFIG_CPU_SUBTYPE_SH7343
538 546
@@ -567,12 +575,30 @@ static struct clk sh7722_video_clock = {
567 .ops = &sh7722_video_clk_ops, 575 .ops = &sh7722_video_clk_ops,
568}; 576};
569 577
570static int sh7722_mstpcr_start_stop(struct clk *clk, unsigned long reg, 578#define MSTPCR_ARCH_FLAGS(reg, bit) (((reg) << 8) | (bit))
571 int enable) 579#define MSTPCR_ARCH_FLAGS_REG(value) ((value) >> 8)
580#define MSTPCR_ARCH_FLAGS_BIT(value) ((value) & 0xff)
581
582static int sh7722_mstpcr_start_stop(struct clk *clk, int enable)
572{ 583{
573 unsigned long bit = clk->arch_flags; 584 unsigned long bit = MSTPCR_ARCH_FLAGS_BIT(clk->arch_flags);
585 unsigned long reg;
574 unsigned long r; 586 unsigned long r;
575 587
588 switch(MSTPCR_ARCH_FLAGS_REG(clk->arch_flags)) {
589 case 0:
590 reg = MSTPCR0;
591 break;
592 case 1:
593 reg = MSTPCR1;
594 break;
595 case 2:
596 reg = MSTPCR2;
597 break;
598 default:
599 return -EINVAL;
600 }
601
576 r = ctrl_inl(reg); 602 r = ctrl_inl(reg);
577 603
578 if (enable) 604 if (enable)
@@ -584,96 +610,175 @@ static int sh7722_mstpcr_start_stop(struct clk *clk, unsigned long reg,
584 return 0; 610 return 0;
585} 611}
586 612
587static void sh7722_mstpcr0_enable(struct clk *clk) 613static void sh7722_mstpcr_enable(struct clk *clk)
588{
589 sh7722_mstpcr_start_stop(clk, MSTPCR0, 1);
590}
591
592static void sh7722_mstpcr0_disable(struct clk *clk)
593{
594 sh7722_mstpcr_start_stop(clk, MSTPCR0, 0);
595}
596
597static void sh7722_mstpcr1_enable(struct clk *clk)
598{
599 sh7722_mstpcr_start_stop(clk, MSTPCR1, 1);
600}
601
602static void sh7722_mstpcr1_disable(struct clk *clk)
603{ 614{
604 sh7722_mstpcr_start_stop(clk, MSTPCR1, 0); 615 sh7722_mstpcr_start_stop(clk, 1);
605} 616}
606 617
607static void sh7722_mstpcr2_enable(struct clk *clk) 618static void sh7722_mstpcr_disable(struct clk *clk)
608{ 619{
609 sh7722_mstpcr_start_stop(clk, MSTPCR2, 1); 620 sh7722_mstpcr_start_stop(clk, 0);
610} 621}
611 622
612static void sh7722_mstpcr2_disable(struct clk *clk) 623static void sh7722_mstpcr_recalc(struct clk *clk)
613{ 624{
614 sh7722_mstpcr_start_stop(clk, MSTPCR2, 0); 625 if (clk->parent)
626 clk->rate = clk->parent->rate;
615} 627}
616 628
617static struct clk_ops sh7722_mstpcr0_clk_ops = { 629static struct clk_ops sh7722_mstpcr_clk_ops = {
618 .enable = sh7722_mstpcr0_enable, 630 .enable = sh7722_mstpcr_enable,
619 .disable = sh7722_mstpcr0_disable, 631 .disable = sh7722_mstpcr_disable,
620}; 632 .recalc = sh7722_mstpcr_recalc,
621
622static struct clk_ops sh7722_mstpcr1_clk_ops = {
623 .enable = sh7722_mstpcr1_enable,
624 .disable = sh7722_mstpcr1_disable,
625}; 633};
626 634
627static struct clk_ops sh7722_mstpcr2_clk_ops = { 635#define MSTPCR(_name, _parent, regnr, bitnr) \
628 .enable = sh7722_mstpcr2_enable, 636{ \
629 .disable = sh7722_mstpcr2_disable, 637 .name = _name, \
630}; 638 .arch_flags = MSTPCR_ARCH_FLAGS(regnr, bitnr), \
631 639 .ops = (void *)_parent, \
632#define DECLARE_MSTPCRN(regnr, bitnr, bitstr) \
633{ \
634 .name = "mstp" __stringify(regnr) bitstr, \
635 .arch_flags = bitnr, \
636 .ops = &sh7722_mstpcr ## regnr ## _clk_ops, \
637} 640}
638 641
639#define DECLARE_MSTPCR(regnr) \ 642static struct clk sh7722_mstpcr_clocks[] = {
640 DECLARE_MSTPCRN(regnr, 31, "31"), \ 643#if defined(CONFIG_CPU_SUBTYPE_SH7722)
641 DECLARE_MSTPCRN(regnr, 30, "30"), \ 644 MSTPCR("uram0", "umem_clk", 0, 28),
642 DECLARE_MSTPCRN(regnr, 29, "29"), \ 645 MSTPCR("xymem0", "bus_clk", 0, 26),
643 DECLARE_MSTPCRN(regnr, 28, "28"), \ 646 MSTPCR("tmu0", "peripheral_clk", 0, 15),
644 DECLARE_MSTPCRN(regnr, 27, "27"), \ 647 MSTPCR("cmt0", "r_clk", 0, 14),
645 DECLARE_MSTPCRN(regnr, 26, "26"), \ 648 MSTPCR("rwdt0", "r_clk", 0, 13),
646 DECLARE_MSTPCRN(regnr, 25, "25"), \ 649 MSTPCR("flctl0", "peripheral_clk", 0, 10),
647 DECLARE_MSTPCRN(regnr, 24, "24"), \ 650 MSTPCR("scif0", "peripheral_clk", 0, 7),
648 DECLARE_MSTPCRN(regnr, 23, "23"), \ 651 MSTPCR("scif1", "peripheral_clk", 0, 6),
649 DECLARE_MSTPCRN(regnr, 22, "22"), \ 652 MSTPCR("scif2", "peripheral_clk", 0, 5),
650 DECLARE_MSTPCRN(regnr, 21, "21"), \ 653 MSTPCR("i2c0", "peripheral_clk", 1, 9),
651 DECLARE_MSTPCRN(regnr, 20, "20"), \ 654 MSTPCR("rtc0", "r_clk", 1, 8),
652 DECLARE_MSTPCRN(regnr, 19, "19"), \ 655 MSTPCR("sdhi0", "peripheral_clk", 2, 18),
653 DECLARE_MSTPCRN(regnr, 18, "18"), \ 656 MSTPCR("keysc0", "r_clk", 2, 14),
654 DECLARE_MSTPCRN(regnr, 17, "17"), \ 657 MSTPCR("usbf0", "peripheral_clk", 2, 11),
655 DECLARE_MSTPCRN(regnr, 16, "16"), \ 658 MSTPCR("2dg0", "bus_clk", 2, 9),
656 DECLARE_MSTPCRN(regnr, 15, "15"), \ 659 MSTPCR("siu0", "bus_clk", 2, 8),
657 DECLARE_MSTPCRN(regnr, 14, "14"), \ 660 MSTPCR("vou0", "bus_clk", 2, 5),
658 DECLARE_MSTPCRN(regnr, 13, "13"), \ 661 MSTPCR("jpu0", "bus_clk", 2, 6),
659 DECLARE_MSTPCRN(regnr, 12, "12"), \ 662 MSTPCR("beu0", "bus_clk", 2, 4),
660 DECLARE_MSTPCRN(regnr, 11, "11"), \ 663 MSTPCR("ceu0", "bus_clk", 2, 3),
661 DECLARE_MSTPCRN(regnr, 10, "10"), \ 664 MSTPCR("veu0", "bus_clk", 2, 2),
662 DECLARE_MSTPCRN(regnr, 9, "09"), \ 665 MSTPCR("vpu0", "bus_clk", 2, 1),
663 DECLARE_MSTPCRN(regnr, 8, "08"), \ 666 MSTPCR("lcdc0", "bus_clk", 2, 0),
664 DECLARE_MSTPCRN(regnr, 7, "07"), \ 667#endif
665 DECLARE_MSTPCRN(regnr, 6, "06"), \ 668#if defined(CONFIG_CPU_SUBTYPE_SH7723)
666 DECLARE_MSTPCRN(regnr, 5, "05"), \ 669 /* See page 60 of Datasheet V1.0: Overview -> Block Diagram */
667 DECLARE_MSTPCRN(regnr, 4, "04"), \ 670 MSTPCR("tlb0", "cpu_clk", 0, 31),
668 DECLARE_MSTPCRN(regnr, 3, "03"), \ 671 MSTPCR("ic0", "cpu_clk", 0, 30),
669 DECLARE_MSTPCRN(regnr, 2, "02"), \ 672 MSTPCR("oc0", "cpu_clk", 0, 29),
670 DECLARE_MSTPCRN(regnr, 1, "01"), \ 673 MSTPCR("l2c0", "sh_clk", 0, 28),
671 DECLARE_MSTPCRN(regnr, 0, "00") 674 MSTPCR("ilmem0", "cpu_clk", 0, 27),
672 675 MSTPCR("fpu0", "cpu_clk", 0, 24),
673static struct clk sh7722_mstpcr[] = { 676 MSTPCR("intc0", "cpu_clk", 0, 22),
674 DECLARE_MSTPCR(0), 677 MSTPCR("dmac0", "bus_clk", 0, 21),
675 DECLARE_MSTPCR(1), 678 MSTPCR("sh0", "sh_clk", 0, 20),
676 DECLARE_MSTPCR(2), 679 MSTPCR("hudi0", "peripheral_clk", 0, 19),
680 MSTPCR("ubc0", "cpu_clk", 0, 17),
681 MSTPCR("tmu0", "peripheral_clk", 0, 15),
682 MSTPCR("cmt0", "r_clk", 0, 14),
683 MSTPCR("rwdt0", "r_clk", 0, 13),
684 MSTPCR("dmac1", "bus_clk", 0, 12),
685 MSTPCR("tmu1", "peripheral_clk", 0, 11),
686 MSTPCR("flctl0", "peripheral_clk", 0, 10),
687 MSTPCR("scif0", "peripheral_clk", 0, 9),
688 MSTPCR("scif1", "peripheral_clk", 0, 8),
689 MSTPCR("scif2", "peripheral_clk", 0, 7),
690 MSTPCR("scif3", "bus_clk", 0, 6),
691 MSTPCR("scif4", "bus_clk", 0, 5),
692 MSTPCR("scif5", "bus_clk", 0, 4),
693 MSTPCR("msiof0", "bus_clk", 0, 2),
694 MSTPCR("msiof1", "bus_clk", 0, 1),
695 MSTPCR("meram0", "sh_clk", 0, 0),
696 MSTPCR("i2c0", "peripheral_clk", 1, 9),
697 MSTPCR("rtc0", "r_clk", 1, 8),
698 MSTPCR("atapi0", "sh_clk", 2, 28),
699 MSTPCR("adc0", "peripheral_clk", 2, 28),
700 MSTPCR("tpu0", "bus_clk", 2, 25),
701 MSTPCR("irda0", "peripheral_clk", 2, 24),
702 MSTPCR("tsif0", "bus_clk", 2, 22),
703 MSTPCR("icb0", "bus_clk", 2, 21),
704 MSTPCR("sdhi0", "bus_clk", 2, 18),
705 MSTPCR("sdhi1", "bus_clk", 2, 17),
706 MSTPCR("keysc0", "r_clk", 2, 14),
707 MSTPCR("usb0", "bus_clk", 2, 11),
708 MSTPCR("2dg0", "bus_clk", 2, 10),
709 MSTPCR("siu0", "bus_clk", 2, 8),
710 MSTPCR("veu1", "bus_clk", 2, 6),
711 MSTPCR("vou0", "bus_clk", 2, 5),
712 MSTPCR("beu0", "bus_clk", 2, 4),
713 MSTPCR("ceu0", "bus_clk", 2, 3),
714 MSTPCR("veu0", "bus_clk", 2, 2),
715 MSTPCR("vpu0", "bus_clk", 2, 1),
716 MSTPCR("lcdc0", "bus_clk", 2, 0),
717#endif
718#if defined(CONFIG_CPU_SUBTYPE_SH7343)
719 MSTPCR("uram0", "umem_clk", 0, 28),
720 MSTPCR("xymem0", "bus_clk", 0, 26),
721 MSTPCR("tmu0", "peripheral_clk", 0, 15),
722 MSTPCR("cmt0", "r_clk", 0, 14),
723 MSTPCR("rwdt0", "r_clk", 0, 13),
724 MSTPCR("scif0", "peripheral_clk", 0, 7),
725 MSTPCR("scif1", "peripheral_clk", 0, 6),
726 MSTPCR("scif2", "peripheral_clk", 0, 5),
727 MSTPCR("scif3", "peripheral_clk", 0, 4),
728 MSTPCR("i2c0", "peripheral_clk", 1, 9),
729 MSTPCR("i2c1", "peripheral_clk", 1, 8),
730 MSTPCR("sdhi0", "peripheral_clk", 2, 18),
731 MSTPCR("keysc0", "r_clk", 2, 14),
732 MSTPCR("usbf0", "peripheral_clk", 2, 11),
733 MSTPCR("siu0", "bus_clk", 2, 8),
734 MSTPCR("jpu0", "bus_clk", 2, 6),
735 MSTPCR("vou0", "bus_clk", 2, 5),
736 MSTPCR("beu0", "bus_clk", 2, 4),
737 MSTPCR("ceu0", "bus_clk", 2, 3),
738 MSTPCR("veu0", "bus_clk", 2, 2),
739 MSTPCR("vpu0", "bus_clk", 2, 1),
740 MSTPCR("lcdc0", "bus_clk", 2, 0),
741#endif
742#if defined(CONFIG_CPU_SUBTYPE_SH7366)
743 /* See page 52 of Datasheet V0.40: Overview -> Block Diagram */
744 MSTPCR("tlb0", "cpu_clk", 0, 31),
745 MSTPCR("ic0", "cpu_clk", 0, 30),
746 MSTPCR("oc0", "cpu_clk", 0, 29),
747 MSTPCR("rsmem0", "sh_clk", 0, 28),
748 MSTPCR("xymem0", "cpu_clk", 0, 26),
749 MSTPCR("intc30", "peripheral_clk", 0, 23),
750 MSTPCR("intc0", "peripheral_clk", 0, 22),
751 MSTPCR("dmac0", "bus_clk", 0, 21),
752 MSTPCR("sh0", "sh_clk", 0, 20),
753 MSTPCR("hudi0", "peripheral_clk", 0, 19),
754 MSTPCR("ubc0", "cpu_clk", 0, 17),
755 MSTPCR("tmu0", "peripheral_clk", 0, 15),
756 MSTPCR("cmt0", "r_clk", 0, 14),
757 MSTPCR("rwdt0", "r_clk", 0, 13),
758 MSTPCR("flctl0", "peripheral_clk", 0, 10),
759 MSTPCR("scif0", "peripheral_clk", 0, 7),
760 MSTPCR("scif1", "bus_clk", 0, 6),
761 MSTPCR("scif2", "bus_clk", 0, 5),
762 MSTPCR("msiof0", "peripheral_clk", 0, 2),
763 MSTPCR("sbr0", "peripheral_clk", 0, 1),
764 MSTPCR("i2c0", "peripheral_clk", 1, 9),
765 MSTPCR("icb0", "bus_clk", 2, 27),
766 MSTPCR("meram0", "sh_clk", 2, 26),
767 MSTPCR("dacc0", "peripheral_clk", 2, 24),
768 MSTPCR("dacy0", "peripheral_clk", 2, 23),
769 MSTPCR("tsif0", "bus_clk", 2, 22),
770 MSTPCR("sdhi0", "bus_clk", 2, 18),
771 MSTPCR("mmcif0", "bus_clk", 2, 17),
772 MSTPCR("usb0", "bus_clk", 2, 11),
773 MSTPCR("siu0", "bus_clk", 2, 8),
774 MSTPCR("veu1", "bus_clk", 2, 7),
775 MSTPCR("vou0", "bus_clk", 2, 5),
776 MSTPCR("beu0", "bus_clk", 2, 4),
777 MSTPCR("ceu0", "bus_clk", 2, 3),
778 MSTPCR("veu0", "bus_clk", 2, 2),
779 MSTPCR("vpu0", "bus_clk", 2, 1),
780 MSTPCR("lcdc0", "bus_clk", 2, 0),
781#endif
677}; 782};
678 783
679static struct clk *sh7722_clocks[] = { 784static struct clk *sh7722_clocks[] = {
@@ -710,21 +815,30 @@ arch_init_clk_ops(struct clk_ops **ops, int type)
710 815
711int __init arch_clk_init(void) 816int __init arch_clk_init(void)
712{ 817{
713 struct clk *master; 818 struct clk *clk;
714 int i; 819 int i;
715 820
716 master = clk_get(NULL, "master_clk"); 821 clk = clk_get(NULL, "master_clk");
717 for (i = 0; i < ARRAY_SIZE(sh7722_clocks); i++) { 822 for (i = 0; i < ARRAY_SIZE(sh7722_clocks); i++) {
718 pr_debug( "Registering clock '%s'\n", sh7722_clocks[i]->name); 823 pr_debug( "Registering clock '%s'\n", sh7722_clocks[i]->name);
719 sh7722_clocks[i]->parent = master; 824 sh7722_clocks[i]->parent = clk;
720 clk_register(sh7722_clocks[i]); 825 clk_register(sh7722_clocks[i]);
721 } 826 }
722 clk_put(master); 827 clk_put(clk);
723 828
724 for (i = 0; i < ARRAY_SIZE(sh7722_mstpcr); i++) { 829 clk_register(&sh7722_r_clock);
725 pr_debug( "Registering mstpcr '%s'\n", sh7722_mstpcr[i].name); 830
726 clk_register(&sh7722_mstpcr[i]); 831 for (i = 0; i < ARRAY_SIZE(sh7722_mstpcr_clocks); i++) {
832 pr_debug( "Registering mstpcr clock '%s'\n",
833 sh7722_mstpcr_clocks[i].name);
834 clk = clk_get(NULL, (void *) sh7722_mstpcr_clocks[i].ops);
835 sh7722_mstpcr_clocks[i].parent = clk;
836 sh7722_mstpcr_clocks[i].ops = &sh7722_mstpcr_clk_ops;
837 clk_register(&sh7722_mstpcr_clocks[i]);
838 clk_put(clk);
727 } 839 }
728 840
841 clk_recalc_rate(&sh7722_r_clock); /* make sure rate gets propagated */
842
729 return 0; 843 return 0;
730} 844}
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
index 78881b4214da..0623e377f488 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
@@ -30,6 +30,7 @@ static struct resource iic0_resources[] = {
30 30
31static struct platform_device iic0_device = { 31static struct platform_device iic0_device = {
32 .name = "i2c-sh_mobile", 32 .name = "i2c-sh_mobile",
33 .id = 0, /* "i2c0" clock */
33 .num_resources = ARRAY_SIZE(iic0_resources), 34 .num_resources = ARRAY_SIZE(iic0_resources),
34 .resource = iic0_resources, 35 .resource = iic0_resources,
35}; 36};
@@ -50,6 +51,7 @@ static struct resource iic1_resources[] = {
50 51
51static struct platform_device iic1_device = { 52static struct platform_device iic1_device = {
52 .name = "i2c-sh_mobile", 53 .name = "i2c-sh_mobile",
54 .id = 1, /* "i2c1" clock */
53 .num_resources = ARRAY_SIZE(iic1_resources), 55 .num_resources = ARRAY_SIZE(iic1_resources),
54 .resource = iic1_resources, 56 .resource = iic1_resources,
55}; 57};
@@ -115,7 +117,22 @@ static struct plat_sci_port sci_platform_data[] = {
115 .mapbase = 0xffe00000, 117 .mapbase = 0xffe00000,
116 .flags = UPF_BOOT_AUTOCONF, 118 .flags = UPF_BOOT_AUTOCONF,
117 .type = PORT_SCIF, 119 .type = PORT_SCIF,
118 .irqs = { 80, 81, 83, 82 }, 120 .irqs = { 80, 80, 80, 80 },
121 }, {
122 .mapbase = 0xffe10000,
123 .flags = UPF_BOOT_AUTOCONF,
124 .type = PORT_SCIF,
125 .irqs = { 81, 81, 81, 81 },
126 }, {
127 .mapbase = 0xffe20000,
128 .flags = UPF_BOOT_AUTOCONF,
129 .type = PORT_SCIF,
130 .irqs = { 82, 82, 82, 82 },
131 }, {
132 .mapbase = 0xffe30000,
133 .flags = UPF_BOOT_AUTOCONF,
134 .type = PORT_SCIF,
135 .irqs = { 83, 83, 83, 83 },
119 }, { 136 }, {
120 .flags = 0, 137 .flags = 0,
121 } 138 }
@@ -139,18 +156,10 @@ static struct platform_device *sh7343_devices[] __initdata = {
139 156
140static int __init sh7343_devices_setup(void) 157static int __init sh7343_devices_setup(void)
141{ 158{
142 clk_always_enable("mstp031"); /* TLB */ 159 clk_always_enable("uram0"); /* URAM */
143 clk_always_enable("mstp030"); /* IC */ 160 clk_always_enable("xymem0"); /* XYMEM */
144 clk_always_enable("mstp029"); /* OC */ 161 clk_always_enable("veu0"); /* VEU */
145 clk_always_enable("mstp028"); /* URAM */ 162 clk_always_enable("vpu0"); /* VPU */
146 clk_always_enable("mstp026"); /* XYMEM */
147 clk_always_enable("mstp023"); /* INTC3 */
148 clk_always_enable("mstp022"); /* INTC */
149 clk_always_enable("mstp020"); /* SuperHyway */
150 clk_always_enable("mstp109"); /* I2C0 */
151 clk_always_enable("mstp108"); /* I2C1 */
152 clk_always_enable("mstp202"); /* VEU */
153 clk_always_enable("mstp201"); /* VPU */
154 163
155 platform_resource_setup_memory(&vpu_device, "vpu", 1 << 20); 164 platform_resource_setup_memory(&vpu_device, "vpu", 1 << 20);
156 platform_resource_setup_memory(&veu_device, "veu", 2 << 20); 165 platform_resource_setup_memory(&veu_device, "veu", 2 << 20);
@@ -171,7 +180,7 @@ enum {
171 MMC_ERR, MMC_TRAN, MMC_FSTAT, MMC_FRDY, 180 MMC_ERR, MMC_TRAN, MMC_FSTAT, MMC_FRDY,
172 DMAC4, DMAC5, DMAC_DADERR, 181 DMAC4, DMAC5, DMAC_DADERR,
173 KEYSC, 182 KEYSC,
174 SCIF, SCIF1, SCIF2, SCIF3, SCIF4, 183 SCIF, SCIF1, SCIF2, SCIF3,
175 SIOF0, SIOF1, SIO, 184 SIOF0, SIOF1, SIO,
176 FLCTL_FLSTEI, FLCTL_FLENDI, FLCTL_FLTREQ0I, FLCTL_FLTREQ1I, 185 FLCTL_FLSTEI, FLCTL_FLENDI, FLCTL_FLTREQ0I, FLCTL_FLTREQ1I,
177 I2C0_ALI, I2C0_TACKI, I2C0_WAITI, I2C0_DTEI, 186 I2C0_ALI, I2C0_TACKI, I2C0_WAITI, I2C0_DTEI,
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
index e17db39b97aa..839ae97a7fd2 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
@@ -32,6 +32,7 @@ static struct resource iic_resources[] = {
32 32
33static struct platform_device iic_device = { 33static struct platform_device iic_device = {
34 .name = "i2c-sh_mobile", 34 .name = "i2c-sh_mobile",
35 .id = 0, /* "i2c0" clock */
35 .num_resources = ARRAY_SIZE(iic_resources), 36 .num_resources = ARRAY_SIZE(iic_resources),
36 .resource = iic_resources, 37 .resource = iic_resources,
37}; 38};
@@ -176,19 +177,11 @@ static struct platform_device *sh7366_devices[] __initdata = {
176 177
177static int __init sh7366_devices_setup(void) 178static int __init sh7366_devices_setup(void)
178{ 179{
179 clk_always_enable("mstp031"); /* TLB */ 180 clk_always_enable("rsmem0"); /* RSMEM */
180 clk_always_enable("mstp030"); /* IC */ 181 clk_always_enable("xymem0"); /* XYMEM */
181 clk_always_enable("mstp029"); /* OC */ 182 clk_always_enable("veu1"); /* VEU-2 */
182 clk_always_enable("mstp028"); /* RSMEM */ 183 clk_always_enable("veu0"); /* VEU-1 */
183 clk_always_enable("mstp026"); /* XYMEM */ 184 clk_always_enable("vpu0"); /* VPU */
184 clk_always_enable("mstp023"); /* INTC3 */
185 clk_always_enable("mstp022"); /* INTC */
186 clk_always_enable("mstp020"); /* SuperHyway */
187 clk_always_enable("mstp109"); /* I2C */
188 clk_always_enable("mstp211"); /* USB */
189 clk_always_enable("mstp207"); /* VEU-2 */
190 clk_always_enable("mstp202"); /* VEU-1 */
191 clk_always_enable("mstp201"); /* VPU */
192 185
193 platform_resource_setup_memory(&vpu_device, "vpu", 2 << 20); 186 platform_resource_setup_memory(&vpu_device, "vpu", 2 << 20);
194 platform_resource_setup_memory(&veu0_device, "veu0", 2 << 20); 187 platform_resource_setup_memory(&veu0_device, "veu0", 2 << 20);
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
index ef77ee1d9f53..50cf6838ec41 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
@@ -62,7 +62,7 @@ static struct resource usbf_resources[] = {
62 62
63static struct platform_device usbf_device = { 63static struct platform_device usbf_device = {
64 .name = "m66592_udc", 64 .name = "m66592_udc",
65 .id = -1, 65 .id = 0, /* "usbf0" clock */
66 .dev = { 66 .dev = {
67 .dma_mask = NULL, 67 .dma_mask = NULL,
68 .coherent_dma_mask = 0xffffffff, 68 .coherent_dma_mask = 0xffffffff,
@@ -87,6 +87,7 @@ static struct resource iic_resources[] = {
87 87
88static struct platform_device iic_device = { 88static struct platform_device iic_device = {
89 .name = "i2c-sh_mobile", 89 .name = "i2c-sh_mobile",
90 .id = 0, /* "i2c0" clock */
90 .num_resources = ARRAY_SIZE(iic_resources), 91 .num_resources = ARRAY_SIZE(iic_resources),
91 .resource = iic_resources, 92 .resource = iic_resources,
92}; 93};
@@ -147,6 +148,34 @@ static struct platform_device veu_device = {
147 .num_resources = ARRAY_SIZE(veu_resources), 148 .num_resources = ARRAY_SIZE(veu_resources),
148}; 149};
149 150
151static struct uio_info jpu_platform_data = {
152 .name = "JPU",
153 .version = "0",
154 .irq = 27,
155};
156
157static struct resource jpu_resources[] = {
158 [0] = {
159 .name = "JPU",
160 .start = 0xfea00000,
161 .end = 0xfea102d0,
162 .flags = IORESOURCE_MEM,
163 },
164 [1] = {
165 /* place holder for contiguous memory */
166 },
167};
168
169static struct platform_device jpu_device = {
170 .name = "uio_pdrv_genirq",
171 .id = 2,
172 .dev = {
173 .platform_data = &jpu_platform_data,
174 },
175 .resource = jpu_resources,
176 .num_resources = ARRAY_SIZE(jpu_resources),
177};
178
150static struct plat_sci_port sci_platform_data[] = { 179static struct plat_sci_port sci_platform_data[] = {
151 { 180 {
152 .mapbase = 0xffe00000, 181 .mapbase = 0xffe00000,
@@ -186,24 +215,21 @@ static struct platform_device *sh7722_devices[] __initdata = {
186 &sci_device, 215 &sci_device,
187 &vpu_device, 216 &vpu_device,
188 &veu_device, 217 &veu_device,
218 &jpu_device,
189}; 219};
190 220
191static int __init sh7722_devices_setup(void) 221static int __init sh7722_devices_setup(void)
192{ 222{
193 clk_always_enable("mstp031"); /* TLB */ 223 clk_always_enable("uram0"); /* URAM */
194 clk_always_enable("mstp030"); /* IC */ 224 clk_always_enable("xymem0"); /* XYMEM */
195 clk_always_enable("mstp029"); /* OC */ 225 clk_always_enable("rtc0"); /* RTC */
196 clk_always_enable("mstp028"); /* URAM */ 226 clk_always_enable("veu0"); /* VEU */
197 clk_always_enable("mstp026"); /* XYMEM */ 227 clk_always_enable("vpu0"); /* VPU */
198 clk_always_enable("mstp022"); /* INTC */ 228 clk_always_enable("jpu0"); /* JPU */
199 clk_always_enable("mstp020"); /* SuperHyway */
200 clk_always_enable("mstp109"); /* I2C */
201 clk_always_enable("mstp211"); /* USB */
202 clk_always_enable("mstp202"); /* VEU */
203 clk_always_enable("mstp201"); /* VPU */
204 229
205 platform_resource_setup_memory(&vpu_device, "vpu", 1 << 20); 230 platform_resource_setup_memory(&vpu_device, "vpu", 1 << 20);
206 platform_resource_setup_memory(&veu_device, "veu", 2 << 20); 231 platform_resource_setup_memory(&veu_device, "veu", 2 << 20);
232 platform_resource_setup_memory(&jpu_device, "jpu", 2 << 20);
207 233
208 return platform_add_devices(sh7722_devices, 234 return platform_add_devices(sh7722_devices,
209 ARRAY_SIZE(sh7722_devices)); 235 ARRAY_SIZE(sh7722_devices));
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
index 6d9e6972cfc9..849770d780ae 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
@@ -215,6 +215,7 @@ static struct resource iic_resources[] = {
215 215
216static struct platform_device iic_device = { 216static struct platform_device iic_device = {
217 .name = "i2c-sh_mobile", 217 .name = "i2c-sh_mobile",
218 .id = 0, /* "i2c0" clock */
218 .num_resources = ARRAY_SIZE(iic_resources), 219 .num_resources = ARRAY_SIZE(iic_resources),
219 .resource = iic_resources, 220 .resource = iic_resources,
220}; 221};
@@ -231,19 +232,11 @@ static struct platform_device *sh7723_devices[] __initdata = {
231 232
232static int __init sh7723_devices_setup(void) 233static int __init sh7723_devices_setup(void)
233{ 234{
234 clk_always_enable("mstp031"); /* TLB */ 235 clk_always_enable("meram0"); /* MERAM */
235 clk_always_enable("mstp030"); /* IC */ 236 clk_always_enable("rtc0"); /* RTC */
236 clk_always_enable("mstp029"); /* OC */ 237 clk_always_enable("veu1"); /* VEU2H1 */
237 clk_always_enable("mstp024"); /* FPU */ 238 clk_always_enable("veu0"); /* VEU2H0 */
238 clk_always_enable("mstp022"); /* INTC */ 239 clk_always_enable("vpu0"); /* VPU */
239 clk_always_enable("mstp020"); /* SuperHyway */
240 clk_always_enable("mstp000"); /* MERAM */
241 clk_always_enable("mstp109"); /* I2C */
242 clk_always_enable("mstp108"); /* RTC */
243 clk_always_enable("mstp211"); /* USB */
244 clk_always_enable("mstp206"); /* VEU2H1 */
245 clk_always_enable("mstp202"); /* VEU2H0 */
246 clk_always_enable("mstp201"); /* VPU */
247 240
248 platform_resource_setup_memory(&vpu_device, "vpu", 2 << 20); 241 platform_resource_setup_memory(&vpu_device, "vpu", 2 << 20);
249 platform_resource_setup_memory(&veu0_device, "veu0", 2 << 20); 242 platform_resource_setup_memory(&veu0_device, "veu0", 2 << 20);
diff --git a/arch/sh/kernel/debugtraps.S b/arch/sh/kernel/debugtraps.S
index 13b66746410a..591741383ee6 100644
--- a/arch/sh/kernel/debugtraps.S
+++ b/arch/sh/kernel/debugtraps.S
@@ -3,7 +3,7 @@
3 * 3 *
4 * Debug trap jump tables for SuperH 4 * Debug trap jump tables for SuperH
5 * 5 *
6 * Copyright (C) 2006 Paul Mundt 6 * Copyright (C) 2006 - 2008 Paul Mundt
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
@@ -12,12 +12,13 @@
12#include <linux/sys.h> 12#include <linux/sys.h>
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14 14
15#if !defined(CONFIG_SH_KGDB) 15#if !defined(CONFIG_KGDB)
16#define kgdb_handle_exception debug_trap_handler 16#define breakpoint_trap_handler debug_trap_handler
17#define singlestep_trap_handler debug_trap_handler
17#endif 18#endif
18 19
19#if !defined(CONFIG_SH_STANDARD_BIOS) 20#if !defined(CONFIG_SH_STANDARD_BIOS)
20#define sh_bios_handler debug_trap_handler 21#define sh_bios_handler debug_trap_handler
21#endif 22#endif
22 23
23 .data 24 .data
@@ -35,7 +36,7 @@ ENTRY(debug_trap_table)
35 .long debug_trap_handler /* 0x39 */ 36 .long debug_trap_handler /* 0x39 */
36 .long debug_trap_handler /* 0x3a */ 37 .long debug_trap_handler /* 0x3a */
37 .long debug_trap_handler /* 0x3b */ 38 .long debug_trap_handler /* 0x3b */
38 .long kgdb_handle_exception /* 0x3c */ 39 .long breakpoint_trap_handler /* 0x3c */
39 .long debug_trap_handler /* 0x3d */ 40 .long singlestep_trap_handler /* 0x3d */
40 .long bug_trap_handler /* 0x3e */ 41 .long bug_trap_handler /* 0x3e */
41 .long sh_bios_handler /* 0x3f */ 42 .long sh_bios_handler /* 0x3f */
diff --git a/arch/sh/kernel/disassemble.c b/arch/sh/kernel/disassemble.c
new file mode 100644
index 000000000000..64d5d8dded7c
--- /dev/null
+++ b/arch/sh/kernel/disassemble.c
@@ -0,0 +1,573 @@
1/*
2 * Disassemble SuperH instructions.
3 *
4 * Copyright (C) 1999 kaz Kojima
5 * Copyright (C) 2008 Paul Mundt
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#include <linux/kernel.h>
12#include <linux/string.h>
13#include <linux/uaccess.h>
14
15/*
16 * Format of an instruction in memory.
17 */
18typedef enum {
19 HEX_0, HEX_1, HEX_2, HEX_3, HEX_4, HEX_5, HEX_6, HEX_7,
20 HEX_8, HEX_9, HEX_A, HEX_B, HEX_C, HEX_D, HEX_E, HEX_F,
21 REG_N, REG_M, REG_NM, REG_B,
22 BRANCH_12, BRANCH_8,
23 DISP_8, DISP_4,
24 IMM_4, IMM_4BY2, IMM_4BY4, PCRELIMM_8BY2, PCRELIMM_8BY4,
25 IMM_8, IMM_8BY2, IMM_8BY4,
26} sh_nibble_type;
27
28typedef enum {
29 A_END, A_BDISP12, A_BDISP8,
30 A_DEC_M, A_DEC_N,
31 A_DISP_GBR, A_DISP_PC, A_DISP_REG_M, A_DISP_REG_N,
32 A_GBR,
33 A_IMM,
34 A_INC_M, A_INC_N,
35 A_IND_M, A_IND_N, A_IND_R0_REG_M, A_IND_R0_REG_N,
36 A_MACH, A_MACL,
37 A_PR, A_R0, A_R0_GBR, A_REG_M, A_REG_N, A_REG_B,
38 A_SR, A_VBR, A_SSR, A_SPC, A_SGR, A_DBR,
39 F_REG_N, F_REG_M, D_REG_N, D_REG_M,
40 X_REG_N, /* Only used for argument parsing */
41 X_REG_M, /* Only used for argument parsing */
42 DX_REG_N, DX_REG_M, V_REG_N, V_REG_M,
43 FD_REG_N,
44 XMTRX_M4,
45 F_FR0,
46 FPUL_N, FPUL_M, FPSCR_N, FPSCR_M,
47} sh_arg_type;
48
49static struct sh_opcode_info {
50 char *name;
51 sh_arg_type arg[7];
52 sh_nibble_type nibbles[4];
53} sh_table[] = {
54 {"add",{A_IMM,A_REG_N},{HEX_7,REG_N,IMM_8}},
55 {"add",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_C}},
56 {"addc",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_E}},
57 {"addv",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_F}},
58 {"and",{A_IMM,A_R0},{HEX_C,HEX_9,IMM_8}},
59 {"and",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_9}},
60 {"and.b",{A_IMM,A_R0_GBR},{HEX_C,HEX_D,IMM_8}},
61 {"bra",{A_BDISP12},{HEX_A,BRANCH_12}},
62 {"bsr",{A_BDISP12},{HEX_B,BRANCH_12}},
63 {"bt",{A_BDISP8},{HEX_8,HEX_9,BRANCH_8}},
64 {"bf",{A_BDISP8},{HEX_8,HEX_B,BRANCH_8}},
65 {"bt.s",{A_BDISP8},{HEX_8,HEX_D,BRANCH_8}},
66 {"bt/s",{A_BDISP8},{HEX_8,HEX_D,BRANCH_8}},
67 {"bf.s",{A_BDISP8},{HEX_8,HEX_F,BRANCH_8}},
68 {"bf/s",{A_BDISP8},{HEX_8,HEX_F,BRANCH_8}},
69 {"clrmac",{0},{HEX_0,HEX_0,HEX_2,HEX_8}},
70 {"clrs",{0},{HEX_0,HEX_0,HEX_4,HEX_8}},
71 {"clrt",{0},{HEX_0,HEX_0,HEX_0,HEX_8}},
72 {"cmp/eq",{A_IMM,A_R0},{HEX_8,HEX_8,IMM_8}},
73 {"cmp/eq",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_0}},
74 {"cmp/ge",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_3}},
75 {"cmp/gt",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_7}},
76 {"cmp/hi",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_6}},
77 {"cmp/hs",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_2}},
78 {"cmp/pl",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_5}},
79 {"cmp/pz",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_1}},
80 {"cmp/str",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_C}},
81 {"div0s",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_7}},
82 {"div0u",{0},{HEX_0,HEX_0,HEX_1,HEX_9}},
83 {"div1",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_4}},
84 {"exts.b",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_E}},
85 {"exts.w",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_F}},
86 {"extu.b",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_C}},
87 {"extu.w",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_D}},
88 {"jmp",{A_IND_N},{HEX_4,REG_N,HEX_2,HEX_B}},
89 {"jsr",{A_IND_N},{HEX_4,REG_N,HEX_0,HEX_B}},
90 {"ldc",{A_REG_N,A_SR},{HEX_4,REG_N,HEX_0,HEX_E}},
91 {"ldc",{A_REG_N,A_GBR},{HEX_4,REG_N,HEX_1,HEX_E}},
92 {"ldc",{A_REG_N,A_VBR},{HEX_4,REG_N,HEX_2,HEX_E}},
93 {"ldc",{A_REG_N,A_SSR},{HEX_4,REG_N,HEX_3,HEX_E}},
94 {"ldc",{A_REG_N,A_SPC},{HEX_4,REG_N,HEX_4,HEX_E}},
95 {"ldc",{A_REG_N,A_DBR},{HEX_4,REG_N,HEX_7,HEX_E}},
96 {"ldc",{A_REG_N,A_REG_B},{HEX_4,REG_N,REG_B,HEX_E}},
97 {"ldc.l",{A_INC_N,A_SR},{HEX_4,REG_N,HEX_0,HEX_7}},
98 {"ldc.l",{A_INC_N,A_GBR},{HEX_4,REG_N,HEX_1,HEX_7}},
99 {"ldc.l",{A_INC_N,A_VBR},{HEX_4,REG_N,HEX_2,HEX_7}},
100 {"ldc.l",{A_INC_N,A_SSR},{HEX_4,REG_N,HEX_3,HEX_7}},
101 {"ldc.l",{A_INC_N,A_SPC},{HEX_4,REG_N,HEX_4,HEX_7}},
102 {"ldc.l",{A_INC_N,A_DBR},{HEX_4,REG_N,HEX_7,HEX_7}},
103 {"ldc.l",{A_INC_N,A_REG_B},{HEX_4,REG_N,REG_B,HEX_7}},
104 {"lds",{A_REG_N,A_MACH},{HEX_4,REG_N,HEX_0,HEX_A}},
105 {"lds",{A_REG_N,A_MACL},{HEX_4,REG_N,HEX_1,HEX_A}},
106 {"lds",{A_REG_N,A_PR},{HEX_4,REG_N,HEX_2,HEX_A}},
107 {"lds",{A_REG_M,FPUL_N},{HEX_4,REG_M,HEX_5,HEX_A}},
108 {"lds",{A_REG_M,FPSCR_N},{HEX_4,REG_M,HEX_6,HEX_A}},
109 {"lds.l",{A_INC_N,A_MACH},{HEX_4,REG_N,HEX_0,HEX_6}},
110 {"lds.l",{A_INC_N,A_MACL},{HEX_4,REG_N,HEX_1,HEX_6}},
111 {"lds.l",{A_INC_N,A_PR},{HEX_4,REG_N,HEX_2,HEX_6}},
112 {"lds.l",{A_INC_M,FPUL_N},{HEX_4,REG_M,HEX_5,HEX_6}},
113 {"lds.l",{A_INC_M,FPSCR_N},{HEX_4,REG_M,HEX_6,HEX_6}},
114 {"ldtlb",{0},{HEX_0,HEX_0,HEX_3,HEX_8}},
115 {"mac.w",{A_INC_M,A_INC_N},{HEX_4,REG_N,REG_M,HEX_F}},
116 {"mov",{A_IMM,A_REG_N},{HEX_E,REG_N,IMM_8}},
117 {"mov",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_3}},
118 {"mov.b",{ A_REG_M,A_IND_R0_REG_N},{HEX_0,REG_N,REG_M,HEX_4}},
119 {"mov.b",{ A_REG_M,A_DEC_N},{HEX_2,REG_N,REG_M,HEX_4}},
120 {"mov.b",{ A_REG_M,A_IND_N},{HEX_2,REG_N,REG_M,HEX_0}},
121 {"mov.b",{A_DISP_REG_M,A_R0},{HEX_8,HEX_4,REG_M,IMM_4}},
122 {"mov.b",{A_DISP_GBR,A_R0},{HEX_C,HEX_4,IMM_8}},
123 {"mov.b",{A_IND_R0_REG_M,A_REG_N},{HEX_0,REG_N,REG_M,HEX_C}},
124 {"mov.b",{A_INC_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_4}},
125 {"mov.b",{A_IND_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_0}},
126 {"mov.b",{A_R0,A_DISP_REG_M},{HEX_8,HEX_0,REG_M,IMM_4}},
127 {"mov.b",{A_R0,A_DISP_GBR},{HEX_C,HEX_0,IMM_8}},
128 {"mov.l",{ A_REG_M,A_DISP_REG_N},{HEX_1,REG_N,REG_M,IMM_4BY4}},
129 {"mov.l",{ A_REG_M,A_IND_R0_REG_N},{HEX_0,REG_N,REG_M,HEX_6}},
130 {"mov.l",{ A_REG_M,A_DEC_N},{HEX_2,REG_N,REG_M,HEX_6}},
131 {"mov.l",{ A_REG_M,A_IND_N},{HEX_2,REG_N,REG_M,HEX_2}},
132 {"mov.l",{A_DISP_REG_M,A_REG_N},{HEX_5,REG_N,REG_M,IMM_4BY4}},
133 {"mov.l",{A_DISP_GBR,A_R0},{HEX_C,HEX_6,IMM_8BY4}},
134 {"mov.l",{A_DISP_PC,A_REG_N},{HEX_D,REG_N,PCRELIMM_8BY4}},
135 {"mov.l",{A_IND_R0_REG_M,A_REG_N},{HEX_0,REG_N,REG_M,HEX_E}},
136 {"mov.l",{A_INC_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_6}},
137 {"mov.l",{A_IND_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_2}},
138 {"mov.l",{A_R0,A_DISP_GBR},{HEX_C,HEX_2,IMM_8BY4}},
139 {"mov.w",{ A_REG_M,A_IND_R0_REG_N},{HEX_0,REG_N,REG_M,HEX_5}},
140 {"mov.w",{ A_REG_M,A_DEC_N},{HEX_2,REG_N,REG_M,HEX_5}},
141 {"mov.w",{ A_REG_M,A_IND_N},{HEX_2,REG_N,REG_M,HEX_1}},
142 {"mov.w",{A_DISP_REG_M,A_R0},{HEX_8,HEX_5,REG_M,IMM_4BY2}},
143 {"mov.w",{A_DISP_GBR,A_R0},{HEX_C,HEX_5,IMM_8BY2}},
144 {"mov.w",{A_DISP_PC,A_REG_N},{HEX_9,REG_N,PCRELIMM_8BY2}},
145 {"mov.w",{A_IND_R0_REG_M,A_REG_N},{HEX_0,REG_N,REG_M,HEX_D}},
146 {"mov.w",{A_INC_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_5}},
147 {"mov.w",{A_IND_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_1}},
148 {"mov.w",{A_R0,A_DISP_REG_M},{HEX_8,HEX_1,REG_M,IMM_4BY2}},
149 {"mov.w",{A_R0,A_DISP_GBR},{HEX_C,HEX_1,IMM_8BY2}},
150 {"mova",{A_DISP_PC,A_R0},{HEX_C,HEX_7,PCRELIMM_8BY4}},
151 {"movca.l",{A_R0,A_IND_N},{HEX_0,REG_N,HEX_C,HEX_3}},
152 {"movt",{A_REG_N},{HEX_0,REG_N,HEX_2,HEX_9}},
153 {"muls",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_F}},
154 {"mul.l",{ A_REG_M,A_REG_N},{HEX_0,REG_N,REG_M,HEX_7}},
155 {"mulu",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_E}},
156 {"neg",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_B}},
157 {"negc",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_A}},
158 {"nop",{0},{HEX_0,HEX_0,HEX_0,HEX_9}},
159 {"not",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_7}},
160 {"ocbi",{A_IND_N},{HEX_0,REG_N,HEX_9,HEX_3}},
161 {"ocbp",{A_IND_N},{HEX_0,REG_N,HEX_A,HEX_3}},
162 {"ocbwb",{A_IND_N},{HEX_0,REG_N,HEX_B,HEX_3}},
163 {"or",{A_IMM,A_R0},{HEX_C,HEX_B,IMM_8}},
164 {"or",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_B}},
165 {"or.b",{A_IMM,A_R0_GBR},{HEX_C,HEX_F,IMM_8}},
166 {"pref",{A_IND_N},{HEX_0,REG_N,HEX_8,HEX_3}},
167 {"rotcl",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_4}},
168 {"rotcr",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_5}},
169 {"rotl",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_4}},
170 {"rotr",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_5}},
171 {"rte",{0},{HEX_0,HEX_0,HEX_2,HEX_B}},
172 {"rts",{0},{HEX_0,HEX_0,HEX_0,HEX_B}},
173 {"sets",{0},{HEX_0,HEX_0,HEX_5,HEX_8}},
174 {"sett",{0},{HEX_0,HEX_0,HEX_1,HEX_8}},
175 {"shad",{ A_REG_M,A_REG_N},{HEX_4,REG_N,REG_M,HEX_C}},
176 {"shld",{ A_REG_M,A_REG_N},{HEX_4,REG_N,REG_M,HEX_D}},
177 {"shal",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_0}},
178 {"shar",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_1}},
179 {"shll",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_0}},
180 {"shll16",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_8}},
181 {"shll2",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_8}},
182 {"shll8",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_8}},
183 {"shlr",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_1}},
184 {"shlr16",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_9}},
185 {"shlr2",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_9}},
186 {"shlr8",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_9}},
187 {"sleep",{0},{HEX_0,HEX_0,HEX_1,HEX_B}},
188 {"stc",{A_SR,A_REG_N},{HEX_0,REG_N,HEX_0,HEX_2}},
189 {"stc",{A_GBR,A_REG_N},{HEX_0,REG_N,HEX_1,HEX_2}},
190 {"stc",{A_VBR,A_REG_N},{HEX_0,REG_N,HEX_2,HEX_2}},
191 {"stc",{A_SSR,A_REG_N},{HEX_0,REG_N,HEX_3,HEX_2}},
192 {"stc",{A_SPC,A_REG_N},{HEX_0,REG_N,HEX_4,HEX_2}},
193 {"stc",{A_SGR,A_REG_N},{HEX_0,REG_N,HEX_6,HEX_2}},
194 {"stc",{A_DBR,A_REG_N},{HEX_0,REG_N,HEX_7,HEX_2}},
195 {"stc",{A_REG_B,A_REG_N},{HEX_0,REG_N,REG_B,HEX_2}},
196 {"stc.l",{A_SR,A_DEC_N},{HEX_4,REG_N,HEX_0,HEX_3}},
197 {"stc.l",{A_GBR,A_DEC_N},{HEX_4,REG_N,HEX_1,HEX_3}},
198 {"stc.l",{A_VBR,A_DEC_N},{HEX_4,REG_N,HEX_2,HEX_3}},
199 {"stc.l",{A_SSR,A_DEC_N},{HEX_4,REG_N,HEX_3,HEX_3}},
200 {"stc.l",{A_SPC,A_DEC_N},{HEX_4,REG_N,HEX_4,HEX_3}},
201 {"stc.l",{A_SGR,A_DEC_N},{HEX_4,REG_N,HEX_6,HEX_3}},
202 {"stc.l",{A_DBR,A_DEC_N},{HEX_4,REG_N,HEX_7,HEX_3}},
203 {"stc.l",{A_REG_B,A_DEC_N},{HEX_4,REG_N,REG_B,HEX_3}},
204 {"sts",{A_MACH,A_REG_N},{HEX_0,REG_N,HEX_0,HEX_A}},
205 {"sts",{A_MACL,A_REG_N},{HEX_0,REG_N,HEX_1,HEX_A}},
206 {"sts",{A_PR,A_REG_N},{HEX_0,REG_N,HEX_2,HEX_A}},
207 {"sts",{FPUL_M,A_REG_N},{HEX_0,REG_N,HEX_5,HEX_A}},
208 {"sts",{FPSCR_M,A_REG_N},{HEX_0,REG_N,HEX_6,HEX_A}},
209 {"sts.l",{A_MACH,A_DEC_N},{HEX_4,REG_N,HEX_0,HEX_2}},
210 {"sts.l",{A_MACL,A_DEC_N},{HEX_4,REG_N,HEX_1,HEX_2}},
211 {"sts.l",{A_PR,A_DEC_N},{HEX_4,REG_N,HEX_2,HEX_2}},
212 {"sts.l",{FPUL_M,A_DEC_N},{HEX_4,REG_N,HEX_5,HEX_2}},
213 {"sts.l",{FPSCR_M,A_DEC_N},{HEX_4,REG_N,HEX_6,HEX_2}},
214 {"sub",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_8}},
215 {"subc",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_A}},
216 {"subv",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_B}},
217 {"swap.b",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_8}},
218 {"swap.w",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_9}},
219 {"tas.b",{A_IND_N},{HEX_4,REG_N,HEX_1,HEX_B}},
220 {"trapa",{A_IMM},{HEX_C,HEX_3,IMM_8}},
221 {"tst",{A_IMM,A_R0},{HEX_C,HEX_8,IMM_8}},
222 {"tst",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_8}},
223 {"tst.b",{A_IMM,A_R0_GBR},{HEX_C,HEX_C,IMM_8}},
224 {"xor",{A_IMM,A_R0},{HEX_C,HEX_A,IMM_8}},
225 {"xor",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_A}},
226 {"xor.b",{A_IMM,A_R0_GBR},{HEX_C,HEX_E,IMM_8}},
227 {"xtrct",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_D}},
228 {"mul.l",{ A_REG_M,A_REG_N},{HEX_0,REG_N,REG_M,HEX_7}},
229 {"dt",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_0}},
230 {"dmuls.l",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_D}},
231 {"dmulu.l",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_5}},
232 {"mac.l",{A_INC_M,A_INC_N},{HEX_0,REG_N,REG_M,HEX_F}},
233 {"braf",{A_REG_N},{HEX_0,REG_N,HEX_2,HEX_3}},
234 {"bsrf",{A_REG_N},{HEX_0,REG_N,HEX_0,HEX_3}},
235 {"fabs",{FD_REG_N},{HEX_F,REG_N,HEX_5,HEX_D}},
236 {"fadd",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_0}},
237 {"fadd",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_0}},
238 {"fcmp/eq",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_4}},
239 {"fcmp/eq",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_4}},
240 {"fcmp/gt",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_5}},
241 {"fcmp/gt",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_5}},
242 {"fcnvds",{D_REG_N,FPUL_M},{HEX_F,REG_N,HEX_B,HEX_D}},
243 {"fcnvsd",{FPUL_M,D_REG_N},{HEX_F,REG_N,HEX_A,HEX_D}},
244 {"fdiv",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_3}},
245 {"fdiv",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_3}},
246 {"fipr",{V_REG_M,V_REG_N},{HEX_F,REG_NM,HEX_E,HEX_D}},
247 {"fldi0",{F_REG_N},{HEX_F,REG_N,HEX_8,HEX_D}},
248 {"fldi1",{F_REG_N},{HEX_F,REG_N,HEX_9,HEX_D}},
249 {"flds",{F_REG_N,FPUL_M},{HEX_F,REG_N,HEX_1,HEX_D}},
250 {"float",{FPUL_M,FD_REG_N},{HEX_F,REG_N,HEX_2,HEX_D}},
251 {"fmac",{F_FR0,F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_E}},
252 {"fmov",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_C}},
253 {"fmov",{DX_REG_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_C}},
254 {"fmov",{A_IND_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_8}},
255 {"fmov",{A_IND_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_8}},
256 {"fmov",{F_REG_M,A_IND_N},{HEX_F,REG_N,REG_M,HEX_A}},
257 {"fmov",{DX_REG_M,A_IND_N},{HEX_F,REG_N,REG_M,HEX_A}},
258 {"fmov",{A_INC_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_9}},
259 {"fmov",{A_INC_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_9}},
260 {"fmov",{F_REG_M,A_DEC_N},{HEX_F,REG_N,REG_M,HEX_B}},
261 {"fmov",{DX_REG_M,A_DEC_N},{HEX_F,REG_N,REG_M,HEX_B}},
262 {"fmov",{A_IND_R0_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_6}},
263 {"fmov",{A_IND_R0_REG_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_6}},
264 {"fmov",{F_REG_M,A_IND_R0_REG_N},{HEX_F,REG_N,REG_M,HEX_7}},
265 {"fmov",{DX_REG_M,A_IND_R0_REG_N},{HEX_F,REG_N,REG_M,HEX_7}},
266 {"fmov.d",{A_IND_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_8}},
267 {"fmov.d",{DX_REG_M,A_IND_N},{HEX_F,REG_N,REG_M,HEX_A}},
268 {"fmov.d",{A_INC_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_9}},
269 {"fmov.d",{DX_REG_M,A_DEC_N},{HEX_F,REG_N,REG_M,HEX_B}},
270 {"fmov.d",{A_IND_R0_REG_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_6}},
271 {"fmov.d",{DX_REG_M,A_IND_R0_REG_N},{HEX_F,REG_N,REG_M,HEX_7}},
272 {"fmov.s",{A_IND_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_8}},
273 {"fmov.s",{F_REG_M,A_IND_N},{HEX_F,REG_N,REG_M,HEX_A}},
274 {"fmov.s",{A_INC_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_9}},
275 {"fmov.s",{F_REG_M,A_DEC_N},{HEX_F,REG_N,REG_M,HEX_B}},
276 {"fmov.s",{A_IND_R0_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_6}},
277 {"fmov.s",{F_REG_M,A_IND_R0_REG_N},{HEX_F,REG_N,REG_M,HEX_7}},
278 {"fmul",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_2}},
279 {"fmul",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_2}},
280 {"fneg",{FD_REG_N},{HEX_F,REG_N,HEX_4,HEX_D}},
281 {"frchg",{0},{HEX_F,HEX_B,HEX_F,HEX_D}},
282 {"fschg",{0},{HEX_F,HEX_3,HEX_F,HEX_D}},
283 {"fsqrt",{FD_REG_N},{HEX_F,REG_N,HEX_6,HEX_D}},
284 {"fsts",{FPUL_M,F_REG_N},{HEX_F,REG_N,HEX_0,HEX_D}},
285 {"fsub",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_1}},
286 {"fsub",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_1}},
287 {"ftrc",{FD_REG_N,FPUL_M},{HEX_F,REG_N,HEX_3,HEX_D}},
288 {"ftrv",{XMTRX_M4,V_REG_N},{HEX_F,REG_NM,HEX_F,HEX_D}},
289 { 0 },
290};
291
292static void print_sh_insn(u32 memaddr, u16 insn)
293{
294 int relmask = ~0;
295 int nibs[4] = { (insn >> 12) & 0xf, (insn >> 8) & 0xf, (insn >> 4) & 0xf, insn & 0xf};
296 int lastsp;
297 struct sh_opcode_info *op = sh_table;
298
299 for (; op->name; op++) {
300 int n;
301 int imm = 0;
302 int rn = 0;
303 int rm = 0;
304 int rb = 0;
305 int disp_pc;
306 int disp_pc_addr = 0;
307
308 for (n = 0; n < 4; n++) {
309 int i = op->nibbles[n];
310
311 if (i < 16) {
312 if (nibs[n] == i)
313 continue;
314 goto fail;
315 }
316 switch (i) {
317 case BRANCH_8:
318 imm = (nibs[2] << 4) | (nibs[3]);
319 if (imm & 0x80)
320 imm |= ~0xff;
321 imm = ((char)imm) * 2 + 4 ;
322 goto ok;
323 case BRANCH_12:
324 imm = ((nibs[1]) << 8) | (nibs[2] << 4) | (nibs[3]);
325 if (imm & 0x800)
326 imm |= ~0xfff;
327 imm = imm * 2 + 4;
328 goto ok;
329 case IMM_4:
330 imm = nibs[3];
331 goto ok;
332 case IMM_4BY2:
333 imm = nibs[3] <<1;
334 goto ok;
335 case IMM_4BY4:
336 imm = nibs[3] <<2;
337 goto ok;
338 case IMM_8:
339 imm = (nibs[2] << 4) | nibs[3];
340 goto ok;
341 case PCRELIMM_8BY2:
342 imm = ((nibs[2] << 4) | nibs[3]) <<1;
343 relmask = ~1;
344 goto ok;
345 case PCRELIMM_8BY4:
346 imm = ((nibs[2] << 4) | nibs[3]) <<2;
347 relmask = ~3;
348 goto ok;
349 case IMM_8BY2:
350 imm = ((nibs[2] << 4) | nibs[3]) <<1;
351 goto ok;
352 case IMM_8BY4:
353 imm = ((nibs[2] << 4) | nibs[3]) <<2;
354 goto ok;
355 case DISP_8:
356 imm = (nibs[2] << 4) | (nibs[3]);
357 goto ok;
358 case DISP_4:
359 imm = nibs[3];
360 goto ok;
361 case REG_N:
362 rn = nibs[n];
363 break;
364 case REG_M:
365 rm = nibs[n];
366 break;
367 case REG_NM:
368 rn = (nibs[n] & 0xc) >> 2;
369 rm = (nibs[n] & 0x3);
370 break;
371 case REG_B:
372 rb = nibs[n] & 0x07;
373 break;
374 default:
375 return;
376 }
377 }
378
379 ok:
380 printk("%-8s ", op->name);
381 lastsp = (op->arg[0] == A_END);
382 disp_pc = 0;
383 for (n = 0; n < 6 && op->arg[n] != A_END; n++) {
384 if (n && op->arg[1] != A_END)
385 printk(", ");
386 switch (op->arg[n]) {
387 case A_IMM:
388 printk("#%d", (char)(imm));
389 break;
390 case A_R0:
391 printk("r0");
392 break;
393 case A_REG_N:
394 printk("r%d", rn);
395 break;
396 case A_INC_N:
397 printk("@r%d+", rn);
398 break;
399 case A_DEC_N:
400 printk("@-r%d", rn);
401 break;
402 case A_IND_N:
403 printk("@r%d", rn);
404 break;
405 case A_DISP_REG_N:
406 printk("@(%d,r%d)", imm, rn);
407 break;
408 case A_REG_M:
409 printk("r%d", rm);
410 break;
411 case A_INC_M:
412 printk("@r%d+", rm);
413 break;
414 case A_DEC_M:
415 printk("@-r%d", rm);
416 break;
417 case A_IND_M:
418 printk("@r%d", rm);
419 break;
420 case A_DISP_REG_M:
421 printk("@(%d,r%d)", imm, rm);
422 break;
423 case A_REG_B:
424 printk("r%d_bank", rb);
425 break;
426 case A_DISP_PC:
427 disp_pc = 1;
428 disp_pc_addr = imm + 4 + (memaddr & relmask);
429 printk("%08x <%pS>", disp_pc_addr,
430 (void *)disp_pc_addr);
431 break;
432 case A_IND_R0_REG_N:
433 printk("@(r0,r%d)", rn);
434 break;
435 case A_IND_R0_REG_M:
436 printk("@(r0,r%d)", rm);
437 break;
438 case A_DISP_GBR:
439 printk("@(%d,gbr)",imm);
440 break;
441 case A_R0_GBR:
442 printk("@(r0,gbr)");
443 break;
444 case A_BDISP12:
445 case A_BDISP8:
446 printk("%08x", imm + memaddr);
447 break;
448 case A_SR:
449 printk("sr");
450 break;
451 case A_GBR:
452 printk("gbr");
453 break;
454 case A_VBR:
455 printk("vbr");
456 break;
457 case A_SSR:
458 printk("ssr");
459 break;
460 case A_SPC:
461 printk("spc");
462 break;
463 case A_MACH:
464 printk("mach");
465 break;
466 case A_MACL:
467 printk("macl");
468 break;
469 case A_PR:
470 printk("pr");
471 break;
472 case A_SGR:
473 printk("sgr");
474 break;
475 case A_DBR:
476 printk("dbr");
477 break;
478 case FD_REG_N:
479 if (0)
480 goto d_reg_n;
481 case F_REG_N:
482 printk("fr%d", rn);
483 break;
484 case F_REG_M:
485 printk("fr%d", rm);
486 break;
487 case DX_REG_N:
488 if (rn & 1) {
489 printk("xd%d", rn & ~1);
490 break;
491 }
492 d_reg_n:
493 case D_REG_N:
494 printk("dr%d", rn);
495 break;
496 case DX_REG_M:
497 if (rm & 1) {
498 printk("xd%d", rm & ~1);
499 break;
500 }
501 case D_REG_M:
502 printk("dr%d", rm);
503 break;
504 case FPSCR_M:
505 case FPSCR_N:
506 printk("fpscr");
507 break;
508 case FPUL_M:
509 case FPUL_N:
510 printk("fpul");
511 break;
512 case F_FR0:
513 printk("fr0");
514 break;
515 case V_REG_N:
516 printk("fv%d", rn*4);
517 break;
518 case V_REG_M:
519 printk("fv%d", rm*4);
520 break;
521 case XMTRX_M4:
522 printk("xmtrx");
523 break;
524 default:
525 return;
526 }
527 }
528
529 if (disp_pc && strcmp(op->name, "mova") != 0) {
530 u32 val;
531
532 if (relmask == ~1)
533 __get_user(val, (u16 *)disp_pc_addr);
534 else
535 __get_user(val, (u32 *)disp_pc_addr);
536
537 printk(" ! %08x <%pS>", val, (void *)val);
538 }
539
540 return;
541 fail:
542 ;
543
544 }
545
546 printk(".word 0x%x%x%x%x", nibs[0], nibs[1], nibs[2], nibs[3]);
547}
548
549void show_code(struct pt_regs *regs)
550{
551 unsigned short *pc = (unsigned short *)regs->pc;
552 long i;
553
554 if (regs->pc & 0x1)
555 return;
556
557 printk("Code:\n");
558
559 for (i = -3 ; i < 6 ; i++) {
560 unsigned short insn;
561
562 if (__get_user(insn, pc + i)) {
563 printk(" (Bad address in pc)\n");
564 break;
565 }
566
567 printk("%s%08lx: ", (i ? " ": "->"), (unsigned long)(pc + i));
568 print_sh_insn((unsigned long)(pc + i), insn);
569 printk("\n");
570 }
571
572 printk("\n");
573}
diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S
index 5b7efc4016fa..d62359cfbbe2 100644
--- a/arch/sh/kernel/entry-common.S
+++ b/arch/sh/kernel/entry-common.S
@@ -308,15 +308,19 @@ ENTRY(system_call)
308 mov.l 1f, r9 308 mov.l 1f, r9
309 mov.l @r9, r8 ! Read from TRA (Trap Address) Register 309 mov.l @r9, r8 ! Read from TRA (Trap Address) Register
310#endif 310#endif
311
312 mov #OFF_TRA, r10
313 add r15, r10
314 mov.l r8, @r10 ! set TRA value to tra
315
311 /* 316 /*
312 * Check the trap type 317 * Check the trap type
313 */ 318 */
314 mov #((0x20 << 2) - 1), r9 319 mov #((0x20 << 2) - 1), r9
315 cmp/hi r9, r8 320 cmp/hi r9, r8
316 bt/s debug_trap ! it's a debug trap.. 321 bt/s debug_trap ! it's a debug trap..
317 mov #OFF_TRA, r9 322 nop
318 add r15, r9 323
319 mov.l r8, @r9 ! set TRA value to tra
320#ifdef CONFIG_TRACE_IRQFLAGS 324#ifdef CONFIG_TRACE_IRQFLAGS
321 mov.l 5f, r10 325 mov.l 5f, r10
322 jsr @r10 326 jsr @r10
@@ -371,47 +375,3 @@ syscall_exit:
371#endif 375#endif
3727: .long do_syscall_trace_enter 3767: .long do_syscall_trace_enter
3738: .long do_syscall_trace_leave 3778: .long do_syscall_trace_leave
374
375#ifdef CONFIG_FUNCTION_TRACER
376 .align 2
377 .globl _mcount
378 .type _mcount,@function
379 .globl mcount
380 .type mcount,@function
381_mcount:
382mcount:
383 mov.l r4, @-r15
384 mov.l r5, @-r15
385 mov.l r6, @-r15
386 mov.l r7, @-r15
387 sts.l pr, @-r15
388
389 mov.l @(20,r15),r4
390 sts pr, r5
391
392 mov.l 1f, r6
393 mov.l ftrace_stub, r7
394 cmp/eq r6, r7
395 bt skip_trace
396
397 mov.l @r6, r6
398 jsr @r6
399 nop
400
401skip_trace:
402
403 lds.l @r15+, pr
404 mov.l @r15+, r7
405 mov.l @r15+, r6
406 mov.l @r15+, r5
407 rts
408 mov.l @r15+, r4
409
410 .align 2
4111: .long ftrace_trace_function
412
413 .globl ftrace_stub
414ftrace_stub:
415 rts
416 nop
417#endif /* CONFIG_FUNCTION_TRACER */
diff --git a/arch/sh/kernel/ftrace.c b/arch/sh/kernel/ftrace.c
new file mode 100644
index 000000000000..4c3247477aa3
--- /dev/null
+++ b/arch/sh/kernel/ftrace.c
@@ -0,0 +1,133 @@
1/*
2 * Copyright (C) 2008 Matt Fleming <mjf@gentoo.org>
3 * Copyright (C) 2008 Paul Mundt <lethal@linux-sh.org>
4 *
5 * Code for replacing ftrace calls with jumps.
6 *
7 * Copyright (C) 2007-2008 Steven Rostedt <srostedt@redhat.com>
8 *
9 * Thanks goes to Ingo Molnar, for suggesting the idea.
10 * Mathieu Desnoyers, for suggesting postponing the modifications.
11 * Arjan van de Ven, for keeping me straight, and explaining to me
12 * the dangers of modifying code on the run.
13 */
14#include <linux/uaccess.h>
15#include <linux/ftrace.h>
16#include <linux/string.h>
17#include <linux/init.h>
18#include <linux/io.h>
19#include <asm/ftrace.h>
20#include <asm/cacheflush.h>
21
22static unsigned char ftrace_nop[] = {
23 0x09, 0x00, /* nop */
24 0x09, 0x00, /* nop */
25};
26
27static unsigned char ftrace_replaced_code[MCOUNT_INSN_SIZE];
28
29unsigned char *ftrace_nop_replace(void)
30{
31 return ftrace_nop;
32}
33
34static int is_sh_nop(unsigned char *ip)
35{
36 return strncmp(ip, ftrace_nop, sizeof(ftrace_nop));
37}
38
39unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
40{
41 /* Place the address in the memory table. */
42 if (addr == CALLER_ADDR)
43 __raw_writel(addr + MCOUNT_INSN_OFFSET, ftrace_replaced_code);
44 else
45 __raw_writel(addr, ftrace_replaced_code);
46
47 /*
48 * No locking needed, this must be called via kstop_machine
49 * which in essence is like running on a uniprocessor machine.
50 */
51 return ftrace_replaced_code;
52}
53
54int ftrace_modify_code(unsigned long ip, unsigned char *old_code,
55 unsigned char *new_code)
56{
57 unsigned char replaced[MCOUNT_INSN_SIZE];
58
59 /*
60 * Note: Due to modules and __init, code can
61 * disappear and change, we need to protect against faulting
62 * as well as code changing. We do this by using the
63 * probe_kernel_* functions.
64 *
65 * No real locking needed, this code is run through
66 * kstop_machine, or before SMP starts.
67 */
68
69 /*
70 * If we're trying to nop out a call to a function, we instead
71 * place a call to the address after the memory table.
72 */
73 if (is_sh_nop(new_code) == 0)
74 __raw_writel(ip + MCOUNT_INSN_SIZE, (unsigned long)new_code);
75
76 /* read the text we want to modify */
77 if (probe_kernel_read(replaced, (void *)ip, MCOUNT_INSN_SIZE))
78 return -EFAULT;
79
80 /* Make sure it is what we expect it to be */
81 if (memcmp(replaced, old_code, MCOUNT_INSN_SIZE) != 0)
82 return -EINVAL;
83
84 /* replace the text with the new text */
85 if (probe_kernel_write((void *)ip, new_code, MCOUNT_INSN_SIZE))
86 return -EPERM;
87
88 flush_icache_range(ip, ip + MCOUNT_INSN_SIZE);
89
90 return 0;
91}
92
93int ftrace_update_ftrace_func(ftrace_func_t func)
94{
95 unsigned long ip = (unsigned long)(&ftrace_call);
96 unsigned char old[MCOUNT_INSN_SIZE], *new;
97
98 memcpy(old, (unsigned char *)(ip + MCOUNT_INSN_OFFSET), MCOUNT_INSN_SIZE);
99 new = ftrace_call_replace(ip, (unsigned long)func);
100
101 return ftrace_modify_code(ip + MCOUNT_INSN_OFFSET, old, new);
102}
103
104int ftrace_make_nop(struct module *mod,
105 struct dyn_ftrace *rec, unsigned long addr)
106{
107 unsigned char *new, *old;
108 unsigned long ip = rec->ip;
109
110 old = ftrace_call_replace(ip, addr);
111 new = ftrace_nop_replace();
112
113 return ftrace_modify_code(rec->ip, old, new);
114}
115
116int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
117{
118 unsigned char *new, *old;
119 unsigned long ip = rec->ip;
120
121 old = ftrace_nop_replace();
122 new = ftrace_call_replace(ip, addr);
123
124 return ftrace_modify_code(rec->ip, old, new);
125}
126
127int __init ftrace_dyn_arch_init(void *data)
128{
129 /* The return code is retured via data */
130 __raw_writel(0, (unsigned long)data);
131
132 return 0;
133}
diff --git a/arch/sh/kernel/head_32.S b/arch/sh/kernel/head_32.S
index ae0a382a82eb..788605ff7088 100644
--- a/arch/sh/kernel/head_32.S
+++ b/arch/sh/kernel/head_32.S
@@ -80,8 +80,14 @@ ENTRY(_stext)
80 mov.l 7f, r0 80 mov.l 7f, r0
81 ldc r0, r7_bank ! ... and initial thread_info 81 ldc r0, r7_bank ! ... and initial thread_info
82#endif 82#endif
83 83
84 ! Clear BSS area 84#ifndef CONFIG_SH_NO_BSS_INIT
85 /*
86 * Don't clear BSS if running on slow platforms such as an RTL simulation,
87 * remote memory via SHdebug link, etc. For these the memory can be guaranteed
88 * to be all zero on boot anyway.
89 */
90 ! Clear BSS area
85#ifdef CONFIG_SMP 91#ifdef CONFIG_SMP
86 mov.l 3f, r0 92 mov.l 3f, r0
87 cmp/eq #0, r0 ! skip clear if set to zero 93 cmp/eq #0, r0 ! skip clear if set to zero
@@ -97,6 +103,8 @@ ENTRY(_stext)
97 mov.l r0,@-r2 103 mov.l r0,@-r2
98 104
9910: 10510:
106#endif
107
100 ! Additional CPU initialization 108 ! Additional CPU initialization
101 mov.l 6f, r0 109 mov.l 6f, r0
102 jsr @r0 110 jsr @r0
diff --git a/arch/sh/kernel/idle.c b/arch/sh/kernel/idle.c
new file mode 100644
index 000000000000..fe59ccfc1152
--- /dev/null
+++ b/arch/sh/kernel/idle.c
@@ -0,0 +1,81 @@
1/*
2 * The idle loop for all SuperH platforms.
3 *
4 * Copyright (C) 2002 - 2008 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/module.h>
11#include <linux/init.h>
12#include <linux/mm.h>
13#include <linux/pm.h>
14#include <linux/tick.h>
15#include <linux/preempt.h>
16#include <linux/thread_info.h>
17#include <linux/irqflags.h>
18#include <asm/pgalloc.h>
19#include <asm/system.h>
20#include <asm/atomic.h>
21
22static int hlt_counter;
23void (*pm_idle)(void);
24void (*pm_power_off)(void);
25EXPORT_SYMBOL(pm_power_off);
26
27static int __init nohlt_setup(char *__unused)
28{
29 hlt_counter = 1;
30 return 1;
31}
32__setup("nohlt", nohlt_setup);
33
34static int __init hlt_setup(char *__unused)
35{
36 hlt_counter = 0;
37 return 1;
38}
39__setup("hlt", hlt_setup);
40
41static void default_idle(void)
42{
43 if (!hlt_counter) {
44 clear_thread_flag(TIF_POLLING_NRFLAG);
45 smp_mb__after_clear_bit();
46 set_bl_bit();
47 stop_critical_timings();
48
49 while (!need_resched())
50 cpu_sleep();
51
52 start_critical_timings();
53 clear_bl_bit();
54 set_thread_flag(TIF_POLLING_NRFLAG);
55 } else
56 while (!need_resched())
57 cpu_relax();
58}
59
60void cpu_idle(void)
61{
62 set_thread_flag(TIF_POLLING_NRFLAG);
63
64 /* endless idle loop with no priority at all */
65 while (1) {
66 void (*idle)(void) = pm_idle;
67
68 if (!idle)
69 idle = default_idle;
70
71 tick_nohz_stop_sched_tick(1);
72 while (!need_resched())
73 idle();
74 tick_nohz_restart_sched_tick();
75
76 preempt_enable_no_resched();
77 schedule();
78 preempt_disable();
79 check_pgt_cache();
80 }
81}
diff --git a/arch/sh/kernel/init_task.c b/arch/sh/kernel/init_task.c
index b151a25cb14d..80c35ff71d56 100644
--- a/arch/sh/kernel/init_task.c
+++ b/arch/sh/kernel/init_task.c
@@ -7,7 +7,6 @@
7#include <asm/uaccess.h> 7#include <asm/uaccess.h>
8#include <asm/pgtable.h> 8#include <asm/pgtable.h>
9 9
10static struct fs_struct init_fs = INIT_FS;
11static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 10static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
12static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 11static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
13struct pt_regs fake_swapper_regs; 12struct pt_regs fake_swapper_regs;
diff --git a/arch/sh/kernel/kgdb.c b/arch/sh/kernel/kgdb.c
new file mode 100644
index 000000000000..7c747e7d71b8
--- /dev/null
+++ b/arch/sh/kernel/kgdb.c
@@ -0,0 +1,285 @@
1/*
2 * SuperH KGDB support
3 *
4 * Copyright (C) 2008 Paul Mundt
5 *
6 * Single stepping taken from the old stub by Henry Bell and Jeremy Siegel.
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/kgdb.h>
13#include <linux/kdebug.h>
14#include <linux/irq.h>
15#include <linux/io.h>
16#include <asm/cacheflush.h>
17
18char in_nmi = 0; /* Set during NMI to prevent re-entry */
19
20/* Macros for single step instruction identification */
21#define OPCODE_BT(op) (((op) & 0xff00) == 0x8900)
22#define OPCODE_BF(op) (((op) & 0xff00) == 0x8b00)
23#define OPCODE_BTF_DISP(op) (((op) & 0x80) ? (((op) | 0xffffff80) << 1) : \
24 (((op) & 0x7f ) << 1))
25#define OPCODE_BFS(op) (((op) & 0xff00) == 0x8f00)
26#define OPCODE_BTS(op) (((op) & 0xff00) == 0x8d00)
27#define OPCODE_BRA(op) (((op) & 0xf000) == 0xa000)
28#define OPCODE_BRA_DISP(op) (((op) & 0x800) ? (((op) | 0xfffff800) << 1) : \
29 (((op) & 0x7ff) << 1))
30#define OPCODE_BRAF(op) (((op) & 0xf0ff) == 0x0023)
31#define OPCODE_BRAF_REG(op) (((op) & 0x0f00) >> 8)
32#define OPCODE_BSR(op) (((op) & 0xf000) == 0xb000)
33#define OPCODE_BSR_DISP(op) (((op) & 0x800) ? (((op) | 0xfffff800) << 1) : \
34 (((op) & 0x7ff) << 1))
35#define OPCODE_BSRF(op) (((op) & 0xf0ff) == 0x0003)
36#define OPCODE_BSRF_REG(op) (((op) >> 8) & 0xf)
37#define OPCODE_JMP(op) (((op) & 0xf0ff) == 0x402b)
38#define OPCODE_JMP_REG(op) (((op) >> 8) & 0xf)
39#define OPCODE_JSR(op) (((op) & 0xf0ff) == 0x400b)
40#define OPCODE_JSR_REG(op) (((op) >> 8) & 0xf)
41#define OPCODE_RTS(op) ((op) == 0xb)
42#define OPCODE_RTE(op) ((op) == 0x2b)
43
44#define SR_T_BIT_MASK 0x1
45#define STEP_OPCODE 0xc33d
46
47/* Calculate the new address for after a step */
48static short *get_step_address(struct pt_regs *linux_regs)
49{
50 opcode_t op = __raw_readw(linux_regs->pc);
51 long addr;
52
53 /* BT */
54 if (OPCODE_BT(op)) {
55 if (linux_regs->sr & SR_T_BIT_MASK)
56 addr = linux_regs->pc + 4 + OPCODE_BTF_DISP(op);
57 else
58 addr = linux_regs->pc + 2;
59 }
60
61 /* BTS */
62 else if (OPCODE_BTS(op)) {
63 if (linux_regs->sr & SR_T_BIT_MASK)
64 addr = linux_regs->pc + 4 + OPCODE_BTF_DISP(op);
65 else
66 addr = linux_regs->pc + 4; /* Not in delay slot */
67 }
68
69 /* BF */
70 else if (OPCODE_BF(op)) {
71 if (!(linux_regs->sr & SR_T_BIT_MASK))
72 addr = linux_regs->pc + 4 + OPCODE_BTF_DISP(op);
73 else
74 addr = linux_regs->pc + 2;
75 }
76
77 /* BFS */
78 else if (OPCODE_BFS(op)) {
79 if (!(linux_regs->sr & SR_T_BIT_MASK))
80 addr = linux_regs->pc + 4 + OPCODE_BTF_DISP(op);
81 else
82 addr = linux_regs->pc + 4; /* Not in delay slot */
83 }
84
85 /* BRA */
86 else if (OPCODE_BRA(op))
87 addr = linux_regs->pc + 4 + OPCODE_BRA_DISP(op);
88
89 /* BRAF */
90 else if (OPCODE_BRAF(op))
91 addr = linux_regs->pc + 4
92 + linux_regs->regs[OPCODE_BRAF_REG(op)];
93
94 /* BSR */
95 else if (OPCODE_BSR(op))
96 addr = linux_regs->pc + 4 + OPCODE_BSR_DISP(op);
97
98 /* BSRF */
99 else if (OPCODE_BSRF(op))
100 addr = linux_regs->pc + 4
101 + linux_regs->regs[OPCODE_BSRF_REG(op)];
102
103 /* JMP */
104 else if (OPCODE_JMP(op))
105 addr = linux_regs->regs[OPCODE_JMP_REG(op)];
106
107 /* JSR */
108 else if (OPCODE_JSR(op))
109 addr = linux_regs->regs[OPCODE_JSR_REG(op)];
110
111 /* RTS */
112 else if (OPCODE_RTS(op))
113 addr = linux_regs->pr;
114
115 /* RTE */
116 else if (OPCODE_RTE(op))
117 addr = linux_regs->regs[15];
118
119 /* Other */
120 else
121 addr = linux_regs->pc + instruction_size(op);
122
123 flush_icache_range(addr, addr + instruction_size(op));
124 return (short *)addr;
125}
126
127/*
128 * Replace the instruction immediately after the current instruction
129 * (i.e. next in the expected flow of control) with a trap instruction,
130 * so that returning will cause only a single instruction to be executed.
131 * Note that this model is slightly broken for instructions with delay
132 * slots (e.g. B[TF]S, BSR, BRA etc), where both the branch and the
133 * instruction in the delay slot will be executed.
134 */
135
136static unsigned long stepped_address;
137static opcode_t stepped_opcode;
138
139static void do_single_step(struct pt_regs *linux_regs)
140{
141 /* Determine where the target instruction will send us to */
142 unsigned short *addr = get_step_address(linux_regs);
143
144 stepped_address = (int)addr;
145
146 /* Replace it */
147 stepped_opcode = __raw_readw((long)addr);
148 *addr = STEP_OPCODE;
149
150 /* Flush and return */
151 flush_icache_range((long)addr, (long)addr +
152 instruction_size(stepped_opcode));
153}
154
155/* Undo a single step */
156static void undo_single_step(struct pt_regs *linux_regs)
157{
158 /* If we have stepped, put back the old instruction */
159 /* Use stepped_address in case we stopped elsewhere */
160 if (stepped_opcode != 0) {
161 __raw_writew(stepped_opcode, stepped_address);
162 flush_icache_range(stepped_address, stepped_address + 2);
163 }
164
165 stepped_opcode = 0;
166}
167
168void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
169{
170 int i;
171
172 for (i = 0; i < 16; i++)
173 gdb_regs[GDB_R0 + i] = regs->regs[i];
174
175 gdb_regs[GDB_PC] = regs->pc;
176 gdb_regs[GDB_PR] = regs->pr;
177 gdb_regs[GDB_SR] = regs->sr;
178 gdb_regs[GDB_GBR] = regs->gbr;
179 gdb_regs[GDB_MACH] = regs->mach;
180 gdb_regs[GDB_MACL] = regs->macl;
181
182 __asm__ __volatile__ ("stc vbr, %0" : "=r" (gdb_regs[GDB_VBR]));
183}
184
185void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
186{
187 int i;
188
189 for (i = 0; i < 16; i++)
190 regs->regs[GDB_R0 + i] = gdb_regs[GDB_R0 + i];
191
192 regs->pc = gdb_regs[GDB_PC];
193 regs->pr = gdb_regs[GDB_PR];
194 regs->sr = gdb_regs[GDB_SR];
195 regs->gbr = gdb_regs[GDB_GBR];
196 regs->mach = gdb_regs[GDB_MACH];
197 regs->macl = gdb_regs[GDB_MACL];
198
199 __asm__ __volatile__ ("ldc %0, vbr" : : "r" (gdb_regs[GDB_VBR]));
200}
201
202void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
203{
204 gdb_regs[GDB_R15] = p->thread.sp;
205 gdb_regs[GDB_PC] = p->thread.pc;
206}
207
208int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
209 char *remcomInBuffer, char *remcomOutBuffer,
210 struct pt_regs *linux_regs)
211{
212 unsigned long addr;
213 char *ptr;
214
215 /* Undo any stepping we may have done */
216 undo_single_step(linux_regs);
217
218 switch (remcomInBuffer[0]) {
219 case 'c':
220 case 's':
221 /* try to read optional parameter, pc unchanged if no parm */
222 ptr = &remcomInBuffer[1];
223 if (kgdb_hex2long(&ptr, &addr))
224 linux_regs->pc = addr;
225 case 'D':
226 case 'k':
227 atomic_set(&kgdb_cpu_doing_single_step, -1);
228
229 if (remcomInBuffer[0] == 's') {
230 do_single_step(linux_regs);
231 kgdb_single_step = 1;
232
233 atomic_set(&kgdb_cpu_doing_single_step,
234 raw_smp_processor_id());
235 }
236
237 return 0;
238 }
239
240 /* this means that we do not want to exit from the handler: */
241 return -1;
242}
243
244/*
245 * The primary entry points for the kgdb debug trap table entries.
246 */
247BUILD_TRAP_HANDLER(singlestep)
248{
249 unsigned long flags;
250 TRAP_HANDLER_DECL;
251
252 local_irq_save(flags);
253 regs->pc -= instruction_size(__raw_readw(regs->pc - 4));
254 kgdb_handle_exception(vec >> 2, SIGTRAP, 0, regs);
255 local_irq_restore(flags);
256}
257
258
259BUILD_TRAP_HANDLER(breakpoint)
260{
261 unsigned long flags;
262 TRAP_HANDLER_DECL;
263
264 local_irq_save(flags);
265 kgdb_handle_exception(vec >> 2, SIGTRAP, 0, regs);
266 local_irq_restore(flags);
267}
268
269int kgdb_arch_init(void)
270{
271 return 0;
272}
273
274void kgdb_arch_exit(void)
275{
276}
277
278struct kgdb_arch arch_kgdb_ops = {
279 /* Breakpoint instruction: trapa #0x3c */
280#ifdef CONFIG_CPU_LITTLE_ENDIAN
281 .gdb_bpt_instr = { 0x3c, 0xc3 },
282#else
283 .gdb_bpt_instr = { 0xc3, 0x3c },
284#endif
285};
diff --git a/arch/sh/kernel/kgdb_jmp.S b/arch/sh/kernel/kgdb_jmp.S
deleted file mode 100644
index 339bb1d7ff0b..000000000000
--- a/arch/sh/kernel/kgdb_jmp.S
+++ /dev/null
@@ -1,33 +0,0 @@
1#include <linux/linkage.h>
2
3ENTRY(setjmp)
4 add #(9*4), r4
5 sts.l pr, @-r4
6 mov.l r15, @-r4
7 mov.l r14, @-r4
8 mov.l r13, @-r4
9 mov.l r12, @-r4
10 mov.l r11, @-r4
11 mov.l r10, @-r4
12 mov.l r9, @-r4
13 mov.l r8, @-r4
14 rts
15 mov #0, r0
16
17ENTRY(longjmp)
18 mov.l @r4+, r8
19 mov.l @r4+, r9
20 mov.l @r4+, r10
21 mov.l @r4+, r11
22 mov.l @r4+, r12
23 mov.l @r4+, r13
24 mov.l @r4+, r14
25 mov.l @r4+, r15
26 lds.l @r4+, pr
27 mov r5, r0
28 tst r0, r0
29 bf 1f
30 mov #1, r0 ! in case val==0
311: rts
32 nop
33
diff --git a/arch/sh/kernel/kgdb_stub.c b/arch/sh/kernel/kgdb_stub.c
deleted file mode 100644
index bf8ac4c71640..000000000000
--- a/arch/sh/kernel/kgdb_stub.c
+++ /dev/null
@@ -1,1052 +0,0 @@
1/*
2 * May be copied or modified under the terms of the GNU General Public
3 * License. See linux/COPYING for more information.
4 *
5 * Contains extracts from code by Glenn Engel, Jim Kingdon,
6 * David Grothe <dave@gcom.com>, Tigran Aivazian <tigran@sco.com>,
7 * Amit S. Kale <akale@veritas.com>, William Gatliff <bgat@open-widgets.com>,
8 * Ben Lee, Steve Chamberlain and Benoit Miller <fulg@iname.com>.
9 *
10 * This version by Henry Bell <henry.bell@st.com>
11 * Minor modifications by Jeremy Siegel <jsiegel@mvista.com>
12 *
13 * Contains low-level support for remote debug using GDB.
14 *
15 * To enable debugger support, two things need to happen. A call to
16 * set_debug_traps() is necessary in order to allow any breakpoints
17 * or error conditions to be properly intercepted and reported to gdb.
18 * A breakpoint also needs to be generated to begin communication. This
19 * is most easily accomplished by a call to breakpoint() which does
20 * a trapa if the initialisation phase has been successfully completed.
21 *
22 * In this case, set_debug_traps() is not used to "take over" exceptions;
23 * other kernel code is modified instead to enter the kgdb functions here
24 * when appropriate (see entry.S for breakpoint traps and NMI interrupts,
25 * see traps.c for kernel error exceptions).
26 *
27 * The following gdb commands are supported:
28 *
29 * Command Function Return value
30 *
31 * g return the value of the CPU registers hex data or ENN
32 * G set the value of the CPU registers OK or ENN
33 *
34 * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN
35 * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN
36 * XAA..AA,LLLL: Same, but data is binary (not hex) OK or ENN
37 *
38 * c Resume at current address SNN ( signal NN)
39 * cAA..AA Continue at address AA..AA SNN
40 * CNN; Resume at current address with signal SNN
41 * CNN;AA..AA Resume at address AA..AA with signal SNN
42 *
43 * s Step one instruction SNN
44 * sAA..AA Step one instruction from AA..AA SNN
45 * SNN; Step one instruction with signal SNN
46 * SNNAA..AA Step one instruction from AA..AA w/NN SNN
47 *
48 * k kill (Detach GDB)
49 *
50 * d Toggle debug flag
51 * D Detach GDB
52 *
53 * Hct Set thread t for operations, OK or ENN
54 * c = 'c' (step, cont), c = 'g' (other
55 * operations)
56 *
57 * qC Query current thread ID QCpid
58 * qfThreadInfo Get list of current threads (first) m<id>
59 * qsThreadInfo " " " " " (subsequent)
60 * qOffsets Get section offsets Text=x;Data=y;Bss=z
61 *
62 * TXX Find if thread XX is alive OK or ENN
63 * ? What was the last sigval ? SNN (signal NN)
64 * O Output to GDB console
65 *
66 * Remote communication protocol.
67 *
68 * A debug packet whose contents are <data> is encapsulated for
69 * transmission in the form:
70 *
71 * $ <data> # CSUM1 CSUM2
72 *
73 * <data> must be ASCII alphanumeric and cannot include characters
74 * '$' or '#'. If <data> starts with two characters followed by
75 * ':', then the existing stubs interpret this as a sequence number.
76 *
77 * CSUM1 and CSUM2 are ascii hex representation of an 8-bit
78 * checksum of <data>, the most significant nibble is sent first.
79 * the hex digits 0-9,a-f are used.
80 *
81 * Receiver responds with:
82 *
83 * + - if CSUM is correct and ready for next packet
84 * - - if CSUM is incorrect
85 *
86 * Responses can be run-length encoded to save space. A '*' means that
87 * the next character is an ASCII encoding giving a repeat count which
88 * stands for that many repetitions of the character preceding the '*'.
89 * The encoding is n+29, yielding a printable character where n >=3
90 * (which is where RLE starts to win). Don't use an n > 126.
91 *
92 * So "0* " means the same as "0000".
93 */
94
95#include <linux/string.h>
96#include <linux/kernel.h>
97#include <linux/sched.h>
98#include <linux/smp.h>
99#include <linux/spinlock.h>
100#include <linux/delay.h>
101#include <linux/linkage.h>
102#include <linux/init.h>
103#include <linux/console.h>
104#include <linux/sysrq.h>
105#include <linux/module.h>
106#include <asm/system.h>
107#include <asm/cacheflush.h>
108#include <asm/current.h>
109#include <asm/signal.h>
110#include <asm/pgtable.h>
111#include <asm/ptrace.h>
112#include <asm/kgdb.h>
113#include <asm/io.h>
114
115/* Function pointers for linkage */
116kgdb_debug_hook_t *kgdb_debug_hook;
117kgdb_bus_error_hook_t *kgdb_bus_err_hook;
118
119int (*kgdb_getchar)(void);
120EXPORT_SYMBOL_GPL(kgdb_getchar);
121void (*kgdb_putchar)(int);
122EXPORT_SYMBOL_GPL(kgdb_putchar);
123
124static void put_debug_char(int c)
125{
126 if (!kgdb_putchar)
127 return;
128 (*kgdb_putchar)(c);
129}
130static int get_debug_char(void)
131{
132 if (!kgdb_getchar)
133 return -1;
134 return (*kgdb_getchar)();
135}
136
137/* Num chars in in/out bound buffers, register packets need NUMREGBYTES * 2 */
138#define BUFMAX 1024
139#define NUMREGBYTES (MAXREG*4)
140#define OUTBUFMAX (NUMREGBYTES*2+512)
141
142enum {
143 R0 = 0, R1, R2, R3, R4, R5, R6, R7,
144 R8, R9, R10, R11, R12, R13, R14, R15,
145 PC, PR, GBR, VBR, MACH, MACL, SR,
146 /* */
147 MAXREG
148};
149
150static unsigned int registers[MAXREG];
151struct kgdb_regs trap_registers;
152
153char kgdb_in_gdb_mode;
154char in_nmi; /* Set during NMI to prevent reentry */
155int kgdb_nofault; /* Boolean to ignore bus errs (i.e. in GDB) */
156
157/* Default values for SCI (can override via kernel args in setup.c) */
158#ifndef CONFIG_KGDB_DEFPORT
159#define CONFIG_KGDB_DEFPORT 1
160#endif
161
162#ifndef CONFIG_KGDB_DEFBAUD
163#define CONFIG_KGDB_DEFBAUD 115200
164#endif
165
166#if defined(CONFIG_KGDB_DEFPARITY_E)
167#define CONFIG_KGDB_DEFPARITY 'E'
168#elif defined(CONFIG_KGDB_DEFPARITY_O)
169#define CONFIG_KGDB_DEFPARITY 'O'
170#else /* CONFIG_KGDB_DEFPARITY_N */
171#define CONFIG_KGDB_DEFPARITY 'N'
172#endif
173
174#ifdef CONFIG_KGDB_DEFBITS_7
175#define CONFIG_KGDB_DEFBITS '7'
176#else /* CONFIG_KGDB_DEFBITS_8 */
177#define CONFIG_KGDB_DEFBITS '8'
178#endif
179
180/* SCI/UART settings, used in kgdb_console_setup() */
181int kgdb_portnum = CONFIG_KGDB_DEFPORT;
182EXPORT_SYMBOL_GPL(kgdb_portnum);
183int kgdb_baud = CONFIG_KGDB_DEFBAUD;
184EXPORT_SYMBOL_GPL(kgdb_baud);
185char kgdb_parity = CONFIG_KGDB_DEFPARITY;
186EXPORT_SYMBOL_GPL(kgdb_parity);
187char kgdb_bits = CONFIG_KGDB_DEFBITS;
188EXPORT_SYMBOL_GPL(kgdb_bits);
189
190/* Jump buffer for setjmp/longjmp */
191static jmp_buf rem_com_env;
192
193/* TRA differs sh3/4 */
194#if defined(CONFIG_CPU_SH3)
195#define TRA 0xffffffd0
196#elif defined(CONFIG_CPU_SH4)
197#define TRA 0xff000020
198#endif
199
200/* Macros for single step instruction identification */
201#define OPCODE_BT(op) (((op) & 0xff00) == 0x8900)
202#define OPCODE_BF(op) (((op) & 0xff00) == 0x8b00)
203#define OPCODE_BTF_DISP(op) (((op) & 0x80) ? (((op) | 0xffffff80) << 1) : \
204 (((op) & 0x7f ) << 1))
205#define OPCODE_BFS(op) (((op) & 0xff00) == 0x8f00)
206#define OPCODE_BTS(op) (((op) & 0xff00) == 0x8d00)
207#define OPCODE_BRA(op) (((op) & 0xf000) == 0xa000)
208#define OPCODE_BRA_DISP(op) (((op) & 0x800) ? (((op) | 0xfffff800) << 1) : \
209 (((op) & 0x7ff) << 1))
210#define OPCODE_BRAF(op) (((op) & 0xf0ff) == 0x0023)
211#define OPCODE_BRAF_REG(op) (((op) & 0x0f00) >> 8)
212#define OPCODE_BSR(op) (((op) & 0xf000) == 0xb000)
213#define OPCODE_BSR_DISP(op) (((op) & 0x800) ? (((op) | 0xfffff800) << 1) : \
214 (((op) & 0x7ff) << 1))
215#define OPCODE_BSRF(op) (((op) & 0xf0ff) == 0x0003)
216#define OPCODE_BSRF_REG(op) (((op) >> 8) & 0xf)
217#define OPCODE_JMP(op) (((op) & 0xf0ff) == 0x402b)
218#define OPCODE_JMP_REG(op) (((op) >> 8) & 0xf)
219#define OPCODE_JSR(op) (((op) & 0xf0ff) == 0x400b)
220#define OPCODE_JSR_REG(op) (((op) >> 8) & 0xf)
221#define OPCODE_RTS(op) ((op) == 0xb)
222#define OPCODE_RTE(op) ((op) == 0x2b)
223
224#define SR_T_BIT_MASK 0x1
225#define STEP_OPCODE 0xc320
226#define BIOS_CALL_TRAP 0x3f
227
228/* Exception codes as per SH-4 core manual */
229#define ADDRESS_ERROR_LOAD_VEC 7
230#define ADDRESS_ERROR_STORE_VEC 8
231#define TRAP_VEC 11
232#define INVALID_INSN_VEC 12
233#define INVALID_SLOT_VEC 13
234#define NMI_VEC 14
235#define USER_BREAK_VEC 15
236#define SERIAL_BREAK_VEC 58
237
238/* Misc static */
239static int stepped_address;
240static short stepped_opcode;
241static char in_buffer[BUFMAX];
242static char out_buffer[OUTBUFMAX];
243
244static void kgdb_to_gdb(const char *s);
245
246/* Convert ch to hex */
247static int hex(const char ch)
248{
249 if ((ch >= 'a') && (ch <= 'f'))
250 return (ch - 'a' + 10);
251 if ((ch >= '0') && (ch <= '9'))
252 return (ch - '0');
253 if ((ch >= 'A') && (ch <= 'F'))
254 return (ch - 'A' + 10);
255 return (-1);
256}
257
258/* Convert the memory pointed to by mem into hex, placing result in buf.
259 Returns a pointer to the last char put in buf (null) */
260static char *mem_to_hex(const char *mem, char *buf, const int count)
261{
262 int i;
263 int ch;
264 unsigned short s_val;
265 unsigned long l_val;
266
267 /* Check for 16 or 32 */
268 if (count == 2 && ((long) mem & 1) == 0) {
269 s_val = *(unsigned short *) mem;
270 mem = (char *) &s_val;
271 } else if (count == 4 && ((long) mem & 3) == 0) {
272 l_val = *(unsigned long *) mem;
273 mem = (char *) &l_val;
274 }
275 for (i = 0; i < count; i++) {
276 ch = *mem++;
277 buf = pack_hex_byte(buf, ch);
278 }
279 *buf = 0;
280 return (buf);
281}
282
283/* Convert the hex array pointed to by buf into binary, to be placed in mem.
284 Return a pointer to the character after the last byte written */
285static char *hex_to_mem(const char *buf, char *mem, const int count)
286{
287 int i;
288 unsigned char ch;
289
290 for (i = 0; i < count; i++) {
291 ch = hex(*buf++) << 4;
292 ch = ch + hex(*buf++);
293 *mem++ = ch;
294 }
295 return (mem);
296}
297
298/* While finding valid hex chars, convert to an integer, then return it */
299static int hex_to_int(char **ptr, int *int_value)
300{
301 int num_chars = 0;
302 int hex_value;
303
304 *int_value = 0;
305
306 while (**ptr) {
307 hex_value = hex(**ptr);
308 if (hex_value >= 0) {
309 *int_value = (*int_value << 4) | hex_value;
310 num_chars++;
311 } else
312 break;
313 (*ptr)++;
314 }
315 return num_chars;
316}
317
318/* Copy the binary array pointed to by buf into mem. Fix $, #,
319 and 0x7d escaped with 0x7d. Return a pointer to the character
320 after the last byte written. */
321static char *ebin_to_mem(const char *buf, char *mem, int count)
322{
323 for (; count > 0; count--, buf++) {
324 if (*buf == 0x7d)
325 *mem++ = *(++buf) ^ 0x20;
326 else
327 *mem++ = *buf;
328 }
329 return mem;
330}
331
332/* Scan for the start char '$', read the packet and check the checksum */
333static void get_packet(char *buffer, int buflen)
334{
335 unsigned char checksum;
336 unsigned char xmitcsum;
337 int i;
338 int count;
339 char ch;
340
341 do {
342 /* Ignore everything until the start character */
343 while ((ch = get_debug_char()) != '$');
344
345 checksum = 0;
346 xmitcsum = -1;
347 count = 0;
348
349 /* Now, read until a # or end of buffer is found */
350 while (count < (buflen - 1)) {
351 ch = get_debug_char();
352
353 if (ch == '#')
354 break;
355
356 checksum = checksum + ch;
357 buffer[count] = ch;
358 count = count + 1;
359 }
360
361 buffer[count] = 0;
362
363 /* Continue to read checksum following # */
364 if (ch == '#') {
365 xmitcsum = hex(get_debug_char()) << 4;
366 xmitcsum += hex(get_debug_char());
367
368 /* Checksum */
369 if (checksum != xmitcsum)
370 put_debug_char('-'); /* Failed checksum */
371 else {
372 /* Ack successful transfer */
373 put_debug_char('+');
374
375 /* If a sequence char is present, reply
376 the sequence ID */
377 if (buffer[2] == ':') {
378 put_debug_char(buffer[0]);
379 put_debug_char(buffer[1]);
380
381 /* Remove sequence chars from buffer */
382 count = strlen(buffer);
383 for (i = 3; i <= count; i++)
384 buffer[i - 3] = buffer[i];
385 }
386 }
387 }
388 }
389 while (checksum != xmitcsum); /* Keep trying while we fail */
390}
391
392/* Send the packet in the buffer with run-length encoding */
393static void put_packet(char *buffer)
394{
395 int checksum;
396 char *src;
397 int runlen;
398 int encode;
399
400 do {
401 src = buffer;
402 put_debug_char('$');
403 checksum = 0;
404
405 /* Continue while we still have chars left */
406 while (*src) {
407 /* Check for runs up to 99 chars long */
408 for (runlen = 1; runlen < 99; runlen++) {
409 if (src[0] != src[runlen])
410 break;
411 }
412
413 if (runlen > 3) {
414 /* Got a useful amount, send encoding */
415 encode = runlen + ' ' - 4;
416 put_debug_char(*src); checksum += *src;
417 put_debug_char('*'); checksum += '*';
418 put_debug_char(encode); checksum += encode;
419 src += runlen;
420 } else {
421 /* Otherwise just send the current char */
422 put_debug_char(*src); checksum += *src;
423 src += 1;
424 }
425 }
426
427 /* '#' Separator, put high and low components of checksum */
428 put_debug_char('#');
429 put_debug_char(hex_asc_hi(checksum));
430 put_debug_char(hex_asc_lo(checksum));
431 }
432 while ((get_debug_char()) != '+'); /* While no ack */
433}
434
435/* A bus error has occurred - perform a longjmp to return execution and
436 allow handling of the error */
437static void kgdb_handle_bus_error(void)
438{
439 longjmp(rem_com_env, 1);
440}
441
442/* Translate SH-3/4 exception numbers to unix-like signal values */
443static int compute_signal(const int excep_code)
444{
445 int sigval;
446
447 switch (excep_code) {
448
449 case INVALID_INSN_VEC:
450 case INVALID_SLOT_VEC:
451 sigval = SIGILL;
452 break;
453 case ADDRESS_ERROR_LOAD_VEC:
454 case ADDRESS_ERROR_STORE_VEC:
455 sigval = SIGSEGV;
456 break;
457
458 case SERIAL_BREAK_VEC:
459 case NMI_VEC:
460 sigval = SIGINT;
461 break;
462
463 case USER_BREAK_VEC:
464 case TRAP_VEC:
465 sigval = SIGTRAP;
466 break;
467
468 default:
469 sigval = SIGBUS; /* "software generated" */
470 break;
471 }
472
473 return (sigval);
474}
475
476/* Make a local copy of the registers passed into the handler (bletch) */
477static void kgdb_regs_to_gdb_regs(const struct kgdb_regs *regs,
478 int *gdb_regs)
479{
480 gdb_regs[R0] = regs->regs[R0];
481 gdb_regs[R1] = regs->regs[R1];
482 gdb_regs[R2] = regs->regs[R2];
483 gdb_regs[R3] = regs->regs[R3];
484 gdb_regs[R4] = regs->regs[R4];
485 gdb_regs[R5] = regs->regs[R5];
486 gdb_regs[R6] = regs->regs[R6];
487 gdb_regs[R7] = regs->regs[R7];
488 gdb_regs[R8] = regs->regs[R8];
489 gdb_regs[R9] = regs->regs[R9];
490 gdb_regs[R10] = regs->regs[R10];
491 gdb_regs[R11] = regs->regs[R11];
492 gdb_regs[R12] = regs->regs[R12];
493 gdb_regs[R13] = regs->regs[R13];
494 gdb_regs[R14] = regs->regs[R14];
495 gdb_regs[R15] = regs->regs[R15];
496 gdb_regs[PC] = regs->pc;
497 gdb_regs[PR] = regs->pr;
498 gdb_regs[GBR] = regs->gbr;
499 gdb_regs[MACH] = regs->mach;
500 gdb_regs[MACL] = regs->macl;
501 gdb_regs[SR] = regs->sr;
502 gdb_regs[VBR] = regs->vbr;
503}
504
505/* Copy local gdb registers back to kgdb regs, for later copy to kernel */
506static void gdb_regs_to_kgdb_regs(const int *gdb_regs,
507 struct kgdb_regs *regs)
508{
509 regs->regs[R0] = gdb_regs[R0];
510 regs->regs[R1] = gdb_regs[R1];
511 regs->regs[R2] = gdb_regs[R2];
512 regs->regs[R3] = gdb_regs[R3];
513 regs->regs[R4] = gdb_regs[R4];
514 regs->regs[R5] = gdb_regs[R5];
515 regs->regs[R6] = gdb_regs[R6];
516 regs->regs[R7] = gdb_regs[R7];
517 regs->regs[R8] = gdb_regs[R8];
518 regs->regs[R9] = gdb_regs[R9];
519 regs->regs[R10] = gdb_regs[R10];
520 regs->regs[R11] = gdb_regs[R11];
521 regs->regs[R12] = gdb_regs[R12];
522 regs->regs[R13] = gdb_regs[R13];
523 regs->regs[R14] = gdb_regs[R14];
524 regs->regs[R15] = gdb_regs[R15];
525 regs->pc = gdb_regs[PC];
526 regs->pr = gdb_regs[PR];
527 regs->gbr = gdb_regs[GBR];
528 regs->mach = gdb_regs[MACH];
529 regs->macl = gdb_regs[MACL];
530 regs->sr = gdb_regs[SR];
531 regs->vbr = gdb_regs[VBR];
532}
533
534/* Calculate the new address for after a step */
535static short *get_step_address(void)
536{
537 short op = *(short *) trap_registers.pc;
538 long addr;
539
540 /* BT */
541 if (OPCODE_BT(op)) {
542 if (trap_registers.sr & SR_T_BIT_MASK)
543 addr = trap_registers.pc + 4 + OPCODE_BTF_DISP(op);
544 else
545 addr = trap_registers.pc + 2;
546 }
547
548 /* BTS */
549 else if (OPCODE_BTS(op)) {
550 if (trap_registers.sr & SR_T_BIT_MASK)
551 addr = trap_registers.pc + 4 + OPCODE_BTF_DISP(op);
552 else
553 addr = trap_registers.pc + 4; /* Not in delay slot */
554 }
555
556 /* BF */
557 else if (OPCODE_BF(op)) {
558 if (!(trap_registers.sr & SR_T_BIT_MASK))
559 addr = trap_registers.pc + 4 + OPCODE_BTF_DISP(op);
560 else
561 addr = trap_registers.pc + 2;
562 }
563
564 /* BFS */
565 else if (OPCODE_BFS(op)) {
566 if (!(trap_registers.sr & SR_T_BIT_MASK))
567 addr = trap_registers.pc + 4 + OPCODE_BTF_DISP(op);
568 else
569 addr = trap_registers.pc + 4; /* Not in delay slot */
570 }
571
572 /* BRA */
573 else if (OPCODE_BRA(op))
574 addr = trap_registers.pc + 4 + OPCODE_BRA_DISP(op);
575
576 /* BRAF */
577 else if (OPCODE_BRAF(op))
578 addr = trap_registers.pc + 4
579 + trap_registers.regs[OPCODE_BRAF_REG(op)];
580
581 /* BSR */
582 else if (OPCODE_BSR(op))
583 addr = trap_registers.pc + 4 + OPCODE_BSR_DISP(op);
584
585 /* BSRF */
586 else if (OPCODE_BSRF(op))
587 addr = trap_registers.pc + 4
588 + trap_registers.regs[OPCODE_BSRF_REG(op)];
589
590 /* JMP */
591 else if (OPCODE_JMP(op))
592 addr = trap_registers.regs[OPCODE_JMP_REG(op)];
593
594 /* JSR */
595 else if (OPCODE_JSR(op))
596 addr = trap_registers.regs[OPCODE_JSR_REG(op)];
597
598 /* RTS */
599 else if (OPCODE_RTS(op))
600 addr = trap_registers.pr;
601
602 /* RTE */
603 else if (OPCODE_RTE(op))
604 addr = trap_registers.regs[15];
605
606 /* Other */
607 else
608 addr = trap_registers.pc + 2;
609
610 flush_icache_range(addr, addr + 2);
611 return (short *) addr;
612}
613
614/* Set up a single-step. Replace the instruction immediately after the
615 current instruction (i.e. next in the expected flow of control) with a
616 trap instruction, so that returning will cause only a single instruction
617 to be executed. Note that this model is slightly broken for instructions
618 with delay slots (e.g. B[TF]S, BSR, BRA etc), where both the branch
619 and the instruction in the delay slot will be executed. */
620static void do_single_step(void)
621{
622 unsigned short *addr = 0;
623
624 /* Determine where the target instruction will send us to */
625 addr = get_step_address();
626 stepped_address = (int)addr;
627
628 /* Replace it */
629 stepped_opcode = *(short *)addr;
630 *addr = STEP_OPCODE;
631
632 /* Flush and return */
633 flush_icache_range((long) addr, (long) addr + 2);
634}
635
636/* Undo a single step */
637static void undo_single_step(void)
638{
639 /* If we have stepped, put back the old instruction */
640 /* Use stepped_address in case we stopped elsewhere */
641 if (stepped_opcode != 0) {
642 *(short*)stepped_address = stepped_opcode;
643 flush_icache_range(stepped_address, stepped_address + 2);
644 }
645 stepped_opcode = 0;
646}
647
648/* Send a signal message */
649static void send_signal_msg(const int signum)
650{
651 out_buffer[0] = 'S';
652 out_buffer[1] = hex_asc_hi(signum);
653 out_buffer[2] = hex_asc_lo(signum);
654 out_buffer[3] = 0;
655 put_packet(out_buffer);
656}
657
658/* Reply that all was well */
659static void send_ok_msg(void)
660{
661 strcpy(out_buffer, "OK");
662 put_packet(out_buffer);
663}
664
665/* Reply that an error occurred */
666static void send_err_msg(void)
667{
668 strcpy(out_buffer, "E01");
669 put_packet(out_buffer);
670}
671
672/* Empty message indicates unrecognised command */
673static void send_empty_msg(void)
674{
675 put_packet("");
676}
677
678/* Read memory due to 'm' message */
679static void read_mem_msg(void)
680{
681 char *ptr;
682 int addr;
683 int length;
684
685 /* Jmp, disable bus error handler */
686 if (setjmp(rem_com_env) == 0) {
687
688 kgdb_nofault = 1;
689
690 /* Walk through, have m<addr>,<length> */
691 ptr = &in_buffer[1];
692 if (hex_to_int(&ptr, &addr) && (*ptr++ == ','))
693 if (hex_to_int(&ptr, &length)) {
694 ptr = 0;
695 if (length * 2 > OUTBUFMAX)
696 length = OUTBUFMAX / 2;
697 mem_to_hex((char *) addr, out_buffer, length);
698 }
699 if (ptr)
700 send_err_msg();
701 else
702 put_packet(out_buffer);
703 } else
704 send_err_msg();
705
706 /* Restore bus error handler */
707 kgdb_nofault = 0;
708}
709
710/* Write memory due to 'M' or 'X' message */
711static void write_mem_msg(int binary)
712{
713 char *ptr;
714 int addr;
715 int length;
716
717 if (setjmp(rem_com_env) == 0) {
718
719 kgdb_nofault = 1;
720
721 /* Walk through, have M<addr>,<length>:<data> */
722 ptr = &in_buffer[1];
723 if (hex_to_int(&ptr, &addr) && (*ptr++ == ','))
724 if (hex_to_int(&ptr, &length) && (*ptr++ == ':')) {
725 if (binary)
726 ebin_to_mem(ptr, (char*)addr, length);
727 else
728 hex_to_mem(ptr, (char*)addr, length);
729 flush_icache_range(addr, addr + length);
730 ptr = 0;
731 send_ok_msg();
732 }
733 if (ptr)
734 send_err_msg();
735 } else
736 send_err_msg();
737
738 /* Restore bus error handler */
739 kgdb_nofault = 0;
740}
741
742/* Continue message */
743static void continue_msg(void)
744{
745 /* Try to read optional parameter, PC unchanged if none */
746 char *ptr = &in_buffer[1];
747 int addr;
748
749 if (hex_to_int(&ptr, &addr))
750 trap_registers.pc = addr;
751}
752
753/* Continue message with signal */
754static void continue_with_sig_msg(void)
755{
756 int signal;
757 char *ptr = &in_buffer[1];
758 int addr;
759
760 /* Report limitation */
761 kgdb_to_gdb("Cannot force signal in kgdb, continuing anyway.\n");
762
763 /* Signal */
764 hex_to_int(&ptr, &signal);
765 if (*ptr == ';')
766 ptr++;
767
768 /* Optional address */
769 if (hex_to_int(&ptr, &addr))
770 trap_registers.pc = addr;
771}
772
773/* Step message */
774static void step_msg(void)
775{
776 continue_msg();
777 do_single_step();
778}
779
780/* Step message with signal */
781static void step_with_sig_msg(void)
782{
783 continue_with_sig_msg();
784 do_single_step();
785}
786
787/* Send register contents */
788static void send_regs_msg(void)
789{
790 kgdb_regs_to_gdb_regs(&trap_registers, registers);
791 mem_to_hex((char *) registers, out_buffer, NUMREGBYTES);
792 put_packet(out_buffer);
793}
794
795/* Set register contents - currently can't set other thread's registers */
796static void set_regs_msg(void)
797{
798 kgdb_regs_to_gdb_regs(&trap_registers, registers);
799 hex_to_mem(&in_buffer[1], (char *) registers, NUMREGBYTES);
800 gdb_regs_to_kgdb_regs(registers, &trap_registers);
801 send_ok_msg();
802}
803
804#ifdef CONFIG_SH_KGDB_CONSOLE
805/*
806 * Bring up the ports..
807 */
808static int __init kgdb_serial_setup(void)
809{
810 struct console dummy;
811 return kgdb_console_setup(&dummy, 0);
812}
813#else
814#define kgdb_serial_setup() 0
815#endif
816
817/* The command loop, read and act on requests */
818static void kgdb_command_loop(const int excep_code, const int trapa_value)
819{
820 int sigval;
821
822 /* Enter GDB mode (e.g. after detach) */
823 if (!kgdb_in_gdb_mode) {
824 /* Do serial setup, notify user, issue preemptive ack */
825 printk(KERN_NOTICE "KGDB: Waiting for GDB\n");
826 kgdb_in_gdb_mode = 1;
827 put_debug_char('+');
828 }
829
830 /* Reply to host that an exception has occurred */
831 sigval = compute_signal(excep_code);
832 send_signal_msg(sigval);
833
834 /* TRAP_VEC exception indicates a software trap inserted in place of
835 code by GDB so back up PC by one instruction, as this instruction
836 will later be replaced by its original one. Do NOT do this for
837 trap 0xff, since that indicates a compiled-in breakpoint which
838 will not be replaced (and we would retake the trap forever) */
839 if ((excep_code == TRAP_VEC) && (trapa_value != (0x3c << 2)))
840 trap_registers.pc -= 2;
841
842 /* Undo any stepping we may have done */
843 undo_single_step();
844
845 while (1) {
846 out_buffer[0] = 0;
847 get_packet(in_buffer, BUFMAX);
848
849 /* Examine first char of buffer to see what we need to do */
850 switch (in_buffer[0]) {
851 case '?': /* Send which signal we've received */
852 send_signal_msg(sigval);
853 break;
854
855 case 'g': /* Return the values of the CPU registers */
856 send_regs_msg();
857 break;
858
859 case 'G': /* Set the value of the CPU registers */
860 set_regs_msg();
861 break;
862
863 case 'm': /* Read LLLL bytes address AA..AA */
864 read_mem_msg();
865 break;
866
867 case 'M': /* Write LLLL bytes address AA..AA, ret OK */
868 write_mem_msg(0); /* 0 = data in hex */
869 break;
870
871 case 'X': /* Write LLLL bytes esc bin address AA..AA */
872 if (kgdb_bits == '8')
873 write_mem_msg(1); /* 1 = data in binary */
874 else
875 send_empty_msg();
876 break;
877
878 case 'C': /* Continue, signum included, we ignore it */
879 continue_with_sig_msg();
880 return;
881
882 case 'c': /* Continue at address AA..AA (optional) */
883 continue_msg();
884 return;
885
886 case 'S': /* Step, signum included, we ignore it */
887 step_with_sig_msg();
888 return;
889
890 case 's': /* Step one instruction from AA..AA */
891 step_msg();
892 return;
893
894 case 'k': /* 'Kill the program' with a kernel ? */
895 break;
896
897 case 'D': /* Detach from program, send reply OK */
898 kgdb_in_gdb_mode = 0;
899 send_ok_msg();
900 get_debug_char();
901 return;
902
903 default:
904 send_empty_msg();
905 break;
906 }
907 }
908}
909
910/* There has been an exception, most likely a breakpoint. */
911static void handle_exception(struct pt_regs *regs)
912{
913 int excep_code, vbr_val;
914 int count;
915 int trapa_value = ctrl_inl(TRA);
916
917 /* Copy kernel regs (from stack) */
918 for (count = 0; count < 16; count++)
919 trap_registers.regs[count] = regs->regs[count];
920 trap_registers.pc = regs->pc;
921 trap_registers.pr = regs->pr;
922 trap_registers.sr = regs->sr;
923 trap_registers.gbr = regs->gbr;
924 trap_registers.mach = regs->mach;
925 trap_registers.macl = regs->macl;
926
927 asm("stc vbr, %0":"=r"(vbr_val));
928 trap_registers.vbr = vbr_val;
929
930 /* Get excode for command loop call, user access */
931 asm("stc r2_bank, %0":"=r"(excep_code));
932
933 /* Act on the exception */
934 kgdb_command_loop(excep_code, trapa_value);
935
936 /* Copy back the (maybe modified) registers */
937 for (count = 0; count < 16; count++)
938 regs->regs[count] = trap_registers.regs[count];
939 regs->pc = trap_registers.pc;
940 regs->pr = trap_registers.pr;
941 regs->sr = trap_registers.sr;
942 regs->gbr = trap_registers.gbr;
943 regs->mach = trap_registers.mach;
944 regs->macl = trap_registers.macl;
945
946 vbr_val = trap_registers.vbr;
947 asm("ldc %0, vbr": :"r"(vbr_val));
948}
949
950asmlinkage void kgdb_handle_exception(unsigned long r4, unsigned long r5,
951 unsigned long r6, unsigned long r7,
952 struct pt_regs __regs)
953{
954 struct pt_regs *regs = RELOC_HIDE(&__regs, 0);
955 handle_exception(regs);
956}
957
958/* Initialise the KGDB data structures and serial configuration */
959int __init kgdb_init(void)
960{
961 in_nmi = 0;
962 kgdb_nofault = 0;
963 stepped_opcode = 0;
964 kgdb_in_gdb_mode = 0;
965
966 if (kgdb_serial_setup() != 0) {
967 printk(KERN_NOTICE "KGDB: serial setup error\n");
968 return -1;
969 }
970
971 /* Init ptr to exception handler */
972 kgdb_debug_hook = handle_exception;
973 kgdb_bus_err_hook = kgdb_handle_bus_error;
974
975 /* Enter kgdb now if requested, or just report init done */
976 printk(KERN_NOTICE "KGDB: stub is initialized.\n");
977
978 return 0;
979}
980
981/* Make function available for "user messages"; console will use it too. */
982
983char gdbmsgbuf[BUFMAX];
984#define MAXOUT ((BUFMAX-2)/2)
985
986static void kgdb_msg_write(const char *s, unsigned count)
987{
988 int i;
989 int wcount;
990 char *bufptr;
991
992 /* 'O'utput */
993 gdbmsgbuf[0] = 'O';
994
995 /* Fill and send buffers... */
996 while (count > 0) {
997 bufptr = gdbmsgbuf + 1;
998
999 /* Calculate how many this time */
1000 wcount = (count > MAXOUT) ? MAXOUT : count;
1001
1002 /* Pack in hex chars */
1003 for (i = 0; i < wcount; i++)
1004 bufptr = pack_hex_byte(bufptr, s[i]);
1005 *bufptr = '\0';
1006
1007 /* Move up */
1008 s += wcount;
1009 count -= wcount;
1010
1011 /* Write packet */
1012 put_packet(gdbmsgbuf);
1013 }
1014}
1015
1016static void kgdb_to_gdb(const char *s)
1017{
1018 kgdb_msg_write(s, strlen(s));
1019}
1020
1021#ifdef CONFIG_SH_KGDB_CONSOLE
1022void kgdb_console_write(struct console *co, const char *s, unsigned count)
1023{
1024 /* Bail if we're not talking to GDB */
1025 if (!kgdb_in_gdb_mode)
1026 return;
1027
1028 kgdb_msg_write(s, count);
1029}
1030#endif
1031
1032#ifdef CONFIG_KGDB_SYSRQ
1033static void sysrq_handle_gdb(int key, struct tty_struct *tty)
1034{
1035 printk("Entering GDB stub\n");
1036 breakpoint();
1037}
1038
1039static struct sysrq_key_op sysrq_gdb_op = {
1040 .handler = sysrq_handle_gdb,
1041 .help_msg = "Gdb",
1042 .action_msg = "GDB",
1043};
1044
1045static int gdb_register_sysrq(void)
1046{
1047 printk("Registering GDB sysrq handler\n");
1048 register_sysrq_key('g', &sysrq_gdb_op);
1049 return 0;
1050}
1051module_init(gdb_register_sysrq);
1052#endif
diff --git a/arch/sh/kernel/pm.c b/arch/sh/kernel/pm.c
deleted file mode 100644
index 10ab62c9aede..000000000000
--- a/arch/sh/kernel/pm.c
+++ /dev/null
@@ -1,88 +0,0 @@
1/*
2 * Generic Power Management Routine
3 *
4 * Copyright (c) 2006 Andriy Skulysh <askulsyh@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 */
9#include <linux/suspend.h>
10#include <linux/delay.h>
11#include <linux/gfp.h>
12#include <asm/freq.h>
13#include <asm/io.h>
14#include <asm/watchdog.h>
15#include <asm/pm.h>
16
17#define INTR_OFFSET 0x600
18
19#define STBCR 0xffffff82
20#define STBCR2 0xffffff88
21
22#define STBCR_STBY 0x80
23#define STBCR_MSTP2 0x04
24
25#define MCR 0xffffff68
26#define RTCNT 0xffffff70
27
28#define MCR_RMODE 2
29#define MCR_RFSH 4
30
31void pm_enter(void)
32{
33 u8 stbcr, csr;
34 u16 frqcr, mcr;
35 u32 vbr_new, vbr_old;
36
37 set_bl_bit();
38
39 /* set wdt */
40 csr = sh_wdt_read_csr();
41 csr &= ~WTCSR_TME;
42 csr |= WTCSR_CKS_4096;
43 sh_wdt_write_csr(csr);
44 csr = sh_wdt_read_csr();
45 sh_wdt_write_cnt(0);
46
47 /* disable PLL1 */
48 frqcr = ctrl_inw(FRQCR);
49 frqcr &= ~(FRQCR_PLLEN | FRQCR_PSTBY);
50 ctrl_outw(frqcr, FRQCR);
51
52 /* enable standby */
53 stbcr = ctrl_inb(STBCR);
54 ctrl_outb(stbcr | STBCR_STBY | STBCR_MSTP2, STBCR);
55
56 /* set self-refresh */
57 mcr = ctrl_inw(MCR);
58 ctrl_outw(mcr & ~MCR_RFSH, MCR);
59
60 /* set interrupt handler */
61 asm volatile("stc vbr, %0" : "=r" (vbr_old));
62 vbr_new = get_zeroed_page(GFP_ATOMIC);
63 udelay(50);
64 memcpy((void*)(vbr_new + INTR_OFFSET),
65 &wakeup_start, &wakeup_end - &wakeup_start);
66 asm volatile("ldc %0, vbr" : : "r" (vbr_new));
67
68 ctrl_outw(0, RTCNT);
69 ctrl_outw(mcr | MCR_RFSH | MCR_RMODE, MCR);
70
71 cpu_sleep();
72
73 asm volatile("ldc %0, vbr" : : "r" (vbr_old));
74
75 free_page(vbr_new);
76
77 /* enable PLL1 */
78 frqcr = ctrl_inw(FRQCR);
79 frqcr |= FRQCR_PSTBY;
80 ctrl_outw(frqcr, FRQCR);
81 udelay(50);
82 frqcr |= FRQCR_PLLEN;
83 ctrl_outw(frqcr, FRQCR);
84
85 ctrl_outb(stbcr, STBCR);
86
87 clear_bl_bit();
88}
diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c
index b965f0282c7d..ddafbbbab2ab 100644
--- a/arch/sh/kernel/process_32.c
+++ b/arch/sh/kernel/process_32.c
@@ -32,65 +32,8 @@
32#include <asm/fpu.h> 32#include <asm/fpu.h>
33#include <asm/syscalls.h> 33#include <asm/syscalls.h>
34 34
35static int hlt_counter;
36int ubc_usercnt = 0; 35int ubc_usercnt = 0;
37 36
38void (*pm_idle)(void);
39void (*pm_power_off)(void);
40EXPORT_SYMBOL(pm_power_off);
41
42static int __init nohlt_setup(char *__unused)
43{
44 hlt_counter = 1;
45 return 1;
46}
47__setup("nohlt", nohlt_setup);
48
49static int __init hlt_setup(char *__unused)
50{
51 hlt_counter = 0;
52 return 1;
53}
54__setup("hlt", hlt_setup);
55
56static void default_idle(void)
57{
58 if (!hlt_counter) {
59 clear_thread_flag(TIF_POLLING_NRFLAG);
60 smp_mb__after_clear_bit();
61 set_bl_bit();
62 while (!need_resched())
63 cpu_sleep();
64 clear_bl_bit();
65 set_thread_flag(TIF_POLLING_NRFLAG);
66 } else
67 while (!need_resched())
68 cpu_relax();
69}
70
71void cpu_idle(void)
72{
73 set_thread_flag(TIF_POLLING_NRFLAG);
74
75 /* endless idle loop with no priority at all */
76 while (1) {
77 void (*idle)(void) = pm_idle;
78
79 if (!idle)
80 idle = default_idle;
81
82 tick_nohz_stop_sched_tick(1);
83 while (!need_resched())
84 idle();
85 tick_nohz_restart_sched_tick();
86
87 preempt_enable_no_resched();
88 schedule();
89 preempt_disable();
90 check_pgt_cache();
91 }
92}
93
94void machine_restart(char * __unused) 37void machine_restart(char * __unused)
95{ 38{
96 /* SR.BL=1 and invoke address error to let CPU reset (manual reset) */ 39 /* SR.BL=1 and invoke address error to let CPU reset (manual reset) */
@@ -115,8 +58,8 @@ void machine_power_off(void)
115void show_regs(struct pt_regs * regs) 58void show_regs(struct pt_regs * regs)
116{ 59{
117 printk("\n"); 60 printk("\n");
118 printk("Pid : %d, Comm: %20s\n", task_pid_nr(current), current->comm); 61 printk("Pid : %d, Comm: \t\t%s\n", task_pid_nr(current), current->comm);
119 printk("CPU : %d %s (%s %.*s)\n", 62 printk("CPU : %d \t\t%s (%s %.*s)\n\n",
120 smp_processor_id(), print_tainted(), init_utsname()->release, 63 smp_processor_id(), print_tainted(), init_utsname()->release,
121 (int)strcspn(init_utsname()->version, " "), 64 (int)strcspn(init_utsname()->version, " "),
122 init_utsname()->version); 65 init_utsname()->version);
@@ -148,26 +91,16 @@ void show_regs(struct pt_regs * regs)
148 regs->mach, regs->macl, regs->gbr, regs->pr); 91 regs->mach, regs->macl, regs->gbr, regs->pr);
149 92
150 show_trace(NULL, (unsigned long *)regs->regs[15], regs); 93 show_trace(NULL, (unsigned long *)regs->regs[15], regs);
94 show_code(regs);
151} 95}
152 96
153/* 97/*
154 * Create a kernel thread 98 * Create a kernel thread
155 */ 99 */
156 100ATTRIB_NORET void kernel_thread_helper(void *arg, int (*fn)(void *))
157/* 101{
158 * This is the mechanism for creating a new kernel thread. 102 do_exit(fn(arg));
159 * 103}
160 */
161extern void kernel_thread_helper(void);
162__asm__(".align 5\n"
163 "kernel_thread_helper:\n\t"
164 "jsr @r5\n\t"
165 " nop\n\t"
166 "mov.l 1f, r1\n\t"
167 "jsr @r1\n\t"
168 " mov r0, r4\n\t"
169 ".align 2\n\t"
170 "1:.long do_exit");
171 104
172/* Don't use this in BL=1(cli). Or else, CPU resets! */ 105/* Don't use this in BL=1(cli). Or else, CPU resets! */
173int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) 106int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
diff --git a/arch/sh/kernel/process_64.c b/arch/sh/kernel/process_64.c
index b7aa09235b51..a7e5f2e74bac 100644
--- a/arch/sh/kernel/process_64.c
+++ b/arch/sh/kernel/process_64.c
@@ -23,7 +23,6 @@
23#include <linux/reboot.h> 23#include <linux/reboot.h>
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/proc_fs.h>
27#include <linux/io.h> 26#include <linux/io.h>
28#include <asm/syscalls.h> 27#include <asm/syscalls.h>
29#include <asm/uaccess.h> 28#include <asm/uaccess.h>
@@ -33,56 +32,6 @@
33 32
34struct task_struct *last_task_used_math = NULL; 33struct task_struct *last_task_used_math = NULL;
35 34
36static int hlt_counter = 1;
37
38#define HARD_IDLE_TIMEOUT (HZ / 3)
39
40static int __init nohlt_setup(char *__unused)
41{
42 hlt_counter = 1;
43 return 1;
44}
45
46static int __init hlt_setup(char *__unused)
47{
48 hlt_counter = 0;
49 return 1;
50}
51
52__setup("nohlt", nohlt_setup);
53__setup("hlt", hlt_setup);
54
55static inline void hlt(void)
56{
57 __asm__ __volatile__ ("sleep" : : : "memory");
58}
59
60/*
61 * The idle loop on a uniprocessor SH..
62 */
63void cpu_idle(void)
64{
65 /* endless idle loop with no priority at all */
66 while (1) {
67 if (hlt_counter) {
68 while (!need_resched())
69 cpu_relax();
70 } else {
71 local_irq_disable();
72 while (!need_resched()) {
73 local_irq_enable();
74 hlt();
75 local_irq_disable();
76 }
77 local_irq_enable();
78 }
79 preempt_enable_no_resched();
80 schedule();
81 preempt_disable();
82 }
83
84}
85
86void machine_restart(char * __unused) 35void machine_restart(char * __unused)
87{ 36{
88 extern void phys_stext(void); 37 extern void phys_stext(void);
@@ -97,13 +46,6 @@ void machine_halt(void)
97 46
98void machine_power_off(void) 47void machine_power_off(void)
99{ 48{
100#if 0
101 /* Disable watchdog timer */
102 ctrl_outl(0xa5000000, WTCSR);
103 /* Configure deep standby on sleep */
104 ctrl_outl(0x03, STBCR);
105#endif
106
107 __asm__ __volatile__ ( 49 __asm__ __volatile__ (
108 "sleep\n\t" 50 "sleep\n\t"
109 "synci\n\t" 51 "synci\n\t"
@@ -113,9 +55,6 @@ void machine_power_off(void)
113 panic("Unexpected wakeup!\n"); 55 panic("Unexpected wakeup!\n");
114} 56}
115 57
116void (*pm_power_off)(void) = machine_power_off;
117EXPORT_SYMBOL(pm_power_off);
118
119void show_regs(struct pt_regs * regs) 58void show_regs(struct pt_regs * regs)
120{ 59{
121 unsigned long long ah, al, bh, bl, ch, cl; 60 unsigned long long ah, al, bh, bl, ch, cl;
@@ -365,18 +304,6 @@ void show_regs(struct pt_regs * regs)
365 } 304 }
366} 305}
367 306
368struct task_struct * alloc_task_struct(void)
369{
370 /* Get task descriptor pages */
371 return (struct task_struct *)
372 __get_free_pages(GFP_KERNEL, get_order(THREAD_SIZE));
373}
374
375void free_task_struct(struct task_struct *p)
376{
377 free_pages((unsigned long) p, get_order(THREAD_SIZE));
378}
379
380/* 307/*
381 * Create a kernel thread 308 * Create a kernel thread
382 */ 309 */
@@ -662,41 +589,3 @@ unsigned long get_wchan(struct task_struct *p)
662#endif 589#endif
663 return pc; 590 return pc;
664} 591}
665
666/* Provide a /proc/asids file that lists out the
667 ASIDs currently associated with the processes. (If the DM.PC register is
668 examined through the debug link, this shows ASID + PC. To make use of this,
669 the PID->ASID relationship needs to be known. This is primarily for
670 debugging.)
671 */
672
673#if defined(CONFIG_SH64_PROC_ASIDS)
674static int
675asids_proc_info(char *buf, char **start, off_t fpos, int length, int *eof, void *data)
676{
677 int len=0;
678 struct task_struct *p;
679 read_lock(&tasklist_lock);
680 for_each_process(p) {
681 int pid = p->pid;
682
683 if (!pid)
684 continue;
685 if (p->mm)
686 len += sprintf(buf+len, "%5d : %02lx\n", pid,
687 asid_cache(smp_processor_id()));
688 else
689 len += sprintf(buf+len, "%5d : (none)\n", pid);
690 }
691 read_unlock(&tasklist_lock);
692 *eof = 1;
693 return len;
694}
695
696static int __init register_proc_asids(void)
697{
698 create_proc_read_entry("asids", 0, NULL, asids_proc_info, NULL);
699 return 0;
700}
701__initcall(register_proc_asids);
702#endif
diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c
index e15b099c1f06..695097438f02 100644
--- a/arch/sh/kernel/ptrace_64.c
+++ b/arch/sh/kernel/ptrace_64.c
@@ -2,7 +2,7 @@
2 * arch/sh/kernel/ptrace_64.c 2 * arch/sh/kernel/ptrace_64.c
3 * 3 *
4 * Copyright (C) 2000, 2001 Paolo Alberelli 4 * Copyright (C) 2000, 2001 Paolo Alberelli
5 * Copyright (C) 2003 - 2007 Paul Mundt 5 * Copyright (C) 2003 - 2008 Paul Mundt
6 * 6 *
7 * Started from SH3/4 version: 7 * Started from SH3/4 version:
8 * SuperH version: Copyright (C) 1999, 2000 Kaz Kojima & Niibe Yutaka 8 * SuperH version: Copyright (C) 1999, 2000 Kaz Kojima & Niibe Yutaka
@@ -29,6 +29,8 @@
29#include <linux/audit.h> 29#include <linux/audit.h>
30#include <linux/seccomp.h> 30#include <linux/seccomp.h>
31#include <linux/tracehook.h> 31#include <linux/tracehook.h>
32#include <linux/elf.h>
33#include <linux/regset.h>
32#include <asm/io.h> 34#include <asm/io.h>
33#include <asm/uaccess.h> 35#include <asm/uaccess.h>
34#include <asm/pgtable.h> 36#include <asm/pgtable.h>
@@ -137,6 +139,165 @@ void user_disable_single_step(struct task_struct *child)
137 regs->sr &= ~SR_SSTEP; 139 regs->sr &= ~SR_SSTEP;
138} 140}
139 141
142static int genregs_get(struct task_struct *target,
143 const struct user_regset *regset,
144 unsigned int pos, unsigned int count,
145 void *kbuf, void __user *ubuf)
146{
147 const struct pt_regs *regs = task_pt_regs(target);
148 int ret;
149
150 /* PC, SR, SYSCALL */
151 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
152 &regs->pc,
153 0, 3 * sizeof(unsigned long long));
154
155 /* R1 -> R63 */
156 if (!ret)
157 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
158 regs->regs,
159 offsetof(struct pt_regs, regs[0]),
160 63 * sizeof(unsigned long long));
161 /* TR0 -> TR7 */
162 if (!ret)
163 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
164 regs->tregs,
165 offsetof(struct pt_regs, tregs[0]),
166 8 * sizeof(unsigned long long));
167
168 if (!ret)
169 ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
170 sizeof(struct pt_regs), -1);
171
172 return ret;
173}
174
175static int genregs_set(struct task_struct *target,
176 const struct user_regset *regset,
177 unsigned int pos, unsigned int count,
178 const void *kbuf, const void __user *ubuf)
179{
180 struct pt_regs *regs = task_pt_regs(target);
181 int ret;
182
183 /* PC, SR, SYSCALL */
184 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
185 &regs->pc,
186 0, 3 * sizeof(unsigned long long));
187
188 /* R1 -> R63 */
189 if (!ret && count > 0)
190 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
191 regs->regs,
192 offsetof(struct pt_regs, regs[0]),
193 63 * sizeof(unsigned long long));
194
195 /* TR0 -> TR7 */
196 if (!ret && count > 0)
197 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
198 regs->tregs,
199 offsetof(struct pt_regs, tregs[0]),
200 8 * sizeof(unsigned long long));
201
202 if (!ret)
203 ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
204 sizeof(struct pt_regs), -1);
205
206 return ret;
207}
208
209#ifdef CONFIG_SH_FPU
210int fpregs_get(struct task_struct *target,
211 const struct user_regset *regset,
212 unsigned int pos, unsigned int count,
213 void *kbuf, void __user *ubuf)
214{
215 int ret;
216
217 ret = init_fpu(target);
218 if (ret)
219 return ret;
220
221 return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
222 &target->thread.fpu.hard, 0, -1);
223}
224
225static int fpregs_set(struct task_struct *target,
226 const struct user_regset *regset,
227 unsigned int pos, unsigned int count,
228 const void *kbuf, const void __user *ubuf)
229{
230 int ret;
231
232 ret = init_fpu(target);
233 if (ret)
234 return ret;
235
236 set_stopped_child_used_math(target);
237
238 return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
239 &target->thread.fpu.hard, 0, -1);
240}
241
242static int fpregs_active(struct task_struct *target,
243 const struct user_regset *regset)
244{
245 return tsk_used_math(target) ? regset->n : 0;
246}
247#endif
248
249/*
250 * These are our native regset flavours.
251 */
252enum sh_regset {
253 REGSET_GENERAL,
254#ifdef CONFIG_SH_FPU
255 REGSET_FPU,
256#endif
257};
258
259static const struct user_regset sh_regsets[] = {
260 /*
261 * Format is:
262 * PC, SR, SYSCALL,
263 * R1 --> R63,
264 * TR0 --> TR7,
265 */
266 [REGSET_GENERAL] = {
267 .core_note_type = NT_PRSTATUS,
268 .n = ELF_NGREG,
269 .size = sizeof(long long),
270 .align = sizeof(long long),
271 .get = genregs_get,
272 .set = genregs_set,
273 },
274
275#ifdef CONFIG_SH_FPU
276 [REGSET_FPU] = {
277 .core_note_type = NT_PRFPREG,
278 .n = sizeof(struct user_fpu_struct) /
279 sizeof(long long),
280 .size = sizeof(long long),
281 .align = sizeof(long long),
282 .get = fpregs_get,
283 .set = fpregs_set,
284 .active = fpregs_active,
285 },
286#endif
287};
288
289static const struct user_regset_view user_sh64_native_view = {
290 .name = "sh64",
291 .e_machine = EM_SH,
292 .regsets = sh_regsets,
293 .n = ARRAY_SIZE(sh_regsets),
294};
295
296const struct user_regset_view *task_user_regset_view(struct task_struct *task)
297{
298 return &user_sh64_native_view;
299}
300
140long arch_ptrace(struct task_struct *child, long request, long addr, long data) 301long arch_ptrace(struct task_struct *child, long request, long addr, long data)
141{ 302{
142 int ret; 303 int ret;
@@ -195,10 +356,33 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
195 } 356 }
196 break; 357 break;
197 358
359 case PTRACE_GETREGS:
360 return copy_regset_to_user(child, &user_sh64_native_view,
361 REGSET_GENERAL,
362 0, sizeof(struct pt_regs),
363 (void __user *)data);
364 case PTRACE_SETREGS:
365 return copy_regset_from_user(child, &user_sh64_native_view,
366 REGSET_GENERAL,
367 0, sizeof(struct pt_regs),
368 (const void __user *)data);
369#ifdef CONFIG_SH_FPU
370 case PTRACE_GETFPREGS:
371 return copy_regset_to_user(child, &user_sh64_native_view,
372 REGSET_FPU,
373 0, sizeof(struct user_fpu_struct),
374 (void __user *)data);
375 case PTRACE_SETFPREGS:
376 return copy_regset_from_user(child, &user_sh64_native_view,
377 REGSET_FPU,
378 0, sizeof(struct user_fpu_struct),
379 (const void __user *)data);
380#endif
198 default: 381 default:
199 ret = ptrace_request(child, request, addr, data); 382 ret = ptrace_request(child, request, addr, data);
200 break; 383 break;
201 } 384 }
385
202 return ret; 386 return ret;
203} 387}
204 388
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index e7152cc6930e..534247508572 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -417,6 +417,7 @@ void __init setup_arch(char **cmdline_p)
417} 417}
418 418
419static const char *cpu_name[] = { 419static const char *cpu_name[] = {
420 [CPU_SH7201] = "SH7201",
420 [CPU_SH7203] = "SH7203", [CPU_SH7263] = "SH7263", 421 [CPU_SH7203] = "SH7203", [CPU_SH7263] = "SH7263",
421 [CPU_SH7206] = "SH7206", [CPU_SH7619] = "SH7619", 422 [CPU_SH7206] = "SH7206", [CPU_SH7619] = "SH7619",
422 [CPU_SH7705] = "SH7705", [CPU_SH7706] = "SH7706", 423 [CPU_SH7705] = "SH7705", [CPU_SH7706] = "SH7706",
diff --git a/arch/sh/kernel/sh_bios.c b/arch/sh/kernel/sh_bios.c
index d1bcac4fa269..c852f7805728 100644
--- a/arch/sh/kernel/sh_bios.c
+++ b/arch/sh/kernel/sh_bios.c
@@ -8,69 +8,50 @@
8#include <linux/module.h> 8#include <linux/module.h>
9#include <asm/sh_bios.h> 9#include <asm/sh_bios.h>
10 10
11#define BIOS_CALL_CONSOLE_WRITE 0 11#define BIOS_CALL_CONSOLE_WRITE 0
12#define BIOS_CALL_READ_BLOCK 1
13#define BIOS_CALL_ETH_NODE_ADDR 10 12#define BIOS_CALL_ETH_NODE_ADDR 10
14#define BIOS_CALL_SHUTDOWN 11 13#define BIOS_CALL_SHUTDOWN 11
15#define BIOS_CALL_CHAR_OUT 0x1f /* TODO: hack */ 14#define BIOS_CALL_CHAR_OUT 0x1f /* TODO: hack */
16#define BIOS_CALL_GDB_GET_MODE_PTR 0xfe 15#define BIOS_CALL_GDB_DETACH 0xff
17#define BIOS_CALL_GDB_DETACH 0xff
18 16
19static __inline__ long sh_bios_call(long func, long arg0, long arg1, long arg2, long arg3) 17static inline long sh_bios_call(long func, long arg0, long arg1, long arg2,
18 long arg3)
20{ 19{
21 register long r0 __asm__("r0") = func; 20 register long r0 __asm__("r0") = func;
22 register long r4 __asm__("r4") = arg0; 21 register long r4 __asm__("r4") = arg0;
23 register long r5 __asm__("r5") = arg1; 22 register long r5 __asm__("r5") = arg1;
24 register long r6 __asm__("r6") = arg2; 23 register long r6 __asm__("r6") = arg2;
25 register long r7 __asm__("r7") = arg3; 24 register long r7 __asm__("r7") = arg3;
26 __asm__ __volatile__("trapa #0x3f" 25
27 : "=z" (r0) 26 __asm__ __volatile__("trapa #0x3f":"=z"(r0)
28 : "0" (r0), "r" (r4), "r" (r5), "r" (r6), "r" (r7) 27 :"0"(r0), "r"(r4), "r"(r5), "r"(r6), "r"(r7)
29 : "memory"); 28 :"memory");
30 return r0; 29 return r0;
31} 30}
32 31
33
34void sh_bios_console_write(const char *buf, unsigned int len) 32void sh_bios_console_write(const char *buf, unsigned int len)
35{ 33{
36 sh_bios_call(BIOS_CALL_CONSOLE_WRITE, (long)buf, (long)len, 0, 0); 34 sh_bios_call(BIOS_CALL_CONSOLE_WRITE, (long)buf, (long)len, 0, 0);
37} 35}
38 36
39
40void sh_bios_char_out(char ch) 37void sh_bios_char_out(char ch)
41{ 38{
42 sh_bios_call(BIOS_CALL_CHAR_OUT, ch, 0, 0, 0); 39 sh_bios_call(BIOS_CALL_CHAR_OUT, ch, 0, 0, 0);
43}
44
45
46int sh_bios_in_gdb_mode(void)
47{
48 static char queried = 0;
49 static char *gdb_mode_p = 0;
50
51 if (!queried)
52 {
53 /* Query the gdb stub for address of its gdb mode variable */
54 long r = sh_bios_call(BIOS_CALL_GDB_GET_MODE_PTR, 0, 0, 0, 0);
55 if (r != ~0) /* BIOS returns -1 for unknown function */
56 gdb_mode_p = (char *)r;
57 queried = 1;
58 }
59 return (gdb_mode_p != 0 ? *gdb_mode_p : 0);
60} 40}
61 41
62void sh_bios_gdb_detach(void) 42void sh_bios_gdb_detach(void)
63{ 43{
64 sh_bios_call(BIOS_CALL_GDB_DETACH, 0, 0, 0, 0); 44 sh_bios_call(BIOS_CALL_GDB_DETACH, 0, 0, 0, 0);
65} 45}
66EXPORT_SYMBOL(sh_bios_gdb_detach); 46EXPORT_SYMBOL_GPL(sh_bios_gdb_detach);
67 47
68void sh_bios_get_node_addr (unsigned char *node_addr) 48void sh_bios_get_node_addr(unsigned char *node_addr)
69{ 49{
70 sh_bios_call(BIOS_CALL_ETH_NODE_ADDR, 0, (long)node_addr, 0, 0); 50 sh_bios_call(BIOS_CALL_ETH_NODE_ADDR, 0, (long)node_addr, 0, 0);
71} 51}
52EXPORT_SYMBOL_GPL(sh_bios_get_node_addr);
72 53
73void sh_bios_shutdown(unsigned int how) 54void sh_bios_shutdown(unsigned int how)
74{ 55{
75 sh_bios_call(BIOS_CALL_SHUTDOWN, how, 0, 0, 0); 56 sh_bios_call(BIOS_CALL_SHUTDOWN, how, 0, 0, 0);
76} 57}
diff --git a/arch/sh/kernel/sh_ksyms_32.c b/arch/sh/kernel/sh_ksyms_32.c
index 92ae5e6c099e..528de2955c81 100644
--- a/arch/sh/kernel/sh_ksyms_32.c
+++ b/arch/sh/kernel/sh_ksyms_32.c
@@ -52,16 +52,12 @@ EXPORT_SYMBOL(__const_udelay);
52 52
53#define DECLARE_EXPORT(name) \ 53#define DECLARE_EXPORT(name) \
54 extern void name(void);EXPORT_SYMBOL(name) 54 extern void name(void);EXPORT_SYMBOL(name)
55#define MAYBE_DECLARE_EXPORT(name) \
56 extern void name(void) __weak;EXPORT_SYMBOL(name)
57 55
58/* These symbols are generated by the compiler itself */
59DECLARE_EXPORT(__udivsi3); 56DECLARE_EXPORT(__udivsi3);
60DECLARE_EXPORT(__sdivsi3); 57DECLARE_EXPORT(__sdivsi3);
58DECLARE_EXPORT(__lshrsi3);
61DECLARE_EXPORT(__ashrsi3); 59DECLARE_EXPORT(__ashrsi3);
62DECLARE_EXPORT(__ashlsi3); 60DECLARE_EXPORT(__ashlsi3);
63DECLARE_EXPORT(__ashrdi3);
64DECLARE_EXPORT(__ashldi3);
65DECLARE_EXPORT(__ashiftrt_r4_6); 61DECLARE_EXPORT(__ashiftrt_r4_6);
66DECLARE_EXPORT(__ashiftrt_r4_7); 62DECLARE_EXPORT(__ashiftrt_r4_7);
67DECLARE_EXPORT(__ashiftrt_r4_8); 63DECLARE_EXPORT(__ashiftrt_r4_8);
@@ -79,8 +75,7 @@ DECLARE_EXPORT(__ashiftrt_r4_23);
79DECLARE_EXPORT(__ashiftrt_r4_24); 75DECLARE_EXPORT(__ashiftrt_r4_24);
80DECLARE_EXPORT(__ashiftrt_r4_27); 76DECLARE_EXPORT(__ashiftrt_r4_27);
81DECLARE_EXPORT(__ashiftrt_r4_30); 77DECLARE_EXPORT(__ashiftrt_r4_30);
82DECLARE_EXPORT(__lshrsi3); 78DECLARE_EXPORT(__movstr);
83DECLARE_EXPORT(__lshrdi3);
84DECLARE_EXPORT(__movstrSI8); 79DECLARE_EXPORT(__movstrSI8);
85DECLARE_EXPORT(__movstrSI12); 80DECLARE_EXPORT(__movstrSI12);
86DECLARE_EXPORT(__movstrSI16); 81DECLARE_EXPORT(__movstrSI16);
@@ -95,31 +90,17 @@ DECLARE_EXPORT(__movstrSI48);
95DECLARE_EXPORT(__movstrSI52); 90DECLARE_EXPORT(__movstrSI52);
96DECLARE_EXPORT(__movstrSI56); 91DECLARE_EXPORT(__movstrSI56);
97DECLARE_EXPORT(__movstrSI60); 92DECLARE_EXPORT(__movstrSI60);
98#if __GNUC__ == 4 93DECLARE_EXPORT(__movstr_i4_even);
99DECLARE_EXPORT(__movmem); 94DECLARE_EXPORT(__movstr_i4_odd);
100#else 95DECLARE_EXPORT(__movstrSI12_i4);
101DECLARE_EXPORT(__movstr);
102#endif
103
104#if __GNUC__ == 4
105DECLARE_EXPORT(__movmem_i4_even); 96DECLARE_EXPORT(__movmem_i4_even);
106DECLARE_EXPORT(__movmem_i4_odd); 97DECLARE_EXPORT(__movmem_i4_odd);
107DECLARE_EXPORT(__movmemSI12_i4); 98DECLARE_EXPORT(__movmemSI12_i4);
108
109#if (__GNUC_MINOR__ >= 2 || defined(__GNUC_STM_RELEASE__))
110/*
111 * GCC >= 4.2 emits these for division, as do GCC 4.1.x versions of the ST
112 * compiler which include backported patches.
113 */
114DECLARE_EXPORT(__udiv_qrnnd_16); 99DECLARE_EXPORT(__udiv_qrnnd_16);
115MAYBE_DECLARE_EXPORT(__sdivsi3_i4i); 100DECLARE_EXPORT(__sdivsi3_i4);
116MAYBE_DECLARE_EXPORT(__udivsi3_i4i); 101DECLARE_EXPORT(__udivsi3_i4);
117#endif 102DECLARE_EXPORT(__sdivsi3_i4i);
118#else /* GCC 3.x */ 103DECLARE_EXPORT(__udivsi3_i4i);
119DECLARE_EXPORT(__movstr_i4_even);
120DECLARE_EXPORT(__movstr_i4_odd);
121DECLARE_EXPORT(__movstrSI12_i4);
122#endif /* __GNUC__ == 4 */
123 104
124#if !defined(CONFIG_CACHE_OFF) && (defined(CONFIG_CPU_SH4) || \ 105#if !defined(CONFIG_CACHE_OFF) && (defined(CONFIG_CPU_SH4) || \
125 defined(CONFIG_SH7705_CACHE_32KB)) 106 defined(CONFIG_SH7705_CACHE_32KB))
diff --git a/arch/sh/kernel/sh_ksyms_64.c b/arch/sh/kernel/sh_ksyms_64.c
index 9324d32adacc..0d74d6b8774e 100644
--- a/arch/sh/kernel/sh_ksyms_64.c
+++ b/arch/sh/kernel/sh_ksyms_64.c
@@ -65,15 +65,16 @@ EXPORT_SYMBOL(copy_page);
65EXPORT_SYMBOL(__copy_user); 65EXPORT_SYMBOL(__copy_user);
66EXPORT_SYMBOL(empty_zero_page); 66EXPORT_SYMBOL(empty_zero_page);
67EXPORT_SYMBOL(memcpy); 67EXPORT_SYMBOL(memcpy);
68EXPORT_SYMBOL(memset);
68EXPORT_SYMBOL(__udelay); 69EXPORT_SYMBOL(__udelay);
69EXPORT_SYMBOL(__ndelay); 70EXPORT_SYMBOL(__ndelay);
70EXPORT_SYMBOL(__const_udelay); 71EXPORT_SYMBOL(__const_udelay);
72EXPORT_SYMBOL(strlen);
73EXPORT_SYMBOL(strcpy);
71 74
72/* Ugh. These come in from libgcc.a at link time. */ 75/* Ugh. These come in from libgcc.a at link time. */
73#define DECLARE_EXPORT(name) extern void name(void);EXPORT_SYMBOL(name) 76#define DECLARE_EXPORT(name) extern void name(void);EXPORT_SYMBOL(name)
74 77
75DECLARE_EXPORT(__sdivsi3); 78DECLARE_EXPORT(__sdivsi3);
76DECLARE_EXPORT(__sdivsi3_2);
77DECLARE_EXPORT(__muldi3);
78DECLARE_EXPORT(__udivsi3); 79DECLARE_EXPORT(__udivsi3);
79DECLARE_EXPORT(__div_table); 80DECLARE_EXPORT(__div_table);
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c
index 69d09c0b3498..77c21bde376a 100644
--- a/arch/sh/kernel/signal_32.c
+++ b/arch/sh/kernel/signal_32.c
@@ -533,7 +533,6 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
533{ 533{
534 int ret; 534 int ret;
535 535
536
537 /* Set up the stack frame */ 536 /* Set up the stack frame */
538 if (ka->sa.sa_flags & SA_SIGINFO) 537 if (ka->sa.sa_flags & SA_SIGINFO)
539 ret = setup_rt_frame(sig, ka, info, oldset, regs); 538 ret = setup_rt_frame(sig, ka, info, oldset, regs);
diff --git a/arch/sh/kernel/signal_64.c b/arch/sh/kernel/signal_64.c
index ce3e851dffcb..b22fdfaaa191 100644
--- a/arch/sh/kernel/signal_64.c
+++ b/arch/sh/kernel/signal_64.c
@@ -2,7 +2,7 @@
2 * arch/sh/kernel/signal_64.c 2 * arch/sh/kernel/signal_64.c
3 * 3 *
4 * Copyright (C) 2000, 2001 Paolo Alberelli 4 * Copyright (C) 2000, 2001 Paolo Alberelli
5 * Copyright (C) 2003 Paul Mundt 5 * Copyright (C) 2003 - 2008 Paul Mundt
6 * Copyright (C) 2004 Richard Curnow 6 * Copyright (C) 2004 Richard Curnow
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
@@ -43,10 +43,38 @@
43 43
44#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 44#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
45 45
46static void 46static int
47handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, 47handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
48 sigset_t *oldset, struct pt_regs * regs); 48 sigset_t *oldset, struct pt_regs * regs);
49 49
50static inline void
51handle_syscall_restart(struct pt_regs *regs, struct sigaction *sa)
52{
53 /* If we're not from a syscall, bail out */
54 if (regs->syscall_nr < 0)
55 return;
56
57 /* check for system call restart.. */
58 switch (regs->regs[REG_RET]) {
59 case -ERESTART_RESTARTBLOCK:
60 case -ERESTARTNOHAND:
61 no_system_call_restart:
62 regs->regs[REG_RET] = -EINTR;
63 regs->sr |= 1;
64 break;
65
66 case -ERESTARTSYS:
67 if (!(sa->sa_flags & SA_RESTART))
68 goto no_system_call_restart;
69 /* fallthrough */
70 case -ERESTARTNOINTR:
71 /* Decode syscall # */
72 regs->regs[REG_RET] = regs->syscall_nr;
73 regs->pc -= 4;
74 break;
75 }
76}
77
50/* 78/*
51 * Note that 'init' is a special process: it doesn't get signals it doesn't 79 * Note that 'init' is a special process: it doesn't get signals it doesn't
52 * want to handle. Thus you cannot kill init even with a SIGKILL even by 80 * want to handle. Thus you cannot kill init even with a SIGKILL even by
@@ -80,21 +108,23 @@ static int do_signal(struct pt_regs *regs, sigset_t *oldset)
80 oldset = &current->blocked; 108 oldset = &current->blocked;
81 109
82 signr = get_signal_to_deliver(&info, &ka, regs, 0); 110 signr = get_signal_to_deliver(&info, &ka, regs, 0);
83
84 if (signr > 0) { 111 if (signr > 0) {
85 /* Whee! Actually deliver the signal. */ 112 if (regs->sr & 1)
86 handle_signal(signr, &info, &ka, oldset, regs); 113 handle_syscall_restart(regs, &ka.sa);
87 114
88 /* 115 /* Whee! Actually deliver the signal. */
89 * If a signal was successfully delivered, the saved sigmask 116 if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
90 * is in its frame, and we can clear the TIF_RESTORE_SIGMASK 117 /*
91 * flag. 118 * If a signal was successfully delivered, the
92 */ 119 * saved sigmask is in its frame, and we can
93 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 120 * clear the TIF_RESTORE_SIGMASK flag.
94 clear_thread_flag(TIF_RESTORE_SIGMASK); 121 */
95 122 if (test_thread_flag(TIF_RESTORE_SIGMASK))
96 tracehook_signal_handler(signr, &info, &ka, regs, 0); 123 clear_thread_flag(TIF_RESTORE_SIGMASK);
97 return 1; 124
125 tracehook_signal_handler(signr, &info, &ka, regs, 0);
126 return 1;
127 }
98 } 128 }
99 129
100no_signal: 130no_signal:
@@ -129,7 +159,6 @@ no_signal:
129/* 159/*
130 * Atomically swap in the new signal mask, and wait for a signal. 160 * Atomically swap in the new signal mask, and wait for a signal.
131 */ 161 */
132
133asmlinkage int 162asmlinkage int
134sys_sigsuspend(old_sigset_t mask, 163sys_sigsuspend(old_sigset_t mask,
135 unsigned long r3, unsigned long r4, unsigned long r5, 164 unsigned long r3, unsigned long r4, unsigned long r5,
@@ -235,20 +264,16 @@ sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
235 return do_sigaltstack(uss, uoss, REF_REG_SP); 264 return do_sigaltstack(uss, uoss, REF_REG_SP);
236} 265}
237 266
238
239/* 267/*
240 * Do a signal return; undo the signal stack. 268 * Do a signal return; undo the signal stack.
241 */ 269 */
242 270struct sigframe {
243struct sigframe
244{
245 struct sigcontext sc; 271 struct sigcontext sc;
246 unsigned long extramask[_NSIG_WORDS-1]; 272 unsigned long extramask[_NSIG_WORDS-1];
247 long long retcode[2]; 273 long long retcode[2];
248}; 274};
249 275
250struct rt_sigframe 276struct rt_sigframe {
251{
252 struct siginfo __user *pinfo; 277 struct siginfo __user *pinfo;
253 void *puc; 278 void *puc;
254 struct siginfo info; 279 struct siginfo info;
@@ -450,7 +475,6 @@ badframe:
450/* 475/*
451 * Set up a signal frame. 476 * Set up a signal frame.
452 */ 477 */
453
454static int 478static int
455setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, 479setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
456 unsigned long mask) 480 unsigned long mask)
@@ -504,8 +528,8 @@ get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
504void sa_default_restorer(void); /* See comments below */ 528void sa_default_restorer(void); /* See comments below */
505void sa_default_rt_restorer(void); /* See comments below */ 529void sa_default_rt_restorer(void); /* See comments below */
506 530
507static void setup_frame(int sig, struct k_sigaction *ka, 531static int setup_frame(int sig, struct k_sigaction *ka,
508 sigset_t *set, struct pt_regs *regs) 532 sigset_t *set, struct pt_regs *regs)
509{ 533{
510 struct sigframe __user *frame; 534 struct sigframe __user *frame;
511 int err = 0; 535 int err = 0;
@@ -596,23 +620,21 @@ static void setup_frame(int sig, struct k_sigaction *ka,
596 620
597 set_fs(USER_DS); 621 set_fs(USER_DS);
598 622
599#if DEBUG_SIG
600 /* Broken %016Lx */ 623 /* Broken %016Lx */
601 printk("SIG deliver (#%d,%s:%d): sp=%p pc=%08Lx%08Lx link=%08Lx%08Lx\n", 624 pr_debug("SIG deliver (#%d,%s:%d): sp=%p pc=%08Lx%08Lx link=%08Lx%08Lx\n",
602 signal, 625 signal, current->comm, current->pid, frame,
603 current->comm, current->pid, frame, 626 regs->pc >> 32, regs->pc & 0xffffffff,
604 regs->pc >> 32, regs->pc & 0xffffffff, 627 DEREF_REG_PR >> 32, DEREF_REG_PR & 0xffffffff);
605 DEREF_REG_PR >> 32, DEREF_REG_PR & 0xffffffff);
606#endif
607 628
608 return; 629 return 0;
609 630
610give_sigsegv: 631give_sigsegv:
611 force_sigsegv(sig, current); 632 force_sigsegv(sig, current);
633 return -EFAULT;
612} 634}
613 635
614static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 636static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
615 sigset_t *set, struct pt_regs *regs) 637 sigset_t *set, struct pt_regs *regs)
616{ 638{
617 struct rt_sigframe __user *frame; 639 struct rt_sigframe __user *frame;
618 int err = 0; 640 int err = 0;
@@ -702,62 +724,46 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
702 724
703 set_fs(USER_DS); 725 set_fs(USER_DS);
704 726
705#if DEBUG_SIG 727 pr_debug("SIG deliver (#%d,%s:%d): sp=%p pc=%08Lx%08Lx link=%08Lx%08Lx\n",
706 /* Broken %016Lx */ 728 signal, current->comm, current->pid, frame,
707 printk("SIG deliver (#%d,%s:%d): sp=%p pc=%08Lx%08Lx link=%08Lx%08Lx\n", 729 regs->pc >> 32, regs->pc & 0xffffffff,
708 signal, 730 DEREF_REG_PR >> 32, DEREF_REG_PR & 0xffffffff);
709 current->comm, current->pid, frame,
710 regs->pc >> 32, regs->pc & 0xffffffff,
711 DEREF_REG_PR >> 32, DEREF_REG_PR & 0xffffffff);
712#endif
713 731
714 return; 732 return 0;
715 733
716give_sigsegv: 734give_sigsegv:
717 force_sigsegv(sig, current); 735 force_sigsegv(sig, current);
736 return -EFAULT;
718} 737}
719 738
720/* 739/*
721 * OK, we're invoking a handler 740 * OK, we're invoking a handler
722 */ 741 */
723 742static int
724static void
725handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, 743handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
726 sigset_t *oldset, struct pt_regs * regs) 744 sigset_t *oldset, struct pt_regs * regs)
727{ 745{
728 /* Are we from a system call? */ 746 int ret;
729 if (regs->syscall_nr >= 0) {
730 /* If so, check system call restarting.. */
731 switch (regs->regs[REG_RET]) {
732 case -ERESTART_RESTARTBLOCK:
733 case -ERESTARTNOHAND:
734 no_system_call_restart:
735 regs->regs[REG_RET] = -EINTR;
736 break;
737
738 case -ERESTARTSYS:
739 if (!(ka->sa.sa_flags & SA_RESTART))
740 goto no_system_call_restart;
741 /* fallthrough */
742 case -ERESTARTNOINTR:
743 /* Decode syscall # */
744 regs->regs[REG_RET] = regs->syscall_nr;
745 regs->pc -= 4;
746 }
747 }
748 747
749 /* Set up the stack frame */ 748 /* Set up the stack frame */
750 if (ka->sa.sa_flags & SA_SIGINFO) 749 if (ka->sa.sa_flags & SA_SIGINFO)
751 setup_rt_frame(sig, ka, info, oldset, regs); 750 ret = setup_rt_frame(sig, ka, info, oldset, regs);
752 else 751 else
753 setup_frame(sig, ka, oldset, regs); 752 ret = setup_frame(sig, ka, oldset, regs);
753
754 if (ka->sa.sa_flags & SA_ONESHOT)
755 ka->sa.sa_handler = SIG_DFL;
756
757 if (ret == 0) {
758 spin_lock_irq(&current->sighand->siglock);
759 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
760 if (!(ka->sa.sa_flags & SA_NODEFER))
761 sigaddset(&current->blocked,sig);
762 recalc_sigpending();
763 spin_unlock_irq(&current->sighand->siglock);
764 }
754 765
755 spin_lock_irq(&current->sighand->siglock); 766 return ret;
756 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
757 if (!(ka->sa.sa_flags & SA_NODEFER))
758 sigaddset(&current->blocked,sig);
759 recalc_sigpending();
760 spin_unlock_irq(&current->sighand->siglock);
761} 767}
762 768
763asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) 769asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c
index 3c5ad1660bbc..8f4027412614 100644
--- a/arch/sh/kernel/smp.c
+++ b/arch/sh/kernel/smp.c
@@ -31,12 +31,6 @@
31int __cpu_number_map[NR_CPUS]; /* Map physical to logical */ 31int __cpu_number_map[NR_CPUS]; /* Map physical to logical */
32int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */ 32int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */
33 33
34cpumask_t cpu_possible_map;
35EXPORT_SYMBOL(cpu_possible_map);
36
37cpumask_t cpu_online_map;
38EXPORT_SYMBOL(cpu_online_map);
39
40static inline void __init smp_store_cpu_info(unsigned int cpu) 34static inline void __init smp_store_cpu_info(unsigned int cpu)
41{ 35{
42 struct sh_cpuinfo *c = cpu_data + cpu; 36 struct sh_cpuinfo *c = cpu_data + cpu;
@@ -190,11 +184,11 @@ void arch_send_call_function_single_ipi(int cpu)
190 plat_send_ipi(cpu, SMP_MSG_FUNCTION_SINGLE); 184 plat_send_ipi(cpu, SMP_MSG_FUNCTION_SINGLE);
191} 185}
192 186
193void smp_timer_broadcast(cpumask_t mask) 187void smp_timer_broadcast(const struct cpumask *mask)
194{ 188{
195 int cpu; 189 int cpu;
196 190
197 for_each_cpu_mask(cpu, mask) 191 for_each_cpu(cpu, mask)
198 plat_send_ipi(cpu, SMP_MSG_TIMER); 192 plat_send_ipi(cpu, SMP_MSG_TIMER);
199} 193}
200 194
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c
index 38f098c9c72d..58dfc02c7af1 100644
--- a/arch/sh/kernel/sys_sh.c
+++ b/arch/sh/kernel/sys_sh.c
@@ -22,102 +22,10 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/fs.h> 23#include <linux/fs.h>
24#include <linux/ipc.h> 24#include <linux/ipc.h>
25#include <asm/cacheflush.h>
26#include <asm/syscalls.h> 25#include <asm/syscalls.h>
27#include <asm/uaccess.h> 26#include <asm/uaccess.h>
28#include <asm/unistd.h> 27#include <asm/unistd.h>
29 28
30unsigned long shm_align_mask = PAGE_SIZE - 1; /* Sane caches */
31EXPORT_SYMBOL(shm_align_mask);
32
33#ifdef CONFIG_MMU
34/*
35 * To avoid cache aliases, we map the shared page with same color.
36 */
37#define COLOUR_ALIGN(addr, pgoff) \
38 ((((addr) + shm_align_mask) & ~shm_align_mask) + \
39 (((pgoff) << PAGE_SHIFT) & shm_align_mask))
40
41unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
42 unsigned long len, unsigned long pgoff, unsigned long flags)
43{
44 struct mm_struct *mm = current->mm;
45 struct vm_area_struct *vma;
46 unsigned long start_addr;
47 int do_colour_align;
48
49 if (flags & MAP_FIXED) {
50 /* We do not accept a shared mapping if it would violate
51 * cache aliasing constraints.
52 */
53 if ((flags & MAP_SHARED) && (addr & shm_align_mask))
54 return -EINVAL;
55 return addr;
56 }
57
58 if (unlikely(len > TASK_SIZE))
59 return -ENOMEM;
60
61 do_colour_align = 0;
62 if (filp || (flags & MAP_SHARED))
63 do_colour_align = 1;
64
65 if (addr) {
66 if (do_colour_align)
67 addr = COLOUR_ALIGN(addr, pgoff);
68 else
69 addr = PAGE_ALIGN(addr);
70
71 vma = find_vma(mm, addr);
72 if (TASK_SIZE - len >= addr &&
73 (!vma || addr + len <= vma->vm_start))
74 return addr;
75 }
76
77 if (len > mm->cached_hole_size) {
78 start_addr = addr = mm->free_area_cache;
79 } else {
80 mm->cached_hole_size = 0;
81 start_addr = addr = TASK_UNMAPPED_BASE;
82 }
83
84full_search:
85 if (do_colour_align)
86 addr = COLOUR_ALIGN(addr, pgoff);
87 else
88 addr = PAGE_ALIGN(mm->free_area_cache);
89
90 for (vma = find_vma(mm, addr); ; vma = vma->vm_next) {
91 /* At this point: (!vma || addr < vma->vm_end). */
92 if (unlikely(TASK_SIZE - len < addr)) {
93 /*
94 * Start a new search - just in case we missed
95 * some holes.
96 */
97 if (start_addr != TASK_UNMAPPED_BASE) {
98 start_addr = addr = TASK_UNMAPPED_BASE;
99 mm->cached_hole_size = 0;
100 goto full_search;
101 }
102 return -ENOMEM;
103 }
104 if (likely(!vma || addr + len <= vma->vm_start)) {
105 /*
106 * Remember the place where we stopped the search:
107 */
108 mm->free_area_cache = addr + len;
109 return addr;
110 }
111 if (addr + mm->cached_hole_size < vma->vm_start)
112 mm->cached_hole_size = vma->vm_start - addr;
113
114 addr = vma->vm_end;
115 if (do_colour_align)
116 addr = COLOUR_ALIGN(addr, pgoff);
117 }
118}
119#endif /* CONFIG_MMU */
120
121static inline long 29static inline long
122do_mmap2(unsigned long addr, unsigned long len, unsigned long prot, 30do_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
123 unsigned long flags, int fd, unsigned long pgoff) 31 unsigned long flags, int fd, unsigned long pgoff)
diff --git a/arch/sh/kernel/time_32.c b/arch/sh/kernel/time_32.c
index 23ca711c27d2..8457f83242c5 100644
--- a/arch/sh/kernel/time_32.c
+++ b/arch/sh/kernel/time_32.c
@@ -125,11 +125,6 @@ void handle_timer_tick(void)
125 if (current->pid) 125 if (current->pid)
126 profile_tick(CPU_PROFILING); 126 profile_tick(CPU_PROFILING);
127 127
128#ifdef CONFIG_HEARTBEAT
129 if (sh_mv.mv_heartbeat != NULL)
130 sh_mv.mv_heartbeat();
131#endif
132
133 /* 128 /*
134 * Here we are in the timer irq handler. We just have irqs locally 129 * Here we are in the timer irq handler. We just have irqs locally
135 * disabled but we don't know if the timer_bh is running on the other 130 * disabled but we don't know if the timer_bh is running on the other
@@ -277,11 +272,4 @@ void __init time_init(void)
277 ((sh_hpt_frequency + 500) / 1000) / 1000, 272 ((sh_hpt_frequency + 500) / 1000) / 1000,
278 ((sh_hpt_frequency + 500) / 1000) % 1000); 273 ((sh_hpt_frequency + 500) / 1000) % 1000);
279 274
280#if defined(CONFIG_SH_KGDB)
281 /*
282 * Set up kgdb as requested. We do it here because the serial
283 * init uses the timer vars we just set up for figuring baud.
284 */
285 kgdb_init();
286#endif
287} 275}
diff --git a/arch/sh/kernel/time_64.c b/arch/sh/kernel/time_64.c
index bbb2af1004d9..59d2a03e8b3c 100644
--- a/arch/sh/kernel/time_64.c
+++ b/arch/sh/kernel/time_64.c
@@ -240,11 +240,6 @@ static inline void do_timer_interrupt(void)
240 240
241 do_timer(1); 241 do_timer(1);
242 242
243#ifdef CONFIG_HEARTBEAT
244 if (sh_mv.mv_heartbeat != NULL)
245 sh_mv.mv_heartbeat();
246#endif
247
248 /* 243 /*
249 * If we have an externally synchronized Linux clock, then update 244 * If we have an externally synchronized Linux clock, then update
250 * RTC clock accordingly every ~11 minutes. Set_rtc_mmss() has to be 245 * RTC clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
diff --git a/arch/sh/kernel/timers/timer-broadcast.c b/arch/sh/kernel/timers/timer-broadcast.c
index c2317635230f..96e8eaea1e62 100644
--- a/arch/sh/kernel/timers/timer-broadcast.c
+++ b/arch/sh/kernel/timers/timer-broadcast.c
@@ -51,7 +51,7 @@ void __cpuinit local_timer_setup(unsigned int cpu)
51 clk->mult = 1; 51 clk->mult = 1;
52 clk->set_mode = dummy_timer_set_mode; 52 clk->set_mode = dummy_timer_set_mode;
53 clk->broadcast = smp_timer_broadcast; 53 clk->broadcast = smp_timer_broadcast;
54 clk->cpumask = cpumask_of_cpu(cpu); 54 clk->cpumask = cpumask_of(cpu);
55 55
56 clockevents_register_device(clk); 56 clockevents_register_device(clk);
57} 57}
diff --git a/arch/sh/kernel/timers/timer-mtu2.c b/arch/sh/kernel/timers/timer-mtu2.c
index fe453c01f9c9..c3d237e1d566 100644
--- a/arch/sh/kernel/timers/timer-mtu2.c
+++ b/arch/sh/kernel/timers/timer-mtu2.c
@@ -34,7 +34,12 @@
34#define MTU2_TIER_1 0xfffe4384 34#define MTU2_TIER_1 0xfffe4384
35#define MTU2_TSR_1 0xfffe4385 35#define MTU2_TSR_1 0xfffe4385
36#define MTU2_TCNT_1 0xfffe4386 /* 16-bit counter */ 36#define MTU2_TCNT_1 0xfffe4386 /* 16-bit counter */
37
38#if defined(CONFIG_CPU_SUBTYPE_SH7201)
39#define MTU2_TGRA_1 0xfffe4388
40#else
37#define MTU2_TGRA_1 0xfffe438a 41#define MTU2_TGRA_1 0xfffe438a
42#endif
38 43
39#define STBCR3 0xfffe0408 44#define STBCR3 0xfffe0408
40 45
diff --git a/arch/sh/kernel/timers/timer-tmu.c b/arch/sh/kernel/timers/timer-tmu.c
index 3c61ddd4d43e..0db3f9510336 100644
--- a/arch/sh/kernel/timers/timer-tmu.c
+++ b/arch/sh/kernel/timers/timer-tmu.c
@@ -263,7 +263,7 @@ static int tmu_timer_init(void)
263 tmu0_clockevent.min_delta_ns = 263 tmu0_clockevent.min_delta_ns =
264 clockevent_delta2ns(1, &tmu0_clockevent); 264 clockevent_delta2ns(1, &tmu0_clockevent);
265 265
266 tmu0_clockevent.cpumask = cpumask_of_cpu(0); 266 tmu0_clockevent.cpumask = cpumask_of(0);
267 267
268 clockevents_register_device(&tmu0_clockevent); 268 clockevents_register_device(&tmu0_clockevent);
269 269
diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c
index 1e5c74efbacc..c0aa3d83ec0e 100644
--- a/arch/sh/kernel/traps_32.c
+++ b/arch/sh/kernel/traps_32.c
@@ -13,6 +13,7 @@
13 */ 13 */
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/ptrace.h> 15#include <linux/ptrace.h>
16#include <linux/hardirq.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/spinlock.h> 18#include <linux/spinlock.h>
18#include <linux/module.h> 19#include <linux/module.h>
@@ -28,17 +29,6 @@
28#include <asm/fpu.h> 29#include <asm/fpu.h>
29#include <asm/kprobes.h> 30#include <asm/kprobes.h>
30 31
31#ifdef CONFIG_SH_KGDB
32#include <asm/kgdb.h>
33#define CHK_REMOTE_DEBUG(regs) \
34{ \
35 if (kgdb_debug_hook && !user_mode(regs))\
36 (*kgdb_debug_hook)(regs); \
37}
38#else
39#define CHK_REMOTE_DEBUG(regs)
40#endif
41
42#ifdef CONFIG_CPU_SH2 32#ifdef CONFIG_CPU_SH2
43# define TRAP_RESERVED_INST 4 33# define TRAP_RESERVED_INST 4
44# define TRAP_ILLEGAL_SLOT_INST 6 34# define TRAP_ILLEGAL_SLOT_INST 6
@@ -94,7 +84,6 @@ void die(const char * str, struct pt_regs * regs, long err)
94 84
95 printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); 85 printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
96 86
97 CHK_REMOTE_DEBUG(regs);
98 print_modules(); 87 print_modules();
99 show_regs(regs); 88 show_regs(regs);
100 89
@@ -683,13 +672,12 @@ asmlinkage void do_reserved_inst(unsigned long r4, unsigned long r5,
683 error_code = lookup_exception_vector(); 672 error_code = lookup_exception_vector();
684 673
685 local_irq_enable(); 674 local_irq_enable();
686 CHK_REMOTE_DEBUG(regs);
687 force_sig(SIGILL, tsk); 675 force_sig(SIGILL, tsk);
688 die_if_no_fixup("reserved instruction", regs, error_code); 676 die_if_no_fixup("reserved instruction", regs, error_code);
689} 677}
690 678
691#ifdef CONFIG_SH_FPU_EMU 679#ifdef CONFIG_SH_FPU_EMU
692static int emulate_branch(unsigned short inst, struct pt_regs* regs) 680static int emulate_branch(unsigned short inst, struct pt_regs *regs)
693{ 681{
694 /* 682 /*
695 * bfs: 8fxx: PC+=d*2+4; 683 * bfs: 8fxx: PC+=d*2+4;
@@ -702,27 +690,32 @@ static int emulate_branch(unsigned short inst, struct pt_regs* regs)
702 * jsr: 4x0b: PC=Rn after PR=PC+4; 690 * jsr: 4x0b: PC=Rn after PR=PC+4;
703 * rts: 000b: PC=PR; 691 * rts: 000b: PC=PR;
704 */ 692 */
705 if ((inst & 0xfd00) == 0x8d00) { 693 if (((inst & 0xf000) == 0xb000) || /* bsr */
694 ((inst & 0xf0ff) == 0x0003) || /* bsrf */
695 ((inst & 0xf0ff) == 0x400b)) /* jsr */
696 regs->pr = regs->pc + 4;
697
698 if ((inst & 0xfd00) == 0x8d00) { /* bfs, bts */
706 regs->pc += SH_PC_8BIT_OFFSET(inst); 699 regs->pc += SH_PC_8BIT_OFFSET(inst);
707 return 0; 700 return 0;
708 } 701 }
709 702
710 if ((inst & 0xe000) == 0xa000) { 703 if ((inst & 0xe000) == 0xa000) { /* bra, bsr */
711 regs->pc += SH_PC_12BIT_OFFSET(inst); 704 regs->pc += SH_PC_12BIT_OFFSET(inst);
712 return 0; 705 return 0;
713 } 706 }
714 707
715 if ((inst & 0xf0df) == 0x0003) { 708 if ((inst & 0xf0df) == 0x0003) { /* braf, bsrf */
716 regs->pc += regs->regs[(inst & 0x0f00) >> 8] + 4; 709 regs->pc += regs->regs[(inst & 0x0f00) >> 8] + 4;
717 return 0; 710 return 0;
718 } 711 }
719 712
720 if ((inst & 0xf0df) == 0x400b) { 713 if ((inst & 0xf0df) == 0x400b) { /* jmp, jsr */
721 regs->pc = regs->regs[(inst & 0x0f00) >> 8]; 714 regs->pc = regs->regs[(inst & 0x0f00) >> 8];
722 return 0; 715 return 0;
723 } 716 }
724 717
725 if ((inst & 0xffff) == 0x000b) { 718 if ((inst & 0xffff) == 0x000b) { /* rts */
726 regs->pc = regs->pr; 719 regs->pc = regs->pr;
727 return 0; 720 return 0;
728 } 721 }
@@ -756,7 +749,6 @@ asmlinkage void do_illegal_slot_inst(unsigned long r4, unsigned long r5,
756 inst = lookup_exception_vector(); 749 inst = lookup_exception_vector();
757 750
758 local_irq_enable(); 751 local_irq_enable();
759 CHK_REMOTE_DEBUG(regs);
760 force_sig(SIGILL, tsk); 752 force_sig(SIGILL, tsk);
761 die_if_no_fixup("illegal slot instruction", regs, inst); 753 die_if_no_fixup("illegal slot instruction", regs, inst);
762} 754}
@@ -868,10 +860,7 @@ void show_trace(struct task_struct *tsk, unsigned long *sp,
868 if (regs && user_mode(regs)) 860 if (regs && user_mode(regs))
869 return; 861 return;
870 862
871 printk("\nCall trace: "); 863 printk("\nCall trace:\n");
872#ifdef CONFIG_KALLSYMS
873 printk("\n");
874#endif
875 864
876 while (!kstack_end(sp)) { 865 while (!kstack_end(sp)) {
877 addr = *sp++; 866 addr = *sp++;
diff --git a/arch/sh/kernel/vsyscall/vsyscall.c b/arch/sh/kernel/vsyscall/vsyscall.c
index 95f4de0800ec..3f7e415be86a 100644
--- a/arch/sh/kernel/vsyscall/vsyscall.c
+++ b/arch/sh/kernel/vsyscall/vsyscall.c
@@ -59,8 +59,7 @@ int __init vsyscall_init(void)
59} 59}
60 60
61/* Setup a VMA at program startup for the vsyscall page */ 61/* Setup a VMA at program startup for the vsyscall page */
62int arch_setup_additional_pages(struct linux_binprm *bprm, 62int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
63 int executable_stack)
64{ 63{
65 struct mm_struct *mm = current->mm; 64 struct mm_struct *mm = current->mm;
66 unsigned long addr; 65 unsigned long addr;
diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile
index 8596cc78e18d..aaea580b65bb 100644
--- a/arch/sh/lib/Makefile
+++ b/arch/sh/lib/Makefile
@@ -5,12 +5,26 @@
5lib-y = delay.o memset.o memmove.o memchr.o \ 5lib-y = delay.o memset.o memmove.o memchr.o \
6 checksum.o strlen.o div64.o div64-generic.o 6 checksum.o strlen.o div64.o div64-generic.o
7 7
8# Extracted from libgcc
9lib-y += movmem.o ashldi3.o ashrdi3.o lshrdi3.o \
10 ashlsi3.o ashrsi3.o ashiftrt.o lshrsi3.o \
11 udiv_qrnnd.o
12
13udivsi3-y := udivsi3_i4i-Os.o
14
15ifneq ($(CONFIG_CC_OPTIMIZE_FOR_SIZE),y)
16udivsi3-$(CONFIG_CPU_SH3) := udivsi3_i4i.o
17udivsi3-$(CONFIG_CPU_SH4) := udivsi3_i4i.o
18endif
19udivsi3-y += udivsi3.o
20
8obj-y += io.o 21obj-y += io.o
9 22
10memcpy-y := memcpy.o 23memcpy-y := memcpy.o
11memcpy-$(CONFIG_CPU_SH4) := memcpy-sh4.o 24memcpy-$(CONFIG_CPU_SH4) := memcpy-sh4.o
12 25
13lib-$(CONFIG_MMU) += copy_page.o clear_page.o 26lib-$(CONFIG_MMU) += copy_page.o clear_page.o
14lib-y += $(memcpy-y) 27lib-$(CONFIG_FUNCTION_TRACER) += mcount.o
28lib-y += $(memcpy-y) $(udivsi3-y)
15 29
16EXTRA_CFLAGS += -Werror 30EXTRA_CFLAGS += -Werror
diff --git a/arch/sh/lib/ashiftrt.S b/arch/sh/lib/ashiftrt.S
new file mode 100644
index 000000000000..45ce86558f46
--- /dev/null
+++ b/arch/sh/lib/ashiftrt.S
@@ -0,0 +1,149 @@
1/* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2 2004, 2005, 2006
3 Free Software Foundation, Inc.
4
5This file is free software; you can redistribute it and/or modify it
6under the terms of the GNU General Public License as published by the
7Free Software Foundation; either version 2, or (at your option) any
8later version.
9
10In addition to the permissions in the GNU General Public License, the
11Free Software Foundation gives you unlimited permission to link the
12compiled version of this file into combinations with other programs,
13and to distribute those combinations without any restriction coming
14from the use of this file. (The General Public License restrictions
15do apply in other respects; for example, they cover modification of
16the file, and distribution when not linked into a combine
17executable.)
18
19This file is distributed in the hope that it will be useful, but
20WITHOUT ANY WARRANTY; without even the implied warranty of
21MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22General Public License for more details.
23
24You should have received a copy of the GNU General Public License
25along with this program; see the file COPYING. If not, write to
26the Free Software Foundation, 51 Franklin Street, Fifth Floor,
27Boston, MA 02110-1301, USA. */
28
29!! libgcc routines for the Renesas / SuperH SH CPUs.
30!! Contributed by Steve Chamberlain.
31!! sac@cygnus.com
32
33!! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines
34!! recoded in assembly by Toshiyasu Morita
35!! tm@netcom.com
36
37/* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and
38 ELF local label prefixes by J"orn Rennecke
39 amylaar@cygnus.com */
40
41 .global __ashiftrt_r4_0
42 .global __ashiftrt_r4_1
43 .global __ashiftrt_r4_2
44 .global __ashiftrt_r4_3
45 .global __ashiftrt_r4_4
46 .global __ashiftrt_r4_5
47 .global __ashiftrt_r4_6
48 .global __ashiftrt_r4_7
49 .global __ashiftrt_r4_8
50 .global __ashiftrt_r4_9
51 .global __ashiftrt_r4_10
52 .global __ashiftrt_r4_11
53 .global __ashiftrt_r4_12
54 .global __ashiftrt_r4_13
55 .global __ashiftrt_r4_14
56 .global __ashiftrt_r4_15
57 .global __ashiftrt_r4_16
58 .global __ashiftrt_r4_17
59 .global __ashiftrt_r4_18
60 .global __ashiftrt_r4_19
61 .global __ashiftrt_r4_20
62 .global __ashiftrt_r4_21
63 .global __ashiftrt_r4_22
64 .global __ashiftrt_r4_23
65 .global __ashiftrt_r4_24
66 .global __ashiftrt_r4_25
67 .global __ashiftrt_r4_26
68 .global __ashiftrt_r4_27
69 .global __ashiftrt_r4_28
70 .global __ashiftrt_r4_29
71 .global __ashiftrt_r4_30
72 .global __ashiftrt_r4_31
73 .global __ashiftrt_r4_32
74
75 .align 1
76__ashiftrt_r4_32:
77__ashiftrt_r4_31:
78 rotcl r4
79 rts
80 subc r4,r4
81__ashiftrt_r4_30:
82 shar r4
83__ashiftrt_r4_29:
84 shar r4
85__ashiftrt_r4_28:
86 shar r4
87__ashiftrt_r4_27:
88 shar r4
89__ashiftrt_r4_26:
90 shar r4
91__ashiftrt_r4_25:
92 shar r4
93__ashiftrt_r4_24:
94 shlr16 r4
95 shlr8 r4
96 rts
97 exts.b r4,r4
98__ashiftrt_r4_23:
99 shar r4
100__ashiftrt_r4_22:
101 shar r4
102__ashiftrt_r4_21:
103 shar r4
104__ashiftrt_r4_20:
105 shar r4
106__ashiftrt_r4_19:
107 shar r4
108__ashiftrt_r4_18:
109 shar r4
110__ashiftrt_r4_17:
111 shar r4
112__ashiftrt_r4_16:
113 shlr16 r4
114 rts
115 exts.w r4,r4
116__ashiftrt_r4_15:
117 shar r4
118__ashiftrt_r4_14:
119 shar r4
120__ashiftrt_r4_13:
121 shar r4
122__ashiftrt_r4_12:
123 shar r4
124__ashiftrt_r4_11:
125 shar r4
126__ashiftrt_r4_10:
127 shar r4
128__ashiftrt_r4_9:
129 shar r4
130__ashiftrt_r4_8:
131 shar r4
132__ashiftrt_r4_7:
133 shar r4
134__ashiftrt_r4_6:
135 shar r4
136__ashiftrt_r4_5:
137 shar r4
138__ashiftrt_r4_4:
139 shar r4
140__ashiftrt_r4_3:
141 shar r4
142__ashiftrt_r4_2:
143 shar r4
144__ashiftrt_r4_1:
145 rts
146 shar r4
147__ashiftrt_r4_0:
148 rts
149 nop
diff --git a/arch/sh/lib/ashldi3.c b/arch/sh/lib/ashldi3.c
new file mode 100644
index 000000000000..beb80f316095
--- /dev/null
+++ b/arch/sh/lib/ashldi3.c
@@ -0,0 +1,29 @@
1#include <linux/module.h>
2
3#include "libgcc.h"
4
5long long __ashldi3(long long u, word_type b)
6{
7 DWunion uu, w;
8 word_type bm;
9
10 if (b == 0)
11 return u;
12
13 uu.ll = u;
14 bm = 32 - b;
15
16 if (bm <= 0) {
17 w.s.low = 0;
18 w.s.high = (unsigned int) uu.s.low << -bm;
19 } else {
20 const unsigned int carries = (unsigned int) uu.s.low >> bm;
21
22 w.s.low = (unsigned int) uu.s.low << b;
23 w.s.high = ((unsigned int) uu.s.high << b) | carries;
24 }
25
26 return w.ll;
27}
28
29EXPORT_SYMBOL(__ashldi3);
diff --git a/arch/sh/lib/ashlsi3.S b/arch/sh/lib/ashlsi3.S
new file mode 100644
index 000000000000..bd47e9b403a5
--- /dev/null
+++ b/arch/sh/lib/ashlsi3.S
@@ -0,0 +1,193 @@
1/* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2 2004, 2005, 2006
3 Free Software Foundation, Inc.
4
5This file is free software; you can redistribute it and/or modify it
6under the terms of the GNU General Public License as published by the
7Free Software Foundation; either version 2, or (at your option) any
8later version.
9
10In addition to the permissions in the GNU General Public License, the
11Free Software Foundation gives you unlimited permission to link the
12compiled version of this file into combinations with other programs,
13and to distribute those combinations without any restriction coming
14from the use of this file. (The General Public License restrictions
15do apply in other respects; for example, they cover modification of
16the file, and distribution when not linked into a combine
17executable.)
18
19This file is distributed in the hope that it will be useful, but
20WITHOUT ANY WARRANTY; without even the implied warranty of
21MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22General Public License for more details.
23
24You should have received a copy of the GNU General Public License
25along with this program; see the file COPYING. If not, write to
26the Free Software Foundation, 51 Franklin Street, Fifth Floor,
27Boston, MA 02110-1301, USA. */
28
29!! libgcc routines for the Renesas / SuperH SH CPUs.
30!! Contributed by Steve Chamberlain.
31!! sac@cygnus.com
32
33!! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines
34!! recoded in assembly by Toshiyasu Morita
35!! tm@netcom.com
36
37/* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and
38 ELF local label prefixes by J"orn Rennecke
39 amylaar@cygnus.com */
40
41!
42! __ashlsi3
43!
44! Entry:
45!
46! r4: Value to shift
47! r5: Shifts
48!
49! Exit:
50!
51! r0: Result
52!
53! Destroys:
54!
55! (none)
56!
57 .global __ashlsi3
58
59 .align 2
60__ashlsi3:
61 mov #31,r0
62 and r0,r5
63 mova ashlsi3_table,r0
64 mov.b @(r0,r5),r5
65#ifdef __sh1__
66 add r5,r0
67 jmp @r0
68#else
69 braf r5
70#endif
71 mov r4,r0
72
73 .align 2
74ashlsi3_table:
75 .byte ashlsi3_0-ashlsi3_table
76 .byte ashlsi3_1-ashlsi3_table
77 .byte ashlsi3_2-ashlsi3_table
78 .byte ashlsi3_3-ashlsi3_table
79 .byte ashlsi3_4-ashlsi3_table
80 .byte ashlsi3_5-ashlsi3_table
81 .byte ashlsi3_6-ashlsi3_table
82 .byte ashlsi3_7-ashlsi3_table
83 .byte ashlsi3_8-ashlsi3_table
84 .byte ashlsi3_9-ashlsi3_table
85 .byte ashlsi3_10-ashlsi3_table
86 .byte ashlsi3_11-ashlsi3_table
87 .byte ashlsi3_12-ashlsi3_table
88 .byte ashlsi3_13-ashlsi3_table
89 .byte ashlsi3_14-ashlsi3_table
90 .byte ashlsi3_15-ashlsi3_table
91 .byte ashlsi3_16-ashlsi3_table
92 .byte ashlsi3_17-ashlsi3_table
93 .byte ashlsi3_18-ashlsi3_table
94 .byte ashlsi3_19-ashlsi3_table
95 .byte ashlsi3_20-ashlsi3_table
96 .byte ashlsi3_21-ashlsi3_table
97 .byte ashlsi3_22-ashlsi3_table
98 .byte ashlsi3_23-ashlsi3_table
99 .byte ashlsi3_24-ashlsi3_table
100 .byte ashlsi3_25-ashlsi3_table
101 .byte ashlsi3_26-ashlsi3_table
102 .byte ashlsi3_27-ashlsi3_table
103 .byte ashlsi3_28-ashlsi3_table
104 .byte ashlsi3_29-ashlsi3_table
105 .byte ashlsi3_30-ashlsi3_table
106 .byte ashlsi3_31-ashlsi3_table
107
108ashlsi3_6:
109 shll2 r0
110ashlsi3_4:
111 shll2 r0
112ashlsi3_2:
113 rts
114 shll2 r0
115
116ashlsi3_7:
117 shll2 r0
118ashlsi3_5:
119 shll2 r0
120ashlsi3_3:
121 shll2 r0
122ashlsi3_1:
123 rts
124 shll r0
125
126ashlsi3_14:
127 shll2 r0
128ashlsi3_12:
129 shll2 r0
130ashlsi3_10:
131 shll2 r0
132ashlsi3_8:
133 rts
134 shll8 r0
135
136ashlsi3_15:
137 shll2 r0
138ashlsi3_13:
139 shll2 r0
140ashlsi3_11:
141 shll2 r0
142ashlsi3_9:
143 shll8 r0
144 rts
145 shll r0
146
147ashlsi3_22:
148 shll2 r0
149ashlsi3_20:
150 shll2 r0
151ashlsi3_18:
152 shll2 r0
153ashlsi3_16:
154 rts
155 shll16 r0
156
157ashlsi3_23:
158 shll2 r0
159ashlsi3_21:
160 shll2 r0
161ashlsi3_19:
162 shll2 r0
163ashlsi3_17:
164 shll16 r0
165 rts
166 shll r0
167
168ashlsi3_30:
169 shll2 r0
170ashlsi3_28:
171 shll2 r0
172ashlsi3_26:
173 shll2 r0
174ashlsi3_24:
175 shll16 r0
176 rts
177 shll8 r0
178
179ashlsi3_31:
180 shll2 r0
181ashlsi3_29:
182 shll2 r0
183ashlsi3_27:
184 shll2 r0
185ashlsi3_25:
186 shll16 r0
187 shll8 r0
188 rts
189 shll r0
190
191ashlsi3_0:
192 rts
193 nop
diff --git a/arch/sh/lib/ashrdi3.c b/arch/sh/lib/ashrdi3.c
new file mode 100644
index 000000000000..c884a912b660
--- /dev/null
+++ b/arch/sh/lib/ashrdi3.c
@@ -0,0 +1,31 @@
1#include <linux/module.h>
2
3#include "libgcc.h"
4
5long long __ashrdi3(long long u, word_type b)
6{
7 DWunion uu, w;
8 word_type bm;
9
10 if (b == 0)
11 return u;
12
13 uu.ll = u;
14 bm = 32 - b;
15
16 if (bm <= 0) {
17 /* w.s.high = 1..1 or 0..0 */
18 w.s.high =
19 uu.s.high >> 31;
20 w.s.low = uu.s.high >> -bm;
21 } else {
22 const unsigned int carries = (unsigned int) uu.s.high << bm;
23
24 w.s.high = uu.s.high >> b;
25 w.s.low = ((unsigned int) uu.s.low >> b) | carries;
26 }
27
28 return w.ll;
29}
30
31EXPORT_SYMBOL(__ashrdi3);
diff --git a/arch/sh/lib/ashrsi3.S b/arch/sh/lib/ashrsi3.S
new file mode 100644
index 000000000000..6f3cf46b77c2
--- /dev/null
+++ b/arch/sh/lib/ashrsi3.S
@@ -0,0 +1,185 @@
1/* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2 2004, 2005, 2006
3 Free Software Foundation, Inc.
4
5This file is free software; you can redistribute it and/or modify it
6under the terms of the GNU General Public License as published by the
7Free Software Foundation; either version 2, or (at your option) any
8later version.
9
10In addition to the permissions in the GNU General Public License, the
11Free Software Foundation gives you unlimited permission to link the
12compiled version of this file into combinations with other programs,
13and to distribute those combinations without any restriction coming
14from the use of this file. (The General Public License restrictions
15do apply in other respects; for example, they cover modification of
16the file, and distribution when not linked into a combine
17executable.)
18
19This file is distributed in the hope that it will be useful, but
20WITHOUT ANY WARRANTY; without even the implied warranty of
21MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22General Public License for more details.
23
24You should have received a copy of the GNU General Public License
25along with this program; see the file COPYING. If not, write to
26the Free Software Foundation, 51 Franklin Street, Fifth Floor,
27Boston, MA 02110-1301, USA. */
28
29!! libgcc routines for the Renesas / SuperH SH CPUs.
30!! Contributed by Steve Chamberlain.
31!! sac@cygnus.com
32
33!! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines
34!! recoded in assembly by Toshiyasu Morita
35!! tm@netcom.com
36
37/* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and
38 ELF local label prefixes by J"orn Rennecke
39 amylaar@cygnus.com */
40
41!
42! __ashrsi3
43!
44! Entry:
45!
46! r4: Value to shift
47! r5: Shifts
48!
49! Exit:
50!
51! r0: Result
52!
53! Destroys:
54!
55! (none)
56!
57
58 .global __ashrsi3
59
60 .align 2
61__ashrsi3:
62 mov #31,r0
63 and r0,r5
64 mova ashrsi3_table,r0
65 mov.b @(r0,r5),r5
66#ifdef __sh1__
67 add r5,r0
68 jmp @r0
69#else
70 braf r5
71#endif
72 mov r4,r0
73
74 .align 2
75ashrsi3_table:
76 .byte ashrsi3_0-ashrsi3_table
77 .byte ashrsi3_1-ashrsi3_table
78 .byte ashrsi3_2-ashrsi3_table
79 .byte ashrsi3_3-ashrsi3_table
80 .byte ashrsi3_4-ashrsi3_table
81 .byte ashrsi3_5-ashrsi3_table
82 .byte ashrsi3_6-ashrsi3_table
83 .byte ashrsi3_7-ashrsi3_table
84 .byte ashrsi3_8-ashrsi3_table
85 .byte ashrsi3_9-ashrsi3_table
86 .byte ashrsi3_10-ashrsi3_table
87 .byte ashrsi3_11-ashrsi3_table
88 .byte ashrsi3_12-ashrsi3_table
89 .byte ashrsi3_13-ashrsi3_table
90 .byte ashrsi3_14-ashrsi3_table
91 .byte ashrsi3_15-ashrsi3_table
92 .byte ashrsi3_16-ashrsi3_table
93 .byte ashrsi3_17-ashrsi3_table
94 .byte ashrsi3_18-ashrsi3_table
95 .byte ashrsi3_19-ashrsi3_table
96 .byte ashrsi3_20-ashrsi3_table
97 .byte ashrsi3_21-ashrsi3_table
98 .byte ashrsi3_22-ashrsi3_table
99 .byte ashrsi3_23-ashrsi3_table
100 .byte ashrsi3_24-ashrsi3_table
101 .byte ashrsi3_25-ashrsi3_table
102 .byte ashrsi3_26-ashrsi3_table
103 .byte ashrsi3_27-ashrsi3_table
104 .byte ashrsi3_28-ashrsi3_table
105 .byte ashrsi3_29-ashrsi3_table
106 .byte ashrsi3_30-ashrsi3_table
107 .byte ashrsi3_31-ashrsi3_table
108
109ashrsi3_31:
110 rotcl r0
111 rts
112 subc r0,r0
113
114ashrsi3_30:
115 shar r0
116ashrsi3_29:
117 shar r0
118ashrsi3_28:
119 shar r0
120ashrsi3_27:
121 shar r0
122ashrsi3_26:
123 shar r0
124ashrsi3_25:
125 shar r0
126ashrsi3_24:
127 shlr16 r0
128 shlr8 r0
129 rts
130 exts.b r0,r0
131
132ashrsi3_23:
133 shar r0
134ashrsi3_22:
135 shar r0
136ashrsi3_21:
137 shar r0
138ashrsi3_20:
139 shar r0
140ashrsi3_19:
141 shar r0
142ashrsi3_18:
143 shar r0
144ashrsi3_17:
145 shar r0
146ashrsi3_16:
147 shlr16 r0
148 rts
149 exts.w r0,r0
150
151ashrsi3_15:
152 shar r0
153ashrsi3_14:
154 shar r0
155ashrsi3_13:
156 shar r0
157ashrsi3_12:
158 shar r0
159ashrsi3_11:
160 shar r0
161ashrsi3_10:
162 shar r0
163ashrsi3_9:
164 shar r0
165ashrsi3_8:
166 shar r0
167ashrsi3_7:
168 shar r0
169ashrsi3_6:
170 shar r0
171ashrsi3_5:
172 shar r0
173ashrsi3_4:
174 shar r0
175ashrsi3_3:
176 shar r0
177ashrsi3_2:
178 shar r0
179ashrsi3_1:
180 rts
181 shar r0
182
183ashrsi3_0:
184 rts
185 nop
diff --git a/arch/sh/lib/libgcc.h b/arch/sh/lib/libgcc.h
new file mode 100644
index 000000000000..3f19d1c5d942
--- /dev/null
+++ b/arch/sh/lib/libgcc.h
@@ -0,0 +1,26 @@
1#ifndef __ASM_LIBGCC_H
2#define __ASM_LIBGCC_H
3
4#include <asm/byteorder.h>
5
6typedef int word_type __attribute__ ((mode (__word__)));
7
8#ifdef __BIG_ENDIAN
9struct DWstruct {
10 int high, low;
11};
12#elif defined(__LITTLE_ENDIAN)
13struct DWstruct {
14 int low, high;
15};
16#else
17#error I feel sick.
18#endif
19
20typedef union
21{
22 struct DWstruct s;
23 long long ll;
24} DWunion;
25
26#endif /* __ASM_LIBGCC_H */
diff --git a/arch/sh/lib/lshrdi3.c b/arch/sh/lib/lshrdi3.c
new file mode 100644
index 000000000000..dcf8d6810b7c
--- /dev/null
+++ b/arch/sh/lib/lshrdi3.c
@@ -0,0 +1,29 @@
1#include <linux/module.h>
2
3#include "libgcc.h"
4
5long long __lshrdi3(long long u, word_type b)
6{
7 DWunion uu, w;
8 word_type bm;
9
10 if (b == 0)
11 return u;
12
13 uu.ll = u;
14 bm = 32 - b;
15
16 if (bm <= 0) {
17 w.s.high = 0;
18 w.s.low = (unsigned int) uu.s.high >> -bm;
19 } else {
20 const unsigned int carries = (unsigned int) uu.s.high << bm;
21
22 w.s.high = (unsigned int) uu.s.high >> b;
23 w.s.low = ((unsigned int) uu.s.low >> b) | carries;
24 }
25
26 return w.ll;
27}
28
29EXPORT_SYMBOL(__lshrdi3);
diff --git a/arch/sh/lib/lshrsi3.S b/arch/sh/lib/lshrsi3.S
new file mode 100644
index 000000000000..1e7aaa557130
--- /dev/null
+++ b/arch/sh/lib/lshrsi3.S
@@ -0,0 +1,193 @@
1/* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2 2004, 2005, 2006
3 Free Software Foundation, Inc.
4
5This file is free software; you can redistribute it and/or modify it
6under the terms of the GNU General Public License as published by the
7Free Software Foundation; either version 2, or (at your option) any
8later version.
9
10In addition to the permissions in the GNU General Public License, the
11Free Software Foundation gives you unlimited permission to link the
12compiled version of this file into combinations with other programs,
13and to distribute those combinations without any restriction coming
14from the use of this file. (The General Public License restrictions
15do apply in other respects; for example, they cover modification of
16the file, and distribution when not linked into a combine
17executable.)
18
19This file is distributed in the hope that it will be useful, but
20WITHOUT ANY WARRANTY; without even the implied warranty of
21MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22General Public License for more details.
23
24You should have received a copy of the GNU General Public License
25along with this program; see the file COPYING. If not, write to
26the Free Software Foundation, 51 Franklin Street, Fifth Floor,
27Boston, MA 02110-1301, USA. */
28
29!! libgcc routines for the Renesas / SuperH SH CPUs.
30!! Contributed by Steve Chamberlain.
31!! sac@cygnus.com
32
33!! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines
34!! recoded in assembly by Toshiyasu Morita
35!! tm@netcom.com
36
37/* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and
38 ELF local label prefixes by J"orn Rennecke
39 amylaar@cygnus.com */
40
41!
42! __lshrsi3
43!
44! Entry:
45!
46! r4: Value to shift
47! r5: Shifts
48!
49! Exit:
50!
51! r0: Result
52!
53! Destroys:
54!
55! (none)
56!
57 .global __lshrsi3
58
59 .align 2
60__lshrsi3:
61 mov #31,r0
62 and r0,r5
63 mova lshrsi3_table,r0
64 mov.b @(r0,r5),r5
65#ifdef __sh1__
66 add r5,r0
67 jmp @r0
68#else
69 braf r5
70#endif
71 mov r4,r0
72
73 .align 2
74lshrsi3_table:
75 .byte lshrsi3_0-lshrsi3_table
76 .byte lshrsi3_1-lshrsi3_table
77 .byte lshrsi3_2-lshrsi3_table
78 .byte lshrsi3_3-lshrsi3_table
79 .byte lshrsi3_4-lshrsi3_table
80 .byte lshrsi3_5-lshrsi3_table
81 .byte lshrsi3_6-lshrsi3_table
82 .byte lshrsi3_7-lshrsi3_table
83 .byte lshrsi3_8-lshrsi3_table
84 .byte lshrsi3_9-lshrsi3_table
85 .byte lshrsi3_10-lshrsi3_table
86 .byte lshrsi3_11-lshrsi3_table
87 .byte lshrsi3_12-lshrsi3_table
88 .byte lshrsi3_13-lshrsi3_table
89 .byte lshrsi3_14-lshrsi3_table
90 .byte lshrsi3_15-lshrsi3_table
91 .byte lshrsi3_16-lshrsi3_table
92 .byte lshrsi3_17-lshrsi3_table
93 .byte lshrsi3_18-lshrsi3_table
94 .byte lshrsi3_19-lshrsi3_table
95 .byte lshrsi3_20-lshrsi3_table
96 .byte lshrsi3_21-lshrsi3_table
97 .byte lshrsi3_22-lshrsi3_table
98 .byte lshrsi3_23-lshrsi3_table
99 .byte lshrsi3_24-lshrsi3_table
100 .byte lshrsi3_25-lshrsi3_table
101 .byte lshrsi3_26-lshrsi3_table
102 .byte lshrsi3_27-lshrsi3_table
103 .byte lshrsi3_28-lshrsi3_table
104 .byte lshrsi3_29-lshrsi3_table
105 .byte lshrsi3_30-lshrsi3_table
106 .byte lshrsi3_31-lshrsi3_table
107
108lshrsi3_6:
109 shlr2 r0
110lshrsi3_4:
111 shlr2 r0
112lshrsi3_2:
113 rts
114 shlr2 r0
115
116lshrsi3_7:
117 shlr2 r0
118lshrsi3_5:
119 shlr2 r0
120lshrsi3_3:
121 shlr2 r0
122lshrsi3_1:
123 rts
124 shlr r0
125
126lshrsi3_14:
127 shlr2 r0
128lshrsi3_12:
129 shlr2 r0
130lshrsi3_10:
131 shlr2 r0
132lshrsi3_8:
133 rts
134 shlr8 r0
135
136lshrsi3_15:
137 shlr2 r0
138lshrsi3_13:
139 shlr2 r0
140lshrsi3_11:
141 shlr2 r0
142lshrsi3_9:
143 shlr8 r0
144 rts
145 shlr r0
146
147lshrsi3_22:
148 shlr2 r0
149lshrsi3_20:
150 shlr2 r0
151lshrsi3_18:
152 shlr2 r0
153lshrsi3_16:
154 rts
155 shlr16 r0
156
157lshrsi3_23:
158 shlr2 r0
159lshrsi3_21:
160 shlr2 r0
161lshrsi3_19:
162 shlr2 r0
163lshrsi3_17:
164 shlr16 r0
165 rts
166 shlr r0
167
168lshrsi3_30:
169 shlr2 r0
170lshrsi3_28:
171 shlr2 r0
172lshrsi3_26:
173 shlr2 r0
174lshrsi3_24:
175 shlr16 r0
176 rts
177 shlr8 r0
178
179lshrsi3_31:
180 shlr2 r0
181lshrsi3_29:
182 shlr2 r0
183lshrsi3_27:
184 shlr2 r0
185lshrsi3_25:
186 shlr16 r0
187 shlr8 r0
188 rts
189 shlr r0
190
191lshrsi3_0:
192 rts
193 nop
diff --git a/arch/sh/lib/mcount.S b/arch/sh/lib/mcount.S
new file mode 100644
index 000000000000..110fbfe1831f
--- /dev/null
+++ b/arch/sh/lib/mcount.S
@@ -0,0 +1,90 @@
1/*
2 * arch/sh/lib/mcount.S
3 *
4 * Copyright (C) 2008 Paul Mundt
5 * Copyright (C) 2008 Matt Fleming
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#include <asm/ftrace.h>
12
13#define MCOUNT_ENTER() \
14 mov.l r4, @-r15; \
15 mov.l r5, @-r15; \
16 mov.l r6, @-r15; \
17 mov.l r7, @-r15; \
18 sts.l pr, @-r15; \
19 \
20 mov.l @(20,r15),r4; \
21 sts pr, r5
22
23#define MCOUNT_LEAVE() \
24 lds.l @r15+, pr; \
25 mov.l @r15+, r7; \
26 mov.l @r15+, r6; \
27 mov.l @r15+, r5; \
28 rts; \
29 mov.l @r15+, r4
30
31 .align 2
32 .globl _mcount
33 .type _mcount,@function
34 .globl mcount
35 .type mcount,@function
36_mcount:
37mcount:
38 MCOUNT_ENTER()
39
40#ifdef CONFIG_DYNAMIC_FTRACE
41 .globl mcount_call
42mcount_call:
43 mov.l .Lftrace_stub, r6
44#else
45 mov.l .Lftrace_trace_function, r6
46 mov.l ftrace_stub, r7
47 cmp/eq r6, r7
48 bt skip_trace
49 mov.l @r6, r6
50#endif
51
52 jsr @r6
53 nop
54
55skip_trace:
56 MCOUNT_LEAVE()
57
58 .align 2
59.Lftrace_trace_function:
60 .long ftrace_trace_function
61
62#ifdef CONFIG_DYNAMIC_FTRACE
63 .globl ftrace_caller
64ftrace_caller:
65 MCOUNT_ENTER()
66
67 .globl ftrace_call
68ftrace_call:
69 mov.l .Lftrace_stub, r6
70 jsr @r6
71 nop
72
73 MCOUNT_LEAVE()
74#endif /* CONFIG_DYNAMIC_FTRACE */
75
76/*
77 * NOTE: From here on the locations of the .Lftrace_stub label and
78 * ftrace_stub itself are fixed. Adding additional data here will skew
79 * the displacement for the memory table and break the block replacement.
80 * Place new labels either after the ftrace_stub body, or before
81 * ftrace_caller. You have been warned.
82 */
83 .align 2
84.Lftrace_stub:
85 .long ftrace_stub
86
87 .globl ftrace_stub
88ftrace_stub:
89 rts
90 nop
diff --git a/arch/sh/lib/movmem.S b/arch/sh/lib/movmem.S
new file mode 100644
index 000000000000..62075f6bc67c
--- /dev/null
+++ b/arch/sh/lib/movmem.S
@@ -0,0 +1,238 @@
1/* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2 2004, 2005, 2006
3 Free Software Foundation, Inc.
4
5This file is free software; you can redistribute it and/or modify it
6under the terms of the GNU General Public License as published by the
7Free Software Foundation; either version 2, or (at your option) any
8later version.
9
10In addition to the permissions in the GNU General Public License, the
11Free Software Foundation gives you unlimited permission to link the
12compiled version of this file into combinations with other programs,
13and to distribute those combinations without any restriction coming
14from the use of this file. (The General Public License restrictions
15do apply in other respects; for example, they cover modification of
16the file, and distribution when not linked into a combine
17executable.)
18
19This file is distributed in the hope that it will be useful, but
20WITHOUT ANY WARRANTY; without even the implied warranty of
21MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22General Public License for more details.
23
24You should have received a copy of the GNU General Public License
25along with this program; see the file COPYING. If not, write to
26the Free Software Foundation, 51 Franklin Street, Fifth Floor,
27Boston, MA 02110-1301, USA. */
28
29!! libgcc routines for the Renesas / SuperH SH CPUs.
30!! Contributed by Steve Chamberlain.
31!! sac@cygnus.com
32
33!! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines
34!! recoded in assembly by Toshiyasu Morita
35!! tm@netcom.com
36
37/* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and
38 ELF local label prefixes by J"orn Rennecke
39 amylaar@cygnus.com */
40
41 .text
42 .balign 4
43 .global __movmem
44 .global __movstr
45 .set __movstr, __movmem
46 /* This would be a lot simpler if r6 contained the byte count
47 minus 64, and we wouldn't be called here for a byte count of 64. */
48__movmem:
49 sts.l pr,@-r15
50 shll2 r6
51 bsr __movmemSI52+2
52 mov.l @(48,r5),r0
53 .balign 4
54movmem_loop: /* Reached with rts */
55 mov.l @(60,r5),r0
56 add #-64,r6
57 mov.l r0,@(60,r4)
58 tst r6,r6
59 mov.l @(56,r5),r0
60 bt movmem_done
61 mov.l r0,@(56,r4)
62 cmp/pl r6
63 mov.l @(52,r5),r0
64 add #64,r5
65 mov.l r0,@(52,r4)
66 add #64,r4
67 bt __movmemSI52
68! done all the large groups, do the remainder
69! jump to movmem+
70 mova __movmemSI4+4,r0
71 add r6,r0
72 jmp @r0
73movmem_done: ! share slot insn, works out aligned.
74 lds.l @r15+,pr
75 mov.l r0,@(56,r4)
76 mov.l @(52,r5),r0
77 rts
78 mov.l r0,@(52,r4)
79 .balign 4
80
81 .global __movmemSI64
82 .global __movstrSI64
83 .set __movstrSI64, __movmemSI64
84__movmemSI64:
85 mov.l @(60,r5),r0
86 mov.l r0,@(60,r4)
87 .global __movmemSI60
88 .global __movstrSI60
89 .set __movstrSI60, __movmemSI60
90__movmemSI60:
91 mov.l @(56,r5),r0
92 mov.l r0,@(56,r4)
93 .global __movmemSI56
94 .global __movstrSI56
95 .set __movstrSI56, __movmemSI56
96__movmemSI56:
97 mov.l @(52,r5),r0
98 mov.l r0,@(52,r4)
99 .global __movmemSI52
100 .global __movstrSI52
101 .set __movstrSI52, __movmemSI52
102__movmemSI52:
103 mov.l @(48,r5),r0
104 mov.l r0,@(48,r4)
105 .global __movmemSI48
106 .global __movstrSI48
107 .set __movstrSI48, __movmemSI48
108__movmemSI48:
109 mov.l @(44,r5),r0
110 mov.l r0,@(44,r4)
111 .global __movmemSI44
112 .global __movstrSI44
113 .set __movstrSI44, __movmemSI44
114__movmemSI44:
115 mov.l @(40,r5),r0
116 mov.l r0,@(40,r4)
117 .global __movmemSI40
118 .global __movstrSI40
119 .set __movstrSI40, __movmemSI40
120__movmemSI40:
121 mov.l @(36,r5),r0
122 mov.l r0,@(36,r4)
123 .global __movmemSI36
124 .global __movstrSI36
125 .set __movstrSI36, __movmemSI36
126__movmemSI36:
127 mov.l @(32,r5),r0
128 mov.l r0,@(32,r4)
129 .global __movmemSI32
130 .global __movstrSI32
131 .set __movstrSI32, __movmemSI32
132__movmemSI32:
133 mov.l @(28,r5),r0
134 mov.l r0,@(28,r4)
135 .global __movmemSI28
136 .global __movstrSI28
137 .set __movstrSI28, __movmemSI28
138__movmemSI28:
139 mov.l @(24,r5),r0
140 mov.l r0,@(24,r4)
141 .global __movmemSI24
142 .global __movstrSI24
143 .set __movstrSI24, __movmemSI24
144__movmemSI24:
145 mov.l @(20,r5),r0
146 mov.l r0,@(20,r4)
147 .global __movmemSI20
148 .global __movstrSI20
149 .set __movstrSI20, __movmemSI20
150__movmemSI20:
151 mov.l @(16,r5),r0
152 mov.l r0,@(16,r4)
153 .global __movmemSI16
154 .global __movstrSI16
155 .set __movstrSI16, __movmemSI16
156__movmemSI16:
157 mov.l @(12,r5),r0
158 mov.l r0,@(12,r4)
159 .global __movmemSI12
160 .global __movstrSI12
161 .set __movstrSI12, __movmemSI12
162__movmemSI12:
163 mov.l @(8,r5),r0
164 mov.l r0,@(8,r4)
165 .global __movmemSI8
166 .global __movstrSI8
167 .set __movstrSI8, __movmemSI8
168__movmemSI8:
169 mov.l @(4,r5),r0
170 mov.l r0,@(4,r4)
171 .global __movmemSI4
172 .global __movstrSI4
173 .set __movstrSI4, __movmemSI4
174__movmemSI4:
175 mov.l @(0,r5),r0
176 rts
177 mov.l r0,@(0,r4)
178
179 .global __movmem_i4_even
180 .global __movstr_i4_even
181 .set __movstr_i4_even, __movmem_i4_even
182
183 .global __movmem_i4_odd
184 .global __movstr_i4_odd
185 .set __movstr_i4_odd, __movmem_i4_odd
186
187 .global __movmemSI12_i4
188 .global __movstrSI12_i4
189 .set __movstrSI12_i4, __movmemSI12_i4
190
191 .p2align 5
192L_movmem_2mod4_end:
193 mov.l r0,@(16,r4)
194 rts
195 mov.l r1,@(20,r4)
196
197 .p2align 2
198
199__movmem_i4_even:
200 mov.l @r5+,r0
201 bra L_movmem_start_even
202 mov.l @r5+,r1
203
204__movmem_i4_odd:
205 mov.l @r5+,r1
206 add #-4,r4
207 mov.l @r5+,r2
208 mov.l @r5+,r3
209 mov.l r1,@(4,r4)
210 mov.l r2,@(8,r4)
211
212L_movmem_loop:
213 mov.l r3,@(12,r4)
214 dt r6
215 mov.l @r5+,r0
216 bt/s L_movmem_2mod4_end
217 mov.l @r5+,r1
218 add #16,r4
219L_movmem_start_even:
220 mov.l @r5+,r2
221 mov.l @r5+,r3
222 mov.l r0,@r4
223 dt r6
224 mov.l r1,@(4,r4)
225 bf/s L_movmem_loop
226 mov.l r2,@(8,r4)
227 rts
228 mov.l r3,@(12,r4)
229
230 .p2align 4
231__movmemSI12_i4:
232 mov.l @r5,r0
233 mov.l @(4,r5),r1
234 mov.l @(8,r5),r2
235 mov.l r0,@r4
236 mov.l r1,@(4,r4)
237 rts
238 mov.l r2,@(8,r4)
diff --git a/arch/sh/lib/udiv_qrnnd.S b/arch/sh/lib/udiv_qrnnd.S
new file mode 100644
index 000000000000..32b9a36de943
--- /dev/null
+++ b/arch/sh/lib/udiv_qrnnd.S
@@ -0,0 +1,81 @@
1/* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2 2004, 2005, 2006
3 Free Software Foundation, Inc.
4
5This file is free software; you can redistribute it and/or modify it
6under the terms of the GNU General Public License as published by the
7Free Software Foundation; either version 2, or (at your option) any
8later version.
9
10In addition to the permissions in the GNU General Public License, the
11Free Software Foundation gives you unlimited permission to link the
12compiled version of this file into combinations with other programs,
13and to distribute those combinations without any restriction coming
14from the use of this file. (The General Public License restrictions
15do apply in other respects; for example, they cover modification of
16the file, and distribution when not linked into a combine
17executable.)
18
19This file is distributed in the hope that it will be useful, but
20WITHOUT ANY WARRANTY; without even the implied warranty of
21MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22General Public License for more details.
23
24You should have received a copy of the GNU General Public License
25along with this program; see the file COPYING. If not, write to
26the Free Software Foundation, 51 Franklin Street, Fifth Floor,
27Boston, MA 02110-1301, USA. */
28
29!! libgcc routines for the Renesas / SuperH SH CPUs.
30!! Contributed by Steve Chamberlain.
31!! sac@cygnus.com
32
33!! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines
34!! recoded in assembly by Toshiyasu Morita
35!! tm@netcom.com
36
37/* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and
38 ELF local label prefixes by J"orn Rennecke
39 amylaar@cygnus.com */
40
41 /* r0: rn r1: qn */ /* r0: n1 r4: n0 r5: d r6: d1 */ /* r2: __m */
42 /* n1 < d, but n1 might be larger than d1. */
43 .global __udiv_qrnnd_16
44 .balign 8
45__udiv_qrnnd_16:
46 div0u
47 cmp/hi r6,r0
48 bt .Lots
49 .rept 16
50 div1 r6,r0
51 .endr
52 extu.w r0,r1
53 bt 0f
54 add r6,r0
550: rotcl r1
56 mulu.w r1,r5
57 xtrct r4,r0
58 swap.w r0,r0
59 sts macl,r2
60 cmp/hs r2,r0
61 sub r2,r0
62 bt 0f
63 addc r5,r0
64 add #-1,r1
65 bt 0f
661: add #-1,r1
67 rts
68 add r5,r0
69 .balign 8
70.Lots:
71 sub r5,r0
72 swap.w r4,r1
73 xtrct r0,r1
74 clrt
75 mov r1,r0
76 addc r5,r0
77 mov #-1,r1
78 bf/s 1b
79 shlr16 r1
800: rts
81 nop
diff --git a/arch/sh/lib/udivsi3.S b/arch/sh/lib/udivsi3.S
new file mode 100644
index 000000000000..72157ab5c314
--- /dev/null
+++ b/arch/sh/lib/udivsi3.S
@@ -0,0 +1,87 @@
1/* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2 2004, 2005
3 Free Software Foundation, Inc.
4
5This file is free software; you can redistribute it and/or modify it
6under the terms of the GNU General Public License as published by the
7Free Software Foundation; either version 2, or (at your option) any
8later version.
9
10In addition to the permissions in the GNU General Public License, the
11Free Software Foundation gives you unlimited permission to link the
12compiled version of this file into combinations with other programs,
13and to distribute those combinations without any restriction coming
14from the use of this file. (The General Public License restrictions
15do apply in other respects; for example, they cover modification of
16the file, and distribution when not linked into a combine
17executable.)
18
19This file is distributed in the hope that it will be useful, but
20WITHOUT ANY WARRANTY; without even the implied warranty of
21MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22General Public License for more details.
23
24You should have received a copy of the GNU General Public License
25along with this program; see the file COPYING. If not, write to
26the Free Software Foundation, 51 Franklin Street, Fifth Floor,
27Boston, MA 02110-1301, USA. */
28
29!! libgcc routines for the Renesas / SuperH SH CPUs.
30!! Contributed by Steve Chamberlain.
31!! sac@cygnus.com
32
33 .balign 4
34 .global __udivsi3
35 .type __udivsi3, @function
36div8:
37 div1 r5,r4
38div7:
39 div1 r5,r4; div1 r5,r4; div1 r5,r4
40 div1 r5,r4; div1 r5,r4; div1 r5,r4; rts; div1 r5,r4
41
42divx4:
43 div1 r5,r4; rotcl r0
44 div1 r5,r4; rotcl r0
45 div1 r5,r4; rotcl r0
46 rts; div1 r5,r4
47
48__udivsi3:
49 sts.l pr,@-r15
50 extu.w r5,r0
51 cmp/eq r5,r0
52 bf/s large_divisor
53 div0u
54 swap.w r4,r0
55 shlr16 r4
56 bsr div8
57 shll16 r5
58 bsr div7
59 div1 r5,r4
60 xtrct r4,r0
61 xtrct r0,r4
62 bsr div8
63 swap.w r4,r4
64 bsr div7
65 div1 r5,r4
66 lds.l @r15+,pr
67 xtrct r4,r0
68 swap.w r0,r0
69 rotcl r0
70 rts
71 shlr16 r5
72
73large_divisor:
74 mov #0,r0
75 xtrct r4,r0
76 xtrct r0,r4
77 bsr divx4
78 rotcl r0
79 bsr divx4
80 rotcl r0
81 bsr divx4
82 rotcl r0
83 bsr divx4
84 rotcl r0
85 lds.l @r15+,pr
86 rts
87 rotcl r0
diff --git a/arch/sh/lib/udivsi3_i4i-Os.S b/arch/sh/lib/udivsi3_i4i-Os.S
new file mode 100644
index 000000000000..4835553e1ea9
--- /dev/null
+++ b/arch/sh/lib/udivsi3_i4i-Os.S
@@ -0,0 +1,149 @@
1/* Copyright (C) 2006 Free Software Foundation, Inc.
2
3This file is free software; you can redistribute it and/or modify it
4under the terms of the GNU General Public License as published by the
5Free Software Foundation; either version 2, or (at your option) any
6later version.
7
8In addition to the permissions in the GNU General Public License, the
9Free Software Foundation gives you unlimited permission to link the
10compiled version of this file into combinations with other programs,
11and to distribute those combinations without any restriction coming
12from the use of this file. (The General Public License restrictions
13do apply in other respects; for example, they cover modification of
14the file, and distribution when not linked into a combine
15executable.)
16
17This file is distributed in the hope that it will be useful, but
18WITHOUT ANY WARRANTY; without even the implied warranty of
19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20General Public License for more details.
21
22You should have received a copy of the GNU General Public License
23along with this program; see the file COPYING. If not, write to
24the Free Software Foundation, 51 Franklin Street, Fifth Floor,
25Boston, MA 02110-1301, USA. */
26
27/* Moderately Space-optimized libgcc routines for the Renesas SH /
28 STMicroelectronics ST40 CPUs.
29 Contributed by J"orn Rennecke joern.rennecke@st.com. */
30
31/* Size: 186 bytes jointly for udivsi3_i4i and sdivsi3_i4i
32 sh4-200 run times:
33 udiv small divisor: 55 cycles
34 udiv large divisor: 52 cycles
35 sdiv small divisor, positive result: 59 cycles
36 sdiv large divisor, positive result: 56 cycles
37 sdiv small divisor, negative result: 65 cycles (*)
38 sdiv large divisor, negative result: 62 cycles (*)
39 (*): r2 is restored in the rts delay slot and has a lingering latency
40 of two more cycles. */
41 .balign 4
42 .global __udivsi3_i4i
43 .global __udivsi3_i4
44 .set __udivsi3_i4, __udivsi3_i4i
45 .type __udivsi3_i4i, @function
46 .type __sdivsi3_i4i, @function
47__udivsi3_i4i:
48 sts pr,r1
49 mov.l r4,@-r15
50 extu.w r5,r0
51 cmp/eq r5,r0
52 swap.w r4,r0
53 shlr16 r4
54 bf/s large_divisor
55 div0u
56 mov.l r5,@-r15
57 shll16 r5
58sdiv_small_divisor:
59 div1 r5,r4
60 bsr div6
61 div1 r5,r4
62 div1 r5,r4
63 bsr div6
64 div1 r5,r4
65 xtrct r4,r0
66 xtrct r0,r4
67 bsr div7
68 swap.w r4,r4
69 div1 r5,r4
70 bsr div7
71 div1 r5,r4
72 xtrct r4,r0
73 mov.l @r15+,r5
74 swap.w r0,r0
75 mov.l @r15+,r4
76 jmp @r1
77 rotcl r0
78div7:
79 div1 r5,r4
80div6:
81 div1 r5,r4; div1 r5,r4; div1 r5,r4
82 div1 r5,r4; div1 r5,r4; rts; div1 r5,r4
83
84divx3:
85 rotcl r0
86 div1 r5,r4
87 rotcl r0
88 div1 r5,r4
89 rotcl r0
90 rts
91 div1 r5,r4
92
93large_divisor:
94 mov.l r5,@-r15
95sdiv_large_divisor:
96 xor r4,r0
97 .rept 4
98 rotcl r0
99 bsr divx3
100 div1 r5,r4
101 .endr
102 mov.l @r15+,r5
103 mov.l @r15+,r4
104 jmp @r1
105 rotcl r0
106
107 .global __sdivsi3_i4i
108 .global __sdivsi3_i4
109 .global __sdivsi3
110 .set __sdivsi3_i4, __sdivsi3_i4i
111 .set __sdivsi3, __sdivsi3_i4i
112__sdivsi3_i4i:
113 mov.l r4,@-r15
114 cmp/pz r5
115 mov.l r5,@-r15
116 bt/s pos_divisor
117 cmp/pz r4
118 neg r5,r5
119 extu.w r5,r0
120 bt/s neg_result
121 cmp/eq r5,r0
122 neg r4,r4
123pos_result:
124 swap.w r4,r0
125 bra sdiv_check_divisor
126 sts pr,r1
127pos_divisor:
128 extu.w r5,r0
129 bt/s pos_result
130 cmp/eq r5,r0
131 neg r4,r4
132neg_result:
133 mova negate_result,r0
134 ;
135 mov r0,r1
136 swap.w r4,r0
137 lds r2,macl
138 sts pr,r2
139sdiv_check_divisor:
140 shlr16 r4
141 bf/s sdiv_large_divisor
142 div0u
143 bra sdiv_small_divisor
144 shll16 r5
145 .balign 4
146negate_result:
147 neg r0,r0
148 jmp @r2
149 sts macl,r2
diff --git a/arch/sh/lib/udivsi3_i4i.S b/arch/sh/lib/udivsi3_i4i.S
new file mode 100644
index 000000000000..f1a79d9c5015
--- /dev/null
+++ b/arch/sh/lib/udivsi3_i4i.S
@@ -0,0 +1,666 @@
1/* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2 2004, 2005, 2006
3 Free Software Foundation, Inc.
4
5This file is free software; you can redistribute it and/or modify it
6under the terms of the GNU General Public License as published by the
7Free Software Foundation; either version 2, or (at your option) any
8later version.
9
10In addition to the permissions in the GNU General Public License, the
11Free Software Foundation gives you unlimited permission to link the
12compiled version of this file into combinations with other programs,
13and to distribute those combinations without any restriction coming
14from the use of this file. (The General Public License restrictions
15do apply in other respects; for example, they cover modification of
16the file, and distribution when not linked into a combine
17executable.)
18
19This file is distributed in the hope that it will be useful, but
20WITHOUT ANY WARRANTY; without even the implied warranty of
21MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22General Public License for more details.
23
24You should have received a copy of the GNU General Public License
25along with this program; see the file COPYING. If not, write to
26the Free Software Foundation, 51 Franklin Street, Fifth Floor,
27Boston, MA 02110-1301, USA. */
28
29!! libgcc routines for the Renesas / SuperH SH CPUs.
30!! Contributed by Steve Chamberlain.
31!! sac@cygnus.com
32
33!! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines
34!! recoded in assembly by Toshiyasu Morita
35!! tm@netcom.com
36
37/* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and
38 ELF local label prefixes by J"orn Rennecke
39 amylaar@cygnus.com */
40
41/* This code used shld, thus is not suitable for SH1 / SH2. */
42
43/* Signed / unsigned division without use of FPU, optimized for SH4.
44 Uses a lookup table for divisors in the range -128 .. +128, and
45 div1 with case distinction for larger divisors in three more ranges.
46 The code is lumped together with the table to allow the use of mova. */
47#ifdef CONFIG_CPU_LITTLE_ENDIAN
48#define L_LSB 0
49#define L_LSWMSB 1
50#define L_MSWLSB 2
51#else
52#define L_LSB 3
53#define L_LSWMSB 2
54#define L_MSWLSB 1
55#endif
56
57 .balign 4
58 .global __udivsi3_i4i
59 .global __udivsi3_i4
60 .set __udivsi3_i4, __udivsi3_i4i
61 .type __udivsi3_i4i, @function
62__udivsi3_i4i:
63 mov.w c128_w, r1
64 div0u
65 mov r4,r0
66 shlr8 r0
67 cmp/hi r1,r5
68 extu.w r5,r1
69 bf udiv_le128
70 cmp/eq r5,r1
71 bf udiv_ge64k
72 shlr r0
73 mov r5,r1
74 shll16 r5
75 mov.l r4,@-r15
76 div1 r5,r0
77 mov.l r1,@-r15
78 div1 r5,r0
79 div1 r5,r0
80 bra udiv_25
81 div1 r5,r0
82
83div_le128:
84 mova div_table_ix,r0
85 bra div_le128_2
86 mov.b @(r0,r5),r1
87udiv_le128:
88 mov.l r4,@-r15
89 mova div_table_ix,r0
90 mov.b @(r0,r5),r1
91 mov.l r5,@-r15
92div_le128_2:
93 mova div_table_inv,r0
94 mov.l @(r0,r1),r1
95 mov r5,r0
96 tst #0xfe,r0
97 mova div_table_clz,r0
98 dmulu.l r1,r4
99 mov.b @(r0,r5),r1
100 bt/s div_by_1
101 mov r4,r0
102 mov.l @r15+,r5
103 sts mach,r0
104 /* clrt */
105 addc r4,r0
106 mov.l @r15+,r4
107 rotcr r0
108 rts
109 shld r1,r0
110
111div_by_1_neg:
112 neg r4,r0
113div_by_1:
114 mov.l @r15+,r5
115 rts
116 mov.l @r15+,r4
117
118div_ge64k:
119 bt/s div_r8
120 div0u
121 shll8 r5
122 bra div_ge64k_2
123 div1 r5,r0
124udiv_ge64k:
125 cmp/hi r0,r5
126 mov r5,r1
127 bt udiv_r8
128 shll8 r5
129 mov.l r4,@-r15
130 div1 r5,r0
131 mov.l r1,@-r15
132div_ge64k_2:
133 div1 r5,r0
134 mov.l zero_l,r1
135 .rept 4
136 div1 r5,r0
137 .endr
138 mov.l r1,@-r15
139 div1 r5,r0
140 mov.w m256_w,r1
141 div1 r5,r0
142 mov.b r0,@(L_LSWMSB,r15)
143 xor r4,r0
144 and r1,r0
145 bra div_ge64k_end
146 xor r4,r0
147
148div_r8:
149 shll16 r4
150 bra div_r8_2
151 shll8 r4
152udiv_r8:
153 mov.l r4,@-r15
154 shll16 r4
155 clrt
156 shll8 r4
157 mov.l r5,@-r15
158div_r8_2:
159 rotcl r4
160 mov r0,r1
161 div1 r5,r1
162 mov r4,r0
163 rotcl r0
164 mov r5,r4
165 div1 r5,r1
166 .rept 5
167 rotcl r0; div1 r5,r1
168 .endr
169 rotcl r0
170 mov.l @r15+,r5
171 div1 r4,r1
172 mov.l @r15+,r4
173 rts
174 rotcl r0
175
176 .global __sdivsi3_i4i
177 .global __sdivsi3_i4
178 .global __sdivsi3
179 .set __sdivsi3_i4, __sdivsi3_i4i
180 .set __sdivsi3, __sdivsi3_i4i
181 .type __sdivsi3_i4i, @function
182 /* This is link-compatible with a __sdivsi3 call,
183 but we effectively clobber only r1. */
184__sdivsi3_i4i:
185 mov.l r4,@-r15
186 cmp/pz r5
187 mov.w c128_w, r1
188 bt/s pos_divisor
189 cmp/pz r4
190 mov.l r5,@-r15
191 neg r5,r5
192 bt/s neg_result
193 cmp/hi r1,r5
194 neg r4,r4
195pos_result:
196 extu.w r5,r0
197 bf div_le128
198 cmp/eq r5,r0
199 mov r4,r0
200 shlr8 r0
201 bf/s div_ge64k
202 cmp/hi r0,r5
203 div0u
204 shll16 r5
205 div1 r5,r0
206 div1 r5,r0
207 div1 r5,r0
208udiv_25:
209 mov.l zero_l,r1
210 div1 r5,r0
211 div1 r5,r0
212 mov.l r1,@-r15
213 .rept 3
214 div1 r5,r0
215 .endr
216 mov.b r0,@(L_MSWLSB,r15)
217 xtrct r4,r0
218 swap.w r0,r0
219 .rept 8
220 div1 r5,r0
221 .endr
222 mov.b r0,@(L_LSWMSB,r15)
223div_ge64k_end:
224 .rept 8
225 div1 r5,r0
226 .endr
227 mov.l @r15+,r4 ! zero-extension and swap using LS unit.
228 extu.b r0,r0
229 mov.l @r15+,r5
230 or r4,r0
231 mov.l @r15+,r4
232 rts
233 rotcl r0
234
235div_le128_neg:
236 tst #0xfe,r0
237 mova div_table_ix,r0
238 mov.b @(r0,r5),r1
239 mova div_table_inv,r0
240 bt/s div_by_1_neg
241 mov.l @(r0,r1),r1
242 mova div_table_clz,r0
243 dmulu.l r1,r4
244 mov.b @(r0,r5),r1
245 mov.l @r15+,r5
246 sts mach,r0
247 /* clrt */
248 addc r4,r0
249 mov.l @r15+,r4
250 rotcr r0
251 shld r1,r0
252 rts
253 neg r0,r0
254
255pos_divisor:
256 mov.l r5,@-r15
257 bt/s pos_result
258 cmp/hi r1,r5
259 neg r4,r4
260neg_result:
261 extu.w r5,r0
262 bf div_le128_neg
263 cmp/eq r5,r0
264 mov r4,r0
265 shlr8 r0
266 bf/s div_ge64k_neg
267 cmp/hi r0,r5
268 div0u
269 mov.l zero_l,r1
270 shll16 r5
271 div1 r5,r0
272 mov.l r1,@-r15
273 .rept 7
274 div1 r5,r0
275 .endr
276 mov.b r0,@(L_MSWLSB,r15)
277 xtrct r4,r0
278 swap.w r0,r0
279 .rept 8
280 div1 r5,r0
281 .endr
282 mov.b r0,@(L_LSWMSB,r15)
283div_ge64k_neg_end:
284 .rept 8
285 div1 r5,r0
286 .endr
287 mov.l @r15+,r4 ! zero-extension and swap using LS unit.
288 extu.b r0,r1
289 mov.l @r15+,r5
290 or r4,r1
291div_r8_neg_end:
292 mov.l @r15+,r4
293 rotcl r1
294 rts
295 neg r1,r0
296
297div_ge64k_neg:
298 bt/s div_r8_neg
299 div0u
300 shll8 r5
301 mov.l zero_l,r1
302 .rept 6
303 div1 r5,r0
304 .endr
305 mov.l r1,@-r15
306 div1 r5,r0
307 mov.w m256_w,r1
308 div1 r5,r0
309 mov.b r0,@(L_LSWMSB,r15)
310 xor r4,r0
311 and r1,r0
312 bra div_ge64k_neg_end
313 xor r4,r0
314
315c128_w:
316 .word 128
317
318div_r8_neg:
319 clrt
320 shll16 r4
321 mov r4,r1
322 shll8 r1
323 mov r5,r4
324 .rept 7
325 rotcl r1; div1 r5,r0
326 .endr
327 mov.l @r15+,r5
328 rotcl r1
329 bra div_r8_neg_end
330 div1 r4,r0
331
332m256_w:
333 .word 0xff00
334/* This table has been generated by divtab-sh4.c. */
335 .balign 4
336div_table_clz:
337 .byte 0
338 .byte 1
339 .byte 0
340 .byte -1
341 .byte -1
342 .byte -2
343 .byte -2
344 .byte -2
345 .byte -2
346 .byte -3
347 .byte -3
348 .byte -3
349 .byte -3
350 .byte -3
351 .byte -3
352 .byte -3
353 .byte -3
354 .byte -4
355 .byte -4
356 .byte -4
357 .byte -4
358 .byte -4
359 .byte -4
360 .byte -4
361 .byte -4
362 .byte -4
363 .byte -4
364 .byte -4
365 .byte -4
366 .byte -4
367 .byte -4
368 .byte -4
369 .byte -4
370 .byte -5
371 .byte -5
372 .byte -5
373 .byte -5
374 .byte -5
375 .byte -5
376 .byte -5
377 .byte -5
378 .byte -5
379 .byte -5
380 .byte -5
381 .byte -5
382 .byte -5
383 .byte -5
384 .byte -5
385 .byte -5
386 .byte -5
387 .byte -5
388 .byte -5
389 .byte -5
390 .byte -5
391 .byte -5
392 .byte -5
393 .byte -5
394 .byte -5
395 .byte -5
396 .byte -5
397 .byte -5
398 .byte -5
399 .byte -5
400 .byte -5
401 .byte -5
402 .byte -6
403 .byte -6
404 .byte -6
405 .byte -6
406 .byte -6
407 .byte -6
408 .byte -6
409 .byte -6
410 .byte -6
411 .byte -6
412 .byte -6
413 .byte -6
414 .byte -6
415 .byte -6
416 .byte -6
417 .byte -6
418 .byte -6
419 .byte -6
420 .byte -6
421 .byte -6
422 .byte -6
423 .byte -6
424 .byte -6
425 .byte -6
426 .byte -6
427 .byte -6
428 .byte -6
429 .byte -6
430 .byte -6
431 .byte -6
432 .byte -6
433 .byte -6
434 .byte -6
435 .byte -6
436 .byte -6
437 .byte -6
438 .byte -6
439 .byte -6
440 .byte -6
441 .byte -6
442 .byte -6
443 .byte -6
444 .byte -6
445 .byte -6
446 .byte -6
447 .byte -6
448 .byte -6
449 .byte -6
450 .byte -6
451 .byte -6
452 .byte -6
453 .byte -6
454 .byte -6
455 .byte -6
456 .byte -6
457 .byte -6
458 .byte -6
459 .byte -6
460 .byte -6
461 .byte -6
462 .byte -6
463 .byte -6
464 .byte -6
465/* Lookup table translating positive divisor to index into table of
466 normalized inverse. N.B. the '0' entry is also the last entry of the
467 previous table, and causes an unaligned access for division by zero. */
468div_table_ix:
469 .byte -6
470 .byte -128
471 .byte -128
472 .byte 0
473 .byte -128
474 .byte -64
475 .byte 0
476 .byte 64
477 .byte -128
478 .byte -96
479 .byte -64
480 .byte -32
481 .byte 0
482 .byte 32
483 .byte 64
484 .byte 96
485 .byte -128
486 .byte -112
487 .byte -96
488 .byte -80
489 .byte -64
490 .byte -48
491 .byte -32
492 .byte -16
493 .byte 0
494 .byte 16
495 .byte 32
496 .byte 48
497 .byte 64
498 .byte 80
499 .byte 96
500 .byte 112
501 .byte -128
502 .byte -120
503 .byte -112
504 .byte -104
505 .byte -96
506 .byte -88
507 .byte -80
508 .byte -72
509 .byte -64
510 .byte -56
511 .byte -48
512 .byte -40
513 .byte -32
514 .byte -24
515 .byte -16
516 .byte -8
517 .byte 0
518 .byte 8
519 .byte 16
520 .byte 24
521 .byte 32
522 .byte 40
523 .byte 48
524 .byte 56
525 .byte 64
526 .byte 72
527 .byte 80
528 .byte 88
529 .byte 96
530 .byte 104
531 .byte 112
532 .byte 120
533 .byte -128
534 .byte -124
535 .byte -120
536 .byte -116
537 .byte -112
538 .byte -108
539 .byte -104
540 .byte -100
541 .byte -96
542 .byte -92
543 .byte -88
544 .byte -84
545 .byte -80
546 .byte -76
547 .byte -72
548 .byte -68
549 .byte -64
550 .byte -60
551 .byte -56
552 .byte -52
553 .byte -48
554 .byte -44
555 .byte -40
556 .byte -36
557 .byte -32
558 .byte -28
559 .byte -24
560 .byte -20
561 .byte -16
562 .byte -12
563 .byte -8
564 .byte -4
565 .byte 0
566 .byte 4
567 .byte 8
568 .byte 12
569 .byte 16
570 .byte 20
571 .byte 24
572 .byte 28
573 .byte 32
574 .byte 36
575 .byte 40
576 .byte 44
577 .byte 48
578 .byte 52
579 .byte 56
580 .byte 60
581 .byte 64
582 .byte 68
583 .byte 72
584 .byte 76
585 .byte 80
586 .byte 84
587 .byte 88
588 .byte 92
589 .byte 96
590 .byte 100
591 .byte 104
592 .byte 108
593 .byte 112
594 .byte 116
595 .byte 120
596 .byte 124
597 .byte -128
598/* 1/64 .. 1/127, normalized. There is an implicit leading 1 in bit 32. */
599 .balign 4
600zero_l:
601 .long 0x0
602 .long 0xF81F81F9
603 .long 0xF07C1F08
604 .long 0xE9131AC0
605 .long 0xE1E1E1E2
606 .long 0xDAE6076C
607 .long 0xD41D41D5
608 .long 0xCD856891
609 .long 0xC71C71C8
610 .long 0xC0E07039
611 .long 0xBACF914D
612 .long 0xB4E81B4F
613 .long 0xAF286BCB
614 .long 0xA98EF607
615 .long 0xA41A41A5
616 .long 0x9EC8E952
617 .long 0x9999999A
618 .long 0x948B0FCE
619 .long 0x8F9C18FA
620 .long 0x8ACB90F7
621 .long 0x86186187
622 .long 0x81818182
623 .long 0x7D05F418
624 .long 0x78A4C818
625 .long 0x745D1746
626 .long 0x702E05C1
627 .long 0x6C16C16D
628 .long 0x68168169
629 .long 0x642C8591
630 .long 0x60581606
631 .long 0x5C9882BA
632 .long 0x58ED2309
633div_table_inv:
634 .long 0x55555556
635 .long 0x51D07EAF
636 .long 0x4E5E0A73
637 .long 0x4AFD6A06
638 .long 0x47AE147B
639 .long 0x446F8657
640 .long 0x41414142
641 .long 0x3E22CBCF
642 .long 0x3B13B13C
643 .long 0x38138139
644 .long 0x3521CFB3
645 .long 0x323E34A3
646 .long 0x2F684BDB
647 .long 0x2C9FB4D9
648 .long 0x29E4129F
649 .long 0x27350B89
650 .long 0x24924925
651 .long 0x21FB7813
652 .long 0x1F7047DD
653 .long 0x1CF06ADB
654 .long 0x1A7B9612
655 .long 0x18118119
656 .long 0x15B1E5F8
657 .long 0x135C8114
658 .long 0x11111112
659 .long 0xECF56BF
660 .long 0xC9714FC
661 .long 0xA6810A7
662 .long 0x8421085
663 .long 0x624DD30
664 .long 0x4104105
665 .long 0x2040811
666 /* maximum error: 0.987342 scaled: 0.921875*/
diff --git a/arch/sh/lib64/Makefile b/arch/sh/lib64/Makefile
index 9950966923a0..4bacb9e83478 100644
--- a/arch/sh/lib64/Makefile
+++ b/arch/sh/lib64/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the SH-5 specific library files.. 2# Makefile for the SH-5 specific library files..
3# 3#
4# Copyright (C) 2000, 2001 Paolo Alberelli 4# Copyright (C) 2000, 2001 Paolo Alberelli
5# Copyright (C) 2003 Paul Mundt 5# Copyright (C) 2003 - 2008 Paul Mundt
6# 6#
7# This file is subject to the terms and conditions of the GNU General Public 7# This file is subject to the terms and conditions of the GNU General Public
8# License. See the file "COPYING" in the main directory of this archive 8# License. See the file "COPYING" in the main directory of this archive
@@ -10,6 +10,8 @@
10# 10#
11 11
12# Panic should really be compiled as PIC 12# Panic should really be compiled as PIC
13lib-y := udelay.o c-checksum.o dbg.o panic.o memcpy.o copy_user_memcpy.o \ 13lib-y := udelay.o c-checksum.o dbg.o panic.o memcpy.o memset.o \
14 copy_page.o clear_page.o 14 copy_user_memcpy.o copy_page.o clear_page.o strcpy.o strlen.o
15 15
16# Extracted from libgcc
17lib-y += udivsi3.o udivdi3.o sdivsi3.o
diff --git a/arch/sh/lib64/c-checksum.c b/arch/sh/lib64/c-checksum.c
index 5c284e0cff9c..73c0877e3a29 100644
--- a/arch/sh/lib64/c-checksum.c
+++ b/arch/sh/lib64/c-checksum.c
@@ -35,7 +35,7 @@ static inline unsigned short foldto16(unsigned long x)
35 35
36static inline unsigned short myfoldto16(unsigned long long x) 36static inline unsigned short myfoldto16(unsigned long long x)
37{ 37{
38 /* Fold down to 32-bits so we don't loose in the typedef-less 38 /* Fold down to 32-bits so we don't lose in the typedef-less
39 network stack. */ 39 network stack. */
40 /* 64 to 33 */ 40 /* 64 to 33 */
41 x = (x & 0xffffffff) + (x >> 32); 41 x = (x & 0xffffffff) + (x >> 32);
@@ -199,7 +199,7 @@ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
199 result = (__force u64) saddr + (__force u64) daddr + 199 result = (__force u64) saddr + (__force u64) daddr +
200 (__force u64) sum + ((len + proto) << 8); 200 (__force u64) sum + ((len + proto) << 8);
201 201
202 /* Fold down to 32-bits so we don't loose in the typedef-less 202 /* Fold down to 32-bits so we don't lose in the typedef-less
203 network stack. */ 203 network stack. */
204 /* 64 to 33 */ 204 /* 64 to 33 */
205 result = (result & 0xffffffff) + (result >> 32); 205 result = (result & 0xffffffff) + (result >> 32);
diff --git a/arch/sh/lib64/memcpy.S b/arch/sh/lib64/memcpy.S
new file mode 100644
index 000000000000..dd300c372ce1
--- /dev/null
+++ b/arch/sh/lib64/memcpy.S
@@ -0,0 +1,201 @@
1/* Cloned and hacked for uClibc by Paul Mundt, December 2003 */
2/* Modified by SuperH, Inc. September 2003 */
3!
4! Fast SH memcpy
5!
6! by Toshiyasu Morita (tm@netcom.com)
7! hacked by J"orn Rernnecke (joern.rennecke@superh.com) ("o for o-umlaut)
8! SH5 code Copyright 2002 SuperH Ltd.
9!
10! Entry: ARG0: destination pointer
11! ARG1: source pointer
12! ARG2: byte count
13!
14! Exit: RESULT: destination pointer
15! any other registers in the range r0-r7: trashed
16!
17! Notes: Usually one wants to do small reads and write a longword, but
18! unfortunately it is difficult in some cases to concatanate bytes
19! into a longword on the SH, so this does a longword read and small
20! writes.
21!
22! This implementation makes two assumptions about how it is called:
23!
24! 1.: If the byte count is nonzero, the address of the last byte to be
25! copied is unsigned greater than the address of the first byte to
26! be copied. This could be easily swapped for a signed comparison,
27! but the algorithm used needs some comparison.
28!
29! 2.: When there are two or three bytes in the last word of an 11-or-more
30! bytes memory chunk to b copied, the rest of the word can be read
31! without side effects.
32! This could be easily changed by increasing the minumum size of
33! a fast memcpy and the amount subtracted from r7 before L_2l_loop be 2,
34! however, this would cost a few extra cyles on average.
35! For SHmedia, the assumption is that any quadword can be read in its
36! enirety if at least one byte is included in the copy.
37!
38
39 .section .text..SHmedia32,"ax"
40 .globl memcpy
41 .type memcpy, @function
42 .align 5
43
44memcpy:
45
46#define LDUAQ(P,O,D0,D1) ldlo.q P,O,D0; ldhi.q P,O+7,D1
47#define STUAQ(P,O,D0,D1) stlo.q P,O,D0; sthi.q P,O+7,D1
48#define LDUAL(P,O,D0,D1) ldlo.l P,O,D0; ldhi.l P,O+3,D1
49#define STUAL(P,O,D0,D1) stlo.l P,O,D0; sthi.l P,O+3,D1
50
51 ld.b r3,0,r63
52 pta/l Large,tr0
53 movi 25,r0
54 bgeu/u r4,r0,tr0
55 nsb r4,r0
56 shlli r0,5,r0
57 movi (L1-L0+63*32 + 1) & 0xffff,r1
58 sub r1, r0, r0
59L0: ptrel r0,tr0
60 add r2,r4,r5
61 ptabs r18,tr1
62 add r3,r4,r6
63 blink tr0,r63
64
65/* Rearranged to make cut2 safe */
66 .balign 8
67L4_7: /* 4..7 byte memcpy cntd. */
68 stlo.l r2, 0, r0
69 or r6, r7, r6
70 sthi.l r5, -1, r6
71 stlo.l r5, -4, r6
72 blink tr1,r63
73
74 .balign 8
75L1: /* 0 byte memcpy */
76 nop
77 blink tr1,r63
78 nop
79 nop
80 nop
81 nop
82
83L2_3: /* 2 or 3 byte memcpy cntd. */
84 st.b r5,-1,r6
85 blink tr1,r63
86
87 /* 1 byte memcpy */
88 ld.b r3,0,r0
89 st.b r2,0,r0
90 blink tr1,r63
91
92L8_15: /* 8..15 byte memcpy cntd. */
93 stlo.q r2, 0, r0
94 or r6, r7, r6
95 sthi.q r5, -1, r6
96 stlo.q r5, -8, r6
97 blink tr1,r63
98
99 /* 2 or 3 byte memcpy */
100 ld.b r3,0,r0
101 ld.b r2,0,r63
102 ld.b r3,1,r1
103 st.b r2,0,r0
104 pta/l L2_3,tr0
105 ld.b r6,-1,r6
106 st.b r2,1,r1
107 blink tr0, r63
108
109 /* 4 .. 7 byte memcpy */
110 LDUAL (r3, 0, r0, r1)
111 pta L4_7, tr0
112 ldlo.l r6, -4, r7
113 or r0, r1, r0
114 sthi.l r2, 3, r0
115 ldhi.l r6, -1, r6
116 blink tr0, r63
117
118 /* 8 .. 15 byte memcpy */
119 LDUAQ (r3, 0, r0, r1)
120 pta L8_15, tr0
121 ldlo.q r6, -8, r7
122 or r0, r1, r0
123 sthi.q r2, 7, r0
124 ldhi.q r6, -1, r6
125 blink tr0, r63
126
127 /* 16 .. 24 byte memcpy */
128 LDUAQ (r3, 0, r0, r1)
129 LDUAQ (r3, 8, r8, r9)
130 or r0, r1, r0
131 sthi.q r2, 7, r0
132 or r8, r9, r8
133 sthi.q r2, 15, r8
134 ldlo.q r6, -8, r7
135 ldhi.q r6, -1, r6
136 stlo.q r2, 8, r8
137 stlo.q r2, 0, r0
138 or r6, r7, r6
139 sthi.q r5, -1, r6
140 stlo.q r5, -8, r6
141 blink tr1,r63
142
143Large:
144 ld.b r2, 0, r63
145 pta/l Loop_ua, tr1
146 ori r3, -8, r7
147 sub r2, r7, r22
148 sub r3, r2, r6
149 add r2, r4, r5
150 ldlo.q r3, 0, r0
151 addi r5, -16, r5
152 movi 64+8, r27 // could subtract r7 from that.
153 stlo.q r2, 0, r0
154 sthi.q r2, 7, r0
155 ldx.q r22, r6, r0
156 bgtu/l r27, r4, tr1
157
158 addi r5, -48, r27
159 pta/l Loop_line, tr0
160 addi r6, 64, r36
161 addi r6, -24, r19
162 addi r6, -16, r20
163 addi r6, -8, r21
164
165Loop_line:
166 ldx.q r22, r36, r63
167 alloco r22, 32
168 addi r22, 32, r22
169 ldx.q r22, r19, r23
170 sthi.q r22, -25, r0
171 ldx.q r22, r20, r24
172 ldx.q r22, r21, r25
173 stlo.q r22, -32, r0
174 ldx.q r22, r6, r0
175 sthi.q r22, -17, r23
176 sthi.q r22, -9, r24
177 sthi.q r22, -1, r25
178 stlo.q r22, -24, r23
179 stlo.q r22, -16, r24
180 stlo.q r22, -8, r25
181 bgeu r27, r22, tr0
182
183Loop_ua:
184 addi r22, 8, r22
185 sthi.q r22, -1, r0
186 stlo.q r22, -8, r0
187 ldx.q r22, r6, r0
188 bgtu/l r5, r22, tr1
189
190 add r3, r4, r7
191 ldlo.q r7, -8, r1
192 sthi.q r22, 7, r0
193 ldhi.q r7, -1, r7
194 ptabs r18,tr1
195 stlo.q r22, 0, r0
196 or r1, r7, r1
197 sthi.q r5, 15, r1
198 stlo.q r5, 8, r1
199 blink tr1, r63
200
201 .size memcpy,.-memcpy
diff --git a/arch/sh/lib64/memcpy.c b/arch/sh/lib64/memcpy.c
deleted file mode 100644
index fba436a92bfa..000000000000
--- a/arch/sh/lib64/memcpy.c
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * Copyright (C) 2002 Mark Debbage (Mark.Debbage@superh.com)
3 *
4 * May be copied or modified under the terms of the GNU General Public
5 * License. See linux/COPYING for more information.
6 *
7 */
8
9#include <linux/types.h>
10#include <asm/string.h>
11
12// This is a simplistic optimization of memcpy to increase the
13// granularity of access beyond one byte using aligned
14// loads and stores. This is not an optimal implementation
15// for SH-5 (especially with regard to prefetching and the cache),
16// and a better version should be provided later ...
17
18void *memcpy(void *dest, const void *src, size_t count)
19{
20 char *d = (char *) dest, *s = (char *) src;
21
22 if (count >= 32) {
23 int i = 8 - (((unsigned long) d) & 0x7);
24
25 if (i != 8)
26 while (i-- && count--) {
27 *d++ = *s++;
28 }
29
30 if (((((unsigned long) d) & 0x7) == 0) &&
31 ((((unsigned long) s) & 0x7) == 0)) {
32 while (count >= 32) {
33 unsigned long long t1, t2, t3, t4;
34 t1 = *(unsigned long long *) (s);
35 t2 = *(unsigned long long *) (s + 8);
36 t3 = *(unsigned long long *) (s + 16);
37 t4 = *(unsigned long long *) (s + 24);
38 *(unsigned long long *) (d) = t1;
39 *(unsigned long long *) (d + 8) = t2;
40 *(unsigned long long *) (d + 16) = t3;
41 *(unsigned long long *) (d + 24) = t4;
42 d += 32;
43 s += 32;
44 count -= 32;
45 }
46 while (count >= 8) {
47 *(unsigned long long *) d =
48 *(unsigned long long *) s;
49 d += 8;
50 s += 8;
51 count -= 8;
52 }
53 }
54
55 if (((((unsigned long) d) & 0x3) == 0) &&
56 ((((unsigned long) s) & 0x3) == 0)) {
57 while (count >= 4) {
58 *(unsigned long *) d = *(unsigned long *) s;
59 d += 4;
60 s += 4;
61 count -= 4;
62 }
63 }
64
65 if (((((unsigned long) d) & 0x1) == 0) &&
66 ((((unsigned long) s) & 0x1) == 0)) {
67 while (count >= 2) {
68 *(unsigned short *) d = *(unsigned short *) s;
69 d += 2;
70 s += 2;
71 count -= 2;
72 }
73 }
74 }
75
76 while (count--) {
77 *d++ = *s++;
78 }
79
80 return d;
81}
diff --git a/arch/sh/lib64/memset.S b/arch/sh/lib64/memset.S
new file mode 100644
index 000000000000..2d37b0488552
--- /dev/null
+++ b/arch/sh/lib64/memset.S
@@ -0,0 +1,91 @@
1/* Cloned and hacked for uClibc by Paul Mundt, December 2003 */
2/* Modified by SuperH, Inc. September 2003 */
3!
4! Fast SH memset
5!
6! by Toshiyasu Morita (tm@netcom.com)
7!
8! SH5 code by J"orn Rennecke (joern.rennecke@superh.com)
9! Copyright 2002 SuperH Ltd.
10!
11
12#if __BYTE_ORDER == __LITTLE_ENDIAN
13#define SHHI shlld
14#define SHLO shlrd
15#else
16#define SHHI shlrd
17#define SHLO shlld
18#endif
19
20 .section .text..SHmedia32,"ax"
21 .globl memset
22 .type memset, @function
23
24 .align 5
25
26memset:
27 pta/l multiquad, tr0
28 andi r2, 7, r22
29 ptabs r18, tr2
30 mshflo.b r3,r3,r3
31 add r4, r22, r23
32 mperm.w r3, r63, r3 // Fill pattern now in every byte of r3
33
34 movi 8, r9
35 bgtu/u r23, r9, tr0 // multiquad
36
37 beqi/u r4, 0, tr2 // Return with size 0 - ensures no mem accesses
38 ldlo.q r2, 0, r7
39 shlli r4, 2, r4
40 movi -1, r8
41 SHHI r8, r4, r8
42 SHHI r8, r4, r8
43 mcmv r7, r8, r3
44 stlo.q r2, 0, r3
45 blink tr2, r63
46
47multiquad:
48 pta/l lastquad, tr0
49 stlo.q r2, 0, r3
50 shlri r23, 3, r24
51 add r2, r4, r5
52 beqi/u r24, 1, tr0 // lastquad
53 pta/l loop, tr1
54 sub r2, r22, r25
55 andi r5, -8, r20 // calculate end address and
56 addi r20, -7*8, r8 // loop end address; This might overflow, so we need
57 // to use a different test before we start the loop
58 bge/u r24, r9, tr1 // loop
59 st.q r25, 8, r3
60 st.q r20, -8, r3
61 shlri r24, 1, r24
62 beqi/u r24, 1, tr0 // lastquad
63 st.q r25, 16, r3
64 st.q r20, -16, r3
65 beqi/u r24, 2, tr0 // lastquad
66 st.q r25, 24, r3
67 st.q r20, -24, r3
68lastquad:
69 sthi.q r5, -1, r3
70 blink tr2,r63
71
72loop:
73!!! alloco r25, 32 // QQQ comment out for short-term fix to SHUK #3895.
74 // QQQ commenting out is locically correct, but sub-optimal
75 // QQQ Sean McGoogan - 4th April 2003.
76 st.q r25, 8, r3
77 st.q r25, 16, r3
78 st.q r25, 24, r3
79 st.q r25, 32, r3
80 addi r25, 32, r25
81 bgeu/l r8, r25, tr1 // loop
82
83 st.q r20, -40, r3
84 st.q r20, -32, r3
85 st.q r20, -24, r3
86 st.q r20, -16, r3
87 st.q r20, -8, r3
88 sthi.q r5, -1, r3
89 blink tr2,r63
90
91 .size memset,.-memset
diff --git a/arch/sh/lib64/sdivsi3.S b/arch/sh/lib64/sdivsi3.S
new file mode 100644
index 000000000000..6a800c6a4904
--- /dev/null
+++ b/arch/sh/lib64/sdivsi3.S
@@ -0,0 +1,131 @@
1 .global __sdivsi3
2 .section .text..SHmedia32,"ax"
3 .align 2
4
5 /* inputs: r4,r5 */
6 /* clobbered: r1,r18,r19,r20,r21,r25,tr0 */
7 /* result in r0 */
8__sdivsi3:
9 ptb __div_table,tr0
10
11 nsb r5, r1
12 shlld r5, r1, r25 /* normalize; [-2 ..1, 1..2) in s2.62 */
13 shari r25, 58, r21 /* extract 5(6) bit index (s2.4 with hole -1..1) */
14 /* bubble */
15 gettr tr0,r20
16 ldx.ub r20, r21, r19 /* u0.8 */
17 shari r25, 32, r25 /* normalize to s2.30 */
18 shlli r21, 1, r21
19 muls.l r25, r19, r19 /* s2.38 */
20 ldx.w r20, r21, r21 /* s2.14 */
21 ptabs r18, tr0
22 shari r19, 24, r19 /* truncate to s2.14 */
23 sub r21, r19, r19 /* some 11 bit inverse in s1.14 */
24 muls.l r19, r19, r21 /* u0.28 */
25 sub r63, r1, r1
26 addi r1, 92, r1
27 muls.l r25, r21, r18 /* s2.58 */
28 shlli r19, 45, r19 /* multiply by two and convert to s2.58 */
29 /* bubble */
30 sub r19, r18, r18
31 shari r18, 28, r18 /* some 22 bit inverse in s1.30 */
32 muls.l r18, r25, r0 /* s2.60 */
33 muls.l r18, r4, r25 /* s32.30 */
34 /* bubble */
35 shari r0, 16, r19 /* s-16.44 */
36 muls.l r19, r18, r19 /* s-16.74 */
37 shari r25, 63, r0
38 shari r4, 14, r18 /* s19.-14 */
39 shari r19, 30, r19 /* s-16.44 */
40 muls.l r19, r18, r19 /* s15.30 */
41 xor r21, r0, r21 /* You could also use the constant 1 << 27. */
42 add r21, r25, r21
43 sub r21, r19, r21
44 shard r21, r1, r21
45 sub r21, r0, r0
46 blink tr0, r63
47
48/* This table has been generated by divtab.c .
49Defects for bias -330:
50 Max defect: 6.081536e-07 at -1.000000e+00
51 Min defect: 2.849516e-08 at 1.030651e+00
52 Max 2nd step defect: 9.606539e-12 at -1.000000e+00
53 Min 2nd step defect: 0.000000e+00 at 0.000000e+00
54 Defect at 1: 1.238659e-07
55 Defect at -2: 1.061708e-07 */
56
57 .balign 2
58 .type __div_table,@object
59 .size __div_table,128
60/* negative division constants */
61 .word -16638
62 .word -17135
63 .word -17737
64 .word -18433
65 .word -19103
66 .word -19751
67 .word -20583
68 .word -21383
69 .word -22343
70 .word -23353
71 .word -24407
72 .word -25582
73 .word -26863
74 .word -28382
75 .word -29965
76 .word -31800
77/* negative division factors */
78 .byte 66
79 .byte 70
80 .byte 75
81 .byte 81
82 .byte 87
83 .byte 93
84 .byte 101
85 .byte 109
86 .byte 119
87 .byte 130
88 .byte 142
89 .byte 156
90 .byte 172
91 .byte 192
92 .byte 214
93 .byte 241
94 .skip 16
95 .global __div_table
96__div_table:
97 .skip 16
98/* positive division factors */
99 .byte 241
100 .byte 214
101 .byte 192
102 .byte 172
103 .byte 156
104 .byte 142
105 .byte 130
106 .byte 119
107 .byte 109
108 .byte 101
109 .byte 93
110 .byte 87
111 .byte 81
112 .byte 75
113 .byte 70
114 .byte 66
115/* positive division constants */
116 .word 31801
117 .word 29966
118 .word 28383
119 .word 26864
120 .word 25583
121 .word 24408
122 .word 23354
123 .word 22344
124 .word 21384
125 .word 20584
126 .word 19752
127 .word 19104
128 .word 18434
129 .word 17738
130 .word 17136
131 .word 16639
diff --git a/arch/sh/lib64/strcpy.S b/arch/sh/lib64/strcpy.S
new file mode 100644
index 000000000000..ea7c9c533eea
--- /dev/null
+++ b/arch/sh/lib64/strcpy.S
@@ -0,0 +1,97 @@
1/* Cloned and hacked for uClibc by Paul Mundt, December 2003 */
2/* Modified by SuperH, Inc. September 2003 */
3! Entry: arg0: destination
4! arg1: source
5! Exit: result: destination
6!
7! SH5 code Copyright 2002 SuperH Ltd.
8
9#if __BYTE_ORDER == __LITTLE_ENDIAN
10#define SHHI shlld
11#define SHLO shlrd
12#else
13#define SHHI shlrd
14#define SHLO shlld
15#endif
16
17 .section .text..SHmedia32,"ax"
18 .globl strcpy
19 .type strcpy, @function
20 .align 5
21
22strcpy:
23
24 pta/l shortstring,tr1
25 ldlo.q r3,0,r4
26 ptabs r18,tr4
27 shlli r3,3,r7
28 addi r2, 8, r0
29 mcmpeq.b r4,r63,r6
30 SHHI r6,r7,r6
31 bnei/u r6,0,tr1 // shortstring
32 pta/l no_lddst, tr2
33 ori r3,-8,r23
34 sub r2, r23, r0
35 sub r3, r2, r21
36 addi r21, 8, r20
37 ldx.q r0, r21, r5
38 pta/l loop, tr0
39 ori r2,-8,r22
40 mcmpeq.b r5, r63, r6
41 bgt/u r22, r23, tr2 // no_lddst
42
43 // r22 < r23 : Need to do a load from the destination.
44 // r22 == r23 : Doesn't actually need to load from destination,
45 // but still can be handled here.
46 ldlo.q r2, 0, r9
47 movi -1, r8
48 SHLO r8, r7, r8
49 mcmv r4, r8, r9
50 stlo.q r2, 0, r9
51 beqi/l r6, 0, tr0 // loop
52
53 add r5, r63, r4
54 addi r0, 8, r0
55 blink tr1, r63 // shortstring
56no_lddst:
57 // r22 > r23: note that for r22 == r23 the sthi.q would clobber
58 // bytes before the destination region.
59 stlo.q r2, 0, r4
60 SHHI r4, r7, r4
61 sthi.q r0, -1, r4
62 beqi/l r6, 0, tr0 // loop
63
64 add r5, r63, r4
65 addi r0, 8, r0
66shortstring:
67#if __BYTE_ORDER != __LITTLE_ENDIAN
68 pta/l shortstring2,tr1
69 byterev r4,r4
70#endif
71shortstring2:
72 st.b r0,-8,r4
73 andi r4,0xff,r5
74 shlri r4,8,r4
75 addi r0,1,r0
76 bnei/l r5,0,tr1
77 blink tr4,r63 // return
78
79 .balign 8
80loop:
81 stlo.q r0, 0, r5
82 ldx.q r0, r20, r4
83 addi r0, 16, r0
84 sthi.q r0, -9, r5
85 mcmpeq.b r4, r63, r6
86 bnei/u r6, 0, tr1 // shortstring
87 ldx.q r0, r21, r5
88 stlo.q r0, -8, r4
89 sthi.q r0, -1, r4
90 mcmpeq.b r5, r63, r6
91 beqi/l r6, 0, tr0 // loop
92
93 add r5, r63, r4
94 addi r0, 8, r0
95 blink tr1, r63 // shortstring
96
97 .size strcpy,.-strcpy
diff --git a/arch/sh/lib64/strlen.S b/arch/sh/lib64/strlen.S
new file mode 100644
index 000000000000..cbc0d912e5f3
--- /dev/null
+++ b/arch/sh/lib64/strlen.S
@@ -0,0 +1,33 @@
1/*
2 * Simplistic strlen() implementation for SHmedia.
3 *
4 * Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org>
5 */
6
7 .section .text..SHmedia32,"ax"
8 .globl strlen
9 .type strlen,@function
10
11 .balign 16
12strlen:
13 ptabs r18, tr4
14
15 /*
16 * Note: We could easily deal with the NULL case here with a simple
17 * sanity check, though it seems that the behavior we want is to fault
18 * in the event that r2 == NULL, so we don't bother.
19 */
20/* beqi r2, 0, tr4 */ ! Sanity check
21
22 movi -1, r0
23 pta/l loop, tr0
24loop:
25 ld.b r2, 0, r1
26 addi r2, 1, r2
27 addi r0, 1, r0
28 bnei/l r1, 0, tr0
29
30 or r0, r63, r2
31 blink tr4, r63
32
33 .size strlen,.-strlen
diff --git a/arch/sh/lib64/udivdi3.S b/arch/sh/lib64/udivdi3.S
new file mode 100644
index 000000000000..6895c0225b85
--- /dev/null
+++ b/arch/sh/lib64/udivdi3.S
@@ -0,0 +1,120 @@
1 .section .text..SHmedia32,"ax"
2 .align 2
3 .global __udivdi3
4__udivdi3:
5 shlri r3,1,r4
6 nsb r4,r22
7 shlld r3,r22,r6
8 shlri r6,49,r5
9 movi 0xffffffffffffbaf1,r21 /* .l shift count 17. */
10 sub r21,r5,r1
11 mmulfx.w r1,r1,r4
12 mshflo.w r1,r63,r1
13 sub r63,r22,r20 // r63 == 64 % 64
14 mmulfx.w r5,r4,r4
15 pta large_divisor,tr0
16 addi r20,32,r9
17 msub.w r1,r4,r1
18 madd.w r1,r1,r1
19 mmulfx.w r1,r1,r4
20 shlri r6,32,r7
21 bgt/u r9,r63,tr0 // large_divisor
22 mmulfx.w r5,r4,r4
23 shlri r2,32+14,r19
24 addi r22,-31,r0
25 msub.w r1,r4,r1
26
27 mulu.l r1,r7,r4
28 addi r1,-3,r5
29 mulu.l r5,r19,r5
30 sub r63,r4,r4 // Negate to make sure r1 ends up <= 1/r2
31 shlri r4,2,r4 /* chop off leading %0000000000000000 001.00000000000 - or, as
32 the case may be, %0000000000000000 000.11111111111, still */
33 muls.l r1,r4,r4 /* leaving at least one sign bit. */
34 mulu.l r5,r3,r8
35 mshalds.l r1,r21,r1
36 shari r4,26,r4
37 shlld r8,r0,r8
38 add r1,r4,r1 // 31 bit unsigned reciprocal now in r1 (msb equiv. 0.5)
39 sub r2,r8,r2
40 /* Can do second step of 64 : 32 div now, using r1 and the rest in r2. */
41
42 shlri r2,22,r21
43 mulu.l r21,r1,r21
44 shlld r5,r0,r8
45 addi r20,30-22,r0
46 shlrd r21,r0,r21
47 mulu.l r21,r3,r5
48 add r8,r21,r8
49 mcmpgt.l r21,r63,r21 // See Note 1
50 addi r20,30,r0
51 mshfhi.l r63,r21,r21
52 sub r2,r5,r2
53 andc r2,r21,r2
54
55 /* small divisor: need a third divide step */
56 mulu.l r2,r1,r7
57 ptabs r18,tr0
58 addi r2,1,r2
59 shlrd r7,r0,r7
60 mulu.l r7,r3,r5
61 add r8,r7,r8
62 sub r2,r3,r2
63 cmpgt r2,r5,r5
64 add r8,r5,r2
65 /* could test r3 here to check for divide by zero. */
66 blink tr0,r63
67
68large_divisor:
69 mmulfx.w r5,r4,r4
70 shlrd r2,r9,r25
71 shlri r25,32,r8
72 msub.w r1,r4,r1
73
74 mulu.l r1,r7,r4
75 addi r1,-3,r5
76 mulu.l r5,r8,r5
77 sub r63,r4,r4 // Negate to make sure r1 ends up <= 1/r2
78 shlri r4,2,r4 /* chop off leading %0000000000000000 001.00000000000 - or, as
79 the case may be, %0000000000000000 000.11111111111, still */
80 muls.l r1,r4,r4 /* leaving at least one sign bit. */
81 shlri r5,14-1,r8
82 mulu.l r8,r7,r5
83 mshalds.l r1,r21,r1
84 shari r4,26,r4
85 add r1,r4,r1 // 31 bit unsigned reciprocal now in r1 (msb equiv. 0.5)
86 sub r25,r5,r25
87 /* Can do second step of 64 : 32 div now, using r1 and the rest in r25. */
88
89 shlri r25,22,r21
90 mulu.l r21,r1,r21
91 pta no_lo_adj,tr0
92 addi r22,32,r0
93 shlri r21,40,r21
94 mulu.l r21,r7,r5
95 add r8,r21,r8
96 shlld r2,r0,r2
97 sub r25,r5,r25
98 bgtu/u r7,r25,tr0 // no_lo_adj
99 addi r8,1,r8
100 sub r25,r7,r25
101no_lo_adj:
102 mextr4 r2,r25,r2
103
104 /* large_divisor: only needs a few adjustments. */
105 mulu.l r8,r6,r5
106 ptabs r18,tr0
107 /* bubble */
108 cmpgtu r5,r2,r5
109 sub r8,r5,r2
110 blink tr0,r63
111
112/* Note 1: To shift the result of the second divide stage so that the result
113 always fits into 32 bits, yet we still reduce the rest sufficiently
114 would require a lot of instructions to do the shifts just right. Using
115 the full 64 bit shift result to multiply with the divisor would require
116 four extra instructions for the upper 32 bits (shift / mulu / shift / sub).
117 Fortunately, if the upper 32 bits of the shift result are nonzero, we
118 know that the rest after taking this partial result into account will
119 fit into 32 bits. So we just clear the upper 32 bits of the rest if the
120 upper 32 bits of the partial result are nonzero. */
diff --git a/arch/sh/lib64/udivsi3.S b/arch/sh/lib64/udivsi3.S
new file mode 100644
index 000000000000..e68120e4b847
--- /dev/null
+++ b/arch/sh/lib64/udivsi3.S
@@ -0,0 +1,59 @@
1 .global __udivsi3
2 .section .text..SHmedia32,"ax"
3 .align 2
4
5/*
6 inputs: r4,r5
7 clobbered: r18,r19,r20,r21,r22,r25,tr0
8 result in r0.
9 */
10__udivsi3:
11 addz.l r5,r63,r22
12 nsb r22,r0
13 shlld r22,r0,r25
14 shlri r25,48,r25
15 movi 0xffffffffffffbb0c,r20 /* shift count eqiv 76 */
16 sub r20,r25,r21
17 mmulfx.w r21,r21,r19
18 mshflo.w r21,r63,r21
19 ptabs r18,tr0
20 mmulfx.w r25,r19,r19
21 sub r20,r0,r0
22 /* bubble */
23 msub.w r21,r19,r19
24
25 /*
26 * It would be nice for scheduling to do this add to r21 before
27 * the msub.w, but we need a different value for r19 to keep
28 * errors under control.
29 */
30 addi r19,-2,r21
31 mulu.l r4,r21,r18
32 mmulfx.w r19,r19,r19
33 shlli r21,15,r21
34 shlrd r18,r0,r18
35 mulu.l r18,r22,r20
36 mmacnfx.wl r25,r19,r21
37 /* bubble */
38 sub r4,r20,r25
39
40 mulu.l r25,r21,r19
41 addi r0,14,r0
42 /* bubble */
43 shlrd r19,r0,r19
44 mulu.l r19,r22,r20
45 add r18,r19,r18
46 /* bubble */
47 sub.l r25,r20,r25
48
49 mulu.l r25,r21,r19
50 addz.l r25,r63,r25
51 sub r25,r22,r25
52 shlrd r19,r0,r19
53 mulu.l r19,r22,r20
54 addi r25,1,r25
55 add r18,r19,r18
56
57 cmpgt r25,r20,r25
58 add.l r18,r25,r0
59 blink tr0,r63
diff --git a/arch/sh/mm/Makefile_32 b/arch/sh/mm/Makefile_32
index f066e76da204..cb2f3f299591 100644
--- a/arch/sh/mm/Makefile_32
+++ b/arch/sh/mm/Makefile_32
@@ -18,6 +18,7 @@ mmu-y := tlb-nommu.o pg-nommu.o
18mmu-$(CONFIG_MMU) := fault_32.o tlbflush_32.o ioremap_32.o 18mmu-$(CONFIG_MMU) := fault_32.o tlbflush_32.o ioremap_32.o
19 19
20obj-y += $(mmu-y) 20obj-y += $(mmu-y)
21obj-$(CONFIG_DEBUG_FS) += asids-debugfs.o
21 22
22ifdef CONFIG_DEBUG_FS 23ifdef CONFIG_DEBUG_FS
23obj-$(CONFIG_CPU_SH4) += cache-debugfs.o 24obj-$(CONFIG_CPU_SH4) += cache-debugfs.o
diff --git a/arch/sh/mm/Makefile_64 b/arch/sh/mm/Makefile_64
index 9481d0f54efd..2863ffb7006d 100644
--- a/arch/sh/mm/Makefile_64
+++ b/arch/sh/mm/Makefile_64
@@ -13,6 +13,7 @@ obj-y += cache-sh5.o
13endif 13endif
14 14
15obj-y += $(mmu-y) 15obj-y += $(mmu-y)
16obj-$(CONFIG_DEBUG_FS) += asids-debugfs.o
16 17
17obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o 18obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
18obj-$(CONFIG_NUMA) += numa.o 19obj-$(CONFIG_NUMA) += numa.o
diff --git a/arch/sh/mm/asids-debugfs.c b/arch/sh/mm/asids-debugfs.c
new file mode 100644
index 000000000000..8e912a15e94f
--- /dev/null
+++ b/arch/sh/mm/asids-debugfs.c
@@ -0,0 +1,79 @@
1/*
2 * debugfs ops for process ASIDs
3 *
4 * Copyright (C) 2000, 2001 Paolo Alberelli
5 * Copyright (C) 2003 - 2008 Paul Mundt
6 * Copyright (C) 2003, 2004 Richard Curnow
7 *
8 * Provides a debugfs file that lists out the ASIDs currently associated
9 * with the processes.
10 *
11 * In the SH-5 case, if the DM.PC register is examined through the debug
12 * link, this shows ASID + PC. To make use of this, the PID->ASID
13 * relationship needs to be known. This is primarily for debugging.
14 *
15 * This file is subject to the terms and conditions of the GNU General Public
16 * License. See the file "COPYING" in the main directory of this archive
17 * for more details.
18 */
19#include <linux/init.h>
20#include <linux/module.h>
21#include <linux/debugfs.h>
22#include <linux/seq_file.h>
23#include <linux/spinlock.h>
24#include <asm/processor.h>
25#include <asm/mmu_context.h>
26
27static int asids_seq_show(struct seq_file *file, void *iter)
28{
29 struct task_struct *p;
30
31 read_lock(&tasklist_lock);
32
33 for_each_process(p) {
34 int pid = p->pid;
35
36 if (unlikely(!pid))
37 continue;
38
39 if (p->mm)
40 seq_printf(file, "%5d : %02lx\n", pid,
41 cpu_asid(smp_processor_id(), p->mm));
42 else
43 seq_printf(file, "%5d : (none)\n", pid);
44 }
45
46 read_unlock(&tasklist_lock);
47
48 return 0;
49}
50
51static int asids_debugfs_open(struct inode *inode, struct file *file)
52{
53 return single_open(file, asids_seq_show, inode->i_private);
54}
55
56static const struct file_operations asids_debugfs_fops = {
57 .owner = THIS_MODULE,
58 .open = asids_debugfs_open,
59 .read = seq_read,
60 .llseek = seq_lseek,
61 .release = single_release,
62};
63
64static int __init asids_debugfs_init(void)
65{
66 struct dentry *asids_dentry;
67
68 asids_dentry = debugfs_create_file("asids", S_IRUSR, sh_debugfs_root,
69 NULL, &asids_debugfs_fops);
70 if (!asids_dentry)
71 return -ENOMEM;
72 if (IS_ERR(asids_dentry))
73 return PTR_ERR(asids_dentry);
74
75 return 0;
76}
77module_init(asids_debugfs_init);
78
79MODULE_LICENSE("GPL v2");
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 9f8ea3ada4db..edcd5fbf9651 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -42,6 +42,8 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
42 return NULL; 42 return NULL;
43 } 43 }
44 44
45 split_page(pfn_to_page(virt_to_phys(ret) >> PAGE_SHIFT), order);
46
45 *dma_handle = virt_to_phys(ret); 47 *dma_handle = virt_to_phys(ret);
46 return ret_nocache; 48 return ret_nocache;
47} 49}
@@ -51,10 +53,13 @@ void dma_free_coherent(struct device *dev, size_t size,
51 void *vaddr, dma_addr_t dma_handle) 53 void *vaddr, dma_addr_t dma_handle)
52{ 54{
53 int order = get_order(size); 55 int order = get_order(size);
56 unsigned long pfn = dma_handle >> PAGE_SHIFT;
57 int k;
54 58
55 if (!dma_release_from_coherent(dev, order, vaddr)) { 59 if (!dma_release_from_coherent(dev, order, vaddr)) {
56 WARN_ON(irqs_disabled()); /* for portability */ 60 WARN_ON(irqs_disabled()); /* for portability */
57 free_pages((unsigned long)phys_to_virt(dma_handle), order); 61 for (k = 0; k < (1 << order); k++)
62 __free_pages(pfn_to_page(pfn + k), 0);
58 iounmap(vaddr); 63 iounmap(vaddr);
59 } 64 }
60} 65}
diff --git a/arch/sh/mm/fault_32.c b/arch/sh/mm/fault_32.c
index 898d477e47c1..31a33ebdef6f 100644
--- a/arch/sh/mm/fault_32.c
+++ b/arch/sh/mm/fault_32.c
@@ -20,7 +20,6 @@
20#include <asm/system.h> 20#include <asm/system.h>
21#include <asm/mmu_context.h> 21#include <asm/mmu_context.h>
22#include <asm/tlbflush.h> 22#include <asm/tlbflush.h>
23#include <asm/kgdb.h>
24 23
25/* 24/*
26 * This routine handles page faults. It determines the address, 25 * This routine handles page faults. It determines the address,
@@ -265,17 +264,6 @@ static inline int notify_page_fault(struct pt_regs *regs, int trap)
265 return ret; 264 return ret;
266} 265}
267 266
268#ifdef CONFIG_SH_STORE_QUEUES
269/*
270 * This is a special case for the SH-4 store queues, as pages for this
271 * space still need to be faulted in before it's possible to flush the
272 * store queue cache for writeout to the remapped region.
273 */
274#define P3_ADDR_MAX (P4SEG_STORE_QUE + 0x04000000)
275#else
276#define P3_ADDR_MAX P4SEG
277#endif
278
279/* 267/*
280 * Called with interrupts disabled. 268 * Called with interrupts disabled.
281 */ 269 */
@@ -293,11 +281,6 @@ asmlinkage int __kprobes __do_page_fault(struct pt_regs *regs,
293 if (notify_page_fault(regs, lookup_exception_vector())) 281 if (notify_page_fault(regs, lookup_exception_vector()))
294 goto out; 282 goto out;
295 283
296#ifdef CONFIG_SH_KGDB
297 if (kgdb_nofault && kgdb_bus_err_hook)
298 kgdb_bus_err_hook();
299#endif
300
301 ret = 1; 284 ret = 1;
302 285
303 /* 286 /*
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index 6cbef8caeb56..3edf297c829b 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -311,7 +311,8 @@ int arch_add_memory(int nid, u64 start, u64 size)
311 pgdat = NODE_DATA(nid); 311 pgdat = NODE_DATA(nid);
312 312
313 /* We only have ZONE_NORMAL, so this is easy.. */ 313 /* We only have ZONE_NORMAL, so this is easy.. */
314 ret = __add_pages(pgdat->node_zones + ZONE_NORMAL, start_pfn, nr_pages); 314 ret = __add_pages(nid, pgdat->node_zones + ZONE_NORMAL,
315 start_pfn, nr_pages);
315 if (unlikely(ret)) 316 if (unlikely(ret))
316 printk("%s: Failed, __add_pages() == %d\n", __func__, ret); 317 printk("%s: Failed, __add_pages() == %d\n", __func__, ret);
317 318
diff --git a/arch/sh/mm/ioremap_32.c b/arch/sh/mm/ioremap_32.c
index 882a32ebc6b7..32946fba123e 100644
--- a/arch/sh/mm/ioremap_32.c
+++ b/arch/sh/mm/ioremap_32.c
@@ -116,9 +116,10 @@ EXPORT_SYMBOL(__ioremap);
116void __iounmap(void __iomem *addr) 116void __iounmap(void __iomem *addr)
117{ 117{
118 unsigned long vaddr = (unsigned long __force)addr; 118 unsigned long vaddr = (unsigned long __force)addr;
119 unsigned long seg = PXSEG(vaddr);
119 struct vm_struct *p; 120 struct vm_struct *p;
120 121
121 if (PXSEG(vaddr) < P3SEG || is_pci_memaddr(vaddr)) 122 if (seg < P3SEG || seg >= P3_ADDR_MAX || is_pci_memaddr(vaddr))
122 return; 123 return;
123 124
124#ifdef CONFIG_32BIT 125#ifdef CONFIG_32BIT
diff --git a/arch/sh/mm/mmap.c b/arch/sh/mm/mmap.c
index 8837d511710a..931f4d003fa0 100644
--- a/arch/sh/mm/mmap.c
+++ b/arch/sh/mm/mmap.c
@@ -9,7 +9,101 @@
9 */ 9 */
10#include <linux/io.h> 10#include <linux/io.h>
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/mman.h>
13#include <linux/module.h>
12#include <asm/page.h> 14#include <asm/page.h>
15#include <asm/processor.h>
16
17#ifdef CONFIG_MMU
18unsigned long shm_align_mask = PAGE_SIZE - 1; /* Sane caches */
19EXPORT_SYMBOL(shm_align_mask);
20
21/*
22 * To avoid cache aliases, we map the shared page with same color.
23 */
24#define COLOUR_ALIGN(addr, pgoff) \
25 ((((addr) + shm_align_mask) & ~shm_align_mask) + \
26 (((pgoff) << PAGE_SHIFT) & shm_align_mask))
27
28unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
29 unsigned long len, unsigned long pgoff, unsigned long flags)
30{
31 struct mm_struct *mm = current->mm;
32 struct vm_area_struct *vma;
33 unsigned long start_addr;
34 int do_colour_align;
35
36 if (flags & MAP_FIXED) {
37 /* We do not accept a shared mapping if it would violate
38 * cache aliasing constraints.
39 */
40 if ((flags & MAP_SHARED) && (addr & shm_align_mask))
41 return -EINVAL;
42 return addr;
43 }
44
45 if (unlikely(len > TASK_SIZE))
46 return -ENOMEM;
47
48 do_colour_align = 0;
49 if (filp || (flags & MAP_SHARED))
50 do_colour_align = 1;
51
52 if (addr) {
53 if (do_colour_align)
54 addr = COLOUR_ALIGN(addr, pgoff);
55 else
56 addr = PAGE_ALIGN(addr);
57
58 vma = find_vma(mm, addr);
59 if (TASK_SIZE - len >= addr &&
60 (!vma || addr + len <= vma->vm_start))
61 return addr;
62 }
63
64 if (len > mm->cached_hole_size) {
65 start_addr = addr = mm->free_area_cache;
66 } else {
67 mm->cached_hole_size = 0;
68 start_addr = addr = TASK_UNMAPPED_BASE;
69 }
70
71full_search:
72 if (do_colour_align)
73 addr = COLOUR_ALIGN(addr, pgoff);
74 else
75 addr = PAGE_ALIGN(mm->free_area_cache);
76
77 for (vma = find_vma(mm, addr); ; vma = vma->vm_next) {
78 /* At this point: (!vma || addr < vma->vm_end). */
79 if (unlikely(TASK_SIZE - len < addr)) {
80 /*
81 * Start a new search - just in case we missed
82 * some holes.
83 */
84 if (start_addr != TASK_UNMAPPED_BASE) {
85 start_addr = addr = TASK_UNMAPPED_BASE;
86 mm->cached_hole_size = 0;
87 goto full_search;
88 }
89 return -ENOMEM;
90 }
91 if (likely(!vma || addr + len <= vma->vm_start)) {
92 /*
93 * Remember the place where we stopped the search:
94 */
95 mm->free_area_cache = addr + len;
96 return addr;
97 }
98 if (addr + mm->cached_hole_size < vma->vm_start)
99 mm->cached_hole_size = vma->vm_start - addr;
100
101 addr = vma->vm_end;
102 if (do_colour_align)
103 addr = COLOUR_ALIGN(addr, pgoff);
104 }
105}
106#endif /* CONFIG_MMU */
13 107
14/* 108/*
15 * You really shouldn't be using read() or write() on /dev/mem. This 109 * You really shouldn't be using read() or write() on /dev/mem. This
diff --git a/arch/sh/oprofile/Makefile b/arch/sh/oprofile/Makefile
index 2efc2e79fd29..8e6eec91c14c 100644
--- a/arch/sh/oprofile/Makefile
+++ b/arch/sh/oprofile/Makefile
@@ -6,13 +6,8 @@ DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \
6 oprofilefs.o oprofile_stats.o \ 6 oprofilefs.o oprofile_stats.o \
7 timer_int.o ) 7 timer_int.o )
8 8
9profdrvr-y := op_model_null.o 9oprofile-y := $(DRIVER_OBJS) common.o backtrace.o
10 10
11# SH7750-style performance counters exist across 7750/7750S and 7091. 11oprofile-$(CONFIG_CPU_SUBTYPE_SH7750S) += op_model_sh7750.o
12profdrvr-$(CONFIG_CPU_SUBTYPE_SH7750S) := op_model_sh7750.o 12oprofile-$(CONFIG_CPU_SUBTYPE_SH7750) += op_model_sh7750.o
13profdrvr-$(CONFIG_CPU_SUBTYPE_SH7750) := op_model_sh7750.o 13oprofile-$(CONFIG_CPU_SUBTYPE_SH7091) += op_model_sh7750.o
14profdrvr-$(CONFIG_CPU_SUBTYPE_SH7091) := op_model_sh7750.o
15
16oprofile-y := $(DRIVER_OBJS) $(profdrvr-y)
17
18EXTRA_CFLAGS += -Werror
diff --git a/arch/sh/oprofile/backtrace.c b/arch/sh/oprofile/backtrace.c
new file mode 100644
index 000000000000..9499a2914f89
--- /dev/null
+++ b/arch/sh/oprofile/backtrace.c
@@ -0,0 +1,114 @@
1/*
2 * SH specific backtracing code for oprofile
3 *
4 * Copyright 2007 STMicroelectronics Ltd.
5 *
6 * Author: Dave Peverley <dpeverley@mpc-data.co.uk>
7 *
8 * Based on ARM oprofile backtrace code by Richard Purdie and in turn, i386
9 * oprofile backtrace code by John Levon, David Smith
10 *
11 * 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 * published by the Free Software Foundation.
14 *
15 */
16#include <linux/oprofile.h>
17#include <linux/sched.h>
18#include <linux/kallsyms.h>
19#include <linux/mm.h>
20#include <asm/ptrace.h>
21#include <asm/uaccess.h>
22#include <asm/sections.h>
23
24/* Limit to stop backtracing too far. */
25static int backtrace_limit = 20;
26
27static unsigned long *
28user_backtrace(unsigned long *stackaddr, struct pt_regs *regs)
29{
30 unsigned long buf_stack;
31
32 /* Also check accessibility of address */
33 if (!access_ok(VERIFY_READ, stackaddr, sizeof(unsigned long)))
34 return NULL;
35
36 if (__copy_from_user_inatomic(&buf_stack, stackaddr, sizeof(unsigned long)))
37 return NULL;
38
39 /* Quick paranoia check */
40 if (buf_stack & 3)
41 return NULL;
42
43 oprofile_add_trace(buf_stack);
44
45 stackaddr++;
46
47 return stackaddr;
48}
49
50/*
51 * | | /\ Higher addresses
52 * | |
53 * --------------- stack base (address of current_thread_info)
54 * | thread info |
55 * . .
56 * | stack |
57 * --------------- saved regs->regs[15] value if valid
58 * . .
59 * --------------- struct pt_regs stored on stack (struct pt_regs *)
60 * | |
61 * . .
62 * | |
63 * --------------- ???
64 * | |
65 * | | \/ Lower addresses
66 *
67 * Thus, &pt_regs <-> stack base restricts the valid(ish) fp values
68 */
69static int valid_kernel_stack(unsigned long *stackaddr, struct pt_regs *regs)
70{
71 unsigned long stack = (unsigned long)regs;
72 unsigned long stack_base = (stack & ~(THREAD_SIZE - 1)) + THREAD_SIZE;
73
74 return ((unsigned long)stackaddr > stack) && ((unsigned long)stackaddr < stack_base);
75}
76
77static unsigned long *
78kernel_backtrace(unsigned long *stackaddr, struct pt_regs *regs)
79{
80 unsigned long addr;
81
82 /*
83 * If not a valid kernel address, keep going till we find one
84 * or the SP stops being a valid address.
85 */
86 do {
87 addr = *stackaddr++;
88 oprofile_add_trace(addr);
89 } while (valid_kernel_stack(stackaddr, regs));
90
91 return stackaddr;
92}
93
94void sh_backtrace(struct pt_regs * const regs, unsigned int depth)
95{
96 unsigned long *stackaddr;
97
98 /*
99 * Paranoia - clip max depth as we could get lost in the weeds.
100 */
101 if (depth > backtrace_limit)
102 depth = backtrace_limit;
103
104 stackaddr = (unsigned long *)regs->regs[15];
105 if (!user_mode(regs)) {
106 while (depth-- && valid_kernel_stack(stackaddr, regs))
107 stackaddr = kernel_backtrace(stackaddr, regs);
108
109 return;
110 }
111
112 while (depth-- && (stackaddr != NULL))
113 stackaddr = user_backtrace(stackaddr, regs);
114}
diff --git a/arch/sh/oprofile/common.c b/arch/sh/oprofile/common.c
new file mode 100644
index 000000000000..1d97d64cb95f
--- /dev/null
+++ b/arch/sh/oprofile/common.c
@@ -0,0 +1,150 @@
1/*
2 * arch/sh/oprofile/init.c
3 *
4 * Copyright (C) 2003 - 2008 Paul Mundt
5 *
6 * Based on arch/mips/oprofile/common.c:
7 *
8 * Copyright (C) 2004, 2005 Ralf Baechle
9 * Copyright (C) 2005 MIPS Technologies, Inc.
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 */
15#include <linux/kernel.h>
16#include <linux/oprofile.h>
17#include <linux/init.h>
18#include <linux/errno.h>
19#include <linux/smp.h>
20#include <asm/processor.h>
21#include "op_impl.h"
22
23extern struct op_sh_model op_model_sh7750_ops __weak;
24extern struct op_sh_model op_model_sh4a_ops __weak;
25
26static struct op_sh_model *model;
27
28static struct op_counter_config ctr[20];
29
30extern void sh_backtrace(struct pt_regs * const regs, unsigned int depth);
31
32static int op_sh_setup(void)
33{
34 /* Pre-compute the values to stuff in the hardware registers. */
35 model->reg_setup(ctr);
36
37 /* Configure the registers on all cpus. */
38 on_each_cpu(model->cpu_setup, NULL, 1);
39
40 return 0;
41}
42
43static int op_sh_create_files(struct super_block *sb, struct dentry *root)
44{
45 int i, ret = 0;
46
47 for (i = 0; i < model->num_counters; i++) {
48 struct dentry *dir;
49 char buf[4];
50
51 snprintf(buf, sizeof(buf), "%d", i);
52 dir = oprofilefs_mkdir(sb, root, buf);
53
54 ret |= oprofilefs_create_ulong(sb, dir, "enabled", &ctr[i].enabled);
55 ret |= oprofilefs_create_ulong(sb, dir, "event", &ctr[i].event);
56 ret |= oprofilefs_create_ulong(sb, dir, "kernel", &ctr[i].kernel);
57 ret |= oprofilefs_create_ulong(sb, dir, "user", &ctr[i].user);
58
59 if (model->create_files)
60 ret |= model->create_files(sb, dir);
61 else
62 ret |= oprofilefs_create_ulong(sb, dir, "count", &ctr[i].count);
63
64 /* Dummy entries */
65 ret |= oprofilefs_create_ulong(sb, dir, "unit_mask", &ctr[i].unit_mask);
66 }
67
68 return ret;
69}
70
71static int op_sh_start(void)
72{
73 /* Enable performance monitoring for all counters. */
74 on_each_cpu(model->cpu_start, NULL, 1);
75
76 return 0;
77}
78
79static void op_sh_stop(void)
80{
81 /* Disable performance monitoring for all counters. */
82 on_each_cpu(model->cpu_stop, NULL, 1);
83}
84
85int __init oprofile_arch_init(struct oprofile_operations *ops)
86{
87 struct op_sh_model *lmodel = NULL;
88 int ret;
89
90 /*
91 * Always assign the backtrace op. If the counter initialization
92 * fails, we fall back to the timer which will still make use of
93 * this.
94 */
95 ops->backtrace = sh_backtrace;
96
97 switch (current_cpu_data.type) {
98 /* SH-4 types */
99 case CPU_SH7750:
100 case CPU_SH7750S:
101 lmodel = &op_model_sh7750_ops;
102 break;
103
104 /* SH-4A types */
105 case CPU_SH7763:
106 case CPU_SH7770:
107 case CPU_SH7780:
108 case CPU_SH7781:
109 case CPU_SH7785:
110 case CPU_SH7723:
111 case CPU_SHX3:
112 lmodel = &op_model_sh4a_ops;
113 break;
114
115 /* SH4AL-DSP types */
116 case CPU_SH7343:
117 case CPU_SH7722:
118 case CPU_SH7366:
119 lmodel = &op_model_sh4a_ops;
120 break;
121 }
122
123 if (!lmodel)
124 return -ENODEV;
125 if (!(current_cpu_data.flags & CPU_HAS_PERF_COUNTER))
126 return -ENODEV;
127
128 ret = lmodel->init();
129 if (unlikely(ret != 0))
130 return ret;
131
132 model = lmodel;
133
134 ops->setup = op_sh_setup;
135 ops->create_files = op_sh_create_files;
136 ops->start = op_sh_start;
137 ops->stop = op_sh_stop;
138 ops->cpu_type = lmodel->cpu_type;
139
140 printk(KERN_INFO "oprofile: using %s performance monitoring.\n",
141 lmodel->cpu_type);
142
143 return 0;
144}
145
146void oprofile_arch_exit(void)
147{
148 if (model && model->exit)
149 model->exit();
150}
diff --git a/arch/sh/oprofile/op_impl.h b/arch/sh/oprofile/op_impl.h
new file mode 100644
index 000000000000..4d509975eba6
--- /dev/null
+++ b/arch/sh/oprofile/op_impl.h
@@ -0,0 +1,33 @@
1#ifndef __OP_IMPL_H
2#define __OP_IMPL_H
3
4/* Per-counter configuration as set via oprofilefs. */
5struct op_counter_config {
6 unsigned long enabled;
7 unsigned long event;
8
9 unsigned long long count;
10
11 /* Dummy values for userspace tool compliance */
12 unsigned long kernel;
13 unsigned long user;
14 unsigned long unit_mask;
15};
16
17/* Per-architecture configury and hooks. */
18struct op_sh_model {
19 void (*reg_setup)(struct op_counter_config *);
20 int (*create_files)(struct super_block *sb, struct dentry *dir);
21 void (*cpu_setup)(void *dummy);
22 int (*init)(void);
23 void (*exit)(void);
24 void (*cpu_start)(void *args);
25 void (*cpu_stop)(void *args);
26 char *cpu_type;
27 unsigned char num_counters;
28};
29
30/* arch/sh/oprofile/common.c */
31extern void sh_backtrace(struct pt_regs * const regs, unsigned int depth);
32
33#endif /* __OP_IMPL_H */
diff --git a/arch/sh/oprofile/op_model_null.c b/arch/sh/oprofile/op_model_null.c
deleted file mode 100644
index a845b088edb4..000000000000
--- a/arch/sh/oprofile/op_model_null.c
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * arch/sh/oprofile/op_model_null.c
3 *
4 * Copyright (C) 2003 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/kernel.h>
11#include <linux/oprofile.h>
12#include <linux/init.h>
13#include <linux/errno.h>
14
15int __init oprofile_arch_init(struct oprofile_operations *ops)
16{
17 return -ENODEV;
18}
19
20void oprofile_arch_exit(void)
21{
22}
23
diff --git a/arch/sh/oprofile/op_model_sh7750.c b/arch/sh/oprofile/op_model_sh7750.c
index 008b3b03750a..c892c7c30c2f 100644
--- a/arch/sh/oprofile/op_model_sh7750.c
+++ b/arch/sh/oprofile/op_model_sh7750.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * OProfile support for SH7750/SH7750S Performance Counters 4 * OProfile support for SH7750/SH7750S Performance Counters
5 * 5 *
6 * Copyright (C) 2003, 2004 Paul Mundt 6 * Copyright (C) 2003 - 2008 Paul Mundt
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
@@ -15,19 +15,16 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/io.h>
18#include <linux/fs.h> 19#include <linux/fs.h>
19#include <asm/uaccess.h> 20#include "op_impl.h"
20#include <asm/io.h>
21 21
22#define PM_CR_BASE 0xff000084 /* 16-bit */ 22#define PM_CR_BASE 0xff000084 /* 16-bit */
23#define PM_CTR_BASE 0xff100004 /* 32-bit */ 23#define PM_CTR_BASE 0xff100004 /* 32-bit */
24 24
25#define PMCR1 (PM_CR_BASE + 0x00) 25#define PMCR(n) (PM_CR_BASE + ((n) * 0x04))
26#define PMCR2 (PM_CR_BASE + 0x04) 26#define PMCTRH(n) (PM_CTR_BASE + 0x00 + ((n) * 0x08))
27#define PMCTR1H (PM_CTR_BASE + 0x00) 27#define PMCTRL(n) (PM_CTR_BASE + 0x04 + ((n) * 0x08))
28#define PMCTR1L (PM_CTR_BASE + 0x04)
29#define PMCTR2H (PM_CTR_BASE + 0x08)
30#define PMCTR2L (PM_CTR_BASE + 0x0c)
31 28
32#define PMCR_PMM_MASK 0x0000003f 29#define PMCR_PMM_MASK 0x0000003f
33 30
@@ -36,25 +33,15 @@
36#define PMCR_PMST 0x00004000 33#define PMCR_PMST 0x00004000
37#define PMCR_PMEN 0x00008000 34#define PMCR_PMEN 0x00008000
38 35
39#define PMCR_ENABLE (PMCR_PMST | PMCR_PMEN) 36struct op_sh_model op_model_sh7750_ops;
40 37
41/*
42 * SH7750/SH7750S have 2 perf counters
43 */
44#define NR_CNTRS 2 38#define NR_CNTRS 2
45 39
46struct op_counter_config { 40static struct sh7750_ppc_register_config {
47 unsigned long enabled; 41 unsigned int ctrl;
48 unsigned long event; 42 unsigned long cnt_hi;
49 unsigned long count; 43 unsigned long cnt_lo;
50 44} regcache[NR_CNTRS];
51 /* Dummy values for userspace tool compliance */
52 unsigned long kernel;
53 unsigned long user;
54 unsigned long unit_mask;
55};
56
57static struct op_counter_config ctr[NR_CNTRS];
58 45
59/* 46/*
60 * There are a number of events supported by each counter (33 in total). 47 * There are a number of events supported by each counter (33 in total).
@@ -116,12 +103,8 @@ static int sh7750_timer_notify(struct pt_regs *regs)
116 103
117static u64 sh7750_read_counter(int counter) 104static u64 sh7750_read_counter(int counter)
118{ 105{
119 u32 hi, lo; 106 return (u64)((u64)(__raw_readl(PMCTRH(counter)) & 0xffff) << 32) |
120 107 __raw_readl(PMCTRL(counter));
121 hi = (counter == 0) ? ctrl_inl(PMCTR1H) : ctrl_inl(PMCTR2H);
122 lo = (counter == 0) ? ctrl_inl(PMCTR1L) : ctrl_inl(PMCTR2L);
123
124 return (u64)((u64)(hi & 0xffff) << 32) | lo;
125} 108}
126 109
127/* 110/*
@@ -170,11 +153,7 @@ static ssize_t sh7750_write_count(struct file *file, const char __user *buf,
170 */ 153 */
171 WARN_ON(val != 0); 154 WARN_ON(val != 0);
172 155
173 if (counter == 0) { 156 __raw_writew(__raw_readw(PMCR(counter)) | PMCR_PMCLR, PMCR(counter));
174 ctrl_outw(ctrl_inw(PMCR1) | PMCR_PMCLR, PMCR1);
175 } else {
176 ctrl_outw(ctrl_inw(PMCR2) | PMCR_PMCLR, PMCR2);
177 }
178 157
179 return count; 158 return count;
180} 159}
@@ -184,88 +163,93 @@ static const struct file_operations count_fops = {
184 .write = sh7750_write_count, 163 .write = sh7750_write_count,
185}; 164};
186 165
187static int sh7750_perf_counter_create_files(struct super_block *sb, struct dentry *root) 166static int sh7750_ppc_create_files(struct super_block *sb, struct dentry *dir)
188{ 167{
189 int i; 168 return oprofilefs_create_file(sb, dir, "count", &count_fops);
169}
190 170
191 for (i = 0; i < NR_CNTRS; i++) { 171static void sh7750_ppc_reg_setup(struct op_counter_config *ctr)
192 struct dentry *dir; 172{
193 char buf[4]; 173 unsigned int counters = op_model_sh7750_ops.num_counters;
174 int i;
194 175
195 snprintf(buf, sizeof(buf), "%d", i); 176 for (i = 0; i < counters; i++) {
196 dir = oprofilefs_mkdir(sb, root, buf); 177 regcache[i].ctrl = 0;
178 regcache[i].cnt_hi = 0;
179 regcache[i].cnt_lo = 0;
197 180
198 oprofilefs_create_ulong(sb, dir, "enabled", &ctr[i].enabled); 181 if (!ctr[i].enabled)
199 oprofilefs_create_ulong(sb, dir, "event", &ctr[i].event); 182 continue;
200 oprofilefs_create_file(sb, dir, "count", &count_fops);
201 183
202 /* Dummy entries */ 184 regcache[i].ctrl |= ctr[i].event | PMCR_PMEN | PMCR_PMST;
203 oprofilefs_create_ulong(sb, dir, "kernel", &ctr[i].kernel); 185 regcache[i].cnt_hi = (unsigned long)((ctr->count >> 32) & 0xffff);
204 oprofilefs_create_ulong(sb, dir, "user", &ctr[i].user); 186 regcache[i].cnt_lo = (unsigned long)(ctr->count & 0xffffffff);
205 oprofilefs_create_ulong(sb, dir, "unit_mask", &ctr[i].unit_mask);
206 } 187 }
207
208 return 0;
209} 188}
210 189
211static int sh7750_perf_counter_start(void) 190static void sh7750_ppc_cpu_setup(void *args)
212{ 191{
213 u16 pmcr; 192 unsigned int counters = op_model_sh7750_ops.num_counters;
214 193 int i;
215 /* Enable counter 1 */
216 if (ctr[0].enabled) {
217 pmcr = ctrl_inw(PMCR1);
218 WARN_ON(pmcr & PMCR_PMEN);
219
220 pmcr &= ~PMCR_PMM_MASK;
221 pmcr |= ctr[0].event;
222 ctrl_outw(pmcr | PMCR_ENABLE, PMCR1);
223 }
224
225 /* Enable counter 2 */
226 if (ctr[1].enabled) {
227 pmcr = ctrl_inw(PMCR2);
228 WARN_ON(pmcr & PMCR_PMEN);
229 194
230 pmcr &= ~PMCR_PMM_MASK; 195 for (i = 0; i < counters; i++) {
231 pmcr |= ctr[1].event; 196 __raw_writew(0, PMCR(i));
232 ctrl_outw(pmcr | PMCR_ENABLE, PMCR2); 197 __raw_writel(regcache[i].cnt_hi, PMCTRH(i));
198 __raw_writel(regcache[i].cnt_lo, PMCTRL(i));
233 } 199 }
234
235 return register_timer_hook(sh7750_timer_notify);
236} 200}
237 201
238static void sh7750_perf_counter_stop(void) 202static void sh7750_ppc_cpu_start(void *args)
239{ 203{
240 ctrl_outw(ctrl_inw(PMCR1) & ~PMCR_PMEN, PMCR1); 204 unsigned int counters = op_model_sh7750_ops.num_counters;
241 ctrl_outw(ctrl_inw(PMCR2) & ~PMCR_PMEN, PMCR2); 205 int i;
242 206
243 unregister_timer_hook(sh7750_timer_notify); 207 for (i = 0; i < counters; i++)
208 __raw_writew(regcache[i].ctrl, PMCR(i));
244} 209}
245 210
246static struct oprofile_operations sh7750_perf_counter_ops = { 211static void sh7750_ppc_cpu_stop(void *args)
247 .create_files = sh7750_perf_counter_create_files,
248 .start = sh7750_perf_counter_start,
249 .stop = sh7750_perf_counter_stop,
250};
251
252int __init oprofile_arch_init(struct oprofile_operations *ops)
253{ 212{
254 if (!(current_cpu_data.flags & CPU_HAS_PERF_COUNTER)) 213 unsigned int counters = op_model_sh7750_ops.num_counters;
255 return -ENODEV; 214 int i;
256 215
257 ops = &sh7750_perf_counter_ops; 216 /* Disable the counters */
258 ops->cpu_type = "sh/sh7750"; 217 for (i = 0; i < counters; i++)
218 __raw_writew(__raw_readw(PMCR(i)) & ~PMCR_PMEN, PMCR(i));
219}
259 220
260 printk(KERN_INFO "oprofile: using SH-4 performance monitoring.\n"); 221static inline void sh7750_ppc_reset(void)
222{
223 unsigned int counters = op_model_sh7750_ops.num_counters;
224 int i;
261 225
262 /* Clear the counters */ 226 /* Clear the counters */
263 ctrl_outw(ctrl_inw(PMCR1) | PMCR_PMCLR, PMCR1); 227 for (i = 0; i < counters; i++)
264 ctrl_outw(ctrl_inw(PMCR2) | PMCR_PMCLR, PMCR2); 228 __raw_writew(__raw_readw(PMCR(i)) | PMCR_PMCLR, PMCR(i));
229}
265 230
266 return 0; 231static int sh7750_ppc_init(void)
232{
233 sh7750_ppc_reset();
234
235 return register_timer_hook(sh7750_timer_notify);
267} 236}
268 237
269void oprofile_arch_exit(void) 238static void sh7750_ppc_exit(void)
270{ 239{
240 unregister_timer_hook(sh7750_timer_notify);
241
242 sh7750_ppc_reset();
271} 243}
244
245struct op_sh_model op_model_sh7750_ops = {
246 .cpu_type = "sh/sh7750",
247 .num_counters = NR_CNTRS,
248 .reg_setup = sh7750_ppc_reg_setup,
249 .cpu_setup = sh7750_ppc_cpu_setup,
250 .cpu_start = sh7750_ppc_cpu_start,
251 .cpu_stop = sh7750_ppc_cpu_stop,
252 .init = sh7750_ppc_init,
253 .exit = sh7750_ppc_exit,
254 .create_files = sh7750_ppc_create_files,
255};
diff --git a/arch/sh/tools/mach-types b/arch/sh/tools/mach-types
index d0c2928d1066..284b7e867496 100644
--- a/arch/sh/tools/mach-types
+++ b/arch/sh/tools/mach-types
@@ -8,6 +8,7 @@
8SE SH_SOLUTION_ENGINE 8SE SH_SOLUTION_ENGINE
9HIGHLANDER SH_HIGHLANDER 9HIGHLANDER SH_HIGHLANDER
10RTS7751R2D SH_RTS7751R2D 10RTS7751R2D SH_RTS7751R2D
11RSK SH_RSK
11 12
12# 13#
13# List of companion chips / MFDs. 14# List of companion chips / MFDs.
@@ -46,6 +47,7 @@ R2D_1 RTS7751R2D_1
46CAYMAN SH_CAYMAN 47CAYMAN SH_CAYMAN
47SDK7780 SH_SDK7780 48SDK7780 SH_SDK7780
48MIGOR SH_MIGOR 49MIGOR SH_MIGOR
50RSK7201 SH_RSK7201
49RSK7203 SH_RSK7203 51RSK7203 SH_RSK7203
50AP325RXA SH_AP325RXA 52AP325RXA SH_AP325RXA
51SH7763RDP SH_SH7763RDP 53SH7763RDP SH_SH7763RDP
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index e594559c8dba..de58c02633b4 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -4,21 +4,113 @@
4 4
5mainmenu "Linux/SPARC Kernel Configuration" 5mainmenu "Linux/SPARC Kernel Configuration"
6 6
7config 64BIT
8 bool "64-bit kernel" if ARCH = "sparc"
9 default ARCH = "sparc64"
10 help
11 SPARC is a family of RISC microprocessors designed and marketed by
12 Sun Microsystems, incorporated. They are very widely found in Sun
13 workstations and clones.
14
15 Say yes to build a 64-bit kernel - formerly known as sparc64
16 Say no to build a 32-bit kernel - formerly known as sparc
17
18config SPARC
19 bool
20 default y
21 select HAVE_IDE
22 select HAVE_OPROFILE
23 select HAVE_ARCH_KGDB if !SMP || SPARC64
24 select HAVE_ARCH_TRACEHOOK
25 select ARCH_WANT_OPTIONAL_GPIOLIB
26 select RTC_CLASS
27 select RTC_DRV_M48T59
28
29config SPARC32
30 def_bool !64BIT
31
32config SPARC64
33 def_bool 64BIT
34 select ARCH_SUPPORTS_MSI
35 select HAVE_FUNCTION_TRACER
36 select HAVE_KRETPROBES
37 select HAVE_KPROBES
38 select HAVE_LMB
39 select USE_GENERIC_SMP_HELPERS if SMP
40 select RTC_DRV_CMOS
41 select RTC_DRV_BQ4802
42 select RTC_DRV_SUN4V
43 select RTC_DRV_STARFIRE
44
45config ARCH_DEFCONFIG
46 string
47 default "arch/sparc/configs/sparc32_defconfig" if SPARC32
48 default "arch/sparc/configs/sparc64_defconfig" if SPARC64
49
50# CONFIG_BITS can be used at source level to get 32/64 bits
51config BITS
52 int
53 default 32 if SPARC32
54 default 64 if SPARC64
55
56config GENERIC_TIME
57 bool
58 default y if SPARC64
59
60config GENERIC_CMOS_UPDATE
61 bool
62 default y if SPARC64
63
64config GENERIC_CLOCKEVENTS
65 bool
66 default y if SPARC64
67
68config IOMMU_HELPER
69 bool
70 default y if SPARC64
71
72config QUICKLIST
73 bool
74 default y if SPARC64
75
76config STACKTRACE_SUPPORT
77 bool
78 default y if SPARC64
79
80config LOCKDEP_SUPPORT
81 bool
82 default y if SPARC64
83
84config HAVE_LATENCYTOP_SUPPORT
85 bool
86 default y if SPARC64
87
88config AUDIT_ARCH
89 bool
90 default y
91
92config HAVE_SETUP_PER_CPU_AREA
93 def_bool y if SPARC64
94
95config GENERIC_HARDIRQS_NO__DO_IRQ
96 bool
97 def_bool y if SPARC64
98
7config MMU 99config MMU
8 bool 100 bool
9 default y 101 default y
10 102
11config HIGHMEM 103config HIGHMEM
12 bool 104 bool
13 default y 105 default y if SPARC32
14 106
15config ZONE_DMA 107config ZONE_DMA
16 bool 108 bool
17 default y 109 default y if SPARC32
18 110
19config GENERIC_ISA_DMA 111config GENERIC_ISA_DMA
20 bool 112 bool
21 default y 113 default y if SPARC32
22 114
23config GENERIC_GPIO 115config GENERIC_GPIO
24 bool 116 bool
@@ -31,15 +123,11 @@ config ARCH_NO_VIRT_TO_BUS
31config OF 123config OF
32 def_bool y 124 def_bool y
33 125
34config HZ
35 int
36 default 100
37
38source "init/Kconfig" 126source "init/Kconfig"
39 127
40source "kernel/Kconfig.freezer" 128source "kernel/Kconfig.freezer"
41 129
42menu "General machine setup" 130menu "Processor type and features"
43 131
44config SMP 132config SMP
45 bool "Symmetric multi-processing support (does not work on sun4/sun4c)" 133 bool "Symmetric multi-processing support (does not work on sun4/sun4c)"
@@ -64,82 +152,261 @@ config SMP
64 If you don't know what to do here, say N. 152 If you don't know what to do here, say N.
65 153
66config NR_CPUS 154config NR_CPUS
67 int "Maximum number of CPUs (2-32)" 155 int "Maximum number of CPUs"
68 range 2 32
69 depends on SMP 156 depends on SMP
70 default "32" 157 range 2 32 if SPARC32
158 range 2 1024 if SPARC64
159 default 32 if SPARC32
160 default 64 if SPARC64
71 161
72config SPARC 162source kernel/Kconfig.hz
163
164config RWSEM_GENERIC_SPINLOCK
165 bool
166 default y if SPARC32
167
168config RWSEM_XCHGADD_ALGORITHM
169 bool
170 default y if SPARC64
171
172config GENERIC_FIND_NEXT_BIT
73 bool 173 bool
74 default y 174 default y
75 select HAVE_IDE
76 select HAVE_OPROFILE
77 select HAVE_ARCH_KGDB if !SMP
78 select HAVE_ARCH_TRACEHOOK
79 select ARCH_WANT_OPTIONAL_GPIOLIB
80 select RTC_CLASS
81 select RTC_DRV_M48T59
82 175
83# Identify this as a Sparc32 build 176config GENERIC_HWEIGHT
84config SPARC32 177 bool
178 default y if !ULTRA_HAS_POPULATION_COUNT
179
180config GENERIC_CALIBRATE_DELAY
85 bool 181 bool
86 default y 182 default y
87 help
88 SPARC is a family of RISC microprocessors designed and marketed by
89 Sun Microsystems, incorporated. They are very widely found in Sun
90 workstations and clones. This port covers the original 32-bit SPARC;
91 it is old and stable and usually considered one of the "big three"
92 along with the Intel and Alpha ports. The UltraLinux project
93 maintains both the SPARC32 and SPARC64 ports; its web page is
94 available at <http://www.ultralinux.org/>.
95 183
96# Global things across all Sun machines. 184config ARCH_MAY_HAVE_PC_FDC
97config ISA
98 bool 185 bool
99 help 186 default y
100 ISA is found on Espresso only and is not supported currently.
101 Say N
102 187
103config EISA 188config EMULATED_CMPXCHG
104 bool 189 bool
190 default y if SPARC32
105 help 191 help
106 EISA is not supported. 192 Sparc32 does not have a CAS instruction like sparc64. cmpxchg()
107 Say N 193 is emulated, and therefore it is not completely atomic.
194
195# Makefile helpers
196config SPARC32_SMP
197 bool
198 default y
199 depends on SPARC32 && SMP
108 200
109config MCA 201config SPARC64_SMP
110 bool 202 bool
203 default y
204 depends on SPARC64 && SMP
205
206choice
207 prompt "Kernel page size" if SPARC64
208 default SPARC64_PAGE_SIZE_8KB
209
210config SPARC64_PAGE_SIZE_8KB
211 bool "8KB"
111 help 212 help
112 MCA is not supported. 213 This lets you select the page size of the kernel.
113 Say N
114 214
115config PCMCIA 215 8KB and 64KB work quite well, since SPARC ELF sections
116 tristate 216 provide for up to 64KB alignment.
117 ---help---
118 Say Y here if you want to attach PCMCIA- or PC-cards to your Linux
119 computer. These are credit-card size devices such as network cards,
120 modems or hard drives often used with laptops computers. There are
121 actually two varieties of these cards: the older 16 bit PCMCIA cards
122 and the newer 32 bit CardBus cards. If you want to use CardBus
123 cards, you need to say Y here and also to "CardBus support" below.
124 217
125 To use your PC-cards, you will need supporting software from David 218 If you don't know what to do, choose 8KB.
126 Hinds' pcmcia-cs package (see the file <file:Documentation/Changes>
127 for location). Please also read the PCMCIA-HOWTO, available from
128 <http://www.tldp.org/docs.html#howto>.
129 219
130 To compile this driver as modules, choose M here: the 220config SPARC64_PAGE_SIZE_64KB
131 modules will be called pcmcia_core and ds. 221 bool "64KB"
132 222
133config SBUS 223endchoice
224
225config SECCOMP
226 bool "Enable seccomp to safely compute untrusted bytecode"
227 depends on SPARC64 && PROC_FS
228 default y
229 help
230 This kernel feature is useful for number crunching applications
231 that may need to compute untrusted bytecode during their
232 execution. By using pipes or other transports made available to
233 the process as file descriptors supporting the read/write
234 syscalls, it's possible to isolate those applications in
235 their own address space using seccomp. Once seccomp is
236 enabled via /proc/<pid>/seccomp, it cannot be disabled
237 and the task is only allowed to execute a few safe syscalls
238 defined by each seccomp mode.
239
240 If unsure, say Y. Only embedded should say N here.
241
242config HOTPLUG_CPU
243 bool "Support for hot-pluggable CPUs"
244 depends on SPARC64 && SMP
245 select HOTPLUG
246 help
247 Say Y here to experiment with turning CPUs off and on. CPUs
248 can be controlled through /sys/devices/system/cpu/cpu#.
249 Say N if you want to disable CPU hotplug.
250
251config GENERIC_HARDIRQS
134 bool 252 bool
253 default y if SPARC64
254
255source "kernel/time/Kconfig"
256
257if SPARC64
258source "drivers/cpufreq/Kconfig"
259
260config US3_FREQ
261 tristate "UltraSPARC-III CPU Frequency driver"
262 depends on CPU_FREQ
263 select CPU_FREQ_TABLE
264 help
265 This adds the CPUFreq driver for UltraSPARC-III processors.
266
267 For details, take a look at <file:Documentation/cpu-freq>.
268
269 If in doubt, say N.
270
271config US2E_FREQ
272 tristate "UltraSPARC-IIe CPU Frequency driver"
273 depends on CPU_FREQ
274 select CPU_FREQ_TABLE
275 help
276 This adds the CPUFreq driver for UltraSPARC-IIe processors.
277
278 For details, take a look at <file:Documentation/cpu-freq>.
279
280 If in doubt, say N.
281
282endif
283
284config US3_MC
285 tristate "UltraSPARC-III Memory Controller driver"
286 depends on SPARC64
135 default y 287 default y
288 help
289 This adds a driver for the UltraSPARC-III memory controller.
290 Loading this driver allows exact mnemonic strings to be
291 printed in the event of a memory error, so that the faulty DIMM
292 on the motherboard can be matched to the error.
136 293
137config SBUSCHAR 294 If in doubt, say Y, as this information can be very useful.
295
296# Global things across all Sun machines.
297config GENERIC_LOCKBREAK
138 bool 298 bool
139 default y 299 default y
300 depends on SPARC64 && SMP && PREEMPT
301
302choice
303 prompt "SPARC64 Huge TLB Page Size"
304 depends on SPARC64 && HUGETLB_PAGE
305 default HUGETLB_PAGE_SIZE_4MB
306
307config HUGETLB_PAGE_SIZE_4MB
308 bool "4MB"
309
310config HUGETLB_PAGE_SIZE_512K
311 bool "512K"
312
313config HUGETLB_PAGE_SIZE_64K
314 depends on !SPARC64_PAGE_SIZE_64KB
315 bool "64K"
316
317endchoice
318
319config NUMA
320 bool "NUMA support"
321 depends on SPARC64 && SMP
322
323config NODES_SHIFT
324 int
325 default "4"
326 depends on NEED_MULTIPLE_NODES
327
328# Some NUMA nodes have memory ranges that span
329# other nodes. Even though a pfn is valid and
330# between a node's start and end pfns, it may not
331# reside on that node. See memmap_init_zone()
332# for details.
333config NODES_SPAN_OTHER_NODES
334 def_bool y
335 depends on NEED_MULTIPLE_NODES
336
337config ARCH_POPULATES_NODE_MAP
338 def_bool y if SPARC64
339
340config ARCH_SELECT_MEMORY_MODEL
341 def_bool y if SPARC64
342
343config ARCH_SPARSEMEM_ENABLE
344 def_bool y if SPARC64
345 select SPARSEMEM_VMEMMAP_ENABLE
346
347config ARCH_SPARSEMEM_DEFAULT
348 def_bool y if SPARC64
349
350source "mm/Kconfig"
351
352config SCHED_SMT
353 bool "SMT (Hyperthreading) scheduler support"
354 depends on SPARC64 && SMP
355 default y
356 help
357 SMT scheduler support improves the CPU scheduler's decision making
358 when dealing with SPARC cpus at a cost of slightly increased overhead
359 in some places. If unsure say N here.
360
361config SCHED_MC
362 bool "Multi-core scheduler support"
363 depends on SPARC64 && SMP
364 default y
365 help
366 Multi-core scheduler support improves the CPU scheduler's decision
367 making when dealing with multi-core CPU chips at a cost of slightly
368 increased overhead in some places. If unsure say N here.
369
370if SPARC64
371source "kernel/Kconfig.preempt"
372endif
373
374config CMDLINE_BOOL
375 bool "Default bootloader kernel arguments"
376 depends on SPARC64
377
378config CMDLINE
379 string "Initial kernel command string"
380 depends on CMDLINE_BOOL
381 default "console=ttyS0,9600 root=/dev/sda1"
382 help
383 Say Y here if you want to be able to pass default arguments to
384 the kernel. This will be overridden by the bootloader, if you
385 use one (such as SILO). This is most useful if you want to boot
386 a kernel from TFTP, and want default options to be available
387 with having them passed on the command line.
388
389 NOTE: This option WILL override the PROM bootargs setting!
390
391config SUN_PM
392 bool
393 default y if SPARC32
394 help
395 Enable power management and CPU standby features on supported
396 SPARC platforms.
397
398config SPARC_LED
399 tristate "Sun4m LED driver"
400 depends on SPARC32
401 help
402 This driver toggles the front-panel LED on sun4m systems
403 in a user-specifiable manner. Its state can be probed
404 by reading /proc/led and its blinking mode can be changed
405 via writes to /proc/led
140 406
141config SERIAL_CONSOLE 407config SERIAL_CONSOLE
142 bool 408 bool
409 depends on SPARC32
143 default y 410 default y
144 ---help--- 411 ---help---
145 If you say Y here, it will be possible to use a serial port as the 412 If you say Y here, it will be possible to use a serial port as the
@@ -161,71 +428,46 @@ config SERIAL_CONSOLE
161 428
162 If unsure, say N. 429 If unsure, say N.
163 430
164config SUN_AUXIO 431endmenu
165 bool
166 default y
167
168config SUN_IO
169 bool
170 default y
171
172config RWSEM_GENERIC_SPINLOCK
173 bool
174 default y
175
176config RWSEM_XCHGADD_ALGORITHM
177 bool
178
179config GENERIC_FIND_NEXT_BIT
180 bool
181 default y
182
183config GENERIC_HWEIGHT
184 bool
185 default y
186
187config GENERIC_CALIBRATE_DELAY
188 bool
189 default y
190 432
191config ARCH_MAY_HAVE_PC_FDC 433menu "Bus options (PCI etc.)"
434config SBUS
192 bool 435 bool
193 default y 436 default y
194 437
195config ARCH_HAS_ILOG2_U32 438config SBUSCHAR
196 bool
197 default n
198
199config ARCH_HAS_ILOG2_U64
200 bool
201 default n
202
203config EMULATED_CMPXCHG
204 bool 439 bool
205 default y 440 default y
206 help
207 Sparc32 does not have a CAS instruction like sparc64. cmpxchg()
208 is emulated, and therefore it is not completely atomic.
209 441
210config SUN_PM 442config SUN_LDOMS
211 bool 443 bool "Sun Logical Domains support"
212 default y 444 depends on SPARC64
213 help 445 help
214 Enable power management and CPU standby features on supported 446 Say Y here is you want to support virtual devices via
215 SPARC platforms. 447 Logical Domains.
216 448
217config PCI 449config PCI
218 bool "Support for PCI and PS/2 keyboard/mouse" 450 bool "Support for PCI and PS/2 keyboard/mouse"
219 help 451 help
452 Find out whether your system includes a PCI bus. PCI is the name of
453 a bus system, i.e. the way the CPU talks to the other stuff inside
454 your box. If you say Y here, the kernel will include drivers and
455 infrastructure code to support PCI bus devices.
456
220 CONFIG_PCI is needed for all JavaStation's (including MrCoffee), 457 CONFIG_PCI is needed for all JavaStation's (including MrCoffee),
221 CP-1200, JavaEngine-1, Corona, Red October, and Serengeti SGSC. 458 CP-1200, JavaEngine-1, Corona, Red October, and Serengeti SGSC.
222 All of these platforms are extremely obscure, so say N if unsure. 459 All of these platforms are extremely obscure, so say N if unsure.
223 460
461config PCI_DOMAINS
462 def_bool PCI if SPARC64
463
224config PCI_SYSCALL 464config PCI_SYSCALL
225 def_bool PCI 465 def_bool PCI
226 466
227source "drivers/pci/Kconfig" 467source "drivers/pci/Kconfig"
228 468
469source "drivers/pcmcia/Kconfig"
470
229config SUN_OPENPROMFS 471config SUN_OPENPROMFS
230 tristate "Openprom tree appears in /proc/openprom" 472 tristate "Openprom tree appears in /proc/openprom"
231 help 473 help
@@ -239,17 +481,33 @@ config SUN_OPENPROMFS
239 Only choose N if you know in advance that you will not need to modify 481 Only choose N if you know in advance that you will not need to modify
240 OpenPROM settings on the running system. 482 OpenPROM settings on the running system.
241 483
242config SPARC_LED 484# Makefile helpers
243 tristate "Sun4m LED driver" 485config SPARC32_PCI
244 help 486 bool
245 This driver toggles the front-panel LED on sun4m systems 487 default y
246 in a user-specifiable manner. Its state can be probed 488 depends on SPARC32 && PCI
247 by reading /proc/led and its blinking mode can be changed 489
248 via writes to /proc/led 490config SPARC64_PCI
491 bool
492 default y
493 depends on SPARC64 && PCI
494
495endmenu
496
497menu "Executable file formats"
249 498
250source "fs/Kconfig.binfmt" 499source "fs/Kconfig.binfmt"
251 500
252source "mm/Kconfig" 501config COMPAT
502 bool
503 depends on SPARC64
504 default y
505 select COMPAT_BINFMT_ELF
506
507config SYSVIPC_COMPAT
508 bool
509 depends on COMPAT && SYSVIPC
510 default y
253 511
254endmenu 512endmenu
255 513
@@ -259,40 +517,6 @@ source "drivers/Kconfig"
259 517
260source "drivers/sbus/char/Kconfig" 518source "drivers/sbus/char/Kconfig"
261 519
262# This one must be before the filesystem configs. -DaveM
263
264menu "Unix98 PTY support"
265
266config UNIX98_PTYS
267 bool "Unix98 PTY support"
268 ---help---
269 A pseudo terminal (PTY) is a software device consisting of two
270 halves: a master and a slave. The slave device behaves identical to
271 a physical terminal; the master device is used by a process to
272 read data from and write data to the slave, thereby emulating a
273 terminal. Typical programs for the master side are telnet servers
274 and xterms.
275
276 Linux has traditionally used the BSD-like names /dev/ptyxx for
277 masters and /dev/ttyxx for slaves of pseudo terminals. This scheme
278 has a number of problems. The GNU C library glibc 2.1 and later,
279 however, supports the Unix98 naming standard: in order to acquire a
280 pseudo terminal, a process opens /dev/ptmx; the number of the pseudo
281 terminal is then made available to the process and the pseudo
282 terminal slave can be accessed as /dev/pts/<number>. What was
283 traditionally /dev/ttyp2 will then be /dev/pts/2, for example.
284
285 The entries in /dev/pts/ are created on the fly by a virtual
286 file system; therefore, if you say Y here you should say Y to
287 "/dev/pts file system for Unix98 PTYs" as well.
288
289 If you want to say Y here, you need to have the C library glibc 2.1
290 or later (equal to libc-6.1, check with "ls -l /lib/libc.so.*").
291 Read the instructions in <file:Documentation/Changes> pertaining to
292 pseudo terminals. It's safe to say N.
293
294endmenu
295
296source "fs/Kconfig" 520source "fs/Kconfig"
297 521
298source "arch/sparc/Kconfig.debug" 522source "arch/sparc/Kconfig.debug"
diff --git a/arch/sparc/Kconfig.debug b/arch/sparc/Kconfig.debug
index 87dd496f15eb..b8a15e271bfa 100644
--- a/arch/sparc/Kconfig.debug
+++ b/arch/sparc/Kconfig.debug
@@ -15,4 +15,30 @@ config DEBUG_STACK_USAGE
15 15
16 This option will slow down process creation somewhat. 16 This option will slow down process creation somewhat.
17 17
18config DEBUG_DCFLUSH
19 bool "D-cache flush debugging"
20 depends on SPARC64 && DEBUG_KERNEL
21
22config STACK_DEBUG
23 bool "Stack Overflow Detection Support"
24
25config DEBUG_PAGEALLOC
26 bool "Debug page memory allocations"
27 depends on SPARC64 && DEBUG_KERNEL && !HIBERNATION
28 help
29 Unmap pages from the kernel linear mapping after free_pages().
30 This results in a large slowdown, but helps to find certain types
31 of memory corruptions.
32
33config MCOUNT
34 bool
35 depends on SPARC64
36 depends on STACK_DEBUG || FUNCTION_TRACER
37 default y
38
39config FRAME_POINTER
40 bool
41 depends on MCOUNT
42 default y
43
18endmenu 44endmenu
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
index 9592889a6fd0..2003ded054c2 100644
--- a/arch/sparc/Makefile
+++ b/arch/sparc/Makefile
@@ -2,18 +2,31 @@
2# sparc/Makefile 2# sparc/Makefile
3# 3#
4# Makefile for the architecture dependent flags and dependencies on the 4# Makefile for the architecture dependent flags and dependencies on the
5# Sparc. 5# Sparc and sparc64.
6# 6#
7# Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu) 7# Copyright (C) 1994,1996,1998 David S. Miller (davem@caip.rutgers.edu)
8# Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
9
10# We are not yet configured - so test on arch
11ifeq ($(ARCH),sparc)
12 KBUILD_DEFCONFIG := sparc32_defconfig
13else
14 KBUILD_DEFCONFIG := sparc64_defconfig
15endif
16
17ifeq ($(CONFIG_SPARC32),y)
18#####
19# sparc32
8# 20#
9 21
10# 22#
11# Uncomment the first KBUILD_CFLAGS if you are doing kgdb source level 23# Uncomment the first KBUILD_CFLAGS if you are doing kgdb source level
12# debugging of the kernel to get the proper debugging information. 24# debugging of the kernel to get the proper debugging information.
13 25
14AS := $(AS) -32 26AS := $(AS) -32
15LDFLAGS := -m elf32_sparc 27LDFLAGS := -m elf32_sparc
16CHECKFLAGS += -D__sparc__ 28CHECKFLAGS += -D__sparc__
29export BITS := 32
17 30
18#KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7 31#KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7
19KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 32KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
@@ -25,38 +38,60 @@ CPPFLAGS_vmlinux.lds += -m32
25# Actual linking is done with "make image". 38# Actual linking is done with "make image".
26LDFLAGS_vmlinux = -r 39LDFLAGS_vmlinux = -r
27 40
28head-y := arch/sparc/kernel/head.o arch/sparc/kernel/init_task.o 41# Default target
29HEAD_Y := $(head-y) 42all: zImage
43
44
45else
46#####
47# sparc64
48#
30 49
31core-y += arch/sparc/kernel/ arch/sparc/mm/ arch/sparc/math-emu/ 50CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64
32libs-y += arch/sparc/prom/ arch/sparc/lib/ 51
52# Undefine sparc when processing vmlinux.lds - it is used
53# And teach CPP we are doing 64 bit builds (for this case)
54CPPFLAGS_vmlinux.lds += -m64 -Usparc
55LDFLAGS := -m elf64_sparc
56export BITS := 64
57
58KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \
59 -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \
60 -Wa,--undeclared-regs
61KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3)
62KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs
63
64ifeq ($(CONFIG_MCOUNT),y)
65 KBUILD_CFLAGS += -pg
66endif
67
68endif
69
70head-y := arch/sparc/kernel/head_$(BITS).o
71head-y += arch/sparc/kernel/init_task.o
72
73core-y += arch/sparc/kernel/
74core-y += arch/sparc/mm/ arch/sparc/math-emu/
75
76libs-y += arch/sparc/prom/
77libs-y += arch/sparc/lib/
33 78
34drivers-$(CONFIG_OPROFILE) += arch/sparc/oprofile/ 79drivers-$(CONFIG_OPROFILE) += arch/sparc/oprofile/
35 80
36# Export what is needed by arch/sparc/boot/Makefile 81# Export what is needed by arch/sparc/boot/Makefile
37# Renaming is done to avoid confusing pattern matching rules in 2.5.45 (multy-) 82export VMLINUX_INIT VMLINUX_MAIN
38INIT_Y := $(patsubst %/, %/built-in.o, $(init-y)) 83VMLINUX_INIT := $(head-y) $(init-y)
39CORE_Y := $(core-y) 84VMLINUX_MAIN := $(core-y) kernel/ mm/ fs/ ipc/ security/ crypto/ block/
40CORE_Y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ 85VMLINUX_MAIN += $(patsubst %/, %/lib.a, $(libs-y)) $(libs-y)
41CORE_Y := $(patsubst %/, %/built-in.o, $(CORE_Y)) 86VMLINUX_MAIN += $(drivers-y) $(net-y)
42DRIVERS_Y := $(patsubst %/, %/built-in.o, $(drivers-y))
43NET_Y := $(patsubst %/, %/built-in.o, $(net-y))
44LIBS_Y1 := $(patsubst %/, %/lib.a, $(libs-y))
45LIBS_Y2 := $(patsubst %/, %/built-in.o, $(libs-y))
46LIBS_Y := $(LIBS_Y1) $(LIBS_Y2)
47 87
48ifdef CONFIG_KALLSYMS 88ifdef CONFIG_KALLSYMS
49kallsyms.o := .tmp_kallsyms2.o 89export kallsyms.o := .tmp_kallsyms2.o
50endif 90endif
51 91
52export INIT_Y CORE_Y DRIVERS_Y NET_Y LIBS_Y HEAD_Y kallsyms.o
53
54# Default target
55all: zImage
56
57boot := arch/sparc/boot 92boot := arch/sparc/boot
58 93
59image zImage tftpboot.img: vmlinux 94image zImage tftpboot.img vmlinux.aout: vmlinux
60 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 95 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
61 96
62archclean: 97archclean:
@@ -65,11 +100,17 @@ archclean:
65# This is the image used for packaging 100# This is the image used for packaging
66KBUILD_IMAGE := $(boot)/zImage 101KBUILD_IMAGE := $(boot)/zImage
67 102
68CLEAN_FILES += arch/$(ARCH)/boot/System.map
69
70# Don't use tabs in echo arguments. 103# Don't use tabs in echo arguments.
104ifeq ($(ARCH),sparc)
71define archhelp 105define archhelp
72 echo '* image - kernel image ($(boot)/image)' 106 echo '* image - kernel image ($(boot)/image)'
73 echo '* zImage - stripped kernel image ($(boot)/zImage)' 107 echo '* zImage - stripped kernel image ($(boot)/zImage)'
74 echo ' tftpboot.img - image prepared for tftp' 108 echo ' tftpboot.img - image prepared for tftp'
75endef 109endef
110else
111define archhelp
112 echo '* vmlinux - Standard sparc64 kernel'
113 echo ' vmlinux.aout - a.out kernel for sparc64'
114 echo ' tftpboot.img - image prepared for tftp'
115endef
116endif
diff --git a/arch/sparc64/boot/.gitignore b/arch/sparc/boot/.gitignore
index 36356f9d498e..fc6f3986c76c 100644
--- a/arch/sparc64/boot/.gitignore
+++ b/arch/sparc/boot/.gitignore
@@ -1,4 +1,8 @@
1btfix.S
2btfixupprep
1image 3image
4zImage
2tftpboot.img 5tftpboot.img
3vmlinux.aout 6vmlinux.aout
4piggyback 7piggyback
8
diff --git a/arch/sparc/boot/Makefile b/arch/sparc/boot/Makefile
index 3e77a9f52248..96041a8d39e8 100644
--- a/arch/sparc/boot/Makefile
+++ b/arch/sparc/boot/Makefile
@@ -6,13 +6,16 @@
6ROOT_IMG := /usr/src/root.img 6ROOT_IMG := /usr/src/root.img
7ELFTOAOUT := elftoaout 7ELFTOAOUT := elftoaout
8 8
9hostprogs-y := piggyback btfixupprep 9hostprogs-y := piggyback_32 piggyback_64 btfixupprep
10targets := tftpboot.img btfix.o btfix.S image 10targets := tftpboot.img btfix.o btfix.S image zImage vmlinux.aout
11clean-files := System.map
11 12
12quiet_cmd_elftoaout = ELFTOAOUT $@ 13quiet_cmd_elftoaout = ELFTOAOUT $@
13 cmd_elftoaout = $(ELFTOAOUT) $(obj)/image -o $@ 14 cmd_elftoaout = $(ELFTOAOUT) $(obj)/image -o $@
15
16ifeq ($(CONFIG_SPARC32),y)
14quiet_cmd_piggy = PIGGY $@ 17quiet_cmd_piggy = PIGGY $@
15 cmd_piggy = $(obj)/piggyback $@ $(obj)/System.map $(ROOT_IMG) 18 cmd_piggy = $(obj)/piggyback_32 $@ $(obj)/System.map $(ROOT_IMG)
16quiet_cmd_btfix = BTFIX $@ 19quiet_cmd_btfix = BTFIX $@
17 cmd_btfix = $(OBJDUMP) -x vmlinux | $(obj)/btfixupprep > $@ 20 cmd_btfix = $(OBJDUMP) -x vmlinux | $(obj)/btfixupprep > $@
18quiet_cmd_sysmap = SYSMAP $(obj)/System.map 21quiet_cmd_sysmap = SYSMAP $(obj)/System.map
@@ -37,8 +40,8 @@ define rule_image
37 echo 'cmd_$@ := $(cmd_image)' > $(@D)/.$(@F).cmd 40 echo 'cmd_$@ := $(cmd_image)' > $(@D)/.$(@F).cmd
38endef 41endef
39 42
40BTOBJS := $(HEAD_Y) $(INIT_Y) 43BTOBJS := $(patsubst %/, %/built-in.o, $(VMLINUX_INIT))
41BTLIBS := $(CORE_Y) $(LIBS_Y) $(DRIVERS_Y) $(NET_Y) 44BTLIBS := $(patsubst %/, %/built-in.o, $(VMLINUX_MAIN))
42LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds $(BTOBJS) \ 45LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds $(BTOBJS) \
43 --start-group $(BTLIBS) --end-group \ 46 --start-group $(BTLIBS) --end-group \
44 $(kallsyms.o) $(obj)/btfix.o 47 $(kallsyms.o) $(obj)/btfix.o
@@ -61,3 +64,28 @@ $(obj)/tftpboot.img: $(obj)/piggyback $(obj)/System.map $(obj)/image FORCE
61 64
62$(obj)/btfix.S: $(obj)/btfixupprep vmlinux FORCE 65$(obj)/btfix.S: $(obj)/btfixupprep vmlinux FORCE
63 $(call if_changed,btfix) 66 $(call if_changed,btfix)
67
68endif
69
70ifeq ($(CONFIG_SPARC64),y)
71quiet_cmd_piggy = PIGGY $@
72 cmd_piggy = $(obj)/piggyback_64 $@ System.map $(ROOT_IMG)
73quiet_cmd_strip = STRIP $@
74 cmd_strip = $(STRIP) -R .comment -R .note -K sun4u_init -K _end -K _start vmlinux -o $@
75
76
77# Actual linking
78$(obj)/image: vmlinux FORCE
79 $(call if_changed,strip)
80 @echo ' kernel: $@ is ready'
81
82$(obj)/tftpboot.img: vmlinux $(obj)/piggyback_64 System.map $(ROOT_IMG) FORCE
83 $(call if_changed,elftoaout)
84 $(call if_changed,piggy)
85 @echo ' kernel: $@ is ready'
86
87$(obj)/vmlinux.aout: vmlinux FORCE
88 $(call if_changed,elftoaout)
89 @echo ' kernel: $@ is ready'
90endif
91
diff --git a/arch/sparc/boot/piggyback.c b/arch/sparc/boot/piggyback_32.c
index c9f500c1a8b2..c9f500c1a8b2 100644
--- a/arch/sparc/boot/piggyback.c
+++ b/arch/sparc/boot/piggyback_32.c
diff --git a/arch/sparc64/boot/piggyback.c b/arch/sparc/boot/piggyback_64.c
index de364bfed0bb..de364bfed0bb 100644
--- a/arch/sparc64/boot/piggyback.c
+++ b/arch/sparc/boot/piggyback_64.c
diff --git a/arch/sparc/defconfig b/arch/sparc/configs/sparc32_defconfig
index 2e3a149ea0e7..2e3a149ea0e7 100644
--- a/arch/sparc/defconfig
+++ b/arch/sparc/configs/sparc32_defconfig
diff --git a/arch/sparc64/defconfig b/arch/sparc/configs/sparc64_defconfig
index 05d19a3e590f..cde19ae78f5a 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc/configs/sparc64_defconfig
@@ -1,27 +1,27 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.28-rc4 3# Linux kernel version: 2.6.28
4# Mon Nov 10 12:35:09 2008 4# Fri Jan 2 18:14:26 2009
5# 5#
6CONFIG_SPARC=y 6CONFIG_SPARC=y
7CONFIG_SPARC64=y 7CONFIG_SPARC64=y
8CONFIG_ARCH_DEFCONFIG="arch/sparc/configs/sparc64_defconfig"
9CONFIG_BITS=64
10CONFIG_64BIT=y
8CONFIG_GENERIC_TIME=y 11CONFIG_GENERIC_TIME=y
9CONFIG_GENERIC_CMOS_UPDATE=y 12CONFIG_GENERIC_CMOS_UPDATE=y
10CONFIG_GENERIC_CLOCKEVENTS=y 13CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_64BIT=y
12CONFIG_MMU=y
13CONFIG_IOMMU_HELPER=y 14CONFIG_IOMMU_HELPER=y
14CONFIG_QUICKLIST=y 15CONFIG_QUICKLIST=y
15CONFIG_STACKTRACE_SUPPORT=y 16CONFIG_STACKTRACE_SUPPORT=y
16CONFIG_LOCKDEP_SUPPORT=y 17CONFIG_LOCKDEP_SUPPORT=y
17CONFIG_ARCH_MAY_HAVE_PC_FDC=y 18CONFIG_HAVE_LATENCYTOP_SUPPORT=y
18# CONFIG_ARCH_HAS_ILOG2_U32 is not set
19# CONFIG_ARCH_HAS_ILOG2_U64 is not set
20CONFIG_AUDIT_ARCH=y 19CONFIG_AUDIT_ARCH=y
21CONFIG_HAVE_SETUP_PER_CPU_AREA=y 20CONFIG_HAVE_SETUP_PER_CPU_AREA=y
21CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
22CONFIG_MMU=y
22CONFIG_ARCH_NO_VIRT_TO_BUS=y 23CONFIG_ARCH_NO_VIRT_TO_BUS=y
23CONFIG_OF=y 24CONFIG_OF=y
24CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
25CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 25CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
26 26
27# 27#
@@ -86,6 +86,7 @@ CONFIG_SLUB_DEBUG=y
86CONFIG_SLUB=y 86CONFIG_SLUB=y
87# CONFIG_SLOB is not set 87# CONFIG_SLOB is not set
88CONFIG_PROFILING=y 88CONFIG_PROFILING=y
89CONFIG_TRACEPOINTS=y
89# CONFIG_MARKERS is not set 90# CONFIG_MARKERS is not set
90CONFIG_OPROFILE=m 91CONFIG_OPROFILE=m
91CONFIG_HAVE_OPROFILE=y 92CONFIG_HAVE_OPROFILE=y
@@ -127,34 +128,40 @@ CONFIG_DEFAULT_AS=y
127# CONFIG_DEFAULT_NOOP is not set 128# CONFIG_DEFAULT_NOOP is not set
128CONFIG_DEFAULT_IOSCHED="anticipatory" 129CONFIG_DEFAULT_IOSCHED="anticipatory"
129CONFIG_CLASSIC_RCU=y 130CONFIG_CLASSIC_RCU=y
131# CONFIG_TREE_RCU is not set
132# CONFIG_PREEMPT_RCU is not set
133# CONFIG_TREE_RCU_TRACE is not set
134# CONFIG_PREEMPT_RCU_TRACE is not set
130# CONFIG_FREEZER is not set 135# CONFIG_FREEZER is not set
131 136
132# 137#
133# Processor type and features 138# Processor type and features
134# 139#
135CONFIG_SPARC64_PAGE_SIZE_8KB=y 140CONFIG_SMP=y
136# CONFIG_SPARC64_PAGE_SIZE_64KB is not set 141CONFIG_NR_CPUS=64
137CONFIG_SECCOMP=y
138CONFIG_HZ_100=y 142CONFIG_HZ_100=y
139# CONFIG_HZ_250 is not set 143# CONFIG_HZ_250 is not set
140# CONFIG_HZ_300 is not set 144# CONFIG_HZ_300 is not set
141# CONFIG_HZ_1000 is not set 145# CONFIG_HZ_1000 is not set
142CONFIG_HZ=100 146CONFIG_HZ=100
143CONFIG_SCHED_HRTICK=y 147CONFIG_SCHED_HRTICK=y
148CONFIG_RWSEM_XCHGADD_ALGORITHM=y
149CONFIG_GENERIC_FIND_NEXT_BIT=y
150CONFIG_GENERIC_HWEIGHT=y
151CONFIG_GENERIC_CALIBRATE_DELAY=y
152CONFIG_ARCH_MAY_HAVE_PC_FDC=y
153CONFIG_SPARC64_SMP=y
154CONFIG_SPARC64_PAGE_SIZE_8KB=y
155# CONFIG_SPARC64_PAGE_SIZE_64KB is not set
156CONFIG_SECCOMP=y
144CONFIG_HOTPLUG_CPU=y 157CONFIG_HOTPLUG_CPU=y
145CONFIG_GENERIC_HARDIRQS=y 158CONFIG_GENERIC_HARDIRQS=y
146CONFIG_TICK_ONESHOT=y 159CONFIG_TICK_ONESHOT=y
147CONFIG_NO_HZ=y 160CONFIG_NO_HZ=y
148CONFIG_HIGH_RES_TIMERS=y 161CONFIG_HIGH_RES_TIMERS=y
149CONFIG_GENERIC_CLOCKEVENTS_BUILD=y 162CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
150CONFIG_SMP=y
151CONFIG_NR_CPUS=64
152# CONFIG_CPU_FREQ is not set 163# CONFIG_CPU_FREQ is not set
153CONFIG_US3_MC=y 164CONFIG_US3_MC=y
154CONFIG_RWSEM_XCHGADD_ALGORITHM=y
155CONFIG_GENERIC_FIND_NEXT_BIT=y
156CONFIG_GENERIC_HWEIGHT=y
157CONFIG_GENERIC_CALIBRATE_DELAY=y
158CONFIG_HUGETLB_PAGE_SIZE_4MB=y 165CONFIG_HUGETLB_PAGE_SIZE_4MB=y
159# CONFIG_HUGETLB_PAGE_SIZE_512K is not set 166# CONFIG_HUGETLB_PAGE_SIZE_512K is not set
160# CONFIG_HUGETLB_PAGE_SIZE_64K is not set 167# CONFIG_HUGETLB_PAGE_SIZE_64K is not set
@@ -183,10 +190,18 @@ CONFIG_PHYS_ADDR_T_64BIT=y
183CONFIG_ZONE_DMA_FLAG=0 190CONFIG_ZONE_DMA_FLAG=0
184CONFIG_NR_QUICK=1 191CONFIG_NR_QUICK=1
185CONFIG_UNEVICTABLE_LRU=y 192CONFIG_UNEVICTABLE_LRU=y
193CONFIG_SCHED_SMT=y
194CONFIG_SCHED_MC=y
195# CONFIG_PREEMPT_NONE is not set
196CONFIG_PREEMPT_VOLUNTARY=y
197# CONFIG_PREEMPT is not set
198# CONFIG_CMDLINE_BOOL is not set
199
200#
201# Bus options (PCI etc.)
202#
186CONFIG_SBUS=y 203CONFIG_SBUS=y
187CONFIG_SBUSCHAR=y 204CONFIG_SBUSCHAR=y
188CONFIG_SUN_AUXIO=y
189CONFIG_SUN_IO=y
190CONFIG_SUN_LDOMS=y 205CONFIG_SUN_LDOMS=y
191CONFIG_PCI=y 206CONFIG_PCI=y
192CONFIG_PCI_DOMAINS=y 207CONFIG_PCI_DOMAINS=y
@@ -195,7 +210,9 @@ CONFIG_ARCH_SUPPORTS_MSI=y
195CONFIG_PCI_MSI=y 210CONFIG_PCI_MSI=y
196# CONFIG_PCI_LEGACY is not set 211# CONFIG_PCI_LEGACY is not set
197# CONFIG_PCI_DEBUG is not set 212# CONFIG_PCI_DEBUG is not set
213# CONFIG_PCCARD is not set
198CONFIG_SUN_OPENPROMFS=m 214CONFIG_SUN_OPENPROMFS=m
215CONFIG_SPARC64_PCI=y
199 216
200# 217#
201# Executable file formats 218# Executable file formats
@@ -207,17 +224,13 @@ CONFIG_COMPAT_BINFMT_ELF=y
207CONFIG_BINFMT_MISC=m 224CONFIG_BINFMT_MISC=m
208CONFIG_COMPAT=y 225CONFIG_COMPAT=y
209CONFIG_SYSVIPC_COMPAT=y 226CONFIG_SYSVIPC_COMPAT=y
210CONFIG_SCHED_SMT=y
211CONFIG_SCHED_MC=y
212# CONFIG_PREEMPT_NONE is not set
213CONFIG_PREEMPT_VOLUNTARY=y
214# CONFIG_PREEMPT is not set
215# CONFIG_CMDLINE_BOOL is not set
216CONFIG_NET=y 227CONFIG_NET=y
217 228
218# 229#
219# Networking options 230# Networking options
220# 231#
232# CONFIG_NET_NS is not set
233CONFIG_COMPAT_NET_DEV_OPS=y
221CONFIG_PACKET=y 234CONFIG_PACKET=y
222CONFIG_PACKET_MMAP=y 235CONFIG_PACKET_MMAP=y
223CONFIG_UNIX=y 236CONFIG_UNIX=y
@@ -314,6 +327,7 @@ CONFIG_VLAN_8021Q=m
314# CONFIG_ECONET is not set 327# CONFIG_ECONET is not set
315# CONFIG_WAN_ROUTER is not set 328# CONFIG_WAN_ROUTER is not set
316# CONFIG_NET_SCHED is not set 329# CONFIG_NET_SCHED is not set
330# CONFIG_DCB is not set
317 331
318# 332#
319# Network testing 333# Network testing
@@ -330,8 +344,8 @@ CONFIG_WIRELESS=y
330# CONFIG_CFG80211 is not set 344# CONFIG_CFG80211 is not set
331CONFIG_WIRELESS_OLD_REGULATORY=y 345CONFIG_WIRELESS_OLD_REGULATORY=y
332# CONFIG_WIRELESS_EXT is not set 346# CONFIG_WIRELESS_EXT is not set
347# CONFIG_LIB80211 is not set
333# CONFIG_MAC80211 is not set 348# CONFIG_MAC80211 is not set
334# CONFIG_IEEE80211 is not set
335# CONFIG_RFKILL is not set 349# CONFIG_RFKILL is not set
336# CONFIG_NET_9P is not set 350# CONFIG_NET_9P is not set
337 351
@@ -378,8 +392,10 @@ CONFIG_MISC_DEVICES=y
378# CONFIG_EEPROM_93CX6 is not set 392# CONFIG_EEPROM_93CX6 is not set
379# CONFIG_SGI_IOC4 is not set 393# CONFIG_SGI_IOC4 is not set
380# CONFIG_TIFM_CORE is not set 394# CONFIG_TIFM_CORE is not set
395# CONFIG_ICS932S401 is not set
381# CONFIG_ENCLOSURE_SERVICES is not set 396# CONFIG_ENCLOSURE_SERVICES is not set
382# CONFIG_HP_ILO is not set 397# CONFIG_HP_ILO is not set
398# CONFIG_C2PORT is not set
383CONFIG_HAVE_IDE=y 399CONFIG_HAVE_IDE=y
384CONFIG_IDE=y 400CONFIG_IDE=y
385 401
@@ -387,6 +403,7 @@ CONFIG_IDE=y
387# Please see Documentation/ide/ide.txt for help/info on IDE drives 403# Please see Documentation/ide/ide.txt for help/info on IDE drives
388# 404#
389CONFIG_IDE_TIMINGS=y 405CONFIG_IDE_TIMINGS=y
406CONFIG_IDE_ATAPI=y
390# CONFIG_BLK_DEV_IDE_SATA is not set 407# CONFIG_BLK_DEV_IDE_SATA is not set
391CONFIG_IDE_GD=y 408CONFIG_IDE_GD=y
392CONFIG_IDE_GD_ATA=y 409CONFIG_IDE_GD_ATA=y
@@ -394,7 +411,6 @@ CONFIG_IDE_GD_ATA=y
394CONFIG_BLK_DEV_IDECD=y 411CONFIG_BLK_DEV_IDECD=y
395CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y 412CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
396# CONFIG_BLK_DEV_IDETAPE is not set 413# CONFIG_BLK_DEV_IDETAPE is not set
397# CONFIG_BLK_DEV_IDESCSI is not set
398# CONFIG_IDE_TASK_IOCTL is not set 414# CONFIG_IDE_TASK_IOCTL is not set
399CONFIG_IDE_PROC_FS=y 415CONFIG_IDE_PROC_FS=y
400 416
@@ -477,6 +493,7 @@ CONFIG_SCSI_FC_ATTRS=y
477# CONFIG_SCSI_SRP_ATTRS is not set 493# CONFIG_SCSI_SRP_ATTRS is not set
478CONFIG_SCSI_LOWLEVEL=y 494CONFIG_SCSI_LOWLEVEL=y
479# CONFIG_ISCSI_TCP is not set 495# CONFIG_ISCSI_TCP is not set
496# CONFIG_SCSI_CXGB3_ISCSI is not set
480# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 497# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
481# CONFIG_SCSI_3W_9XXX is not set 498# CONFIG_SCSI_3W_9XXX is not set
482# CONFIG_SCSI_ACARD is not set 499# CONFIG_SCSI_ACARD is not set
@@ -490,6 +507,8 @@ CONFIG_SCSI_LOWLEVEL=y
490# CONFIG_MEGARAID_LEGACY is not set 507# CONFIG_MEGARAID_LEGACY is not set
491# CONFIG_MEGARAID_SAS is not set 508# CONFIG_MEGARAID_SAS is not set
492# CONFIG_SCSI_HPTIOP is not set 509# CONFIG_SCSI_HPTIOP is not set
510# CONFIG_LIBFC is not set
511# CONFIG_FCOE is not set
493# CONFIG_SCSI_DMX3191D is not set 512# CONFIG_SCSI_DMX3191D is not set
494# CONFIG_SCSI_FUTURE_DOMAIN is not set 513# CONFIG_SCSI_FUTURE_DOMAIN is not set
495# CONFIG_SCSI_IPS is not set 514# CONFIG_SCSI_IPS is not set
@@ -564,6 +583,9 @@ CONFIG_PHYLIB=m
564# CONFIG_BROADCOM_PHY is not set 583# CONFIG_BROADCOM_PHY is not set
565# CONFIG_ICPLUS_PHY is not set 584# CONFIG_ICPLUS_PHY is not set
566# CONFIG_REALTEK_PHY is not set 585# CONFIG_REALTEK_PHY is not set
586# CONFIG_NATIONAL_PHY is not set
587# CONFIG_STE10XP is not set
588# CONFIG_LSI_ET1011C_PHY is not set
567# CONFIG_MDIO_BITBANG is not set 589# CONFIG_MDIO_BITBANG is not set
568CONFIG_NET_ETHERNET=y 590CONFIG_NET_ETHERNET=y
569CONFIG_MII=m 591CONFIG_MII=m
@@ -590,7 +612,6 @@ CONFIG_NET_PCI=y
590# CONFIG_ADAPTEC_STARFIRE is not set 612# CONFIG_ADAPTEC_STARFIRE is not set
591# CONFIG_B44 is not set 613# CONFIG_B44 is not set
592# CONFIG_FORCEDETH is not set 614# CONFIG_FORCEDETH is not set
593# CONFIG_EEPRO100 is not set
594# CONFIG_E100 is not set 615# CONFIG_E100 is not set
595# CONFIG_FEALNX is not set 616# CONFIG_FEALNX is not set
596# CONFIG_NATSEMI is not set 617# CONFIG_NATSEMI is not set
@@ -600,6 +621,7 @@ CONFIG_NET_PCI=y
600# CONFIG_R6040 is not set 621# CONFIG_R6040 is not set
601# CONFIG_SIS900 is not set 622# CONFIG_SIS900 is not set
602# CONFIG_EPIC100 is not set 623# CONFIG_EPIC100 is not set
624# CONFIG_SMSC9420 is not set
603# CONFIG_SUNDANCE is not set 625# CONFIG_SUNDANCE is not set
604# CONFIG_TLAN is not set 626# CONFIG_TLAN is not set
605# CONFIG_VIA_RHINE is not set 627# CONFIG_VIA_RHINE is not set
@@ -629,6 +651,7 @@ CONFIG_BNX2=m
629# CONFIG_JME is not set 651# CONFIG_JME is not set
630CONFIG_NETDEV_10000=y 652CONFIG_NETDEV_10000=y
631# CONFIG_CHELSIO_T1 is not set 653# CONFIG_CHELSIO_T1 is not set
654CONFIG_CHELSIO_T3_DEPENDS=y
632# CONFIG_CHELSIO_T3 is not set 655# CONFIG_CHELSIO_T3 is not set
633# CONFIG_ENIC is not set 656# CONFIG_ENIC is not set
634# CONFIG_IXGBE is not set 657# CONFIG_IXGBE is not set
@@ -778,6 +801,7 @@ CONFIG_SERIAL_CORE=y
778CONFIG_SERIAL_CORE_CONSOLE=y 801CONFIG_SERIAL_CORE_CONSOLE=y
779# CONFIG_SERIAL_JSM is not set 802# CONFIG_SERIAL_JSM is not set
780CONFIG_UNIX98_PTYS=y 803CONFIG_UNIX98_PTYS=y
804# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
781# CONFIG_LEGACY_PTYS is not set 805# CONFIG_LEGACY_PTYS is not set
782# CONFIG_IPMI_HANDLER is not set 806# CONFIG_IPMI_HANDLER is not set
783CONFIG_HW_RANDOM=m 807CONFIG_HW_RANDOM=m
@@ -870,6 +894,7 @@ CONFIG_HWMON=y
870# CONFIG_SENSORS_ADM1029 is not set 894# CONFIG_SENSORS_ADM1029 is not set
871# CONFIG_SENSORS_ADM1031 is not set 895# CONFIG_SENSORS_ADM1031 is not set
872# CONFIG_SENSORS_ADM9240 is not set 896# CONFIG_SENSORS_ADM9240 is not set
897# CONFIG_SENSORS_ADT7462 is not set
873# CONFIG_SENSORS_ADT7470 is not set 898# CONFIG_SENSORS_ADT7470 is not set
874# CONFIG_SENSORS_ADT7473 is not set 899# CONFIG_SENSORS_ADT7473 is not set
875# CONFIG_SENSORS_ATXP1 is not set 900# CONFIG_SENSORS_ATXP1 is not set
@@ -919,11 +944,11 @@ CONFIG_HWMON=y
919# CONFIG_THERMAL is not set 944# CONFIG_THERMAL is not set
920# CONFIG_THERMAL_HWMON is not set 945# CONFIG_THERMAL_HWMON is not set
921# CONFIG_WATCHDOG is not set 946# CONFIG_WATCHDOG is not set
947CONFIG_SSB_POSSIBLE=y
922 948
923# 949#
924# Sonics Silicon Backplane 950# Sonics Silicon Backplane
925# 951#
926CONFIG_SSB_POSSIBLE=y
927# CONFIG_SSB is not set 952# CONFIG_SSB is not set
928 953
929# 954#
@@ -1071,6 +1096,7 @@ CONFIG_SND_MIXER_OSS=m
1071CONFIG_SND_PCM_OSS=m 1096CONFIG_SND_PCM_OSS=m
1072CONFIG_SND_PCM_OSS_PLUGINS=y 1097CONFIG_SND_PCM_OSS_PLUGINS=y
1073CONFIG_SND_SEQUENCER_OSS=y 1098CONFIG_SND_SEQUENCER_OSS=y
1099# CONFIG_SND_HRTIMER is not set
1074# CONFIG_SND_DYNAMIC_MINORS is not set 1100# CONFIG_SND_DYNAMIC_MINORS is not set
1075CONFIG_SND_SUPPORT_OLD_API=y 1101CONFIG_SND_SUPPORT_OLD_API=y
1076CONFIG_SND_VERBOSE_PROCFS=y 1102CONFIG_SND_VERBOSE_PROCFS=y
@@ -1242,11 +1268,11 @@ CONFIG_USB_UHCI_HCD=m
1242# CONFIG_USB_TMC is not set 1268# CONFIG_USB_TMC is not set
1243 1269
1244# 1270#
1245# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1271# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
1246# 1272#
1247 1273
1248# 1274#
1249# may also be needed; see USB_STORAGE Help for more information 1275# see USB_STORAGE Help for more information
1250# 1276#
1251CONFIG_USB_STORAGE=m 1277CONFIG_USB_STORAGE=m
1252# CONFIG_USB_STORAGE_DEBUG is not set 1278# CONFIG_USB_STORAGE_DEBUG is not set
@@ -1337,6 +1363,7 @@ CONFIG_RTC_INTF_DEV=y
1337# CONFIG_RTC_DRV_M41T80 is not set 1363# CONFIG_RTC_DRV_M41T80 is not set
1338# CONFIG_RTC_DRV_S35390A is not set 1364# CONFIG_RTC_DRV_S35390A is not set
1339# CONFIG_RTC_DRV_FM3130 is not set 1365# CONFIG_RTC_DRV_FM3130 is not set
1366# CONFIG_RTC_DRV_RX8581 is not set
1340 1367
1341# 1368#
1342# SPI RTC drivers 1369# SPI RTC drivers
@@ -1365,7 +1392,6 @@ CONFIG_RTC_DRV_STARFIRE=y
1365# CONFIG_DMADEVICES is not set 1392# CONFIG_DMADEVICES is not set
1366# CONFIG_UIO is not set 1393# CONFIG_UIO is not set
1367# CONFIG_STAGING is not set 1394# CONFIG_STAGING is not set
1368CONFIG_STAGING_EXCLUDE_BUILD=y
1369 1395
1370# 1396#
1371# Misc Linux/SPARC drivers 1397# Misc Linux/SPARC drivers
@@ -1544,6 +1570,7 @@ CONFIG_SCHEDSTATS=y
1544# CONFIG_LOCK_STAT is not set 1570# CONFIG_LOCK_STAT is not set
1545# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1571# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1546# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1572# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1573CONFIG_STACKTRACE=y
1547# CONFIG_DEBUG_KOBJECT is not set 1574# CONFIG_DEBUG_KOBJECT is not set
1548CONFIG_DEBUG_BUGVERBOSE=y 1575CONFIG_DEBUG_BUGVERBOSE=y
1549# CONFIG_DEBUG_INFO is not set 1576# CONFIG_DEBUG_INFO is not set
@@ -1552,6 +1579,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
1552CONFIG_DEBUG_MEMORY_INIT=y 1579CONFIG_DEBUG_MEMORY_INIT=y
1553# CONFIG_DEBUG_LIST is not set 1580# CONFIG_DEBUG_LIST is not set
1554# CONFIG_DEBUG_SG is not set 1581# CONFIG_DEBUG_SG is not set
1582# CONFIG_DEBUG_NOTIFIERS is not set
1555# CONFIG_BOOT_PRINTK_DELAY is not set 1583# CONFIG_BOOT_PRINTK_DELAY is not set
1556# CONFIG_RCU_TORTURE_TEST is not set 1584# CONFIG_RCU_TORTURE_TEST is not set
1557# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1585# CONFIG_RCU_CPU_STALL_DETECTOR is not set
@@ -1560,8 +1588,12 @@ CONFIG_DEBUG_MEMORY_INIT=y
1560# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set 1588# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1561# CONFIG_LKDTM is not set 1589# CONFIG_LKDTM is not set
1562# CONFIG_FAULT_INJECTION is not set 1590# CONFIG_FAULT_INJECTION is not set
1591# CONFIG_LATENCYTOP is not set
1563CONFIG_SYSCTL_SYSCALL_CHECK=y 1592CONFIG_SYSCTL_SYSCALL_CHECK=y
1593CONFIG_NOP_TRACER=y
1564CONFIG_HAVE_FUNCTION_TRACER=y 1594CONFIG_HAVE_FUNCTION_TRACER=y
1595CONFIG_RING_BUFFER=y
1596CONFIG_TRACING=y
1565 1597
1566# 1598#
1567# Tracers 1599# Tracers
@@ -1571,7 +1603,9 @@ CONFIG_HAVE_FUNCTION_TRACER=y
1571# CONFIG_SCHED_TRACER is not set 1603# CONFIG_SCHED_TRACER is not set
1572# CONFIG_CONTEXT_SWITCH_TRACER is not set 1604# CONFIG_CONTEXT_SWITCH_TRACER is not set
1573# CONFIG_BOOT_TRACER is not set 1605# CONFIG_BOOT_TRACER is not set
1606# CONFIG_TRACE_BRANCH_PROFILING is not set
1574# CONFIG_STACK_TRACER is not set 1607# CONFIG_STACK_TRACER is not set
1608# CONFIG_FTRACE_STARTUP_TEST is not set
1575# CONFIG_DYNAMIC_PRINTK_DEBUG is not set 1609# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1576# CONFIG_SAMPLES is not set 1610# CONFIG_SAMPLES is not set
1577CONFIG_HAVE_ARCH_KGDB=y 1611CONFIG_HAVE_ARCH_KGDB=y
@@ -1600,11 +1634,16 @@ CONFIG_CRYPTO=y
1600# 1634#
1601# CONFIG_CRYPTO_FIPS is not set 1635# CONFIG_CRYPTO_FIPS is not set
1602CONFIG_CRYPTO_ALGAPI=y 1636CONFIG_CRYPTO_ALGAPI=y
1637CONFIG_CRYPTO_ALGAPI2=y
1603CONFIG_CRYPTO_AEAD=y 1638CONFIG_CRYPTO_AEAD=y
1639CONFIG_CRYPTO_AEAD2=y
1604CONFIG_CRYPTO_BLKCIPHER=y 1640CONFIG_CRYPTO_BLKCIPHER=y
1641CONFIG_CRYPTO_BLKCIPHER2=y
1605CONFIG_CRYPTO_HASH=y 1642CONFIG_CRYPTO_HASH=y
1606CONFIG_CRYPTO_RNG=y 1643CONFIG_CRYPTO_HASH2=y
1644CONFIG_CRYPTO_RNG2=y
1607CONFIG_CRYPTO_MANAGER=y 1645CONFIG_CRYPTO_MANAGER=y
1646CONFIG_CRYPTO_MANAGER2=y
1608CONFIG_CRYPTO_GF128MUL=m 1647CONFIG_CRYPTO_GF128MUL=m
1609CONFIG_CRYPTO_NULL=m 1648CONFIG_CRYPTO_NULL=m
1610# CONFIG_CRYPTO_CRYPTD is not set 1649# CONFIG_CRYPTO_CRYPTD is not set
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index 2d2769d766ec..deeb0fba8029 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -1,23 +1,6 @@
1# User exported sparc header files 1# User exported sparc header files
2include include/asm-generic/Kbuild.asm 2include include/asm-generic/Kbuild.asm
3 3
4header-y += ipcbuf_32.h
5header-y += ipcbuf_64.h
6header-y += posix_types_32.h
7header-y += posix_types_64.h
8header-y += ptrace_32.h
9header-y += ptrace_64.h
10header-y += sigcontext_32.h
11header-y += sigcontext_64.h
12header-y += siginfo_32.h
13header-y += siginfo_64.h
14header-y += signal_32.h
15header-y += signal_64.h
16header-y += stat_32.h
17header-y += stat_64.h
18header-y += unistd_32.h
19header-y += unistd_64.h
20
21header-y += apc.h 4header-y += apc.h
22header-y += asi.h 5header-y += asi.h
23header-y += display7seg.h 6header-y += display7seg.h
@@ -25,16 +8,11 @@ header-y += envctrl.h
25header-y += fbio.h 8header-y += fbio.h
26header-y += jsflash.h 9header-y += jsflash.h
27header-y += openprom.h 10header-y += openprom.h
28header-y += openprom_32.h
29header-y += openprom_64.h
30header-y += openpromio.h 11header-y += openpromio.h
31header-y += perfctr.h 12header-y += perfctr.h
32header-y += psrcompat.h 13header-y += psrcompat.h
33header-y += psr.h 14header-y += psr.h
34header-y += pstate.h 15header-y += pstate.h
35header-y += reg.h
36header-y += reg_32.h
37header-y += reg_64.h
38header-y += traps.h 16header-y += traps.h
39header-y += uctx.h 17header-y += uctx.h
40header-y += utrap.h 18header-y += utrap.h
diff --git a/arch/sparc/include/asm/asm.h b/arch/sparc/include/asm/asm.h
new file mode 100644
index 000000000000..e8e1d94b4cc9
--- /dev/null
+++ b/arch/sparc/include/asm/asm.h
@@ -0,0 +1,40 @@
1#ifndef _SPARC_ASM_H
2#define _SPARC_ASM_H
3
4/* Macros to assist the sharing of assembler code between 32-bit and
5 * 64-bit sparc.
6 */
7
8#ifdef CONFIG_SPARC64
9#define BRANCH32(TYPE, PREDICT, DEST) \
10 TYPE,PREDICT %icc, DEST
11#define BRANCH32_ANNUL(TYPE, PREDICT, DEST) \
12 TYPE,a,PREDICT %icc, DEST
13#define BRANCH_REG_ZERO(PREDICT, REG, DEST) \
14 brz,PREDICT REG, DEST
15#define BRANCH_REG_ZERO_ANNUL(PREDICT, REG, DEST) \
16 brz,a,PREDICT REG, DEST
17#define BRANCH_REG_NOT_ZERO(PREDICT, REG, DEST) \
18 brnz,PREDICT REG, DEST
19#define BRANCH_REG_NOT_ZERO_ANNUL(PREDICT, REG, DEST) \
20 brnz,a,PREDICT REG, DEST
21#else
22#define BRANCH32(TYPE, PREDICT, DEST) \
23 TYPE DEST
24#define BRANCH32_ANNUL(TYPE, PREDICT, DEST) \
25 TYPE,a DEST
26#define BRANCH_REG_ZERO(PREDICT, REG, DEST) \
27 cmp REG, 0; \
28 be DEST
29#define BRANCH_REG_ZERO_ANNUL(PREDICT, REG, DEST) \
30 cmp REG, 0; \
31 be,a DEST
32#define BRANCH_REG_NOT_ZERO(PREDICT, REG, DEST) \
33 cmp REG, 0; \
34 bne DEST
35#define BRANCH_REG_NOT_ZERO_ANNUL(PREDICT, REG, DEST) \
36 cmp REG, 0; \
37 bne,a DEST
38#endif
39
40#endif /* _SPARC_ASM_H */
diff --git a/arch/sparc/include/asm/atomic_32.h b/arch/sparc/include/asm/atomic_32.h
index 5c944b5a8040..ce465975a6a5 100644
--- a/arch/sparc/include/asm/atomic_32.h
+++ b/arch/sparc/include/asm/atomic_32.h
@@ -13,8 +13,6 @@
13 13
14#include <linux/types.h> 14#include <linux/types.h>
15 15
16typedef struct { volatile int counter; } atomic_t;
17
18#ifdef __KERNEL__ 16#ifdef __KERNEL__
19 17
20#define ATOMIC_INIT(i) { (i) } 18#define ATOMIC_INIT(i) { (i) }
diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h
index 2c71ec4a3b18..a0a706492696 100644
--- a/arch/sparc/include/asm/atomic_64.h
+++ b/arch/sparc/include/asm/atomic_64.h
@@ -10,9 +10,6 @@
10#include <linux/types.h> 10#include <linux/types.h>
11#include <asm/system.h> 11#include <asm/system.h>
12 12
13typedef struct { volatile int counter; } atomic_t;
14typedef struct { volatile __s64 counter; } atomic64_t;
15
16#define ATOMIC_INIT(i) { (i) } 13#define ATOMIC_INIT(i) { (i) }
17#define ATOMIC64_INIT(i) { (i) } 14#define ATOMIC64_INIT(i) { (i) }
18 15
@@ -112,17 +109,10 @@ static inline int atomic64_add_unless(atomic64_t *v, long a, long u)
112#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) 109#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
113 110
114/* Atomic operations are already serializing */ 111/* Atomic operations are already serializing */
115#ifdef CONFIG_SMP
116#define smp_mb__before_atomic_dec() membar_storeload_loadload();
117#define smp_mb__after_atomic_dec() membar_storeload_storestore();
118#define smp_mb__before_atomic_inc() membar_storeload_loadload();
119#define smp_mb__after_atomic_inc() membar_storeload_storestore();
120#else
121#define smp_mb__before_atomic_dec() barrier() 112#define smp_mb__before_atomic_dec() barrier()
122#define smp_mb__after_atomic_dec() barrier() 113#define smp_mb__after_atomic_dec() barrier()
123#define smp_mb__before_atomic_inc() barrier() 114#define smp_mb__before_atomic_inc() barrier()
124#define smp_mb__after_atomic_inc() barrier() 115#define smp_mb__after_atomic_inc() barrier()
125#endif
126 116
127#include <asm-generic/atomic.h> 117#include <asm-generic/atomic.h>
128#endif /* !(__ARCH_SPARC64_ATOMIC__) */ 118#endif /* !(__ARCH_SPARC64_ATOMIC__) */
diff --git a/arch/sparc/include/asm/bitops_64.h b/arch/sparc/include/asm/bitops_64.h
index bb87b8080220..e72ac9cdfb98 100644
--- a/arch/sparc/include/asm/bitops_64.h
+++ b/arch/sparc/include/asm/bitops_64.h
@@ -23,13 +23,8 @@ extern void change_bit(unsigned long nr, volatile unsigned long *addr);
23 23
24#include <asm-generic/bitops/non-atomic.h> 24#include <asm-generic/bitops/non-atomic.h>
25 25
26#ifdef CONFIG_SMP
27#define smp_mb__before_clear_bit() membar_storeload_loadload()
28#define smp_mb__after_clear_bit() membar_storeload_storestore()
29#else
30#define smp_mb__before_clear_bit() barrier() 26#define smp_mb__before_clear_bit() barrier()
31#define smp_mb__after_clear_bit() barrier() 27#define smp_mb__after_clear_bit() barrier()
32#endif
33 28
34#include <asm-generic/bitops/ffz.h> 29#include <asm-generic/bitops/ffz.h>
35#include <asm-generic/bitops/__ffs.h> 30#include <asm-generic/bitops/__ffs.h>
diff --git a/arch/sparc/include/asm/byteorder.h b/arch/sparc/include/asm/byteorder.h
index 5a70f137f1f7..738414b26558 100644
--- a/arch/sparc/include/asm/byteorder.h
+++ b/arch/sparc/include/asm/byteorder.h
@@ -1,16 +1,12 @@
1#ifndef _SPARC_BYTEORDER_H 1#ifndef _SPARC_BYTEORDER_H
2#define _SPARC_BYTEORDER_H 2#define _SPARC_BYTEORDER_H
3 3
4#include <asm/types.h> 4#include <linux/types.h>
5#include <asm/asi.h> 5#include <asm/asi.h>
6 6
7#define __BIG_ENDIAN 7#define __BIG_ENDIAN
8 8
9#ifdef CONFIG_SPARC32 9#if defined(__sparc__) && defined(__arch64__)
10#define __SWAB_64_THRU_32__
11#endif
12
13#ifdef CONFIG_SPARC64
14static inline __u16 __arch_swab16p(const __u16 *addr) 10static inline __u16 __arch_swab16p(const __u16 *addr)
15{ 11{
16 __u16 ret; 12 __u16 ret;
@@ -44,7 +40,9 @@ static inline __u64 __arch_swab64p(const __u64 *addr)
44} 40}
45#define __arch_swab64p __arch_swab64p 41#define __arch_swab64p __arch_swab64p
46 42
47#endif /* CONFIG_SPARC64 */ 43#else
44#define __SWAB_64_THRU_32__
45#endif /* defined(__sparc__) && defined(__arch64__) */
48 46
49#include <linux/byteorder.h> 47#include <linux/byteorder.h>
50 48
diff --git a/arch/sparc/include/asm/device.h b/arch/sparc/include/asm/device.h
index 19790eb99cc6..3702e087df2c 100644
--- a/arch/sparc/include/asm/device.h
+++ b/arch/sparc/include/asm/device.h
@@ -20,4 +20,16 @@ struct dev_archdata {
20 int numa_node; 20 int numa_node;
21}; 21};
22 22
23static inline void dev_archdata_set_node(struct dev_archdata *ad,
24 struct device_node *np)
25{
26 ad->prom_node = np;
27}
28
29static inline struct device_node *
30dev_archdata_get_node(const struct dev_archdata *ad)
31{
32 return ad->prom_node;
33}
34
23#endif /* _ASM_SPARC_DEVICE_H */ 35#endif /* _ASM_SPARC_DEVICE_H */
diff --git a/arch/sparc/include/asm/hypervisor.h b/arch/sparc/include/asm/hypervisor.h
index 109ae24ba242..bafe5a631b6d 100644
--- a/arch/sparc/include/asm/hypervisor.h
+++ b/arch/sparc/include/asm/hypervisor.h
@@ -2713,6 +2713,30 @@ extern unsigned long sun4v_ldc_revoke(unsigned long channel,
2713 */ 2713 */
2714#define HV_FAST_SET_PERFREG 0x101 2714#define HV_FAST_SET_PERFREG 0x101
2715 2715
2716#define HV_N2_PERF_SPARC_CTL 0x0
2717#define HV_N2_PERF_DRAM_CTL0 0x1
2718#define HV_N2_PERF_DRAM_CNT0 0x2
2719#define HV_N2_PERF_DRAM_CTL1 0x3
2720#define HV_N2_PERF_DRAM_CNT1 0x4
2721#define HV_N2_PERF_DRAM_CTL2 0x5
2722#define HV_N2_PERF_DRAM_CNT2 0x6
2723#define HV_N2_PERF_DRAM_CTL3 0x7
2724#define HV_N2_PERF_DRAM_CNT3 0x8
2725
2726#define HV_FAST_N2_GET_PERFREG 0x104
2727#define HV_FAST_N2_SET_PERFREG 0x105
2728
2729#ifndef __ASSEMBLY__
2730extern unsigned long sun4v_niagara_getperf(unsigned long reg,
2731 unsigned long *val);
2732extern unsigned long sun4v_niagara_setperf(unsigned long reg,
2733 unsigned long val);
2734extern unsigned long sun4v_niagara2_getperf(unsigned long reg,
2735 unsigned long *val);
2736extern unsigned long sun4v_niagara2_setperf(unsigned long reg,
2737 unsigned long val);
2738#endif
2739
2716/* MMU statistics services. 2740/* MMU statistics services.
2717 * 2741 *
2718 * The hypervisor maintains MMU statistics and privileged code provides 2742 * The hypervisor maintains MMU statistics and privileged code provides
diff --git a/arch/sparc/include/asm/ipcbuf.h b/arch/sparc/include/asm/ipcbuf.h
index 17d6ef7b23a4..66013b4fe10d 100644
--- a/arch/sparc/include/asm/ipcbuf.h
+++ b/arch/sparc/include/asm/ipcbuf.h
@@ -1,8 +1,32 @@
1#ifndef ___ASM_SPARC_IPCBUF_H 1#ifndef __SPARC_IPCBUF_H
2#define ___ASM_SPARC_IPCBUF_H 2#define __SPARC_IPCBUF_H
3#if defined(__sparc__) && defined(__arch64__) 3
4#include <asm/ipcbuf_64.h> 4/*
5#else 5 * The ipc64_perm structure for sparc/sparc64 architecture.
6#include <asm/ipcbuf_32.h> 6 * Note extra padding because this structure is passed back and forth
7#endif 7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit seq
11 * - on sparc for 32 bit mode (it is 32 bit on sparc64)
12 * - 2 miscellaneous 64-bit values
13 */
14
15struct ipc64_perm
16{
17 __kernel_key_t key;
18 __kernel_uid_t uid;
19 __kernel_gid_t gid;
20 __kernel_uid_t cuid;
21 __kernel_gid_t cgid;
22#ifndef __arch64__
23 unsigned short __pad0;
8#endif 24#endif
25 __kernel_mode_t mode;
26 unsigned short __pad1;
27 unsigned short seq;
28 unsigned long long __unused1;
29 unsigned long long __unused2;
30};
31
32#endif /* __SPARC_IPCBUF_H */
diff --git a/arch/sparc/include/asm/ipcbuf_32.h b/arch/sparc/include/asm/ipcbuf_32.h
deleted file mode 100644
index 6387209518f2..000000000000
--- a/arch/sparc/include/asm/ipcbuf_32.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef _SPARC_IPCBUF_H
2#define _SPARC_IPCBUF_H
3
4/*
5 * The ipc64_perm structure for sparc architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit mode
11 * - 32-bit seq
12 * - 2 miscellaneous 64-bit values (so that this structure matches
13 * sparc64 ipc64_perm)
14 */
15
16struct ipc64_perm
17{
18 __kernel_key_t key;
19 __kernel_uid32_t uid;
20 __kernel_gid32_t gid;
21 __kernel_uid32_t cuid;
22 __kernel_gid32_t cgid;
23 unsigned short __pad1;
24 __kernel_mode_t mode;
25 unsigned short __pad2;
26 unsigned short seq;
27 unsigned long long __unused1;
28 unsigned long long __unused2;
29};
30
31#endif /* _SPARC_IPCBUF_H */
diff --git a/arch/sparc/include/asm/ipcbuf_64.h b/arch/sparc/include/asm/ipcbuf_64.h
deleted file mode 100644
index a44b855b98db..000000000000
--- a/arch/sparc/include/asm/ipcbuf_64.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef _SPARC64_IPCBUF_H
2#define _SPARC64_IPCBUF_H
3
4/*
5 * The ipc64_perm structure for sparc64 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit seq
11 * - 2 miscellaneous 64-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid_t uid;
18 __kernel_gid_t gid;
19 __kernel_uid_t cuid;
20 __kernel_gid_t cgid;
21 __kernel_mode_t mode;
22 unsigned short __pad1;
23 unsigned short seq;
24 unsigned long __unused1;
25 unsigned long __unused2;
26};
27
28#endif /* _SPARC64_IPCBUF_H */
diff --git a/arch/sparc/include/asm/irq_32.h b/arch/sparc/include/asm/irq_32.h
index fe205cc444b8..ea43057d4763 100644
--- a/arch/sparc/include/asm/irq_32.h
+++ b/arch/sparc/include/asm/irq_32.h
@@ -12,4 +12,5 @@
12 12
13#define irq_canonicalize(irq) (irq) 13#define irq_canonicalize(irq) (irq)
14 14
15extern void __init init_IRQ(void);
15#endif 16#endif
diff --git a/arch/sparc/include/asm/irq_64.h b/arch/sparc/include/asm/irq_64.h
index 71673eca3660..d47d4a1955a9 100644
--- a/arch/sparc/include/asm/irq_64.h
+++ b/arch/sparc/include/asm/irq_64.h
@@ -66,6 +66,9 @@ extern void virt_irq_free(unsigned int virt_irq);
66extern void __init init_IRQ(void); 66extern void __init init_IRQ(void);
67extern void fixup_irqs(void); 67extern void fixup_irqs(void);
68 68
69extern int register_perfctr_intr(void (*handler)(struct pt_regs *));
70extern void release_perfctr_intr(void (*handler)(struct pt_regs *));
71
69static inline void set_softint(unsigned long bits) 72static inline void set_softint(unsigned long bits)
70{ 73{
71 __asm__ __volatile__("wr %0, 0x0, %%set_softint" 74 __asm__ __volatile__("wr %0, 0x0, %%set_softint"
diff --git a/arch/sparc/include/asm/irqflags_64.h b/arch/sparc/include/asm/irqflags_64.h
index bb42e59162aa..8b49bf920df3 100644
--- a/arch/sparc/include/asm/irqflags_64.h
+++ b/arch/sparc/include/asm/irqflags_64.h
@@ -10,6 +10,8 @@
10#ifndef _ASM_IRQFLAGS_H 10#ifndef _ASM_IRQFLAGS_H
11#define _ASM_IRQFLAGS_H 11#define _ASM_IRQFLAGS_H
12 12
13#include <asm/pil.h>
14
13#ifndef __ASSEMBLY__ 15#ifndef __ASSEMBLY__
14 16
15static inline unsigned long __raw_local_save_flags(void) 17static inline unsigned long __raw_local_save_flags(void)
@@ -40,9 +42,9 @@ static inline void raw_local_irq_restore(unsigned long flags)
40static inline void raw_local_irq_disable(void) 42static inline void raw_local_irq_disable(void)
41{ 43{
42 __asm__ __volatile__( 44 __asm__ __volatile__(
43 "wrpr 15, %%pil" 45 "wrpr %0, %%pil"
44 : /* no outputs */ 46 : /* no outputs */
45 : /* no inputs */ 47 : "i" (PIL_NORMAL_MAX)
46 : "memory" 48 : "memory"
47 ); 49 );
48} 50}
diff --git a/arch/sparc/include/asm/jsflash.h b/arch/sparc/include/asm/jsflash.h
index 3457f29bd73b..0717d9e39d2d 100644
--- a/arch/sparc/include/asm/jsflash.h
+++ b/arch/sparc/include/asm/jsflash.h
@@ -8,7 +8,7 @@
8#define _SPARC_JSFLASH_H 8#define _SPARC_JSFLASH_H
9 9
10#ifndef _SPARC_TYPES_H 10#ifndef _SPARC_TYPES_H
11#include <asm/types.h> 11#include <linux/types.h>
12#endif 12#endif
13 13
14/* 14/*
diff --git a/arch/sparc/include/asm/module.h b/arch/sparc/include/asm/module.h
index e82cf9a3e60e..ff8e02d80334 100644
--- a/arch/sparc/include/asm/module.h
+++ b/arch/sparc/include/asm/module.h
@@ -1,8 +1,24 @@
1#ifndef ___ASM_SPARC_MODULE_H 1#ifndef __SPARC_MODULE_H
2#define ___ASM_SPARC_MODULE_H 2#define __SPARC_MODULE_H
3#if defined(__sparc__) && defined(__arch64__) 3struct mod_arch_specific { };
4#include <asm/module_64.h> 4
5#else 5/*
6#include <asm/module_32.h> 6 * Use some preprocessor magic to define the correct symbol
7#endif 7 * for sparc32 and sparc64.
8#endif 8 * Elf_Addr becomes Elf32_Addr for sparc32 and Elf64_Addr for sparc64
9 */
10#define ___ELF(a, b, c) a##b##c
11#define __ELF(a, b, c) ___ELF(a, b, c)
12#define _Elf(t) __ELF(Elf, CONFIG_BITS, t)
13#define _ELF(t) __ELF(ELF, CONFIG_BITS, t)
14
15#define Elf_Shdr _Elf(_Shdr)
16#define Elf_Sym _Elf(_Sym)
17#define Elf_Ehdr _Elf(_Ehdr)
18#define Elf_Rela _Elf(_Rela)
19#define Elf_Addr _Elf(_Addr)
20
21#define ELF_R_SYM _ELF(_R_SYM)
22#define ELF_R_TYPE _ELF(_R_TYPE)
23
24#endif /* __SPARC_MODULE_H */
diff --git a/arch/sparc/include/asm/module_32.h b/arch/sparc/include/asm/module_32.h
deleted file mode 100644
index cbd9e67b0c0b..000000000000
--- a/arch/sparc/include/asm/module_32.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _ASM_SPARC_MODULE_H
2#define _ASM_SPARC_MODULE_H
3struct mod_arch_specific { };
4#define Elf_Shdr Elf32_Shdr
5#define Elf_Sym Elf32_Sym
6#define Elf_Ehdr Elf32_Ehdr
7#endif /* _ASM_SPARC_MODULE_H */
diff --git a/arch/sparc/include/asm/module_64.h b/arch/sparc/include/asm/module_64.h
deleted file mode 100644
index 3d77ba465783..000000000000
--- a/arch/sparc/include/asm/module_64.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _ASM_SPARC64_MODULE_H
2#define _ASM_SPARC64_MODULE_H
3struct mod_arch_specific { };
4#define Elf_Shdr Elf64_Shdr
5#define Elf_Sym Elf64_Sym
6#define Elf_Ehdr Elf64_Ehdr
7#endif /* _ASM_SPARC64_MODULE_H */
diff --git a/arch/sparc/include/asm/openprom.h b/arch/sparc/include/asm/openprom.h
index aaeae905ed3f..963e1a45c35f 100644
--- a/arch/sparc/include/asm/openprom.h
+++ b/arch/sparc/include/asm/openprom.h
@@ -1,8 +1,277 @@
1#ifndef ___ASM_SPARC_OPENPROM_H 1#ifndef __SPARC_OPENPROM_H
2#define ___ASM_SPARC_OPENPROM_H 2#define __SPARC_OPENPROM_H
3
4/* openprom.h: Prom structures and defines for access to the OPENBOOT
5 * prom routines and data areas.
6 *
7 * Copyright (C) 1995,1996 David S. Miller (davem@caip.rutgers.edu)
8 */
9
10/* Empirical constants... */
11#define LINUX_OPPROM_MAGIC 0x10010407
12
13#ifndef __ASSEMBLY__
14/* V0 prom device operations. */
15struct linux_dev_v0_funcs {
16 int (*v0_devopen)(char *device_str);
17 int (*v0_devclose)(int dev_desc);
18 int (*v0_rdblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
19 int (*v0_wrblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
20 int (*v0_wrnetdev)(int dev_desc, int num_bytes, char *buf);
21 int (*v0_rdnetdev)(int dev_desc, int num_bytes, char *buf);
22 int (*v0_rdchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
23 int (*v0_wrchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
24 int (*v0_seekdev)(int dev_desc, long logical_offst, int from);
25};
26
27/* V2 and later prom device operations. */
28struct linux_dev_v2_funcs {
29 int (*v2_inst2pkg)(int d); /* Convert ihandle to phandle */
30 char * (*v2_dumb_mem_alloc)(char *va, unsigned sz);
31 void (*v2_dumb_mem_free)(char *va, unsigned sz);
32
33 /* To map devices into virtual I/O space. */
34 char * (*v2_dumb_mmap)(char *virta, int which_io, unsigned paddr, unsigned sz);
35 void (*v2_dumb_munmap)(char *virta, unsigned size);
36
37 int (*v2_dev_open)(char *devpath);
38 void (*v2_dev_close)(int d);
39 int (*v2_dev_read)(int d, char *buf, int nbytes);
40 int (*v2_dev_write)(int d, char *buf, int nbytes);
41 int (*v2_dev_seek)(int d, int hi, int lo);
42
43 /* Never issued (multistage load support) */
44 void (*v2_wheee2)(void);
45 void (*v2_wheee3)(void);
46};
47
48struct linux_mlist_v0 {
49 struct linux_mlist_v0 *theres_more;
50 unsigned int start_adr;
51 unsigned num_bytes;
52};
53
54struct linux_mem_v0 {
55 struct linux_mlist_v0 **v0_totphys;
56 struct linux_mlist_v0 **v0_prommap;
57 struct linux_mlist_v0 **v0_available; /* What we can use */
58};
59
60/* Arguments sent to the kernel from the boot prompt. */
61struct linux_arguments_v0 {
62 char *argv[8];
63 char args[100];
64 char boot_dev[2];
65 int boot_dev_ctrl;
66 int boot_dev_unit;
67 int dev_partition;
68 char *kernel_file_name;
69 void *aieee1; /* XXX */
70};
71
72/* V2 and up boot things. */
73struct linux_bootargs_v2 {
74 char **bootpath;
75 char **bootargs;
76 int *fd_stdin;
77 int *fd_stdout;
78};
79
80/* The top level PROM vector. */
81struct linux_romvec {
82 /* Version numbers. */
83 unsigned int pv_magic_cookie;
84 unsigned int pv_romvers;
85 unsigned int pv_plugin_revision;
86 unsigned int pv_printrev;
87
88 /* Version 0 memory descriptors. */
89 struct linux_mem_v0 pv_v0mem;
90
91 /* Node operations. */
92 struct linux_nodeops *pv_nodeops;
93
94 char **pv_bootstr;
95 struct linux_dev_v0_funcs pv_v0devops;
96
97 char *pv_stdin;
98 char *pv_stdout;
99#define PROMDEV_KBD 0 /* input from keyboard */
100#define PROMDEV_SCREEN 0 /* output to screen */
101#define PROMDEV_TTYA 1 /* in/out to ttya */
102#define PROMDEV_TTYB 2 /* in/out to ttyb */
103
104 /* Blocking getchar/putchar. NOT REENTRANT! (grr) */
105 int (*pv_getchar)(void);
106 void (*pv_putchar)(int ch);
107
108 /* Non-blocking variants. */
109 int (*pv_nbgetchar)(void);
110 int (*pv_nbputchar)(int ch);
111
112 void (*pv_putstr)(char *str, int len);
113
114 /* Miscellany. */
115 void (*pv_reboot)(char *bootstr);
116 void (*pv_printf)(__const__ char *fmt, ...);
117 void (*pv_abort)(void);
118 __volatile__ int *pv_ticks;
119 void (*pv_halt)(void);
120 void (**pv_synchook)(void);
121
122 /* Evaluate a forth string, not different proto for V0 and V2->up. */
123 union {
124 void (*v0_eval)(int len, char *str);
125 void (*v2_eval)(char *str);
126 } pv_fortheval;
127
128 struct linux_arguments_v0 **pv_v0bootargs;
129
130 /* Get ether address. */
131 unsigned int (*pv_enaddr)(int d, char *enaddr);
132
133 struct linux_bootargs_v2 pv_v2bootargs;
134 struct linux_dev_v2_funcs pv_v2devops;
135
136 int filler[15];
137
138 /* This one is sun4c/sun4 only. */
139 void (*pv_setctxt)(int ctxt, char *va, int pmeg);
140
141 /* Prom version 3 Multiprocessor routines. This stuff is crazy.
142 * No joke. Calling these when there is only one cpu probably
143 * crashes the machine, have to test this. :-)
144 */
145
146 /* v3_cpustart() will start the cpu 'whichcpu' in mmu-context
147 * 'thiscontext' executing at address 'prog_counter'
148 */
149 int (*v3_cpustart)(unsigned int whichcpu, int ctxtbl_ptr,
150 int thiscontext, char *prog_counter);
151
152 /* v3_cpustop() will cause cpu 'whichcpu' to stop executing
153 * until a resume cpu call is made.
154 */
155 int (*v3_cpustop)(unsigned int whichcpu);
156
157 /* v3_cpuidle() will idle cpu 'whichcpu' until a stop or
158 * resume cpu call is made.
159 */
160 int (*v3_cpuidle)(unsigned int whichcpu);
161
162 /* v3_cpuresume() will resume processor 'whichcpu' executing
163 * starting with whatever 'pc' and 'npc' were left at the
164 * last 'idle' or 'stop' call.
165 */
166 int (*v3_cpuresume)(unsigned int whichcpu);
167};
168
169/* Routines for traversing the prom device tree. */
170struct linux_nodeops {
171 int (*no_nextnode)(int node);
172 int (*no_child)(int node);
173 int (*no_proplen)(int node, const char *name);
174 int (*no_getprop)(int node, const char *name, char *val);
175 int (*no_setprop)(int node, const char *name, char *val, int len);
176 char * (*no_nextprop)(int node, char *name);
177};
178
179/* More fun PROM structures for device probing. */
3#if defined(__sparc__) && defined(__arch64__) 180#if defined(__sparc__) && defined(__arch64__)
4#include <asm/openprom_64.h> 181#define PROMREG_MAX 24
182#define PROMVADDR_MAX 16
183#define PROMINTR_MAX 32
5#else 184#else
6#include <asm/openprom_32.h> 185#define PROMREG_MAX 16
186#define PROMVADDR_MAX 16
187#define PROMINTR_MAX 15
7#endif 188#endif
189
190struct linux_prom_registers {
191 unsigned int which_io; /* hi part of physical address */
192 unsigned int phys_addr; /* The physical address of this register */
193 unsigned int reg_size; /* How many bytes does this register take up? */
194};
195
196struct linux_prom64_registers {
197 unsigned long phys_addr;
198 unsigned long reg_size;
199};
200
201struct linux_prom_irqs {
202 int pri; /* IRQ priority */
203 int vector; /* This is foobar, what does it do? */
204};
205
206/* Element of the "ranges" vector */
207struct linux_prom_ranges {
208 unsigned int ot_child_space;
209 unsigned int ot_child_base; /* Bus feels this */
210 unsigned int ot_parent_space;
211 unsigned int ot_parent_base; /* CPU looks from here */
212 unsigned int or_size;
213};
214
215/*
216 * Ranges and reg properties are a bit different for PCI.
217 */
218#if defined(__sparc__) && defined(__arch64__)
219struct linux_prom_pci_registers {
220 unsigned int phys_hi;
221 unsigned int phys_mid;
222 unsigned int phys_lo;
223
224 unsigned int size_hi;
225 unsigned int size_lo;
226};
227#else
228struct linux_prom_pci_registers {
229 /*
230 * We don't know what information this field contain.
231 * We guess, PCI device function is in bits 15:8
232 * So, ...
233 */
234 unsigned int which_io; /* Let it be which_io */
235
236 unsigned int phys_hi;
237 unsigned int phys_lo;
238
239 unsigned int size_hi;
240 unsigned int size_lo;
241};
242
8#endif 243#endif
244
245struct linux_prom_pci_ranges {
246 unsigned int child_phys_hi; /* Only certain bits are encoded here. */
247 unsigned int child_phys_mid;
248 unsigned int child_phys_lo;
249
250 unsigned int parent_phys_hi;
251 unsigned int parent_phys_lo;
252
253 unsigned int size_hi;
254 unsigned int size_lo;
255};
256
257struct linux_prom_pci_intmap {
258 unsigned int phys_hi;
259 unsigned int phys_mid;
260 unsigned int phys_lo;
261
262 unsigned int interrupt;
263
264 int cnode;
265 unsigned int cinterrupt;
266};
267
268struct linux_prom_pci_intmask {
269 unsigned int phys_hi;
270 unsigned int phys_mid;
271 unsigned int phys_lo;
272 unsigned int interrupt;
273};
274
275#endif /* !(__ASSEMBLY__) */
276
277#endif /* !(__SPARC_OPENPROM_H) */
diff --git a/arch/sparc/include/asm/openprom_32.h b/arch/sparc/include/asm/openprom_32.h
deleted file mode 100644
index 8b1649f29ed9..000000000000
--- a/arch/sparc/include/asm/openprom_32.h
+++ /dev/null
@@ -1,255 +0,0 @@
1#ifndef __SPARC_OPENPROM_H
2#define __SPARC_OPENPROM_H
3
4/* openprom.h: Prom structures and defines for access to the OPENBOOT
5 * prom routines and data areas.
6 *
7 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
8 */
9
10/* Empirical constants... */
11#define LINUX_OPPROM_MAGIC 0x10010407
12
13#ifndef __ASSEMBLY__
14/* V0 prom device operations. */
15struct linux_dev_v0_funcs {
16 int (*v0_devopen)(char *device_str);
17 int (*v0_devclose)(int dev_desc);
18 int (*v0_rdblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
19 int (*v0_wrblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
20 int (*v0_wrnetdev)(int dev_desc, int num_bytes, char *buf);
21 int (*v0_rdnetdev)(int dev_desc, int num_bytes, char *buf);
22 int (*v0_rdchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
23 int (*v0_wrchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
24 int (*v0_seekdev)(int dev_desc, long logical_offst, int from);
25};
26
27/* V2 and later prom device operations. */
28struct linux_dev_v2_funcs {
29 int (*v2_inst2pkg)(int d); /* Convert ihandle to phandle */
30 char * (*v2_dumb_mem_alloc)(char *va, unsigned sz);
31 void (*v2_dumb_mem_free)(char *va, unsigned sz);
32
33 /* To map devices into virtual I/O space. */
34 char * (*v2_dumb_mmap)(char *virta, int which_io, unsigned paddr, unsigned sz);
35 void (*v2_dumb_munmap)(char *virta, unsigned size);
36
37 int (*v2_dev_open)(char *devpath);
38 void (*v2_dev_close)(int d);
39 int (*v2_dev_read)(int d, char *buf, int nbytes);
40 int (*v2_dev_write)(int d, char *buf, int nbytes);
41 int (*v2_dev_seek)(int d, int hi, int lo);
42
43 /* Never issued (multistage load support) */
44 void (*v2_wheee2)(void);
45 void (*v2_wheee3)(void);
46};
47
48struct linux_mlist_v0 {
49 struct linux_mlist_v0 *theres_more;
50 char *start_adr;
51 unsigned num_bytes;
52};
53
54struct linux_mem_v0 {
55 struct linux_mlist_v0 **v0_totphys;
56 struct linux_mlist_v0 **v0_prommap;
57 struct linux_mlist_v0 **v0_available; /* What we can use */
58};
59
60/* Arguments sent to the kernel from the boot prompt. */
61struct linux_arguments_v0 {
62 char *argv[8];
63 char args[100];
64 char boot_dev[2];
65 int boot_dev_ctrl;
66 int boot_dev_unit;
67 int dev_partition;
68 char *kernel_file_name;
69 void *aieee1; /* XXX */
70};
71
72/* V2 and up boot things. */
73struct linux_bootargs_v2 {
74 char **bootpath;
75 char **bootargs;
76 int *fd_stdin;
77 int *fd_stdout;
78};
79
80/* The top level PROM vector. */
81struct linux_romvec {
82 /* Version numbers. */
83 unsigned int pv_magic_cookie;
84 unsigned int pv_romvers;
85 unsigned int pv_plugin_revision;
86 unsigned int pv_printrev;
87
88 /* Version 0 memory descriptors. */
89 struct linux_mem_v0 pv_v0mem;
90
91 /* Node operations. */
92 struct linux_nodeops *pv_nodeops;
93
94 char **pv_bootstr;
95 struct linux_dev_v0_funcs pv_v0devops;
96
97 char *pv_stdin;
98 char *pv_stdout;
99#define PROMDEV_KBD 0 /* input from keyboard */
100#define PROMDEV_SCREEN 0 /* output to screen */
101#define PROMDEV_TTYA 1 /* in/out to ttya */
102#define PROMDEV_TTYB 2 /* in/out to ttyb */
103
104 /* Blocking getchar/putchar. NOT REENTRANT! (grr) */
105 int (*pv_getchar)(void);
106 void (*pv_putchar)(int ch);
107
108 /* Non-blocking variants. */
109 int (*pv_nbgetchar)(void);
110 int (*pv_nbputchar)(int ch);
111
112 void (*pv_putstr)(char *str, int len);
113
114 /* Miscellany. */
115 void (*pv_reboot)(char *bootstr);
116 void (*pv_printf)(__const__ char *fmt, ...);
117 void (*pv_abort)(void);
118 __volatile__ int *pv_ticks;
119 void (*pv_halt)(void);
120 void (**pv_synchook)(void);
121
122 /* Evaluate a forth string, not different proto for V0 and V2->up. */
123 union {
124 void (*v0_eval)(int len, char *str);
125 void (*v2_eval)(char *str);
126 } pv_fortheval;
127
128 struct linux_arguments_v0 **pv_v0bootargs;
129
130 /* Get ether address. */
131 unsigned int (*pv_enaddr)(int d, char *enaddr);
132
133 struct linux_bootargs_v2 pv_v2bootargs;
134 struct linux_dev_v2_funcs pv_v2devops;
135
136 int filler[15];
137
138 /* This one is sun4c/sun4 only. */
139 void (*pv_setctxt)(int ctxt, char *va, int pmeg);
140
141 /* Prom version 3 Multiprocessor routines. This stuff is crazy.
142 * No joke. Calling these when there is only one cpu probably
143 * crashes the machine, have to test this. :-)
144 */
145
146 /* v3_cpustart() will start the cpu 'whichcpu' in mmu-context
147 * 'thiscontext' executing at address 'prog_counter'
148 */
149 int (*v3_cpustart)(unsigned int whichcpu, int ctxtbl_ptr,
150 int thiscontext, char *prog_counter);
151
152 /* v3_cpustop() will cause cpu 'whichcpu' to stop executing
153 * until a resume cpu call is made.
154 */
155 int (*v3_cpustop)(unsigned int whichcpu);
156
157 /* v3_cpuidle() will idle cpu 'whichcpu' until a stop or
158 * resume cpu call is made.
159 */
160 int (*v3_cpuidle)(unsigned int whichcpu);
161
162 /* v3_cpuresume() will resume processor 'whichcpu' executing
163 * starting with whatever 'pc' and 'npc' were left at the
164 * last 'idle' or 'stop' call.
165 */
166 int (*v3_cpuresume)(unsigned int whichcpu);
167};
168
169/* Routines for traversing the prom device tree. */
170struct linux_nodeops {
171 int (*no_nextnode)(int node);
172 int (*no_child)(int node);
173 int (*no_proplen)(int node, char *name);
174 int (*no_getprop)(int node, char *name, char *val);
175 int (*no_setprop)(int node, char *name, char *val, int len);
176 char * (*no_nextprop)(int node, char *name);
177};
178
179/* More fun PROM structures for device probing. */
180#define PROMREG_MAX 16
181#define PROMVADDR_MAX 16
182#define PROMINTR_MAX 15
183
184struct linux_prom_registers {
185 unsigned int which_io; /* is this in OBIO space? */
186 unsigned int phys_addr; /* The physical address of this register */
187 unsigned int reg_size; /* How many bytes does this register take up? */
188};
189
190struct linux_prom_irqs {
191 int pri; /* IRQ priority */
192 int vector; /* This is foobar, what does it do? */
193};
194
195/* Element of the "ranges" vector */
196struct linux_prom_ranges {
197 unsigned int ot_child_space;
198 unsigned int ot_child_base; /* Bus feels this */
199 unsigned int ot_parent_space;
200 unsigned int ot_parent_base; /* CPU looks from here */
201 unsigned int or_size;
202};
203
204/* Ranges and reg properties are a bit different for PCI. */
205struct linux_prom_pci_registers {
206 /*
207 * We don't know what information this field contain.
208 * We guess, PCI device function is in bits 15:8
209 * So, ...
210 */
211 unsigned int which_io; /* Let it be which_io */
212
213 unsigned int phys_hi;
214 unsigned int phys_lo;
215
216 unsigned int size_hi;
217 unsigned int size_lo;
218};
219
220struct linux_prom_pci_ranges {
221 unsigned int child_phys_hi; /* Only certain bits are encoded here. */
222 unsigned int child_phys_mid;
223 unsigned int child_phys_lo;
224
225 unsigned int parent_phys_hi;
226 unsigned int parent_phys_lo;
227
228 unsigned int size_hi;
229 unsigned int size_lo;
230};
231
232struct linux_prom_pci_assigned_addresses {
233 unsigned int which_io;
234
235 unsigned int phys_hi;
236 unsigned int phys_lo;
237
238 unsigned int size_hi;
239 unsigned int size_lo;
240};
241
242struct linux_prom_ebus_ranges {
243 unsigned int child_phys_hi;
244 unsigned int child_phys_lo;
245
246 unsigned int parent_phys_hi;
247 unsigned int parent_phys_mid;
248 unsigned int parent_phys_lo;
249
250 unsigned int size;
251};
252
253#endif /* !(__ASSEMBLY__) */
254
255#endif /* !(__SPARC_OPENPROM_H) */
diff --git a/arch/sparc/include/asm/openprom_64.h b/arch/sparc/include/asm/openprom_64.h
deleted file mode 100644
index b69e4a8c9170..000000000000
--- a/arch/sparc/include/asm/openprom_64.h
+++ /dev/null
@@ -1,280 +0,0 @@
1#ifndef __SPARC64_OPENPROM_H
2#define __SPARC64_OPENPROM_H
3
4/* openprom.h: Prom structures and defines for access to the OPENBOOT
5 * prom routines and data areas.
6 *
7 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
8 */
9
10#ifndef __ASSEMBLY__
11/* V0 prom device operations. */
12struct linux_dev_v0_funcs {
13 int (*v0_devopen)(char *device_str);
14 int (*v0_devclose)(int dev_desc);
15 int (*v0_rdblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
16 int (*v0_wrblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
17 int (*v0_wrnetdev)(int dev_desc, int num_bytes, char *buf);
18 int (*v0_rdnetdev)(int dev_desc, int num_bytes, char *buf);
19 int (*v0_rdchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
20 int (*v0_wrchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
21 int (*v0_seekdev)(int dev_desc, long logical_offst, int from);
22};
23
24/* V2 and later prom device operations. */
25struct linux_dev_v2_funcs {
26 int (*v2_inst2pkg)(int d); /* Convert ihandle to phandle */
27 char * (*v2_dumb_mem_alloc)(char *va, unsigned sz);
28 void (*v2_dumb_mem_free)(char *va, unsigned sz);
29
30 /* To map devices into virtual I/O space. */
31 char * (*v2_dumb_mmap)(char *virta, int which_io, unsigned paddr, unsigned sz);
32 void (*v2_dumb_munmap)(char *virta, unsigned size);
33
34 int (*v2_dev_open)(char *devpath);
35 void (*v2_dev_close)(int d);
36 int (*v2_dev_read)(int d, char *buf, int nbytes);
37 int (*v2_dev_write)(int d, char *buf, int nbytes);
38 int (*v2_dev_seek)(int d, int hi, int lo);
39
40 /* Never issued (multistage load support) */
41 void (*v2_wheee2)(void);
42 void (*v2_wheee3)(void);
43};
44
45struct linux_mlist_v0 {
46 struct linux_mlist_v0 *theres_more;
47 unsigned start_adr;
48 unsigned num_bytes;
49};
50
51struct linux_mem_v0 {
52 struct linux_mlist_v0 **v0_totphys;
53 struct linux_mlist_v0 **v0_prommap;
54 struct linux_mlist_v0 **v0_available; /* What we can use */
55};
56
57/* Arguments sent to the kernel from the boot prompt. */
58struct linux_arguments_v0 {
59 char *argv[8];
60 char args[100];
61 char boot_dev[2];
62 int boot_dev_ctrl;
63 int boot_dev_unit;
64 int dev_partition;
65 char *kernel_file_name;
66 void *aieee1; /* XXX */
67};
68
69/* V2 and up boot things. */
70struct linux_bootargs_v2 {
71 char **bootpath;
72 char **bootargs;
73 int *fd_stdin;
74 int *fd_stdout;
75};
76
77/* The top level PROM vector. */
78struct linux_romvec {
79 /* Version numbers. */
80 unsigned int pv_magic_cookie;
81 unsigned int pv_romvers;
82 unsigned int pv_plugin_revision;
83 unsigned int pv_printrev;
84
85 /* Version 0 memory descriptors. */
86 struct linux_mem_v0 pv_v0mem;
87
88 /* Node operations. */
89 struct linux_nodeops *pv_nodeops;
90
91 char **pv_bootstr;
92 struct linux_dev_v0_funcs pv_v0devops;
93
94 char *pv_stdin;
95 char *pv_stdout;
96#define PROMDEV_KBD 0 /* input from keyboard */
97#define PROMDEV_SCREEN 0 /* output to screen */
98#define PROMDEV_TTYA 1 /* in/out to ttya */
99#define PROMDEV_TTYB 2 /* in/out to ttyb */
100
101 /* Blocking getchar/putchar. NOT REENTRANT! (grr) */
102 int (*pv_getchar)(void);
103 void (*pv_putchar)(int ch);
104
105 /* Non-blocking variants. */
106 int (*pv_nbgetchar)(void);
107 int (*pv_nbputchar)(int ch);
108
109 void (*pv_putstr)(char *str, int len);
110
111 /* Miscellany. */
112 void (*pv_reboot)(char *bootstr);
113 void (*pv_printf)(__const__ char *fmt, ...);
114 void (*pv_abort)(void);
115 __volatile__ int *pv_ticks;
116 void (*pv_halt)(void);
117 void (**pv_synchook)(void);
118
119 /* Evaluate a forth string, not different proto for V0 and V2->up. */
120 union {
121 void (*v0_eval)(int len, char *str);
122 void (*v2_eval)(char *str);
123 } pv_fortheval;
124
125 struct linux_arguments_v0 **pv_v0bootargs;
126
127 /* Get ether address. */
128 unsigned int (*pv_enaddr)(int d, char *enaddr);
129
130 struct linux_bootargs_v2 pv_v2bootargs;
131 struct linux_dev_v2_funcs pv_v2devops;
132
133 int filler[15];
134
135 /* This one is sun4c/sun4 only. */
136 void (*pv_setctxt)(int ctxt, char *va, int pmeg);
137
138 /* Prom version 3 Multiprocessor routines. This stuff is crazy.
139 * No joke. Calling these when there is only one cpu probably
140 * crashes the machine, have to test this. :-)
141 */
142
143 /* v3_cpustart() will start the cpu 'whichcpu' in mmu-context
144 * 'thiscontext' executing at address 'prog_counter'
145 */
146 int (*v3_cpustart)(unsigned int whichcpu, int ctxtbl_ptr,
147 int thiscontext, char *prog_counter);
148
149 /* v3_cpustop() will cause cpu 'whichcpu' to stop executing
150 * until a resume cpu call is made.
151 */
152 int (*v3_cpustop)(unsigned int whichcpu);
153
154 /* v3_cpuidle() will idle cpu 'whichcpu' until a stop or
155 * resume cpu call is made.
156 */
157 int (*v3_cpuidle)(unsigned int whichcpu);
158
159 /* v3_cpuresume() will resume processor 'whichcpu' executing
160 * starting with whatever 'pc' and 'npc' were left at the
161 * last 'idle' or 'stop' call.
162 */
163 int (*v3_cpuresume)(unsigned int whichcpu);
164};
165
166/* Routines for traversing the prom device tree. */
167struct linux_nodeops {
168 int (*no_nextnode)(int node);
169 int (*no_child)(int node);
170 int (*no_proplen)(int node, char *name);
171 int (*no_getprop)(int node, char *name, char *val);
172 int (*no_setprop)(int node, char *name, char *val, int len);
173 char * (*no_nextprop)(int node, char *name);
174};
175
176/* More fun PROM structures for device probing. */
177#define PROMREG_MAX 24
178#define PROMVADDR_MAX 16
179#define PROMINTR_MAX 32
180
181struct linux_prom_registers {
182 unsigned which_io; /* hi part of physical address */
183 unsigned phys_addr; /* The physical address of this register */
184 int reg_size; /* How many bytes does this register take up? */
185};
186
187struct linux_prom64_registers {
188 unsigned long phys_addr;
189 unsigned long reg_size;
190};
191
192struct linux_prom_irqs {
193 int pri; /* IRQ priority */
194 int vector; /* This is foobar, what does it do? */
195};
196
197/* Element of the "ranges" vector */
198struct linux_prom_ranges {
199 unsigned int ot_child_space;
200 unsigned int ot_child_base; /* Bus feels this */
201 unsigned int ot_parent_space;
202 unsigned int ot_parent_base; /* CPU looks from here */
203 unsigned int or_size;
204};
205
206struct linux_prom64_ranges {
207 unsigned long ot_child_base; /* Bus feels this */
208 unsigned long ot_parent_base; /* CPU looks from here */
209 unsigned long or_size;
210};
211
212/* Ranges and reg properties are a bit different for PCI. */
213struct linux_prom_pci_registers {
214 unsigned int phys_hi;
215 unsigned int phys_mid;
216 unsigned int phys_lo;
217
218 unsigned int size_hi;
219 unsigned int size_lo;
220};
221
222struct linux_prom_pci_ranges {
223 unsigned int child_phys_hi; /* Only certain bits are encoded here. */
224 unsigned int child_phys_mid;
225 unsigned int child_phys_lo;
226
227 unsigned int parent_phys_hi;
228 unsigned int parent_phys_lo;
229
230 unsigned int size_hi;
231 unsigned int size_lo;
232};
233
234struct linux_prom_pci_intmap {
235 unsigned int phys_hi;
236 unsigned int phys_mid;
237 unsigned int phys_lo;
238
239 unsigned int interrupt;
240
241 int cnode;
242 unsigned int cinterrupt;
243};
244
245struct linux_prom_pci_intmask {
246 unsigned int phys_hi;
247 unsigned int phys_mid;
248 unsigned int phys_lo;
249 unsigned int interrupt;
250};
251
252struct linux_prom_ebus_ranges {
253 unsigned int child_phys_hi;
254 unsigned int child_phys_lo;
255
256 unsigned int parent_phys_hi;
257 unsigned int parent_phys_mid;
258 unsigned int parent_phys_lo;
259
260 unsigned int size;
261};
262
263struct linux_prom_ebus_intmap {
264 unsigned int phys_hi;
265 unsigned int phys_lo;
266
267 unsigned int interrupt;
268
269 int cnode;
270 unsigned int cinterrupt;
271};
272
273struct linux_prom_ebus_intmask {
274 unsigned int phys_hi;
275 unsigned int phys_lo;
276 unsigned int interrupt;
277};
278#endif /* !(__ASSEMBLY__) */
279
280#endif /* !(__SPARC64_OPENPROM_H) */
diff --git a/arch/sparc/include/asm/oplib_32.h b/arch/sparc/include/asm/oplib_32.h
index 699da05235c8..73d45521db04 100644
--- a/arch/sparc/include/asm/oplib_32.h
+++ b/arch/sparc/include/asm/oplib_32.h
@@ -136,7 +136,7 @@ extern char prom_getchar(void);
136extern void prom_putchar(char character); 136extern void prom_putchar(char character);
137 137
138/* Prom's internal routines, don't use in kernel/boot code. */ 138/* Prom's internal routines, don't use in kernel/boot code. */
139extern void prom_printf(char *fmt, ...); 139extern void prom_printf(const char *fmt, ...);
140extern void prom_write(const char *buf, unsigned int len); 140extern void prom_write(const char *buf, unsigned int len);
141 141
142/* Multiprocessor operations... */ 142/* Multiprocessor operations... */
@@ -199,12 +199,12 @@ extern int prom_getsibling(int node);
199/* Get the length, at the passed node, of the given property type. 199/* Get the length, at the passed node, of the given property type.
200 * Returns -1 on error (ie. no such property at this node). 200 * Returns -1 on error (ie. no such property at this node).
201 */ 201 */
202extern int prom_getproplen(int thisnode, char *property); 202extern int prom_getproplen(int thisnode, const char *property);
203 203
204/* Fetch the requested property using the given buffer. Returns 204/* Fetch the requested property using the given buffer. Returns
205 * the number of bytes the prom put into your buffer or -1 on error. 205 * the number of bytes the prom put into your buffer or -1 on error.
206 */ 206 */
207extern int __must_check prom_getproperty(int thisnode, char *property, 207extern int __must_check prom_getproperty(int thisnode, const char *property,
208 char *prop_buffer, int propbuf_size); 208 char *prop_buffer, int propbuf_size);
209 209
210/* Acquire an integer property. */ 210/* Acquire an integer property. */
@@ -246,7 +246,7 @@ extern int prom_node_has_property(int node, char *property);
246/* Set the indicated property at the given node with the passed value. 246/* Set the indicated property at the given node with the passed value.
247 * Returns the number of bytes of your value that the prom took. 247 * Returns the number of bytes of your value that the prom took.
248 */ 248 */
249extern int prom_setprop(int node, char *prop_name, char *prop_value, 249extern int prom_setprop(int node, const char *prop_name, char *prop_value,
250 int value_size); 250 int value_size);
251 251
252extern int prom_pathtoinode(char *path); 252extern int prom_pathtoinode(char *path);
diff --git a/arch/sparc/include/asm/pil.h b/arch/sparc/include/asm/pil.h
index 71819bb943fc..d573820c0ff4 100644
--- a/arch/sparc/include/asm/pil.h
+++ b/arch/sparc/include/asm/pil.h
@@ -10,7 +10,12 @@
10 * 10 *
11 * In fact any XCALL which has to etrap/rtrap has a problem because 11 * In fact any XCALL which has to etrap/rtrap has a problem because
12 * it is difficult to prevent rtrap from running BH's, and that would 12 * it is difficult to prevent rtrap from running BH's, and that would
13 * need to be done if the XCALL arrived while %pil==15. 13 * need to be done if the XCALL arrived while %pil==PIL_NORMAL_MAX.
14 *
15 * Finally, in order to handle profiling events even when a
16 * local_irq_disable() is in progress, we only disable up to level 14
17 * interrupts. Profile counter overflow interrupts arrive at level
18 * 15.
14 */ 19 */
15#define PIL_SMP_CALL_FUNC 1 20#define PIL_SMP_CALL_FUNC 1
16#define PIL_SMP_RECEIVE_SIGNAL 2 21#define PIL_SMP_RECEIVE_SIGNAL 2
@@ -18,5 +23,7 @@
18#define PIL_SMP_CTX_NEW_VERSION 4 23#define PIL_SMP_CTX_NEW_VERSION 4
19#define PIL_DEVICE_IRQ 5 24#define PIL_DEVICE_IRQ 5
20#define PIL_SMP_CALL_FUNC_SNGL 6 25#define PIL_SMP_CALL_FUNC_SNGL 6
26#define PIL_NORMAL_MAX 14
27#define PIL_NMI 15
21 28
22#endif /* !(_SPARC64_PIL_H) */ 29#endif /* !(_SPARC64_PIL_H) */
diff --git a/arch/sparc/include/asm/posix_types.h b/arch/sparc/include/asm/posix_types.h
index 03a0e091a884..98d6ebb922fb 100644
--- a/arch/sparc/include/asm/posix_types.h
+++ b/arch/sparc/include/asm/posix_types.h
@@ -1,8 +1,155 @@
1#ifndef ___ASM_SPARC_POSIX_TYPES_H 1/*
2#define ___ASM_SPARC_POSIX_TYPES_H 2 * This file is generally used by user-level software, so you need to
3 * be a little careful about namespace pollution etc. Also, we cannot
4 * assume GCC is being used.
5 */
6
7#ifndef __SPARC_POSIX_TYPES_H
8#define __SPARC_POSIX_TYPES_H
9
3#if defined(__sparc__) && defined(__arch64__) 10#if defined(__sparc__) && defined(__arch64__)
4#include <asm/posix_types_64.h> 11/* sparc 64 bit */
12typedef unsigned long __kernel_size_t;
13typedef long __kernel_ssize_t;
14typedef long __kernel_ptrdiff_t;
15typedef long __kernel_time_t;
16typedef long __kernel_clock_t;
17typedef int __kernel_pid_t;
18typedef int __kernel_ipc_pid_t;
19typedef unsigned int __kernel_uid_t;
20typedef unsigned int __kernel_gid_t;
21typedef unsigned long __kernel_ino_t;
22typedef unsigned int __kernel_mode_t;
23typedef unsigned short __kernel_umode_t;
24typedef unsigned int __kernel_nlink_t;
25typedef int __kernel_daddr_t;
26typedef long __kernel_off_t;
27typedef char * __kernel_caddr_t;
28typedef unsigned short __kernel_uid16_t;
29typedef unsigned short __kernel_gid16_t;
30typedef int __kernel_clockid_t;
31typedef int __kernel_timer_t;
32
33typedef unsigned short __kernel_old_uid_t;
34typedef unsigned short __kernel_old_gid_t;
35typedef __kernel_uid_t __kernel_uid32_t;
36typedef __kernel_gid_t __kernel_gid32_t;
37
38typedef unsigned int __kernel_old_dev_t;
39
40/* Note this piece of asymmetry from the v9 ABI. */
41typedef int __kernel_suseconds_t;
42
5#else 43#else
6#include <asm/posix_types_32.h> 44/* sparc 32 bit */
7#endif 45
46typedef unsigned int __kernel_size_t;
47typedef int __kernel_ssize_t;
48typedef long int __kernel_ptrdiff_t;
49typedef long __kernel_time_t;
50typedef long __kernel_suseconds_t;
51typedef long __kernel_clock_t;
52typedef int __kernel_pid_t;
53typedef unsigned short __kernel_ipc_pid_t;
54typedef unsigned short __kernel_uid_t;
55typedef unsigned short __kernel_gid_t;
56typedef unsigned long __kernel_ino_t;
57typedef unsigned short __kernel_mode_t;
58typedef unsigned short __kernel_umode_t;
59typedef short __kernel_nlink_t;
60typedef long __kernel_daddr_t;
61typedef long __kernel_off_t;
62typedef char * __kernel_caddr_t;
63typedef unsigned short __kernel_uid16_t;
64typedef unsigned short __kernel_gid16_t;
65typedef unsigned int __kernel_uid32_t;
66typedef unsigned int __kernel_gid32_t;
67typedef unsigned short __kernel_old_uid_t;
68typedef unsigned short __kernel_old_gid_t;
69typedef unsigned short __kernel_old_dev_t;
70typedef int __kernel_clockid_t;
71typedef int __kernel_timer_t;
72
73#endif /* defined(__sparc__) && defined(__arch64__) */
74
75#ifdef __GNUC__
76typedef long long __kernel_loff_t;
8#endif 77#endif
78
79typedef struct {
80 int val[2];
81} __kernel_fsid_t;
82
83#ifdef __KERNEL__
84
85#undef __FD_SET
86static inline void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
87{
88 unsigned long _tmp = fd / __NFDBITS;
89 unsigned long _rem = fd % __NFDBITS;
90 fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
91}
92
93#undef __FD_CLR
94static inline void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
95{
96 unsigned long _tmp = fd / __NFDBITS;
97 unsigned long _rem = fd % __NFDBITS;
98 fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
99}
100
101#undef __FD_ISSET
102static inline int __FD_ISSET(unsigned long fd, __const__ __kernel_fd_set *p)
103{
104 unsigned long _tmp = fd / __NFDBITS;
105 unsigned long _rem = fd % __NFDBITS;
106 return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
107}
108
109/*
110 * This will unroll the loop for the normal constant cases (8 or 32 longs,
111 * for 256 and 1024-bit fd_sets respectively)
112 */
113#undef __FD_ZERO
114static inline void __FD_ZERO(__kernel_fd_set *p)
115{
116 unsigned long *tmp = p->fds_bits;
117 int i;
118
119 if (__builtin_constant_p(__FDSET_LONGS)) {
120 switch (__FDSET_LONGS) {
121 case 32:
122 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
123 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
124 tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0;
125 tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0;
126 tmp[16] = 0; tmp[17] = 0; tmp[18] = 0; tmp[19] = 0;
127 tmp[20] = 0; tmp[21] = 0; tmp[22] = 0; tmp[23] = 0;
128 tmp[24] = 0; tmp[25] = 0; tmp[26] = 0; tmp[27] = 0;
129 tmp[28] = 0; tmp[29] = 0; tmp[30] = 0; tmp[31] = 0;
130 return;
131 case 16:
132 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
133 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
134 tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0;
135 tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0;
136 return;
137 case 8:
138 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
139 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
140 return;
141 case 4:
142 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
143 return;
144 }
145 }
146 i = __FDSET_LONGS;
147 while (i) {
148 i--;
149 *tmp = 0;
150 tmp++;
151 }
152}
153
154#endif /* __KERNEL__ */
155#endif /* __SPARC_POSIX_TYPES_H */
diff --git a/arch/sparc/include/asm/posix_types_32.h b/arch/sparc/include/asm/posix_types_32.h
deleted file mode 100644
index 6bb6eb1ca0f2..000000000000
--- a/arch/sparc/include/asm/posix_types_32.h
+++ /dev/null
@@ -1,118 +0,0 @@
1#ifndef __ARCH_SPARC_POSIX_TYPES_H
2#define __ARCH_SPARC_POSIX_TYPES_H
3
4/*
5 * This file is generally used by user-level software, so you need to
6 * be a little careful about namespace pollution etc. Also, we cannot
7 * assume GCC is being used.
8 */
9
10typedef unsigned int __kernel_size_t;
11typedef int __kernel_ssize_t;
12typedef long int __kernel_ptrdiff_t;
13typedef long __kernel_time_t;
14typedef long __kernel_suseconds_t;
15typedef long __kernel_clock_t;
16typedef int __kernel_pid_t;
17typedef unsigned short __kernel_ipc_pid_t;
18typedef unsigned short __kernel_uid_t;
19typedef unsigned short __kernel_gid_t;
20typedef unsigned long __kernel_ino_t;
21typedef unsigned short __kernel_mode_t;
22typedef unsigned short __kernel_umode_t;
23typedef short __kernel_nlink_t;
24typedef long __kernel_daddr_t;
25typedef long __kernel_off_t;
26typedef char * __kernel_caddr_t;
27typedef unsigned short __kernel_uid16_t;
28typedef unsigned short __kernel_gid16_t;
29typedef unsigned int __kernel_uid32_t;
30typedef unsigned int __kernel_gid32_t;
31typedef unsigned short __kernel_old_uid_t;
32typedef unsigned short __kernel_old_gid_t;
33typedef unsigned short __kernel_old_dev_t;
34typedef int __kernel_clockid_t;
35typedef int __kernel_timer_t;
36
37#ifdef __GNUC__
38typedef long long __kernel_loff_t;
39#endif
40
41typedef struct {
42 int val[2];
43} __kernel_fsid_t;
44
45#if defined(__KERNEL__)
46
47#undef __FD_SET
48static inline void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
49{
50 unsigned long _tmp = fd / __NFDBITS;
51 unsigned long _rem = fd % __NFDBITS;
52 fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
53}
54
55#undef __FD_CLR
56static inline void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
57{
58 unsigned long _tmp = fd / __NFDBITS;
59 unsigned long _rem = fd % __NFDBITS;
60 fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
61}
62
63#undef __FD_ISSET
64static inline int __FD_ISSET(unsigned long fd, __const__ __kernel_fd_set *p)
65{
66 unsigned long _tmp = fd / __NFDBITS;
67 unsigned long _rem = fd % __NFDBITS;
68 return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
69}
70
71/*
72 * This will unroll the loop for the normal constant cases (8 or 32 longs,
73 * for 256 and 1024-bit fd_sets respectively)
74 */
75#undef __FD_ZERO
76static inline void __FD_ZERO(__kernel_fd_set *p)
77{
78 unsigned long *tmp = p->fds_bits;
79 int i;
80
81 if (__builtin_constant_p(__FDSET_LONGS)) {
82 switch (__FDSET_LONGS) {
83 case 32:
84 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
85 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
86 tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0;
87 tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0;
88 tmp[16] = 0; tmp[17] = 0; tmp[18] = 0; tmp[19] = 0;
89 tmp[20] = 0; tmp[21] = 0; tmp[22] = 0; tmp[23] = 0;
90 tmp[24] = 0; tmp[25] = 0; tmp[26] = 0; tmp[27] = 0;
91 tmp[28] = 0; tmp[29] = 0; tmp[30] = 0; tmp[31] = 0;
92 return;
93 case 16:
94 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
95 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
96 tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0;
97 tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0;
98 return;
99 case 8:
100 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
101 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
102 return;
103 case 4:
104 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
105 return;
106 }
107 }
108 i = __FDSET_LONGS;
109 while (i) {
110 i--;
111 *tmp = 0;
112 tmp++;
113 }
114}
115
116#endif /* defined(__KERNEL__) */
117
118#endif /* !(__ARCH_SPARC_POSIX_TYPES_H) */
diff --git a/arch/sparc/include/asm/posix_types_64.h b/arch/sparc/include/asm/posix_types_64.h
deleted file mode 100644
index ba8f93295763..000000000000
--- a/arch/sparc/include/asm/posix_types_64.h
+++ /dev/null
@@ -1,122 +0,0 @@
1#ifndef __ARCH_SPARC64_POSIX_TYPES_H
2#define __ARCH_SPARC64_POSIX_TYPES_H
3
4/*
5 * This file is generally used by user-level software, so you need to
6 * be a little careful about namespace pollution etc. Also, we cannot
7 * assume GCC is being used.
8 */
9
10typedef unsigned long __kernel_size_t;
11typedef long __kernel_ssize_t;
12typedef long __kernel_ptrdiff_t;
13typedef long __kernel_time_t;
14typedef long __kernel_clock_t;
15typedef int __kernel_pid_t;
16typedef int __kernel_ipc_pid_t;
17typedef unsigned int __kernel_uid_t;
18typedef unsigned int __kernel_gid_t;
19typedef unsigned long __kernel_ino_t;
20typedef unsigned int __kernel_mode_t;
21typedef unsigned short __kernel_umode_t;
22typedef unsigned int __kernel_nlink_t;
23typedef int __kernel_daddr_t;
24typedef long __kernel_off_t;
25typedef char * __kernel_caddr_t;
26typedef unsigned short __kernel_uid16_t;
27typedef unsigned short __kernel_gid16_t;
28typedef int __kernel_clockid_t;
29typedef int __kernel_timer_t;
30
31typedef unsigned short __kernel_old_uid_t;
32typedef unsigned short __kernel_old_gid_t;
33typedef __kernel_uid_t __kernel_uid32_t;
34typedef __kernel_gid_t __kernel_gid32_t;
35
36typedef unsigned int __kernel_old_dev_t;
37
38/* Note this piece of asymmetry from the v9 ABI. */
39typedef int __kernel_suseconds_t;
40
41#ifdef __GNUC__
42typedef long long __kernel_loff_t;
43#endif
44
45typedef struct {
46 int val[2];
47} __kernel_fsid_t;
48
49#if defined(__KERNEL__)
50
51#undef __FD_SET
52static inline void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
53{
54 unsigned long _tmp = fd / __NFDBITS;
55 unsigned long _rem = fd % __NFDBITS;
56 fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
57}
58
59#undef __FD_CLR
60static inline void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
61{
62 unsigned long _tmp = fd / __NFDBITS;
63 unsigned long _rem = fd % __NFDBITS;
64 fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
65}
66
67#undef __FD_ISSET
68static inline int __FD_ISSET(unsigned long fd, __const__ __kernel_fd_set *p)
69{
70 unsigned long _tmp = fd / __NFDBITS;
71 unsigned long _rem = fd % __NFDBITS;
72 return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
73}
74
75/*
76 * This will unroll the loop for the normal constant cases (8 or 32 longs,
77 * for 256 and 1024-bit fd_sets respectively)
78 */
79#undef __FD_ZERO
80static inline void __FD_ZERO(__kernel_fd_set *p)
81{
82 unsigned long *tmp = p->fds_bits;
83 int i;
84
85 if (__builtin_constant_p(__FDSET_LONGS)) {
86 switch (__FDSET_LONGS) {
87 case 32:
88 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
89 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
90 tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0;
91 tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0;
92 tmp[16] = 0; tmp[17] = 0; tmp[18] = 0; tmp[19] = 0;
93 tmp[20] = 0; tmp[21] = 0; tmp[22] = 0; tmp[23] = 0;
94 tmp[24] = 0; tmp[25] = 0; tmp[26] = 0; tmp[27] = 0;
95 tmp[28] = 0; tmp[29] = 0; tmp[30] = 0; tmp[31] = 0;
96 return;
97 case 16:
98 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
99 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
100 tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0;
101 tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0;
102 return;
103 case 8:
104 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
105 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
106 return;
107 case 4:
108 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
109 return;
110 }
111 }
112 i = __FDSET_LONGS;
113 while (i) {
114 i--;
115 *tmp = 0;
116 tmp++;
117 }
118}
119
120#endif /* defined(__KERNEL__) */
121
122#endif /* !(__ARCH_SPARC64_POSIX_TYPES_H) */
diff --git a/arch/sparc/include/asm/processor_32.h b/arch/sparc/include/asm/processor_32.h
index 2ae67a2e7f3a..09521c6a5edb 100644
--- a/arch/sparc/include/asm/processor_32.h
+++ b/arch/sparc/include/asm/processor_32.h
@@ -99,7 +99,7 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc,
99 "st\t%%g0, [%0 + %3 + 0x3c]" 99 "st\t%%g0, [%0 + %3 + 0x3c]"
100 : /* no outputs */ 100 : /* no outputs */
101 : "r" (regs), 101 : "r" (regs),
102 "r" (sp - sizeof(struct reg_window)), 102 "r" (sp - sizeof(struct reg_window32)),
103 "r" (zero), 103 "r" (zero),
104 "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0])) 104 "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))
105 : "memory"); 105 : "memory");
diff --git a/arch/sparc/include/asm/ptrace.h b/arch/sparc/include/asm/ptrace.h
index 6dcbe2eed2e2..30b0b797dc0c 100644
--- a/arch/sparc/include/asm/ptrace.h
+++ b/arch/sparc/include/asm/ptrace.h
@@ -1,8 +1,448 @@
1#ifndef ___ASM_SPARC_PTRACE_H 1#ifndef __SPARC_PTRACE_H
2#define ___ASM_SPARC_PTRACE_H 2#define __SPARC_PTRACE_H
3
3#if defined(__sparc__) && defined(__arch64__) 4#if defined(__sparc__) && defined(__arch64__)
4#include <asm/ptrace_64.h> 5/* 64 bit sparc */
6#include <asm/pstate.h>
7
8/* This struct defines the way the registers are stored on the
9 * stack during a system call and basically all traps.
10 */
11
12/* This magic value must have the low 9 bits clear,
13 * as that is where we encode the %tt value, see below.
14 */
15#define PT_REGS_MAGIC 0x57ac6c00
16
17#ifndef __ASSEMBLY__
18
19#include <linux/types.h>
20
21struct pt_regs {
22 unsigned long u_regs[16]; /* globals and ins */
23 unsigned long tstate;
24 unsigned long tpc;
25 unsigned long tnpc;
26 unsigned int y;
27
28 /* We encode a magic number, PT_REGS_MAGIC, along
29 * with the %tt (trap type) register value at trap
30 * entry time. The magic number allows us to identify
31 * accurately a trap stack frame in the stack
32 * unwinder, and the %tt value allows us to test
33 * things like "in a system call" etc. for an arbitray
34 * process.
35 *
36 * The PT_REGS_MAGIC is choosen such that it can be
37 * loaded completely using just a sethi instruction.
38 */
39 unsigned int magic;
40};
41
42struct pt_regs32 {
43 unsigned int psr;
44 unsigned int pc;
45 unsigned int npc;
46 unsigned int y;
47 unsigned int u_regs[16]; /* globals and ins */
48};
49
50/* A V9 register window */
51struct reg_window {
52 unsigned long locals[8];
53 unsigned long ins[8];
54};
55
56/* A 32-bit register window. */
57struct reg_window32 {
58 unsigned int locals[8];
59 unsigned int ins[8];
60};
61
62/* A V9 Sparc stack frame */
63struct sparc_stackf {
64 unsigned long locals[8];
65 unsigned long ins[6];
66 struct sparc_stackf *fp;
67 unsigned long callers_pc;
68 char *structptr;
69 unsigned long xargs[6];
70 unsigned long xxargs[1];
71};
72
73/* A 32-bit Sparc stack frame */
74struct sparc_stackf32 {
75 unsigned int locals[8];
76 unsigned int ins[6];
77 unsigned int fp;
78 unsigned int callers_pc;
79 unsigned int structptr;
80 unsigned int xargs[6];
81 unsigned int xxargs[1];
82};
83
84struct sparc_trapf {
85 unsigned long locals[8];
86 unsigned long ins[8];
87 unsigned long _unused;
88 struct pt_regs *regs;
89};
90#endif /* (!__ASSEMBLY__) */
5#else 91#else
6#include <asm/ptrace_32.h> 92/* 32 bit sparc */
93
94#include <asm/psr.h>
95
96/* This struct defines the way the registers are stored on the
97 * stack during a system call and basically all traps.
98 */
99#ifndef __ASSEMBLY__
100
101struct pt_regs {
102 unsigned long psr;
103 unsigned long pc;
104 unsigned long npc;
105 unsigned long y;
106 unsigned long u_regs[16]; /* globals and ins */
107};
108
109/* A 32-bit register window. */
110struct reg_window32 {
111 unsigned long locals[8];
112 unsigned long ins[8];
113};
114
115/* A Sparc stack frame */
116struct sparc_stackf {
117 unsigned long locals[8];
118 unsigned long ins[6];
119 struct sparc_stackf *fp;
120 unsigned long callers_pc;
121 char *structptr;
122 unsigned long xargs[6];
123 unsigned long xxargs[1];
124};
125#endif /* (!__ASSEMBLY__) */
126
127#endif /* (defined(__sparc__) && defined(__arch64__))*/
128
129#ifndef __ASSEMBLY__
130
131#define TRACEREG_SZ sizeof(struct pt_regs)
132#define STACKFRAME_SZ sizeof(struct sparc_stackf)
133
134#define TRACEREG32_SZ sizeof(struct pt_regs32)
135#define STACKFRAME32_SZ sizeof(struct sparc_stackf32)
136
137#endif /* (!__ASSEMBLY__) */
138
139#define UREG_G0 0
140#define UREG_G1 1
141#define UREG_G2 2
142#define UREG_G3 3
143#define UREG_G4 4
144#define UREG_G5 5
145#define UREG_G6 6
146#define UREG_G7 7
147#define UREG_I0 8
148#define UREG_I1 9
149#define UREG_I2 10
150#define UREG_I3 11
151#define UREG_I4 12
152#define UREG_I5 13
153#define UREG_I6 14
154#define UREG_I7 15
155#define UREG_FP UREG_I6
156#define UREG_RETPC UREG_I7
157
158#if defined(__sparc__) && defined(__arch64__)
159/* 64 bit sparc */
160
161#ifndef __ASSEMBLY__
162
163#ifdef __KERNEL__
164
165#include <linux/threads.h>
166#include <asm/system.h>
167
168static inline int pt_regs_trap_type(struct pt_regs *regs)
169{
170 return regs->magic & 0x1ff;
171}
172
173static inline bool pt_regs_is_syscall(struct pt_regs *regs)
174{
175 return (regs->tstate & TSTATE_SYSCALL);
176}
177
178static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
179{
180 return (regs->tstate &= ~TSTATE_SYSCALL);
181}
182
183#define arch_ptrace_stop_needed(exit_code, info) \
184({ flush_user_windows(); \
185 get_thread_wsaved() != 0; \
186})
187
188#define arch_ptrace_stop(exit_code, info) \
189 synchronize_user_stack()
190
191struct global_reg_snapshot {
192 unsigned long tstate;
193 unsigned long tpc;
194 unsigned long tnpc;
195 unsigned long o7;
196 unsigned long i7;
197 unsigned long rpc;
198 struct thread_info *thread;
199 unsigned long pad1;
200};
201extern struct global_reg_snapshot global_reg_snapshot[NR_CPUS];
202
203#define force_successful_syscall_return() \
204do { current_thread_info()->syscall_noerror = 1; \
205} while (0)
206#define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV))
207#define instruction_pointer(regs) ((regs)->tpc)
208#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
209#define regs_return_value(regs) ((regs)->u_regs[UREG_I0])
210#ifdef CONFIG_SMP
211extern unsigned long profile_pc(struct pt_regs *);
212#else
213#define profile_pc(regs) instruction_pointer(regs)
7#endif 214#endif
215extern void show_regs(struct pt_regs *);
216#endif /* (__KERNEL__) */
217
218#else /* __ASSEMBLY__ */
219/* For assembly code. */
220#define TRACEREG_SZ 0xa0
221#define STACKFRAME_SZ 0xc0
222
223#define TRACEREG32_SZ 0x50
224#define STACKFRAME32_SZ 0x60
225#endif /* __ASSEMBLY__ */
226
227#else /* (defined(__sparc__) && defined(__arch64__)) */
228
229/* 32 bit sparc */
230
231#ifndef __ASSEMBLY__
232
233#ifdef __KERNEL__
234
235#include <asm/system.h>
236
237static inline bool pt_regs_is_syscall(struct pt_regs *regs)
238{
239 return (regs->psr & PSR_SYSCALL);
240}
241
242static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
243{
244 return (regs->psr &= ~PSR_SYSCALL);
245}
246
247#define arch_ptrace_stop_needed(exit_code, info) \
248({ flush_user_windows(); \
249 current_thread_info()->w_saved != 0; \
250})
251
252#define arch_ptrace_stop(exit_code, info) \
253 synchronize_user_stack()
254
255#define user_mode(regs) (!((regs)->psr & PSR_PS))
256#define instruction_pointer(regs) ((regs)->pc)
257#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
258unsigned long profile_pc(struct pt_regs *);
259extern void show_regs(struct pt_regs *);
260#endif /* (__KERNEL__) */
261
262#else /* (!__ASSEMBLY__) */
263/* For assembly code. */
264#define TRACEREG_SZ 0x50
265#define STACKFRAME_SZ 0x60
266#endif /* (!__ASSEMBLY__) */
267
268#endif /* (defined(__sparc__) && defined(__arch64__)) */
269
270#ifdef __KERNEL__
271#define STACK_BIAS 2047
8#endif 272#endif
273
274/* These are for pt_regs. */
275#define PT_V9_G0 0x00
276#define PT_V9_G1 0x08
277#define PT_V9_G2 0x10
278#define PT_V9_G3 0x18
279#define PT_V9_G4 0x20
280#define PT_V9_G5 0x28
281#define PT_V9_G6 0x30
282#define PT_V9_G7 0x38
283#define PT_V9_I0 0x40
284#define PT_V9_I1 0x48
285#define PT_V9_I2 0x50
286#define PT_V9_I3 0x58
287#define PT_V9_I4 0x60
288#define PT_V9_I5 0x68
289#define PT_V9_I6 0x70
290#define PT_V9_FP PT_V9_I6
291#define PT_V9_I7 0x78
292#define PT_V9_TSTATE 0x80
293#define PT_V9_TPC 0x88
294#define PT_V9_TNPC 0x90
295#define PT_V9_Y 0x98
296#define PT_V9_MAGIC 0x9c
297#define PT_TSTATE PT_V9_TSTATE
298#define PT_TPC PT_V9_TPC
299#define PT_TNPC PT_V9_TNPC
300
301/* These for pt_regs32. */
302#define PT_PSR 0x0
303#define PT_PC 0x4
304#define PT_NPC 0x8
305#define PT_Y 0xc
306#define PT_G0 0x10
307#define PT_WIM PT_G0
308#define PT_G1 0x14
309#define PT_G2 0x18
310#define PT_G3 0x1c
311#define PT_G4 0x20
312#define PT_G5 0x24
313#define PT_G6 0x28
314#define PT_G7 0x2c
315#define PT_I0 0x30
316#define PT_I1 0x34
317#define PT_I2 0x38
318#define PT_I3 0x3c
319#define PT_I4 0x40
320#define PT_I5 0x44
321#define PT_I6 0x48
322#define PT_FP PT_I6
323#define PT_I7 0x4c
324
325/* Reg_window offsets */
326#define RW_V9_L0 0x00
327#define RW_V9_L1 0x08
328#define RW_V9_L2 0x10
329#define RW_V9_L3 0x18
330#define RW_V9_L4 0x20
331#define RW_V9_L5 0x28
332#define RW_V9_L6 0x30
333#define RW_V9_L7 0x38
334#define RW_V9_I0 0x40
335#define RW_V9_I1 0x48
336#define RW_V9_I2 0x50
337#define RW_V9_I3 0x58
338#define RW_V9_I4 0x60
339#define RW_V9_I5 0x68
340#define RW_V9_I6 0x70
341#define RW_V9_I7 0x78
342
343#define RW_L0 0x00
344#define RW_L1 0x04
345#define RW_L2 0x08
346#define RW_L3 0x0c
347#define RW_L4 0x10
348#define RW_L5 0x14
349#define RW_L6 0x18
350#define RW_L7 0x1c
351#define RW_I0 0x20
352#define RW_I1 0x24
353#define RW_I2 0x28
354#define RW_I3 0x2c
355#define RW_I4 0x30
356#define RW_I5 0x34
357#define RW_I6 0x38
358#define RW_I7 0x3c
359
360/* Stack_frame offsets */
361#define SF_V9_L0 0x00
362#define SF_V9_L1 0x08
363#define SF_V9_L2 0x10
364#define SF_V9_L3 0x18
365#define SF_V9_L4 0x20
366#define SF_V9_L5 0x28
367#define SF_V9_L6 0x30
368#define SF_V9_L7 0x38
369#define SF_V9_I0 0x40
370#define SF_V9_I1 0x48
371#define SF_V9_I2 0x50
372#define SF_V9_I3 0x58
373#define SF_V9_I4 0x60
374#define SF_V9_I5 0x68
375#define SF_V9_FP 0x70
376#define SF_V9_PC 0x78
377#define SF_V9_RETP 0x80
378#define SF_V9_XARG0 0x88
379#define SF_V9_XARG1 0x90
380#define SF_V9_XARG2 0x98
381#define SF_V9_XARG3 0xa0
382#define SF_V9_XARG4 0xa8
383#define SF_V9_XARG5 0xb0
384#define SF_V9_XXARG 0xb8
385
386#define SF_L0 0x00
387#define SF_L1 0x04
388#define SF_L2 0x08
389#define SF_L3 0x0c
390#define SF_L4 0x10
391#define SF_L5 0x14
392#define SF_L6 0x18
393#define SF_L7 0x1c
394#define SF_I0 0x20
395#define SF_I1 0x24
396#define SF_I2 0x28
397#define SF_I3 0x2c
398#define SF_I4 0x30
399#define SF_I5 0x34
400#define SF_FP 0x38
401#define SF_PC 0x3c
402#define SF_RETP 0x40
403#define SF_XARG0 0x44
404#define SF_XARG1 0x48
405#define SF_XARG2 0x4c
406#define SF_XARG3 0x50
407#define SF_XARG4 0x54
408#define SF_XARG5 0x58
409#define SF_XXARG 0x5c
410
411#ifdef __KERNEL__
412
413/* global_reg_snapshot offsets */
414#define GR_SNAP_TSTATE 0x00
415#define GR_SNAP_TPC 0x08
416#define GR_SNAP_TNPC 0x10
417#define GR_SNAP_O7 0x18
418#define GR_SNAP_I7 0x20
419#define GR_SNAP_RPC 0x28
420#define GR_SNAP_THREAD 0x30
421#define GR_SNAP_PAD1 0x38
422
423#endif /* __KERNEL__ */
424
425/* Stuff for the ptrace system call */
426#define PTRACE_SPARC_DETACH 11
427#define PTRACE_GETREGS 12
428#define PTRACE_SETREGS 13
429#define PTRACE_GETFPREGS 14
430#define PTRACE_SETFPREGS 15
431#define PTRACE_READDATA 16
432#define PTRACE_WRITEDATA 17
433#define PTRACE_READTEXT 18
434#define PTRACE_WRITETEXT 19
435#define PTRACE_GETFPAREGS 20
436#define PTRACE_SETFPAREGS 21
437
438/* There are for debugging 64-bit processes, either from a 32 or 64 bit
439 * parent. Thus their complements are for debugging 32-bit processes only.
440 */
441
442#define PTRACE_GETREGS64 22
443#define PTRACE_SETREGS64 23
444/* PTRACE_SYSCALL is 24 */
445#define PTRACE_GETFPREGS64 25
446#define PTRACE_SETFPREGS64 26
447
448#endif /* !(__SPARC_PTRACE_H) */
diff --git a/arch/sparc/include/asm/ptrace_32.h b/arch/sparc/include/asm/ptrace_32.h
deleted file mode 100644
index 4cef450167dd..000000000000
--- a/arch/sparc/include/asm/ptrace_32.h
+++ /dev/null
@@ -1,186 +0,0 @@
1#ifndef _SPARC_PTRACE_H
2#define _SPARC_PTRACE_H
3
4#include <asm/psr.h>
5
6/* This struct defines the way the registers are stored on the
7 * stack during a system call and basically all traps.
8 */
9
10#ifndef __ASSEMBLY__
11
12#include <linux/types.h>
13
14struct pt_regs {
15 unsigned long psr;
16 unsigned long pc;
17 unsigned long npc;
18 unsigned long y;
19 unsigned long u_regs[16]; /* globals and ins */
20};
21
22#define UREG_G0 0
23#define UREG_G1 1
24#define UREG_G2 2
25#define UREG_G3 3
26#define UREG_G4 4
27#define UREG_G5 5
28#define UREG_G6 6
29#define UREG_G7 7
30#define UREG_I0 8
31#define UREG_I1 9
32#define UREG_I2 10
33#define UREG_I3 11
34#define UREG_I4 12
35#define UREG_I5 13
36#define UREG_I6 14
37#define UREG_I7 15
38#define UREG_WIM UREG_G0
39#define UREG_FADDR UREG_G0
40#define UREG_FP UREG_I6
41#define UREG_RETPC UREG_I7
42
43/* A register window */
44struct reg_window {
45 unsigned long locals[8];
46 unsigned long ins[8];
47};
48
49/* A Sparc stack frame */
50struct sparc_stackf {
51 unsigned long locals[8];
52 unsigned long ins[6];
53 struct sparc_stackf *fp;
54 unsigned long callers_pc;
55 char *structptr;
56 unsigned long xargs[6];
57 unsigned long xxargs[1];
58};
59
60#define TRACEREG_SZ sizeof(struct pt_regs)
61#define STACKFRAME_SZ sizeof(struct sparc_stackf)
62
63#ifdef __KERNEL__
64
65#include <asm/system.h>
66
67static inline bool pt_regs_is_syscall(struct pt_regs *regs)
68{
69 return (regs->psr & PSR_SYSCALL);
70}
71
72static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
73{
74 return (regs->psr &= ~PSR_SYSCALL);
75}
76
77#define arch_ptrace_stop_needed(exit_code, info) \
78({ flush_user_windows(); \
79 current_thread_info()->w_saved != 0; \
80})
81
82#define arch_ptrace_stop(exit_code, info) \
83 synchronize_user_stack()
84
85#define user_mode(regs) (!((regs)->psr & PSR_PS))
86#define instruction_pointer(regs) ((regs)->pc)
87#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
88unsigned long profile_pc(struct pt_regs *);
89extern void show_regs(struct pt_regs *);
90#endif
91
92#else /* __ASSEMBLY__ */
93/* For assembly code. */
94#define TRACEREG_SZ 0x50
95#define STACKFRAME_SZ 0x60
96#endif
97
98/*
99 * The asm-offsets.h is a generated file, so we cannot include it.
100 * It may be OK for glibc headers, but it's utterly pointless for C code.
101 * The assembly code using those offsets has to include it explicitly.
102 */
103/* #include <asm/asm-offsets.h> */
104
105/* These are for pt_regs. */
106#define PT_PSR 0x0
107#define PT_PC 0x4
108#define PT_NPC 0x8
109#define PT_Y 0xc
110#define PT_G0 0x10
111#define PT_WIM PT_G0
112#define PT_G1 0x14
113#define PT_G2 0x18
114#define PT_G3 0x1c
115#define PT_G4 0x20
116#define PT_G5 0x24
117#define PT_G6 0x28
118#define PT_G7 0x2c
119#define PT_I0 0x30
120#define PT_I1 0x34
121#define PT_I2 0x38
122#define PT_I3 0x3c
123#define PT_I4 0x40
124#define PT_I5 0x44
125#define PT_I6 0x48
126#define PT_FP PT_I6
127#define PT_I7 0x4c
128
129/* Reg_window offsets */
130#define RW_L0 0x00
131#define RW_L1 0x04
132#define RW_L2 0x08
133#define RW_L3 0x0c
134#define RW_L4 0x10
135#define RW_L5 0x14
136#define RW_L6 0x18
137#define RW_L7 0x1c
138#define RW_I0 0x20
139#define RW_I1 0x24
140#define RW_I2 0x28
141#define RW_I3 0x2c
142#define RW_I4 0x30
143#define RW_I5 0x34
144#define RW_I6 0x38
145#define RW_I7 0x3c
146
147/* Stack_frame offsets */
148#define SF_L0 0x00
149#define SF_L1 0x04
150#define SF_L2 0x08
151#define SF_L3 0x0c
152#define SF_L4 0x10
153#define SF_L5 0x14
154#define SF_L6 0x18
155#define SF_L7 0x1c
156#define SF_I0 0x20
157#define SF_I1 0x24
158#define SF_I2 0x28
159#define SF_I3 0x2c
160#define SF_I4 0x30
161#define SF_I5 0x34
162#define SF_FP 0x38
163#define SF_PC 0x3c
164#define SF_RETP 0x40
165#define SF_XARG0 0x44
166#define SF_XARG1 0x48
167#define SF_XARG2 0x4c
168#define SF_XARG3 0x50
169#define SF_XARG4 0x54
170#define SF_XARG5 0x58
171#define SF_XXARG 0x5c
172
173/* Stuff for the ptrace system call */
174#define PTRACE_SPARC_DETACH 11
175#define PTRACE_GETREGS 12
176#define PTRACE_SETREGS 13
177#define PTRACE_GETFPREGS 14
178#define PTRACE_SETFPREGS 15
179#define PTRACE_READDATA 16
180#define PTRACE_WRITEDATA 17
181#define PTRACE_READTEXT 18
182#define PTRACE_WRITETEXT 19
183#define PTRACE_GETFPAREGS 20
184#define PTRACE_SETFPAREGS 21
185
186#endif /* !(_SPARC_PTRACE_H) */
diff --git a/arch/sparc/include/asm/ptrace_64.h b/arch/sparc/include/asm/ptrace_64.h
deleted file mode 100644
index cd6fbfc20435..000000000000
--- a/arch/sparc/include/asm/ptrace_64.h
+++ /dev/null
@@ -1,356 +0,0 @@
1#ifndef _SPARC64_PTRACE_H
2#define _SPARC64_PTRACE_H
3
4#include <asm/pstate.h>
5
6/* This struct defines the way the registers are stored on the
7 * stack during a system call and basically all traps.
8 */
9
10/* This magic value must have the low 9 bits clear,
11 * as that is where we encode the %tt value, see below.
12 */
13#define PT_REGS_MAGIC 0x57ac6c00
14
15#ifndef __ASSEMBLY__
16
17#include <linux/types.h>
18
19struct pt_regs {
20 unsigned long u_regs[16]; /* globals and ins */
21 unsigned long tstate;
22 unsigned long tpc;
23 unsigned long tnpc;
24 unsigned int y;
25
26 /* We encode a magic number, PT_REGS_MAGIC, along
27 * with the %tt (trap type) register value at trap
28 * entry time. The magic number allows us to identify
29 * accurately a trap stack frame in the stack
30 * unwinder, and the %tt value allows us to test
31 * things like "in a system call" etc. for an arbitray
32 * process.
33 *
34 * The PT_REGS_MAGIC is choosen such that it can be
35 * loaded completely using just a sethi instruction.
36 */
37 unsigned int magic;
38};
39
40struct pt_regs32 {
41 unsigned int psr;
42 unsigned int pc;
43 unsigned int npc;
44 unsigned int y;
45 unsigned int u_regs[16]; /* globals and ins */
46};
47
48#define UREG_G0 0
49#define UREG_G1 1
50#define UREG_G2 2
51#define UREG_G3 3
52#define UREG_G4 4
53#define UREG_G5 5
54#define UREG_G6 6
55#define UREG_G7 7
56#define UREG_I0 8
57#define UREG_I1 9
58#define UREG_I2 10
59#define UREG_I3 11
60#define UREG_I4 12
61#define UREG_I5 13
62#define UREG_I6 14
63#define UREG_I7 15
64#define UREG_FP UREG_I6
65#define UREG_RETPC UREG_I7
66
67/* A V9 register window */
68struct reg_window {
69 unsigned long locals[8];
70 unsigned long ins[8];
71};
72
73/* A 32-bit register window. */
74struct reg_window32 {
75 unsigned int locals[8];
76 unsigned int ins[8];
77};
78
79/* A V9 Sparc stack frame */
80struct sparc_stackf {
81 unsigned long locals[8];
82 unsigned long ins[6];
83 struct sparc_stackf *fp;
84 unsigned long callers_pc;
85 char *structptr;
86 unsigned long xargs[6];
87 unsigned long xxargs[1];
88};
89
90/* A 32-bit Sparc stack frame */
91struct sparc_stackf32 {
92 unsigned int locals[8];
93 unsigned int ins[6];
94 unsigned int fp;
95 unsigned int callers_pc;
96 unsigned int structptr;
97 unsigned int xargs[6];
98 unsigned int xxargs[1];
99};
100
101struct sparc_trapf {
102 unsigned long locals[8];
103 unsigned long ins[8];
104 unsigned long _unused;
105 struct pt_regs *regs;
106};
107
108#define TRACEREG_SZ sizeof(struct pt_regs)
109#define STACKFRAME_SZ sizeof(struct sparc_stackf)
110
111#define TRACEREG32_SZ sizeof(struct pt_regs32)
112#define STACKFRAME32_SZ sizeof(struct sparc_stackf32)
113
114#ifdef __KERNEL__
115
116#include <linux/threads.h>
117#include <asm/system.h>
118
119static inline int pt_regs_trap_type(struct pt_regs *regs)
120{
121 return regs->magic & 0x1ff;
122}
123
124static inline bool pt_regs_is_syscall(struct pt_regs *regs)
125{
126 return (regs->tstate & TSTATE_SYSCALL);
127}
128
129static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
130{
131 return (regs->tstate &= ~TSTATE_SYSCALL);
132}
133
134#define arch_ptrace_stop_needed(exit_code, info) \
135({ flush_user_windows(); \
136 get_thread_wsaved() != 0; \
137})
138
139#define arch_ptrace_stop(exit_code, info) \
140 synchronize_user_stack()
141
142struct global_reg_snapshot {
143 unsigned long tstate;
144 unsigned long tpc;
145 unsigned long tnpc;
146 unsigned long o7;
147 unsigned long i7;
148 unsigned long rpc;
149 struct thread_info *thread;
150 unsigned long pad1;
151};
152extern struct global_reg_snapshot global_reg_snapshot[NR_CPUS];
153
154#define force_successful_syscall_return() \
155do { current_thread_info()->syscall_noerror = 1; \
156} while (0)
157#define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV))
158#define instruction_pointer(regs) ((regs)->tpc)
159#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
160#define regs_return_value(regs) ((regs)->u_regs[UREG_I0])
161#ifdef CONFIG_SMP
162extern unsigned long profile_pc(struct pt_regs *);
163#else
164#define profile_pc(regs) instruction_pointer(regs)
165#endif
166extern void show_regs(struct pt_regs *);
167#endif
168
169#else /* __ASSEMBLY__ */
170/* For assembly code. */
171#define TRACEREG_SZ 0xa0
172#define STACKFRAME_SZ 0xc0
173
174#define TRACEREG32_SZ 0x50
175#define STACKFRAME32_SZ 0x60
176#endif
177
178#ifdef __KERNEL__
179#define STACK_BIAS 2047
180#endif
181
182/* These are for pt_regs. */
183#define PT_V9_G0 0x00
184#define PT_V9_G1 0x08
185#define PT_V9_G2 0x10
186#define PT_V9_G3 0x18
187#define PT_V9_G4 0x20
188#define PT_V9_G5 0x28
189#define PT_V9_G6 0x30
190#define PT_V9_G7 0x38
191#define PT_V9_I0 0x40
192#define PT_V9_I1 0x48
193#define PT_V9_I2 0x50
194#define PT_V9_I3 0x58
195#define PT_V9_I4 0x60
196#define PT_V9_I5 0x68
197#define PT_V9_I6 0x70
198#define PT_V9_FP PT_V9_I6
199#define PT_V9_I7 0x78
200#define PT_V9_TSTATE 0x80
201#define PT_V9_TPC 0x88
202#define PT_V9_TNPC 0x90
203#define PT_V9_Y 0x98
204#define PT_V9_MAGIC 0x9c
205#define PT_TSTATE PT_V9_TSTATE
206#define PT_TPC PT_V9_TPC
207#define PT_TNPC PT_V9_TNPC
208
209/* These for pt_regs32. */
210#define PT_PSR 0x0
211#define PT_PC 0x4
212#define PT_NPC 0x8
213#define PT_Y 0xc
214#define PT_G0 0x10
215#define PT_WIM PT_G0
216#define PT_G1 0x14
217#define PT_G2 0x18
218#define PT_G3 0x1c
219#define PT_G4 0x20
220#define PT_G5 0x24
221#define PT_G6 0x28
222#define PT_G7 0x2c
223#define PT_I0 0x30
224#define PT_I1 0x34
225#define PT_I2 0x38
226#define PT_I3 0x3c
227#define PT_I4 0x40
228#define PT_I5 0x44
229#define PT_I6 0x48
230#define PT_FP PT_I6
231#define PT_I7 0x4c
232
233/* Reg_window offsets */
234#define RW_V9_L0 0x00
235#define RW_V9_L1 0x08
236#define RW_V9_L2 0x10
237#define RW_V9_L3 0x18
238#define RW_V9_L4 0x20
239#define RW_V9_L5 0x28
240#define RW_V9_L6 0x30
241#define RW_V9_L7 0x38
242#define RW_V9_I0 0x40
243#define RW_V9_I1 0x48
244#define RW_V9_I2 0x50
245#define RW_V9_I3 0x58
246#define RW_V9_I4 0x60
247#define RW_V9_I5 0x68
248#define RW_V9_I6 0x70
249#define RW_V9_I7 0x78
250
251#define RW_L0 0x00
252#define RW_L1 0x04
253#define RW_L2 0x08
254#define RW_L3 0x0c
255#define RW_L4 0x10
256#define RW_L5 0x14
257#define RW_L6 0x18
258#define RW_L7 0x1c
259#define RW_I0 0x20
260#define RW_I1 0x24
261#define RW_I2 0x28
262#define RW_I3 0x2c
263#define RW_I4 0x30
264#define RW_I5 0x34
265#define RW_I6 0x38
266#define RW_I7 0x3c
267
268/* Stack_frame offsets */
269#define SF_V9_L0 0x00
270#define SF_V9_L1 0x08
271#define SF_V9_L2 0x10
272#define SF_V9_L3 0x18
273#define SF_V9_L4 0x20
274#define SF_V9_L5 0x28
275#define SF_V9_L6 0x30
276#define SF_V9_L7 0x38
277#define SF_V9_I0 0x40
278#define SF_V9_I1 0x48
279#define SF_V9_I2 0x50
280#define SF_V9_I3 0x58
281#define SF_V9_I4 0x60
282#define SF_V9_I5 0x68
283#define SF_V9_FP 0x70
284#define SF_V9_PC 0x78
285#define SF_V9_RETP 0x80
286#define SF_V9_XARG0 0x88
287#define SF_V9_XARG1 0x90
288#define SF_V9_XARG2 0x98
289#define SF_V9_XARG3 0xa0
290#define SF_V9_XARG4 0xa8
291#define SF_V9_XARG5 0xb0
292#define SF_V9_XXARG 0xb8
293
294#define SF_L0 0x00
295#define SF_L1 0x04
296#define SF_L2 0x08
297#define SF_L3 0x0c
298#define SF_L4 0x10
299#define SF_L5 0x14
300#define SF_L6 0x18
301#define SF_L7 0x1c
302#define SF_I0 0x20
303#define SF_I1 0x24
304#define SF_I2 0x28
305#define SF_I3 0x2c
306#define SF_I4 0x30
307#define SF_I5 0x34
308#define SF_FP 0x38
309#define SF_PC 0x3c
310#define SF_RETP 0x40
311#define SF_XARG0 0x44
312#define SF_XARG1 0x48
313#define SF_XARG2 0x4c
314#define SF_XARG3 0x50
315#define SF_XARG4 0x54
316#define SF_XARG5 0x58
317#define SF_XXARG 0x5c
318
319#ifdef __KERNEL__
320
321/* global_reg_snapshot offsets */
322#define GR_SNAP_TSTATE 0x00
323#define GR_SNAP_TPC 0x08
324#define GR_SNAP_TNPC 0x10
325#define GR_SNAP_O7 0x18
326#define GR_SNAP_I7 0x20
327#define GR_SNAP_RPC 0x28
328#define GR_SNAP_THREAD 0x30
329#define GR_SNAP_PAD1 0x38
330
331#endif /* __KERNEL__ */
332
333/* Stuff for the ptrace system call */
334#define PTRACE_SPARC_DETACH 11
335#define PTRACE_GETREGS 12
336#define PTRACE_SETREGS 13
337#define PTRACE_GETFPREGS 14
338#define PTRACE_SETFPREGS 15
339#define PTRACE_READDATA 16
340#define PTRACE_WRITEDATA 17
341#define PTRACE_READTEXT 18
342#define PTRACE_WRITETEXT 19
343#define PTRACE_GETFPAREGS 20
344#define PTRACE_SETFPAREGS 21
345
346/* There are for debugging 64-bit processes, either from a 32 or 64 bit
347 * parent. Thus their complements are for debugging 32-bit processes only.
348 */
349
350#define PTRACE_GETREGS64 22
351#define PTRACE_SETREGS64 23
352/* PTRACE_SYSCALL is 24 */
353#define PTRACE_GETFPREGS64 25
354#define PTRACE_SETFPREGS64 26
355
356#endif /* !(_SPARC64_PTRACE_H) */
diff --git a/arch/sparc/include/asm/reg.h b/arch/sparc/include/asm/reg.h
deleted file mode 100644
index 0c16e19cae4d..000000000000
--- a/arch/sparc/include/asm/reg.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_REG_H
2#define ___ASM_SPARC_REG_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/reg_64.h>
5#else
6#include <asm/reg_32.h>
7#endif
8#endif
diff --git a/arch/sparc/include/asm/reg_32.h b/arch/sparc/include/asm/reg_32.h
deleted file mode 100644
index 1efb056fb3d1..000000000000
--- a/arch/sparc/include/asm/reg_32.h
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * linux/include/asm/reg.h
3 * Layout of the registers as expected by gdb on the Sparc
4 * we should replace the user.h definitions with those in
5 * this file, we don't even use the other
6 * -miguel
7 *
8 * The names of the structures, constants and aliases in this file
9 * have the same names as the sunos ones, some programs rely on these
10 * names (gdb for example).
11 *
12 */
13
14#ifndef __SPARC_REG_H
15#define __SPARC_REG_H
16
17struct regs {
18 int r_psr;
19#define r_ps r_psr
20 int r_pc;
21 int r_npc;
22 int r_y;
23 int r_g1;
24 int r_g2;
25 int r_g3;
26 int r_g4;
27 int r_g5;
28 int r_g6;
29 int r_g7;
30 int r_o0;
31 int r_o1;
32 int r_o2;
33 int r_o3;
34 int r_o4;
35 int r_o5;
36 int r_o6;
37 int r_o7;
38};
39
40struct fpq {
41 unsigned long *addr;
42 unsigned long instr;
43};
44
45struct fq {
46 union {
47 double whole;
48 struct fpq fpq;
49 } FQu;
50};
51
52#define FPU_REGS_TYPE unsigned int
53#define FPU_FSR_TYPE unsigned
54
55struct fp_status {
56 union {
57 FPU_REGS_TYPE Fpu_regs[32];
58 double Fpu_dregs[16];
59 } fpu_fr;
60 FPU_FSR_TYPE Fpu_fsr;
61 unsigned Fpu_flags;
62 unsigned Fpu_extra;
63 unsigned Fpu_qcnt;
64 struct fq Fpu_q[16];
65};
66
67#define fpu_regs f_fpstatus.fpu_fr.Fpu_regs
68#define fpu_dregs f_fpstatus.fpu_fr.Fpu_dregs
69#define fpu_fsr f_fpstatus.Fpu_fsr
70#define fpu_flags f_fpstatus.Fpu_flags
71#define fpu_extra f_fpstatus.Fpu_extra
72#define fpu_q f_fpstatus.Fpu_q
73#define fpu_qcnt f_fpstatus.Fpu_qcnt
74
75struct fpu {
76 struct fp_status f_fpstatus;
77};
78
79#endif /* __SPARC_REG_H */
diff --git a/arch/sparc/include/asm/reg_64.h b/arch/sparc/include/asm/reg_64.h
deleted file mode 100644
index 6f277d7c7d88..000000000000
--- a/arch/sparc/include/asm/reg_64.h
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * linux/asm/reg.h
3 * Layout of the registers as expected by gdb on the Sparc
4 * we should replace the user.h definitions with those in
5 * this file, we don't even use the other
6 * -miguel
7 *
8 * The names of the structures, constants and aliases in this file
9 * have the same names as the sunos ones, some programs rely on these
10 * names (gdb for example).
11 *
12 */
13
14#ifndef __SPARC64_REG_H
15#define __SPARC64_REG_H
16
17struct regs {
18 unsigned long r_g1;
19 unsigned long r_g2;
20 unsigned long r_g3;
21 unsigned long r_g4;
22 unsigned long r_g5;
23 unsigned long r_g6;
24 unsigned long r_g7;
25 unsigned long r_o0;
26 unsigned long r_o1;
27 unsigned long r_o2;
28 unsigned long r_o3;
29 unsigned long r_o4;
30 unsigned long r_o5;
31 unsigned long r_o6;
32 unsigned long r_o7;
33 unsigned long __pad;
34 unsigned long r_tstate;
35 unsigned long r_tpc;
36 unsigned long r_tnpc;
37 unsigned int r_y;
38 unsigned int r_fprs;
39};
40
41#define FPU_REGS_TYPE unsigned int
42#define FPU_FSR_TYPE unsigned long
43
44struct fp_status {
45 unsigned long fpu_fr[32];
46 unsigned long Fpu_fsr;
47};
48
49struct fpu {
50 struct fp_status f_fpstatus;
51};
52
53#define fpu_regs f_fpstatus.fpu_fr
54#define fpu_fsr f_fpstatus.Fpu_fsr
55
56#endif /* __SPARC64_REG_H */
diff --git a/arch/sparc/include/asm/scatterlist.h b/arch/sparc/include/asm/scatterlist.h
index ec21a4517641..e580f5581c88 100644
--- a/arch/sparc/include/asm/scatterlist.h
+++ b/arch/sparc/include/asm/scatterlist.h
@@ -1,8 +1,27 @@
1#ifndef ___ASM_SPARC_SCATTERLIST_H 1#ifndef _SPARC_SCATTERLIST_H
2#define ___ASM_SPARC_SCATTERLIST_H 2#define _SPARC_SCATTERLIST_H
3#if defined(__sparc__) && defined(__arch64__) 3
4#include <asm/scatterlist_64.h> 4#include <asm/page.h>
5#else 5#include <asm/types.h>
6#include <asm/scatterlist_32.h> 6
7#endif 7struct scatterlist {
8#ifdef CONFIG_DEBUG_SG
9 unsigned long sg_magic;
8#endif 10#endif
11 unsigned long page_link;
12 unsigned int offset;
13
14 unsigned int length;
15
16 dma_addr_t dma_address;
17 __u32 dma_length;
18};
19
20#define sg_dma_address(sg) ((sg)->dma_address)
21#define sg_dma_len(sg) ((sg)->dma_length)
22
23#define ISA_DMA_THRESHOLD (~0UL)
24
25#define ARCH_HAS_SG_CHAIN
26
27#endif /* !(_SPARC_SCATTERLIST_H) */
diff --git a/arch/sparc/include/asm/scatterlist_32.h b/arch/sparc/include/asm/scatterlist_32.h
deleted file mode 100644
index c82609ca1d0f..000000000000
--- a/arch/sparc/include/asm/scatterlist_32.h
+++ /dev/null
@@ -1,26 +0,0 @@
1#ifndef _SPARC_SCATTERLIST_H
2#define _SPARC_SCATTERLIST_H
3
4#include <linux/types.h>
5
6struct scatterlist {
7#ifdef CONFIG_DEBUG_SG
8 unsigned long sg_magic;
9#endif
10 unsigned long page_link;
11 unsigned int offset;
12
13 unsigned int length;
14
15 __u32 dvma_address; /* A place to hang host-specific addresses at. */
16 __u32 dvma_length;
17};
18
19#define sg_dma_address(sg) ((sg)->dvma_address)
20#define sg_dma_len(sg) ((sg)->dvma_length)
21
22#define ISA_DMA_THRESHOLD (~0UL)
23
24#define ARCH_HAS_SG_CHAIN
25
26#endif /* !(_SPARC_SCATTERLIST_H) */
diff --git a/arch/sparc/include/asm/scatterlist_64.h b/arch/sparc/include/asm/scatterlist_64.h
deleted file mode 100644
index 81bd058f9382..000000000000
--- a/arch/sparc/include/asm/scatterlist_64.h
+++ /dev/null
@@ -1,27 +0,0 @@
1#ifndef _SPARC64_SCATTERLIST_H
2#define _SPARC64_SCATTERLIST_H
3
4#include <asm/page.h>
5#include <asm/types.h>
6
7struct scatterlist {
8#ifdef CONFIG_DEBUG_SG
9 unsigned long sg_magic;
10#endif
11 unsigned long page_link;
12 unsigned int offset;
13
14 unsigned int length;
15
16 dma_addr_t dma_address;
17 __u32 dma_length;
18};
19
20#define sg_dma_address(sg) ((sg)->dma_address)
21#define sg_dma_len(sg) ((sg)->dma_length)
22
23#define ISA_DMA_THRESHOLD (~0UL)
24
25#define ARCH_HAS_SG_CHAIN
26
27#endif /* !(_SPARC64_SCATTERLIST_H) */
diff --git a/arch/sparc/include/asm/sections.h b/arch/sparc/include/asm/sections.h
index c7c69b00967f..0b0553bbd8a0 100644
--- a/arch/sparc/include/asm/sections.h
+++ b/arch/sparc/include/asm/sections.h
@@ -1,8 +1,10 @@
1#ifndef ___ASM_SPARC_SECTIONS_H 1#ifndef __SPARC_SECTIONS_H
2#define ___ASM_SPARC_SECTIONS_H 2#define __SPARC_SECTIONS_H
3#if defined(__sparc__) && defined(__arch64__) 3
4#include <asm/sections_64.h> 4/* nothing to see, move along */
5#else 5#include <asm-generic/sections.h>
6#include <asm/sections_32.h> 6
7#endif 7/* sparc entry point */
8extern char _start[];
9
8#endif 10#endif
diff --git a/arch/sparc/include/asm/sections_32.h b/arch/sparc/include/asm/sections_32.h
deleted file mode 100644
index 6832841df051..000000000000
--- a/arch/sparc/include/asm/sections_32.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _SPARC_SECTIONS_H
2#define _SPARC_SECTIONS_H
3
4#include <asm-generic/sections.h>
5
6#endif
diff --git a/arch/sparc/include/asm/sections_64.h b/arch/sparc/include/asm/sections_64.h
deleted file mode 100644
index 3f4b9fdc28d0..000000000000
--- a/arch/sparc/include/asm/sections_64.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _SPARC64_SECTIONS_H
2#define _SPARC64_SECTIONS_H
3
4/* nothing to see, move along */
5#include <asm-generic/sections.h>
6
7extern char _start[];
8
9#endif
diff --git a/arch/sparc/include/asm/sigcontext.h b/arch/sparc/include/asm/sigcontext.h
index e92de7e286b5..a1607d180354 100644
--- a/arch/sparc/include/asm/sigcontext.h
+++ b/arch/sparc/include/asm/sigcontext.h
@@ -1,8 +1,96 @@
1#ifndef ___ASM_SPARC_SIGCONTEXT_H 1#ifndef __SPARC_SIGCONTEXT_H
2#define ___ASM_SPARC_SIGCONTEXT_H 2#define __SPARC_SIGCONTEXT_H
3#if defined(__sparc__) && defined(__arch64__) 3
4#include <asm/sigcontext_64.h> 4#ifdef __KERNEL__
5#include <asm/ptrace.h>
6
7#ifndef __ASSEMBLY__
8
9#define __SUNOS_MAXWIN 31
10
11/* This is what SunOS does, so shall I unless we use new 32bit signals or rt signals. */
12struct sigcontext32 {
13 int sigc_onstack; /* state to restore */
14 int sigc_mask; /* sigmask to restore */
15 int sigc_sp; /* stack pointer */
16 int sigc_pc; /* program counter */
17 int sigc_npc; /* next program counter */
18 int sigc_psr; /* for condition codes etc */
19 int sigc_g1; /* User uses these two registers */
20 int sigc_o0; /* within the trampoline code. */
21
22 /* Now comes information regarding the users window set
23 * at the time of the signal.
24 */
25 int sigc_oswins; /* outstanding windows */
26
27 /* stack ptrs for each regwin buf */
28 unsigned sigc_spbuf[__SUNOS_MAXWIN];
29
30 /* Windows to restore after signal */
31 struct reg_window32 sigc_wbuf[__SUNOS_MAXWIN];
32};
33
34
35/* This is what we use for 32bit new non-rt signals. */
36
37typedef struct {
38 struct {
39 unsigned int psr;
40 unsigned int pc;
41 unsigned int npc;
42 unsigned int y;
43 unsigned int u_regs[16]; /* globals and ins */
44 } si_regs;
45 int si_mask;
46} __siginfo32_t;
47
48#ifdef CONFIG_SPARC64
49typedef struct {
50 unsigned int si_float_regs [64];
51 unsigned long si_fsr;
52 unsigned long si_gsr;
53 unsigned long si_fprs;
54} __siginfo_fpu_t;
55
56/* This is what SunOS doesn't, so we have to write this alone
57 and do it properly. */
58struct sigcontext {
59 /* The size of this array has to match SI_MAX_SIZE from siginfo.h */
60 char sigc_info[128];
61 struct {
62 unsigned long u_regs[16]; /* globals and ins */
63 unsigned long tstate;
64 unsigned long tpc;
65 unsigned long tnpc;
66 unsigned int y;
67 unsigned int fprs;
68 } sigc_regs;
69 __siginfo_fpu_t * sigc_fpu_save;
70 struct {
71 void * ss_sp;
72 int ss_flags;
73 unsigned long ss_size;
74 } sigc_stack;
75 unsigned long sigc_mask;
76};
77
5#else 78#else
6#include <asm/sigcontext_32.h> 79
7#endif 80typedef struct {
8#endif 81 unsigned long si_float_regs [32];
82 unsigned long si_fsr;
83 unsigned long si_fpqdepth;
84 struct {
85 unsigned long *insn_addr;
86 unsigned long insn;
87 } si_fpqueue [16];
88} __siginfo_fpu_t;
89#endif /* (CONFIG_SPARC64) */
90
91
92#endif /* !(__ASSEMBLY__) */
93
94#endif /* (__KERNEL__) */
95
96#endif /* !(__SPARC_SIGCONTEXT_H) */
diff --git a/arch/sparc/include/asm/sigcontext_32.h b/arch/sparc/include/asm/sigcontext_32.h
deleted file mode 100644
index c5fb60dcbd75..000000000000
--- a/arch/sparc/include/asm/sigcontext_32.h
+++ /dev/null
@@ -1,62 +0,0 @@
1#ifndef __SPARC_SIGCONTEXT_H
2#define __SPARC_SIGCONTEXT_H
3
4#ifdef __KERNEL__
5#include <asm/ptrace.h>
6
7#ifndef __ASSEMBLY__
8
9#define __SUNOS_MAXWIN 31
10
11/* This is what SunOS does, so shall I. */
12struct sigcontext {
13 int sigc_onstack; /* state to restore */
14 int sigc_mask; /* sigmask to restore */
15 int sigc_sp; /* stack pointer */
16 int sigc_pc; /* program counter */
17 int sigc_npc; /* next program counter */
18 int sigc_psr; /* for condition codes etc */
19 int sigc_g1; /* User uses these two registers */
20 int sigc_o0; /* within the trampoline code. */
21
22 /* Now comes information regarding the users window set
23 * at the time of the signal.
24 */
25 int sigc_oswins; /* outstanding windows */
26
27 /* stack ptrs for each regwin buf */
28 char *sigc_spbuf[__SUNOS_MAXWIN];
29
30 /* Windows to restore after signal */
31 struct {
32 unsigned long locals[8];
33 unsigned long ins[8];
34 } sigc_wbuf[__SUNOS_MAXWIN];
35};
36
37typedef struct {
38 struct {
39 unsigned long psr;
40 unsigned long pc;
41 unsigned long npc;
42 unsigned long y;
43 unsigned long u_regs[16]; /* globals and ins */
44 } si_regs;
45 int si_mask;
46} __siginfo_t;
47
48typedef struct {
49 unsigned long si_float_regs [32];
50 unsigned long si_fsr;
51 unsigned long si_fpqdepth;
52 struct {
53 unsigned long *insn_addr;
54 unsigned long insn;
55 } si_fpqueue [16];
56} __siginfo_fpu_t;
57
58#endif /* !(__ASSEMBLY__) */
59
60#endif /* (__KERNEL__) */
61
62#endif /* !(__SPARC_SIGCONTEXT_H) */
diff --git a/arch/sparc/include/asm/sigcontext_64.h b/arch/sparc/include/asm/sigcontext_64.h
deleted file mode 100644
index 1c868d680cfc..000000000000
--- a/arch/sparc/include/asm/sigcontext_64.h
+++ /dev/null
@@ -1,87 +0,0 @@
1#ifndef __SPARC64_SIGCONTEXT_H
2#define __SPARC64_SIGCONTEXT_H
3
4#ifdef __KERNEL__
5#include <asm/ptrace.h>
6#endif
7
8#ifndef __ASSEMBLY__
9
10#ifdef __KERNEL__
11
12#define __SUNOS_MAXWIN 31
13
14/* This is what SunOS does, so shall I unless we use new 32bit signals or rt signals. */
15struct sigcontext32 {
16 int sigc_onstack; /* state to restore */
17 int sigc_mask; /* sigmask to restore */
18 int sigc_sp; /* stack pointer */
19 int sigc_pc; /* program counter */
20 int sigc_npc; /* next program counter */
21 int sigc_psr; /* for condition codes etc */
22 int sigc_g1; /* User uses these two registers */
23 int sigc_o0; /* within the trampoline code. */
24
25 /* Now comes information regarding the users window set
26 * at the time of the signal.
27 */
28 int sigc_oswins; /* outstanding windows */
29
30 /* stack ptrs for each regwin buf */
31 unsigned sigc_spbuf[__SUNOS_MAXWIN];
32
33 /* Windows to restore after signal */
34 struct reg_window32 sigc_wbuf[__SUNOS_MAXWIN];
35};
36
37#endif
38
39#ifdef __KERNEL__
40
41/* This is what we use for 32bit new non-rt signals. */
42
43typedef struct {
44 struct {
45 unsigned int psr;
46 unsigned int pc;
47 unsigned int npc;
48 unsigned int y;
49 unsigned int u_regs[16]; /* globals and ins */
50 } si_regs;
51 int si_mask;
52} __siginfo32_t;
53
54#endif
55
56typedef struct {
57 unsigned int si_float_regs [64];
58 unsigned long si_fsr;
59 unsigned long si_gsr;
60 unsigned long si_fprs;
61} __siginfo_fpu_t;
62
63/* This is what SunOS doesn't, so we have to write this alone
64 and do it properly. */
65struct sigcontext {
66 /* The size of this array has to match SI_MAX_SIZE from siginfo.h */
67 char sigc_info[128];
68 struct {
69 unsigned long u_regs[16]; /* globals and ins */
70 unsigned long tstate;
71 unsigned long tpc;
72 unsigned long tnpc;
73 unsigned int y;
74 unsigned int fprs;
75 } sigc_regs;
76 __siginfo_fpu_t * sigc_fpu_save;
77 struct {
78 void * ss_sp;
79 int ss_flags;
80 unsigned long ss_size;
81 } sigc_stack;
82 unsigned long sigc_mask;
83};
84
85#endif /* !(__ASSEMBLY__) */
86
87#endif /* !(__SPARC64_SIGCONTEXT_H) */
diff --git a/arch/sparc/include/asm/siginfo.h b/arch/sparc/include/asm/siginfo.h
index bd81f8d7f5ce..988e5d8ed11a 100644
--- a/arch/sparc/include/asm/siginfo.h
+++ b/arch/sparc/include/asm/siginfo.h
@@ -1,8 +1,37 @@
1#ifndef ___ASM_SPARC_SIGINFO_H 1#ifndef __SPARC_SIGINFO_H
2#define ___ASM_SPARC_SIGINFO_H 2#define __SPARC_SIGINFO_H
3
3#if defined(__sparc__) && defined(__arch64__) 4#if defined(__sparc__) && defined(__arch64__)
4#include <asm/siginfo_64.h> 5
5#else 6#define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3)
6#include <asm/siginfo_32.h> 7#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
7#endif 8#define __ARCH_SI_BAND_T int
8#endif 9
10#endif /* defined(__sparc__) && defined(__arch64__) */
11
12
13#define __ARCH_SI_TRAPNO
14
15#include <asm-generic/siginfo.h>
16
17#ifdef __KERNEL__
18
19#include <linux/compat.h>
20
21#ifdef CONFIG_COMPAT
22
23struct compat_siginfo;
24
25#endif /* CONFIG_COMPAT */
26
27#endif /* __KERNEL__ */
28
29#define SI_NOINFO 32767 /* no information in siginfo_t */
30
31/*
32 * SIGEMT si_codes
33 */
34#define EMT_TAGOVF (__SI_FAULT|1) /* tag overflow */
35#define NSIGEMT 1
36
37#endif /* !(__SPARC_SIGINFO_H) */
diff --git a/arch/sparc/include/asm/siginfo_32.h b/arch/sparc/include/asm/siginfo_32.h
deleted file mode 100644
index 3c71af135c52..000000000000
--- a/arch/sparc/include/asm/siginfo_32.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef _SPARC_SIGINFO_H
2#define _SPARC_SIGINFO_H
3
4#define __ARCH_SI_UID_T unsigned int
5#define __ARCH_SI_TRAPNO
6
7#include <asm-generic/siginfo.h>
8
9#define SI_NOINFO 32767 /* no information in siginfo_t */
10
11/*
12 * SIGEMT si_codes
13 */
14#define EMT_TAGOVF (__SI_FAULT|1) /* tag overflow */
15#define NSIGEMT 1
16
17#endif /* !(_SPARC_SIGINFO_H) */
diff --git a/arch/sparc/include/asm/siginfo_64.h b/arch/sparc/include/asm/siginfo_64.h
deleted file mode 100644
index c96e6c30f8b0..000000000000
--- a/arch/sparc/include/asm/siginfo_64.h
+++ /dev/null
@@ -1,32 +0,0 @@
1#ifndef _SPARC64_SIGINFO_H
2#define _SPARC64_SIGINFO_H
3
4#define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3)
5
6#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
7#define __ARCH_SI_TRAPNO
8#define __ARCH_SI_BAND_T int
9
10#include <asm-generic/siginfo.h>
11
12#ifdef __KERNEL__
13
14#include <linux/compat.h>
15
16#ifdef CONFIG_COMPAT
17
18struct compat_siginfo;
19
20#endif /* CONFIG_COMPAT */
21
22#endif /* __KERNEL__ */
23
24#define SI_NOINFO 32767 /* no information in siginfo_t */
25
26/*
27 * SIGEMT si_codes
28 */
29#define EMT_TAGOVF (__SI_FAULT|1) /* tag overflow */
30#define NSIGEMT 1
31
32#endif
diff --git a/arch/sparc/include/asm/signal.h b/arch/sparc/include/asm/signal.h
index 27ab05dc203e..41535e77b255 100644
--- a/arch/sparc/include/asm/signal.h
+++ b/arch/sparc/include/asm/signal.h
@@ -1,8 +1,210 @@
1#ifndef ___ASM_SPARC_SIGNAL_H 1#ifndef __SPARC_SIGNAL_H
2#define ___ASM_SPARC_SIGNAL_H 2#define __SPARC_SIGNAL_H
3#if defined(__sparc__) && defined(__arch64__) 3
4#include <asm/signal_64.h> 4#include <asm/sigcontext.h>
5#include <linux/compiler.h>
6
7#ifdef __KERNEL__
8#ifndef __ASSEMBLY__
9#include <linux/personality.h>
10#include <linux/types.h>
11#endif
12#endif
13
14/* On the Sparc the signal handlers get passed a 'sub-signal' code
15 * for certain signal types, which we document here.
16 */
17#define SIGHUP 1
18#define SIGINT 2
19#define SIGQUIT 3
20#define SIGILL 4
21#define SUBSIG_STACK 0
22#define SUBSIG_ILLINST 2
23#define SUBSIG_PRIVINST 3
24#define SUBSIG_BADTRAP(t) (0x80 + (t))
25
26#define SIGTRAP 5
27#define SIGABRT 6
28#define SIGIOT 6
29
30#define SIGEMT 7
31#define SUBSIG_TAG 10
32
33#define SIGFPE 8
34#define SUBSIG_FPDISABLED 0x400
35#define SUBSIG_FPERROR 0x404
36#define SUBSIG_FPINTOVFL 0x001
37#define SUBSIG_FPSTSIG 0x002
38#define SUBSIG_IDIVZERO 0x014
39#define SUBSIG_FPINEXACT 0x0c4
40#define SUBSIG_FPDIVZERO 0x0c8
41#define SUBSIG_FPUNFLOW 0x0cc
42#define SUBSIG_FPOPERROR 0x0d0
43#define SUBSIG_FPOVFLOW 0x0d4
44
45#define SIGKILL 9
46#define SIGBUS 10
47#define SUBSIG_BUSTIMEOUT 1
48#define SUBSIG_ALIGNMENT 2
49#define SUBSIG_MISCERROR 5
50
51#define SIGSEGV 11
52#define SUBSIG_NOMAPPING 3
53#define SUBSIG_PROTECTION 4
54#define SUBSIG_SEGERROR 5
55
56#define SIGSYS 12
57
58#define SIGPIPE 13
59#define SIGALRM 14
60#define SIGTERM 15
61#define SIGURG 16
62
63/* SunOS values which deviate from the Linux/i386 ones */
64#define SIGSTOP 17
65#define SIGTSTP 18
66#define SIGCONT 19
67#define SIGCHLD 20
68#define SIGTTIN 21
69#define SIGTTOU 22
70#define SIGIO 23
71#define SIGPOLL SIGIO /* SysV name for SIGIO */
72#define SIGXCPU 24
73#define SIGXFSZ 25
74#define SIGVTALRM 26
75#define SIGPROF 27
76#define SIGWINCH 28
77#define SIGLOST 29
78#define SIGPWR SIGLOST
79#define SIGUSR1 30
80#define SIGUSR2 31
81
82/* Most things should be clean enough to redefine this at will, if care
83 is taken to make libc match. */
84
85#define __OLD_NSIG 32
86#define __NEW_NSIG 64
87#define _NSIG_BPW 64
88#define _NSIG_WORDS (__NEW_NSIG / _NSIG_BPW)
89
90#define SIGRTMIN 32
91#define SIGRTMAX __NEW_NSIG
92
93#if defined(__KERNEL__) || defined(__WANT_POSIX1B_SIGNALS__)
94#define _NSIG __NEW_NSIG
95#define __new_sigset_t sigset_t
96#define __new_sigaction sigaction
97#define __new_sigaction32 sigaction32
98#define __old_sigset_t old_sigset_t
99#define __old_sigaction old_sigaction
100#define __old_sigaction32 old_sigaction32
5#else 101#else
6#include <asm/signal_32.h> 102#define _NSIG __OLD_NSIG
103#define NSIG _NSIG
104#define __old_sigset_t sigset_t
105#define __old_sigaction sigaction
106#define __old_sigaction32 sigaction32
7#endif 107#endif
108
109#ifndef __ASSEMBLY__
110
111typedef unsigned long __old_sigset_t; /* at least 32 bits */
112
113typedef struct {
114 unsigned long sig[_NSIG_WORDS];
115} __new_sigset_t;
116
117/* A SunOS sigstack */
118struct sigstack {
119 /* XXX 32-bit pointers pinhead XXX */
120 char *the_stack;
121 int cur_status;
122};
123
124/* Sigvec flags */
125#define _SV_SSTACK 1u /* This signal handler should use sig-stack */
126#define _SV_INTR 2u /* Sig return should not restart system call */
127#define _SV_RESET 4u /* Set handler to SIG_DFL upon taken signal */
128#define _SV_IGNCHILD 8u /* Do not send SIGCHLD */
129
130/*
131 * sa_flags values: SA_STACK is not currently supported, but will allow the
132 * usage of signal stacks by using the (now obsolete) sa_restorer field in
133 * the sigaction structure as a stack pointer. This is now possible due to
134 * the changes in signal handling. LBT 010493.
135 * SA_RESTART flag to get restarting signals (which were the default long ago)
136 */
137#define SA_NOCLDSTOP _SV_IGNCHILD
138#define SA_STACK _SV_SSTACK
139#define SA_ONSTACK _SV_SSTACK
140#define SA_RESTART _SV_INTR
141#define SA_ONESHOT _SV_RESET
142#define SA_NOMASK 0x20u
143#define SA_NOCLDWAIT 0x100u
144#define SA_SIGINFO 0x200u
145
146
147#define SIG_BLOCK 0x01 /* for blocking signals */
148#define SIG_UNBLOCK 0x02 /* for unblocking signals */
149#define SIG_SETMASK 0x04 /* for setting the signal mask */
150
151/*
152 * sigaltstack controls
153 */
154#define SS_ONSTACK 1
155#define SS_DISABLE 2
156
157#define MINSIGSTKSZ 4096
158#define SIGSTKSZ 16384
159
160#ifdef __KERNEL__
161/*
162 * DJHR
163 * SA_STATIC_ALLOC is used for the sparc32 system to indicate that this
164 * interrupt handler's irq structure should be statically allocated
165 * by the request_irq routine.
166 * The alternative is that arch/sparc/kernel/irq.c has carnal knowledge
167 * of interrupt usage and that sucks. Also without a flag like this
168 * it may be possible for the free_irq routine to attempt to free
169 * statically allocated data.. which is NOT GOOD.
170 *
171 */
172#define SA_STATIC_ALLOC 0x8000
8#endif 173#endif
174
175#include <asm-generic/signal.h>
176
177struct __new_sigaction {
178 __sighandler_t sa_handler;
179 unsigned long sa_flags;
180 __sigrestore_t sa_restorer; /* not used by Linux/SPARC yet */
181 __new_sigset_t sa_mask;
182};
183
184struct __old_sigaction {
185 __sighandler_t sa_handler;
186 __old_sigset_t sa_mask;
187 unsigned long sa_flags;
188 void (*sa_restorer)(void); /* not used by Linux/SPARC yet */
189};
190
191typedef struct sigaltstack {
192 void __user *ss_sp;
193 int ss_flags;
194 size_t ss_size;
195} stack_t;
196
197#ifdef __KERNEL__
198
199struct k_sigaction {
200 struct __new_sigaction sa;
201 void __user *ka_restorer;
202};
203
204#define ptrace_signal_deliver(regs, cookie) do { } while (0)
205
206#endif /* !(__KERNEL__) */
207
208#endif /* !(__ASSEMBLY__) */
209
210#endif /* !(__SPARC_SIGNAL_H) */
diff --git a/arch/sparc/include/asm/signal_32.h b/arch/sparc/include/asm/signal_32.h
deleted file mode 100644
index 96a60ab03ca1..000000000000
--- a/arch/sparc/include/asm/signal_32.h
+++ /dev/null
@@ -1,207 +0,0 @@
1#ifndef _ASMSPARC_SIGNAL_H
2#define _ASMSPARC_SIGNAL_H
3
4#include <asm/sigcontext.h>
5#include <linux/compiler.h>
6
7#ifdef __KERNEL__
8#ifndef __ASSEMBLY__
9#include <linux/personality.h>
10#include <linux/types.h>
11#endif
12#endif
13
14/* On the Sparc the signal handlers get passed a 'sub-signal' code
15 * for certain signal types, which we document here.
16 */
17#define SIGHUP 1
18#define SIGINT 2
19#define SIGQUIT 3
20#define SIGILL 4
21#define SUBSIG_STACK 0
22#define SUBSIG_ILLINST 2
23#define SUBSIG_PRIVINST 3
24#define SUBSIG_BADTRAP(t) (0x80 + (t))
25
26#define SIGTRAP 5
27#define SIGABRT 6
28#define SIGIOT 6
29
30#define SIGEMT 7
31#define SUBSIG_TAG 10
32
33#define SIGFPE 8
34#define SUBSIG_FPDISABLED 0x400
35#define SUBSIG_FPERROR 0x404
36#define SUBSIG_FPINTOVFL 0x001
37#define SUBSIG_FPSTSIG 0x002
38#define SUBSIG_IDIVZERO 0x014
39#define SUBSIG_FPINEXACT 0x0c4
40#define SUBSIG_FPDIVZERO 0x0c8
41#define SUBSIG_FPUNFLOW 0x0cc
42#define SUBSIG_FPOPERROR 0x0d0
43#define SUBSIG_FPOVFLOW 0x0d4
44
45#define SIGKILL 9
46#define SIGBUS 10
47#define SUBSIG_BUSTIMEOUT 1
48#define SUBSIG_ALIGNMENT 2
49#define SUBSIG_MISCERROR 5
50
51#define SIGSEGV 11
52#define SUBSIG_NOMAPPING 3
53#define SUBSIG_PROTECTION 4
54#define SUBSIG_SEGERROR 5
55
56#define SIGSYS 12
57
58#define SIGPIPE 13
59#define SIGALRM 14
60#define SIGTERM 15
61#define SIGURG 16
62
63/* SunOS values which deviate from the Linux/i386 ones */
64#define SIGSTOP 17
65#define SIGTSTP 18
66#define SIGCONT 19
67#define SIGCHLD 20
68#define SIGTTIN 21
69#define SIGTTOU 22
70#define SIGIO 23
71#define SIGPOLL SIGIO /* SysV name for SIGIO */
72#define SIGXCPU 24
73#define SIGXFSZ 25
74#define SIGVTALRM 26
75#define SIGPROF 27
76#define SIGWINCH 28
77#define SIGLOST 29
78#define SIGPWR SIGLOST
79#define SIGUSR1 30
80#define SIGUSR2 31
81
82/* Most things should be clean enough to redefine this at will, if care
83 * is taken to make libc match.
84 */
85
86#define __OLD_NSIG 32
87#define __NEW_NSIG 64
88#define _NSIG_BPW 32
89#define _NSIG_WORDS (__NEW_NSIG / _NSIG_BPW)
90
91#define SIGRTMIN 32
92#define SIGRTMAX __NEW_NSIG
93
94#if defined(__KERNEL__) || defined(__WANT_POSIX1B_SIGNALS__)
95#define _NSIG __NEW_NSIG
96#define __new_sigset_t sigset_t
97#define __new_sigaction sigaction
98#define __old_sigset_t old_sigset_t
99#define __old_sigaction old_sigaction
100#else
101#define _NSIG __OLD_NSIG
102#define __old_sigset_t sigset_t
103#define __old_sigaction sigaction
104#endif
105
106#ifndef __ASSEMBLY__
107
108typedef unsigned long __old_sigset_t;
109
110typedef struct {
111 unsigned long sig[_NSIG_WORDS];
112} __new_sigset_t;
113
114
115#ifdef __KERNEL__
116/* A SunOS sigstack */
117struct sigstack {
118 char *the_stack;
119 int cur_status;
120};
121#endif
122
123/* Sigvec flags */
124#define _SV_SSTACK 1u /* This signal handler should use sig-stack */
125#define _SV_INTR 2u /* Sig return should not restart system call */
126#define _SV_RESET 4u /* Set handler to SIG_DFL upon taken signal */
127#define _SV_IGNCHILD 8u /* Do not send SIGCHLD */
128
129/*
130 * sa_flags values: SA_STACK is not currently supported, but will allow the
131 * usage of signal stacks by using the (now obsolete) sa_restorer field in
132 * the sigaction structure as a stack pointer. This is now possible due to
133 * the changes in signal handling. LBT 010493.
134 * SA_RESTART flag to get restarting signals (which were the default long ago)
135 */
136#define SA_NOCLDSTOP _SV_IGNCHILD
137#define SA_STACK _SV_SSTACK
138#define SA_ONSTACK _SV_SSTACK
139#define SA_RESTART _SV_INTR
140#define SA_ONESHOT _SV_RESET
141#define SA_NOMASK 0x20u
142#define SA_NOCLDWAIT 0x100u
143#define SA_SIGINFO 0x200u
144
145#define SIG_BLOCK 0x01 /* for blocking signals */
146#define SIG_UNBLOCK 0x02 /* for unblocking signals */
147#define SIG_SETMASK 0x04 /* for setting the signal mask */
148
149/*
150 * sigaltstack controls
151 */
152#define SS_ONSTACK 1
153#define SS_DISABLE 2
154
155#define MINSIGSTKSZ 4096
156#define SIGSTKSZ 16384
157
158#ifdef __KERNEL__
159/*
160 * DJHR
161 * SA_STATIC_ALLOC is used for the SPARC system to indicate that this
162 * interrupt handler's irq structure should be statically allocated
163 * by the request_irq routine.
164 * The alternative is that arch/sparc/kernel/irq.c has carnal knowledge
165 * of interrupt usage and that sucks. Also without a flag like this
166 * it may be possible for the free_irq routine to attempt to free
167 * statically allocated data.. which is NOT GOOD.
168 *
169 */
170#define SA_STATIC_ALLOC 0x8000
171#endif
172
173#include <asm-generic/signal.h>
174
175#ifdef __KERNEL__
176struct __new_sigaction {
177 __sighandler_t sa_handler;
178 unsigned long sa_flags;
179 void (*sa_restorer)(void); /* Not used by Linux/SPARC */
180 __new_sigset_t sa_mask;
181};
182
183struct k_sigaction {
184 struct __new_sigaction sa;
185 void __user *ka_restorer;
186};
187
188struct __old_sigaction {
189 __sighandler_t sa_handler;
190 __old_sigset_t sa_mask;
191 unsigned long sa_flags;
192 void (*sa_restorer) (void); /* not used by Linux/SPARC */
193};
194
195typedef struct sigaltstack {
196 void __user *ss_sp;
197 int ss_flags;
198 size_t ss_size;
199} stack_t;
200
201#define ptrace_signal_deliver(regs, cookie) do { } while (0)
202
203#endif /* !(__KERNEL__) */
204
205#endif /* !(__ASSEMBLY__) */
206
207#endif /* !(_ASMSPARC_SIGNAL_H) */
diff --git a/arch/sparc/include/asm/signal_64.h b/arch/sparc/include/asm/signal_64.h
deleted file mode 100644
index ab1509a101c5..000000000000
--- a/arch/sparc/include/asm/signal_64.h
+++ /dev/null
@@ -1,194 +0,0 @@
1#ifndef _ASMSPARC64_SIGNAL_H
2#define _ASMSPARC64_SIGNAL_H
3
4#include <asm/sigcontext.h>
5
6#ifdef __KERNEL__
7#ifndef __ASSEMBLY__
8#include <linux/personality.h>
9#include <linux/types.h>
10#endif
11#endif
12
13/* On the Sparc the signal handlers get passed a 'sub-signal' code
14 * for certain signal types, which we document here.
15 */
16#define SIGHUP 1
17#define SIGINT 2
18#define SIGQUIT 3
19#define SIGILL 4
20#define SUBSIG_STACK 0
21#define SUBSIG_ILLINST 2
22#define SUBSIG_PRIVINST 3
23#define SUBSIG_BADTRAP(t) (0x80 + (t))
24
25#define SIGTRAP 5
26#define SIGABRT 6
27#define SIGIOT 6
28
29#define SIGEMT 7
30#define SUBSIG_TAG 10
31
32#define SIGFPE 8
33#define SUBSIG_FPDISABLED 0x400
34#define SUBSIG_FPERROR 0x404
35#define SUBSIG_FPINTOVFL 0x001
36#define SUBSIG_FPSTSIG 0x002
37#define SUBSIG_IDIVZERO 0x014
38#define SUBSIG_FPINEXACT 0x0c4
39#define SUBSIG_FPDIVZERO 0x0c8
40#define SUBSIG_FPUNFLOW 0x0cc
41#define SUBSIG_FPOPERROR 0x0d0
42#define SUBSIG_FPOVFLOW 0x0d4
43
44#define SIGKILL 9
45#define SIGBUS 10
46#define SUBSIG_BUSTIMEOUT 1
47#define SUBSIG_ALIGNMENT 2
48#define SUBSIG_MISCERROR 5
49
50#define SIGSEGV 11
51#define SUBSIG_NOMAPPING 3
52#define SUBSIG_PROTECTION 4
53#define SUBSIG_SEGERROR 5
54
55#define SIGSYS 12
56
57#define SIGPIPE 13
58#define SIGALRM 14
59#define SIGTERM 15
60#define SIGURG 16
61
62/* SunOS values which deviate from the Linux/i386 ones */
63#define SIGSTOP 17
64#define SIGTSTP 18
65#define SIGCONT 19
66#define SIGCHLD 20
67#define SIGTTIN 21
68#define SIGTTOU 22
69#define SIGIO 23
70#define SIGPOLL SIGIO /* SysV name for SIGIO */
71#define SIGXCPU 24
72#define SIGXFSZ 25
73#define SIGVTALRM 26
74#define SIGPROF 27
75#define SIGWINCH 28
76#define SIGLOST 29
77#define SIGPWR SIGLOST
78#define SIGUSR1 30
79#define SIGUSR2 31
80
81/* Most things should be clean enough to redefine this at will, if care
82 is taken to make libc match. */
83
84#define __OLD_NSIG 32
85#define __NEW_NSIG 64
86#define _NSIG_BPW 64
87#define _NSIG_WORDS (__NEW_NSIG / _NSIG_BPW)
88
89#define SIGRTMIN 32
90#define SIGRTMAX __NEW_NSIG
91
92#if defined(__KERNEL__) || defined(__WANT_POSIX1B_SIGNALS__)
93#define _NSIG __NEW_NSIG
94#define __new_sigset_t sigset_t
95#define __new_sigaction sigaction
96#define __new_sigaction32 sigaction32
97#define __old_sigset_t old_sigset_t
98#define __old_sigaction old_sigaction
99#define __old_sigaction32 old_sigaction32
100#else
101#define _NSIG __OLD_NSIG
102#define NSIG _NSIG
103#define __old_sigset_t sigset_t
104#define __old_sigaction sigaction
105#define __old_sigaction32 sigaction32
106#endif
107
108#ifndef __ASSEMBLY__
109
110typedef unsigned long __old_sigset_t; /* at least 32 bits */
111
112typedef struct {
113 unsigned long sig[_NSIG_WORDS];
114} __new_sigset_t;
115
116/* A SunOS sigstack */
117struct sigstack {
118 /* XXX 32-bit pointers pinhead XXX */
119 char *the_stack;
120 int cur_status;
121};
122
123/* Sigvec flags */
124#define _SV_SSTACK 1u /* This signal handler should use sig-stack */
125#define _SV_INTR 2u /* Sig return should not restart system call */
126#define _SV_RESET 4u /* Set handler to SIG_DFL upon taken signal */
127#define _SV_IGNCHILD 8u /* Do not send SIGCHLD */
128
129/*
130 * sa_flags values: SA_STACK is not currently supported, but will allow the
131 * usage of signal stacks by using the (now obsolete) sa_restorer field in
132 * the sigaction structure as a stack pointer. This is now possible due to
133 * the changes in signal handling. LBT 010493.
134 * SA_RESTART flag to get restarting signals (which were the default long ago)
135 */
136#define SA_NOCLDSTOP _SV_IGNCHILD
137#define SA_STACK _SV_SSTACK
138#define SA_ONSTACK _SV_SSTACK
139#define SA_RESTART _SV_INTR
140#define SA_ONESHOT _SV_RESET
141#define SA_NOMASK 0x20u
142#define SA_NOCLDWAIT 0x100u
143#define SA_SIGINFO 0x200u
144
145
146#define SIG_BLOCK 0x01 /* for blocking signals */
147#define SIG_UNBLOCK 0x02 /* for unblocking signals */
148#define SIG_SETMASK 0x04 /* for setting the signal mask */
149
150/*
151 * sigaltstack controls
152 */
153#define SS_ONSTACK 1
154#define SS_DISABLE 2
155
156#define MINSIGSTKSZ 4096
157#define SIGSTKSZ 16384
158
159#include <asm-generic/signal.h>
160
161struct __new_sigaction {
162 __sighandler_t sa_handler;
163 unsigned long sa_flags;
164 __sigrestore_t sa_restorer; /* not used by Linux/SPARC yet */
165 __new_sigset_t sa_mask;
166};
167
168struct __old_sigaction {
169 __sighandler_t sa_handler;
170 __old_sigset_t sa_mask;
171 unsigned long sa_flags;
172 void (*sa_restorer)(void); /* not used by Linux/SPARC yet */
173};
174
175typedef struct sigaltstack {
176 void __user *ss_sp;
177 int ss_flags;
178 size_t ss_size;
179} stack_t;
180
181#ifdef __KERNEL__
182
183struct k_sigaction {
184 struct __new_sigaction sa;
185 void __user *ka_restorer;
186};
187
188#define ptrace_signal_deliver(regs, cookie) do { } while (0)
189
190#endif /* !(__KERNEL__) */
191
192#endif /* !(__ASSEMBLY__) */
193
194#endif /* !(_ASMSPARC64_SIGNAL_H) */
diff --git a/arch/sparc/include/asm/smp_32.h b/arch/sparc/include/asm/smp_32.h
index a8180e546a48..58101dc70493 100644
--- a/arch/sparc/include/asm/smp_32.h
+++ b/arch/sparc/include/asm/smp_32.h
@@ -29,8 +29,6 @@
29 */ 29 */
30 30
31extern unsigned char boot_cpu_id; 31extern unsigned char boot_cpu_id;
32extern cpumask_t phys_cpu_present_map;
33#define cpu_possible_map phys_cpu_present_map
34 32
35typedef void (*smpfunc_t)(unsigned long, unsigned long, unsigned long, 33typedef void (*smpfunc_t)(unsigned long, unsigned long, unsigned long,
36 unsigned long, unsigned long); 34 unsigned long, unsigned long);
@@ -172,7 +170,4 @@ void smp_setup_cpu_possible_map(void);
172#define smp_setup_cpu_possible_map() do { } while (0) 170#define smp_setup_cpu_possible_map() do { } while (0)
173 171
174#endif /* !(SMP) */ 172#endif /* !(SMP) */
175
176#define NO_PROC_ID 0xFF
177
178#endif /* !(_SPARC_SMP_H) */ 173#endif /* !(_SPARC_SMP_H) */
diff --git a/arch/sparc/include/asm/spinlock_64.h b/arch/sparc/include/asm/spinlock_64.h
index 120cfe4577c7..c4d274d330e9 100644
--- a/arch/sparc/include/asm/spinlock_64.h
+++ b/arch/sparc/include/asm/spinlock_64.h
@@ -13,17 +13,12 @@
13 * and rebuild your kernel. 13 * and rebuild your kernel.
14 */ 14 */
15 15
16/* All of these locking primitives are expected to work properly 16/* Because we play games to save cycles in the non-contention case, we
17 * even in an RMO memory model, which currently is what the kernel 17 * need to be extra careful about branch targets into the "spinning"
18 * runs in. 18 * code. They live in their own section, but the newer V9 branches
19 * 19 * have a shorter range than the traditional 32-bit sparc branch
20 * There is another issue. Because we play games to save cycles 20 * variants. The rule is that the branches that go into and out of
21 * in the non-contention case, we need to be extra careful about 21 * the spinner sections must be pre-V9 branches.
22 * branch targets into the "spinning" code. They live in their
23 * own section, but the newer V9 branches have a shorter range
24 * than the traditional 32-bit sparc branch variants. The rule
25 * is that the branches that go into and out of the spinner sections
26 * must be pre-V9 branches.
27 */ 22 */
28 23
29#define __raw_spin_is_locked(lp) ((lp)->lock != 0) 24#define __raw_spin_is_locked(lp) ((lp)->lock != 0)
@@ -38,12 +33,10 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
38 33
39 __asm__ __volatile__( 34 __asm__ __volatile__(
40"1: ldstub [%1], %0\n" 35"1: ldstub [%1], %0\n"
41" membar #StoreLoad | #StoreStore\n"
42" brnz,pn %0, 2f\n" 36" brnz,pn %0, 2f\n"
43" nop\n" 37" nop\n"
44" .subsection 2\n" 38" .subsection 2\n"
45"2: ldub [%1], %0\n" 39"2: ldub [%1], %0\n"
46" membar #LoadLoad\n"
47" brnz,pt %0, 2b\n" 40" brnz,pt %0, 2b\n"
48" nop\n" 41" nop\n"
49" ba,a,pt %%xcc, 1b\n" 42" ba,a,pt %%xcc, 1b\n"
@@ -59,7 +52,6 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock)
59 52
60 __asm__ __volatile__( 53 __asm__ __volatile__(
61" ldstub [%1], %0\n" 54" ldstub [%1], %0\n"
62" membar #StoreLoad | #StoreStore"
63 : "=r" (result) 55 : "=r" (result)
64 : "r" (lock) 56 : "r" (lock)
65 : "memory"); 57 : "memory");
@@ -70,7 +62,6 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock)
70static inline void __raw_spin_unlock(raw_spinlock_t *lock) 62static inline void __raw_spin_unlock(raw_spinlock_t *lock)
71{ 63{
72 __asm__ __volatile__( 64 __asm__ __volatile__(
73" membar #StoreStore | #LoadStore\n"
74" stb %%g0, [%0]" 65" stb %%g0, [%0]"
75 : /* No outputs */ 66 : /* No outputs */
76 : "r" (lock) 67 : "r" (lock)
@@ -83,14 +74,12 @@ static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long fla
83 74
84 __asm__ __volatile__( 75 __asm__ __volatile__(
85"1: ldstub [%2], %0\n" 76"1: ldstub [%2], %0\n"
86" membar #StoreLoad | #StoreStore\n"
87" brnz,pn %0, 2f\n" 77" brnz,pn %0, 2f\n"
88" nop\n" 78" nop\n"
89" .subsection 2\n" 79" .subsection 2\n"
90"2: rdpr %%pil, %1\n" 80"2: rdpr %%pil, %1\n"
91" wrpr %3, %%pil\n" 81" wrpr %3, %%pil\n"
92"3: ldub [%2], %0\n" 82"3: ldub [%2], %0\n"
93" membar #LoadLoad\n"
94" brnz,pt %0, 3b\n" 83" brnz,pt %0, 3b\n"
95" nop\n" 84" nop\n"
96" ba,pt %%xcc, 1b\n" 85" ba,pt %%xcc, 1b\n"
@@ -113,12 +102,10 @@ static void inline __read_lock(raw_rwlock_t *lock)
113"4: add %0, 1, %1\n" 102"4: add %0, 1, %1\n"
114" cas [%2], %0, %1\n" 103" cas [%2], %0, %1\n"
115" cmp %0, %1\n" 104" cmp %0, %1\n"
116" membar #StoreLoad | #StoreStore\n"
117" bne,pn %%icc, 1b\n" 105" bne,pn %%icc, 1b\n"
118" nop\n" 106" nop\n"
119" .subsection 2\n" 107" .subsection 2\n"
120"2: ldsw [%2], %0\n" 108"2: ldsw [%2], %0\n"
121" membar #LoadLoad\n"
122" brlz,pt %0, 2b\n" 109" brlz,pt %0, 2b\n"
123" nop\n" 110" nop\n"
124" ba,a,pt %%xcc, 4b\n" 111" ba,a,pt %%xcc, 4b\n"
@@ -139,7 +126,6 @@ static int inline __read_trylock(raw_rwlock_t *lock)
139" add %0, 1, %1\n" 126" add %0, 1, %1\n"
140" cas [%2], %0, %1\n" 127" cas [%2], %0, %1\n"
141" cmp %0, %1\n" 128" cmp %0, %1\n"
142" membar #StoreLoad | #StoreStore\n"
143" bne,pn %%icc, 1b\n" 129" bne,pn %%icc, 1b\n"
144" mov 1, %0\n" 130" mov 1, %0\n"
145"2:" 131"2:"
@@ -155,7 +141,6 @@ static void inline __read_unlock(raw_rwlock_t *lock)
155 unsigned long tmp1, tmp2; 141 unsigned long tmp1, tmp2;
156 142
157 __asm__ __volatile__( 143 __asm__ __volatile__(
158" membar #StoreLoad | #LoadLoad\n"
159"1: lduw [%2], %0\n" 144"1: lduw [%2], %0\n"
160" sub %0, 1, %1\n" 145" sub %0, 1, %1\n"
161" cas [%2], %0, %1\n" 146" cas [%2], %0, %1\n"
@@ -179,12 +164,10 @@ static void inline __write_lock(raw_rwlock_t *lock)
179"4: or %0, %3, %1\n" 164"4: or %0, %3, %1\n"
180" cas [%2], %0, %1\n" 165" cas [%2], %0, %1\n"
181" cmp %0, %1\n" 166" cmp %0, %1\n"
182" membar #StoreLoad | #StoreStore\n"
183" bne,pn %%icc, 1b\n" 167" bne,pn %%icc, 1b\n"
184" nop\n" 168" nop\n"
185" .subsection 2\n" 169" .subsection 2\n"
186"2: lduw [%2], %0\n" 170"2: lduw [%2], %0\n"
187" membar #LoadLoad\n"
188" brnz,pt %0, 2b\n" 171" brnz,pt %0, 2b\n"
189" nop\n" 172" nop\n"
190" ba,a,pt %%xcc, 4b\n" 173" ba,a,pt %%xcc, 4b\n"
@@ -197,7 +180,6 @@ static void inline __write_lock(raw_rwlock_t *lock)
197static void inline __write_unlock(raw_rwlock_t *lock) 180static void inline __write_unlock(raw_rwlock_t *lock)
198{ 181{
199 __asm__ __volatile__( 182 __asm__ __volatile__(
200" membar #LoadStore | #StoreStore\n"
201" stw %%g0, [%0]" 183" stw %%g0, [%0]"
202 : /* no outputs */ 184 : /* no outputs */
203 : "r" (lock) 185 : "r" (lock)
@@ -217,7 +199,6 @@ static int inline __write_trylock(raw_rwlock_t *lock)
217" or %0, %4, %1\n" 199" or %0, %4, %1\n"
218" cas [%3], %0, %1\n" 200" cas [%3], %0, %1\n"
219" cmp %0, %1\n" 201" cmp %0, %1\n"
220" membar #StoreLoad | #StoreStore\n"
221" bne,pn %%icc, 1b\n" 202" bne,pn %%icc, 1b\n"
222" nop\n" 203" nop\n"
223" mov 1, %2\n" 204" mov 1, %2\n"
diff --git a/arch/sparc/include/asm/spitfire.h b/arch/sparc/include/asm/spitfire.h
index 985ea7e31992..f0d0c40c44da 100644
--- a/arch/sparc/include/asm/spitfire.h
+++ b/arch/sparc/include/asm/spitfire.h
@@ -6,6 +6,8 @@
6#ifndef _SPARC64_SPITFIRE_H 6#ifndef _SPARC64_SPITFIRE_H
7#define _SPARC64_SPITFIRE_H 7#define _SPARC64_SPITFIRE_H
8 8
9#ifdef CONFIG_SPARC64
10
9#include <asm/asi.h> 11#include <asm/asi.h>
10 12
11/* The following register addresses are accessible via ASI_DMMU 13/* The following register addresses are accessible via ASI_DMMU
@@ -338,5 +340,5 @@ static inline void cheetah_put_itlb_data(int entry, unsigned long data)
338} 340}
339 341
340#endif /* !(__ASSEMBLY__) */ 342#endif /* !(__ASSEMBLY__) */
341 343#endif /* CONFIG_SPARC64 */
342#endif /* !(_SPARC64_SPITFIRE_H) */ 344#endif /* !(_SPARC64_SPITFIRE_H) */
diff --git a/arch/sparc/include/asm/stat.h b/arch/sparc/include/asm/stat.h
index d8153013df72..55db5eca08e2 100644
--- a/arch/sparc/include/asm/stat.h
+++ b/arch/sparc/include/asm/stat.h
@@ -1,8 +1,107 @@
1#ifndef ___ASM_SPARC_STAT_H 1#ifndef __SPARC_STAT_H
2#define ___ASM_SPARC_STAT_H 2#define __SPARC_STAT_H
3
4#include <linux/types.h>
5
3#if defined(__sparc__) && defined(__arch64__) 6#if defined(__sparc__) && defined(__arch64__)
4#include <asm/stat_64.h> 7/* 64 bit sparc */
8struct stat {
9 unsigned st_dev;
10 ino_t st_ino;
11 mode_t st_mode;
12 short st_nlink;
13 uid_t st_uid;
14 gid_t st_gid;
15 unsigned st_rdev;
16 off_t st_size;
17 time_t st_atime;
18 time_t st_mtime;
19 time_t st_ctime;
20 off_t st_blksize;
21 off_t st_blocks;
22 unsigned long __unused4[2];
23};
24
25struct stat64 {
26 unsigned long st_dev;
27 unsigned long st_ino;
28 unsigned long st_nlink;
29
30 unsigned int st_mode;
31 unsigned int st_uid;
32 unsigned int st_gid;
33 unsigned int __pad0;
34
35 unsigned long st_rdev;
36 long st_size;
37 long st_blksize;
38 long st_blocks;
39
40 unsigned long st_atime;
41 unsigned long st_atime_nsec;
42 unsigned long st_mtime;
43 unsigned long st_mtime_nsec;
44 unsigned long st_ctime;
45 unsigned long st_ctime_nsec;
46 long __unused[3];
47};
48
5#else 49#else
6#include <asm/stat_32.h> 50/* 32 bit sparc */
7#endif 51struct stat {
8#endif 52 unsigned short st_dev;
53 ino_t st_ino;
54 mode_t st_mode;
55 short st_nlink;
56 uid_t st_uid;
57 gid_t st_gid;
58 unsigned short st_rdev;
59 off_t st_size;
60 time_t st_atime;
61 unsigned long st_atime_nsec;
62 time_t st_mtime;
63 unsigned long st_mtime_nsec;
64 time_t st_ctime;
65 unsigned long st_ctime_nsec;
66 off_t st_blksize;
67 off_t st_blocks;
68 unsigned long __unused4[2];
69};
70
71#define STAT_HAVE_NSEC 1
72
73struct stat64 {
74 unsigned long long st_dev;
75
76 unsigned long long st_ino;
77
78 unsigned int st_mode;
79 unsigned int st_nlink;
80
81 unsigned int st_uid;
82 unsigned int st_gid;
83
84 unsigned long long st_rdev;
85
86 unsigned char __pad3[8];
87
88 long long st_size;
89 unsigned int st_blksize;
90
91 unsigned char __pad4[8];
92 unsigned int st_blocks;
93
94 unsigned int st_atime;
95 unsigned int st_atime_nsec;
96
97 unsigned int st_mtime;
98 unsigned int st_mtime_nsec;
99
100 unsigned int st_ctime;
101 unsigned int st_ctime_nsec;
102
103 unsigned int __unused4;
104 unsigned int __unused5;
105};
106#endif /* defined(__sparc__) && defined(__arch64__) */
107#endif /* __SPARC_STAT_H */
diff --git a/arch/sparc/include/asm/stat_32.h b/arch/sparc/include/asm/stat_32.h
deleted file mode 100644
index 2299e1d5d94c..000000000000
--- a/arch/sparc/include/asm/stat_32.h
+++ /dev/null
@@ -1,76 +0,0 @@
1#ifndef _SPARC_STAT_H
2#define _SPARC_STAT_H
3
4#include <linux/types.h>
5
6struct __old_kernel_stat {
7 unsigned short st_dev;
8 unsigned short st_ino;
9 unsigned short st_mode;
10 unsigned short st_nlink;
11 unsigned short st_uid;
12 unsigned short st_gid;
13 unsigned short st_rdev;
14 unsigned long st_size;
15 unsigned long st_atime;
16 unsigned long st_mtime;
17 unsigned long st_ctime;
18};
19
20struct stat {
21 unsigned short st_dev;
22 unsigned long st_ino;
23 unsigned short st_mode;
24 short st_nlink;
25 unsigned short st_uid;
26 unsigned short st_gid;
27 unsigned short st_rdev;
28 long st_size;
29 long st_atime;
30 unsigned long st_atime_nsec;
31 long st_mtime;
32 unsigned long st_mtime_nsec;
33 long st_ctime;
34 unsigned long st_ctime_nsec;
35 long st_blksize;
36 long st_blocks;
37 unsigned long __unused4[2];
38};
39
40#define STAT_HAVE_NSEC 1
41
42struct stat64 {
43 unsigned long long st_dev;
44
45 unsigned long long st_ino;
46
47 unsigned int st_mode;
48 unsigned int st_nlink;
49
50 unsigned int st_uid;
51 unsigned int st_gid;
52
53 unsigned long long st_rdev;
54
55 unsigned char __pad3[8];
56
57 long long st_size;
58 unsigned int st_blksize;
59
60 unsigned char __pad4[8];
61 unsigned int st_blocks;
62
63 unsigned int st_atime;
64 unsigned int st_atime_nsec;
65
66 unsigned int st_mtime;
67 unsigned int st_mtime_nsec;
68
69 unsigned int st_ctime;
70 unsigned int st_ctime_nsec;
71
72 unsigned int __unused4;
73 unsigned int __unused5;
74};
75
76#endif
diff --git a/arch/sparc/include/asm/stat_64.h b/arch/sparc/include/asm/stat_64.h
deleted file mode 100644
index 9650fdea847f..000000000000
--- a/arch/sparc/include/asm/stat_64.h
+++ /dev/null
@@ -1,47 +0,0 @@
1#ifndef _SPARC64_STAT_H
2#define _SPARC64_STAT_H
3
4#include <linux/types.h>
5
6struct stat {
7 unsigned st_dev;
8 ino_t st_ino;
9 mode_t st_mode;
10 short st_nlink;
11 uid_t st_uid;
12 gid_t st_gid;
13 unsigned st_rdev;
14 off_t st_size;
15 time_t st_atime;
16 time_t st_mtime;
17 time_t st_ctime;
18 off_t st_blksize;
19 off_t st_blocks;
20 unsigned long __unused4[2];
21};
22
23struct stat64 {
24 unsigned long st_dev;
25 unsigned long st_ino;
26 unsigned long st_nlink;
27
28 unsigned int st_mode;
29 unsigned int st_uid;
30 unsigned int st_gid;
31 unsigned int __pad0;
32
33 unsigned long st_rdev;
34 long st_size;
35 long st_blksize;
36 long st_blocks;
37
38 unsigned long st_atime;
39 unsigned long st_atime_nsec;
40 unsigned long st_mtime;
41 unsigned long st_mtime_nsec;
42 unsigned long st_ctime;
43 unsigned long st_ctime_nsec;
44 long __unused[3];
45};
46
47#endif
diff --git a/arch/sparc/include/asm/system_32.h b/arch/sparc/include/asm/system_32.h
index 8623fc48fe24..79c1ae2b42a3 100644
--- a/arch/sparc/include/asm/system_32.h
+++ b/arch/sparc/include/asm/system_32.h
@@ -15,6 +15,11 @@
15 15
16#include <linux/irqflags.h> 16#include <linux/irqflags.h>
17 17
18static inline unsigned int probe_irq_mask(unsigned long val)
19{
20 return 0;
21}
22
18/* 23/*
19 * Sparc (general) CPU types 24 * Sparc (general) CPU types
20 */ 25 */
diff --git a/arch/sparc/include/asm/system_64.h b/arch/sparc/include/asm/system_64.h
index 8759f2a1b837..6c077816ab28 100644
--- a/arch/sparc/include/asm/system_64.h
+++ b/arch/sparc/include/asm/system_64.h
@@ -59,20 +59,9 @@ do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \
59 : : : "memory"); \ 59 : : : "memory"); \
60} while (0) 60} while (0)
61 61
62#define mb() \ 62#define mb() membar_safe("#StoreLoad")
63 membar_safe("#LoadLoad | #LoadStore | #StoreStore | #StoreLoad") 63#define rmb() __asm__ __volatile__("":::"memory")
64#define rmb() \ 64#define wmb() __asm__ __volatile__("":::"memory")
65 membar_safe("#LoadLoad")
66#define wmb() \
67 membar_safe("#StoreStore")
68#define membar_storeload() \
69 membar_safe("#StoreLoad")
70#define membar_storeload_storestore() \
71 membar_safe("#StoreLoad | #StoreStore")
72#define membar_storeload_loadload() \
73 membar_safe("#StoreLoad | #LoadLoad")
74#define membar_storestore_loadstore() \
75 membar_safe("#StoreStore | #LoadStore")
76 65
77#endif 66#endif
78 67
@@ -80,20 +69,20 @@ do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \
80 69
81#define read_barrier_depends() do { } while(0) 70#define read_barrier_depends() do { } while(0)
82#define set_mb(__var, __value) \ 71#define set_mb(__var, __value) \
83 do { __var = __value; membar_storeload_storestore(); } while(0) 72 do { __var = __value; membar_safe("#StoreLoad"); } while(0)
84 73
85#ifdef CONFIG_SMP 74#ifdef CONFIG_SMP
86#define smp_mb() mb() 75#define smp_mb() mb()
87#define smp_rmb() rmb() 76#define smp_rmb() rmb()
88#define smp_wmb() wmb() 77#define smp_wmb() wmb()
89#define smp_read_barrier_depends() read_barrier_depends()
90#else 78#else
91#define smp_mb() __asm__ __volatile__("":::"memory") 79#define smp_mb() __asm__ __volatile__("":::"memory")
92#define smp_rmb() __asm__ __volatile__("":::"memory") 80#define smp_rmb() __asm__ __volatile__("":::"memory")
93#define smp_wmb() __asm__ __volatile__("":::"memory") 81#define smp_wmb() __asm__ __volatile__("":::"memory")
94#define smp_read_barrier_depends() do { } while(0)
95#endif 82#endif
96 83
84#define smp_read_barrier_depends() do { } while(0)
85
97#define flushi(addr) __asm__ __volatile__ ("flush %0" : : "r" (addr) : "memory") 86#define flushi(addr) __asm__ __volatile__ ("flush %0" : : "r" (addr) : "memory")
98 87
99#define flushw_all() __asm__ __volatile__("flushw") 88#define flushw_all() __asm__ __volatile__("flushw")
@@ -107,11 +96,12 @@ do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \
107 * arch/sparc64/kernel/smp.c:smp_percpu_timer_interrupt() 96 * arch/sparc64/kernel/smp.c:smp_percpu_timer_interrupt()
108 * for more information. 97 * for more information.
109 */ 98 */
110#define reset_pic() \ 99#define write_pic(__p) \
111 __asm__ __volatile__("ba,pt %xcc, 99f\n\t" \ 100 __asm__ __volatile__("ba,pt %%xcc, 99f\n\t" \
112 ".align 64\n" \ 101 ".align 64\n" \
113 "99:wr %g0, 0x0, %pic\n\t" \ 102 "99:wr %0, 0x0, %%pic\n\t" \
114 "rd %pic, %g0") 103 "rd %%pic, %%g0" : : "r" (__p))
104#define reset_pic() write_pic(0)
115 105
116#ifndef __ASSEMBLY__ 106#ifndef __ASSEMBLY__
117 107
@@ -170,6 +160,7 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \
170 "stb %%o5, [%%g6 + %5]\n\t" \ 160 "stb %%o5, [%%g6 + %5]\n\t" \
171 "rdpr %%cwp, %%o5\n\t" \ 161 "rdpr %%cwp, %%o5\n\t" \
172 "stb %%o5, [%%g6 + %8]\n\t" \ 162 "stb %%o5, [%%g6 + %8]\n\t" \
163 "wrpr %%g0, 15, %%pil\n\t" \
173 "mov %4, %%g6\n\t" \ 164 "mov %4, %%g6\n\t" \
174 "ldub [%4 + %8], %%g1\n\t" \ 165 "ldub [%4 + %8], %%g1\n\t" \
175 "wrpr %%g1, %%cwp\n\t" \ 166 "wrpr %%g1, %%cwp\n\t" \
@@ -180,6 +171,7 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \
180 "ldx [%%sp + 2047 + 0x70], %%i6\n\t" \ 171 "ldx [%%sp + 2047 + 0x70], %%i6\n\t" \
181 "ldx [%%sp + 2047 + 0x78], %%i7\n\t" \ 172 "ldx [%%sp + 2047 + 0x78], %%i7\n\t" \
182 "ldx [%%g6 + %9], %%g4\n\t" \ 173 "ldx [%%g6 + %9], %%g4\n\t" \
174 "wrpr %%g0, 14, %%pil\n\t" \
183 "brz,pt %%o7, switch_to_pc\n\t" \ 175 "brz,pt %%o7, switch_to_pc\n\t" \
184 " mov %%g7, %0\n\t" \ 176 " mov %%g7, %0\n\t" \
185 "sethi %%hi(ret_from_syscall), %%g1\n\t" \ 177 "sethi %%hi(ret_from_syscall), %%g1\n\t" \
@@ -209,14 +201,12 @@ static inline unsigned long xchg32(__volatile__ unsigned int *m, unsigned int va
209 unsigned long tmp1, tmp2; 201 unsigned long tmp1, tmp2;
210 202
211 __asm__ __volatile__( 203 __asm__ __volatile__(
212" membar #StoreLoad | #LoadLoad\n"
213" mov %0, %1\n" 204" mov %0, %1\n"
214"1: lduw [%4], %2\n" 205"1: lduw [%4], %2\n"
215" cas [%4], %2, %0\n" 206" cas [%4], %2, %0\n"
216" cmp %2, %0\n" 207" cmp %2, %0\n"
217" bne,a,pn %%icc, 1b\n" 208" bne,a,pn %%icc, 1b\n"
218" mov %1, %0\n" 209" mov %1, %0\n"
219" membar #StoreLoad | #StoreStore\n"
220 : "=&r" (val), "=&r" (tmp1), "=&r" (tmp2) 210 : "=&r" (val), "=&r" (tmp1), "=&r" (tmp2)
221 : "0" (val), "r" (m) 211 : "0" (val), "r" (m)
222 : "cc", "memory"); 212 : "cc", "memory");
@@ -228,14 +218,12 @@ static inline unsigned long xchg64(__volatile__ unsigned long *m, unsigned long
228 unsigned long tmp1, tmp2; 218 unsigned long tmp1, tmp2;
229 219
230 __asm__ __volatile__( 220 __asm__ __volatile__(
231" membar #StoreLoad | #LoadLoad\n"
232" mov %0, %1\n" 221" mov %0, %1\n"
233"1: ldx [%4], %2\n" 222"1: ldx [%4], %2\n"
234" casx [%4], %2, %0\n" 223" casx [%4], %2, %0\n"
235" cmp %2, %0\n" 224" cmp %2, %0\n"
236" bne,a,pn %%xcc, 1b\n" 225" bne,a,pn %%xcc, 1b\n"
237" mov %1, %0\n" 226" mov %1, %0\n"
238" membar #StoreLoad | #StoreStore\n"
239 : "=&r" (val), "=&r" (tmp1), "=&r" (tmp2) 227 : "=&r" (val), "=&r" (tmp1), "=&r" (tmp2)
240 : "0" (val), "r" (m) 228 : "0" (val), "r" (m)
241 : "cc", "memory"); 229 : "cc", "memory");
@@ -272,9 +260,7 @@ extern void die_if_kernel(char *str, struct pt_regs *regs) __attribute__ ((noret
272static inline unsigned long 260static inline unsigned long
273__cmpxchg_u32(volatile int *m, int old, int new) 261__cmpxchg_u32(volatile int *m, int old, int new)
274{ 262{
275 __asm__ __volatile__("membar #StoreLoad | #LoadLoad\n" 263 __asm__ __volatile__("cas [%2], %3, %0"
276 "cas [%2], %3, %0\n\t"
277 "membar #StoreLoad | #StoreStore"
278 : "=&r" (new) 264 : "=&r" (new)
279 : "0" (new), "r" (m), "r" (old) 265 : "0" (new), "r" (m), "r" (old)
280 : "memory"); 266 : "memory");
@@ -285,9 +271,7 @@ __cmpxchg_u32(volatile int *m, int old, int new)
285static inline unsigned long 271static inline unsigned long
286__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new) 272__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
287{ 273{
288 __asm__ __volatile__("membar #StoreLoad | #LoadLoad\n" 274 __asm__ __volatile__("casx [%2], %3, %0"
289 "casx [%2], %3, %0\n\t"
290 "membar #StoreLoad | #StoreStore"
291 : "=&r" (new) 275 : "=&r" (new)
292 : "0" (new), "r" (m), "r" (old) 276 : "0" (new), "r" (m), "r" (old)
293 : "memory"); 277 : "memory");
diff --git a/arch/sparc/include/asm/thread_info_32.h b/arch/sparc/include/asm/thread_info_32.h
index 80fe547c3f45..0f7b0e5fb1c7 100644
--- a/arch/sparc/include/asm/thread_info_32.h
+++ b/arch/sparc/include/asm/thread_info_32.h
@@ -45,7 +45,7 @@ struct thread_info {
45 /* A place to store user windows and stack pointers 45 /* A place to store user windows and stack pointers
46 * when the stack needs inspection. 46 * when the stack needs inspection.
47 */ 47 */
48 struct reg_window reg_window[NSWINS]; /* align for ldd! */ 48 struct reg_window32 reg_window[NSWINS]; /* align for ldd! */
49 unsigned long rwbuf_stkptrs[NSWINS]; 49 unsigned long rwbuf_stkptrs[NSWINS];
50 unsigned long w_saved; 50 unsigned long w_saved;
51 51
diff --git a/arch/sparc/include/asm/topology_64.h b/arch/sparc/include/asm/topology_64.h
index 001c04027c82..b8a65b64e1df 100644
--- a/arch/sparc/include/asm/topology_64.h
+++ b/arch/sparc/include/asm/topology_64.h
@@ -16,8 +16,12 @@ static inline cpumask_t node_to_cpumask(int node)
16{ 16{
17 return numa_cpumask_lookup_table[node]; 17 return numa_cpumask_lookup_table[node];
18} 18}
19#define cpumask_of_node(node) (&numa_cpumask_lookup_table[node])
19 20
20/* Returns a pointer to the cpumask of CPUs on Node 'node'. */ 21/*
22 * Returns a pointer to the cpumask of CPUs on Node 'node'.
23 * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)"
24 */
21#define node_to_cpumask_ptr(v, node) \ 25#define node_to_cpumask_ptr(v, node) \
22 cpumask_t *v = &(numa_cpumask_lookup_table[node]) 26 cpumask_t *v = &(numa_cpumask_lookup_table[node])
23 27
@@ -26,9 +30,7 @@ static inline cpumask_t node_to_cpumask(int node)
26 30
27static inline int node_to_first_cpu(int node) 31static inline int node_to_first_cpu(int node)
28{ 32{
29 cpumask_t tmp; 33 return cpumask_first(cpumask_of_node(node));
30 tmp = node_to_cpumask(node);
31 return first_cpu(tmp);
32} 34}
33 35
34struct pci_bus; 36struct pci_bus;
@@ -77,10 +79,13 @@ static inline int pcibus_to_node(struct pci_bus *pbus)
77#define topology_core_id(cpu) (cpu_data(cpu).core_id) 79#define topology_core_id(cpu) (cpu_data(cpu).core_id)
78#define topology_core_siblings(cpu) (cpu_core_map[cpu]) 80#define topology_core_siblings(cpu) (cpu_core_map[cpu])
79#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) 81#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu))
82#define topology_core_cpumask(cpu) (&cpu_core_map[cpu])
83#define topology_thread_cpumask(cpu) (&per_cpu(cpu_sibling_map, cpu))
80#define mc_capable() (sparc64_multi_core) 84#define mc_capable() (sparc64_multi_core)
81#define smt_capable() (sparc64_multi_core) 85#define smt_capable() (sparc64_multi_core)
82#endif /* CONFIG_SMP */ 86#endif /* CONFIG_SMP */
83 87
84#define cpu_coregroup_map(cpu) (cpu_core_map[cpu]) 88#define cpu_coregroup_map(cpu) (cpu_core_map[cpu])
89#define cpu_coregroup_mask(cpu) (&cpu_core_map[cpu])
85 90
86#endif /* _ASM_SPARC64_TOPOLOGY_H */ 91#endif /* _ASM_SPARC64_TOPOLOGY_H */
diff --git a/arch/sparc/include/asm/traps.h b/arch/sparc/include/asm/traps.h
index bebdbf8f43a8..3aa62dde343f 100644
--- a/arch/sparc/include/asm/traps.h
+++ b/arch/sparc/include/asm/traps.h
@@ -10,7 +10,7 @@
10#define NUM_SPARC_TRAPS 255 10#define NUM_SPARC_TRAPS 255
11 11
12#ifndef __ASSEMBLY__ 12#ifndef __ASSEMBLY__
13 13#ifdef __KERNEL__
14/* This is for V8 compliant Sparc CPUS */ 14/* This is for V8 compliant Sparc CPUS */
15struct tt_entry { 15struct tt_entry {
16 unsigned long inst_one; 16 unsigned long inst_one;
@@ -22,14 +22,7 @@ struct tt_entry {
22/* We set this to _start in system setup. */ 22/* We set this to _start in system setup. */
23extern struct tt_entry *sparc_ttable; 23extern struct tt_entry *sparc_ttable;
24 24
25static inline unsigned long get_tbr(void) 25#endif /* (__KERNEL__) */
26{
27 unsigned long tbr;
28
29 __asm__ __volatile__("rd %%tbr, %0\n\t" : "=r" (tbr));
30 return tbr;
31}
32
33#endif /* !(__ASSEMBLY__) */ 26#endif /* !(__ASSEMBLY__) */
34 27
35/* For patching the trap table at boot time, we need to know how to 28/* For patching the trap table at boot time, we need to know how to
diff --git a/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h
index 76e4299dd9bc..83c571d8c8a7 100644
--- a/arch/sparc/include/asm/tsb.h
+++ b/arch/sparc/include/asm/tsb.h
@@ -50,8 +50,6 @@
50#define TSB_TAG_INVALID_BIT 46 50#define TSB_TAG_INVALID_BIT 46
51#define TSB_TAG_INVALID_HIGH (1 << (TSB_TAG_INVALID_BIT - 32)) 51#define TSB_TAG_INVALID_HIGH (1 << (TSB_TAG_INVALID_BIT - 32))
52 52
53#define TSB_MEMBAR membar #StoreStore
54
55/* Some cpus support physical address quad loads. We want to use 53/* Some cpus support physical address quad loads. We want to use
56 * those if possible so we don't need to hard-lock the TSB mapping 54 * those if possible so we don't need to hard-lock the TSB mapping
57 * into the TLB. We encode some instruction patching in order to 55 * into the TLB. We encode some instruction patching in order to
@@ -128,13 +126,11 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
128 cmp REG1, REG2; \ 126 cmp REG1, REG2; \
129 bne,pn %icc, 99b; \ 127 bne,pn %icc, 99b; \
130 nop; \ 128 nop; \
131 TSB_MEMBAR
132 129
133#define TSB_WRITE(TSB, TTE, TAG) \ 130#define TSB_WRITE(TSB, TTE, TAG) \
134 add TSB, 0x8, TSB; \ 131 add TSB, 0x8, TSB; \
135 TSB_STORE(TSB, TTE); \ 132 TSB_STORE(TSB, TTE); \
136 sub TSB, 0x8, TSB; \ 133 sub TSB, 0x8, TSB; \
137 TSB_MEMBAR; \
138 TSB_STORE(TSB, TAG); 134 TSB_STORE(TSB, TAG);
139 135
140#define KTSB_LOAD_QUAD(TSB, REG) \ 136#define KTSB_LOAD_QUAD(TSB, REG) \
@@ -153,13 +149,11 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
153 cmp REG1, REG2; \ 149 cmp REG1, REG2; \
154 bne,pn %icc, 99b; \ 150 bne,pn %icc, 99b; \
155 nop; \ 151 nop; \
156 TSB_MEMBAR
157 152
158#define KTSB_WRITE(TSB, TTE, TAG) \ 153#define KTSB_WRITE(TSB, TTE, TAG) \
159 add TSB, 0x8, TSB; \ 154 add TSB, 0x8, TSB; \
160 stxa TTE, [TSB] ASI_N; \ 155 stxa TTE, [TSB] ASI_N; \
161 sub TSB, 0x8, TSB; \ 156 sub TSB, 0x8, TSB; \
162 TSB_MEMBAR; \
163 stxa TAG, [TSB] ASI_N; 157 stxa TAG, [TSB] ASI_N;
164 158
165 /* Do a kernel page table walk. Leaves physical PTE pointer in 159 /* Do a kernel page table walk. Leaves physical PTE pointer in
diff --git a/arch/sparc/include/asm/ttable.h b/arch/sparc/include/asm/ttable.h
index 5708ba2719fb..48f2807d3265 100644
--- a/arch/sparc/include/asm/ttable.h
+++ b/arch/sparc/include/asm/ttable.h
@@ -2,6 +2,7 @@
2#define _SPARC64_TTABLE_H 2#define _SPARC64_TTABLE_H
3 3
4#include <asm/utrap.h> 4#include <asm/utrap.h>
5#include <asm/pil.h>
5 6
6#ifdef __ASSEMBLY__ 7#ifdef __ASSEMBLY__
7#include <asm/thread_info.h> 8#include <asm/thread_info.h>
@@ -123,7 +124,7 @@
123 124
124#define TRAP_IRQ(routine, level) \ 125#define TRAP_IRQ(routine, level) \
125 rdpr %pil, %g2; \ 126 rdpr %pil, %g2; \
126 wrpr %g0, 15, %pil; \ 127 wrpr %g0, PIL_NORMAL_MAX, %pil; \
127 sethi %hi(1f-4), %g7; \ 128 sethi %hi(1f-4), %g7; \
128 ba,pt %xcc, etrap_irq; \ 129 ba,pt %xcc, etrap_irq; \
129 or %g7, %lo(1f-4), %g7; \ 130 or %g7, %lo(1f-4), %g7; \
@@ -143,7 +144,7 @@
143 144
144#define TRAP_IRQ(routine, level) \ 145#define TRAP_IRQ(routine, level) \
145 rdpr %pil, %g2; \ 146 rdpr %pil, %g2; \
146 wrpr %g0, 15, %pil; \ 147 wrpr %g0, PIL_NORMAL_MAX, %pil; \
147 ba,pt %xcc, etrap_irq; \ 148 ba,pt %xcc, etrap_irq; \
148 rd %pc, %g7; \ 149 rd %pc, %g7; \
149 mov level, %o0; \ 150 mov level, %o0; \
@@ -153,6 +154,16 @@
153 154
154#endif 155#endif
155 156
157#define TRAP_NMI_IRQ(routine, level) \
158 rdpr %pil, %g2; \
159 wrpr %g0, PIL_NMI, %pil; \
160 ba,pt %xcc, etrap_irq; \
161 rd %pc, %g7; \
162 mov level, %o0; \
163 call routine; \
164 add %sp, PTREGS_OFF, %o1; \
165 ba,a,pt %xcc, rtrap_nmi;
166
156#define TRAP_IVEC TRAP_NOSAVE(do_ivec) 167#define TRAP_IVEC TRAP_NOSAVE(do_ivec)
157 168
158#define BTRAP(lvl) TRAP_ARG(bad_trap, lvl) 169#define BTRAP(lvl) TRAP_ARG(bad_trap, lvl)
diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h
index 4207fb362da0..031f038b19f7 100644
--- a/arch/sparc/include/asm/unistd.h
+++ b/arch/sparc/include/asm/unistd.h
@@ -1,8 +1,444 @@
1#ifndef ___ASM_SPARC_UNISTD_H 1#ifndef _SPARC_UNISTD_H
2#define ___ASM_SPARC_UNISTD_H 2#define _SPARC_UNISTD_H
3#if defined(__sparc__) && defined(__arch64__) 3
4#include <asm/unistd_64.h> 4/*
5 * System calls under the Sparc.
6 *
7 * Don't be scared by the ugly clobbers, it is the only way I can
8 * think of right now to force the arguments into fixed registers
9 * before the trap into the system call with gcc 'asm' statements.
10 *
11 * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net)
12 *
13 * SunOS compatibility based upon preliminary work which is:
14 *
15 * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu)
16 */
17#ifndef __32bit_syscall_numbers__
18#ifndef __arch64__
19#define __32bit_syscall_numbers__
20#endif
21#endif
22
23#define __NR_restart_syscall 0 /* Linux Specific */
24#define __NR_exit 1 /* Common */
25#define __NR_fork 2 /* Common */
26#define __NR_read 3 /* Common */
27#define __NR_write 4 /* Common */
28#define __NR_open 5 /* Common */
29#define __NR_close 6 /* Common */
30#define __NR_wait4 7 /* Common */
31#define __NR_creat 8 /* Common */
32#define __NR_link 9 /* Common */
33#define __NR_unlink 10 /* Common */
34#define __NR_execv 11 /* SunOS Specific */
35#define __NR_chdir 12 /* Common */
36#define __NR_chown 13 /* Common */
37#define __NR_mknod 14 /* Common */
38#define __NR_chmod 15 /* Common */
39#define __NR_lchown 16 /* Common */
40#define __NR_brk 17 /* Common */
41#define __NR_perfctr 18 /* Performance counter operations */
42#define __NR_lseek 19 /* Common */
43#define __NR_getpid 20 /* Common */
44#define __NR_capget 21 /* Linux Specific */
45#define __NR_capset 22 /* Linux Specific */
46#define __NR_setuid 23 /* Implemented via setreuid in SunOS */
47#define __NR_getuid 24 /* Common */
48#define __NR_vmsplice 25 /* ENOSYS under SunOS */
49#define __NR_ptrace 26 /* Common */
50#define __NR_alarm 27 /* Implemented via setitimer in SunOS */
51#define __NR_sigaltstack 28 /* Common */
52#define __NR_pause 29 /* Is sigblock(0)->sigpause() in SunOS */
53#define __NR_utime 30 /* Implemented via utimes() under SunOS */
54#ifdef __32bit_syscall_numbers__
55#define __NR_lchown32 31 /* Linux sparc32 specific */
56#define __NR_fchown32 32 /* Linux sparc32 specific */
57#endif
58#define __NR_access 33 /* Common */
59#define __NR_nice 34 /* Implemented via get/setpriority() in SunOS */
60#ifdef __32bit_syscall_numbers__
61#define __NR_chown32 35 /* Linux sparc32 specific */
62#endif
63#define __NR_sync 36 /* Common */
64#define __NR_kill 37 /* Common */
65#define __NR_stat 38 /* Common */
66#define __NR_sendfile 39 /* Linux Specific */
67#define __NR_lstat 40 /* Common */
68#define __NR_dup 41 /* Common */
69#define __NR_pipe 42 /* Common */
70#define __NR_times 43 /* Implemented via getrusage() in SunOS */
71#ifdef __32bit_syscall_numbers__
72#define __NR_getuid32 44 /* Linux sparc32 specific */
73#endif
74#define __NR_umount2 45 /* Linux Specific */
75#define __NR_setgid 46 /* Implemented via setregid() in SunOS */
76#define __NR_getgid 47 /* Common */
77#define __NR_signal 48 /* Implemented via sigvec() in SunOS */
78#define __NR_geteuid 49 /* SunOS calls getuid() */
79#define __NR_getegid 50 /* SunOS calls getgid() */
80#define __NR_acct 51 /* Common */
81#ifdef __32bit_syscall_numbers__
82#define __NR_getgid32 53 /* Linux sparc32 specific */
83#else
84#define __NR_memory_ordering 52 /* Linux Specific */
85#endif
86#define __NR_ioctl 54 /* Common */
87#define __NR_reboot 55 /* Common */
88#ifdef __32bit_syscall_numbers__
89#define __NR_mmap2 56 /* Linux sparc32 Specific */
90#endif
91#define __NR_symlink 57 /* Common */
92#define __NR_readlink 58 /* Common */
93#define __NR_execve 59 /* Common */
94#define __NR_umask 60 /* Common */
95#define __NR_chroot 61 /* Common */
96#define __NR_fstat 62 /* Common */
97#define __NR_fstat64 63 /* Linux Specific */
98#define __NR_getpagesize 64 /* Common */
99#define __NR_msync 65 /* Common in newer 1.3.x revs... */
100#define __NR_vfork 66 /* Common */
101#define __NR_pread64 67 /* Linux Specific */
102#define __NR_pwrite64 68 /* Linux Specific */
103#ifdef __32bit_syscall_numbers__
104#define __NR_geteuid32 69 /* Linux sparc32, sbrk under SunOS */
105#define __NR_getegid32 70 /* Linux sparc32, sstk under SunOS */
106#endif
107#define __NR_mmap 71 /* Common */
108#ifdef __32bit_syscall_numbers__
109#define __NR_setreuid32 72 /* Linux sparc32, vadvise under SunOS */
110#endif
111#define __NR_munmap 73 /* Common */
112#define __NR_mprotect 74 /* Common */
113#define __NR_madvise 75 /* Common */
114#define __NR_vhangup 76 /* Common */
115#ifdef __32bit_syscall_numbers__
116#define __NR_truncate64 77 /* Linux sparc32 Specific */
117#endif
118#define __NR_mincore 78 /* Common */
119#define __NR_getgroups 79 /* Common */
120#define __NR_setgroups 80 /* Common */
121#define __NR_getpgrp 81 /* Common */
122#ifdef __32bit_syscall_numbers__
123#define __NR_setgroups32 82 /* Linux sparc32, setpgrp under SunOS */
124#endif
125#define __NR_setitimer 83 /* Common */
126#ifdef __32bit_syscall_numbers__
127#define __NR_ftruncate64 84 /* Linux sparc32 Specific */
128#endif
129#define __NR_swapon 85 /* Common */
130#define __NR_getitimer 86 /* Common */
131#ifdef __32bit_syscall_numbers__
132#define __NR_setuid32 87 /* Linux sparc32, gethostname under SunOS */
133#endif
134#define __NR_sethostname 88 /* Common */
135#ifdef __32bit_syscall_numbers__
136#define __NR_setgid32 89 /* Linux sparc32, getdtablesize under SunOS */
137#endif
138#define __NR_dup2 90 /* Common */
139#ifdef __32bit_syscall_numbers__
140#define __NR_setfsuid32 91 /* Linux sparc32, getdopt under SunOS */
141#endif
142#define __NR_fcntl 92 /* Common */
143#define __NR_select 93 /* Common */
144#ifdef __32bit_syscall_numbers__
145#define __NR_setfsgid32 94 /* Linux sparc32, setdopt under SunOS */
146#endif
147#define __NR_fsync 95 /* Common */
148#define __NR_setpriority 96 /* Common */
149#define __NR_socket 97 /* Common */
150#define __NR_connect 98 /* Common */
151#define __NR_accept 99 /* Common */
152#define __NR_getpriority 100 /* Common */
153#define __NR_rt_sigreturn 101 /* Linux Specific */
154#define __NR_rt_sigaction 102 /* Linux Specific */
155#define __NR_rt_sigprocmask 103 /* Linux Specific */
156#define __NR_rt_sigpending 104 /* Linux Specific */
157#define __NR_rt_sigtimedwait 105 /* Linux Specific */
158#define __NR_rt_sigqueueinfo 106 /* Linux Specific */
159#define __NR_rt_sigsuspend 107 /* Linux Specific */
160#ifdef __32bit_syscall_numbers__
161#define __NR_setresuid32 108 /* Linux Specific, sigvec under SunOS */
162#define __NR_getresuid32 109 /* Linux Specific, sigblock under SunOS */
163#define __NR_setresgid32 110 /* Linux Specific, sigsetmask under SunOS */
164#define __NR_getresgid32 111 /* Linux Specific, sigpause under SunOS */
165#define __NR_setregid32 112 /* Linux sparc32, sigstack under SunOS */
166#else
167#define __NR_setresuid 108 /* Linux Specific, sigvec under SunOS */
168#define __NR_getresuid 109 /* Linux Specific, sigblock under SunOS */
169#define __NR_setresgid 110 /* Linux Specific, sigsetmask under SunOS */
170#define __NR_getresgid 111 /* Linux Specific, sigpause under SunOS */
171#endif
172#define __NR_recvmsg 113 /* Common */
173#define __NR_sendmsg 114 /* Common */
174#ifdef __32bit_syscall_numbers__
175#define __NR_getgroups32 115 /* Linux sparc32, vtrace under SunOS */
176#endif
177#define __NR_gettimeofday 116 /* Common */
178#define __NR_getrusage 117 /* Common */
179#define __NR_getsockopt 118 /* Common */
180#define __NR_getcwd 119 /* Linux Specific */
181#define __NR_readv 120 /* Common */
182#define __NR_writev 121 /* Common */
183#define __NR_settimeofday 122 /* Common */
184#define __NR_fchown 123 /* Common */
185#define __NR_fchmod 124 /* Common */
186#define __NR_recvfrom 125 /* Common */
187#define __NR_setreuid 126 /* Common */
188#define __NR_setregid 127 /* Common */
189#define __NR_rename 128 /* Common */
190#define __NR_truncate 129 /* Common */
191#define __NR_ftruncate 130 /* Common */
192#define __NR_flock 131 /* Common */
193#define __NR_lstat64 132 /* Linux Specific */
194#define __NR_sendto 133 /* Common */
195#define __NR_shutdown 134 /* Common */
196#define __NR_socketpair 135 /* Common */
197#define __NR_mkdir 136 /* Common */
198#define __NR_rmdir 137 /* Common */
199#define __NR_utimes 138 /* SunOS Specific */
200#define __NR_stat64 139 /* Linux Specific */
201#define __NR_sendfile64 140 /* adjtime under SunOS */
202#define __NR_getpeername 141 /* Common */
203#define __NR_futex 142 /* gethostid under SunOS */
204#define __NR_gettid 143 /* ENOSYS under SunOS */
205#define __NR_getrlimit 144 /* Common */
206#define __NR_setrlimit 145 /* Common */
207#define __NR_pivot_root 146 /* Linux Specific, killpg under SunOS */
208#define __NR_prctl 147 /* ENOSYS under SunOS */
209#define __NR_pciconfig_read 148 /* ENOSYS under SunOS */
210#define __NR_pciconfig_write 149 /* ENOSYS under SunOS */
211#define __NR_getsockname 150 /* Common */
212#define __NR_inotify_init 151 /* Linux specific */
213#define __NR_inotify_add_watch 152 /* Linux specific */
214#define __NR_poll 153 /* Common */
215#define __NR_getdents64 154 /* Linux specific */
216#ifdef __32bit_syscall_numbers__
217#define __NR_fcntl64 155 /* Linux sparc32 Specific */
218#endif
219#define __NR_inotify_rm_watch 156 /* Linux specific */
220#define __NR_statfs 157 /* Common */
221#define __NR_fstatfs 158 /* Common */
222#define __NR_umount 159 /* Common */
223#define __NR_sched_set_affinity 160 /* Linux specific, async_daemon under SunOS */
224#define __NR_sched_get_affinity 161 /* Linux specific, getfh under SunOS */
225#define __NR_getdomainname 162 /* SunOS Specific */
226#define __NR_setdomainname 163 /* Common */
227#ifndef __32bit_syscall_numbers__
228#define __NR_utrap_install 164 /* SYSV ABI/v9 required */
229#endif
230#define __NR_quotactl 165 /* Common */
231#define __NR_set_tid_address 166 /* Linux specific, exportfs under SunOS */
232#define __NR_mount 167 /* Common */
233#define __NR_ustat 168 /* Common */
234#define __NR_setxattr 169 /* SunOS: semsys */
235#define __NR_lsetxattr 170 /* SunOS: msgsys */
236#define __NR_fsetxattr 171 /* SunOS: shmsys */
237#define __NR_getxattr 172 /* SunOS: auditsys */
238#define __NR_lgetxattr 173 /* SunOS: rfssys */
239#define __NR_getdents 174 /* Common */
240#define __NR_setsid 175 /* Common */
241#define __NR_fchdir 176 /* Common */
242#define __NR_fgetxattr 177 /* SunOS: fchroot */
243#define __NR_listxattr 178 /* SunOS: vpixsys */
244#define __NR_llistxattr 179 /* SunOS: aioread */
245#define __NR_flistxattr 180 /* SunOS: aiowrite */
246#define __NR_removexattr 181 /* SunOS: aiowait */
247#define __NR_lremovexattr 182 /* SunOS: aiocancel */
248#define __NR_sigpending 183 /* Common */
249#define __NR_query_module 184 /* Linux Specific */
250#define __NR_setpgid 185 /* Common */
251#define __NR_fremovexattr 186 /* SunOS: pathconf */
252#define __NR_tkill 187 /* SunOS: fpathconf */
253#define __NR_exit_group 188 /* Linux specific, sysconf undef SunOS */
254#define __NR_uname 189 /* Linux Specific */
255#define __NR_init_module 190 /* Linux Specific */
256#define __NR_personality 191 /* Linux Specific */
257#define __NR_remap_file_pages 192 /* Linux Specific */
258#define __NR_epoll_create 193 /* Linux Specific */
259#define __NR_epoll_ctl 194 /* Linux Specific */
260#define __NR_epoll_wait 195 /* Linux Specific */
261#define __NR_ioprio_set 196 /* Linux Specific */
262#define __NR_getppid 197 /* Linux Specific */
263#define __NR_sigaction 198 /* Linux Specific */
264#define __NR_sgetmask 199 /* Linux Specific */
265#define __NR_ssetmask 200 /* Linux Specific */
266#define __NR_sigsuspend 201 /* Linux Specific */
267#define __NR_oldlstat 202 /* Linux Specific */
268#define __NR_uselib 203 /* Linux Specific */
269#define __NR_readdir 204 /* Linux Specific */
270#define __NR_readahead 205 /* Linux Specific */
271#define __NR_socketcall 206 /* Linux Specific */
272#define __NR_syslog 207 /* Linux Specific */
273#define __NR_lookup_dcookie 208 /* Linux Specific */
274#define __NR_fadvise64 209 /* Linux Specific */
275#define __NR_fadvise64_64 210 /* Linux Specific */
276#define __NR_tgkill 211 /* Linux Specific */
277#define __NR_waitpid 212 /* Linux Specific */
278#define __NR_swapoff 213 /* Linux Specific */
279#define __NR_sysinfo 214 /* Linux Specific */
280#define __NR_ipc 215 /* Linux Specific */
281#define __NR_sigreturn 216 /* Linux Specific */
282#define __NR_clone 217 /* Linux Specific */
283#define __NR_ioprio_get 218 /* Linux Specific */
284#define __NR_adjtimex 219 /* Linux Specific */
285#define __NR_sigprocmask 220 /* Linux Specific */
286#define __NR_create_module 221 /* Linux Specific */
287#define __NR_delete_module 222 /* Linux Specific */
288#define __NR_get_kernel_syms 223 /* Linux Specific */
289#define __NR_getpgid 224 /* Linux Specific */
290#define __NR_bdflush 225 /* Linux Specific */
291#define __NR_sysfs 226 /* Linux Specific */
292#define __NR_afs_syscall 227 /* Linux Specific */
293#define __NR_setfsuid 228 /* Linux Specific */
294#define __NR_setfsgid 229 /* Linux Specific */
295#define __NR__newselect 230 /* Linux Specific */
296#ifdef __32bit_syscall_numbers__
297#define __NR_time 231 /* Linux Specific */
5#else 298#else
6#include <asm/unistd_32.h> 299#ifdef __KERNEL__
300#define __NR_time 231 /* Linux sparc32 */
301#endif
302#endif
303#define __NR_splice 232 /* Linux Specific */
304#define __NR_stime 233 /* Linux Specific */
305#define __NR_statfs64 234 /* Linux Specific */
306#define __NR_fstatfs64 235 /* Linux Specific */
307#define __NR__llseek 236 /* Linux Specific */
308#define __NR_mlock 237
309#define __NR_munlock 238
310#define __NR_mlockall 239
311#define __NR_munlockall 240
312#define __NR_sched_setparam 241
313#define __NR_sched_getparam 242
314#define __NR_sched_setscheduler 243
315#define __NR_sched_getscheduler 244
316#define __NR_sched_yield 245
317#define __NR_sched_get_priority_max 246
318#define __NR_sched_get_priority_min 247
319#define __NR_sched_rr_get_interval 248
320#define __NR_nanosleep 249
321#define __NR_mremap 250
322#define __NR__sysctl 251
323#define __NR_getsid 252
324#define __NR_fdatasync 253
325#define __NR_nfsservctl 254
326#define __NR_sync_file_range 255
327#define __NR_clock_settime 256
328#define __NR_clock_gettime 257
329#define __NR_clock_getres 258
330#define __NR_clock_nanosleep 259
331#define __NR_sched_getaffinity 260
332#define __NR_sched_setaffinity 261
333#define __NR_timer_settime 262
334#define __NR_timer_gettime 263
335#define __NR_timer_getoverrun 264
336#define __NR_timer_delete 265
337#define __NR_timer_create 266
338/* #define __NR_vserver 267 Reserved for VSERVER */
339#define __NR_io_setup 268
340#define __NR_io_destroy 269
341#define __NR_io_submit 270
342#define __NR_io_cancel 271
343#define __NR_io_getevents 272
344#define __NR_mq_open 273
345#define __NR_mq_unlink 274
346#define __NR_mq_timedsend 275
347#define __NR_mq_timedreceive 276
348#define __NR_mq_notify 277
349#define __NR_mq_getsetattr 278
350#define __NR_waitid 279
351#define __NR_tee 280
352#define __NR_add_key 281
353#define __NR_request_key 282
354#define __NR_keyctl 283
355#define __NR_openat 284
356#define __NR_mkdirat 285
357#define __NR_mknodat 286
358#define __NR_fchownat 287
359#define __NR_futimesat 288
360#define __NR_fstatat64 289
361#define __NR_unlinkat 290
362#define __NR_renameat 291
363#define __NR_linkat 292
364#define __NR_symlinkat 293
365#define __NR_readlinkat 294
366#define __NR_fchmodat 295
367#define __NR_faccessat 296
368#define __NR_pselect6 297
369#define __NR_ppoll 298
370#define __NR_unshare 299
371#define __NR_set_robust_list 300
372#define __NR_get_robust_list 301
373#define __NR_migrate_pages 302
374#define __NR_mbind 303
375#define __NR_get_mempolicy 304
376#define __NR_set_mempolicy 305
377#define __NR_kexec_load 306
378#define __NR_move_pages 307
379#define __NR_getcpu 308
380#define __NR_epoll_pwait 309
381#define __NR_utimensat 310
382#define __NR_signalfd 311
383#define __NR_timerfd_create 312
384#define __NR_eventfd 313
385#define __NR_fallocate 314
386#define __NR_timerfd_settime 315
387#define __NR_timerfd_gettime 316
388#define __NR_signalfd4 317
389#define __NR_eventfd2 318
390#define __NR_epoll_create1 319
391#define __NR_dup3 320
392#define __NR_pipe2 321
393#define __NR_inotify_init1 322
394#define __NR_accept4 323
395
396#define NR_SYSCALLS 324
397
398#ifdef __32bit_syscall_numbers__
399/* Sparc 32-bit only has the "setresuid32", "getresuid32" variants,
400 * it never had the plain ones and there is no value to adding those
401 * old versions into the syscall table.
402 */
403#define __IGNORE_setresuid
404#define __IGNORE_getresuid
405#define __IGNORE_setresgid
406#define __IGNORE_getresgid
7#endif 407#endif
408
409#ifdef __KERNEL__
410#define __ARCH_WANT_IPC_PARSE_VERSION
411#define __ARCH_WANT_OLD_READDIR
412#define __ARCH_WANT_STAT64
413#define __ARCH_WANT_SYS_ALARM
414#define __ARCH_WANT_SYS_GETHOSTNAME
415#define __ARCH_WANT_SYS_PAUSE
416#define __ARCH_WANT_SYS_SGETMASK
417#define __ARCH_WANT_SYS_SIGNAL
418#define __ARCH_WANT_SYS_TIME
419#define __ARCH_WANT_SYS_UTIME
420#define __ARCH_WANT_SYS_WAITPID
421#define __ARCH_WANT_SYS_SOCKETCALL
422#define __ARCH_WANT_SYS_FADVISE64
423#define __ARCH_WANT_SYS_GETPGRP
424#define __ARCH_WANT_SYS_LLSEEK
425#define __ARCH_WANT_SYS_NICE
426#define __ARCH_WANT_SYS_OLDUMOUNT
427#define __ARCH_WANT_SYS_SIGPENDING
428#define __ARCH_WANT_SYS_SIGPROCMASK
429#define __ARCH_WANT_SYS_RT_SIGSUSPEND
430#ifndef __32bit_syscall_numbers__
431#define __ARCH_WANT_COMPAT_SYS_TIME
432#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
8#endif 433#endif
434
435/*
436 * "Conditional" syscalls
437 *
438 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
439 * but it doesn't work on all toolchains, so we just do it by hand
440 */
441#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
442
443#endif /* __KERNEL__ */
444#endif /* _SPARC_UNISTD_H */
diff --git a/arch/sparc/include/asm/unistd_32.h b/arch/sparc/include/asm/unistd_32.h
deleted file mode 100644
index 0d13d2a4c76f..000000000000
--- a/arch/sparc/include/asm/unistd_32.h
+++ /dev/null
@@ -1,385 +0,0 @@
1#ifndef _SPARC_UNISTD_H
2#define _SPARC_UNISTD_H
3
4/*
5 * System calls under the Sparc.
6 *
7 * Don't be scared by the ugly clobbers, it is the only way I can
8 * think of right now to force the arguments into fixed registers
9 * before the trap into the system call with gcc 'asm' statements.
10 *
11 * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net)
12 *
13 * SunOS compatibility based upon preliminary work which is:
14 *
15 * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu)
16 */
17
18#define __NR_restart_syscall 0 /* Linux Specific */
19#define __NR_exit 1 /* Common */
20#define __NR_fork 2 /* Common */
21#define __NR_read 3 /* Common */
22#define __NR_write 4 /* Common */
23#define __NR_open 5 /* Common */
24#define __NR_close 6 /* Common */
25#define __NR_wait4 7 /* Common */
26#define __NR_creat 8 /* Common */
27#define __NR_link 9 /* Common */
28#define __NR_unlink 10 /* Common */
29#define __NR_execv 11 /* SunOS Specific */
30#define __NR_chdir 12 /* Common */
31#define __NR_chown 13 /* Common */
32#define __NR_mknod 14 /* Common */
33#define __NR_chmod 15 /* Common */
34#define __NR_lchown 16 /* Common */
35#define __NR_brk 17 /* Common */
36#define __NR_perfctr 18 /* Performance counter operations */
37#define __NR_lseek 19 /* Common */
38#define __NR_getpid 20 /* Common */
39#define __NR_capget 21 /* Linux Specific */
40#define __NR_capset 22 /* Linux Specific */
41#define __NR_setuid 23 /* Implemented via setreuid in SunOS */
42#define __NR_getuid 24 /* Common */
43#define __NR_vmsplice 25 /* ENOSYS under SunOS */
44#define __NR_ptrace 26 /* Common */
45#define __NR_alarm 27 /* Implemented via setitimer in SunOS */
46#define __NR_sigaltstack 28 /* Common */
47#define __NR_pause 29 /* Is sigblock(0)->sigpause() in SunOS */
48#define __NR_utime 30 /* Implemented via utimes() under SunOS */
49#define __NR_lchown32 31 /* Linux sparc32 specific */
50#define __NR_fchown32 32 /* Linux sparc32 specific */
51#define __NR_access 33 /* Common */
52#define __NR_nice 34 /* Implemented via get/setpriority() in SunOS */
53#define __NR_chown32 35 /* Linux sparc32 specific */
54#define __NR_sync 36 /* Common */
55#define __NR_kill 37 /* Common */
56#define __NR_stat 38 /* Common */
57#define __NR_sendfile 39 /* Linux Specific */
58#define __NR_lstat 40 /* Common */
59#define __NR_dup 41 /* Common */
60#define __NR_pipe 42 /* Common */
61#define __NR_times 43 /* Implemented via getrusage() in SunOS */
62#define __NR_getuid32 44 /* Linux sparc32 specific */
63#define __NR_umount2 45 /* Linux Specific */
64#define __NR_setgid 46 /* Implemented via setregid() in SunOS */
65#define __NR_getgid 47 /* Common */
66#define __NR_signal 48 /* Implemented via sigvec() in SunOS */
67#define __NR_geteuid 49 /* SunOS calls getuid() */
68#define __NR_getegid 50 /* SunOS calls getgid() */
69#define __NR_acct 51 /* Common */
70/* #define __NR_memory_ordering 52 Linux sparc64 specific */
71#define __NR_getgid32 53 /* Linux sparc32 specific */
72#define __NR_ioctl 54 /* Common */
73#define __NR_reboot 55 /* Common */
74#define __NR_mmap2 56 /* Linux sparc32 Specific */
75#define __NR_symlink 57 /* Common */
76#define __NR_readlink 58 /* Common */
77#define __NR_execve 59 /* Common */
78#define __NR_umask 60 /* Common */
79#define __NR_chroot 61 /* Common */
80#define __NR_fstat 62 /* Common */
81#define __NR_fstat64 63 /* Linux Specific */
82#define __NR_getpagesize 64 /* Common */
83#define __NR_msync 65 /* Common in newer 1.3.x revs... */
84#define __NR_vfork 66 /* Common */
85#define __NR_pread64 67 /* Linux Specific */
86#define __NR_pwrite64 68 /* Linux Specific */
87#define __NR_geteuid32 69 /* Linux sparc32, sbrk under SunOS */
88#define __NR_getegid32 70 /* Linux sparc32, sstk under SunOS */
89#define __NR_mmap 71 /* Common */
90#define __NR_setreuid32 72 /* Linux sparc32, vadvise under SunOS */
91#define __NR_munmap 73 /* Common */
92#define __NR_mprotect 74 /* Common */
93#define __NR_madvise 75 /* Common */
94#define __NR_vhangup 76 /* Common */
95#define __NR_truncate64 77 /* Linux sparc32 Specific */
96#define __NR_mincore 78 /* Common */
97#define __NR_getgroups 79 /* Common */
98#define __NR_setgroups 80 /* Common */
99#define __NR_getpgrp 81 /* Common */
100#define __NR_setgroups32 82 /* Linux sparc32, setpgrp under SunOS */
101#define __NR_setitimer 83 /* Common */
102#define __NR_ftruncate64 84 /* Linux sparc32 Specific */
103#define __NR_swapon 85 /* Common */
104#define __NR_getitimer 86 /* Common */
105#define __NR_setuid32 87 /* Linux sparc32, gethostname under SunOS */
106#define __NR_sethostname 88 /* Common */
107#define __NR_setgid32 89 /* Linux sparc32, getdtablesize under SunOS */
108#define __NR_dup2 90 /* Common */
109#define __NR_setfsuid32 91 /* Linux sparc32, getdopt under SunOS */
110#define __NR_fcntl 92 /* Common */
111#define __NR_select 93 /* Common */
112#define __NR_setfsgid32 94 /* Linux sparc32, setdopt under SunOS */
113#define __NR_fsync 95 /* Common */
114#define __NR_setpriority 96 /* Common */
115#define __NR_socket 97 /* Common */
116#define __NR_connect 98 /* Common */
117#define __NR_accept 99 /* Common */
118#define __NR_getpriority 100 /* Common */
119#define __NR_rt_sigreturn 101 /* Linux Specific */
120#define __NR_rt_sigaction 102 /* Linux Specific */
121#define __NR_rt_sigprocmask 103 /* Linux Specific */
122#define __NR_rt_sigpending 104 /* Linux Specific */
123#define __NR_rt_sigtimedwait 105 /* Linux Specific */
124#define __NR_rt_sigqueueinfo 106 /* Linux Specific */
125#define __NR_rt_sigsuspend 107 /* Linux Specific */
126#define __NR_setresuid32 108 /* Linux Specific, sigvec under SunOS */
127#define __NR_getresuid32 109 /* Linux Specific, sigblock under SunOS */
128#define __NR_setresgid32 110 /* Linux Specific, sigsetmask under SunOS */
129#define __NR_getresgid32 111 /* Linux Specific, sigpause under SunOS */
130#define __NR_setregid32 112 /* Linux sparc32, sigstack under SunOS */
131#define __NR_recvmsg 113 /* Common */
132#define __NR_sendmsg 114 /* Common */
133#define __NR_getgroups32 115 /* Linux sparc32, vtrace under SunOS */
134#define __NR_gettimeofday 116 /* Common */
135#define __NR_getrusage 117 /* Common */
136#define __NR_getsockopt 118 /* Common */
137#define __NR_getcwd 119 /* Linux Specific */
138#define __NR_readv 120 /* Common */
139#define __NR_writev 121 /* Common */
140#define __NR_settimeofday 122 /* Common */
141#define __NR_fchown 123 /* Common */
142#define __NR_fchmod 124 /* Common */
143#define __NR_recvfrom 125 /* Common */
144#define __NR_setreuid 126 /* Common */
145#define __NR_setregid 127 /* Common */
146#define __NR_rename 128 /* Common */
147#define __NR_truncate 129 /* Common */
148#define __NR_ftruncate 130 /* Common */
149#define __NR_flock 131 /* Common */
150#define __NR_lstat64 132 /* Linux Specific */
151#define __NR_sendto 133 /* Common */
152#define __NR_shutdown 134 /* Common */
153#define __NR_socketpair 135 /* Common */
154#define __NR_mkdir 136 /* Common */
155#define __NR_rmdir 137 /* Common */
156#define __NR_utimes 138 /* SunOS Specific */
157#define __NR_stat64 139 /* Linux Specific */
158#define __NR_sendfile64 140 /* adjtime under SunOS */
159#define __NR_getpeername 141 /* Common */
160#define __NR_futex 142 /* gethostid under SunOS */
161#define __NR_gettid 143 /* ENOSYS under SunOS */
162#define __NR_getrlimit 144 /* Common */
163#define __NR_setrlimit 145 /* Common */
164#define __NR_pivot_root 146 /* Linux Specific, killpg under SunOS */
165#define __NR_prctl 147 /* ENOSYS under SunOS */
166#define __NR_pciconfig_read 148 /* ENOSYS under SunOS */
167#define __NR_pciconfig_write 149 /* ENOSYS under SunOS */
168#define __NR_getsockname 150 /* Common */
169#define __NR_inotify_init 151 /* Linux specific */
170#define __NR_inotify_add_watch 152 /* Linux specific */
171#define __NR_poll 153 /* Common */
172#define __NR_getdents64 154 /* Linux specific */
173#define __NR_fcntl64 155 /* Linux sparc32 Specific */
174#define __NR_inotify_rm_watch 156 /* Linux specific */
175#define __NR_statfs 157 /* Common */
176#define __NR_fstatfs 158 /* Common */
177#define __NR_umount 159 /* Common */
178#define __NR_sched_set_affinity 160 /* Linux specific, async_daemon under SunOS */
179#define __NR_sched_get_affinity 161 /* Linux specific, getfh under SunOS */
180#define __NR_getdomainname 162 /* SunOS Specific */
181#define __NR_setdomainname 163 /* Common */
182/* #define __NR_utrap_install 164 Linux sparc64 specific */
183#define __NR_quotactl 165 /* Common */
184#define __NR_set_tid_address 166 /* Linux specific, exportfs under SunOS */
185#define __NR_mount 167 /* Common */
186#define __NR_ustat 168 /* Common */
187#define __NR_setxattr 169 /* SunOS: semsys */
188#define __NR_lsetxattr 170 /* SunOS: msgsys */
189#define __NR_fsetxattr 171 /* SunOS: shmsys */
190#define __NR_getxattr 172 /* SunOS: auditsys */
191#define __NR_lgetxattr 173 /* SunOS: rfssys */
192#define __NR_getdents 174 /* Common */
193#define __NR_setsid 175 /* Common */
194#define __NR_fchdir 176 /* Common */
195#define __NR_fgetxattr 177 /* SunOS: fchroot */
196#define __NR_listxattr 178 /* SunOS: vpixsys */
197#define __NR_llistxattr 179 /* SunOS: aioread */
198#define __NR_flistxattr 180 /* SunOS: aiowrite */
199#define __NR_removexattr 181 /* SunOS: aiowait */
200#define __NR_lremovexattr 182 /* SunOS: aiocancel */
201#define __NR_sigpending 183 /* Common */
202#define __NR_query_module 184 /* Linux Specific */
203#define __NR_setpgid 185 /* Common */
204#define __NR_fremovexattr 186 /* SunOS: pathconf */
205#define __NR_tkill 187 /* SunOS: fpathconf */
206#define __NR_exit_group 188 /* Linux specific, sysconf undef SunOS */
207#define __NR_uname 189 /* Linux Specific */
208#define __NR_init_module 190 /* Linux Specific */
209#define __NR_personality 191 /* Linux Specific */
210#define __NR_remap_file_pages 192 /* Linux Specific */
211#define __NR_epoll_create 193 /* Linux Specific */
212#define __NR_epoll_ctl 194 /* Linux Specific */
213#define __NR_epoll_wait 195 /* Linux Specific */
214#define __NR_ioprio_set 196 /* Linux Specific */
215#define __NR_getppid 197 /* Linux Specific */
216#define __NR_sigaction 198 /* Linux Specific */
217#define __NR_sgetmask 199 /* Linux Specific */
218#define __NR_ssetmask 200 /* Linux Specific */
219#define __NR_sigsuspend 201 /* Linux Specific */
220#define __NR_oldlstat 202 /* Linux Specific */
221#define __NR_uselib 203 /* Linux Specific */
222#define __NR_readdir 204 /* Linux Specific */
223#define __NR_readahead 205 /* Linux Specific */
224#define __NR_socketcall 206 /* Linux Specific */
225#define __NR_syslog 207 /* Linux Specific */
226#define __NR_lookup_dcookie 208 /* Linux Specific */
227#define __NR_fadvise64 209 /* Linux Specific */
228#define __NR_fadvise64_64 210 /* Linux Specific */
229#define __NR_tgkill 211 /* Linux Specific */
230#define __NR_waitpid 212 /* Linux Specific */
231#define __NR_swapoff 213 /* Linux Specific */
232#define __NR_sysinfo 214 /* Linux Specific */
233#define __NR_ipc 215 /* Linux Specific */
234#define __NR_sigreturn 216 /* Linux Specific */
235#define __NR_clone 217 /* Linux Specific */
236#define __NR_ioprio_get 218 /* Linux Specific */
237#define __NR_adjtimex 219 /* Linux Specific */
238#define __NR_sigprocmask 220 /* Linux Specific */
239#define __NR_create_module 221 /* Linux Specific */
240#define __NR_delete_module 222 /* Linux Specific */
241#define __NR_get_kernel_syms 223 /* Linux Specific */
242#define __NR_getpgid 224 /* Linux Specific */
243#define __NR_bdflush 225 /* Linux Specific */
244#define __NR_sysfs 226 /* Linux Specific */
245#define __NR_afs_syscall 227 /* Linux Specific */
246#define __NR_setfsuid 228 /* Linux Specific */
247#define __NR_setfsgid 229 /* Linux Specific */
248#define __NR__newselect 230 /* Linux Specific */
249#define __NR_time 231 /* Linux Specific */
250#define __NR_splice 232 /* Linux Specific */
251#define __NR_stime 233 /* Linux Specific */
252#define __NR_statfs64 234 /* Linux Specific */
253#define __NR_fstatfs64 235 /* Linux Specific */
254#define __NR__llseek 236 /* Linux Specific */
255#define __NR_mlock 237
256#define __NR_munlock 238
257#define __NR_mlockall 239
258#define __NR_munlockall 240
259#define __NR_sched_setparam 241
260#define __NR_sched_getparam 242
261#define __NR_sched_setscheduler 243
262#define __NR_sched_getscheduler 244
263#define __NR_sched_yield 245
264#define __NR_sched_get_priority_max 246
265#define __NR_sched_get_priority_min 247
266#define __NR_sched_rr_get_interval 248
267#define __NR_nanosleep 249
268#define __NR_mremap 250
269#define __NR__sysctl 251
270#define __NR_getsid 252
271#define __NR_fdatasync 253
272#define __NR_nfsservctl 254
273#define __NR_sync_file_range 255
274#define __NR_clock_settime 256
275#define __NR_clock_gettime 257
276#define __NR_clock_getres 258
277#define __NR_clock_nanosleep 259
278#define __NR_sched_getaffinity 260
279#define __NR_sched_setaffinity 261
280#define __NR_timer_settime 262
281#define __NR_timer_gettime 263
282#define __NR_timer_getoverrun 264
283#define __NR_timer_delete 265
284#define __NR_timer_create 266
285/* #define __NR_vserver 267 Reserved for VSERVER */
286#define __NR_io_setup 268
287#define __NR_io_destroy 269
288#define __NR_io_submit 270
289#define __NR_io_cancel 271
290#define __NR_io_getevents 272
291#define __NR_mq_open 273
292#define __NR_mq_unlink 274
293#define __NR_mq_timedsend 275
294#define __NR_mq_timedreceive 276
295#define __NR_mq_notify 277
296#define __NR_mq_getsetattr 278
297#define __NR_waitid 279
298#define __NR_tee 280
299#define __NR_add_key 281
300#define __NR_request_key 282
301#define __NR_keyctl 283
302#define __NR_openat 284
303#define __NR_mkdirat 285
304#define __NR_mknodat 286
305#define __NR_fchownat 287
306#define __NR_futimesat 288
307#define __NR_fstatat64 289
308#define __NR_unlinkat 290
309#define __NR_renameat 291
310#define __NR_linkat 292
311#define __NR_symlinkat 293
312#define __NR_readlinkat 294
313#define __NR_fchmodat 295
314#define __NR_faccessat 296
315#define __NR_pselect6 297
316#define __NR_ppoll 298
317#define __NR_unshare 299
318#define __NR_set_robust_list 300
319#define __NR_get_robust_list 301
320#define __NR_migrate_pages 302
321#define __NR_mbind 303
322#define __NR_get_mempolicy 304
323#define __NR_set_mempolicy 305
324#define __NR_kexec_load 306
325#define __NR_move_pages 307
326#define __NR_getcpu 308
327#define __NR_epoll_pwait 309
328#define __NR_utimensat 310
329#define __NR_signalfd 311
330#define __NR_timerfd_create 312
331#define __NR_eventfd 313
332#define __NR_fallocate 314
333#define __NR_timerfd_settime 315
334#define __NR_timerfd_gettime 316
335#define __NR_signalfd4 317
336#define __NR_eventfd2 318
337#define __NR_epoll_create1 319
338#define __NR_dup3 320
339#define __NR_pipe2 321
340#define __NR_inotify_init1 322
341#define __NR_accept4 323
342
343#define NR_SYSCALLS 324
344
345/* Sparc 32-bit only has the "setresuid32", "getresuid32" variants,
346 * it never had the plain ones and there is no value to adding those
347 * old versions into the syscall table.
348 */
349#define __IGNORE_setresuid
350#define __IGNORE_getresuid
351#define __IGNORE_setresgid
352#define __IGNORE_getresgid
353
354#ifdef __KERNEL__
355#define __ARCH_WANT_IPC_PARSE_VERSION
356#define __ARCH_WANT_OLD_READDIR
357#define __ARCH_WANT_STAT64
358#define __ARCH_WANT_SYS_ALARM
359#define __ARCH_WANT_SYS_GETHOSTNAME
360#define __ARCH_WANT_SYS_PAUSE
361#define __ARCH_WANT_SYS_SGETMASK
362#define __ARCH_WANT_SYS_SIGNAL
363#define __ARCH_WANT_SYS_TIME
364#define __ARCH_WANT_SYS_UTIME
365#define __ARCH_WANT_SYS_WAITPID
366#define __ARCH_WANT_SYS_SOCKETCALL
367#define __ARCH_WANT_SYS_FADVISE64
368#define __ARCH_WANT_SYS_GETPGRP
369#define __ARCH_WANT_SYS_LLSEEK
370#define __ARCH_WANT_SYS_NICE
371#define __ARCH_WANT_SYS_OLDUMOUNT
372#define __ARCH_WANT_SYS_SIGPENDING
373#define __ARCH_WANT_SYS_SIGPROCMASK
374#define __ARCH_WANT_SYS_RT_SIGSUSPEND
375
376/*
377 * "Conditional" syscalls
378 *
379 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
380 * but it doesn't work on all toolchains, so we just do it by hand
381 */
382#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
383
384#endif /* __KERNEL__ */
385#endif /* _SPARC_UNISTD_H */
diff --git a/arch/sparc/include/asm/unistd_64.h b/arch/sparc/include/asm/unistd_64.h
deleted file mode 100644
index fa5d3c0343c7..000000000000
--- a/arch/sparc/include/asm/unistd_64.h
+++ /dev/null
@@ -1,380 +0,0 @@
1#ifndef _SPARC64_UNISTD_H
2#define _SPARC64_UNISTD_H
3
4/*
5 * System calls under the Sparc.
6 *
7 * Don't be scared by the ugly clobbers, it is the only way I can
8 * think of right now to force the arguments into fixed registers
9 * before the trap into the system call with gcc 'asm' statements.
10 *
11 * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net)
12 *
13 * SunOS compatibility based upon preliminary work which is:
14 *
15 * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu)
16 */
17
18#define __NR_restart_syscall 0 /* Linux Specific */
19#define __NR_exit 1 /* Common */
20#define __NR_fork 2 /* Common */
21#define __NR_read 3 /* Common */
22#define __NR_write 4 /* Common */
23#define __NR_open 5 /* Common */
24#define __NR_close 6 /* Common */
25#define __NR_wait4 7 /* Common */
26#define __NR_creat 8 /* Common */
27#define __NR_link 9 /* Common */
28#define __NR_unlink 10 /* Common */
29#define __NR_execv 11 /* SunOS Specific */
30#define __NR_chdir 12 /* Common */
31#define __NR_chown 13 /* Common */
32#define __NR_mknod 14 /* Common */
33#define __NR_chmod 15 /* Common */
34#define __NR_lchown 16 /* Common */
35#define __NR_brk 17 /* Common */
36#define __NR_perfctr 18 /* Performance counter operations */
37#define __NR_lseek 19 /* Common */
38#define __NR_getpid 20 /* Common */
39#define __NR_capget 21 /* Linux Specific */
40#define __NR_capset 22 /* Linux Specific */
41#define __NR_setuid 23 /* Implemented via setreuid in SunOS */
42#define __NR_getuid 24 /* Common */
43#define __NR_vmsplice 25 /* ENOSYS under SunOS */
44#define __NR_ptrace 26 /* Common */
45#define __NR_alarm 27 /* Implemented via setitimer in SunOS */
46#define __NR_sigaltstack 28 /* Common */
47#define __NR_pause 29 /* Is sigblock(0)->sigpause() in SunOS */
48#define __NR_utime 30 /* Implemented via utimes() under SunOS */
49/* #define __NR_lchown32 31 Linux sparc32 specific */
50/* #define __NR_fchown32 32 Linux sparc32 specific */
51#define __NR_access 33 /* Common */
52#define __NR_nice 34 /* Implemented via get/setpriority() in SunOS */
53/* #define __NR_chown32 35 Linux sparc32 specific */
54#define __NR_sync 36 /* Common */
55#define __NR_kill 37 /* Common */
56#define __NR_stat 38 /* Common */
57#define __NR_sendfile 39 /* Linux Specific */
58#define __NR_lstat 40 /* Common */
59#define __NR_dup 41 /* Common */
60#define __NR_pipe 42 /* Common */
61#define __NR_times 43 /* Implemented via getrusage() in SunOS */
62/* #define __NR_getuid32 44 Linux sparc32 specific */
63#define __NR_umount2 45 /* Linux Specific */
64#define __NR_setgid 46 /* Implemented via setregid() in SunOS */
65#define __NR_getgid 47 /* Common */
66#define __NR_signal 48 /* Implemented via sigvec() in SunOS */
67#define __NR_geteuid 49 /* SunOS calls getuid() */
68#define __NR_getegid 50 /* SunOS calls getgid() */
69#define __NR_acct 51 /* Common */
70#define __NR_memory_ordering 52 /* Linux Specific */
71/* #define __NR_getgid32 53 Linux sparc32 specific */
72#define __NR_ioctl 54 /* Common */
73#define __NR_reboot 55 /* Common */
74/* #define __NR_mmap2 56 Linux sparc32 Specific */
75#define __NR_symlink 57 /* Common */
76#define __NR_readlink 58 /* Common */
77#define __NR_execve 59 /* Common */
78#define __NR_umask 60 /* Common */
79#define __NR_chroot 61 /* Common */
80#define __NR_fstat 62 /* Common */
81#define __NR_fstat64 63 /* Linux Specific */
82#define __NR_getpagesize 64 /* Common */
83#define __NR_msync 65 /* Common in newer 1.3.x revs... */
84#define __NR_vfork 66 /* Common */
85#define __NR_pread64 67 /* Linux Specific */
86#define __NR_pwrite64 68 /* Linux Specific */
87/* #define __NR_geteuid32 69 Linux sparc32, sbrk under SunOS */
88/* #define __NR_getegid32 70 Linux sparc32, sstk under SunOS */
89#define __NR_mmap 71 /* Common */
90/* #define __NR_setreuid32 72 Linux sparc32, vadvise under SunOS */
91#define __NR_munmap 73 /* Common */
92#define __NR_mprotect 74 /* Common */
93#define __NR_madvise 75 /* Common */
94#define __NR_vhangup 76 /* Common */
95/* #define __NR_truncate64 77 Linux sparc32 Specific */
96#define __NR_mincore 78 /* Common */
97#define __NR_getgroups 79 /* Common */
98#define __NR_setgroups 80 /* Common */
99#define __NR_getpgrp 81 /* Common */
100/* #define __NR_setgroups32 82 Linux sparc32, setpgrp under SunOS */
101#define __NR_setitimer 83 /* Common */
102/* #define __NR_ftruncate64 84 Linux sparc32 Specific */
103#define __NR_swapon 85 /* Common */
104#define __NR_getitimer 86 /* Common */
105/* #define __NR_setuid32 87 Linux sparc32, gethostname under SunOS */
106#define __NR_sethostname 88 /* Common */
107/* #define __NR_setgid32 89 Linux sparc32, getdtablesize under SunOS */
108#define __NR_dup2 90 /* Common */
109/* #define __NR_setfsuid32 91 Linux sparc32, getdopt under SunOS */
110#define __NR_fcntl 92 /* Common */
111#define __NR_select 93 /* Common */
112/* #define __NR_setfsgid32 94 Linux sparc32, setdopt under SunOS */
113#define __NR_fsync 95 /* Common */
114#define __NR_setpriority 96 /* Common */
115#define __NR_socket 97 /* Common */
116#define __NR_connect 98 /* Common */
117#define __NR_accept 99 /* Common */
118#define __NR_getpriority 100 /* Common */
119#define __NR_rt_sigreturn 101 /* Linux Specific */
120#define __NR_rt_sigaction 102 /* Linux Specific */
121#define __NR_rt_sigprocmask 103 /* Linux Specific */
122#define __NR_rt_sigpending 104 /* Linux Specific */
123#define __NR_rt_sigtimedwait 105 /* Linux Specific */
124#define __NR_rt_sigqueueinfo 106 /* Linux Specific */
125#define __NR_rt_sigsuspend 107 /* Linux Specific */
126#define __NR_setresuid 108 /* Linux Specific, sigvec under SunOS */
127#define __NR_getresuid 109 /* Linux Specific, sigblock under SunOS */
128#define __NR_setresgid 110 /* Linux Specific, sigsetmask under SunOS */
129#define __NR_getresgid 111 /* Linux Specific, sigpause under SunOS */
130/* #define __NR_setregid32 75 Linux sparc32, sigstack under SunOS */
131#define __NR_recvmsg 113 /* Common */
132#define __NR_sendmsg 114 /* Common */
133/* #define __NR_getgroups32 115 Linux sparc32, vtrace under SunOS */
134#define __NR_gettimeofday 116 /* Common */
135#define __NR_getrusage 117 /* Common */
136#define __NR_getsockopt 118 /* Common */
137#define __NR_getcwd 119 /* Linux Specific */
138#define __NR_readv 120 /* Common */
139#define __NR_writev 121 /* Common */
140#define __NR_settimeofday 122 /* Common */
141#define __NR_fchown 123 /* Common */
142#define __NR_fchmod 124 /* Common */
143#define __NR_recvfrom 125 /* Common */
144#define __NR_setreuid 126 /* Common */
145#define __NR_setregid 127 /* Common */
146#define __NR_rename 128 /* Common */
147#define __NR_truncate 129 /* Common */
148#define __NR_ftruncate 130 /* Common */
149#define __NR_flock 131 /* Common */
150#define __NR_lstat64 132 /* Linux Specific */
151#define __NR_sendto 133 /* Common */
152#define __NR_shutdown 134 /* Common */
153#define __NR_socketpair 135 /* Common */
154#define __NR_mkdir 136 /* Common */
155#define __NR_rmdir 137 /* Common */
156#define __NR_utimes 138 /* SunOS Specific */
157#define __NR_stat64 139 /* Linux Specific */
158#define __NR_sendfile64 140 /* adjtime under SunOS */
159#define __NR_getpeername 141 /* Common */
160#define __NR_futex 142 /* gethostid under SunOS */
161#define __NR_gettid 143 /* ENOSYS under SunOS */
162#define __NR_getrlimit 144 /* Common */
163#define __NR_setrlimit 145 /* Common */
164#define __NR_pivot_root 146 /* Linux Specific, killpg under SunOS */
165#define __NR_prctl 147 /* ENOSYS under SunOS */
166#define __NR_pciconfig_read 148 /* ENOSYS under SunOS */
167#define __NR_pciconfig_write 149 /* ENOSYS under SunOS */
168#define __NR_getsockname 150 /* Common */
169#define __NR_inotify_init 151 /* Linux specific */
170#define __NR_inotify_add_watch 152 /* Linux specific */
171#define __NR_poll 153 /* Common */
172#define __NR_getdents64 154 /* Linux specific */
173/* #define __NR_fcntl64 155 Linux sparc32 Specific */
174#define __NR_inotify_rm_watch 156 /* Linux specific */
175#define __NR_statfs 157 /* Common */
176#define __NR_fstatfs 158 /* Common */
177#define __NR_umount 159 /* Common */
178#define __NR_sched_set_affinity 160 /* Linux specific, async_daemon under SunOS */
179#define __NR_sched_get_affinity 161 /* Linux specific, getfh under SunOS */
180#define __NR_getdomainname 162 /* SunOS Specific */
181#define __NR_setdomainname 163 /* Common */
182#define __NR_utrap_install 164 /* SYSV ABI/v9 required */
183#define __NR_quotactl 165 /* Common */
184#define __NR_set_tid_address 166 /* Linux specific, exportfs under SunOS */
185#define __NR_mount 167 /* Common */
186#define __NR_ustat 168 /* Common */
187#define __NR_setxattr 169 /* SunOS: semsys */
188#define __NR_lsetxattr 170 /* SunOS: msgsys */
189#define __NR_fsetxattr 171 /* SunOS: shmsys */
190#define __NR_getxattr 172 /* SunOS: auditsys */
191#define __NR_lgetxattr 173 /* SunOS: rfssys */
192#define __NR_getdents 174 /* Common */
193#define __NR_setsid 175 /* Common */
194#define __NR_fchdir 176 /* Common */
195#define __NR_fgetxattr 177 /* SunOS: fchroot */
196#define __NR_listxattr 178 /* SunOS: vpixsys */
197#define __NR_llistxattr 179 /* SunOS: aioread */
198#define __NR_flistxattr 180 /* SunOS: aiowrite */
199#define __NR_removexattr 181 /* SunOS: aiowait */
200#define __NR_lremovexattr 182 /* SunOS: aiocancel */
201#define __NR_sigpending 183 /* Common */
202#define __NR_query_module 184 /* Linux Specific */
203#define __NR_setpgid 185 /* Common */
204#define __NR_fremovexattr 186 /* SunOS: pathconf */
205#define __NR_tkill 187 /* SunOS: fpathconf */
206#define __NR_exit_group 188 /* Linux specific, sysconf undef SunOS */
207#define __NR_uname 189 /* Linux Specific */
208#define __NR_init_module 190 /* Linux Specific */
209#define __NR_personality 191 /* Linux Specific */
210#define __NR_remap_file_pages 192 /* Linux Specific */
211#define __NR_epoll_create 193 /* Linux Specific */
212#define __NR_epoll_ctl 194 /* Linux Specific */
213#define __NR_epoll_wait 195 /* Linux Specific */
214#define __NR_ioprio_set 196 /* Linux Specific */
215#define __NR_getppid 197 /* Linux Specific */
216#define __NR_sigaction 198 /* Linux Specific */
217#define __NR_sgetmask 199 /* Linux Specific */
218#define __NR_ssetmask 200 /* Linux Specific */
219#define __NR_sigsuspend 201 /* Linux Specific */
220#define __NR_oldlstat 202 /* Linux Specific */
221#define __NR_uselib 203 /* Linux Specific */
222#define __NR_readdir 204 /* Linux Specific */
223#define __NR_readahead 205 /* Linux Specific */
224#define __NR_socketcall 206 /* Linux Specific */
225#define __NR_syslog 207 /* Linux Specific */
226#define __NR_lookup_dcookie 208 /* Linux Specific */
227#define __NR_fadvise64 209 /* Linux Specific */
228#define __NR_fadvise64_64 210 /* Linux Specific */
229#define __NR_tgkill 211 /* Linux Specific */
230#define __NR_waitpid 212 /* Linux Specific */
231#define __NR_swapoff 213 /* Linux Specific */
232#define __NR_sysinfo 214 /* Linux Specific */
233#define __NR_ipc 215 /* Linux Specific */
234#define __NR_sigreturn 216 /* Linux Specific */
235#define __NR_clone 217 /* Linux Specific */
236#define __NR_ioprio_get 218 /* Linux Specific */
237#define __NR_adjtimex 219 /* Linux Specific */
238#define __NR_sigprocmask 220 /* Linux Specific */
239#define __NR_create_module 221 /* Linux Specific */
240#define __NR_delete_module 222 /* Linux Specific */
241#define __NR_get_kernel_syms 223 /* Linux Specific */
242#define __NR_getpgid 224 /* Linux Specific */
243#define __NR_bdflush 225 /* Linux Specific */
244#define __NR_sysfs 226 /* Linux Specific */
245#define __NR_afs_syscall 227 /* Linux Specific */
246#define __NR_setfsuid 228 /* Linux Specific */
247#define __NR_setfsgid 229 /* Linux Specific */
248#define __NR__newselect 230 /* Linux Specific */
249#ifdef __KERNEL__
250#define __NR_time 231 /* Linux sparc32 */
251#endif
252#define __NR_splice 232 /* Linux Specific */
253#define __NR_stime 233 /* Linux Specific */
254#define __NR_statfs64 234 /* Linux Specific */
255#define __NR_fstatfs64 235 /* Linux Specific */
256#define __NR__llseek 236 /* Linux Specific */
257#define __NR_mlock 237
258#define __NR_munlock 238
259#define __NR_mlockall 239
260#define __NR_munlockall 240
261#define __NR_sched_setparam 241
262#define __NR_sched_getparam 242
263#define __NR_sched_setscheduler 243
264#define __NR_sched_getscheduler 244
265#define __NR_sched_yield 245
266#define __NR_sched_get_priority_max 246
267#define __NR_sched_get_priority_min 247
268#define __NR_sched_rr_get_interval 248
269#define __NR_nanosleep 249
270#define __NR_mremap 250
271#define __NR__sysctl 251
272#define __NR_getsid 252
273#define __NR_fdatasync 253
274#define __NR_nfsservctl 254
275#define __NR_sync_file_range 255
276#define __NR_clock_settime 256
277#define __NR_clock_gettime 257
278#define __NR_clock_getres 258
279#define __NR_clock_nanosleep 259
280#define __NR_sched_getaffinity 260
281#define __NR_sched_setaffinity 261
282#define __NR_timer_settime 262
283#define __NR_timer_gettime 263
284#define __NR_timer_getoverrun 264
285#define __NR_timer_delete 265
286#define __NR_timer_create 266
287/* #define __NR_vserver 267 Reserved for VSERVER */
288#define __NR_io_setup 268
289#define __NR_io_destroy 269
290#define __NR_io_submit 270
291#define __NR_io_cancel 271
292#define __NR_io_getevents 272
293#define __NR_mq_open 273
294#define __NR_mq_unlink 274
295#define __NR_mq_timedsend 275
296#define __NR_mq_timedreceive 276
297#define __NR_mq_notify 277
298#define __NR_mq_getsetattr 278
299#define __NR_waitid 279
300#define __NR_tee 280
301#define __NR_add_key 281
302#define __NR_request_key 282
303#define __NR_keyctl 283
304#define __NR_openat 284
305#define __NR_mkdirat 285
306#define __NR_mknodat 286
307#define __NR_fchownat 287
308#define __NR_futimesat 288
309#define __NR_fstatat64 289
310#define __NR_unlinkat 290
311#define __NR_renameat 291
312#define __NR_linkat 292
313#define __NR_symlinkat 293
314#define __NR_readlinkat 294
315#define __NR_fchmodat 295
316#define __NR_faccessat 296
317#define __NR_pselect6 297
318#define __NR_ppoll 298
319#define __NR_unshare 299
320#define __NR_set_robust_list 300
321#define __NR_get_robust_list 301
322#define __NR_migrate_pages 302
323#define __NR_mbind 303
324#define __NR_get_mempolicy 304
325#define __NR_set_mempolicy 305
326#define __NR_kexec_load 306
327#define __NR_move_pages 307
328#define __NR_getcpu 308
329#define __NR_epoll_pwait 309
330#define __NR_utimensat 310
331#define __NR_signalfd 311
332#define __NR_timerfd_create 312
333#define __NR_eventfd 313
334#define __NR_fallocate 314
335#define __NR_timerfd_settime 315
336#define __NR_timerfd_gettime 316
337#define __NR_signalfd4 317
338#define __NR_eventfd2 318
339#define __NR_epoll_create1 319
340#define __NR_dup3 320
341#define __NR_pipe2 321
342#define __NR_inotify_init1 322
343#define __NR_accept4 323
344
345#define NR_SYSCALLS 324
346
347#ifdef __KERNEL__
348#define __ARCH_WANT_IPC_PARSE_VERSION
349#define __ARCH_WANT_OLD_READDIR
350#define __ARCH_WANT_STAT64
351#define __ARCH_WANT_SYS_ALARM
352#define __ARCH_WANT_SYS_GETHOSTNAME
353#define __ARCH_WANT_SYS_PAUSE
354#define __ARCH_WANT_SYS_SGETMASK
355#define __ARCH_WANT_SYS_SIGNAL
356#define __ARCH_WANT_SYS_TIME
357#define __ARCH_WANT_COMPAT_SYS_TIME
358#define __ARCH_WANT_SYS_UTIME
359#define __ARCH_WANT_SYS_WAITPID
360#define __ARCH_WANT_SYS_SOCKETCALL
361#define __ARCH_WANT_SYS_FADVISE64
362#define __ARCH_WANT_SYS_GETPGRP
363#define __ARCH_WANT_SYS_LLSEEK
364#define __ARCH_WANT_SYS_NICE
365#define __ARCH_WANT_SYS_OLDUMOUNT
366#define __ARCH_WANT_SYS_SIGPENDING
367#define __ARCH_WANT_SYS_SIGPROCMASK
368#define __ARCH_WANT_SYS_RT_SIGSUSPEND
369#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
370
371/*
372 * "Conditional" syscalls
373 *
374 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
375 * but it doesn't work on all toolchains, so we just do it by hand
376 */
377#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
378
379#endif /* __KERNEL__ */
380#endif /* _SPARC64_UNISTD_H */
diff --git a/arch/sparc/kernel/.gitignore b/arch/sparc/kernel/.gitignore
new file mode 100644
index 000000000000..c5f676c3c224
--- /dev/null
+++ b/arch/sparc/kernel/.gitignore
@@ -0,0 +1 @@
vmlinux.lds
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index 2d6582095099..53adcaa0348b 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -2,25 +2,98 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5extra-y := head.o init_task.o vmlinux.lds 5asflags-y := -ansi
6 6ccflags-y := -Werror
7EXTRA_AFLAGS := -ansi 7
8 8extra-y := head_$(BITS).o
9IRQ_OBJS := irq.o sun4m_irq.o sun4c_irq.o sun4d_irq.o 9extra-y += init_task.o
10obj-y := entry.o wof.o wuf.o etrap.o rtrap.o traps.o $(IRQ_OBJS) \ 10extra-y += vmlinux.lds
11 process.o signal.o ioport.o setup.o idprom.o \ 11
12 sys_sparc.o systbls.o \ 12obj-$(CONFIG_SPARC32) += entry.o wof.o wuf.o
13 time.o windows.o cpu.o devices.o \ 13obj-$(CONFIG_SPARC32) += etrap_32.o
14 tadpole.o tick14.o ptrace.o \ 14obj-$(CONFIG_SPARC32) += rtrap_32.o
15 unaligned.o una_asm.o muldiv.o \ 15obj-y += traps_$(BITS).o
16 prom.o of_device.o devres.o dma.o 16
17 17# IRQ
18devres-y = ../../../kernel/irq/devres.o 18obj-y += irq_$(BITS).o
19 19obj-$(CONFIG_SPARC32) += sun4m_irq.o sun4c_irq.o sun4d_irq.o
20obj-$(CONFIG_PCI) += pcic.o 20
21obj-$(CONFIG_SMP) += trampoline.o smp.o sun4m_smp.o sun4d_smp.o 21obj-y += process_$(BITS).o
22obj-$(CONFIG_SUN_AUXIO) += auxio.o 22obj-y += signal_$(BITS).o
23obj-$(CONFIG_SUN_PM) += apc.o pmc.o 23obj-$(CONFIG_SPARC32) += ioport.o
24obj-$(CONFIG_MODULES) += module.o sparc_ksyms.o 24obj-y += setup_$(BITS).o
25obj-$(CONFIG_SPARC_LED) += led.o 25obj-y += idprom.o
26obj-$(CONFIG_KGDB) += kgdb.o 26obj-y += sys_sparc_$(BITS).o
27obj-$(CONFIG_SPARC32) += systbls_32.o
28obj-y += time_$(BITS).o
29obj-$(CONFIG_SPARC32) += windows.o
30obj-y += cpu.o
31obj-$(CONFIG_SPARC32) += devices.o
32obj-$(CONFIG_SPARC32) += tadpole.o
33obj-$(CONFIG_SPARC32) += tick14.o
34obj-y += ptrace_$(BITS).o
35obj-y += unaligned_$(BITS).o
36obj-y += una_asm_$(BITS).o
37obj-$(CONFIG_SPARC32) += muldiv.o
38obj-y += prom_common.o
39obj-y += prom_$(BITS).o
40obj-y += of_device_$(BITS).o
41obj-$(CONFIG_SPARC64) += prom_irqtrans.o
42
43obj-$(CONFIG_SPARC64) += reboot.o
44obj-$(CONFIG_SPARC64) += sysfs.o
45obj-$(CONFIG_SPARC64) += iommu.o
46obj-$(CONFIG_SPARC64) += central.o
47obj-$(CONFIG_SPARC64) += starfire.o
48obj-$(CONFIG_SPARC64) += power.o
49obj-$(CONFIG_SPARC64) += sbus.o
50obj-$(CONFIG_SPARC64) += ebus.o
51obj-$(CONFIG_SPARC64) += visemul.o
52obj-$(CONFIG_SPARC64) += hvapi.o
53obj-$(CONFIG_SPARC64) += sstate.o
54obj-$(CONFIG_SPARC64) += mdesc.o
55
56# sparc32 do not use GENERIC_HARDIRQS but uses the generic devres implementation
57obj-$(CONFIG_SPARC32) += devres.o
58devres-y := ../../../kernel/irq/devres.o
59
60obj-$(CONFIG_SPARC32) += dma.o
61
62obj-$(CONFIG_SPARC32_PCI) += pcic.o
63
64obj-$(CONFIG_SMP) += trampoline_$(BITS).o smp_$(BITS).o
65obj-$(CONFIG_SPARC32_SMP) += sun4m_smp.o sun4d_smp.o
66obj-$(CONFIG_SPARC64_SMP) += hvtramp.o
67
68obj-y += auxio_$(BITS).o
69obj-$(CONFIG_SUN_PM) += apc.o pmc.o
70
71obj-$(CONFIG_MODULES) += module.o
72obj-$(CONFIG_MODULES) += sparc_ksyms_$(BITS).o
73obj-$(CONFIG_SPARC_LED) += led.o
74obj-$(CONFIG_KGDB) += kgdb_$(BITS).o
75
76
77obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
78CFLAGS_REMOVE_ftrace.o := -pg
79
80obj-$(CONFIG_STACKTRACE) += stacktrace.o
81# sparc64 PCI
82obj-$(CONFIG_SPARC64_PCI) += pci.o pci_common.o psycho_common.o
83obj-$(CONFIG_SPARC64_PCI) += pci_psycho.o pci_sabre.o pci_schizo.o
84obj-$(CONFIG_SPARC64_PCI) += pci_sun4v.o pci_sun4v_asm.o pci_fire.o
85obj-$(CONFIG_PCI_MSI) += pci_msi.o
86
87obj-$(CONFIG_COMPAT) += sys32.o sys_sparc32.o signal32.o
88
89# sparc64 cpufreq
90obj-$(CONFIG_US3_FREQ) += us3_cpufreq.o
91obj-$(CONFIG_US2E_FREQ) += us2e_cpufreq.o
92obj-$(CONFIG_US3_MC) += chmc.o
93
94obj-$(CONFIG_KPROBES) += kprobes.o
95obj-$(CONFIG_SUN_LDOMS) += ldc.o vio.o viohs.o ds.o
96
97obj-$(CONFIG_AUDIT) += audit.o
98audit--$(CONFIG_AUDIT) := compat_audit.o
99obj-$(CONFIG_COMPAT) += $(audit--y)
diff --git a/arch/sparc/kernel/asm-offsets.c b/arch/sparc/kernel/asm-offsets.c
index b5bb99ed892c..68f7e1118e9b 100644
--- a/arch/sparc/kernel/asm-offsets.c
+++ b/arch/sparc/kernel/asm-offsets.c
@@ -14,15 +14,28 @@
14// #include <linux/mm.h> 14// #include <linux/mm.h>
15#include <linux/kbuild.h> 15#include <linux/kbuild.h>
16 16
17int foo(void) 17#ifdef CONFIG_SPARC32
18int sparc32_foo(void)
18{ 19{
19 DEFINE(AOFF_task_thread, offsetof(struct task_struct, thread));
20 BLANK();
21 DEFINE(AOFF_thread_fork_kpsr, 20 DEFINE(AOFF_thread_fork_kpsr,
22 offsetof(struct thread_struct, fork_kpsr)); 21 offsetof(struct thread_struct, fork_kpsr));
22 return 0;
23}
24#else
25int sparc64_foo(void)
26{
27 return 0;
28}
29#endif
30
31int foo(void)
32{
33 BLANK();
34 DEFINE(AOFF_task_thread, offsetof(struct task_struct, thread));
23 BLANK(); 35 BLANK();
24 DEFINE(AOFF_mm_context, offsetof(struct mm_struct, context)); 36 DEFINE(AOFF_mm_context, offsetof(struct mm_struct, context));
25 37
26 /* DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28); */ 38 /* DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28); */
27 return 0; 39 return 0;
28} 40}
41
diff --git a/arch/sparc64/kernel/audit.c b/arch/sparc/kernel/audit.c
index 8fff0ac63d56..8fff0ac63d56 100644
--- a/arch/sparc64/kernel/audit.c
+++ b/arch/sparc/kernel/audit.c
diff --git a/arch/sparc/kernel/auxio.c b/arch/sparc/kernel/auxio_32.c
index 09c857215a52..09c857215a52 100644
--- a/arch/sparc/kernel/auxio.c
+++ b/arch/sparc/kernel/auxio_32.c
diff --git a/arch/sparc64/kernel/auxio.c b/arch/sparc/kernel/auxio_64.c
index 858beda86524..8b67347d4221 100644
--- a/arch/sparc64/kernel/auxio.c
+++ b/arch/sparc/kernel/auxio_64.c
@@ -27,73 +27,55 @@ enum auxio_type {
27static enum auxio_type auxio_devtype = AUXIO_TYPE_NODEV; 27static enum auxio_type auxio_devtype = AUXIO_TYPE_NODEV;
28static DEFINE_SPINLOCK(auxio_lock); 28static DEFINE_SPINLOCK(auxio_lock);
29 29
30static void __auxio_sbus_set(u8 bits_on, u8 bits_off) 30static void __auxio_rmw(u8 bits_on, u8 bits_off, int ebus)
31{ 31{
32 if (auxio_register) { 32 if (auxio_register) {
33 unsigned char regval;
34 unsigned long flags; 33 unsigned long flags;
35 unsigned char newval; 34 u8 regval, newval;
36 35
37 spin_lock_irqsave(&auxio_lock, flags); 36 spin_lock_irqsave(&auxio_lock, flags);
38 37
39 regval = sbus_readb(auxio_register); 38 regval = (ebus ?
39 (u8) readl(auxio_register) :
40 sbus_readb(auxio_register));
40 newval = regval | bits_on; 41 newval = regval | bits_on;
41 newval &= ~bits_off; 42 newval &= ~bits_off;
42 newval &= ~AUXIO_AUX1_MASK; 43 if (!ebus)
43 sbus_writeb(newval, auxio_register); 44 newval &= ~AUXIO_AUX1_MASK;
45 if (ebus)
46 writel((u32) newval, auxio_register);
47 else
48 sbus_writeb(newval, auxio_register);
44 49
45 spin_unlock_irqrestore(&auxio_lock, flags); 50 spin_unlock_irqrestore(&auxio_lock, flags);
46 } 51 }
47} 52}
48 53
49static void __auxio_ebus_set(u8 bits_on, u8 bits_off) 54static void __auxio_set_bit(u8 bit, int on, int ebus)
50{ 55{
51 if (auxio_register) { 56 u8 bits_on = (ebus ? AUXIO_PCIO_LED : AUXIO_AUX1_LED);
52 unsigned char regval; 57 u8 bits_off = 0;
53 unsigned long flags;
54 unsigned char newval;
55
56 spin_lock_irqsave(&auxio_lock, flags);
57
58 regval = (u8)readl(auxio_register);
59 newval = regval | bits_on;
60 newval &= ~bits_off;
61 writel((u32)newval, auxio_register);
62 58
63 spin_unlock_irqrestore(&auxio_lock, flags); 59 if (!on) {
60 u8 tmp = bits_off;
61 bits_off = bits_on;
62 bits_on = tmp;
64 } 63 }
65} 64 __auxio_rmw(bits_on, bits_off, ebus);
66
67static inline void __auxio_ebus_set_led(int on)
68{
69 (on) ? __auxio_ebus_set(AUXIO_PCIO_LED, 0) :
70 __auxio_ebus_set(0, AUXIO_PCIO_LED) ;
71}
72
73static inline void __auxio_sbus_set_led(int on)
74{
75 (on) ? __auxio_sbus_set(AUXIO_AUX1_LED, 0) :
76 __auxio_sbus_set(0, AUXIO_AUX1_LED) ;
77} 65}
78 66
79void auxio_set_led(int on) 67void auxio_set_led(int on)
80{ 68{
81 switch(auxio_devtype) { 69 int ebus = auxio_devtype == AUXIO_TYPE_EBUS;
82 case AUXIO_TYPE_SBUS: 70 u8 bit;
83 __auxio_sbus_set_led(on); 71
84 break; 72 bit = (ebus ? AUXIO_PCIO_LED : AUXIO_AUX1_LED);
85 case AUXIO_TYPE_EBUS: 73 __auxio_set_bit(bit, on, ebus);
86 __auxio_ebus_set_led(on);
87 break;
88 default:
89 break;
90 }
91} 74}
92 75
93static inline void __auxio_sbus_set_lte(int on) 76static void __auxio_sbus_set_lte(int on)
94{ 77{
95 (on) ? __auxio_sbus_set(AUXIO_AUX1_LTE, 0) : 78 __auxio_set_bit(AUXIO_AUX1_LTE, on, 0);
96 __auxio_sbus_set(0, AUXIO_AUX1_LTE) ;
97} 79}
98 80
99void auxio_set_lte(int on) 81void auxio_set_lte(int on)
diff --git a/arch/sparc64/kernel/central.c b/arch/sparc/kernel/central.c
index 05f1c916db06..05f1c916db06 100644
--- a/arch/sparc64/kernel/central.c
+++ b/arch/sparc/kernel/central.c
diff --git a/arch/sparc64/kernel/cherrs.S b/arch/sparc/kernel/cherrs.S
index 89afebd7eca0..4ee1ad420862 100644
--- a/arch/sparc64/kernel/cherrs.S
+++ b/arch/sparc/kernel/cherrs.S
@@ -102,7 +102,7 @@ cheetah_plus_dcpe_trap_vector:
102 .type do_cheetah_plus_data_parity,#function 102 .type do_cheetah_plus_data_parity,#function
103do_cheetah_plus_data_parity: 103do_cheetah_plus_data_parity:
104 rdpr %pil, %g2 104 rdpr %pil, %g2
105 wrpr %g0, 15, %pil 105 wrpr %g0, PIL_NORMAL_MAX, %pil
106 ba,pt %xcc, etrap_irq 106 ba,pt %xcc, etrap_irq
107 rd %pc, %g7 107 rd %pc, %g7
108#ifdef CONFIG_TRACE_IRQFLAGS 108#ifdef CONFIG_TRACE_IRQFLAGS
@@ -144,7 +144,7 @@ cheetah_plus_icpe_trap_vector:
144 .type do_cheetah_plus_insn_parity,#function 144 .type do_cheetah_plus_insn_parity,#function
145do_cheetah_plus_insn_parity: 145do_cheetah_plus_insn_parity:
146 rdpr %pil, %g2 146 rdpr %pil, %g2
147 wrpr %g0, 15, %pil 147 wrpr %g0, PIL_NORMAL_MAX, %pil
148 ba,pt %xcc, etrap_irq 148 ba,pt %xcc, etrap_irq
149 rd %pc, %g7 149 rd %pc, %g7
150#ifdef CONFIG_TRACE_IRQFLAGS 150#ifdef CONFIG_TRACE_IRQFLAGS
@@ -492,7 +492,7 @@ cheetah_fast_ecc:
492 .type c_fast_ecc,#function 492 .type c_fast_ecc,#function
493c_fast_ecc: 493c_fast_ecc:
494 rdpr %pil, %g2 494 rdpr %pil, %g2
495 wrpr %g0, 15, %pil 495 wrpr %g0, PIL_NORMAL_MAX, %pil
496 ba,pt %xcc, etrap_irq 496 ba,pt %xcc, etrap_irq
497 rd %pc, %g7 497 rd %pc, %g7
498#ifdef CONFIG_TRACE_IRQFLAGS 498#ifdef CONFIG_TRACE_IRQFLAGS
@@ -528,7 +528,7 @@ cheetah_cee:
528 .type c_cee,#function 528 .type c_cee,#function
529c_cee: 529c_cee:
530 rdpr %pil, %g2 530 rdpr %pil, %g2
531 wrpr %g0, 15, %pil 531 wrpr %g0, PIL_NORMAL_MAX, %pil
532 ba,pt %xcc, etrap_irq 532 ba,pt %xcc, etrap_irq
533 rd %pc, %g7 533 rd %pc, %g7
534#ifdef CONFIG_TRACE_IRQFLAGS 534#ifdef CONFIG_TRACE_IRQFLAGS
@@ -564,7 +564,7 @@ cheetah_deferred_trap:
564 .type c_deferred,#function 564 .type c_deferred,#function
565c_deferred: 565c_deferred:
566 rdpr %pil, %g2 566 rdpr %pil, %g2
567 wrpr %g0, 15, %pil 567 wrpr %g0, PIL_NORMAL_MAX, %pil
568 ba,pt %xcc, etrap_irq 568 ba,pt %xcc, etrap_irq
569 rd %pc, %g7 569 rd %pc, %g7
570#ifdef CONFIG_TRACE_IRQFLAGS 570#ifdef CONFIG_TRACE_IRQFLAGS
diff --git a/arch/sparc64/kernel/chmc.c b/arch/sparc/kernel/chmc.c
index 3b9f4d6e14a9..3b9f4d6e14a9 100644
--- a/arch/sparc64/kernel/chmc.c
+++ b/arch/sparc/kernel/chmc.c
diff --git a/arch/sparc64/kernel/compat_audit.c b/arch/sparc/kernel/compat_audit.c
index c831b0a4e660..d865575b25bf 100644
--- a/arch/sparc64/kernel/compat_audit.c
+++ b/arch/sparc/kernel/compat_audit.c
@@ -1,4 +1,5 @@
1#include <asm/unistd_32.h> 1#define __32bit_syscall_numbers__
2#include <asm/unistd.h>
2 3
3unsigned sparc32_dir_class[] = { 4unsigned sparc32_dir_class[] = {
4#include <asm-generic/audit_dir_write.h> 5#include <asm-generic/audit_dir_write.h>
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c
index 1fc17f59c6bf..6c2da2420f76 100644
--- a/arch/sparc/kernel/cpu.c
+++ b/arch/sparc/kernel/cpu.c
@@ -8,6 +8,8 @@
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/smp.h> 9#include <linux/smp.h>
10#include <linux/threads.h> 10#include <linux/threads.h>
11
12#include <asm/spitfire.h>
11#include <asm/oplib.h> 13#include <asm/oplib.h>
12#include <asm/page.h> 14#include <asm/page.h>
13#include <asm/head.h> 15#include <asm/head.h>
@@ -15,153 +17,322 @@
15#include <asm/mbus.h> 17#include <asm/mbus.h>
16#include <asm/cpudata.h> 18#include <asm/cpudata.h>
17 19
20#include "kernel.h"
21
18DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 }; 22DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 };
19 23
20struct cpu_iu_info { 24struct cpu_info {
21 int psr_impl; 25 int psr_vers;
22 int psr_vers; 26 const char *name;
23 char* cpu_name; /* should be enough I hope... */ 27};
28
29struct fpu_info {
30 int fp_vers;
31 const char *name;
24}; 32};
25 33
26struct cpu_fp_info { 34#define NOCPU 8
27 int psr_impl; 35#define NOFPU 8
28 int fp_vers; 36
29 char* fp_name; 37struct manufacturer_info {
38 int psr_impl;
39 struct cpu_info cpu_info[NOCPU];
40 struct fpu_info fpu_info[NOFPU];
30}; 41};
31 42
43#define CPU(ver, _name) \
44{ .psr_vers = ver, .name = _name }
45
46#define FPU(ver, _name) \
47{ .fp_vers = ver, .name = _name }
48
49static const struct manufacturer_info __initconst manufacturer_info[] = {
50{
51 0,
52 /* Sun4/100, 4/200, SLC */
53 .cpu_info = {
54 CPU(0, "Fujitsu MB86900/1A or LSI L64831 SparcKIT-40"),
55 /* borned STP1012PGA */
56 CPU(4, "Fujitsu MB86904"),
57 CPU(5, "Fujitsu TurboSparc MB86907"),
58 CPU(-1, NULL)
59 },
60 .fpu_info = {
61 FPU(0, "Fujitsu MB86910 or Weitek WTL1164/5"),
62 FPU(1, "Fujitsu MB86911 or Weitek WTL1164/5 or LSI L64831"),
63 FPU(2, "LSI Logic L64802 or Texas Instruments ACT8847"),
64 /* SparcStation SLC, SparcStation1 */
65 FPU(3, "Weitek WTL3170/2"),
66 /* SPARCstation-5 */
67 FPU(4, "Lsi Logic/Meiko L64804 or compatible"),
68 FPU(-1, NULL)
69 }
70},{
71 1,
72 .cpu_info = {
73 /* SparcStation2, SparcServer 490 & 690 */
74 CPU(0, "LSI Logic Corporation - L64811"),
75 /* SparcStation2 */
76 CPU(1, "Cypress/ROSS CY7C601"),
77 /* Embedded controller */
78 CPU(3, "Cypress/ROSS CY7C611"),
79 /* Ross Technologies HyperSparc */
80 CPU(0xf, "ROSS HyperSparc RT620"),
81 CPU(0xe, "ROSS HyperSparc RT625 or RT626"),
82 CPU(-1, NULL)
83 },
84 .fpu_info = {
85 FPU(0, "ROSS HyperSparc combined IU/FPU"),
86 FPU(1, "Lsi Logic L64814"),
87 FPU(2, "Texas Instruments TMS390-C602A"),
88 FPU(3, "Cypress CY7C602 FPU"),
89 FPU(-1, NULL)
90 }
91},{
92 2,
93 .cpu_info = {
94 /* ECL Implementation, CRAY S-MP Supercomputer... AIEEE! */
95 /* Someone please write the code to support this beast! ;) */
96 CPU(0, "Bipolar Integrated Technology - B5010"),
97 CPU(-1, NULL)
98 },
99 .fpu_info = {
100 FPU(-1, NULL)
101 }
102},{
103 3,
104 .cpu_info = {
105 CPU(0, "LSI Logic Corporation - unknown-type"),
106 CPU(-1, NULL)
107 },
108 .fpu_info = {
109 FPU(-1, NULL)
110 }
111},{
112 4,
113 .cpu_info = {
114 CPU(0, "Texas Instruments, Inc. - SuperSparc-(II)"),
115 /* SparcClassic -- borned STP1010TAB-50*/
116 CPU(1, "Texas Instruments, Inc. - MicroSparc"),
117 CPU(2, "Texas Instruments, Inc. - MicroSparc II"),
118 CPU(3, "Texas Instruments, Inc. - SuperSparc 51"),
119 CPU(4, "Texas Instruments, Inc. - SuperSparc 61"),
120 CPU(5, "Texas Instruments, Inc. - unknown"),
121 CPU(-1, NULL)
122 },
123 .fpu_info = {
124 /* SuperSparc 50 module */
125 FPU(0, "SuperSparc on-chip FPU"),
126 /* SparcClassic */
127 FPU(4, "TI MicroSparc on chip FPU"),
128 FPU(-1, NULL)
129 }
130},{
131 5,
132 .cpu_info = {
133 CPU(0, "Matsushita - MN10501"),
134 CPU(-1, NULL)
135 },
136 .fpu_info = {
137 FPU(0, "Matsushita MN10501"),
138 FPU(-1, NULL)
139 }
140},{
141 6,
142 .cpu_info = {
143 CPU(0, "Philips Corporation - unknown"),
144 CPU(-1, NULL)
145 },
146 .fpu_info = {
147 FPU(-1, NULL)
148 }
149},{
150 7,
151 .cpu_info = {
152 CPU(0, "Harvest VLSI Design Center, Inc. - unknown"),
153 CPU(-1, NULL)
154 },
155 .fpu_info = {
156 FPU(-1, NULL)
157 }
158},{
159 8,
160 .cpu_info = {
161 CPU(0, "Systems and Processes Engineering Corporation (SPEC)"),
162 CPU(-1, NULL)
163 },
164 .fpu_info = {
165 FPU(-1, NULL)
166 }
167},{
168 9,
169 .cpu_info = {
170 /* Gallium arsenide 200MHz, BOOOOGOOOOMIPS!!! */
171 CPU(0, "Fujitsu or Weitek Power-UP"),
172 CPU(1, "Fujitsu or Weitek Power-UP"),
173 CPU(2, "Fujitsu or Weitek Power-UP"),
174 CPU(3, "Fujitsu or Weitek Power-UP"),
175 CPU(-1, NULL)
176 },
177 .fpu_info = {
178 FPU(3, "Fujitsu or Weitek on-chip FPU"),
179 FPU(-1, NULL)
180 }
181},{
182 0x17,
183 .cpu_info = {
184 CPU(0x10, "TI UltraSparc I (SpitFire)"),
185 CPU(0x11, "TI UltraSparc II (BlackBird)"),
186 CPU(0x12, "TI UltraSparc IIi (Sabre)"),
187 CPU(0x13, "TI UltraSparc IIe (Hummingbird)"),
188 CPU(-1, NULL)
189 },
190 .fpu_info = {
191 FPU(0x10, "UltraSparc I integrated FPU"),
192 FPU(0x11, "UltraSparc II integrated FPU"),
193 FPU(0x12, "UltraSparc IIi integrated FPU"),
194 FPU(0x13, "UltraSparc IIe integrated FPU"),
195 FPU(-1, NULL)
196 }
197},{
198 0x22,
199 .cpu_info = {
200 CPU(0x10, "TI UltraSparc I (SpitFire)"),
201 CPU(-1, NULL)
202 },
203 .fpu_info = {
204 FPU(0x10, "UltraSparc I integrated FPU"),
205 FPU(-1, NULL)
206 }
207},{
208 0x3e,
209 .cpu_info = {
210 CPU(0x14, "TI UltraSparc III (Cheetah)"),
211 CPU(0x15, "TI UltraSparc III+ (Cheetah+)"),
212 CPU(0x16, "TI UltraSparc IIIi (Jalapeno)"),
213 CPU(0x18, "TI UltraSparc IV (Jaguar)"),
214 CPU(0x19, "TI UltraSparc IV+ (Panther)"),
215 CPU(0x22, "TI UltraSparc IIIi+ (Serrano)"),
216 CPU(-1, NULL)
217 },
218 .fpu_info = {
219 FPU(0x14, "UltraSparc III integrated FPU"),
220 FPU(0x15, "UltraSparc III+ integrated FPU"),
221 FPU(0x16, "UltraSparc IIIi integrated FPU"),
222 FPU(0x18, "UltraSparc IV integrated FPU"),
223 FPU(0x19, "UltraSparc IV+ integrated FPU"),
224 FPU(0x22, "UltraSparc IIIi+ integrated FPU"),
225 FPU(-1, NULL)
226 }
227}};
228
32/* In order to get the fpu type correct, you need to take the IDPROM's 229/* In order to get the fpu type correct, you need to take the IDPROM's
33 * machine type value into consideration too. I will fix this. 230 * machine type value into consideration too. I will fix this.
34 */ 231 */
35static struct cpu_fp_info linux_sparc_fpu[] = {
36 { 0, 0, "Fujitsu MB86910 or Weitek WTL1164/5"},
37 { 0, 1, "Fujitsu MB86911 or Weitek WTL1164/5 or LSI L64831"},
38 { 0, 2, "LSI Logic L64802 or Texas Instruments ACT8847"},
39 /* SparcStation SLC, SparcStation1 */
40 { 0, 3, "Weitek WTL3170/2"},
41 /* SPARCstation-5 */
42 { 0, 4, "Lsi Logic/Meiko L64804 or compatible"},
43 { 0, 5, "reserved"},
44 { 0, 6, "reserved"},
45 { 0, 7, "No FPU"},
46 { 1, 0, "ROSS HyperSparc combined IU/FPU"},
47 { 1, 1, "Lsi Logic L64814"},
48 { 1, 2, "Texas Instruments TMS390-C602A"},
49 { 1, 3, "Cypress CY7C602 FPU"},
50 { 1, 4, "reserved"},
51 { 1, 5, "reserved"},
52 { 1, 6, "reserved"},
53 { 1, 7, "No FPU"},
54 { 2, 0, "BIT B5010 or B5110/20 or B5210"},
55 { 2, 1, "reserved"},
56 { 2, 2, "reserved"},
57 { 2, 3, "reserved"},
58 { 2, 4, "reserved"},
59 { 2, 5, "reserved"},
60 { 2, 6, "reserved"},
61 { 2, 7, "No FPU"},
62 /* SuperSparc 50 module */
63 { 4, 0, "SuperSparc on-chip FPU"},
64 /* SparcClassic */
65 { 4, 4, "TI MicroSparc on chip FPU"},
66 { 5, 0, "Matsushita MN10501"},
67 { 5, 1, "reserved"},
68 { 5, 2, "reserved"},
69 { 5, 3, "reserved"},
70 { 5, 4, "reserved"},
71 { 5, 5, "reserved"},
72 { 5, 6, "reserved"},
73 { 5, 7, "No FPU"},
74 { 9, 3, "Fujitsu or Weitek on-chip FPU"},
75};
76 232
77#define NSPARCFPU ARRAY_SIZE(linux_sparc_fpu) 233const char *sparc_cpu_type;
78 234const char *sparc_fpu_type;
79static struct cpu_iu_info linux_sparc_chips[] = {
80 /* Sun4/100, 4/200, SLC */
81 { 0, 0, "Fujitsu MB86900/1A or LSI L64831 SparcKIT-40"},
82 /* borned STP1012PGA */
83 { 0, 4, "Fujitsu MB86904"},
84 { 0, 5, "Fujitsu TurboSparc MB86907"},
85 /* SparcStation2, SparcServer 490 & 690 */
86 { 1, 0, "LSI Logic Corporation - L64811"},
87 /* SparcStation2 */
88 { 1, 1, "Cypress/ROSS CY7C601"},
89 /* Embedded controller */
90 { 1, 3, "Cypress/ROSS CY7C611"},
91 /* Ross Technologies HyperSparc */
92 { 1, 0xf, "ROSS HyperSparc RT620"},
93 { 1, 0xe, "ROSS HyperSparc RT625 or RT626"},
94 /* ECL Implementation, CRAY S-MP Supercomputer... AIEEE! */
95 /* Someone please write the code to support this beast! ;) */
96 { 2, 0, "Bipolar Integrated Technology - B5010"},
97 { 3, 0, "LSI Logic Corporation - unknown-type"},
98 { 4, 0, "Texas Instruments, Inc. - SuperSparc-(II)"},
99 /* SparcClassic -- borned STP1010TAB-50*/
100 { 4, 1, "Texas Instruments, Inc. - MicroSparc"},
101 { 4, 2, "Texas Instruments, Inc. - MicroSparc II"},
102 { 4, 3, "Texas Instruments, Inc. - SuperSparc 51"},
103 { 4, 4, "Texas Instruments, Inc. - SuperSparc 61"},
104 { 4, 5, "Texas Instruments, Inc. - unknown"},
105 { 5, 0, "Matsushita - MN10501"},
106 { 6, 0, "Philips Corporation - unknown"},
107 { 7, 0, "Harvest VLSI Design Center, Inc. - unknown"},
108 /* Gallium arsenide 200MHz, BOOOOGOOOOMIPS!!! */
109 { 8, 0, "Systems and Processes Engineering Corporation (SPEC)"},
110 { 9, 0, "Fujitsu or Weitek Power-UP"},
111 { 9, 1, "Fujitsu or Weitek Power-UP"},
112 { 9, 2, "Fujitsu or Weitek Power-UP"},
113 { 9, 3, "Fujitsu or Weitek Power-UP"},
114 { 0xa, 0, "UNKNOWN CPU-VENDOR/TYPE"},
115 { 0xb, 0, "UNKNOWN CPU-VENDOR/TYPE"},
116 { 0xc, 0, "UNKNOWN CPU-VENDOR/TYPE"},
117 { 0xd, 0, "UNKNOWN CPU-VENDOR/TYPE"},
118 { 0xe, 0, "UNKNOWN CPU-VENDOR/TYPE"},
119 { 0xf, 0, "UNKNOWN CPU-VENDOR/TYPE"},
120};
121 235
122#define NSPARCCHIPS ARRAY_SIZE(linux_sparc_chips) 236unsigned int fsr_storage;
123 237
124char *sparc_cpu_type; 238static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers)
125char *sparc_fpu_type; 239{
240 sparc_cpu_type = NULL;
241 sparc_fpu_type = NULL;
242 if (psr_impl < ARRAY_SIZE(manufacturer_info))
243 {
244 const struct cpu_info *cpu;
245 const struct fpu_info *fpu;
126 246
127unsigned int fsr_storage; 247 cpu = &manufacturer_info[psr_impl].cpu_info[0];
248 while (cpu->psr_vers != -1)
249 {
250 if (cpu->psr_vers == psr_vers) {
251 sparc_cpu_type = cpu->name;
252 sparc_fpu_type = "No FPU";
253 break;
254 }
255 cpu++;
256 }
257 fpu = &manufacturer_info[psr_impl].fpu_info[0];
258 while (fpu->fp_vers != -1)
259 {
260 if (fpu->fp_vers == fpu_vers) {
261 sparc_fpu_type = fpu->name;
262 break;
263 }
264 fpu++;
265 }
266 }
267 if (sparc_cpu_type == NULL)
268 {
269 printk(KERN_ERR "CPU: Unknown chip, impl[0x%x] vers[0x%x]\n",
270 psr_impl, psr_vers);
271 sparc_cpu_type = "Unknown CPU";
272 }
273 if (sparc_fpu_type == NULL)
274 {
275 printk(KERN_ERR "FPU: Unknown chip, impl[0x%x] vers[0x%x]\n",
276 psr_impl, fpu_vers);
277 sparc_fpu_type = "Unknown FPU";
278 }
279}
128 280
281#ifdef CONFIG_SPARC32
129void __cpuinit cpu_probe(void) 282void __cpuinit cpu_probe(void)
130{ 283{
131 int psr_impl, psr_vers, fpu_vers; 284 int psr_impl, psr_vers, fpu_vers;
132 int i, psr; 285 int psr;
133 286
134 psr_impl = ((get_psr()>>28)&0xf); 287 psr_impl = ((get_psr() >> 28) & 0xf);
135 psr_vers = ((get_psr()>>24)&0xf); 288 psr_vers = ((get_psr() >> 24) & 0xf);
136 289
137 psr = get_psr(); 290 psr = get_psr();
138 put_psr(psr | PSR_EF); 291 put_psr(psr | PSR_EF);
139 fpu_vers = ((get_fsr()>>17)&0x7); 292 fpu_vers = ((get_fsr() >> 17) & 0x7);
140 put_psr(psr); 293 put_psr(psr);
141 294
142 for(i = 0; i<NSPARCCHIPS; i++) { 295 set_cpu_and_fpu(psr_impl, psr_vers, fpu_vers);
143 if(linux_sparc_chips[i].psr_impl == psr_impl) 296}
144 if(linux_sparc_chips[i].psr_vers == psr_vers) { 297#else
145 sparc_cpu_type = linux_sparc_chips[i].cpu_name; 298static void __init sun4v_cpu_probe(void)
146 break; 299{
147 } 300 switch (sun4v_chip_type) {
148 } 301 case SUN4V_CHIP_NIAGARA1:
302 sparc_cpu_type = "UltraSparc T1 (Niagara)";
303 sparc_fpu_type = "UltraSparc T1 integrated FPU";
304 break;
149 305
150 if(i==NSPARCCHIPS) 306 case SUN4V_CHIP_NIAGARA2:
151 printk("DEBUG: psr.impl = 0x%x psr.vers = 0x%x\n", psr_impl, 307 sparc_cpu_type = "UltraSparc T2 (Niagara2)";
152 psr_vers); 308 sparc_fpu_type = "UltraSparc T2 integrated FPU";
309 break;
153 310
154 for(i = 0; i<NSPARCFPU; i++) { 311 default:
155 if(linux_sparc_fpu[i].psr_impl == psr_impl) 312 printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n",
156 if(linux_sparc_fpu[i].fp_vers == fpu_vers) { 313 prom_cpu_compatible);
157 sparc_fpu_type = linux_sparc_fpu[i].fp_name; 314 sparc_cpu_type = "Unknown SUN4V CPU";
158 break; 315 sparc_fpu_type = "Unknown SUN4V FPU";
159 } 316 break;
160 } 317 }
318}
319
320static int __init cpu_type_probe(void)
321{
322 if (tlb_type == hypervisor) {
323 sun4v_cpu_probe();
324 } else {
325 unsigned long ver;
326 int manuf, impl;
161 327
162 if(i == NSPARCFPU) { 328 __asm__ __volatile__("rdpr %%ver, %0" : "=r" (ver));
163 printk("DEBUG: psr.impl = 0x%x fsr.vers = 0x%x\n", psr_impl, 329
164 fpu_vers); 330 manuf = ((ver >> 48) & 0xffff);
165 sparc_fpu_type = linux_sparc_fpu[31].fp_name; 331 impl = ((ver >> 32) & 0xffff);
332 set_cpu_and_fpu(manuf, impl, impl);
166 } 333 }
334 return 0;
167} 335}
336
337arch_initcall(cpu_type_probe);
338#endif
diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c
index ad656b044b8c..b171ae8de90d 100644
--- a/arch/sparc/kernel/devices.c
+++ b/arch/sparc/kernel/devices.c
@@ -133,14 +133,12 @@ void __init device_scan(void)
133#endif /* !CONFIG_SMP */ 133#endif /* !CONFIG_SMP */
134 134
135 cpu_probe(); 135 cpu_probe();
136#ifdef CONFIG_SUN_AUXIO
137 { 136 {
138 extern void auxio_probe(void); 137 extern void auxio_probe(void);
139 extern void auxio_power_probe(void); 138 extern void auxio_power_probe(void);
140 auxio_probe(); 139 auxio_probe();
141 auxio_power_probe(); 140 auxio_power_probe();
142 } 141 }
143#endif
144 clock_stop_probe(); 142 clock_stop_probe();
145 143
146 if (ARCH_SUN4C) 144 if (ARCH_SUN4C)
diff --git a/arch/sparc64/kernel/ds.c b/arch/sparc/kernel/ds.c
index f52e0534d91d..f52e0534d91d 100644
--- a/arch/sparc64/kernel/ds.c
+++ b/arch/sparc/kernel/ds.c
diff --git a/arch/sparc64/kernel/dtlb_miss.S b/arch/sparc/kernel/dtlb_miss.S
index 09a6a15a7105..09a6a15a7105 100644
--- a/arch/sparc64/kernel/dtlb_miss.S
+++ b/arch/sparc/kernel/dtlb_miss.S
diff --git a/arch/sparc64/kernel/dtlb_prot.S b/arch/sparc/kernel/dtlb_prot.S
index b2c2c5be281c..b2c2c5be281c 100644
--- a/arch/sparc64/kernel/dtlb_prot.S
+++ b/arch/sparc/kernel/dtlb_prot.S
diff --git a/arch/sparc64/kernel/ebus.c b/arch/sparc/kernel/ebus.c
index 77dbf6d45faf..77dbf6d45faf 100644
--- a/arch/sparc64/kernel/ebus.c
+++ b/arch/sparc/kernel/ebus.c
diff --git a/arch/sparc64/kernel/entry.h b/arch/sparc/kernel/entry.h
index 34d7ab5e10d2..4f53a2395ac6 100644
--- a/arch/sparc64/kernel/entry.h
+++ b/arch/sparc/kernel/entry.h
@@ -5,9 +5,43 @@
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/init.h> 6#include <linux/init.h>
7 7
8extern const char *sparc_cpu_type; 8/* irq */
9extern const char *sparc_fpu_type; 9extern void handler_irq(int irq, struct pt_regs *regs);
10 10
11#ifdef CONFIG_SPARC32
12/* traps */
13extern void do_hw_interrupt(struct pt_regs *regs, unsigned long type);
14extern void do_illegal_instruction(struct pt_regs *regs, unsigned long pc,
15 unsigned long npc, unsigned long psr);
16
17extern void do_priv_instruction(struct pt_regs *regs, unsigned long pc,
18 unsigned long npc, unsigned long psr);
19extern void do_memaccess_unaligned(struct pt_regs *regs, unsigned long pc,
20 unsigned long npc,
21 unsigned long psr);
22extern void do_fpd_trap(struct pt_regs *regs, unsigned long pc,
23 unsigned long npc, unsigned long psr);
24extern void do_fpe_trap(struct pt_regs *regs, unsigned long pc,
25 unsigned long npc, unsigned long psr);
26extern void handle_tag_overflow(struct pt_regs *regs, unsigned long pc,
27 unsigned long npc, unsigned long psr);
28extern void handle_watchpoint(struct pt_regs *regs, unsigned long pc,
29 unsigned long npc, unsigned long psr);
30extern void handle_reg_access(struct pt_regs *regs, unsigned long pc,
31 unsigned long npc, unsigned long psr);
32extern void handle_cp_disabled(struct pt_regs *regs, unsigned long pc,
33 unsigned long npc, unsigned long psr);
34extern void handle_cp_exception(struct pt_regs *regs, unsigned long pc,
35 unsigned long npc, unsigned long psr);
36
37
38
39/* entry.S */
40extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
41 void *fpqueue, unsigned long *fpqdepth);
42extern void fpload(unsigned long *fpregs, unsigned long *fsr);
43
44#else /* CONFIG_SPARC32 */
11extern void __init per_cpu_patch(void); 45extern void __init per_cpu_patch(void);
12extern void __init sun4v_patch(void); 46extern void __init sun4v_patch(void);
13extern void __init boot_cpu_id_too_large(int cpu); 47extern void __init boot_cpu_id_too_large(int cpu);
@@ -188,8 +222,8 @@ struct ino_bucket {
188extern struct ino_bucket *ivector_table; 222extern struct ino_bucket *ivector_table;
189extern unsigned long ivector_table_pa; 223extern unsigned long ivector_table_pa;
190 224
191extern void handler_irq(int irq, struct pt_regs *regs);
192extern void init_irqwork_curcpu(void); 225extern void init_irqwork_curcpu(void);
193extern void __cpuinit sun4v_register_mondo_queues(int this_cpu); 226extern void __cpuinit sun4v_register_mondo_queues(int this_cpu);
194 227
228#endif /* CONFIG_SPARC32 */
195#endif /* _ENTRY_H */ 229#endif /* _ENTRY_H */
diff --git a/arch/sparc/kernel/etrap.S b/arch/sparc/kernel/etrap_32.S
index e806fcdc46db..e806fcdc46db 100644
--- a/arch/sparc/kernel/etrap.S
+++ b/arch/sparc/kernel/etrap_32.S
diff --git a/arch/sparc64/kernel/etrap.S b/arch/sparc/kernel/etrap_64.S
index 29ce489bc188..786b185e6e3f 100644
--- a/arch/sparc64/kernel/etrap.S
+++ b/arch/sparc/kernel/etrap_64.S
@@ -16,9 +16,9 @@
16#include <asm/mmu.h> 16#include <asm/mmu.h>
17 17
18#define TASK_REGOFF (THREAD_SIZE-TRACEREG_SZ-STACKFRAME_SZ) 18#define TASK_REGOFF (THREAD_SIZE-TRACEREG_SZ-STACKFRAME_SZ)
19#define ETRAP_PSTATE1 (PSTATE_RMO | PSTATE_PRIV) 19#define ETRAP_PSTATE1 (PSTATE_TSO | PSTATE_PRIV)
20#define ETRAP_PSTATE2 \ 20#define ETRAP_PSTATE2 \
21 (PSTATE_RMO | PSTATE_PEF | PSTATE_PRIV | PSTATE_IE) 21 (PSTATE_TSO | PSTATE_PEF | PSTATE_PRIV | PSTATE_IE)
22 22
23/* 23/*
24 * On entry, %g7 is return address - 0x4. 24 * On entry, %g7 is return address - 0x4.
@@ -130,7 +130,7 @@ etrap_save: save %g2, -STACK_BIAS, %sp
130 stx %g6, [%sp + PTREGS_OFF + PT_V9_G6] 130 stx %g6, [%sp + PTREGS_OFF + PT_V9_G6]
131 stx %g7, [%sp + PTREGS_OFF + PT_V9_G7] 131 stx %g7, [%sp + PTREGS_OFF + PT_V9_G7]
132 or %l7, %l0, %l7 132 or %l7, %l0, %l7
133 sethi %hi(TSTATE_RMO | TSTATE_PEF), %l0 133 sethi %hi(TSTATE_TSO | TSTATE_PEF), %l0
134 or %l7, %l0, %l7 134 or %l7, %l0, %l7
135 wrpr %l2, %tnpc 135 wrpr %l2, %tnpc
136 wrpr %l7, (TSTATE_PRIV | TSTATE_IE), %tstate 136 wrpr %l7, (TSTATE_PRIV | TSTATE_IE), %tstate
diff --git a/arch/sparc64/kernel/fpu_traps.S b/arch/sparc/kernel/fpu_traps.S
index a6864826a4bd..a6864826a4bd 100644
--- a/arch/sparc64/kernel/fpu_traps.S
+++ b/arch/sparc/kernel/fpu_traps.S
diff --git a/arch/sparc64/kernel/ftrace.c b/arch/sparc/kernel/ftrace.c
index d0218e73f982..d0218e73f982 100644
--- a/arch/sparc64/kernel/ftrace.c
+++ b/arch/sparc/kernel/ftrace.c
diff --git a/arch/sparc64/kernel/getsetcc.S b/arch/sparc/kernel/getsetcc.S
index a14d272d2061..a14d272d2061 100644
--- a/arch/sparc64/kernel/getsetcc.S
+++ b/arch/sparc/kernel/getsetcc.S
diff --git a/arch/sparc/kernel/head.S b/arch/sparc/kernel/head_32.S
index 51b40426f9c6..f0b4b516304f 100644
--- a/arch/sparc/kernel/head.S
+++ b/arch/sparc/kernel/head_32.S
@@ -990,7 +990,7 @@ sun4c_continue_boot:
990 990
991 /* Zero out our BSS section. */ 991 /* Zero out our BSS section. */
992 set __bss_start , %o0 ! First address of BSS 992 set __bss_start , %o0 ! First address of BSS
993 set end , %o1 ! Last address of BSS 993 set _end , %o1 ! Last address of BSS
994 add %o0, 0x1, %o0 994 add %o0, 0x1, %o0
9951: 9951:
996 stb %g0, [%o0] 996 stb %g0, [%o0]
diff --git a/arch/sparc64/kernel/head.S b/arch/sparc/kernel/head_64.S
index 353226fa0239..8ffee714f932 100644
--- a/arch/sparc64/kernel/head.S
+++ b/arch/sparc/kernel/head_64.S
@@ -706,7 +706,7 @@ setup_trap_table:
706 andn %l0, PSTATE_IE, %o1 706 andn %l0, PSTATE_IE, %o1
707 wrpr %o1, 0x0, %pstate 707 wrpr %o1, 0x0, %pstate
708 rdpr %pil, %l1 708 rdpr %pil, %l1
709 wrpr %g0, 15, %pil 709 wrpr %g0, PIL_NORMAL_MAX, %pil
710 710
711 /* Make the firmware call to jump over to the Linux trap table. */ 711 /* Make the firmware call to jump over to the Linux trap table. */
712 sethi %hi(is_sun4v), %o0 712 sethi %hi(is_sun4v), %o0
@@ -825,8 +825,8 @@ setup_tba:
825 restore 825 restore
826sparc64_boot_end: 826sparc64_boot_end:
827 827
828#include "etrap.S" 828#include "etrap_64.S"
829#include "rtrap.S" 829#include "rtrap_64.S"
830#include "winfixup.S" 830#include "winfixup.S"
831#include "fpu_traps.S" 831#include "fpu_traps.S"
832#include "ivec.S" 832#include "ivec.S"
@@ -882,7 +882,7 @@ swapper_4m_tsb:
882 882
883! 0x0000000000428000 883! 0x0000000000428000
884 884
885#include "systbls.S" 885#include "systbls_64.S"
886 886
887 .data 887 .data
888 .align 8 888 .align 8
diff --git a/arch/sparc64/kernel/helpers.S b/arch/sparc/kernel/helpers.S
index 314dd0c9fc5b..314dd0c9fc5b 100644
--- a/arch/sparc64/kernel/helpers.S
+++ b/arch/sparc/kernel/helpers.S
diff --git a/arch/sparc64/kernel/hvapi.c b/arch/sparc/kernel/hvapi.c
index 1d272c3b5740..1d272c3b5740 100644
--- a/arch/sparc64/kernel/hvapi.c
+++ b/arch/sparc/kernel/hvapi.c
diff --git a/arch/sparc64/kernel/hvcalls.S b/arch/sparc/kernel/hvcalls.S
index e066269d1594..8a5f35ffb15e 100644
--- a/arch/sparc64/kernel/hvcalls.S
+++ b/arch/sparc/kernel/hvcalls.S
@@ -766,3 +766,35 @@ ENTRY(sun4v_mmu_demap_all)
766 retl 766 retl
767 nop 767 nop
768ENDPROC(sun4v_mmu_demap_all) 768ENDPROC(sun4v_mmu_demap_all)
769
770ENTRY(sun4v_niagara_getperf)
771 mov %o0, %o4
772 mov HV_FAST_GET_PERFREG, %o5
773 ta HV_FAST_TRAP
774 stx %o1, [%o4]
775 retl
776 nop
777ENDPROC(sun4v_niagara_getperf)
778
779ENTRY(sun4v_niagara_setperf)
780 mov HV_FAST_SET_PERFREG, %o5
781 ta HV_FAST_TRAP
782 retl
783 nop
784ENDPROC(sun4v_niagara_setperf)
785
786ENTRY(sun4v_niagara2_getperf)
787 mov %o0, %o4
788 mov HV_FAST_N2_GET_PERFREG, %o5
789 ta HV_FAST_TRAP
790 stx %o1, [%o4]
791 retl
792 nop
793ENDPROC(sun4v_niagara2_getperf)
794
795ENTRY(sun4v_niagara2_setperf)
796 mov HV_FAST_N2_SET_PERFREG, %o5
797 ta HV_FAST_TRAP
798 retl
799 nop
800ENDPROC(sun4v_niagara2_setperf)
diff --git a/arch/sparc64/kernel/hvtramp.S b/arch/sparc/kernel/hvtramp.S
index 0236c43772fa..9365432904d6 100644
--- a/arch/sparc64/kernel/hvtramp.S
+++ b/arch/sparc/kernel/hvtramp.S
@@ -1,6 +1,6 @@
1/* hvtramp.S: Hypervisor start-cpu trampoline code. 1/* hvtramp.S: Hypervisor start-cpu trampoline code.
2 * 2 *
3 * Copyright (C) 2007 David S. Miller <davem@davemloft.net> 3 * Copyright (C) 2007, 2008 David S. Miller <davem@davemloft.net>
4 */ 4 */
5 5
6#include <linux/init.h> 6#include <linux/init.h>
@@ -14,6 +14,7 @@
14#include <asm/ptrace.h> 14#include <asm/ptrace.h>
15#include <asm/head.h> 15#include <asm/head.h>
16#include <asm/asi.h> 16#include <asm/asi.h>
17#include <asm/pil.h>
17 18
18 __CPUINIT 19 __CPUINIT
19 .align 8 20 .align 8
@@ -32,7 +33,7 @@
32 */ 33 */
33hv_cpu_startup: 34hv_cpu_startup:
34 SET_GL(0) 35 SET_GL(0)
35 wrpr %g0, 15, %pil 36 wrpr %g0, PIL_NORMAL_MAX, %pil
36 wrpr %g0, 0, %canrestore 37 wrpr %g0, 0, %canrestore
37 wrpr %g0, 0, %otherwin 38 wrpr %g0, 0, %otherwin
38 wrpr %g0, 6, %cansave 39 wrpr %g0, 6, %cansave
diff --git a/arch/sparc/kernel/idprom.c b/arch/sparc/kernel/idprom.c
index 223a6582e1e2..c16135e0c151 100644
--- a/arch/sparc/kernel/idprom.c
+++ b/arch/sparc/kernel/idprom.c
@@ -11,35 +11,37 @@
11 11
12#include <asm/oplib.h> 12#include <asm/oplib.h>
13#include <asm/idprom.h> 13#include <asm/idprom.h>
14#include <asm/machines.h> /* Fun with Sun released architectures. */
15 14
16struct idprom *idprom; 15struct idprom *idprom;
17static struct idprom idprom_buffer; 16static struct idprom idprom_buffer;
18 17
18#ifdef CONFIG_SPARC32
19#include <asm/machines.h> /* Fun with Sun released architectures. */
20
19/* Here is the master table of Sun machines which use some implementation 21/* Here is the master table of Sun machines which use some implementation
20 * of the Sparc CPU and have a meaningful IDPROM machtype value that we 22 * of the Sparc CPU and have a meaningful IDPROM machtype value that we
21 * know about. See asm-sparc/machines.h for empirical constants. 23 * know about. See asm-sparc/machines.h for empirical constants.
22 */ 24 */
23static struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES] = { 25static struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES] = {
24/* First, Sun4's */ 26/* First, Sun4's */
25{ "Sun 4/100 Series", (SM_SUN4 | SM_4_110) }, 27{ .name = "Sun 4/100 Series", .id_machtype = (SM_SUN4 | SM_4_110) },
26{ "Sun 4/200 Series", (SM_SUN4 | SM_4_260) }, 28{ .name = "Sun 4/200 Series", .id_machtype = (SM_SUN4 | SM_4_260) },
27{ "Sun 4/300 Series", (SM_SUN4 | SM_4_330) }, 29{ .name = "Sun 4/300 Series", .id_machtype = (SM_SUN4 | SM_4_330) },
28{ "Sun 4/400 Series", (SM_SUN4 | SM_4_470) }, 30{ .name = "Sun 4/400 Series", .id_machtype = (SM_SUN4 | SM_4_470) },
29/* Now, Sun4c's */ 31/* Now, Sun4c's */
30{ "Sun4c SparcStation 1", (SM_SUN4C | SM_4C_SS1) }, 32{ .name = "Sun4c SparcStation 1", .id_machtype = (SM_SUN4C | SM_4C_SS1) },
31{ "Sun4c SparcStation IPC", (SM_SUN4C | SM_4C_IPC) }, 33{ .name = "Sun4c SparcStation IPC", .id_machtype = (SM_SUN4C | SM_4C_IPC) },
32{ "Sun4c SparcStation 1+", (SM_SUN4C | SM_4C_SS1PLUS) }, 34{ .name = "Sun4c SparcStation 1+", .id_machtype = (SM_SUN4C | SM_4C_SS1PLUS) },
33{ "Sun4c SparcStation SLC", (SM_SUN4C | SM_4C_SLC) }, 35{ .name = "Sun4c SparcStation SLC", .id_machtype = (SM_SUN4C | SM_4C_SLC) },
34{ "Sun4c SparcStation 2", (SM_SUN4C | SM_4C_SS2) }, 36{ .name = "Sun4c SparcStation 2", .id_machtype = (SM_SUN4C | SM_4C_SS2) },
35{ "Sun4c SparcStation ELC", (SM_SUN4C | SM_4C_ELC) }, 37{ .name = "Sun4c SparcStation ELC", .id_machtype = (SM_SUN4C | SM_4C_ELC) },
36{ "Sun4c SparcStation IPX", (SM_SUN4C | SM_4C_IPX) }, 38{ .name = "Sun4c SparcStation IPX", .id_machtype = (SM_SUN4C | SM_4C_IPX) },
37/* Finally, early Sun4m's */ 39/* Finally, early Sun4m's */
38{ "Sun4m SparcSystem600", (SM_SUN4M | SM_4M_SS60) }, 40{ .name = "Sun4m SparcSystem600", .id_machtype = (SM_SUN4M | SM_4M_SS60) },
39{ "Sun4m SparcStation10/20", (SM_SUN4M | SM_4M_SS50) }, 41{ .name = "Sun4m SparcStation10/20", .id_machtype = (SM_SUN4M | SM_4M_SS50) },
40{ "Sun4m SparcStation5", (SM_SUN4M | SM_4M_SS40) }, 42{ .name = "Sun4m SparcStation5", .id_machtype = (SM_SUN4M | SM_4M_SS40) },
41/* One entry for the OBP arch's which are sun4d, sun4e, and newer sun4m's */ 43/* One entry for the OBP arch's which are sun4d, sun4e, and newer sun4m's */
42{ "Sun4M OBP based system", (SM_SUN4M_OBP | 0x0) } }; 44{ .name = "Sun4M OBP based system", .id_machtype = (SM_SUN4M_OBP | 0x0) } };
43 45
44static void __init display_system_type(unsigned char machtype) 46static void __init display_system_type(unsigned char machtype)
45{ 47{
@@ -47,21 +49,25 @@ static void __init display_system_type(unsigned char machtype)
47 register int i; 49 register int i;
48 50
49 for (i = 0; i < NUM_SUN_MACHINES; i++) { 51 for (i = 0; i < NUM_SUN_MACHINES; i++) {
50 if(Sun_Machines[i].id_machtype == machtype) { 52 if (Sun_Machines[i].id_machtype == machtype) {
51 if (machtype != (SM_SUN4M_OBP | 0x00) || 53 if (machtype != (SM_SUN4M_OBP | 0x00) ||
52 prom_getproperty(prom_root_node, "banner-name", 54 prom_getproperty(prom_root_node, "banner-name",
53 sysname, sizeof(sysname)) <= 0) 55 sysname, sizeof(sysname)) <= 0)
54 printk("TYPE: %s\n", Sun_Machines[i].name); 56 printk(KERN_WARNING "TYPE: %s\n",
57 Sun_Machines[i].name);
55 else 58 else
56 printk("TYPE: %s\n", sysname); 59 printk(KERN_WARNING "TYPE: %s\n", sysname);
57 return; 60 return;
58 } 61 }
59 } 62 }
60 63
61 prom_printf("IDPROM: Bogus id_machtype value, 0x%x\n", machtype); 64 prom_printf("IDPROM: Warning, bogus id_machtype value, 0x%x\n", machtype);
62 prom_halt();
63} 65}
64 66#else
67static void __init display_system_type(unsigned char machtype)
68{
69}
70#endif
65/* Calculate the IDPROM checksum (xor of the data bytes). */ 71/* Calculate the IDPROM checksum (xor of the data bytes). */
66static unsigned char __init calc_idprom_cksum(struct idprom *idprom) 72static unsigned char __init calc_idprom_cksum(struct idprom *idprom)
67{ 73{
@@ -80,21 +86,14 @@ void __init idprom_init(void)
80 86
81 idprom = &idprom_buffer; 87 idprom = &idprom_buffer;
82 88
83 if (idprom->id_format != 0x01) { 89 if (idprom->id_format != 0x01)
84 prom_printf("IDPROM: Unknown format type!\n"); 90 prom_printf("IDPROM: Warning, unknown format type!\n");
85 prom_halt();
86 }
87 91
88 if (idprom->id_cksum != calc_idprom_cksum(idprom)) { 92 if (idprom->id_cksum != calc_idprom_cksum(idprom))
89 prom_printf("IDPROM: Checksum failure (nvram=%x, calc=%x)!\n", 93 prom_printf("IDPROM: Warning, checksum failure (nvram=%x, calc=%x)!\n",
90 idprom->id_cksum, calc_idprom_cksum(idprom)); 94 idprom->id_cksum, calc_idprom_cksum(idprom));
91 prom_halt();
92 }
93 95
94 display_system_type(idprom->id_machtype); 96 display_system_type(idprom->id_machtype);
95 97
96 printk("Ethernet address: %x:%x:%x:%x:%x:%x\n", 98 printk(KERN_WARNING "Ethernet address: %pM\n", idprom->id_ethaddr);
97 idprom->id_ethaddr[0], idprom->id_ethaddr[1],
98 idprom->id_ethaddr[2], idprom->id_ethaddr[3],
99 idprom->id_ethaddr[4], idprom->id_ethaddr[5]);
100} 99}
diff --git a/arch/sparc/kernel/init_task.c b/arch/sparc/kernel/init_task.c
index 8e64ebc445ef..f28cb8278e98 100644
--- a/arch/sparc/kernel/init_task.c
+++ b/arch/sparc/kernel/init_task.c
@@ -8,7 +8,6 @@
8#include <asm/pgtable.h> 8#include <asm/pgtable.h>
9#include <asm/uaccess.h> 9#include <asm/uaccess.h>
10 10
11static struct fs_struct init_fs = INIT_FS;
12static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 11static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
13static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 12static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
14struct mm_struct init_mm = INIT_MM(init_mm); 13struct mm_struct init_mm = INIT_MM(init_mm);
@@ -23,6 +22,5 @@ EXPORT_SYMBOL(init_task);
23 * in etrap.S which assumes it. 22 * in etrap.S which assumes it.
24 */ 23 */
25union thread_union init_thread_union 24union thread_union init_thread_union
26 __attribute__((section (".text\"\n\t#"))) 25 __attribute__((section (".data.init_task")))
27 __attribute__((aligned (THREAD_SIZE)))
28 = { INIT_THREAD_INFO(init_task) }; 26 = { INIT_THREAD_INFO(init_task) };
diff --git a/arch/sparc64/kernel/iommu.c b/arch/sparc/kernel/iommu.c
index 1cc1995531e2..1cc1995531e2 100644
--- a/arch/sparc64/kernel/iommu.c
+++ b/arch/sparc/kernel/iommu.c
diff --git a/arch/sparc64/kernel/iommu_common.h b/arch/sparc/kernel/iommu_common.h
index 591f5879039c..591f5879039c 100644
--- a/arch/sparc64/kernel/iommu_common.h
+++ b/arch/sparc/kernel/iommu_common.h
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 4f025b36934b..7ce14f05eb48 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -552,8 +552,8 @@ int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sgl, int nents,
552 /* IIep is write-through, not flushing. */ 552 /* IIep is write-through, not flushing. */
553 for_each_sg(sgl, sg, nents, n) { 553 for_each_sg(sgl, sg, nents, n) {
554 BUG_ON(page_address(sg_page(sg)) == NULL); 554 BUG_ON(page_address(sg_page(sg)) == NULL);
555 sg->dvma_address = virt_to_phys(sg_virt(sg)); 555 sg->dma_address = virt_to_phys(sg_virt(sg));
556 sg->dvma_length = sg->length; 556 sg->dma_length = sg->length;
557 } 557 }
558 return nents; 558 return nents;
559} 559}
diff --git a/arch/sparc/kernel/irq.c b/arch/sparc/kernel/irq_32.c
index 93e1d1c65290..1eff942fe22f 100644
--- a/arch/sparc/kernel/irq.c
+++ b/arch/sparc/kernel/irq_32.c
@@ -46,6 +46,7 @@
46#include <asm/cacheflush.h> 46#include <asm/cacheflush.h>
47#include <asm/irq_regs.h> 47#include <asm/irq_regs.h>
48 48
49#include "kernel.h"
49#include "irq.h" 50#include "irq.h"
50 51
51#ifdef CONFIG_SMP 52#ifdef CONFIG_SMP
@@ -592,19 +593,19 @@ EXPORT_SYMBOL(request_irq);
592 593
593void disable_irq_nosync(unsigned int irq) 594void disable_irq_nosync(unsigned int irq)
594{ 595{
595 return __disable_irq(irq); 596 __disable_irq(irq);
596} 597}
597EXPORT_SYMBOL(disable_irq_nosync); 598EXPORT_SYMBOL(disable_irq_nosync);
598 599
599void disable_irq(unsigned int irq) 600void disable_irq(unsigned int irq)
600{ 601{
601 return __disable_irq(irq); 602 __disable_irq(irq);
602} 603}
603EXPORT_SYMBOL(disable_irq); 604EXPORT_SYMBOL(disable_irq);
604 605
605void enable_irq(unsigned int irq) 606void enable_irq(unsigned int irq)
606{ 607{
607 return __enable_irq(irq); 608 __enable_irq(irq);
608} 609}
609 610
610EXPORT_SYMBOL(enable_irq); 611EXPORT_SYMBOL(enable_irq);
@@ -668,7 +669,9 @@ void __init init_IRQ(void)
668 btfixup(); 669 btfixup();
669} 670}
670 671
672#ifdef CONFIG_PROC_FS
671void init_irq_proc(void) 673void init_irq_proc(void)
672{ 674{
673 /* For now, nothing... */ 675 /* For now, nothing... */
674} 676}
677#endif /* CONFIG_PROC_FS */
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc/kernel/irq_64.c
index 52fc836f464d..cab8e0286871 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc/kernel/irq_64.c
@@ -312,7 +312,8 @@ static void sun4u_irq_enable(unsigned int virt_irq)
312 } 312 }
313} 313}
314 314
315static void sun4u_set_affinity(unsigned int virt_irq, cpumask_t mask) 315static void sun4u_set_affinity(unsigned int virt_irq,
316 const struct cpumask *mask)
316{ 317{
317 sun4u_irq_enable(virt_irq); 318 sun4u_irq_enable(virt_irq);
318} 319}
@@ -362,7 +363,8 @@ static void sun4v_irq_enable(unsigned int virt_irq)
362 ino, err); 363 ino, err);
363} 364}
364 365
365static void sun4v_set_affinity(unsigned int virt_irq, cpumask_t mask) 366static void sun4v_set_affinity(unsigned int virt_irq,
367 const struct cpumask *mask)
366{ 368{
367 unsigned int ino = virt_irq_table[virt_irq].dev_ino; 369 unsigned int ino = virt_irq_table[virt_irq].dev_ino;
368 unsigned long cpuid = irq_choose_cpu(virt_irq); 370 unsigned long cpuid = irq_choose_cpu(virt_irq);
@@ -429,7 +431,8 @@ static void sun4v_virq_enable(unsigned int virt_irq)
429 dev_handle, dev_ino, err); 431 dev_handle, dev_ino, err);
430} 432}
431 433
432static void sun4v_virt_set_affinity(unsigned int virt_irq, cpumask_t mask) 434static void sun4v_virt_set_affinity(unsigned int virt_irq,
435 const struct cpumask *mask)
433{ 436{
434 unsigned long cpuid, dev_handle, dev_ino; 437 unsigned long cpuid, dev_handle, dev_ino;
435 int err; 438 int err;
@@ -775,6 +778,69 @@ void do_softirq(void)
775 local_irq_restore(flags); 778 local_irq_restore(flags);
776} 779}
777 780
781static void unhandled_perf_irq(struct pt_regs *regs)
782{
783 unsigned long pcr, pic;
784
785 read_pcr(pcr);
786 read_pic(pic);
787
788 write_pcr(0);
789
790 printk(KERN_EMERG "CPU %d: Got unexpected perf counter IRQ.\n",
791 smp_processor_id());
792 printk(KERN_EMERG "CPU %d: PCR[%016lx] PIC[%016lx]\n",
793 smp_processor_id(), pcr, pic);
794}
795
796/* Almost a direct copy of the powerpc PMC code. */
797static DEFINE_SPINLOCK(perf_irq_lock);
798static void *perf_irq_owner_caller; /* mostly for debugging */
799static void (*perf_irq)(struct pt_regs *regs) = unhandled_perf_irq;
800
801/* Invoked from level 15 PIL handler in trap table. */
802void perfctr_irq(int irq, struct pt_regs *regs)
803{
804 clear_softint(1 << irq);
805 perf_irq(regs);
806}
807
808int register_perfctr_intr(void (*handler)(struct pt_regs *))
809{
810 int ret;
811
812 if (!handler)
813 return -EINVAL;
814
815 spin_lock(&perf_irq_lock);
816 if (perf_irq != unhandled_perf_irq) {
817 printk(KERN_WARNING "register_perfctr_intr: "
818 "perf IRQ busy (reserved by caller %p)\n",
819 perf_irq_owner_caller);
820 ret = -EBUSY;
821 goto out;
822 }
823
824 perf_irq_owner_caller = __builtin_return_address(0);
825 perf_irq = handler;
826
827 ret = 0;
828out:
829 spin_unlock(&perf_irq_lock);
830
831 return ret;
832}
833EXPORT_SYMBOL_GPL(register_perfctr_intr);
834
835void release_perfctr_intr(void (*handler)(struct pt_regs *))
836{
837 spin_lock(&perf_irq_lock);
838 perf_irq_owner_caller = NULL;
839 perf_irq = unhandled_perf_irq;
840 spin_unlock(&perf_irq_lock);
841}
842EXPORT_SYMBOL_GPL(release_perfctr_intr);
843
778#ifdef CONFIG_HOTPLUG_CPU 844#ifdef CONFIG_HOTPLUG_CPU
779void fixup_irqs(void) 845void fixup_irqs(void)
780{ 846{
@@ -788,7 +854,7 @@ void fixup_irqs(void)
788 !(irq_desc[irq].status & IRQ_PER_CPU)) { 854 !(irq_desc[irq].status & IRQ_PER_CPU)) {
789 if (irq_desc[irq].chip->set_affinity) 855 if (irq_desc[irq].chip->set_affinity)
790 irq_desc[irq].chip->set_affinity(irq, 856 irq_desc[irq].chip->set_affinity(irq,
791 irq_desc[irq].affinity); 857 &irq_desc[irq].affinity);
792 } 858 }
793 spin_unlock_irqrestore(&irq_desc[irq].lock, flags); 859 spin_unlock_irqrestore(&irq_desc[irq].lock, flags);
794 } 860 }
diff --git a/arch/sparc64/kernel/itlb_miss.S b/arch/sparc/kernel/itlb_miss.S
index 5a8377b54955..5a8377b54955 100644
--- a/arch/sparc64/kernel/itlb_miss.S
+++ b/arch/sparc/kernel/itlb_miss.S
diff --git a/arch/sparc64/kernel/ivec.S b/arch/sparc/kernel/ivec.S
index d29f92ebca5e..d29f92ebca5e 100644
--- a/arch/sparc64/kernel/ivec.S
+++ b/arch/sparc/kernel/ivec.S
diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h
new file mode 100644
index 000000000000..81a972e8d8ea
--- /dev/null
+++ b/arch/sparc/kernel/kernel.h
@@ -0,0 +1,31 @@
1#ifndef __SPARC_KERNEL_H
2#define __SPARC_KERNEL_H
3
4#include <linux/interrupt.h>
5
6/* cpu.c */
7extern const char *sparc_cpu_type;
8extern const char *sparc_fpu_type;
9
10extern unsigned int fsr_storage;
11
12#ifdef CONFIG_SPARC32
13/* cpu.c */
14extern void cpu_probe(void);
15
16/* traps_32.c */
17extern void handle_hw_divzero(struct pt_regs *regs, unsigned long pc,
18 unsigned long npc, unsigned long psr);
19/* muldiv.c */
20extern int do_user_muldiv (struct pt_regs *, unsigned long);
21
22/* irq_32.c */
23extern struct irqaction static_irqaction[];
24extern int static_irq_count;
25extern spinlock_t irq_action_lock;
26
27extern void unexpected_irq(int irq, void *dev_id, struct pt_regs * regs);
28
29#else /* CONFIG_SPARC32 */
30#endif /* CONFIG_SPARC32 */
31#endif /* !(__SPARC_KERNEL_H) */
diff --git a/arch/sparc/kernel/kgdb.c b/arch/sparc/kernel/kgdb_32.c
index 757805ce02ee..04df4edc0073 100644
--- a/arch/sparc/kernel/kgdb.c
+++ b/arch/sparc/kernel/kgdb_32.c
@@ -14,14 +14,14 @@ extern unsigned long trapbase;
14 14
15void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) 15void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
16{ 16{
17 struct reg_window *win; 17 struct reg_window32 *win;
18 int i; 18 int i;
19 19
20 gdb_regs[GDB_G0] = 0; 20 gdb_regs[GDB_G0] = 0;
21 for (i = 0; i < 15; i++) 21 for (i = 0; i < 15; i++)
22 gdb_regs[GDB_G1 + i] = regs->u_regs[UREG_G1 + i]; 22 gdb_regs[GDB_G1 + i] = regs->u_regs[UREG_G1 + i];
23 23
24 win = (struct reg_window *) regs->u_regs[UREG_FP]; 24 win = (struct reg_window32 *) regs->u_regs[UREG_FP];
25 for (i = 0; i < 8; i++) 25 for (i = 0; i < 8; i++)
26 gdb_regs[GDB_L0 + i] = win->locals[i]; 26 gdb_regs[GDB_L0 + i] = win->locals[i];
27 for (i = 0; i < 8; i++) 27 for (i = 0; i < 8; i++)
@@ -43,7 +43,7 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
43void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) 43void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
44{ 44{
45 struct thread_info *t = task_thread_info(p); 45 struct thread_info *t = task_thread_info(p);
46 struct reg_window *win; 46 struct reg_window32 *win;
47 int i; 47 int i;
48 48
49 for (i = GDB_G0; i < GDB_G6; i++) 49 for (i = GDB_G0; i < GDB_G6; i++)
@@ -55,7 +55,7 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
55 gdb_regs[GDB_SP] = t->ksp; 55 gdb_regs[GDB_SP] = t->ksp;
56 gdb_regs[GDB_O7] = 0; 56 gdb_regs[GDB_O7] = 0;
57 57
58 win = (struct reg_window *) t->ksp; 58 win = (struct reg_window32 *) t->ksp;
59 for (i = 0; i < 8; i++) 59 for (i = 0; i < 8; i++)
60 gdb_regs[GDB_L0 + i] = win->locals[i]; 60 gdb_regs[GDB_L0 + i] = win->locals[i];
61 for (i = 0; i < 8; i++) 61 for (i = 0; i < 8; i++)
@@ -77,7 +77,7 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
77 77
78void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs) 78void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
79{ 79{
80 struct reg_window *win; 80 struct reg_window32 *win;
81 int i; 81 int i;
82 82
83 for (i = 0; i < 15; i++) 83 for (i = 0; i < 15; i++)
@@ -96,7 +96,7 @@ void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
96 regs->npc = gdb_regs[GDB_NPC]; 96 regs->npc = gdb_regs[GDB_NPC];
97 regs->y = gdb_regs[GDB_Y]; 97 regs->y = gdb_regs[GDB_Y];
98 98
99 win = (struct reg_window *) regs->u_regs[UREG_FP]; 99 win = (struct reg_window32 *) regs->u_regs[UREG_FP];
100 for (i = 0; i < 8; i++) 100 for (i = 0; i < 8; i++)
101 win->locals[i] = gdb_regs[GDB_L0 + i]; 101 win->locals[i] = gdb_regs[GDB_L0 + i];
102 for (i = 0; i < 8; i++) 102 for (i = 0; i < 8; i++)
diff --git a/arch/sparc64/kernel/kgdb.c b/arch/sparc/kernel/kgdb_64.c
index fefbe6dc51be..fefbe6dc51be 100644
--- a/arch/sparc64/kernel/kgdb.c
+++ b/arch/sparc/kernel/kgdb_64.c
diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc/kernel/kprobes.c
index 201a6e547e4a..201a6e547e4a 100644
--- a/arch/sparc64/kernel/kprobes.c
+++ b/arch/sparc/kernel/kprobes.c
diff --git a/arch/sparc64/kernel/kstack.h b/arch/sparc/kernel/kstack.h
index 4248d969272f..4248d969272f 100644
--- a/arch/sparc64/kernel/kstack.h
+++ b/arch/sparc/kernel/kstack.h
diff --git a/arch/sparc64/kernel/ktlb.S b/arch/sparc/kernel/ktlb.S
index cef8defcd7a9..cef8defcd7a9 100644
--- a/arch/sparc64/kernel/ktlb.S
+++ b/arch/sparc/kernel/ktlb.S
diff --git a/arch/sparc64/kernel/ldc.c b/arch/sparc/kernel/ldc.c
index d68982330f66..d68982330f66 100644
--- a/arch/sparc64/kernel/ldc.c
+++ b/arch/sparc/kernel/ldc.c
diff --git a/arch/sparc64/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c
index dde52bcf5c64..3c539a6d7c18 100644
--- a/arch/sparc64/kernel/mdesc.c
+++ b/arch/sparc/kernel/mdesc.c
@@ -11,6 +11,7 @@
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/miscdevice.h> 12#include <linux/miscdevice.h>
13 13
14#include <asm/cpudata.h>
14#include <asm/hypervisor.h> 15#include <asm/hypervisor.h>
15#include <asm/mdesc.h> 16#include <asm/mdesc.h>
16#include <asm/prom.h> 17#include <asm/prom.h>
diff --git a/arch/sparc64/kernel/misctrap.S b/arch/sparc/kernel/misctrap.S
index 753b4f031bfb..753b4f031bfb 100644
--- a/arch/sparc64/kernel/misctrap.S
+++ b/arch/sparc/kernel/misctrap.S
diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c
index 598682f31ebf..90273765e81f 100644
--- a/arch/sparc/kernel/module.c
+++ b/arch/sparc/kernel/module.c
@@ -1,4 +1,4 @@
1/* Kernel module help for sparc32. 1/* Kernel module help for sparc64.
2 * 2 *
3 * Copyright (C) 2001 Rusty Russell. 3 * Copyright (C) 2001 Rusty Russell.
4 * Copyright (C) 2002 David S. Miller. 4 * Copyright (C) 2002 David S. Miller.
@@ -11,6 +11,48 @@
11#include <linux/fs.h> 11#include <linux/fs.h>
12#include <linux/string.h> 12#include <linux/string.h>
13#include <linux/ctype.h> 13#include <linux/ctype.h>
14#include <linux/slab.h>
15#include <linux/mm.h>
16
17#include <asm/processor.h>
18#include <asm/spitfire.h>
19
20#ifdef CONFIG_SPARC64
21static void *module_map(unsigned long size)
22{
23 struct vm_struct *area;
24
25 size = PAGE_ALIGN(size);
26 if (!size || size > MODULES_LEN)
27 return NULL;
28
29 area = __get_vm_area(size, VM_ALLOC, MODULES_VADDR, MODULES_END);
30 if (!area)
31 return NULL;
32
33 return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL);
34}
35
36static char *dot2underscore(char *name)
37{
38 return name;
39}
40#else
41static void *module_map(unsigned long size)
42{
43 return vmalloc(size);
44}
45
46/* Replace references to .func with _Func */
47static char *dot2underscore(char *name)
48{
49 if (name[0] == '.') {
50 name[0] = '_';
51 name[1] = toupper(name[1]);
52 }
53 return name;
54}
55#endif /* CONFIG_SPARC64 */
14 56
15void *module_alloc(unsigned long size) 57void *module_alloc(unsigned long size)
16{ 58{
@@ -20,7 +62,7 @@ void *module_alloc(unsigned long size)
20 if (size == 0) 62 if (size == 0)
21 return NULL; 63 return NULL;
22 64
23 ret = vmalloc(size); 65 ret = module_map(size);
24 if (!ret) 66 if (!ret)
25 ret = ERR_PTR(-ENOMEM); 67 ret = ERR_PTR(-ENOMEM);
26 else 68 else
@@ -37,16 +79,14 @@ void module_free(struct module *mod, void *module_region)
37 table entries. */ 79 table entries. */
38} 80}
39 81
40/* Make generic code ignore STT_REGISTER dummy undefined symbols, 82/* Make generic code ignore STT_REGISTER dummy undefined symbols. */
41 * and replace references to .func with _Func
42 */
43int module_frob_arch_sections(Elf_Ehdr *hdr, 83int module_frob_arch_sections(Elf_Ehdr *hdr,
44 Elf_Shdr *sechdrs, 84 Elf_Shdr *sechdrs,
45 char *secstrings, 85 char *secstrings,
46 struct module *mod) 86 struct module *mod)
47{ 87{
48 unsigned int symidx; 88 unsigned int symidx;
49 Elf32_Sym *sym; 89 Elf_Sym *sym;
50 char *strtab; 90 char *strtab;
51 int i; 91 int i;
52 92
@@ -56,26 +96,23 @@ int module_frob_arch_sections(Elf_Ehdr *hdr,
56 return -ENOEXEC; 96 return -ENOEXEC;
57 } 97 }
58 } 98 }
59 sym = (Elf32_Sym *)sechdrs[symidx].sh_addr; 99 sym = (Elf_Sym *)sechdrs[symidx].sh_addr;
60 strtab = (char *)sechdrs[sechdrs[symidx].sh_link].sh_addr; 100 strtab = (char *)sechdrs[sechdrs[symidx].sh_link].sh_addr;
61 101
62 for (i = 1; i < sechdrs[symidx].sh_size / sizeof(Elf_Sym); i++) { 102 for (i = 1; i < sechdrs[symidx].sh_size / sizeof(Elf_Sym); i++) {
63 if (sym[i].st_shndx == SHN_UNDEF) { 103 if (sym[i].st_shndx == SHN_UNDEF) {
64 if (ELF32_ST_TYPE(sym[i].st_info) == STT_REGISTER) 104 if (ELF_ST_TYPE(sym[i].st_info) == STT_REGISTER) {
65 sym[i].st_shndx = SHN_ABS; 105 sym[i].st_shndx = SHN_ABS;
66 else { 106 } else {
67 char *name = strtab + sym[i].st_name; 107 char *name = strtab + sym[i].st_name;
68 if (name[0] == '.') { 108 dot2underscore(name);
69 name[0] = '_';
70 name[1] = toupper(name[1]);
71 }
72 } 109 }
73 } 110 }
74 } 111 }
75 return 0; 112 return 0;
76} 113}
77 114
78int apply_relocate(Elf32_Shdr *sechdrs, 115int apply_relocate(Elf_Shdr *sechdrs,
79 const char *strtab, 116 const char *strtab,
80 unsigned int symindex, 117 unsigned int symindex,
81 unsigned int relsec, 118 unsigned int relsec,
@@ -86,32 +123,68 @@ int apply_relocate(Elf32_Shdr *sechdrs,
86 return -ENOEXEC; 123 return -ENOEXEC;
87} 124}
88 125
89int apply_relocate_add(Elf32_Shdr *sechdrs, 126int apply_relocate_add(Elf_Shdr *sechdrs,
90 const char *strtab, 127 const char *strtab,
91 unsigned int symindex, 128 unsigned int symindex,
92 unsigned int relsec, 129 unsigned int relsec,
93 struct module *me) 130 struct module *me)
94{ 131{
95 unsigned int i; 132 unsigned int i;
96 Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr; 133 Elf_Rela *rel = (void *)sechdrs[relsec].sh_addr;
97 Elf32_Sym *sym; 134 Elf_Sym *sym;
98 u8 *location; 135 u8 *location;
99 u32 *loc32; 136 u32 *loc32;
100 137
101 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { 138 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
102 Elf32_Addr v; 139 Elf_Addr v;
103 140
104 /* This is where to make the change */ 141 /* This is where to make the change */
105 location = (u8 *)sechdrs[sechdrs[relsec].sh_info].sh_addr 142 location = (u8 *)sechdrs[sechdrs[relsec].sh_info].sh_addr
106 + rel[i].r_offset; 143 + rel[i].r_offset;
107 loc32 = (u32 *) location; 144 loc32 = (u32 *) location;
145
146#ifdef CONFIG_SPARC64
147 BUG_ON(((u64)location >> (u64)32) != (u64)0);
148#endif /* CONFIG_SPARC64 */
149
108 /* This is the symbol it is referring to. Note that all 150 /* This is the symbol it is referring to. Note that all
109 undefined symbols have been resolved. */ 151 undefined symbols have been resolved. */
110 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr 152 sym = (Elf_Sym *)sechdrs[symindex].sh_addr
111 + ELF32_R_SYM(rel[i].r_info); 153 + ELF_R_SYM(rel[i].r_info);
112 v = sym->st_value + rel[i].r_addend; 154 v = sym->st_value + rel[i].r_addend;
113 155
114 switch (ELF32_R_TYPE(rel[i].r_info)) { 156 switch (ELF_R_TYPE(rel[i].r_info) & 0xff) {
157#ifdef CONFIG_SPARC64
158 case R_SPARC_64:
159 location[0] = v >> 56;
160 location[1] = v >> 48;
161 location[2] = v >> 40;
162 location[3] = v >> 32;
163 location[4] = v >> 24;
164 location[5] = v >> 16;
165 location[6] = v >> 8;
166 location[7] = v >> 0;
167 break;
168
169 case R_SPARC_DISP32:
170 v -= (Elf_Addr) location;
171 *loc32 = v;
172 break;
173
174 case R_SPARC_WDISP19:
175 v -= (Elf_Addr) location;
176 *loc32 = (*loc32 & ~0x7ffff) |
177 ((v >> 2) & 0x7ffff);
178 break;
179
180 case R_SPARC_OLO10:
181 *loc32 = (*loc32 & ~0x1fff) |
182 (((v & 0x3ff) +
183 (ELF_R_TYPE(rel[i].r_info) >> 8))
184 & 0x1fff);
185 break;
186#endif /* CONFIG_SPARC64 */
187
115 case R_SPARC_32: 188 case R_SPARC_32:
116 case R_SPARC_UA32: 189 case R_SPARC_UA32:
117 location[0] = v >> 24; 190 location[0] = v >> 24;
@@ -121,13 +194,13 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
121 break; 194 break;
122 195
123 case R_SPARC_WDISP30: 196 case R_SPARC_WDISP30:
124 v -= (Elf32_Addr) location; 197 v -= (Elf_Addr) location;
125 *loc32 = (*loc32 & ~0x3fffffff) | 198 *loc32 = (*loc32 & ~0x3fffffff) |
126 ((v >> 2) & 0x3fffffff); 199 ((v >> 2) & 0x3fffffff);
127 break; 200 break;
128 201
129 case R_SPARC_WDISP22: 202 case R_SPARC_WDISP22:
130 v -= (Elf32_Addr) location; 203 v -= (Elf_Addr) location;
131 *loc32 = (*loc32 & ~0x3fffff) | 204 *loc32 = (*loc32 & ~0x3fffff) |
132 ((v >> 2) & 0x3fffff); 205 ((v >> 2) & 0x3fffff);
133 break; 206 break;
@@ -144,19 +217,38 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
144 default: 217 default:
145 printk(KERN_ERR "module %s: Unknown relocation: %x\n", 218 printk(KERN_ERR "module %s: Unknown relocation: %x\n",
146 me->name, 219 me->name,
147 (int) (ELF32_R_TYPE(rel[i].r_info) & 0xff)); 220 (int) (ELF_R_TYPE(rel[i].r_info) & 0xff));
148 return -ENOEXEC; 221 return -ENOEXEC;
149 }; 222 };
150 } 223 }
151 return 0; 224 return 0;
152} 225}
153 226
227#ifdef CONFIG_SPARC64
154int module_finalize(const Elf_Ehdr *hdr, 228int module_finalize(const Elf_Ehdr *hdr,
155 const Elf_Shdr *sechdrs, 229 const Elf_Shdr *sechdrs,
156 struct module *me) 230 struct module *me)
157{ 231{
232 /* Cheetah's I-cache is fully coherent. */
233 if (tlb_type == spitfire) {
234 unsigned long va;
235
236 flushw_all();
237 for (va = 0; va < (PAGE_SIZE << 1); va += 32)
238 spitfire_put_icache_tag(va, 0x0);
239 __asm__ __volatile__("flush %g6");
240 }
241
158 return 0; 242 return 0;
159} 243}
244#else
245int module_finalize(const Elf_Ehdr *hdr,
246 const Elf_Shdr *sechdrs,
247 struct module *me)
248{
249 return 0;
250}
251#endif /* CONFIG_SPARC64 */
160 252
161void module_arch_cleanup(struct module *mod) 253void module_arch_cleanup(struct module *mod)
162{ 254{
diff --git a/arch/sparc/kernel/muldiv.c b/arch/sparc/kernel/muldiv.c
index e352239e72c8..6ce1021d487c 100644
--- a/arch/sparc/kernel/muldiv.c
+++ b/arch/sparc/kernel/muldiv.c
@@ -17,6 +17,8 @@
17#include <asm/system.h> 17#include <asm/system.h>
18#include <asm/uaccess.h> 18#include <asm/uaccess.h>
19 19
20#include "kernel.h"
21
20/* #define DEBUG_MULDIV */ 22/* #define DEBUG_MULDIV */
21 23
22static inline int has_imm13(int insn) 24static inline int has_imm13(int insn)
@@ -58,7 +60,7 @@ static inline void maybe_flush_windows(unsigned int rs1, unsigned int rs2,
58} 60}
59 61
60#define fetch_reg(reg, regs) ({ \ 62#define fetch_reg(reg, regs) ({ \
61 struct reg_window __user *win; \ 63 struct reg_window32 __user *win; \
62 register unsigned long ret; \ 64 register unsigned long ret; \
63 \ 65 \
64 if (!(reg)) ret = 0; \ 66 if (!(reg)) ret = 0; \
@@ -66,7 +68,7 @@ static inline void maybe_flush_windows(unsigned int rs1, unsigned int rs2,
66 ret = regs->u_regs[(reg)]; \ 68 ret = regs->u_regs[(reg)]; \
67 } else { \ 69 } else { \
68 /* Ho hum, the slightly complicated case. */ \ 70 /* Ho hum, the slightly complicated case. */ \
69 win = (struct reg_window __user *)regs->u_regs[UREG_FP];\ 71 win = (struct reg_window32 __user *)regs->u_regs[UREG_FP];\
70 if (get_user (ret, &win->locals[(reg) - 16])) return -1;\ 72 if (get_user (ret, &win->locals[(reg) - 16])) return -1;\
71 } \ 73 } \
72 ret; \ 74 ret; \
@@ -75,7 +77,7 @@ static inline void maybe_flush_windows(unsigned int rs1, unsigned int rs2,
75static inline int 77static inline int
76store_reg(unsigned int result, unsigned int reg, struct pt_regs *regs) 78store_reg(unsigned int result, unsigned int reg, struct pt_regs *regs)
77{ 79{
78 struct reg_window __user *win; 80 struct reg_window32 __user *win;
79 81
80 if (!reg) 82 if (!reg)
81 return 0; 83 return 0;
@@ -84,13 +86,10 @@ store_reg(unsigned int result, unsigned int reg, struct pt_regs *regs)
84 return 0; 86 return 0;
85 } else { 87 } else {
86 /* need to use put_user() in this case: */ 88 /* need to use put_user() in this case: */
87 win = (struct reg_window __user *) regs->u_regs[UREG_FP]; 89 win = (struct reg_window32 __user *) regs->u_regs[UREG_FP];
88 return (put_user(result, &win->locals[reg - 16])); 90 return (put_user(result, &win->locals[reg - 16]));
89 } 91 }
90} 92}
91
92extern void handle_hw_divzero (struct pt_regs *regs, unsigned long pc,
93 unsigned long npc, unsigned long psr);
94 93
95/* Should return 0 if mul/div emulation succeeded and SIGILL should 94/* Should return 0 if mul/div emulation succeeded and SIGILL should
96 * not be issued. 95 * not be issued.
diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device_32.c
index 0a83bd737654..0a83bd737654 100644
--- a/arch/sparc/kernel/of_device.c
+++ b/arch/sparc/kernel/of_device_32.c
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc/kernel/of_device_64.c
index 0f616ae3246c..4873f28905b0 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc/kernel/of_device_64.c
@@ -778,9 +778,9 @@ static unsigned int __init build_one_device_irq(struct of_device *op,
778out: 778out:
779 nid = of_node_to_nid(dp); 779 nid = of_node_to_nid(dp);
780 if (nid != -1) { 780 if (nid != -1) {
781 cpumask_t numa_mask = node_to_cpumask(nid); 781 cpumask_t numa_mask = *cpumask_of_node(nid);
782 782
783 irq_set_affinity(irq, numa_mask); 783 irq_set_affinity(irq, &numa_mask);
784 } 784 }
785 785
786 return irq; 786 return irq;
@@ -811,20 +811,20 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
811 811
812 irq = of_get_property(dp, "interrupts", &len); 812 irq = of_get_property(dp, "interrupts", &len);
813 if (irq) { 813 if (irq) {
814 memcpy(op->irqs, irq, len);
815 op->num_irqs = len / 4; 814 op->num_irqs = len / 4;
815
816 /* Prevent overrunning the op->irqs[] array. */
817 if (op->num_irqs > PROMINTR_MAX) {
818 printk(KERN_WARNING "%s: Too many irqs (%d), "
819 "limiting to %d.\n",
820 dp->full_name, op->num_irqs, PROMINTR_MAX);
821 op->num_irqs = PROMINTR_MAX;
822 }
823 memcpy(op->irqs, irq, op->num_irqs * 4);
816 } else { 824 } else {
817 op->num_irqs = 0; 825 op->num_irqs = 0;
818 } 826 }
819 827
820 /* Prevent overrunning the op->irqs[] array. */
821 if (op->num_irqs > PROMINTR_MAX) {
822 printk(KERN_WARNING "%s: Too many irqs (%d), "
823 "limiting to %d.\n",
824 dp->full_name, op->num_irqs, PROMINTR_MAX);
825 op->num_irqs = PROMINTR_MAX;
826 }
827
828 build_device_resources(op, parent); 828 build_device_resources(op, parent);
829 for (i = 0; i < op->num_irqs; i++) 829 for (i = 0; i < op->num_irqs; i++)
830 op->irqs[i] = build_one_device_irq(op, parent, op->irqs[i]); 830 op->irqs[i] = build_one_device_irq(op, parent, op->irqs[i]);
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc/kernel/pci.c
index bdb7c0a6d83d..bdb7c0a6d83d 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
diff --git a/arch/sparc64/kernel/pci_common.c b/arch/sparc/kernel/pci_common.c
index 23b88082d0b2..23b88082d0b2 100644
--- a/arch/sparc64/kernel/pci_common.c
+++ b/arch/sparc/kernel/pci_common.c
diff --git a/arch/sparc64/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c
index 9462b68f4894..9462b68f4894 100644
--- a/arch/sparc64/kernel/pci_fire.c
+++ b/arch/sparc/kernel/pci_fire.c
diff --git a/arch/sparc64/kernel/pci_impl.h b/arch/sparc/kernel/pci_impl.h
index 03186824327e..03186824327e 100644
--- a/arch/sparc64/kernel/pci_impl.h
+++ b/arch/sparc/kernel/pci_impl.h
diff --git a/arch/sparc64/kernel/pci_msi.c b/arch/sparc/kernel/pci_msi.c
index 2e680f34f727..4ef282e81912 100644
--- a/arch/sparc64/kernel/pci_msi.c
+++ b/arch/sparc/kernel/pci_msi.c
@@ -286,9 +286,9 @@ static int bringup_one_msi_queue(struct pci_pbm_info *pbm,
286 286
287 nid = pbm->numa_node; 287 nid = pbm->numa_node;
288 if (nid != -1) { 288 if (nid != -1) {
289 cpumask_t numa_mask = node_to_cpumask(nid); 289 cpumask_t numa_mask = *cpumask_of_node(nid);
290 290
291 irq_set_affinity(irq, numa_mask); 291 irq_set_affinity(irq, &numa_mask);
292 } 292 }
293 err = request_irq(irq, sparc64_msiq_interrupt, 0, 293 err = request_irq(irq, sparc64_msiq_interrupt, 0,
294 "MSIQ", 294 "MSIQ",
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc/kernel/pci_psycho.c
index dfb3ec892987..3b34344082ef 100644
--- a/arch/sparc64/kernel/pci_psycho.c
+++ b/arch/sparc/kernel/pci_psycho.c
@@ -307,10 +307,7 @@ static void psycho_register_error_handlers(struct pci_pbm_info *pbm)
307 307
308 /* We really mean to ignore the return result here. Two 308 /* We really mean to ignore the return result here. Two
309 * PCI controller share the same interrupt numbers and 309 * PCI controller share the same interrupt numbers and
310 * drive the same front-end hardware. Whichever of the 310 * drive the same front-end hardware.
311 * two get in here first will register the IRQ handler
312 * the second will just error out since we do not pass in
313 * IRQF_SHARED.
314 */ 311 */
315 err = request_irq(op->irqs[1], psycho_ue_intr, IRQF_SHARED, 312 err = request_irq(op->irqs[1], psycho_ue_intr, IRQF_SHARED,
316 "PSYCHO_UE", pbm); 313 "PSYCHO_UE", pbm);
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc/kernel/pci_sabre.c
index 713257b6963c..713257b6963c 100644
--- a/arch/sparc64/kernel/pci_sabre.c
+++ b/arch/sparc/kernel/pci_sabre.c
diff --git a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
index 45d9dba1ba11..45d9dba1ba11 100644
--- a/arch/sparc64/kernel/pci_schizo.c
+++ b/arch/sparc/kernel/pci_schizo.c
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
index 34a1fded3941..34a1fded3941 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc/kernel/pci_sun4v.c
diff --git a/arch/sparc64/kernel/pci_sun4v.h b/arch/sparc/kernel/pci_sun4v.h
index 8e9fc3a5b4f5..8e9fc3a5b4f5 100644
--- a/arch/sparc64/kernel/pci_sun4v.h
+++ b/arch/sparc/kernel/pci_sun4v.h
diff --git a/arch/sparc64/kernel/pci_sun4v_asm.S b/arch/sparc/kernel/pci_sun4v_asm.S
index e606d46c6815..e606d46c6815 100644
--- a/arch/sparc64/kernel/pci_sun4v_asm.S
+++ b/arch/sparc/kernel/pci_sun4v_asm.S
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 462584e55fba..75ed98be3edf 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -436,7 +436,7 @@ int pcic_present(void)
436 return pcic0_up; 436 return pcic0_up;
437} 437}
438 438
439static int __init pdev_to_pnode(struct linux_pbm_info *pbm, 439static int __devinit pdev_to_pnode(struct linux_pbm_info *pbm,
440 struct pci_dev *pdev) 440 struct pci_dev *pdev)
441{ 441{
442 struct linux_prom_pci_registers regs[PROMREG_MAX]; 442 struct linux_prom_pci_registers regs[PROMREG_MAX];
diff --git a/arch/sparc/kernel/pmc.c b/arch/sparc/kernel/pmc.c
index 2afcfab4f11c..5e4563d86f19 100644
--- a/arch/sparc/kernel/pmc.c
+++ b/arch/sparc/kernel/pmc.c
@@ -24,32 +24,32 @@
24 */ 24 */
25 25
26#define PMC_OBPNAME "SUNW,pmc" 26#define PMC_OBPNAME "SUNW,pmc"
27#define PMC_DEVNAME "pmc" 27#define PMC_DEVNAME "pmc"
28 28
29#define PMC_IDLE_REG 0x00 29#define PMC_IDLE_REG 0x00
30#define PMC_IDLE_ON 0x01 30#define PMC_IDLE_ON 0x01
31 31
32static u8 __iomem *regs; 32static u8 __iomem *regs;
33 33
34#define pmc_readb(offs) (sbus_readb(regs+offs)) 34#define pmc_readb(offs) (sbus_readb(regs+offs))
35#define pmc_writeb(val, offs) (sbus_writeb(val, regs+offs)) 35#define pmc_writeb(val, offs) (sbus_writeb(val, regs+offs))
36 36
37/* 37/*
38 * CPU idle callback function 38 * CPU idle callback function
39 * See .../arch/sparc/kernel/process.c 39 * See .../arch/sparc/kernel/process.c
40 */ 40 */
41void pmc_swift_idle(void) 41static void pmc_swift_idle(void)
42{ 42{
43#ifdef PMC_DEBUG_LED 43#ifdef PMC_DEBUG_LED
44 set_auxio(0x00, AUXIO_LED); 44 set_auxio(0x00, AUXIO_LED);
45#endif 45#endif
46 46
47 pmc_writeb(pmc_readb(PMC_IDLE_REG) | PMC_IDLE_ON, PMC_IDLE_REG); 47 pmc_writeb(pmc_readb(PMC_IDLE_REG) | PMC_IDLE_ON, PMC_IDLE_REG);
48 48
49#ifdef PMC_DEBUG_LED 49#ifdef PMC_DEBUG_LED
50 set_auxio(AUXIO_LED, 0x00); 50 set_auxio(AUXIO_LED, 0x00);
51#endif 51#endif
52} 52}
53 53
54static int __devinit pmc_probe(struct of_device *op, 54static int __devinit pmc_probe(struct of_device *op,
55 const struct of_device_id *match) 55 const struct of_device_id *match)
@@ -63,7 +63,7 @@ static int __devinit pmc_probe(struct of_device *op,
63 63
64#ifndef PMC_NO_IDLE 64#ifndef PMC_NO_IDLE
65 /* Assign power management IDLE handler */ 65 /* Assign power management IDLE handler */
66 pm_idle = pmc_swift_idle; 66 pm_idle = pmc_swift_idle;
67#endif 67#endif
68 68
69 printk(KERN_INFO "%s: power management initialized\n", PMC_DEVNAME); 69 printk(KERN_INFO "%s: power management initialized\n", PMC_DEVNAME);
diff --git a/arch/sparc64/kernel/power.c b/arch/sparc/kernel/power.c
index 076cad7f9757..076cad7f9757 100644
--- a/arch/sparc64/kernel/power.c
+++ b/arch/sparc/kernel/power.c
diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process_32.c
index e8c43ffe317e..5a8d8ced33da 100644
--- a/arch/sparc/kernel/process.c
+++ b/arch/sparc/kernel/process_32.c
@@ -168,11 +168,9 @@ void machine_restart(char * cmd)
168 168
169void machine_power_off(void) 169void machine_power_off(void)
170{ 170{
171#ifdef CONFIG_SUN_AUXIO
172 if (auxio_power_register && 171 if (auxio_power_register &&
173 (strcmp(of_console_device->type, "serial") || scons_pwroff)) 172 (strcmp(of_console_device->type, "serial") || scons_pwroff))
174 *auxio_power_register |= AUXIO_POWER_OFF; 173 *auxio_power_register |= AUXIO_POWER_OFF;
175#endif
176 machine_halt(); 174 machine_halt();
177} 175}
178 176
@@ -182,13 +180,13 @@ static DEFINE_SPINLOCK(sparc_backtrace_lock);
182 180
183void __show_backtrace(unsigned long fp) 181void __show_backtrace(unsigned long fp)
184{ 182{
185 struct reg_window *rw; 183 struct reg_window32 *rw;
186 unsigned long flags; 184 unsigned long flags;
187 int cpu = smp_processor_id(); 185 int cpu = smp_processor_id();
188 186
189 spin_lock_irqsave(&sparc_backtrace_lock, flags); 187 spin_lock_irqsave(&sparc_backtrace_lock, flags);
190 188
191 rw = (struct reg_window *)fp; 189 rw = (struct reg_window32 *)fp;
192 while(rw && (((unsigned long) rw) >= PAGE_OFFSET) && 190 while(rw && (((unsigned long) rw) >= PAGE_OFFSET) &&
193 !(((unsigned long) rw) & 0x7)) { 191 !(((unsigned long) rw) & 0x7)) {
194 printk("CPU[%d]: ARGS[%08lx,%08lx,%08lx,%08lx,%08lx,%08lx] " 192 printk("CPU[%d]: ARGS[%08lx,%08lx,%08lx,%08lx,%08lx,%08lx] "
@@ -198,7 +196,7 @@ void __show_backtrace(unsigned long fp)
198 rw->ins[6], 196 rw->ins[6],
199 rw->ins[7]); 197 rw->ins[7]);
200 printk("%pS\n", (void *) rw->ins[7]); 198 printk("%pS\n", (void *) rw->ins[7]);
201 rw = (struct reg_window *) rw->ins[6]; 199 rw = (struct reg_window32 *) rw->ins[6];
202 } 200 }
203 spin_unlock_irqrestore(&sparc_backtrace_lock, flags); 201 spin_unlock_irqrestore(&sparc_backtrace_lock, flags);
204} 202}
@@ -260,7 +258,7 @@ void show_stackframe(struct sparc_stackf *sf)
260 258
261void show_regs(struct pt_regs *r) 259void show_regs(struct pt_regs *r)
262{ 260{
263 struct reg_window *rw = (struct reg_window *) r->u_regs[14]; 261 struct reg_window32 *rw = (struct reg_window32 *) r->u_regs[14];
264 262
265 printk("PSR: %08lx PC: %08lx NPC: %08lx Y: %08lx %s\n", 263 printk("PSR: %08lx PC: %08lx NPC: %08lx Y: %08lx %s\n",
266 r->psr, r->pc, r->npc, r->y, print_tainted()); 264 r->psr, r->pc, r->npc, r->y, print_tainted());
@@ -289,7 +287,7 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
289{ 287{
290 unsigned long pc, fp; 288 unsigned long pc, fp;
291 unsigned long task_base; 289 unsigned long task_base;
292 struct reg_window *rw; 290 struct reg_window32 *rw;
293 int count = 0; 291 int count = 0;
294 292
295 if (tsk != NULL) 293 if (tsk != NULL)
@@ -303,7 +301,7 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
303 if (fp < (task_base + sizeof(struct thread_info)) || 301 if (fp < (task_base + sizeof(struct thread_info)) ||
304 fp >= (task_base + (PAGE_SIZE << 1))) 302 fp >= (task_base + (PAGE_SIZE << 1)))
305 break; 303 break;
306 rw = (struct reg_window *) fp; 304 rw = (struct reg_window32 *) fp;
307 pc = rw->ins[7]; 305 pc = rw->ins[7];
308 printk("[%08lx : ", pc); 306 printk("[%08lx : ", pc);
309 printk("%pS ] ", (void *) pc); 307 printk("%pS ] ", (void *) pc);
@@ -681,7 +679,7 @@ unsigned long get_wchan(struct task_struct *task)
681 unsigned long pc, fp, bias = 0; 679 unsigned long pc, fp, bias = 0;
682 unsigned long task_base = (unsigned long) task; 680 unsigned long task_base = (unsigned long) task;
683 unsigned long ret = 0; 681 unsigned long ret = 0;
684 struct reg_window *rw; 682 struct reg_window32 *rw;
685 int count = 0; 683 int count = 0;
686 684
687 if (!task || task == current || 685 if (!task || task == current ||
@@ -694,7 +692,7 @@ unsigned long get_wchan(struct task_struct *task)
694 if (fp < (task_base + sizeof(struct thread_info)) || 692 if (fp < (task_base + sizeof(struct thread_info)) ||
695 fp >= (task_base + (2 * PAGE_SIZE))) 693 fp >= (task_base + (2 * PAGE_SIZE)))
696 break; 694 break;
697 rw = (struct reg_window *) fp; 695 rw = (struct reg_window32 *) fp;
698 pc = rw->ins[7]; 696 pc = rw->ins[7];
699 if (!in_sched_functions(pc)) { 697 if (!in_sched_functions(pc)) {
700 ret = pc; 698 ret = pc;
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc/kernel/process_64.c
index d5e2acef9877..d5e2acef9877 100644
--- a/arch/sparc64/kernel/process.c
+++ b/arch/sparc/kernel/process_64.c
diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h
new file mode 100644
index 000000000000..bb0f0fda6cab
--- /dev/null
+++ b/arch/sparc/kernel/prom.h
@@ -0,0 +1,29 @@
1#ifndef __PROM_H
2#define __PROM_H
3
4#include <linux/spinlock.h>
5#include <asm/prom.h>
6
7extern struct device_node *allnodes; /* temporary while merging */
8extern rwlock_t devtree_lock; /* temporary while merging */
9
10extern void * prom_early_alloc(unsigned long size);
11extern void irq_trans_init(struct device_node *dp);
12
13extern unsigned int prom_unique_id;
14
15static inline int is_root_node(const struct device_node *dp)
16{
17 if (!dp)
18 return 0;
19
20 return (dp->parent == NULL);
21}
22
23extern char *build_path_component(struct device_node *dp);
24extern void of_console_init(void);
25extern void of_fill_in_cpu_data(void);
26
27extern unsigned int prom_early_allocated;
28
29#endif /* __PROM_H */
diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom_32.c
index eee5efcfe50e..fe43e80772db 100644
--- a/arch/sparc/kernel/prom.c
+++ b/arch/sparc/kernel/prom_32.c
@@ -25,107 +25,9 @@
25#include <asm/prom.h> 25#include <asm/prom.h>
26#include <asm/oplib.h> 26#include <asm/oplib.h>
27 27
28extern struct device_node *allnodes; /* temporary while merging */ 28#include "prom.h"
29 29
30extern rwlock_t devtree_lock; /* temporary while merging */ 30void * __init prom_early_alloc(unsigned long size)
31
32struct device_node *of_find_node_by_phandle(phandle handle)
33{
34 struct device_node *np;
35
36 for (np = allnodes; np != 0; np = np->allnext)
37 if (np->node == handle)
38 break;
39
40 return np;
41}
42EXPORT_SYMBOL(of_find_node_by_phandle);
43
44int of_getintprop_default(struct device_node *np, const char *name, int def)
45{
46 struct property *prop;
47 int len;
48
49 prop = of_find_property(np, name, &len);
50 if (!prop || len != 4)
51 return def;
52
53 return *(int *) prop->value;
54}
55EXPORT_SYMBOL(of_getintprop_default);
56
57DEFINE_MUTEX(of_set_property_mutex);
58EXPORT_SYMBOL(of_set_property_mutex);
59
60int of_set_property(struct device_node *dp, const char *name, void *val, int len)
61{
62 struct property **prevp;
63 void *new_val;
64 int err;
65
66 new_val = kmalloc(len, GFP_KERNEL);
67 if (!new_val)
68 return -ENOMEM;
69
70 memcpy(new_val, val, len);
71
72 err = -ENODEV;
73
74 write_lock(&devtree_lock);
75 prevp = &dp->properties;
76 while (*prevp) {
77 struct property *prop = *prevp;
78
79 if (!strcasecmp(prop->name, name)) {
80 void *old_val = prop->value;
81 int ret;
82
83 mutex_lock(&of_set_property_mutex);
84 ret = prom_setprop(dp->node, (char *) name, val, len);
85 mutex_unlock(&of_set_property_mutex);
86
87 err = -EINVAL;
88 if (ret >= 0) {
89 prop->value = new_val;
90 prop->length = len;
91
92 if (OF_IS_DYNAMIC(prop))
93 kfree(old_val);
94
95 OF_MARK_DYNAMIC(prop);
96
97 err = 0;
98 }
99 break;
100 }
101 prevp = &(*prevp)->next;
102 }
103 write_unlock(&devtree_lock);
104
105 /* XXX Upate procfs if necessary... */
106
107 return err;
108}
109EXPORT_SYMBOL(of_set_property);
110
111int of_find_in_proplist(const char *list, const char *match, int len)
112{
113 while (len > 0) {
114 int l;
115
116 if (!strcmp(list, match))
117 return 1;
118 l = strlen(list) + 1;
119 list += l;
120 len -= l;
121 }
122 return 0;
123}
124EXPORT_SYMBOL(of_find_in_proplist);
125
126static unsigned int prom_early_allocated;
127
128static void * __init prom_early_alloc(unsigned long size)
129{ 31{
130 void *ret; 32 void *ret;
131 33
@@ -138,14 +40,6 @@ static void * __init prom_early_alloc(unsigned long size)
138 return ret; 40 return ret;
139} 41}
140 42
141static int is_root_node(const struct device_node *dp)
142{
143 if (!dp)
144 return 0;
145
146 return (dp->parent == NULL);
147}
148
149/* The following routines deal with the black magic of fully naming a 43/* The following routines deal with the black magic of fully naming a
150 * node. 44 * node.
151 * 45 *
@@ -257,7 +151,7 @@ static void __init __build_path_component(struct device_node *dp, char *tmp_buf)
257 return sparc32_path_component(dp, tmp_buf); 151 return sparc32_path_component(dp, tmp_buf);
258} 152}
259 153
260static char * __init build_path_component(struct device_node *dp) 154char * __init build_path_component(struct device_node *dp)
261{ 155{
262 char tmp_buf[64], *n; 156 char tmp_buf[64], *n;
263 157
@@ -272,164 +166,9 @@ static char * __init build_path_component(struct device_node *dp)
272 return n; 166 return n;
273} 167}
274 168
275static char * __init build_full_name(struct device_node *dp)
276{
277 int len, ourlen, plen;
278 char *n;
279
280 plen = strlen(dp->parent->full_name);
281 ourlen = strlen(dp->path_component_name);
282 len = ourlen + plen + 2;
283
284 n = prom_early_alloc(len);
285 strcpy(n, dp->parent->full_name);
286 if (!is_root_node(dp->parent)) {
287 strcpy(n + plen, "/");
288 plen++;
289 }
290 strcpy(n + plen, dp->path_component_name);
291
292 return n;
293}
294
295static unsigned int unique_id;
296
297static struct property * __init build_one_prop(phandle node, char *prev, char *special_name, void *special_val, int special_len)
298{
299 static struct property *tmp = NULL;
300 struct property *p;
301 int len;
302 const char *name;
303
304 if (tmp) {
305 p = tmp;
306 memset(p, 0, sizeof(*p) + 32);
307 tmp = NULL;
308 } else {
309 p = prom_early_alloc(sizeof(struct property) + 32);
310 p->unique_id = unique_id++;
311 }
312
313 p->name = (char *) (p + 1);
314 if (special_name) {
315 strcpy(p->name, special_name);
316 p->length = special_len;
317 p->value = prom_early_alloc(special_len);
318 memcpy(p->value, special_val, special_len);
319 } else {
320 if (prev == NULL) {
321 name = prom_firstprop(node, NULL);
322 } else {
323 name = prom_nextprop(node, prev, NULL);
324 }
325 if (strlen(name) == 0) {
326 tmp = p;
327 return NULL;
328 }
329 strcpy(p->name, name);
330 p->length = prom_getproplen(node, p->name);
331 if (p->length <= 0) {
332 p->length = 0;
333 } else {
334 p->value = prom_early_alloc(p->length + 1);
335 len = prom_getproperty(node, p->name, p->value,
336 p->length);
337 if (len <= 0)
338 p->length = 0;
339 ((unsigned char *)p->value)[p->length] = '\0';
340 }
341 }
342 return p;
343}
344
345static struct property * __init build_prop_list(phandle node)
346{
347 struct property *head, *tail;
348
349 head = tail = build_one_prop(node, NULL,
350 ".node", &node, sizeof(node));
351
352 tail->next = build_one_prop(node, NULL, NULL, NULL, 0);
353 tail = tail->next;
354 while(tail) {
355 tail->next = build_one_prop(node, tail->name,
356 NULL, NULL, 0);
357 tail = tail->next;
358 }
359
360 return head;
361}
362
363static char * __init get_one_property(phandle node, char *name)
364{
365 char *buf = "<NULL>";
366 int len;
367
368 len = prom_getproplen(node, name);
369 if (len > 0) {
370 buf = prom_early_alloc(len);
371 len = prom_getproperty(node, name, buf, len);
372 }
373
374 return buf;
375}
376
377static struct device_node * __init create_node(phandle node)
378{
379 struct device_node *dp;
380
381 if (!node)
382 return NULL;
383
384 dp = prom_early_alloc(sizeof(*dp));
385 dp->unique_id = unique_id++;
386
387 kref_init(&dp->kref);
388
389 dp->name = get_one_property(node, "name");
390 dp->type = get_one_property(node, "device_type");
391 dp->node = node;
392
393 /* Build interrupts later... */
394
395 dp->properties = build_prop_list(node);
396
397 return dp;
398}
399
400static struct device_node * __init build_tree(struct device_node *parent, phandle node, struct device_node ***nextp)
401{
402 struct device_node *dp;
403
404 dp = create_node(node);
405 if (dp) {
406 *(*nextp) = dp;
407 *nextp = &dp->allnext;
408
409 dp->parent = parent;
410 dp->path_component_name = build_path_component(dp);
411 dp->full_name = build_full_name(dp);
412
413 dp->child = build_tree(dp, prom_getchild(node), nextp);
414
415 dp->sibling = build_tree(parent, prom_getsibling(node), nextp);
416 }
417
418 return dp;
419}
420
421struct device_node *of_console_device;
422EXPORT_SYMBOL(of_console_device);
423
424char *of_console_path;
425EXPORT_SYMBOL(of_console_path);
426
427char *of_console_options;
428EXPORT_SYMBOL(of_console_options);
429
430extern void restore_current(void); 169extern void restore_current(void);
431 170
432static void __init of_console_init(void) 171void __init of_console_init(void)
433{ 172{
434 char *msg = "OF stdout device is: %s\n"; 173 char *msg = "OF stdout device is: %s\n";
435 struct device_node *dp; 174 struct device_node *dp;
@@ -547,20 +286,10 @@ static void __init of_console_init(void)
547 printk(msg, of_console_path); 286 printk(msg, of_console_path);
548} 287}
549 288
550void __init prom_build_devicetree(void) 289void __init of_fill_in_cpu_data(void)
551{ 290{
552 struct device_node **nextp; 291}
553
554 allnodes = create_node(prom_root_node);
555 allnodes->path_component_name = "";
556 allnodes->full_name = "/";
557
558 nextp = &allnodes->allnext;
559 allnodes->child = build_tree(allnodes,
560 prom_getchild(allnodes->node),
561 &nextp);
562 of_console_init();
563 292
564 printk("PROM: Built device tree with %u bytes of memory.\n", 293void __init irq_trans_init(struct device_node *dp)
565 prom_early_allocated); 294{
566} 295}
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c
new file mode 100644
index 000000000000..edecca7b8116
--- /dev/null
+++ b/arch/sparc/kernel/prom_64.c
@@ -0,0 +1,571 @@
1/*
2 * Procedures for creating, accessing and interpreting the device tree.
3 *
4 * Paul Mackerras August 1996.
5 * Copyright (C) 1996-2005 Paul Mackerras.
6 *
7 * Adapted for 64bit PowerPC by Dave Engebretsen and Peter Bergner.
8 * {engebret|bergner}@us.ibm.com
9 *
10 * Adapted for sparc64 by David S. Miller davem@davemloft.net
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17
18#include <linux/kernel.h>
19#include <linux/types.h>
20#include <linux/string.h>
21#include <linux/mm.h>
22#include <linux/module.h>
23#include <linux/lmb.h>
24#include <linux/of_device.h>
25
26#include <asm/prom.h>
27#include <asm/oplib.h>
28#include <asm/irq.h>
29#include <asm/asi.h>
30#include <asm/upa.h>
31#include <asm/smp.h>
32
33#include "prom.h"
34
35void * __init prom_early_alloc(unsigned long size)
36{
37 unsigned long paddr = lmb_alloc(size, SMP_CACHE_BYTES);
38 void *ret;
39
40 if (!paddr) {
41 prom_printf("prom_early_alloc(%lu) failed\n");
42 prom_halt();
43 }
44
45 ret = __va(paddr);
46 memset(ret, 0, size);
47 prom_early_allocated += size;
48
49 return ret;
50}
51
52/* The following routines deal with the black magic of fully naming a
53 * node.
54 *
55 * Certain well known named nodes are just the simple name string.
56 *
57 * Actual devices have an address specifier appended to the base name
58 * string, like this "foo@addr". The "addr" can be in any number of
59 * formats, and the platform plus the type of the node determine the
60 * format and how it is constructed.
61 *
62 * For children of the ROOT node, the naming convention is fixed and
63 * determined by whether this is a sun4u or sun4v system.
64 *
65 * For children of other nodes, it is bus type specific. So
66 * we walk up the tree until we discover a "device_type" property
67 * we recognize and we go from there.
68 *
69 * As an example, the boot device on my workstation has a full path:
70 *
71 * /pci@1e,600000/ide@d/disk@0,0:c
72 */
73static void __init sun4v_path_component(struct device_node *dp, char *tmp_buf)
74{
75 struct linux_prom64_registers *regs;
76 struct property *rprop;
77 u32 high_bits, low_bits, type;
78
79 rprop = of_find_property(dp, "reg", NULL);
80 if (!rprop)
81 return;
82
83 regs = rprop->value;
84 if (!is_root_node(dp->parent)) {
85 sprintf(tmp_buf, "%s@%x,%x",
86 dp->name,
87 (unsigned int) (regs->phys_addr >> 32UL),
88 (unsigned int) (regs->phys_addr & 0xffffffffUL));
89 return;
90 }
91
92 type = regs->phys_addr >> 60UL;
93 high_bits = (regs->phys_addr >> 32UL) & 0x0fffffffUL;
94 low_bits = (regs->phys_addr & 0xffffffffUL);
95
96 if (type == 0 || type == 8) {
97 const char *prefix = (type == 0) ? "m" : "i";
98
99 if (low_bits)
100 sprintf(tmp_buf, "%s@%s%x,%x",
101 dp->name, prefix,
102 high_bits, low_bits);
103 else
104 sprintf(tmp_buf, "%s@%s%x",
105 dp->name,
106 prefix,
107 high_bits);
108 } else if (type == 12) {
109 sprintf(tmp_buf, "%s@%x",
110 dp->name, high_bits);
111 }
112}
113
114static void __init sun4u_path_component(struct device_node *dp, char *tmp_buf)
115{
116 struct linux_prom64_registers *regs;
117 struct property *prop;
118
119 prop = of_find_property(dp, "reg", NULL);
120 if (!prop)
121 return;
122
123 regs = prop->value;
124 if (!is_root_node(dp->parent)) {
125 sprintf(tmp_buf, "%s@%x,%x",
126 dp->name,
127 (unsigned int) (regs->phys_addr >> 32UL),
128 (unsigned int) (regs->phys_addr & 0xffffffffUL));
129 return;
130 }
131
132 prop = of_find_property(dp, "upa-portid", NULL);
133 if (!prop)
134 prop = of_find_property(dp, "portid", NULL);
135 if (prop) {
136 unsigned long mask = 0xffffffffUL;
137
138 if (tlb_type >= cheetah)
139 mask = 0x7fffff;
140
141 sprintf(tmp_buf, "%s@%x,%x",
142 dp->name,
143 *(u32 *)prop->value,
144 (unsigned int) (regs->phys_addr & mask));
145 }
146}
147
148/* "name@slot,offset" */
149static void __init sbus_path_component(struct device_node *dp, char *tmp_buf)
150{
151 struct linux_prom_registers *regs;
152 struct property *prop;
153
154 prop = of_find_property(dp, "reg", NULL);
155 if (!prop)
156 return;
157
158 regs = prop->value;
159 sprintf(tmp_buf, "%s@%x,%x",
160 dp->name,
161 regs->which_io,
162 regs->phys_addr);
163}
164
165/* "name@devnum[,func]" */
166static void __init pci_path_component(struct device_node *dp, char *tmp_buf)
167{
168 struct linux_prom_pci_registers *regs;
169 struct property *prop;
170 unsigned int devfn;
171
172 prop = of_find_property(dp, "reg", NULL);
173 if (!prop)
174 return;
175
176 regs = prop->value;
177 devfn = (regs->phys_hi >> 8) & 0xff;
178 if (devfn & 0x07) {
179 sprintf(tmp_buf, "%s@%x,%x",
180 dp->name,
181 devfn >> 3,
182 devfn & 0x07);
183 } else {
184 sprintf(tmp_buf, "%s@%x",
185 dp->name,
186 devfn >> 3);
187 }
188}
189
190/* "name@UPA_PORTID,offset" */
191static void __init upa_path_component(struct device_node *dp, char *tmp_buf)
192{
193 struct linux_prom64_registers *regs;
194 struct property *prop;
195
196 prop = of_find_property(dp, "reg", NULL);
197 if (!prop)
198 return;
199
200 regs = prop->value;
201
202 prop = of_find_property(dp, "upa-portid", NULL);
203 if (!prop)
204 return;
205
206 sprintf(tmp_buf, "%s@%x,%x",
207 dp->name,
208 *(u32 *) prop->value,
209 (unsigned int) (regs->phys_addr & 0xffffffffUL));
210}
211
212/* "name@reg" */
213static void __init vdev_path_component(struct device_node *dp, char *tmp_buf)
214{
215 struct property *prop;
216 u32 *regs;
217
218 prop = of_find_property(dp, "reg", NULL);
219 if (!prop)
220 return;
221
222 regs = prop->value;
223
224 sprintf(tmp_buf, "%s@%x", dp->name, *regs);
225}
226
227/* "name@addrhi,addrlo" */
228static void __init ebus_path_component(struct device_node *dp, char *tmp_buf)
229{
230 struct linux_prom64_registers *regs;
231 struct property *prop;
232
233 prop = of_find_property(dp, "reg", NULL);
234 if (!prop)
235 return;
236
237 regs = prop->value;
238
239 sprintf(tmp_buf, "%s@%x,%x",
240 dp->name,
241 (unsigned int) (regs->phys_addr >> 32UL),
242 (unsigned int) (regs->phys_addr & 0xffffffffUL));
243}
244
245/* "name@bus,addr" */
246static void __init i2c_path_component(struct device_node *dp, char *tmp_buf)
247{
248 struct property *prop;
249 u32 *regs;
250
251 prop = of_find_property(dp, "reg", NULL);
252 if (!prop)
253 return;
254
255 regs = prop->value;
256
257 /* This actually isn't right... should look at the #address-cells
258 * property of the i2c bus node etc. etc.
259 */
260 sprintf(tmp_buf, "%s@%x,%x",
261 dp->name, regs[0], regs[1]);
262}
263
264/* "name@reg0[,reg1]" */
265static void __init usb_path_component(struct device_node *dp, char *tmp_buf)
266{
267 struct property *prop;
268 u32 *regs;
269
270 prop = of_find_property(dp, "reg", NULL);
271 if (!prop)
272 return;
273
274 regs = prop->value;
275
276 if (prop->length == sizeof(u32) || regs[1] == 1) {
277 sprintf(tmp_buf, "%s@%x",
278 dp->name, regs[0]);
279 } else {
280 sprintf(tmp_buf, "%s@%x,%x",
281 dp->name, regs[0], regs[1]);
282 }
283}
284
285/* "name@reg0reg1[,reg2reg3]" */
286static void __init ieee1394_path_component(struct device_node *dp, char *tmp_buf)
287{
288 struct property *prop;
289 u32 *regs;
290
291 prop = of_find_property(dp, "reg", NULL);
292 if (!prop)
293 return;
294
295 regs = prop->value;
296
297 if (regs[2] || regs[3]) {
298 sprintf(tmp_buf, "%s@%08x%08x,%04x%08x",
299 dp->name, regs[0], regs[1], regs[2], regs[3]);
300 } else {
301 sprintf(tmp_buf, "%s@%08x%08x",
302 dp->name, regs[0], regs[1]);
303 }
304}
305
306static void __init __build_path_component(struct device_node *dp, char *tmp_buf)
307{
308 struct device_node *parent = dp->parent;
309
310 if (parent != NULL) {
311 if (!strcmp(parent->type, "pci") ||
312 !strcmp(parent->type, "pciex")) {
313 pci_path_component(dp, tmp_buf);
314 return;
315 }
316 if (!strcmp(parent->type, "sbus")) {
317 sbus_path_component(dp, tmp_buf);
318 return;
319 }
320 if (!strcmp(parent->type, "upa")) {
321 upa_path_component(dp, tmp_buf);
322 return;
323 }
324 if (!strcmp(parent->type, "ebus")) {
325 ebus_path_component(dp, tmp_buf);
326 return;
327 }
328 if (!strcmp(parent->name, "usb") ||
329 !strcmp(parent->name, "hub")) {
330 usb_path_component(dp, tmp_buf);
331 return;
332 }
333 if (!strcmp(parent->type, "i2c")) {
334 i2c_path_component(dp, tmp_buf);
335 return;
336 }
337 if (!strcmp(parent->type, "firewire")) {
338 ieee1394_path_component(dp, tmp_buf);
339 return;
340 }
341 if (!strcmp(parent->type, "virtual-devices")) {
342 vdev_path_component(dp, tmp_buf);
343 return;
344 }
345 /* "isa" is handled with platform naming */
346 }
347
348 /* Use platform naming convention. */
349 if (tlb_type == hypervisor) {
350 sun4v_path_component(dp, tmp_buf);
351 return;
352 } else {
353 sun4u_path_component(dp, tmp_buf);
354 }
355}
356
357char * __init build_path_component(struct device_node *dp)
358{
359 char tmp_buf[64], *n;
360
361 tmp_buf[0] = '\0';
362 __build_path_component(dp, tmp_buf);
363 if (tmp_buf[0] == '\0')
364 strcpy(tmp_buf, dp->name);
365
366 n = prom_early_alloc(strlen(tmp_buf) + 1);
367 strcpy(n, tmp_buf);
368
369 return n;
370}
371
372static const char *get_mid_prop(void)
373{
374 return (tlb_type == spitfire ? "upa-portid" : "portid");
375}
376
377struct device_node *of_find_node_by_cpuid(int cpuid)
378{
379 struct device_node *dp;
380 const char *mid_prop = get_mid_prop();
381
382 for_each_node_by_type(dp, "cpu") {
383 int id = of_getintprop_default(dp, mid_prop, -1);
384 const char *this_mid_prop = mid_prop;
385
386 if (id < 0) {
387 this_mid_prop = "cpuid";
388 id = of_getintprop_default(dp, this_mid_prop, -1);
389 }
390
391 if (id < 0) {
392 prom_printf("OF: Serious problem, cpu lacks "
393 "%s property", this_mid_prop);
394 prom_halt();
395 }
396 if (cpuid == id)
397 return dp;
398 }
399 return NULL;
400}
401
402void __init of_fill_in_cpu_data(void)
403{
404 struct device_node *dp;
405 const char *mid_prop;
406
407 if (tlb_type == hypervisor)
408 return;
409
410 mid_prop = get_mid_prop();
411 ncpus_probed = 0;
412 for_each_node_by_type(dp, "cpu") {
413 int cpuid = of_getintprop_default(dp, mid_prop, -1);
414 const char *this_mid_prop = mid_prop;
415 struct device_node *portid_parent;
416 int portid = -1;
417
418 portid_parent = NULL;
419 if (cpuid < 0) {
420 this_mid_prop = "cpuid";
421 cpuid = of_getintprop_default(dp, this_mid_prop, -1);
422 if (cpuid >= 0) {
423 int limit = 2;
424
425 portid_parent = dp;
426 while (limit--) {
427 portid_parent = portid_parent->parent;
428 if (!portid_parent)
429 break;
430 portid = of_getintprop_default(portid_parent,
431 "portid", -1);
432 if (portid >= 0)
433 break;
434 }
435 }
436 }
437
438 if (cpuid < 0) {
439 prom_printf("OF: Serious problem, cpu lacks "
440 "%s property", this_mid_prop);
441 prom_halt();
442 }
443
444 ncpus_probed++;
445
446#ifdef CONFIG_SMP
447 if (cpuid >= NR_CPUS) {
448 printk(KERN_WARNING "Ignoring CPU %d which is "
449 ">= NR_CPUS (%d)\n",
450 cpuid, NR_CPUS);
451 continue;
452 }
453#else
454 /* On uniprocessor we only want the values for the
455 * real physical cpu the kernel booted onto, however
456 * cpu_data() only has one entry at index 0.
457 */
458 if (cpuid != real_hard_smp_processor_id())
459 continue;
460 cpuid = 0;
461#endif
462
463 cpu_data(cpuid).clock_tick =
464 of_getintprop_default(dp, "clock-frequency", 0);
465
466 if (portid_parent) {
467 cpu_data(cpuid).dcache_size =
468 of_getintprop_default(dp, "l1-dcache-size",
469 16 * 1024);
470 cpu_data(cpuid).dcache_line_size =
471 of_getintprop_default(dp, "l1-dcache-line-size",
472 32);
473 cpu_data(cpuid).icache_size =
474 of_getintprop_default(dp, "l1-icache-size",
475 8 * 1024);
476 cpu_data(cpuid).icache_line_size =
477 of_getintprop_default(dp, "l1-icache-line-size",
478 32);
479 cpu_data(cpuid).ecache_size =
480 of_getintprop_default(dp, "l2-cache-size", 0);
481 cpu_data(cpuid).ecache_line_size =
482 of_getintprop_default(dp, "l2-cache-line-size", 0);
483 if (!cpu_data(cpuid).ecache_size ||
484 !cpu_data(cpuid).ecache_line_size) {
485 cpu_data(cpuid).ecache_size =
486 of_getintprop_default(portid_parent,
487 "l2-cache-size",
488 (4 * 1024 * 1024));
489 cpu_data(cpuid).ecache_line_size =
490 of_getintprop_default(portid_parent,
491 "l2-cache-line-size", 64);
492 }
493
494 cpu_data(cpuid).core_id = portid + 1;
495 cpu_data(cpuid).proc_id = portid;
496#ifdef CONFIG_SMP
497 sparc64_multi_core = 1;
498#endif
499 } else {
500 cpu_data(cpuid).dcache_size =
501 of_getintprop_default(dp, "dcache-size", 16 * 1024);
502 cpu_data(cpuid).dcache_line_size =
503 of_getintprop_default(dp, "dcache-line-size", 32);
504
505 cpu_data(cpuid).icache_size =
506 of_getintprop_default(dp, "icache-size", 16 * 1024);
507 cpu_data(cpuid).icache_line_size =
508 of_getintprop_default(dp, "icache-line-size", 32);
509
510 cpu_data(cpuid).ecache_size =
511 of_getintprop_default(dp, "ecache-size",
512 (4 * 1024 * 1024));
513 cpu_data(cpuid).ecache_line_size =
514 of_getintprop_default(dp, "ecache-line-size", 64);
515
516 cpu_data(cpuid).core_id = 0;
517 cpu_data(cpuid).proc_id = -1;
518 }
519
520#ifdef CONFIG_SMP
521 cpu_set(cpuid, cpu_present_map);
522 cpu_set(cpuid, cpu_possible_map);
523#endif
524 }
525
526 smp_fill_in_sib_core_maps();
527}
528
529void __init of_console_init(void)
530{
531 char *msg = "OF stdout device is: %s\n";
532 struct device_node *dp;
533 const char *type;
534 phandle node;
535
536 of_console_path = prom_early_alloc(256);
537 if (prom_ihandle2path(prom_stdout, of_console_path, 256) < 0) {
538 prom_printf("Cannot obtain path of stdout.\n");
539 prom_halt();
540 }
541 of_console_options = strrchr(of_console_path, ':');
542 if (of_console_options) {
543 of_console_options++;
544 if (*of_console_options == '\0')
545 of_console_options = NULL;
546 }
547
548 node = prom_inst2pkg(prom_stdout);
549 if (!node) {
550 prom_printf("Cannot resolve stdout node from "
551 "instance %08x.\n", prom_stdout);
552 prom_halt();
553 }
554
555 dp = of_find_node_by_phandle(node);
556 type = of_get_property(dp, "device_type", NULL);
557 if (!type) {
558 prom_printf("Console stdout lacks device_type property.\n");
559 prom_halt();
560 }
561
562 if (strcmp(type, "display") && strcmp(type, "serial")) {
563 prom_printf("Console device_type is neither display "
564 "nor serial.\n");
565 prom_halt();
566 }
567
568 of_console_device = dp;
569
570 printk(msg, of_console_path);
571}
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c
new file mode 100644
index 000000000000..ff7b591c8946
--- /dev/null
+++ b/arch/sparc/kernel/prom_common.c
@@ -0,0 +1,318 @@
1/* prom_common.c: OF device tree support common code.
2 *
3 * Paul Mackerras August 1996.
4 * Copyright (C) 1996-2005 Paul Mackerras.
5 *
6 * Adapted for 64bit PowerPC by Dave Engebretsen and Peter Bergner.
7 * {engebret|bergner}@us.ibm.com
8 *
9 * Adapted for sparc by David S. Miller davem@davemloft.net
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 */
16
17#include <linux/kernel.h>
18#include <linux/module.h>
19#include <linux/errno.h>
20#include <linux/mutex.h>
21#include <linux/slab.h>
22#include <linux/of.h>
23#include <asm/prom.h>
24#include <asm/oplib.h>
25
26#include "prom.h"
27
28struct device_node *of_console_device;
29EXPORT_SYMBOL(of_console_device);
30
31char *of_console_path;
32EXPORT_SYMBOL(of_console_path);
33
34char *of_console_options;
35EXPORT_SYMBOL(of_console_options);
36
37struct device_node *of_find_node_by_phandle(phandle handle)
38{
39 struct device_node *np;
40
41 for (np = allnodes; np; np = np->allnext)
42 if (np->node == handle)
43 break;
44
45 return np;
46}
47EXPORT_SYMBOL(of_find_node_by_phandle);
48
49int of_getintprop_default(struct device_node *np, const char *name, int def)
50{
51 struct property *prop;
52 int len;
53
54 prop = of_find_property(np, name, &len);
55 if (!prop || len != 4)
56 return def;
57
58 return *(int *) prop->value;
59}
60EXPORT_SYMBOL(of_getintprop_default);
61
62DEFINE_MUTEX(of_set_property_mutex);
63EXPORT_SYMBOL(of_set_property_mutex);
64
65int of_set_property(struct device_node *dp, const char *name, void *val, int len)
66{
67 struct property **prevp;
68 void *new_val;
69 int err;
70
71 new_val = kmalloc(len, GFP_KERNEL);
72 if (!new_val)
73 return -ENOMEM;
74
75 memcpy(new_val, val, len);
76
77 err = -ENODEV;
78
79 write_lock(&devtree_lock);
80 prevp = &dp->properties;
81 while (*prevp) {
82 struct property *prop = *prevp;
83
84 if (!strcasecmp(prop->name, name)) {
85 void *old_val = prop->value;
86 int ret;
87
88 mutex_lock(&of_set_property_mutex);
89 ret = prom_setprop(dp->node, name, val, len);
90 mutex_unlock(&of_set_property_mutex);
91
92 err = -EINVAL;
93 if (ret >= 0) {
94 prop->value = new_val;
95 prop->length = len;
96
97 if (OF_IS_DYNAMIC(prop))
98 kfree(old_val);
99
100 OF_MARK_DYNAMIC(prop);
101
102 err = 0;
103 }
104 break;
105 }
106 prevp = &(*prevp)->next;
107 }
108 write_unlock(&devtree_lock);
109
110 /* XXX Upate procfs if necessary... */
111
112 return err;
113}
114EXPORT_SYMBOL(of_set_property);
115
116int of_find_in_proplist(const char *list, const char *match, int len)
117{
118 while (len > 0) {
119 int l;
120
121 if (!strcmp(list, match))
122 return 1;
123 l = strlen(list) + 1;
124 list += l;
125 len -= l;
126 }
127 return 0;
128}
129EXPORT_SYMBOL(of_find_in_proplist);
130
131unsigned int prom_unique_id;
132
133static struct property * __init build_one_prop(phandle node, char *prev,
134 char *special_name,
135 void *special_val,
136 int special_len)
137{
138 static struct property *tmp = NULL;
139 struct property *p;
140 const char *name;
141
142 if (tmp) {
143 p = tmp;
144 memset(p, 0, sizeof(*p) + 32);
145 tmp = NULL;
146 } else {
147 p = prom_early_alloc(sizeof(struct property) + 32);
148 p->unique_id = prom_unique_id++;
149 }
150
151 p->name = (char *) (p + 1);
152 if (special_name) {
153 strcpy(p->name, special_name);
154 p->length = special_len;
155 p->value = prom_early_alloc(special_len);
156 memcpy(p->value, special_val, special_len);
157 } else {
158 if (prev == NULL) {
159 name = prom_firstprop(node, p->name);
160 } else {
161 name = prom_nextprop(node, prev, p->name);
162 }
163
164 if (strlen(name) == 0) {
165 tmp = p;
166 return NULL;
167 }
168#ifdef CONFIG_SPARC32
169 strcpy(p->name, name);
170#endif
171 p->length = prom_getproplen(node, p->name);
172 if (p->length <= 0) {
173 p->length = 0;
174 } else {
175 int len;
176
177 p->value = prom_early_alloc(p->length + 1);
178 len = prom_getproperty(node, p->name, p->value,
179 p->length);
180 if (len <= 0)
181 p->length = 0;
182 ((unsigned char *)p->value)[p->length] = '\0';
183 }
184 }
185 return p;
186}
187
188static struct property * __init build_prop_list(phandle node)
189{
190 struct property *head, *tail;
191
192 head = tail = build_one_prop(node, NULL,
193 ".node", &node, sizeof(node));
194
195 tail->next = build_one_prop(node, NULL, NULL, NULL, 0);
196 tail = tail->next;
197 while(tail) {
198 tail->next = build_one_prop(node, tail->name,
199 NULL, NULL, 0);
200 tail = tail->next;
201 }
202
203 return head;
204}
205
206static char * __init get_one_property(phandle node, const char *name)
207{
208 char *buf = "<NULL>";
209 int len;
210
211 len = prom_getproplen(node, name);
212 if (len > 0) {
213 buf = prom_early_alloc(len);
214 len = prom_getproperty(node, name, buf, len);
215 }
216
217 return buf;
218}
219
220static struct device_node * __init prom_create_node(phandle node,
221 struct device_node *parent)
222{
223 struct device_node *dp;
224
225 if (!node)
226 return NULL;
227
228 dp = prom_early_alloc(sizeof(*dp));
229 dp->unique_id = prom_unique_id++;
230 dp->parent = parent;
231
232 kref_init(&dp->kref);
233
234 dp->name = get_one_property(node, "name");
235 dp->type = get_one_property(node, "device_type");
236 dp->node = node;
237
238 dp->properties = build_prop_list(node);
239
240 irq_trans_init(dp);
241
242 return dp;
243}
244
245static char * __init build_full_name(struct device_node *dp)
246{
247 int len, ourlen, plen;
248 char *n;
249
250 plen = strlen(dp->parent->full_name);
251 ourlen = strlen(dp->path_component_name);
252 len = ourlen + plen + 2;
253
254 n = prom_early_alloc(len);
255 strcpy(n, dp->parent->full_name);
256 if (!is_root_node(dp->parent)) {
257 strcpy(n + plen, "/");
258 plen++;
259 }
260 strcpy(n + plen, dp->path_component_name);
261
262 return n;
263}
264
265static struct device_node * __init prom_build_tree(struct device_node *parent,
266 phandle node,
267 struct device_node ***nextp)
268{
269 struct device_node *ret = NULL, *prev_sibling = NULL;
270 struct device_node *dp;
271
272 while (1) {
273 dp = prom_create_node(node, parent);
274 if (!dp)
275 break;
276
277 if (prev_sibling)
278 prev_sibling->sibling = dp;
279
280 if (!ret)
281 ret = dp;
282 prev_sibling = dp;
283
284 *(*nextp) = dp;
285 *nextp = &dp->allnext;
286
287 dp->path_component_name = build_path_component(dp);
288 dp->full_name = build_full_name(dp);
289
290 dp->child = prom_build_tree(dp, prom_getchild(node), nextp);
291
292 node = prom_getsibling(node);
293 }
294
295 return ret;
296}
297
298unsigned int prom_early_allocated __initdata;
299
300void __init prom_build_devicetree(void)
301{
302 struct device_node **nextp;
303
304 allnodes = prom_create_node(prom_root_node, NULL);
305 allnodes->path_component_name = "";
306 allnodes->full_name = "/";
307
308 nextp = &allnodes->allnext;
309 allnodes->child = prom_build_tree(allnodes,
310 prom_getchild(allnodes->node),
311 &nextp);
312 of_console_init();
313
314 printk("PROM: Built device tree with %u bytes of memory.\n",
315 prom_early_allocated);
316
317 of_fill_in_cpu_data();
318}
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc/kernel/prom_irqtrans.c
index dbba82f9b142..96958c4dce8e 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc/kernel/prom_irqtrans.c
@@ -1,151 +1,15 @@
1/*
2 * Procedures for creating, accessing and interpreting the device tree.
3 *
4 * Paul Mackerras August 1996.
5 * Copyright (C) 1996-2005 Paul Mackerras.
6 *
7 * Adapted for 64bit PowerPC by Dave Engebretsen and Peter Bergner.
8 * {engebret|bergner}@us.ibm.com
9 *
10 * Adapted for sparc64 by David S. Miller davem@davemloft.net
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17
18#include <linux/kernel.h> 1#include <linux/kernel.h>
19#include <linux/types.h>
20#include <linux/string.h> 2#include <linux/string.h>
21#include <linux/mm.h> 3#include <linux/init.h>
22#include <linux/module.h> 4#include <linux/of.h>
23#include <linux/lmb.h> 5#include <linux/of_platform.h>
24#include <linux/of_device.h>
25 6
26#include <asm/prom.h>
27#include <asm/oplib.h> 7#include <asm/oplib.h>
8#include <asm/prom.h>
28#include <asm/irq.h> 9#include <asm/irq.h>
29#include <asm/asi.h>
30#include <asm/upa.h> 10#include <asm/upa.h>
31#include <asm/smp.h>
32
33extern struct device_node *allnodes; /* temporary while merging */
34
35extern rwlock_t devtree_lock; /* temporary while merging */
36
37struct device_node *of_find_node_by_phandle(phandle handle)
38{
39 struct device_node *np;
40
41 for (np = allnodes; np; np = np->allnext)
42 if (np->node == handle)
43 break;
44
45 return np;
46}
47EXPORT_SYMBOL(of_find_node_by_phandle);
48
49int of_getintprop_default(struct device_node *np, const char *name, int def)
50{
51 struct property *prop;
52 int len;
53
54 prop = of_find_property(np, name, &len);
55 if (!prop || len != 4)
56 return def;
57
58 return *(int *) prop->value;
59}
60EXPORT_SYMBOL(of_getintprop_default);
61
62DEFINE_MUTEX(of_set_property_mutex);
63EXPORT_SYMBOL(of_set_property_mutex);
64
65int of_set_property(struct device_node *dp, const char *name, void *val, int len)
66{
67 struct property **prevp;
68 void *new_val;
69 int err;
70
71 new_val = kmalloc(len, GFP_KERNEL);
72 if (!new_val)
73 return -ENOMEM;
74
75 memcpy(new_val, val, len);
76
77 err = -ENODEV;
78
79 write_lock(&devtree_lock);
80 prevp = &dp->properties;
81 while (*prevp) {
82 struct property *prop = *prevp;
83
84 if (!strcasecmp(prop->name, name)) {
85 void *old_val = prop->value;
86 int ret;
87
88 mutex_lock(&of_set_property_mutex);
89 ret = prom_setprop(dp->node, name, val, len);
90 mutex_unlock(&of_set_property_mutex);
91
92 err = -EINVAL;
93 if (ret >= 0) {
94 prop->value = new_val;
95 prop->length = len;
96
97 if (OF_IS_DYNAMIC(prop))
98 kfree(old_val);
99
100 OF_MARK_DYNAMIC(prop);
101
102 err = 0;
103 }
104 break;
105 }
106 prevp = &(*prevp)->next;
107 }
108 write_unlock(&devtree_lock);
109
110 /* XXX Upate procfs if necessary... */
111 11
112 return err; 12#include "prom.h"
113}
114EXPORT_SYMBOL(of_set_property);
115
116int of_find_in_proplist(const char *list, const char *match, int len)
117{
118 while (len > 0) {
119 int l;
120
121 if (!strcmp(list, match))
122 return 1;
123 l = strlen(list) + 1;
124 list += l;
125 len -= l;
126 }
127 return 0;
128}
129EXPORT_SYMBOL(of_find_in_proplist);
130
131static unsigned int prom_early_allocated __initdata;
132
133static void * __init prom_early_alloc(unsigned long size)
134{
135 unsigned long paddr = lmb_alloc(size, SMP_CACHE_BYTES);
136 void *ret;
137
138 if (!paddr) {
139 prom_printf("prom_early_alloc(%lu) failed\n");
140 prom_halt();
141 }
142
143 ret = __va(paddr);
144 memset(ret, 0, size);
145 prom_early_allocated += size;
146
147 return ret;
148}
149 13
150#ifdef CONFIG_PCI 14#ifdef CONFIG_PCI
151/* PSYCHO interrupt mapping support. */ 15/* PSYCHO interrupt mapping support. */
@@ -936,7 +800,7 @@ static void __init sun4v_vdev_irq_trans_init(struct device_node *dp)
936 ((regs->phys_addr >> 32UL) & 0x0fffffff); 800 ((regs->phys_addr >> 32UL) & 0x0fffffff);
937} 801}
938 802
939static void __init irq_trans_init(struct device_node *dp) 803void __init irq_trans_init(struct device_node *dp)
940{ 804{
941#ifdef CONFIG_PCI 805#ifdef CONFIG_PCI
942 const char *model; 806 const char *model;
@@ -976,709 +840,3 @@ static void __init irq_trans_init(struct device_node *dp)
976 return; 840 return;
977 } 841 }
978} 842}
979
980static int is_root_node(const struct device_node *dp)
981{
982 if (!dp)
983 return 0;
984
985 return (dp->parent == NULL);
986}
987
988/* The following routines deal with the black magic of fully naming a
989 * node.
990 *
991 * Certain well known named nodes are just the simple name string.
992 *
993 * Actual devices have an address specifier appended to the base name
994 * string, like this "foo@addr". The "addr" can be in any number of
995 * formats, and the platform plus the type of the node determine the
996 * format and how it is constructed.
997 *
998 * For children of the ROOT node, the naming convention is fixed and
999 * determined by whether this is a sun4u or sun4v system.
1000 *
1001 * For children of other nodes, it is bus type specific. So
1002 * we walk up the tree until we discover a "device_type" property
1003 * we recognize and we go from there.
1004 *
1005 * As an example, the boot device on my workstation has a full path:
1006 *
1007 * /pci@1e,600000/ide@d/disk@0,0:c
1008 */
1009static void __init sun4v_path_component(struct device_node *dp, char *tmp_buf)
1010{
1011 struct linux_prom64_registers *regs;
1012 struct property *rprop;
1013 u32 high_bits, low_bits, type;
1014
1015 rprop = of_find_property(dp, "reg", NULL);
1016 if (!rprop)
1017 return;
1018
1019 regs = rprop->value;
1020 if (!is_root_node(dp->parent)) {
1021 sprintf(tmp_buf, "%s@%x,%x",
1022 dp->name,
1023 (unsigned int) (regs->phys_addr >> 32UL),
1024 (unsigned int) (regs->phys_addr & 0xffffffffUL));
1025 return;
1026 }
1027
1028 type = regs->phys_addr >> 60UL;
1029 high_bits = (regs->phys_addr >> 32UL) & 0x0fffffffUL;
1030 low_bits = (regs->phys_addr & 0xffffffffUL);
1031
1032 if (type == 0 || type == 8) {
1033 const char *prefix = (type == 0) ? "m" : "i";
1034
1035 if (low_bits)
1036 sprintf(tmp_buf, "%s@%s%x,%x",
1037 dp->name, prefix,
1038 high_bits, low_bits);
1039 else
1040 sprintf(tmp_buf, "%s@%s%x",
1041 dp->name,
1042 prefix,
1043 high_bits);
1044 } else if (type == 12) {
1045 sprintf(tmp_buf, "%s@%x",
1046 dp->name, high_bits);
1047 }
1048}
1049
1050static void __init sun4u_path_component(struct device_node *dp, char *tmp_buf)
1051{
1052 struct linux_prom64_registers *regs;
1053 struct property *prop;
1054
1055 prop = of_find_property(dp, "reg", NULL);
1056 if (!prop)
1057 return;
1058
1059 regs = prop->value;
1060 if (!is_root_node(dp->parent)) {
1061 sprintf(tmp_buf, "%s@%x,%x",
1062 dp->name,
1063 (unsigned int) (regs->phys_addr >> 32UL),
1064 (unsigned int) (regs->phys_addr & 0xffffffffUL));
1065 return;
1066 }
1067
1068 prop = of_find_property(dp, "upa-portid", NULL);
1069 if (!prop)
1070 prop = of_find_property(dp, "portid", NULL);
1071 if (prop) {
1072 unsigned long mask = 0xffffffffUL;
1073
1074 if (tlb_type >= cheetah)
1075 mask = 0x7fffff;
1076
1077 sprintf(tmp_buf, "%s@%x,%x",
1078 dp->name,
1079 *(u32 *)prop->value,
1080 (unsigned int) (regs->phys_addr & mask));
1081 }
1082}
1083
1084/* "name@slot,offset" */
1085static void __init sbus_path_component(struct device_node *dp, char *tmp_buf)
1086{
1087 struct linux_prom_registers *regs;
1088 struct property *prop;
1089
1090 prop = of_find_property(dp, "reg", NULL);
1091 if (!prop)
1092 return;
1093
1094 regs = prop->value;
1095 sprintf(tmp_buf, "%s@%x,%x",
1096 dp->name,
1097 regs->which_io,
1098 regs->phys_addr);
1099}
1100
1101/* "name@devnum[,func]" */
1102static void __init pci_path_component(struct device_node *dp, char *tmp_buf)
1103{
1104 struct linux_prom_pci_registers *regs;
1105 struct property *prop;
1106 unsigned int devfn;
1107
1108 prop = of_find_property(dp, "reg", NULL);
1109 if (!prop)
1110 return;
1111
1112 regs = prop->value;
1113 devfn = (regs->phys_hi >> 8) & 0xff;
1114 if (devfn & 0x07) {
1115 sprintf(tmp_buf, "%s@%x,%x",
1116 dp->name,
1117 devfn >> 3,
1118 devfn & 0x07);
1119 } else {
1120 sprintf(tmp_buf, "%s@%x",
1121 dp->name,
1122 devfn >> 3);
1123 }
1124}
1125
1126/* "name@UPA_PORTID,offset" */
1127static void __init upa_path_component(struct device_node *dp, char *tmp_buf)
1128{
1129 struct linux_prom64_registers *regs;
1130 struct property *prop;
1131
1132 prop = of_find_property(dp, "reg", NULL);
1133 if (!prop)
1134 return;
1135
1136 regs = prop->value;
1137
1138 prop = of_find_property(dp, "upa-portid", NULL);
1139 if (!prop)
1140 return;
1141
1142 sprintf(tmp_buf, "%s@%x,%x",
1143 dp->name,
1144 *(u32 *) prop->value,
1145 (unsigned int) (regs->phys_addr & 0xffffffffUL));
1146}
1147
1148/* "name@reg" */
1149static void __init vdev_path_component(struct device_node *dp, char *tmp_buf)
1150{
1151 struct property *prop;
1152 u32 *regs;
1153
1154 prop = of_find_property(dp, "reg", NULL);
1155 if (!prop)
1156 return;
1157
1158 regs = prop->value;
1159
1160 sprintf(tmp_buf, "%s@%x", dp->name, *regs);
1161}
1162
1163/* "name@addrhi,addrlo" */
1164static void __init ebus_path_component(struct device_node *dp, char *tmp_buf)
1165{
1166 struct linux_prom64_registers *regs;
1167 struct property *prop;
1168
1169 prop = of_find_property(dp, "reg", NULL);
1170 if (!prop)
1171 return;
1172
1173 regs = prop->value;
1174
1175 sprintf(tmp_buf, "%s@%x,%x",
1176 dp->name,
1177 (unsigned int) (regs->phys_addr >> 32UL),
1178 (unsigned int) (regs->phys_addr & 0xffffffffUL));
1179}
1180
1181/* "name@bus,addr" */
1182static void __init i2c_path_component(struct device_node *dp, char *tmp_buf)
1183{
1184 struct property *prop;
1185 u32 *regs;
1186
1187 prop = of_find_property(dp, "reg", NULL);
1188 if (!prop)
1189 return;
1190
1191 regs = prop->value;
1192
1193 /* This actually isn't right... should look at the #address-cells
1194 * property of the i2c bus node etc. etc.
1195 */
1196 sprintf(tmp_buf, "%s@%x,%x",
1197 dp->name, regs[0], regs[1]);
1198}
1199
1200/* "name@reg0[,reg1]" */
1201static void __init usb_path_component(struct device_node *dp, char *tmp_buf)
1202{
1203 struct property *prop;
1204 u32 *regs;
1205
1206 prop = of_find_property(dp, "reg", NULL);
1207 if (!prop)
1208 return;
1209
1210 regs = prop->value;
1211
1212 if (prop->length == sizeof(u32) || regs[1] == 1) {
1213 sprintf(tmp_buf, "%s@%x",
1214 dp->name, regs[0]);
1215 } else {
1216 sprintf(tmp_buf, "%s@%x,%x",
1217 dp->name, regs[0], regs[1]);
1218 }
1219}
1220
1221/* "name@reg0reg1[,reg2reg3]" */
1222static void __init ieee1394_path_component(struct device_node *dp, char *tmp_buf)
1223{
1224 struct property *prop;
1225 u32 *regs;
1226
1227 prop = of_find_property(dp, "reg", NULL);
1228 if (!prop)
1229 return;
1230
1231 regs = prop->value;
1232
1233 if (regs[2] || regs[3]) {
1234 sprintf(tmp_buf, "%s@%08x%08x,%04x%08x",
1235 dp->name, regs[0], regs[1], regs[2], regs[3]);
1236 } else {
1237 sprintf(tmp_buf, "%s@%08x%08x",
1238 dp->name, regs[0], regs[1]);
1239 }
1240}
1241
1242static void __init __build_path_component(struct device_node *dp, char *tmp_buf)
1243{
1244 struct device_node *parent = dp->parent;
1245
1246 if (parent != NULL) {
1247 if (!strcmp(parent->type, "pci") ||
1248 !strcmp(parent->type, "pciex")) {
1249 pci_path_component(dp, tmp_buf);
1250 return;
1251 }
1252 if (!strcmp(parent->type, "sbus")) {
1253 sbus_path_component(dp, tmp_buf);
1254 return;
1255 }
1256 if (!strcmp(parent->type, "upa")) {
1257 upa_path_component(dp, tmp_buf);
1258 return;
1259 }
1260 if (!strcmp(parent->type, "ebus")) {
1261 ebus_path_component(dp, tmp_buf);
1262 return;
1263 }
1264 if (!strcmp(parent->name, "usb") ||
1265 !strcmp(parent->name, "hub")) {
1266 usb_path_component(dp, tmp_buf);
1267 return;
1268 }
1269 if (!strcmp(parent->type, "i2c")) {
1270 i2c_path_component(dp, tmp_buf);
1271 return;
1272 }
1273 if (!strcmp(parent->type, "firewire")) {
1274 ieee1394_path_component(dp, tmp_buf);
1275 return;
1276 }
1277 if (!strcmp(parent->type, "virtual-devices")) {
1278 vdev_path_component(dp, tmp_buf);
1279 return;
1280 }
1281 /* "isa" is handled with platform naming */
1282 }
1283
1284 /* Use platform naming convention. */
1285 if (tlb_type == hypervisor) {
1286 sun4v_path_component(dp, tmp_buf);
1287 return;
1288 } else {
1289 sun4u_path_component(dp, tmp_buf);
1290 }
1291}
1292
1293static char * __init build_path_component(struct device_node *dp)
1294{
1295 char tmp_buf[64], *n;
1296
1297 tmp_buf[0] = '\0';
1298 __build_path_component(dp, tmp_buf);
1299 if (tmp_buf[0] == '\0')
1300 strcpy(tmp_buf, dp->name);
1301
1302 n = prom_early_alloc(strlen(tmp_buf) + 1);
1303 strcpy(n, tmp_buf);
1304
1305 return n;
1306}
1307
1308static char * __init build_full_name(struct device_node *dp)
1309{
1310 int len, ourlen, plen;
1311 char *n;
1312
1313 plen = strlen(dp->parent->full_name);
1314 ourlen = strlen(dp->path_component_name);
1315 len = ourlen + plen + 2;
1316
1317 n = prom_early_alloc(len);
1318 strcpy(n, dp->parent->full_name);
1319 if (!is_root_node(dp->parent)) {
1320 strcpy(n + plen, "/");
1321 plen++;
1322 }
1323 strcpy(n + plen, dp->path_component_name);
1324
1325 return n;
1326}
1327
1328static unsigned int unique_id;
1329
1330static struct property * __init build_one_prop(phandle node, char *prev, char *special_name, void *special_val, int special_len)
1331{
1332 static struct property *tmp = NULL;
1333 struct property *p;
1334
1335 if (tmp) {
1336 p = tmp;
1337 memset(p, 0, sizeof(*p) + 32);
1338 tmp = NULL;
1339 } else {
1340 p = prom_early_alloc(sizeof(struct property) + 32);
1341 p->unique_id = unique_id++;
1342 }
1343
1344 p->name = (char *) (p + 1);
1345 if (special_name) {
1346 strcpy(p->name, special_name);
1347 p->length = special_len;
1348 p->value = prom_early_alloc(special_len);
1349 memcpy(p->value, special_val, special_len);
1350 } else {
1351 if (prev == NULL) {
1352 prom_firstprop(node, p->name);
1353 } else {
1354 prom_nextprop(node, prev, p->name);
1355 }
1356 if (strlen(p->name) == 0) {
1357 tmp = p;
1358 return NULL;
1359 }
1360 p->length = prom_getproplen(node, p->name);
1361 if (p->length <= 0) {
1362 p->length = 0;
1363 } else {
1364 p->value = prom_early_alloc(p->length + 1);
1365 prom_getproperty(node, p->name, p->value, p->length);
1366 ((unsigned char *)p->value)[p->length] = '\0';
1367 }
1368 }
1369 return p;
1370}
1371
1372static struct property * __init build_prop_list(phandle node)
1373{
1374 struct property *head, *tail;
1375
1376 head = tail = build_one_prop(node, NULL,
1377 ".node", &node, sizeof(node));
1378
1379 tail->next = build_one_prop(node, NULL, NULL, NULL, 0);
1380 tail = tail->next;
1381 while(tail) {
1382 tail->next = build_one_prop(node, tail->name,
1383 NULL, NULL, 0);
1384 tail = tail->next;
1385 }
1386
1387 return head;
1388}
1389
1390static char * __init get_one_property(phandle node, const char *name)
1391{
1392 char *buf = "<NULL>";
1393 int len;
1394
1395 len = prom_getproplen(node, name);
1396 if (len > 0) {
1397 buf = prom_early_alloc(len);
1398 prom_getproperty(node, name, buf, len);
1399 }
1400
1401 return buf;
1402}
1403
1404static struct device_node * __init create_node(phandle node, struct device_node *parent)
1405{
1406 struct device_node *dp;
1407
1408 if (!node)
1409 return NULL;
1410
1411 dp = prom_early_alloc(sizeof(*dp));
1412 dp->unique_id = unique_id++;
1413 dp->parent = parent;
1414
1415 kref_init(&dp->kref);
1416
1417 dp->name = get_one_property(node, "name");
1418 dp->type = get_one_property(node, "device_type");
1419 dp->node = node;
1420
1421 dp->properties = build_prop_list(node);
1422
1423 irq_trans_init(dp);
1424
1425 return dp;
1426}
1427
1428static struct device_node * __init build_tree(struct device_node *parent, phandle node, struct device_node ***nextp)
1429{
1430 struct device_node *ret = NULL, *prev_sibling = NULL;
1431 struct device_node *dp;
1432
1433 while (1) {
1434 dp = create_node(node, parent);
1435 if (!dp)
1436 break;
1437
1438 if (prev_sibling)
1439 prev_sibling->sibling = dp;
1440
1441 if (!ret)
1442 ret = dp;
1443 prev_sibling = dp;
1444
1445 *(*nextp) = dp;
1446 *nextp = &dp->allnext;
1447
1448 dp->path_component_name = build_path_component(dp);
1449 dp->full_name = build_full_name(dp);
1450
1451 dp->child = build_tree(dp, prom_getchild(node), nextp);
1452
1453 node = prom_getsibling(node);
1454 }
1455
1456 return ret;
1457}
1458
1459static const char *get_mid_prop(void)
1460{
1461 return (tlb_type == spitfire ? "upa-portid" : "portid");
1462}
1463
1464struct device_node *of_find_node_by_cpuid(int cpuid)
1465{
1466 struct device_node *dp;
1467 const char *mid_prop = get_mid_prop();
1468
1469 for_each_node_by_type(dp, "cpu") {
1470 int id = of_getintprop_default(dp, mid_prop, -1);
1471 const char *this_mid_prop = mid_prop;
1472
1473 if (id < 0) {
1474 this_mid_prop = "cpuid";
1475 id = of_getintprop_default(dp, this_mid_prop, -1);
1476 }
1477
1478 if (id < 0) {
1479 prom_printf("OF: Serious problem, cpu lacks "
1480 "%s property", this_mid_prop);
1481 prom_halt();
1482 }
1483 if (cpuid == id)
1484 return dp;
1485 }
1486 return NULL;
1487}
1488
1489static void __init of_fill_in_cpu_data(void)
1490{
1491 struct device_node *dp;
1492 const char *mid_prop = get_mid_prop();
1493
1494 ncpus_probed = 0;
1495 for_each_node_by_type(dp, "cpu") {
1496 int cpuid = of_getintprop_default(dp, mid_prop, -1);
1497 const char *this_mid_prop = mid_prop;
1498 struct device_node *portid_parent;
1499 int portid = -1;
1500
1501 portid_parent = NULL;
1502 if (cpuid < 0) {
1503 this_mid_prop = "cpuid";
1504 cpuid = of_getintprop_default(dp, this_mid_prop, -1);
1505 if (cpuid >= 0) {
1506 int limit = 2;
1507
1508 portid_parent = dp;
1509 while (limit--) {
1510 portid_parent = portid_parent->parent;
1511 if (!portid_parent)
1512 break;
1513 portid = of_getintprop_default(portid_parent,
1514 "portid", -1);
1515 if (portid >= 0)
1516 break;
1517 }
1518 }
1519 }
1520
1521 if (cpuid < 0) {
1522 prom_printf("OF: Serious problem, cpu lacks "
1523 "%s property", this_mid_prop);
1524 prom_halt();
1525 }
1526
1527 ncpus_probed++;
1528
1529#ifdef CONFIG_SMP
1530 if (cpuid >= NR_CPUS) {
1531 printk(KERN_WARNING "Ignoring CPU %d which is "
1532 ">= NR_CPUS (%d)\n",
1533 cpuid, NR_CPUS);
1534 continue;
1535 }
1536#else
1537 /* On uniprocessor we only want the values for the
1538 * real physical cpu the kernel booted onto, however
1539 * cpu_data() only has one entry at index 0.
1540 */
1541 if (cpuid != real_hard_smp_processor_id())
1542 continue;
1543 cpuid = 0;
1544#endif
1545
1546 cpu_data(cpuid).clock_tick =
1547 of_getintprop_default(dp, "clock-frequency", 0);
1548
1549 if (portid_parent) {
1550 cpu_data(cpuid).dcache_size =
1551 of_getintprop_default(dp, "l1-dcache-size",
1552 16 * 1024);
1553 cpu_data(cpuid).dcache_line_size =
1554 of_getintprop_default(dp, "l1-dcache-line-size",
1555 32);
1556 cpu_data(cpuid).icache_size =
1557 of_getintprop_default(dp, "l1-icache-size",
1558 8 * 1024);
1559 cpu_data(cpuid).icache_line_size =
1560 of_getintprop_default(dp, "l1-icache-line-size",
1561 32);
1562 cpu_data(cpuid).ecache_size =
1563 of_getintprop_default(dp, "l2-cache-size", 0);
1564 cpu_data(cpuid).ecache_line_size =
1565 of_getintprop_default(dp, "l2-cache-line-size", 0);
1566 if (!cpu_data(cpuid).ecache_size ||
1567 !cpu_data(cpuid).ecache_line_size) {
1568 cpu_data(cpuid).ecache_size =
1569 of_getintprop_default(portid_parent,
1570 "l2-cache-size",
1571 (4 * 1024 * 1024));
1572 cpu_data(cpuid).ecache_line_size =
1573 of_getintprop_default(portid_parent,
1574 "l2-cache-line-size", 64);
1575 }
1576
1577 cpu_data(cpuid).core_id = portid + 1;
1578 cpu_data(cpuid).proc_id = portid;
1579#ifdef CONFIG_SMP
1580 sparc64_multi_core = 1;
1581#endif
1582 } else {
1583 cpu_data(cpuid).dcache_size =
1584 of_getintprop_default(dp, "dcache-size", 16 * 1024);
1585 cpu_data(cpuid).dcache_line_size =
1586 of_getintprop_default(dp, "dcache-line-size", 32);
1587
1588 cpu_data(cpuid).icache_size =
1589 of_getintprop_default(dp, "icache-size", 16 * 1024);
1590 cpu_data(cpuid).icache_line_size =
1591 of_getintprop_default(dp, "icache-line-size", 32);
1592
1593 cpu_data(cpuid).ecache_size =
1594 of_getintprop_default(dp, "ecache-size",
1595 (4 * 1024 * 1024));
1596 cpu_data(cpuid).ecache_line_size =
1597 of_getintprop_default(dp, "ecache-line-size", 64);
1598
1599 cpu_data(cpuid).core_id = 0;
1600 cpu_data(cpuid).proc_id = -1;
1601 }
1602
1603#ifdef CONFIG_SMP
1604 cpu_set(cpuid, cpu_present_map);
1605 cpu_set(cpuid, cpu_possible_map);
1606#endif
1607 }
1608
1609 smp_fill_in_sib_core_maps();
1610}
1611
1612struct device_node *of_console_device;
1613EXPORT_SYMBOL(of_console_device);
1614
1615char *of_console_path;
1616EXPORT_SYMBOL(of_console_path);
1617
1618char *of_console_options;
1619EXPORT_SYMBOL(of_console_options);
1620
1621static void __init of_console_init(void)
1622{
1623 char *msg = "OF stdout device is: %s\n";
1624 struct device_node *dp;
1625 const char *type;
1626 phandle node;
1627
1628 of_console_path = prom_early_alloc(256);
1629 if (prom_ihandle2path(prom_stdout, of_console_path, 256) < 0) {
1630 prom_printf("Cannot obtain path of stdout.\n");
1631 prom_halt();
1632 }
1633 of_console_options = strrchr(of_console_path, ':');
1634 if (of_console_options) {
1635 of_console_options++;
1636 if (*of_console_options == '\0')
1637 of_console_options = NULL;
1638 }
1639
1640 node = prom_inst2pkg(prom_stdout);
1641 if (!node) {
1642 prom_printf("Cannot resolve stdout node from "
1643 "instance %08x.\n", prom_stdout);
1644 prom_halt();
1645 }
1646
1647 dp = of_find_node_by_phandle(node);
1648 type = of_get_property(dp, "device_type", NULL);
1649 if (!type) {
1650 prom_printf("Console stdout lacks device_type property.\n");
1651 prom_halt();
1652 }
1653
1654 if (strcmp(type, "display") && strcmp(type, "serial")) {
1655 prom_printf("Console device_type is neither display "
1656 "nor serial.\n");
1657 prom_halt();
1658 }
1659
1660 of_console_device = dp;
1661
1662 printk(msg, of_console_path);
1663}
1664
1665void __init prom_build_devicetree(void)
1666{
1667 struct device_node **nextp;
1668
1669 allnodes = create_node(prom_root_node, NULL);
1670 allnodes->path_component_name = "";
1671 allnodes->full_name = "/";
1672
1673 nextp = &allnodes->allnext;
1674 allnodes->child = build_tree(allnodes,
1675 prom_getchild(allnodes->node),
1676 &nextp);
1677 of_console_init();
1678
1679 printk("PROM: Built device tree with %u bytes of memory.\n",
1680 prom_early_allocated);
1681
1682 if (tlb_type != hypervisor)
1683 of_fill_in_cpu_data();
1684}
diff --git a/arch/sparc64/kernel/psycho_common.c b/arch/sparc/kernel/psycho_common.c
index 790996428c14..790996428c14 100644
--- a/arch/sparc64/kernel/psycho_common.c
+++ b/arch/sparc/kernel/psycho_common.c
diff --git a/arch/sparc64/kernel/psycho_common.h b/arch/sparc/kernel/psycho_common.h
index 092c278ef28d..092c278ef28d 100644
--- a/arch/sparc64/kernel/psycho_common.h
+++ b/arch/sparc/kernel/psycho_common.h
diff --git a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace_32.c
index 8ce6285a06d5..8ce6285a06d5 100644
--- a/arch/sparc/kernel/ptrace.c
+++ b/arch/sparc/kernel/ptrace_32.c
diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc/kernel/ptrace_64.c
index a941c610e7ce..a941c610e7ce 100644
--- a/arch/sparc64/kernel/ptrace.c
+++ b/arch/sparc/kernel/ptrace_64.c
diff --git a/arch/sparc64/kernel/reboot.c b/arch/sparc/kernel/reboot.c
index ef89d3d69748..ef89d3d69748 100644
--- a/arch/sparc64/kernel/reboot.c
+++ b/arch/sparc/kernel/reboot.c
diff --git a/arch/sparc/kernel/rtrap.S b/arch/sparc/kernel/rtrap_32.S
index 4da2e1f66290..4da2e1f66290 100644
--- a/arch/sparc/kernel/rtrap.S
+++ b/arch/sparc/kernel/rtrap_32.S
diff --git a/arch/sparc64/kernel/rtrap.S b/arch/sparc/kernel/rtrap_64.S
index 97a993c1f7f3..fd3cee4d117c 100644
--- a/arch/sparc64/kernel/rtrap.S
+++ b/arch/sparc/kernel/rtrap_64.S
@@ -14,9 +14,9 @@
14#include <asm/visasm.h> 14#include <asm/visasm.h>
15#include <asm/processor.h> 15#include <asm/processor.h>
16 16
17#define RTRAP_PSTATE (PSTATE_RMO|PSTATE_PEF|PSTATE_PRIV|PSTATE_IE) 17#define RTRAP_PSTATE (PSTATE_TSO|PSTATE_PEF|PSTATE_PRIV|PSTATE_IE)
18#define RTRAP_PSTATE_IRQOFF (PSTATE_RMO|PSTATE_PEF|PSTATE_PRIV) 18#define RTRAP_PSTATE_IRQOFF (PSTATE_TSO|PSTATE_PEF|PSTATE_PRIV)
19#define RTRAP_PSTATE_AG_IRQOFF (PSTATE_RMO|PSTATE_PEF|PSTATE_PRIV|PSTATE_AG) 19#define RTRAP_PSTATE_AG_IRQOFF (PSTATE_TSO|PSTATE_PEF|PSTATE_PRIV|PSTATE_AG)
20 20
21 .text 21 .text
22 .align 32 22 .align 32
@@ -132,6 +132,18 @@ __handle_signal:
132 ba,pt %xcc, __handle_signal_continue 132 ba,pt %xcc, __handle_signal_continue
133 andn %l1, %l4, %l1 133 andn %l1, %l4, %l1
134 134
135 /* When returning from a NMI (%pil==15) interrupt we want to
136 * avoid running softirqs, doing IRQ tracing, preempting, etc.
137 */
138 .globl rtrap_nmi
139rtrap_nmi: ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
140 sethi %hi(0xf << 20), %l4
141 and %l1, %l4, %l4
142 andn %l1, %l4, %l1
143 srl %l4, 20, %l4
144 ba,pt %xcc, rtrap_no_irq_enable
145 wrpr %l4, %pil
146
135 .align 64 147 .align 64
136 .globl rtrap_irq, rtrap, irqsz_patchme, rtrap_xcall 148 .globl rtrap_irq, rtrap, irqsz_patchme, rtrap_xcall
137rtrap_irq: 149rtrap_irq:
@@ -161,8 +173,8 @@ rtrap_xcall:
161 call trace_hardirqs_on 173 call trace_hardirqs_on
162 nop 174 nop
163 wrpr %l4, %pil 175 wrpr %l4, %pil
164rtrap_no_irq_enable:
165#endif 176#endif
177rtrap_no_irq_enable:
166 andcc %l1, TSTATE_PRIV, %l3 178 andcc %l1, TSTATE_PRIV, %l3
167 bne,pn %icc, to_kernel 179 bne,pn %icc, to_kernel
168 nop 180 nop
diff --git a/arch/sparc64/kernel/sbus.c b/arch/sparc/kernel/sbus.c
index 2ead310066d1..2ead310066d1 100644
--- a/arch/sparc64/kernel/sbus.c
+++ b/arch/sparc/kernel/sbus.c
diff --git a/arch/sparc/kernel/setup.c b/arch/sparc/kernel/setup_32.c
index 24fe3078bd4b..c96c65d1b58b 100644
--- a/arch/sparc/kernel/setup.c
+++ b/arch/sparc/kernel/setup_32.c
@@ -46,6 +46,8 @@
46#include <asm/cpudata.h> 46#include <asm/cpudata.h>
47#include <asm/setup.h> 47#include <asm/setup.h>
48 48
49#include "kernel.h"
50
49struct screen_info screen_info = { 51struct screen_info screen_info = {
50 0, 0, /* orig-x, orig-y */ 52 0, 0, /* orig-x, orig-y */
51 0, /* unused */ 53 0, /* unused */
@@ -308,9 +310,6 @@ void __init setup_arch(char **cmdline_p)
308 smp_setup_cpu_possible_map(); 310 smp_setup_cpu_possible_map();
309} 311}
310 312
311extern char *sparc_cpu_type;
312extern char *sparc_fpu_type;
313
314static int ncpus_probed; 313static int ncpus_probed;
315 314
316static int show_cpuinfo(struct seq_file *m, void *__unused) 315static int show_cpuinfo(struct seq_file *m, void *__unused)
@@ -328,8 +327,8 @@ static int show_cpuinfo(struct seq_file *m, void *__unused)
328 "CPU0ClkTck\t: %ld\n" 327 "CPU0ClkTck\t: %ld\n"
329#endif 328#endif
330 , 329 ,
331 sparc_cpu_type ? sparc_cpu_type : "undetermined", 330 sparc_cpu_type,
332 sparc_fpu_type ? sparc_fpu_type : "undetermined", 331 sparc_fpu_type ,
333 romvec->pv_romvers, 332 romvec->pv_romvers,
334 prom_rev, 333 prom_rev,
335 romvec->pv_printrev >> 16, 334 romvec->pv_printrev >> 16,
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc/kernel/setup_64.c
index c8b03a4f68bf..555db7452ebe 100644
--- a/arch/sparc64/kernel/setup.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -52,6 +52,7 @@
52#endif 52#endif
53 53
54#include "entry.h" 54#include "entry.h"
55#include "kernel.h"
55 56
56/* Used to synchronize accesses to NatSemi SUPER I/O chip configure 57/* Used to synchronize accesses to NatSemi SUPER I/O chip configure
57 * operations in asm/ns87303.h 58 * operations in asm/ns87303.h
diff --git a/arch/sparc64/kernel/signal32.c b/arch/sparc/kernel/signal32.c
index ba5b09ad6666..ba5b09ad6666 100644
--- a/arch/sparc64/kernel/signal32.c
+++ b/arch/sparc/kernel/signal32.c
diff --git a/arch/sparc/kernel/signal.c b/arch/sparc/kernel/signal_32.c
index c94f91c8b6e0..181d069a2d44 100644
--- a/arch/sparc/kernel/signal.c
+++ b/arch/sparc/kernel/signal_32.c
@@ -34,7 +34,7 @@ extern void fpload(unsigned long *fpregs, unsigned long *fsr);
34 34
35struct signal_frame { 35struct signal_frame {
36 struct sparc_stackf ss; 36 struct sparc_stackf ss;
37 __siginfo_t info; 37 __siginfo32_t info;
38 __siginfo_fpu_t __user *fpu_save; 38 __siginfo_fpu_t __user *fpu_save;
39 unsigned long insns[2] __attribute__ ((aligned (8))); 39 unsigned long insns[2] __attribute__ ((aligned (8)));
40 unsigned int extramask[_NSIG_WORDS - 1]; 40 unsigned int extramask[_NSIG_WORDS - 1];
@@ -351,7 +351,7 @@ static void setup_frame(struct k_sigaction *ka, struct pt_regs *regs,
351 err |= __copy_to_user(sf->extramask, &oldset->sig[1], 351 err |= __copy_to_user(sf->extramask, &oldset->sig[1],
352 (_NSIG_WORDS - 1) * sizeof(unsigned int)); 352 (_NSIG_WORDS - 1) * sizeof(unsigned int));
353 err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP], 353 err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP],
354 sizeof(struct reg_window)); 354 sizeof(struct reg_window32));
355 if (err) 355 if (err)
356 goto sigsegv; 356 goto sigsegv;
357 357
@@ -433,7 +433,7 @@ static void setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
433 err |= __put_user(current->sas_ss_size, &sf->stack.ss_size); 433 err |= __put_user(current->sas_ss_size, &sf->stack.ss_size);
434 434
435 err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP], 435 err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP],
436 sizeof(struct reg_window)); 436 sizeof(struct reg_window32));
437 437
438 err |= copy_siginfo_to_user(&sf->info, info); 438 err |= copy_siginfo_to_user(&sf->info, info);
439 439
diff --git a/arch/sparc64/kernel/signal.c b/arch/sparc/kernel/signal_64.c
index ec82d76dc6f2..ec82d76dc6f2 100644
--- a/arch/sparc64/kernel/signal.c
+++ b/arch/sparc/kernel/signal_64.c
diff --git a/arch/sparc/kernel/smp.c b/arch/sparc/kernel/smp_32.c
index e396c1f17a92..1e5ac4e282e1 100644
--- a/arch/sparc/kernel/smp.c
+++ b/arch/sparc/kernel/smp_32.c
@@ -39,8 +39,6 @@ volatile unsigned long cpu_callin_map[NR_CPUS] __cpuinitdata = {0,};
39unsigned char boot_cpu_id = 0; 39unsigned char boot_cpu_id = 0;
40unsigned char boot_cpu_id4 = 0; /* boot_cpu_id << 2 */ 40unsigned char boot_cpu_id4 = 0; /* boot_cpu_id << 2 */
41 41
42cpumask_t cpu_online_map = CPU_MASK_NONE;
43cpumask_t phys_cpu_present_map = CPU_MASK_NONE;
44cpumask_t smp_commenced_mask = CPU_MASK_NONE; 42cpumask_t smp_commenced_mask = CPU_MASK_NONE;
45 43
46/* The only guaranteed locking primitive available on all Sparc 44/* The only guaranteed locking primitive available on all Sparc
@@ -334,7 +332,7 @@ void __init smp_setup_cpu_possible_map(void)
334 instance = 0; 332 instance = 0;
335 while (!cpu_find_by_instance(instance, NULL, &mid)) { 333 while (!cpu_find_by_instance(instance, NULL, &mid)) {
336 if (mid < NR_CPUS) { 334 if (mid < NR_CPUS) {
337 cpu_set(mid, phys_cpu_present_map); 335 cpu_set(mid, cpu_possible_map);
338 cpu_set(mid, cpu_present_map); 336 cpu_set(mid, cpu_present_map);
339 } 337 }
340 instance++; 338 instance++;
@@ -354,7 +352,7 @@ void __init smp_prepare_boot_cpu(void)
354 352
355 current_thread_info()->cpu = cpuid; 353 current_thread_info()->cpu = cpuid;
356 cpu_set(cpuid, cpu_online_map); 354 cpu_set(cpuid, cpu_online_map);
357 cpu_set(cpuid, phys_cpu_present_map); 355 cpu_set(cpuid, cpu_possible_map);
358} 356}
359 357
360int __cpuinit __cpu_up(unsigned int cpu) 358int __cpuinit __cpu_up(unsigned int cpu)
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc/kernel/smp_64.c
index f500b0618bb0..46329799f346 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -49,14 +49,10 @@
49 49
50int sparc64_multi_core __read_mostly; 50int sparc64_multi_core __read_mostly;
51 51
52cpumask_t cpu_possible_map __read_mostly = CPU_MASK_NONE;
53cpumask_t cpu_online_map __read_mostly = CPU_MASK_NONE;
54DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE; 52DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE;
55cpumask_t cpu_core_map[NR_CPUS] __read_mostly = 53cpumask_t cpu_core_map[NR_CPUS] __read_mostly =
56 { [0 ... NR_CPUS-1] = CPU_MASK_NONE }; 54 { [0 ... NR_CPUS-1] = CPU_MASK_NONE };
57 55
58EXPORT_SYMBOL(cpu_possible_map);
59EXPORT_SYMBOL(cpu_online_map);
60EXPORT_PER_CPU_SYMBOL(cpu_sibling_map); 56EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
61EXPORT_SYMBOL(cpu_core_map); 57EXPORT_SYMBOL(cpu_core_map);
62 58
@@ -163,7 +159,7 @@ static inline long get_delta (long *rt, long *master)
163 for (i = 0; i < NUM_ITERS; i++) { 159 for (i = 0; i < NUM_ITERS; i++) {
164 t0 = tick_ops->get_tick(); 160 t0 = tick_ops->get_tick();
165 go[MASTER] = 1; 161 go[MASTER] = 1;
166 membar_storeload(); 162 membar_safe("#StoreLoad");
167 while (!(tm = go[SLAVE])) 163 while (!(tm = go[SLAVE]))
168 rmb(); 164 rmb();
169 go[SLAVE] = 0; 165 go[SLAVE] = 0;
@@ -257,7 +253,7 @@ static void smp_synchronize_one_tick(int cpu)
257 253
258 /* now let the client proceed into his loop */ 254 /* now let the client proceed into his loop */
259 go[MASTER] = 0; 255 go[MASTER] = 0;
260 membar_storeload(); 256 membar_safe("#StoreLoad");
261 257
262 spin_lock_irqsave(&itc_sync_lock, flags); 258 spin_lock_irqsave(&itc_sync_lock, flags);
263 { 259 {
@@ -267,7 +263,7 @@ static void smp_synchronize_one_tick(int cpu)
267 go[MASTER] = 0; 263 go[MASTER] = 0;
268 wmb(); 264 wmb();
269 go[SLAVE] = tick_ops->get_tick(); 265 go[SLAVE] = tick_ops->get_tick();
270 membar_storeload(); 266 membar_safe("#StoreLoad");
271 } 267 }
272 } 268 }
273 spin_unlock_irqrestore(&itc_sync_lock, flags); 269 spin_unlock_irqrestore(&itc_sync_lock, flags);
@@ -773,7 +769,7 @@ static void xcall_deliver(u64 data0, u64 data1, u64 data2, const cpumask_t *mask
773 769
774 /* Setup the initial cpu list. */ 770 /* Setup the initial cpu list. */
775 cnt = 0; 771 cnt = 0;
776 for_each_cpu_mask_nr(i, *mask) { 772 for_each_cpu(i, mask) {
777 if (i == this_cpu || !cpu_online(i)) 773 if (i == this_cpu || !cpu_online(i))
778 continue; 774 continue;
779 cpu_list[cnt++] = i; 775 cpu_list[cnt++] = i;
@@ -1122,7 +1118,6 @@ void smp_capture(void)
1122 smp_processor_id()); 1118 smp_processor_id());
1123#endif 1119#endif
1124 penguins_are_doing_time = 1; 1120 penguins_are_doing_time = 1;
1125 membar_storestore_loadstore();
1126 atomic_inc(&smp_capture_registry); 1121 atomic_inc(&smp_capture_registry);
1127 smp_cross_call(&xcall_capture, 0, 0, 0); 1122 smp_cross_call(&xcall_capture, 0, 0, 0);
1128 while (atomic_read(&smp_capture_registry) != ncpus) 1123 while (atomic_read(&smp_capture_registry) != ncpus)
@@ -1142,13 +1137,13 @@ void smp_release(void)
1142 smp_processor_id()); 1137 smp_processor_id());
1143#endif 1138#endif
1144 penguins_are_doing_time = 0; 1139 penguins_are_doing_time = 0;
1145 membar_storeload_storestore(); 1140 membar_safe("#StoreLoad");
1146 atomic_dec(&smp_capture_registry); 1141 atomic_dec(&smp_capture_registry);
1147 } 1142 }
1148} 1143}
1149 1144
1150/* Imprisoned penguins run with %pil == 15, but PSTATE_IE set, so they 1145/* Imprisoned penguins run with %pil == PIL_NORMAL_MAX, but PSTATE_IE
1151 * can service tlb flush xcalls... 1146 * set, so they can service tlb flush xcalls...
1152 */ 1147 */
1153extern void prom_world(int); 1148extern void prom_world(int);
1154 1149
@@ -1161,7 +1156,7 @@ void smp_penguin_jailcell(int irq, struct pt_regs *regs)
1161 __asm__ __volatile__("flushw"); 1156 __asm__ __volatile__("flushw");
1162 prom_world(1); 1157 prom_world(1);
1163 atomic_inc(&smp_capture_registry); 1158 atomic_inc(&smp_capture_registry);
1164 membar_storeload_storestore(); 1159 membar_safe("#StoreLoad");
1165 while (penguins_are_doing_time) 1160 while (penguins_are_doing_time)
1166 rmb(); 1161 rmb();
1167 atomic_dec(&smp_capture_registry); 1162 atomic_dec(&smp_capture_registry);
diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms_32.c
index b0dfff848653..e1e97639231b 100644
--- a/arch/sparc/kernel/sparc_ksyms.c
+++ b/arch/sparc/kernel/sparc_ksyms_32.c
@@ -61,7 +61,6 @@ extern void (*bzero_1page)(void *);
61extern void *__bzero(void *, size_t); 61extern void *__bzero(void *, size_t);
62extern void *__memscan_zero(void *, size_t); 62extern void *__memscan_zero(void *, size_t);
63extern void *__memscan_generic(void *, int, size_t); 63extern void *__memscan_generic(void *, int, size_t);
64extern int __memcmp(const void *, const void *, __kernel_size_t);
65extern int __strncmp(const char *, const char *, __kernel_size_t); 64extern int __strncmp(const char *, const char *, __kernel_size_t);
66 65
67extern int __ashrdi3(int, int); 66extern int __ashrdi3(int, int);
@@ -113,19 +112,13 @@ EXPORT_PER_CPU_SYMBOL(__cpu_data);
113#ifdef CONFIG_SMP 112#ifdef CONFIG_SMP
114/* IRQ implementation. */ 113/* IRQ implementation. */
115EXPORT_SYMBOL(synchronize_irq); 114EXPORT_SYMBOL(synchronize_irq);
116
117/* CPU online map and active count. */
118EXPORT_SYMBOL(cpu_online_map);
119EXPORT_SYMBOL(phys_cpu_present_map);
120#endif 115#endif
121 116
122EXPORT_SYMBOL(__udelay); 117EXPORT_SYMBOL(__udelay);
123EXPORT_SYMBOL(__ndelay); 118EXPORT_SYMBOL(__ndelay);
124EXPORT_SYMBOL(rtc_lock); 119EXPORT_SYMBOL(rtc_lock);
125#ifdef CONFIG_SUN_AUXIO
126EXPORT_SYMBOL(set_auxio); 120EXPORT_SYMBOL(set_auxio);
127EXPORT_SYMBOL(get_auxio); 121EXPORT_SYMBOL(get_auxio);
128#endif
129EXPORT_SYMBOL(io_remap_pfn_range); 122EXPORT_SYMBOL(io_remap_pfn_range);
130 123
131#ifndef CONFIG_SMP 124#ifndef CONFIG_SMP
@@ -213,7 +206,6 @@ EXPORT_SYMBOL(bzero_1page);
213EXPORT_SYMBOL(__bzero); 206EXPORT_SYMBOL(__bzero);
214EXPORT_SYMBOL(__memscan_zero); 207EXPORT_SYMBOL(__memscan_zero);
215EXPORT_SYMBOL(__memscan_generic); 208EXPORT_SYMBOL(__memscan_generic);
216EXPORT_SYMBOL(__memcmp);
217EXPORT_SYMBOL(__strncmp); 209EXPORT_SYMBOL(__strncmp);
218EXPORT_SYMBOL(__memmove); 210EXPORT_SYMBOL(__memmove);
219 211
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc/kernel/sparc_ksyms_64.c
index 30bba8b0a3b0..0133211ab634 100644
--- a/arch/sparc64/kernel/sparc64_ksyms.c
+++ b/arch/sparc/kernel/sparc_ksyms_64.c
@@ -49,6 +49,7 @@
49#include <asm/timer.h> 49#include <asm/timer.h>
50#include <asm/cpudata.h> 50#include <asm/cpudata.h>
51#include <asm/ftrace.h> 51#include <asm/ftrace.h>
52#include <asm/hypervisor.h>
52 53
53struct poll { 54struct poll {
54 int fd; 55 int fd;
@@ -61,7 +62,6 @@ extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
61extern void *__bzero(void *, size_t); 62extern void *__bzero(void *, size_t);
62extern void *__memscan_zero(void *, size_t); 63extern void *__memscan_zero(void *, size_t);
63extern void *__memscan_generic(void *, int, size_t); 64extern void *__memscan_generic(void *, int, size_t);
64extern int __memcmp(const void *, const void *, __kernel_size_t);
65extern __kernel_size_t strlen(const char *); 65extern __kernel_size_t strlen(const char *);
66extern void sys_sigsuspend(void); 66extern void sys_sigsuspend(void);
67extern int compat_sys_ioctl(unsigned int fd, unsigned int cmd, u32 arg); 67extern int compat_sys_ioctl(unsigned int fd, unsigned int cmd, u32 arg);
@@ -148,10 +148,13 @@ EXPORT_SYMBOL(flush_dcache_page);
148EXPORT_SYMBOL(__flush_dcache_range); 148EXPORT_SYMBOL(__flush_dcache_range);
149#endif 149#endif
150 150
151#ifdef CONFIG_SUN_AUXIO 151EXPORT_SYMBOL(sun4v_niagara_getperf);
152EXPORT_SYMBOL(sun4v_niagara_setperf);
153EXPORT_SYMBOL(sun4v_niagara2_getperf);
154EXPORT_SYMBOL(sun4v_niagara2_setperf);
155
152EXPORT_SYMBOL(auxio_set_led); 156EXPORT_SYMBOL(auxio_set_led);
153EXPORT_SYMBOL(auxio_set_lte); 157EXPORT_SYMBOL(auxio_set_lte);
154#endif
155#ifdef CONFIG_SBUS 158#ifdef CONFIG_SBUS
156EXPORT_SYMBOL(sbus_set_sbus64); 159EXPORT_SYMBOL(sbus_set_sbus64);
157#endif 160#endif
@@ -177,7 +180,6 @@ EXPORT_SYMBOL(pci_dma_supported);
177EXPORT_SYMBOL(io_remap_pfn_range); 180EXPORT_SYMBOL(io_remap_pfn_range);
178 181
179EXPORT_SYMBOL(dump_fpu); 182EXPORT_SYMBOL(dump_fpu);
180EXPORT_SYMBOL(put_fs_struct);
181 183
182/* math-emu wants this */ 184/* math-emu wants this */
183EXPORT_SYMBOL(die_if_kernel); 185EXPORT_SYMBOL(die_if_kernel);
@@ -219,7 +221,6 @@ EXPORT_SYMBOL(copy_user_page);
219EXPORT_SYMBOL(__bzero); 221EXPORT_SYMBOL(__bzero);
220EXPORT_SYMBOL(__memscan_zero); 222EXPORT_SYMBOL(__memscan_zero);
221EXPORT_SYMBOL(__memscan_generic); 223EXPORT_SYMBOL(__memscan_generic);
222EXPORT_SYMBOL(__memcmp);
223EXPORT_SYMBOL(__memset); 224EXPORT_SYMBOL(__memset);
224 225
225EXPORT_SYMBOL(csum_partial); 226EXPORT_SYMBOL(csum_partial);
diff --git a/arch/sparc64/kernel/spiterrs.S b/arch/sparc/kernel/spiterrs.S
index ef902c6f8e3c..c357e40ffd01 100644
--- a/arch/sparc64/kernel/spiterrs.S
+++ b/arch/sparc/kernel/spiterrs.S
@@ -80,7 +80,7 @@ __spitfire_cee_trap_continue:
80 cmp %g2, 1 80 cmp %g2, 1
81 rdpr %pil, %g2 81 rdpr %pil, %g2
82 bleu,pt %xcc, 1f 82 bleu,pt %xcc, 1f
83 wrpr %g0, 15, %pil 83 wrpr %g0, PIL_NORMAL_MAX, %pil
84 84
85 ba,pt %xcc, etraptl1 85 ba,pt %xcc, etraptl1
86 rd %pc, %g7 86 rd %pc, %g7
diff --git a/arch/sparc64/kernel/sstate.c b/arch/sparc/kernel/sstate.c
index 8cdbe5946b43..8cdbe5946b43 100644
--- a/arch/sparc64/kernel/sstate.c
+++ b/arch/sparc/kernel/sstate.c
diff --git a/arch/sparc64/kernel/stacktrace.c b/arch/sparc/kernel/stacktrace.c
index 4e21d4a57d3b..acb12f673757 100644
--- a/arch/sparc64/kernel/stacktrace.c
+++ b/arch/sparc/kernel/stacktrace.c
@@ -7,17 +7,18 @@
7 7
8#include "kstack.h" 8#include "kstack.h"
9 9
10void save_stack_trace(struct stack_trace *trace) 10static void __save_stack_trace(struct thread_info *tp,
11 struct stack_trace *trace,
12 bool skip_sched)
11{ 13{
12 struct thread_info *tp = task_thread_info(current);
13 unsigned long ksp, fp; 14 unsigned long ksp, fp;
14 15
15 stack_trace_flush(); 16 if (tp == current_thread_info()) {
16 17 stack_trace_flush();
17 __asm__ __volatile__( 18 __asm__ __volatile__("mov %%fp, %0" : "=r" (ksp));
18 "mov %%fp, %0" 19 } else {
19 : "=r" (ksp) 20 ksp = tp->ksp;
20 ); 21 }
21 22
22 fp = ksp + STACK_BIAS; 23 fp = ksp + STACK_BIAS;
23 do { 24 do {
@@ -43,8 +44,21 @@ void save_stack_trace(struct stack_trace *trace)
43 44
44 if (trace->skip > 0) 45 if (trace->skip > 0)
45 trace->skip--; 46 trace->skip--;
46 else 47 else if (!skip_sched || !in_sched_functions(pc))
47 trace->entries[trace->nr_entries++] = pc; 48 trace->entries[trace->nr_entries++] = pc;
48 } while (trace->nr_entries < trace->max_entries); 49 } while (trace->nr_entries < trace->max_entries);
49} 50}
51
52void save_stack_trace(struct stack_trace *trace)
53{
54 __save_stack_trace(current_thread_info(), trace, false);
55}
50EXPORT_SYMBOL_GPL(save_stack_trace); 56EXPORT_SYMBOL_GPL(save_stack_trace);
57
58void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
59{
60 struct thread_info *tp = task_thread_info(tsk);
61
62 __save_stack_trace(tp, trace, true);
63}
64EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
diff --git a/arch/sparc64/kernel/starfire.c b/arch/sparc/kernel/starfire.c
index 060d0f3a6151..060d0f3a6151 100644
--- a/arch/sparc64/kernel/starfire.c
+++ b/arch/sparc/kernel/starfire.c
diff --git a/arch/sparc/kernel/sun4c_irq.c b/arch/sparc/kernel/sun4c_irq.c
index 5dc8a5769489..bc3adbf79c6a 100644
--- a/arch/sparc/kernel/sun4c_irq.c
+++ b/arch/sparc/kernel/sun4c_irq.c
@@ -160,6 +160,7 @@ static void __init sun4c_init_timers(irq_handler_t counter_fn)
160 sun4c_timers = (void __iomem *) (unsigned long) addr[0]; 160 sun4c_timers = (void __iomem *) (unsigned long) addr[0];
161 161
162 irq = of_get_property(dp, "intr", NULL); 162 irq = of_get_property(dp, "intr", NULL);
163 of_node_put(dp);
163 if (!irq) { 164 if (!irq) {
164 prom_printf("sun4c_init_timers: No intr property\n"); 165 prom_printf("sun4c_init_timers: No intr property\n");
165 prom_halt(); 166 prom_halt();
@@ -200,6 +201,7 @@ void __init sun4c_init_IRQ(void)
200 } 201 }
201 202
202 addr = of_get_property(dp, "address", NULL); 203 addr = of_get_property(dp, "address", NULL);
204 of_node_put(dp);
203 if (!addr) { 205 if (!addr) {
204 prom_printf("sun4c_init_IRQ: No address property\n"); 206 prom_printf("sun4c_init_IRQ: No address property\n");
205 prom_halt(); 207 prom_halt();
diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c
index d3cb76ce418b..3369fef5b4b3 100644
--- a/arch/sparc/kernel/sun4d_irq.c
+++ b/arch/sparc/kernel/sun4d_irq.c
@@ -40,6 +40,7 @@
40#include <asm/cacheflush.h> 40#include <asm/cacheflush.h>
41#include <asm/irq_regs.h> 41#include <asm/irq_regs.h>
42 42
43#include "kernel.h"
43#include "irq.h" 44#include "irq.h"
44 45
45/* If you trust current SCSI layer to handle different SCSI IRQs, enable this. I don't trust it... -jj */ 46/* If you trust current SCSI layer to handle different SCSI IRQs, enable this. I don't trust it... -jj */
@@ -58,7 +59,6 @@ static struct sun4d_timer_regs __iomem *sun4d_timers;
58#define TIMER_IRQ 10 59#define TIMER_IRQ 10
59 60
60#define MAX_STATIC_ALLOC 4 61#define MAX_STATIC_ALLOC 4
61extern struct irqaction static_irqaction[MAX_STATIC_ALLOC];
62extern int static_irq_count; 62extern int static_irq_count;
63static unsigned char sbus_tid[32]; 63static unsigned char sbus_tid[32];
64 64
@@ -508,6 +508,7 @@ static void __init sun4d_init_timers(irq_handler_t counter_fn)
508 * bootbus. 508 * bootbus.
509 */ 509 */
510 reg = of_get_property(dp, "reg", NULL); 510 reg = of_get_property(dp, "reg", NULL);
511 of_node_put(dp);
511 if (!reg) { 512 if (!reg) {
512 prom_printf("sun4d_init_timers: No reg property\n"); 513 prom_printf("sun4d_init_timers: No reg property\n");
513 prom_halt(); 514 prom_halt();
diff --git a/arch/sparc/kernel/sun4m_irq.c b/arch/sparc/kernel/sun4m_irq.c
index f10317179ee6..301892e2d718 100644
--- a/arch/sparc/kernel/sun4m_irq.c
+++ b/arch/sparc/kernel/sun4m_irq.c
@@ -374,6 +374,7 @@ static void __init sun4m_init_timers(irq_handler_t counter_fn)
374 } 374 }
375 375
376 addr = of_get_property(dp, "address", &len); 376 addr = of_get_property(dp, "address", &len);
377 of_node_put(dp);
377 if (!addr) { 378 if (!addr) {
378 printk(KERN_ERR "sun4m_init_timers: No 'address' prop.\n"); 379 printk(KERN_ERR "sun4m_init_timers: No 'address' prop.\n");
379 return; 380 return;
@@ -437,6 +438,7 @@ void __init sun4m_init_IRQ(void)
437 } 438 }
438 439
439 addr = of_get_property(dp, "address", &len); 440 addr = of_get_property(dp, "address", &len);
441 of_node_put(dp);
440 if (!addr) { 442 if (!addr) {
441 printk(KERN_ERR "sun4m_init_IRQ: No 'address' prop.\n"); 443 printk(KERN_ERR "sun4m_init_IRQ: No 'address' prop.\n");
442 return; 444 return;
diff --git a/arch/sparc64/kernel/sun4v_ivec.S b/arch/sparc/kernel/sun4v_ivec.S
index e2f8e1b4882a..559bc5e9c199 100644
--- a/arch/sparc64/kernel/sun4v_ivec.S
+++ b/arch/sparc/kernel/sun4v_ivec.S
@@ -186,7 +186,7 @@ sun4v_res_mondo:
186 * when it's done. 186 * when it's done.
187 */ 187 */
188 rdpr %pil, %g2 188 rdpr %pil, %g2
189 wrpr %g0, 15, %pil 189 wrpr %g0, PIL_NORMAL_MAX, %pil
190 mov %g1, %g4 190 mov %g1, %g4
191 ba,pt %xcc, etrap_irq 191 ba,pt %xcc, etrap_irq
192 rd %pc, %g7 192 rd %pc, %g7
@@ -216,7 +216,7 @@ sun4v_res_mondo_queue_full:
216 membar #Sync 216 membar #Sync
217 217
218 rdpr %pil, %g2 218 rdpr %pil, %g2
219 wrpr %g0, 15, %pil 219 wrpr %g0, PIL_NORMAL_MAX, %pil
220 ba,pt %xcc, etrap_irq 220 ba,pt %xcc, etrap_irq
221 rd %pc, %g7 221 rd %pc, %g7
222#ifdef CONFIG_TRACE_IRQFLAGS 222#ifdef CONFIG_TRACE_IRQFLAGS
@@ -297,7 +297,7 @@ sun4v_nonres_mondo:
297 * when it's done. 297 * when it's done.
298 */ 298 */
299 rdpr %pil, %g2 299 rdpr %pil, %g2
300 wrpr %g0, 15, %pil 300 wrpr %g0, PIL_NORMAL_MAX, %pil
301 mov %g1, %g4 301 mov %g1, %g4
302 ba,pt %xcc, etrap_irq 302 ba,pt %xcc, etrap_irq
303 rd %pc, %g7 303 rd %pc, %g7
@@ -327,7 +327,7 @@ sun4v_nonres_mondo_queue_full:
327 membar #Sync 327 membar #Sync
328 328
329 rdpr %pil, %g2 329 rdpr %pil, %g2
330 wrpr %g0, 15, %pil 330 wrpr %g0, PIL_NORMAL_MAX, %pil
331 ba,pt %xcc, etrap_irq 331 ba,pt %xcc, etrap_irq
332 rd %pc, %g7 332 rd %pc, %g7
333#ifdef CONFIG_TRACE_IRQFLAGS 333#ifdef CONFIG_TRACE_IRQFLAGS
diff --git a/arch/sparc64/kernel/sun4v_tlb_miss.S b/arch/sparc/kernel/sun4v_tlb_miss.S
index e1fbf8c75787..e1fbf8c75787 100644
--- a/arch/sparc64/kernel/sun4v_tlb_miss.S
+++ b/arch/sparc/kernel/sun4v_tlb_miss.S
diff --git a/arch/sparc64/kernel/sys32.S b/arch/sparc/kernel/sys32.S
index f061c4dda9ef..f061c4dda9ef 100644
--- a/arch/sparc64/kernel/sys32.S
+++ b/arch/sparc/kernel/sys32.S
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c
index e800503879e4..e800503879e4 100644
--- a/arch/sparc64/kernel/sys_sparc32.c
+++ b/arch/sparc/kernel/sys_sparc32.c
diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc_32.c
index 03035c852a43..03035c852a43 100644
--- a/arch/sparc/kernel/sys_sparc.c
+++ b/arch/sparc/kernel/sys_sparc_32.c
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc_64.c
index 39749e32dc7e..39749e32dc7e 100644
--- a/arch/sparc64/kernel/sys_sparc.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
diff --git a/arch/sparc64/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S
index 7a6786a71363..7a6786a71363 100644
--- a/arch/sparc64/kernel/syscalls.S
+++ b/arch/sparc/kernel/syscalls.S
diff --git a/arch/sparc64/kernel/sysfs.c b/arch/sparc/kernel/sysfs.c
index 84e5ce146713..d28f496f4669 100644
--- a/arch/sparc64/kernel/sysfs.c
+++ b/arch/sparc/kernel/sysfs.c
@@ -8,6 +8,7 @@
8#include <linux/percpu.h> 8#include <linux/percpu.h>
9#include <linux/init.h> 9#include <linux/init.h>
10 10
11#include <asm/cpudata.h>
11#include <asm/hypervisor.h> 12#include <asm/hypervisor.h>
12#include <asm/spitfire.h> 13#include <asm/spitfire.h>
13 14
diff --git a/arch/sparc64/kernel/systbls.h b/arch/sparc/kernel/systbls.h
index bc9f5dac4069..bc9f5dac4069 100644
--- a/arch/sparc64/kernel/systbls.h
+++ b/arch/sparc/kernel/systbls.h
diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls_32.S
index 7d0807586442..7d0807586442 100644
--- a/arch/sparc/kernel/systbls.S
+++ b/arch/sparc/kernel/systbls_32.S
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc/kernel/systbls_64.S
index 9fc78cf354bd..9fc78cf354bd 100644
--- a/arch/sparc64/kernel/systbls.S
+++ b/arch/sparc/kernel/systbls_64.S
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time_32.c
index 00f7383c7657..00f7383c7657 100644
--- a/arch/sparc/kernel/time.c
+++ b/arch/sparc/kernel/time_32.c
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc/kernel/time_64.c
index 141da3759091..9df8f095a8b1 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc/kernel/time_64.c
@@ -763,7 +763,7 @@ void __devinit setup_sparc64_timer(void)
763 sevt = &__get_cpu_var(sparc64_events); 763 sevt = &__get_cpu_var(sparc64_events);
764 764
765 memcpy(sevt, &sparc64_clockevent, sizeof(*sevt)); 765 memcpy(sevt, &sparc64_clockevent, sizeof(*sevt));
766 sevt->cpumask = cpumask_of_cpu(smp_processor_id()); 766 sevt->cpumask = cpumask_of(smp_processor_id());
767 767
768 clockevents_register_device(sevt); 768 clockevents_register_device(sevt);
769} 769}
diff --git a/arch/sparc/kernel/trampoline.S b/arch/sparc/kernel/trampoline_32.S
index 5e235c52d667..5e235c52d667 100644
--- a/arch/sparc/kernel/trampoline.S
+++ b/arch/sparc/kernel/trampoline_32.S
diff --git a/arch/sparc64/kernel/trampoline.S b/arch/sparc/kernel/trampoline_64.S
index 83abd5ae88a4..da1b781b5e65 100644
--- a/arch/sparc64/kernel/trampoline.S
+++ b/arch/sparc/kernel/trampoline_64.S
@@ -109,7 +109,6 @@ startup_continue:
109 */ 109 */
110 sethi %hi(prom_entry_lock), %g2 110 sethi %hi(prom_entry_lock), %g2
1111: ldstub [%g2 + %lo(prom_entry_lock)], %g1 1111: ldstub [%g2 + %lo(prom_entry_lock)], %g1
112 membar #StoreLoad | #StoreStore
113 brnz,pn %g1, 1b 112 brnz,pn %g1, 1b
114 nop 113 nop
115 114
@@ -214,7 +213,6 @@ startup_continue:
214 213
215 sethi %hi(prom_entry_lock), %g2 214 sethi %hi(prom_entry_lock), %g2
216 stb %g0, [%g2 + %lo(prom_entry_lock)] 215 stb %g0, [%g2 + %lo(prom_entry_lock)]
217 membar #StoreStore | #StoreLoad
218 216
219 ba,pt %xcc, after_lock_tlb 217 ba,pt %xcc, after_lock_tlb
220 nop 218 nop
@@ -330,7 +328,6 @@ after_lock_tlb:
330 328
331 sethi %hi(prom_entry_lock), %g2 329 sethi %hi(prom_entry_lock), %g2
3321: ldstub [%g2 + %lo(prom_entry_lock)], %g1 3301: ldstub [%g2 + %lo(prom_entry_lock)], %g1
333 membar #StoreLoad | #StoreStore
334 brnz,pn %g1, 1b 331 brnz,pn %g1, 1b
335 nop 332 nop
336 333
@@ -394,7 +391,6 @@ after_lock_tlb:
394 391
3953: sethi %hi(prom_entry_lock), %g2 3923: sethi %hi(prom_entry_lock), %g2
396 stb %g0, [%g2 + %lo(prom_entry_lock)] 393 stb %g0, [%g2 + %lo(prom_entry_lock)]
397 membar #StoreStore | #StoreLoad
398 394
399 ldx [%l0], %g6 395 ldx [%l0], %g6
400 ldx [%g6 + TI_TASK], %g4 396 ldx [%g6 + TI_TASK], %g4
diff --git a/arch/sparc/kernel/traps.c b/arch/sparc/kernel/traps_32.c
index 2b7d50659036..213645be6e92 100644
--- a/arch/sparc/kernel/traps.c
+++ b/arch/sparc/kernel/traps_32.c
@@ -25,31 +25,10 @@
25#include <asm/unistd.h> 25#include <asm/unistd.h>
26#include <asm/traps.h> 26#include <asm/traps.h>
27 27
28/* #define TRAP_DEBUG */ 28#include "entry.h"
29 29#include "kernel.h"
30struct trap_trace_entry {
31 unsigned long pc;
32 unsigned long type;
33};
34
35void syscall_trace_entry(struct pt_regs *regs)
36{
37 printk("%s[%d]: ", current->comm, task_pid_nr(current));
38 printk("scall<%d> (could be %d)\n", (int) regs->u_regs[UREG_G1],
39 (int) regs->u_regs[UREG_I0]);
40}
41
42void syscall_trace_exit(struct pt_regs *regs)
43{
44}
45 30
46void sun4d_nmi(struct pt_regs *regs) 31/* #define TRAP_DEBUG */
47{
48 printk("Aieee: sun4d NMI received!\n");
49 printk("you lose buddy boy...\n");
50 show_regs(regs);
51 prom_halt();
52}
53 32
54static void instruction_dump(unsigned long *pc) 33static void instruction_dump(unsigned long *pc)
55{ 34{
@@ -88,7 +67,7 @@ void die_if_kernel(char *str, struct pt_regs *regs)
88 __RESTORE; __RESTORE; __RESTORE; __RESTORE; 67 __RESTORE; __RESTORE; __RESTORE; __RESTORE;
89 68
90 { 69 {
91 struct reg_window *rw = (struct reg_window *)regs->u_regs[UREG_FP]; 70 struct reg_window32 *rw = (struct reg_window32 *)regs->u_regs[UREG_FP];
92 71
93 /* Stop the back trace when we hit userland or we 72 /* Stop the back trace when we hit userland or we
94 * find some badly aligned kernel stack. Set an upper 73 * find some badly aligned kernel stack. Set an upper
@@ -100,7 +79,7 @@ void die_if_kernel(char *str, struct pt_regs *regs)
100 !(((unsigned long) rw) & 0x7)) { 79 !(((unsigned long) rw) & 0x7)) {
101 printk("Caller[%08lx]: %pS\n", rw->ins[7], 80 printk("Caller[%08lx]: %pS\n", rw->ins[7],
102 (void *) rw->ins[7]); 81 (void *) rw->ins[7]);
103 rw = (struct reg_window *)rw->ins[6]; 82 rw = (struct reg_window32 *)rw->ins[6];
104 } 83 }
105 } 84 }
106 printk("Instruction DUMP:"); 85 printk("Instruction DUMP:");
@@ -134,7 +113,6 @@ void do_hw_interrupt(struct pt_regs *regs, unsigned long type)
134void do_illegal_instruction(struct pt_regs *regs, unsigned long pc, unsigned long npc, 113void do_illegal_instruction(struct pt_regs *regs, unsigned long pc, unsigned long npc,
135 unsigned long psr) 114 unsigned long psr)
136{ 115{
137 extern int do_user_muldiv (struct pt_regs *, unsigned long);
138 siginfo_t info; 116 siginfo_t info;
139 117
140 if(psr & PSR_PS) 118 if(psr & PSR_PS)
@@ -195,10 +173,6 @@ void do_memaccess_unaligned(struct pt_regs *regs, unsigned long pc, unsigned lon
195 send_sig_info(SIGBUS, &info, current); 173 send_sig_info(SIGBUS, &info, current);
196} 174}
197 175
198extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
199 void *fpqueue, unsigned long *fpqdepth);
200extern void fpload(unsigned long *fpregs, unsigned long *fsr);
201
202static unsigned long init_fsr = 0x0UL; 176static unsigned long init_fsr = 0x0UL;
203static unsigned long init_fregs[32] __attribute__ ((aligned (8))) = 177static unsigned long init_fregs[32] __attribute__ ((aligned (8))) =
204 { ~0UL, ~0UL, ~0UL, ~0UL, ~0UL, ~0UL, ~0UL, ~0UL, 178 { ~0UL, ~0UL, ~0UL, ~0UL, ~0UL, ~0UL, ~0UL, ~0UL,
@@ -456,8 +430,6 @@ void do_BUG(const char *file, int line)
456 * up here so that timer interrupts work during initialization. 430 * up here so that timer interrupts work during initialization.
457 */ 431 */
458 432
459extern void sparc_cpu_startup(void);
460
461void trap_init(void) 433void trap_init(void)
462{ 434{
463 extern void thread_info_offsets_are_bolixed_pete(void); 435 extern void thread_info_offsets_are_bolixed_pete(void);
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc/kernel/traps_64.c
index 81ccd22e78d4..4638af2f55a0 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc/kernel/traps_64.c
@@ -1371,7 +1371,6 @@ static int cheetah_fix_ce(unsigned long physaddr)
1371 __asm__ __volatile__("ldxa [%0] %3, %%g0\n\t" 1371 __asm__ __volatile__("ldxa [%0] %3, %%g0\n\t"
1372 "ldxa [%1] %3, %%g0\n\t" 1372 "ldxa [%1] %3, %%g0\n\t"
1373 "casxa [%2] %3, %%g0, %%g0\n\t" 1373 "casxa [%2] %3, %%g0, %%g0\n\t"
1374 "membar #StoreLoad | #StoreStore\n\t"
1375 "ldxa [%0] %3, %%g0\n\t" 1374 "ldxa [%0] %3, %%g0\n\t"
1376 "ldxa [%1] %3, %%g0\n\t" 1375 "ldxa [%1] %3, %%g0\n\t"
1377 "membar #Sync" 1376 "membar #Sync"
@@ -1833,7 +1832,7 @@ static void sun4v_log_error(struct pt_regs *regs, struct sun4v_error_entry *ent,
1833 } 1832 }
1834} 1833}
1835 1834
1836/* We run with %pil set to 15 and PSTATE_IE enabled in %pstate. 1835/* We run with %pil set to PIL_NORMAL_MAX and PSTATE_IE enabled in %pstate.
1837 * Log the event and clear the first word of the entry. 1836 * Log the event and clear the first word of the entry.
1838 */ 1837 */
1839void sun4v_resum_error(struct pt_regs *regs, unsigned long offset) 1838void sun4v_resum_error(struct pt_regs *regs, unsigned long offset)
@@ -1881,7 +1880,7 @@ void sun4v_resum_overflow(struct pt_regs *regs)
1881 atomic_inc(&sun4v_resum_oflow_cnt); 1880 atomic_inc(&sun4v_resum_oflow_cnt);
1882} 1881}
1883 1882
1884/* We run with %pil set to 15 and PSTATE_IE enabled in %pstate. 1883/* We run with %pil set to PIL_NORMAL_MAX and PSTATE_IE enabled in %pstate.
1885 * Log the event, clear the first word of the entry, and die. 1884 * Log the event, clear the first word of the entry, and die.
1886 */ 1885 */
1887void sun4v_nonresum_error(struct pt_regs *regs, unsigned long offset) 1886void sun4v_nonresum_error(struct pt_regs *regs, unsigned long offset)
diff --git a/arch/sparc64/kernel/tsb.S b/arch/sparc/kernel/tsb.S
index c499214b501d..8c91d9b29a2f 100644
--- a/arch/sparc64/kernel/tsb.S
+++ b/arch/sparc/kernel/tsb.S
@@ -317,7 +317,7 @@ tsb_flush:
317 srlx %g1, 32, %o3 317 srlx %g1, 32, %o3
318 andcc %o3, %g2, %g0 318 andcc %o3, %g2, %g0
319 bne,pn %icc, 1b 319 bne,pn %icc, 1b
320 membar #LoadLoad 320 nop
321 cmp %g1, %o1 321 cmp %g1, %o1
322 mov 1, %o3 322 mov 1, %o3
323 bne,pt %xcc, 2f 323 bne,pt %xcc, 2f
@@ -327,7 +327,7 @@ tsb_flush:
327 bne,pn %xcc, 1b 327 bne,pn %xcc, 1b
328 nop 328 nop
3292: retl 3292: retl
330 TSB_MEMBAR 330 nop
331 .size tsb_flush, .-tsb_flush 331 .size tsb_flush, .-tsb_flush
332 332
333 /* Reload MMU related context switch state at 333 /* Reload MMU related context switch state at
@@ -478,7 +478,7 @@ copy_tsb: /* %o0=old_tsb_base, %o1=old_tsb_size
478 nop 478 nop
479 479
480 retl 480 retl
481 TSB_MEMBAR 481 nop
482 .size copy_tsb, .-copy_tsb 482 .size copy_tsb, .-copy_tsb
483 483
484 /* Set the invalid bit in all TSB entries. */ 484 /* Set the invalid bit in all TSB entries. */
diff --git a/arch/sparc64/kernel/ttable.S b/arch/sparc/kernel/ttable.S
index 1ade3d6fb7fc..ea925503b42e 100644
--- a/arch/sparc64/kernel/ttable.S
+++ b/arch/sparc/kernel/ttable.S
@@ -66,7 +66,7 @@ tl0_irq6: BTRAP(0x46)
66tl0_irq7: BTRAP(0x47) BTRAP(0x48) BTRAP(0x49) 66tl0_irq7: BTRAP(0x47) BTRAP(0x48) BTRAP(0x49)
67tl0_irq10: BTRAP(0x4a) BTRAP(0x4b) BTRAP(0x4c) BTRAP(0x4d) 67tl0_irq10: BTRAP(0x4a) BTRAP(0x4b) BTRAP(0x4c) BTRAP(0x4d)
68tl0_irq14: TRAP_IRQ(timer_interrupt, 14) 68tl0_irq14: TRAP_IRQ(timer_interrupt, 14)
69tl0_irq15: TRAP_IRQ(handler_irq, 15) 69tl0_irq15: TRAP_NMI_IRQ(perfctr_irq, 15)
70tl0_resv050: BTRAP(0x50) BTRAP(0x51) BTRAP(0x52) BTRAP(0x53) BTRAP(0x54) BTRAP(0x55) 70tl0_resv050: BTRAP(0x50) BTRAP(0x51) BTRAP(0x52) BTRAP(0x53) BTRAP(0x54) BTRAP(0x55)
71tl0_resv056: BTRAP(0x56) BTRAP(0x57) BTRAP(0x58) BTRAP(0x59) BTRAP(0x5a) BTRAP(0x5b) 71tl0_resv056: BTRAP(0x56) BTRAP(0x57) BTRAP(0x58) BTRAP(0x59) BTRAP(0x5a) BTRAP(0x5b)
72tl0_resv05c: BTRAP(0x5c) BTRAP(0x5d) BTRAP(0x5e) BTRAP(0x5f) 72tl0_resv05c: BTRAP(0x5c) BTRAP(0x5d) BTRAP(0x5e) BTRAP(0x5f)
diff --git a/arch/sparc/kernel/una_asm.S b/arch/sparc/kernel/una_asm_32.S
index 8cc03458eb7e..8cc03458eb7e 100644
--- a/arch/sparc/kernel/una_asm.S
+++ b/arch/sparc/kernel/una_asm_32.S
diff --git a/arch/sparc64/kernel/una_asm.S b/arch/sparc/kernel/una_asm_64.S
index be183fe41443..be183fe41443 100644
--- a/arch/sparc64/kernel/una_asm.S
+++ b/arch/sparc/kernel/una_asm_64.S
diff --git a/arch/sparc/kernel/unaligned.c b/arch/sparc/kernel/unaligned_32.c
index c2a28c5ad650..6b1e6cde6fff 100644
--- a/arch/sparc/kernel/unaligned.c
+++ b/arch/sparc/kernel/unaligned_32.c
@@ -97,26 +97,26 @@ static inline int sign_extend_imm13(int imm)
97 97
98static inline unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs) 98static inline unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs)
99{ 99{
100 struct reg_window *win; 100 struct reg_window32 *win;
101 101
102 if(reg < 16) 102 if(reg < 16)
103 return (!reg ? 0 : regs->u_regs[reg]); 103 return (!reg ? 0 : regs->u_regs[reg]);
104 104
105 /* Ho hum, the slightly complicated case. */ 105 /* Ho hum, the slightly complicated case. */
106 win = (struct reg_window *) regs->u_regs[UREG_FP]; 106 win = (struct reg_window32 *) regs->u_regs[UREG_FP];
107 return win->locals[reg - 16]; /* yes, I know what this does... */ 107 return win->locals[reg - 16]; /* yes, I know what this does... */
108} 108}
109 109
110static inline unsigned long safe_fetch_reg(unsigned int reg, struct pt_regs *regs) 110static inline unsigned long safe_fetch_reg(unsigned int reg, struct pt_regs *regs)
111{ 111{
112 struct reg_window __user *win; 112 struct reg_window32 __user *win;
113 unsigned long ret; 113 unsigned long ret;
114 114
115 if (reg < 16) 115 if (reg < 16)
116 return (!reg ? 0 : regs->u_regs[reg]); 116 return (!reg ? 0 : regs->u_regs[reg]);
117 117
118 /* Ho hum, the slightly complicated case. */ 118 /* Ho hum, the slightly complicated case. */
119 win = (struct reg_window __user *) regs->u_regs[UREG_FP]; 119 win = (struct reg_window32 __user *) regs->u_regs[UREG_FP];
120 120
121 if ((unsigned long)win & 3) 121 if ((unsigned long)win & 3)
122 return -1; 122 return -1;
@@ -129,11 +129,11 @@ static inline unsigned long safe_fetch_reg(unsigned int reg, struct pt_regs *reg
129 129
130static inline unsigned long *fetch_reg_addr(unsigned int reg, struct pt_regs *regs) 130static inline unsigned long *fetch_reg_addr(unsigned int reg, struct pt_regs *regs)
131{ 131{
132 struct reg_window *win; 132 struct reg_window32 *win;
133 133
134 if(reg < 16) 134 if(reg < 16)
135 return &regs->u_regs[reg]; 135 return &regs->u_regs[reg];
136 win = (struct reg_window *) regs->u_regs[UREG_FP]; 136 win = (struct reg_window32 *) regs->u_regs[UREG_FP];
137 return &win->locals[reg - 16]; 137 return &win->locals[reg - 16];
138} 138}
139 139
diff --git a/arch/sparc64/kernel/unaligned.c b/arch/sparc/kernel/unaligned_64.c
index 203ddfad9f27..203ddfad9f27 100644
--- a/arch/sparc64/kernel/unaligned.c
+++ b/arch/sparc/kernel/unaligned_64.c
diff --git a/arch/sparc64/kernel/us2e_cpufreq.c b/arch/sparc/kernel/us2e_cpufreq.c
index 791c15138f3a..791c15138f3a 100644
--- a/arch/sparc64/kernel/us2e_cpufreq.c
+++ b/arch/sparc/kernel/us2e_cpufreq.c
diff --git a/arch/sparc64/kernel/us3_cpufreq.c b/arch/sparc/kernel/us3_cpufreq.c
index 365b6464e2ce..365b6464e2ce 100644
--- a/arch/sparc64/kernel/us3_cpufreq.c
+++ b/arch/sparc/kernel/us3_cpufreq.c
diff --git a/arch/sparc64/kernel/utrap.S b/arch/sparc/kernel/utrap.S
index b7f0f3f3a909..b7f0f3f3a909 100644
--- a/arch/sparc64/kernel/utrap.S
+++ b/arch/sparc/kernel/utrap.S
diff --git a/arch/sparc64/kernel/vio.c b/arch/sparc/kernel/vio.c
index 92b1f8ec01de..92b1f8ec01de 100644
--- a/arch/sparc64/kernel/vio.c
+++ b/arch/sparc/kernel/vio.c
diff --git a/arch/sparc64/kernel/viohs.c b/arch/sparc/kernel/viohs.c
index 708fa1705fbe..708fa1705fbe 100644
--- a/arch/sparc64/kernel/viohs.c
+++ b/arch/sparc/kernel/viohs.c
diff --git a/arch/sparc64/kernel/visemul.c b/arch/sparc/kernel/visemul.c
index b956fd71c131..b956fd71c131 100644
--- a/arch/sparc64/kernel/visemul.c
+++ b/arch/sparc/kernel/visemul.c
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index 5b7e69a8c32f..76267085b13b 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -1,27 +1,56 @@
1/* ld script to make SparcLinux kernel */ 1/* ld script for sparc32/sparc64 kernel */
2 2
3#include <asm-generic/vmlinux.lds.h> 3#include <asm-generic/vmlinux.lds.h>
4
4#include <asm/page.h> 5#include <asm/page.h>
6#include <asm/thread_info.h>
7
8#ifdef CONFIG_SPARC32
9#define INITIAL_ADDRESS 0x10000 + SIZEOF_HEADERS
10#define TEXTSTART 0xf0004000
11
12#define SMP_CACHE_BYTES_SHIFT 5
13
14#else
15#define SMP_CACHE_BYTES_SHIFT 6
16#define INITIAL_ADDRESS 0x4000
17#define TEXTSTART 0x0000000000404000
18
19#endif
20
21#define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT)
5 22
23#ifdef CONFIG_SPARC32
6OUTPUT_FORMAT("elf32-sparc", "elf32-sparc", "elf32-sparc") 24OUTPUT_FORMAT("elf32-sparc", "elf32-sparc", "elf32-sparc")
7OUTPUT_ARCH(sparc) 25OUTPUT_ARCH(sparc)
8ENTRY(_start) 26ENTRY(_start)
9jiffies = jiffies_64 + 4; 27jiffies = jiffies_64 + 4;
28#else
29/* sparc64 */
30OUTPUT_FORMAT("elf64-sparc", "elf64-sparc", "elf64-sparc")
31OUTPUT_ARCH(sparc:v9a)
32ENTRY(_start)
33jiffies = jiffies_64;
34#endif
35
10SECTIONS 36SECTIONS
11{ 37{
12 . = 0x10000 + SIZEOF_HEADERS; 38 /* swapper_low_pmd_dir is sparc64 only */
13 .text 0xf0004000 : 39 swapper_low_pmd_dir = 0x0000000000402000;
40 . = INITIAL_ADDRESS;
41 .text TEXTSTART :
14 { 42 {
15 _text = .; 43 _text = .;
16 *(.text.head) 44 *(.text.head)
17 TEXT_TEXT 45 TEXT_TEXT
18 SCHED_TEXT 46 SCHED_TEXT
19 LOCK_TEXT 47 LOCK_TEXT
48 KPROBES_TEXT
20 *(.gnu.warning) 49 *(.gnu.warning)
21 } = 0 50 } = 0
22 _etext = .; 51 _etext = .;
23 PROVIDE (etext = .); 52
24 RODATA 53 RO_DATA(PAGE_SIZE)
25 .data : { 54 .data : {
26 DATA_DATA 55 DATA_DATA
27 CONSTRUCTORS 56 CONSTRUCTORS
@@ -29,25 +58,38 @@ SECTIONS
29 .data1 : { 58 .data1 : {
30 *(.data1) 59 *(.data1)
31 } 60 }
61 . = ALIGN(SMP_CACHE_BYTES);
62 .data.cacheline_aligned : {
63 *(.data.cacheline_aligned)
64 }
65 . = ALIGN(SMP_CACHE_BYTES);
66 .data.read_mostly : {
67 *(.data.read_mostly)
68 }
69 /* End of data section */
32 _edata = .; 70 _edata = .;
33 PROVIDE (edata = .);
34 71
72 /* init_task */
73 . = ALIGN(THREAD_SIZE);
74 .data.init_task : {
75 *(.data.init_task)
76 }
35 .fixup : { 77 .fixup : {
36 __start___fixup = .; 78 __start___fixup = .;
37 *(.fixup) 79 *(.fixup)
38 __stop___fixup = .; 80 __stop___fixup = .;
39 } 81 }
82 . = ALIGN(16);
40 __ex_table : { 83 __ex_table : {
41 __start___ex_table = .; 84 __start___ex_table = .;
42 *(__ex_table) 85 *(__ex_table)
43 __stop___ex_table = .; 86 __stop___ex_table = .;
44 } 87 }
45
46 NOTES 88 NOTES
47 89
48 . = ALIGN(PAGE_SIZE); 90 . = ALIGN(PAGE_SIZE);
49 __init_begin = .;
50 .init.text : { 91 .init.text : {
92 __init_begin = .;
51 _sinittext = .; 93 _sinittext = .;
52 INIT_TEXT 94 INIT_TEXT
53 _einittext = .; 95 _einittext = .;
@@ -65,7 +107,7 @@ SECTIONS
65 .initcall.init : { 107 .initcall.init : {
66 __initcall_start = .; 108 __initcall_start = .;
67 INITCALLS 109 INITCALLS
68 __initcall_end = .; 110 __initcall_end = .;
69 } 111 }
70 .con_initcall.init : { 112 .con_initcall.init : {
71 __con_initcall_start = .; 113 __con_initcall_start = .;
@@ -74,38 +116,61 @@ SECTIONS
74 } 116 }
75 SECURITY_INIT 117 SECURITY_INIT
76 118
119 . = ALIGN(4);
120 .tsb_ldquad_phys_patch : {
121 __tsb_ldquad_phys_patch = .;
122 *(.tsb_ldquad_phys_patch)
123 __tsb_ldquad_phys_patch_end = .;
124 }
125
126 .tsb_phys_patch : {
127 __tsb_phys_patch = .;
128 *(.tsb_phys_patch)
129 __tsb_phys_patch_end = .;
130 }
131
132 .cpuid_patch : {
133 __cpuid_patch = .;
134 *(.cpuid_patch)
135 __cpuid_patch_end = .;
136 }
137
138 .sun4v_1insn_patch : {
139 __sun4v_1insn_patch = .;
140 *(.sun4v_1insn_patch)
141 __sun4v_1insn_patch_end = .;
142 }
143 .sun4v_2insn_patch : {
144 __sun4v_2insn_patch = .;
145 *(.sun4v_2insn_patch)
146 __sun4v_2insn_patch_end = .;
147 }
148
77#ifdef CONFIG_BLK_DEV_INITRD 149#ifdef CONFIG_BLK_DEV_INITRD
78 . = ALIGN(PAGE_SIZE); 150 . = ALIGN(PAGE_SIZE);
79 .init.ramfs : { 151 .init.ramfs : {
80 __initramfs_start = .; 152 __initramfs_start = .;
81 *(.init.ramfs) 153 *(.init.ramfs)
82 __initramfs_end = .; 154 __initramfs_end = .;
83 } 155 }
84#endif 156#endif
85 157
86 PERCPU(PAGE_SIZE) 158 PERCPU(PAGE_SIZE)
159
87 . = ALIGN(PAGE_SIZE); 160 . = ALIGN(PAGE_SIZE);
88 __init_end = .; 161 __init_end = .;
89 . = ALIGN(32);
90 .data.cacheline_aligned : {
91 *(.data.cacheline_aligned)
92 }
93 . = ALIGN(32);
94 .data.read_mostly : {
95 *(.data.read_mostly)
96 }
97
98 __bss_start = .; 162 __bss_start = .;
99 .sbss : { 163 .sbss : {
100 *(.sbss) 164 *(.sbss)
101 *(.scommon) } 165 *(.scommon)
166 }
102 .bss : { 167 .bss : {
103 *(.dynbss) 168 *(.dynbss)
104 *(.bss) 169 *(.bss)
105 *(COMMON) 170 *(COMMON)
106 } 171 }
107 _end = . ; 172 _end = . ;
108 PROVIDE (end = .); 173
109 /DISCARD/ : { 174 /DISCARD/ : {
110 EXIT_TEXT 175 EXIT_TEXT
111 EXIT_DATA 176 EXIT_DATA
diff --git a/arch/sparc/kernel/windows.c b/arch/sparc/kernel/windows.c
index 9cc93eaa4abf..f24d298bda29 100644
--- a/arch/sparc/kernel/windows.c
+++ b/arch/sparc/kernel/windows.c
@@ -42,7 +42,7 @@ static inline void shift_window_buffer(int first_win, int last_win, struct threa
42 42
43 for(i = first_win; i < last_win; i++) { 43 for(i = first_win; i < last_win; i++) {
44 tp->rwbuf_stkptrs[i] = tp->rwbuf_stkptrs[i+1]; 44 tp->rwbuf_stkptrs[i] = tp->rwbuf_stkptrs[i+1];
45 memcpy(&tp->reg_window[i], &tp->reg_window[i+1], sizeof(struct reg_window)); 45 memcpy(&tp->reg_window[i], &tp->reg_window[i+1], sizeof(struct reg_window32));
46 } 46 }
47} 47}
48 48
@@ -70,7 +70,7 @@ void synchronize_user_stack(void)
70 70
71 /* Ok, let it rip. */ 71 /* Ok, let it rip. */
72 if (copy_to_user((char __user *) sp, &tp->reg_window[window], 72 if (copy_to_user((char __user *) sp, &tp->reg_window[window],
73 sizeof(struct reg_window))) 73 sizeof(struct reg_window32)))
74 continue; 74 continue;
75 75
76 shift_window_buffer(window, tp->w_saved - 1, tp); 76 shift_window_buffer(window, tp->w_saved - 1, tp);
@@ -119,7 +119,7 @@ void try_to_clear_window_buffer(struct pt_regs *regs, int who)
119 119
120 if ((sp & 7) || 120 if ((sp & 7) ||
121 copy_to_user((char __user *) sp, &tp->reg_window[window], 121 copy_to_user((char __user *) sp, &tp->reg_window[window],
122 sizeof(struct reg_window))) 122 sizeof(struct reg_window32)))
123 do_exit(SIGILL); 123 do_exit(SIGILL);
124 } 124 }
125 tp->w_saved = 0; 125 tp->w_saved = 0;
diff --git a/arch/sparc64/kernel/winfixup.S b/arch/sparc/kernel/winfixup.S
index a6b0863c27df..a6b0863c27df 100644
--- a/arch/sparc64/kernel/winfixup.S
+++ b/arch/sparc/kernel/winfixup.S
diff --git a/arch/sparc64/lib/GENbzero.S b/arch/sparc/lib/GENbzero.S
index 6a4f956a2f7a..6a4f956a2f7a 100644
--- a/arch/sparc64/lib/GENbzero.S
+++ b/arch/sparc/lib/GENbzero.S
diff --git a/arch/sparc64/lib/GENcopy_from_user.S b/arch/sparc/lib/GENcopy_from_user.S
index 2b9df99e87f9..2b9df99e87f9 100644
--- a/arch/sparc64/lib/GENcopy_from_user.S
+++ b/arch/sparc/lib/GENcopy_from_user.S
diff --git a/arch/sparc64/lib/GENcopy_to_user.S b/arch/sparc/lib/GENcopy_to_user.S
index bb3f7084daf9..bb3f7084daf9 100644
--- a/arch/sparc64/lib/GENcopy_to_user.S
+++ b/arch/sparc/lib/GENcopy_to_user.S
diff --git a/arch/sparc64/lib/GENmemcpy.S b/arch/sparc/lib/GENmemcpy.S
index 89358ee94851..89358ee94851 100644
--- a/arch/sparc64/lib/GENmemcpy.S
+++ b/arch/sparc/lib/GENmemcpy.S
diff --git a/arch/sparc64/lib/GENpage.S b/arch/sparc/lib/GENpage.S
index 2ef9d05f21bc..2ef9d05f21bc 100644
--- a/arch/sparc64/lib/GENpage.S
+++ b/arch/sparc/lib/GENpage.S
diff --git a/arch/sparc64/lib/GENpatch.S b/arch/sparc/lib/GENpatch.S
index fab9e89f16bd..fab9e89f16bd 100644
--- a/arch/sparc64/lib/GENpatch.S
+++ b/arch/sparc/lib/GENpatch.S
diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile
index 6e303e10c3b9..375016e19144 100644
--- a/arch/sparc/lib/Makefile
+++ b/arch/sparc/lib/Makefile
@@ -1,13 +1,44 @@
1# Makefile for Sparc library files.. 1# Makefile for Sparc library files..
2# 2#
3 3
4EXTRA_AFLAGS := -ansi -DST_DIV0=0x02 4asflags-y := -ansi -DST_DIV0=0x02
5ccflags-y := -Werror
5 6
6lib-y := mul.o rem.o sdiv.o udiv.o umul.o urem.o ashrdi3.o memcpy.o memset.o \ 7lib-$(CONFIG_SPARC32) += mul.o rem.o sdiv.o udiv.o umul.o urem.o ashrdi3.o
7 strlen.o checksum.o blockops.o memscan.o memcmp.o strncmp.o \ 8lib-$(CONFIG_SPARC32) += memcpy.o memset.o
8 strncpy_from_user.o divdi3.o udivdi3.o strlen_user.o \ 9lib-y += strlen.o
9 copy_user.o locks.o atomic.o \ 10lib-y += checksum_$(BITS).o
10 lshrdi3.o ashldi3.o rwsem.o muldi3.o bitext.o \ 11lib-$(CONFIG_SPARC32) += blockops.o
11 cmpdi2.o 12lib-y += memscan_$(BITS).o memcmp.o strncmp_$(BITS).o
13lib-y += strncpy_from_user_$(BITS).o strlen_user_$(BITS).o
14lib-$(CONFIG_SPARC32) += divdi3.o udivdi3.o
15lib-$(CONFIG_SPARC32) += copy_user.o locks.o
16lib-y += atomic_$(BITS).o
17lib-$(CONFIG_SPARC32) += lshrdi3.o ashldi3.o
18lib-y += rwsem_$(BITS).o
19lib-$(CONFIG_SPARC32) += muldi3.o bitext.o cmpdi2.o
12 20
13obj-y += iomap.o atomic32.o 21lib-$(CONFIG_SPARC64) += PeeCeeI.o copy_page.o clear_page.o bzero.o
22lib-$(CONFIG_SPARC64) += csum_copy.o csum_copy_from_user.o csum_copy_to_user.o
23lib-$(CONFIG_SPARC64) += VISsave.o
24lib-$(CONFIG_SPARC64) += bitops.o
25
26lib-$(CONFIG_SPARC64) += U1memcpy.o U1copy_from_user.o U1copy_to_user.o
27
28lib-$(CONFIG_SPARC64) += U3memcpy.o U3copy_from_user.o U3copy_to_user.o
29lib-$(CONFIG_SPARC64) += U3patch.o
30
31lib-$(CONFIG_SPARC64) += NGmemcpy.o NGcopy_from_user.o NGcopy_to_user.o
32lib-$(CONFIG_SPARC64) += NGpatch.o NGpage.o NGbzero.o
33
34lib-$(CONFIG_SPARC64) += NG2memcpy.o NG2copy_from_user.o NG2copy_to_user.o
35lib-$(CONFIG_SPARC64) += NG2patch.o NG2page.o
36
37lib-$(CONFIG_SPARC64) += GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o
38lib-$(CONFIG_SPARC64) += GENpatch.o GENpage.o GENbzero.o
39
40lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o
41lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o
42
43obj-y += iomap.o
44obj-$(CONFIG_SPARC32) += atomic32.o
diff --git a/arch/sparc64/lib/NG2copy_from_user.S b/arch/sparc/lib/NG2copy_from_user.S
index c77ef5f22102..c77ef5f22102 100644
--- a/arch/sparc64/lib/NG2copy_from_user.S
+++ b/arch/sparc/lib/NG2copy_from_user.S
diff --git a/arch/sparc64/lib/NG2copy_to_user.S b/arch/sparc/lib/NG2copy_to_user.S
index 4bd4093acbbd..4bd4093acbbd 100644
--- a/arch/sparc64/lib/NG2copy_to_user.S
+++ b/arch/sparc/lib/NG2copy_to_user.S
diff --git a/arch/sparc64/lib/NG2memcpy.S b/arch/sparc/lib/NG2memcpy.S
index 0aed75653b50..0aed75653b50 100644
--- a/arch/sparc64/lib/NG2memcpy.S
+++ b/arch/sparc/lib/NG2memcpy.S
diff --git a/arch/sparc64/lib/NG2page.S b/arch/sparc/lib/NG2page.S
index 73b6b7c72cbf..73b6b7c72cbf 100644
--- a/arch/sparc64/lib/NG2page.S
+++ b/arch/sparc/lib/NG2page.S
diff --git a/arch/sparc64/lib/NG2patch.S b/arch/sparc/lib/NG2patch.S
index 28c36f06a6d1..28c36f06a6d1 100644
--- a/arch/sparc64/lib/NG2patch.S
+++ b/arch/sparc/lib/NG2patch.S
diff --git a/arch/sparc64/lib/NGbzero.S b/arch/sparc/lib/NGbzero.S
index 814d5f7a45e1..814d5f7a45e1 100644
--- a/arch/sparc64/lib/NGbzero.S
+++ b/arch/sparc/lib/NGbzero.S
diff --git a/arch/sparc64/lib/NGcopy_from_user.S b/arch/sparc/lib/NGcopy_from_user.S
index e7f433f71b42..e7f433f71b42 100644
--- a/arch/sparc64/lib/NGcopy_from_user.S
+++ b/arch/sparc/lib/NGcopy_from_user.S
diff --git a/arch/sparc64/lib/NGcopy_to_user.S b/arch/sparc/lib/NGcopy_to_user.S
index 6ea01c5532a0..6ea01c5532a0 100644
--- a/arch/sparc64/lib/NGcopy_to_user.S
+++ b/arch/sparc/lib/NGcopy_to_user.S
diff --git a/arch/sparc64/lib/NGmemcpy.S b/arch/sparc/lib/NGmemcpy.S
index 96a14caf6966..96a14caf6966 100644
--- a/arch/sparc64/lib/NGmemcpy.S
+++ b/arch/sparc/lib/NGmemcpy.S
diff --git a/arch/sparc64/lib/NGpage.S b/arch/sparc/lib/NGpage.S
index 428920de05ba..428920de05ba 100644
--- a/arch/sparc64/lib/NGpage.S
+++ b/arch/sparc/lib/NGpage.S
diff --git a/arch/sparc64/lib/NGpatch.S b/arch/sparc/lib/NGpatch.S
index 3b0674fc3366..3b0674fc3366 100644
--- a/arch/sparc64/lib/NGpatch.S
+++ b/arch/sparc/lib/NGpatch.S
diff --git a/arch/sparc64/lib/PeeCeeI.c b/arch/sparc/lib/PeeCeeI.c
index 46053e6ddd7b..46053e6ddd7b 100644
--- a/arch/sparc64/lib/PeeCeeI.c
+++ b/arch/sparc/lib/PeeCeeI.c
diff --git a/arch/sparc64/lib/U1copy_from_user.S b/arch/sparc/lib/U1copy_from_user.S
index 3192b0bf4fab..3192b0bf4fab 100644
--- a/arch/sparc64/lib/U1copy_from_user.S
+++ b/arch/sparc/lib/U1copy_from_user.S
diff --git a/arch/sparc64/lib/U1copy_to_user.S b/arch/sparc/lib/U1copy_to_user.S
index d1210ffb0b82..d1210ffb0b82 100644
--- a/arch/sparc64/lib/U1copy_to_user.S
+++ b/arch/sparc/lib/U1copy_to_user.S
diff --git a/arch/sparc64/lib/U1memcpy.S b/arch/sparc/lib/U1memcpy.S
index bafd2fc07acb..bafd2fc07acb 100644
--- a/arch/sparc64/lib/U1memcpy.S
+++ b/arch/sparc/lib/U1memcpy.S
diff --git a/arch/sparc64/lib/U3copy_from_user.S b/arch/sparc/lib/U3copy_from_user.S
index f5bfc8d9d216..f5bfc8d9d216 100644
--- a/arch/sparc64/lib/U3copy_from_user.S
+++ b/arch/sparc/lib/U3copy_from_user.S
diff --git a/arch/sparc64/lib/U3copy_to_user.S b/arch/sparc/lib/U3copy_to_user.S
index 2334f111bb0c..2334f111bb0c 100644
--- a/arch/sparc64/lib/U3copy_to_user.S
+++ b/arch/sparc/lib/U3copy_to_user.S
diff --git a/arch/sparc64/lib/U3memcpy.S b/arch/sparc/lib/U3memcpy.S
index 7cae9cc6a204..7cae9cc6a204 100644
--- a/arch/sparc64/lib/U3memcpy.S
+++ b/arch/sparc/lib/U3memcpy.S
diff --git a/arch/sparc64/lib/U3patch.S b/arch/sparc/lib/U3patch.S
index ecc302619a6e..ecc302619a6e 100644
--- a/arch/sparc64/lib/U3patch.S
+++ b/arch/sparc/lib/U3patch.S
diff --git a/arch/sparc64/lib/VISsave.S b/arch/sparc/lib/VISsave.S
index b320ae9e2e2e..b320ae9e2e2e 100644
--- a/arch/sparc64/lib/VISsave.S
+++ b/arch/sparc/lib/VISsave.S
diff --git a/arch/sparc/lib/atomic.S b/arch/sparc/lib/atomic_32.S
index 178cbb8ae1b9..178cbb8ae1b9 100644
--- a/arch/sparc/lib/atomic.S
+++ b/arch/sparc/lib/atomic_32.S
diff --git a/arch/sparc64/lib/atomic.S b/arch/sparc/lib/atomic_64.S
index 70ac4186f62b..0268210ca168 100644
--- a/arch/sparc64/lib/atomic.S
+++ b/arch/sparc/lib/atomic_64.S
@@ -43,29 +43,10 @@ atomic_sub: /* %o0 = decrement, %o1 = atomic_ptr */
432: BACKOFF_SPIN(%o2, %o3, 1b) 432: BACKOFF_SPIN(%o2, %o3, 1b)
44 .size atomic_sub, .-atomic_sub 44 .size atomic_sub, .-atomic_sub
45 45
46 /* On SMP we need to use memory barriers to ensure
47 * correct memory operation ordering, nop these out
48 * for uniprocessor.
49 */
50#ifdef CONFIG_SMP
51
52#define ATOMIC_PRE_BARRIER membar #StoreLoad | #LoadLoad;
53#define ATOMIC_POST_BARRIER \
54 ba,pt %xcc, 80b; \
55 membar #StoreLoad | #StoreStore
56
5780: retl
58 nop
59#else
60#define ATOMIC_PRE_BARRIER
61#define ATOMIC_POST_BARRIER
62#endif
63
64 .globl atomic_add_ret 46 .globl atomic_add_ret
65 .type atomic_add_ret,#function 47 .type atomic_add_ret,#function
66atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */ 48atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
67 BACKOFF_SETUP(%o2) 49 BACKOFF_SETUP(%o2)
68 ATOMIC_PRE_BARRIER
691: lduw [%o1], %g1 501: lduw [%o1], %g1
70 add %g1, %o0, %g7 51 add %g1, %o0, %g7
71 cas [%o1], %g1, %g7 52 cas [%o1], %g1, %g7
@@ -73,7 +54,6 @@ atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
73 bne,pn %icc, 2f 54 bne,pn %icc, 2f
74 add %g7, %o0, %g7 55 add %g7, %o0, %g7
75 sra %g7, 0, %o0 56 sra %g7, 0, %o0
76 ATOMIC_POST_BARRIER
77 retl 57 retl
78 nop 58 nop
792: BACKOFF_SPIN(%o2, %o3, 1b) 592: BACKOFF_SPIN(%o2, %o3, 1b)
@@ -83,7 +63,6 @@ atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
83 .type atomic_sub_ret,#function 63 .type atomic_sub_ret,#function
84atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */ 64atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
85 BACKOFF_SETUP(%o2) 65 BACKOFF_SETUP(%o2)
86 ATOMIC_PRE_BARRIER
871: lduw [%o1], %g1 661: lduw [%o1], %g1
88 sub %g1, %o0, %g7 67 sub %g1, %o0, %g7
89 cas [%o1], %g1, %g7 68 cas [%o1], %g1, %g7
@@ -91,7 +70,6 @@ atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
91 bne,pn %icc, 2f 70 bne,pn %icc, 2f
92 sub %g7, %o0, %g7 71 sub %g7, %o0, %g7
93 sra %g7, 0, %o0 72 sra %g7, 0, %o0
94 ATOMIC_POST_BARRIER
95 retl 73 retl
96 nop 74 nop
972: BACKOFF_SPIN(%o2, %o3, 1b) 752: BACKOFF_SPIN(%o2, %o3, 1b)
@@ -131,7 +109,6 @@ atomic64_sub: /* %o0 = decrement, %o1 = atomic_ptr */
131 .type atomic64_add_ret,#function 109 .type atomic64_add_ret,#function
132atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */ 110atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
133 BACKOFF_SETUP(%o2) 111 BACKOFF_SETUP(%o2)
134 ATOMIC_PRE_BARRIER
1351: ldx [%o1], %g1 1121: ldx [%o1], %g1
136 add %g1, %o0, %g7 113 add %g1, %o0, %g7
137 casx [%o1], %g1, %g7 114 casx [%o1], %g1, %g7
@@ -139,7 +116,6 @@ atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
139 bne,pn %xcc, 2f 116 bne,pn %xcc, 2f
140 add %g7, %o0, %g7 117 add %g7, %o0, %g7
141 mov %g7, %o0 118 mov %g7, %o0
142 ATOMIC_POST_BARRIER
143 retl 119 retl
144 nop 120 nop
1452: BACKOFF_SPIN(%o2, %o3, 1b) 1212: BACKOFF_SPIN(%o2, %o3, 1b)
@@ -149,7 +125,6 @@ atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
149 .type atomic64_sub_ret,#function 125 .type atomic64_sub_ret,#function
150atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */ 126atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
151 BACKOFF_SETUP(%o2) 127 BACKOFF_SETUP(%o2)
152 ATOMIC_PRE_BARRIER
1531: ldx [%o1], %g1 1281: ldx [%o1], %g1
154 sub %g1, %o0, %g7 129 sub %g1, %o0, %g7
155 casx [%o1], %g1, %g7 130 casx [%o1], %g1, %g7
@@ -157,7 +132,6 @@ atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
157 bne,pn %xcc, 2f 132 bne,pn %xcc, 2f
158 sub %g7, %o0, %g7 133 sub %g7, %o0, %g7
159 mov %g7, %o0 134 mov %g7, %o0
160 ATOMIC_POST_BARRIER
161 retl 135 retl
162 nop 136 nop
1632: BACKOFF_SPIN(%o2, %o3, 1b) 1372: BACKOFF_SPIN(%o2, %o3, 1b)
diff --git a/arch/sparc64/lib/bitops.S b/arch/sparc/lib/bitops.S
index 6b015a6eefb5..2b7228cb8c22 100644
--- a/arch/sparc64/lib/bitops.S
+++ b/arch/sparc/lib/bitops.S
@@ -8,29 +8,10 @@
8 8
9 .text 9 .text
10 10
11 /* On SMP we need to use memory barriers to ensure
12 * correct memory operation ordering, nop these out
13 * for uniprocessor.
14 */
15
16#ifdef CONFIG_SMP
17#define BITOP_PRE_BARRIER membar #StoreLoad | #LoadLoad
18#define BITOP_POST_BARRIER \
19 ba,pt %xcc, 80b; \
20 membar #StoreLoad | #StoreStore
21
2280: retl
23 nop
24#else
25#define BITOP_PRE_BARRIER
26#define BITOP_POST_BARRIER
27#endif
28
29 .globl test_and_set_bit 11 .globl test_and_set_bit
30 .type test_and_set_bit,#function 12 .type test_and_set_bit,#function
31test_and_set_bit: /* %o0=nr, %o1=addr */ 13test_and_set_bit: /* %o0=nr, %o1=addr */
32 BACKOFF_SETUP(%o3) 14 BACKOFF_SETUP(%o3)
33 BITOP_PRE_BARRIER
34 srlx %o0, 6, %g1 15 srlx %o0, 6, %g1
35 mov 1, %o2 16 mov 1, %o2
36 sllx %g1, 3, %g3 17 sllx %g1, 3, %g3
@@ -45,7 +26,6 @@ test_and_set_bit: /* %o0=nr, %o1=addr */
45 and %g7, %o2, %g2 26 and %g7, %o2, %g2
46 clr %o0 27 clr %o0
47 movrne %g2, 1, %o0 28 movrne %g2, 1, %o0
48 BITOP_POST_BARRIER
49 retl 29 retl
50 nop 30 nop
512: BACKOFF_SPIN(%o3, %o4, 1b) 312: BACKOFF_SPIN(%o3, %o4, 1b)
@@ -55,7 +35,6 @@ test_and_set_bit: /* %o0=nr, %o1=addr */
55 .type test_and_clear_bit,#function 35 .type test_and_clear_bit,#function
56test_and_clear_bit: /* %o0=nr, %o1=addr */ 36test_and_clear_bit: /* %o0=nr, %o1=addr */
57 BACKOFF_SETUP(%o3) 37 BACKOFF_SETUP(%o3)
58 BITOP_PRE_BARRIER
59 srlx %o0, 6, %g1 38 srlx %o0, 6, %g1
60 mov 1, %o2 39 mov 1, %o2
61 sllx %g1, 3, %g3 40 sllx %g1, 3, %g3
@@ -70,7 +49,6 @@ test_and_clear_bit: /* %o0=nr, %o1=addr */
70 and %g7, %o2, %g2 49 and %g7, %o2, %g2
71 clr %o0 50 clr %o0
72 movrne %g2, 1, %o0 51 movrne %g2, 1, %o0
73 BITOP_POST_BARRIER
74 retl 52 retl
75 nop 53 nop
762: BACKOFF_SPIN(%o3, %o4, 1b) 542: BACKOFF_SPIN(%o3, %o4, 1b)
@@ -80,7 +58,6 @@ test_and_clear_bit: /* %o0=nr, %o1=addr */
80 .type test_and_change_bit,#function 58 .type test_and_change_bit,#function
81test_and_change_bit: /* %o0=nr, %o1=addr */ 59test_and_change_bit: /* %o0=nr, %o1=addr */
82 BACKOFF_SETUP(%o3) 60 BACKOFF_SETUP(%o3)
83 BITOP_PRE_BARRIER
84 srlx %o0, 6, %g1 61 srlx %o0, 6, %g1
85 mov 1, %o2 62 mov 1, %o2
86 sllx %g1, 3, %g3 63 sllx %g1, 3, %g3
@@ -95,7 +72,6 @@ test_and_change_bit: /* %o0=nr, %o1=addr */
95 and %g7, %o2, %g2 72 and %g7, %o2, %g2
96 clr %o0 73 clr %o0
97 movrne %g2, 1, %o0 74 movrne %g2, 1, %o0
98 BITOP_POST_BARRIER
99 retl 75 retl
100 nop 76 nop
1012: BACKOFF_SPIN(%o3, %o4, 1b) 772: BACKOFF_SPIN(%o3, %o4, 1b)
diff --git a/arch/sparc64/lib/bzero.S b/arch/sparc/lib/bzero.S
index c7bbae8c590f..c7bbae8c590f 100644
--- a/arch/sparc64/lib/bzero.S
+++ b/arch/sparc/lib/bzero.S
diff --git a/arch/sparc/lib/checksum.S b/arch/sparc/lib/checksum_32.S
index 77f228533d47..77f228533d47 100644
--- a/arch/sparc/lib/checksum.S
+++ b/arch/sparc/lib/checksum_32.S
diff --git a/arch/sparc64/lib/checksum.S b/arch/sparc/lib/checksum_64.S
index 1d230f693dc4..1d230f693dc4 100644
--- a/arch/sparc64/lib/checksum.S
+++ b/arch/sparc/lib/checksum_64.S
diff --git a/arch/sparc64/lib/clear_page.S b/arch/sparc/lib/clear_page.S
index 77e531f6c2a7..77e531f6c2a7 100644
--- a/arch/sparc64/lib/clear_page.S
+++ b/arch/sparc/lib/clear_page.S
diff --git a/arch/sparc64/lib/copy_in_user.S b/arch/sparc/lib/copy_in_user.S
index 650af3f21f78..650af3f21f78 100644
--- a/arch/sparc64/lib/copy_in_user.S
+++ b/arch/sparc/lib/copy_in_user.S
diff --git a/arch/sparc64/lib/copy_page.S b/arch/sparc/lib/copy_page.S
index b243d3b606ba..b243d3b606ba 100644
--- a/arch/sparc64/lib/copy_page.S
+++ b/arch/sparc/lib/copy_page.S
diff --git a/arch/sparc64/lib/csum_copy.S b/arch/sparc/lib/csum_copy.S
index e566c770a0f6..e566c770a0f6 100644
--- a/arch/sparc64/lib/csum_copy.S
+++ b/arch/sparc/lib/csum_copy.S
diff --git a/arch/sparc64/lib/csum_copy_from_user.S b/arch/sparc/lib/csum_copy_from_user.S
index a22eddbe5dba..a22eddbe5dba 100644
--- a/arch/sparc64/lib/csum_copy_from_user.S
+++ b/arch/sparc/lib/csum_copy_from_user.S
diff --git a/arch/sparc64/lib/csum_copy_to_user.S b/arch/sparc/lib/csum_copy_to_user.S
index d5b12f441f02..d5b12f441f02 100644
--- a/arch/sparc64/lib/csum_copy_to_user.S
+++ b/arch/sparc/lib/csum_copy_to_user.S
diff --git a/arch/sparc64/lib/ipcsum.S b/arch/sparc/lib/ipcsum.S
index 58ca5b9a8778..58ca5b9a8778 100644
--- a/arch/sparc64/lib/ipcsum.S
+++ b/arch/sparc/lib/ipcsum.S
diff --git a/arch/sparc64/lib/mcount.S b/arch/sparc/lib/mcount.S
index 7ce9c65f3592..7ce9c65f3592 100644
--- a/arch/sparc64/lib/mcount.S
+++ b/arch/sparc/lib/mcount.S
diff --git a/arch/sparc/lib/memcmp.S b/arch/sparc/lib/memcmp.S
index cb4bdb0cc2af..efa106c41ed0 100644
--- a/arch/sparc/lib/memcmp.S
+++ b/arch/sparc/lib/memcmp.S
@@ -1,312 +1,27 @@
1 .text 1/* Sparc optimized memcmp code.
2 .align 4 2 *
3 .global __memcmp, memcmp 3 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
4__memcmp: 4 * Copyright (C) 2000, 2008 David S. Miller (davem@davemloft.net)
5memcmp: 5 */
6#if 1
7 cmp %o2, 0
8 ble L3
9 mov 0, %g3
10L5:
11 ldub [%o0], %g2
12 ldub [%o1], %g3
13 sub %g2, %g3, %g2
14 mov %g2, %g3
15 sll %g2, 24, %g2
16
17 cmp %g2, 0
18 bne L3
19 add %o0, 1, %o0
20 6
21 add %o2, -1, %o2 7#include <linux/linkage.h>
8#include <asm/asm.h>
22 9
10 .text
11ENTRY(memcmp)
23 cmp %o2, 0 12 cmp %o2, 0
24 bg L5 131: BRANCH32(be, pn, 2f)
25 add %o1, 1, %o1
26L3:
27 sll %g3, 24, %o0
28 sra %o0, 24, %o0
29
30 retl
31 nop 14 nop
32#else 15 ldub [%o0], %g7
33 save %sp, -104, %sp 16 ldub [%o1], %g3
34 mov %i2, %o4 17 sub %o2, 1, %o2
35 mov %i0, %o0
36
37 cmp %o4, 15
38 ble L72
39 mov %i1, %i2
40
41 andcc %i2, 3, %g0
42 be L161
43 andcc %o0, 3, %g2
44L75:
45 ldub [%o0], %g3
46 ldub [%i2], %g2
47 add %o0,1, %o0
48
49 subcc %g3, %g2, %i0
50 bne L156
51 add %i2, 1, %i2
52
53 andcc %i2, 3, %g0
54 bne L75
55 add %o4, -1, %o4
56
57 andcc %o0, 3, %g2
58L161:
59 bne,a L78
60 mov %i2, %i1
61
62 mov %o0, %i5
63 mov %i2, %i3
64 srl %o4, 2, %i4
65
66 cmp %i4, 0
67 bge L93
68 mov %i4, %g2
69
70 add %i4, 3, %g2
71L93:
72 sra %g2, 2, %g2
73 sll %g2, 2, %g2
74 sub %i4, %g2, %g2
75
76 cmp %g2, 1
77 be,a L88
78 add %o0, 4, %i5
79
80 bg L94
81 cmp %g2, 2
82
83 cmp %g2, 0
84 be,a L86
85 ld [%o0], %g3
86
87 b L162
88 ld [%i5], %g3
89L94:
90 be L81
91 cmp %g2, 3
92
93 be,a L83
94 add %o0, -4, %i5
95
96 b L162
97 ld [%i5], %g3
98L81:
99 add %o0, -8, %i5
100 ld [%o0], %g3
101 add %i2, -8, %i3
102 ld [%i2], %g2
103
104 b L82
105 add %i4, 2, %i4
106L83:
107 ld [%o0], %g4
108 add %i2, -4, %i3
109 ld [%i2], %g1
110
111 b L84
112 add %i4, 1, %i4
113L86:
114 b L87
115 ld [%i2], %g2
116L88:
117 add %i2, 4, %i3
118 ld [%o0], %g4
119 add %i4, -1, %i4
120 ld [%i2], %g1
121L95:
122 ld [%i5], %g3
123L162:
124 cmp %g4, %g1
125 be L87
126 ld [%i3], %g2
127
128 cmp %g4, %g1
129L163:
130 bleu L114
131 mov -1, %i0
132
133 b L114
134 mov 1, %i0
135L87:
136 ld [%i5 + 4], %g4
137 cmp %g3, %g2
138 bne L163
139 ld [%i3 + 4], %g1
140L84:
141 ld [%i5 + 8], %g3
142
143 cmp %g4, %g1
144 bne L163
145 ld [%i3 + 8], %g2
146L82:
147 ld [%i5 + 12], %g4
148 cmp %g3, %g2
149 bne L163
150 ld [%i3 + 12], %g1
151
152 add %i5, 16, %i5
153
154 addcc %i4, -4, %i4
155 bne L95
156 add %i3, 16, %i3
157
158 cmp %g4, %g1
159 bne L163
160 nop
161
162 b L114
163 mov 0, %i0
164L78:
165 srl %o4, 2, %i0
166 and %o0, -4, %i3
167 orcc %i0, %g0, %g3
168 sll %g2, 3, %o7
169 mov 32, %g2
170
171 bge L129
172 sub %g2, %o7, %o1
173
174 add %i0, 3, %g3
175L129:
176 sra %g3, 2, %g2
177 sll %g2, 2, %g2
178 sub %i0, %g2, %g2
179
180 cmp %g2, 1
181 be,a L124
182 ld [%i3], %o3
183
184 bg L130
185 cmp %g2, 2
186
187 cmp %g2, 0
188 be,a L122
189 ld [%i3], %o2
190
191 b L164
192 sll %o3, %o7, %g3
193L130:
194 be L117
195 cmp %g2, 3
196
197 be,a L119
198 ld [%i3], %g1
199
200 b L164
201 sll %o3, %o7, %g3
202L117:
203 ld [%i3], %g4
204 add %i2, -8, %i1
205 ld [%i3 + 4], %o3
206 add %i0, 2, %i0
207 ld [%i2], %i4
208
209 b L118
210 add %i3, -4, %i3
211L119:
212 ld [%i3 + 4], %g4
213 add %i2, -4, %i1
214 ld [%i2], %i5
215
216 b L120
217 add %i0, 1, %i0
218L122:
219 ld [%i3 + 4], %g1
220 ld [%i2], %i4
221
222 b L123
223 add %i3, 4, %i3
224L124:
225 add %i2, 4, %i1
226 ld [%i3 + 4], %o2
227 add %i0, -1, %i0
228 ld [%i2], %i5
229 add %i3, 8, %i3
230L131:
231 sll %o3, %o7, %g3
232L164:
233 srl %o2, %o1, %g2
234 ld [%i3], %g1
235 or %g3, %g2, %g3
236
237 cmp %g3, %i5
238 bne L163
239 ld [%i1], %i4
240L123:
241 sll %o2, %o7, %g3
242 srl %g1, %o1, %g2
243 ld [%i3 + 4], %g4
244 or %g3, %g2, %g3
245
246 cmp %g3, %i4
247 bne L163
248 ld [%i1 + 4], %i5
249L120:
250 sll %g1, %o7, %g3
251 srl %g4, %o1, %g2
252 ld [%i3 + 8], %o3
253 or %g3, %g2, %g3
254
255 cmp %g3, %i5
256 bne L163
257 ld [%i1 + 8], %i4
258L118:
259 sll %g4, %o7, %g3
260 srl %o3, %o1, %g2
261 ld [%i3 + 12], %o2
262 or %g3, %g2, %g3
263
264 cmp %g3, %i4
265 bne L163
266 ld [%i1 + 12], %i5
267
268 add %i3, 16, %i3
269 addcc %i0, -4, %i0
270 bne L131
271 add %i1, 16, %i1
272
273 sll %o3, %o7, %g3
274 srl %o2, %o1, %g2
275 or %g3, %g2, %g3
276
277 cmp %g3, %i5
278 be,a L114
279 mov 0, %i0
280
281 b,a L163
282L114:
283 cmp %i0, 0
284 bne L156
285 and %o4, -4, %g2
286
287 add %o0, %g2, %o0
288 add %i2, %g2, %i2
289 and %o4, 3, %o4
290L72:
291 cmp %o4, 0
292 be L156
293 mov 0, %i0
294
295 ldub [%o0], %g3
296L165:
297 ldub [%i2], %g2
298 add %o0, 1, %o0 18 add %o0, 1, %o0
299 19 add %o1, 1, %o1
300 subcc %g3, %g2, %i0 20 subcc %g7, %g3, %g3
301 bne L156 21 BRANCH32(be, pt, 1b)
302 add %i2, 1, %i2 22 cmp %o2, 0
303 23 retl
304 addcc %o4, -1, %o4 24 mov %g3, %o0
305 bne,a L165 252: retl
306 ldub [%o0], %g3 26 mov 0, %o0
307 27ENDPROC(memcmp)
308 mov 0, %i0
309L156:
310 ret
311 restore
312#endif
diff --git a/arch/sparc64/lib/memmove.S b/arch/sparc/lib/memmove.S
index 97395802c23c..97395802c23c 100644
--- a/arch/sparc64/lib/memmove.S
+++ b/arch/sparc/lib/memmove.S
diff --git a/arch/sparc/lib/memscan.S b/arch/sparc/lib/memscan_32.S
index 4ff1657dfc24..4ff1657dfc24 100644
--- a/arch/sparc/lib/memscan.S
+++ b/arch/sparc/lib/memscan_32.S
diff --git a/arch/sparc64/lib/memscan.S b/arch/sparc/lib/memscan_64.S
index 5686dfa5dc15..5686dfa5dc15 100644
--- a/arch/sparc64/lib/memscan.S
+++ b/arch/sparc/lib/memscan_64.S
diff --git a/arch/sparc/lib/rwsem.S b/arch/sparc/lib/rwsem_32.S
index 9675268e7fde..9675268e7fde 100644
--- a/arch/sparc/lib/rwsem.S
+++ b/arch/sparc/lib/rwsem_32.S
diff --git a/arch/sparc64/lib/rwsem.S b/arch/sparc/lib/rwsem_64.S
index 1a4cc5654de4..91a7d29a79d5 100644
--- a/arch/sparc64/lib/rwsem.S
+++ b/arch/sparc/lib/rwsem_64.S
@@ -17,7 +17,6 @@ __down_read:
17 bne,pn %icc, 1b 17 bne,pn %icc, 1b
18 add %g7, 1, %g7 18 add %g7, 1, %g7
19 cmp %g7, 0 19 cmp %g7, 0
20 membar #StoreLoad | #StoreStore
21 bl,pn %icc, 3f 20 bl,pn %icc, 3f
22 nop 21 nop
232: 222:
@@ -42,7 +41,6 @@ __down_read_trylock:
42 cmp %g1, %g7 41 cmp %g1, %g7
43 bne,pn %icc, 1b 42 bne,pn %icc, 1b
44 mov 1, %o1 43 mov 1, %o1
45 membar #StoreLoad | #StoreStore
462: retl 442: retl
47 mov %o1, %o0 45 mov %o1, %o0
48 .size __down_read_trylock, .-__down_read_trylock 46 .size __down_read_trylock, .-__down_read_trylock
@@ -58,7 +56,6 @@ __down_write:
58 cmp %g3, %g7 56 cmp %g3, %g7
59 bne,pn %icc, 1b 57 bne,pn %icc, 1b
60 cmp %g7, 0 58 cmp %g7, 0
61 membar #StoreLoad | #StoreStore
62 bne,pn %icc, 3f 59 bne,pn %icc, 3f
63 nop 60 nop
642: retl 612: retl
@@ -85,7 +82,6 @@ __down_write_trylock:
85 cmp %g3, %g7 82 cmp %g3, %g7
86 bne,pn %icc, 1b 83 bne,pn %icc, 1b
87 mov 1, %o1 84 mov 1, %o1
88 membar #StoreLoad | #StoreStore
892: retl 852: retl
90 mov %o1, %o0 86 mov %o1, %o0
91 .size __down_write_trylock, .-__down_write_trylock 87 .size __down_write_trylock, .-__down_write_trylock
@@ -99,7 +95,6 @@ __up_read:
99 cmp %g1, %g7 95 cmp %g1, %g7
100 bne,pn %icc, 1b 96 bne,pn %icc, 1b
101 cmp %g7, 0 97 cmp %g7, 0
102 membar #StoreLoad | #StoreStore
103 bl,pn %icc, 3f 98 bl,pn %icc, 3f
104 nop 99 nop
1052: retl 1002: retl
@@ -129,7 +124,6 @@ __up_write:
129 bne,pn %icc, 1b 124 bne,pn %icc, 1b
130 sub %g7, %g1, %g7 125 sub %g7, %g1, %g7
131 cmp %g7, 0 126 cmp %g7, 0
132 membar #StoreLoad | #StoreStore
133 bl,pn %icc, 3f 127 bl,pn %icc, 3f
134 nop 128 nop
1352: 1292:
@@ -155,7 +149,6 @@ __downgrade_write:
155 bne,pn %icc, 1b 149 bne,pn %icc, 1b
156 sub %g7, %g1, %g7 150 sub %g7, %g1, %g7
157 cmp %g7, 0 151 cmp %g7, 0
158 membar #StoreLoad | #StoreStore
159 bl,pn %icc, 3f 152 bl,pn %icc, 3f
160 nop 153 nop
1612: 1542:
diff --git a/arch/sparc/lib/strlen.S b/arch/sparc/lib/strlen.S
index ed9a763368cd..536f83507fbf 100644
--- a/arch/sparc/lib/strlen.S
+++ b/arch/sparc/lib/strlen.S
@@ -1,51 +1,40 @@
1/* strlen.S: Sparc optimized strlen code 1/* strlen.S: Sparc optimized strlen code
2 * Hand optimized from GNU libc's strlen 2 * Hand optimized from GNU libc's strlen
3 * Copyright (C) 1991,1996 Free Software Foundation 3 * Copyright (C) 1991,1996 Free Software Foundation
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1996,2008 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 5 * Copyright (C) 1996, 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
6 */ 6 */
7 7
8#include <linux/linkage.h>
9#include <asm/asm.h>
10
8#define LO_MAGIC 0x01010101 11#define LO_MAGIC 0x01010101
9#define HI_MAGIC 0x80808080 12#define HI_MAGIC 0x80808080
10 13
110: 14 .text
15ENTRY(strlen)
16 mov %o0, %o1
17 andcc %o0, 3, %g0
18 BRANCH32(be, pt, 9f)
19 sethi %hi(HI_MAGIC), %o4
12 ldub [%o0], %o5 20 ldub [%o0], %o5
13 cmp %o5, 0 21 BRANCH_REG_ZERO(pn, %o5, 11f)
14 be 1f
15 add %o0, 1, %o0 22 add %o0, 1, %o0
16 andcc %o0, 3, %g0 23 andcc %o0, 3, %g0
17 be 4f 24 BRANCH32(be, pn, 4f)
18 or %o4, %lo(HI_MAGIC), %o3 25 or %o4, %lo(HI_MAGIC), %o3
19 ldub [%o0], %o5 26 ldub [%o0], %o5
20 cmp %o5, 0 27 BRANCH_REG_ZERO(pn, %o5, 12f)
21 be 2f
22 add %o0, 1, %o0 28 add %o0, 1, %o0
23 andcc %o0, 3, %g0 29 andcc %o0, 3, %g0
24 be 5f 30 BRANCH32(be, pt, 5f)
25 sethi %hi(LO_MAGIC), %o4 31 sethi %hi(LO_MAGIC), %o4
26 ldub [%o0], %o5 32 ldub [%o0], %o5
27 cmp %o5, 0 33 BRANCH_REG_ZERO(pn, %o5, 13f)
28 be 3f
29 add %o0, 1, %o0 34 add %o0, 1, %o0
30 b 8f 35 BRANCH32(ba, pt, 8f)
31 or %o4, %lo(LO_MAGIC), %o2 36 or %o4, %lo(LO_MAGIC), %o2
321: 379:
33 retl
34 mov 0, %o0
352:
36 retl
37 mov 1, %o0
383:
39 retl
40 mov 2, %o0
41
42 .align 4
43 .global strlen
44strlen:
45 mov %o0, %o1
46 andcc %o0, 3, %g0
47 bne 0b
48 sethi %hi(HI_MAGIC), %o4
49 or %o4, %lo(HI_MAGIC), %o3 38 or %o4, %lo(HI_MAGIC), %o3
504: 394:
51 sethi %hi(LO_MAGIC), %o4 40 sethi %hi(LO_MAGIC), %o4
@@ -56,26 +45,36 @@ strlen:
562: 452:
57 sub %o5, %o2, %o4 46 sub %o5, %o2, %o4
58 andcc %o4, %o3, %g0 47 andcc %o4, %o3, %g0
59 be 8b 48 BRANCH32(be, pt, 8b)
60 add %o0, 4, %o0 49 add %o0, 4, %o0
61 50
62 /* Check every byte. */ 51 /* Check every byte. */
63 srl %o5, 24, %g5 52 srl %o5, 24, %g7
64 andcc %g5, 0xff, %g0 53 andcc %g7, 0xff, %g0
65 be 1f 54 BRANCH32(be, pn, 1f)
66 add %o0, -4, %o4 55 add %o0, -4, %o4
67 srl %o5, 16, %g5 56 srl %o5, 16, %g7
68 andcc %g5, 0xff, %g0 57 andcc %g7, 0xff, %g0
69 be 1f 58 BRANCH32(be, pn, 1f)
70 add %o4, 1, %o4 59 add %o4, 1, %o4
71 srl %o5, 8, %g5 60 srl %o5, 8, %g7
72 andcc %g5, 0xff, %g0 61 andcc %g7, 0xff, %g0
73 be 1f 62 BRANCH32(be, pn, 1f)
74 add %o4, 1, %o4 63 add %o4, 1, %o4
75 andcc %o5, 0xff, %g0 64 andcc %o5, 0xff, %g0
76 bne,a 2b 65 BRANCH32_ANNUL(bne, pt, 2b)
77 ld [%o0], %o5 66 ld [%o0], %o5
78 add %o4, 1, %o4 67 add %o4, 1, %o4
791: 681:
80 retl 69 retl
81 sub %o4, %o1, %o0 70 sub %o4, %o1, %o0
7111:
72 retl
73 mov 0, %o0
7412:
75 retl
76 mov 1, %o0
7713:
78 retl
79 mov 2, %o0
80ENDPROC(strlen)
diff --git a/arch/sparc/lib/strlen_user.S b/arch/sparc/lib/strlen_user_32.S
index 8c8a371df3c9..8c8a371df3c9 100644
--- a/arch/sparc/lib/strlen_user.S
+++ b/arch/sparc/lib/strlen_user_32.S
diff --git a/arch/sparc64/lib/strlen_user.S b/arch/sparc/lib/strlen_user_64.S
index 114ed111e251..114ed111e251 100644
--- a/arch/sparc64/lib/strlen_user.S
+++ b/arch/sparc/lib/strlen_user_64.S
diff --git a/arch/sparc/lib/strncmp.S b/arch/sparc/lib/strncmp_32.S
index 494ec664537a..494ec664537a 100644
--- a/arch/sparc/lib/strncmp.S
+++ b/arch/sparc/lib/strncmp_32.S
diff --git a/arch/sparc64/lib/strncmp.S b/arch/sparc/lib/strncmp_64.S
index 980e83751556..980e83751556 100644
--- a/arch/sparc64/lib/strncmp.S
+++ b/arch/sparc/lib/strncmp_64.S
diff --git a/arch/sparc/lib/strncpy_from_user.S b/arch/sparc/lib/strncpy_from_user_32.S
index d77198976a66..d77198976a66 100644
--- a/arch/sparc/lib/strncpy_from_user.S
+++ b/arch/sparc/lib/strncpy_from_user_32.S
diff --git a/arch/sparc64/lib/strncpy_from_user.S b/arch/sparc/lib/strncpy_from_user_64.S
index 511c8f136f95..511c8f136f95 100644
--- a/arch/sparc64/lib/strncpy_from_user.S
+++ b/arch/sparc/lib/strncpy_from_user_64.S
diff --git a/arch/sparc64/lib/user_fixup.c b/arch/sparc/lib/user_fixup.c
index 05a361b0a1a4..05a361b0a1a4 100644
--- a/arch/sparc64/lib/user_fixup.c
+++ b/arch/sparc/lib/user_fixup.c
diff --git a/arch/sparc64/lib/xor.S b/arch/sparc/lib/xor.S
index f44f58f40234..f44f58f40234 100644
--- a/arch/sparc64/lib/xor.S
+++ b/arch/sparc/lib/xor.S
diff --git a/arch/sparc/math-emu/Makefile b/arch/sparc/math-emu/Makefile
index 8136987977f4..b9085ecbb27b 100644
--- a/arch/sparc/math-emu/Makefile
+++ b/arch/sparc/math-emu/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the FPU instruction emulation. 2# Makefile for the FPU instruction emulation.
3# 3#
4 4
5obj-y := math.o 5# supress all warnings - as math.c produces a lot!
6ccflags-y := -w
6 7
7EXTRA_AFLAGS := -ansi 8obj-y := math_$(BITS).o
8EXTRA_CFLAGS = -I. -Iinclude/math-emu -w
diff --git a/arch/sparc/math-emu/ashldi3.S b/arch/sparc/math-emu/ashldi3.S
deleted file mode 100644
index 7230ff5c7aa1..000000000000
--- a/arch/sparc/math-emu/ashldi3.S
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * ashldi3.S: Math-emu code creates all kinds of references to
3 * this little routine on the sparc with gcc.
4 *
5 * Copyright (C) 1998 Jakub Jelinek(jj@ultra.linux.cz)
6 */
7
8#include <asm/cprefix.h>
9
10 .globl C_LABEL(__ashldi3)
11C_LABEL(__ashldi3):
12 tst %o2
13 be 3f
14 mov 32, %g2
15
16 sub %g2, %o2, %g2
17
18 tst %g2
19 bg 1f
20 srl %o1, %g2, %g3
21
22 clr %o5
23 neg %g2
24 ba 2f
25 sll %o1, %g2, %o4
26
271:
28 sll %o1, %o2, %o5
29 srl %o0, %o2, %g2
30 or %g2, %g3, %o4
312:
32 mov %o4, %o0
33 mov %o5, %o1
343:
35 jmpl %o7 + 8, %g0
36 nop
diff --git a/arch/sparc/math-emu/math.c b/arch/sparc/math-emu/math_32.c
index 8613b3eb877c..e13f65da17df 100644
--- a/arch/sparc/math-emu/math.c
+++ b/arch/sparc/math-emu/math_32.c
@@ -69,7 +69,7 @@
69#include <linux/mm.h> 69#include <linux/mm.h>
70#include <asm/uaccess.h> 70#include <asm/uaccess.h>
71 71
72#include "sfp-util.h" 72#include "sfp-util_32.h"
73#include <math-emu/soft-fp.h> 73#include <math-emu/soft-fp.h>
74#include <math-emu/single.h> 74#include <math-emu/single.h>
75#include <math-emu/double.h> 75#include <math-emu/double.h>
diff --git a/arch/sparc64/math-emu/math.c b/arch/sparc/math-emu/math_64.c
index add053e0f3b3..6863c9bde25c 100644
--- a/arch/sparc64/math-emu/math.c
+++ b/arch/sparc/math-emu/math_64.c
@@ -16,7 +16,7 @@
16#include <asm/ptrace.h> 16#include <asm/ptrace.h>
17#include <asm/uaccess.h> 17#include <asm/uaccess.h>
18 18
19#include "sfp-util.h" 19#include "sfp-util_64.h"
20#include <math-emu/soft-fp.h> 20#include <math-emu/soft-fp.h>
21#include <math-emu/single.h> 21#include <math-emu/single.h>
22#include <math-emu/double.h> 22#include <math-emu/double.h>
diff --git a/arch/sparc/math-emu/sfp-util.h b/arch/sparc/math-emu/sfp-util_32.h
index d1b2aff3c259..d1b2aff3c259 100644
--- a/arch/sparc/math-emu/sfp-util.h
+++ b/arch/sparc/math-emu/sfp-util_32.h
diff --git a/arch/sparc64/math-emu/sfp-util.h b/arch/sparc/math-emu/sfp-util_64.h
index 425d3cf01af4..425d3cf01af4 100644
--- a/arch/sparc64/math-emu/sfp-util.h
+++ b/arch/sparc/math-emu/sfp-util_64.h
diff --git a/arch/sparc/mm/Makefile b/arch/sparc/mm/Makefile
index ea88955d97ff..681abe0a4594 100644
--- a/arch/sparc/mm/Makefile
+++ b/arch/sparc/mm/Makefile
@@ -1,17 +1,25 @@
1# Makefile for the linux Sparc-specific parts of the memory manager. 1# Makefile for the linux Sparc-specific parts of the memory manager.
2# 2#
3 3
4EXTRA_AFLAGS := -ansi 4asflags-y := -ansi
5ccflags-y := -Werror
5 6
6obj-y := fault.o init.o loadmmu.o generic.o extable.o btfixup.o \ 7obj-$(CONFIG_SPARC64) += ultra.o tlb.o tsb.o
7 srmmu.o iommu.o io-unit.o hypersparc.o viking.o tsunami.o swift.o 8obj-y += fault_$(BITS).o
9obj-y += init_$(BITS).o
10obj-$(CONFIG_SPARC32) += loadmmu.o
11obj-y += generic_$(BITS).o
12obj-$(CONFIG_SPARC32) += extable.o btfixup.o srmmu.o iommu.o io-unit.o
13obj-$(CONFIG_SPARC32) += hypersparc.o viking.o tsunami.o swift.o
8 14
9ifdef CONFIG_HIGHMEM 15# Only used by sparc64
10obj-y += highmem.o 16obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
11endif 17
18# Only used by sparc32
19obj-$(CONFIG_HIGHMEM) += highmem.o
12 20
13ifdef CONFIG_SMP 21ifdef CONFIG_SMP
14obj-y += nosun4c.o 22obj-$(CONFIG_SPARC32) += nosun4c.o
15else 23else
16obj-y += sun4c.o 24obj-$(CONFIG_SPARC32) += sun4c.o
17endif 25endif
diff --git a/arch/sparc/mm/fault.c b/arch/sparc/mm/fault_32.c
index a507e1174662..a507e1174662 100644
--- a/arch/sparc/mm/fault.c
+++ b/arch/sparc/mm/fault_32.c
diff --git a/arch/sparc64/mm/fault.c b/arch/sparc/mm/fault_64.c
index a9e474bf6385..a9e474bf6385 100644
--- a/arch/sparc64/mm/fault.c
+++ b/arch/sparc/mm/fault_64.c
diff --git a/arch/sparc/mm/generic.c b/arch/sparc/mm/generic_32.c
index a289261da9fd..a289261da9fd 100644
--- a/arch/sparc/mm/generic.c
+++ b/arch/sparc/mm/generic_32.c
diff --git a/arch/sparc64/mm/generic.c b/arch/sparc/mm/generic_64.c
index f362c2037013..f362c2037013 100644
--- a/arch/sparc64/mm/generic.c
+++ b/arch/sparc/mm/generic_64.c
diff --git a/arch/sparc64/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
index f27d10369e0c..f27d10369e0c 100644
--- a/arch/sparc64/mm/hugetlbpage.c
+++ b/arch/sparc/mm/hugetlbpage.c
diff --git a/arch/sparc/mm/init.c b/arch/sparc/mm/init_32.c
index 677c1e187a23..fec926021f49 100644
--- a/arch/sparc/mm/init.c
+++ b/arch/sparc/mm/init_32.c
@@ -25,6 +25,7 @@
25#include <linux/pagemap.h> 25#include <linux/pagemap.h>
26#include <linux/poison.h> 26#include <linux/poison.h>
27 27
28#include <asm/sections.h>
28#include <asm/system.h> 29#include <asm/system.h>
29#include <asm/vac-ops.h> 30#include <asm/vac-ops.h>
30#include <asm/page.h> 31#include <asm/page.h>
@@ -48,9 +49,6 @@ unsigned long sparc_unmapped_base;
48 49
49struct pgtable_cache_struct pgt_quicklists; 50struct pgtable_cache_struct pgt_quicklists;
50 51
51/* References to section boundaries */
52extern char __init_begin, __init_end, _start, _end, etext , edata;
53
54/* Initial ramdisk setup */ 52/* Initial ramdisk setup */
55extern unsigned int sparc_ramdisk_image; 53extern unsigned int sparc_ramdisk_image;
56extern unsigned int sparc_ramdisk_size; 54extern unsigned int sparc_ramdisk_size;
@@ -450,9 +448,9 @@ void __init mem_init(void)
450 448
451 totalram_pages += totalhigh_pages; 449 totalram_pages += totalhigh_pages;
452 450
453 codepages = (((unsigned long) &etext) - ((unsigned long)&_start)); 451 codepages = (((unsigned long) &_etext) - ((unsigned long)&_start));
454 codepages = PAGE_ALIGN(codepages) >> PAGE_SHIFT; 452 codepages = PAGE_ALIGN(codepages) >> PAGE_SHIFT;
455 datapages = (((unsigned long) &edata) - ((unsigned long)&etext)); 453 datapages = (((unsigned long) &_edata) - ((unsigned long)&_etext));
456 datapages = PAGE_ALIGN(datapages) >> PAGE_SHIFT; 454 datapages = PAGE_ALIGN(datapages) >> PAGE_SHIFT;
457 initpages = (((unsigned long) &__init_end) - ((unsigned long) &__init_begin)); 455 initpages = (((unsigned long) &__init_end) - ((unsigned long) &__init_begin));
458 initpages = PAGE_ALIGN(initpages) >> PAGE_SHIFT; 456 initpages = PAGE_ALIGN(initpages) >> PAGE_SHIFT;
@@ -476,8 +474,10 @@ void __init mem_init(void)
476void free_initmem (void) 474void free_initmem (void)
477{ 475{
478 unsigned long addr; 476 unsigned long addr;
477 unsigned long freed;
479 478
480 addr = (unsigned long)(&__init_begin); 479 addr = (unsigned long)(&__init_begin);
480 freed = (unsigned long)(&__init_end) - addr;
481 for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { 481 for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
482 struct page *p; 482 struct page *p;
483 483
@@ -490,8 +490,8 @@ void free_initmem (void)
490 totalram_pages++; 490 totalram_pages++;
491 num_physpages++; 491 num_physpages++;
492 } 492 }
493 printk(KERN_INFO "Freeing unused kernel memory: %dk freed\n", 493 printk(KERN_INFO "Freeing unused kernel memory: %ldk freed\n",
494 (&__init_end - &__init_begin) >> 10); 494 freed >> 10);
495} 495}
496 496
497#ifdef CONFIG_BLK_DEV_INITRD 497#ifdef CONFIG_BLK_DEV_INITRD
diff --git a/arch/sparc64/mm/init.c b/arch/sparc/mm/init_64.c
index 185f34679110..6ea73da29312 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc/mm/init_64.c
@@ -50,7 +50,7 @@
50#include <asm/cpudata.h> 50#include <asm/cpudata.h>
51#include <asm/irq.h> 51#include <asm/irq.h>
52 52
53#include "init.h" 53#include "init_64.h"
54 54
55unsigned long kern_linear_pte_xor[2] __read_mostly; 55unsigned long kern_linear_pte_xor[2] __read_mostly;
56 56
@@ -214,7 +214,6 @@ static inline void set_dcache_dirty(struct page *page, int this_cpu)
214 "or %%g1, %0, %%g1\n\t" 214 "or %%g1, %0, %%g1\n\t"
215 "casx [%2], %%g7, %%g1\n\t" 215 "casx [%2], %%g7, %%g1\n\t"
216 "cmp %%g7, %%g1\n\t" 216 "cmp %%g7, %%g1\n\t"
217 "membar #StoreLoad | #StoreStore\n\t"
218 "bne,pn %%xcc, 1b\n\t" 217 "bne,pn %%xcc, 1b\n\t"
219 " nop" 218 " nop"
220 : /* no outputs */ 219 : /* no outputs */
@@ -236,7 +235,6 @@ static inline void clear_dcache_dirty_cpu(struct page *page, unsigned long cpu)
236 " andn %%g7, %1, %%g1\n\t" 235 " andn %%g7, %1, %%g1\n\t"
237 "casx [%2], %%g7, %%g1\n\t" 236 "casx [%2], %%g7, %%g1\n\t"
238 "cmp %%g7, %%g1\n\t" 237 "cmp %%g7, %%g1\n\t"
239 "membar #StoreLoad | #StoreStore\n\t"
240 "bne,pn %%xcc, 1b\n\t" 238 "bne,pn %%xcc, 1b\n\t"
241 " nop\n" 239 " nop\n"
242 "2:" 240 "2:"
@@ -956,7 +954,7 @@ int of_node_to_nid(struct device_node *dp)
956 return nid; 954 return nid;
957} 955}
958 956
959static void __init add_node_ranges(void) 957static void add_node_ranges(void)
960{ 958{
961 int i; 959 int i;
962 960
diff --git a/arch/sparc64/mm/init.h b/arch/sparc/mm/init_64.h
index 16063870a489..16063870a489 100644
--- a/arch/sparc64/mm/init.h
+++ b/arch/sparc/mm/init_64.h
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c
index daadf5f88050..005e758a4db7 100644
--- a/arch/sparc/mm/io-unit.c
+++ b/arch/sparc/mm/io-unit.c
@@ -156,8 +156,8 @@ static void iounit_get_scsi_sgl(struct device *dev, struct scatterlist *sg, int
156 spin_lock_irqsave(&iounit->lock, flags); 156 spin_lock_irqsave(&iounit->lock, flags);
157 while (sz != 0) { 157 while (sz != 0) {
158 --sz; 158 --sz;
159 sg->dvma_address = iounit_get_area(iounit, (unsigned long) sg_virt(sg), sg->length); 159 sg->dma_address = iounit_get_area(iounit, (unsigned long) sg_virt(sg), sg->length);
160 sg->dvma_length = sg->length; 160 sg->dma_length = sg->length;
161 sg = sg_next(sg); 161 sg = sg_next(sg);
162 } 162 }
163 spin_unlock_irqrestore(&iounit->lock, flags); 163 spin_unlock_irqrestore(&iounit->lock, flags);
@@ -186,8 +186,8 @@ static void iounit_release_scsi_sgl(struct device *dev, struct scatterlist *sg,
186 spin_lock_irqsave(&iounit->lock, flags); 186 spin_lock_irqsave(&iounit->lock, flags);
187 while (sz != 0) { 187 while (sz != 0) {
188 --sz; 188 --sz;
189 len = ((sg->dvma_address & ~PAGE_MASK) + sg->length + (PAGE_SIZE-1)) >> PAGE_SHIFT; 189 len = ((sg->dma_address & ~PAGE_MASK) + sg->length + (PAGE_SIZE-1)) >> PAGE_SHIFT;
190 vaddr = (sg->dvma_address - IOUNIT_DMA_BASE) >> PAGE_SHIFT; 190 vaddr = (sg->dma_address - IOUNIT_DMA_BASE) >> PAGE_SHIFT;
191 IOD(("iounit_release %08lx-%08lx\n", (long)vaddr, (long)len+vaddr)); 191 IOD(("iounit_release %08lx-%08lx\n", (long)vaddr, (long)len+vaddr));
192 for (len += vaddr; vaddr < len; vaddr++) 192 for (len += vaddr; vaddr < len; vaddr++)
193 clear_bit(vaddr, iounit->bmap); 193 clear_bit(vaddr, iounit->bmap);
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c
index e7a499e3aa3c..b2e6e73888b5 100644
--- a/arch/sparc/mm/iommu.c
+++ b/arch/sparc/mm/iommu.c
@@ -245,8 +245,8 @@ static void iommu_get_scsi_sgl_noflush(struct device *dev, struct scatterlist *s
245 while (sz != 0) { 245 while (sz != 0) {
246 --sz; 246 --sz;
247 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT; 247 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT;
248 sg->dvma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset; 248 sg->dma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset;
249 sg->dvma_length = (__u32) sg->length; 249 sg->dma_length = sg->length;
250 sg = sg_next(sg); 250 sg = sg_next(sg);
251 } 251 }
252} 252}
@@ -259,8 +259,8 @@ static void iommu_get_scsi_sgl_gflush(struct device *dev, struct scatterlist *sg
259 while (sz != 0) { 259 while (sz != 0) {
260 --sz; 260 --sz;
261 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT; 261 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT;
262 sg->dvma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset; 262 sg->dma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset;
263 sg->dvma_length = (__u32) sg->length; 263 sg->dma_length = sg->length;
264 sg = sg_next(sg); 264 sg = sg_next(sg);
265 } 265 }
266} 266}
@@ -290,8 +290,8 @@ static void iommu_get_scsi_sgl_pflush(struct device *dev, struct scatterlist *sg
290 } 290 }
291 } 291 }
292 292
293 sg->dvma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset; 293 sg->dma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset;
294 sg->dvma_length = (__u32) sg->length; 294 sg->dma_length = sg->length;
295 sg = sg_next(sg); 295 sg = sg_next(sg);
296 } 296 }
297} 297}
@@ -330,8 +330,8 @@ static void iommu_release_scsi_sgl(struct device *dev, struct scatterlist *sg, i
330 --sz; 330 --sz;
331 331
332 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT; 332 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT;
333 iommu_release_one(dev, sg->dvma_address & PAGE_MASK, n); 333 iommu_release_one(dev, sg->dma_address & PAGE_MASK, n);
334 sg->dvma_address = 0x21212121; 334 sg->dma_address = 0x21212121;
335 sg = sg_next(sg); 335 sg = sg_next(sg);
336 } 336 }
337} 337}
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index dd8aa36f366c..fe7ed08390bb 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -1312,10 +1312,8 @@ void __init srmmu_paging_init(void)
1312#endif 1312#endif
1313 poke_srmmu(); 1313 poke_srmmu();
1314 1314
1315#ifdef CONFIG_SUN_IO
1316 srmmu_allocate_ptable_skeleton(sparc_iomap.start, IOBASE_END); 1315 srmmu_allocate_ptable_skeleton(sparc_iomap.start, IOBASE_END);
1317 srmmu_allocate_ptable_skeleton(DVMA_VADDR, DVMA_END); 1316 srmmu_allocate_ptable_skeleton(DVMA_VADDR, DVMA_END);
1318#endif
1319 1317
1320 srmmu_allocate_ptable_skeleton( 1318 srmmu_allocate_ptable_skeleton(
1321 __fix_to_virt(__end_of_fixed_addresses - 1), FIXADDR_TOP); 1319 __fix_to_virt(__end_of_fixed_addresses - 1), FIXADDR_TOP);
@@ -1916,18 +1914,6 @@ static void __cpuinit poke_viking(void)
1916 mreg |= VIKING_SBENABLE; 1914 mreg |= VIKING_SBENABLE;
1917 mreg &= ~(VIKING_ACENABLE); 1915 mreg &= ~(VIKING_ACENABLE);
1918 srmmu_set_mmureg(mreg); 1916 srmmu_set_mmureg(mreg);
1919
1920#ifdef CONFIG_SMP
1921 /* Avoid unnecessary cross calls. */
1922 BTFIXUPCOPY_CALL(flush_cache_all, local_flush_cache_all);
1923 BTFIXUPCOPY_CALL(flush_cache_mm, local_flush_cache_mm);
1924 BTFIXUPCOPY_CALL(flush_cache_range, local_flush_cache_range);
1925 BTFIXUPCOPY_CALL(flush_cache_page, local_flush_cache_page);
1926 BTFIXUPCOPY_CALL(__flush_page_to_ram, local_flush_page_to_ram);
1927 BTFIXUPCOPY_CALL(flush_sig_insns, local_flush_sig_insns);
1928 BTFIXUPCOPY_CALL(flush_page_for_dma, local_flush_page_for_dma);
1929 btfixup();
1930#endif
1931} 1917}
1932 1918
1933static void __init init_viking(void) 1919static void __init init_viking(void)
@@ -2272,6 +2258,17 @@ void __init ld_mmu_srmmu(void)
2272 BTFIXUPSET_CALL(__flush_page_to_ram, smp_flush_page_to_ram, BTFIXUPCALL_NORM); 2258 BTFIXUPSET_CALL(__flush_page_to_ram, smp_flush_page_to_ram, BTFIXUPCALL_NORM);
2273 BTFIXUPSET_CALL(flush_sig_insns, smp_flush_sig_insns, BTFIXUPCALL_NORM); 2259 BTFIXUPSET_CALL(flush_sig_insns, smp_flush_sig_insns, BTFIXUPCALL_NORM);
2274 BTFIXUPSET_CALL(flush_page_for_dma, smp_flush_page_for_dma, BTFIXUPCALL_NORM); 2260 BTFIXUPSET_CALL(flush_page_for_dma, smp_flush_page_for_dma, BTFIXUPCALL_NORM);
2261
2262 if (poke_srmmu == poke_viking) {
2263 /* Avoid unnecessary cross calls. */
2264 BTFIXUPCOPY_CALL(flush_cache_all, local_flush_cache_all);
2265 BTFIXUPCOPY_CALL(flush_cache_mm, local_flush_cache_mm);
2266 BTFIXUPCOPY_CALL(flush_cache_range, local_flush_cache_range);
2267 BTFIXUPCOPY_CALL(flush_cache_page, local_flush_cache_page);
2268 BTFIXUPCOPY_CALL(__flush_page_to_ram, local_flush_page_to_ram);
2269 BTFIXUPCOPY_CALL(flush_sig_insns, local_flush_sig_insns);
2270 BTFIXUPCOPY_CALL(flush_page_for_dma, local_flush_page_for_dma);
2271 }
2275#endif 2272#endif
2276 2273
2277 if (sparc_cpu_model == sun4d) 2274 if (sparc_cpu_model == sun4d)
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
index fe65aeeb3947..2ffacd67c424 100644
--- a/arch/sparc/mm/sun4c.c
+++ b/arch/sparc/mm/sun4c.c
@@ -18,6 +18,7 @@
18#include <linux/seq_file.h> 18#include <linux/seq_file.h>
19#include <linux/scatterlist.h> 19#include <linux/scatterlist.h>
20 20
21#include <asm/sections.h>
21#include <asm/page.h> 22#include <asm/page.h>
22#include <asm/pgalloc.h> 23#include <asm/pgalloc.h>
23#include <asm/pgtable.h> 24#include <asm/pgtable.h>
@@ -240,9 +241,7 @@ void sun4c_complete_all_stores(void)
240 241
241 _unused = sun4c_get_context(); 242 _unused = sun4c_get_context();
242 sun4c_set_context(_unused); 243 sun4c_set_context(_unused);
243#ifdef CONFIG_SUN_AUXIO
244 _unused = get_auxio(); 244 _unused = get_auxio();
245#endif
246} 245}
247 246
248/* Bootup utility functions. */ 247/* Bootup utility functions. */
@@ -1124,8 +1123,8 @@ static void sun4c_get_scsi_sgl(struct device *dev, struct scatterlist *sg, int s
1124{ 1123{
1125 while (sz != 0) { 1124 while (sz != 0) {
1126 --sz; 1125 --sz;
1127 sg->dvma_address = (__u32)sun4c_lockarea(sg_virt(sg), sg->length); 1126 sg->dma_address = (__u32)sun4c_lockarea(sg_virt(sg), sg->length);
1128 sg->dvma_length = sg->length; 1127 sg->dma_length = sg->length;
1129 sg = sg_next(sg); 1128 sg = sg_next(sg);
1130 } 1129 }
1131} 1130}
@@ -1141,7 +1140,7 @@ static void sun4c_release_scsi_sgl(struct device *dev, struct scatterlist *sg, i
1141{ 1140{
1142 while (sz != 0) { 1141 while (sz != 0) {
1143 --sz; 1142 --sz;
1144 sun4c_unlockarea((char *)sg->dvma_address, sg->length); 1143 sun4c_unlockarea((char *)sg->dma_address, sg->length);
1145 sg = sg_next(sg); 1144 sg = sg_next(sg);
1146 } 1145 }
1147} 1146}
@@ -1953,7 +1952,6 @@ void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, p
1953} 1952}
1954 1953
1955extern void sparc_context_init(int); 1954extern void sparc_context_init(int);
1956extern unsigned long end;
1957extern unsigned long bootmem_init(unsigned long *pages_avail); 1955extern unsigned long bootmem_init(unsigned long *pages_avail);
1958extern unsigned long last_valid_pfn; 1956extern unsigned long last_valid_pfn;
1959 1957
@@ -1964,7 +1962,7 @@ void __init sun4c_paging_init(void)
1964 extern struct resource sparc_iomap; 1962 extern struct resource sparc_iomap;
1965 unsigned long end_pfn, pages_avail; 1963 unsigned long end_pfn, pages_avail;
1966 1964
1967 kernel_end = (unsigned long) &end; 1965 kernel_end = (unsigned long) &_end;
1968 kernel_end = SUN4C_REAL_PGDIR_ALIGN(kernel_end); 1966 kernel_end = SUN4C_REAL_PGDIR_ALIGN(kernel_end);
1969 1967
1970 pages_avail = 0; 1968 pages_avail = 0;
diff --git a/arch/sparc64/mm/tlb.c b/arch/sparc/mm/tlb.c
index d8f21e24a82f..d8f21e24a82f 100644
--- a/arch/sparc64/mm/tlb.c
+++ b/arch/sparc/mm/tlb.c
diff --git a/arch/sparc64/mm/tsb.c b/arch/sparc/mm/tsb.c
index 587f8efb2e05..36a0813f9517 100644
--- a/arch/sparc64/mm/tsb.c
+++ b/arch/sparc/mm/tsb.c
@@ -41,10 +41,8 @@ void flush_tsb_kernel_range(unsigned long start, unsigned long end)
41 KERNEL_TSB_NENTRIES); 41 KERNEL_TSB_NENTRIES);
42 struct tsb *ent = &swapper_tsb[hash]; 42 struct tsb *ent = &swapper_tsb[hash];
43 43
44 if (tag_compare(ent->tag, v)) { 44 if (tag_compare(ent->tag, v))
45 ent->tag = (1UL << TSB_TAG_INVALID_BIT); 45 ent->tag = (1UL << TSB_TAG_INVALID_BIT);
46 membar_storeload_storestore();
47 }
48 } 46 }
49} 47}
50 48
@@ -267,6 +265,18 @@ void __init pgtable_cache_init(void)
267 } 265 }
268} 266}
269 267
268int sysctl_tsb_ratio = -2;
269
270static unsigned long tsb_size_to_rss_limit(unsigned long new_size)
271{
272 unsigned long num_ents = (new_size / sizeof(struct tsb));
273
274 if (sysctl_tsb_ratio < 0)
275 return num_ents - (num_ents >> -sysctl_tsb_ratio);
276 else
277 return num_ents + (num_ents >> sysctl_tsb_ratio);
278}
279
270/* When the RSS of an address space exceeds tsb_rss_limit for a TSB, 280/* When the RSS of an address space exceeds tsb_rss_limit for a TSB,
271 * do_sparc64_fault() invokes this routine to try and grow it. 281 * do_sparc64_fault() invokes this routine to try and grow it.
272 * 282 *
@@ -297,19 +307,14 @@ void tsb_grow(struct mm_struct *mm, unsigned long tsb_index, unsigned long rss)
297 307
298 new_cache_index = 0; 308 new_cache_index = 0;
299 for (new_size = 8192; new_size < max_tsb_size; new_size <<= 1UL) { 309 for (new_size = 8192; new_size < max_tsb_size; new_size <<= 1UL) {
300 unsigned long n_entries = new_size / sizeof(struct tsb); 310 new_rss_limit = tsb_size_to_rss_limit(new_size);
301 311 if (new_rss_limit > rss)
302 n_entries = (n_entries * 3) / 4;
303 if (n_entries > rss)
304 break; 312 break;
305
306 new_cache_index++; 313 new_cache_index++;
307 } 314 }
308 315
309 if (new_size == max_tsb_size) 316 if (new_size == max_tsb_size)
310 new_rss_limit = ~0UL; 317 new_rss_limit = ~0UL;
311 else
312 new_rss_limit = ((new_size / sizeof(struct tsb)) * 3) / 4;
313 318
314retry_tsb_alloc: 319retry_tsb_alloc:
315 gfp_flags = GFP_KERNEL; 320 gfp_flags = GFP_KERNEL;
diff --git a/arch/sparc64/mm/ultra.S b/arch/sparc/mm/ultra.S
index 86773e89dc1b..80c788ec7c32 100644
--- a/arch/sparc64/mm/ultra.S
+++ b/arch/sparc/mm/ultra.S
@@ -125,7 +125,6 @@ __spitfire_flush_tlb_mm_slow:
125 .align 32 125 .align 32
126 .globl __flush_icache_page 126 .globl __flush_icache_page
127__flush_icache_page: /* %o0 = phys_page */ 127__flush_icache_page: /* %o0 = phys_page */
128 membar #StoreStore
129 srlx %o0, PAGE_SHIFT, %o0 128 srlx %o0, PAGE_SHIFT, %o0
130 sethi %uhi(PAGE_OFFSET), %g1 129 sethi %uhi(PAGE_OFFSET), %g1
131 sllx %o0, PAGE_SHIFT, %o0 130 sllx %o0, PAGE_SHIFT, %o0
@@ -467,7 +466,7 @@ xcall_sync_tick:
467 .previous 466 .previous
468 467
469 rdpr %pil, %g2 468 rdpr %pil, %g2
470 wrpr %g0, 15, %pil 469 wrpr %g0, PIL_NORMAL_MAX, %pil
471 sethi %hi(109f), %g7 470 sethi %hi(109f), %g7
472 b,pt %xcc, etrap_irq 471 b,pt %xcc, etrap_irq
473109: or %g7, %lo(109b), %g7 472109: or %g7, %lo(109b), %g7
@@ -507,7 +506,6 @@ xcall_fetch_glob_regs:
507 sllx %g2, TRAP_BLOCK_SZ_SHIFT, %g2 506 sllx %g2, TRAP_BLOCK_SZ_SHIFT, %g2
508 add %g7, %g2, %g7 507 add %g7, %g2, %g7
509 ldx [%g7 + TRAP_PER_CPU_THREAD], %g3 508 ldx [%g7 + TRAP_PER_CPU_THREAD], %g3
510 membar #StoreStore
511 stx %g3, [%g1 + GR_SNAP_THREAD] 509 stx %g3, [%g1 + GR_SNAP_THREAD]
512 retry 510 retry
513 511
@@ -690,7 +688,7 @@ xcall_kgdb_capture:
690 .previous 688 .previous
691 689
692 rdpr %pil, %g2 690 rdpr %pil, %g2
693 wrpr %g0, 15, %pil 691 wrpr %g0, PIL_NORMAL_MAX, %pil
694 sethi %hi(109f), %g7 692 sethi %hi(109f), %g7
695 ba,pt %xcc, etrap_irq 693 ba,pt %xcc, etrap_irq
696109: or %g7, %lo(109b), %g7 694109: or %g7, %lo(109b), %g7
diff --git a/arch/sparc/oprofile/init.c b/arch/sparc/oprofile/init.c
index 17bb6035069b..d6e170c074fc 100644
--- a/arch/sparc/oprofile/init.c
+++ b/arch/sparc/oprofile/init.c
@@ -12,12 +12,239 @@
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/init.h> 13#include <linux/init.h>
14 14
15#ifdef CONFIG_SPARC64
16#include <asm/hypervisor.h>
17#include <asm/spitfire.h>
18#include <asm/cpudata.h>
19#include <asm/irq.h>
20
21static int nmi_enabled;
22
23struct pcr_ops {
24 u64 (*read)(void);
25 void (*write)(u64);
26};
27static const struct pcr_ops *pcr_ops;
28
29static u64 direct_pcr_read(void)
30{
31 u64 val;
32
33 read_pcr(val);
34 return val;
35}
36
37static void direct_pcr_write(u64 val)
38{
39 write_pcr(val);
40}
41
42static const struct pcr_ops direct_pcr_ops = {
43 .read = direct_pcr_read,
44 .write = direct_pcr_write,
45};
46
47static void n2_pcr_write(u64 val)
48{
49 unsigned long ret;
50
51 ret = sun4v_niagara2_setperf(HV_N2_PERF_SPARC_CTL, val);
52 if (val != HV_EOK)
53 write_pcr(val);
54}
55
56static const struct pcr_ops n2_pcr_ops = {
57 .read = direct_pcr_read,
58 .write = n2_pcr_write,
59};
60
61/* In order to commonize as much of the implementation as
62 * possible, we use PICH as our counter. Mostly this is
63 * to accomodate Niagara-1 which can only count insn cycles
64 * in PICH.
65 */
66static u64 picl_value(void)
67{
68 u32 delta = local_cpu_data().clock_tick / HZ;
69
70 return ((u64)((0 - delta) & 0xffffffff)) << 32;
71}
72
73#define PCR_PIC_PRIV 0x00000001 /* PIC access is privileged */
74#define PCR_STRACE 0x00000002 /* Trace supervisor events */
75#define PCR_UTRACE 0x00000004 /* Trace user events */
76#define PCR_N2_HTRACE 0x00000008 /* Trace hypervisor events */
77#define PCR_N2_TOE_OV0 0x00000010 /* Trap if PIC 0 overflows */
78#define PCR_N2_TOE_OV1 0x00000020 /* Trap if PIC 1 overflows */
79#define PCR_N2_MASK0 0x00003fc0
80#define PCR_N2_MASK0_SHIFT 6
81#define PCR_N2_SL0 0x0003c000
82#define PCR_N2_SL0_SHIFT 14
83#define PCR_N2_OV0 0x00040000
84#define PCR_N2_MASK1 0x07f80000
85#define PCR_N2_MASK1_SHIFT 19
86#define PCR_N2_SL1 0x78000000
87#define PCR_N2_SL1_SHIFT 27
88#define PCR_N2_OV1 0x80000000
89
90#define PCR_SUN4U_ENABLE (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE)
91#define PCR_N2_ENABLE (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE | \
92 PCR_N2_TOE_OV1 | \
93 (2 << PCR_N2_SL1_SHIFT) | \
94 (0xff << PCR_N2_MASK1_SHIFT))
95
96static u64 pcr_enable = PCR_SUN4U_ENABLE;
97
98static void nmi_handler(struct pt_regs *regs)
99{
100 pcr_ops->write(PCR_PIC_PRIV);
101
102 if (nmi_enabled) {
103 oprofile_add_sample(regs, 0);
104
105 write_pic(picl_value());
106 pcr_ops->write(pcr_enable);
107 }
108}
109
110/* We count "clock cycle" events in the lower 32-bit PIC.
111 * Then configure it such that it overflows every HZ, and thus
112 * generates a level 15 interrupt at that frequency.
113 */
114static void cpu_nmi_start(void *_unused)
115{
116 pcr_ops->write(PCR_PIC_PRIV);
117 write_pic(picl_value());
118
119 pcr_ops->write(pcr_enable);
120}
121
122static void cpu_nmi_stop(void *_unused)
123{
124 pcr_ops->write(PCR_PIC_PRIV);
125}
126
127static int nmi_start(void)
128{
129 int err = register_perfctr_intr(nmi_handler);
130
131 if (!err) {
132 nmi_enabled = 1;
133 wmb();
134 err = on_each_cpu(cpu_nmi_start, NULL, 1);
135 if (err) {
136 nmi_enabled = 0;
137 wmb();
138 on_each_cpu(cpu_nmi_stop, NULL, 1);
139 release_perfctr_intr(nmi_handler);
140 }
141 }
142
143 return err;
144}
145
146static void nmi_stop(void)
147{
148 nmi_enabled = 0;
149 wmb();
150
151 on_each_cpu(cpu_nmi_stop, NULL, 1);
152 release_perfctr_intr(nmi_handler);
153 synchronize_sched();
154}
155
156static unsigned long perf_hsvc_group;
157static unsigned long perf_hsvc_major;
158static unsigned long perf_hsvc_minor;
159
160static int __init register_perf_hsvc(void)
161{
162 if (tlb_type == hypervisor) {
163 switch (sun4v_chip_type) {
164 case SUN4V_CHIP_NIAGARA1:
165 perf_hsvc_group = HV_GRP_NIAG_PERF;
166 break;
167
168 case SUN4V_CHIP_NIAGARA2:
169 perf_hsvc_group = HV_GRP_N2_CPU;
170 break;
171
172 default:
173 return -ENODEV;
174 }
175
176
177 perf_hsvc_major = 1;
178 perf_hsvc_minor = 0;
179 if (sun4v_hvapi_register(perf_hsvc_group,
180 perf_hsvc_major,
181 &perf_hsvc_minor)) {
182 printk("perfmon: Could not register N2 hvapi.\n");
183 return -ENODEV;
184 }
185 }
186 return 0;
187}
188
189static void unregister_perf_hsvc(void)
190{
191 if (tlb_type != hypervisor)
192 return;
193 sun4v_hvapi_unregister(perf_hsvc_group);
194}
195
196static int oprofile_nmi_init(struct oprofile_operations *ops)
197{
198 int err = register_perf_hsvc();
199
200 if (err)
201 return err;
202
203 switch (tlb_type) {
204 case hypervisor:
205 pcr_ops = &n2_pcr_ops;
206 pcr_enable = PCR_N2_ENABLE;
207 break;
208
209 case cheetah:
210 case cheetah_plus:
211 pcr_ops = &direct_pcr_ops;
212 break;
213
214 default:
215 return -ENODEV;
216 }
217
218 ops->create_files = NULL;
219 ops->setup = NULL;
220 ops->shutdown = NULL;
221 ops->start = nmi_start;
222 ops->stop = nmi_stop;
223 ops->cpu_type = "timer";
224
225 printk(KERN_INFO "oprofile: Using perfctr based NMI timer interrupt.\n");
226
227 return 0;
228}
229#endif
230
15int __init oprofile_arch_init(struct oprofile_operations *ops) 231int __init oprofile_arch_init(struct oprofile_operations *ops)
16{ 232{
17 return -ENODEV; 233 int ret = -ENODEV;
234
235#ifdef CONFIG_SPARC64
236 ret = oprofile_nmi_init(ops);
237 if (!ret)
238 return ret;
239#endif
240
241 return ret;
18} 242}
19 243
20 244
21void oprofile_arch_exit(void) 245void oprofile_arch_exit(void)
22{ 246{
247#ifdef CONFIG_SPARC64
248 unregister_perf_hsvc();
249#endif
23} 250}
diff --git a/arch/sparc/prom/Makefile b/arch/sparc/prom/Makefile
index 8f7e18546c97..1b8c073adb44 100644
--- a/arch/sparc/prom/Makefile
+++ b/arch/sparc/prom/Makefile
@@ -1,6 +1,21 @@
1# Makefile for the Sun Boot PROM interface library under 1# Makefile for the Sun Boot PROM interface library under
2# Linux. 2# Linux.
3# 3#
4asflags := -ansi
5ccflags := -Werror
4 6
5lib-y := bootstr.o devmap.o devops.o init.o memory.o misc.o mp.o \ 7lib-y := bootstr_$(BITS).o
6 palloc.o ranges.o segment.o console.o printf.o tree.o 8lib-$(CONFIG_SPARC32) += devmap.o
9lib-y += devops_$(BITS).o
10lib-y += init_$(BITS).o
11lib-$(CONFIG_SPARC32) += memory.o
12lib-y += misc_$(BITS).o
13lib-$(CONFIG_SPARC32) += mp.o
14lib-$(CONFIG_SPARC32) += palloc.o
15lib-$(CONFIG_SPARC32) += ranges.o
16lib-$(CONFIG_SPARC32) += segment.o
17lib-y += console_$(BITS).o
18lib-y += printf.o
19lib-y += tree_$(BITS).o
20lib-$(CONFIG_SPARC64) += p1275.o
21lib-$(CONFIG_SPARC64) += cif.o
diff --git a/arch/sparc/prom/bootstr.c b/arch/sparc/prom/bootstr_32.c
index 916831da7e67..916831da7e67 100644
--- a/arch/sparc/prom/bootstr.c
+++ b/arch/sparc/prom/bootstr_32.c
diff --git a/arch/sparc64/prom/bootstr.c b/arch/sparc/prom/bootstr_64.c
index ab9ccc63b388..ab9ccc63b388 100644
--- a/arch/sparc64/prom/bootstr.c
+++ b/arch/sparc/prom/bootstr_64.c
diff --git a/arch/sparc64/prom/cif.S b/arch/sparc/prom/cif.S
index 5f27ad779c0c..5f27ad779c0c 100644
--- a/arch/sparc64/prom/cif.S
+++ b/arch/sparc/prom/cif.S
diff --git a/arch/sparc/prom/console.c b/arch/sparc/prom/console_32.c
index b3075d73fc19..b3075d73fc19 100644
--- a/arch/sparc/prom/console.c
+++ b/arch/sparc/prom/console_32.c
diff --git a/arch/sparc64/prom/console.c b/arch/sparc/prom/console_64.c
index e1c3fc87484d..e1c3fc87484d 100644
--- a/arch/sparc64/prom/console.c
+++ b/arch/sparc/prom/console_64.c
diff --git a/arch/sparc/prom/devops.c b/arch/sparc/prom/devops_32.c
index 9f1a95c91ad1..9f1a95c91ad1 100644
--- a/arch/sparc/prom/devops.c
+++ b/arch/sparc/prom/devops_32.c
diff --git a/arch/sparc64/prom/devops.c b/arch/sparc/prom/devops_64.c
index 9dbd803e46e1..9dbd803e46e1 100644
--- a/arch/sparc64/prom/devops.c
+++ b/arch/sparc/prom/devops_64.c
diff --git a/arch/sparc/prom/init.c b/arch/sparc/prom/init_32.c
index 873217c6d823..873217c6d823 100644
--- a/arch/sparc/prom/init.c
+++ b/arch/sparc/prom/init_32.c
diff --git a/arch/sparc64/prom/init.c b/arch/sparc/prom/init_64.c
index 7b00f89490a4..7b00f89490a4 100644
--- a/arch/sparc64/prom/init.c
+++ b/arch/sparc/prom/init_64.c
diff --git a/arch/sparc/prom/misc.c b/arch/sparc/prom/misc_32.c
index 49b5057b9601..cf6c3f6d36c3 100644
--- a/arch/sparc/prom/misc.c
+++ b/arch/sparc/prom/misc_32.c
@@ -61,9 +61,7 @@ prom_cmdline(void)
61 restore_current(); 61 restore_current();
62 install_linux_ticker(); 62 install_linux_ticker();
63 spin_unlock_irqrestore(&prom_lock, flags); 63 spin_unlock_irqrestore(&prom_lock, flags);
64#ifdef CONFIG_SUN_AUXIO
65 set_auxio(AUXIO_LED, 0); 64 set_auxio(AUXIO_LED, 0);
66#endif
67} 65}
68 66
69/* Drop into the prom, but completely terminate the program. 67/* Drop into the prom, but completely terminate the program.
diff --git a/arch/sparc64/prom/misc.c b/arch/sparc/prom/misc_64.c
index 9b0c0760901e..9b0c0760901e 100644
--- a/arch/sparc64/prom/misc.c
+++ b/arch/sparc/prom/misc_64.c
diff --git a/arch/sparc64/prom/p1275.c b/arch/sparc/prom/p1275.c
index 4b7c937bba61..4b7c937bba61 100644
--- a/arch/sparc64/prom/p1275.c
+++ b/arch/sparc/prom/p1275.c
diff --git a/arch/sparc/prom/printf.c b/arch/sparc/prom/printf.c
index a36ab9c5ee08..660943ee4c2a 100644
--- a/arch/sparc/prom/printf.c
+++ b/arch/sparc/prom/printf.c
@@ -2,6 +2,7 @@
2 * printf.c: Internal prom library printf facility. 2 * printf.c: Internal prom library printf facility.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
5 * Copyright (c) 2002 Pete Zaitcev (zaitcev@yahoo.com) 6 * Copyright (c) 2002 Pete Zaitcev (zaitcev@yahoo.com)
6 * 7 *
7 * We used to warn all over the code: DO NOT USE prom_printf(), 8 * We used to warn all over the code: DO NOT USE prom_printf(),
@@ -13,7 +14,6 @@
13 */ 14 */
14 15
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <linux/module.h>
17 17
18#include <asm/openprom.h> 18#include <asm/openprom.h>
19#include <asm/oplib.h> 19#include <asm/oplib.h>
@@ -34,7 +34,7 @@ prom_write(const char *buf, unsigned int n)
34} 34}
35 35
36void 36void
37prom_printf(char *fmt, ...) 37prom_printf(const char *fmt, ...)
38{ 38{
39 va_list args; 39 va_list args;
40 int i; 40 int i;
@@ -45,4 +45,3 @@ prom_printf(char *fmt, ...)
45 45
46 prom_write(ppbuf, i); 46 prom_write(ppbuf, i);
47} 47}
48EXPORT_SYMBOL(prom_printf);
diff --git a/arch/sparc/prom/tree.c b/arch/sparc/prom/tree_32.c
index f228fe057b24..6d8187357331 100644
--- a/arch/sparc/prom/tree.c
+++ b/arch/sparc/prom/tree_32.c
@@ -85,7 +85,7 @@ int prom_getsibling(int node)
85/* Return the length in bytes of property 'prop' at node 'node'. 85/* Return the length in bytes of property 'prop' at node 'node'.
86 * Return -1 on error. 86 * Return -1 on error.
87 */ 87 */
88int prom_getproplen(int node, char *prop) 88int prom_getproplen(int node, const char *prop)
89{ 89{
90 int ret; 90 int ret;
91 unsigned long flags; 91 unsigned long flags;
@@ -104,7 +104,7 @@ int prom_getproplen(int node, char *prop)
104 * 'buffer' which has a size of 'bufsize'. If the acquisition 104 * 'buffer' which has a size of 'bufsize'. If the acquisition
105 * was successful the length will be returned, else -1 is returned. 105 * was successful the length will be returned, else -1 is returned.
106 */ 106 */
107int prom_getproperty(int node, char *prop, char *buffer, int bufsize) 107int prom_getproperty(int node, const char *prop, char *buffer, int bufsize)
108{ 108{
109 int plen, ret; 109 int plen, ret;
110 unsigned long flags; 110 unsigned long flags;
@@ -303,7 +303,7 @@ int prom_node_has_property(int node, char *prop)
303/* Set property 'pname' at node 'node' to value 'value' which has a length 303/* Set property 'pname' at node 'node' to value 'value' which has a length
304 * of 'size' bytes. Return the number of bytes the prom accepted. 304 * of 'size' bytes. Return the number of bytes the prom accepted.
305 */ 305 */
306int prom_setprop(int node, char *pname, char *value, int size) 306int prom_setprop(int node, const char *pname, char *value, int size)
307{ 307{
308 unsigned long flags; 308 unsigned long flags;
309 int ret; 309 int ret;
diff --git a/arch/sparc64/prom/tree.c b/arch/sparc/prom/tree_64.c
index 281aea44790b..281aea44790b 100644
--- a/arch/sparc64/prom/tree.c
+++ b/arch/sparc/prom/tree_64.c
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
deleted file mode 100644
index 3b96e70b4670..000000000000
--- a/arch/sparc64/Kconfig
+++ /dev/null
@@ -1,433 +0,0 @@
1# sparc64 configuration
2mainmenu "Linux Kernel Configuration for 64-bit SPARC"
3
4config SPARC
5 bool
6 default y
7 select HAVE_OPROFILE
8 select HAVE_KPROBES
9 select HAVE_KRETPROBES
10
11config SPARC64
12 bool
13 default y
14 select HAVE_FUNCTION_TRACER
15 select HAVE_IDE
16 select HAVE_LMB
17 select HAVE_ARCH_KGDB
18 select USE_GENERIC_SMP_HELPERS if SMP
19 select HAVE_ARCH_TRACEHOOK
20 select ARCH_WANT_OPTIONAL_GPIOLIB
21 select RTC_CLASS
22 select RTC_DRV_M48T59
23 select RTC_DRV_CMOS
24 select RTC_DRV_BQ4802
25 select RTC_DRV_SUN4V
26 select RTC_DRV_STARFIRE
27
28config GENERIC_TIME
29 bool
30 default y
31
32config GENERIC_CMOS_UPDATE
33 bool
34 default y
35
36config GENERIC_CLOCKEVENTS
37 bool
38 default y
39
40config GENERIC_GPIO
41 bool
42 help
43 Generic GPIO API support
44
45config 64BIT
46 def_bool y
47
48config MMU
49 bool
50 default y
51
52config IOMMU_HELPER
53 bool
54 default y
55
56config QUICKLIST
57 bool
58 default y
59
60config STACKTRACE_SUPPORT
61 bool
62 default y
63
64config LOCKDEP_SUPPORT
65 bool
66 default y
67
68config ARCH_MAY_HAVE_PC_FDC
69 bool
70 default y
71
72config ARCH_HAS_ILOG2_U32
73 bool
74 default n
75
76config ARCH_HAS_ILOG2_U64
77 bool
78 default n
79
80config AUDIT_ARCH
81 bool
82 default y
83
84config HAVE_SETUP_PER_CPU_AREA
85 def_bool y
86
87config ARCH_NO_VIRT_TO_BUS
88 def_bool y
89
90config OF
91 def_bool y
92
93config GENERIC_HARDIRQS_NO__DO_IRQ
94 bool
95 def_bool y
96
97source "init/Kconfig"
98source "kernel/Kconfig.freezer"
99
100menu "Processor type and features"
101
102choice
103 prompt "Kernel page size"
104 default SPARC64_PAGE_SIZE_8KB
105
106config SPARC64_PAGE_SIZE_8KB
107 bool "8KB"
108 help
109 This lets you select the page size of the kernel.
110
111 8KB and 64KB work quite well, since SPARC ELF sections
112 provide for up to 64KB alignment.
113
114 If you don't know what to do, choose 8KB.
115
116config SPARC64_PAGE_SIZE_64KB
117 bool "64KB"
118
119endchoice
120
121config SECCOMP
122 bool "Enable seccomp to safely compute untrusted bytecode"
123 depends on PROC_FS
124 default y
125 help
126 This kernel feature is useful for number crunching applications
127 that may need to compute untrusted bytecode during their
128 execution. By using pipes or other transports made available to
129 the process as file descriptors supporting the read/write
130 syscalls, it's possible to isolate those applications in
131 their own address space using seccomp. Once seccomp is
132 enabled via /proc/<pid>/seccomp, it cannot be disabled
133 and the task is only allowed to execute a few safe syscalls
134 defined by each seccomp mode.
135
136 If unsure, say Y. Only embedded should say N here.
137
138source kernel/Kconfig.hz
139
140config HOTPLUG_CPU
141 bool "Support for hot-pluggable CPUs"
142 depends on SMP
143 select HOTPLUG
144 help
145 Say Y here to experiment with turning CPUs off and on. CPUs
146 can be controlled through /sys/devices/system/cpu/cpu#.
147 Say N if you want to disable CPU hotplug.
148
149config GENERIC_HARDIRQS
150 bool
151 default y
152
153source "kernel/time/Kconfig"
154
155config SMP
156 bool "Symmetric multi-processing support"
157 help
158 This enables support for systems with more than one CPU. If you have
159 a system with only one CPU, say N. If you have a system with more than
160 one CPU, say Y.
161
162 If you say N here, the kernel will run on single and multiprocessor
163 machines, but will use only one CPU of a multiprocessor machine. If
164 you say Y here, the kernel will run on single-processor machines.
165 On a single-processor machine, the kernel will run faster if you say
166 N here.
167
168 If you don't know what to do here, say N.
169
170config NR_CPUS
171 int "Maximum number of CPUs (2-1024)"
172 range 2 1024
173 depends on SMP
174 default "64"
175
176source "drivers/cpufreq/Kconfig"
177
178config US3_FREQ
179 tristate "UltraSPARC-III CPU Frequency driver"
180 depends on CPU_FREQ
181 select CPU_FREQ_TABLE
182 help
183 This adds the CPUFreq driver for UltraSPARC-III processors.
184
185 For details, take a look at <file:Documentation/cpu-freq>.
186
187 If in doubt, say N.
188
189config US2E_FREQ
190 tristate "UltraSPARC-IIe CPU Frequency driver"
191 depends on CPU_FREQ
192 select CPU_FREQ_TABLE
193 help
194 This adds the CPUFreq driver for UltraSPARC-IIe processors.
195
196 For details, take a look at <file:Documentation/cpu-freq>.
197
198 If in doubt, say N.
199
200config US3_MC
201 tristate "UltraSPARC-III Memory Controller driver"
202 default y
203 help
204 This adds a driver for the UltraSPARC-III memory controller.
205 Loading this driver allows exact mnemonic strings to be
206 printed in the event of a memory error, so that the faulty DIMM
207 on the motherboard can be matched to the error.
208
209 If in doubt, say Y, as this information can be very useful.
210
211# Global things across all Sun machines.
212config GENERIC_LOCKBREAK
213 bool
214 default y
215 depends on SMP && PREEMPT
216
217config RWSEM_GENERIC_SPINLOCK
218 bool
219
220config RWSEM_XCHGADD_ALGORITHM
221 bool
222 default y
223
224config GENERIC_FIND_NEXT_BIT
225 bool
226 default y
227
228config GENERIC_HWEIGHT
229 bool
230 default y if !ULTRA_HAS_POPULATION_COUNT
231
232config GENERIC_CALIBRATE_DELAY
233 bool
234 default y
235
236choice
237 prompt "SPARC64 Huge TLB Page Size"
238 depends on HUGETLB_PAGE
239 default HUGETLB_PAGE_SIZE_4MB
240
241config HUGETLB_PAGE_SIZE_4MB
242 bool "4MB"
243
244config HUGETLB_PAGE_SIZE_512K
245 bool "512K"
246
247config HUGETLB_PAGE_SIZE_64K
248 depends on !SPARC64_PAGE_SIZE_64KB
249 bool "64K"
250
251endchoice
252
253endmenu
254
255config NUMA
256 bool "NUMA support"
257 depends on SMP
258
259config NODES_SHIFT
260 int
261 default "4"
262 depends on NEED_MULTIPLE_NODES
263
264# Some NUMA nodes have memory ranges that span
265# other nodes. Even though a pfn is valid and
266# between a node's start and end pfns, it may not
267# reside on that node. See memmap_init_zone()
268# for details.
269config NODES_SPAN_OTHER_NODES
270 def_bool y
271 depends on NEED_MULTIPLE_NODES
272
273config ARCH_POPULATES_NODE_MAP
274 def_bool y
275
276config ARCH_SELECT_MEMORY_MODEL
277 def_bool y
278
279config ARCH_SPARSEMEM_ENABLE
280 def_bool y
281 select SPARSEMEM_VMEMMAP_ENABLE
282
283config ARCH_SPARSEMEM_DEFAULT
284 def_bool y
285
286source "mm/Kconfig"
287
288config ISA
289 bool
290
291config ISAPNP
292 bool
293
294config EISA
295 bool
296
297config MCA
298 bool
299
300config PCMCIA
301 tristate
302 help
303 Say Y here if you want to attach PCMCIA- or PC-cards to your Linux
304 computer. These are credit-card size devices such as network cards,
305 modems or hard drives often used with laptops computers. There are
306 actually two varieties of these cards: the older 16 bit PCMCIA cards
307 and the newer 32 bit CardBus cards. If you want to use CardBus
308 cards, you need to say Y here and also to "CardBus support" below.
309
310 To use your PC-cards, you will need supporting software from David
311 Hinds' pcmcia-cs package (see the file <file:Documentation/Changes>
312 for location). Please also read the PCMCIA-HOWTO, available from
313 <http://www.tldp.org/docs.html#howto>.
314
315 To compile this driver as modules, choose M here: the
316 modules will be called pcmcia_core and ds.
317
318config SBUS
319 bool
320 default y
321
322config SBUSCHAR
323 bool
324 default y
325
326config SUN_AUXIO
327 bool
328 default y
329
330config SUN_IO
331 bool
332 default y
333
334config SUN_LDOMS
335 bool "Sun Logical Domains support"
336 help
337 Say Y here is you want to support virtual devices via
338 Logical Domains.
339
340config PCI
341 bool "PCI support"
342 select ARCH_SUPPORTS_MSI
343 help
344 Find out whether your system includes a PCI bus. PCI is the name of
345 a bus system, i.e. the way the CPU talks to the other stuff inside
346 your box. If you say Y here, the kernel will include drivers and
347 infrastructure code to support PCI bus devices.
348
349config PCI_DOMAINS
350 def_bool PCI
351
352config PCI_SYSCALL
353 def_bool PCI
354
355source "drivers/pci/Kconfig"
356
357config SUN_OPENPROMFS
358 tristate "Openprom tree appears in /proc/openprom"
359 help
360 If you say Y, the OpenPROM device tree will be available as a
361 virtual file system, which you can mount to /proc/openprom by "mount
362 -t openpromfs none /proc/openprom".
363
364 To compile the /proc/openprom support as a module, choose M here: the
365 module will be called openpromfs. If unsure, choose M.
366
367menu "Executable file formats"
368
369source "fs/Kconfig.binfmt"
370
371config COMPAT
372 bool
373 default y
374 select COMPAT_BINFMT_ELF
375
376config SYSVIPC_COMPAT
377 bool
378 depends on COMPAT && SYSVIPC
379 default y
380
381endmenu
382
383config SCHED_SMT
384 bool "SMT (Hyperthreading) scheduler support"
385 depends on SMP
386 default y
387 help
388 SMT scheduler support improves the CPU scheduler's decision making
389 when dealing with SPARC cpus at a cost of slightly increased overhead
390 in some places. If unsure say N here.
391
392config SCHED_MC
393 bool "Multi-core scheduler support"
394 depends on SMP
395 default y
396 help
397 Multi-core scheduler support improves the CPU scheduler's decision
398 making when dealing with multi-core CPU chips at a cost of slightly
399 increased overhead in some places. If unsure say N here.
400
401source "kernel/Kconfig.preempt"
402
403config CMDLINE_BOOL
404 bool "Default bootloader kernel arguments"
405
406config CMDLINE
407 string "Initial kernel command string"
408 depends on CMDLINE_BOOL
409 default "console=ttyS0,9600 root=/dev/sda1"
410 help
411 Say Y here if you want to be able to pass default arguments to
412 the kernel. This will be overridden by the bootloader, if you
413 use one (such as SILO). This is most useful if you want to boot
414 a kernel from TFTP, and want default options to be available
415 with having them passed on the command line.
416
417 NOTE: This option WILL override the PROM bootargs setting!
418
419source "net/Kconfig"
420
421source "drivers/Kconfig"
422
423source "drivers/sbus/char/Kconfig"
424
425source "fs/Kconfig"
426
427source "arch/sparc64/Kconfig.debug"
428
429source "security/Kconfig"
430
431source "crypto/Kconfig"
432
433source "lib/Kconfig"
diff --git a/arch/sparc64/Kconfig.debug b/arch/sparc64/Kconfig.debug
deleted file mode 100644
index c40515c06690..000000000000
--- a/arch/sparc64/Kconfig.debug
+++ /dev/null
@@ -1,44 +0,0 @@
1menu "Kernel hacking"
2
3config TRACE_IRQFLAGS_SUPPORT
4 bool
5 default y
6
7source "lib/Kconfig.debug"
8
9config DEBUG_STACK_USAGE
10 bool "Enable stack utilization instrumentation"
11 depends on DEBUG_KERNEL
12 help
13 Enables the display of the minimum amount of free stack which each
14 task has ever had available in the sysrq-T and sysrq-P debug output.
15
16 This option will slow down process creation somewhat.
17
18config DEBUG_DCFLUSH
19 bool "D-cache flush debugging"
20 depends on DEBUG_KERNEL
21
22config STACK_DEBUG
23 depends on DEBUG_KERNEL
24 bool "Stack Overflow Detection Support"
25
26config DEBUG_PAGEALLOC
27 bool "Debug page memory allocations"
28 depends on DEBUG_KERNEL && !HIBERNATION
29 help
30 Unmap pages from the kernel linear mapping after free_pages().
31 This results in a large slowdown, but helps to find certain types
32 of memory corruptions.
33
34config MCOUNT
35 bool
36 depends on STACK_DEBUG || FUNCTION_TRACER
37 default y
38
39config FRAME_POINTER
40 bool
41 depends on MCOUNT
42 default y
43
44endmenu
diff --git a/arch/sparc64/Makefile b/arch/sparc64/Makefile
deleted file mode 100644
index c7214abc0d84..000000000000
--- a/arch/sparc64/Makefile
+++ /dev/null
@@ -1,48 +0,0 @@
1# sparc64/Makefile
2#
3# Makefile for the architecture dependent flags and dependencies on the
4# 64-bit Sparc.
5#
6# Copyright (C) 1996,1998 David S. Miller (davem@caip.rutgers.edu)
7# Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
8#
9
10CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64
11
12# Undefine sparc when processing vmlinux.lds - it is used
13# And teach CPP we are doing 64 bit builds (for this case)
14CPPFLAGS_vmlinux.lds += -m64 -Usparc
15
16LDFLAGS := -m elf64_sparc
17
18KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \
19 -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \
20 -Wa,--undeclared-regs
21KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3)
22KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs
23
24ifeq ($(CONFIG_MCOUNT),y)
25 KBUILD_CFLAGS += -pg
26endif
27
28head-y := arch/sparc64/kernel/head.o arch/sparc64/kernel/init_task.o
29
30core-y += arch/sparc64/kernel/ arch/sparc64/mm/
31core-y += arch/sparc64/math-emu/
32libs-y += arch/sparc64/prom/ arch/sparc64/lib/
33drivers-$(CONFIG_OPROFILE) += arch/sparc64/oprofile/
34
35boot := arch/sparc64/boot
36
37image tftpboot.img vmlinux.aout: vmlinux
38 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
39
40archclean:
41 $(Q)$(MAKE) $(clean)=$(boot)
42
43define archhelp
44 echo '* vmlinux - Standard sparc64 kernel'
45 echo ' vmlinux.aout - a.out kernel for sparc64'
46 echo ' tftpboot.img - Image prepared for tftp'
47endef
48
diff --git a/arch/sparc64/boot/Makefile b/arch/sparc64/boot/Makefile
deleted file mode 100644
index 0458b5244f09..000000000000
--- a/arch/sparc64/boot/Makefile
+++ /dev/null
@@ -1,33 +0,0 @@
1# Makefile for the Sparc64 boot stuff.
2#
3# Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
4# Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
5
6ROOT_IMG := /usr/src/root.img
7ELFTOAOUT := elftoaout
8
9hostprogs-y := piggyback
10targets := image tftpboot.img vmlinux.aout
11
12quiet_cmd_elftoaout = ELF2AOUT $@
13 cmd_elftoaout = $(ELFTOAOUT) vmlinux -o $@
14quiet_cmd_piggy = PIGGY $@
15 cmd_piggy = $(obj)/piggyback $@ System.map $(ROOT_IMG)
16quiet_cmd_strip = STRIP $@
17 cmd_strip = $(STRIP) -R .comment -R .note -K sun4u_init -K _end -K _start vmlinux -o $@
18
19
20# Actual linking
21$(obj)/image: vmlinux FORCE
22 $(call if_changed,strip)
23 @echo ' kernel: $@ is ready'
24
25$(obj)/tftpboot.img: vmlinux $(obj)/piggyback System.map $(ROOT_IMG) FORCE
26 $(call if_changed,elftoaout)
27 $(call if_changed,piggy)
28 @echo ' kernel: $@ is ready'
29
30$(obj)/vmlinux.aout: vmlinux FORCE
31 $(call if_changed,elftoaout)
32 @echo ' kernel: $@ is ready'
33
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile
deleted file mode 100644
index b3e0b986bef8..000000000000
--- a/arch/sparc64/kernel/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5EXTRA_AFLAGS := -ansi
6EXTRA_CFLAGS := -Werror
7
8CFLAGS_REMOVE_ftrace.o = -pg
9
10extra-y := head.o init_task.o vmlinux.lds
11
12obj-y := process.o setup.o cpu.o idprom.o reboot.o \
13 traps.o auxio.o una_asm.o sysfs.o iommu.o \
14 irq.o ptrace.o time.o sys_sparc.o signal.o \
15 unaligned.o central.o starfire.o \
16 power.o sbus.o sparc64_ksyms.o ebus.o \
17 visemul.o prom.o of_device.o hvapi.o sstate.o mdesc.o
18
19obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
20obj-$(CONFIG_STACKTRACE) += stacktrace.o
21obj-$(CONFIG_PCI) += pci.o pci_common.o psycho_common.o \
22 pci_psycho.o pci_sabre.o pci_schizo.o \
23 pci_sun4v.o pci_sun4v_asm.o pci_fire.o
24obj-$(CONFIG_PCI_MSI) += pci_msi.o
25obj-$(CONFIG_SMP) += smp.o trampoline.o hvtramp.o
26obj-$(CONFIG_COMPAT) += sys32.o sys_sparc32.o signal32.o
27obj-$(CONFIG_MODULES) += module.o
28obj-$(CONFIG_US3_FREQ) += us3_cpufreq.o
29obj-$(CONFIG_US2E_FREQ) += us2e_cpufreq.o
30obj-$(CONFIG_US3_MC) += chmc.o
31obj-$(CONFIG_KPROBES) += kprobes.o
32obj-$(CONFIG_SUN_LDOMS) += ldc.o vio.o viohs.o ds.o
33obj-$(CONFIG_AUDIT) += audit.o
34obj-$(CONFIG_AUDIT)$(CONFIG_COMPAT) += compat_audit.o
35obj-y += $(obj-yy)
36obj-$(CONFIG_KGDB) += kgdb.o
diff --git a/arch/sparc64/kernel/asm-offsets.c b/arch/sparc64/kernel/asm-offsets.c
deleted file mode 100644
index 9e263112a6e2..000000000000
--- a/arch/sparc64/kernel/asm-offsets.c
+++ /dev/null
@@ -1 +0,0 @@
1/* Dummy asm-offsets.c file. Required by kbuild and ready to be used - hint! */
diff --git a/arch/sparc64/kernel/cpu.c b/arch/sparc64/kernel/cpu.c
deleted file mode 100644
index 0c9ac83ed0a8..000000000000
--- a/arch/sparc64/kernel/cpu.c
+++ /dev/null
@@ -1,166 +0,0 @@
1/* cpu.c: Dinky routines to look for the kind of Sparc cpu
2 * we are on.
3 *
4 * Copyright (C) 1996, 2007, 2008 David S. Miller (davem@davemloft.net)
5 */
6
7#include <linux/kernel.h>
8#include <linux/init.h>
9#include <linux/sched.h>
10#include <linux/smp.h>
11#include <asm/asi.h>
12#include <asm/system.h>
13#include <asm/fpumacro.h>
14#include <asm/cpudata.h>
15#include <asm/spitfire.h>
16#include <asm/oplib.h>
17
18#include "entry.h"
19
20DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 };
21
22struct cpu_chip_info {
23 unsigned short manuf;
24 unsigned short impl;
25 const char *cpu_name;
26 const char *fp_name;
27};
28
29static const struct cpu_chip_info cpu_chips[] = {
30 {
31 .manuf = 0x17,
32 .impl = 0x10,
33 .cpu_name = "TI UltraSparc I (SpitFire)",
34 .fp_name = "UltraSparc I integrated FPU",
35 },
36 {
37 .manuf = 0x22,
38 .impl = 0x10,
39 .cpu_name = "TI UltraSparc I (SpitFire)",
40 .fp_name = "UltraSparc I integrated FPU",
41 },
42 {
43 .manuf = 0x17,
44 .impl = 0x11,
45 .cpu_name = "TI UltraSparc II (BlackBird)",
46 .fp_name = "UltraSparc II integrated FPU",
47 },
48 {
49 .manuf = 0x17,
50 .impl = 0x12,
51 .cpu_name = "TI UltraSparc IIi (Sabre)",
52 .fp_name = "UltraSparc IIi integrated FPU",
53 },
54 {
55 .manuf = 0x17,
56 .impl = 0x13,
57 .cpu_name = "TI UltraSparc IIe (Hummingbird)",
58 .fp_name = "UltraSparc IIe integrated FPU",
59 },
60 {
61 .manuf = 0x3e,
62 .impl = 0x14,
63 .cpu_name = "TI UltraSparc III (Cheetah)",
64 .fp_name = "UltraSparc III integrated FPU",
65 },
66 {
67 .manuf = 0x3e,
68 .impl = 0x15,
69 .cpu_name = "TI UltraSparc III+ (Cheetah+)",
70 .fp_name = "UltraSparc III+ integrated FPU",
71 },
72 {
73 .manuf = 0x3e,
74 .impl = 0x16,
75 .cpu_name = "TI UltraSparc IIIi (Jalapeno)",
76 .fp_name = "UltraSparc IIIi integrated FPU",
77 },
78 {
79 .manuf = 0x3e,
80 .impl = 0x18,
81 .cpu_name = "TI UltraSparc IV (Jaguar)",
82 .fp_name = "UltraSparc IV integrated FPU",
83 },
84 {
85 .manuf = 0x3e,
86 .impl = 0x19,
87 .cpu_name = "TI UltraSparc IV+ (Panther)",
88 .fp_name = "UltraSparc IV+ integrated FPU",
89 },
90 {
91 .manuf = 0x3e,
92 .impl = 0x22,
93 .cpu_name = "TI UltraSparc IIIi+ (Serrano)",
94 .fp_name = "UltraSparc IIIi+ integrated FPU",
95 },
96};
97
98#define NSPARCCHIPS ARRAY_SIZE(linux_sparc_chips)
99
100const char *sparc_cpu_type;
101const char *sparc_fpu_type;
102
103static void __init sun4v_cpu_probe(void)
104{
105 switch (sun4v_chip_type) {
106 case SUN4V_CHIP_NIAGARA1:
107 sparc_cpu_type = "UltraSparc T1 (Niagara)";
108 sparc_fpu_type = "UltraSparc T1 integrated FPU";
109 break;
110
111 case SUN4V_CHIP_NIAGARA2:
112 sparc_cpu_type = "UltraSparc T2 (Niagara2)";
113 sparc_fpu_type = "UltraSparc T2 integrated FPU";
114 break;
115
116 default:
117 printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n",
118 prom_cpu_compatible);
119 sparc_cpu_type = "Unknown SUN4V CPU";
120 sparc_fpu_type = "Unknown SUN4V FPU";
121 break;
122 }
123}
124
125static const struct cpu_chip_info * __init find_cpu_chip(unsigned short manuf,
126 unsigned short impl)
127{
128 int i;
129
130 for (i = 0; i < ARRAY_SIZE(cpu_chips); i++) {
131 const struct cpu_chip_info *p = &cpu_chips[i];
132
133 if (p->manuf == manuf && p->impl == impl)
134 return p;
135 }
136 return NULL;
137}
138
139static int __init cpu_type_probe(void)
140{
141 if (tlb_type == hypervisor) {
142 sun4v_cpu_probe();
143 } else {
144 unsigned long ver, manuf, impl;
145 const struct cpu_chip_info *p;
146
147 __asm__ __volatile__("rdpr %%ver, %0" : "=r" (ver));
148
149 manuf = ((ver >> 48) & 0xffff);
150 impl = ((ver >> 32) & 0xffff);
151
152 p = find_cpu_chip(manuf, impl);
153 if (p) {
154 sparc_cpu_type = p->cpu_name;
155 sparc_fpu_type = p->fp_name;
156 } else {
157 printk(KERN_ERR "CPU: Unknown chip, manuf[%lx] impl[%lx]\n",
158 manuf, impl);
159 sparc_cpu_type = "Unknown CPU";
160 sparc_fpu_type = "Unknown FPU";
161 }
162 }
163 return 0;
164}
165
166arch_initcall(cpu_type_probe);
diff --git a/arch/sparc64/kernel/idprom.c b/arch/sparc64/kernel/idprom.c
deleted file mode 100644
index 5b45a808c621..000000000000
--- a/arch/sparc64/kernel/idprom.c
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * idprom.c: Routines to load the idprom into kernel addresses and
3 * interpret the data contained within.
4 *
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
6 */
7
8#include <linux/kernel.h>
9#include <linux/types.h>
10#include <linux/init.h>
11
12#include <asm/oplib.h>
13#include <asm/idprom.h>
14
15struct idprom *idprom;
16static struct idprom idprom_buffer;
17
18/* Calculate the IDPROM checksum (xor of the data bytes). */
19static unsigned char __init calc_idprom_cksum(struct idprom *idprom)
20{
21 unsigned char cksum, i, *ptr = (unsigned char *)idprom;
22
23 for (i = cksum = 0; i <= 0x0E; i++)
24 cksum ^= *ptr++;
25
26 return cksum;
27}
28
29/* Create a local IDPROM copy and verify integrity. */
30void __init idprom_init(void)
31{
32 prom_get_idprom((char *) &idprom_buffer, sizeof(idprom_buffer));
33
34 idprom = &idprom_buffer;
35
36 if (idprom->id_format != 0x01) {
37 prom_printf("IDPROM: Warning, unknown format type!\n");
38 }
39
40 if (idprom->id_cksum != calc_idprom_cksum(idprom)) {
41 prom_printf("IDPROM: Warning, checksum failure (nvram=%x, calc=%x)!\n",
42 idprom->id_cksum, calc_idprom_cksum(idprom));
43 }
44
45 printk("Ethernet address: %02x:%02x:%02x:%02x:%02x:%02x\n",
46 idprom->id_ethaddr[0], idprom->id_ethaddr[1],
47 idprom->id_ethaddr[2], idprom->id_ethaddr[3],
48 idprom->id_ethaddr[4], idprom->id_ethaddr[5]);
49}
diff --git a/arch/sparc64/kernel/init_task.c b/arch/sparc64/kernel/init_task.c
deleted file mode 100644
index d2b312381c19..000000000000
--- a/arch/sparc64/kernel/init_task.c
+++ /dev/null
@@ -1,35 +0,0 @@
1#include <linux/mm.h>
2#include <linux/fs.h>
3#include <linux/module.h>
4#include <linux/sched.h>
5#include <linux/init_task.h>
6#include <linux/mqueue.h>
7
8#include <asm/pgtable.h>
9#include <asm/uaccess.h>
10#include <asm/processor.h>
11
12static struct fs_struct init_fs = INIT_FS;
13static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
14static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
15struct mm_struct init_mm = INIT_MM(init_mm);
16
17EXPORT_SYMBOL(init_mm);
18
19/* .text section in head.S is aligned at 2 page boundary and this gets linked
20 * right after that so that the init_thread_union is aligned properly as well.
21 * We really don't need this special alignment like the Intel does, but
22 * I do it anyways for completeness.
23 */
24__asm__ (".text");
25union thread_union init_thread_union = { INIT_THREAD_INFO(init_task) };
26
27/*
28 * Initial task structure.
29 *
30 * All other task structs will be allocated on slabs in fork.c
31 */
32EXPORT_SYMBOL(init_task);
33
34__asm__(".data");
35struct task_struct init_task = INIT_TASK(init_task);
diff --git a/arch/sparc64/kernel/module.c b/arch/sparc64/kernel/module.c
deleted file mode 100644
index 158484bf5999..000000000000
--- a/arch/sparc64/kernel/module.c
+++ /dev/null
@@ -1,213 +0,0 @@
1/* Kernel module help for sparc64.
2 *
3 * Copyright (C) 2001 Rusty Russell.
4 * Copyright (C) 2002 David S. Miller.
5 */
6
7#include <linux/moduleloader.h>
8#include <linux/kernel.h>
9#include <linux/elf.h>
10#include <linux/vmalloc.h>
11#include <linux/fs.h>
12#include <linux/string.h>
13#include <linux/slab.h>
14#include <linux/mm.h>
15
16#include <asm/processor.h>
17#include <asm/spitfire.h>
18
19static void *module_map(unsigned long size)
20{
21 struct vm_struct *area;
22
23 size = PAGE_ALIGN(size);
24 if (!size || size > MODULES_LEN)
25 return NULL;
26
27 area = __get_vm_area(size, VM_ALLOC, MODULES_VADDR, MODULES_END);
28 if (!area)
29 return NULL;
30
31 return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL);
32}
33
34void *module_alloc(unsigned long size)
35{
36 void *ret;
37
38 /* We handle the zero case fine, unlike vmalloc */
39 if (size == 0)
40 return NULL;
41
42 ret = module_map(size);
43 if (!ret)
44 ret = ERR_PTR(-ENOMEM);
45 else
46 memset(ret, 0, size);
47
48 return ret;
49}
50
51/* Free memory returned from module_core_alloc/module_init_alloc */
52void module_free(struct module *mod, void *module_region)
53{
54 vfree(module_region);
55 /* FIXME: If module_region == mod->init_region, trim exception
56 table entries. */
57}
58
59/* Make generic code ignore STT_REGISTER dummy undefined symbols. */
60int module_frob_arch_sections(Elf_Ehdr *hdr,
61 Elf_Shdr *sechdrs,
62 char *secstrings,
63 struct module *mod)
64{
65 unsigned int symidx;
66 Elf64_Sym *sym;
67 const char *strtab;
68 int i;
69
70 for (symidx = 0; sechdrs[symidx].sh_type != SHT_SYMTAB; symidx++) {
71 if (symidx == hdr->e_shnum-1) {
72 printk("%s: no symtab found.\n", mod->name);
73 return -ENOEXEC;
74 }
75 }
76 sym = (Elf64_Sym *)sechdrs[symidx].sh_addr;
77 strtab = (char *)sechdrs[sechdrs[symidx].sh_link].sh_addr;
78
79 for (i = 1; i < sechdrs[symidx].sh_size / sizeof(Elf_Sym); i++) {
80 if (sym[i].st_shndx == SHN_UNDEF &&
81 ELF64_ST_TYPE(sym[i].st_info) == STT_REGISTER)
82 sym[i].st_shndx = SHN_ABS;
83 }
84 return 0;
85}
86
87int apply_relocate(Elf64_Shdr *sechdrs,
88 const char *strtab,
89 unsigned int symindex,
90 unsigned int relsec,
91 struct module *me)
92{
93 printk(KERN_ERR "module %s: non-ADD RELOCATION unsupported\n",
94 me->name);
95 return -ENOEXEC;
96}
97
98int apply_relocate_add(Elf64_Shdr *sechdrs,
99 const char *strtab,
100 unsigned int symindex,
101 unsigned int relsec,
102 struct module *me)
103{
104 unsigned int i;
105 Elf64_Rela *rel = (void *)sechdrs[relsec].sh_addr;
106 Elf64_Sym *sym;
107 u8 *location;
108 u32 *loc32;
109
110 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
111 Elf64_Addr v;
112
113 /* This is where to make the change */
114 location = (u8 *)sechdrs[sechdrs[relsec].sh_info].sh_addr
115 + rel[i].r_offset;
116 loc32 = (u32 *) location;
117
118 BUG_ON(((u64)location >> (u64)32) != (u64)0);
119
120 /* This is the symbol it is referring to. Note that all
121 undefined symbols have been resolved. */
122 sym = (Elf64_Sym *)sechdrs[symindex].sh_addr
123 + ELF64_R_SYM(rel[i].r_info);
124 v = sym->st_value + rel[i].r_addend;
125
126 switch (ELF64_R_TYPE(rel[i].r_info) & 0xff) {
127 case R_SPARC_64:
128 location[0] = v >> 56;
129 location[1] = v >> 48;
130 location[2] = v >> 40;
131 location[3] = v >> 32;
132 location[4] = v >> 24;
133 location[5] = v >> 16;
134 location[6] = v >> 8;
135 location[7] = v >> 0;
136 break;
137
138 case R_SPARC_32:
139 location[0] = v >> 24;
140 location[1] = v >> 16;
141 location[2] = v >> 8;
142 location[3] = v >> 0;
143 break;
144
145 case R_SPARC_DISP32:
146 v -= (Elf64_Addr) location;
147 *loc32 = v;
148 break;
149
150 case R_SPARC_WDISP30:
151 v -= (Elf64_Addr) location;
152 *loc32 = (*loc32 & ~0x3fffffff) |
153 ((v >> 2) & 0x3fffffff);
154 break;
155
156 case R_SPARC_WDISP22:
157 v -= (Elf64_Addr) location;
158 *loc32 = (*loc32 & ~0x3fffff) |
159 ((v >> 2) & 0x3fffff);
160 break;
161
162 case R_SPARC_WDISP19:
163 v -= (Elf64_Addr) location;
164 *loc32 = (*loc32 & ~0x7ffff) |
165 ((v >> 2) & 0x7ffff);
166 break;
167
168 case R_SPARC_LO10:
169 *loc32 = (*loc32 & ~0x3ff) | (v & 0x3ff);
170 break;
171
172 case R_SPARC_HI22:
173 *loc32 = (*loc32 & ~0x3fffff) |
174 ((v >> 10) & 0x3fffff);
175 break;
176
177 case R_SPARC_OLO10:
178 *loc32 = (*loc32 & ~0x1fff) |
179 (((v & 0x3ff) +
180 (ELF64_R_TYPE(rel[i].r_info) >> 8))
181 & 0x1fff);
182 break;
183
184 default:
185 printk(KERN_ERR "module %s: Unknown relocation: %x\n",
186 me->name,
187 (int) (ELF64_R_TYPE(rel[i].r_info) & 0xff));
188 return -ENOEXEC;
189 };
190 }
191 return 0;
192}
193
194int module_finalize(const Elf_Ehdr *hdr,
195 const Elf_Shdr *sechdrs,
196 struct module *me)
197{
198 /* Cheetah's I-cache is fully coherent. */
199 if (tlb_type == spitfire) {
200 unsigned long va;
201
202 flushw_all();
203 for (va = 0; va < (PAGE_SIZE << 1); va += 32)
204 spitfire_put_icache_tag(va, 0x0);
205 __asm__ __volatile__("flush %g6");
206 }
207
208 return 0;
209}
210
211void module_arch_cleanup(struct module *mod)
212{
213}
diff --git a/arch/sparc64/kernel/vmlinux.lds.S b/arch/sparc64/kernel/vmlinux.lds.S
deleted file mode 100644
index 01f809617e5e..000000000000
--- a/arch/sparc64/kernel/vmlinux.lds.S
+++ /dev/null
@@ -1,147 +0,0 @@
1/* ld script to make UltraLinux kernel */
2
3#include <asm/page.h>
4#include <asm-generic/vmlinux.lds.h>
5
6OUTPUT_FORMAT("elf64-sparc", "elf64-sparc", "elf64-sparc")
7OUTPUT_ARCH(sparc:v9a)
8ENTRY(_start)
9
10jiffies = jiffies_64;
11SECTIONS
12{
13 swapper_low_pmd_dir = 0x0000000000402000;
14 . = 0x4000;
15 .text 0x0000000000404000 : {
16 _text = .;
17 TEXT_TEXT
18 SCHED_TEXT
19 LOCK_TEXT
20 KPROBES_TEXT
21 *(.gnu.warning)
22 } = 0
23 _etext = .;
24 PROVIDE (etext = .);
25
26 RO_DATA(PAGE_SIZE)
27 .data : {
28 DATA_DATA
29 CONSTRUCTORS
30 }
31 .data1 : {
32 *(.data1)
33 }
34 . = ALIGN(64);
35 .data.cacheline_aligned : {
36 *(.data.cacheline_aligned)
37 }
38 . = ALIGN(64);
39 .data.read_mostly : {
40 *(.data.read_mostly)
41 }
42 _edata = .;
43 PROVIDE (edata = .);
44 .fixup : {
45 *(.fixup)
46 }
47 . = ALIGN(16);
48 __ex_table : {
49 __start___ex_table = .;
50 *(__ex_table)
51 __stop___ex_table = .;
52 }
53 NOTES
54
55 . = ALIGN(PAGE_SIZE);
56 .init.text : {
57 __init_begin = .;
58 _sinittext = .;
59 INIT_TEXT
60 _einittext = .;
61 }
62 .init.data : {
63 INIT_DATA
64 }
65 . = ALIGN(16);
66 .init.setup : {
67 __setup_start = .;
68 *(.init.setup)
69 __setup_end = .;
70 }
71 .initcall.init : {
72 __initcall_start = .;
73 INITCALLS
74 __initcall_end = .;
75 }
76 .con_initcall.init : {
77 __con_initcall_start = .;
78 *(.con_initcall.init)
79 __con_initcall_end = .;
80 }
81 SECURITY_INIT
82
83 . = ALIGN(4);
84 .tsb_ldquad_phys_patch : {
85 __tsb_ldquad_phys_patch = .;
86 *(.tsb_ldquad_phys_patch)
87 __tsb_ldquad_phys_patch_end = .;
88 }
89
90 .tsb_phys_patch : {
91 __tsb_phys_patch = .;
92 *(.tsb_phys_patch)
93 __tsb_phys_patch_end = .;
94 }
95
96 .cpuid_patch : {
97 __cpuid_patch = .;
98 *(.cpuid_patch)
99 __cpuid_patch_end = .;
100 }
101
102 .sun4v_1insn_patch : {
103 __sun4v_1insn_patch = .;
104 *(.sun4v_1insn_patch)
105 __sun4v_1insn_patch_end = .;
106 }
107 .sun4v_2insn_patch : {
108 __sun4v_2insn_patch = .;
109 *(.sun4v_2insn_patch)
110 __sun4v_2insn_patch_end = .;
111 }
112
113#ifdef CONFIG_BLK_DEV_INITRD
114 . = ALIGN(PAGE_SIZE);
115 .init.ramfs : {
116 __initramfs_start = .;
117 *(.init.ramfs)
118 __initramfs_end = .;
119 }
120#endif
121
122 PERCPU(PAGE_SIZE)
123
124 . = ALIGN(PAGE_SIZE);
125 __init_end = .;
126 __bss_start = .;
127 .sbss : {
128 *(.sbss)
129 *(.scommon)
130 }
131 .bss : {
132 *(.dynbss)
133 *(.bss)
134 *(COMMON)
135 }
136 _end = . ;
137 PROVIDE (end = .);
138
139 /DISCARD/ : {
140 EXIT_TEXT
141 EXIT_DATA
142 *(.exitcall.exit)
143 }
144
145 STABS_DEBUG
146 DWARF_DEBUG
147}
diff --git a/arch/sparc64/lib/Makefile b/arch/sparc64/lib/Makefile
deleted file mode 100644
index f095e13910bc..000000000000
--- a/arch/sparc64/lib/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
1#
2# Makefile for Sparc64 library files..
3#
4
5EXTRA_AFLAGS := -ansi
6EXTRA_CFLAGS := -Werror
7
8lib-y := PeeCeeI.o copy_page.o clear_page.o strlen.o strncmp.o \
9 memscan.o strncpy_from_user.o strlen_user.o memcmp.o checksum.o \
10 bzero.o csum_copy.o csum_copy_from_user.o csum_copy_to_user.o \
11 VISsave.o atomic.o bitops.o \
12 U1memcpy.o U1copy_from_user.o U1copy_to_user.o \
13 U3memcpy.o U3copy_from_user.o U3copy_to_user.o U3patch.o \
14 NGmemcpy.o NGcopy_from_user.o NGcopy_to_user.o NGpatch.o \
15 NGpage.o NGbzero.o \
16 NG2memcpy.o NG2copy_from_user.o NG2copy_to_user.o NG2patch.o \
17 NG2page.o \
18 GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o GENpatch.o \
19 GENpage.o GENbzero.o \
20 copy_in_user.o user_fixup.o memmove.o \
21 mcount.o ipcsum.o rwsem.o xor.o
22
23obj-y += iomap.o
diff --git a/arch/sparc64/lib/iomap.c b/arch/sparc64/lib/iomap.c
deleted file mode 100644
index 7120ebbd4d03..000000000000
--- a/arch/sparc64/lib/iomap.c
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * Implement the sparc64 iomap interfaces
3 */
4#include <linux/pci.h>
5#include <linux/module.h>
6#include <asm/io.h>
7
8/* Create a virtual mapping cookie for an IO port range */
9void __iomem *ioport_map(unsigned long port, unsigned int nr)
10{
11 return (void __iomem *) (unsigned long) port;
12}
13
14void ioport_unmap(void __iomem *addr)
15{
16 /* Nothing to do */
17}
18EXPORT_SYMBOL(ioport_map);
19EXPORT_SYMBOL(ioport_unmap);
20
21/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
22void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
23{
24 resource_size_t start = pci_resource_start(dev, bar);
25 resource_size_t len = pci_resource_len(dev, bar);
26 unsigned long flags = pci_resource_flags(dev, bar);
27
28 if (!len || !start)
29 return NULL;
30 if (maxlen && len > maxlen)
31 len = maxlen;
32 if (flags & IORESOURCE_IO)
33 return ioport_map(start, len);
34 if (flags & IORESOURCE_MEM) {
35 if (flags & IORESOURCE_CACHEABLE)
36 return ioremap(start, len);
37 return ioremap_nocache(start, len);
38 }
39 /* What? */
40 return NULL;
41}
42
43void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
44{
45 /* nothing to do */
46}
47EXPORT_SYMBOL(pci_iomap);
48EXPORT_SYMBOL(pci_iounmap);
diff --git a/arch/sparc64/lib/memcmp.S b/arch/sparc64/lib/memcmp.S
deleted file mode 100644
index d3fdaa898566..000000000000
--- a/arch/sparc64/lib/memcmp.S
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * Sparc64 optimized memcmp code.
3 *
4 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
5 * Copyright (C) 2000 David S. Miller (davem@redhat.com)
6 */
7
8 .text
9 .align 32
10 .globl __memcmp, memcmp
11__memcmp:
12memcmp:
13 cmp %o2, 0 ! IEU1 Group
14loop: be,pn %icc, ret_0 ! CTI
15 nop ! IEU0
16 ldub [%o0], %g7 ! LSU Group
17 ldub [%o1], %g3 ! LSU Group
18 sub %o2, 1, %o2 ! IEU0
19 add %o0, 1, %o0 ! IEU1
20 add %o1, 1, %o1 ! IEU0 Group
21 subcc %g7, %g3, %g3 ! IEU1 Group
22 be,pt %icc, loop ! CTI
23 cmp %o2, 0 ! IEU1 Group
24
25ret_n0: retl
26 mov %g3, %o0
27ret_0: retl
28 mov 0, %o0
diff --git a/arch/sparc64/lib/strlen.S b/arch/sparc64/lib/strlen.S
deleted file mode 100644
index e9ba1920d818..000000000000
--- a/arch/sparc64/lib/strlen.S
+++ /dev/null
@@ -1,80 +0,0 @@
1/* strlen.S: Sparc64 optimized strlen code
2 * Hand optimized from GNU libc's strlen
3 * Copyright (C) 1991,1996 Free Software Foundation
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 1996, 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
6 */
7
8#define LO_MAGIC 0x01010101
9#define HI_MAGIC 0x80808080
10
11 .align 32
12 .globl strlen
13 .type strlen,#function
14strlen:
15 mov %o0, %o1
16 andcc %o0, 3, %g0
17 be,pt %icc, 9f
18 sethi %hi(HI_MAGIC), %o4
19 ldub [%o0], %o5
20 brz,pn %o5, 11f
21 add %o0, 1, %o0
22 andcc %o0, 3, %g0
23 be,pn %icc, 4f
24 or %o4, %lo(HI_MAGIC), %o3
25 ldub [%o0], %o5
26 brz,pn %o5, 12f
27 add %o0, 1, %o0
28 andcc %o0, 3, %g0
29 be,pt %icc, 5f
30 sethi %hi(LO_MAGIC), %o4
31 ldub [%o0], %o5
32 brz,pn %o5, 13f
33 add %o0, 1, %o0
34 ba,pt %icc, 8f
35 or %o4, %lo(LO_MAGIC), %o2
369:
37 or %o4, %lo(HI_MAGIC), %o3
384:
39 sethi %hi(LO_MAGIC), %o4
405:
41 or %o4, %lo(LO_MAGIC), %o2
428:
43 ld [%o0], %o5
442:
45 sub %o5, %o2, %o4
46 andcc %o4, %o3, %g0
47 be,pt %icc, 8b
48 add %o0, 4, %o0
49
50 /* Check every byte. */
51 srl %o5, 24, %g7
52 andcc %g7, 0xff, %g0
53 be,pn %icc, 1f
54 add %o0, -4, %o4
55 srl %o5, 16, %g7
56 andcc %g7, 0xff, %g0
57 be,pn %icc, 1f
58 add %o4, 1, %o4
59 srl %o5, 8, %g7
60 andcc %g7, 0xff, %g0
61 be,pn %icc, 1f
62 add %o4, 1, %o4
63 andcc %o5, 0xff, %g0
64 bne,a,pt %icc, 2b
65 ld [%o0], %o5
66 add %o4, 1, %o4
671:
68 retl
69 sub %o4, %o1, %o0
7011:
71 retl
72 mov 0, %o0
7312:
74 retl
75 mov 1, %o0
7613:
77 retl
78 mov 2, %o0
79
80 .size strlen, .-strlen
diff --git a/arch/sparc64/math-emu/Makefile b/arch/sparc64/math-emu/Makefile
deleted file mode 100644
index cc5cb9baf6aa..000000000000
--- a/arch/sparc64/math-emu/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
1#
2# Makefile for the FPU instruction emulation.
3#
4
5obj-y := math.o
6
7EXTRA_CFLAGS = -Iinclude/math-emu -w
diff --git a/arch/sparc64/mm/Makefile b/arch/sparc64/mm/Makefile
deleted file mode 100644
index 68d04c0370f4..000000000000
--- a/arch/sparc64/mm/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
1# Makefile for the linux Sparc64-specific parts of the memory manager.
2#
3
4EXTRA_AFLAGS := -ansi
5EXTRA_CFLAGS := -Werror
6
7obj-y := ultra.o tlb.o tsb.o fault.o init.o generic.o
8
9obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
diff --git a/arch/sparc64/oprofile/Makefile b/arch/sparc64/oprofile/Makefile
deleted file mode 100644
index e9feca1ca28b..000000000000
--- a/arch/sparc64/oprofile/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
1obj-$(CONFIG_OPROFILE) += oprofile.o
2
3DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \
4 oprof.o cpu_buffer.o buffer_sync.o \
5 event_buffer.o oprofile_files.o \
6 oprofilefs.o oprofile_stats.o \
7 timer_int.o )
8
9oprofile-y := $(DRIVER_OBJS) init.o
diff --git a/arch/sparc64/oprofile/init.c b/arch/sparc64/oprofile/init.c
deleted file mode 100644
index 17bb6035069b..000000000000
--- a/arch/sparc64/oprofile/init.c
+++ /dev/null
@@ -1,23 +0,0 @@
1/**
2 * @file init.c
3 *
4 * @remark Copyright 2002 OProfile authors
5 * @remark Read the file COPYING
6 *
7 * @author John Levon <levon@movementarian.org>
8 */
9
10#include <linux/kernel.h>
11#include <linux/oprofile.h>
12#include <linux/errno.h>
13#include <linux/init.h>
14
15int __init oprofile_arch_init(struct oprofile_operations *ops)
16{
17 return -ENODEV;
18}
19
20
21void oprofile_arch_exit(void)
22{
23}
diff --git a/arch/sparc64/prom/Makefile b/arch/sparc64/prom/Makefile
deleted file mode 100644
index 8c94483ca54d..000000000000
--- a/arch/sparc64/prom/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
1# Makefile for the Sun Boot PROM interface library under
2# Linux.
3#
4
5EXTRA_AFLAGS := -ansi
6EXTRA_CFLAGS := -Werror
7
8lib-y := bootstr.o devops.o init.o misc.o \
9 tree.o console.o printf.o p1275.o cif.o
diff --git a/arch/sparc64/prom/printf.c b/arch/sparc64/prom/printf.c
deleted file mode 100644
index 660943ee4c2a..000000000000
--- a/arch/sparc64/prom/printf.c
+++ /dev/null
@@ -1,47 +0,0 @@
1/*
2 * printf.c: Internal prom library printf facility.
3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
6 * Copyright (c) 2002 Pete Zaitcev (zaitcev@yahoo.com)
7 *
8 * We used to warn all over the code: DO NOT USE prom_printf(),
9 * and yet people do. Anton's banking code was outputting banks
10 * with prom_printf for most of the 2.4 lifetime. Since an effective
11 * stick is not available, we deployed a carrot: an early printk
12 * through PROM by means of -p boot option. This ought to fix it.
13 * USE printk; if you need, deploy -p.
14 */
15
16#include <linux/kernel.h>
17
18#include <asm/openprom.h>
19#include <asm/oplib.h>
20
21static char ppbuf[1024];
22
23void
24prom_write(const char *buf, unsigned int n)
25{
26 char ch;
27
28 while (n != 0) {
29 --n;
30 if ((ch = *buf++) == '\n')
31 prom_putchar('\r');
32 prom_putchar(ch);
33 }
34}
35
36void
37prom_printf(const char *fmt, ...)
38{
39 va_list args;
40 int i;
41
42 va_start(args, fmt);
43 i = vscnprintf(ppbuf, sizeof(ppbuf), fmt, args);
44 va_end(args);
45
46 prom_write(ppbuf, i);
47}
diff --git a/arch/um/Makefile b/arch/um/Makefile
index d944c343acdb..0728def32234 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -22,10 +22,11 @@ MODE_INCLUDE += -I$(srctree)/$(ARCH_DIR)/include/shared/skas
22 22
23include $(srctree)/$(ARCH_DIR)/Makefile-skas 23include $(srctree)/$(ARCH_DIR)/Makefile-skas
24 24
25ARCH_INCLUDE := -I$(srctree)/$(ARCH_DIR)/include/shared 25SHARED_HEADERS := $(ARCH_DIR)/include/shared
26ARCH_INCLUDE := -I$(srctree)/$(SHARED_HEADERS)
26ARCH_INCLUDE += -I$(srctree)/$(ARCH_DIR)/sys-$(SUBARCH)/shared 27ARCH_INCLUDE += -I$(srctree)/$(ARCH_DIR)/sys-$(SUBARCH)/shared
27ifneq ($(KBUILD_SRC),) 28ifneq ($(KBUILD_SRC),)
28ARCH_INCLUDE += -I$(ARCH_DIR)/include/shared # for two generated files 29ARCH_INCLUDE += -I$(SHARED_HEADERS)
29endif 30endif
30KBUILD_CPPFLAGS += -I$(srctree)/$(ARCH_DIR)/sys-$(SUBARCH) 31KBUILD_CPPFLAGS += -I$(srctree)/$(ARCH_DIR)/sys-$(SUBARCH)
31 32
@@ -85,8 +86,8 @@ endef
85 86
86KBUILD_KCONFIG := arch/um/Kconfig.$(HEADER_ARCH) 87KBUILD_KCONFIG := arch/um/Kconfig.$(HEADER_ARCH)
87 88
88archprepare: $(ARCH_DIR)/include/shared/user_constants.h 89archprepare: $(SHARED_HEADERS)/user_constants.h
89prepare: $(ARCH_DIR)/include/shared/kern_constants.h 90archprepare: $(SHARED_HEADERS)/kern_constants.h
90 91
91LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static 92LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
92LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib 93LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib
@@ -119,17 +120,13 @@ endef
119# When cleaning we don't include .config, so we don't include 120# When cleaning we don't include .config, so we don't include
120# TT or skas makefiles and don't clean skas_ptregs.h. 121# TT or skas makefiles and don't clean skas_ptregs.h.
121CLEAN_FILES += linux x.i gmon.out \ 122CLEAN_FILES += linux x.i gmon.out \
122 $(ARCH_DIR)/include/shared/user_constants.h \ 123 $(SHARED_HEADERS)/user_constants.h \
123 $(ARCH_DIR)/include/shared/kern_constants.h 124 $(SHARED_HEADERS)/kern_constants.h
124 125
125archclean: 126archclean:
126 @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \ 127 @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \
127 -o -name '*.gcov' \) -type f -print | xargs rm -f 128 -o -name '*.gcov' \) -type f -print | xargs rm -f
128 129
129$(objtree)/$(ARCH_DIR)/include/shared:
130 @echo ' MKDIR $@'
131 $(Q)mkdir -p $@
132
133# Generated files 130# Generated files
134 131
135$(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s: FORCE 132$(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s: FORCE
@@ -148,11 +145,11 @@ define filechk_gen-asm-offsets
148 echo ""; ) 145 echo ""; )
149endef 146endef
150 147
151$(ARCH_DIR)/include/shared/user_constants.h: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s 148$(SHARED_HEADERS)/user_constants.h: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s
152 $(call filechk,gen-asm-offsets) 149 $(call filechk,gen-asm-offsets)
153 150
154$(ARCH_DIR)/include/shared/kern_constants.h: $(objtree)/$(ARCH_DIR)/include/shared 151$(SHARED_HEADERS)/kern_constants.h:
155 @echo ' SYMLINK $@' 152 $(Q)mkdir -p $(dir $@)
156 $(Q)ln -sf ../../../../include/asm/asm-offsets.h $@ 153 $(Q)echo '#include "../../../../include/asm/asm-offsets.h"' >$@
157 154
158export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS HEADER_ARCH DEV_NULL_PATH 155export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS HEADER_ARCH DEV_NULL_PATH
diff --git a/arch/um/drivers/daemon_kern.c b/arch/um/drivers/daemon_kern.c
index d53ff52bb404..b4a1522f2157 100644
--- a/arch/um/drivers/daemon_kern.c
+++ b/arch/um/drivers/daemon_kern.c
@@ -22,7 +22,7 @@ static void daemon_init(struct net_device *dev, void *data)
22 struct daemon_data *dpri; 22 struct daemon_data *dpri;
23 struct daemon_init *init = data; 23 struct daemon_init *init = data;
24 24
25 pri = dev->priv; 25 pri = netdev_priv(dev);
26 dpri = (struct daemon_data *) pri->user; 26 dpri = (struct daemon_data *) pri->user;
27 dpri->sock_type = init->sock_type; 27 dpri->sock_type = init->sock_type;
28 dpri->ctl_sock = init->ctl_sock; 28 dpri->ctl_sock = init->ctl_sock;
diff --git a/arch/um/drivers/mcast_kern.c b/arch/um/drivers/mcast_kern.c
index 8c4378a76d63..ffc6416d5ed7 100644
--- a/arch/um/drivers/mcast_kern.c
+++ b/arch/um/drivers/mcast_kern.c
@@ -28,7 +28,7 @@ static void mcast_init(struct net_device *dev, void *data)
28 struct mcast_data *dpri; 28 struct mcast_data *dpri;
29 struct mcast_init *init = data; 29 struct mcast_init *init = data;
30 30
31 pri = dev->priv; 31 pri = netdev_priv(dev);
32 dpri = (struct mcast_data *) pri->user; 32 dpri = (struct mcast_data *) pri->user;
33 dpri->addr = init->addr; 33 dpri->addr = init->addr;
34 dpri->port = init->port; 34 dpri->port = init->port;
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index 8f44ebb0dec8..e14629c87de4 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -161,7 +161,8 @@ void mconsole_proc(struct mc_request *req)
161 goto out_kill; 161 goto out_kill;
162 } 162 }
163 163
164 file = dentry_open(nd.path.dentry, nd.path.mnt, O_RDONLY); 164 file = dentry_open(nd.path.dentry, nd.path.mnt, O_RDONLY,
165 current_cred());
165 if (IS_ERR(file)) { 166 if (IS_ERR(file)) {
166 mconsole_reply(req, "Failed to open file", 1, 0); 167 mconsole_reply(req, "Failed to open file", 1, 0);
167 goto out_kill; 168 goto out_kill;
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 5b4ca8d93682..fde510b664d3 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -76,7 +76,7 @@ out:
76 76
77static int uml_net_rx(struct net_device *dev) 77static int uml_net_rx(struct net_device *dev)
78{ 78{
79 struct uml_net_private *lp = dev->priv; 79 struct uml_net_private *lp = netdev_priv(dev);
80 int pkt_len; 80 int pkt_len;
81 struct sk_buff *skb; 81 struct sk_buff *skb;
82 82
@@ -119,7 +119,7 @@ static void uml_dev_close(struct work_struct *work)
119static irqreturn_t uml_net_interrupt(int irq, void *dev_id) 119static irqreturn_t uml_net_interrupt(int irq, void *dev_id)
120{ 120{
121 struct net_device *dev = dev_id; 121 struct net_device *dev = dev_id;
122 struct uml_net_private *lp = dev->priv; 122 struct uml_net_private *lp = netdev_priv(dev);
123 int err; 123 int err;
124 124
125 if (!netif_running(dev)) 125 if (!netif_running(dev))
@@ -150,7 +150,7 @@ out:
150 150
151static int uml_net_open(struct net_device *dev) 151static int uml_net_open(struct net_device *dev)
152{ 152{
153 struct uml_net_private *lp = dev->priv; 153 struct uml_net_private *lp = netdev_priv(dev);
154 int err; 154 int err;
155 155
156 if (lp->fd >= 0) { 156 if (lp->fd >= 0) {
@@ -195,7 +195,7 @@ out:
195 195
196static int uml_net_close(struct net_device *dev) 196static int uml_net_close(struct net_device *dev)
197{ 197{
198 struct uml_net_private *lp = dev->priv; 198 struct uml_net_private *lp = netdev_priv(dev);
199 199
200 netif_stop_queue(dev); 200 netif_stop_queue(dev);
201 201
@@ -213,7 +213,7 @@ static int uml_net_close(struct net_device *dev)
213 213
214static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev) 214static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
215{ 215{
216 struct uml_net_private *lp = dev->priv; 216 struct uml_net_private *lp = netdev_priv(dev);
217 unsigned long flags; 217 unsigned long flags;
218 int len; 218 int len;
219 219
@@ -250,7 +250,7 @@ static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
250 250
251static struct net_device_stats *uml_net_get_stats(struct net_device *dev) 251static struct net_device_stats *uml_net_get_stats(struct net_device *dev)
252{ 252{
253 struct uml_net_private *lp = dev->priv; 253 struct uml_net_private *lp = netdev_priv(dev);
254 return &lp->stats; 254 return &lp->stats;
255} 255}
256 256
@@ -267,7 +267,7 @@ static void uml_net_tx_timeout(struct net_device *dev)
267 267
268static int uml_net_set_mac(struct net_device *dev, void *addr) 268static int uml_net_set_mac(struct net_device *dev, void *addr)
269{ 269{
270 struct uml_net_private *lp = dev->priv; 270 struct uml_net_private *lp = netdev_priv(dev);
271 struct sockaddr *hwaddr = addr; 271 struct sockaddr *hwaddr = addr;
272 272
273 spin_lock_irq(&lp->lock); 273 spin_lock_irq(&lp->lock);
@@ -368,7 +368,7 @@ static void net_device_release(struct device *dev)
368{ 368{
369 struct uml_net *device = dev->driver_data; 369 struct uml_net *device = dev->driver_data;
370 struct net_device *netdev = device->dev; 370 struct net_device *netdev = device->dev;
371 struct uml_net_private *lp = netdev->priv; 371 struct uml_net_private *lp = netdev_priv(netdev);
372 372
373 if (lp->remove != NULL) 373 if (lp->remove != NULL)
374 (*lp->remove)(&lp->user); 374 (*lp->remove)(&lp->user);
@@ -418,14 +418,9 @@ static void eth_configure(int n, void *init, char *mac,
418 418
419 setup_etheraddr(mac, device->mac, dev->name); 419 setup_etheraddr(mac, device->mac, dev->name);
420 420
421 printk(KERN_INFO "Netdevice %d ", n); 421 printk(KERN_INFO "Netdevice %d (%pM) : ", n, device->mac);
422 printk("(%02x:%02x:%02x:%02x:%02x:%02x) ",
423 device->mac[0], device->mac[1],
424 device->mac[2], device->mac[3],
425 device->mac[4], device->mac[5]);
426 printk(": ");
427 422
428 lp = dev->priv; 423 lp = netdev_priv(dev);
429 /* This points to the transport private data. It's still clear, but we 424 /* This points to the transport private data. It's still clear, but we
430 * must memset it to 0 *now*. Let's help the drivers. */ 425 * must memset it to 0 *now*. Let's help the drivers. */
431 memset(lp, 0, size); 426 memset(lp, 0, size);
@@ -735,7 +730,7 @@ static int net_remove(int n, char **error_out)
735 return -ENODEV; 730 return -ENODEV;
736 731
737 dev = device->dev; 732 dev = device->dev;
738 lp = dev->priv; 733 lp = netdev_priv(dev);
739 if (lp->fd > 0) 734 if (lp->fd > 0)
740 return -EBUSY; 735 return -EBUSY;
741 unregister_netdev(dev); 736 unregister_netdev(dev);
@@ -766,7 +761,7 @@ static int uml_inetaddr_event(struct notifier_block *this, unsigned long event,
766 if (dev->open != uml_net_open) 761 if (dev->open != uml_net_open)
767 return NOTIFY_DONE; 762 return NOTIFY_DONE;
768 763
769 lp = dev->priv; 764 lp = netdev_priv(dev);
770 765
771 proc = NULL; 766 proc = NULL;
772 switch (event) { 767 switch (event) {
diff --git a/arch/um/drivers/pcap_kern.c b/arch/um/drivers/pcap_kern.c
index 3a750dd39be1..2860525f8ff6 100644
--- a/arch/um/drivers/pcap_kern.c
+++ b/arch/um/drivers/pcap_kern.c
@@ -21,7 +21,7 @@ void pcap_init(struct net_device *dev, void *data)
21 struct pcap_data *ppri; 21 struct pcap_data *ppri;
22 struct pcap_init *init = data; 22 struct pcap_init *init = data;
23 23
24 pri = dev->priv; 24 pri = netdev_priv(dev);
25 ppri = (struct pcap_data *) pri->user; 25 ppri = (struct pcap_data *) pri->user;
26 ppri->host_if = init->host_if; 26 ppri->host_if = init->host_if;
27 ppri->promisc = init->promisc; 27 ppri->promisc = init->promisc;
diff --git a/arch/um/drivers/slip_kern.c b/arch/um/drivers/slip_kern.c
index d19faec7046e..5ec17563142e 100644
--- a/arch/um/drivers/slip_kern.c
+++ b/arch/um/drivers/slip_kern.c
@@ -19,7 +19,7 @@ static void slip_init(struct net_device *dev, void *data)
19 struct slip_data *spri; 19 struct slip_data *spri;
20 struct slip_init *init = data; 20 struct slip_init *init = data;
21 21
22 private = dev->priv; 22 private = netdev_priv(dev);
23 spri = (struct slip_data *) private->user; 23 spri = (struct slip_data *) private->user;
24 24
25 memset(spri->name, 0, sizeof(spri->name)); 25 memset(spri->name, 0, sizeof(spri->name));
diff --git a/arch/um/drivers/slirp_kern.c b/arch/um/drivers/slirp_kern.c
index d987af277db9..f15a6e7654f3 100644
--- a/arch/um/drivers/slirp_kern.c
+++ b/arch/um/drivers/slirp_kern.c
@@ -22,7 +22,7 @@ void slirp_init(struct net_device *dev, void *data)
22 struct slirp_init *init = data; 22 struct slirp_init *init = data;
23 int i; 23 int i;
24 24
25 private = dev->priv; 25 private = netdev_priv(dev);
26 spri = (struct slirp_data *) private->user; 26 spri = (struct slirp_data *) private->user;
27 27
28 spri->argw = init->argw; 28 spri->argw = init->argw;
diff --git a/arch/um/drivers/vde_kern.c b/arch/um/drivers/vde_kern.c
index add7e722defb..1b852bffdebc 100644
--- a/arch/um/drivers/vde_kern.c
+++ b/arch/um/drivers/vde_kern.c
@@ -19,7 +19,7 @@ static void vde_init(struct net_device *dev, void *data)
19 struct uml_net_private *pri; 19 struct uml_net_private *pri;
20 struct vde_data *vpri; 20 struct vde_data *vpri;
21 21
22 pri = dev->priv; 22 pri = netdev_priv(dev);
23 vpri = (struct vde_data *) pri->user; 23 vpri = (struct vde_data *) pri->user;
24 24
25 vpri->vde_switch = init->vde_switch; 25 vpri->vde_switch = init->vde_switch;
diff --git a/arch/um/kernel/init_task.c b/arch/um/kernel/init_task.c
index 910eda8fca18..806d381947bf 100644
--- a/arch/um/kernel/init_task.c
+++ b/arch/um/kernel/init_task.c
@@ -10,7 +10,6 @@
10#include "linux/mqueue.h" 10#include "linux/mqueue.h"
11#include "asm/uaccess.h" 11#include "asm/uaccess.h"
12 12
13static struct fs_struct init_fs = INIT_FS;
14struct mm_struct init_mm = INIT_MM(init_mm); 13struct mm_struct init_mm = INIT_MM(init_mm);
15static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 14static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 15static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
diff --git a/arch/um/kernel/smp.c b/arch/um/kernel/smp.c
index 045772142844..98351c78bc81 100644
--- a/arch/um/kernel/smp.c
+++ b/arch/um/kernel/smp.c
@@ -25,13 +25,6 @@ DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
25#include "irq_user.h" 25#include "irq_user.h"
26#include "os.h" 26#include "os.h"
27 27
28/* CPU online map, set by smp_boot_cpus */
29cpumask_t cpu_online_map = CPU_MASK_NONE;
30cpumask_t cpu_possible_map = CPU_MASK_NONE;
31
32EXPORT_SYMBOL(cpu_online_map);
33EXPORT_SYMBOL(cpu_possible_map);
34
35/* Per CPU bogomips and other parameters 28/* Per CPU bogomips and other parameters
36 * The only piece used here is the ipi pipe, which is set before SMP is 29 * The only piece used here is the ipi pipe, which is set before SMP is
37 * started and never changed. 30 * started and never changed.
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index 47f04f4a3464..b13a87a3ec95 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -50,7 +50,7 @@ static int itimer_next_event(unsigned long delta,
50static struct clock_event_device itimer_clockevent = { 50static struct clock_event_device itimer_clockevent = {
51 .name = "itimer", 51 .name = "itimer",
52 .rating = 250, 52 .rating = 250,
53 .cpumask = CPU_MASK_ALL, 53 .cpumask = cpu_all_mask,
54 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 54 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
55 .set_mode = itimer_set_mode, 55 .set_mode = itimer_set_mode,
56 .set_next_event = itimer_next_event, 56 .set_next_event = itimer_next_event,
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c
index 44e490419495..7384d8accfe7 100644
--- a/arch/um/kernel/trap.c
+++ b/arch/um/kernel/trap.c
@@ -64,11 +64,10 @@ good_area:
64 64
65 do { 65 do {
66 int fault; 66 int fault;
67survive: 67
68 fault = handle_mm_fault(mm, vma, address, is_write); 68 fault = handle_mm_fault(mm, vma, address, is_write);
69 if (unlikely(fault & VM_FAULT_ERROR)) { 69 if (unlikely(fault & VM_FAULT_ERROR)) {
70 if (fault & VM_FAULT_OOM) { 70 if (fault & VM_FAULT_OOM) {
71 err = -ENOMEM;
72 goto out_of_memory; 71 goto out_of_memory;
73 } else if (fault & VM_FAULT_SIGBUS) { 72 } else if (fault & VM_FAULT_SIGBUS) {
74 err = -EACCES; 73 err = -EACCES;
@@ -104,18 +103,14 @@ out:
104out_nosemaphore: 103out_nosemaphore:
105 return err; 104 return err;
106 105
107/*
108 * We ran out of memory, or some other thing happened to us that made
109 * us unable to handle the page fault gracefully.
110 */
111out_of_memory: 106out_of_memory:
112 if (is_global_init(current)) { 107 /*
113 up_read(&mm->mmap_sem); 108 * We ran out of memory, call the OOM killer, and return the userspace
114 yield(); 109 * (which will retry the fault, or kill us if we got oom-killed).
115 down_read(&mm->mmap_sem); 110 */
116 goto survive; 111 up_read(&mm->mmap_sem);
117 } 112 pagefault_out_of_memory();
118 goto out; 113 return 0;
119} 114}
120 115
121static void bad_segv(struct faultinfo fi, unsigned long ip) 116static void bad_segv(struct faultinfo fi, unsigned long ip)
@@ -214,9 +209,6 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user,
214 si.si_addr = (void __user *)address; 209 si.si_addr = (void __user *)address;
215 current->thread.arch.faultinfo = fi; 210 current->thread.arch.faultinfo = fi;
216 force_sig_info(SIGBUS, &si, current); 211 force_sig_info(SIGBUS, &si, current);
217 } else if (err == -ENOMEM) {
218 printk(KERN_INFO "VM: killing process %s\n", current->comm);
219 do_exit(SIGKILL);
220 } else { 212 } else {
221 BUG_ON(err != -EFAULT); 213 BUG_ON(err != -EFAULT);
222 si.si_signo = SIGSEGV; 214 si.si_signo = SIGSEGV;
diff --git a/arch/um/os-Linux/drivers/ethertap_kern.c b/arch/um/os-Linux/drivers/ethertap_kern.c
index 046a131f6104..7f6f9a71aae4 100644
--- a/arch/um/os-Linux/drivers/ethertap_kern.c
+++ b/arch/um/os-Linux/drivers/ethertap_kern.c
@@ -22,7 +22,7 @@ static void etap_init(struct net_device *dev, void *data)
22 struct ethertap_data *epri; 22 struct ethertap_data *epri;
23 struct ethertap_init *init = data; 23 struct ethertap_init *init = data;
24 24
25 pri = dev->priv; 25 pri = netdev_priv(dev);
26 epri = (struct ethertap_data *) pri->user; 26 epri = (struct ethertap_data *) pri->user;
27 epri->dev_name = init->dev_name; 27 epri->dev_name = init->dev_name;
28 epri->gate_addr = init->gate_addr; 28 epri->gate_addr = init->gate_addr;
diff --git a/arch/um/os-Linux/drivers/tuntap_kern.c b/arch/um/os-Linux/drivers/tuntap_kern.c
index 6b9e33d5de20..4048800e4696 100644
--- a/arch/um/os-Linux/drivers/tuntap_kern.c
+++ b/arch/um/os-Linux/drivers/tuntap_kern.c
@@ -21,7 +21,7 @@ static void tuntap_init(struct net_device *dev, void *data)
21 struct tuntap_data *tpri; 21 struct tuntap_data *tpri;
22 struct tuntap_init *init = data; 22 struct tuntap_init *init = data;
23 23
24 pri = dev->priv; 24 pri = netdev_priv(dev);
25 tpri = (struct tuntap_data *) pri->user; 25 tpri = (struct tuntap_data *) pri->user;
26 tpri->dev_name = init->dev_name; 26 tpri->dev_name = init->dev_name;
27 tpri->fixed_config = (init->dev_name != NULL); 27 tpri->fixed_config = (init->dev_name != NULL);
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index ac22bb7719f7..862adb9bf0d4 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -19,6 +19,8 @@ config X86_64
19config X86 19config X86
20 def_bool y 20 def_bool y
21 select HAVE_AOUT if X86_32 21 select HAVE_AOUT if X86_32
22 select HAVE_READQ
23 select HAVE_WRITEQ
22 select HAVE_UNSTABLE_SCHED_CLOCK 24 select HAVE_UNSTABLE_SCHED_CLOCK
23 select HAVE_IDE 25 select HAVE_IDE
24 select HAVE_OPROFILE 26 select HAVE_OPROFILE
@@ -29,11 +31,14 @@ config X86
29 select HAVE_FTRACE_MCOUNT_RECORD 31 select HAVE_FTRACE_MCOUNT_RECORD
30 select HAVE_DYNAMIC_FTRACE 32 select HAVE_DYNAMIC_FTRACE
31 select HAVE_FUNCTION_TRACER 33 select HAVE_FUNCTION_TRACER
34 select HAVE_FUNCTION_GRAPH_TRACER
35 select HAVE_FUNCTION_TRACE_MCOUNT_TEST
32 select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) 36 select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64)
33 select HAVE_ARCH_KGDB if !X86_VOYAGER 37 select HAVE_ARCH_KGDB if !X86_VOYAGER
34 select HAVE_ARCH_TRACEHOOK 38 select HAVE_ARCH_TRACEHOOK
35 select HAVE_GENERIC_DMA_COHERENT if X86_32 39 select HAVE_GENERIC_DMA_COHERENT if X86_32
36 select HAVE_EFFICIENT_UNALIGNED_ACCESS 40 select HAVE_EFFICIENT_UNALIGNED_ACCESS
41 select USER_STACKTRACE_SUPPORT
37 42
38config ARCH_DEFCONFIG 43config ARCH_DEFCONFIG
39 string 44 string
@@ -87,6 +92,10 @@ config GENERIC_IOMAP
87config GENERIC_BUG 92config GENERIC_BUG
88 def_bool y 93 def_bool y
89 depends on BUG 94 depends on BUG
95 select GENERIC_BUG_RELATIVE_POINTERS if X86_64
96
97config GENERIC_BUG_RELATIVE_POINTERS
98 bool
90 99
91config GENERIC_HWEIGHT 100config GENERIC_HWEIGHT
92 def_bool y 101 def_bool y
@@ -238,25 +247,39 @@ config X86_HAS_BOOT_CPU_ID
238 def_bool y 247 def_bool y
239 depends on X86_VOYAGER 248 depends on X86_VOYAGER
240 249
250config SPARSE_IRQ
251 bool "Support sparse irq numbering"
252 depends on PCI_MSI || HT_IRQ
253 help
254 This enables support for sparse irqs. This is useful for distro
255 kernels that want to define a high CONFIG_NR_CPUS value but still
256 want to have low kernel memory footprint on smaller machines.
257
258 ( Sparse IRQs can also be beneficial on NUMA boxes, as they spread
259 out the irq_desc[] array in a more NUMA-friendly way. )
260
261 If you don't know what to do here, say N.
262
263config NUMA_MIGRATE_IRQ_DESC
264 bool "Move irq desc when changing irq smp_affinity"
265 depends on SPARSE_IRQ && NUMA
266 default n
267 help
268 This enables moving irq_desc to cpu/node that irq will use handled.
269
270 If you don't know what to do here, say N.
271
241config X86_FIND_SMP_CONFIG 272config X86_FIND_SMP_CONFIG
242 def_bool y 273 def_bool y
243 depends on X86_MPPARSE || X86_VOYAGER 274 depends on X86_MPPARSE || X86_VOYAGER
244 275
245if ACPI
246config X86_MPPARSE 276config X86_MPPARSE
247 def_bool y 277 bool "Enable MPS table" if ACPI
248 bool "Enable MPS table" 278 default y
249 depends on X86_LOCAL_APIC 279 depends on X86_LOCAL_APIC
250 help 280 help
251 For old smp systems that do not have proper acpi support. Newer systems 281 For old smp systems that do not have proper acpi support. Newer systems
252 (esp with 64bit cpus) with acpi support, MADT and DSDT will override it 282 (esp with 64bit cpus) with acpi support, MADT and DSDT will override it
253endif
254
255if !ACPI
256config X86_MPPARSE
257 def_bool y
258 depends on X86_LOCAL_APIC
259endif
260 283
261choice 284choice
262 prompt "Subarchitecture Type" 285 prompt "Subarchitecture Type"
@@ -367,10 +390,10 @@ config X86_RDC321X
367 as R-8610-(G). 390 as R-8610-(G).
368 If you don't have one of these chips, you should say N here. 391 If you don't have one of these chips, you should say N here.
369 392
370config SCHED_NO_NO_OMIT_FRAME_POINTER 393config SCHED_OMIT_FRAME_POINTER
371 def_bool y 394 def_bool y
372 prompt "Single-depth WCHAN output" 395 prompt "Single-depth WCHAN output"
373 depends on X86_32 396 depends on X86
374 help 397 help
375 Calculate simpler /proc/<PID>/wchan values. If this option 398 Calculate simpler /proc/<PID>/wchan values. If this option
376 is disabled then wchan values will recurse back to the 399 is disabled then wchan values will recurse back to the
@@ -465,10 +488,6 @@ config X86_CYCLONE_TIMER
465 def_bool y 488 def_bool y
466 depends on X86_GENERICARCH 489 depends on X86_GENERICARCH
467 490
468config ES7000_CLUSTERED_APIC
469 def_bool y
470 depends on SMP && X86_ES7000 && MPENTIUMIII
471
472source "arch/x86/Kconfig.cpu" 491source "arch/x86/Kconfig.cpu"
473 492
474config HPET_TIMER 493config HPET_TIMER
@@ -482,7 +501,7 @@ config HPET_TIMER
482 The HPET provides a stable time base on SMP 501 The HPET provides a stable time base on SMP
483 systems, unlike the TSC, but it is more expensive to access, 502 systems, unlike the TSC, but it is more expensive to access,
484 as it is off-chip. You can find the HPET spec at 503 as it is off-chip. You can find the HPET spec at
485 <http://www.intel.com/hardwaredesign/hpetspec.htm>. 504 <http://www.intel.com/hardwaredesign/hpetspec_1.pdf>.
486 505
487 You can safely choose Y here. However, HPET will only be 506 You can safely choose Y here. However, HPET will only be
488 activated if the platform and the BIOS support this feature. 507 activated if the platform and the BIOS support this feature.
@@ -567,9 +586,19 @@ config AMD_IOMMU
567 your BIOS for an option to enable it or if you have an IVRS ACPI 586 your BIOS for an option to enable it or if you have an IVRS ACPI
568 table. 587 table.
569 588
589config AMD_IOMMU_STATS
590 bool "Export AMD IOMMU statistics to debugfs"
591 depends on AMD_IOMMU
592 select DEBUG_FS
593 help
594 This option enables code in the AMD IOMMU driver to collect various
595 statistics about whats happening in the driver and exports that
596 information to userspace via debugfs.
597 If unsure, say N.
598
570# need this always selected by IOMMU for the VIA workaround 599# need this always selected by IOMMU for the VIA workaround
571config SWIOTLB 600config SWIOTLB
572 bool 601 def_bool y if X86_64
573 help 602 help
574 Support for software bounce buffers used on x86-64 systems 603 Support for software bounce buffers used on x86-64 systems
575 which don't have a hardware IOMMU (e.g. the current generation 604 which don't have a hardware IOMMU (e.g. the current generation
@@ -580,21 +609,25 @@ config SWIOTLB
580config IOMMU_HELPER 609config IOMMU_HELPER
581 def_bool (CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU) 610 def_bool (CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU)
582 611
612config IOMMU_API
613 def_bool (AMD_IOMMU || DMAR)
614
583config MAXSMP 615config MAXSMP
584 bool "Configure Maximum number of SMP Processors and NUMA Nodes" 616 bool "Configure Maximum number of SMP Processors and NUMA Nodes"
585 depends on X86_64 && SMP && BROKEN 617 depends on X86_64 && SMP && DEBUG_KERNEL && EXPERIMENTAL
618 select CPUMASK_OFFSTACK
586 default n 619 default n
587 help 620 help
588 Configure maximum number of CPUS and NUMA Nodes for this architecture. 621 Configure maximum number of CPUS and NUMA Nodes for this architecture.
589 If unsure, say N. 622 If unsure, say N.
590 623
591config NR_CPUS 624config NR_CPUS
592 int "Maximum number of CPUs (2-512)" if !MAXSMP 625 int "Maximum number of CPUs" if SMP && !MAXSMP
593 range 2 512 626 range 2 512 if SMP && !MAXSMP
594 depends on SMP 627 default "1" if !SMP
595 default "4096" if MAXSMP 628 default "4096" if MAXSMP
596 default "32" if X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000 629 default "32" if SMP && (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000)
597 default "8" 630 default "8" if SMP
598 help 631 help
599 This allows you to specify the maximum number of CPUs which this 632 This allows you to specify the maximum number of CPUs which this
600 kernel will support. The maximum supported value is 512 and the 633 kernel will support. The maximum supported value is 512 and the
@@ -660,6 +693,30 @@ config X86_VISWS_APIC
660 def_bool y 693 def_bool y
661 depends on X86_32 && X86_VISWS 694 depends on X86_32 && X86_VISWS
662 695
696config X86_REROUTE_FOR_BROKEN_BOOT_IRQS
697 bool "Reroute for broken boot IRQs"
698 default n
699 depends on X86_IO_APIC
700 help
701 This option enables a workaround that fixes a source of
702 spurious interrupts. This is recommended when threaded
703 interrupt handling is used on systems where the generation of
704 superfluous "boot interrupts" cannot be disabled.
705
706 Some chipsets generate a legacy INTx "boot IRQ" when the IRQ
707 entry in the chipset's IO-APIC is masked (as, e.g. the RT
708 kernel does during interrupt handling). On chipsets where this
709 boot IRQ generation cannot be disabled, this workaround keeps
710 the original IRQ line masked so that only the equivalent "boot
711 IRQ" is delivered to the CPUs. The workaround also tells the
712 kernel to set up the IRQ handler on the boot IRQ line. In this
713 way only one interrupt is delivered to the kernel. Otherwise
714 the spurious second interrupt may cause the kernel to bring
715 down (vital) interrupt lines.
716
717 Only affects "broken" chipsets. Interrupt sharing may be
718 increased on these systems.
719
663config X86_MCE 720config X86_MCE
664 bool "Machine Check Exception" 721 bool "Machine Check Exception"
665 depends on !X86_VOYAGER 722 depends on !X86_VOYAGER
@@ -956,24 +1013,37 @@ config X86_PAE
956config ARCH_PHYS_ADDR_T_64BIT 1013config ARCH_PHYS_ADDR_T_64BIT
957 def_bool X86_64 || X86_PAE 1014 def_bool X86_64 || X86_PAE
958 1015
1016config DIRECT_GBPAGES
1017 bool "Enable 1GB pages for kernel pagetables" if EMBEDDED
1018 default y
1019 depends on X86_64
1020 help
1021 Allow the kernel linear mapping to use 1GB pages on CPUs that
1022 support it. This can improve the kernel's performance a tiny bit by
1023 reducing TLB pressure. If in doubt, say "Y".
1024
959# Common NUMA Features 1025# Common NUMA Features
960config NUMA 1026config NUMA
961 bool "Numa Memory Allocation and Scheduler Support (EXPERIMENTAL)" 1027 bool "Numa Memory Allocation and Scheduler Support"
962 depends on SMP 1028 depends on SMP
963 depends on X86_64 || (X86_32 && HIGHMEM64G && (X86_NUMAQ || X86_BIGSMP || X86_SUMMIT && ACPI) && EXPERIMENTAL) 1029 depends on X86_64 || (X86_32 && HIGHMEM64G && (X86_NUMAQ || X86_BIGSMP || X86_SUMMIT && ACPI) && EXPERIMENTAL)
964 default n if X86_PC 1030 default n if X86_PC
965 default y if (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP) 1031 default y if (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP)
966 help 1032 help
967 Enable NUMA (Non Uniform Memory Access) support. 1033 Enable NUMA (Non Uniform Memory Access) support.
1034
968 The kernel will try to allocate memory used by a CPU on the 1035 The kernel will try to allocate memory used by a CPU on the
969 local memory controller of the CPU and add some more 1036 local memory controller of the CPU and add some more
970 NUMA awareness to the kernel. 1037 NUMA awareness to the kernel.
971 1038
972 For 32-bit this is currently highly experimental and should be only 1039 For 64-bit this is recommended if the system is Intel Core i7
973 used for kernel development. It might also cause boot failures. 1040 (or later), AMD Opteron, or EM64T NUMA.
974 For 64-bit this is recommended on all multiprocessor Opteron systems. 1041
975 If the system is EM64T, you should say N unless your system is 1042 For 32-bit this is only needed on (rare) 32-bit-only platforms
976 EM64T NUMA. 1043 that support NUMA topologies, such as NUMAQ / Summit, or if you
1044 boot a 32-bit kernel on a 64-bit NUMA platform.
1045
1046 Otherwise, you should say N.
977 1047
978comment "NUMA (Summit) requires SMP, 64GB highmem support, ACPI" 1048comment "NUMA (Summit) requires SMP, 64GB highmem support, ACPI"
979 depends on X86_32 && X86_SUMMIT && (!HIGHMEM64G || !ACPI) 1049 depends on X86_32 && X86_SUMMIT && (!HIGHMEM64G || !ACPI)
@@ -1493,6 +1563,10 @@ config ARCH_ENABLE_MEMORY_HOTPLUG
1493 def_bool y 1563 def_bool y
1494 depends on X86_64 || (X86_32 && HIGHMEM) 1564 depends on X86_64 || (X86_32 && HIGHMEM)
1495 1565
1566config ARCH_ENABLE_MEMORY_HOTREMOVE
1567 def_bool y
1568 depends on MEMORY_HOTPLUG
1569
1496config HAVE_ARCH_EARLY_PFN_TO_NID 1570config HAVE_ARCH_EARLY_PFN_TO_NID
1497 def_bool X86_64 1571 def_bool X86_64
1498 depends on NUMA 1572 depends on NUMA
@@ -1632,13 +1706,6 @@ config APM_ALLOW_INTS
1632 many of the newer IBM Thinkpads. If you experience hangs when you 1706 many of the newer IBM Thinkpads. If you experience hangs when you
1633 suspend, try setting this to Y. Otherwise, say N. 1707 suspend, try setting this to Y. Otherwise, say N.
1634 1708
1635config APM_REAL_MODE_POWER_OFF
1636 bool "Use real mode APM BIOS call to power off"
1637 help
1638 Use real mode APM BIOS calls to switch off the computer. This is
1639 a work-around for a number of buggy BIOSes. Switch this option on if
1640 your computer crashes instead of powering off properly.
1641
1642endif # APM 1709endif # APM
1643 1710
1644source "arch/x86/kernel/cpu/cpufreq/Kconfig" 1711source "arch/x86/kernel/cpu/cpufreq/Kconfig"
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index 8e99073b9e0f..8078955845ae 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -408,7 +408,7 @@ config X86_MINIMUM_CPU_FAMILY
408 408
409config X86_DEBUGCTLMSR 409config X86_DEBUGCTLMSR
410 def_bool y 410 def_bool y
411 depends on !(MK6 || MWINCHIPC6 || MWINCHIP3D || MCYRIXIII || M586MMX || M586TSC || M586 || M486 || M386) 411 depends on !(MK6 || MWINCHIPC6 || MWINCHIP3D || MCYRIXIII || M586MMX || M586TSC || M586 || M486 || M386) && !UML
412 412
413menuconfig PROCESSOR_SELECT 413menuconfig PROCESSOR_SELECT
414 bool "Supported processor vendors" if EMBEDDED 414 bool "Supported processor vendors" if EMBEDDED
@@ -515,12 +515,12 @@ config CPU_SUP_UMC_32
515config X86_DS 515config X86_DS
516 def_bool X86_PTRACE_BTS 516 def_bool X86_PTRACE_BTS
517 depends on X86_DEBUGCTLMSR 517 depends on X86_DEBUGCTLMSR
518 select HAVE_HW_BRANCH_TRACER
518 519
519config X86_PTRACE_BTS 520config X86_PTRACE_BTS
520 bool "Branch Trace Store" 521 bool "Branch Trace Store"
521 default y 522 default y
522 depends on X86_DEBUGCTLMSR 523 depends on X86_DEBUGCTLMSR
523 depends on BROKEN
524 help 524 help
525 This adds a ptrace interface to the hardware's branch trace store. 525 This adds a ptrace interface to the hardware's branch trace store.
526 526
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 2a3dfbd5e677..10d6cc3fd052 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -114,18 +114,6 @@ config DEBUG_RODATA
114 data. This is recommended so that we can catch kernel bugs sooner. 114 data. This is recommended so that we can catch kernel bugs sooner.
115 If in doubt, say "Y". 115 If in doubt, say "Y".
116 116
117config DIRECT_GBPAGES
118 bool "Enable gbpages-mapped kernel pagetables"
119 depends on DEBUG_KERNEL && EXPERIMENTAL && X86_64
120 help
121 Enable gigabyte pages support (if the CPU supports it). This can
122 improve the kernel's performance a tiny bit by reducing TLB
123 pressure.
124
125 This is experimental code.
126
127 If in doubt, say "N".
128
129config DEBUG_RODATA_TEST 117config DEBUG_RODATA_TEST
130 bool "Testcase for the DEBUG_RODATA feature" 118 bool "Testcase for the DEBUG_RODATA feature"
131 depends on DEBUG_RODATA 119 depends on DEBUG_RODATA
@@ -186,14 +174,10 @@ config IOMMU_LEAK
186 Add a simple leak tracer to the IOMMU code. This is useful when you 174 Add a simple leak tracer to the IOMMU code. This is useful when you
187 are debugging a buggy device driver that leaks IOMMU mappings. 175 are debugging a buggy device driver that leaks IOMMU mappings.
188 176
189config MMIOTRACE_HOOKS
190 bool
191
192config MMIOTRACE 177config MMIOTRACE
193 bool "Memory mapped IO tracing" 178 bool "Memory mapped IO tracing"
194 depends on DEBUG_KERNEL && PCI 179 depends on DEBUG_KERNEL && PCI
195 select TRACING 180 select TRACING
196 select MMIOTRACE_HOOKS
197 help 181 help
198 Mmiotrace traces Memory Mapped I/O access and is meant for 182 Mmiotrace traces Memory Mapped I/O access and is meant for
199 debugging and reverse engineering. It is called from the ioremap 183 debugging and reverse engineering. It is called from the ioremap
@@ -307,10 +291,10 @@ config OPTIMIZE_INLINING
307 developers have marked 'inline'. Doing so takes away freedom from gcc to 291 developers have marked 'inline'. Doing so takes away freedom from gcc to
308 do what it thinks is best, which is desirable for the gcc 3.x series of 292 do what it thinks is best, which is desirable for the gcc 3.x series of
309 compilers. The gcc 4.x series have a rewritten inlining algorithm and 293 compilers. The gcc 4.x series have a rewritten inlining algorithm and
310 disabling this option will generate a smaller kernel there. Hopefully 294 enabling this option will generate a smaller kernel there. Hopefully
311 this algorithm is so good that allowing gcc4 to make the decision can 295 this algorithm is so good that allowing gcc 4.x and above to make the
312 become the default in the future, until then this option is there to 296 decision will become the default in the future. Until then this option
313 test gcc for this. 297 is there to test gcc for this.
314 298
315 If unsure, say N. 299 If unsure, say N.
316 300
diff --git a/arch/x86/boot/video-vga.c b/arch/x86/boot/video-vga.c
index b939cb476dec..5d4742ed4aa2 100644
--- a/arch/x86/boot/video-vga.c
+++ b/arch/x86/boot/video-vga.c
@@ -34,7 +34,7 @@ static struct mode_info cga_modes[] = {
34 { VIDEO_80x25, 80, 25, 0 }, 34 { VIDEO_80x25, 80, 25, 0 },
35}; 35};
36 36
37__videocard video_vga; 37static __videocard video_vga;
38 38
39/* Set basic 80x25 mode */ 39/* Set basic 80x25 mode */
40static u8 vga_set_basic_mode(void) 40static u8 vga_set_basic_mode(void)
@@ -259,7 +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 = { 262static __videocard video_vga = {
263 .card_name = "VGA", 263 .card_name = "VGA",
264 .probe = vga_probe, 264 .probe = vga_probe,
265 .set_mode = vga_set_mode, 265 .set_mode = vga_set_mode,
diff --git a/arch/x86/boot/video.c b/arch/x86/boot/video.c
index 83598b23093a..3bef2c1febe9 100644
--- a/arch/x86/boot/video.c
+++ b/arch/x86/boot/video.c
@@ -226,7 +226,7 @@ static unsigned int mode_menu(void)
226 226
227#ifdef CONFIG_VIDEO_RETAIN 227#ifdef CONFIG_VIDEO_RETAIN
228/* Save screen content to the heap */ 228/* Save screen content to the heap */
229struct saved_screen { 229static struct saved_screen {
230 int x, y; 230 int x, y;
231 int curx, cury; 231 int curx, cury;
232 u16 *data; 232 u16 *data;
diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig
index 13b8c86ae985..b30a08ed8eb4 100644
--- a/arch/x86/configs/i386_defconfig
+++ b/arch/x86/configs/i386_defconfig
@@ -77,7 +77,7 @@ CONFIG_AUDIT=y
77CONFIG_AUDITSYSCALL=y 77CONFIG_AUDITSYSCALL=y
78CONFIG_AUDIT_TREE=y 78CONFIG_AUDIT_TREE=y
79# CONFIG_IKCONFIG is not set 79# CONFIG_IKCONFIG is not set
80CONFIG_LOG_BUF_SHIFT=17 80CONFIG_LOG_BUF_SHIFT=18
81CONFIG_CGROUPS=y 81CONFIG_CGROUPS=y
82# CONFIG_CGROUP_DEBUG is not set 82# CONFIG_CGROUP_DEBUG is not set
83CONFIG_CGROUP_NS=y 83CONFIG_CGROUP_NS=y
@@ -298,7 +298,7 @@ CONFIG_KEXEC=y
298CONFIG_CRASH_DUMP=y 298CONFIG_CRASH_DUMP=y
299# CONFIG_KEXEC_JUMP is not set 299# CONFIG_KEXEC_JUMP is not set
300CONFIG_PHYSICAL_START=0x1000000 300CONFIG_PHYSICAL_START=0x1000000
301CONFIG_RELOCATABLE=y 301# CONFIG_RELOCATABLE is not set
302CONFIG_PHYSICAL_ALIGN=0x200000 302CONFIG_PHYSICAL_ALIGN=0x200000
303CONFIG_HOTPLUG_CPU=y 303CONFIG_HOTPLUG_CPU=y
304# CONFIG_COMPAT_VDSO is not set 304# CONFIG_COMPAT_VDSO is not set
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index f0a03d7a7d63..0e7dbc0a3e46 100644
--- a/arch/x86/configs/x86_64_defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -77,7 +77,7 @@ CONFIG_AUDIT=y
77CONFIG_AUDITSYSCALL=y 77CONFIG_AUDITSYSCALL=y
78CONFIG_AUDIT_TREE=y 78CONFIG_AUDIT_TREE=y
79# CONFIG_IKCONFIG is not set 79# CONFIG_IKCONFIG is not set
80CONFIG_LOG_BUF_SHIFT=17 80CONFIG_LOG_BUF_SHIFT=18
81CONFIG_CGROUPS=y 81CONFIG_CGROUPS=y
82# CONFIG_CGROUP_DEBUG is not set 82# CONFIG_CGROUP_DEBUG is not set
83CONFIG_CGROUP_NS=y 83CONFIG_CGROUP_NS=y
@@ -298,7 +298,7 @@ CONFIG_SCHED_HRTICK=y
298CONFIG_KEXEC=y 298CONFIG_KEXEC=y
299CONFIG_CRASH_DUMP=y 299CONFIG_CRASH_DUMP=y
300CONFIG_PHYSICAL_START=0x1000000 300CONFIG_PHYSICAL_START=0x1000000
301CONFIG_RELOCATABLE=y 301# CONFIG_RELOCATABLE is not set
302CONFIG_PHYSICAL_ALIGN=0x200000 302CONFIG_PHYSICAL_ALIGN=0x200000
303CONFIG_HOTPLUG_CPU=y 303CONFIG_HOTPLUG_CPU=y
304# CONFIG_COMPAT_VDSO is not set 304# CONFIG_COMPAT_VDSO is not set
diff --git a/arch/x86/crypto/crc32c-intel.c b/arch/x86/crypto/crc32c-intel.c
index 070afc5b6c94..b9d00261703c 100644
--- a/arch/x86/crypto/crc32c-intel.c
+++ b/arch/x86/crypto/crc32c-intel.c
@@ -6,13 +6,22 @@
6 * Intel(R) 64 and IA-32 Architectures Software Developer's Manual 6 * Intel(R) 64 and IA-32 Architectures Software Developer's Manual
7 * Volume 2A: Instruction Set Reference, A-M 7 * Volume 2A: Instruction Set Reference, A-M
8 * 8 *
9 * Copyright (c) 2008 Austin Zhang <austin_zhang@linux.intel.com> 9 * Copyright (C) 2008 Intel Corporation
10 * Copyright (c) 2008 Kent Liu <kent.liu@intel.com> 10 * Authors: Austin Zhang <austin_zhang@linux.intel.com>
11 * Kent Liu <kent.liu@intel.com>
11 * 12 *
12 * This program is free software; you can redistribute it and/or modify it 13 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the Free 14 * under the terms and conditions of the GNU General Public License,
14 * Software Foundation; either version 2 of the License, or (at your option) 15 * version 2, as published by the Free Software Foundation.
15 * any later version. 16 *
17 * This program is distributed in the hope it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
20 * more details.
21 *
22 * You should have received a copy of the GNU General Public License along with
23 * this program; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 * 25 *
17 */ 26 */
18#include <linux/init.h> 27#include <linux/init.h>
@@ -75,99 +84,92 @@ static u32 __pure crc32c_intel_le_hw(u32 crc, unsigned char const *p, size_t len
75 * If your algorithm starts with ~0, then XOR with ~0 before you set 84 * If your algorithm starts with ~0, then XOR with ~0 before you set
76 * the seed. 85 * the seed.
77 */ 86 */
78static int crc32c_intel_setkey(struct crypto_ahash *hash, const u8 *key, 87static int crc32c_intel_setkey(struct crypto_shash *hash, const u8 *key,
79 unsigned int keylen) 88 unsigned int keylen)
80{ 89{
81 u32 *mctx = crypto_ahash_ctx(hash); 90 u32 *mctx = crypto_shash_ctx(hash);
82 91
83 if (keylen != sizeof(u32)) { 92 if (keylen != sizeof(u32)) {
84 crypto_ahash_set_flags(hash, CRYPTO_TFM_RES_BAD_KEY_LEN); 93 crypto_shash_set_flags(hash, CRYPTO_TFM_RES_BAD_KEY_LEN);
85 return -EINVAL; 94 return -EINVAL;
86 } 95 }
87 *mctx = le32_to_cpup((__le32 *)key); 96 *mctx = le32_to_cpup((__le32 *)key);
88 return 0; 97 return 0;
89} 98}
90 99
91static int crc32c_intel_init(struct ahash_request *req) 100static int crc32c_intel_init(struct shash_desc *desc)
92{ 101{
93 u32 *mctx = crypto_ahash_ctx(crypto_ahash_reqtfm(req)); 102 u32 *mctx = crypto_shash_ctx(desc->tfm);
94 u32 *crcp = ahash_request_ctx(req); 103 u32 *crcp = shash_desc_ctx(desc);
95 104
96 *crcp = *mctx; 105 *crcp = *mctx;
97 106
98 return 0; 107 return 0;
99} 108}
100 109
101static int crc32c_intel_update(struct ahash_request *req) 110static int crc32c_intel_update(struct shash_desc *desc, const u8 *data,
111 unsigned int len)
102{ 112{
103 struct crypto_hash_walk walk; 113 u32 *crcp = shash_desc_ctx(desc);
104 u32 *crcp = ahash_request_ctx(req);
105 u32 crc = *crcp;
106 int nbytes;
107
108 for (nbytes = crypto_hash_walk_first(req, &walk); nbytes;
109 nbytes = crypto_hash_walk_done(&walk, 0))
110 crc = crc32c_intel_le_hw(crc, walk.data, nbytes);
111 114
112 *crcp = crc; 115 *crcp = crc32c_intel_le_hw(*crcp, data, len);
113 return 0; 116 return 0;
114} 117}
115 118
116static int crc32c_intel_final(struct ahash_request *req) 119static int __crc32c_intel_finup(u32 *crcp, const u8 *data, unsigned int len,
120 u8 *out)
117{ 121{
118 u32 *crcp = ahash_request_ctx(req); 122 *(__le32 *)out = ~cpu_to_le32(crc32c_intel_le_hw(*crcp, data, len));
119
120 *(__le32 *)req->result = ~cpu_to_le32p(crcp);
121 return 0; 123 return 0;
122} 124}
123 125
124static int crc32c_intel_digest(struct ahash_request *req) 126static int crc32c_intel_finup(struct shash_desc *desc, const u8 *data,
127 unsigned int len, u8 *out)
125{ 128{
126 struct crypto_hash_walk walk; 129 return __crc32c_intel_finup(shash_desc_ctx(desc), data, len, out);
127 u32 *mctx = crypto_ahash_ctx(crypto_ahash_reqtfm(req)); 130}
128 u32 crc = *mctx;
129 int nbytes;
130 131
131 for (nbytes = crypto_hash_walk_first(req, &walk); nbytes; 132static int crc32c_intel_final(struct shash_desc *desc, u8 *out)
132 nbytes = crypto_hash_walk_done(&walk, 0)) 133{
133 crc = crc32c_intel_le_hw(crc, walk.data, nbytes); 134 u32 *crcp = shash_desc_ctx(desc);
134 135
135 *(__le32 *)req->result = ~cpu_to_le32(crc); 136 *(__le32 *)out = ~cpu_to_le32p(crcp);
136 return 0; 137 return 0;
137} 138}
138 139
140static int crc32c_intel_digest(struct shash_desc *desc, const u8 *data,
141 unsigned int len, u8 *out)
142{
143 return __crc32c_intel_finup(crypto_shash_ctx(desc->tfm), data, len,
144 out);
145}
146
139static int crc32c_intel_cra_init(struct crypto_tfm *tfm) 147static int crc32c_intel_cra_init(struct crypto_tfm *tfm)
140{ 148{
141 u32 *key = crypto_tfm_ctx(tfm); 149 u32 *key = crypto_tfm_ctx(tfm);
142 150
143 *key = ~0; 151 *key = ~0;
144 152
145 tfm->crt_ahash.reqsize = sizeof(u32);
146
147 return 0; 153 return 0;
148} 154}
149 155
150static struct crypto_alg alg = { 156static struct shash_alg alg = {
151 .cra_name = "crc32c", 157 .setkey = crc32c_intel_setkey,
152 .cra_driver_name = "crc32c-intel", 158 .init = crc32c_intel_init,
153 .cra_priority = 200, 159 .update = crc32c_intel_update,
154 .cra_flags = CRYPTO_ALG_TYPE_AHASH, 160 .final = crc32c_intel_final,
155 .cra_blocksize = CHKSUM_BLOCK_SIZE, 161 .finup = crc32c_intel_finup,
156 .cra_alignmask = 3, 162 .digest = crc32c_intel_digest,
157 .cra_ctxsize = sizeof(u32), 163 .descsize = sizeof(u32),
158 .cra_module = THIS_MODULE, 164 .digestsize = CHKSUM_DIGEST_SIZE,
159 .cra_list = LIST_HEAD_INIT(alg.cra_list), 165 .base = {
160 .cra_init = crc32c_intel_cra_init, 166 .cra_name = "crc32c",
161 .cra_type = &crypto_ahash_type, 167 .cra_driver_name = "crc32c-intel",
162 .cra_u = { 168 .cra_priority = 200,
163 .ahash = { 169 .cra_blocksize = CHKSUM_BLOCK_SIZE,
164 .digestsize = CHKSUM_DIGEST_SIZE, 170 .cra_ctxsize = sizeof(u32),
165 .setkey = crc32c_intel_setkey, 171 .cra_module = THIS_MODULE,
166 .init = crc32c_intel_init, 172 .cra_init = crc32c_intel_cra_init,
167 .update = crc32c_intel_update,
168 .final = crc32c_intel_final,
169 .digest = crc32c_intel_digest,
170 }
171 } 173 }
172}; 174};
173 175
@@ -175,14 +177,14 @@ static struct crypto_alg alg = {
175static int __init crc32c_intel_mod_init(void) 177static int __init crc32c_intel_mod_init(void)
176{ 178{
177 if (cpu_has_xmm4_2) 179 if (cpu_has_xmm4_2)
178 return crypto_register_alg(&alg); 180 return crypto_register_shash(&alg);
179 else 181 else
180 return -ENODEV; 182 return -ENODEV;
181} 183}
182 184
183static void __exit crc32c_intel_mod_fini(void) 185static void __exit crc32c_intel_mod_fini(void)
184{ 186{
185 crypto_unregister_alg(&alg); 187 crypto_unregister_shash(&alg);
186} 188}
187 189
188module_init(crc32c_intel_mod_init); 190module_init(crc32c_intel_mod_init);
@@ -194,4 +196,3 @@ MODULE_LICENSE("GPL");
194 196
195MODULE_ALIAS("crc32c"); 197MODULE_ALIAS("crc32c");
196MODULE_ALIAS("crc32c-intel"); 198MODULE_ALIAS("crc32c-intel");
197
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
index 127ec3f07214..2a4d073d2cf1 100644
--- a/arch/x86/ia32/ia32_aout.c
+++ b/arch/x86/ia32/ia32_aout.c
@@ -327,7 +327,7 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs)
327 current->mm->cached_hole_size = 0; 327 current->mm->cached_hole_size = 0;
328 328
329 current->mm->mmap = NULL; 329 current->mm->mmap = NULL;
330 compute_creds(bprm); 330 install_exec_creds(bprm);
331 current->flags &= ~PF_FORKNOEXEC; 331 current->flags &= ~PF_FORKNOEXEC;
332 332
333 if (N_MAGIC(ex) == OMAGIC) { 333 if (N_MAGIC(ex) == OMAGIC) {
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index 4bc02b23674b..9dabd00e9805 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -24,13 +24,14 @@
24#include <asm/ucontext.h> 24#include <asm/ucontext.h>
25#include <asm/uaccess.h> 25#include <asm/uaccess.h>
26#include <asm/i387.h> 26#include <asm/i387.h>
27#include <asm/ia32.h>
28#include <asm/ptrace.h> 27#include <asm/ptrace.h>
29#include <asm/ia32_unistd.h> 28#include <asm/ia32_unistd.h>
30#include <asm/user32.h> 29#include <asm/user32.h>
31#include <asm/sigcontext32.h> 30#include <asm/sigcontext32.h>
32#include <asm/proto.h> 31#include <asm/proto.h>
33#include <asm/vdso.h> 32#include <asm/vdso.h>
33#include <asm/sigframe.h>
34#include <asm/sys_ia32.h>
34 35
35#define DEBUG_SIG 0 36#define DEBUG_SIG 0
36 37
@@ -41,7 +42,6 @@
41 X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \ 42 X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \
42 X86_EFLAGS_CF) 43 X86_EFLAGS_CF)
43 44
44asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset);
45void signal_fault(struct pt_regs *regs, void __user *frame, char *where); 45void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
46 46
47int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) 47int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
@@ -173,47 +173,28 @@ asmlinkage long sys32_sigaltstack(const stack_ia32_t __user *uss_ptr,
173/* 173/*
174 * Do a signal return; undo the signal stack. 174 * Do a signal return; undo the signal stack.
175 */ 175 */
176#define COPY(x) { \
177 err |= __get_user(regs->x, &sc->x); \
178}
176 179
177struct sigframe 180#define COPY_SEG_CPL3(seg) { \
178{ 181 unsigned short tmp; \
179 u32 pretcode; 182 err |= __get_user(tmp, &sc->seg); \
180 int sig; 183 regs->seg = tmp | 3; \
181 struct sigcontext_ia32 sc;
182 struct _fpstate_ia32 fpstate_unused; /* look at kernel/sigframe.h */
183 unsigned int extramask[_COMPAT_NSIG_WORDS-1];
184 char retcode[8];
185 /* fp state follows here */
186};
187
188struct rt_sigframe
189{
190 u32 pretcode;
191 int sig;
192 u32 pinfo;
193 u32 puc;
194 compat_siginfo_t info;
195 struct ucontext_ia32 uc;
196 char retcode[8];
197 /* fp state follows here */
198};
199
200#define COPY(x) { \
201 unsigned int reg; \
202 err |= __get_user(reg, &sc->x); \
203 regs->x = reg; \
204} 184}
205 185
206#define RELOAD_SEG(seg,mask) \ 186#define RELOAD_SEG(seg) { \
207 { unsigned int cur; \ 187 unsigned int cur, pre; \
208 unsigned short pre; \ 188 err |= __get_user(pre, &sc->seg); \
209 err |= __get_user(pre, &sc->seg); \ 189 savesegment(seg, cur); \
210 savesegment(seg, cur); \ 190 pre |= 3; \
211 pre |= mask; \ 191 if (pre != cur) \
212 if (pre != cur) loadsegment(seg, pre); } 192 loadsegment(seg, pre); \
193}
213 194
214static int ia32_restore_sigcontext(struct pt_regs *regs, 195static int ia32_restore_sigcontext(struct pt_regs *regs,
215 struct sigcontext_ia32 __user *sc, 196 struct sigcontext_ia32 __user *sc,
216 unsigned int *peax) 197 unsigned int *pax)
217{ 198{
218 unsigned int tmpflags, gs, oldgs, err = 0; 199 unsigned int tmpflags, gs, oldgs, err = 0;
219 void __user *buf; 200 void __user *buf;
@@ -240,18 +221,16 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
240 if (gs != oldgs) 221 if (gs != oldgs)
241 load_gs_index(gs); 222 load_gs_index(gs);
242 223
243 RELOAD_SEG(fs, 3); 224 RELOAD_SEG(fs);
244 RELOAD_SEG(ds, 3); 225 RELOAD_SEG(ds);
245 RELOAD_SEG(es, 3); 226 RELOAD_SEG(es);
246 227
247 COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); 228 COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx);
248 COPY(dx); COPY(cx); COPY(ip); 229 COPY(dx); COPY(cx); COPY(ip);
249 /* Don't touch extended registers */ 230 /* Don't touch extended registers */
250 231
251 err |= __get_user(regs->cs, &sc->cs); 232 COPY_SEG_CPL3(cs);
252 regs->cs |= 3; 233 COPY_SEG_CPL3(ss);
253 err |= __get_user(regs->ss, &sc->ss);
254 regs->ss |= 3;
255 234
256 err |= __get_user(tmpflags, &sc->flags); 235 err |= __get_user(tmpflags, &sc->flags);
257 regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); 236 regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
@@ -262,15 +241,13 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
262 buf = compat_ptr(tmp); 241 buf = compat_ptr(tmp);
263 err |= restore_i387_xstate_ia32(buf); 242 err |= restore_i387_xstate_ia32(buf);
264 243
265 err |= __get_user(tmp, &sc->ax); 244 err |= __get_user(*pax, &sc->ax);
266 *peax = tmp;
267
268 return err; 245 return err;
269} 246}
270 247
271asmlinkage long sys32_sigreturn(struct pt_regs *regs) 248asmlinkage long sys32_sigreturn(struct pt_regs *regs)
272{ 249{
273 struct sigframe __user *frame = (struct sigframe __user *)(regs->sp-8); 250 struct sigframe_ia32 __user *frame = (struct sigframe_ia32 __user *)(regs->sp-8);
274 sigset_t set; 251 sigset_t set;
275 unsigned int ax; 252 unsigned int ax;
276 253
@@ -300,12 +277,12 @@ badframe:
300 277
301asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs) 278asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs)
302{ 279{
303 struct rt_sigframe __user *frame; 280 struct rt_sigframe_ia32 __user *frame;
304 sigset_t set; 281 sigset_t set;
305 unsigned int ax; 282 unsigned int ax;
306 struct pt_regs tregs; 283 struct pt_regs tregs;
307 284
308 frame = (struct rt_sigframe __user *)(regs->sp - 4); 285 frame = (struct rt_sigframe_ia32 __user *)(regs->sp - 4);
309 286
310 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 287 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
311 goto badframe; 288 goto badframe;
@@ -359,20 +336,15 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc,
359 err |= __put_user(regs->dx, &sc->dx); 336 err |= __put_user(regs->dx, &sc->dx);
360 err |= __put_user(regs->cx, &sc->cx); 337 err |= __put_user(regs->cx, &sc->cx);
361 err |= __put_user(regs->ax, &sc->ax); 338 err |= __put_user(regs->ax, &sc->ax);
362 err |= __put_user(regs->cs, &sc->cs);
363 err |= __put_user(regs->ss, &sc->ss);
364 err |= __put_user(current->thread.trap_no, &sc->trapno); 339 err |= __put_user(current->thread.trap_no, &sc->trapno);
365 err |= __put_user(current->thread.error_code, &sc->err); 340 err |= __put_user(current->thread.error_code, &sc->err);
366 err |= __put_user(regs->ip, &sc->ip); 341 err |= __put_user(regs->ip, &sc->ip);
342 err |= __put_user(regs->cs, (unsigned int __user *)&sc->cs);
367 err |= __put_user(regs->flags, &sc->flags); 343 err |= __put_user(regs->flags, &sc->flags);
368 err |= __put_user(regs->sp, &sc->sp_at_signal); 344 err |= __put_user(regs->sp, &sc->sp_at_signal);
345 err |= __put_user(regs->ss, (unsigned int __user *)&sc->ss);
369 346
370 tmp = save_i387_xstate_ia32(fpstate); 347 err |= __put_user(ptr_to_compat(fpstate), &sc->fpstate);
371 if (tmp < 0)
372 err = -EFAULT;
373 else
374 err |= __put_user(ptr_to_compat(tmp ? fpstate : NULL),
375 &sc->fpstate);
376 348
377 /* non-iBCS2 extensions.. */ 349 /* non-iBCS2 extensions.. */
378 err |= __put_user(mask, &sc->oldmask); 350 err |= __put_user(mask, &sc->oldmask);
@@ -400,7 +372,7 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
400 } 372 }
401 373
402 /* This is the legacy signal stack switching. */ 374 /* This is the legacy signal stack switching. */
403 else if ((regs->ss & 0xffff) != __USER_DS && 375 else if ((regs->ss & 0xffff) != __USER32_DS &&
404 !(ka->sa.sa_flags & SA_RESTORER) && 376 !(ka->sa.sa_flags & SA_RESTORER) &&
405 ka->sa.sa_restorer) 377 ka->sa.sa_restorer)
406 sp = (unsigned long) ka->sa.sa_restorer; 378 sp = (unsigned long) ka->sa.sa_restorer;
@@ -408,6 +380,8 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
408 if (used_math()) { 380 if (used_math()) {
409 sp = sp - sig_xstate_ia32_size; 381 sp = sp - sig_xstate_ia32_size;
410 *fpstate = (struct _fpstate_ia32 *) sp; 382 *fpstate = (struct _fpstate_ia32 *) sp;
383 if (save_i387_xstate_ia32(*fpstate) < 0)
384 return (void __user *) -1L;
411 } 385 }
412 386
413 sp -= frame_size; 387 sp -= frame_size;
@@ -420,7 +394,7 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
420int ia32_setup_frame(int sig, struct k_sigaction *ka, 394int ia32_setup_frame(int sig, struct k_sigaction *ka,
421 compat_sigset_t *set, struct pt_regs *regs) 395 compat_sigset_t *set, struct pt_regs *regs)
422{ 396{
423 struct sigframe __user *frame; 397 struct sigframe_ia32 __user *frame;
424 void __user *restorer; 398 void __user *restorer;
425 int err = 0; 399 int err = 0;
426 void __user *fpstate = NULL; 400 void __user *fpstate = NULL;
@@ -430,12 +404,10 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
430 u16 poplmovl; 404 u16 poplmovl;
431 u32 val; 405 u32 val;
432 u16 int80; 406 u16 int80;
433 u16 pad;
434 } __attribute__((packed)) code = { 407 } __attribute__((packed)) code = {
435 0xb858, /* popl %eax ; movl $...,%eax */ 408 0xb858, /* popl %eax ; movl $...,%eax */
436 __NR_ia32_sigreturn, 409 __NR_ia32_sigreturn,
437 0x80cd, /* int $0x80 */ 410 0x80cd, /* int $0x80 */
438 0,
439 }; 411 };
440 412
441 frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); 413 frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate);
@@ -471,7 +443,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
471 * These are actually not used anymore, but left because some 443 * These are actually not used anymore, but left because some
472 * gdb versions depend on them as a marker. 444 * gdb versions depend on them as a marker.
473 */ 445 */
474 err |= __copy_to_user(frame->retcode, &code, 8); 446 err |= __put_user(*((u64 *)&code), (u64 *)frame->retcode);
475 if (err) 447 if (err)
476 return -EFAULT; 448 return -EFAULT;
477 449
@@ -501,7 +473,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
501int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 473int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
502 compat_sigset_t *set, struct pt_regs *regs) 474 compat_sigset_t *set, struct pt_regs *regs)
503{ 475{
504 struct rt_sigframe __user *frame; 476 struct rt_sigframe_ia32 __user *frame;
505 void __user *restorer; 477 void __user *restorer;
506 int err = 0; 478 int err = 0;
507 void __user *fpstate = NULL; 479 void __user *fpstate = NULL;
@@ -511,8 +483,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
511 u8 movl; 483 u8 movl;
512 u32 val; 484 u32 val;
513 u16 int80; 485 u16 int80;
514 u16 pad; 486 u8 pad;
515 u8 pad2;
516 } __attribute__((packed)) code = { 487 } __attribute__((packed)) code = {
517 0xb8, 488 0xb8,
518 __NR_ia32_rt_sigreturn, 489 __NR_ia32_rt_sigreturn,
@@ -559,7 +530,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
559 * Not actually used anymore, but left because some gdb 530 * Not actually used anymore, but left because some gdb
560 * versions need it. 531 * versions need it.
561 */ 532 */
562 err |= __copy_to_user(frame->retcode, &code, 8); 533 err |= __put_user(*((u64 *)&code), (u64 *)frame->retcode);
563 if (err) 534 if (err)
564 return -EFAULT; 535 return -EFAULT;
565 536
@@ -572,11 +543,6 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
572 regs->dx = (unsigned long) &frame->info; 543 regs->dx = (unsigned long) &frame->info;
573 regs->cx = (unsigned long) &frame->uc; 544 regs->cx = (unsigned long) &frame->uc;
574 545
575 /* Make -mregparm=3 work */
576 regs->ax = sig;
577 regs->dx = (unsigned long) &frame->info;
578 regs->cx = (unsigned long) &frame->uc;
579
580 loadsegment(ds, __USER32_DS); 546 loadsegment(ds, __USER32_DS);
581 loadsegment(es, __USER32_DS); 547 loadsegment(es, __USER32_DS);
582 548
diff --git a/arch/x86/ia32/ipc32.c b/arch/x86/ia32/ipc32.c
index d21991ce606c..29cdcd02ead3 100644
--- a/arch/x86/ia32/ipc32.c
+++ b/arch/x86/ia32/ipc32.c
@@ -8,6 +8,7 @@
8#include <linux/shm.h> 8#include <linux/shm.h>
9#include <linux/ipc.h> 9#include <linux/ipc.h>
10#include <linux/compat.h> 10#include <linux/compat.h>
11#include <asm/sys_ia32.h>
11 12
12asmlinkage long sys32_ipc(u32 call, int first, int second, int third, 13asmlinkage long sys32_ipc(u32 call, int first, int second, int third,
13 compat_uptr_t ptr, u32 fifth) 14 compat_uptr_t ptr, u32 fifth)
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index 2e09dcd3c0a6..6c0d7f6231af 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -44,8 +44,8 @@
44#include <asm/types.h> 44#include <asm/types.h>
45#include <asm/uaccess.h> 45#include <asm/uaccess.h>
46#include <asm/atomic.h> 46#include <asm/atomic.h>
47#include <asm/ia32.h>
48#include <asm/vgtod.h> 47#include <asm/vgtod.h>
48#include <asm/sys_ia32.h>
49 49
50#define AA(__x) ((unsigned long)(__x)) 50#define AA(__x) ((unsigned long)(__x))
51 51
diff --git a/arch/x86/include/asm/amd_iommu_types.h b/arch/x86/include/asm/amd_iommu_types.h
index ac302a2fa339..95c8cd9d22b5 100644
--- a/arch/x86/include/asm/amd_iommu_types.h
+++ b/arch/x86/include/asm/amd_iommu_types.h
@@ -190,16 +190,23 @@
190/* FIXME: move this macro to <linux/pci.h> */ 190/* FIXME: move this macro to <linux/pci.h> */
191#define PCI_BUS(x) (((x) >> 8) & 0xff) 191#define PCI_BUS(x) (((x) >> 8) & 0xff)
192 192
193/* Protection domain flags */
194#define PD_DMA_OPS_MASK (1UL << 0) /* domain used for dma_ops */
195#define PD_DEFAULT_MASK (1UL << 1) /* domain is a default dma_ops
196 domain for an IOMMU */
197
193/* 198/*
194 * This structure contains generic data for IOMMU protection domains 199 * This structure contains generic data for IOMMU protection domains
195 * independent of their use. 200 * independent of their use.
196 */ 201 */
197struct protection_domain { 202struct protection_domain {
198 spinlock_t lock; /* mostly used to lock the page table*/ 203 spinlock_t lock; /* mostly used to lock the page table*/
199 u16 id; /* the domain id written to the device table */ 204 u16 id; /* the domain id written to the device table */
200 int mode; /* paging mode (0-6 levels) */ 205 int mode; /* paging mode (0-6 levels) */
201 u64 *pt_root; /* page table root pointer */ 206 u64 *pt_root; /* page table root pointer */
202 void *priv; /* private data */ 207 unsigned long flags; /* flags to find out type of domain */
208 unsigned dev_cnt; /* devices assigned to this domain */
209 void *priv; /* private data */
203}; 210};
204 211
205/* 212/*
@@ -295,7 +302,7 @@ struct amd_iommu {
295 bool int_enabled; 302 bool int_enabled;
296 303
297 /* if one, we need to send a completion wait command */ 304 /* if one, we need to send a completion wait command */
298 int need_sync; 305 bool need_sync;
299 306
300 /* default dma_ops domain for that IOMMU */ 307 /* default dma_ops domain for that IOMMU */
301 struct dma_ops_domain *default_dom; 308 struct dma_ops_domain *default_dom;
@@ -374,7 +381,7 @@ extern struct protection_domain **amd_iommu_pd_table;
374extern unsigned long *amd_iommu_pd_alloc_bitmap; 381extern unsigned long *amd_iommu_pd_alloc_bitmap;
375 382
376/* will be 1 if device isolation is enabled */ 383/* will be 1 if device isolation is enabled */
377extern int amd_iommu_isolate; 384extern bool amd_iommu_isolate;
378 385
379/* 386/*
380 * If true, the addresses will be flushed on unmap time, not when 387 * If true, the addresses will be flushed on unmap time, not when
@@ -382,18 +389,6 @@ extern int amd_iommu_isolate;
382 */ 389 */
383extern bool amd_iommu_unmap_flush; 390extern bool amd_iommu_unmap_flush;
384 391
385/* takes a PCI device id and prints it out in a readable form */
386static inline void print_devid(u16 devid, int nl)
387{
388 int bus = devid >> 8;
389 int dev = devid >> 3 & 0x1f;
390 int fn = devid & 0x07;
391
392 printk("%02x:%02x.%x", bus, dev, fn);
393 if (nl)
394 printk("\n");
395}
396
397/* takes bus and device/function and returns the device id 392/* takes bus and device/function and returns the device id
398 * FIXME: should that be in generic PCI code? */ 393 * FIXME: should that be in generic PCI code? */
399static inline u16 calc_devid(u8 bus, u8 devfn) 394static inline u16 calc_devid(u8 bus, u8 devfn)
@@ -401,4 +396,32 @@ static inline u16 calc_devid(u8 bus, u8 devfn)
401 return (((u16)bus) << 8) | devfn; 396 return (((u16)bus) << 8) | devfn;
402} 397}
403 398
399#ifdef CONFIG_AMD_IOMMU_STATS
400
401struct __iommu_counter {
402 char *name;
403 struct dentry *dent;
404 u64 value;
405};
406
407#define DECLARE_STATS_COUNTER(nm) \
408 static struct __iommu_counter nm = { \
409 .name = #nm, \
410 }
411
412#define INC_STATS_COUNTER(name) name.value += 1
413#define ADD_STATS_COUNTER(name, x) name.value += (x)
414#define SUB_STATS_COUNTER(name, x) name.value -= (x)
415
416#else /* CONFIG_AMD_IOMMU_STATS */
417
418#define DECLARE_STATS_COUNTER(name)
419#define INC_STATS_COUNTER(name)
420#define ADD_STATS_COUNTER(name, x)
421#define SUB_STATS_COUNTER(name, x)
422
423static inline void amd_iommu_stats_init(void) { }
424
425#endif /* CONFIG_AMD_IOMMU_STATS */
426
404#endif /* _ASM_X86_AMD_IOMMU_TYPES_H */ 427#endif /* _ASM_X86_AMD_IOMMU_TYPES_H */
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index 3b1510b4fc57..ab1d51a8855e 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -54,7 +54,6 @@ extern int disable_apic;
54extern int is_vsmp_box(void); 54extern int is_vsmp_box(void);
55extern void xapic_wait_icr_idle(void); 55extern void xapic_wait_icr_idle(void);
56extern u32 safe_xapic_wait_icr_idle(void); 56extern u32 safe_xapic_wait_icr_idle(void);
57extern u64 xapic_icr_read(void);
58extern void xapic_icr_write(u32, u32); 57extern void xapic_icr_write(u32, u32);
59extern int setup_profiling_timer(unsigned int); 58extern int setup_profiling_timer(unsigned int);
60 59
@@ -93,7 +92,7 @@ static inline u32 native_apic_msr_read(u32 reg)
93} 92}
94 93
95#ifndef CONFIG_X86_32 94#ifndef CONFIG_X86_32
96extern int x2apic, x2apic_preenabled; 95extern int x2apic;
97extern void check_x2apic(void); 96extern void check_x2apic(void);
98extern void enable_x2apic(void); 97extern void enable_x2apic(void);
99extern void enable_IR_x2apic(void); 98extern void enable_IR_x2apic(void);
@@ -193,6 +192,7 @@ extern u8 setup_APIC_eilvt_ibs(u8 vector, u8 msg_type, u8 mask);
193static inline void lapic_shutdown(void) { } 192static inline void lapic_shutdown(void) { }
194#define local_apic_timer_c2_ok 1 193#define local_apic_timer_c2_ok 1
195static inline void init_apic_mappings(void) { } 194static inline void init_apic_mappings(void) { }
195static inline void disable_local_APIC(void) { }
196 196
197#endif /* !CONFIG_X86_LOCAL_APIC */ 197#endif /* !CONFIG_X86_LOCAL_APIC */
198 198
diff --git a/arch/x86/include/asm/atomic_32.h b/arch/x86/include/asm/atomic_32.h
index ad5b9f6ecddf..85b46fba4229 100644
--- a/arch/x86/include/asm/atomic_32.h
+++ b/arch/x86/include/asm/atomic_32.h
@@ -2,6 +2,7 @@
2#define _ASM_X86_ATOMIC_32_H 2#define _ASM_X86_ATOMIC_32_H
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/types.h>
5#include <asm/processor.h> 6#include <asm/processor.h>
6#include <asm/cmpxchg.h> 7#include <asm/cmpxchg.h>
7 8
@@ -10,15 +11,6 @@
10 * resource counting etc.. 11 * resource counting etc..
11 */ 12 */
12 13
13/*
14 * Make sure gcc doesn't try to be clever and move things around
15 * on us. We need to use _exactly_ the address the user gave us,
16 * not some alias that contains the same information.
17 */
18typedef struct {
19 int counter;
20} atomic_t;
21
22#define ATOMIC_INIT(i) { (i) } 14#define ATOMIC_INIT(i) { (i) }
23 15
24/** 16/**
diff --git a/arch/x86/include/asm/atomic_64.h b/arch/x86/include/asm/atomic_64.h
index 279d2a731f3f..8c21731984da 100644
--- a/arch/x86/include/asm/atomic_64.h
+++ b/arch/x86/include/asm/atomic_64.h
@@ -1,25 +1,15 @@
1#ifndef _ASM_X86_ATOMIC_64_H 1#ifndef _ASM_X86_ATOMIC_64_H
2#define _ASM_X86_ATOMIC_64_H 2#define _ASM_X86_ATOMIC_64_H
3 3
4#include <linux/types.h>
4#include <asm/alternative.h> 5#include <asm/alternative.h>
5#include <asm/cmpxchg.h> 6#include <asm/cmpxchg.h>
6 7
7/* atomic_t should be 32 bit signed type */
8
9/* 8/*
10 * Atomic operations that C can't guarantee us. Useful for 9 * Atomic operations that C can't guarantee us. Useful for
11 * resource counting etc.. 10 * resource counting etc..
12 */ 11 */
13 12
14/*
15 * Make sure gcc doesn't try to be clever and move things around
16 * on us. We need to use _exactly_ the address the user gave us,
17 * not some alias that contains the same information.
18 */
19typedef struct {
20 int counter;
21} atomic_t;
22
23#define ATOMIC_INIT(i) { (i) } 13#define ATOMIC_INIT(i) { (i) }
24 14
25/** 15/**
@@ -191,11 +181,7 @@ static inline int atomic_sub_return(int i, atomic_t *v)
191#define atomic_inc_return(v) (atomic_add_return(1, v)) 181#define atomic_inc_return(v) (atomic_add_return(1, v))
192#define atomic_dec_return(v) (atomic_sub_return(1, v)) 182#define atomic_dec_return(v) (atomic_sub_return(1, v))
193 183
194/* An 64bit atomic type */ 184/* The 64-bit atomic type */
195
196typedef struct {
197 long counter;
198} atomic64_t;
199 185
200#define ATOMIC64_INIT(i) { (i) } 186#define ATOMIC64_INIT(i) { (i) }
201 187
diff --git a/arch/x86/include/asm/bigsmp/apic.h b/arch/x86/include/asm/bigsmp/apic.h
index 1d9543b9d358..d8dd9f537911 100644
--- a/arch/x86/include/asm/bigsmp/apic.h
+++ b/arch/x86/include/asm/bigsmp/apic.h
@@ -9,12 +9,12 @@ static inline int apic_id_registered(void)
9 return (1); 9 return (1);
10} 10}
11 11
12static inline cpumask_t target_cpus(void) 12static inline const cpumask_t *target_cpus(void)
13{ 13{
14#ifdef CONFIG_SMP 14#ifdef CONFIG_SMP
15 return cpu_online_map; 15 return &cpu_online_map;
16#else 16#else
17 return cpumask_of_cpu(0); 17 return &cpumask_of_cpu(0);
18#endif 18#endif
19} 19}
20 20
@@ -24,8 +24,6 @@ static inline cpumask_t target_cpus(void)
24#define INT_DELIVERY_MODE (dest_Fixed) 24#define INT_DELIVERY_MODE (dest_Fixed)
25#define INT_DEST_MODE (0) /* phys delivery to target proc */ 25#define INT_DEST_MODE (0) /* phys delivery to target proc */
26#define NO_BALANCE_IRQ (0) 26#define NO_BALANCE_IRQ (0)
27#define WAKE_SECONDARY_VIA_INIT
28
29 27
30static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) 28static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
31{ 29{
@@ -81,7 +79,7 @@ static inline int apicid_to_node(int logical_apicid)
81 79
82static inline int cpu_present_to_apicid(int mps_cpu) 80static inline int cpu_present_to_apicid(int mps_cpu)
83{ 81{
84 if (mps_cpu < NR_CPUS) 82 if (mps_cpu < nr_cpu_ids)
85 return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu); 83 return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu);
86 84
87 return BAD_APICID; 85 return BAD_APICID;
@@ -96,7 +94,7 @@ extern u8 cpu_2_logical_apicid[];
96/* Mapping from cpu number to logical apicid */ 94/* Mapping from cpu number to logical apicid */
97static inline int cpu_to_logical_apicid(int cpu) 95static inline int cpu_to_logical_apicid(int cpu)
98{ 96{
99 if (cpu >= NR_CPUS) 97 if (cpu >= nr_cpu_ids)
100 return BAD_APICID; 98 return BAD_APICID;
101 return cpu_physical_id(cpu); 99 return cpu_physical_id(cpu);
102} 100}
@@ -121,16 +119,34 @@ static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
121} 119}
122 120
123/* As we are using single CPU as destination, pick only one CPU here */ 121/* As we are using single CPU as destination, pick only one CPU here */
124static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask) 122static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
125{ 123{
126 int cpu; 124 int cpu;
127 int apicid; 125 int apicid;
128 126
129 cpu = first_cpu(cpumask); 127 cpu = first_cpu(*cpumask);
130 apicid = cpu_to_logical_apicid(cpu); 128 apicid = cpu_to_logical_apicid(cpu);
131 return apicid; 129 return apicid;
132} 130}
133 131
132static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
133 const struct cpumask *andmask)
134{
135 int cpu;
136
137 /*
138 * We're using fixed IRQ delivery, can only return one phys APIC ID.
139 * May as well be the first.
140 */
141 for_each_cpu_and(cpu, cpumask, andmask)
142 if (cpumask_test_cpu(cpu, cpu_online_mask))
143 break;
144 if (cpu < nr_cpu_ids)
145 return cpu_to_logical_apicid(cpu);
146
147 return BAD_APICID;
148}
149
134static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) 150static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
135{ 151{
136 return cpuid_apic >> index_msb; 152 return cpuid_apic >> index_msb;
diff --git a/arch/x86/include/asm/bigsmp/ipi.h b/arch/x86/include/asm/bigsmp/ipi.h
index 9404c535b7ec..27fcd01b3ae6 100644
--- a/arch/x86/include/asm/bigsmp/ipi.h
+++ b/arch/x86/include/asm/bigsmp/ipi.h
@@ -1,25 +1,22 @@
1#ifndef __ASM_MACH_IPI_H 1#ifndef __ASM_MACH_IPI_H
2#define __ASM_MACH_IPI_H 2#define __ASM_MACH_IPI_H
3 3
4void send_IPI_mask_sequence(cpumask_t mask, int vector); 4void send_IPI_mask_sequence(const struct cpumask *mask, int vector);
5void send_IPI_mask_allbutself(const struct cpumask *mask, int vector);
5 6
6static inline void send_IPI_mask(cpumask_t mask, int vector) 7static inline void send_IPI_mask(const struct cpumask *mask, int vector)
7{ 8{
8 send_IPI_mask_sequence(mask, vector); 9 send_IPI_mask_sequence(mask, vector);
9} 10}
10 11
11static inline void send_IPI_allbutself(int vector) 12static inline void send_IPI_allbutself(int vector)
12{ 13{
13 cpumask_t mask = cpu_online_map; 14 send_IPI_mask_allbutself(cpu_online_mask, vector);
14 cpu_clear(smp_processor_id(), mask);
15
16 if (!cpus_empty(mask))
17 send_IPI_mask(mask, vector);
18} 15}
19 16
20static inline void send_IPI_all(int vector) 17static inline void send_IPI_all(int vector)
21{ 18{
22 send_IPI_mask(cpu_online_map, vector); 19 send_IPI_mask(cpu_online_mask, vector);
23} 20}
24 21
25#endif /* __ASM_MACH_IPI_H */ 22#endif /* __ASM_MACH_IPI_H */
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
index 360010322711..9fa9dcdf344b 100644
--- a/arch/x86/include/asm/bitops.h
+++ b/arch/x86/include/asm/bitops.h
@@ -168,7 +168,15 @@ static inline void __change_bit(int nr, volatile unsigned long *addr)
168 */ 168 */
169static inline void change_bit(int nr, volatile unsigned long *addr) 169static inline void change_bit(int nr, volatile unsigned long *addr)
170{ 170{
171 asm volatile(LOCK_PREFIX "btc %1,%0" : ADDR : "Ir" (nr)); 171 if (IS_IMMEDIATE(nr)) {
172 asm volatile(LOCK_PREFIX "xorb %1,%0"
173 : CONST_MASK_ADDR(nr, addr)
174 : "iq" ((u8)CONST_MASK(nr)));
175 } else {
176 asm volatile(LOCK_PREFIX "btc %1,%0"
177 : BITOP_ADDR(addr)
178 : "Ir" (nr));
179 }
172} 180}
173 181
174/** 182/**
diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h
index 3def2065fcea..d9cf1cd156d2 100644
--- a/arch/x86/include/asm/bug.h
+++ b/arch/x86/include/asm/bug.h
@@ -9,7 +9,7 @@
9#ifdef CONFIG_X86_32 9#ifdef CONFIG_X86_32
10# define __BUG_C0 "2:\t.long 1b, %c0\n" 10# define __BUG_C0 "2:\t.long 1b, %c0\n"
11#else 11#else
12# define __BUG_C0 "2:\t.quad 1b, %c0\n" 12# define __BUG_C0 "2:\t.long 1b - 2b, %c0 - 2b\n"
13#endif 13#endif
14 14
15#define BUG() \ 15#define BUG() \
diff --git a/arch/x86/include/asm/byteorder.h b/arch/x86/include/asm/byteorder.h
index e02ae2d89acf..f110ad417df3 100644
--- a/arch/x86/include/asm/byteorder.h
+++ b/arch/x86/include/asm/byteorder.h
@@ -4,26 +4,33 @@
4#include <asm/types.h> 4#include <asm/types.h>
5#include <linux/compiler.h> 5#include <linux/compiler.h>
6 6
7#ifdef __GNUC__ 7#define __LITTLE_ENDIAN
8 8
9#ifdef __i386__ 9static inline __attribute_const__ __u32 __arch_swab32(__u32 val)
10
11static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
12{ 10{
13#ifdef CONFIG_X86_BSWAP 11#ifdef __i386__
14 asm("bswap %0" : "=r" (x) : "0" (x)); 12# ifdef CONFIG_X86_BSWAP
15#else 13 asm("bswap %0" : "=r" (val) : "0" (val));
14# else
16 asm("xchgb %b0,%h0\n\t" /* swap lower bytes */ 15 asm("xchgb %b0,%h0\n\t" /* swap lower bytes */
17 "rorl $16,%0\n\t" /* swap words */ 16 "rorl $16,%0\n\t" /* swap words */
18 "xchgb %b0,%h0" /* swap higher bytes */ 17 "xchgb %b0,%h0" /* swap higher bytes */
19 : "=q" (x) 18 : "=q" (val)
20 : "0" (x)); 19 : "0" (val));
20# endif
21
22#else /* __i386__ */
23 asm("bswapl %0"
24 : "=r" (val)
25 : "0" (val));
21#endif 26#endif
22 return x; 27 return val;
23} 28}
29#define __arch_swab32 __arch_swab32
24 30
25static inline __attribute_const__ __u64 ___arch__swab64(__u64 val) 31static inline __attribute_const__ __u64 __arch_swab64(__u64 val)
26{ 32{
33#ifdef __i386__
27 union { 34 union {
28 struct { 35 struct {
29 __u32 a; 36 __u32 a;
@@ -32,50 +39,27 @@ static inline __attribute_const__ __u64 ___arch__swab64(__u64 val)
32 __u64 u; 39 __u64 u;
33 } v; 40 } v;
34 v.u = val; 41 v.u = val;
35#ifdef CONFIG_X86_BSWAP 42# ifdef CONFIG_X86_BSWAP
36 asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1" 43 asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
37 : "=r" (v.s.a), "=r" (v.s.b) 44 : "=r" (v.s.a), "=r" (v.s.b)
38 : "0" (v.s.a), "1" (v.s.b)); 45 : "0" (v.s.a), "1" (v.s.b));
39#else 46# else
40 v.s.a = ___arch__swab32(v.s.a); 47 v.s.a = __arch_swab32(v.s.a);
41 v.s.b = ___arch__swab32(v.s.b); 48 v.s.b = __arch_swab32(v.s.b);
42 asm("xchgl %0,%1" 49 asm("xchgl %0,%1"
43 : "=r" (v.s.a), "=r" (v.s.b) 50 : "=r" (v.s.a), "=r" (v.s.b)
44 : "0" (v.s.a), "1" (v.s.b)); 51 : "0" (v.s.a), "1" (v.s.b));
45#endif 52# endif
46 return v.u; 53 return v.u;
47}
48
49#else /* __i386__ */ 54#else /* __i386__ */
50
51static inline __attribute_const__ __u64 ___arch__swab64(__u64 x)
52{
53 asm("bswapq %0" 55 asm("bswapq %0"
54 : "=r" (x) 56 : "=r" (val)
55 : "0" (x)); 57 : "0" (val));
56 return x; 58 return val;
57}
58
59static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
60{
61 asm("bswapl %0"
62 : "=r" (x)
63 : "0" (x));
64 return x;
65}
66
67#endif 59#endif
60}
61#define __arch_swab64 __arch_swab64
68 62
69/* Do not define swab16. Gcc is smart enough to recognize "C" version and 63#include <linux/byteorder.h>
70 convert it into rotation or exhange. */
71
72#define __arch__swab64(x) ___arch__swab64(x)
73#define __arch__swab32(x) ___arch__swab32(x)
74
75#define __BYTEORDER_HAS_U64__
76
77#endif /* __GNUC__ */
78
79#include <linux/byteorder/little_endian.h>
80 64
81#endif /* _ASM_X86_BYTEORDER_H */ 65#endif /* _ASM_X86_BYTEORDER_H */
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index cfdf8c2c5c31..ea408dcba513 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -80,7 +80,6 @@
80#define X86_FEATURE_UP (3*32+ 9) /* smp kernel running on up */ 80#define X86_FEATURE_UP (3*32+ 9) /* smp kernel running on up */
81#define X86_FEATURE_FXSAVE_LEAK (3*32+10) /* "" FXSAVE leaks FOP/FIP/FOP */ 81#define X86_FEATURE_FXSAVE_LEAK (3*32+10) /* "" FXSAVE leaks FOP/FIP/FOP */
82#define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */ 82#define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */
83#define X86_FEATURE_NOPL (3*32+20) /* The NOPL (0F 1F) instructions */
84#define X86_FEATURE_PEBS (3*32+12) /* Precise-Event Based Sampling */ 83#define X86_FEATURE_PEBS (3*32+12) /* Precise-Event Based Sampling */
85#define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */ 84#define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */
86#define X86_FEATURE_SYSCALL32 (3*32+14) /* "" syscall in ia32 userspace */ 85#define X86_FEATURE_SYSCALL32 (3*32+14) /* "" syscall in ia32 userspace */
@@ -92,6 +91,8 @@
92#define X86_FEATURE_NOPL (3*32+20) /* The NOPL (0F 1F) instructions */ 91#define X86_FEATURE_NOPL (3*32+20) /* The NOPL (0F 1F) instructions */
93#define X86_FEATURE_AMDC1E (3*32+21) /* AMD C1E detected */ 92#define X86_FEATURE_AMDC1E (3*32+21) /* AMD C1E detected */
94#define X86_FEATURE_XTOPOLOGY (3*32+22) /* cpu topology enum extensions */ 93#define X86_FEATURE_XTOPOLOGY (3*32+22) /* cpu topology enum extensions */
94#define X86_FEATURE_TSC_RELIABLE (3*32+23) /* TSC is known to be reliable */
95#define X86_FEATURE_NONSTOP_TSC (3*32+24) /* TSC does not stop in C states */
95 96
96/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ 97/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
97#define X86_FEATURE_XMM3 (4*32+ 0) /* "pni" SSE-3 */ 98#define X86_FEATURE_XMM3 (4*32+ 0) /* "pni" SSE-3 */
@@ -117,6 +118,7 @@
117#define X86_FEATURE_XSAVE (4*32+26) /* XSAVE/XRSTOR/XSETBV/XGETBV */ 118#define X86_FEATURE_XSAVE (4*32+26) /* XSAVE/XRSTOR/XSETBV/XGETBV */
118#define X86_FEATURE_OSXSAVE (4*32+27) /* "" XSAVE enabled in the OS */ 119#define X86_FEATURE_OSXSAVE (4*32+27) /* "" XSAVE enabled in the OS */
119#define X86_FEATURE_AVX (4*32+28) /* Advanced Vector Extensions */ 120#define X86_FEATURE_AVX (4*32+28) /* Advanced Vector Extensions */
121#define X86_FEATURE_HYPERVISOR (4*32+31) /* Running on a hypervisor */
120 122
121/* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */ 123/* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */
122#define X86_FEATURE_XSTORE (5*32+ 2) /* "rng" RNG present (xstore) */ 124#define X86_FEATURE_XSTORE (5*32+ 2) /* "rng" RNG present (xstore) */
@@ -237,6 +239,7 @@ extern const char * const x86_power_flags[32];
237#define cpu_has_xmm4_2 boot_cpu_has(X86_FEATURE_XMM4_2) 239#define cpu_has_xmm4_2 boot_cpu_has(X86_FEATURE_XMM4_2)
238#define cpu_has_x2apic boot_cpu_has(X86_FEATURE_X2APIC) 240#define cpu_has_x2apic boot_cpu_has(X86_FEATURE_X2APIC)
239#define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE) 241#define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)
242#define cpu_has_hypervisor boot_cpu_has(X86_FEATURE_HYPERVISOR)
240 243
241#if defined(CONFIG_X86_INVLPG) || defined(CONFIG_X86_64) 244#if defined(CONFIG_X86_INVLPG) || defined(CONFIG_X86_64)
242# define cpu_has_invlpg 1 245# define cpu_has_invlpg 1
diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
index e6b82b17b072..dc27705f5443 100644
--- a/arch/x86/include/asm/desc.h
+++ b/arch/x86/include/asm/desc.h
@@ -320,16 +320,14 @@ static inline void set_intr_gate(unsigned int n, void *addr)
320 _set_gate(n, GATE_INTERRUPT, addr, 0, 0, __KERNEL_CS); 320 _set_gate(n, GATE_INTERRUPT, addr, 0, 0, __KERNEL_CS);
321} 321}
322 322
323#define SYS_VECTOR_FREE 0
324#define SYS_VECTOR_ALLOCED 1
325
326extern int first_system_vector; 323extern int first_system_vector;
327extern char system_vectors[]; 324/* used_vectors is BITMAP for irq is not managed by percpu vector_irq */
325extern unsigned long used_vectors[];
328 326
329static inline void alloc_system_vector(int vector) 327static inline void alloc_system_vector(int vector)
330{ 328{
331 if (system_vectors[vector] == SYS_VECTOR_FREE) { 329 if (!test_bit(vector, used_vectors)) {
332 system_vectors[vector] = SYS_VECTOR_ALLOCED; 330 set_bit(vector, used_vectors);
333 if (first_system_vector > vector) 331 if (first_system_vector > vector)
334 first_system_vector = vector; 332 first_system_vector = vector;
335 } else 333 } else
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index 097794ff6b79..4035357f5b9d 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -65,18 +65,16 @@ static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
65 return dma_ops; 65 return dma_ops;
66 else 66 else
67 return dev->archdata.dma_ops; 67 return dev->archdata.dma_ops;
68#endif /* _ASM_X86_DMA_MAPPING_H */ 68#endif
69} 69}
70 70
71/* Make sure we keep the same behaviour */ 71/* Make sure we keep the same behaviour */
72static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) 72static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
73{ 73{
74#ifdef CONFIG_X86_64
75 struct dma_mapping_ops *ops = get_dma_ops(dev); 74 struct dma_mapping_ops *ops = get_dma_ops(dev);
76 if (ops->mapping_error) 75 if (ops->mapping_error)
77 return ops->mapping_error(dev, dma_addr); 76 return ops->mapping_error(dev, dma_addr);
78 77
79#endif
80 return (dma_addr == bad_dma_address); 78 return (dma_addr == bad_dma_address);
81} 79}
82 80
diff --git a/arch/x86/include/asm/ds.h b/arch/x86/include/asm/ds.h
index a95008457ea4..a8f672ba100c 100644
--- a/arch/x86/include/asm/ds.h
+++ b/arch/x86/include/asm/ds.h
@@ -6,14 +6,13 @@
6 * precise-event based sampling (PEBS). 6 * precise-event based sampling (PEBS).
7 * 7 *
8 * It manages: 8 * It manages:
9 * - per-thread and per-cpu allocation of BTS and PEBS 9 * - DS and BTS hardware configuration
10 * - buffer memory allocation (optional) 10 * - buffer overflow handling (to be done)
11 * - buffer overflow handling
12 * - buffer access 11 * - buffer access
13 * 12 *
14 * It assumes: 13 * It does not do:
15 * - get_task_struct on all parameter tasks 14 * - security checking (is the caller allowed to trace the task)
16 * - current is allowed to trace parameter tasks 15 * - buffer allocation (memory accounting)
17 * 16 *
18 * 17 *
19 * Copyright (C) 2007-2008 Intel Corporation. 18 * Copyright (C) 2007-2008 Intel Corporation.
@@ -26,11 +25,51 @@
26 25
27#include <linux/types.h> 26#include <linux/types.h>
28#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/err.h>
29 29
30 30
31#ifdef CONFIG_X86_DS 31#ifdef CONFIG_X86_DS
32 32
33struct task_struct; 33struct task_struct;
34struct ds_context;
35struct ds_tracer;
36struct bts_tracer;
37struct pebs_tracer;
38
39typedef void (*bts_ovfl_callback_t)(struct bts_tracer *);
40typedef void (*pebs_ovfl_callback_t)(struct pebs_tracer *);
41
42
43/*
44 * A list of features plus corresponding macros to talk about them in
45 * the ds_request function's flags parameter.
46 *
47 * We use the enum to index an array of corresponding control bits;
48 * we use the macro to index a flags bit-vector.
49 */
50enum ds_feature {
51 dsf_bts = 0,
52 dsf_bts_kernel,
53#define BTS_KERNEL (1 << dsf_bts_kernel)
54 /* trace kernel-mode branches */
55
56 dsf_bts_user,
57#define BTS_USER (1 << dsf_bts_user)
58 /* trace user-mode branches */
59
60 dsf_bts_overflow,
61 dsf_bts_max,
62 dsf_pebs = dsf_bts_max,
63
64 dsf_pebs_max,
65 dsf_ctl_max = dsf_pebs_max,
66 dsf_bts_timestamps = dsf_ctl_max,
67#define BTS_TIMESTAMPS (1 << dsf_bts_timestamps)
68 /* add timestamps into BTS trace */
69
70#define BTS_USER_FLAGS (BTS_KERNEL | BTS_USER | BTS_TIMESTAMPS)
71};
72
34 73
35/* 74/*
36 * Request BTS or PEBS 75 * Request BTS or PEBS
@@ -38,163 +77,169 @@ struct task_struct;
38 * Due to alignement constraints, the actual buffer may be slightly 77 * Due to alignement constraints, the actual buffer may be slightly
39 * smaller than the requested or provided buffer. 78 * smaller than the requested or provided buffer.
40 * 79 *
41 * Returns 0 on success; -Eerrno otherwise 80 * Returns a pointer to a tracer structure on success, or
81 * ERR_PTR(errcode) on failure.
82 *
83 * The interrupt threshold is independent from the overflow callback
84 * to allow users to use their own overflow interrupt handling mechanism.
42 * 85 *
43 * task: the task to request recording for; 86 * task: the task to request recording for;
44 * NULL for per-cpu recording on the current cpu 87 * NULL for per-cpu recording on the current cpu
45 * base: the base pointer for the (non-pageable) buffer; 88 * base: the base pointer for the (non-pageable) buffer;
46 * NULL if buffer allocation requested 89 * size: the size of the provided buffer in bytes
47 * size: the size of the requested or provided buffer
48 * ovfl: pointer to a function to be called on buffer overflow; 90 * ovfl: pointer to a function to be called on buffer overflow;
49 * NULL if cyclic buffer requested 91 * NULL if cyclic buffer requested
92 * th: the interrupt threshold in records from the end of the buffer;
93 * -1 if no interrupt threshold is requested.
94 * flags: a bit-mask of the above flags
50 */ 95 */
51typedef void (*ds_ovfl_callback_t)(struct task_struct *); 96extern struct bts_tracer *ds_request_bts(struct task_struct *task,
52extern int ds_request_bts(struct task_struct *task, void *base, size_t size, 97 void *base, size_t size,
53 ds_ovfl_callback_t ovfl); 98 bts_ovfl_callback_t ovfl,
54extern int ds_request_pebs(struct task_struct *task, void *base, size_t size, 99 size_t th, unsigned int flags);
55 ds_ovfl_callback_t ovfl); 100extern struct pebs_tracer *ds_request_pebs(struct task_struct *task,
101 void *base, size_t size,
102 pebs_ovfl_callback_t ovfl,
103 size_t th, unsigned int flags);
56 104
57/* 105/*
58 * Release BTS or PEBS resources 106 * Release BTS or PEBS resources
107 * Suspend and resume BTS or PEBS tracing
59 * 108 *
60 * Frees buffers allocated on ds_request. 109 * tracer: the tracer handle returned from ds_request_~()
61 *
62 * Returns 0 on success; -Eerrno otherwise
63 *
64 * task: the task to release resources for;
65 * NULL to release resources for the current cpu
66 */ 110 */
67extern int ds_release_bts(struct task_struct *task); 111extern void ds_release_bts(struct bts_tracer *tracer);
68extern int ds_release_pebs(struct task_struct *task); 112extern void ds_suspend_bts(struct bts_tracer *tracer);
113extern void ds_resume_bts(struct bts_tracer *tracer);
114extern void ds_release_pebs(struct pebs_tracer *tracer);
115extern void ds_suspend_pebs(struct pebs_tracer *tracer);
116extern void ds_resume_pebs(struct pebs_tracer *tracer);
69 117
70/*
71 * Return the (array) index of the write pointer.
72 * (assuming an array of BTS/PEBS records)
73 *
74 * Returns -Eerrno on error
75 *
76 * task: the task to access;
77 * NULL to access the current cpu
78 * pos (out): if not NULL, will hold the result
79 */
80extern int ds_get_bts_index(struct task_struct *task, size_t *pos);
81extern int ds_get_pebs_index(struct task_struct *task, size_t *pos);
82 118
83/* 119/*
84 * Return the (array) index one record beyond the end of the array. 120 * The raw DS buffer state as it is used for BTS and PEBS recording.
85 * (assuming an array of BTS/PEBS records)
86 * 121 *
87 * Returns -Eerrno on error 122 * This is the low-level, arch-dependent interface for working
88 * 123 * directly on the raw trace data.
89 * task: the task to access;
90 * NULL to access the current cpu
91 * pos (out): if not NULL, will hold the result
92 */ 124 */
93extern int ds_get_bts_end(struct task_struct *task, size_t *pos); 125struct ds_trace {
94extern int ds_get_pebs_end(struct task_struct *task, size_t *pos); 126 /* the number of bts/pebs records */
127 size_t n;
128 /* the size of a bts/pebs record in bytes */
129 size_t size;
130 /* pointers into the raw buffer:
131 - to the first entry */
132 void *begin;
133 /* - one beyond the last entry */
134 void *end;
135 /* - one beyond the newest entry */
136 void *top;
137 /* - the interrupt threshold */
138 void *ith;
139 /* flags given on ds_request() */
140 unsigned int flags;
141};
95 142
96/* 143/*
97 * Provide a pointer to the BTS/PEBS record at parameter index. 144 * An arch-independent view on branch trace data.
98 * (assuming an array of BTS/PEBS records)
99 *
100 * The pointer points directly into the buffer. The user is
101 * responsible for copying the record.
102 *
103 * Returns the size of a single record on success; -Eerrno on error
104 *
105 * task: the task to access;
106 * NULL to access the current cpu
107 * index: the index of the requested record
108 * record (out): pointer to the requested record
109 */ 145 */
110extern int ds_access_bts(struct task_struct *task, 146enum bts_qualifier {
111 size_t index, const void **record); 147 bts_invalid,
112extern int ds_access_pebs(struct task_struct *task, 148#define BTS_INVALID bts_invalid
113 size_t index, const void **record); 149
150 bts_branch,
151#define BTS_BRANCH bts_branch
152
153 bts_task_arrives,
154#define BTS_TASK_ARRIVES bts_task_arrives
155
156 bts_task_departs,
157#define BTS_TASK_DEPARTS bts_task_departs
158
159 bts_qual_bit_size = 4,
160 bts_qual_max = (1 << bts_qual_bit_size),
161};
162
163struct bts_struct {
164 __u64 qualifier;
165 union {
166 /* BTS_BRANCH */
167 struct {
168 __u64 from;
169 __u64 to;
170 } lbr;
171 /* BTS_TASK_ARRIVES or BTS_TASK_DEPARTS */
172 struct {
173 __u64 jiffies;
174 pid_t pid;
175 } timestamp;
176 } variant;
177};
114 178
115/*
116 * Write one or more BTS/PEBS records at the write pointer index and
117 * advance the write pointer.
118 *
119 * If size is not a multiple of the record size, trailing bytes are
120 * zeroed out.
121 *
122 * May result in one or more overflow notifications.
123 *
124 * If called during overflow handling, that is, with index >=
125 * interrupt threshold, the write will wrap around.
126 *
127 * An overflow notification is given if and when the interrupt
128 * threshold is reached during or after the write.
129 *
130 * Returns the number of bytes written or -Eerrno.
131 *
132 * task: the task to access;
133 * NULL to access the current cpu
134 * buffer: the buffer to write
135 * size: the size of the buffer
136 */
137extern int ds_write_bts(struct task_struct *task,
138 const void *buffer, size_t size);
139extern int ds_write_pebs(struct task_struct *task,
140 const void *buffer, size_t size);
141 179
142/* 180/*
143 * Same as ds_write_bts/pebs, but omit ownership checks. 181 * The BTS state.
144 * 182 *
145 * This is needed to have some other task than the owner of the 183 * This gives access to the raw DS state and adds functions to provide
146 * BTS/PEBS buffer or the parameter task itself write into the 184 * an arch-independent view of the BTS data.
147 * respective buffer.
148 */ 185 */
149extern int ds_unchecked_write_bts(struct task_struct *task, 186struct bts_trace {
150 const void *buffer, size_t size); 187 struct ds_trace ds;
151extern int ds_unchecked_write_pebs(struct task_struct *task, 188
152 const void *buffer, size_t size); 189 int (*read)(struct bts_tracer *tracer, const void *at,
190 struct bts_struct *out);
191 int (*write)(struct bts_tracer *tracer, const struct bts_struct *in);
192};
193
153 194
154/* 195/*
155 * Reset the write pointer of the BTS/PEBS buffer. 196 * The PEBS state.
156 * 197 *
157 * Returns 0 on success; -Eerrno on error 198 * This gives access to the raw DS state and the PEBS-specific counter
158 * 199 * reset value.
159 * task: the task to access;
160 * NULL to access the current cpu
161 */ 200 */
162extern int ds_reset_bts(struct task_struct *task); 201struct pebs_trace {
163extern int ds_reset_pebs(struct task_struct *task); 202 struct ds_trace ds;
203
204 /* the PEBS reset value */
205 unsigned long long reset_value;
206};
207
164 208
165/* 209/*
166 * Clear the BTS/PEBS buffer and reset the write pointer. 210 * Read the BTS or PEBS trace.
167 * The entire buffer will be zeroed out.
168 * 211 *
169 * Returns 0 on success; -Eerrno on error 212 * Returns a view on the trace collected for the parameter tracer.
213 *
214 * The view remains valid as long as the traced task is not running or
215 * the tracer is suspended.
216 * Writes into the trace buffer are not reflected.
170 * 217 *
171 * task: the task to access; 218 * tracer: the tracer handle returned from ds_request_~()
172 * NULL to access the current cpu
173 */ 219 */
174extern int ds_clear_bts(struct task_struct *task); 220extern const struct bts_trace *ds_read_bts(struct bts_tracer *tracer);
175extern int ds_clear_pebs(struct task_struct *task); 221extern const struct pebs_trace *ds_read_pebs(struct pebs_tracer *tracer);
222
176 223
177/* 224/*
178 * Provide the PEBS counter reset value. 225 * Reset the write pointer of the BTS/PEBS buffer.
179 * 226 *
180 * Returns 0 on success; -Eerrno on error 227 * Returns 0 on success; -Eerrno on error
181 * 228 *
182 * task: the task to access; 229 * tracer: the tracer handle returned from ds_request_~()
183 * NULL to access the current cpu
184 * value (out): the counter reset value
185 */ 230 */
186extern int ds_get_pebs_reset(struct task_struct *task, u64 *value); 231extern int ds_reset_bts(struct bts_tracer *tracer);
232extern int ds_reset_pebs(struct pebs_tracer *tracer);
187 233
188/* 234/*
189 * Set the PEBS counter reset value. 235 * Set the PEBS counter reset value.
190 * 236 *
191 * Returns 0 on success; -Eerrno on error 237 * Returns 0 on success; -Eerrno on error
192 * 238 *
193 * task: the task to access; 239 * tracer: the tracer handle returned from ds_request_pebs()
194 * NULL to access the current cpu
195 * value: the new counter reset value 240 * value: the new counter reset value
196 */ 241 */
197extern int ds_set_pebs_reset(struct task_struct *task, u64 value); 242extern int ds_set_pebs_reset(struct pebs_tracer *tracer, u64 value);
198 243
199/* 244/*
200 * Initialization 245 * Initialization
@@ -202,39 +247,26 @@ extern int ds_set_pebs_reset(struct task_struct *task, u64 value);
202struct cpuinfo_x86; 247struct cpuinfo_x86;
203extern void __cpuinit ds_init_intel(struct cpuinfo_x86 *); 248extern void __cpuinit ds_init_intel(struct cpuinfo_x86 *);
204 249
205
206
207/* 250/*
208 * The DS context - part of struct thread_struct. 251 * Context switch work
209 */ 252 */
210struct ds_context { 253extern void ds_switch_to(struct task_struct *prev, struct task_struct *next);
211 /* pointer to the DS configuration; goes into MSR_IA32_DS_AREA */
212 unsigned char *ds;
213 /* the owner of the BTS and PEBS configuration, respectively */
214 struct task_struct *owner[2];
215 /* buffer overflow notification function for BTS and PEBS */
216 ds_ovfl_callback_t callback[2];
217 /* the original buffer address */
218 void *buffer[2];
219 /* the number of allocated pages for on-request allocated buffers */
220 unsigned int pages[2];
221 /* use count */
222 unsigned long count;
223 /* a pointer to the context location inside the thread_struct
224 * or the per_cpu context array */
225 struct ds_context **this;
226 /* a pointer to the task owning this context, or NULL, if the
227 * context is owned by a cpu */
228 struct task_struct *task;
229};
230 254
231/* called by exit_thread() to free leftover contexts */ 255/*
232extern void ds_free(struct ds_context *context); 256 * Task clone/init and cleanup work
257 */
258extern void ds_copy_thread(struct task_struct *tsk, struct task_struct *father);
259extern void ds_exit_thread(struct task_struct *tsk);
233 260
234#else /* CONFIG_X86_DS */ 261#else /* CONFIG_X86_DS */
235 262
236struct cpuinfo_x86; 263struct cpuinfo_x86;
237static inline void __cpuinit ds_init_intel(struct cpuinfo_x86 *ignored) {} 264static inline void __cpuinit ds_init_intel(struct cpuinfo_x86 *ignored) {}
265static inline void ds_switch_to(struct task_struct *prev,
266 struct task_struct *next) {}
267static inline void ds_copy_thread(struct task_struct *tsk,
268 struct task_struct *father) {}
269static inline void ds_exit_thread(struct task_struct *tsk) {}
238 270
239#endif /* CONFIG_X86_DS */ 271#endif /* CONFIG_X86_DS */
240#endif /* _ASM_X86_DS_H */ 272#endif /* _ASM_X86_DS_H */
diff --git a/arch/x86/include/asm/dwarf2.h b/arch/x86/include/asm/dwarf2.h
index 804b6e6be929..3afc5e87cfdd 100644
--- a/arch/x86/include/asm/dwarf2.h
+++ b/arch/x86/include/asm/dwarf2.h
@@ -6,56 +6,91 @@
6#endif 6#endif
7 7
8/* 8/*
9 Macros for dwarf2 CFI unwind table entries. 9 * Macros for dwarf2 CFI unwind table entries.
10 See "as.info" for details on these pseudo ops. Unfortunately 10 * See "as.info" for details on these pseudo ops. Unfortunately
11 they are only supported in very new binutils, so define them 11 * they are only supported in very new binutils, so define them
12 away for older version. 12 * away for older version.
13 */ 13 */
14 14
15#ifdef CONFIG_AS_CFI 15#ifdef CONFIG_AS_CFI
16 16
17#define CFI_STARTPROC .cfi_startproc 17#define CFI_STARTPROC .cfi_startproc
18#define CFI_ENDPROC .cfi_endproc 18#define CFI_ENDPROC .cfi_endproc
19#define CFI_DEF_CFA .cfi_def_cfa 19#define CFI_DEF_CFA .cfi_def_cfa
20#define CFI_DEF_CFA_REGISTER .cfi_def_cfa_register 20#define CFI_DEF_CFA_REGISTER .cfi_def_cfa_register
21#define CFI_DEF_CFA_OFFSET .cfi_def_cfa_offset 21#define CFI_DEF_CFA_OFFSET .cfi_def_cfa_offset
22#define CFI_ADJUST_CFA_OFFSET .cfi_adjust_cfa_offset 22#define CFI_ADJUST_CFA_OFFSET .cfi_adjust_cfa_offset
23#define CFI_OFFSET .cfi_offset 23#define CFI_OFFSET .cfi_offset
24#define CFI_REL_OFFSET .cfi_rel_offset 24#define CFI_REL_OFFSET .cfi_rel_offset
25#define CFI_REGISTER .cfi_register 25#define CFI_REGISTER .cfi_register
26#define CFI_RESTORE .cfi_restore 26#define CFI_RESTORE .cfi_restore
27#define CFI_REMEMBER_STATE .cfi_remember_state 27#define CFI_REMEMBER_STATE .cfi_remember_state
28#define CFI_RESTORE_STATE .cfi_restore_state 28#define CFI_RESTORE_STATE .cfi_restore_state
29#define CFI_UNDEFINED .cfi_undefined 29#define CFI_UNDEFINED .cfi_undefined
30 30
31#ifdef CONFIG_AS_CFI_SIGNAL_FRAME 31#ifdef CONFIG_AS_CFI_SIGNAL_FRAME
32#define CFI_SIGNAL_FRAME .cfi_signal_frame 32#define CFI_SIGNAL_FRAME .cfi_signal_frame
33#else 33#else
34#define CFI_SIGNAL_FRAME 34#define CFI_SIGNAL_FRAME
35#endif 35#endif
36 36
37#else 37#else
38 38
39/* Due to the structure of pre-exisiting code, don't use assembler line 39/*
40 comment character # to ignore the arguments. Instead, use a dummy macro. */ 40 * Due to the structure of pre-exisiting code, don't use assembler line
41 * comment character # to ignore the arguments. Instead, use a dummy macro.
42 */
41.macro cfi_ignore a=0, b=0, c=0, d=0 43.macro cfi_ignore a=0, b=0, c=0, d=0
42.endm 44.endm
43 45
44#define CFI_STARTPROC cfi_ignore 46#define CFI_STARTPROC cfi_ignore
45#define CFI_ENDPROC cfi_ignore 47#define CFI_ENDPROC cfi_ignore
46#define CFI_DEF_CFA cfi_ignore 48#define CFI_DEF_CFA cfi_ignore
47#define CFI_DEF_CFA_REGISTER cfi_ignore 49#define CFI_DEF_CFA_REGISTER cfi_ignore
48#define CFI_DEF_CFA_OFFSET cfi_ignore 50#define CFI_DEF_CFA_OFFSET cfi_ignore
49#define CFI_ADJUST_CFA_OFFSET cfi_ignore 51#define CFI_ADJUST_CFA_OFFSET cfi_ignore
50#define CFI_OFFSET cfi_ignore 52#define CFI_OFFSET cfi_ignore
51#define CFI_REL_OFFSET cfi_ignore 53#define CFI_REL_OFFSET cfi_ignore
52#define CFI_REGISTER cfi_ignore 54#define CFI_REGISTER cfi_ignore
53#define CFI_RESTORE cfi_ignore 55#define CFI_RESTORE cfi_ignore
54#define CFI_REMEMBER_STATE cfi_ignore 56#define CFI_REMEMBER_STATE cfi_ignore
55#define CFI_RESTORE_STATE cfi_ignore 57#define CFI_RESTORE_STATE cfi_ignore
56#define CFI_UNDEFINED cfi_ignore 58#define CFI_UNDEFINED cfi_ignore
57#define CFI_SIGNAL_FRAME cfi_ignore 59#define CFI_SIGNAL_FRAME cfi_ignore
58 60
59#endif 61#endif
60 62
63/*
64 * An attempt to make CFI annotations more or less
65 * correct and shorter. It is implied that you know
66 * what you're doing if you use them.
67 */
68#ifdef __ASSEMBLY__
69#ifdef CONFIG_X86_64
70 .macro pushq_cfi reg
71 pushq \reg
72 CFI_ADJUST_CFA_OFFSET 8
73 .endm
74
75 .macro popq_cfi reg
76 popq \reg
77 CFI_ADJUST_CFA_OFFSET -8
78 .endm
79
80 .macro movq_cfi reg offset=0
81 movq %\reg, \offset(%rsp)
82 CFI_REL_OFFSET \reg, \offset
83 .endm
84
85 .macro movq_cfi_restore offset reg
86 movq \offset(%rsp), %\reg
87 CFI_RESTORE \reg
88 .endm
89#else /*!CONFIG_X86_64*/
90
91 /* 32bit defenitions are missed yet */
92
93#endif /*!CONFIG_X86_64*/
94#endif /*__ASSEMBLY__*/
95
61#endif /* _ASM_X86_DWARF2_H */ 96#endif /* _ASM_X86_DWARF2_H */
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index a2e545c91c35..ca5ffb2856b6 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -90,6 +90,7 @@ extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size);
90 90
91#endif /* CONFIG_X86_32 */ 91#endif /* CONFIG_X86_32 */
92 92
93extern int add_efi_memmap;
93extern void efi_reserve_early(void); 94extern void efi_reserve_early(void);
94extern void efi_call_phys_prelog(void); 95extern void efi_call_phys_prelog(void);
95extern void efi_call_phys_epilog(void); 96extern void efi_call_phys_epilog(void);
diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
index 40ca1bea7916..f51a3ddde01a 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -325,7 +325,7 @@ struct linux_binprm;
325 325
326#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 326#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
327extern int arch_setup_additional_pages(struct linux_binprm *bprm, 327extern int arch_setup_additional_pages(struct linux_binprm *bprm,
328 int executable_stack); 328 int uses_interp);
329 329
330extern int syscall32_setup_pages(struct linux_binprm *, int exstack); 330extern int syscall32_setup_pages(struct linux_binprm *, int exstack);
331#define compat_arch_setup_additional_pages syscall32_setup_pages 331#define compat_arch_setup_additional_pages syscall32_setup_pages
diff --git a/arch/x86/include/asm/emergency-restart.h b/arch/x86/include/asm/emergency-restart.h
index 94826cf87455..cc70c1c78ca4 100644
--- a/arch/x86/include/asm/emergency-restart.h
+++ b/arch/x86/include/asm/emergency-restart.h
@@ -8,7 +8,9 @@ enum reboot_type {
8 BOOT_BIOS = 'b', 8 BOOT_BIOS = 'b',
9#endif 9#endif
10 BOOT_ACPI = 'a', 10 BOOT_ACPI = 'a',
11 BOOT_EFI = 'e' 11 BOOT_EFI = 'e',
12 BOOT_CF9 = 'p',
13 BOOT_CF9_COND = 'q',
12}; 14};
13 15
14extern enum reboot_type reboot_type; 16extern enum reboot_type reboot_type;
diff --git a/arch/x86/include/asm/es7000/apic.h b/arch/x86/include/asm/es7000/apic.h
index 380f0b4f17ed..bc53d5ef1386 100644
--- a/arch/x86/include/asm/es7000/apic.h
+++ b/arch/x86/include/asm/es7000/apic.h
@@ -9,31 +9,27 @@ static inline int apic_id_registered(void)
9 return (1); 9 return (1);
10} 10}
11 11
12static inline cpumask_t target_cpus(void) 12static inline const cpumask_t *target_cpus_cluster(void)
13{ 13{
14#if defined CONFIG_ES7000_CLUSTERED_APIC 14 return &CPU_MASK_ALL;
15 return CPU_MASK_ALL;
16#else
17 return cpumask_of_cpu(smp_processor_id());
18#endif
19} 15}
20 16
21#if defined CONFIG_ES7000_CLUSTERED_APIC 17static inline const cpumask_t *target_cpus(void)
22#define APIC_DFR_VALUE (APIC_DFR_CLUSTER) 18{
23#define INT_DELIVERY_MODE (dest_LowestPrio) 19 return &cpumask_of_cpu(smp_processor_id());
24#define INT_DEST_MODE (1) /* logical delivery broadcast to all procs */ 20}
25#define NO_BALANCE_IRQ (1) 21
26#undef WAKE_SECONDARY_VIA_INIT 22#define APIC_DFR_VALUE_CLUSTER (APIC_DFR_CLUSTER)
27#define WAKE_SECONDARY_VIA_MIP 23#define INT_DELIVERY_MODE_CLUSTER (dest_LowestPrio)
28#else 24#define INT_DEST_MODE_CLUSTER (1) /* logical delivery broadcast to all procs */
25#define NO_BALANCE_IRQ_CLUSTER (1)
26
29#define APIC_DFR_VALUE (APIC_DFR_FLAT) 27#define APIC_DFR_VALUE (APIC_DFR_FLAT)
30#define INT_DELIVERY_MODE (dest_Fixed) 28#define INT_DELIVERY_MODE (dest_Fixed)
31#define INT_DEST_MODE (0) /* phys delivery to target procs */ 29#define INT_DEST_MODE (0) /* phys delivery to target procs */
32#define NO_BALANCE_IRQ (0) 30#define NO_BALANCE_IRQ (0)
33#undef APIC_DEST_LOGICAL 31#undef APIC_DEST_LOGICAL
34#define APIC_DEST_LOGICAL 0x0 32#define APIC_DEST_LOGICAL 0x0
35#define WAKE_SECONDARY_VIA_INIT
36#endif
37 33
38static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) 34static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
39{ 35{
@@ -60,6 +56,16 @@ static inline unsigned long calculate_ldr(int cpu)
60 * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel 56 * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel
61 * document number 292116). So here it goes... 57 * document number 292116). So here it goes...
62 */ 58 */
59static inline void init_apic_ldr_cluster(void)
60{
61 unsigned long val;
62 int cpu = smp_processor_id();
63
64 apic_write(APIC_DFR, APIC_DFR_VALUE_CLUSTER);
65 val = calculate_ldr(cpu);
66 apic_write(APIC_LDR, val);
67}
68
63static inline void init_apic_ldr(void) 69static inline void init_apic_ldr(void)
64{ 70{
65 unsigned long val; 71 unsigned long val;
@@ -70,17 +76,14 @@ static inline void init_apic_ldr(void)
70 apic_write(APIC_LDR, val); 76 apic_write(APIC_LDR, val);
71} 77}
72 78
73#ifndef CONFIG_X86_GENERICARCH
74extern void enable_apic_mode(void);
75#endif
76
77extern int apic_version [MAX_APICS]; 79extern int apic_version [MAX_APICS];
78static inline void setup_apic_routing(void) 80static inline void setup_apic_routing(void)
79{ 81{
80 int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id()); 82 int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id());
81 printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n", 83 printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n",
82 (apic_version[apic] == 0x14) ? 84 (apic_version[apic] == 0x14) ?
83 "Physical Cluster" : "Logical Cluster", nr_ioapics, cpus_addr(target_cpus())[0]); 85 "Physical Cluster" : "Logical Cluster",
86 nr_ioapics, cpus_addr(*target_cpus())[0]);
84} 87}
85 88
86static inline int multi_timer_check(int apic, int irq) 89static inline int multi_timer_check(int apic, int irq)
@@ -98,7 +101,7 @@ static inline int cpu_present_to_apicid(int mps_cpu)
98{ 101{
99 if (!mps_cpu) 102 if (!mps_cpu)
100 return boot_cpu_physical_apicid; 103 return boot_cpu_physical_apicid;
101 else if (mps_cpu < NR_CPUS) 104 else if (mps_cpu < nr_cpu_ids)
102 return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu); 105 return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu);
103 else 106 else
104 return BAD_APICID; 107 return BAD_APICID;
@@ -118,9 +121,9 @@ extern u8 cpu_2_logical_apicid[];
118static inline int cpu_to_logical_apicid(int cpu) 121static inline int cpu_to_logical_apicid(int cpu)
119{ 122{
120#ifdef CONFIG_SMP 123#ifdef CONFIG_SMP
121 if (cpu >= NR_CPUS) 124 if (cpu >= nr_cpu_ids)
122 return BAD_APICID; 125 return BAD_APICID;
123 return (int)cpu_2_logical_apicid[cpu]; 126 return (int)cpu_2_logical_apicid[cpu];
124#else 127#else
125 return logical_smp_processor_id(); 128 return logical_smp_processor_id();
126#endif 129#endif
@@ -144,38 +147,64 @@ static inline int check_phys_apicid_present(int cpu_physical_apicid)
144 return (1); 147 return (1);
145} 148}
146 149
147static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask) 150static inline unsigned int
151cpu_mask_to_apicid_cluster(const struct cpumask *cpumask)
148{ 152{
149 int num_bits_set; 153 int num_bits_set;
150 int cpus_found = 0; 154 int cpus_found = 0;
151 int cpu; 155 int cpu;
152 int apicid; 156 int apicid;
153 157
154 num_bits_set = cpus_weight(cpumask); 158 num_bits_set = cpumask_weight(cpumask);
155 /* Return id to all */ 159 /* Return id to all */
156 if (num_bits_set == NR_CPUS) 160 if (num_bits_set == nr_cpu_ids)
157#if defined CONFIG_ES7000_CLUSTERED_APIC
158 return 0xFF; 161 return 0xFF;
159#else
160 return cpu_to_logical_apicid(0);
161#endif
162 /* 162 /*
163 * The cpus in the mask must all be on the apic cluster. If are not 163 * The cpus in the mask must all be on the apic cluster. If are not
164 * on the same apicid cluster return default value of TARGET_CPUS. 164 * on the same apicid cluster return default value of TARGET_CPUS.
165 */ 165 */
166 cpu = first_cpu(cpumask); 166 cpu = cpumask_first(cpumask);
167 apicid = cpu_to_logical_apicid(cpu); 167 apicid = cpu_to_logical_apicid(cpu);
168 while (cpus_found < num_bits_set) { 168 while (cpus_found < num_bits_set) {
169 if (cpu_isset(cpu, cpumask)) { 169 if (cpumask_test_cpu(cpu, cpumask)) {
170 int new_apicid = cpu_to_logical_apicid(cpu); 170 int new_apicid = cpu_to_logical_apicid(cpu);
171 if (apicid_cluster(apicid) != 171 if (apicid_cluster(apicid) !=
172 apicid_cluster(new_apicid)){ 172 apicid_cluster(new_apicid)){
173 printk ("%s: Not a valid mask!\n", __func__); 173 printk ("%s: Not a valid mask!\n", __func__);
174#if defined CONFIG_ES7000_CLUSTERED_APIC
175 return 0xFF; 174 return 0xFF;
176#else 175 }
176 apicid = new_apicid;
177 cpus_found++;
178 }
179 cpu++;
180 }
181 return apicid;
182}
183
184static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
185{
186 int num_bits_set;
187 int cpus_found = 0;
188 int cpu;
189 int apicid;
190
191 num_bits_set = cpus_weight(*cpumask);
192 /* Return id to all */
193 if (num_bits_set == nr_cpu_ids)
194 return cpu_to_logical_apicid(0);
195 /*
196 * The cpus in the mask must all be on the apic cluster. If are not
197 * on the same apicid cluster return default value of TARGET_CPUS.
198 */
199 cpu = first_cpu(*cpumask);
200 apicid = cpu_to_logical_apicid(cpu);
201 while (cpus_found < num_bits_set) {
202 if (cpu_isset(cpu, *cpumask)) {
203 int new_apicid = cpu_to_logical_apicid(cpu);
204 if (apicid_cluster(apicid) !=
205 apicid_cluster(new_apicid)){
206 printk ("%s: Not a valid mask!\n", __func__);
177 return cpu_to_logical_apicid(0); 207 return cpu_to_logical_apicid(0);
178#endif
179 } 208 }
180 apicid = new_apicid; 209 apicid = new_apicid;
181 cpus_found++; 210 cpus_found++;
@@ -185,6 +214,24 @@ static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
185 return apicid; 214 return apicid;
186} 215}
187 216
217
218static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
219 const struct cpumask *andmask)
220{
221 int apicid = cpu_to_logical_apicid(0);
222 cpumask_var_t cpumask;
223
224 if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC))
225 return apicid;
226
227 cpumask_and(cpumask, inmask, andmask);
228 cpumask_and(cpumask, cpumask, cpu_online_mask);
229 apicid = cpu_mask_to_apicid(cpumask);
230
231 free_cpumask_var(cpumask);
232 return apicid;
233}
234
188static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) 235static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
189{ 236{
190 return cpuid_apic >> index_msb; 237 return cpuid_apic >> index_msb;
diff --git a/arch/x86/include/asm/es7000/ipi.h b/arch/x86/include/asm/es7000/ipi.h
index 632a955fcc0a..7e8ed24d4b8a 100644
--- a/arch/x86/include/asm/es7000/ipi.h
+++ b/arch/x86/include/asm/es7000/ipi.h
@@ -1,24 +1,22 @@
1#ifndef __ASM_ES7000_IPI_H 1#ifndef __ASM_ES7000_IPI_H
2#define __ASM_ES7000_IPI_H 2#define __ASM_ES7000_IPI_H
3 3
4void send_IPI_mask_sequence(cpumask_t mask, int vector); 4void send_IPI_mask_sequence(const struct cpumask *mask, int vector);
5void send_IPI_mask_allbutself(const struct cpumask *mask, int vector);
5 6
6static inline void send_IPI_mask(cpumask_t mask, int vector) 7static inline void send_IPI_mask(const struct cpumask *mask, int vector)
7{ 8{
8 send_IPI_mask_sequence(mask, vector); 9 send_IPI_mask_sequence(mask, vector);
9} 10}
10 11
11static inline void send_IPI_allbutself(int vector) 12static inline void send_IPI_allbutself(int vector)
12{ 13{
13 cpumask_t mask = cpu_online_map; 14 send_IPI_mask_allbutself(cpu_online_mask, vector);
14 cpu_clear(smp_processor_id(), mask);
15 if (!cpus_empty(mask))
16 send_IPI_mask(mask, vector);
17} 15}
18 16
19static inline void send_IPI_all(int vector) 17static inline void send_IPI_all(int vector)
20{ 18{
21 send_IPI_mask(cpu_online_map, vector); 19 send_IPI_mask(cpu_online_mask, vector);
22} 20}
23 21
24#endif /* __ASM_ES7000_IPI_H */ 22#endif /* __ASM_ES7000_IPI_H */
diff --git a/arch/x86/include/asm/es7000/wakecpu.h b/arch/x86/include/asm/es7000/wakecpu.h
index 398493461913..78f0daaee436 100644
--- a/arch/x86/include/asm/es7000/wakecpu.h
+++ b/arch/x86/include/asm/es7000/wakecpu.h
@@ -1,36 +1,12 @@
1#ifndef __ASM_ES7000_WAKECPU_H 1#ifndef __ASM_ES7000_WAKECPU_H
2#define __ASM_ES7000_WAKECPU_H 2#define __ASM_ES7000_WAKECPU_H
3 3
4/* 4#define TRAMPOLINE_PHYS_LOW 0x467
5 * This file copes with machines that wakeup secondary CPUs by the 5#define TRAMPOLINE_PHYS_HIGH 0x469
6 * INIT, INIT, STARTUP sequence.
7 */
8
9#ifdef CONFIG_ES7000_CLUSTERED_APIC
10#define WAKE_SECONDARY_VIA_MIP
11#else
12#define WAKE_SECONDARY_VIA_INIT
13#endif
14
15#ifdef WAKE_SECONDARY_VIA_MIP
16extern int es7000_start_cpu(int cpu, unsigned long eip);
17static inline int
18wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip)
19{
20 int boot_error = 0;
21 boot_error = es7000_start_cpu(phys_apicid, start_eip);
22 return boot_error;
23}
24#endif
25
26#define TRAMPOLINE_LOW phys_to_virt(0x467)
27#define TRAMPOLINE_HIGH phys_to_virt(0x469)
28
29#define boot_cpu_apicid boot_cpu_physical_apicid
30 6
31static inline void wait_for_init_deassert(atomic_t *deassert) 7static inline void wait_for_init_deassert(atomic_t *deassert)
32{ 8{
33#ifdef WAKE_SECONDARY_VIA_INIT 9#ifndef CONFIG_ES7000_CLUSTERED_APIC
34 while (!atomic_read(deassert)) 10 while (!atomic_read(deassert))
35 cpu_relax(); 11 cpu_relax();
36#endif 12#endif
@@ -50,9 +26,12 @@ static inline void restore_NMI_vector(unsigned short *high, unsigned short *low)
50{ 26{
51} 27}
52 28
53#define inquire_remote_apic(apicid) do { \ 29extern void __inquire_remote_apic(int apicid);
54 if (apic_verbosity >= APIC_DEBUG) \ 30
55 __inquire_remote_apic(apicid); \ 31static inline void inquire_remote_apic(int apicid)
56 } while (0) 32{
33 if (apic_verbosity >= APIC_DEBUG)
34 __inquire_remote_apic(apicid);
35}
57 36
58#endif /* __ASM_MACH_WAKECPU_H */ 37#endif /* __ASM_MACH_WAKECPU_H */
diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h
index 9e8bc29b8b17..b55b4a7fbefd 100644
--- a/arch/x86/include/asm/ftrace.h
+++ b/arch/x86/include/asm/ftrace.h
@@ -1,6 +1,33 @@
1#ifndef _ASM_X86_FTRACE_H 1#ifndef _ASM_X86_FTRACE_H
2#define _ASM_X86_FTRACE_H 2#define _ASM_X86_FTRACE_H
3 3
4#ifdef __ASSEMBLY__
5
6 .macro MCOUNT_SAVE_FRAME
7 /* taken from glibc */
8 subq $0x38, %rsp
9 movq %rax, (%rsp)
10 movq %rcx, 8(%rsp)
11 movq %rdx, 16(%rsp)
12 movq %rsi, 24(%rsp)
13 movq %rdi, 32(%rsp)
14 movq %r8, 40(%rsp)
15 movq %r9, 48(%rsp)
16 .endm
17
18 .macro MCOUNT_RESTORE_FRAME
19 movq 48(%rsp), %r9
20 movq 40(%rsp), %r8
21 movq 32(%rsp), %rdi
22 movq 24(%rsp), %rsi
23 movq 16(%rsp), %rdx
24 movq 8(%rsp), %rcx
25 movq (%rsp), %rax
26 addq $0x38, %rsp
27 .endm
28
29#endif
30
4#ifdef CONFIG_FUNCTION_TRACER 31#ifdef CONFIG_FUNCTION_TRACER
5#define MCOUNT_ADDR ((long)(mcount)) 32#define MCOUNT_ADDR ((long)(mcount))
6#define MCOUNT_INSN_SIZE 5 /* sizeof mcount call */ 33#define MCOUNT_INSN_SIZE 5 /* sizeof mcount call */
@@ -17,8 +44,40 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
17 */ 44 */
18 return addr - 1; 45 return addr - 1;
19} 46}
20#endif
21 47
48#ifdef CONFIG_DYNAMIC_FTRACE
49
50struct dyn_arch_ftrace {
51 /* No extra data needed for x86 */
52};
53
54#endif /* CONFIG_DYNAMIC_FTRACE */
55#endif /* __ASSEMBLY__ */
22#endif /* CONFIG_FUNCTION_TRACER */ 56#endif /* CONFIG_FUNCTION_TRACER */
23 57
58#ifdef CONFIG_FUNCTION_GRAPH_TRACER
59
60#ifndef __ASSEMBLY__
61
62/*
63 * Stack of return addresses for functions
64 * of a thread.
65 * Used in struct thread_info
66 */
67struct ftrace_ret_stack {
68 unsigned long ret;
69 unsigned long func;
70 unsigned long long calltime;
71};
72
73/*
74 * Primary handler of a function return.
75 * It relays on ftrace_return_to_handler.
76 * Defined in entry_32/64.S
77 */
78extern void return_to_handler(void);
79
80#endif /* __ASSEMBLY__ */
81#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
82
24#endif /* _ASM_X86_FTRACE_H */ 83#endif /* _ASM_X86_FTRACE_H */
diff --git a/arch/x86/include/asm/gart.h b/arch/x86/include/asm/gart.h
index 74252264433d..6cfdafa409d8 100644
--- a/arch/x86/include/asm/gart.h
+++ b/arch/x86/include/asm/gart.h
@@ -29,6 +29,39 @@ extern int fix_aperture;
29#define AMD64_GARTCACHECTL 0x9c 29#define AMD64_GARTCACHECTL 0x9c
30#define AMD64_GARTEN (1<<0) 30#define AMD64_GARTEN (1<<0)
31 31
32#ifdef CONFIG_GART_IOMMU
33extern int gart_iommu_aperture;
34extern int gart_iommu_aperture_allowed;
35extern int gart_iommu_aperture_disabled;
36
37extern void early_gart_iommu_check(void);
38extern void gart_iommu_init(void);
39extern void gart_iommu_shutdown(void);
40extern void __init gart_parse_options(char *);
41extern void gart_iommu_hole_init(void);
42
43#else
44#define gart_iommu_aperture 0
45#define gart_iommu_aperture_allowed 0
46#define gart_iommu_aperture_disabled 1
47
48static inline void early_gart_iommu_check(void)
49{
50}
51static inline void gart_iommu_init(void)
52{
53}
54static inline void gart_iommu_shutdown(void)
55{
56}
57static inline void gart_parse_options(char *options)
58{
59}
60static inline void gart_iommu_hole_init(void)
61{
62}
63#endif
64
32extern int agp_amd64_init(void); 65extern int agp_amd64_init(void);
33 66
34static inline void enable_gart_translation(struct pci_dev *dev, u64 addr) 67static inline void enable_gart_translation(struct pci_dev *dev, u64 addr)
diff --git a/arch/x86/include/asm/genapic_32.h b/arch/x86/include/asm/genapic_32.h
index 5cbd4fcc06fd..746f37a7963a 100644
--- a/arch/x86/include/asm/genapic_32.h
+++ b/arch/x86/include/asm/genapic_32.h
@@ -2,6 +2,7 @@
2#define _ASM_X86_GENAPIC_32_H 2#define _ASM_X86_GENAPIC_32_H
3 3
4#include <asm/mpspec.h> 4#include <asm/mpspec.h>
5#include <asm/atomic.h>
5 6
6/* 7/*
7 * Generic APIC driver interface. 8 * Generic APIC driver interface.
@@ -23,7 +24,7 @@ struct genapic {
23 int (*probe)(void); 24 int (*probe)(void);
24 25
25 int (*apic_id_registered)(void); 26 int (*apic_id_registered)(void);
26 cpumask_t (*target_cpus)(void); 27 const struct cpumask *(*target_cpus)(void);
27 int int_delivery_mode; 28 int int_delivery_mode;
28 int int_dest_mode; 29 int int_dest_mode;
29 int ESR_DISABLE; 30 int ESR_DISABLE;
@@ -56,15 +57,27 @@ struct genapic {
56 57
57 unsigned (*get_apic_id)(unsigned long x); 58 unsigned (*get_apic_id)(unsigned long x);
58 unsigned long apic_id_mask; 59 unsigned long apic_id_mask;
59 unsigned int (*cpu_mask_to_apicid)(cpumask_t cpumask); 60 unsigned int (*cpu_mask_to_apicid)(const struct cpumask *cpumask);
60 cpumask_t (*vector_allocation_domain)(int cpu); 61 unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask,
62 const struct cpumask *andmask);
63 void (*vector_allocation_domain)(int cpu, struct cpumask *retmask);
61 64
62#ifdef CONFIG_SMP 65#ifdef CONFIG_SMP
63 /* ipi */ 66 /* ipi */
64 void (*send_IPI_mask)(cpumask_t mask, int vector); 67 void (*send_IPI_mask)(const struct cpumask *mask, int vector);
68 void (*send_IPI_mask_allbutself)(const struct cpumask *mask,
69 int vector);
65 void (*send_IPI_allbutself)(int vector); 70 void (*send_IPI_allbutself)(int vector);
66 void (*send_IPI_all)(int vector); 71 void (*send_IPI_all)(int vector);
67#endif 72#endif
73 int (*wakeup_cpu)(int apicid, unsigned long start_eip);
74 int trampoline_phys_low;
75 int trampoline_phys_high;
76 void (*wait_for_init_deassert)(atomic_t *deassert);
77 void (*smp_callin_clear_local_apic)(void);
78 void (*store_NMI_vector)(unsigned short *high, unsigned short *low);
79 void (*restore_NMI_vector)(unsigned short *high, unsigned short *low);
80 void (*inquire_remote_apic)(int apicid);
68}; 81};
69 82
70#define APICFUNC(x) .x = x, 83#define APICFUNC(x) .x = x,
@@ -105,16 +118,25 @@ struct genapic {
105 APICFUNC(get_apic_id) \ 118 APICFUNC(get_apic_id) \
106 .apic_id_mask = APIC_ID_MASK, \ 119 .apic_id_mask = APIC_ID_MASK, \
107 APICFUNC(cpu_mask_to_apicid) \ 120 APICFUNC(cpu_mask_to_apicid) \
108 APICFUNC(vector_allocation_domain) \ 121 APICFUNC(cpu_mask_to_apicid_and) \
122 APICFUNC(vector_allocation_domain) \
109 APICFUNC(acpi_madt_oem_check) \ 123 APICFUNC(acpi_madt_oem_check) \
110 IPIFUNC(send_IPI_mask) \ 124 IPIFUNC(send_IPI_mask) \
111 IPIFUNC(send_IPI_allbutself) \ 125 IPIFUNC(send_IPI_allbutself) \
112 IPIFUNC(send_IPI_all) \ 126 IPIFUNC(send_IPI_all) \
113 APICFUNC(enable_apic_mode) \ 127 APICFUNC(enable_apic_mode) \
114 APICFUNC(phys_pkg_id) \ 128 APICFUNC(phys_pkg_id) \
129 .trampoline_phys_low = TRAMPOLINE_PHYS_LOW, \
130 .trampoline_phys_high = TRAMPOLINE_PHYS_HIGH, \
131 APICFUNC(wait_for_init_deassert) \
132 APICFUNC(smp_callin_clear_local_apic) \
133 APICFUNC(store_NMI_vector) \
134 APICFUNC(restore_NMI_vector) \
135 APICFUNC(inquire_remote_apic) \
115} 136}
116 137
117extern struct genapic *genapic; 138extern struct genapic *genapic;
139extern void es7000_update_genapic_to_cluster(void);
118 140
119enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC}; 141enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC};
120#define get_uv_system_type() UV_NONE 142#define get_uv_system_type() UV_NONE
diff --git a/arch/x86/include/asm/genapic_64.h b/arch/x86/include/asm/genapic_64.h
index 13c4e96199ea..adf32fb56aa6 100644
--- a/arch/x86/include/asm/genapic_64.h
+++ b/arch/x86/include/asm/genapic_64.h
@@ -1,6 +1,8 @@
1#ifndef _ASM_X86_GENAPIC_64_H 1#ifndef _ASM_X86_GENAPIC_64_H
2#define _ASM_X86_GENAPIC_64_H 2#define _ASM_X86_GENAPIC_64_H
3 3
4#include <linux/cpumask.h>
5
4/* 6/*
5 * Copyright 2004 James Cleverdon, IBM. 7 * Copyright 2004 James Cleverdon, IBM.
6 * Subject to the GNU Public License, v.2 8 * Subject to the GNU Public License, v.2
@@ -18,20 +20,26 @@ struct genapic {
18 u32 int_delivery_mode; 20 u32 int_delivery_mode;
19 u32 int_dest_mode; 21 u32 int_dest_mode;
20 int (*apic_id_registered)(void); 22 int (*apic_id_registered)(void);
21 cpumask_t (*target_cpus)(void); 23 const struct cpumask *(*target_cpus)(void);
22 cpumask_t (*vector_allocation_domain)(int cpu); 24 void (*vector_allocation_domain)(int cpu, struct cpumask *retmask);
23 void (*init_apic_ldr)(void); 25 void (*init_apic_ldr)(void);
24 /* ipi */ 26 /* ipi */
25 void (*send_IPI_mask)(cpumask_t mask, int vector); 27 void (*send_IPI_mask)(const struct cpumask *mask, int vector);
28 void (*send_IPI_mask_allbutself)(const struct cpumask *mask,
29 int vector);
26 void (*send_IPI_allbutself)(int vector); 30 void (*send_IPI_allbutself)(int vector);
27 void (*send_IPI_all)(int vector); 31 void (*send_IPI_all)(int vector);
28 void (*send_IPI_self)(int vector); 32 void (*send_IPI_self)(int vector);
29 /* */ 33 /* */
30 unsigned int (*cpu_mask_to_apicid)(cpumask_t cpumask); 34 unsigned int (*cpu_mask_to_apicid)(const struct cpumask *cpumask);
35 unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask,
36 const struct cpumask *andmask);
31 unsigned int (*phys_pkg_id)(int index_msb); 37 unsigned int (*phys_pkg_id)(int index_msb);
32 unsigned int (*get_apic_id)(unsigned long x); 38 unsigned int (*get_apic_id)(unsigned long x);
33 unsigned long (*set_apic_id)(unsigned int id); 39 unsigned long (*set_apic_id)(unsigned int id);
34 unsigned long apic_id_mask; 40 unsigned long apic_id_mask;
41 /* wakeup_secondary_cpu */
42 int (*wakeup_cpu)(int apicid, unsigned long start_eip);
35}; 43};
36 44
37extern struct genapic *genapic; 45extern struct genapic *genapic;
diff --git a/arch/x86/include/asm/hardirq_32.h b/arch/x86/include/asm/hardirq_32.h
index 5ca135e72f2b..cf7954d1405f 100644
--- a/arch/x86/include/asm/hardirq_32.h
+++ b/arch/x86/include/asm/hardirq_32.h
@@ -22,6 +22,8 @@ DECLARE_PER_CPU(irq_cpustat_t, irq_stat);
22#define __ARCH_IRQ_STAT 22#define __ARCH_IRQ_STAT
23#define __IRQ_STAT(cpu, member) (per_cpu(irq_stat, cpu).member) 23#define __IRQ_STAT(cpu, member) (per_cpu(irq_stat, cpu).member)
24 24
25#define inc_irq_stat(member) (__get_cpu_var(irq_stat).member++)
26
25void ack_bad_irq(unsigned int irq); 27void ack_bad_irq(unsigned int irq);
26#include <linux/irq_cpustat.h> 28#include <linux/irq_cpustat.h>
27 29
diff --git a/arch/x86/include/asm/hardirq_64.h b/arch/x86/include/asm/hardirq_64.h
index 1ba381fc51d3..b5a6b5d56704 100644
--- a/arch/x86/include/asm/hardirq_64.h
+++ b/arch/x86/include/asm/hardirq_64.h
@@ -11,6 +11,8 @@
11 11
12#define __ARCH_IRQ_STAT 1 12#define __ARCH_IRQ_STAT 1
13 13
14#define inc_irq_stat(member) add_pda(member, 1)
15
14#define local_softirq_pending() read_pda(__softirq_pending) 16#define local_softirq_pending() read_pda(__softirq_pending)
15 17
16#define __ARCH_SET_SOFTIRQ_PENDING 1 18#define __ARCH_SET_SOFTIRQ_PENDING 1
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
index b97aecb0b61d..8de644b6b959 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -109,9 +109,7 @@ extern asmlinkage void smp_invalidate_interrupt(struct pt_regs *);
109#endif 109#endif
110#endif 110#endif
111 111
112#ifdef CONFIG_X86_32 112extern void (*__initconst interrupt[NR_VECTORS-FIRST_EXTERNAL_VECTOR])(void);
113extern void (*const interrupt[NR_VECTORS])(void);
114#endif
115 113
116typedef int vector_irq_t[NR_VECTORS]; 114typedef int vector_irq_t[NR_VECTORS];
117DECLARE_PER_CPU(vector_irq_t, vector_irq); 115DECLARE_PER_CPU(vector_irq_t, vector_irq);
diff --git a/arch/x86/include/asm/hypervisor.h b/arch/x86/include/asm/hypervisor.h
new file mode 100644
index 000000000000..369f5c5d09a1
--- /dev/null
+++ b/arch/x86/include/asm/hypervisor.h
@@ -0,0 +1,26 @@
1/*
2 * Copyright (C) 2008, VMware, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
12 * NON INFRINGEMENT. See the GNU General Public License for more
13 * 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 St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20#ifndef ASM_X86__HYPERVISOR_H
21#define ASM_X86__HYPERVISOR_H
22
23extern unsigned long get_hypervisor_tsc_freq(void);
24extern void init_hypervisor(struct cpuinfo_x86 *c);
25
26#endif
diff --git a/arch/x86/include/asm/ia32.h b/arch/x86/include/asm/ia32.h
index 97989c0e534c..50ca486fd88c 100644
--- a/arch/x86/include/asm/ia32.h
+++ b/arch/x86/include/asm/ia32.h
@@ -129,24 +129,6 @@ typedef struct compat_siginfo {
129 } _sifields; 129 } _sifields;
130} compat_siginfo_t; 130} compat_siginfo_t;
131 131
132struct sigframe32 {
133 u32 pretcode;
134 int sig;
135 struct sigcontext_ia32 sc;
136 struct _fpstate_ia32 fpstate;
137 unsigned int extramask[_COMPAT_NSIG_WORDS-1];
138};
139
140struct rt_sigframe32 {
141 u32 pretcode;
142 int sig;
143 u32 pinfo;
144 u32 puc;
145 compat_siginfo_t info;
146 struct ucontext_ia32 uc;
147 struct _fpstate_ia32 fpstate;
148};
149
150struct ustat32 { 132struct ustat32 {
151 __u32 f_tfree; 133 __u32 f_tfree;
152 compat_ino_t f_tinode; 134 compat_ino_t f_tinode;
diff --git a/arch/x86/include/asm/idle.h b/arch/x86/include/asm/idle.h
index 44c89c3a23e9..38d87379e270 100644
--- a/arch/x86/include/asm/idle.h
+++ b/arch/x86/include/asm/idle.h
@@ -8,8 +8,13 @@ struct notifier_block;
8void idle_notifier_register(struct notifier_block *n); 8void idle_notifier_register(struct notifier_block *n);
9void idle_notifier_unregister(struct notifier_block *n); 9void idle_notifier_unregister(struct notifier_block *n);
10 10
11#ifdef CONFIG_X86_64
11void enter_idle(void); 12void enter_idle(void);
12void exit_idle(void); 13void exit_idle(void);
14#else /* !CONFIG_X86_64 */
15static inline void enter_idle(void) { }
16static inline void exit_idle(void) { }
17#endif /* CONFIG_X86_64 */
13 18
14void c1e_remove_cpu(int cpu); 19void c1e_remove_cpu(int cpu);
15 20
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index ac2abc88cd95..05cfed4485fa 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -4,6 +4,7 @@
4#define ARCH_HAS_IOREMAP_WC 4#define ARCH_HAS_IOREMAP_WC
5 5
6#include <linux/compiler.h> 6#include <linux/compiler.h>
7#include <asm-generic/int-ll64.h>
7 8
8#define build_mmio_read(name, size, type, reg, barrier) \ 9#define build_mmio_read(name, size, type, reg, barrier) \
9static inline type name(const volatile void __iomem *addr) \ 10static inline type name(const volatile void __iomem *addr) \
@@ -45,21 +46,39 @@ build_mmio_write(__writel, "l", unsigned int, "r", )
45#define mmiowb() barrier() 46#define mmiowb() barrier()
46 47
47#ifdef CONFIG_X86_64 48#ifdef CONFIG_X86_64
49
48build_mmio_read(readq, "q", unsigned long, "=r", :"memory") 50build_mmio_read(readq, "q", unsigned long, "=r", :"memory")
49build_mmio_read(__readq, "q", unsigned long, "=r", )
50build_mmio_write(writeq, "q", unsigned long, "r", :"memory") 51build_mmio_write(writeq, "q", unsigned long, "r", :"memory")
51build_mmio_write(__writeq, "q", unsigned long, "r", )
52 52
53#define readq_relaxed(a) __readq(a) 53#else
54#define __raw_readq __readq 54
55#define __raw_writeq writeq 55static inline __u64 readq(const volatile void __iomem *addr)
56{
57 const volatile u32 __iomem *p = addr;
58 u32 low, high;
59
60 low = readl(p);
61 high = readl(p + 1);
62
63 return low + ((u64)high << 32);
64}
65
66static inline void writeq(__u64 val, volatile void __iomem *addr)
67{
68 writel(val, addr);
69 writel(val >> 32, addr+4);
70}
56 71
57/* Let people know we have them */
58#define readq readq
59#define writeq writeq
60#endif 72#endif
61 73
62extern int iommu_bio_merge; 74#define readq_relaxed(a) readq(a)
75
76#define __raw_readq(a) readq(a)
77#define __raw_writeq(val, addr) writeq(val, addr)
78
79/* Let people know that we have them */
80#define readq readq
81#define writeq writeq
63 82
64#ifdef CONFIG_X86_32 83#ifdef CONFIG_X86_32
65# include "io_32.h" 84# include "io_32.h"
diff --git a/arch/x86/include/asm/io_64.h b/arch/x86/include/asm/io_64.h
index fea325a1122f..563c16270ba6 100644
--- a/arch/x86/include/asm/io_64.h
+++ b/arch/x86/include/asm/io_64.h
@@ -232,8 +232,6 @@ void memset_io(volatile void __iomem *a, int b, size_t c);
232 232
233#define flush_write_buffers() 233#define flush_write_buffers()
234 234
235#define BIO_VMERGE_BOUNDARY iommu_bio_merge
236
237/* 235/*
238 * Convert a virtual cached pointer to an uncached pointer 236 * Convert a virtual cached pointer to an uncached pointer
239 */ 237 */
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h
index 6afd9933a7dd..7a1f44ac1f17 100644
--- a/arch/x86/include/asm/io_apic.h
+++ b/arch/x86/include/asm/io_apic.h
@@ -156,11 +156,21 @@ extern int sis_apic_bug;
156/* 1 if "noapic" boot option passed */ 156/* 1 if "noapic" boot option passed */
157extern int skip_ioapic_setup; 157extern int skip_ioapic_setup;
158 158
159/* 1 if "noapic" boot option passed */
160extern int noioapicquirk;
161
162/* -1 if "noapic" boot option passed */
163extern int noioapicreroute;
164
159/* 1 if the timer IRQ uses the '8259A Virtual Wire' mode */ 165/* 1 if the timer IRQ uses the '8259A Virtual Wire' mode */
160extern int timer_through_8259; 166extern int timer_through_8259;
161 167
162static inline void disable_ioapic_setup(void) 168static inline void disable_ioapic_setup(void)
163{ 169{
170#ifdef CONFIG_PCI
171 noioapicquirk = 1;
172 noioapicreroute = -1;
173#endif
164 skip_ioapic_setup = 1; 174 skip_ioapic_setup = 1;
165} 175}
166 176
@@ -188,17 +198,14 @@ extern void restore_IO_APIC_setup(void);
188extern void reinit_intr_remapped_IO_APIC(int); 198extern void reinit_intr_remapped_IO_APIC(int);
189#endif 199#endif
190 200
191extern int probe_nr_irqs(void); 201extern void probe_nr_irqs_gsi(void);
192 202
193#else /* !CONFIG_X86_IO_APIC */ 203#else /* !CONFIG_X86_IO_APIC */
194#define io_apic_assign_pci_irqs 0 204#define io_apic_assign_pci_irqs 0
195static const int timer_through_8259 = 0; 205static const int timer_through_8259 = 0;
196static inline void ioapic_init_mappings(void) { } 206static inline void ioapic_init_mappings(void) { }
197 207
198static inline int probe_nr_irqs(void) 208static inline void probe_nr_irqs_gsi(void) { }
199{
200 return NR_IRQS;
201}
202#endif 209#endif
203 210
204#endif /* _ASM_X86_IO_APIC_H */ 211#endif /* _ASM_X86_IO_APIC_H */
diff --git a/arch/x86/include/asm/iommu.h b/arch/x86/include/asm/iommu.h
index 0b500c5b6446..a6ee9e6f530f 100644
--- a/arch/x86/include/asm/iommu.h
+++ b/arch/x86/include/asm/iommu.h
@@ -7,42 +7,7 @@ extern struct dma_mapping_ops nommu_dma_ops;
7extern int force_iommu, no_iommu; 7extern int force_iommu, no_iommu;
8extern int iommu_detected; 8extern int iommu_detected;
9 9
10extern unsigned long iommu_nr_pages(unsigned long addr, unsigned long len);
11
12/* 10 seconds */ 10/* 10 seconds */
13#define DMAR_OPERATION_TIMEOUT ((cycles_t) tsc_khz*10*1000) 11#define DMAR_OPERATION_TIMEOUT ((cycles_t) tsc_khz*10*1000)
14 12
15#ifdef CONFIG_GART_IOMMU
16extern int gart_iommu_aperture;
17extern int gart_iommu_aperture_allowed;
18extern int gart_iommu_aperture_disabled;
19
20extern void early_gart_iommu_check(void);
21extern void gart_iommu_init(void);
22extern void gart_iommu_shutdown(void);
23extern void __init gart_parse_options(char *);
24extern void gart_iommu_hole_init(void);
25
26#else
27#define gart_iommu_aperture 0
28#define gart_iommu_aperture_allowed 0
29#define gart_iommu_aperture_disabled 1
30
31static inline void early_gart_iommu_check(void)
32{
33}
34static inline void gart_iommu_init(void)
35{
36}
37static inline void gart_iommu_shutdown(void)
38{
39}
40static inline void gart_parse_options(char *options)
41{
42}
43static inline void gart_iommu_hole_init(void)
44{
45}
46#endif
47
48#endif /* _ASM_X86_IOMMU_H */ 13#endif /* _ASM_X86_IOMMU_H */
diff --git a/arch/x86/include/asm/ipi.h b/arch/x86/include/asm/ipi.h
index f89dffb28aa9..c745a306f7d3 100644
--- a/arch/x86/include/asm/ipi.h
+++ b/arch/x86/include/asm/ipi.h
@@ -117,7 +117,8 @@ static inline void __send_IPI_dest_field(unsigned int mask, int vector,
117 native_apic_mem_write(APIC_ICR, cfg); 117 native_apic_mem_write(APIC_ICR, cfg);
118} 118}
119 119
120static inline void send_IPI_mask_sequence(cpumask_t mask, int vector) 120static inline void send_IPI_mask_sequence(const struct cpumask *mask,
121 int vector)
121{ 122{
122 unsigned long flags; 123 unsigned long flags;
123 unsigned long query_cpu; 124 unsigned long query_cpu;
@@ -128,11 +129,29 @@ static inline void send_IPI_mask_sequence(cpumask_t mask, int vector)
128 * - mbligh 129 * - mbligh
129 */ 130 */
130 local_irq_save(flags); 131 local_irq_save(flags);
131 for_each_cpu_mask_nr(query_cpu, mask) { 132 for_each_cpu(query_cpu, mask) {
132 __send_IPI_dest_field(per_cpu(x86_cpu_to_apicid, query_cpu), 133 __send_IPI_dest_field(per_cpu(x86_cpu_to_apicid, query_cpu),
133 vector, APIC_DEST_PHYSICAL); 134 vector, APIC_DEST_PHYSICAL);
134 } 135 }
135 local_irq_restore(flags); 136 local_irq_restore(flags);
136} 137}
137 138
139static inline void send_IPI_mask_allbutself(const struct cpumask *mask,
140 int vector)
141{
142 unsigned long flags;
143 unsigned int query_cpu;
144 unsigned int this_cpu = smp_processor_id();
145
146 /* See Hack comment above */
147
148 local_irq_save(flags);
149 for_each_cpu(query_cpu, mask)
150 if (query_cpu != this_cpu)
151 __send_IPI_dest_field(
152 per_cpu(x86_cpu_to_apicid, query_cpu),
153 vector, APIC_DEST_PHYSICAL);
154 local_irq_restore(flags);
155}
156
138#endif /* _ASM_X86_IPI_H */ 157#endif /* _ASM_X86_IPI_H */
diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h
index bae0eda95486..592688ed04d3 100644
--- a/arch/x86/include/asm/irq.h
+++ b/arch/x86/include/asm/irq.h
@@ -31,13 +31,9 @@ static inline int irq_canonicalize(int irq)
31# endif 31# endif
32#endif 32#endif
33 33
34#ifdef CONFIG_IRQBALANCE
35extern int irqbalance_disable(char *str);
36#endif
37
38#ifdef CONFIG_HOTPLUG_CPU 34#ifdef CONFIG_HOTPLUG_CPU
39#include <linux/cpumask.h> 35#include <linux/cpumask.h>
40extern void fixup_irqs(cpumask_t map); 36extern void fixup_irqs(void);
41#endif 37#endif
42 38
43extern unsigned int do_IRQ(struct pt_regs *regs); 39extern unsigned int do_IRQ(struct pt_regs *regs);
@@ -46,5 +42,6 @@ extern void native_init_IRQ(void);
46 42
47/* Interrupt vector management */ 43/* Interrupt vector management */
48extern DECLARE_BITMAP(used_vectors, NR_VECTORS); 44extern DECLARE_BITMAP(used_vectors, NR_VECTORS);
45extern int vector_used_by_percpu_irq(unsigned int vector);
49 46
50#endif /* _ASM_X86_IRQ_H */ 47#endif /* _ASM_X86_IRQ_H */
diff --git a/arch/x86/include/asm/irq_regs_32.h b/arch/x86/include/asm/irq_regs_32.h
index af2f02d27fc7..86afd7473457 100644
--- a/arch/x86/include/asm/irq_regs_32.h
+++ b/arch/x86/include/asm/irq_regs_32.h
@@ -9,6 +9,8 @@
9 9
10#include <asm/percpu.h> 10#include <asm/percpu.h>
11 11
12#define ARCH_HAS_OWN_IRQ_REGS
13
12DECLARE_PER_CPU(struct pt_regs *, irq_regs); 14DECLARE_PER_CPU(struct pt_regs *, irq_regs);
13 15
14static inline struct pt_regs *get_irq_regs(void) 16static inline struct pt_regs *get_irq_regs(void)
diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
index 0005adb0f941..f7ff65032b9d 100644
--- a/arch/x86/include/asm/irq_vectors.h
+++ b/arch/x86/include/asm/irq_vectors.h
@@ -101,12 +101,23 @@
101#define LAST_VM86_IRQ 15 101#define LAST_VM86_IRQ 15
102#define invalid_vm86_irq(irq) ((irq) < 3 || (irq) > 15) 102#define invalid_vm86_irq(irq) ((irq) < 3 || (irq) > 15)
103 103
104#define NR_IRQS_LEGACY 16
105
104#if defined(CONFIG_X86_IO_APIC) && !defined(CONFIG_X86_VOYAGER) 106#if defined(CONFIG_X86_IO_APIC) && !defined(CONFIG_X86_VOYAGER)
107
108#ifndef CONFIG_SPARSE_IRQ
105# if NR_CPUS < MAX_IO_APICS 109# if NR_CPUS < MAX_IO_APICS
106# define NR_IRQS (NR_VECTORS + (32 * NR_CPUS)) 110# define NR_IRQS (NR_VECTORS + (32 * NR_CPUS))
107# else 111# else
108# define NR_IRQS (NR_VECTORS + (32 * MAX_IO_APICS)) 112# define NR_IRQS (NR_VECTORS + (32 * MAX_IO_APICS))
109# endif 113# endif
114#else
115# if (8 * NR_CPUS) > (32 * MAX_IO_APICS)
116# define NR_IRQS (NR_VECTORS + (8 * NR_CPUS))
117# else
118# define NR_IRQS (NR_VECTORS + (32 * MAX_IO_APICS))
119# endif
120#endif
110 121
111#elif defined(CONFIG_X86_VOYAGER) 122#elif defined(CONFIG_X86_VOYAGER)
112 123
diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h
index a1f22771a15a..c61d8b2ab8b9 100644
--- a/arch/x86/include/asm/kexec.h
+++ b/arch/x86/include/asm/kexec.h
@@ -5,21 +5,8 @@
5# define PA_CONTROL_PAGE 0 5# define PA_CONTROL_PAGE 0
6# define VA_CONTROL_PAGE 1 6# define VA_CONTROL_PAGE 1
7# define PA_PGD 2 7# define PA_PGD 2
8# define VA_PGD 3 8# define PA_SWAP_PAGE 3
9# define PA_PTE_0 4 9# define PAGES_NR 4
10# define VA_PTE_0 5
11# define PA_PTE_1 6
12# define VA_PTE_1 7
13# define PA_SWAP_PAGE 8
14# ifdef CONFIG_X86_PAE
15# define PA_PMD_0 9
16# define VA_PMD_0 10
17# define PA_PMD_1 11
18# define VA_PMD_1 12
19# define PAGES_NR 13
20# else
21# define PAGES_NR 9
22# endif
23#else 10#else
24# define PA_CONTROL_PAGE 0 11# define PA_CONTROL_PAGE 0
25# define VA_CONTROL_PAGE 1 12# define VA_CONTROL_PAGE 1
@@ -170,6 +157,20 @@ relocate_kernel(unsigned long indirection_page,
170 unsigned long start_address) ATTRIB_NORET; 157 unsigned long start_address) ATTRIB_NORET;
171#endif 158#endif
172 159
160#ifdef CONFIG_X86_32
161#define ARCH_HAS_KIMAGE_ARCH
162
163struct kimage_arch {
164 pgd_t *pgd;
165#ifdef CONFIG_X86_PAE
166 pmd_t *pmd0;
167 pmd_t *pmd1;
168#endif
169 pte_t *pte0;
170 pte_t *pte1;
171};
172#endif
173
173#endif /* __ASSEMBLY__ */ 174#endif /* __ASSEMBLY__ */
174 175
175#endif /* _ASM_X86_KEXEC_H */ 176#endif /* _ASM_X86_KEXEC_H */
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 8346be87cfa1..730843d1d2fb 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -21,6 +21,7 @@
21 21
22#include <asm/pvclock-abi.h> 22#include <asm/pvclock-abi.h>
23#include <asm/desc.h> 23#include <asm/desc.h>
24#include <asm/mtrr.h>
24 25
25#define KVM_MAX_VCPUS 16 26#define KVM_MAX_VCPUS 16
26#define KVM_MEMORY_SLOTS 32 27#define KVM_MEMORY_SLOTS 32
@@ -86,6 +87,7 @@
86#define KVM_MIN_FREE_MMU_PAGES 5 87#define KVM_MIN_FREE_MMU_PAGES 5
87#define KVM_REFILL_PAGES 25 88#define KVM_REFILL_PAGES 25
88#define KVM_MAX_CPUID_ENTRIES 40 89#define KVM_MAX_CPUID_ENTRIES 40
90#define KVM_NR_FIXED_MTRR_REGION 88
89#define KVM_NR_VAR_MTRR 8 91#define KVM_NR_VAR_MTRR 8
90 92
91extern spinlock_t kvm_lock; 93extern spinlock_t kvm_lock;
@@ -180,6 +182,8 @@ struct kvm_mmu_page {
180 struct list_head link; 182 struct list_head link;
181 struct hlist_node hash_link; 183 struct hlist_node hash_link;
182 184
185 struct list_head oos_link;
186
183 /* 187 /*
184 * The following two entries are used to key the shadow page in the 188 * The following two entries are used to key the shadow page in the
185 * hash table. 189 * hash table.
@@ -190,13 +194,16 @@ struct kvm_mmu_page {
190 u64 *spt; 194 u64 *spt;
191 /* hold the gfn of each spte inside spt */ 195 /* hold the gfn of each spte inside spt */
192 gfn_t *gfns; 196 gfn_t *gfns;
193 unsigned long slot_bitmap; /* One bit set per slot which has memory 197 /*
194 * in this shadow page. 198 * One bit set per slot which has memory
195 */ 199 * in this shadow page.
200 */
201 DECLARE_BITMAP(slot_bitmap, KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS);
196 int multimapped; /* More than one parent_pte? */ 202 int multimapped; /* More than one parent_pte? */
197 int root_count; /* Currently serving as active root */ 203 int root_count; /* Currently serving as active root */
198 bool unsync; 204 bool unsync;
199 bool unsync_children; 205 bool global;
206 unsigned int unsync_children;
200 union { 207 union {
201 u64 *parent_pte; /* !multimapped */ 208 u64 *parent_pte; /* !multimapped */
202 struct hlist_head parent_ptes; /* multimapped, kvm_pte_chain */ 209 struct hlist_head parent_ptes; /* multimapped, kvm_pte_chain */
@@ -327,8 +334,10 @@ struct kvm_vcpu_arch {
327 334
328 bool nmi_pending; 335 bool nmi_pending;
329 bool nmi_injected; 336 bool nmi_injected;
337 bool nmi_window_open;
330 338
331 u64 mtrr[0x100]; 339 struct mtrr_state_type mtrr_state;
340 u32 pat;
332}; 341};
333 342
334struct kvm_mem_alias { 343struct kvm_mem_alias {
@@ -350,11 +359,13 @@ struct kvm_arch{
350 */ 359 */
351 struct list_head active_mmu_pages; 360 struct list_head active_mmu_pages;
352 struct list_head assigned_dev_head; 361 struct list_head assigned_dev_head;
353 struct dmar_domain *intel_iommu_domain; 362 struct list_head oos_global_pages;
363 struct iommu_domain *iommu_domain;
354 struct kvm_pic *vpic; 364 struct kvm_pic *vpic;
355 struct kvm_ioapic *vioapic; 365 struct kvm_ioapic *vioapic;
356 struct kvm_pit *vpit; 366 struct kvm_pit *vpit;
357 struct hlist_head irq_ack_notifier_list; 367 struct hlist_head irq_ack_notifier_list;
368 int vapics_in_nmi_mode;
358 369
359 int round_robin_prev_vcpu; 370 int round_robin_prev_vcpu;
360 unsigned int tss_addr; 371 unsigned int tss_addr;
@@ -378,6 +389,7 @@ struct kvm_vm_stat {
378 u32 mmu_recycled; 389 u32 mmu_recycled;
379 u32 mmu_cache_miss; 390 u32 mmu_cache_miss;
380 u32 mmu_unsync; 391 u32 mmu_unsync;
392 u32 mmu_unsync_global;
381 u32 remote_tlb_flush; 393 u32 remote_tlb_flush;
382 u32 lpages; 394 u32 lpages;
383}; 395};
@@ -397,6 +409,7 @@ struct kvm_vcpu_stat {
397 u32 halt_exits; 409 u32 halt_exits;
398 u32 halt_wakeup; 410 u32 halt_wakeup;
399 u32 request_irq_exits; 411 u32 request_irq_exits;
412 u32 request_nmi_exits;
400 u32 irq_exits; 413 u32 irq_exits;
401 u32 host_state_reload; 414 u32 host_state_reload;
402 u32 efer_reload; 415 u32 efer_reload;
@@ -405,6 +418,7 @@ struct kvm_vcpu_stat {
405 u32 insn_emulation_fail; 418 u32 insn_emulation_fail;
406 u32 hypercalls; 419 u32 hypercalls;
407 u32 irq_injections; 420 u32 irq_injections;
421 u32 nmi_injections;
408}; 422};
409 423
410struct descriptor_table { 424struct descriptor_table {
@@ -477,6 +491,7 @@ struct kvm_x86_ops {
477 491
478 int (*set_tss_addr)(struct kvm *kvm, unsigned int addr); 492 int (*set_tss_addr)(struct kvm *kvm, unsigned int addr);
479 int (*get_tdp_level)(void); 493 int (*get_tdp_level)(void);
494 int (*get_mt_mask_shift)(void);
480}; 495};
481 496
482extern struct kvm_x86_ops *kvm_x86_ops; 497extern struct kvm_x86_ops *kvm_x86_ops;
@@ -490,7 +505,7 @@ int kvm_mmu_setup(struct kvm_vcpu *vcpu);
490void kvm_mmu_set_nonpresent_ptes(u64 trap_pte, u64 notrap_pte); 505void kvm_mmu_set_nonpresent_ptes(u64 trap_pte, u64 notrap_pte);
491void kvm_mmu_set_base_ptes(u64 base_pte); 506void kvm_mmu_set_base_ptes(u64 base_pte);
492void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask, 507void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask,
493 u64 dirty_mask, u64 nx_mask, u64 x_mask); 508 u64 dirty_mask, u64 nx_mask, u64 x_mask, u64 mt_mask);
494 509
495int kvm_mmu_reset_context(struct kvm_vcpu *vcpu); 510int kvm_mmu_reset_context(struct kvm_vcpu *vcpu);
496void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot); 511void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot);
@@ -587,12 +602,14 @@ unsigned long segment_base(u16 selector);
587 602
588void kvm_mmu_flush_tlb(struct kvm_vcpu *vcpu); 603void kvm_mmu_flush_tlb(struct kvm_vcpu *vcpu);
589void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, 604void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
590 const u8 *new, int bytes); 605 const u8 *new, int bytes,
606 bool guest_initiated);
591int kvm_mmu_unprotect_page_virt(struct kvm_vcpu *vcpu, gva_t gva); 607int kvm_mmu_unprotect_page_virt(struct kvm_vcpu *vcpu, gva_t gva);
592void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu); 608void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu);
593int kvm_mmu_load(struct kvm_vcpu *vcpu); 609int kvm_mmu_load(struct kvm_vcpu *vcpu);
594void kvm_mmu_unload(struct kvm_vcpu *vcpu); 610void kvm_mmu_unload(struct kvm_vcpu *vcpu);
595void kvm_mmu_sync_roots(struct kvm_vcpu *vcpu); 611void kvm_mmu_sync_roots(struct kvm_vcpu *vcpu);
612void kvm_mmu_sync_global(struct kvm_vcpu *vcpu);
596 613
597int kvm_emulate_hypercall(struct kvm_vcpu *vcpu); 614int kvm_emulate_hypercall(struct kvm_vcpu *vcpu);
598 615
@@ -607,6 +624,8 @@ void kvm_disable_tdp(void);
607int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3); 624int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3);
608int complete_pio(struct kvm_vcpu *vcpu); 625int complete_pio(struct kvm_vcpu *vcpu);
609 626
627struct kvm_memory_slot *gfn_to_memslot_unaliased(struct kvm *kvm, gfn_t gfn);
628
610static inline struct kvm_mmu_page *page_header(hpa_t shadow_page) 629static inline struct kvm_mmu_page *page_header(hpa_t shadow_page)
611{ 630{
612 struct page *page = pfn_to_page(shadow_page >> PAGE_SHIFT); 631 struct page *page = pfn_to_page(shadow_page >> PAGE_SHIFT);
@@ -702,18 +721,6 @@ static inline void kvm_inject_gp(struct kvm_vcpu *vcpu, u32 error_code)
702 kvm_queue_exception_e(vcpu, GP_VECTOR, error_code); 721 kvm_queue_exception_e(vcpu, GP_VECTOR, error_code);
703} 722}
704 723
705#define ASM_VMX_VMCLEAR_RAX ".byte 0x66, 0x0f, 0xc7, 0x30"
706#define ASM_VMX_VMLAUNCH ".byte 0x0f, 0x01, 0xc2"
707#define ASM_VMX_VMRESUME ".byte 0x0f, 0x01, 0xc3"
708#define ASM_VMX_VMPTRLD_RAX ".byte 0x0f, 0xc7, 0x30"
709#define ASM_VMX_VMREAD_RDX_RAX ".byte 0x0f, 0x78, 0xd0"
710#define ASM_VMX_VMWRITE_RAX_RDX ".byte 0x0f, 0x79, 0xd0"
711#define ASM_VMX_VMWRITE_RSP_RDX ".byte 0x0f, 0x79, 0xd4"
712#define ASM_VMX_VMXOFF ".byte 0x0f, 0x01, 0xc4"
713#define ASM_VMX_VMXON_RAX ".byte 0xf3, 0x0f, 0xc7, 0x30"
714#define ASM_VMX_INVEPT ".byte 0x66, 0x0f, 0x38, 0x80, 0x08"
715#define ASM_VMX_INVVPID ".byte 0x66, 0x0f, 0x38, 0x81, 0x08"
716
717#define MSR_IA32_TIME_STAMP_COUNTER 0x010 724#define MSR_IA32_TIME_STAMP_COUNTER 0x010
718 725
719#define TSS_IOPB_BASE_OFFSET 0x66 726#define TSS_IOPB_BASE_OFFSET 0x66
diff --git a/arch/x86/include/asm/kvm_x86_emulate.h b/arch/x86/include/asm/kvm_x86_emulate.h
index 25179a29f208..6a159732881a 100644
--- a/arch/x86/include/asm/kvm_x86_emulate.h
+++ b/arch/x86/include/asm/kvm_x86_emulate.h
@@ -123,6 +123,7 @@ struct decode_cache {
123 u8 ad_bytes; 123 u8 ad_bytes;
124 u8 rex_prefix; 124 u8 rex_prefix;
125 struct operand src; 125 struct operand src;
126 struct operand src2;
126 struct operand dst; 127 struct operand dst;
127 bool has_seg_override; 128 bool has_seg_override;
128 u8 seg_override; 129 u8 seg_override;
@@ -146,22 +147,18 @@ struct x86_emulate_ctxt {
146 /* Register state before/after emulation. */ 147 /* Register state before/after emulation. */
147 struct kvm_vcpu *vcpu; 148 struct kvm_vcpu *vcpu;
148 149
149 /* Linear faulting address (if emulating a page-faulting instruction) */
150 unsigned long eflags; 150 unsigned long eflags;
151
152 /* Emulated execution mode, represented by an X86EMUL_MODE value. */ 151 /* Emulated execution mode, represented by an X86EMUL_MODE value. */
153 int mode; 152 int mode;
154
155 u32 cs_base; 153 u32 cs_base;
156 154
157 /* decode cache */ 155 /* decode cache */
158
159 struct decode_cache decode; 156 struct decode_cache decode;
160}; 157};
161 158
162/* Repeat String Operation Prefix */ 159/* Repeat String Operation Prefix */
163#define REPE_PREFIX 1 160#define REPE_PREFIX 1
164#define REPNE_PREFIX 2 161#define REPNE_PREFIX 2
165 162
166/* Execution mode, passed to the emulator. */ 163/* Execution mode, passed to the emulator. */
167#define X86EMUL_MODE_REAL 0 /* Real mode. */ 164#define X86EMUL_MODE_REAL 0 /* Real mode. */
@@ -170,7 +167,7 @@ struct x86_emulate_ctxt {
170#define X86EMUL_MODE_PROT64 8 /* 64-bit (long) mode. */ 167#define X86EMUL_MODE_PROT64 8 /* 64-bit (long) mode. */
171 168
172/* Host execution mode. */ 169/* Host execution mode. */
173#if defined(__i386__) 170#if defined(CONFIG_X86_32)
174#define X86EMUL_MODE_HOST X86EMUL_MODE_PROT32 171#define X86EMUL_MODE_HOST X86EMUL_MODE_PROT32
175#elif defined(CONFIG_X86_64) 172#elif defined(CONFIG_X86_64)
176#define X86EMUL_MODE_HOST X86EMUL_MODE_PROT64 173#define X86EMUL_MODE_HOST X86EMUL_MODE_PROT64
diff --git a/arch/x86/include/asm/lguest.h b/arch/x86/include/asm/lguest.h
index d28a507cef39..1caf57628b9c 100644
--- a/arch/x86/include/asm/lguest.h
+++ b/arch/x86/include/asm/lguest.h
@@ -15,7 +15,7 @@
15#define SHARED_SWITCHER_PAGES \ 15#define SHARED_SWITCHER_PAGES \
16 DIV_ROUND_UP(end_switcher_text - start_switcher_text, PAGE_SIZE) 16 DIV_ROUND_UP(end_switcher_text - start_switcher_text, PAGE_SIZE)
17/* Pages for switcher itself, then two pages per cpu */ 17/* Pages for switcher itself, then two pages per cpu */
18#define TOTAL_SWITCHER_PAGES (SHARED_SWITCHER_PAGES + 2 * NR_CPUS) 18#define TOTAL_SWITCHER_PAGES (SHARED_SWITCHER_PAGES + 2 * nr_cpu_ids)
19 19
20/* We map at -4M for ease of mapping into the guest (one PTE page). */ 20/* We map at -4M for ease of mapping into the guest (one PTE page). */
21#define SWITCHER_ADDR 0xFFC00000 21#define SWITCHER_ADDR 0xFFC00000
diff --git a/arch/x86/include/asm/linkage.h b/arch/x86/include/asm/linkage.h
index f61ee8f937e4..5d98d0b68ffc 100644
--- a/arch/x86/include/asm/linkage.h
+++ b/arch/x86/include/asm/linkage.h
@@ -57,5 +57,65 @@
57#define __ALIGN_STR ".align 16,0x90" 57#define __ALIGN_STR ".align 16,0x90"
58#endif 58#endif
59 59
60/*
61 * to check ENTRY_X86/END_X86 and
62 * KPROBE_ENTRY_X86/KPROBE_END_X86
63 * unbalanced-missed-mixed appearance
64 */
65#define __set_entry_x86 .set ENTRY_X86_IN, 0
66#define __unset_entry_x86 .set ENTRY_X86_IN, 1
67#define __set_kprobe_x86 .set KPROBE_X86_IN, 0
68#define __unset_kprobe_x86 .set KPROBE_X86_IN, 1
69
70#define __macro_err_x86 .error "ENTRY_X86/KPROBE_X86 unbalanced,missed,mixed"
71
72#define __check_entry_x86 \
73 .ifdef ENTRY_X86_IN; \
74 .ifeq ENTRY_X86_IN; \
75 __macro_err_x86; \
76 .abort; \
77 .endif; \
78 .endif
79
80#define __check_kprobe_x86 \
81 .ifdef KPROBE_X86_IN; \
82 .ifeq KPROBE_X86_IN; \
83 __macro_err_x86; \
84 .abort; \
85 .endif; \
86 .endif
87
88#define __check_entry_kprobe_x86 \
89 __check_entry_x86; \
90 __check_kprobe_x86
91
92#define ENTRY_KPROBE_FINAL_X86 __check_entry_kprobe_x86
93
94#define ENTRY_X86(name) \
95 __check_entry_kprobe_x86; \
96 __set_entry_x86; \
97 .globl name; \
98 __ALIGN; \
99 name:
100
101#define END_X86(name) \
102 __unset_entry_x86; \
103 __check_entry_kprobe_x86; \
104 .size name, .-name
105
106#define KPROBE_ENTRY_X86(name) \
107 __check_entry_kprobe_x86; \
108 __set_kprobe_x86; \
109 .pushsection .kprobes.text, "ax"; \
110 .globl name; \
111 __ALIGN; \
112 name:
113
114#define KPROBE_END_X86(name) \
115 __unset_kprobe_x86; \
116 __check_entry_kprobe_x86; \
117 .size name, .-name; \
118 .popsection
119
60#endif /* _ASM_X86_LINKAGE_H */ 120#endif /* _ASM_X86_LINKAGE_H */
61 121
diff --git a/arch/x86/include/asm/mach-default/mach_apic.h b/arch/x86/include/asm/mach-default/mach_apic.h
index ff3a6c236c00..cc09cbbee27e 100644
--- a/arch/x86/include/asm/mach-default/mach_apic.h
+++ b/arch/x86/include/asm/mach-default/mach_apic.h
@@ -8,12 +8,12 @@
8 8
9#define APIC_DFR_VALUE (APIC_DFR_FLAT) 9#define APIC_DFR_VALUE (APIC_DFR_FLAT)
10 10
11static inline cpumask_t target_cpus(void) 11static inline const struct cpumask *target_cpus(void)
12{ 12{
13#ifdef CONFIG_SMP 13#ifdef CONFIG_SMP
14 return cpu_online_map; 14 return cpu_online_mask;
15#else 15#else
16 return cpumask_of_cpu(0); 16 return cpumask_of(0);
17#endif 17#endif
18} 18}
19 19
@@ -28,15 +28,18 @@ static inline cpumask_t target_cpus(void)
28#define apic_id_registered (genapic->apic_id_registered) 28#define apic_id_registered (genapic->apic_id_registered)
29#define init_apic_ldr (genapic->init_apic_ldr) 29#define init_apic_ldr (genapic->init_apic_ldr)
30#define cpu_mask_to_apicid (genapic->cpu_mask_to_apicid) 30#define cpu_mask_to_apicid (genapic->cpu_mask_to_apicid)
31#define cpu_mask_to_apicid_and (genapic->cpu_mask_to_apicid_and)
31#define phys_pkg_id (genapic->phys_pkg_id) 32#define phys_pkg_id (genapic->phys_pkg_id)
32#define vector_allocation_domain (genapic->vector_allocation_domain) 33#define vector_allocation_domain (genapic->vector_allocation_domain)
33#define read_apic_id() (GET_APIC_ID(apic_read(APIC_ID))) 34#define read_apic_id() (GET_APIC_ID(apic_read(APIC_ID)))
34#define send_IPI_self (genapic->send_IPI_self) 35#define send_IPI_self (genapic->send_IPI_self)
36#define wakeup_secondary_cpu (genapic->wakeup_cpu)
35extern void setup_apic_routing(void); 37extern void setup_apic_routing(void);
36#else 38#else
37#define INT_DELIVERY_MODE dest_LowestPrio 39#define INT_DELIVERY_MODE dest_LowestPrio
38#define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */ 40#define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */
39#define TARGET_CPUS (target_cpus()) 41#define TARGET_CPUS (target_cpus())
42#define wakeup_secondary_cpu wakeup_secondary_cpu_via_init
40/* 43/*
41 * Set up the logical destination ID. 44 * Set up the logical destination ID.
42 * 45 *
@@ -59,9 +62,19 @@ static inline int apic_id_registered(void)
59 return physid_isset(read_apic_id(), phys_cpu_present_map); 62 return physid_isset(read_apic_id(), phys_cpu_present_map);
60} 63}
61 64
62static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask) 65static inline unsigned int cpu_mask_to_apicid(const struct cpumask *cpumask)
63{ 66{
64 return cpus_addr(cpumask)[0]; 67 return cpumask_bits(cpumask)[0];
68}
69
70static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
71 const struct cpumask *andmask)
72{
73 unsigned long mask1 = cpumask_bits(cpumask)[0];
74 unsigned long mask2 = cpumask_bits(andmask)[0];
75 unsigned long mask3 = cpumask_bits(cpu_online_mask)[0];
76
77 return (unsigned int)(mask1 & mask2 & mask3);
65} 78}
66 79
67static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) 80static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
@@ -86,7 +99,7 @@ static inline int apicid_to_node(int logical_apicid)
86#endif 99#endif
87} 100}
88 101
89static inline cpumask_t vector_allocation_domain(int cpu) 102static inline void vector_allocation_domain(int cpu, struct cpumask *retmask)
90{ 103{
91 /* Careful. Some cpus do not strictly honor the set of cpus 104 /* Careful. Some cpus do not strictly honor the set of cpus
92 * specified in the interrupt destination when using lowest 105 * specified in the interrupt destination when using lowest
@@ -96,8 +109,7 @@ static inline cpumask_t vector_allocation_domain(int cpu)
96 * deliver interrupts to the wrong hyperthread when only one 109 * deliver interrupts to the wrong hyperthread when only one
97 * hyperthread was specified in the interrupt desitination. 110 * hyperthread was specified in the interrupt desitination.
98 */ 111 */
99 cpumask_t domain = { { [0] = APIC_ALL_CPUS, } }; 112 *retmask = (cpumask_t) { { [0] = APIC_ALL_CPUS } };
100 return domain;
101} 113}
102#endif 114#endif
103 115
@@ -129,7 +141,7 @@ static inline int cpu_to_logical_apicid(int cpu)
129 141
130static inline int cpu_present_to_apicid(int mps_cpu) 142static inline int cpu_present_to_apicid(int mps_cpu)
131{ 143{
132 if (mps_cpu < NR_CPUS && cpu_present(mps_cpu)) 144 if (mps_cpu < nr_cpu_ids && cpu_present(mps_cpu))
133 return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); 145 return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu);
134 else 146 else
135 return BAD_APICID; 147 return BAD_APICID;
diff --git a/arch/x86/include/asm/mach-default/mach_ipi.h b/arch/x86/include/asm/mach-default/mach_ipi.h
index fabca01ebacf..191312d155da 100644
--- a/arch/x86/include/asm/mach-default/mach_ipi.h
+++ b/arch/x86/include/asm/mach-default/mach_ipi.h
@@ -4,7 +4,8 @@
4/* Avoid include hell */ 4/* Avoid include hell */
5#define NMI_VECTOR 0x02 5#define NMI_VECTOR 0x02
6 6
7void send_IPI_mask_bitmask(cpumask_t mask, int vector); 7void send_IPI_mask_bitmask(const struct cpumask *mask, int vector);
8void send_IPI_mask_allbutself(const struct cpumask *mask, int vector);
8void __send_IPI_shortcut(unsigned int shortcut, int vector); 9void __send_IPI_shortcut(unsigned int shortcut, int vector);
9 10
10extern int no_broadcast; 11extern int no_broadcast;
@@ -12,28 +13,27 @@ extern int no_broadcast;
12#ifdef CONFIG_X86_64 13#ifdef CONFIG_X86_64
13#include <asm/genapic.h> 14#include <asm/genapic.h>
14#define send_IPI_mask (genapic->send_IPI_mask) 15#define send_IPI_mask (genapic->send_IPI_mask)
16#define send_IPI_mask_allbutself (genapic->send_IPI_mask_allbutself)
15#else 17#else
16static inline void send_IPI_mask(cpumask_t mask, int vector) 18static inline void send_IPI_mask(const struct cpumask *mask, int vector)
17{ 19{
18 send_IPI_mask_bitmask(mask, vector); 20 send_IPI_mask_bitmask(mask, vector);
19} 21}
22void send_IPI_mask_allbutself(const struct cpumask *mask, int vector);
20#endif 23#endif
21 24
22static inline void __local_send_IPI_allbutself(int vector) 25static inline void __local_send_IPI_allbutself(int vector)
23{ 26{
24 if (no_broadcast || vector == NMI_VECTOR) { 27 if (no_broadcast || vector == NMI_VECTOR)
25 cpumask_t mask = cpu_online_map; 28 send_IPI_mask_allbutself(cpu_online_mask, vector);
26 29 else
27 cpu_clear(smp_processor_id(), mask);
28 send_IPI_mask(mask, vector);
29 } else
30 __send_IPI_shortcut(APIC_DEST_ALLBUT, vector); 30 __send_IPI_shortcut(APIC_DEST_ALLBUT, vector);
31} 31}
32 32
33static inline void __local_send_IPI_all(int vector) 33static inline void __local_send_IPI_all(int vector)
34{ 34{
35 if (no_broadcast || vector == NMI_VECTOR) 35 if (no_broadcast || vector == NMI_VECTOR)
36 send_IPI_mask(cpu_online_map, vector); 36 send_IPI_mask(cpu_online_mask, vector);
37 else 37 else
38 __send_IPI_shortcut(APIC_DEST_ALLINC, vector); 38 __send_IPI_shortcut(APIC_DEST_ALLINC, vector);
39} 39}
diff --git a/arch/x86/include/asm/mach-default/mach_wakecpu.h b/arch/x86/include/asm/mach-default/mach_wakecpu.h
index 9d80db91e992..ceb013660146 100644
--- a/arch/x86/include/asm/mach-default/mach_wakecpu.h
+++ b/arch/x86/include/asm/mach-default/mach_wakecpu.h
@@ -1,17 +1,8 @@
1#ifndef _ASM_X86_MACH_DEFAULT_MACH_WAKECPU_H 1#ifndef _ASM_X86_MACH_DEFAULT_MACH_WAKECPU_H
2#define _ASM_X86_MACH_DEFAULT_MACH_WAKECPU_H 2#define _ASM_X86_MACH_DEFAULT_MACH_WAKECPU_H
3 3
4/* 4#define TRAMPOLINE_PHYS_LOW (0x467)
5 * This file copes with machines that wakeup secondary CPUs by the 5#define TRAMPOLINE_PHYS_HIGH (0x469)
6 * INIT, INIT, STARTUP sequence.
7 */
8
9#define WAKE_SECONDARY_VIA_INIT
10
11#define TRAMPOLINE_LOW phys_to_virt(0x467)
12#define TRAMPOLINE_HIGH phys_to_virt(0x469)
13
14#define boot_cpu_apicid boot_cpu_physical_apicid
15 6
16static inline void wait_for_init_deassert(atomic_t *deassert) 7static inline void wait_for_init_deassert(atomic_t *deassert)
17{ 8{
@@ -33,9 +24,12 @@ static inline void restore_NMI_vector(unsigned short *high, unsigned short *low)
33{ 24{
34} 25}
35 26
36#define inquire_remote_apic(apicid) do { \ 27extern void __inquire_remote_apic(int apicid);
37 if (apic_verbosity >= APIC_DEBUG) \ 28
38 __inquire_remote_apic(apicid); \ 29static inline void inquire_remote_apic(int apicid)
39 } while (0) 30{
31 if (apic_verbosity >= APIC_DEBUG)
32 __inquire_remote_apic(apicid);
33}
40 34
41#endif /* _ASM_X86_MACH_DEFAULT_MACH_WAKECPU_H */ 35#endif /* _ASM_X86_MACH_DEFAULT_MACH_WAKECPU_H */
diff --git a/arch/x86/include/asm/mach-default/smpboot_hooks.h b/arch/x86/include/asm/mach-default/smpboot_hooks.h
index dbab36d64d48..23bf52103b89 100644
--- a/arch/x86/include/asm/mach-default/smpboot_hooks.h
+++ b/arch/x86/include/asm/mach-default/smpboot_hooks.h
@@ -13,9 +13,11 @@ static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip)
13 CMOS_WRITE(0xa, 0xf); 13 CMOS_WRITE(0xa, 0xf);
14 local_flush_tlb(); 14 local_flush_tlb();
15 pr_debug("1.\n"); 15 pr_debug("1.\n");
16 *((volatile unsigned short *) TRAMPOLINE_HIGH) = start_eip >> 4; 16 *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_HIGH)) =
17 start_eip >> 4;
17 pr_debug("2.\n"); 18 pr_debug("2.\n");
18 *((volatile unsigned short *) TRAMPOLINE_LOW) = start_eip & 0xf; 19 *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) =
20 start_eip & 0xf;
19 pr_debug("3.\n"); 21 pr_debug("3.\n");
20} 22}
21 23
@@ -32,7 +34,7 @@ static inline void smpboot_restore_warm_reset_vector(void)
32 */ 34 */
33 CMOS_WRITE(0, 0xf); 35 CMOS_WRITE(0, 0xf);
34 36
35 *((volatile long *) phys_to_virt(0x467)) = 0; 37 *((volatile long *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) = 0;
36} 38}
37 39
38static inline void __init smpboot_setup_io_apic(void) 40static inline void __init smpboot_setup_io_apic(void)
diff --git a/arch/x86/include/asm/mach-generic/mach_apic.h b/arch/x86/include/asm/mach-generic/mach_apic.h
index 5180bd7478fb..48553e958ad5 100644
--- a/arch/x86/include/asm/mach-generic/mach_apic.h
+++ b/arch/x86/include/asm/mach-generic/mach_apic.h
@@ -24,9 +24,11 @@
24#define check_phys_apicid_present (genapic->check_phys_apicid_present) 24#define check_phys_apicid_present (genapic->check_phys_apicid_present)
25#define check_apicid_used (genapic->check_apicid_used) 25#define check_apicid_used (genapic->check_apicid_used)
26#define cpu_mask_to_apicid (genapic->cpu_mask_to_apicid) 26#define cpu_mask_to_apicid (genapic->cpu_mask_to_apicid)
27#define cpu_mask_to_apicid_and (genapic->cpu_mask_to_apicid_and)
27#define vector_allocation_domain (genapic->vector_allocation_domain) 28#define vector_allocation_domain (genapic->vector_allocation_domain)
28#define enable_apic_mode (genapic->enable_apic_mode) 29#define enable_apic_mode (genapic->enable_apic_mode)
29#define phys_pkg_id (genapic->phys_pkg_id) 30#define phys_pkg_id (genapic->phys_pkg_id)
31#define wakeup_secondary_cpu (genapic->wakeup_cpu)
30 32
31extern void generic_bigsmp_probe(void); 33extern void generic_bigsmp_probe(void);
32 34
diff --git a/arch/x86/include/asm/mach-generic/mach_wakecpu.h b/arch/x86/include/asm/mach-generic/mach_wakecpu.h
new file mode 100644
index 000000000000..1ab16b168c8a
--- /dev/null
+++ b/arch/x86/include/asm/mach-generic/mach_wakecpu.h
@@ -0,0 +1,12 @@
1#ifndef _ASM_X86_MACH_GENERIC_MACH_WAKECPU_H
2#define _ASM_X86_MACH_GENERIC_MACH_WAKECPU_H
3
4#define TRAMPOLINE_PHYS_LOW (genapic->trampoline_phys_low)
5#define TRAMPOLINE_PHYS_HIGH (genapic->trampoline_phys_high)
6#define wait_for_init_deassert (genapic->wait_for_init_deassert)
7#define smp_callin_clear_local_apic (genapic->smp_callin_clear_local_apic)
8#define store_NMI_vector (genapic->store_NMI_vector)
9#define restore_NMI_vector (genapic->restore_NMI_vector)
10#define inquire_remote_apic (genapic->inquire_remote_apic)
11
12#endif /* _ASM_X86_MACH_GENERIC_MACH_APIC_H */
diff --git a/arch/x86/include/asm/mmu_context_32.h b/arch/x86/include/asm/mmu_context_32.h
index 8e10015781fb..7e98ce1d2c0e 100644
--- a/arch/x86/include/asm/mmu_context_32.h
+++ b/arch/x86/include/asm/mmu_context_32.h
@@ -4,9 +4,8 @@
4static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 4static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
5{ 5{
6#ifdef CONFIG_SMP 6#ifdef CONFIG_SMP
7 unsigned cpu = smp_processor_id(); 7 if (x86_read_percpu(cpu_tlbstate.state) == TLBSTATE_OK)
8 if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK) 8 x86_write_percpu(cpu_tlbstate.state, TLBSTATE_LAZY);
9 per_cpu(cpu_tlbstate, cpu).state = TLBSTATE_LAZY;
10#endif 9#endif
11} 10}
12 11
@@ -20,8 +19,8 @@ static inline void switch_mm(struct mm_struct *prev,
20 /* stop flush ipis for the previous mm */ 19 /* stop flush ipis for the previous mm */
21 cpu_clear(cpu, prev->cpu_vm_mask); 20 cpu_clear(cpu, prev->cpu_vm_mask);
22#ifdef CONFIG_SMP 21#ifdef CONFIG_SMP
23 per_cpu(cpu_tlbstate, cpu).state = TLBSTATE_OK; 22 x86_write_percpu(cpu_tlbstate.state, TLBSTATE_OK);
24 per_cpu(cpu_tlbstate, cpu).active_mm = next; 23 x86_write_percpu(cpu_tlbstate.active_mm, next);
25#endif 24#endif
26 cpu_set(cpu, next->cpu_vm_mask); 25 cpu_set(cpu, next->cpu_vm_mask);
27 26
@@ -36,8 +35,8 @@ static inline void switch_mm(struct mm_struct *prev,
36 } 35 }
37#ifdef CONFIG_SMP 36#ifdef CONFIG_SMP
38 else { 37 else {
39 per_cpu(cpu_tlbstate, cpu).state = TLBSTATE_OK; 38 x86_write_percpu(cpu_tlbstate.state, TLBSTATE_OK);
40 BUG_ON(per_cpu(cpu_tlbstate, cpu).active_mm != next); 39 BUG_ON(x86_read_percpu(cpu_tlbstate.active_mm) != next);
41 40
42 if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) { 41 if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) {
43 /* We were in lazy tlb mode and leave_mm disabled 42 /* We were in lazy tlb mode and leave_mm disabled
diff --git a/arch/x86/include/asm/mpspec.h b/arch/x86/include/asm/mpspec.h
index 91885c28f66b..62d14ce3cd00 100644
--- a/arch/x86/include/asm/mpspec.h
+++ b/arch/x86/include/asm/mpspec.h
@@ -6,13 +6,13 @@
6#include <asm/mpspec_def.h> 6#include <asm/mpspec_def.h>
7 7
8extern int apic_version[MAX_APICS]; 8extern int apic_version[MAX_APICS];
9extern int pic_mode;
9 10
10#ifdef CONFIG_X86_32 11#ifdef CONFIG_X86_32
11#include <mach_mpspec.h> 12#include <mach_mpspec.h>
12 13
13extern unsigned int def_to_bigsmp; 14extern unsigned int def_to_bigsmp;
14extern u8 apicid_2_node[]; 15extern u8 apicid_2_node[];
15extern int pic_mode;
16 16
17#ifdef CONFIG_X86_NUMAQ 17#ifdef CONFIG_X86_NUMAQ
18extern int mp_bus_id_to_node[MAX_MP_BUSSES]; 18extern int mp_bus_id_to_node[MAX_MP_BUSSES];
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index e38859d577a1..cb58643947b9 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -85,7 +85,9 @@
85/* AMD64 MSRs. Not complete. See the architecture manual for a more 85/* AMD64 MSRs. Not complete. See the architecture manual for a more
86 complete list. */ 86 complete list. */
87 87
88#define MSR_AMD64_PATCH_LEVEL 0x0000008b
88#define MSR_AMD64_NB_CFG 0xc001001f 89#define MSR_AMD64_NB_CFG 0xc001001f
90#define MSR_AMD64_PATCH_LOADER 0xc0010020
89#define MSR_AMD64_IBSFETCHCTL 0xc0011030 91#define MSR_AMD64_IBSFETCHCTL 0xc0011030
90#define MSR_AMD64_IBSFETCHLINAD 0xc0011031 92#define MSR_AMD64_IBSFETCHLINAD 0xc0011031
91#define MSR_AMD64_IBSFETCHPHYSAD 0xc0011032 93#define MSR_AMD64_IBSFETCHPHYSAD 0xc0011032
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index c2a812ebde89..638bf6241807 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -22,10 +22,10 @@ static inline unsigned long long native_read_tscp(unsigned int *aux)
22} 22}
23 23
24/* 24/*
25 * i386 calling convention returns 64-bit value in edx:eax, while 25 * both i386 and x86_64 returns 64-bit value in edx:eax, but gcc's "A"
26 * x86_64 returns at rax. Also, the "A" constraint does not really 26 * constraint has different meanings. For i386, "A" means exactly
27 * mean rdx:rax in x86_64, so we need specialized behaviour for each 27 * edx:eax, while for x86_64 it doesn't mean rdx:rax or edx:eax. Instead,
28 * architecture 28 * it means rax *or* rdx.
29 */ 29 */
30#ifdef CONFIG_X86_64 30#ifdef CONFIG_X86_64
31#define DECLARE_ARGS(val, low, high) unsigned low, high 31#define DECLARE_ARGS(val, low, high) unsigned low, high
@@ -85,7 +85,8 @@ static inline void native_write_msr(unsigned int msr,
85 asm volatile("wrmsr" : : "c" (msr), "a"(low), "d" (high) : "memory"); 85 asm volatile("wrmsr" : : "c" (msr), "a"(low), "d" (high) : "memory");
86} 86}
87 87
88static inline int native_write_msr_safe(unsigned int msr, 88/* Can be uninlined because referenced by paravirt */
89notrace static inline int native_write_msr_safe(unsigned int msr,
89 unsigned low, unsigned high) 90 unsigned low, unsigned high)
90{ 91{
91 int err; 92 int err;
@@ -181,10 +182,10 @@ static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p)
181} 182}
182 183
183#define rdtscl(low) \ 184#define rdtscl(low) \
184 ((low) = (u32)native_read_tsc()) 185 ((low) = (u32)__native_read_tsc())
185 186
186#define rdtscll(val) \ 187#define rdtscll(val) \
187 ((val) = native_read_tsc()) 188 ((val) = __native_read_tsc())
188 189
189#define rdpmc(counter, low, high) \ 190#define rdpmc(counter, low, high) \
190do { \ 191do { \
diff --git a/arch/x86/include/asm/mtrr.h b/arch/x86/include/asm/mtrr.h
index 7c1e4258b31e..cb988aab716d 100644
--- a/arch/x86/include/asm/mtrr.h
+++ b/arch/x86/include/asm/mtrr.h
@@ -57,6 +57,31 @@ struct mtrr_gentry {
57}; 57};
58#endif /* !__i386__ */ 58#endif /* !__i386__ */
59 59
60struct mtrr_var_range {
61 u32 base_lo;
62 u32 base_hi;
63 u32 mask_lo;
64 u32 mask_hi;
65};
66
67/* In the Intel processor's MTRR interface, the MTRR type is always held in
68 an 8 bit field: */
69typedef u8 mtrr_type;
70
71#define MTRR_NUM_FIXED_RANGES 88
72#define MTRR_MAX_VAR_RANGES 256
73
74struct mtrr_state_type {
75 struct mtrr_var_range var_ranges[MTRR_MAX_VAR_RANGES];
76 mtrr_type fixed_ranges[MTRR_NUM_FIXED_RANGES];
77 unsigned char enabled;
78 unsigned char have_fixed;
79 mtrr_type def_type;
80};
81
82#define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg))
83#define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1)
84
60/* These are the various ioctls */ 85/* These are the various ioctls */
61#define MTRRIOC_ADD_ENTRY _IOW(MTRR_IOCTL_BASE, 0, struct mtrr_sentry) 86#define MTRRIOC_ADD_ENTRY _IOW(MTRR_IOCTL_BASE, 0, struct mtrr_sentry)
62#define MTRRIOC_SET_ENTRY _IOW(MTRR_IOCTL_BASE, 1, struct mtrr_sentry) 87#define MTRRIOC_SET_ENTRY _IOW(MTRR_IOCTL_BASE, 1, struct mtrr_sentry)
diff --git a/arch/x86/include/asm/numaq/apic.h b/arch/x86/include/asm/numaq/apic.h
index 0bf2a06b7a4e..bf37bc49bd8e 100644
--- a/arch/x86/include/asm/numaq/apic.h
+++ b/arch/x86/include/asm/numaq/apic.h
@@ -7,9 +7,9 @@
7 7
8#define APIC_DFR_VALUE (APIC_DFR_CLUSTER) 8#define APIC_DFR_VALUE (APIC_DFR_CLUSTER)
9 9
10static inline cpumask_t target_cpus(void) 10static inline const cpumask_t *target_cpus(void)
11{ 11{
12 return CPU_MASK_ALL; 12 return &CPU_MASK_ALL;
13} 13}
14 14
15#define NO_BALANCE_IRQ (1) 15#define NO_BALANCE_IRQ (1)
@@ -63,8 +63,8 @@ static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
63extern u8 cpu_2_logical_apicid[]; 63extern u8 cpu_2_logical_apicid[];
64static inline int cpu_to_logical_apicid(int cpu) 64static inline int cpu_to_logical_apicid(int cpu)
65{ 65{
66 if (cpu >= NR_CPUS) 66 if (cpu >= nr_cpu_ids)
67 return BAD_APICID; 67 return BAD_APICID;
68 return (int)cpu_2_logical_apicid[cpu]; 68 return (int)cpu_2_logical_apicid[cpu];
69} 69}
70 70
@@ -122,7 +122,13 @@ static inline void enable_apic_mode(void)
122 * We use physical apicids here, not logical, so just return the default 122 * We use physical apicids here, not logical, so just return the default
123 * physical broadcast to stop people from breaking us 123 * physical broadcast to stop people from breaking us
124 */ 124 */
125static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask) 125static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
126{
127 return (int) 0xF;
128}
129
130static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
131 const struct cpumask *andmask)
126{ 132{
127 return (int) 0xF; 133 return (int) 0xF;
128} 134}
diff --git a/arch/x86/include/asm/numaq/ipi.h b/arch/x86/include/asm/numaq/ipi.h
index 935588d286cf..a8374c652778 100644
--- a/arch/x86/include/asm/numaq/ipi.h
+++ b/arch/x86/include/asm/numaq/ipi.h
@@ -1,25 +1,22 @@
1#ifndef __ASM_NUMAQ_IPI_H 1#ifndef __ASM_NUMAQ_IPI_H
2#define __ASM_NUMAQ_IPI_H 2#define __ASM_NUMAQ_IPI_H
3 3
4void send_IPI_mask_sequence(cpumask_t, int vector); 4void send_IPI_mask_sequence(const struct cpumask *mask, int vector);
5void send_IPI_mask_allbutself(const struct cpumask *mask, int vector);
5 6
6static inline void send_IPI_mask(cpumask_t mask, int vector) 7static inline void send_IPI_mask(const struct cpumask *mask, int vector)
7{ 8{
8 send_IPI_mask_sequence(mask, vector); 9 send_IPI_mask_sequence(mask, vector);
9} 10}
10 11
11static inline void send_IPI_allbutself(int vector) 12static inline void send_IPI_allbutself(int vector)
12{ 13{
13 cpumask_t mask = cpu_online_map; 14 send_IPI_mask_allbutself(cpu_online_mask, vector);
14 cpu_clear(smp_processor_id(), mask);
15
16 if (!cpus_empty(mask))
17 send_IPI_mask(mask, vector);
18} 15}
19 16
20static inline void send_IPI_all(int vector) 17static inline void send_IPI_all(int vector)
21{ 18{
22 send_IPI_mask(cpu_online_map, vector); 19 send_IPI_mask(cpu_online_mask, vector);
23} 20}
24 21
25#endif /* __ASM_NUMAQ_IPI_H */ 22#endif /* __ASM_NUMAQ_IPI_H */
diff --git a/arch/x86/include/asm/numaq/wakecpu.h b/arch/x86/include/asm/numaq/wakecpu.h
index c577bda5b1c5..6f499df8eddb 100644
--- a/arch/x86/include/asm/numaq/wakecpu.h
+++ b/arch/x86/include/asm/numaq/wakecpu.h
@@ -3,12 +3,8 @@
3 3
4/* This file copes with machines that wakeup secondary CPUs by NMIs */ 4/* This file copes with machines that wakeup secondary CPUs by NMIs */
5 5
6#define WAKE_SECONDARY_VIA_NMI 6#define TRAMPOLINE_PHYS_LOW (0x8)
7 7#define TRAMPOLINE_PHYS_HIGH (0xa)
8#define TRAMPOLINE_LOW phys_to_virt(0x8)
9#define TRAMPOLINE_HIGH phys_to_virt(0xa)
10
11#define boot_cpu_apicid boot_cpu_logical_apicid
12 8
13/* We don't do anything here because we use NMI's to boot instead */ 9/* We don't do anything here because we use NMI's to boot instead */
14static inline void wait_for_init_deassert(atomic_t *deassert) 10static inline void wait_for_init_deassert(atomic_t *deassert)
@@ -27,17 +23,23 @@ static inline void smp_callin_clear_local_apic(void)
27static inline void store_NMI_vector(unsigned short *high, unsigned short *low) 23static inline void store_NMI_vector(unsigned short *high, unsigned short *low)
28{ 24{
29 printk("Storing NMI vector\n"); 25 printk("Storing NMI vector\n");
30 *high = *((volatile unsigned short *) TRAMPOLINE_HIGH); 26 *high =
31 *low = *((volatile unsigned short *) TRAMPOLINE_LOW); 27 *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_HIGH));
28 *low =
29 *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_LOW));
32} 30}
33 31
34static inline void restore_NMI_vector(unsigned short *high, unsigned short *low) 32static inline void restore_NMI_vector(unsigned short *high, unsigned short *low)
35{ 33{
36 printk("Restoring NMI vector\n"); 34 printk("Restoring NMI vector\n");
37 *((volatile unsigned short *) TRAMPOLINE_HIGH) = *high; 35 *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_HIGH)) =
38 *((volatile unsigned short *) TRAMPOLINE_LOW) = *low; 36 *high;
37 *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) =
38 *low;
39} 39}
40 40
41#define inquire_remote_apic(apicid) {} 41static inline void inquire_remote_apic(int apicid)
42{
43}
42 44
43#endif /* __ASM_NUMAQ_WAKECPU_H */ 45#endif /* __ASM_NUMAQ_WAKECPU_H */
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 875b38edf193..a977de23cb4d 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -19,6 +19,8 @@ struct pci_sysdata {
19}; 19};
20 20
21extern int pci_routeirq; 21extern int pci_routeirq;
22extern int noioapicquirk;
23extern int noioapicreroute;
22 24
23/* scan a bus after allocating a pci_sysdata for it */ 25/* scan a bus after allocating a pci_sysdata for it */
24extern struct pci_bus *pci_scan_bus_on_node(int busno, struct pci_ops *ops, 26extern struct pci_bus *pci_scan_bus_on_node(int busno, struct pci_ops *ops,
@@ -82,6 +84,8 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
82static inline void early_quirks(void) { } 84static inline void early_quirks(void) { }
83#endif 85#endif
84 86
87extern void pci_iommu_alloc(void);
88
85#endif /* __KERNEL__ */ 89#endif /* __KERNEL__ */
86 90
87#ifdef CONFIG_X86_32 91#ifdef CONFIG_X86_32
@@ -98,9 +102,9 @@ static inline void early_quirks(void) { }
98 102
99#ifdef CONFIG_NUMA 103#ifdef CONFIG_NUMA
100/* Returns the node based on pci bus */ 104/* Returns the node based on pci bus */
101static inline int __pcibus_to_node(struct pci_bus *bus) 105static inline int __pcibus_to_node(const struct pci_bus *bus)
102{ 106{
103 struct pci_sysdata *sd = bus->sysdata; 107 const struct pci_sysdata *sd = bus->sysdata;
104 108
105 return sd->node; 109 return sd->node;
106} 110}
@@ -109,6 +113,12 @@ static inline cpumask_t __pcibus_to_cpumask(struct pci_bus *bus)
109{ 113{
110 return node_to_cpumask(__pcibus_to_node(bus)); 114 return node_to_cpumask(__pcibus_to_node(bus));
111} 115}
116
117static inline const struct cpumask *
118cpumask_of_pcibus(const struct pci_bus *bus)
119{
120 return cpumask_of_node(__pcibus_to_node(bus));
121}
112#endif 122#endif
113 123
114#endif /* _ASM_X86_PCI_H */ 124#endif /* _ASM_X86_PCI_H */
diff --git a/arch/x86/include/asm/pci_64.h b/arch/x86/include/asm/pci_64.h
index d02d936840a3..4da207982777 100644
--- a/arch/x86/include/asm/pci_64.h
+++ b/arch/x86/include/asm/pci_64.h
@@ -23,7 +23,6 @@ extern int (*pci_config_write)(int seg, int bus, int dev, int fn,
23 int reg, int len, u32 value); 23 int reg, int len, u32 value);
24 24
25extern void dma32_reserve_bootmem(void); 25extern void dma32_reserve_bootmem(void);
26extern void pci_iommu_alloc(void);
27 26
28/* The PCI address space does equal the physical memory 27/* The PCI address space does equal the physical memory
29 * address space. The networking and block device layers use 28 * address space. The networking and block device layers use
diff --git a/arch/x86/pci/pci.h b/arch/x86/include/asm/pci_x86.h
index 15b9cf6be729..e60fd3e14bdf 100644
--- a/arch/x86/pci/pci.h
+++ b/arch/x86/include/asm/pci_x86.h
@@ -57,7 +57,8 @@ extern struct pci_ops pci_root_ops;
57struct irq_info { 57struct irq_info {
58 u8 bus, devfn; /* Bus, device and function */ 58 u8 bus, devfn; /* Bus, device and function */
59 struct { 59 struct {
60 u8 link; /* IRQ line ID, chipset dependent, 0=not routed */ 60 u8 link; /* IRQ line ID, chipset dependent,
61 0 = not routed */
61 u16 bitmap; /* Available IRQs */ 62 u16 bitmap; /* Available IRQs */
62 } __attribute__((packed)) irq[4]; 63 } __attribute__((packed)) irq[4];
63 u8 slot; /* Slot number, 0=onboard */ 64 u8 slot; /* Slot number, 0=onboard */
@@ -69,11 +70,13 @@ struct irq_routing_table {
69 u16 version; /* PIRQ_VERSION */ 70 u16 version; /* PIRQ_VERSION */
70 u16 size; /* Table size in bytes */ 71 u16 size; /* Table size in bytes */
71 u8 rtr_bus, rtr_devfn; /* Where the interrupt router lies */ 72 u8 rtr_bus, rtr_devfn; /* Where the interrupt router lies */
72 u16 exclusive_irqs; /* IRQs devoted exclusively to PCI usage */ 73 u16 exclusive_irqs; /* IRQs devoted exclusively to
73 u16 rtr_vendor, rtr_device; /* Vendor and device ID of interrupt router */ 74 PCI usage */
75 u16 rtr_vendor, rtr_device; /* Vendor and device ID of
76 interrupt router */
74 u32 miniport_data; /* Crap */ 77 u32 miniport_data; /* Crap */
75 u8 rfu[11]; 78 u8 rfu[11];
76 u8 checksum; /* Modulo 256 checksum must give zero */ 79 u8 checksum; /* Modulo 256 checksum must give 0 */
77 struct irq_info slots[0]; 80 struct irq_info slots[0];
78} __attribute__((packed)); 81} __attribute__((packed));
79 82
@@ -96,6 +99,7 @@ extern struct pci_raw_ops *raw_pci_ops;
96extern struct pci_raw_ops *raw_pci_ext_ops; 99extern struct pci_raw_ops *raw_pci_ext_ops;
97 100
98extern struct pci_raw_ops pci_direct_conf1; 101extern struct pci_raw_ops pci_direct_conf1;
102extern bool port_cf9_safe;
99 103
100/* arch_initcall level */ 104/* arch_initcall level */
101extern int pci_direct_probe(void); 105extern int pci_direct_probe(void);
@@ -147,15 +151,15 @@ static inline unsigned int mmio_config_readl(void __iomem *pos)
147 151
148static inline void mmio_config_writeb(void __iomem *pos, u8 val) 152static inline void mmio_config_writeb(void __iomem *pos, u8 val)
149{ 153{
150 asm volatile("movb %%al,(%1)" :: "a" (val), "r" (pos) : "memory"); 154 asm volatile("movb %%al,(%1)" : : "a" (val), "r" (pos) : "memory");
151} 155}
152 156
153static inline void mmio_config_writew(void __iomem *pos, u16 val) 157static inline void mmio_config_writew(void __iomem *pos, u16 val)
154{ 158{
155 asm volatile("movw %%ax,(%1)" :: "a" (val), "r" (pos) : "memory"); 159 asm volatile("movw %%ax,(%1)" : : "a" (val), "r" (pos) : "memory");
156} 160}
157 161
158static inline void mmio_config_writel(void __iomem *pos, u32 val) 162static inline void mmio_config_writel(void __iomem *pos, u32 val)
159{ 163{
160 asm volatile("movl %%eax,(%1)" :: "a" (val), "r" (pos) : "memory"); 164 asm volatile("movl %%eax,(%1)" : : "a" (val), "r" (pos) : "memory");
161} 165}
diff --git a/arch/x86/include/asm/pgtable-2level.h b/arch/x86/include/asm/pgtable-2level.h
index b17edfd23628..e0d199fe1d83 100644
--- a/arch/x86/include/asm/pgtable-2level.h
+++ b/arch/x86/include/asm/pgtable-2level.h
@@ -56,23 +56,55 @@ static inline pte_t native_ptep_get_and_clear(pte_t *xp)
56#define pte_none(x) (!(x).pte_low) 56#define pte_none(x) (!(x).pte_low)
57 57
58/* 58/*
59 * Bits 0, 6 and 7 are taken, split up the 29 bits of offset 59 * Bits _PAGE_BIT_PRESENT, _PAGE_BIT_FILE and _PAGE_BIT_PROTNONE are taken,
60 * into this range: 60 * split up the 29 bits of offset into this range:
61 */ 61 */
62#define PTE_FILE_MAX_BITS 29 62#define PTE_FILE_MAX_BITS 29
63#define PTE_FILE_SHIFT1 (_PAGE_BIT_PRESENT + 1)
64#if _PAGE_BIT_FILE < _PAGE_BIT_PROTNONE
65#define PTE_FILE_SHIFT2 (_PAGE_BIT_FILE + 1)
66#define PTE_FILE_SHIFT3 (_PAGE_BIT_PROTNONE + 1)
67#else
68#define PTE_FILE_SHIFT2 (_PAGE_BIT_PROTNONE + 1)
69#define PTE_FILE_SHIFT3 (_PAGE_BIT_FILE + 1)
70#endif
71#define PTE_FILE_BITS1 (PTE_FILE_SHIFT2 - PTE_FILE_SHIFT1 - 1)
72#define PTE_FILE_BITS2 (PTE_FILE_SHIFT3 - PTE_FILE_SHIFT2 - 1)
63 73
64#define pte_to_pgoff(pte) \ 74#define pte_to_pgoff(pte) \
65 ((((pte).pte_low >> 1) & 0x1f) + (((pte).pte_low >> 8) << 5)) 75 ((((pte).pte_low >> PTE_FILE_SHIFT1) \
76 & ((1U << PTE_FILE_BITS1) - 1)) \
77 + ((((pte).pte_low >> PTE_FILE_SHIFT2) \
78 & ((1U << PTE_FILE_BITS2) - 1)) << PTE_FILE_BITS1) \
79 + (((pte).pte_low >> PTE_FILE_SHIFT3) \
80 << (PTE_FILE_BITS1 + PTE_FILE_BITS2)))
66 81
67#define pgoff_to_pte(off) \ 82#define pgoff_to_pte(off) \
68 ((pte_t) { .pte_low = (((off) & 0x1f) << 1) + \ 83 ((pte_t) { .pte_low = \
69 (((off) >> 5) << 8) + _PAGE_FILE }) 84 (((off) & ((1U << PTE_FILE_BITS1) - 1)) << PTE_FILE_SHIFT1) \
85 + ((((off) >> PTE_FILE_BITS1) & ((1U << PTE_FILE_BITS2) - 1)) \
86 << PTE_FILE_SHIFT2) \
87 + (((off) >> (PTE_FILE_BITS1 + PTE_FILE_BITS2)) \
88 << PTE_FILE_SHIFT3) \
89 + _PAGE_FILE })
70 90
71/* Encode and de-code a swap entry */ 91/* Encode and de-code a swap entry */
72#define __swp_type(x) (((x).val >> 1) & 0x1f) 92#if _PAGE_BIT_FILE < _PAGE_BIT_PROTNONE
73#define __swp_offset(x) ((x).val >> 8) 93#define SWP_TYPE_BITS (_PAGE_BIT_FILE - _PAGE_BIT_PRESENT - 1)
74#define __swp_entry(type, offset) \ 94#define SWP_OFFSET_SHIFT (_PAGE_BIT_PROTNONE + 1)
75 ((swp_entry_t) { ((type) << 1) | ((offset) << 8) }) 95#else
96#define SWP_TYPE_BITS (_PAGE_BIT_PROTNONE - _PAGE_BIT_PRESENT - 1)
97#define SWP_OFFSET_SHIFT (_PAGE_BIT_FILE + 1)
98#endif
99
100#define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > SWP_TYPE_BITS)
101
102#define __swp_type(x) (((x).val >> (_PAGE_BIT_PRESENT + 1)) \
103 & ((1U << SWP_TYPE_BITS) - 1))
104#define __swp_offset(x) ((x).val >> SWP_OFFSET_SHIFT)
105#define __swp_entry(type, offset) ((swp_entry_t) { \
106 ((type) << (_PAGE_BIT_PRESENT + 1)) \
107 | ((offset) << SWP_OFFSET_SHIFT) })
76#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_low }) 108#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_low })
77#define __swp_entry_to_pte(x) ((pte_t) { .pte = (x).val }) 109#define __swp_entry_to_pte(x) ((pte_t) { .pte = (x).val })
78 110
diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h
index 52597aeadfff..447da43cddb3 100644
--- a/arch/x86/include/asm/pgtable-3level.h
+++ b/arch/x86/include/asm/pgtable-3level.h
@@ -166,6 +166,7 @@ static inline int pte_none(pte_t pte)
166#define PTE_FILE_MAX_BITS 32 166#define PTE_FILE_MAX_BITS 32
167 167
168/* Encode and de-code a swap entry */ 168/* Encode and de-code a swap entry */
169#define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > 5)
169#define __swp_type(x) (((x).val) & 0x1f) 170#define __swp_type(x) (((x).val) & 0x1f)
170#define __swp_offset(x) ((x).val >> 5) 171#define __swp_offset(x) ((x).val >> 5)
171#define __swp_entry(type, offset) ((swp_entry_t){(type) | (offset) << 5}) 172#define __swp_entry(type, offset) ((swp_entry_t){(type) | (offset) << 5})
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index c012f3b11671..83e69f4a37f0 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -10,7 +10,6 @@
10#define _PAGE_BIT_PCD 4 /* page cache disabled */ 10#define _PAGE_BIT_PCD 4 /* page cache disabled */
11#define _PAGE_BIT_ACCESSED 5 /* was accessed (raised by CPU) */ 11#define _PAGE_BIT_ACCESSED 5 /* was accessed (raised by CPU) */
12#define _PAGE_BIT_DIRTY 6 /* was written to (raised by CPU) */ 12#define _PAGE_BIT_DIRTY 6 /* was written to (raised by CPU) */
13#define _PAGE_BIT_FILE 6
14#define _PAGE_BIT_PSE 7 /* 4 MB (or 2MB) page */ 13#define _PAGE_BIT_PSE 7 /* 4 MB (or 2MB) page */
15#define _PAGE_BIT_PAT 7 /* on 4KB pages */ 14#define _PAGE_BIT_PAT 7 /* on 4KB pages */
16#define _PAGE_BIT_GLOBAL 8 /* Global TLB entry PPro+ */ 15#define _PAGE_BIT_GLOBAL 8 /* Global TLB entry PPro+ */
@@ -22,6 +21,12 @@
22#define _PAGE_BIT_CPA_TEST _PAGE_BIT_UNUSED1 21#define _PAGE_BIT_CPA_TEST _PAGE_BIT_UNUSED1
23#define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */ 22#define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */
24 23
24/* If _PAGE_BIT_PRESENT is clear, we use these: */
25/* - if the user mapped it with PROT_NONE; pte_present gives true */
26#define _PAGE_BIT_PROTNONE _PAGE_BIT_GLOBAL
27/* - set: nonlinear file mapping, saved PTE; unset:swap */
28#define _PAGE_BIT_FILE _PAGE_BIT_DIRTY
29
25#define _PAGE_PRESENT (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT) 30#define _PAGE_PRESENT (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT)
26#define _PAGE_RW (_AT(pteval_t, 1) << _PAGE_BIT_RW) 31#define _PAGE_RW (_AT(pteval_t, 1) << _PAGE_BIT_RW)
27#define _PAGE_USER (_AT(pteval_t, 1) << _PAGE_BIT_USER) 32#define _PAGE_USER (_AT(pteval_t, 1) << _PAGE_BIT_USER)
@@ -46,11 +51,8 @@
46#define _PAGE_NX (_AT(pteval_t, 0)) 51#define _PAGE_NX (_AT(pteval_t, 0))
47#endif 52#endif
48 53
49/* If _PAGE_PRESENT is clear, we use these: */ 54#define _PAGE_FILE (_AT(pteval_t, 1) << _PAGE_BIT_FILE)
50#define _PAGE_FILE _PAGE_DIRTY /* nonlinear file mapping, 55#define _PAGE_PROTNONE (_AT(pteval_t, 1) << _PAGE_BIT_PROTNONE)
51 * saved PTE; unset:swap */
52#define _PAGE_PROTNONE _PAGE_PSE /* if the user mapped it with PROT_NONE;
53 pte_present gives true */
54 56
55#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \ 57#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \
56 _PAGE_ACCESSED | _PAGE_DIRTY) 58 _PAGE_ACCESSED | _PAGE_DIRTY)
@@ -158,8 +160,19 @@
158#define PGD_IDENT_ATTR 0x001 /* PRESENT (no other attributes) */ 160#define PGD_IDENT_ATTR 0x001 /* PRESENT (no other attributes) */
159#endif 161#endif
160 162
163/*
164 * Macro to mark a page protection value as UC-
165 */
166#define pgprot_noncached(prot) \
167 ((boot_cpu_data.x86 > 3) \
168 ? (__pgprot(pgprot_val(prot) | _PAGE_CACHE_UC_MINUS)) \
169 : (prot))
170
161#ifndef __ASSEMBLY__ 171#ifndef __ASSEMBLY__
162 172
173#define pgprot_writecombine pgprot_writecombine
174extern pgprot_t pgprot_writecombine(pgprot_t prot);
175
163/* 176/*
164 * ZERO_PAGE is a global shared page that is always zero: used 177 * ZERO_PAGE is a global shared page that is always zero: used
165 * for zero-mapped memory areas etc.. 178 * for zero-mapped memory areas etc..
@@ -329,6 +342,9 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
329#define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask) 342#define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask)
330 343
331#ifndef __ASSEMBLY__ 344#ifndef __ASSEMBLY__
345/* Indicate that x86 has its own track and untrack pfn vma functions */
346#define __HAVE_PFNMAP_TRACKING
347
332#define __HAVE_PHYS_MEM_ACCESS_PROT 348#define __HAVE_PHYS_MEM_ACCESS_PROT
333struct file; 349struct file;
334pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, 350pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h
index f9d5889b336b..72b020deb46b 100644
--- a/arch/x86/include/asm/pgtable_32.h
+++ b/arch/x86/include/asm/pgtable_32.h
@@ -101,15 +101,6 @@ extern unsigned long pg0[];
101#endif 101#endif
102 102
103/* 103/*
104 * Macro to mark a page protection value as "uncacheable".
105 * On processors which do not support it, this is a no-op.
106 */
107#define pgprot_noncached(prot) \
108 ((boot_cpu_data.x86 > 3) \
109 ? (__pgprot(pgprot_val(prot) | _PAGE_PCD | _PAGE_PWT)) \
110 : (prot))
111
112/*
113 * Conversion functions: convert a page and protection to a page entry, 104 * Conversion functions: convert a page and protection to a page entry,
114 * and a page entry and page directory to the page they refer to. 105 * and a page entry and page directory to the page they refer to.
115 */ 106 */
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
index 545a0e042bb2..ba09289accaa 100644
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -146,7 +146,7 @@ static inline void native_pgd_clear(pgd_t *pgd)
146#define PGDIR_MASK (~(PGDIR_SIZE - 1)) 146#define PGDIR_MASK (~(PGDIR_SIZE - 1))
147 147
148 148
149#define MAXMEM _AC(0x00003fffffffffff, UL) 149#define MAXMEM _AC(__AC(1, UL) << MAX_PHYSMEM_BITS, UL)
150#define VMALLOC_START _AC(0xffffc20000000000, UL) 150#define VMALLOC_START _AC(0xffffc20000000000, UL)
151#define VMALLOC_END _AC(0xffffe1ffffffffff, UL) 151#define VMALLOC_END _AC(0xffffe1ffffffffff, UL)
152#define VMEMMAP_START _AC(0xffffe20000000000, UL) 152#define VMEMMAP_START _AC(0xffffe20000000000, UL)
@@ -177,12 +177,6 @@ static inline int pmd_bad(pmd_t pmd)
177#define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT)) /* FIXME: is this right? */ 177#define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT)) /* FIXME: is this right? */
178 178
179/* 179/*
180 * Macro to mark a page protection value as "uncacheable".
181 */
182#define pgprot_noncached(prot) \
183 (__pgprot(pgprot_val((prot)) | _PAGE_PCD | _PAGE_PWT))
184
185/*
186 * Conversion functions: convert a page and protection to a page entry, 180 * Conversion functions: convert a page and protection to a page entry,
187 * and a page entry and page directory to the page they refer to. 181 * and a page entry and page directory to the page they refer to.
188 */ 182 */
@@ -250,10 +244,22 @@ static inline int pud_large(pud_t pte)
250extern int direct_gbpages; 244extern int direct_gbpages;
251 245
252/* Encode and de-code a swap entry */ 246/* Encode and de-code a swap entry */
253#define __swp_type(x) (((x).val >> 1) & 0x3f) 247#if _PAGE_BIT_FILE < _PAGE_BIT_PROTNONE
254#define __swp_offset(x) ((x).val >> 8) 248#define SWP_TYPE_BITS (_PAGE_BIT_FILE - _PAGE_BIT_PRESENT - 1)
255#define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 1) | \ 249#define SWP_OFFSET_SHIFT (_PAGE_BIT_PROTNONE + 1)
256 ((offset) << 8) }) 250#else
251#define SWP_TYPE_BITS (_PAGE_BIT_PROTNONE - _PAGE_BIT_PRESENT - 1)
252#define SWP_OFFSET_SHIFT (_PAGE_BIT_FILE + 1)
253#endif
254
255#define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > SWP_TYPE_BITS)
256
257#define __swp_type(x) (((x).val >> (_PAGE_BIT_PRESENT + 1)) \
258 & ((1U << SWP_TYPE_BITS) - 1))
259#define __swp_offset(x) ((x).val >> SWP_OFFSET_SHIFT)
260#define __swp_entry(type, offset) ((swp_entry_t) { \
261 ((type) << (_PAGE_BIT_PRESENT + 1)) \
262 | ((offset) << SWP_OFFSET_SHIFT) })
257#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val((pte)) }) 263#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val((pte)) })
258#define __swp_entry_to_pte(x) ((pte_t) { .pte = (x).val }) 264#define __swp_entry_to_pte(x) ((pte_t) { .pte = (x).val })
259 265
diff --git a/arch/x86/include/asm/prctl.h b/arch/x86/include/asm/prctl.h
index fe681147a4f7..a8894647dd9a 100644
--- a/arch/x86/include/asm/prctl.h
+++ b/arch/x86/include/asm/prctl.h
@@ -6,5 +6,8 @@
6#define ARCH_GET_FS 0x1003 6#define ARCH_GET_FS 0x1003
7#define ARCH_GET_GS 0x1004 7#define ARCH_GET_GS 0x1004
8 8
9#ifdef CONFIG_X86_64
10extern long sys_arch_prctl(int, unsigned long);
11#endif /* CONFIG_X86_64 */
9 12
10#endif /* _ASM_X86_PRCTL_H */ 13#endif /* _ASM_X86_PRCTL_H */
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 5ca01e383269..091cd8855f2e 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -110,6 +110,7 @@ struct cpuinfo_x86 {
110 /* Index into per_cpu list: */ 110 /* Index into per_cpu list: */
111 u16 cpu_index; 111 u16 cpu_index;
112#endif 112#endif
113 unsigned int x86_hyper_vendor;
113} __attribute__((__aligned__(SMP_CACHE_BYTES))); 114} __attribute__((__aligned__(SMP_CACHE_BYTES)));
114 115
115#define X86_VENDOR_INTEL 0 116#define X86_VENDOR_INTEL 0
@@ -123,6 +124,9 @@ struct cpuinfo_x86 {
123 124
124#define X86_VENDOR_UNKNOWN 0xff 125#define X86_VENDOR_UNKNOWN 0xff
125 126
127#define X86_HYPER_VENDOR_NONE 0
128#define X86_HYPER_VENDOR_VMWARE 1
129
126/* 130/*
127 * capabilities of CPUs 131 * capabilities of CPUs
128 */ 132 */
@@ -752,6 +756,19 @@ extern void switch_to_new_gdt(void);
752extern void cpu_init(void); 756extern void cpu_init(void);
753extern void init_gdt(int cpu); 757extern void init_gdt(int cpu);
754 758
759static inline unsigned long get_debugctlmsr(void)
760{
761 unsigned long debugctlmsr = 0;
762
763#ifndef CONFIG_X86_DEBUGCTLMSR
764 if (boot_cpu_data.x86 < 6)
765 return 0;
766#endif
767 rdmsrl(MSR_IA32_DEBUGCTLMSR, debugctlmsr);
768
769 return debugctlmsr;
770}
771
755static inline void update_debugctlmsr(unsigned long debugctlmsr) 772static inline void update_debugctlmsr(unsigned long debugctlmsr)
756{ 773{
757#ifndef CONFIG_X86_DEBUGCTLMSR 774#ifndef CONFIG_X86_DEBUGCTLMSR
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index eefb0594b058..6d34d954c228 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -6,7 +6,6 @@
6#include <asm/processor-flags.h> 6#include <asm/processor-flags.h>
7 7
8#ifdef __KERNEL__ 8#ifdef __KERNEL__
9#include <asm/ds.h> /* the DS BTS struct is used for ptrace too */
10#include <asm/segment.h> 9#include <asm/segment.h>
11#endif 10#endif
12 11
@@ -128,34 +127,6 @@ struct pt_regs {
128#endif /* !__i386__ */ 127#endif /* !__i386__ */
129 128
130 129
131#ifdef CONFIG_X86_PTRACE_BTS
132/* a branch trace record entry
133 *
134 * In order to unify the interface between various processor versions,
135 * we use the below data structure for all processors.
136 */
137enum bts_qualifier {
138 BTS_INVALID = 0,
139 BTS_BRANCH,
140 BTS_TASK_ARRIVES,
141 BTS_TASK_DEPARTS
142};
143
144struct bts_struct {
145 __u64 qualifier;
146 union {
147 /* BTS_BRANCH */
148 struct {
149 __u64 from_ip;
150 __u64 to_ip;
151 } lbr;
152 /* BTS_TASK_ARRIVES or
153 BTS_TASK_DEPARTS */
154 __u64 jiffies;
155 } variant;
156};
157#endif /* CONFIG_X86_PTRACE_BTS */
158
159#ifdef __KERNEL__ 130#ifdef __KERNEL__
160 131
161#include <linux/init.h> 132#include <linux/init.h>
@@ -163,13 +134,6 @@ struct bts_struct {
163struct cpuinfo_x86; 134struct cpuinfo_x86;
164struct task_struct; 135struct task_struct;
165 136
166#ifdef CONFIG_X86_PTRACE_BTS
167extern void __cpuinit ptrace_bts_init_intel(struct cpuinfo_x86 *);
168extern void ptrace_bts_take_timestamp(struct task_struct *, enum bts_qualifier);
169#else
170#define ptrace_bts_init_intel(config) do {} while (0)
171#endif /* CONFIG_X86_PTRACE_BTS */
172
173extern unsigned long profile_pc(struct pt_regs *regs); 137extern unsigned long profile_pc(struct pt_regs *regs);
174 138
175extern unsigned long 139extern unsigned long
@@ -271,6 +235,13 @@ extern int do_get_thread_area(struct task_struct *p, int idx,
271extern int do_set_thread_area(struct task_struct *p, int idx, 235extern int do_set_thread_area(struct task_struct *p, int idx,
272 struct user_desc __user *info, int can_allocate); 236 struct user_desc __user *info, int can_allocate);
273 237
238extern void x86_ptrace_untrace(struct task_struct *);
239extern void x86_ptrace_fork(struct task_struct *child,
240 unsigned long clone_flags);
241
242#define arch_ptrace_untrace(tsk) x86_ptrace_untrace(tsk)
243#define arch_ptrace_fork(child, flags) x86_ptrace_fork(child, flags)
244
274#endif /* __KERNEL__ */ 245#endif /* __KERNEL__ */
275 246
276#endif /* !__ASSEMBLY__ */ 247#endif /* !__ASSEMBLY__ */
diff --git a/arch/x86/include/asm/reboot.h b/arch/x86/include/asm/reboot.h
index df7710354f85..562d4fd31ba8 100644
--- a/arch/x86/include/asm/reboot.h
+++ b/arch/x86/include/asm/reboot.h
@@ -1,6 +1,8 @@
1#ifndef _ASM_X86_REBOOT_H 1#ifndef _ASM_X86_REBOOT_H
2#define _ASM_X86_REBOOT_H 2#define _ASM_X86_REBOOT_H
3 3
4#include <linux/kdebug.h>
5
4struct pt_regs; 6struct pt_regs;
5 7
6struct machine_ops { 8struct machine_ops {
@@ -18,4 +20,7 @@ void native_machine_crash_shutdown(struct pt_regs *regs);
18void native_machine_shutdown(void); 20void native_machine_shutdown(void);
19void machine_real_restart(const unsigned char *code, int length); 21void machine_real_restart(const unsigned char *code, int length);
20 22
23typedef void (*nmi_shootdown_cb)(int, struct die_args*);
24void nmi_shootdown_cpus(nmi_shootdown_cb callback);
25
21#endif /* _ASM_X86_REBOOT_H */ 26#endif /* _ASM_X86_REBOOT_H */
diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index f12d37237465..4fcd53fd5f43 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -8,6 +8,10 @@
8/* Interrupt control for vSMPowered x86_64 systems */ 8/* Interrupt control for vSMPowered x86_64 systems */
9void vsmp_init(void); 9void vsmp_init(void);
10 10
11
12void setup_bios_corruption_check(void);
13
14
11#ifdef CONFIG_X86_VISWS 15#ifdef CONFIG_X86_VISWS
12extern void visws_early_detect(void); 16extern void visws_early_detect(void);
13extern int is_visws_box(void); 17extern int is_visws_box(void);
@@ -16,6 +20,8 @@ static inline void visws_early_detect(void) { }
16static inline int is_visws_box(void) { return 0; } 20static inline int is_visws_box(void) { return 0; }
17#endif 21#endif
18 22
23extern int wakeup_secondary_cpu_via_nmi(int apicid, unsigned long start_eip);
24extern int wakeup_secondary_cpu_via_init(int apicid, unsigned long start_eip);
19/* 25/*
20 * Any setup quirks to be performed? 26 * Any setup quirks to be performed?
21 */ 27 */
@@ -39,6 +45,7 @@ struct x86_quirks {
39 void (*smp_read_mpc_oem)(struct mp_config_oemtable *oemtable, 45 void (*smp_read_mpc_oem)(struct mp_config_oemtable *oemtable,
40 unsigned short oemsize); 46 unsigned short oemsize);
41 int (*setup_ioapic_ids)(void); 47 int (*setup_ioapic_ids)(void);
48 int (*update_genapic)(void);
42}; 49};
43 50
44extern struct x86_quirks *x86_quirks; 51extern struct x86_quirks *x86_quirks;
diff --git a/arch/x86/include/asm/sigframe.h b/arch/x86/include/asm/sigframe.h
new file mode 100644
index 000000000000..4e0fe26d27d3
--- /dev/null
+++ b/arch/x86/include/asm/sigframe.h
@@ -0,0 +1,70 @@
1#ifndef _ASM_X86_SIGFRAME_H
2#define _ASM_X86_SIGFRAME_H
3
4#include <asm/sigcontext.h>
5#include <asm/siginfo.h>
6#include <asm/ucontext.h>
7
8#ifdef CONFIG_X86_32
9#define sigframe_ia32 sigframe
10#define rt_sigframe_ia32 rt_sigframe
11#define sigcontext_ia32 sigcontext
12#define _fpstate_ia32 _fpstate
13#define ucontext_ia32 ucontext
14#else /* !CONFIG_X86_32 */
15
16#ifdef CONFIG_IA32_EMULATION
17#include <asm/ia32.h>
18#endif /* CONFIG_IA32_EMULATION */
19
20#endif /* CONFIG_X86_32 */
21
22#if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)
23struct sigframe_ia32 {
24 u32 pretcode;
25 int sig;
26 struct sigcontext_ia32 sc;
27 /*
28 * fpstate is unused. fpstate is moved/allocated after
29 * retcode[] below. This movement allows to have the FP state and the
30 * future state extensions (xsave) stay together.
31 * And at the same time retaining the unused fpstate, prevents changing
32 * the offset of extramask[] in the sigframe and thus prevent any
33 * legacy application accessing/modifying it.
34 */
35 struct _fpstate_ia32 fpstate_unused;
36#ifdef CONFIG_IA32_EMULATION
37 unsigned int extramask[_COMPAT_NSIG_WORDS-1];
38#else /* !CONFIG_IA32_EMULATION */
39 unsigned long extramask[_NSIG_WORDS-1];
40#endif /* CONFIG_IA32_EMULATION */
41 char retcode[8];
42 /* fp state follows here */
43};
44
45struct rt_sigframe_ia32 {
46 u32 pretcode;
47 int sig;
48 u32 pinfo;
49 u32 puc;
50#ifdef CONFIG_IA32_EMULATION
51 compat_siginfo_t info;
52#else /* !CONFIG_IA32_EMULATION */
53 struct siginfo info;
54#endif /* CONFIG_IA32_EMULATION */
55 struct ucontext_ia32 uc;
56 char retcode[8];
57 /* fp state follows here */
58};
59#endif /* defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION) */
60
61#ifdef CONFIG_X86_64
62struct rt_sigframe {
63 char __user *pretcode;
64 struct ucontext uc;
65 struct siginfo info;
66 /* fp state follows here */
67};
68#endif /* CONFIG_X86_64 */
69
70#endif /* _ASM_X86_SIGFRAME_H */
diff --git a/arch/x86/include/asm/signal.h b/arch/x86/include/asm/signal.h
index 96ac44f275da..7761a5d554bb 100644
--- a/arch/x86/include/asm/signal.h
+++ b/arch/x86/include/asm/signal.h
@@ -121,6 +121,10 @@ typedef unsigned long sigset_t;
121 121
122#ifndef __ASSEMBLY__ 122#ifndef __ASSEMBLY__
123 123
124# ifdef __KERNEL__
125extern void do_notify_resume(struct pt_regs *, void *, __u32);
126# endif /* __KERNEL__ */
127
124#ifdef __i386__ 128#ifdef __i386__
125# ifdef __KERNEL__ 129# ifdef __KERNEL__
126struct old_sigaction { 130struct old_sigaction {
@@ -141,8 +145,6 @@ struct k_sigaction {
141 struct sigaction sa; 145 struct sigaction sa;
142}; 146};
143 147
144extern void do_notify_resume(struct pt_regs *, void *, __u32);
145
146# else /* __KERNEL__ */ 148# else /* __KERNEL__ */
147/* Here we must cater to libcs that poke about in kernel headers. */ 149/* Here we must cater to libcs that poke about in kernel headers. */
148 150
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index d12811ce51d9..830b9fcb6427 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -60,7 +60,7 @@ struct smp_ops {
60 void (*cpu_die)(unsigned int cpu); 60 void (*cpu_die)(unsigned int cpu);
61 void (*play_dead)(void); 61 void (*play_dead)(void);
62 62
63 void (*send_call_func_ipi)(cpumask_t mask); 63 void (*send_call_func_ipi)(const struct cpumask *mask);
64 void (*send_call_func_single_ipi)(int cpu); 64 void (*send_call_func_single_ipi)(int cpu);
65}; 65};
66 66
@@ -125,7 +125,7 @@ static inline void arch_send_call_function_single_ipi(int cpu)
125 125
126static inline void arch_send_call_function_ipi(cpumask_t mask) 126static inline void arch_send_call_function_ipi(cpumask_t mask)
127{ 127{
128 smp_ops.send_call_func_ipi(mask); 128 smp_ops.send_call_func_ipi(&mask);
129} 129}
130 130
131void cpu_disable_common(void); 131void cpu_disable_common(void);
@@ -138,7 +138,7 @@ void native_cpu_die(unsigned int cpu);
138void native_play_dead(void); 138void native_play_dead(void);
139void play_dead_common(void); 139void play_dead_common(void);
140 140
141void native_send_call_func_ipi(cpumask_t mask); 141void native_send_call_func_ipi(const struct cpumask *mask);
142void native_send_call_func_single_ipi(int cpu); 142void native_send_call_func_single_ipi(int cpu);
143 143
144extern void prefill_possible_map(void); 144extern void prefill_possible_map(void);
diff --git a/arch/x86/include/asm/sparsemem.h b/arch/x86/include/asm/sparsemem.h
index be44f7dab395..e3cc3c063ec5 100644
--- a/arch/x86/include/asm/sparsemem.h
+++ b/arch/x86/include/asm/sparsemem.h
@@ -27,7 +27,7 @@
27#else /* CONFIG_X86_32 */ 27#else /* CONFIG_X86_32 */
28# define SECTION_SIZE_BITS 27 /* matt - 128 is convenient right now */ 28# define SECTION_SIZE_BITS 27 /* matt - 128 is convenient right now */
29# define MAX_PHYSADDR_BITS 44 29# define MAX_PHYSADDR_BITS 44
30# define MAX_PHYSMEM_BITS 44 30# define MAX_PHYSMEM_BITS 44 /* Can be max 45 bits */
31#endif 31#endif
32 32
33#endif /* CONFIG_SPARSEMEM */ 33#endif /* CONFIG_SPARSEMEM */
diff --git a/arch/x86/include/asm/summit/apic.h b/arch/x86/include/asm/summit/apic.h
index 9b3070f1c2ac..4bb5fb34f030 100644
--- a/arch/x86/include/asm/summit/apic.h
+++ b/arch/x86/include/asm/summit/apic.h
@@ -14,13 +14,13 @@
14 14
15#define APIC_DFR_VALUE (APIC_DFR_CLUSTER) 15#define APIC_DFR_VALUE (APIC_DFR_CLUSTER)
16 16
17static inline cpumask_t target_cpus(void) 17static inline const cpumask_t *target_cpus(void)
18{ 18{
19 /* CPU_MASK_ALL (0xff) has undefined behaviour with 19 /* CPU_MASK_ALL (0xff) has undefined behaviour with
20 * dest_LowestPrio mode logical clustered apic interrupt routing 20 * dest_LowestPrio mode logical clustered apic interrupt routing
21 * Just start on cpu 0. IRQ balancing will spread load 21 * Just start on cpu 0. IRQ balancing will spread load
22 */ 22 */
23 return cpumask_of_cpu(0); 23 return &cpumask_of_cpu(0);
24} 24}
25 25
26#define INT_DELIVERY_MODE (dest_LowestPrio) 26#define INT_DELIVERY_MODE (dest_LowestPrio)
@@ -52,7 +52,7 @@ static inline void init_apic_ldr(void)
52 int i; 52 int i;
53 53
54 /* Create logical APIC IDs by counting CPUs already in cluster. */ 54 /* Create logical APIC IDs by counting CPUs already in cluster. */
55 for (count = 0, i = NR_CPUS; --i >= 0; ) { 55 for (count = 0, i = nr_cpu_ids; --i >= 0; ) {
56 lid = cpu_2_logical_apicid[i]; 56 lid = cpu_2_logical_apicid[i];
57 if (lid != BAD_APICID && apicid_cluster(lid) == my_cluster) 57 if (lid != BAD_APICID && apicid_cluster(lid) == my_cluster)
58 ++count; 58 ++count;
@@ -97,8 +97,8 @@ static inline int apicid_to_node(int logical_apicid)
97static inline int cpu_to_logical_apicid(int cpu) 97static inline int cpu_to_logical_apicid(int cpu)
98{ 98{
99#ifdef CONFIG_SMP 99#ifdef CONFIG_SMP
100 if (cpu >= NR_CPUS) 100 if (cpu >= nr_cpu_ids)
101 return BAD_APICID; 101 return BAD_APICID;
102 return (int)cpu_2_logical_apicid[cpu]; 102 return (int)cpu_2_logical_apicid[cpu];
103#else 103#else
104 return logical_smp_processor_id(); 104 return logical_smp_processor_id();
@@ -107,7 +107,7 @@ static inline int cpu_to_logical_apicid(int cpu)
107 107
108static inline int cpu_present_to_apicid(int mps_cpu) 108static inline int cpu_present_to_apicid(int mps_cpu)
109{ 109{
110 if (mps_cpu < NR_CPUS) 110 if (mps_cpu < nr_cpu_ids)
111 return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); 111 return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu);
112 else 112 else
113 return BAD_APICID; 113 return BAD_APICID;
@@ -137,25 +137,25 @@ static inline void enable_apic_mode(void)
137{ 137{
138} 138}
139 139
140static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask) 140static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
141{ 141{
142 int num_bits_set; 142 int num_bits_set;
143 int cpus_found = 0; 143 int cpus_found = 0;
144 int cpu; 144 int cpu;
145 int apicid; 145 int apicid;
146 146
147 num_bits_set = cpus_weight(cpumask); 147 num_bits_set = cpus_weight(*cpumask);
148 /* Return id to all */ 148 /* Return id to all */
149 if (num_bits_set == NR_CPUS) 149 if (num_bits_set >= nr_cpu_ids)
150 return (int) 0xFF; 150 return (int) 0xFF;
151 /* 151 /*
152 * The cpus in the mask must all be on the apic cluster. If are not 152 * The cpus in the mask must all be on the apic cluster. If are not
153 * on the same apicid cluster return default value of TARGET_CPUS. 153 * on the same apicid cluster return default value of TARGET_CPUS.
154 */ 154 */
155 cpu = first_cpu(cpumask); 155 cpu = first_cpu(*cpumask);
156 apicid = cpu_to_logical_apicid(cpu); 156 apicid = cpu_to_logical_apicid(cpu);
157 while (cpus_found < num_bits_set) { 157 while (cpus_found < num_bits_set) {
158 if (cpu_isset(cpu, cpumask)) { 158 if (cpu_isset(cpu, *cpumask)) {
159 int new_apicid = cpu_to_logical_apicid(cpu); 159 int new_apicid = cpu_to_logical_apicid(cpu);
160 if (apicid_cluster(apicid) != 160 if (apicid_cluster(apicid) !=
161 apicid_cluster(new_apicid)){ 161 apicid_cluster(new_apicid)){
@@ -170,6 +170,23 @@ static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
170 return apicid; 170 return apicid;
171} 171}
172 172
173static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
174 const struct cpumask *andmask)
175{
176 int apicid = cpu_to_logical_apicid(0);
177 cpumask_var_t cpumask;
178
179 if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC))
180 return apicid;
181
182 cpumask_and(cpumask, inmask, andmask);
183 cpumask_and(cpumask, cpumask, cpu_online_mask);
184 apicid = cpu_mask_to_apicid(cpumask);
185
186 free_cpumask_var(cpumask);
187 return apicid;
188}
189
173/* cpuid returns the value latched in the HW at reset, not the APIC ID 190/* cpuid returns the value latched in the HW at reset, not the APIC ID
174 * register's value. For any box whose BIOS changes APIC IDs, like 191 * register's value. For any box whose BIOS changes APIC IDs, like
175 * clustered APIC systems, we must use hard_smp_processor_id. 192 * clustered APIC systems, we must use hard_smp_processor_id.
diff --git a/arch/x86/include/asm/summit/ipi.h b/arch/x86/include/asm/summit/ipi.h
index 53bd1e7bd7b4..a8a2c24f50cc 100644
--- a/arch/x86/include/asm/summit/ipi.h
+++ b/arch/x86/include/asm/summit/ipi.h
@@ -1,9 +1,10 @@
1#ifndef __ASM_SUMMIT_IPI_H 1#ifndef __ASM_SUMMIT_IPI_H
2#define __ASM_SUMMIT_IPI_H 2#define __ASM_SUMMIT_IPI_H
3 3
4void send_IPI_mask_sequence(cpumask_t mask, int vector); 4void send_IPI_mask_sequence(const cpumask_t *mask, int vector);
5void send_IPI_mask_allbutself(const cpumask_t *mask, int vector);
5 6
6static inline void send_IPI_mask(cpumask_t mask, int vector) 7static inline void send_IPI_mask(const cpumask_t *mask, int vector)
7{ 8{
8 send_IPI_mask_sequence(mask, vector); 9 send_IPI_mask_sequence(mask, vector);
9} 10}
@@ -14,12 +15,12 @@ static inline void send_IPI_allbutself(int vector)
14 cpu_clear(smp_processor_id(), mask); 15 cpu_clear(smp_processor_id(), mask);
15 16
16 if (!cpus_empty(mask)) 17 if (!cpus_empty(mask))
17 send_IPI_mask(mask, vector); 18 send_IPI_mask(&mask, vector);
18} 19}
19 20
20static inline void send_IPI_all(int vector) 21static inline void send_IPI_all(int vector)
21{ 22{
22 send_IPI_mask(cpu_online_map, vector); 23 send_IPI_mask(&cpu_online_map, vector);
23} 24}
24 25
25#endif /* __ASM_SUMMIT_IPI_H */ 26#endif /* __ASM_SUMMIT_IPI_H */
diff --git a/arch/x86/kvm/svm.h b/arch/x86/include/asm/svm.h
index 1b8afa78e869..1b8afa78e869 100644
--- a/arch/x86/kvm/svm.h
+++ b/arch/x86/include/asm/svm.h
diff --git a/arch/x86/include/asm/swiotlb.h b/arch/x86/include/asm/swiotlb.h
index 51fb2c76ad74..b9e4e20174fb 100644
--- a/arch/x86/include/asm/swiotlb.h
+++ b/arch/x86/include/asm/swiotlb.h
@@ -1,46 +1,10 @@
1#ifndef _ASM_X86_SWIOTLB_H 1#ifndef _ASM_X86_SWIOTLB_H
2#define _ASM_X86_SWIOTLB_H 2#define _ASM_X86_SWIOTLB_H
3 3
4#include <asm/dma-mapping.h> 4#include <linux/swiotlb.h>
5 5
6/* SWIOTLB interface */ 6/* SWIOTLB interface */
7 7
8extern dma_addr_t swiotlb_map_single(struct device *hwdev, void *ptr,
9 size_t size, int dir);
10extern void *swiotlb_alloc_coherent(struct device *hwdev, size_t size,
11 dma_addr_t *dma_handle, gfp_t flags);
12extern void swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr,
13 size_t size, int dir);
14extern void swiotlb_sync_single_for_cpu(struct device *hwdev,
15 dma_addr_t dev_addr,
16 size_t size, int dir);
17extern void swiotlb_sync_single_for_device(struct device *hwdev,
18 dma_addr_t dev_addr,
19 size_t size, int dir);
20extern void swiotlb_sync_single_range_for_cpu(struct device *hwdev,
21 dma_addr_t dev_addr,
22 unsigned long offset,
23 size_t size, int dir);
24extern void swiotlb_sync_single_range_for_device(struct device *hwdev,
25 dma_addr_t dev_addr,
26 unsigned long offset,
27 size_t size, int dir);
28extern void swiotlb_sync_sg_for_cpu(struct device *hwdev,
29 struct scatterlist *sg, int nelems,
30 int dir);
31extern void swiotlb_sync_sg_for_device(struct device *hwdev,
32 struct scatterlist *sg, int nelems,
33 int dir);
34extern int swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg,
35 int nents, int direction);
36extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg,
37 int nents, int direction);
38extern int swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
39extern void swiotlb_free_coherent(struct device *hwdev, size_t size,
40 void *vaddr, dma_addr_t dma_handle);
41extern int swiotlb_dma_supported(struct device *hwdev, u64 mask);
42extern void swiotlb_init(void);
43
44extern int swiotlb_force; 8extern int swiotlb_force;
45 9
46#ifdef CONFIG_SWIOTLB 10#ifdef CONFIG_SWIOTLB
diff --git a/arch/x86/include/asm/sys_ia32.h b/arch/x86/include/asm/sys_ia32.h
new file mode 100644
index 000000000000..ffb08be2a530
--- /dev/null
+++ b/arch/x86/include/asm/sys_ia32.h
@@ -0,0 +1,101 @@
1/*
2 * sys_ia32.h - Linux ia32 syscall interfaces
3 *
4 * Copyright (c) 2008 Jaswinder Singh Rajput
5 *
6 * This file is released under the GPLv2.
7 * See the file COPYING for more details.
8 */
9
10#ifndef _ASM_X86_SYS_IA32_H
11#define _ASM_X86_SYS_IA32_H
12
13#include <linux/compiler.h>
14#include <linux/linkage.h>
15#include <linux/types.h>
16#include <linux/signal.h>
17#include <asm/compat.h>
18#include <asm/ia32.h>
19
20/* ia32/sys_ia32.c */
21asmlinkage long sys32_truncate64(char __user *, unsigned long, unsigned long);
22asmlinkage long sys32_ftruncate64(unsigned int, unsigned long, unsigned long);
23
24asmlinkage long sys32_stat64(char __user *, struct stat64 __user *);
25asmlinkage long sys32_lstat64(char __user *, struct stat64 __user *);
26asmlinkage long sys32_fstat64(unsigned int, struct stat64 __user *);
27asmlinkage long sys32_fstatat(unsigned int, char __user *,
28 struct stat64 __user *, int);
29struct mmap_arg_struct;
30asmlinkage long sys32_mmap(struct mmap_arg_struct __user *);
31asmlinkage long sys32_mprotect(unsigned long, size_t, unsigned long);
32
33asmlinkage long sys32_pipe(int __user *);
34struct sigaction32;
35struct old_sigaction32;
36asmlinkage long sys32_rt_sigaction(int, struct sigaction32 __user *,
37 struct sigaction32 __user *, unsigned int);
38asmlinkage long sys32_sigaction(int, struct old_sigaction32 __user *,
39 struct old_sigaction32 __user *);
40asmlinkage long sys32_rt_sigprocmask(int, compat_sigset_t __user *,
41 compat_sigset_t __user *, unsigned int);
42asmlinkage long sys32_alarm(unsigned int);
43
44struct sel_arg_struct;
45asmlinkage long sys32_old_select(struct sel_arg_struct __user *);
46asmlinkage long sys32_waitpid(compat_pid_t, unsigned int *, int);
47asmlinkage long sys32_sysfs(int, u32, u32);
48
49asmlinkage long sys32_sched_rr_get_interval(compat_pid_t,
50 struct compat_timespec __user *);
51asmlinkage long sys32_rt_sigpending(compat_sigset_t __user *, compat_size_t);
52asmlinkage long sys32_rt_sigqueueinfo(int, int, compat_siginfo_t __user *);
53
54#ifdef CONFIG_SYSCTL_SYSCALL
55struct sysctl_ia32;
56asmlinkage long sys32_sysctl(struct sysctl_ia32 __user *);
57#endif
58
59asmlinkage long sys32_pread(unsigned int, char __user *, u32, u32, u32);
60asmlinkage long sys32_pwrite(unsigned int, char __user *, u32, u32, u32);
61
62asmlinkage long sys32_personality(unsigned long);
63asmlinkage long sys32_sendfile(int, int, compat_off_t __user *, s32);
64
65asmlinkage long sys32_mmap2(unsigned long, unsigned long, unsigned long,
66 unsigned long, unsigned long, unsigned long);
67
68struct oldold_utsname;
69struct old_utsname;
70asmlinkage long sys32_olduname(struct oldold_utsname __user *);
71long sys32_uname(struct old_utsname __user *);
72
73long sys32_ustat(unsigned, struct ustat32 __user *);
74
75asmlinkage long sys32_execve(char __user *, compat_uptr_t __user *,
76 compat_uptr_t __user *, struct pt_regs *);
77asmlinkage long sys32_clone(unsigned int, unsigned int, struct pt_regs *);
78
79long sys32_lseek(unsigned int, int, unsigned int);
80long sys32_kill(int, int);
81long sys32_fadvise64_64(int, __u32, __u32, __u32, __u32, int);
82long sys32_vm86_warning(void);
83long sys32_lookup_dcookie(u32, u32, char __user *, size_t);
84
85asmlinkage ssize_t sys32_readahead(int, unsigned, unsigned, size_t);
86asmlinkage long sys32_sync_file_range(int, unsigned, unsigned,
87 unsigned, unsigned, int);
88asmlinkage long sys32_fadvise64(int, unsigned, unsigned, size_t, int);
89asmlinkage long sys32_fallocate(int, int, unsigned,
90 unsigned, unsigned, unsigned);
91
92/* ia32/ia32_signal.c */
93asmlinkage long sys32_sigsuspend(int, int, old_sigset_t);
94asmlinkage long sys32_sigaltstack(const stack_ia32_t __user *,
95 stack_ia32_t __user *, struct pt_regs *);
96asmlinkage long sys32_sigreturn(struct pt_regs *);
97asmlinkage long sys32_rt_sigreturn(struct pt_regs *);
98
99/* ia32/ipc32.c */
100asmlinkage long sys32_ipc(u32, int, int, int, compat_uptr_t, u32);
101#endif /* _ASM_X86_SYS_IA32_H */
diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h
index 87803da44010..9c6797c3e56c 100644
--- a/arch/x86/include/asm/syscalls.h
+++ b/arch/x86/include/asm/syscalls.h
@@ -19,6 +19,13 @@
19/* kernel/ioport.c */ 19/* kernel/ioport.c */
20asmlinkage long sys_ioperm(unsigned long, unsigned long, int); 20asmlinkage long sys_ioperm(unsigned long, unsigned long, int);
21 21
22/* kernel/ldt.c */
23asmlinkage int sys_modify_ldt(int, void __user *, unsigned long);
24
25/* kernel/tls.c */
26asmlinkage int sys_set_thread_area(struct user_desc __user *);
27asmlinkage int sys_get_thread_area(struct user_desc __user *);
28
22/* X86_32 only */ 29/* X86_32 only */
23#ifdef CONFIG_X86_32 30#ifdef CONFIG_X86_32
24/* kernel/process_32.c */ 31/* kernel/process_32.c */
@@ -33,14 +40,11 @@ asmlinkage int sys_sigaction(int, const struct old_sigaction __user *,
33 struct old_sigaction __user *); 40 struct old_sigaction __user *);
34asmlinkage int sys_sigaltstack(unsigned long); 41asmlinkage int sys_sigaltstack(unsigned long);
35asmlinkage unsigned long sys_sigreturn(unsigned long); 42asmlinkage unsigned long sys_sigreturn(unsigned long);
36asmlinkage int sys_rt_sigreturn(unsigned long); 43asmlinkage int sys_rt_sigreturn(struct pt_regs);
37 44
38/* kernel/ioport.c */ 45/* kernel/ioport.c */
39asmlinkage long sys_iopl(unsigned long); 46asmlinkage long sys_iopl(unsigned long);
40 47
41/* kernel/ldt.c */
42asmlinkage int sys_modify_ldt(int, void __user *, unsigned long);
43
44/* kernel/sys_i386_32.c */ 48/* kernel/sys_i386_32.c */
45asmlinkage long sys_mmap2(unsigned long, unsigned long, unsigned long, 49asmlinkage long sys_mmap2(unsigned long, unsigned long, unsigned long,
46 unsigned long, unsigned long, unsigned long); 50 unsigned long, unsigned long, unsigned long);
@@ -54,10 +58,6 @@ asmlinkage int sys_uname(struct old_utsname __user *);
54struct oldold_utsname; 58struct oldold_utsname;
55asmlinkage int sys_olduname(struct oldold_utsname __user *); 59asmlinkage int sys_olduname(struct oldold_utsname __user *);
56 60
57/* kernel/tls.c */
58asmlinkage int sys_set_thread_area(struct user_desc __user *);
59asmlinkage int sys_get_thread_area(struct user_desc __user *);
60
61/* kernel/vm86_32.c */ 61/* kernel/vm86_32.c */
62asmlinkage int sys_vm86old(struct pt_regs); 62asmlinkage int sys_vm86old(struct pt_regs);
63asmlinkage int sys_vm86(struct pt_regs); 63asmlinkage int sys_vm86(struct pt_regs);
diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h
index 2ed3f0f44ff7..8e626ea33a1a 100644
--- a/arch/x86/include/asm/system.h
+++ b/arch/x86/include/asm/system.h
@@ -17,12 +17,12 @@
17# define AT_VECTOR_SIZE_ARCH 1 17# define AT_VECTOR_SIZE_ARCH 1
18#endif 18#endif
19 19
20#ifdef CONFIG_X86_32
21
22struct task_struct; /* one of the stranger aspects of C forward declarations */ 20struct task_struct; /* one of the stranger aspects of C forward declarations */
23struct task_struct *__switch_to(struct task_struct *prev, 21struct task_struct *__switch_to(struct task_struct *prev,
24 struct task_struct *next); 22 struct task_struct *next);
25 23
24#ifdef CONFIG_X86_32
25
26/* 26/*
27 * Saving eflags is important. It switches not only IOPL between tasks, 27 * Saving eflags is important. It switches not only IOPL between tasks,
28 * it also protects other tasks from NT leaking through sysenter etc. 28 * it also protects other tasks from NT leaking through sysenter etc.
@@ -314,6 +314,8 @@ extern void free_init_pages(char *what, unsigned long begin, unsigned long end);
314 314
315void default_idle(void); 315void default_idle(void);
316 316
317void stop_this_cpu(void *dummy);
318
317/* 319/*
318 * Force strict CPU ordering. 320 * Force strict CPU ordering.
319 * And yes, this is required on UP too when we're talking 321 * And yes, this is required on UP too when we're talking
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index e44d379faad2..98789647baa9 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -20,11 +20,13 @@
20struct task_struct; 20struct task_struct;
21struct exec_domain; 21struct exec_domain;
22#include <asm/processor.h> 22#include <asm/processor.h>
23#include <asm/ftrace.h>
24#include <asm/atomic.h>
23 25
24struct thread_info { 26struct thread_info {
25 struct task_struct *task; /* main task structure */ 27 struct task_struct *task; /* main task structure */
26 struct exec_domain *exec_domain; /* execution domain */ 28 struct exec_domain *exec_domain; /* execution domain */
27 unsigned long flags; /* low level flags */ 29 __u32 flags; /* low level flags */
28 __u32 status; /* thread synchronous flags */ 30 __u32 status; /* thread synchronous flags */
29 __u32 cpu; /* current CPU */ 31 __u32 cpu; /* current CPU */
30 int preempt_count; /* 0 => preemptable, 32 int preempt_count; /* 0 => preemptable,
@@ -91,7 +93,6 @@ struct thread_info {
91#define TIF_FORCED_TF 24 /* true if TF in eflags artificially */ 93#define TIF_FORCED_TF 24 /* true if TF in eflags artificially */
92#define TIF_DEBUGCTLMSR 25 /* uses thread_struct.debugctlmsr */ 94#define TIF_DEBUGCTLMSR 25 /* uses thread_struct.debugctlmsr */
93#define TIF_DS_AREA_MSR 26 /* uses thread_struct.ds_area_msr */ 95#define TIF_DS_AREA_MSR 26 /* uses thread_struct.ds_area_msr */
94#define TIF_BTS_TRACE_TS 27 /* record scheduling event timestamps */
95 96
96#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 97#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
97#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 98#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
@@ -113,7 +114,6 @@ struct thread_info {
113#define _TIF_FORCED_TF (1 << TIF_FORCED_TF) 114#define _TIF_FORCED_TF (1 << TIF_FORCED_TF)
114#define _TIF_DEBUGCTLMSR (1 << TIF_DEBUGCTLMSR) 115#define _TIF_DEBUGCTLMSR (1 << TIF_DEBUGCTLMSR)
115#define _TIF_DS_AREA_MSR (1 << TIF_DS_AREA_MSR) 116#define _TIF_DS_AREA_MSR (1 << TIF_DS_AREA_MSR)
116#define _TIF_BTS_TRACE_TS (1 << TIF_BTS_TRACE_TS)
117 117
118/* work to do in syscall_trace_enter() */ 118/* work to do in syscall_trace_enter() */
119#define _TIF_WORK_SYSCALL_ENTRY \ 119#define _TIF_WORK_SYSCALL_ENTRY \
@@ -139,8 +139,7 @@ struct thread_info {
139 139
140/* flags to check in __switch_to() */ 140/* flags to check in __switch_to() */
141#define _TIF_WORK_CTXSW \ 141#define _TIF_WORK_CTXSW \
142 (_TIF_IO_BITMAP|_TIF_DEBUGCTLMSR|_TIF_DS_AREA_MSR|_TIF_BTS_TRACE_TS| \ 142 (_TIF_IO_BITMAP|_TIF_DEBUGCTLMSR|_TIF_DS_AREA_MSR|_TIF_NOTSC)
143 _TIF_NOTSC)
144 143
145#define _TIF_WORK_CTXSW_PREV _TIF_WORK_CTXSW 144#define _TIF_WORK_CTXSW_PREV _TIF_WORK_CTXSW
146#define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW|_TIF_DEBUG) 145#define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW|_TIF_DEBUG)
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index ff386ff50ed7..4e2f2e0aab27 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -61,13 +61,19 @@ static inline int cpu_to_node(int cpu)
61 * 61 *
62 * Side note: this function creates the returned cpumask on the stack 62 * Side note: this function creates the returned cpumask on the stack
63 * so with a high NR_CPUS count, excessive stack space is used. The 63 * so with a high NR_CPUS count, excessive stack space is used. The
64 * node_to_cpumask_ptr function should be used whenever possible. 64 * cpumask_of_node function should be used whenever possible.
65 */ 65 */
66static inline cpumask_t node_to_cpumask(int node) 66static inline cpumask_t node_to_cpumask(int node)
67{ 67{
68 return node_to_cpumask_map[node]; 68 return node_to_cpumask_map[node];
69} 69}
70 70
71/* Returns a bitmask of CPUs on Node 'node'. */
72static inline const struct cpumask *cpumask_of_node(int node)
73{
74 return &node_to_cpumask_map[node];
75}
76
71#else /* CONFIG_X86_64 */ 77#else /* CONFIG_X86_64 */
72 78
73/* Mappings between node number and cpus on that node. */ 79/* Mappings between node number and cpus on that node. */
@@ -82,7 +88,7 @@ DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map);
82#ifdef CONFIG_DEBUG_PER_CPU_MAPS 88#ifdef CONFIG_DEBUG_PER_CPU_MAPS
83extern int cpu_to_node(int cpu); 89extern int cpu_to_node(int cpu);
84extern int early_cpu_to_node(int cpu); 90extern int early_cpu_to_node(int cpu);
85extern const cpumask_t *_node_to_cpumask_ptr(int node); 91extern const cpumask_t *cpumask_of_node(int node);
86extern cpumask_t node_to_cpumask(int node); 92extern cpumask_t node_to_cpumask(int node);
87 93
88#else /* !CONFIG_DEBUG_PER_CPU_MAPS */ 94#else /* !CONFIG_DEBUG_PER_CPU_MAPS */
@@ -103,7 +109,7 @@ static inline int early_cpu_to_node(int cpu)
103} 109}
104 110
105/* Returns a pointer to the cpumask of CPUs on Node 'node'. */ 111/* Returns a pointer to the cpumask of CPUs on Node 'node'. */
106static inline const cpumask_t *_node_to_cpumask_ptr(int node) 112static inline const cpumask_t *cpumask_of_node(int node)
107{ 113{
108 return &node_to_cpumask_map[node]; 114 return &node_to_cpumask_map[node];
109} 115}
@@ -116,12 +122,15 @@ static inline cpumask_t node_to_cpumask(int node)
116 122
117#endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ 123#endif /* !CONFIG_DEBUG_PER_CPU_MAPS */
118 124
119/* Replace default node_to_cpumask_ptr with optimized version */ 125/*
126 * Replace default node_to_cpumask_ptr with optimized version
127 * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)"
128 */
120#define node_to_cpumask_ptr(v, node) \ 129#define node_to_cpumask_ptr(v, node) \
121 const cpumask_t *v = _node_to_cpumask_ptr(node) 130 const cpumask_t *v = cpumask_of_node(node)
122 131
123#define node_to_cpumask_ptr_next(v, node) \ 132#define node_to_cpumask_ptr_next(v, node) \
124 v = _node_to_cpumask_ptr(node) 133 v = cpumask_of_node(node)
125 134
126#endif /* CONFIG_X86_64 */ 135#endif /* CONFIG_X86_64 */
127 136
@@ -187,7 +196,7 @@ extern int __node_distance(int, int);
187#define cpu_to_node(cpu) 0 196#define cpu_to_node(cpu) 0
188#define early_cpu_to_node(cpu) 0 197#define early_cpu_to_node(cpu) 0
189 198
190static inline const cpumask_t *_node_to_cpumask_ptr(int node) 199static inline const cpumask_t *cpumask_of_node(int node)
191{ 200{
192 return &cpu_online_map; 201 return &cpu_online_map;
193} 202}
@@ -200,12 +209,15 @@ static inline int node_to_first_cpu(int node)
200 return first_cpu(cpu_online_map); 209 return first_cpu(cpu_online_map);
201} 210}
202 211
203/* Replace default node_to_cpumask_ptr with optimized version */ 212/*
213 * Replace default node_to_cpumask_ptr with optimized version
214 * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)"
215 */
204#define node_to_cpumask_ptr(v, node) \ 216#define node_to_cpumask_ptr(v, node) \
205 const cpumask_t *v = _node_to_cpumask_ptr(node) 217 const cpumask_t *v = cpumask_of_node(node)
206 218
207#define node_to_cpumask_ptr_next(v, node) \ 219#define node_to_cpumask_ptr_next(v, node) \
208 v = _node_to_cpumask_ptr(node) 220 v = cpumask_of_node(node)
209#endif 221#endif
210 222
211#include <asm-generic/topology.h> 223#include <asm-generic/topology.h>
@@ -214,18 +226,20 @@ static inline int node_to_first_cpu(int node)
214/* Returns the number of the first CPU on Node 'node'. */ 226/* Returns the number of the first CPU on Node 'node'. */
215static inline int node_to_first_cpu(int node) 227static inline int node_to_first_cpu(int node)
216{ 228{
217 node_to_cpumask_ptr(mask, node); 229 return cpumask_first(cpumask_of_node(node));
218 return first_cpu(*mask);
219} 230}
220#endif 231#endif
221 232
222extern cpumask_t cpu_coregroup_map(int cpu); 233extern cpumask_t cpu_coregroup_map(int cpu);
234extern const struct cpumask *cpu_coregroup_mask(int cpu);
223 235
224#ifdef ENABLE_TOPO_DEFINES 236#ifdef ENABLE_TOPO_DEFINES
225#define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) 237#define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id)
226#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) 238#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id)
227#define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) 239#define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu))
228#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) 240#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu))
241#define topology_core_cpumask(cpu) (&per_cpu(cpu_core_map, cpu))
242#define topology_thread_cpumask(cpu) (&per_cpu(cpu_sibling_map, cpu))
229 243
230/* indicates that pointers to the topology cpumask_t maps are valid */ 244/* indicates that pointers to the topology cpumask_t maps are valid */
231#define arch_provides_topology_pointers yes 245#define arch_provides_topology_pointers yes
diff --git a/arch/x86/include/asm/trampoline.h b/arch/x86/include/asm/trampoline.h
index fa0d79facdbc..780ba0ab94f9 100644
--- a/arch/x86/include/asm/trampoline.h
+++ b/arch/x86/include/asm/trampoline.h
@@ -3,6 +3,7 @@
3 3
4#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5 5
6#ifdef CONFIG_X86_TRAMPOLINE
6/* 7/*
7 * Trampoline 80x86 program as an array. 8 * Trampoline 80x86 program as an array.
8 */ 9 */
@@ -13,8 +14,14 @@ extern unsigned char *trampoline_base;
13extern unsigned long init_rsp; 14extern unsigned long init_rsp;
14extern unsigned long initial_code; 15extern unsigned long initial_code;
15 16
17#define TRAMPOLINE_SIZE roundup(trampoline_end - trampoline_data, PAGE_SIZE)
16#define TRAMPOLINE_BASE 0x6000 18#define TRAMPOLINE_BASE 0x6000
19
17extern unsigned long setup_trampoline(void); 20extern unsigned long setup_trampoline(void);
21extern void __init reserve_trampoline_memory(void);
22#else
23static inline void reserve_trampoline_memory(void) {};
24#endif /* CONFIG_X86_TRAMPOLINE */
18 25
19#endif /* __ASSEMBLY__ */ 26#endif /* __ASSEMBLY__ */
20 27
diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h
index 45dee286e45c..2ee0a3bceedf 100644
--- a/arch/x86/include/asm/traps.h
+++ b/arch/x86/include/asm/traps.h
@@ -46,6 +46,10 @@ dotraplinkage void do_coprocessor_segment_overrun(struct pt_regs *, long);
46dotraplinkage void do_invalid_TSS(struct pt_regs *, long); 46dotraplinkage void do_invalid_TSS(struct pt_regs *, long);
47dotraplinkage void do_segment_not_present(struct pt_regs *, long); 47dotraplinkage void do_segment_not_present(struct pt_regs *, long);
48dotraplinkage void do_stack_segment(struct pt_regs *, long); 48dotraplinkage void do_stack_segment(struct pt_regs *, long);
49#ifdef CONFIG_X86_64
50dotraplinkage void do_double_fault(struct pt_regs *, long);
51asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *);
52#endif
49dotraplinkage void do_general_protection(struct pt_regs *, long); 53dotraplinkage void do_general_protection(struct pt_regs *, long);
50dotraplinkage void do_page_fault(struct pt_regs *, unsigned long); 54dotraplinkage void do_page_fault(struct pt_regs *, unsigned long);
51dotraplinkage void do_spurious_interrupt_bug(struct pt_regs *, long); 55dotraplinkage void do_spurious_interrupt_bug(struct pt_regs *, long);
@@ -72,10 +76,13 @@ static inline int get_si_code(unsigned long condition)
72extern int panic_on_unrecovered_nmi; 76extern int panic_on_unrecovered_nmi;
73extern int kstack_depth_to_print; 77extern int kstack_depth_to_print;
74 78
75#ifdef CONFIG_X86_32
76void math_error(void __user *); 79void math_error(void __user *);
77unsigned long patch_espfix_desc(unsigned long, unsigned long);
78asmlinkage void math_emulate(long); 80asmlinkage void math_emulate(long);
81#ifdef CONFIG_X86_32
82unsigned long patch_espfix_desc(unsigned long, unsigned long);
83#else
84asmlinkage void smp_thermal_interrupt(void);
85asmlinkage void mce_threshold_interrupt(void);
79#endif 86#endif
80 87
81#endif /* _ASM_X86_TRAPS_H */ 88#endif /* _ASM_X86_TRAPS_H */
diff --git a/arch/x86/include/asm/tsc.h b/arch/x86/include/asm/tsc.h
index 9cd83a8e40d5..38ae163cc91b 100644
--- a/arch/x86/include/asm/tsc.h
+++ b/arch/x86/include/asm/tsc.h
@@ -34,8 +34,6 @@ static inline cycles_t get_cycles(void)
34 34
35static __always_inline cycles_t vget_cycles(void) 35static __always_inline cycles_t vget_cycles(void)
36{ 36{
37 cycles_t cycles;
38
39 /* 37 /*
40 * We only do VDSOs on TSC capable CPUs, so this shouldnt 38 * We only do VDSOs on TSC capable CPUs, so this shouldnt
41 * access boot_cpu_data (which is not VDSO-safe): 39 * access boot_cpu_data (which is not VDSO-safe):
@@ -44,11 +42,7 @@ static __always_inline cycles_t vget_cycles(void)
44 if (!cpu_has_tsc) 42 if (!cpu_has_tsc)
45 return 0; 43 return 0;
46#endif 44#endif
47 rdtsc_barrier(); 45 return (cycles_t)__native_read_tsc();
48 cycles = (cycles_t)__native_read_tsc();
49 rdtsc_barrier();
50
51 return cycles;
52} 46}
53 47
54extern void tsc_init(void); 48extern void tsc_init(void);
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
index 35c54921b2e4..4340055b7559 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -157,6 +157,7 @@ extern int __get_user_bad(void);
157 int __ret_gu; \ 157 int __ret_gu; \
158 unsigned long __val_gu; \ 158 unsigned long __val_gu; \
159 __chk_user_ptr(ptr); \ 159 __chk_user_ptr(ptr); \
160 might_fault(); \
160 switch (sizeof(*(ptr))) { \ 161 switch (sizeof(*(ptr))) { \
161 case 1: \ 162 case 1: \
162 __get_user_x(1, __ret_gu, __val_gu, ptr); \ 163 __get_user_x(1, __ret_gu, __val_gu, ptr); \
@@ -241,6 +242,7 @@ extern void __put_user_8(void);
241 int __ret_pu; \ 242 int __ret_pu; \
242 __typeof__(*(ptr)) __pu_val; \ 243 __typeof__(*(ptr)) __pu_val; \
243 __chk_user_ptr(ptr); \ 244 __chk_user_ptr(ptr); \
245 might_fault(); \
244 __pu_val = x; \ 246 __pu_val = x; \
245 switch (sizeof(*(ptr))) { \ 247 switch (sizeof(*(ptr))) { \
246 case 1: \ 248 case 1: \
@@ -350,14 +352,14 @@ do { \
350 352
351#define __put_user_nocheck(x, ptr, size) \ 353#define __put_user_nocheck(x, ptr, size) \
352({ \ 354({ \
353 long __pu_err; \ 355 int __pu_err; \
354 __put_user_size((x), (ptr), (size), __pu_err, -EFAULT); \ 356 __put_user_size((x), (ptr), (size), __pu_err, -EFAULT); \
355 __pu_err; \ 357 __pu_err; \
356}) 358})
357 359
358#define __get_user_nocheck(x, ptr, size) \ 360#define __get_user_nocheck(x, ptr, size) \
359({ \ 361({ \
360 long __gu_err; \ 362 int __gu_err; \
361 unsigned long __gu_val; \ 363 unsigned long __gu_val; \
362 __get_user_size(__gu_val, (ptr), (size), __gu_err, -EFAULT); \ 364 __get_user_size(__gu_val, (ptr), (size), __gu_err, -EFAULT); \
363 (x) = (__force __typeof__(*(ptr)))__gu_val; \ 365 (x) = (__force __typeof__(*(ptr)))__gu_val; \
diff --git a/arch/x86/include/asm/uaccess_32.h b/arch/x86/include/asm/uaccess_32.h
index d095a3aeea1b..5e06259e90e5 100644
--- a/arch/x86/include/asm/uaccess_32.h
+++ b/arch/x86/include/asm/uaccess_32.h
@@ -82,8 +82,8 @@ __copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)
82static __always_inline unsigned long __must_check 82static __always_inline unsigned long __must_check
83__copy_to_user(void __user *to, const void *from, unsigned long n) 83__copy_to_user(void __user *to, const void *from, unsigned long n)
84{ 84{
85 might_sleep(); 85 might_fault();
86 return __copy_to_user_inatomic(to, from, n); 86 return __copy_to_user_inatomic(to, from, n);
87} 87}
88 88
89static __always_inline unsigned long 89static __always_inline unsigned long
@@ -137,7 +137,7 @@ __copy_from_user_inatomic(void *to, const void __user *from, unsigned long n)
137static __always_inline unsigned long 137static __always_inline unsigned long
138__copy_from_user(void *to, const void __user *from, unsigned long n) 138__copy_from_user(void *to, const void __user *from, unsigned long n)
139{ 139{
140 might_sleep(); 140 might_fault();
141 if (__builtin_constant_p(n)) { 141 if (__builtin_constant_p(n)) {
142 unsigned long ret; 142 unsigned long ret;
143 143
@@ -159,7 +159,7 @@ __copy_from_user(void *to, const void __user *from, unsigned long n)
159static __always_inline unsigned long __copy_from_user_nocache(void *to, 159static __always_inline unsigned long __copy_from_user_nocache(void *to,
160 const void __user *from, unsigned long n) 160 const void __user *from, unsigned long n)
161{ 161{
162 might_sleep(); 162 might_fault();
163 if (__builtin_constant_p(n)) { 163 if (__builtin_constant_p(n)) {
164 unsigned long ret; 164 unsigned long ret;
165 165
diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h
index f8cfd00db450..84210c479fca 100644
--- a/arch/x86/include/asm/uaccess_64.h
+++ b/arch/x86/include/asm/uaccess_64.h
@@ -29,6 +29,8 @@ static __always_inline __must_check
29int __copy_from_user(void *dst, const void __user *src, unsigned size) 29int __copy_from_user(void *dst, const void __user *src, unsigned size)
30{ 30{
31 int ret = 0; 31 int ret = 0;
32
33 might_fault();
32 if (!__builtin_constant_p(size)) 34 if (!__builtin_constant_p(size))
33 return copy_user_generic(dst, (__force void *)src, size); 35 return copy_user_generic(dst, (__force void *)src, size);
34 switch (size) { 36 switch (size) {
@@ -71,6 +73,8 @@ static __always_inline __must_check
71int __copy_to_user(void __user *dst, const void *src, unsigned size) 73int __copy_to_user(void __user *dst, const void *src, unsigned size)
72{ 74{
73 int ret = 0; 75 int ret = 0;
76
77 might_fault();
74 if (!__builtin_constant_p(size)) 78 if (!__builtin_constant_p(size))
75 return copy_user_generic((__force void *)dst, src, size); 79 return copy_user_generic((__force void *)dst, src, size);
76 switch (size) { 80 switch (size) {
@@ -113,6 +117,8 @@ static __always_inline __must_check
113int __copy_in_user(void __user *dst, const void __user *src, unsigned size) 117int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
114{ 118{
115 int ret = 0; 119 int ret = 0;
120
121 might_fault();
116 if (!__builtin_constant_p(size)) 122 if (!__builtin_constant_p(size))
117 return copy_user_generic((__force void *)dst, 123 return copy_user_generic((__force void *)dst,
118 (__force void *)src, size); 124 (__force void *)src, size);
diff --git a/arch/x86/include/asm/unwind.h b/arch/x86/include/asm/unwind.h
deleted file mode 100644
index 8b064bd9c553..000000000000
--- a/arch/x86/include/asm/unwind.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef _ASM_X86_UNWIND_H
2#define _ASM_X86_UNWIND_H
3
4#define UNW_PC(frame) ((void)(frame), 0UL)
5#define UNW_SP(frame) ((void)(frame), 0UL)
6#define UNW_FP(frame) ((void)(frame), 0UL)
7
8static inline int arch_unw_user_mode(const void *info)
9{
10 return 0;
11}
12
13#endif /* _ASM_X86_UNWIND_H */
diff --git a/arch/x86/include/asm/uv/bios.h b/arch/x86/include/asm/uv/bios.h
index d931d3b7e6f7..7ed17ff502b9 100644
--- a/arch/x86/include/asm/uv/bios.h
+++ b/arch/x86/include/asm/uv/bios.h
@@ -32,13 +32,18 @@
32enum uv_bios_cmd { 32enum uv_bios_cmd {
33 UV_BIOS_COMMON, 33 UV_BIOS_COMMON,
34 UV_BIOS_GET_SN_INFO, 34 UV_BIOS_GET_SN_INFO,
35 UV_BIOS_FREQ_BASE 35 UV_BIOS_FREQ_BASE,
36 UV_BIOS_WATCHLIST_ALLOC,
37 UV_BIOS_WATCHLIST_FREE,
38 UV_BIOS_MEMPROTECT,
39 UV_BIOS_GET_PARTITION_ADDR
36}; 40};
37 41
38/* 42/*
39 * Status values returned from a BIOS call. 43 * Status values returned from a BIOS call.
40 */ 44 */
41enum { 45enum {
46 BIOS_STATUS_MORE_PASSES = 1,
42 BIOS_STATUS_SUCCESS = 0, 47 BIOS_STATUS_SUCCESS = 0,
43 BIOS_STATUS_UNIMPLEMENTED = -ENOSYS, 48 BIOS_STATUS_UNIMPLEMENTED = -ENOSYS,
44 BIOS_STATUS_EINVAL = -EINVAL, 49 BIOS_STATUS_EINVAL = -EINVAL,
@@ -71,6 +76,21 @@ union partition_info_u {
71 }; 76 };
72}; 77};
73 78
79union uv_watchlist_u {
80 u64 val;
81 struct {
82 u64 blade : 16,
83 size : 32,
84 filler : 16;
85 };
86};
87
88enum uv_memprotect {
89 UV_MEMPROT_RESTRICT_ACCESS,
90 UV_MEMPROT_ALLOW_AMO,
91 UV_MEMPROT_ALLOW_RW
92};
93
74/* 94/*
75 * bios calls have 6 parameters 95 * bios calls have 6 parameters
76 */ 96 */
@@ -80,14 +100,20 @@ extern s64 uv_bios_call_reentrant(enum uv_bios_cmd, u64, u64, u64, u64, u64);
80 100
81extern s64 uv_bios_get_sn_info(int, int *, long *, long *, long *); 101extern s64 uv_bios_get_sn_info(int, int *, long *, long *, long *);
82extern s64 uv_bios_freq_base(u64, u64 *); 102extern s64 uv_bios_freq_base(u64, u64 *);
103extern int uv_bios_mq_watchlist_alloc(int, unsigned long, unsigned int,
104 unsigned long *);
105extern int uv_bios_mq_watchlist_free(int, int);
106extern s64 uv_bios_change_memprotect(u64, u64, enum uv_memprotect);
107extern s64 uv_bios_reserved_page_pa(u64, u64 *, u64 *, u64 *);
83 108
84extern void uv_bios_init(void); 109extern void uv_bios_init(void);
85 110
111extern unsigned long sn_rtc_cycles_per_second;
86extern int uv_type; 112extern int uv_type;
87extern long sn_partition_id; 113extern long sn_partition_id;
88extern long uv_coherency_id; 114extern long sn_coherency_id;
89extern long uv_region_size; 115extern long sn_region_size;
90#define partition_coherence_id() (uv_coherency_id) 116#define partition_coherence_id() (sn_coherency_id)
91 117
92extern struct kobject *sgi_uv_kobj; /* /sys/firmware/sgi_uv */ 118extern struct kobject *sgi_uv_kobj; /* /sys/firmware/sgi_uv */
93 119
diff --git a/arch/x86/include/asm/uv/uv_bau.h b/arch/x86/include/asm/uv/uv_bau.h
index e2363253bbbf..50423c7b56b2 100644
--- a/arch/x86/include/asm/uv/uv_bau.h
+++ b/arch/x86/include/asm/uv/uv_bau.h
@@ -133,61 +133,61 @@ struct bau_msg_payload {
133 * see table 4.2.3.0.1 in broacast_assist spec. 133 * see table 4.2.3.0.1 in broacast_assist spec.
134 */ 134 */
135struct bau_msg_header { 135struct bau_msg_header {
136 int dest_subnodeid:6; /* must be zero */ 136 unsigned int dest_subnodeid:6; /* must be zero */
137 /* bits 5:0 */ 137 /* bits 5:0 */
138 int base_dest_nodeid:15; /* nasid>>1 (pnode) of first bit in node_map */ 138 unsigned int base_dest_nodeid:15; /* nasid>>1 (pnode) of */
139 /* bits 20:6 */ 139 /* bits 20:6 */ /* first bit in node_map */
140 int command:8; /* message type */ 140 unsigned int command:8; /* message type */
141 /* bits 28:21 */ 141 /* bits 28:21 */
142 /* 0x38: SN3net EndPoint Message */ 142 /* 0x38: SN3net EndPoint Message */
143 int rsvd_1:3; /* must be zero */ 143 unsigned int rsvd_1:3; /* must be zero */
144 /* bits 31:29 */ 144 /* bits 31:29 */
145 /* int will align on 32 bits */ 145 /* int will align on 32 bits */
146 int rsvd_2:9; /* must be zero */ 146 unsigned int rsvd_2:9; /* must be zero */
147 /* bits 40:32 */ 147 /* bits 40:32 */
148 /* Suppl_A is 56-41 */ 148 /* Suppl_A is 56-41 */
149 int payload_2a:8; /* becomes byte 16 of msg */ 149 unsigned int payload_2a:8;/* becomes byte 16 of msg */
150 /* bits 48:41 */ /* not currently using */ 150 /* bits 48:41 */ /* not currently using */
151 int payload_2b:8; /* becomes byte 17 of msg */ 151 unsigned int payload_2b:8;/* becomes byte 17 of msg */
152 /* bits 56:49 */ /* not currently using */ 152 /* bits 56:49 */ /* not currently using */
153 /* Address field (96:57) is never used as an 153 /* Address field (96:57) is never used as an
154 address (these are address bits 42:3) */ 154 address (these are address bits 42:3) */
155 int rsvd_3:1; /* must be zero */ 155 unsigned int rsvd_3:1; /* must be zero */
156 /* bit 57 */ 156 /* bit 57 */
157 /* address bits 27:4 are payload */ 157 /* address bits 27:4 are payload */
158 /* these 24 bits become bytes 12-14 of msg */ 158 /* these 24 bits become bytes 12-14 of msg */
159 int replied_to:1; /* sent as 0 by the source to byte 12 */ 159 unsigned int replied_to:1;/* sent as 0 by the source to byte 12 */
160 /* bit 58 */ 160 /* bit 58 */
161 161
162 int payload_1a:5; /* not currently used */ 162 unsigned int payload_1a:5;/* not currently used */
163 /* bits 63:59 */ 163 /* bits 63:59 */
164 int payload_1b:8; /* not currently used */ 164 unsigned int payload_1b:8;/* not currently used */
165 /* bits 71:64 */ 165 /* bits 71:64 */
166 int payload_1c:8; /* not currently used */ 166 unsigned int payload_1c:8;/* not currently used */
167 /* bits 79:72 */ 167 /* bits 79:72 */
168 int payload_1d:2; /* not currently used */ 168 unsigned int payload_1d:2;/* not currently used */
169 /* bits 81:80 */ 169 /* bits 81:80 */
170 170
171 int rsvd_4:7; /* must be zero */ 171 unsigned int rsvd_4:7; /* must be zero */
172 /* bits 88:82 */ 172 /* bits 88:82 */
173 int sw_ack_flag:1; /* software acknowledge flag */ 173 unsigned int sw_ack_flag:1;/* software acknowledge flag */
174 /* bit 89 */ 174 /* bit 89 */
175 /* INTD trasactions at destination are to 175 /* INTD trasactions at destination are to
176 wait for software acknowledge */ 176 wait for software acknowledge */
177 int rsvd_5:6; /* must be zero */ 177 unsigned int rsvd_5:6; /* must be zero */
178 /* bits 95:90 */ 178 /* bits 95:90 */
179 int rsvd_6:5; /* must be zero */ 179 unsigned int rsvd_6:5; /* must be zero */
180 /* bits 100:96 */ 180 /* bits 100:96 */
181 int int_both:1; /* if 1, interrupt both sockets on the blade */ 181 unsigned int int_both:1;/* if 1, interrupt both sockets on the blade */
182 /* bit 101*/ 182 /* bit 101*/
183 int fairness:3; /* usually zero */ 183 unsigned int fairness:3;/* usually zero */
184 /* bits 104:102 */ 184 /* bits 104:102 */
185 int multilevel:1; /* multi-level multicast format */ 185 unsigned int multilevel:1; /* multi-level multicast format */
186 /* bit 105 */ 186 /* bit 105 */
187 /* 0 for TLB: endpoint multi-unicast messages */ 187 /* 0 for TLB: endpoint multi-unicast messages */
188 int chaining:1; /* next descriptor is part of this activation*/ 188 unsigned int chaining:1;/* next descriptor is part of this activation*/
189 /* bit 106 */ 189 /* bit 106 */
190 int rsvd_7:21; /* must be zero */ 190 unsigned int rsvd_7:21; /* must be zero */
191 /* bits 127:107 */ 191 /* bits 127:107 */
192}; 192};
193 193
diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h
index 7a5782610b2b..777327ef05c1 100644
--- a/arch/x86/include/asm/uv/uv_hub.h
+++ b/arch/x86/include/asm/uv/uv_hub.h
@@ -113,25 +113,37 @@
113 */ 113 */
114#define UV_MAX_NASID_VALUE (UV_MAX_NUMALINK_NODES * 2) 114#define UV_MAX_NASID_VALUE (UV_MAX_NUMALINK_NODES * 2)
115 115
116struct uv_scir_s {
117 struct timer_list timer;
118 unsigned long offset;
119 unsigned long last;
120 unsigned long idle_on;
121 unsigned long idle_off;
122 unsigned char state;
123 unsigned char enabled;
124};
125
116/* 126/*
117 * The following defines attributes of the HUB chip. These attributes are 127 * The following defines attributes of the HUB chip. These attributes are
118 * frequently referenced and are kept in the per-cpu data areas of each cpu. 128 * frequently referenced and are kept in the per-cpu data areas of each cpu.
119 * They are kept together in a struct to minimize cache misses. 129 * They are kept together in a struct to minimize cache misses.
120 */ 130 */
121struct uv_hub_info_s { 131struct uv_hub_info_s {
122 unsigned long global_mmr_base; 132 unsigned long global_mmr_base;
123 unsigned long gpa_mask; 133 unsigned long gpa_mask;
124 unsigned long gnode_upper; 134 unsigned long gnode_upper;
125 unsigned long lowmem_remap_top; 135 unsigned long lowmem_remap_top;
126 unsigned long lowmem_remap_base; 136 unsigned long lowmem_remap_base;
127 unsigned short pnode; 137 unsigned short pnode;
128 unsigned short pnode_mask; 138 unsigned short pnode_mask;
129 unsigned short coherency_domain_number; 139 unsigned short coherency_domain_number;
130 unsigned short numa_blade_id; 140 unsigned short numa_blade_id;
131 unsigned char blade_processor_id; 141 unsigned char blade_processor_id;
132 unsigned char m_val; 142 unsigned char m_val;
133 unsigned char n_val; 143 unsigned char n_val;
144 struct uv_scir_s scir;
134}; 145};
146
135DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info); 147DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
136#define uv_hub_info (&__get_cpu_var(__uv_hub_info)) 148#define uv_hub_info (&__get_cpu_var(__uv_hub_info))
137#define uv_cpu_hub_info(cpu) (&per_cpu(__uv_hub_info, cpu)) 149#define uv_cpu_hub_info(cpu) (&per_cpu(__uv_hub_info, cpu))
@@ -163,6 +175,30 @@ DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
163 175
164#define UV_APIC_PNODE_SHIFT 6 176#define UV_APIC_PNODE_SHIFT 6
165 177
178/* Local Bus from cpu's perspective */
179#define LOCAL_BUS_BASE 0x1c00000
180#define LOCAL_BUS_SIZE (4 * 1024 * 1024)
181
182/*
183 * System Controller Interface Reg
184 *
185 * Note there are NO leds on a UV system. This register is only
186 * used by the system controller to monitor system-wide operation.
187 * There are 64 regs per node. With Nahelem cpus (2 cores per node,
188 * 8 cpus per core, 2 threads per cpu) there are 32 cpu threads on
189 * a node.
190 *
191 * The window is located at top of ACPI MMR space
192 */
193#define SCIR_WINDOW_COUNT 64
194#define SCIR_LOCAL_MMR_BASE (LOCAL_BUS_BASE + \
195 LOCAL_BUS_SIZE - \
196 SCIR_WINDOW_COUNT)
197
198#define SCIR_CPU_HEARTBEAT 0x01 /* timer interrupt */
199#define SCIR_CPU_ACTIVITY 0x02 /* not idle */
200#define SCIR_CPU_HB_INTERVAL (HZ) /* once per second */
201
166/* 202/*
167 * Macros for converting between kernel virtual addresses, socket local physical 203 * Macros for converting between kernel virtual addresses, socket local physical
168 * addresses, and UV global physical addresses. 204 * addresses, and UV global physical addresses.
@@ -174,7 +210,7 @@ DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
174static inline unsigned long uv_soc_phys_ram_to_gpa(unsigned long paddr) 210static inline unsigned long uv_soc_phys_ram_to_gpa(unsigned long paddr)
175{ 211{
176 if (paddr < uv_hub_info->lowmem_remap_top) 212 if (paddr < uv_hub_info->lowmem_remap_top)
177 paddr += uv_hub_info->lowmem_remap_base; 213 paddr |= uv_hub_info->lowmem_remap_base;
178 return paddr | uv_hub_info->gnode_upper; 214 return paddr | uv_hub_info->gnode_upper;
179} 215}
180 216
@@ -182,19 +218,7 @@ static inline unsigned long uv_soc_phys_ram_to_gpa(unsigned long paddr)
182/* socket virtual --> UV global physical address */ 218/* socket virtual --> UV global physical address */
183static inline unsigned long uv_gpa(void *v) 219static inline unsigned long uv_gpa(void *v)
184{ 220{
185 return __pa(v) | uv_hub_info->gnode_upper; 221 return uv_soc_phys_ram_to_gpa(__pa(v));
186}
187
188/* socket virtual --> UV global physical address */
189static inline void *uv_vgpa(void *v)
190{
191 return (void *)uv_gpa(v);
192}
193
194/* UV global physical address --> socket virtual */
195static inline void *uv_va(unsigned long gpa)
196{
197 return __va(gpa & uv_hub_info->gpa_mask);
198} 222}
199 223
200/* pnode, offset --> socket virtual */ 224/* pnode, offset --> socket virtual */
@@ -277,6 +301,16 @@ static inline void uv_write_local_mmr(unsigned long offset, unsigned long val)
277 *uv_local_mmr_address(offset) = val; 301 *uv_local_mmr_address(offset) = val;
278} 302}
279 303
304static inline unsigned char uv_read_local_mmr8(unsigned long offset)
305{
306 return *((unsigned char *)uv_local_mmr_address(offset));
307}
308
309static inline void uv_write_local_mmr8(unsigned long offset, unsigned char val)
310{
311 *((unsigned char *)uv_local_mmr_address(offset)) = val;
312}
313
280/* 314/*
281 * Structures and definitions for converting between cpu, node, pnode, and blade 315 * Structures and definitions for converting between cpu, node, pnode, and blade
282 * numbers. 316 * numbers.
@@ -351,5 +385,20 @@ static inline int uv_num_possible_blades(void)
351 return uv_possible_blades; 385 return uv_possible_blades;
352} 386}
353 387
354#endif /* _ASM_X86_UV_UV_HUB_H */ 388/* Update SCIR state */
389static inline void uv_set_scir_bits(unsigned char value)
390{
391 if (uv_hub_info->scir.state != value) {
392 uv_hub_info->scir.state = value;
393 uv_write_local_mmr8(uv_hub_info->scir.offset, value);
394 }
395}
396static inline void uv_set_cpu_scir_bits(int cpu, unsigned char value)
397{
398 if (uv_cpu_hub_info(cpu)->scir.state != value) {
399 uv_cpu_hub_info(cpu)->scir.state = value;
400 uv_write_local_mmr8(uv_cpu_hub_info(cpu)->scir.offset, value);
401 }
402}
355 403
404#endif /* _ASM_X86_UV_UV_HUB_H */
diff --git a/arch/x86/include/asm/virtext.h b/arch/x86/include/asm/virtext.h
new file mode 100644
index 000000000000..593636275238
--- /dev/null
+++ b/arch/x86/include/asm/virtext.h
@@ -0,0 +1,132 @@
1/* CPU virtualization extensions handling
2 *
3 * This should carry the code for handling CPU virtualization extensions
4 * that needs to live in the kernel core.
5 *
6 * Author: Eduardo Habkost <ehabkost@redhat.com>
7 *
8 * Copyright (C) 2008, Red Hat Inc.
9 *
10 * Contains code from KVM, Copyright (C) 2006 Qumranet, Inc.
11 *
12 * This work is licensed under the terms of the GNU GPL, version 2. See
13 * the COPYING file in the top-level directory.
14 */
15#ifndef _ASM_X86_VIRTEX_H
16#define _ASM_X86_VIRTEX_H
17
18#include <asm/processor.h>
19#include <asm/system.h>
20
21#include <asm/vmx.h>
22#include <asm/svm.h>
23
24/*
25 * VMX functions:
26 */
27
28static inline int cpu_has_vmx(void)
29{
30 unsigned long ecx = cpuid_ecx(1);
31 return test_bit(5, &ecx); /* CPUID.1:ECX.VMX[bit 5] -> VT */
32}
33
34
35/** Disable VMX on the current CPU
36 *
37 * vmxoff causes a undefined-opcode exception if vmxon was not run
38 * on the CPU previously. Only call this function if you know VMX
39 * is enabled.
40 */
41static inline void cpu_vmxoff(void)
42{
43 asm volatile (ASM_VMX_VMXOFF : : : "cc");
44 write_cr4(read_cr4() & ~X86_CR4_VMXE);
45}
46
47static inline int cpu_vmx_enabled(void)
48{
49 return read_cr4() & X86_CR4_VMXE;
50}
51
52/** Disable VMX if it is enabled on the current CPU
53 *
54 * You shouldn't call this if cpu_has_vmx() returns 0.
55 */
56static inline void __cpu_emergency_vmxoff(void)
57{
58 if (cpu_vmx_enabled())
59 cpu_vmxoff();
60}
61
62/** Disable VMX if it is supported and enabled on the current CPU
63 */
64static inline void cpu_emergency_vmxoff(void)
65{
66 if (cpu_has_vmx())
67 __cpu_emergency_vmxoff();
68}
69
70
71
72
73/*
74 * SVM functions:
75 */
76
77/** Check if the CPU has SVM support
78 *
79 * You can use the 'msg' arg to get a message describing the problem,
80 * if the function returns zero. Simply pass NULL if you are not interested
81 * on the messages; gcc should take care of not generating code for
82 * the messages on this case.
83 */
84static inline int cpu_has_svm(const char **msg)
85{
86 uint32_t eax, ebx, ecx, edx;
87
88 if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) {
89 if (msg)
90 *msg = "not amd";
91 return 0;
92 }
93
94 cpuid(0x80000000, &eax, &ebx, &ecx, &edx);
95 if (eax < SVM_CPUID_FUNC) {
96 if (msg)
97 *msg = "can't execute cpuid_8000000a";
98 return 0;
99 }
100
101 cpuid(0x80000001, &eax, &ebx, &ecx, &edx);
102 if (!(ecx & (1 << SVM_CPUID_FEATURE_SHIFT))) {
103 if (msg)
104 *msg = "svm not available";
105 return 0;
106 }
107 return 1;
108}
109
110
111/** Disable SVM on the current CPU
112 *
113 * You should call this only if cpu_has_svm() returned true.
114 */
115static inline void cpu_svm_disable(void)
116{
117 uint64_t efer;
118
119 wrmsrl(MSR_VM_HSAVE_PA, 0);
120 rdmsrl(MSR_EFER, efer);
121 wrmsrl(MSR_EFER, efer & ~MSR_EFER_SVME_MASK);
122}
123
124/** Makes sure SVM is disabled, if it is supported on the CPU
125 */
126static inline void cpu_emergency_svm_disable(void)
127{
128 if (cpu_has_svm(NULL))
129 cpu_svm_disable();
130}
131
132#endif /* _ASM_X86_VIRTEX_H */
diff --git a/arch/x86/include/asm/vmware.h b/arch/x86/include/asm/vmware.h
new file mode 100644
index 000000000000..c11b7e100d83
--- /dev/null
+++ b/arch/x86/include/asm/vmware.h
@@ -0,0 +1,27 @@
1/*
2 * Copyright (C) 2008, VMware, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
12 * NON INFRINGEMENT. See the GNU General Public License for more
13 * 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 St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20#ifndef ASM_X86__VMWARE_H
21#define ASM_X86__VMWARE_H
22
23extern unsigned long vmware_get_tsc_khz(void);
24extern int vmware_platform(void);
25extern void vmware_set_feature_bits(struct cpuinfo_x86 *c);
26
27#endif
diff --git a/arch/x86/kvm/vmx.h b/arch/x86/include/asm/vmx.h
index ec5edc339da6..d0238e6151d8 100644
--- a/arch/x86/kvm/vmx.h
+++ b/arch/x86/include/asm/vmx.h
@@ -63,10 +63,13 @@
63 63
64#define VM_EXIT_HOST_ADDR_SPACE_SIZE 0x00000200 64#define VM_EXIT_HOST_ADDR_SPACE_SIZE 0x00000200
65#define VM_EXIT_ACK_INTR_ON_EXIT 0x00008000 65#define VM_EXIT_ACK_INTR_ON_EXIT 0x00008000
66#define VM_EXIT_SAVE_IA32_PAT 0x00040000
67#define VM_EXIT_LOAD_IA32_PAT 0x00080000
66 68
67#define VM_ENTRY_IA32E_MODE 0x00000200 69#define VM_ENTRY_IA32E_MODE 0x00000200
68#define VM_ENTRY_SMM 0x00000400 70#define VM_ENTRY_SMM 0x00000400
69#define VM_ENTRY_DEACT_DUAL_MONITOR 0x00000800 71#define VM_ENTRY_DEACT_DUAL_MONITOR 0x00000800
72#define VM_ENTRY_LOAD_IA32_PAT 0x00004000
70 73
71/* VMCS Encodings */ 74/* VMCS Encodings */
72enum vmcs_field { 75enum vmcs_field {
@@ -112,6 +115,8 @@ enum vmcs_field {
112 VMCS_LINK_POINTER_HIGH = 0x00002801, 115 VMCS_LINK_POINTER_HIGH = 0x00002801,
113 GUEST_IA32_DEBUGCTL = 0x00002802, 116 GUEST_IA32_DEBUGCTL = 0x00002802,
114 GUEST_IA32_DEBUGCTL_HIGH = 0x00002803, 117 GUEST_IA32_DEBUGCTL_HIGH = 0x00002803,
118 GUEST_IA32_PAT = 0x00002804,
119 GUEST_IA32_PAT_HIGH = 0x00002805,
115 GUEST_PDPTR0 = 0x0000280a, 120 GUEST_PDPTR0 = 0x0000280a,
116 GUEST_PDPTR0_HIGH = 0x0000280b, 121 GUEST_PDPTR0_HIGH = 0x0000280b,
117 GUEST_PDPTR1 = 0x0000280c, 122 GUEST_PDPTR1 = 0x0000280c,
@@ -120,6 +125,8 @@ enum vmcs_field {
120 GUEST_PDPTR2_HIGH = 0x0000280f, 125 GUEST_PDPTR2_HIGH = 0x0000280f,
121 GUEST_PDPTR3 = 0x00002810, 126 GUEST_PDPTR3 = 0x00002810,
122 GUEST_PDPTR3_HIGH = 0x00002811, 127 GUEST_PDPTR3_HIGH = 0x00002811,
128 HOST_IA32_PAT = 0x00002c00,
129 HOST_IA32_PAT_HIGH = 0x00002c01,
123 PIN_BASED_VM_EXEC_CONTROL = 0x00004000, 130 PIN_BASED_VM_EXEC_CONTROL = 0x00004000,
124 CPU_BASED_VM_EXEC_CONTROL = 0x00004002, 131 CPU_BASED_VM_EXEC_CONTROL = 0x00004002,
125 EXCEPTION_BITMAP = 0x00004004, 132 EXCEPTION_BITMAP = 0x00004004,
@@ -331,8 +338,9 @@ enum vmcs_field {
331 338
332#define AR_RESERVD_MASK 0xfffe0f00 339#define AR_RESERVD_MASK 0xfffe0f00
333 340
334#define APIC_ACCESS_PAGE_PRIVATE_MEMSLOT 9 341#define TSS_PRIVATE_MEMSLOT (KVM_MEMORY_SLOTS + 0)
335#define IDENTITY_PAGETABLE_PRIVATE_MEMSLOT 10 342#define APIC_ACCESS_PAGE_PRIVATE_MEMSLOT (KVM_MEMORY_SLOTS + 1)
343#define IDENTITY_PAGETABLE_PRIVATE_MEMSLOT (KVM_MEMORY_SLOTS + 2)
336 344
337#define VMX_NR_VPIDS (1 << 16) 345#define VMX_NR_VPIDS (1 << 16)
338#define VMX_VPID_EXTENT_SINGLE_CONTEXT 1 346#define VMX_VPID_EXTENT_SINGLE_CONTEXT 1
@@ -356,4 +364,19 @@ enum vmcs_field {
356 364
357#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfffbc000ul 365#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfffbc000ul
358 366
367
368#define ASM_VMX_VMCLEAR_RAX ".byte 0x66, 0x0f, 0xc7, 0x30"
369#define ASM_VMX_VMLAUNCH ".byte 0x0f, 0x01, 0xc2"
370#define ASM_VMX_VMRESUME ".byte 0x0f, 0x01, 0xc3"
371#define ASM_VMX_VMPTRLD_RAX ".byte 0x0f, 0xc7, 0x30"
372#define ASM_VMX_VMREAD_RDX_RAX ".byte 0x0f, 0x78, 0xd0"
373#define ASM_VMX_VMWRITE_RAX_RDX ".byte 0x0f, 0x79, 0xd0"
374#define ASM_VMX_VMWRITE_RSP_RDX ".byte 0x0f, 0x79, 0xd4"
375#define ASM_VMX_VMXOFF ".byte 0x0f, 0x01, 0xc4"
376#define ASM_VMX_VMXON_RAX ".byte 0xf3, 0x0f, 0xc7, 0x30"
377#define ASM_VMX_INVEPT ".byte 0x66, 0x0f, 0x38, 0x80, 0x08"
378#define ASM_VMX_INVVPID ".byte 0x66, 0x0f, 0x38, 0x81, 0x08"
379
380
381
359#endif 382#endif
diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
index 3f6000d95fe2..5e79ca694326 100644
--- a/arch/x86/include/asm/xen/hypercall.h
+++ b/arch/x86/include/asm/xen/hypercall.h
@@ -33,8 +33,14 @@
33#ifndef _ASM_X86_XEN_HYPERCALL_H 33#ifndef _ASM_X86_XEN_HYPERCALL_H
34#define _ASM_X86_XEN_HYPERCALL_H 34#define _ASM_X86_XEN_HYPERCALL_H
35 35
36#include <linux/kernel.h>
37#include <linux/spinlock.h>
36#include <linux/errno.h> 38#include <linux/errno.h>
37#include <linux/string.h> 39#include <linux/string.h>
40#include <linux/types.h>
41
42#include <asm/page.h>
43#include <asm/pgtable.h>
38 44
39#include <xen/interface/xen.h> 45#include <xen/interface/xen.h>
40#include <xen/interface/sched.h> 46#include <xen/interface/sched.h>
diff --git a/arch/x86/include/asm/xen/hypervisor.h b/arch/x86/include/asm/xen/hypervisor.h
index a38d25ac87d2..81fbd735aec4 100644
--- a/arch/x86/include/asm/xen/hypervisor.h
+++ b/arch/x86/include/asm/xen/hypervisor.h
@@ -33,39 +33,10 @@
33#ifndef _ASM_X86_XEN_HYPERVISOR_H 33#ifndef _ASM_X86_XEN_HYPERVISOR_H
34#define _ASM_X86_XEN_HYPERVISOR_H 34#define _ASM_X86_XEN_HYPERVISOR_H
35 35
36#include <linux/types.h>
37#include <linux/kernel.h>
38
39#include <xen/interface/xen.h>
40#include <xen/interface/version.h>
41
42#include <asm/ptrace.h>
43#include <asm/page.h>
44#include <asm/desc.h>
45#if defined(__i386__)
46# ifdef CONFIG_X86_PAE
47# include <asm-generic/pgtable-nopud.h>
48# else
49# include <asm-generic/pgtable-nopmd.h>
50# endif
51#endif
52#include <asm/xen/hypercall.h>
53
54/* arch/i386/kernel/setup.c */ 36/* arch/i386/kernel/setup.c */
55extern struct shared_info *HYPERVISOR_shared_info; 37extern struct shared_info *HYPERVISOR_shared_info;
56extern struct start_info *xen_start_info; 38extern struct start_info *xen_start_info;
57 39
58/* arch/i386/mach-xen/evtchn.c */
59/* Force a proper event-channel callback from Xen. */
60extern void force_evtchn_callback(void);
61
62/* Turn jiffies into Xen system time. */
63u64 jiffies_to_st(unsigned long jiffies);
64
65
66#define MULTI_UVMFLAGS_INDEX 3
67#define MULTI_UVMDOMID_INDEX 4
68
69enum xen_domain_type { 40enum xen_domain_type {
70 XEN_NATIVE, 41 XEN_NATIVE,
71 XEN_PV_DOMAIN, 42 XEN_PV_DOMAIN,
@@ -74,9 +45,15 @@ enum xen_domain_type {
74 45
75extern enum xen_domain_type xen_domain_type; 46extern enum xen_domain_type xen_domain_type;
76 47
48#ifdef CONFIG_XEN
77#define xen_domain() (xen_domain_type != XEN_NATIVE) 49#define xen_domain() (xen_domain_type != XEN_NATIVE)
78#define xen_pv_domain() (xen_domain_type == XEN_PV_DOMAIN) 50#else
51#define xen_domain() (0)
52#endif
53
54#define xen_pv_domain() (xen_domain() && xen_domain_type == XEN_PV_DOMAIN)
55#define xen_hvm_domain() (xen_domain() && xen_domain_type == XEN_HVM_DOMAIN)
56
79#define xen_initial_domain() (xen_pv_domain() && xen_start_info->flags & SIF_INITDOMAIN) 57#define xen_initial_domain() (xen_pv_domain() && xen_start_info->flags & SIF_INITDOMAIN)
80#define xen_hvm_domain() (xen_domain_type == XEN_HVM_DOMAIN)
81 58
82#endif /* _ASM_X86_XEN_HYPERVISOR_H */ 59#endif /* _ASM_X86_XEN_HYPERVISOR_H */
diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h
index bc628998a1b9..7ef617ef1df3 100644
--- a/arch/x86/include/asm/xen/page.h
+++ b/arch/x86/include/asm/xen/page.h
@@ -1,11 +1,16 @@
1#ifndef _ASM_X86_XEN_PAGE_H 1#ifndef _ASM_X86_XEN_PAGE_H
2#define _ASM_X86_XEN_PAGE_H 2#define _ASM_X86_XEN_PAGE_H
3 3
4#include <linux/kernel.h>
5#include <linux/types.h>
6#include <linux/spinlock.h>
4#include <linux/pfn.h> 7#include <linux/pfn.h>
5 8
6#include <asm/uaccess.h> 9#include <asm/uaccess.h>
10#include <asm/page.h>
7#include <asm/pgtable.h> 11#include <asm/pgtable.h>
8 12
13#include <xen/interface/xen.h>
9#include <xen/features.h> 14#include <xen/features.h>
10 15
11/* Xen machine address */ 16/* Xen machine address */
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index b62a7667828e..d364df03c1d6 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -12,6 +12,7 @@ CFLAGS_REMOVE_tsc.o = -pg
12CFLAGS_REMOVE_rtc.o = -pg 12CFLAGS_REMOVE_rtc.o = -pg
13CFLAGS_REMOVE_paravirt-spinlocks.o = -pg 13CFLAGS_REMOVE_paravirt-spinlocks.o = -pg
14CFLAGS_REMOVE_ftrace.o = -pg 14CFLAGS_REMOVE_ftrace.o = -pg
15CFLAGS_REMOVE_early_printk.o = -pg
15endif 16endif
16 17
17# 18#
@@ -23,9 +24,9 @@ CFLAGS_vsyscall_64.o := $(PROFILING) -g0 $(nostackp)
23CFLAGS_hpet.o := $(nostackp) 24CFLAGS_hpet.o := $(nostackp)
24CFLAGS_tsc.o := $(nostackp) 25CFLAGS_tsc.o := $(nostackp)
25 26
26obj-y := process_$(BITS).o signal_$(BITS).o entry_$(BITS).o 27obj-y := process_$(BITS).o signal.o entry_$(BITS).o
27obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o 28obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o
28obj-y += time_$(BITS).o ioport.o ldt.o 29obj-y += time_$(BITS).o ioport.o ldt.o dumpstack.o
29obj-y += setup.o i8259.o irqinit_$(BITS).o setup_percpu.o 30obj-y += setup.o i8259.o irqinit_$(BITS).o setup_percpu.o
30obj-$(CONFIG_X86_VISWS) += visws_quirks.o 31obj-$(CONFIG_X86_VISWS) += visws_quirks.o
31obj-$(CONFIG_X86_32) += probe_roms_32.o 32obj-$(CONFIG_X86_32) += probe_roms_32.o
@@ -65,6 +66,7 @@ obj-$(CONFIG_X86_LOCAL_APIC) += apic.o nmi.o
65obj-$(CONFIG_X86_IO_APIC) += io_apic.o 66obj-$(CONFIG_X86_IO_APIC) += io_apic.o
66obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups_32.o 67obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups_32.o
67obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o 68obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
69obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
68obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o 70obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o
69obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o 71obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o
70obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o 72obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o
@@ -105,6 +107,10 @@ microcode-$(CONFIG_MICROCODE_INTEL) += microcode_intel.o
105microcode-$(CONFIG_MICROCODE_AMD) += microcode_amd.o 107microcode-$(CONFIG_MICROCODE_AMD) += microcode_amd.o
106obj-$(CONFIG_MICROCODE) += microcode.o 108obj-$(CONFIG_MICROCODE) += microcode.o
107 109
110obj-$(CONFIG_X86_CHECK_BIOS_CORRUPTION) += check.o
111
112obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o # NB rename without _64
113
108### 114###
109# 64 bit specific files 115# 64 bit specific files
110ifeq ($(CONFIG_X86_64),y) 116ifeq ($(CONFIG_X86_64),y)
@@ -118,7 +124,6 @@ ifeq ($(CONFIG_X86_64),y)
118 obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o 124 obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o
119 obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o 125 obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o
120 obj-$(CONFIG_AMD_IOMMU) += amd_iommu_init.o amd_iommu.o 126 obj-$(CONFIG_AMD_IOMMU) += amd_iommu_init.o amd_iommu.o
121 obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o
122 127
123 obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o 128 obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o
124endif 129endif
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 4c51a2f8fd31..29dc0c89d4af 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -538,9 +538,10 @@ static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu)
538 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 538 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
539 union acpi_object *obj; 539 union acpi_object *obj;
540 struct acpi_madt_local_apic *lapic; 540 struct acpi_madt_local_apic *lapic;
541 cpumask_t tmp_map, new_map; 541 cpumask_var_t tmp_map, new_map;
542 u8 physid; 542 u8 physid;
543 int cpu; 543 int cpu;
544 int retval = -ENOMEM;
544 545
545 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer))) 546 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
546 return -EINVAL; 547 return -EINVAL;
@@ -569,23 +570,37 @@ static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu)
569 buffer.length = ACPI_ALLOCATE_BUFFER; 570 buffer.length = ACPI_ALLOCATE_BUFFER;
570 buffer.pointer = NULL; 571 buffer.pointer = NULL;
571 572
572 tmp_map = cpu_present_map; 573 if (!alloc_cpumask_var(&tmp_map, GFP_KERNEL))
574 goto out;
575
576 if (!alloc_cpumask_var(&new_map, GFP_KERNEL))
577 goto free_tmp_map;
578
579 cpumask_copy(tmp_map, cpu_present_mask);
573 acpi_register_lapic(physid, lapic->lapic_flags & ACPI_MADT_ENABLED); 580 acpi_register_lapic(physid, lapic->lapic_flags & ACPI_MADT_ENABLED);
574 581
575 /* 582 /*
576 * If mp_register_lapic successfully generates a new logical cpu 583 * If mp_register_lapic successfully generates a new logical cpu
577 * number, then the following will get us exactly what was mapped 584 * number, then the following will get us exactly what was mapped
578 */ 585 */
579 cpus_andnot(new_map, cpu_present_map, tmp_map); 586 cpumask_andnot(new_map, cpu_present_mask, tmp_map);
580 if (cpus_empty(new_map)) { 587 if (cpumask_empty(new_map)) {
581 printk ("Unable to map lapic to logical cpu number\n"); 588 printk ("Unable to map lapic to logical cpu number\n");
582 return -EINVAL; 589 retval = -EINVAL;
590 goto free_new_map;
583 } 591 }
584 592
585 cpu = first_cpu(new_map); 593 cpu = cpumask_first(new_map);
586 594
587 *pcpu = cpu; 595 *pcpu = cpu;
588 return 0; 596 retval = 0;
597
598free_new_map:
599 free_cpumask_var(new_map);
600free_tmp_map:
601 free_cpumask_var(tmp_map);
602out:
603 return retval;
589} 604}
590 605
591/* wrapper to silence section mismatch warning */ 606/* wrapper to silence section mismatch warning */
@@ -598,7 +613,7 @@ EXPORT_SYMBOL(acpi_map_lsapic);
598int acpi_unmap_lsapic(int cpu) 613int acpi_unmap_lsapic(int cpu)
599{ 614{
600 per_cpu(x86_cpu_to_apicid, cpu) = -1; 615 per_cpu(x86_cpu_to_apicid, cpu) = -1;
601 cpu_clear(cpu, cpu_present_map); 616 set_cpu_present(cpu, false);
602 num_processors--; 617 num_processors--;
603 618
604 return (0); 619 return (0);
@@ -1360,6 +1375,17 @@ static void __init acpi_process_madt(void)
1360 disable_acpi(); 1375 disable_acpi();
1361 } 1376 }
1362 } 1377 }
1378
1379 /*
1380 * ACPI supports both logical (e.g. Hyper-Threading) and physical
1381 * processors, where MPS only supports physical.
1382 */
1383 if (acpi_lapic && acpi_ioapic)
1384 printk(KERN_INFO "Using ACPI (MADT) for SMP configuration "
1385 "information\n");
1386 else if (acpi_lapic)
1387 printk(KERN_INFO "Using ACPI for processor (LAPIC) "
1388 "configuration information\n");
1363#endif 1389#endif
1364 return; 1390 return;
1365} 1391}
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 0a60d60ed036..5113c080f0c4 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -20,10 +20,15 @@
20#include <linux/pci.h> 20#include <linux/pci.h>
21#include <linux/gfp.h> 21#include <linux/gfp.h>
22#include <linux/bitops.h> 22#include <linux/bitops.h>
23#include <linux/debugfs.h>
23#include <linux/scatterlist.h> 24#include <linux/scatterlist.h>
24#include <linux/iommu-helper.h> 25#include <linux/iommu-helper.h>
26#ifdef CONFIG_IOMMU_API
27#include <linux/iommu.h>
28#endif
25#include <asm/proto.h> 29#include <asm/proto.h>
26#include <asm/iommu.h> 30#include <asm/iommu.h>
31#include <asm/gart.h>
27#include <asm/amd_iommu_types.h> 32#include <asm/amd_iommu_types.h>
28#include <asm/amd_iommu.h> 33#include <asm/amd_iommu.h>
29 34
@@ -37,6 +42,10 @@ static DEFINE_RWLOCK(amd_iommu_devtable_lock);
37static LIST_HEAD(iommu_pd_list); 42static LIST_HEAD(iommu_pd_list);
38static DEFINE_SPINLOCK(iommu_pd_list_lock); 43static DEFINE_SPINLOCK(iommu_pd_list_lock);
39 44
45#ifdef CONFIG_IOMMU_API
46static struct iommu_ops amd_iommu_ops;
47#endif
48
40/* 49/*
41 * general struct to manage commands send to an IOMMU 50 * general struct to manage commands send to an IOMMU
42 */ 51 */
@@ -46,6 +55,68 @@ struct iommu_cmd {
46 55
47static int dma_ops_unity_map(struct dma_ops_domain *dma_dom, 56static int dma_ops_unity_map(struct dma_ops_domain *dma_dom,
48 struct unity_map_entry *e); 57 struct unity_map_entry *e);
58static struct dma_ops_domain *find_protection_domain(u16 devid);
59
60
61#ifdef CONFIG_AMD_IOMMU_STATS
62
63/*
64 * Initialization code for statistics collection
65 */
66
67DECLARE_STATS_COUNTER(compl_wait);
68DECLARE_STATS_COUNTER(cnt_map_single);
69DECLARE_STATS_COUNTER(cnt_unmap_single);
70DECLARE_STATS_COUNTER(cnt_map_sg);
71DECLARE_STATS_COUNTER(cnt_unmap_sg);
72DECLARE_STATS_COUNTER(cnt_alloc_coherent);
73DECLARE_STATS_COUNTER(cnt_free_coherent);
74DECLARE_STATS_COUNTER(cross_page);
75DECLARE_STATS_COUNTER(domain_flush_single);
76DECLARE_STATS_COUNTER(domain_flush_all);
77DECLARE_STATS_COUNTER(alloced_io_mem);
78DECLARE_STATS_COUNTER(total_map_requests);
79
80static struct dentry *stats_dir;
81static struct dentry *de_isolate;
82static struct dentry *de_fflush;
83
84static void amd_iommu_stats_add(struct __iommu_counter *cnt)
85{
86 if (stats_dir == NULL)
87 return;
88
89 cnt->dent = debugfs_create_u64(cnt->name, 0444, stats_dir,
90 &cnt->value);
91}
92
93static void amd_iommu_stats_init(void)
94{
95 stats_dir = debugfs_create_dir("amd-iommu", NULL);
96 if (stats_dir == NULL)
97 return;
98
99 de_isolate = debugfs_create_bool("isolation", 0444, stats_dir,
100 (u32 *)&amd_iommu_isolate);
101
102 de_fflush = debugfs_create_bool("fullflush", 0444, stats_dir,
103 (u32 *)&amd_iommu_unmap_flush);
104
105 amd_iommu_stats_add(&compl_wait);
106 amd_iommu_stats_add(&cnt_map_single);
107 amd_iommu_stats_add(&cnt_unmap_single);
108 amd_iommu_stats_add(&cnt_map_sg);
109 amd_iommu_stats_add(&cnt_unmap_sg);
110 amd_iommu_stats_add(&cnt_alloc_coherent);
111 amd_iommu_stats_add(&cnt_free_coherent);
112 amd_iommu_stats_add(&cross_page);
113 amd_iommu_stats_add(&domain_flush_single);
114 amd_iommu_stats_add(&domain_flush_all);
115 amd_iommu_stats_add(&alloced_io_mem);
116 amd_iommu_stats_add(&total_map_requests);
117}
118
119#endif
49 120
50/* returns !0 if the IOMMU is caching non-present entries in its TLB */ 121/* returns !0 if the IOMMU is caching non-present entries in its TLB */
51static int iommu_has_npcache(struct amd_iommu *iommu) 122static int iommu_has_npcache(struct amd_iommu *iommu)
@@ -188,13 +259,55 @@ static int iommu_queue_command(struct amd_iommu *iommu, struct iommu_cmd *cmd)
188 spin_lock_irqsave(&iommu->lock, flags); 259 spin_lock_irqsave(&iommu->lock, flags);
189 ret = __iommu_queue_command(iommu, cmd); 260 ret = __iommu_queue_command(iommu, cmd);
190 if (!ret) 261 if (!ret)
191 iommu->need_sync = 1; 262 iommu->need_sync = true;
192 spin_unlock_irqrestore(&iommu->lock, flags); 263 spin_unlock_irqrestore(&iommu->lock, flags);
193 264
194 return ret; 265 return ret;
195} 266}
196 267
197/* 268/*
269 * This function waits until an IOMMU has completed a completion
270 * wait command
271 */
272static void __iommu_wait_for_completion(struct amd_iommu *iommu)
273{
274 int ready = 0;
275 unsigned status = 0;
276 unsigned long i = 0;
277
278 INC_STATS_COUNTER(compl_wait);
279
280 while (!ready && (i < EXIT_LOOP_COUNT)) {
281 ++i;
282 /* wait for the bit to become one */
283 status = readl(iommu->mmio_base + MMIO_STATUS_OFFSET);
284 ready = status & MMIO_STATUS_COM_WAIT_INT_MASK;
285 }
286
287 /* set bit back to zero */
288 status &= ~MMIO_STATUS_COM_WAIT_INT_MASK;
289 writel(status, iommu->mmio_base + MMIO_STATUS_OFFSET);
290
291 if (unlikely(i == EXIT_LOOP_COUNT))
292 panic("AMD IOMMU: Completion wait loop failed\n");
293}
294
295/*
296 * This function queues a completion wait command into the command
297 * buffer of an IOMMU
298 */
299static int __iommu_completion_wait(struct amd_iommu *iommu)
300{
301 struct iommu_cmd cmd;
302
303 memset(&cmd, 0, sizeof(cmd));
304 cmd.data[0] = CMD_COMPL_WAIT_INT_MASK;
305 CMD_SET_TYPE(&cmd, CMD_COMPL_WAIT);
306
307 return __iommu_queue_command(iommu, &cmd);
308}
309
310/*
198 * This function is called whenever we need to ensure that the IOMMU has 311 * This function is called whenever we need to ensure that the IOMMU has
199 * completed execution of all commands we sent. It sends a 312 * completed execution of all commands we sent. It sends a
200 * COMPLETION_WAIT command and waits for it to finish. The IOMMU informs 313 * COMPLETION_WAIT command and waits for it to finish. The IOMMU informs
@@ -203,40 +316,22 @@ static int iommu_queue_command(struct amd_iommu *iommu, struct iommu_cmd *cmd)
203 */ 316 */
204static int iommu_completion_wait(struct amd_iommu *iommu) 317static int iommu_completion_wait(struct amd_iommu *iommu)
205{ 318{
206 int ret = 0, ready = 0; 319 int ret = 0;
207 unsigned status = 0; 320 unsigned long flags;
208 struct iommu_cmd cmd;
209 unsigned long flags, i = 0;
210
211 memset(&cmd, 0, sizeof(cmd));
212 cmd.data[0] = CMD_COMPL_WAIT_INT_MASK;
213 CMD_SET_TYPE(&cmd, CMD_COMPL_WAIT);
214 321
215 spin_lock_irqsave(&iommu->lock, flags); 322 spin_lock_irqsave(&iommu->lock, flags);
216 323
217 if (!iommu->need_sync) 324 if (!iommu->need_sync)
218 goto out; 325 goto out;
219 326
220 iommu->need_sync = 0; 327 ret = __iommu_completion_wait(iommu);
221 328
222 ret = __iommu_queue_command(iommu, &cmd); 329 iommu->need_sync = false;
223 330
224 if (ret) 331 if (ret)
225 goto out; 332 goto out;
226 333
227 while (!ready && (i < EXIT_LOOP_COUNT)) { 334 __iommu_wait_for_completion(iommu);
228 ++i;
229 /* wait for the bit to become one */
230 status = readl(iommu->mmio_base + MMIO_STATUS_OFFSET);
231 ready = status & MMIO_STATUS_COM_WAIT_INT_MASK;
232 }
233
234 /* set bit back to zero */
235 status &= ~MMIO_STATUS_COM_WAIT_INT_MASK;
236 writel(status, iommu->mmio_base + MMIO_STATUS_OFFSET);
237
238 if (unlikely(i == EXIT_LOOP_COUNT))
239 panic("AMD IOMMU: Completion wait loop failed\n");
240 335
241out: 336out:
242 spin_unlock_irqrestore(&iommu->lock, flags); 337 spin_unlock_irqrestore(&iommu->lock, flags);
@@ -263,6 +358,21 @@ static int iommu_queue_inv_dev_entry(struct amd_iommu *iommu, u16 devid)
263 return ret; 358 return ret;
264} 359}
265 360
361static void __iommu_build_inv_iommu_pages(struct iommu_cmd *cmd, u64 address,
362 u16 domid, int pde, int s)
363{
364 memset(cmd, 0, sizeof(*cmd));
365 address &= PAGE_MASK;
366 CMD_SET_TYPE(cmd, CMD_INV_IOMMU_PAGES);
367 cmd->data[1] |= domid;
368 cmd->data[2] = lower_32_bits(address);
369 cmd->data[3] = upper_32_bits(address);
370 if (s) /* size bit - we flush more than one 4kb page */
371 cmd->data[2] |= CMD_INV_IOMMU_PAGES_SIZE_MASK;
372 if (pde) /* PDE bit - we wan't flush everything not only the PTEs */
373 cmd->data[2] |= CMD_INV_IOMMU_PAGES_PDE_MASK;
374}
375
266/* 376/*
267 * Generic command send function for invalidaing TLB entries 377 * Generic command send function for invalidaing TLB entries
268 */ 378 */
@@ -272,16 +382,7 @@ static int iommu_queue_inv_iommu_pages(struct amd_iommu *iommu,
272 struct iommu_cmd cmd; 382 struct iommu_cmd cmd;
273 int ret; 383 int ret;
274 384
275 memset(&cmd, 0, sizeof(cmd)); 385 __iommu_build_inv_iommu_pages(&cmd, address, domid, pde, s);
276 address &= PAGE_MASK;
277 CMD_SET_TYPE(&cmd, CMD_INV_IOMMU_PAGES);
278 cmd.data[1] |= domid;
279 cmd.data[2] = lower_32_bits(address);
280 cmd.data[3] = upper_32_bits(address);
281 if (s) /* size bit - we flush more than one 4kb page */
282 cmd.data[2] |= CMD_INV_IOMMU_PAGES_SIZE_MASK;
283 if (pde) /* PDE bit - we wan't flush everything not only the PTEs */
284 cmd.data[2] |= CMD_INV_IOMMU_PAGES_PDE_MASK;
285 386
286 ret = iommu_queue_command(iommu, &cmd); 387 ret = iommu_queue_command(iommu, &cmd);
287 388
@@ -320,9 +421,35 @@ static void iommu_flush_tlb(struct amd_iommu *iommu, u16 domid)
320{ 421{
321 u64 address = CMD_INV_IOMMU_ALL_PAGES_ADDRESS; 422 u64 address = CMD_INV_IOMMU_ALL_PAGES_ADDRESS;
322 423
424 INC_STATS_COUNTER(domain_flush_single);
425
323 iommu_queue_inv_iommu_pages(iommu, address, domid, 0, 1); 426 iommu_queue_inv_iommu_pages(iommu, address, domid, 0, 1);
324} 427}
325 428
429/*
430 * This function is used to flush the IO/TLB for a given protection domain
431 * on every IOMMU in the system
432 */
433static void iommu_flush_domain(u16 domid)
434{
435 unsigned long flags;
436 struct amd_iommu *iommu;
437 struct iommu_cmd cmd;
438
439 INC_STATS_COUNTER(domain_flush_all);
440
441 __iommu_build_inv_iommu_pages(&cmd, CMD_INV_IOMMU_ALL_PAGES_ADDRESS,
442 domid, 1, 1);
443
444 list_for_each_entry(iommu, &amd_iommu_list, list) {
445 spin_lock_irqsave(&iommu->lock, flags);
446 __iommu_queue_command(iommu, &cmd);
447 __iommu_completion_wait(iommu);
448 __iommu_wait_for_completion(iommu);
449 spin_unlock_irqrestore(&iommu->lock, flags);
450 }
451}
452
326/**************************************************************************** 453/****************************************************************************
327 * 454 *
328 * The functions below are used the create the page table mappings for 455 * The functions below are used the create the page table mappings for
@@ -337,10 +464,10 @@ static void iommu_flush_tlb(struct amd_iommu *iommu, u16 domid)
337 * supporting all features of AMD IOMMU page tables like level skipping 464 * supporting all features of AMD IOMMU page tables like level skipping
338 * and full 64 bit address spaces. 465 * and full 64 bit address spaces.
339 */ 466 */
340static int iommu_map(struct protection_domain *dom, 467static int iommu_map_page(struct protection_domain *dom,
341 unsigned long bus_addr, 468 unsigned long bus_addr,
342 unsigned long phys_addr, 469 unsigned long phys_addr,
343 int prot) 470 int prot)
344{ 471{
345 u64 __pte, *pte, *page; 472 u64 __pte, *pte, *page;
346 473
@@ -387,6 +514,28 @@ static int iommu_map(struct protection_domain *dom,
387 return 0; 514 return 0;
388} 515}
389 516
517static void iommu_unmap_page(struct protection_domain *dom,
518 unsigned long bus_addr)
519{
520 u64 *pte;
521
522 pte = &dom->pt_root[IOMMU_PTE_L2_INDEX(bus_addr)];
523
524 if (!IOMMU_PTE_PRESENT(*pte))
525 return;
526
527 pte = IOMMU_PTE_PAGE(*pte);
528 pte = &pte[IOMMU_PTE_L1_INDEX(bus_addr)];
529
530 if (!IOMMU_PTE_PRESENT(*pte))
531 return;
532
533 pte = IOMMU_PTE_PAGE(*pte);
534 pte = &pte[IOMMU_PTE_L1_INDEX(bus_addr)];
535
536 *pte = 0;
537}
538
390/* 539/*
391 * This function checks if a specific unity mapping entry is needed for 540 * This function checks if a specific unity mapping entry is needed for
392 * this specific IOMMU. 541 * this specific IOMMU.
@@ -439,7 +588,7 @@ static int dma_ops_unity_map(struct dma_ops_domain *dma_dom,
439 588
440 for (addr = e->address_start; addr < e->address_end; 589 for (addr = e->address_start; addr < e->address_end;
441 addr += PAGE_SIZE) { 590 addr += PAGE_SIZE) {
442 ret = iommu_map(&dma_dom->domain, addr, addr, e->prot); 591 ret = iommu_map_page(&dma_dom->domain, addr, addr, e->prot);
443 if (ret) 592 if (ret)
444 return ret; 593 return ret;
445 /* 594 /*
@@ -570,6 +719,16 @@ static u16 domain_id_alloc(void)
570 return id; 719 return id;
571} 720}
572 721
722static void domain_id_free(int id)
723{
724 unsigned long flags;
725
726 write_lock_irqsave(&amd_iommu_devtable_lock, flags);
727 if (id > 0 && id < MAX_DOMAIN_ID)
728 __clear_bit(id, amd_iommu_pd_alloc_bitmap);
729 write_unlock_irqrestore(&amd_iommu_devtable_lock, flags);
730}
731
573/* 732/*
574 * Used to reserve address ranges in the aperture (e.g. for exclusion 733 * Used to reserve address ranges in the aperture (e.g. for exclusion
575 * ranges. 734 * ranges.
@@ -586,12 +745,12 @@ static void dma_ops_reserve_addresses(struct dma_ops_domain *dom,
586 iommu_area_reserve(dom->bitmap, start_page, pages); 745 iommu_area_reserve(dom->bitmap, start_page, pages);
587} 746}
588 747
589static void dma_ops_free_pagetable(struct dma_ops_domain *dma_dom) 748static void free_pagetable(struct protection_domain *domain)
590{ 749{
591 int i, j; 750 int i, j;
592 u64 *p1, *p2, *p3; 751 u64 *p1, *p2, *p3;
593 752
594 p1 = dma_dom->domain.pt_root; 753 p1 = domain->pt_root;
595 754
596 if (!p1) 755 if (!p1)
597 return; 756 return;
@@ -612,6 +771,8 @@ static void dma_ops_free_pagetable(struct dma_ops_domain *dma_dom)
612 } 771 }
613 772
614 free_page((unsigned long)p1); 773 free_page((unsigned long)p1);
774
775 domain->pt_root = NULL;
615} 776}
616 777
617/* 778/*
@@ -623,7 +784,7 @@ static void dma_ops_domain_free(struct dma_ops_domain *dom)
623 if (!dom) 784 if (!dom)
624 return; 785 return;
625 786
626 dma_ops_free_pagetable(dom); 787 free_pagetable(&dom->domain);
627 788
628 kfree(dom->pte_pages); 789 kfree(dom->pte_pages);
629 790
@@ -662,6 +823,7 @@ static struct dma_ops_domain *dma_ops_domain_alloc(struct amd_iommu *iommu,
662 goto free_dma_dom; 823 goto free_dma_dom;
663 dma_dom->domain.mode = PAGE_MODE_3_LEVEL; 824 dma_dom->domain.mode = PAGE_MODE_3_LEVEL;
664 dma_dom->domain.pt_root = (void *)get_zeroed_page(GFP_KERNEL); 825 dma_dom->domain.pt_root = (void *)get_zeroed_page(GFP_KERNEL);
826 dma_dom->domain.flags = PD_DMA_OPS_MASK;
665 dma_dom->domain.priv = dma_dom; 827 dma_dom->domain.priv = dma_dom;
666 if (!dma_dom->domain.pt_root) 828 if (!dma_dom->domain.pt_root)
667 goto free_dma_dom; 829 goto free_dma_dom;
@@ -724,6 +886,15 @@ free_dma_dom:
724} 886}
725 887
726/* 888/*
889 * little helper function to check whether a given protection domain is a
890 * dma_ops domain
891 */
892static bool dma_ops_domain(struct protection_domain *domain)
893{
894 return domain->flags & PD_DMA_OPS_MASK;
895}
896
897/*
727 * Find out the protection domain structure for a given PCI device. This 898 * Find out the protection domain structure for a given PCI device. This
728 * will give us the pointer to the page table root for example. 899 * will give us the pointer to the page table root for example.
729 */ 900 */
@@ -743,14 +914,15 @@ static struct protection_domain *domain_for_device(u16 devid)
743 * If a device is not yet associated with a domain, this function does 914 * If a device is not yet associated with a domain, this function does
744 * assigns it visible for the hardware 915 * assigns it visible for the hardware
745 */ 916 */
746static void set_device_domain(struct amd_iommu *iommu, 917static void attach_device(struct amd_iommu *iommu,
747 struct protection_domain *domain, 918 struct protection_domain *domain,
748 u16 devid) 919 u16 devid)
749{ 920{
750 unsigned long flags; 921 unsigned long flags;
751
752 u64 pte_root = virt_to_phys(domain->pt_root); 922 u64 pte_root = virt_to_phys(domain->pt_root);
753 923
924 domain->dev_cnt += 1;
925
754 pte_root |= (domain->mode & DEV_ENTRY_MODE_MASK) 926 pte_root |= (domain->mode & DEV_ENTRY_MODE_MASK)
755 << DEV_ENTRY_MODE_SHIFT; 927 << DEV_ENTRY_MODE_SHIFT;
756 pte_root |= IOMMU_PTE_IR | IOMMU_PTE_IW | IOMMU_PTE_P | IOMMU_PTE_TV; 928 pte_root |= IOMMU_PTE_IR | IOMMU_PTE_IW | IOMMU_PTE_P | IOMMU_PTE_TV;
@@ -766,6 +938,116 @@ static void set_device_domain(struct amd_iommu *iommu,
766 iommu_queue_inv_dev_entry(iommu, devid); 938 iommu_queue_inv_dev_entry(iommu, devid);
767} 939}
768 940
941/*
942 * Removes a device from a protection domain (unlocked)
943 */
944static void __detach_device(struct protection_domain *domain, u16 devid)
945{
946
947 /* lock domain */
948 spin_lock(&domain->lock);
949
950 /* remove domain from the lookup table */
951 amd_iommu_pd_table[devid] = NULL;
952
953 /* remove entry from the device table seen by the hardware */
954 amd_iommu_dev_table[devid].data[0] = IOMMU_PTE_P | IOMMU_PTE_TV;
955 amd_iommu_dev_table[devid].data[1] = 0;
956 amd_iommu_dev_table[devid].data[2] = 0;
957
958 /* decrease reference counter */
959 domain->dev_cnt -= 1;
960
961 /* ready */
962 spin_unlock(&domain->lock);
963}
964
965/*
966 * Removes a device from a protection domain (with devtable_lock held)
967 */
968static void detach_device(struct protection_domain *domain, u16 devid)
969{
970 unsigned long flags;
971
972 /* lock device table */
973 write_lock_irqsave(&amd_iommu_devtable_lock, flags);
974 __detach_device(domain, devid);
975 write_unlock_irqrestore(&amd_iommu_devtable_lock, flags);
976}
977
978static int device_change_notifier(struct notifier_block *nb,
979 unsigned long action, void *data)
980{
981 struct device *dev = data;
982 struct pci_dev *pdev = to_pci_dev(dev);
983 u16 devid = calc_devid(pdev->bus->number, pdev->devfn);
984 struct protection_domain *domain;
985 struct dma_ops_domain *dma_domain;
986 struct amd_iommu *iommu;
987 int order = amd_iommu_aperture_order;
988 unsigned long flags;
989
990 if (devid > amd_iommu_last_bdf)
991 goto out;
992
993 devid = amd_iommu_alias_table[devid];
994
995 iommu = amd_iommu_rlookup_table[devid];
996 if (iommu == NULL)
997 goto out;
998
999 domain = domain_for_device(devid);
1000
1001 if (domain && !dma_ops_domain(domain))
1002 WARN_ONCE(1, "AMD IOMMU WARNING: device %s already bound "
1003 "to a non-dma-ops domain\n", dev_name(dev));
1004
1005 switch (action) {
1006 case BUS_NOTIFY_BOUND_DRIVER:
1007 if (domain)
1008 goto out;
1009 dma_domain = find_protection_domain(devid);
1010 if (!dma_domain)
1011 dma_domain = iommu->default_dom;
1012 attach_device(iommu, &dma_domain->domain, devid);
1013 printk(KERN_INFO "AMD IOMMU: Using protection domain %d for "
1014 "device %s\n", dma_domain->domain.id, dev_name(dev));
1015 break;
1016 case BUS_NOTIFY_UNBIND_DRIVER:
1017 if (!domain)
1018 goto out;
1019 detach_device(domain, devid);
1020 break;
1021 case BUS_NOTIFY_ADD_DEVICE:
1022 /* allocate a protection domain if a device is added */
1023 dma_domain = find_protection_domain(devid);
1024 if (dma_domain)
1025 goto out;
1026 dma_domain = dma_ops_domain_alloc(iommu, order);
1027 if (!dma_domain)
1028 goto out;
1029 dma_domain->target_dev = devid;
1030
1031 spin_lock_irqsave(&iommu_pd_list_lock, flags);
1032 list_add_tail(&dma_domain->list, &iommu_pd_list);
1033 spin_unlock_irqrestore(&iommu_pd_list_lock, flags);
1034
1035 break;
1036 default:
1037 goto out;
1038 }
1039
1040 iommu_queue_inv_dev_entry(iommu, devid);
1041 iommu_completion_wait(iommu);
1042
1043out:
1044 return 0;
1045}
1046
1047struct notifier_block device_nb = {
1048 .notifier_call = device_change_notifier,
1049};
1050
769/***************************************************************************** 1051/*****************************************************************************
770 * 1052 *
771 * The next functions belong to the dma_ops mapping/unmapping code. 1053 * The next functions belong to the dma_ops mapping/unmapping code.
@@ -801,7 +1083,6 @@ static struct dma_ops_domain *find_protection_domain(u16 devid)
801 list_for_each_entry(entry, &iommu_pd_list, list) { 1083 list_for_each_entry(entry, &iommu_pd_list, list) {
802 if (entry->target_dev == devid) { 1084 if (entry->target_dev == devid) {
803 ret = entry; 1085 ret = entry;
804 list_del(&ret->list);
805 break; 1086 break;
806 } 1087 }
807 } 1088 }
@@ -852,14 +1133,13 @@ static int get_device_resources(struct device *dev,
852 if (!dma_dom) 1133 if (!dma_dom)
853 dma_dom = (*iommu)->default_dom; 1134 dma_dom = (*iommu)->default_dom;
854 *domain = &dma_dom->domain; 1135 *domain = &dma_dom->domain;
855 set_device_domain(*iommu, *domain, *bdf); 1136 attach_device(*iommu, *domain, *bdf);
856 printk(KERN_INFO "AMD IOMMU: Using protection domain %d for " 1137 printk(KERN_INFO "AMD IOMMU: Using protection domain %d for "
857 "device ", (*domain)->id); 1138 "device %s\n", (*domain)->id, dev_name(dev));
858 print_devid(_bdf, 1);
859 } 1139 }
860 1140
861 if (domain_for_device(_bdf) == NULL) 1141 if (domain_for_device(_bdf) == NULL)
862 set_device_domain(*iommu, *domain, _bdf); 1142 attach_device(*iommu, *domain, _bdf);
863 1143
864 return 1; 1144 return 1;
865} 1145}
@@ -945,6 +1225,11 @@ static dma_addr_t __map_single(struct device *dev,
945 pages = iommu_num_pages(paddr, size, PAGE_SIZE); 1225 pages = iommu_num_pages(paddr, size, PAGE_SIZE);
946 paddr &= PAGE_MASK; 1226 paddr &= PAGE_MASK;
947 1227
1228 INC_STATS_COUNTER(total_map_requests);
1229
1230 if (pages > 1)
1231 INC_STATS_COUNTER(cross_page);
1232
948 if (align) 1233 if (align)
949 align_mask = (1UL << get_order(size)) - 1; 1234 align_mask = (1UL << get_order(size)) - 1;
950 1235
@@ -961,6 +1246,8 @@ static dma_addr_t __map_single(struct device *dev,
961 } 1246 }
962 address += offset; 1247 address += offset;
963 1248
1249 ADD_STATS_COUNTER(alloced_io_mem, size);
1250
964 if (unlikely(dma_dom->need_flush && !amd_iommu_unmap_flush)) { 1251 if (unlikely(dma_dom->need_flush && !amd_iommu_unmap_flush)) {
965 iommu_flush_tlb(iommu, dma_dom->domain.id); 1252 iommu_flush_tlb(iommu, dma_dom->domain.id);
966 dma_dom->need_flush = false; 1253 dma_dom->need_flush = false;
@@ -997,6 +1284,8 @@ static void __unmap_single(struct amd_iommu *iommu,
997 start += PAGE_SIZE; 1284 start += PAGE_SIZE;
998 } 1285 }
999 1286
1287 SUB_STATS_COUNTER(alloced_io_mem, size);
1288
1000 dma_ops_free_addresses(dma_dom, dma_addr, pages); 1289 dma_ops_free_addresses(dma_dom, dma_addr, pages);
1001 1290
1002 if (amd_iommu_unmap_flush || dma_dom->need_flush) { 1291 if (amd_iommu_unmap_flush || dma_dom->need_flush) {
@@ -1018,6 +1307,8 @@ static dma_addr_t map_single(struct device *dev, phys_addr_t paddr,
1018 dma_addr_t addr; 1307 dma_addr_t addr;
1019 u64 dma_mask; 1308 u64 dma_mask;
1020 1309
1310 INC_STATS_COUNTER(cnt_map_single);
1311
1021 if (!check_device(dev)) 1312 if (!check_device(dev))
1022 return bad_dma_address; 1313 return bad_dma_address;
1023 1314
@@ -1029,6 +1320,9 @@ static dma_addr_t map_single(struct device *dev, phys_addr_t paddr,
1029 /* device not handled by any AMD IOMMU */ 1320 /* device not handled by any AMD IOMMU */
1030 return (dma_addr_t)paddr; 1321 return (dma_addr_t)paddr;
1031 1322
1323 if (!dma_ops_domain(domain))
1324 return bad_dma_address;
1325
1032 spin_lock_irqsave(&domain->lock, flags); 1326 spin_lock_irqsave(&domain->lock, flags);
1033 addr = __map_single(dev, iommu, domain->priv, paddr, size, dir, false, 1327 addr = __map_single(dev, iommu, domain->priv, paddr, size, dir, false,
1034 dma_mask); 1328 dma_mask);
@@ -1054,11 +1348,16 @@ static void unmap_single(struct device *dev, dma_addr_t dma_addr,
1054 struct protection_domain *domain; 1348 struct protection_domain *domain;
1055 u16 devid; 1349 u16 devid;
1056 1350
1351 INC_STATS_COUNTER(cnt_unmap_single);
1352
1057 if (!check_device(dev) || 1353 if (!check_device(dev) ||
1058 !get_device_resources(dev, &iommu, &domain, &devid)) 1354 !get_device_resources(dev, &iommu, &domain, &devid))
1059 /* device not handled by any AMD IOMMU */ 1355 /* device not handled by any AMD IOMMU */
1060 return; 1356 return;
1061 1357
1358 if (!dma_ops_domain(domain))
1359 return;
1360
1062 spin_lock_irqsave(&domain->lock, flags); 1361 spin_lock_irqsave(&domain->lock, flags);
1063 1362
1064 __unmap_single(iommu, domain->priv, dma_addr, size, dir); 1363 __unmap_single(iommu, domain->priv, dma_addr, size, dir);
@@ -1103,6 +1402,8 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
1103 int mapped_elems = 0; 1402 int mapped_elems = 0;
1104 u64 dma_mask; 1403 u64 dma_mask;
1105 1404
1405 INC_STATS_COUNTER(cnt_map_sg);
1406
1106 if (!check_device(dev)) 1407 if (!check_device(dev))
1107 return 0; 1408 return 0;
1108 1409
@@ -1113,6 +1414,9 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
1113 if (!iommu || !domain) 1414 if (!iommu || !domain)
1114 return map_sg_no_iommu(dev, sglist, nelems, dir); 1415 return map_sg_no_iommu(dev, sglist, nelems, dir);
1115 1416
1417 if (!dma_ops_domain(domain))
1418 return 0;
1419
1116 spin_lock_irqsave(&domain->lock, flags); 1420 spin_lock_irqsave(&domain->lock, flags);
1117 1421
1118 for_each_sg(sglist, s, nelems, i) { 1422 for_each_sg(sglist, s, nelems, i) {
@@ -1162,10 +1466,15 @@ static void unmap_sg(struct device *dev, struct scatterlist *sglist,
1162 u16 devid; 1466 u16 devid;
1163 int i; 1467 int i;
1164 1468
1469 INC_STATS_COUNTER(cnt_unmap_sg);
1470
1165 if (!check_device(dev) || 1471 if (!check_device(dev) ||
1166 !get_device_resources(dev, &iommu, &domain, &devid)) 1472 !get_device_resources(dev, &iommu, &domain, &devid))
1167 return; 1473 return;
1168 1474
1475 if (!dma_ops_domain(domain))
1476 return;
1477
1169 spin_lock_irqsave(&domain->lock, flags); 1478 spin_lock_irqsave(&domain->lock, flags);
1170 1479
1171 for_each_sg(sglist, s, nelems, i) { 1480 for_each_sg(sglist, s, nelems, i) {
@@ -1193,6 +1502,8 @@ static void *alloc_coherent(struct device *dev, size_t size,
1193 phys_addr_t paddr; 1502 phys_addr_t paddr;
1194 u64 dma_mask = dev->coherent_dma_mask; 1503 u64 dma_mask = dev->coherent_dma_mask;
1195 1504
1505 INC_STATS_COUNTER(cnt_alloc_coherent);
1506
1196 if (!check_device(dev)) 1507 if (!check_device(dev))
1197 return NULL; 1508 return NULL;
1198 1509
@@ -1211,6 +1522,9 @@ static void *alloc_coherent(struct device *dev, size_t size,
1211 return virt_addr; 1522 return virt_addr;
1212 } 1523 }
1213 1524
1525 if (!dma_ops_domain(domain))
1526 goto out_free;
1527
1214 if (!dma_mask) 1528 if (!dma_mask)
1215 dma_mask = *dev->dma_mask; 1529 dma_mask = *dev->dma_mask;
1216 1530
@@ -1219,18 +1533,20 @@ static void *alloc_coherent(struct device *dev, size_t size,
1219 *dma_addr = __map_single(dev, iommu, domain->priv, paddr, 1533 *dma_addr = __map_single(dev, iommu, domain->priv, paddr,
1220 size, DMA_BIDIRECTIONAL, true, dma_mask); 1534 size, DMA_BIDIRECTIONAL, true, dma_mask);
1221 1535
1222 if (*dma_addr == bad_dma_address) { 1536 if (*dma_addr == bad_dma_address)
1223 free_pages((unsigned long)virt_addr, get_order(size)); 1537 goto out_free;
1224 virt_addr = NULL;
1225 goto out;
1226 }
1227 1538
1228 iommu_completion_wait(iommu); 1539 iommu_completion_wait(iommu);
1229 1540
1230out:
1231 spin_unlock_irqrestore(&domain->lock, flags); 1541 spin_unlock_irqrestore(&domain->lock, flags);
1232 1542
1233 return virt_addr; 1543 return virt_addr;
1544
1545out_free:
1546
1547 free_pages((unsigned long)virt_addr, get_order(size));
1548
1549 return NULL;
1234} 1550}
1235 1551
1236/* 1552/*
@@ -1244,6 +1560,8 @@ static void free_coherent(struct device *dev, size_t size,
1244 struct protection_domain *domain; 1560 struct protection_domain *domain;
1245 u16 devid; 1561 u16 devid;
1246 1562
1563 INC_STATS_COUNTER(cnt_free_coherent);
1564
1247 if (!check_device(dev)) 1565 if (!check_device(dev))
1248 return; 1566 return;
1249 1567
@@ -1252,6 +1570,9 @@ static void free_coherent(struct device *dev, size_t size,
1252 if (!iommu || !domain) 1570 if (!iommu || !domain)
1253 goto free_mem; 1571 goto free_mem;
1254 1572
1573 if (!dma_ops_domain(domain))
1574 goto free_mem;
1575
1255 spin_lock_irqsave(&domain->lock, flags); 1576 spin_lock_irqsave(&domain->lock, flags);
1256 1577
1257 __unmap_single(iommu, domain->priv, dma_addr, size, DMA_BIDIRECTIONAL); 1578 __unmap_single(iommu, domain->priv, dma_addr, size, DMA_BIDIRECTIONAL);
@@ -1295,7 +1616,7 @@ static int amd_iommu_dma_supported(struct device *dev, u64 mask)
1295 * we don't need to preallocate the protection domains anymore. 1616 * we don't need to preallocate the protection domains anymore.
1296 * For now we have to. 1617 * For now we have to.
1297 */ 1618 */
1298void prealloc_protection_domains(void) 1619static void prealloc_protection_domains(void)
1299{ 1620{
1300 struct pci_dev *dev = NULL; 1621 struct pci_dev *dev = NULL;
1301 struct dma_ops_domain *dma_dom; 1622 struct dma_ops_domain *dma_dom;
@@ -1304,7 +1625,7 @@ void prealloc_protection_domains(void)
1304 u16 devid; 1625 u16 devid;
1305 1626
1306 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 1627 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
1307 devid = (dev->bus->number << 8) | dev->devfn; 1628 devid = calc_devid(dev->bus->number, dev->devfn);
1308 if (devid > amd_iommu_last_bdf) 1629 if (devid > amd_iommu_last_bdf)
1309 continue; 1630 continue;
1310 devid = amd_iommu_alias_table[devid]; 1631 devid = amd_iommu_alias_table[devid];
@@ -1351,6 +1672,7 @@ int __init amd_iommu_init_dma_ops(void)
1351 iommu->default_dom = dma_ops_domain_alloc(iommu, order); 1672 iommu->default_dom = dma_ops_domain_alloc(iommu, order);
1352 if (iommu->default_dom == NULL) 1673 if (iommu->default_dom == NULL)
1353 return -ENOMEM; 1674 return -ENOMEM;
1675 iommu->default_dom->domain.flags |= PD_DEFAULT_MASK;
1354 ret = iommu_init_unity_mappings(iommu); 1676 ret = iommu_init_unity_mappings(iommu);
1355 if (ret) 1677 if (ret)
1356 goto free_domains; 1678 goto free_domains;
@@ -1374,6 +1696,12 @@ int __init amd_iommu_init_dma_ops(void)
1374 /* Make the driver finally visible to the drivers */ 1696 /* Make the driver finally visible to the drivers */
1375 dma_ops = &amd_iommu_dma_ops; 1697 dma_ops = &amd_iommu_dma_ops;
1376 1698
1699 register_iommu(&amd_iommu_ops);
1700
1701 bus_register_notifier(&pci_bus_type, &device_nb);
1702
1703 amd_iommu_stats_init();
1704
1377 return 0; 1705 return 0;
1378 1706
1379free_domains: 1707free_domains:
@@ -1385,3 +1713,224 @@ free_domains:
1385 1713
1386 return ret; 1714 return ret;
1387} 1715}
1716
1717/*****************************************************************************
1718 *
1719 * The following functions belong to the exported interface of AMD IOMMU
1720 *
1721 * This interface allows access to lower level functions of the IOMMU
1722 * like protection domain handling and assignement of devices to domains
1723 * which is not possible with the dma_ops interface.
1724 *
1725 *****************************************************************************/
1726
1727static void cleanup_domain(struct protection_domain *domain)
1728{
1729 unsigned long flags;
1730 u16 devid;
1731
1732 write_lock_irqsave(&amd_iommu_devtable_lock, flags);
1733
1734 for (devid = 0; devid <= amd_iommu_last_bdf; ++devid)
1735 if (amd_iommu_pd_table[devid] == domain)
1736 __detach_device(domain, devid);
1737
1738 write_unlock_irqrestore(&amd_iommu_devtable_lock, flags);
1739}
1740
1741static int amd_iommu_domain_init(struct iommu_domain *dom)
1742{
1743 struct protection_domain *domain;
1744
1745 domain = kzalloc(sizeof(*domain), GFP_KERNEL);
1746 if (!domain)
1747 return -ENOMEM;
1748
1749 spin_lock_init(&domain->lock);
1750 domain->mode = PAGE_MODE_3_LEVEL;
1751 domain->id = domain_id_alloc();
1752 if (!domain->id)
1753 goto out_free;
1754 domain->pt_root = (void *)get_zeroed_page(GFP_KERNEL);
1755 if (!domain->pt_root)
1756 goto out_free;
1757
1758 dom->priv = domain;
1759
1760 return 0;
1761
1762out_free:
1763 kfree(domain);
1764
1765 return -ENOMEM;
1766}
1767
1768static void amd_iommu_domain_destroy(struct iommu_domain *dom)
1769{
1770 struct protection_domain *domain = dom->priv;
1771
1772 if (!domain)
1773 return;
1774
1775 if (domain->dev_cnt > 0)
1776 cleanup_domain(domain);
1777
1778 BUG_ON(domain->dev_cnt != 0);
1779
1780 free_pagetable(domain);
1781
1782 domain_id_free(domain->id);
1783
1784 kfree(domain);
1785
1786 dom->priv = NULL;
1787}
1788
1789static void amd_iommu_detach_device(struct iommu_domain *dom,
1790 struct device *dev)
1791{
1792 struct protection_domain *domain = dom->priv;
1793 struct amd_iommu *iommu;
1794 struct pci_dev *pdev;
1795 u16 devid;
1796
1797 if (dev->bus != &pci_bus_type)
1798 return;
1799
1800 pdev = to_pci_dev(dev);
1801
1802 devid = calc_devid(pdev->bus->number, pdev->devfn);
1803
1804 if (devid > 0)
1805 detach_device(domain, devid);
1806
1807 iommu = amd_iommu_rlookup_table[devid];
1808 if (!iommu)
1809 return;
1810
1811 iommu_queue_inv_dev_entry(iommu, devid);
1812 iommu_completion_wait(iommu);
1813}
1814
1815static int amd_iommu_attach_device(struct iommu_domain *dom,
1816 struct device *dev)
1817{
1818 struct protection_domain *domain = dom->priv;
1819 struct protection_domain *old_domain;
1820 struct amd_iommu *iommu;
1821 struct pci_dev *pdev;
1822 u16 devid;
1823
1824 if (dev->bus != &pci_bus_type)
1825 return -EINVAL;
1826
1827 pdev = to_pci_dev(dev);
1828
1829 devid = calc_devid(pdev->bus->number, pdev->devfn);
1830
1831 if (devid >= amd_iommu_last_bdf ||
1832 devid != amd_iommu_alias_table[devid])
1833 return -EINVAL;
1834
1835 iommu = amd_iommu_rlookup_table[devid];
1836 if (!iommu)
1837 return -EINVAL;
1838
1839 old_domain = domain_for_device(devid);
1840 if (old_domain)
1841 return -EBUSY;
1842
1843 attach_device(iommu, domain, devid);
1844
1845 iommu_completion_wait(iommu);
1846
1847 return 0;
1848}
1849
1850static int amd_iommu_map_range(struct iommu_domain *dom,
1851 unsigned long iova, phys_addr_t paddr,
1852 size_t size, int iommu_prot)
1853{
1854 struct protection_domain *domain = dom->priv;
1855 unsigned long i, npages = iommu_num_pages(paddr, size, PAGE_SIZE);
1856 int prot = 0;
1857 int ret;
1858
1859 if (iommu_prot & IOMMU_READ)
1860 prot |= IOMMU_PROT_IR;
1861 if (iommu_prot & IOMMU_WRITE)
1862 prot |= IOMMU_PROT_IW;
1863
1864 iova &= PAGE_MASK;
1865 paddr &= PAGE_MASK;
1866
1867 for (i = 0; i < npages; ++i) {
1868 ret = iommu_map_page(domain, iova, paddr, prot);
1869 if (ret)
1870 return ret;
1871
1872 iova += PAGE_SIZE;
1873 paddr += PAGE_SIZE;
1874 }
1875
1876 return 0;
1877}
1878
1879static void amd_iommu_unmap_range(struct iommu_domain *dom,
1880 unsigned long iova, size_t size)
1881{
1882
1883 struct protection_domain *domain = dom->priv;
1884 unsigned long i, npages = iommu_num_pages(iova, size, PAGE_SIZE);
1885
1886 iova &= PAGE_MASK;
1887
1888 for (i = 0; i < npages; ++i) {
1889 iommu_unmap_page(domain, iova);
1890 iova += PAGE_SIZE;
1891 }
1892
1893 iommu_flush_domain(domain->id);
1894}
1895
1896static phys_addr_t amd_iommu_iova_to_phys(struct iommu_domain *dom,
1897 unsigned long iova)
1898{
1899 struct protection_domain *domain = dom->priv;
1900 unsigned long offset = iova & ~PAGE_MASK;
1901 phys_addr_t paddr;
1902 u64 *pte;
1903
1904 pte = &domain->pt_root[IOMMU_PTE_L2_INDEX(iova)];
1905
1906 if (!IOMMU_PTE_PRESENT(*pte))
1907 return 0;
1908
1909 pte = IOMMU_PTE_PAGE(*pte);
1910 pte = &pte[IOMMU_PTE_L1_INDEX(iova)];
1911
1912 if (!IOMMU_PTE_PRESENT(*pte))
1913 return 0;
1914
1915 pte = IOMMU_PTE_PAGE(*pte);
1916 pte = &pte[IOMMU_PTE_L0_INDEX(iova)];
1917
1918 if (!IOMMU_PTE_PRESENT(*pte))
1919 return 0;
1920
1921 paddr = *pte & IOMMU_PAGE_MASK;
1922 paddr |= offset;
1923
1924 return paddr;
1925}
1926
1927static struct iommu_ops amd_iommu_ops = {
1928 .domain_init = amd_iommu_domain_init,
1929 .domain_destroy = amd_iommu_domain_destroy,
1930 .attach_dev = amd_iommu_attach_device,
1931 .detach_dev = amd_iommu_detach_device,
1932 .map = amd_iommu_map_range,
1933 .unmap = amd_iommu_unmap_range,
1934 .iova_to_phys = amd_iommu_iova_to_phys,
1935};
1936
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index c6cc22815d35..42c33cebf00f 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -28,6 +28,7 @@
28#include <asm/amd_iommu_types.h> 28#include <asm/amd_iommu_types.h>
29#include <asm/amd_iommu.h> 29#include <asm/amd_iommu.h>
30#include <asm/iommu.h> 30#include <asm/iommu.h>
31#include <asm/gart.h>
31 32
32/* 33/*
33 * definitions for the ACPI scanning code 34 * definitions for the ACPI scanning code
@@ -121,7 +122,8 @@ u16 amd_iommu_last_bdf; /* largest PCI device id we have
121LIST_HEAD(amd_iommu_unity_map); /* a list of required unity mappings 122LIST_HEAD(amd_iommu_unity_map); /* a list of required unity mappings
122 we find in ACPI */ 123 we find in ACPI */
123unsigned amd_iommu_aperture_order = 26; /* size of aperture in power of 2 */ 124unsigned amd_iommu_aperture_order = 26; /* size of aperture in power of 2 */
124int amd_iommu_isolate = 1; /* if 1, device isolation is enabled */ 125bool amd_iommu_isolate = true; /* if true, device isolation is
126 enabled */
125bool amd_iommu_unmap_flush; /* if true, flush on every unmap */ 127bool amd_iommu_unmap_flush; /* if true, flush on every unmap */
126 128
127LIST_HEAD(amd_iommu_list); /* list of all AMD IOMMUs in the 129LIST_HEAD(amd_iommu_list); /* list of all AMD IOMMUs in the
@@ -242,20 +244,16 @@ static void __init iommu_feature_disable(struct amd_iommu *iommu, u8 bit)
242} 244}
243 245
244/* Function to enable the hardware */ 246/* Function to enable the hardware */
245void __init iommu_enable(struct amd_iommu *iommu) 247static void __init iommu_enable(struct amd_iommu *iommu)
246{ 248{
247 printk(KERN_INFO "AMD IOMMU: Enabling IOMMU " 249 printk(KERN_INFO "AMD IOMMU: Enabling IOMMU at %s cap 0x%hx\n",
248 "at %02x:%02x.%x cap 0x%hx\n", 250 dev_name(&iommu->dev->dev), iommu->cap_ptr);
249 iommu->dev->bus->number,
250 PCI_SLOT(iommu->dev->devfn),
251 PCI_FUNC(iommu->dev->devfn),
252 iommu->cap_ptr);
253 251
254 iommu_feature_enable(iommu, CONTROL_IOMMU_EN); 252 iommu_feature_enable(iommu, CONTROL_IOMMU_EN);
255} 253}
256 254
257/* Function to enable IOMMU event logging and event interrupts */ 255/* Function to enable IOMMU event logging and event interrupts */
258void __init iommu_enable_event_logging(struct amd_iommu *iommu) 256static void __init iommu_enable_event_logging(struct amd_iommu *iommu)
259{ 257{
260 iommu_feature_enable(iommu, CONTROL_EVT_LOG_EN); 258 iommu_feature_enable(iommu, CONTROL_EVT_LOG_EN);
261 iommu_feature_enable(iommu, CONTROL_EVT_INT_EN); 259 iommu_feature_enable(iommu, CONTROL_EVT_INT_EN);
@@ -1217,9 +1215,9 @@ static int __init parse_amd_iommu_options(char *str)
1217{ 1215{
1218 for (; *str; ++str) { 1216 for (; *str; ++str) {
1219 if (strncmp(str, "isolate", 7) == 0) 1217 if (strncmp(str, "isolate", 7) == 0)
1220 amd_iommu_isolate = 1; 1218 amd_iommu_isolate = true;
1221 if (strncmp(str, "share", 5) == 0) 1219 if (strncmp(str, "share", 5) == 0)
1222 amd_iommu_isolate = 0; 1220 amd_iommu_isolate = false;
1223 if (strncmp(str, "fullflush", 9) == 0) 1221 if (strncmp(str, "fullflush", 9) == 0)
1224 amd_iommu_unmap_flush = true; 1222 amd_iommu_unmap_flush = true;
1225 } 1223 }
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
index 9a32b37ee2ee..676debfc1702 100644
--- a/arch/x86/kernel/aperture_64.c
+++ b/arch/x86/kernel/aperture_64.c
@@ -1,8 +1,9 @@
1/* 1/*
2 * Firmware replacement code. 2 * Firmware replacement code.
3 * 3 *
4 * Work around broken BIOSes that don't set an aperture or only set the 4 * Work around broken BIOSes that don't set an aperture, only set the
5 * aperture in the AGP bridge. 5 * aperture in the AGP bridge, or set too small aperture.
6 *
6 * If all fails map the aperture over some low memory. This is cheaper than 7 * If all fails map the aperture over some low memory. This is cheaper than
7 * doing bounce buffering. The memory is lost. This is done at early boot 8 * doing bounce buffering. The memory is lost. This is done at early boot
8 * because only the bootmem allocator can allocate 32+MB. 9 * because only the bootmem allocator can allocate 32+MB.
diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic.c
index 16f94879b525..b13d3c4dbd42 100644
--- a/arch/x86/kernel/apic.c
+++ b/arch/x86/kernel/apic.c
@@ -30,6 +30,7 @@
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/dmi.h> 31#include <linux/dmi.h>
32#include <linux/dmar.h> 32#include <linux/dmar.h>
33#include <linux/ftrace.h>
33 34
34#include <asm/atomic.h> 35#include <asm/atomic.h>
35#include <asm/smp.h> 36#include <asm/smp.h>
@@ -97,8 +98,8 @@ __setup("apicpmtimer", setup_apicpmtimer);
97#ifdef HAVE_X2APIC 98#ifdef HAVE_X2APIC
98int x2apic; 99int x2apic;
99/* x2apic enabled before OS handover */ 100/* x2apic enabled before OS handover */
100int x2apic_preenabled; 101static int x2apic_preenabled;
101int disable_x2apic; 102static int disable_x2apic;
102static __init int setup_nox2apic(char *str) 103static __init int setup_nox2apic(char *str)
103{ 104{
104 disable_x2apic = 1; 105 disable_x2apic = 1;
@@ -118,8 +119,6 @@ EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok);
118 119
119int first_system_vector = 0xfe; 120int first_system_vector = 0xfe;
120 121
121char system_vectors[NR_VECTORS] = { [0 ... NR_VECTORS-1] = SYS_VECTOR_FREE};
122
123/* 122/*
124 * Debug level, exported for io_apic.c 123 * Debug level, exported for io_apic.c
125 */ 124 */
@@ -141,7 +140,7 @@ static int lapic_next_event(unsigned long delta,
141 struct clock_event_device *evt); 140 struct clock_event_device *evt);
142static void lapic_timer_setup(enum clock_event_mode mode, 141static void lapic_timer_setup(enum clock_event_mode mode,
143 struct clock_event_device *evt); 142 struct clock_event_device *evt);
144static void lapic_timer_broadcast(cpumask_t mask); 143static void lapic_timer_broadcast(const struct cpumask *mask);
145static void apic_pm_activate(void); 144static void apic_pm_activate(void);
146 145
147/* 146/*
@@ -227,7 +226,7 @@ void xapic_icr_write(u32 low, u32 id)
227 apic_write(APIC_ICR, low); 226 apic_write(APIC_ICR, low);
228} 227}
229 228
230u64 xapic_icr_read(void) 229static u64 xapic_icr_read(void)
231{ 230{
232 u32 icr1, icr2; 231 u32 icr1, icr2;
233 232
@@ -267,7 +266,7 @@ void x2apic_icr_write(u32 low, u32 id)
267 wrmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), ((__u64) id) << 32 | low); 266 wrmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), ((__u64) id) << 32 | low);
268} 267}
269 268
270u64 x2apic_icr_read(void) 269static u64 x2apic_icr_read(void)
271{ 270{
272 unsigned long val; 271 unsigned long val;
273 272
@@ -441,6 +440,7 @@ static void lapic_timer_setup(enum clock_event_mode mode,
441 v = apic_read(APIC_LVTT); 440 v = apic_read(APIC_LVTT);
442 v |= (APIC_LVT_MASKED | LOCAL_TIMER_VECTOR); 441 v |= (APIC_LVT_MASKED | LOCAL_TIMER_VECTOR);
443 apic_write(APIC_LVTT, v); 442 apic_write(APIC_LVTT, v);
443 apic_write(APIC_TMICT, 0xffffffff);
444 break; 444 break;
445 case CLOCK_EVT_MODE_RESUME: 445 case CLOCK_EVT_MODE_RESUME:
446 /* Nothing to do here */ 446 /* Nothing to do here */
@@ -453,7 +453,7 @@ static void lapic_timer_setup(enum clock_event_mode mode,
453/* 453/*
454 * Local APIC timer broadcast function 454 * Local APIC timer broadcast function
455 */ 455 */
456static void lapic_timer_broadcast(cpumask_t mask) 456static void lapic_timer_broadcast(const struct cpumask *mask)
457{ 457{
458#ifdef CONFIG_SMP 458#ifdef CONFIG_SMP
459 send_IPI_mask(mask, LOCAL_TIMER_VECTOR); 459 send_IPI_mask(mask, LOCAL_TIMER_VECTOR);
@@ -469,7 +469,7 @@ static void __cpuinit setup_APIC_timer(void)
469 struct clock_event_device *levt = &__get_cpu_var(lapic_events); 469 struct clock_event_device *levt = &__get_cpu_var(lapic_events);
470 470
471 memcpy(levt, &lapic_clockevent, sizeof(*levt)); 471 memcpy(levt, &lapic_clockevent, sizeof(*levt));
472 levt->cpumask = cpumask_of_cpu(smp_processor_id()); 472 levt->cpumask = cpumask_of(smp_processor_id());
473 473
474 clockevents_register_device(levt); 474 clockevents_register_device(levt);
475} 475}
@@ -559,13 +559,13 @@ static int __init calibrate_by_pmtimer(long deltapm, long *delta)
559 } else { 559 } else {
560 res = (((u64)deltapm) * mult) >> 22; 560 res = (((u64)deltapm) * mult) >> 22;
561 do_div(res, 1000000); 561 do_div(res, 1000000);
562 printk(KERN_WARNING "APIC calibration not consistent " 562 pr_warning("APIC calibration not consistent "
563 "with PM Timer: %ldms instead of 100ms\n", 563 "with PM Timer: %ldms instead of 100ms\n",
564 (long)res); 564 (long)res);
565 /* Correct the lapic counter value */ 565 /* Correct the lapic counter value */
566 res = (((u64)(*delta)) * pm_100ms); 566 res = (((u64)(*delta)) * pm_100ms);
567 do_div(res, deltapm); 567 do_div(res, deltapm);
568 printk(KERN_INFO "APIC delta adjusted to PM-Timer: " 568 pr_info("APIC delta adjusted to PM-Timer: "
569 "%lu (%ld)\n", (unsigned long)res, *delta); 569 "%lu (%ld)\n", (unsigned long)res, *delta);
570 *delta = (long)res; 570 *delta = (long)res;
571 } 571 }
@@ -645,8 +645,7 @@ static int __init calibrate_APIC_clock(void)
645 */ 645 */
646 if (calibration_result < (1000000 / HZ)) { 646 if (calibration_result < (1000000 / HZ)) {
647 local_irq_enable(); 647 local_irq_enable();
648 printk(KERN_WARNING 648 pr_warning("APIC frequency too slow, disabling apic timer\n");
649 "APIC frequency too slow, disabling apic timer\n");
650 return -1; 649 return -1;
651 } 650 }
652 651
@@ -672,13 +671,9 @@ static int __init calibrate_APIC_clock(void)
672 while (lapic_cal_loops <= LAPIC_CAL_LOOPS) 671 while (lapic_cal_loops <= LAPIC_CAL_LOOPS)
673 cpu_relax(); 672 cpu_relax();
674 673
675 local_irq_disable();
676
677 /* Stop the lapic timer */ 674 /* Stop the lapic timer */
678 lapic_timer_setup(CLOCK_EVT_MODE_SHUTDOWN, levt); 675 lapic_timer_setup(CLOCK_EVT_MODE_SHUTDOWN, levt);
679 676
680 local_irq_enable();
681
682 /* Jiffies delta */ 677 /* Jiffies delta */
683 deltaj = lapic_cal_j2 - lapic_cal_j1; 678 deltaj = lapic_cal_j2 - lapic_cal_j1;
684 apic_printk(APIC_VERBOSE, "... jiffies delta = %lu\n", deltaj); 679 apic_printk(APIC_VERBOSE, "... jiffies delta = %lu\n", deltaj);
@@ -692,8 +687,7 @@ static int __init calibrate_APIC_clock(void)
692 local_irq_enable(); 687 local_irq_enable();
693 688
694 if (levt->features & CLOCK_EVT_FEAT_DUMMY) { 689 if (levt->features & CLOCK_EVT_FEAT_DUMMY) {
695 printk(KERN_WARNING 690 pr_warning("APIC timer disabled due to verification failure.\n");
696 "APIC timer disabled due to verification failure.\n");
697 return -1; 691 return -1;
698 } 692 }
699 693
@@ -714,7 +708,7 @@ void __init setup_boot_APIC_clock(void)
714 * broadcast mechanism is used. On UP systems simply ignore it. 708 * broadcast mechanism is used. On UP systems simply ignore it.
715 */ 709 */
716 if (disable_apic_timer) { 710 if (disable_apic_timer) {
717 printk(KERN_INFO "Disabling APIC timer\n"); 711 pr_info("Disabling APIC timer\n");
718 /* No broadcast on UP ! */ 712 /* No broadcast on UP ! */
719 if (num_possible_cpus() > 1) { 713 if (num_possible_cpus() > 1) {
720 lapic_clockevent.mult = 1; 714 lapic_clockevent.mult = 1;
@@ -741,7 +735,7 @@ void __init setup_boot_APIC_clock(void)
741 if (nmi_watchdog != NMI_IO_APIC) 735 if (nmi_watchdog != NMI_IO_APIC)
742 lapic_clockevent.features &= ~CLOCK_EVT_FEAT_DUMMY; 736 lapic_clockevent.features &= ~CLOCK_EVT_FEAT_DUMMY;
743 else 737 else
744 printk(KERN_WARNING "APIC timer registered as dummy," 738 pr_warning("APIC timer registered as dummy,"
745 " due to nmi_watchdog=%d!\n", nmi_watchdog); 739 " due to nmi_watchdog=%d!\n", nmi_watchdog);
746 740
747 /* Setup the lapic or request the broadcast */ 741 /* Setup the lapic or request the broadcast */
@@ -773,8 +767,7 @@ static void local_apic_timer_interrupt(void)
773 * spurious. 767 * spurious.
774 */ 768 */
775 if (!evt->event_handler) { 769 if (!evt->event_handler) {
776 printk(KERN_WARNING 770 pr_warning("Spurious LAPIC timer interrupt on cpu %d\n", cpu);
777 "Spurious LAPIC timer interrupt on cpu %d\n", cpu);
778 /* Switch it off */ 771 /* Switch it off */
779 lapic_timer_setup(CLOCK_EVT_MODE_SHUTDOWN, evt); 772 lapic_timer_setup(CLOCK_EVT_MODE_SHUTDOWN, evt);
780 return; 773 return;
@@ -783,11 +776,7 @@ static void local_apic_timer_interrupt(void)
783 /* 776 /*
784 * the NMI deadlock-detector uses this. 777 * the NMI deadlock-detector uses this.
785 */ 778 */
786#ifdef CONFIG_X86_64 779 inc_irq_stat(apic_timer_irqs);
787 add_pda(apic_timer_irqs, 1);
788#else
789 per_cpu(irq_stat, cpu).apic_timer_irqs++;
790#endif
791 780
792 evt->event_handler(evt); 781 evt->event_handler(evt);
793} 782}
@@ -800,7 +789,7 @@ static void local_apic_timer_interrupt(void)
800 * [ if a single-CPU system runs an SMP kernel then we call the local 789 * [ if a single-CPU system runs an SMP kernel then we call the local
801 * interrupt as well. Thus we cannot inline the local irq ... ] 790 * interrupt as well. Thus we cannot inline the local irq ... ]
802 */ 791 */
803void smp_apic_timer_interrupt(struct pt_regs *regs) 792void __irq_entry smp_apic_timer_interrupt(struct pt_regs *regs)
804{ 793{
805 struct pt_regs *old_regs = set_irq_regs(regs); 794 struct pt_regs *old_regs = set_irq_regs(regs);
806 795
@@ -814,9 +803,7 @@ void smp_apic_timer_interrupt(struct pt_regs *regs)
814 * Besides, if we don't timer interrupts ignore the global 803 * Besides, if we don't timer interrupts ignore the global
815 * interrupt lock, which is the WrongThing (tm) to do. 804 * interrupt lock, which is the WrongThing (tm) to do.
816 */ 805 */
817#ifdef CONFIG_X86_64
818 exit_idle(); 806 exit_idle();
819#endif
820 irq_enter(); 807 irq_enter();
821 local_apic_timer_interrupt(); 808 local_apic_timer_interrupt();
822 irq_exit(); 809 irq_exit();
@@ -1093,7 +1080,7 @@ static void __cpuinit lapic_setup_esr(void)
1093 unsigned int oldvalue, value, maxlvt; 1080 unsigned int oldvalue, value, maxlvt;
1094 1081
1095 if (!lapic_is_integrated()) { 1082 if (!lapic_is_integrated()) {
1096 printk(KERN_INFO "No ESR for 82489DX.\n"); 1083 pr_info("No ESR for 82489DX.\n");
1097 return; 1084 return;
1098 } 1085 }
1099 1086
@@ -1104,7 +1091,7 @@ static void __cpuinit lapic_setup_esr(void)
1104 * ESR disabled - we can't do anything useful with the 1091 * ESR disabled - we can't do anything useful with the
1105 * errors anyway - mbligh 1092 * errors anyway - mbligh
1106 */ 1093 */
1107 printk(KERN_INFO "Leaving ESR disabled.\n"); 1094 pr_info("Leaving ESR disabled.\n");
1108 return; 1095 return;
1109 } 1096 }
1110 1097
@@ -1298,7 +1285,7 @@ void check_x2apic(void)
1298 rdmsr(MSR_IA32_APICBASE, msr, msr2); 1285 rdmsr(MSR_IA32_APICBASE, msr, msr2);
1299 1286
1300 if (msr & X2APIC_ENABLE) { 1287 if (msr & X2APIC_ENABLE) {
1301 printk("x2apic enabled by BIOS, switching to x2apic ops\n"); 1288 pr_info("x2apic enabled by BIOS, switching to x2apic ops\n");
1302 x2apic_preenabled = x2apic = 1; 1289 x2apic_preenabled = x2apic = 1;
1303 apic_ops = &x2apic_ops; 1290 apic_ops = &x2apic_ops;
1304 } 1291 }
@@ -1310,7 +1297,7 @@ void enable_x2apic(void)
1310 1297
1311 rdmsr(MSR_IA32_APICBASE, msr, msr2); 1298 rdmsr(MSR_IA32_APICBASE, msr, msr2);
1312 if (!(msr & X2APIC_ENABLE)) { 1299 if (!(msr & X2APIC_ENABLE)) {
1313 printk("Enabling x2apic\n"); 1300 pr_info("Enabling x2apic\n");
1314 wrmsr(MSR_IA32_APICBASE, msr | X2APIC_ENABLE, 0); 1301 wrmsr(MSR_IA32_APICBASE, msr | X2APIC_ENABLE, 0);
1315 } 1302 }
1316} 1303}
@@ -1325,9 +1312,8 @@ void __init enable_IR_x2apic(void)
1325 return; 1312 return;
1326 1313
1327 if (!x2apic_preenabled && disable_x2apic) { 1314 if (!x2apic_preenabled && disable_x2apic) {
1328 printk(KERN_INFO 1315 pr_info("Skipped enabling x2apic and Interrupt-remapping "
1329 "Skipped enabling x2apic and Interrupt-remapping " 1316 "because of nox2apic\n");
1330 "because of nox2apic\n");
1331 return; 1317 return;
1332 } 1318 }
1333 1319
@@ -1335,22 +1321,19 @@ void __init enable_IR_x2apic(void)
1335 panic("Bios already enabled x2apic, can't enforce nox2apic"); 1321 panic("Bios already enabled x2apic, can't enforce nox2apic");
1336 1322
1337 if (!x2apic_preenabled && skip_ioapic_setup) { 1323 if (!x2apic_preenabled && skip_ioapic_setup) {
1338 printk(KERN_INFO 1324 pr_info("Skipped enabling x2apic and Interrupt-remapping "
1339 "Skipped enabling x2apic and Interrupt-remapping " 1325 "because of skipping io-apic setup\n");
1340 "because of skipping io-apic setup\n");
1341 return; 1326 return;
1342 } 1327 }
1343 1328
1344 ret = dmar_table_init(); 1329 ret = dmar_table_init();
1345 if (ret) { 1330 if (ret) {
1346 printk(KERN_INFO 1331 pr_info("dmar_table_init() failed with %d:\n", ret);
1347 "dmar_table_init() failed with %d:\n", ret);
1348 1332
1349 if (x2apic_preenabled) 1333 if (x2apic_preenabled)
1350 panic("x2apic enabled by bios. But IR enabling failed"); 1334 panic("x2apic enabled by bios. But IR enabling failed");
1351 else 1335 else
1352 printk(KERN_INFO 1336 pr_info("Not enabling x2apic,Intr-remapping\n");
1353 "Not enabling x2apic,Intr-remapping\n");
1354 return; 1337 return;
1355 } 1338 }
1356 1339
@@ -1359,7 +1342,7 @@ void __init enable_IR_x2apic(void)
1359 1342
1360 ret = save_mask_IO_APIC_setup(); 1343 ret = save_mask_IO_APIC_setup();
1361 if (ret) { 1344 if (ret) {
1362 printk(KERN_INFO "Saving IO-APIC state failed: %d\n", ret); 1345 pr_info("Saving IO-APIC state failed: %d\n", ret);
1363 goto end; 1346 goto end;
1364 } 1347 }
1365 1348
@@ -1394,14 +1377,11 @@ end:
1394 1377
1395 if (!ret) { 1378 if (!ret) {
1396 if (!x2apic_preenabled) 1379 if (!x2apic_preenabled)
1397 printk(KERN_INFO 1380 pr_info("Enabled x2apic and interrupt-remapping\n");
1398 "Enabled x2apic and interrupt-remapping\n");
1399 else 1381 else
1400 printk(KERN_INFO 1382 pr_info("Enabled Interrupt-remapping\n");
1401 "Enabled Interrupt-remapping\n");
1402 } else 1383 } else
1403 printk(KERN_ERR 1384 pr_err("Failed to enable Interrupt-remapping and x2apic\n");
1404 "Failed to enable Interrupt-remapping and x2apic\n");
1405#else 1385#else
1406 if (!cpu_has_x2apic) 1386 if (!cpu_has_x2apic)
1407 return; 1387 return;
@@ -1410,8 +1390,8 @@ end:
1410 panic("x2apic enabled prior OS handover," 1390 panic("x2apic enabled prior OS handover,"
1411 " enable CONFIG_INTR_REMAP"); 1391 " enable CONFIG_INTR_REMAP");
1412 1392
1413 printk(KERN_INFO "Enable CONFIG_INTR_REMAP for enabling intr-remapping " 1393 pr_info("Enable CONFIG_INTR_REMAP for enabling intr-remapping "
1414 " and x2apic\n"); 1394 " and x2apic\n");
1415#endif 1395#endif
1416 1396
1417 return; 1397 return;
@@ -1428,7 +1408,7 @@ end:
1428static int __init detect_init_APIC(void) 1408static int __init detect_init_APIC(void)
1429{ 1409{
1430 if (!cpu_has_apic) { 1410 if (!cpu_has_apic) {
1431 printk(KERN_INFO "No local APIC present\n"); 1411 pr_info("No local APIC present\n");
1432 return -1; 1412 return -1;
1433 } 1413 }
1434 1414
@@ -1469,8 +1449,8 @@ static int __init detect_init_APIC(void)
1469 * "lapic" specified. 1449 * "lapic" specified.
1470 */ 1450 */
1471 if (!force_enable_local_apic) { 1451 if (!force_enable_local_apic) {
1472 printk(KERN_INFO "Local APIC disabled by BIOS -- " 1452 pr_info("Local APIC disabled by BIOS -- "
1473 "you can enable it with \"lapic\"\n"); 1453 "you can enable it with \"lapic\"\n");
1474 return -1; 1454 return -1;
1475 } 1455 }
1476 /* 1456 /*
@@ -1480,8 +1460,7 @@ static int __init detect_init_APIC(void)
1480 */ 1460 */
1481 rdmsr(MSR_IA32_APICBASE, l, h); 1461 rdmsr(MSR_IA32_APICBASE, l, h);
1482 if (!(l & MSR_IA32_APICBASE_ENABLE)) { 1462 if (!(l & MSR_IA32_APICBASE_ENABLE)) {
1483 printk(KERN_INFO 1463 pr_info("Local APIC disabled by BIOS -- reenabling.\n");
1484 "Local APIC disabled by BIOS -- reenabling.\n");
1485 l &= ~MSR_IA32_APICBASE_BASE; 1464 l &= ~MSR_IA32_APICBASE_BASE;
1486 l |= MSR_IA32_APICBASE_ENABLE | APIC_DEFAULT_PHYS_BASE; 1465 l |= MSR_IA32_APICBASE_ENABLE | APIC_DEFAULT_PHYS_BASE;
1487 wrmsr(MSR_IA32_APICBASE, l, h); 1466 wrmsr(MSR_IA32_APICBASE, l, h);
@@ -1494,7 +1473,7 @@ static int __init detect_init_APIC(void)
1494 */ 1473 */
1495 features = cpuid_edx(1); 1474 features = cpuid_edx(1);
1496 if (!(features & (1 << X86_FEATURE_APIC))) { 1475 if (!(features & (1 << X86_FEATURE_APIC))) {
1497 printk(KERN_WARNING "Could not enable APIC!\n"); 1476 pr_warning("Could not enable APIC!\n");
1498 return -1; 1477 return -1;
1499 } 1478 }
1500 set_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC); 1479 set_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
@@ -1505,14 +1484,14 @@ static int __init detect_init_APIC(void)
1505 if (l & MSR_IA32_APICBASE_ENABLE) 1484 if (l & MSR_IA32_APICBASE_ENABLE)
1506 mp_lapic_addr = l & MSR_IA32_APICBASE_BASE; 1485 mp_lapic_addr = l & MSR_IA32_APICBASE_BASE;
1507 1486
1508 printk(KERN_INFO "Found and enabled local APIC!\n"); 1487 pr_info("Found and enabled local APIC!\n");
1509 1488
1510 apic_pm_activate(); 1489 apic_pm_activate();
1511 1490
1512 return 0; 1491 return 0;
1513 1492
1514no_apic: 1493no_apic:
1515 printk(KERN_INFO "No local APIC present or hardware disabled\n"); 1494 pr_info("No local APIC present or hardware disabled\n");
1516 return -1; 1495 return -1;
1517} 1496}
1518#endif 1497#endif
@@ -1588,12 +1567,12 @@ int __init APIC_init_uniprocessor(void)
1588{ 1567{
1589#ifdef CONFIG_X86_64 1568#ifdef CONFIG_X86_64
1590 if (disable_apic) { 1569 if (disable_apic) {
1591 printk(KERN_INFO "Apic disabled\n"); 1570 pr_info("Apic disabled\n");
1592 return -1; 1571 return -1;
1593 } 1572 }
1594 if (!cpu_has_apic) { 1573 if (!cpu_has_apic) {
1595 disable_apic = 1; 1574 disable_apic = 1;
1596 printk(KERN_INFO "Apic disabled by BIOS\n"); 1575 pr_info("Apic disabled by BIOS\n");
1597 return -1; 1576 return -1;
1598 } 1577 }
1599#else 1578#else
@@ -1605,8 +1584,8 @@ int __init APIC_init_uniprocessor(void)
1605 */ 1584 */
1606 if (!cpu_has_apic && 1585 if (!cpu_has_apic &&
1607 APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) { 1586 APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) {
1608 printk(KERN_ERR "BIOS bug, local APIC 0x%x not detected!...\n", 1587 pr_err("BIOS bug, local APIC 0x%x not detected!...\n",
1609 boot_cpu_physical_apicid); 1588 boot_cpu_physical_apicid);
1610 clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC); 1589 clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
1611 return -1; 1590 return -1;
1612 } 1591 }
@@ -1682,9 +1661,7 @@ void smp_spurious_interrupt(struct pt_regs *regs)
1682{ 1661{
1683 u32 v; 1662 u32 v;
1684 1663
1685#ifdef CONFIG_X86_64
1686 exit_idle(); 1664 exit_idle();
1687#endif
1688 irq_enter(); 1665 irq_enter();
1689 /* 1666 /*
1690 * Check if this really is a spurious interrupt and ACK it 1667 * Check if this really is a spurious interrupt and ACK it
@@ -1695,14 +1672,11 @@ void smp_spurious_interrupt(struct pt_regs *regs)
1695 if (v & (1 << (SPURIOUS_APIC_VECTOR & 0x1f))) 1672 if (v & (1 << (SPURIOUS_APIC_VECTOR & 0x1f)))
1696 ack_APIC_irq(); 1673 ack_APIC_irq();
1697 1674
1698#ifdef CONFIG_X86_64 1675 inc_irq_stat(irq_spurious_count);
1699 add_pda(irq_spurious_count, 1); 1676
1700#else
1701 /* see sw-dev-man vol 3, chapter 7.4.13.5 */ 1677 /* see sw-dev-man vol 3, chapter 7.4.13.5 */
1702 printk(KERN_INFO "spurious APIC interrupt on CPU#%d, " 1678 pr_info("spurious APIC interrupt on CPU#%d, "
1703 "should never happen.\n", smp_processor_id()); 1679 "should never happen.\n", smp_processor_id());
1704 __get_cpu_var(irq_stat).irq_spurious_count++;
1705#endif
1706 irq_exit(); 1680 irq_exit();
1707} 1681}
1708 1682
@@ -1713,9 +1687,7 @@ void smp_error_interrupt(struct pt_regs *regs)
1713{ 1687{
1714 u32 v, v1; 1688 u32 v, v1;
1715 1689
1716#ifdef CONFIG_X86_64
1717 exit_idle(); 1690 exit_idle();
1718#endif
1719 irq_enter(); 1691 irq_enter();
1720 /* First tickle the hardware, only then report what went on. -- REW */ 1692 /* First tickle the hardware, only then report what went on. -- REW */
1721 v = apic_read(APIC_ESR); 1693 v = apic_read(APIC_ESR);
@@ -1724,17 +1696,18 @@ void smp_error_interrupt(struct pt_regs *regs)
1724 ack_APIC_irq(); 1696 ack_APIC_irq();
1725 atomic_inc(&irq_err_count); 1697 atomic_inc(&irq_err_count);
1726 1698
1727 /* Here is what the APIC error bits mean: 1699 /*
1728 0: Send CS error 1700 * Here is what the APIC error bits mean:
1729 1: Receive CS error 1701 * 0: Send CS error
1730 2: Send accept error 1702 * 1: Receive CS error
1731 3: Receive accept error 1703 * 2: Send accept error
1732 4: Reserved 1704 * 3: Receive accept error
1733 5: Send illegal vector 1705 * 4: Reserved
1734 6: Received illegal vector 1706 * 5: Send illegal vector
1735 7: Illegal register address 1707 * 6: Received illegal vector
1736 */ 1708 * 7: Illegal register address
1737 printk(KERN_DEBUG "APIC error on CPU%d: %02x(%02x)\n", 1709 */
1710 pr_debug("APIC error on CPU%d: %02x(%02x)\n",
1738 smp_processor_id(), v , v1); 1711 smp_processor_id(), v , v1);
1739 irq_exit(); 1712 irq_exit();
1740} 1713}
@@ -1832,28 +1805,32 @@ void disconnect_bsp_APIC(int virt_wire_setup)
1832void __cpuinit generic_processor_info(int apicid, int version) 1805void __cpuinit generic_processor_info(int apicid, int version)
1833{ 1806{
1834 int cpu; 1807 int cpu;
1835 cpumask_t tmp_map;
1836 1808
1837 /* 1809 /*
1838 * Validate version 1810 * Validate version
1839 */ 1811 */
1840 if (version == 0x0) { 1812 if (version == 0x0) {
1841 printk(KERN_WARNING "BIOS bug, APIC version is 0 for CPU#%d! " 1813 pr_warning("BIOS bug, APIC version is 0 for CPU#%d! "
1842 "fixing up to 0x10. (tell your hw vendor)\n", 1814 "fixing up to 0x10. (tell your hw vendor)\n",
1843 version); 1815 version);
1844 version = 0x10; 1816 version = 0x10;
1845 } 1817 }
1846 apic_version[apicid] = version; 1818 apic_version[apicid] = version;
1847 1819
1848 if (num_processors >= NR_CPUS) { 1820 if (num_processors >= nr_cpu_ids) {
1849 printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached." 1821 int max = nr_cpu_ids;
1850 " Processor ignored.\n", NR_CPUS); 1822 int thiscpu = max + disabled_cpus;
1823
1824 pr_warning(
1825 "ACPI: NR_CPUS/possible_cpus limit of %i reached."
1826 " Processor %d/0x%x ignored.\n", max, thiscpu, apicid);
1827
1828 disabled_cpus++;
1851 return; 1829 return;
1852 } 1830 }
1853 1831
1854 num_processors++; 1832 num_processors++;
1855 cpus_complement(tmp_map, cpu_present_map); 1833 cpu = cpumask_next_zero(-1, cpu_present_mask);
1856 cpu = first_cpu(tmp_map);
1857 1834
1858 physid_set(apicid, phys_cpu_present_map); 1835 physid_set(apicid, phys_cpu_present_map);
1859 if (apicid == boot_cpu_physical_apicid) { 1836 if (apicid == boot_cpu_physical_apicid) {
@@ -1903,8 +1880,8 @@ void __cpuinit generic_processor_info(int apicid, int version)
1903 } 1880 }
1904#endif 1881#endif
1905 1882
1906 cpu_set(cpu, cpu_possible_map); 1883 set_cpu_possible(cpu, true);
1907 cpu_set(cpu, cpu_present_map); 1884 set_cpu_present(cpu, true);
1908} 1885}
1909 1886
1910#ifdef CONFIG_X86_64 1887#ifdef CONFIG_X86_64
@@ -2106,7 +2083,7 @@ __cpuinit int apic_is_clustered_box(void)
2106 bios_cpu_apicid = early_per_cpu_ptr(x86_bios_cpu_apicid); 2083 bios_cpu_apicid = early_per_cpu_ptr(x86_bios_cpu_apicid);
2107 bitmap_zero(clustermap, NUM_APIC_CLUSTERS); 2084 bitmap_zero(clustermap, NUM_APIC_CLUSTERS);
2108 2085
2109 for (i = 0; i < NR_CPUS; i++) { 2086 for (i = 0; i < nr_cpu_ids; i++) {
2110 /* are we being called early in kernel startup? */ 2087 /* are we being called early in kernel startup? */
2111 if (bios_cpu_apicid) { 2088 if (bios_cpu_apicid) {
2112 id = bios_cpu_apicid[i]; 2089 id = bios_cpu_apicid[i];
@@ -2209,7 +2186,7 @@ static int __init apic_set_verbosity(char *arg)
2209 else if (strcmp("verbose", arg) == 0) 2186 else if (strcmp("verbose", arg) == 0)
2210 apic_verbosity = APIC_VERBOSE; 2187 apic_verbosity = APIC_VERBOSE;
2211 else { 2188 else {
2212 printk(KERN_WARNING "APIC Verbosity level %s not recognised" 2189 pr_warning("APIC Verbosity level %s not recognised"
2213 " use apic=verbose or apic=debug\n", arg); 2190 " use apic=verbose or apic=debug\n", arg);
2214 return -EINVAL; 2191 return -EINVAL;
2215 } 2192 }
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 5145a6e72bbb..3a26525a3f31 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -391,11 +391,7 @@ static int power_off;
391#else 391#else
392static int power_off = 1; 392static int power_off = 1;
393#endif 393#endif
394#ifdef CONFIG_APM_REAL_MODE_POWER_OFF
395static int realmode_power_off = 1;
396#else
397static int realmode_power_off; 394static int realmode_power_off;
398#endif
399#ifdef CONFIG_APM_ALLOW_INTS 395#ifdef CONFIG_APM_ALLOW_INTS
400static int allow_ints = 1; 396static int allow_ints = 1;
401#else 397#else
diff --git a/arch/x86/kernel/asm-offsets_32.c b/arch/x86/kernel/asm-offsets_32.c
index 6649d09ad88f..ee4df08feee6 100644
--- a/arch/x86/kernel/asm-offsets_32.c
+++ b/arch/x86/kernel/asm-offsets_32.c
@@ -11,7 +11,7 @@
11#include <linux/suspend.h> 11#include <linux/suspend.h>
12#include <linux/kbuild.h> 12#include <linux/kbuild.h>
13#include <asm/ucontext.h> 13#include <asm/ucontext.h>
14#include "sigframe.h" 14#include <asm/sigframe.h>
15#include <asm/pgtable.h> 15#include <asm/pgtable.h>
16#include <asm/fixmap.h> 16#include <asm/fixmap.h>
17#include <asm/processor.h> 17#include <asm/processor.h>
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
index 7fcf63d22f8b..1d41d3f1edbc 100644
--- a/arch/x86/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
@@ -20,6 +20,8 @@
20 20
21#include <xen/interface/xen.h> 21#include <xen/interface/xen.h>
22 22
23#include <asm/sigframe.h>
24
23#define __NO_STUBS 1 25#define __NO_STUBS 1
24#undef __SYSCALL 26#undef __SYSCALL
25#undef _ASM_X86_UNISTD_64_H 27#undef _ASM_X86_UNISTD_64_H
@@ -87,7 +89,7 @@ int main(void)
87 BLANK(); 89 BLANK();
88#undef ENTRY 90#undef ENTRY
89 DEFINE(IA32_RT_SIGFRAME_sigcontext, 91 DEFINE(IA32_RT_SIGFRAME_sigcontext,
90 offsetof (struct rt_sigframe32, uc.uc_mcontext)); 92 offsetof (struct rt_sigframe_ia32, uc.uc_mcontext));
91 BLANK(); 93 BLANK();
92#endif 94#endif
93 DEFINE(pbe_address, offsetof(struct pbe, address)); 95 DEFINE(pbe_address, offsetof(struct pbe, address));
diff --git a/arch/x86/kernel/bios_uv.c b/arch/x86/kernel/bios_uv.c
index f0dfe6f17e7e..f63882728d91 100644
--- a/arch/x86/kernel/bios_uv.c
+++ b/arch/x86/kernel/bios_uv.c
@@ -25,7 +25,7 @@
25#include <asm/uv/bios.h> 25#include <asm/uv/bios.h>
26#include <asm/uv/uv_hub.h> 26#include <asm/uv/uv_hub.h>
27 27
28struct uv_systab uv_systab; 28static struct uv_systab uv_systab;
29 29
30s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5) 30s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5)
31{ 31{
@@ -69,10 +69,10 @@ s64 uv_bios_call_reentrant(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3,
69 69
70long sn_partition_id; 70long sn_partition_id;
71EXPORT_SYMBOL_GPL(sn_partition_id); 71EXPORT_SYMBOL_GPL(sn_partition_id);
72long uv_coherency_id; 72long sn_coherency_id;
73EXPORT_SYMBOL_GPL(uv_coherency_id); 73EXPORT_SYMBOL_GPL(sn_coherency_id);
74long uv_region_size; 74long sn_region_size;
75EXPORT_SYMBOL_GPL(uv_region_size); 75EXPORT_SYMBOL_GPL(sn_region_size);
76int uv_type; 76int uv_type;
77 77
78 78
@@ -100,6 +100,56 @@ s64 uv_bios_get_sn_info(int fc, int *uvtype, long *partid, long *coher,
100 return ret; 100 return ret;
101} 101}
102 102
103int
104uv_bios_mq_watchlist_alloc(int blade, unsigned long addr, unsigned int mq_size,
105 unsigned long *intr_mmr_offset)
106{
107 union uv_watchlist_u size_blade;
108 u64 watchlist;
109 s64 ret;
110
111 size_blade.size = mq_size;
112 size_blade.blade = blade;
113
114 /*
115 * bios returns watchlist number or negative error number.
116 */
117 ret = (int)uv_bios_call_irqsave(UV_BIOS_WATCHLIST_ALLOC, addr,
118 size_blade.val, (u64)intr_mmr_offset,
119 (u64)&watchlist, 0);
120 if (ret < BIOS_STATUS_SUCCESS)
121 return ret;
122
123 return watchlist;
124}
125EXPORT_SYMBOL_GPL(uv_bios_mq_watchlist_alloc);
126
127int
128uv_bios_mq_watchlist_free(int blade, int watchlist_num)
129{
130 return (int)uv_bios_call_irqsave(UV_BIOS_WATCHLIST_FREE,
131 blade, watchlist_num, 0, 0, 0);
132}
133EXPORT_SYMBOL_GPL(uv_bios_mq_watchlist_free);
134
135s64
136uv_bios_change_memprotect(u64 paddr, u64 len, enum uv_memprotect perms)
137{
138 return uv_bios_call_irqsave(UV_BIOS_MEMPROTECT, paddr, len,
139 perms, 0, 0);
140}
141EXPORT_SYMBOL_GPL(uv_bios_change_memprotect);
142
143s64
144uv_bios_reserved_page_pa(u64 buf, u64 *cookie, u64 *addr, u64 *len)
145{
146 s64 ret;
147
148 ret = uv_bios_call_irqsave(UV_BIOS_GET_PARTITION_ADDR, (u64)cookie,
149 (u64)addr, buf, (u64)len, 0);
150 return ret;
151}
152EXPORT_SYMBOL_GPL(uv_bios_reserved_page_pa);
103 153
104s64 uv_bios_freq_base(u64 clock_type, u64 *ticks_per_second) 154s64 uv_bios_freq_base(u64 clock_type, u64 *ticks_per_second)
105{ 155{
diff --git a/arch/x86/kernel/check.c b/arch/x86/kernel/check.c
new file mode 100644
index 000000000000..2ac0ab71412a
--- /dev/null
+++ b/arch/x86/kernel/check.c
@@ -0,0 +1,161 @@
1#include <linux/module.h>
2#include <linux/sched.h>
3#include <linux/kthread.h>
4#include <linux/workqueue.h>
5#include <asm/e820.h>
6#include <asm/proto.h>
7
8/*
9 * Some BIOSes seem to corrupt the low 64k of memory during events
10 * like suspend/resume and unplugging an HDMI cable. Reserve all
11 * remaining free memory in that area and fill it with a distinct
12 * pattern.
13 */
14#define MAX_SCAN_AREAS 8
15
16static int __read_mostly memory_corruption_check = -1;
17
18static unsigned __read_mostly corruption_check_size = 64*1024;
19static unsigned __read_mostly corruption_check_period = 60; /* seconds */
20
21static struct e820entry scan_areas[MAX_SCAN_AREAS];
22static int num_scan_areas;
23
24
25static __init int set_corruption_check(char *arg)
26{
27 char *end;
28
29 memory_corruption_check = simple_strtol(arg, &end, 10);
30
31 return (*end == 0) ? 0 : -EINVAL;
32}
33early_param("memory_corruption_check", set_corruption_check);
34
35static __init int set_corruption_check_period(char *arg)
36{
37 char *end;
38
39 corruption_check_period = simple_strtoul(arg, &end, 10);
40
41 return (*end == 0) ? 0 : -EINVAL;
42}
43early_param("memory_corruption_check_period", set_corruption_check_period);
44
45static __init int set_corruption_check_size(char *arg)
46{
47 char *end;
48 unsigned size;
49
50 size = memparse(arg, &end);
51
52 if (*end == '\0')
53 corruption_check_size = size;
54
55 return (size == corruption_check_size) ? 0 : -EINVAL;
56}
57early_param("memory_corruption_check_size", set_corruption_check_size);
58
59
60void __init setup_bios_corruption_check(void)
61{
62 u64 addr = PAGE_SIZE; /* assume first page is reserved anyway */
63
64 if (memory_corruption_check == -1) {
65 memory_corruption_check =
66#ifdef CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK
67 1
68#else
69 0
70#endif
71 ;
72 }
73
74 if (corruption_check_size == 0)
75 memory_corruption_check = 0;
76
77 if (!memory_corruption_check)
78 return;
79
80 corruption_check_size = round_up(corruption_check_size, PAGE_SIZE);
81
82 while (addr < corruption_check_size && num_scan_areas < MAX_SCAN_AREAS) {
83 u64 size;
84 addr = find_e820_area_size(addr, &size, PAGE_SIZE);
85
86 if (addr == 0)
87 break;
88
89 if ((addr + size) > corruption_check_size)
90 size = corruption_check_size - addr;
91
92 if (size == 0)
93 break;
94
95 e820_update_range(addr, size, E820_RAM, E820_RESERVED);
96 scan_areas[num_scan_areas].addr = addr;
97 scan_areas[num_scan_areas].size = size;
98 num_scan_areas++;
99
100 /* Assume we've already mapped this early memory */
101 memset(__va(addr), 0, size);
102
103 addr += size;
104 }
105
106 printk(KERN_INFO "Scanning %d areas for low memory corruption\n",
107 num_scan_areas);
108 update_e820();
109}
110
111
112void check_for_bios_corruption(void)
113{
114 int i;
115 int corruption = 0;
116
117 if (!memory_corruption_check)
118 return;
119
120 for (i = 0; i < num_scan_areas; i++) {
121 unsigned long *addr = __va(scan_areas[i].addr);
122 unsigned long size = scan_areas[i].size;
123
124 for (; size; addr++, size -= sizeof(unsigned long)) {
125 if (!*addr)
126 continue;
127 printk(KERN_ERR "Corrupted low memory at %p (%lx phys) = %08lx\n",
128 addr, __pa(addr), *addr);
129 corruption = 1;
130 *addr = 0;
131 }
132 }
133
134 WARN_ONCE(corruption, KERN_ERR "Memory corruption detected in low memory\n");
135}
136
137static void check_corruption(struct work_struct *dummy);
138static DECLARE_DELAYED_WORK(bios_check_work, check_corruption);
139
140static void check_corruption(struct work_struct *dummy)
141{
142 check_for_bios_corruption();
143 schedule_delayed_work(&bios_check_work,
144 round_jiffies_relative(corruption_check_period*HZ));
145}
146
147static int start_periodic_check_for_corruption(void)
148{
149 if (!memory_corruption_check || corruption_check_period == 0)
150 return 0;
151
152 printk(KERN_INFO "Scanning for low memory corruption every %d seconds\n",
153 corruption_check_period);
154
155 /* First time we run the checks right away */
156 schedule_delayed_work(&bios_check_work, 0);
157 return 0;
158}
159
160module_init(start_periodic_check_for_corruption);
161
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
index 82ec6075c057..82db7f45e2de 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -2,8 +2,14 @@
2# Makefile for x86-compatible CPU details and quirks 2# Makefile for x86-compatible CPU details and quirks
3# 3#
4 4
5# Don't trace early stages of a secondary CPU boot
6ifdef CONFIG_FUNCTION_TRACER
7CFLAGS_REMOVE_common.o = -pg
8endif
9
5obj-y := intel_cacheinfo.o addon_cpuid_features.o 10obj-y := intel_cacheinfo.o addon_cpuid_features.o
6obj-y += proc.o capflags.o powerflags.o common.o 11obj-y += proc.o capflags.o powerflags.o common.o
12obj-y += vmware.o hypervisor.o
7 13
8obj-$(CONFIG_X86_32) += bugs.o cmpxchg.o 14obj-$(CONFIG_X86_32) += bugs.o cmpxchg.o
9obj-$(CONFIG_X86_64) += bugs_64.o 15obj-$(CONFIG_X86_64) += bugs_64.o
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c
index ef8f831af823..2cf23634b6d9 100644
--- a/arch/x86/kernel/cpu/addon_cpuid_features.c
+++ b/arch/x86/kernel/cpu/addon_cpuid_features.c
@@ -120,9 +120,17 @@ void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c)
120 c->cpu_core_id = phys_pkg_id(c->initial_apicid, ht_mask_width) 120 c->cpu_core_id = phys_pkg_id(c->initial_apicid, ht_mask_width)
121 & core_select_mask; 121 & core_select_mask;
122 c->phys_proc_id = phys_pkg_id(c->initial_apicid, core_plus_mask_width); 122 c->phys_proc_id = phys_pkg_id(c->initial_apicid, core_plus_mask_width);
123 /*
124 * Reinit the apicid, now that we have extended initial_apicid.
125 */
126 c->apicid = phys_pkg_id(c->initial_apicid, 0);
123#else 127#else
124 c->cpu_core_id = phys_pkg_id(ht_mask_width) & core_select_mask; 128 c->cpu_core_id = phys_pkg_id(ht_mask_width) & core_select_mask;
125 c->phys_proc_id = phys_pkg_id(core_plus_mask_width); 129 c->phys_proc_id = phys_pkg_id(core_plus_mask_width);
130 /*
131 * Reinit the apicid, now that we have extended initial_apicid.
132 */
133 c->apicid = phys_pkg_id(0);
126#endif 134#endif
127 c->x86_max_cores = (core_level_siblings / smp_num_siblings); 135 c->x86_max_cores = (core_level_siblings / smp_num_siblings);
128 136
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 8f1e31db2ad5..7c878f6aa919 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -283,9 +283,14 @@ static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
283{ 283{
284 early_init_amd_mc(c); 284 early_init_amd_mc(c);
285 285
286 /* c->x86_power is 8000_0007 edx. Bit 8 is constant TSC */ 286 /*
287 if (c->x86_power & (1<<8)) 287 * c->x86_power is 8000_0007 edx. Bit 8 is TSC runs at constant rate
288 * with P/T states and does not stop in deep C-states
289 */
290 if (c->x86_power & (1 << 8)) {
288 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); 291 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
292 set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
293 }
289 294
290#ifdef CONFIG_X86_64 295#ifdef CONFIG_X86_64
291 set_cpu_cap(c, X86_FEATURE_SYSCALL32); 296 set_cpu_cap(c, X86_FEATURE_SYSCALL32);
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index b9c9ea0217a9..3f95a40f718a 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -36,6 +36,7 @@
36#include <asm/proto.h> 36#include <asm/proto.h>
37#include <asm/sections.h> 37#include <asm/sections.h>
38#include <asm/setup.h> 38#include <asm/setup.h>
39#include <asm/hypervisor.h>
39 40
40#include "cpu.h" 41#include "cpu.h"
41 42
@@ -354,7 +355,7 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c)
354 printk(KERN_INFO "CPU: Hyper-Threading is disabled\n"); 355 printk(KERN_INFO "CPU: Hyper-Threading is disabled\n");
355 } else if (smp_num_siblings > 1) { 356 } else if (smp_num_siblings > 1) {
356 357
357 if (smp_num_siblings > NR_CPUS) { 358 if (smp_num_siblings > nr_cpu_ids) {
358 printk(KERN_WARNING "CPU: Unsupported number of siblings %d", 359 printk(KERN_WARNING "CPU: Unsupported number of siblings %d",
359 smp_num_siblings); 360 smp_num_siblings);
360 smp_num_siblings = 1; 361 smp_num_siblings = 1;
@@ -703,6 +704,7 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
703 detect_ht(c); 704 detect_ht(c);
704#endif 705#endif
705 706
707 init_hypervisor(c);
706 /* 708 /*
707 * On SMP, boot_cpu_data holds the common feature set between 709 * On SMP, boot_cpu_data holds the common feature set between
708 * all CPUs; so make sure that we indicate which features are 710 * all CPUs; so make sure that we indicate which features are
@@ -862,7 +864,7 @@ EXPORT_SYMBOL(_cpu_pda);
862 864
863struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table }; 865struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table };
864 866
865char boot_cpu_stack[IRQSTACKSIZE] __page_aligned_bss; 867static char boot_cpu_stack[IRQSTACKSIZE] __page_aligned_bss;
866 868
867void __cpuinit pda_init(int cpu) 869void __cpuinit pda_init(int cpu)
868{ 870{
@@ -903,8 +905,8 @@ void __cpuinit pda_init(int cpu)
903 } 905 }
904} 906}
905 907
906char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + 908static char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ +
907 DEBUG_STKSZ] __page_aligned_bss; 909 DEBUG_STKSZ] __page_aligned_bss;
908 910
909extern asmlinkage void ignore_sysret(void); 911extern asmlinkage void ignore_sysret(void);
910 912
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
index 8e48c5d4467d..28102ad1a363 100644
--- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -33,6 +33,7 @@
33#include <linux/cpufreq.h> 33#include <linux/cpufreq.h>
34#include <linux/compiler.h> 34#include <linux/compiler.h>
35#include <linux/dmi.h> 35#include <linux/dmi.h>
36#include <linux/ftrace.h>
36 37
37#include <linux/acpi.h> 38#include <linux/acpi.h>
38#include <acpi/processor.h> 39#include <acpi/processor.h>
@@ -391,6 +392,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
391 unsigned int next_perf_state = 0; /* Index into perf table */ 392 unsigned int next_perf_state = 0; /* Index into perf table */
392 unsigned int i; 393 unsigned int i;
393 int result = 0; 394 int result = 0;
395 struct power_trace it;
394 396
395 dprintk("acpi_cpufreq_target %d (%d)\n", target_freq, policy->cpu); 397 dprintk("acpi_cpufreq_target %d (%d)\n", target_freq, policy->cpu);
396 398
@@ -427,6 +429,8 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
427 } 429 }
428 } 430 }
429 431
432 trace_power_mark(&it, POWER_PSTATE, next_perf_state);
433
430 switch (data->cpu_feature) { 434 switch (data->cpu_feature) {
431 case SYSTEM_INTEL_MSR_CAPABLE: 435 case SYSTEM_INTEL_MSR_CAPABLE:
432 cmd.type = SYSTEM_INTEL_MSR_CAPABLE; 436 cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
@@ -513,6 +517,17 @@ acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu)
513 } 517 }
514} 518}
515 519
520static void free_acpi_perf_data(void)
521{
522 unsigned int i;
523
524 /* Freeing a NULL pointer is OK, and alloc_percpu zeroes. */
525 for_each_possible_cpu(i)
526 free_cpumask_var(per_cpu_ptr(acpi_perf_data, i)
527 ->shared_cpu_map);
528 free_percpu(acpi_perf_data);
529}
530
516/* 531/*
517 * acpi_cpufreq_early_init - initialize ACPI P-States library 532 * acpi_cpufreq_early_init - initialize ACPI P-States library
518 * 533 *
@@ -523,6 +538,7 @@ acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu)
523 */ 538 */
524static int __init acpi_cpufreq_early_init(void) 539static int __init acpi_cpufreq_early_init(void)
525{ 540{
541 unsigned int i;
526 dprintk("acpi_cpufreq_early_init\n"); 542 dprintk("acpi_cpufreq_early_init\n");
527 543
528 acpi_perf_data = alloc_percpu(struct acpi_processor_performance); 544 acpi_perf_data = alloc_percpu(struct acpi_processor_performance);
@@ -530,6 +546,16 @@ static int __init acpi_cpufreq_early_init(void)
530 dprintk("Memory allocation error for acpi_perf_data.\n"); 546 dprintk("Memory allocation error for acpi_perf_data.\n");
531 return -ENOMEM; 547 return -ENOMEM;
532 } 548 }
549 for_each_possible_cpu(i) {
550 if (!alloc_cpumask_var_node(
551 &per_cpu_ptr(acpi_perf_data, i)->shared_cpu_map,
552 GFP_KERNEL, cpu_to_node(i))) {
553
554 /* Freeing a NULL pointer is OK: alloc_percpu zeroes. */
555 free_acpi_perf_data();
556 return -ENOMEM;
557 }
558 }
533 559
534 /* Do initialization in ACPI core */ 560 /* Do initialization in ACPI core */
535 acpi_processor_preregister_performance(acpi_perf_data); 561 acpi_processor_preregister_performance(acpi_perf_data);
@@ -600,9 +626,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
600 */ 626 */
601 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL || 627 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL ||
602 policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) { 628 policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {
603 policy->cpus = perf->shared_cpu_map; 629 cpumask_copy(&policy->cpus, perf->shared_cpu_map);
604 } 630 }
605 policy->related_cpus = perf->shared_cpu_map; 631 cpumask_copy(&policy->related_cpus, perf->shared_cpu_map);
606 632
607#ifdef CONFIG_SMP 633#ifdef CONFIG_SMP
608 dmi_check_system(sw_any_bug_dmi_table); 634 dmi_check_system(sw_any_bug_dmi_table);
@@ -791,7 +817,7 @@ static int __init acpi_cpufreq_init(void)
791 817
792 ret = cpufreq_register_driver(&acpi_cpufreq_driver); 818 ret = cpufreq_register_driver(&acpi_cpufreq_driver);
793 if (ret) 819 if (ret)
794 free_percpu(acpi_perf_data); 820 free_acpi_perf_data();
795 821
796 return ret; 822 return ret;
797} 823}
diff --git a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
index b8e05ee4f736..beea4466b063 100644
--- a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
+++ b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
@@ -160,6 +160,7 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
160 switch (c->x86_model) { 160 switch (c->x86_model) {
161 case 0x0E: /* Core */ 161 case 0x0E: /* Core */
162 case 0x0F: /* Core Duo */ 162 case 0x0F: /* Core Duo */
163 case 0x16: /* Celeron Core */
163 p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS; 164 p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS;
164 return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PCORE); 165 return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PCORE);
165 case 0x0D: /* Pentium M (Dothan) */ 166 case 0x0D: /* Pentium M (Dothan) */
@@ -171,7 +172,9 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
171 } 172 }
172 173
173 if (c->x86 != 0xF) { 174 if (c->x86 != 0xF) {
174 printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. Please send an e-mail to <cpufreq@vger.kernel.org>\n"); 175 if (!cpu_has(c, X86_FEATURE_EST))
176 printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. "
177 "Please send an e-mail to <cpufreq@vger.kernel.org>\n");
175 return 0; 178 return 0;
176 } 179 }
177 180
@@ -274,6 +277,7 @@ static struct cpufreq_driver p4clockmod_driver = {
274 .name = "p4-clockmod", 277 .name = "p4-clockmod",
275 .owner = THIS_MODULE, 278 .owner = THIS_MODULE,
276 .attr = p4clockmod_attr, 279 .attr = p4clockmod_attr,
280 .hide_interface = 1,
277}; 281};
278 282
279 283
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k7.c b/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
index 7c7d56b43136..1b446d79a8fd 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
@@ -310,6 +310,12 @@ static int powernow_acpi_init(void)
310 goto err0; 310 goto err0;
311 } 311 }
312 312
313 if (!alloc_cpumask_var(&acpi_processor_perf->shared_cpu_map,
314 GFP_KERNEL)) {
315 retval = -ENOMEM;
316 goto err05;
317 }
318
313 if (acpi_processor_register_performance(acpi_processor_perf, 0)) { 319 if (acpi_processor_register_performance(acpi_processor_perf, 0)) {
314 retval = -EIO; 320 retval = -EIO;
315 goto err1; 321 goto err1;
@@ -412,6 +418,8 @@ static int powernow_acpi_init(void)
412err2: 418err2:
413 acpi_processor_unregister_performance(acpi_processor_perf, 0); 419 acpi_processor_unregister_performance(acpi_processor_perf, 0);
414err1: 420err1:
421 free_cpumask_var(acpi_processor_perf->shared_cpu_map);
422err05:
415 kfree(acpi_processor_perf); 423 kfree(acpi_processor_perf);
416err0: 424err0:
417 printk(KERN_WARNING PFX "ACPI perflib can not be used in this platform\n"); 425 printk(KERN_WARNING PFX "ACPI perflib can not be used in this platform\n");
@@ -652,6 +660,7 @@ static int powernow_cpu_exit (struct cpufreq_policy *policy) {
652#ifdef CONFIG_X86_POWERNOW_K7_ACPI 660#ifdef CONFIG_X86_POWERNOW_K7_ACPI
653 if (acpi_processor_perf) { 661 if (acpi_processor_perf) {
654 acpi_processor_unregister_performance(acpi_processor_perf, 0); 662 acpi_processor_unregister_performance(acpi_processor_perf, 0);
663 free_cpumask_var(acpi_processor_perf->shared_cpu_map);
655 kfree(acpi_processor_perf); 664 kfree(acpi_processor_perf);
656 } 665 }
657#endif 666#endif
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index 7f05f44b97e9..c3c9adbaa26f 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -766,7 +766,7 @@ static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned
766static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) 766static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
767{ 767{
768 struct cpufreq_frequency_table *powernow_table; 768 struct cpufreq_frequency_table *powernow_table;
769 int ret_val; 769 int ret_val = -ENODEV;
770 770
771 if (acpi_processor_register_performance(&data->acpi_data, data->cpu)) { 771 if (acpi_processor_register_performance(&data->acpi_data, data->cpu)) {
772 dprintk("register performance failed: bad ACPI data\n"); 772 dprintk("register performance failed: bad ACPI data\n");
@@ -815,6 +815,13 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
815 /* notify BIOS that we exist */ 815 /* notify BIOS that we exist */
816 acpi_processor_notify_smm(THIS_MODULE); 816 acpi_processor_notify_smm(THIS_MODULE);
817 817
818 if (!alloc_cpumask_var(&data->acpi_data.shared_cpu_map, GFP_KERNEL)) {
819 printk(KERN_ERR PFX
820 "unable to alloc powernow_k8_data cpumask\n");
821 ret_val = -ENOMEM;
822 goto err_out_mem;
823 }
824
818 return 0; 825 return 0;
819 826
820err_out_mem: 827err_out_mem:
@@ -826,7 +833,7 @@ err_out:
826 /* data->acpi_data.state_count informs us at ->exit() whether ACPI was used */ 833 /* data->acpi_data.state_count informs us at ->exit() whether ACPI was used */
827 data->acpi_data.state_count = 0; 834 data->acpi_data.state_count = 0;
828 835
829 return -ENODEV; 836 return ret_val;
830} 837}
831 838
832static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table) 839static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table)
@@ -929,6 +936,7 @@ static void powernow_k8_cpu_exit_acpi(struct powernow_k8_data *data)
929{ 936{
930 if (data->acpi_data.state_count) 937 if (data->acpi_data.state_count)
931 acpi_processor_unregister_performance(&data->acpi_data, data->cpu); 938 acpi_processor_unregister_performance(&data->acpi_data, data->cpu);
939 free_cpumask_var(data->acpi_data.shared_cpu_map);
932} 940}
933 941
934#else 942#else
@@ -1134,7 +1142,8 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1134 data->cpu = pol->cpu; 1142 data->cpu = pol->cpu;
1135 data->currpstate = HW_PSTATE_INVALID; 1143 data->currpstate = HW_PSTATE_INVALID;
1136 1144
1137 if (powernow_k8_cpu_init_acpi(data)) { 1145 rc = powernow_k8_cpu_init_acpi(data);
1146 if (rc) {
1138 /* 1147 /*
1139 * Use the PSB BIOS structure. This is only availabe on 1148 * Use the PSB BIOS structure. This is only availabe on
1140 * an UP version, and is deprecated by AMD. 1149 * an UP version, and is deprecated by AMD.
@@ -1152,20 +1161,17 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1152 "ACPI maintainers and complain to your BIOS " 1161 "ACPI maintainers and complain to your BIOS "
1153 "vendor.\n"); 1162 "vendor.\n");
1154#endif 1163#endif
1155 kfree(data); 1164 goto err_out;
1156 return -ENODEV;
1157 } 1165 }
1158 if (pol->cpu != 0) { 1166 if (pol->cpu != 0) {
1159 printk(KERN_ERR FW_BUG PFX "No ACPI _PSS objects for " 1167 printk(KERN_ERR FW_BUG PFX "No ACPI _PSS objects for "
1160 "CPU other than CPU0. Complain to your BIOS " 1168 "CPU other than CPU0. Complain to your BIOS "
1161 "vendor.\n"); 1169 "vendor.\n");
1162 kfree(data); 1170 goto err_out;
1163 return -ENODEV;
1164 } 1171 }
1165 rc = find_psb_table(data); 1172 rc = find_psb_table(data);
1166 if (rc) { 1173 if (rc) {
1167 kfree(data); 1174 goto err_out;
1168 return -ENODEV;
1169 } 1175 }
1170 } 1176 }
1171 1177
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
index 3b5f06423e77..f0ea6fa2f53c 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -459,9 +459,7 @@ static int centrino_verify (struct cpufreq_policy *policy)
459 * Sets a new CPUFreq policy. 459 * Sets a new CPUFreq policy.
460 */ 460 */
461struct allmasks { 461struct allmasks {
462 cpumask_t online_policy_cpus;
463 cpumask_t saved_mask; 462 cpumask_t saved_mask;
464 cpumask_t set_mask;
465 cpumask_t covered_cpus; 463 cpumask_t covered_cpus;
466}; 464};
467 465
@@ -475,9 +473,7 @@ static int centrino_target (struct cpufreq_policy *policy,
475 int retval = 0; 473 int retval = 0;
476 unsigned int j, k, first_cpu, tmp; 474 unsigned int j, k, first_cpu, tmp;
477 CPUMASK_ALLOC(allmasks); 475 CPUMASK_ALLOC(allmasks);
478 CPUMASK_PTR(online_policy_cpus, allmasks);
479 CPUMASK_PTR(saved_mask, allmasks); 476 CPUMASK_PTR(saved_mask, allmasks);
480 CPUMASK_PTR(set_mask, allmasks);
481 CPUMASK_PTR(covered_cpus, allmasks); 477 CPUMASK_PTR(covered_cpus, allmasks);
482 478
483 if (unlikely(allmasks == NULL)) 479 if (unlikely(allmasks == NULL))
@@ -497,30 +493,28 @@ static int centrino_target (struct cpufreq_policy *policy,
497 goto out; 493 goto out;
498 } 494 }
499 495
500#ifdef CONFIG_HOTPLUG_CPU
501 /* cpufreq holds the hotplug lock, so we are safe from here on */
502 cpus_and(*online_policy_cpus, cpu_online_map, policy->cpus);
503#else
504 *online_policy_cpus = policy->cpus;
505#endif
506
507 *saved_mask = current->cpus_allowed; 496 *saved_mask = current->cpus_allowed;
508 first_cpu = 1; 497 first_cpu = 1;
509 cpus_clear(*covered_cpus); 498 cpus_clear(*covered_cpus);
510 for_each_cpu_mask_nr(j, *online_policy_cpus) { 499 for_each_cpu_mask_nr(j, policy->cpus) {
500 const cpumask_t *mask;
501
502 /* cpufreq holds the hotplug lock, so we are safe here */
503 if (!cpu_online(j))
504 continue;
505
511 /* 506 /*
512 * Support for SMP systems. 507 * Support for SMP systems.
513 * Make sure we are running on CPU that wants to change freq 508 * Make sure we are running on CPU that wants to change freq
514 */ 509 */
515 cpus_clear(*set_mask);
516 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) 510 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
517 cpus_or(*set_mask, *set_mask, *online_policy_cpus); 511 mask = &policy->cpus;
518 else 512 else
519 cpu_set(j, *set_mask); 513 mask = &cpumask_of_cpu(j);
520 514
521 set_cpus_allowed_ptr(current, set_mask); 515 set_cpus_allowed_ptr(current, mask);
522 preempt_disable(); 516 preempt_disable();
523 if (unlikely(!cpu_isset(smp_processor_id(), *set_mask))) { 517 if (unlikely(!cpu_isset(smp_processor_id(), *mask))) {
524 dprintk("couldn't limit to CPUs in this domain\n"); 518 dprintk("couldn't limit to CPUs in this domain\n");
525 retval = -EAGAIN; 519 retval = -EAGAIN;
526 if (first_cpu) { 520 if (first_cpu) {
@@ -548,7 +542,9 @@ static int centrino_target (struct cpufreq_policy *policy,
548 dprintk("target=%dkHz old=%d new=%d msr=%04x\n", 542 dprintk("target=%dkHz old=%d new=%d msr=%04x\n",
549 target_freq, freqs.old, freqs.new, msr); 543 target_freq, freqs.old, freqs.new, msr);
550 544
551 for_each_cpu_mask_nr(k, *online_policy_cpus) { 545 for_each_cpu_mask_nr(k, policy->cpus) {
546 if (!cpu_online(k))
547 continue;
552 freqs.cpu = k; 548 freqs.cpu = k;
553 cpufreq_notify_transition(&freqs, 549 cpufreq_notify_transition(&freqs,
554 CPUFREQ_PRECHANGE); 550 CPUFREQ_PRECHANGE);
@@ -571,7 +567,9 @@ static int centrino_target (struct cpufreq_policy *policy,
571 preempt_enable(); 567 preempt_enable();
572 } 568 }
573 569
574 for_each_cpu_mask_nr(k, *online_policy_cpus) { 570 for_each_cpu_mask_nr(k, policy->cpus) {
571 if (!cpu_online(k))
572 continue;
575 freqs.cpu = k; 573 freqs.cpu = k;
576 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 574 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
577 } 575 }
@@ -584,18 +582,17 @@ static int centrino_target (struct cpufreq_policy *policy,
584 * Best effort undo.. 582 * Best effort undo..
585 */ 583 */
586 584
587 if (!cpus_empty(*covered_cpus)) 585 for_each_cpu_mask_nr(j, *covered_cpus) {
588 for_each_cpu_mask_nr(j, *covered_cpus) { 586 set_cpus_allowed_ptr(current, &cpumask_of_cpu(j));
589 set_cpus_allowed_ptr(current, 587 wrmsr(MSR_IA32_PERF_CTL, oldmsr, h);
590 &cpumask_of_cpu(j)); 588 }
591 wrmsr(MSR_IA32_PERF_CTL, oldmsr, h);
592 }
593 589
594 tmp = freqs.new; 590 tmp = freqs.new;
595 freqs.new = freqs.old; 591 freqs.new = freqs.old;
596 freqs.old = tmp; 592 freqs.old = tmp;
597 for_each_cpu_mask_nr(j, *online_policy_cpus) { 593 for_each_cpu_mask_nr(j, policy->cpus) {
598 freqs.cpu = j; 594 if (!cpu_online(j))
595 continue;
599 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 596 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
600 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 597 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
601 } 598 }
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c b/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c
index 98d4fdb7dc04..cdac7d62369b 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c
@@ -139,6 +139,15 @@ static unsigned int pentium_core_get_frequency(void)
139 case 3: 139 case 3:
140 fsb = 166667; 140 fsb = 166667;
141 break; 141 break;
142 case 2:
143 fsb = 200000;
144 break;
145 case 0:
146 fsb = 266667;
147 break;
148 case 4:
149 fsb = 333333;
150 break;
142 default: 151 default:
143 printk(KERN_ERR "PCORE - MSR_FSB_FREQ undefined value"); 152 printk(KERN_ERR "PCORE - MSR_FSB_FREQ undefined value");
144 } 153 }
diff --git a/arch/x86/kernel/cpu/hypervisor.c b/arch/x86/kernel/cpu/hypervisor.c
new file mode 100644
index 000000000000..fb5b86af0b01
--- /dev/null
+++ b/arch/x86/kernel/cpu/hypervisor.c
@@ -0,0 +1,58 @@
1/*
2 * Common hypervisor code
3 *
4 * Copyright (C) 2008, VMware, Inc.
5 * Author : Alok N Kataria <akataria@vmware.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
15 * NON INFRINGEMENT. See the GNU General Public License for more
16 * details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 */
23
24#include <asm/processor.h>
25#include <asm/vmware.h>
26#include <asm/hypervisor.h>
27
28static inline void __cpuinit
29detect_hypervisor_vendor(struct cpuinfo_x86 *c)
30{
31 if (vmware_platform()) {
32 c->x86_hyper_vendor = X86_HYPER_VENDOR_VMWARE;
33 } else {
34 c->x86_hyper_vendor = X86_HYPER_VENDOR_NONE;
35 }
36}
37
38unsigned long get_hypervisor_tsc_freq(void)
39{
40 if (boot_cpu_data.x86_hyper_vendor == X86_HYPER_VENDOR_VMWARE)
41 return vmware_get_tsc_khz();
42 return 0;
43}
44
45static inline void __cpuinit
46hypervisor_set_feature_bits(struct cpuinfo_x86 *c)
47{
48 if (boot_cpu_data.x86_hyper_vendor == X86_HYPER_VENDOR_VMWARE) {
49 vmware_set_feature_bits(c);
50 return;
51 }
52}
53
54void __cpuinit init_hypervisor(struct cpuinfo_x86 *c)
55{
56 detect_hypervisor_vendor(c);
57 hypervisor_set_feature_bits(c);
58}
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index cce0b6118d55..8ea6929e974c 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -11,7 +11,6 @@
11#include <asm/pgtable.h> 11#include <asm/pgtable.h>
12#include <asm/msr.h> 12#include <asm/msr.h>
13#include <asm/uaccess.h> 13#include <asm/uaccess.h>
14#include <asm/ptrace.h>
15#include <asm/ds.h> 14#include <asm/ds.h>
16#include <asm/bugs.h> 15#include <asm/bugs.h>
17 16
@@ -41,6 +40,16 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
41 if (c->x86 == 15 && c->x86_cache_alignment == 64) 40 if (c->x86 == 15 && c->x86_cache_alignment == 64)
42 c->x86_cache_alignment = 128; 41 c->x86_cache_alignment = 128;
43#endif 42#endif
43
44 /*
45 * c->x86_power is 8000_0007 edx. Bit 8 is TSC runs at constant rate
46 * with P/T states and does not stop in deep C-states
47 */
48 if (c->x86_power & (1 << 8)) {
49 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
50 set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
51 }
52
44} 53}
45 54
46#ifdef CONFIG_X86_32 55#ifdef CONFIG_X86_32
@@ -242,6 +251,13 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
242 251
243 intel_workarounds(c); 252 intel_workarounds(c);
244 253
254 /*
255 * Detect the extended topology information if available. This
256 * will reinitialise the initial_apicid which will be used
257 * in init_intel_cacheinfo()
258 */
259 detect_extended_topology(c);
260
245 l2 = init_intel_cacheinfo(c); 261 l2 = init_intel_cacheinfo(c);
246 if (c->cpuid_level > 9) { 262 if (c->cpuid_level > 9) {
247 unsigned eax = cpuid_eax(10); 263 unsigned eax = cpuid_eax(10);
@@ -307,13 +323,8 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
307 set_cpu_cap(c, X86_FEATURE_P4); 323 set_cpu_cap(c, X86_FEATURE_P4);
308 if (c->x86 == 6) 324 if (c->x86 == 6)
309 set_cpu_cap(c, X86_FEATURE_P3); 325 set_cpu_cap(c, X86_FEATURE_P3);
310
311 if (cpu_has_bts)
312 ptrace_bts_init_intel(c);
313
314#endif 326#endif
315 327
316 detect_extended_topology(c);
317 if (!cpu_has(c, X86_FEATURE_XTOPOLOGY)) { 328 if (!cpu_has(c, X86_FEATURE_XTOPOLOGY)) {
318 /* 329 /*
319 * let's use the legacy cpuid vector 0x1 and 0x4 for topology 330 * let's use the legacy cpuid vector 0x1 and 0x4 for topology
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 3f46afbb1cf1..48533d77be78 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -534,31 +534,16 @@ static void __cpuinit free_cache_attributes(unsigned int cpu)
534 per_cpu(cpuid4_info, cpu) = NULL; 534 per_cpu(cpuid4_info, cpu) = NULL;
535} 535}
536 536
537static int __cpuinit detect_cache_attributes(unsigned int cpu) 537static void __cpuinit get_cpu_leaves(void *_retval)
538{ 538{
539 struct _cpuid4_info *this_leaf; 539 int j, *retval = _retval, cpu = smp_processor_id();
540 unsigned long j;
541 int retval;
542 cpumask_t oldmask;
543
544 if (num_cache_leaves == 0)
545 return -ENOENT;
546
547 per_cpu(cpuid4_info, cpu) = kzalloc(
548 sizeof(struct _cpuid4_info) * num_cache_leaves, GFP_KERNEL);
549 if (per_cpu(cpuid4_info, cpu) == NULL)
550 return -ENOMEM;
551
552 oldmask = current->cpus_allowed;
553 retval = set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
554 if (retval)
555 goto out;
556 540
557 /* Do cpuid and store the results */ 541 /* Do cpuid and store the results */
558 for (j = 0; j < num_cache_leaves; j++) { 542 for (j = 0; j < num_cache_leaves; j++) {
543 struct _cpuid4_info *this_leaf;
559 this_leaf = CPUID4_INFO_IDX(cpu, j); 544 this_leaf = CPUID4_INFO_IDX(cpu, j);
560 retval = cpuid4_cache_lookup(j, this_leaf); 545 *retval = cpuid4_cache_lookup(j, this_leaf);
561 if (unlikely(retval < 0)) { 546 if (unlikely(*retval < 0)) {
562 int i; 547 int i;
563 548
564 for (i = 0; i < j; i++) 549 for (i = 0; i < j; i++)
@@ -567,9 +552,21 @@ static int __cpuinit detect_cache_attributes(unsigned int cpu)
567 } 552 }
568 cache_shared_cpu_map_setup(cpu, j); 553 cache_shared_cpu_map_setup(cpu, j);
569 } 554 }
570 set_cpus_allowed_ptr(current, &oldmask); 555}
556
557static int __cpuinit detect_cache_attributes(unsigned int cpu)
558{
559 int retval;
560
561 if (num_cache_leaves == 0)
562 return -ENOENT;
571 563
572out: 564 per_cpu(cpuid4_info, cpu) = kzalloc(
565 sizeof(struct _cpuid4_info) * num_cache_leaves, GFP_KERNEL);
566 if (per_cpu(cpuid4_info, cpu) == NULL)
567 return -ENOMEM;
568
569 smp_call_function_single(cpu, get_cpu_leaves, &retval, true);
573 if (retval) { 570 if (retval) {
574 kfree(per_cpu(cpuid4_info, cpu)); 571 kfree(per_cpu(cpuid4_info, cpu));
575 per_cpu(cpuid4_info, cpu) = NULL; 572 per_cpu(cpuid4_info, cpu) = NULL;
@@ -626,8 +623,8 @@ static ssize_t show_shared_cpu_map_func(struct _cpuid4_info *this_leaf,
626 cpumask_t *mask = &this_leaf->shared_cpu_map; 623 cpumask_t *mask = &this_leaf->shared_cpu_map;
627 624
628 n = type? 625 n = type?
629 cpulist_scnprintf(buf, len-2, *mask): 626 cpulist_scnprintf(buf, len-2, mask) :
630 cpumask_scnprintf(buf, len-2, *mask); 627 cpumask_scnprintf(buf, len-2, mask);
631 buf[n++] = '\n'; 628 buf[n++] = '\n';
632 buf[n] = '\0'; 629 buf[n] = '\0';
633 } 630 }
@@ -644,20 +641,17 @@ static inline ssize_t show_shared_cpu_list(struct _cpuid4_info *leaf, char *buf)
644 return show_shared_cpu_map_func(leaf, 1, buf); 641 return show_shared_cpu_map_func(leaf, 1, buf);
645} 642}
646 643
647static ssize_t show_type(struct _cpuid4_info *this_leaf, char *buf) { 644static ssize_t show_type(struct _cpuid4_info *this_leaf, char *buf)
648 switch(this_leaf->eax.split.type) { 645{
649 case CACHE_TYPE_DATA: 646 switch (this_leaf->eax.split.type) {
647 case CACHE_TYPE_DATA:
650 return sprintf(buf, "Data\n"); 648 return sprintf(buf, "Data\n");
651 break; 649 case CACHE_TYPE_INST:
652 case CACHE_TYPE_INST:
653 return sprintf(buf, "Instruction\n"); 650 return sprintf(buf, "Instruction\n");
654 break; 651 case CACHE_TYPE_UNIFIED:
655 case CACHE_TYPE_UNIFIED:
656 return sprintf(buf, "Unified\n"); 652 return sprintf(buf, "Unified\n");
657 break; 653 default:
658 default:
659 return sprintf(buf, "Unknown\n"); 654 return sprintf(buf, "Unknown\n");
660 break;
661 } 655 }
662} 656}
663 657
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
index 5eb390a4b2e9..a5a5e0530370 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
@@ -83,34 +83,41 @@ static DEFINE_PER_CPU(unsigned char, bank_map); /* see which banks are on */
83 * CPU Initialization 83 * CPU Initialization
84 */ 84 */
85 85
86struct thresh_restart {
87 struct threshold_block *b;
88 int reset;
89 u16 old_limit;
90};
91
86/* must be called with correct cpu affinity */ 92/* must be called with correct cpu affinity */
87static void threshold_restart_bank(struct threshold_block *b, 93static long threshold_restart_bank(void *_tr)
88 int reset, u16 old_limit)
89{ 94{
95 struct thresh_restart *tr = _tr;
90 u32 mci_misc_hi, mci_misc_lo; 96 u32 mci_misc_hi, mci_misc_lo;
91 97
92 rdmsr(b->address, mci_misc_lo, mci_misc_hi); 98 rdmsr(tr->b->address, mci_misc_lo, mci_misc_hi);
93 99
94 if (b->threshold_limit < (mci_misc_hi & THRESHOLD_MAX)) 100 if (tr->b->threshold_limit < (mci_misc_hi & THRESHOLD_MAX))
95 reset = 1; /* limit cannot be lower than err count */ 101 tr->reset = 1; /* limit cannot be lower than err count */
96 102
97 if (reset) { /* reset err count and overflow bit */ 103 if (tr->reset) { /* reset err count and overflow bit */
98 mci_misc_hi = 104 mci_misc_hi =
99 (mci_misc_hi & ~(MASK_ERR_COUNT_HI | MASK_OVERFLOW_HI)) | 105 (mci_misc_hi & ~(MASK_ERR_COUNT_HI | MASK_OVERFLOW_HI)) |
100 (THRESHOLD_MAX - b->threshold_limit); 106 (THRESHOLD_MAX - tr->b->threshold_limit);
101 } else if (old_limit) { /* change limit w/o reset */ 107 } else if (tr->old_limit) { /* change limit w/o reset */
102 int new_count = (mci_misc_hi & THRESHOLD_MAX) + 108 int new_count = (mci_misc_hi & THRESHOLD_MAX) +
103 (old_limit - b->threshold_limit); 109 (tr->old_limit - tr->b->threshold_limit);
104 mci_misc_hi = (mci_misc_hi & ~MASK_ERR_COUNT_HI) | 110 mci_misc_hi = (mci_misc_hi & ~MASK_ERR_COUNT_HI) |
105 (new_count & THRESHOLD_MAX); 111 (new_count & THRESHOLD_MAX);
106 } 112 }
107 113
108 b->interrupt_enable ? 114 tr->b->interrupt_enable ?
109 (mci_misc_hi = (mci_misc_hi & ~MASK_INT_TYPE_HI) | INT_TYPE_APIC) : 115 (mci_misc_hi = (mci_misc_hi & ~MASK_INT_TYPE_HI) | INT_TYPE_APIC) :
110 (mci_misc_hi &= ~MASK_INT_TYPE_HI); 116 (mci_misc_hi &= ~MASK_INT_TYPE_HI);
111 117
112 mci_misc_hi |= MASK_COUNT_EN_HI; 118 mci_misc_hi |= MASK_COUNT_EN_HI;
113 wrmsr(b->address, mci_misc_lo, mci_misc_hi); 119 wrmsr(tr->b->address, mci_misc_lo, mci_misc_hi);
120 return 0;
114} 121}
115 122
116/* cpu init entry point, called from mce.c with preempt off */ 123/* cpu init entry point, called from mce.c with preempt off */
@@ -120,6 +127,7 @@ void __cpuinit mce_amd_feature_init(struct cpuinfo_x86 *c)
120 unsigned int cpu = smp_processor_id(); 127 unsigned int cpu = smp_processor_id();
121 u8 lvt_off; 128 u8 lvt_off;
122 u32 low = 0, high = 0, address = 0; 129 u32 low = 0, high = 0, address = 0;
130 struct thresh_restart tr;
123 131
124 for (bank = 0; bank < NR_BANKS; ++bank) { 132 for (bank = 0; bank < NR_BANKS; ++bank) {
125 for (block = 0; block < NR_BLOCKS; ++block) { 133 for (block = 0; block < NR_BLOCKS; ++block) {
@@ -162,7 +170,10 @@ void __cpuinit mce_amd_feature_init(struct cpuinfo_x86 *c)
162 wrmsr(address, low, high); 170 wrmsr(address, low, high);
163 171
164 threshold_defaults.address = address; 172 threshold_defaults.address = address;
165 threshold_restart_bank(&threshold_defaults, 0, 0); 173 tr.b = &threshold_defaults;
174 tr.reset = 0;
175 tr.old_limit = 0;
176 threshold_restart_bank(&tr);
166 } 177 }
167 } 178 }
168} 179}
@@ -237,7 +248,7 @@ asmlinkage void mce_threshold_interrupt(void)
237 } 248 }
238 } 249 }
239out: 250out:
240 add_pda(irq_threshold_count, 1); 251 inc_irq_stat(irq_threshold_count);
241 irq_exit(); 252 irq_exit();
242} 253}
243 254
@@ -251,20 +262,6 @@ struct threshold_attr {
251 ssize_t(*store) (struct threshold_block *, const char *, size_t count); 262 ssize_t(*store) (struct threshold_block *, const char *, size_t count);
252}; 263};
253 264
254static void affinity_set(unsigned int cpu, cpumask_t *oldmask,
255 cpumask_t *newmask)
256{
257 *oldmask = current->cpus_allowed;
258 cpus_clear(*newmask);
259 cpu_set(cpu, *newmask);
260 set_cpus_allowed_ptr(current, newmask);
261}
262
263static void affinity_restore(const cpumask_t *oldmask)
264{
265 set_cpus_allowed_ptr(current, oldmask);
266}
267
268#define SHOW_FIELDS(name) \ 265#define SHOW_FIELDS(name) \
269static ssize_t show_ ## name(struct threshold_block * b, char *buf) \ 266static ssize_t show_ ## name(struct threshold_block * b, char *buf) \
270{ \ 267{ \
@@ -277,15 +274,16 @@ static ssize_t store_interrupt_enable(struct threshold_block *b,
277 const char *buf, size_t count) 274 const char *buf, size_t count)
278{ 275{
279 char *end; 276 char *end;
280 cpumask_t oldmask, newmask; 277 struct thresh_restart tr;
281 unsigned long new = simple_strtoul(buf, &end, 0); 278 unsigned long new = simple_strtoul(buf, &end, 0);
282 if (end == buf) 279 if (end == buf)
283 return -EINVAL; 280 return -EINVAL;
284 b->interrupt_enable = !!new; 281 b->interrupt_enable = !!new;
285 282
286 affinity_set(b->cpu, &oldmask, &newmask); 283 tr.b = b;
287 threshold_restart_bank(b, 0, 0); 284 tr.reset = 0;
288 affinity_restore(&oldmask); 285 tr.old_limit = 0;
286 work_on_cpu(b->cpu, threshold_restart_bank, &tr);
289 287
290 return end - buf; 288 return end - buf;
291} 289}
@@ -294,8 +292,7 @@ static ssize_t store_threshold_limit(struct threshold_block *b,
294 const char *buf, size_t count) 292 const char *buf, size_t count)
295{ 293{
296 char *end; 294 char *end;
297 cpumask_t oldmask, newmask; 295 struct thresh_restart tr;
298 u16 old;
299 unsigned long new = simple_strtoul(buf, &end, 0); 296 unsigned long new = simple_strtoul(buf, &end, 0);
300 if (end == buf) 297 if (end == buf)
301 return -EINVAL; 298 return -EINVAL;
@@ -303,34 +300,36 @@ static ssize_t store_threshold_limit(struct threshold_block *b,
303 new = THRESHOLD_MAX; 300 new = THRESHOLD_MAX;
304 if (new < 1) 301 if (new < 1)
305 new = 1; 302 new = 1;
306 old = b->threshold_limit; 303 tr.old_limit = b->threshold_limit;
307 b->threshold_limit = new; 304 b->threshold_limit = new;
305 tr.b = b;
306 tr.reset = 0;
308 307
309 affinity_set(b->cpu, &oldmask, &newmask); 308 work_on_cpu(b->cpu, threshold_restart_bank, &tr);
310 threshold_restart_bank(b, 0, old);
311 affinity_restore(&oldmask);
312 309
313 return end - buf; 310 return end - buf;
314} 311}
315 312
316static ssize_t show_error_count(struct threshold_block *b, char *buf) 313static long local_error_count(void *_b)
317{ 314{
318 u32 high, low; 315 struct threshold_block *b = _b;
319 cpumask_t oldmask, newmask; 316 u32 low, high;
320 affinity_set(b->cpu, &oldmask, &newmask); 317
321 rdmsr(b->address, low, high); 318 rdmsr(b->address, low, high);
322 affinity_restore(&oldmask); 319 return (high & 0xFFF) - (THRESHOLD_MAX - b->threshold_limit);
323 return sprintf(buf, "%x\n", 320}
324 (high & 0xFFF) - (THRESHOLD_MAX - b->threshold_limit)); 321
322static ssize_t show_error_count(struct threshold_block *b, char *buf)
323{
324 return sprintf(buf, "%lx\n", work_on_cpu(b->cpu, local_error_count, b));
325} 325}
326 326
327static ssize_t store_error_count(struct threshold_block *b, 327static ssize_t store_error_count(struct threshold_block *b,
328 const char *buf, size_t count) 328 const char *buf, size_t count)
329{ 329{
330 cpumask_t oldmask, newmask; 330 struct thresh_restart tr = { .b = b, .reset = 1, .old_limit = 0 };
331 affinity_set(b->cpu, &oldmask, &newmask); 331
332 threshold_restart_bank(b, 1, 0); 332 work_on_cpu(b->cpu, threshold_restart_bank, &tr);
333 affinity_restore(&oldmask);
334 return 1; 333 return 1;
335} 334}
336 335
@@ -463,12 +462,19 @@ out_free:
463 return err; 462 return err;
464} 463}
465 464
465static long local_allocate_threshold_blocks(void *_bank)
466{
467 unsigned int *bank = _bank;
468
469 return allocate_threshold_blocks(smp_processor_id(), *bank, 0,
470 MSR_IA32_MC0_MISC + *bank * 4);
471}
472
466/* symlinks sibling shared banks to first core. first core owns dir/files. */ 473/* symlinks sibling shared banks to first core. first core owns dir/files. */
467static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) 474static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
468{ 475{
469 int i, err = 0; 476 int i, err = 0;
470 struct threshold_bank *b = NULL; 477 struct threshold_bank *b = NULL;
471 cpumask_t oldmask, newmask;
472 char name[32]; 478 char name[32];
473 479
474 sprintf(name, "threshold_bank%i", bank); 480 sprintf(name, "threshold_bank%i", bank);
@@ -519,11 +525,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
519 525
520 per_cpu(threshold_banks, cpu)[bank] = b; 526 per_cpu(threshold_banks, cpu)[bank] = b;
521 527
522 affinity_set(cpu, &oldmask, &newmask); 528 err = work_on_cpu(cpu, local_allocate_threshold_blocks, &bank);
523 err = allocate_threshold_blocks(cpu, bank, 0,
524 MSR_IA32_MC0_MISC + bank * 4);
525 affinity_restore(&oldmask);
526
527 if (err) 529 if (err)
528 goto out_free; 530 goto out_free;
529 531
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel_64.c b/arch/x86/kernel/cpu/mcheck/mce_intel_64.c
index c17eaf5dd6dd..4b48f251fd39 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_intel_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_intel_64.c
@@ -26,7 +26,7 @@ asmlinkage void smp_thermal_interrupt(void)
26 if (therm_throt_process(msr_val & 1)) 26 if (therm_throt_process(msr_val & 1))
27 mce_log_therm_throt_event(smp_processor_id(), msr_val); 27 mce_log_therm_throt_event(smp_processor_id(), msr_val);
28 28
29 add_pda(irq_thermal_count, 1); 29 inc_irq_stat(irq_thermal_count);
30 irq_exit(); 30 irq_exit();
31} 31}
32 32
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
index 4e8d77f01eeb..b59ddcc88cd8 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -14,14 +14,6 @@
14#include <asm/pat.h> 14#include <asm/pat.h>
15#include "mtrr.h" 15#include "mtrr.h"
16 16
17struct mtrr_state {
18 struct mtrr_var_range var_ranges[MAX_VAR_RANGES];
19 mtrr_type fixed_ranges[NUM_FIXED_RANGES];
20 unsigned char enabled;
21 unsigned char have_fixed;
22 mtrr_type def_type;
23};
24
25struct fixed_range_block { 17struct fixed_range_block {
26 int base_msr; /* start address of an MTRR block */ 18 int base_msr; /* start address of an MTRR block */
27 int ranges; /* number of MTRRs in this block */ 19 int ranges; /* number of MTRRs in this block */
@@ -35,10 +27,12 @@ static struct fixed_range_block fixed_range_blocks[] = {
35}; 27};
36 28
37static unsigned long smp_changes_mask; 29static unsigned long smp_changes_mask;
38static struct mtrr_state mtrr_state = {};
39static int mtrr_state_set; 30static int mtrr_state_set;
40u64 mtrr_tom2; 31u64 mtrr_tom2;
41 32
33struct mtrr_state_type mtrr_state = {};
34EXPORT_SYMBOL_GPL(mtrr_state);
35
42#undef MODULE_PARAM_PREFIX 36#undef MODULE_PARAM_PREFIX
43#define MODULE_PARAM_PREFIX "mtrr." 37#define MODULE_PARAM_PREFIX "mtrr."
44 38
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index c78c04821ea1..d259e5d2e054 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -49,7 +49,7 @@
49 49
50u32 num_var_ranges = 0; 50u32 num_var_ranges = 0;
51 51
52unsigned int mtrr_usage_table[MAX_VAR_RANGES]; 52unsigned int mtrr_usage_table[MTRR_MAX_VAR_RANGES];
53static DEFINE_MUTEX(mtrr_mutex); 53static DEFINE_MUTEX(mtrr_mutex);
54 54
55u64 size_or_mask, size_and_mask; 55u64 size_or_mask, size_and_mask;
@@ -574,7 +574,7 @@ struct mtrr_value {
574 unsigned long lsize; 574 unsigned long lsize;
575}; 575};
576 576
577static struct mtrr_value mtrr_state[MAX_VAR_RANGES]; 577static struct mtrr_value mtrr_state[MTRR_MAX_VAR_RANGES];
578 578
579static int mtrr_save(struct sys_device * sysdev, pm_message_t state) 579static int mtrr_save(struct sys_device * sysdev, pm_message_t state)
580{ 580{
@@ -803,6 +803,7 @@ x86_get_mtrr_mem_range(struct res_range *range, int nr_range,
803} 803}
804 804
805static struct res_range __initdata range[RANGE_NUM]; 805static struct res_range __initdata range[RANGE_NUM];
806static int __initdata nr_range;
806 807
807#ifdef CONFIG_MTRR_SANITIZER 808#ifdef CONFIG_MTRR_SANITIZER
808 809
@@ -823,16 +824,14 @@ static int enable_mtrr_cleanup __initdata =
823 824
824static int __init disable_mtrr_cleanup_setup(char *str) 825static int __init disable_mtrr_cleanup_setup(char *str)
825{ 826{
826 if (enable_mtrr_cleanup != -1) 827 enable_mtrr_cleanup = 0;
827 enable_mtrr_cleanup = 0;
828 return 0; 828 return 0;
829} 829}
830early_param("disable_mtrr_cleanup", disable_mtrr_cleanup_setup); 830early_param("disable_mtrr_cleanup", disable_mtrr_cleanup_setup);
831 831
832static int __init enable_mtrr_cleanup_setup(char *str) 832static int __init enable_mtrr_cleanup_setup(char *str)
833{ 833{
834 if (enable_mtrr_cleanup != -1) 834 enable_mtrr_cleanup = 1;
835 enable_mtrr_cleanup = 1;
836 return 0; 835 return 0;
837} 836}
838early_param("enable_mtrr_cleanup", enable_mtrr_cleanup_setup); 837early_param("enable_mtrr_cleanup", enable_mtrr_cleanup_setup);
@@ -1206,39 +1205,43 @@ struct mtrr_cleanup_result {
1206#define PSHIFT (PAGE_SHIFT - 10) 1205#define PSHIFT (PAGE_SHIFT - 10)
1207 1206
1208static struct mtrr_cleanup_result __initdata result[NUM_RESULT]; 1207static struct mtrr_cleanup_result __initdata result[NUM_RESULT];
1209static struct res_range __initdata range_new[RANGE_NUM];
1210static unsigned long __initdata min_loss_pfn[RANGE_NUM]; 1208static unsigned long __initdata min_loss_pfn[RANGE_NUM];
1211 1209
1212static int __init mtrr_cleanup(unsigned address_bits) 1210static void __init print_out_mtrr_range_state(void)
1213{ 1211{
1214 unsigned long extra_remove_base, extra_remove_size;
1215 unsigned long base, size, def, dummy;
1216 mtrr_type type;
1217 int nr_range, nr_range_new;
1218 u64 chunk_size, gran_size;
1219 unsigned long range_sums, range_sums_new;
1220 int index_good;
1221 int num_reg_good;
1222 int i; 1212 int i;
1213 char start_factor = 'K', size_factor = 'K';
1214 unsigned long start_base, size_base;
1215 mtrr_type type;
1223 1216
1224 /* extra one for all 0 */ 1217 for (i = 0; i < num_var_ranges; i++) {
1225 int num[MTRR_NUM_TYPES + 1];
1226 1218
1227 if (!is_cpu(INTEL) || enable_mtrr_cleanup < 1) 1219 size_base = range_state[i].size_pfn << (PAGE_SHIFT - 10);
1228 return 0; 1220 if (!size_base)
1229 rdmsr(MTRRdefType_MSR, def, dummy); 1221 continue;
1230 def &= 0xff;
1231 if (def != MTRR_TYPE_UNCACHABLE)
1232 return 0;
1233 1222
1234 /* get it and store it aside */ 1223 size_base = to_size_factor(size_base, &size_factor),
1235 memset(range_state, 0, sizeof(range_state)); 1224 start_base = range_state[i].base_pfn << (PAGE_SHIFT - 10);
1236 for (i = 0; i < num_var_ranges; i++) { 1225 start_base = to_size_factor(start_base, &start_factor),
1237 mtrr_if->get(i, &base, &size, &type); 1226 type = range_state[i].type;
1238 range_state[i].base_pfn = base; 1227
1239 range_state[i].size_pfn = size; 1228 printk(KERN_DEBUG "reg %d, base: %ld%cB, range: %ld%cB, type %s\n",
1240 range_state[i].type = type; 1229 i, start_base, start_factor,
1230 size_base, size_factor,
1231 (type == MTRR_TYPE_UNCACHABLE) ? "UC" :
1232 ((type == MTRR_TYPE_WRPROT) ? "WP" :
1233 ((type == MTRR_TYPE_WRBACK) ? "WB" : "Other"))
1234 );
1241 } 1235 }
1236}
1237
1238static int __init mtrr_need_cleanup(void)
1239{
1240 int i;
1241 mtrr_type type;
1242 unsigned long size;
1243 /* extra one for all 0 */
1244 int num[MTRR_NUM_TYPES + 1];
1242 1245
1243 /* check entries number */ 1246 /* check entries number */
1244 memset(num, 0, sizeof(num)); 1247 memset(num, 0, sizeof(num));
@@ -1263,29 +1266,133 @@ static int __init mtrr_cleanup(unsigned address_bits)
1263 num_var_ranges - num[MTRR_NUM_TYPES]) 1266 num_var_ranges - num[MTRR_NUM_TYPES])
1264 return 0; 1267 return 0;
1265 1268
1266 /* print original var MTRRs at first, for debugging: */ 1269 return 1;
1267 printk(KERN_DEBUG "original variable MTRRs\n"); 1270}
1268 for (i = 0; i < num_var_ranges; i++) {
1269 char start_factor = 'K', size_factor = 'K';
1270 unsigned long start_base, size_base;
1271 1271
1272 size_base = range_state[i].size_pfn << (PAGE_SHIFT - 10); 1272static unsigned long __initdata range_sums;
1273 if (!size_base) 1273static void __init mtrr_calc_range_state(u64 chunk_size, u64 gran_size,
1274 continue; 1274 unsigned long extra_remove_base,
1275 unsigned long extra_remove_size,
1276 int i)
1277{
1278 int num_reg;
1279 static struct res_range range_new[RANGE_NUM];
1280 static int nr_range_new;
1281 unsigned long range_sums_new;
1282
1283 /* convert ranges to var ranges state */
1284 num_reg = x86_setup_var_mtrrs(range, nr_range,
1285 chunk_size, gran_size);
1286
1287 /* we got new setting in range_state, check it */
1288 memset(range_new, 0, sizeof(range_new));
1289 nr_range_new = x86_get_mtrr_mem_range(range_new, 0,
1290 extra_remove_base, extra_remove_size);
1291 range_sums_new = sum_ranges(range_new, nr_range_new);
1292
1293 result[i].chunk_sizek = chunk_size >> 10;
1294 result[i].gran_sizek = gran_size >> 10;
1295 result[i].num_reg = num_reg;
1296 if (range_sums < range_sums_new) {
1297 result[i].lose_cover_sizek =
1298 (range_sums_new - range_sums) << PSHIFT;
1299 result[i].bad = 1;
1300 } else
1301 result[i].lose_cover_sizek =
1302 (range_sums - range_sums_new) << PSHIFT;
1275 1303
1276 size_base = to_size_factor(size_base, &size_factor), 1304 /* double check it */
1277 start_base = range_state[i].base_pfn << (PAGE_SHIFT - 10); 1305 if (!result[i].bad && !result[i].lose_cover_sizek) {
1278 start_base = to_size_factor(start_base, &start_factor), 1306 if (nr_range_new != nr_range ||
1279 type = range_state[i].type; 1307 memcmp(range, range_new, sizeof(range)))
1308 result[i].bad = 1;
1309 }
1280 1310
1281 printk(KERN_DEBUG "reg %d, base: %ld%cB, range: %ld%cB, type %s\n", 1311 if (!result[i].bad && (range_sums - range_sums_new <
1282 i, start_base, start_factor, 1312 min_loss_pfn[num_reg])) {
1283 size_base, size_factor, 1313 min_loss_pfn[num_reg] =
1284 (type == MTRR_TYPE_UNCACHABLE) ? "UC" : 1314 range_sums - range_sums_new;
1285 ((type == MTRR_TYPE_WRPROT) ? "WP" :
1286 ((type == MTRR_TYPE_WRBACK) ? "WB" : "Other"))
1287 );
1288 } 1315 }
1316}
1317
1318static void __init mtrr_print_out_one_result(int i)
1319{
1320 char gran_factor, chunk_factor, lose_factor;
1321 unsigned long gran_base, chunk_base, lose_base;
1322
1323 gran_base = to_size_factor(result[i].gran_sizek, &gran_factor),
1324 chunk_base = to_size_factor(result[i].chunk_sizek, &chunk_factor),
1325 lose_base = to_size_factor(result[i].lose_cover_sizek, &lose_factor),
1326 printk(KERN_INFO "%sgran_size: %ld%c \tchunk_size: %ld%c \t",
1327 result[i].bad ? "*BAD*" : " ",
1328 gran_base, gran_factor, chunk_base, chunk_factor);
1329 printk(KERN_CONT "num_reg: %d \tlose cover RAM: %s%ld%c\n",
1330 result[i].num_reg, result[i].bad ? "-" : "",
1331 lose_base, lose_factor);
1332}
1333
1334static int __init mtrr_search_optimal_index(void)
1335{
1336 int i;
1337 int num_reg_good;
1338 int index_good;
1339
1340 if (nr_mtrr_spare_reg >= num_var_ranges)
1341 nr_mtrr_spare_reg = num_var_ranges - 1;
1342 num_reg_good = -1;
1343 for (i = num_var_ranges - nr_mtrr_spare_reg; i > 0; i--) {
1344 if (!min_loss_pfn[i])
1345 num_reg_good = i;
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 return index_good;
1361}
1362
1363
1364static int __init mtrr_cleanup(unsigned address_bits)
1365{
1366 unsigned long extra_remove_base, extra_remove_size;
1367 unsigned long base, size, def, dummy;
1368 mtrr_type type;
1369 u64 chunk_size, gran_size;
1370 int index_good;
1371 int i;
1372
1373 if (!is_cpu(INTEL) || enable_mtrr_cleanup < 1)
1374 return 0;
1375 rdmsr(MTRRdefType_MSR, def, dummy);
1376 def &= 0xff;
1377 if (def != MTRR_TYPE_UNCACHABLE)
1378 return 0;
1379
1380 /* get it and store it aside */
1381 memset(range_state, 0, sizeof(range_state));
1382 for (i = 0; i < num_var_ranges; i++) {
1383 mtrr_if->get(i, &base, &size, &type);
1384 range_state[i].base_pfn = base;
1385 range_state[i].size_pfn = size;
1386 range_state[i].type = type;
1387 }
1388
1389 /* check if we need handle it and can handle it */
1390 if (!mtrr_need_cleanup())
1391 return 0;
1392
1393 /* print original var MTRRs at first, for debugging: */
1394 printk(KERN_DEBUG "original variable MTRRs\n");
1395 print_out_mtrr_range_state();
1289 1396
1290 memset(range, 0, sizeof(range)); 1397 memset(range, 0, sizeof(range));
1291 extra_remove_size = 0; 1398 extra_remove_size = 0;
@@ -1309,176 +1416,64 @@ static int __init mtrr_cleanup(unsigned address_bits)
1309 range_sums >> (20 - PAGE_SHIFT)); 1416 range_sums >> (20 - PAGE_SHIFT));
1310 1417
1311 if (mtrr_chunk_size && mtrr_gran_size) { 1418 if (mtrr_chunk_size && mtrr_gran_size) {
1312 int num_reg; 1419 i = 0;
1313 char gran_factor, chunk_factor, lose_factor; 1420 mtrr_calc_range_state(mtrr_chunk_size, mtrr_gran_size,
1314 unsigned long gran_base, chunk_base, lose_base; 1421 extra_remove_base, extra_remove_size, i);
1315
1316 debug_print++;
1317 /* convert ranges to var ranges state */
1318 num_reg = x86_setup_var_mtrrs(range, nr_range, mtrr_chunk_size,
1319 mtrr_gran_size);
1320 1422
1321 /* we got new setting in range_state, check it */ 1423 mtrr_print_out_one_result(i);
1322 memset(range_new, 0, sizeof(range_new));
1323 nr_range_new = x86_get_mtrr_mem_range(range_new, 0,
1324 extra_remove_base,
1325 extra_remove_size);
1326 range_sums_new = sum_ranges(range_new, nr_range_new);
1327 1424
1328 i = 0;
1329 result[i].chunk_sizek = mtrr_chunk_size >> 10;
1330 result[i].gran_sizek = mtrr_gran_size >> 10;
1331 result[i].num_reg = num_reg;
1332 if (range_sums < range_sums_new) {
1333 result[i].lose_cover_sizek =
1334 (range_sums_new - range_sums) << PSHIFT;
1335 result[i].bad = 1;
1336 } else
1337 result[i].lose_cover_sizek =
1338 (range_sums - range_sums_new) << PSHIFT;
1339
1340 gran_base = to_size_factor(result[i].gran_sizek, &gran_factor),
1341 chunk_base = to_size_factor(result[i].chunk_sizek, &chunk_factor),
1342 lose_base = to_size_factor(result[i].lose_cover_sizek, &lose_factor),
1343 printk(KERN_INFO "%sgran_size: %ld%c \tchunk_size: %ld%c \t",
1344 result[i].bad?"*BAD*":" ",
1345 gran_base, gran_factor, chunk_base, chunk_factor);
1346 printk(KERN_CONT "num_reg: %d \tlose cover RAM: %s%ld%c\n",
1347 result[i].num_reg, result[i].bad?"-":"",
1348 lose_base, lose_factor);
1349 if (!result[i].bad) { 1425 if (!result[i].bad) {
1350 set_var_mtrr_all(address_bits); 1426 set_var_mtrr_all(address_bits);
1351 return 1; 1427 return 1;
1352 } 1428 }
1353 printk(KERN_INFO "invalid mtrr_gran_size or mtrr_chunk_size, " 1429 printk(KERN_INFO "invalid mtrr_gran_size or mtrr_chunk_size, "
1354 "will find optimal one\n"); 1430 "will find optimal one\n");
1355 debug_print--;
1356 memset(result, 0, sizeof(result[0]));
1357 } 1431 }
1358 1432
1359 i = 0; 1433 i = 0;
1360 memset(min_loss_pfn, 0xff, sizeof(min_loss_pfn)); 1434 memset(min_loss_pfn, 0xff, sizeof(min_loss_pfn));
1361 memset(result, 0, sizeof(result)); 1435 memset(result, 0, sizeof(result));
1362 for (gran_size = (1ULL<<16); gran_size < (1ULL<<32); gran_size <<= 1) { 1436 for (gran_size = (1ULL<<16); gran_size < (1ULL<<32); gran_size <<= 1) {
1363 char gran_factor;
1364 unsigned long gran_base;
1365
1366 if (debug_print)
1367 gran_base = to_size_factor(gran_size >> 10, &gran_factor);
1368 1437
1369 for (chunk_size = gran_size; chunk_size < (1ULL<<32); 1438 for (chunk_size = gran_size; chunk_size < (1ULL<<32);
1370 chunk_size <<= 1) { 1439 chunk_size <<= 1) {
1371 int num_reg;
1372 1440
1373 if (debug_print) {
1374 char chunk_factor;
1375 unsigned long chunk_base;
1376
1377 chunk_base = to_size_factor(chunk_size>>10, &chunk_factor),
1378 printk(KERN_INFO "\n");
1379 printk(KERN_INFO "gran_size: %ld%c chunk_size: %ld%c \n",
1380 gran_base, gran_factor, chunk_base, chunk_factor);
1381 }
1382 if (i >= NUM_RESULT) 1441 if (i >= NUM_RESULT)
1383 continue; 1442 continue;
1384 1443
1385 /* convert ranges to var ranges state */ 1444 mtrr_calc_range_state(chunk_size, gran_size,
1386 num_reg = x86_setup_var_mtrrs(range, nr_range, 1445 extra_remove_base, extra_remove_size, i);
1387 chunk_size, gran_size); 1446 if (debug_print) {
1388 1447 mtrr_print_out_one_result(i);
1389 /* we got new setting in range_state, check it */ 1448 printk(KERN_INFO "\n");
1390 memset(range_new, 0, sizeof(range_new));
1391 nr_range_new = x86_get_mtrr_mem_range(range_new, 0,
1392 extra_remove_base, extra_remove_size);
1393 range_sums_new = sum_ranges(range_new, nr_range_new);
1394
1395 result[i].chunk_sizek = chunk_size >> 10;
1396 result[i].gran_sizek = gran_size >> 10;
1397 result[i].num_reg = num_reg;
1398 if (range_sums < range_sums_new) {
1399 result[i].lose_cover_sizek =
1400 (range_sums_new - range_sums) << PSHIFT;
1401 result[i].bad = 1;
1402 } else
1403 result[i].lose_cover_sizek =
1404 (range_sums - range_sums_new) << PSHIFT;
1405
1406 /* double check it */
1407 if (!result[i].bad && !result[i].lose_cover_sizek) {
1408 if (nr_range_new != nr_range ||
1409 memcmp(range, range_new, sizeof(range)))
1410 result[i].bad = 1;
1411 } 1449 }
1412 1450
1413 if (!result[i].bad && (range_sums - range_sums_new <
1414 min_loss_pfn[num_reg])) {
1415 min_loss_pfn[num_reg] =
1416 range_sums - range_sums_new;
1417 }
1418 i++; 1451 i++;
1419 } 1452 }
1420 } 1453 }
1421 1454
1422 /* print out all */
1423 for (i = 0; i < NUM_RESULT; i++) {
1424 char gran_factor, chunk_factor, lose_factor;
1425 unsigned long gran_base, chunk_base, lose_base;
1426
1427 gran_base = to_size_factor(result[i].gran_sizek, &gran_factor),
1428 chunk_base = to_size_factor(result[i].chunk_sizek, &chunk_factor),
1429 lose_base = to_size_factor(result[i].lose_cover_sizek, &lose_factor),
1430 printk(KERN_INFO "%sgran_size: %ld%c \tchunk_size: %ld%c \t",
1431 result[i].bad?"*BAD*":" ",
1432 gran_base, gran_factor, chunk_base, chunk_factor);
1433 printk(KERN_CONT "num_reg: %d \tlose cover RAM: %s%ld%c\n",
1434 result[i].num_reg, result[i].bad?"-":"",
1435 lose_base, lose_factor);
1436 }
1437
1438 /* try to find the optimal index */ 1455 /* try to find the optimal index */
1439 if (nr_mtrr_spare_reg >= num_var_ranges) 1456 index_good = mtrr_search_optimal_index();
1440 nr_mtrr_spare_reg = num_var_ranges - 1;
1441 num_reg_good = -1;
1442 for (i = num_var_ranges - nr_mtrr_spare_reg; i > 0; i--) {
1443 if (!min_loss_pfn[i])
1444 num_reg_good = i;
1445 }
1446
1447 index_good = -1;
1448 if (num_reg_good != -1) {
1449 for (i = 0; i < NUM_RESULT; i++) {
1450 if (!result[i].bad &&
1451 result[i].num_reg == num_reg_good &&
1452 !result[i].lose_cover_sizek) {
1453 index_good = i;
1454 break;
1455 }
1456 }
1457 }
1458 1457
1459 if (index_good != -1) { 1458 if (index_good != -1) {
1460 char gran_factor, chunk_factor, lose_factor;
1461 unsigned long gran_base, chunk_base, lose_base;
1462
1463 printk(KERN_INFO "Found optimal setting for mtrr clean up\n"); 1459 printk(KERN_INFO "Found optimal setting for mtrr clean up\n");
1464 i = index_good; 1460 i = index_good;
1465 gran_base = to_size_factor(result[i].gran_sizek, &gran_factor), 1461 mtrr_print_out_one_result(i);
1466 chunk_base = to_size_factor(result[i].chunk_sizek, &chunk_factor), 1462
1467 lose_base = to_size_factor(result[i].lose_cover_sizek, &lose_factor),
1468 printk(KERN_INFO "gran_size: %ld%c \tchunk_size: %ld%c \t",
1469 gran_base, gran_factor, chunk_base, chunk_factor);
1470 printk(KERN_CONT "num_reg: %d \tlose RAM: %ld%c\n",
1471 result[i].num_reg, lose_base, lose_factor);
1472 /* convert ranges to var ranges state */ 1463 /* convert ranges to var ranges state */
1473 chunk_size = result[i].chunk_sizek; 1464 chunk_size = result[i].chunk_sizek;
1474 chunk_size <<= 10; 1465 chunk_size <<= 10;
1475 gran_size = result[i].gran_sizek; 1466 gran_size = result[i].gran_sizek;
1476 gran_size <<= 10; 1467 gran_size <<= 10;
1477 debug_print++;
1478 x86_setup_var_mtrrs(range, nr_range, chunk_size, gran_size); 1468 x86_setup_var_mtrrs(range, nr_range, chunk_size, gran_size);
1479 debug_print--;
1480 set_var_mtrr_all(address_bits); 1469 set_var_mtrr_all(address_bits);
1470 printk(KERN_DEBUG "New variable MTRRs\n");
1471 print_out_mtrr_range_state();
1481 return 1; 1472 return 1;
1473 } else {
1474 /* print out all */
1475 for (i = 0; i < NUM_RESULT; i++)
1476 mtrr_print_out_one_result(i);
1482 } 1477 }
1483 1478
1484 printk(KERN_INFO "mtrr_cleanup: can not find optimal value\n"); 1479 printk(KERN_INFO "mtrr_cleanup: can not find optimal value\n");
@@ -1562,7 +1557,6 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
1562{ 1557{
1563 unsigned long i, base, size, highest_pfn = 0, def, dummy; 1558 unsigned long i, base, size, highest_pfn = 0, def, dummy;
1564 mtrr_type type; 1559 mtrr_type type;
1565 int nr_range;
1566 u64 total_trim_size; 1560 u64 total_trim_size;
1567 1561
1568 /* extra one for all 0 */ 1562 /* extra one for all 0 */
diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.h b/arch/x86/kernel/cpu/mtrr/mtrr.h
index 2dc4ec656b23..ffd60409cc6d 100644
--- a/arch/x86/kernel/cpu/mtrr/mtrr.h
+++ b/arch/x86/kernel/cpu/mtrr/mtrr.h
@@ -8,11 +8,6 @@
8#define MTRRcap_MSR 0x0fe 8#define MTRRcap_MSR 0x0fe
9#define MTRRdefType_MSR 0x2ff 9#define MTRRdefType_MSR 0x2ff
10 10
11#define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg))
12#define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1)
13
14#define NUM_FIXED_RANGES 88
15#define MAX_VAR_RANGES 256
16#define MTRRfix64K_00000_MSR 0x250 11#define MTRRfix64K_00000_MSR 0x250
17#define MTRRfix16K_80000_MSR 0x258 12#define MTRRfix16K_80000_MSR 0x258
18#define MTRRfix16K_A0000_MSR 0x259 13#define MTRRfix16K_A0000_MSR 0x259
@@ -29,11 +24,7 @@
29#define MTRR_CHANGE_MASK_VARIABLE 0x02 24#define MTRR_CHANGE_MASK_VARIABLE 0x02
30#define MTRR_CHANGE_MASK_DEFTYPE 0x04 25#define MTRR_CHANGE_MASK_DEFTYPE 0x04
31 26
32/* In the Intel processor's MTRR interface, the MTRR type is always held in 27extern unsigned int mtrr_usage_table[MTRR_MAX_VAR_RANGES];
33 an 8 bit field: */
34typedef u8 mtrr_type;
35
36extern unsigned int mtrr_usage_table[MAX_VAR_RANGES];
37 28
38struct mtrr_ops { 29struct mtrr_ops {
39 u32 vendor; 30 u32 vendor;
@@ -70,13 +61,6 @@ struct set_mtrr_context {
70 u32 ccr3; 61 u32 ccr3;
71}; 62};
72 63
73struct mtrr_var_range {
74 u32 base_lo;
75 u32 base_hi;
76 u32 mask_lo;
77 u32 mask_hi;
78};
79
80void set_mtrr_done(struct set_mtrr_context *ctxt); 64void set_mtrr_done(struct set_mtrr_context *ctxt);
81void set_mtrr_cache_disable(struct set_mtrr_context *ctxt); 65void set_mtrr_cache_disable(struct set_mtrr_context *ctxt);
82void set_mtrr_prepare_save(struct set_mtrr_context *ctxt); 66void set_mtrr_prepare_save(struct set_mtrr_context *ctxt);
diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c
new file mode 100644
index 000000000000..284c399e3234
--- /dev/null
+++ b/arch/x86/kernel/cpu/vmware.c
@@ -0,0 +1,112 @@
1/*
2 * VMware Detection code.
3 *
4 * Copyright (C) 2008, VMware, Inc.
5 * Author : Alok N Kataria <akataria@vmware.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
15 * NON INFRINGEMENT. See the GNU General Public License for more
16 * details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 */
23
24#include <linux/dmi.h>
25#include <asm/div64.h>
26#include <asm/vmware.h>
27
28#define CPUID_VMWARE_INFO_LEAF 0x40000000
29#define VMWARE_HYPERVISOR_MAGIC 0x564D5868
30#define VMWARE_HYPERVISOR_PORT 0x5658
31
32#define VMWARE_PORT_CMD_GETVERSION 10
33#define VMWARE_PORT_CMD_GETHZ 45
34
35#define VMWARE_PORT(cmd, eax, ebx, ecx, edx) \
36 __asm__("inl (%%dx)" : \
37 "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) : \
38 "0"(VMWARE_HYPERVISOR_MAGIC), \
39 "1"(VMWARE_PORT_CMD_##cmd), \
40 "2"(VMWARE_HYPERVISOR_PORT), "3"(UINT_MAX) : \
41 "memory");
42
43static inline int __vmware_platform(void)
44{
45 uint32_t eax, ebx, ecx, edx;
46 VMWARE_PORT(GETVERSION, eax, ebx, ecx, edx);
47 return eax != (uint32_t)-1 && ebx == VMWARE_HYPERVISOR_MAGIC;
48}
49
50static unsigned long __vmware_get_tsc_khz(void)
51{
52 uint64_t tsc_hz;
53 uint32_t eax, ebx, ecx, edx;
54
55 VMWARE_PORT(GETHZ, eax, ebx, ecx, edx);
56
57 if (ebx == UINT_MAX)
58 return 0;
59 tsc_hz = eax | (((uint64_t)ebx) << 32);
60 do_div(tsc_hz, 1000);
61 BUG_ON(tsc_hz >> 32);
62 return tsc_hz;
63}
64
65/*
66 * While checking the dmi string infomation, just checking the product
67 * serial key should be enough, as this will always have a VMware
68 * specific string when running under VMware hypervisor.
69 */
70int vmware_platform(void)
71{
72 if (cpu_has_hypervisor) {
73 unsigned int eax, ebx, ecx, edx;
74 char hyper_vendor_id[13];
75
76 cpuid(CPUID_VMWARE_INFO_LEAF, &eax, &ebx, &ecx, &edx);
77 memcpy(hyper_vendor_id + 0, &ebx, 4);
78 memcpy(hyper_vendor_id + 4, &ecx, 4);
79 memcpy(hyper_vendor_id + 8, &edx, 4);
80 hyper_vendor_id[12] = '\0';
81 if (!strcmp(hyper_vendor_id, "VMwareVMware"))
82 return 1;
83 } else if (dmi_available && dmi_name_in_serial("VMware") &&
84 __vmware_platform())
85 return 1;
86
87 return 0;
88}
89
90unsigned long vmware_get_tsc_khz(void)
91{
92 BUG_ON(!vmware_platform());
93 return __vmware_get_tsc_khz();
94}
95
96/*
97 * VMware hypervisor takes care of exporting a reliable TSC to the guest.
98 * Still, due to timing difference when running on virtual cpus, the TSC can
99 * be marked as unstable in some cases. For example, the TSC sync check at
100 * bootup can fail due to a marginal offset between vcpus' TSCs (though the
101 * TSCs do not drift from each other). Also, the ACPI PM timer clocksource
102 * is not suitable as a watchdog when running on a hypervisor because the
103 * kernel may miss a wrap of the counter if the vcpu is descheduled for a
104 * long time. To skip these checks at runtime we set these capability bits,
105 * so that the kernel could just trust the hypervisor with providing a
106 * reliable virtual TSC that is suitable for timekeeping.
107 */
108void __cpuinit vmware_set_feature_bits(struct cpuinfo_x86 *c)
109{
110 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
111 set_cpu_cap(c, X86_FEATURE_TSC_RELIABLE);
112}
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index 72cefd1e649b..2ac1f0c2beb3 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -39,10 +39,10 @@
39#include <linux/device.h> 39#include <linux/device.h>
40#include <linux/cpu.h> 40#include <linux/cpu.h>
41#include <linux/notifier.h> 41#include <linux/notifier.h>
42#include <linux/uaccess.h>
42 43
43#include <asm/processor.h> 44#include <asm/processor.h>
44#include <asm/msr.h> 45#include <asm/msr.h>
45#include <asm/uaccess.h>
46#include <asm/system.h> 46#include <asm/system.h>
47 47
48static struct class *cpuid_class; 48static struct class *cpuid_class;
@@ -82,7 +82,7 @@ static loff_t cpuid_seek(struct file *file, loff_t offset, int orig)
82} 82}
83 83
84static ssize_t cpuid_read(struct file *file, char __user *buf, 84static ssize_t cpuid_read(struct file *file, char __user *buf,
85 size_t count, loff_t * ppos) 85 size_t count, loff_t *ppos)
86{ 86{
87 char __user *tmp = buf; 87 char __user *tmp = buf;
88 struct cpuid_regs cmd; 88 struct cpuid_regs cmd;
@@ -117,11 +117,11 @@ static int cpuid_open(struct inode *inode, struct file *file)
117 unsigned int cpu; 117 unsigned int cpu;
118 struct cpuinfo_x86 *c; 118 struct cpuinfo_x86 *c;
119 int ret = 0; 119 int ret = 0;
120 120
121 lock_kernel(); 121 lock_kernel();
122 122
123 cpu = iminor(file->f_path.dentry->d_inode); 123 cpu = iminor(file->f_path.dentry->d_inode);
124 if (cpu >= NR_CPUS || !cpu_online(cpu)) { 124 if (cpu >= nr_cpu_ids || !cpu_online(cpu)) {
125 ret = -ENXIO; /* No such CPU */ 125 ret = -ENXIO; /* No such CPU */
126 goto out; 126 goto out;
127 } 127 }
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 268553817909..c689d19e35ab 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -26,37 +26,21 @@
26#include <linux/kdebug.h> 26#include <linux/kdebug.h>
27#include <asm/smp.h> 27#include <asm/smp.h>
28#include <asm/reboot.h> 28#include <asm/reboot.h>
29#include <asm/virtext.h>
29 30
30#include <mach_ipi.h> 31#include <mach_ipi.h>
31 32
32/* This keeps a track of which one is crashing cpu. */
33static int crashing_cpu;
34 33
35#if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC) 34#if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC)
36static atomic_t waiting_for_crash_ipi;
37 35
38static int crash_nmi_callback(struct notifier_block *self, 36static void kdump_nmi_callback(int cpu, struct die_args *args)
39 unsigned long val, void *data)
40{ 37{
41 struct pt_regs *regs; 38 struct pt_regs *regs;
42#ifdef CONFIG_X86_32 39#ifdef CONFIG_X86_32
43 struct pt_regs fixed_regs; 40 struct pt_regs fixed_regs;
44#endif 41#endif
45 int cpu;
46 42
47 if (val != DIE_NMI_IPI) 43 regs = args->regs;
48 return NOTIFY_OK;
49
50 regs = ((struct die_args *)data)->regs;
51 cpu = raw_smp_processor_id();
52
53 /* Don't do anything if this handler is invoked on crashing cpu.
54 * Otherwise, system will completely hang. Crashing cpu can get
55 * an NMI if system was initially booted with nmi_watchdog parameter.
56 */
57 if (cpu == crashing_cpu)
58 return NOTIFY_STOP;
59 local_irq_disable();
60 44
61#ifdef CONFIG_X86_32 45#ifdef CONFIG_X86_32
62 if (!user_mode_vm(regs)) { 46 if (!user_mode_vm(regs)) {
@@ -65,54 +49,28 @@ static int crash_nmi_callback(struct notifier_block *self,
65 } 49 }
66#endif 50#endif
67 crash_save_cpu(regs, cpu); 51 crash_save_cpu(regs, cpu);
68 disable_local_APIC();
69 atomic_dec(&waiting_for_crash_ipi);
70 /* Assume hlt works */
71 halt();
72 for (;;)
73 cpu_relax();
74 52
75 return 1; 53 /* Disable VMX or SVM if needed.
76} 54 *
55 * We need to disable virtualization on all CPUs.
56 * Having VMX or SVM enabled on any CPU may break rebooting
57 * after the kdump kernel has finished its task.
58 */
59 cpu_emergency_vmxoff();
60 cpu_emergency_svm_disable();
77 61
78static void smp_send_nmi_allbutself(void) 62 disable_local_APIC();
79{
80 cpumask_t mask = cpu_online_map;
81 cpu_clear(safe_smp_processor_id(), mask);
82 if (!cpus_empty(mask))
83 send_IPI_mask(mask, NMI_VECTOR);
84} 63}
85 64
86static struct notifier_block crash_nmi_nb = { 65static void kdump_nmi_shootdown_cpus(void)
87 .notifier_call = crash_nmi_callback,
88};
89
90static void nmi_shootdown_cpus(void)
91{ 66{
92 unsigned long msecs; 67 nmi_shootdown_cpus(kdump_nmi_callback);
93
94 atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1);
95 /* Would it be better to replace the trap vector here? */
96 if (register_die_notifier(&crash_nmi_nb))
97 return; /* return what? */
98 /* Ensure the new callback function is set before sending
99 * out the NMI
100 */
101 wmb();
102
103 smp_send_nmi_allbutself();
104
105 msecs = 1000; /* Wait at most a second for the other cpus to stop */
106 while ((atomic_read(&waiting_for_crash_ipi) > 0) && msecs) {
107 mdelay(1);
108 msecs--;
109 }
110 68
111 /* Leave the nmi callback set */
112 disable_local_APIC(); 69 disable_local_APIC();
113} 70}
71
114#else 72#else
115static void nmi_shootdown_cpus(void) 73static void kdump_nmi_shootdown_cpus(void)
116{ 74{
117 /* There are no cpus to shootdown */ 75 /* There are no cpus to shootdown */
118} 76}
@@ -131,9 +89,15 @@ void native_machine_crash_shutdown(struct pt_regs *regs)
131 /* The kernel is broken so disable interrupts */ 89 /* The kernel is broken so disable interrupts */
132 local_irq_disable(); 90 local_irq_disable();
133 91
134 /* Make a note of crashing cpu. Will be used in NMI callback.*/ 92 kdump_nmi_shootdown_cpus();
135 crashing_cpu = safe_smp_processor_id(); 93
136 nmi_shootdown_cpus(); 94 /* Booting kdump kernel with VMX or SVM enabled won't work,
95 * because (among other limitations) we can't disable paging
96 * with the virt flags.
97 */
98 cpu_emergency_vmxoff();
99 cpu_emergency_svm_disable();
100
137 lapic_shutdown(); 101 lapic_shutdown();
138#if defined(CONFIG_X86_IO_APIC) 102#if defined(CONFIG_X86_IO_APIC)
139 disable_IO_APIC(); 103 disable_IO_APIC();
diff --git a/arch/x86/kernel/ds.c b/arch/x86/kernel/ds.c
index a2d1176c38ee..da91701a2348 100644
--- a/arch/x86/kernel/ds.c
+++ b/arch/x86/kernel/ds.c
@@ -6,14 +6,13 @@
6 * precise-event based sampling (PEBS). 6 * precise-event based sampling (PEBS).
7 * 7 *
8 * It manages: 8 * It manages:
9 * - per-thread and per-cpu allocation of BTS and PEBS 9 * - DS and BTS hardware configuration
10 * - buffer memory allocation (optional) 10 * - buffer overflow handling (to be done)
11 * - buffer overflow handling
12 * - buffer access 11 * - buffer access
13 * 12 *
14 * It assumes: 13 * It does not do:
15 * - get_task_struct on all parameter tasks 14 * - security checking (is the caller allowed to trace the task)
16 * - current is allowed to trace parameter tasks 15 * - buffer allocation (memory accounting)
17 * 16 *
18 * 17 *
19 * Copyright (C) 2007-2008 Intel Corporation. 18 * Copyright (C) 2007-2008 Intel Corporation.
@@ -28,22 +27,69 @@
28#include <linux/slab.h> 27#include <linux/slab.h>
29#include <linux/sched.h> 28#include <linux/sched.h>
30#include <linux/mm.h> 29#include <linux/mm.h>
30#include <linux/kernel.h>
31 31
32 32
33/* 33/*
34 * The configuration for a particular DS hardware implementation. 34 * The configuration for a particular DS hardware implementation.
35 */ 35 */
36struct ds_configuration { 36struct ds_configuration {
37 /* the size of the DS structure in bytes */ 37 /* the name of the configuration */
38 unsigned char sizeof_ds; 38 const char *name;
39 /* the size of one pointer-typed field in the DS structure in bytes; 39 /* the size of one pointer-typed field in the DS structure and
40 this covers the first 8 fields related to buffer management. */ 40 in the BTS and PEBS buffers in bytes;
41 this covers the first 8 DS fields related to buffer management. */
41 unsigned char sizeof_field; 42 unsigned char sizeof_field;
42 /* the size of a BTS/PEBS record in bytes */ 43 /* the size of a BTS/PEBS record in bytes */
43 unsigned char sizeof_rec[2]; 44 unsigned char sizeof_rec[2];
45 /* a series of bit-masks to control various features indexed
46 * by enum ds_feature */
47 unsigned long ctl[dsf_ctl_max];
44}; 48};
45static struct ds_configuration ds_cfg; 49static DEFINE_PER_CPU(struct ds_configuration, ds_cfg_array);
46 50
51#define ds_cfg per_cpu(ds_cfg_array, smp_processor_id())
52
53#define MAX_SIZEOF_DS (12 * 8) /* maximal size of a DS configuration */
54#define MAX_SIZEOF_BTS (3 * 8) /* maximal size of a BTS record */
55#define DS_ALIGNMENT (1 << 3) /* BTS and PEBS buffer alignment */
56
57#define BTS_CONTROL \
58 (ds_cfg.ctl[dsf_bts] | ds_cfg.ctl[dsf_bts_kernel] | ds_cfg.ctl[dsf_bts_user] |\
59 ds_cfg.ctl[dsf_bts_overflow])
60
61
62/*
63 * A BTS or PEBS tracer.
64 *
65 * This holds the configuration of the tracer and serves as a handle
66 * to identify tracers.
67 */
68struct ds_tracer {
69 /* the DS context (partially) owned by this tracer */
70 struct ds_context *context;
71 /* the buffer provided on ds_request() and its size in bytes */
72 void *buffer;
73 size_t size;
74};
75
76struct bts_tracer {
77 /* the common DS part */
78 struct ds_tracer ds;
79 /* the trace including the DS configuration */
80 struct bts_trace trace;
81 /* buffer overflow notification function */
82 bts_ovfl_callback_t ovfl;
83};
84
85struct pebs_tracer {
86 /* the common DS part */
87 struct ds_tracer ds;
88 /* the trace including the DS configuration */
89 struct pebs_trace trace;
90 /* buffer overflow notification function */
91 pebs_ovfl_callback_t ovfl;
92};
47 93
48/* 94/*
49 * Debug Store (DS) save area configuration (see Intel64 and IA32 95 * Debug Store (DS) save area configuration (see Intel64 and IA32
@@ -109,32 +155,9 @@ static inline void ds_set(unsigned char *base, enum ds_qualifier qual,
109 155
110 156
111/* 157/*
112 * Locking is done only for allocating BTS or PEBS resources and for 158 * Locking is done only for allocating BTS or PEBS resources.
113 * guarding context and buffer memory allocation.
114 *
115 * Most functions require the current task to own the ds context part
116 * they are going to access. All the locking is done when validating
117 * access to the context.
118 */ 159 */
119static spinlock_t ds_lock = __SPIN_LOCK_UNLOCKED(ds_lock); 160static DEFINE_SPINLOCK(ds_lock);
120
121/*
122 * Validate that the current task is allowed to access the BTS/PEBS
123 * buffer of the parameter task.
124 *
125 * Returns 0, if access is granted; -Eerrno, otherwise.
126 */
127static inline int ds_validate_access(struct ds_context *context,
128 enum ds_qualifier qual)
129{
130 if (!context)
131 return -EPERM;
132
133 if (context->owner[qual] == current)
134 return 0;
135
136 return -EPERM;
137}
138 161
139 162
140/* 163/*
@@ -150,27 +173,32 @@ static inline int ds_validate_access(struct ds_context *context,
150 * >0 number of per-thread tracers 173 * >0 number of per-thread tracers
151 * <0 number of per-cpu tracers 174 * <0 number of per-cpu tracers
152 * 175 *
153 * The below functions to get and put tracers and to check the
154 * allocation type require the ds_lock to be held by the caller.
155 *
156 * Tracers essentially gives the number of ds contexts for a certain 176 * Tracers essentially gives the number of ds contexts for a certain
157 * type of allocation. 177 * type of allocation.
158 */ 178 */
159static long tracers; 179static atomic_t tracers = ATOMIC_INIT(0);
160 180
161static inline void get_tracer(struct task_struct *task) 181static inline void get_tracer(struct task_struct *task)
162{ 182{
163 tracers += (task ? 1 : -1); 183 if (task)
184 atomic_inc(&tracers);
185 else
186 atomic_dec(&tracers);
164} 187}
165 188
166static inline void put_tracer(struct task_struct *task) 189static inline void put_tracer(struct task_struct *task)
167{ 190{
168 tracers -= (task ? 1 : -1); 191 if (task)
192 atomic_dec(&tracers);
193 else
194 atomic_inc(&tracers);
169} 195}
170 196
171static inline int check_tracer(struct task_struct *task) 197static inline int check_tracer(struct task_struct *task)
172{ 198{
173 return (task ? (tracers >= 0) : (tracers <= 0)); 199 return task ?
200 (atomic_read(&tracers) >= 0) :
201 (atomic_read(&tracers) <= 0);
174} 202}
175 203
176 204
@@ -183,99 +211,70 @@ static inline int check_tracer(struct task_struct *task)
183 * 211 *
184 * Contexts are use-counted. They are allocated on first access and 212 * Contexts are use-counted. They are allocated on first access and
185 * deallocated when the last user puts the context. 213 * deallocated when the last user puts the context.
186 *
187 * We distinguish between an allocating and a non-allocating get of a
188 * context:
189 * - the allocating get is used for requesting BTS/PEBS resources. It
190 * requires the caller to hold the global ds_lock.
191 * - the non-allocating get is used for all other cases. A
192 * non-existing context indicates an error. It acquires and releases
193 * the ds_lock itself for obtaining the context.
194 *
195 * A context and its DS configuration are allocated and deallocated
196 * together. A context always has a DS configuration of the
197 * appropriate size.
198 */
199static DEFINE_PER_CPU(struct ds_context *, system_context);
200
201#define this_system_context per_cpu(system_context, smp_processor_id())
202
203/*
204 * Returns the pointer to the parameter task's context or to the
205 * system-wide context, if task is NULL.
206 *
207 * Increases the use count of the returned context, if not NULL.
208 */ 214 */
209static inline struct ds_context *ds_get_context(struct task_struct *task) 215struct ds_context {
210{ 216 /* pointer to the DS configuration; goes into MSR_IA32_DS_AREA */
211 struct ds_context *context; 217 unsigned char ds[MAX_SIZEOF_DS];
212 unsigned long irq; 218 /* the owner of the BTS and PEBS configuration, respectively */
219 struct bts_tracer *bts_master;
220 struct pebs_tracer *pebs_master;
221 /* use count */
222 unsigned long count;
223 /* a pointer to the context location inside the thread_struct
224 * or the per_cpu context array */
225 struct ds_context **this;
226 /* a pointer to the task owning this context, or NULL, if the
227 * context is owned by a cpu */
228 struct task_struct *task;
229};
213 230
214 spin_lock_irqsave(&ds_lock, irq); 231static DEFINE_PER_CPU(struct ds_context *, system_context_array);
215 232
216 context = (task ? task->thread.ds_ctx : this_system_context); 233#define system_context per_cpu(system_context_array, smp_processor_id())
217 if (context)
218 context->count++;
219 234
220 spin_unlock_irqrestore(&ds_lock, irq);
221
222 return context;
223}
224 235
225/* 236static inline struct ds_context *ds_get_context(struct task_struct *task)
226 * Same as ds_get_context, but allocates the context and it's DS
227 * structure, if necessary; returns NULL; if out of memory.
228 */
229static inline struct ds_context *ds_alloc_context(struct task_struct *task)
230{ 237{
231 struct ds_context **p_context = 238 struct ds_context **p_context =
232 (task ? &task->thread.ds_ctx : &this_system_context); 239 (task ? &task->thread.ds_ctx : &system_context);
233 struct ds_context *context = *p_context; 240 struct ds_context *context = NULL;
241 struct ds_context *new_context = NULL;
234 unsigned long irq; 242 unsigned long irq;
235 243
236 if (!context) { 244 /* Chances are small that we already have a context. */
237 context = kzalloc(sizeof(*context), GFP_KERNEL); 245 new_context = kzalloc(sizeof(*new_context), GFP_KERNEL);
238 if (!context) 246 if (!new_context)
239 return NULL; 247 return NULL;
240
241 context->ds = kzalloc(ds_cfg.sizeof_ds, GFP_KERNEL);
242 if (!context->ds) {
243 kfree(context);
244 return NULL;
245 }
246 248
247 spin_lock_irqsave(&ds_lock, irq); 249 spin_lock_irqsave(&ds_lock, irq);
248 250
249 if (*p_context) { 251 context = *p_context;
250 kfree(context->ds); 252 if (!context) {
251 kfree(context); 253 context = new_context;
252 254
253 context = *p_context; 255 context->this = p_context;
254 } else { 256 context->task = task;
255 *p_context = context; 257 context->count = 0;
256 258
257 context->this = p_context; 259 if (task)
258 context->task = task; 260 set_tsk_thread_flag(task, TIF_DS_AREA_MSR);
259 261
260 if (task) 262 if (!task || (task == current))
261 set_tsk_thread_flag(task, TIF_DS_AREA_MSR); 263 wrmsrl(MSR_IA32_DS_AREA, (unsigned long)context->ds);
262 264
263 if (!task || (task == current)) 265 *p_context = context;
264 wrmsrl(MSR_IA32_DS_AREA,
265 (unsigned long)context->ds);
266 }
267 spin_unlock_irqrestore(&ds_lock, irq);
268 } 266 }
269 267
270 context->count++; 268 context->count++;
271 269
270 spin_unlock_irqrestore(&ds_lock, irq);
271
272 if (context != new_context)
273 kfree(new_context);
274
272 return context; 275 return context;
273} 276}
274 277
275/*
276 * Decreases the use count of the parameter context, if not NULL.
277 * Deallocates the context, if the use count reaches zero.
278 */
279static inline void ds_put_context(struct ds_context *context) 278static inline void ds_put_context(struct ds_context *context)
280{ 279{
281 unsigned long irq; 280 unsigned long irq;
@@ -285,8 +284,10 @@ static inline void ds_put_context(struct ds_context *context)
285 284
286 spin_lock_irqsave(&ds_lock, irq); 285 spin_lock_irqsave(&ds_lock, irq);
287 286
288 if (--context->count) 287 if (--context->count) {
289 goto out; 288 spin_unlock_irqrestore(&ds_lock, irq);
289 return;
290 }
290 291
291 *(context->this) = NULL; 292 *(context->this) = NULL;
292 293
@@ -296,135 +297,263 @@ static inline void ds_put_context(struct ds_context *context)
296 if (!context->task || (context->task == current)) 297 if (!context->task || (context->task == current))
297 wrmsrl(MSR_IA32_DS_AREA, 0); 298 wrmsrl(MSR_IA32_DS_AREA, 0);
298 299
299 put_tracer(context->task); 300 spin_unlock_irqrestore(&ds_lock, irq);
300 301
301 /* free any leftover buffers from tracers that did not
302 * deallocate them properly. */
303 kfree(context->buffer[ds_bts]);
304 kfree(context->buffer[ds_pebs]);
305 kfree(context->ds);
306 kfree(context); 302 kfree(context);
307 out:
308 spin_unlock_irqrestore(&ds_lock, irq);
309} 303}
310 304
311 305
312/* 306/*
313 * Handle a buffer overflow 307 * Call the tracer's callback on a buffer overflow.
314 * 308 *
315 * task: the task whose buffers are overflowing;
316 * NULL for a buffer overflow on the current cpu
317 * context: the ds context 309 * context: the ds context
318 * qual: the buffer type 310 * qual: the buffer type
319 */ 311 */
320static void ds_overflow(struct task_struct *task, struct ds_context *context, 312static void ds_overflow(struct ds_context *context, enum ds_qualifier qual)
321 enum ds_qualifier qual)
322{ 313{
323 if (!context) 314 switch (qual) {
324 return; 315 case ds_bts:
325 316 if (context->bts_master &&
326 if (context->callback[qual]) 317 context->bts_master->ovfl)
327 (*context->callback[qual])(task); 318 context->bts_master->ovfl(context->bts_master);
328 319 break;
329 /* todo: do some more overflow handling */ 320 case ds_pebs:
321 if (context->pebs_master &&
322 context->pebs_master->ovfl)
323 context->pebs_master->ovfl(context->pebs_master);
324 break;
325 }
330} 326}
331 327
332 328
333/* 329/*
334 * Allocate a non-pageable buffer of the parameter size. 330 * Write raw data into the BTS or PEBS buffer.
335 * Checks the memory and the locked memory rlimit.
336 * 331 *
337 * Returns the buffer, if successful; 332 * The remainder of any partially written record is zeroed out.
338 * NULL, if out of memory or rlimit exceeded.
339 * 333 *
340 * size: the requested buffer size in bytes 334 * context: the DS context
341 * pages (out): if not NULL, contains the number of pages reserved 335 * qual: the buffer type
336 * record: the data to write
337 * size: the size of the data
342 */ 338 */
343static inline void *ds_allocate_buffer(size_t size, unsigned int *pages) 339static int ds_write(struct ds_context *context, enum ds_qualifier qual,
340 const void *record, size_t size)
344{ 341{
345 unsigned long rlim, vm, pgsz; 342 int bytes_written = 0;
346 void *buffer;
347 343
348 pgsz = PAGE_ALIGN(size) >> PAGE_SHIFT; 344 if (!record)
345 return -EINVAL;
349 346
350 rlim = current->signal->rlim[RLIMIT_AS].rlim_cur >> PAGE_SHIFT; 347 while (size) {
351 vm = current->mm->total_vm + pgsz; 348 unsigned long base, index, end, write_end, int_th;
352 if (rlim < vm) 349 unsigned long write_size, adj_write_size;
353 return NULL;
354 350
355 rlim = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur >> PAGE_SHIFT; 351 /*
356 vm = current->mm->locked_vm + pgsz; 352 * write as much as possible without producing an
357 if (rlim < vm) 353 * overflow interrupt.
358 return NULL; 354 *
355 * interrupt_threshold must either be
356 * - bigger than absolute_maximum or
357 * - point to a record between buffer_base and absolute_maximum
358 *
359 * index points to a valid record.
360 */
361 base = ds_get(context->ds, qual, ds_buffer_base);
362 index = ds_get(context->ds, qual, ds_index);
363 end = ds_get(context->ds, qual, ds_absolute_maximum);
364 int_th = ds_get(context->ds, qual, ds_interrupt_threshold);
359 365
360 buffer = kzalloc(size, GFP_KERNEL); 366 write_end = min(end, int_th);
361 if (!buffer)
362 return NULL;
363 367
364 current->mm->total_vm += pgsz; 368 /* if we are already beyond the interrupt threshold,
365 current->mm->locked_vm += pgsz; 369 * we fill the entire buffer */
370 if (write_end <= index)
371 write_end = end;
366 372
367 if (pages) 373 if (write_end <= index)
368 *pages = pgsz; 374 break;
375
376 write_size = min((unsigned long) size, write_end - index);
377 memcpy((void *)index, record, write_size);
369 378
370 return buffer; 379 record = (const char *)record + write_size;
380 size -= write_size;
381 bytes_written += write_size;
382
383 adj_write_size = write_size / ds_cfg.sizeof_rec[qual];
384 adj_write_size *= ds_cfg.sizeof_rec[qual];
385
386 /* zero out trailing bytes */
387 memset((char *)index + write_size, 0,
388 adj_write_size - write_size);
389 index += adj_write_size;
390
391 if (index >= end)
392 index = base;
393 ds_set(context->ds, qual, ds_index, index);
394
395 if (index >= int_th)
396 ds_overflow(context, qual);
397 }
398
399 return bytes_written;
371} 400}
372 401
373static int ds_request(struct task_struct *task, void *base, size_t size, 402
374 ds_ovfl_callback_t ovfl, enum ds_qualifier qual) 403/*
404 * Branch Trace Store (BTS) uses the following format. Different
405 * architectures vary in the size of those fields.
406 * - source linear address
407 * - destination linear address
408 * - flags
409 *
410 * Later architectures use 64bit pointers throughout, whereas earlier
411 * architectures use 32bit pointers in 32bit mode.
412 *
413 * We compute the base address for the first 8 fields based on:
414 * - the field size stored in the DS configuration
415 * - the relative field position
416 *
417 * In order to store additional information in the BTS buffer, we use
418 * a special source address to indicate that the record requires
419 * special interpretation.
420 *
421 * Netburst indicated via a bit in the flags field whether the branch
422 * was predicted; this is ignored.
423 *
424 * We use two levels of abstraction:
425 * - the raw data level defined here
426 * - an arch-independent level defined in ds.h
427 */
428
429enum bts_field {
430 bts_from,
431 bts_to,
432 bts_flags,
433
434 bts_qual = bts_from,
435 bts_jiffies = bts_to,
436 bts_pid = bts_flags,
437
438 bts_qual_mask = (bts_qual_max - 1),
439 bts_escape = ((unsigned long)-1 & ~bts_qual_mask)
440};
441
442static inline unsigned long bts_get(const char *base, enum bts_field field)
375{ 443{
376 struct ds_context *context; 444 base += (ds_cfg.sizeof_field * field);
377 unsigned long buffer, adj; 445 return *(unsigned long *)base;
378 const unsigned long alignment = (1 << 3); 446}
379 unsigned long irq; 447
380 int error = 0; 448static inline void bts_set(char *base, enum bts_field field, unsigned long val)
449{
450 base += (ds_cfg.sizeof_field * field);;
451 (*(unsigned long *)base) = val;
452}
381 453
382 if (!ds_cfg.sizeof_ds)
383 return -EOPNOTSUPP;
384 454
385 /* we require some space to do alignment adjustments below */ 455/*
386 if (size < (alignment + ds_cfg.sizeof_rec[qual])) 456 * The raw BTS data is architecture dependent.
457 *
458 * For higher-level users, we give an arch-independent view.
459 * - ds.h defines struct bts_struct
460 * - bts_read translates one raw bts record into a bts_struct
461 * - bts_write translates one bts_struct into the raw format and
462 * writes it into the top of the parameter tracer's buffer.
463 *
464 * return: bytes read/written on success; -Eerrno, otherwise
465 */
466static int bts_read(struct bts_tracer *tracer, const void *at,
467 struct bts_struct *out)
468{
469 if (!tracer)
387 return -EINVAL; 470 return -EINVAL;
388 471
389 /* buffer overflow notification is not yet implemented */ 472 if (at < tracer->trace.ds.begin)
390 if (ovfl) 473 return -EINVAL;
391 return -EOPNOTSUPP;
392 474
475 if (tracer->trace.ds.end < (at + tracer->trace.ds.size))
476 return -EINVAL;
393 477
394 context = ds_alloc_context(task); 478 memset(out, 0, sizeof(*out));
395 if (!context) 479 if ((bts_get(at, bts_qual) & ~bts_qual_mask) == bts_escape) {
396 return -ENOMEM; 480 out->qualifier = (bts_get(at, bts_qual) & bts_qual_mask);
481 out->variant.timestamp.jiffies = bts_get(at, bts_jiffies);
482 out->variant.timestamp.pid = bts_get(at, bts_pid);
483 } else {
484 out->qualifier = bts_branch;
485 out->variant.lbr.from = bts_get(at, bts_from);
486 out->variant.lbr.to = bts_get(at, bts_to);
487
488 if (!out->variant.lbr.from && !out->variant.lbr.to)
489 out->qualifier = bts_invalid;
490 }
397 491
398 spin_lock_irqsave(&ds_lock, irq); 492 return ds_cfg.sizeof_rec[ds_bts];
493}
399 494
400 error = -EPERM; 495static int bts_write(struct bts_tracer *tracer, const struct bts_struct *in)
401 if (!check_tracer(task)) 496{
402 goto out_unlock; 497 unsigned char raw[MAX_SIZEOF_BTS];
403 498
404 get_tracer(task); 499 if (!tracer)
500 return -EINVAL;
405 501
406 error = -EALREADY; 502 if (MAX_SIZEOF_BTS < ds_cfg.sizeof_rec[ds_bts])
407 if (context->owner[qual] == current) 503 return -EOVERFLOW;
408 goto out_put_tracer;
409 error = -EPERM;
410 if (context->owner[qual] != NULL)
411 goto out_put_tracer;
412 context->owner[qual] = current;
413 504
414 spin_unlock_irqrestore(&ds_lock, irq); 505 switch (in->qualifier) {
506 case bts_invalid:
507 bts_set(raw, bts_from, 0);
508 bts_set(raw, bts_to, 0);
509 bts_set(raw, bts_flags, 0);
510 break;
511 case bts_branch:
512 bts_set(raw, bts_from, in->variant.lbr.from);
513 bts_set(raw, bts_to, in->variant.lbr.to);
514 bts_set(raw, bts_flags, 0);
515 break;
516 case bts_task_arrives:
517 case bts_task_departs:
518 bts_set(raw, bts_qual, (bts_escape | in->qualifier));
519 bts_set(raw, bts_jiffies, in->variant.timestamp.jiffies);
520 bts_set(raw, bts_pid, in->variant.timestamp.pid);
521 break;
522 default:
523 return -EINVAL;
524 }
415 525
526 return ds_write(tracer->ds.context, ds_bts, raw,
527 ds_cfg.sizeof_rec[ds_bts]);
528}
416 529
417 error = -ENOMEM;
418 if (!base) {
419 base = ds_allocate_buffer(size, &context->pages[qual]);
420 if (!base)
421 goto out_release;
422 530
423 context->buffer[qual] = base; 531static void ds_write_config(struct ds_context *context,
424 } 532 struct ds_trace *cfg, enum ds_qualifier qual)
425 error = 0; 533{
534 unsigned char *ds = context->ds;
535
536 ds_set(ds, qual, ds_buffer_base, (unsigned long)cfg->begin);
537 ds_set(ds, qual, ds_index, (unsigned long)cfg->top);
538 ds_set(ds, qual, ds_absolute_maximum, (unsigned long)cfg->end);
539 ds_set(ds, qual, ds_interrupt_threshold, (unsigned long)cfg->ith);
540}
541
542static void ds_read_config(struct ds_context *context,
543 struct ds_trace *cfg, enum ds_qualifier qual)
544{
545 unsigned char *ds = context->ds;
426 546
427 context->callback[qual] = ovfl; 547 cfg->begin = (void *)ds_get(ds, qual, ds_buffer_base);
548 cfg->top = (void *)ds_get(ds, qual, ds_index);
549 cfg->end = (void *)ds_get(ds, qual, ds_absolute_maximum);
550 cfg->ith = (void *)ds_get(ds, qual, ds_interrupt_threshold);
551}
552
553static void ds_init_ds_trace(struct ds_trace *trace, enum ds_qualifier qual,
554 void *base, size_t size, size_t ith,
555 unsigned int flags) {
556 unsigned long buffer, adj;
428 557
429 /* adjust the buffer address and size to meet alignment 558 /* adjust the buffer address and size to meet alignment
430 * constraints: 559 * constraints:
@@ -436,410 +565,383 @@ static int ds_request(struct task_struct *task, void *base, size_t size,
436 */ 565 */
437 buffer = (unsigned long)base; 566 buffer = (unsigned long)base;
438 567
439 adj = ALIGN(buffer, alignment) - buffer; 568 adj = ALIGN(buffer, DS_ALIGNMENT) - buffer;
440 buffer += adj; 569 buffer += adj;
441 size -= adj; 570 size -= adj;
442 571
443 size /= ds_cfg.sizeof_rec[qual]; 572 trace->n = size / ds_cfg.sizeof_rec[qual];
444 size *= ds_cfg.sizeof_rec[qual]; 573 trace->size = ds_cfg.sizeof_rec[qual];
445
446 ds_set(context->ds, qual, ds_buffer_base, buffer);
447 ds_set(context->ds, qual, ds_index, buffer);
448 ds_set(context->ds, qual, ds_absolute_maximum, buffer + size);
449 574
450 if (ovfl) { 575 size = (trace->n * trace->size);
451 /* todo: select a suitable interrupt threshold */
452 } else
453 ds_set(context->ds, qual,
454 ds_interrupt_threshold, buffer + size + 1);
455 576
456 /* we keep the context until ds_release */ 577 trace->begin = (void *)buffer;
457 return error; 578 trace->top = trace->begin;
458 579 trace->end = (void *)(buffer + size);
459 out_release: 580 /* The value for 'no threshold' is -1, which will set the
460 context->owner[qual] = NULL; 581 * threshold outside of the buffer, just like we want it.
461 ds_put_context(context); 582 */
462 put_tracer(task); 583 trace->ith = (void *)(buffer + size - ith);
463 return error;
464
465 out_put_tracer:
466 spin_unlock_irqrestore(&ds_lock, irq);
467 ds_put_context(context);
468 put_tracer(task);
469 return error;
470 584
471 out_unlock: 585 trace->flags = flags;
472 spin_unlock_irqrestore(&ds_lock, irq);
473 ds_put_context(context);
474 return error;
475} 586}
476 587
477int ds_request_bts(struct task_struct *task, void *base, size_t size,
478 ds_ovfl_callback_t ovfl)
479{
480 return ds_request(task, base, size, ovfl, ds_bts);
481}
482 588
483int ds_request_pebs(struct task_struct *task, void *base, size_t size, 589static int ds_request(struct ds_tracer *tracer, struct ds_trace *trace,
484 ds_ovfl_callback_t ovfl) 590 enum ds_qualifier qual, struct task_struct *task,
485{ 591 void *base, size_t size, size_t th, unsigned int flags)
486 return ds_request(task, base, size, ovfl, ds_pebs);
487}
488
489static int ds_release(struct task_struct *task, enum ds_qualifier qual)
490{ 592{
491 struct ds_context *context; 593 struct ds_context *context;
492 int error; 594 int error;
493 595
494 context = ds_get_context(task); 596 error = -EINVAL;
495 error = ds_validate_access(context, qual); 597 if (!base)
496 if (error < 0)
497 goto out; 598 goto out;
498 599
499 kfree(context->buffer[qual]); 600 /* we require some space to do alignment adjustments below */
500 context->buffer[qual] = NULL; 601 error = -EINVAL;
501 602 if (size < (DS_ALIGNMENT + ds_cfg.sizeof_rec[qual]))
502 current->mm->total_vm -= context->pages[qual]; 603 goto out;
503 current->mm->locked_vm -= context->pages[qual];
504 context->pages[qual] = 0;
505 context->owner[qual] = NULL;
506
507 /*
508 * we put the context twice:
509 * once for the ds_get_context
510 * once for the corresponding ds_request
511 */
512 ds_put_context(context);
513 out:
514 ds_put_context(context);
515 return error;
516}
517 604
518int ds_release_bts(struct task_struct *task) 605 if (th != (size_t)-1) {
519{ 606 th *= ds_cfg.sizeof_rec[qual];
520 return ds_release(task, ds_bts);
521}
522 607
523int ds_release_pebs(struct task_struct *task) 608 error = -EINVAL;
524{ 609 if (size <= th)
525 return ds_release(task, ds_pebs); 610 goto out;
526} 611 }
527 612
528static int ds_get_index(struct task_struct *task, size_t *pos, 613 tracer->buffer = base;
529 enum ds_qualifier qual) 614 tracer->size = size;
530{
531 struct ds_context *context;
532 unsigned long base, index;
533 int error;
534 615
616 error = -ENOMEM;
535 context = ds_get_context(task); 617 context = ds_get_context(task);
536 error = ds_validate_access(context, qual); 618 if (!context)
537 if (error < 0)
538 goto out; 619 goto out;
620 tracer->context = context;
539 621
540 base = ds_get(context->ds, qual, ds_buffer_base); 622 ds_init_ds_trace(trace, qual, base, size, th, flags);
541 index = ds_get(context->ds, qual, ds_index);
542 623
543 error = ((index - base) / ds_cfg.sizeof_rec[qual]); 624 error = 0;
544 if (pos)
545 *pos = error;
546 out: 625 out:
547 ds_put_context(context);
548 return error; 626 return error;
549} 627}
550 628
551int ds_get_bts_index(struct task_struct *task, size_t *pos) 629struct bts_tracer *ds_request_bts(struct task_struct *task,
552{ 630 void *base, size_t size,
553 return ds_get_index(task, pos, ds_bts); 631 bts_ovfl_callback_t ovfl, size_t th,
554} 632 unsigned int flags)
555
556int ds_get_pebs_index(struct task_struct *task, size_t *pos)
557{ 633{
558 return ds_get_index(task, pos, ds_pebs); 634 struct bts_tracer *tracer;
559} 635 unsigned long irq;
560
561static int ds_get_end(struct task_struct *task, size_t *pos,
562 enum ds_qualifier qual)
563{
564 struct ds_context *context;
565 unsigned long base, end;
566 int error; 636 int error;
567 637
568 context = ds_get_context(task); 638 error = -EOPNOTSUPP;
569 error = ds_validate_access(context, qual); 639 if (!ds_cfg.ctl[dsf_bts])
570 if (error < 0)
571 goto out; 640 goto out;
572 641
573 base = ds_get(context->ds, qual, ds_buffer_base); 642 /* buffer overflow notification is not yet implemented */
574 end = ds_get(context->ds, qual, ds_absolute_maximum); 643 error = -EOPNOTSUPP;
644 if (ovfl)
645 goto out;
575 646
576 error = ((end - base) / ds_cfg.sizeof_rec[qual]); 647 error = -ENOMEM;
577 if (pos) 648 tracer = kzalloc(sizeof(*tracer), GFP_KERNEL);
578 *pos = error; 649 if (!tracer)
579 out: 650 goto out;
580 ds_put_context(context); 651 tracer->ovfl = ovfl;
581 return error;
582}
583 652
584int ds_get_bts_end(struct task_struct *task, size_t *pos) 653 error = ds_request(&tracer->ds, &tracer->trace.ds,
585{ 654 ds_bts, task, base, size, th, flags);
586 return ds_get_end(task, pos, ds_bts); 655 if (error < 0)
587} 656 goto out_tracer;
588 657
589int ds_get_pebs_end(struct task_struct *task, size_t *pos)
590{
591 return ds_get_end(task, pos, ds_pebs);
592}
593 658
594static int ds_access(struct task_struct *task, size_t index, 659 spin_lock_irqsave(&ds_lock, irq);
595 const void **record, enum ds_qualifier qual)
596{
597 struct ds_context *context;
598 unsigned long base, idx;
599 int error;
600 660
601 if (!record) 661 error = -EPERM;
602 return -EINVAL; 662 if (!check_tracer(task))
663 goto out_unlock;
664 get_tracer(task);
603 665
604 context = ds_get_context(task); 666 error = -EPERM;
605 error = ds_validate_access(context, qual); 667 if (tracer->ds.context->bts_master)
606 if (error < 0) 668 goto out_put_tracer;
607 goto out; 669 tracer->ds.context->bts_master = tracer;
608 670
609 base = ds_get(context->ds, qual, ds_buffer_base); 671 spin_unlock_irqrestore(&ds_lock, irq);
610 idx = base + (index * ds_cfg.sizeof_rec[qual]);
611 672
612 error = -EINVAL;
613 if (idx > ds_get(context->ds, qual, ds_absolute_maximum))
614 goto out;
615 673
616 *record = (const void *)idx; 674 tracer->trace.read = bts_read;
617 error = ds_cfg.sizeof_rec[qual]; 675 tracer->trace.write = bts_write;
618 out:
619 ds_put_context(context);
620 return error;
621}
622 676
623int ds_access_bts(struct task_struct *task, size_t index, const void **record) 677 ds_write_config(tracer->ds.context, &tracer->trace.ds, ds_bts);
624{ 678 ds_resume_bts(tracer);
625 return ds_access(task, index, record, ds_bts);
626}
627 679
628int ds_access_pebs(struct task_struct *task, size_t index, const void **record) 680 return tracer;
629{ 681
630 return ds_access(task, index, record, ds_pebs); 682 out_put_tracer:
683 put_tracer(task);
684 out_unlock:
685 spin_unlock_irqrestore(&ds_lock, irq);
686 ds_put_context(tracer->ds.context);
687 out_tracer:
688 kfree(tracer);
689 out:
690 return ERR_PTR(error);
631} 691}
632 692
633static int ds_write(struct task_struct *task, const void *record, size_t size, 693struct pebs_tracer *ds_request_pebs(struct task_struct *task,
634 enum ds_qualifier qual, int force) 694 void *base, size_t size,
695 pebs_ovfl_callback_t ovfl, size_t th,
696 unsigned int flags)
635{ 697{
636 struct ds_context *context; 698 struct pebs_tracer *tracer;
699 unsigned long irq;
637 int error; 700 int error;
638 701
639 if (!record) 702 /* buffer overflow notification is not yet implemented */
640 return -EINVAL; 703 error = -EOPNOTSUPP;
704 if (ovfl)
705 goto out;
641 706
642 error = -EPERM; 707 error = -ENOMEM;
643 context = ds_get_context(task); 708 tracer = kzalloc(sizeof(*tracer), GFP_KERNEL);
644 if (!context) 709 if (!tracer)
645 goto out; 710 goto out;
711 tracer->ovfl = ovfl;
646 712
647 if (!force) { 713 error = ds_request(&tracer->ds, &tracer->trace.ds,
648 error = ds_validate_access(context, qual); 714 ds_pebs, task, base, size, th, flags);
649 if (error < 0) 715 if (error < 0)
650 goto out; 716 goto out_tracer;
651 }
652 717
653 error = 0; 718 spin_lock_irqsave(&ds_lock, irq);
654 while (size) {
655 unsigned long base, index, end, write_end, int_th;
656 unsigned long write_size, adj_write_size;
657 719
658 /* 720 error = -EPERM;
659 * write as much as possible without producing an 721 if (!check_tracer(task))
660 * overflow interrupt. 722 goto out_unlock;
661 * 723 get_tracer(task);
662 * interrupt_threshold must either be
663 * - bigger than absolute_maximum or
664 * - point to a record between buffer_base and absolute_maximum
665 *
666 * index points to a valid record.
667 */
668 base = ds_get(context->ds, qual, ds_buffer_base);
669 index = ds_get(context->ds, qual, ds_index);
670 end = ds_get(context->ds, qual, ds_absolute_maximum);
671 int_th = ds_get(context->ds, qual, ds_interrupt_threshold);
672 724
673 write_end = min(end, int_th); 725 error = -EPERM;
726 if (tracer->ds.context->pebs_master)
727 goto out_put_tracer;
728 tracer->ds.context->pebs_master = tracer;
674 729
675 /* if we are already beyond the interrupt threshold, 730 spin_unlock_irqrestore(&ds_lock, irq);
676 * we fill the entire buffer */
677 if (write_end <= index)
678 write_end = end;
679 731
680 if (write_end <= index) 732 ds_write_config(tracer->ds.context, &tracer->trace.ds, ds_bts);
681 goto out; 733 ds_resume_pebs(tracer);
682 734
683 write_size = min((unsigned long) size, write_end - index); 735 return tracer;
684 memcpy((void *)index, record, write_size);
685 736
686 record = (const char *)record + write_size; 737 out_put_tracer:
687 size -= write_size; 738 put_tracer(task);
688 error += write_size; 739 out_unlock:
740 spin_unlock_irqrestore(&ds_lock, irq);
741 ds_put_context(tracer->ds.context);
742 out_tracer:
743 kfree(tracer);
744 out:
745 return ERR_PTR(error);
746}
689 747
690 adj_write_size = write_size / ds_cfg.sizeof_rec[qual]; 748void ds_release_bts(struct bts_tracer *tracer)
691 adj_write_size *= ds_cfg.sizeof_rec[qual]; 749{
750 if (!tracer)
751 return;
692 752
693 /* zero out trailing bytes */ 753 ds_suspend_bts(tracer);
694 memset((char *)index + write_size, 0,
695 adj_write_size - write_size);
696 index += adj_write_size;
697 754
698 if (index >= end) 755 WARN_ON_ONCE(tracer->ds.context->bts_master != tracer);
699 index = base; 756 tracer->ds.context->bts_master = NULL;
700 ds_set(context->ds, qual, ds_index, index);
701 757
702 if (index >= int_th) 758 put_tracer(tracer->ds.context->task);
703 ds_overflow(task, context, qual); 759 ds_put_context(tracer->ds.context);
704 }
705 760
706 out: 761 kfree(tracer);
707 ds_put_context(context);
708 return error;
709} 762}
710 763
711int ds_write_bts(struct task_struct *task, const void *record, size_t size) 764void ds_suspend_bts(struct bts_tracer *tracer)
712{ 765{
713 return ds_write(task, record, size, ds_bts, /* force = */ 0); 766 struct task_struct *task;
714}
715 767
716int ds_write_pebs(struct task_struct *task, const void *record, size_t size) 768 if (!tracer)
717{ 769 return;
718 return ds_write(task, record, size, ds_pebs, /* force = */ 0);
719}
720 770
721int ds_unchecked_write_bts(struct task_struct *task, 771 task = tracer->ds.context->task;
722 const void *record, size_t size)
723{
724 return ds_write(task, record, size, ds_bts, /* force = */ 1);
725}
726 772
727int ds_unchecked_write_pebs(struct task_struct *task, 773 if (!task || (task == current))
728 const void *record, size_t size) 774 update_debugctlmsr(get_debugctlmsr() & ~BTS_CONTROL);
729{ 775
730 return ds_write(task, record, size, ds_pebs, /* force = */ 1); 776 if (task) {
777 task->thread.debugctlmsr &= ~BTS_CONTROL;
778
779 if (!task->thread.debugctlmsr)
780 clear_tsk_thread_flag(task, TIF_DEBUGCTLMSR);
781 }
731} 782}
732 783
733static int ds_reset_or_clear(struct task_struct *task, 784void ds_resume_bts(struct bts_tracer *tracer)
734 enum ds_qualifier qual, int clear)
735{ 785{
736 struct ds_context *context; 786 struct task_struct *task;
737 unsigned long base, end; 787 unsigned long control;
738 int error;
739 788
740 context = ds_get_context(task); 789 if (!tracer)
741 error = ds_validate_access(context, qual); 790 return;
742 if (error < 0)
743 goto out;
744 791
745 base = ds_get(context->ds, qual, ds_buffer_base); 792 task = tracer->ds.context->task;
746 end = ds_get(context->ds, qual, ds_absolute_maximum);
747 793
748 if (clear) 794 control = ds_cfg.ctl[dsf_bts];
749 memset((void *)base, 0, end - base); 795 if (!(tracer->trace.ds.flags & BTS_KERNEL))
796 control |= ds_cfg.ctl[dsf_bts_kernel];
797 if (!(tracer->trace.ds.flags & BTS_USER))
798 control |= ds_cfg.ctl[dsf_bts_user];
750 799
751 ds_set(context->ds, qual, ds_index, base); 800 if (task) {
801 task->thread.debugctlmsr |= control;
802 set_tsk_thread_flag(task, TIF_DEBUGCTLMSR);
803 }
752 804
753 error = 0; 805 if (!task || (task == current))
754 out: 806 update_debugctlmsr(get_debugctlmsr() | control);
755 ds_put_context(context);
756 return error;
757} 807}
758 808
759int ds_reset_bts(struct task_struct *task) 809void ds_release_pebs(struct pebs_tracer *tracer)
760{ 810{
761 return ds_reset_or_clear(task, ds_bts, /* clear = */ 0); 811 if (!tracer)
812 return;
813
814 ds_suspend_pebs(tracer);
815
816 WARN_ON_ONCE(tracer->ds.context->pebs_master != tracer);
817 tracer->ds.context->pebs_master = NULL;
818
819 put_tracer(tracer->ds.context->task);
820 ds_put_context(tracer->ds.context);
821
822 kfree(tracer);
762} 823}
763 824
764int ds_reset_pebs(struct task_struct *task) 825void ds_suspend_pebs(struct pebs_tracer *tracer)
765{ 826{
766 return ds_reset_or_clear(task, ds_pebs, /* clear = */ 0); 827
767} 828}
768 829
769int ds_clear_bts(struct task_struct *task) 830void ds_resume_pebs(struct pebs_tracer *tracer)
770{ 831{
771 return ds_reset_or_clear(task, ds_bts, /* clear = */ 1); 832
772} 833}
773 834
774int ds_clear_pebs(struct task_struct *task) 835const struct bts_trace *ds_read_bts(struct bts_tracer *tracer)
775{ 836{
776 return ds_reset_or_clear(task, ds_pebs, /* clear = */ 1); 837 if (!tracer)
838 return NULL;
839
840 ds_read_config(tracer->ds.context, &tracer->trace.ds, ds_bts);
841 return &tracer->trace;
777} 842}
778 843
779int ds_get_pebs_reset(struct task_struct *task, u64 *value) 844const struct pebs_trace *ds_read_pebs(struct pebs_tracer *tracer)
780{ 845{
781 struct ds_context *context; 846 if (!tracer)
782 int error; 847 return NULL;
848
849 ds_read_config(tracer->ds.context, &tracer->trace.ds, ds_pebs);
850 tracer->trace.reset_value =
851 *(u64 *)(tracer->ds.context->ds + (ds_cfg.sizeof_field * 8));
783 852
784 if (!value) 853 return &tracer->trace;
854}
855
856int ds_reset_bts(struct bts_tracer *tracer)
857{
858 if (!tracer)
785 return -EINVAL; 859 return -EINVAL;
786 860
787 context = ds_get_context(task); 861 tracer->trace.ds.top = tracer->trace.ds.begin;
788 error = ds_validate_access(context, ds_pebs);
789 if (error < 0)
790 goto out;
791 862
792 *value = *(u64 *)(context->ds + (ds_cfg.sizeof_field * 8)); 863 ds_set(tracer->ds.context->ds, ds_bts, ds_index,
864 (unsigned long)tracer->trace.ds.top);
793 865
794 error = 0; 866 return 0;
795 out:
796 ds_put_context(context);
797 return error;
798} 867}
799 868
800int ds_set_pebs_reset(struct task_struct *task, u64 value) 869int ds_reset_pebs(struct pebs_tracer *tracer)
801{ 870{
802 struct ds_context *context; 871 if (!tracer)
803 int error; 872 return -EINVAL;
804 873
805 context = ds_get_context(task); 874 tracer->trace.ds.top = tracer->trace.ds.begin;
806 error = ds_validate_access(context, ds_pebs);
807 if (error < 0)
808 goto out;
809 875
810 *(u64 *)(context->ds + (ds_cfg.sizeof_field * 8)) = value; 876 ds_set(tracer->ds.context->ds, ds_bts, ds_index,
877 (unsigned long)tracer->trace.ds.top);
811 878
812 error = 0; 879 return 0;
813 out: 880}
814 ds_put_context(context); 881
815 return error; 882int ds_set_pebs_reset(struct pebs_tracer *tracer, u64 value)
883{
884 if (!tracer)
885 return -EINVAL;
886
887 *(u64 *)(tracer->ds.context->ds + (ds_cfg.sizeof_field * 8)) = value;
888
889 return 0;
816} 890}
817 891
818static const struct ds_configuration ds_cfg_var = { 892static const struct ds_configuration ds_cfg_netburst = {
819 .sizeof_ds = sizeof(long) * 12, 893 .name = "netburst",
820 .sizeof_field = sizeof(long), 894 .ctl[dsf_bts] = (1 << 2) | (1 << 3),
821 .sizeof_rec[ds_bts] = sizeof(long) * 3, 895 .ctl[dsf_bts_kernel] = (1 << 5),
896 .ctl[dsf_bts_user] = (1 << 6),
897
898 .sizeof_field = sizeof(long),
899 .sizeof_rec[ds_bts] = sizeof(long) * 3,
822#ifdef __i386__ 900#ifdef __i386__
823 .sizeof_rec[ds_pebs] = sizeof(long) * 10 901 .sizeof_rec[ds_pebs] = sizeof(long) * 10,
824#else 902#else
825 .sizeof_rec[ds_pebs] = sizeof(long) * 18 903 .sizeof_rec[ds_pebs] = sizeof(long) * 18,
826#endif 904#endif
827}; 905};
828static const struct ds_configuration ds_cfg_64 = { 906static const struct ds_configuration ds_cfg_pentium_m = {
829 .sizeof_ds = 8 * 12, 907 .name = "pentium m",
830 .sizeof_field = 8, 908 .ctl[dsf_bts] = (1 << 6) | (1 << 7),
831 .sizeof_rec[ds_bts] = 8 * 3, 909
910 .sizeof_field = sizeof(long),
911 .sizeof_rec[ds_bts] = sizeof(long) * 3,
832#ifdef __i386__ 912#ifdef __i386__
833 .sizeof_rec[ds_pebs] = 8 * 10 913 .sizeof_rec[ds_pebs] = sizeof(long) * 10,
834#else 914#else
835 .sizeof_rec[ds_pebs] = 8 * 18 915 .sizeof_rec[ds_pebs] = sizeof(long) * 18,
836#endif 916#endif
837}; 917};
918static const struct ds_configuration ds_cfg_core2 = {
919 .name = "core 2",
920 .ctl[dsf_bts] = (1 << 6) | (1 << 7),
921 .ctl[dsf_bts_kernel] = (1 << 9),
922 .ctl[dsf_bts_user] = (1 << 10),
923
924 .sizeof_field = 8,
925 .sizeof_rec[ds_bts] = 8 * 3,
926 .sizeof_rec[ds_pebs] = 8 * 18,
927};
838 928
839static inline void 929static void
840ds_configure(const struct ds_configuration *cfg) 930ds_configure(const struct ds_configuration *cfg)
841{ 931{
932 memset(&ds_cfg, 0, sizeof(ds_cfg));
842 ds_cfg = *cfg; 933 ds_cfg = *cfg;
934
935 printk(KERN_INFO "[ds] using %s configuration\n", ds_cfg.name);
936
937 if (!cpu_has_bts) {
938 ds_cfg.ctl[dsf_bts] = 0;
939 printk(KERN_INFO "[ds] bts not available\n");
940 }
941 if (!cpu_has_pebs)
942 printk(KERN_INFO "[ds] pebs not available\n");
943
944 WARN_ON_ONCE(MAX_SIZEOF_DS < (12 * ds_cfg.sizeof_field));
843} 945}
844 946
845void __cpuinit ds_init_intel(struct cpuinfo_x86 *c) 947void __cpuinit ds_init_intel(struct cpuinfo_x86 *c)
@@ -847,16 +949,15 @@ void __cpuinit ds_init_intel(struct cpuinfo_x86 *c)
847 switch (c->x86) { 949 switch (c->x86) {
848 case 0x6: 950 case 0x6:
849 switch (c->x86_model) { 951 switch (c->x86_model) {
952 case 0 ... 0xC:
953 /* sorry, don't know about them */
954 break;
850 case 0xD: 955 case 0xD:
851 case 0xE: /* Pentium M */ 956 case 0xE: /* Pentium M */
852 ds_configure(&ds_cfg_var); 957 ds_configure(&ds_cfg_pentium_m);
853 break; 958 break;
854 case 0xF: /* Core2 */ 959 default: /* Core2, Atom, ... */
855 case 0x1C: /* Atom */ 960 ds_configure(&ds_cfg_core2);
856 ds_configure(&ds_cfg_64);
857 break;
858 default:
859 /* sorry, don't know about them */
860 break; 961 break;
861 } 962 }
862 break; 963 break;
@@ -865,7 +966,7 @@ void __cpuinit ds_init_intel(struct cpuinfo_x86 *c)
865 case 0x0: 966 case 0x0:
866 case 0x1: 967 case 0x1:
867 case 0x2: /* Netburst */ 968 case 0x2: /* Netburst */
868 ds_configure(&ds_cfg_var); 969 ds_configure(&ds_cfg_netburst);
869 break; 970 break;
870 default: 971 default:
871 /* sorry, don't know about them */ 972 /* sorry, don't know about them */
@@ -878,12 +979,52 @@ void __cpuinit ds_init_intel(struct cpuinfo_x86 *c)
878 } 979 }
879} 980}
880 981
881void ds_free(struct ds_context *context) 982/*
983 * Change the DS configuration from tracing prev to tracing next.
984 */
985void ds_switch_to(struct task_struct *prev, struct task_struct *next)
986{
987 struct ds_context *prev_ctx = prev->thread.ds_ctx;
988 struct ds_context *next_ctx = next->thread.ds_ctx;
989
990 if (prev_ctx) {
991 update_debugctlmsr(0);
992
993 if (prev_ctx->bts_master &&
994 (prev_ctx->bts_master->trace.ds.flags & BTS_TIMESTAMPS)) {
995 struct bts_struct ts = {
996 .qualifier = bts_task_departs,
997 .variant.timestamp.jiffies = jiffies_64,
998 .variant.timestamp.pid = prev->pid
999 };
1000 bts_write(prev_ctx->bts_master, &ts);
1001 }
1002 }
1003
1004 if (next_ctx) {
1005 if (next_ctx->bts_master &&
1006 (next_ctx->bts_master->trace.ds.flags & BTS_TIMESTAMPS)) {
1007 struct bts_struct ts = {
1008 .qualifier = bts_task_arrives,
1009 .variant.timestamp.jiffies = jiffies_64,
1010 .variant.timestamp.pid = next->pid
1011 };
1012 bts_write(next_ctx->bts_master, &ts);
1013 }
1014
1015 wrmsrl(MSR_IA32_DS_AREA, (unsigned long)next_ctx->ds);
1016 }
1017
1018 update_debugctlmsr(next->thread.debugctlmsr);
1019}
1020
1021void ds_copy_thread(struct task_struct *tsk, struct task_struct *father)
1022{
1023 clear_tsk_thread_flag(tsk, TIF_DS_AREA_MSR);
1024 tsk->thread.ds_ctx = NULL;
1025}
1026
1027void ds_exit_thread(struct task_struct *tsk)
882{ 1028{
883 /* This is called when the task owning the parameter context 1029 WARN_ON(tsk->thread.ds_ctx);
884 * is dying. There should not be any user of that context left
885 * to disturb us, anymore. */
886 unsigned long leftovers = context->count;
887 while (leftovers--)
888 ds_put_context(context);
889} 1030}
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
new file mode 100644
index 000000000000..6b1f6f6f8661
--- /dev/null
+++ b/arch/x86/kernel/dumpstack.c
@@ -0,0 +1,351 @@
1/*
2 * Copyright (C) 1991, 1992 Linus Torvalds
3 * Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs
4 */
5#include <linux/kallsyms.h>
6#include <linux/kprobes.h>
7#include <linux/uaccess.h>
8#include <linux/utsname.h>
9#include <linux/hardirq.h>
10#include <linux/kdebug.h>
11#include <linux/module.h>
12#include <linux/ptrace.h>
13#include <linux/kexec.h>
14#include <linux/bug.h>
15#include <linux/nmi.h>
16#include <linux/sysfs.h>
17
18#include <asm/stacktrace.h>
19
20#include "dumpstack.h"
21
22int panic_on_unrecovered_nmi;
23unsigned int code_bytes = 64;
24int kstack_depth_to_print = 3 * STACKSLOTS_PER_LINE;
25static int die_counter;
26
27void printk_address(unsigned long address, int reliable)
28{
29 printk(" [<%p>] %s%pS\n", (void *) address,
30 reliable ? "" : "? ", (void *) address);
31}
32
33#ifdef CONFIG_FUNCTION_GRAPH_TRACER
34static void
35print_ftrace_graph_addr(unsigned long addr, void *data,
36 const struct stacktrace_ops *ops,
37 struct thread_info *tinfo, int *graph)
38{
39 struct task_struct *task = tinfo->task;
40 unsigned long ret_addr;
41 int index = task->curr_ret_stack;
42
43 if (addr != (unsigned long)return_to_handler)
44 return;
45
46 if (!task->ret_stack || index < *graph)
47 return;
48
49 index -= *graph;
50 ret_addr = task->ret_stack[index].ret;
51
52 ops->address(data, ret_addr, 1);
53
54 (*graph)++;
55}
56#else
57static inline void
58print_ftrace_graph_addr(unsigned long addr, void *data,
59 const struct stacktrace_ops *ops,
60 struct thread_info *tinfo, int *graph)
61{ }
62#endif
63
64/*
65 * x86-64 can have up to three kernel stacks:
66 * process stack
67 * interrupt stack
68 * severe exception (double fault, nmi, stack fault, debug, mce) hardware stack
69 */
70
71static inline int valid_stack_ptr(struct thread_info *tinfo,
72 void *p, unsigned int size, void *end)
73{
74 void *t = tinfo;
75 if (end) {
76 if (p < end && p >= (end-THREAD_SIZE))
77 return 1;
78 else
79 return 0;
80 }
81 return p > t && p < t + THREAD_SIZE - size;
82}
83
84unsigned long
85print_context_stack(struct thread_info *tinfo,
86 unsigned long *stack, unsigned long bp,
87 const struct stacktrace_ops *ops, void *data,
88 unsigned long *end, int *graph)
89{
90 struct stack_frame *frame = (struct stack_frame *)bp;
91
92 while (valid_stack_ptr(tinfo, stack, sizeof(*stack), end)) {
93 unsigned long addr;
94
95 addr = *stack;
96 if (__kernel_text_address(addr)) {
97 if ((unsigned long) stack == bp + sizeof(long)) {
98 ops->address(data, addr, 1);
99 frame = frame->next_frame;
100 bp = (unsigned long) frame;
101 } else {
102 ops->address(data, addr, bp == 0);
103 }
104 print_ftrace_graph_addr(addr, data, ops, tinfo, graph);
105 }
106 stack++;
107 }
108 return bp;
109}
110
111
112static void
113print_trace_warning_symbol(void *data, char *msg, unsigned long symbol)
114{
115 printk(data);
116 print_symbol(msg, symbol);
117 printk("\n");
118}
119
120static void print_trace_warning(void *data, char *msg)
121{
122 printk("%s%s\n", (char *)data, msg);
123}
124
125static int print_trace_stack(void *data, char *name)
126{
127 printk("%s <%s> ", (char *)data, name);
128 return 0;
129}
130
131/*
132 * Print one address/symbol entries per line.
133 */
134static void print_trace_address(void *data, unsigned long addr, int reliable)
135{
136 touch_nmi_watchdog();
137 printk(data);
138 printk_address(addr, reliable);
139}
140
141static const struct stacktrace_ops print_trace_ops = {
142 .warning = print_trace_warning,
143 .warning_symbol = print_trace_warning_symbol,
144 .stack = print_trace_stack,
145 .address = print_trace_address,
146};
147
148void
149show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
150 unsigned long *stack, unsigned long bp, char *log_lvl)
151{
152 printk("%sCall Trace:\n", log_lvl);
153 dump_trace(task, regs, stack, bp, &print_trace_ops, log_lvl);
154}
155
156void show_trace(struct task_struct *task, struct pt_regs *regs,
157 unsigned long *stack, unsigned long bp)
158{
159 show_trace_log_lvl(task, regs, stack, bp, "");
160}
161
162void show_stack(struct task_struct *task, unsigned long *sp)
163{
164 show_stack_log_lvl(task, NULL, sp, 0, "");
165}
166
167/*
168 * The architecture-independent dump_stack generator
169 */
170void dump_stack(void)
171{
172 unsigned long bp = 0;
173 unsigned long stack;
174
175#ifdef CONFIG_FRAME_POINTER
176 if (!bp)
177 get_bp(bp);
178#endif
179
180 printk("Pid: %d, comm: %.20s %s %s %.*s\n",
181 current->pid, current->comm, print_tainted(),
182 init_utsname()->release,
183 (int)strcspn(init_utsname()->version, " "),
184 init_utsname()->version);
185 show_trace(NULL, NULL, &stack, bp);
186}
187EXPORT_SYMBOL(dump_stack);
188
189static raw_spinlock_t die_lock = __RAW_SPIN_LOCK_UNLOCKED;
190static int die_owner = -1;
191static unsigned int die_nest_count;
192
193unsigned __kprobes long oops_begin(void)
194{
195 int cpu;
196 unsigned long flags;
197
198 oops_enter();
199
200 /* racy, but better than risking deadlock. */
201 raw_local_irq_save(flags);
202 cpu = smp_processor_id();
203 if (!__raw_spin_trylock(&die_lock)) {
204 if (cpu == die_owner)
205 /* nested oops. should stop eventually */;
206 else
207 __raw_spin_lock(&die_lock);
208 }
209 die_nest_count++;
210 die_owner = cpu;
211 console_verbose();
212 bust_spinlocks(1);
213 return flags;
214}
215
216void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, int signr)
217{
218 if (regs && kexec_should_crash(current))
219 crash_kexec(regs);
220
221 bust_spinlocks(0);
222 die_owner = -1;
223 add_taint(TAINT_DIE);
224 die_nest_count--;
225 if (!die_nest_count)
226 /* Nest count reaches zero, release the lock. */
227 __raw_spin_unlock(&die_lock);
228 raw_local_irq_restore(flags);
229 oops_exit();
230
231 if (!signr)
232 return;
233 if (in_interrupt())
234 panic("Fatal exception in interrupt");
235 if (panic_on_oops)
236 panic("Fatal exception");
237 do_exit(signr);
238}
239
240int __kprobes __die(const char *str, struct pt_regs *regs, long err)
241{
242#ifdef CONFIG_X86_32
243 unsigned short ss;
244 unsigned long sp;
245#endif
246 printk(KERN_EMERG "%s: %04lx [#%d] ", str, err & 0xffff, ++die_counter);
247#ifdef CONFIG_PREEMPT
248 printk("PREEMPT ");
249#endif
250#ifdef CONFIG_SMP
251 printk("SMP ");
252#endif
253#ifdef CONFIG_DEBUG_PAGEALLOC
254 printk("DEBUG_PAGEALLOC");
255#endif
256 printk("\n");
257 sysfs_printk_last_file();
258 if (notify_die(DIE_OOPS, str, regs, err,
259 current->thread.trap_no, SIGSEGV) == NOTIFY_STOP)
260 return 1;
261
262 show_registers(regs);
263#ifdef CONFIG_X86_32
264 sp = (unsigned long) (&regs->sp);
265 savesegment(ss, ss);
266 if (user_mode(regs)) {
267 sp = regs->sp;
268 ss = regs->ss & 0xffff;
269 }
270 printk(KERN_EMERG "EIP: [<%08lx>] ", regs->ip);
271 print_symbol("%s", regs->ip);
272 printk(" SS:ESP %04x:%08lx\n", ss, sp);
273#else
274 /* Executive summary in case the oops scrolled away */
275 printk(KERN_ALERT "RIP ");
276 printk_address(regs->ip, 1);
277 printk(" RSP <%016lx>\n", regs->sp);
278#endif
279 return 0;
280}
281
282/*
283 * This is gone through when something in the kernel has done something bad
284 * and is about to be terminated:
285 */
286void die(const char *str, struct pt_regs *regs, long err)
287{
288 unsigned long flags = oops_begin();
289 int sig = SIGSEGV;
290
291 if (!user_mode_vm(regs))
292 report_bug(regs->ip, regs);
293
294 if (__die(str, regs, err))
295 sig = 0;
296 oops_end(flags, regs, sig);
297}
298
299void notrace __kprobes
300die_nmi(char *str, struct pt_regs *regs, int do_panic)
301{
302 unsigned long flags;
303
304 if (notify_die(DIE_NMIWATCHDOG, str, regs, 0, 2, SIGINT) == NOTIFY_STOP)
305 return;
306
307 /*
308 * We are in trouble anyway, lets at least try
309 * to get a message out.
310 */
311 flags = oops_begin();
312 printk(KERN_EMERG "%s", str);
313 printk(" on CPU%d, ip %08lx, registers:\n",
314 smp_processor_id(), regs->ip);
315 show_registers(regs);
316 oops_end(flags, regs, 0);
317 if (do_panic || panic_on_oops)
318 panic("Non maskable interrupt");
319 nmi_exit();
320 local_irq_enable();
321 do_exit(SIGBUS);
322}
323
324static int __init oops_setup(char *s)
325{
326 if (!s)
327 return -EINVAL;
328 if (!strcmp(s, "panic"))
329 panic_on_oops = 1;
330 return 0;
331}
332early_param("oops", oops_setup);
333
334static int __init kstack_setup(char *s)
335{
336 if (!s)
337 return -EINVAL;
338 kstack_depth_to_print = simple_strtoul(s, NULL, 0);
339 return 0;
340}
341early_param("kstack", kstack_setup);
342
343static int __init code_bytes_setup(char *s)
344{
345 code_bytes = simple_strtoul(s, NULL, 0);
346 if (code_bytes > 8192)
347 code_bytes = 8192;
348
349 return 1;
350}
351__setup("code_bytes=", code_bytes_setup);
diff --git a/arch/x86/kernel/dumpstack.h b/arch/x86/kernel/dumpstack.h
new file mode 100644
index 000000000000..da87590b8698
--- /dev/null
+++ b/arch/x86/kernel/dumpstack.h
@@ -0,0 +1,39 @@
1/*
2 * Copyright (C) 1991, 1992 Linus Torvalds
3 * Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs
4 */
5
6#ifndef DUMPSTACK_H
7#define DUMPSTACK_H
8
9#ifdef CONFIG_X86_32
10#define STACKSLOTS_PER_LINE 8
11#define get_bp(bp) asm("movl %%ebp, %0" : "=r" (bp) :)
12#else
13#define STACKSLOTS_PER_LINE 4
14#define get_bp(bp) asm("movq %%rbp, %0" : "=r" (bp) :)
15#endif
16
17extern unsigned long
18print_context_stack(struct thread_info *tinfo,
19 unsigned long *stack, unsigned long bp,
20 const struct stacktrace_ops *ops, void *data,
21 unsigned long *end, int *graph);
22
23extern void
24show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
25 unsigned long *stack, unsigned long bp, char *log_lvl);
26
27extern void
28show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
29 unsigned long *sp, unsigned long bp, char *log_lvl);
30
31extern unsigned int code_bytes;
32extern int kstack_depth_to_print;
33
34/* The form of the top of the frame on the stack */
35struct stack_frame {
36 struct stack_frame *next_frame;
37 unsigned long return_address;
38};
39#endif
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
index b3614752197b..d593cd1f58dc 100644
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -17,69 +17,14 @@
17 17
18#include <asm/stacktrace.h> 18#include <asm/stacktrace.h>
19 19
20#define STACKSLOTS_PER_LINE 8 20#include "dumpstack.h"
21#define get_bp(bp) asm("movl %%ebp, %0" : "=r" (bp) :)
22
23int panic_on_unrecovered_nmi;
24int kstack_depth_to_print = 3 * STACKSLOTS_PER_LINE;
25static unsigned int code_bytes = 64;
26static int die_counter;
27
28void printk_address(unsigned long address, int reliable)
29{
30 printk(" [<%p>] %s%pS\n", (void *) address,
31 reliable ? "" : "? ", (void *) address);
32}
33
34static inline int valid_stack_ptr(struct thread_info *tinfo,
35 void *p, unsigned int size, void *end)
36{
37 void *t = tinfo;
38 if (end) {
39 if (p < end && p >= (end-THREAD_SIZE))
40 return 1;
41 else
42 return 0;
43 }
44 return p > t && p < t + THREAD_SIZE - size;
45}
46
47/* The form of the top of the frame on the stack */
48struct stack_frame {
49 struct stack_frame *next_frame;
50 unsigned long return_address;
51};
52
53static inline unsigned long
54print_context_stack(struct thread_info *tinfo,
55 unsigned long *stack, unsigned long bp,
56 const struct stacktrace_ops *ops, void *data,
57 unsigned long *end)
58{
59 struct stack_frame *frame = (struct stack_frame *)bp;
60
61 while (valid_stack_ptr(tinfo, stack, sizeof(*stack), end)) {
62 unsigned long addr;
63
64 addr = *stack;
65 if (__kernel_text_address(addr)) {
66 if ((unsigned long) stack == bp + sizeof(long)) {
67 ops->address(data, addr, 1);
68 frame = frame->next_frame;
69 bp = (unsigned long) frame;
70 } else {
71 ops->address(data, addr, bp == 0);
72 }
73 }
74 stack++;
75 }
76 return bp;
77}
78 21
79void dump_trace(struct task_struct *task, struct pt_regs *regs, 22void dump_trace(struct task_struct *task, struct pt_regs *regs,
80 unsigned long *stack, unsigned long bp, 23 unsigned long *stack, unsigned long bp,
81 const struct stacktrace_ops *ops, void *data) 24 const struct stacktrace_ops *ops, void *data)
82{ 25{
26 int graph = 0;
27
83 if (!task) 28 if (!task)
84 task = current; 29 task = current;
85 30
@@ -107,7 +52,8 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
107 52
108 context = (struct thread_info *) 53 context = (struct thread_info *)
109 ((unsigned long)stack & (~(THREAD_SIZE - 1))); 54 ((unsigned long)stack & (~(THREAD_SIZE - 1)));
110 bp = print_context_stack(context, stack, bp, ops, data, NULL); 55 bp = print_context_stack(context, stack, bp, ops,
56 data, NULL, &graph);
111 57
112 stack = (unsigned long *)context->previous_esp; 58 stack = (unsigned long *)context->previous_esp;
113 if (!stack) 59 if (!stack)
@@ -119,57 +65,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
119} 65}
120EXPORT_SYMBOL(dump_trace); 66EXPORT_SYMBOL(dump_trace);
121 67
122static void 68void
123print_trace_warning_symbol(void *data, char *msg, unsigned long symbol)
124{
125 printk(data);
126 print_symbol(msg, symbol);
127 printk("\n");
128}
129
130static void print_trace_warning(void *data, char *msg)
131{
132 printk("%s%s\n", (char *)data, msg);
133}
134
135static int print_trace_stack(void *data, char *name)
136{
137 printk("%s <%s> ", (char *)data, name);
138 return 0;
139}
140
141/*
142 * Print one address/symbol entries per line.
143 */
144static void print_trace_address(void *data, unsigned long addr, int reliable)
145{
146 touch_nmi_watchdog();
147 printk(data);
148 printk_address(addr, reliable);
149}
150
151static const struct stacktrace_ops print_trace_ops = {
152 .warning = print_trace_warning,
153 .warning_symbol = print_trace_warning_symbol,
154 .stack = print_trace_stack,
155 .address = print_trace_address,
156};
157
158static void
159show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
160 unsigned long *stack, unsigned long bp, char *log_lvl)
161{
162 printk("%sCall Trace:\n", log_lvl);
163 dump_trace(task, regs, stack, bp, &print_trace_ops, log_lvl);
164}
165
166void show_trace(struct task_struct *task, struct pt_regs *regs,
167 unsigned long *stack, unsigned long bp)
168{
169 show_trace_log_lvl(task, regs, stack, bp, "");
170}
171
172static void
173show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs, 69show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
174 unsigned long *sp, unsigned long bp, char *log_lvl) 70 unsigned long *sp, unsigned long bp, char *log_lvl)
175{ 71{
@@ -196,33 +92,6 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
196 show_trace_log_lvl(task, regs, sp, bp, log_lvl); 92 show_trace_log_lvl(task, regs, sp, bp, log_lvl);
197} 93}
198 94
199void show_stack(struct task_struct *task, unsigned long *sp)
200{
201 show_stack_log_lvl(task, NULL, sp, 0, "");
202}
203
204/*
205 * The architecture-independent dump_stack generator
206 */
207void dump_stack(void)
208{
209 unsigned long bp = 0;
210 unsigned long stack;
211
212#ifdef CONFIG_FRAME_POINTER
213 if (!bp)
214 get_bp(bp);
215#endif
216
217 printk("Pid: %d, comm: %.20s %s %s %.*s\n",
218 current->pid, current->comm, print_tainted(),
219 init_utsname()->release,
220 (int)strcspn(init_utsname()->version, " "),
221 init_utsname()->version);
222 show_trace(NULL, NULL, &stack, bp);
223}
224
225EXPORT_SYMBOL(dump_stack);
226 95
227void show_registers(struct pt_regs *regs) 96void show_registers(struct pt_regs *regs)
228{ 97{
@@ -283,167 +152,3 @@ int is_valid_bugaddr(unsigned long ip)
283 return ud2 == 0x0b0f; 152 return ud2 == 0x0b0f;
284} 153}
285 154
286static raw_spinlock_t die_lock = __RAW_SPIN_LOCK_UNLOCKED;
287static int die_owner = -1;
288static unsigned int die_nest_count;
289
290unsigned __kprobes long oops_begin(void)
291{
292 unsigned long flags;
293
294 oops_enter();
295
296 if (die_owner != raw_smp_processor_id()) {
297 console_verbose();
298 raw_local_irq_save(flags);
299 __raw_spin_lock(&die_lock);
300 die_owner = smp_processor_id();
301 die_nest_count = 0;
302 bust_spinlocks(1);
303 } else {
304 raw_local_irq_save(flags);
305 }
306 die_nest_count++;
307 return flags;
308}
309
310void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, int signr)
311{
312 bust_spinlocks(0);
313 die_owner = -1;
314 add_taint(TAINT_DIE);
315 __raw_spin_unlock(&die_lock);
316 raw_local_irq_restore(flags);
317
318 if (!regs)
319 return;
320
321 if (kexec_should_crash(current))
322 crash_kexec(regs);
323 if (in_interrupt())
324 panic("Fatal exception in interrupt");
325 if (panic_on_oops)
326 panic("Fatal exception");
327 oops_exit();
328 do_exit(signr);
329}
330
331int __kprobes __die(const char *str, struct pt_regs *regs, long err)
332{
333 unsigned short ss;
334 unsigned long sp;
335
336 printk(KERN_EMERG "%s: %04lx [#%d] ", str, err & 0xffff, ++die_counter);
337#ifdef CONFIG_PREEMPT
338 printk("PREEMPT ");
339#endif
340#ifdef CONFIG_SMP
341 printk("SMP ");
342#endif
343#ifdef CONFIG_DEBUG_PAGEALLOC
344 printk("DEBUG_PAGEALLOC");
345#endif
346 printk("\n");
347 sysfs_printk_last_file();
348 if (notify_die(DIE_OOPS, str, regs, err,
349 current->thread.trap_no, SIGSEGV) == NOTIFY_STOP)
350 return 1;
351
352 show_registers(regs);
353 /* Executive summary in case the oops scrolled away */
354 sp = (unsigned long) (&regs->sp);
355 savesegment(ss, ss);
356 if (user_mode(regs)) {
357 sp = regs->sp;
358 ss = regs->ss & 0xffff;
359 }
360 printk(KERN_EMERG "EIP: [<%08lx>] ", regs->ip);
361 print_symbol("%s", regs->ip);
362 printk(" SS:ESP %04x:%08lx\n", ss, sp);
363 return 0;
364}
365
366/*
367 * This is gone through when something in the kernel has done something bad
368 * and is about to be terminated:
369 */
370void die(const char *str, struct pt_regs *regs, long err)
371{
372 unsigned long flags = oops_begin();
373
374 if (die_nest_count < 3) {
375 report_bug(regs->ip, regs);
376
377 if (__die(str, regs, err))
378 regs = NULL;
379 } else {
380 printk(KERN_EMERG "Recursive die() failure, output suppressed\n");
381 }
382
383 oops_end(flags, regs, SIGSEGV);
384}
385
386static DEFINE_SPINLOCK(nmi_print_lock);
387
388void notrace __kprobes
389die_nmi(char *str, struct pt_regs *regs, int do_panic)
390{
391 if (notify_die(DIE_NMIWATCHDOG, str, regs, 0, 2, SIGINT) == NOTIFY_STOP)
392 return;
393
394 spin_lock(&nmi_print_lock);
395 /*
396 * We are in trouble anyway, lets at least try
397 * to get a message out:
398 */
399 bust_spinlocks(1);
400 printk(KERN_EMERG "%s", str);
401 printk(" on CPU%d, ip %08lx, registers:\n",
402 smp_processor_id(), regs->ip);
403 show_registers(regs);
404 if (do_panic)
405 panic("Non maskable interrupt");
406 console_silent();
407 spin_unlock(&nmi_print_lock);
408
409 /*
410 * If we are in kernel we are probably nested up pretty bad
411 * and might aswell get out now while we still can:
412 */
413 if (!user_mode_vm(regs)) {
414 current->thread.trap_no = 2;
415 crash_kexec(regs);
416 }
417
418 bust_spinlocks(0);
419 do_exit(SIGSEGV);
420}
421
422static int __init oops_setup(char *s)
423{
424 if (!s)
425 return -EINVAL;
426 if (!strcmp(s, "panic"))
427 panic_on_oops = 1;
428 return 0;
429}
430early_param("oops", oops_setup);
431
432static int __init kstack_setup(char *s)
433{
434 if (!s)
435 return -EINVAL;
436 kstack_depth_to_print = simple_strtoul(s, NULL, 0);
437 return 0;
438}
439early_param("kstack", kstack_setup);
440
441static int __init code_bytes_setup(char *s)
442{
443 code_bytes = simple_strtoul(s, NULL, 0);
444 if (code_bytes > 8192)
445 code_bytes = 8192;
446
447 return 1;
448}
449__setup("code_bytes=", code_bytes_setup);
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index 96a5db7da8a7..c302d0707048 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -17,19 +17,7 @@
17 17
18#include <asm/stacktrace.h> 18#include <asm/stacktrace.h>
19 19
20#define STACKSLOTS_PER_LINE 4 20#include "dumpstack.h"
21#define get_bp(bp) asm("movq %%rbp, %0" : "=r" (bp) :)
22
23int panic_on_unrecovered_nmi;
24int kstack_depth_to_print = 3 * STACKSLOTS_PER_LINE;
25static unsigned int code_bytes = 64;
26static int die_counter;
27
28void printk_address(unsigned long address, int reliable)
29{
30 printk(" [<%p>] %s%pS\n", (void *) address,
31 reliable ? "" : "? ", (void *) address);
32}
33 21
34static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, 22static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
35 unsigned *usedp, char **idp) 23 unsigned *usedp, char **idp)
@@ -113,51 +101,6 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
113 * severe exception (double fault, nmi, stack fault, debug, mce) hardware stack 101 * severe exception (double fault, nmi, stack fault, debug, mce) hardware stack
114 */ 102 */
115 103
116static inline int valid_stack_ptr(struct thread_info *tinfo,
117 void *p, unsigned int size, void *end)
118{
119 void *t = tinfo;
120 if (end) {
121 if (p < end && p >= (end-THREAD_SIZE))
122 return 1;
123 else
124 return 0;
125 }
126 return p > t && p < t + THREAD_SIZE - size;
127}
128
129/* The form of the top of the frame on the stack */
130struct stack_frame {
131 struct stack_frame *next_frame;
132 unsigned long return_address;
133};
134
135static inline unsigned long
136print_context_stack(struct thread_info *tinfo,
137 unsigned long *stack, unsigned long bp,
138 const struct stacktrace_ops *ops, void *data,
139 unsigned long *end)
140{
141 struct stack_frame *frame = (struct stack_frame *)bp;
142
143 while (valid_stack_ptr(tinfo, stack, sizeof(*stack), end)) {
144 unsigned long addr;
145
146 addr = *stack;
147 if (__kernel_text_address(addr)) {
148 if ((unsigned long) stack == bp + sizeof(long)) {
149 ops->address(data, addr, 1);
150 frame = frame->next_frame;
151 bp = (unsigned long) frame;
152 } else {
153 ops->address(data, addr, bp == 0);
154 }
155 }
156 stack++;
157 }
158 return bp;
159}
160
161void dump_trace(struct task_struct *task, struct pt_regs *regs, 104void dump_trace(struct task_struct *task, struct pt_regs *regs,
162 unsigned long *stack, unsigned long bp, 105 unsigned long *stack, unsigned long bp,
163 const struct stacktrace_ops *ops, void *data) 106 const struct stacktrace_ops *ops, void *data)
@@ -166,6 +109,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
166 unsigned long *irqstack_end = (unsigned long *)cpu_pda(cpu)->irqstackptr; 109 unsigned long *irqstack_end = (unsigned long *)cpu_pda(cpu)->irqstackptr;
167 unsigned used = 0; 110 unsigned used = 0;
168 struct thread_info *tinfo; 111 struct thread_info *tinfo;
112 int graph = 0;
169 113
170 if (!task) 114 if (!task)
171 task = current; 115 task = current;
@@ -206,7 +150,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
206 break; 150 break;
207 151
208 bp = print_context_stack(tinfo, stack, bp, ops, 152 bp = print_context_stack(tinfo, stack, bp, ops,
209 data, estack_end); 153 data, estack_end, &graph);
210 ops->stack(data, "<EOE>"); 154 ops->stack(data, "<EOE>");
211 /* 155 /*
212 * We link to the next stack via the 156 * We link to the next stack via the
@@ -225,7 +169,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
225 if (ops->stack(data, "IRQ") < 0) 169 if (ops->stack(data, "IRQ") < 0)
226 break; 170 break;
227 bp = print_context_stack(tinfo, stack, bp, 171 bp = print_context_stack(tinfo, stack, bp,
228 ops, data, irqstack_end); 172 ops, data, irqstack_end, &graph);
229 /* 173 /*
230 * We link to the next stack (which would be 174 * We link to the next stack (which would be
231 * the process stack normally) the last 175 * the process stack normally) the last
@@ -243,62 +187,12 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
243 /* 187 /*
244 * This handles the process stack: 188 * This handles the process stack:
245 */ 189 */
246 bp = print_context_stack(tinfo, stack, bp, ops, data, NULL); 190 bp = print_context_stack(tinfo, stack, bp, ops, data, NULL, &graph);
247 put_cpu(); 191 put_cpu();
248} 192}
249EXPORT_SYMBOL(dump_trace); 193EXPORT_SYMBOL(dump_trace);
250 194
251static void 195void
252print_trace_warning_symbol(void *data, char *msg, unsigned long symbol)
253{
254 printk(data);
255 print_symbol(msg, symbol);
256 printk("\n");
257}
258
259static void print_trace_warning(void *data, char *msg)
260{
261 printk("%s%s\n", (char *)data, msg);
262}
263
264static int print_trace_stack(void *data, char *name)
265{
266 printk("%s <%s> ", (char *)data, name);
267 return 0;
268}
269
270/*
271 * Print one address/symbol entries per line.
272 */
273static void print_trace_address(void *data, unsigned long addr, int reliable)
274{
275 touch_nmi_watchdog();
276 printk(data);
277 printk_address(addr, reliable);
278}
279
280static const struct stacktrace_ops print_trace_ops = {
281 .warning = print_trace_warning,
282 .warning_symbol = print_trace_warning_symbol,
283 .stack = print_trace_stack,
284 .address = print_trace_address,
285};
286
287static void
288show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
289 unsigned long *stack, unsigned long bp, char *log_lvl)
290{
291 printk("%sCall Trace:\n", log_lvl);
292 dump_trace(task, regs, stack, bp, &print_trace_ops, log_lvl);
293}
294
295void show_trace(struct task_struct *task, struct pt_regs *regs,
296 unsigned long *stack, unsigned long bp)
297{
298 show_trace_log_lvl(task, regs, stack, bp, "");
299}
300
301static void
302show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs, 196show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
303 unsigned long *sp, unsigned long bp, char *log_lvl) 197 unsigned long *sp, unsigned long bp, char *log_lvl)
304{ 198{
@@ -342,33 +236,6 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
342 show_trace_log_lvl(task, regs, sp, bp, log_lvl); 236 show_trace_log_lvl(task, regs, sp, bp, log_lvl);
343} 237}
344 238
345void show_stack(struct task_struct *task, unsigned long *sp)
346{
347 show_stack_log_lvl(task, NULL, sp, 0, "");
348}
349
350/*
351 * The architecture-independent dump_stack generator
352 */
353void dump_stack(void)
354{
355 unsigned long bp = 0;
356 unsigned long stack;
357
358#ifdef CONFIG_FRAME_POINTER
359 if (!bp)
360 get_bp(bp);
361#endif
362
363 printk("Pid: %d, comm: %.20s %s %s %.*s\n",
364 current->pid, current->comm, print_tainted(),
365 init_utsname()->release,
366 (int)strcspn(init_utsname()->version, " "),
367 init_utsname()->version);
368 show_trace(NULL, NULL, &stack, bp);
369}
370EXPORT_SYMBOL(dump_stack);
371
372void show_registers(struct pt_regs *regs) 239void show_registers(struct pt_regs *regs)
373{ 240{
374 int i; 241 int i;
@@ -429,147 +296,3 @@ int is_valid_bugaddr(unsigned long ip)
429 return ud2 == 0x0b0f; 296 return ud2 == 0x0b0f;
430} 297}
431 298
432static raw_spinlock_t die_lock = __RAW_SPIN_LOCK_UNLOCKED;
433static int die_owner = -1;
434static unsigned int die_nest_count;
435
436unsigned __kprobes long oops_begin(void)
437{
438 int cpu;
439 unsigned long flags;
440
441 oops_enter();
442
443 /* racy, but better than risking deadlock. */
444 raw_local_irq_save(flags);
445 cpu = smp_processor_id();
446 if (!__raw_spin_trylock(&die_lock)) {
447 if (cpu == die_owner)
448 /* nested oops. should stop eventually */;
449 else
450 __raw_spin_lock(&die_lock);
451 }
452 die_nest_count++;
453 die_owner = cpu;
454 console_verbose();
455 bust_spinlocks(1);
456 return flags;
457}
458
459void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, int signr)
460{
461 die_owner = -1;
462 bust_spinlocks(0);
463 die_nest_count--;
464 if (!die_nest_count)
465 /* Nest count reaches zero, release the lock. */
466 __raw_spin_unlock(&die_lock);
467 raw_local_irq_restore(flags);
468 if (!regs) {
469 oops_exit();
470 return;
471 }
472 if (in_interrupt())
473 panic("Fatal exception in interrupt");
474 if (panic_on_oops)
475 panic("Fatal exception");
476 oops_exit();
477 do_exit(signr);
478}
479
480int __kprobes __die(const char *str, struct pt_regs *regs, long err)
481{
482 printk(KERN_EMERG "%s: %04lx [#%d] ", str, err & 0xffff, ++die_counter);
483#ifdef CONFIG_PREEMPT
484 printk("PREEMPT ");
485#endif
486#ifdef CONFIG_SMP
487 printk("SMP ");
488#endif
489#ifdef CONFIG_DEBUG_PAGEALLOC
490 printk("DEBUG_PAGEALLOC");
491#endif
492 printk("\n");
493 sysfs_printk_last_file();
494 if (notify_die(DIE_OOPS, str, regs, err,
495 current->thread.trap_no, SIGSEGV) == NOTIFY_STOP)
496 return 1;
497
498 show_registers(regs);
499 add_taint(TAINT_DIE);
500 /* Executive summary in case the oops scrolled away */
501 printk(KERN_ALERT "RIP ");
502 printk_address(regs->ip, 1);
503 printk(" RSP <%016lx>\n", regs->sp);
504 if (kexec_should_crash(current))
505 crash_kexec(regs);
506 return 0;
507}
508
509void die(const char *str, struct pt_regs *regs, long err)
510{
511 unsigned long flags = oops_begin();
512
513 if (!user_mode(regs))
514 report_bug(regs->ip, regs);
515
516 if (__die(str, regs, err))
517 regs = NULL;
518 oops_end(flags, regs, SIGSEGV);
519}
520
521notrace __kprobes void
522die_nmi(char *str, struct pt_regs *regs, int do_panic)
523{
524 unsigned long flags;
525
526 if (notify_die(DIE_NMIWATCHDOG, str, regs, 0, 2, SIGINT) == NOTIFY_STOP)
527 return;
528
529 flags = oops_begin();
530 /*
531 * We are in trouble anyway, lets at least try
532 * to get a message out.
533 */
534 printk(KERN_EMERG "%s", str);
535 printk(" on CPU%d, ip %08lx, registers:\n",
536 smp_processor_id(), regs->ip);
537 show_registers(regs);
538 if (kexec_should_crash(current))
539 crash_kexec(regs);
540 if (do_panic || panic_on_oops)
541 panic("Non maskable interrupt");
542 oops_end(flags, NULL, SIGBUS);
543 nmi_exit();
544 local_irq_enable();
545 do_exit(SIGBUS);
546}
547
548static int __init oops_setup(char *s)
549{
550 if (!s)
551 return -EINVAL;
552 if (!strcmp(s, "panic"))
553 panic_on_oops = 1;
554 return 0;
555}
556early_param("oops", oops_setup);
557
558static int __init kstack_setup(char *s)
559{
560 if (!s)
561 return -EINVAL;
562 kstack_depth_to_print = simple_strtoul(s, NULL, 0);
563 return 0;
564}
565early_param("kstack", kstack_setup);
566
567static int __init code_bytes_setup(char *s)
568{
569 code_bytes = simple_strtoul(s, NULL, 0);
570 if (code_bytes > 8192)
571 code_bytes = 8192;
572
573 return 1;
574}
575__setup("code_bytes=", code_bytes_setup);
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 7aafeb5263ef..65a13943e098 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -677,22 +677,6 @@ struct early_res {
677}; 677};
678static struct early_res early_res[MAX_EARLY_RES] __initdata = { 678static struct early_res early_res[MAX_EARLY_RES] __initdata = {
679 { 0, PAGE_SIZE, "BIOS data page" }, /* BIOS data page */ 679 { 0, PAGE_SIZE, "BIOS data page" }, /* BIOS data page */
680#if defined(CONFIG_X86_64) && defined(CONFIG_X86_TRAMPOLINE)
681 { TRAMPOLINE_BASE, TRAMPOLINE_BASE + 2 * PAGE_SIZE, "TRAMPOLINE" },
682#endif
683#if defined(CONFIG_X86_32) && defined(CONFIG_SMP)
684 /*
685 * But first pinch a few for the stack/trampoline stuff
686 * FIXME: Don't need the extra page at 4K, but need to fix
687 * trampoline before removing it. (see the GDT stuff)
688 */
689 { PAGE_SIZE, PAGE_SIZE + PAGE_SIZE, "EX TRAMPOLINE" },
690 /*
691 * Has to be in very low memory so we can execute
692 * real-mode AP code.
693 */
694 { TRAMPOLINE_BASE, TRAMPOLINE_BASE + PAGE_SIZE, "TRAMPOLINE" },
695#endif
696 {} 680 {}
697}; 681};
698 682
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index 1b894b72c0f5..744aa7fc49d5 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -17,6 +17,7 @@
17#include <asm/io_apic.h> 17#include <asm/io_apic.h>
18#include <asm/apic.h> 18#include <asm/apic.h>
19#include <asm/iommu.h> 19#include <asm/iommu.h>
20#include <asm/gart.h>
20 21
21static void __init fix_hypertransport_config(int num, int slot, int func) 22static void __init fix_hypertransport_config(int num, int slot, int func)
22{ 23{
diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index 34ad997d3834..504ad198e4ad 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -875,49 +875,6 @@ static struct console early_dbgp_console = {
875}; 875};
876#endif 876#endif
877 877
878/* Console interface to a host file on AMD's SimNow! */
879
880static int simnow_fd;
881
882enum {
883 MAGIC1 = 0xBACCD00A,
884 MAGIC2 = 0xCA110000,
885 XOPEN = 5,
886 XWRITE = 4,
887};
888
889static noinline long simnow(long cmd, long a, long b, long c)
890{
891 long ret;
892
893 asm volatile("cpuid" :
894 "=a" (ret) :
895 "b" (a), "c" (b), "d" (c), "0" (MAGIC1), "D" (cmd + MAGIC2));
896 return ret;
897}
898
899static void __init simnow_init(char *str)
900{
901 char *fn = "klog";
902
903 if (*str == '=')
904 fn = ++str;
905 /* error ignored */
906 simnow_fd = simnow(XOPEN, (unsigned long)fn, O_WRONLY|O_APPEND|O_CREAT, 0644);
907}
908
909static void simnow_write(struct console *con, const char *s, unsigned n)
910{
911 simnow(XWRITE, simnow_fd, (unsigned long)s, n);
912}
913
914static struct console simnow_console = {
915 .name = "simnow",
916 .write = simnow_write,
917 .flags = CON_PRINTBUFFER,
918 .index = -1,
919};
920
921/* Direct interface for emergencies */ 878/* Direct interface for emergencies */
922static struct console *early_console = &early_vga_console; 879static struct console *early_console = &early_vga_console;
923static int __initdata early_console_initialized; 880static int __initdata early_console_initialized;
@@ -929,7 +886,7 @@ asmlinkage void early_printk(const char *fmt, ...)
929 va_list ap; 886 va_list ap;
930 887
931 va_start(ap, fmt); 888 va_start(ap, fmt);
932 n = vscnprintf(buf, 512, fmt, ap); 889 n = vscnprintf(buf, sizeof(buf), fmt, ap);
933 early_console->write(early_console, buf, n); 890 early_console->write(early_console, buf, n);
934 va_end(ap); 891 va_end(ap);
935} 892}
@@ -960,10 +917,6 @@ static int __init setup_early_printk(char *buf)
960 max_ypos = boot_params.screen_info.orig_video_lines; 917 max_ypos = boot_params.screen_info.orig_video_lines;
961 current_ypos = boot_params.screen_info.orig_y; 918 current_ypos = boot_params.screen_info.orig_y;
962 early_console = &early_vga_console; 919 early_console = &early_vga_console;
963 } else if (!strncmp(buf, "simnow", 6)) {
964 simnow_init(buf + 6);
965 early_console = &simnow_console;
966 keep_early = 1;
967#ifdef CONFIG_EARLY_PRINTK_DBGP 920#ifdef CONFIG_EARLY_PRINTK_DBGP
968 } else if (!strncmp(buf, "dbgp", 4)) { 921 } else if (!strncmp(buf, "dbgp", 4)) {
969 if (early_dbgp_init(buf+4) < 0) 922 if (early_dbgp_init(buf+4) < 0)
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 28b597ef9ca1..d6f0490a7391 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -619,28 +619,37 @@ END(syscall_badsys)
61927:; 61927:;
620 620
621/* 621/*
622 * Build the entry stubs and pointer table with 622 * Build the entry stubs and pointer table with some assembler magic.
623 * some assembler magic. 623 * We pack 7 stubs into a single 32-byte chunk, which will fit in a
624 * single cache line on all modern x86 implementations.
624 */ 625 */
625.section .rodata,"a" 626.section .init.rodata,"a"
626ENTRY(interrupt) 627ENTRY(interrupt)
627.text 628.text
628 629 .p2align 5
630 .p2align CONFIG_X86_L1_CACHE_SHIFT
629ENTRY(irq_entries_start) 631ENTRY(irq_entries_start)
630 RING0_INT_FRAME 632 RING0_INT_FRAME
631vector=0 633vector=FIRST_EXTERNAL_VECTOR
632.rept NR_VECTORS 634.rept (NR_VECTORS-FIRST_EXTERNAL_VECTOR+6)/7
633 ALIGN 635 .balign 32
634 .if vector 636 .rept 7
637 .if vector < NR_VECTORS
638 .if vector <> FIRST_EXTERNAL_VECTOR
635 CFI_ADJUST_CFA_OFFSET -4 639 CFI_ADJUST_CFA_OFFSET -4
636 .endif 640 .endif
6371: pushl $~(vector) 6411: pushl $(~vector+0x80) /* Note: always in signed byte range */
638 CFI_ADJUST_CFA_OFFSET 4 642 CFI_ADJUST_CFA_OFFSET 4
639 jmp common_interrupt 643 .if ((vector-FIRST_EXTERNAL_VECTOR)%7) <> 6
640 .previous 644 jmp 2f
645 .endif
646 .previous
641 .long 1b 647 .long 1b
642 .text 648 .text
643vector=vector+1 649vector=vector+1
650 .endif
651 .endr
6522: jmp common_interrupt
644.endr 653.endr
645END(irq_entries_start) 654END(irq_entries_start)
646 655
@@ -652,8 +661,9 @@ END(interrupt)
652 * the CPU automatically disables interrupts when executing an IRQ vector, 661 * the CPU automatically disables interrupts when executing an IRQ vector,
653 * so IRQ-flags tracing has to follow that: 662 * so IRQ-flags tracing has to follow that:
654 */ 663 */
655 ALIGN 664 .p2align CONFIG_X86_L1_CACHE_SHIFT
656common_interrupt: 665common_interrupt:
666 addl $-0x80,(%esp) /* Adjust vector into the [-256,-1] range */
657 SAVE_ALL 667 SAVE_ALL
658 TRACE_IRQS_OFF 668 TRACE_IRQS_OFF
659 movl %esp,%eax 669 movl %esp,%eax
@@ -678,65 +688,6 @@ ENDPROC(name)
678/* The include is where all of the SMP etc. interrupts come from */ 688/* The include is where all of the SMP etc. interrupts come from */
679#include "entry_arch.h" 689#include "entry_arch.h"
680 690
681KPROBE_ENTRY(page_fault)
682 RING0_EC_FRAME
683 pushl $do_page_fault
684 CFI_ADJUST_CFA_OFFSET 4
685 ALIGN
686error_code:
687 /* the function address is in %fs's slot on the stack */
688 pushl %es
689 CFI_ADJUST_CFA_OFFSET 4
690 /*CFI_REL_OFFSET es, 0*/
691 pushl %ds
692 CFI_ADJUST_CFA_OFFSET 4
693 /*CFI_REL_OFFSET ds, 0*/
694 pushl %eax
695 CFI_ADJUST_CFA_OFFSET 4
696 CFI_REL_OFFSET eax, 0
697 pushl %ebp
698 CFI_ADJUST_CFA_OFFSET 4
699 CFI_REL_OFFSET ebp, 0
700 pushl %edi
701 CFI_ADJUST_CFA_OFFSET 4
702 CFI_REL_OFFSET edi, 0
703 pushl %esi
704 CFI_ADJUST_CFA_OFFSET 4
705 CFI_REL_OFFSET esi, 0
706 pushl %edx
707 CFI_ADJUST_CFA_OFFSET 4
708 CFI_REL_OFFSET edx, 0
709 pushl %ecx
710 CFI_ADJUST_CFA_OFFSET 4
711 CFI_REL_OFFSET ecx, 0
712 pushl %ebx
713 CFI_ADJUST_CFA_OFFSET 4
714 CFI_REL_OFFSET ebx, 0
715 cld
716 pushl %fs
717 CFI_ADJUST_CFA_OFFSET 4
718 /*CFI_REL_OFFSET fs, 0*/
719 movl $(__KERNEL_PERCPU), %ecx
720 movl %ecx, %fs
721 UNWIND_ESPFIX_STACK
722 popl %ecx
723 CFI_ADJUST_CFA_OFFSET -4
724 /*CFI_REGISTER es, ecx*/
725 movl PT_FS(%esp), %edi # get the function address
726 movl PT_ORIG_EAX(%esp), %edx # get the error code
727 movl $-1, PT_ORIG_EAX(%esp) # no syscall to restart
728 mov %ecx, PT_FS(%esp)
729 /*CFI_REL_OFFSET fs, ES*/
730 movl $(__USER_DS), %ecx
731 movl %ecx, %ds
732 movl %ecx, %es
733 TRACE_IRQS_OFF
734 movl %esp,%eax # pt_regs pointer
735 call *%edi
736 jmp ret_from_exception
737 CFI_ENDPROC
738KPROBE_END(page_fault)
739
740ENTRY(coprocessor_error) 691ENTRY(coprocessor_error)
741 RING0_INT_FRAME 692 RING0_INT_FRAME
742 pushl $0 693 pushl $0
@@ -767,140 +718,6 @@ ENTRY(device_not_available)
767 CFI_ENDPROC 718 CFI_ENDPROC
768END(device_not_available) 719END(device_not_available)
769 720
770/*
771 * Debug traps and NMI can happen at the one SYSENTER instruction
772 * that sets up the real kernel stack. Check here, since we can't
773 * allow the wrong stack to be used.
774 *
775 * "TSS_sysenter_sp0+12" is because the NMI/debug handler will have
776 * already pushed 3 words if it hits on the sysenter instruction:
777 * eflags, cs and eip.
778 *
779 * We just load the right stack, and push the three (known) values
780 * by hand onto the new stack - while updating the return eip past
781 * the instruction that would have done it for sysenter.
782 */
783#define FIX_STACK(offset, ok, label) \
784 cmpw $__KERNEL_CS,4(%esp); \
785 jne ok; \
786label: \
787 movl TSS_sysenter_sp0+offset(%esp),%esp; \
788 CFI_DEF_CFA esp, 0; \
789 CFI_UNDEFINED eip; \
790 pushfl; \
791 CFI_ADJUST_CFA_OFFSET 4; \
792 pushl $__KERNEL_CS; \
793 CFI_ADJUST_CFA_OFFSET 4; \
794 pushl $sysenter_past_esp; \
795 CFI_ADJUST_CFA_OFFSET 4; \
796 CFI_REL_OFFSET eip, 0
797
798KPROBE_ENTRY(debug)
799 RING0_INT_FRAME
800 cmpl $ia32_sysenter_target,(%esp)
801 jne debug_stack_correct
802 FIX_STACK(12, debug_stack_correct, debug_esp_fix_insn)
803debug_stack_correct:
804 pushl $-1 # mark this as an int
805 CFI_ADJUST_CFA_OFFSET 4
806 SAVE_ALL
807 TRACE_IRQS_OFF
808 xorl %edx,%edx # error code 0
809 movl %esp,%eax # pt_regs pointer
810 call do_debug
811 jmp ret_from_exception
812 CFI_ENDPROC
813KPROBE_END(debug)
814
815/*
816 * NMI is doubly nasty. It can happen _while_ we're handling
817 * a debug fault, and the debug fault hasn't yet been able to
818 * clear up the stack. So we first check whether we got an
819 * NMI on the sysenter entry path, but after that we need to
820 * check whether we got an NMI on the debug path where the debug
821 * fault happened on the sysenter path.
822 */
823KPROBE_ENTRY(nmi)
824 RING0_INT_FRAME
825 pushl %eax
826 CFI_ADJUST_CFA_OFFSET 4
827 movl %ss, %eax
828 cmpw $__ESPFIX_SS, %ax
829 popl %eax
830 CFI_ADJUST_CFA_OFFSET -4
831 je nmi_espfix_stack
832 cmpl $ia32_sysenter_target,(%esp)
833 je nmi_stack_fixup
834 pushl %eax
835 CFI_ADJUST_CFA_OFFSET 4
836 movl %esp,%eax
837 /* Do not access memory above the end of our stack page,
838 * it might not exist.
839 */
840 andl $(THREAD_SIZE-1),%eax
841 cmpl $(THREAD_SIZE-20),%eax
842 popl %eax
843 CFI_ADJUST_CFA_OFFSET -4
844 jae nmi_stack_correct
845 cmpl $ia32_sysenter_target,12(%esp)
846 je nmi_debug_stack_check
847nmi_stack_correct:
848 /* We have a RING0_INT_FRAME here */
849 pushl %eax
850 CFI_ADJUST_CFA_OFFSET 4
851 SAVE_ALL
852 TRACE_IRQS_OFF
853 xorl %edx,%edx # zero error code
854 movl %esp,%eax # pt_regs pointer
855 call do_nmi
856 jmp restore_nocheck_notrace
857 CFI_ENDPROC
858
859nmi_stack_fixup:
860 RING0_INT_FRAME
861 FIX_STACK(12,nmi_stack_correct, 1)
862 jmp nmi_stack_correct
863
864nmi_debug_stack_check:
865 /* We have a RING0_INT_FRAME here */
866 cmpw $__KERNEL_CS,16(%esp)
867 jne nmi_stack_correct
868 cmpl $debug,(%esp)
869 jb nmi_stack_correct
870 cmpl $debug_esp_fix_insn,(%esp)
871 ja nmi_stack_correct
872 FIX_STACK(24,nmi_stack_correct, 1)
873 jmp nmi_stack_correct
874
875nmi_espfix_stack:
876 /* We have a RING0_INT_FRAME here.
877 *
878 * create the pointer to lss back
879 */
880 pushl %ss
881 CFI_ADJUST_CFA_OFFSET 4
882 pushl %esp
883 CFI_ADJUST_CFA_OFFSET 4
884 addw $4, (%esp)
885 /* copy the iret frame of 12 bytes */
886 .rept 3
887 pushl 16(%esp)
888 CFI_ADJUST_CFA_OFFSET 4
889 .endr
890 pushl %eax
891 CFI_ADJUST_CFA_OFFSET 4
892 SAVE_ALL
893 TRACE_IRQS_OFF
894 FIXUP_ESPFIX_STACK # %eax == %esp
895 xorl %edx,%edx # zero error code
896 call do_nmi
897 RESTORE_REGS
898 lss 12+4(%esp), %esp # back to espfix stack
899 CFI_ADJUST_CFA_OFFSET -24
900 jmp irq_return
901 CFI_ENDPROC
902KPROBE_END(nmi)
903
904#ifdef CONFIG_PARAVIRT 721#ifdef CONFIG_PARAVIRT
905ENTRY(native_iret) 722ENTRY(native_iret)
906 iret 723 iret
@@ -916,19 +733,6 @@ ENTRY(native_irq_enable_sysexit)
916END(native_irq_enable_sysexit) 733END(native_irq_enable_sysexit)
917#endif 734#endif
918 735
919KPROBE_ENTRY(int3)
920 RING0_INT_FRAME
921 pushl $-1 # mark this as an int
922 CFI_ADJUST_CFA_OFFSET 4
923 SAVE_ALL
924 TRACE_IRQS_OFF
925 xorl %edx,%edx # zero error code
926 movl %esp,%eax # pt_regs pointer
927 call do_int3
928 jmp ret_from_exception
929 CFI_ENDPROC
930KPROBE_END(int3)
931
932ENTRY(overflow) 736ENTRY(overflow)
933 RING0_INT_FRAME 737 RING0_INT_FRAME
934 pushl $0 738 pushl $0
@@ -993,14 +797,6 @@ ENTRY(stack_segment)
993 CFI_ENDPROC 797 CFI_ENDPROC
994END(stack_segment) 798END(stack_segment)
995 799
996KPROBE_ENTRY(general_protection)
997 RING0_EC_FRAME
998 pushl $do_general_protection
999 CFI_ADJUST_CFA_OFFSET 4
1000 jmp error_code
1001 CFI_ENDPROC
1002KPROBE_END(general_protection)
1003
1004ENTRY(alignment_check) 800ENTRY(alignment_check)
1005 RING0_EC_FRAME 801 RING0_EC_FRAME
1006 pushl $do_alignment_check 802 pushl $do_alignment_check
@@ -1051,6 +847,7 @@ ENTRY(kernel_thread_helper)
1051 push %eax 847 push %eax
1052 CFI_ADJUST_CFA_OFFSET 4 848 CFI_ADJUST_CFA_OFFSET 4
1053 call do_exit 849 call do_exit
850 ud2 # padding for call trace
1054 CFI_ENDPROC 851 CFI_ENDPROC
1055ENDPROC(kernel_thread_helper) 852ENDPROC(kernel_thread_helper)
1056 853
@@ -1157,6 +954,9 @@ ENTRY(mcount)
1157END(mcount) 954END(mcount)
1158 955
1159ENTRY(ftrace_caller) 956ENTRY(ftrace_caller)
957 cmpl $0, function_trace_stop
958 jne ftrace_stub
959
1160 pushl %eax 960 pushl %eax
1161 pushl %ecx 961 pushl %ecx
1162 pushl %edx 962 pushl %edx
@@ -1171,6 +971,11 @@ ftrace_call:
1171 popl %edx 971 popl %edx
1172 popl %ecx 972 popl %ecx
1173 popl %eax 973 popl %eax
974#ifdef CONFIG_FUNCTION_GRAPH_TRACER
975.globl ftrace_graph_call
976ftrace_graph_call:
977 jmp ftrace_stub
978#endif
1174 979
1175.globl ftrace_stub 980.globl ftrace_stub
1176ftrace_stub: 981ftrace_stub:
@@ -1180,8 +985,18 @@ END(ftrace_caller)
1180#else /* ! CONFIG_DYNAMIC_FTRACE */ 985#else /* ! CONFIG_DYNAMIC_FTRACE */
1181 986
1182ENTRY(mcount) 987ENTRY(mcount)
988 cmpl $0, function_trace_stop
989 jne ftrace_stub
990
1183 cmpl $ftrace_stub, ftrace_trace_function 991 cmpl $ftrace_stub, ftrace_trace_function
1184 jnz trace 992 jnz trace
993#ifdef CONFIG_FUNCTION_GRAPH_TRACER
994 cmpl $ftrace_stub, ftrace_graph_return
995 jnz ftrace_graph_caller
996
997 cmpl $ftrace_graph_entry_stub, ftrace_graph_entry
998 jnz ftrace_graph_caller
999#endif
1185.globl ftrace_stub 1000.globl ftrace_stub
1186ftrace_stub: 1001ftrace_stub:
1187 ret 1002 ret
@@ -1200,13 +1015,268 @@ trace:
1200 popl %edx 1015 popl %edx
1201 popl %ecx 1016 popl %ecx
1202 popl %eax 1017 popl %eax
1203
1204 jmp ftrace_stub 1018 jmp ftrace_stub
1205END(mcount) 1019END(mcount)
1206#endif /* CONFIG_DYNAMIC_FTRACE */ 1020#endif /* CONFIG_DYNAMIC_FTRACE */
1207#endif /* CONFIG_FUNCTION_TRACER */ 1021#endif /* CONFIG_FUNCTION_TRACER */
1208 1022
1023#ifdef CONFIG_FUNCTION_GRAPH_TRACER
1024ENTRY(ftrace_graph_caller)
1025 cmpl $0, function_trace_stop
1026 jne ftrace_stub
1027
1028 pushl %eax
1029 pushl %ecx
1030 pushl %edx
1031 movl 0xc(%esp), %edx
1032 lea 0x4(%ebp), %eax
1033 subl $MCOUNT_INSN_SIZE, %edx
1034 call prepare_ftrace_return
1035 popl %edx
1036 popl %ecx
1037 popl %eax
1038 ret
1039END(ftrace_graph_caller)
1040
1041.globl return_to_handler
1042return_to_handler:
1043 pushl $0
1044 pushl %eax
1045 pushl %ecx
1046 pushl %edx
1047 call ftrace_return_to_handler
1048 movl %eax, 0xc(%esp)
1049 popl %edx
1050 popl %ecx
1051 popl %eax
1052 ret
1053#endif
1054
1209.section .rodata,"a" 1055.section .rodata,"a"
1210#include "syscall_table_32.S" 1056#include "syscall_table_32.S"
1211 1057
1212syscall_table_size=(.-sys_call_table) 1058syscall_table_size=(.-sys_call_table)
1059
1060/*
1061 * Some functions should be protected against kprobes
1062 */
1063 .pushsection .kprobes.text, "ax"
1064
1065ENTRY(page_fault)
1066 RING0_EC_FRAME
1067 pushl $do_page_fault
1068 CFI_ADJUST_CFA_OFFSET 4
1069 ALIGN
1070error_code:
1071 /* the function address is in %fs's slot on the stack */
1072 pushl %es
1073 CFI_ADJUST_CFA_OFFSET 4
1074 /*CFI_REL_OFFSET es, 0*/
1075 pushl %ds
1076 CFI_ADJUST_CFA_OFFSET 4
1077 /*CFI_REL_OFFSET ds, 0*/
1078 pushl %eax
1079 CFI_ADJUST_CFA_OFFSET 4
1080 CFI_REL_OFFSET eax, 0
1081 pushl %ebp
1082 CFI_ADJUST_CFA_OFFSET 4
1083 CFI_REL_OFFSET ebp, 0
1084 pushl %edi
1085 CFI_ADJUST_CFA_OFFSET 4
1086 CFI_REL_OFFSET edi, 0
1087 pushl %esi
1088 CFI_ADJUST_CFA_OFFSET 4
1089 CFI_REL_OFFSET esi, 0
1090 pushl %edx
1091 CFI_ADJUST_CFA_OFFSET 4
1092 CFI_REL_OFFSET edx, 0
1093 pushl %ecx
1094 CFI_ADJUST_CFA_OFFSET 4
1095 CFI_REL_OFFSET ecx, 0
1096 pushl %ebx
1097 CFI_ADJUST_CFA_OFFSET 4
1098 CFI_REL_OFFSET ebx, 0
1099 cld
1100 pushl %fs
1101 CFI_ADJUST_CFA_OFFSET 4
1102 /*CFI_REL_OFFSET fs, 0*/
1103 movl $(__KERNEL_PERCPU), %ecx
1104 movl %ecx, %fs
1105 UNWIND_ESPFIX_STACK
1106 popl %ecx
1107 CFI_ADJUST_CFA_OFFSET -4
1108 /*CFI_REGISTER es, ecx*/
1109 movl PT_FS(%esp), %edi # get the function address
1110 movl PT_ORIG_EAX(%esp), %edx # get the error code
1111 movl $-1, PT_ORIG_EAX(%esp) # no syscall to restart
1112 mov %ecx, PT_FS(%esp)
1113 /*CFI_REL_OFFSET fs, ES*/
1114 movl $(__USER_DS), %ecx
1115 movl %ecx, %ds
1116 movl %ecx, %es
1117 TRACE_IRQS_OFF
1118 movl %esp,%eax # pt_regs pointer
1119 call *%edi
1120 jmp ret_from_exception
1121 CFI_ENDPROC
1122END(page_fault)
1123
1124/*
1125 * Debug traps and NMI can happen at the one SYSENTER instruction
1126 * that sets up the real kernel stack. Check here, since we can't
1127 * allow the wrong stack to be used.
1128 *
1129 * "TSS_sysenter_sp0+12" is because the NMI/debug handler will have
1130 * already pushed 3 words if it hits on the sysenter instruction:
1131 * eflags, cs and eip.
1132 *
1133 * We just load the right stack, and push the three (known) values
1134 * by hand onto the new stack - while updating the return eip past
1135 * the instruction that would have done it for sysenter.
1136 */
1137#define FIX_STACK(offset, ok, label) \
1138 cmpw $__KERNEL_CS,4(%esp); \
1139 jne ok; \
1140label: \
1141 movl TSS_sysenter_sp0+offset(%esp),%esp; \
1142 CFI_DEF_CFA esp, 0; \
1143 CFI_UNDEFINED eip; \
1144 pushfl; \
1145 CFI_ADJUST_CFA_OFFSET 4; \
1146 pushl $__KERNEL_CS; \
1147 CFI_ADJUST_CFA_OFFSET 4; \
1148 pushl $sysenter_past_esp; \
1149 CFI_ADJUST_CFA_OFFSET 4; \
1150 CFI_REL_OFFSET eip, 0
1151
1152ENTRY(debug)
1153 RING0_INT_FRAME
1154 cmpl $ia32_sysenter_target,(%esp)
1155 jne debug_stack_correct
1156 FIX_STACK(12, debug_stack_correct, debug_esp_fix_insn)
1157debug_stack_correct:
1158 pushl $-1 # mark this as an int
1159 CFI_ADJUST_CFA_OFFSET 4
1160 SAVE_ALL
1161 TRACE_IRQS_OFF
1162 xorl %edx,%edx # error code 0
1163 movl %esp,%eax # pt_regs pointer
1164 call do_debug
1165 jmp ret_from_exception
1166 CFI_ENDPROC
1167END(debug)
1168
1169/*
1170 * NMI is doubly nasty. It can happen _while_ we're handling
1171 * a debug fault, and the debug fault hasn't yet been able to
1172 * clear up the stack. So we first check whether we got an
1173 * NMI on the sysenter entry path, but after that we need to
1174 * check whether we got an NMI on the debug path where the debug
1175 * fault happened on the sysenter path.
1176 */
1177ENTRY(nmi)
1178 RING0_INT_FRAME
1179 pushl %eax
1180 CFI_ADJUST_CFA_OFFSET 4
1181 movl %ss, %eax
1182 cmpw $__ESPFIX_SS, %ax
1183 popl %eax
1184 CFI_ADJUST_CFA_OFFSET -4
1185 je nmi_espfix_stack
1186 cmpl $ia32_sysenter_target,(%esp)
1187 je nmi_stack_fixup
1188 pushl %eax
1189 CFI_ADJUST_CFA_OFFSET 4
1190 movl %esp,%eax
1191 /* Do not access memory above the end of our stack page,
1192 * it might not exist.
1193 */
1194 andl $(THREAD_SIZE-1),%eax
1195 cmpl $(THREAD_SIZE-20),%eax
1196 popl %eax
1197 CFI_ADJUST_CFA_OFFSET -4
1198 jae nmi_stack_correct
1199 cmpl $ia32_sysenter_target,12(%esp)
1200 je nmi_debug_stack_check
1201nmi_stack_correct:
1202 /* We have a RING0_INT_FRAME here */
1203 pushl %eax
1204 CFI_ADJUST_CFA_OFFSET 4
1205 SAVE_ALL
1206 TRACE_IRQS_OFF
1207 xorl %edx,%edx # zero error code
1208 movl %esp,%eax # pt_regs pointer
1209 call do_nmi
1210 jmp restore_nocheck_notrace
1211 CFI_ENDPROC
1212
1213nmi_stack_fixup:
1214 RING0_INT_FRAME
1215 FIX_STACK(12,nmi_stack_correct, 1)
1216 jmp nmi_stack_correct
1217
1218nmi_debug_stack_check:
1219 /* We have a RING0_INT_FRAME here */
1220 cmpw $__KERNEL_CS,16(%esp)
1221 jne nmi_stack_correct
1222 cmpl $debug,(%esp)
1223 jb nmi_stack_correct
1224 cmpl $debug_esp_fix_insn,(%esp)
1225 ja nmi_stack_correct
1226 FIX_STACK(24,nmi_stack_correct, 1)
1227 jmp nmi_stack_correct
1228
1229nmi_espfix_stack:
1230 /* We have a RING0_INT_FRAME here.
1231 *
1232 * create the pointer to lss back
1233 */
1234 pushl %ss
1235 CFI_ADJUST_CFA_OFFSET 4
1236 pushl %esp
1237 CFI_ADJUST_CFA_OFFSET 4
1238 addw $4, (%esp)
1239 /* copy the iret frame of 12 bytes */
1240 .rept 3
1241 pushl 16(%esp)
1242 CFI_ADJUST_CFA_OFFSET 4
1243 .endr
1244 pushl %eax
1245 CFI_ADJUST_CFA_OFFSET 4
1246 SAVE_ALL
1247 TRACE_IRQS_OFF
1248 FIXUP_ESPFIX_STACK # %eax == %esp
1249 xorl %edx,%edx # zero error code
1250 call do_nmi
1251 RESTORE_REGS
1252 lss 12+4(%esp), %esp # back to espfix stack
1253 CFI_ADJUST_CFA_OFFSET -24
1254 jmp irq_return
1255 CFI_ENDPROC
1256END(nmi)
1257
1258ENTRY(int3)
1259 RING0_INT_FRAME
1260 pushl $-1 # mark this as an int
1261 CFI_ADJUST_CFA_OFFSET 4
1262 SAVE_ALL
1263 TRACE_IRQS_OFF
1264 xorl %edx,%edx # zero error code
1265 movl %esp,%eax # pt_regs pointer
1266 call do_int3
1267 jmp ret_from_exception
1268 CFI_ENDPROC
1269END(int3)
1270
1271ENTRY(general_protection)
1272 RING0_EC_FRAME
1273 pushl $do_general_protection
1274 CFI_ADJUST_CFA_OFFSET 4
1275 jmp error_code
1276 CFI_ENDPROC
1277END(general_protection)
1278
1279/*
1280 * End of kprobes section
1281 */
1282 .popsection
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index b86f332c96a6..e28c7a987793 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -11,15 +11,15 @@
11 * 11 *
12 * NOTE: This code handles signal-recognition, which happens every time 12 * NOTE: This code handles signal-recognition, which happens every time
13 * after an interrupt and after each system call. 13 * after an interrupt and after each system call.
14 * 14 *
15 * Normal syscalls and interrupts don't save a full stack frame, this is 15 * Normal syscalls and interrupts don't save a full stack frame, this is
16 * only done for syscall tracing, signals or fork/exec et.al. 16 * only done for syscall tracing, signals or fork/exec et.al.
17 * 17 *
18 * A note on terminology: 18 * A note on terminology:
19 * - top of stack: Architecture defined interrupt frame from SS to RIP 19 * - top of stack: Architecture defined interrupt frame from SS to RIP
20 * at the top of the kernel process stack. 20 * at the top of the kernel process stack.
21 * - partial stack frame: partially saved registers upto R11. 21 * - partial stack frame: partially saved registers upto R11.
22 * - full stack frame: Like partial stack frame, but all register saved. 22 * - full stack frame: Like partial stack frame, but all register saved.
23 * 23 *
24 * Some macro usage: 24 * Some macro usage:
25 * - CFI macros are used to generate dwarf2 unwind information for better 25 * - CFI macros are used to generate dwarf2 unwind information for better
@@ -60,7 +60,6 @@
60#define __AUDIT_ARCH_LE 0x40000000 60#define __AUDIT_ARCH_LE 0x40000000
61 61
62 .code64 62 .code64
63
64#ifdef CONFIG_FUNCTION_TRACER 63#ifdef CONFIG_FUNCTION_TRACER
65#ifdef CONFIG_DYNAMIC_FTRACE 64#ifdef CONFIG_DYNAMIC_FTRACE
66ENTRY(mcount) 65ENTRY(mcount)
@@ -68,16 +67,10 @@ ENTRY(mcount)
68END(mcount) 67END(mcount)
69 68
70ENTRY(ftrace_caller) 69ENTRY(ftrace_caller)
70 cmpl $0, function_trace_stop
71 jne ftrace_stub
71 72
72 /* taken from glibc */ 73 MCOUNT_SAVE_FRAME
73 subq $0x38, %rsp
74 movq %rax, (%rsp)
75 movq %rcx, 8(%rsp)
76 movq %rdx, 16(%rsp)
77 movq %rsi, 24(%rsp)
78 movq %rdi, 32(%rsp)
79 movq %r8, 40(%rsp)
80 movq %r9, 48(%rsp)
81 74
82 movq 0x38(%rsp), %rdi 75 movq 0x38(%rsp), %rdi
83 movq 8(%rbp), %rsi 76 movq 8(%rbp), %rsi
@@ -87,14 +80,13 @@ ENTRY(ftrace_caller)
87ftrace_call: 80ftrace_call:
88 call ftrace_stub 81 call ftrace_stub
89 82
90 movq 48(%rsp), %r9 83 MCOUNT_RESTORE_FRAME
91 movq 40(%rsp), %r8 84
92 movq 32(%rsp), %rdi 85#ifdef CONFIG_FUNCTION_GRAPH_TRACER
93 movq 24(%rsp), %rsi 86.globl ftrace_graph_call
94 movq 16(%rsp), %rdx 87ftrace_graph_call:
95 movq 8(%rsp), %rcx 88 jmp ftrace_stub
96 movq (%rsp), %rax 89#endif
97 addq $0x38, %rsp
98 90
99.globl ftrace_stub 91.globl ftrace_stub
100ftrace_stub: 92ftrace_stub:
@@ -103,15 +95,63 @@ END(ftrace_caller)
103 95
104#else /* ! CONFIG_DYNAMIC_FTRACE */ 96#else /* ! CONFIG_DYNAMIC_FTRACE */
105ENTRY(mcount) 97ENTRY(mcount)
98 cmpl $0, function_trace_stop
99 jne ftrace_stub
100
106 cmpq $ftrace_stub, ftrace_trace_function 101 cmpq $ftrace_stub, ftrace_trace_function
107 jnz trace 102 jnz trace
103
104#ifdef CONFIG_FUNCTION_GRAPH_TRACER
105 cmpq $ftrace_stub, ftrace_graph_return
106 jnz ftrace_graph_caller
107
108 cmpq $ftrace_graph_entry_stub, ftrace_graph_entry
109 jnz ftrace_graph_caller
110#endif
111
108.globl ftrace_stub 112.globl ftrace_stub
109ftrace_stub: 113ftrace_stub:
110 retq 114 retq
111 115
112trace: 116trace:
113 /* taken from glibc */ 117 MCOUNT_SAVE_FRAME
114 subq $0x38, %rsp 118
119 movq 0x38(%rsp), %rdi
120 movq 8(%rbp), %rsi
121 subq $MCOUNT_INSN_SIZE, %rdi
122
123 call *ftrace_trace_function
124
125 MCOUNT_RESTORE_FRAME
126
127 jmp ftrace_stub
128END(mcount)
129#endif /* CONFIG_DYNAMIC_FTRACE */
130#endif /* CONFIG_FUNCTION_TRACER */
131
132#ifdef CONFIG_FUNCTION_GRAPH_TRACER
133ENTRY(ftrace_graph_caller)
134 cmpl $0, function_trace_stop
135 jne ftrace_stub
136
137 MCOUNT_SAVE_FRAME
138
139 leaq 8(%rbp), %rdi
140 movq 0x38(%rsp), %rsi
141 subq $MCOUNT_INSN_SIZE, %rsi
142
143 call prepare_ftrace_return
144
145 MCOUNT_RESTORE_FRAME
146
147 retq
148END(ftrace_graph_caller)
149
150
151.globl return_to_handler
152return_to_handler:
153 subq $80, %rsp
154
115 movq %rax, (%rsp) 155 movq %rax, (%rsp)
116 movq %rcx, 8(%rsp) 156 movq %rcx, 8(%rsp)
117 movq %rdx, 16(%rsp) 157 movq %rdx, 16(%rsp)
@@ -119,13 +159,14 @@ trace:
119 movq %rdi, 32(%rsp) 159 movq %rdi, 32(%rsp)
120 movq %r8, 40(%rsp) 160 movq %r8, 40(%rsp)
121 movq %r9, 48(%rsp) 161 movq %r9, 48(%rsp)
162 movq %r10, 56(%rsp)
163 movq %r11, 64(%rsp)
122 164
123 movq 0x38(%rsp), %rdi 165 call ftrace_return_to_handler
124 movq 8(%rbp), %rsi
125 subq $MCOUNT_INSN_SIZE, %rdi
126
127 call *ftrace_trace_function
128 166
167 movq %rax, 72(%rsp)
168 movq 64(%rsp), %r11
169 movq 56(%rsp), %r10
129 movq 48(%rsp), %r9 170 movq 48(%rsp), %r9
130 movq 40(%rsp), %r8 171 movq 40(%rsp), %r8
131 movq 32(%rsp), %rdi 172 movq 32(%rsp), %rdi
@@ -133,16 +174,14 @@ trace:
133 movq 16(%rsp), %rdx 174 movq 16(%rsp), %rdx
134 movq 8(%rsp), %rcx 175 movq 8(%rsp), %rcx
135 movq (%rsp), %rax 176 movq (%rsp), %rax
136 addq $0x38, %rsp 177 addq $72, %rsp
178 retq
179#endif
137 180
138 jmp ftrace_stub
139END(mcount)
140#endif /* CONFIG_DYNAMIC_FTRACE */
141#endif /* CONFIG_FUNCTION_TRACER */
142 181
143#ifndef CONFIG_PREEMPT 182#ifndef CONFIG_PREEMPT
144#define retint_kernel retint_restore_args 183#define retint_kernel retint_restore_args
145#endif 184#endif
146 185
147#ifdef CONFIG_PARAVIRT 186#ifdef CONFIG_PARAVIRT
148ENTRY(native_usergs_sysret64) 187ENTRY(native_usergs_sysret64)
@@ -161,29 +200,29 @@ ENTRY(native_usergs_sysret64)
161.endm 200.endm
162 201
163/* 202/*
164 * C code is not supposed to know about undefined top of stack. Every time 203 * C code is not supposed to know about undefined top of stack. Every time
165 * a C function with an pt_regs argument is called from the SYSCALL based 204 * a C function with an pt_regs argument is called from the SYSCALL based
166 * fast path FIXUP_TOP_OF_STACK is needed. 205 * fast path FIXUP_TOP_OF_STACK is needed.
167 * RESTORE_TOP_OF_STACK syncs the syscall state after any possible ptregs 206 * RESTORE_TOP_OF_STACK syncs the syscall state after any possible ptregs
168 * manipulation. 207 * manipulation.
169 */ 208 */
170 209
171 /* %rsp:at FRAMEEND */ 210 /* %rsp:at FRAMEEND */
172 .macro FIXUP_TOP_OF_STACK tmp 211 .macro FIXUP_TOP_OF_STACK tmp offset=0
173 movq %gs:pda_oldrsp,\tmp 212 movq %gs:pda_oldrsp,\tmp
174 movq \tmp,RSP(%rsp) 213 movq \tmp,RSP+\offset(%rsp)
175 movq $__USER_DS,SS(%rsp) 214 movq $__USER_DS,SS+\offset(%rsp)
176 movq $__USER_CS,CS(%rsp) 215 movq $__USER_CS,CS+\offset(%rsp)
177 movq $-1,RCX(%rsp) 216 movq $-1,RCX+\offset(%rsp)
178 movq R11(%rsp),\tmp /* get eflags */ 217 movq R11+\offset(%rsp),\tmp /* get eflags */
179 movq \tmp,EFLAGS(%rsp) 218 movq \tmp,EFLAGS+\offset(%rsp)
180 .endm 219 .endm
181 220
182 .macro RESTORE_TOP_OF_STACK tmp,offset=0 221 .macro RESTORE_TOP_OF_STACK tmp offset=0
183 movq RSP-\offset(%rsp),\tmp 222 movq RSP+\offset(%rsp),\tmp
184 movq \tmp,%gs:pda_oldrsp 223 movq \tmp,%gs:pda_oldrsp
185 movq EFLAGS-\offset(%rsp),\tmp 224 movq EFLAGS+\offset(%rsp),\tmp
186 movq \tmp,R11-\offset(%rsp) 225 movq \tmp,R11+\offset(%rsp)
187 .endm 226 .endm
188 227
189 .macro FAKE_STACK_FRAME child_rip 228 .macro FAKE_STACK_FRAME child_rip
@@ -195,7 +234,7 @@ ENTRY(native_usergs_sysret64)
195 pushq %rax /* rsp */ 234 pushq %rax /* rsp */
196 CFI_ADJUST_CFA_OFFSET 8 235 CFI_ADJUST_CFA_OFFSET 8
197 CFI_REL_OFFSET rsp,0 236 CFI_REL_OFFSET rsp,0
198 pushq $(1<<9) /* eflags - interrupts on */ 237 pushq $X86_EFLAGS_IF /* eflags - interrupts on */
199 CFI_ADJUST_CFA_OFFSET 8 238 CFI_ADJUST_CFA_OFFSET 8
200 /*CFI_REL_OFFSET rflags,0*/ 239 /*CFI_REL_OFFSET rflags,0*/
201 pushq $__KERNEL_CS /* cs */ 240 pushq $__KERNEL_CS /* cs */
@@ -213,62 +252,184 @@ ENTRY(native_usergs_sysret64)
213 CFI_ADJUST_CFA_OFFSET -(6*8) 252 CFI_ADJUST_CFA_OFFSET -(6*8)
214 .endm 253 .endm
215 254
216 .macro CFI_DEFAULT_STACK start=1 255/*
256 * initial frame state for interrupts (and exceptions without error code)
257 */
258 .macro EMPTY_FRAME start=1 offset=0
217 .if \start 259 .if \start
218 CFI_STARTPROC simple 260 CFI_STARTPROC simple
219 CFI_SIGNAL_FRAME 261 CFI_SIGNAL_FRAME
220 CFI_DEF_CFA rsp,SS+8 262 CFI_DEF_CFA rsp,8+\offset
221 .else 263 .else
222 CFI_DEF_CFA_OFFSET SS+8 264 CFI_DEF_CFA_OFFSET 8+\offset
223 .endif 265 .endif
224 CFI_REL_OFFSET r15,R15
225 CFI_REL_OFFSET r14,R14
226 CFI_REL_OFFSET r13,R13
227 CFI_REL_OFFSET r12,R12
228 CFI_REL_OFFSET rbp,RBP
229 CFI_REL_OFFSET rbx,RBX
230 CFI_REL_OFFSET r11,R11
231 CFI_REL_OFFSET r10,R10
232 CFI_REL_OFFSET r9,R9
233 CFI_REL_OFFSET r8,R8
234 CFI_REL_OFFSET rax,RAX
235 CFI_REL_OFFSET rcx,RCX
236 CFI_REL_OFFSET rdx,RDX
237 CFI_REL_OFFSET rsi,RSI
238 CFI_REL_OFFSET rdi,RDI
239 CFI_REL_OFFSET rip,RIP
240 /*CFI_REL_OFFSET cs,CS*/
241 /*CFI_REL_OFFSET rflags,EFLAGS*/
242 CFI_REL_OFFSET rsp,RSP
243 /*CFI_REL_OFFSET ss,SS*/
244 .endm 266 .endm
267
268/*
269 * initial frame state for interrupts (and exceptions without error code)
270 */
271 .macro INTR_FRAME start=1 offset=0
272 EMPTY_FRAME \start, SS+8+\offset-RIP
273 /*CFI_REL_OFFSET ss, SS+\offset-RIP*/
274 CFI_REL_OFFSET rsp, RSP+\offset-RIP
275 /*CFI_REL_OFFSET rflags, EFLAGS+\offset-RIP*/
276 /*CFI_REL_OFFSET cs, CS+\offset-RIP*/
277 CFI_REL_OFFSET rip, RIP+\offset-RIP
278 .endm
279
280/*
281 * initial frame state for exceptions with error code (and interrupts
282 * with vector already pushed)
283 */
284 .macro XCPT_FRAME start=1 offset=0
285 INTR_FRAME \start, RIP+\offset-ORIG_RAX
286 /*CFI_REL_OFFSET orig_rax, ORIG_RAX-ORIG_RAX*/
287 .endm
288
245/* 289/*
246 * A newly forked process directly context switches into this. 290 * frame that enables calling into C.
247 */ 291 */
248/* rdi: prev */ 292 .macro PARTIAL_FRAME start=1 offset=0
293 XCPT_FRAME \start, ORIG_RAX+\offset-ARGOFFSET
294 CFI_REL_OFFSET rdi, RDI+\offset-ARGOFFSET
295 CFI_REL_OFFSET rsi, RSI+\offset-ARGOFFSET
296 CFI_REL_OFFSET rdx, RDX+\offset-ARGOFFSET
297 CFI_REL_OFFSET rcx, RCX+\offset-ARGOFFSET
298 CFI_REL_OFFSET rax, RAX+\offset-ARGOFFSET
299 CFI_REL_OFFSET r8, R8+\offset-ARGOFFSET
300 CFI_REL_OFFSET r9, R9+\offset-ARGOFFSET
301 CFI_REL_OFFSET r10, R10+\offset-ARGOFFSET
302 CFI_REL_OFFSET r11, R11+\offset-ARGOFFSET
303 .endm
304
305/*
306 * frame that enables passing a complete pt_regs to a C function.
307 */
308 .macro DEFAULT_FRAME start=1 offset=0
309 PARTIAL_FRAME \start, R11+\offset-R15
310 CFI_REL_OFFSET rbx, RBX+\offset
311 CFI_REL_OFFSET rbp, RBP+\offset
312 CFI_REL_OFFSET r12, R12+\offset
313 CFI_REL_OFFSET r13, R13+\offset
314 CFI_REL_OFFSET r14, R14+\offset
315 CFI_REL_OFFSET r15, R15+\offset
316 .endm
317
318/* save partial stack frame */
319ENTRY(save_args)
320 XCPT_FRAME
321 cld
322 movq_cfi rdi, RDI+16-ARGOFFSET
323 movq_cfi rsi, RSI+16-ARGOFFSET
324 movq_cfi rdx, RDX+16-ARGOFFSET
325 movq_cfi rcx, RCX+16-ARGOFFSET
326 movq_cfi rax, RAX+16-ARGOFFSET
327 movq_cfi r8, R8+16-ARGOFFSET
328 movq_cfi r9, R9+16-ARGOFFSET
329 movq_cfi r10, R10+16-ARGOFFSET
330 movq_cfi r11, R11+16-ARGOFFSET
331
332 leaq -ARGOFFSET+16(%rsp),%rdi /* arg1 for handler */
333 movq_cfi rbp, 8 /* push %rbp */
334 leaq 8(%rsp), %rbp /* mov %rsp, %ebp */
335 testl $3, CS(%rdi)
336 je 1f
337 SWAPGS
338 /*
339 * irqcount is used to check if a CPU is already on an interrupt stack
340 * or not. While this is essentially redundant with preempt_count it is
341 * a little cheaper to use a separate counter in the PDA (short of
342 * moving irq_enter into assembly, which would be too much work)
343 */
3441: incl %gs:pda_irqcount
345 jne 2f
346 popq_cfi %rax /* move return address... */
347 mov %gs:pda_irqstackptr,%rsp
348 EMPTY_FRAME 0
349 pushq_cfi %rax /* ... to the new stack */
350 /*
351 * We entered an interrupt context - irqs are off:
352 */
3532: TRACE_IRQS_OFF
354 ret
355 CFI_ENDPROC
356END(save_args)
357
358ENTRY(save_rest)
359 PARTIAL_FRAME 1 REST_SKIP+8
360 movq 5*8+16(%rsp), %r11 /* save return address */
361 movq_cfi rbx, RBX+16
362 movq_cfi rbp, RBP+16
363 movq_cfi r12, R12+16
364 movq_cfi r13, R13+16
365 movq_cfi r14, R14+16
366 movq_cfi r15, R15+16
367 movq %r11, 8(%rsp) /* return address */
368 FIXUP_TOP_OF_STACK %r11, 16
369 ret
370 CFI_ENDPROC
371END(save_rest)
372
373/* save complete stack frame */
374ENTRY(save_paranoid)
375 XCPT_FRAME 1 RDI+8
376 cld
377 movq_cfi rdi, RDI+8
378 movq_cfi rsi, RSI+8
379 movq_cfi rdx, RDX+8
380 movq_cfi rcx, RCX+8
381 movq_cfi rax, RAX+8
382 movq_cfi r8, R8+8
383 movq_cfi r9, R9+8
384 movq_cfi r10, R10+8
385 movq_cfi r11, R11+8
386 movq_cfi rbx, RBX+8
387 movq_cfi rbp, RBP+8
388 movq_cfi r12, R12+8
389 movq_cfi r13, R13+8
390 movq_cfi r14, R14+8
391 movq_cfi r15, R15+8
392 movl $1,%ebx
393 movl $MSR_GS_BASE,%ecx
394 rdmsr
395 testl %edx,%edx
396 js 1f /* negative -> in kernel */
397 SWAPGS
398 xorl %ebx,%ebx
3991: ret
400 CFI_ENDPROC
401END(save_paranoid)
402
403/*
404 * A newly forked process directly context switches into this address.
405 *
406 * rdi: prev task we switched from
407 */
249ENTRY(ret_from_fork) 408ENTRY(ret_from_fork)
250 CFI_DEFAULT_STACK 409 DEFAULT_FRAME
410
251 push kernel_eflags(%rip) 411 push kernel_eflags(%rip)
252 CFI_ADJUST_CFA_OFFSET 8 412 CFI_ADJUST_CFA_OFFSET 8
253 popf # reset kernel eflags 413 popf # reset kernel eflags
254 CFI_ADJUST_CFA_OFFSET -8 414 CFI_ADJUST_CFA_OFFSET -8
255 call schedule_tail 415
416 call schedule_tail # rdi: 'prev' task parameter
417
256 GET_THREAD_INFO(%rcx) 418 GET_THREAD_INFO(%rcx)
257 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_flags(%rcx) 419
258 jnz rff_trace 420 CFI_REMEMBER_STATE
259rff_action:
260 RESTORE_REST 421 RESTORE_REST
261 testl $3,CS-ARGOFFSET(%rsp) # from kernel_thread? 422
423 testl $3, CS-ARGOFFSET(%rsp) # from kernel_thread?
262 je int_ret_from_sys_call 424 je int_ret_from_sys_call
263 testl $_TIF_IA32,TI_flags(%rcx) 425
426 testl $_TIF_IA32, TI_flags(%rcx) # 32-bit compat task needs IRET
264 jnz int_ret_from_sys_call 427 jnz int_ret_from_sys_call
265 RESTORE_TOP_OF_STACK %rdi,ARGOFFSET 428
266 jmp ret_from_sys_call 429 RESTORE_TOP_OF_STACK %rdi, -ARGOFFSET
267rff_trace: 430 jmp ret_from_sys_call # go to the SYSRET fastpath
268 movq %rsp,%rdi 431
269 call syscall_trace_leave 432 CFI_RESTORE_STATE
270 GET_THREAD_INFO(%rcx)
271 jmp rff_action
272 CFI_ENDPROC 433 CFI_ENDPROC
273END(ret_from_fork) 434END(ret_from_fork)
274 435
@@ -278,20 +439,20 @@ END(ret_from_fork)
278 * SYSCALL does not save anything on the stack and does not change the 439 * SYSCALL does not save anything on the stack and does not change the
279 * stack pointer. 440 * stack pointer.
280 */ 441 */
281 442
282/* 443/*
283 * Register setup: 444 * Register setup:
284 * rax system call number 445 * rax system call number
285 * rdi arg0 446 * rdi arg0
286 * rcx return address for syscall/sysret, C arg3 447 * rcx return address for syscall/sysret, C arg3
287 * rsi arg1 448 * rsi arg1
288 * rdx arg2 449 * rdx arg2
289 * r10 arg3 (--> moved to rcx for C) 450 * r10 arg3 (--> moved to rcx for C)
290 * r8 arg4 451 * r8 arg4
291 * r9 arg5 452 * r9 arg5
292 * r11 eflags for syscall/sysret, temporary for C 453 * r11 eflags for syscall/sysret, temporary for C
293 * r12-r15,rbp,rbx saved by C code, not touched. 454 * r12-r15,rbp,rbx saved by C code, not touched.
294 * 455 *
295 * Interrupts are off on entry. 456 * Interrupts are off on entry.
296 * Only called from user space. 457 * Only called from user space.
297 * 458 *
@@ -301,7 +462,7 @@ END(ret_from_fork)
301 * When user can change the frames always force IRET. That is because 462 * When user can change the frames always force IRET. That is because
302 * it deals with uncanonical addresses better. SYSRET has trouble 463 * it deals with uncanonical addresses better. SYSRET has trouble
303 * with them due to bugs in both AMD and Intel CPUs. 464 * with them due to bugs in both AMD and Intel CPUs.
304 */ 465 */
305 466
306ENTRY(system_call) 467ENTRY(system_call)
307 CFI_STARTPROC simple 468 CFI_STARTPROC simple
@@ -317,7 +478,7 @@ ENTRY(system_call)
317 */ 478 */
318ENTRY(system_call_after_swapgs) 479ENTRY(system_call_after_swapgs)
319 480
320 movq %rsp,%gs:pda_oldrsp 481 movq %rsp,%gs:pda_oldrsp
321 movq %gs:pda_kernelstack,%rsp 482 movq %gs:pda_kernelstack,%rsp
322 /* 483 /*
323 * No need to follow this irqs off/on section - it's straight 484 * No need to follow this irqs off/on section - it's straight
@@ -325,7 +486,7 @@ ENTRY(system_call_after_swapgs)
325 */ 486 */
326 ENABLE_INTERRUPTS(CLBR_NONE) 487 ENABLE_INTERRUPTS(CLBR_NONE)
327 SAVE_ARGS 8,1 488 SAVE_ARGS 8,1
328 movq %rax,ORIG_RAX-ARGOFFSET(%rsp) 489 movq %rax,ORIG_RAX-ARGOFFSET(%rsp)
329 movq %rcx,RIP-ARGOFFSET(%rsp) 490 movq %rcx,RIP-ARGOFFSET(%rsp)
330 CFI_REL_OFFSET rip,RIP-ARGOFFSET 491 CFI_REL_OFFSET rip,RIP-ARGOFFSET
331 GET_THREAD_INFO(%rcx) 492 GET_THREAD_INFO(%rcx)
@@ -339,19 +500,19 @@ system_call_fastpath:
339 movq %rax,RAX-ARGOFFSET(%rsp) 500 movq %rax,RAX-ARGOFFSET(%rsp)
340/* 501/*
341 * Syscall return path ending with SYSRET (fast path) 502 * Syscall return path ending with SYSRET (fast path)
342 * Has incomplete stack frame and undefined top of stack. 503 * Has incomplete stack frame and undefined top of stack.
343 */ 504 */
344ret_from_sys_call: 505ret_from_sys_call:
345 movl $_TIF_ALLWORK_MASK,%edi 506 movl $_TIF_ALLWORK_MASK,%edi
346 /* edi: flagmask */ 507 /* edi: flagmask */
347sysret_check: 508sysret_check:
348 LOCKDEP_SYS_EXIT 509 LOCKDEP_SYS_EXIT
349 GET_THREAD_INFO(%rcx) 510 GET_THREAD_INFO(%rcx)
350 DISABLE_INTERRUPTS(CLBR_NONE) 511 DISABLE_INTERRUPTS(CLBR_NONE)
351 TRACE_IRQS_OFF 512 TRACE_IRQS_OFF
352 movl TI_flags(%rcx),%edx 513 movl TI_flags(%rcx),%edx
353 andl %edi,%edx 514 andl %edi,%edx
354 jnz sysret_careful 515 jnz sysret_careful
355 CFI_REMEMBER_STATE 516 CFI_REMEMBER_STATE
356 /* 517 /*
357 * sysretq will re-enable interrupts: 518 * sysretq will re-enable interrupts:
@@ -366,7 +527,7 @@ sysret_check:
366 527
367 CFI_RESTORE_STATE 528 CFI_RESTORE_STATE
368 /* Handle reschedules */ 529 /* Handle reschedules */
369 /* edx: work, edi: workmask */ 530 /* edx: work, edi: workmask */
370sysret_careful: 531sysret_careful:
371 bt $TIF_NEED_RESCHED,%edx 532 bt $TIF_NEED_RESCHED,%edx
372 jnc sysret_signal 533 jnc sysret_signal
@@ -379,7 +540,7 @@ sysret_careful:
379 CFI_ADJUST_CFA_OFFSET -8 540 CFI_ADJUST_CFA_OFFSET -8
380 jmp sysret_check 541 jmp sysret_check
381 542
382 /* Handle a signal */ 543 /* Handle a signal */
383sysret_signal: 544sysret_signal:
384 TRACE_IRQS_ON 545 TRACE_IRQS_ON
385 ENABLE_INTERRUPTS(CLBR_NONE) 546 ENABLE_INTERRUPTS(CLBR_NONE)
@@ -388,17 +549,20 @@ sysret_signal:
388 jc sysret_audit 549 jc sysret_audit
389#endif 550#endif
390 /* edx: work flags (arg3) */ 551 /* edx: work flags (arg3) */
391 leaq do_notify_resume(%rip),%rax
392 leaq -ARGOFFSET(%rsp),%rdi # &pt_regs -> arg1 552 leaq -ARGOFFSET(%rsp),%rdi # &pt_regs -> arg1
393 xorl %esi,%esi # oldset -> arg2 553 xorl %esi,%esi # oldset -> arg2
394 call ptregscall_common 554 SAVE_REST
555 FIXUP_TOP_OF_STACK %r11
556 call do_notify_resume
557 RESTORE_TOP_OF_STACK %r11
558 RESTORE_REST
395 movl $_TIF_WORK_MASK,%edi 559 movl $_TIF_WORK_MASK,%edi
396 /* Use IRET because user could have changed frame. This 560 /* Use IRET because user could have changed frame. This
397 works because ptregscall_common has called FIXUP_TOP_OF_STACK. */ 561 works because ptregscall_common has called FIXUP_TOP_OF_STACK. */
398 DISABLE_INTERRUPTS(CLBR_NONE) 562 DISABLE_INTERRUPTS(CLBR_NONE)
399 TRACE_IRQS_OFF 563 TRACE_IRQS_OFF
400 jmp int_with_check 564 jmp int_with_check
401 565
402badsys: 566badsys:
403 movq $-ENOSYS,RAX-ARGOFFSET(%rsp) 567 movq $-ENOSYS,RAX-ARGOFFSET(%rsp)
404 jmp ret_from_sys_call 568 jmp ret_from_sys_call
@@ -437,7 +601,7 @@ sysret_audit:
437#endif /* CONFIG_AUDITSYSCALL */ 601#endif /* CONFIG_AUDITSYSCALL */
438 602
439 /* Do syscall tracing */ 603 /* Do syscall tracing */
440tracesys: 604tracesys:
441#ifdef CONFIG_AUDITSYSCALL 605#ifdef CONFIG_AUDITSYSCALL
442 testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%rcx) 606 testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%rcx)
443 jz auditsys 607 jz auditsys
@@ -460,8 +624,8 @@ tracesys:
460 call *sys_call_table(,%rax,8) 624 call *sys_call_table(,%rax,8)
461 movq %rax,RAX-ARGOFFSET(%rsp) 625 movq %rax,RAX-ARGOFFSET(%rsp)
462 /* Use IRET because user could have changed frame */ 626 /* Use IRET because user could have changed frame */
463 627
464/* 628/*
465 * Syscall return path ending with IRET. 629 * Syscall return path ending with IRET.
466 * Has correct top of stack, but partial stack frame. 630 * Has correct top of stack, but partial stack frame.
467 */ 631 */
@@ -505,18 +669,18 @@ int_very_careful:
505 TRACE_IRQS_ON 669 TRACE_IRQS_ON
506 ENABLE_INTERRUPTS(CLBR_NONE) 670 ENABLE_INTERRUPTS(CLBR_NONE)
507 SAVE_REST 671 SAVE_REST
508 /* Check for syscall exit trace */ 672 /* Check for syscall exit trace */
509 testl $_TIF_WORK_SYSCALL_EXIT,%edx 673 testl $_TIF_WORK_SYSCALL_EXIT,%edx
510 jz int_signal 674 jz int_signal
511 pushq %rdi 675 pushq %rdi
512 CFI_ADJUST_CFA_OFFSET 8 676 CFI_ADJUST_CFA_OFFSET 8
513 leaq 8(%rsp),%rdi # &ptregs -> arg1 677 leaq 8(%rsp),%rdi # &ptregs -> arg1
514 call syscall_trace_leave 678 call syscall_trace_leave
515 popq %rdi 679 popq %rdi
516 CFI_ADJUST_CFA_OFFSET -8 680 CFI_ADJUST_CFA_OFFSET -8
517 andl $~(_TIF_WORK_SYSCALL_EXIT|_TIF_SYSCALL_EMU),%edi 681 andl $~(_TIF_WORK_SYSCALL_EXIT|_TIF_SYSCALL_EMU),%edi
518 jmp int_restore_rest 682 jmp int_restore_rest
519 683
520int_signal: 684int_signal:
521 testl $_TIF_DO_NOTIFY_MASK,%edx 685 testl $_TIF_DO_NOTIFY_MASK,%edx
522 jz 1f 686 jz 1f
@@ -531,22 +695,24 @@ int_restore_rest:
531 jmp int_with_check 695 jmp int_with_check
532 CFI_ENDPROC 696 CFI_ENDPROC
533END(system_call) 697END(system_call)
534 698
535/* 699/*
536 * Certain special system calls that need to save a complete full stack frame. 700 * Certain special system calls that need to save a complete full stack frame.
537 */ 701 */
538
539 .macro PTREGSCALL label,func,arg 702 .macro PTREGSCALL label,func,arg
540 .globl \label 703ENTRY(\label)
541\label: 704 PARTIAL_FRAME 1 8 /* offset 8: return address */
542 leaq \func(%rip),%rax 705 subq $REST_SKIP, %rsp
543 leaq -ARGOFFSET+8(%rsp),\arg /* 8 for return address */ 706 CFI_ADJUST_CFA_OFFSET REST_SKIP
544 jmp ptregscall_common 707 call save_rest
708 DEFAULT_FRAME 0 8 /* offset 8: return address */
709 leaq 8(%rsp), \arg /* pt_regs pointer */
710 call \func
711 jmp ptregscall_common
712 CFI_ENDPROC
545END(\label) 713END(\label)
546 .endm 714 .endm
547 715
548 CFI_STARTPROC
549
550 PTREGSCALL stub_clone, sys_clone, %r8 716 PTREGSCALL stub_clone, sys_clone, %r8
551 PTREGSCALL stub_fork, sys_fork, %rdi 717 PTREGSCALL stub_fork, sys_fork, %rdi
552 PTREGSCALL stub_vfork, sys_vfork, %rdi 718 PTREGSCALL stub_vfork, sys_vfork, %rdi
@@ -554,25 +720,18 @@ END(\label)
554 PTREGSCALL stub_iopl, sys_iopl, %rsi 720 PTREGSCALL stub_iopl, sys_iopl, %rsi
555 721
556ENTRY(ptregscall_common) 722ENTRY(ptregscall_common)
557 popq %r11 723 DEFAULT_FRAME 1 8 /* offset 8: return address */
558 CFI_ADJUST_CFA_OFFSET -8 724 RESTORE_TOP_OF_STACK %r11, 8
559 CFI_REGISTER rip, r11 725 movq_cfi_restore R15+8, r15
560 SAVE_REST 726 movq_cfi_restore R14+8, r14
561 movq %r11, %r15 727 movq_cfi_restore R13+8, r13
562 CFI_REGISTER rip, r15 728 movq_cfi_restore R12+8, r12
563 FIXUP_TOP_OF_STACK %r11 729 movq_cfi_restore RBP+8, rbp
564 call *%rax 730 movq_cfi_restore RBX+8, rbx
565 RESTORE_TOP_OF_STACK %r11 731 ret $REST_SKIP /* pop extended registers */
566 movq %r15, %r11
567 CFI_REGISTER rip, r11
568 RESTORE_REST
569 pushq %r11
570 CFI_ADJUST_CFA_OFFSET 8
571 CFI_REL_OFFSET rip, 0
572 ret
573 CFI_ENDPROC 732 CFI_ENDPROC
574END(ptregscall_common) 733END(ptregscall_common)
575 734
576ENTRY(stub_execve) 735ENTRY(stub_execve)
577 CFI_STARTPROC 736 CFI_STARTPROC
578 popq %r11 737 popq %r11
@@ -588,11 +747,11 @@ ENTRY(stub_execve)
588 jmp int_ret_from_sys_call 747 jmp int_ret_from_sys_call
589 CFI_ENDPROC 748 CFI_ENDPROC
590END(stub_execve) 749END(stub_execve)
591 750
592/* 751/*
593 * sigreturn is special because it needs to restore all registers on return. 752 * sigreturn is special because it needs to restore all registers on return.
594 * This cannot be done with SYSRET, so use the IRET return path instead. 753 * This cannot be done with SYSRET, so use the IRET return path instead.
595 */ 754 */
596ENTRY(stub_rt_sigreturn) 755ENTRY(stub_rt_sigreturn)
597 CFI_STARTPROC 756 CFI_STARTPROC
598 addq $8, %rsp 757 addq $8, %rsp
@@ -608,70 +767,70 @@ ENTRY(stub_rt_sigreturn)
608END(stub_rt_sigreturn) 767END(stub_rt_sigreturn)
609 768
610/* 769/*
611 * initial frame state for interrupts and exceptions 770 * Build the entry stubs and pointer table with some assembler magic.
771 * We pack 7 stubs into a single 32-byte chunk, which will fit in a
772 * single cache line on all modern x86 implementations.
612 */ 773 */
613 .macro _frame ref 774 .section .init.rodata,"a"
614 CFI_STARTPROC simple 775ENTRY(interrupt)
615 CFI_SIGNAL_FRAME 776 .text
616 CFI_DEF_CFA rsp,SS+8-\ref 777 .p2align 5
617 /*CFI_REL_OFFSET ss,SS-\ref*/ 778 .p2align CONFIG_X86_L1_CACHE_SHIFT
618 CFI_REL_OFFSET rsp,RSP-\ref 779ENTRY(irq_entries_start)
619 /*CFI_REL_OFFSET rflags,EFLAGS-\ref*/ 780 INTR_FRAME
620 /*CFI_REL_OFFSET cs,CS-\ref*/ 781vector=FIRST_EXTERNAL_VECTOR
621 CFI_REL_OFFSET rip,RIP-\ref 782.rept (NR_VECTORS-FIRST_EXTERNAL_VECTOR+6)/7
622 .endm 783 .balign 32
784 .rept 7
785 .if vector < NR_VECTORS
786 .if vector <> FIRST_EXTERNAL_VECTOR
787 CFI_ADJUST_CFA_OFFSET -8
788 .endif
7891: pushq $(~vector+0x80) /* Note: always in signed byte range */
790 CFI_ADJUST_CFA_OFFSET 8
791 .if ((vector-FIRST_EXTERNAL_VECTOR)%7) <> 6
792 jmp 2f
793 .endif
794 .previous
795 .quad 1b
796 .text
797vector=vector+1
798 .endif
799 .endr
8002: jmp common_interrupt
801.endr
802 CFI_ENDPROC
803END(irq_entries_start)
623 804
624/* initial frame state for interrupts (and exceptions without error code) */ 805.previous
625#define INTR_FRAME _frame RIP 806END(interrupt)
626/* initial frame state for exceptions with error code (and interrupts with 807.previous
627 vector already pushed) */
628#define XCPT_FRAME _frame ORIG_RAX
629 808
630/* 809/*
631 * Interrupt entry/exit. 810 * Interrupt entry/exit.
632 * 811 *
633 * Interrupt entry points save only callee clobbered registers in fast path. 812 * Interrupt entry points save only callee clobbered registers in fast path.
634 * 813 *
635 * Entry runs with interrupts off. 814 * Entry runs with interrupts off.
636 */ 815 */
637 816
638/* 0(%rsp): interrupt number */ 817/* 0(%rsp): ~(interrupt number) */
639 .macro interrupt func 818 .macro interrupt func
640 cld 819 subq $10*8, %rsp
641 SAVE_ARGS 820 CFI_ADJUST_CFA_OFFSET 10*8
642 leaq -ARGOFFSET(%rsp),%rdi # arg1 for handler 821 call save_args
643 pushq %rbp 822 PARTIAL_FRAME 0
644 /*
645 * Save rbp twice: One is for marking the stack frame, as usual, and the
646 * other, to fill pt_regs properly. This is because bx comes right
647 * before the last saved register in that structure, and not bp. If the
648 * base pointer were in the place bx is today, this would not be needed.
649 */
650 movq %rbp, -8(%rsp)
651 CFI_ADJUST_CFA_OFFSET 8
652 CFI_REL_OFFSET rbp, 0
653 movq %rsp,%rbp
654 CFI_DEF_CFA_REGISTER rbp
655 testl $3,CS(%rdi)
656 je 1f
657 SWAPGS
658 /* irqcount is used to check if a CPU is already on an interrupt
659 stack or not. While this is essentially redundant with preempt_count
660 it is a little cheaper to use a separate counter in the PDA
661 (short of moving irq_enter into assembly, which would be too
662 much work) */
6631: incl %gs:pda_irqcount
664 cmoveq %gs:pda_irqstackptr,%rsp
665 push %rbp # backlink for old unwinder
666 /*
667 * We entered an interrupt context - irqs are off:
668 */
669 TRACE_IRQS_OFF
670 call \func 823 call \func
671 .endm 824 .endm
672 825
673ENTRY(common_interrupt) 826 /*
827 * The interrupt stubs push (~vector+0x80) onto the stack and
828 * then jump to common_interrupt.
829 */
830 .p2align CONFIG_X86_L1_CACHE_SHIFT
831common_interrupt:
674 XCPT_FRAME 832 XCPT_FRAME
833 addq $-0x80,(%rsp) /* Adjust vector to [-256,-1] range */
675 interrupt do_IRQ 834 interrupt do_IRQ
676 /* 0(%rsp): oldrsp-ARGOFFSET */ 835 /* 0(%rsp): oldrsp-ARGOFFSET */
677ret_from_intr: 836ret_from_intr:
@@ -685,12 +844,12 @@ exit_intr:
685 GET_THREAD_INFO(%rcx) 844 GET_THREAD_INFO(%rcx)
686 testl $3,CS-ARGOFFSET(%rsp) 845 testl $3,CS-ARGOFFSET(%rsp)
687 je retint_kernel 846 je retint_kernel
688 847
689 /* Interrupt came from user space */ 848 /* Interrupt came from user space */
690 /* 849 /*
691 * Has a correct top of stack, but a partial stack frame 850 * Has a correct top of stack, but a partial stack frame
692 * %rcx: thread info. Interrupts off. 851 * %rcx: thread info. Interrupts off.
693 */ 852 */
694retint_with_reschedule: 853retint_with_reschedule:
695 movl $_TIF_WORK_MASK,%edi 854 movl $_TIF_WORK_MASK,%edi
696retint_check: 855retint_check:
@@ -763,20 +922,20 @@ retint_careful:
763 pushq %rdi 922 pushq %rdi
764 CFI_ADJUST_CFA_OFFSET 8 923 CFI_ADJUST_CFA_OFFSET 8
765 call schedule 924 call schedule
766 popq %rdi 925 popq %rdi
767 CFI_ADJUST_CFA_OFFSET -8 926 CFI_ADJUST_CFA_OFFSET -8
768 GET_THREAD_INFO(%rcx) 927 GET_THREAD_INFO(%rcx)
769 DISABLE_INTERRUPTS(CLBR_NONE) 928 DISABLE_INTERRUPTS(CLBR_NONE)
770 TRACE_IRQS_OFF 929 TRACE_IRQS_OFF
771 jmp retint_check 930 jmp retint_check
772 931
773retint_signal: 932retint_signal:
774 testl $_TIF_DO_NOTIFY_MASK,%edx 933 testl $_TIF_DO_NOTIFY_MASK,%edx
775 jz retint_swapgs 934 jz retint_swapgs
776 TRACE_IRQS_ON 935 TRACE_IRQS_ON
777 ENABLE_INTERRUPTS(CLBR_NONE) 936 ENABLE_INTERRUPTS(CLBR_NONE)
778 SAVE_REST 937 SAVE_REST
779 movq $-1,ORIG_RAX(%rsp) 938 movq $-1,ORIG_RAX(%rsp)
780 xorl %esi,%esi # oldset 939 xorl %esi,%esi # oldset
781 movq %rsp,%rdi # &pt_regs 940 movq %rsp,%rdi # &pt_regs
782 call do_notify_resume 941 call do_notify_resume
@@ -798,324 +957,211 @@ ENTRY(retint_kernel)
798 jnc retint_restore_args 957 jnc retint_restore_args
799 call preempt_schedule_irq 958 call preempt_schedule_irq
800 jmp exit_intr 959 jmp exit_intr
801#endif 960#endif
802 961
803 CFI_ENDPROC 962 CFI_ENDPROC
804END(common_interrupt) 963END(common_interrupt)
805 964
806/* 965/*
807 * APIC interrupts. 966 * APIC interrupts.
808 */ 967 */
809 .macro apicinterrupt num,func 968.macro apicinterrupt num sym do_sym
969ENTRY(\sym)
810 INTR_FRAME 970 INTR_FRAME
811 pushq $~(\num) 971 pushq $~(\num)
812 CFI_ADJUST_CFA_OFFSET 8 972 CFI_ADJUST_CFA_OFFSET 8
813 interrupt \func 973 interrupt \do_sym
814 jmp ret_from_intr 974 jmp ret_from_intr
815 CFI_ENDPROC 975 CFI_ENDPROC
816 .endm 976END(\sym)
817 977.endm
818ENTRY(thermal_interrupt)
819 apicinterrupt THERMAL_APIC_VECTOR,smp_thermal_interrupt
820END(thermal_interrupt)
821
822ENTRY(threshold_interrupt)
823 apicinterrupt THRESHOLD_APIC_VECTOR,mce_threshold_interrupt
824END(threshold_interrupt)
825
826#ifdef CONFIG_SMP
827ENTRY(reschedule_interrupt)
828 apicinterrupt RESCHEDULE_VECTOR,smp_reschedule_interrupt
829END(reschedule_interrupt)
830
831 .macro INVALIDATE_ENTRY num
832ENTRY(invalidate_interrupt\num)
833 apicinterrupt INVALIDATE_TLB_VECTOR_START+\num,smp_invalidate_interrupt
834END(invalidate_interrupt\num)
835 .endm
836 978
837 INVALIDATE_ENTRY 0 979#ifdef CONFIG_SMP
838 INVALIDATE_ENTRY 1 980apicinterrupt IRQ_MOVE_CLEANUP_VECTOR \
839 INVALIDATE_ENTRY 2 981 irq_move_cleanup_interrupt smp_irq_move_cleanup_interrupt
840 INVALIDATE_ENTRY 3
841 INVALIDATE_ENTRY 4
842 INVALIDATE_ENTRY 5
843 INVALIDATE_ENTRY 6
844 INVALIDATE_ENTRY 7
845
846ENTRY(call_function_interrupt)
847 apicinterrupt CALL_FUNCTION_VECTOR,smp_call_function_interrupt
848END(call_function_interrupt)
849ENTRY(call_function_single_interrupt)
850 apicinterrupt CALL_FUNCTION_SINGLE_VECTOR,smp_call_function_single_interrupt
851END(call_function_single_interrupt)
852ENTRY(irq_move_cleanup_interrupt)
853 apicinterrupt IRQ_MOVE_CLEANUP_VECTOR,smp_irq_move_cleanup_interrupt
854END(irq_move_cleanup_interrupt)
855#endif 982#endif
856 983
857ENTRY(apic_timer_interrupt) 984apicinterrupt UV_BAU_MESSAGE \
858 apicinterrupt LOCAL_TIMER_VECTOR,smp_apic_timer_interrupt 985 uv_bau_message_intr1 uv_bau_message_interrupt
859END(apic_timer_interrupt) 986apicinterrupt LOCAL_TIMER_VECTOR \
987 apic_timer_interrupt smp_apic_timer_interrupt
988
989#ifdef CONFIG_SMP
990apicinterrupt INVALIDATE_TLB_VECTOR_START+0 \
991 invalidate_interrupt0 smp_invalidate_interrupt
992apicinterrupt INVALIDATE_TLB_VECTOR_START+1 \
993 invalidate_interrupt1 smp_invalidate_interrupt
994apicinterrupt INVALIDATE_TLB_VECTOR_START+2 \
995 invalidate_interrupt2 smp_invalidate_interrupt
996apicinterrupt INVALIDATE_TLB_VECTOR_START+3 \
997 invalidate_interrupt3 smp_invalidate_interrupt
998apicinterrupt INVALIDATE_TLB_VECTOR_START+4 \
999 invalidate_interrupt4 smp_invalidate_interrupt
1000apicinterrupt INVALIDATE_TLB_VECTOR_START+5 \
1001 invalidate_interrupt5 smp_invalidate_interrupt
1002apicinterrupt INVALIDATE_TLB_VECTOR_START+6 \
1003 invalidate_interrupt6 smp_invalidate_interrupt
1004apicinterrupt INVALIDATE_TLB_VECTOR_START+7 \
1005 invalidate_interrupt7 smp_invalidate_interrupt
1006#endif
860 1007
861ENTRY(uv_bau_message_intr1) 1008apicinterrupt THRESHOLD_APIC_VECTOR \
862 apicinterrupt 220,uv_bau_message_interrupt 1009 threshold_interrupt mce_threshold_interrupt
863END(uv_bau_message_intr1) 1010apicinterrupt THERMAL_APIC_VECTOR \
1011 thermal_interrupt smp_thermal_interrupt
1012
1013#ifdef CONFIG_SMP
1014apicinterrupt CALL_FUNCTION_SINGLE_VECTOR \
1015 call_function_single_interrupt smp_call_function_single_interrupt
1016apicinterrupt CALL_FUNCTION_VECTOR \
1017 call_function_interrupt smp_call_function_interrupt
1018apicinterrupt RESCHEDULE_VECTOR \
1019 reschedule_interrupt smp_reschedule_interrupt
1020#endif
864 1021
865ENTRY(error_interrupt) 1022apicinterrupt ERROR_APIC_VECTOR \
866 apicinterrupt ERROR_APIC_VECTOR,smp_error_interrupt 1023 error_interrupt smp_error_interrupt
867END(error_interrupt) 1024apicinterrupt SPURIOUS_APIC_VECTOR \
1025 spurious_interrupt smp_spurious_interrupt
868 1026
869ENTRY(spurious_interrupt)
870 apicinterrupt SPURIOUS_APIC_VECTOR,smp_spurious_interrupt
871END(spurious_interrupt)
872
873/* 1027/*
874 * Exception entry points. 1028 * Exception entry points.
875 */ 1029 */
876 .macro zeroentry sym 1030.macro zeroentry sym do_sym
1031ENTRY(\sym)
877 INTR_FRAME 1032 INTR_FRAME
878 PARAVIRT_ADJUST_EXCEPTION_FRAME 1033 PARAVIRT_ADJUST_EXCEPTION_FRAME
879 pushq $0 /* push error code/oldrax */ 1034 pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */
880 CFI_ADJUST_CFA_OFFSET 8 1035 subq $15*8,%rsp
881 pushq %rax /* push real oldrax to the rdi slot */ 1036 CFI_ADJUST_CFA_OFFSET 15*8
882 CFI_ADJUST_CFA_OFFSET 8 1037 call error_entry
883 CFI_REL_OFFSET rax,0 1038 DEFAULT_FRAME 0
884 leaq \sym(%rip),%rax 1039 movq %rsp,%rdi /* pt_regs pointer */
885 jmp error_entry 1040 xorl %esi,%esi /* no error code */
1041 call \do_sym
1042 jmp error_exit /* %ebx: no swapgs flag */
886 CFI_ENDPROC 1043 CFI_ENDPROC
887 .endm 1044END(\sym)
1045.endm
888 1046
889 .macro errorentry sym 1047.macro paranoidzeroentry sym do_sym
890 XCPT_FRAME 1048ENTRY(\sym)
1049 INTR_FRAME
891 PARAVIRT_ADJUST_EXCEPTION_FRAME 1050 PARAVIRT_ADJUST_EXCEPTION_FRAME
892 pushq %rax 1051 pushq $-1 /* ORIG_RAX: no syscall to restart */
893 CFI_ADJUST_CFA_OFFSET 8 1052 CFI_ADJUST_CFA_OFFSET 8
894 CFI_REL_OFFSET rax,0 1053 subq $15*8, %rsp
895 leaq \sym(%rip),%rax 1054 call save_paranoid
896 jmp error_entry 1055 TRACE_IRQS_OFF
1056 movq %rsp,%rdi /* pt_regs pointer */
1057 xorl %esi,%esi /* no error code */
1058 call \do_sym
1059 jmp paranoid_exit /* %ebx: no swapgs flag */
897 CFI_ENDPROC 1060 CFI_ENDPROC
898 .endm 1061END(\sym)
1062.endm
899 1063
900 /* error code is on the stack already */ 1064.macro paranoidzeroentry_ist sym do_sym ist
901 /* handle NMI like exceptions that can happen everywhere */ 1065ENTRY(\sym)
902 .macro paranoidentry sym, ist=0, irqtrace=1 1066 INTR_FRAME
903 SAVE_ALL 1067 PARAVIRT_ADJUST_EXCEPTION_FRAME
904 cld 1068 pushq $-1 /* ORIG_RAX: no syscall to restart */
905 movl $1,%ebx 1069 CFI_ADJUST_CFA_OFFSET 8
906 movl $MSR_GS_BASE,%ecx 1070 subq $15*8, %rsp
907 rdmsr 1071 call save_paranoid
908 testl %edx,%edx
909 js 1f
910 SWAPGS
911 xorl %ebx,%ebx
9121:
913 .if \ist
914 movq %gs:pda_data_offset, %rbp
915 .endif
916 .if \irqtrace
917 TRACE_IRQS_OFF
918 .endif
919 movq %rsp,%rdi
920 movq ORIG_RAX(%rsp),%rsi
921 movq $-1,ORIG_RAX(%rsp)
922 .if \ist
923 subq $EXCEPTION_STKSZ, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp)
924 .endif
925 call \sym
926 .if \ist
927 addq $EXCEPTION_STKSZ, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp)
928 .endif
929 DISABLE_INTERRUPTS(CLBR_NONE)
930 .if \irqtrace
931 TRACE_IRQS_OFF 1072 TRACE_IRQS_OFF
932 .endif 1073 movq %rsp,%rdi /* pt_regs pointer */
933 .endm 1074 xorl %esi,%esi /* no error code */
1075 movq %gs:pda_data_offset, %rbp
1076 subq $EXCEPTION_STKSZ, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp)
1077 call \do_sym
1078 addq $EXCEPTION_STKSZ, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp)
1079 jmp paranoid_exit /* %ebx: no swapgs flag */
1080 CFI_ENDPROC
1081END(\sym)
1082.endm
934 1083
935 /* 1084.macro errorentry sym do_sym
936 * "Paranoid" exit path from exception stack. 1085ENTRY(\sym)
937 * Paranoid because this is used by NMIs and cannot take 1086 XCPT_FRAME
938 * any kernel state for granted. 1087 PARAVIRT_ADJUST_EXCEPTION_FRAME
939 * We don't do kernel preemption checks here, because only 1088 subq $15*8,%rsp
940 * NMI should be common and it does not enable IRQs and 1089 CFI_ADJUST_CFA_OFFSET 15*8
941 * cannot get reschedule ticks. 1090 call error_entry
942 * 1091 DEFAULT_FRAME 0
943 * "trace" is 0 for the NMI handler only, because irq-tracing 1092 movq %rsp,%rdi /* pt_regs pointer */
944 * is fundamentally NMI-unsafe. (we cannot change the soft and 1093 movq ORIG_RAX(%rsp),%rsi /* get error code */
945 * hard flags at once, atomically) 1094 movq $-1,ORIG_RAX(%rsp) /* no syscall to restart */
946 */ 1095 call \do_sym
947 .macro paranoidexit trace=1 1096 jmp error_exit /* %ebx: no swapgs flag */
948 /* ebx: no swapgs flag */
949paranoid_exit\trace:
950 testl %ebx,%ebx /* swapgs needed? */
951 jnz paranoid_restore\trace
952 testl $3,CS(%rsp)
953 jnz paranoid_userspace\trace
954paranoid_swapgs\trace:
955 .if \trace
956 TRACE_IRQS_IRETQ 0
957 .endif
958 SWAPGS_UNSAFE_STACK
959paranoid_restore\trace:
960 RESTORE_ALL 8
961 jmp irq_return
962paranoid_userspace\trace:
963 GET_THREAD_INFO(%rcx)
964 movl TI_flags(%rcx),%ebx
965 andl $_TIF_WORK_MASK,%ebx
966 jz paranoid_swapgs\trace
967 movq %rsp,%rdi /* &pt_regs */
968 call sync_regs
969 movq %rax,%rsp /* switch stack for scheduling */
970 testl $_TIF_NEED_RESCHED,%ebx
971 jnz paranoid_schedule\trace
972 movl %ebx,%edx /* arg3: thread flags */
973 .if \trace
974 TRACE_IRQS_ON
975 .endif
976 ENABLE_INTERRUPTS(CLBR_NONE)
977 xorl %esi,%esi /* arg2: oldset */
978 movq %rsp,%rdi /* arg1: &pt_regs */
979 call do_notify_resume
980 DISABLE_INTERRUPTS(CLBR_NONE)
981 .if \trace
982 TRACE_IRQS_OFF
983 .endif
984 jmp paranoid_userspace\trace
985paranoid_schedule\trace:
986 .if \trace
987 TRACE_IRQS_ON
988 .endif
989 ENABLE_INTERRUPTS(CLBR_ANY)
990 call schedule
991 DISABLE_INTERRUPTS(CLBR_ANY)
992 .if \trace
993 TRACE_IRQS_OFF
994 .endif
995 jmp paranoid_userspace\trace
996 CFI_ENDPROC 1097 CFI_ENDPROC
997 .endm 1098END(\sym)
1099.endm
998 1100
999/* 1101 /* error code is on the stack already */
1000 * Exception entry point. This expects an error code/orig_rax on the stack 1102.macro paranoiderrorentry sym do_sym
1001 * and the exception handler in %rax. 1103ENTRY(\sym)
1002 */ 1104 XCPT_FRAME
1003KPROBE_ENTRY(error_entry) 1105 PARAVIRT_ADJUST_EXCEPTION_FRAME
1004 _frame RDI 1106 subq $15*8,%rsp
1005 CFI_REL_OFFSET rax,0 1107 CFI_ADJUST_CFA_OFFSET 15*8
1006 /* rdi slot contains rax, oldrax contains error code */ 1108 call save_paranoid
1007 cld 1109 DEFAULT_FRAME 0
1008 subq $14*8,%rsp
1009 CFI_ADJUST_CFA_OFFSET (14*8)
1010 movq %rsi,13*8(%rsp)
1011 CFI_REL_OFFSET rsi,RSI
1012 movq 14*8(%rsp),%rsi /* load rax from rdi slot */
1013 CFI_REGISTER rax,rsi
1014 movq %rdx,12*8(%rsp)
1015 CFI_REL_OFFSET rdx,RDX
1016 movq %rcx,11*8(%rsp)
1017 CFI_REL_OFFSET rcx,RCX
1018 movq %rsi,10*8(%rsp) /* store rax */
1019 CFI_REL_OFFSET rax,RAX
1020 movq %r8, 9*8(%rsp)
1021 CFI_REL_OFFSET r8,R8
1022 movq %r9, 8*8(%rsp)
1023 CFI_REL_OFFSET r9,R9
1024 movq %r10,7*8(%rsp)
1025 CFI_REL_OFFSET r10,R10
1026 movq %r11,6*8(%rsp)
1027 CFI_REL_OFFSET r11,R11
1028 movq %rbx,5*8(%rsp)
1029 CFI_REL_OFFSET rbx,RBX
1030 movq %rbp,4*8(%rsp)
1031 CFI_REL_OFFSET rbp,RBP
1032 movq %r12,3*8(%rsp)
1033 CFI_REL_OFFSET r12,R12
1034 movq %r13,2*8(%rsp)
1035 CFI_REL_OFFSET r13,R13
1036 movq %r14,1*8(%rsp)
1037 CFI_REL_OFFSET r14,R14
1038 movq %r15,(%rsp)
1039 CFI_REL_OFFSET r15,R15
1040 xorl %ebx,%ebx
1041 testl $3,CS(%rsp)
1042 je error_kernelspace
1043error_swapgs:
1044 SWAPGS
1045error_sti:
1046 TRACE_IRQS_OFF
1047 movq %rdi,RDI(%rsp)
1048 CFI_REL_OFFSET rdi,RDI
1049 movq %rsp,%rdi
1050 movq ORIG_RAX(%rsp),%rsi /* get error code */
1051 movq $-1,ORIG_RAX(%rsp)
1052 call *%rax
1053 /* ebx: no swapgs flag (1: don't need swapgs, 0: need it) */
1054error_exit:
1055 movl %ebx,%eax
1056 RESTORE_REST
1057 DISABLE_INTERRUPTS(CLBR_NONE)
1058 TRACE_IRQS_OFF 1110 TRACE_IRQS_OFF
1059 GET_THREAD_INFO(%rcx) 1111 movq %rsp,%rdi /* pt_regs pointer */
1060 testl %eax,%eax 1112 movq ORIG_RAX(%rsp),%rsi /* get error code */
1061 jne retint_kernel 1113 movq $-1,ORIG_RAX(%rsp) /* no syscall to restart */
1062 LOCKDEP_SYS_EXIT_IRQ 1114 call \do_sym
1063 movl TI_flags(%rcx),%edx 1115 jmp paranoid_exit /* %ebx: no swapgs flag */
1064 movl $_TIF_WORK_MASK,%edi
1065 andl %edi,%edx
1066 jnz retint_careful
1067 jmp retint_swapgs
1068 CFI_ENDPROC 1116 CFI_ENDPROC
1117END(\sym)
1118.endm
1069 1119
1070error_kernelspace: 1120zeroentry divide_error do_divide_error
1071 incl %ebx 1121zeroentry overflow do_overflow
1072 /* There are two places in the kernel that can potentially fault with 1122zeroentry bounds do_bounds
1073 usergs. Handle them here. The exception handlers after 1123zeroentry invalid_op do_invalid_op
1074 iret run with kernel gs again, so don't set the user space flag. 1124zeroentry device_not_available do_device_not_available
1075 B stepping K8s sometimes report an truncated RIP for IRET 1125paranoiderrorentry double_fault do_double_fault
1076 exceptions returning to compat mode. Check for these here too. */ 1126zeroentry coprocessor_segment_overrun do_coprocessor_segment_overrun
1077 leaq irq_return(%rip),%rcx 1127errorentry invalid_TSS do_invalid_TSS
1078 cmpq %rcx,RIP(%rsp) 1128errorentry segment_not_present do_segment_not_present
1079 je error_swapgs 1129zeroentry spurious_interrupt_bug do_spurious_interrupt_bug
1080 movl %ecx,%ecx /* zero extend */ 1130zeroentry coprocessor_error do_coprocessor_error
1081 cmpq %rcx,RIP(%rsp) 1131errorentry alignment_check do_alignment_check
1082 je error_swapgs 1132zeroentry simd_coprocessor_error do_simd_coprocessor_error
1083 cmpq $gs_change,RIP(%rsp) 1133
1084 je error_swapgs 1134 /* Reload gs selector with exception handling */
1085 jmp error_sti 1135 /* edi: new selector */
1086KPROBE_END(error_entry)
1087
1088 /* Reload gs selector with exception handling */
1089 /* edi: new selector */
1090ENTRY(native_load_gs_index) 1136ENTRY(native_load_gs_index)
1091 CFI_STARTPROC 1137 CFI_STARTPROC
1092 pushf 1138 pushf
1093 CFI_ADJUST_CFA_OFFSET 8 1139 CFI_ADJUST_CFA_OFFSET 8
1094 DISABLE_INTERRUPTS(CLBR_ANY | ~(CLBR_RDI)) 1140 DISABLE_INTERRUPTS(CLBR_ANY | ~(CLBR_RDI))
1095 SWAPGS 1141 SWAPGS
1096gs_change: 1142gs_change:
1097 movl %edi,%gs 1143 movl %edi,%gs
10982: mfence /* workaround */ 11442: mfence /* workaround */
1099 SWAPGS 1145 SWAPGS
1100 popf 1146 popf
1101 CFI_ADJUST_CFA_OFFSET -8 1147 CFI_ADJUST_CFA_OFFSET -8
1102 ret 1148 ret
1103 CFI_ENDPROC 1149 CFI_ENDPROC
1104ENDPROC(native_load_gs_index) 1150END(native_load_gs_index)
1105 1151
1106 .section __ex_table,"a" 1152 .section __ex_table,"a"
1107 .align 8 1153 .align 8
1108 .quad gs_change,bad_gs 1154 .quad gs_change,bad_gs
1109 .previous 1155 .previous
1110 .section .fixup,"ax" 1156 .section .fixup,"ax"
1111 /* running with kernelgs */ 1157 /* running with kernelgs */
1112bad_gs: 1158bad_gs:
1113 SWAPGS /* switch back to user gs */ 1159 SWAPGS /* switch back to user gs */
1114 xorl %eax,%eax 1160 xorl %eax,%eax
1115 movl %eax,%gs 1161 movl %eax,%gs
1116 jmp 2b 1162 jmp 2b
1117 .previous 1163 .previous
1118 1164
1119/* 1165/*
1120 * Create a kernel thread. 1166 * Create a kernel thread.
1121 * 1167 *
@@ -1138,7 +1184,7 @@ ENTRY(kernel_thread)
1138 1184
1139 xorl %r8d,%r8d 1185 xorl %r8d,%r8d
1140 xorl %r9d,%r9d 1186 xorl %r9d,%r9d
1141 1187
1142 # clone now 1188 # clone now
1143 call do_fork 1189 call do_fork
1144 movq %rax,RAX(%rsp) 1190 movq %rax,RAX(%rsp)
@@ -1149,15 +1195,15 @@ ENTRY(kernel_thread)
1149 * so internally to the x86_64 port you can rely on kernel_thread() 1195 * so internally to the x86_64 port you can rely on kernel_thread()
1150 * not to reschedule the child before returning, this avoids the need 1196 * not to reschedule the child before returning, this avoids the need
1151 * of hacks for example to fork off the per-CPU idle tasks. 1197 * of hacks for example to fork off the per-CPU idle tasks.
1152 * [Hopefully no generic code relies on the reschedule -AK] 1198 * [Hopefully no generic code relies on the reschedule -AK]
1153 */ 1199 */
1154 RESTORE_ALL 1200 RESTORE_ALL
1155 UNFAKE_STACK_FRAME 1201 UNFAKE_STACK_FRAME
1156 ret 1202 ret
1157 CFI_ENDPROC 1203 CFI_ENDPROC
1158ENDPROC(kernel_thread) 1204END(kernel_thread)
1159 1205
1160child_rip: 1206ENTRY(child_rip)
1161 pushq $0 # fake return address 1207 pushq $0 # fake return address
1162 CFI_STARTPROC 1208 CFI_STARTPROC
1163 /* 1209 /*
@@ -1170,8 +1216,9 @@ child_rip:
1170 # exit 1216 # exit
1171 mov %eax, %edi 1217 mov %eax, %edi
1172 call do_exit 1218 call do_exit
1219 ud2 # padding for call trace
1173 CFI_ENDPROC 1220 CFI_ENDPROC
1174ENDPROC(child_rip) 1221END(child_rip)
1175 1222
1176/* 1223/*
1177 * execve(). This function needs to use IRET, not SYSRET, to set up all state properly. 1224 * execve(). This function needs to use IRET, not SYSRET, to set up all state properly.
@@ -1191,10 +1238,10 @@ ENDPROC(child_rip)
1191ENTRY(kernel_execve) 1238ENTRY(kernel_execve)
1192 CFI_STARTPROC 1239 CFI_STARTPROC
1193 FAKE_STACK_FRAME $0 1240 FAKE_STACK_FRAME $0
1194 SAVE_ALL 1241 SAVE_ALL
1195 movq %rsp,%rcx 1242 movq %rsp,%rcx
1196 call sys_execve 1243 call sys_execve
1197 movq %rax, RAX(%rsp) 1244 movq %rax, RAX(%rsp)
1198 RESTORE_REST 1245 RESTORE_REST
1199 testq %rax,%rax 1246 testq %rax,%rax
1200 je int_ret_from_sys_call 1247 je int_ret_from_sys_call
@@ -1202,129 +1249,7 @@ ENTRY(kernel_execve)
1202 UNFAKE_STACK_FRAME 1249 UNFAKE_STACK_FRAME
1203 ret 1250 ret
1204 CFI_ENDPROC 1251 CFI_ENDPROC
1205ENDPROC(kernel_execve) 1252END(kernel_execve)
1206
1207KPROBE_ENTRY(page_fault)
1208 errorentry do_page_fault
1209KPROBE_END(page_fault)
1210
1211ENTRY(coprocessor_error)
1212 zeroentry do_coprocessor_error
1213END(coprocessor_error)
1214
1215ENTRY(simd_coprocessor_error)
1216 zeroentry do_simd_coprocessor_error
1217END(simd_coprocessor_error)
1218
1219ENTRY(device_not_available)
1220 zeroentry do_device_not_available
1221END(device_not_available)
1222
1223 /* runs on exception stack */
1224KPROBE_ENTRY(debug)
1225 INTR_FRAME
1226 PARAVIRT_ADJUST_EXCEPTION_FRAME
1227 pushq $0
1228 CFI_ADJUST_CFA_OFFSET 8
1229 paranoidentry do_debug, DEBUG_STACK
1230 paranoidexit
1231KPROBE_END(debug)
1232
1233 /* runs on exception stack */
1234KPROBE_ENTRY(nmi)
1235 INTR_FRAME
1236 PARAVIRT_ADJUST_EXCEPTION_FRAME
1237 pushq $-1
1238 CFI_ADJUST_CFA_OFFSET 8
1239 paranoidentry do_nmi, 0, 0
1240#ifdef CONFIG_TRACE_IRQFLAGS
1241 paranoidexit 0
1242#else
1243 jmp paranoid_exit1
1244 CFI_ENDPROC
1245#endif
1246KPROBE_END(nmi)
1247
1248KPROBE_ENTRY(int3)
1249 INTR_FRAME
1250 PARAVIRT_ADJUST_EXCEPTION_FRAME
1251 pushq $0
1252 CFI_ADJUST_CFA_OFFSET 8
1253 paranoidentry do_int3, DEBUG_STACK
1254 jmp paranoid_exit1
1255 CFI_ENDPROC
1256KPROBE_END(int3)
1257
1258ENTRY(overflow)
1259 zeroentry do_overflow
1260END(overflow)
1261
1262ENTRY(bounds)
1263 zeroentry do_bounds
1264END(bounds)
1265
1266ENTRY(invalid_op)
1267 zeroentry do_invalid_op
1268END(invalid_op)
1269
1270ENTRY(coprocessor_segment_overrun)
1271 zeroentry do_coprocessor_segment_overrun
1272END(coprocessor_segment_overrun)
1273
1274 /* runs on exception stack */
1275ENTRY(double_fault)
1276 XCPT_FRAME
1277 PARAVIRT_ADJUST_EXCEPTION_FRAME
1278 paranoidentry do_double_fault
1279 jmp paranoid_exit1
1280 CFI_ENDPROC
1281END(double_fault)
1282
1283ENTRY(invalid_TSS)
1284 errorentry do_invalid_TSS
1285END(invalid_TSS)
1286
1287ENTRY(segment_not_present)
1288 errorentry do_segment_not_present
1289END(segment_not_present)
1290
1291 /* runs on exception stack */
1292ENTRY(stack_segment)
1293 XCPT_FRAME
1294 PARAVIRT_ADJUST_EXCEPTION_FRAME
1295 paranoidentry do_stack_segment
1296 jmp paranoid_exit1
1297 CFI_ENDPROC
1298END(stack_segment)
1299
1300KPROBE_ENTRY(general_protection)
1301 errorentry do_general_protection
1302KPROBE_END(general_protection)
1303
1304ENTRY(alignment_check)
1305 errorentry do_alignment_check
1306END(alignment_check)
1307
1308ENTRY(divide_error)
1309 zeroentry do_divide_error
1310END(divide_error)
1311
1312ENTRY(spurious_interrupt_bug)
1313 zeroentry do_spurious_interrupt_bug
1314END(spurious_interrupt_bug)
1315
1316#ifdef CONFIG_X86_MCE
1317 /* runs on exception stack */
1318ENTRY(machine_check)
1319 INTR_FRAME
1320 PARAVIRT_ADJUST_EXCEPTION_FRAME
1321 pushq $0
1322 CFI_ADJUST_CFA_OFFSET 8
1323 paranoidentry do_machine_check
1324 jmp paranoid_exit1
1325 CFI_ENDPROC
1326END(machine_check)
1327#endif
1328 1253
1329/* Call softirq on interrupt stack. Interrupts are off. */ 1254/* Call softirq on interrupt stack. Interrupts are off. */
1330ENTRY(call_softirq) 1255ENTRY(call_softirq)
@@ -1344,40 +1269,33 @@ ENTRY(call_softirq)
1344 decl %gs:pda_irqcount 1269 decl %gs:pda_irqcount
1345 ret 1270 ret
1346 CFI_ENDPROC 1271 CFI_ENDPROC
1347ENDPROC(call_softirq) 1272END(call_softirq)
1348
1349KPROBE_ENTRY(ignore_sysret)
1350 CFI_STARTPROC
1351 mov $-ENOSYS,%eax
1352 sysret
1353 CFI_ENDPROC
1354ENDPROC(ignore_sysret)
1355 1273
1356#ifdef CONFIG_XEN 1274#ifdef CONFIG_XEN
1357ENTRY(xen_hypervisor_callback) 1275zeroentry xen_hypervisor_callback xen_do_hypervisor_callback
1358 zeroentry xen_do_hypervisor_callback
1359END(xen_hypervisor_callback)
1360 1276
1361/* 1277/*
1362# A note on the "critical region" in our callback handler. 1278 * A note on the "critical region" in our callback handler.
1363# We want to avoid stacking callback handlers due to events occurring 1279 * We want to avoid stacking callback handlers due to events occurring
1364# during handling of the last event. To do this, we keep events disabled 1280 * during handling of the last event. To do this, we keep events disabled
1365# until we've done all processing. HOWEVER, we must enable events before 1281 * until we've done all processing. HOWEVER, we must enable events before
1366# popping the stack frame (can't be done atomically) and so it would still 1282 * popping the stack frame (can't be done atomically) and so it would still
1367# be possible to get enough handler activations to overflow the stack. 1283 * be possible to get enough handler activations to overflow the stack.
1368# Although unlikely, bugs of that kind are hard to track down, so we'd 1284 * Although unlikely, bugs of that kind are hard to track down, so we'd
1369# like to avoid the possibility. 1285 * like to avoid the possibility.
1370# So, on entry to the handler we detect whether we interrupted an 1286 * So, on entry to the handler we detect whether we interrupted an
1371# existing activation in its critical region -- if so, we pop the current 1287 * existing activation in its critical region -- if so, we pop the current
1372# activation and restart the handler using the previous one. 1288 * activation and restart the handler using the previous one.
1373*/ 1289 */
1374ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs) 1290ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs)
1375 CFI_STARTPROC 1291 CFI_STARTPROC
1376/* Since we don't modify %rdi, evtchn_do_upall(struct *pt_regs) will 1292/*
1377 see the correct pointer to the pt_regs */ 1293 * Since we don't modify %rdi, evtchn_do_upall(struct *pt_regs) will
1294 * see the correct pointer to the pt_regs
1295 */
1378 movq %rdi, %rsp # we don't return, adjust the stack frame 1296 movq %rdi, %rsp # we don't return, adjust the stack frame
1379 CFI_ENDPROC 1297 CFI_ENDPROC
1380 CFI_DEFAULT_STACK 1298 DEFAULT_FRAME
138111: incl %gs:pda_irqcount 129911: incl %gs:pda_irqcount
1382 movq %rsp,%rbp 1300 movq %rsp,%rbp
1383 CFI_DEF_CFA_REGISTER rbp 1301 CFI_DEF_CFA_REGISTER rbp
@@ -1392,23 +1310,26 @@ ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs)
1392END(do_hypervisor_callback) 1310END(do_hypervisor_callback)
1393 1311
1394/* 1312/*
1395# Hypervisor uses this for application faults while it executes. 1313 * Hypervisor uses this for application faults while it executes.
1396# We get here for two reasons: 1314 * We get here for two reasons:
1397# 1. Fault while reloading DS, ES, FS or GS 1315 * 1. Fault while reloading DS, ES, FS or GS
1398# 2. Fault while executing IRET 1316 * 2. Fault while executing IRET
1399# Category 1 we do not need to fix up as Xen has already reloaded all segment 1317 * Category 1 we do not need to fix up as Xen has already reloaded all segment
1400# registers that could be reloaded and zeroed the others. 1318 * registers that could be reloaded and zeroed the others.
1401# Category 2 we fix up by killing the current process. We cannot use the 1319 * Category 2 we fix up by killing the current process. We cannot use the
1402# normal Linux return path in this case because if we use the IRET hypercall 1320 * normal Linux return path in this case because if we use the IRET hypercall
1403# to pop the stack frame we end up in an infinite loop of failsafe callbacks. 1321 * to pop the stack frame we end up in an infinite loop of failsafe callbacks.
1404# We distinguish between categories by comparing each saved segment register 1322 * We distinguish between categories by comparing each saved segment register
1405# with its current contents: any discrepancy means we in category 1. 1323 * with its current contents: any discrepancy means we in category 1.
1406*/ 1324 */
1407ENTRY(xen_failsafe_callback) 1325ENTRY(xen_failsafe_callback)
1408 framesz = (RIP-0x30) /* workaround buggy gas */ 1326 INTR_FRAME 1 (6*8)
1409 _frame framesz 1327 /*CFI_REL_OFFSET gs,GS*/
1410 CFI_REL_OFFSET rcx, 0 1328 /*CFI_REL_OFFSET fs,FS*/
1411 CFI_REL_OFFSET r11, 8 1329 /*CFI_REL_OFFSET es,ES*/
1330 /*CFI_REL_OFFSET ds,DS*/
1331 CFI_REL_OFFSET r11,8
1332 CFI_REL_OFFSET rcx,0
1412 movw %ds,%cx 1333 movw %ds,%cx
1413 cmpw %cx,0x10(%rsp) 1334 cmpw %cx,0x10(%rsp)
1414 CFI_REMEMBER_STATE 1335 CFI_REMEMBER_STATE
@@ -1429,12 +1350,9 @@ ENTRY(xen_failsafe_callback)
1429 CFI_RESTORE r11 1350 CFI_RESTORE r11
1430 addq $0x30,%rsp 1351 addq $0x30,%rsp
1431 CFI_ADJUST_CFA_OFFSET -0x30 1352 CFI_ADJUST_CFA_OFFSET -0x30
1432 pushq $0 1353 pushq_cfi $0 /* RIP */
1433 CFI_ADJUST_CFA_OFFSET 8 1354 pushq_cfi %r11
1434 pushq %r11 1355 pushq_cfi %rcx
1435 CFI_ADJUST_CFA_OFFSET 8
1436 pushq %rcx
1437 CFI_ADJUST_CFA_OFFSET 8
1438 jmp general_protection 1356 jmp general_protection
1439 CFI_RESTORE_STATE 1357 CFI_RESTORE_STATE
14401: /* Segment mismatch => Category 1 (Bad segment). Retry the IRET. */ 13581: /* Segment mismatch => Category 1 (Bad segment). Retry the IRET. */
@@ -1444,11 +1362,223 @@ ENTRY(xen_failsafe_callback)
1444 CFI_RESTORE r11 1362 CFI_RESTORE r11
1445 addq $0x30,%rsp 1363 addq $0x30,%rsp
1446 CFI_ADJUST_CFA_OFFSET -0x30 1364 CFI_ADJUST_CFA_OFFSET -0x30
1447 pushq $0 1365 pushq_cfi $0
1448 CFI_ADJUST_CFA_OFFSET 8
1449 SAVE_ALL 1366 SAVE_ALL
1450 jmp error_exit 1367 jmp error_exit
1451 CFI_ENDPROC 1368 CFI_ENDPROC
1452END(xen_failsafe_callback) 1369END(xen_failsafe_callback)
1453 1370
1454#endif /* CONFIG_XEN */ 1371#endif /* CONFIG_XEN */
1372
1373/*
1374 * Some functions should be protected against kprobes
1375 */
1376 .pushsection .kprobes.text, "ax"
1377
1378paranoidzeroentry_ist debug do_debug DEBUG_STACK
1379paranoidzeroentry_ist int3 do_int3 DEBUG_STACK
1380paranoiderrorentry stack_segment do_stack_segment
1381errorentry general_protection do_general_protection
1382errorentry page_fault do_page_fault
1383#ifdef CONFIG_X86_MCE
1384paranoidzeroentry machine_check do_machine_check
1385#endif
1386
1387 /*
1388 * "Paranoid" exit path from exception stack.
1389 * Paranoid because this is used by NMIs and cannot take
1390 * any kernel state for granted.
1391 * We don't do kernel preemption checks here, because only
1392 * NMI should be common and it does not enable IRQs and
1393 * cannot get reschedule ticks.
1394 *
1395 * "trace" is 0 for the NMI handler only, because irq-tracing
1396 * is fundamentally NMI-unsafe. (we cannot change the soft and
1397 * hard flags at once, atomically)
1398 */
1399
1400 /* ebx: no swapgs flag */
1401ENTRY(paranoid_exit)
1402 INTR_FRAME
1403 DISABLE_INTERRUPTS(CLBR_NONE)
1404 TRACE_IRQS_OFF
1405 testl %ebx,%ebx /* swapgs needed? */
1406 jnz paranoid_restore
1407 testl $3,CS(%rsp)
1408 jnz paranoid_userspace
1409paranoid_swapgs:
1410 TRACE_IRQS_IRETQ 0
1411 SWAPGS_UNSAFE_STACK
1412paranoid_restore:
1413 RESTORE_ALL 8
1414 jmp irq_return
1415paranoid_userspace:
1416 GET_THREAD_INFO(%rcx)
1417 movl TI_flags(%rcx),%ebx
1418 andl $_TIF_WORK_MASK,%ebx
1419 jz paranoid_swapgs
1420 movq %rsp,%rdi /* &pt_regs */
1421 call sync_regs
1422 movq %rax,%rsp /* switch stack for scheduling */
1423 testl $_TIF_NEED_RESCHED,%ebx
1424 jnz paranoid_schedule
1425 movl %ebx,%edx /* arg3: thread flags */
1426 TRACE_IRQS_ON
1427 ENABLE_INTERRUPTS(CLBR_NONE)
1428 xorl %esi,%esi /* arg2: oldset */
1429 movq %rsp,%rdi /* arg1: &pt_regs */
1430 call do_notify_resume
1431 DISABLE_INTERRUPTS(CLBR_NONE)
1432 TRACE_IRQS_OFF
1433 jmp paranoid_userspace
1434paranoid_schedule:
1435 TRACE_IRQS_ON
1436 ENABLE_INTERRUPTS(CLBR_ANY)
1437 call schedule
1438 DISABLE_INTERRUPTS(CLBR_ANY)
1439 TRACE_IRQS_OFF
1440 jmp paranoid_userspace
1441 CFI_ENDPROC
1442END(paranoid_exit)
1443
1444/*
1445 * Exception entry point. This expects an error code/orig_rax on the stack.
1446 * returns in "no swapgs flag" in %ebx.
1447 */
1448ENTRY(error_entry)
1449 XCPT_FRAME
1450 CFI_ADJUST_CFA_OFFSET 15*8
1451 /* oldrax contains error code */
1452 cld
1453 movq_cfi rdi, RDI+8
1454 movq_cfi rsi, RSI+8
1455 movq_cfi rdx, RDX+8
1456 movq_cfi rcx, RCX+8
1457 movq_cfi rax, RAX+8
1458 movq_cfi r8, R8+8
1459 movq_cfi r9, R9+8
1460 movq_cfi r10, R10+8
1461 movq_cfi r11, R11+8
1462 movq_cfi rbx, RBX+8
1463 movq_cfi rbp, RBP+8
1464 movq_cfi r12, R12+8
1465 movq_cfi r13, R13+8
1466 movq_cfi r14, R14+8
1467 movq_cfi r15, R15+8
1468 xorl %ebx,%ebx
1469 testl $3,CS+8(%rsp)
1470 je error_kernelspace
1471error_swapgs:
1472 SWAPGS
1473error_sti:
1474 TRACE_IRQS_OFF
1475 ret
1476 CFI_ENDPROC
1477
1478/*
1479 * There are two places in the kernel that can potentially fault with
1480 * usergs. Handle them here. The exception handlers after iret run with
1481 * kernel gs again, so don't set the user space flag. B stepping K8s
1482 * sometimes report an truncated RIP for IRET exceptions returning to
1483 * compat mode. Check for these here too.
1484 */
1485error_kernelspace:
1486 incl %ebx
1487 leaq irq_return(%rip),%rcx
1488 cmpq %rcx,RIP+8(%rsp)
1489 je error_swapgs
1490 movl %ecx,%ecx /* zero extend */
1491 cmpq %rcx,RIP+8(%rsp)
1492 je error_swapgs
1493 cmpq $gs_change,RIP+8(%rsp)
1494 je error_swapgs
1495 jmp error_sti
1496END(error_entry)
1497
1498
1499/* ebx: no swapgs flag (1: don't need swapgs, 0: need it) */
1500ENTRY(error_exit)
1501 DEFAULT_FRAME
1502 movl %ebx,%eax
1503 RESTORE_REST
1504 DISABLE_INTERRUPTS(CLBR_NONE)
1505 TRACE_IRQS_OFF
1506 GET_THREAD_INFO(%rcx)
1507 testl %eax,%eax
1508 jne retint_kernel
1509 LOCKDEP_SYS_EXIT_IRQ
1510 movl TI_flags(%rcx),%edx
1511 movl $_TIF_WORK_MASK,%edi
1512 andl %edi,%edx
1513 jnz retint_careful
1514 jmp retint_swapgs
1515 CFI_ENDPROC
1516END(error_exit)
1517
1518
1519 /* runs on exception stack */
1520ENTRY(nmi)
1521 INTR_FRAME
1522 PARAVIRT_ADJUST_EXCEPTION_FRAME
1523 pushq_cfi $-1
1524 subq $15*8, %rsp
1525 CFI_ADJUST_CFA_OFFSET 15*8
1526 call save_paranoid
1527 DEFAULT_FRAME 0
1528 /* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */
1529 movq %rsp,%rdi
1530 movq $-1,%rsi
1531 call do_nmi
1532#ifdef CONFIG_TRACE_IRQFLAGS
1533 /* paranoidexit; without TRACE_IRQS_OFF */
1534 /* ebx: no swapgs flag */
1535 DISABLE_INTERRUPTS(CLBR_NONE)
1536 testl %ebx,%ebx /* swapgs needed? */
1537 jnz nmi_restore
1538 testl $3,CS(%rsp)
1539 jnz nmi_userspace
1540nmi_swapgs:
1541 SWAPGS_UNSAFE_STACK
1542nmi_restore:
1543 RESTORE_ALL 8
1544 jmp irq_return
1545nmi_userspace:
1546 GET_THREAD_INFO(%rcx)
1547 movl TI_flags(%rcx),%ebx
1548 andl $_TIF_WORK_MASK,%ebx
1549 jz nmi_swapgs
1550 movq %rsp,%rdi /* &pt_regs */
1551 call sync_regs
1552 movq %rax,%rsp /* switch stack for scheduling */
1553 testl $_TIF_NEED_RESCHED,%ebx
1554 jnz nmi_schedule
1555 movl %ebx,%edx /* arg3: thread flags */
1556 ENABLE_INTERRUPTS(CLBR_NONE)
1557 xorl %esi,%esi /* arg2: oldset */
1558 movq %rsp,%rdi /* arg1: &pt_regs */
1559 call do_notify_resume
1560 DISABLE_INTERRUPTS(CLBR_NONE)
1561 jmp nmi_userspace
1562nmi_schedule:
1563 ENABLE_INTERRUPTS(CLBR_ANY)
1564 call schedule
1565 DISABLE_INTERRUPTS(CLBR_ANY)
1566 jmp nmi_userspace
1567 CFI_ENDPROC
1568#else
1569 jmp paranoid_exit
1570 CFI_ENDPROC
1571#endif
1572END(nmi)
1573
1574ENTRY(ignore_sysret)
1575 CFI_STARTPROC
1576 mov $-ENOSYS,%eax
1577 sysret
1578 CFI_ENDPROC
1579END(ignore_sysret)
1580
1581/*
1582 * End of kprobes section
1583 */
1584 .popsection
diff --git a/arch/x86/kernel/es7000_32.c b/arch/x86/kernel/es7000_32.c
index 0aa2c443d600..53699c931ad4 100644
--- a/arch/x86/kernel/es7000_32.c
+++ b/arch/x86/kernel/es7000_32.c
@@ -38,8 +38,11 @@
38#include <asm/io.h> 38#include <asm/io.h>
39#include <asm/nmi.h> 39#include <asm/nmi.h>
40#include <asm/smp.h> 40#include <asm/smp.h>
41#include <asm/atomic.h>
41#include <asm/apicdef.h> 42#include <asm/apicdef.h>
42#include <mach_mpparse.h> 43#include <mach_mpparse.h>
44#include <asm/genapic.h>
45#include <asm/setup.h>
43 46
44/* 47/*
45 * ES7000 chipsets 48 * ES7000 chipsets
@@ -161,6 +164,43 @@ es7000_rename_gsi(int ioapic, int gsi)
161 return gsi; 164 return gsi;
162} 165}
163 166
167static int wakeup_secondary_cpu_via_mip(int cpu, unsigned long eip)
168{
169 unsigned long vect = 0, psaival = 0;
170
171 if (psai == NULL)
172 return -1;
173
174 vect = ((unsigned long)__pa(eip)/0x1000) << 16;
175 psaival = (0x1000000 | vect | cpu);
176
177 while (*psai & 0x1000000)
178 ;
179
180 *psai = psaival;
181
182 return 0;
183}
184
185static void noop_wait_for_deassert(atomic_t *deassert_not_used)
186{
187}
188
189static int __init es7000_update_genapic(void)
190{
191 genapic->wakeup_cpu = wakeup_secondary_cpu_via_mip;
192
193 /* MPENTIUMIII */
194 if (boot_cpu_data.x86 == 6 &&
195 (boot_cpu_data.x86_model >= 7 || boot_cpu_data.x86_model <= 11)) {
196 es7000_update_genapic_to_cluster();
197 genapic->wait_for_init_deassert = noop_wait_for_deassert;
198 genapic->wakeup_cpu = wakeup_secondary_cpu_via_mip;
199 }
200
201 return 0;
202}
203
164void __init 204void __init
165setup_unisys(void) 205setup_unisys(void)
166{ 206{
@@ -176,6 +216,8 @@ setup_unisys(void)
176 else 216 else
177 es7000_plat = ES7000_CLASSIC; 217 es7000_plat = ES7000_CLASSIC;
178 ioapic_renumber_irq = es7000_rename_gsi; 218 ioapic_renumber_irq = es7000_rename_gsi;
219
220 x86_quirks->update_genapic = es7000_update_genapic;
179} 221}
180 222
181/* 223/*
@@ -317,26 +359,6 @@ es7000_mip_write(struct mip_reg *mip_reg)
317 return status; 359 return status;
318} 360}
319 361
320int
321es7000_start_cpu(int cpu, unsigned long eip)
322{
323 unsigned long vect = 0, psaival = 0;
324
325 if (psai == NULL)
326 return -1;
327
328 vect = ((unsigned long)__pa(eip)/0x1000) << 16;
329 psaival = (0x1000000 | vect | cpu);
330
331 while (*psai & 0x1000000)
332 ;
333
334 *psai = psaival;
335
336 return 0;
337
338}
339
340void __init 362void __init
341es7000_sw_apic(void) 363es7000_sw_apic(void)
342{ 364{
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 50ea0ac8c9bf..1b43086b097a 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -14,14 +14,17 @@
14#include <linux/uaccess.h> 14#include <linux/uaccess.h>
15#include <linux/ftrace.h> 15#include <linux/ftrace.h>
16#include <linux/percpu.h> 16#include <linux/percpu.h>
17#include <linux/sched.h>
17#include <linux/init.h> 18#include <linux/init.h>
18#include <linux/list.h> 19#include <linux/list.h>
19 20
20#include <asm/ftrace.h> 21#include <asm/ftrace.h>
22#include <linux/ftrace.h>
21#include <asm/nops.h> 23#include <asm/nops.h>
24#include <asm/nmi.h>
22 25
23 26
24static unsigned char ftrace_nop[MCOUNT_INSN_SIZE]; 27#ifdef CONFIG_DYNAMIC_FTRACE
25 28
26union ftrace_code_union { 29union ftrace_code_union {
27 char code[MCOUNT_INSN_SIZE]; 30 char code[MCOUNT_INSN_SIZE];
@@ -31,18 +34,12 @@ union ftrace_code_union {
31 } __attribute__((packed)); 34 } __attribute__((packed));
32}; 35};
33 36
34
35static int ftrace_calc_offset(long ip, long addr) 37static int ftrace_calc_offset(long ip, long addr)
36{ 38{
37 return (int)(addr - ip); 39 return (int)(addr - ip);
38} 40}
39 41
40unsigned char *ftrace_nop_replace(void) 42static unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
41{
42 return ftrace_nop;
43}
44
45unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
46{ 43{
47 static union ftrace_code_union calc; 44 static union ftrace_code_union calc;
48 45
@@ -56,7 +53,142 @@ unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
56 return calc.code; 53 return calc.code;
57} 54}
58 55
59int 56/*
57 * Modifying code must take extra care. On an SMP machine, if
58 * the code being modified is also being executed on another CPU
59 * that CPU will have undefined results and possibly take a GPF.
60 * We use kstop_machine to stop other CPUS from exectuing code.
61 * But this does not stop NMIs from happening. We still need
62 * to protect against that. We separate out the modification of
63 * the code to take care of this.
64 *
65 * Two buffers are added: An IP buffer and a "code" buffer.
66 *
67 * 1) Put the instruction pointer into the IP buffer
68 * and the new code into the "code" buffer.
69 * 2) Set a flag that says we are modifying code
70 * 3) Wait for any running NMIs to finish.
71 * 4) Write the code
72 * 5) clear the flag.
73 * 6) Wait for any running NMIs to finish.
74 *
75 * If an NMI is executed, the first thing it does is to call
76 * "ftrace_nmi_enter". This will check if the flag is set to write
77 * and if it is, it will write what is in the IP and "code" buffers.
78 *
79 * The trick is, it does not matter if everyone is writing the same
80 * content to the code location. Also, if a CPU is executing code
81 * it is OK to write to that code location if the contents being written
82 * are the same as what exists.
83 */
84
85static atomic_t in_nmi = ATOMIC_INIT(0);
86static int mod_code_status; /* holds return value of text write */
87static int mod_code_write; /* set when NMI should do the write */
88static void *mod_code_ip; /* holds the IP to write to */
89static void *mod_code_newcode; /* holds the text to write to the IP */
90
91static unsigned nmi_wait_count;
92static atomic_t nmi_update_count = ATOMIC_INIT(0);
93
94int ftrace_arch_read_dyn_info(char *buf, int size)
95{
96 int r;
97
98 r = snprintf(buf, size, "%u %u",
99 nmi_wait_count,
100 atomic_read(&nmi_update_count));
101 return r;
102}
103
104static void ftrace_mod_code(void)
105{
106 /*
107 * Yes, more than one CPU process can be writing to mod_code_status.
108 * (and the code itself)
109 * But if one were to fail, then they all should, and if one were
110 * to succeed, then they all should.
111 */
112 mod_code_status = probe_kernel_write(mod_code_ip, mod_code_newcode,
113 MCOUNT_INSN_SIZE);
114}
115
116void ftrace_nmi_enter(void)
117{
118 atomic_inc(&in_nmi);
119 /* Must have in_nmi seen before reading write flag */
120 smp_mb();
121 if (mod_code_write) {
122 ftrace_mod_code();
123 atomic_inc(&nmi_update_count);
124 }
125}
126
127void ftrace_nmi_exit(void)
128{
129 /* Finish all executions before clearing in_nmi */
130 smp_wmb();
131 atomic_dec(&in_nmi);
132}
133
134static void wait_for_nmi(void)
135{
136 int waited = 0;
137
138 while (atomic_read(&in_nmi)) {
139 waited = 1;
140 cpu_relax();
141 }
142
143 if (waited)
144 nmi_wait_count++;
145}
146
147static int
148do_ftrace_mod_code(unsigned long ip, void *new_code)
149{
150 mod_code_ip = (void *)ip;
151 mod_code_newcode = new_code;
152
153 /* The buffers need to be visible before we let NMIs write them */
154 smp_wmb();
155
156 mod_code_write = 1;
157
158 /* Make sure write bit is visible before we wait on NMIs */
159 smp_mb();
160
161 wait_for_nmi();
162
163 /* Make sure all running NMIs have finished before we write the code */
164 smp_mb();
165
166 ftrace_mod_code();
167
168 /* Make sure the write happens before clearing the bit */
169 smp_wmb();
170
171 mod_code_write = 0;
172
173 /* make sure NMIs see the cleared bit */
174 smp_mb();
175
176 wait_for_nmi();
177
178 return mod_code_status;
179}
180
181
182
183
184static unsigned char ftrace_nop[MCOUNT_INSN_SIZE];
185
186static unsigned char *ftrace_nop_replace(void)
187{
188 return ftrace_nop;
189}
190
191static int
60ftrace_modify_code(unsigned long ip, unsigned char *old_code, 192ftrace_modify_code(unsigned long ip, unsigned char *old_code,
61 unsigned char *new_code) 193 unsigned char *new_code)
62{ 194{
@@ -81,7 +213,7 @@ ftrace_modify_code(unsigned long ip, unsigned char *old_code,
81 return -EINVAL; 213 return -EINVAL;
82 214
83 /* replace the text with the new text */ 215 /* replace the text with the new text */
84 if (probe_kernel_write((void *)ip, new_code, MCOUNT_INSN_SIZE)) 216 if (do_ftrace_mod_code(ip, new_code))
85 return -EPERM; 217 return -EPERM;
86 218
87 sync_core(); 219 sync_core();
@@ -89,6 +221,29 @@ ftrace_modify_code(unsigned long ip, unsigned char *old_code,
89 return 0; 221 return 0;
90} 222}
91 223
224int ftrace_make_nop(struct module *mod,
225 struct dyn_ftrace *rec, unsigned long addr)
226{
227 unsigned char *new, *old;
228 unsigned long ip = rec->ip;
229
230 old = ftrace_call_replace(ip, addr);
231 new = ftrace_nop_replace();
232
233 return ftrace_modify_code(rec->ip, old, new);
234}
235
236int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
237{
238 unsigned char *new, *old;
239 unsigned long ip = rec->ip;
240
241 old = ftrace_nop_replace();
242 new = ftrace_call_replace(ip, addr);
243
244 return ftrace_modify_code(rec->ip, old, new);
245}
246
92int ftrace_update_ftrace_func(ftrace_func_t func) 247int ftrace_update_ftrace_func(ftrace_func_t func)
93{ 248{
94 unsigned long ip = (unsigned long)(&ftrace_call); 249 unsigned long ip = (unsigned long)(&ftrace_call);
@@ -165,3 +320,218 @@ int __init ftrace_dyn_arch_init(void *data)
165 320
166 return 0; 321 return 0;
167} 322}
323#endif
324
325#ifdef CONFIG_FUNCTION_GRAPH_TRACER
326
327#ifdef CONFIG_DYNAMIC_FTRACE
328extern void ftrace_graph_call(void);
329
330static int ftrace_mod_jmp(unsigned long ip,
331 int old_offset, int new_offset)
332{
333 unsigned char code[MCOUNT_INSN_SIZE];
334
335 if (probe_kernel_read(code, (void *)ip, MCOUNT_INSN_SIZE))
336 return -EFAULT;
337
338 if (code[0] != 0xe9 || old_offset != *(int *)(&code[1]))
339 return -EINVAL;
340
341 *(int *)(&code[1]) = new_offset;
342
343 if (do_ftrace_mod_code(ip, &code))
344 return -EPERM;
345
346 return 0;
347}
348
349int ftrace_enable_ftrace_graph_caller(void)
350{
351 unsigned long ip = (unsigned long)(&ftrace_graph_call);
352 int old_offset, new_offset;
353
354 old_offset = (unsigned long)(&ftrace_stub) - (ip + MCOUNT_INSN_SIZE);
355 new_offset = (unsigned long)(&ftrace_graph_caller) - (ip + MCOUNT_INSN_SIZE);
356
357 return ftrace_mod_jmp(ip, old_offset, new_offset);
358}
359
360int ftrace_disable_ftrace_graph_caller(void)
361{
362 unsigned long ip = (unsigned long)(&ftrace_graph_call);
363 int old_offset, new_offset;
364
365 old_offset = (unsigned long)(&ftrace_graph_caller) - (ip + MCOUNT_INSN_SIZE);
366 new_offset = (unsigned long)(&ftrace_stub) - (ip + MCOUNT_INSN_SIZE);
367
368 return ftrace_mod_jmp(ip, old_offset, new_offset);
369}
370
371#else /* CONFIG_DYNAMIC_FTRACE */
372
373/*
374 * These functions are picked from those used on
375 * this page for dynamic ftrace. They have been
376 * simplified to ignore all traces in NMI context.
377 */
378static atomic_t in_nmi;
379
380void ftrace_nmi_enter(void)
381{
382 atomic_inc(&in_nmi);
383}
384
385void ftrace_nmi_exit(void)
386{
387 atomic_dec(&in_nmi);
388}
389
390#endif /* !CONFIG_DYNAMIC_FTRACE */
391
392/* Add a function return address to the trace stack on thread info.*/
393static int push_return_trace(unsigned long ret, unsigned long long time,
394 unsigned long func, int *depth)
395{
396 int index;
397
398 if (!current->ret_stack)
399 return -EBUSY;
400
401 /* The return trace stack is full */
402 if (current->curr_ret_stack == FTRACE_RETFUNC_DEPTH - 1) {
403 atomic_inc(&current->trace_overrun);
404 return -EBUSY;
405 }
406
407 index = ++current->curr_ret_stack;
408 barrier();
409 current->ret_stack[index].ret = ret;
410 current->ret_stack[index].func = func;
411 current->ret_stack[index].calltime = time;
412 *depth = index;
413
414 return 0;
415}
416
417/* Retrieve a function return address to the trace stack on thread info.*/
418static void pop_return_trace(struct ftrace_graph_ret *trace, unsigned long *ret)
419{
420 int index;
421
422 index = current->curr_ret_stack;
423
424 if (unlikely(index < 0)) {
425 ftrace_graph_stop();
426 WARN_ON(1);
427 /* Might as well panic, otherwise we have no where to go */
428 *ret = (unsigned long)panic;
429 return;
430 }
431
432 *ret = current->ret_stack[index].ret;
433 trace->func = current->ret_stack[index].func;
434 trace->calltime = current->ret_stack[index].calltime;
435 trace->overrun = atomic_read(&current->trace_overrun);
436 trace->depth = index;
437 barrier();
438 current->curr_ret_stack--;
439
440}
441
442/*
443 * Send the trace to the ring-buffer.
444 * @return the original return address.
445 */
446unsigned long ftrace_return_to_handler(void)
447{
448 struct ftrace_graph_ret trace;
449 unsigned long ret;
450
451 pop_return_trace(&trace, &ret);
452 trace.rettime = cpu_clock(raw_smp_processor_id());
453 ftrace_graph_return(&trace);
454
455 if (unlikely(!ret)) {
456 ftrace_graph_stop();
457 WARN_ON(1);
458 /* Might as well panic. What else to do? */
459 ret = (unsigned long)panic;
460 }
461
462 return ret;
463}
464
465/*
466 * Hook the return address and push it in the stack of return addrs
467 * in current thread info.
468 */
469void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
470{
471 unsigned long old;
472 unsigned long long calltime;
473 int faulted;
474 struct ftrace_graph_ent trace;
475 unsigned long return_hooker = (unsigned long)
476 &return_to_handler;
477
478 /* Nmi's are currently unsupported */
479 if (unlikely(atomic_read(&in_nmi)))
480 return;
481
482 if (unlikely(atomic_read(&current->tracing_graph_pause)))
483 return;
484
485 /*
486 * Protect against fault, even if it shouldn't
487 * happen. This tool is too much intrusive to
488 * ignore such a protection.
489 */
490 asm volatile(
491 "1: " _ASM_MOV " (%[parent_old]), %[old]\n"
492 "2: " _ASM_MOV " %[return_hooker], (%[parent_replaced])\n"
493 " movl $0, %[faulted]\n"
494
495 ".section .fixup, \"ax\"\n"
496 "3: movl $1, %[faulted]\n"
497 ".previous\n"
498
499 _ASM_EXTABLE(1b, 3b)
500 _ASM_EXTABLE(2b, 3b)
501
502 : [parent_replaced] "=r" (parent), [old] "=r" (old),
503 [faulted] "=r" (faulted)
504 : [parent_old] "0" (parent), [return_hooker] "r" (return_hooker)
505 : "memory"
506 );
507
508 if (unlikely(faulted)) {
509 ftrace_graph_stop();
510 WARN_ON(1);
511 return;
512 }
513
514 if (unlikely(!__kernel_text_address(old))) {
515 ftrace_graph_stop();
516 *parent = old;
517 WARN_ON(1);
518 return;
519 }
520
521 calltime = cpu_clock(raw_smp_processor_id());
522
523 if (push_return_trace(old, calltime,
524 self_addr, &trace.depth) == -EBUSY) {
525 *parent = old;
526 return;
527 }
528
529 trace.func = self_addr;
530
531 /* Only trace if the calling function expects to */
532 if (!ftrace_graph_entry(&trace)) {
533 current->curr_ret_stack--;
534 *parent = old;
535 }
536}
537#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
diff --git a/arch/x86/kernel/genapic_64.c b/arch/x86/kernel/genapic_64.c
index 6c9bfc9e1e95..2bced78b0b8e 100644
--- a/arch/x86/kernel/genapic_64.c
+++ b/arch/x86/kernel/genapic_64.c
@@ -21,6 +21,7 @@
21#include <asm/smp.h> 21#include <asm/smp.h>
22#include <asm/ipi.h> 22#include <asm/ipi.h>
23#include <asm/genapic.h> 23#include <asm/genapic.h>
24#include <asm/setup.h>
24 25
25extern struct genapic apic_flat; 26extern struct genapic apic_flat;
26extern struct genapic apic_physflat; 27extern struct genapic apic_physflat;
@@ -53,6 +54,9 @@ void __init setup_apic_routing(void)
53 genapic = &apic_physflat; 54 genapic = &apic_physflat;
54 printk(KERN_INFO "Setting APIC routing to %s\n", genapic->name); 55 printk(KERN_INFO "Setting APIC routing to %s\n", genapic->name);
55 } 56 }
57
58 if (x86_quirks->update_genapic)
59 x86_quirks->update_genapic();
56} 60}
57 61
58/* Same for both flat and physical. */ 62/* Same for both flat and physical. */
diff --git a/arch/x86/kernel/genapic_flat_64.c b/arch/x86/kernel/genapic_flat_64.c
index c0262791bda4..34185488e4fb 100644
--- a/arch/x86/kernel/genapic_flat_64.c
+++ b/arch/x86/kernel/genapic_flat_64.c
@@ -30,12 +30,12 @@ static int flat_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
30 return 1; 30 return 1;
31} 31}
32 32
33static cpumask_t flat_target_cpus(void) 33static const struct cpumask *flat_target_cpus(void)
34{ 34{
35 return cpu_online_map; 35 return cpu_online_mask;
36} 36}
37 37
38static cpumask_t flat_vector_allocation_domain(int cpu) 38static void flat_vector_allocation_domain(int cpu, struct cpumask *retmask)
39{ 39{
40 /* Careful. Some cpus do not strictly honor the set of cpus 40 /* Careful. Some cpus do not strictly honor the set of cpus
41 * specified in the interrupt destination when using lowest 41 * specified in the interrupt destination when using lowest
@@ -45,8 +45,8 @@ static cpumask_t flat_vector_allocation_domain(int cpu)
45 * deliver interrupts to the wrong hyperthread when only one 45 * deliver interrupts to the wrong hyperthread when only one
46 * hyperthread was specified in the interrupt desitination. 46 * hyperthread was specified in the interrupt desitination.
47 */ 47 */
48 cpumask_t domain = { { [0] = APIC_ALL_CPUS, } }; 48 cpumask_clear(retmask);
49 return domain; 49 cpumask_bits(retmask)[0] = APIC_ALL_CPUS;
50} 50}
51 51
52/* 52/*
@@ -69,9 +69,8 @@ static void flat_init_apic_ldr(void)
69 apic_write(APIC_LDR, val); 69 apic_write(APIC_LDR, val);
70} 70}
71 71
72static void flat_send_IPI_mask(cpumask_t cpumask, int vector) 72static inline void _flat_send_IPI_mask(unsigned long mask, int vector)
73{ 73{
74 unsigned long mask = cpus_addr(cpumask)[0];
75 unsigned long flags; 74 unsigned long flags;
76 75
77 local_irq_save(flags); 76 local_irq_save(flags);
@@ -79,20 +78,41 @@ static void flat_send_IPI_mask(cpumask_t cpumask, int vector)
79 local_irq_restore(flags); 78 local_irq_restore(flags);
80} 79}
81 80
81static void flat_send_IPI_mask(const struct cpumask *cpumask, int vector)
82{
83 unsigned long mask = cpumask_bits(cpumask)[0];
84
85 _flat_send_IPI_mask(mask, vector);
86}
87
88static void flat_send_IPI_mask_allbutself(const struct cpumask *cpumask,
89 int vector)
90{
91 unsigned long mask = cpumask_bits(cpumask)[0];
92 int cpu = smp_processor_id();
93
94 if (cpu < BITS_PER_LONG)
95 clear_bit(cpu, &mask);
96 _flat_send_IPI_mask(mask, vector);
97}
98
82static void flat_send_IPI_allbutself(int vector) 99static void flat_send_IPI_allbutself(int vector)
83{ 100{
101 int cpu = smp_processor_id();
84#ifdef CONFIG_HOTPLUG_CPU 102#ifdef CONFIG_HOTPLUG_CPU
85 int hotplug = 1; 103 int hotplug = 1;
86#else 104#else
87 int hotplug = 0; 105 int hotplug = 0;
88#endif 106#endif
89 if (hotplug || vector == NMI_VECTOR) { 107 if (hotplug || vector == NMI_VECTOR) {
90 cpumask_t allbutme = cpu_online_map; 108 if (!cpumask_equal(cpu_online_mask, cpumask_of(cpu))) {
109 unsigned long mask = cpumask_bits(cpu_online_mask)[0];
91 110
92 cpu_clear(smp_processor_id(), allbutme); 111 if (cpu < BITS_PER_LONG)
112 clear_bit(cpu, &mask);
93 113
94 if (!cpus_empty(allbutme)) 114 _flat_send_IPI_mask(mask, vector);
95 flat_send_IPI_mask(allbutme, vector); 115 }
96 } else if (num_online_cpus() > 1) { 116 } else if (num_online_cpus() > 1) {
97 __send_IPI_shortcut(APIC_DEST_ALLBUT, vector,APIC_DEST_LOGICAL); 117 __send_IPI_shortcut(APIC_DEST_ALLBUT, vector,APIC_DEST_LOGICAL);
98 } 118 }
@@ -101,7 +121,7 @@ static void flat_send_IPI_allbutself(int vector)
101static void flat_send_IPI_all(int vector) 121static void flat_send_IPI_all(int vector)
102{ 122{
103 if (vector == NMI_VECTOR) 123 if (vector == NMI_VECTOR)
104 flat_send_IPI_mask(cpu_online_map, vector); 124 flat_send_IPI_mask(cpu_online_mask, vector);
105 else 125 else
106 __send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL); 126 __send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL);
107} 127}
@@ -135,9 +155,18 @@ static int flat_apic_id_registered(void)
135 return physid_isset(read_xapic_id(), phys_cpu_present_map); 155 return physid_isset(read_xapic_id(), phys_cpu_present_map);
136} 156}
137 157
138static unsigned int flat_cpu_mask_to_apicid(cpumask_t cpumask) 158static unsigned int flat_cpu_mask_to_apicid(const struct cpumask *cpumask)
159{
160 return cpumask_bits(cpumask)[0] & APIC_ALL_CPUS;
161}
162
163static unsigned int flat_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
164 const struct cpumask *andmask)
139{ 165{
140 return cpus_addr(cpumask)[0] & APIC_ALL_CPUS; 166 unsigned long mask1 = cpumask_bits(cpumask)[0] & APIC_ALL_CPUS;
167 unsigned long mask2 = cpumask_bits(andmask)[0] & APIC_ALL_CPUS;
168
169 return mask1 & mask2;
141} 170}
142 171
143static unsigned int phys_pkg_id(int index_msb) 172static unsigned int phys_pkg_id(int index_msb)
@@ -157,8 +186,10 @@ struct genapic apic_flat = {
157 .send_IPI_all = flat_send_IPI_all, 186 .send_IPI_all = flat_send_IPI_all,
158 .send_IPI_allbutself = flat_send_IPI_allbutself, 187 .send_IPI_allbutself = flat_send_IPI_allbutself,
159 .send_IPI_mask = flat_send_IPI_mask, 188 .send_IPI_mask = flat_send_IPI_mask,
189 .send_IPI_mask_allbutself = flat_send_IPI_mask_allbutself,
160 .send_IPI_self = apic_send_IPI_self, 190 .send_IPI_self = apic_send_IPI_self,
161 .cpu_mask_to_apicid = flat_cpu_mask_to_apicid, 191 .cpu_mask_to_apicid = flat_cpu_mask_to_apicid,
192 .cpu_mask_to_apicid_and = flat_cpu_mask_to_apicid_and,
162 .phys_pkg_id = phys_pkg_id, 193 .phys_pkg_id = phys_pkg_id,
163 .get_apic_id = get_apic_id, 194 .get_apic_id = get_apic_id,
164 .set_apic_id = set_apic_id, 195 .set_apic_id = set_apic_id,
@@ -188,35 +219,39 @@ static int physflat_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
188 return 0; 219 return 0;
189} 220}
190 221
191static cpumask_t physflat_target_cpus(void) 222static const struct cpumask *physflat_target_cpus(void)
192{ 223{
193 return cpu_online_map; 224 return cpu_online_mask;
194} 225}
195 226
196static cpumask_t physflat_vector_allocation_domain(int cpu) 227static void physflat_vector_allocation_domain(int cpu, struct cpumask *retmask)
197{ 228{
198 return cpumask_of_cpu(cpu); 229 cpumask_clear(retmask);
230 cpumask_set_cpu(cpu, retmask);
199} 231}
200 232
201static void physflat_send_IPI_mask(cpumask_t cpumask, int vector) 233static void physflat_send_IPI_mask(const struct cpumask *cpumask, int vector)
202{ 234{
203 send_IPI_mask_sequence(cpumask, vector); 235 send_IPI_mask_sequence(cpumask, vector);
204} 236}
205 237
206static void physflat_send_IPI_allbutself(int vector) 238static void physflat_send_IPI_mask_allbutself(const struct cpumask *cpumask,
239 int vector)
207{ 240{
208 cpumask_t allbutme = cpu_online_map; 241 send_IPI_mask_allbutself(cpumask, vector);
242}
209 243
210 cpu_clear(smp_processor_id(), allbutme); 244static void physflat_send_IPI_allbutself(int vector)
211 physflat_send_IPI_mask(allbutme, vector); 245{
246 send_IPI_mask_allbutself(cpu_online_mask, vector);
212} 247}
213 248
214static void physflat_send_IPI_all(int vector) 249static void physflat_send_IPI_all(int vector)
215{ 250{
216 physflat_send_IPI_mask(cpu_online_map, vector); 251 physflat_send_IPI_mask(cpu_online_mask, vector);
217} 252}
218 253
219static unsigned int physflat_cpu_mask_to_apicid(cpumask_t cpumask) 254static unsigned int physflat_cpu_mask_to_apicid(const struct cpumask *cpumask)
220{ 255{
221 int cpu; 256 int cpu;
222 257
@@ -224,13 +259,31 @@ static unsigned int physflat_cpu_mask_to_apicid(cpumask_t cpumask)
224 * We're using fixed IRQ delivery, can only return one phys APIC ID. 259 * We're using fixed IRQ delivery, can only return one phys APIC ID.
225 * May as well be the first. 260 * May as well be the first.
226 */ 261 */
227 cpu = first_cpu(cpumask); 262 cpu = cpumask_first(cpumask);
228 if ((unsigned)cpu < nr_cpu_ids) 263 if ((unsigned)cpu < nr_cpu_ids)
229 return per_cpu(x86_cpu_to_apicid, cpu); 264 return per_cpu(x86_cpu_to_apicid, cpu);
230 else 265 else
231 return BAD_APICID; 266 return BAD_APICID;
232} 267}
233 268
269static unsigned int
270physflat_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
271 const struct cpumask *andmask)
272{
273 int cpu;
274
275 /*
276 * We're using fixed IRQ delivery, can only return one phys APIC ID.
277 * May as well be the first.
278 */
279 for_each_cpu_and(cpu, cpumask, andmask)
280 if (cpumask_test_cpu(cpu, cpu_online_mask))
281 break;
282 if (cpu < nr_cpu_ids)
283 return per_cpu(x86_cpu_to_apicid, cpu);
284 return BAD_APICID;
285}
286
234struct genapic apic_physflat = { 287struct genapic apic_physflat = {
235 .name = "physical flat", 288 .name = "physical flat",
236 .acpi_madt_oem_check = physflat_acpi_madt_oem_check, 289 .acpi_madt_oem_check = physflat_acpi_madt_oem_check,
@@ -243,8 +296,10 @@ struct genapic apic_physflat = {
243 .send_IPI_all = physflat_send_IPI_all, 296 .send_IPI_all = physflat_send_IPI_all,
244 .send_IPI_allbutself = physflat_send_IPI_allbutself, 297 .send_IPI_allbutself = physflat_send_IPI_allbutself,
245 .send_IPI_mask = physflat_send_IPI_mask, 298 .send_IPI_mask = physflat_send_IPI_mask,
299 .send_IPI_mask_allbutself = physflat_send_IPI_mask_allbutself,
246 .send_IPI_self = apic_send_IPI_self, 300 .send_IPI_self = apic_send_IPI_self,
247 .cpu_mask_to_apicid = physflat_cpu_mask_to_apicid, 301 .cpu_mask_to_apicid = physflat_cpu_mask_to_apicid,
302 .cpu_mask_to_apicid_and = physflat_cpu_mask_to_apicid_and,
248 .phys_pkg_id = phys_pkg_id, 303 .phys_pkg_id = phys_pkg_id,
249 .get_apic_id = get_apic_id, 304 .get_apic_id = get_apic_id,
250 .set_apic_id = set_apic_id, 305 .set_apic_id = set_apic_id,
diff --git a/arch/x86/kernel/genx2apic_cluster.c b/arch/x86/kernel/genx2apic_cluster.c
index f6a2c8eb48a6..6ce497cc372d 100644
--- a/arch/x86/kernel/genx2apic_cluster.c
+++ b/arch/x86/kernel/genx2apic_cluster.c
@@ -22,19 +22,18 @@ static int x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
22 22
23/* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */ 23/* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */
24 24
25static cpumask_t x2apic_target_cpus(void) 25static const struct cpumask *x2apic_target_cpus(void)
26{ 26{
27 return cpumask_of_cpu(0); 27 return cpumask_of(0);
28} 28}
29 29
30/* 30/*
31 * for now each logical cpu is in its own vector allocation domain. 31 * for now each logical cpu is in its own vector allocation domain.
32 */ 32 */
33static cpumask_t x2apic_vector_allocation_domain(int cpu) 33static void x2apic_vector_allocation_domain(int cpu, struct cpumask *retmask)
34{ 34{
35 cpumask_t domain = CPU_MASK_NONE; 35 cpumask_clear(retmask);
36 cpu_set(cpu, domain); 36 cpumask_set_cpu(cpu, retmask);
37 return domain;
38} 37}
39 38
40static void __x2apic_send_IPI_dest(unsigned int apicid, int vector, 39static void __x2apic_send_IPI_dest(unsigned int apicid, int vector,
@@ -56,32 +55,53 @@ static void __x2apic_send_IPI_dest(unsigned int apicid, int vector,
56 * at once. We have 16 cpu's in a cluster. This will minimize IPI register 55 * at once. We have 16 cpu's in a cluster. This will minimize IPI register
57 * writes. 56 * writes.
58 */ 57 */
59static void x2apic_send_IPI_mask(cpumask_t mask, int vector) 58static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector)
60{ 59{
61 unsigned long flags; 60 unsigned long flags;
62 unsigned long query_cpu; 61 unsigned long query_cpu;
63 62
64 local_irq_save(flags); 63 local_irq_save(flags);
65 for_each_cpu_mask(query_cpu, mask) { 64 for_each_cpu(query_cpu, mask)
66 __x2apic_send_IPI_dest(per_cpu(x86_cpu_to_logical_apicid, query_cpu), 65 __x2apic_send_IPI_dest(
67 vector, APIC_DEST_LOGICAL); 66 per_cpu(x86_cpu_to_logical_apicid, query_cpu),
68 } 67 vector, APIC_DEST_LOGICAL);
69 local_irq_restore(flags); 68 local_irq_restore(flags);
70} 69}
71 70
72static void x2apic_send_IPI_allbutself(int vector) 71static void x2apic_send_IPI_mask_allbutself(const struct cpumask *mask,
72 int vector)
73{ 73{
74 cpumask_t mask = cpu_online_map; 74 unsigned long flags;
75 unsigned long query_cpu;
76 unsigned long this_cpu = smp_processor_id();
75 77
76 cpu_clear(smp_processor_id(), mask); 78 local_irq_save(flags);
79 for_each_cpu(query_cpu, mask)
80 if (query_cpu != this_cpu)
81 __x2apic_send_IPI_dest(
82 per_cpu(x86_cpu_to_logical_apicid, query_cpu),
83 vector, APIC_DEST_LOGICAL);
84 local_irq_restore(flags);
85}
86
87static void x2apic_send_IPI_allbutself(int vector)
88{
89 unsigned long flags;
90 unsigned long query_cpu;
91 unsigned long this_cpu = smp_processor_id();
77 92
78 if (!cpus_empty(mask)) 93 local_irq_save(flags);
79 x2apic_send_IPI_mask(mask, vector); 94 for_each_online_cpu(query_cpu)
95 if (query_cpu != this_cpu)
96 __x2apic_send_IPI_dest(
97 per_cpu(x86_cpu_to_logical_apicid, query_cpu),
98 vector, APIC_DEST_LOGICAL);
99 local_irq_restore(flags);
80} 100}
81 101
82static void x2apic_send_IPI_all(int vector) 102static void x2apic_send_IPI_all(int vector)
83{ 103{
84 x2apic_send_IPI_mask(cpu_online_map, vector); 104 x2apic_send_IPI_mask(cpu_online_mask, vector);
85} 105}
86 106
87static int x2apic_apic_id_registered(void) 107static int x2apic_apic_id_registered(void)
@@ -89,21 +109,38 @@ static int x2apic_apic_id_registered(void)
89 return 1; 109 return 1;
90} 110}
91 111
92static unsigned int x2apic_cpu_mask_to_apicid(cpumask_t cpumask) 112static unsigned int x2apic_cpu_mask_to_apicid(const struct cpumask *cpumask)
93{ 113{
94 int cpu; 114 int cpu;
95 115
96 /* 116 /*
97 * We're using fixed IRQ delivery, can only return one phys APIC ID. 117 * We're using fixed IRQ delivery, can only return one logical APIC ID.
98 * May as well be the first. 118 * May as well be the first.
99 */ 119 */
100 cpu = first_cpu(cpumask); 120 cpu = cpumask_first(cpumask);
101 if ((unsigned)cpu < NR_CPUS) 121 if ((unsigned)cpu < nr_cpu_ids)
102 return per_cpu(x86_cpu_to_logical_apicid, cpu); 122 return per_cpu(x86_cpu_to_logical_apicid, cpu);
103 else 123 else
104 return BAD_APICID; 124 return BAD_APICID;
105} 125}
106 126
127static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
128 const struct cpumask *andmask)
129{
130 int cpu;
131
132 /*
133 * We're using fixed IRQ delivery, can only return one logical APIC ID.
134 * May as well be the first.
135 */
136 for_each_cpu_and(cpu, cpumask, andmask)
137 if (cpumask_test_cpu(cpu, cpu_online_mask))
138 break;
139 if (cpu < nr_cpu_ids)
140 return per_cpu(x86_cpu_to_logical_apicid, cpu);
141 return BAD_APICID;
142}
143
107static unsigned int get_apic_id(unsigned long x) 144static unsigned int get_apic_id(unsigned long x)
108{ 145{
109 unsigned int id; 146 unsigned int id;
@@ -150,8 +187,10 @@ struct genapic apic_x2apic_cluster = {
150 .send_IPI_all = x2apic_send_IPI_all, 187 .send_IPI_all = x2apic_send_IPI_all,
151 .send_IPI_allbutself = x2apic_send_IPI_allbutself, 188 .send_IPI_allbutself = x2apic_send_IPI_allbutself,
152 .send_IPI_mask = x2apic_send_IPI_mask, 189 .send_IPI_mask = x2apic_send_IPI_mask,
190 .send_IPI_mask_allbutself = x2apic_send_IPI_mask_allbutself,
153 .send_IPI_self = x2apic_send_IPI_self, 191 .send_IPI_self = x2apic_send_IPI_self,
154 .cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid, 192 .cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid,
193 .cpu_mask_to_apicid_and = x2apic_cpu_mask_to_apicid_and,
155 .phys_pkg_id = phys_pkg_id, 194 .phys_pkg_id = phys_pkg_id,
156 .get_apic_id = get_apic_id, 195 .get_apic_id = get_apic_id,
157 .set_apic_id = set_apic_id, 196 .set_apic_id = set_apic_id,
diff --git a/arch/x86/kernel/genx2apic_phys.c b/arch/x86/kernel/genx2apic_phys.c
index d042211768b7..21bcc0e098ba 100644
--- a/arch/x86/kernel/genx2apic_phys.c
+++ b/arch/x86/kernel/genx2apic_phys.c
@@ -29,16 +29,15 @@ static int x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
29 29
30/* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */ 30/* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */
31 31
32static cpumask_t x2apic_target_cpus(void) 32static const struct cpumask *x2apic_target_cpus(void)
33{ 33{
34 return cpumask_of_cpu(0); 34 return cpumask_of(0);
35} 35}
36 36
37static cpumask_t x2apic_vector_allocation_domain(int cpu) 37static void x2apic_vector_allocation_domain(int cpu, struct cpumask *retmask)
38{ 38{
39 cpumask_t domain = CPU_MASK_NONE; 39 cpumask_clear(retmask);
40 cpu_set(cpu, domain); 40 cpumask_set_cpu(cpu, retmask);
41 return domain;
42} 41}
43 42
44static void __x2apic_send_IPI_dest(unsigned int apicid, int vector, 43static void __x2apic_send_IPI_dest(unsigned int apicid, int vector,
@@ -54,32 +53,54 @@ static void __x2apic_send_IPI_dest(unsigned int apicid, int vector,
54 x2apic_icr_write(cfg, apicid); 53 x2apic_icr_write(cfg, apicid);
55} 54}
56 55
57static void x2apic_send_IPI_mask(cpumask_t mask, int vector) 56static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector)
58{ 57{
59 unsigned long flags; 58 unsigned long flags;
60 unsigned long query_cpu; 59 unsigned long query_cpu;
61 60
62 local_irq_save(flags); 61 local_irq_save(flags);
63 for_each_cpu_mask(query_cpu, mask) { 62 for_each_cpu(query_cpu, mask) {
64 __x2apic_send_IPI_dest(per_cpu(x86_cpu_to_apicid, query_cpu), 63 __x2apic_send_IPI_dest(per_cpu(x86_cpu_to_apicid, query_cpu),
65 vector, APIC_DEST_PHYSICAL); 64 vector, APIC_DEST_PHYSICAL);
66 } 65 }
67 local_irq_restore(flags); 66 local_irq_restore(flags);
68} 67}
69 68
70static void x2apic_send_IPI_allbutself(int vector) 69static void x2apic_send_IPI_mask_allbutself(const struct cpumask *mask,
70 int vector)
71{ 71{
72 cpumask_t mask = cpu_online_map; 72 unsigned long flags;
73 unsigned long query_cpu;
74 unsigned long this_cpu = smp_processor_id();
75
76 local_irq_save(flags);
77 for_each_cpu(query_cpu, mask) {
78 if (query_cpu != this_cpu)
79 __x2apic_send_IPI_dest(
80 per_cpu(x86_cpu_to_apicid, query_cpu),
81 vector, APIC_DEST_PHYSICAL);
82 }
83 local_irq_restore(flags);
84}
73 85
74 cpu_clear(smp_processor_id(), mask); 86static void x2apic_send_IPI_allbutself(int vector)
87{
88 unsigned long flags;
89 unsigned long query_cpu;
90 unsigned long this_cpu = smp_processor_id();
75 91
76 if (!cpus_empty(mask)) 92 local_irq_save(flags);
77 x2apic_send_IPI_mask(mask, vector); 93 for_each_online_cpu(query_cpu)
94 if (query_cpu != this_cpu)
95 __x2apic_send_IPI_dest(
96 per_cpu(x86_cpu_to_apicid, query_cpu),
97 vector, APIC_DEST_PHYSICAL);
98 local_irq_restore(flags);
78} 99}
79 100
80static void x2apic_send_IPI_all(int vector) 101static void x2apic_send_IPI_all(int vector)
81{ 102{
82 x2apic_send_IPI_mask(cpu_online_map, vector); 103 x2apic_send_IPI_mask(cpu_online_mask, vector);
83} 104}
84 105
85static int x2apic_apic_id_registered(void) 106static int x2apic_apic_id_registered(void)
@@ -87,7 +108,7 @@ static int x2apic_apic_id_registered(void)
87 return 1; 108 return 1;
88} 109}
89 110
90static unsigned int x2apic_cpu_mask_to_apicid(cpumask_t cpumask) 111static unsigned int x2apic_cpu_mask_to_apicid(const struct cpumask *cpumask)
91{ 112{
92 int cpu; 113 int cpu;
93 114
@@ -95,13 +116,30 @@ static unsigned int x2apic_cpu_mask_to_apicid(cpumask_t cpumask)
95 * We're using fixed IRQ delivery, can only return one phys APIC ID. 116 * We're using fixed IRQ delivery, can only return one phys APIC ID.
96 * May as well be the first. 117 * May as well be the first.
97 */ 118 */
98 cpu = first_cpu(cpumask); 119 cpu = cpumask_first(cpumask);
99 if ((unsigned)cpu < NR_CPUS) 120 if ((unsigned)cpu < nr_cpu_ids)
100 return per_cpu(x86_cpu_to_apicid, cpu); 121 return per_cpu(x86_cpu_to_apicid, cpu);
101 else 122 else
102 return BAD_APICID; 123 return BAD_APICID;
103} 124}
104 125
126static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
127 const struct cpumask *andmask)
128{
129 int cpu;
130
131 /*
132 * We're using fixed IRQ delivery, can only return one phys APIC ID.
133 * May as well be the first.
134 */
135 for_each_cpu_and(cpu, cpumask, andmask)
136 if (cpumask_test_cpu(cpu, cpu_online_mask))
137 break;
138 if (cpu < nr_cpu_ids)
139 return per_cpu(x86_cpu_to_apicid, cpu);
140 return BAD_APICID;
141}
142
105static unsigned int get_apic_id(unsigned long x) 143static unsigned int get_apic_id(unsigned long x)
106{ 144{
107 unsigned int id; 145 unsigned int id;
@@ -123,12 +161,12 @@ static unsigned int phys_pkg_id(int index_msb)
123 return current_cpu_data.initial_apicid >> index_msb; 161 return current_cpu_data.initial_apicid >> index_msb;
124} 162}
125 163
126void x2apic_send_IPI_self(int vector) 164static void x2apic_send_IPI_self(int vector)
127{ 165{
128 apic_write(APIC_SELF_IPI, vector); 166 apic_write(APIC_SELF_IPI, vector);
129} 167}
130 168
131void init_x2apic_ldr(void) 169static void init_x2apic_ldr(void)
132{ 170{
133 return; 171 return;
134} 172}
@@ -145,8 +183,10 @@ struct genapic apic_x2apic_phys = {
145 .send_IPI_all = x2apic_send_IPI_all, 183 .send_IPI_all = x2apic_send_IPI_all,
146 .send_IPI_allbutself = x2apic_send_IPI_allbutself, 184 .send_IPI_allbutself = x2apic_send_IPI_allbutself,
147 .send_IPI_mask = x2apic_send_IPI_mask, 185 .send_IPI_mask = x2apic_send_IPI_mask,
186 .send_IPI_mask_allbutself = x2apic_send_IPI_mask_allbutself,
148 .send_IPI_self = x2apic_send_IPI_self, 187 .send_IPI_self = x2apic_send_IPI_self,
149 .cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid, 188 .cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid,
189 .cpu_mask_to_apicid_and = x2apic_cpu_mask_to_apicid_and,
150 .phys_pkg_id = phys_pkg_id, 190 .phys_pkg_id = phys_pkg_id,
151 .get_apic_id = get_apic_id, 191 .get_apic_id = get_apic_id,
152 .set_apic_id = set_apic_id, 192 .set_apic_id = set_apic_id,
diff --git a/arch/x86/kernel/genx2apic_uv_x.c b/arch/x86/kernel/genx2apic_uv_x.c
index 2c7dbdb98278..b193e082f6ce 100644
--- a/arch/x86/kernel/genx2apic_uv_x.c
+++ b/arch/x86/kernel/genx2apic_uv_x.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/threads.h> 12#include <linux/threads.h>
13#include <linux/cpu.h>
13#include <linux/cpumask.h> 14#include <linux/cpumask.h>
14#include <linux/string.h> 15#include <linux/string.h>
15#include <linux/ctype.h> 16#include <linux/ctype.h>
@@ -17,6 +18,9 @@
17#include <linux/sched.h> 18#include <linux/sched.h>
18#include <linux/module.h> 19#include <linux/module.h>
19#include <linux/hardirq.h> 20#include <linux/hardirq.h>
21#include <linux/timer.h>
22#include <linux/proc_fs.h>
23#include <asm/current.h>
20#include <asm/smp.h> 24#include <asm/smp.h>
21#include <asm/ipi.h> 25#include <asm/ipi.h>
22#include <asm/genapic.h> 26#include <asm/genapic.h>
@@ -75,16 +79,15 @@ EXPORT_SYMBOL(sn_rtc_cycles_per_second);
75 79
76/* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */ 80/* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */
77 81
78static cpumask_t uv_target_cpus(void) 82static const struct cpumask *uv_target_cpus(void)
79{ 83{
80 return cpumask_of_cpu(0); 84 return cpumask_of(0);
81} 85}
82 86
83static cpumask_t uv_vector_allocation_domain(int cpu) 87static void uv_vector_allocation_domain(int cpu, struct cpumask *retmask)
84{ 88{
85 cpumask_t domain = CPU_MASK_NONE; 89 cpumask_clear(retmask);
86 cpu_set(cpu, domain); 90 cpumask_set_cpu(cpu, retmask);
87 return domain;
88} 91}
89 92
90int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip) 93int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip)
@@ -123,28 +126,37 @@ static void uv_send_IPI_one(int cpu, int vector)
123 uv_write_global_mmr64(pnode, UVH_IPI_INT, val); 126 uv_write_global_mmr64(pnode, UVH_IPI_INT, val);
124} 127}
125 128
126static void uv_send_IPI_mask(cpumask_t mask, int vector) 129static void uv_send_IPI_mask(const struct cpumask *mask, int vector)
127{ 130{
128 unsigned int cpu; 131 unsigned int cpu;
129 132
130 for_each_possible_cpu(cpu) 133 for_each_cpu(cpu, mask)
131 if (cpu_isset(cpu, mask)) 134 uv_send_IPI_one(cpu, vector);
135}
136
137static void uv_send_IPI_mask_allbutself(const struct cpumask *mask, int vector)
138{
139 unsigned int cpu;
140 unsigned int this_cpu = smp_processor_id();
141
142 for_each_cpu(cpu, mask)
143 if (cpu != this_cpu)
132 uv_send_IPI_one(cpu, vector); 144 uv_send_IPI_one(cpu, vector);
133} 145}
134 146
135static void uv_send_IPI_allbutself(int vector) 147static void uv_send_IPI_allbutself(int vector)
136{ 148{
137 cpumask_t mask = cpu_online_map; 149 unsigned int cpu;
138 150 unsigned int this_cpu = smp_processor_id();
139 cpu_clear(smp_processor_id(), mask);
140 151
141 if (!cpus_empty(mask)) 152 for_each_online_cpu(cpu)
142 uv_send_IPI_mask(mask, vector); 153 if (cpu != this_cpu)
154 uv_send_IPI_one(cpu, vector);
143} 155}
144 156
145static void uv_send_IPI_all(int vector) 157static void uv_send_IPI_all(int vector)
146{ 158{
147 uv_send_IPI_mask(cpu_online_map, vector); 159 uv_send_IPI_mask(cpu_online_mask, vector);
148} 160}
149 161
150static int uv_apic_id_registered(void) 162static int uv_apic_id_registered(void)
@@ -156,7 +168,7 @@ static void uv_init_apic_ldr(void)
156{ 168{
157} 169}
158 170
159static unsigned int uv_cpu_mask_to_apicid(cpumask_t cpumask) 171static unsigned int uv_cpu_mask_to_apicid(const struct cpumask *cpumask)
160{ 172{
161 int cpu; 173 int cpu;
162 174
@@ -164,13 +176,30 @@ static unsigned int uv_cpu_mask_to_apicid(cpumask_t cpumask)
164 * We're using fixed IRQ delivery, can only return one phys APIC ID. 176 * We're using fixed IRQ delivery, can only return one phys APIC ID.
165 * May as well be the first. 177 * May as well be the first.
166 */ 178 */
167 cpu = first_cpu(cpumask); 179 cpu = cpumask_first(cpumask);
168 if ((unsigned)cpu < nr_cpu_ids) 180 if ((unsigned)cpu < nr_cpu_ids)
169 return per_cpu(x86_cpu_to_apicid, cpu); 181 return per_cpu(x86_cpu_to_apicid, cpu);
170 else 182 else
171 return BAD_APICID; 183 return BAD_APICID;
172} 184}
173 185
186static unsigned int uv_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
187 const struct cpumask *andmask)
188{
189 int cpu;
190
191 /*
192 * We're using fixed IRQ delivery, can only return one phys APIC ID.
193 * May as well be the first.
194 */
195 for_each_cpu_and(cpu, cpumask, andmask)
196 if (cpumask_test_cpu(cpu, cpu_online_mask))
197 break;
198 if (cpu < nr_cpu_ids)
199 return per_cpu(x86_cpu_to_apicid, cpu);
200 return BAD_APICID;
201}
202
174static unsigned int get_apic_id(unsigned long x) 203static unsigned int get_apic_id(unsigned long x)
175{ 204{
176 unsigned int id; 205 unsigned int id;
@@ -218,8 +247,10 @@ struct genapic apic_x2apic_uv_x = {
218 .send_IPI_all = uv_send_IPI_all, 247 .send_IPI_all = uv_send_IPI_all,
219 .send_IPI_allbutself = uv_send_IPI_allbutself, 248 .send_IPI_allbutself = uv_send_IPI_allbutself,
220 .send_IPI_mask = uv_send_IPI_mask, 249 .send_IPI_mask = uv_send_IPI_mask,
250 .send_IPI_mask_allbutself = uv_send_IPI_mask_allbutself,
221 .send_IPI_self = uv_send_IPI_self, 251 .send_IPI_self = uv_send_IPI_self,
222 .cpu_mask_to_apicid = uv_cpu_mask_to_apicid, 252 .cpu_mask_to_apicid = uv_cpu_mask_to_apicid,
253 .cpu_mask_to_apicid_and = uv_cpu_mask_to_apicid_and,
223 .phys_pkg_id = phys_pkg_id, 254 .phys_pkg_id = phys_pkg_id,
224 .get_apic_id = get_apic_id, 255 .get_apic_id = get_apic_id,
225 .set_apic_id = set_apic_id, 256 .set_apic_id = set_apic_id,
@@ -356,6 +387,103 @@ static __init void uv_rtc_init(void)
356} 387}
357 388
358/* 389/*
390 * percpu heartbeat timer
391 */
392static void uv_heartbeat(unsigned long ignored)
393{
394 struct timer_list *timer = &uv_hub_info->scir.timer;
395 unsigned char bits = uv_hub_info->scir.state;
396
397 /* flip heartbeat bit */
398 bits ^= SCIR_CPU_HEARTBEAT;
399
400 /* is this cpu idle? */
401 if (idle_cpu(raw_smp_processor_id()))
402 bits &= ~SCIR_CPU_ACTIVITY;
403 else
404 bits |= SCIR_CPU_ACTIVITY;
405
406 /* update system controller interface reg */
407 uv_set_scir_bits(bits);
408
409 /* enable next timer period */
410 mod_timer(timer, jiffies + SCIR_CPU_HB_INTERVAL);
411}
412
413static void __cpuinit uv_heartbeat_enable(int cpu)
414{
415 if (!uv_cpu_hub_info(cpu)->scir.enabled) {
416 struct timer_list *timer = &uv_cpu_hub_info(cpu)->scir.timer;
417
418 uv_set_cpu_scir_bits(cpu, SCIR_CPU_HEARTBEAT|SCIR_CPU_ACTIVITY);
419 setup_timer(timer, uv_heartbeat, cpu);
420 timer->expires = jiffies + SCIR_CPU_HB_INTERVAL;
421 add_timer_on(timer, cpu);
422 uv_cpu_hub_info(cpu)->scir.enabled = 1;
423 }
424
425 /* check boot cpu */
426 if (!uv_cpu_hub_info(0)->scir.enabled)
427 uv_heartbeat_enable(0);
428}
429
430#ifdef CONFIG_HOTPLUG_CPU
431static void __cpuinit uv_heartbeat_disable(int cpu)
432{
433 if (uv_cpu_hub_info(cpu)->scir.enabled) {
434 uv_cpu_hub_info(cpu)->scir.enabled = 0;
435 del_timer(&uv_cpu_hub_info(cpu)->scir.timer);
436 }
437 uv_set_cpu_scir_bits(cpu, 0xff);
438}
439
440/*
441 * cpu hotplug notifier
442 */
443static __cpuinit int uv_scir_cpu_notify(struct notifier_block *self,
444 unsigned long action, void *hcpu)
445{
446 long cpu = (long)hcpu;
447
448 switch (action) {
449 case CPU_ONLINE:
450 uv_heartbeat_enable(cpu);
451 break;
452 case CPU_DOWN_PREPARE:
453 uv_heartbeat_disable(cpu);
454 break;
455 default:
456 break;
457 }
458 return NOTIFY_OK;
459}
460
461static __init void uv_scir_register_cpu_notifier(void)
462{
463 hotcpu_notifier(uv_scir_cpu_notify, 0);
464}
465
466#else /* !CONFIG_HOTPLUG_CPU */
467
468static __init void uv_scir_register_cpu_notifier(void)
469{
470}
471
472static __init int uv_init_heartbeat(void)
473{
474 int cpu;
475
476 if (is_uv_system())
477 for_each_online_cpu(cpu)
478 uv_heartbeat_enable(cpu);
479 return 0;
480}
481
482late_initcall(uv_init_heartbeat);
483
484#endif /* !CONFIG_HOTPLUG_CPU */
485
486/*
359 * Called on each cpu to initialize the per_cpu UV data area. 487 * Called on each cpu to initialize the per_cpu UV data area.
360 * ZZZ hotplug not supported yet 488 * ZZZ hotplug not supported yet
361 */ 489 */
@@ -428,7 +556,7 @@ void __init uv_system_init(void)
428 556
429 uv_bios_init(); 557 uv_bios_init();
430 uv_bios_get_sn_info(0, &uv_type, &sn_partition_id, 558 uv_bios_get_sn_info(0, &uv_type, &sn_partition_id,
431 &uv_coherency_id, &uv_region_size); 559 &sn_coherency_id, &sn_region_size);
432 uv_rtc_init(); 560 uv_rtc_init();
433 561
434 for_each_present_cpu(cpu) { 562 for_each_present_cpu(cpu) {
@@ -439,8 +567,7 @@ void __init uv_system_init(void)
439 uv_blade_info[blade].nr_possible_cpus++; 567 uv_blade_info[blade].nr_possible_cpus++;
440 568
441 uv_cpu_hub_info(cpu)->lowmem_remap_base = lowmem_redir_base; 569 uv_cpu_hub_info(cpu)->lowmem_remap_base = lowmem_redir_base;
442 uv_cpu_hub_info(cpu)->lowmem_remap_top = 570 uv_cpu_hub_info(cpu)->lowmem_remap_top = lowmem_redir_size;
443 lowmem_redir_base + lowmem_redir_size;
444 uv_cpu_hub_info(cpu)->m_val = m_val; 571 uv_cpu_hub_info(cpu)->m_val = m_val;
445 uv_cpu_hub_info(cpu)->n_val = m_val; 572 uv_cpu_hub_info(cpu)->n_val = m_val;
446 uv_cpu_hub_info(cpu)->numa_blade_id = blade; 573 uv_cpu_hub_info(cpu)->numa_blade_id = blade;
@@ -450,7 +577,8 @@ void __init uv_system_init(void)
450 uv_cpu_hub_info(cpu)->gpa_mask = (1 << (m_val + n_val)) - 1; 577 uv_cpu_hub_info(cpu)->gpa_mask = (1 << (m_val + n_val)) - 1;
451 uv_cpu_hub_info(cpu)->gnode_upper = gnode_upper; 578 uv_cpu_hub_info(cpu)->gnode_upper = gnode_upper;
452 uv_cpu_hub_info(cpu)->global_mmr_base = mmr_base; 579 uv_cpu_hub_info(cpu)->global_mmr_base = mmr_base;
453 uv_cpu_hub_info(cpu)->coherency_domain_number = uv_coherency_id; 580 uv_cpu_hub_info(cpu)->coherency_domain_number = sn_coherency_id;
581 uv_cpu_hub_info(cpu)->scir.offset = SCIR_LOCAL_MMR_BASE + lcpu;
454 uv_node_to_blade[nid] = blade; 582 uv_node_to_blade[nid] = blade;
455 uv_cpu_to_blade[cpu] = blade; 583 uv_cpu_to_blade[cpu] = blade;
456 max_pnode = max(pnode, max_pnode); 584 max_pnode = max(pnode, max_pnode);
@@ -467,4 +595,6 @@ void __init uv_system_init(void)
467 map_mmioh_high(max_pnode); 595 map_mmioh_high(max_pnode);
468 596
469 uv_cpu_init(); 597 uv_cpu_init();
598 uv_scir_register_cpu_notifier();
599 proc_mkdir("sgi_uv", NULL);
470} 600}
diff --git a/arch/x86/kernel/head.c b/arch/x86/kernel/head.c
index 1dcb0f13897e..3e66bd364a9d 100644
--- a/arch/x86/kernel/head.c
+++ b/arch/x86/kernel/head.c
@@ -35,7 +35,6 @@ void __init reserve_ebda_region(void)
35 35
36 /* start of EBDA area */ 36 /* start of EBDA area */
37 ebda_addr = get_bios_ebda(); 37 ebda_addr = get_bios_ebda();
38 printk(KERN_INFO "BIOS EBDA/lowmem at: %08x/%08x\n", ebda_addr, lowmem);
39 38
40 /* Fixup: bios puts an EBDA in the top 64K segment */ 39 /* Fixup: bios puts an EBDA in the top 64K segment */
41 /* of conventional memory, but does not adjust lowmem. */ 40 /* of conventional memory, but does not adjust lowmem. */
diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c
index fa1d25dd83e3..ac108d1fe182 100644
--- a/arch/x86/kernel/head32.c
+++ b/arch/x86/kernel/head32.c
@@ -12,9 +12,12 @@
12#include <asm/sections.h> 12#include <asm/sections.h>
13#include <asm/e820.h> 13#include <asm/e820.h>
14#include <asm/bios_ebda.h> 14#include <asm/bios_ebda.h>
15#include <asm/trampoline.h>
15 16
16void __init i386_start_kernel(void) 17void __init i386_start_kernel(void)
17{ 18{
19 reserve_trampoline_memory();
20
18 reserve_early(__pa_symbol(&_text), __pa_symbol(&_end), "TEXT DATA BSS"); 21 reserve_early(__pa_symbol(&_text), __pa_symbol(&_end), "TEXT DATA BSS");
19 22
20#ifdef CONFIG_BLK_DEV_INITRD 23#ifdef CONFIG_BLK_DEV_INITRD
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index d16084f90649..b9a4d8c4b935 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -24,9 +24,10 @@
24#include <asm/kdebug.h> 24#include <asm/kdebug.h>
25#include <asm/e820.h> 25#include <asm/e820.h>
26#include <asm/bios_ebda.h> 26#include <asm/bios_ebda.h>
27#include <asm/trampoline.h>
27 28
28/* boot cpu pda */ 29/* boot cpu pda */
29static struct x8664_pda _boot_cpu_pda __read_mostly; 30static struct x8664_pda _boot_cpu_pda;
30 31
31#ifdef CONFIG_SMP 32#ifdef CONFIG_SMP
32/* 33/*
@@ -120,6 +121,8 @@ void __init x86_64_start_reservations(char *real_mode_data)
120{ 121{
121 copy_bootdata(__va(real_mode_data)); 122 copy_bootdata(__va(real_mode_data));
122 123
124 reserve_trampoline_memory();
125
123 reserve_early(__pa_symbol(&_text), __pa_symbol(&_end), "TEXT DATA BSS"); 126 reserve_early(__pa_symbol(&_text), __pa_symbol(&_end), "TEXT DATA BSS");
124 127
125#ifdef CONFIG_BLK_DEV_INITRD 128#ifdef CONFIG_BLK_DEV_INITRD
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 067d8de913f6..cd759ad90690 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -33,7 +33,9 @@
33 * HPET address is set in acpi/boot.c, when an ACPI entry exists 33 * HPET address is set in acpi/boot.c, when an ACPI entry exists
34 */ 34 */
35unsigned long hpet_address; 35unsigned long hpet_address;
36unsigned long hpet_num_timers; 36#ifdef CONFIG_PCI_MSI
37static unsigned long hpet_num_timers;
38#endif
37static void __iomem *hpet_virt_address; 39static void __iomem *hpet_virt_address;
38 40
39struct hpet_dev { 41struct hpet_dev {
@@ -246,7 +248,7 @@ static void hpet_legacy_clockevent_register(void)
246 * Start hpet with the boot cpu mask and make it 248 * Start hpet with the boot cpu mask and make it
247 * global after the IO_APIC has been initialized. 249 * global after the IO_APIC has been initialized.
248 */ 250 */
249 hpet_clockevent.cpumask = cpumask_of_cpu(smp_processor_id()); 251 hpet_clockevent.cpumask = cpumask_of(smp_processor_id());
250 clockevents_register_device(&hpet_clockevent); 252 clockevents_register_device(&hpet_clockevent);
251 global_clock_event = &hpet_clockevent; 253 global_clock_event = &hpet_clockevent;
252 printk(KERN_DEBUG "hpet clockevent registered\n"); 254 printk(KERN_DEBUG "hpet clockevent registered\n");
@@ -301,7 +303,7 @@ static void hpet_set_mode(enum clock_event_mode mode,
301 struct hpet_dev *hdev = EVT_TO_HPET_DEV(evt); 303 struct hpet_dev *hdev = EVT_TO_HPET_DEV(evt);
302 hpet_setup_msi_irq(hdev->irq); 304 hpet_setup_msi_irq(hdev->irq);
303 disable_irq(hdev->irq); 305 disable_irq(hdev->irq);
304 irq_set_affinity(hdev->irq, cpumask_of_cpu(hdev->cpu)); 306 irq_set_affinity(hdev->irq, cpumask_of(hdev->cpu));
305 enable_irq(hdev->irq); 307 enable_irq(hdev->irq);
306 } 308 }
307 break; 309 break;
@@ -449,7 +451,7 @@ static int hpet_setup_irq(struct hpet_dev *dev)
449 return -1; 451 return -1;
450 452
451 disable_irq(dev->irq); 453 disable_irq(dev->irq);
452 irq_set_affinity(dev->irq, cpumask_of_cpu(dev->cpu)); 454 irq_set_affinity(dev->irq, cpumask_of(dev->cpu));
453 enable_irq(dev->irq); 455 enable_irq(dev->irq);
454 456
455 printk(KERN_DEBUG "hpet: %s irq %d for MSI\n", 457 printk(KERN_DEBUG "hpet: %s irq %d for MSI\n",
@@ -500,7 +502,7 @@ static void init_one_hpet_msi_clockevent(struct hpet_dev *hdev, int cpu)
500 /* 5 usec minimum reprogramming delta. */ 502 /* 5 usec minimum reprogramming delta. */
501 evt->min_delta_ns = 5000; 503 evt->min_delta_ns = 5000;
502 504
503 evt->cpumask = cpumask_of_cpu(hdev->cpu); 505 evt->cpumask = cpumask_of(hdev->cpu);
504 clockevents_register_device(evt); 506 clockevents_register_device(evt);
505} 507}
506 508
@@ -811,7 +813,7 @@ int __init hpet_enable(void)
811 813
812out_nohpet: 814out_nohpet:
813 hpet_clear_mapping(); 815 hpet_clear_mapping();
814 boot_hpet_disable = 1; 816 hpet_address = 0;
815 return 0; 817 return 0;
816} 818}
817 819
@@ -834,10 +836,11 @@ static __init int hpet_late_init(void)
834 836
835 hpet_address = force_hpet_address; 837 hpet_address = force_hpet_address;
836 hpet_enable(); 838 hpet_enable();
837 if (!hpet_virt_address)
838 return -ENODEV;
839 } 839 }
840 840
841 if (!hpet_virt_address)
842 return -ENODEV;
843
841 hpet_reserve_platform_timers(hpet_readl(HPET_ID)); 844 hpet_reserve_platform_timers(hpet_readl(HPET_ID));
842 845
843 for_each_online_cpu(cpu) { 846 for_each_online_cpu(cpu) {
diff --git a/arch/x86/kernel/i8253.c b/arch/x86/kernel/i8253.c
index c1b5e3ece1f2..10f92fb532f3 100644
--- a/arch/x86/kernel/i8253.c
+++ b/arch/x86/kernel/i8253.c
@@ -114,7 +114,7 @@ void __init setup_pit_timer(void)
114 * Start pit with the boot cpu mask and make it global after the 114 * Start pit with the boot cpu mask and make it global after the
115 * IO_APIC has been initialized. 115 * IO_APIC has been initialized.
116 */ 116 */
117 pit_clockevent.cpumask = cpumask_of_cpu(smp_processor_id()); 117 pit_clockevent.cpumask = cpumask_of(smp_processor_id());
118 pit_clockevent.mult = div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC, 118 pit_clockevent.mult = div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC,
119 pit_clockevent.shift); 119 pit_clockevent.shift);
120 pit_clockevent.max_delta_ns = 120 pit_clockevent.max_delta_ns =
diff --git a/arch/x86/kernel/init_task.c b/arch/x86/kernel/init_task.c
index a4f93b4120c1..df3bf269beab 100644
--- a/arch/x86/kernel/init_task.c
+++ b/arch/x86/kernel/init_task.c
@@ -10,11 +10,9 @@
10#include <asm/pgtable.h> 10#include <asm/pgtable.h>
11#include <asm/desc.h> 11#include <asm/desc.h>
12 12
13static struct fs_struct init_fs = INIT_FS;
14static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 13static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
15static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 14static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
16struct mm_struct init_mm = INIT_MM(init_mm); 15struct mm_struct init_mm = INIT_MM(init_mm);
17EXPORT_UNUSED_SYMBOL(init_mm); /* will be removed in 2.6.26 */
18 16
19/* 17/*
20 * Initial thread structure. 18 * Initial thread structure.
diff --git a/arch/x86/kernel/io_apic.c b/arch/x86/kernel/io_apic.c
index 9043251210fb..3639442aa7a4 100644
--- a/arch/x86/kernel/io_apic.c
+++ b/arch/x86/kernel/io_apic.c
@@ -108,93 +108,276 @@ static int __init parse_noapic(char *str)
108early_param("noapic", parse_noapic); 108early_param("noapic", parse_noapic);
109 109
110struct irq_pin_list; 110struct irq_pin_list;
111
112/*
113 * This is performance-critical, we want to do it O(1)
114 *
115 * the indexing order of this array favors 1:1 mappings
116 * between pins and IRQs.
117 */
118
119struct irq_pin_list {
120 int apic, pin;
121 struct irq_pin_list *next;
122};
123
124static struct irq_pin_list *get_one_free_irq_2_pin(int cpu)
125{
126 struct irq_pin_list *pin;
127 int node;
128
129 node = cpu_to_node(cpu);
130
131 pin = kzalloc_node(sizeof(*pin), GFP_ATOMIC, node);
132 printk(KERN_DEBUG " alloc irq_2_pin on cpu %d node %d\n", cpu, node);
133
134 return pin;
135}
136
111struct irq_cfg { 137struct irq_cfg {
112 unsigned int irq;
113 struct irq_pin_list *irq_2_pin; 138 struct irq_pin_list *irq_2_pin;
114 cpumask_t domain; 139 cpumask_var_t domain;
115 cpumask_t old_domain; 140 cpumask_var_t old_domain;
116 unsigned move_cleanup_count; 141 unsigned move_cleanup_count;
117 u8 vector; 142 u8 vector;
118 u8 move_in_progress : 1; 143 u8 move_in_progress : 1;
144#ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC
145 u8 move_desc_pending : 1;
146#endif
119}; 147};
120 148
121/* irq_cfg is indexed by the sum of all RTEs in all I/O APICs. */ 149/* irq_cfg is indexed by the sum of all RTEs in all I/O APICs. */
150#ifdef CONFIG_SPARSE_IRQ
151static struct irq_cfg irq_cfgx[] = {
152#else
122static struct irq_cfg irq_cfgx[NR_IRQS] = { 153static struct irq_cfg irq_cfgx[NR_IRQS] = {
123 [0] = { .irq = 0, .domain = CPU_MASK_ALL, .vector = IRQ0_VECTOR, }, 154#endif
124 [1] = { .irq = 1, .domain = CPU_MASK_ALL, .vector = IRQ1_VECTOR, }, 155 [0] = { .vector = IRQ0_VECTOR, },
125 [2] = { .irq = 2, .domain = CPU_MASK_ALL, .vector = IRQ2_VECTOR, }, 156 [1] = { .vector = IRQ1_VECTOR, },
126 [3] = { .irq = 3, .domain = CPU_MASK_ALL, .vector = IRQ3_VECTOR, }, 157 [2] = { .vector = IRQ2_VECTOR, },
127 [4] = { .irq = 4, .domain = CPU_MASK_ALL, .vector = IRQ4_VECTOR, }, 158 [3] = { .vector = IRQ3_VECTOR, },
128 [5] = { .irq = 5, .domain = CPU_MASK_ALL, .vector = IRQ5_VECTOR, }, 159 [4] = { .vector = IRQ4_VECTOR, },
129 [6] = { .irq = 6, .domain = CPU_MASK_ALL, .vector = IRQ6_VECTOR, }, 160 [5] = { .vector = IRQ5_VECTOR, },
130 [7] = { .irq = 7, .domain = CPU_MASK_ALL, .vector = IRQ7_VECTOR, }, 161 [6] = { .vector = IRQ6_VECTOR, },
131 [8] = { .irq = 8, .domain = CPU_MASK_ALL, .vector = IRQ8_VECTOR, }, 162 [7] = { .vector = IRQ7_VECTOR, },
132 [9] = { .irq = 9, .domain = CPU_MASK_ALL, .vector = IRQ9_VECTOR, }, 163 [8] = { .vector = IRQ8_VECTOR, },
133 [10] = { .irq = 10, .domain = CPU_MASK_ALL, .vector = IRQ10_VECTOR, }, 164 [9] = { .vector = IRQ9_VECTOR, },
134 [11] = { .irq = 11, .domain = CPU_MASK_ALL, .vector = IRQ11_VECTOR, }, 165 [10] = { .vector = IRQ10_VECTOR, },
135 [12] = { .irq = 12, .domain = CPU_MASK_ALL, .vector = IRQ12_VECTOR, }, 166 [11] = { .vector = IRQ11_VECTOR, },
136 [13] = { .irq = 13, .domain = CPU_MASK_ALL, .vector = IRQ13_VECTOR, }, 167 [12] = { .vector = IRQ12_VECTOR, },
137 [14] = { .irq = 14, .domain = CPU_MASK_ALL, .vector = IRQ14_VECTOR, }, 168 [13] = { .vector = IRQ13_VECTOR, },
138 [15] = { .irq = 15, .domain = CPU_MASK_ALL, .vector = IRQ15_VECTOR, }, 169 [14] = { .vector = IRQ14_VECTOR, },
170 [15] = { .vector = IRQ15_VECTOR, },
139}; 171};
140 172
141#define for_each_irq_cfg(irq, cfg) \ 173int __init arch_early_irq_init(void)
142 for (irq = 0, cfg = irq_cfgx; irq < nr_irqs; irq++, cfg++) 174{
175 struct irq_cfg *cfg;
176 struct irq_desc *desc;
177 int count;
178 int i;
179
180 cfg = irq_cfgx;
181 count = ARRAY_SIZE(irq_cfgx);
143 182
183 for (i = 0; i < count; i++) {
184 desc = irq_to_desc(i);
185 desc->chip_data = &cfg[i];
186 alloc_bootmem_cpumask_var(&cfg[i].domain);
187 alloc_bootmem_cpumask_var(&cfg[i].old_domain);
188 if (i < NR_IRQS_LEGACY)
189 cpumask_setall(cfg[i].domain);
190 }
191
192 return 0;
193}
194
195#ifdef CONFIG_SPARSE_IRQ
144static struct irq_cfg *irq_cfg(unsigned int irq) 196static struct irq_cfg *irq_cfg(unsigned int irq)
145{ 197{
146 return irq < nr_irqs ? irq_cfgx + irq : NULL; 198 struct irq_cfg *cfg = NULL;
199 struct irq_desc *desc;
200
201 desc = irq_to_desc(irq);
202 if (desc)
203 cfg = desc->chip_data;
204
205 return cfg;
147} 206}
148 207
149static struct irq_cfg *irq_cfg_alloc(unsigned int irq) 208static struct irq_cfg *get_one_free_irq_cfg(int cpu)
150{ 209{
151 return irq_cfg(irq); 210 struct irq_cfg *cfg;
211 int node;
212
213 node = cpu_to_node(cpu);
214
215 cfg = kzalloc_node(sizeof(*cfg), GFP_ATOMIC, node);
216 if (cfg) {
217 if (!alloc_cpumask_var_node(&cfg->domain, GFP_ATOMIC, node)) {
218 kfree(cfg);
219 cfg = NULL;
220 } else if (!alloc_cpumask_var_node(&cfg->old_domain,
221 GFP_ATOMIC, node)) {
222 free_cpumask_var(cfg->domain);
223 kfree(cfg);
224 cfg = NULL;
225 } else {
226 cpumask_clear(cfg->domain);
227 cpumask_clear(cfg->old_domain);
228 }
229 }
230 printk(KERN_DEBUG " alloc irq_cfg on cpu %d node %d\n", cpu, node);
231
232 return cfg;
152} 233}
153 234
154/* 235int arch_init_chip_data(struct irq_desc *desc, int cpu)
155 * Rough estimation of how many shared IRQs there are, can be changed 236{
156 * anytime. 237 struct irq_cfg *cfg;
157 */
158#define MAX_PLUS_SHARED_IRQS NR_IRQS
159#define PIN_MAP_SIZE (MAX_PLUS_SHARED_IRQS + NR_IRQS)
160 238
161/* 239 cfg = desc->chip_data;
162 * This is performance-critical, we want to do it O(1) 240 if (!cfg) {
163 * 241 desc->chip_data = get_one_free_irq_cfg(cpu);
164 * the indexing order of this array favors 1:1 mappings 242 if (!desc->chip_data) {
165 * between pins and IRQs. 243 printk(KERN_ERR "can not alloc irq_cfg\n");
166 */ 244 BUG_ON(1);
245 }
246 }
167 247
168struct irq_pin_list { 248 return 0;
169 int apic, pin; 249}
170 struct irq_pin_list *next;
171};
172 250
173static struct irq_pin_list irq_2_pin_head[PIN_MAP_SIZE]; 251#ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC
174static struct irq_pin_list *irq_2_pin_ptr;
175 252
176static void __init irq_2_pin_init(void) 253static void
254init_copy_irq_2_pin(struct irq_cfg *old_cfg, struct irq_cfg *cfg, int cpu)
177{ 255{
178 struct irq_pin_list *pin = irq_2_pin_head; 256 struct irq_pin_list *old_entry, *head, *tail, *entry;
179 int i; 257
258 cfg->irq_2_pin = NULL;
259 old_entry = old_cfg->irq_2_pin;
260 if (!old_entry)
261 return;
262
263 entry = get_one_free_irq_2_pin(cpu);
264 if (!entry)
265 return;
266
267 entry->apic = old_entry->apic;
268 entry->pin = old_entry->pin;
269 head = entry;
270 tail = entry;
271 old_entry = old_entry->next;
272 while (old_entry) {
273 entry = get_one_free_irq_2_pin(cpu);
274 if (!entry) {
275 entry = head;
276 while (entry) {
277 head = entry->next;
278 kfree(entry);
279 entry = head;
280 }
281 /* still use the old one */
282 return;
283 }
284 entry->apic = old_entry->apic;
285 entry->pin = old_entry->pin;
286 tail->next = entry;
287 tail = entry;
288 old_entry = old_entry->next;
289 }
180 290
181 for (i = 1; i < PIN_MAP_SIZE; i++) 291 tail->next = NULL;
182 pin[i-1].next = &pin[i]; 292 cfg->irq_2_pin = head;
293}
294
295static void free_irq_2_pin(struct irq_cfg *old_cfg, struct irq_cfg *cfg)
296{
297 struct irq_pin_list *entry, *next;
298
299 if (old_cfg->irq_2_pin == cfg->irq_2_pin)
300 return;
183 301
184 irq_2_pin_ptr = &pin[0]; 302 entry = old_cfg->irq_2_pin;
303
304 while (entry) {
305 next = entry->next;
306 kfree(entry);
307 entry = next;
308 }
309 old_cfg->irq_2_pin = NULL;
185} 310}
186 311
187static struct irq_pin_list *get_one_free_irq_2_pin(void) 312void arch_init_copy_chip_data(struct irq_desc *old_desc,
313 struct irq_desc *desc, int cpu)
188{ 314{
189 struct irq_pin_list *pin = irq_2_pin_ptr; 315 struct irq_cfg *cfg;
316 struct irq_cfg *old_cfg;
190 317
191 if (!pin) 318 cfg = get_one_free_irq_cfg(cpu);
192 panic("can not get more irq_2_pin\n");
193 319
194 irq_2_pin_ptr = pin->next; 320 if (!cfg)
195 pin->next = NULL; 321 return;
196 return pin; 322
323 desc->chip_data = cfg;
324
325 old_cfg = old_desc->chip_data;
326
327 memcpy(cfg, old_cfg, sizeof(struct irq_cfg));
328
329 init_copy_irq_2_pin(old_cfg, cfg, cpu);
330}
331
332static void free_irq_cfg(struct irq_cfg *old_cfg)
333{
334 kfree(old_cfg);
335}
336
337void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc)
338{
339 struct irq_cfg *old_cfg, *cfg;
340
341 old_cfg = old_desc->chip_data;
342 cfg = desc->chip_data;
343
344 if (old_cfg == cfg)
345 return;
346
347 if (old_cfg) {
348 free_irq_2_pin(old_cfg, cfg);
349 free_irq_cfg(old_cfg);
350 old_desc->chip_data = NULL;
351 }
352}
353
354static void
355set_extra_move_desc(struct irq_desc *desc, const struct cpumask *mask)
356{
357 struct irq_cfg *cfg = desc->chip_data;
358
359 if (!cfg->move_in_progress) {
360 /* it means that domain is not changed */
361 if (!cpumask_intersects(&desc->affinity, mask))
362 cfg->move_desc_pending = 1;
363 }
197} 364}
365#endif
366
367#else
368static struct irq_cfg *irq_cfg(unsigned int irq)
369{
370 return irq < nr_irqs ? irq_cfgx + irq : NULL;
371}
372
373#endif
374
375#ifndef CONFIG_NUMA_MIGRATE_IRQ_DESC
376static inline void
377set_extra_move_desc(struct irq_desc *desc, const struct cpumask *mask)
378{
379}
380#endif
198 381
199struct io_apic { 382struct io_apic {
200 unsigned int index; 383 unsigned int index;
@@ -237,11 +420,10 @@ static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned
237 writel(value, &io_apic->data); 420 writel(value, &io_apic->data);
238} 421}
239 422
240static bool io_apic_level_ack_pending(unsigned int irq) 423static bool io_apic_level_ack_pending(struct irq_cfg *cfg)
241{ 424{
242 struct irq_pin_list *entry; 425 struct irq_pin_list *entry;
243 unsigned long flags; 426 unsigned long flags;
244 struct irq_cfg *cfg = irq_cfg(irq);
245 427
246 spin_lock_irqsave(&ioapic_lock, flags); 428 spin_lock_irqsave(&ioapic_lock, flags);
247 entry = cfg->irq_2_pin; 429 entry = cfg->irq_2_pin;
@@ -323,13 +505,32 @@ static void ioapic_mask_entry(int apic, int pin)
323} 505}
324 506
325#ifdef CONFIG_SMP 507#ifdef CONFIG_SMP
326static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, u8 vector) 508static void send_cleanup_vector(struct irq_cfg *cfg)
509{
510 cpumask_var_t cleanup_mask;
511
512 if (unlikely(!alloc_cpumask_var(&cleanup_mask, GFP_ATOMIC))) {
513 unsigned int i;
514 cfg->move_cleanup_count = 0;
515 for_each_cpu_and(i, cfg->old_domain, cpu_online_mask)
516 cfg->move_cleanup_count++;
517 for_each_cpu_and(i, cfg->old_domain, cpu_online_mask)
518 send_IPI_mask(cpumask_of(i), IRQ_MOVE_CLEANUP_VECTOR);
519 } else {
520 cpumask_and(cleanup_mask, cfg->old_domain, cpu_online_mask);
521 cfg->move_cleanup_count = cpumask_weight(cleanup_mask);
522 send_IPI_mask(cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
523 free_cpumask_var(cleanup_mask);
524 }
525 cfg->move_in_progress = 0;
526}
527
528static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, struct irq_cfg *cfg)
327{ 529{
328 int apic, pin; 530 int apic, pin;
329 struct irq_cfg *cfg;
330 struct irq_pin_list *entry; 531 struct irq_pin_list *entry;
532 u8 vector = cfg->vector;
331 533
332 cfg = irq_cfg(irq);
333 entry = cfg->irq_2_pin; 534 entry = cfg->irq_2_pin;
334 for (;;) { 535 for (;;) {
335 unsigned int reg; 536 unsigned int reg;
@@ -359,36 +560,61 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, u8 vector)
359 } 560 }
360} 561}
361 562
362static int assign_irq_vector(int irq, cpumask_t mask); 563static int
564assign_irq_vector(int irq, struct irq_cfg *cfg, const struct cpumask *mask);
363 565
364static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask) 566/*
567 * Either sets desc->affinity to a valid value, and returns cpu_mask_to_apicid
568 * of that, or returns BAD_APICID and leaves desc->affinity untouched.
569 */
570static unsigned int
571set_desc_affinity(struct irq_desc *desc, const struct cpumask *mask)
572{
573 struct irq_cfg *cfg;
574 unsigned int irq;
575
576 if (!cpumask_intersects(mask, cpu_online_mask))
577 return BAD_APICID;
578
579 irq = desc->irq;
580 cfg = desc->chip_data;
581 if (assign_irq_vector(irq, cfg, mask))
582 return BAD_APICID;
583
584 cpumask_and(&desc->affinity, cfg->domain, mask);
585 set_extra_move_desc(desc, mask);
586 return cpu_mask_to_apicid_and(&desc->affinity, cpu_online_mask);
587}
588
589static void
590set_ioapic_affinity_irq_desc(struct irq_desc *desc, const struct cpumask *mask)
365{ 591{
366 struct irq_cfg *cfg; 592 struct irq_cfg *cfg;
367 unsigned long flags; 593 unsigned long flags;
368 unsigned int dest; 594 unsigned int dest;
369 cpumask_t tmp; 595 unsigned int irq;
370 struct irq_desc *desc;
371 596
372 cpus_and(tmp, mask, cpu_online_map); 597 irq = desc->irq;
373 if (cpus_empty(tmp)) 598 cfg = desc->chip_data;
374 return;
375 599
376 cfg = irq_cfg(irq); 600 spin_lock_irqsave(&ioapic_lock, flags);
377 if (assign_irq_vector(irq, mask)) 601 dest = set_desc_affinity(desc, mask);
378 return; 602 if (dest != BAD_APICID) {
603 /* Only the high 8 bits are valid. */
604 dest = SET_APIC_LOGICAL_ID(dest);
605 __target_IO_APIC_irq(irq, dest, cfg);
606 }
607 spin_unlock_irqrestore(&ioapic_lock, flags);
608}
379 609
380 cpus_and(tmp, cfg->domain, mask); 610static void
381 dest = cpu_mask_to_apicid(tmp); 611set_ioapic_affinity_irq(unsigned int irq, const struct cpumask *mask)
382 /* 612{
383 * Only the high 8 bits are valid. 613 struct irq_desc *desc;
384 */
385 dest = SET_APIC_LOGICAL_ID(dest);
386 614
387 desc = irq_to_desc(irq); 615 desc = irq_to_desc(irq);
388 spin_lock_irqsave(&ioapic_lock, flags); 616
389 __target_IO_APIC_irq(irq, dest, cfg->vector); 617 set_ioapic_affinity_irq_desc(desc, mask);
390 desc->affinity = mask;
391 spin_unlock_irqrestore(&ioapic_lock, flags);
392} 618}
393#endif /* CONFIG_SMP */ 619#endif /* CONFIG_SMP */
394 620
@@ -397,16 +623,18 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
397 * shared ISA-space IRQs, so we have to support them. We are super 623 * shared ISA-space IRQs, so we have to support them. We are super
398 * fast in the common case, and fast for shared ISA-space IRQs. 624 * fast in the common case, and fast for shared ISA-space IRQs.
399 */ 625 */
400static void add_pin_to_irq(unsigned int irq, int apic, int pin) 626static void add_pin_to_irq_cpu(struct irq_cfg *cfg, int cpu, int apic, int pin)
401{ 627{
402 struct irq_cfg *cfg;
403 struct irq_pin_list *entry; 628 struct irq_pin_list *entry;
404 629
405 /* first time to refer irq_cfg, so with new */
406 cfg = irq_cfg_alloc(irq);
407 entry = cfg->irq_2_pin; 630 entry = cfg->irq_2_pin;
408 if (!entry) { 631 if (!entry) {
409 entry = get_one_free_irq_2_pin(); 632 entry = get_one_free_irq_2_pin(cpu);
633 if (!entry) {
634 printk(KERN_ERR "can not alloc irq_2_pin to add %d - %d\n",
635 apic, pin);
636 return;
637 }
410 cfg->irq_2_pin = entry; 638 cfg->irq_2_pin = entry;
411 entry->apic = apic; 639 entry->apic = apic;
412 entry->pin = pin; 640 entry->pin = pin;
@@ -421,7 +649,7 @@ static void add_pin_to_irq(unsigned int irq, int apic, int pin)
421 entry = entry->next; 649 entry = entry->next;
422 } 650 }
423 651
424 entry->next = get_one_free_irq_2_pin(); 652 entry->next = get_one_free_irq_2_pin(cpu);
425 entry = entry->next; 653 entry = entry->next;
426 entry->apic = apic; 654 entry->apic = apic;
427 entry->pin = pin; 655 entry->pin = pin;
@@ -430,11 +658,10 @@ static void add_pin_to_irq(unsigned int irq, int apic, int pin)
430/* 658/*
431 * Reroute an IRQ to a different pin. 659 * Reroute an IRQ to a different pin.
432 */ 660 */
433static void __init replace_pin_at_irq(unsigned int irq, 661static void __init replace_pin_at_irq_cpu(struct irq_cfg *cfg, int cpu,
434 int oldapic, int oldpin, 662 int oldapic, int oldpin,
435 int newapic, int newpin) 663 int newapic, int newpin)
436{ 664{
437 struct irq_cfg *cfg = irq_cfg(irq);
438 struct irq_pin_list *entry = cfg->irq_2_pin; 665 struct irq_pin_list *entry = cfg->irq_2_pin;
439 int replaced = 0; 666 int replaced = 0;
440 667
@@ -451,18 +678,16 @@ static void __init replace_pin_at_irq(unsigned int irq,
451 678
452 /* why? call replace before add? */ 679 /* why? call replace before add? */
453 if (!replaced) 680 if (!replaced)
454 add_pin_to_irq(irq, newapic, newpin); 681 add_pin_to_irq_cpu(cfg, cpu, newapic, newpin);
455} 682}
456 683
457static inline void io_apic_modify_irq(unsigned int irq, 684static inline void io_apic_modify_irq(struct irq_cfg *cfg,
458 int mask_and, int mask_or, 685 int mask_and, int mask_or,
459 void (*final)(struct irq_pin_list *entry)) 686 void (*final)(struct irq_pin_list *entry))
460{ 687{
461 int pin; 688 int pin;
462 struct irq_cfg *cfg;
463 struct irq_pin_list *entry; 689 struct irq_pin_list *entry;
464 690
465 cfg = irq_cfg(irq);
466 for (entry = cfg->irq_2_pin; entry != NULL; entry = entry->next) { 691 for (entry = cfg->irq_2_pin; entry != NULL; entry = entry->next) {
467 unsigned int reg; 692 unsigned int reg;
468 pin = entry->pin; 693 pin = entry->pin;
@@ -475,13 +700,13 @@ static inline void io_apic_modify_irq(unsigned int irq,
475 } 700 }
476} 701}
477 702
478static void __unmask_IO_APIC_irq(unsigned int irq) 703static void __unmask_IO_APIC_irq(struct irq_cfg *cfg)
479{ 704{
480 io_apic_modify_irq(irq, ~IO_APIC_REDIR_MASKED, 0, NULL); 705 io_apic_modify_irq(cfg, ~IO_APIC_REDIR_MASKED, 0, NULL);
481} 706}
482 707
483#ifdef CONFIG_X86_64 708#ifdef CONFIG_X86_64
484void io_apic_sync(struct irq_pin_list *entry) 709static void io_apic_sync(struct irq_pin_list *entry)
485{ 710{
486 /* 711 /*
487 * Synchronize the IO-APIC and the CPU by doing 712 * Synchronize the IO-APIC and the CPU by doing
@@ -492,47 +717,64 @@ void io_apic_sync(struct irq_pin_list *entry)
492 readl(&io_apic->data); 717 readl(&io_apic->data);
493} 718}
494 719
495static void __mask_IO_APIC_irq(unsigned int irq) 720static void __mask_IO_APIC_irq(struct irq_cfg *cfg)
496{ 721{
497 io_apic_modify_irq(irq, ~0, IO_APIC_REDIR_MASKED, &io_apic_sync); 722 io_apic_modify_irq(cfg, ~0, IO_APIC_REDIR_MASKED, &io_apic_sync);
498} 723}
499#else /* CONFIG_X86_32 */ 724#else /* CONFIG_X86_32 */
500static void __mask_IO_APIC_irq(unsigned int irq) 725static void __mask_IO_APIC_irq(struct irq_cfg *cfg)
501{ 726{
502 io_apic_modify_irq(irq, ~0, IO_APIC_REDIR_MASKED, NULL); 727 io_apic_modify_irq(cfg, ~0, IO_APIC_REDIR_MASKED, NULL);
503} 728}
504 729
505static void __mask_and_edge_IO_APIC_irq(unsigned int irq) 730static void __mask_and_edge_IO_APIC_irq(struct irq_cfg *cfg)
506{ 731{
507 io_apic_modify_irq(irq, ~IO_APIC_REDIR_LEVEL_TRIGGER, 732 io_apic_modify_irq(cfg, ~IO_APIC_REDIR_LEVEL_TRIGGER,
508 IO_APIC_REDIR_MASKED, NULL); 733 IO_APIC_REDIR_MASKED, NULL);
509} 734}
510 735
511static void __unmask_and_level_IO_APIC_irq(unsigned int irq) 736static void __unmask_and_level_IO_APIC_irq(struct irq_cfg *cfg)
512{ 737{
513 io_apic_modify_irq(irq, ~IO_APIC_REDIR_MASKED, 738 io_apic_modify_irq(cfg, ~IO_APIC_REDIR_MASKED,
514 IO_APIC_REDIR_LEVEL_TRIGGER, NULL); 739 IO_APIC_REDIR_LEVEL_TRIGGER, NULL);
515} 740}
516#endif /* CONFIG_X86_32 */ 741#endif /* CONFIG_X86_32 */
517 742
518static void mask_IO_APIC_irq (unsigned int irq) 743static void mask_IO_APIC_irq_desc(struct irq_desc *desc)
519{ 744{
745 struct irq_cfg *cfg = desc->chip_data;
520 unsigned long flags; 746 unsigned long flags;
521 747
748 BUG_ON(!cfg);
749
522 spin_lock_irqsave(&ioapic_lock, flags); 750 spin_lock_irqsave(&ioapic_lock, flags);
523 __mask_IO_APIC_irq(irq); 751 __mask_IO_APIC_irq(cfg);
524 spin_unlock_irqrestore(&ioapic_lock, flags); 752 spin_unlock_irqrestore(&ioapic_lock, flags);
525} 753}
526 754
527static void unmask_IO_APIC_irq (unsigned int irq) 755static void unmask_IO_APIC_irq_desc(struct irq_desc *desc)
528{ 756{
757 struct irq_cfg *cfg = desc->chip_data;
529 unsigned long flags; 758 unsigned long flags;
530 759
531 spin_lock_irqsave(&ioapic_lock, flags); 760 spin_lock_irqsave(&ioapic_lock, flags);
532 __unmask_IO_APIC_irq(irq); 761 __unmask_IO_APIC_irq(cfg);
533 spin_unlock_irqrestore(&ioapic_lock, flags); 762 spin_unlock_irqrestore(&ioapic_lock, flags);
534} 763}
535 764
765static void mask_IO_APIC_irq(unsigned int irq)
766{
767 struct irq_desc *desc = irq_to_desc(irq);
768
769 mask_IO_APIC_irq_desc(desc);
770}
771static void unmask_IO_APIC_irq(unsigned int irq)
772{
773 struct irq_desc *desc = irq_to_desc(irq);
774
775 unmask_IO_APIC_irq_desc(desc);
776}
777
536static void clear_IO_APIC_pin(unsigned int apic, unsigned int pin) 778static void clear_IO_APIC_pin(unsigned int apic, unsigned int pin)
537{ 779{
538 struct IO_APIC_route_entry entry; 780 struct IO_APIC_route_entry entry;
@@ -809,7 +1051,7 @@ EXPORT_SYMBOL(IO_APIC_get_PCI_irq_vector);
809 */ 1051 */
810static int EISA_ELCR(unsigned int irq) 1052static int EISA_ELCR(unsigned int irq)
811{ 1053{
812 if (irq < 16) { 1054 if (irq < NR_IRQS_LEGACY) {
813 unsigned int port = 0x4d0 + (irq >> 3); 1055 unsigned int port = 0x4d0 + (irq >> 3);
814 return (inb(port) >> (irq & 7)) & 1; 1056 return (inb(port) >> (irq & 7)) & 1;
815 } 1057 }
@@ -1034,7 +1276,8 @@ void unlock_vector_lock(void)
1034 spin_unlock(&vector_lock); 1276 spin_unlock(&vector_lock);
1035} 1277}
1036 1278
1037static int __assign_irq_vector(int irq, cpumask_t mask) 1279static int
1280__assign_irq_vector(int irq, struct irq_cfg *cfg, const struct cpumask *mask)
1038{ 1281{
1039 /* 1282 /*
1040 * NOTE! The local APIC isn't very good at handling 1283 * NOTE! The local APIC isn't very good at handling
@@ -1049,52 +1292,49 @@ static int __assign_irq_vector(int irq, cpumask_t mask)
1049 */ 1292 */
1050 static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0; 1293 static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0;
1051 unsigned int old_vector; 1294 unsigned int old_vector;
1052 int cpu; 1295 int cpu, err;
1053 struct irq_cfg *cfg; 1296 cpumask_var_t tmp_mask;
1054
1055 cfg = irq_cfg(irq);
1056
1057 /* Only try and allocate irqs on cpus that are present */
1058 cpus_and(mask, mask, cpu_online_map);
1059 1297
1060 if ((cfg->move_in_progress) || cfg->move_cleanup_count) 1298 if ((cfg->move_in_progress) || cfg->move_cleanup_count)
1061 return -EBUSY; 1299 return -EBUSY;
1062 1300
1301 if (!alloc_cpumask_var(&tmp_mask, GFP_ATOMIC))
1302 return -ENOMEM;
1303
1063 old_vector = cfg->vector; 1304 old_vector = cfg->vector;
1064 if (old_vector) { 1305 if (old_vector) {
1065 cpumask_t tmp; 1306 cpumask_and(tmp_mask, mask, cpu_online_mask);
1066 cpus_and(tmp, cfg->domain, mask); 1307 cpumask_and(tmp_mask, cfg->domain, tmp_mask);
1067 if (!cpus_empty(tmp)) 1308 if (!cpumask_empty(tmp_mask)) {
1309 free_cpumask_var(tmp_mask);
1068 return 0; 1310 return 0;
1311 }
1069 } 1312 }
1070 1313
1071 for_each_cpu_mask_nr(cpu, mask) { 1314 /* Only try and allocate irqs on cpus that are present */
1072 cpumask_t domain, new_mask; 1315 err = -ENOSPC;
1316 for_each_cpu_and(cpu, mask, cpu_online_mask) {
1073 int new_cpu; 1317 int new_cpu;
1074 int vector, offset; 1318 int vector, offset;
1075 1319
1076 domain = vector_allocation_domain(cpu); 1320 vector_allocation_domain(cpu, tmp_mask);
1077 cpus_and(new_mask, domain, cpu_online_map);
1078 1321
1079 vector = current_vector; 1322 vector = current_vector;
1080 offset = current_offset; 1323 offset = current_offset;
1081next: 1324next:
1082 vector += 8; 1325 vector += 8;
1083 if (vector >= first_system_vector) { 1326 if (vector >= first_system_vector) {
1084 /* If we run out of vectors on large boxen, must share them. */ 1327 /* If out of vectors on large boxen, must share them. */
1085 offset = (offset + 1) % 8; 1328 offset = (offset + 1) % 8;
1086 vector = FIRST_DEVICE_VECTOR + offset; 1329 vector = FIRST_DEVICE_VECTOR + offset;
1087 } 1330 }
1088 if (unlikely(current_vector == vector)) 1331 if (unlikely(current_vector == vector))
1089 continue; 1332 continue;
1090#ifdef CONFIG_X86_64 1333
1091 if (vector == IA32_SYSCALL_VECTOR) 1334 if (test_bit(vector, used_vectors))
1092 goto next;
1093#else
1094 if (vector == SYSCALL_VECTOR)
1095 goto next; 1335 goto next;
1096#endif 1336
1097 for_each_cpu_mask_nr(new_cpu, new_mask) 1337 for_each_cpu_and(new_cpu, tmp_mask, cpu_online_mask)
1098 if (per_cpu(vector_irq, new_cpu)[vector] != -1) 1338 if (per_cpu(vector_irq, new_cpu)[vector] != -1)
1099 goto next; 1339 goto next;
1100 /* Found one! */ 1340 /* Found one! */
@@ -1102,49 +1342,47 @@ next:
1102 current_offset = offset; 1342 current_offset = offset;
1103 if (old_vector) { 1343 if (old_vector) {
1104 cfg->move_in_progress = 1; 1344 cfg->move_in_progress = 1;
1105 cfg->old_domain = cfg->domain; 1345 cpumask_copy(cfg->old_domain, cfg->domain);
1106 } 1346 }
1107 for_each_cpu_mask_nr(new_cpu, new_mask) 1347 for_each_cpu_and(new_cpu, tmp_mask, cpu_online_mask)
1108 per_cpu(vector_irq, new_cpu)[vector] = irq; 1348 per_cpu(vector_irq, new_cpu)[vector] = irq;
1109 cfg->vector = vector; 1349 cfg->vector = vector;
1110 cfg->domain = domain; 1350 cpumask_copy(cfg->domain, tmp_mask);
1111 return 0; 1351 err = 0;
1352 break;
1112 } 1353 }
1113 return -ENOSPC; 1354 free_cpumask_var(tmp_mask);
1355 return err;
1114} 1356}
1115 1357
1116static int assign_irq_vector(int irq, cpumask_t mask) 1358static int
1359assign_irq_vector(int irq, struct irq_cfg *cfg, const struct cpumask *mask)
1117{ 1360{
1118 int err; 1361 int err;
1119 unsigned long flags; 1362 unsigned long flags;
1120 1363
1121 spin_lock_irqsave(&vector_lock, flags); 1364 spin_lock_irqsave(&vector_lock, flags);
1122 err = __assign_irq_vector(irq, mask); 1365 err = __assign_irq_vector(irq, cfg, mask);
1123 spin_unlock_irqrestore(&vector_lock, flags); 1366 spin_unlock_irqrestore(&vector_lock, flags);
1124 return err; 1367 return err;
1125} 1368}
1126 1369
1127static void __clear_irq_vector(int irq) 1370static void __clear_irq_vector(int irq, struct irq_cfg *cfg)
1128{ 1371{
1129 struct irq_cfg *cfg;
1130 cpumask_t mask;
1131 int cpu, vector; 1372 int cpu, vector;
1132 1373
1133 cfg = irq_cfg(irq);
1134 BUG_ON(!cfg->vector); 1374 BUG_ON(!cfg->vector);
1135 1375
1136 vector = cfg->vector; 1376 vector = cfg->vector;
1137 cpus_and(mask, cfg->domain, cpu_online_map); 1377 for_each_cpu_and(cpu, cfg->domain, cpu_online_mask)
1138 for_each_cpu_mask_nr(cpu, mask)
1139 per_cpu(vector_irq, cpu)[vector] = -1; 1378 per_cpu(vector_irq, cpu)[vector] = -1;
1140 1379
1141 cfg->vector = 0; 1380 cfg->vector = 0;
1142 cpus_clear(cfg->domain); 1381 cpumask_clear(cfg->domain);
1143 1382
1144 if (likely(!cfg->move_in_progress)) 1383 if (likely(!cfg->move_in_progress))
1145 return; 1384 return;
1146 cpus_and(mask, cfg->old_domain, cpu_online_map); 1385 for_each_cpu_and(cpu, cfg->old_domain, cpu_online_mask) {
1147 for_each_cpu_mask_nr(cpu, mask) {
1148 for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; 1386 for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS;
1149 vector++) { 1387 vector++) {
1150 if (per_cpu(vector_irq, cpu)[vector] != irq) 1388 if (per_cpu(vector_irq, cpu)[vector] != irq)
@@ -1162,10 +1400,12 @@ void __setup_vector_irq(int cpu)
1162 /* This function must be called with vector_lock held */ 1400 /* This function must be called with vector_lock held */
1163 int irq, vector; 1401 int irq, vector;
1164 struct irq_cfg *cfg; 1402 struct irq_cfg *cfg;
1403 struct irq_desc *desc;
1165 1404
1166 /* Mark the inuse vectors */ 1405 /* Mark the inuse vectors */
1167 for_each_irq_cfg(irq, cfg) { 1406 for_each_irq_desc(irq, desc) {
1168 if (!cpu_isset(cpu, cfg->domain)) 1407 cfg = desc->chip_data;
1408 if (!cpumask_test_cpu(cpu, cfg->domain))
1169 continue; 1409 continue;
1170 vector = cfg->vector; 1410 vector = cfg->vector;
1171 per_cpu(vector_irq, cpu)[vector] = irq; 1411 per_cpu(vector_irq, cpu)[vector] = irq;
@@ -1177,7 +1417,7 @@ void __setup_vector_irq(int cpu)
1177 continue; 1417 continue;
1178 1418
1179 cfg = irq_cfg(irq); 1419 cfg = irq_cfg(irq);
1180 if (!cpu_isset(cpu, cfg->domain)) 1420 if (!cpumask_test_cpu(cpu, cfg->domain))
1181 per_cpu(vector_irq, cpu)[vector] = -1; 1421 per_cpu(vector_irq, cpu)[vector] = -1;
1182 } 1422 }
1183} 1423}
@@ -1215,11 +1455,8 @@ static inline int IO_APIC_irq_trigger(int irq)
1215} 1455}
1216#endif 1456#endif
1217 1457
1218static void ioapic_register_intr(int irq, unsigned long trigger) 1458static void ioapic_register_intr(int irq, struct irq_desc *desc, unsigned long trigger)
1219{ 1459{
1220 struct irq_desc *desc;
1221
1222 desc = irq_to_desc(irq);
1223 1460
1224 if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) || 1461 if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
1225 trigger == IOAPIC_LEVEL) 1462 trigger == IOAPIC_LEVEL)
@@ -1311,23 +1548,22 @@ static int setup_ioapic_entry(int apic, int irq,
1311 return 0; 1548 return 0;
1312} 1549}
1313 1550
1314static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq, 1551static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq, struct irq_desc *desc,
1315 int trigger, int polarity) 1552 int trigger, int polarity)
1316{ 1553{
1317 struct irq_cfg *cfg; 1554 struct irq_cfg *cfg;
1318 struct IO_APIC_route_entry entry; 1555 struct IO_APIC_route_entry entry;
1319 cpumask_t mask; 1556 unsigned int dest;
1320 1557
1321 if (!IO_APIC_IRQ(irq)) 1558 if (!IO_APIC_IRQ(irq))
1322 return; 1559 return;
1323 1560
1324 cfg = irq_cfg(irq); 1561 cfg = desc->chip_data;
1325 1562
1326 mask = TARGET_CPUS; 1563 if (assign_irq_vector(irq, cfg, TARGET_CPUS))
1327 if (assign_irq_vector(irq, mask))
1328 return; 1564 return;
1329 1565
1330 cpus_and(mask, cfg->domain, mask); 1566 dest = cpu_mask_to_apicid_and(cfg->domain, TARGET_CPUS);
1331 1567
1332 apic_printk(APIC_VERBOSE,KERN_DEBUG 1568 apic_printk(APIC_VERBOSE,KERN_DEBUG
1333 "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> " 1569 "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> "
@@ -1337,16 +1573,15 @@ static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq,
1337 1573
1338 1574
1339 if (setup_ioapic_entry(mp_ioapics[apic].mp_apicid, irq, &entry, 1575 if (setup_ioapic_entry(mp_ioapics[apic].mp_apicid, irq, &entry,
1340 cpu_mask_to_apicid(mask), trigger, polarity, 1576 dest, trigger, polarity, cfg->vector)) {
1341 cfg->vector)) {
1342 printk("Failed to setup ioapic entry for ioapic %d, pin %d\n", 1577 printk("Failed to setup ioapic entry for ioapic %d, pin %d\n",
1343 mp_ioapics[apic].mp_apicid, pin); 1578 mp_ioapics[apic].mp_apicid, pin);
1344 __clear_irq_vector(irq); 1579 __clear_irq_vector(irq, cfg);
1345 return; 1580 return;
1346 } 1581 }
1347 1582
1348 ioapic_register_intr(irq, trigger); 1583 ioapic_register_intr(irq, desc, trigger);
1349 if (irq < 16) 1584 if (irq < NR_IRQS_LEGACY)
1350 disable_8259A_irq(irq); 1585 disable_8259A_irq(irq);
1351 1586
1352 ioapic_write_entry(apic, pin, entry); 1587 ioapic_write_entry(apic, pin, entry);
@@ -1356,6 +1591,9 @@ static void __init setup_IO_APIC_irqs(void)
1356{ 1591{
1357 int apic, pin, idx, irq; 1592 int apic, pin, idx, irq;
1358 int notcon = 0; 1593 int notcon = 0;
1594 struct irq_desc *desc;
1595 struct irq_cfg *cfg;
1596 int cpu = boot_cpu_id;
1359 1597
1360 apic_printk(APIC_VERBOSE, KERN_DEBUG "init IO_APIC IRQs\n"); 1598 apic_printk(APIC_VERBOSE, KERN_DEBUG "init IO_APIC IRQs\n");
1361 1599
@@ -1387,9 +1625,15 @@ static void __init setup_IO_APIC_irqs(void)
1387 if (multi_timer_check(apic, irq)) 1625 if (multi_timer_check(apic, irq))
1388 continue; 1626 continue;
1389#endif 1627#endif
1390 add_pin_to_irq(irq, apic, pin); 1628 desc = irq_to_desc_alloc_cpu(irq, cpu);
1629 if (!desc) {
1630 printk(KERN_INFO "can not get irq_desc for %d\n", irq);
1631 continue;
1632 }
1633 cfg = desc->chip_data;
1634 add_pin_to_irq_cpu(cfg, cpu, apic, pin);
1391 1635
1392 setup_IO_APIC_irq(apic, pin, irq, 1636 setup_IO_APIC_irq(apic, pin, irq, desc,
1393 irq_trigger(idx), irq_polarity(idx)); 1637 irq_trigger(idx), irq_polarity(idx));
1394 } 1638 }
1395 } 1639 }
@@ -1448,6 +1692,7 @@ __apicdebuginit(void) print_IO_APIC(void)
1448 union IO_APIC_reg_03 reg_03; 1692 union IO_APIC_reg_03 reg_03;
1449 unsigned long flags; 1693 unsigned long flags;
1450 struct irq_cfg *cfg; 1694 struct irq_cfg *cfg;
1695 struct irq_desc *desc;
1451 unsigned int irq; 1696 unsigned int irq;
1452 1697
1453 if (apic_verbosity == APIC_QUIET) 1698 if (apic_verbosity == APIC_QUIET)
@@ -1537,8 +1782,11 @@ __apicdebuginit(void) print_IO_APIC(void)
1537 } 1782 }
1538 } 1783 }
1539 printk(KERN_DEBUG "IRQ to pin mappings:\n"); 1784 printk(KERN_DEBUG "IRQ to pin mappings:\n");
1540 for_each_irq_cfg(irq, cfg) { 1785 for_each_irq_desc(irq, desc) {
1541 struct irq_pin_list *entry = cfg->irq_2_pin; 1786 struct irq_pin_list *entry;
1787
1788 cfg = desc->chip_data;
1789 entry = cfg->irq_2_pin;
1542 if (!entry) 1790 if (!entry)
1543 continue; 1791 continue;
1544 printk(KERN_DEBUG "IRQ%d ", irq); 1792 printk(KERN_DEBUG "IRQ%d ", irq);
@@ -2022,14 +2270,16 @@ static unsigned int startup_ioapic_irq(unsigned int irq)
2022{ 2270{
2023 int was_pending = 0; 2271 int was_pending = 0;
2024 unsigned long flags; 2272 unsigned long flags;
2273 struct irq_cfg *cfg;
2025 2274
2026 spin_lock_irqsave(&ioapic_lock, flags); 2275 spin_lock_irqsave(&ioapic_lock, flags);
2027 if (irq < 16) { 2276 if (irq < NR_IRQS_LEGACY) {
2028 disable_8259A_irq(irq); 2277 disable_8259A_irq(irq);
2029 if (i8259A_irq_pending(irq)) 2278 if (i8259A_irq_pending(irq))
2030 was_pending = 1; 2279 was_pending = 1;
2031 } 2280 }
2032 __unmask_IO_APIC_irq(irq); 2281 cfg = irq_cfg(irq);
2282 __unmask_IO_APIC_irq(cfg);
2033 spin_unlock_irqrestore(&ioapic_lock, flags); 2283 spin_unlock_irqrestore(&ioapic_lock, flags);
2034 2284
2035 return was_pending; 2285 return was_pending;
@@ -2043,7 +2293,7 @@ static int ioapic_retrigger_irq(unsigned int irq)
2043 unsigned long flags; 2293 unsigned long flags;
2044 2294
2045 spin_lock_irqsave(&vector_lock, flags); 2295 spin_lock_irqsave(&vector_lock, flags);
2046 send_IPI_mask(cpumask_of_cpu(first_cpu(cfg->domain)), cfg->vector); 2296 send_IPI_mask(cpumask_of(cpumask_first(cfg->domain)), cfg->vector);
2047 spin_unlock_irqrestore(&vector_lock, flags); 2297 spin_unlock_irqrestore(&vector_lock, flags);
2048 2298
2049 return 1; 2299 return 1;
@@ -2092,35 +2342,35 @@ static DECLARE_DELAYED_WORK(ir_migration_work, ir_irq_migration);
2092 * as simple as edge triggered migration and we can do the irq migration 2342 * as simple as edge triggered migration and we can do the irq migration
2093 * with a simple atomic update to IO-APIC RTE. 2343 * with a simple atomic update to IO-APIC RTE.
2094 */ 2344 */
2095static void migrate_ioapic_irq(int irq, cpumask_t mask) 2345static void
2346migrate_ioapic_irq_desc(struct irq_desc *desc, const struct cpumask *mask)
2096{ 2347{
2097 struct irq_cfg *cfg; 2348 struct irq_cfg *cfg;
2098 struct irq_desc *desc;
2099 cpumask_t tmp, cleanup_mask;
2100 struct irte irte; 2349 struct irte irte;
2101 int modify_ioapic_rte; 2350 int modify_ioapic_rte;
2102 unsigned int dest; 2351 unsigned int dest;
2103 unsigned long flags; 2352 unsigned long flags;
2353 unsigned int irq;
2104 2354
2105 cpus_and(tmp, mask, cpu_online_map); 2355 if (!cpumask_intersects(mask, cpu_online_mask))
2106 if (cpus_empty(tmp))
2107 return; 2356 return;
2108 2357
2358 irq = desc->irq;
2109 if (get_irte(irq, &irte)) 2359 if (get_irte(irq, &irte))
2110 return; 2360 return;
2111 2361
2112 if (assign_irq_vector(irq, mask)) 2362 cfg = desc->chip_data;
2363 if (assign_irq_vector(irq, cfg, mask))
2113 return; 2364 return;
2114 2365
2115 cfg = irq_cfg(irq); 2366 set_extra_move_desc(desc, mask);
2116 cpus_and(tmp, cfg->domain, mask); 2367
2117 dest = cpu_mask_to_apicid(tmp); 2368 dest = cpu_mask_to_apicid_and(cfg->domain, mask);
2118 2369
2119 desc = irq_to_desc(irq);
2120 modify_ioapic_rte = desc->status & IRQ_LEVEL; 2370 modify_ioapic_rte = desc->status & IRQ_LEVEL;
2121 if (modify_ioapic_rte) { 2371 if (modify_ioapic_rte) {
2122 spin_lock_irqsave(&ioapic_lock, flags); 2372 spin_lock_irqsave(&ioapic_lock, flags);
2123 __target_IO_APIC_irq(irq, dest, cfg->vector); 2373 __target_IO_APIC_irq(irq, dest, cfg);
2124 spin_unlock_irqrestore(&ioapic_lock, flags); 2374 spin_unlock_irqrestore(&ioapic_lock, flags);
2125 } 2375 }
2126 2376
@@ -2132,24 +2382,20 @@ static void migrate_ioapic_irq(int irq, cpumask_t mask)
2132 */ 2382 */
2133 modify_irte(irq, &irte); 2383 modify_irte(irq, &irte);
2134 2384
2135 if (cfg->move_in_progress) { 2385 if (cfg->move_in_progress)
2136 cpus_and(cleanup_mask, cfg->old_domain, cpu_online_map); 2386 send_cleanup_vector(cfg);
2137 cfg->move_cleanup_count = cpus_weight(cleanup_mask);
2138 send_IPI_mask(cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
2139 cfg->move_in_progress = 0;
2140 }
2141 2387
2142 desc->affinity = mask; 2388 cpumask_copy(&desc->affinity, mask);
2143} 2389}
2144 2390
2145static int migrate_irq_remapped_level(int irq) 2391static int migrate_irq_remapped_level_desc(struct irq_desc *desc)
2146{ 2392{
2147 int ret = -1; 2393 int ret = -1;
2148 struct irq_desc *desc = irq_to_desc(irq); 2394 struct irq_cfg *cfg = desc->chip_data;
2149 2395
2150 mask_IO_APIC_irq(irq); 2396 mask_IO_APIC_irq_desc(desc);
2151 2397
2152 if (io_apic_level_ack_pending(irq)) { 2398 if (io_apic_level_ack_pending(cfg)) {
2153 /* 2399 /*
2154 * Interrupt in progress. Migrating irq now will change the 2400 * Interrupt in progress. Migrating irq now will change the
2155 * vector information in the IO-APIC RTE and that will confuse 2401 * vector information in the IO-APIC RTE and that will confuse
@@ -2161,14 +2407,15 @@ static int migrate_irq_remapped_level(int irq)
2161 } 2407 }
2162 2408
2163 /* everthing is clear. we have right of way */ 2409 /* everthing is clear. we have right of way */
2164 migrate_ioapic_irq(irq, desc->pending_mask); 2410 migrate_ioapic_irq_desc(desc, &desc->pending_mask);
2165 2411
2166 ret = 0; 2412 ret = 0;
2167 desc->status &= ~IRQ_MOVE_PENDING; 2413 desc->status &= ~IRQ_MOVE_PENDING;
2168 cpus_clear(desc->pending_mask); 2414 cpumask_clear(&desc->pending_mask);
2169 2415
2170unmask: 2416unmask:
2171 unmask_IO_APIC_irq(irq); 2417 unmask_IO_APIC_irq_desc(desc);
2418
2172 return ret; 2419 return ret;
2173} 2420}
2174 2421
@@ -2189,7 +2436,7 @@ static void ir_irq_migration(struct work_struct *work)
2189 continue; 2436 continue;
2190 } 2437 }
2191 2438
2192 desc->chip->set_affinity(irq, desc->pending_mask); 2439 desc->chip->set_affinity(irq, &desc->pending_mask);
2193 spin_unlock_irqrestore(&desc->lock, flags); 2440 spin_unlock_irqrestore(&desc->lock, flags);
2194 } 2441 }
2195 } 2442 }
@@ -2198,28 +2445,33 @@ static void ir_irq_migration(struct work_struct *work)
2198/* 2445/*
2199 * Migrates the IRQ destination in the process context. 2446 * Migrates the IRQ destination in the process context.
2200 */ 2447 */
2201static void set_ir_ioapic_affinity_irq(unsigned int irq, cpumask_t mask) 2448static void set_ir_ioapic_affinity_irq_desc(struct irq_desc *desc,
2449 const struct cpumask *mask)
2202{ 2450{
2203 struct irq_desc *desc = irq_to_desc(irq);
2204
2205 if (desc->status & IRQ_LEVEL) { 2451 if (desc->status & IRQ_LEVEL) {
2206 desc->status |= IRQ_MOVE_PENDING; 2452 desc->status |= IRQ_MOVE_PENDING;
2207 desc->pending_mask = mask; 2453 cpumask_copy(&desc->pending_mask, mask);
2208 migrate_irq_remapped_level(irq); 2454 migrate_irq_remapped_level_desc(desc);
2209 return; 2455 return;
2210 } 2456 }
2211 2457
2212 migrate_ioapic_irq(irq, mask); 2458 migrate_ioapic_irq_desc(desc, mask);
2459}
2460static void set_ir_ioapic_affinity_irq(unsigned int irq,
2461 const struct cpumask *mask)
2462{
2463 struct irq_desc *desc = irq_to_desc(irq);
2464
2465 set_ir_ioapic_affinity_irq_desc(desc, mask);
2213} 2466}
2214#endif 2467#endif
2215 2468
2216asmlinkage void smp_irq_move_cleanup_interrupt(void) 2469asmlinkage void smp_irq_move_cleanup_interrupt(void)
2217{ 2470{
2218 unsigned vector, me; 2471 unsigned vector, me;
2472
2219 ack_APIC_irq(); 2473 ack_APIC_irq();
2220#ifdef CONFIG_X86_64
2221 exit_idle(); 2474 exit_idle();
2222#endif
2223 irq_enter(); 2475 irq_enter();
2224 2476
2225 me = smp_processor_id(); 2477 me = smp_processor_id();
@@ -2229,6 +2481,9 @@ asmlinkage void smp_irq_move_cleanup_interrupt(void)
2229 struct irq_cfg *cfg; 2481 struct irq_cfg *cfg;
2230 irq = __get_cpu_var(vector_irq)[vector]; 2482 irq = __get_cpu_var(vector_irq)[vector];
2231 2483
2484 if (irq == -1)
2485 continue;
2486
2232 desc = irq_to_desc(irq); 2487 desc = irq_to_desc(irq);
2233 if (!desc) 2488 if (!desc)
2234 continue; 2489 continue;
@@ -2238,7 +2493,7 @@ asmlinkage void smp_irq_move_cleanup_interrupt(void)
2238 if (!cfg->move_cleanup_count) 2493 if (!cfg->move_cleanup_count)
2239 goto unlock; 2494 goto unlock;
2240 2495
2241 if ((vector == cfg->vector) && cpu_isset(me, cfg->domain)) 2496 if (vector == cfg->vector && cpumask_test_cpu(me, cfg->domain))
2242 goto unlock; 2497 goto unlock;
2243 2498
2244 __get_cpu_var(vector_irq)[vector] = -1; 2499 __get_cpu_var(vector_irq)[vector] = -1;
@@ -2250,28 +2505,44 @@ unlock:
2250 irq_exit(); 2505 irq_exit();
2251} 2506}
2252 2507
2253static void irq_complete_move(unsigned int irq) 2508static void irq_complete_move(struct irq_desc **descp)
2254{ 2509{
2255 struct irq_cfg *cfg = irq_cfg(irq); 2510 struct irq_desc *desc = *descp;
2511 struct irq_cfg *cfg = desc->chip_data;
2256 unsigned vector, me; 2512 unsigned vector, me;
2257 2513
2258 if (likely(!cfg->move_in_progress)) 2514 if (likely(!cfg->move_in_progress)) {
2515#ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC
2516 if (likely(!cfg->move_desc_pending))
2517 return;
2518
2519 /* domain has not changed, but affinity did */
2520 me = smp_processor_id();
2521 if (cpu_isset(me, desc->affinity)) {
2522 *descp = desc = move_irq_desc(desc, me);
2523 /* get the new one */
2524 cfg = desc->chip_data;
2525 cfg->move_desc_pending = 0;
2526 }
2527#endif
2259 return; 2528 return;
2529 }
2260 2530
2261 vector = ~get_irq_regs()->orig_ax; 2531 vector = ~get_irq_regs()->orig_ax;
2262 me = smp_processor_id(); 2532 me = smp_processor_id();
2263 if ((vector == cfg->vector) && cpu_isset(me, cfg->domain)) { 2533#ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC
2264 cpumask_t cleanup_mask; 2534 *descp = desc = move_irq_desc(desc, me);
2535 /* get the new one */
2536 cfg = desc->chip_data;
2537#endif
2265 2538
2266 cpus_and(cleanup_mask, cfg->old_domain, cpu_online_map); 2539 if (vector == cfg->vector && cpumask_test_cpu(me, cfg->domain))
2267 cfg->move_cleanup_count = cpus_weight(cleanup_mask); 2540 send_cleanup_vector(cfg);
2268 send_IPI_mask(cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
2269 cfg->move_in_progress = 0;
2270 }
2271} 2541}
2272#else 2542#else
2273static inline void irq_complete_move(unsigned int irq) {} 2543static inline void irq_complete_move(struct irq_desc **descp) {}
2274#endif 2544#endif
2545
2275#ifdef CONFIG_INTR_REMAP 2546#ifdef CONFIG_INTR_REMAP
2276static void ack_x2apic_level(unsigned int irq) 2547static void ack_x2apic_level(unsigned int irq)
2277{ 2548{
@@ -2282,11 +2553,14 @@ static void ack_x2apic_edge(unsigned int irq)
2282{ 2553{
2283 ack_x2APIC_irq(); 2554 ack_x2APIC_irq();
2284} 2555}
2556
2285#endif 2557#endif
2286 2558
2287static void ack_apic_edge(unsigned int irq) 2559static void ack_apic_edge(unsigned int irq)
2288{ 2560{
2289 irq_complete_move(irq); 2561 struct irq_desc *desc = irq_to_desc(irq);
2562
2563 irq_complete_move(&desc);
2290 move_native_irq(irq); 2564 move_native_irq(irq);
2291 ack_APIC_irq(); 2565 ack_APIC_irq();
2292} 2566}
@@ -2295,18 +2569,21 @@ atomic_t irq_mis_count;
2295 2569
2296static void ack_apic_level(unsigned int irq) 2570static void ack_apic_level(unsigned int irq)
2297{ 2571{
2572 struct irq_desc *desc = irq_to_desc(irq);
2573
2298#ifdef CONFIG_X86_32 2574#ifdef CONFIG_X86_32
2299 unsigned long v; 2575 unsigned long v;
2300 int i; 2576 int i;
2301#endif 2577#endif
2578 struct irq_cfg *cfg;
2302 int do_unmask_irq = 0; 2579 int do_unmask_irq = 0;
2303 2580
2304 irq_complete_move(irq); 2581 irq_complete_move(&desc);
2305#ifdef CONFIG_GENERIC_PENDING_IRQ 2582#ifdef CONFIG_GENERIC_PENDING_IRQ
2306 /* If we are moving the irq we need to mask it */ 2583 /* If we are moving the irq we need to mask it */
2307 if (unlikely(irq_to_desc(irq)->status & IRQ_MOVE_PENDING)) { 2584 if (unlikely(desc->status & IRQ_MOVE_PENDING)) {
2308 do_unmask_irq = 1; 2585 do_unmask_irq = 1;
2309 mask_IO_APIC_irq(irq); 2586 mask_IO_APIC_irq_desc(desc);
2310 } 2587 }
2311#endif 2588#endif
2312 2589
@@ -2330,7 +2607,8 @@ static void ack_apic_level(unsigned int irq)
2330 * operation to prevent an edge-triggered interrupt escaping meanwhile. 2607 * operation to prevent an edge-triggered interrupt escaping meanwhile.
2331 * The idea is from Manfred Spraul. --macro 2608 * The idea is from Manfred Spraul. --macro
2332 */ 2609 */
2333 i = irq_cfg(irq)->vector; 2610 cfg = desc->chip_data;
2611 i = cfg->vector;
2334 2612
2335 v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1)); 2613 v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1));
2336#endif 2614#endif
@@ -2369,17 +2647,18 @@ static void ack_apic_level(unsigned int irq)
2369 * accurate and is causing problems then it is a hardware bug 2647 * accurate and is causing problems then it is a hardware bug
2370 * and you can go talk to the chipset vendor about it. 2648 * and you can go talk to the chipset vendor about it.
2371 */ 2649 */
2372 if (!io_apic_level_ack_pending(irq)) 2650 cfg = desc->chip_data;
2651 if (!io_apic_level_ack_pending(cfg))
2373 move_masked_irq(irq); 2652 move_masked_irq(irq);
2374 unmask_IO_APIC_irq(irq); 2653 unmask_IO_APIC_irq_desc(desc);
2375 } 2654 }
2376 2655
2377#ifdef CONFIG_X86_32 2656#ifdef CONFIG_X86_32
2378 if (!(v & (1 << (i & 0x1f)))) { 2657 if (!(v & (1 << (i & 0x1f)))) {
2379 atomic_inc(&irq_mis_count); 2658 atomic_inc(&irq_mis_count);
2380 spin_lock(&ioapic_lock); 2659 spin_lock(&ioapic_lock);
2381 __mask_and_edge_IO_APIC_irq(irq); 2660 __mask_and_edge_IO_APIC_irq(cfg);
2382 __unmask_and_level_IO_APIC_irq(irq); 2661 __unmask_and_level_IO_APIC_irq(cfg);
2383 spin_unlock(&ioapic_lock); 2662 spin_unlock(&ioapic_lock);
2384 } 2663 }
2385#endif 2664#endif
@@ -2430,20 +2709,19 @@ static inline void init_IO_APIC_traps(void)
2430 * Also, we've got to be careful not to trash gate 2709 * Also, we've got to be careful not to trash gate
2431 * 0x80, because int 0x80 is hm, kind of importantish. ;) 2710 * 0x80, because int 0x80 is hm, kind of importantish. ;)
2432 */ 2711 */
2433 for_each_irq_cfg(irq, cfg) { 2712 for_each_irq_desc(irq, desc) {
2434 if (IO_APIC_IRQ(irq) && !cfg->vector) { 2713 cfg = desc->chip_data;
2714 if (IO_APIC_IRQ(irq) && cfg && !cfg->vector) {
2435 /* 2715 /*
2436 * Hmm.. We don't have an entry for this, 2716 * Hmm.. We don't have an entry for this,
2437 * so default to an old-fashioned 8259 2717 * so default to an old-fashioned 8259
2438 * interrupt if we can.. 2718 * interrupt if we can..
2439 */ 2719 */
2440 if (irq < 16) 2720 if (irq < NR_IRQS_LEGACY)
2441 make_8259A_irq(irq); 2721 make_8259A_irq(irq);
2442 else { 2722 else
2443 desc = irq_to_desc(irq);
2444 /* Strange. Oh, well.. */ 2723 /* Strange. Oh, well.. */
2445 desc->chip = &no_irq_chip; 2724 desc->chip = &no_irq_chip;
2446 }
2447 } 2725 }
2448 } 2726 }
2449} 2727}
@@ -2468,7 +2746,7 @@ static void unmask_lapic_irq(unsigned int irq)
2468 apic_write(APIC_LVT0, v & ~APIC_LVT_MASKED); 2746 apic_write(APIC_LVT0, v & ~APIC_LVT_MASKED);
2469} 2747}
2470 2748
2471static void ack_lapic_irq (unsigned int irq) 2749static void ack_lapic_irq(unsigned int irq)
2472{ 2750{
2473 ack_APIC_irq(); 2751 ack_APIC_irq();
2474} 2752}
@@ -2480,11 +2758,8 @@ static struct irq_chip lapic_chip __read_mostly = {
2480 .ack = ack_lapic_irq, 2758 .ack = ack_lapic_irq,
2481}; 2759};
2482 2760
2483static void lapic_register_intr(int irq) 2761static void lapic_register_intr(int irq, struct irq_desc *desc)
2484{ 2762{
2485 struct irq_desc *desc;
2486
2487 desc = irq_to_desc(irq);
2488 desc->status &= ~IRQ_LEVEL; 2763 desc->status &= ~IRQ_LEVEL;
2489 set_irq_chip_and_handler_name(irq, &lapic_chip, handle_edge_irq, 2764 set_irq_chip_and_handler_name(irq, &lapic_chip, handle_edge_irq,
2490 "edge"); 2765 "edge");
@@ -2588,7 +2863,9 @@ int timer_through_8259 __initdata;
2588 */ 2863 */
2589static inline void __init check_timer(void) 2864static inline void __init check_timer(void)
2590{ 2865{
2591 struct irq_cfg *cfg = irq_cfg(0); 2866 struct irq_desc *desc = irq_to_desc(0);
2867 struct irq_cfg *cfg = desc->chip_data;
2868 int cpu = boot_cpu_id;
2592 int apic1, pin1, apic2, pin2; 2869 int apic1, pin1, apic2, pin2;
2593 unsigned long flags; 2870 unsigned long flags;
2594 unsigned int ver; 2871 unsigned int ver;
@@ -2603,7 +2880,7 @@ static inline void __init check_timer(void)
2603 * get/set the timer IRQ vector: 2880 * get/set the timer IRQ vector:
2604 */ 2881 */
2605 disable_8259A_irq(0); 2882 disable_8259A_irq(0);
2606 assign_irq_vector(0, TARGET_CPUS); 2883 assign_irq_vector(0, cfg, TARGET_CPUS);
2607 2884
2608 /* 2885 /*
2609 * As IRQ0 is to be enabled in the 8259A, the virtual 2886 * As IRQ0 is to be enabled in the 8259A, the virtual
@@ -2654,10 +2931,10 @@ static inline void __init check_timer(void)
2654 * Ok, does IRQ0 through the IOAPIC work? 2931 * Ok, does IRQ0 through the IOAPIC work?
2655 */ 2932 */
2656 if (no_pin1) { 2933 if (no_pin1) {
2657 add_pin_to_irq(0, apic1, pin1); 2934 add_pin_to_irq_cpu(cfg, cpu, apic1, pin1);
2658 setup_timer_IRQ0_pin(apic1, pin1, cfg->vector); 2935 setup_timer_IRQ0_pin(apic1, pin1, cfg->vector);
2659 } 2936 }
2660 unmask_IO_APIC_irq(0); 2937 unmask_IO_APIC_irq_desc(desc);
2661 if (timer_irq_works()) { 2938 if (timer_irq_works()) {
2662 if (nmi_watchdog == NMI_IO_APIC) { 2939 if (nmi_watchdog == NMI_IO_APIC) {
2663 setup_nmi(); 2940 setup_nmi();
@@ -2683,9 +2960,9 @@ static inline void __init check_timer(void)
2683 /* 2960 /*
2684 * legacy devices should be connected to IO APIC #0 2961 * legacy devices should be connected to IO APIC #0
2685 */ 2962 */
2686 replace_pin_at_irq(0, apic1, pin1, apic2, pin2); 2963 replace_pin_at_irq_cpu(cfg, cpu, apic1, pin1, apic2, pin2);
2687 setup_timer_IRQ0_pin(apic2, pin2, cfg->vector); 2964 setup_timer_IRQ0_pin(apic2, pin2, cfg->vector);
2688 unmask_IO_APIC_irq(0); 2965 unmask_IO_APIC_irq_desc(desc);
2689 enable_8259A_irq(0); 2966 enable_8259A_irq(0);
2690 if (timer_irq_works()) { 2967 if (timer_irq_works()) {
2691 apic_printk(APIC_QUIET, KERN_INFO "....... works.\n"); 2968 apic_printk(APIC_QUIET, KERN_INFO "....... works.\n");
@@ -2717,7 +2994,7 @@ static inline void __init check_timer(void)
2717 apic_printk(APIC_QUIET, KERN_INFO 2994 apic_printk(APIC_QUIET, KERN_INFO
2718 "...trying to set up timer as Virtual Wire IRQ...\n"); 2995 "...trying to set up timer as Virtual Wire IRQ...\n");
2719 2996
2720 lapic_register_intr(0); 2997 lapic_register_intr(0, desc);
2721 apic_write(APIC_LVT0, APIC_DM_FIXED | cfg->vector); /* Fixed mode */ 2998 apic_write(APIC_LVT0, APIC_DM_FIXED | cfg->vector); /* Fixed mode */
2722 enable_8259A_irq(0); 2999 enable_8259A_irq(0);
2723 3000
@@ -2902,22 +3179,26 @@ unsigned int create_irq_nr(unsigned int irq_want)
2902 unsigned int irq; 3179 unsigned int irq;
2903 unsigned int new; 3180 unsigned int new;
2904 unsigned long flags; 3181 unsigned long flags;
2905 struct irq_cfg *cfg_new; 3182 struct irq_cfg *cfg_new = NULL;
2906 3183 int cpu = boot_cpu_id;
2907 irq_want = nr_irqs - 1; 3184 struct irq_desc *desc_new = NULL;
2908 3185
2909 irq = 0; 3186 irq = 0;
2910 spin_lock_irqsave(&vector_lock, flags); 3187 spin_lock_irqsave(&vector_lock, flags);
2911 for (new = irq_want; new > 0; new--) { 3188 for (new = irq_want; new < NR_IRQS; new++) {
2912 if (platform_legacy_irq(new)) 3189 if (platform_legacy_irq(new))
2913 continue; 3190 continue;
2914 cfg_new = irq_cfg(new); 3191
2915 if (cfg_new && cfg_new->vector != 0) 3192 desc_new = irq_to_desc_alloc_cpu(new, cpu);
3193 if (!desc_new) {
3194 printk(KERN_INFO "can not get irq_desc for %d\n", new);
2916 continue; 3195 continue;
2917 /* check if need to create one */ 3196 }
2918 if (!cfg_new) 3197 cfg_new = desc_new->chip_data;
2919 cfg_new = irq_cfg_alloc(new); 3198
2920 if (__assign_irq_vector(new, TARGET_CPUS) == 0) 3199 if (cfg_new->vector != 0)
3200 continue;
3201 if (__assign_irq_vector(new, cfg_new, TARGET_CPUS) == 0)
2921 irq = new; 3202 irq = new;
2922 break; 3203 break;
2923 } 3204 }
@@ -2925,15 +3206,21 @@ unsigned int create_irq_nr(unsigned int irq_want)
2925 3206
2926 if (irq > 0) { 3207 if (irq > 0) {
2927 dynamic_irq_init(irq); 3208 dynamic_irq_init(irq);
3209 /* restore it, in case dynamic_irq_init clear it */
3210 if (desc_new)
3211 desc_new->chip_data = cfg_new;
2928 } 3212 }
2929 return irq; 3213 return irq;
2930} 3214}
2931 3215
3216static int nr_irqs_gsi = NR_IRQS_LEGACY;
2932int create_irq(void) 3217int create_irq(void)
2933{ 3218{
3219 unsigned int irq_want;
2934 int irq; 3220 int irq;
2935 3221
2936 irq = create_irq_nr(nr_irqs - 1); 3222 irq_want = nr_irqs_gsi;
3223 irq = create_irq_nr(irq_want);
2937 3224
2938 if (irq == 0) 3225 if (irq == 0)
2939 irq = -1; 3226 irq = -1;
@@ -2944,14 +3231,22 @@ int create_irq(void)
2944void destroy_irq(unsigned int irq) 3231void destroy_irq(unsigned int irq)
2945{ 3232{
2946 unsigned long flags; 3233 unsigned long flags;
3234 struct irq_cfg *cfg;
3235 struct irq_desc *desc;
2947 3236
3237 /* store it, in case dynamic_irq_cleanup clear it */
3238 desc = irq_to_desc(irq);
3239 cfg = desc->chip_data;
2948 dynamic_irq_cleanup(irq); 3240 dynamic_irq_cleanup(irq);
3241 /* connect back irq_cfg */
3242 if (desc)
3243 desc->chip_data = cfg;
2949 3244
2950#ifdef CONFIG_INTR_REMAP 3245#ifdef CONFIG_INTR_REMAP
2951 free_irte(irq); 3246 free_irte(irq);
2952#endif 3247#endif
2953 spin_lock_irqsave(&vector_lock, flags); 3248 spin_lock_irqsave(&vector_lock, flags);
2954 __clear_irq_vector(irq); 3249 __clear_irq_vector(irq, cfg);
2955 spin_unlock_irqrestore(&vector_lock, flags); 3250 spin_unlock_irqrestore(&vector_lock, flags);
2956} 3251}
2957 3252
@@ -2964,16 +3259,13 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms
2964 struct irq_cfg *cfg; 3259 struct irq_cfg *cfg;
2965 int err; 3260 int err;
2966 unsigned dest; 3261 unsigned dest;
2967 cpumask_t tmp;
2968 3262
2969 tmp = TARGET_CPUS; 3263 cfg = irq_cfg(irq);
2970 err = assign_irq_vector(irq, tmp); 3264 err = assign_irq_vector(irq, cfg, TARGET_CPUS);
2971 if (err) 3265 if (err)
2972 return err; 3266 return err;
2973 3267
2974 cfg = irq_cfg(irq); 3268 dest = cpu_mask_to_apicid_and(cfg->domain, TARGET_CPUS);
2975 cpus_and(tmp, cfg->domain, tmp);
2976 dest = cpu_mask_to_apicid(tmp);
2977 3269
2978#ifdef CONFIG_INTR_REMAP 3270#ifdef CONFIG_INTR_REMAP
2979 if (irq_remapped(irq)) { 3271 if (irq_remapped(irq)) {
@@ -3027,64 +3319,48 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms
3027} 3319}
3028 3320
3029#ifdef CONFIG_SMP 3321#ifdef CONFIG_SMP
3030static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask) 3322static void set_msi_irq_affinity(unsigned int irq, const struct cpumask *mask)
3031{ 3323{
3324 struct irq_desc *desc = irq_to_desc(irq);
3032 struct irq_cfg *cfg; 3325 struct irq_cfg *cfg;
3033 struct msi_msg msg; 3326 struct msi_msg msg;
3034 unsigned int dest; 3327 unsigned int dest;
3035 cpumask_t tmp;
3036 struct irq_desc *desc;
3037 3328
3038 cpus_and(tmp, mask, cpu_online_map); 3329 dest = set_desc_affinity(desc, mask);
3039 if (cpus_empty(tmp)) 3330 if (dest == BAD_APICID)
3040 return; 3331 return;
3041 3332
3042 if (assign_irq_vector(irq, mask)) 3333 cfg = desc->chip_data;
3043 return;
3044 3334
3045 cfg = irq_cfg(irq); 3335 read_msi_msg_desc(desc, &msg);
3046 cpus_and(tmp, cfg->domain, mask);
3047 dest = cpu_mask_to_apicid(tmp);
3048
3049 read_msi_msg(irq, &msg);
3050 3336
3051 msg.data &= ~MSI_DATA_VECTOR_MASK; 3337 msg.data &= ~MSI_DATA_VECTOR_MASK;
3052 msg.data |= MSI_DATA_VECTOR(cfg->vector); 3338 msg.data |= MSI_DATA_VECTOR(cfg->vector);
3053 msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK; 3339 msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK;
3054 msg.address_lo |= MSI_ADDR_DEST_ID(dest); 3340 msg.address_lo |= MSI_ADDR_DEST_ID(dest);
3055 3341
3056 write_msi_msg(irq, &msg); 3342 write_msi_msg_desc(desc, &msg);
3057 desc = irq_to_desc(irq);
3058 desc->affinity = mask;
3059} 3343}
3060
3061#ifdef CONFIG_INTR_REMAP 3344#ifdef CONFIG_INTR_REMAP
3062/* 3345/*
3063 * Migrate the MSI irq to another cpumask. This migration is 3346 * Migrate the MSI irq to another cpumask. This migration is
3064 * done in the process context using interrupt-remapping hardware. 3347 * done in the process context using interrupt-remapping hardware.
3065 */ 3348 */
3066static void ir_set_msi_irq_affinity(unsigned int irq, cpumask_t mask) 3349static void
3350ir_set_msi_irq_affinity(unsigned int irq, const struct cpumask *mask)
3067{ 3351{
3068 struct irq_cfg *cfg; 3352 struct irq_desc *desc = irq_to_desc(irq);
3353 struct irq_cfg *cfg = desc->chip_data;
3069 unsigned int dest; 3354 unsigned int dest;
3070 cpumask_t tmp, cleanup_mask;
3071 struct irte irte; 3355 struct irte irte;
3072 struct irq_desc *desc;
3073
3074 cpus_and(tmp, mask, cpu_online_map);
3075 if (cpus_empty(tmp))
3076 return;
3077 3356
3078 if (get_irte(irq, &irte)) 3357 if (get_irte(irq, &irte))
3079 return; 3358 return;
3080 3359
3081 if (assign_irq_vector(irq, mask)) 3360 dest = set_desc_affinity(desc, mask);
3361 if (dest == BAD_APICID)
3082 return; 3362 return;
3083 3363
3084 cfg = irq_cfg(irq);
3085 cpus_and(tmp, cfg->domain, mask);
3086 dest = cpu_mask_to_apicid(tmp);
3087
3088 irte.vector = cfg->vector; 3364 irte.vector = cfg->vector;
3089 irte.dest_id = IRTE_DEST(dest); 3365 irte.dest_id = IRTE_DEST(dest);
3090 3366
@@ -3098,16 +3374,10 @@ static void ir_set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
3098 * at the new destination. So, time to cleanup the previous 3374 * at the new destination. So, time to cleanup the previous
3099 * vector allocation. 3375 * vector allocation.
3100 */ 3376 */
3101 if (cfg->move_in_progress) { 3377 if (cfg->move_in_progress)
3102 cpus_and(cleanup_mask, cfg->old_domain, cpu_online_map); 3378 send_cleanup_vector(cfg);
3103 cfg->move_cleanup_count = cpus_weight(cleanup_mask);
3104 send_IPI_mask(cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
3105 cfg->move_in_progress = 0;
3106 }
3107
3108 desc = irq_to_desc(irq);
3109 desc->affinity = mask;
3110} 3379}
3380
3111#endif 3381#endif
3112#endif /* CONFIG_SMP */ 3382#endif /* CONFIG_SMP */
3113 3383
@@ -3166,7 +3436,7 @@ static int msi_alloc_irte(struct pci_dev *dev, int irq, int nvec)
3166} 3436}
3167#endif 3437#endif
3168 3438
3169static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc, int irq) 3439static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int irq)
3170{ 3440{
3171 int ret; 3441 int ret;
3172 struct msi_msg msg; 3442 struct msi_msg msg;
@@ -3175,7 +3445,7 @@ static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc, int irq)
3175 if (ret < 0) 3445 if (ret < 0)
3176 return ret; 3446 return ret;
3177 3447
3178 set_irq_msi(irq, desc); 3448 set_irq_msi(irq, msidesc);
3179 write_msi_msg(irq, &msg); 3449 write_msi_msg(irq, &msg);
3180 3450
3181#ifdef CONFIG_INTR_REMAP 3451#ifdef CONFIG_INTR_REMAP
@@ -3195,26 +3465,13 @@ static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc, int irq)
3195 return 0; 3465 return 0;
3196} 3466}
3197 3467
3198static unsigned int build_irq_for_pci_dev(struct pci_dev *dev) 3468int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc)
3199{
3200 unsigned int irq;
3201
3202 irq = dev->bus->number;
3203 irq <<= 8;
3204 irq |= dev->devfn;
3205 irq <<= 12;
3206
3207 return irq;
3208}
3209
3210int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
3211{ 3469{
3212 unsigned int irq; 3470 unsigned int irq;
3213 int ret; 3471 int ret;
3214 unsigned int irq_want; 3472 unsigned int irq_want;
3215 3473
3216 irq_want = build_irq_for_pci_dev(dev) + 0x100; 3474 irq_want = nr_irqs_gsi;
3217
3218 irq = create_irq_nr(irq_want); 3475 irq = create_irq_nr(irq_want);
3219 if (irq == 0) 3476 if (irq == 0)
3220 return -1; 3477 return -1;
@@ -3228,7 +3485,7 @@ int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
3228 goto error; 3485 goto error;
3229no_ir: 3486no_ir:
3230#endif 3487#endif
3231 ret = setup_msi_irq(dev, desc, irq); 3488 ret = setup_msi_irq(dev, msidesc, irq);
3232 if (ret < 0) { 3489 if (ret < 0) {
3233 destroy_irq(irq); 3490 destroy_irq(irq);
3234 return ret; 3491 return ret;
@@ -3246,7 +3503,7 @@ int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
3246{ 3503{
3247 unsigned int irq; 3504 unsigned int irq;
3248 int ret, sub_handle; 3505 int ret, sub_handle;
3249 struct msi_desc *desc; 3506 struct msi_desc *msidesc;
3250 unsigned int irq_want; 3507 unsigned int irq_want;
3251 3508
3252#ifdef CONFIG_INTR_REMAP 3509#ifdef CONFIG_INTR_REMAP
@@ -3254,10 +3511,11 @@ int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
3254 int index = 0; 3511 int index = 0;
3255#endif 3512#endif
3256 3513
3257 irq_want = build_irq_for_pci_dev(dev) + 0x100; 3514 irq_want = nr_irqs_gsi;
3258 sub_handle = 0; 3515 sub_handle = 0;
3259 list_for_each_entry(desc, &dev->msi_list, list) { 3516 list_for_each_entry(msidesc, &dev->msi_list, list) {
3260 irq = create_irq_nr(irq_want--); 3517 irq = create_irq_nr(irq_want);
3518 irq_want++;
3261 if (irq == 0) 3519 if (irq == 0)
3262 return -1; 3520 return -1;
3263#ifdef CONFIG_INTR_REMAP 3521#ifdef CONFIG_INTR_REMAP
@@ -3289,7 +3547,7 @@ int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
3289 } 3547 }
3290no_ir: 3548no_ir:
3291#endif 3549#endif
3292 ret = setup_msi_irq(dev, desc, irq); 3550 ret = setup_msi_irq(dev, msidesc, irq);
3293 if (ret < 0) 3551 if (ret < 0)
3294 goto error; 3552 goto error;
3295 sub_handle++; 3553 sub_handle++;
@@ -3308,24 +3566,18 @@ void arch_teardown_msi_irq(unsigned int irq)
3308 3566
3309#ifdef CONFIG_DMAR 3567#ifdef CONFIG_DMAR
3310#ifdef CONFIG_SMP 3568#ifdef CONFIG_SMP
3311static void dmar_msi_set_affinity(unsigned int irq, cpumask_t mask) 3569static void dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask)
3312{ 3570{
3571 struct irq_desc *desc = irq_to_desc(irq);
3313 struct irq_cfg *cfg; 3572 struct irq_cfg *cfg;
3314 struct msi_msg msg; 3573 struct msi_msg msg;
3315 unsigned int dest; 3574 unsigned int dest;
3316 cpumask_t tmp;
3317 struct irq_desc *desc;
3318 3575
3319 cpus_and(tmp, mask, cpu_online_map); 3576 dest = set_desc_affinity(desc, mask);
3320 if (cpus_empty(tmp)) 3577 if (dest == BAD_APICID)
3321 return; 3578 return;
3322 3579
3323 if (assign_irq_vector(irq, mask)) 3580 cfg = desc->chip_data;
3324 return;
3325
3326 cfg = irq_cfg(irq);
3327 cpus_and(tmp, cfg->domain, mask);
3328 dest = cpu_mask_to_apicid(tmp);
3329 3581
3330 dmar_msi_read(irq, &msg); 3582 dmar_msi_read(irq, &msg);
3331 3583
@@ -3335,9 +3587,8 @@ static void dmar_msi_set_affinity(unsigned int irq, cpumask_t mask)
3335 msg.address_lo |= MSI_ADDR_DEST_ID(dest); 3587 msg.address_lo |= MSI_ADDR_DEST_ID(dest);
3336 3588
3337 dmar_msi_write(irq, &msg); 3589 dmar_msi_write(irq, &msg);
3338 desc = irq_to_desc(irq);
3339 desc->affinity = mask;
3340} 3590}
3591
3341#endif /* CONFIG_SMP */ 3592#endif /* CONFIG_SMP */
3342 3593
3343struct irq_chip dmar_msi_type = { 3594struct irq_chip dmar_msi_type = {
@@ -3369,24 +3620,18 @@ int arch_setup_dmar_msi(unsigned int irq)
3369#ifdef CONFIG_HPET_TIMER 3620#ifdef CONFIG_HPET_TIMER
3370 3621
3371#ifdef CONFIG_SMP 3622#ifdef CONFIG_SMP
3372static void hpet_msi_set_affinity(unsigned int irq, cpumask_t mask) 3623static void hpet_msi_set_affinity(unsigned int irq, const struct cpumask *mask)
3373{ 3624{
3625 struct irq_desc *desc = irq_to_desc(irq);
3374 struct irq_cfg *cfg; 3626 struct irq_cfg *cfg;
3375 struct irq_desc *desc;
3376 struct msi_msg msg; 3627 struct msi_msg msg;
3377 unsigned int dest; 3628 unsigned int dest;
3378 cpumask_t tmp;
3379 3629
3380 cpus_and(tmp, mask, cpu_online_map); 3630 dest = set_desc_affinity(desc, mask);
3381 if (cpus_empty(tmp)) 3631 if (dest == BAD_APICID)
3382 return; 3632 return;
3383 3633
3384 if (assign_irq_vector(irq, mask)) 3634 cfg = desc->chip_data;
3385 return;
3386
3387 cfg = irq_cfg(irq);
3388 cpus_and(tmp, cfg->domain, mask);
3389 dest = cpu_mask_to_apicid(tmp);
3390 3635
3391 hpet_msi_read(irq, &msg); 3636 hpet_msi_read(irq, &msg);
3392 3637
@@ -3396,9 +3641,8 @@ static void hpet_msi_set_affinity(unsigned int irq, cpumask_t mask)
3396 msg.address_lo |= MSI_ADDR_DEST_ID(dest); 3641 msg.address_lo |= MSI_ADDR_DEST_ID(dest);
3397 3642
3398 hpet_msi_write(irq, &msg); 3643 hpet_msi_write(irq, &msg);
3399 desc = irq_to_desc(irq);
3400 desc->affinity = mask;
3401} 3644}
3645
3402#endif /* CONFIG_SMP */ 3646#endif /* CONFIG_SMP */
3403 3647
3404struct irq_chip hpet_msi_type = { 3648struct irq_chip hpet_msi_type = {
@@ -3451,28 +3695,21 @@ static void target_ht_irq(unsigned int irq, unsigned int dest, u8 vector)
3451 write_ht_irq_msg(irq, &msg); 3695 write_ht_irq_msg(irq, &msg);
3452} 3696}
3453 3697
3454static void set_ht_irq_affinity(unsigned int irq, cpumask_t mask) 3698static void set_ht_irq_affinity(unsigned int irq, const struct cpumask *mask)
3455{ 3699{
3700 struct irq_desc *desc = irq_to_desc(irq);
3456 struct irq_cfg *cfg; 3701 struct irq_cfg *cfg;
3457 unsigned int dest; 3702 unsigned int dest;
3458 cpumask_t tmp;
3459 struct irq_desc *desc;
3460 3703
3461 cpus_and(tmp, mask, cpu_online_map); 3704 dest = set_desc_affinity(desc, mask);
3462 if (cpus_empty(tmp)) 3705 if (dest == BAD_APICID)
3463 return; 3706 return;
3464 3707
3465 if (assign_irq_vector(irq, mask)) 3708 cfg = desc->chip_data;
3466 return;
3467
3468 cfg = irq_cfg(irq);
3469 cpus_and(tmp, cfg->domain, mask);
3470 dest = cpu_mask_to_apicid(tmp);
3471 3709
3472 target_ht_irq(irq, dest, cfg->vector); 3710 target_ht_irq(irq, dest, cfg->vector);
3473 desc = irq_to_desc(irq);
3474 desc->affinity = mask;
3475} 3711}
3712
3476#endif 3713#endif
3477 3714
3478static struct irq_chip ht_irq_chip = { 3715static struct irq_chip ht_irq_chip = {
@@ -3490,17 +3727,14 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
3490{ 3727{
3491 struct irq_cfg *cfg; 3728 struct irq_cfg *cfg;
3492 int err; 3729 int err;
3493 cpumask_t tmp;
3494 3730
3495 tmp = TARGET_CPUS; 3731 cfg = irq_cfg(irq);
3496 err = assign_irq_vector(irq, tmp); 3732 err = assign_irq_vector(irq, cfg, TARGET_CPUS);
3497 if (!err) { 3733 if (!err) {
3498 struct ht_irq_msg msg; 3734 struct ht_irq_msg msg;
3499 unsigned dest; 3735 unsigned dest;
3500 3736
3501 cfg = irq_cfg(irq); 3737 dest = cpu_mask_to_apicid_and(cfg->domain, TARGET_CPUS);
3502 cpus_and(tmp, cfg->domain, tmp);
3503 dest = cpu_mask_to_apicid(tmp);
3504 3738
3505 msg.address_hi = HT_IRQ_HIGH_DEST_ID(dest); 3739 msg.address_hi = HT_IRQ_HIGH_DEST_ID(dest);
3506 3740
@@ -3536,7 +3770,7 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
3536int arch_enable_uv_irq(char *irq_name, unsigned int irq, int cpu, int mmr_blade, 3770int arch_enable_uv_irq(char *irq_name, unsigned int irq, int cpu, int mmr_blade,
3537 unsigned long mmr_offset) 3771 unsigned long mmr_offset)
3538{ 3772{
3539 const cpumask_t *eligible_cpu = get_cpu_mask(cpu); 3773 const struct cpumask *eligible_cpu = cpumask_of(cpu);
3540 struct irq_cfg *cfg; 3774 struct irq_cfg *cfg;
3541 int mmr_pnode; 3775 int mmr_pnode;
3542 unsigned long mmr_value; 3776 unsigned long mmr_value;
@@ -3544,7 +3778,9 @@ int arch_enable_uv_irq(char *irq_name, unsigned int irq, int cpu, int mmr_blade,
3544 unsigned long flags; 3778 unsigned long flags;
3545 int err; 3779 int err;
3546 3780
3547 err = assign_irq_vector(irq, *eligible_cpu); 3781 cfg = irq_cfg(irq);
3782
3783 err = assign_irq_vector(irq, cfg, eligible_cpu);
3548 if (err != 0) 3784 if (err != 0)
3549 return err; 3785 return err;
3550 3786
@@ -3553,8 +3789,6 @@ int arch_enable_uv_irq(char *irq_name, unsigned int irq, int cpu, int mmr_blade,
3553 irq_name); 3789 irq_name);
3554 spin_unlock_irqrestore(&vector_lock, flags); 3790 spin_unlock_irqrestore(&vector_lock, flags);
3555 3791
3556 cfg = irq_cfg(irq);
3557
3558 mmr_value = 0; 3792 mmr_value = 0;
3559 entry = (struct uv_IO_APIC_route_entry *)&mmr_value; 3793 entry = (struct uv_IO_APIC_route_entry *)&mmr_value;
3560 BUG_ON(sizeof(struct uv_IO_APIC_route_entry) != sizeof(unsigned long)); 3794 BUG_ON(sizeof(struct uv_IO_APIC_route_entry) != sizeof(unsigned long));
@@ -3565,7 +3799,7 @@ int arch_enable_uv_irq(char *irq_name, unsigned int irq, int cpu, int mmr_blade,
3565 entry->polarity = 0; 3799 entry->polarity = 0;
3566 entry->trigger = 0; 3800 entry->trigger = 0;
3567 entry->mask = 0; 3801 entry->mask = 0;
3568 entry->dest = cpu_mask_to_apicid(*eligible_cpu); 3802 entry->dest = cpu_mask_to_apicid(eligible_cpu);
3569 3803
3570 mmr_pnode = uv_blade_to_pnode(mmr_blade); 3804 mmr_pnode = uv_blade_to_pnode(mmr_blade);
3571 uv_write_global_mmr64(mmr_pnode, mmr_offset, mmr_value); 3805 uv_write_global_mmr64(mmr_pnode, mmr_offset, mmr_value);
@@ -3606,9 +3840,16 @@ int __init io_apic_get_redir_entries (int ioapic)
3606 return reg_01.bits.entries; 3840 return reg_01.bits.entries;
3607} 3841}
3608 3842
3609int __init probe_nr_irqs(void) 3843void __init probe_nr_irqs_gsi(void)
3610{ 3844{
3611 return NR_IRQS; 3845 int idx;
3846 int nr = 0;
3847
3848 for (idx = 0; idx < nr_ioapics; idx++)
3849 nr += io_apic_get_redir_entries(idx) + 1;
3850
3851 if (nr > nr_irqs_gsi)
3852 nr_irqs_gsi = nr;
3612} 3853}
3613 3854
3614/* -------------------------------------------------------------------------- 3855/* --------------------------------------------------------------------------
@@ -3707,19 +3948,31 @@ int __init io_apic_get_version(int ioapic)
3707 3948
3708int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int polarity) 3949int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int polarity)
3709{ 3950{
3951 struct irq_desc *desc;
3952 struct irq_cfg *cfg;
3953 int cpu = boot_cpu_id;
3954
3710 if (!IO_APIC_IRQ(irq)) { 3955 if (!IO_APIC_IRQ(irq)) {
3711 apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n", 3956 apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
3712 ioapic); 3957 ioapic);
3713 return -EINVAL; 3958 return -EINVAL;
3714 } 3959 }
3715 3960
3961 desc = irq_to_desc_alloc_cpu(irq, cpu);
3962 if (!desc) {
3963 printk(KERN_INFO "can not get irq_desc %d\n", irq);
3964 return 0;
3965 }
3966
3716 /* 3967 /*
3717 * IRQs < 16 are already in the irq_2_pin[] map 3968 * IRQs < 16 are already in the irq_2_pin[] map
3718 */ 3969 */
3719 if (irq >= 16) 3970 if (irq >= NR_IRQS_LEGACY) {
3720 add_pin_to_irq(irq, ioapic, pin); 3971 cfg = desc->chip_data;
3972 add_pin_to_irq_cpu(cfg, cpu, ioapic, pin);
3973 }
3721 3974
3722 setup_IO_APIC_irq(ioapic, pin, irq, triggering, polarity); 3975 setup_IO_APIC_irq(ioapic, pin, irq, desc, triggering, polarity);
3723 3976
3724 return 0; 3977 return 0;
3725} 3978}
@@ -3757,7 +4010,7 @@ void __init setup_ioapic_dest(void)
3757 int pin, ioapic, irq, irq_entry; 4010 int pin, ioapic, irq, irq_entry;
3758 struct irq_desc *desc; 4011 struct irq_desc *desc;
3759 struct irq_cfg *cfg; 4012 struct irq_cfg *cfg;
3760 cpumask_t mask; 4013 const struct cpumask *mask;
3761 4014
3762 if (skip_ioapic_setup == 1) 4015 if (skip_ioapic_setup == 1)
3763 return; 4016 return;
@@ -3773,9 +4026,10 @@ void __init setup_ioapic_dest(void)
3773 * when you have too many devices, because at that time only boot 4026 * when you have too many devices, because at that time only boot
3774 * cpu is online. 4027 * cpu is online.
3775 */ 4028 */
3776 cfg = irq_cfg(irq); 4029 desc = irq_to_desc(irq);
4030 cfg = desc->chip_data;
3777 if (!cfg->vector) { 4031 if (!cfg->vector) {
3778 setup_IO_APIC_irq(ioapic, pin, irq, 4032 setup_IO_APIC_irq(ioapic, pin, irq, desc,
3779 irq_trigger(irq_entry), 4033 irq_trigger(irq_entry),
3780 irq_polarity(irq_entry)); 4034 irq_polarity(irq_entry));
3781 continue; 4035 continue;
@@ -3785,19 +4039,18 @@ void __init setup_ioapic_dest(void)
3785 /* 4039 /*
3786 * Honour affinities which have been set in early boot 4040 * Honour affinities which have been set in early boot
3787 */ 4041 */
3788 desc = irq_to_desc(irq);
3789 if (desc->status & 4042 if (desc->status &
3790 (IRQ_NO_BALANCING | IRQ_AFFINITY_SET)) 4043 (IRQ_NO_BALANCING | IRQ_AFFINITY_SET))
3791 mask = desc->affinity; 4044 mask = &desc->affinity;
3792 else 4045 else
3793 mask = TARGET_CPUS; 4046 mask = TARGET_CPUS;
3794 4047
3795#ifdef CONFIG_INTR_REMAP 4048#ifdef CONFIG_INTR_REMAP
3796 if (intr_remapping_enabled) 4049 if (intr_remapping_enabled)
3797 set_ir_ioapic_affinity_irq(irq, mask); 4050 set_ir_ioapic_affinity_irq_desc(desc, mask);
3798 else 4051 else
3799#endif 4052#endif
3800 set_ioapic_affinity_irq(irq, mask); 4053 set_ioapic_affinity_irq_desc(desc, mask);
3801 } 4054 }
3802 4055
3803 } 4056 }
@@ -3846,7 +4099,6 @@ void __init ioapic_init_mappings(void)
3846 struct resource *ioapic_res; 4099 struct resource *ioapic_res;
3847 int i; 4100 int i;
3848 4101
3849 irq_2_pin_init();
3850 ioapic_res = ioapic_setup_resources(); 4102 ioapic_res = ioapic_setup_resources();
3851 for (i = 0; i < nr_ioapics; i++) { 4103 for (i = 0; i < nr_ioapics; i++) {
3852 if (smp_found_config) { 4104 if (smp_found_config) {
diff --git a/arch/x86/kernel/ipi.c b/arch/x86/kernel/ipi.c
index f1c688e46f35..285bbf8831fa 100644
--- a/arch/x86/kernel/ipi.c
+++ b/arch/x86/kernel/ipi.c
@@ -116,18 +116,18 @@ static inline void __send_IPI_dest_field(unsigned long mask, int vector)
116/* 116/*
117 * This is only used on smaller machines. 117 * This is only used on smaller machines.
118 */ 118 */
119void send_IPI_mask_bitmask(cpumask_t cpumask, int vector) 119void send_IPI_mask_bitmask(const struct cpumask *cpumask, int vector)
120{ 120{
121 unsigned long mask = cpus_addr(cpumask)[0]; 121 unsigned long mask = cpumask_bits(cpumask)[0];
122 unsigned long flags; 122 unsigned long flags;
123 123
124 local_irq_save(flags); 124 local_irq_save(flags);
125 WARN_ON(mask & ~cpus_addr(cpu_online_map)[0]); 125 WARN_ON(mask & ~cpumask_bits(cpu_online_mask)[0]);
126 __send_IPI_dest_field(mask, vector); 126 __send_IPI_dest_field(mask, vector);
127 local_irq_restore(flags); 127 local_irq_restore(flags);
128} 128}
129 129
130void send_IPI_mask_sequence(cpumask_t mask, int vector) 130void send_IPI_mask_sequence(const struct cpumask *mask, int vector)
131{ 131{
132 unsigned long flags; 132 unsigned long flags;
133 unsigned int query_cpu; 133 unsigned int query_cpu;
@@ -139,12 +139,24 @@ void send_IPI_mask_sequence(cpumask_t mask, int vector)
139 */ 139 */
140 140
141 local_irq_save(flags); 141 local_irq_save(flags);
142 for_each_possible_cpu(query_cpu) { 142 for_each_cpu(query_cpu, mask)
143 if (cpu_isset(query_cpu, mask)) { 143 __send_IPI_dest_field(cpu_to_logical_apicid(query_cpu), vector);
144 local_irq_restore(flags);
145}
146
147void send_IPI_mask_allbutself(const struct cpumask *mask, int vector)
148{
149 unsigned long flags;
150 unsigned int query_cpu;
151 unsigned int this_cpu = smp_processor_id();
152
153 /* See Hack comment above */
154
155 local_irq_save(flags);
156 for_each_cpu(query_cpu, mask)
157 if (query_cpu != this_cpu)
144 __send_IPI_dest_field(cpu_to_logical_apicid(query_cpu), 158 __send_IPI_dest_field(cpu_to_logical_apicid(query_cpu),
145 vector); 159 vector);
146 }
147 }
148 local_irq_restore(flags); 160 local_irq_restore(flags);
149} 161}
150 162
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index d1d4dc52f649..bce53e1352a0 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -9,6 +9,7 @@
9#include <asm/apic.h> 9#include <asm/apic.h>
10#include <asm/io_apic.h> 10#include <asm/io_apic.h>
11#include <asm/smp.h> 11#include <asm/smp.h>
12#include <asm/irq.h>
12 13
13atomic_t irq_err_count; 14atomic_t irq_err_count;
14 15
@@ -118,6 +119,9 @@ int show_interrupts(struct seq_file *p, void *v)
118 } 119 }
119 120
120 desc = irq_to_desc(i); 121 desc = irq_to_desc(i);
122 if (!desc)
123 return 0;
124
121 spin_lock_irqsave(&desc->lock, flags); 125 spin_lock_irqsave(&desc->lock, flags);
122#ifndef CONFIG_SMP 126#ifndef CONFIG_SMP
123 any_count = kstat_irqs(i); 127 any_count = kstat_irqs(i);
@@ -187,3 +191,5 @@ u64 arch_irq_stat(void)
187#endif 191#endif
188 return sum; 192 return sum;
189} 193}
194
195EXPORT_SYMBOL_GPL(vector_used_by_percpu_irq);
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index a51382672de0..9dc5588f336a 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -233,25 +233,28 @@ unsigned int do_IRQ(struct pt_regs *regs)
233#ifdef CONFIG_HOTPLUG_CPU 233#ifdef CONFIG_HOTPLUG_CPU
234#include <mach_apic.h> 234#include <mach_apic.h>
235 235
236void fixup_irqs(cpumask_t map) 236/* A cpu has been removed from cpu_online_mask. Reset irq affinities. */
237void fixup_irqs(void)
237{ 238{
238 unsigned int irq; 239 unsigned int irq;
239 static int warned; 240 static int warned;
240 struct irq_desc *desc; 241 struct irq_desc *desc;
241 242
242 for_each_irq_desc(irq, desc) { 243 for_each_irq_desc(irq, desc) {
243 cpumask_t mask; 244 const struct cpumask *affinity;
244 245
246 if (!desc)
247 continue;
245 if (irq == 2) 248 if (irq == 2)
246 continue; 249 continue;
247 250
248 cpus_and(mask, desc->affinity, map); 251 affinity = &desc->affinity;
249 if (any_online_cpu(mask) == NR_CPUS) { 252 if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
250 printk("Breaking affinity for irq %i\n", irq); 253 printk("Breaking affinity for irq %i\n", irq);
251 mask = map; 254 affinity = cpu_all_mask;
252 } 255 }
253 if (desc->chip->set_affinity) 256 if (desc->chip->set_affinity)
254 desc->chip->set_affinity(irq, mask); 257 desc->chip->set_affinity(irq, affinity);
255 else if (desc->action && !(warned++)) 258 else if (desc->action && !(warned++))
256 printk("Cannot set affinity for irq %i\n", irq); 259 printk("Cannot set affinity for irq %i\n", irq);
257 } 260 }
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index 60eb84eb77a0..6383d50f82ea 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -13,12 +13,12 @@
13#include <linux/seq_file.h> 13#include <linux/seq_file.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/ftrace.h>
16#include <asm/uaccess.h> 17#include <asm/uaccess.h>
17#include <asm/io_apic.h> 18#include <asm/io_apic.h>
18#include <asm/idle.h> 19#include <asm/idle.h>
19#include <asm/smp.h> 20#include <asm/smp.h>
20 21
21#ifdef CONFIG_DEBUG_STACKOVERFLOW
22/* 22/*
23 * Probabilistic stack overflow check: 23 * Probabilistic stack overflow check:
24 * 24 *
@@ -28,26 +28,25 @@
28 */ 28 */
29static inline void stack_overflow_check(struct pt_regs *regs) 29static inline void stack_overflow_check(struct pt_regs *regs)
30{ 30{
31#ifdef CONFIG_DEBUG_STACKOVERFLOW
31 u64 curbase = (u64)task_stack_page(current); 32 u64 curbase = (u64)task_stack_page(current);
32 static unsigned long warned = -60*HZ; 33
33 34 WARN_ONCE(regs->sp >= curbase &&
34 if (regs->sp >= curbase && regs->sp <= curbase + THREAD_SIZE && 35 regs->sp <= curbase + THREAD_SIZE &&
35 regs->sp < curbase + sizeof(struct thread_info) + 128 && 36 regs->sp < curbase + sizeof(struct thread_info) +
36 time_after(jiffies, warned + 60*HZ)) { 37 sizeof(struct pt_regs) + 128,
37 printk("do_IRQ: %s near stack overflow (cur:%Lx,sp:%lx)\n", 38
38 current->comm, curbase, regs->sp); 39 "do_IRQ: %s near stack overflow (cur:%Lx,sp:%lx)\n",
39 show_stack(NULL,NULL); 40 current->comm, curbase, regs->sp);
40 warned = jiffies;
41 }
42}
43#endif 41#endif
42}
44 43
45/* 44/*
46 * do_IRQ handles all normal device IRQ's (the special 45 * do_IRQ handles all normal device IRQ's (the special
47 * SMP cross-CPU interrupts have their own specific 46 * SMP cross-CPU interrupts have their own specific
48 * handlers). 47 * handlers).
49 */ 48 */
50asmlinkage unsigned int do_IRQ(struct pt_regs *regs) 49asmlinkage unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
51{ 50{
52 struct pt_regs *old_regs = set_irq_regs(regs); 51 struct pt_regs *old_regs = set_irq_regs(regs);
53 struct irq_desc *desc; 52 struct irq_desc *desc;
@@ -60,9 +59,7 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
60 irq_enter(); 59 irq_enter();
61 irq = __get_cpu_var(vector_irq)[vector]; 60 irq = __get_cpu_var(vector_irq)[vector];
62 61
63#ifdef CONFIG_DEBUG_STACKOVERFLOW
64 stack_overflow_check(regs); 62 stack_overflow_check(regs);
65#endif
66 63
67 desc = irq_to_desc(irq); 64 desc = irq_to_desc(irq);
68 if (likely(desc)) 65 if (likely(desc))
@@ -83,40 +80,43 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
83} 80}
84 81
85#ifdef CONFIG_HOTPLUG_CPU 82#ifdef CONFIG_HOTPLUG_CPU
86void fixup_irqs(cpumask_t map) 83/* A cpu has been removed from cpu_online_mask. Reset irq affinities. */
84void fixup_irqs(void)
87{ 85{
88 unsigned int irq; 86 unsigned int irq;
89 static int warned; 87 static int warned;
90 struct irq_desc *desc; 88 struct irq_desc *desc;
91 89
92 for_each_irq_desc(irq, desc) { 90 for_each_irq_desc(irq, desc) {
93 cpumask_t mask;
94 int break_affinity = 0; 91 int break_affinity = 0;
95 int set_affinity = 1; 92 int set_affinity = 1;
93 const struct cpumask *affinity;
96 94
95 if (!desc)
96 continue;
97 if (irq == 2) 97 if (irq == 2)
98 continue; 98 continue;
99 99
100 /* interrupt's are disabled at this point */ 100 /* interrupt's are disabled at this point */
101 spin_lock(&desc->lock); 101 spin_lock(&desc->lock);
102 102
103 affinity = &desc->affinity;
103 if (!irq_has_action(irq) || 104 if (!irq_has_action(irq) ||
104 cpus_equal(desc->affinity, map)) { 105 cpumask_equal(affinity, cpu_online_mask)) {
105 spin_unlock(&desc->lock); 106 spin_unlock(&desc->lock);
106 continue; 107 continue;
107 } 108 }
108 109
109 cpus_and(mask, desc->affinity, map); 110 if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
110 if (cpus_empty(mask)) {
111 break_affinity = 1; 111 break_affinity = 1;
112 mask = map; 112 affinity = cpu_all_mask;
113 } 113 }
114 114
115 if (desc->chip->mask) 115 if (desc->chip->mask)
116 desc->chip->mask(irq); 116 desc->chip->mask(irq);
117 117
118 if (desc->chip->set_affinity) 118 if (desc->chip->set_affinity)
119 desc->chip->set_affinity(irq, mask); 119 desc->chip->set_affinity(irq, affinity);
120 else if (!(warned++)) 120 else if (!(warned++))
121 set_affinity = 0; 121 set_affinity = 0;
122 122
diff --git a/arch/x86/kernel/irqinit_32.c b/arch/x86/kernel/irqinit_32.c
index 845aa9803e80..84723295f88a 100644
--- a/arch/x86/kernel/irqinit_32.c
+++ b/arch/x86/kernel/irqinit_32.c
@@ -68,8 +68,7 @@ void __init init_ISA_irqs (void)
68 /* 68 /*
69 * 16 old-style INTA-cycle interrupts: 69 * 16 old-style INTA-cycle interrupts:
70 */ 70 */
71 for (i = 0; i < 16; i++) { 71 for (i = 0; i < NR_IRQS_LEGACY; i++) {
72 /* first time call this irq_desc */
73 struct irq_desc *desc = irq_to_desc(i); 72 struct irq_desc *desc = irq_to_desc(i);
74 73
75 desc->status = IRQ_DISABLED; 74 desc->status = IRQ_DISABLED;
@@ -111,6 +110,18 @@ DEFINE_PER_CPU(vector_irq_t, vector_irq) = {
111 [IRQ15_VECTOR + 1 ... NR_VECTORS - 1] = -1 110 [IRQ15_VECTOR + 1 ... NR_VECTORS - 1] = -1
112}; 111};
113 112
113int vector_used_by_percpu_irq(unsigned int vector)
114{
115 int cpu;
116
117 for_each_online_cpu(cpu) {
118 if (per_cpu(vector_irq, cpu)[vector] != -1)
119 return 1;
120 }
121
122 return 0;
123}
124
114/* Overridden in paravirt.c */ 125/* Overridden in paravirt.c */
115void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ"))); 126void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ")));
116 127
@@ -129,7 +140,7 @@ void __init native_init_IRQ(void)
129 for (i = FIRST_EXTERNAL_VECTOR; i < NR_VECTORS; i++) { 140 for (i = FIRST_EXTERNAL_VECTOR; i < NR_VECTORS; i++) {
130 /* SYSCALL_VECTOR was reserved in trap_init. */ 141 /* SYSCALL_VECTOR was reserved in trap_init. */
131 if (i != SYSCALL_VECTOR) 142 if (i != SYSCALL_VECTOR)
132 set_intr_gate(i, interrupt[i]); 143 set_intr_gate(i, interrupt[i-FIRST_EXTERNAL_VECTOR]);
133 } 144 }
134 145
135 146
@@ -147,10 +158,12 @@ void __init native_init_IRQ(void)
147 alloc_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt); 158 alloc_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt);
148 159
149 /* IPI for single call function */ 160 /* IPI for single call function */
150 set_intr_gate(CALL_FUNCTION_SINGLE_VECTOR, call_function_single_interrupt); 161 alloc_intr_gate(CALL_FUNCTION_SINGLE_VECTOR,
162 call_function_single_interrupt);
151 163
152 /* Low priority IPI to cleanup after moving an irq */ 164 /* Low priority IPI to cleanup after moving an irq */
153 set_intr_gate(IRQ_MOVE_CLEANUP_VECTOR, irq_move_cleanup_interrupt); 165 set_intr_gate(IRQ_MOVE_CLEANUP_VECTOR, irq_move_cleanup_interrupt);
166 set_bit(IRQ_MOVE_CLEANUP_VECTOR, used_vectors);
154#endif 167#endif
155 168
156#ifdef CONFIG_X86_LOCAL_APIC 169#ifdef CONFIG_X86_LOCAL_APIC
diff --git a/arch/x86/kernel/irqinit_64.c b/arch/x86/kernel/irqinit_64.c
index ff0235391285..31ebfe38e96c 100644
--- a/arch/x86/kernel/irqinit_64.c
+++ b/arch/x86/kernel/irqinit_64.c
@@ -24,41 +24,6 @@
24#include <asm/i8259.h> 24#include <asm/i8259.h>
25 25
26/* 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.text\n.p2align\n" \
47 "IRQ" #nr "_interrupt:\n\t" \
48 "push $~(" #nr ") ; " \
49 "jmp common_interrupt\n" \
50 ".previous");
51
52#define BI(x,y) \
53 BUILD_IRQ(x##y)
54
55#define BUILD_16_IRQS(x) \
56 BI(x,0) BI(x,1) BI(x,2) BI(x,3) \
57 BI(x,4) BI(x,5) BI(x,6) BI(x,7) \
58 BI(x,8) BI(x,9) BI(x,a) BI(x,b) \
59 BI(x,c) BI(x,d) BI(x,e) BI(x,f)
60
61/*
62 * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts: 27 * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts:
63 * (these are usually mapped to vectors 0x30-0x3f) 28 * (these are usually mapped to vectors 0x30-0x3f)
64 */ 29 */
@@ -73,37 +38,6 @@
73 * 38 *
74 * (these are usually mapped into the 0x30-0xff vector range) 39 * (these are usually mapped into the 0x30-0xff vector range)
75 */ 40 */
76 BUILD_16_IRQS(0x2) BUILD_16_IRQS(0x3)
77BUILD_16_IRQS(0x4) BUILD_16_IRQS(0x5) BUILD_16_IRQS(0x6) BUILD_16_IRQS(0x7)
78BUILD_16_IRQS(0x8) BUILD_16_IRQS(0x9) BUILD_16_IRQS(0xa) BUILD_16_IRQS(0xb)
79BUILD_16_IRQS(0xc) BUILD_16_IRQS(0xd) BUILD_16_IRQS(0xe) BUILD_16_IRQS(0xf)
80
81#undef BUILD_16_IRQS
82#undef BI
83
84
85#define IRQ(x,y) \
86 IRQ##x##y##_interrupt
87
88#define IRQLIST_16(x) \
89 IRQ(x,0), IRQ(x,1), IRQ(x,2), IRQ(x,3), \
90 IRQ(x,4), IRQ(x,5), IRQ(x,6), IRQ(x,7), \
91 IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \
92 IRQ(x,c), IRQ(x,d), IRQ(x,e), IRQ(x,f)
93
94/* for the irq vectors */
95static void (*__initdata interrupt[NR_VECTORS - FIRST_EXTERNAL_VECTOR])(void) = {
96 IRQLIST_16(0x2), IRQLIST_16(0x3),
97 IRQLIST_16(0x4), IRQLIST_16(0x5), IRQLIST_16(0x6), IRQLIST_16(0x7),
98 IRQLIST_16(0x8), IRQLIST_16(0x9), IRQLIST_16(0xa), IRQLIST_16(0xb),
99 IRQLIST_16(0xc), IRQLIST_16(0xd), IRQLIST_16(0xe), IRQLIST_16(0xf)
100};
101
102#undef IRQ
103#undef IRQLIST_16
104
105
106
107 41
108/* 42/*
109 * IRQ2 is cascade interrupt to second interrupt controller 43 * IRQ2 is cascade interrupt to second interrupt controller
@@ -135,6 +69,18 @@ DEFINE_PER_CPU(vector_irq_t, vector_irq) = {
135 [IRQ15_VECTOR + 1 ... NR_VECTORS - 1] = -1 69 [IRQ15_VECTOR + 1 ... NR_VECTORS - 1] = -1
136}; 70};
137 71
72int vector_used_by_percpu_irq(unsigned int vector)
73{
74 int cpu;
75
76 for_each_online_cpu(cpu) {
77 if (per_cpu(vector_irq, cpu)[vector] != -1)
78 return 1;
79 }
80
81 return 0;
82}
83
138void __init init_ISA_irqs(void) 84void __init init_ISA_irqs(void)
139{ 85{
140 int i; 86 int i;
@@ -142,8 +88,7 @@ void __init init_ISA_irqs(void)
142 init_bsp_APIC(); 88 init_bsp_APIC();
143 init_8259A(0); 89 init_8259A(0);
144 90
145 for (i = 0; i < 16; i++) { 91 for (i = 0; i < NR_IRQS_LEGACY; i++) {
146 /* first time call this irq_desc */
147 struct irq_desc *desc = irq_to_desc(i); 92 struct irq_desc *desc = irq_to_desc(i);
148 93
149 desc->status = IRQ_DISABLED; 94 desc->status = IRQ_DISABLED;
@@ -188,6 +133,7 @@ static void __init smp_intr_init(void)
188 133
189 /* Low priority IPI to cleanup after moving an irq */ 134 /* Low priority IPI to cleanup after moving an irq */
190 set_intr_gate(IRQ_MOVE_CLEANUP_VECTOR, irq_move_cleanup_interrupt); 135 set_intr_gate(IRQ_MOVE_CLEANUP_VECTOR, irq_move_cleanup_interrupt);
136 set_bit(IRQ_MOVE_CLEANUP_VECTOR, used_vectors);
191#endif 137#endif
192} 138}
193 139
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
index 6c27679ec6aa..eead6f8f9218 100644
--- a/arch/x86/kernel/kprobes.c
+++ b/arch/x86/kernel/kprobes.c
@@ -376,9 +376,10 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
376 376
377void __kprobes arch_remove_kprobe(struct kprobe *p) 377void __kprobes arch_remove_kprobe(struct kprobe *p)
378{ 378{
379 mutex_lock(&kprobe_mutex); 379 if (p->ainsn.insn) {
380 free_insn_slot(p->ainsn.insn, (p->ainsn.boostable == 1)); 380 free_insn_slot(p->ainsn.insn, (p->ainsn.boostable == 1));
381 mutex_unlock(&kprobe_mutex); 381 p->ainsn.insn = NULL;
382 }
382} 383}
383 384
384static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) 385static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index e169ae9b6a62..652fce6d2cce 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -89,17 +89,17 @@ static cycle_t kvm_clock_read(void)
89 */ 89 */
90static unsigned long kvm_get_tsc_khz(void) 90static unsigned long kvm_get_tsc_khz(void)
91{ 91{
92 return preset_lpj; 92 struct pvclock_vcpu_time_info *src;
93 src = &per_cpu(hv_clock, 0);
94 return pvclock_tsc_khz(src);
93} 95}
94 96
95static void kvm_get_preset_lpj(void) 97static void kvm_get_preset_lpj(void)
96{ 98{
97 struct pvclock_vcpu_time_info *src;
98 unsigned long khz; 99 unsigned long khz;
99 u64 lpj; 100 u64 lpj;
100 101
101 src = &per_cpu(hv_clock, 0); 102 khz = kvm_get_tsc_khz();
102 khz = pvclock_tsc_khz(src);
103 103
104 lpj = ((u64)khz * 1000); 104 lpj = ((u64)khz * 1000);
105 do_div(lpj, HZ); 105 do_div(lpj, HZ);
@@ -194,5 +194,7 @@ void __init kvmclock_init(void)
194#endif 194#endif
195 kvm_get_preset_lpj(); 195 kvm_get_preset_lpj();
196 clocksource_register(&kvm_clock); 196 clocksource_register(&kvm_clock);
197 pv_info.paravirt_enabled = 1;
198 pv_info.name = "KVM";
197 } 199 }
198} 200}
diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c
index eee32b43fee3..71f1d99a635d 100644
--- a/arch/x86/kernel/ldt.c
+++ b/arch/x86/kernel/ldt.c
@@ -12,8 +12,8 @@
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14#include <linux/vmalloc.h> 14#include <linux/vmalloc.h>
15#include <linux/uaccess.h>
15 16
16#include <asm/uaccess.h>
17#include <asm/system.h> 17#include <asm/system.h>
18#include <asm/ldt.h> 18#include <asm/ldt.h>
19#include <asm/desc.h> 19#include <asm/desc.h>
@@ -93,7 +93,7 @@ static inline int copy_ldt(mm_context_t *new, mm_context_t *old)
93 if (err < 0) 93 if (err < 0)
94 return err; 94 return err;
95 95
96 for(i = 0; i < old->size; i++) 96 for (i = 0; i < old->size; i++)
97 write_ldt_entry(new->ldt, i, old->ldt + i * LDT_ENTRY_SIZE); 97 write_ldt_entry(new->ldt, i, old->ldt + i * LDT_ENTRY_SIZE);
98 return 0; 98 return 0;
99} 99}
diff --git a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c
index 7a385746509a..37f420018a41 100644
--- a/arch/x86/kernel/machine_kexec_32.c
+++ b/arch/x86/kernel/machine_kexec_32.c
@@ -13,6 +13,7 @@
13#include <linux/numa.h> 13#include <linux/numa.h>
14#include <linux/ftrace.h> 14#include <linux/ftrace.h>
15#include <linux/suspend.h> 15#include <linux/suspend.h>
16#include <linux/gfp.h>
16 17
17#include <asm/pgtable.h> 18#include <asm/pgtable.h>
18#include <asm/pgalloc.h> 19#include <asm/pgalloc.h>
@@ -25,15 +26,6 @@
25#include <asm/system.h> 26#include <asm/system.h>
26#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
27 28
28#define PAGE_ALIGNED __attribute__ ((__aligned__(PAGE_SIZE)))
29static u32 kexec_pgd[1024] PAGE_ALIGNED;
30#ifdef CONFIG_X86_PAE
31static u32 kexec_pmd0[1024] PAGE_ALIGNED;
32static u32 kexec_pmd1[1024] PAGE_ALIGNED;
33#endif
34static u32 kexec_pte0[1024] PAGE_ALIGNED;
35static u32 kexec_pte1[1024] PAGE_ALIGNED;
36
37static void set_idt(void *newidt, __u16 limit) 29static void set_idt(void *newidt, __u16 limit)
38{ 30{
39 struct desc_ptr curidt; 31 struct desc_ptr curidt;
@@ -76,6 +68,76 @@ static void load_segments(void)
76#undef __STR 68#undef __STR
77} 69}
78 70
71static void machine_kexec_free_page_tables(struct kimage *image)
72{
73 free_page((unsigned long)image->arch.pgd);
74#ifdef CONFIG_X86_PAE
75 free_page((unsigned long)image->arch.pmd0);
76 free_page((unsigned long)image->arch.pmd1);
77#endif
78 free_page((unsigned long)image->arch.pte0);
79 free_page((unsigned long)image->arch.pte1);
80}
81
82static int machine_kexec_alloc_page_tables(struct kimage *image)
83{
84 image->arch.pgd = (pgd_t *)get_zeroed_page(GFP_KERNEL);
85#ifdef CONFIG_X86_PAE
86 image->arch.pmd0 = (pmd_t *)get_zeroed_page(GFP_KERNEL);
87 image->arch.pmd1 = (pmd_t *)get_zeroed_page(GFP_KERNEL);
88#endif
89 image->arch.pte0 = (pte_t *)get_zeroed_page(GFP_KERNEL);
90 image->arch.pte1 = (pte_t *)get_zeroed_page(GFP_KERNEL);
91 if (!image->arch.pgd ||
92#ifdef CONFIG_X86_PAE
93 !image->arch.pmd0 || !image->arch.pmd1 ||
94#endif
95 !image->arch.pte0 || !image->arch.pte1) {
96 machine_kexec_free_page_tables(image);
97 return -ENOMEM;
98 }
99 return 0;
100}
101
102static void machine_kexec_page_table_set_one(
103 pgd_t *pgd, pmd_t *pmd, pte_t *pte,
104 unsigned long vaddr, unsigned long paddr)
105{
106 pud_t *pud;
107
108 pgd += pgd_index(vaddr);
109#ifdef CONFIG_X86_PAE
110 if (!(pgd_val(*pgd) & _PAGE_PRESENT))
111 set_pgd(pgd, __pgd(__pa(pmd) | _PAGE_PRESENT));
112#endif
113 pud = pud_offset(pgd, vaddr);
114 pmd = pmd_offset(pud, vaddr);
115 if (!(pmd_val(*pmd) & _PAGE_PRESENT))
116 set_pmd(pmd, __pmd(__pa(pte) | _PAGE_TABLE));
117 pte = pte_offset_kernel(pmd, vaddr);
118 set_pte(pte, pfn_pte(paddr >> PAGE_SHIFT, PAGE_KERNEL_EXEC));
119}
120
121static void machine_kexec_prepare_page_tables(struct kimage *image)
122{
123 void *control_page;
124 pmd_t *pmd = 0;
125
126 control_page = page_address(image->control_code_page);
127#ifdef CONFIG_X86_PAE
128 pmd = image->arch.pmd0;
129#endif
130 machine_kexec_page_table_set_one(
131 image->arch.pgd, pmd, image->arch.pte0,
132 (unsigned long)control_page, __pa(control_page));
133#ifdef CONFIG_X86_PAE
134 pmd = image->arch.pmd1;
135#endif
136 machine_kexec_page_table_set_one(
137 image->arch.pgd, pmd, image->arch.pte1,
138 __pa(control_page), __pa(control_page));
139}
140
79/* 141/*
80 * A architecture hook called to validate the 142 * A architecture hook called to validate the
81 * proposed image and prepare the control pages 143 * proposed image and prepare the control pages
@@ -87,12 +149,20 @@ static void load_segments(void)
87 * reboot code buffer to allow us to avoid allocations 149 * reboot code buffer to allow us to avoid allocations
88 * later. 150 * later.
89 * 151 *
90 * Make control page executable. 152 * - Make control page executable.
153 * - Allocate page tables
154 * - Setup page tables
91 */ 155 */
92int machine_kexec_prepare(struct kimage *image) 156int machine_kexec_prepare(struct kimage *image)
93{ 157{
158 int error;
159
94 if (nx_enabled) 160 if (nx_enabled)
95 set_pages_x(image->control_code_page, 1); 161 set_pages_x(image->control_code_page, 1);
162 error = machine_kexec_alloc_page_tables(image);
163 if (error)
164 return error;
165 machine_kexec_prepare_page_tables(image);
96 return 0; 166 return 0;
97} 167}
98 168
@@ -104,6 +174,7 @@ void machine_kexec_cleanup(struct kimage *image)
104{ 174{
105 if (nx_enabled) 175 if (nx_enabled)
106 set_pages_nx(image->control_code_page, 1); 176 set_pages_nx(image->control_code_page, 1);
177 machine_kexec_free_page_tables(image);
107} 178}
108 179
109/* 180/*
@@ -150,18 +221,7 @@ void machine_kexec(struct kimage *image)
150 relocate_kernel_ptr = control_page; 221 relocate_kernel_ptr = control_page;
151 page_list[PA_CONTROL_PAGE] = __pa(control_page); 222 page_list[PA_CONTROL_PAGE] = __pa(control_page);
152 page_list[VA_CONTROL_PAGE] = (unsigned long)control_page; 223 page_list[VA_CONTROL_PAGE] = (unsigned long)control_page;
153 page_list[PA_PGD] = __pa(kexec_pgd); 224 page_list[PA_PGD] = __pa(image->arch.pgd);
154 page_list[VA_PGD] = (unsigned long)kexec_pgd;
155#ifdef CONFIG_X86_PAE
156 page_list[PA_PMD_0] = __pa(kexec_pmd0);
157 page_list[VA_PMD_0] = (unsigned long)kexec_pmd0;
158 page_list[PA_PMD_1] = __pa(kexec_pmd1);
159 page_list[VA_PMD_1] = (unsigned long)kexec_pmd1;
160#endif
161 page_list[PA_PTE_0] = __pa(kexec_pte0);
162 page_list[VA_PTE_0] = (unsigned long)kexec_pte0;
163 page_list[PA_PTE_1] = __pa(kexec_pte1);
164 page_list[VA_PTE_1] = (unsigned long)kexec_pte1;
165 225
166 if (image->type == KEXEC_TYPE_DEFAULT) 226 if (image->type == KEXEC_TYPE_DEFAULT)
167 page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page) 227 page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page)
diff --git a/arch/x86/kernel/mfgpt_32.c b/arch/x86/kernel/mfgpt_32.c
index 3b599518c322..c12314c9e86f 100644
--- a/arch/x86/kernel/mfgpt_32.c
+++ b/arch/x86/kernel/mfgpt_32.c
@@ -287,7 +287,7 @@ static struct clock_event_device mfgpt_clockevent = {
287 .set_mode = mfgpt_set_mode, 287 .set_mode = mfgpt_set_mode,
288 .set_next_event = mfgpt_next_event, 288 .set_next_event = mfgpt_next_event,
289 .rating = 250, 289 .rating = 250,
290 .cpumask = CPU_MASK_ALL, 290 .cpumask = cpu_all_mask,
291 .shift = 32 291 .shift = 32
292}; 292};
293 293
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index 5f8e5d75a254..c25fdb382292 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -10,7 +10,7 @@
10 * This driver allows to upgrade microcode on AMD 10 * This driver allows to upgrade microcode on AMD
11 * family 0x10 and 0x11 processors. 11 * family 0x10 and 0x11 processors.
12 * 12 *
13 * Licensed unter the terms of the GNU General Public 13 * Licensed under the terms of the GNU General Public
14 * License version 2. See file COPYING for details. 14 * License version 2. See file COPYING for details.
15*/ 15*/
16 16
@@ -32,9 +32,9 @@
32#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <linux/pci.h> 33#include <linux/pci.h>
34#include <linux/pci_ids.h> 34#include <linux/pci_ids.h>
35#include <linux/uaccess.h>
35 36
36#include <asm/msr.h> 37#include <asm/msr.h>
37#include <asm/uaccess.h>
38#include <asm/processor.h> 38#include <asm/processor.h>
39#include <asm/microcode.h> 39#include <asm/microcode.h>
40 40
@@ -47,43 +47,38 @@ MODULE_LICENSE("GPL v2");
47#define UCODE_UCODE_TYPE 0x00000001 47#define UCODE_UCODE_TYPE 0x00000001
48 48
49struct equiv_cpu_entry { 49struct equiv_cpu_entry {
50 unsigned int installed_cpu; 50 u32 installed_cpu;
51 unsigned int fixed_errata_mask; 51 u32 fixed_errata_mask;
52 unsigned int fixed_errata_compare; 52 u32 fixed_errata_compare;
53 unsigned int equiv_cpu; 53 u16 equiv_cpu;
54}; 54 u16 res;
55} __attribute__((packed));
55 56
56struct microcode_header_amd { 57struct microcode_header_amd {
57 unsigned int data_code; 58 u32 data_code;
58 unsigned int patch_id; 59 u32 patch_id;
59 unsigned char mc_patch_data_id[2]; 60 u16 mc_patch_data_id;
60 unsigned char mc_patch_data_len; 61 u8 mc_patch_data_len;
61 unsigned char init_flag; 62 u8 init_flag;
62 unsigned int mc_patch_data_checksum; 63 u32 mc_patch_data_checksum;
63 unsigned int nb_dev_id; 64 u32 nb_dev_id;
64 unsigned int sb_dev_id; 65 u32 sb_dev_id;
65 unsigned char processor_rev_id[2]; 66 u16 processor_rev_id;
66 unsigned char nb_rev_id; 67 u8 nb_rev_id;
67 unsigned char sb_rev_id; 68 u8 sb_rev_id;
68 unsigned char bios_api_rev; 69 u8 bios_api_rev;
69 unsigned char reserved1[3]; 70 u8 reserved1[3];
70 unsigned int match_reg[8]; 71 u32 match_reg[8];
71}; 72} __attribute__((packed));
72 73
73struct microcode_amd { 74struct microcode_amd {
74 struct microcode_header_amd hdr; 75 struct microcode_header_amd hdr;
75 unsigned int mpb[0]; 76 unsigned int mpb[0];
76}; 77};
77 78
78#define UCODE_MAX_SIZE (2048) 79#define UCODE_MAX_SIZE 2048
79#define DEFAULT_UCODE_DATASIZE (896) 80#define UCODE_CONTAINER_SECTION_HDR 8
80#define MC_HEADER_SIZE (sizeof(struct microcode_header_amd)) 81#define UCODE_CONTAINER_HEADER_SIZE 12
81#define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE)
82#define DWSIZE (sizeof(u32))
83/* For now we support a fixed ucode total size only */
84#define get_totalsize(mc) \
85 ((((struct microcode_amd *)mc)->hdr.mc_patch_data_len * 28) \
86 + MC_HEADER_SIZE)
87 82
88/* serialize access to the physical write */ 83/* serialize access to the physical write */
89static DEFINE_SPINLOCK(microcode_update_lock); 84static DEFINE_SPINLOCK(microcode_update_lock);
@@ -93,31 +88,24 @@ static struct equiv_cpu_entry *equiv_cpu_table;
93static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) 88static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig)
94{ 89{
95 struct cpuinfo_x86 *c = &cpu_data(cpu); 90 struct cpuinfo_x86 *c = &cpu_data(cpu);
91 u32 dummy;
96 92
97 memset(csig, 0, sizeof(*csig)); 93 memset(csig, 0, sizeof(*csig));
98
99 if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) { 94 if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) {
100 printk(KERN_ERR "microcode: CPU%d not a capable AMD processor\n", 95 printk(KERN_WARNING "microcode: CPU%d: AMD CPU family 0x%x not "
101 cpu); 96 "supported\n", cpu, c->x86);
102 return -1; 97 return -1;
103 } 98 }
104 99 rdmsr(MSR_AMD64_PATCH_LEVEL, csig->rev, dummy);
105 asm volatile("movl %1, %%ecx; rdmsr" 100 printk(KERN_INFO "microcode: CPU%d: patch_level=0x%x\n", cpu, csig->rev);
106 : "=a" (csig->rev)
107 : "i" (0x0000008B) : "ecx");
108
109 printk(KERN_INFO "microcode: collect_cpu_info_amd : patch_id=0x%x\n",
110 csig->rev);
111
112 return 0; 101 return 0;
113} 102}
114 103
115static int get_matching_microcode(int cpu, void *mc, int rev) 104static int get_matching_microcode(int cpu, void *mc, int rev)
116{ 105{
117 struct microcode_header_amd *mc_header = mc; 106 struct microcode_header_amd *mc_header = mc;
118 struct pci_dev *nb_pci_dev, *sb_pci_dev;
119 unsigned int current_cpu_id; 107 unsigned int current_cpu_id;
120 unsigned int equiv_cpu_id = 0x00; 108 u16 equiv_cpu_id = 0;
121 unsigned int i = 0; 109 unsigned int i = 0;
122 110
123 BUG_ON(equiv_cpu_table == NULL); 111 BUG_ON(equiv_cpu_table == NULL);
@@ -132,57 +120,25 @@ static int get_matching_microcode(int cpu, void *mc, int rev)
132 } 120 }
133 121
134 if (!equiv_cpu_id) { 122 if (!equiv_cpu_id) {
135 printk(KERN_ERR "microcode: CPU%d cpu_id " 123 printk(KERN_WARNING "microcode: CPU%d: cpu revision "
136 "not found in equivalent cpu table \n", cpu); 124 "not listed in equivalent cpu table\n", cpu);
137 return 0; 125 return 0;
138 } 126 }
139 127
140 if ((mc_header->processor_rev_id[0]) != (equiv_cpu_id & 0xff)) { 128 if (mc_header->processor_rev_id != equiv_cpu_id) {
141 printk(KERN_ERR 129 printk(KERN_ERR "microcode: CPU%d: patch mismatch "
142 "microcode: CPU%d patch does not match " 130 "(processor_rev_id: %x, equiv_cpu_id: %x)\n",
143 "(patch is %x, cpu extended is %x) \n", 131 cpu, mc_header->processor_rev_id, equiv_cpu_id);
144 cpu, mc_header->processor_rev_id[0],
145 (equiv_cpu_id & 0xff));
146 return 0; 132 return 0;
147 } 133 }
148 134
149 if ((mc_header->processor_rev_id[1]) != ((equiv_cpu_id >> 16) & 0xff)) { 135 /* ucode might be chipset specific -- currently we don't support this */
150 printk(KERN_ERR "microcode: CPU%d patch does not match " 136 if (mc_header->nb_dev_id || mc_header->sb_dev_id) {
151 "(patch is %x, cpu base id is %x) \n", 137 printk(KERN_ERR "microcode: CPU%d: loading of chipset "
152 cpu, mc_header->processor_rev_id[1], 138 "specific code not yet supported\n", cpu);
153 ((equiv_cpu_id >> 16) & 0xff));
154
155 return 0; 139 return 0;
156 } 140 }
157 141
158 /* ucode may be northbridge specific */
159 if (mc_header->nb_dev_id) {
160 nb_pci_dev = pci_get_device(PCI_VENDOR_ID_AMD,
161 (mc_header->nb_dev_id & 0xff),
162 NULL);
163 if ((!nb_pci_dev) ||
164 (mc_header->nb_rev_id != nb_pci_dev->revision)) {
165 printk(KERN_ERR "microcode: CPU%d NB mismatch \n", cpu);
166 pci_dev_put(nb_pci_dev);
167 return 0;
168 }
169 pci_dev_put(nb_pci_dev);
170 }
171
172 /* ucode may be southbridge specific */
173 if (mc_header->sb_dev_id) {
174 sb_pci_dev = pci_get_device(PCI_VENDOR_ID_AMD,
175 (mc_header->sb_dev_id & 0xff),
176 NULL);
177 if ((!sb_pci_dev) ||
178 (mc_header->sb_rev_id != sb_pci_dev->revision)) {
179 printk(KERN_ERR "microcode: CPU%d SB mismatch \n", cpu);
180 pci_dev_put(sb_pci_dev);
181 return 0;
182 }
183 pci_dev_put(sb_pci_dev);
184 }
185
186 if (mc_header->patch_id <= rev) 142 if (mc_header->patch_id <= rev)
187 return 0; 143 return 0;
188 144
@@ -192,12 +148,10 @@ static int get_matching_microcode(int cpu, void *mc, int rev)
192static void apply_microcode_amd(int cpu) 148static void apply_microcode_amd(int cpu)
193{ 149{
194 unsigned long flags; 150 unsigned long flags;
195 unsigned int eax, edx; 151 u32 rev, dummy;
196 unsigned int rev;
197 int cpu_num = raw_smp_processor_id(); 152 int cpu_num = raw_smp_processor_id();
198 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; 153 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
199 struct microcode_amd *mc_amd = uci->mc; 154 struct microcode_amd *mc_amd = uci->mc;
200 unsigned long addr;
201 155
202 /* We should bind the task to the CPU */ 156 /* We should bind the task to the CPU */
203 BUG_ON(cpu_num != cpu); 157 BUG_ON(cpu_num != cpu);
@@ -206,42 +160,34 @@ static void apply_microcode_amd(int cpu)
206 return; 160 return;
207 161
208 spin_lock_irqsave(&microcode_update_lock, flags); 162 spin_lock_irqsave(&microcode_update_lock, flags);
209 163 wrmsrl(MSR_AMD64_PATCH_LOADER, (u64)(long)&mc_amd->hdr.data_code);
210 addr = (unsigned long)&mc_amd->hdr.data_code;
211 edx = (unsigned int)(((unsigned long)upper_32_bits(addr)));
212 eax = (unsigned int)(((unsigned long)lower_32_bits(addr)));
213
214 asm volatile("movl %0, %%ecx; wrmsr" :
215 : "i" (0xc0010020), "a" (eax), "d" (edx) : "ecx");
216
217 /* get patch id after patching */ 164 /* get patch id after patching */
218 asm volatile("movl %1, %%ecx; rdmsr" 165 rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
219 : "=a" (rev)
220 : "i" (0x0000008B) : "ecx");
221
222 spin_unlock_irqrestore(&microcode_update_lock, flags); 166 spin_unlock_irqrestore(&microcode_update_lock, flags);
223 167
224 /* check current patch id and patch's id for match */ 168 /* check current patch id and patch's id for match */
225 if (rev != mc_amd->hdr.patch_id) { 169 if (rev != mc_amd->hdr.patch_id) {
226 printk(KERN_ERR "microcode: CPU%d update from revision " 170 printk(KERN_ERR "microcode: CPU%d: update failed "
227 "0x%x to 0x%x failed\n", cpu_num, 171 "(for patch_level=0x%x)\n", cpu, mc_amd->hdr.patch_id);
228 mc_amd->hdr.patch_id, rev);
229 return; 172 return;
230 } 173 }
231 174
232 printk(KERN_INFO "microcode: CPU%d updated from revision " 175 printk(KERN_INFO "microcode: CPU%d: updated (new patch_level=0x%x)\n",
233 "0x%x to 0x%x \n", 176 cpu, rev);
234 cpu_num, uci->cpu_sig.rev, mc_amd->hdr.patch_id);
235 177
236 uci->cpu_sig.rev = rev; 178 uci->cpu_sig.rev = rev;
237} 179}
238 180
239static void * get_next_ucode(u8 *buf, unsigned int size, 181static int get_ucode_data(void *to, const u8 *from, size_t n)
240 int (*get_ucode_data)(void *, const void *, size_t), 182{
241 unsigned int *mc_size) 183 memcpy(to, from, n);
184 return 0;
185}
186
187static void *get_next_ucode(const u8 *buf, unsigned int size,
188 unsigned int *mc_size)
242{ 189{
243 unsigned int total_size; 190 unsigned int total_size;
244#define UCODE_CONTAINER_SECTION_HDR 8
245 u8 section_hdr[UCODE_CONTAINER_SECTION_HDR]; 191 u8 section_hdr[UCODE_CONTAINER_SECTION_HDR];
246 void *mc; 192 void *mc;
247 193
@@ -249,39 +195,37 @@ static void * get_next_ucode(u8 *buf, unsigned int size,
249 return NULL; 195 return NULL;
250 196
251 if (section_hdr[0] != UCODE_UCODE_TYPE) { 197 if (section_hdr[0] != UCODE_UCODE_TYPE) {
252 printk(KERN_ERR "microcode: error! " 198 printk(KERN_ERR "microcode: error: invalid type field in "
253 "Wrong microcode payload type field\n"); 199 "container file section header\n");
254 return NULL; 200 return NULL;
255 } 201 }
256 202
257 total_size = (unsigned long) (section_hdr[4] + (section_hdr[5] << 8)); 203 total_size = (unsigned long) (section_hdr[4] + (section_hdr[5] << 8));
258 204
259 printk(KERN_INFO "microcode: size %u, total_size %u\n", 205 printk(KERN_DEBUG "microcode: size %u, total_size %u\n",
260 size, total_size); 206 size, total_size);
261 207
262 if (total_size > size || total_size > UCODE_MAX_SIZE) { 208 if (total_size > size || total_size > UCODE_MAX_SIZE) {
263 printk(KERN_ERR "microcode: error! Bad data in microcode data file\n"); 209 printk(KERN_ERR "microcode: error: size mismatch\n");
264 return NULL; 210 return NULL;
265 } 211 }
266 212
267 mc = vmalloc(UCODE_MAX_SIZE); 213 mc = vmalloc(UCODE_MAX_SIZE);
268 if (mc) { 214 if (mc) {
269 memset(mc, 0, UCODE_MAX_SIZE); 215 memset(mc, 0, UCODE_MAX_SIZE);
270 if (get_ucode_data(mc, buf + UCODE_CONTAINER_SECTION_HDR, total_size)) { 216 if (get_ucode_data(mc, buf + UCODE_CONTAINER_SECTION_HDR,
217 total_size)) {
271 vfree(mc); 218 vfree(mc);
272 mc = NULL; 219 mc = NULL;
273 } else 220 } else
274 *mc_size = total_size + UCODE_CONTAINER_SECTION_HDR; 221 *mc_size = total_size + UCODE_CONTAINER_SECTION_HDR;
275 } 222 }
276#undef UCODE_CONTAINER_SECTION_HDR
277 return mc; 223 return mc;
278} 224}
279 225
280 226
281static int install_equiv_cpu_table(u8 *buf, 227static int install_equiv_cpu_table(const u8 *buf)
282 int (*get_ucode_data)(void *, const void *, size_t))
283{ 228{
284#define UCODE_CONTAINER_HEADER_SIZE 12
285 u8 *container_hdr[UCODE_CONTAINER_HEADER_SIZE]; 229 u8 *container_hdr[UCODE_CONTAINER_HEADER_SIZE];
286 unsigned int *buf_pos = (unsigned int *)container_hdr; 230 unsigned int *buf_pos = (unsigned int *)container_hdr;
287 unsigned long size; 231 unsigned long size;
@@ -292,14 +236,15 @@ static int install_equiv_cpu_table(u8 *buf,
292 size = buf_pos[2]; 236 size = buf_pos[2];
293 237
294 if (buf_pos[1] != UCODE_EQUIV_CPU_TABLE_TYPE || !size) { 238 if (buf_pos[1] != UCODE_EQUIV_CPU_TABLE_TYPE || !size) {
295 printk(KERN_ERR "microcode: error! " 239 printk(KERN_ERR "microcode: error: invalid type field in "
296 "Wrong microcode equivalnet cpu table\n"); 240 "container file section header\n");
297 return 0; 241 return 0;
298 } 242 }
299 243
300 equiv_cpu_table = (struct equiv_cpu_entry *) vmalloc(size); 244 equiv_cpu_table = (struct equiv_cpu_entry *) vmalloc(size);
301 if (!equiv_cpu_table) { 245 if (!equiv_cpu_table) {
302 printk(KERN_ERR "microcode: error, can't allocate memory for equiv CPU table\n"); 246 printk(KERN_ERR "microcode: failed to allocate "
247 "equivalent CPU table\n");
303 return 0; 248 return 0;
304 } 249 }
305 250
@@ -310,7 +255,6 @@ static int install_equiv_cpu_table(u8 *buf,
310 } 255 }
311 256
312 return size + UCODE_CONTAINER_HEADER_SIZE; /* add header length */ 257 return size + UCODE_CONTAINER_HEADER_SIZE; /* add header length */
313#undef UCODE_CONTAINER_HEADER_SIZE
314} 258}
315 259
316static void free_equiv_cpu_table(void) 260static void free_equiv_cpu_table(void)
@@ -321,18 +265,20 @@ static void free_equiv_cpu_table(void)
321 } 265 }
322} 266}
323 267
324static int generic_load_microcode(int cpu, void *data, size_t size, 268static int generic_load_microcode(int cpu, const u8 *data, size_t size)
325 int (*get_ucode_data)(void *, const void *, size_t))
326{ 269{
327 struct ucode_cpu_info *uci = ucode_cpu_info + cpu; 270 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
328 u8 *ucode_ptr = data, *new_mc = NULL, *mc; 271 const u8 *ucode_ptr = data;
272 void *new_mc = NULL;
273 void *mc;
329 int new_rev = uci->cpu_sig.rev; 274 int new_rev = uci->cpu_sig.rev;
330 unsigned int leftover; 275 unsigned int leftover;
331 unsigned long offset; 276 unsigned long offset;
332 277
333 offset = install_equiv_cpu_table(ucode_ptr, get_ucode_data); 278 offset = install_equiv_cpu_table(ucode_ptr);
334 if (!offset) { 279 if (!offset) {
335 printk(KERN_ERR "microcode: installing equivalent cpu table failed\n"); 280 printk(KERN_ERR "microcode: failed to create "
281 "equivalent cpu table\n");
336 return -EINVAL; 282 return -EINVAL;
337 } 283 }
338 284
@@ -343,7 +289,7 @@ static int generic_load_microcode(int cpu, void *data, size_t size,
343 unsigned int uninitialized_var(mc_size); 289 unsigned int uninitialized_var(mc_size);
344 struct microcode_header_amd *mc_header; 290 struct microcode_header_amd *mc_header;
345 291
346 mc = get_next_ucode(ucode_ptr, leftover, get_ucode_data, &mc_size); 292 mc = get_next_ucode(ucode_ptr, leftover, &mc_size);
347 if (!mc) 293 if (!mc)
348 break; 294 break;
349 295
@@ -353,7 +299,7 @@ static int generic_load_microcode(int cpu, void *data, size_t size,
353 vfree(new_mc); 299 vfree(new_mc);
354 new_rev = mc_header->patch_id; 300 new_rev = mc_header->patch_id;
355 new_mc = mc; 301 new_mc = mc;
356 } else 302 } else
357 vfree(mc); 303 vfree(mc);
358 304
359 ucode_ptr += mc_size; 305 ucode_ptr += mc_size;
@@ -365,9 +311,9 @@ static int generic_load_microcode(int cpu, void *data, size_t size,
365 if (uci->mc) 311 if (uci->mc)
366 vfree(uci->mc); 312 vfree(uci->mc);
367 uci->mc = new_mc; 313 uci->mc = new_mc;
368 pr_debug("microcode: CPU%d found a matching microcode update with" 314 pr_debug("microcode: CPU%d found a matching microcode "
369 " version 0x%x (current=0x%x)\n", 315 "update with version 0x%x (current=0x%x)\n",
370 cpu, new_rev, uci->cpu_sig.rev); 316 cpu, new_rev, uci->cpu_sig.rev);
371 } else 317 } else
372 vfree(new_mc); 318 vfree(new_mc);
373 } 319 }
@@ -377,12 +323,6 @@ static int generic_load_microcode(int cpu, void *data, size_t size,
377 return (int)leftover; 323 return (int)leftover;
378} 324}
379 325
380static int get_ucode_fw(void *to, const void *from, size_t n)
381{
382 memcpy(to, from, n);
383 return 0;
384}
385
386static int request_microcode_fw(int cpu, struct device *device) 326static int request_microcode_fw(int cpu, struct device *device)
387{ 327{
388 const char *fw_name = "amd-ucode/microcode_amd.bin"; 328 const char *fw_name = "amd-ucode/microcode_amd.bin";
@@ -394,12 +334,11 @@ static int request_microcode_fw(int cpu, struct device *device)
394 334
395 ret = request_firmware(&firmware, fw_name, device); 335 ret = request_firmware(&firmware, fw_name, device);
396 if (ret) { 336 if (ret) {
397 printk(KERN_ERR "microcode: ucode data file %s load failed\n", fw_name); 337 printk(KERN_ERR "microcode: failed to load file %s\n", fw_name);
398 return ret; 338 return ret;
399 } 339 }
400 340
401 ret = generic_load_microcode(cpu, (void*)firmware->data, firmware->size, 341 ret = generic_load_microcode(cpu, firmware->data, firmware->size);
402 &get_ucode_fw);
403 342
404 release_firmware(firmware); 343 release_firmware(firmware);
405 344
@@ -408,8 +347,8 @@ static int request_microcode_fw(int cpu, struct device *device)
408 347
409static int request_microcode_user(int cpu, const void __user *buf, size_t size) 348static int request_microcode_user(int cpu, const void __user *buf, size_t size)
410{ 349{
411 printk(KERN_WARNING "microcode: AMD microcode update via /dev/cpu/microcode" 350 printk(KERN_INFO "microcode: AMD microcode update via "
412 "is not supported\n"); 351 "/dev/cpu/microcode not supported\n");
413 return -1; 352 return -1;
414} 353}
415 354
@@ -433,3 +372,4 @@ struct microcode_ops * __init init_amd_microcode(void)
433{ 372{
434 return &microcode_amd_ops; 373 return &microcode_amd_ops;
435} 374}
375
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index c4b5b24e0217..c9b721ba968c 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -99,7 +99,7 @@ MODULE_LICENSE("GPL");
99 99
100#define MICROCODE_VERSION "2.00" 100#define MICROCODE_VERSION "2.00"
101 101
102struct microcode_ops *microcode_ops; 102static struct microcode_ops *microcode_ops;
103 103
104/* no concurrent ->write()s are allowed on /dev/cpu/microcode */ 104/* no concurrent ->write()s are allowed on /dev/cpu/microcode */
105static DEFINE_MUTEX(microcode_mutex); 105static DEFINE_MUTEX(microcode_mutex);
@@ -203,7 +203,7 @@ MODULE_ALIAS_MISCDEV(MICROCODE_MINOR);
203#endif 203#endif
204 204
205/* fake device for request_firmware */ 205/* fake device for request_firmware */
206struct platform_device *microcode_pdev; 206static struct platform_device *microcode_pdev;
207 207
208static ssize_t reload_store(struct sys_device *dev, 208static ssize_t reload_store(struct sys_device *dev,
209 struct sysdev_attribute *attr, 209 struct sysdev_attribute *attr,
@@ -328,7 +328,7 @@ static int microcode_resume_cpu(int cpu)
328 return 0; 328 return 0;
329} 329}
330 330
331void microcode_update_cpu(int cpu) 331static void microcode_update_cpu(int cpu)
332{ 332{
333 struct ucode_cpu_info *uci = ucode_cpu_info + cpu; 333 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
334 int err = 0; 334 int err = 0;
diff --git a/arch/x86/kernel/microcode_intel.c b/arch/x86/kernel/microcode_intel.c
index a8e62792d171..b7f4c929e615 100644
--- a/arch/x86/kernel/microcode_intel.c
+++ b/arch/x86/kernel/microcode_intel.c
@@ -471,7 +471,7 @@ static void microcode_fini_cpu(int cpu)
471 uci->mc = NULL; 471 uci->mc = NULL;
472} 472}
473 473
474struct microcode_ops microcode_intel_ops = { 474static struct microcode_ops microcode_intel_ops = {
475 .request_microcode_user = request_microcode_user, 475 .request_microcode_user = request_microcode_user,
476 .request_microcode_fw = request_microcode_fw, 476 .request_microcode_fw = request_microcode_fw,
477 .collect_cpu_info = collect_cpu_info, 477 .collect_cpu_info = collect_cpu_info,
diff --git a/arch/x86/kernel/mmconf-fam10h_64.c b/arch/x86/kernel/mmconf-fam10h_64.c
index efc2f361fe85..666e43df51f9 100644
--- a/arch/x86/kernel/mmconf-fam10h_64.c
+++ b/arch/x86/kernel/mmconf-fam10h_64.c
@@ -13,8 +13,7 @@
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#include <asm/mmconfig.h>
16 16#include <asm/pci_x86.h>
17#include "../pci/pci.h"
18 17
19struct pci_hostbridge_probe { 18struct pci_hostbridge_probe {
20 u32 bus; 19 u32 bus;
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index 0f4c1fd5a1f4..c5c5b8df1dbc 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -16,14 +16,14 @@
16#include <linux/bitops.h> 16#include <linux/bitops.h>
17#include <linux/acpi.h> 17#include <linux/acpi.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/smp.h>
20#include <linux/acpi.h>
19 21
20#include <asm/smp.h>
21#include <asm/mtrr.h> 22#include <asm/mtrr.h>
22#include <asm/mpspec.h> 23#include <asm/mpspec.h>
23#include <asm/pgalloc.h> 24#include <asm/pgalloc.h>
24#include <asm/io_apic.h> 25#include <asm/io_apic.h>
25#include <asm/proto.h> 26#include <asm/proto.h>
26#include <asm/acpi.h>
27#include <asm/bios_ebda.h> 27#include <asm/bios_ebda.h>
28#include <asm/e820.h> 28#include <asm/e820.h>
29#include <asm/trampoline.h> 29#include <asm/trampoline.h>
@@ -95,8 +95,8 @@ static void __init MP_bus_info(struct mpc_config_bus *m)
95#endif 95#endif
96 96
97 if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA) - 1) == 0) { 97 if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA) - 1) == 0) {
98 set_bit(m->mpc_busid, mp_bus_not_pci); 98 set_bit(m->mpc_busid, mp_bus_not_pci);
99#if defined(CONFIG_EISA) || defined (CONFIG_MCA) 99#if defined(CONFIG_EISA) || defined(CONFIG_MCA)
100 mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA; 100 mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA;
101#endif 101#endif
102 } else if (strncmp(str, BUSTYPE_PCI, sizeof(BUSTYPE_PCI) - 1) == 0) { 102 } else if (strncmp(str, BUSTYPE_PCI, sizeof(BUSTYPE_PCI) - 1) == 0) {
@@ -104,7 +104,7 @@ static void __init MP_bus_info(struct mpc_config_bus *m)
104 x86_quirks->mpc_oem_pci_bus(m); 104 x86_quirks->mpc_oem_pci_bus(m);
105 105
106 clear_bit(m->mpc_busid, mp_bus_not_pci); 106 clear_bit(m->mpc_busid, mp_bus_not_pci);
107#if defined(CONFIG_EISA) || defined (CONFIG_MCA) 107#if defined(CONFIG_EISA) || defined(CONFIG_MCA)
108 mp_bus_id_to_type[m->mpc_busid] = MP_BUS_PCI; 108 mp_bus_id_to_type[m->mpc_busid] = MP_BUS_PCI;
109 } else if (strncmp(str, BUSTYPE_EISA, sizeof(BUSTYPE_EISA) - 1) == 0) { 109 } else if (strncmp(str, BUSTYPE_EISA, sizeof(BUSTYPE_EISA) - 1) == 0) {
110 mp_bus_id_to_type[m->mpc_busid] = MP_BUS_EISA; 110 mp_bus_id_to_type[m->mpc_busid] = MP_BUS_EISA;
@@ -586,26 +586,23 @@ static void __init __get_smp_config(unsigned int early)
586{ 586{
587 struct intel_mp_floating *mpf = mpf_found; 587 struct intel_mp_floating *mpf = mpf_found;
588 588
589 if (x86_quirks->mach_get_smp_config) { 589 if (!mpf)
590 if (x86_quirks->mach_get_smp_config(early)) 590 return;
591 return; 591
592 }
593 if (acpi_lapic && early) 592 if (acpi_lapic && early)
594 return; 593 return;
594
595 /* 595 /*
596 * ACPI supports both logical (e.g. Hyper-Threading) and physical 596 * MPS doesn't support hyperthreading, aka only have
597 * processors, where MPS only supports physical. 597 * thread 0 apic id in MPS table
598 */ 598 */
599 if (acpi_lapic && acpi_ioapic) { 599 if (acpi_lapic && acpi_ioapic)
600 printk(KERN_INFO "Using ACPI (MADT) for SMP configuration "
601 "information\n");
602 return; 600 return;
603 } else if (acpi_lapic)
604 printk(KERN_INFO "Using ACPI for processor (LAPIC) "
605 "configuration information\n");
606 601
607 if (!mpf) 602 if (x86_quirks->mach_get_smp_config) {
608 return; 603 if (x86_quirks->mach_get_smp_config(early))
604 return;
605 }
609 606
610 printk(KERN_INFO "Intel MultiProcessor Specification v1.%d\n", 607 printk(KERN_INFO "Intel MultiProcessor Specification v1.%d\n",
611 mpf->mpf_specification); 608 mpf->mpf_specification);
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index 82a7c7ed6d45..726266695b2c 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -136,7 +136,7 @@ static int msr_open(struct inode *inode, struct file *file)
136 lock_kernel(); 136 lock_kernel();
137 cpu = iminor(file->f_path.dentry->d_inode); 137 cpu = iminor(file->f_path.dentry->d_inode);
138 138
139 if (cpu >= NR_CPUS || !cpu_online(cpu)) { 139 if (cpu >= nr_cpu_ids || !cpu_online(cpu)) {
140 ret = -ENXIO; /* No such CPU */ 140 ret = -ENXIO; /* No such CPU */
141 goto out; 141 goto out;
142 } 142 }
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index 2c97f07f1c2c..45a09ccdc214 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -26,11 +26,10 @@
26#include <linux/kernel_stat.h> 26#include <linux/kernel_stat.h>
27#include <linux/kdebug.h> 27#include <linux/kdebug.h>
28#include <linux/smp.h> 28#include <linux/smp.h>
29#include <linux/nmi.h>
29 30
30#include <asm/i8259.h> 31#include <asm/i8259.h>
31#include <asm/io_apic.h> 32#include <asm/io_apic.h>
32#include <asm/smp.h>
33#include <asm/nmi.h>
34#include <asm/proto.h> 33#include <asm/proto.h>
35#include <asm/timer.h> 34#include <asm/timer.h>
36 35
@@ -131,6 +130,11 @@ static void report_broken_nmi(int cpu, int *prev_nmi_count)
131 atomic_dec(&nmi_active); 130 atomic_dec(&nmi_active);
132} 131}
133 132
133static void __acpi_nmi_disable(void *__unused)
134{
135 apic_write(APIC_LVT0, APIC_DM_NMI | APIC_LVT_MASKED);
136}
137
134int __init check_nmi_watchdog(void) 138int __init check_nmi_watchdog(void)
135{ 139{
136 unsigned int *prev_nmi_count; 140 unsigned int *prev_nmi_count;
@@ -179,8 +183,12 @@ int __init check_nmi_watchdog(void)
179 kfree(prev_nmi_count); 183 kfree(prev_nmi_count);
180 return 0; 184 return 0;
181error: 185error:
182 if (nmi_watchdog == NMI_IO_APIC && !timer_through_8259) 186 if (nmi_watchdog == NMI_IO_APIC) {
183 disable_8259A_irq(0); 187 if (!timer_through_8259)
188 disable_8259A_irq(0);
189 on_each_cpu(__acpi_nmi_disable, NULL, 1);
190 }
191
184#ifdef CONFIG_X86_32 192#ifdef CONFIG_X86_32
185 timer_ack = 0; 193 timer_ack = 0;
186#endif 194#endif
@@ -199,12 +207,17 @@ static int __init setup_nmi_watchdog(char *str)
199 ++str; 207 ++str;
200 } 208 }
201 209
202 get_option(&str, &nmi); 210 if (!strncmp(str, "lapic", 5))
203 211 nmi_watchdog = NMI_LOCAL_APIC;
204 if (nmi >= NMI_INVALID) 212 else if (!strncmp(str, "ioapic", 6))
205 return 0; 213 nmi_watchdog = NMI_IO_APIC;
214 else {
215 get_option(&str, &nmi);
216 if (nmi >= NMI_INVALID)
217 return 0;
218 nmi_watchdog = nmi;
219 }
206 220
207 nmi_watchdog = nmi;
208 return 1; 221 return 1;
209} 222}
210__setup("nmi_watchdog=", setup_nmi_watchdog); 223__setup("nmi_watchdog=", setup_nmi_watchdog);
@@ -285,11 +298,6 @@ void acpi_nmi_enable(void)
285 on_each_cpu(__acpi_nmi_enable, NULL, 1); 298 on_each_cpu(__acpi_nmi_enable, NULL, 1);
286} 299}
287 300
288static void __acpi_nmi_disable(void *__unused)
289{
290 apic_write(APIC_LVT0, APIC_DM_NMI | APIC_LVT_MASKED);
291}
292
293/* 301/*
294 * Disable timer based NMIs on all CPUs: 302 * Disable timer based NMIs on all CPUs:
295 */ 303 */
@@ -340,6 +348,8 @@ void stop_apic_nmi_watchdog(void *unused)
340 return; 348 return;
341 if (nmi_watchdog == NMI_LOCAL_APIC) 349 if (nmi_watchdog == NMI_LOCAL_APIC)
342 lapic_watchdog_stop(); 350 lapic_watchdog_stop();
351 else
352 __acpi_nmi_disable(NULL);
343 __get_cpu_var(wd_enabled) = 0; 353 __get_cpu_var(wd_enabled) = 0;
344 atomic_dec(&nmi_active); 354 atomic_dec(&nmi_active);
345} 355}
@@ -465,6 +475,24 @@ nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)
465 475
466#ifdef CONFIG_SYSCTL 476#ifdef CONFIG_SYSCTL
467 477
478static void enable_ioapic_nmi_watchdog_single(void *unused)
479{
480 __get_cpu_var(wd_enabled) = 1;
481 atomic_inc(&nmi_active);
482 __acpi_nmi_enable(NULL);
483}
484
485static void enable_ioapic_nmi_watchdog(void)
486{
487 on_each_cpu(enable_ioapic_nmi_watchdog_single, NULL, 1);
488 touch_nmi_watchdog();
489}
490
491static void disable_ioapic_nmi_watchdog(void)
492{
493 on_each_cpu(stop_apic_nmi_watchdog, NULL, 1);
494}
495
468static int __init setup_unknown_nmi_panic(char *str) 496static int __init setup_unknown_nmi_panic(char *str)
469{ 497{
470 unknown_nmi_panic = 1; 498 unknown_nmi_panic = 1;
@@ -507,6 +535,11 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
507 enable_lapic_nmi_watchdog(); 535 enable_lapic_nmi_watchdog();
508 else 536 else
509 disable_lapic_nmi_watchdog(); 537 disable_lapic_nmi_watchdog();
538 } else if (nmi_watchdog == NMI_IO_APIC) {
539 if (nmi_watchdog_enabled)
540 enable_ioapic_nmi_watchdog();
541 else
542 disable_ioapic_nmi_watchdog();
510 } else { 543 } else {
511 printk(KERN_WARNING 544 printk(KERN_WARNING
512 "NMI watchdog doesn't know what hardware to touch\n"); 545 "NMI watchdog doesn't know what hardware to touch\n");
diff --git a/arch/x86/kernel/numaq_32.c b/arch/x86/kernel/numaq_32.c
index 4caff39078e0..0deea37a53cf 100644
--- a/arch/x86/kernel/numaq_32.c
+++ b/arch/x86/kernel/numaq_32.c
@@ -31,7 +31,7 @@
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> 34#include <asm/genapic.h>
35#include <asm/e820.h> 35#include <asm/e820.h>
36#include <asm/setup.h> 36#include <asm/setup.h>
37 37
@@ -235,6 +235,13 @@ static int __init numaq_setup_ioapic_ids(void)
235 return 1; 235 return 1;
236} 236}
237 237
238static int __init numaq_update_genapic(void)
239{
240 genapic->wakeup_cpu = wakeup_secondary_cpu_via_nmi;
241
242 return 0;
243}
244
238static struct x86_quirks numaq_x86_quirks __initdata = { 245static struct x86_quirks numaq_x86_quirks __initdata = {
239 .arch_pre_time_init = numaq_pre_time_init, 246 .arch_pre_time_init = numaq_pre_time_init,
240 .arch_time_init = NULL, 247 .arch_time_init = NULL,
@@ -250,6 +257,7 @@ static struct x86_quirks numaq_x86_quirks __initdata = {
250 .mpc_oem_pci_bus = mpc_oem_pci_bus, 257 .mpc_oem_pci_bus = mpc_oem_pci_bus,
251 .smp_read_mpc_oem = smp_read_mpc_oem, 258 .smp_read_mpc_oem = smp_read_mpc_oem,
252 .setup_ioapic_ids = numaq_setup_ioapic_ids, 259 .setup_ioapic_ids = numaq_setup_ioapic_ids,
260 .update_genapic = numaq_update_genapic,
253}; 261};
254 262
255void numaq_mps_oem_check(struct mp_config_table *mpc, char *oem, 263void numaq_mps_oem_check(struct mp_config_table *mpc, char *oem,
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 192624820217..19a1044a0cd9 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -6,6 +6,7 @@
6#include <asm/proto.h> 6#include <asm/proto.h>
7#include <asm/dma.h> 7#include <asm/dma.h>
8#include <asm/iommu.h> 8#include <asm/iommu.h>
9#include <asm/gart.h>
9#include <asm/calgary.h> 10#include <asm/calgary.h>
10#include <asm/amd_iommu.h> 11#include <asm/amd_iommu.h>
11 12
@@ -30,11 +31,6 @@ int no_iommu __read_mostly;
30/* Set this to 1 if there is a HW IOMMU in the system */ 31/* Set this to 1 if there is a HW IOMMU in the system */
31int iommu_detected __read_mostly = 0; 32int iommu_detected __read_mostly = 0;
32 33
33/* This tells the BIO block layer to assume merging. Default to off
34 because we cannot guarantee merging later. */
35int iommu_bio_merge __read_mostly = 0;
36EXPORT_SYMBOL(iommu_bio_merge);
37
38dma_addr_t bad_dma_address __read_mostly = 0; 34dma_addr_t bad_dma_address __read_mostly = 0;
39EXPORT_SYMBOL(bad_dma_address); 35EXPORT_SYMBOL(bad_dma_address);
40 36
@@ -105,11 +101,15 @@ static void __init dma32_free_bootmem(void)
105 dma32_bootmem_ptr = NULL; 101 dma32_bootmem_ptr = NULL;
106 dma32_bootmem_size = 0; 102 dma32_bootmem_size = 0;
107} 103}
104#endif
108 105
109void __init pci_iommu_alloc(void) 106void __init pci_iommu_alloc(void)
110{ 107{
108#ifdef CONFIG_X86_64
111 /* free the range so iommu could get some range less than 4G */ 109 /* free the range so iommu could get some range less than 4G */
112 dma32_free_bootmem(); 110 dma32_free_bootmem();
111#endif
112
113 /* 113 /*
114 * The order of these functions is important for 114 * The order of these functions is important for
115 * fall-back/fail-over reasons 115 * fall-back/fail-over reasons
@@ -125,15 +125,6 @@ void __init pci_iommu_alloc(void)
125 pci_swiotlb_init(); 125 pci_swiotlb_init();
126} 126}
127 127
128unsigned long iommu_nr_pages(unsigned long addr, unsigned long len)
129{
130 unsigned long size = roundup((addr & ~PAGE_MASK) + len, PAGE_SIZE);
131
132 return size >> PAGE_SHIFT;
133}
134EXPORT_SYMBOL(iommu_nr_pages);
135#endif
136
137void *dma_generic_alloc_coherent(struct device *dev, size_t size, 128void *dma_generic_alloc_coherent(struct device *dev, size_t size,
138 dma_addr_t *dma_addr, gfp_t flag) 129 dma_addr_t *dma_addr, gfp_t flag)
139{ 130{
@@ -188,7 +179,6 @@ static __init int iommu_setup(char *p)
188 } 179 }
189 180
190 if (!strncmp(p, "biomerge", 8)) { 181 if (!strncmp(p, "biomerge", 8)) {
191 iommu_bio_merge = 4096;
192 iommu_merge = 1; 182 iommu_merge = 1;
193 force_iommu = 1; 183 force_iommu = 1;
194 } 184 }
@@ -300,8 +290,8 @@ fs_initcall(pci_iommu_init);
300static __devinit void via_no_dac(struct pci_dev *dev) 290static __devinit void via_no_dac(struct pci_dev *dev)
301{ 291{
302 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI && forbid_dac == 0) { 292 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI && forbid_dac == 0) {
303 printk(KERN_INFO "PCI: VIA PCI bridge detected." 293 printk(KERN_INFO
304 "Disabling DAC.\n"); 294 "PCI: VIA PCI bridge detected. Disabling DAC.\n");
305 forbid_dac = 1; 295 forbid_dac = 1;
306 } 296 }
307} 297}
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index a35eaa379ff6..00c2bcd41463 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -52,7 +52,7 @@ static u32 *iommu_gatt_base; /* Remapping table */
52 * to trigger bugs with some popular PCI cards, in particular 3ware (but 52 * to trigger bugs with some popular PCI cards, in particular 3ware (but
53 * has been also also seen with Qlogic at least). 53 * has been also also seen with Qlogic at least).
54 */ 54 */
55int iommu_fullflush = 1; 55static int iommu_fullflush = 1;
56 56
57/* Allocation bitmap for the remapping area: */ 57/* Allocation bitmap for the remapping area: */
58static DEFINE_SPINLOCK(iommu_bitmap_lock); 58static DEFINE_SPINLOCK(iommu_bitmap_lock);
diff --git a/arch/x86/kernel/pci-swiotlb_64.c b/arch/x86/kernel/pci-swiotlb_64.c
index 3c539d111abb..d59c91747665 100644
--- a/arch/x86/kernel/pci-swiotlb_64.c
+++ b/arch/x86/kernel/pci-swiotlb_64.c
@@ -3,6 +3,8 @@
3#include <linux/pci.h> 3#include <linux/pci.h>
4#include <linux/cache.h> 4#include <linux/cache.h>
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/swiotlb.h>
7#include <linux/bootmem.h>
6#include <linux/dma-mapping.h> 8#include <linux/dma-mapping.h>
7 9
8#include <asm/iommu.h> 10#include <asm/iommu.h>
@@ -11,6 +13,31 @@
11 13
12int swiotlb __read_mostly; 14int swiotlb __read_mostly;
13 15
16void * __init swiotlb_alloc_boot(size_t size, unsigned long nslabs)
17{
18 return alloc_bootmem_low_pages(size);
19}
20
21void *swiotlb_alloc(unsigned order, unsigned long nslabs)
22{
23 return (void *)__get_free_pages(GFP_DMA | __GFP_NOWARN, order);
24}
25
26dma_addr_t swiotlb_phys_to_bus(struct device *hwdev, phys_addr_t paddr)
27{
28 return paddr;
29}
30
31phys_addr_t swiotlb_bus_to_phys(dma_addr_t baddr)
32{
33 return baddr;
34}
35
36int __weak swiotlb_arch_range_needs_mapping(void *ptr, size_t size)
37{
38 return 0;
39}
40
14static dma_addr_t 41static dma_addr_t
15swiotlb_map_single_phys(struct device *hwdev, phys_addr_t paddr, size_t size, 42swiotlb_map_single_phys(struct device *hwdev, phys_addr_t paddr, size_t size,
16 int direction) 43 int direction)
@@ -50,8 +77,10 @@ struct dma_mapping_ops swiotlb_dma_ops = {
50void __init pci_swiotlb_init(void) 77void __init pci_swiotlb_init(void)
51{ 78{
52 /* don't initialize swiotlb if iommu=off (no_iommu=1) */ 79 /* don't initialize swiotlb if iommu=off (no_iommu=1) */
80#ifdef CONFIG_X86_64
53 if (!iommu_detected && !no_iommu && max_pfn > MAX_DMA32_PFN) 81 if (!iommu_detected && !no_iommu && max_pfn > MAX_DMA32_PFN)
54 swiotlb = 1; 82 swiotlb = 1;
83#endif
55 if (swiotlb_force) 84 if (swiotlb_force)
56 swiotlb = 1; 85 swiotlb = 1;
57 if (swiotlb) { 86 if (swiotlb) {
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index c622772744d8..e68bb9e30864 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -1,13 +1,16 @@
1#include <linux/errno.h> 1#include <linux/errno.h>
2#include <linux/kernel.h> 2#include <linux/kernel.h>
3#include <linux/mm.h> 3#include <linux/mm.h>
4#include <asm/idle.h>
4#include <linux/smp.h> 5#include <linux/smp.h>
5#include <linux/slab.h> 6#include <linux/slab.h>
6#include <linux/sched.h> 7#include <linux/sched.h>
7#include <linux/module.h> 8#include <linux/module.h>
8#include <linux/pm.h> 9#include <linux/pm.h>
9#include <linux/clockchips.h> 10#include <linux/clockchips.h>
11#include <linux/ftrace.h>
10#include <asm/system.h> 12#include <asm/system.h>
13#include <asm/apic.h>
11 14
12unsigned long idle_halt; 15unsigned long idle_halt;
13EXPORT_SYMBOL(idle_halt); 16EXPORT_SYMBOL(idle_halt);
@@ -100,6 +103,9 @@ static inline int hlt_use_halt(void)
100void default_idle(void) 103void default_idle(void)
101{ 104{
102 if (hlt_use_halt()) { 105 if (hlt_use_halt()) {
106 struct power_trace it;
107
108 trace_power_start(&it, POWER_CSTATE, 1);
103 current_thread_info()->status &= ~TS_POLLING; 109 current_thread_info()->status &= ~TS_POLLING;
104 /* 110 /*
105 * TS_POLLING-cleared state must be visible before we 111 * TS_POLLING-cleared state must be visible before we
@@ -112,6 +118,7 @@ void default_idle(void)
112 else 118 else
113 local_irq_enable(); 119 local_irq_enable();
114 current_thread_info()->status |= TS_POLLING; 120 current_thread_info()->status |= TS_POLLING;
121 trace_power_end(&it);
115 } else { 122 } else {
116 local_irq_enable(); 123 local_irq_enable();
117 /* loop is done by the caller */ 124 /* loop is done by the caller */
@@ -122,6 +129,21 @@ void default_idle(void)
122EXPORT_SYMBOL(default_idle); 129EXPORT_SYMBOL(default_idle);
123#endif 130#endif
124 131
132void stop_this_cpu(void *dummy)
133{
134 local_irq_disable();
135 /*
136 * Remove this CPU:
137 */
138 cpu_clear(smp_processor_id(), cpu_online_map);
139 disable_local_APIC();
140
141 for (;;) {
142 if (hlt_works(smp_processor_id()))
143 halt();
144 }
145}
146
125static void do_nothing(void *unused) 147static void do_nothing(void *unused)
126{ 148{
127} 149}
@@ -154,24 +176,31 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait);
154 */ 176 */
155void mwait_idle_with_hints(unsigned long ax, unsigned long cx) 177void mwait_idle_with_hints(unsigned long ax, unsigned long cx)
156{ 178{
179 struct power_trace it;
180
181 trace_power_start(&it, POWER_CSTATE, (ax>>4)+1);
157 if (!need_resched()) { 182 if (!need_resched()) {
158 __monitor((void *)&current_thread_info()->flags, 0, 0); 183 __monitor((void *)&current_thread_info()->flags, 0, 0);
159 smp_mb(); 184 smp_mb();
160 if (!need_resched()) 185 if (!need_resched())
161 __mwait(ax, cx); 186 __mwait(ax, cx);
162 } 187 }
188 trace_power_end(&it);
163} 189}
164 190
165/* Default MONITOR/MWAIT with no hints, used for default C1 state */ 191/* Default MONITOR/MWAIT with no hints, used for default C1 state */
166static void mwait_idle(void) 192static void mwait_idle(void)
167{ 193{
194 struct power_trace it;
168 if (!need_resched()) { 195 if (!need_resched()) {
196 trace_power_start(&it, POWER_CSTATE, 1);
169 __monitor((void *)&current_thread_info()->flags, 0, 0); 197 __monitor((void *)&current_thread_info()->flags, 0, 0);
170 smp_mb(); 198 smp_mb();
171 if (!need_resched()) 199 if (!need_resched())
172 __sti_mwait(0, 0); 200 __sti_mwait(0, 0);
173 else 201 else
174 local_irq_enable(); 202 local_irq_enable();
203 trace_power_end(&it);
175 } else 204 } else
176 local_irq_enable(); 205 local_irq_enable();
177} 206}
@@ -183,9 +212,13 @@ static void mwait_idle(void)
183 */ 212 */
184static void poll_idle(void) 213static void poll_idle(void)
185{ 214{
215 struct power_trace it;
216
217 trace_power_start(&it, POWER_CSTATE, 0);
186 local_irq_enable(); 218 local_irq_enable();
187 while (!need_resched()) 219 while (!need_resched())
188 cpu_relax(); 220 cpu_relax();
221 trace_power_end(&it);
189} 222}
190 223
191/* 224/*
@@ -270,7 +303,7 @@ static void c1e_idle(void)
270 rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi); 303 rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi);
271 if (lo & K8_INTP_C1E_ACTIVE_MASK) { 304 if (lo & K8_INTP_C1E_ACTIVE_MASK) {
272 c1e_detected = 1; 305 c1e_detected = 1;
273 if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) 306 if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC))
274 mark_tsc_unstable("TSC halt in AMD C1E"); 307 mark_tsc_unstable("TSC halt in AMD C1E");
275 printk(KERN_INFO "System has AMD C1E enabled\n"); 308 printk(KERN_INFO "System has AMD C1E enabled\n");
276 set_cpu_cap(&boot_cpu_data, X86_FEATURE_AMDC1E); 309 set_cpu_cap(&boot_cpu_data, X86_FEATURE_AMDC1E);
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 0a1302fe6d45..3ba155d24884 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -38,6 +38,7 @@
38#include <linux/percpu.h> 38#include <linux/percpu.h>
39#include <linux/prctl.h> 39#include <linux/prctl.h>
40#include <linux/dmi.h> 40#include <linux/dmi.h>
41#include <linux/ftrace.h>
41 42
42#include <asm/uaccess.h> 43#include <asm/uaccess.h>
43#include <asm/pgtable.h> 44#include <asm/pgtable.h>
@@ -59,6 +60,7 @@
59#include <asm/idle.h> 60#include <asm/idle.h>
60#include <asm/syscalls.h> 61#include <asm/syscalls.h>
61#include <asm/smp.h> 62#include <asm/smp.h>
63#include <asm/ds.h>
62 64
63asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); 65asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
64 66
@@ -250,14 +252,8 @@ void exit_thread(void)
250 tss->x86_tss.io_bitmap_base = INVALID_IO_BITMAP_OFFSET; 252 tss->x86_tss.io_bitmap_base = INVALID_IO_BITMAP_OFFSET;
251 put_cpu(); 253 put_cpu();
252 } 254 }
253#ifdef CONFIG_X86_DS 255
254 /* Free any DS contexts that have not been properly released. */ 256 ds_exit_thread(current);
255 if (unlikely(current->thread.ds_ctx)) {
256 /* we clear debugctl to make sure DS is not used. */
257 update_debugctlmsr(0);
258 ds_free(current->thread.ds_ctx);
259 }
260#endif /* CONFIG_X86_DS */
261} 257}
262 258
263void flush_thread(void) 259void flush_thread(void)
@@ -339,6 +335,12 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
339 kfree(p->thread.io_bitmap_ptr); 335 kfree(p->thread.io_bitmap_ptr);
340 p->thread.io_bitmap_max = 0; 336 p->thread.io_bitmap_max = 0;
341 } 337 }
338
339 ds_copy_thread(p, current);
340
341 clear_tsk_thread_flag(p, TIF_DEBUGCTLMSR);
342 p->thread.debugctlmsr = 0;
343
342 return err; 344 return err;
343} 345}
344 346
@@ -419,48 +421,19 @@ int set_tsc_mode(unsigned int val)
419 return 0; 421 return 0;
420} 422}
421 423
422#ifdef CONFIG_X86_DS
423static int update_debugctl(struct thread_struct *prev,
424 struct thread_struct *next, unsigned long debugctl)
425{
426 unsigned long ds_prev = 0;
427 unsigned long ds_next = 0;
428
429 if (prev->ds_ctx)
430 ds_prev = (unsigned long)prev->ds_ctx->ds;
431 if (next->ds_ctx)
432 ds_next = (unsigned long)next->ds_ctx->ds;
433
434 if (ds_next != ds_prev) {
435 /* we clear debugctl to make sure DS
436 * is not in use when we change it */
437 debugctl = 0;
438 update_debugctlmsr(0);
439 wrmsr(MSR_IA32_DS_AREA, ds_next, 0);
440 }
441 return debugctl;
442}
443#else
444static int update_debugctl(struct thread_struct *prev,
445 struct thread_struct *next, unsigned long debugctl)
446{
447 return debugctl;
448}
449#endif /* CONFIG_X86_DS */
450
451static noinline void 424static noinline void
452__switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p, 425__switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p,
453 struct tss_struct *tss) 426 struct tss_struct *tss)
454{ 427{
455 struct thread_struct *prev, *next; 428 struct thread_struct *prev, *next;
456 unsigned long debugctl;
457 429
458 prev = &prev_p->thread; 430 prev = &prev_p->thread;
459 next = &next_p->thread; 431 next = &next_p->thread;
460 432
461 debugctl = update_debugctl(prev, next, prev->debugctlmsr); 433 if (test_tsk_thread_flag(next_p, TIF_DS_AREA_MSR) ||
462 434 test_tsk_thread_flag(prev_p, TIF_DS_AREA_MSR))
463 if (next->debugctlmsr != debugctl) 435 ds_switch_to(prev_p, next_p);
436 else if (next->debugctlmsr != prev->debugctlmsr)
464 update_debugctlmsr(next->debugctlmsr); 437 update_debugctlmsr(next->debugctlmsr);
465 438
466 if (test_tsk_thread_flag(next_p, TIF_DEBUG)) { 439 if (test_tsk_thread_flag(next_p, TIF_DEBUG)) {
@@ -482,15 +455,6 @@ __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p,
482 hard_enable_TSC(); 455 hard_enable_TSC();
483 } 456 }
484 457
485#ifdef CONFIG_X86_PTRACE_BTS
486 if (test_tsk_thread_flag(prev_p, TIF_BTS_TRACE_TS))
487 ptrace_bts_take_timestamp(prev_p, BTS_TASK_DEPARTS);
488
489 if (test_tsk_thread_flag(next_p, TIF_BTS_TRACE_TS))
490 ptrace_bts_take_timestamp(next_p, BTS_TASK_ARRIVES);
491#endif /* CONFIG_X86_PTRACE_BTS */
492
493
494 if (!test_tsk_thread_flag(next_p, TIF_IO_BITMAP)) { 458 if (!test_tsk_thread_flag(next_p, TIF_IO_BITMAP)) {
495 /* 459 /*
496 * Disable the bitmap via an invalid offset. We still cache 460 * Disable the bitmap via an invalid offset. We still cache
@@ -548,7 +512,8 @@ __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p,
548 * the task-switch, and shows up in ret_from_fork in entry.S, 512 * the task-switch, and shows up in ret_from_fork in entry.S,
549 * for example. 513 * for example.
550 */ 514 */
551struct task_struct * __switch_to(struct task_struct *prev_p, struct task_struct *next_p) 515__notrace_funcgraph struct task_struct *
516__switch_to(struct task_struct *prev_p, struct task_struct *next_p)
552{ 517{
553 struct thread_struct *prev = &prev_p->thread, 518 struct thread_struct *prev = &prev_p->thread,
554 *next = &next_p->thread; 519 *next = &next_p->thread;
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index c958120fb1b6..416fb9282f4f 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -39,6 +39,7 @@
39#include <linux/prctl.h> 39#include <linux/prctl.h>
40#include <linux/uaccess.h> 40#include <linux/uaccess.h>
41#include <linux/io.h> 41#include <linux/io.h>
42#include <linux/ftrace.h>
42 43
43#include <asm/pgtable.h> 44#include <asm/pgtable.h>
44#include <asm/system.h> 45#include <asm/system.h>
@@ -52,6 +53,7 @@
52#include <asm/ia32.h> 53#include <asm/ia32.h>
53#include <asm/idle.h> 54#include <asm/idle.h>
54#include <asm/syscalls.h> 55#include <asm/syscalls.h>
56#include <asm/ds.h>
55 57
56asmlinkage extern void ret_from_fork(void); 58asmlinkage extern void ret_from_fork(void);
57 59
@@ -235,14 +237,8 @@ void exit_thread(void)
235 t->io_bitmap_max = 0; 237 t->io_bitmap_max = 0;
236 put_cpu(); 238 put_cpu();
237 } 239 }
238#ifdef CONFIG_X86_DS 240
239 /* Free any DS contexts that have not been properly released. */ 241 ds_exit_thread(current);
240 if (unlikely(t->ds_ctx)) {
241 /* we clear debugctl to make sure DS is not used. */
242 update_debugctlmsr(0);
243 ds_free(t->ds_ctx);
244 }
245#endif /* CONFIG_X86_DS */
246} 242}
247 243
248void flush_thread(void) 244void flush_thread(void)
@@ -372,6 +368,12 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
372 if (err) 368 if (err)
373 goto out; 369 goto out;
374 } 370 }
371
372 ds_copy_thread(p, me);
373
374 clear_tsk_thread_flag(p, TIF_DEBUGCTLMSR);
375 p->thread.debugctlmsr = 0;
376
375 err = 0; 377 err = 0;
376out: 378out:
377 if (err && p->thread.io_bitmap_ptr) { 379 if (err && p->thread.io_bitmap_ptr) {
@@ -470,35 +472,14 @@ static inline void __switch_to_xtra(struct task_struct *prev_p,
470 struct tss_struct *tss) 472 struct tss_struct *tss)
471{ 473{
472 struct thread_struct *prev, *next; 474 struct thread_struct *prev, *next;
473 unsigned long debugctl;
474 475
475 prev = &prev_p->thread, 476 prev = &prev_p->thread,
476 next = &next_p->thread; 477 next = &next_p->thread;
477 478
478 debugctl = prev->debugctlmsr; 479 if (test_tsk_thread_flag(next_p, TIF_DS_AREA_MSR) ||
479 480 test_tsk_thread_flag(prev_p, TIF_DS_AREA_MSR))
480#ifdef CONFIG_X86_DS 481 ds_switch_to(prev_p, next_p);
481 { 482 else if (next->debugctlmsr != prev->debugctlmsr)
482 unsigned long ds_prev = 0, ds_next = 0;
483
484 if (prev->ds_ctx)
485 ds_prev = (unsigned long)prev->ds_ctx->ds;
486 if (next->ds_ctx)
487 ds_next = (unsigned long)next->ds_ctx->ds;
488
489 if (ds_next != ds_prev) {
490 /*
491 * We clear debugctl to make sure DS
492 * is not in use when we change it:
493 */
494 debugctl = 0;
495 update_debugctlmsr(0);
496 wrmsrl(MSR_IA32_DS_AREA, ds_next);
497 }
498 }
499#endif /* CONFIG_X86_DS */
500
501 if (next->debugctlmsr != debugctl)
502 update_debugctlmsr(next->debugctlmsr); 483 update_debugctlmsr(next->debugctlmsr);
503 484
504 if (test_tsk_thread_flag(next_p, TIF_DEBUG)) { 485 if (test_tsk_thread_flag(next_p, TIF_DEBUG)) {
@@ -533,14 +514,6 @@ static inline void __switch_to_xtra(struct task_struct *prev_p,
533 */ 514 */
534 memset(tss->io_bitmap, 0xff, prev->io_bitmap_max); 515 memset(tss->io_bitmap, 0xff, prev->io_bitmap_max);
535 } 516 }
536
537#ifdef CONFIG_X86_PTRACE_BTS
538 if (test_tsk_thread_flag(prev_p, TIF_BTS_TRACE_TS))
539 ptrace_bts_take_timestamp(prev_p, BTS_TASK_DEPARTS);
540
541 if (test_tsk_thread_flag(next_p, TIF_BTS_TRACE_TS))
542 ptrace_bts_take_timestamp(next_p, BTS_TASK_ARRIVES);
543#endif /* CONFIG_X86_PTRACE_BTS */
544} 517}
545 518
546/* 519/*
@@ -551,8 +524,9 @@ static inline void __switch_to_xtra(struct task_struct *prev_p,
551 * - could test fs/gs bitsliced 524 * - could test fs/gs bitsliced
552 * 525 *
553 * Kprobes not supported here. Set the probe on schedule instead. 526 * Kprobes not supported here. Set the probe on schedule instead.
527 * Function graph tracer not supported too.
554 */ 528 */
555struct task_struct * 529__notrace_funcgraph struct task_struct *
556__switch_to(struct task_struct *prev_p, struct task_struct *next_p) 530__switch_to(struct task_struct *prev_p, struct task_struct *next_p)
557{ 531{
558 struct thread_struct *prev = &prev_p->thread; 532 struct thread_struct *prev = &prev_p->thread;
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 0a6d8c12e10d..0a5df5f82fb9 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -581,158 +581,91 @@ static int ioperm_get(struct task_struct *target,
581} 581}
582 582
583#ifdef CONFIG_X86_PTRACE_BTS 583#ifdef CONFIG_X86_PTRACE_BTS
584/*
585 * The configuration for a particular BTS hardware implementation.
586 */
587struct bts_configuration {
588 /* the size of a BTS record in bytes; at most BTS_MAX_RECORD_SIZE */
589 unsigned char sizeof_bts;
590 /* the size of a field in the BTS record in bytes */
591 unsigned char sizeof_field;
592 /* a bitmask to enable/disable BTS in DEBUGCTL MSR */
593 unsigned long debugctl_mask;
594};
595static struct bts_configuration bts_cfg;
596
597#define BTS_MAX_RECORD_SIZE (8 * 3)
598
599
600/*
601 * Branch Trace Store (BTS) uses the following format. Different
602 * architectures vary in the size of those fields.
603 * - source linear address
604 * - destination linear address
605 * - flags
606 *
607 * Later architectures use 64bit pointers throughout, whereas earlier
608 * architectures use 32bit pointers in 32bit mode.
609 *
610 * We compute the base address for the first 8 fields based on:
611 * - the field size stored in the DS configuration
612 * - the relative field position
613 *
614 * In order to store additional information in the BTS buffer, we use
615 * a special source address to indicate that the record requires
616 * special interpretation.
617 *
618 * Netburst indicated via a bit in the flags field whether the branch
619 * was predicted; this is ignored.
620 */
621
622enum bts_field {
623 bts_from = 0,
624 bts_to,
625 bts_flags,
626
627 bts_escape = (unsigned long)-1,
628 bts_qual = bts_to,
629 bts_jiffies = bts_flags
630};
631
632static inline unsigned long bts_get(const char *base, enum bts_field field)
633{
634 base += (bts_cfg.sizeof_field * field);
635 return *(unsigned long *)base;
636}
637
638static inline void bts_set(char *base, enum bts_field field, unsigned long val)
639{
640 base += (bts_cfg.sizeof_field * field);;
641 (*(unsigned long *)base) = val;
642}
643
644/*
645 * Translate a BTS record from the raw format into the bts_struct format
646 *
647 * out (out): bts_struct interpretation
648 * raw: raw BTS record
649 */
650static void ptrace_bts_translate_record(struct bts_struct *out, const void *raw)
651{
652 memset(out, 0, sizeof(*out));
653 if (bts_get(raw, bts_from) == bts_escape) {
654 out->qualifier = bts_get(raw, bts_qual);
655 out->variant.jiffies = bts_get(raw, bts_jiffies);
656 } else {
657 out->qualifier = BTS_BRANCH;
658 out->variant.lbr.from_ip = bts_get(raw, bts_from);
659 out->variant.lbr.to_ip = bts_get(raw, bts_to);
660 }
661}
662
663static int ptrace_bts_read_record(struct task_struct *child, size_t index, 584static int ptrace_bts_read_record(struct task_struct *child, size_t index,
664 struct bts_struct __user *out) 585 struct bts_struct __user *out)
665{ 586{
666 struct bts_struct ret; 587 const struct bts_trace *trace;
667 const void *bts_record; 588 struct bts_struct bts;
668 size_t bts_index, bts_end; 589 const unsigned char *at;
669 int error; 590 int error;
670 591
671 error = ds_get_bts_end(child, &bts_end); 592 trace = ds_read_bts(child->bts);
672 if (error < 0) 593 if (!trace)
673 return error; 594 return -EPERM;
674
675 if (bts_end <= index)
676 return -EINVAL;
677 595
678 error = ds_get_bts_index(child, &bts_index); 596 at = trace->ds.top - ((index + 1) * trace->ds.size);
679 if (error < 0) 597 if ((void *)at < trace->ds.begin)
680 return error; 598 at += (trace->ds.n * trace->ds.size);
681 599
682 /* translate the ptrace bts index into the ds bts index */ 600 if (!trace->read)
683 bts_index += bts_end - (index + 1); 601 return -EOPNOTSUPP;
684 if (bts_end <= bts_index)
685 bts_index -= bts_end;
686 602
687 error = ds_access_bts(child, bts_index, &bts_record); 603 error = trace->read(child->bts, at, &bts);
688 if (error < 0) 604 if (error < 0)
689 return error; 605 return error;
690 606
691 ptrace_bts_translate_record(&ret, bts_record); 607 if (copy_to_user(out, &bts, sizeof(bts)))
692
693 if (copy_to_user(out, &ret, sizeof(ret)))
694 return -EFAULT; 608 return -EFAULT;
695 609
696 return sizeof(ret); 610 return sizeof(bts);
697} 611}
698 612
699static int ptrace_bts_drain(struct task_struct *child, 613static int ptrace_bts_drain(struct task_struct *child,
700 long size, 614 long size,
701 struct bts_struct __user *out) 615 struct bts_struct __user *out)
702{ 616{
703 struct bts_struct ret; 617 const struct bts_trace *trace;
704 const unsigned char *raw; 618 const unsigned char *at;
705 size_t end, i; 619 int error, drained = 0;
706 int error;
707 620
708 error = ds_get_bts_index(child, &end); 621 trace = ds_read_bts(child->bts);
709 if (error < 0) 622 if (!trace)
710 return error; 623 return -EPERM;
711 624
712 if (size < (end * sizeof(struct bts_struct))) 625 if (!trace->read)
626 return -EOPNOTSUPP;
627
628 if (size < (trace->ds.top - trace->ds.begin))
713 return -EIO; 629 return -EIO;
714 630
715 error = ds_access_bts(child, 0, (const void **)&raw); 631 for (at = trace->ds.begin; (void *)at < trace->ds.top;
716 if (error < 0) 632 out++, drained++, at += trace->ds.size) {
717 return error; 633 struct bts_struct bts;
634 int error;
718 635
719 for (i = 0; i < end; i++, out++, raw += bts_cfg.sizeof_bts) { 636 error = trace->read(child->bts, at, &bts);
720 ptrace_bts_translate_record(&ret, raw); 637 if (error < 0)
638 return error;
721 639
722 if (copy_to_user(out, &ret, sizeof(ret))) 640 if (copy_to_user(out, &bts, sizeof(bts)))
723 return -EFAULT; 641 return -EFAULT;
724 } 642 }
725 643
726 error = ds_clear_bts(child); 644 memset(trace->ds.begin, 0, trace->ds.n * trace->ds.size);
645
646 error = ds_reset_bts(child->bts);
727 if (error < 0) 647 if (error < 0)
728 return error; 648 return error;
729 649
730 return end; 650 return drained;
731} 651}
732 652
733static void ptrace_bts_ovfl(struct task_struct *child) 653static int ptrace_bts_allocate_buffer(struct task_struct *child, size_t size)
734{ 654{
735 send_sig(child->thread.bts_ovfl_signal, child, 0); 655 child->bts_buffer = alloc_locked_buffer(size);
656 if (!child->bts_buffer)
657 return -ENOMEM;
658
659 child->bts_size = size;
660
661 return 0;
662}
663
664static void ptrace_bts_free_buffer(struct task_struct *child)
665{
666 free_locked_buffer(child->bts_buffer, child->bts_size);
667 child->bts_buffer = NULL;
668 child->bts_size = 0;
736} 669}
737 670
738static int ptrace_bts_config(struct task_struct *child, 671static int ptrace_bts_config(struct task_struct *child,
@@ -740,114 +673,86 @@ static int ptrace_bts_config(struct task_struct *child,
740 const struct ptrace_bts_config __user *ucfg) 673 const struct ptrace_bts_config __user *ucfg)
741{ 674{
742 struct ptrace_bts_config cfg; 675 struct ptrace_bts_config cfg;
743 int error = 0; 676 unsigned int flags = 0;
744
745 error = -EOPNOTSUPP;
746 if (!bts_cfg.sizeof_bts)
747 goto errout;
748 677
749 error = -EIO;
750 if (cfg_size < sizeof(cfg)) 678 if (cfg_size < sizeof(cfg))
751 goto errout; 679 return -EIO;
752 680
753 error = -EFAULT;
754 if (copy_from_user(&cfg, ucfg, sizeof(cfg))) 681 if (copy_from_user(&cfg, ucfg, sizeof(cfg)))
755 goto errout; 682 return -EFAULT;
756 683
757 error = -EINVAL; 684 if (child->bts) {
758 if ((cfg.flags & PTRACE_BTS_O_SIGNAL) && 685 ds_release_bts(child->bts);
759 !(cfg.flags & PTRACE_BTS_O_ALLOC)) 686 child->bts = NULL;
760 goto errout; 687 }
761 688
762 if (cfg.flags & PTRACE_BTS_O_ALLOC) { 689 if (cfg.flags & PTRACE_BTS_O_SIGNAL) {
763 ds_ovfl_callback_t ovfl = NULL; 690 if (!cfg.signal)
764 unsigned int sig = 0; 691 return -EINVAL;
765 692
766 /* we ignore the error in case we were not tracing child */ 693 return -EOPNOTSUPP;
767 (void)ds_release_bts(child);
768 694
769 if (cfg.flags & PTRACE_BTS_O_SIGNAL) { 695 child->thread.bts_ovfl_signal = cfg.signal;
770 if (!cfg.signal) 696 }
771 goto errout;
772 697
773 sig = cfg.signal; 698 if ((cfg.flags & PTRACE_BTS_O_ALLOC) &&
774 ovfl = ptrace_bts_ovfl; 699 (cfg.size != child->bts_size)) {
775 } 700 int error;
776 701
777 error = ds_request_bts(child, /* base = */ NULL, cfg.size, ovfl); 702 ptrace_bts_free_buffer(child);
778 if (error < 0)
779 goto errout;
780 703
781 child->thread.bts_ovfl_signal = sig; 704 error = ptrace_bts_allocate_buffer(child, cfg.size);
705 if (error < 0)
706 return error;
782 } 707 }
783 708
784 error = -EINVAL;
785 if (!child->thread.ds_ctx && cfg.flags)
786 goto errout;
787
788 if (cfg.flags & PTRACE_BTS_O_TRACE) 709 if (cfg.flags & PTRACE_BTS_O_TRACE)
789 child->thread.debugctlmsr |= bts_cfg.debugctl_mask; 710 flags |= BTS_USER;
790 else
791 child->thread.debugctlmsr &= ~bts_cfg.debugctl_mask;
792 711
793 if (cfg.flags & PTRACE_BTS_O_SCHED) 712 if (cfg.flags & PTRACE_BTS_O_SCHED)
794 set_tsk_thread_flag(child, TIF_BTS_TRACE_TS); 713 flags |= BTS_TIMESTAMPS;
795 else
796 clear_tsk_thread_flag(child, TIF_BTS_TRACE_TS);
797 714
798 error = sizeof(cfg); 715 child->bts = ds_request_bts(child, child->bts_buffer, child->bts_size,
716 /* ovfl = */ NULL, /* th = */ (size_t)-1,
717 flags);
718 if (IS_ERR(child->bts)) {
719 int error = PTR_ERR(child->bts);
799 720
800out: 721 ptrace_bts_free_buffer(child);
801 if (child->thread.debugctlmsr) 722 child->bts = NULL;
802 set_tsk_thread_flag(child, TIF_DEBUGCTLMSR);
803 else
804 clear_tsk_thread_flag(child, TIF_DEBUGCTLMSR);
805 723
806 return error; 724 return error;
725 }
807 726
808errout: 727 return sizeof(cfg);
809 child->thread.debugctlmsr &= ~bts_cfg.debugctl_mask;
810 clear_tsk_thread_flag(child, TIF_BTS_TRACE_TS);
811 goto out;
812} 728}
813 729
814static int ptrace_bts_status(struct task_struct *child, 730static int ptrace_bts_status(struct task_struct *child,
815 long cfg_size, 731 long cfg_size,
816 struct ptrace_bts_config __user *ucfg) 732 struct ptrace_bts_config __user *ucfg)
817{ 733{
734 const struct bts_trace *trace;
818 struct ptrace_bts_config cfg; 735 struct ptrace_bts_config cfg;
819 size_t end;
820 const void *base, *max;
821 int error;
822 736
823 if (cfg_size < sizeof(cfg)) 737 if (cfg_size < sizeof(cfg))
824 return -EIO; 738 return -EIO;
825 739
826 error = ds_get_bts_end(child, &end); 740 trace = ds_read_bts(child->bts);
827 if (error < 0) 741 if (!trace)
828 return error; 742 return -EPERM;
829
830 error = ds_access_bts(child, /* index = */ 0, &base);
831 if (error < 0)
832 return error;
833
834 error = ds_access_bts(child, /* index = */ end, &max);
835 if (error < 0)
836 return error;
837 743
838 memset(&cfg, 0, sizeof(cfg)); 744 memset(&cfg, 0, sizeof(cfg));
839 cfg.size = (max - base); 745 cfg.size = trace->ds.end - trace->ds.begin;
840 cfg.signal = child->thread.bts_ovfl_signal; 746 cfg.signal = child->thread.bts_ovfl_signal;
841 cfg.bts_size = sizeof(struct bts_struct); 747 cfg.bts_size = sizeof(struct bts_struct);
842 748
843 if (cfg.signal) 749 if (cfg.signal)
844 cfg.flags |= PTRACE_BTS_O_SIGNAL; 750 cfg.flags |= PTRACE_BTS_O_SIGNAL;
845 751
846 if (test_tsk_thread_flag(child, TIF_DEBUGCTLMSR) && 752 if (trace->ds.flags & BTS_USER)
847 child->thread.debugctlmsr & bts_cfg.debugctl_mask)
848 cfg.flags |= PTRACE_BTS_O_TRACE; 753 cfg.flags |= PTRACE_BTS_O_TRACE;
849 754
850 if (test_tsk_thread_flag(child, TIF_BTS_TRACE_TS)) 755 if (trace->ds.flags & BTS_TIMESTAMPS)
851 cfg.flags |= PTRACE_BTS_O_SCHED; 756 cfg.flags |= PTRACE_BTS_O_SCHED;
852 757
853 if (copy_to_user(ucfg, &cfg, sizeof(cfg))) 758 if (copy_to_user(ucfg, &cfg, sizeof(cfg)))
@@ -856,110 +761,77 @@ static int ptrace_bts_status(struct task_struct *child,
856 return sizeof(cfg); 761 return sizeof(cfg);
857} 762}
858 763
859static int ptrace_bts_write_record(struct task_struct *child, 764static int ptrace_bts_clear(struct task_struct *child)
860 const struct bts_struct *in)
861{ 765{
862 unsigned char bts_record[BTS_MAX_RECORD_SIZE]; 766 const struct bts_trace *trace;
863 767
864 BUG_ON(BTS_MAX_RECORD_SIZE < bts_cfg.sizeof_bts); 768 trace = ds_read_bts(child->bts);
769 if (!trace)
770 return -EPERM;
865 771
866 memset(bts_record, 0, bts_cfg.sizeof_bts); 772 memset(trace->ds.begin, 0, trace->ds.n * trace->ds.size);
867 switch (in->qualifier) {
868 case BTS_INVALID:
869 break;
870 773
871 case BTS_BRANCH: 774 return ds_reset_bts(child->bts);
872 bts_set(bts_record, bts_from, in->variant.lbr.from_ip); 775}
873 bts_set(bts_record, bts_to, in->variant.lbr.to_ip);
874 break;
875 776
876 case BTS_TASK_ARRIVES: 777static int ptrace_bts_size(struct task_struct *child)
877 case BTS_TASK_DEPARTS: 778{
878 bts_set(bts_record, bts_from, bts_escape); 779 const struct bts_trace *trace;
879 bts_set(bts_record, bts_qual, in->qualifier);
880 bts_set(bts_record, bts_jiffies, in->variant.jiffies);
881 break;
882 780
883 default: 781 trace = ds_read_bts(child->bts);
884 return -EINVAL; 782 if (!trace)
885 } 783 return -EPERM;
886 784
887 /* The writing task will be the switched-to task on a context 785 return (trace->ds.top - trace->ds.begin) / trace->ds.size;
888 * switch. It needs to write into the switched-from task's BTS
889 * buffer. */
890 return ds_unchecked_write_bts(child, bts_record, bts_cfg.sizeof_bts);
891} 786}
892 787
893void ptrace_bts_take_timestamp(struct task_struct *tsk, 788static void ptrace_bts_fork(struct task_struct *tsk)
894 enum bts_qualifier qualifier)
895{ 789{
896 struct bts_struct rec = { 790 tsk->bts = NULL;
897 .qualifier = qualifier, 791 tsk->bts_buffer = NULL;
898 .variant.jiffies = jiffies_64 792 tsk->bts_size = 0;
899 }; 793 tsk->thread.bts_ovfl_signal = 0;
900
901 ptrace_bts_write_record(tsk, &rec);
902} 794}
903 795
904static const struct bts_configuration bts_cfg_netburst = { 796static void ptrace_bts_untrace(struct task_struct *child)
905 .sizeof_bts = sizeof(long) * 3, 797{
906 .sizeof_field = sizeof(long), 798 if (unlikely(child->bts)) {
907 .debugctl_mask = (1<<2)|(1<<3)|(1<<5) 799 ds_release_bts(child->bts);
908}; 800 child->bts = NULL;
801
802 /* We cannot update total_vm and locked_vm since
803 child's mm is already gone. But we can reclaim the
804 memory. */
805 kfree(child->bts_buffer);
806 child->bts_buffer = NULL;
807 child->bts_size = 0;
808 }
809}
909 810
910static const struct bts_configuration bts_cfg_pentium_m = { 811static void ptrace_bts_detach(struct task_struct *child)
911 .sizeof_bts = sizeof(long) * 3, 812{
912 .sizeof_field = sizeof(long), 813 if (unlikely(child->bts)) {
913 .debugctl_mask = (1<<6)|(1<<7) 814 ds_release_bts(child->bts);
914}; 815 child->bts = NULL;
915 816
916static const struct bts_configuration bts_cfg_core2 = { 817 ptrace_bts_free_buffer(child);
917 .sizeof_bts = 8 * 3, 818 }
918 .sizeof_field = 8, 819}
919 .debugctl_mask = (1<<6)|(1<<7)|(1<<9) 820#else
920}; 821static inline void ptrace_bts_fork(struct task_struct *tsk) {}
822static inline void ptrace_bts_detach(struct task_struct *child) {}
823static inline void ptrace_bts_untrace(struct task_struct *child) {}
824#endif /* CONFIG_X86_PTRACE_BTS */
921 825
922static inline void bts_configure(const struct bts_configuration *cfg) 826void x86_ptrace_fork(struct task_struct *child, unsigned long clone_flags)
923{ 827{
924 bts_cfg = *cfg; 828 ptrace_bts_fork(child);
925} 829}
926 830
927void __cpuinit ptrace_bts_init_intel(struct cpuinfo_x86 *c) 831void x86_ptrace_untrace(struct task_struct *child)
928{ 832{
929 switch (c->x86) { 833 ptrace_bts_untrace(child);
930 case 0x6:
931 switch (c->x86_model) {
932 case 0xD:
933 case 0xE: /* Pentium M */
934 bts_configure(&bts_cfg_pentium_m);
935 break;
936 case 0xF: /* Core2 */
937 case 0x1C: /* Atom */
938 bts_configure(&bts_cfg_core2);
939 break;
940 default:
941 /* sorry, don't know about them */
942 break;
943 }
944 break;
945 case 0xF:
946 switch (c->x86_model) {
947 case 0x0:
948 case 0x1:
949 case 0x2: /* Netburst */
950 bts_configure(&bts_cfg_netburst);
951 break;
952 default:
953 /* sorry, don't know about them */
954 break;
955 }
956 break;
957 default:
958 /* sorry, don't know about them */
959 break;
960 }
961} 834}
962#endif /* CONFIG_X86_PTRACE_BTS */
963 835
964/* 836/*
965 * Called by kernel/ptrace.c when detaching.. 837 * Called by kernel/ptrace.c when detaching..
@@ -972,15 +844,7 @@ void ptrace_disable(struct task_struct *child)
972#ifdef TIF_SYSCALL_EMU 844#ifdef TIF_SYSCALL_EMU
973 clear_tsk_thread_flag(child, TIF_SYSCALL_EMU); 845 clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
974#endif 846#endif
975#ifdef CONFIG_X86_PTRACE_BTS 847 ptrace_bts_detach(child);
976 (void)ds_release_bts(child);
977
978 child->thread.debugctlmsr &= ~bts_cfg.debugctl_mask;
979 if (!child->thread.debugctlmsr)
980 clear_tsk_thread_flag(child, TIF_DEBUGCTLMSR);
981
982 clear_tsk_thread_flag(child, TIF_BTS_TRACE_TS);
983#endif /* CONFIG_X86_PTRACE_BTS */
984} 848}
985 849
986#if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION 850#if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
@@ -1112,7 +976,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
1112 break; 976 break;
1113 977
1114 case PTRACE_BTS_SIZE: 978 case PTRACE_BTS_SIZE:
1115 ret = ds_get_bts_index(child, /* pos = */ NULL); 979 ret = ptrace_bts_size(child);
1116 break; 980 break;
1117 981
1118 case PTRACE_BTS_GET: 982 case PTRACE_BTS_GET:
@@ -1121,7 +985,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
1121 break; 985 break;
1122 986
1123 case PTRACE_BTS_CLEAR: 987 case PTRACE_BTS_CLEAR:
1124 ret = ds_clear_bts(child); 988 ret = ptrace_bts_clear(child);
1125 break; 989 break;
1126 990
1127 case PTRACE_BTS_DRAIN: 991 case PTRACE_BTS_DRAIN:
@@ -1384,6 +1248,14 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
1384 1248
1385 case PTRACE_GET_THREAD_AREA: 1249 case PTRACE_GET_THREAD_AREA:
1386 case PTRACE_SET_THREAD_AREA: 1250 case PTRACE_SET_THREAD_AREA:
1251#ifdef CONFIG_X86_PTRACE_BTS
1252 case PTRACE_BTS_CONFIG:
1253 case PTRACE_BTS_STATUS:
1254 case PTRACE_BTS_SIZE:
1255 case PTRACE_BTS_GET:
1256 case PTRACE_BTS_CLEAR:
1257 case PTRACE_BTS_DRAIN:
1258#endif /* CONFIG_X86_PTRACE_BTS */
1387 return arch_ptrace(child, request, addr, data); 1259 return arch_ptrace(child, request, addr, data);
1388 1260
1389 default: 1261 default:
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index 67465ed89310..309949e9e1c1 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -168,6 +168,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31,
168 ich_force_enable_hpet); 168 ich_force_enable_hpet);
169DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_1, 169DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_1,
170 ich_force_enable_hpet); 170 ich_force_enable_hpet);
171DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_4,
172 ich_force_enable_hpet);
171DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_7, 173DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_7,
172 ich_force_enable_hpet); 174 ich_force_enable_hpet);
173 175
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index cc5a2545dd41..2b46eb41643b 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -12,6 +12,8 @@
12#include <asm/proto.h> 12#include <asm/proto.h>
13#include <asm/reboot_fixups.h> 13#include <asm/reboot_fixups.h>
14#include <asm/reboot.h> 14#include <asm/reboot.h>
15#include <asm/pci_x86.h>
16#include <asm/virtext.h>
15 17
16#ifdef CONFIG_X86_32 18#ifdef CONFIG_X86_32
17# include <linux/dmi.h> 19# include <linux/dmi.h>
@@ -21,6 +23,8 @@
21# include <asm/iommu.h> 23# include <asm/iommu.h>
22#endif 24#endif
23 25
26#include <mach_ipi.h>
27
24/* 28/*
25 * Power off function, if any 29 * Power off function, if any
26 */ 30 */
@@ -36,7 +40,16 @@ int reboot_force;
36static int reboot_cpu = -1; 40static int reboot_cpu = -1;
37#endif 41#endif
38 42
39/* reboot=b[ios] | s[mp] | t[riple] | k[bd] | e[fi] [, [w]arm | [c]old] 43/* This is set if we need to go through the 'emergency' path.
44 * When machine_emergency_restart() is called, we may be on
45 * an inconsistent state and won't be able to do a clean cleanup
46 */
47static int reboot_emergency;
48
49/* This is set by the PCI code if either type 1 or type 2 PCI is detected */
50bool port_cf9_safe = false;
51
52/* reboot=b[ios] | s[mp] | t[riple] | k[bd] | e[fi] [, [w]arm | [c]old] | p[ci]
40 warm Don't set the cold reboot flag 53 warm Don't set the cold reboot flag
41 cold Set the cold reboot flag 54 cold Set the cold reboot flag
42 bios Reboot by jumping through the BIOS (only for X86_32) 55 bios Reboot by jumping through the BIOS (only for X86_32)
@@ -45,6 +58,7 @@ static int reboot_cpu = -1;
45 kbd Use the keyboard controller. cold reset (default) 58 kbd Use the keyboard controller. cold reset (default)
46 acpi Use the RESET_REG in the FADT 59 acpi Use the RESET_REG in the FADT
47 efi Use efi reset_system runtime service 60 efi Use efi reset_system runtime service
61 pci Use the so-called "PCI reset register", CF9
48 force Avoid anything that could hang. 62 force Avoid anything that could hang.
49 */ 63 */
50static int __init reboot_setup(char *str) 64static int __init reboot_setup(char *str)
@@ -79,6 +93,7 @@ static int __init reboot_setup(char *str)
79 case 'k': 93 case 'k':
80 case 't': 94 case 't':
81 case 'e': 95 case 'e':
96 case 'p':
82 reboot_type = *str; 97 reboot_type = *str;
83 break; 98 break;
84 99
@@ -360,6 +375,48 @@ static inline void kb_wait(void)
360 } 375 }
361} 376}
362 377
378static void vmxoff_nmi(int cpu, struct die_args *args)
379{
380 cpu_emergency_vmxoff();
381}
382
383/* Use NMIs as IPIs to tell all CPUs to disable virtualization
384 */
385static void emergency_vmx_disable_all(void)
386{
387 /* Just make sure we won't change CPUs while doing this */
388 local_irq_disable();
389
390 /* We need to disable VMX on all CPUs before rebooting, otherwise
391 * we risk hanging up the machine, because the CPU ignore INIT
392 * signals when VMX is enabled.
393 *
394 * We can't take any locks and we may be on an inconsistent
395 * state, so we use NMIs as IPIs to tell the other CPUs to disable
396 * VMX and halt.
397 *
398 * For safety, we will avoid running the nmi_shootdown_cpus()
399 * stuff unnecessarily, but we don't have a way to check
400 * if other CPUs have VMX enabled. So we will call it only if the
401 * CPU we are running on has VMX enabled.
402 *
403 * We will miss cases where VMX is not enabled on all CPUs. This
404 * shouldn't do much harm because KVM always enable VMX on all
405 * CPUs anyway. But we can miss it on the small window where KVM
406 * is still enabling VMX.
407 */
408 if (cpu_has_vmx() && cpu_vmx_enabled()) {
409 /* Disable VMX on this CPU.
410 */
411 cpu_vmxoff();
412
413 /* Halt and disable VMX on the other CPUs */
414 nmi_shootdown_cpus(vmxoff_nmi);
415
416 }
417}
418
419
363void __attribute__((weak)) mach_reboot_fixups(void) 420void __attribute__((weak)) mach_reboot_fixups(void)
364{ 421{
365} 422}
@@ -368,6 +425,9 @@ static void native_machine_emergency_restart(void)
368{ 425{
369 int i; 426 int i;
370 427
428 if (reboot_emergency)
429 emergency_vmx_disable_all();
430
371 /* Tell the BIOS if we want cold or warm reboot */ 431 /* Tell the BIOS if we want cold or warm reboot */
372 *((unsigned short *)__va(0x472)) = reboot_mode; 432 *((unsigned short *)__va(0x472)) = reboot_mode;
373 433
@@ -404,12 +464,27 @@ static void native_machine_emergency_restart(void)
404 reboot_type = BOOT_KBD; 464 reboot_type = BOOT_KBD;
405 break; 465 break;
406 466
407
408 case BOOT_EFI: 467 case BOOT_EFI:
409 if (efi_enabled) 468 if (efi_enabled)
410 efi.reset_system(reboot_mode ? EFI_RESET_WARM : EFI_RESET_COLD, 469 efi.reset_system(reboot_mode ?
470 EFI_RESET_WARM :
471 EFI_RESET_COLD,
411 EFI_SUCCESS, 0, NULL); 472 EFI_SUCCESS, 0, NULL);
473 reboot_type = BOOT_KBD;
474 break;
475
476 case BOOT_CF9:
477 port_cf9_safe = true;
478 /* fall through */
412 479
480 case BOOT_CF9_COND:
481 if (port_cf9_safe) {
482 u8 cf9 = inb(0xcf9) & ~6;
483 outb(cf9|2, 0xcf9); /* Request hard reset */
484 udelay(50);
485 outb(cf9|6, 0xcf9); /* Actually do the reset */
486 udelay(50);
487 }
413 reboot_type = BOOT_KBD; 488 reboot_type = BOOT_KBD;
414 break; 489 break;
415 } 490 }
@@ -426,7 +501,7 @@ void native_machine_shutdown(void)
426 501
427#ifdef CONFIG_X86_32 502#ifdef CONFIG_X86_32
428 /* See if there has been given a command line override */ 503 /* See if there has been given a command line override */
429 if ((reboot_cpu != -1) && (reboot_cpu < NR_CPUS) && 504 if ((reboot_cpu != -1) && (reboot_cpu < nr_cpu_ids) &&
430 cpu_online(reboot_cpu)) 505 cpu_online(reboot_cpu))
431 reboot_cpu_id = reboot_cpu; 506 reboot_cpu_id = reboot_cpu;
432#endif 507#endif
@@ -436,7 +511,7 @@ void native_machine_shutdown(void)
436 reboot_cpu_id = smp_processor_id(); 511 reboot_cpu_id = smp_processor_id();
437 512
438 /* Make certain I only run on the appropriate processor */ 513 /* Make certain I only run on the appropriate processor */
439 set_cpus_allowed_ptr(current, &cpumask_of_cpu(reboot_cpu_id)); 514 set_cpus_allowed_ptr(current, cpumask_of(reboot_cpu_id));
440 515
441 /* O.K Now that I'm on the appropriate processor, 516 /* O.K Now that I'm on the appropriate processor,
442 * stop all of the others. 517 * stop all of the others.
@@ -459,17 +534,28 @@ void native_machine_shutdown(void)
459#endif 534#endif
460} 535}
461 536
537static void __machine_emergency_restart(int emergency)
538{
539 reboot_emergency = emergency;
540 machine_ops.emergency_restart();
541}
542
462static void native_machine_restart(char *__unused) 543static void native_machine_restart(char *__unused)
463{ 544{
464 printk("machine restart\n"); 545 printk("machine restart\n");
465 546
466 if (!reboot_force) 547 if (!reboot_force)
467 machine_shutdown(); 548 machine_shutdown();
468 machine_emergency_restart(); 549 __machine_emergency_restart(0);
469} 550}
470 551
471static void native_machine_halt(void) 552static void native_machine_halt(void)
472{ 553{
554 /* stop other cpus and apics */
555 machine_shutdown();
556
557 /* stop this cpu */
558 stop_this_cpu(NULL);
473} 559}
474 560
475static void native_machine_power_off(void) 561static void native_machine_power_off(void)
@@ -504,7 +590,7 @@ void machine_shutdown(void)
504 590
505void machine_emergency_restart(void) 591void machine_emergency_restart(void)
506{ 592{
507 machine_ops.emergency_restart(); 593 __machine_emergency_restart(1);
508} 594}
509 595
510void machine_restart(char *cmd) 596void machine_restart(char *cmd)
@@ -523,3 +609,92 @@ void machine_crash_shutdown(struct pt_regs *regs)
523 machine_ops.crash_shutdown(regs); 609 machine_ops.crash_shutdown(regs);
524} 610}
525#endif 611#endif
612
613
614#if defined(CONFIG_SMP)
615
616/* This keeps a track of which one is crashing cpu. */
617static int crashing_cpu;
618static nmi_shootdown_cb shootdown_callback;
619
620static atomic_t waiting_for_crash_ipi;
621
622static int crash_nmi_callback(struct notifier_block *self,
623 unsigned long val, void *data)
624{
625 int cpu;
626
627 if (val != DIE_NMI_IPI)
628 return NOTIFY_OK;
629
630 cpu = raw_smp_processor_id();
631
632 /* Don't do anything if this handler is invoked on crashing cpu.
633 * Otherwise, system will completely hang. Crashing cpu can get
634 * an NMI if system was initially booted with nmi_watchdog parameter.
635 */
636 if (cpu == crashing_cpu)
637 return NOTIFY_STOP;
638 local_irq_disable();
639
640 shootdown_callback(cpu, (struct die_args *)data);
641
642 atomic_dec(&waiting_for_crash_ipi);
643 /* Assume hlt works */
644 halt();
645 for (;;)
646 cpu_relax();
647
648 return 1;
649}
650
651static void smp_send_nmi_allbutself(void)
652{
653 send_IPI_allbutself(NMI_VECTOR);
654}
655
656static struct notifier_block crash_nmi_nb = {
657 .notifier_call = crash_nmi_callback,
658};
659
660/* Halt all other CPUs, calling the specified function on each of them
661 *
662 * This function can be used to halt all other CPUs on crash
663 * or emergency reboot time. The function passed as parameter
664 * will be called inside a NMI handler on all CPUs.
665 */
666void nmi_shootdown_cpus(nmi_shootdown_cb callback)
667{
668 unsigned long msecs;
669 local_irq_disable();
670
671 /* Make a note of crashing cpu. Will be used in NMI callback.*/
672 crashing_cpu = safe_smp_processor_id();
673
674 shootdown_callback = callback;
675
676 atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1);
677 /* Would it be better to replace the trap vector here? */
678 if (register_die_notifier(&crash_nmi_nb))
679 return; /* return what? */
680 /* Ensure the new callback function is set before sending
681 * out the NMI
682 */
683 wmb();
684
685 smp_send_nmi_allbutself();
686
687 msecs = 1000; /* Wait at most a second for the other cpus to stop */
688 while ((atomic_read(&waiting_for_crash_ipi) > 0) && msecs) {
689 mdelay(1);
690 msecs--;
691 }
692
693 /* Leave the nmi callback set */
694}
695#else /* !CONFIG_SMP */
696void nmi_shootdown_cpus(nmi_shootdown_cb callback)
697{
698 /* No other CPUs to shoot down */
699}
700#endif
diff --git a/arch/x86/kernel/relocate_kernel_32.S b/arch/x86/kernel/relocate_kernel_32.S
index 6f50664b2ba5..a160f3119725 100644
--- a/arch/x86/kernel/relocate_kernel_32.S
+++ b/arch/x86/kernel/relocate_kernel_32.S
@@ -10,15 +10,12 @@
10#include <asm/page.h> 10#include <asm/page.h>
11#include <asm/kexec.h> 11#include <asm/kexec.h>
12#include <asm/processor-flags.h> 12#include <asm/processor-flags.h>
13#include <asm/pgtable.h>
14 13
15/* 14/*
16 * Must be relocatable PIC code callable as a C function 15 * Must be relocatable PIC code callable as a C function
17 */ 16 */
18 17
19#define PTR(x) (x << 2) 18#define PTR(x) (x << 2)
20#define PAGE_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
21#define PAE_PGD_ATTR (_PAGE_PRESENT)
22 19
23/* control_page + KEXEC_CONTROL_CODE_MAX_SIZE 20/* control_page + KEXEC_CONTROL_CODE_MAX_SIZE
24 * ~ control_page + PAGE_SIZE are used as data storage and stack for 21 * ~ control_page + PAGE_SIZE are used as data storage and stack for
@@ -39,7 +36,6 @@
39#define CP_PA_BACKUP_PAGES_MAP DATA(0x1c) 36#define CP_PA_BACKUP_PAGES_MAP DATA(0x1c)
40 37
41 .text 38 .text
42 .align PAGE_SIZE
43 .globl relocate_kernel 39 .globl relocate_kernel
44relocate_kernel: 40relocate_kernel:
45 /* Save the CPU context, used for jumping back */ 41 /* Save the CPU context, used for jumping back */
@@ -60,117 +56,6 @@ relocate_kernel:
60 movl %cr4, %eax 56 movl %cr4, %eax
61 movl %eax, CR4(%edi) 57 movl %eax, CR4(%edi)
62 58
63#ifdef CONFIG_X86_PAE
64 /* map the control page at its virtual address */
65
66 movl PTR(VA_PGD)(%ebp), %edi
67 movl PTR(VA_CONTROL_PAGE)(%ebp), %eax
68 andl $0xc0000000, %eax
69 shrl $27, %eax
70 addl %edi, %eax
71
72 movl PTR(PA_PMD_0)(%ebp), %edx
73 orl $PAE_PGD_ATTR, %edx
74 movl %edx, (%eax)
75
76 movl PTR(VA_PMD_0)(%ebp), %edi
77 movl PTR(VA_CONTROL_PAGE)(%ebp), %eax
78 andl $0x3fe00000, %eax
79 shrl $18, %eax
80 addl %edi, %eax
81
82 movl PTR(PA_PTE_0)(%ebp), %edx
83 orl $PAGE_ATTR, %edx
84 movl %edx, (%eax)
85
86 movl PTR(VA_PTE_0)(%ebp), %edi
87 movl PTR(VA_CONTROL_PAGE)(%ebp), %eax
88 andl $0x001ff000, %eax
89 shrl $9, %eax
90 addl %edi, %eax
91
92 movl PTR(PA_CONTROL_PAGE)(%ebp), %edx
93 orl $PAGE_ATTR, %edx
94 movl %edx, (%eax)
95
96 /* identity map the control page at its physical address */
97
98 movl PTR(VA_PGD)(%ebp), %edi
99 movl PTR(PA_CONTROL_PAGE)(%ebp), %eax
100 andl $0xc0000000, %eax
101 shrl $27, %eax
102 addl %edi, %eax
103
104 movl PTR(PA_PMD_1)(%ebp), %edx
105 orl $PAE_PGD_ATTR, %edx
106 movl %edx, (%eax)
107
108 movl PTR(VA_PMD_1)(%ebp), %edi
109 movl PTR(PA_CONTROL_PAGE)(%ebp), %eax
110 andl $0x3fe00000, %eax
111 shrl $18, %eax
112 addl %edi, %eax
113
114 movl PTR(PA_PTE_1)(%ebp), %edx
115 orl $PAGE_ATTR, %edx
116 movl %edx, (%eax)
117
118 movl PTR(VA_PTE_1)(%ebp), %edi
119 movl PTR(PA_CONTROL_PAGE)(%ebp), %eax
120 andl $0x001ff000, %eax
121 shrl $9, %eax
122 addl %edi, %eax
123
124 movl PTR(PA_CONTROL_PAGE)(%ebp), %edx
125 orl $PAGE_ATTR, %edx
126 movl %edx, (%eax)
127#else
128 /* map the control page at its virtual address */
129
130 movl PTR(VA_PGD)(%ebp), %edi
131 movl PTR(VA_CONTROL_PAGE)(%ebp), %eax
132 andl $0xffc00000, %eax
133 shrl $20, %eax
134 addl %edi, %eax
135
136 movl PTR(PA_PTE_0)(%ebp), %edx
137 orl $PAGE_ATTR, %edx
138 movl %edx, (%eax)
139
140 movl PTR(VA_PTE_0)(%ebp), %edi
141 movl PTR(VA_CONTROL_PAGE)(%ebp), %eax
142 andl $0x003ff000, %eax
143 shrl $10, %eax
144 addl %edi, %eax
145
146 movl PTR(PA_CONTROL_PAGE)(%ebp), %edx
147 orl $PAGE_ATTR, %edx
148 movl %edx, (%eax)
149
150 /* identity map the control page at its physical address */
151
152 movl PTR(VA_PGD)(%ebp), %edi
153 movl PTR(PA_CONTROL_PAGE)(%ebp), %eax
154 andl $0xffc00000, %eax
155 shrl $20, %eax
156 addl %edi, %eax
157
158 movl PTR(PA_PTE_1)(%ebp), %edx
159 orl $PAGE_ATTR, %edx
160 movl %edx, (%eax)
161
162 movl PTR(VA_PTE_1)(%ebp), %edi
163 movl PTR(PA_CONTROL_PAGE)(%ebp), %eax
164 andl $0x003ff000, %eax
165 shrl $10, %eax
166 addl %edi, %eax
167
168 movl PTR(PA_CONTROL_PAGE)(%ebp), %edx
169 orl $PAGE_ATTR, %edx
170 movl %edx, (%eax)
171#endif
172
173relocate_new_kernel:
174 /* read the arguments and say goodbye to the stack */ 59 /* read the arguments and say goodbye to the stack */
175 movl 20+4(%esp), %ebx /* page_list */ 60 movl 20+4(%esp), %ebx /* page_list */
176 movl 20+8(%esp), %ebp /* list of pages */ 61 movl 20+8(%esp), %ebp /* list of pages */
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index bdec76e55594..ae0d8042cf69 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -93,11 +93,13 @@
93#include <asm/desc.h> 93#include <asm/desc.h>
94#include <asm/dma.h> 94#include <asm/dma.h>
95#include <asm/iommu.h> 95#include <asm/iommu.h>
96#include <asm/gart.h>
96#include <asm/mmu_context.h> 97#include <asm/mmu_context.h>
97#include <asm/proto.h> 98#include <asm/proto.h>
98 99
99#include <mach_apic.h> 100#include <mach_apic.h>
100#include <asm/paravirt.h> 101#include <asm/paravirt.h>
102#include <asm/hypervisor.h>
101 103
102#include <asm/percpu.h> 104#include <asm/percpu.h>
103#include <asm/topology.h> 105#include <asm/topology.h>
@@ -448,6 +450,7 @@ static void __init reserve_early_setup_data(void)
448 * @size: Size of the crashkernel memory to reserve. 450 * @size: Size of the crashkernel memory to reserve.
449 * Returns the base address on success, and -1ULL on failure. 451 * Returns the base address on success, and -1ULL on failure.
450 */ 452 */
453static
451unsigned long long __init find_and_reserve_crashkernel(unsigned long long size) 454unsigned long long __init find_and_reserve_crashkernel(unsigned long long size)
452{ 455{
453 const unsigned long long alignment = 16<<20; /* 16M */ 456 const unsigned long long alignment = 16<<20; /* 16M */
@@ -583,161 +586,24 @@ static int __init setup_elfcorehdr(char *arg)
583early_param("elfcorehdr", setup_elfcorehdr); 586early_param("elfcorehdr", setup_elfcorehdr);
584#endif 587#endif
585 588
586static struct x86_quirks default_x86_quirks __initdata; 589static int __init default_update_genapic(void)
587
588struct x86_quirks *x86_quirks __initdata = &default_x86_quirks;
589
590/*
591 * Some BIOSes seem to corrupt the low 64k of memory during events
592 * like suspend/resume and unplugging an HDMI cable. Reserve all
593 * remaining free memory in that area and fill it with a distinct
594 * pattern.
595 */
596#ifdef CONFIG_X86_CHECK_BIOS_CORRUPTION
597#define MAX_SCAN_AREAS 8
598
599static int __read_mostly memory_corruption_check = -1;
600
601static unsigned __read_mostly corruption_check_size = 64*1024;
602static unsigned __read_mostly corruption_check_period = 60; /* seconds */
603
604static struct e820entry scan_areas[MAX_SCAN_AREAS];
605static int num_scan_areas;
606
607
608static int set_corruption_check(char *arg)
609{
610 char *end;
611
612 memory_corruption_check = simple_strtol(arg, &end, 10);
613
614 return (*end == 0) ? 0 : -EINVAL;
615}
616early_param("memory_corruption_check", set_corruption_check);
617
618static int set_corruption_check_period(char *arg)
619{
620 char *end;
621
622 corruption_check_period = simple_strtoul(arg, &end, 10);
623
624 return (*end == 0) ? 0 : -EINVAL;
625}
626early_param("memory_corruption_check_period", set_corruption_check_period);
627
628static int set_corruption_check_size(char *arg)
629{ 590{
630 char *end; 591#ifdef CONFIG_X86_SMP
631 unsigned size; 592# if defined(CONFIG_X86_GENERICARCH) || defined(CONFIG_X86_64)
632 593 genapic->wakeup_cpu = wakeup_secondary_cpu_via_init;
633 size = memparse(arg, &end); 594# endif
634
635 if (*end == '\0')
636 corruption_check_size = size;
637
638 return (size == corruption_check_size) ? 0 : -EINVAL;
639}
640early_param("memory_corruption_check_size", set_corruption_check_size);
641
642
643static void __init setup_bios_corruption_check(void)
644{
645 u64 addr = PAGE_SIZE; /* assume first page is reserved anyway */
646
647 if (memory_corruption_check == -1) {
648 memory_corruption_check =
649#ifdef CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK
650 1
651#else
652 0
653#endif 595#endif
654 ;
655 }
656
657 if (corruption_check_size == 0)
658 memory_corruption_check = 0;
659
660 if (!memory_corruption_check)
661 return;
662
663 corruption_check_size = round_up(corruption_check_size, PAGE_SIZE);
664 596
665 while(addr < corruption_check_size && num_scan_areas < MAX_SCAN_AREAS) { 597 return 0;
666 u64 size;
667 addr = find_e820_area_size(addr, &size, PAGE_SIZE);
668
669 if (addr == 0)
670 break;
671
672 if ((addr + size) > corruption_check_size)
673 size = corruption_check_size - addr;
674
675 if (size == 0)
676 break;
677
678 e820_update_range(addr, size, E820_RAM, E820_RESERVED);
679 scan_areas[num_scan_areas].addr = addr;
680 scan_areas[num_scan_areas].size = size;
681 num_scan_areas++;
682
683 /* Assume we've already mapped this early memory */
684 memset(__va(addr), 0, size);
685
686 addr += size;
687 }
688
689 printk(KERN_INFO "Scanning %d areas for low memory corruption\n",
690 num_scan_areas);
691 update_e820();
692}
693
694static struct timer_list periodic_check_timer;
695
696void check_for_bios_corruption(void)
697{
698 int i;
699 int corruption = 0;
700
701 if (!memory_corruption_check)
702 return;
703
704 for(i = 0; i < num_scan_areas; i++) {
705 unsigned long *addr = __va(scan_areas[i].addr);
706 unsigned long size = scan_areas[i].size;
707
708 for(; size; addr++, size -= sizeof(unsigned long)) {
709 if (!*addr)
710 continue;
711 printk(KERN_ERR "Corrupted low memory at %p (%lx phys) = %08lx\n",
712 addr, __pa(addr), *addr);
713 corruption = 1;
714 *addr = 0;
715 }
716 }
717
718 WARN(corruption, KERN_ERR "Memory corruption detected in low memory\n");
719}
720
721static void periodic_check_for_corruption(unsigned long data)
722{
723 check_for_bios_corruption();
724 mod_timer(&periodic_check_timer, round_jiffies(jiffies + corruption_check_period*HZ));
725} 598}
726 599
727void start_periodic_check_for_corruption(void) 600static struct x86_quirks default_x86_quirks __initdata = {
728{ 601 .update_genapic = default_update_genapic,
729 if (!memory_corruption_check || corruption_check_period == 0) 602};
730 return;
731
732 printk(KERN_INFO "Scanning for low memory corruption every %d seconds\n",
733 corruption_check_period);
734 603
735 init_timer(&periodic_check_timer); 604struct x86_quirks *x86_quirks __initdata = &default_x86_quirks;
736 periodic_check_timer.function = &periodic_check_for_corruption;
737 periodic_check_for_corruption(0);
738}
739#endif
740 605
606#ifdef CONFIG_X86_RESERVE_LOW_64K
741static int __init dmi_low_memory_corruption(const struct dmi_system_id *d) 607static int __init dmi_low_memory_corruption(const struct dmi_system_id *d)
742{ 608{
743 printk(KERN_NOTICE 609 printk(KERN_NOTICE
@@ -749,6 +615,7 @@ static int __init dmi_low_memory_corruption(const struct dmi_system_id *d)
749 615
750 return 0; 616 return 0;
751} 617}
618#endif
752 619
753/* List of systems that have known low memory corruption BIOS problems */ 620/* List of systems that have known low memory corruption BIOS problems */
754static struct dmi_system_id __initdata bad_bios_dmi_table[] = { 621static struct dmi_system_id __initdata bad_bios_dmi_table[] = {
@@ -907,6 +774,12 @@ void __init setup_arch(char **cmdline_p)
907 774
908 dmi_check_system(bad_bios_dmi_table); 775 dmi_check_system(bad_bios_dmi_table);
909 776
777 /*
778 * VMware detection requires dmi to be available, so this
779 * needs to be done after dmi_scan_machine, for the BP.
780 */
781 init_hypervisor(&boot_cpu_data);
782
910#ifdef CONFIG_X86_32 783#ifdef CONFIG_X86_32
911 probe_roms(); 784 probe_roms();
912#endif 785#endif
@@ -1080,7 +953,7 @@ void __init setup_arch(char **cmdline_p)
1080 ioapic_init_mappings(); 953 ioapic_init_mappings();
1081 954
1082 /* need to wait for io_apic is mapped */ 955 /* need to wait for io_apic is mapped */
1083 nr_irqs = probe_nr_irqs(); 956 probe_nr_irqs_gsi();
1084 957
1085 kvm_guest_init(); 958 kvm_guest_init();
1086 959
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index ae0c0d3bb770..a4b619c33106 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -152,8 +152,11 @@ void __init setup_per_cpu_areas(void)
152 old_size = PERCPU_ENOUGH_ROOM; 152 old_size = PERCPU_ENOUGH_ROOM;
153 align = max_t(unsigned long, PAGE_SIZE, align); 153 align = max_t(unsigned long, PAGE_SIZE, align);
154 size = roundup(old_size, align); 154 size = roundup(old_size, align);
155 printk(KERN_INFO "PERCPU: Allocating %zd bytes of per cpu data\n", 155
156 size); 156 pr_info("NR_CPUS:%d nr_cpumask_bits:%d nr_cpu_ids:%d nr_node_ids:%d\n",
157 NR_CPUS, nr_cpumask_bits, nr_cpu_ids, nr_node_ids);
158
159 pr_info("PERCPU: Allocating %zd bytes of per cpu data\n", size);
157 160
158 for_each_possible_cpu(cpu) { 161 for_each_possible_cpu(cpu) {
159#ifndef CONFIG_NEED_MULTIPLE_NODES 162#ifndef CONFIG_NEED_MULTIPLE_NODES
@@ -164,28 +167,21 @@ void __init setup_per_cpu_areas(void)
164 if (!node_online(node) || !NODE_DATA(node)) { 167 if (!node_online(node) || !NODE_DATA(node)) {
165 ptr = __alloc_bootmem(size, align, 168 ptr = __alloc_bootmem(size, align,
166 __pa(MAX_DMA_ADDRESS)); 169 __pa(MAX_DMA_ADDRESS));
167 printk(KERN_INFO 170 pr_info("cpu %d has no node %d or node-local memory\n",
168 "cpu %d has no node %d or node-local memory\n",
169 cpu, node); 171 cpu, node);
170 if (ptr) 172 pr_debug("per cpu data for cpu%d at %016lx\n",
171 printk(KERN_DEBUG "per cpu data for cpu%d at %016lx\n", 173 cpu, __pa(ptr));
172 cpu, __pa(ptr)); 174 } else {
173 }
174 else {
175 ptr = __alloc_bootmem_node(NODE_DATA(node), size, align, 175 ptr = __alloc_bootmem_node(NODE_DATA(node), size, align,
176 __pa(MAX_DMA_ADDRESS)); 176 __pa(MAX_DMA_ADDRESS));
177 if (ptr) 177 pr_debug("per cpu data for cpu%d on node%d at %016lx\n",
178 printk(KERN_DEBUG "per cpu data for cpu%d on node%d at %016lx\n", 178 cpu, node, __pa(ptr));
179 cpu, node, __pa(ptr));
180 } 179 }
181#endif 180#endif
182 per_cpu_offset(cpu) = ptr - __per_cpu_start; 181 per_cpu_offset(cpu) = ptr - __per_cpu_start;
183 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); 182 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
184 } 183 }
185 184
186 printk(KERN_DEBUG "NR_CPUS: %d, nr_cpu_ids: %d, nr_node_ids %d\n",
187 NR_CPUS, nr_cpu_ids, nr_node_ids);
188
189 /* Setup percpu data maps */ 185 /* Setup percpu data maps */
190 setup_per_cpu_maps(); 186 setup_per_cpu_maps();
191 187
@@ -282,7 +278,7 @@ static void __cpuinit numa_set_cpumask(int cpu, int enable)
282 else 278 else
283 cpu_clear(cpu, *mask); 279 cpu_clear(cpu, *mask);
284 280
285 cpulist_scnprintf(buf, sizeof(buf), *mask); 281 cpulist_scnprintf(buf, sizeof(buf), mask);
286 printk(KERN_DEBUG "%s cpu %d node %d: mask now %s\n", 282 printk(KERN_DEBUG "%s cpu %d node %d: mask now %s\n",
287 enable? "numa_add_cpu":"numa_remove_cpu", cpu, node, buf); 283 enable? "numa_add_cpu":"numa_remove_cpu", cpu, node, buf);
288 } 284 }
@@ -334,25 +330,25 @@ static const cpumask_t cpu_mask_none;
334/* 330/*
335 * Returns a pointer to the bitmask of CPUs on Node 'node'. 331 * Returns a pointer to the bitmask of CPUs on Node 'node'.
336 */ 332 */
337const cpumask_t *_node_to_cpumask_ptr(int node) 333const cpumask_t *cpumask_of_node(int node)
338{ 334{
339 if (node_to_cpumask_map == NULL) { 335 if (node_to_cpumask_map == NULL) {
340 printk(KERN_WARNING 336 printk(KERN_WARNING
341 "_node_to_cpumask_ptr(%d): no node_to_cpumask_map!\n", 337 "cpumask_of_node(%d): no node_to_cpumask_map!\n",
342 node); 338 node);
343 dump_stack(); 339 dump_stack();
344 return (const cpumask_t *)&cpu_online_map; 340 return (const cpumask_t *)&cpu_online_map;
345 } 341 }
346 if (node >= nr_node_ids) { 342 if (node >= nr_node_ids) {
347 printk(KERN_WARNING 343 printk(KERN_WARNING
348 "_node_to_cpumask_ptr(%d): node > nr_node_ids(%d)\n", 344 "cpumask_of_node(%d): node > nr_node_ids(%d)\n",
349 node, nr_node_ids); 345 node, nr_node_ids);
350 dump_stack(); 346 dump_stack();
351 return &cpu_mask_none; 347 return &cpu_mask_none;
352 } 348 }
353 return &node_to_cpumask_map[node]; 349 return &node_to_cpumask_map[node];
354} 350}
355EXPORT_SYMBOL(_node_to_cpumask_ptr); 351EXPORT_SYMBOL(cpumask_of_node);
356 352
357/* 353/*
358 * Returns a bitmask of CPUs on Node 'node'. 354 * Returns a bitmask of CPUs on Node 'node'.
diff --git a/arch/x86/kernel/sigframe.h b/arch/x86/kernel/sigframe.h
deleted file mode 100644
index cc673aa55ce4..000000000000
--- a/arch/x86/kernel/sigframe.h
+++ /dev/null
@@ -1,42 +0,0 @@
1#ifdef CONFIG_X86_32
2struct sigframe {
3 char __user *pretcode;
4 int sig;
5 struct sigcontext sc;
6 /*
7 * fpstate is unused. fpstate is moved/allocated after
8 * retcode[] below. This movement allows to have the FP state and the
9 * future state extensions (xsave) stay together.
10 * And at the same time retaining the unused fpstate, prevents changing
11 * the offset of extramask[] in the sigframe and thus prevent any
12 * legacy application accessing/modifying it.
13 */
14 struct _fpstate fpstate_unused;
15 unsigned long extramask[_NSIG_WORDS-1];
16 char retcode[8];
17 /* fp state follows here */
18};
19
20struct rt_sigframe {
21 char __user *pretcode;
22 int sig;
23 struct siginfo __user *pinfo;
24 void __user *puc;
25 struct siginfo info;
26 struct ucontext uc;
27 char retcode[8];
28 /* fp state follows here */
29};
30#else
31struct rt_sigframe {
32 char __user *pretcode;
33 struct ucontext uc;
34 struct siginfo info;
35 /* fp state follows here */
36};
37
38int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
39 sigset_t *set, struct pt_regs *regs);
40int ia32_setup_frame(int sig, struct k_sigaction *ka,
41 sigset_t *set, struct pt_regs *regs);
42#endif
diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal.c
index d6dd057d0f22..89bb7668041d 100644
--- a/arch/x86/kernel/signal_32.c
+++ b/arch/x86/kernel/signal.c
@@ -1,36 +1,41 @@
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 * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson 5 * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson
5 * 2000-06-20 Pentium III FXSR, SSE support by Gareth Hughes 6 * 2000-06-20 Pentium III FXSR, SSE support by Gareth Hughes
7 * 2000-2002 x86-64 support by Andi Kleen
6 */ 8 */
7#include <linux/list.h>
8 9
9#include <linux/personality.h> 10#include <linux/sched.h>
10#include <linux/binfmts.h> 11#include <linux/mm.h>
11#include <linux/suspend.h> 12#include <linux/smp.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
13#include <linux/ptrace.h>
14#include <linux/signal.h> 14#include <linux/signal.h>
15#include <linux/stddef.h>
16#include <linux/unistd.h>
17#include <linux/errno.h> 15#include <linux/errno.h>
18#include <linux/sched.h>
19#include <linux/wait.h> 16#include <linux/wait.h>
17#include <linux/ptrace.h>
20#include <linux/tracehook.h> 18#include <linux/tracehook.h>
21#include <linux/elf.h> 19#include <linux/unistd.h>
22#include <linux/smp.h> 20#include <linux/stddef.h>
23#include <linux/mm.h> 21#include <linux/personality.h>
22#include <linux/uaccess.h>
24 23
25#include <asm/processor.h> 24#include <asm/processor.h>
26#include <asm/ucontext.h> 25#include <asm/ucontext.h>
27#include <asm/uaccess.h>
28#include <asm/i387.h> 26#include <asm/i387.h>
29#include <asm/vdso.h> 27#include <asm/vdso.h>
28
29#ifdef CONFIG_X86_64
30#include <asm/proto.h>
31#include <asm/ia32_unistd.h>
32#include <asm/mce.h>
33#endif /* CONFIG_X86_64 */
34
30#include <asm/syscall.h> 35#include <asm/syscall.h>
31#include <asm/syscalls.h> 36#include <asm/syscalls.h>
32 37
33#include "sigframe.h" 38#include <asm/sigframe.h>
34 39
35#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 40#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
36 41
@@ -45,74 +50,6 @@
45# define FIX_EFLAGS __FIX_EFLAGS 50# define FIX_EFLAGS __FIX_EFLAGS
46#endif 51#endif
47 52
48/*
49 * Atomically swap in the new signal mask, and wait for a signal.
50 */
51asmlinkage int
52sys_sigsuspend(int history0, int history1, old_sigset_t mask)
53{
54 mask &= _BLOCKABLE;
55 spin_lock_irq(&current->sighand->siglock);
56 current->saved_sigmask = current->blocked;
57 siginitset(&current->blocked, mask);
58 recalc_sigpending();
59 spin_unlock_irq(&current->sighand->siglock);
60
61 current->state = TASK_INTERRUPTIBLE;
62 schedule();
63 set_restore_sigmask();
64
65 return -ERESTARTNOHAND;
66}
67
68asmlinkage int
69sys_sigaction(int sig, const struct old_sigaction __user *act,
70 struct old_sigaction __user *oact)
71{
72 struct k_sigaction new_ka, old_ka;
73 int ret;
74
75 if (act) {
76 old_sigset_t mask;
77
78 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
79 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
80 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
81 return -EFAULT;
82
83 __get_user(new_ka.sa.sa_flags, &act->sa_flags);
84 __get_user(mask, &act->sa_mask);
85 siginitset(&new_ka.sa.sa_mask, mask);
86 }
87
88 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
89
90 if (!ret && oact) {
91 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
92 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
93 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
94 return -EFAULT;
95
96 __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
97 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
98 }
99
100 return ret;
101}
102
103asmlinkage int sys_sigaltstack(unsigned long bx)
104{
105 /*
106 * This is needed to make gcc realize it doesn't own the
107 * "struct pt_regs"
108 */
109 struct pt_regs *regs = (struct pt_regs *)&bx;
110 const stack_t __user *uss = (const stack_t __user *)bx;
111 stack_t __user *uoss = (stack_t __user *)regs->cx;
112
113 return do_sigaltstack(uss, uoss, regs->sp);
114}
115
116#define COPY(x) { \ 53#define COPY(x) { \
117 err |= __get_user(regs->x, &sc->x); \ 54 err |= __get_user(regs->x, &sc->x); \
118} 55}
@@ -123,7 +60,7 @@ asmlinkage int sys_sigaltstack(unsigned long bx)
123 regs->seg = tmp; \ 60 regs->seg = tmp; \
124} 61}
125 62
126#define COPY_SEG_STRICT(seg) { \ 63#define COPY_SEG_CPL3(seg) { \
127 unsigned short tmp; \ 64 unsigned short tmp; \
128 err |= __get_user(tmp, &sc->seg); \ 65 err |= __get_user(tmp, &sc->seg); \
129 regs->seg = tmp | 3; \ 66 regs->seg = tmp | 3; \
@@ -135,9 +72,6 @@ asmlinkage int sys_sigaltstack(unsigned long bx)
135 loadsegment(seg, tmp); \ 72 loadsegment(seg, tmp); \
136} 73}
137 74
138/*
139 * Do a signal return; undo the signal stack.
140 */
141static int 75static int
142restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, 76restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
143 unsigned long *pax) 77 unsigned long *pax)
@@ -149,14 +83,36 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
149 /* Always make any pending restarted system calls return -EINTR */ 83 /* Always make any pending restarted system calls return -EINTR */
150 current_thread_info()->restart_block.fn = do_no_restart_syscall; 84 current_thread_info()->restart_block.fn = do_no_restart_syscall;
151 85
86#ifdef CONFIG_X86_32
152 GET_SEG(gs); 87 GET_SEG(gs);
153 COPY_SEG(fs); 88 COPY_SEG(fs);
154 COPY_SEG(es); 89 COPY_SEG(es);
155 COPY_SEG(ds); 90 COPY_SEG(ds);
91#endif /* CONFIG_X86_32 */
92
156 COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); 93 COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx);
157 COPY(dx); COPY(cx); COPY(ip); 94 COPY(dx); COPY(cx); COPY(ip);
158 COPY_SEG_STRICT(cs); 95
159 COPY_SEG_STRICT(ss); 96#ifdef CONFIG_X86_64
97 COPY(r8);
98 COPY(r9);
99 COPY(r10);
100 COPY(r11);
101 COPY(r12);
102 COPY(r13);
103 COPY(r14);
104 COPY(r15);
105#endif /* CONFIG_X86_64 */
106
107#ifdef CONFIG_X86_32
108 COPY_SEG_CPL3(cs);
109 COPY_SEG_CPL3(ss);
110#else /* !CONFIG_X86_32 */
111 /* Kernel saves and restores only the CS segment register on signals,
112 * which is the bare minimum needed to allow mixed 32/64-bit code.
113 * App's signal handler can save/restore other segments if needed. */
114 COPY_SEG_CPL3(cs);
115#endif /* CONFIG_X86_32 */
160 116
161 err |= __get_user(tmpflags, &sc->flags); 117 err |= __get_user(tmpflags, &sc->flags);
162 regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); 118 regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
@@ -169,102 +125,24 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
169 return err; 125 return err;
170} 126}
171 127
172asmlinkage unsigned long sys_sigreturn(unsigned long __unused)
173{
174 struct sigframe __user *frame;
175 struct pt_regs *regs;
176 unsigned long ax;
177 sigset_t set;
178
179 regs = (struct pt_regs *) &__unused;
180 frame = (struct sigframe __user *)(regs->sp - 8);
181
182 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
183 goto badframe;
184 if (__get_user(set.sig[0], &frame->sc.oldmask) || (_NSIG_WORDS > 1
185 && __copy_from_user(&set.sig[1], &frame->extramask,
186 sizeof(frame->extramask))))
187 goto badframe;
188
189 sigdelsetmask(&set, ~_BLOCKABLE);
190 spin_lock_irq(&current->sighand->siglock);
191 current->blocked = set;
192 recalc_sigpending();
193 spin_unlock_irq(&current->sighand->siglock);
194
195 if (restore_sigcontext(regs, &frame->sc, &ax))
196 goto badframe;
197 return ax;
198
199badframe:
200 if (show_unhandled_signals && printk_ratelimit()) {
201 printk("%s%s[%d] bad frame in sigreturn frame:"
202 "%p ip:%lx sp:%lx oeax:%lx",
203 task_pid_nr(current) > 1 ? KERN_INFO : KERN_EMERG,
204 current->comm, task_pid_nr(current), frame, regs->ip,
205 regs->sp, regs->orig_ax);
206 print_vma_addr(" in ", regs->ip);
207 printk(KERN_CONT "\n");
208 }
209
210 force_sig(SIGSEGV, current);
211
212 return 0;
213}
214
215static long do_rt_sigreturn(struct pt_regs *regs)
216{
217 struct rt_sigframe __user *frame;
218 unsigned long ax;
219 sigset_t set;
220
221 frame = (struct rt_sigframe __user *)(regs->sp - sizeof(long));
222 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
223 goto badframe;
224 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
225 goto badframe;
226
227 sigdelsetmask(&set, ~_BLOCKABLE);
228 spin_lock_irq(&current->sighand->siglock);
229 current->blocked = set;
230 recalc_sigpending();
231 spin_unlock_irq(&current->sighand->siglock);
232
233 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax))
234 goto badframe;
235
236 if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->sp) == -EFAULT)
237 goto badframe;
238
239 return ax;
240
241badframe:
242 signal_fault(regs, frame, "rt_sigreturn");
243 return 0;
244}
245
246asmlinkage int sys_rt_sigreturn(unsigned long __unused)
247{
248 struct pt_regs *regs = (struct pt_regs *)&__unused;
249
250 return do_rt_sigreturn(regs);
251}
252
253/*
254 * Set up a signal frame.
255 */
256static int 128static int
257setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate, 129setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate,
258 struct pt_regs *regs, unsigned long mask) 130 struct pt_regs *regs, unsigned long mask)
259{ 131{
260 int tmp, err = 0; 132 int err = 0;
261 133
262 err |= __put_user(regs->fs, (unsigned int __user *)&sc->fs); 134#ifdef CONFIG_X86_32
263 savesegment(gs, tmp); 135 {
264 err |= __put_user(tmp, (unsigned int __user *)&sc->gs); 136 unsigned int tmp;
265 137
138 savesegment(gs, tmp);
139 err |= __put_user(tmp, (unsigned int __user *)&sc->gs);
140 }
141 err |= __put_user(regs->fs, (unsigned int __user *)&sc->fs);
266 err |= __put_user(regs->es, (unsigned int __user *)&sc->es); 142 err |= __put_user(regs->es, (unsigned int __user *)&sc->es);
267 err |= __put_user(regs->ds, (unsigned int __user *)&sc->ds); 143 err |= __put_user(regs->ds, (unsigned int __user *)&sc->ds);
144#endif /* CONFIG_X86_32 */
145
268 err |= __put_user(regs->di, &sc->di); 146 err |= __put_user(regs->di, &sc->di);
269 err |= __put_user(regs->si, &sc->si); 147 err |= __put_user(regs->si, &sc->si);
270 err |= __put_user(regs->bp, &sc->bp); 148 err |= __put_user(regs->bp, &sc->bp);
@@ -273,19 +151,33 @@ setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate,
273 err |= __put_user(regs->dx, &sc->dx); 151 err |= __put_user(regs->dx, &sc->dx);
274 err |= __put_user(regs->cx, &sc->cx); 152 err |= __put_user(regs->cx, &sc->cx);
275 err |= __put_user(regs->ax, &sc->ax); 153 err |= __put_user(regs->ax, &sc->ax);
154#ifdef CONFIG_X86_64
155 err |= __put_user(regs->r8, &sc->r8);
156 err |= __put_user(regs->r9, &sc->r9);
157 err |= __put_user(regs->r10, &sc->r10);
158 err |= __put_user(regs->r11, &sc->r11);
159 err |= __put_user(regs->r12, &sc->r12);
160 err |= __put_user(regs->r13, &sc->r13);
161 err |= __put_user(regs->r14, &sc->r14);
162 err |= __put_user(regs->r15, &sc->r15);
163#endif /* CONFIG_X86_64 */
164
276 err |= __put_user(current->thread.trap_no, &sc->trapno); 165 err |= __put_user(current->thread.trap_no, &sc->trapno);
277 err |= __put_user(current->thread.error_code, &sc->err); 166 err |= __put_user(current->thread.error_code, &sc->err);
278 err |= __put_user(regs->ip, &sc->ip); 167 err |= __put_user(regs->ip, &sc->ip);
168#ifdef CONFIG_X86_32
279 err |= __put_user(regs->cs, (unsigned int __user *)&sc->cs); 169 err |= __put_user(regs->cs, (unsigned int __user *)&sc->cs);
280 err |= __put_user(regs->flags, &sc->flags); 170 err |= __put_user(regs->flags, &sc->flags);
281 err |= __put_user(regs->sp, &sc->sp_at_signal); 171 err |= __put_user(regs->sp, &sc->sp_at_signal);
282 err |= __put_user(regs->ss, (unsigned int __user *)&sc->ss); 172 err |= __put_user(regs->ss, (unsigned int __user *)&sc->ss);
173#else /* !CONFIG_X86_32 */
174 err |= __put_user(regs->flags, &sc->flags);
175 err |= __put_user(regs->cs, &sc->cs);
176 err |= __put_user(0, &sc->gs);
177 err |= __put_user(0, &sc->fs);
178#endif /* CONFIG_X86_32 */
283 179
284 tmp = save_i387_xstate(fpstate); 180 err |= __put_user(fpstate, &sc->fpstate);
285 if (tmp < 0)
286 err = 1;
287 else
288 err |= __put_user(tmp ? fpstate : NULL, &sc->fpstate);
289 181
290 /* non-iBCS2 extensions.. */ 182 /* non-iBCS2 extensions.. */
291 err |= __put_user(mask, &sc->oldmask); 183 err |= __put_user(mask, &sc->oldmask);
@@ -295,6 +187,32 @@ setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate,
295} 187}
296 188
297/* 189/*
190 * Set up a signal frame.
191 */
192#ifdef CONFIG_X86_32
193static const struct {
194 u16 poplmovl;
195 u32 val;
196 u16 int80;
197} __attribute__((packed)) retcode = {
198 0xb858, /* popl %eax; movl $..., %eax */
199 __NR_sigreturn,
200 0x80cd, /* int $0x80 */
201};
202
203static const struct {
204 u8 movl;
205 u32 val;
206 u16 int80;
207 u8 pad;
208} __attribute__((packed)) rt_retcode = {
209 0xb8, /* movl $..., %eax */
210 __NR_rt_sigreturn,
211 0x80cd, /* int $0x80 */
212 0
213};
214
215/*
298 * Determine which stack to use.. 216 * Determine which stack to use..
299 */ 217 */
300static inline void __user * 218static inline void __user *
@@ -328,6 +246,8 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size,
328 if (used_math()) { 246 if (used_math()) {
329 sp = sp - sig_xstate_size; 247 sp = sp - sig_xstate_size;
330 *fpstate = (struct _fpstate *) sp; 248 *fpstate = (struct _fpstate *) sp;
249 if (save_i387_xstate(*fpstate) < 0)
250 return (void __user *)-1L;
331 } 251 }
332 252
333 sp -= frame_size; 253 sp -= frame_size;
@@ -383,9 +303,7 @@ __setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
383 * reasons and because gdb uses it as a signature to notice 303 * reasons and because gdb uses it as a signature to notice
384 * signal handler stack frames. 304 * signal handler stack frames.
385 */ 305 */
386 err |= __put_user(0xb858, (short __user *)(frame->retcode+0)); 306 err |= __put_user(*((u64 *)&retcode), (u64 *)frame->retcode);
387 err |= __put_user(__NR_sigreturn, (int __user *)(frame->retcode+2));
388 err |= __put_user(0x80cd, (short __user *)(frame->retcode+6));
389 307
390 if (err) 308 if (err)
391 return -EFAULT; 309 return -EFAULT;
@@ -454,9 +372,7 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
454 * reasons and because gdb uses it as a signature to notice 372 * reasons and because gdb uses it as a signature to notice
455 * signal handler stack frames. 373 * signal handler stack frames.
456 */ 374 */
457 err |= __put_user(0xb8, (char __user *)(frame->retcode+0)); 375 err |= __put_user(*((u64 *)&rt_retcode), (u64 *)frame->retcode);
458 err |= __put_user(__NR_rt_sigreturn, (int __user *)(frame->retcode+1));
459 err |= __put_user(0x80cd, (short __user *)(frame->retcode+5));
460 376
461 if (err) 377 if (err)
462 return -EFAULT; 378 return -EFAULT;
@@ -475,23 +391,293 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
475 391
476 return 0; 392 return 0;
477} 393}
394#else /* !CONFIG_X86_32 */
395/*
396 * Determine which stack to use..
397 */
398static void __user *
399get_stack(struct k_sigaction *ka, unsigned long sp, unsigned long size)
400{
401 /* Default to using normal stack - redzone*/
402 sp -= 128;
403
404 /* This is the X/Open sanctioned signal stack switching. */
405 if (ka->sa.sa_flags & SA_ONSTACK) {
406 if (sas_ss_flags(sp) == 0)
407 sp = current->sas_ss_sp + current->sas_ss_size;
408 }
409
410 return (void __user *)round_down(sp - size, 64);
411}
412
413static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
414 sigset_t *set, struct pt_regs *regs)
415{
416 struct rt_sigframe __user *frame;
417 void __user *fp = NULL;
418 int err = 0;
419 struct task_struct *me = current;
420
421 if (used_math()) {
422 fp = get_stack(ka, regs->sp, sig_xstate_size);
423 frame = (void __user *)round_down(
424 (unsigned long)fp - sizeof(struct rt_sigframe), 16) - 8;
425
426 if (save_i387_xstate(fp) < 0)
427 return -EFAULT;
428 } else
429 frame = get_stack(ka, regs->sp, sizeof(struct rt_sigframe)) - 8;
430
431 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
432 return -EFAULT;
433
434 if (ka->sa.sa_flags & SA_SIGINFO) {
435 if (copy_siginfo_to_user(&frame->info, info))
436 return -EFAULT;
437 }
438
439 /* Create the ucontext. */
440 if (cpu_has_xsave)
441 err |= __put_user(UC_FP_XSTATE, &frame->uc.uc_flags);
442 else
443 err |= __put_user(0, &frame->uc.uc_flags);
444 err |= __put_user(0, &frame->uc.uc_link);
445 err |= __put_user(me->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
446 err |= __put_user(sas_ss_flags(regs->sp),
447 &frame->uc.uc_stack.ss_flags);
448 err |= __put_user(me->sas_ss_size, &frame->uc.uc_stack.ss_size);
449 err |= setup_sigcontext(&frame->uc.uc_mcontext, fp, regs, set->sig[0]);
450 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
451
452 /* Set up to return from userspace. If provided, use a stub
453 already in userspace. */
454 /* x86-64 should always use SA_RESTORER. */
455 if (ka->sa.sa_flags & SA_RESTORER) {
456 err |= __put_user(ka->sa.sa_restorer, &frame->pretcode);
457 } else {
458 /* could use a vstub here */
459 return -EFAULT;
460 }
461
462 if (err)
463 return -EFAULT;
464
465 /* Set up registers for signal handler */
466 regs->di = sig;
467 /* In case the signal handler was declared without prototypes */
468 regs->ax = 0;
469
470 /* This also works for non SA_SIGINFO handlers because they expect the
471 next argument after the signal number on the stack. */
472 regs->si = (unsigned long)&frame->info;
473 regs->dx = (unsigned long)&frame->uc;
474 regs->ip = (unsigned long) ka->sa.sa_handler;
475
476 regs->sp = (unsigned long)frame;
477
478 /* Set up the CS register to run signal handlers in 64-bit mode,
479 even if the handler happens to be interrupting 32-bit code. */
480 regs->cs = __USER_CS;
481
482 return 0;
483}
484#endif /* CONFIG_X86_32 */
485
486#ifdef CONFIG_X86_32
487/*
488 * Atomically swap in the new signal mask, and wait for a signal.
489 */
490asmlinkage int
491sys_sigsuspend(int history0, int history1, old_sigset_t mask)
492{
493 mask &= _BLOCKABLE;
494 spin_lock_irq(&current->sighand->siglock);
495 current->saved_sigmask = current->blocked;
496 siginitset(&current->blocked, mask);
497 recalc_sigpending();
498 spin_unlock_irq(&current->sighand->siglock);
499
500 current->state = TASK_INTERRUPTIBLE;
501 schedule();
502 set_restore_sigmask();
503
504 return -ERESTARTNOHAND;
505}
506
507asmlinkage int
508sys_sigaction(int sig, const struct old_sigaction __user *act,
509 struct old_sigaction __user *oact)
510{
511 struct k_sigaction new_ka, old_ka;
512 int ret;
513
514 if (act) {
515 old_sigset_t mask;
516
517 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
518 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
519 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
520 return -EFAULT;
521
522 __get_user(new_ka.sa.sa_flags, &act->sa_flags);
523 __get_user(mask, &act->sa_mask);
524 siginitset(&new_ka.sa.sa_mask, mask);
525 }
526
527 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
528
529 if (!ret && oact) {
530 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
531 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
532 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
533 return -EFAULT;
534
535 __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
536 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
537 }
538
539 return ret;
540}
541#endif /* CONFIG_X86_32 */
542
543#ifdef CONFIG_X86_32
544asmlinkage int sys_sigaltstack(unsigned long bx)
545{
546 /*
547 * This is needed to make gcc realize it doesn't own the
548 * "struct pt_regs"
549 */
550 struct pt_regs *regs = (struct pt_regs *)&bx;
551 const stack_t __user *uss = (const stack_t __user *)bx;
552 stack_t __user *uoss = (stack_t __user *)regs->cx;
553
554 return do_sigaltstack(uss, uoss, regs->sp);
555}
556#else /* !CONFIG_X86_32 */
557asmlinkage long
558sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
559 struct pt_regs *regs)
560{
561 return do_sigaltstack(uss, uoss, regs->sp);
562}
563#endif /* CONFIG_X86_32 */
564
565/*
566 * Do a signal return; undo the signal stack.
567 */
568#ifdef CONFIG_X86_32
569asmlinkage unsigned long sys_sigreturn(unsigned long __unused)
570{
571 struct sigframe __user *frame;
572 struct pt_regs *regs;
573 unsigned long ax;
574 sigset_t set;
575
576 regs = (struct pt_regs *) &__unused;
577 frame = (struct sigframe __user *)(regs->sp - 8);
578
579 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
580 goto badframe;
581 if (__get_user(set.sig[0], &frame->sc.oldmask) || (_NSIG_WORDS > 1
582 && __copy_from_user(&set.sig[1], &frame->extramask,
583 sizeof(frame->extramask))))
584 goto badframe;
585
586 sigdelsetmask(&set, ~_BLOCKABLE);
587 spin_lock_irq(&current->sighand->siglock);
588 current->blocked = set;
589 recalc_sigpending();
590 spin_unlock_irq(&current->sighand->siglock);
591
592 if (restore_sigcontext(regs, &frame->sc, &ax))
593 goto badframe;
594 return ax;
595
596badframe:
597 signal_fault(regs, frame, "sigreturn");
598
599 return 0;
600}
601#endif /* CONFIG_X86_32 */
602
603static long do_rt_sigreturn(struct pt_regs *regs)
604{
605 struct rt_sigframe __user *frame;
606 unsigned long ax;
607 sigset_t set;
608
609 frame = (struct rt_sigframe __user *)(regs->sp - sizeof(long));
610 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
611 goto badframe;
612 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
613 goto badframe;
614
615 sigdelsetmask(&set, ~_BLOCKABLE);
616 spin_lock_irq(&current->sighand->siglock);
617 current->blocked = set;
618 recalc_sigpending();
619 spin_unlock_irq(&current->sighand->siglock);
620
621 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax))
622 goto badframe;
623
624 if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->sp) == -EFAULT)
625 goto badframe;
626
627 return ax;
628
629badframe:
630 signal_fault(regs, frame, "rt_sigreturn");
631 return 0;
632}
633
634#ifdef CONFIG_X86_32
635asmlinkage int sys_rt_sigreturn(struct pt_regs regs)
636{
637 return do_rt_sigreturn(&regs);
638}
639#else /* !CONFIG_X86_32 */
640asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
641{
642 return do_rt_sigreturn(regs);
643}
644#endif /* CONFIG_X86_32 */
478 645
479/* 646/*
480 * OK, we're invoking a handler: 647 * OK, we're invoking a handler:
481 */ 648 */
482static int signr_convert(int sig) 649static int signr_convert(int sig)
483{ 650{
651#ifdef CONFIG_X86_32
484 struct thread_info *info = current_thread_info(); 652 struct thread_info *info = current_thread_info();
485 653
486 if (info->exec_domain && info->exec_domain->signal_invmap && sig < 32) 654 if (info->exec_domain && info->exec_domain->signal_invmap && sig < 32)
487 return info->exec_domain->signal_invmap[sig]; 655 return info->exec_domain->signal_invmap[sig];
656#endif /* CONFIG_X86_32 */
488 return sig; 657 return sig;
489} 658}
490 659
660#ifdef CONFIG_X86_32
661
491#define is_ia32 1 662#define is_ia32 1
492#define ia32_setup_frame __setup_frame 663#define ia32_setup_frame __setup_frame
493#define ia32_setup_rt_frame __setup_rt_frame 664#define ia32_setup_rt_frame __setup_rt_frame
494 665
666#else /* !CONFIG_X86_32 */
667
668#ifdef CONFIG_IA32_EMULATION
669#define is_ia32 test_thread_flag(TIF_IA32)
670#else /* !CONFIG_IA32_EMULATION */
671#define is_ia32 0
672#endif /* CONFIG_IA32_EMULATION */
673
674int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
675 sigset_t *set, struct pt_regs *regs);
676int ia32_setup_frame(int sig, struct k_sigaction *ka,
677 sigset_t *set, struct pt_regs *regs);
678
679#endif /* CONFIG_X86_32 */
680
495static int 681static int
496setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 682setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
497 sigset_t *set, struct pt_regs *regs) 683 sigset_t *set, struct pt_regs *regs)
@@ -592,7 +778,13 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
592 return 0; 778 return 0;
593} 779}
594 780
781#ifdef CONFIG_X86_32
595#define NR_restart_syscall __NR_restart_syscall 782#define NR_restart_syscall __NR_restart_syscall
783#else /* !CONFIG_X86_32 */
784#define NR_restart_syscall \
785 test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall : __NR_restart_syscall
786#endif /* CONFIG_X86_32 */
787
596/* 788/*
597 * Note that 'init' is a special process: it doesn't get signals it doesn't 789 * Note that 'init' is a special process: it doesn't get signals it doesn't
598 * want to handle. Thus you cannot kill init even with a SIGKILL even by 790 * want to handle. Thus you cannot kill init even with a SIGKILL even by
@@ -704,8 +896,9 @@ void signal_fault(struct pt_regs *regs, void __user *frame, char *where)
704 struct task_struct *me = current; 896 struct task_struct *me = current;
705 897
706 if (show_unhandled_signals && printk_ratelimit()) { 898 if (show_unhandled_signals && printk_ratelimit()) {
707 printk(KERN_INFO 899 printk("%s"
708 "%s[%d] bad frame in %s frame:%p ip:%lx sp:%lx orax:%lx", 900 "%s[%d] bad frame in %s frame:%p ip:%lx sp:%lx orax:%lx",
901 task_pid_nr(current) > 1 ? KERN_INFO : KERN_EMERG,
709 me->comm, me->pid, where, frame, 902 me->comm, me->pid, where, frame,
710 regs->ip, regs->sp, regs->orig_ax); 903 regs->ip, regs->sp, regs->orig_ax);
711 print_vma_addr(" in ", regs->ip); 904 print_vma_addr(" in ", regs->ip);
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c
deleted file mode 100644
index a5c9627f4db9..000000000000
--- a/arch/x86/kernel/signal_64.c
+++ /dev/null
@@ -1,516 +0,0 @@
1/*
2 * Copyright (C) 1991, 1992 Linus Torvalds
3 * Copyright (C) 2000, 2001, 2002 Andi Kleen SuSE Labs
4 *
5 * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson
6 * 2000-06-20 Pentium III FXSR, SSE support by Gareth Hughes
7 * 2000-2002 x86-64 support by Andi Kleen
8 */
9
10#include <linux/sched.h>
11#include <linux/mm.h>
12#include <linux/smp.h>
13#include <linux/kernel.h>
14#include <linux/signal.h>
15#include <linux/errno.h>
16#include <linux/wait.h>
17#include <linux/ptrace.h>
18#include <linux/tracehook.h>
19#include <linux/unistd.h>
20#include <linux/stddef.h>
21#include <linux/personality.h>
22#include <linux/compiler.h>
23#include <linux/uaccess.h>
24
25#include <asm/processor.h>
26#include <asm/ucontext.h>
27#include <asm/i387.h>
28#include <asm/proto.h>
29#include <asm/ia32_unistd.h>
30#include <asm/mce.h>
31#include <asm/syscall.h>
32#include <asm/syscalls.h>
33#include "sigframe.h"
34
35#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
36
37#define __FIX_EFLAGS (X86_EFLAGS_AC | X86_EFLAGS_OF | \
38 X86_EFLAGS_DF | X86_EFLAGS_TF | X86_EFLAGS_SF | \
39 X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \
40 X86_EFLAGS_CF)
41
42#ifdef CONFIG_X86_32
43# define FIX_EFLAGS (__FIX_EFLAGS | X86_EFLAGS_RF)
44#else
45# define FIX_EFLAGS __FIX_EFLAGS
46#endif
47
48asmlinkage long
49sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
50 struct pt_regs *regs)
51{
52 return do_sigaltstack(uss, uoss, regs->sp);
53}
54
55#define COPY(x) { \
56 err |= __get_user(regs->x, &sc->x); \
57}
58
59#define COPY_SEG_STRICT(seg) { \
60 unsigned short tmp; \
61 err |= __get_user(tmp, &sc->seg); \
62 regs->seg = tmp | 3; \
63}
64
65/*
66 * Do a signal return; undo the signal stack.
67 */
68static int
69restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
70 unsigned long *pax)
71{
72 void __user *buf;
73 unsigned int tmpflags;
74 unsigned int err = 0;
75
76 /* Always make any pending restarted system calls return -EINTR */
77 current_thread_info()->restart_block.fn = do_no_restart_syscall;
78
79 COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx);
80 COPY(dx); COPY(cx); COPY(ip);
81 COPY(r8);
82 COPY(r9);
83 COPY(r10);
84 COPY(r11);
85 COPY(r12);
86 COPY(r13);
87 COPY(r14);
88 COPY(r15);
89
90 /* Kernel saves and restores only the CS segment register on signals,
91 * which is the bare minimum needed to allow mixed 32/64-bit code.
92 * App's signal handler can save/restore other segments if needed. */
93 COPY_SEG_STRICT(cs);
94
95 err |= __get_user(tmpflags, &sc->flags);
96 regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
97 regs->orig_ax = -1; /* disable syscall checks */
98
99 err |= __get_user(buf, &sc->fpstate);
100 err |= restore_i387_xstate(buf);
101
102 err |= __get_user(*pax, &sc->ax);
103 return err;
104}
105
106static long do_rt_sigreturn(struct pt_regs *regs)
107{
108 struct rt_sigframe __user *frame;
109 unsigned long ax;
110 sigset_t set;
111
112 frame = (struct rt_sigframe __user *)(regs->sp - sizeof(long));
113 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
114 goto badframe;
115 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
116 goto badframe;
117
118 sigdelsetmask(&set, ~_BLOCKABLE);
119 spin_lock_irq(&current->sighand->siglock);
120 current->blocked = set;
121 recalc_sigpending();
122 spin_unlock_irq(&current->sighand->siglock);
123
124 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax))
125 goto badframe;
126
127 if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->sp) == -EFAULT)
128 goto badframe;
129
130 return ax;
131
132badframe:
133 signal_fault(regs, frame, "rt_sigreturn");
134 return 0;
135}
136
137asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
138{
139 return do_rt_sigreturn(regs);
140}
141
142/*
143 * Set up a signal frame.
144 */
145
146static inline int
147setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
148 unsigned long mask, struct task_struct *me)
149{
150 int err = 0;
151
152 err |= __put_user(regs->cs, &sc->cs);
153 err |= __put_user(0, &sc->gs);
154 err |= __put_user(0, &sc->fs);
155
156 err |= __put_user(regs->di, &sc->di);
157 err |= __put_user(regs->si, &sc->si);
158 err |= __put_user(regs->bp, &sc->bp);
159 err |= __put_user(regs->sp, &sc->sp);
160 err |= __put_user(regs->bx, &sc->bx);
161 err |= __put_user(regs->dx, &sc->dx);
162 err |= __put_user(regs->cx, &sc->cx);
163 err |= __put_user(regs->ax, &sc->ax);
164 err |= __put_user(regs->r8, &sc->r8);
165 err |= __put_user(regs->r9, &sc->r9);
166 err |= __put_user(regs->r10, &sc->r10);
167 err |= __put_user(regs->r11, &sc->r11);
168 err |= __put_user(regs->r12, &sc->r12);
169 err |= __put_user(regs->r13, &sc->r13);
170 err |= __put_user(regs->r14, &sc->r14);
171 err |= __put_user(regs->r15, &sc->r15);
172 err |= __put_user(me->thread.trap_no, &sc->trapno);
173 err |= __put_user(me->thread.error_code, &sc->err);
174 err |= __put_user(regs->ip, &sc->ip);
175 err |= __put_user(regs->flags, &sc->flags);
176 err |= __put_user(mask, &sc->oldmask);
177 err |= __put_user(me->thread.cr2, &sc->cr2);
178
179 return err;
180}
181
182/*
183 * Determine which stack to use..
184 */
185
186static void __user *
187get_stack(struct k_sigaction *ka, struct pt_regs *regs, unsigned long size)
188{
189 unsigned long sp;
190
191 /* Default to using normal stack - redzone*/
192 sp = regs->sp - 128;
193
194 /* This is the X/Open sanctioned signal stack switching. */
195 if (ka->sa.sa_flags & SA_ONSTACK) {
196 if (sas_ss_flags(sp) == 0)
197 sp = current->sas_ss_sp + current->sas_ss_size;
198 }
199
200 return (void __user *)round_down(sp - size, 64);
201}
202
203static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
204 sigset_t *set, struct pt_regs *regs)
205{
206 struct rt_sigframe __user *frame;
207 void __user *fp = NULL;
208 int err = 0;
209 struct task_struct *me = current;
210
211 if (used_math()) {
212 fp = get_stack(ka, regs, sig_xstate_size);
213 frame = (void __user *)round_down(
214 (unsigned long)fp - sizeof(struct rt_sigframe), 16) - 8;
215
216 if (save_i387_xstate(fp) < 0)
217 return -EFAULT;
218 } else
219 frame = get_stack(ka, regs, sizeof(struct rt_sigframe)) - 8;
220
221 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
222 return -EFAULT;
223
224 if (ka->sa.sa_flags & SA_SIGINFO) {
225 if (copy_siginfo_to_user(&frame->info, info))
226 return -EFAULT;
227 }
228
229 /* Create the ucontext. */
230 if (cpu_has_xsave)
231 err |= __put_user(UC_FP_XSTATE, &frame->uc.uc_flags);
232 else
233 err |= __put_user(0, &frame->uc.uc_flags);
234 err |= __put_user(0, &frame->uc.uc_link);
235 err |= __put_user(me->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
236 err |= __put_user(sas_ss_flags(regs->sp),
237 &frame->uc.uc_stack.ss_flags);
238 err |= __put_user(me->sas_ss_size, &frame->uc.uc_stack.ss_size);
239 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0], me);
240 err |= __put_user(fp, &frame->uc.uc_mcontext.fpstate);
241 if (sizeof(*set) == 16) {
242 __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]);
243 __put_user(set->sig[1], &frame->uc.uc_sigmask.sig[1]);
244 } else
245 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
246
247 /* Set up to return from userspace. If provided, use a stub
248 already in userspace. */
249 /* x86-64 should always use SA_RESTORER. */
250 if (ka->sa.sa_flags & SA_RESTORER) {
251 err |= __put_user(ka->sa.sa_restorer, &frame->pretcode);
252 } else {
253 /* could use a vstub here */
254 return -EFAULT;
255 }
256
257 if (err)
258 return -EFAULT;
259
260 /* Set up registers for signal handler */
261 regs->di = sig;
262 /* In case the signal handler was declared without prototypes */
263 regs->ax = 0;
264
265 /* This also works for non SA_SIGINFO handlers because they expect the
266 next argument after the signal number on the stack. */
267 regs->si = (unsigned long)&frame->info;
268 regs->dx = (unsigned long)&frame->uc;
269 regs->ip = (unsigned long) ka->sa.sa_handler;
270
271 regs->sp = (unsigned long)frame;
272
273 /* Set up the CS register to run signal handlers in 64-bit mode,
274 even if the handler happens to be interrupting 32-bit code. */
275 regs->cs = __USER_CS;
276
277 return 0;
278}
279
280/*
281 * OK, we're invoking a handler
282 */
283static int signr_convert(int sig)
284{
285 return sig;
286}
287
288#ifdef CONFIG_IA32_EMULATION
289#define is_ia32 test_thread_flag(TIF_IA32)
290#else
291#define is_ia32 0
292#endif
293
294static int
295setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
296 sigset_t *set, struct pt_regs *regs)
297{
298 int usig = signr_convert(sig);
299 int ret;
300
301 /* Set up the stack frame */
302 if (is_ia32) {
303 if (ka->sa.sa_flags & SA_SIGINFO)
304 ret = ia32_setup_rt_frame(usig, ka, info, set, regs);
305 else
306 ret = ia32_setup_frame(usig, ka, set, regs);
307 } else
308 ret = __setup_rt_frame(sig, ka, info, set, regs);
309
310 if (ret) {
311 force_sigsegv(sig, current);
312 return -EFAULT;
313 }
314
315 return ret;
316}
317
318static int
319handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
320 sigset_t *oldset, struct pt_regs *regs)
321{
322 int ret;
323
324 /* Are we from a system call? */
325 if (syscall_get_nr(current, regs) >= 0) {
326 /* If so, check system call restarting.. */
327 switch (syscall_get_error(current, regs)) {
328 case -ERESTART_RESTARTBLOCK:
329 case -ERESTARTNOHAND:
330 regs->ax = -EINTR;
331 break;
332
333 case -ERESTARTSYS:
334 if (!(ka->sa.sa_flags & SA_RESTART)) {
335 regs->ax = -EINTR;
336 break;
337 }
338 /* fallthrough */
339 case -ERESTARTNOINTR:
340 regs->ax = regs->orig_ax;
341 regs->ip -= 2;
342 break;
343 }
344 }
345
346 /*
347 * If TF is set due to a debugger (TIF_FORCED_TF), clear the TF
348 * flag so that register information in the sigcontext is correct.
349 */
350 if (unlikely(regs->flags & X86_EFLAGS_TF) &&
351 likely(test_and_clear_thread_flag(TIF_FORCED_TF)))
352 regs->flags &= ~X86_EFLAGS_TF;
353
354 ret = setup_rt_frame(sig, ka, info, oldset, regs);
355
356 if (ret)
357 return ret;
358
359#ifdef CONFIG_X86_64
360 /*
361 * This has nothing to do with segment registers,
362 * despite the name. This magic affects uaccess.h
363 * macros' behavior. Reset it to the normal setting.
364 */
365 set_fs(USER_DS);
366#endif
367
368 /*
369 * Clear the direction flag as per the ABI for function entry.
370 */
371 regs->flags &= ~X86_EFLAGS_DF;
372
373 /*
374 * Clear TF when entering the signal handler, but
375 * notify any tracer that was single-stepping it.
376 * The tracer may want to single-step inside the
377 * handler too.
378 */
379 regs->flags &= ~X86_EFLAGS_TF;
380
381 spin_lock_irq(&current->sighand->siglock);
382 sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask);
383 if (!(ka->sa.sa_flags & SA_NODEFER))
384 sigaddset(&current->blocked, sig);
385 recalc_sigpending();
386 spin_unlock_irq(&current->sighand->siglock);
387
388 tracehook_signal_handler(sig, info, ka, regs,
389 test_thread_flag(TIF_SINGLESTEP));
390
391 return 0;
392}
393
394#define NR_restart_syscall \
395 test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall : __NR_restart_syscall
396/*
397 * Note that 'init' is a special process: it doesn't get signals it doesn't
398 * want to handle. Thus you cannot kill init even with a SIGKILL even by
399 * mistake.
400 */
401static void do_signal(struct pt_regs *regs)
402{
403 struct k_sigaction ka;
404 siginfo_t info;
405 int signr;
406 sigset_t *oldset;
407
408 /*
409 * We want the common case to go fast, which is why we may in certain
410 * cases get here from kernel mode. Just return without doing anything
411 * if so.
412 * X86_32: vm86 regs switched out by assembly code before reaching
413 * here, so testing against kernel CS suffices.
414 */
415 if (!user_mode(regs))
416 return;
417
418 if (current_thread_info()->status & TS_RESTORE_SIGMASK)
419 oldset = &current->saved_sigmask;
420 else
421 oldset = &current->blocked;
422
423 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
424 if (signr > 0) {
425 /*
426 * Re-enable any watchpoints before delivering the
427 * signal to user space. The processor register will
428 * have been cleared if the watchpoint triggered
429 * inside the kernel.
430 */
431 if (current->thread.debugreg7)
432 set_debugreg(current->thread.debugreg7, 7);
433
434 /* Whee! Actually deliver the signal. */
435 if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
436 /*
437 * A signal was successfully delivered; the saved
438 * sigmask will have been stored in the signal frame,
439 * and will be restored by sigreturn, so we can simply
440 * clear the TS_RESTORE_SIGMASK flag.
441 */
442 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
443 }
444 return;
445 }
446
447 /* Did we come from a system call? */
448 if (syscall_get_nr(current, regs) >= 0) {
449 /* Restart the system call - no handlers present */
450 switch (syscall_get_error(current, regs)) {
451 case -ERESTARTNOHAND:
452 case -ERESTARTSYS:
453 case -ERESTARTNOINTR:
454 regs->ax = regs->orig_ax;
455 regs->ip -= 2;
456 break;
457
458 case -ERESTART_RESTARTBLOCK:
459 regs->ax = NR_restart_syscall;
460 regs->ip -= 2;
461 break;
462 }
463 }
464
465 /*
466 * If there's no signal to deliver, we just put the saved sigmask
467 * back.
468 */
469 if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
470 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
471 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
472 }
473}
474
475/*
476 * notification of userspace execution resumption
477 * - triggered by the TIF_WORK_MASK flags
478 */
479void
480do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags)
481{
482#if defined(CONFIG_X86_64) && defined(CONFIG_X86_MCE)
483 /* notify userspace of pending MCEs */
484 if (thread_info_flags & _TIF_MCE_NOTIFY)
485 mce_notify_user();
486#endif /* CONFIG_X86_64 && CONFIG_X86_MCE */
487
488 /* deal with pending signal delivery */
489 if (thread_info_flags & _TIF_SIGPENDING)
490 do_signal(regs);
491
492 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
493 clear_thread_flag(TIF_NOTIFY_RESUME);
494 tracehook_notify_resume(regs);
495 }
496
497#ifdef CONFIG_X86_32
498 clear_thread_flag(TIF_IRET);
499#endif /* CONFIG_X86_32 */
500}
501
502void signal_fault(struct pt_regs *regs, void __user *frame, char *where)
503{
504 struct task_struct *me = current;
505
506 if (show_unhandled_signals && printk_ratelimit()) {
507 printk(KERN_INFO
508 "%s[%d] bad frame in %s frame:%p ip:%lx sp:%lx orax:%lx",
509 me->comm, me->pid, where, frame,
510 regs->ip, regs->sp, regs->orig_ax);
511 print_vma_addr(" in ", regs->ip);
512 printk(KERN_CONT "\n");
513 }
514
515 force_sig(SIGSEGV, me);
516}
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index 18f9b19f5f8f..beea2649a240 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -118,41 +118,28 @@ static void native_smp_send_reschedule(int cpu)
118 WARN_ON(1); 118 WARN_ON(1);
119 return; 119 return;
120 } 120 }
121 send_IPI_mask(cpumask_of_cpu(cpu), RESCHEDULE_VECTOR); 121 send_IPI_mask(cpumask_of(cpu), RESCHEDULE_VECTOR);
122} 122}
123 123
124void native_send_call_func_single_ipi(int cpu) 124void native_send_call_func_single_ipi(int cpu)
125{ 125{
126 send_IPI_mask(cpumask_of_cpu(cpu), CALL_FUNCTION_SINGLE_VECTOR); 126 send_IPI_mask(cpumask_of(cpu), CALL_FUNCTION_SINGLE_VECTOR);
127} 127}
128 128
129void native_send_call_func_ipi(cpumask_t mask) 129void native_send_call_func_ipi(const struct cpumask *mask)
130{ 130{
131 cpumask_t allbutself; 131 cpumask_t allbutself;
132 132
133 allbutself = cpu_online_map; 133 allbutself = cpu_online_map;
134 cpu_clear(smp_processor_id(), allbutself); 134 cpu_clear(smp_processor_id(), allbutself);
135 135
136 if (cpus_equal(mask, allbutself) && 136 if (cpus_equal(*mask, allbutself) &&
137 cpus_equal(cpu_online_map, cpu_callout_map)) 137 cpus_equal(cpu_online_map, cpu_callout_map))
138 send_IPI_allbutself(CALL_FUNCTION_VECTOR); 138 send_IPI_allbutself(CALL_FUNCTION_VECTOR);
139 else 139 else
140 send_IPI_mask(mask, CALL_FUNCTION_VECTOR); 140 send_IPI_mask(mask, CALL_FUNCTION_VECTOR);
141} 141}
142 142
143static void stop_this_cpu(void *dummy)
144{
145 local_irq_disable();
146 /*
147 * Remove this CPU:
148 */
149 cpu_clear(smp_processor_id(), cpu_online_map);
150 disable_local_APIC();
151 if (hlt_works(smp_processor_id()))
152 for (;;) halt();
153 for (;;);
154}
155
156/* 143/*
157 * this function calls the 'stop' function on all other CPUs in the system. 144 * this function calls the 'stop' function on all other CPUs in the system.
158 */ 145 */
@@ -178,11 +165,7 @@ static void native_smp_send_stop(void)
178void smp_reschedule_interrupt(struct pt_regs *regs) 165void smp_reschedule_interrupt(struct pt_regs *regs)
179{ 166{
180 ack_APIC_irq(); 167 ack_APIC_irq();
181#ifdef CONFIG_X86_32 168 inc_irq_stat(irq_resched_count);
182 __get_cpu_var(irq_stat).irq_resched_count++;
183#else
184 add_pda(irq_resched_count, 1);
185#endif
186} 169}
187 170
188void smp_call_function_interrupt(struct pt_regs *regs) 171void smp_call_function_interrupt(struct pt_regs *regs)
@@ -190,11 +173,7 @@ void smp_call_function_interrupt(struct pt_regs *regs)
190 ack_APIC_irq(); 173 ack_APIC_irq();
191 irq_enter(); 174 irq_enter();
192 generic_smp_call_function_interrupt(); 175 generic_smp_call_function_interrupt();
193#ifdef CONFIG_X86_32 176 inc_irq_stat(irq_call_count);
194 __get_cpu_var(irq_stat).irq_call_count++;
195#else
196 add_pda(irq_call_count, 1);
197#endif
198 irq_exit(); 177 irq_exit();
199} 178}
200 179
@@ -203,11 +182,7 @@ void smp_call_function_single_interrupt(struct pt_regs *regs)
203 ack_APIC_irq(); 182 ack_APIC_irq();
204 irq_enter(); 183 irq_enter();
205 generic_smp_call_function_single_interrupt(); 184 generic_smp_call_function_single_interrupt();
206#ifdef CONFIG_X86_32 185 inc_irq_stat(irq_call_count);
207 __get_cpu_var(irq_stat).irq_call_count++;
208#else
209 add_pda(irq_call_count, 1);
210#endif
211 irq_exit(); 186 irq_exit();
212} 187}
213 188
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index f71f96fc9e62..6bd4d9b73870 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -62,6 +62,7 @@
62#include <asm/mtrr.h> 62#include <asm/mtrr.h>
63#include <asm/vmi.h> 63#include <asm/vmi.h>
64#include <asm/genapic.h> 64#include <asm/genapic.h>
65#include <asm/setup.h>
65#include <linux/mc146818rtc.h> 66#include <linux/mc146818rtc.h>
66 67
67#include <mach_apic.h> 68#include <mach_apic.h>
@@ -101,14 +102,8 @@ EXPORT_SYMBOL(smp_num_siblings);
101/* Last level cache ID of each logical CPU */ 102/* Last level cache ID of each logical CPU */
102DEFINE_PER_CPU(u16, cpu_llc_id) = BAD_APICID; 103DEFINE_PER_CPU(u16, cpu_llc_id) = BAD_APICID;
103 104
104/* bitmap of online cpus */
105cpumask_t cpu_online_map __read_mostly;
106EXPORT_SYMBOL(cpu_online_map);
107
108cpumask_t cpu_callin_map; 105cpumask_t cpu_callin_map;
109cpumask_t cpu_callout_map; 106cpumask_t cpu_callout_map;
110cpumask_t cpu_possible_map;
111EXPORT_SYMBOL(cpu_possible_map);
112 107
113/* representing HT siblings of each logical CPU */ 108/* representing HT siblings of each logical CPU */
114DEFINE_PER_CPU(cpumask_t, cpu_sibling_map); 109DEFINE_PER_CPU(cpumask_t, cpu_sibling_map);
@@ -287,7 +282,7 @@ static int __cpuinitdata unsafe_smp;
287/* 282/*
288 * Activate a secondary processor. 283 * Activate a secondary processor.
289 */ 284 */
290static void __cpuinit start_secondary(void *unused) 285notrace static void __cpuinit start_secondary(void *unused)
291{ 286{
292 /* 287 /*
293 * Don't put *anything* before cpu_init(), SMP booting is too 288 * Don't put *anything* before cpu_init(), SMP booting is too
@@ -501,7 +496,7 @@ void __cpuinit set_cpu_sibling_map(int cpu)
501} 496}
502 497
503/* maps the cpu to the sched domain representing multi-core */ 498/* maps the cpu to the sched domain representing multi-core */
504cpumask_t cpu_coregroup_map(int cpu) 499const struct cpumask *cpu_coregroup_mask(int cpu)
505{ 500{
506 struct cpuinfo_x86 *c = &cpu_data(cpu); 501 struct cpuinfo_x86 *c = &cpu_data(cpu);
507 /* 502 /*
@@ -509,9 +504,14 @@ cpumask_t cpu_coregroup_map(int cpu)
509 * And for power savings, we return cpu_core_map 504 * And for power savings, we return cpu_core_map
510 */ 505 */
511 if (sched_mc_power_savings || sched_smt_power_savings) 506 if (sched_mc_power_savings || sched_smt_power_savings)
512 return per_cpu(cpu_core_map, cpu); 507 return &per_cpu(cpu_core_map, cpu);
513 else 508 else
514 return c->llc_shared_map; 509 return &c->llc_shared_map;
510}
511
512cpumask_t cpu_coregroup_map(int cpu)
513{
514 return *cpu_coregroup_mask(cpu);
515} 515}
516 516
517static void impress_friends(void) 517static void impress_friends(void)
@@ -534,7 +534,7 @@ static void impress_friends(void)
534 pr_debug("Before bogocount - setting activated=1.\n"); 534 pr_debug("Before bogocount - setting activated=1.\n");
535} 535}
536 536
537static inline void __inquire_remote_apic(int apicid) 537void __inquire_remote_apic(int apicid)
538{ 538{
539 unsigned i, regs[] = { APIC_ID >> 4, APIC_LVR >> 4, APIC_SPIV >> 4 }; 539 unsigned i, regs[] = { APIC_ID >> 4, APIC_LVR >> 4, APIC_SPIV >> 4 };
540 char *names[] = { "ID", "VERSION", "SPIV" }; 540 char *names[] = { "ID", "VERSION", "SPIV" };
@@ -573,14 +573,13 @@ static inline void __inquire_remote_apic(int apicid)
573 } 573 }
574} 574}
575 575
576#ifdef WAKE_SECONDARY_VIA_NMI
577/* 576/*
578 * Poke the other CPU in the eye via NMI to wake it up. Remember that the normal 577 * Poke the other CPU in the eye via NMI to wake it up. Remember that the normal
579 * INIT, INIT, STARTUP sequence will reset the chip hard for us, and this 578 * INIT, INIT, STARTUP sequence will reset the chip hard for us, and this
580 * won't ... remember to clear down the APIC, etc later. 579 * won't ... remember to clear down the APIC, etc later.
581 */ 580 */
582static int __devinit 581int __devinit
583wakeup_secondary_cpu(int logical_apicid, unsigned long start_eip) 582wakeup_secondary_cpu_via_nmi(int logical_apicid, unsigned long start_eip)
584{ 583{
585 unsigned long send_status, accept_status = 0; 584 unsigned long send_status, accept_status = 0;
586 int maxlvt; 585 int maxlvt;
@@ -597,7 +596,7 @@ wakeup_secondary_cpu(int logical_apicid, unsigned long start_eip)
597 * Give the other CPU some time to accept the IPI. 596 * Give the other CPU some time to accept the IPI.
598 */ 597 */
599 udelay(200); 598 udelay(200);
600 if (APIC_INTEGRATED(apic_version[phys_apicid])) { 599 if (APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) {
601 maxlvt = lapic_get_maxlvt(); 600 maxlvt = lapic_get_maxlvt();
602 if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */ 601 if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */
603 apic_write(APIC_ESR, 0); 602 apic_write(APIC_ESR, 0);
@@ -612,11 +611,9 @@ wakeup_secondary_cpu(int logical_apicid, unsigned long start_eip)
612 611
613 return (send_status | accept_status); 612 return (send_status | accept_status);
614} 613}
615#endif /* WAKE_SECONDARY_VIA_NMI */
616 614
617#ifdef WAKE_SECONDARY_VIA_INIT 615int __devinit
618static int __devinit 616wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
619wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip)
620{ 617{
621 unsigned long send_status, accept_status = 0; 618 unsigned long send_status, accept_status = 0;
622 int maxlvt, num_starts, j; 619 int maxlvt, num_starts, j;
@@ -735,7 +732,6 @@ wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip)
735 732
736 return (send_status | accept_status); 733 return (send_status | accept_status);
737} 734}
738#endif /* WAKE_SECONDARY_VIA_INIT */
739 735
740struct create_idle { 736struct create_idle {
741 struct work_struct work; 737 struct work_struct work;
@@ -1084,8 +1080,10 @@ static int __init smp_sanity_check(unsigned max_cpus)
1084#endif 1080#endif
1085 1081
1086 if (!physid_isset(hard_smp_processor_id(), phys_cpu_present_map)) { 1082 if (!physid_isset(hard_smp_processor_id(), phys_cpu_present_map)) {
1087 printk(KERN_WARNING "weird, boot CPU (#%d) not listed" 1083 printk(KERN_WARNING
1088 "by the BIOS.\n", hard_smp_processor_id()); 1084 "weird, boot CPU (#%d) not listed by the BIOS.\n",
1085 hard_smp_processor_id());
1086
1089 physid_set(hard_smp_processor_id(), phys_cpu_present_map); 1087 physid_set(hard_smp_processor_id(), phys_cpu_present_map);
1090 } 1088 }
1091 1089
@@ -1156,7 +1154,7 @@ static void __init smp_cpu_index_default(void)
1156 for_each_possible_cpu(i) { 1154 for_each_possible_cpu(i) {
1157 c = &cpu_data(i); 1155 c = &cpu_data(i);
1158 /* mark all to hotplug */ 1156 /* mark all to hotplug */
1159 c->cpu_index = NR_CPUS; 1157 c->cpu_index = nr_cpu_ids;
1160 } 1158 }
1161} 1159}
1162 1160
@@ -1261,6 +1259,15 @@ void __init native_smp_cpus_done(unsigned int max_cpus)
1261 check_nmi_watchdog(); 1259 check_nmi_watchdog();
1262} 1260}
1263 1261
1262static int __initdata setup_possible_cpus = -1;
1263static int __init _setup_possible_cpus(char *str)
1264{
1265 get_option(&str, &setup_possible_cpus);
1266 return 0;
1267}
1268early_param("possible_cpus", _setup_possible_cpus);
1269
1270
1264/* 1271/*
1265 * cpu_possible_map should be static, it cannot change as cpu's 1272 * cpu_possible_map should be static, it cannot change as cpu's
1266 * are onlined, or offlined. The reason is per-cpu data-structures 1273 * are onlined, or offlined. The reason is per-cpu data-structures
@@ -1273,7 +1280,7 @@ void __init native_smp_cpus_done(unsigned int max_cpus)
1273 * 1280 *
1274 * Three ways to find out the number of additional hotplug CPUs: 1281 * Three ways to find out the number of additional hotplug CPUs:
1275 * - If the BIOS specified disabled CPUs in ACPI/mptables use that. 1282 * - If the BIOS specified disabled CPUs in ACPI/mptables use that.
1276 * - The user can overwrite it with additional_cpus=NUM 1283 * - The user can overwrite it with possible_cpus=NUM
1277 * - Otherwise don't reserve additional CPUs. 1284 * - Otherwise don't reserve additional CPUs.
1278 * We do this because additional CPUs waste a lot of memory. 1285 * We do this because additional CPUs waste a lot of memory.
1279 * -AK 1286 * -AK
@@ -1286,9 +1293,19 @@ __init void prefill_possible_map(void)
1286 if (!num_processors) 1293 if (!num_processors)
1287 num_processors = 1; 1294 num_processors = 1;
1288 1295
1289 possible = num_processors + disabled_cpus; 1296 if (setup_possible_cpus == -1)
1290 if (possible > NR_CPUS) 1297 possible = num_processors + disabled_cpus;
1291 possible = NR_CPUS; 1298 else
1299 possible = setup_possible_cpus;
1300
1301 total_cpus = max_t(int, possible, num_processors + disabled_cpus);
1302
1303 if (possible > CONFIG_NR_CPUS) {
1304 printk(KERN_WARNING
1305 "%d Processors exceeds NR_CPUS limit of %d\n",
1306 possible, CONFIG_NR_CPUS);
1307 possible = CONFIG_NR_CPUS;
1308 }
1292 1309
1293 printk(KERN_INFO "SMP: Allowing %d CPUs, %d hotplug CPUs\n", 1310 printk(KERN_INFO "SMP: Allowing %d CPUs, %d hotplug CPUs\n",
1294 possible, max_t(int, possible - num_processors, 0)); 1311 possible, max_t(int, possible - num_processors, 0));
@@ -1353,7 +1370,7 @@ void cpu_disable_common(void)
1353 lock_vector_lock(); 1370 lock_vector_lock();
1354 remove_cpu_from_maps(cpu); 1371 remove_cpu_from_maps(cpu);
1355 unlock_vector_lock(); 1372 unlock_vector_lock();
1356 fixup_irqs(cpu_online_map); 1373 fixup_irqs();
1357} 1374}
1358 1375
1359int native_cpu_disable(void) 1376int native_cpu_disable(void)
diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c
index a03e7f6d90c3..10786af95545 100644
--- a/arch/x86/kernel/stacktrace.c
+++ b/arch/x86/kernel/stacktrace.c
@@ -6,6 +6,7 @@
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/stacktrace.h> 7#include <linux/stacktrace.h>
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/uaccess.h>
9#include <asm/stacktrace.h> 10#include <asm/stacktrace.h>
10 11
11static void save_stack_warning(void *data, char *msg) 12static void save_stack_warning(void *data, char *msg)
@@ -83,3 +84,66 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
83 trace->entries[trace->nr_entries++] = ULONG_MAX; 84 trace->entries[trace->nr_entries++] = ULONG_MAX;
84} 85}
85EXPORT_SYMBOL_GPL(save_stack_trace_tsk); 86EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
87
88/* Userspace stacktrace - based on kernel/trace/trace_sysprof.c */
89
90struct stack_frame {
91 const void __user *next_fp;
92 unsigned long ret_addr;
93};
94
95static int copy_stack_frame(const void __user *fp, struct stack_frame *frame)
96{
97 int ret;
98
99 if (!access_ok(VERIFY_READ, fp, sizeof(*frame)))
100 return 0;
101
102 ret = 1;
103 pagefault_disable();
104 if (__copy_from_user_inatomic(frame, fp, sizeof(*frame)))
105 ret = 0;
106 pagefault_enable();
107
108 return ret;
109}
110
111static inline void __save_stack_trace_user(struct stack_trace *trace)
112{
113 const struct pt_regs *regs = task_pt_regs(current);
114 const void __user *fp = (const void __user *)regs->bp;
115
116 if (trace->nr_entries < trace->max_entries)
117 trace->entries[trace->nr_entries++] = regs->ip;
118
119 while (trace->nr_entries < trace->max_entries) {
120 struct stack_frame frame;
121
122 frame.next_fp = NULL;
123 frame.ret_addr = 0;
124 if (!copy_stack_frame(fp, &frame))
125 break;
126 if ((unsigned long)fp < regs->sp)
127 break;
128 if (frame.ret_addr) {
129 trace->entries[trace->nr_entries++] =
130 frame.ret_addr;
131 }
132 if (fp == frame.next_fp)
133 break;
134 fp = frame.next_fp;
135 }
136}
137
138void save_stack_trace_user(struct stack_trace *trace)
139{
140 /*
141 * Trace user stack if we are not a kernel thread
142 */
143 if (current->mm) {
144 __save_stack_trace_user(trace);
145 }
146 if (trace->nr_entries < trace->max_entries)
147 trace->entries[trace->nr_entries++] = ULONG_MAX;
148}
149
diff --git a/arch/x86/kernel/time_32.c b/arch/x86/kernel/time_32.c
index 77b400f06ea2..65309e4cb1c0 100644
--- a/arch/x86/kernel/time_32.c
+++ b/arch/x86/kernel/time_32.c
@@ -75,7 +75,7 @@ EXPORT_SYMBOL(profile_pc);
75irqreturn_t timer_interrupt(int irq, void *dev_id) 75irqreturn_t timer_interrupt(int irq, void *dev_id)
76{ 76{
77 /* Keep nmi watchdog up to date */ 77 /* Keep nmi watchdog up to date */
78 per_cpu(irq_stat, smp_processor_id()).irq0_irqs++; 78 inc_irq_stat(irq0_irqs);
79 79
80#ifdef CONFIG_X86_IO_APIC 80#ifdef CONFIG_X86_IO_APIC
81 if (timer_ack) { 81 if (timer_ack) {
diff --git a/arch/x86/kernel/time_64.c b/arch/x86/kernel/time_64.c
index cb19d650c216..891e7a7c4334 100644
--- a/arch/x86/kernel/time_64.c
+++ b/arch/x86/kernel/time_64.c
@@ -49,9 +49,9 @@ unsigned long profile_pc(struct pt_regs *regs)
49} 49}
50EXPORT_SYMBOL(profile_pc); 50EXPORT_SYMBOL(profile_pc);
51 51
52irqreturn_t timer_interrupt(int irq, void *dev_id) 52static irqreturn_t timer_interrupt(int irq, void *dev_id)
53{ 53{
54 add_pda(irq0_irqs, 1); 54 inc_irq_stat(irq0_irqs);
55 55
56 global_clock_event->event_handler(global_clock_event); 56 global_clock_event->event_handler(global_clock_event);
57 57
@@ -80,6 +80,8 @@ unsigned long __init calibrate_cpu(void)
80 break; 80 break;
81 no_ctr_free = (i == 4); 81 no_ctr_free = (i == 4);
82 if (no_ctr_free) { 82 if (no_ctr_free) {
83 WARN(1, KERN_WARNING "Warning: AMD perfctrs busy ... "
84 "cpu_khz value may be incorrect.\n");
83 i = 3; 85 i = 3;
84 rdmsrl(MSR_K7_EVNTSEL3, evntsel3); 86 rdmsrl(MSR_K7_EVNTSEL3, evntsel3);
85 wrmsrl(MSR_K7_EVNTSEL3, 0); 87 wrmsrl(MSR_K7_EVNTSEL3, 0);
diff --git a/arch/x86/kernel/tlb_32.c b/arch/x86/kernel/tlb_32.c
index f4049f3513b6..ce5054642247 100644
--- a/arch/x86/kernel/tlb_32.c
+++ b/arch/x86/kernel/tlb_32.c
@@ -34,9 +34,8 @@ static DEFINE_SPINLOCK(tlbstate_lock);
34 */ 34 */
35void leave_mm(int cpu) 35void leave_mm(int cpu)
36{ 36{
37 if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK) 37 BUG_ON(x86_read_percpu(cpu_tlbstate.state) == TLBSTATE_OK);
38 BUG(); 38 cpu_clear(cpu, x86_read_percpu(cpu_tlbstate.active_mm)->cpu_vm_mask);
39 cpu_clear(cpu, per_cpu(cpu_tlbstate, cpu).active_mm->cpu_vm_mask);
40 load_cr3(swapper_pg_dir); 39 load_cr3(swapper_pg_dir);
41} 40}
42EXPORT_SYMBOL_GPL(leave_mm); 41EXPORT_SYMBOL_GPL(leave_mm);
@@ -104,8 +103,8 @@ void smp_invalidate_interrupt(struct pt_regs *regs)
104 * BUG(); 103 * BUG();
105 */ 104 */
106 105
107 if (flush_mm == per_cpu(cpu_tlbstate, cpu).active_mm) { 106 if (flush_mm == x86_read_percpu(cpu_tlbstate.active_mm)) {
108 if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK) { 107 if (x86_read_percpu(cpu_tlbstate.state) == TLBSTATE_OK) {
109 if (flush_va == TLB_FLUSH_ALL) 108 if (flush_va == TLB_FLUSH_ALL)
110 local_flush_tlb(); 109 local_flush_tlb();
111 else 110 else
@@ -119,7 +118,7 @@ void smp_invalidate_interrupt(struct pt_regs *regs)
119 smp_mb__after_clear_bit(); 118 smp_mb__after_clear_bit();
120out: 119out:
121 put_cpu_no_resched(); 120 put_cpu_no_resched();
122 __get_cpu_var(irq_stat).irq_tlb_count++; 121 inc_irq_stat(irq_tlb_count);
123} 122}
124 123
125void native_flush_tlb_others(const cpumask_t *cpumaskp, struct mm_struct *mm, 124void native_flush_tlb_others(const cpumask_t *cpumaskp, struct mm_struct *mm,
@@ -164,7 +163,7 @@ void native_flush_tlb_others(const cpumask_t *cpumaskp, struct mm_struct *mm,
164 * We have to send the IPI only to 163 * We have to send the IPI only to
165 * CPUs affected. 164 * CPUs affected.
166 */ 165 */
167 send_IPI_mask(cpumask, INVALIDATE_TLB_VECTOR); 166 send_IPI_mask(&cpumask, INVALIDATE_TLB_VECTOR);
168 167
169 while (!cpus_empty(flush_cpumask)) 168 while (!cpus_empty(flush_cpumask))
170 /* nothing. lockup detection does not belong here */ 169 /* nothing. lockup detection does not belong here */
@@ -238,7 +237,7 @@ static void do_flush_tlb_all(void *info)
238 unsigned long cpu = smp_processor_id(); 237 unsigned long cpu = smp_processor_id();
239 238
240 __flush_tlb_all(); 239 __flush_tlb_all();
241 if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_LAZY) 240 if (x86_read_percpu(cpu_tlbstate.state) == TLBSTATE_LAZY)
242 leave_mm(cpu); 241 leave_mm(cpu);
243} 242}
244 243
diff --git a/arch/x86/kernel/tlb_64.c b/arch/x86/kernel/tlb_64.c
index 8f919ca69494..f8be6f1d2e48 100644
--- a/arch/x86/kernel/tlb_64.c
+++ b/arch/x86/kernel/tlb_64.c
@@ -154,7 +154,7 @@ asmlinkage void smp_invalidate_interrupt(struct pt_regs *regs)
154out: 154out:
155 ack_APIC_irq(); 155 ack_APIC_irq();
156 cpu_clear(cpu, f->flush_cpumask); 156 cpu_clear(cpu, f->flush_cpumask);
157 add_pda(irq_tlb_count, 1); 157 inc_irq_stat(irq_tlb_count);
158} 158}
159 159
160void native_flush_tlb_others(const cpumask_t *cpumaskp, struct mm_struct *mm, 160void native_flush_tlb_others(const cpumask_t *cpumaskp, struct mm_struct *mm,
@@ -191,7 +191,7 @@ void native_flush_tlb_others(const cpumask_t *cpumaskp, struct mm_struct *mm,
191 * We have to send the IPI only to 191 * We have to send the IPI only to
192 * CPUs affected. 192 * CPUs affected.
193 */ 193 */
194 send_IPI_mask(cpumask, INVALIDATE_TLB_VECTOR_START + sender); 194 send_IPI_mask(&cpumask, INVALIDATE_TLB_VECTOR_START + sender);
195 195
196 while (!cpus_empty(f->flush_cpumask)) 196 while (!cpus_empty(f->flush_cpumask))
197 cpu_relax(); 197 cpu_relax();
diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
index 04431f34fd16..f885023167e0 100644
--- a/arch/x86/kernel/tlb_uv.c
+++ b/arch/x86/kernel/tlb_uv.c
@@ -566,14 +566,10 @@ static int __init uv_ptc_init(void)
566 if (!is_uv_system()) 566 if (!is_uv_system())
567 return 0; 567 return 0;
568 568
569 if (!proc_mkdir("sgi_uv", NULL))
570 return -EINVAL;
571
572 proc_uv_ptc = create_proc_entry(UV_PTC_BASENAME, 0444, NULL); 569 proc_uv_ptc = create_proc_entry(UV_PTC_BASENAME, 0444, NULL);
573 if (!proc_uv_ptc) { 570 if (!proc_uv_ptc) {
574 printk(KERN_ERR "unable to create %s proc entry\n", 571 printk(KERN_ERR "unable to create %s proc entry\n",
575 UV_PTC_BASENAME); 572 UV_PTC_BASENAME);
576 remove_proc_entry("sgi_uv", NULL);
577 return -EINVAL; 573 return -EINVAL;
578 } 574 }
579 proc_uv_ptc->proc_fops = &proc_uv_ptc_operations; 575 proc_uv_ptc->proc_fops = &proc_uv_ptc_operations;
@@ -586,7 +582,6 @@ static int __init uv_ptc_init(void)
586static struct bau_control * __init uv_table_bases_init(int blade, int node) 582static struct bau_control * __init uv_table_bases_init(int blade, int node)
587{ 583{
588 int i; 584 int i;
589 int *ip;
590 struct bau_msg_status *msp; 585 struct bau_msg_status *msp;
591 struct bau_control *bau_tabp; 586 struct bau_control *bau_tabp;
592 587
@@ -603,13 +598,6 @@ static struct bau_control * __init uv_table_bases_init(int blade, int node)
603 bau_cpubits_clear(&msp->seen_by, (int) 598 bau_cpubits_clear(&msp->seen_by, (int)
604 uv_blade_nr_possible_cpus(blade)); 599 uv_blade_nr_possible_cpus(blade));
605 600
606 bau_tabp->watching =
607 kmalloc_node(sizeof(int) * DEST_NUM_RESOURCES, GFP_KERNEL, node);
608 BUG_ON(!bau_tabp->watching);
609
610 for (i = 0, ip = bau_tabp->watching; i < DEST_Q_SIZE; i++, ip++)
611 *ip = 0;
612
613 uv_bau_table_bases[blade] = bau_tabp; 601 uv_bau_table_bases[blade] = bau_tabp;
614 602
615 return bau_tabp; 603 return bau_tabp;
@@ -632,7 +620,6 @@ uv_table_bases_finish(int blade, int node, int cur_cpu,
632 bcp->bau_msg_head = bau_tablesp->va_queue_first; 620 bcp->bau_msg_head = bau_tablesp->va_queue_first;
633 bcp->va_queue_first = bau_tablesp->va_queue_first; 621 bcp->va_queue_first = bau_tablesp->va_queue_first;
634 bcp->va_queue_last = bau_tablesp->va_queue_last; 622 bcp->va_queue_last = bau_tablesp->va_queue_last;
635 bcp->watching = bau_tablesp->watching;
636 bcp->msg_statuses = bau_tablesp->msg_statuses; 623 bcp->msg_statuses = bau_tablesp->msg_statuses;
637 bcp->descriptor_base = adp; 624 bcp->descriptor_base = adp;
638 } 625 }
diff --git a/arch/x86/kernel/trampoline.c b/arch/x86/kernel/trampoline.c
index 1106fac6024d..808031a5ba19 100644
--- a/arch/x86/kernel/trampoline.c
+++ b/arch/x86/kernel/trampoline.c
@@ -1,10 +1,26 @@
1#include <linux/io.h> 1#include <linux/io.h>
2 2
3#include <asm/trampoline.h> 3#include <asm/trampoline.h>
4#include <asm/e820.h>
4 5
5/* ready for x86_64 and x86 */ 6/* ready for x86_64 and x86 */
6unsigned char *trampoline_base = __va(TRAMPOLINE_BASE); 7unsigned char *trampoline_base = __va(TRAMPOLINE_BASE);
7 8
9void __init reserve_trampoline_memory(void)
10{
11#ifdef CONFIG_X86_32
12 /*
13 * But first pinch a few for the stack/trampoline stuff
14 * FIXME: Don't need the extra page at 4K, but need to fix
15 * trampoline before removing it. (see the GDT stuff)
16 */
17 reserve_early(PAGE_SIZE, PAGE_SIZE + PAGE_SIZE, "EX TRAMPOLINE");
18#endif
19 /* Has to be in very low memory so we can execute real-mode AP code. */
20 reserve_early(TRAMPOLINE_BASE, TRAMPOLINE_BASE + TRAMPOLINE_SIZE,
21 "TRAMPOLINE");
22}
23
8/* 24/*
9 * Currently trivial. Write the real->protected mode 25 * Currently trivial. Write the real->protected mode
10 * bootstrap into the page concerned. The caller 26 * bootstrap into the page concerned. The caller
@@ -12,7 +28,6 @@ unsigned char *trampoline_base = __va(TRAMPOLINE_BASE);
12 */ 28 */
13unsigned long setup_trampoline(void) 29unsigned long setup_trampoline(void)
14{ 30{
15 memcpy(trampoline_base, trampoline_data, 31 memcpy(trampoline_base, trampoline_data, TRAMPOLINE_SIZE);
16 trampoline_end - trampoline_data);
17 return virt_to_phys(trampoline_base); 32 return virt_to_phys(trampoline_base);
18} 33}
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 04d242ab0161..c9a666cdd3db 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -20,7 +20,6 @@
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/ptrace.h> 21#include <linux/ptrace.h>
22#include <linux/string.h> 22#include <linux/string.h>
23#include <linux/unwind.h>
24#include <linux/delay.h> 23#include <linux/delay.h>
25#include <linux/errno.h> 24#include <linux/errno.h>
26#include <linux/kexec.h> 25#include <linux/kexec.h>
@@ -51,7 +50,6 @@
51#include <asm/debugreg.h> 50#include <asm/debugreg.h>
52#include <asm/atomic.h> 51#include <asm/atomic.h>
53#include <asm/system.h> 52#include <asm/system.h>
54#include <asm/unwind.h>
55#include <asm/traps.h> 53#include <asm/traps.h>
56#include <asm/desc.h> 54#include <asm/desc.h>
57#include <asm/i387.h> 55#include <asm/i387.h>
@@ -72,9 +70,6 @@
72 70
73#include "cpu/mcheck/mce.h" 71#include "cpu/mcheck/mce.h"
74 72
75DECLARE_BITMAP(used_vectors, NR_VECTORS);
76EXPORT_SYMBOL_GPL(used_vectors);
77
78asmlinkage int system_call(void); 73asmlinkage int system_call(void);
79 74
80/* Do we ignore FPU interrupts ? */ 75/* Do we ignore FPU interrupts ? */
@@ -89,6 +84,9 @@ gate_desc idt_table[256]
89 __attribute__((__section__(".data.idt"))) = { { { { 0, 0 } } }, }; 84 __attribute__((__section__(".data.idt"))) = { { { { 0, 0 } } }, };
90#endif 85#endif
91 86
87DECLARE_BITMAP(used_vectors, NR_VECTORS);
88EXPORT_SYMBOL_GPL(used_vectors);
89
92static int ignore_nmis; 90static int ignore_nmis;
93 91
94static inline void conditional_sti(struct pt_regs *regs) 92static inline void conditional_sti(struct pt_regs *regs)
@@ -292,8 +290,10 @@ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code)
292 tsk->thread.error_code = error_code; 290 tsk->thread.error_code = error_code;
293 tsk->thread.trap_no = 8; 291 tsk->thread.trap_no = 8;
294 292
295 /* This is always a kernel trap and never fixable (and thus must 293 /*
296 never return). */ 294 * This is always a kernel trap and never fixable (and thus must
295 * never return).
296 */
297 for (;;) 297 for (;;)
298 die(str, regs, error_code); 298 die(str, regs, error_code);
299} 299}
@@ -481,11 +481,7 @@ do_nmi(struct pt_regs *regs, long error_code)
481{ 481{
482 nmi_enter(); 482 nmi_enter();
483 483
484#ifdef CONFIG_X86_32 484 inc_irq_stat(__nmi_count);
485 { int cpu; cpu = smp_processor_id(); ++nmi_count(cpu); }
486#else
487 add_pda(__nmi_count, 1);
488#endif
489 485
490 if (!ignore_nmis) 486 if (!ignore_nmis)
491 default_do_nmi(regs); 487 default_do_nmi(regs);
@@ -524,9 +520,11 @@ dotraplinkage void __kprobes do_int3(struct pt_regs *regs, long error_code)
524} 520}
525 521
526#ifdef CONFIG_X86_64 522#ifdef CONFIG_X86_64
527/* Help handler running on IST stack to switch back to user stack 523/*
528 for scheduling or signal handling. The actual stack switch is done in 524 * Help handler running on IST stack to switch back to user stack
529 entry.S */ 525 * for scheduling or signal handling. The actual stack switch is done in
526 * entry.S
527 */
530asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs) 528asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
531{ 529{
532 struct pt_regs *regs = eregs; 530 struct pt_regs *regs = eregs;
@@ -536,8 +534,10 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
536 /* Exception from user space */ 534 /* Exception from user space */
537 else if (user_mode(eregs)) 535 else if (user_mode(eregs))
538 regs = task_pt_regs(current); 536 regs = task_pt_regs(current);
539 /* Exception from kernel and interrupts are enabled. Move to 537 /*
540 kernel process stack. */ 538 * Exception from kernel and interrupts are enabled. Move to
539 * kernel process stack.
540 */
541 else if (eregs->flags & X86_EFLAGS_IF) 541 else if (eregs->flags & X86_EFLAGS_IF)
542 regs = (struct pt_regs *)(eregs->sp -= sizeof(struct pt_regs)); 542 regs = (struct pt_regs *)(eregs->sp -= sizeof(struct pt_regs));
543 if (eregs != regs) 543 if (eregs != regs)
@@ -664,7 +664,7 @@ void math_error(void __user *ip)
664{ 664{
665 struct task_struct *task; 665 struct task_struct *task;
666 siginfo_t info; 666 siginfo_t info;
667 unsigned short cwd, swd; 667 unsigned short cwd, swd, err;
668 668
669 /* 669 /*
670 * Save the info for the exception handler and clear the error. 670 * Save the info for the exception handler and clear the error.
@@ -675,7 +675,6 @@ void math_error(void __user *ip)
675 task->thread.error_code = 0; 675 task->thread.error_code = 0;
676 info.si_signo = SIGFPE; 676 info.si_signo = SIGFPE;
677 info.si_errno = 0; 677 info.si_errno = 0;
678 info.si_code = __SI_FAULT;
679 info.si_addr = ip; 678 info.si_addr = ip;
680 /* 679 /*
681 * (~cwd & swd) will mask out exceptions that are not set to unmasked 680 * (~cwd & swd) will mask out exceptions that are not set to unmasked
@@ -689,34 +688,30 @@ void math_error(void __user *ip)
689 */ 688 */
690 cwd = get_fpu_cwd(task); 689 cwd = get_fpu_cwd(task);
691 swd = get_fpu_swd(task); 690 swd = get_fpu_swd(task);
692 switch (swd & ~cwd & 0x3f) { 691
693 case 0x000: /* No unmasked exception */ 692 err = swd & ~cwd;
694#ifdef CONFIG_X86_32 693
695 return; 694 if (err & 0x001) { /* Invalid op */
696#endif
697 default: /* Multiple exceptions */
698 break;
699 case 0x001: /* Invalid Op */
700 /* 695 /*
701 * swd & 0x240 == 0x040: Stack Underflow 696 * swd & 0x240 == 0x040: Stack Underflow
702 * swd & 0x240 == 0x240: Stack Overflow 697 * swd & 0x240 == 0x240: Stack Overflow
703 * User must clear the SF bit (0x40) if set 698 * User must clear the SF bit (0x40) if set
704 */ 699 */
705 info.si_code = FPE_FLTINV; 700 info.si_code = FPE_FLTINV;
706 break; 701 } else if (err & 0x004) { /* Divide by Zero */
707 case 0x002: /* Denormalize */
708 case 0x010: /* Underflow */
709 info.si_code = FPE_FLTUND;
710 break;
711 case 0x004: /* Zero Divide */
712 info.si_code = FPE_FLTDIV; 702 info.si_code = FPE_FLTDIV;
713 break; 703 } else if (err & 0x008) { /* Overflow */
714 case 0x008: /* Overflow */
715 info.si_code = FPE_FLTOVF; 704 info.si_code = FPE_FLTOVF;
716 break; 705 } else if (err & 0x012) { /* Denormal, Underflow */
717 case 0x020: /* Precision */ 706 info.si_code = FPE_FLTUND;
707 } else if (err & 0x020) { /* Precision */
718 info.si_code = FPE_FLTRES; 708 info.si_code = FPE_FLTRES;
719 break; 709 } else {
710 /*
711 * If we're using IRQ 13, or supposedly even some trap 16
712 * implementations, it's possible we get a spurious trap...
713 */
714 return; /* Spurious trap, no error */
720 } 715 }
721 force_sig_info(SIGFPE, &info, task); 716 force_sig_info(SIGFPE, &info, task);
722} 717}
@@ -949,9 +944,7 @@ dotraplinkage void do_iret_error(struct pt_regs *regs, long error_code)
949 944
950void __init trap_init(void) 945void __init trap_init(void)
951{ 946{
952#ifdef CONFIG_X86_32
953 int i; 947 int i;
954#endif
955 948
956#ifdef CONFIG_EISA 949#ifdef CONFIG_EISA
957 void __iomem *p = early_ioremap(0x0FFFD9, 4); 950 void __iomem *p = early_ioremap(0x0FFFD9, 4);
@@ -1008,11 +1001,15 @@ void __init trap_init(void)
1008 } 1001 }
1009 1002
1010 set_system_trap_gate(SYSCALL_VECTOR, &system_call); 1003 set_system_trap_gate(SYSCALL_VECTOR, &system_call);
1004#endif
1011 1005
1012 /* Reserve all the builtin and the syscall vector: */ 1006 /* Reserve all the builtin and the syscall vector: */
1013 for (i = 0; i < FIRST_EXTERNAL_VECTOR; i++) 1007 for (i = 0; i < FIRST_EXTERNAL_VECTOR; i++)
1014 set_bit(i, used_vectors); 1008 set_bit(i, used_vectors);
1015 1009
1010#ifdef CONFIG_X86_64
1011 set_bit(IA32_SYSCALL_VECTOR, used_vectors);
1012#else
1016 set_bit(SYSCALL_VECTOR, used_vectors); 1013 set_bit(SYSCALL_VECTOR, used_vectors);
1017#endif 1014#endif
1018 /* 1015 /*
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 424093b157d3..599e58168631 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -15,6 +15,7 @@
15#include <asm/vgtod.h> 15#include <asm/vgtod.h>
16#include <asm/time.h> 16#include <asm/time.h>
17#include <asm/delay.h> 17#include <asm/delay.h>
18#include <asm/hypervisor.h>
18 19
19unsigned int cpu_khz; /* TSC clocks / usec, not used here */ 20unsigned int cpu_khz; /* TSC clocks / usec, not used here */
20EXPORT_SYMBOL(cpu_khz); 21EXPORT_SYMBOL(cpu_khz);
@@ -31,6 +32,7 @@ static int tsc_unstable;
31 erroneous rdtsc usage on !cpu_has_tsc processors */ 32 erroneous rdtsc usage on !cpu_has_tsc processors */
32static int tsc_disabled = -1; 33static int tsc_disabled = -1;
33 34
35static int tsc_clocksource_reliable;
34/* 36/*
35 * Scheduler clock - returns current time in nanosec units. 37 * Scheduler clock - returns current time in nanosec units.
36 */ 38 */
@@ -98,6 +100,15 @@ int __init notsc_setup(char *str)
98 100
99__setup("notsc", notsc_setup); 101__setup("notsc", notsc_setup);
100 102
103static int __init tsc_setup(char *str)
104{
105 if (!strcmp(str, "reliable"))
106 tsc_clocksource_reliable = 1;
107 return 1;
108}
109
110__setup("tsc=", tsc_setup);
111
101#define MAX_RETRIES 5 112#define MAX_RETRIES 5
102#define SMI_TRESHOLD 50000 113#define SMI_TRESHOLD 50000
103 114
@@ -352,9 +363,15 @@ unsigned long native_calibrate_tsc(void)
352{ 363{
353 u64 tsc1, tsc2, delta, ref1, ref2; 364 u64 tsc1, tsc2, delta, ref1, ref2;
354 unsigned long tsc_pit_min = ULONG_MAX, tsc_ref_min = ULONG_MAX; 365 unsigned long tsc_pit_min = ULONG_MAX, tsc_ref_min = ULONG_MAX;
355 unsigned long flags, latch, ms, fast_calibrate; 366 unsigned long flags, latch, ms, fast_calibrate, tsc_khz;
356 int hpet = is_hpet_enabled(), i, loopmin; 367 int hpet = is_hpet_enabled(), i, loopmin;
357 368
369 tsc_khz = get_hypervisor_tsc_freq();
370 if (tsc_khz) {
371 printk(KERN_INFO "TSC: Frequency read from the hypervisor\n");
372 return tsc_khz;
373 }
374
358 local_irq_save(flags); 375 local_irq_save(flags);
359 fast_calibrate = quick_pit_calibrate(); 376 fast_calibrate = quick_pit_calibrate();
360 local_irq_restore(flags); 377 local_irq_restore(flags);
@@ -731,24 +748,21 @@ static struct dmi_system_id __initdata bad_tsc_dmi_table[] = {
731 {} 748 {}
732}; 749};
733 750
734/* 751static void __init check_system_tsc_reliable(void)
735 * Geode_LX - the OLPC CPU has a possibly a very reliable TSC 752{
736 */
737#ifdef CONFIG_MGEODE_LX 753#ifdef CONFIG_MGEODE_LX
738/* RTSC counts during suspend */ 754 /* RTSC counts during suspend */
739#define RTSC_SUSP 0x100 755#define RTSC_SUSP 0x100
740
741static void __init check_geode_tsc_reliable(void)
742{
743 unsigned long res_low, res_high; 756 unsigned long res_low, res_high;
744 757
745 rdmsr_safe(MSR_GEODE_BUSCONT_CONF0, &res_low, &res_high); 758 rdmsr_safe(MSR_GEODE_BUSCONT_CONF0, &res_low, &res_high);
759 /* Geode_LX - the OLPC CPU has a possibly a very reliable TSC */
746 if (res_low & RTSC_SUSP) 760 if (res_low & RTSC_SUSP)
747 clocksource_tsc.flags &= ~CLOCK_SOURCE_MUST_VERIFY; 761 tsc_clocksource_reliable = 1;
748}
749#else
750static inline void check_geode_tsc_reliable(void) { }
751#endif 762#endif
763 if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE))
764 tsc_clocksource_reliable = 1;
765}
752 766
753/* 767/*
754 * Make an educated guess if the TSC is trustworthy and synchronized 768 * Make an educated guess if the TSC is trustworthy and synchronized
@@ -783,6 +797,8 @@ static void __init init_tsc_clocksource(void)
783{ 797{
784 clocksource_tsc.mult = clocksource_khz2mult(tsc_khz, 798 clocksource_tsc.mult = clocksource_khz2mult(tsc_khz,
785 clocksource_tsc.shift); 799 clocksource_tsc.shift);
800 if (tsc_clocksource_reliable)
801 clocksource_tsc.flags &= ~CLOCK_SOURCE_MUST_VERIFY;
786 /* lower the rating if we already know its unstable: */ 802 /* lower the rating if we already know its unstable: */
787 if (check_tsc_unstable()) { 803 if (check_tsc_unstable()) {
788 clocksource_tsc.rating = 0; 804 clocksource_tsc.rating = 0;
@@ -843,7 +859,7 @@ void __init tsc_init(void)
843 if (unsynchronized_tsc()) 859 if (unsynchronized_tsc())
844 mark_tsc_unstable("TSCs unsynchronized"); 860 mark_tsc_unstable("TSCs unsynchronized");
845 861
846 check_geode_tsc_reliable(); 862 check_system_tsc_reliable();
847 init_tsc_clocksource(); 863 init_tsc_clocksource();
848} 864}
849 865
diff --git a/arch/x86/kernel/tsc_sync.c b/arch/x86/kernel/tsc_sync.c
index 1c0dfbca87c1..bf36328f6ef9 100644
--- a/arch/x86/kernel/tsc_sync.c
+++ b/arch/x86/kernel/tsc_sync.c
@@ -112,6 +112,12 @@ void __cpuinit check_tsc_sync_source(int cpu)
112 if (unsynchronized_tsc()) 112 if (unsynchronized_tsc())
113 return; 113 return;
114 114
115 if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE)) {
116 printk(KERN_INFO
117 "Skipping synchronization checks as TSC is reliable.\n");
118 return;
119 }
120
115 printk(KERN_INFO "checking TSC synchronization [CPU#%d -> CPU#%d]:", 121 printk(KERN_INFO "checking TSC synchronization [CPU#%d -> CPU#%d]:",
116 smp_processor_id(), cpu); 122 smp_processor_id(), cpu);
117 123
@@ -165,7 +171,7 @@ void __cpuinit check_tsc_sync_target(void)
165{ 171{
166 int cpus = 2; 172 int cpus = 2;
167 173
168 if (unsynchronized_tsc()) 174 if (unsynchronized_tsc() || boot_cpu_has(X86_FEATURE_TSC_RELIABLE))
169 return; 175 return;
170 176
171 /* 177 /*
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c
index 22fd6577156a..23206ba16874 100644
--- a/arch/x86/kernel/vmi_32.c
+++ b/arch/x86/kernel/vmi_32.c
@@ -266,109 +266,6 @@ static void vmi_nop(void)
266{ 266{
267} 267}
268 268
269#ifdef CONFIG_DEBUG_PAGE_TYPE
270
271#ifdef CONFIG_X86_PAE
272#define MAX_BOOT_PTS (2048+4+1)
273#else
274#define MAX_BOOT_PTS (1024+1)
275#endif
276
277/*
278 * During boot, mem_map is not yet available in paging_init, so stash
279 * all the boot page allocations here.
280 */
281static struct {
282 u32 pfn;
283 int type;
284} boot_page_allocations[MAX_BOOT_PTS];
285static int num_boot_page_allocations;
286static int boot_allocations_applied;
287
288void vmi_apply_boot_page_allocations(void)
289{
290 int i;
291 BUG_ON(!mem_map);
292 for (i = 0; i < num_boot_page_allocations; i++) {
293 struct page *page = pfn_to_page(boot_page_allocations[i].pfn);
294 page->type = boot_page_allocations[i].type;
295 page->type = boot_page_allocations[i].type &
296 ~(VMI_PAGE_ZEROED | VMI_PAGE_CLONE);
297 }
298 boot_allocations_applied = 1;
299}
300
301static void record_page_type(u32 pfn, int type)
302{
303 BUG_ON(num_boot_page_allocations >= MAX_BOOT_PTS);
304 boot_page_allocations[num_boot_page_allocations].pfn = pfn;
305 boot_page_allocations[num_boot_page_allocations].type = type;
306 num_boot_page_allocations++;
307}
308
309static void check_zeroed_page(u32 pfn, int type, struct page *page)
310{
311 u32 *ptr;
312 int i;
313 int limit = PAGE_SIZE / sizeof(int);
314
315 if (page_address(page))
316 ptr = (u32 *)page_address(page);
317 else
318 ptr = (u32 *)__va(pfn << PAGE_SHIFT);
319 /*
320 * When cloning the root in non-PAE mode, only the userspace
321 * pdes need to be zeroed.
322 */
323 if (type & VMI_PAGE_CLONE)
324 limit = KERNEL_PGD_BOUNDARY;
325 for (i = 0; i < limit; i++)
326 BUG_ON(ptr[i]);
327}
328
329/*
330 * We stash the page type into struct page so we can verify the page
331 * types are used properly.
332 */
333static void vmi_set_page_type(u32 pfn, int type)
334{
335 /* PAE can have multiple roots per page - don't track */
336 if (PTRS_PER_PMD > 1 && (type & VMI_PAGE_PDP))
337 return;
338
339 if (boot_allocations_applied) {
340 struct page *page = pfn_to_page(pfn);
341 if (type != VMI_PAGE_NORMAL)
342 BUG_ON(page->type);
343 else
344 BUG_ON(page->type == VMI_PAGE_NORMAL);
345 page->type = type & ~(VMI_PAGE_ZEROED | VMI_PAGE_CLONE);
346 if (type & VMI_PAGE_ZEROED)
347 check_zeroed_page(pfn, type, page);
348 } else {
349 record_page_type(pfn, type);
350 }
351}
352
353static void vmi_check_page_type(u32 pfn, int type)
354{
355 /* PAE can have multiple roots per page - skip checks */
356 if (PTRS_PER_PMD > 1 && (type & VMI_PAGE_PDP))
357 return;
358
359 type &= ~(VMI_PAGE_ZEROED | VMI_PAGE_CLONE);
360 if (boot_allocations_applied) {
361 struct page *page = pfn_to_page(pfn);
362 BUG_ON((page->type ^ type) & VMI_PAGE_PAE);
363 BUG_ON(type == VMI_PAGE_NORMAL && page->type);
364 BUG_ON((type & page->type) == 0);
365 }
366}
367#else
368#define vmi_set_page_type(p,t) do { } while (0)
369#define vmi_check_page_type(p,t) do { } while (0)
370#endif
371
372#ifdef CONFIG_HIGHPTE 269#ifdef CONFIG_HIGHPTE
373static void *vmi_kmap_atomic_pte(struct page *page, enum km_type type) 270static void *vmi_kmap_atomic_pte(struct page *page, enum km_type type)
374{ 271{
@@ -395,7 +292,6 @@ static void *vmi_kmap_atomic_pte(struct page *page, enum km_type type)
395 292
396static void vmi_allocate_pte(struct mm_struct *mm, unsigned long pfn) 293static void vmi_allocate_pte(struct mm_struct *mm, unsigned long pfn)
397{ 294{
398 vmi_set_page_type(pfn, VMI_PAGE_L1);
399 vmi_ops.allocate_page(pfn, VMI_PAGE_L1, 0, 0, 0); 295 vmi_ops.allocate_page(pfn, VMI_PAGE_L1, 0, 0, 0);
400} 296}
401 297
@@ -406,27 +302,22 @@ static void vmi_allocate_pmd(struct mm_struct *mm, unsigned long pfn)
406 * It is called only for swapper_pg_dir, which already has 302 * It is called only for swapper_pg_dir, which already has
407 * data on it. 303 * data on it.
408 */ 304 */
409 vmi_set_page_type(pfn, VMI_PAGE_L2);
410 vmi_ops.allocate_page(pfn, VMI_PAGE_L2, 0, 0, 0); 305 vmi_ops.allocate_page(pfn, VMI_PAGE_L2, 0, 0, 0);
411} 306}
412 307
413static void vmi_allocate_pmd_clone(unsigned long pfn, unsigned long clonepfn, unsigned long start, unsigned long count) 308static void vmi_allocate_pmd_clone(unsigned long pfn, unsigned long clonepfn, unsigned long start, unsigned long count)
414{ 309{
415 vmi_set_page_type(pfn, VMI_PAGE_L2 | VMI_PAGE_CLONE);
416 vmi_check_page_type(clonepfn, VMI_PAGE_L2);
417 vmi_ops.allocate_page(pfn, VMI_PAGE_L2 | VMI_PAGE_CLONE, clonepfn, start, count); 310 vmi_ops.allocate_page(pfn, VMI_PAGE_L2 | VMI_PAGE_CLONE, clonepfn, start, count);
418} 311}
419 312
420static void vmi_release_pte(unsigned long pfn) 313static void vmi_release_pte(unsigned long pfn)
421{ 314{
422 vmi_ops.release_page(pfn, VMI_PAGE_L1); 315 vmi_ops.release_page(pfn, VMI_PAGE_L1);
423 vmi_set_page_type(pfn, VMI_PAGE_NORMAL);
424} 316}
425 317
426static void vmi_release_pmd(unsigned long pfn) 318static void vmi_release_pmd(unsigned long pfn)
427{ 319{
428 vmi_ops.release_page(pfn, VMI_PAGE_L2); 320 vmi_ops.release_page(pfn, VMI_PAGE_L2);
429 vmi_set_page_type(pfn, VMI_PAGE_NORMAL);
430} 321}
431 322
432/* 323/*
@@ -450,26 +341,22 @@ static void vmi_release_pmd(unsigned long pfn)
450 341
451static void vmi_update_pte(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 342static void vmi_update_pte(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
452{ 343{
453 vmi_check_page_type(__pa(ptep) >> PAGE_SHIFT, VMI_PAGE_PTE);
454 vmi_ops.update_pte(ptep, vmi_flags_addr(mm, addr, VMI_PAGE_PT, 0)); 344 vmi_ops.update_pte(ptep, vmi_flags_addr(mm, addr, VMI_PAGE_PT, 0));
455} 345}
456 346
457static void vmi_update_pte_defer(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 347static void vmi_update_pte_defer(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
458{ 348{
459 vmi_check_page_type(__pa(ptep) >> PAGE_SHIFT, VMI_PAGE_PTE);
460 vmi_ops.update_pte(ptep, vmi_flags_addr_defer(mm, addr, VMI_PAGE_PT, 0)); 349 vmi_ops.update_pte(ptep, vmi_flags_addr_defer(mm, addr, VMI_PAGE_PT, 0));
461} 350}
462 351
463static void vmi_set_pte(pte_t *ptep, pte_t pte) 352static void vmi_set_pte(pte_t *ptep, pte_t pte)
464{ 353{
465 /* XXX because of set_pmd_pte, this can be called on PT or PD layers */ 354 /* XXX because of set_pmd_pte, this can be called on PT or PD layers */
466 vmi_check_page_type(__pa(ptep) >> PAGE_SHIFT, VMI_PAGE_PTE | VMI_PAGE_PD);
467 vmi_ops.set_pte(pte, ptep, VMI_PAGE_PT); 355 vmi_ops.set_pte(pte, ptep, VMI_PAGE_PT);
468} 356}
469 357
470static void vmi_set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) 358static void vmi_set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte)
471{ 359{
472 vmi_check_page_type(__pa(ptep) >> PAGE_SHIFT, VMI_PAGE_PTE);
473 vmi_ops.set_pte(pte, ptep, vmi_flags_addr(mm, addr, VMI_PAGE_PT, 0)); 360 vmi_ops.set_pte(pte, ptep, vmi_flags_addr(mm, addr, VMI_PAGE_PT, 0));
474} 361}
475 362
@@ -477,10 +364,8 @@ static void vmi_set_pmd(pmd_t *pmdp, pmd_t pmdval)
477{ 364{
478#ifdef CONFIG_X86_PAE 365#ifdef CONFIG_X86_PAE
479 const pte_t pte = { .pte = pmdval.pmd }; 366 const pte_t pte = { .pte = pmdval.pmd };
480 vmi_check_page_type(__pa(pmdp) >> PAGE_SHIFT, VMI_PAGE_PMD);
481#else 367#else
482 const pte_t pte = { pmdval.pud.pgd.pgd }; 368 const pte_t pte = { pmdval.pud.pgd.pgd };
483 vmi_check_page_type(__pa(pmdp) >> PAGE_SHIFT, VMI_PAGE_PGD);
484#endif 369#endif
485 vmi_ops.set_pte(pte, (pte_t *)pmdp, VMI_PAGE_PD); 370 vmi_ops.set_pte(pte, (pte_t *)pmdp, VMI_PAGE_PD);
486} 371}
@@ -502,7 +387,6 @@ static void vmi_set_pte_atomic(pte_t *ptep, pte_t pteval)
502 387
503static void vmi_set_pte_present(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) 388static void vmi_set_pte_present(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte)
504{ 389{
505 vmi_check_page_type(__pa(ptep) >> PAGE_SHIFT, VMI_PAGE_PTE);
506 vmi_ops.set_pte(pte, ptep, vmi_flags_addr_defer(mm, addr, VMI_PAGE_PT, 1)); 390 vmi_ops.set_pte(pte, ptep, vmi_flags_addr_defer(mm, addr, VMI_PAGE_PT, 1));
507} 391}
508 392
@@ -510,21 +394,18 @@ static void vmi_set_pud(pud_t *pudp, pud_t pudval)
510{ 394{
511 /* Um, eww */ 395 /* Um, eww */
512 const pte_t pte = { .pte = pudval.pgd.pgd }; 396 const pte_t pte = { .pte = pudval.pgd.pgd };
513 vmi_check_page_type(__pa(pudp) >> PAGE_SHIFT, VMI_PAGE_PGD);
514 vmi_ops.set_pte(pte, (pte_t *)pudp, VMI_PAGE_PDP); 397 vmi_ops.set_pte(pte, (pte_t *)pudp, VMI_PAGE_PDP);
515} 398}
516 399
517static void vmi_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 400static void vmi_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
518{ 401{
519 const pte_t pte = { .pte = 0 }; 402 const pte_t pte = { .pte = 0 };
520 vmi_check_page_type(__pa(ptep) >> PAGE_SHIFT, VMI_PAGE_PTE);
521 vmi_ops.set_pte(pte, ptep, vmi_flags_addr(mm, addr, VMI_PAGE_PT, 0)); 403 vmi_ops.set_pte(pte, ptep, vmi_flags_addr(mm, addr, VMI_PAGE_PT, 0));
522} 404}
523 405
524static void vmi_pmd_clear(pmd_t *pmd) 406static void vmi_pmd_clear(pmd_t *pmd)
525{ 407{
526 const pte_t pte = { .pte = 0 }; 408 const pte_t pte = { .pte = 0 };
527 vmi_check_page_type(__pa(pmd) >> PAGE_SHIFT, VMI_PAGE_PMD);
528 vmi_ops.set_pte(pte, (pte_t *)pmd, VMI_PAGE_PD); 409 vmi_ops.set_pte(pte, (pte_t *)pmd, VMI_PAGE_PD);
529} 410}
530#endif 411#endif
diff --git a/arch/x86/kernel/vmiclock_32.c b/arch/x86/kernel/vmiclock_32.c
index 254ee07f8635..c4c1f9e09402 100644
--- a/arch/x86/kernel/vmiclock_32.c
+++ b/arch/x86/kernel/vmiclock_32.c
@@ -226,7 +226,7 @@ static void __devinit vmi_time_init_clockevent(void)
226 /* Upper bound is clockevent's use of ulong for cycle deltas. */ 226 /* Upper bound is clockevent's use of ulong for cycle deltas. */
227 evt->max_delta_ns = clockevent_delta2ns(ULONG_MAX, evt); 227 evt->max_delta_ns = clockevent_delta2ns(ULONG_MAX, evt);
228 evt->min_delta_ns = clockevent_delta2ns(1, evt); 228 evt->min_delta_ns = clockevent_delta2ns(1, evt);
229 evt->cpumask = cpumask_of_cpu(cpu); 229 evt->cpumask = cpumask_of(cpu);
230 230
231 printk(KERN_WARNING "vmi: registering clock event %s. mult=%lu shift=%u\n", 231 printk(KERN_WARNING "vmi: registering clock event %s. mult=%lu shift=%u\n",
232 evt->name, evt->mult, evt->shift); 232 evt->name, evt->mult, evt->shift);
diff --git a/arch/x86/kernel/vmlinux_32.lds.S b/arch/x86/kernel/vmlinux_32.lds.S
index a9b8560adbc2..82c67559dde7 100644
--- a/arch/x86/kernel/vmlinux_32.lds.S
+++ b/arch/x86/kernel/vmlinux_32.lds.S
@@ -44,6 +44,7 @@ SECTIONS
44 SCHED_TEXT 44 SCHED_TEXT
45 LOCK_TEXT 45 LOCK_TEXT
46 KPROBES_TEXT 46 KPROBES_TEXT
47 IRQENTRY_TEXT
47 *(.fixup) 48 *(.fixup)
48 *(.gnu.warning) 49 *(.gnu.warning)
49 _etext = .; /* End of text section */ 50 _etext = .; /* End of text section */
diff --git a/arch/x86/kernel/vmlinux_64.lds.S b/arch/x86/kernel/vmlinux_64.lds.S
index 46e05447405b..1a614c0e6bef 100644
--- a/arch/x86/kernel/vmlinux_64.lds.S
+++ b/arch/x86/kernel/vmlinux_64.lds.S
@@ -35,6 +35,7 @@ SECTIONS
35 SCHED_TEXT 35 SCHED_TEXT
36 LOCK_TEXT 36 LOCK_TEXT
37 KPROBES_TEXT 37 KPROBES_TEXT
38 IRQENTRY_TEXT
38 *(.fixup) 39 *(.fixup)
39 *(.gnu.warning) 40 *(.gnu.warning)
40 _etext = .; /* End of text section */ 41 _etext = .; /* End of text section */
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index 0b8b6690a86d..44153afc9067 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -17,6 +17,9 @@
17 * want per guest time just set the kernel.vsyscall64 sysctl to 0. 17 * want per guest time just set the kernel.vsyscall64 sysctl to 0.
18 */ 18 */
19 19
20/* Disable profiling for userspace code: */
21#define DISABLE_BRANCH_PROFILING
22
20#include <linux/time.h> 23#include <linux/time.h>
21#include <linux/init.h> 24#include <linux/init.h>
22#include <linux/kernel.h> 25#include <linux/kernel.h>
@@ -128,7 +131,16 @@ static __always_inline void do_vgettimeofday(struct timeval * tv)
128 gettimeofday(tv,NULL); 131 gettimeofday(tv,NULL);
129 return; 132 return;
130 } 133 }
134
135 /*
136 * Surround the RDTSC by barriers, to make sure it's not
137 * speculated to outside the seqlock critical section and
138 * does not cause time warps:
139 */
140 rdtsc_barrier();
131 now = vread(); 141 now = vread();
142 rdtsc_barrier();
143
132 base = __vsyscall_gtod_data.clock.cycle_last; 144 base = __vsyscall_gtod_data.clock.cycle_last;
133 mask = __vsyscall_gtod_data.clock.mask; 145 mask = __vsyscall_gtod_data.clock.mask;
134 mult = __vsyscall_gtod_data.clock.mult; 146 mult = __vsyscall_gtod_data.clock.mult;
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c
index 15c3e6999182..2b54fe002e94 100644
--- a/arch/x86/kernel/xsave.c
+++ b/arch/x86/kernel/xsave.c
@@ -159,7 +159,7 @@ int save_i387_xstate(void __user *buf)
159 * Restore the extended state if present. Otherwise, restore the FP/SSE 159 * Restore the extended state if present. Otherwise, restore the FP/SSE
160 * state. 160 * state.
161 */ 161 */
162int restore_user_xstate(void __user *buf) 162static int restore_user_xstate(void __user *buf)
163{ 163{
164 struct _fpx_sw_bytes fx_sw_user; 164 struct _fpx_sw_bytes fx_sw_user;
165 u64 mask; 165 u64 mask;
diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile
index c02343594b4d..d3ec292f00f2 100644
--- a/arch/x86/kvm/Makefile
+++ b/arch/x86/kvm/Makefile
@@ -7,8 +7,8 @@ common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \
7ifeq ($(CONFIG_KVM_TRACE),y) 7ifeq ($(CONFIG_KVM_TRACE),y)
8common-objs += $(addprefix ../../../virt/kvm/, kvm_trace.o) 8common-objs += $(addprefix ../../../virt/kvm/, kvm_trace.o)
9endif 9endif
10ifeq ($(CONFIG_DMAR),y) 10ifeq ($(CONFIG_IOMMU_API),y)
11common-objs += $(addprefix ../../../virt/kvm/, vtd.o) 11common-objs += $(addprefix ../../../virt/kvm/, iommu.o)
12endif 12endif
13 13
14EXTRA_CFLAGS += -Ivirt/kvm -Iarch/x86/kvm 14EXTRA_CFLAGS += -Ivirt/kvm -Iarch/x86/kvm
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 59ebd37ad79e..e665d1c623ca 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -603,10 +603,29 @@ void kvm_free_pit(struct kvm *kvm)
603 603
604static void __inject_pit_timer_intr(struct kvm *kvm) 604static void __inject_pit_timer_intr(struct kvm *kvm)
605{ 605{
606 struct kvm_vcpu *vcpu;
607 int i;
608
606 mutex_lock(&kvm->lock); 609 mutex_lock(&kvm->lock);
607 kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 1); 610 kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 1);
608 kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 0); 611 kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 0);
609 mutex_unlock(&kvm->lock); 612 mutex_unlock(&kvm->lock);
613
614 /*
615 * Provides NMI watchdog support via Virtual Wire mode.
616 * The route is: PIT -> PIC -> LVT0 in NMI mode.
617 *
618 * Note: Our Virtual Wire implementation is simplified, only
619 * propagating PIT interrupts to all VCPUs when they have set
620 * LVT0 to NMI delivery. Other PIC interrupts are just sent to
621 * VCPU0, and only if its LVT0 is in EXTINT mode.
622 */
623 if (kvm->arch.vapics_in_nmi_mode > 0)
624 for (i = 0; i < KVM_MAX_VCPUS; ++i) {
625 vcpu = kvm->vcpus[i];
626 if (vcpu)
627 kvm_apic_nmi_wd_deliver(vcpu);
628 }
610} 629}
611 630
612void kvm_inject_pit_timer_irqs(struct kvm_vcpu *vcpu) 631void kvm_inject_pit_timer_irqs(struct kvm_vcpu *vcpu)
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index 17e41e165f1a..179dcb0103fd 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -26,10 +26,40 @@
26 * Port from Qemu. 26 * Port from Qemu.
27 */ 27 */
28#include <linux/mm.h> 28#include <linux/mm.h>
29#include <linux/bitops.h>
29#include "irq.h" 30#include "irq.h"
30 31
31#include <linux/kvm_host.h> 32#include <linux/kvm_host.h>
32 33
34static void pic_lock(struct kvm_pic *s)
35{
36 spin_lock(&s->lock);
37}
38
39static void pic_unlock(struct kvm_pic *s)
40{
41 struct kvm *kvm = s->kvm;
42 unsigned acks = s->pending_acks;
43 bool wakeup = s->wakeup_needed;
44 struct kvm_vcpu *vcpu;
45
46 s->pending_acks = 0;
47 s->wakeup_needed = false;
48
49 spin_unlock(&s->lock);
50
51 while (acks) {
52 kvm_notify_acked_irq(kvm, __ffs(acks));
53 acks &= acks - 1;
54 }
55
56 if (wakeup) {
57 vcpu = s->kvm->vcpus[0];
58 if (vcpu)
59 kvm_vcpu_kick(vcpu);
60 }
61}
62
33static void pic_clear_isr(struct kvm_kpic_state *s, int irq) 63static void pic_clear_isr(struct kvm_kpic_state *s, int irq)
34{ 64{
35 s->isr &= ~(1 << irq); 65 s->isr &= ~(1 << irq);
@@ -136,17 +166,21 @@ static void pic_update_irq(struct kvm_pic *s)
136 166
137void kvm_pic_update_irq(struct kvm_pic *s) 167void kvm_pic_update_irq(struct kvm_pic *s)
138{ 168{
169 pic_lock(s);
139 pic_update_irq(s); 170 pic_update_irq(s);
171 pic_unlock(s);
140} 172}
141 173
142void kvm_pic_set_irq(void *opaque, int irq, int level) 174void kvm_pic_set_irq(void *opaque, int irq, int level)
143{ 175{
144 struct kvm_pic *s = opaque; 176 struct kvm_pic *s = opaque;
145 177
178 pic_lock(s);
146 if (irq >= 0 && irq < PIC_NUM_PINS) { 179 if (irq >= 0 && irq < PIC_NUM_PINS) {
147 pic_set_irq1(&s->pics[irq >> 3], irq & 7, level); 180 pic_set_irq1(&s->pics[irq >> 3], irq & 7, level);
148 pic_update_irq(s); 181 pic_update_irq(s);
149 } 182 }
183 pic_unlock(s);
150} 184}
151 185
152/* 186/*
@@ -172,6 +206,7 @@ int kvm_pic_read_irq(struct kvm *kvm)
172 int irq, irq2, intno; 206 int irq, irq2, intno;
173 struct kvm_pic *s = pic_irqchip(kvm); 207 struct kvm_pic *s = pic_irqchip(kvm);
174 208
209 pic_lock(s);
175 irq = pic_get_irq(&s->pics[0]); 210 irq = pic_get_irq(&s->pics[0]);
176 if (irq >= 0) { 211 if (irq >= 0) {
177 pic_intack(&s->pics[0], irq); 212 pic_intack(&s->pics[0], irq);
@@ -196,6 +231,7 @@ int kvm_pic_read_irq(struct kvm *kvm)
196 intno = s->pics[0].irq_base + irq; 231 intno = s->pics[0].irq_base + irq;
197 } 232 }
198 pic_update_irq(s); 233 pic_update_irq(s);
234 pic_unlock(s);
199 kvm_notify_acked_irq(kvm, irq); 235 kvm_notify_acked_irq(kvm, irq);
200 236
201 return intno; 237 return intno;
@@ -203,7 +239,7 @@ int kvm_pic_read_irq(struct kvm *kvm)
203 239
204void kvm_pic_reset(struct kvm_kpic_state *s) 240void kvm_pic_reset(struct kvm_kpic_state *s)
205{ 241{
206 int irq, irqbase; 242 int irq, irqbase, n;
207 struct kvm *kvm = s->pics_state->irq_request_opaque; 243 struct kvm *kvm = s->pics_state->irq_request_opaque;
208 struct kvm_vcpu *vcpu0 = kvm->vcpus[0]; 244 struct kvm_vcpu *vcpu0 = kvm->vcpus[0];
209 245
@@ -214,8 +250,10 @@ void kvm_pic_reset(struct kvm_kpic_state *s)
214 250
215 for (irq = 0; irq < PIC_NUM_PINS/2; irq++) { 251 for (irq = 0; irq < PIC_NUM_PINS/2; irq++) {
216 if (vcpu0 && kvm_apic_accept_pic_intr(vcpu0)) 252 if (vcpu0 && kvm_apic_accept_pic_intr(vcpu0))
217 if (s->irr & (1 << irq) || s->isr & (1 << irq)) 253 if (s->irr & (1 << irq) || s->isr & (1 << irq)) {
218 kvm_notify_acked_irq(kvm, irq+irqbase); 254 n = irq + irqbase;
255 s->pics_state->pending_acks |= 1 << n;
256 }
219 } 257 }
220 s->last_irr = 0; 258 s->last_irr = 0;
221 s->irr = 0; 259 s->irr = 0;
@@ -406,6 +444,7 @@ static void picdev_write(struct kvm_io_device *this,
406 printk(KERN_ERR "PIC: non byte write\n"); 444 printk(KERN_ERR "PIC: non byte write\n");
407 return; 445 return;
408 } 446 }
447 pic_lock(s);
409 switch (addr) { 448 switch (addr) {
410 case 0x20: 449 case 0x20:
411 case 0x21: 450 case 0x21:
@@ -418,6 +457,7 @@ static void picdev_write(struct kvm_io_device *this,
418 elcr_ioport_write(&s->pics[addr & 1], addr, data); 457 elcr_ioport_write(&s->pics[addr & 1], addr, data);
419 break; 458 break;
420 } 459 }
460 pic_unlock(s);
421} 461}
422 462
423static void picdev_read(struct kvm_io_device *this, 463static void picdev_read(struct kvm_io_device *this,
@@ -431,6 +471,7 @@ static void picdev_read(struct kvm_io_device *this,
431 printk(KERN_ERR "PIC: non byte read\n"); 471 printk(KERN_ERR "PIC: non byte read\n");
432 return; 472 return;
433 } 473 }
474 pic_lock(s);
434 switch (addr) { 475 switch (addr) {
435 case 0x20: 476 case 0x20:
436 case 0x21: 477 case 0x21:
@@ -444,6 +485,7 @@ static void picdev_read(struct kvm_io_device *this,
444 break; 485 break;
445 } 486 }
446 *(unsigned char *)val = data; 487 *(unsigned char *)val = data;
488 pic_unlock(s);
447} 489}
448 490
449/* 491/*
@@ -459,7 +501,7 @@ static void pic_irq_request(void *opaque, int level)
459 s->output = level; 501 s->output = level;
460 if (vcpu && level && (s->pics[0].isr_ack & (1 << irq))) { 502 if (vcpu && level && (s->pics[0].isr_ack & (1 << irq))) {
461 s->pics[0].isr_ack &= ~(1 << irq); 503 s->pics[0].isr_ack &= ~(1 << irq);
462 kvm_vcpu_kick(vcpu); 504 s->wakeup_needed = true;
463 } 505 }
464} 506}
465 507
@@ -469,6 +511,8 @@ struct kvm_pic *kvm_create_pic(struct kvm *kvm)
469 s = kzalloc(sizeof(struct kvm_pic), GFP_KERNEL); 511 s = kzalloc(sizeof(struct kvm_pic), GFP_KERNEL);
470 if (!s) 512 if (!s)
471 return NULL; 513 return NULL;
514 spin_lock_init(&s->lock);
515 s->kvm = kvm;
472 s->pics[0].elcr_mask = 0xf8; 516 s->pics[0].elcr_mask = 0xf8;
473 s->pics[1].elcr_mask = 0xde; 517 s->pics[1].elcr_mask = 0xde;
474 s->irq_request = pic_irq_request; 518 s->irq_request = pic_irq_request;
diff --git a/arch/x86/kvm/irq.h b/arch/x86/kvm/irq.h
index f17c8f5bbf31..2bf32a03ceec 100644
--- a/arch/x86/kvm/irq.h
+++ b/arch/x86/kvm/irq.h
@@ -25,6 +25,7 @@
25#include <linux/mm_types.h> 25#include <linux/mm_types.h>
26#include <linux/hrtimer.h> 26#include <linux/hrtimer.h>
27#include <linux/kvm_host.h> 27#include <linux/kvm_host.h>
28#include <linux/spinlock.h>
28 29
29#include "iodev.h" 30#include "iodev.h"
30#include "ioapic.h" 31#include "ioapic.h"
@@ -59,6 +60,10 @@ struct kvm_kpic_state {
59}; 60};
60 61
61struct kvm_pic { 62struct kvm_pic {
63 spinlock_t lock;
64 bool wakeup_needed;
65 unsigned pending_acks;
66 struct kvm *kvm;
62 struct kvm_kpic_state pics[2]; /* 0 is master pic, 1 is slave pic */ 67 struct kvm_kpic_state pics[2]; /* 0 is master pic, 1 is slave pic */
63 irq_request_func *irq_request; 68 irq_request_func *irq_request;
64 void *irq_request_opaque; 69 void *irq_request_opaque;
@@ -87,6 +92,7 @@ void kvm_pic_reset(struct kvm_kpic_state *s);
87void kvm_timer_intr_post(struct kvm_vcpu *vcpu, int vec); 92void kvm_timer_intr_post(struct kvm_vcpu *vcpu, int vec);
88void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu); 93void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu);
89void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu); 94void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu);
95void kvm_apic_nmi_wd_deliver(struct kvm_vcpu *vcpu);
90void __kvm_migrate_apic_timer(struct kvm_vcpu *vcpu); 96void __kvm_migrate_apic_timer(struct kvm_vcpu *vcpu);
91void __kvm_migrate_pit_timer(struct kvm_vcpu *vcpu); 97void __kvm_migrate_pit_timer(struct kvm_vcpu *vcpu);
92void __kvm_migrate_timers(struct kvm_vcpu *vcpu); 98void __kvm_migrate_timers(struct kvm_vcpu *vcpu);
diff --git a/arch/x86/kvm/kvm_svm.h b/arch/x86/kvm/kvm_svm.h
index 65ef0fc2c036..8e5ee99551f6 100644
--- a/arch/x86/kvm/kvm_svm.h
+++ b/arch/x86/kvm/kvm_svm.h
@@ -7,7 +7,7 @@
7#include <linux/kvm_host.h> 7#include <linux/kvm_host.h>
8#include <asm/msr.h> 8#include <asm/msr.h>
9 9
10#include "svm.h" 10#include <asm/svm.h>
11 11
12static const u32 host_save_user_msrs[] = { 12static const u32 host_save_user_msrs[] = {
13#ifdef CONFIG_X86_64 13#ifdef CONFIG_X86_64
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 0fc3cab48943..afac68c0815c 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -130,6 +130,11 @@ static inline int apic_lvtt_period(struct kvm_lapic *apic)
130 return apic_get_reg(apic, APIC_LVTT) & APIC_LVT_TIMER_PERIODIC; 130 return apic_get_reg(apic, APIC_LVTT) & APIC_LVT_TIMER_PERIODIC;
131} 131}
132 132
133static inline int apic_lvt_nmi_mode(u32 lvt_val)
134{
135 return (lvt_val & (APIC_MODE_MASK | APIC_LVT_MASKED)) == APIC_DM_NMI;
136}
137
133static unsigned int apic_lvt_mask[APIC_LVT_NUM] = { 138static unsigned int apic_lvt_mask[APIC_LVT_NUM] = {
134 LVT_MASK | APIC_LVT_TIMER_PERIODIC, /* LVTT */ 139 LVT_MASK | APIC_LVT_TIMER_PERIODIC, /* LVTT */
135 LVT_MASK | APIC_MODE_MASK, /* LVTTHMR */ 140 LVT_MASK | APIC_MODE_MASK, /* LVTTHMR */
@@ -354,6 +359,7 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
354 359
355 case APIC_DM_NMI: 360 case APIC_DM_NMI:
356 kvm_inject_nmi(vcpu); 361 kvm_inject_nmi(vcpu);
362 kvm_vcpu_kick(vcpu);
357 break; 363 break;
358 364
359 case APIC_DM_INIT: 365 case APIC_DM_INIT:
@@ -380,6 +386,14 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
380 } 386 }
381 break; 387 break;
382 388
389 case APIC_DM_EXTINT:
390 /*
391 * Should only be called by kvm_apic_local_deliver() with LVT0,
392 * before NMI watchdog was enabled. Already handled by
393 * kvm_apic_accept_pic_intr().
394 */
395 break;
396
383 default: 397 default:
384 printk(KERN_ERR "TODO: unsupported delivery mode %x\n", 398 printk(KERN_ERR "TODO: unsupported delivery mode %x\n",
385 delivery_mode); 399 delivery_mode);
@@ -663,6 +677,20 @@ static void start_apic_timer(struct kvm_lapic *apic)
663 apic->timer.period))); 677 apic->timer.period)));
664} 678}
665 679
680static void apic_manage_nmi_watchdog(struct kvm_lapic *apic, u32 lvt0_val)
681{
682 int nmi_wd_enabled = apic_lvt_nmi_mode(apic_get_reg(apic, APIC_LVT0));
683
684 if (apic_lvt_nmi_mode(lvt0_val)) {
685 if (!nmi_wd_enabled) {
686 apic_debug("Receive NMI setting on APIC_LVT0 "
687 "for cpu %d\n", apic->vcpu->vcpu_id);
688 apic->vcpu->kvm->arch.vapics_in_nmi_mode++;
689 }
690 } else if (nmi_wd_enabled)
691 apic->vcpu->kvm->arch.vapics_in_nmi_mode--;
692}
693
666static void apic_mmio_write(struct kvm_io_device *this, 694static void apic_mmio_write(struct kvm_io_device *this,
667 gpa_t address, int len, const void *data) 695 gpa_t address, int len, const void *data)
668{ 696{
@@ -743,10 +771,11 @@ static void apic_mmio_write(struct kvm_io_device *this,
743 apic_set_reg(apic, APIC_ICR2, val & 0xff000000); 771 apic_set_reg(apic, APIC_ICR2, val & 0xff000000);
744 break; 772 break;
745 773
774 case APIC_LVT0:
775 apic_manage_nmi_watchdog(apic, val);
746 case APIC_LVTT: 776 case APIC_LVTT:
747 case APIC_LVTTHMR: 777 case APIC_LVTTHMR:
748 case APIC_LVTPC: 778 case APIC_LVTPC:
749 case APIC_LVT0:
750 case APIC_LVT1: 779 case APIC_LVT1:
751 case APIC_LVTERR: 780 case APIC_LVTERR:
752 /* TODO: Check vector */ 781 /* TODO: Check vector */
@@ -961,12 +990,26 @@ int apic_has_pending_timer(struct kvm_vcpu *vcpu)
961 return 0; 990 return 0;
962} 991}
963 992
964static int __inject_apic_timer_irq(struct kvm_lapic *apic) 993static int kvm_apic_local_deliver(struct kvm_lapic *apic, int lvt_type)
994{
995 u32 reg = apic_get_reg(apic, lvt_type);
996 int vector, mode, trig_mode;
997
998 if (apic_hw_enabled(apic) && !(reg & APIC_LVT_MASKED)) {
999 vector = reg & APIC_VECTOR_MASK;
1000 mode = reg & APIC_MODE_MASK;
1001 trig_mode = reg & APIC_LVT_LEVEL_TRIGGER;
1002 return __apic_accept_irq(apic, mode, vector, 1, trig_mode);
1003 }
1004 return 0;
1005}
1006
1007void kvm_apic_nmi_wd_deliver(struct kvm_vcpu *vcpu)
965{ 1008{
966 int vector; 1009 struct kvm_lapic *apic = vcpu->arch.apic;
967 1010
968 vector = apic_lvt_vector(apic, APIC_LVTT); 1011 if (apic)
969 return __apic_accept_irq(apic, APIC_DM_FIXED, vector, 1, 0); 1012 kvm_apic_local_deliver(apic, APIC_LVT0);
970} 1013}
971 1014
972static enum hrtimer_restart apic_timer_fn(struct hrtimer *data) 1015static enum hrtimer_restart apic_timer_fn(struct hrtimer *data)
@@ -1061,9 +1104,8 @@ void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu)
1061{ 1104{
1062 struct kvm_lapic *apic = vcpu->arch.apic; 1105 struct kvm_lapic *apic = vcpu->arch.apic;
1063 1106
1064 if (apic && apic_lvt_enabled(apic, APIC_LVTT) && 1107 if (apic && atomic_read(&apic->timer.pending) > 0) {
1065 atomic_read(&apic->timer.pending) > 0) { 1108 if (kvm_apic_local_deliver(apic, APIC_LVTT))
1066 if (__inject_apic_timer_irq(apic))
1067 atomic_dec(&apic->timer.pending); 1109 atomic_dec(&apic->timer.pending);
1068 } 1110 }
1069} 1111}
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 410ddbc1aa2e..83f11c7474a1 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -17,7 +17,6 @@
17 * 17 *
18 */ 18 */
19 19
20#include "vmx.h"
21#include "mmu.h" 20#include "mmu.h"
22 21
23#include <linux/kvm_host.h> 22#include <linux/kvm_host.h>
@@ -33,6 +32,7 @@
33#include <asm/page.h> 32#include <asm/page.h>
34#include <asm/cmpxchg.h> 33#include <asm/cmpxchg.h>
35#include <asm/io.h> 34#include <asm/io.h>
35#include <asm/vmx.h>
36 36
37/* 37/*
38 * When setting this variable to true it enables Two-Dimensional-Paging 38 * When setting this variable to true it enables Two-Dimensional-Paging
@@ -168,6 +168,7 @@ static u64 __read_mostly shadow_x_mask; /* mutual exclusive with nx_mask */
168static u64 __read_mostly shadow_user_mask; 168static u64 __read_mostly shadow_user_mask;
169static u64 __read_mostly shadow_accessed_mask; 169static u64 __read_mostly shadow_accessed_mask;
170static u64 __read_mostly shadow_dirty_mask; 170static u64 __read_mostly shadow_dirty_mask;
171static u64 __read_mostly shadow_mt_mask;
171 172
172void kvm_mmu_set_nonpresent_ptes(u64 trap_pte, u64 notrap_pte) 173void kvm_mmu_set_nonpresent_ptes(u64 trap_pte, u64 notrap_pte)
173{ 174{
@@ -183,13 +184,14 @@ void kvm_mmu_set_base_ptes(u64 base_pte)
183EXPORT_SYMBOL_GPL(kvm_mmu_set_base_ptes); 184EXPORT_SYMBOL_GPL(kvm_mmu_set_base_ptes);
184 185
185void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask, 186void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask,
186 u64 dirty_mask, u64 nx_mask, u64 x_mask) 187 u64 dirty_mask, u64 nx_mask, u64 x_mask, u64 mt_mask)
187{ 188{
188 shadow_user_mask = user_mask; 189 shadow_user_mask = user_mask;
189 shadow_accessed_mask = accessed_mask; 190 shadow_accessed_mask = accessed_mask;
190 shadow_dirty_mask = dirty_mask; 191 shadow_dirty_mask = dirty_mask;
191 shadow_nx_mask = nx_mask; 192 shadow_nx_mask = nx_mask;
192 shadow_x_mask = x_mask; 193 shadow_x_mask = x_mask;
194 shadow_mt_mask = mt_mask;
193} 195}
194EXPORT_SYMBOL_GPL(kvm_mmu_set_mask_ptes); 196EXPORT_SYMBOL_GPL(kvm_mmu_set_mask_ptes);
195 197
@@ -384,7 +386,9 @@ static void account_shadowed(struct kvm *kvm, gfn_t gfn)
384{ 386{
385 int *write_count; 387 int *write_count;
386 388
387 write_count = slot_largepage_idx(gfn, gfn_to_memslot(kvm, gfn)); 389 gfn = unalias_gfn(kvm, gfn);
390 write_count = slot_largepage_idx(gfn,
391 gfn_to_memslot_unaliased(kvm, gfn));
388 *write_count += 1; 392 *write_count += 1;
389} 393}
390 394
@@ -392,16 +396,20 @@ static void unaccount_shadowed(struct kvm *kvm, gfn_t gfn)
392{ 396{
393 int *write_count; 397 int *write_count;
394 398
395 write_count = slot_largepage_idx(gfn, gfn_to_memslot(kvm, gfn)); 399 gfn = unalias_gfn(kvm, gfn);
400 write_count = slot_largepage_idx(gfn,
401 gfn_to_memslot_unaliased(kvm, gfn));
396 *write_count -= 1; 402 *write_count -= 1;
397 WARN_ON(*write_count < 0); 403 WARN_ON(*write_count < 0);
398} 404}
399 405
400static int has_wrprotected_page(struct kvm *kvm, gfn_t gfn) 406static int has_wrprotected_page(struct kvm *kvm, gfn_t gfn)
401{ 407{
402 struct kvm_memory_slot *slot = gfn_to_memslot(kvm, gfn); 408 struct kvm_memory_slot *slot;
403 int *largepage_idx; 409 int *largepage_idx;
404 410
411 gfn = unalias_gfn(kvm, gfn);
412 slot = gfn_to_memslot_unaliased(kvm, gfn);
405 if (slot) { 413 if (slot) {
406 largepage_idx = slot_largepage_idx(gfn, slot); 414 largepage_idx = slot_largepage_idx(gfn, slot);
407 return *largepage_idx; 415 return *largepage_idx;
@@ -613,7 +621,7 @@ static u64 *rmap_next(struct kvm *kvm, unsigned long *rmapp, u64 *spte)
613 return NULL; 621 return NULL;
614} 622}
615 623
616static void rmap_write_protect(struct kvm *kvm, u64 gfn) 624static int rmap_write_protect(struct kvm *kvm, u64 gfn)
617{ 625{
618 unsigned long *rmapp; 626 unsigned long *rmapp;
619 u64 *spte; 627 u64 *spte;
@@ -659,8 +667,7 @@ static void rmap_write_protect(struct kvm *kvm, u64 gfn)
659 spte = rmap_next(kvm, rmapp, spte); 667 spte = rmap_next(kvm, rmapp, spte);
660 } 668 }
661 669
662 if (write_protected) 670 return write_protected;
663 kvm_flush_remote_tlbs(kvm);
664} 671}
665 672
666static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp) 673static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp)
@@ -786,9 +793,11 @@ static struct kvm_mmu_page *kvm_mmu_alloc_page(struct kvm_vcpu *vcpu,
786 sp->gfns = mmu_memory_cache_alloc(&vcpu->arch.mmu_page_cache, PAGE_SIZE); 793 sp->gfns = mmu_memory_cache_alloc(&vcpu->arch.mmu_page_cache, PAGE_SIZE);
787 set_page_private(virt_to_page(sp->spt), (unsigned long)sp); 794 set_page_private(virt_to_page(sp->spt), (unsigned long)sp);
788 list_add(&sp->link, &vcpu->kvm->arch.active_mmu_pages); 795 list_add(&sp->link, &vcpu->kvm->arch.active_mmu_pages);
796 INIT_LIST_HEAD(&sp->oos_link);
789 ASSERT(is_empty_shadow_page(sp->spt)); 797 ASSERT(is_empty_shadow_page(sp->spt));
790 sp->slot_bitmap = 0; 798 bitmap_zero(sp->slot_bitmap, KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS);
791 sp->multimapped = 0; 799 sp->multimapped = 0;
800 sp->global = 1;
792 sp->parent_pte = parent_pte; 801 sp->parent_pte = parent_pte;
793 --vcpu->kvm->arch.n_free_mmu_pages; 802 --vcpu->kvm->arch.n_free_mmu_pages;
794 return sp; 803 return sp;
@@ -900,8 +909,9 @@ static void kvm_mmu_update_unsync_bitmap(u64 *spte)
900 struct kvm_mmu_page *sp = page_header(__pa(spte)); 909 struct kvm_mmu_page *sp = page_header(__pa(spte));
901 910
902 index = spte - sp->spt; 911 index = spte - sp->spt;
903 __set_bit(index, sp->unsync_child_bitmap); 912 if (!__test_and_set_bit(index, sp->unsync_child_bitmap))
904 sp->unsync_children = 1; 913 sp->unsync_children++;
914 WARN_ON(!sp->unsync_children);
905} 915}
906 916
907static void kvm_mmu_update_parents_unsync(struct kvm_mmu_page *sp) 917static void kvm_mmu_update_parents_unsync(struct kvm_mmu_page *sp)
@@ -928,7 +938,6 @@ static void kvm_mmu_update_parents_unsync(struct kvm_mmu_page *sp)
928 938
929static int unsync_walk_fn(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp) 939static int unsync_walk_fn(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
930{ 940{
931 sp->unsync_children = 1;
932 kvm_mmu_update_parents_unsync(sp); 941 kvm_mmu_update_parents_unsync(sp);
933 return 1; 942 return 1;
934} 943}
@@ -959,38 +968,66 @@ static void nonpaging_invlpg(struct kvm_vcpu *vcpu, gva_t gva)
959{ 968{
960} 969}
961 970
971#define KVM_PAGE_ARRAY_NR 16
972
973struct kvm_mmu_pages {
974 struct mmu_page_and_offset {
975 struct kvm_mmu_page *sp;
976 unsigned int idx;
977 } page[KVM_PAGE_ARRAY_NR];
978 unsigned int nr;
979};
980
962#define for_each_unsync_children(bitmap, idx) \ 981#define for_each_unsync_children(bitmap, idx) \
963 for (idx = find_first_bit(bitmap, 512); \ 982 for (idx = find_first_bit(bitmap, 512); \
964 idx < 512; \ 983 idx < 512; \
965 idx = find_next_bit(bitmap, 512, idx+1)) 984 idx = find_next_bit(bitmap, 512, idx+1))
966 985
967static int mmu_unsync_walk(struct kvm_mmu_page *sp, 986int mmu_pages_add(struct kvm_mmu_pages *pvec, struct kvm_mmu_page *sp,
968 struct kvm_unsync_walk *walker) 987 int idx)
969{ 988{
970 int i, ret; 989 int i;
971 990
972 if (!sp->unsync_children) 991 if (sp->unsync)
973 return 0; 992 for (i=0; i < pvec->nr; i++)
993 if (pvec->page[i].sp == sp)
994 return 0;
995
996 pvec->page[pvec->nr].sp = sp;
997 pvec->page[pvec->nr].idx = idx;
998 pvec->nr++;
999 return (pvec->nr == KVM_PAGE_ARRAY_NR);
1000}
1001
1002static int __mmu_unsync_walk(struct kvm_mmu_page *sp,
1003 struct kvm_mmu_pages *pvec)
1004{
1005 int i, ret, nr_unsync_leaf = 0;
974 1006
975 for_each_unsync_children(sp->unsync_child_bitmap, i) { 1007 for_each_unsync_children(sp->unsync_child_bitmap, i) {
976 u64 ent = sp->spt[i]; 1008 u64 ent = sp->spt[i];
977 1009
978 if (is_shadow_present_pte(ent)) { 1010 if (is_shadow_present_pte(ent) && !is_large_pte(ent)) {
979 struct kvm_mmu_page *child; 1011 struct kvm_mmu_page *child;
980 child = page_header(ent & PT64_BASE_ADDR_MASK); 1012 child = page_header(ent & PT64_BASE_ADDR_MASK);
981 1013
982 if (child->unsync_children) { 1014 if (child->unsync_children) {
983 ret = mmu_unsync_walk(child, walker); 1015 if (mmu_pages_add(pvec, child, i))
984 if (ret) 1016 return -ENOSPC;
1017
1018 ret = __mmu_unsync_walk(child, pvec);
1019 if (!ret)
1020 __clear_bit(i, sp->unsync_child_bitmap);
1021 else if (ret > 0)
1022 nr_unsync_leaf += ret;
1023 else
985 return ret; 1024 return ret;
986 __clear_bit(i, sp->unsync_child_bitmap);
987 } 1025 }
988 1026
989 if (child->unsync) { 1027 if (child->unsync) {
990 ret = walker->entry(child, walker); 1028 nr_unsync_leaf++;
991 __clear_bit(i, sp->unsync_child_bitmap); 1029 if (mmu_pages_add(pvec, child, i))
992 if (ret) 1030 return -ENOSPC;
993 return ret;
994 } 1031 }
995 } 1032 }
996 } 1033 }
@@ -998,7 +1035,17 @@ static int mmu_unsync_walk(struct kvm_mmu_page *sp,
998 if (find_first_bit(sp->unsync_child_bitmap, 512) == 512) 1035 if (find_first_bit(sp->unsync_child_bitmap, 512) == 512)
999 sp->unsync_children = 0; 1036 sp->unsync_children = 0;
1000 1037
1001 return 0; 1038 return nr_unsync_leaf;
1039}
1040
1041static int mmu_unsync_walk(struct kvm_mmu_page *sp,
1042 struct kvm_mmu_pages *pvec)
1043{
1044 if (!sp->unsync_children)
1045 return 0;
1046
1047 mmu_pages_add(pvec, sp, 0);
1048 return __mmu_unsync_walk(sp, pvec);
1002} 1049}
1003 1050
1004static struct kvm_mmu_page *kvm_mmu_lookup_page(struct kvm *kvm, gfn_t gfn) 1051static struct kvm_mmu_page *kvm_mmu_lookup_page(struct kvm *kvm, gfn_t gfn)
@@ -1021,10 +1068,18 @@ static struct kvm_mmu_page *kvm_mmu_lookup_page(struct kvm *kvm, gfn_t gfn)
1021 return NULL; 1068 return NULL;
1022} 1069}
1023 1070
1071static void kvm_unlink_unsync_global(struct kvm *kvm, struct kvm_mmu_page *sp)
1072{
1073 list_del(&sp->oos_link);
1074 --kvm->stat.mmu_unsync_global;
1075}
1076
1024static void kvm_unlink_unsync_page(struct kvm *kvm, struct kvm_mmu_page *sp) 1077static void kvm_unlink_unsync_page(struct kvm *kvm, struct kvm_mmu_page *sp)
1025{ 1078{
1026 WARN_ON(!sp->unsync); 1079 WARN_ON(!sp->unsync);
1027 sp->unsync = 0; 1080 sp->unsync = 0;
1081 if (sp->global)
1082 kvm_unlink_unsync_global(kvm, sp);
1028 --kvm->stat.mmu_unsync; 1083 --kvm->stat.mmu_unsync;
1029} 1084}
1030 1085
@@ -1037,7 +1092,8 @@ static int kvm_sync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
1037 return 1; 1092 return 1;
1038 } 1093 }
1039 1094
1040 rmap_write_protect(vcpu->kvm, sp->gfn); 1095 if (rmap_write_protect(vcpu->kvm, sp->gfn))
1096 kvm_flush_remote_tlbs(vcpu->kvm);
1041 kvm_unlink_unsync_page(vcpu->kvm, sp); 1097 kvm_unlink_unsync_page(vcpu->kvm, sp);
1042 if (vcpu->arch.mmu.sync_page(vcpu, sp)) { 1098 if (vcpu->arch.mmu.sync_page(vcpu, sp)) {
1043 kvm_mmu_zap_page(vcpu->kvm, sp); 1099 kvm_mmu_zap_page(vcpu->kvm, sp);
@@ -1048,30 +1104,89 @@ static int kvm_sync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
1048 return 0; 1104 return 0;
1049} 1105}
1050 1106
1051struct sync_walker { 1107struct mmu_page_path {
1052 struct kvm_vcpu *vcpu; 1108 struct kvm_mmu_page *parent[PT64_ROOT_LEVEL-1];
1053 struct kvm_unsync_walk walker; 1109 unsigned int idx[PT64_ROOT_LEVEL-1];
1054}; 1110};
1055 1111
1056static int mmu_sync_fn(struct kvm_mmu_page *sp, struct kvm_unsync_walk *walk) 1112#define for_each_sp(pvec, sp, parents, i) \
1113 for (i = mmu_pages_next(&pvec, &parents, -1), \
1114 sp = pvec.page[i].sp; \
1115 i < pvec.nr && ({ sp = pvec.page[i].sp; 1;}); \
1116 i = mmu_pages_next(&pvec, &parents, i))
1117
1118int mmu_pages_next(struct kvm_mmu_pages *pvec, struct mmu_page_path *parents,
1119 int i)
1057{ 1120{
1058 struct sync_walker *sync_walk = container_of(walk, struct sync_walker, 1121 int n;
1059 walker);
1060 struct kvm_vcpu *vcpu = sync_walk->vcpu;
1061 1122
1062 kvm_sync_page(vcpu, sp); 1123 for (n = i+1; n < pvec->nr; n++) {
1063 return (need_resched() || spin_needbreak(&vcpu->kvm->mmu_lock)); 1124 struct kvm_mmu_page *sp = pvec->page[n].sp;
1125
1126 if (sp->role.level == PT_PAGE_TABLE_LEVEL) {
1127 parents->idx[0] = pvec->page[n].idx;
1128 return n;
1129 }
1130
1131 parents->parent[sp->role.level-2] = sp;
1132 parents->idx[sp->role.level-1] = pvec->page[n].idx;
1133 }
1134
1135 return n;
1064} 1136}
1065 1137
1066static void mmu_sync_children(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp) 1138void mmu_pages_clear_parents(struct mmu_page_path *parents)
1067{ 1139{
1068 struct sync_walker walker = { 1140 struct kvm_mmu_page *sp;
1069 .walker = { .entry = mmu_sync_fn, }, 1141 unsigned int level = 0;
1070 .vcpu = vcpu, 1142
1071 }; 1143 do {
1144 unsigned int idx = parents->idx[level];
1145
1146 sp = parents->parent[level];
1147 if (!sp)
1148 return;
1149
1150 --sp->unsync_children;
1151 WARN_ON((int)sp->unsync_children < 0);
1152 __clear_bit(idx, sp->unsync_child_bitmap);
1153 level++;
1154 } while (level < PT64_ROOT_LEVEL-1 && !sp->unsync_children);
1155}
1156
1157static void kvm_mmu_pages_init(struct kvm_mmu_page *parent,
1158 struct mmu_page_path *parents,
1159 struct kvm_mmu_pages *pvec)
1160{
1161 parents->parent[parent->role.level-1] = NULL;
1162 pvec->nr = 0;
1163}
1164
1165static void mmu_sync_children(struct kvm_vcpu *vcpu,
1166 struct kvm_mmu_page *parent)
1167{
1168 int i;
1169 struct kvm_mmu_page *sp;
1170 struct mmu_page_path parents;
1171 struct kvm_mmu_pages pages;
1172
1173 kvm_mmu_pages_init(parent, &parents, &pages);
1174 while (mmu_unsync_walk(parent, &pages)) {
1175 int protected = 0;
1072 1176
1073 while (mmu_unsync_walk(sp, &walker.walker)) 1177 for_each_sp(pages, sp, parents, i)
1178 protected |= rmap_write_protect(vcpu->kvm, sp->gfn);
1179
1180 if (protected)
1181 kvm_flush_remote_tlbs(vcpu->kvm);
1182
1183 for_each_sp(pages, sp, parents, i) {
1184 kvm_sync_page(vcpu, sp);
1185 mmu_pages_clear_parents(&parents);
1186 }
1074 cond_resched_lock(&vcpu->kvm->mmu_lock); 1187 cond_resched_lock(&vcpu->kvm->mmu_lock);
1188 kvm_mmu_pages_init(parent, &parents, &pages);
1189 }
1075} 1190}
1076 1191
1077static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu, 1192static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu,
@@ -1129,7 +1244,8 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu,
1129 sp->role = role; 1244 sp->role = role;
1130 hlist_add_head(&sp->hash_link, bucket); 1245 hlist_add_head(&sp->hash_link, bucket);
1131 if (!metaphysical) { 1246 if (!metaphysical) {
1132 rmap_write_protect(vcpu->kvm, gfn); 1247 if (rmap_write_protect(vcpu->kvm, gfn))
1248 kvm_flush_remote_tlbs(vcpu->kvm);
1133 account_shadowed(vcpu->kvm, gfn); 1249 account_shadowed(vcpu->kvm, gfn);
1134 } 1250 }
1135 if (shadow_trap_nonpresent_pte != shadow_notrap_nonpresent_pte) 1251 if (shadow_trap_nonpresent_pte != shadow_notrap_nonpresent_pte)
@@ -1153,6 +1269,8 @@ static int walk_shadow(struct kvm_shadow_walk *walker,
1153 if (level == PT32E_ROOT_LEVEL) { 1269 if (level == PT32E_ROOT_LEVEL) {
1154 shadow_addr = vcpu->arch.mmu.pae_root[(addr >> 30) & 3]; 1270 shadow_addr = vcpu->arch.mmu.pae_root[(addr >> 30) & 3];
1155 shadow_addr &= PT64_BASE_ADDR_MASK; 1271 shadow_addr &= PT64_BASE_ADDR_MASK;
1272 if (!shadow_addr)
1273 return 1;
1156 --level; 1274 --level;
1157 } 1275 }
1158 1276
@@ -1237,33 +1355,29 @@ static void kvm_mmu_unlink_parents(struct kvm *kvm, struct kvm_mmu_page *sp)
1237 } 1355 }
1238} 1356}
1239 1357
1240struct zap_walker { 1358static int mmu_zap_unsync_children(struct kvm *kvm,
1241 struct kvm_unsync_walk walker; 1359 struct kvm_mmu_page *parent)
1242 struct kvm *kvm;
1243 int zapped;
1244};
1245
1246static int mmu_zap_fn(struct kvm_mmu_page *sp, struct kvm_unsync_walk *walk)
1247{ 1360{
1248 struct zap_walker *zap_walk = container_of(walk, struct zap_walker, 1361 int i, zapped = 0;
1249 walker); 1362 struct mmu_page_path parents;
1250 kvm_mmu_zap_page(zap_walk->kvm, sp); 1363 struct kvm_mmu_pages pages;
1251 zap_walk->zapped = 1;
1252 return 0;
1253}
1254 1364
1255static int mmu_zap_unsync_children(struct kvm *kvm, struct kvm_mmu_page *sp) 1365 if (parent->role.level == PT_PAGE_TABLE_LEVEL)
1256{
1257 struct zap_walker walker = {
1258 .walker = { .entry = mmu_zap_fn, },
1259 .kvm = kvm,
1260 .zapped = 0,
1261 };
1262
1263 if (sp->role.level == PT_PAGE_TABLE_LEVEL)
1264 return 0; 1366 return 0;
1265 mmu_unsync_walk(sp, &walker.walker); 1367
1266 return walker.zapped; 1368 kvm_mmu_pages_init(parent, &parents, &pages);
1369 while (mmu_unsync_walk(parent, &pages)) {
1370 struct kvm_mmu_page *sp;
1371
1372 for_each_sp(pages, sp, parents, i) {
1373 kvm_mmu_zap_page(kvm, sp);
1374 mmu_pages_clear_parents(&parents);
1375 }
1376 zapped += pages.nr;
1377 kvm_mmu_pages_init(parent, &parents, &pages);
1378 }
1379
1380 return zapped;
1267} 1381}
1268 1382
1269static int kvm_mmu_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp) 1383static int kvm_mmu_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp)
@@ -1362,7 +1476,7 @@ static void page_header_update_slot(struct kvm *kvm, void *pte, gfn_t gfn)
1362 int slot = memslot_id(kvm, gfn_to_memslot(kvm, gfn)); 1476 int slot = memslot_id(kvm, gfn_to_memslot(kvm, gfn));
1363 struct kvm_mmu_page *sp = page_header(__pa(pte)); 1477 struct kvm_mmu_page *sp = page_header(__pa(pte));
1364 1478
1365 __set_bit(slot, &sp->slot_bitmap); 1479 __set_bit(slot, sp->slot_bitmap);
1366} 1480}
1367 1481
1368static void mmu_convert_notrap(struct kvm_mmu_page *sp) 1482static void mmu_convert_notrap(struct kvm_mmu_page *sp)
@@ -1393,6 +1507,110 @@ struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva)
1393 return page; 1507 return page;
1394} 1508}
1395 1509
1510/*
1511 * The function is based on mtrr_type_lookup() in
1512 * arch/x86/kernel/cpu/mtrr/generic.c
1513 */
1514static int get_mtrr_type(struct mtrr_state_type *mtrr_state,
1515 u64 start, u64 end)
1516{
1517 int i;
1518 u64 base, mask;
1519 u8 prev_match, curr_match;
1520 int num_var_ranges = KVM_NR_VAR_MTRR;
1521
1522 if (!mtrr_state->enabled)
1523 return 0xFF;
1524
1525 /* Make end inclusive end, instead of exclusive */
1526 end--;
1527
1528 /* Look in fixed ranges. Just return the type as per start */
1529 if (mtrr_state->have_fixed && (start < 0x100000)) {
1530 int idx;
1531
1532 if (start < 0x80000) {
1533 idx = 0;
1534 idx += (start >> 16);
1535 return mtrr_state->fixed_ranges[idx];
1536 } else if (start < 0xC0000) {
1537 idx = 1 * 8;
1538 idx += ((start - 0x80000) >> 14);
1539 return mtrr_state->fixed_ranges[idx];
1540 } else if (start < 0x1000000) {
1541 idx = 3 * 8;
1542 idx += ((start - 0xC0000) >> 12);
1543 return mtrr_state->fixed_ranges[idx];
1544 }
1545 }
1546
1547 /*
1548 * Look in variable ranges
1549 * Look of multiple ranges matching this address and pick type
1550 * as per MTRR precedence
1551 */
1552 if (!(mtrr_state->enabled & 2))
1553 return mtrr_state->def_type;
1554
1555 prev_match = 0xFF;
1556 for (i = 0; i < num_var_ranges; ++i) {
1557 unsigned short start_state, end_state;
1558
1559 if (!(mtrr_state->var_ranges[i].mask_lo & (1 << 11)))
1560 continue;
1561
1562 base = (((u64)mtrr_state->var_ranges[i].base_hi) << 32) +
1563 (mtrr_state->var_ranges[i].base_lo & PAGE_MASK);
1564 mask = (((u64)mtrr_state->var_ranges[i].mask_hi) << 32) +
1565 (mtrr_state->var_ranges[i].mask_lo & PAGE_MASK);
1566
1567 start_state = ((start & mask) == (base & mask));
1568 end_state = ((end & mask) == (base & mask));
1569 if (start_state != end_state)
1570 return 0xFE;
1571
1572 if ((start & mask) != (base & mask))
1573 continue;
1574
1575 curr_match = mtrr_state->var_ranges[i].base_lo & 0xff;
1576 if (prev_match == 0xFF) {
1577 prev_match = curr_match;
1578 continue;
1579 }
1580
1581 if (prev_match == MTRR_TYPE_UNCACHABLE ||
1582 curr_match == MTRR_TYPE_UNCACHABLE)
1583 return MTRR_TYPE_UNCACHABLE;
1584
1585 if ((prev_match == MTRR_TYPE_WRBACK &&
1586 curr_match == MTRR_TYPE_WRTHROUGH) ||
1587 (prev_match == MTRR_TYPE_WRTHROUGH &&
1588 curr_match == MTRR_TYPE_WRBACK)) {
1589 prev_match = MTRR_TYPE_WRTHROUGH;
1590 curr_match = MTRR_TYPE_WRTHROUGH;
1591 }
1592
1593 if (prev_match != curr_match)
1594 return MTRR_TYPE_UNCACHABLE;
1595 }
1596
1597 if (prev_match != 0xFF)
1598 return prev_match;
1599
1600 return mtrr_state->def_type;
1601}
1602
1603static u8 get_memory_type(struct kvm_vcpu *vcpu, gfn_t gfn)
1604{
1605 u8 mtrr;
1606
1607 mtrr = get_mtrr_type(&vcpu->arch.mtrr_state, gfn << PAGE_SHIFT,
1608 (gfn << PAGE_SHIFT) + PAGE_SIZE);
1609 if (mtrr == 0xfe || mtrr == 0xff)
1610 mtrr = MTRR_TYPE_WRBACK;
1611 return mtrr;
1612}
1613
1396static int kvm_unsync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp) 1614static int kvm_unsync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
1397{ 1615{
1398 unsigned index; 1616 unsigned index;
@@ -1409,9 +1627,15 @@ static int kvm_unsync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
1409 if (s->role.word != sp->role.word) 1627 if (s->role.word != sp->role.word)
1410 return 1; 1628 return 1;
1411 } 1629 }
1412 kvm_mmu_mark_parents_unsync(vcpu, sp);
1413 ++vcpu->kvm->stat.mmu_unsync; 1630 ++vcpu->kvm->stat.mmu_unsync;
1414 sp->unsync = 1; 1631 sp->unsync = 1;
1632
1633 if (sp->global) {
1634 list_add(&sp->oos_link, &vcpu->kvm->arch.oos_global_pages);
1635 ++vcpu->kvm->stat.mmu_unsync_global;
1636 } else
1637 kvm_mmu_mark_parents_unsync(vcpu, sp);
1638
1415 mmu_convert_notrap(sp); 1639 mmu_convert_notrap(sp);
1416 return 0; 1640 return 0;
1417} 1641}
@@ -1437,11 +1661,24 @@ static int mmu_need_write_protect(struct kvm_vcpu *vcpu, gfn_t gfn,
1437static int set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte, 1661static int set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte,
1438 unsigned pte_access, int user_fault, 1662 unsigned pte_access, int user_fault,
1439 int write_fault, int dirty, int largepage, 1663 int write_fault, int dirty, int largepage,
1440 gfn_t gfn, pfn_t pfn, bool speculative, 1664 int global, gfn_t gfn, pfn_t pfn, bool speculative,
1441 bool can_unsync) 1665 bool can_unsync)
1442{ 1666{
1443 u64 spte; 1667 u64 spte;
1444 int ret = 0; 1668 int ret = 0;
1669 u64 mt_mask = shadow_mt_mask;
1670 struct kvm_mmu_page *sp = page_header(__pa(shadow_pte));
1671
1672 if (!(vcpu->arch.cr4 & X86_CR4_PGE))
1673 global = 0;
1674 if (!global && sp->global) {
1675 sp->global = 0;
1676 if (sp->unsync) {
1677 kvm_unlink_unsync_global(vcpu->kvm, sp);
1678 kvm_mmu_mark_parents_unsync(vcpu, sp);
1679 }
1680 }
1681
1445 /* 1682 /*
1446 * We don't set the accessed bit, since we sometimes want to see 1683 * We don't set the accessed bit, since we sometimes want to see
1447 * whether the guest actually used the pte (in order to detect 1684 * whether the guest actually used the pte (in order to detect
@@ -1460,6 +1697,11 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte,
1460 spte |= shadow_user_mask; 1697 spte |= shadow_user_mask;
1461 if (largepage) 1698 if (largepage)
1462 spte |= PT_PAGE_SIZE_MASK; 1699 spte |= PT_PAGE_SIZE_MASK;
1700 if (mt_mask) {
1701 mt_mask = get_memory_type(vcpu, gfn) <<
1702 kvm_x86_ops->get_mt_mask_shift();
1703 spte |= mt_mask;
1704 }
1463 1705
1464 spte |= (u64)pfn << PAGE_SHIFT; 1706 spte |= (u64)pfn << PAGE_SHIFT;
1465 1707
@@ -1474,6 +1716,15 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte,
1474 1716
1475 spte |= PT_WRITABLE_MASK; 1717 spte |= PT_WRITABLE_MASK;
1476 1718
1719 /*
1720 * Optimization: for pte sync, if spte was writable the hash
1721 * lookup is unnecessary (and expensive). Write protection
1722 * is responsibility of mmu_get_page / kvm_sync_page.
1723 * Same reasoning can be applied to dirty page accounting.
1724 */
1725 if (!can_unsync && is_writeble_pte(*shadow_pte))
1726 goto set_pte;
1727
1477 if (mmu_need_write_protect(vcpu, gfn, can_unsync)) { 1728 if (mmu_need_write_protect(vcpu, gfn, can_unsync)) {
1478 pgprintk("%s: found shadow page for %lx, marking ro\n", 1729 pgprintk("%s: found shadow page for %lx, marking ro\n",
1479 __func__, gfn); 1730 __func__, gfn);
@@ -1495,8 +1746,8 @@ set_pte:
1495static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte, 1746static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte,
1496 unsigned pt_access, unsigned pte_access, 1747 unsigned pt_access, unsigned pte_access,
1497 int user_fault, int write_fault, int dirty, 1748 int user_fault, int write_fault, int dirty,
1498 int *ptwrite, int largepage, gfn_t gfn, 1749 int *ptwrite, int largepage, int global,
1499 pfn_t pfn, bool speculative) 1750 gfn_t gfn, pfn_t pfn, bool speculative)
1500{ 1751{
1501 int was_rmapped = 0; 1752 int was_rmapped = 0;
1502 int was_writeble = is_writeble_pte(*shadow_pte); 1753 int was_writeble = is_writeble_pte(*shadow_pte);
@@ -1529,7 +1780,7 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte,
1529 } 1780 }
1530 } 1781 }
1531 if (set_spte(vcpu, shadow_pte, pte_access, user_fault, write_fault, 1782 if (set_spte(vcpu, shadow_pte, pte_access, user_fault, write_fault,
1532 dirty, largepage, gfn, pfn, speculative, true)) { 1783 dirty, largepage, global, gfn, pfn, speculative, true)) {
1533 if (write_fault) 1784 if (write_fault)
1534 *ptwrite = 1; 1785 *ptwrite = 1;
1535 kvm_x86_ops->tlb_flush(vcpu); 1786 kvm_x86_ops->tlb_flush(vcpu);
@@ -1586,7 +1837,7 @@ static int direct_map_entry(struct kvm_shadow_walk *_walk,
1586 || (walk->largepage && level == PT_DIRECTORY_LEVEL)) { 1837 || (walk->largepage && level == PT_DIRECTORY_LEVEL)) {
1587 mmu_set_spte(vcpu, sptep, ACC_ALL, ACC_ALL, 1838 mmu_set_spte(vcpu, sptep, ACC_ALL, ACC_ALL,
1588 0, walk->write, 1, &walk->pt_write, 1839 0, walk->write, 1, &walk->pt_write,
1589 walk->largepage, gfn, walk->pfn, false); 1840 walk->largepage, 0, gfn, walk->pfn, false);
1590 ++vcpu->stat.pf_fixed; 1841 ++vcpu->stat.pf_fixed;
1591 return 1; 1842 return 1;
1592 } 1843 }
@@ -1773,6 +2024,15 @@ static void mmu_sync_roots(struct kvm_vcpu *vcpu)
1773 } 2024 }
1774} 2025}
1775 2026
2027static void mmu_sync_global(struct kvm_vcpu *vcpu)
2028{
2029 struct kvm *kvm = vcpu->kvm;
2030 struct kvm_mmu_page *sp, *n;
2031
2032 list_for_each_entry_safe(sp, n, &kvm->arch.oos_global_pages, oos_link)
2033 kvm_sync_page(vcpu, sp);
2034}
2035
1776void kvm_mmu_sync_roots(struct kvm_vcpu *vcpu) 2036void kvm_mmu_sync_roots(struct kvm_vcpu *vcpu)
1777{ 2037{
1778 spin_lock(&vcpu->kvm->mmu_lock); 2038 spin_lock(&vcpu->kvm->mmu_lock);
@@ -1780,6 +2040,13 @@ void kvm_mmu_sync_roots(struct kvm_vcpu *vcpu)
1780 spin_unlock(&vcpu->kvm->mmu_lock); 2040 spin_unlock(&vcpu->kvm->mmu_lock);
1781} 2041}
1782 2042
2043void kvm_mmu_sync_global(struct kvm_vcpu *vcpu)
2044{
2045 spin_lock(&vcpu->kvm->mmu_lock);
2046 mmu_sync_global(vcpu);
2047 spin_unlock(&vcpu->kvm->mmu_lock);
2048}
2049
1783static gpa_t nonpaging_gva_to_gpa(struct kvm_vcpu *vcpu, gva_t vaddr) 2050static gpa_t nonpaging_gva_to_gpa(struct kvm_vcpu *vcpu, gva_t vaddr)
1784{ 2051{
1785 return vaddr; 2052 return vaddr;
@@ -2178,7 +2445,8 @@ static void kvm_mmu_access_page(struct kvm_vcpu *vcpu, gfn_t gfn)
2178} 2445}
2179 2446
2180void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, 2447void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
2181 const u8 *new, int bytes) 2448 const u8 *new, int bytes,
2449 bool guest_initiated)
2182{ 2450{
2183 gfn_t gfn = gpa >> PAGE_SHIFT; 2451 gfn_t gfn = gpa >> PAGE_SHIFT;
2184 struct kvm_mmu_page *sp; 2452 struct kvm_mmu_page *sp;
@@ -2204,15 +2472,17 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
2204 kvm_mmu_free_some_pages(vcpu); 2472 kvm_mmu_free_some_pages(vcpu);
2205 ++vcpu->kvm->stat.mmu_pte_write; 2473 ++vcpu->kvm->stat.mmu_pte_write;
2206 kvm_mmu_audit(vcpu, "pre pte write"); 2474 kvm_mmu_audit(vcpu, "pre pte write");
2207 if (gfn == vcpu->arch.last_pt_write_gfn 2475 if (guest_initiated) {
2208 && !last_updated_pte_accessed(vcpu)) { 2476 if (gfn == vcpu->arch.last_pt_write_gfn
2209 ++vcpu->arch.last_pt_write_count; 2477 && !last_updated_pte_accessed(vcpu)) {
2210 if (vcpu->arch.last_pt_write_count >= 3) 2478 ++vcpu->arch.last_pt_write_count;
2211 flooded = 1; 2479 if (vcpu->arch.last_pt_write_count >= 3)
2212 } else { 2480 flooded = 1;
2213 vcpu->arch.last_pt_write_gfn = gfn; 2481 } else {
2214 vcpu->arch.last_pt_write_count = 1; 2482 vcpu->arch.last_pt_write_gfn = gfn;
2215 vcpu->arch.last_pte_updated = NULL; 2483 vcpu->arch.last_pt_write_count = 1;
2484 vcpu->arch.last_pte_updated = NULL;
2485 }
2216 } 2486 }
2217 index = kvm_page_table_hashfn(gfn); 2487 index = kvm_page_table_hashfn(gfn);
2218 bucket = &vcpu->kvm->arch.mmu_page_hash[index]; 2488 bucket = &vcpu->kvm->arch.mmu_page_hash[index];
@@ -2352,9 +2622,7 @@ EXPORT_SYMBOL_GPL(kvm_mmu_page_fault);
2352 2622
2353void kvm_mmu_invlpg(struct kvm_vcpu *vcpu, gva_t gva) 2623void kvm_mmu_invlpg(struct kvm_vcpu *vcpu, gva_t gva)
2354{ 2624{
2355 spin_lock(&vcpu->kvm->mmu_lock);
2356 vcpu->arch.mmu.invlpg(vcpu, gva); 2625 vcpu->arch.mmu.invlpg(vcpu, gva);
2357 spin_unlock(&vcpu->kvm->mmu_lock);
2358 kvm_mmu_flush_tlb(vcpu); 2626 kvm_mmu_flush_tlb(vcpu);
2359 ++vcpu->stat.invlpg; 2627 ++vcpu->stat.invlpg;
2360} 2628}
@@ -2451,7 +2719,7 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot)
2451 int i; 2719 int i;
2452 u64 *pt; 2720 u64 *pt;
2453 2721
2454 if (!test_bit(slot, &sp->slot_bitmap)) 2722 if (!test_bit(slot, sp->slot_bitmap))
2455 continue; 2723 continue;
2456 2724
2457 pt = sp->spt; 2725 pt = sp->spt;
@@ -2860,8 +3128,8 @@ static void audit_write_protection(struct kvm_vcpu *vcpu)
2860 if (sp->role.metaphysical) 3128 if (sp->role.metaphysical)
2861 continue; 3129 continue;
2862 3130
2863 slot = gfn_to_memslot(vcpu->kvm, sp->gfn);
2864 gfn = unalias_gfn(vcpu->kvm, sp->gfn); 3131 gfn = unalias_gfn(vcpu->kvm, sp->gfn);
3132 slot = gfn_to_memslot_unaliased(vcpu->kvm, sp->gfn);
2865 rmapp = &slot->rmap[gfn - slot->base_gfn]; 3133 rmapp = &slot->rmap[gfn - slot->base_gfn];
2866 if (*rmapp) 3134 if (*rmapp)
2867 printk(KERN_ERR "%s: (%s) shadow page has writable" 3135 printk(KERN_ERR "%s: (%s) shadow page has writable"
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 84eee43bbe74..9fd78b6e17ad 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -82,6 +82,7 @@ struct shadow_walker {
82 int *ptwrite; 82 int *ptwrite;
83 pfn_t pfn; 83 pfn_t pfn;
84 u64 *sptep; 84 u64 *sptep;
85 gpa_t pte_gpa;
85}; 86};
86 87
87static gfn_t gpte_to_gfn(pt_element_t gpte) 88static gfn_t gpte_to_gfn(pt_element_t gpte)
@@ -222,7 +223,7 @@ walk:
222 if (ret) 223 if (ret)
223 goto walk; 224 goto walk;
224 pte |= PT_DIRTY_MASK; 225 pte |= PT_DIRTY_MASK;
225 kvm_mmu_pte_write(vcpu, pte_gpa, (u8 *)&pte, sizeof(pte)); 226 kvm_mmu_pte_write(vcpu, pte_gpa, (u8 *)&pte, sizeof(pte), 0);
226 walker->ptes[walker->level - 1] = pte; 227 walker->ptes[walker->level - 1] = pte;
227 } 228 }
228 229
@@ -274,7 +275,8 @@ static void FNAME(update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *page,
274 return; 275 return;
275 kvm_get_pfn(pfn); 276 kvm_get_pfn(pfn);
276 mmu_set_spte(vcpu, spte, page->role.access, pte_access, 0, 0, 277 mmu_set_spte(vcpu, spte, page->role.access, pte_access, 0, 0,
277 gpte & PT_DIRTY_MASK, NULL, largepage, gpte_to_gfn(gpte), 278 gpte & PT_DIRTY_MASK, NULL, largepage,
279 gpte & PT_GLOBAL_MASK, gpte_to_gfn(gpte),
278 pfn, true); 280 pfn, true);
279} 281}
280 282
@@ -301,8 +303,9 @@ static int FNAME(shadow_walk_entry)(struct kvm_shadow_walk *_sw,
301 mmu_set_spte(vcpu, sptep, access, gw->pte_access & access, 303 mmu_set_spte(vcpu, sptep, access, gw->pte_access & access,
302 sw->user_fault, sw->write_fault, 304 sw->user_fault, sw->write_fault,
303 gw->ptes[gw->level-1] & PT_DIRTY_MASK, 305 gw->ptes[gw->level-1] & PT_DIRTY_MASK,
304 sw->ptwrite, sw->largepage, gw->gfn, sw->pfn, 306 sw->ptwrite, sw->largepage,
305 false); 307 gw->ptes[gw->level-1] & PT_GLOBAL_MASK,
308 gw->gfn, sw->pfn, false);
306 sw->sptep = sptep; 309 sw->sptep = sptep;
307 return 1; 310 return 1;
308 } 311 }
@@ -466,10 +469,22 @@ static int FNAME(shadow_invlpg_entry)(struct kvm_shadow_walk *_sw,
466 struct kvm_vcpu *vcpu, u64 addr, 469 struct kvm_vcpu *vcpu, u64 addr,
467 u64 *sptep, int level) 470 u64 *sptep, int level)
468{ 471{
472 struct shadow_walker *sw =
473 container_of(_sw, struct shadow_walker, walker);
469 474
470 if (level == PT_PAGE_TABLE_LEVEL) { 475 /* FIXME: properly handle invlpg on large guest pages */
471 if (is_shadow_present_pte(*sptep)) 476 if (level == PT_PAGE_TABLE_LEVEL ||
477 ((level == PT_DIRECTORY_LEVEL) && is_large_pte(*sptep))) {
478 struct kvm_mmu_page *sp = page_header(__pa(sptep));
479
480 sw->pte_gpa = (sp->gfn << PAGE_SHIFT);
481 sw->pte_gpa += (sptep - sp->spt) * sizeof(pt_element_t);
482
483 if (is_shadow_present_pte(*sptep)) {
472 rmap_remove(vcpu->kvm, sptep); 484 rmap_remove(vcpu->kvm, sptep);
485 if (is_large_pte(*sptep))
486 --vcpu->kvm->stat.lpages;
487 }
473 set_shadow_pte(sptep, shadow_trap_nonpresent_pte); 488 set_shadow_pte(sptep, shadow_trap_nonpresent_pte);
474 return 1; 489 return 1;
475 } 490 }
@@ -480,11 +495,26 @@ static int FNAME(shadow_invlpg_entry)(struct kvm_shadow_walk *_sw,
480 495
481static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva) 496static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva)
482{ 497{
498 pt_element_t gpte;
483 struct shadow_walker walker = { 499 struct shadow_walker walker = {
484 .walker = { .entry = FNAME(shadow_invlpg_entry), }, 500 .walker = { .entry = FNAME(shadow_invlpg_entry), },
501 .pte_gpa = -1,
485 }; 502 };
486 503
504 spin_lock(&vcpu->kvm->mmu_lock);
487 walk_shadow(&walker.walker, vcpu, gva); 505 walk_shadow(&walker.walker, vcpu, gva);
506 spin_unlock(&vcpu->kvm->mmu_lock);
507 if (walker.pte_gpa == -1)
508 return;
509 if (kvm_read_guest_atomic(vcpu->kvm, walker.pte_gpa, &gpte,
510 sizeof(pt_element_t)))
511 return;
512 if (is_present_pte(gpte) && (gpte & PT_ACCESSED_MASK)) {
513 if (mmu_topup_memory_caches(vcpu))
514 return;
515 kvm_mmu_pte_write(vcpu, walker.pte_gpa, (const u8 *)&gpte,
516 sizeof(pt_element_t), 0);
517 }
488} 518}
489 519
490static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr) 520static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr)
@@ -580,7 +610,7 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
580 nr_present++; 610 nr_present++;
581 pte_access = sp->role.access & FNAME(gpte_access)(vcpu, gpte); 611 pte_access = sp->role.access & FNAME(gpte_access)(vcpu, gpte);
582 set_spte(vcpu, &sp->spt[i], pte_access, 0, 0, 612 set_spte(vcpu, &sp->spt[i], pte_access, 0, 0,
583 is_dirty_pte(gpte), 0, gfn, 613 is_dirty_pte(gpte), 0, gpte & PT_GLOBAL_MASK, gfn,
584 spte_to_pfn(sp->spt[i]), true, false); 614 spte_to_pfn(sp->spt[i]), true, false);
585 } 615 }
586 616
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 9c4ce657d963..1452851ae258 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -28,6 +28,8 @@
28 28
29#include <asm/desc.h> 29#include <asm/desc.h>
30 30
31#include <asm/virtext.h>
32
31#define __ex(x) __kvm_handle_fault_on_reboot(x) 33#define __ex(x) __kvm_handle_fault_on_reboot(x)
32 34
33MODULE_AUTHOR("Qumranet"); 35MODULE_AUTHOR("Qumranet");
@@ -245,34 +247,19 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu)
245 247
246static int has_svm(void) 248static int has_svm(void)
247{ 249{
248 uint32_t eax, ebx, ecx, edx; 250 const char *msg;
249
250 if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) {
251 printk(KERN_INFO "has_svm: not amd\n");
252 return 0;
253 }
254 251
255 cpuid(0x80000000, &eax, &ebx, &ecx, &edx); 252 if (!cpu_has_svm(&msg)) {
256 if (eax < SVM_CPUID_FUNC) { 253 printk(KERN_INFO "has_svn: %s\n", msg);
257 printk(KERN_INFO "has_svm: can't execute cpuid_8000000a\n");
258 return 0; 254 return 0;
259 } 255 }
260 256
261 cpuid(0x80000001, &eax, &ebx, &ecx, &edx);
262 if (!(ecx & (1 << SVM_CPUID_FEATURE_SHIFT))) {
263 printk(KERN_DEBUG "has_svm: svm not available\n");
264 return 0;
265 }
266 return 1; 257 return 1;
267} 258}
268 259
269static void svm_hardware_disable(void *garbage) 260static void svm_hardware_disable(void *garbage)
270{ 261{
271 uint64_t efer; 262 cpu_svm_disable();
272
273 wrmsrl(MSR_VM_HSAVE_PA, 0);
274 rdmsrl(MSR_EFER, efer);
275 wrmsrl(MSR_EFER, efer & ~MSR_EFER_SVME_MASK);
276} 263}
277 264
278static void svm_hardware_enable(void *garbage) 265static void svm_hardware_enable(void *garbage)
@@ -772,6 +759,22 @@ static void svm_get_segment(struct kvm_vcpu *vcpu,
772 var->l = (s->attrib >> SVM_SELECTOR_L_SHIFT) & 1; 759 var->l = (s->attrib >> SVM_SELECTOR_L_SHIFT) & 1;
773 var->db = (s->attrib >> SVM_SELECTOR_DB_SHIFT) & 1; 760 var->db = (s->attrib >> SVM_SELECTOR_DB_SHIFT) & 1;
774 var->g = (s->attrib >> SVM_SELECTOR_G_SHIFT) & 1; 761 var->g = (s->attrib >> SVM_SELECTOR_G_SHIFT) & 1;
762
763 /*
764 * SVM always stores 0 for the 'G' bit in the CS selector in
765 * the VMCB on a VMEXIT. This hurts cross-vendor migration:
766 * Intel's VMENTRY has a check on the 'G' bit.
767 */
768 if (seg == VCPU_SREG_CS)
769 var->g = s->limit > 0xfffff;
770
771 /*
772 * Work around a bug where the busy flag in the tr selector
773 * isn't exposed
774 */
775 if (seg == VCPU_SREG_TR)
776 var->type |= 0x2;
777
775 var->unusable = !var->present; 778 var->unusable = !var->present;
776} 779}
777 780
@@ -1099,6 +1102,7 @@ static int io_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
1099 rep = (io_info & SVM_IOIO_REP_MASK) != 0; 1102 rep = (io_info & SVM_IOIO_REP_MASK) != 0;
1100 down = (svm->vmcb->save.rflags & X86_EFLAGS_DF) != 0; 1103 down = (svm->vmcb->save.rflags & X86_EFLAGS_DF) != 0;
1101 1104
1105 skip_emulated_instruction(&svm->vcpu);
1102 return kvm_emulate_pio(&svm->vcpu, kvm_run, in, size, port); 1106 return kvm_emulate_pio(&svm->vcpu, kvm_run, in, size, port);
1103} 1107}
1104 1108
@@ -1912,6 +1916,11 @@ static int get_npt_level(void)
1912#endif 1916#endif
1913} 1917}
1914 1918
1919static int svm_get_mt_mask_shift(void)
1920{
1921 return 0;
1922}
1923
1915static struct kvm_x86_ops svm_x86_ops = { 1924static struct kvm_x86_ops svm_x86_ops = {
1916 .cpu_has_kvm_support = has_svm, 1925 .cpu_has_kvm_support = has_svm,
1917 .disabled_by_bios = is_disabled, 1926 .disabled_by_bios = is_disabled,
@@ -1967,6 +1976,7 @@ static struct kvm_x86_ops svm_x86_ops = {
1967 1976
1968 .set_tss_addr = svm_set_tss_addr, 1977 .set_tss_addr = svm_set_tss_addr,
1969 .get_tdp_level = get_npt_level, 1978 .get_tdp_level = get_npt_level,
1979 .get_mt_mask_shift = svm_get_mt_mask_shift,
1970}; 1980};
1971 1981
1972static int __init svm_init(void) 1982static int __init svm_init(void)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index a4018b01e1f9..6259d7467648 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -16,7 +16,6 @@
16 */ 16 */
17 17
18#include "irq.h" 18#include "irq.h"
19#include "vmx.h"
20#include "mmu.h" 19#include "mmu.h"
21 20
22#include <linux/kvm_host.h> 21#include <linux/kvm_host.h>
@@ -31,6 +30,8 @@
31 30
32#include <asm/io.h> 31#include <asm/io.h>
33#include <asm/desc.h> 32#include <asm/desc.h>
33#include <asm/vmx.h>
34#include <asm/virtext.h>
34 35
35#define __ex(x) __kvm_handle_fault_on_reboot(x) 36#define __ex(x) __kvm_handle_fault_on_reboot(x)
36 37
@@ -90,6 +91,11 @@ struct vcpu_vmx {
90 } rmode; 91 } rmode;
91 int vpid; 92 int vpid;
92 bool emulation_required; 93 bool emulation_required;
94
95 /* Support for vnmi-less CPUs */
96 int soft_vnmi_blocked;
97 ktime_t entry_time;
98 s64 vnmi_blocked_time;
93}; 99};
94 100
95static inline struct vcpu_vmx *to_vmx(struct kvm_vcpu *vcpu) 101static inline struct vcpu_vmx *to_vmx(struct kvm_vcpu *vcpu)
@@ -122,7 +128,7 @@ static struct vmcs_config {
122 u32 vmentry_ctrl; 128 u32 vmentry_ctrl;
123} vmcs_config; 129} vmcs_config;
124 130
125struct vmx_capability { 131static struct vmx_capability {
126 u32 ept; 132 u32 ept;
127 u32 vpid; 133 u32 vpid;
128} vmx_capability; 134} vmx_capability;
@@ -957,6 +963,13 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
957 pr_unimpl(vcpu, "unimplemented perfctr wrmsr: 0x%x data 0x%llx\n", msr_index, data); 963 pr_unimpl(vcpu, "unimplemented perfctr wrmsr: 0x%x data 0x%llx\n", msr_index, data);
958 964
959 break; 965 break;
966 case MSR_IA32_CR_PAT:
967 if (vmcs_config.vmentry_ctrl & VM_ENTRY_LOAD_IA32_PAT) {
968 vmcs_write64(GUEST_IA32_PAT, data);
969 vcpu->arch.pat = data;
970 break;
971 }
972 /* Otherwise falls through to kvm_set_msr_common */
960 default: 973 default:
961 vmx_load_host_state(vmx); 974 vmx_load_host_state(vmx);
962 msr = find_msr_entry(vmx, msr_index); 975 msr = find_msr_entry(vmx, msr_index);
@@ -1032,8 +1045,7 @@ static int vmx_get_irq(struct kvm_vcpu *vcpu)
1032 1045
1033static __init int cpu_has_kvm_support(void) 1046static __init int cpu_has_kvm_support(void)
1034{ 1047{
1035 unsigned long ecx = cpuid_ecx(1); 1048 return cpu_has_vmx();
1036 return test_bit(5, &ecx); /* CPUID.1:ECX.VMX[bit 5] -> VT */
1037} 1049}
1038 1050
1039static __init int vmx_disabled_by_bios(void) 1051static __init int vmx_disabled_by_bios(void)
@@ -1079,13 +1091,22 @@ static void vmclear_local_vcpus(void)
1079 __vcpu_clear(vmx); 1091 __vcpu_clear(vmx);
1080} 1092}
1081 1093
1082static void hardware_disable(void *garbage) 1094
1095/* Just like cpu_vmxoff(), but with the __kvm_handle_fault_on_reboot()
1096 * tricks.
1097 */
1098static void kvm_cpu_vmxoff(void)
1083{ 1099{
1084 vmclear_local_vcpus();
1085 asm volatile (__ex(ASM_VMX_VMXOFF) : : : "cc"); 1100 asm volatile (__ex(ASM_VMX_VMXOFF) : : : "cc");
1086 write_cr4(read_cr4() & ~X86_CR4_VMXE); 1101 write_cr4(read_cr4() & ~X86_CR4_VMXE);
1087} 1102}
1088 1103
1104static void hardware_disable(void *garbage)
1105{
1106 vmclear_local_vcpus();
1107 kvm_cpu_vmxoff();
1108}
1109
1089static __init int adjust_vmx_controls(u32 ctl_min, u32 ctl_opt, 1110static __init int adjust_vmx_controls(u32 ctl_min, u32 ctl_opt,
1090 u32 msr, u32 *result) 1111 u32 msr, u32 *result)
1091{ 1112{
@@ -1176,12 +1197,13 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
1176#ifdef CONFIG_X86_64 1197#ifdef CONFIG_X86_64
1177 min |= VM_EXIT_HOST_ADDR_SPACE_SIZE; 1198 min |= VM_EXIT_HOST_ADDR_SPACE_SIZE;
1178#endif 1199#endif
1179 opt = 0; 1200 opt = VM_EXIT_SAVE_IA32_PAT | VM_EXIT_LOAD_IA32_PAT;
1180 if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_EXIT_CTLS, 1201 if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_EXIT_CTLS,
1181 &_vmexit_control) < 0) 1202 &_vmexit_control) < 0)
1182 return -EIO; 1203 return -EIO;
1183 1204
1184 min = opt = 0; 1205 min = 0;
1206 opt = VM_ENTRY_LOAD_IA32_PAT;
1185 if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_ENTRY_CTLS, 1207 if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_ENTRY_CTLS,
1186 &_vmentry_control) < 0) 1208 &_vmentry_control) < 0)
1187 return -EIO; 1209 return -EIO;
@@ -2087,8 +2109,9 @@ static void vmx_disable_intercept_for_msr(struct page *msr_bitmap, u32 msr)
2087 */ 2109 */
2088static int vmx_vcpu_setup(struct vcpu_vmx *vmx) 2110static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
2089{ 2111{
2090 u32 host_sysenter_cs; 2112 u32 host_sysenter_cs, msr_low, msr_high;
2091 u32 junk; 2113 u32 junk;
2114 u64 host_pat;
2092 unsigned long a; 2115 unsigned long a;
2093 struct descriptor_table dt; 2116 struct descriptor_table dt;
2094 int i; 2117 int i;
@@ -2176,6 +2199,20 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
2176 rdmsrl(MSR_IA32_SYSENTER_EIP, a); 2199 rdmsrl(MSR_IA32_SYSENTER_EIP, a);
2177 vmcs_writel(HOST_IA32_SYSENTER_EIP, a); /* 22.2.3 */ 2200 vmcs_writel(HOST_IA32_SYSENTER_EIP, a); /* 22.2.3 */
2178 2201
2202 if (vmcs_config.vmexit_ctrl & VM_EXIT_LOAD_IA32_PAT) {
2203 rdmsr(MSR_IA32_CR_PAT, msr_low, msr_high);
2204 host_pat = msr_low | ((u64) msr_high << 32);
2205 vmcs_write64(HOST_IA32_PAT, host_pat);
2206 }
2207 if (vmcs_config.vmentry_ctrl & VM_ENTRY_LOAD_IA32_PAT) {
2208 rdmsr(MSR_IA32_CR_PAT, msr_low, msr_high);
2209 host_pat = msr_low | ((u64) msr_high << 32);
2210 /* Write the default value follow host pat */
2211 vmcs_write64(GUEST_IA32_PAT, host_pat);
2212 /* Keep arch.pat sync with GUEST_IA32_PAT */
2213 vmx->vcpu.arch.pat = host_pat;
2214 }
2215
2179 for (i = 0; i < NR_VMX_MSR; ++i) { 2216 for (i = 0; i < NR_VMX_MSR; ++i) {
2180 u32 index = vmx_msr_index[i]; 2217 u32 index = vmx_msr_index[i];
2181 u32 data_low, data_high; 2218 u32 data_low, data_high;
@@ -2230,6 +2267,8 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu)
2230 2267
2231 vmx->vcpu.arch.rmode.active = 0; 2268 vmx->vcpu.arch.rmode.active = 0;
2232 2269
2270 vmx->soft_vnmi_blocked = 0;
2271
2233 vmx->vcpu.arch.regs[VCPU_REGS_RDX] = get_rdx_init_val(); 2272 vmx->vcpu.arch.regs[VCPU_REGS_RDX] = get_rdx_init_val();
2234 kvm_set_cr8(&vmx->vcpu, 0); 2273 kvm_set_cr8(&vmx->vcpu, 0);
2235 msr = 0xfee00000 | MSR_IA32_APICBASE_ENABLE; 2274 msr = 0xfee00000 | MSR_IA32_APICBASE_ENABLE;
@@ -2335,6 +2374,29 @@ out:
2335 return ret; 2374 return ret;
2336} 2375}
2337 2376
2377static void enable_irq_window(struct kvm_vcpu *vcpu)
2378{
2379 u32 cpu_based_vm_exec_control;
2380
2381 cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
2382 cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_INTR_PENDING;
2383 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control);
2384}
2385
2386static void enable_nmi_window(struct kvm_vcpu *vcpu)
2387{
2388 u32 cpu_based_vm_exec_control;
2389
2390 if (!cpu_has_virtual_nmis()) {
2391 enable_irq_window(vcpu);
2392 return;
2393 }
2394
2395 cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
2396 cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_NMI_PENDING;
2397 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control);
2398}
2399
2338static void vmx_inject_irq(struct kvm_vcpu *vcpu, int irq) 2400static void vmx_inject_irq(struct kvm_vcpu *vcpu, int irq)
2339{ 2401{
2340 struct vcpu_vmx *vmx = to_vmx(vcpu); 2402 struct vcpu_vmx *vmx = to_vmx(vcpu);
@@ -2358,10 +2420,54 @@ static void vmx_inject_irq(struct kvm_vcpu *vcpu, int irq)
2358 2420
2359static void vmx_inject_nmi(struct kvm_vcpu *vcpu) 2421static void vmx_inject_nmi(struct kvm_vcpu *vcpu)
2360{ 2422{
2423 struct vcpu_vmx *vmx = to_vmx(vcpu);
2424
2425 if (!cpu_has_virtual_nmis()) {
2426 /*
2427 * Tracking the NMI-blocked state in software is built upon
2428 * finding the next open IRQ window. This, in turn, depends on
2429 * well-behaving guests: They have to keep IRQs disabled at
2430 * least as long as the NMI handler runs. Otherwise we may
2431 * cause NMI nesting, maybe breaking the guest. But as this is
2432 * highly unlikely, we can live with the residual risk.
2433 */
2434 vmx->soft_vnmi_blocked = 1;
2435 vmx->vnmi_blocked_time = 0;
2436 }
2437
2438 ++vcpu->stat.nmi_injections;
2439 if (vcpu->arch.rmode.active) {
2440 vmx->rmode.irq.pending = true;
2441 vmx->rmode.irq.vector = NMI_VECTOR;
2442 vmx->rmode.irq.rip = kvm_rip_read(vcpu);
2443 vmcs_write32(VM_ENTRY_INTR_INFO_FIELD,
2444 NMI_VECTOR | INTR_TYPE_SOFT_INTR |
2445 INTR_INFO_VALID_MASK);
2446 vmcs_write32(VM_ENTRY_INSTRUCTION_LEN, 1);
2447 kvm_rip_write(vcpu, vmx->rmode.irq.rip - 1);
2448 return;
2449 }
2361 vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, 2450 vmcs_write32(VM_ENTRY_INTR_INFO_FIELD,
2362 INTR_TYPE_NMI_INTR | INTR_INFO_VALID_MASK | NMI_VECTOR); 2451 INTR_TYPE_NMI_INTR | INTR_INFO_VALID_MASK | NMI_VECTOR);
2363} 2452}
2364 2453
2454static void vmx_update_window_states(struct kvm_vcpu *vcpu)
2455{
2456 u32 guest_intr = vmcs_read32(GUEST_INTERRUPTIBILITY_INFO);
2457
2458 vcpu->arch.nmi_window_open =
2459 !(guest_intr & (GUEST_INTR_STATE_STI |
2460 GUEST_INTR_STATE_MOV_SS |
2461 GUEST_INTR_STATE_NMI));
2462 if (!cpu_has_virtual_nmis() && to_vmx(vcpu)->soft_vnmi_blocked)
2463 vcpu->arch.nmi_window_open = 0;
2464
2465 vcpu->arch.interrupt_window_open =
2466 ((vmcs_readl(GUEST_RFLAGS) & X86_EFLAGS_IF) &&
2467 !(guest_intr & (GUEST_INTR_STATE_STI |
2468 GUEST_INTR_STATE_MOV_SS)));
2469}
2470
2365static void kvm_do_inject_irq(struct kvm_vcpu *vcpu) 2471static void kvm_do_inject_irq(struct kvm_vcpu *vcpu)
2366{ 2472{
2367 int word_index = __ffs(vcpu->arch.irq_summary); 2473 int word_index = __ffs(vcpu->arch.irq_summary);
@@ -2374,40 +2480,49 @@ static void kvm_do_inject_irq(struct kvm_vcpu *vcpu)
2374 kvm_queue_interrupt(vcpu, irq); 2480 kvm_queue_interrupt(vcpu, irq);
2375} 2481}
2376 2482
2377
2378static void do_interrupt_requests(struct kvm_vcpu *vcpu, 2483static void do_interrupt_requests(struct kvm_vcpu *vcpu,
2379 struct kvm_run *kvm_run) 2484 struct kvm_run *kvm_run)
2380{ 2485{
2381 u32 cpu_based_vm_exec_control; 2486 vmx_update_window_states(vcpu);
2382
2383 vcpu->arch.interrupt_window_open =
2384 ((vmcs_readl(GUEST_RFLAGS) & X86_EFLAGS_IF) &&
2385 (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & 3) == 0);
2386 2487
2387 if (vcpu->arch.interrupt_window_open && 2488 if (vcpu->arch.nmi_pending && !vcpu->arch.nmi_injected) {
2388 vcpu->arch.irq_summary && !vcpu->arch.interrupt.pending) 2489 if (vcpu->arch.interrupt.pending) {
2389 kvm_do_inject_irq(vcpu); 2490 enable_nmi_window(vcpu);
2491 } else if (vcpu->arch.nmi_window_open) {
2492 vcpu->arch.nmi_pending = false;
2493 vcpu->arch.nmi_injected = true;
2494 } else {
2495 enable_nmi_window(vcpu);
2496 return;
2497 }
2498 }
2499 if (vcpu->arch.nmi_injected) {
2500 vmx_inject_nmi(vcpu);
2501 if (vcpu->arch.nmi_pending)
2502 enable_nmi_window(vcpu);
2503 else if (vcpu->arch.irq_summary
2504 || kvm_run->request_interrupt_window)
2505 enable_irq_window(vcpu);
2506 return;
2507 }
2390 2508
2391 if (vcpu->arch.interrupt_window_open && vcpu->arch.interrupt.pending) 2509 if (vcpu->arch.interrupt_window_open) {
2392 vmx_inject_irq(vcpu, vcpu->arch.interrupt.nr); 2510 if (vcpu->arch.irq_summary && !vcpu->arch.interrupt.pending)
2511 kvm_do_inject_irq(vcpu);
2393 2512
2394 cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL); 2513 if (vcpu->arch.interrupt.pending)
2514 vmx_inject_irq(vcpu, vcpu->arch.interrupt.nr);
2515 }
2395 if (!vcpu->arch.interrupt_window_open && 2516 if (!vcpu->arch.interrupt_window_open &&
2396 (vcpu->arch.irq_summary || kvm_run->request_interrupt_window)) 2517 (vcpu->arch.irq_summary || kvm_run->request_interrupt_window))
2397 /* 2518 enable_irq_window(vcpu);
2398 * Interrupts blocked. Wait for unblock.
2399 */
2400 cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_INTR_PENDING;
2401 else
2402 cpu_based_vm_exec_control &= ~CPU_BASED_VIRTUAL_INTR_PENDING;
2403 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control);
2404} 2519}
2405 2520
2406static int vmx_set_tss_addr(struct kvm *kvm, unsigned int addr) 2521static int vmx_set_tss_addr(struct kvm *kvm, unsigned int addr)
2407{ 2522{
2408 int ret; 2523 int ret;
2409 struct kvm_userspace_memory_region tss_mem = { 2524 struct kvm_userspace_memory_region tss_mem = {
2410 .slot = 8, 2525 .slot = TSS_PRIVATE_MEMSLOT,
2411 .guest_phys_addr = addr, 2526 .guest_phys_addr = addr,
2412 .memory_size = PAGE_SIZE * 3, 2527 .memory_size = PAGE_SIZE * 3,
2413 .flags = 0, 2528 .flags = 0,
@@ -2492,7 +2607,7 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
2492 set_bit(irq / BITS_PER_LONG, &vcpu->arch.irq_summary); 2607 set_bit(irq / BITS_PER_LONG, &vcpu->arch.irq_summary);
2493 } 2608 }
2494 2609
2495 if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == 0x200) /* nmi */ 2610 if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR)
2496 return 1; /* already handled by vmx_vcpu_run() */ 2611 return 1; /* already handled by vmx_vcpu_run() */
2497 2612
2498 if (is_no_device(intr_info)) { 2613 if (is_no_device(intr_info)) {
@@ -2581,6 +2696,7 @@ static int handle_io(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
2581 rep = (exit_qualification & 32) != 0; 2696 rep = (exit_qualification & 32) != 0;
2582 port = exit_qualification >> 16; 2697 port = exit_qualification >> 16;
2583 2698
2699 skip_emulated_instruction(vcpu);
2584 return kvm_emulate_pio(vcpu, kvm_run, in, size, port); 2700 return kvm_emulate_pio(vcpu, kvm_run, in, size, port);
2585} 2701}
2586 2702
@@ -2767,6 +2883,7 @@ static int handle_interrupt_window(struct kvm_vcpu *vcpu,
2767 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control); 2883 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control);
2768 2884
2769 KVMTRACE_0D(PEND_INTR, vcpu, handler); 2885 KVMTRACE_0D(PEND_INTR, vcpu, handler);
2886 ++vcpu->stat.irq_window_exits;
2770 2887
2771 /* 2888 /*
2772 * If the user space waits to inject interrupts, exit as soon as 2889 * If the user space waits to inject interrupts, exit as soon as
@@ -2775,7 +2892,6 @@ static int handle_interrupt_window(struct kvm_vcpu *vcpu,
2775 if (kvm_run->request_interrupt_window && 2892 if (kvm_run->request_interrupt_window &&
2776 !vcpu->arch.irq_summary) { 2893 !vcpu->arch.irq_summary) {
2777 kvm_run->exit_reason = KVM_EXIT_IRQ_WINDOW_OPEN; 2894 kvm_run->exit_reason = KVM_EXIT_IRQ_WINDOW_OPEN;
2778 ++vcpu->stat.irq_window_exits;
2779 return 0; 2895 return 0;
2780 } 2896 }
2781 return 1; 2897 return 1;
@@ -2832,6 +2948,7 @@ static int handle_apic_access(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
2832 2948
2833static int handle_task_switch(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) 2949static int handle_task_switch(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
2834{ 2950{
2951 struct vcpu_vmx *vmx = to_vmx(vcpu);
2835 unsigned long exit_qualification; 2952 unsigned long exit_qualification;
2836 u16 tss_selector; 2953 u16 tss_selector;
2837 int reason; 2954 int reason;
@@ -2839,6 +2956,15 @@ static int handle_task_switch(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
2839 exit_qualification = vmcs_readl(EXIT_QUALIFICATION); 2956 exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
2840 2957
2841 reason = (u32)exit_qualification >> 30; 2958 reason = (u32)exit_qualification >> 30;
2959 if (reason == TASK_SWITCH_GATE && vmx->vcpu.arch.nmi_injected &&
2960 (vmx->idt_vectoring_info & VECTORING_INFO_VALID_MASK) &&
2961 (vmx->idt_vectoring_info & VECTORING_INFO_TYPE_MASK)
2962 == INTR_TYPE_NMI_INTR) {
2963 vcpu->arch.nmi_injected = false;
2964 if (cpu_has_virtual_nmis())
2965 vmcs_set_bits(GUEST_INTERRUPTIBILITY_INFO,
2966 GUEST_INTR_STATE_NMI);
2967 }
2842 tss_selector = exit_qualification; 2968 tss_selector = exit_qualification;
2843 2969
2844 return kvm_task_switch(vcpu, tss_selector, reason); 2970 return kvm_task_switch(vcpu, tss_selector, reason);
@@ -2927,16 +3053,12 @@ static void handle_invalid_guest_state(struct kvm_vcpu *vcpu,
2927 while (!guest_state_valid(vcpu)) { 3053 while (!guest_state_valid(vcpu)) {
2928 err = emulate_instruction(vcpu, kvm_run, 0, 0, 0); 3054 err = emulate_instruction(vcpu, kvm_run, 0, 0, 0);
2929 3055
2930 switch (err) { 3056 if (err == EMULATE_DO_MMIO)
2931 case EMULATE_DONE: 3057 break;
2932 break; 3058
2933 case EMULATE_DO_MMIO: 3059 if (err != EMULATE_DONE) {
2934 kvm_report_emulation_failure(vcpu, "mmio"); 3060 kvm_report_emulation_failure(vcpu, "emulation failure");
2935 /* TODO: Handle MMIO */ 3061 return;
2936 return;
2937 default:
2938 kvm_report_emulation_failure(vcpu, "emulation failure");
2939 return;
2940 } 3062 }
2941 3063
2942 if (signal_pending(current)) 3064 if (signal_pending(current))
@@ -2948,8 +3070,10 @@ static void handle_invalid_guest_state(struct kvm_vcpu *vcpu,
2948 local_irq_disable(); 3070 local_irq_disable();
2949 preempt_disable(); 3071 preempt_disable();
2950 3072
2951 /* Guest state should be valid now, no more emulation should be needed */ 3073 /* Guest state should be valid now except if we need to
2952 vmx->emulation_required = 0; 3074 * emulate an MMIO */
3075 if (guest_state_valid(vcpu))
3076 vmx->emulation_required = 0;
2953} 3077}
2954 3078
2955/* 3079/*
@@ -2996,6 +3120,11 @@ static int kvm_handle_exit(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
2996 KVMTRACE_3D(VMEXIT, vcpu, exit_reason, (u32)kvm_rip_read(vcpu), 3120 KVMTRACE_3D(VMEXIT, vcpu, exit_reason, (u32)kvm_rip_read(vcpu),
2997 (u32)((u64)kvm_rip_read(vcpu) >> 32), entryexit); 3121 (u32)((u64)kvm_rip_read(vcpu) >> 32), entryexit);
2998 3122
3123 /* If we need to emulate an MMIO from handle_invalid_guest_state
3124 * we just return 0 */
3125 if (vmx->emulation_required && emulate_invalid_guest_state)
3126 return 0;
3127
2999 /* Access CR3 don't cause VMExit in paging mode, so we need 3128 /* Access CR3 don't cause VMExit in paging mode, so we need
3000 * to sync with guest real CR3. */ 3129 * to sync with guest real CR3. */
3001 if (vm_need_ept() && is_paging(vcpu)) { 3130 if (vm_need_ept() && is_paging(vcpu)) {
@@ -3012,9 +3141,32 @@ static int kvm_handle_exit(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
3012 3141
3013 if ((vectoring_info & VECTORING_INFO_VALID_MASK) && 3142 if ((vectoring_info & VECTORING_INFO_VALID_MASK) &&
3014 (exit_reason != EXIT_REASON_EXCEPTION_NMI && 3143 (exit_reason != EXIT_REASON_EXCEPTION_NMI &&
3015 exit_reason != EXIT_REASON_EPT_VIOLATION)) 3144 exit_reason != EXIT_REASON_EPT_VIOLATION &&
3016 printk(KERN_WARNING "%s: unexpected, valid vectoring info and " 3145 exit_reason != EXIT_REASON_TASK_SWITCH))
3017 "exit reason is 0x%x\n", __func__, exit_reason); 3146 printk(KERN_WARNING "%s: unexpected, valid vectoring info "
3147 "(0x%x) and exit reason is 0x%x\n",
3148 __func__, vectoring_info, exit_reason);
3149
3150 if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked)) {
3151 if (vcpu->arch.interrupt_window_open) {
3152 vmx->soft_vnmi_blocked = 0;
3153 vcpu->arch.nmi_window_open = 1;
3154 } else if (vmx->vnmi_blocked_time > 1000000000LL &&
3155 vcpu->arch.nmi_pending) {
3156 /*
3157 * This CPU don't support us in finding the end of an
3158 * NMI-blocked window if the guest runs with IRQs
3159 * disabled. So we pull the trigger after 1 s of
3160 * futile waiting, but inform the user about this.
3161 */
3162 printk(KERN_WARNING "%s: Breaking out of NMI-blocked "
3163 "state on VCPU %d after 1 s timeout\n",
3164 __func__, vcpu->vcpu_id);
3165 vmx->soft_vnmi_blocked = 0;
3166 vmx->vcpu.arch.nmi_window_open = 1;
3167 }
3168 }
3169
3018 if (exit_reason < kvm_vmx_max_exit_handlers 3170 if (exit_reason < kvm_vmx_max_exit_handlers
3019 && kvm_vmx_exit_handlers[exit_reason]) 3171 && kvm_vmx_exit_handlers[exit_reason])
3020 return kvm_vmx_exit_handlers[exit_reason](vcpu, kvm_run); 3172 return kvm_vmx_exit_handlers[exit_reason](vcpu, kvm_run);
@@ -3042,51 +3194,6 @@ static void update_tpr_threshold(struct kvm_vcpu *vcpu)
3042 vmcs_write32(TPR_THRESHOLD, (max_irr > tpr) ? tpr >> 4 : max_irr >> 4); 3194 vmcs_write32(TPR_THRESHOLD, (max_irr > tpr) ? tpr >> 4 : max_irr >> 4);
3043} 3195}
3044 3196
3045static void enable_irq_window(struct kvm_vcpu *vcpu)
3046{
3047 u32 cpu_based_vm_exec_control;
3048
3049 cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
3050 cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_INTR_PENDING;
3051 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control);
3052}
3053
3054static void enable_nmi_window(struct kvm_vcpu *vcpu)
3055{
3056 u32 cpu_based_vm_exec_control;
3057
3058 if (!cpu_has_virtual_nmis())
3059 return;
3060
3061 cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
3062 cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_NMI_PENDING;
3063 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control);
3064}
3065
3066static int vmx_nmi_enabled(struct kvm_vcpu *vcpu)
3067{
3068 u32 guest_intr = vmcs_read32(GUEST_INTERRUPTIBILITY_INFO);
3069 return !(guest_intr & (GUEST_INTR_STATE_NMI |
3070 GUEST_INTR_STATE_MOV_SS |
3071 GUEST_INTR_STATE_STI));
3072}
3073
3074static int vmx_irq_enabled(struct kvm_vcpu *vcpu)
3075{
3076 u32 guest_intr = vmcs_read32(GUEST_INTERRUPTIBILITY_INFO);
3077 return (!(guest_intr & (GUEST_INTR_STATE_MOV_SS |
3078 GUEST_INTR_STATE_STI)) &&
3079 (vmcs_readl(GUEST_RFLAGS) & X86_EFLAGS_IF));
3080}
3081
3082static void enable_intr_window(struct kvm_vcpu *vcpu)
3083{
3084 if (vcpu->arch.nmi_pending)
3085 enable_nmi_window(vcpu);
3086 else if (kvm_cpu_has_interrupt(vcpu))
3087 enable_irq_window(vcpu);
3088}
3089
3090static void vmx_complete_interrupts(struct vcpu_vmx *vmx) 3197static void vmx_complete_interrupts(struct vcpu_vmx *vmx)
3091{ 3198{
3092 u32 exit_intr_info; 3199 u32 exit_intr_info;
@@ -3109,7 +3216,9 @@ static void vmx_complete_interrupts(struct vcpu_vmx *vmx)
3109 if (unblock_nmi && vector != DF_VECTOR) 3216 if (unblock_nmi && vector != DF_VECTOR)
3110 vmcs_set_bits(GUEST_INTERRUPTIBILITY_INFO, 3217 vmcs_set_bits(GUEST_INTERRUPTIBILITY_INFO,
3111 GUEST_INTR_STATE_NMI); 3218 GUEST_INTR_STATE_NMI);
3112 } 3219 } else if (unlikely(vmx->soft_vnmi_blocked))
3220 vmx->vnmi_blocked_time +=
3221 ktime_to_ns(ktime_sub(ktime_get(), vmx->entry_time));
3113 3222
3114 idt_vectoring_info = vmx->idt_vectoring_info; 3223 idt_vectoring_info = vmx->idt_vectoring_info;
3115 idtv_info_valid = idt_vectoring_info & VECTORING_INFO_VALID_MASK; 3224 idtv_info_valid = idt_vectoring_info & VECTORING_INFO_VALID_MASK;
@@ -3147,26 +3256,29 @@ static void vmx_intr_assist(struct kvm_vcpu *vcpu)
3147{ 3256{
3148 update_tpr_threshold(vcpu); 3257 update_tpr_threshold(vcpu);
3149 3258
3150 if (cpu_has_virtual_nmis()) { 3259 vmx_update_window_states(vcpu);
3151 if (vcpu->arch.nmi_pending && !vcpu->arch.nmi_injected) { 3260
3152 if (vcpu->arch.interrupt.pending) { 3261 if (vcpu->arch.nmi_pending && !vcpu->arch.nmi_injected) {
3153 enable_nmi_window(vcpu); 3262 if (vcpu->arch.interrupt.pending) {
3154 } else if (vmx_nmi_enabled(vcpu)) { 3263 enable_nmi_window(vcpu);
3155 vcpu->arch.nmi_pending = false; 3264 } else if (vcpu->arch.nmi_window_open) {
3156 vcpu->arch.nmi_injected = true; 3265 vcpu->arch.nmi_pending = false;
3157 } else { 3266 vcpu->arch.nmi_injected = true;
3158 enable_intr_window(vcpu); 3267 } else {
3159 return; 3268 enable_nmi_window(vcpu);
3160 }
3161 }
3162 if (vcpu->arch.nmi_injected) {
3163 vmx_inject_nmi(vcpu);
3164 enable_intr_window(vcpu);
3165 return; 3269 return;
3166 } 3270 }
3167 } 3271 }
3272 if (vcpu->arch.nmi_injected) {
3273 vmx_inject_nmi(vcpu);
3274 if (vcpu->arch.nmi_pending)
3275 enable_nmi_window(vcpu);
3276 else if (kvm_cpu_has_interrupt(vcpu))
3277 enable_irq_window(vcpu);
3278 return;
3279 }
3168 if (!vcpu->arch.interrupt.pending && kvm_cpu_has_interrupt(vcpu)) { 3280 if (!vcpu->arch.interrupt.pending && kvm_cpu_has_interrupt(vcpu)) {
3169 if (vmx_irq_enabled(vcpu)) 3281 if (vcpu->arch.interrupt_window_open)
3170 kvm_queue_interrupt(vcpu, kvm_cpu_get_interrupt(vcpu)); 3282 kvm_queue_interrupt(vcpu, kvm_cpu_get_interrupt(vcpu));
3171 else 3283 else
3172 enable_irq_window(vcpu); 3284 enable_irq_window(vcpu);
@@ -3174,6 +3286,8 @@ static void vmx_intr_assist(struct kvm_vcpu *vcpu)
3174 if (vcpu->arch.interrupt.pending) { 3286 if (vcpu->arch.interrupt.pending) {
3175 vmx_inject_irq(vcpu, vcpu->arch.interrupt.nr); 3287 vmx_inject_irq(vcpu, vcpu->arch.interrupt.nr);
3176 kvm_timer_intr_post(vcpu, vcpu->arch.interrupt.nr); 3288 kvm_timer_intr_post(vcpu, vcpu->arch.interrupt.nr);
3289 if (kvm_cpu_has_interrupt(vcpu))
3290 enable_irq_window(vcpu);
3177 } 3291 }
3178} 3292}
3179 3293
@@ -3213,6 +3327,10 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
3213 struct vcpu_vmx *vmx = to_vmx(vcpu); 3327 struct vcpu_vmx *vmx = to_vmx(vcpu);
3214 u32 intr_info; 3328 u32 intr_info;
3215 3329
3330 /* Record the guest's net vcpu time for enforced NMI injections. */
3331 if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked))
3332 vmx->entry_time = ktime_get();
3333
3216 /* Handle invalid guest state instead of entering VMX */ 3334 /* Handle invalid guest state instead of entering VMX */
3217 if (vmx->emulation_required && emulate_invalid_guest_state) { 3335 if (vmx->emulation_required && emulate_invalid_guest_state) {
3218 handle_invalid_guest_state(vcpu, kvm_run); 3336 handle_invalid_guest_state(vcpu, kvm_run);
@@ -3327,9 +3445,7 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
3327 if (vmx->rmode.irq.pending) 3445 if (vmx->rmode.irq.pending)
3328 fixup_rmode_irq(vmx); 3446 fixup_rmode_irq(vmx);
3329 3447
3330 vcpu->arch.interrupt_window_open = 3448 vmx_update_window_states(vcpu);
3331 (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) &
3332 (GUEST_INTR_STATE_STI | GUEST_INTR_STATE_MOV_SS)) == 0;
3333 3449
3334 asm("mov %0, %%ds; mov %0, %%es" : : "r"(__USER_DS)); 3450 asm("mov %0, %%ds; mov %0, %%es" : : "r"(__USER_DS));
3335 vmx->launched = 1; 3451 vmx->launched = 1;
@@ -3337,7 +3453,7 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
3337 intr_info = vmcs_read32(VM_EXIT_INTR_INFO); 3453 intr_info = vmcs_read32(VM_EXIT_INTR_INFO);
3338 3454
3339 /* We need to handle NMIs before interrupts are enabled */ 3455 /* We need to handle NMIs before interrupts are enabled */
3340 if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == 0x200 && 3456 if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR &&
3341 (intr_info & INTR_INFO_VALID_MASK)) { 3457 (intr_info & INTR_INFO_VALID_MASK)) {
3342 KVMTRACE_0D(NMI, vcpu, handler); 3458 KVMTRACE_0D(NMI, vcpu, handler);
3343 asm("int $2"); 3459 asm("int $2");
@@ -3455,6 +3571,11 @@ static int get_ept_level(void)
3455 return VMX_EPT_DEFAULT_GAW + 1; 3571 return VMX_EPT_DEFAULT_GAW + 1;
3456} 3572}
3457 3573
3574static int vmx_get_mt_mask_shift(void)
3575{
3576 return VMX_EPT_MT_EPTE_SHIFT;
3577}
3578
3458static struct kvm_x86_ops vmx_x86_ops = { 3579static struct kvm_x86_ops vmx_x86_ops = {
3459 .cpu_has_kvm_support = cpu_has_kvm_support, 3580 .cpu_has_kvm_support = cpu_has_kvm_support,
3460 .disabled_by_bios = vmx_disabled_by_bios, 3581 .disabled_by_bios = vmx_disabled_by_bios,
@@ -3510,6 +3631,7 @@ static struct kvm_x86_ops vmx_x86_ops = {
3510 3631
3511 .set_tss_addr = vmx_set_tss_addr, 3632 .set_tss_addr = vmx_set_tss_addr,
3512 .get_tdp_level = get_ept_level, 3633 .get_tdp_level = get_ept_level,
3634 .get_mt_mask_shift = vmx_get_mt_mask_shift,
3513}; 3635};
3514 3636
3515static int __init vmx_init(void) 3637static int __init vmx_init(void)
@@ -3566,10 +3688,10 @@ static int __init vmx_init(void)
3566 bypass_guest_pf = 0; 3688 bypass_guest_pf = 0;
3567 kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK | 3689 kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK |
3568 VMX_EPT_WRITABLE_MASK | 3690 VMX_EPT_WRITABLE_MASK |
3569 VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT |
3570 VMX_EPT_IGMT_BIT); 3691 VMX_EPT_IGMT_BIT);
3571 kvm_mmu_set_mask_ptes(0ull, 0ull, 0ull, 0ull, 3692 kvm_mmu_set_mask_ptes(0ull, 0ull, 0ull, 0ull,
3572 VMX_EPT_EXECUTABLE_MASK); 3693 VMX_EPT_EXECUTABLE_MASK,
3694 VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT);
3573 kvm_enable_tdp(); 3695 kvm_enable_tdp();
3574 } else 3696 } else
3575 kvm_disable_tdp(); 3697 kvm_disable_tdp();
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index f1f8ff2f1fa2..cc17546a2406 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -34,11 +34,13 @@
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/mman.h> 35#include <linux/mman.h>
36#include <linux/highmem.h> 36#include <linux/highmem.h>
37#include <linux/iommu.h>
37#include <linux/intel-iommu.h> 38#include <linux/intel-iommu.h>
38 39
39#include <asm/uaccess.h> 40#include <asm/uaccess.h>
40#include <asm/msr.h> 41#include <asm/msr.h>
41#include <asm/desc.h> 42#include <asm/desc.h>
43#include <asm/mtrr.h>
42 44
43#define MAX_IO_MSRS 256 45#define MAX_IO_MSRS 256
44#define CR0_RESERVED_BITS \ 46#define CR0_RESERVED_BITS \
@@ -86,6 +88,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
86 { "halt_wakeup", VCPU_STAT(halt_wakeup) }, 88 { "halt_wakeup", VCPU_STAT(halt_wakeup) },
87 { "hypercalls", VCPU_STAT(hypercalls) }, 89 { "hypercalls", VCPU_STAT(hypercalls) },
88 { "request_irq", VCPU_STAT(request_irq_exits) }, 90 { "request_irq", VCPU_STAT(request_irq_exits) },
91 { "request_nmi", VCPU_STAT(request_nmi_exits) },
89 { "irq_exits", VCPU_STAT(irq_exits) }, 92 { "irq_exits", VCPU_STAT(irq_exits) },
90 { "host_state_reload", VCPU_STAT(host_state_reload) }, 93 { "host_state_reload", VCPU_STAT(host_state_reload) },
91 { "efer_reload", VCPU_STAT(efer_reload) }, 94 { "efer_reload", VCPU_STAT(efer_reload) },
@@ -93,6 +96,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
93 { "insn_emulation", VCPU_STAT(insn_emulation) }, 96 { "insn_emulation", VCPU_STAT(insn_emulation) },
94 { "insn_emulation_fail", VCPU_STAT(insn_emulation_fail) }, 97 { "insn_emulation_fail", VCPU_STAT(insn_emulation_fail) },
95 { "irq_injections", VCPU_STAT(irq_injections) }, 98 { "irq_injections", VCPU_STAT(irq_injections) },
99 { "nmi_injections", VCPU_STAT(nmi_injections) },
96 { "mmu_shadow_zapped", VM_STAT(mmu_shadow_zapped) }, 100 { "mmu_shadow_zapped", VM_STAT(mmu_shadow_zapped) },
97 { "mmu_pte_write", VM_STAT(mmu_pte_write) }, 101 { "mmu_pte_write", VM_STAT(mmu_pte_write) },
98 { "mmu_pte_updated", VM_STAT(mmu_pte_updated) }, 102 { "mmu_pte_updated", VM_STAT(mmu_pte_updated) },
@@ -101,6 +105,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
101 { "mmu_recycled", VM_STAT(mmu_recycled) }, 105 { "mmu_recycled", VM_STAT(mmu_recycled) },
102 { "mmu_cache_miss", VM_STAT(mmu_cache_miss) }, 106 { "mmu_cache_miss", VM_STAT(mmu_cache_miss) },
103 { "mmu_unsync", VM_STAT(mmu_unsync) }, 107 { "mmu_unsync", VM_STAT(mmu_unsync) },
108 { "mmu_unsync_global", VM_STAT(mmu_unsync_global) },
104 { "remote_tlb_flush", VM_STAT(remote_tlb_flush) }, 109 { "remote_tlb_flush", VM_STAT(remote_tlb_flush) },
105 { "largepages", VM_STAT(lpages) }, 110 { "largepages", VM_STAT(lpages) },
106 { NULL } 111 { NULL }
@@ -312,6 +317,7 @@ void kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0)
312 kvm_x86_ops->set_cr0(vcpu, cr0); 317 kvm_x86_ops->set_cr0(vcpu, cr0);
313 vcpu->arch.cr0 = cr0; 318 vcpu->arch.cr0 = cr0;
314 319
320 kvm_mmu_sync_global(vcpu);
315 kvm_mmu_reset_context(vcpu); 321 kvm_mmu_reset_context(vcpu);
316 return; 322 return;
317} 323}
@@ -355,6 +361,7 @@ void kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
355 } 361 }
356 kvm_x86_ops->set_cr4(vcpu, cr4); 362 kvm_x86_ops->set_cr4(vcpu, cr4);
357 vcpu->arch.cr4 = cr4; 363 vcpu->arch.cr4 = cr4;
364 kvm_mmu_sync_global(vcpu);
358 kvm_mmu_reset_context(vcpu); 365 kvm_mmu_reset_context(vcpu);
359} 366}
360EXPORT_SYMBOL_GPL(kvm_set_cr4); 367EXPORT_SYMBOL_GPL(kvm_set_cr4);
@@ -449,7 +456,7 @@ static u32 msrs_to_save[] = {
449 MSR_CSTAR, MSR_KERNEL_GS_BASE, MSR_SYSCALL_MASK, MSR_LSTAR, 456 MSR_CSTAR, MSR_KERNEL_GS_BASE, MSR_SYSCALL_MASK, MSR_LSTAR,
450#endif 457#endif
451 MSR_IA32_TIME_STAMP_COUNTER, MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK, 458 MSR_IA32_TIME_STAMP_COUNTER, MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK,
452 MSR_IA32_PERF_STATUS, 459 MSR_IA32_PERF_STATUS, MSR_IA32_CR_PAT
453}; 460};
454 461
455static unsigned num_msrs_to_save; 462static unsigned num_msrs_to_save;
@@ -648,10 +655,38 @@ static bool msr_mtrr_valid(unsigned msr)
648 655
649static int set_msr_mtrr(struct kvm_vcpu *vcpu, u32 msr, u64 data) 656static int set_msr_mtrr(struct kvm_vcpu *vcpu, u32 msr, u64 data)
650{ 657{
658 u64 *p = (u64 *)&vcpu->arch.mtrr_state.fixed_ranges;
659
651 if (!msr_mtrr_valid(msr)) 660 if (!msr_mtrr_valid(msr))
652 return 1; 661 return 1;
653 662
654 vcpu->arch.mtrr[msr - 0x200] = data; 663 if (msr == MSR_MTRRdefType) {
664 vcpu->arch.mtrr_state.def_type = data;
665 vcpu->arch.mtrr_state.enabled = (data & 0xc00) >> 10;
666 } else if (msr == MSR_MTRRfix64K_00000)
667 p[0] = data;
668 else if (msr == MSR_MTRRfix16K_80000 || msr == MSR_MTRRfix16K_A0000)
669 p[1 + msr - MSR_MTRRfix16K_80000] = data;
670 else if (msr >= MSR_MTRRfix4K_C0000 && msr <= MSR_MTRRfix4K_F8000)
671 p[3 + msr - MSR_MTRRfix4K_C0000] = data;
672 else if (msr == MSR_IA32_CR_PAT)
673 vcpu->arch.pat = data;
674 else { /* Variable MTRRs */
675 int idx, is_mtrr_mask;
676 u64 *pt;
677
678 idx = (msr - 0x200) / 2;
679 is_mtrr_mask = msr - 0x200 - 2 * idx;
680 if (!is_mtrr_mask)
681 pt =
682 (u64 *)&vcpu->arch.mtrr_state.var_ranges[idx].base_lo;
683 else
684 pt =
685 (u64 *)&vcpu->arch.mtrr_state.var_ranges[idx].mask_lo;
686 *pt = data;
687 }
688
689 kvm_mmu_reset_context(vcpu);
655 return 0; 690 return 0;
656} 691}
657 692
@@ -747,10 +782,37 @@ int kvm_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
747 782
748static int get_msr_mtrr(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata) 783static int get_msr_mtrr(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
749{ 784{
785 u64 *p = (u64 *)&vcpu->arch.mtrr_state.fixed_ranges;
786
750 if (!msr_mtrr_valid(msr)) 787 if (!msr_mtrr_valid(msr))
751 return 1; 788 return 1;
752 789
753 *pdata = vcpu->arch.mtrr[msr - 0x200]; 790 if (msr == MSR_MTRRdefType)
791 *pdata = vcpu->arch.mtrr_state.def_type +
792 (vcpu->arch.mtrr_state.enabled << 10);
793 else if (msr == MSR_MTRRfix64K_00000)
794 *pdata = p[0];
795 else if (msr == MSR_MTRRfix16K_80000 || msr == MSR_MTRRfix16K_A0000)
796 *pdata = p[1 + msr - MSR_MTRRfix16K_80000];
797 else if (msr >= MSR_MTRRfix4K_C0000 && msr <= MSR_MTRRfix4K_F8000)
798 *pdata = p[3 + msr - MSR_MTRRfix4K_C0000];
799 else if (msr == MSR_IA32_CR_PAT)
800 *pdata = vcpu->arch.pat;
801 else { /* Variable MTRRs */
802 int idx, is_mtrr_mask;
803 u64 *pt;
804
805 idx = (msr - 0x200) / 2;
806 is_mtrr_mask = msr - 0x200 - 2 * idx;
807 if (!is_mtrr_mask)
808 pt =
809 (u64 *)&vcpu->arch.mtrr_state.var_ranges[idx].base_lo;
810 else
811 pt =
812 (u64 *)&vcpu->arch.mtrr_state.var_ranges[idx].mask_lo;
813 *pdata = *pt;
814 }
815
754 return 0; 816 return 0;
755} 817}
756 818
@@ -903,7 +965,6 @@ int kvm_dev_ioctl_check_extension(long ext)
903 case KVM_CAP_IRQCHIP: 965 case KVM_CAP_IRQCHIP:
904 case KVM_CAP_HLT: 966 case KVM_CAP_HLT:
905 case KVM_CAP_MMU_SHADOW_CACHE_CONTROL: 967 case KVM_CAP_MMU_SHADOW_CACHE_CONTROL:
906 case KVM_CAP_USER_MEMORY:
907 case KVM_CAP_SET_TSS_ADDR: 968 case KVM_CAP_SET_TSS_ADDR:
908 case KVM_CAP_EXT_CPUID: 969 case KVM_CAP_EXT_CPUID:
909 case KVM_CAP_CLOCKSOURCE: 970 case KVM_CAP_CLOCKSOURCE:
@@ -929,7 +990,7 @@ int kvm_dev_ioctl_check_extension(long ext)
929 r = !tdp_enabled; 990 r = !tdp_enabled;
930 break; 991 break;
931 case KVM_CAP_IOMMU: 992 case KVM_CAP_IOMMU:
932 r = intel_iommu_found(); 993 r = iommu_found();
933 break; 994 break;
934 default: 995 default:
935 r = 0; 996 r = 0;
@@ -1188,6 +1249,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
1188 int t, times = entry->eax & 0xff; 1249 int t, times = entry->eax & 0xff;
1189 1250
1190 entry->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC; 1251 entry->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC;
1252 entry->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT;
1191 for (t = 1; t < times && *nent < maxnent; ++t) { 1253 for (t = 1; t < times && *nent < maxnent; ++t) {
1192 do_cpuid_1_ent(&entry[t], function, 0); 1254 do_cpuid_1_ent(&entry[t], function, 0);
1193 entry[t].flags |= KVM_CPUID_FLAG_STATEFUL_FUNC; 1255 entry[t].flags |= KVM_CPUID_FLAG_STATEFUL_FUNC;
@@ -1218,7 +1280,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
1218 entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX; 1280 entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
1219 /* read more entries until level_type is zero */ 1281 /* read more entries until level_type is zero */
1220 for (i = 1; *nent < maxnent; ++i) { 1282 for (i = 1; *nent < maxnent; ++i) {
1221 level_type = entry[i - 1].ecx & 0xff; 1283 level_type = entry[i - 1].ecx & 0xff00;
1222 if (!level_type) 1284 if (!level_type)
1223 break; 1285 break;
1224 do_cpuid_1_ent(&entry[i], function, i); 1286 do_cpuid_1_ent(&entry[i], function, i);
@@ -1318,6 +1380,15 @@ static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu,
1318 return 0; 1380 return 0;
1319} 1381}
1320 1382
1383static int kvm_vcpu_ioctl_nmi(struct kvm_vcpu *vcpu)
1384{
1385 vcpu_load(vcpu);
1386 kvm_inject_nmi(vcpu);
1387 vcpu_put(vcpu);
1388
1389 return 0;
1390}
1391
1321static int vcpu_ioctl_tpr_access_reporting(struct kvm_vcpu *vcpu, 1392static int vcpu_ioctl_tpr_access_reporting(struct kvm_vcpu *vcpu,
1322 struct kvm_tpr_access_ctl *tac) 1393 struct kvm_tpr_access_ctl *tac)
1323{ 1394{
@@ -1377,6 +1448,13 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
1377 r = 0; 1448 r = 0;
1378 break; 1449 break;
1379 } 1450 }
1451 case KVM_NMI: {
1452 r = kvm_vcpu_ioctl_nmi(vcpu);
1453 if (r)
1454 goto out;
1455 r = 0;
1456 break;
1457 }
1380 case KVM_SET_CPUID: { 1458 case KVM_SET_CPUID: {
1381 struct kvm_cpuid __user *cpuid_arg = argp; 1459 struct kvm_cpuid __user *cpuid_arg = argp;
1382 struct kvm_cpuid cpuid; 1460 struct kvm_cpuid cpuid;
@@ -1968,7 +2046,7 @@ int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa,
1968 ret = kvm_write_guest(vcpu->kvm, gpa, val, bytes); 2046 ret = kvm_write_guest(vcpu->kvm, gpa, val, bytes);
1969 if (ret < 0) 2047 if (ret < 0)
1970 return 0; 2048 return 0;
1971 kvm_mmu_pte_write(vcpu, gpa, val, bytes); 2049 kvm_mmu_pte_write(vcpu, gpa, val, bytes, 1);
1972 return 1; 2050 return 1;
1973} 2051}
1974 2052
@@ -2404,8 +2482,6 @@ int kvm_emulate_pio(struct kvm_vcpu *vcpu, struct kvm_run *run, int in,
2404 val = kvm_register_read(vcpu, VCPU_REGS_RAX); 2482 val = kvm_register_read(vcpu, VCPU_REGS_RAX);
2405 memcpy(vcpu->arch.pio_data, &val, 4); 2483 memcpy(vcpu->arch.pio_data, &val, 4);
2406 2484
2407 kvm_x86_ops->skip_emulated_instruction(vcpu);
2408
2409 pio_dev = vcpu_find_pio_dev(vcpu, port, size, !in); 2485 pio_dev = vcpu_find_pio_dev(vcpu, port, size, !in);
2410 if (pio_dev) { 2486 if (pio_dev) {
2411 kernel_pio(pio_dev, vcpu, vcpu->arch.pio_data); 2487 kernel_pio(pio_dev, vcpu, vcpu->arch.pio_data);
@@ -2541,7 +2617,7 @@ int kvm_arch_init(void *opaque)
2541 kvm_mmu_set_nonpresent_ptes(0ull, 0ull); 2617 kvm_mmu_set_nonpresent_ptes(0ull, 0ull);
2542 kvm_mmu_set_base_ptes(PT_PRESENT_MASK); 2618 kvm_mmu_set_base_ptes(PT_PRESENT_MASK);
2543 kvm_mmu_set_mask_ptes(PT_USER_MASK, PT_ACCESSED_MASK, 2619 kvm_mmu_set_mask_ptes(PT_USER_MASK, PT_ACCESSED_MASK,
2544 PT_DIRTY_MASK, PT64_NX_MASK, 0); 2620 PT_DIRTY_MASK, PT64_NX_MASK, 0, 0);
2545 return 0; 2621 return 0;
2546 2622
2547out: 2623out:
@@ -2729,7 +2805,7 @@ static int move_to_next_stateful_cpuid_entry(struct kvm_vcpu *vcpu, int i)
2729 2805
2730 e->flags &= ~KVM_CPUID_FLAG_STATE_READ_NEXT; 2806 e->flags &= ~KVM_CPUID_FLAG_STATE_READ_NEXT;
2731 /* when no next entry is found, the current entry[i] is reselected */ 2807 /* when no next entry is found, the current entry[i] is reselected */
2732 for (j = i + 1; j == i; j = (j + 1) % nent) { 2808 for (j = i + 1; ; j = (j + 1) % nent) {
2733 struct kvm_cpuid_entry2 *ej = &vcpu->arch.cpuid_entries[j]; 2809 struct kvm_cpuid_entry2 *ej = &vcpu->arch.cpuid_entries[j];
2734 if (ej->function == e->function) { 2810 if (ej->function == e->function) {
2735 ej->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT; 2811 ej->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT;
@@ -2973,7 +3049,7 @@ static int __vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
2973 pr_debug("vcpu %d received sipi with vector # %x\n", 3049 pr_debug("vcpu %d received sipi with vector # %x\n",
2974 vcpu->vcpu_id, vcpu->arch.sipi_vector); 3050 vcpu->vcpu_id, vcpu->arch.sipi_vector);
2975 kvm_lapic_reset(vcpu); 3051 kvm_lapic_reset(vcpu);
2976 r = kvm_x86_ops->vcpu_reset(vcpu); 3052 r = kvm_arch_vcpu_reset(vcpu);
2977 if (r) 3053 if (r)
2978 return r; 3054 return r;
2979 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; 3055 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
@@ -3275,9 +3351,9 @@ static void seg_desct_to_kvm_desct(struct desc_struct *seg_desc, u16 selector,
3275 kvm_desct->padding = 0; 3351 kvm_desct->padding = 0;
3276} 3352}
3277 3353
3278static void get_segment_descritptor_dtable(struct kvm_vcpu *vcpu, 3354static void get_segment_descriptor_dtable(struct kvm_vcpu *vcpu,
3279 u16 selector, 3355 u16 selector,
3280 struct descriptor_table *dtable) 3356 struct descriptor_table *dtable)
3281{ 3357{
3282 if (selector & 1 << 2) { 3358 if (selector & 1 << 2) {
3283 struct kvm_segment kvm_seg; 3359 struct kvm_segment kvm_seg;
@@ -3302,7 +3378,7 @@ static int load_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
3302 struct descriptor_table dtable; 3378 struct descriptor_table dtable;
3303 u16 index = selector >> 3; 3379 u16 index = selector >> 3;
3304 3380
3305 get_segment_descritptor_dtable(vcpu, selector, &dtable); 3381 get_segment_descriptor_dtable(vcpu, selector, &dtable);
3306 3382
3307 if (dtable.limit < index * 8 + 7) { 3383 if (dtable.limit < index * 8 + 7) {
3308 kvm_queue_exception_e(vcpu, GP_VECTOR, selector & 0xfffc); 3384 kvm_queue_exception_e(vcpu, GP_VECTOR, selector & 0xfffc);
@@ -3321,7 +3397,7 @@ static int save_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
3321 struct descriptor_table dtable; 3397 struct descriptor_table dtable;
3322 u16 index = selector >> 3; 3398 u16 index = selector >> 3;
3323 3399
3324 get_segment_descritptor_dtable(vcpu, selector, &dtable); 3400 get_segment_descriptor_dtable(vcpu, selector, &dtable);
3325 3401
3326 if (dtable.limit < index * 8 + 7) 3402 if (dtable.limit < index * 8 + 7)
3327 return 1; 3403 return 1;
@@ -3900,6 +3976,7 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
3900 /* We do fxsave: this must be aligned. */ 3976 /* We do fxsave: this must be aligned. */
3901 BUG_ON((unsigned long)&vcpu->arch.host_fx_image & 0xF); 3977 BUG_ON((unsigned long)&vcpu->arch.host_fx_image & 0xF);
3902 3978
3979 vcpu->arch.mtrr_state.have_fixed = 1;
3903 vcpu_load(vcpu); 3980 vcpu_load(vcpu);
3904 r = kvm_arch_vcpu_reset(vcpu); 3981 r = kvm_arch_vcpu_reset(vcpu);
3905 if (r == 0) 3982 if (r == 0)
@@ -3925,6 +4002,9 @@ void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
3925 4002
3926int kvm_arch_vcpu_reset(struct kvm_vcpu *vcpu) 4003int kvm_arch_vcpu_reset(struct kvm_vcpu *vcpu)
3927{ 4004{
4005 vcpu->arch.nmi_pending = false;
4006 vcpu->arch.nmi_injected = false;
4007
3928 return kvm_x86_ops->vcpu_reset(vcpu); 4008 return kvm_x86_ops->vcpu_reset(vcpu);
3929} 4009}
3930 4010
@@ -4012,6 +4092,7 @@ struct kvm *kvm_arch_create_vm(void)
4012 return ERR_PTR(-ENOMEM); 4092 return ERR_PTR(-ENOMEM);
4013 4093
4014 INIT_LIST_HEAD(&kvm->arch.active_mmu_pages); 4094 INIT_LIST_HEAD(&kvm->arch.active_mmu_pages);
4095 INIT_LIST_HEAD(&kvm->arch.oos_global_pages);
4015 INIT_LIST_HEAD(&kvm->arch.assigned_dev_head); 4096 INIT_LIST_HEAD(&kvm->arch.assigned_dev_head);
4016 4097
4017 /* Reserve bit 0 of irq_sources_bitmap for userspace irq source */ 4098 /* Reserve bit 0 of irq_sources_bitmap for userspace irq source */
@@ -4048,8 +4129,8 @@ static void kvm_free_vcpus(struct kvm *kvm)
4048 4129
4049void kvm_arch_destroy_vm(struct kvm *kvm) 4130void kvm_arch_destroy_vm(struct kvm *kvm)
4050{ 4131{
4051 kvm_iommu_unmap_guest(kvm);
4052 kvm_free_all_assigned_devices(kvm); 4132 kvm_free_all_assigned_devices(kvm);
4133 kvm_iommu_unmap_guest(kvm);
4053 kvm_free_pit(kvm); 4134 kvm_free_pit(kvm);
4054 kfree(kvm->arch.vpic); 4135 kfree(kvm->arch.vpic);
4055 kfree(kvm->arch.vioapic); 4136 kfree(kvm->arch.vioapic);
@@ -4127,7 +4208,8 @@ void kvm_arch_flush_shadow(struct kvm *kvm)
4127int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) 4208int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
4128{ 4209{
4129 return vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE 4210 return vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE
4130 || vcpu->arch.mp_state == KVM_MP_STATE_SIPI_RECEIVED; 4211 || vcpu->arch.mp_state == KVM_MP_STATE_SIPI_RECEIVED
4212 || vcpu->arch.nmi_pending;
4131} 4213}
4132 4214
4133static void vcpu_kick_intr(void *info) 4215static void vcpu_kick_intr(void *info)
diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index ea051173b0da..d174db7a3370 100644
--- a/arch/x86/kvm/x86_emulate.c
+++ b/arch/x86/kvm/x86_emulate.c
@@ -58,6 +58,7 @@
58#define SrcMem32 (4<<4) /* Memory operand (32-bit). */ 58#define SrcMem32 (4<<4) /* Memory operand (32-bit). */
59#define SrcImm (5<<4) /* Immediate operand. */ 59#define SrcImm (5<<4) /* Immediate operand. */
60#define SrcImmByte (6<<4) /* 8-bit sign-extended immediate operand. */ 60#define SrcImmByte (6<<4) /* 8-bit sign-extended immediate operand. */
61#define SrcOne (7<<4) /* Implied '1' */
61#define SrcMask (7<<4) 62#define SrcMask (7<<4)
62/* Generic ModRM decode. */ 63/* Generic ModRM decode. */
63#define ModRM (1<<7) 64#define ModRM (1<<7)
@@ -70,17 +71,23 @@
70#define Group (1<<14) /* Bits 3:5 of modrm byte extend opcode */ 71#define Group (1<<14) /* Bits 3:5 of modrm byte extend opcode */
71#define GroupDual (1<<15) /* Alternate decoding of mod == 3 */ 72#define GroupDual (1<<15) /* Alternate decoding of mod == 3 */
72#define GroupMask 0xff /* Group number stored in bits 0:7 */ 73#define GroupMask 0xff /* Group number stored in bits 0:7 */
74/* Source 2 operand type */
75#define Src2None (0<<29)
76#define Src2CL (1<<29)
77#define Src2ImmByte (2<<29)
78#define Src2One (3<<29)
79#define Src2Mask (7<<29)
73 80
74enum { 81enum {
75 Group1_80, Group1_81, Group1_82, Group1_83, 82 Group1_80, Group1_81, Group1_82, Group1_83,
76 Group1A, Group3_Byte, Group3, Group4, Group5, Group7, 83 Group1A, Group3_Byte, Group3, Group4, Group5, Group7,
77}; 84};
78 85
79static u16 opcode_table[256] = { 86static u32 opcode_table[256] = {
80 /* 0x00 - 0x07 */ 87 /* 0x00 - 0x07 */
81 ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM, 88 ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM,
82 ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM, 89 ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM,
83 0, 0, 0, 0, 90 ByteOp | DstAcc | SrcImm, DstAcc | SrcImm, 0, 0,
84 /* 0x08 - 0x0F */ 91 /* 0x08 - 0x0F */
85 ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM, 92 ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM,
86 ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM, 93 ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM,
@@ -195,7 +202,7 @@ static u16 opcode_table[256] = {
195 ImplicitOps, ImplicitOps, Group | Group4, Group | Group5, 202 ImplicitOps, ImplicitOps, Group | Group4, Group | Group5,
196}; 203};
197 204
198static u16 twobyte_table[256] = { 205static u32 twobyte_table[256] = {
199 /* 0x00 - 0x0F */ 206 /* 0x00 - 0x0F */
200 0, Group | GroupDual | Group7, 0, 0, 0, 0, ImplicitOps, 0, 207 0, Group | GroupDual | Group7, 0, 0, 0, 0, ImplicitOps, 0,
201 ImplicitOps, ImplicitOps, 0, 0, 0, ImplicitOps | ModRM, 0, 0, 208 ImplicitOps, ImplicitOps, 0, 0, 0, ImplicitOps | ModRM, 0, 0,
@@ -230,9 +237,14 @@ static u16 twobyte_table[256] = {
230 /* 0x90 - 0x9F */ 237 /* 0x90 - 0x9F */
231 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 238 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
232 /* 0xA0 - 0xA7 */ 239 /* 0xA0 - 0xA7 */
233 0, 0, 0, DstMem | SrcReg | ModRM | BitOp, 0, 0, 0, 0, 240 0, 0, 0, DstMem | SrcReg | ModRM | BitOp,
241 DstMem | SrcReg | Src2ImmByte | ModRM,
242 DstMem | SrcReg | Src2CL | ModRM, 0, 0,
234 /* 0xA8 - 0xAF */ 243 /* 0xA8 - 0xAF */
235 0, 0, 0, DstMem | SrcReg | ModRM | BitOp, 0, 0, ModRM, 0, 244 0, 0, 0, DstMem | SrcReg | ModRM | BitOp,
245 DstMem | SrcReg | Src2ImmByte | ModRM,
246 DstMem | SrcReg | Src2CL | ModRM,
247 ModRM, 0,
236 /* 0xB0 - 0xB7 */ 248 /* 0xB0 - 0xB7 */
237 ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM, 0, 249 ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM, 0,
238 DstMem | SrcReg | ModRM | BitOp, 250 DstMem | SrcReg | ModRM | BitOp,
@@ -253,7 +265,7 @@ static u16 twobyte_table[256] = {
253 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 265 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
254}; 266};
255 267
256static u16 group_table[] = { 268static u32 group_table[] = {
257 [Group1_80*8] = 269 [Group1_80*8] =
258 ByteOp | DstMem | SrcImm | ModRM, ByteOp | DstMem | SrcImm | ModRM, 270 ByteOp | DstMem | SrcImm | ModRM, ByteOp | DstMem | SrcImm | ModRM,
259 ByteOp | DstMem | SrcImm | ModRM, ByteOp | DstMem | SrcImm | ModRM, 271 ByteOp | DstMem | SrcImm | ModRM, ByteOp | DstMem | SrcImm | ModRM,
@@ -297,9 +309,9 @@ static u16 group_table[] = {
297 SrcMem16 | ModRM | Mov, SrcMem | ModRM | ByteOp, 309 SrcMem16 | ModRM | Mov, SrcMem | ModRM | ByteOp,
298}; 310};
299 311
300static u16 group2_table[] = { 312static u32 group2_table[] = {
301 [Group7*8] = 313 [Group7*8] =
302 SrcNone | ModRM, 0, 0, 0, 314 SrcNone | ModRM, 0, 0, SrcNone | ModRM,
303 SrcNone | ModRM | DstMem | Mov, 0, 315 SrcNone | ModRM | DstMem | Mov, 0,
304 SrcMem16 | ModRM | Mov, 0, 316 SrcMem16 | ModRM | Mov, 0,
305}; 317};
@@ -359,49 +371,48 @@ static u16 group2_table[] = {
359 "andl %"_msk",%"_LO32 _tmp"; " \ 371 "andl %"_msk",%"_LO32 _tmp"; " \
360 "orl %"_LO32 _tmp",%"_sav"; " 372 "orl %"_LO32 _tmp",%"_sav"; "
361 373
374#ifdef CONFIG_X86_64
375#define ON64(x) x
376#else
377#define ON64(x)
378#endif
379
380#define ____emulate_2op(_op, _src, _dst, _eflags, _x, _y, _suffix) \
381 do { \
382 __asm__ __volatile__ ( \
383 _PRE_EFLAGS("0", "4", "2") \
384 _op _suffix " %"_x"3,%1; " \
385 _POST_EFLAGS("0", "4", "2") \
386 : "=m" (_eflags), "=m" ((_dst).val), \
387 "=&r" (_tmp) \
388 : _y ((_src).val), "i" (EFLAGS_MASK)); \
389 } while (0)
390
391
362/* Raw emulation: instruction has two explicit operands. */ 392/* Raw emulation: instruction has two explicit operands. */
363#define __emulate_2op_nobyte(_op,_src,_dst,_eflags,_wx,_wy,_lx,_ly,_qx,_qy) \ 393#define __emulate_2op_nobyte(_op,_src,_dst,_eflags,_wx,_wy,_lx,_ly,_qx,_qy) \
364 do { \ 394 do { \
365 unsigned long _tmp; \ 395 unsigned long _tmp; \
366 \ 396 \
367 switch ((_dst).bytes) { \ 397 switch ((_dst).bytes) { \
368 case 2: \ 398 case 2: \
369 __asm__ __volatile__ ( \ 399 ____emulate_2op(_op,_src,_dst,_eflags,_wx,_wy,"w"); \
370 _PRE_EFLAGS("0", "4", "2") \ 400 break; \
371 _op"w %"_wx"3,%1; " \ 401 case 4: \
372 _POST_EFLAGS("0", "4", "2") \ 402 ____emulate_2op(_op,_src,_dst,_eflags,_lx,_ly,"l"); \
373 : "=m" (_eflags), "=m" ((_dst).val), \ 403 break; \
374 "=&r" (_tmp) \ 404 case 8: \
375 : _wy ((_src).val), "i" (EFLAGS_MASK)); \ 405 ON64(____emulate_2op(_op,_src,_dst,_eflags,_qx,_qy,"q")); \
376 break; \ 406 break; \
377 case 4: \ 407 } \
378 __asm__ __volatile__ ( \
379 _PRE_EFLAGS("0", "4", "2") \
380 _op"l %"_lx"3,%1; " \
381 _POST_EFLAGS("0", "4", "2") \
382 : "=m" (_eflags), "=m" ((_dst).val), \
383 "=&r" (_tmp) \
384 : _ly ((_src).val), "i" (EFLAGS_MASK)); \
385 break; \
386 case 8: \
387 __emulate_2op_8byte(_op, _src, _dst, \
388 _eflags, _qx, _qy); \
389 break; \
390 } \
391 } while (0) 408 } while (0)
392 409
393#define __emulate_2op(_op,_src,_dst,_eflags,_bx,_by,_wx,_wy,_lx,_ly,_qx,_qy) \ 410#define __emulate_2op(_op,_src,_dst,_eflags,_bx,_by,_wx,_wy,_lx,_ly,_qx,_qy) \
394 do { \ 411 do { \
395 unsigned long __tmp; \ 412 unsigned long _tmp; \
396 switch ((_dst).bytes) { \ 413 switch ((_dst).bytes) { \
397 case 1: \ 414 case 1: \
398 __asm__ __volatile__ ( \ 415 ____emulate_2op(_op,_src,_dst,_eflags,_bx,_by,"b"); \
399 _PRE_EFLAGS("0", "4", "2") \
400 _op"b %"_bx"3,%1; " \
401 _POST_EFLAGS("0", "4", "2") \
402 : "=m" (_eflags), "=m" ((_dst).val), \
403 "=&r" (__tmp) \
404 : _by ((_src).val), "i" (EFLAGS_MASK)); \
405 break; \ 416 break; \
406 default: \ 417 default: \
407 __emulate_2op_nobyte(_op, _src, _dst, _eflags, \ 418 __emulate_2op_nobyte(_op, _src, _dst, _eflags, \
@@ -425,71 +436,68 @@ static u16 group2_table[] = {
425 __emulate_2op_nobyte(_op, _src, _dst, _eflags, \ 436 __emulate_2op_nobyte(_op, _src, _dst, _eflags, \
426 "w", "r", _LO32, "r", "", "r") 437 "w", "r", _LO32, "r", "", "r")
427 438
428/* Instruction has only one explicit operand (no source operand). */ 439/* Instruction has three operands and one operand is stored in ECX register */
429#define emulate_1op(_op, _dst, _eflags) \ 440#define __emulate_2op_cl(_op, _cl, _src, _dst, _eflags, _suffix, _type) \
430 do { \ 441 do { \
431 unsigned long _tmp; \ 442 unsigned long _tmp; \
432 \ 443 _type _clv = (_cl).val; \
433 switch ((_dst).bytes) { \ 444 _type _srcv = (_src).val; \
434 case 1: \ 445 _type _dstv = (_dst).val; \
435 __asm__ __volatile__ ( \ 446 \
436 _PRE_EFLAGS("0", "3", "2") \ 447 __asm__ __volatile__ ( \
437 _op"b %1; " \ 448 _PRE_EFLAGS("0", "5", "2") \
438 _POST_EFLAGS("0", "3", "2") \ 449 _op _suffix " %4,%1 \n" \
439 : "=m" (_eflags), "=m" ((_dst).val), \ 450 _POST_EFLAGS("0", "5", "2") \
440 "=&r" (_tmp) \ 451 : "=m" (_eflags), "+r" (_dstv), "=&r" (_tmp) \
441 : "i" (EFLAGS_MASK)); \ 452 : "c" (_clv) , "r" (_srcv), "i" (EFLAGS_MASK) \
442 break; \ 453 ); \
443 case 2: \ 454 \
444 __asm__ __volatile__ ( \ 455 (_cl).val = (unsigned long) _clv; \
445 _PRE_EFLAGS("0", "3", "2") \ 456 (_src).val = (unsigned long) _srcv; \
446 _op"w %1; " \ 457 (_dst).val = (unsigned long) _dstv; \
447 _POST_EFLAGS("0", "3", "2") \
448 : "=m" (_eflags), "=m" ((_dst).val), \
449 "=&r" (_tmp) \
450 : "i" (EFLAGS_MASK)); \
451 break; \
452 case 4: \
453 __asm__ __volatile__ ( \
454 _PRE_EFLAGS("0", "3", "2") \
455 _op"l %1; " \
456 _POST_EFLAGS("0", "3", "2") \
457 : "=m" (_eflags), "=m" ((_dst).val), \
458 "=&r" (_tmp) \
459 : "i" (EFLAGS_MASK)); \
460 break; \
461 case 8: \
462 __emulate_1op_8byte(_op, _dst, _eflags); \
463 break; \
464 } \
465 } while (0) 458 } while (0)
466 459
467/* Emulate an instruction with quadword operands (x86/64 only). */ 460#define emulate_2op_cl(_op, _cl, _src, _dst, _eflags) \
468#if defined(CONFIG_X86_64) 461 do { \
469#define __emulate_2op_8byte(_op, _src, _dst, _eflags, _qx, _qy) \ 462 switch ((_dst).bytes) { \
470 do { \ 463 case 2: \
471 __asm__ __volatile__ ( \ 464 __emulate_2op_cl(_op, _cl, _src, _dst, _eflags, \
472 _PRE_EFLAGS("0", "4", "2") \ 465 "w", unsigned short); \
473 _op"q %"_qx"3,%1; " \ 466 break; \
474 _POST_EFLAGS("0", "4", "2") \ 467 case 4: \
475 : "=m" (_eflags), "=m" ((_dst).val), "=&r" (_tmp) \ 468 __emulate_2op_cl(_op, _cl, _src, _dst, _eflags, \
476 : _qy ((_src).val), "i" (EFLAGS_MASK)); \ 469 "l", unsigned int); \
470 break; \
471 case 8: \
472 ON64(__emulate_2op_cl(_op, _cl, _src, _dst, _eflags, \
473 "q", unsigned long)); \
474 break; \
475 } \
477 } while (0) 476 } while (0)
478 477
479#define __emulate_1op_8byte(_op, _dst, _eflags) \ 478#define __emulate_1op(_op, _dst, _eflags, _suffix) \
480 do { \ 479 do { \
481 __asm__ __volatile__ ( \ 480 unsigned long _tmp; \
482 _PRE_EFLAGS("0", "3", "2") \ 481 \
483 _op"q %1; " \ 482 __asm__ __volatile__ ( \
484 _POST_EFLAGS("0", "3", "2") \ 483 _PRE_EFLAGS("0", "3", "2") \
485 : "=m" (_eflags), "=m" ((_dst).val), "=&r" (_tmp) \ 484 _op _suffix " %1; " \
486 : "i" (EFLAGS_MASK)); \ 485 _POST_EFLAGS("0", "3", "2") \
486 : "=m" (_eflags), "+m" ((_dst).val), \
487 "=&r" (_tmp) \
488 : "i" (EFLAGS_MASK)); \
487 } while (0) 489 } while (0)
488 490
489#elif defined(__i386__) 491/* Instruction has only one explicit operand (no source operand). */
490#define __emulate_2op_8byte(_op, _src, _dst, _eflags, _qx, _qy) 492#define emulate_1op(_op, _dst, _eflags) \
491#define __emulate_1op_8byte(_op, _dst, _eflags) 493 do { \
492#endif /* __i386__ */ 494 switch ((_dst).bytes) { \
495 case 1: __emulate_1op(_op, _dst, _eflags, "b"); break; \
496 case 2: __emulate_1op(_op, _dst, _eflags, "w"); break; \
497 case 4: __emulate_1op(_op, _dst, _eflags, "l"); break; \
498 case 8: ON64(__emulate_1op(_op, _dst, _eflags, "q")); break; \
499 } \
500 } while (0)
493 501
494/* Fetch next part of the instruction being emulated. */ 502/* Fetch next part of the instruction being emulated. */
495#define insn_fetch(_type, _size, _eip) \ 503#define insn_fetch(_type, _size, _eip) \
@@ -1041,6 +1049,33 @@ done_prefixes:
1041 c->src.bytes = 1; 1049 c->src.bytes = 1;
1042 c->src.val = insn_fetch(s8, 1, c->eip); 1050 c->src.val = insn_fetch(s8, 1, c->eip);
1043 break; 1051 break;
1052 case SrcOne:
1053 c->src.bytes = 1;
1054 c->src.val = 1;
1055 break;
1056 }
1057
1058 /*
1059 * Decode and fetch the second source operand: register, memory
1060 * or immediate.
1061 */
1062 switch (c->d & Src2Mask) {
1063 case Src2None:
1064 break;
1065 case Src2CL:
1066 c->src2.bytes = 1;
1067 c->src2.val = c->regs[VCPU_REGS_RCX] & 0x8;
1068 break;
1069 case Src2ImmByte:
1070 c->src2.type = OP_IMM;
1071 c->src2.ptr = (unsigned long *)c->eip;
1072 c->src2.bytes = 1;
1073 c->src2.val = insn_fetch(u8, 1, c->eip);
1074 break;
1075 case Src2One:
1076 c->src2.bytes = 1;
1077 c->src2.val = 1;
1078 break;
1044 } 1079 }
1045 1080
1046 /* Decode and fetch the destination operand: register or memory. */ 1081 /* Decode and fetch the destination operand: register or memory. */
@@ -1100,20 +1135,33 @@ static inline void emulate_push(struct x86_emulate_ctxt *ctxt)
1100 c->regs[VCPU_REGS_RSP]); 1135 c->regs[VCPU_REGS_RSP]);
1101} 1136}
1102 1137
1103static inline int emulate_grp1a(struct x86_emulate_ctxt *ctxt, 1138static int emulate_pop(struct x86_emulate_ctxt *ctxt,
1104 struct x86_emulate_ops *ops) 1139 struct x86_emulate_ops *ops)
1105{ 1140{
1106 struct decode_cache *c = &ctxt->decode; 1141 struct decode_cache *c = &ctxt->decode;
1107 int rc; 1142 int rc;
1108 1143
1109 rc = ops->read_std(register_address(c, ss_base(ctxt), 1144 rc = ops->read_emulated(register_address(c, ss_base(ctxt),
1110 c->regs[VCPU_REGS_RSP]), 1145 c->regs[VCPU_REGS_RSP]),
1111 &c->dst.val, c->dst.bytes, ctxt->vcpu); 1146 &c->src.val, c->src.bytes, ctxt->vcpu);
1112 if (rc != 0) 1147 if (rc != 0)
1113 return rc; 1148 return rc;
1114 1149
1115 register_address_increment(c, &c->regs[VCPU_REGS_RSP], c->dst.bytes); 1150 register_address_increment(c, &c->regs[VCPU_REGS_RSP], c->src.bytes);
1151 return rc;
1152}
1153
1154static inline int emulate_grp1a(struct x86_emulate_ctxt *ctxt,
1155 struct x86_emulate_ops *ops)
1156{
1157 struct decode_cache *c = &ctxt->decode;
1158 int rc;
1116 1159
1160 c->src.bytes = c->dst.bytes;
1161 rc = emulate_pop(ctxt, ops);
1162 if (rc != 0)
1163 return rc;
1164 c->dst.val = c->src.val;
1117 return 0; 1165 return 0;
1118} 1166}
1119 1167
@@ -1415,24 +1463,15 @@ special_insn:
1415 emulate_1op("dec", c->dst, ctxt->eflags); 1463 emulate_1op("dec", c->dst, ctxt->eflags);
1416 break; 1464 break;
1417 case 0x50 ... 0x57: /* push reg */ 1465 case 0x50 ... 0x57: /* push reg */
1418 c->dst.type = OP_MEM; 1466 emulate_push(ctxt);
1419 c->dst.bytes = c->op_bytes;
1420 c->dst.val = c->src.val;
1421 register_address_increment(c, &c->regs[VCPU_REGS_RSP],
1422 -c->op_bytes);
1423 c->dst.ptr = (void *) register_address(
1424 c, ss_base(ctxt), c->regs[VCPU_REGS_RSP]);
1425 break; 1467 break;
1426 case 0x58 ... 0x5f: /* pop reg */ 1468 case 0x58 ... 0x5f: /* pop reg */
1427 pop_instruction: 1469 pop_instruction:
1428 if ((rc = ops->read_std(register_address(c, ss_base(ctxt), 1470 c->src.bytes = c->op_bytes;
1429 c->regs[VCPU_REGS_RSP]), c->dst.ptr, 1471 rc = emulate_pop(ctxt, ops);
1430 c->op_bytes, ctxt->vcpu)) != 0) 1472 if (rc != 0)
1431 goto done; 1473 goto done;
1432 1474 c->dst.val = c->src.val;
1433 register_address_increment(c, &c->regs[VCPU_REGS_RSP],
1434 c->op_bytes);
1435 c->dst.type = OP_NONE; /* Disable writeback. */
1436 break; 1475 break;
1437 case 0x63: /* movsxd */ 1476 case 0x63: /* movsxd */
1438 if (ctxt->mode != X86EMUL_MODE_PROT64) 1477 if (ctxt->mode != X86EMUL_MODE_PROT64)
@@ -1591,7 +1630,9 @@ special_insn:
1591 emulate_push(ctxt); 1630 emulate_push(ctxt);
1592 break; 1631 break;
1593 case 0x9d: /* popf */ 1632 case 0x9d: /* popf */
1633 c->dst.type = OP_REG;
1594 c->dst.ptr = (unsigned long *) &ctxt->eflags; 1634 c->dst.ptr = (unsigned long *) &ctxt->eflags;
1635 c->dst.bytes = c->op_bytes;
1595 goto pop_instruction; 1636 goto pop_instruction;
1596 case 0xa0 ... 0xa1: /* mov */ 1637 case 0xa0 ... 0xa1: /* mov */
1597 c->dst.ptr = (unsigned long *)&c->regs[VCPU_REGS_RAX]; 1638 c->dst.ptr = (unsigned long *)&c->regs[VCPU_REGS_RAX];
@@ -1689,7 +1730,9 @@ special_insn:
1689 emulate_grp2(ctxt); 1730 emulate_grp2(ctxt);
1690 break; 1731 break;
1691 case 0xc3: /* ret */ 1732 case 0xc3: /* ret */
1733 c->dst.type = OP_REG;
1692 c->dst.ptr = &c->eip; 1734 c->dst.ptr = &c->eip;
1735 c->dst.bytes = c->op_bytes;
1693 goto pop_instruction; 1736 goto pop_instruction;
1694 case 0xc6 ... 0xc7: /* mov (sole member of Grp11) */ 1737 case 0xc6 ... 0xc7: /* mov (sole member of Grp11) */
1695 mov: 1738 mov:
@@ -1778,7 +1821,7 @@ special_insn:
1778 c->eip = saved_eip; 1821 c->eip = saved_eip;
1779 goto cannot_emulate; 1822 goto cannot_emulate;
1780 } 1823 }
1781 return 0; 1824 break;
1782 case 0xf4: /* hlt */ 1825 case 0xf4: /* hlt */
1783 ctxt->vcpu->arch.halt_request = 1; 1826 ctxt->vcpu->arch.halt_request = 1;
1784 break; 1827 break;
@@ -1999,12 +2042,20 @@ twobyte_insn:
1999 c->src.val &= (c->dst.bytes << 3) - 1; 2042 c->src.val &= (c->dst.bytes << 3) - 1;
2000 emulate_2op_SrcV_nobyte("bt", c->src, c->dst, ctxt->eflags); 2043 emulate_2op_SrcV_nobyte("bt", c->src, c->dst, ctxt->eflags);
2001 break; 2044 break;
2045 case 0xa4: /* shld imm8, r, r/m */
2046 case 0xa5: /* shld cl, r, r/m */
2047 emulate_2op_cl("shld", c->src2, c->src, c->dst, ctxt->eflags);
2048 break;
2002 case 0xab: 2049 case 0xab:
2003 bts: /* bts */ 2050 bts: /* bts */
2004 /* only subword offset */ 2051 /* only subword offset */
2005 c->src.val &= (c->dst.bytes << 3) - 1; 2052 c->src.val &= (c->dst.bytes << 3) - 1;
2006 emulate_2op_SrcV_nobyte("bts", c->src, c->dst, ctxt->eflags); 2053 emulate_2op_SrcV_nobyte("bts", c->src, c->dst, ctxt->eflags);
2007 break; 2054 break;
2055 case 0xac: /* shrd imm8, r, r/m */
2056 case 0xad: /* shrd cl, r, r/m */
2057 emulate_2op_cl("shrd", c->src2, c->src, c->dst, ctxt->eflags);
2058 break;
2008 case 0xae: /* clflush */ 2059 case 0xae: /* clflush */
2009 break; 2060 break;
2010 case 0xb0 ... 0xb1: /* cmpxchg */ 2061 case 0xb0 ... 0xb1: /* cmpxchg */
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index a5d8e1ace1cf..a7ed208f81e3 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -590,7 +590,8 @@ static void __init lguest_init_IRQ(void)
590 * a straightforward 1 to 1 mapping, so force that here. */ 590 * a straightforward 1 to 1 mapping, so force that here. */
591 __get_cpu_var(vector_irq)[vector] = i; 591 __get_cpu_var(vector_irq)[vector] = i;
592 if (vector != SYSCALL_VECTOR) { 592 if (vector != SYSCALL_VECTOR) {
593 set_intr_gate(vector, interrupt[vector]); 593 set_intr_gate(vector,
594 interrupt[vector-FIRST_EXTERNAL_VECTOR]);
594 set_irq_chip_and_handler_name(i, &lguest_irq_controller, 595 set_irq_chip_and_handler_name(i, &lguest_irq_controller,
595 handle_level_irq, 596 handle_level_irq,
596 "level"); 597 "level");
@@ -737,7 +738,7 @@ static void lguest_time_init(void)
737 738
738 /* We can't set cpumask in the initializer: damn C limitations! Set it 739 /* We can't set cpumask in the initializer: damn C limitations! Set it
739 * here and register our timer device. */ 740 * here and register our timer device. */
740 lguest_clockevent.cpumask = cpumask_of_cpu(0); 741 lguest_clockevent.cpumask = cpumask_of(0);
741 clockevents_register_device(&lguest_clockevent); 742 clockevents_register_device(&lguest_clockevent);
742 743
743 /* Finally, we unblock the timer interrupt. */ 744 /* Finally, we unblock the timer interrupt. */
diff --git a/arch/x86/lguest/i386_head.S b/arch/x86/lguest/i386_head.S
index 5c7cef34c9e7..10b9bd35a8ff 100644
--- a/arch/x86/lguest/i386_head.S
+++ b/arch/x86/lguest/i386_head.S
@@ -30,21 +30,6 @@ ENTRY(lguest_entry)
30 movl $lguest_data - __PAGE_OFFSET, %edx 30 movl $lguest_data - __PAGE_OFFSET, %edx
31 int $LGUEST_TRAP_ENTRY 31 int $LGUEST_TRAP_ENTRY
32 32
33 /* The Host put the toplevel pagetable in lguest_data.pgdir. The movsl
34 * instruction uses %esi implicitly as the source for the copy we're
35 * about to do. */
36 movl lguest_data - __PAGE_OFFSET + LGUEST_DATA_pgdir, %esi
37
38 /* Copy first 32 entries of page directory to __PAGE_OFFSET entries.
39 * This means the first 128M of kernel memory will be mapped at
40 * PAGE_OFFSET where the kernel expects to run. This will get it far
41 * enough through boot to switch to its own pagetables. */
42 movl $32, %ecx
43 movl %esi, %edi
44 addl $((__PAGE_OFFSET >> 22) * 4), %edi
45 rep
46 movsl
47
48 /* Set up the initial stack so we can run C code. */ 33 /* Set up the initial stack so we can run C code. */
49 movl $(init_thread_union+THREAD_SIZE),%esp 34 movl $(init_thread_union+THREAD_SIZE),%esp
50 35
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c
index 9e68075544f6..4a20b2f9a381 100644
--- a/arch/x86/lib/usercopy_32.c
+++ b/arch/x86/lib/usercopy_32.c
@@ -39,7 +39,7 @@ static inline int __movsl_is_ok(unsigned long a1, unsigned long a2, unsigned lon
39#define __do_strncpy_from_user(dst, src, count, res) \ 39#define __do_strncpy_from_user(dst, src, count, res) \
40do { \ 40do { \
41 int __d0, __d1, __d2; \ 41 int __d0, __d1, __d2; \
42 might_sleep(); \ 42 might_fault(); \
43 __asm__ __volatile__( \ 43 __asm__ __volatile__( \
44 " testl %1,%1\n" \ 44 " testl %1,%1\n" \
45 " jz 2f\n" \ 45 " jz 2f\n" \
@@ -126,7 +126,7 @@ EXPORT_SYMBOL(strncpy_from_user);
126#define __do_clear_user(addr,size) \ 126#define __do_clear_user(addr,size) \
127do { \ 127do { \
128 int __d0; \ 128 int __d0; \
129 might_sleep(); \ 129 might_fault(); \
130 __asm__ __volatile__( \ 130 __asm__ __volatile__( \
131 "0: rep; stosl\n" \ 131 "0: rep; stosl\n" \
132 " movl %2,%0\n" \ 132 " movl %2,%0\n" \
@@ -155,7 +155,7 @@ do { \
155unsigned long 155unsigned long
156clear_user(void __user *to, unsigned long n) 156clear_user(void __user *to, unsigned long n)
157{ 157{
158 might_sleep(); 158 might_fault();
159 if (access_ok(VERIFY_WRITE, to, n)) 159 if (access_ok(VERIFY_WRITE, to, n))
160 __do_clear_user(to, n); 160 __do_clear_user(to, n);
161 return n; 161 return n;
@@ -197,7 +197,7 @@ long strnlen_user(const char __user *s, long n)
197 unsigned long mask = -__addr_ok(s); 197 unsigned long mask = -__addr_ok(s);
198 unsigned long res, tmp; 198 unsigned long res, tmp;
199 199
200 might_sleep(); 200 might_fault();
201 201
202 __asm__ __volatile__( 202 __asm__ __volatile__(
203 " testl %0, %0\n" 203 " testl %0, %0\n"
diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c
index f4df6e7c718b..64d6c84e6353 100644
--- a/arch/x86/lib/usercopy_64.c
+++ b/arch/x86/lib/usercopy_64.c
@@ -15,7 +15,7 @@
15#define __do_strncpy_from_user(dst,src,count,res) \ 15#define __do_strncpy_from_user(dst,src,count,res) \
16do { \ 16do { \
17 long __d0, __d1, __d2; \ 17 long __d0, __d1, __d2; \
18 might_sleep(); \ 18 might_fault(); \
19 __asm__ __volatile__( \ 19 __asm__ __volatile__( \
20 " testq %1,%1\n" \ 20 " testq %1,%1\n" \
21 " jz 2f\n" \ 21 " jz 2f\n" \
@@ -64,7 +64,7 @@ EXPORT_SYMBOL(strncpy_from_user);
64unsigned long __clear_user(void __user *addr, unsigned long size) 64unsigned long __clear_user(void __user *addr, unsigned long size)
65{ 65{
66 long __d0; 66 long __d0;
67 might_sleep(); 67 might_fault();
68 /* no memory constraint because it doesn't change any memory gcc knows 68 /* no memory constraint because it doesn't change any memory gcc knows
69 about */ 69 about */
70 asm volatile( 70 asm volatile(
diff --git a/arch/x86/mach-default/setup.c b/arch/x86/mach-default/setup.c
index 37b9ae4d44c5..df167f265622 100644
--- a/arch/x86/mach-default/setup.c
+++ b/arch/x86/mach-default/setup.c
@@ -133,29 +133,28 @@ void __init time_init_hook(void)
133 **/ 133 **/
134void mca_nmi_hook(void) 134void mca_nmi_hook(void)
135{ 135{
136 /* If I recall correctly, there's a whole bunch of other things that 136 /*
137 * If I recall correctly, there's a whole bunch of other things that
137 * we can do to check for NMI problems, but that's all I know about 138 * we can do to check for NMI problems, but that's all I know about
138 * at the moment. 139 * at the moment.
139 */ 140 */
140 141 pr_warning("NMI generated from unknown source!\n");
141 printk("NMI generated from unknown source!\n");
142} 142}
143#endif 143#endif
144 144
145static __init int no_ipi_broadcast(char *str) 145static __init int no_ipi_broadcast(char *str)
146{ 146{
147 get_option(&str, &no_broadcast); 147 get_option(&str, &no_broadcast);
148 printk ("Using %s mode\n", no_broadcast ? "No IPI Broadcast" : 148 pr_info("Using %s mode\n",
149 "IPI Broadcast"); 149 no_broadcast ? "No IPI Broadcast" : "IPI Broadcast");
150 return 1; 150 return 1;
151} 151}
152
153__setup("no_ipi_broadcast=", no_ipi_broadcast); 152__setup("no_ipi_broadcast=", no_ipi_broadcast);
154 153
155static int __init print_ipi_mode(void) 154static int __init print_ipi_mode(void)
156{ 155{
157 printk ("Using IPI %s mode\n", no_broadcast ? "No-Shortcut" : 156 pr_info("Using IPI %s mode\n",
158 "Shortcut"); 157 no_broadcast ? "No-Shortcut" : "Shortcut");
159 return 0; 158 return 0;
160} 159}
161 160
diff --git a/arch/x86/mach-generic/bigsmp.c b/arch/x86/mach-generic/bigsmp.c
index 3c3b471ea496..bc4c7840b2a8 100644
--- a/arch/x86/mach-generic/bigsmp.c
+++ b/arch/x86/mach-generic/bigsmp.c
@@ -17,6 +17,7 @@
17#include <asm/bigsmp/apic.h> 17#include <asm/bigsmp/apic.h>
18#include <asm/bigsmp/ipi.h> 18#include <asm/bigsmp/ipi.h>
19#include <asm/mach-default/mach_mpparse.h> 19#include <asm/mach-default/mach_mpparse.h>
20#include <asm/mach-default/mach_wakecpu.h>
20 21
21static int dmi_bigsmp; /* can be set by dmi scanners */ 22static int dmi_bigsmp; /* can be set by dmi scanners */
22 23
@@ -41,9 +42,10 @@ static const struct dmi_system_id bigsmp_dmi_table[] = {
41 { } 42 { }
42}; 43};
43 44
44static cpumask_t vector_allocation_domain(int cpu) 45static void vector_allocation_domain(int cpu, cpumask_t *retmask)
45{ 46{
46 return cpumask_of_cpu(cpu); 47 cpus_clear(*retmask);
48 cpu_set(cpu, *retmask);
47} 49}
48 50
49static int probe_bigsmp(void) 51static int probe_bigsmp(void)
diff --git a/arch/x86/mach-generic/default.c b/arch/x86/mach-generic/default.c
index 9e835a11a13a..e63a4a76d8cd 100644
--- a/arch/x86/mach-generic/default.c
+++ b/arch/x86/mach-generic/default.c
@@ -16,6 +16,7 @@
16#include <asm/mach-default/mach_apic.h> 16#include <asm/mach-default/mach_apic.h>
17#include <asm/mach-default/mach_ipi.h> 17#include <asm/mach-default/mach_ipi.h>
18#include <asm/mach-default/mach_mpparse.h> 18#include <asm/mach-default/mach_mpparse.h>
19#include <asm/mach-default/mach_wakecpu.h>
19 20
20/* should be called last. */ 21/* should be called last. */
21static int probe_default(void) 22static int probe_default(void)
diff --git a/arch/x86/mach-generic/es7000.c b/arch/x86/mach-generic/es7000.c
index 28459cab3ddb..4ba5ccaa1584 100644
--- a/arch/x86/mach-generic/es7000.c
+++ b/arch/x86/mach-generic/es7000.c
@@ -16,7 +16,19 @@
16#include <asm/es7000/apic.h> 16#include <asm/es7000/apic.h>
17#include <asm/es7000/ipi.h> 17#include <asm/es7000/ipi.h>
18#include <asm/es7000/mpparse.h> 18#include <asm/es7000/mpparse.h>
19#include <asm/es7000/wakecpu.h> 19#include <asm/mach-default/mach_wakecpu.h>
20
21void __init es7000_update_genapic_to_cluster(void)
22{
23 genapic->target_cpus = target_cpus_cluster;
24 genapic->int_delivery_mode = INT_DELIVERY_MODE_CLUSTER;
25 genapic->int_dest_mode = INT_DEST_MODE_CLUSTER;
26 genapic->no_balance_irq = NO_BALANCE_IRQ_CLUSTER;
27
28 genapic->init_apic_ldr = init_apic_ldr_cluster;
29
30 genapic->cpu_mask_to_apicid = cpu_mask_to_apicid_cluster;
31}
20 32
21static int probe_es7000(void) 33static int probe_es7000(void)
22{ 34{
@@ -75,7 +87,7 @@ static int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
75} 87}
76#endif 88#endif
77 89
78static cpumask_t vector_allocation_domain(int cpu) 90static void vector_allocation_domain(int cpu, cpumask_t *retmask)
79{ 91{
80 /* Careful. Some cpus do not strictly honor the set of cpus 92 /* Careful. Some cpus do not strictly honor the set of cpus
81 * specified in the interrupt destination when using lowest 93 * specified in the interrupt destination when using lowest
@@ -85,8 +97,7 @@ static cpumask_t vector_allocation_domain(int cpu)
85 * deliver interrupts to the wrong hyperthread when only one 97 * deliver interrupts to the wrong hyperthread when only one
86 * hyperthread was specified in the interrupt desitination. 98 * hyperthread was specified in the interrupt desitination.
87 */ 99 */
88 cpumask_t domain = { { [0] = APIC_ALL_CPUS, } }; 100 *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } };
89 return domain;
90} 101}
91 102
92struct genapic __initdata_refok apic_es7000 = APIC_INIT("es7000", probe_es7000); 103struct genapic __initdata_refok apic_es7000 = APIC_INIT("es7000", probe_es7000);
diff --git a/arch/x86/mach-generic/numaq.c b/arch/x86/mach-generic/numaq.c
index 71a309b122e6..511d7941364f 100644
--- a/arch/x86/mach-generic/numaq.c
+++ b/arch/x86/mach-generic/numaq.c
@@ -38,7 +38,7 @@ static int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
38 return 0; 38 return 0;
39} 39}
40 40
41static cpumask_t vector_allocation_domain(int cpu) 41static void vector_allocation_domain(int cpu, cpumask_t *retmask)
42{ 42{
43 /* Careful. Some cpus do not strictly honor the set of cpus 43 /* Careful. Some cpus do not strictly honor the set of cpus
44 * specified in the interrupt destination when using lowest 44 * specified in the interrupt destination when using lowest
@@ -48,8 +48,7 @@ static cpumask_t vector_allocation_domain(int cpu)
48 * deliver interrupts to the wrong hyperthread when only one 48 * deliver interrupts to the wrong hyperthread when only one
49 * hyperthread was specified in the interrupt desitination. 49 * hyperthread was specified in the interrupt desitination.
50 */ 50 */
51 cpumask_t domain = { { [0] = APIC_ALL_CPUS, } }; 51 *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } };
52 return domain;
53} 52}
54 53
55struct genapic apic_numaq = APIC_INIT("NUMAQ", probe_numaq); 54struct 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 5a7e4619e1c4..c346d9d0226f 100644
--- a/arch/x86/mach-generic/probe.c
+++ b/arch/x86/mach-generic/probe.c
@@ -15,6 +15,7 @@
15#include <asm/mpspec.h> 15#include <asm/mpspec.h>
16#include <asm/apicdef.h> 16#include <asm/apicdef.h>
17#include <asm/genapic.h> 17#include <asm/genapic.h>
18#include <asm/setup.h>
18 19
19extern struct genapic apic_numaq; 20extern struct genapic apic_numaq;
20extern struct genapic apic_summit; 21extern struct genapic apic_summit;
@@ -57,6 +58,9 @@ static int __init parse_apic(char *arg)
57 } 58 }
58 } 59 }
59 60
61 if (x86_quirks->update_genapic)
62 x86_quirks->update_genapic();
63
60 /* Parsed again by __setup for debug/verbose */ 64 /* Parsed again by __setup for debug/verbose */
61 return 0; 65 return 0;
62} 66}
@@ -72,12 +76,15 @@ void __init generic_bigsmp_probe(void)
72 * - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support 76 * - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support
73 */ 77 */
74 78
75 if (!cmdline_apic && genapic == &apic_default) 79 if (!cmdline_apic && genapic == &apic_default) {
76 if (apic_bigsmp.probe()) { 80 if (apic_bigsmp.probe()) {
77 genapic = &apic_bigsmp; 81 genapic = &apic_bigsmp;
82 if (x86_quirks->update_genapic)
83 x86_quirks->update_genapic();
78 printk(KERN_INFO "Overriding APIC driver with %s\n", 84 printk(KERN_INFO "Overriding APIC driver with %s\n",
79 genapic->name); 85 genapic->name);
80 } 86 }
87 }
81#endif 88#endif
82} 89}
83 90
@@ -94,6 +101,9 @@ void __init generic_apic_probe(void)
94 /* Not visible without early console */ 101 /* Not visible without early console */
95 if (!apic_probe[i]) 102 if (!apic_probe[i])
96 panic("Didn't find an APIC driver"); 103 panic("Didn't find an APIC driver");
104
105 if (x86_quirks->update_genapic)
106 x86_quirks->update_genapic();
97 } 107 }
98 printk(KERN_INFO "Using APIC driver %s\n", genapic->name); 108 printk(KERN_INFO "Using APIC driver %s\n", genapic->name);
99} 109}
@@ -108,6 +118,8 @@ int __init mps_oem_check(struct mp_config_table *mpc, char *oem,
108 if (apic_probe[i]->mps_oem_check(mpc, oem, productid)) { 118 if (apic_probe[i]->mps_oem_check(mpc, oem, productid)) {
109 if (!cmdline_apic) { 119 if (!cmdline_apic) {
110 genapic = apic_probe[i]; 120 genapic = apic_probe[i];
121 if (x86_quirks->update_genapic)
122 x86_quirks->update_genapic();
111 printk(KERN_INFO "Switched to APIC driver `%s'.\n", 123 printk(KERN_INFO "Switched to APIC driver `%s'.\n",
112 genapic->name); 124 genapic->name);
113 } 125 }
@@ -124,6 +136,8 @@ int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
124 if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) { 136 if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) {
125 if (!cmdline_apic) { 137 if (!cmdline_apic) {
126 genapic = apic_probe[i]; 138 genapic = apic_probe[i];
139 if (x86_quirks->update_genapic)
140 x86_quirks->update_genapic();
127 printk(KERN_INFO "Switched to APIC driver `%s'.\n", 141 printk(KERN_INFO "Switched to APIC driver `%s'.\n",
128 genapic->name); 142 genapic->name);
129 } 143 }
diff --git a/arch/x86/mach-generic/summit.c b/arch/x86/mach-generic/summit.c
index 6272b5e69da6..2821ffc188b5 100644
--- a/arch/x86/mach-generic/summit.c
+++ b/arch/x86/mach-generic/summit.c
@@ -16,6 +16,7 @@
16#include <asm/summit/apic.h> 16#include <asm/summit/apic.h>
17#include <asm/summit/ipi.h> 17#include <asm/summit/ipi.h>
18#include <asm/summit/mpparse.h> 18#include <asm/summit/mpparse.h>
19#include <asm/mach-default/mach_wakecpu.h>
19 20
20static int probe_summit(void) 21static int probe_summit(void)
21{ 22{
@@ -23,7 +24,7 @@ static int probe_summit(void)
23 return 0; 24 return 0;
24} 25}
25 26
26static cpumask_t vector_allocation_domain(int cpu) 27static void vector_allocation_domain(int cpu, cpumask_t *retmask)
27{ 28{
28 /* Careful. Some cpus do not strictly honor the set of cpus 29 /* Careful. Some cpus do not strictly honor the set of cpus
29 * specified in the interrupt destination when using lowest 30 * specified in the interrupt destination when using lowest
@@ -33,8 +34,7 @@ static cpumask_t vector_allocation_domain(int cpu)
33 * deliver interrupts to the wrong hyperthread when only one 34 * deliver interrupts to the wrong hyperthread when only one
34 * hyperthread was specified in the interrupt desitination. 35 * hyperthread was specified in the interrupt desitination.
35 */ 36 */
36 cpumask_t domain = { { [0] = APIC_ALL_CPUS, } }; 37 *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } };
37 return domain;
38} 38}
39 39
40struct genapic apic_summit = APIC_INIT("summit", probe_summit); 40struct genapic apic_summit = APIC_INIT("summit", probe_summit);
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c
index 52145007bd7e..9840b7ec749a 100644
--- a/arch/x86/mach-voyager/voyager_smp.c
+++ b/arch/x86/mach-voyager/voyager_smp.c
@@ -63,11 +63,6 @@ static int voyager_extended_cpus = 1;
63/* Used for the invalidate map that's also checked in the spinlock */ 63/* Used for the invalidate map that's also checked in the spinlock */
64static volatile unsigned long smp_invalidate_needed; 64static volatile unsigned long smp_invalidate_needed;
65 65
66/* Bitmask of currently online CPUs - used by setup.c for
67 /proc/cpuinfo, visible externally but still physical */
68cpumask_t cpu_online_map = CPU_MASK_NONE;
69EXPORT_SYMBOL(cpu_online_map);
70
71/* Bitmask of CPUs present in the system - exported by i386_syms.c, used 66/* Bitmask of CPUs present in the system - exported by i386_syms.c, used
72 * by scheduler but indexed physically */ 67 * by scheduler but indexed physically */
73cpumask_t phys_cpu_present_map = CPU_MASK_NONE; 68cpumask_t phys_cpu_present_map = CPU_MASK_NONE;
@@ -218,8 +213,6 @@ static cpumask_t smp_commenced_mask = CPU_MASK_NONE;
218/* This is for the new dynamic CPU boot code */ 213/* This is for the new dynamic CPU boot code */
219cpumask_t cpu_callin_map = CPU_MASK_NONE; 214cpumask_t cpu_callin_map = CPU_MASK_NONE;
220cpumask_t cpu_callout_map = CPU_MASK_NONE; 215cpumask_t cpu_callout_map = CPU_MASK_NONE;
221cpumask_t cpu_possible_map = CPU_MASK_NONE;
222EXPORT_SYMBOL(cpu_possible_map);
223 216
224/* The per processor IRQ masks (these are usually kept in sync) */ 217/* The per processor IRQ masks (these are usually kept in sync) */
225static __u16 vic_irq_mask[NR_CPUS] __cacheline_aligned; 218static __u16 vic_irq_mask[NR_CPUS] __cacheline_aligned;
@@ -364,9 +357,8 @@ void __init find_smp_config(void)
364 printk("VOYAGER SMP: Boot cpu is %d\n", boot_cpu_id); 357 printk("VOYAGER SMP: Boot cpu is %d\n", boot_cpu_id);
365 358
366 /* initialize the CPU structures (moved from smp_boot_cpus) */ 359 /* initialize the CPU structures (moved from smp_boot_cpus) */
367 for (i = 0; i < NR_CPUS; i++) { 360 for (i = 0; i < nr_cpu_ids; i++)
368 cpu_irq_affinity[i] = ~0; 361 cpu_irq_affinity[i] = ~0;
369 }
370 cpu_online_map = cpumask_of_cpu(boot_cpu_id); 362 cpu_online_map = cpumask_of_cpu(boot_cpu_id);
371 363
372 /* The boot CPU must be extended */ 364 /* The boot CPU must be extended */
@@ -679,7 +671,7 @@ void __init smp_boot_cpus(void)
679 671
680 /* loop over all the extended VIC CPUs and boot them. The 672 /* loop over all the extended VIC CPUs and boot them. The
681 * Quad CPUs must be bootstrapped by their extended VIC cpu */ 673 * Quad CPUs must be bootstrapped by their extended VIC cpu */
682 for (i = 0; i < NR_CPUS; i++) { 674 for (i = 0; i < nr_cpu_ids; i++) {
683 if (i == boot_cpu_id || !cpu_isset(i, phys_cpu_present_map)) 675 if (i == boot_cpu_id || !cpu_isset(i, phys_cpu_present_map))
684 continue; 676 continue;
685 do_boot_cpu(i); 677 do_boot_cpu(i);
@@ -1234,7 +1226,7 @@ int setup_profiling_timer(unsigned int multiplier)
1234 * new values until the next timer interrupt in which they do process 1226 * new values until the next timer interrupt in which they do process
1235 * accounting. 1227 * accounting.
1236 */ 1228 */
1237 for (i = 0; i < NR_CPUS; ++i) 1229 for (i = 0; i < nr_cpu_ids; ++i)
1238 per_cpu(prof_multiplier, i) = multiplier; 1230 per_cpu(prof_multiplier, i) = multiplier;
1239 1231
1240 return 0; 1232 return 0;
@@ -1264,7 +1256,7 @@ void __init voyager_smp_intr_init(void)
1264 int i; 1256 int i;
1265 1257
1266 /* initialize the per cpu irq mask to all disabled */ 1258 /* initialize the per cpu irq mask to all disabled */
1267 for (i = 0; i < NR_CPUS; i++) 1259 for (i = 0; i < nr_cpu_ids; i++)
1268 vic_irq_mask[i] = 0xFFFF; 1260 vic_irq_mask[i] = 0xFFFF;
1269 1261
1270 VIC_SET_GATE(VIC_CPI_LEVEL0, vic_cpi_interrupt); 1262 VIC_SET_GATE(VIC_CPI_LEVEL0, vic_cpi_interrupt);
diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile
index fea4565ff576..d8cc96a2738f 100644
--- a/arch/x86/mm/Makefile
+++ b/arch/x86/mm/Makefile
@@ -8,9 +8,8 @@ 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 11obj-$(CONFIG_MMIOTRACE) += mmiotrace.o
13mmiotrace-y := pf_in.o mmio-mod.o 12mmiotrace-y := kmmio.o pf_in.o mmio-mod.o
14obj-$(CONFIG_MMIOTRACE_TEST) += testmmiotrace.o 13obj-$(CONFIG_MMIOTRACE_TEST) += testmmiotrace.o
15 14
16obj-$(CONFIG_NUMA) += numa_$(BITS).o 15obj-$(CONFIG_NUMA) += numa_$(BITS).o
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 31e8730fa246..9e268b6b204e 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -53,7 +53,7 @@
53 53
54static inline int kmmio_fault(struct pt_regs *regs, unsigned long addr) 54static inline int kmmio_fault(struct pt_regs *regs, unsigned long addr)
55{ 55{
56#ifdef CONFIG_MMIOTRACE_HOOKS 56#ifdef CONFIG_MMIOTRACE
57 if (unlikely(is_kmmio_active())) 57 if (unlikely(is_kmmio_active()))
58 if (kmmio_handler(regs, addr) == 1) 58 if (kmmio_handler(regs, addr) == 1)
59 return -1; 59 return -1;
@@ -393,7 +393,7 @@ static void show_fault_oops(struct pt_regs *regs, unsigned long error_code,
393 if (pte && pte_present(*pte) && !pte_exec(*pte)) 393 if (pte && pte_present(*pte) && !pte_exec(*pte))
394 printk(KERN_CRIT "kernel tried to execute " 394 printk(KERN_CRIT "kernel tried to execute "
395 "NX-protected page - exploit attempt? " 395 "NX-protected page - exploit attempt? "
396 "(uid: %d)\n", current->uid); 396 "(uid: %d)\n", current_uid());
397 } 397 }
398#endif 398#endif
399 399
@@ -413,6 +413,7 @@ static noinline void pgtable_bad(unsigned long address, struct pt_regs *regs,
413 unsigned long error_code) 413 unsigned long error_code)
414{ 414{
415 unsigned long flags = oops_begin(); 415 unsigned long flags = oops_begin();
416 int sig = SIGKILL;
416 struct task_struct *tsk; 417 struct task_struct *tsk;
417 418
418 printk(KERN_ALERT "%s: Corrupted page table at address %lx\n", 419 printk(KERN_ALERT "%s: Corrupted page table at address %lx\n",
@@ -423,8 +424,8 @@ static noinline void pgtable_bad(unsigned long address, struct pt_regs *regs,
423 tsk->thread.trap_no = 14; 424 tsk->thread.trap_no = 14;
424 tsk->thread.error_code = error_code; 425 tsk->thread.error_code = error_code;
425 if (__die("Bad pagetable", regs, error_code)) 426 if (__die("Bad pagetable", regs, error_code))
426 regs = NULL; 427 sig = 0;
427 oops_end(flags, regs, SIGKILL); 428 oops_end(flags, regs, sig);
428} 429}
429#endif 430#endif
430 431
@@ -590,6 +591,7 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
590 int fault; 591 int fault;
591#ifdef CONFIG_X86_64 592#ifdef CONFIG_X86_64
592 unsigned long flags; 593 unsigned long flags;
594 int sig;
593#endif 595#endif
594 596
595 tsk = current; 597 tsk = current;
@@ -665,7 +667,6 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
665 if (unlikely(in_atomic() || !mm)) 667 if (unlikely(in_atomic() || !mm))
666 goto bad_area_nosemaphore; 668 goto bad_area_nosemaphore;
667 669
668again:
669 /* 670 /*
670 * When running in the kernel we expect faults to occur only to 671 * When running in the kernel we expect faults to occur only to
671 * addresses in user space. All other faults represent errors in the 672 * addresses in user space. All other faults represent errors in the
@@ -849,32 +850,22 @@ no_context:
849 bust_spinlocks(0); 850 bust_spinlocks(0);
850 do_exit(SIGKILL); 851 do_exit(SIGKILL);
851#else 852#else
853 sig = SIGKILL;
852 if (__die("Oops", regs, error_code)) 854 if (__die("Oops", regs, error_code))
853 regs = NULL; 855 sig = 0;
854 /* Executive summary in case the body of the oops scrolled away */ 856 /* Executive summary in case the body of the oops scrolled away */
855 printk(KERN_EMERG "CR2: %016lx\n", address); 857 printk(KERN_EMERG "CR2: %016lx\n", address);
856 oops_end(flags, regs, SIGKILL); 858 oops_end(flags, regs, sig);
857#endif 859#endif
858 860
859/*
860 * We ran out of memory, or some other thing happened to us that made
861 * us unable to handle the page fault gracefully.
862 */
863out_of_memory: 861out_of_memory:
862 /*
863 * We ran out of memory, call the OOM killer, and return the userspace
864 * (which will retry the fault, or kill us if we got oom-killed).
865 */
864 up_read(&mm->mmap_sem); 866 up_read(&mm->mmap_sem);
865 if (is_global_init(tsk)) { 867 pagefault_out_of_memory();
866 yield(); 868 return;
867 /*
868 * Re-lookup the vma - in theory the vma tree might
869 * have changed:
870 */
871 goto again;
872 }
873
874 printk("VM: killing process %s\n", tsk->comm);
875 if (error_code & PF_USER)
876 do_group_exit(SIGKILL);
877 goto no_context;
878 869
879do_sigbus: 870do_sigbus:
880 up_read(&mm->mmap_sem); 871 up_read(&mm->mmap_sem);
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index c483f4242079..544d724caeee 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -21,6 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/highmem.h> 22#include <linux/highmem.h>
23#include <linux/pagemap.h> 23#include <linux/pagemap.h>
24#include <linux/pci.h>
24#include <linux/pfn.h> 25#include <linux/pfn.h>
25#include <linux/poison.h> 26#include <linux/poison.h>
26#include <linux/bootmem.h> 27#include <linux/bootmem.h>
@@ -67,7 +68,7 @@ static unsigned long __meminitdata table_top;
67 68
68static int __initdata after_init_bootmem; 69static int __initdata after_init_bootmem;
69 70
70static __init void *alloc_low_page(unsigned long *phys) 71static __init void *alloc_low_page(void)
71{ 72{
72 unsigned long pfn = table_end++; 73 unsigned long pfn = table_end++;
73 void *adr; 74 void *adr;
@@ -77,7 +78,6 @@ static __init void *alloc_low_page(unsigned long *phys)
77 78
78 adr = __va(pfn * PAGE_SIZE); 79 adr = __va(pfn * PAGE_SIZE);
79 memset(adr, 0, PAGE_SIZE); 80 memset(adr, 0, PAGE_SIZE);
80 *phys = pfn * PAGE_SIZE;
81 return adr; 81 return adr;
82} 82}
83 83
@@ -92,16 +92,17 @@ static pmd_t * __init one_md_table_init(pgd_t *pgd)
92 pmd_t *pmd_table; 92 pmd_t *pmd_table;
93 93
94#ifdef CONFIG_X86_PAE 94#ifdef CONFIG_X86_PAE
95 unsigned long phys;
96 if (!(pgd_val(*pgd) & _PAGE_PRESENT)) { 95 if (!(pgd_val(*pgd) & _PAGE_PRESENT)) {
97 if (after_init_bootmem) 96 if (after_init_bootmem)
98 pmd_table = (pmd_t *)alloc_bootmem_low_pages(PAGE_SIZE); 97 pmd_table = (pmd_t *)alloc_bootmem_low_pages(PAGE_SIZE);
99 else 98 else
100 pmd_table = (pmd_t *)alloc_low_page(&phys); 99 pmd_table = (pmd_t *)alloc_low_page();
101 paravirt_alloc_pmd(&init_mm, __pa(pmd_table) >> PAGE_SHIFT); 100 paravirt_alloc_pmd(&init_mm, __pa(pmd_table) >> PAGE_SHIFT);
102 set_pgd(pgd, __pgd(__pa(pmd_table) | _PAGE_PRESENT)); 101 set_pgd(pgd, __pgd(__pa(pmd_table) | _PAGE_PRESENT));
103 pud = pud_offset(pgd, 0); 102 pud = pud_offset(pgd, 0);
104 BUG_ON(pmd_table != pmd_offset(pud, 0)); 103 BUG_ON(pmd_table != pmd_offset(pud, 0));
104
105 return pmd_table;
105 } 106 }
106#endif 107#endif
107 pud = pud_offset(pgd, 0); 108 pud = pud_offset(pgd, 0);
@@ -126,10 +127,8 @@ static pte_t * __init one_page_table_init(pmd_t *pmd)
126 if (!page_table) 127 if (!page_table)
127 page_table = 128 page_table =
128 (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE); 129 (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE);
129 } else { 130 } else
130 unsigned long phys; 131 page_table = (pte_t *)alloc_low_page();
131 page_table = (pte_t *)alloc_low_page(&phys);
132 }
133 132
134 paravirt_alloc_pte(&init_mm, __pa(page_table) >> PAGE_SHIFT); 133 paravirt_alloc_pte(&init_mm, __pa(page_table) >> PAGE_SHIFT);
135 set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE)); 134 set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE));
@@ -436,8 +435,12 @@ static void __init set_highmem_pages_init(void)
436#endif /* !CONFIG_NUMA */ 435#endif /* !CONFIG_NUMA */
437 436
438#else 437#else
439# define permanent_kmaps_init(pgd_base) do { } while (0) 438static inline void permanent_kmaps_init(pgd_t *pgd_base)
440# define set_highmem_pages_init() do { } while (0) 439{
440}
441static inline void set_highmem_pages_init(void)
442{
443}
441#endif /* CONFIG_HIGHMEM */ 444#endif /* CONFIG_HIGHMEM */
442 445
443void __init native_pagetable_setup_start(pgd_t *base) 446void __init native_pagetable_setup_start(pgd_t *base)
@@ -969,7 +972,7 @@ void __init mem_init(void)
969 int codesize, reservedpages, datasize, initsize; 972 int codesize, reservedpages, datasize, initsize;
970 int tmp; 973 int tmp;
971 974
972 start_periodic_check_for_corruption(); 975 pci_iommu_alloc();
973 976
974#ifdef CONFIG_FLATMEM 977#ifdef CONFIG_FLATMEM
975 BUG_ON(!mem_map); 978 BUG_ON(!mem_map);
@@ -1040,11 +1043,25 @@ void __init mem_init(void)
1040 (unsigned long)&_text, (unsigned long)&_etext, 1043 (unsigned long)&_text, (unsigned long)&_etext,
1041 ((unsigned long)&_etext - (unsigned long)&_text) >> 10); 1044 ((unsigned long)&_etext - (unsigned long)&_text) >> 10);
1042 1045
1046 /*
1047 * Check boundaries twice: Some fundamental inconsistencies can
1048 * be detected at build time already.
1049 */
1050#define __FIXADDR_TOP (-PAGE_SIZE)
1051#ifdef CONFIG_HIGHMEM
1052 BUILD_BUG_ON(PKMAP_BASE + LAST_PKMAP*PAGE_SIZE > FIXADDR_START);
1053 BUILD_BUG_ON(VMALLOC_END > PKMAP_BASE);
1054#endif
1055#define high_memory (-128UL << 20)
1056 BUILD_BUG_ON(VMALLOC_START >= VMALLOC_END);
1057#undef high_memory
1058#undef __FIXADDR_TOP
1059
1043#ifdef CONFIG_HIGHMEM 1060#ifdef CONFIG_HIGHMEM
1044 BUG_ON(PKMAP_BASE + LAST_PKMAP*PAGE_SIZE > FIXADDR_START); 1061 BUG_ON(PKMAP_BASE + LAST_PKMAP*PAGE_SIZE > FIXADDR_START);
1045 BUG_ON(VMALLOC_END > PKMAP_BASE); 1062 BUG_ON(VMALLOC_END > PKMAP_BASE);
1046#endif 1063#endif
1047 BUG_ON(VMALLOC_START > VMALLOC_END); 1064 BUG_ON(VMALLOC_START >= VMALLOC_END);
1048 BUG_ON((unsigned long)high_memory > VMALLOC_START); 1065 BUG_ON((unsigned long)high_memory > VMALLOC_START);
1049 1066
1050 if (boot_cpu_data.wp_works_ok < 0) 1067 if (boot_cpu_data.wp_works_ok < 0)
@@ -1062,7 +1079,7 @@ int arch_add_memory(int nid, u64 start, u64 size)
1062 unsigned long start_pfn = start >> PAGE_SHIFT; 1079 unsigned long start_pfn = start >> PAGE_SHIFT;
1063 unsigned long nr_pages = size >> PAGE_SHIFT; 1080 unsigned long nr_pages = size >> PAGE_SHIFT;
1064 1081
1065 return __add_pages(zone, start_pfn, nr_pages); 1082 return __add_pages(nid, zone, start_pfn, nr_pages);
1066} 1083}
1067#endif 1084#endif
1068 1085
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 9db01db6e3cd..54c437e96541 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -857,7 +857,7 @@ int arch_add_memory(int nid, u64 start, u64 size)
857 if (last_mapped_pfn > max_pfn_mapped) 857 if (last_mapped_pfn > max_pfn_mapped)
858 max_pfn_mapped = last_mapped_pfn; 858 max_pfn_mapped = last_mapped_pfn;
859 859
860 ret = __add_pages(zone, start_pfn, nr_pages); 860 ret = __add_pages(nid, zone, start_pfn, nr_pages);
861 WARN_ON_ONCE(ret); 861 WARN_ON_ONCE(ret);
862 862
863 return ret; 863 return ret;
@@ -902,8 +902,6 @@ void __init mem_init(void)
902 long codesize, reservedpages, datasize, initsize; 902 long codesize, reservedpages, datasize, initsize;
903 unsigned long absent_pages; 903 unsigned long absent_pages;
904 904
905 start_periodic_check_for_corruption();
906
907 pci_iommu_alloc(); 905 pci_iommu_alloc();
908 906
909 /* clear_bss() already clear the empty_zero_page */ 907 /* clear_bss() already clear the empty_zero_page */
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index d4c4307ff3e0..bd85d42819e1 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -223,7 +223,8 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
223 * Check if the request spans more than any BAR in the iomem resource 223 * Check if the request spans more than any BAR in the iomem resource
224 * tree. 224 * tree.
225 */ 225 */
226 WARN_ON(iomem_map_sanity_check(phys_addr, size)); 226 WARN_ONCE(iomem_map_sanity_check(phys_addr, size),
227 KERN_INFO "Info: mapping multiple BARs. Your kernel is fine.");
227 228
228 /* 229 /*
229 * Don't allow anybody to remap normal RAM that we're using.. 230 * Don't allow anybody to remap normal RAM that we're using..
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index cebcbf152d46..71a14f89f89e 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -278,7 +278,7 @@ void __init numa_init_array(void)
278 int rr, i; 278 int rr, i;
279 279
280 rr = first_node(node_online_map); 280 rr = first_node(node_online_map);
281 for (i = 0; i < NR_CPUS; i++) { 281 for (i = 0; i < nr_cpu_ids; i++) {
282 if (early_cpu_to_node(i) != NUMA_NO_NODE) 282 if (early_cpu_to_node(i) != NUMA_NO_NODE)
283 continue; 283 continue;
284 numa_set_node(i, rr); 284 numa_set_node(i, rr);
@@ -549,7 +549,7 @@ void __init initmem_init(unsigned long start_pfn, unsigned long last_pfn)
549 memnodemap[0] = 0; 549 memnodemap[0] = 0;
550 node_set_online(0); 550 node_set_online(0);
551 node_set(0, node_possible_map); 551 node_set(0, node_possible_map);
552 for (i = 0; i < NR_CPUS; i++) 552 for (i = 0; i < nr_cpu_ids; i++)
553 numa_set_node(i, 0); 553 numa_set_node(i, 0);
554 e820_register_active_regions(0, start_pfn, last_pfn); 554 e820_register_active_regions(0, start_pfn, last_pfn);
555 setup_node_bootmem(0, start_pfn << PAGE_SHIFT, last_pfn << PAGE_SHIFT); 555 setup_node_bootmem(0, start_pfn << PAGE_SHIFT, last_pfn << PAGE_SHIFT);
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index eb1bf000d12e..85cbd3cd3723 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -596,6 +596,242 @@ void unmap_devmem(unsigned long pfn, unsigned long size, pgprot_t vma_prot)
596 free_memtype(addr, addr + size); 596 free_memtype(addr, addr + size);
597} 597}
598 598
599/*
600 * Internal interface to reserve a range of physical memory with prot.
601 * Reserved non RAM regions only and after successful reserve_memtype,
602 * this func also keeps identity mapping (if any) in sync with this new prot.
603 */
604static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t vma_prot)
605{
606 int is_ram = 0;
607 int id_sz, ret;
608 unsigned long flags;
609 unsigned long want_flags = (pgprot_val(vma_prot) & _PAGE_CACHE_MASK);
610
611 is_ram = pagerange_is_ram(paddr, paddr + size);
612
613 if (is_ram != 0) {
614 /*
615 * For mapping RAM pages, drivers need to call
616 * set_memory_[uc|wc|wb] directly, for reserve and free, before
617 * setting up the PTE.
618 */
619 WARN_ON_ONCE(1);
620 return 0;
621 }
622
623 ret = reserve_memtype(paddr, paddr + size, want_flags, &flags);
624 if (ret)
625 return ret;
626
627 if (flags != want_flags) {
628 free_memtype(paddr, paddr + size);
629 printk(KERN_ERR
630 "%s:%d map pfn expected mapping type %s for %Lx-%Lx, got %s\n",
631 current->comm, current->pid,
632 cattr_name(want_flags),
633 (unsigned long long)paddr,
634 (unsigned long long)(paddr + size),
635 cattr_name(flags));
636 return -EINVAL;
637 }
638
639 /* Need to keep identity mapping in sync */
640 if (paddr >= __pa(high_memory))
641 return 0;
642
643 id_sz = (__pa(high_memory) < paddr + size) ?
644 __pa(high_memory) - paddr :
645 size;
646
647 if (ioremap_change_attr((unsigned long)__va(paddr), id_sz, flags) < 0) {
648 free_memtype(paddr, paddr + size);
649 printk(KERN_ERR
650 "%s:%d reserve_pfn_range ioremap_change_attr failed %s "
651 "for %Lx-%Lx\n",
652 current->comm, current->pid,
653 cattr_name(flags),
654 (unsigned long long)paddr,
655 (unsigned long long)(paddr + size));
656 return -EINVAL;
657 }
658 return 0;
659}
660
661/*
662 * Internal interface to free a range of physical memory.
663 * Frees non RAM regions only.
664 */
665static void free_pfn_range(u64 paddr, unsigned long size)
666{
667 int is_ram;
668
669 is_ram = pagerange_is_ram(paddr, paddr + size);
670 if (is_ram == 0)
671 free_memtype(paddr, paddr + size);
672}
673
674/*
675 * track_pfn_vma_copy is called when vma that is covering the pfnmap gets
676 * copied through copy_page_range().
677 *
678 * If the vma has a linear pfn mapping for the entire range, we get the prot
679 * from pte and reserve the entire vma range with single reserve_pfn_range call.
680 * Otherwise, we reserve the entire vma range, my ging through the PTEs page
681 * by page to get physical address and protection.
682 */
683int track_pfn_vma_copy(struct vm_area_struct *vma)
684{
685 int retval = 0;
686 unsigned long i, j;
687 resource_size_t paddr;
688 unsigned long prot;
689 unsigned long vma_start = vma->vm_start;
690 unsigned long vma_end = vma->vm_end;
691 unsigned long vma_size = vma_end - vma_start;
692
693 if (!pat_enabled)
694 return 0;
695
696 if (is_linear_pfn_mapping(vma)) {
697 /*
698 * reserve the whole chunk covered by vma. We need the
699 * starting address and protection from pte.
700 */
701 if (follow_phys(vma, vma_start, 0, &prot, &paddr)) {
702 WARN_ON_ONCE(1);
703 return -EINVAL;
704 }
705 return reserve_pfn_range(paddr, vma_size, __pgprot(prot));
706 }
707
708 /* reserve entire vma page by page, using pfn and prot from pte */
709 for (i = 0; i < vma_size; i += PAGE_SIZE) {
710 if (follow_phys(vma, vma_start + i, 0, &prot, &paddr))
711 continue;
712
713 retval = reserve_pfn_range(paddr, PAGE_SIZE, __pgprot(prot));
714 if (retval)
715 goto cleanup_ret;
716 }
717 return 0;
718
719cleanup_ret:
720 /* Reserve error: Cleanup partial reservation and return error */
721 for (j = 0; j < i; j += PAGE_SIZE) {
722 if (follow_phys(vma, vma_start + j, 0, &prot, &paddr))
723 continue;
724
725 free_pfn_range(paddr, PAGE_SIZE);
726 }
727
728 return retval;
729}
730
731/*
732 * track_pfn_vma_new is called when a _new_ pfn mapping is being established
733 * for physical range indicated by pfn and size.
734 *
735 * prot is passed in as a parameter for the new mapping. If the vma has a
736 * linear pfn mapping for the entire range reserve the entire vma range with
737 * single reserve_pfn_range call.
738 * Otherwise, we look t the pfn and size and reserve only the specified range
739 * page by page.
740 *
741 * Note that this function can be called with caller trying to map only a
742 * subrange/page inside the vma.
743 */
744int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t prot,
745 unsigned long pfn, unsigned long size)
746{
747 int retval = 0;
748 unsigned long i, j;
749 resource_size_t base_paddr;
750 resource_size_t paddr;
751 unsigned long vma_start = vma->vm_start;
752 unsigned long vma_end = vma->vm_end;
753 unsigned long vma_size = vma_end - vma_start;
754
755 if (!pat_enabled)
756 return 0;
757
758 if (is_linear_pfn_mapping(vma)) {
759 /* reserve the whole chunk starting from vm_pgoff */
760 paddr = (resource_size_t)vma->vm_pgoff << PAGE_SHIFT;
761 return reserve_pfn_range(paddr, vma_size, prot);
762 }
763
764 /* reserve page by page using pfn and size */
765 base_paddr = (resource_size_t)pfn << PAGE_SHIFT;
766 for (i = 0; i < size; i += PAGE_SIZE) {
767 paddr = base_paddr + i;
768 retval = reserve_pfn_range(paddr, PAGE_SIZE, prot);
769 if (retval)
770 goto cleanup_ret;
771 }
772 return 0;
773
774cleanup_ret:
775 /* Reserve error: Cleanup partial reservation and return error */
776 for (j = 0; j < i; j += PAGE_SIZE) {
777 paddr = base_paddr + j;
778 free_pfn_range(paddr, PAGE_SIZE);
779 }
780
781 return retval;
782}
783
784/*
785 * untrack_pfn_vma is called while unmapping a pfnmap for a region.
786 * untrack can be called for a specific region indicated by pfn and size or
787 * can be for the entire vma (in which case size can be zero).
788 */
789void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn,
790 unsigned long size)
791{
792 unsigned long i;
793 resource_size_t paddr;
794 unsigned long prot;
795 unsigned long vma_start = vma->vm_start;
796 unsigned long vma_end = vma->vm_end;
797 unsigned long vma_size = vma_end - vma_start;
798
799 if (!pat_enabled)
800 return;
801
802 if (is_linear_pfn_mapping(vma)) {
803 /* free the whole chunk starting from vm_pgoff */
804 paddr = (resource_size_t)vma->vm_pgoff << PAGE_SHIFT;
805 free_pfn_range(paddr, vma_size);
806 return;
807 }
808
809 if (size != 0 && size != vma_size) {
810 /* free page by page, using pfn and size */
811 paddr = (resource_size_t)pfn << PAGE_SHIFT;
812 for (i = 0; i < size; i += PAGE_SIZE) {
813 paddr = paddr + i;
814 free_pfn_range(paddr, PAGE_SIZE);
815 }
816 } else {
817 /* free entire vma, page by page, using the pfn from pte */
818 for (i = 0; i < vma_size; i += PAGE_SIZE) {
819 if (follow_phys(vma, vma_start + i, 0, &prot, &paddr))
820 continue;
821
822 free_pfn_range(paddr, PAGE_SIZE);
823 }
824 }
825}
826
827pgprot_t pgprot_writecombine(pgprot_t prot)
828{
829 if (pat_enabled)
830 return __pgprot(pgprot_val(prot) | _PAGE_CACHE_WC);
831 else
832 return pgprot_noncached(prot);
833}
834
599#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_X86_PAT) 835#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_X86_PAT)
600 836
601/* get Nth element of the linked list */ 837/* get Nth element of the linked list */
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c
index 51c0a2fc14fe..09737c8af074 100644
--- a/arch/x86/mm/srat_64.c
+++ b/arch/x86/mm/srat_64.c
@@ -382,7 +382,7 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
382 if (!node_online(i)) 382 if (!node_online(i))
383 setup_node_bootmem(i, nodes[i].start, nodes[i].end); 383 setup_node_bootmem(i, nodes[i].start, nodes[i].end);
384 384
385 for (i = 0; i < NR_CPUS; i++) { 385 for (i = 0; i < nr_cpu_ids; i++) {
386 int node = early_cpu_to_node(i); 386 int node = early_cpu_to_node(i);
387 387
388 if (node == NUMA_NO_NODE) 388 if (node == NUMA_NO_NODE)
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c
index 509513760a6e..98658f25f542 100644
--- a/arch/x86/oprofile/op_model_amd.c
+++ b/arch/x86/oprofile/op_model_amd.c
@@ -65,11 +65,13 @@ static unsigned long reset_value[NUM_COUNTERS];
65#define IBS_FETCH_BEGIN 3 65#define IBS_FETCH_BEGIN 3
66#define IBS_OP_BEGIN 4 66#define IBS_OP_BEGIN 4
67 67
68/* The function interface needs to be fixed, something like add 68/*
69 data. Should then be added to linux/oprofile.h. */ 69 * The function interface needs to be fixed, something like add
70 * data. Should then be added to linux/oprofile.h.
71 */
70extern void 72extern void
71oprofile_add_ibs_sample(struct pt_regs *const regs, 73oprofile_add_ibs_sample(struct pt_regs * const regs,
72 unsigned int *const ibs_sample, int ibs_code); 74 unsigned int * const ibs_sample, int ibs_code);
73 75
74struct ibs_fetch_sample { 76struct ibs_fetch_sample {
75 /* MSRC001_1031 IBS Fetch Linear Address Register */ 77 /* MSRC001_1031 IBS Fetch Linear Address Register */
@@ -104,11 +106,6 @@ struct ibs_op_sample {
104 unsigned int ibs_dc_phys_high; 106 unsigned int ibs_dc_phys_high;
105}; 107};
106 108
107/*
108 * unitialize the APIC for the IBS interrupts if needed on AMD Family10h+
109*/
110static void clear_ibs_nmi(void);
111
112static int ibs_allowed; /* AMD Family10h and later */ 109static int ibs_allowed; /* AMD Family10h and later */
113 110
114struct op_ibs_config { 111struct op_ibs_config {
@@ -223,7 +220,7 @@ op_amd_handle_ibs(struct pt_regs * const regs,
223 (unsigned int *)&ibs_fetch, 220 (unsigned int *)&ibs_fetch,
224 IBS_FETCH_BEGIN); 221 IBS_FETCH_BEGIN);
225 222
226 /*reenable the IRQ */ 223 /* reenable the IRQ */
227 rdmsr(MSR_AMD64_IBSFETCHCTL, low, high); 224 rdmsr(MSR_AMD64_IBSFETCHCTL, low, high);
228 high &= ~IBS_FETCH_HIGH_VALID_BIT; 225 high &= ~IBS_FETCH_HIGH_VALID_BIT;
229 high |= IBS_FETCH_HIGH_ENABLE; 226 high |= IBS_FETCH_HIGH_ENABLE;
@@ -331,8 +328,10 @@ static void op_amd_stop(struct op_msrs const * const msrs)
331 unsigned int low, high; 328 unsigned int low, high;
332 int i; 329 int i;
333 330
334 /* Subtle: stop on all counters to avoid race with 331 /*
335 * setting our pm callback */ 332 * Subtle: stop on all counters to avoid race with setting our
333 * pm callback
334 */
336 for (i = 0 ; i < NUM_COUNTERS ; ++i) { 335 for (i = 0 ; i < NUM_COUNTERS ; ++i) {
337 if (!reset_value[i]) 336 if (!reset_value[i])
338 continue; 337 continue;
@@ -343,13 +342,15 @@ static void op_amd_stop(struct op_msrs const * const msrs)
343 342
344#ifdef CONFIG_OPROFILE_IBS 343#ifdef CONFIG_OPROFILE_IBS
345 if (ibs_allowed && ibs_config.fetch_enabled) { 344 if (ibs_allowed && ibs_config.fetch_enabled) {
346 low = 0; /* clear max count and enable */ 345 /* clear max count and enable */
346 low = 0;
347 high = 0; 347 high = 0;
348 wrmsr(MSR_AMD64_IBSFETCHCTL, low, high); 348 wrmsr(MSR_AMD64_IBSFETCHCTL, low, high);
349 } 349 }
350 350
351 if (ibs_allowed && ibs_config.op_enabled) { 351 if (ibs_allowed && ibs_config.op_enabled) {
352 low = 0; /* clear max count and enable */ 352 /* clear max count and enable */
353 low = 0;
353 high = 0; 354 high = 0;
354 wrmsr(MSR_AMD64_IBSOPCTL, low, high); 355 wrmsr(MSR_AMD64_IBSOPCTL, low, high);
355 } 356 }
@@ -370,18 +371,7 @@ static void op_amd_shutdown(struct op_msrs const * const msrs)
370 } 371 }
371} 372}
372 373
373#ifndef CONFIG_OPROFILE_IBS 374#ifdef CONFIG_OPROFILE_IBS
374
375/* no IBS support */
376
377static int op_amd_init(struct oprofile_operations *ops)
378{
379 return 0;
380}
381
382static void op_amd_exit(void) {}
383
384#else
385 375
386static u8 ibs_eilvt_off; 376static u8 ibs_eilvt_off;
387 377
@@ -395,7 +385,7 @@ static inline void apic_clear_ibs_nmi_per_cpu(void *arg)
395 setup_APIC_eilvt_ibs(0, APIC_EILVT_MSG_FIX, 1); 385 setup_APIC_eilvt_ibs(0, APIC_EILVT_MSG_FIX, 1);
396} 386}
397 387
398static int pfm_amd64_setup_eilvt(void) 388static int init_ibs_nmi(void)
399{ 389{
400#define IBSCTL_LVTOFFSETVAL (1 << 8) 390#define IBSCTL_LVTOFFSETVAL (1 << 8)
401#define IBSCTL 0x1cc 391#define IBSCTL 0x1cc
@@ -443,18 +433,22 @@ static int pfm_amd64_setup_eilvt(void)
443 return 0; 433 return 0;
444} 434}
445 435
446/* 436/* uninitialize the APIC for the IBS interrupts if needed */
447 * initialize the APIC for the IBS interrupts 437static void clear_ibs_nmi(void)
448 * if available (AMD Family10h rev B0 and later) 438{
449 */ 439 if (ibs_allowed)
450static void setup_ibs(void) 440 on_each_cpu(apic_clear_ibs_nmi_per_cpu, NULL, 1);
441}
442
443/* initialize the APIC for the IBS interrupts if available */
444static void ibs_init(void)
451{ 445{
452 ibs_allowed = boot_cpu_has(X86_FEATURE_IBS); 446 ibs_allowed = boot_cpu_has(X86_FEATURE_IBS);
453 447
454 if (!ibs_allowed) 448 if (!ibs_allowed)
455 return; 449 return;
456 450
457 if (pfm_amd64_setup_eilvt()) { 451 if (init_ibs_nmi()) {
458 ibs_allowed = 0; 452 ibs_allowed = 0;
459 return; 453 return;
460 } 454 }
@@ -462,14 +456,12 @@ static void setup_ibs(void)
462 printk(KERN_INFO "oprofile: AMD IBS detected\n"); 456 printk(KERN_INFO "oprofile: AMD IBS detected\n");
463} 457}
464 458
465 459static void ibs_exit(void)
466/*
467 * unitialize the APIC for the IBS interrupts if needed on AMD Family10h
468 * rev B0 and later */
469static void clear_ibs_nmi(void)
470{ 460{
471 if (ibs_allowed) 461 if (!ibs_allowed)
472 on_each_cpu(apic_clear_ibs_nmi_per_cpu, NULL, 1); 462 return;
463
464 clear_ibs_nmi();
473} 465}
474 466
475static int (*create_arch_files)(struct super_block *sb, struct dentry *root); 467static int (*create_arch_files)(struct super_block *sb, struct dentry *root);
@@ -519,7 +511,7 @@ static int setup_ibs_files(struct super_block *sb, struct dentry *root)
519 511
520static int op_amd_init(struct oprofile_operations *ops) 512static int op_amd_init(struct oprofile_operations *ops)
521{ 513{
522 setup_ibs(); 514 ibs_init();
523 create_arch_files = ops->create_files; 515 create_arch_files = ops->create_files;
524 ops->create_files = setup_ibs_files; 516 ops->create_files = setup_ibs_files;
525 return 0; 517 return 0;
@@ -527,10 +519,21 @@ static int op_amd_init(struct oprofile_operations *ops)
527 519
528static void op_amd_exit(void) 520static void op_amd_exit(void)
529{ 521{
530 clear_ibs_nmi(); 522 ibs_exit();
531} 523}
532 524
533#endif 525#else
526
527/* no IBS support */
528
529static int op_amd_init(struct oprofile_operations *ops)
530{
531 return 0;
532}
533
534static void op_amd_exit(void) {}
535
536#endif /* CONFIG_OPROFILE_IBS */
534 537
535struct op_x86_model_spec const op_amd_spec = { 538struct op_x86_model_spec const op_amd_spec = {
536 .init = op_amd_init, 539 .init = op_amd_init,
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 1d88d2b39771..9e5752fe4d15 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -4,7 +4,7 @@
4#include <linux/irq.h> 4#include <linux/irq.h>
5#include <linux/dmi.h> 5#include <linux/dmi.h>
6#include <asm/numa.h> 6#include <asm/numa.h>
7#include "pci.h" 7#include <asm/pci_x86.h>
8 8
9struct pci_root_info { 9struct pci_root_info {
10 char *name; 10 char *name;
diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
index 22e057665e55..9bb09823b362 100644
--- a/arch/x86/pci/amd_bus.c
+++ b/arch/x86/pci/amd_bus.c
@@ -2,7 +2,7 @@
2#include <linux/pci.h> 2#include <linux/pci.h>
3#include <linux/topology.h> 3#include <linux/topology.h>
4#include <linux/cpu.h> 4#include <linux/cpu.h>
5#include "pci.h" 5#include <asm/pci_x86.h>
6 6
7#ifdef CONFIG_X86_64 7#ifdef CONFIG_X86_64
8#include <asm/pci-direct.h> 8#include <asm/pci-direct.h>
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index b67732bbb85a..62ddb73e09ed 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -14,8 +14,7 @@
14#include <asm/segment.h> 14#include <asm/segment.h>
15#include <asm/io.h> 15#include <asm/io.h>
16#include <asm/smp.h> 16#include <asm/smp.h>
17 17#include <asm/pci_x86.h>
18#include "pci.h"
19 18
20unsigned int pci_probe = PCI_PROBE_BIOS | PCI_PROBE_CONF1 | PCI_PROBE_CONF2 | 19unsigned int pci_probe = PCI_PROBE_BIOS | PCI_PROBE_CONF1 | PCI_PROBE_CONF2 |
21 PCI_PROBE_MMCONF; 20 PCI_PROBE_MMCONF;
@@ -23,6 +22,12 @@ unsigned int pci_probe = PCI_PROBE_BIOS | PCI_PROBE_CONF1 | PCI_PROBE_CONF2 |
23unsigned int pci_early_dump_regs; 22unsigned int pci_early_dump_regs;
24static int pci_bf_sort; 23static int pci_bf_sort;
25int pci_routeirq; 24int pci_routeirq;
25int noioapicquirk;
26#ifdef CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS
27int noioapicreroute = 0;
28#else
29int noioapicreroute = 1;
30#endif
26int pcibios_last_bus = -1; 31int pcibios_last_bus = -1;
27unsigned long pirq_table_addr; 32unsigned long pirq_table_addr;
28struct pci_bus *pci_root_bus; 33struct pci_bus *pci_root_bus;
@@ -519,6 +524,17 @@ char * __devinit pcibios_setup(char *str)
519 } else if (!strcmp(str, "skip_isa_align")) { 524 } else if (!strcmp(str, "skip_isa_align")) {
520 pci_probe |= PCI_CAN_SKIP_ISA_ALIGN; 525 pci_probe |= PCI_CAN_SKIP_ISA_ALIGN;
521 return NULL; 526 return NULL;
527 } else if (!strcmp(str, "noioapicquirk")) {
528 noioapicquirk = 1;
529 return NULL;
530 } else if (!strcmp(str, "ioapicreroute")) {
531 if (noioapicreroute != -1)
532 noioapicreroute = 0;
533 return NULL;
534 } else if (!strcmp(str, "noioapicreroute")) {
535 if (noioapicreroute != -1)
536 noioapicreroute = 1;
537 return NULL;
522 } 538 }
523 return str; 539 return str;
524} 540}
diff --git a/arch/x86/pci/direct.c b/arch/x86/pci/direct.c
index 9915293500fb..bd13c3e4c6db 100644
--- a/arch/x86/pci/direct.c
+++ b/arch/x86/pci/direct.c
@@ -5,7 +5,7 @@
5#include <linux/pci.h> 5#include <linux/pci.h>
6#include <linux/init.h> 6#include <linux/init.h>
7#include <linux/dmi.h> 7#include <linux/dmi.h>
8#include "pci.h" 8#include <asm/pci_x86.h>
9 9
10/* 10/*
11 * Functions for accessing PCI base (first 256 bytes) and extended 11 * Functions for accessing PCI base (first 256 bytes) and extended
@@ -173,7 +173,7 @@ static int pci_conf2_write(unsigned int seg, unsigned int bus,
173 173
174#undef PCI_CONF2_ADDRESS 174#undef PCI_CONF2_ADDRESS
175 175
176static struct pci_raw_ops pci_direct_conf2 = { 176struct pci_raw_ops pci_direct_conf2 = {
177 .read = pci_conf2_read, 177 .read = pci_conf2_read,
178 .write = pci_conf2_write, 178 .write = pci_conf2_write,
179}; 179};
@@ -289,6 +289,7 @@ int __init pci_direct_probe(void)
289 289
290 if (pci_check_type1()) { 290 if (pci_check_type1()) {
291 raw_pci_ops = &pci_direct_conf1; 291 raw_pci_ops = &pci_direct_conf1;
292 port_cf9_safe = true;
292 return 1; 293 return 1;
293 } 294 }
294 release_resource(region); 295 release_resource(region);
@@ -305,6 +306,7 @@ int __init pci_direct_probe(void)
305 306
306 if (pci_check_type2()) { 307 if (pci_check_type2()) {
307 raw_pci_ops = &pci_direct_conf2; 308 raw_pci_ops = &pci_direct_conf2;
309 port_cf9_safe = true;
308 return 2; 310 return 2;
309 } 311 }
310 312
diff --git a/arch/x86/pci/early.c b/arch/x86/pci/early.c
index 86631ccbc25a..f6adf2c6d751 100644
--- a/arch/x86/pci/early.c
+++ b/arch/x86/pci/early.c
@@ -2,7 +2,7 @@
2#include <linux/pci.h> 2#include <linux/pci.h>
3#include <asm/pci-direct.h> 3#include <asm/pci-direct.h>
4#include <asm/io.h> 4#include <asm/io.h>
5#include "pci.h" 5#include <asm/pci_x86.h>
6 6
7/* Direct PCI access. This is used for PCI accesses in early boot before 7/* Direct PCI access. This is used for PCI accesses in early boot before
8 the PCI subsystem works. */ 8 the PCI subsystem works. */
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index 2051dc96b8e9..7d388d5cf548 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -6,8 +6,7 @@
6#include <linux/dmi.h> 6#include <linux/dmi.h>
7#include <linux/pci.h> 7#include <linux/pci.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include "pci.h" 9#include <asm/pci_x86.h>
10
11 10
12static void __devinit pci_fixup_i450nx(struct pci_dev *d) 11static void __devinit pci_fixup_i450nx(struct pci_dev *d)
13{ 12{
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 844df0cbbd3e..e51bf2cda4b0 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -34,8 +34,8 @@
34 34
35#include <asm/pat.h> 35#include <asm/pat.h>
36#include <asm/e820.h> 36#include <asm/e820.h>
37#include <asm/pci_x86.h>
37 38
38#include "pci.h"
39 39
40static int 40static int
41skip_isa_ioresource_align(struct pci_dev *dev) { 41skip_isa_ioresource_align(struct pci_dev *dev) {
diff --git a/arch/x86/pci/init.c b/arch/x86/pci/init.c
index d6c950f81858..bec3b048e72b 100644
--- a/arch/x86/pci/init.c
+++ b/arch/x86/pci/init.c
@@ -1,6 +1,6 @@
1#include <linux/pci.h> 1#include <linux/pci.h>
2#include <linux/init.h> 2#include <linux/init.h>
3#include "pci.h" 3#include <asm/pci_x86.h>
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. */
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index bf69dbe08bff..373b9afe6d44 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -16,8 +16,7 @@
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>
19 19#include <asm/pci_x86.h>
20#include "pci.h"
21 20
22#define PIRQ_SIGNATURE (('$' << 0) + ('P' << 8) + ('I' << 16) + ('R' << 24)) 21#define PIRQ_SIGNATURE (('$' << 0) + ('P' << 8) + ('I' << 16) + ('R' << 24))
23#define PIRQ_VERSION 0x0100 22#define PIRQ_VERSION 0x0100
diff --git a/arch/x86/pci/legacy.c b/arch/x86/pci/legacy.c
index b722dd481b39..f1065b129e9c 100644
--- a/arch/x86/pci/legacy.c
+++ b/arch/x86/pci/legacy.c
@@ -3,7 +3,7 @@
3 */ 3 */
4#include <linux/init.h> 4#include <linux/init.h>
5#include <linux/pci.h> 5#include <linux/pci.h>
6#include "pci.h" 6#include <asm/pci_x86.h>
7 7
8/* 8/*
9 * Discover remaining PCI buses in case there are peer host bridges. 9 * Discover remaining PCI buses in case there are peer host bridges.
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index 654a2234f8f3..89bf9242c80a 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -15,8 +15,7 @@
15#include <linux/acpi.h> 15#include <linux/acpi.h>
16#include <linux/bitmap.h> 16#include <linux/bitmap.h>
17#include <asm/e820.h> 17#include <asm/e820.h>
18 18#include <asm/pci_x86.h>
19#include "pci.h"
20 19
21/* aperture is up to 256MB but BIOS may reserve less */ 20/* aperture is up to 256MB but BIOS may reserve less */
22#define MMCONFIG_APER_MIN (2 * 1024*1024) 21#define MMCONFIG_APER_MIN (2 * 1024*1024)
diff --git a/arch/x86/pci/mmconfig_32.c b/arch/x86/pci/mmconfig_32.c
index f3c761dce695..8b2d561046a3 100644
--- a/arch/x86/pci/mmconfig_32.c
+++ b/arch/x86/pci/mmconfig_32.c
@@ -13,7 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/acpi.h> 14#include <linux/acpi.h>
15#include <asm/e820.h> 15#include <asm/e820.h>
16#include "pci.h" 16#include <asm/pci_x86.h>
17 17
18/* Assume systems with more busses have correct MCFG */ 18/* Assume systems with more busses have correct MCFG */
19#define mmcfg_virt_addr ((void __iomem *) fix_to_virt(FIX_PCIE_MCFG)) 19#define mmcfg_virt_addr ((void __iomem *) fix_to_virt(FIX_PCIE_MCFG))
diff --git a/arch/x86/pci/mmconfig_64.c b/arch/x86/pci/mmconfig_64.c
index a1994163c99d..30007ffc8e11 100644
--- a/arch/x86/pci/mmconfig_64.c
+++ b/arch/x86/pci/mmconfig_64.c
@@ -10,8 +10,7 @@
10#include <linux/acpi.h> 10#include <linux/acpi.h>
11#include <linux/bitmap.h> 11#include <linux/bitmap.h>
12#include <asm/e820.h> 12#include <asm/e820.h>
13 13#include <asm/pci_x86.h>
14#include "pci.h"
15 14
16/* Static virtual mapping of the MMCONFIG aperture */ 15/* Static virtual mapping of the MMCONFIG aperture */
17struct mmcfg_virt { 16struct mmcfg_virt {
diff --git a/arch/x86/pci/numaq_32.c b/arch/x86/pci/numaq_32.c
index 1177845d3186..2089354968a2 100644
--- a/arch/x86/pci/numaq_32.c
+++ b/arch/x86/pci/numaq_32.c
@@ -7,7 +7,7 @@
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 <asm/mpspec.h>
10#include "pci.h" 10#include <asm/pci_x86.h>
11 11
12#define XQUAD_PORTIO_BASE 0xfe400000 12#define XQUAD_PORTIO_BASE 0xfe400000
13#define XQUAD_PORTIO_QUAD 0x40000 /* 256k per quad. */ 13#define XQUAD_PORTIO_QUAD 0x40000 /* 256k per quad. */
diff --git a/arch/x86/pci/olpc.c b/arch/x86/pci/olpc.c
index e11e9e803d5f..b889d824f7c6 100644
--- a/arch/x86/pci/olpc.c
+++ b/arch/x86/pci/olpc.c
@@ -29,7 +29,7 @@
29#include <linux/init.h> 29#include <linux/init.h>
30#include <asm/olpc.h> 30#include <asm/olpc.h>
31#include <asm/geode.h> 31#include <asm/geode.h>
32#include "pci.h" 32#include <asm/pci_x86.h>
33 33
34/* 34/*
35 * In the tables below, the first two line (8 longwords) are the 35 * In the tables below, the first two line (8 longwords) are the
diff --git a/arch/x86/pci/pcbios.c b/arch/x86/pci/pcbios.c
index 37472fc6f729..b82cae970dfd 100644
--- a/arch/x86/pci/pcbios.c
+++ b/arch/x86/pci/pcbios.c
@@ -6,9 +6,8 @@
6#include <linux/init.h> 6#include <linux/init.h>
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/uaccess.h> 8#include <linux/uaccess.h>
9#include "pci.h" 9#include <asm/pci_x86.h>
10#include "pci-functions.h" 10#include <asm/mach-default/pci-functions.h>
11
12 11
13/* BIOS32 signature: "_32_" */ 12/* BIOS32 signature: "_32_" */
14#define BIOS32_SIGNATURE (('_' << 0) + ('3' << 8) + ('2' << 16) + ('_' << 24)) 13#define BIOS32_SIGNATURE (('_' << 0) + ('3' << 8) + ('2' << 16) + ('_' << 24))
diff --git a/arch/x86/pci/visws.c b/arch/x86/pci/visws.c
index 42f4cb19faca..16d0c0eb0d19 100644
--- a/arch/x86/pci/visws.c
+++ b/arch/x86/pci/visws.c
@@ -9,11 +9,10 @@
9#include <linux/init.h> 9#include <linux/init.h>
10 10
11#include <asm/setup.h> 11#include <asm/setup.h>
12#include <asm/pci_x86.h>
12#include <asm/visws/cobalt.h> 13#include <asm/visws/cobalt.h>
13#include <asm/visws/lithium.h> 14#include <asm/visws/lithium.h>
14 15
15#include "pci.h"
16
17static int pci_visws_enable_irq(struct pci_dev *dev) { return 0; } 16static int pci_visws_enable_irq(struct pci_dev *dev) { return 0; }
18static void pci_visws_disable_irq(struct pci_dev *dev) { } 17static void pci_visws_disable_irq(struct pci_dev *dev) { }
19 18
diff --git a/arch/x86/scripts/strip-symbols b/arch/x86/scripts/strip-symbols
new file mode 100644
index 000000000000..a2f1ccb827c7
--- /dev/null
+++ b/arch/x86/scripts/strip-symbols
@@ -0,0 +1 @@
__cpu_vendor_dev_X86_VENDOR_*
diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
index 1ef0f90813d6..d9d35824c56f 100644
--- a/arch/x86/vdso/vclock_gettime.c
+++ b/arch/x86/vdso/vclock_gettime.c
@@ -9,6 +9,9 @@
9 * Also alternative() doesn't work. 9 * Also alternative() doesn't work.
10 */ 10 */
11 11
12/* Disable profiling for userspace code: */
13#define DISABLE_BRANCH_PROFILING
14
12#include <linux/kernel.h> 15#include <linux/kernel.h>
13#include <linux/posix-timers.h> 16#include <linux/posix-timers.h>
14#include <linux/time.h> 17#include <linux/time.h>
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index 513f330c5832..1241f118ab56 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -310,7 +310,7 @@ int __init sysenter_setup(void)
310} 310}
311 311
312/* Setup a VMA at program startup for the vsyscall page */ 312/* Setup a VMA at program startup for the vsyscall page */
313int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack) 313int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
314{ 314{
315 struct mm_struct *mm = current->mm; 315 struct mm_struct *mm = current->mm;
316 unsigned long addr; 316 unsigned long addr;
diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c
index 257ba4a10abf..9c98cc6ba978 100644
--- a/arch/x86/vdso/vma.c
+++ b/arch/x86/vdso/vma.c
@@ -98,7 +98,7 @@ static unsigned long vdso_addr(unsigned long start, unsigned len)
98 98
99/* Setup a VMA at program startup for the vsyscall page. 99/* Setup a VMA at program startup for the vsyscall page.
100 Not called for compat tasks */ 100 Not called for compat tasks */
101int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack) 101int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
102{ 102{
103 struct mm_struct *mm = current->mm; 103 struct mm_struct *mm = current->mm;
104 unsigned long addr; 104 unsigned long addr;
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 5e4686d70f62..bea215230b20 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -28,6 +28,7 @@
28#include <linux/console.h> 28#include <linux/console.h>
29 29
30#include <xen/interface/xen.h> 30#include <xen/interface/xen.h>
31#include <xen/interface/version.h>
31#include <xen/interface/physdev.h> 32#include <xen/interface/physdev.h>
32#include <xen/interface/vcpu.h> 33#include <xen/interface/vcpu.h>
33#include <xen/features.h> 34#include <xen/features.h>
@@ -793,7 +794,7 @@ static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
793 794
794 ret = 0; 795 ret = 0;
795 796
796 switch(msr) { 797 switch (msr) {
797#ifdef CONFIG_X86_64 798#ifdef CONFIG_X86_64
798 unsigned which; 799 unsigned which;
799 u64 base; 800 u64 base;
@@ -1453,7 +1454,7 @@ static __init void xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn)
1453 1454
1454 ident_pte = 0; 1455 ident_pte = 0;
1455 pfn = 0; 1456 pfn = 0;
1456 for(pmdidx = 0; pmdidx < PTRS_PER_PMD && pfn < max_pfn; pmdidx++) { 1457 for (pmdidx = 0; pmdidx < PTRS_PER_PMD && pfn < max_pfn; pmdidx++) {
1457 pte_t *pte_page; 1458 pte_t *pte_page;
1458 1459
1459 /* Reuse or allocate a page of ptes */ 1460 /* Reuse or allocate a page of ptes */
@@ -1471,7 +1472,7 @@ static __init void xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn)
1471 } 1472 }
1472 1473
1473 /* Install mappings */ 1474 /* Install mappings */
1474 for(pteidx = 0; pteidx < PTRS_PER_PTE; pteidx++, pfn++) { 1475 for (pteidx = 0; pteidx < PTRS_PER_PTE; pteidx++, pfn++) {
1475 pte_t pte; 1476 pte_t pte;
1476 1477
1477 if (pfn > max_pfn_mapped) 1478 if (pfn > max_pfn_mapped)
@@ -1485,7 +1486,7 @@ static __init void xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn)
1485 } 1486 }
1486 } 1487 }
1487 1488
1488 for(pteidx = 0; pteidx < ident_pte; pteidx += PTRS_PER_PTE) 1489 for (pteidx = 0; pteidx < ident_pte; pteidx += PTRS_PER_PTE)
1489 set_page_prot(&level1_ident_pgt[pteidx], PAGE_KERNEL_RO); 1490 set_page_prot(&level1_ident_pgt[pteidx], PAGE_KERNEL_RO);
1490 1491
1491 set_page_prot(pmd, PAGE_KERNEL_RO); 1492 set_page_prot(pmd, PAGE_KERNEL_RO);
@@ -1499,7 +1500,7 @@ static void convert_pfn_mfn(void *v)
1499 1500
1500 /* All levels are converted the same way, so just treat them 1501 /* All levels are converted the same way, so just treat them
1501 as ptes. */ 1502 as ptes. */
1502 for(i = 0; i < PTRS_PER_PTE; i++) 1503 for (i = 0; i < PTRS_PER_PTE; i++)
1503 pte[i] = xen_make_pte(pte[i].pte); 1504 pte[i] = xen_make_pte(pte[i].pte);
1504} 1505}
1505 1506
@@ -1514,7 +1515,8 @@ static void convert_pfn_mfn(void *v)
1514 * of the physical mapping once some sort of allocator has been set 1515 * of the physical mapping once some sort of allocator has been set
1515 * up. 1516 * up.
1516 */ 1517 */
1517static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) 1518static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd,
1519 unsigned long max_pfn)
1518{ 1520{
1519 pud_t *l3; 1521 pud_t *l3;
1520 pmd_t *l2; 1522 pmd_t *l2;
@@ -1577,7 +1579,8 @@ static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pf
1577#else /* !CONFIG_X86_64 */ 1579#else /* !CONFIG_X86_64 */
1578static pmd_t level2_kernel_pgt[PTRS_PER_PMD] __page_aligned_bss; 1580static pmd_t level2_kernel_pgt[PTRS_PER_PMD] __page_aligned_bss;
1579 1581
1580static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) 1582static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd,
1583 unsigned long max_pfn)
1581{ 1584{
1582 pmd_t *kernel_pmd; 1585 pmd_t *kernel_pmd;
1583 1586
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 636ef4caa52d..503c240e26c7 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -154,13 +154,13 @@ void xen_setup_mfn_list_list(void)
154{ 154{
155 unsigned pfn, idx; 155 unsigned pfn, idx;
156 156
157 for(pfn = 0; pfn < MAX_DOMAIN_PAGES; pfn += P2M_ENTRIES_PER_PAGE) { 157 for (pfn = 0; pfn < MAX_DOMAIN_PAGES; pfn += P2M_ENTRIES_PER_PAGE) {
158 unsigned topidx = p2m_top_index(pfn); 158 unsigned topidx = p2m_top_index(pfn);
159 159
160 p2m_top_mfn[topidx] = virt_to_mfn(p2m_top[topidx]); 160 p2m_top_mfn[topidx] = virt_to_mfn(p2m_top[topidx]);
161 } 161 }
162 162
163 for(idx = 0; idx < ARRAY_SIZE(p2m_top_mfn_list); idx++) { 163 for (idx = 0; idx < ARRAY_SIZE(p2m_top_mfn_list); idx++) {
164 unsigned topidx = idx * P2M_ENTRIES_PER_PAGE; 164 unsigned topidx = idx * P2M_ENTRIES_PER_PAGE;
165 p2m_top_mfn_list[idx] = virt_to_mfn(&p2m_top_mfn[topidx]); 165 p2m_top_mfn_list[idx] = virt_to_mfn(&p2m_top_mfn[topidx]);
166 } 166 }
@@ -179,7 +179,7 @@ void __init xen_build_dynamic_phys_to_machine(void)
179 unsigned long max_pfn = min(MAX_DOMAIN_PAGES, xen_start_info->nr_pages); 179 unsigned long max_pfn = min(MAX_DOMAIN_PAGES, xen_start_info->nr_pages);
180 unsigned pfn; 180 unsigned pfn;
181 181
182 for(pfn = 0; pfn < max_pfn; pfn += P2M_ENTRIES_PER_PAGE) { 182 for (pfn = 0; pfn < max_pfn; pfn += P2M_ENTRIES_PER_PAGE) {
183 unsigned topidx = p2m_top_index(pfn); 183 unsigned topidx = p2m_top_index(pfn);
184 184
185 p2m_top[topidx] = &mfn_list[pfn]; 185 p2m_top[topidx] = &mfn_list[pfn];
@@ -207,7 +207,7 @@ static void alloc_p2m(unsigned long **pp, unsigned long *mfnp)
207 p = (void *)__get_free_page(GFP_KERNEL | __GFP_NOFAIL); 207 p = (void *)__get_free_page(GFP_KERNEL | __GFP_NOFAIL);
208 BUG_ON(p == NULL); 208 BUG_ON(p == NULL);
209 209
210 for(i = 0; i < P2M_ENTRIES_PER_PAGE; i++) 210 for (i = 0; i < P2M_ENTRIES_PER_PAGE; i++)
211 p[i] = INVALID_P2M_ENTRY; 211 p[i] = INVALID_P2M_ENTRY;
212 212
213 if (cmpxchg(pp, p2m_missing, p) != p2m_missing) 213 if (cmpxchg(pp, p2m_missing, p) != p2m_missing)
@@ -407,7 +407,8 @@ out:
407 preempt_enable(); 407 preempt_enable();
408} 408}
409 409
410pte_t xen_ptep_modify_prot_start(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 410pte_t xen_ptep_modify_prot_start(struct mm_struct *mm,
411 unsigned long addr, pte_t *ptep)
411{ 412{
412 /* Just return the pte as-is. We preserve the bits on commit */ 413 /* Just return the pte as-is. We preserve the bits on commit */
413 return *ptep; 414 return *ptep;
@@ -878,7 +879,8 @@ static void __xen_pgd_pin(struct mm_struct *mm, pgd_t *pgd)
878 879
879 if (user_pgd) { 880 if (user_pgd) {
880 xen_pin_page(mm, virt_to_page(user_pgd), PT_PGD); 881 xen_pin_page(mm, virt_to_page(user_pgd), PT_PGD);
881 xen_do_pin(MMUEXT_PIN_L4_TABLE, PFN_DOWN(__pa(user_pgd))); 882 xen_do_pin(MMUEXT_PIN_L4_TABLE,
883 PFN_DOWN(__pa(user_pgd)));
882 } 884 }
883 } 885 }
884#else /* CONFIG_X86_32 */ 886#else /* CONFIG_X86_32 */
@@ -993,7 +995,8 @@ static void __xen_pgd_unpin(struct mm_struct *mm, pgd_t *pgd)
993 pgd_t *user_pgd = xen_get_user_pgd(pgd); 995 pgd_t *user_pgd = xen_get_user_pgd(pgd);
994 996
995 if (user_pgd) { 997 if (user_pgd) {
996 xen_do_pin(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(user_pgd))); 998 xen_do_pin(MMUEXT_UNPIN_TABLE,
999 PFN_DOWN(__pa(user_pgd)));
997 xen_unpin_page(mm, virt_to_page(user_pgd), PT_PGD); 1000 xen_unpin_page(mm, virt_to_page(user_pgd), PT_PGD);
998 } 1001 }
999 } 1002 }
@@ -1079,7 +1082,7 @@ static void drop_other_mm_ref(void *info)
1079 1082
1080static void xen_drop_mm_ref(struct mm_struct *mm) 1083static void xen_drop_mm_ref(struct mm_struct *mm)
1081{ 1084{
1082 cpumask_t mask; 1085 cpumask_var_t mask;
1083 unsigned cpu; 1086 unsigned cpu;
1084 1087
1085 if (current->active_mm == mm) { 1088 if (current->active_mm == mm) {
@@ -1091,7 +1094,16 @@ static void xen_drop_mm_ref(struct mm_struct *mm)
1091 } 1094 }
1092 1095
1093 /* Get the "official" set of cpus referring to our pagetable. */ 1096 /* Get the "official" set of cpus referring to our pagetable. */
1094 mask = mm->cpu_vm_mask; 1097 if (!alloc_cpumask_var(&mask, GFP_ATOMIC)) {
1098 for_each_online_cpu(cpu) {
1099 if (!cpumask_test_cpu(cpu, &mm->cpu_vm_mask)
1100 && per_cpu(xen_current_cr3, cpu) != __pa(mm->pgd))
1101 continue;
1102 smp_call_function_single(cpu, drop_other_mm_ref, mm, 1);
1103 }
1104 return;
1105 }
1106 cpumask_copy(mask, &mm->cpu_vm_mask);
1095 1107
1096 /* It's possible that a vcpu may have a stale reference to our 1108 /* It's possible that a vcpu may have a stale reference to our
1097 cr3, because its in lazy mode, and it hasn't yet flushed 1109 cr3, because its in lazy mode, and it hasn't yet flushed
@@ -1100,11 +1112,12 @@ static void xen_drop_mm_ref(struct mm_struct *mm)
1100 if needed. */ 1112 if needed. */
1101 for_each_online_cpu(cpu) { 1113 for_each_online_cpu(cpu) {
1102 if (per_cpu(xen_current_cr3, cpu) == __pa(mm->pgd)) 1114 if (per_cpu(xen_current_cr3, cpu) == __pa(mm->pgd))
1103 cpu_set(cpu, mask); 1115 cpumask_set_cpu(cpu, mask);
1104 } 1116 }
1105 1117
1106 if (!cpus_empty(mask)) 1118 if (!cpumask_empty(mask))
1107 smp_call_function_mask(mask, drop_other_mm_ref, mm, 1); 1119 smp_call_function_many(mask, drop_other_mm_ref, mm, 1);
1120 free_cpumask_var(mask);
1108} 1121}
1109#else 1122#else
1110static void xen_drop_mm_ref(struct mm_struct *mm) 1123static void xen_drop_mm_ref(struct mm_struct *mm)
diff --git a/arch/x86/xen/multicalls.c b/arch/x86/xen/multicalls.c
index 8ea8a0d0b0de..c738644b5435 100644
--- a/arch/x86/xen/multicalls.c
+++ b/arch/x86/xen/multicalls.c
@@ -154,7 +154,7 @@ void xen_mc_flush(void)
154 ret, smp_processor_id()); 154 ret, smp_processor_id());
155 dump_stack(); 155 dump_stack();
156 for (i = 0; i < b->mcidx; i++) { 156 for (i = 0; i < b->mcidx; i++) {
157 printk(" call %2d/%d: op=%lu arg=[%lx] result=%ld\n", 157 printk(KERN_DEBUG " call %2d/%d: op=%lu arg=[%lx] result=%ld\n",
158 i+1, b->mcidx, 158 i+1, b->mcidx,
159 b->debug[i].op, 159 b->debug[i].op,
160 b->debug[i].args[0], 160 b->debug[i].args[0],
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index d67901083888..15c6c68db6a2 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -28,6 +28,9 @@
28/* These are code, but not functions. Defined in entry.S */ 28/* These are code, but not functions. Defined in entry.S */
29extern const char xen_hypervisor_callback[]; 29extern const char xen_hypervisor_callback[];
30extern const char xen_failsafe_callback[]; 30extern const char xen_failsafe_callback[];
31extern void xen_sysenter_target(void);
32extern void xen_syscall_target(void);
33extern void xen_syscall32_target(void);
31 34
32 35
33/** 36/**
@@ -110,7 +113,6 @@ static __cpuinit int register_callback(unsigned type, const void *func)
110 113
111void __cpuinit xen_enable_sysenter(void) 114void __cpuinit xen_enable_sysenter(void)
112{ 115{
113 extern void xen_sysenter_target(void);
114 int ret; 116 int ret;
115 unsigned sysenter_feature; 117 unsigned sysenter_feature;
116 118
@@ -132,8 +134,6 @@ void __cpuinit xen_enable_syscall(void)
132{ 134{
133#ifdef CONFIG_X86_64 135#ifdef CONFIG_X86_64
134 int ret; 136 int ret;
135 extern void xen_syscall_target(void);
136 extern void xen_syscall32_target(void);
137 137
138 ret = register_callback(CALLBACKTYPE_syscall, xen_syscall_target); 138 ret = register_callback(CALLBACKTYPE_syscall, xen_syscall_target);
139 if (ret != 0) { 139 if (ret != 0) {
@@ -160,7 +160,8 @@ void __init xen_arch_setup(void)
160 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables); 160 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables);
161 161
162 if (!xen_feature(XENFEAT_auto_translated_physmap)) 162 if (!xen_feature(XENFEAT_auto_translated_physmap))
163 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_pae_extended_cr3); 163 HYPERVISOR_vm_assist(VMASST_CMD_enable,
164 VMASST_TYPE_pae_extended_cr3);
164 165
165 if (register_callback(CALLBACKTYPE_event, xen_hypervisor_callback) || 166 if (register_callback(CALLBACKTYPE_event, xen_hypervisor_callback) ||
166 register_callback(CALLBACKTYPE_failsafe, xen_failsafe_callback)) 167 register_callback(CALLBACKTYPE_failsafe, xen_failsafe_callback))
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index acd9b6705e02..c44e2069c7c7 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -33,7 +33,7 @@
33#include "xen-ops.h" 33#include "xen-ops.h"
34#include "mmu.h" 34#include "mmu.h"
35 35
36cpumask_t xen_cpu_initialized_map; 36cpumask_var_t xen_cpu_initialized_map;
37 37
38static DEFINE_PER_CPU(int, resched_irq); 38static DEFINE_PER_CPU(int, resched_irq);
39static DEFINE_PER_CPU(int, callfunc_irq); 39static DEFINE_PER_CPU(int, callfunc_irq);
@@ -158,7 +158,7 @@ static void __init xen_fill_possible_map(void)
158{ 158{
159 int i, rc; 159 int i, rc;
160 160
161 for (i = 0; i < NR_CPUS; i++) { 161 for (i = 0; i < nr_cpu_ids; i++) {
162 rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL); 162 rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL);
163 if (rc >= 0) { 163 if (rc >= 0) {
164 num_processors++; 164 num_processors++;
@@ -192,11 +192,14 @@ static void __init xen_smp_prepare_cpus(unsigned int max_cpus)
192 if (xen_smp_intr_init(0)) 192 if (xen_smp_intr_init(0))
193 BUG(); 193 BUG();
194 194
195 xen_cpu_initialized_map = cpumask_of_cpu(0); 195 if (!alloc_cpumask_var(&xen_cpu_initialized_map, GFP_KERNEL))
196 panic("could not allocate xen_cpu_initialized_map\n");
197
198 cpumask_copy(xen_cpu_initialized_map, cpumask_of(0));
196 199
197 /* Restrict the possible_map according to max_cpus. */ 200 /* Restrict the possible_map according to max_cpus. */
198 while ((num_possible_cpus() > 1) && (num_possible_cpus() > max_cpus)) { 201 while ((num_possible_cpus() > 1) && (num_possible_cpus() > max_cpus)) {
199 for (cpu = NR_CPUS - 1; !cpu_possible(cpu); cpu--) 202 for (cpu = nr_cpu_ids - 1; !cpu_possible(cpu); cpu--)
200 continue; 203 continue;
201 cpu_clear(cpu, cpu_possible_map); 204 cpu_clear(cpu, cpu_possible_map);
202 } 205 }
@@ -221,7 +224,7 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
221 struct vcpu_guest_context *ctxt; 224 struct vcpu_guest_context *ctxt;
222 struct desc_struct *gdt; 225 struct desc_struct *gdt;
223 226
224 if (cpu_test_and_set(cpu, xen_cpu_initialized_map)) 227 if (cpumask_test_and_set_cpu(cpu, xen_cpu_initialized_map))
225 return 0; 228 return 0;
226 229
227 ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL); 230 ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
@@ -408,24 +411,23 @@ static void xen_smp_send_reschedule(int cpu)
408 xen_send_IPI_one(cpu, XEN_RESCHEDULE_VECTOR); 411 xen_send_IPI_one(cpu, XEN_RESCHEDULE_VECTOR);
409} 412}
410 413
411static void xen_send_IPI_mask(cpumask_t mask, enum ipi_vector vector) 414static void xen_send_IPI_mask(const struct cpumask *mask,
415 enum ipi_vector vector)
412{ 416{
413 unsigned cpu; 417 unsigned cpu;
414 418
415 cpus_and(mask, mask, cpu_online_map); 419 for_each_cpu_and(cpu, mask, cpu_online_mask)
416
417 for_each_cpu_mask_nr(cpu, mask)
418 xen_send_IPI_one(cpu, vector); 420 xen_send_IPI_one(cpu, vector);
419} 421}
420 422
421static void xen_smp_send_call_function_ipi(cpumask_t mask) 423static void xen_smp_send_call_function_ipi(const struct cpumask *mask)
422{ 424{
423 int cpu; 425 int cpu;
424 426
425 xen_send_IPI_mask(mask, XEN_CALL_FUNCTION_VECTOR); 427 xen_send_IPI_mask(mask, XEN_CALL_FUNCTION_VECTOR);
426 428
427 /* Make sure other vcpus get a chance to run if they need to. */ 429 /* Make sure other vcpus get a chance to run if they need to. */
428 for_each_cpu_mask_nr(cpu, mask) { 430 for_each_cpu(cpu, mask) {
429 if (xen_vcpu_stolen(cpu)) { 431 if (xen_vcpu_stolen(cpu)) {
430 HYPERVISOR_sched_op(SCHEDOP_yield, 0); 432 HYPERVISOR_sched_op(SCHEDOP_yield, 0);
431 break; 433 break;
@@ -435,7 +437,8 @@ static void xen_smp_send_call_function_ipi(cpumask_t mask)
435 437
436static void xen_smp_send_call_function_single_ipi(int cpu) 438static void xen_smp_send_call_function_single_ipi(int cpu)
437{ 439{
438 xen_send_IPI_mask(cpumask_of_cpu(cpu), XEN_CALL_FUNCTION_SINGLE_VECTOR); 440 xen_send_IPI_mask(cpumask_of(cpu),
441 XEN_CALL_FUNCTION_SINGLE_VECTOR);
439} 442}
440 443
441static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id) 444static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id)
diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c
index 2a234db5949b..212ffe012b76 100644
--- a/arch/x86/xen/suspend.c
+++ b/arch/x86/xen/suspend.c
@@ -35,7 +35,8 @@ void xen_post_suspend(int suspend_cancelled)
35 pfn_to_mfn(xen_start_info->console.domU.mfn); 35 pfn_to_mfn(xen_start_info->console.domU.mfn);
36 } else { 36 } else {
37#ifdef CONFIG_SMP 37#ifdef CONFIG_SMP
38 xen_cpu_initialized_map = cpu_online_map; 38 BUG_ON(xen_cpu_initialized_map == NULL);
39 cpumask_copy(xen_cpu_initialized_map, cpu_online_mask);
39#endif 40#endif
40 xen_vcpu_restore(); 41 xen_vcpu_restore();
41 } 42 }
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index c9f7cda48ed7..14f240623497 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -132,8 +132,7 @@ static void do_stolen_accounting(void)
132 *snap = state; 132 *snap = state;
133 133
134 /* Add the appropriate number of ticks of stolen time, 134 /* Add the appropriate number of ticks of stolen time,
135 including any left-overs from last time. Passing NULL to 135 including any left-overs from last time. */
136 account_steal_time accounts the time as stolen. */
137 stolen = runnable + offline + __get_cpu_var(residual_stolen); 136 stolen = runnable + offline + __get_cpu_var(residual_stolen);
138 137
139 if (stolen < 0) 138 if (stolen < 0)
@@ -141,11 +140,10 @@ static void do_stolen_accounting(void)
141 140
142 ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen); 141 ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen);
143 __get_cpu_var(residual_stolen) = stolen; 142 __get_cpu_var(residual_stolen) = stolen;
144 account_steal_time(NULL, ticks); 143 account_steal_ticks(ticks);
145 144
146 /* Add the appropriate number of ticks of blocked time, 145 /* Add the appropriate number of ticks of blocked time,
147 including any left-overs from last time. Passing idle to 146 including any left-overs from last time. */
148 account_steal_time accounts the time as idle/wait. */
149 blocked += __get_cpu_var(residual_blocked); 147 blocked += __get_cpu_var(residual_blocked);
150 148
151 if (blocked < 0) 149 if (blocked < 0)
@@ -153,7 +151,7 @@ static void do_stolen_accounting(void)
153 151
154 ticks = iter_div_u64_rem(blocked, NS_PER_TICK, &blocked); 152 ticks = iter_div_u64_rem(blocked, NS_PER_TICK, &blocked);
155 __get_cpu_var(residual_blocked) = blocked; 153 __get_cpu_var(residual_blocked) = blocked;
156 account_steal_time(idle_task(smp_processor_id()), ticks); 154 account_idle_ticks(ticks);
157} 155}
158 156
159/* 157/*
@@ -437,7 +435,7 @@ void xen_setup_timer(int cpu)
437 evt = &per_cpu(xen_clock_events, cpu); 435 evt = &per_cpu(xen_clock_events, cpu);
438 memcpy(evt, xen_clockevent, sizeof(*evt)); 436 memcpy(evt, xen_clockevent, sizeof(*evt));
439 437
440 evt->cpumask = cpumask_of_cpu(cpu); 438 evt->cpumask = cpumask_of(cpu);
441 evt->irq = irq; 439 evt->irq = irq;
442 440
443 setup_runstate_info(cpu); 441 setup_runstate_info(cpu);
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index 9e1afae8461f..c1f8faf0a2c5 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -58,7 +58,7 @@ void __init xen_init_spinlocks(void);
58__cpuinit void xen_init_lock_cpu(int cpu); 58__cpuinit void xen_init_lock_cpu(int cpu);
59void xen_uninit_lock_cpu(int cpu); 59void xen_uninit_lock_cpu(int cpu);
60 60
61extern cpumask_t xen_cpu_initialized_map; 61extern cpumask_var_t xen_cpu_initialized_map;
62#else 62#else
63static inline void xen_smp_init(void) {} 63static inline void xen_smp_init(void) {}
64#endif 64#endif
diff --git a/arch/xtensa/kernel/init_task.c b/arch/xtensa/kernel/init_task.c
index 3df469dbe814..e07f5c9fcd35 100644
--- a/arch/xtensa/kernel/init_task.c
+++ b/arch/xtensa/kernel/init_task.c
@@ -21,7 +21,6 @@
21 21
22#include <asm/uaccess.h> 22#include <asm/uaccess.h>
23 23
24static struct fs_struct init_fs = INIT_FS;
25static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 24static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
26static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 25static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
27struct mm_struct init_mm = INIT_MM(init_mm); 26struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c
index 11a20adc1409..64f057d89e73 100644
--- a/arch/xtensa/platforms/iss/network.c
+++ b/arch/xtensa/platforms/iss/network.c
@@ -365,7 +365,7 @@ static int tuntap_probe(struct iss_net_private *lp, int index, char *init)
365 365
366static int iss_net_rx(struct net_device *dev) 366static int iss_net_rx(struct net_device *dev)
367{ 367{
368 struct iss_net_private *lp = dev->priv; 368 struct iss_net_private *lp = netdev_priv(dev);
369 int pkt_len; 369 int pkt_len;
370 struct sk_buff *skb; 370 struct sk_buff *skb;
371 371
@@ -456,7 +456,7 @@ static void iss_net_timer(unsigned long priv)
456 456
457static int iss_net_open(struct net_device *dev) 457static int iss_net_open(struct net_device *dev)
458{ 458{
459 struct iss_net_private *lp = dev->priv; 459 struct iss_net_private *lp = netdev_priv(dev);
460 char addr[sizeof "255.255.255.255\0"]; 460 char addr[sizeof "255.255.255.255\0"];
461 int err; 461 int err;
462 462
@@ -496,7 +496,7 @@ out:
496 496
497static int iss_net_close(struct net_device *dev) 497static int iss_net_close(struct net_device *dev)
498{ 498{
499 struct iss_net_private *lp = dev->priv; 499 struct iss_net_private *lp = netdev_priv(dev);
500printk("iss_net_close!\n"); 500printk("iss_net_close!\n");
501 netif_stop_queue(dev); 501 netif_stop_queue(dev);
502 spin_lock(&lp->lock); 502 spin_lock(&lp->lock);
@@ -515,7 +515,7 @@ printk("iss_net_close!\n");
515 515
516static int iss_net_start_xmit(struct sk_buff *skb, struct net_device *dev) 516static int iss_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
517{ 517{
518 struct iss_net_private *lp = dev->priv; 518 struct iss_net_private *lp = netdev_priv(dev);
519 unsigned long flags; 519 unsigned long flags;
520 int len; 520 int len;
521 521
@@ -551,7 +551,7 @@ static int iss_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
551 551
552static struct net_device_stats *iss_net_get_stats(struct net_device *dev) 552static struct net_device_stats *iss_net_get_stats(struct net_device *dev)
553{ 553{
554 struct iss_net_private *lp = dev->priv; 554 struct iss_net_private *lp = netdev_priv(dev);
555 return &lp->stats; 555 return &lp->stats;
556} 556}
557 557
@@ -578,7 +578,7 @@ static void iss_net_tx_timeout(struct net_device *dev)
578static int iss_net_set_mac(struct net_device *dev, void *addr) 578static int iss_net_set_mac(struct net_device *dev, void *addr)
579{ 579{
580#if 0 580#if 0
581 struct iss_net_private *lp = dev->priv; 581 struct iss_net_private *lp = netdev_priv(dev);
582 struct sockaddr *hwaddr = addr; 582 struct sockaddr *hwaddr = addr;
583 583
584 spin_lock(&lp->lock); 584 spin_lock(&lp->lock);
@@ -592,7 +592,7 @@ static int iss_net_set_mac(struct net_device *dev, void *addr)
592static int iss_net_change_mtu(struct net_device *dev, int new_mtu) 592static int iss_net_change_mtu(struct net_device *dev, int new_mtu)
593{ 593{
594#if 0 594#if 0
595 struct iss_net_private *lp = dev->priv; 595 struct iss_net_private *lp = netdev_priv(dev);
596 int err = 0; 596 int err = 0;
597 597
598 spin_lock(&lp->lock); 598 spin_lock(&lp->lock);
@@ -636,7 +636,7 @@ static int iss_net_configure(int index, char *init)
636 636
637 /* Initialize private element. */ 637 /* Initialize private element. */
638 638
639 lp = dev->priv; 639 lp = netdev_priv(dev);
640 *lp = ((struct iss_net_private) { 640 *lp = ((struct iss_net_private) {
641 .device_list = LIST_HEAD_INIT(lp->device_list), 641 .device_list = LIST_HEAD_INIT(lp->device_list),
642 .opened_list = LIST_HEAD_INIT(lp->opened_list), 642 .opened_list = LIST_HEAD_INIT(lp->opened_list),
@@ -660,10 +660,7 @@ static int iss_net_configure(int index, char *init)
660 660
661 printk(KERN_INFO "Netdevice %d ", index); 661 printk(KERN_INFO "Netdevice %d ", index);
662 if (lp->have_mac) 662 if (lp->have_mac)
663 printk("(%02x:%02x:%02x:%02x:%02x:%02x) ", 663 printk("(%pM) ", lp->mac);
664 lp->mac[0], lp->mac[1],
665 lp->mac[2], lp->mac[3],
666 lp->mac[4], lp->mac[5]);
667 printk(": "); 664 printk(": ");
668 665
669 /* sysfs register */ 666 /* sysfs register */