aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/include/asm/fcntl.h2
-rw-r--r--arch/alpha/kernel/srm_env.c5
-rw-r--r--arch/arm/Kconfig60
-rw-r--r--arch/arm/Kconfig.debug91
-rw-r--r--arch/arm/Makefile3
-rw-r--r--arch/arm/boot/Makefile9
-rw-r--r--arch/arm/boot/compressed/Makefile8
-rw-r--r--arch/arm/common/gic.c43
-rw-r--r--arch/arm/common/pl330.c2
-rw-r--r--arch/arm/common/vic.c4
-rw-r--r--arch/arm/configs/integrator_defconfig19
-rw-r--r--arch/arm/include/asm/Kbuild17
-rw-r--r--arch/arm/include/asm/auxvec.h4
-rw-r--r--arch/arm/include/asm/bitsperlong.h1
-rw-r--r--arch/arm/include/asm/bug.h55
-rw-r--r--arch/arm/include/asm/cachetype.h5
-rw-r--r--arch/arm/include/asm/cputime.h6
-rw-r--r--arch/arm/include/asm/cputype.h6
-rw-r--r--arch/arm/include/asm/device.h3
-rw-r--r--arch/arm/include/asm/dma-mapping.h2
-rw-r--r--arch/arm/include/asm/dma.h6
-rw-r--r--arch/arm/include/asm/ecard.h1
-rw-r--r--arch/arm/include/asm/emergency-restart.h6
-rw-r--r--arch/arm/include/asm/errno.h6
-rw-r--r--arch/arm/include/asm/exception.h19
-rw-r--r--arch/arm/include/asm/hardware/cache-l2x0.h42
-rw-r--r--arch/arm/include/asm/io.h40
-rw-r--r--arch/arm/include/asm/ioctl.h1
-rw-r--r--arch/arm/include/asm/irq_regs.h1
-rw-r--r--arch/arm/include/asm/kdebug.h1
-rw-r--r--arch/arm/include/asm/local.h1
-rw-r--r--arch/arm/include/asm/local64.h1
-rw-r--r--arch/arm/include/asm/localtimer.h6
-rw-r--r--arch/arm/include/asm/mach/arch.h3
-rw-r--r--arch/arm/include/asm/memory.h7
-rw-r--r--arch/arm/include/asm/mmu.h4
-rw-r--r--arch/arm/include/asm/module.h4
-rw-r--r--arch/arm/include/asm/outercache.h7
-rw-r--r--arch/arm/include/asm/page.h42
-rw-r--r--arch/arm/include/asm/percpu.h6
-rw-r--r--arch/arm/include/asm/pgalloc.h4
-rw-r--r--arch/arm/include/asm/pgtable-2level-hwdef.h93
-rw-r--r--arch/arm/include/asm/pgtable-2level-types.h67
-rw-r--r--arch/arm/include/asm/pgtable-2level.h143
-rw-r--r--arch/arm/include/asm/pgtable-hwdef.h77
-rw-r--r--arch/arm/include/asm/pgtable.h141
-rw-r--r--arch/arm/include/asm/poll.h1
-rw-r--r--arch/arm/include/asm/resource.h6
-rw-r--r--arch/arm/include/asm/sections.h1
-rw-r--r--arch/arm/include/asm/siginfo.h6
-rw-r--r--arch/arm/include/asm/sizes.h21
-rw-r--r--arch/arm/include/asm/smp.h11
-rw-r--r--arch/arm/include/asm/system.h11
-rw-r--r--arch/arm/include/asm/tlbflush.h4
-rw-r--r--arch/arm/include/asm/topology.h33
-rw-r--r--arch/arm/kernel/Makefile3
-rw-r--r--arch/arm/kernel/armksyms.c3
-rw-r--r--arch/arm/kernel/asm-offsets.c12
-rw-r--r--arch/arm/kernel/bios32.c9
-rw-r--r--arch/arm/kernel/debug.S4
-rw-r--r--arch/arm/kernel/dma.c2
-rw-r--r--arch/arm/kernel/ecard.c36
-rw-r--r--arch/arm/kernel/entry-armv.S44
-rw-r--r--arch/arm/kernel/head.S135
-rw-r--r--arch/arm/kernel/irq.c2
-rw-r--r--arch/arm/kernel/machine_kexec.c35
-rw-r--r--arch/arm/kernel/module.c2
-rw-r--r--arch/arm/kernel/perf_event_v7.c4
-rw-r--r--arch/arm/kernel/process.c2
-rw-r--r--arch/arm/kernel/setup.c37
-rw-r--r--arch/arm/kernel/smp.c61
-rw-r--r--arch/arm/kernel/smp_scu.c2
-rw-r--r--arch/arm/kernel/time.c6
-rw-r--r--arch/arm/kernel/topology.c148
-rw-r--r--arch/arm/kernel/traps.c52
-rw-r--r--arch/arm/kernel/vmlinux.lds.S3
-rw-r--r--arch/arm/lib/backtrace.S6
-rw-r--r--arch/arm/lib/div64.S8
-rw-r--r--arch/arm/lib/uaccess_with_memcpy.c1
-rw-r--r--arch/arm/mach-at91/Makefile.boot6
-rw-r--r--arch/arm/mach-bcmring/Kconfig2
-rw-r--r--arch/arm/mach-bcmring/Makefile.boot2
-rw-r--r--arch/arm/mach-bcmring/arch.c4
-rw-r--r--arch/arm/mach-bcmring/irq.c1
-rw-r--r--arch/arm/mach-bcmring/timer.c1
-rw-r--r--arch/arm/mach-clps711x/Makefile.boot2
-rw-r--r--arch/arm/mach-clps711x/clep7312.c3
-rw-r--r--arch/arm/mach-clps711x/edb7211-arch.c3
-rw-r--r--arch/arm/mach-clps711x/fortunet.c3
-rw-r--r--arch/arm/mach-clps711x/p720t.c3
-rw-r--r--arch/arm/mach-cns3xxx/Makefile.boot2
-rw-r--r--arch/arm/mach-davinci/Makefile.boot4
-rw-r--r--arch/arm/mach-dove/Makefile.boot2
-rw-r--r--arch/arm/mach-ebsa110/Makefile.boot2
-rw-r--r--arch/arm/mach-ebsa110/include/mach/io.h2
-rw-r--r--arch/arm/mach-ep93xx/Makefile.boot10
-rw-r--r--arch/arm/mach-exynos4/Kconfig1
-rw-r--r--arch/arm/mach-exynos4/Makefile.boot2
-rw-r--r--arch/arm/mach-exynos4/platsmp.c10
-rw-r--r--arch/arm/mach-footbridge/Kconfig4
-rw-r--r--arch/arm/mach-footbridge/Makefile.boot2
-rw-r--r--arch/arm/mach-footbridge/cats-hw.c3
-rw-r--r--arch/arm/mach-footbridge/include/mach/hardware.h2
-rw-r--r--arch/arm/mach-footbridge/include/mach/io.h2
-rw-r--r--arch/arm/mach-footbridge/netwinder-hw.c17
-rw-r--r--arch/arm/mach-footbridge/netwinder-leds.c10
-rw-r--r--arch/arm/mach-gemini/Makefile.boot4
-rw-r--r--arch/arm/mach-h720x/Makefile.boot2
-rw-r--r--arch/arm/mach-imx/Makefile.boot10
-rw-r--r--arch/arm/mach-integrator/Makefile.boot2
-rw-r--r--arch/arm/mach-integrator/core.c10
-rw-r--r--arch/arm/mach-integrator/include/mach/io.h2
-rw-r--r--arch/arm/mach-integrator/include/mach/platform.h12
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c86
-rw-r--r--arch/arm/mach-integrator/pci_v3.c14
-rw-r--r--arch/arm/mach-iop13xx/Makefile.boot2
-rw-r--r--arch/arm/mach-iop32x/Makefile.boot2
-rw-r--r--arch/arm/mach-iop33x/Makefile.boot2
-rw-r--r--arch/arm/mach-ixp2000/Makefile.boot2
-rw-r--r--arch/arm/mach-ixp23xx/Makefile.boot2
-rw-r--r--arch/arm/mach-ixp4xx/Makefile.boot2
-rw-r--r--arch/arm/mach-ixp4xx/common-pci.c25
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/io.h2
-rw-r--r--arch/arm/mach-kirkwood/Makefile.boot2
-rw-r--r--arch/arm/mach-ks8695/Makefile.boot2
-rw-r--r--arch/arm/mach-lpc32xx/Makefile.boot2
-rw-r--r--arch/arm/mach-mmp/Makefile.boot2
-rw-r--r--arch/arm/mach-mmp/aspenite.c2
-rw-r--r--arch/arm/mach-mmp/include/mach/pxa168.h7
-rw-r--r--arch/arm/mach-mmp/pxa168.c46
-rw-r--r--arch/arm/mach-mmp/ttc_dkb.c2
-rw-r--r--arch/arm/mach-msm/Makefile.boot2
-rw-r--r--arch/arm/mach-msm/board-halibut.c4
-rw-r--r--arch/arm/mach-msm/board-mahimahi.c4
-rw-r--r--arch/arm/mach-msm/board-msm7x30.c22
-rw-r--r--arch/arm/mach-msm/board-msm8960.c22
-rw-r--r--arch/arm/mach-msm/board-msm8x60.c25
-rw-r--r--arch/arm/mach-msm/board-sapphire.c4
-rw-r--r--arch/arm/mach-msm/board-trout.c4
-rw-r--r--arch/arm/mach-msm/clock.c2
-rw-r--r--arch/arm/mach-msm/include/mach/memory.h6
-rw-r--r--arch/arm/mach-msm/platsmp.c6
-rw-r--r--arch/arm/mach-mv78xx0/Makefile.boot2
-rw-r--r--arch/arm/mach-mx5/Makefile.boot6
-rw-r--r--arch/arm/mach-mxs/Makefile.boot2
-rw-r--r--arch/arm/mach-netx/Makefile.boot2
-rw-r--r--arch/arm/mach-nomadik/Makefile.boot2
-rw-r--r--arch/arm/mach-nuc93x/Makefile.boot2
-rw-r--r--arch/arm/mach-nuc93x/time.c2
-rw-r--r--arch/arm/mach-omap1/Makefile.boot2
-rw-r--r--arch/arm/mach-omap1/pm_bus.c1
-rw-r--r--arch/arm/mach-omap2/Kconfig2
-rw-r--r--arch/arm/mach-omap2/Makefile11
-rw-r--r--arch/arm/mach-omap2/Makefile.boot2
-rw-r--r--arch/arm/mach-omap2/omap-smp.c10
-rw-r--r--arch/arm/mach-omap2/smartreflex.c2
-rw-r--r--arch/arm/mach-orion5x/Makefile.boot2
-rw-r--r--arch/arm/mach-orion5x/common.c4
-rw-r--r--arch/arm/mach-orion5x/common.h4
-rw-r--r--arch/arm/mach-pnx4008/Makefile.boot2
-rw-r--r--arch/arm/mach-prima2/Makefile.boot2
-rw-r--r--arch/arm/mach-pxa/Makefile.boot2
-rw-r--r--arch/arm/mach-pxa/cm-x300.c4
-rw-r--r--arch/arm/mach-pxa/corgi.c4
-rw-r--r--arch/arm/mach-pxa/eseries.c3
-rw-r--r--arch/arm/mach-pxa/eseries.h3
-rw-r--r--arch/arm/mach-pxa/irq.c2
-rw-r--r--arch/arm/mach-pxa/poodle.c4
-rw-r--r--arch/arm/mach-pxa/saar.c2
-rw-r--r--arch/arm/mach-pxa/spitz.c4
-rw-r--r--arch/arm/mach-pxa/tosa.c4
-rw-r--r--arch/arm/mach-pxa/xcep.c3
-rw-r--r--arch/arm/mach-realview/Makefile.boot4
-rw-r--r--arch/arm/mach-realview/core.c3
-rw-r--r--arch/arm/mach-realview/core.h4
-rw-r--r--arch/arm/mach-realview/include/mach/board-pb1176.h1
-rw-r--r--arch/arm/mach-realview/platsmp.c10
-rw-r--r--arch/arm/mach-realview/realview_pb1176.c48
-rw-r--r--arch/arm/mach-realview/realview_pbx.c6
-rw-r--r--arch/arm/mach-rpc/Makefile.boot2
-rw-r--r--arch/arm/mach-rpc/include/mach/hardware.h25
-rw-r--r--arch/arm/mach-rpc/include/mach/io.h193
-rw-r--r--arch/arm/mach-rpc/riscpc.c2
-rw-r--r--arch/arm/mach-s3c2410/Makefile.boot4
-rw-r--r--arch/arm/mach-s3c2410/include/mach/io.h2
-rw-r--r--arch/arm/mach-s3c2410/s3c2410.c2
-rw-r--r--arch/arm/mach-s3c2412/mach-smdk2413.c3
-rw-r--r--arch/arm/mach-s3c2412/mach-vstms.c5
-rw-r--r--arch/arm/mach-s3c2412/s3c2412.c2
-rw-r--r--arch/arm/mach-s3c2416/s3c2416.c2
-rw-r--r--arch/arm/mach-s3c2440/s3c2440.c2
-rw-r--r--arch/arm/mach-s3c2440/s3c2442.c2
-rw-r--r--arch/arm/mach-s3c64xx/Makefile.boot2
-rw-r--r--arch/arm/mach-s3c64xx/dev-uart.c60
-rw-r--r--arch/arm/mach-s3c64xx/include/mach/irqs.h30
-rw-r--r--arch/arm/mach-s3c64xx/irq.c25
-rw-r--r--arch/arm/mach-s5p64x0/Makefile.boot2
-rw-r--r--arch/arm/mach-s5pc100/Makefile.boot2
-rw-r--r--arch/arm/mach-s5pv210/Makefile.boot2
-rw-r--r--arch/arm/mach-sa1100/Makefile1
-rw-r--r--arch/arm/mach-sa1100/Makefile.boot5
-rw-r--r--arch/arm/mach-sa1100/assabet.c3
-rw-r--r--arch/arm/mach-sa1100/include/mach/io.h6
-rw-r--r--arch/arm/mach-sa1100/include/mach/simpad.h94
-rw-r--r--arch/arm/mach-sa1100/leds-simpad.c100
-rw-r--r--arch/arm/mach-sa1100/leds.c2
-rw-r--r--arch/arm/mach-sa1100/leds.h1
-rw-r--r--arch/arm/mach-sa1100/simpad.c213
-rw-r--r--arch/arm/mach-shark/Makefile.boot2
-rw-r--r--arch/arm/mach-shark/leds.c6
-rw-r--r--arch/arm/mach-shmobile/Makefile.boot2
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c6
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c12
-rw-r--r--arch/arm/mach-shmobile/include/mach/common.h4
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh7372.h13
-rw-r--r--arch/arm/mach-shmobile/intc-sh7372.c52
-rw-r--r--arch/arm/mach-shmobile/platsmp.c6
-rw-r--r--arch/arm/mach-shmobile/pm-sh7372.c342
-rw-r--r--arch/arm/mach-shmobile/pm_runtime.c1
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c25
-rw-r--r--arch/arm/mach-shmobile/sleep-sh7372.S221
-rw-r--r--arch/arm/mach-spear3xx/Makefile.boot2
-rw-r--r--arch/arm/mach-spear6xx/Makefile.boot2
-rw-r--r--arch/arm/mach-tcc8k/Makefile.boot2
-rw-r--r--arch/arm/mach-tegra/Makefile.boot2
-rw-r--r--arch/arm/mach-tegra/board-harmony.c4
-rw-r--r--arch/arm/mach-tegra/board-paz00.c4
-rw-r--r--arch/arm/mach-tegra/board-trimslice.c4
-rw-r--r--arch/arm/mach-tegra/platsmp.c8
-rw-r--r--arch/arm/mach-u300/Kconfig2
-rw-r--r--arch/arm/mach-u300/Makefile2
-rw-r--r--arch/arm/mach-u300/Makefile.boot4
-rw-r--r--arch/arm/mach-u300/core.c84
-rw-r--r--arch/arm/mach-u300/include/mach/syscon.h136
-rw-r--r--arch/arm/mach-u300/mmc.c16
-rw-r--r--arch/arm/mach-u300/padmux.c367
-rw-r--r--arch/arm/mach-u300/padmux.h39
-rw-r--r--arch/arm/mach-u300/spi.c20
-rw-r--r--arch/arm/mach-ux500/Makefile.boot2
-rw-r--r--arch/arm/mach-ux500/platsmp.c10
-rw-r--r--arch/arm/mach-versatile/Makefile.boot2
-rw-r--r--arch/arm/mach-vexpress/Makefile.boot2
-rw-r--r--arch/arm/mach-vexpress/ct-ca9x4.c6
-rw-r--r--arch/arm/mach-vexpress/hotplug.c9
-rw-r--r--arch/arm/mach-vexpress/include/mach/io.h2
-rw-r--r--arch/arm/mach-vt8500/Makefile.boot2
-rw-r--r--arch/arm/mach-vt8500/include/mach/io.h2
-rw-r--r--arch/arm/mach-w90x900/Makefile.boot2
-rw-r--r--arch/arm/mach-w90x900/cpu.c2
-rw-r--r--arch/arm/mach-zynq/Makefile.boot2
-rw-r--r--arch/arm/mm/alignment.c20
-rw-r--r--arch/arm/mm/cache-l2x0.c262
-rw-r--r--arch/arm/mm/context.c14
-rw-r--r--arch/arm/mm/copypage-v4mc.c6
-rw-r--r--arch/arm/mm/copypage-v6.c10
-rw-r--r--arch/arm/mm/copypage-xscale.c6
-rw-r--r--arch/arm/mm/dma-mapping.c6
-rw-r--r--arch/arm/mm/fault.c1
-rw-r--r--arch/arm/mm/init.c7
-rw-r--r--arch/arm/mm/ioremap.c21
-rw-r--r--arch/arm/mm/mm.h4
-rw-r--r--arch/arm/mm/mmu.c18
-rw-r--r--arch/arm/mm/proc-v7.S2
-rw-r--r--arch/arm/plat-mxc/Kconfig2
-rw-r--r--arch/arm/plat-mxc/devices.c53
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h16
-rw-r--r--arch/arm/plat-omap/Kconfig1
-rw-r--r--arch/arm/plat-s5p/Kconfig1
-rw-r--r--arch/arm/plat-s5p/dev-uart.c84
-rw-r--r--arch/arm/plat-s5p/include/plat/irqs.h35
-rw-r--r--arch/arm/plat-s5p/irq-gpioint.c6
-rw-r--r--arch/arm/plat-s5p/irq.c34
-rw-r--r--arch/arm/plat-samsung/Kconfig5
-rw-r--r--arch/arm/plat-samsung/Makefile1
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-serial.h5
-rw-r--r--arch/arm/plat-samsung/irq-uart.c96
-rw-r--r--arch/arm/tools/mach-types20
-rw-r--r--arch/arm/vfp/Makefile2
-rw-r--r--arch/cris/Kconfig4
-rw-r--r--arch/cris/arch-v10/Kconfig12
-rw-r--r--arch/cris/arch-v10/drivers/Kconfig1
-rw-r--r--arch/cris/arch-v32/drivers/Kconfig1
-rw-r--r--arch/cris/arch-v32/lib/nand_init.S178
-rw-r--r--arch/h8300/Kconfig4
-rw-r--r--arch/ia64/configs/generic_defconfig2
-rw-r--r--arch/ia64/dig/Makefile2
-rw-r--r--arch/ia64/hp/common/sba_iommu.c12
-rw-r--r--arch/ia64/hp/sim/simeth.c2
-rw-r--r--arch/ia64/include/asm/device.h2
-rw-r--r--arch/ia64/include/asm/iommu.h6
-rw-r--r--arch/ia64/include/asm/pci.h2
-rw-r--r--arch/ia64/kernel/Makefile2
-rw-r--r--arch/ia64/kernel/acpi.c4
-rw-r--r--arch/ia64/kernel/msi_ia64.c4
-rw-r--r--arch/ia64/kernel/pci-dma.c2
-rw-r--r--arch/m32r/Kconfig1
-rw-r--r--arch/m68k/Kconfig195
-rw-r--r--arch/m68k/Kconfig.bus55
-rw-r--r--arch/m68k/Kconfig.cpu429
-rw-r--r--arch/m68k/Kconfig.devices123
-rw-r--r--arch/m68k/Kconfig.machine (renamed from arch/m68k/Kconfig.nommu)562
-rw-r--r--arch/m68k/Kconfig.mmu411
-rw-r--r--arch/m68k/Makefile168
-rw-r--r--arch/m68k/Makefile_mm121
-rw-r--r--arch/m68k/Makefile_no124
-rw-r--r--arch/m68k/include/asm/entry.h255
-rw-r--r--arch/m68k/include/asm/entry_mm.h128
-rw-r--r--arch/m68k/include/asm/entry_no.h181
-rw-r--r--arch/m68k/include/asm/m520xsim.h26
-rw-r--r--arch/m68k/include/asm/mcfqspi.h8
-rw-r--r--arch/m68k/include/asm/page_no.h3
-rw-r--r--arch/m68k/include/asm/processor.h6
-rw-r--r--arch/m68k/include/asm/sections.h2
-rw-r--r--arch/m68k/kernel/Makefile24
-rw-r--r--arch/m68k/kernel/Makefile_mm17
-rw-r--r--arch/m68k/kernel/Makefile_no10
-rw-r--r--arch/m68k/kernel/entry_no.S6
-rw-r--r--arch/m68k/kernel/setup_no.c4
-rw-r--r--arch/m68k/kernel/traps.c1108
-rw-r--r--arch/m68k/kernel/traps_mm.c1207
-rw-r--r--arch/m68k/kernel/traps_no.c361
-rw-r--r--arch/m68k/kernel/vectors.c145
-rw-r--r--arch/m68k/kernel/vmlinux.lds_no.S1
-rw-r--r--arch/m68k/lib/memcpy.c9
-rw-r--r--arch/m68k/mac/macints.c2
-rw-r--r--arch/m68k/mac/misc.c40
-rw-r--r--arch/m68k/mm/init_no.c21
-rw-r--r--arch/m68k/platform/520x/config.c6
-rw-r--r--arch/m68k/platform/520x/gpio.c50
-rw-r--r--arch/m68k/platform/68328/Makefile5
-rw-r--r--arch/m68k/platform/68328/entry.S18
-rw-r--r--arch/m68k/platform/68360/Makefile6
-rw-r--r--arch/m68k/platform/68360/entry.S4
-rw-r--r--arch/m68k/platform/coldfire/entry.S6
-rw-r--r--arch/m68k/q40/README2
-rw-r--r--arch/microblaze/include/asm/dma-mapping.h2
-rw-r--r--arch/microblaze/mm/init.c6
-rw-r--r--arch/mips/Kconfig8
-rw-r--r--arch/mips/bcm47xx/Kconfig31
-rw-r--r--arch/mips/bcm47xx/Makefile3
-rw-r--r--arch/mips/bcm47xx/gpio.c82
-rw-r--r--arch/mips/bcm47xx/irq.c12
-rw-r--r--arch/mips/bcm47xx/nvram.c29
-rw-r--r--arch/mips/bcm47xx/serial.c46
-rw-r--r--arch/mips/bcm47xx/setup.c90
-rw-r--r--arch/mips/bcm47xx/time.c16
-rw-r--r--arch/mips/bcm47xx/wgt634u.c14
-rw-r--r--arch/mips/include/asm/lasat/lasat.h6
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/bcm47xx.h26
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/gpio.h108
-rw-r--r--arch/mips/pci/pci-bcm47xx.c6
-rw-r--r--arch/mips/pmc-sierra/msp71xx/msp_serial.c73
-rw-r--r--arch/mips/txx9/generic/setup_tx4939.c2
-rw-r--r--arch/mn10300/Kconfig2
-rw-r--r--arch/mn10300/kernel/irq.c1
-rw-r--r--arch/openrisc/Kconfig2
-rw-r--r--arch/openrisc/include/asm/dma-mapping.h2
-rw-r--r--arch/parisc/Kconfig4
-rw-r--r--arch/parisc/include/asm/dma-mapping.h2
-rw-r--r--arch/parisc/kernel/pci-dma.c2
-rw-r--r--arch/powerpc/Kconfig2
-rw-r--r--arch/powerpc/boot/dts/p1010rdb.dts10
-rw-r--r--arch/powerpc/boot/dts/p1010si.dtsi10
-rw-r--r--arch/powerpc/configs/40x/acadia_defconfig11
-rw-r--r--arch/powerpc/configs/40x/ep405_defconfig5
-rw-r--r--arch/powerpc/configs/40x/hcu4_defconfig5
-rw-r--r--arch/powerpc/configs/40x/kilauea_defconfig9
-rw-r--r--arch/powerpc/configs/40x/makalu_defconfig9
-rw-r--r--arch/powerpc/configs/40x/walnut_defconfig5
-rw-r--r--arch/powerpc/configs/44x/arches_defconfig9
-rw-r--r--arch/powerpc/configs/44x/bamboo_defconfig5
-rw-r--r--arch/powerpc/configs/44x/bluestone_defconfig9
-rw-r--r--arch/powerpc/configs/44x/canyonlands_defconfig9
-rw-r--r--arch/powerpc/configs/44x/ebony_defconfig5
-rw-r--r--arch/powerpc/configs/44x/eiger_defconfig9
-rw-r--r--arch/powerpc/configs/44x/icon_defconfig5
-rw-r--r--arch/powerpc/configs/44x/katmai_defconfig5
-rw-r--r--arch/powerpc/configs/44x/redwood_defconfig11
-rw-r--r--arch/powerpc/configs/44x/sam440ep_defconfig5
-rw-r--r--arch/powerpc/configs/44x/sequoia_defconfig5
-rw-r--r--arch/powerpc/configs/44x/taishan_defconfig5
-rw-r--r--arch/powerpc/configs/44x/warp_defconfig5
-rw-r--r--arch/powerpc/configs/ppc40x_defconfig5
-rw-r--r--arch/powerpc/configs/ppc44x_defconfig5
-rw-r--r--arch/powerpc/include/asm/qe.h2
-rw-r--r--arch/powerpc/include/asm/udbg.h1
-rw-r--r--arch/powerpc/kernel/udbg.c2
-rw-r--r--arch/powerpc/platforms/40x/Kconfig12
-rw-r--r--arch/powerpc/platforms/44x/Kconfig54
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig2
-rw-r--r--arch/powerpc/platforms/cell/Kconfig8
-rw-r--r--arch/powerpc/platforms/embedded6xx/storcenter.c2
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe.c2
-rw-r--r--arch/powerpc/sysdev/uic.c24
-rw-r--r--arch/s390/Kconfig1
-rw-r--r--arch/s390/hypfs/hypfs_diag.c3
-rw-r--r--arch/s390/include/asm/qdio.h78
-rw-r--r--arch/s390/kernel/suspend.c118
-rw-r--r--arch/s390/kernel/swsusp_asm64.S3
-rw-r--r--arch/sh/include/asm/sh_eth.h25
-rw-r--r--arch/sparc/include/asm/pgtsrmmu.h2
-rw-r--r--arch/sparc/kernel/pci.c3
-rw-r--r--arch/sparc/kernel/signal32.c21
-rw-r--r--arch/sparc/kernel/signal_32.c32
-rw-r--r--arch/sparc/kernel/signal_64.c32
-rw-r--r--arch/sparc/mm/leon_mm.c2
-rw-r--r--arch/tile/kernel/intvec_32.S2
-rw-r--r--arch/tile/lib/atomic_asm_32.S2
-rw-r--r--arch/um/drivers/net_kern.c2
-rw-r--r--arch/unicore32/include/asm/io.h2
-rw-r--r--arch/x86/Kconfig8
-rw-r--r--arch/x86/Kconfig.debug2
-rw-r--r--arch/x86/boot/header.S2
-rw-r--r--arch/x86/configs/x86_64_defconfig4
-rw-r--r--arch/x86/include/asm/device.h2
-rw-r--r--arch/x86/include/asm/dma-mapping.h2
-rw-r--r--arch/x86/include/asm/hw_irq.h2
-rw-r--r--arch/x86/include/asm/hyperv.h1
-rw-r--r--arch/x86/include/asm/irq_remapping.h6
-rw-r--r--arch/x86/include/asm/nmi.h37
-rw-r--r--arch/x86/include/asm/perf_event.h55
-rw-r--r--arch/x86/include/asm/reboot.h2
-rw-r--r--arch/x86/include/asm/xen/page.h6
-rw-r--r--arch/x86/kernel/Makefile2
-rw-r--r--arch/x86/kernel/amd_gart_64.c2
-rw-r--r--arch/x86/kernel/apic/apic.c33
-rw-r--r--arch/x86/kernel/apic/hw_nmi.c27
-rw-r--r--arch/x86/kernel/apic/io_apic.c284
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c20
-rw-r--r--arch/x86/kernel/apm_32.c2
-rw-r--r--arch/x86/kernel/cpu/Makefile7
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce-inject.c20
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c23
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_intel.c10
-rw-r--r--arch/x86/kernel/cpu/perf_event.c442
-rw-r--r--arch/x86/kernel/cpu/perf_event.h505
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd.c38
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd_ibs.c294
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel.c146
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_ds.c79
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_lbr.c28
-rw-r--r--arch/x86/kernel/cpu/perf_event_p4.c10
-rw-r--r--arch/x86/kernel/cpu/perf_event_p6.c9
-rw-r--r--arch/x86/kernel/crash.c5
-rw-r--r--arch/x86/kernel/jump_label.c2
-rw-r--r--arch/x86/kernel/kgdb.c60
-rw-r--r--arch/x86/kernel/kprobes.c5
-rw-r--r--arch/x86/kernel/nmi.c433
-rw-r--r--arch/x86/kernel/pci-dma.c4
-rw-r--r--arch/x86/kernel/process_32.c4
-rw-r--r--arch/x86/kernel/process_64.c2
-rw-r--r--arch/x86/kernel/reboot.c23
-rw-r--r--arch/x86/kernel/traps.c155
-rw-r--r--arch/x86/kernel/vsyscall_64.c2
-rw-r--r--arch/x86/mm/init.c3
-rw-r--r--arch/x86/mm/mmio-mod.c1
-rw-r--r--arch/x86/oprofile/nmi_int.c44
-rw-r--r--arch/x86/oprofile/nmi_timer_int.c28
-rw-r--r--arch/x86/oprofile/op_model_amd.c234
-rw-r--r--arch/x86/oprofile/op_model_ppro.c27
-rw-r--r--arch/x86/oprofile/op_x86_model.h1
-rw-r--r--arch/x86/pci/xen.c32
-rw-r--r--arch/x86/platform/mrst/mrst.c25
-rw-r--r--arch/x86/xen/Kconfig11
-rw-r--r--arch/x86/xen/enlighten.c1
-rw-r--r--arch/x86/xen/mmu.c52
-rw-r--r--arch/x86/xen/p2m.c128
-rw-r--r--arch/x86/xen/setup.c284
-rw-r--r--arch/xtensa/platforms/iss/network.c2
469 files changed, 8376 insertions, 7942 deletions
diff --git a/arch/alpha/include/asm/fcntl.h b/arch/alpha/include/asm/fcntl.h
index 1b71ca70c9f..6d9e805f18a 100644
--- a/arch/alpha/include/asm/fcntl.h
+++ b/arch/alpha/include/asm/fcntl.h
@@ -51,8 +51,6 @@
51#define F_EXLCK 16 /* or 3 */ 51#define F_EXLCK 16 /* or 3 */
52#define F_SHLCK 32 /* or 4 */ 52#define F_SHLCK 32 /* or 4 */
53 53
54#define F_INPROGRESS 64
55
56#include <asm-generic/fcntl.h> 54#include <asm-generic/fcntl.h>
57 55
58#endif 56#endif
diff --git a/arch/alpha/kernel/srm_env.c b/arch/alpha/kernel/srm_env.c
index f0df3fbd840..b9fc6c309d2 100644
--- a/arch/alpha/kernel/srm_env.c
+++ b/arch/alpha/kernel/srm_env.c
@@ -4,9 +4,8 @@
4 * 4 *
5 * (C) 2001,2002,2006 by Jan-Benedict Glaw <jbglaw@lug-owl.de> 5 * (C) 2001,2002,2006 by Jan-Benedict Glaw <jbglaw@lug-owl.de>
6 * 6 *
7 * This driver is at all a modified version of Erik Mouw's 7 * This driver is a modified version of Erik Mouw's example proc
8 * Documentation/DocBook/procfs_example.c, so: thank 8 * interface, so: thank you, Erik! He can be reached via email at
9 * you, Erik! He can be reached via email at
10 * <J.A.K.Mouw@its.tudelft.nl>. It is based on an idea 9 * <J.A.K.Mouw@its.tudelft.nl>. It is based on an idea
11 * provided by DEC^WCompaq^WIntel's "Jumpstart" CD. They 10 * provided by DEC^WCompaq^WIntel's "Jumpstart" CD. They
12 * included a patch like this as well. Thanks for idea! 11 * included a patch like this as well. Thanks for idea!
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 3146ed3f6ec..795126ea493 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -3,7 +3,7 @@ config ARM
3 default y 3 default y
4 select HAVE_AOUT 4 select HAVE_AOUT
5 select HAVE_DMA_API_DEBUG 5 select HAVE_DMA_API_DEBUG
6 select HAVE_IDE 6 select HAVE_IDE if PCI || ISA || PCMCIA
7 select HAVE_MEMBLOCK 7 select HAVE_MEMBLOCK
8 select RTC_LIB 8 select RTC_LIB
9 select SYS_SUPPORTS_APM_EMULATION 9 select SYS_SUPPORTS_APM_EMULATION
@@ -195,7 +195,8 @@ config VECTORS_BASE
195 The base address of exception vectors. 195 The base address of exception vectors.
196 196
197config ARM_PATCH_PHYS_VIRT 197config ARM_PATCH_PHYS_VIRT
198 bool "Patch physical to virtual translations at runtime" 198 bool "Patch physical to virtual translations at runtime" if EMBEDDED
199 default y
199 depends on !XIP_KERNEL && MMU 200 depends on !XIP_KERNEL && MMU
200 depends on !ARCH_REALVIEW || !SPARSEMEM 201 depends on !ARCH_REALVIEW || !SPARSEMEM
201 help 202 help
@@ -204,16 +205,16 @@ config ARM_PATCH_PHYS_VIRT
204 kernel in system memory. 205 kernel in system memory.
205 206
206 This can only be used with non-XIP MMU kernels where the base 207 This can only be used with non-XIP MMU kernels where the base
207 of physical memory is at a 16MB boundary, or theoretically 64K 208 of physical memory is at a 16MB boundary.
208 for the MSM machine class. 209
210 Only disable this option if you know that you do not require
211 this feature (eg, building a kernel for a single machine) and
212 you need to shrink the kernel to the minimal size.
209 213
210config ARM_PATCH_PHYS_VIRT_16BIT 214
215config GENERIC_BUG
211 def_bool y 216 def_bool y
212 depends on ARM_PATCH_PHYS_VIRT && ARCH_MSM 217 depends on BUG
213 help
214 This option extends the physical to virtual translation patching
215 to allow physical memory down to a theoretical minimum of 64K
216 boundaries.
217 218
218source "init/Kconfig" 219source "init/Kconfig"
219 220
@@ -301,7 +302,6 @@ config ARCH_AT91
301 select ARCH_REQUIRE_GPIOLIB 302 select ARCH_REQUIRE_GPIOLIB
302 select HAVE_CLK 303 select HAVE_CLK
303 select CLKDEV_LOOKUP 304 select CLKDEV_LOOKUP
304 select ARM_PATCH_PHYS_VIRT if MMU
305 help 305 help
306 This enables support for systems based on the Atmel AT91RM9200, 306 This enables support for systems based on the Atmel AT91RM9200,
307 AT91SAM9 and AT91CAP9 processors. 307 AT91SAM9 and AT91CAP9 processors.
@@ -385,6 +385,7 @@ config ARCH_FOOTBRIDGE
385 select CPU_SA110 385 select CPU_SA110
386 select FOOTBRIDGE 386 select FOOTBRIDGE
387 select GENERIC_CLOCKEVENTS 387 select GENERIC_CLOCKEVENTS
388 select HAVE_IDE
388 help 389 help
389 Support for systems based on the DC21285 companion chip 390 Support for systems based on the DC21285 companion chip
390 ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder. 391 ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder.
@@ -631,6 +632,8 @@ config ARCH_PXA
631 select SPARSE_IRQ 632 select SPARSE_IRQ
632 select AUTO_ZRELADDR 633 select AUTO_ZRELADDR
633 select MULTI_IRQ_HANDLER 634 select MULTI_IRQ_HANDLER
635 select ARM_CPU_SUSPEND if PM
636 select HAVE_IDE
634 help 637 help
635 Support for Intel/Marvell's PXA2xx/PXA3xx processor line. 638 Support for Intel/Marvell's PXA2xx/PXA3xx processor line.
636 639
@@ -671,6 +674,7 @@ config ARCH_RPC
671 select NO_IOPORT 674 select NO_IOPORT
672 select ARCH_SPARSEMEM_ENABLE 675 select ARCH_SPARSEMEM_ENABLE
673 select ARCH_USES_GETTIMEOFFSET 676 select ARCH_USES_GETTIMEOFFSET
677 select HAVE_IDE
674 help 678 help
675 On the Acorn Risc-PC, Linux can support the internal IDE disk and 679 On the Acorn Risc-PC, Linux can support the internal IDE disk and
676 CD-ROM interface, serial and parallel port, and the floppy drive. 680 CD-ROM interface, serial and parallel port, and the floppy drive.
@@ -689,6 +693,7 @@ config ARCH_SA1100
689 select HAVE_SCHED_CLOCK 693 select HAVE_SCHED_CLOCK
690 select TICK_ONESHOT 694 select TICK_ONESHOT
691 select ARCH_REQUIRE_GPIOLIB 695 select ARCH_REQUIRE_GPIOLIB
696 select HAVE_IDE
692 help 697 help
693 Support for StrongARM 11x0 based boards. 698 Support for StrongARM 11x0 based boards.
694 699
@@ -722,7 +727,6 @@ config ARCH_S3C64XX
722 select ARCH_REQUIRE_GPIOLIB 727 select ARCH_REQUIRE_GPIOLIB
723 select SAMSUNG_CLKSRC 728 select SAMSUNG_CLKSRC
724 select SAMSUNG_IRQ_VIC_TIMER 729 select SAMSUNG_IRQ_VIC_TIMER
725 select SAMSUNG_IRQ_UART
726 select S3C_GPIO_TRACK 730 select S3C_GPIO_TRACK
727 select S3C_GPIO_PULL_UPDOWN 731 select S3C_GPIO_PULL_UPDOWN
728 select S3C_GPIO_CFG_S3C24XX 732 select S3C_GPIO_CFG_S3C24XX
@@ -1375,6 +1379,7 @@ config SMP
1375 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || \ 1379 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || \
1376 ARCH_EXYNOS4 || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4 || \ 1380 ARCH_EXYNOS4 || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4 || \
1377 ARCH_MSM_SCORPIONMP || ARCH_SHMOBILE 1381 ARCH_MSM_SCORPIONMP || ARCH_SHMOBILE
1382 depends on MMU
1378 select USE_GENERIC_SMP_HELPERS 1383 select USE_GENERIC_SMP_HELPERS
1379 select HAVE_ARM_SCU if !ARCH_MSM_SCORPIONMP 1384 select HAVE_ARM_SCU if !ARCH_MSM_SCORPIONMP
1380 help 1385 help
@@ -1388,7 +1393,7 @@ config SMP
1388 processor machines. On a single processor machine, the kernel will 1393 processor machines. On a single processor machine, the kernel will
1389 run faster if you say N here. 1394 run faster if you say N here.
1390 1395
1391 See also <file:Documentation/i386/IO-APIC.txt>, 1396 See also <file:Documentation/x86/i386/IO-APIC.txt>,
1392 <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at 1397 <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at
1393 <http://tldp.org/HOWTO/SMP-HOWTO.html>. 1398 <http://tldp.org/HOWTO/SMP-HOWTO.html>.
1394 1399
@@ -1407,6 +1412,31 @@ config SMP_ON_UP
1407 1412
1408 If you don't know what to do here, say Y. 1413 If you don't know what to do here, say Y.
1409 1414
1415config ARM_CPU_TOPOLOGY
1416 bool "Support cpu topology definition"
1417 depends on SMP && CPU_V7
1418 default y
1419 help
1420 Support ARM cpu topology definition. The MPIDR register defines
1421 affinity between processors which is then used to describe the cpu
1422 topology of an ARM System.
1423
1424config SCHED_MC
1425 bool "Multi-core scheduler support"
1426 depends on ARM_CPU_TOPOLOGY
1427 help
1428 Multi-core scheduler support improves the CPU scheduler's decision
1429 making when dealing with multi-core CPU chips at a cost of slightly
1430 increased overhead in some places. If unsure say N here.
1431
1432config SCHED_SMT
1433 bool "SMT scheduler support"
1434 depends on ARM_CPU_TOPOLOGY
1435 help
1436 Improves the CPU scheduler's decision making when dealing with
1437 MultiThreading at a cost of slightly increased overhead in some
1438 places. If unsure say N here.
1439
1410config HAVE_ARM_SCU 1440config HAVE_ARM_SCU
1411 bool 1441 bool
1412 help 1442 help
@@ -1482,6 +1512,7 @@ config THUMB2_KERNEL
1482 depends on CPU_V7 && !CPU_V6 && !CPU_V6K && EXPERIMENTAL 1512 depends on CPU_V7 && !CPU_V6 && !CPU_V6K && EXPERIMENTAL
1483 select AEABI 1513 select AEABI
1484 select ARM_ASM_UNIFIED 1514 select ARM_ASM_UNIFIED
1515 select ARM_UNWIND
1485 help 1516 help
1486 By enabling this option, the kernel will be compiled in 1517 By enabling this option, the kernel will be compiled in
1487 Thumb-2 mode. A compiler/assembler that understand the unified 1518 Thumb-2 mode. A compiler/assembler that understand the unified
@@ -2101,6 +2132,9 @@ config ARCH_SUSPEND_POSSIBLE
2101 CPU_V6 || CPU_V6K || CPU_V7 || CPU_XSC3 || CPU_XSCALE 2132 CPU_V6 || CPU_V6K || CPU_V7 || CPU_XSC3 || CPU_XSCALE
2102 def_bool y 2133 def_bool y
2103 2134
2135config ARM_CPU_SUSPEND
2136 def_bool PM_SLEEP
2137
2104endmenu 2138endmenu
2105 2139
2106source "net/Kconfig" 2140source "net/Kconfig"
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 81cbe40c159..df3eb3ccd76 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -65,13 +65,71 @@ config DEBUG_USER
65 65
66# These options are only for real kernel hackers who want to get their hands dirty. 66# These options are only for real kernel hackers who want to get their hands dirty.
67config DEBUG_LL 67config DEBUG_LL
68 bool "Kernel low-level debugging functions" 68 bool "Kernel low-level debugging functions (read help!)"
69 depends on DEBUG_KERNEL 69 depends on DEBUG_KERNEL
70 help 70 help
71 Say Y here to include definitions of printascii, printch, printhex 71 Say Y here to include definitions of printascii, printch, printhex
72 in the kernel. This is helpful if you are debugging code that 72 in the kernel. This is helpful if you are debugging code that
73 executes before the console is initialized. 73 executes before the console is initialized.
74 74
75 Note that selecting this option will limit the kernel to a single
76 UART definition, as specified below. Attempting to boot the kernel
77 image on a different platform *will not work*, so this option should
78 not be enabled for kernels that are intended to be portable.
79
80choice
81 prompt "Kernel low-level debugging port"
82 depends on DEBUG_LL
83
84 config DEBUG_LL_UART_NONE
85 bool "No low-level debugging UART"
86 help
87 Say Y here if your platform doesn't provide a UART option
88 below. This relies on your platform choosing the right UART
89 definition internally in order for low-level debugging to
90 work.
91
92 config DEBUG_ICEDCC
93 bool "Kernel low-level debugging via EmbeddedICE DCC channel"
94 help
95 Say Y here if you want the debug print routines to direct
96 their output to the EmbeddedICE macrocell's DCC channel using
97 co-processor 14. This is known to work on the ARM9 style ICE
98 channel and on the XScale with the PEEDI.
99
100 Note that the system will appear to hang during boot if there
101 is nothing connected to read from the DCC.
102
103 config DEBUG_FOOTBRIDGE_COM1
104 bool "Kernel low-level debugging messages via footbridge 8250 at PCI COM1"
105 depends on FOOTBRIDGE
106 help
107 Say Y here if you want the debug print routines to direct
108 their output to the 8250 at PCI COM1.
109
110 config DEBUG_DC21285_PORT
111 bool "Kernel low-level debugging messages via footbridge serial port"
112 depends on FOOTBRIDGE
113 help
114 Say Y here if you want the debug print routines to direct
115 their output to the serial port in the DC21285 (Footbridge).
116
117 config DEBUG_CLPS711X_UART1
118 bool "Kernel low-level debugging messages via UART1"
119 depends on ARCH_CLPS711X
120 help
121 Say Y here if you want the debug print routines to direct
122 their output to the first serial port on these devices.
123
124 config DEBUG_CLPS711X_UART2
125 bool "Kernel low-level debugging messages via UART2"
126 depends on ARCH_CLPS711X
127 help
128 Say Y here if you want the debug print routines to direct
129 their output to the second serial port on these devices.
130
131endchoice
132
75config EARLY_PRINTK 133config EARLY_PRINTK
76 bool "Early printk" 134 bool "Early printk"
77 depends on DEBUG_LL 135 depends on DEBUG_LL
@@ -80,43 +138,14 @@ config EARLY_PRINTK
80 kernel low-level debugging functions. Add earlyprintk to your 138 kernel low-level debugging functions. Add earlyprintk to your
81 kernel parameters to enable this console. 139 kernel parameters to enable this console.
82 140
83config DEBUG_ICEDCC
84 bool "Kernel low-level debugging via EmbeddedICE DCC channel"
85 depends on DEBUG_LL
86 help
87 Say Y here if you want the debug print routines to direct their
88 output to the EmbeddedICE macrocell's DCC channel using
89 co-processor 14. This is known to work on the ARM9 style ICE
90 channel and on the XScale with the PEEDI.
91
92 It does include a timeout to ensure that the system does not
93 totally freeze when there is nothing connected to read.
94
95config OC_ETM 141config OC_ETM
96 bool "On-chip ETM and ETB" 142 bool "On-chip ETM and ETB"
97 select ARM_AMBA 143 depends on ARM_AMBA
98 help 144 help
99 Enables the on-chip embedded trace macrocell and embedded trace 145 Enables the on-chip embedded trace macrocell and embedded trace
100 buffer driver that will allow you to collect traces of the 146 buffer driver that will allow you to collect traces of the
101 kernel code. 147 kernel code.
102 148
103config DEBUG_DC21285_PORT
104 bool "Kernel low-level debugging messages via footbridge serial port"
105 depends on DEBUG_LL && FOOTBRIDGE
106 help
107 Say Y here if you want the debug print routines to direct their
108 output to the serial port in the DC21285 (Footbridge). Saying N
109 will cause the debug messages to appear on the first 16550
110 serial port.
111
112config DEBUG_CLPS711X_UART2
113 bool "Kernel low-level debugging messages via UART2"
114 depends on DEBUG_LL && ARCH_CLPS711X
115 help
116 Say Y here if you want the debug print routines to direct their
117 output to the second serial port on these devices. Saying N will
118 cause the debug messages to appear on the first serial port.
119
120config DEBUG_S3C_UART 149config DEBUG_S3C_UART
121 depends on PLAT_SAMSUNG 150 depends on PLAT_SAMSUNG
122 int "S3C UART to use for low-level debug" 151 int "S3C UART to use for low-level debug"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 70c424eaf7b..5665c2a3b65 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -128,6 +128,9 @@ textofs-$(CONFIG_PM_H1940) := 0x00108000
128ifeq ($(CONFIG_ARCH_SA1100),y) 128ifeq ($(CONFIG_ARCH_SA1100),y)
129textofs-$(CONFIG_SA1111) := 0x00208000 129textofs-$(CONFIG_SA1111) := 0x00208000
130endif 130endif
131textofs-$(CONFIG_ARCH_MSM7X30) := 0x00208000
132textofs-$(CONFIG_ARCH_MSM8X60) := 0x00208000
133textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
131 134
132# Machine directory name. This list is sorted alphanumerically 135# Machine directory name. This list is sorted alphanumerically
133# by CONFIG_* macro name. 136# by CONFIG_* macro name.
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
index a1edfd5a129..176062ac7f0 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -78,7 +78,16 @@ endif
78 78
79$(obj)/uImage: STARTADDR=$(LOADADDR) 79$(obj)/uImage: STARTADDR=$(LOADADDR)
80 80
81check_for_multiple_loadaddr = \
82if [ $(words $(LOADADDR)) -gt 1 ]; then \
83 echo 'multiple load addresses: $(LOADADDR)'; \
84 echo 'This is incompatible with uImages'; \
85 echo 'Specify LOADADDR on the commandline to build an uImage'; \
86 false; \
87fi
88
81$(obj)/uImage: $(obj)/zImage FORCE 89$(obj)/uImage: $(obj)/zImage FORCE
90 @$(check_for_multiple_loadaddr)
82 $(call if_changed,uimage) 91 $(call if_changed,uimage)
83 @echo ' Image $@ is ready' 92 @echo ' Image $@ is ready'
84 93
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 0c74a6fab95..a6b30b35ca6 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -139,8 +139,16 @@ bad_syms=$$($(CROSS_COMPILE)nm $@ | sed -n 's/^.\{8\} [bc] \(.*\)/\1/p') && \
139 ( echo "following symbols must have non local/private scope:" >&2; \ 139 ( echo "following symbols must have non local/private scope:" >&2; \
140 echo "$$bad_syms" >&2; rm -f $@; false ) 140 echo "$$bad_syms" >&2; rm -f $@; false )
141 141
142check_for_multiple_zreladdr = \
143if [ $(words $(ZRELADDR)) -gt 1 -a "$(CONFIG_AUTO_ZRELADDR)" = "" ]; then \
144 echo 'multiple zreladdrs: $(ZRELADDR)'; \
145 echo 'This needs CONFIG_AUTO_ZRELADDR to be set'; \
146 false; \
147fi
148
142$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ 149$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \
143 $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE 150 $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE
151 @$(check_for_multiple_zreladdr)
144 $(call if_changed,ld) 152 $(call if_changed,ld)
145 @$(check_for_bad_syms) 153 @$(check_for_bad_syms)
146 154
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index 3227ca952a1..bdbb3f74f0f 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -33,7 +33,7 @@
33#include <asm/mach/irq.h> 33#include <asm/mach/irq.h>
34#include <asm/hardware/gic.h> 34#include <asm/hardware/gic.h>
35 35
36static DEFINE_SPINLOCK(irq_controller_lock); 36static DEFINE_RAW_SPINLOCK(irq_controller_lock);
37 37
38/* Address of GIC 0 CPU interface */ 38/* Address of GIC 0 CPU interface */
39void __iomem *gic_cpu_base_addr __read_mostly; 39void __iomem *gic_cpu_base_addr __read_mostly;
@@ -82,30 +82,30 @@ static void gic_mask_irq(struct irq_data *d)
82{ 82{
83 u32 mask = 1 << (d->irq % 32); 83 u32 mask = 1 << (d->irq % 32);
84 84
85 spin_lock(&irq_controller_lock); 85 raw_spin_lock(&irq_controller_lock);
86 writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_CLEAR + (gic_irq(d) / 32) * 4); 86 writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_CLEAR + (gic_irq(d) / 32) * 4);
87 if (gic_arch_extn.irq_mask) 87 if (gic_arch_extn.irq_mask)
88 gic_arch_extn.irq_mask(d); 88 gic_arch_extn.irq_mask(d);
89 spin_unlock(&irq_controller_lock); 89 raw_spin_unlock(&irq_controller_lock);
90} 90}
91 91
92static void gic_unmask_irq(struct irq_data *d) 92static void gic_unmask_irq(struct irq_data *d)
93{ 93{
94 u32 mask = 1 << (d->irq % 32); 94 u32 mask = 1 << (d->irq % 32);
95 95
96 spin_lock(&irq_controller_lock); 96 raw_spin_lock(&irq_controller_lock);
97 if (gic_arch_extn.irq_unmask) 97 if (gic_arch_extn.irq_unmask)
98 gic_arch_extn.irq_unmask(d); 98 gic_arch_extn.irq_unmask(d);
99 writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_SET + (gic_irq(d) / 32) * 4); 99 writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_SET + (gic_irq(d) / 32) * 4);
100 spin_unlock(&irq_controller_lock); 100 raw_spin_unlock(&irq_controller_lock);
101} 101}
102 102
103static void gic_eoi_irq(struct irq_data *d) 103static void gic_eoi_irq(struct irq_data *d)
104{ 104{
105 if (gic_arch_extn.irq_eoi) { 105 if (gic_arch_extn.irq_eoi) {
106 spin_lock(&irq_controller_lock); 106 raw_spin_lock(&irq_controller_lock);
107 gic_arch_extn.irq_eoi(d); 107 gic_arch_extn.irq_eoi(d);
108 spin_unlock(&irq_controller_lock); 108 raw_spin_unlock(&irq_controller_lock);
109 } 109 }
110 110
111 writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI); 111 writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
@@ -129,7 +129,7 @@ static int gic_set_type(struct irq_data *d, unsigned int type)
129 if (type != IRQ_TYPE_LEVEL_HIGH && type != IRQ_TYPE_EDGE_RISING) 129 if (type != IRQ_TYPE_LEVEL_HIGH && type != IRQ_TYPE_EDGE_RISING)
130 return -EINVAL; 130 return -EINVAL;
131 131
132 spin_lock(&irq_controller_lock); 132 raw_spin_lock(&irq_controller_lock);
133 133
134 if (gic_arch_extn.irq_set_type) 134 if (gic_arch_extn.irq_set_type)
135 gic_arch_extn.irq_set_type(d, type); 135 gic_arch_extn.irq_set_type(d, type);
@@ -154,7 +154,7 @@ static int gic_set_type(struct irq_data *d, unsigned int type)
154 if (enabled) 154 if (enabled)
155 writel_relaxed(enablemask, base + GIC_DIST_ENABLE_SET + enableoff); 155 writel_relaxed(enablemask, base + GIC_DIST_ENABLE_SET + enableoff);
156 156
157 spin_unlock(&irq_controller_lock); 157 raw_spin_unlock(&irq_controller_lock);
158 158
159 return 0; 159 return 0;
160} 160}
@@ -180,12 +180,12 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
180 return -EINVAL; 180 return -EINVAL;
181 181
182 mask = 0xff << shift; 182 mask = 0xff << shift;
183 bit = 1 << (cpu + shift); 183 bit = 1 << (cpu_logical_map(cpu) + shift);
184 184
185 spin_lock(&irq_controller_lock); 185 raw_spin_lock(&irq_controller_lock);
186 val = readl_relaxed(reg) & ~mask; 186 val = readl_relaxed(reg) & ~mask;
187 writel_relaxed(val | bit, reg); 187 writel_relaxed(val | bit, reg);
188 spin_unlock(&irq_controller_lock); 188 raw_spin_unlock(&irq_controller_lock);
189 189
190 return IRQ_SET_MASK_OK; 190 return IRQ_SET_MASK_OK;
191} 191}
@@ -215,9 +215,9 @@ static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
215 215
216 chained_irq_enter(chip, desc); 216 chained_irq_enter(chip, desc);
217 217
218 spin_lock(&irq_controller_lock); 218 raw_spin_lock(&irq_controller_lock);
219 status = readl_relaxed(chip_data->cpu_base + GIC_CPU_INTACK); 219 status = readl_relaxed(chip_data->cpu_base + GIC_CPU_INTACK);
220 spin_unlock(&irq_controller_lock); 220 raw_spin_unlock(&irq_controller_lock);
221 221
222 gic_irq = (status & 0x3ff); 222 gic_irq = (status & 0x3ff);
223 if (gic_irq == 1023) 223 if (gic_irq == 1023)
@@ -259,9 +259,15 @@ static void __init gic_dist_init(struct gic_chip_data *gic,
259 unsigned int irq_start) 259 unsigned int irq_start)
260{ 260{
261 unsigned int gic_irqs, irq_limit, i; 261 unsigned int gic_irqs, irq_limit, i;
262 u32 cpumask;
262 void __iomem *base = gic->dist_base; 263 void __iomem *base = gic->dist_base;
263 u32 cpumask = 1 << smp_processor_id(); 264 u32 cpu = 0;
264 265
266#ifdef CONFIG_SMP
267 cpu = cpu_logical_map(smp_processor_id());
268#endif
269
270 cpumask = 1 << cpu;
265 cpumask |= cpumask << 8; 271 cpumask |= cpumask << 8;
266 cpumask |= cpumask << 16; 272 cpumask |= cpumask << 16;
267 273
@@ -382,7 +388,12 @@ void __cpuinit gic_enable_ppi(unsigned int irq)
382#ifdef CONFIG_SMP 388#ifdef CONFIG_SMP
383void gic_raise_softirq(const struct cpumask *mask, unsigned int irq) 389void gic_raise_softirq(const struct cpumask *mask, unsigned int irq)
384{ 390{
385 unsigned long map = *cpus_addr(*mask); 391 int cpu;
392 unsigned long map = 0;
393
394 /* Convert our logical CPU mask into a physical one. */
395 for_each_cpu(cpu, mask)
396 map |= 1 << cpu_logical_map(cpu);
386 397
387 /* 398 /*
388 * Ensure that stores to Normal memory are visible to the 399 * Ensure that stores to Normal memory are visible to the
diff --git a/arch/arm/common/pl330.c b/arch/arm/common/pl330.c
index 97912fa4878..7129cfbdacd 100644
--- a/arch/arm/common/pl330.c
+++ b/arch/arm/common/pl330.c
@@ -1546,7 +1546,7 @@ int pl330_chan_ctrl(void *ch_id, enum pl330_chan_op op)
1546 1546
1547 /* Start the next */ 1547 /* Start the next */
1548 case PL330_OP_START: 1548 case PL330_OP_START:
1549 if (!_start(thrd)) 1549 if (!_thrd_active(thrd) && !_start(thrd))
1550 ret = -EIO; 1550 ret = -EIO;
1551 break; 1551 break;
1552 1552
diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c
index 7aa4262ada7..01f18a421b1 100644
--- a/arch/arm/common/vic.c
+++ b/arch/arm/common/vic.c
@@ -259,7 +259,6 @@ static void __init vic_disable(void __iomem *base)
259 writel(0, base + VIC_INT_SELECT); 259 writel(0, base + VIC_INT_SELECT);
260 writel(0, base + VIC_INT_ENABLE); 260 writel(0, base + VIC_INT_ENABLE);
261 writel(~0, base + VIC_INT_ENABLE_CLEAR); 261 writel(~0, base + VIC_INT_ENABLE_CLEAR);
262 writel(0, base + VIC_IRQ_STATUS);
263 writel(0, base + VIC_ITCR); 262 writel(0, base + VIC_ITCR);
264 writel(~0, base + VIC_INT_SOFT_CLEAR); 263 writel(~0, base + VIC_INT_SOFT_CLEAR);
265} 264}
@@ -347,7 +346,8 @@ void __init vic_init(void __iomem *base, unsigned int irq_start,
347 346
348 /* Identify which VIC cell this one is, by reading the ID */ 347 /* Identify which VIC cell this one is, by reading the ID */
349 for (i = 0; i < 4; i++) { 348 for (i = 0; i < 4; i++) {
350 u32 addr = ((u32)base & PAGE_MASK) + 0xfe0 + (i * 4); 349 void __iomem *addr;
350 addr = (void __iomem *)((u32)base & PAGE_MASK) + 0xfe0 + (i * 4);
351 cellid |= (readl(addr) & 0xff) << (8 * i); 351 cellid |= (readl(addr) & 0xff) << (8 * i);
352 } 352 }
353 vendor = (cellid >> 12) & 0xff; 353 vendor = (cellid >> 12) & 0xff;
diff --git a/arch/arm/configs/integrator_defconfig b/arch/arm/configs/integrator_defconfig
index 7196ade07e2..1103f62a196 100644
--- a/arch/arm/configs/integrator_defconfig
+++ b/arch/arm/configs/integrator_defconfig
@@ -1,5 +1,6 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_TINY_RCU=y
3CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 5CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
@@ -8,20 +9,29 @@ CONFIG_MODULES=y
8CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
9CONFIG_ARCH_INTEGRATOR=y 10CONFIG_ARCH_INTEGRATOR=y
10CONFIG_ARCH_INTEGRATOR_AP=y 11CONFIG_ARCH_INTEGRATOR_AP=y
12CONFIG_ARCH_INTEGRATOR_CP=y
11CONFIG_CPU_ARM720T=y 13CONFIG_CPU_ARM720T=y
12CONFIG_CPU_ARM920T=y 14CONFIG_CPU_ARM920T=y
15CONFIG_CPU_ARM922T=y
16CONFIG_CPU_ARM926T=y
17CONFIG_CPU_ARM1020=y
18CONFIG_CPU_ARM1022=y
19CONFIG_CPU_ARM1026=y
13CONFIG_PCI=y 20CONFIG_PCI=y
21CONFIG_NO_HZ=y
22CONFIG_HIGH_RES_TIMERS=y
23CONFIG_PREEMPT=y
24CONFIG_AEABI=y
14CONFIG_LEDS=y 25CONFIG_LEDS=y
15CONFIG_LEDS_CPU=y 26CONFIG_LEDS_CPU=y
16CONFIG_ZBOOT_ROM_TEXT=0x0 27CONFIG_ZBOOT_ROM_TEXT=0x0
17CONFIG_ZBOOT_ROM_BSS=0x0 28CONFIG_ZBOOT_ROM_BSS=0x0
18CONFIG_CMDLINE="console=ttyAM0,38400n8 root=/dev/nfs ip=bootp mem=32M" 29CONFIG_CMDLINE="console=ttyAM0,38400n8 root=/dev/nfs ip=bootp"
19CONFIG_CPU_FREQ=y 30CONFIG_CPU_FREQ=y
20CONFIG_CPU_FREQ_GOV_POWERSAVE=y 31CONFIG_CPU_FREQ_GOV_POWERSAVE=y
21CONFIG_CPU_FREQ_GOV_USERSPACE=y 32CONFIG_CPU_FREQ_GOV_USERSPACE=y
22CONFIG_CPU_FREQ_GOV_ONDEMAND=y 33CONFIG_CPU_FREQ_GOV_ONDEMAND=y
23CONFIG_FPE_NWFPE=y 34CONFIG_FPE_NWFPE=y
24CONFIG_PM=y
25CONFIG_NET=y 35CONFIG_NET=y
26CONFIG_PACKET=y 36CONFIG_PACKET=y
27CONFIG_UNIX=y 37CONFIG_UNIX=y
@@ -32,7 +42,6 @@ CONFIG_IP_PNP_DHCP=y
32CONFIG_IP_PNP_BOOTP=y 42CONFIG_IP_PNP_BOOTP=y
33# CONFIG_IPV6 is not set 43# CONFIG_IPV6 is not set
34CONFIG_MTD=y 44CONFIG_MTD=y
35CONFIG_MTD_PARTITIONS=y
36CONFIG_MTD_CMDLINE_PARTS=y 45CONFIG_MTD_CMDLINE_PARTS=y
37CONFIG_MTD_AFS_PARTS=y 46CONFIG_MTD_AFS_PARTS=y
38CONFIG_MTD_CHAR=y 47CONFIG_MTD_CHAR=y
@@ -40,6 +49,7 @@ CONFIG_MTD_BLOCK=y
40CONFIG_MTD_CFI=y 49CONFIG_MTD_CFI=y
41CONFIG_MTD_CFI_ADV_OPTIONS=y 50CONFIG_MTD_CFI_ADV_OPTIONS=y
42CONFIG_MTD_CFI_INTELEXT=y 51CONFIG_MTD_CFI_INTELEXT=y
52CONFIG_MTD_PHYSMAP=y
43CONFIG_BLK_DEV_LOOP=y 53CONFIG_BLK_DEV_LOOP=y
44CONFIG_BLK_DEV_RAM=y 54CONFIG_BLK_DEV_RAM=y
45CONFIG_BLK_DEV_RAM_SIZE=8192 55CONFIG_BLK_DEV_RAM_SIZE=8192
@@ -56,6 +66,8 @@ CONFIG_FB_MODE_HELPERS=y
56CONFIG_FB_MATROX=y 66CONFIG_FB_MATROX=y
57CONFIG_FB_MATROX_MILLENIUM=y 67CONFIG_FB_MATROX_MILLENIUM=y
58CONFIG_FB_MATROX_MYSTIQUE=y 68CONFIG_FB_MATROX_MYSTIQUE=y
69CONFIG_RTC_CLASS=y
70CONFIG_RTC_DRV_PL030=y
59CONFIG_EXT2_FS=y 71CONFIG_EXT2_FS=y
60CONFIG_TMPFS=y 72CONFIG_TMPFS=y
61CONFIG_JFFS2_FS=y 73CONFIG_JFFS2_FS=y
@@ -68,4 +80,3 @@ CONFIG_NFSD_V3=y
68CONFIG_PARTITION_ADVANCED=y 80CONFIG_PARTITION_ADVANCED=y
69CONFIG_MAGIC_SYSRQ=y 81CONFIG_MAGIC_SYSRQ=y
70CONFIG_DEBUG_KERNEL=y 82CONFIG_DEBUG_KERNEL=y
71CONFIG_DEBUG_ERRORS=y
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
index 6550db3aa5c..960abceb8e1 100644
--- a/arch/arm/include/asm/Kbuild
+++ b/arch/arm/include/asm/Kbuild
@@ -1,3 +1,20 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3header-y += hwcap.h 3header-y += hwcap.h
4
5generic-y += auxvec.h
6generic-y += bitsperlong.h
7generic-y += cputime.h
8generic-y += emergency-restart.h
9generic-y += errno.h
10generic-y += ioctl.h
11generic-y += irq_regs.h
12generic-y += kdebug.h
13generic-y += local.h
14generic-y += local64.h
15generic-y += percpu.h
16generic-y += poll.h
17generic-y += resource.h
18generic-y += sections.h
19generic-y += siginfo.h
20generic-y += sizes.h
diff --git a/arch/arm/include/asm/auxvec.h b/arch/arm/include/asm/auxvec.h
deleted file mode 100644
index c0536f6b29a..00000000000
--- a/arch/arm/include/asm/auxvec.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef __ASMARM_AUXVEC_H
2#define __ASMARM_AUXVEC_H
3
4#endif
diff --git a/arch/arm/include/asm/bitsperlong.h b/arch/arm/include/asm/bitsperlong.h
deleted file mode 100644
index 6dc0bb0c13b..00000000000
--- a/arch/arm/include/asm/bitsperlong.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/bitsperlong.h>
diff --git a/arch/arm/include/asm/bug.h b/arch/arm/include/asm/bug.h
index 4d88425a416..9abe7a07d5a 100644
--- a/arch/arm/include/asm/bug.h
+++ b/arch/arm/include/asm/bug.h
@@ -3,21 +3,58 @@
3 3
4 4
5#ifdef CONFIG_BUG 5#ifdef CONFIG_BUG
6#ifdef CONFIG_DEBUG_BUGVERBOSE
7extern void __bug(const char *file, int line) __attribute__((noreturn));
8
9/* give file/line information */
10#define BUG() __bug(__FILE__, __LINE__)
11 6
7/*
8 * Use a suitable undefined instruction to use for ARM/Thumb2 bug handling.
9 * We need to be careful not to conflict with those used by other modules and
10 * the register_undef_hook() system.
11 */
12#ifdef CONFIG_THUMB2_KERNEL
13#define BUG_INSTR_VALUE 0xde02
14#define BUG_INSTR_TYPE ".hword "
12#else 15#else
16#define BUG_INSTR_VALUE 0xe7f001f2
17#define BUG_INSTR_TYPE ".word "
18#endif
13 19
14/* this just causes an oops */
15#define BUG() do { *(int *)0 = 0; } while (1)
16 20
17#endif 21#define BUG() _BUG(__FILE__, __LINE__, BUG_INSTR_VALUE)
22#define _BUG(file, line, value) __BUG(file, line, value)
23
24#ifdef CONFIG_DEBUG_BUGVERBOSE
25
26/*
27 * The extra indirection is to ensure that the __FILE__ string comes through
28 * OK. Many version of gcc do not support the asm %c parameter which would be
29 * preferable to this unpleasantness. We use mergeable string sections to
30 * avoid multiple copies of the string appearing in the kernel image.
31 */
32
33#define __BUG(__file, __line, __value) \
34do { \
35 BUILD_BUG_ON(sizeof(struct bug_entry) != 12); \
36 asm volatile("1:\t" BUG_INSTR_TYPE #__value "\n" \
37 ".pushsection .rodata.str, \"aMS\", %progbits, 1\n" \
38 "2:\t.asciz " #__file "\n" \
39 ".popsection\n" \
40 ".pushsection __bug_table,\"a\"\n" \
41 "3:\t.word 1b, 2b\n" \
42 "\t.hword " #__line ", 0\n" \
43 ".popsection"); \
44 unreachable(); \
45} while (0)
46
47#else /* not CONFIG_DEBUG_BUGVERBOSE */
48
49#define __BUG(__file, __line, __value) \
50do { \
51 asm volatile(BUG_INSTR_TYPE #__value); \
52 unreachable(); \
53} while (0)
54#endif /* CONFIG_DEBUG_BUGVERBOSE */
18 55
19#define HAVE_ARCH_BUG 56#define HAVE_ARCH_BUG
20#endif 57#endif /* CONFIG_BUG */
21 58
22#include <asm-generic/bug.h> 59#include <asm-generic/bug.h>
23 60
diff --git a/arch/arm/include/asm/cachetype.h b/arch/arm/include/asm/cachetype.h
index c023db09fcc..7ea78144ae2 100644
--- a/arch/arm/include/asm/cachetype.h
+++ b/arch/arm/include/asm/cachetype.h
@@ -7,6 +7,7 @@
7#define CACHEID_VIPT (CACHEID_VIPT_ALIASING|CACHEID_VIPT_NONALIASING) 7#define CACHEID_VIPT (CACHEID_VIPT_ALIASING|CACHEID_VIPT_NONALIASING)
8#define CACHEID_ASID_TAGGED (1 << 3) 8#define CACHEID_ASID_TAGGED (1 << 3)
9#define CACHEID_VIPT_I_ALIASING (1 << 4) 9#define CACHEID_VIPT_I_ALIASING (1 << 4)
10#define CACHEID_PIPT (1 << 5)
10 11
11extern unsigned int cacheid; 12extern unsigned int cacheid;
12 13
@@ -16,6 +17,7 @@ extern unsigned int cacheid;
16#define cache_is_vipt_aliasing() cacheid_is(CACHEID_VIPT_ALIASING) 17#define cache_is_vipt_aliasing() cacheid_is(CACHEID_VIPT_ALIASING)
17#define icache_is_vivt_asid_tagged() cacheid_is(CACHEID_ASID_TAGGED) 18#define icache_is_vivt_asid_tagged() cacheid_is(CACHEID_ASID_TAGGED)
18#define icache_is_vipt_aliasing() cacheid_is(CACHEID_VIPT_I_ALIASING) 19#define icache_is_vipt_aliasing() cacheid_is(CACHEID_VIPT_I_ALIASING)
20#define icache_is_pipt() cacheid_is(CACHEID_PIPT)
19 21
20/* 22/*
21 * __LINUX_ARM_ARCH__ is the minimum supported CPU architecture 23 * __LINUX_ARM_ARCH__ is the minimum supported CPU architecture
@@ -26,7 +28,8 @@ extern unsigned int cacheid;
26#if __LINUX_ARM_ARCH__ >= 7 28#if __LINUX_ARM_ARCH__ >= 7
27#define __CACHEID_ARCH_MIN (CACHEID_VIPT_NONALIASING |\ 29#define __CACHEID_ARCH_MIN (CACHEID_VIPT_NONALIASING |\
28 CACHEID_ASID_TAGGED |\ 30 CACHEID_ASID_TAGGED |\
29 CACHEID_VIPT_I_ALIASING) 31 CACHEID_VIPT_I_ALIASING |\
32 CACHEID_PIPT)
30#elif __LINUX_ARM_ARCH__ >= 6 33#elif __LINUX_ARM_ARCH__ >= 6
31#define __CACHEID_ARCH_MIN (~CACHEID_VIVT) 34#define __CACHEID_ARCH_MIN (~CACHEID_VIVT)
32#else 35#else
diff --git a/arch/arm/include/asm/cputime.h b/arch/arm/include/asm/cputime.h
deleted file mode 100644
index 3a8002a5fec..00000000000
--- a/arch/arm/include/asm/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ARM_CPUTIME_H
2#define __ARM_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __ARM_CPUTIME_H */
diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h
index cd4458f6417..cb47d28cbe1 100644
--- a/arch/arm/include/asm/cputype.h
+++ b/arch/arm/include/asm/cputype.h
@@ -8,6 +8,7 @@
8#define CPUID_CACHETYPE 1 8#define CPUID_CACHETYPE 1
9#define CPUID_TCM 2 9#define CPUID_TCM 2
10#define CPUID_TLBTYPE 3 10#define CPUID_TLBTYPE 3
11#define CPUID_MPIDR 5
11 12
12#define CPUID_EXT_PFR0 "c1, 0" 13#define CPUID_EXT_PFR0 "c1, 0"
13#define CPUID_EXT_PFR1 "c1, 1" 14#define CPUID_EXT_PFR1 "c1, 1"
@@ -70,6 +71,11 @@ static inline unsigned int __attribute_const__ read_cpuid_tcmstatus(void)
70 return read_cpuid(CPUID_TCM); 71 return read_cpuid(CPUID_TCM);
71} 72}
72 73
74static inline unsigned int __attribute_const__ read_cpuid_mpidr(void)
75{
76 return read_cpuid(CPUID_MPIDR);
77}
78
73/* 79/*
74 * Intel's XScale3 core supports some v6 features (supersections, L2) 80 * Intel's XScale3 core supports some v6 features (supersections, L2)
75 * but advertises itself as v5 as it does not support the v6 ISA. For 81 * but advertises itself as v5 as it does not support the v6 ISA. For
diff --git a/arch/arm/include/asm/device.h b/arch/arm/include/asm/device.h
index 9f390ce335c..6615f03f56a 100644
--- a/arch/arm/include/asm/device.h
+++ b/arch/arm/include/asm/device.h
@@ -10,6 +10,9 @@ struct dev_archdata {
10#ifdef CONFIG_DMABOUNCE 10#ifdef CONFIG_DMABOUNCE
11 struct dmabounce_device_info *dmabounce; 11 struct dmabounce_device_info *dmabounce;
12#endif 12#endif
13#ifdef CONFIG_IOMMU_API
14 void *iommu; /* private IOMMU data */
15#endif
13}; 16};
14 17
15struct pdev_archdata { 18struct pdev_archdata {
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index 7a21d0bf713..28b7ee8d739 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -32,7 +32,7 @@ static inline unsigned long dma_to_pfn(struct device *dev, dma_addr_t addr)
32 32
33static inline void *dma_to_virt(struct device *dev, dma_addr_t addr) 33static inline void *dma_to_virt(struct device *dev, dma_addr_t addr)
34{ 34{
35 return (void *)__bus_to_virt(addr); 35 return (void *)__bus_to_virt((unsigned long)addr);
36} 36}
37 37
38static inline dma_addr_t virt_to_dma(struct device *dev, void *addr) 38static inline dma_addr_t virt_to_dma(struct device *dev, void *addr)
diff --git a/arch/arm/include/asm/dma.h b/arch/arm/include/asm/dma.h
index 628670e9d7c..69a5b0b6455 100644
--- a/arch/arm/include/asm/dma.h
+++ b/arch/arm/include/asm/dma.h
@@ -34,18 +34,18 @@
34#define DMA_MODE_CASCADE 0xc0 34#define DMA_MODE_CASCADE 0xc0
35#define DMA_AUTOINIT 0x10 35#define DMA_AUTOINIT 0x10
36 36
37extern spinlock_t dma_spin_lock; 37extern raw_spinlock_t dma_spin_lock;
38 38
39static inline unsigned long claim_dma_lock(void) 39static inline unsigned long claim_dma_lock(void)
40{ 40{
41 unsigned long flags; 41 unsigned long flags;
42 spin_lock_irqsave(&dma_spin_lock, flags); 42 raw_spin_lock_irqsave(&dma_spin_lock, flags);
43 return flags; 43 return flags;
44} 44}
45 45
46static inline void release_dma_lock(unsigned long flags) 46static inline void release_dma_lock(unsigned long flags)
47{ 47{
48 spin_unlock_irqrestore(&dma_spin_lock, flags); 48 raw_spin_unlock_irqrestore(&dma_spin_lock, flags);
49} 49}
50 50
51/* Clear the 'DMA Pointer Flip Flop'. 51/* Clear the 'DMA Pointer Flip Flop'.
diff --git a/arch/arm/include/asm/ecard.h b/arch/arm/include/asm/ecard.h
index 29f2610efc7..eaea14676d5 100644
--- a/arch/arm/include/asm/ecard.h
+++ b/arch/arm/include/asm/ecard.h
@@ -161,7 +161,6 @@ struct expansion_card {
161 161
162 /* Private internal data */ 162 /* Private internal data */
163 const char *card_desc; /* Card description */ 163 const char *card_desc; /* Card description */
164 CONST unsigned int podaddr; /* Base Linux address for card */
165 CONST loader_t loader; /* loader program */ 164 CONST loader_t loader; /* loader program */
166 u64 dma_mask; 165 u64 dma_mask;
167}; 166};
diff --git a/arch/arm/include/asm/emergency-restart.h b/arch/arm/include/asm/emergency-restart.h
deleted file mode 100644
index 108d8c48e42..00000000000
--- a/arch/arm/include/asm/emergency-restart.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_EMERGENCY_RESTART_H
2#define _ASM_EMERGENCY_RESTART_H
3
4#include <asm-generic/emergency-restart.h>
5
6#endif /* _ASM_EMERGENCY_RESTART_H */
diff --git a/arch/arm/include/asm/errno.h b/arch/arm/include/asm/errno.h
deleted file mode 100644
index 6e60f0612bb..00000000000
--- a/arch/arm/include/asm/errno.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ARM_ERRNO_H
2#define _ARM_ERRNO_H
3
4#include <asm-generic/errno.h>
5
6#endif
diff --git a/arch/arm/include/asm/exception.h b/arch/arm/include/asm/exception.h
new file mode 100644
index 00000000000..5abaf5bbd98
--- /dev/null
+++ b/arch/arm/include/asm/exception.h
@@ -0,0 +1,19 @@
1/*
2 * Annotations for marking C functions as exception handlers.
3 *
4 * These should only be used for C functions that are called from the low
5 * level exception entry code and not any intervening C code.
6 */
7#ifndef __ASM_ARM_EXCEPTION_H
8#define __ASM_ARM_EXCEPTION_H
9
10#include <linux/ftrace.h>
11
12#define __exception __attribute__((section(".exception.text")))
13#ifdef CONFIG_FUNCTION_GRAPH_TRACER
14#define __exception_irq_entry __irq_entry
15#else
16#define __exception_irq_entry __exception
17#endif
18
19#endif /* __ASM_ARM_EXCEPTION_H */
diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h
index 99a6ed7e1bf..434edccdf7f 100644
--- a/arch/arm/include/asm/hardware/cache-l2x0.h
+++ b/arch/arm/include/asm/hardware/cache-l2x0.h
@@ -52,6 +52,8 @@
52#define L2X0_LOCKDOWN_WAY_D_BASE 0x900 52#define L2X0_LOCKDOWN_WAY_D_BASE 0x900
53#define L2X0_LOCKDOWN_WAY_I_BASE 0x904 53#define L2X0_LOCKDOWN_WAY_I_BASE 0x904
54#define L2X0_LOCKDOWN_STRIDE 0x08 54#define L2X0_LOCKDOWN_STRIDE 0x08
55#define L2X0_ADDR_FILTER_START 0xC00
56#define L2X0_ADDR_FILTER_END 0xC04
55#define L2X0_TEST_OPERATION 0xF00 57#define L2X0_TEST_OPERATION 0xF00
56#define L2X0_LINE_DATA 0xF10 58#define L2X0_LINE_DATA 0xF10
57#define L2X0_LINE_TAG 0xF30 59#define L2X0_LINE_TAG 0xF30
@@ -65,8 +67,23 @@
65#define L2X0_CACHE_ID_PART_MASK (0xf << 6) 67#define L2X0_CACHE_ID_PART_MASK (0xf << 6)
66#define L2X0_CACHE_ID_PART_L210 (1 << 6) 68#define L2X0_CACHE_ID_PART_L210 (1 << 6)
67#define L2X0_CACHE_ID_PART_L310 (3 << 6) 69#define L2X0_CACHE_ID_PART_L310 (3 << 6)
70#define L2X0_CACHE_ID_RTL_MASK 0x3f
71#define L2X0_CACHE_ID_RTL_R0P0 0x0
72#define L2X0_CACHE_ID_RTL_R1P0 0x2
73#define L2X0_CACHE_ID_RTL_R2P0 0x4
74#define L2X0_CACHE_ID_RTL_R3P0 0x5
75#define L2X0_CACHE_ID_RTL_R3P1 0x6
76#define L2X0_CACHE_ID_RTL_R3P2 0x8
68 77
69#define L2X0_AUX_CTRL_MASK 0xc0000fff 78#define L2X0_AUX_CTRL_MASK 0xc0000fff
79#define L2X0_AUX_CTRL_DATA_RD_LATENCY_SHIFT 0
80#define L2X0_AUX_CTRL_DATA_RD_LATENCY_MASK 0x7
81#define L2X0_AUX_CTRL_DATA_WR_LATENCY_SHIFT 3
82#define L2X0_AUX_CTRL_DATA_WR_LATENCY_MASK (0x7 << 3)
83#define L2X0_AUX_CTRL_TAG_LATENCY_SHIFT 6
84#define L2X0_AUX_CTRL_TAG_LATENCY_MASK (0x7 << 6)
85#define L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT 9
86#define L2X0_AUX_CTRL_DIRTY_LATENCY_MASK (0x7 << 9)
70#define L2X0_AUX_CTRL_ASSOCIATIVITY_SHIFT 16 87#define L2X0_AUX_CTRL_ASSOCIATIVITY_SHIFT 16
71#define L2X0_AUX_CTRL_WAY_SIZE_SHIFT 17 88#define L2X0_AUX_CTRL_WAY_SIZE_SHIFT 17
72#define L2X0_AUX_CTRL_WAY_SIZE_MASK (0x7 << 17) 89#define L2X0_AUX_CTRL_WAY_SIZE_MASK (0x7 << 17)
@@ -77,8 +94,33 @@
77#define L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT 29 94#define L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT 29
78#define L2X0_AUX_CTRL_EARLY_BRESP_SHIFT 30 95#define L2X0_AUX_CTRL_EARLY_BRESP_SHIFT 30
79 96
97#define L2X0_LATENCY_CTRL_SETUP_SHIFT 0
98#define L2X0_LATENCY_CTRL_RD_SHIFT 4
99#define L2X0_LATENCY_CTRL_WR_SHIFT 8
100
101#define L2X0_ADDR_FILTER_EN 1
102
80#ifndef __ASSEMBLY__ 103#ifndef __ASSEMBLY__
81extern void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask); 104extern void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask);
105extern int l2x0_of_init(__u32 aux_val, __u32 aux_mask);
106
107struct l2x0_regs {
108 unsigned long phy_base;
109 unsigned long aux_ctrl;
110 /*
111 * Whether the following registers need to be saved/restored
112 * depends on platform
113 */
114 unsigned long tag_latency;
115 unsigned long data_latency;
116 unsigned long filter_start;
117 unsigned long filter_end;
118 unsigned long prefetch_ctrl;
119 unsigned long pwr_ctrl;
120};
121
122extern struct l2x0_regs l2x0_saved_regs;
123
82#endif 124#endif
83 125
84#endif 126#endif
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index d66605dea55..065d100fa63 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -80,6 +80,7 @@ extern void __iomem *__arm_ioremap_caller(unsigned long, size_t, unsigned int,
80 80
81extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int); 81extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int);
82extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int); 82extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int);
83extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, bool cached);
83extern void __iounmap(volatile void __iomem *addr); 84extern void __iounmap(volatile void __iomem *addr);
84 85
85/* 86/*
@@ -110,6 +111,27 @@ static inline void __iomem *__typesafe_io(unsigned long addr)
110#include <mach/io.h> 111#include <mach/io.h>
111 112
112/* 113/*
114 * This is the limit of PC card/PCI/ISA IO space, which is by default
115 * 64K if we have PC card, PCI or ISA support. Otherwise, default to
116 * zero to prevent ISA/PCI drivers claiming IO space (and potentially
117 * oopsing.)
118 *
119 * Only set this larger if you really need inb() et.al. to operate over
120 * a larger address space. Note that SOC_COMMON ioremaps each sockets
121 * IO space area, and so inb() et.al. must be defined to operate as per
122 * readb() et.al. on such platforms.
123 */
124#ifndef IO_SPACE_LIMIT
125#if defined(CONFIG_PCMCIA_SOC_COMMON) || defined(CONFIG_PCMCIA_SOC_COMMON_MODULE)
126#define IO_SPACE_LIMIT ((resource_size_t)0xffffffff)
127#elif defined(CONFIG_PCI) || defined(CONFIG_ISA) || defined(CONFIG_PCCARD)
128#define IO_SPACE_LIMIT ((resource_size_t)0xffff)
129#else
130#define IO_SPACE_LIMIT ((resource_size_t)0)
131#endif
132#endif
133
134/*
113 * IO port access primitives 135 * IO port access primitives
114 * ------------------------- 136 * -------------------------
115 * 137 *
@@ -189,11 +211,11 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
189 * IO port primitives for more information. 211 * IO port primitives for more information.
190 */ 212 */
191#ifdef __mem_pci 213#ifdef __mem_pci
192#define readb_relaxed(c) ({ u8 __v = __raw_readb(__mem_pci(c)); __v; }) 214#define readb_relaxed(c) ({ u8 __r = __raw_readb(__mem_pci(c)); __r; })
193#define readw_relaxed(c) ({ u16 __v = le16_to_cpu((__force __le16) \ 215#define readw_relaxed(c) ({ u16 __r = le16_to_cpu((__force __le16) \
194 __raw_readw(__mem_pci(c))); __v; }) 216 __raw_readw(__mem_pci(c))); __r; })
195#define readl_relaxed(c) ({ u32 __v = le32_to_cpu((__force __le32) \ 217#define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32) \
196 __raw_readl(__mem_pci(c))); __v; }) 218 __raw_readl(__mem_pci(c))); __r; })
197 219
198#define writeb_relaxed(v,c) ((void)__raw_writeb(v,__mem_pci(c))) 220#define writeb_relaxed(v,c) ((void)__raw_writeb(v,__mem_pci(c)))
199#define writew_relaxed(v,c) ((void)__raw_writew((__force u16) \ 221#define writew_relaxed(v,c) ((void)__raw_writew((__force u16) \
@@ -238,7 +260,7 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
238 * ioremap and friends. 260 * ioremap and friends.
239 * 261 *
240 * ioremap takes a PCI memory address, as specified in 262 * ioremap takes a PCI memory address, as specified in
241 * Documentation/IO-mapping.txt. 263 * Documentation/io-mapping.txt.
242 * 264 *
243 */ 265 */
244#ifndef __arch_ioremap 266#ifndef __arch_ioremap
@@ -260,10 +282,16 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
260#define ioread16(p) ({ unsigned int __v = le16_to_cpu((__force __le16)__raw_readw(p)); __iormb(); __v; }) 282#define ioread16(p) ({ unsigned int __v = le16_to_cpu((__force __le16)__raw_readw(p)); __iormb(); __v; })
261#define ioread32(p) ({ unsigned int __v = le32_to_cpu((__force __le32)__raw_readl(p)); __iormb(); __v; }) 283#define ioread32(p) ({ unsigned int __v = le32_to_cpu((__force __le32)__raw_readl(p)); __iormb(); __v; })
262 284
285#define ioread16be(p) ({ unsigned int __v = be16_to_cpu((__force __be16)__raw_readw(p)); __iormb(); __v; })
286#define ioread32be(p) ({ unsigned int __v = be32_to_cpu((__force __be32)__raw_readl(p)); __iormb(); __v; })
287
263#define iowrite8(v,p) ({ __iowmb(); (void)__raw_writeb(v, p); }) 288#define iowrite8(v,p) ({ __iowmb(); (void)__raw_writeb(v, p); })
264#define iowrite16(v,p) ({ __iowmb(); (void)__raw_writew((__force __u16)cpu_to_le16(v), p); }) 289#define iowrite16(v,p) ({ __iowmb(); (void)__raw_writew((__force __u16)cpu_to_le16(v), p); })
265#define iowrite32(v,p) ({ __iowmb(); (void)__raw_writel((__force __u32)cpu_to_le32(v), p); }) 290#define iowrite32(v,p) ({ __iowmb(); (void)__raw_writel((__force __u32)cpu_to_le32(v), p); })
266 291
292#define iowrite16be(v,p) ({ __iowmb(); (void)__raw_writew((__force __u16)cpu_to_be16(v), p); })
293#define iowrite32be(v,p) ({ __iowmb(); (void)__raw_writel((__force __u32)cpu_to_be32(v), p); })
294
267#define ioread8_rep(p,d,c) __raw_readsb(p,d,c) 295#define ioread8_rep(p,d,c) __raw_readsb(p,d,c)
268#define ioread16_rep(p,d,c) __raw_readsw(p,d,c) 296#define ioread16_rep(p,d,c) __raw_readsw(p,d,c)
269#define ioread32_rep(p,d,c) __raw_readsl(p,d,c) 297#define ioread32_rep(p,d,c) __raw_readsl(p,d,c)
diff --git a/arch/arm/include/asm/ioctl.h b/arch/arm/include/asm/ioctl.h
deleted file mode 100644
index b279fe06dfe..00000000000
--- a/arch/arm/include/asm/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ioctl.h>
diff --git a/arch/arm/include/asm/irq_regs.h b/arch/arm/include/asm/irq_regs.h
deleted file mode 100644
index 3dd9c0b7027..00000000000
--- a/arch/arm/include/asm/irq_regs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/irq_regs.h>
diff --git a/arch/arm/include/asm/kdebug.h b/arch/arm/include/asm/kdebug.h
deleted file mode 100644
index 6ece1b03766..00000000000
--- a/arch/arm/include/asm/kdebug.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/kdebug.h>
diff --git a/arch/arm/include/asm/local.h b/arch/arm/include/asm/local.h
deleted file mode 100644
index c11c530f74d..00000000000
--- a/arch/arm/include/asm/local.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/local.h>
diff --git a/arch/arm/include/asm/local64.h b/arch/arm/include/asm/local64.h
deleted file mode 100644
index 36c93b5cc23..00000000000
--- a/arch/arm/include/asm/local64.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/local64.h>
diff --git a/arch/arm/include/asm/localtimer.h b/arch/arm/include/asm/localtimer.h
index 080d74f8128..6fd955d34c6 100644
--- a/arch/arm/include/asm/localtimer.h
+++ b/arch/arm/include/asm/localtimer.h
@@ -10,6 +10,8 @@
10#ifndef __ASM_ARM_LOCALTIMER_H 10#ifndef __ASM_ARM_LOCALTIMER_H
11#define __ASM_ARM_LOCALTIMER_H 11#define __ASM_ARM_LOCALTIMER_H
12 12
13#include <linux/errno.h>
14
13struct clock_event_device; 15struct clock_event_device;
14 16
15/* 17/*
@@ -22,6 +24,10 @@ void percpu_timer_setup(void);
22 */ 24 */
23asmlinkage void do_local_timer(struct pt_regs *); 25asmlinkage void do_local_timer(struct pt_regs *);
24 26
27/*
28 * Called from C code
29 */
30void handle_local_timer(struct pt_regs *);
25 31
26#ifdef CONFIG_LOCAL_TIMERS 32#ifdef CONFIG_LOCAL_TIMERS
27 33
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
index 217aa1911dd..c5699987fa9 100644
--- a/arch/arm/include/asm/mach/arch.h
+++ b/arch/arm/include/asm/mach/arch.h
@@ -34,8 +34,7 @@ struct machine_desc {
34 unsigned int reserve_lp1 :1; /* never has lp1 */ 34 unsigned int reserve_lp1 :1; /* never has lp1 */
35 unsigned int reserve_lp2 :1; /* never has lp2 */ 35 unsigned int reserve_lp2 :1; /* never has lp2 */
36 unsigned int soft_reboot :1; /* soft reboot */ 36 unsigned int soft_reboot :1; /* soft reboot */
37 void (*fixup)(struct machine_desc *, 37 void (*fixup)(struct tag *, char **,
38 struct tag *, char **,
39 struct meminfo *); 38 struct meminfo *);
40 void (*reserve)(void);/* reserve mem blocks */ 39 void (*reserve)(void);/* reserve mem blocks */
41 void (*map_io)(void);/* IO mapping function */ 40 void (*map_io)(void);/* IO mapping function */
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index b8de516e600..441fc4fe826 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -160,7 +160,6 @@
160 * so that all we need to do is modify the 8-bit constant field. 160 * so that all we need to do is modify the 8-bit constant field.
161 */ 161 */
162#define __PV_BITS_31_24 0x81000000 162#define __PV_BITS_31_24 0x81000000
163#define __PV_BITS_23_16 0x00810000
164 163
165extern unsigned long __pv_phys_offset; 164extern unsigned long __pv_phys_offset;
166#define PHYS_OFFSET __pv_phys_offset 165#define PHYS_OFFSET __pv_phys_offset
@@ -178,9 +177,6 @@ static inline unsigned long __virt_to_phys(unsigned long x)
178{ 177{
179 unsigned long t; 178 unsigned long t;
180 __pv_stub(x, t, "add", __PV_BITS_31_24); 179 __pv_stub(x, t, "add", __PV_BITS_31_24);
181#ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT
182 __pv_stub(t, t, "add", __PV_BITS_23_16);
183#endif
184 return t; 180 return t;
185} 181}
186 182
@@ -188,9 +184,6 @@ static inline unsigned long __phys_to_virt(unsigned long x)
188{ 184{
189 unsigned long t; 185 unsigned long t;
190 __pv_stub(x, t, "sub", __PV_BITS_31_24); 186 __pv_stub(x, t, "sub", __PV_BITS_31_24);
191#ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT
192 __pv_stub(t, t, "sub", __PV_BITS_23_16);
193#endif
194 return t; 187 return t;
195} 188}
196#else 189#else
diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h
index b4ffe9d5b52..14965658a92 100644
--- a/arch/arm/include/asm/mmu.h
+++ b/arch/arm/include/asm/mmu.h
@@ -6,7 +6,7 @@
6typedef struct { 6typedef struct {
7#ifdef CONFIG_CPU_HAS_ASID 7#ifdef CONFIG_CPU_HAS_ASID
8 unsigned int id; 8 unsigned int id;
9 spinlock_t id_lock; 9 raw_spinlock_t id_lock;
10#endif 10#endif
11 unsigned int kvm_seq; 11 unsigned int kvm_seq;
12} mm_context_t; 12} mm_context_t;
@@ -16,7 +16,7 @@ typedef struct {
16 16
17/* init_mm.context.id_lock should be initialized. */ 17/* init_mm.context.id_lock should be initialized. */
18#define INIT_MM_CONTEXT(name) \ 18#define INIT_MM_CONTEXT(name) \
19 .context.id_lock = __SPIN_LOCK_UNLOCKED(name.context.id_lock), 19 .context.id_lock = __RAW_SPIN_LOCK_UNLOCKED(name.context.id_lock),
20#else 20#else
21#define ASID(mm) (0) 21#define ASID(mm) (0)
22#endif 22#endif
diff --git a/arch/arm/include/asm/module.h b/arch/arm/include/asm/module.h
index 543b44916d2..6c6809f982f 100644
--- a/arch/arm/include/asm/module.h
+++ b/arch/arm/include/asm/module.h
@@ -31,11 +31,7 @@ struct mod_arch_specific {
31 31
32/* Add __virt_to_phys patching state as well */ 32/* Add __virt_to_phys patching state as well */
33#ifdef CONFIG_ARM_PATCH_PHYS_VIRT 33#ifdef CONFIG_ARM_PATCH_PHYS_VIRT
34#ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT
35#define MODULE_ARCH_VERMAGIC_P2V "p2v16 "
36#else
37#define MODULE_ARCH_VERMAGIC_P2V "p2v8 " 34#define MODULE_ARCH_VERMAGIC_P2V "p2v8 "
38#endif
39#else 35#else
40#define MODULE_ARCH_VERMAGIC_P2V "" 36#define MODULE_ARCH_VERMAGIC_P2V ""
41#endif 37#endif
diff --git a/arch/arm/include/asm/outercache.h b/arch/arm/include/asm/outercache.h
index d8387437ec5..53426c66352 100644
--- a/arch/arm/include/asm/outercache.h
+++ b/arch/arm/include/asm/outercache.h
@@ -34,6 +34,7 @@ struct outer_cache_fns {
34 void (*sync)(void); 34 void (*sync)(void);
35#endif 35#endif
36 void (*set_debug)(unsigned long); 36 void (*set_debug)(unsigned long);
37 void (*resume)(void);
37}; 38};
38 39
39#ifdef CONFIG_OUTER_CACHE 40#ifdef CONFIG_OUTER_CACHE
@@ -74,6 +75,12 @@ static inline void outer_disable(void)
74 outer_cache.disable(); 75 outer_cache.disable();
75} 76}
76 77
78static inline void outer_resume(void)
79{
80 if (outer_cache.resume)
81 outer_cache.resume();
82}
83
77#else 84#else
78 85
79static inline void outer_inv_range(phys_addr_t start, phys_addr_t end) 86static inline void outer_inv_range(phys_addr_t start, phys_addr_t end)
diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h
index ac75d084888..ca94653f1ec 100644
--- a/arch/arm/include/asm/page.h
+++ b/arch/arm/include/asm/page.h
@@ -151,47 +151,7 @@ extern void __cpu_copy_user_highpage(struct page *to, struct page *from,
151#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) 151#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
152extern void copy_page(void *to, const void *from); 152extern void copy_page(void *to, const void *from);
153 153
154typedef unsigned long pteval_t; 154#include <asm/pgtable-2level-types.h>
155
156#undef STRICT_MM_TYPECHECKS
157
158#ifdef STRICT_MM_TYPECHECKS
159/*
160 * These are used to make use of C type-checking..
161 */
162typedef struct { pteval_t pte; } pte_t;
163typedef struct { unsigned long pmd; } pmd_t;
164typedef struct { unsigned long pgd[2]; } pgd_t;
165typedef struct { unsigned long pgprot; } pgprot_t;
166
167#define pte_val(x) ((x).pte)
168#define pmd_val(x) ((x).pmd)
169#define pgd_val(x) ((x).pgd[0])
170#define pgprot_val(x) ((x).pgprot)
171
172#define __pte(x) ((pte_t) { (x) } )
173#define __pmd(x) ((pmd_t) { (x) } )
174#define __pgprot(x) ((pgprot_t) { (x) } )
175
176#else
177/*
178 * .. while these make it easier on the compiler
179 */
180typedef pteval_t pte_t;
181typedef unsigned long pmd_t;
182typedef unsigned long pgd_t[2];
183typedef unsigned long pgprot_t;
184
185#define pte_val(x) (x)
186#define pmd_val(x) (x)
187#define pgd_val(x) ((x)[0])
188#define pgprot_val(x) (x)
189
190#define __pte(x) (x)
191#define __pmd(x) (x)
192#define __pgprot(x) (x)
193
194#endif /* STRICT_MM_TYPECHECKS */
195 155
196#endif /* CONFIG_MMU */ 156#endif /* CONFIG_MMU */
197 157
diff --git a/arch/arm/include/asm/percpu.h b/arch/arm/include/asm/percpu.h
deleted file mode 100644
index b4e32d8ec07..00000000000
--- a/arch/arm/include/asm/percpu.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ARM_PERCPU
2#define __ARM_PERCPU
3
4#include <asm-generic/percpu.h>
5
6#endif
diff --git a/arch/arm/include/asm/pgalloc.h b/arch/arm/include/asm/pgalloc.h
index 22de005f159..3e08fd3fbb6 100644
--- a/arch/arm/include/asm/pgalloc.h
+++ b/arch/arm/include/asm/pgalloc.h
@@ -105,9 +105,9 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
105} 105}
106 106
107static inline void __pmd_populate(pmd_t *pmdp, phys_addr_t pte, 107static inline void __pmd_populate(pmd_t *pmdp, phys_addr_t pte,
108 unsigned long prot) 108 pmdval_t prot)
109{ 109{
110 unsigned long pmdval = (pte + PTE_HWTABLE_OFF) | prot; 110 pmdval_t pmdval = (pte + PTE_HWTABLE_OFF) | prot;
111 pmdp[0] = __pmd(pmdval); 111 pmdp[0] = __pmd(pmdval);
112 pmdp[1] = __pmd(pmdval + 256 * sizeof(pte_t)); 112 pmdp[1] = __pmd(pmdval + 256 * sizeof(pte_t));
113 flush_pmd_entry(pmdp); 113 flush_pmd_entry(pmdp);
diff --git a/arch/arm/include/asm/pgtable-2level-hwdef.h b/arch/arm/include/asm/pgtable-2level-hwdef.h
new file mode 100644
index 00000000000..5cfba15cb40
--- /dev/null
+++ b/arch/arm/include/asm/pgtable-2level-hwdef.h
@@ -0,0 +1,93 @@
1/*
2 * arch/arm/include/asm/pgtable-2level-hwdef.h
3 *
4 * Copyright (C) 1995-2002 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#ifndef _ASM_PGTABLE_2LEVEL_HWDEF_H
11#define _ASM_PGTABLE_2LEVEL_HWDEF_H
12
13/*
14 * Hardware page table definitions.
15 *
16 * + Level 1 descriptor (PMD)
17 * - common
18 */
19#define PMD_TYPE_MASK (_AT(pmdval_t, 3) << 0)
20#define PMD_TYPE_FAULT (_AT(pmdval_t, 0) << 0)
21#define PMD_TYPE_TABLE (_AT(pmdval_t, 1) << 0)
22#define PMD_TYPE_SECT (_AT(pmdval_t, 2) << 0)
23#define PMD_BIT4 (_AT(pmdval_t, 1) << 4)
24#define PMD_DOMAIN(x) (_AT(pmdval_t, (x)) << 5)
25#define PMD_PROTECTION (_AT(pmdval_t, 1) << 9) /* v5 */
26/*
27 * - section
28 */
29#define PMD_SECT_BUFFERABLE (_AT(pmdval_t, 1) << 2)
30#define PMD_SECT_CACHEABLE (_AT(pmdval_t, 1) << 3)
31#define PMD_SECT_XN (_AT(pmdval_t, 1) << 4) /* v6 */
32#define PMD_SECT_AP_WRITE (_AT(pmdval_t, 1) << 10)
33#define PMD_SECT_AP_READ (_AT(pmdval_t, 1) << 11)
34#define PMD_SECT_TEX(x) (_AT(pmdval_t, (x)) << 12) /* v5 */
35#define PMD_SECT_APX (_AT(pmdval_t, 1) << 15) /* v6 */
36#define PMD_SECT_S (_AT(pmdval_t, 1) << 16) /* v6 */
37#define PMD_SECT_nG (_AT(pmdval_t, 1) << 17) /* v6 */
38#define PMD_SECT_SUPER (_AT(pmdval_t, 1) << 18) /* v6 */
39#define PMD_SECT_AF (_AT(pmdval_t, 0))
40
41#define PMD_SECT_UNCACHED (_AT(pmdval_t, 0))
42#define PMD_SECT_BUFFERED (PMD_SECT_BUFFERABLE)
43#define PMD_SECT_WT (PMD_SECT_CACHEABLE)
44#define PMD_SECT_WB (PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
45#define PMD_SECT_MINICACHE (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE)
46#define PMD_SECT_WBWA (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
47#define PMD_SECT_NONSHARED_DEV (PMD_SECT_TEX(2))
48
49/*
50 * - coarse table (not used)
51 */
52
53/*
54 * + Level 2 descriptor (PTE)
55 * - common
56 */
57#define PTE_TYPE_MASK (_AT(pteval_t, 3) << 0)
58#define PTE_TYPE_FAULT (_AT(pteval_t, 0) << 0)
59#define PTE_TYPE_LARGE (_AT(pteval_t, 1) << 0)
60#define PTE_TYPE_SMALL (_AT(pteval_t, 2) << 0)
61#define PTE_TYPE_EXT (_AT(pteval_t, 3) << 0) /* v5 */
62#define PTE_BUFFERABLE (_AT(pteval_t, 1) << 2)
63#define PTE_CACHEABLE (_AT(pteval_t, 1) << 3)
64
65/*
66 * - extended small page/tiny page
67 */
68#define PTE_EXT_XN (_AT(pteval_t, 1) << 0) /* v6 */
69#define PTE_EXT_AP_MASK (_AT(pteval_t, 3) << 4)
70#define PTE_EXT_AP0 (_AT(pteval_t, 1) << 4)
71#define PTE_EXT_AP1 (_AT(pteval_t, 2) << 4)
72#define PTE_EXT_AP_UNO_SRO (_AT(pteval_t, 0) << 4)
73#define PTE_EXT_AP_UNO_SRW (PTE_EXT_AP0)
74#define PTE_EXT_AP_URO_SRW (PTE_EXT_AP1)
75#define PTE_EXT_AP_URW_SRW (PTE_EXT_AP1|PTE_EXT_AP0)
76#define PTE_EXT_TEX(x) (_AT(pteval_t, (x)) << 6) /* v5 */
77#define PTE_EXT_APX (_AT(pteval_t, 1) << 9) /* v6 */
78#define PTE_EXT_COHERENT (_AT(pteval_t, 1) << 9) /* XScale3 */
79#define PTE_EXT_SHARED (_AT(pteval_t, 1) << 10) /* v6 */
80#define PTE_EXT_NG (_AT(pteval_t, 1) << 11) /* v6 */
81
82/*
83 * - small page
84 */
85#define PTE_SMALL_AP_MASK (_AT(pteval_t, 0xff) << 4)
86#define PTE_SMALL_AP_UNO_SRO (_AT(pteval_t, 0x00) << 4)
87#define PTE_SMALL_AP_UNO_SRW (_AT(pteval_t, 0x55) << 4)
88#define PTE_SMALL_AP_URO_SRW (_AT(pteval_t, 0xaa) << 4)
89#define PTE_SMALL_AP_URW_SRW (_AT(pteval_t, 0xff) << 4)
90
91#define PHYS_MASK (~0UL)
92
93#endif
diff --git a/arch/arm/include/asm/pgtable-2level-types.h b/arch/arm/include/asm/pgtable-2level-types.h
new file mode 100644
index 00000000000..66cb5b0e89c
--- /dev/null
+++ b/arch/arm/include/asm/pgtable-2level-types.h
@@ -0,0 +1,67 @@
1/*
2 * arch/arm/include/asm/pgtable-2level-types.h
3 *
4 * Copyright (C) 1995-2003 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 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#ifndef _ASM_PGTABLE_2LEVEL_TYPES_H
20#define _ASM_PGTABLE_2LEVEL_TYPES_H
21
22#include <asm/types.h>
23
24typedef u32 pteval_t;
25typedef u32 pmdval_t;
26
27#undef STRICT_MM_TYPECHECKS
28
29#ifdef STRICT_MM_TYPECHECKS
30/*
31 * These are used to make use of C type-checking..
32 */
33typedef struct { pteval_t pte; } pte_t;
34typedef struct { pmdval_t pmd; } pmd_t;
35typedef struct { pmdval_t pgd[2]; } pgd_t;
36typedef struct { pteval_t pgprot; } pgprot_t;
37
38#define pte_val(x) ((x).pte)
39#define pmd_val(x) ((x).pmd)
40#define pgd_val(x) ((x).pgd[0])
41#define pgprot_val(x) ((x).pgprot)
42
43#define __pte(x) ((pte_t) { (x) } )
44#define __pmd(x) ((pmd_t) { (x) } )
45#define __pgprot(x) ((pgprot_t) { (x) } )
46
47#else
48/*
49 * .. while these make it easier on the compiler
50 */
51typedef pteval_t pte_t;
52typedef pmdval_t pmd_t;
53typedef pmdval_t pgd_t[2];
54typedef pteval_t pgprot_t;
55
56#define pte_val(x) (x)
57#define pmd_val(x) (x)
58#define pgd_val(x) ((x)[0])
59#define pgprot_val(x) (x)
60
61#define __pte(x) (x)
62#define __pmd(x) (x)
63#define __pgprot(x) (x)
64
65#endif /* STRICT_MM_TYPECHECKS */
66
67#endif /* _ASM_PGTABLE_2LEVEL_TYPES_H */
diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h
new file mode 100644
index 00000000000..470457e1cfc
--- /dev/null
+++ b/arch/arm/include/asm/pgtable-2level.h
@@ -0,0 +1,143 @@
1/*
2 * arch/arm/include/asm/pgtable-2level.h
3 *
4 * Copyright (C) 1995-2002 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#ifndef _ASM_PGTABLE_2LEVEL_H
11#define _ASM_PGTABLE_2LEVEL_H
12
13/*
14 * Hardware-wise, we have a two level page table structure, where the first
15 * level has 4096 entries, and the second level has 256 entries. Each entry
16 * is one 32-bit word. Most of the bits in the second level entry are used
17 * by hardware, and there aren't any "accessed" and "dirty" bits.
18 *
19 * Linux on the other hand has a three level page table structure, which can
20 * be wrapped to fit a two level page table structure easily - using the PGD
21 * and PTE only. However, Linux also expects one "PTE" table per page, and
22 * at least a "dirty" bit.
23 *
24 * Therefore, we tweak the implementation slightly - we tell Linux that we
25 * have 2048 entries in the first level, each of which is 8 bytes (iow, two
26 * hardware pointers to the second level.) The second level contains two
27 * hardware PTE tables arranged contiguously, preceded by Linux versions
28 * which contain the state information Linux needs. We, therefore, end up
29 * with 512 entries in the "PTE" level.
30 *
31 * This leads to the page tables having the following layout:
32 *
33 * pgd pte
34 * | |
35 * +--------+
36 * | | +------------+ +0
37 * +- - - - + | Linux pt 0 |
38 * | | +------------+ +1024
39 * +--------+ +0 | Linux pt 1 |
40 * | |-----> +------------+ +2048
41 * +- - - - + +4 | h/w pt 0 |
42 * | |-----> +------------+ +3072
43 * +--------+ +8 | h/w pt 1 |
44 * | | +------------+ +4096
45 *
46 * See L_PTE_xxx below for definitions of bits in the "Linux pt", and
47 * PTE_xxx for definitions of bits appearing in the "h/w pt".
48 *
49 * PMD_xxx definitions refer to bits in the first level page table.
50 *
51 * The "dirty" bit is emulated by only granting hardware write permission
52 * iff the page is marked "writable" and "dirty" in the Linux PTE. This
53 * means that a write to a clean page will cause a permission fault, and
54 * the Linux MM layer will mark the page dirty via handle_pte_fault().
55 * For the hardware to notice the permission change, the TLB entry must
56 * be flushed, and ptep_set_access_flags() does that for us.
57 *
58 * The "accessed" or "young" bit is emulated by a similar method; we only
59 * allow accesses to the page if the "young" bit is set. Accesses to the
60 * page will cause a fault, and handle_pte_fault() will set the young bit
61 * for us as long as the page is marked present in the corresponding Linux
62 * PTE entry. Again, ptep_set_access_flags() will ensure that the TLB is
63 * up to date.
64 *
65 * However, when the "young" bit is cleared, we deny access to the page
66 * by clearing the hardware PTE. Currently Linux does not flush the TLB
67 * for us in this case, which means the TLB will retain the transation
68 * until either the TLB entry is evicted under pressure, or a context
69 * switch which changes the user space mapping occurs.
70 */
71#define PTRS_PER_PTE 512
72#define PTRS_PER_PMD 1
73#define PTRS_PER_PGD 2048
74
75#define PTE_HWTABLE_PTRS (PTRS_PER_PTE)
76#define PTE_HWTABLE_OFF (PTE_HWTABLE_PTRS * sizeof(pte_t))
77#define PTE_HWTABLE_SIZE (PTRS_PER_PTE * sizeof(u32))
78
79/*
80 * PMD_SHIFT determines the size of the area a second-level page table can map
81 * PGDIR_SHIFT determines what a third-level page table entry can map
82 */
83#define PMD_SHIFT 21
84#define PGDIR_SHIFT 21
85
86#define PMD_SIZE (1UL << PMD_SHIFT)
87#define PMD_MASK (~(PMD_SIZE-1))
88#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
89#define PGDIR_MASK (~(PGDIR_SIZE-1))
90
91/*
92 * section address mask and size definitions.
93 */
94#define SECTION_SHIFT 20
95#define SECTION_SIZE (1UL << SECTION_SHIFT)
96#define SECTION_MASK (~(SECTION_SIZE-1))
97
98/*
99 * ARMv6 supersection address mask and size definitions.
100 */
101#define SUPERSECTION_SHIFT 24
102#define SUPERSECTION_SIZE (1UL << SUPERSECTION_SHIFT)
103#define SUPERSECTION_MASK (~(SUPERSECTION_SIZE-1))
104
105#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
106
107/*
108 * "Linux" PTE definitions.
109 *
110 * We keep two sets of PTEs - the hardware and the linux version.
111 * This allows greater flexibility in the way we map the Linux bits
112 * onto the hardware tables, and allows us to have YOUNG and DIRTY
113 * bits.
114 *
115 * The PTE table pointer refers to the hardware entries; the "Linux"
116 * entries are stored 1024 bytes below.
117 */
118#define L_PTE_PRESENT (_AT(pteval_t, 1) << 0)
119#define L_PTE_YOUNG (_AT(pteval_t, 1) << 1)
120#define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */
121#define L_PTE_DIRTY (_AT(pteval_t, 1) << 6)
122#define L_PTE_RDONLY (_AT(pteval_t, 1) << 7)
123#define L_PTE_USER (_AT(pteval_t, 1) << 8)
124#define L_PTE_XN (_AT(pteval_t, 1) << 9)
125#define L_PTE_SHARED (_AT(pteval_t, 1) << 10) /* shared(v6), coherent(xsc3) */
126
127/*
128 * These are the memory types, defined to be compatible with
129 * pre-ARMv6 CPUs cacheable and bufferable bits: XXCB
130 */
131#define L_PTE_MT_UNCACHED (_AT(pteval_t, 0x00) << 2) /* 0000 */
132#define L_PTE_MT_BUFFERABLE (_AT(pteval_t, 0x01) << 2) /* 0001 */
133#define L_PTE_MT_WRITETHROUGH (_AT(pteval_t, 0x02) << 2) /* 0010 */
134#define L_PTE_MT_WRITEBACK (_AT(pteval_t, 0x03) << 2) /* 0011 */
135#define L_PTE_MT_MINICACHE (_AT(pteval_t, 0x06) << 2) /* 0110 (sa1100, xscale) */
136#define L_PTE_MT_WRITEALLOC (_AT(pteval_t, 0x07) << 2) /* 0111 */
137#define L_PTE_MT_DEV_SHARED (_AT(pteval_t, 0x04) << 2) /* 0100 */
138#define L_PTE_MT_DEV_NONSHARED (_AT(pteval_t, 0x0c) << 2) /* 1100 */
139#define L_PTE_MT_DEV_WC (_AT(pteval_t, 0x09) << 2) /* 1001 */
140#define L_PTE_MT_DEV_CACHED (_AT(pteval_t, 0x0b) << 2) /* 1011 */
141#define L_PTE_MT_MASK (_AT(pteval_t, 0x0f) << 2)
142
143#endif /* _ASM_PGTABLE_2LEVEL_H */
diff --git a/arch/arm/include/asm/pgtable-hwdef.h b/arch/arm/include/asm/pgtable-hwdef.h
index fd1521d5cb9..183111164ce 100644
--- a/arch/arm/include/asm/pgtable-hwdef.h
+++ b/arch/arm/include/asm/pgtable-hwdef.h
@@ -10,81 +10,6 @@
10#ifndef _ASMARM_PGTABLE_HWDEF_H 10#ifndef _ASMARM_PGTABLE_HWDEF_H
11#define _ASMARM_PGTABLE_HWDEF_H 11#define _ASMARM_PGTABLE_HWDEF_H
12 12
13/* 13#include <asm/pgtable-2level-hwdef.h>
14 * Hardware page table definitions.
15 *
16 * + Level 1 descriptor (PMD)
17 * - common
18 */
19#define PMD_TYPE_MASK (3 << 0)
20#define PMD_TYPE_FAULT (0 << 0)
21#define PMD_TYPE_TABLE (1 << 0)
22#define PMD_TYPE_SECT (2 << 0)
23#define PMD_BIT4 (1 << 4)
24#define PMD_DOMAIN(x) ((x) << 5)
25#define PMD_PROTECTION (1 << 9) /* v5 */
26/*
27 * - section
28 */
29#define PMD_SECT_BUFFERABLE (1 << 2)
30#define PMD_SECT_CACHEABLE (1 << 3)
31#define PMD_SECT_XN (1 << 4) /* v6 */
32#define PMD_SECT_AP_WRITE (1 << 10)
33#define PMD_SECT_AP_READ (1 << 11)
34#define PMD_SECT_TEX(x) ((x) << 12) /* v5 */
35#define PMD_SECT_APX (1 << 15) /* v6 */
36#define PMD_SECT_S (1 << 16) /* v6 */
37#define PMD_SECT_nG (1 << 17) /* v6 */
38#define PMD_SECT_SUPER (1 << 18) /* v6 */
39
40#define PMD_SECT_UNCACHED (0)
41#define PMD_SECT_BUFFERED (PMD_SECT_BUFFERABLE)
42#define PMD_SECT_WT (PMD_SECT_CACHEABLE)
43#define PMD_SECT_WB (PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
44#define PMD_SECT_MINICACHE (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE)
45#define PMD_SECT_WBWA (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
46#define PMD_SECT_NONSHARED_DEV (PMD_SECT_TEX(2))
47
48/*
49 * - coarse table (not used)
50 */
51
52/*
53 * + Level 2 descriptor (PTE)
54 * - common
55 */
56#define PTE_TYPE_MASK (3 << 0)
57#define PTE_TYPE_FAULT (0 << 0)
58#define PTE_TYPE_LARGE (1 << 0)
59#define PTE_TYPE_SMALL (2 << 0)
60#define PTE_TYPE_EXT (3 << 0) /* v5 */
61#define PTE_BUFFERABLE (1 << 2)
62#define PTE_CACHEABLE (1 << 3)
63
64/*
65 * - extended small page/tiny page
66 */
67#define PTE_EXT_XN (1 << 0) /* v6 */
68#define PTE_EXT_AP_MASK (3 << 4)
69#define PTE_EXT_AP0 (1 << 4)
70#define PTE_EXT_AP1 (2 << 4)
71#define PTE_EXT_AP_UNO_SRO (0 << 4)
72#define PTE_EXT_AP_UNO_SRW (PTE_EXT_AP0)
73#define PTE_EXT_AP_URO_SRW (PTE_EXT_AP1)
74#define PTE_EXT_AP_URW_SRW (PTE_EXT_AP1|PTE_EXT_AP0)
75#define PTE_EXT_TEX(x) ((x) << 6) /* v5 */
76#define PTE_EXT_APX (1 << 9) /* v6 */
77#define PTE_EXT_COHERENT (1 << 9) /* XScale3 */
78#define PTE_EXT_SHARED (1 << 10) /* v6 */
79#define PTE_EXT_NG (1 << 11) /* v6 */
80
81/*
82 * - small page
83 */
84#define PTE_SMALL_AP_MASK (0xff << 4)
85#define PTE_SMALL_AP_UNO_SRO (0x00 << 4)
86#define PTE_SMALL_AP_UNO_SRW (0x55 << 4)
87#define PTE_SMALL_AP_URO_SRW (0xaa << 4)
88#define PTE_SMALL_AP_URW_SRW (0xff << 4)
89 14
90#endif 15#endif
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index 5750704e027..8ade1840c6f 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -24,6 +24,8 @@
24#include <mach/vmalloc.h> 24#include <mach/vmalloc.h>
25#include <asm/pgtable-hwdef.h> 25#include <asm/pgtable-hwdef.h>
26 26
27#include <asm/pgtable-2level.h>
28
27/* 29/*
28 * Just any arbitrary offset to the start of the vmalloc VM area: the 30 * Just any arbitrary offset to the start of the vmalloc VM area: the
29 * current 8MB value just means that there will be a 8MB "hole" after the 31 * current 8MB value just means that there will be a 8MB "hole" after the
@@ -41,79 +43,6 @@
41#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) 43#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
42#endif 44#endif
43 45
44/*
45 * Hardware-wise, we have a two level page table structure, where the first
46 * level has 4096 entries, and the second level has 256 entries. Each entry
47 * is one 32-bit word. Most of the bits in the second level entry are used
48 * by hardware, and there aren't any "accessed" and "dirty" bits.
49 *
50 * Linux on the other hand has a three level page table structure, which can
51 * be wrapped to fit a two level page table structure easily - using the PGD
52 * and PTE only. However, Linux also expects one "PTE" table per page, and
53 * at least a "dirty" bit.
54 *
55 * Therefore, we tweak the implementation slightly - we tell Linux that we
56 * have 2048 entries in the first level, each of which is 8 bytes (iow, two
57 * hardware pointers to the second level.) The second level contains two
58 * hardware PTE tables arranged contiguously, preceded by Linux versions
59 * which contain the state information Linux needs. We, therefore, end up
60 * with 512 entries in the "PTE" level.
61 *
62 * This leads to the page tables having the following layout:
63 *
64 * pgd pte
65 * | |
66 * +--------+
67 * | | +------------+ +0
68 * +- - - - + | Linux pt 0 |
69 * | | +------------+ +1024
70 * +--------+ +0 | Linux pt 1 |
71 * | |-----> +------------+ +2048
72 * +- - - - + +4 | h/w pt 0 |
73 * | |-----> +------------+ +3072
74 * +--------+ +8 | h/w pt 1 |
75 * | | +------------+ +4096
76 *
77 * See L_PTE_xxx below for definitions of bits in the "Linux pt", and
78 * PTE_xxx for definitions of bits appearing in the "h/w pt".
79 *
80 * PMD_xxx definitions refer to bits in the first level page table.
81 *
82 * The "dirty" bit is emulated by only granting hardware write permission
83 * iff the page is marked "writable" and "dirty" in the Linux PTE. This
84 * means that a write to a clean page will cause a permission fault, and
85 * the Linux MM layer will mark the page dirty via handle_pte_fault().
86 * For the hardware to notice the permission change, the TLB entry must
87 * be flushed, and ptep_set_access_flags() does that for us.
88 *
89 * The "accessed" or "young" bit is emulated by a similar method; we only
90 * allow accesses to the page if the "young" bit is set. Accesses to the
91 * page will cause a fault, and handle_pte_fault() will set the young bit
92 * for us as long as the page is marked present in the corresponding Linux
93 * PTE entry. Again, ptep_set_access_flags() will ensure that the TLB is
94 * up to date.
95 *
96 * However, when the "young" bit is cleared, we deny access to the page
97 * by clearing the hardware PTE. Currently Linux does not flush the TLB
98 * for us in this case, which means the TLB will retain the transation
99 * until either the TLB entry is evicted under pressure, or a context
100 * switch which changes the user space mapping occurs.
101 */
102#define PTRS_PER_PTE 512
103#define PTRS_PER_PMD 1
104#define PTRS_PER_PGD 2048
105
106#define PTE_HWTABLE_PTRS (PTRS_PER_PTE)
107#define PTE_HWTABLE_OFF (PTE_HWTABLE_PTRS * sizeof(pte_t))
108#define PTE_HWTABLE_SIZE (PTRS_PER_PTE * sizeof(u32))
109
110/*
111 * PMD_SHIFT determines the size of the area a second-level page table can map
112 * PGDIR_SHIFT determines what a third-level page table entry can map
113 */
114#define PMD_SHIFT 21
115#define PGDIR_SHIFT 21
116
117#define LIBRARY_TEXT_START 0x0c000000 46#define LIBRARY_TEXT_START 0x0c000000
118 47
119#ifndef __ASSEMBLY__ 48#ifndef __ASSEMBLY__
@@ -124,12 +53,6 @@ extern void __pgd_error(const char *file, int line, pgd_t);
124#define pte_ERROR(pte) __pte_error(__FILE__, __LINE__, pte) 53#define pte_ERROR(pte) __pte_error(__FILE__, __LINE__, pte)
125#define pmd_ERROR(pmd) __pmd_error(__FILE__, __LINE__, pmd) 54#define pmd_ERROR(pmd) __pmd_error(__FILE__, __LINE__, pmd)
126#define pgd_ERROR(pgd) __pgd_error(__FILE__, __LINE__, pgd) 55#define pgd_ERROR(pgd) __pgd_error(__FILE__, __LINE__, pgd)
127#endif /* !__ASSEMBLY__ */
128
129#define PMD_SIZE (1UL << PMD_SHIFT)
130#define PMD_MASK (~(PMD_SIZE-1))
131#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
132#define PGDIR_MASK (~(PGDIR_SIZE-1))
133 56
134/* 57/*
135 * This is the lowest virtual address we can permit any user space 58 * This is the lowest virtual address we can permit any user space
@@ -138,60 +61,6 @@ extern void __pgd_error(const char *file, int line, pgd_t);
138 */ 61 */
139#define FIRST_USER_ADDRESS PAGE_SIZE 62#define FIRST_USER_ADDRESS PAGE_SIZE
140 63
141#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
142
143/*
144 * section address mask and size definitions.
145 */
146#define SECTION_SHIFT 20
147#define SECTION_SIZE (1UL << SECTION_SHIFT)
148#define SECTION_MASK (~(SECTION_SIZE-1))
149
150/*
151 * ARMv6 supersection address mask and size definitions.
152 */
153#define SUPERSECTION_SHIFT 24
154#define SUPERSECTION_SIZE (1UL << SUPERSECTION_SHIFT)
155#define SUPERSECTION_MASK (~(SUPERSECTION_SIZE-1))
156
157/*
158 * "Linux" PTE definitions.
159 *
160 * We keep two sets of PTEs - the hardware and the linux version.
161 * This allows greater flexibility in the way we map the Linux bits
162 * onto the hardware tables, and allows us to have YOUNG and DIRTY
163 * bits.
164 *
165 * The PTE table pointer refers to the hardware entries; the "Linux"
166 * entries are stored 1024 bytes below.
167 */
168#define L_PTE_PRESENT (_AT(pteval_t, 1) << 0)
169#define L_PTE_YOUNG (_AT(pteval_t, 1) << 1)
170#define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */
171#define L_PTE_DIRTY (_AT(pteval_t, 1) << 6)
172#define L_PTE_RDONLY (_AT(pteval_t, 1) << 7)
173#define L_PTE_USER (_AT(pteval_t, 1) << 8)
174#define L_PTE_XN (_AT(pteval_t, 1) << 9)
175#define L_PTE_SHARED (_AT(pteval_t, 1) << 10) /* shared(v6), coherent(xsc3) */
176
177/*
178 * These are the memory types, defined to be compatible with
179 * pre-ARMv6 CPUs cacheable and bufferable bits: XXCB
180 */
181#define L_PTE_MT_UNCACHED (_AT(pteval_t, 0x00) << 2) /* 0000 */
182#define L_PTE_MT_BUFFERABLE (_AT(pteval_t, 0x01) << 2) /* 0001 */
183#define L_PTE_MT_WRITETHROUGH (_AT(pteval_t, 0x02) << 2) /* 0010 */
184#define L_PTE_MT_WRITEBACK (_AT(pteval_t, 0x03) << 2) /* 0011 */
185#define L_PTE_MT_MINICACHE (_AT(pteval_t, 0x06) << 2) /* 0110 (sa1100, xscale) */
186#define L_PTE_MT_WRITEALLOC (_AT(pteval_t, 0x07) << 2) /* 0111 */
187#define L_PTE_MT_DEV_SHARED (_AT(pteval_t, 0x04) << 2) /* 0100 */
188#define L_PTE_MT_DEV_NONSHARED (_AT(pteval_t, 0x0c) << 2) /* 1100 */
189#define L_PTE_MT_DEV_WC (_AT(pteval_t, 0x09) << 2) /* 1001 */
190#define L_PTE_MT_DEV_CACHED (_AT(pteval_t, 0x0b) << 2) /* 1011 */
191#define L_PTE_MT_MASK (_AT(pteval_t, 0x0f) << 2)
192
193#ifndef __ASSEMBLY__
194
195/* 64/*
196 * The pgprot_* and protection_map entries will be fixed up in runtime 65 * The pgprot_* and protection_map entries will be fixed up in runtime
197 * to include the cachable and bufferable bits based on memory policy, 66 * to include the cachable and bufferable bits based on memory policy,
@@ -327,10 +196,10 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
327 196
328static inline pte_t *pmd_page_vaddr(pmd_t pmd) 197static inline pte_t *pmd_page_vaddr(pmd_t pmd)
329{ 198{
330 return __va(pmd_val(pmd) & PAGE_MASK); 199 return __va(pmd_val(pmd) & PHYS_MASK & (s32)PAGE_MASK);
331} 200}
332 201
333#define pmd_page(pmd) pfn_to_page(__phys_to_pfn(pmd_val(pmd))) 202#define pmd_page(pmd) pfn_to_page(__phys_to_pfn(pmd_val(pmd) & PHYS_MASK))
334 203
335/* we don't need complex calculations here as the pmd is folded into the pgd */ 204/* we don't need complex calculations here as the pmd is folded into the pgd */
336#define pmd_addr_end(addr,end) (end) 205#define pmd_addr_end(addr,end) (end)
@@ -351,7 +220,7 @@ static inline pte_t *pmd_page_vaddr(pmd_t pmd)
351#define pte_offset_map(pmd,addr) (__pte_map(pmd) + pte_index(addr)) 220#define pte_offset_map(pmd,addr) (__pte_map(pmd) + pte_index(addr))
352#define pte_unmap(pte) __pte_unmap(pte) 221#define pte_unmap(pte) __pte_unmap(pte)
353 222
354#define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT) 223#define pte_pfn(pte) ((pte_val(pte) & PHYS_MASK) >> PAGE_SHIFT)
355#define pfn_pte(pfn,prot) __pte(__pfn_to_phys(pfn) | pgprot_val(prot)) 224#define pfn_pte(pfn,prot) __pte(__pfn_to_phys(pfn) | pgprot_val(prot))
356 225
357#define pte_page(pte) pfn_to_page(pte_pfn(pte)) 226#define pte_page(pte) pfn_to_page(pte_pfn(pte))
diff --git a/arch/arm/include/asm/poll.h b/arch/arm/include/asm/poll.h
deleted file mode 100644
index c98509d3149..00000000000
--- a/arch/arm/include/asm/poll.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/poll.h>
diff --git a/arch/arm/include/asm/resource.h b/arch/arm/include/asm/resource.h
deleted file mode 100644
index 734b581b5b6..00000000000
--- a/arch/arm/include/asm/resource.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ARM_RESOURCE_H
2#define _ARM_RESOURCE_H
3
4#include <asm-generic/resource.h>
5
6#endif
diff --git a/arch/arm/include/asm/sections.h b/arch/arm/include/asm/sections.h
deleted file mode 100644
index 2b8c5160388..00000000000
--- a/arch/arm/include/asm/sections.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/sections.h>
diff --git a/arch/arm/include/asm/siginfo.h b/arch/arm/include/asm/siginfo.h
deleted file mode 100644
index 5e21852e603..00000000000
--- a/arch/arm/include/asm/siginfo.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASMARM_SIGINFO_H
2#define _ASMARM_SIGINFO_H
3
4#include <asm-generic/siginfo.h>
5
6#endif
diff --git a/arch/arm/include/asm/sizes.h b/arch/arm/include/asm/sizes.h
deleted file mode 100644
index 154b89b81d3..00000000000
--- a/arch/arm/include/asm/sizes.h
+++ /dev/null
@@ -1,21 +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 as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 */
16/* Size definitions
17 * Copyright (C) ARM Limited 1998. All rights reserved.
18 */
19#include <asm-generic/sizes.h>
20
21#define SZ_48M (SZ_32M + SZ_16M)
diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h
index e42d96a45d3..0a17b62538c 100644
--- a/arch/arm/include/asm/smp.h
+++ b/arch/arm/include/asm/smp.h
@@ -33,6 +33,11 @@ extern void show_ipi_list(struct seq_file *, int);
33asmlinkage void do_IPI(int ipinr, struct pt_regs *regs); 33asmlinkage void do_IPI(int ipinr, struct pt_regs *regs);
34 34
35/* 35/*
36 * Called from C code, this handles an IPI.
37 */
38void handle_IPI(int ipinr, struct pt_regs *regs);
39
40/*
36 * Setup the set of possible CPUs (via set_cpu_possible) 41 * Setup the set of possible CPUs (via set_cpu_possible)
37 */ 42 */
38extern void smp_init_cpus(void); 43extern void smp_init_cpus(void);
@@ -66,6 +71,12 @@ extern void platform_secondary_init(unsigned int cpu);
66extern void platform_smp_prepare_cpus(unsigned int); 71extern void platform_smp_prepare_cpus(unsigned int);
67 72
68/* 73/*
74 * Logical CPU mapping.
75 */
76extern int __cpu_logical_map[NR_CPUS];
77#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
78
79/*
69 * Initial data for bringing up a secondary CPU. 80 * Initial data for bringing up a secondary CPU.
70 */ 81 */
71struct secondary_data { 82struct secondary_data {
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 832888d0c20..984014b9264 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -57,18 +57,12 @@
57 57
58#ifndef __ASSEMBLY__ 58#ifndef __ASSEMBLY__
59 59
60#include <linux/compiler.h>
60#include <linux/linkage.h> 61#include <linux/linkage.h>
61#include <linux/irqflags.h> 62#include <linux/irqflags.h>
62 63
63#include <asm/outercache.h> 64#include <asm/outercache.h>
64 65
65#define __exception __attribute__((section(".exception.text")))
66#ifdef CONFIG_FUNCTION_GRAPH_TRACER
67#define __exception_irq_entry __irq_entry
68#else
69#define __exception_irq_entry __exception
70#endif
71
72struct thread_info; 66struct thread_info;
73struct task_struct; 67struct task_struct;
74 68
@@ -97,14 +91,13 @@ void hook_ifault_code(int nr, int (*fn)(unsigned long, unsigned int,
97#define xchg(ptr,x) \ 91#define xchg(ptr,x) \
98 ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) 92 ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
99 93
100extern asmlinkage void __backtrace(void);
101extern asmlinkage void c_backtrace(unsigned long fp, int pmode); 94extern asmlinkage void c_backtrace(unsigned long fp, int pmode);
102 95
103struct mm_struct; 96struct mm_struct;
104extern void show_pte(struct mm_struct *mm, unsigned long addr); 97extern void show_pte(struct mm_struct *mm, unsigned long addr);
105extern void __show_regs(struct pt_regs *); 98extern void __show_regs(struct pt_regs *);
106 99
107extern int cpu_architecture(void); 100extern int __pure cpu_architecture(void);
108extern void cpu_init(void); 101extern void cpu_init(void);
109 102
110void arm_machine_restart(char mode, const char *cmd); 103void arm_machine_restart(char mode, const char *cmd);
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h
index 8077145698f..02b2f820398 100644
--- a/arch/arm/include/asm/tlbflush.h
+++ b/arch/arm/include/asm/tlbflush.h
@@ -471,7 +471,7 @@ static inline void local_flush_tlb_kernel_page(unsigned long kaddr)
471 * these operations. This is typically used when we are removing 471 * these operations. This is typically used when we are removing
472 * PMD entries. 472 * PMD entries.
473 */ 473 */
474static inline void flush_pmd_entry(pmd_t *pmd) 474static inline void flush_pmd_entry(void *pmd)
475{ 475{
476 const unsigned int __tlb_flag = __cpu_tlb_flags; 476 const unsigned int __tlb_flag = __cpu_tlb_flags;
477 477
@@ -487,7 +487,7 @@ static inline void flush_pmd_entry(pmd_t *pmd)
487 dsb(); 487 dsb();
488} 488}
489 489
490static inline void clean_pmd_entry(pmd_t *pmd) 490static inline void clean_pmd_entry(void *pmd)
491{ 491{
492 const unsigned int __tlb_flag = __cpu_tlb_flags; 492 const unsigned int __tlb_flag = __cpu_tlb_flags;
493 493
diff --git a/arch/arm/include/asm/topology.h b/arch/arm/include/asm/topology.h
index accbd7cad9b..a7e457ed27c 100644
--- a/arch/arm/include/asm/topology.h
+++ b/arch/arm/include/asm/topology.h
@@ -1,6 +1,39 @@
1#ifndef _ASM_ARM_TOPOLOGY_H 1#ifndef _ASM_ARM_TOPOLOGY_H
2#define _ASM_ARM_TOPOLOGY_H 2#define _ASM_ARM_TOPOLOGY_H
3 3
4#ifdef CONFIG_ARM_CPU_TOPOLOGY
5
6#include <linux/cpumask.h>
7
8struct cputopo_arm {
9 int thread_id;
10 int core_id;
11 int socket_id;
12 cpumask_t thread_sibling;
13 cpumask_t core_sibling;
14};
15
16extern struct cputopo_arm cpu_topology[NR_CPUS];
17
18#define topology_physical_package_id(cpu) (cpu_topology[cpu].socket_id)
19#define topology_core_id(cpu) (cpu_topology[cpu].core_id)
20#define topology_core_cpumask(cpu) (&cpu_topology[cpu].core_sibling)
21#define topology_thread_cpumask(cpu) (&cpu_topology[cpu].thread_sibling)
22
23#define mc_capable() (cpu_topology[0].socket_id != -1)
24#define smt_capable() (cpu_topology[0].thread_id != -1)
25
26void init_cpu_topology(void);
27void store_cpu_topology(unsigned int cpuid);
28const struct cpumask *cpu_coregroup_mask(unsigned int cpu);
29
30#else
31
32static inline void init_cpu_topology(void) { }
33static inline void store_cpu_topology(unsigned int cpuid) { }
34
35#endif
36
4#include <asm-generic/topology.h> 37#include <asm-generic/topology.h>
5 38
6#endif /* _ASM_ARM_TOPOLOGY_H */ 39#endif /* _ASM_ARM_TOPOLOGY_H */
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index f7887dc53c1..68036eece34 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -29,7 +29,7 @@ obj-$(CONFIG_MODULES) += armksyms.o module.o
29obj-$(CONFIG_ARTHUR) += arthur.o 29obj-$(CONFIG_ARTHUR) += arthur.o
30obj-$(CONFIG_ISA_DMA) += dma-isa.o 30obj-$(CONFIG_ISA_DMA) += dma-isa.o
31obj-$(CONFIG_PCI) += bios32.o isa.o 31obj-$(CONFIG_PCI) += bios32.o isa.o
32obj-$(CONFIG_PM_SLEEP) += sleep.o 32obj-$(CONFIG_ARM_CPU_SUSPEND) += sleep.o
33obj-$(CONFIG_HAVE_SCHED_CLOCK) += sched_clock.o 33obj-$(CONFIG_HAVE_SCHED_CLOCK) += sched_clock.o
34obj-$(CONFIG_SMP) += smp.o smp_tlb.o 34obj-$(CONFIG_SMP) += smp.o smp_tlb.o
35obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o 35obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o
@@ -66,6 +66,7 @@ obj-$(CONFIG_IWMMXT) += iwmmxt.o
66obj-$(CONFIG_CPU_HAS_PMU) += pmu.o 66obj-$(CONFIG_CPU_HAS_PMU) += pmu.o
67obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o 67obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o
68AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt 68AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt
69obj-$(CONFIG_ARM_CPU_TOPOLOGY) += topology.o
69 70
70ifneq ($(CONFIG_ARCH_EBSA110),y) 71ifneq ($(CONFIG_ARCH_EBSA110),y)
71 obj-y += io.o 72 obj-y += io.o
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
index aeef960ff79..8e3c6f11b0a 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
@@ -49,9 +49,6 @@ extern void __aeabi_ulcmp(void);
49 49
50extern void fpundefinstr(void); 50extern void fpundefinstr(void);
51 51
52
53EXPORT_SYMBOL(__backtrace);
54
55 /* platform dependent support */ 52 /* platform dependent support */
56EXPORT_SYMBOL(__udelay); 53EXPORT_SYMBOL(__udelay);
57EXPORT_SYMBOL(__const_udelay); 54EXPORT_SYMBOL(__const_udelay);
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
index 16baba2e436..1429d8989fb 100644
--- a/arch/arm/kernel/asm-offsets.c
+++ b/arch/arm/kernel/asm-offsets.c
@@ -20,6 +20,7 @@
20#include <asm/thread_info.h> 20#include <asm/thread_info.h>
21#include <asm/memory.h> 21#include <asm/memory.h>
22#include <asm/procinfo.h> 22#include <asm/procinfo.h>
23#include <asm/hardware/cache-l2x0.h>
23#include <linux/kbuild.h> 24#include <linux/kbuild.h>
24 25
25/* 26/*
@@ -92,6 +93,17 @@ int main(void)
92 DEFINE(S_OLD_R0, offsetof(struct pt_regs, ARM_ORIG_r0)); 93 DEFINE(S_OLD_R0, offsetof(struct pt_regs, ARM_ORIG_r0));
93 DEFINE(S_FRAME_SIZE, sizeof(struct pt_regs)); 94 DEFINE(S_FRAME_SIZE, sizeof(struct pt_regs));
94 BLANK(); 95 BLANK();
96#ifdef CONFIG_CACHE_L2X0
97 DEFINE(L2X0_R_PHY_BASE, offsetof(struct l2x0_regs, phy_base));
98 DEFINE(L2X0_R_AUX_CTRL, offsetof(struct l2x0_regs, aux_ctrl));
99 DEFINE(L2X0_R_TAG_LATENCY, offsetof(struct l2x0_regs, tag_latency));
100 DEFINE(L2X0_R_DATA_LATENCY, offsetof(struct l2x0_regs, data_latency));
101 DEFINE(L2X0_R_FILTER_START, offsetof(struct l2x0_regs, filter_start));
102 DEFINE(L2X0_R_FILTER_END, offsetof(struct l2x0_regs, filter_end));
103 DEFINE(L2X0_R_PREFETCH_CTRL, offsetof(struct l2x0_regs, prefetch_ctrl));
104 DEFINE(L2X0_R_PWR_CTRL, offsetof(struct l2x0_regs, pwr_ctrl));
105 BLANK();
106#endif
95#ifdef CONFIG_CPU_HAS_ASID 107#ifdef CONFIG_CPU_HAS_ASID
96 DEFINE(MM_CONTEXT_ID, offsetof(struct mm_struct, context.id)); 108 DEFINE(MM_CONTEXT_ID, offsetof(struct mm_struct, context.id));
97 BLANK(); 109 BLANK();
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index d6df359408f..c0d9203fc75 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -412,6 +412,9 @@ void pcibios_fixup_bus(struct pci_bus *bus)
412 printk(KERN_INFO "PCI: bus%d: Fast back to back transfers %sabled\n", 412 printk(KERN_INFO "PCI: bus%d: Fast back to back transfers %sabled\n",
413 bus->number, (features & PCI_COMMAND_FAST_BACK) ? "en" : "dis"); 413 bus->number, (features & PCI_COMMAND_FAST_BACK) ? "en" : "dis");
414} 414}
415#ifdef CONFIG_HOTPLUG
416EXPORT_SYMBOL(pcibios_fixup_bus);
417#endif
415 418
416/* 419/*
417 * Convert from Linux-centric to bus-centric addresses for bridge devices. 420 * Convert from Linux-centric to bus-centric addresses for bridge devices.
@@ -431,6 +434,7 @@ pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
431 region->start = res->start - offset; 434 region->start = res->start - offset;
432 region->end = res->end - offset; 435 region->end = res->end - offset;
433} 436}
437EXPORT_SYMBOL(pcibios_resource_to_bus);
434 438
435void __devinit 439void __devinit
436pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, 440pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
@@ -447,12 +451,7 @@ pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
447 res->start = region->start + offset; 451 res->start = region->start + offset;
448 res->end = region->end + offset; 452 res->end = region->end + offset;
449} 453}
450
451#ifdef CONFIG_HOTPLUG
452EXPORT_SYMBOL(pcibios_fixup_bus);
453EXPORT_SYMBOL(pcibios_resource_to_bus);
454EXPORT_SYMBOL(pcibios_bus_to_resource); 454EXPORT_SYMBOL(pcibios_bus_to_resource);
455#endif
456 455
457/* 456/*
458 * Swizzle the device pin each time we cross a bridge. 457 * Swizzle the device pin each time we cross a bridge.
diff --git a/arch/arm/kernel/debug.S b/arch/arm/kernel/debug.S
index bcd66e00bdb..0f852d082fc 100644
--- a/arch/arm/kernel/debug.S
+++ b/arch/arm/kernel/debug.S
@@ -151,6 +151,8 @@ printhex: adr r2, hexbuf
151 b printascii 151 b printascii
152ENDPROC(printhex2) 152ENDPROC(printhex2)
153 153
154hexbuf: .space 16
155
154 .ltorg 156 .ltorg
155 157
156ENTRY(printascii) 158ENTRY(printascii)
@@ -175,5 +177,3 @@ ENTRY(printch)
175 mov r0, #0 177 mov r0, #0
176 b 1b 178 b 1b
177ENDPROC(printch) 179ENDPROC(printch)
178
179hexbuf: .space 16
diff --git a/arch/arm/kernel/dma.c b/arch/arm/kernel/dma.c
index 2c4a185f92c..7b829d9663b 100644
--- a/arch/arm/kernel/dma.c
+++ b/arch/arm/kernel/dma.c
@@ -23,7 +23,7 @@
23 23
24#include <asm/mach/dma.h> 24#include <asm/mach/dma.h>
25 25
26DEFINE_SPINLOCK(dma_spin_lock); 26DEFINE_RAW_SPINLOCK(dma_spin_lock);
27EXPORT_SYMBOL(dma_spin_lock); 27EXPORT_SYMBOL(dma_spin_lock);
28 28
29static dma_t *dma_chan[MAX_DMA_CHANNELS]; 29static dma_t *dma_chan[MAX_DMA_CHANNELS];
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c
index d16500110ee..4dd0edab6a6 100644
--- a/arch/arm/kernel/ecard.c
+++ b/arch/arm/kernel/ecard.c
@@ -237,7 +237,7 @@ static void ecard_init_pgtables(struct mm_struct *mm)
237 237
238 memcpy(dst_pgd, src_pgd, sizeof(pgd_t) * (IO_SIZE / PGDIR_SIZE)); 238 memcpy(dst_pgd, src_pgd, sizeof(pgd_t) * (IO_SIZE / PGDIR_SIZE));
239 239
240 src_pgd = pgd_offset(mm, EASI_BASE); 240 src_pgd = pgd_offset(mm, (unsigned long)EASI_BASE);
241 dst_pgd = pgd_offset(mm, EASI_START); 241 dst_pgd = pgd_offset(mm, EASI_START);
242 242
243 memcpy(dst_pgd, src_pgd, sizeof(pgd_t) * (EASI_SIZE / PGDIR_SIZE)); 243 memcpy(dst_pgd, src_pgd, sizeof(pgd_t) * (EASI_SIZE / PGDIR_SIZE));
@@ -674,44 +674,37 @@ static int __init ecard_probeirqhw(void)
674#define ecard_probeirqhw() (0) 674#define ecard_probeirqhw() (0)
675#endif 675#endif
676 676
677#ifndef IO_EC_MEMC8_BASE 677static void __iomem *__ecard_address(ecard_t *ec, card_type_t type, card_speed_t speed)
678#define IO_EC_MEMC8_BASE 0
679#endif
680
681static unsigned int __ecard_address(ecard_t *ec, card_type_t type, card_speed_t speed)
682{ 678{
683 unsigned long address = 0; 679 void __iomem *address = NULL;
684 int slot = ec->slot_no; 680 int slot = ec->slot_no;
685 681
686 if (ec->slot_no == 8) 682 if (ec->slot_no == 8)
687 return IO_EC_MEMC8_BASE; 683 return ECARD_MEMC8_BASE;
688 684
689 ectcr &= ~(1 << slot); 685 ectcr &= ~(1 << slot);
690 686
691 switch (type) { 687 switch (type) {
692 case ECARD_MEMC: 688 case ECARD_MEMC:
693 if (slot < 4) 689 if (slot < 4)
694 address = IO_EC_MEMC_BASE + (slot << 12); 690 address = ECARD_MEMC_BASE + (slot << 14);
695 break; 691 break;
696 692
697 case ECARD_IOC: 693 case ECARD_IOC:
698 if (slot < 4) 694 if (slot < 4)
699 address = IO_EC_IOC_BASE + (slot << 12); 695 address = ECARD_IOC_BASE + (slot << 14);
700#ifdef IO_EC_IOC4_BASE
701 else 696 else
702 address = IO_EC_IOC4_BASE + ((slot - 4) << 12); 697 address = ECARD_IOC4_BASE + ((slot - 4) << 14);
703#endif
704 if (address) 698 if (address)
705 address += speed << 17; 699 address += speed << 19;
706 break; 700 break;
707 701
708#ifdef IO_EC_EASI_BASE
709 case ECARD_EASI: 702 case ECARD_EASI:
710 address = IO_EC_EASI_BASE + (slot << 22); 703 address = ECARD_EASI_BASE + (slot << 24);
711 if (speed == ECARD_FAST) 704 if (speed == ECARD_FAST)
712 ectcr |= 1 << slot; 705 ectcr |= 1 << slot;
713 break; 706 break;
714#endif 707
715 default: 708 default:
716 break; 709 break;
717 } 710 }
@@ -990,6 +983,7 @@ ecard_probe(int slot, card_type_t type)
990 ecard_t **ecp; 983 ecard_t **ecp;
991 ecard_t *ec; 984 ecard_t *ec;
992 struct ex_ecid cid; 985 struct ex_ecid cid;
986 void __iomem *addr;
993 int i, rc; 987 int i, rc;
994 988
995 ec = ecard_alloc_card(type, slot); 989 ec = ecard_alloc_card(type, slot);
@@ -999,7 +993,7 @@ ecard_probe(int slot, card_type_t type)
999 } 993 }
1000 994
1001 rc = -ENODEV; 995 rc = -ENODEV;
1002 if ((ec->podaddr = __ecard_address(ec, type, ECARD_SYNC)) == 0) 996 if ((addr = __ecard_address(ec, type, ECARD_SYNC)) == NULL)
1003 goto nodev; 997 goto nodev;
1004 998
1005 cid.r_zero = 1; 999 cid.r_zero = 1;
@@ -1019,7 +1013,7 @@ ecard_probe(int slot, card_type_t type)
1019 ec->cid.fiqmask = cid.r_fiqmask; 1013 ec->cid.fiqmask = cid.r_fiqmask;
1020 ec->cid.fiqoff = ecard_gets24(cid.r_fiqoff); 1014 ec->cid.fiqoff = ecard_gets24(cid.r_fiqoff);
1021 ec->fiqaddr = 1015 ec->fiqaddr =
1022 ec->irqaddr = (void __iomem *)ioaddr(ec->podaddr); 1016 ec->irqaddr = addr;
1023 1017
1024 if (ec->cid.is) { 1018 if (ec->cid.is) {
1025 ec->irqmask = ec->cid.irqmask; 1019 ec->irqmask = ec->cid.irqmask;
@@ -1048,10 +1042,8 @@ ecard_probe(int slot, card_type_t type)
1048 set_irq_flags(ec->irq, IRQF_VALID); 1042 set_irq_flags(ec->irq, IRQF_VALID);
1049 } 1043 }
1050 1044
1051#ifdef IO_EC_MEMC8_BASE
1052 if (slot == 8) 1045 if (slot == 8)
1053 ec->irq = 11; 1046 ec->irq = 11;
1054#endif
1055#ifdef CONFIG_ARCH_RPC 1047#ifdef CONFIG_ARCH_RPC
1056 /* On RiscPC, only first two slots have DMA capability */ 1048 /* On RiscPC, only first two slots have DMA capability */
1057 if (slot < 2) 1049 if (slot < 2)
@@ -1097,9 +1089,7 @@ static int __init ecard_init(void)
1097 ecard_probe(slot, ECARD_IOC); 1089 ecard_probe(slot, ECARD_IOC);
1098 } 1090 }
1099 1091
1100#ifdef IO_EC_MEMC8_BASE
1101 ecard_probe(8, ECARD_IOC); 1092 ecard_probe(8, ECARD_IOC);
1102#endif
1103 1093
1104 irqhw = ecard_probeirqhw(); 1094 irqhw = ecard_probeirqhw();
1105 1095
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index a87cbf889ff..9ad50c4208a 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -24,6 +24,7 @@
24#include <asm/unwind.h> 24#include <asm/unwind.h>
25#include <asm/unistd.h> 25#include <asm/unistd.h>
26#include <asm/tls.h> 26#include <asm/tls.h>
27#include <asm/system.h>
27 28
28#include "entry-header.S" 29#include "entry-header.S"
29#include <asm/entry-macro-multi.S> 30#include <asm/entry-macro-multi.S>
@@ -262,8 +263,7 @@ __und_svc:
262 ldr r0, [r4, #-4] 263 ldr r0, [r4, #-4]
263#else 264#else
264 ldrh r0, [r4, #-2] @ Thumb instruction at LR - 2 265 ldrh r0, [r4, #-2] @ Thumb instruction at LR - 2
265 and r9, r0, #0xf800 266 cmp r0, #0xe800 @ 32-bit instruction if xx >= 0
266 cmp r9, #0xe800 @ 32-bit instruction if xx >= 0
267 ldrhhs r9, [r4] @ bottom 16 bits 267 ldrhhs r9, [r4] @ bottom 16 bits
268 orrhs r0, r9, r0, lsl #16 268 orrhs r0, r9, r0, lsl #16
269#endif 269#endif
@@ -440,18 +440,46 @@ __und_usr:
440#endif 440#endif
441 beq call_fpe 441 beq call_fpe
442 @ Thumb instruction 442 @ Thumb instruction
443#if __LINUX_ARM_ARCH__ >= 7 443#if CONFIG_ARM_THUMB && __LINUX_ARM_ARCH__ >= 6 && CONFIG_CPU_V7
444/*
445 * Thumb-2 instruction handling. Note that because pre-v6 and >= v6 platforms
446 * can never be supported in a single kernel, this code is not applicable at
447 * all when __LINUX_ARM_ARCH__ < 6. This allows simplifying assumptions to be
448 * made about .arch directives.
449 */
450#if __LINUX_ARM_ARCH__ < 7
451/* If the target CPU may not be Thumb-2-capable, a run-time check is needed: */
452#define NEED_CPU_ARCHITECTURE
453 ldr r5, .LCcpu_architecture
454 ldr r5, [r5]
455 cmp r5, #CPU_ARCH_ARMv7
456 blo __und_usr_unknown
457/*
458 * The following code won't get run unless the running CPU really is v7, so
459 * coding round the lack of ldrht on older arches is pointless. Temporarily
460 * override the assembler target arch with the minimum required instead:
461 */
462 .arch armv6t2
463#endif
4442: 4642:
445 ARM( ldrht r5, [r4], #2 ) 465 ARM( ldrht r5, [r4], #2 )
446 THUMB( ldrht r5, [r4] ) 466 THUMB( ldrht r5, [r4] )
447 THUMB( add r4, r4, #2 ) 467 THUMB( add r4, r4, #2 )
448 and r0, r5, #0xf800 @ mask bits 111x x... .... .... 468 cmp r5, #0xe800 @ 32bit instruction if xx != 0
449 cmp r0, #0xe800 @ 32bit instruction if xx != 0
450 blo __und_usr_unknown 469 blo __und_usr_unknown
4513: ldrht r0, [r4] 4703: ldrht r0, [r4]
452 add r2, r2, #2 @ r2 is PC + 2, make it PC + 4 471 add r2, r2, #2 @ r2 is PC + 2, make it PC + 4
453 orr r0, r0, r5, lsl #16 472 orr r0, r0, r5, lsl #16
473
474#if __LINUX_ARM_ARCH__ < 7
475/* If the target arch was overridden, change it back: */
476#ifdef CONFIG_CPU_32v6K
477 .arch armv6k
454#else 478#else
479 .arch armv6
480#endif
481#endif /* __LINUX_ARM_ARCH__ < 7 */
482#else /* !(CONFIG_ARM_THUMB && __LINUX_ARM_ARCH__ >= 6 && CONFIG_CPU_V7) */
455 b __und_usr_unknown 483 b __und_usr_unknown
456#endif 484#endif
457 UNWIND(.fnend ) 485 UNWIND(.fnend )
@@ -578,6 +606,12 @@ call_fpe:
578 movw_pc lr @ CP#14 (Debug) 606 movw_pc lr @ CP#14 (Debug)
579 movw_pc lr @ CP#15 (Control) 607 movw_pc lr @ CP#15 (Control)
580 608
609#ifdef NEED_CPU_ARCHITECTURE
610 .align 2
611.LCcpu_architecture:
612 .word __cpu_architecture
613#endif
614
581#ifdef CONFIG_NEON 615#ifdef CONFIG_NEON
582 .align 6 616 .align 6
583 617
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 742b6108a00..239703dbdf4 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -21,6 +21,7 @@
21#include <asm/memory.h> 21#include <asm/memory.h>
22#include <asm/thread_info.h> 22#include <asm/thread_info.h>
23#include <asm/system.h> 23#include <asm/system.h>
24#include <asm/pgtable.h>
24 25
25#ifdef CONFIG_DEBUG_LL 26#ifdef CONFIG_DEBUG_LL
26#include <mach/debug-macro.S> 27#include <mach/debug-macro.S>
@@ -38,11 +39,14 @@
38#error KERNEL_RAM_VADDR must start at 0xXXXX8000 39#error KERNEL_RAM_VADDR must start at 0xXXXX8000
39#endif 40#endif
40 41
42#define PG_DIR_SIZE 0x4000
43#define PMD_ORDER 2
44
41 .globl swapper_pg_dir 45 .globl swapper_pg_dir
42 .equ swapper_pg_dir, KERNEL_RAM_VADDR - 0x4000 46 .equ swapper_pg_dir, KERNEL_RAM_VADDR - PG_DIR_SIZE
43 47
44 .macro pgtbl, rd, phys 48 .macro pgtbl, rd, phys
45 add \rd, \phys, #TEXT_OFFSET - 0x4000 49 add \rd, \phys, #TEXT_OFFSET - PG_DIR_SIZE
46 .endm 50 .endm
47 51
48#ifdef CONFIG_XIP_KERNEL 52#ifdef CONFIG_XIP_KERNEL
@@ -148,11 +152,11 @@ __create_page_tables:
148 pgtbl r4, r8 @ page table address 152 pgtbl r4, r8 @ page table address
149 153
150 /* 154 /*
151 * Clear the 16K level 1 swapper page table 155 * Clear the swapper page table
152 */ 156 */
153 mov r0, r4 157 mov r0, r4
154 mov r3, #0 158 mov r3, #0
155 add r6, r0, #0x4000 159 add r6, r0, #PG_DIR_SIZE
1561: str r3, [r0], #4 1601: str r3, [r0], #4
157 str r3, [r0], #4 161 str r3, [r0], #4
158 str r3, [r0], #4 162 str r3, [r0], #4
@@ -171,30 +175,30 @@ __create_page_tables:
171 sub r0, r0, r3 @ virt->phys offset 175 sub r0, r0, r3 @ virt->phys offset
172 add r5, r5, r0 @ phys __enable_mmu 176 add r5, r5, r0 @ phys __enable_mmu
173 add r6, r6, r0 @ phys __enable_mmu_end 177 add r6, r6, r0 @ phys __enable_mmu_end
174 mov r5, r5, lsr #20 178 mov r5, r5, lsr #SECTION_SHIFT
175 mov r6, r6, lsr #20 179 mov r6, r6, lsr #SECTION_SHIFT
176 180
1771: orr r3, r7, r5, lsl #20 @ flags + kernel base 1811: orr r3, r7, r5, lsl #SECTION_SHIFT @ flags + kernel base
178 str r3, [r4, r5, lsl #2] @ identity mapping 182 str r3, [r4, r5, lsl #PMD_ORDER] @ identity mapping
179 teq r5, r6 183 cmp r5, r6
180 addne r5, r5, #1 @ next section 184 addlo r5, r5, #1 @ next section
181 bne 1b 185 blo 1b
182 186
183 /* 187 /*
184 * Now setup the pagetables for our kernel direct 188 * Now setup the pagetables for our kernel direct
185 * mapped region. 189 * mapped region.
186 */ 190 */
187 mov r3, pc 191 mov r3, pc
188 mov r3, r3, lsr #20 192 mov r3, r3, lsr #SECTION_SHIFT
189 orr r3, r7, r3, lsl #20 193 orr r3, r7, r3, lsl #SECTION_SHIFT
190 add r0, r4, #(KERNEL_START & 0xff000000) >> 18 194 add r0, r4, #(KERNEL_START & 0xff000000) >> (SECTION_SHIFT - PMD_ORDER)
191 str r3, [r0, #(KERNEL_START & 0x00f00000) >> 18]! 195 str r3, [r0, #((KERNEL_START & 0x00f00000) >> SECTION_SHIFT) << PMD_ORDER]!
192 ldr r6, =(KERNEL_END - 1) 196 ldr r6, =(KERNEL_END - 1)
193 add r0, r0, #4 197 add r0, r0, #1 << PMD_ORDER
194 add r6, r4, r6, lsr #18 198 add r6, r4, r6, lsr #(SECTION_SHIFT - PMD_ORDER)
1951: cmp r0, r6 1991: cmp r0, r6
196 add r3, r3, #1 << 20 200 add r3, r3, #1 << SECTION_SHIFT
197 strls r3, [r0], #4 201 strls r3, [r0], #1 << PMD_ORDER
198 bls 1b 202 bls 1b
199 203
200#ifdef CONFIG_XIP_KERNEL 204#ifdef CONFIG_XIP_KERNEL
@@ -203,11 +207,11 @@ __create_page_tables:
203 */ 207 */
204 add r3, r8, #TEXT_OFFSET 208 add r3, r8, #TEXT_OFFSET
205 orr r3, r3, r7 209 orr r3, r3, r7
206 add r0, r4, #(KERNEL_RAM_VADDR & 0xff000000) >> 18 210 add r0, r4, #(KERNEL_RAM_VADDR & 0xff000000) >> (SECTION_SHIFT - PMD_ORDER)
207 str r3, [r0, #(KERNEL_RAM_VADDR & 0x00f00000) >> 18]! 211 str r3, [r0, #(KERNEL_RAM_VADDR & 0x00f00000) >> (SECTION_SHIFT - PMD_ORDER)]!
208 ldr r6, =(_end - 1) 212 ldr r6, =(_end - 1)
209 add r0, r0, #4 213 add r0, r0, #4
210 add r6, r4, r6, lsr #18 214 add r6, r4, r6, lsr #(SECTION_SHIFT - PMD_ORDER)
2111: cmp r0, r6 2151: cmp r0, r6
212 add r3, r3, #1 << 20 216 add r3, r3, #1 << 20
213 strls r3, [r0], #4 217 strls r3, [r0], #4
@@ -218,12 +222,12 @@ __create_page_tables:
218 * Then map boot params address in r2 or 222 * Then map boot params address in r2 or
219 * the first 1MB of ram if boot params address is not specified. 223 * the first 1MB of ram if boot params address is not specified.
220 */ 224 */
221 mov r0, r2, lsr #20 225 mov r0, r2, lsr #SECTION_SHIFT
222 movs r0, r0, lsl #20 226 movs r0, r0, lsl #SECTION_SHIFT
223 moveq r0, r8 227 moveq r0, r8
224 sub r3, r0, r8 228 sub r3, r0, r8
225 add r3, r3, #PAGE_OFFSET 229 add r3, r3, #PAGE_OFFSET
226 add r3, r4, r3, lsr #18 230 add r3, r4, r3, lsr #(SECTION_SHIFT - PMD_ORDER)
227 orr r6, r7, r0 231 orr r6, r7, r0
228 str r6, [r3] 232 str r6, [r3]
229 233
@@ -236,21 +240,21 @@ __create_page_tables:
236 */ 240 */
237 addruart r7, r3 241 addruart r7, r3
238 242
239 mov r3, r3, lsr #20 243 mov r3, r3, lsr #SECTION_SHIFT
240 mov r3, r3, lsl #2 244 mov r3, r3, lsl #PMD_ORDER
241 245
242 add r0, r4, r3 246 add r0, r4, r3
243 rsb r3, r3, #0x4000 @ PTRS_PER_PGD*sizeof(long) 247 rsb r3, r3, #0x4000 @ PTRS_PER_PGD*sizeof(long)
244 cmp r3, #0x0800 @ limit to 512MB 248 cmp r3, #0x0800 @ limit to 512MB
245 movhi r3, #0x0800 249 movhi r3, #0x0800
246 add r6, r0, r3 250 add r6, r0, r3
247 mov r3, r7, lsr #20 251 mov r3, r7, lsr #SECTION_SHIFT
248 ldr r7, [r10, #PROCINFO_IO_MMUFLAGS] @ io_mmuflags 252 ldr r7, [r10, #PROCINFO_IO_MMUFLAGS] @ io_mmuflags
249 orr r3, r7, r3, lsl #20 253 orr r3, r7, r3, lsl #SECTION_SHIFT
2501: str r3, [r0], #4 2541: str r3, [r0], #4
251 add r3, r3, #1 << 20 255 add r3, r3, #1 << SECTION_SHIFT
252 teq r0, r6 256 cmp r0, r6
253 bne 1b 257 blo 1b
254 258
255#else /* CONFIG_DEBUG_ICEDCC */ 259#else /* CONFIG_DEBUG_ICEDCC */
256 /* we don't need any serial debugging mappings for ICEDCC */ 260 /* we don't need any serial debugging mappings for ICEDCC */
@@ -262,7 +266,7 @@ __create_page_tables:
262 * If we're using the NetWinder or CATS, we also need to map 266 * If we're using the NetWinder or CATS, we also need to map
263 * in the 16550-type serial port for the debug messages 267 * in the 16550-type serial port for the debug messages
264 */ 268 */
265 add r0, r4, #0xff000000 >> 18 269 add r0, r4, #0xff000000 >> (SECTION_SHIFT - PMD_ORDER)
266 orr r3, r7, #0x7c000000 270 orr r3, r7, #0x7c000000
267 str r3, [r0] 271 str r3, [r0]
268#endif 272#endif
@@ -272,10 +276,10 @@ __create_page_tables:
272 * Similar reasons here - for debug. This is 276 * Similar reasons here - for debug. This is
273 * only for Acorn RiscPC architectures. 277 * only for Acorn RiscPC architectures.
274 */ 278 */
275 add r0, r4, #0x02000000 >> 18 279 add r0, r4, #0x02000000 >> (SECTION_SHIFT - PMD_ORDER)
276 orr r3, r7, #0x02000000 280 orr r3, r7, #0x02000000
277 str r3, [r0] 281 str r3, [r0]
278 add r0, r4, #0xd8000000 >> 18 282 add r0, r4, #0xd8000000 >> (SECTION_SHIFT - PMD_ORDER)
279 str r3, [r0] 283 str r3, [r0]
280#endif 284#endif
281#endif 285#endif
@@ -488,13 +492,8 @@ __fixup_pv_table:
488 add r5, r5, r3 @ adjust table end address 492 add r5, r5, r3 @ adjust table end address
489 add r7, r7, r3 @ adjust __pv_phys_offset address 493 add r7, r7, r3 @ adjust __pv_phys_offset address
490 str r8, [r7] @ save computed PHYS_OFFSET to __pv_phys_offset 494 str r8, [r7] @ save computed PHYS_OFFSET to __pv_phys_offset
491#ifndef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT
492 mov r6, r3, lsr #24 @ constant for add/sub instructions 495 mov r6, r3, lsr #24 @ constant for add/sub instructions
493 teq r3, r6, lsl #24 @ must be 16MiB aligned 496 teq r3, r6, lsl #24 @ must be 16MiB aligned
494#else
495 mov r6, r3, lsr #16 @ constant for add/sub instructions
496 teq r3, r6, lsl #16 @ must be 64kiB aligned
497#endif
498THUMB( it ne @ cross section branch ) 497THUMB( it ne @ cross section branch )
499 bne __error 498 bne __error
500 str r6, [r7, #4] @ save to __pv_offset 499 str r6, [r7, #4] @ save to __pv_offset
@@ -510,20 +509,8 @@ ENDPROC(__fixup_pv_table)
510 .text 509 .text
511__fixup_a_pv_table: 510__fixup_a_pv_table:
512#ifdef CONFIG_THUMB2_KERNEL 511#ifdef CONFIG_THUMB2_KERNEL
513#ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT 512 lsls r6, #24
514 lsls r0, r6, #24 513 beq 2f
515 lsr r6, #8
516 beq 1f
517 clz r7, r0
518 lsr r0, #24
519 lsl r0, r7
520 bic r0, 0x0080
521 lsrs r7, #1
522 orrcs r0, #0x0080
523 orr r0, r0, r7, lsl #12
524#endif
5251: lsls r6, #24
526 beq 4f
527 clz r7, r6 514 clz r7, r6
528 lsr r6, #24 515 lsr r6, #24
529 lsl r6, r7 516 lsl r6, r7
@@ -532,43 +519,25 @@ __fixup_a_pv_table:
532 orrcs r6, #0x0080 519 orrcs r6, #0x0080
533 orr r6, r6, r7, lsl #12 520 orr r6, r6, r7, lsl #12
534 orr r6, #0x4000 521 orr r6, #0x4000
535 b 4f 522 b 2f
5362: @ at this point the C flag is always clear 5231: add r7, r3
537 add r7, r3 524 ldrh ip, [r7, #2]
538#ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT
539 ldrh ip, [r7]
540 tst ip, 0x0400 @ the i bit tells us LS or MS byte
541 beq 3f
542 cmp r0, #0 @ set C flag, and ...
543 biceq ip, 0x0400 @ immediate zero value has a special encoding
544 streqh ip, [r7] @ that requires the i bit cleared
545#endif
5463: ldrh ip, [r7, #2]
547 and ip, 0x8f00 525 and ip, 0x8f00
548 orrcc ip, r6 @ mask in offset bits 31-24 526 orr ip, r6 @ mask in offset bits 31-24
549 orrcs ip, r0 @ mask in offset bits 23-16
550 strh ip, [r7, #2] 527 strh ip, [r7, #2]
5514: cmp r4, r5 5282: cmp r4, r5
552 ldrcc r7, [r4], #4 @ use branch for delay slot 529 ldrcc r7, [r4], #4 @ use branch for delay slot
553 bcc 2b 530 bcc 1b
554 bx lr 531 bx lr
555#else 532#else
556#ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT 533 b 2f
557 and r0, r6, #255 @ offset bits 23-16 5341: ldr ip, [r7, r3]
558 mov r6, r6, lsr #8 @ offset bits 31-24
559#else
560 mov r0, #0 @ just in case...
561#endif
562 b 3f
5632: ldr ip, [r7, r3]
564 bic ip, ip, #0x000000ff 535 bic ip, ip, #0x000000ff
565 tst ip, #0x400 @ rotate shift tells us LS or MS byte 536 orr ip, ip, r6 @ mask in offset bits 31-24
566 orrne ip, ip, r6 @ mask in offset bits 31-24
567 orreq ip, ip, r0 @ mask in offset bits 23-16
568 str ip, [r7, r3] 537 str ip, [r7, r3]
5693: cmp r4, r5 5382: cmp r4, r5
570 ldrcc r7, [r4], #4 @ use branch for delay slot 539 ldrcc r7, [r4], #4 @ use branch for delay slot
571 bcc 2b 540 bcc 1b
572 mov pc, lr 541 mov pc, lr
573#endif 542#endif
574ENDPROC(__fixup_a_pv_table) 543ENDPROC(__fixup_a_pv_table)
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index de3dcab8610..53919b230e8 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -35,8 +35,8 @@
35#include <linux/list.h> 35#include <linux/list.h>
36#include <linux/kallsyms.h> 36#include <linux/kallsyms.h>
37#include <linux/proc_fs.h> 37#include <linux/proc_fs.h>
38#include <linux/ftrace.h>
39 38
39#include <asm/exception.h>
40#include <asm/system.h> 40#include <asm/system.h>
41#include <asm/mach/arch.h> 41#include <asm/mach/arch.h>
42#include <asm/mach/irq.h> 42#include <asm/mach/irq.h>
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index e59bbd496c3..c1b4463dcc8 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -32,6 +32,24 @@ static atomic_t waiting_for_crash_ipi;
32 32
33int machine_kexec_prepare(struct kimage *image) 33int machine_kexec_prepare(struct kimage *image)
34{ 34{
35 unsigned long page_list;
36 void *reboot_code_buffer;
37 page_list = image->head & PAGE_MASK;
38
39 reboot_code_buffer = page_address(image->control_code_page);
40
41 /* Prepare parameters for reboot_code_buffer*/
42 kexec_start_address = image->start;
43 kexec_indirection_page = page_list;
44 kexec_mach_type = machine_arch_type;
45 kexec_boot_atags = image->start - KEXEC_ARM_ZIMAGE_OFFSET + KEXEC_ARM_ATAGS_OFFSET;
46
47 /* copy our kernel relocation code to the control code page */
48 memcpy(reboot_code_buffer,
49 relocate_new_kernel, relocate_new_kernel_size);
50
51 flush_icache_range((unsigned long) reboot_code_buffer,
52 (unsigned long) reboot_code_buffer + KEXEC_CONTROL_PAGE_SIZE);
35 return 0; 53 return 0;
36} 54}
37 55
@@ -82,31 +100,14 @@ void (*kexec_reinit)(void);
82 100
83void machine_kexec(struct kimage *image) 101void machine_kexec(struct kimage *image)
84{ 102{
85 unsigned long page_list;
86 unsigned long reboot_code_buffer_phys; 103 unsigned long reboot_code_buffer_phys;
87 void *reboot_code_buffer; 104 void *reboot_code_buffer;
88 105
89
90 page_list = image->head & PAGE_MASK;
91
92 /* we need both effective and real address here */ 106 /* we need both effective and real address here */
93 reboot_code_buffer_phys = 107 reboot_code_buffer_phys =
94 page_to_pfn(image->control_code_page) << PAGE_SHIFT; 108 page_to_pfn(image->control_code_page) << PAGE_SHIFT;
95 reboot_code_buffer = page_address(image->control_code_page); 109 reboot_code_buffer = page_address(image->control_code_page);
96 110
97 /* Prepare parameters for reboot_code_buffer*/
98 kexec_start_address = image->start;
99 kexec_indirection_page = page_list;
100 kexec_mach_type = machine_arch_type;
101 kexec_boot_atags = image->start - KEXEC_ARM_ZIMAGE_OFFSET + KEXEC_ARM_ATAGS_OFFSET;
102
103 /* copy our kernel relocation code to the control code page */
104 memcpy(reboot_code_buffer,
105 relocate_new_kernel, relocate_new_kernel_size);
106
107
108 flush_icache_range((unsigned long) reboot_code_buffer,
109 (unsigned long) reboot_code_buffer + KEXEC_CONTROL_PAGE_SIZE);
110 printk(KERN_INFO "Bye!\n"); 111 printk(KERN_INFO "Bye!\n");
111 112
112 if (kexec_reinit) 113 if (kexec_reinit)
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index cc2020c2c70..1e9be5d25e5 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -33,7 +33,7 @@
33 * recompiling the whole kernel when CONFIG_XIP_KERNEL is turned on/off. 33 * recompiling the whole kernel when CONFIG_XIP_KERNEL is turned on/off.
34 */ 34 */
35#undef MODULES_VADDR 35#undef MODULES_VADDR
36#define MODULES_VADDR (((unsigned long)_etext + ~PGDIR_MASK) & PGDIR_MASK) 36#define MODULES_VADDR (((unsigned long)_etext + ~PMD_MASK) & PMD_MASK)
37#endif 37#endif
38 38
39#ifdef CONFIG_MMU 39#ifdef CONFIG_MMU
diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c
index 4c851834f68..6be3e2e4d83 100644
--- a/arch/arm/kernel/perf_event_v7.c
+++ b/arch/arm/kernel/perf_event_v7.c
@@ -321,8 +321,8 @@ static const unsigned armv7_a9_perf_map[PERF_COUNT_HW_MAX] = {
321 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES, 321 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES,
322 [PERF_COUNT_HW_INSTRUCTIONS] = 322 [PERF_COUNT_HW_INSTRUCTIONS] =
323 ARMV7_PERFCTR_INST_OUT_OF_RENAME_STAGE, 323 ARMV7_PERFCTR_INST_OUT_OF_RENAME_STAGE,
324 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV7_PERFCTR_COHERENT_LINE_HIT, 324 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV7_PERFCTR_DCACHE_ACCESS,
325 [PERF_COUNT_HW_CACHE_MISSES] = ARMV7_PERFCTR_COHERENT_LINE_MISS, 325 [PERF_COUNT_HW_CACHE_MISSES] = ARMV7_PERFCTR_DCACHE_REFILL,
326 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERFCTR_PC_WRITE, 326 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERFCTR_PC_WRITE,
327 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED, 327 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
328 [PERF_COUNT_HW_BUS_CYCLES] = ARMV7_PERFCTR_CLOCK_CYCLES, 328 [PERF_COUNT_HW_BUS_CYCLES] = ARMV7_PERFCTR_CLOCK_CYCLES,
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 1a347f481e5..fd0814076ff 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -319,7 +319,7 @@ void show_regs(struct pt_regs * regs)
319 printk("\n"); 319 printk("\n");
320 printk("Pid: %d, comm: %20s\n", task_pid_nr(current), current->comm); 320 printk("Pid: %d, comm: %20s\n", task_pid_nr(current), current->comm);
321 __show_regs(regs); 321 __show_regs(regs);
322 __backtrace(); 322 dump_stack();
323} 323}
324 324
325ATOMIC_NOTIFIER_HEAD(thread_notify_head); 325ATOMIC_NOTIFIER_HEAD(thread_notify_head);
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index e514c76043b..3fe93f75b55 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -29,6 +29,8 @@
29#include <linux/fs.h> 29#include <linux/fs.h>
30#include <linux/proc_fs.h> 30#include <linux/proc_fs.h>
31#include <linux/memblock.h> 31#include <linux/memblock.h>
32#include <linux/bug.h>
33#include <linux/compiler.h>
32 34
33#include <asm/unified.h> 35#include <asm/unified.h>
34#include <asm/cpu.h> 36#include <asm/cpu.h>
@@ -42,6 +44,7 @@
42#include <asm/cacheflush.h> 44#include <asm/cacheflush.h>
43#include <asm/cachetype.h> 45#include <asm/cachetype.h>
44#include <asm/tlbflush.h> 46#include <asm/tlbflush.h>
47#include <asm/system.h>
45 48
46#include <asm/prom.h> 49#include <asm/prom.h>
47#include <asm/mach/arch.h> 50#include <asm/mach/arch.h>
@@ -115,6 +118,13 @@ struct outer_cache_fns outer_cache __read_mostly;
115EXPORT_SYMBOL(outer_cache); 118EXPORT_SYMBOL(outer_cache);
116#endif 119#endif
117 120
121/*
122 * Cached cpu_architecture() result for use by assembler code.
123 * C code should use the cpu_architecture() function instead of accessing this
124 * variable directly.
125 */
126int __cpu_architecture __read_mostly = CPU_ARCH_UNKNOWN;
127
118struct stack { 128struct stack {
119 u32 irq[3]; 129 u32 irq[3];
120 u32 abt[3]; 130 u32 abt[3];
@@ -210,7 +220,7 @@ static const char *proc_arch[] = {
210 "?(17)", 220 "?(17)",
211}; 221};
212 222
213int cpu_architecture(void) 223static int __get_cpu_architecture(void)
214{ 224{
215 int cpu_arch; 225 int cpu_arch;
216 226
@@ -243,11 +253,22 @@ int cpu_architecture(void)
243 return cpu_arch; 253 return cpu_arch;
244} 254}
245 255
256int __pure cpu_architecture(void)
257{
258 BUG_ON(__cpu_architecture == CPU_ARCH_UNKNOWN);
259
260 return __cpu_architecture;
261}
262
246static int cpu_has_aliasing_icache(unsigned int arch) 263static int cpu_has_aliasing_icache(unsigned int arch)
247{ 264{
248 int aliasing_icache; 265 int aliasing_icache;
249 unsigned int id_reg, num_sets, line_size; 266 unsigned int id_reg, num_sets, line_size;
250 267
268 /* PIPT caches never alias. */
269 if (icache_is_pipt())
270 return 0;
271
251 /* arch specifies the register format */ 272 /* arch specifies the register format */
252 switch (arch) { 273 switch (arch) {
253 case CPU_ARCH_ARMv7: 274 case CPU_ARCH_ARMv7:
@@ -282,8 +303,14 @@ static void __init cacheid_init(void)
282 /* ARMv7 register format */ 303 /* ARMv7 register format */
283 arch = CPU_ARCH_ARMv7; 304 arch = CPU_ARCH_ARMv7;
284 cacheid = CACHEID_VIPT_NONALIASING; 305 cacheid = CACHEID_VIPT_NONALIASING;
285 if ((cachetype & (3 << 14)) == 1 << 14) 306 switch (cachetype & (3 << 14)) {
307 case (1 << 14):
286 cacheid |= CACHEID_ASID_TAGGED; 308 cacheid |= CACHEID_ASID_TAGGED;
309 break;
310 case (3 << 14):
311 cacheid |= CACHEID_PIPT;
312 break;
313 }
287 } else { 314 } else {
288 arch = CPU_ARCH_ARMv6; 315 arch = CPU_ARCH_ARMv6;
289 if (cachetype & (1 << 23)) 316 if (cachetype & (1 << 23))
@@ -300,10 +327,11 @@ static void __init cacheid_init(void)
300 printk("CPU: %s data cache, %s instruction cache\n", 327 printk("CPU: %s data cache, %s instruction cache\n",
301 cache_is_vivt() ? "VIVT" : 328 cache_is_vivt() ? "VIVT" :
302 cache_is_vipt_aliasing() ? "VIPT aliasing" : 329 cache_is_vipt_aliasing() ? "VIPT aliasing" :
303 cache_is_vipt_nonaliasing() ? "VIPT nonaliasing" : "unknown", 330 cache_is_vipt_nonaliasing() ? "PIPT / VIPT nonaliasing" : "unknown",
304 cache_is_vivt() ? "VIVT" : 331 cache_is_vivt() ? "VIVT" :
305 icache_is_vivt_asid_tagged() ? "VIVT ASID tagged" : 332 icache_is_vivt_asid_tagged() ? "VIVT ASID tagged" :
306 icache_is_vipt_aliasing() ? "VIPT aliasing" : 333 icache_is_vipt_aliasing() ? "VIPT aliasing" :
334 icache_is_pipt() ? "PIPT" :
307 cache_is_vipt_nonaliasing() ? "VIPT nonaliasing" : "unknown"); 335 cache_is_vipt_nonaliasing() ? "VIPT nonaliasing" : "unknown");
308} 336}
309 337
@@ -414,6 +442,7 @@ static void __init setup_processor(void)
414 } 442 }
415 443
416 cpu_name = list->cpu_name; 444 cpu_name = list->cpu_name;
445 __cpu_architecture = __get_cpu_architecture();
417 446
418#ifdef MULTI_CPU 447#ifdef MULTI_CPU
419 processor = *list->proc; 448 processor = *list->proc;
@@ -861,7 +890,7 @@ static struct machine_desc * __init setup_machine_tags(unsigned int nr)
861 } 890 }
862 891
863 if (mdesc->fixup) 892 if (mdesc->fixup)
864 mdesc->fixup(mdesc, tags, &from, &meminfo); 893 mdesc->fixup(tags, &from, &meminfo);
865 894
866 if (tags->hdr.tag == ATAG_CORE) { 895 if (tags->hdr.tag == ATAG_CORE) {
867 if (meminfo.nr_banks != 0) 896 if (meminfo.nr_banks != 0)
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index d88ff0230e8..94f34a6c861 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -16,7 +16,6 @@
16#include <linux/cache.h> 16#include <linux/cache.h>
17#include <linux/profile.h> 17#include <linux/profile.h>
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/ftrace.h>
20#include <linux/mm.h> 19#include <linux/mm.h>
21#include <linux/err.h> 20#include <linux/err.h>
22#include <linux/cpu.h> 21#include <linux/cpu.h>
@@ -31,6 +30,8 @@
31#include <asm/cacheflush.h> 30#include <asm/cacheflush.h>
32#include <asm/cpu.h> 31#include <asm/cpu.h>
33#include <asm/cputype.h> 32#include <asm/cputype.h>
33#include <asm/exception.h>
34#include <asm/topology.h>
34#include <asm/mmu_context.h> 35#include <asm/mmu_context.h>
35#include <asm/pgtable.h> 36#include <asm/pgtable.h>
36#include <asm/pgalloc.h> 37#include <asm/pgalloc.h>
@@ -39,6 +40,7 @@
39#include <asm/tlbflush.h> 40#include <asm/tlbflush.h>
40#include <asm/ptrace.h> 41#include <asm/ptrace.h>
41#include <asm/localtimer.h> 42#include <asm/localtimer.h>
43#include <asm/smp_plat.h>
42 44
43/* 45/*
44 * as from 2.5, kernels no longer have an init_tasks structure 46 * as from 2.5, kernels no longer have an init_tasks structure
@@ -259,6 +261,20 @@ void __ref cpu_die(void)
259} 261}
260#endif /* CONFIG_HOTPLUG_CPU */ 262#endif /* CONFIG_HOTPLUG_CPU */
261 263
264int __cpu_logical_map[NR_CPUS];
265
266void __init smp_setup_processor_id(void)
267{
268 int i;
269 u32 cpu = is_smp() ? read_cpuid_mpidr() & 0xff : 0;
270
271 cpu_logical_map(0) = cpu;
272 for (i = 1; i < NR_CPUS; ++i)
273 cpu_logical_map(i) = i == cpu ? 0 : i;
274
275 printk(KERN_INFO "Booting Linux on physical CPU %d\n", cpu);
276}
277
262/* 278/*
263 * Called by both boot and secondaries to move global data into 279 * Called by both boot and secondaries to move global data into
264 * per-processor storage. 280 * per-processor storage.
@@ -268,6 +284,8 @@ static void __cpuinit smp_store_cpu_info(unsigned int cpuid)
268 struct cpuinfo_arm *cpu_info = &per_cpu(cpu_data, cpuid); 284 struct cpuinfo_arm *cpu_info = &per_cpu(cpu_data, cpuid);
269 285
270 cpu_info->loops_per_jiffy = loops_per_jiffy; 286 cpu_info->loops_per_jiffy = loops_per_jiffy;
287
288 store_cpu_topology(cpuid);
271} 289}
272 290
273/* 291/*
@@ -301,17 +319,7 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
301 */ 319 */
302 platform_secondary_init(cpu); 320 platform_secondary_init(cpu);
303 321
304 /*
305 * Enable local interrupts.
306 */
307 notify_cpu_starting(cpu); 322 notify_cpu_starting(cpu);
308 local_irq_enable();
309 local_fiq_enable();
310
311 /*
312 * Setup the percpu timer for this CPU.
313 */
314 percpu_timer_setup();
315 323
316 calibrate_delay(); 324 calibrate_delay();
317 325
@@ -323,10 +331,23 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
323 * before we continue. 331 * before we continue.
324 */ 332 */
325 set_cpu_online(cpu, true); 333 set_cpu_online(cpu, true);
334
335 /*
336 * Setup the percpu timer for this CPU.
337 */
338 percpu_timer_setup();
339
326 while (!cpu_active(cpu)) 340 while (!cpu_active(cpu))
327 cpu_relax(); 341 cpu_relax();
328 342
329 /* 343 /*
344 * cpu_active bit is set, so it's safe to enalbe interrupts
345 * now.
346 */
347 local_irq_enable();
348 local_fiq_enable();
349
350 /*
330 * OK, it's off to the idle thread for us 351 * OK, it's off to the idle thread for us
331 */ 352 */
332 cpu_idle(); 353 cpu_idle();
@@ -358,6 +379,8 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
358{ 379{
359 unsigned int ncores = num_possible_cpus(); 380 unsigned int ncores = num_possible_cpus();
360 381
382 init_cpu_topology();
383
361 smp_store_cpu_info(smp_processor_id()); 384 smp_store_cpu_info(smp_processor_id());
362 385
363 /* 386 /*
@@ -460,6 +483,11 @@ static void ipi_timer(void)
460#ifdef CONFIG_LOCAL_TIMERS 483#ifdef CONFIG_LOCAL_TIMERS
461asmlinkage void __exception_irq_entry do_local_timer(struct pt_regs *regs) 484asmlinkage void __exception_irq_entry do_local_timer(struct pt_regs *regs)
462{ 485{
486 handle_local_timer(regs);
487}
488
489void handle_local_timer(struct pt_regs *regs)
490{
463 struct pt_regs *old_regs = set_irq_regs(regs); 491 struct pt_regs *old_regs = set_irq_regs(regs);
464 int cpu = smp_processor_id(); 492 int cpu = smp_processor_id();
465 493
@@ -538,7 +566,7 @@ static void percpu_timer_stop(void)
538} 566}
539#endif 567#endif
540 568
541static DEFINE_SPINLOCK(stop_lock); 569static DEFINE_RAW_SPINLOCK(stop_lock);
542 570
543/* 571/*
544 * ipi_cpu_stop - handle IPI from smp_send_stop() 572 * ipi_cpu_stop - handle IPI from smp_send_stop()
@@ -547,10 +575,10 @@ static void ipi_cpu_stop(unsigned int cpu)
547{ 575{
548 if (system_state == SYSTEM_BOOTING || 576 if (system_state == SYSTEM_BOOTING ||
549 system_state == SYSTEM_RUNNING) { 577 system_state == SYSTEM_RUNNING) {
550 spin_lock(&stop_lock); 578 raw_spin_lock(&stop_lock);
551 printk(KERN_CRIT "CPU%u: stopping\n", cpu); 579 printk(KERN_CRIT "CPU%u: stopping\n", cpu);
552 dump_stack(); 580 dump_stack();
553 spin_unlock(&stop_lock); 581 raw_spin_unlock(&stop_lock);
554 } 582 }
555 583
556 set_cpu_online(cpu, false); 584 set_cpu_online(cpu, false);
@@ -567,6 +595,11 @@ static void ipi_cpu_stop(unsigned int cpu)
567 */ 595 */
568asmlinkage void __exception_irq_entry do_IPI(int ipinr, struct pt_regs *regs) 596asmlinkage void __exception_irq_entry do_IPI(int ipinr, struct pt_regs *regs)
569{ 597{
598 handle_IPI(ipinr, regs);
599}
600
601void handle_IPI(int ipinr, struct pt_regs *regs)
602{
570 unsigned int cpu = smp_processor_id(); 603 unsigned int cpu = smp_processor_id();
571 struct pt_regs *old_regs = set_irq_regs(regs); 604 struct pt_regs *old_regs = set_irq_regs(regs);
572 605
diff --git a/arch/arm/kernel/smp_scu.c b/arch/arm/kernel/smp_scu.c
index 7fcddb75c87..8f5dd796335 100644
--- a/arch/arm/kernel/smp_scu.c
+++ b/arch/arm/kernel/smp_scu.c
@@ -34,7 +34,7 @@ unsigned int __init scu_get_core_count(void __iomem *scu_base)
34/* 34/*
35 * Enable the SCU 35 * Enable the SCU
36 */ 36 */
37void __init scu_enable(void __iomem *scu_base) 37void scu_enable(void __iomem *scu_base)
38{ 38{
39 u32 scu_ctrl; 39 u32 scu_ctrl;
40 40
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index cb634c3e28e..5a54b95d6bd 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -39,13 +39,11 @@
39 */ 39 */
40static struct sys_timer *system_timer; 40static struct sys_timer *system_timer;
41 41
42#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) 42#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || \
43 defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE)
43/* this needs a better home */ 44/* this needs a better home */
44DEFINE_SPINLOCK(rtc_lock); 45DEFINE_SPINLOCK(rtc_lock);
45
46#ifdef CONFIG_RTC_DRV_CMOS_MODULE
47EXPORT_SYMBOL(rtc_lock); 46EXPORT_SYMBOL(rtc_lock);
48#endif
49#endif /* pc-style 'CMOS' RTC support */ 47#endif /* pc-style 'CMOS' RTC support */
50 48
51/* change this if you have some constant time drift */ 49/* change this if you have some constant time drift */
diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
new file mode 100644
index 00000000000..1040c00405d
--- /dev/null
+++ b/arch/arm/kernel/topology.c
@@ -0,0 +1,148 @@
1/*
2 * arch/arm/kernel/topology.c
3 *
4 * Copyright (C) 2011 Linaro Limited.
5 * Written by: Vincent Guittot
6 *
7 * based on arch/sh/kernel/topology.c
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
14#include <linux/cpu.h>
15#include <linux/cpumask.h>
16#include <linux/init.h>
17#include <linux/percpu.h>
18#include <linux/node.h>
19#include <linux/nodemask.h>
20#include <linux/sched.h>
21
22#include <asm/cputype.h>
23#include <asm/topology.h>
24
25#define MPIDR_SMP_BITMASK (0x3 << 30)
26#define MPIDR_SMP_VALUE (0x2 << 30)
27
28#define MPIDR_MT_BITMASK (0x1 << 24)
29
30/*
31 * These masks reflect the current use of the affinity levels.
32 * The affinity level can be up to 16 bits according to ARM ARM
33 */
34
35#define MPIDR_LEVEL0_MASK 0x3
36#define MPIDR_LEVEL0_SHIFT 0
37
38#define MPIDR_LEVEL1_MASK 0xF
39#define MPIDR_LEVEL1_SHIFT 8
40
41#define MPIDR_LEVEL2_MASK 0xFF
42#define MPIDR_LEVEL2_SHIFT 16
43
44struct cputopo_arm cpu_topology[NR_CPUS];
45
46const struct cpumask *cpu_coregroup_mask(unsigned int cpu)
47{
48 return &cpu_topology[cpu].core_sibling;
49}
50
51/*
52 * store_cpu_topology is called at boot when only one cpu is running
53 * and with the mutex cpu_hotplug.lock locked, when several cpus have booted,
54 * which prevents simultaneous write access to cpu_topology array
55 */
56void store_cpu_topology(unsigned int cpuid)
57{
58 struct cputopo_arm *cpuid_topo = &cpu_topology[cpuid];
59 unsigned int mpidr;
60 unsigned int cpu;
61
62 /* If the cpu topology has been already set, just return */
63 if (cpuid_topo->core_id != -1)
64 return;
65
66 mpidr = read_cpuid_mpidr();
67
68 /* create cpu topology mapping */
69 if ((mpidr & MPIDR_SMP_BITMASK) == MPIDR_SMP_VALUE) {
70 /*
71 * This is a multiprocessor system
72 * multiprocessor format & multiprocessor mode field are set
73 */
74
75 if (mpidr & MPIDR_MT_BITMASK) {
76 /* core performance interdependency */
77 cpuid_topo->thread_id = (mpidr >> MPIDR_LEVEL0_SHIFT)
78 & MPIDR_LEVEL0_MASK;
79 cpuid_topo->core_id = (mpidr >> MPIDR_LEVEL1_SHIFT)
80 & MPIDR_LEVEL1_MASK;
81 cpuid_topo->socket_id = (mpidr >> MPIDR_LEVEL2_SHIFT)
82 & MPIDR_LEVEL2_MASK;
83 } else {
84 /* largely independent cores */
85 cpuid_topo->thread_id = -1;
86 cpuid_topo->core_id = (mpidr >> MPIDR_LEVEL0_SHIFT)
87 & MPIDR_LEVEL0_MASK;
88 cpuid_topo->socket_id = (mpidr >> MPIDR_LEVEL1_SHIFT)
89 & MPIDR_LEVEL1_MASK;
90 }
91 } else {
92 /*
93 * This is an uniprocessor system
94 * we are in multiprocessor format but uniprocessor system
95 * or in the old uniprocessor format
96 */
97 cpuid_topo->thread_id = -1;
98 cpuid_topo->core_id = 0;
99 cpuid_topo->socket_id = -1;
100 }
101
102 /* update core and thread sibling masks */
103 for_each_possible_cpu(cpu) {
104 struct cputopo_arm *cpu_topo = &cpu_topology[cpu];
105
106 if (cpuid_topo->socket_id == cpu_topo->socket_id) {
107 cpumask_set_cpu(cpuid, &cpu_topo->core_sibling);
108 if (cpu != cpuid)
109 cpumask_set_cpu(cpu,
110 &cpuid_topo->core_sibling);
111
112 if (cpuid_topo->core_id == cpu_topo->core_id) {
113 cpumask_set_cpu(cpuid,
114 &cpu_topo->thread_sibling);
115 if (cpu != cpuid)
116 cpumask_set_cpu(cpu,
117 &cpuid_topo->thread_sibling);
118 }
119 }
120 }
121 smp_wmb();
122
123 printk(KERN_INFO "CPU%u: thread %d, cpu %d, socket %d, mpidr %x\n",
124 cpuid, cpu_topology[cpuid].thread_id,
125 cpu_topology[cpuid].core_id,
126 cpu_topology[cpuid].socket_id, mpidr);
127}
128
129/*
130 * init_cpu_topology is called at boot when only one cpu is running
131 * which prevent simultaneous write access to cpu_topology array
132 */
133void init_cpu_topology(void)
134{
135 unsigned int cpu;
136
137 /* init core mask */
138 for_each_possible_cpu(cpu) {
139 struct cputopo_arm *cpu_topo = &(cpu_topology[cpu]);
140
141 cpu_topo->thread_id = -1;
142 cpu_topo->core_id = -1;
143 cpu_topo->socket_id = -1;
144 cpumask_clear(&cpu_topo->core_sibling);
145 cpumask_clear(&cpu_topo->thread_sibling);
146 }
147 smp_wmb();
148}
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index bc9f9da782c..99a57270250 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -21,12 +21,14 @@
21#include <linux/kdebug.h> 21#include <linux/kdebug.h>
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/kexec.h> 23#include <linux/kexec.h>
24#include <linux/bug.h>
24#include <linux/delay.h> 25#include <linux/delay.h>
25#include <linux/init.h> 26#include <linux/init.h>
26#include <linux/sched.h> 27#include <linux/sched.h>
27 28
28#include <linux/atomic.h> 29#include <linux/atomic.h>
29#include <asm/cacheflush.h> 30#include <asm/cacheflush.h>
31#include <asm/exception.h>
30#include <asm/system.h> 32#include <asm/system.h>
31#include <asm/unistd.h> 33#include <asm/unistd.h>
32#include <asm/traps.h> 34#include <asm/traps.h>
@@ -255,7 +257,7 @@ static int __die(const char *str, int err, struct thread_info *thread, struct pt
255 return ret; 257 return ret;
256} 258}
257 259
258static DEFINE_SPINLOCK(die_lock); 260static DEFINE_RAW_SPINLOCK(die_lock);
259 261
260/* 262/*
261 * This function is protected against re-entrancy. 263 * This function is protected against re-entrancy.
@@ -267,9 +269,11 @@ void die(const char *str, struct pt_regs *regs, int err)
267 269
268 oops_enter(); 270 oops_enter();
269 271
270 spin_lock_irq(&die_lock); 272 raw_spin_lock_irq(&die_lock);
271 console_verbose(); 273 console_verbose();
272 bust_spinlocks(1); 274 bust_spinlocks(1);
275 if (!user_mode(regs))
276 report_bug(regs->ARM_pc, regs);
273 ret = __die(str, err, thread, regs); 277 ret = __die(str, err, thread, regs);
274 278
275 if (regs && kexec_should_crash(thread->task)) 279 if (regs && kexec_should_crash(thread->task))
@@ -277,7 +281,7 @@ void die(const char *str, struct pt_regs *regs, int err)
277 281
278 bust_spinlocks(0); 282 bust_spinlocks(0);
279 add_taint(TAINT_DIE); 283 add_taint(TAINT_DIE);
280 spin_unlock_irq(&die_lock); 284 raw_spin_unlock_irq(&die_lock);
281 oops_exit(); 285 oops_exit();
282 286
283 if (in_interrupt()) 287 if (in_interrupt())
@@ -301,25 +305,43 @@ void arm_notify_die(const char *str, struct pt_regs *regs,
301 } 305 }
302} 306}
303 307
308#ifdef CONFIG_GENERIC_BUG
309
310int is_valid_bugaddr(unsigned long pc)
311{
312#ifdef CONFIG_THUMB2_KERNEL
313 unsigned short bkpt;
314#else
315 unsigned long bkpt;
316#endif
317
318 if (probe_kernel_address((unsigned *)pc, bkpt))
319 return 0;
320
321 return bkpt == BUG_INSTR_VALUE;
322}
323
324#endif
325
304static LIST_HEAD(undef_hook); 326static LIST_HEAD(undef_hook);
305static DEFINE_SPINLOCK(undef_lock); 327static DEFINE_RAW_SPINLOCK(undef_lock);
306 328
307void register_undef_hook(struct undef_hook *hook) 329void register_undef_hook(struct undef_hook *hook)
308{ 330{
309 unsigned long flags; 331 unsigned long flags;
310 332
311 spin_lock_irqsave(&undef_lock, flags); 333 raw_spin_lock_irqsave(&undef_lock, flags);
312 list_add(&hook->node, &undef_hook); 334 list_add(&hook->node, &undef_hook);
313 spin_unlock_irqrestore(&undef_lock, flags); 335 raw_spin_unlock_irqrestore(&undef_lock, flags);
314} 336}
315 337
316void unregister_undef_hook(struct undef_hook *hook) 338void unregister_undef_hook(struct undef_hook *hook)
317{ 339{
318 unsigned long flags; 340 unsigned long flags;
319 341
320 spin_lock_irqsave(&undef_lock, flags); 342 raw_spin_lock_irqsave(&undef_lock, flags);
321 list_del(&hook->node); 343 list_del(&hook->node);
322 spin_unlock_irqrestore(&undef_lock, flags); 344 raw_spin_unlock_irqrestore(&undef_lock, flags);
323} 345}
324 346
325static int call_undef_hook(struct pt_regs *regs, unsigned int instr) 347static int call_undef_hook(struct pt_regs *regs, unsigned int instr)
@@ -328,12 +350,12 @@ static int call_undef_hook(struct pt_regs *regs, unsigned int instr)
328 unsigned long flags; 350 unsigned long flags;
329 int (*fn)(struct pt_regs *regs, unsigned int instr) = NULL; 351 int (*fn)(struct pt_regs *regs, unsigned int instr) = NULL;
330 352
331 spin_lock_irqsave(&undef_lock, flags); 353 raw_spin_lock_irqsave(&undef_lock, flags);
332 list_for_each_entry(hook, &undef_hook, node) 354 list_for_each_entry(hook, &undef_hook, node)
333 if ((instr & hook->instr_mask) == hook->instr_val && 355 if ((instr & hook->instr_mask) == hook->instr_val &&
334 (regs->ARM_cpsr & hook->cpsr_mask) == hook->cpsr_val) 356 (regs->ARM_cpsr & hook->cpsr_mask) == hook->cpsr_val)
335 fn = hook->fn; 357 fn = hook->fn;
336 spin_unlock_irqrestore(&undef_lock, flags); 358 raw_spin_unlock_irqrestore(&undef_lock, flags);
337 359
338 return fn ? fn(regs, instr) : 1; 360 return fn ? fn(regs, instr) : 1;
339} 361}
@@ -706,16 +728,6 @@ baddataabort(int code, unsigned long instr, struct pt_regs *regs)
706 arm_notify_die("unknown data abort code", regs, &info, instr, 0); 728 arm_notify_die("unknown data abort code", regs, &info, instr, 0);
707} 729}
708 730
709void __attribute__((noreturn)) __bug(const char *file, int line)
710{
711 printk(KERN_CRIT"kernel BUG at %s:%d!\n", file, line);
712 *(int *)0 = 0;
713
714 /* Avoid "noreturn function does return" */
715 for (;;);
716}
717EXPORT_SYMBOL(__bug);
718
719void __readwrite_bug(const char *fn) 731void __readwrite_bug(const char *fn)
720{ 732{
721 printk("%s called, but not implemented\n", fn); 733 printk("%s called, but not implemented\n", fn);
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 4e66f62b8d4..20b3041e086 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -21,7 +21,8 @@
21#define ARM_CPU_KEEP(x) 21#define ARM_CPU_KEEP(x)
22#endif 22#endif
23 23
24#if defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK) 24#if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \
25 defined(CONFIG_GENERIC_BUG)
25#define ARM_EXIT_KEEP(x) x 26#define ARM_EXIT_KEEP(x) x
26#define ARM_EXIT_DISCARD(x) 27#define ARM_EXIT_DISCARD(x)
27#else 28#else
diff --git a/arch/arm/lib/backtrace.S b/arch/arm/lib/backtrace.S
index a673297b0cf..cd07b5814c2 100644
--- a/arch/arm/lib/backtrace.S
+++ b/arch/arm/lib/backtrace.S
@@ -22,15 +22,10 @@
22#define mask r7 22#define mask r7
23#define offset r8 23#define offset r8
24 24
25ENTRY(__backtrace)
26 mov r1, #0x10
27 mov r0, fp
28
29ENTRY(c_backtrace) 25ENTRY(c_backtrace)
30 26
31#if !defined(CONFIG_FRAME_POINTER) || !defined(CONFIG_PRINTK) 27#if !defined(CONFIG_FRAME_POINTER) || !defined(CONFIG_PRINTK)
32 mov pc, lr 28 mov pc, lr
33ENDPROC(__backtrace)
34ENDPROC(c_backtrace) 29ENDPROC(c_backtrace)
35#else 30#else
36 stmfd sp!, {r4 - r8, lr} @ Save an extra register so we have a location... 31 stmfd sp!, {r4 - r8, lr} @ Save an extra register so we have a location...
@@ -107,7 +102,6 @@ for_each_frame: tst frame, mask @ Check for address exceptions
107 mov r1, frame 102 mov r1, frame
108 bl printk 103 bl printk
109no_frame: ldmfd sp!, {r4 - r8, pc} 104no_frame: ldmfd sp!, {r4 - r8, pc}
110ENDPROC(__backtrace)
111ENDPROC(c_backtrace) 105ENDPROC(c_backtrace)
112 106
113 .pushsection __ex_table,"a" 107 .pushsection __ex_table,"a"
diff --git a/arch/arm/lib/div64.S b/arch/arm/lib/div64.S
index faa7748142d..e55c4842c29 100644
--- a/arch/arm/lib/div64.S
+++ b/arch/arm/lib/div64.S
@@ -13,6 +13,7 @@
13 */ 13 */
14 14
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <asm/unwind.h>
16 17
17#ifdef __ARMEB__ 18#ifdef __ARMEB__
18#define xh r0 19#define xh r0
@@ -44,6 +45,7 @@
44 */ 45 */
45 46
46ENTRY(__do_div64) 47ENTRY(__do_div64)
48UNWIND(.fnstart)
47 49
48 @ Test for easy paths first. 50 @ Test for easy paths first.
49 subs ip, r4, #1 51 subs ip, r4, #1
@@ -189,7 +191,12 @@ ENTRY(__do_div64)
189 moveq yh, xh 191 moveq yh, xh
190 moveq xh, #0 192 moveq xh, #0
191 moveq pc, lr 193 moveq pc, lr
194UNWIND(.fnend)
192 195
196UNWIND(.fnstart)
197UNWIND(.pad #4)
198UNWIND(.save {lr})
199Ldiv0_64:
193 @ Division by 0: 200 @ Division by 0:
194 str lr, [sp, #-8]! 201 str lr, [sp, #-8]!
195 bl __div0 202 bl __div0
@@ -200,4 +207,5 @@ ENTRY(__do_div64)
200 mov xh, #0 207 mov xh, #0
201 ldr pc, [sp], #8 208 ldr pc, [sp], #8
202 209
210UNWIND(.fnend)
203ENDPROC(__do_div64) 211ENDPROC(__do_div64)
diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c
index 8b9b13649f8..025f742dd4d 100644
--- a/arch/arm/lib/uaccess_with_memcpy.c
+++ b/arch/arm/lib/uaccess_with_memcpy.c
@@ -17,6 +17,7 @@
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/hardirq.h> /* for in_atomic() */ 18#include <linux/hardirq.h> /* for in_atomic() */
19#include <linux/gfp.h> 19#include <linux/gfp.h>
20#include <linux/highmem.h>
20#include <asm/current.h> 21#include <asm/current.h>
21#include <asm/page.h> 22#include <asm/page.h>
22 23
diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot
index 3462b815054..9ab5a3e5f4f 100644
--- a/arch/arm/mach-at91/Makefile.boot
+++ b/arch/arm/mach-at91/Makefile.boot
@@ -4,15 +4,15 @@
4# INITRD_PHYS must be in RAM 4# INITRD_PHYS must be in RAM
5 5
6ifeq ($(CONFIG_ARCH_AT91CAP9),y) 6ifeq ($(CONFIG_ARCH_AT91CAP9),y)
7 zreladdr-y := 0x70008000 7 zreladdr-y += 0x70008000
8params_phys-y := 0x70000100 8params_phys-y := 0x70000100
9initrd_phys-y := 0x70410000 9initrd_phys-y := 0x70410000
10else ifeq ($(CONFIG_ARCH_AT91SAM9G45),y) 10else ifeq ($(CONFIG_ARCH_AT91SAM9G45),y)
11 zreladdr-y := 0x70008000 11 zreladdr-y += 0x70008000
12params_phys-y := 0x70000100 12params_phys-y := 0x70000100
13initrd_phys-y := 0x70410000 13initrd_phys-y := 0x70410000
14else 14else
15 zreladdr-y := 0x20008000 15 zreladdr-y += 0x20008000
16params_phys-y := 0x20000100 16params_phys-y := 0x20000100
17initrd_phys-y := 0x20410000 17initrd_phys-y := 0x20410000
18endif 18endif
diff --git a/arch/arm/mach-bcmring/Kconfig b/arch/arm/mach-bcmring/Kconfig
index 457b4384913..9170d16dca5 100644
--- a/arch/arm/mach-bcmring/Kconfig
+++ b/arch/arm/mach-bcmring/Kconfig
@@ -17,5 +17,3 @@ config BCM_ZRELADDR
17 hex "Compressed ZREL ADDR" 17 hex "Compressed ZREL ADDR"
18 18
19endmenu 19endmenu
20
21# source "drivers/char/bcmring/Kconfig"
diff --git a/arch/arm/mach-bcmring/Makefile.boot b/arch/arm/mach-bcmring/Makefile.boot
index fb53b283beb..aef2467757f 100644
--- a/arch/arm/mach-bcmring/Makefile.boot
+++ b/arch/arm/mach-bcmring/Makefile.boot
@@ -1,6 +1,6 @@
1# Address where decompressor will be written and eventually executed. 1# Address where decompressor will be written and eventually executed.
2# 2#
3# default to SDRAM 3# default to SDRAM
4zreladdr-y := $(CONFIG_BCM_ZRELADDR) 4zreladdr-y += $(CONFIG_BCM_ZRELADDR)
5params_phys-y := 0x00000800 5params_phys-y := 0x00000800
6 6
diff --git a/arch/arm/mach-bcmring/arch.c b/arch/arm/mach-bcmring/arch.c
index a604b9ebb50..31a143592c8 100644
--- a/arch/arm/mach-bcmring/arch.c
+++ b/arch/arm/mach-bcmring/arch.c
@@ -136,8 +136,8 @@ static void __init bcmring_init_machine(void)
136* 136*
137*****************************************************************************/ 137*****************************************************************************/
138 138
139static void __init bcmring_fixup(struct machine_desc *desc, 139static void __init bcmring_fixup(struct tag *t, char **cmdline,
140 struct tag *t, char **cmdline, struct meminfo *mi) { 140 struct meminfo *mi) {
141#ifdef CONFIG_BLK_DEV_INITRD 141#ifdef CONFIG_BLK_DEV_INITRD
142 printk(KERN_NOTICE "bcmring_fixup\n"); 142 printk(KERN_NOTICE "bcmring_fixup\n");
143 t->hdr.tag = ATAG_CORE; 143 t->hdr.tag = ATAG_CORE;
diff --git a/arch/arm/mach-bcmring/irq.c b/arch/arm/mach-bcmring/irq.c
index c48feaf4e8e..437fa683bcb 100644
--- a/arch/arm/mach-bcmring/irq.c
+++ b/arch/arm/mach-bcmring/irq.c
@@ -20,7 +20,6 @@
20#include <linux/stddef.h> 20#include <linux/stddef.h>
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/timer.h> 22#include <linux/timer.h>
23#include <linux/version.h>
24#include <linux/io.h> 23#include <linux/io.h>
25 24
26#include <mach/hardware.h> 25#include <mach/hardware.h>
diff --git a/arch/arm/mach-bcmring/timer.c b/arch/arm/mach-bcmring/timer.c
index 2d415d2a8e6..af9c3d7e2a0 100644
--- a/arch/arm/mach-bcmring/timer.c
+++ b/arch/arm/mach-bcmring/timer.c
@@ -12,7 +12,6 @@
12* consent. 12* consent.
13*****************************************************************************/ 13*****************************************************************************/
14 14
15#include <linux/version.h>
16#include <linux/types.h> 15#include <linux/types.h>
17#include <linux/module.h> 16#include <linux/module.h>
18#include <csp/tmrHw.h> 17#include <csp/tmrHw.h>
diff --git a/arch/arm/mach-clps711x/Makefile.boot b/arch/arm/mach-clps711x/Makefile.boot
index a51fcef64fe..9398e859b5a 100644
--- a/arch/arm/mach-clps711x/Makefile.boot
+++ b/arch/arm/mach-clps711x/Makefile.boot
@@ -1,5 +1,5 @@
1# The standard locations for stuff on CLPS711x type processors 1# The standard locations for stuff on CLPS711x type processors
2 zreladdr-y := 0xc0028000 2 zreladdr-y += 0xc0028000
3params_phys-y := 0xc0000100 3params_phys-y := 0xc0000100
4# Should probably have some agreement on these... 4# Should probably have some agreement on these...
5initrd_phys-$(CONFIG_ARCH_P720T) := 0xc0400000 5initrd_phys-$(CONFIG_ARCH_P720T) := 0xc0400000
diff --git a/arch/arm/mach-clps711x/clep7312.c b/arch/arm/mach-clps711x/clep7312.c
index 67b5abb4a60..0a2e74feb24 100644
--- a/arch/arm/mach-clps711x/clep7312.c
+++ b/arch/arm/mach-clps711x/clep7312.c
@@ -26,8 +26,7 @@
26#include "common.h" 26#include "common.h"
27 27
28static void __init 28static void __init
29fixup_clep7312(struct machine_desc *desc, struct tag *tags, 29fixup_clep7312(struct tag *tags, char **cmdline, struct meminfo *mi)
30 char **cmdline, struct meminfo *mi)
31{ 30{
32 mi->nr_banks=1; 31 mi->nr_banks=1;
33 mi->bank[0].start = 0xc0000000; 32 mi->bank[0].start = 0xc0000000;
diff --git a/arch/arm/mach-clps711x/edb7211-arch.c b/arch/arm/mach-clps711x/edb7211-arch.c
index 98ca5b2e940..725a7a54ba4 100644
--- a/arch/arm/mach-clps711x/edb7211-arch.c
+++ b/arch/arm/mach-clps711x/edb7211-arch.c
@@ -37,8 +37,7 @@ static void __init edb7211_reserve(void)
37} 37}
38 38
39static void __init 39static void __init
40fixup_edb7211(struct machine_desc *desc, struct tag *tags, 40fixup_edb7211(struct tag *tags, char **cmdline, struct meminfo *mi)
41 char **cmdline, struct meminfo *mi)
42{ 41{
43 /* 42 /*
44 * Bank start addresses are not present in the information 43 * Bank start addresses are not present in the information
diff --git a/arch/arm/mach-clps711x/fortunet.c b/arch/arm/mach-clps711x/fortunet.c
index b1cb479e71e..1947b30f9b8 100644
--- a/arch/arm/mach-clps711x/fortunet.c
+++ b/arch/arm/mach-clps711x/fortunet.c
@@ -57,8 +57,7 @@ typedef struct tag_IMAGE_PARAMS
57#define IMAGE_PARAMS_PHYS 0xC01F0000 57#define IMAGE_PARAMS_PHYS 0xC01F0000
58 58
59static void __init 59static void __init
60fortunet_fixup(struct machine_desc *desc, struct tag *tags, 60fortunet_fixup(struct tag *tags, char **cmdline, struct meminfo *mi)
61 char **cmdline, struct meminfo *mi)
62{ 61{
63 IMAGE_PARAMS *ip = phys_to_virt(IMAGE_PARAMS_PHYS); 62 IMAGE_PARAMS *ip = phys_to_virt(IMAGE_PARAMS_PHYS);
64 *cmdline = phys_to_virt(ip->command_line); 63 *cmdline = phys_to_virt(ip->command_line);
diff --git a/arch/arm/mach-clps711x/p720t.c b/arch/arm/mach-clps711x/p720t.c
index cefbce0480b..3f796e0d328 100644
--- a/arch/arm/mach-clps711x/p720t.c
+++ b/arch/arm/mach-clps711x/p720t.c
@@ -56,8 +56,7 @@ static struct map_desc p720t_io_desc[] __initdata = {
56}; 56};
57 57
58static void __init 58static void __init
59fixup_p720t(struct machine_desc *desc, struct tag *tag, 59fixup_p720t(struct tag *tag, char **cmdline, struct meminfo *mi)
60 char **cmdline, struct meminfo *mi)
61{ 60{
62 /* 61 /*
63 * Our bootloader doesn't setup any tags (yet). 62 * Our bootloader doesn't setup any tags (yet).
diff --git a/arch/arm/mach-cns3xxx/Makefile.boot b/arch/arm/mach-cns3xxx/Makefile.boot
index 77701286522..d079de0b6e3 100644
--- a/arch/arm/mach-cns3xxx/Makefile.boot
+++ b/arch/arm/mach-cns3xxx/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00C00000 3initrd_phys-y := 0x00C00000
diff --git a/arch/arm/mach-davinci/Makefile.boot b/arch/arm/mach-davinci/Makefile.boot
index db97ef2c647..04a6c4e67b1 100644
--- a/arch/arm/mach-davinci/Makefile.boot
+++ b/arch/arm/mach-davinci/Makefile.boot
@@ -2,12 +2,12 @@ ifeq ($(CONFIG_ARCH_DAVINCI_DA8XX),y)
2ifeq ($(CONFIG_ARCH_DAVINCI_DMx),y) 2ifeq ($(CONFIG_ARCH_DAVINCI_DMx),y)
3$(error Cannot enable DaVinci and DA8XX platforms concurrently) 3$(error Cannot enable DaVinci and DA8XX platforms concurrently)
4else 4else
5 zreladdr-y := 0xc0008000 5 zreladdr-y += 0xc0008000
6params_phys-y := 0xc0000100 6params_phys-y := 0xc0000100
7initrd_phys-y := 0xc0800000 7initrd_phys-y := 0xc0800000
8endif 8endif
9else 9else
10 zreladdr-y := 0x80008000 10 zreladdr-y += 0x80008000
11params_phys-y := 0x80000100 11params_phys-y := 0x80000100
12initrd_phys-y := 0x80800000 12initrd_phys-y := 0x80800000
13endif 13endif
diff --git a/arch/arm/mach-dove/Makefile.boot b/arch/arm/mach-dove/Makefile.boot
index 67039c3e0c4..760a0efe758 100644
--- a/arch/arm/mach-dove/Makefile.boot
+++ b/arch/arm/mach-dove/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-ebsa110/Makefile.boot b/arch/arm/mach-ebsa110/Makefile.boot
index 23212604493..83cf07c38ad 100644
--- a/arch/arm/mach-ebsa110/Makefile.boot
+++ b/arch/arm/mach-ebsa110/Makefile.boot
@@ -1,4 +1,4 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000400 2params_phys-y := 0x00000400
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4 4
diff --git a/arch/arm/mach-ebsa110/include/mach/io.h b/arch/arm/mach-ebsa110/include/mach/io.h
index f68daa632af..44679db672f 100644
--- a/arch/arm/mach-ebsa110/include/mach/io.h
+++ b/arch/arm/mach-ebsa110/include/mach/io.h
@@ -13,8 +13,6 @@
13#ifndef __ASM_ARM_ARCH_IO_H 13#ifndef __ASM_ARM_ARCH_IO_H
14#define __ASM_ARM_ARCH_IO_H 14#define __ASM_ARM_ARCH_IO_H
15 15
16#define IO_SPACE_LIMIT 0xffff
17
18u8 __inb8(unsigned int port); 16u8 __inb8(unsigned int port);
19void __outb8(u8 val, unsigned int port); 17void __outb8(u8 val, unsigned int port);
20 18
diff --git a/arch/arm/mach-ep93xx/Makefile.boot b/arch/arm/mach-ep93xx/Makefile.boot
index 0ad33f15c62..d3113a71cb4 100644
--- a/arch/arm/mach-ep93xx/Makefile.boot
+++ b/arch/arm/mach-ep93xx/Makefile.boot
@@ -1,14 +1,14 @@
1 zreladdr-$(CONFIG_EP93XX_SDCE3_SYNC_PHYS_OFFSET) := 0x00008000 1 zreladdr-$(CONFIG_EP93XX_SDCE3_SYNC_PHYS_OFFSET) += 0x00008000
2params_phys-$(CONFIG_EP93XX_SDCE3_SYNC_PHYS_OFFSET) := 0x00000100 2params_phys-$(CONFIG_EP93XX_SDCE3_SYNC_PHYS_OFFSET) := 0x00000100
3 3
4 zreladdr-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) := 0xc0008000 4 zreladdr-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) += 0xc0008000
5params_phys-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) := 0xc0000100 5params_phys-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) := 0xc0000100
6 6
7 zreladdr-$(CONFIG_EP93XX_SDCE1_PHYS_OFFSET) := 0xd0008000 7 zreladdr-$(CONFIG_EP93XX_SDCE1_PHYS_OFFSET) += 0xd0008000
8params_phys-$(CONFIG_EP93XX_SDCE1_PHYS_OFFSET) := 0xd0000100 8params_phys-$(CONFIG_EP93XX_SDCE1_PHYS_OFFSET) := 0xd0000100
9 9
10 zreladdr-$(CONFIG_EP93XX_SDCE2_PHYS_OFFSET) := 0xe0008000 10 zreladdr-$(CONFIG_EP93XX_SDCE2_PHYS_OFFSET) += 0xe0008000
11params_phys-$(CONFIG_EP93XX_SDCE2_PHYS_OFFSET) := 0xe0000100 11params_phys-$(CONFIG_EP93XX_SDCE2_PHYS_OFFSET) := 0xe0000100
12 12
13 zreladdr-$(CONFIG_EP93XX_SDCE3_ASYNC_PHYS_OFFSET) := 0xf0008000 13 zreladdr-$(CONFIG_EP93XX_SDCE3_ASYNC_PHYS_OFFSET) += 0xf0008000
14params_phys-$(CONFIG_EP93XX_SDCE3_ASYNC_PHYS_OFFSET) := 0xf0000100 14params_phys-$(CONFIG_EP93XX_SDCE3_ASYNC_PHYS_OFFSET) := 0xf0000100
diff --git a/arch/arm/mach-exynos4/Kconfig b/arch/arm/mach-exynos4/Kconfig
index 0c77ab99fa1..fc1f92dfbea 100644
--- a/arch/arm/mach-exynos4/Kconfig
+++ b/arch/arm/mach-exynos4/Kconfig
@@ -12,6 +12,7 @@ if ARCH_EXYNOS4
12config CPU_EXYNOS4210 12config CPU_EXYNOS4210
13 bool 13 bool
14 select S3C_PL330_DMA 14 select S3C_PL330_DMA
15 select ARM_CPU_SUSPEND if PM
15 help 16 help
16 Enable EXYNOS4210 CPU support 17 Enable EXYNOS4210 CPU support
17 18
diff --git a/arch/arm/mach-exynos4/Makefile.boot b/arch/arm/mach-exynos4/Makefile.boot
index d65956ffb43..b9862e22bf1 100644
--- a/arch/arm/mach-exynos4/Makefile.boot
+++ b/arch/arm/mach-exynos4/Makefile.boot
@@ -1,2 +1,2 @@
1 zreladdr-y := 0x40008000 1 zreladdr-y += 0x40008000
2params_phys-y := 0x40000100 2params_phys-y := 0x40000100
diff --git a/arch/arm/mach-exynos4/platsmp.c b/arch/arm/mach-exynos4/platsmp.c
index df6ef1b2f98..0c90896ad9a 100644
--- a/arch/arm/mach-exynos4/platsmp.c
+++ b/arch/arm/mach-exynos4/platsmp.c
@@ -193,12 +193,10 @@ void __init smp_init_cpus(void)
193 ncores = scu_base ? scu_get_core_count(scu_base) : 1; 193 ncores = scu_base ? scu_get_core_count(scu_base) : 1;
194 194
195 /* sanity check */ 195 /* sanity check */
196 if (ncores > NR_CPUS) { 196 if (ncores > nr_cpu_ids) {
197 printk(KERN_WARNING 197 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
198 "EXYNOS4: no. of cores (%d) greater than configured " 198 ncores, nr_cpu_ids);
199 "maximum of %d - clipping\n", 199 ncores = nr_cpu_ids;
200 ncores, NR_CPUS);
201 ncores = NR_CPUS;
202 } 200 }
203 201
204 for (i = 0; i < ncores; i++) 202 for (i = 0; i < ncores; i++)
diff --git a/arch/arm/mach-footbridge/Kconfig b/arch/arm/mach-footbridge/Kconfig
index c8e7afcf14e..f643ef819da 100644
--- a/arch/arm/mach-footbridge/Kconfig
+++ b/arch/arm/mach-footbridge/Kconfig
@@ -4,8 +4,8 @@ menu "Footbridge Implementations"
4 4
5config ARCH_CATS 5config ARCH_CATS
6 bool "CATS" 6 bool "CATS"
7 select CLKSRC_I8253
8 select CLKEVT_I8253 7 select CLKEVT_I8253
8 select CLKSRC_I8253
9 select FOOTBRIDGE_HOST 9 select FOOTBRIDGE_HOST
10 select ISA 10 select ISA
11 select ISA_DMA 11 select ISA_DMA
@@ -61,8 +61,8 @@ config ARCH_EBSA285_HOST
61 61
62config ARCH_NETWINDER 62config ARCH_NETWINDER
63 bool "NetWinder" 63 bool "NetWinder"
64 select CLKSRC_I8253
65 select CLKEVT_I8253 64 select CLKEVT_I8253
65 select CLKSRC_I8253
66 select FOOTBRIDGE_HOST 66 select FOOTBRIDGE_HOST
67 select ISA 67 select ISA
68 select ISA_DMA 68 select ISA_DMA
diff --git a/arch/arm/mach-footbridge/Makefile.boot b/arch/arm/mach-footbridge/Makefile.boot
index c7e75acfe6c..ff0a4b5b0a8 100644
--- a/arch/arm/mach-footbridge/Makefile.boot
+++ b/arch/arm/mach-footbridge/Makefile.boot
@@ -1,4 +1,4 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4 4
diff --git a/arch/arm/mach-footbridge/cats-hw.c b/arch/arm/mach-footbridge/cats-hw.c
index 5b1a8db779b..206ff2f39d6 100644
--- a/arch/arm/mach-footbridge/cats-hw.c
+++ b/arch/arm/mach-footbridge/cats-hw.c
@@ -76,8 +76,7 @@ __initcall(cats_hw_init);
76 * hard reboots fail on early boards. 76 * hard reboots fail on early boards.
77 */ 77 */
78static void __init 78static void __init
79fixup_cats(struct machine_desc *desc, struct tag *tags, 79fixup_cats(struct tag *tags, char **cmdline, struct meminfo *mi)
80 char **cmdline, struct meminfo *mi)
81{ 80{
82 screen_info.orig_video_lines = 25; 81 screen_info.orig_video_lines = 25;
83 screen_info.orig_video_points = 16; 82 screen_info.orig_video_points = 16;
diff --git a/arch/arm/mach-footbridge/include/mach/hardware.h b/arch/arm/mach-footbridge/include/mach/hardware.h
index 15d54981674..e3d6ccac216 100644
--- a/arch/arm/mach-footbridge/include/mach/hardware.h
+++ b/arch/arm/mach-footbridge/include/mach/hardware.h
@@ -93,7 +93,7 @@
93#define CPLD_FLASH_WR_ENABLE 1 93#define CPLD_FLASH_WR_ENABLE 1
94 94
95#ifndef __ASSEMBLY__ 95#ifndef __ASSEMBLY__
96extern spinlock_t nw_gpio_lock; 96extern raw_spinlock_t nw_gpio_lock;
97extern void nw_gpio_modify_op(unsigned int mask, unsigned int set); 97extern void nw_gpio_modify_op(unsigned int mask, unsigned int set);
98extern void nw_gpio_modify_io(unsigned int mask, unsigned int in); 98extern void nw_gpio_modify_io(unsigned int mask, unsigned int in);
99extern unsigned int nw_gpio_read(void); 99extern unsigned int nw_gpio_read(void);
diff --git a/arch/arm/mach-footbridge/include/mach/io.h b/arch/arm/mach-footbridge/include/mach/io.h
index 32e4cc397c2..15a70396c27 100644
--- a/arch/arm/mach-footbridge/include/mach/io.h
+++ b/arch/arm/mach-footbridge/include/mach/io.h
@@ -23,8 +23,6 @@
23#define PCIO_SIZE 0x00100000 23#define PCIO_SIZE 0x00100000
24#define PCIO_BASE MMU_IO(0xff000000, 0x7c000000) 24#define PCIO_BASE MMU_IO(0xff000000, 0x7c000000)
25 25
26#define IO_SPACE_LIMIT 0xffff
27
28/* 26/*
29 * Translation of various region addresses to virtual addresses 27 * Translation of various region addresses to virtual addresses
30 */ 28 */
diff --git a/arch/arm/mach-footbridge/netwinder-hw.c b/arch/arm/mach-footbridge/netwinder-hw.c
index 06e514f372d..0f7aeff486c 100644
--- a/arch/arm/mach-footbridge/netwinder-hw.c
+++ b/arch/arm/mach-footbridge/netwinder-hw.c
@@ -68,7 +68,7 @@ static inline void wb977_ww(int reg, int val)
68/* 68/*
69 * 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
70 */ 70 */
71DEFINE_SPINLOCK(nw_gpio_lock); 71DEFINE_RAW_SPINLOCK(nw_gpio_lock);
72EXPORT_SYMBOL(nw_gpio_lock); 72EXPORT_SYMBOL(nw_gpio_lock);
73 73
74static unsigned int current_gpio_op; 74static unsigned int current_gpio_op;
@@ -327,9 +327,9 @@ static inline void wb977_init_gpio(void)
327 /* 327 /*
328 * Set Group1/Group2 outputs 328 * Set Group1/Group2 outputs
329 */ 329 */
330 spin_lock_irqsave(&nw_gpio_lock, flags); 330 raw_spin_lock_irqsave(&nw_gpio_lock, flags);
331 nw_gpio_modify_op(-1, GPIO_RED_LED | GPIO_FAN); 331 nw_gpio_modify_op(-1, GPIO_RED_LED | GPIO_FAN);
332 spin_unlock_irqrestore(&nw_gpio_lock, flags); 332 raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
333} 333}
334 334
335/* 335/*
@@ -390,9 +390,9 @@ static void __init cpld_init(void)
390{ 390{
391 unsigned long flags; 391 unsigned long flags;
392 392
393 spin_lock_irqsave(&nw_gpio_lock, flags); 393 raw_spin_lock_irqsave(&nw_gpio_lock, flags);
394 nw_cpld_modify(-1, CPLD_UNMUTE | CPLD_7111_DISABLE); 394 nw_cpld_modify(-1, CPLD_UNMUTE | CPLD_7111_DISABLE);
395 spin_unlock_irqrestore(&nw_gpio_lock, flags); 395 raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
396} 396}
397 397
398static unsigned char rwa_unlock[] __initdata = 398static unsigned char rwa_unlock[] __initdata =
@@ -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(&nw_gpio_lock, flags); 619 raw_spin_lock_irqsave(&nw_gpio_lock, flags);
620 nw_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(&nw_gpio_lock, flags); 621 raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
622 } 622 }
623 return 0; 623 return 0;
624} 624}
@@ -631,8 +631,7 @@ __initcall(nw_hw_init);
631 * the parameter page. 631 * the parameter page.
632 */ 632 */
633static void __init 633static void __init
634fixup_netwinder(struct machine_desc *desc, struct tag *tags, 634fixup_netwinder(struct tag *tags, char **cmdline, struct meminfo *mi)
635 char **cmdline, struct meminfo *mi)
636{ 635{
637#ifdef CONFIG_ISAPNP 636#ifdef CONFIG_ISAPNP
638 extern int isapnp_disable; 637 extern int isapnp_disable;
diff --git a/arch/arm/mach-footbridge/netwinder-leds.c b/arch/arm/mach-footbridge/netwinder-leds.c
index 00269fe0be8..e57102e871f 100644
--- a/arch/arm/mach-footbridge/netwinder-leds.c
+++ b/arch/arm/mach-footbridge/netwinder-leds.c
@@ -31,13 +31,13 @@
31static char led_state; 31static char led_state;
32static char hw_led_state; 32static char hw_led_state;
33 33
34static DEFINE_SPINLOCK(leds_lock); 34static DEFINE_RAW_SPINLOCK(leds_lock);
35 35
36static void netwinder_leds_event(led_event_t evt) 36static void netwinder_leds_event(led_event_t evt)
37{ 37{
38 unsigned long flags; 38 unsigned long flags;
39 39
40 spin_lock_irqsave(&leds_lock, flags); 40 raw_spin_lock_irqsave(&leds_lock, flags);
41 41
42 switch (evt) { 42 switch (evt) {
43 case led_start: 43 case led_start:
@@ -117,12 +117,12 @@ static void netwinder_leds_event(led_event_t evt)
117 break; 117 break;
118 } 118 }
119 119
120 spin_unlock_irqrestore(&leds_lock, flags); 120 raw_spin_unlock_irqrestore(&leds_lock, flags);
121 121
122 if (led_state & LED_STATE_ENABLED) { 122 if (led_state & LED_STATE_ENABLED) {
123 spin_lock_irqsave(&nw_gpio_lock, flags); 123 raw_spin_lock_irqsave(&nw_gpio_lock, flags);
124 nw_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);
125 spin_unlock_irqrestore(&nw_gpio_lock, flags); 125 raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
126 } 126 }
127} 127}
128 128
diff --git a/arch/arm/mach-gemini/Makefile.boot b/arch/arm/mach-gemini/Makefile.boot
index 22a52c228d9..683f52b20e3 100644
--- a/arch/arm/mach-gemini/Makefile.boot
+++ b/arch/arm/mach-gemini/Makefile.boot
@@ -1,9 +1,9 @@
1ifeq ($(CONFIG_GEMINI_MEM_SWAP),y) 1ifeq ($(CONFIG_GEMINI_MEM_SWAP),y)
2 zreladdr-y := 0x00008000 2 zreladdr-y += 0x00008000
3params_phys-y := 0x00000100 3params_phys-y := 0x00000100
4initrd_phys-y := 0x00800000 4initrd_phys-y := 0x00800000
5else 5else
6 zreladdr-y := 0x10008000 6 zreladdr-y += 0x10008000
7params_phys-y := 0x10000100 7params_phys-y := 0x10000100
8initrd_phys-y := 0x10800000 8initrd_phys-y := 0x10800000
9endif 9endif
diff --git a/arch/arm/mach-h720x/Makefile.boot b/arch/arm/mach-h720x/Makefile.boot
index 52984017bd9..d875a7094df 100644
--- a/arch/arm/mach-h720x/Makefile.boot
+++ b/arch/arm/mach-h720x/Makefile.boot
@@ -1,2 +1,2 @@
1 zreladdr-$(CONFIG_ARCH_H720X) := 0x40008000 1 zreladdr-$(CONFIG_ARCH_H720X) += 0x40008000
2 2
diff --git a/arch/arm/mach-imx/Makefile.boot b/arch/arm/mach-imx/Makefile.boot
index ebee18b3884..dbe61201bcd 100644
--- a/arch/arm/mach-imx/Makefile.boot
+++ b/arch/arm/mach-imx/Makefile.boot
@@ -1,19 +1,19 @@
1zreladdr-$(CONFIG_ARCH_MX1) := 0x08008000 1zreladdr-$(CONFIG_ARCH_MX1) += 0x08008000
2params_phys-$(CONFIG_ARCH_MX1) := 0x08000100 2params_phys-$(CONFIG_ARCH_MX1) := 0x08000100
3initrd_phys-$(CONFIG_ARCH_MX1) := 0x08800000 3initrd_phys-$(CONFIG_ARCH_MX1) := 0x08800000
4 4
5zreladdr-$(CONFIG_MACH_MX21) := 0xC0008000 5zreladdr-$(CONFIG_MACH_MX21) += 0xC0008000
6params_phys-$(CONFIG_MACH_MX21) := 0xC0000100 6params_phys-$(CONFIG_MACH_MX21) := 0xC0000100
7initrd_phys-$(CONFIG_MACH_MX21) := 0xC0800000 7initrd_phys-$(CONFIG_MACH_MX21) := 0xC0800000
8 8
9zreladdr-$(CONFIG_ARCH_MX25) := 0x80008000 9zreladdr-$(CONFIG_ARCH_MX25) += 0x80008000
10params_phys-$(CONFIG_ARCH_MX25) := 0x80000100 10params_phys-$(CONFIG_ARCH_MX25) := 0x80000100
11initrd_phys-$(CONFIG_ARCH_MX25) := 0x80800000 11initrd_phys-$(CONFIG_ARCH_MX25) := 0x80800000
12 12
13zreladdr-$(CONFIG_MACH_MX27) := 0xA0008000 13zreladdr-$(CONFIG_MACH_MX27) += 0xA0008000
14params_phys-$(CONFIG_MACH_MX27) := 0xA0000100 14params_phys-$(CONFIG_MACH_MX27) := 0xA0000100
15initrd_phys-$(CONFIG_MACH_MX27) := 0xA0800000 15initrd_phys-$(CONFIG_MACH_MX27) := 0xA0800000
16 16
17zreladdr-$(CONFIG_ARCH_MX3) := 0x80008000 17zreladdr-$(CONFIG_ARCH_MX3) += 0x80008000
18params_phys-$(CONFIG_ARCH_MX3) := 0x80000100 18params_phys-$(CONFIG_ARCH_MX3) := 0x80000100
19initrd_phys-$(CONFIG_ARCH_MX3) := 0x80800000 19initrd_phys-$(CONFIG_ARCH_MX3) := 0x80800000
diff --git a/arch/arm/mach-integrator/Makefile.boot b/arch/arm/mach-integrator/Makefile.boot
index c7e75acfe6c..ff0a4b5b0a8 100644
--- a/arch/arm/mach-integrator/Makefile.boot
+++ b/arch/arm/mach-integrator/Makefile.boot
@@ -1,4 +1,4 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4 4
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index 77315b99568..4b38e13667a 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -126,6 +126,10 @@ static struct clk_lookup lookups[] = {
126 { /* Bus clock */ 126 { /* Bus clock */
127 .con_id = "apb_pclk", 127 .con_id = "apb_pclk",
128 .clk = &dummy_apb_pclk, 128 .clk = &dummy_apb_pclk,
129 }, {
130 /* Integrator/AP timer frequency */
131 .dev_id = "ap_timer",
132 .clk = &clk24mhz,
129 }, { /* UART0 */ 133 }, { /* UART0 */
130 .dev_id = "mb:16", 134 .dev_id = "mb:16",
131 .clk = &uartclk, 135 .clk = &uartclk,
@@ -205,7 +209,7 @@ static struct amba_pl010_data integrator_uart_data = {
205 209
206#define CM_CTRL IO_ADDRESS(INTEGRATOR_HDR_CTRL) 210#define CM_CTRL IO_ADDRESS(INTEGRATOR_HDR_CTRL)
207 211
208static DEFINE_SPINLOCK(cm_lock); 212static DEFINE_RAW_SPINLOCK(cm_lock);
209 213
210/** 214/**
211 * cm_control - update the CM_CTRL register. 215 * cm_control - update the CM_CTRL register.
@@ -217,10 +221,10 @@ void cm_control(u32 mask, u32 set)
217 unsigned long flags; 221 unsigned long flags;
218 u32 val; 222 u32 val;
219 223
220 spin_lock_irqsave(&cm_lock, flags); 224 raw_spin_lock_irqsave(&cm_lock, flags);
221 val = readl(CM_CTRL) & ~mask; 225 val = readl(CM_CTRL) & ~mask;
222 writel(val | set, CM_CTRL); 226 writel(val | set, CM_CTRL);
223 spin_unlock_irqrestore(&cm_lock, flags); 227 raw_spin_unlock_irqrestore(&cm_lock, flags);
224} 228}
225 229
226EXPORT_SYMBOL(cm_control); 230EXPORT_SYMBOL(cm_control);
diff --git a/arch/arm/mach-integrator/include/mach/io.h b/arch/arm/mach-integrator/include/mach/io.h
index f21bb5493dd..37beed3fa3e 100644
--- a/arch/arm/mach-integrator/include/mach/io.h
+++ b/arch/arm/mach-integrator/include/mach/io.h
@@ -20,8 +20,6 @@
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#define IO_SPACE_LIMIT 0xffff
24
25/* 23/*
26 * WARNING: this has to mirror definitions in platform.h 24 * WARNING: this has to mirror definitions in platform.h
27 */ 25 */
diff --git a/arch/arm/mach-integrator/include/mach/platform.h b/arch/arm/mach-integrator/include/mach/platform.h
index 5e6ea5cfea6..ec467baade0 100644
--- a/arch/arm/mach-integrator/include/mach/platform.h
+++ b/arch/arm/mach-integrator/include/mach/platform.h
@@ -13,9 +13,6 @@
13 * along with this program; if not, write to the Free Software 13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 */ 15 */
16/* DO NOT EDIT!! - this file automatically generated
17 * from .s file by awk -f s2h.awk
18 */
19/************************************************************************** 16/**************************************************************************
20 * * Copyright © ARM Limited 1998. All rights reserved. 17 * * Copyright © ARM Limited 1998. All rights reserved.
21 * ***********************************************************************/ 18 * ***********************************************************************/
@@ -399,15 +396,6 @@
399#define INTEGRATOR_TIMER1_BASE (INTEGRATOR_CT_BASE + 0x100) 396#define INTEGRATOR_TIMER1_BASE (INTEGRATOR_CT_BASE + 0x100)
400#define INTEGRATOR_TIMER2_BASE (INTEGRATOR_CT_BASE + 0x200) 397#define INTEGRATOR_TIMER2_BASE (INTEGRATOR_CT_BASE + 0x200)
401 398
402#define TICKS_PER_uSEC 24
403
404/*
405 * These are useconds NOT ticks.
406 *
407 */
408#define mSEC_1 1000
409#define mSEC_10 (mSEC_1 * 10)
410
411#define INTEGRATOR_CSR_BASE 0x10000000 399#define INTEGRATOR_CSR_BASE 0x10000000
412#define INTEGRATOR_CSR_SIZE 0x10000000 400#define INTEGRATOR_CSR_SIZE 0x10000000
413 401
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index 8cdc730dcb3..f2119908a0b 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -32,6 +32,7 @@
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/io.h> 33#include <linux/io.h>
34#include <linux/mtd/physmap.h> 34#include <linux/mtd/physmap.h>
35#include <linux/clk.h>
35#include <video/vga.h> 36#include <video/vga.h>
36 37
37#include <mach/hardware.h> 38#include <mach/hardware.h>
@@ -322,27 +323,16 @@ static void __init ap_init(void)
322#define TIMER1_VA_BASE IO_ADDRESS(INTEGRATOR_TIMER1_BASE) 323#define TIMER1_VA_BASE IO_ADDRESS(INTEGRATOR_TIMER1_BASE)
323#define TIMER2_VA_BASE IO_ADDRESS(INTEGRATOR_TIMER2_BASE) 324#define TIMER2_VA_BASE IO_ADDRESS(INTEGRATOR_TIMER2_BASE)
324 325
325/*
326 * How long is the timer interval?
327 */
328#define TIMER_INTERVAL (TICKS_PER_uSEC * mSEC_10)
329#if TIMER_INTERVAL >= 0x100000
330#define TICKS2USECS(x) (256 * (x) / TICKS_PER_uSEC)
331#elif TIMER_INTERVAL >= 0x10000
332#define TICKS2USECS(x) (16 * (x) / TICKS_PER_uSEC)
333#else
334#define TICKS2USECS(x) ((x) / TICKS_PER_uSEC)
335#endif
336
337static unsigned long timer_reload; 326static unsigned long timer_reload;
338 327
339static void integrator_clocksource_init(u32 khz) 328static void integrator_clocksource_init(unsigned long inrate)
340{ 329{
341 void __iomem *base = (void __iomem *)TIMER2_VA_BASE; 330 void __iomem *base = (void __iomem *)TIMER2_VA_BASE;
342 u32 ctrl = TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC; 331 u32 ctrl = TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC;
332 unsigned long rate = inrate;
343 333
344 if (khz >= 1500) { 334 if (rate >= 1500000) {
345 khz /= 16; 335 rate /= 16;
346 ctrl |= TIMER_CTRL_DIV16; 336 ctrl |= TIMER_CTRL_DIV16;
347 } 337 }
348 338
@@ -350,7 +340,7 @@ static void integrator_clocksource_init(u32 khz)
350 writel(ctrl, base + TIMER_CTRL); 340 writel(ctrl, base + TIMER_CTRL);
351 341
352 clocksource_mmio_init(base + TIMER_VALUE, "timer2", 342 clocksource_mmio_init(base + TIMER_VALUE, "timer2",
353 khz * 1000, 200, 16, clocksource_mmio_readl_down); 343 rate, 200, 16, clocksource_mmio_readl_down);
354} 344}
355 345
356static void __iomem * const clkevt_base = (void __iomem *)TIMER1_VA_BASE; 346static void __iomem * const clkevt_base = (void __iomem *)TIMER1_VA_BASE;
@@ -374,15 +364,29 @@ static void clkevt_set_mode(enum clock_event_mode mode, struct clock_event_devic
374{ 364{
375 u32 ctrl = readl(clkevt_base + TIMER_CTRL) & ~TIMER_CTRL_ENABLE; 365 u32 ctrl = readl(clkevt_base + TIMER_CTRL) & ~TIMER_CTRL_ENABLE;
376 366
377 BUG_ON(mode == CLOCK_EVT_MODE_ONESHOT); 367 /* Disable timer */
368 writel(ctrl, clkevt_base + TIMER_CTRL);
378 369
379 if (mode == CLOCK_EVT_MODE_PERIODIC) { 370 switch (mode) {
380 writel(ctrl, clkevt_base + TIMER_CTRL); 371 case CLOCK_EVT_MODE_PERIODIC:
372 /* Enable the timer and start the periodic tick */
381 writel(timer_reload, clkevt_base + TIMER_LOAD); 373 writel(timer_reload, clkevt_base + TIMER_LOAD);
382 ctrl |= TIMER_CTRL_PERIODIC | TIMER_CTRL_ENABLE; 374 ctrl |= TIMER_CTRL_PERIODIC | TIMER_CTRL_ENABLE;
375 writel(ctrl, clkevt_base + TIMER_CTRL);
376 break;
377 case CLOCK_EVT_MODE_ONESHOT:
378 /* Leave the timer disabled, .set_next_event will enable it */
379 ctrl &= ~TIMER_CTRL_PERIODIC;
380 writel(ctrl, clkevt_base + TIMER_CTRL);
381 break;
382 case CLOCK_EVT_MODE_UNUSED:
383 case CLOCK_EVT_MODE_SHUTDOWN:
384 case CLOCK_EVT_MODE_RESUME:
385 default:
386 /* Just leave in disabled state */
387 break;
383 } 388 }
384 389
385 writel(ctrl, clkevt_base + TIMER_CTRL);
386} 390}
387 391
388static int clkevt_set_next_event(unsigned long next, struct clock_event_device *evt) 392static int clkevt_set_next_event(unsigned long next, struct clock_event_device *evt)
@@ -398,12 +402,10 @@ static int clkevt_set_next_event(unsigned long next, struct clock_event_device *
398 402
399static struct clock_event_device integrator_clockevent = { 403static struct clock_event_device integrator_clockevent = {
400 .name = "timer1", 404 .name = "timer1",
401 .shift = 34, 405 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
402 .features = CLOCK_EVT_FEAT_PERIODIC,
403 .set_mode = clkevt_set_mode, 406 .set_mode = clkevt_set_mode,
404 .set_next_event = clkevt_set_next_event, 407 .set_next_event = clkevt_set_next_event,
405 .rating = 300, 408 .rating = 300,
406 .cpumask = cpu_all_mask,
407}; 409};
408 410
409static struct irqaction integrator_timer_irq = { 411static struct irqaction integrator_timer_irq = {
@@ -413,29 +415,27 @@ static struct irqaction integrator_timer_irq = {
413 .dev_id = &integrator_clockevent, 415 .dev_id = &integrator_clockevent,
414}; 416};
415 417
416static void integrator_clockevent_init(u32 khz) 418static void integrator_clockevent_init(unsigned long inrate)
417{ 419{
418 struct clock_event_device *evt = &integrator_clockevent; 420 unsigned long rate = inrate;
419 unsigned int ctrl = 0; 421 unsigned int ctrl = 0;
420 422
421 if (khz * 1000 > 0x100000 * HZ) { 423 /* Calculate and program a divisor */
422 khz /= 256; 424 if (rate > 0x100000 * HZ) {
425 rate /= 256;
423 ctrl |= TIMER_CTRL_DIV256; 426 ctrl |= TIMER_CTRL_DIV256;
424 } else if (khz * 1000 > 0x10000 * HZ) { 427 } else if (rate > 0x10000 * HZ) {
425 khz /= 16; 428 rate /= 16;
426 ctrl |= TIMER_CTRL_DIV16; 429 ctrl |= TIMER_CTRL_DIV16;
427 } 430 }
428 431 timer_reload = rate / HZ;
429 timer_reload = khz * 1000 / HZ;
430 writel(ctrl, clkevt_base + TIMER_CTRL); 432 writel(ctrl, clkevt_base + TIMER_CTRL);
431 433
432 evt->irq = IRQ_TIMERINT1;
433 evt->mult = div_sc(khz, NSEC_PER_MSEC, evt->shift);
434 evt->max_delta_ns = clockevent_delta2ns(0xffff, evt);
435 evt->min_delta_ns = clockevent_delta2ns(0xf, evt);
436
437 setup_irq(IRQ_TIMERINT1, &integrator_timer_irq); 434 setup_irq(IRQ_TIMERINT1, &integrator_timer_irq);
438 clockevents_register_device(evt); 435 clockevents_config_and_register(&integrator_clockevent,
436 rate,
437 1,
438 0xffffU);
439} 439}
440 440
441/* 441/*
@@ -443,14 +443,20 @@ static void integrator_clockevent_init(u32 khz)
443 */ 443 */
444static void __init ap_init_timer(void) 444static void __init ap_init_timer(void)
445{ 445{
446 u32 khz = TICKS_PER_uSEC * 1000; 446 struct clk *clk;
447 unsigned long rate;
448
449 clk = clk_get_sys("ap_timer", NULL);
450 BUG_ON(IS_ERR(clk));
451 clk_enable(clk);
452 rate = clk_get_rate(clk);
447 453
448 writel(0, TIMER0_VA_BASE + TIMER_CTRL); 454 writel(0, TIMER0_VA_BASE + TIMER_CTRL);
449 writel(0, TIMER1_VA_BASE + TIMER_CTRL); 455 writel(0, TIMER1_VA_BASE + TIMER_CTRL);
450 writel(0, TIMER2_VA_BASE + TIMER_CTRL); 456 writel(0, TIMER2_VA_BASE + TIMER_CTRL);
451 457
452 integrator_clocksource_init(khz); 458 integrator_clocksource_init(rate);
453 integrator_clockevent_init(khz); 459 integrator_clockevent_init(rate);
454} 460}
455 461
456static struct sys_timer ap_timer = { 462static struct sys_timer ap_timer = {
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
index 11b86e5b71c..b4d8f8b8a08 100644
--- a/arch/arm/mach-integrator/pci_v3.c
+++ b/arch/arm/mach-integrator/pci_v3.c
@@ -163,7 +163,7 @@
163 * 7:2 register number 163 * 7:2 register number
164 * 164 *
165 */ 165 */
166static DEFINE_SPINLOCK(v3_lock); 166static DEFINE_RAW_SPINLOCK(v3_lock);
167 167
168#define PCI_BUS_NONMEM_START 0x00000000 168#define PCI_BUS_NONMEM_START 0x00000000
169#define PCI_BUS_NONMEM_SIZE SZ_256M 169#define PCI_BUS_NONMEM_SIZE SZ_256M
@@ -284,7 +284,7 @@ static int v3_read_config(struct pci_bus *bus, unsigned int devfn, int where,
284 unsigned long flags; 284 unsigned long flags;
285 u32 v; 285 u32 v;
286 286
287 spin_lock_irqsave(&v3_lock, flags); 287 raw_spin_lock_irqsave(&v3_lock, flags);
288 addr = v3_open_config_window(bus, devfn, where); 288 addr = v3_open_config_window(bus, devfn, where);
289 289
290 switch (size) { 290 switch (size) {
@@ -302,7 +302,7 @@ static int v3_read_config(struct pci_bus *bus, unsigned int devfn, int where,
302 } 302 }
303 303
304 v3_close_config_window(); 304 v3_close_config_window();
305 spin_unlock_irqrestore(&v3_lock, flags); 305 raw_spin_unlock_irqrestore(&v3_lock, flags);
306 306
307 *val = v; 307 *val = v;
308 return PCIBIOS_SUCCESSFUL; 308 return PCIBIOS_SUCCESSFUL;
@@ -314,7 +314,7 @@ static int v3_write_config(struct pci_bus *bus, unsigned int devfn, int where,
314 unsigned long addr; 314 unsigned long addr;
315 unsigned long flags; 315 unsigned long flags;
316 316
317 spin_lock_irqsave(&v3_lock, flags); 317 raw_spin_lock_irqsave(&v3_lock, flags);
318 addr = v3_open_config_window(bus, devfn, where); 318 addr = v3_open_config_window(bus, devfn, where);
319 319
320 switch (size) { 320 switch (size) {
@@ -335,7 +335,7 @@ static int v3_write_config(struct pci_bus *bus, unsigned int devfn, int where,
335 } 335 }
336 336
337 v3_close_config_window(); 337 v3_close_config_window();
338 spin_unlock_irqrestore(&v3_lock, flags); 338 raw_spin_unlock_irqrestore(&v3_lock, flags);
339 339
340 return PCIBIOS_SUCCESSFUL; 340 return PCIBIOS_SUCCESSFUL;
341} 341}
@@ -513,7 +513,7 @@ void __init pci_v3_preinit(void)
513 hook_fault_code(8, v3_pci_fault, SIGBUS, 0, "external abort on non-linefetch"); 513 hook_fault_code(8, v3_pci_fault, SIGBUS, 0, "external abort on non-linefetch");
514 hook_fault_code(10, v3_pci_fault, SIGBUS, 0, "external abort on non-linefetch"); 514 hook_fault_code(10, v3_pci_fault, SIGBUS, 0, "external abort on non-linefetch");
515 515
516 spin_lock_irqsave(&v3_lock, flags); 516 raw_spin_lock_irqsave(&v3_lock, flags);
517 517
518 /* 518 /*
519 * Unlock V3 registers, but only if they were previously locked. 519 * Unlock V3 registers, but only if they were previously locked.
@@ -586,7 +586,7 @@ void __init pci_v3_preinit(void)
586 printk(KERN_ERR "PCI: unable to grab PCI error " 586 printk(KERN_ERR "PCI: unable to grab PCI error "
587 "interrupt: %d\n", ret); 587 "interrupt: %d\n", ret);
588 588
589 spin_unlock_irqrestore(&v3_lock, flags); 589 raw_spin_unlock_irqrestore(&v3_lock, flags);
590} 590}
591 591
592void __init pci_v3_postinit(void) 592void __init pci_v3_postinit(void)
diff --git a/arch/arm/mach-iop13xx/Makefile.boot b/arch/arm/mach-iop13xx/Makefile.boot
index 0b0e19fdfe6..3a8c38c3189 100644
--- a/arch/arm/mach-iop13xx/Makefile.boot
+++ b/arch/arm/mach-iop13xx/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-iop32x/Makefile.boot b/arch/arm/mach-iop32x/Makefile.boot
index 47000dccd61..0a833b11e38 100644
--- a/arch/arm/mach-iop32x/Makefile.boot
+++ b/arch/arm/mach-iop32x/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0xa0008000 1 zreladdr-y += 0xa0008000
2params_phys-y := 0xa0000100 2params_phys-y := 0xa0000100
3initrd_phys-y := 0xa0800000 3initrd_phys-y := 0xa0800000
diff --git a/arch/arm/mach-iop33x/Makefile.boot b/arch/arm/mach-iop33x/Makefile.boot
index 67039c3e0c4..760a0efe758 100644
--- a/arch/arm/mach-iop33x/Makefile.boot
+++ b/arch/arm/mach-iop33x/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-ixp2000/Makefile.boot b/arch/arm/mach-ixp2000/Makefile.boot
index d84c5807a43..9c7af91d93d 100644
--- a/arch/arm/mach-ixp2000/Makefile.boot
+++ b/arch/arm/mach-ixp2000/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3 3
diff --git a/arch/arm/mach-ixp23xx/Makefile.boot b/arch/arm/mach-ixp23xx/Makefile.boot
index d5561ad15ba..44fb4a717c3 100644
--- a/arch/arm/mach-ixp23xx/Makefile.boot
+++ b/arch/arm/mach-ixp23xx/Makefile.boot
@@ -1,2 +1,2 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
diff --git a/arch/arm/mach-ixp4xx/Makefile.boot b/arch/arm/mach-ixp4xx/Makefile.boot
index d84c5807a43..9c7af91d93d 100644
--- a/arch/arm/mach-ixp4xx/Makefile.boot
+++ b/arch/arm/mach-ixp4xx/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3 3
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index 2131832ee6b..f72a3a893c4 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -54,7 +54,7 @@ unsigned long ixp4xx_pci_reg_base = 0;
54 * these transactions are atomic or we will end up 54 * these transactions are atomic or we will end up
55 * with corrupt data on the bus or in a driver. 55 * with corrupt data on the bus or in a driver.
56 */ 56 */
57static DEFINE_SPINLOCK(ixp4xx_pci_lock); 57static DEFINE_RAW_SPINLOCK(ixp4xx_pci_lock);
58 58
59/* 59/*
60 * Read from PCI config space 60 * Read from PCI config space
@@ -62,10 +62,10 @@ static DEFINE_SPINLOCK(ixp4xx_pci_lock);
62static void crp_read(u32 ad_cbe, u32 *data) 62static void crp_read(u32 ad_cbe, u32 *data)
63{ 63{
64 unsigned long flags; 64 unsigned long flags;
65 spin_lock_irqsave(&ixp4xx_pci_lock, flags); 65 raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
66 *PCI_CRP_AD_CBE = ad_cbe; 66 *PCI_CRP_AD_CBE = ad_cbe;
67 *data = *PCI_CRP_RDATA; 67 *data = *PCI_CRP_RDATA;
68 spin_unlock_irqrestore(&ixp4xx_pci_lock, flags); 68 raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
69} 69}
70 70
71/* 71/*
@@ -74,10 +74,10 @@ static void crp_read(u32 ad_cbe, u32 *data)
74static void crp_write(u32 ad_cbe, u32 data) 74static void crp_write(u32 ad_cbe, u32 data)
75{ 75{
76 unsigned long flags; 76 unsigned long flags;
77 spin_lock_irqsave(&ixp4xx_pci_lock, flags); 77 raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
78 *PCI_CRP_AD_CBE = CRP_AD_CBE_WRITE | ad_cbe; 78 *PCI_CRP_AD_CBE = CRP_AD_CBE_WRITE | ad_cbe;
79 *PCI_CRP_WDATA = data; 79 *PCI_CRP_WDATA = data;
80 spin_unlock_irqrestore(&ixp4xx_pci_lock, flags); 80 raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
81} 81}
82 82
83static inline int check_master_abort(void) 83static inline int check_master_abort(void)
@@ -101,7 +101,7 @@ int ixp4xx_pci_read_errata(u32 addr, u32 cmd, u32* data)
101 int retval = 0; 101 int retval = 0;
102 int i; 102 int i;
103 103
104 spin_lock_irqsave(&ixp4xx_pci_lock, flags); 104 raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
105 105
106 *PCI_NP_AD = addr; 106 *PCI_NP_AD = addr;
107 107
@@ -118,7 +118,7 @@ int ixp4xx_pci_read_errata(u32 addr, u32 cmd, u32* data)
118 if(check_master_abort()) 118 if(check_master_abort())
119 retval = 1; 119 retval = 1;
120 120
121 spin_unlock_irqrestore(&ixp4xx_pci_lock, flags); 121 raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
122 return retval; 122 return retval;
123} 123}
124 124
@@ -127,7 +127,7 @@ int ixp4xx_pci_read_no_errata(u32 addr, u32 cmd, u32* data)
127 unsigned long flags; 127 unsigned long flags;
128 int retval = 0; 128 int retval = 0;
129 129
130 spin_lock_irqsave(&ixp4xx_pci_lock, flags); 130 raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
131 131
132 *PCI_NP_AD = addr; 132 *PCI_NP_AD = addr;
133 133
@@ -140,7 +140,7 @@ int ixp4xx_pci_read_no_errata(u32 addr, u32 cmd, u32* data)
140 if(check_master_abort()) 140 if(check_master_abort())
141 retval = 1; 141 retval = 1;
142 142
143 spin_unlock_irqrestore(&ixp4xx_pci_lock, flags); 143 raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
144 return retval; 144 return retval;
145} 145}
146 146
@@ -149,7 +149,7 @@ int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data)
149 unsigned long flags; 149 unsigned long flags;
150 int retval = 0; 150 int retval = 0;
151 151
152 spin_lock_irqsave(&ixp4xx_pci_lock, flags); 152 raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
153 153
154 *PCI_NP_AD = addr; 154 *PCI_NP_AD = addr;
155 155
@@ -162,7 +162,7 @@ int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data)
162 if(check_master_abort()) 162 if(check_master_abort())
163 retval = 1; 163 retval = 1;
164 164
165 spin_unlock_irqrestore(&ixp4xx_pci_lock, flags); 165 raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
166 return retval; 166 return retval;
167} 167}
168 168
@@ -397,7 +397,8 @@ void __init ixp4xx_pci_preinit(void)
397 local_write_config(PCI_BASE_ADDRESS_0, 4, PHYS_OFFSET); 397 local_write_config(PCI_BASE_ADDRESS_0, 4, PHYS_OFFSET);
398 local_write_config(PCI_BASE_ADDRESS_1, 4, PHYS_OFFSET + SZ_16M); 398 local_write_config(PCI_BASE_ADDRESS_1, 4, PHYS_OFFSET + SZ_16M);
399 local_write_config(PCI_BASE_ADDRESS_2, 4, PHYS_OFFSET + SZ_32M); 399 local_write_config(PCI_BASE_ADDRESS_2, 4, PHYS_OFFSET + SZ_32M);
400 local_write_config(PCI_BASE_ADDRESS_3, 4, PHYS_OFFSET + SZ_48M); 400 local_write_config(PCI_BASE_ADDRESS_3, 4,
401 PHYS_OFFSET + SZ_32M + SZ_16M);
401 402
402 /* 403 /*
403 * Enable CSR window at 64 MiB to allow PCI masters 404 * Enable CSR window at 64 MiB to allow PCI masters
diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h
index 57b5410c31f..ffb9d6afb89 100644
--- a/arch/arm/mach-ixp4xx/include/mach/io.h
+++ b/arch/arm/mach-ixp4xx/include/mach/io.h
@@ -17,8 +17,6 @@
17 17
18#include <mach/hardware.h> 18#include <mach/hardware.h>
19 19
20#define IO_SPACE_LIMIT 0x0000ffff
21
22extern int (*ixp4xx_pci_read)(u32 addr, u32 cmd, u32* data); 20extern int (*ixp4xx_pci_read)(u32 addr, u32 cmd, u32* data);
23extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data); 21extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data);
24 22
diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
index 67039c3e0c4..760a0efe758 100644
--- a/arch/arm/mach-kirkwood/Makefile.boot
+++ b/arch/arm/mach-kirkwood/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-ks8695/Makefile.boot b/arch/arm/mach-ks8695/Makefile.boot
index 48eb2cb3ac7..c9b0bebcf23 100644
--- a/arch/arm/mach-ks8695/Makefile.boot
+++ b/arch/arm/mach-ks8695/Makefile.boot
@@ -3,6 +3,6 @@
3# PARAMS_PHYS must be within 4MB of ZRELADDR 3# PARAMS_PHYS must be within 4MB of ZRELADDR
4# INITRD_PHYS must be in RAM 4# INITRD_PHYS must be in RAM
5 5
6 zreladdr-y := 0x00008000 6 zreladdr-y += 0x00008000
7params_phys-y := 0x00000100 7params_phys-y := 0x00000100
8initrd_phys-y := 0x00800000 8initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-lpc32xx/Makefile.boot b/arch/arm/mach-lpc32xx/Makefile.boot
index b796b41ebf8..2cfe0ee635c 100644
--- a/arch/arm/mach-lpc32xx/Makefile.boot
+++ b/arch/arm/mach-lpc32xx/Makefile.boot
@@ -1,4 +1,4 @@
1 zreladdr-y := 0x80008000 1 zreladdr-y += 0x80008000
2params_phys-y := 0x80000100 2params_phys-y := 0x80000100
3initrd_phys-y := 0x82000000 3initrd_phys-y := 0x82000000
4 4
diff --git a/arch/arm/mach-mmp/Makefile.boot b/arch/arm/mach-mmp/Makefile.boot
index 574a4aa8321..5edf03e2bee 100644
--- a/arch/arm/mach-mmp/Makefile.boot
+++ b/arch/arm/mach-mmp/Makefile.boot
@@ -1 +1 @@
zreladdr-y := 0x00008000 zreladdr-y += 0x00008000
diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index 06b5fa853c9..49c5d6d843d 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -160,7 +160,7 @@ static struct mtd_partition aspenite_nand_partitions[] = {
160 }, { 160 }, {
161 .name = "filesystem", 161 .name = "filesystem",
162 .offset = MTDPART_OFS_APPEND, 162 .offset = MTDPART_OFS_APPEND,
163 .size = SZ_48M, 163 .size = SZ_32M + SZ_16M,
164 .mask_flags = 0, 164 .mask_flags = 0,
165 } 165 }
166}; 166};
diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h b/arch/arm/mach-mmp/include/mach/pxa168.h
index 7f005843a70..7fb568d2845 100644
--- a/arch/arm/mach-mmp/include/mach/pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/pxa168.h
@@ -35,6 +35,13 @@ extern struct pxa_device_desc pxa168_device_fb;
35extern struct pxa_device_desc pxa168_device_keypad; 35extern struct pxa_device_desc pxa168_device_keypad;
36extern struct pxa_device_desc pxa168_device_eth; 36extern struct pxa_device_desc pxa168_device_eth;
37 37
38struct pxa168_usb_pdata {
39 /* If NULL, default phy init routine for PXA168 would be called */
40 int (*phy_init)(void __iomem *usb_phy_reg_base);
41};
42/* pdata can be NULL */
43int __init pxa168_add_usb_host(struct pxa168_usb_pdata *pdata);
44
38static inline int pxa168_add_uart(int id) 45static inline int pxa168_add_uart(int id)
39{ 46{
40 struct pxa_device_desc *d = NULL; 47 struct pxa_device_desc *d = NULL;
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 0156f535dae..b2b280c517d 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -25,6 +25,9 @@
25#include <mach/dma.h> 25#include <mach/dma.h>
26#include <mach/devices.h> 26#include <mach/devices.h>
27#include <mach/mfp.h> 27#include <mach/mfp.h>
28#include <linux/platform_device.h>
29#include <linux/dma-mapping.h>
30#include <mach/pxa168.h>
28 31
29#include "common.h" 32#include "common.h"
30#include "clock.h" 33#include "clock.h"
@@ -83,6 +86,7 @@ static APBC_CLK(keypad, PXA168_KPC, 0, 32000);
83static APMU_CLK(nand, NAND, 0x19b, 156000000); 86static APMU_CLK(nand, NAND, 0x19b, 156000000);
84static APMU_CLK(lcd, LCD, 0x7f, 312000000); 87static APMU_CLK(lcd, LCD, 0x7f, 312000000);
85static APMU_CLK(eth, ETH, 0x09, 0); 88static APMU_CLK(eth, ETH, 0x09, 0);
89static APMU_CLK(usb, USB, 0x12, 0);
86 90
87/* device and clock bindings */ 91/* device and clock bindings */
88static struct clk_lookup pxa168_clkregs[] = { 92static struct clk_lookup pxa168_clkregs[] = {
@@ -104,6 +108,7 @@ static struct clk_lookup pxa168_clkregs[] = {
104 INIT_CLKREG(&clk_lcd, "pxa168-fb", NULL), 108 INIT_CLKREG(&clk_lcd, "pxa168-fb", NULL),
105 INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL), 109 INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL),
106 INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"), 110 INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"),
111 INIT_CLKREG(&clk_usb, "pxa168-ehci", "PXA168-USBCLK"),
107}; 112};
108 113
109static int __init pxa168_init(void) 114static int __init pxa168_init(void)
@@ -169,3 +174,44 @@ PXA168_DEVICE(ssp5, "pxa168-ssp", 4, SSP5, 0xd4021000, 0x40, 60, 61);
169PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8); 174PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8);
170PXA168_DEVICE(keypad, "pxa27x-keypad", -1, KEYPAD, 0xd4012000, 0x4c); 175PXA168_DEVICE(keypad, "pxa27x-keypad", -1, KEYPAD, 0xd4012000, 0x4c);
171PXA168_DEVICE(eth, "pxa168-eth", -1, MFU, 0xc0800000, 0x0fff); 176PXA168_DEVICE(eth, "pxa168-eth", -1, MFU, 0xc0800000, 0x0fff);
177
178struct resource pxa168_usb_host_resources[] = {
179 /* USB Host conroller register base */
180 [0] = {
181 .start = 0xd4209000,
182 .end = 0xd4209000 + 0x200,
183 .flags = IORESOURCE_MEM,
184 .name = "pxa168-usb-host",
185 },
186 /* USB PHY register base */
187 [1] = {
188 .start = 0xd4206000,
189 .end = 0xd4206000 + 0xff,
190 .flags = IORESOURCE_MEM,
191 .name = "pxa168-usb-phy",
192 },
193 [2] = {
194 .start = IRQ_PXA168_USB2,
195 .end = IRQ_PXA168_USB2,
196 .flags = IORESOURCE_IRQ,
197 },
198};
199
200static u64 pxa168_usb_host_dmamask = DMA_BIT_MASK(32);
201struct platform_device pxa168_device_usb_host = {
202 .name = "pxa168-ehci",
203 .id = -1,
204 .dev = {
205 .dma_mask = &pxa168_usb_host_dmamask,
206 .coherent_dma_mask = DMA_BIT_MASK(32),
207 },
208
209 .num_resources = ARRAY_SIZE(pxa168_usb_host_resources),
210 .resource = pxa168_usb_host_resources,
211};
212
213int __init pxa168_add_usb_host(struct pxa168_usb_pdata *pdata)
214{
215 pxa168_device_usb_host.dev.platform_data = pdata;
216 return platform_device_register(&pxa168_device_usb_host);
217}
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index 6bd37a27e5f..176515a7698 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -93,7 +93,7 @@ static struct mtd_partition ttc_dkb_onenand_partitions[] = {
93 }, { 93 }, {
94 .name = "filesystem", 94 .name = "filesystem",
95 .offset = MTDPART_OFS_APPEND, 95 .offset = MTDPART_OFS_APPEND,
96 .size = SZ_48M, 96 .size = SZ_32M + SZ_16M,
97 .mask_flags = 0, 97 .mask_flags = 0,
98 } 98 }
99}; 99};
diff --git a/arch/arm/mach-msm/Makefile.boot b/arch/arm/mach-msm/Makefile.boot
index 24dfbf8c07c..9b803a578b4 100644
--- a/arch/arm/mach-msm/Makefile.boot
+++ b/arch/arm/mach-msm/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x10008000 1 zreladdr-y += 0x10008000
2params_phys-y := 0x10000100 2params_phys-y := 0x10000100
3initrd_phys-y := 0x10800000 3initrd_phys-y := 0x10800000
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c
index 18a3c97bc86..f81ef1f9d46 100644
--- a/arch/arm/mach-msm/board-halibut.c
+++ b/arch/arm/mach-msm/board-halibut.c
@@ -78,8 +78,8 @@ static void __init halibut_init(void)
78 platform_add_devices(devices, ARRAY_SIZE(devices)); 78 platform_add_devices(devices, ARRAY_SIZE(devices));
79} 79}
80 80
81static void __init halibut_fixup(struct machine_desc *desc, struct tag *tags, 81static void __init halibut_fixup(struct tag *tags, char **cmdline,
82 char **cmdline, struct meminfo *mi) 82 struct meminfo *mi)
83{ 83{
84 mi->nr_banks=1; 84 mi->nr_banks=1;
85 mi->bank[0].start = PHYS_OFFSET; 85 mi->bank[0].start = PHYS_OFFSET;
diff --git a/arch/arm/mach-msm/board-mahimahi.c b/arch/arm/mach-msm/board-mahimahi.c
index 7a9a03eb189..1df15aa3c66 100644
--- a/arch/arm/mach-msm/board-mahimahi.c
+++ b/arch/arm/mach-msm/board-mahimahi.c
@@ -53,8 +53,8 @@ static void __init mahimahi_init(void)
53 platform_add_devices(devices, ARRAY_SIZE(devices)); 53 platform_add_devices(devices, ARRAY_SIZE(devices));
54} 54}
55 55
56static void __init mahimahi_fixup(struct machine_desc *desc, struct tag *tags, 56static void __init mahimahi_fixup(struct tag *tags, char **cmdline,
57 char **cmdline, struct meminfo *mi) 57 struct meminfo *mi)
58{ 58{
59 mi->nr_banks = 2; 59 mi->nr_banks = 2;
60 mi->bank[0].start = PHYS_OFFSET; 60 mi->bank[0].start = PHYS_OFFSET;
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index b7a84966b71..d1e4cc83b1e 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -24,6 +24,7 @@
24#include <linux/smsc911x.h> 24#include <linux/smsc911x.h>
25#include <linux/usb/msm_hsusb.h> 25#include <linux/usb/msm_hsusb.h>
26#include <linux/clkdev.h> 26#include <linux/clkdev.h>
27#include <linux/memblock.h>
27 28
28#include <asm/mach-types.h> 29#include <asm/mach-types.h>
29#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
@@ -42,6 +43,21 @@
42 43
43extern struct sys_timer msm_timer; 44extern struct sys_timer msm_timer;
44 45
46static void __init msm7x30_fixup(struct machine_desc *desc, struct tag *tag,
47 char **cmdline, struct meminfo *mi)
48{
49 for (; tag->hdr.size; tag = tag_next(tag))
50 if (tag->hdr.tag == ATAG_MEM && tag->u.mem.start == 0x200000) {
51 tag->u.mem.start = 0;
52 tag->u.mem.size += SZ_2M;
53 }
54}
55
56static void __init msm7x30_reserve(void)
57{
58 memblock_remove(0x0, SZ_2M);
59}
60
45static int hsusb_phy_init_seq[] = { 61static int hsusb_phy_init_seq[] = {
46 0x30, 0x32, /* Enable and set Pre-Emphasis Depth to 20% */ 62 0x30, 0x32, /* Enable and set Pre-Emphasis Depth to 20% */
47 0x02, 0x36, /* Disable CDR Auto Reset feature */ 63 0x02, 0x36, /* Disable CDR Auto Reset feature */
@@ -107,6 +123,8 @@ static void __init msm7x30_map_io(void)
107 123
108MACHINE_START(MSM7X30_SURF, "QCT MSM7X30 SURF") 124MACHINE_START(MSM7X30_SURF, "QCT MSM7X30 SURF")
109 .boot_params = PLAT_PHYS_OFFSET + 0x100, 125 .boot_params = PLAT_PHYS_OFFSET + 0x100,
126 .fixup = msm7x30_fixup,
127 .reserve = msm7x30_reserve,
110 .map_io = msm7x30_map_io, 128 .map_io = msm7x30_map_io,
111 .init_irq = msm7x30_init_irq, 129 .init_irq = msm7x30_init_irq,
112 .init_machine = msm7x30_init, 130 .init_machine = msm7x30_init,
@@ -115,6 +133,8 @@ MACHINE_END
115 133
116MACHINE_START(MSM7X30_FFA, "QCT MSM7X30 FFA") 134MACHINE_START(MSM7X30_FFA, "QCT MSM7X30 FFA")
117 .boot_params = PLAT_PHYS_OFFSET + 0x100, 135 .boot_params = PLAT_PHYS_OFFSET + 0x100,
136 .fixup = msm7x30_fixup,
137 .reserve = msm7x30_reserve,
118 .map_io = msm7x30_map_io, 138 .map_io = msm7x30_map_io,
119 .init_irq = msm7x30_init_irq, 139 .init_irq = msm7x30_init_irq,
120 .init_machine = msm7x30_init, 140 .init_machine = msm7x30_init,
@@ -123,6 +143,8 @@ MACHINE_END
123 143
124MACHINE_START(MSM7X30_FLUID, "QCT MSM7X30 FLUID") 144MACHINE_START(MSM7X30_FLUID, "QCT MSM7X30 FLUID")
125 .boot_params = PLAT_PHYS_OFFSET + 0x100, 145 .boot_params = PLAT_PHYS_OFFSET + 0x100,
146 .fixup = msm7x30_fixup,
147 .reserve = msm7x30_reserve,
126 .map_io = msm7x30_map_io, 148 .map_io = msm7x30_map_io,
127 .init_irq = msm7x30_init_irq, 149 .init_irq = msm7x30_init_irq,
128 .init_machine = msm7x30_init, 150 .init_machine = msm7x30_init,
diff --git a/arch/arm/mach-msm/board-msm8960.c b/arch/arm/mach-msm/board-msm8960.c
index 35c7ceeb3f2..b04468e7d00 100644
--- a/arch/arm/mach-msm/board-msm8960.c
+++ b/arch/arm/mach-msm/board-msm8960.c
@@ -20,16 +20,34 @@
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/irq.h> 21#include <linux/irq.h>
22#include <linux/clkdev.h> 22#include <linux/clkdev.h>
23#include <linux/memblock.h>
23 24
24#include <asm/mach-types.h> 25#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
26#include <asm/hardware/gic.h> 27#include <asm/hardware/gic.h>
28#include <asm/setup.h>
27 29
28#include <mach/board.h> 30#include <mach/board.h>
29#include <mach/msm_iomap.h> 31#include <mach/msm_iomap.h>
30 32
31#include "devices.h" 33#include "devices.h"
32 34
35static void __init msm8960_fixup(struct machine_desc *desc, struct tag *tag,
36 char **cmdline, struct meminfo *mi)
37{
38 for (; tag->hdr.size; tag = tag_next(tag))
39 if (tag->hdr.tag == ATAG_MEM &&
40 tag->u.mem.start == 0x40200000) {
41 tag->u.mem.start = 0x40000000;
42 tag->u.mem.size += SZ_2M;
43 }
44}
45
46static void __init msm8960_reserve(void)
47{
48 memblock_remove(0x40000000, SZ_2M);
49}
50
33static void __init msm8960_map_io(void) 51static void __init msm8960_map_io(void)
34{ 52{
35 msm_map_msm8960_io(); 53 msm_map_msm8960_io();
@@ -76,6 +94,8 @@ static void __init msm8960_rumi3_init(void)
76} 94}
77 95
78MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR") 96MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
97 .fixup = msm8960_fixup,
98 .reserve = msm8960_reserve,
79 .map_io = msm8960_map_io, 99 .map_io = msm8960_map_io,
80 .init_irq = msm8960_init_irq, 100 .init_irq = msm8960_init_irq,
81 .timer = &msm_timer, 101 .timer = &msm_timer,
@@ -83,6 +103,8 @@ MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
83MACHINE_END 103MACHINE_END
84 104
85MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3") 105MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
106 .fixup = msm8960_fixup,
107 .reserve = msm8960_reserve,
86 .map_io = msm8960_map_io, 108 .map_io = msm8960_map_io,
87 .init_irq = msm8960_init_irq, 109 .init_irq = msm8960_init_irq,
88 .timer = &msm_timer, 110 .timer = &msm_timer,
diff --git a/arch/arm/mach-msm/board-msm8x60.c b/arch/arm/mach-msm/board-msm8x60.c
index 1163b6fd05d..9221f54778b 100644
--- a/arch/arm/mach-msm/board-msm8x60.c
+++ b/arch/arm/mach-msm/board-msm8x60.c
@@ -20,14 +20,31 @@
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/irq.h> 22#include <linux/irq.h>
23#include <linux/memblock.h>
23 24
24#include <asm/mach-types.h> 25#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
26#include <asm/hardware/gic.h> 27#include <asm/hardware/gic.h>
28#include <asm/setup.h>
27 29
28#include <mach/board.h> 30#include <mach/board.h>
29#include <mach/msm_iomap.h> 31#include <mach/msm_iomap.h>
30 32
33static void __init msm8x60_fixup(struct machine_desc *desc, struct tag *tag,
34 char **cmdline, struct meminfo *mi)
35{
36 for (; tag->hdr.size; tag = tag_next(tag))
37 if (tag->hdr.tag == ATAG_MEM &&
38 tag->u.mem.start == 0x40200000) {
39 tag->u.mem.start = 0x40000000;
40 tag->u.mem.size += SZ_2M;
41 }
42}
43
44static void __init msm8x60_reserve(void)
45{
46 memblock_remove(0x40000000, SZ_2M);
47}
31 48
32static void __init msm8x60_map_io(void) 49static void __init msm8x60_map_io(void)
33{ 50{
@@ -65,6 +82,8 @@ static void __init msm8x60_init(void)
65} 82}
66 83
67MACHINE_START(MSM8X60_RUMI3, "QCT MSM8X60 RUMI3") 84MACHINE_START(MSM8X60_RUMI3, "QCT MSM8X60 RUMI3")
85 .fixup = msm8x60_fixup,
86 .reserve = msm8x60_reserve,
68 .map_io = msm8x60_map_io, 87 .map_io = msm8x60_map_io,
69 .init_irq = msm8x60_init_irq, 88 .init_irq = msm8x60_init_irq,
70 .init_machine = msm8x60_init, 89 .init_machine = msm8x60_init,
@@ -72,6 +91,8 @@ MACHINE_START(MSM8X60_RUMI3, "QCT MSM8X60 RUMI3")
72MACHINE_END 91MACHINE_END
73 92
74MACHINE_START(MSM8X60_SURF, "QCT MSM8X60 SURF") 93MACHINE_START(MSM8X60_SURF, "QCT MSM8X60 SURF")
94 .fixup = msm8x60_fixup,
95 .reserve = msm8x60_reserve,
75 .map_io = msm8x60_map_io, 96 .map_io = msm8x60_map_io,
76 .init_irq = msm8x60_init_irq, 97 .init_irq = msm8x60_init_irq,
77 .init_machine = msm8x60_init, 98 .init_machine = msm8x60_init,
@@ -79,6 +100,8 @@ MACHINE_START(MSM8X60_SURF, "QCT MSM8X60 SURF")
79MACHINE_END 100MACHINE_END
80 101
81MACHINE_START(MSM8X60_SIM, "QCT MSM8X60 SIMULATOR") 102MACHINE_START(MSM8X60_SIM, "QCT MSM8X60 SIMULATOR")
103 .fixup = msm8x60_fixup,
104 .reserve = msm8x60_reserve,
82 .map_io = msm8x60_map_io, 105 .map_io = msm8x60_map_io,
83 .init_irq = msm8x60_init_irq, 106 .init_irq = msm8x60_init_irq,
84 .init_machine = msm8x60_init, 107 .init_machine = msm8x60_init,
@@ -86,6 +109,8 @@ MACHINE_START(MSM8X60_SIM, "QCT MSM8X60 SIMULATOR")
86MACHINE_END 109MACHINE_END
87 110
88MACHINE_START(MSM8X60_FFA, "QCT MSM8X60 FFA") 111MACHINE_START(MSM8X60_FFA, "QCT MSM8X60 FFA")
112 .fixup = msm8x60_fixup,
113 .reserve = msm8x60_reserve,
89 .map_io = msm8x60_map_io, 114 .map_io = msm8x60_map_io,
90 .init_irq = msm8x60_init_irq, 115 .init_irq = msm8x60_init_irq,
91 .init_machine = msm8x60_init, 116 .init_machine = msm8x60_init,
diff --git a/arch/arm/mach-msm/board-sapphire.c b/arch/arm/mach-msm/board-sapphire.c
index 68f930f07d7..c6e043c896a 100644
--- a/arch/arm/mach-msm/board-sapphire.c
+++ b/arch/arm/mach-msm/board-sapphire.c
@@ -77,8 +77,8 @@ static struct map_desc sapphire_io_desc[] __initdata = {
77 } 77 }
78}; 78};
79 79
80static void __init sapphire_fixup(struct machine_desc *desc, struct tag *tags, 80static void __init sapphire_fixup(struct tag *tags, char **cmdline,
81 char **cmdline, struct meminfo *mi) 81 struct meminfo *mi)
82{ 82{
83 int smi_sz = parse_tag_smi((const struct tag *)tags); 83 int smi_sz = parse_tag_smi((const struct tag *)tags);
84 84
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c
index 814386772c6..7acd2021ada 100644
--- a/arch/arm/mach-msm/board-trout.c
+++ b/arch/arm/mach-msm/board-trout.c
@@ -48,8 +48,8 @@ static void __init trout_init_irq(void)
48 msm_init_irq(); 48 msm_init_irq();
49} 49}
50 50
51static void __init trout_fixup(struct machine_desc *desc, struct tag *tags, 51static void __init trout_fixup(struct tag *tags, char **cmdline,
52 char **cmdline, struct meminfo *mi) 52 struct meminfo *mi)
53{ 53{
54 mi->nr_banks = 1; 54 mi->nr_banks = 1;
55 mi->bank[0].start = PHYS_OFFSET; 55 mi->bank[0].start = PHYS_OFFSET;
diff --git a/arch/arm/mach-msm/clock.c b/arch/arm/mach-msm/clock.c
index 22a53766962..d9145dfc2a3 100644
--- a/arch/arm/mach-msm/clock.c
+++ b/arch/arm/mach-msm/clock.c
@@ -18,7 +18,7 @@
18#include <linux/list.h> 18#include <linux/list.h>
19#include <linux/err.h> 19#include <linux/err.h>
20#include <linux/spinlock.h> 20#include <linux/spinlock.h>
21#include <linux/pm_qos_params.h> 21#include <linux/pm_qos.h>
22#include <linux/mutex.h> 22#include <linux/mutex.h>
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/string.h> 24#include <linux/string.h>
diff --git a/arch/arm/mach-msm/include/mach/memory.h b/arch/arm/mach-msm/include/mach/memory.h
index f2f8d299ba9..58d5e7eec43 100644
--- a/arch/arm/mach-msm/include/mach/memory.h
+++ b/arch/arm/mach-msm/include/mach/memory.h
@@ -22,11 +22,11 @@
22#elif defined(CONFIG_ARCH_QSD8X50) 22#elif defined(CONFIG_ARCH_QSD8X50)
23#define PLAT_PHYS_OFFSET UL(0x20000000) 23#define PLAT_PHYS_OFFSET UL(0x20000000)
24#elif defined(CONFIG_ARCH_MSM7X30) 24#elif defined(CONFIG_ARCH_MSM7X30)
25#define PLAT_PHYS_OFFSET UL(0x00200000) 25#define PLAT_PHYS_OFFSET UL(0x00000000)
26#elif defined(CONFIG_ARCH_MSM8X60) 26#elif defined(CONFIG_ARCH_MSM8X60)
27#define PLAT_PHYS_OFFSET UL(0x40200000) 27#define PLAT_PHYS_OFFSET UL(0x40000000)
28#elif defined(CONFIG_ARCH_MSM8960) 28#elif defined(CONFIG_ARCH_MSM8960)
29#define PLAT_PHYS_OFFSET UL(0x40200000) 29#define PLAT_PHYS_OFFSET UL(0x40000000)
30#else 30#else
31#define PLAT_PHYS_OFFSET UL(0x10000000) 31#define PLAT_PHYS_OFFSET UL(0x10000000)
32#endif 32#endif
diff --git a/arch/arm/mach-msm/platsmp.c b/arch/arm/mach-msm/platsmp.c
index 1a1af9e5625..72765952091 100644
--- a/arch/arm/mach-msm/platsmp.c
+++ b/arch/arm/mach-msm/platsmp.c
@@ -156,6 +156,12 @@ void __init smp_init_cpus(void)
156{ 156{
157 unsigned int i, ncores = get_core_count(); 157 unsigned int i, ncores = get_core_count();
158 158
159 if (ncores > nr_cpu_ids) {
160 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
161 ncores, nr_cpu_ids);
162 ncores = nr_cpu_ids;
163 }
164
159 for (i = 0; i < ncores; i++) 165 for (i = 0; i < ncores; i++)
160 set_cpu_possible(i, true); 166 set_cpu_possible(i, true);
161 167
diff --git a/arch/arm/mach-mv78xx0/Makefile.boot b/arch/arm/mach-mv78xx0/Makefile.boot
index 67039c3e0c4..760a0efe758 100644
--- a/arch/arm/mach-mv78xx0/Makefile.boot
+++ b/arch/arm/mach-mv78xx0/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-mx5/Makefile.boot b/arch/arm/mach-mx5/Makefile.boot
index e928be1b675..ca207ca305e 100644
--- a/arch/arm/mach-mx5/Makefile.boot
+++ b/arch/arm/mach-mx5/Makefile.boot
@@ -1,9 +1,9 @@
1 zreladdr-$(CONFIG_ARCH_MX50) := 0x70008000 1 zreladdr-$(CONFIG_ARCH_MX50) += 0x70008000
2params_phys-$(CONFIG_ARCH_MX50) := 0x70000100 2params_phys-$(CONFIG_ARCH_MX50) := 0x70000100
3initrd_phys-$(CONFIG_ARCH_MX50) := 0x70800000 3initrd_phys-$(CONFIG_ARCH_MX50) := 0x70800000
4 zreladdr-$(CONFIG_ARCH_MX51) := 0x90008000 4 zreladdr-$(CONFIG_ARCH_MX51) += 0x90008000
5params_phys-$(CONFIG_ARCH_MX51) := 0x90000100 5params_phys-$(CONFIG_ARCH_MX51) := 0x90000100
6initrd_phys-$(CONFIG_ARCH_MX51) := 0x90800000 6initrd_phys-$(CONFIG_ARCH_MX51) := 0x90800000
7 zreladdr-$(CONFIG_ARCH_MX53) := 0x70008000 7 zreladdr-$(CONFIG_ARCH_MX53) += 0x70008000
8params_phys-$(CONFIG_ARCH_MX53) := 0x70000100 8params_phys-$(CONFIG_ARCH_MX53) := 0x70000100
9initrd_phys-$(CONFIG_ARCH_MX53) := 0x70800000 9initrd_phys-$(CONFIG_ARCH_MX53) := 0x70800000
diff --git a/arch/arm/mach-mxs/Makefile.boot b/arch/arm/mach-mxs/Makefile.boot
index eb541e0291d..07b11fe6453 100644
--- a/arch/arm/mach-mxs/Makefile.boot
+++ b/arch/arm/mach-mxs/Makefile.boot
@@ -1 +1 @@
zreladdr-y := 0x40008000 zreladdr-y += 0x40008000
diff --git a/arch/arm/mach-netx/Makefile.boot b/arch/arm/mach-netx/Makefile.boot
index b81cf6aff0a..534a4d27055 100644
--- a/arch/arm/mach-netx/Makefile.boot
+++ b/arch/arm/mach-netx/Makefile.boot
@@ -1,2 +1,2 @@
1 zreladdr-y := 0x80008000 1 zreladdr-y += 0x80008000
2 2
diff --git a/arch/arm/mach-nomadik/Makefile.boot b/arch/arm/mach-nomadik/Makefile.boot
index c7e75acfe6c..ff0a4b5b0a8 100644
--- a/arch/arm/mach-nomadik/Makefile.boot
+++ b/arch/arm/mach-nomadik/Makefile.boot
@@ -1,4 +1,4 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4 4
diff --git a/arch/arm/mach-nuc93x/Makefile.boot b/arch/arm/mach-nuc93x/Makefile.boot
index a057b546b6e..6c3d421c2d1 100644
--- a/arch/arm/mach-nuc93x/Makefile.boot
+++ b/arch/arm/mach-nuc93x/Makefile.boot
@@ -1,3 +1,3 @@
1zreladdr-y := 0x00008000 1zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3 3
diff --git a/arch/arm/mach-nuc93x/time.c b/arch/arm/mach-nuc93x/time.c
index 2f90f9dc6e3..f9807c029ec 100644
--- a/arch/arm/mach-nuc93x/time.c
+++ b/arch/arm/mach-nuc93x/time.c
@@ -82,7 +82,7 @@ static void nuc93x_timer_setup(void)
82 timer0_load = (rate / TICKS_PER_SEC); 82 timer0_load = (rate / TICKS_PER_SEC);
83 __raw_writel(timer0_load, REG_TICR0); 83 __raw_writel(timer0_load, REG_TICR0);
84 84
85 val |= (PERIOD | COUNTEN | INTEN | PRESCALE);; 85 val |= (PERIOD | COUNTEN | INTEN | PRESCALE);
86 __raw_writel(val, REG_TCSR0); 86 __raw_writel(val, REG_TCSR0);
87 87
88} 88}
diff --git a/arch/arm/mach-omap1/Makefile.boot b/arch/arm/mach-omap1/Makefile.boot
index 292d56c5a88..13bda8dbd60 100644
--- a/arch/arm/mach-omap1/Makefile.boot
+++ b/arch/arm/mach-omap1/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x10008000 1 zreladdr-y += 0x10008000
2params_phys-y := 0x10000100 2params_phys-y := 0x10000100
3initrd_phys-y := 0x10800000 3initrd_phys-y := 0x10800000
diff --git a/arch/arm/mach-omap1/pm_bus.c b/arch/arm/mach-omap1/pm_bus.c
index 943072d5a1d..7868e75ad07 100644
--- a/arch/arm/mach-omap1/pm_bus.c
+++ b/arch/arm/mach-omap1/pm_bus.c
@@ -13,6 +13,7 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/pm_runtime.h> 15#include <linux/pm_runtime.h>
16#include <linux/pm_clock.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/mutex.h> 18#include <linux/mutex.h>
18#include <linux/clk.h> 19#include <linux/clk.h>
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 57b66d590c5..89bfb49389f 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -36,6 +36,7 @@ config ARCH_OMAP3
36 select ARM_L1_CACHE_SHIFT_6 if !ARCH_OMAP4 36 select ARM_L1_CACHE_SHIFT_6 if !ARCH_OMAP4
37 select ARCH_HAS_OPP 37 select ARCH_HAS_OPP
38 select PM_OPP if PM 38 select PM_OPP if PM
39 select ARM_CPU_SUSPEND if PM
39 40
40config ARCH_OMAP4 41config ARCH_OMAP4
41 bool "TI OMAP4" 42 bool "TI OMAP4"
@@ -50,6 +51,7 @@ config ARCH_OMAP4
50 select ARCH_HAS_OPP 51 select ARCH_HAS_OPP
51 select PM_OPP if PM 52 select PM_OPP if PM
52 select USB_ARCH_HAS_EHCI 53 select USB_ARCH_HAS_EHCI
54 select ARM_CPU_SUSPEND if PM
53 55
54comment "OMAP Core Type" 56comment "OMAP Core Type"
55 depends on ARCH_OMAP2 57 depends on ARCH_OMAP2
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index f3433656043..7317a2b39dd 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -242,14 +242,11 @@ obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o \
242obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK) += board-omap3touchbook.o \ 242obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK) += board-omap3touchbook.o \
243 hsmmc.o 243 hsmmc.o
244obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o \ 244obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o \
245 hsmmc.o \ 245 hsmmc.o
246 omap_phy_internal.o
247obj-$(CONFIG_MACH_OMAP4_PANDA) += board-omap4panda.o \ 246obj-$(CONFIG_MACH_OMAP4_PANDA) += board-omap4panda.o \
248 hsmmc.o \ 247 hsmmc.o
249 omap_phy_internal.o
250 248
251obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o \ 249obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o
252 omap_phy_internal.o \
253 250
254obj-$(CONFIG_MACH_CRANEBOARD) += board-am3517crane.o 251obj-$(CONFIG_MACH_CRANEBOARD) += board-am3517crane.o
255 252
@@ -260,6 +257,8 @@ obj-$(CONFIG_MACH_TI8168EVM) += board-ti8168evm.o
260usbfs-$(CONFIG_ARCH_OMAP_OTG) := usb-fs.o 257usbfs-$(CONFIG_ARCH_OMAP_OTG) := usb-fs.o
261obj-y += $(usbfs-m) $(usbfs-y) 258obj-y += $(usbfs-m) $(usbfs-y)
262obj-y += usb-musb.o 259obj-y += usb-musb.o
260obj-y += omap_phy_internal.o
261
263obj-$(CONFIG_MACH_OMAP2_TUSB6010) += usb-tusb6010.o 262obj-$(CONFIG_MACH_OMAP2_TUSB6010) += usb-tusb6010.o
264obj-y += usb-host.o 263obj-y += usb-host.o
265 264
diff --git a/arch/arm/mach-omap2/Makefile.boot b/arch/arm/mach-omap2/Makefile.boot
index 565aff7f37a..b03e562acc6 100644
--- a/arch/arm/mach-omap2/Makefile.boot
+++ b/arch/arm/mach-omap2/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x80008000 1 zreladdr-y += 0x80008000
2params_phys-y := 0x80000100 2params_phys-y := 0x80000100
3initrd_phys-y := 0x80800000 3initrd_phys-y := 0x80800000
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index ce65e9329c7..889464dc7b2 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -109,12 +109,10 @@ void __init smp_init_cpus(void)
109 ncores = scu_get_core_count(scu_base); 109 ncores = scu_get_core_count(scu_base);
110 110
111 /* sanity check */ 111 /* sanity check */
112 if (ncores > NR_CPUS) { 112 if (ncores > nr_cpu_ids) {
113 printk(KERN_WARNING 113 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
114 "OMAP4: no. of cores (%d) greater than configured " 114 ncores, nr_cpu_ids);
115 "maximum of %d - clipping\n", 115 ncores = nr_cpu_ids;
116 ncores, NR_CPUS);
117 ncores = NR_CPUS;
118 } 116 }
119 117
120 for (i = 0; i < ncores; i++) 118 for (i = 0; i < ncores; i++)
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index 34c01a7de81..f49804f181d 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -247,7 +247,7 @@ static void sr_stop_vddautocomp(struct omap_sr *sr)
247 * driver register and sr device intializtion API's. Only one call 247 * driver register and sr device intializtion API's. Only one call
248 * will ultimately succeed. 248 * will ultimately succeed.
249 * 249 *
250 * Currently this function registers interrrupt handler for a particular SR 250 * Currently this function registers interrupt handler for a particular SR
251 * if smartreflex class driver is already registered and has 251 * if smartreflex class driver is already registered and has
252 * requested for interrupts and the SR interrupt line in present. 252 * requested for interrupts and the SR interrupt line in present.
253 */ 253 */
diff --git a/arch/arm/mach-orion5x/Makefile.boot b/arch/arm/mach-orion5x/Makefile.boot
index 67039c3e0c4..760a0efe758 100644
--- a/arch/arm/mach-orion5x/Makefile.boot
+++ b/arch/arm/mach-orion5x/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 0ab531d047f..22ace0bf2f9 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -308,8 +308,8 @@ void __init orion5x_init(void)
308 * Many orion-based systems have buggy bootloader implementations. 308 * Many orion-based systems have buggy bootloader implementations.
309 * This is a common fixup for bogus memory tags. 309 * This is a common fixup for bogus memory tags.
310 */ 310 */
311void __init tag_fixup_mem32(struct machine_desc *mdesc, struct tag *t, 311void __init tag_fixup_mem32(struct tag *t, char **from,
312 char **from, struct meminfo *meminfo) 312 struct meminfo *meminfo)
313{ 313{
314 for (; t->hdr.size; t = tag_next(t)) 314 for (; t->hdr.size; t = tag_next(t))
315 if (t->hdr.tag == ATAG_MEM && 315 if (t->hdr.tag == ATAG_MEM &&
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h
index 3e5499dda49..909489f4d23 100644
--- a/arch/arm/mach-orion5x/common.h
+++ b/arch/arm/mach-orion5x/common.h
@@ -53,11 +53,9 @@ int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys);
53struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys); 53struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys);
54int orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin); 54int orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
55 55
56struct machine_desc;
57struct meminfo; 56struct meminfo;
58struct tag; 57struct tag;
59extern void __init tag_fixup_mem32(struct machine_desc *, struct tag *, 58extern void __init tag_fixup_mem32(struct tag *, char **, struct meminfo *);
60 char **, struct meminfo *);
61 59
62 60
63#endif 61#endif
diff --git a/arch/arm/mach-pnx4008/Makefile.boot b/arch/arm/mach-pnx4008/Makefile.boot
index 44c7117e20d..9fa19baa7f2 100644
--- a/arch/arm/mach-pnx4008/Makefile.boot
+++ b/arch/arm/mach-pnx4008/Makefile.boot
@@ -1,4 +1,4 @@
1 zreladdr-y := 0x80008000 1 zreladdr-y += 0x80008000
2params_phys-y := 0x80000100 2params_phys-y := 0x80000100
3initrd_phys-y := 0x80800000 3initrd_phys-y := 0x80800000
4 4
diff --git a/arch/arm/mach-prima2/Makefile.boot b/arch/arm/mach-prima2/Makefile.boot
index d023db3ae4f..c77a4883a4e 100644
--- a/arch/arm/mach-prima2/Makefile.boot
+++ b/arch/arm/mach-prima2/Makefile.boot
@@ -1,3 +1,3 @@
1zreladdr-y := 0x00008000 1zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-pxa/Makefile.boot b/arch/arm/mach-pxa/Makefile.boot
index 1ead67178ec..2c1ae92f210 100644
--- a/arch/arm/mach-pxa/Makefile.boot
+++ b/arch/arm/mach-pxa/Makefile.boot
@@ -1,2 +1,2 @@
1 zreladdr-y := 0xa0008000 1 zreladdr-y += 0xa0008000
2 2
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
index b6a51340270..d940e8a7227 100644
--- a/arch/arm/mach-pxa/cm-x300.c
+++ b/arch/arm/mach-pxa/cm-x300.c
@@ -839,8 +839,8 @@ static void __init cm_x300_init(void)
839 cm_x300_init_bl(); 839 cm_x300_init_bl();
840} 840}
841 841
842static void __init cm_x300_fixup(struct machine_desc *mdesc, struct tag *tags, 842static void __init cm_x300_fixup(struct tag *tags, char **cmdline,
843 char **cmdline, struct meminfo *mi) 843 struct meminfo *mi)
844{ 844{
845 /* Make sure that mi->bank[0].start = PHYS_ADDR */ 845 /* Make sure that mi->bank[0].start = PHYS_ADDR */
846 for (; tags->hdr.size; tags = tag_next(tags)) 846 for (; tags->hdr.size; tags = tag_next(tags))
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 185a37cad25..3e9483b0605 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -705,8 +705,8 @@ static void __init corgi_init(void)
705 platform_add_devices(devices, ARRAY_SIZE(devices)); 705 platform_add_devices(devices, ARRAY_SIZE(devices));
706} 706}
707 707
708static void __init fixup_corgi(struct machine_desc *desc, 708static void __init fixup_corgi(struct tag *tags, char **cmdline,
709 struct tag *tags, char **cmdline, struct meminfo *mi) 709 struct meminfo *mi)
710{ 710{
711 sharpsl_save_param(); 711 sharpsl_save_param();
712 mi->nr_banks=1; 712 mi->nr_banks=1;
diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c
index b4599ec9d61..e4a1f4dc89f 100644
--- a/arch/arm/mach-pxa/eseries.c
+++ b/arch/arm/mach-pxa/eseries.c
@@ -41,8 +41,7 @@
41#include "clock.h" 41#include "clock.h"
42 42
43/* Only e800 has 128MB RAM */ 43/* Only e800 has 128MB RAM */
44void __init eseries_fixup(struct machine_desc *desc, 44void __init eseries_fixup(struct tag *tags, char **cmdline, struct meminfo *mi)
45 struct tag *tags, char **cmdline, struct meminfo *mi)
46{ 45{
47 mi->nr_banks=1; 46 mi->nr_banks=1;
48 mi->bank[0].start = 0xa0000000; 47 mi->bank[0].start = 0xa0000000;
diff --git a/arch/arm/mach-pxa/eseries.h b/arch/arm/mach-pxa/eseries.h
index 5930f5e2a12..be921965e91 100644
--- a/arch/arm/mach-pxa/eseries.h
+++ b/arch/arm/mach-pxa/eseries.h
@@ -1,5 +1,4 @@
1void __init eseries_fixup(struct machine_desc *desc, 1void __init eseries_fixup(struct tag *tags, char **cmdline, struct meminfo *mi);
2 struct tag *tags, char **cmdline, struct meminfo *mi);
3 2
4extern struct pxa2xx_udc_mach_info e7xx_udc_mach_info; 3extern struct pxa2xx_udc_mach_info e7xx_udc_mach_info;
5extern struct pxaficp_platform_data e7xx_ficp_platform_data; 4extern struct pxaficp_platform_data e7xx_ficp_platform_data;
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index b09e848eb6c..ca607571782 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -19,6 +19,8 @@
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/irq.h> 20#include <linux/irq.h>
21 21
22#include <asm/exception.h>
23
22#include <mach/hardware.h> 24#include <mach/hardware.h>
23#include <mach/irqs.h> 25#include <mach/irqs.h>
24#include <mach/gpio.h> 26#include <mach/gpio.h>
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index a113ea9ab4a..948ce3e729f 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -454,8 +454,8 @@ static void __init poodle_init(void)
454 poodle_init_spi(); 454 poodle_init_spi();
455} 455}
456 456
457static void __init fixup_poodle(struct machine_desc *desc, 457static void __init fixup_poodle(struct tag *tags, char **cmdline,
458 struct tag *tags, char **cmdline, struct meminfo *mi) 458 struct meminfo *mi)
459{ 459{
460 sharpsl_save_param(); 460 sharpsl_save_param();
461 mi->nr_banks=1; 461 mi->nr_banks=1;
diff --git a/arch/arm/mach-pxa/saar.c b/arch/arm/mach-pxa/saar.c
index df4356e8aca..72001ec6e7b 100644
--- a/arch/arm/mach-pxa/saar.c
+++ b/arch/arm/mach-pxa/saar.c
@@ -540,7 +540,7 @@ static struct mtd_partition saar_onenand_partitions[] = {
540 }, { 540 }, {
541 .name = "filesystem", 541 .name = "filesystem",
542 .offset = MTDPART_OFS_APPEND, 542 .offset = MTDPART_OFS_APPEND,
543 .size = SZ_48M, 543 .size = SZ_32M + SZ_16M,
544 .mask_flags = 0, 544 .mask_flags = 0,
545 } 545 }
546}; 546};
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 438c7b5e451..d8dec9113aa 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -970,8 +970,8 @@ static void __init spitz_init(void)
970 spitz_i2c_init(); 970 spitz_i2c_init();
971} 971}
972 972
973static void __init spitz_fixup(struct machine_desc *desc, 973static void __init spitz_fixup(struct tag *tags, char **cmdline,
974 struct tag *tags, char **cmdline, struct meminfo *mi) 974 struct meminfo *mi)
975{ 975{
976 sharpsl_save_param(); 976 sharpsl_save_param();
977 mi->nr_banks = 1; 977 mi->nr_banks = 1;
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 9f69a268269..402b0c96613 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -960,8 +960,8 @@ static void __init tosa_init(void)
960 platform_add_devices(devices, ARRAY_SIZE(devices)); 960 platform_add_devices(devices, ARRAY_SIZE(devices));
961} 961}
962 962
963static void __init fixup_tosa(struct machine_desc *desc, 963static void __init fixup_tosa(struct tag *tags, char **cmdline,
964 struct tag *tags, char **cmdline, struct meminfo *mi) 964 struct meminfo *mi)
965{ 965{
966 sharpsl_save_param(); 966 sharpsl_save_param();
967 mi->nr_banks=1; 967 mi->nr_banks=1;
diff --git a/arch/arm/mach-pxa/xcep.c b/arch/arm/mach-pxa/xcep.c
index acc600f5e72..937c42845df 100644
--- a/arch/arm/mach-pxa/xcep.c
+++ b/arch/arm/mach-pxa/xcep.c
@@ -142,8 +142,7 @@ static struct platform_device *devices[] __initdata = {
142 142
143/* We have to state that there are HWMON devices on the I2C bus on XCEP. 143/* We have to state that there are HWMON devices on the I2C bus on XCEP.
144 * Drivers for HWMON verify capabilities of the adapter when loading and 144 * Drivers for HWMON verify capabilities of the adapter when loading and
145 * refuse to attach if the adapter doesn't support HWMON class of devices. 145 * refuse to attach if the adapter doesn't support HWMON class of devices. */
146 * See also Documentation/i2c/porting-clients. */
147static struct i2c_pxa_platform_data xcep_i2c_platform_data = { 146static struct i2c_pxa_platform_data xcep_i2c_platform_data = {
148 .class = I2C_CLASS_HWMON 147 .class = I2C_CLASS_HWMON
149}; 148};
diff --git a/arch/arm/mach-realview/Makefile.boot b/arch/arm/mach-realview/Makefile.boot
index d97e003d3df..d2c3d788f68 100644
--- a/arch/arm/mach-realview/Makefile.boot
+++ b/arch/arm/mach-realview/Makefile.boot
@@ -1,9 +1,9 @@
1ifeq ($(CONFIG_REALVIEW_HIGH_PHYS_OFFSET),y) 1ifeq ($(CONFIG_REALVIEW_HIGH_PHYS_OFFSET),y)
2 zreladdr-y := 0x70008000 2 zreladdr-y += 0x70008000
3params_phys-y := 0x70000100 3params_phys-y := 0x70000100
4initrd_phys-y := 0x70800000 4initrd_phys-y := 0x70800000
5else 5else
6 zreladdr-y := 0x00008000 6 zreladdr-y += 0x00008000
7params_phys-y := 0x00000100 7params_phys-y := 0x00000100
8initrd_phys-y := 0x00800000 8initrd_phys-y := 0x00800000
9endif 9endif
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 5c23450d2d1..d5ed5d4f77d 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -517,8 +517,7 @@ void __init realview_timer_init(unsigned int timer_irq)
517/* 517/*
518 * Setup the memory banks. 518 * Setup the memory banks.
519 */ 519 */
520void realview_fixup(struct machine_desc *mdesc, struct tag *tags, char **from, 520void realview_fixup(struct tag *tags, char **from, struct meminfo *meminfo)
521 struct meminfo *meminfo)
522{ 521{
523 /* 522 /*
524 * Most RealView platforms have 512MB contiguous RAM at 0x70000000. 523 * Most RealView platforms have 512MB contiguous RAM at 0x70000000.
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
index 5c83d1e87a0..47259c89a75 100644
--- a/arch/arm/mach-realview/core.h
+++ b/arch/arm/mach-realview/core.h
@@ -63,8 +63,8 @@ extern int realview_flash_register(struct resource *res, u32 num);
63extern int realview_eth_register(const char *name, struct resource *res); 63extern int realview_eth_register(const char *name, struct resource *res);
64extern int realview_usb_register(struct resource *res); 64extern int realview_usb_register(struct resource *res);
65extern void realview_init_early(void); 65extern void realview_init_early(void);
66extern void realview_fixup(struct machine_desc *mdesc, struct tag *tags, 66extern void realview_fixup(struct tag *tags, char **from,
67 char **from, struct meminfo *meminfo); 67 struct meminfo *meminfo);
68extern void (*realview_reset)(char); 68extern void (*realview_reset)(char);
69 69
70#endif 70#endif
diff --git a/arch/arm/mach-realview/include/mach/board-pb1176.h b/arch/arm/mach-realview/include/mach/board-pb1176.h
index 002ab5d8c11..2a15fef9473 100644
--- a/arch/arm/mach-realview/include/mach/board-pb1176.h
+++ b/arch/arm/mach-realview/include/mach/board-pb1176.h
@@ -70,6 +70,7 @@
70 70
71#define REALVIEW_DC1176_GIC_CPU_BASE 0x10120000 /* GIC CPU interface, on devchip */ 71#define REALVIEW_DC1176_GIC_CPU_BASE 0x10120000 /* GIC CPU interface, on devchip */
72#define REALVIEW_DC1176_GIC_DIST_BASE 0x10121000 /* GIC distributor, on devchip */ 72#define REALVIEW_DC1176_GIC_DIST_BASE 0x10121000 /* GIC distributor, on devchip */
73#define REALVIEW_DC1176_ROM_BASE 0x10200000 /* 16KiB NRAM preudo-ROM, on devchip */
73#define REALVIEW_PB1176_GIC_CPU_BASE 0x10040000 /* GIC CPU interface, on FPGA */ 74#define REALVIEW_PB1176_GIC_CPU_BASE 0x10040000 /* GIC CPU interface, on FPGA */
74#define REALVIEW_PB1176_GIC_DIST_BASE 0x10041000 /* GIC distributor, on FPGA */ 75#define REALVIEW_PB1176_GIC_DIST_BASE 0x10041000 /* GIC distributor, on FPGA */
75#define REALVIEW_PB1176_L220_BASE 0x10110000 /* L220 registers */ 76#define REALVIEW_PB1176_L220_BASE 0x10110000 /* L220 registers */
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c
index 4ae943bafa9..e83c654a58d 100644
--- a/arch/arm/mach-realview/platsmp.c
+++ b/arch/arm/mach-realview/platsmp.c
@@ -52,12 +52,10 @@ void __init smp_init_cpus(void)
52 ncores = scu_base ? scu_get_core_count(scu_base) : 1; 52 ncores = scu_base ? scu_get_core_count(scu_base) : 1;
53 53
54 /* sanity check */ 54 /* sanity check */
55 if (ncores > NR_CPUS) { 55 if (ncores > nr_cpu_ids) {
56 printk(KERN_WARNING 56 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
57 "Realview: no. of cores (%d) greater than configured " 57 ncores, nr_cpu_ids);
58 "maximum of %d - clipping\n", 58 ncores = nr_cpu_ids;
59 ncores, NR_CPUS);
60 ncores = NR_CPUS;
61 } 59 }
62 60
63 for (i = 0; i < ncores; i++) 61 for (i = 0; i < ncores; i++)
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index ad5671acb66..865d440fcf5 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -26,6 +26,8 @@
26#include <linux/amba/pl061.h> 26#include <linux/amba/pl061.h>
27#include <linux/amba/mmci.h> 27#include <linux/amba/mmci.h>
28#include <linux/amba/pl022.h> 28#include <linux/amba/pl022.h>
29#include <linux/mtd/physmap.h>
30#include <linux/mtd/partitions.h>
29#include <linux/io.h> 31#include <linux/io.h>
30 32
31#include <mach/hardware.h> 33#include <mach/hardware.h>
@@ -204,22 +206,48 @@ static struct amba_device *amba_devs[] __initdata = {
204 * RealView PB1176 platform devices 206 * RealView PB1176 platform devices
205 */ 207 */
206static struct resource realview_pb1176_flash_resources[] = { 208static struct resource realview_pb1176_flash_resources[] = {
207 [0] = { 209 {
208 .start = REALVIEW_PB1176_FLASH_BASE, 210 .start = REALVIEW_PB1176_FLASH_BASE,
209 .end = REALVIEW_PB1176_FLASH_BASE + REALVIEW_PB1176_FLASH_SIZE - 1, 211 .end = REALVIEW_PB1176_FLASH_BASE + REALVIEW_PB1176_FLASH_SIZE - 1,
210 .flags = IORESOURCE_MEM, 212 .flags = IORESOURCE_MEM,
211 }, 213 },
212 [1] = { 214#ifdef CONFIG_REALVIEW_PB1176_SECURE_FLASH
215 {
213 .start = REALVIEW_PB1176_SEC_FLASH_BASE, 216 .start = REALVIEW_PB1176_SEC_FLASH_BASE,
214 .end = REALVIEW_PB1176_SEC_FLASH_BASE + REALVIEW_PB1176_SEC_FLASH_SIZE - 1, 217 .end = REALVIEW_PB1176_SEC_FLASH_BASE + REALVIEW_PB1176_SEC_FLASH_SIZE - 1,
215 .flags = IORESOURCE_MEM, 218 .flags = IORESOURCE_MEM,
216 }, 219 },
217};
218#ifdef CONFIG_REALVIEW_PB1176_SECURE_FLASH
219#define PB1176_FLASH_BLOCKS 2
220#else
221#define PB1176_FLASH_BLOCKS 1
222#endif 220#endif
221};
222
223static struct physmap_flash_data pb1176_rom_pdata = {
224 .probe_type = "map_rom",
225 .width = 4,
226 .nr_parts = 0,
227};
228
229static struct resource pb1176_rom_resources[] = {
230 /*
231 * This exposes the PB1176 DevChip ROM as an MTD ROM mapping.
232 * The reference manual states that this is actually a pseudo-ROM
233 * programmed in NVRAM.
234 */
235 {
236 .start = REALVIEW_DC1176_ROM_BASE,
237 .end = REALVIEW_DC1176_ROM_BASE + SZ_16K - 1,
238 .flags = IORESOURCE_MEM,
239 }
240};
241
242static struct platform_device pb1176_rom_device = {
243 .name = "physmap-flash",
244 .id = -1,
245 .num_resources = ARRAY_SIZE(pb1176_rom_resources),
246 .resource = pb1176_rom_resources,
247 .dev = {
248 .platform_data = &pb1176_rom_pdata,
249 },
250};
223 251
224static struct resource realview_pb1176_smsc911x_resources[] = { 252static struct resource realview_pb1176_smsc911x_resources[] = {
225 [0] = { 253 [0] = {
@@ -316,8 +344,7 @@ static void realview_pb1176_reset(char mode)
316 __raw_writel(REALVIEW_PB1176_SYS_SOFT_RESET, reset_ctrl); 344 __raw_writel(REALVIEW_PB1176_SYS_SOFT_RESET, reset_ctrl);
317} 345}
318 346
319static void realview_pb1176_fixup(struct machine_desc *mdesc, 347static void realview_pb1176_fixup(struct tag *tags, char **from,
320 struct tag *tags, char **from,
321 struct meminfo *meminfo) 348 struct meminfo *meminfo)
322{ 349{
323 /* 350 /*
@@ -338,7 +365,8 @@ static void __init realview_pb1176_init(void)
338#endif 365#endif
339 366
340 realview_flash_register(realview_pb1176_flash_resources, 367 realview_flash_register(realview_pb1176_flash_resources,
341 PB1176_FLASH_BLOCKS); 368 ARRAY_SIZE(realview_pb1176_flash_resources));
369 platform_device_register(&pb1176_rom_device);
342 realview_eth_register(NULL, realview_pb1176_smsc911x_resources); 370 realview_eth_register(NULL, realview_pb1176_smsc911x_resources);
343 platform_device_register(&realview_i2c_device); 371 platform_device_register(&realview_i2c_device);
344 realview_usb_register(realview_pb1176_isp1761_resources); 372 realview_usb_register(realview_pb1176_isp1761_resources);
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c
index 363b0ab5615..3e1eb2eb813 100644
--- a/arch/arm/mach-realview/realview_pbx.c
+++ b/arch/arm/mach-realview/realview_pbx.c
@@ -319,8 +319,8 @@ static struct sys_timer realview_pbx_timer = {
319 .init = realview_pbx_timer_init, 319 .init = realview_pbx_timer_init,
320}; 320};
321 321
322static void realview_pbx_fixup(struct machine_desc *mdesc, struct tag *tags, 322static void realview_pbx_fixup(struct tag *tags, char **from,
323 char **from, struct meminfo *meminfo) 323 struct meminfo *meminfo)
324{ 324{
325#ifdef CONFIG_SPARSEMEM 325#ifdef CONFIG_SPARSEMEM
326 /* 326 /*
@@ -335,7 +335,7 @@ static void realview_pbx_fixup(struct machine_desc *mdesc, struct tag *tags,
335 meminfo->bank[2].size = SZ_256M; 335 meminfo->bank[2].size = SZ_256M;
336 meminfo->nr_banks = 3; 336 meminfo->nr_banks = 3;
337#else 337#else
338 realview_fixup(mdesc, tags, from, meminfo); 338 realview_fixup(tags, from, meminfo);
339#endif 339#endif
340} 340}
341 341
diff --git a/arch/arm/mach-rpc/Makefile.boot b/arch/arm/mach-rpc/Makefile.boot
index 9c9e7685ec7..ae2df0d7d03 100644
--- a/arch/arm/mach-rpc/Makefile.boot
+++ b/arch/arm/mach-rpc/Makefile.boot
@@ -1,4 +1,4 @@
1 zreladdr-y := 0x10008000 1 zreladdr-y += 0x10008000
2params_phys-y := 0x10000100 2params_phys-y := 0x10000100
3initrd_phys-y := 0x18000000 3initrd_phys-y := 0x18000000
4 4
diff --git a/arch/arm/mach-rpc/include/mach/hardware.h b/arch/arm/mach-rpc/include/mach/hardware.h
index dde6b3c0e29..050d63c74cc 100644
--- a/arch/arm/mach-rpc/include/mach/hardware.h
+++ b/arch/arm/mach-rpc/include/mach/hardware.h
@@ -36,7 +36,7 @@
36 36
37#define EASI_SIZE 0x08000000 /* EASI I/O */ 37#define EASI_SIZE 0x08000000 /* EASI I/O */
38#define EASI_START 0x08000000 38#define EASI_START 0x08000000
39#define EASI_BASE 0xe5000000 39#define EASI_BASE IOMEM(0xe5000000)
40 40
41#define IO_START 0x03000000 /* I/O */ 41#define IO_START 0x03000000 /* I/O */
42#define IO_SIZE 0x01000000 42#define IO_SIZE 0x01000000
@@ -51,21 +51,20 @@
51/* 51/*
52 * IO Addresses 52 * IO Addresses
53 */ 53 */
54#define VIDC_BASE IOMEM(0xe0400000) 54#define ECARD_EASI_BASE (EASI_BASE)
55#define EXPMASK_BASE 0xe0360000 55#define VIDC_BASE (IO_BASE + 0x00400000)
56#define IOMD_BASE IOMEM(0xe0200000) 56#define EXPMASK_BASE (IO_BASE + 0x00360000)
57#define IOC_BASE IOMEM(0xe0200000) 57#define ECARD_IOC4_BASE (IO_BASE + 0x00270000)
58#define PCIO_BASE IOMEM(0xe0010000) 58#define ECARD_IOC_BASE (IO_BASE + 0x00240000)
59#define FLOPPYDMA_BASE IOMEM(0xe002a000) 59#define IOMD_BASE (IO_BASE + 0x00200000)
60#define IOC_BASE (IO_BASE + 0x00200000)
61#define ECARD_MEMC8_BASE (IO_BASE + 0x0002b000)
62#define FLOPPYDMA_BASE (IO_BASE + 0x0002a000)
63#define PCIO_BASE (IO_BASE + 0x00010000)
64#define ECARD_MEMC_BASE (IO_BASE + 0x00000000)
60 65
61#define vidc_writel(val) __raw_writel(val, VIDC_BASE) 66#define vidc_writel(val) __raw_writel(val, VIDC_BASE)
62 67
63#define IO_EC_EASI_BASE 0x81400000
64#define IO_EC_IOC4_BASE 0x8009c000
65#define IO_EC_IOC_BASE 0x80090000
66#define IO_EC_MEMC8_BASE 0x8000ac00
67#define IO_EC_MEMC_BASE 0x80000000
68
69#define NETSLOT_BASE 0x0302b000 68#define NETSLOT_BASE 0x0302b000
70#define NETSLOT_SIZE 0x00001000 69#define NETSLOT_SIZE 0x00001000
71 70
diff --git a/arch/arm/mach-rpc/include/mach/io.h b/arch/arm/mach-rpc/include/mach/io.h
index 20da7f486e5..695f4ed2e11 100644
--- a/arch/arm/mach-rpc/include/mach/io.h
+++ b/arch/arm/mach-rpc/include/mach/io.h
@@ -15,195 +15,18 @@
15 15
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17 17
18#define IO_SPACE_LIMIT 0xffffffff 18#define IO_SPACE_LIMIT 0xffff
19 19
20/* 20/*
21 * We use two different types of addressing - PC style addresses, and ARM 21 * We need PC style IO addressing for:
22 * addresses. PC style accesses the PC hardware with the normal PC IO 22 * - floppy (at 0x3f2,0x3f4,0x3f5,0x3f7)
23 * addresses, eg 0x3f8 for serial#1. ARM addresses are 0x80000000+ 23 * - parport (at 0x278-0x27a, 0x27b-0x27f, 0x778-0x77a)
24 * and are translated to the start of IO. Note that all addresses are 24 * - 8250 serial (only for compile)
25 * shifted left!
26 */
27#define __PORT_PCIO(x) (!((x) & 0x80000000))
28
29/*
30 * Dynamic IO functions.
31 */
32static inline void __outb (unsigned int value, unsigned int port)
33{
34 unsigned long temp;
35 __asm__ __volatile__(
36 "tst %2, #0x80000000\n\t"
37 "mov %0, %4\n\t"
38 "addeq %0, %0, %3\n\t"
39 "strb %1, [%0, %2, lsl #2] @ outb"
40 : "=&r" (temp)
41 : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
42 : "cc");
43}
44
45static inline void __outw (unsigned int value, unsigned int port)
46{
47 unsigned long temp;
48 __asm__ __volatile__(
49 "tst %2, #0x80000000\n\t"
50 "mov %0, %4\n\t"
51 "addeq %0, %0, %3\n\t"
52 "str %1, [%0, %2, lsl #2] @ outw"
53 : "=&r" (temp)
54 : "r" (value|value<<16), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
55 : "cc");
56}
57
58static inline void __outl (unsigned int value, unsigned int port)
59{
60 unsigned long temp;
61 __asm__ __volatile__(
62 "tst %2, #0x80000000\n\t"
63 "mov %0, %4\n\t"
64 "addeq %0, %0, %3\n\t"
65 "str %1, [%0, %2, lsl #2] @ outl"
66 : "=&r" (temp)
67 : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
68 : "cc");
69}
70
71#define DECLARE_DYN_IN(sz,fnsuffix,instr) \
72static inline unsigned sz __in##fnsuffix (unsigned int port) \
73{ \
74 unsigned long temp, value; \
75 __asm__ __volatile__( \
76 "tst %2, #0x80000000\n\t" \
77 "mov %0, %4\n\t" \
78 "addeq %0, %0, %3\n\t" \
79 "ldr" instr " %1, [%0, %2, lsl #2] @ in" #fnsuffix \
80 : "=&r" (temp), "=r" (value) \
81 : "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) \
82 : "cc"); \
83 return (unsigned sz)value; \
84}
85
86static inline void __iomem *__deprecated __ioaddr(unsigned int port)
87{
88 void __iomem *ret;
89 if (__PORT_PCIO(port))
90 ret = PCIO_BASE;
91 else
92 ret = IO_BASE;
93 return ret + (port << 2);
94}
95
96#define DECLARE_IO(sz,fnsuffix,instr) \
97 DECLARE_DYN_IN(sz,fnsuffix,instr)
98
99DECLARE_IO(char,b,"b")
100DECLARE_IO(short,w,"")
101DECLARE_IO(int,l,"")
102
103#undef DECLARE_IO
104#undef DECLARE_DYN_IN
105
106/*
107 * Constant address IO functions
108 * 25 *
109 * These have to be macros for the 'J' constraint to work - 26 * These peripherals are found in an area of MMIO which looks very much
110 * +/-4096 immediate operand. 27 * like an ISA bus, but with registers at the low byte of each word.
111 */ 28 */
112#define __outbc(value,port) \ 29#define __io(a) (PCIO_BASE + ((a) << 2))
113({ \
114 if (__PORT_PCIO((port))) \
115 __asm__ __volatile__( \
116 "strb %0, [%1, %2] @ outbc" \
117 : : "r" (value), "r" (PCIO_BASE), "Jr" ((port) << 2)); \
118 else \
119 __asm__ __volatile__( \
120 "strb %0, [%1, %2] @ outbc" \
121 : : "r" (value), "r" (IO_BASE), "r" ((port) << 2)); \
122})
123
124#define __inbc(port) \
125({ \
126 unsigned char result; \
127 if (__PORT_PCIO((port))) \
128 __asm__ __volatile__( \
129 "ldrb %0, [%1, %2] @ inbc" \
130 : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
131 else \
132 __asm__ __volatile__( \
133 "ldrb %0, [%1, %2] @ inbc" \
134 : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
135 result; \
136})
137
138#define __outwc(value,port) \
139({ \
140 unsigned long __v = value; \
141 if (__PORT_PCIO((port))) \
142 __asm__ __volatile__( \
143 "str %0, [%1, %2] @ outwc" \
144 : : "r" (__v|__v<<16), "r" (PCIO_BASE), "Jr" ((port) << 2)); \
145 else \
146 __asm__ __volatile__( \
147 "str %0, [%1, %2] @ outwc" \
148 : : "r" (__v|__v<<16), "r" (IO_BASE), "r" ((port) << 2)); \
149})
150
151#define __inwc(port) \
152({ \
153 unsigned short result; \
154 if (__PORT_PCIO((port))) \
155 __asm__ __volatile__( \
156 "ldr %0, [%1, %2] @ inwc" \
157 : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
158 else \
159 __asm__ __volatile__( \
160 "ldr %0, [%1, %2] @ inwc" \
161 : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
162 result & 0xffff; \
163})
164
165#define __outlc(value,port) \
166({ \
167 unsigned long __v = value; \
168 if (__PORT_PCIO((port))) \
169 __asm__ __volatile__( \
170 "str %0, [%1, %2] @ outlc" \
171 : : "r" (__v), "r" (PCIO_BASE), "Jr" ((port) << 2)); \
172 else \
173 __asm__ __volatile__( \
174 "str %0, [%1, %2] @ outlc" \
175 : : "r" (__v), "r" (IO_BASE), "r" ((port) << 2)); \
176})
177
178#define __inlc(port) \
179({ \
180 unsigned long result; \
181 if (__PORT_PCIO((port))) \
182 __asm__ __volatile__( \
183 "ldr %0, [%1, %2] @ inlc" \
184 : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
185 else \
186 __asm__ __volatile__( \
187 "ldr %0, [%1, %2] @ inlc" \
188 : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
189 result; \
190})
191
192#define inb(p) (__builtin_constant_p((p)) ? __inbc(p) : __inb(p))
193#define inw(p) (__builtin_constant_p((p)) ? __inwc(p) : __inw(p))
194#define inl(p) (__builtin_constant_p((p)) ? __inlc(p) : __inl(p))
195#define outb(v,p) (__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p))
196#define outw(v,p) (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p))
197#define outl(v,p) (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p))
198
199/* the following macro is deprecated */
200#define ioaddr(port) ((unsigned long)__ioaddr((port)))
201
202#define insb(p,d,l) __raw_readsb(__ioaddr(p),d,l)
203#define insw(p,d,l) __raw_readsw(__ioaddr(p),d,l)
204
205#define outsb(p,d,l) __raw_writesb(__ioaddr(p),d,l)
206#define outsw(p,d,l) __raw_writesw(__ioaddr(p),d,l)
207 30
208/* 31/*
209 * 1:1 mapping for ioremapped regions. 32 * 1:1 mapping for ioremapped regions.
diff --git a/arch/arm/mach-rpc/riscpc.c b/arch/arm/mach-rpc/riscpc.c
index 580b3c73d2c..1e0e60d0462 100644
--- a/arch/arm/mach-rpc/riscpc.c
+++ b/arch/arm/mach-rpc/riscpc.c
@@ -74,7 +74,7 @@ static struct map_desc rpc_io_desc[] __initdata = {
74 .length = IO_SIZE , 74 .length = IO_SIZE ,
75 .type = MT_DEVICE 75 .type = MT_DEVICE
76 }, { /* EASI space */ 76 }, { /* EASI space */
77 .virtual = EASI_BASE, 77 .virtual = (unsigned long)EASI_BASE,
78 .pfn = __phys_to_pfn(EASI_START), 78 .pfn = __phys_to_pfn(EASI_START),
79 .length = EASI_SIZE, 79 .length = EASI_SIZE,
80 .type = MT_DEVICE 80 .type = MT_DEVICE
diff --git a/arch/arm/mach-s3c2410/Makefile.boot b/arch/arm/mach-s3c2410/Makefile.boot
index 58c1dd7f8e1..4457605ba04 100644
--- a/arch/arm/mach-s3c2410/Makefile.boot
+++ b/arch/arm/mach-s3c2410/Makefile.boot
@@ -1,7 +1,7 @@
1ifeq ($(CONFIG_PM_H1940),y) 1ifeq ($(CONFIG_PM_H1940),y)
2 zreladdr-y := 0x30108000 2 zreladdr-y += 0x30108000
3 params_phys-y := 0x30100100 3 params_phys-y := 0x30100100
4else 4else
5 zreladdr-y := 0x30008000 5 zreladdr-y += 0x30008000
6 params_phys-y := 0x30000100 6 params_phys-y := 0x30000100
7endif 7endif
diff --git a/arch/arm/mach-s3c2410/include/mach/io.h b/arch/arm/mach-s3c2410/include/mach/io.h
index 9813dbf2ae4..118749f37c4 100644
--- a/arch/arm/mach-s3c2410/include/mach/io.h
+++ b/arch/arm/mach-s3c2410/include/mach/io.h
@@ -199,8 +199,6 @@ DECLARE_IO(int,l,"")
199#define outw(v,p) (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p)) 199#define outw(v,p) (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p))
200#define outl(v,p) (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p)) 200#define outl(v,p) (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p))
201#define __ioaddr(p) (__builtin_constant_p((p)) ? __ioaddr(p) : __ioaddrc(p)) 201#define __ioaddr(p) (__builtin_constant_p((p)) ? __ioaddr(p) : __ioaddrc(p))
202/* the following macro is deprecated */
203#define ioaddr(port) __ioaddr((port))
204 202
205#define insb(p,d,l) __raw_readsb(__ioaddr(p),d,l) 203#define insb(p,d,l) __raw_readsb(__ioaddr(p),d,l)
206#define insw(p,d,l) __raw_readsw(__ioaddr(p),d,l) 204#define insw(p,d,l) __raw_readsw(__ioaddr(p),d,l)
diff --git a/arch/arm/mach-s3c2410/s3c2410.c b/arch/arm/mach-s3c2410/s3c2410.c
index f1d3bd8f6f1..343a540d86a 100644
--- a/arch/arm/mach-s3c2410/s3c2410.c
+++ b/arch/arm/mach-s3c2410/s3c2410.c
@@ -170,7 +170,9 @@ int __init s3c2410_init(void)
170{ 170{
171 printk("S3C2410: Initialising architecture\n"); 171 printk("S3C2410: Initialising architecture\n");
172 172
173#ifdef CONFIG_PM
173 register_syscore_ops(&s3c2410_pm_syscore_ops); 174 register_syscore_ops(&s3c2410_pm_syscore_ops);
175#endif
174 register_syscore_ops(&s3c24xx_irq_syscore_ops); 176 register_syscore_ops(&s3c24xx_irq_syscore_ops);
175 177
176 return sysdev_register(&s3c2410_sysdev); 178 return sysdev_register(&s3c2410_sysdev);
diff --git a/arch/arm/mach-s3c2412/mach-smdk2413.c b/arch/arm/mach-s3c2412/mach-smdk2413.c
index 834cfb61bcf..3391713e0c9 100644
--- a/arch/arm/mach-s3c2412/mach-smdk2413.c
+++ b/arch/arm/mach-s3c2412/mach-smdk2413.c
@@ -92,8 +92,7 @@ static struct platform_device *smdk2413_devices[] __initdata = {
92 &s3c_device_usbgadget, 92 &s3c_device_usbgadget,
93}; 93};
94 94
95static void __init smdk2413_fixup(struct machine_desc *desc, 95static void __init smdk2413_fixup(struct tag *tags, char **cmdline,
96 struct tag *tags, char **cmdline,
97 struct meminfo *mi) 96 struct meminfo *mi)
98{ 97{
99 if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) { 98 if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) {
diff --git a/arch/arm/mach-s3c2412/mach-vstms.c b/arch/arm/mach-s3c2412/mach-vstms.c
index 83544ebe20a..b6ed4573553 100644
--- a/arch/arm/mach-s3c2412/mach-vstms.c
+++ b/arch/arm/mach-s3c2412/mach-vstms.c
@@ -129,9 +129,8 @@ static struct platform_device *vstms_devices[] __initdata = {
129 &s3c_device_nand, 129 &s3c_device_nand,
130}; 130};
131 131
132static void __init vstms_fixup(struct machine_desc *desc, 132static void __init vstms_fixup(struct tag *tags, char **cmdline,
133 struct tag *tags, char **cmdline, 133 struct meminfo *mi)
134 struct meminfo *mi)
135{ 134{
136 if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) { 135 if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) {
137 mi->nr_banks=1; 136 mi->nr_banks=1;
diff --git a/arch/arm/mach-s3c2412/s3c2412.c b/arch/arm/mach-s3c2412/s3c2412.c
index ef0958d3e5c..57a1e01e4e5 100644
--- a/arch/arm/mach-s3c2412/s3c2412.c
+++ b/arch/arm/mach-s3c2412/s3c2412.c
@@ -245,7 +245,9 @@ int __init s3c2412_init(void)
245{ 245{
246 printk("S3C2412: Initialising architecture\n"); 246 printk("S3C2412: Initialising architecture\n");
247 247
248#ifdef CONFIG_PM
248 register_syscore_ops(&s3c2412_pm_syscore_ops); 249 register_syscore_ops(&s3c2412_pm_syscore_ops);
250#endif
249 register_syscore_ops(&s3c24xx_irq_syscore_ops); 251 register_syscore_ops(&s3c24xx_irq_syscore_ops);
250 252
251 return sysdev_register(&s3c2412_sysdev); 253 return sysdev_register(&s3c2412_sysdev);
diff --git a/arch/arm/mach-s3c2416/s3c2416.c b/arch/arm/mach-s3c2416/s3c2416.c
index 494ce913dc9..20b3fdfb305 100644
--- a/arch/arm/mach-s3c2416/s3c2416.c
+++ b/arch/arm/mach-s3c2416/s3c2416.c
@@ -97,7 +97,9 @@ int __init s3c2416_init(void)
97 97
98 s3c_fb_setname("s3c2443-fb"); 98 s3c_fb_setname("s3c2443-fb");
99 99
100#ifdef CONFIG_PM
100 register_syscore_ops(&s3c2416_pm_syscore_ops); 101 register_syscore_ops(&s3c2416_pm_syscore_ops);
102#endif
101 register_syscore_ops(&s3c24xx_irq_syscore_ops); 103 register_syscore_ops(&s3c24xx_irq_syscore_ops);
102 104
103 return sysdev_register(&s3c2416_sysdev); 105 return sysdev_register(&s3c2416_sysdev);
diff --git a/arch/arm/mach-s3c2440/s3c2440.c b/arch/arm/mach-s3c2440/s3c2440.c
index ce99ff72838..2270d336021 100644
--- a/arch/arm/mach-s3c2440/s3c2440.c
+++ b/arch/arm/mach-s3c2440/s3c2440.c
@@ -55,7 +55,9 @@ int __init s3c2440_init(void)
55 55
56 /* register suspend/resume handlers */ 56 /* register suspend/resume handlers */
57 57
58#ifdef CONFIG_PM
58 register_syscore_ops(&s3c2410_pm_syscore_ops); 59 register_syscore_ops(&s3c2410_pm_syscore_ops);
60#endif
59 register_syscore_ops(&s3c244x_pm_syscore_ops); 61 register_syscore_ops(&s3c244x_pm_syscore_ops);
60 register_syscore_ops(&s3c24xx_irq_syscore_ops); 62 register_syscore_ops(&s3c24xx_irq_syscore_ops);
61 63
diff --git a/arch/arm/mach-s3c2440/s3c2442.c b/arch/arm/mach-s3c2440/s3c2442.c
index 9ad99f8016a..6f2b65e6e06 100644
--- a/arch/arm/mach-s3c2440/s3c2442.c
+++ b/arch/arm/mach-s3c2440/s3c2442.c
@@ -169,7 +169,9 @@ int __init s3c2442_init(void)
169{ 169{
170 printk("S3C2442: Initialising architecture\n"); 170 printk("S3C2442: Initialising architecture\n");
171 171
172#ifdef CONFIG_PM
172 register_syscore_ops(&s3c2410_pm_syscore_ops); 173 register_syscore_ops(&s3c2410_pm_syscore_ops);
174#endif
173 register_syscore_ops(&s3c244x_pm_syscore_ops); 175 register_syscore_ops(&s3c244x_pm_syscore_ops);
174 register_syscore_ops(&s3c24xx_irq_syscore_ops); 176 register_syscore_ops(&s3c24xx_irq_syscore_ops);
175 177
diff --git a/arch/arm/mach-s3c64xx/Makefile.boot b/arch/arm/mach-s3c64xx/Makefile.boot
index ba41fdc0a58..c642333af3e 100644
--- a/arch/arm/mach-s3c64xx/Makefile.boot
+++ b/arch/arm/mach-s3c64xx/Makefile.boot
@@ -1,2 +1,2 @@
1 zreladdr-y := 0x50008000 1 zreladdr-y += 0x50008000
2params_phys-y := 0x50000100 2params_phys-y := 0x50000100
diff --git a/arch/arm/mach-s3c64xx/dev-uart.c b/arch/arm/mach-s3c64xx/dev-uart.c
index f797f748b99..c681b99eda0 100644
--- a/arch/arm/mach-s3c64xx/dev-uart.c
+++ b/arch/arm/mach-s3c64xx/dev-uart.c
@@ -37,21 +37,10 @@ static struct resource s3c64xx_uart0_resource[] = {
37 .flags = IORESOURCE_MEM, 37 .flags = IORESOURCE_MEM,
38 }, 38 },
39 [1] = { 39 [1] = {
40 .start = IRQ_S3CUART_RX0, 40 .start = IRQ_UART0,
41 .end = IRQ_S3CUART_RX0, 41 .end = IRQ_UART0,
42 .flags = IORESOURCE_IRQ, 42 .flags = IORESOURCE_IRQ,
43 }, 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}; 44};
56 45
57static struct resource s3c64xx_uart1_resource[] = { 46static struct resource s3c64xx_uart1_resource[] = {
@@ -61,19 +50,8 @@ static struct resource s3c64xx_uart1_resource[] = {
61 .flags = IORESOURCE_MEM, 50 .flags = IORESOURCE_MEM,
62 }, 51 },
63 [1] = { 52 [1] = {
64 .start = IRQ_S3CUART_RX1, 53 .start = IRQ_UART1,
65 .end = IRQ_S3CUART_RX1, 54 .end = IRQ_UART1,
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, 55 .flags = IORESOURCE_IRQ,
78 }, 56 },
79}; 57};
@@ -85,19 +63,8 @@ static struct resource s3c6xx_uart2_resource[] = {
85 .flags = IORESOURCE_MEM, 63 .flags = IORESOURCE_MEM,
86 }, 64 },
87 [1] = { 65 [1] = {
88 .start = IRQ_S3CUART_RX2, 66 .start = IRQ_UART2,
89 .end = IRQ_S3CUART_RX2, 67 .end = IRQ_UART2,
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, 68 .flags = IORESOURCE_IRQ,
102 }, 69 },
103}; 70};
@@ -109,19 +76,8 @@ static struct resource s3c64xx_uart3_resource[] = {
109 .flags = IORESOURCE_MEM, 76 .flags = IORESOURCE_MEM,
110 }, 77 },
111 [1] = { 78 [1] = {
112 .start = IRQ_S3CUART_RX3, 79 .start = IRQ_UART3,
113 .end = IRQ_S3CUART_RX3, 80 .end = IRQ_UART3,
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, 81 .flags = IORESOURCE_IRQ,
126 }, 82 },
127}; 83};
diff --git a/arch/arm/mach-s3c64xx/include/mach/irqs.h b/arch/arm/mach-s3c64xx/include/mach/irqs.h
index c026f67a80d..443f85b3c20 100644
--- a/arch/arm/mach-s3c64xx/include/mach/irqs.h
+++ b/arch/arm/mach-s3c64xx/include/mach/irqs.h
@@ -27,36 +27,6 @@
27#define IRQ_VIC0_BASE S3C_IRQ(0) 27#define IRQ_VIC0_BASE S3C_IRQ(0)
28#define IRQ_VIC1_BASE S3C_IRQ(32) 28#define IRQ_VIC1_BASE S3C_IRQ(32)
29 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 */ 30/* VIC based IRQs */
61 31
62#define S3C64XX_IRQ_VIC0(x) (IRQ_VIC0_BASE + (x)) 32#define S3C64XX_IRQ_VIC0(x) (IRQ_VIC0_BASE + (x))
diff --git a/arch/arm/mach-s3c64xx/irq.c b/arch/arm/mach-s3c64xx/irq.c
index 75d9a0e4919..b07357e9495 100644
--- a/arch/arm/mach-s3c64xx/irq.c
+++ b/arch/arm/mach-s3c64xx/irq.c
@@ -25,29 +25,6 @@
25#include <plat/irq-uart.h> 25#include <plat/irq-uart.h>
26#include <plat/cpu.h> 26#include <plat/cpu.h>
27 27
28static struct s3c_uart_irq uart_irqs[] = {
29 [0] = {
30 .regs = S3C_VA_UART0,
31 .base_irq = IRQ_S3CUART_BASE0,
32 .parent_irq = IRQ_UART0,
33 },
34 [1] = {
35 .regs = S3C_VA_UART1,
36 .base_irq = IRQ_S3CUART_BASE1,
37 .parent_irq = IRQ_UART1,
38 },
39 [2] = {
40 .regs = S3C_VA_UART2,
41 .base_irq = IRQ_S3CUART_BASE2,
42 .parent_irq = IRQ_UART2,
43 },
44 [3] = {
45 .regs = S3C_VA_UART3,
46 .base_irq = IRQ_S3CUART_BASE3,
47 .parent_irq = IRQ_UART3,
48 },
49};
50
51/* setup the sources the vic should advertise resume for, even though it 28/* setup the sources the vic should advertise resume for, even though it
52 * is not doing the wake (set_irq_wake needs to be valid) */ 29 * is not doing the wake (set_irq_wake needs to be valid) */
53#define IRQ_VIC0_RESUME (1 << (IRQ_RTC_TIC - IRQ_VIC0_BASE)) 30#define IRQ_VIC0_RESUME (1 << (IRQ_RTC_TIC - IRQ_VIC0_BASE))
@@ -67,6 +44,4 @@ void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid)
67 44
68 /* add the timer sub-irqs */ 45 /* add the timer sub-irqs */
69 s3c_init_vic_timer_irq(5, IRQ_TIMER0); 46 s3c_init_vic_timer_irq(5, IRQ_TIMER0);
70
71 s3c_init_uart_irqs(uart_irqs, ARRAY_SIZE(uart_irqs));
72} 47}
diff --git a/arch/arm/mach-s5p64x0/Makefile.boot b/arch/arm/mach-s5p64x0/Makefile.boot
index ff90aa13bd6..79ece4055b0 100644
--- a/arch/arm/mach-s5p64x0/Makefile.boot
+++ b/arch/arm/mach-s5p64x0/Makefile.boot
@@ -1,2 +1,2 @@
1 zreladdr-y := 0x20008000 1 zreladdr-y += 0x20008000
2params_phys-y := 0x20000100 2params_phys-y := 0x20000100
diff --git a/arch/arm/mach-s5pc100/Makefile.boot b/arch/arm/mach-s5pc100/Makefile.boot
index ff90aa13bd6..79ece4055b0 100644
--- a/arch/arm/mach-s5pc100/Makefile.boot
+++ b/arch/arm/mach-s5pc100/Makefile.boot
@@ -1,2 +1,2 @@
1 zreladdr-y := 0x20008000 1 zreladdr-y += 0x20008000
2params_phys-y := 0x20000100 2params_phys-y := 0x20000100
diff --git a/arch/arm/mach-s5pv210/Makefile.boot b/arch/arm/mach-s5pv210/Makefile.boot
index ff90aa13bd6..79ece4055b0 100644
--- a/arch/arm/mach-s5pv210/Makefile.boot
+++ b/arch/arm/mach-s5pv210/Makefile.boot
@@ -1,2 +1,2 @@
1 zreladdr-y := 0x20008000 1 zreladdr-y += 0x20008000
2params_phys-y := 0x20000100 2params_phys-y := 0x20000100
diff --git a/arch/arm/mach-sa1100/Makefile b/arch/arm/mach-sa1100/Makefile
index 41252d22e65..00631787e80 100644
--- a/arch/arm/mach-sa1100/Makefile
+++ b/arch/arm/mach-sa1100/Makefile
@@ -45,7 +45,6 @@ obj-$(CONFIG_SA1100_PLEB) += pleb.o
45obj-$(CONFIG_SA1100_SHANNON) += shannon.o 45obj-$(CONFIG_SA1100_SHANNON) += shannon.o
46 46
47obj-$(CONFIG_SA1100_SIMPAD) += simpad.o 47obj-$(CONFIG_SA1100_SIMPAD) += simpad.o
48led-$(CONFIG_SA1100_SIMPAD) += leds-simpad.o
49 48
50# LEDs support 49# LEDs support
51obj-$(CONFIG_LEDS) += $(led-y) 50obj-$(CONFIG_LEDS) += $(led-y)
diff --git a/arch/arm/mach-sa1100/Makefile.boot b/arch/arm/mach-sa1100/Makefile.boot
index a56ad0417cf..5a616f6e561 100644
--- a/arch/arm/mach-sa1100/Makefile.boot
+++ b/arch/arm/mach-sa1100/Makefile.boot
@@ -1,6 +1,7 @@
1 zreladdr-y := 0xc0008000
2ifeq ($(CONFIG_ARCH_SA1100),y) 1ifeq ($(CONFIG_ARCH_SA1100),y)
3 zreladdr-$(CONFIG_SA1111) := 0xc0208000 2 zreladdr-$(CONFIG_SA1111) += 0xc0208000
3else
4 zreladdr-y += 0xc0008000
4endif 5endif
5params_phys-y := 0xc0000100 6params_phys-y := 0xc0000100
6initrd_phys-y := 0xc0800000 7initrd_phys-y := 0xc0800000
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index 26257df19b6..6290ce28b88 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -301,8 +301,7 @@ static void __init get_assabet_scr(void)
301} 301}
302 302
303static void __init 303static void __init
304fixup_assabet(struct machine_desc *desc, struct tag *tags, 304fixup_assabet(struct tag *tags, char **cmdline, struct meminfo *mi)
305 char **cmdline, struct meminfo *mi)
306{ 305{
307 /* This must be done before any call to machine_has_neponset() */ 306 /* This must be done before any call to machine_has_neponset() */
308 map_sa1100_gpio_regs(); 307 map_sa1100_gpio_regs();
diff --git a/arch/arm/mach-sa1100/include/mach/io.h b/arch/arm/mach-sa1100/include/mach/io.h
index d8b43f3dcd2..dfc27ff0834 100644
--- a/arch/arm/mach-sa1100/include/mach/io.h
+++ b/arch/arm/mach-sa1100/include/mach/io.h
@@ -10,11 +10,9 @@
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#define IO_SPACE_LIMIT 0xffffffff
14
15/* 13/*
16 * We don't actually have real ISA nor PCI buses, but there is so many 14 * __io() is required to be an equivalent mapping to __mem_pci() for
17 * drivers out there that might just work if we fake them... 15 * SOC_COMMON to work.
18 */ 16 */
19#define __io(a) __typesafe_io(a) 17#define __io(a) __typesafe_io(a)
20#define __mem_pci(a) (a) 18#define __mem_pci(a) (a)
diff --git a/arch/arm/mach-sa1100/include/mach/simpad.h b/arch/arm/mach-sa1100/include/mach/simpad.h
index 9296c4513ce..db28118103e 100644
--- a/arch/arm/mach-sa1100/include/mach/simpad.h
+++ b/arch/arm/mach-sa1100/include/mach/simpad.h
@@ -48,32 +48,80 @@
48#define GPIO_SMART_CARD GPIO_GPIO10 48#define GPIO_SMART_CARD GPIO_GPIO10
49#define IRQ_GPIO_SMARD_CARD IRQ_GPIO10 49#define IRQ_GPIO_SMARD_CARD IRQ_GPIO10
50 50
51// CS3 Latch is write only, a shadow is necessary 51/*--- ucb1x00 GPIO ---*/
52#define SIMPAD_UCB1X00_GPIO_BASE (GPIO_MAX + 1)
53#define SIMPAD_UCB1X00_GPIO_PROG1 (SIMPAD_UCB1X00_GPIO_BASE)
54#define SIMPAD_UCB1X00_GPIO_PROG2 (SIMPAD_UCB1X00_GPIO_BASE + 1)
55#define SIMPAD_UCB1X00_GPIO_UP (SIMPAD_UCB1X00_GPIO_BASE + 2)
56#define SIMPAD_UCB1X00_GPIO_DOWN (SIMPAD_UCB1X00_GPIO_BASE + 3)
57#define SIMPAD_UCB1X00_GPIO_LEFT (SIMPAD_UCB1X00_GPIO_BASE + 4)
58#define SIMPAD_UCB1X00_GPIO_RIGHT (SIMPAD_UCB1X00_GPIO_BASE + 5)
59#define SIMPAD_UCB1X00_GPIO_6 (SIMPAD_UCB1X00_GPIO_BASE + 6)
60#define SIMPAD_UCB1X00_GPIO_7 (SIMPAD_UCB1X00_GPIO_BASE + 7)
61#define SIMPAD_UCB1X00_GPIO_HEADSET (SIMPAD_UCB1X00_GPIO_BASE + 8)
62#define SIMPAD_UCB1X00_GPIO_SPEAKER (SIMPAD_UCB1X00_GPIO_BASE + 9)
63
64/*--- CS3 Latch ---*/
65#define SIMPAD_CS3_GPIO_BASE (GPIO_MAX + 11)
66#define SIMPAD_CS3_VCC_5V_EN (SIMPAD_CS3_GPIO_BASE)
67#define SIMPAD_CS3_VCC_3V_EN (SIMPAD_CS3_GPIO_BASE + 1)
68#define SIMPAD_CS3_EN1 (SIMPAD_CS3_GPIO_BASE + 2)
69#define SIMPAD_CS3_EN0 (SIMPAD_CS3_GPIO_BASE + 3)
70#define SIMPAD_CS3_DISPLAY_ON (SIMPAD_CS3_GPIO_BASE + 4)
71#define SIMPAD_CS3_PCMCIA_BUFF_DIS (SIMPAD_CS3_GPIO_BASE + 5)
72#define SIMPAD_CS3_MQ_RESET (SIMPAD_CS3_GPIO_BASE + 6)
73#define SIMPAD_CS3_PCMCIA_RESET (SIMPAD_CS3_GPIO_BASE + 7)
74#define SIMPAD_CS3_DECT_POWER_ON (SIMPAD_CS3_GPIO_BASE + 8)
75#define SIMPAD_CS3_IRDA_SD (SIMPAD_CS3_GPIO_BASE + 9)
76#define SIMPAD_CS3_RS232_ON (SIMPAD_CS3_GPIO_BASE + 10)
77#define SIMPAD_CS3_SD_MEDIAQ (SIMPAD_CS3_GPIO_BASE + 11)
78#define SIMPAD_CS3_LED2_ON (SIMPAD_CS3_GPIO_BASE + 12)
79#define SIMPAD_CS3_IRDA_MODE (SIMPAD_CS3_GPIO_BASE + 13)
80#define SIMPAD_CS3_ENABLE_5V (SIMPAD_CS3_GPIO_BASE + 14)
81#define SIMPAD_CS3_RESET_SIMCARD (SIMPAD_CS3_GPIO_BASE + 15)
82
83#define SIMPAD_CS3_PCMCIA_BVD1 (SIMPAD_CS3_GPIO_BASE + 16)
84#define SIMPAD_CS3_PCMCIA_BVD2 (SIMPAD_CS3_GPIO_BASE + 17)
85#define SIMPAD_CS3_PCMCIA_VS1 (SIMPAD_CS3_GPIO_BASE + 18)
86#define SIMPAD_CS3_PCMCIA_VS2 (SIMPAD_CS3_GPIO_BASE + 19)
87#define SIMPAD_CS3_LOCK_IND (SIMPAD_CS3_GPIO_BASE + 20)
88#define SIMPAD_CS3_CHARGING_STATE (SIMPAD_CS3_GPIO_BASE + 21)
89#define SIMPAD_CS3_PCMCIA_SHORT (SIMPAD_CS3_GPIO_BASE + 22)
90#define SIMPAD_CS3_GPIO_23 (SIMPAD_CS3_GPIO_BASE + 23)
52 91
53#define CS3BUSTYPE unsigned volatile long
54#define CS3_BASE 0xf1000000 92#define CS3_BASE 0xf1000000
55 93
56#define VCC_5V_EN 0x0001 // For 5V PCMCIA 94long simpad_get_cs3_ro(void);
57#define VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA 95long simpad_get_cs3_shadow(void);
58#define EN1 0x0004 // This is only for EPROM's 96void simpad_set_cs3_bit(int value);
59#define EN0 0x0008 // Both should be enable for 3.3V or 5V 97void simpad_clear_cs3_bit(int value);
60#define DISPLAY_ON 0x0010 98
61#define PCMCIA_BUFF_DIS 0x0020 99#define VCC_5V_EN 0x0001 /* For 5V PCMCIA */
62#define MQ_RESET 0x0040 100#define VCC_3V_EN 0x0002 /* FOR 3.3V PCMCIA */
63#define PCMCIA_RESET 0x0080 101#define EN1 0x0004 /* This is only for EPROM's */
64#define DECT_POWER_ON 0x0100 102#define EN0 0x0008 /* Both should be enable for 3.3V or 5V */
65#define IRDA_SD 0x0200 // Shutdown for powersave 103#define DISPLAY_ON 0x0010
66#define RS232_ON 0x0400 104#define PCMCIA_BUFF_DIS 0x0020
67#define SD_MEDIAQ 0x0800 // Shutdown for powersave 105#define MQ_RESET 0x0040
68#define LED2_ON 0x1000 106#define PCMCIA_RESET 0x0080
69#define IRDA_MODE 0x2000 // Fast/Slow IrDA mode 107#define DECT_POWER_ON 0x0100
70#define ENABLE_5V 0x4000 // Enable 5V circuit 108#define IRDA_SD 0x0200 /* Shutdown for powersave */
71#define RESET_SIMCARD 0x8000 109#define RS232_ON 0x0400
72 110#define SD_MEDIAQ 0x0800 /* Shutdown for powersave */
73#define RS232_ENABLE 0x0440 111#define LED2_ON 0x1000
74#define PCMCIAMASK 0x402f 112#define IRDA_MODE 0x2000 /* Fast/Slow IrDA mode */
75 113#define ENABLE_5V 0x4000 /* Enable 5V circuit */
76 114#define RESET_SIMCARD 0x8000
115
116#define PCMCIA_BVD1 0x01
117#define PCMCIA_BVD2 0x02
118#define PCMCIA_VS1 0x04
119#define PCMCIA_VS2 0x08
120#define LOCK_IND 0x10
121#define CHARGING_STATE 0x20
122#define PCMCIA_SHORT 0x40
123
124/*--- Battery ---*/
77struct simpad_battery { 125struct simpad_battery {
78 unsigned char ac_status; /* line connected yes/no */ 126 unsigned char ac_status; /* line connected yes/no */
79 unsigned char status; /* battery loading yes/no */ 127 unsigned char status; /* battery loading yes/no */
diff --git a/arch/arm/mach-sa1100/leds-simpad.c b/arch/arm/mach-sa1100/leds-simpad.c
deleted file mode 100644
index d50f4eeaa12..00000000000
--- a/arch/arm/mach-sa1100/leds-simpad.c
+++ /dev/null
@@ -1,100 +0,0 @@
1/*
2 * linux/arch/arm/mach-sa1100/leds-simpad.c
3 *
4 * Author: Juergen Messerer <juergen.messerer@siemens.ch>
5 */
6#include <linux/init.h>
7
8#include <mach/hardware.h>
9#include <asm/leds.h>
10#include <asm/system.h>
11#include <mach/simpad.h>
12
13#include "leds.h"
14
15
16#define LED_STATE_ENABLED 1
17#define LED_STATE_CLAIMED 2
18
19static unsigned int led_state;
20static unsigned int hw_led_state;
21
22#define LED_GREEN (1)
23#define LED_MASK (1)
24
25extern void set_cs3_bit(int value);
26extern void clear_cs3_bit(int value);
27
28void simpad_leds_event(led_event_t evt)
29{
30 switch (evt)
31 {
32 case led_start:
33 hw_led_state = LED_GREEN;
34 led_state = LED_STATE_ENABLED;
35 break;
36
37 case led_stop:
38 led_state &= ~LED_STATE_ENABLED;
39 break;
40
41 case led_claim:
42 led_state |= LED_STATE_CLAIMED;
43 hw_led_state = LED_GREEN;
44 break;
45
46 case led_release:
47 led_state &= ~LED_STATE_CLAIMED;
48 hw_led_state = LED_GREEN;
49 break;
50
51#ifdef CONFIG_LEDS_TIMER
52 case led_timer:
53 if (!(led_state & LED_STATE_CLAIMED))
54 hw_led_state ^= LED_GREEN;
55 break;
56#endif
57
58#ifdef CONFIG_LEDS_CPU
59 case led_idle_start:
60 break;
61
62 case led_idle_end:
63 break;
64#endif
65
66 case led_halted:
67 break;
68
69 case led_green_on:
70 if (led_state & LED_STATE_CLAIMED)
71 hw_led_state |= LED_GREEN;
72 break;
73
74 case led_green_off:
75 if (led_state & LED_STATE_CLAIMED)
76 hw_led_state &= ~LED_GREEN;
77 break;
78
79 case led_amber_on:
80 break;
81
82 case led_amber_off:
83 break;
84
85 case led_red_on:
86 break;
87
88 case led_red_off:
89 break;
90
91 default:
92 break;
93 }
94
95 if (led_state & LED_STATE_ENABLED)
96 set_cs3_bit(LED2_ON);
97 else
98 clear_cs3_bit(LED2_ON);
99}
100
diff --git a/arch/arm/mach-sa1100/leds.c b/arch/arm/mach-sa1100/leds.c
index bbfe197fb4d..5fe71a0f105 100644
--- a/arch/arm/mach-sa1100/leds.c
+++ b/arch/arm/mach-sa1100/leds.c
@@ -42,8 +42,6 @@ sa1100_leds_init(void)
42 leds_event = adsbitsy_leds_event; 42 leds_event = adsbitsy_leds_event;
43 if (machine_is_pt_system3()) 43 if (machine_is_pt_system3())
44 leds_event = system3_leds_event; 44 leds_event = system3_leds_event;
45 if (machine_is_simpad())
46 leds_event = simpad_leds_event; /* what about machine registry? including led, apm... -zecke */
47 45
48 leds_event(led_start); 46 leds_event(led_start);
49 return 0; 47 return 0;
diff --git a/arch/arm/mach-sa1100/leds.h b/arch/arm/mach-sa1100/leds.h
index 68cc9f773d6..776b6020f55 100644
--- a/arch/arm/mach-sa1100/leds.h
+++ b/arch/arm/mach-sa1100/leds.h
@@ -11,4 +11,3 @@ extern void pfs168_leds_event(led_event_t evt);
11extern void graphicsmaster_leds_event(led_event_t evt); 11extern void graphicsmaster_leds_event(led_event_t evt);
12extern void adsbitsy_leds_event(led_event_t evt); 12extern void adsbitsy_leds_event(led_event_t evt);
13extern void system3_leds_event(led_event_t evt); 13extern void system3_leds_event(led_event_t evt);
14extern void simpad_leds_event(led_event_t evt);
diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c
index cfb76077bd2..34659f354be 100644
--- a/arch/arm/mach-sa1100/simpad.c
+++ b/arch/arm/mach-sa1100/simpad.c
@@ -13,6 +13,7 @@
13#include <linux/mtd/mtd.h> 13#include <linux/mtd/mtd.h>
14#include <linux/mtd/partitions.h> 14#include <linux/mtd/partitions.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/gpio.h>
16 17
17#include <asm/irq.h> 18#include <asm/irq.h>
18#include <mach/hardware.h> 19#include <mach/hardware.h>
@@ -28,35 +29,92 @@
28 29
29#include <linux/serial_core.h> 30#include <linux/serial_core.h>
30#include <linux/ioport.h> 31#include <linux/ioport.h>
32#include <linux/input.h>
33#include <linux/gpio_keys.h>
34#include <linux/leds.h>
35#include <linux/i2c-gpio.h>
31 36
32#include "generic.h" 37#include "generic.h"
33 38
34long cs3_shadow; 39/*
40 * CS3 support
41 */
35 42
36long get_cs3_shadow(void) 43static long cs3_shadow;
44static spinlock_t cs3_lock;
45static struct gpio_chip cs3_gpio;
46
47long simpad_get_cs3_ro(void)
48{
49 return readl(CS3_BASE);
50}
51EXPORT_SYMBOL(simpad_get_cs3_ro);
52
53long simpad_get_cs3_shadow(void)
37{ 54{
38 return cs3_shadow; 55 return cs3_shadow;
39} 56}
57EXPORT_SYMBOL(simpad_get_cs3_shadow);
40 58
41void set_cs3(long value) 59static void __simpad_write_cs3(void)
42{ 60{
43 *(CS3BUSTYPE *)(CS3_BASE) = cs3_shadow = value; 61 writel(cs3_shadow, CS3_BASE);
44} 62}
45 63
46void set_cs3_bit(int value) 64void simpad_set_cs3_bit(int value)
47{ 65{
66 unsigned long flags;
67
68 spin_lock_irqsave(&cs3_lock, flags);
48 cs3_shadow |= value; 69 cs3_shadow |= value;
49 *(CS3BUSTYPE *)(CS3_BASE) = cs3_shadow; 70 __simpad_write_cs3();
71 spin_unlock_irqrestore(&cs3_lock, flags);
50} 72}
73EXPORT_SYMBOL(simpad_set_cs3_bit);
51 74
52void clear_cs3_bit(int value) 75void simpad_clear_cs3_bit(int value)
53{ 76{
77 unsigned long flags;
78
79 spin_lock_irqsave(&cs3_lock, flags);
54 cs3_shadow &= ~value; 80 cs3_shadow &= ~value;
55 *(CS3BUSTYPE *)(CS3_BASE) = cs3_shadow; 81 __simpad_write_cs3();
82 spin_unlock_irqrestore(&cs3_lock, flags);
56} 83}
84EXPORT_SYMBOL(simpad_clear_cs3_bit);
85
86static void cs3_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
87{
88 if (offset > 15)
89 return;
90 if (value)
91 simpad_set_cs3_bit(1 << offset);
92 else
93 simpad_clear_cs3_bit(1 << offset);
94};
95
96static int cs3_gpio_get(struct gpio_chip *chip, unsigned offset)
97{
98 if (offset > 15)
99 return simpad_get_cs3_ro() & (1 << (offset - 16));
100 return simpad_get_cs3_shadow() & (1 << offset);
101};
57 102
58EXPORT_SYMBOL(set_cs3_bit); 103static int cs3_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
59EXPORT_SYMBOL(clear_cs3_bit); 104{
105 if (offset > 15)
106 return 0;
107 return -EINVAL;
108};
109
110static int cs3_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
111 int value)
112{
113 if (offset > 15)
114 return -EINVAL;
115 cs3_gpio_set(chip, offset, value);
116 return 0;
117};
60 118
61static struct map_desc simpad_io_desc[] __initdata = { 119static struct map_desc simpad_io_desc[] __initdata = {
62 { /* MQ200 */ 120 { /* MQ200 */
@@ -64,9 +122,9 @@ static struct map_desc simpad_io_desc[] __initdata = {
64 .pfn = __phys_to_pfn(0x4b800000), 122 .pfn = __phys_to_pfn(0x4b800000),
65 .length = 0x00800000, 123 .length = 0x00800000,
66 .type = MT_DEVICE 124 .type = MT_DEVICE
67 }, { /* Paules CS3, write only */ 125 }, { /* Simpad CS3 */
68 .virtual = 0xf1000000, 126 .virtual = CS3_BASE,
69 .pfn = __phys_to_pfn(0x18000000), 127 .pfn = __phys_to_pfn(SA1100_CS3_PHYS),
70 .length = 0x00100000, 128 .length = 0x00100000,
71 .type = MT_DEVICE 129 .type = MT_DEVICE
72 }, 130 },
@@ -78,12 +136,12 @@ static void simpad_uart_pm(struct uart_port *port, u_int state, u_int oldstate)
78 if (port->mapbase == (u_int)&Ser1UTCR0) { 136 if (port->mapbase == (u_int)&Ser1UTCR0) {
79 if (state) 137 if (state)
80 { 138 {
81 clear_cs3_bit(RS232_ON); 139 simpad_clear_cs3_bit(RS232_ON);
82 clear_cs3_bit(DECT_POWER_ON); 140 simpad_clear_cs3_bit(DECT_POWER_ON);
83 }else 141 }else
84 { 142 {
85 set_cs3_bit(RS232_ON); 143 simpad_set_cs3_bit(RS232_ON);
86 set_cs3_bit(DECT_POWER_ON); 144 simpad_set_cs3_bit(DECT_POWER_ON);
87 } 145 }
88 } 146 }
89} 147}
@@ -132,6 +190,7 @@ static struct resource simpad_flash_resources [] = {
132static struct mcp_plat_data simpad_mcp_data = { 190static struct mcp_plat_data simpad_mcp_data = {
133 .mccr0 = MCCR0_ADM, 191 .mccr0 = MCCR0_ADM,
134 .sclk_rate = 11981000, 192 .sclk_rate = 11981000,
193 .gpio_base = SIMPAD_UCB1X00_GPIO_BASE,
135}; 194};
136 195
137 196
@@ -142,9 +201,10 @@ static void __init simpad_map_io(void)
142 201
143 iotable_init(simpad_io_desc, ARRAY_SIZE(simpad_io_desc)); 202 iotable_init(simpad_io_desc, ARRAY_SIZE(simpad_io_desc));
144 203
145 set_cs3_bit (EN1 | EN0 | LED2_ON | DISPLAY_ON | RS232_ON | 204 /* Initialize CS3 */
146 ENABLE_5V | RESET_SIMCARD | DECT_POWER_ON); 205 cs3_shadow = (EN1 | EN0 | LED2_ON | DISPLAY_ON |
147 206 RS232_ON | ENABLE_5V | RESET_SIMCARD | DECT_POWER_ON);
207 __simpad_write_cs3(); /* Spinlocks not yet initialized */
148 208
149 sa1100_register_uart_fns(&simpad_port_fns); 209 sa1100_register_uart_fns(&simpad_port_fns);
150 sa1100_register_uart(0, 3); /* serial interface */ 210 sa1100_register_uart(0, 3); /* serial interface */
@@ -170,13 +230,14 @@ static void __init simpad_map_io(void)
170 230
171static void simpad_power_off(void) 231static void simpad_power_off(void)
172{ 232{
173 local_irq_disable(); // was cli 233 local_irq_disable();
174 set_cs3(0x800); /* only SD_MEDIAQ */ 234 cs3_shadow = SD_MEDIAQ;
235 __simpad_write_cs3(); /* Bypass spinlock here */
175 236
176 /* disable internal oscillator, float CS lines */ 237 /* disable internal oscillator, float CS lines */
177 PCFR = (PCFR_OPDE | PCFR_FP | PCFR_FS); 238 PCFR = (PCFR_OPDE | PCFR_FP | PCFR_FS);
178 /* enable wake-up on GPIO0 (Assabet...) */ 239 /* enable wake-up on GPIO0 */
179 PWER = GFER = GRER = 1; 240 PWER = GFER = GRER = PWER_GPIO0;
180 /* 241 /*
181 * set scratchpad to zero, just in case it is used as a 242 * set scratchpad to zero, just in case it is used as a
182 * restart address by the bootloader. 243 * restart address by the bootloader.
@@ -192,6 +253,91 @@ static void simpad_power_off(void)
192 253
193} 254}
194 255
256/*
257 * gpio_keys
258*/
259
260static struct gpio_keys_button simpad_button_table[] = {
261 { KEY_POWER, IRQ_GPIO_POWER_BUTTON, 1, "power button" },
262};
263
264static struct gpio_keys_platform_data simpad_keys_data = {
265 .buttons = simpad_button_table,
266 .nbuttons = ARRAY_SIZE(simpad_button_table),
267};
268
269static struct platform_device simpad_keys = {
270 .name = "gpio-keys",
271 .dev = {
272 .platform_data = &simpad_keys_data,
273 },
274};
275
276static struct gpio_keys_button simpad_polled_button_table[] = {
277 { KEY_PROG1, SIMPAD_UCB1X00_GPIO_PROG1, 1, "prog1 button" },
278 { KEY_PROG2, SIMPAD_UCB1X00_GPIO_PROG2, 1, "prog2 button" },
279 { KEY_UP, SIMPAD_UCB1X00_GPIO_UP, 1, "up button" },
280 { KEY_DOWN, SIMPAD_UCB1X00_GPIO_DOWN, 1, "down button" },
281 { KEY_LEFT, SIMPAD_UCB1X00_GPIO_LEFT, 1, "left button" },
282 { KEY_RIGHT, SIMPAD_UCB1X00_GPIO_RIGHT, 1, "right button" },
283};
284
285static struct gpio_keys_platform_data simpad_polled_keys_data = {
286 .buttons = simpad_polled_button_table,
287 .nbuttons = ARRAY_SIZE(simpad_polled_button_table),
288 .poll_interval = 50,
289};
290
291static struct platform_device simpad_polled_keys = {
292 .name = "gpio-keys-polled",
293 .dev = {
294 .platform_data = &simpad_polled_keys_data,
295 },
296};
297
298/*
299 * GPIO LEDs
300 */
301
302static struct gpio_led simpad_leds[] = {
303 {
304 .name = "simpad:power",
305 .gpio = SIMPAD_CS3_LED2_ON,
306 .active_low = 0,
307 .default_trigger = "default-on",
308 },
309};
310
311static struct gpio_led_platform_data simpad_led_data = {
312 .num_leds = ARRAY_SIZE(simpad_leds),
313 .leds = simpad_leds,
314};
315
316static struct platform_device simpad_gpio_leds = {
317 .name = "leds-gpio",
318 .id = 0,
319 .dev = {
320 .platform_data = &simpad_led_data,
321 },
322};
323
324/*
325 * i2c
326 */
327static struct i2c_gpio_platform_data simpad_i2c_data = {
328 .sda_pin = GPIO_GPIO21,
329 .scl_pin = GPIO_GPIO25,
330 .udelay = 10,
331 .timeout = HZ,
332};
333
334static struct platform_device simpad_i2c = {
335 .name = "i2c-gpio",
336 .id = 0,
337 .dev = {
338 .platform_data = &simpad_i2c_data,
339 },
340};
195 341
196/* 342/*
197 * MediaQ Video Device 343 * MediaQ Video Device
@@ -202,7 +348,11 @@ static struct platform_device simpad_mq200fb = {
202}; 348};
203 349
204static struct platform_device *devices[] __initdata = { 350static struct platform_device *devices[] __initdata = {
205 &simpad_mq200fb 351 &simpad_keys,
352 &simpad_polled_keys,
353 &simpad_mq200fb,
354 &simpad_gpio_leds,
355 &simpad_i2c,
206}; 356};
207 357
208 358
@@ -211,6 +361,19 @@ static int __init simpad_init(void)
211{ 361{
212 int ret; 362 int ret;
213 363
364 spin_lock_init(&cs3_lock);
365
366 cs3_gpio.label = "simpad_cs3";
367 cs3_gpio.base = SIMPAD_CS3_GPIO_BASE;
368 cs3_gpio.ngpio = 24;
369 cs3_gpio.set = cs3_gpio_set;
370 cs3_gpio.get = cs3_gpio_get;
371 cs3_gpio.direction_input = cs3_gpio_direction_input;
372 cs3_gpio.direction_output = cs3_gpio_direction_output;
373 ret = gpiochip_add(&cs3_gpio);
374 if (ret)
375 printk(KERN_WARNING "simpad: Unable to register cs3 GPIO device");
376
214 pm_power_off = simpad_power_off; 377 pm_power_off = simpad_power_off;
215 378
216 sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources, 379 sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources,
diff --git a/arch/arm/mach-shark/Makefile.boot b/arch/arm/mach-shark/Makefile.boot
index 4320f8b9277..e40e24e4ca3 100644
--- a/arch/arm/mach-shark/Makefile.boot
+++ b/arch/arm/mach-shark/Makefile.boot
@@ -1,2 +1,2 @@
1 zreladdr-y := 0x08008000 1 zreladdr-y += 0x08008000
2 2
diff --git a/arch/arm/mach-shark/leds.c b/arch/arm/mach-shark/leds.c
index c9e32de4adf..ccd49189bbd 100644
--- a/arch/arm/mach-shark/leds.c
+++ b/arch/arm/mach-shark/leds.c
@@ -36,7 +36,7 @@ static char led_state;
36static short hw_led_state; 36static short hw_led_state;
37static short saved_state; 37static short saved_state;
38 38
39static DEFINE_SPINLOCK(leds_lock); 39static DEFINE_RAW_SPINLOCK(leds_lock);
40 40
41short sequoia_read(int addr) { 41short sequoia_read(int addr) {
42 outw(addr,0x24); 42 outw(addr,0x24);
@@ -52,7 +52,7 @@ static void sequoia_leds_event(led_event_t evt)
52{ 52{
53 unsigned long flags; 53 unsigned long flags;
54 54
55 spin_lock_irqsave(&leds_lock, flags); 55 raw_spin_lock_irqsave(&leds_lock, flags);
56 56
57 hw_led_state = sequoia_read(0x09); 57 hw_led_state = sequoia_read(0x09);
58 58
@@ -144,7 +144,7 @@ static void sequoia_leds_event(led_event_t evt)
144 if (led_state & LED_STATE_ENABLED) 144 if (led_state & LED_STATE_ENABLED)
145 sequoia_write(hw_led_state,0x09); 145 sequoia_write(hw_led_state,0x09);
146 146
147 spin_unlock_irqrestore(&leds_lock, flags); 147 raw_spin_unlock_irqrestore(&leds_lock, flags);
148} 148}
149 149
150static int __init leds_init(void) 150static int __init leds_init(void)
diff --git a/arch/arm/mach-shmobile/Makefile.boot b/arch/arm/mach-shmobile/Makefile.boot
index 1c08ee9de86..498efd99338 100644
--- a/arch/arm/mach-shmobile/Makefile.boot
+++ b/arch/arm/mach-shmobile/Makefile.boot
@@ -1,7 +1,7 @@
1__ZRELADDR := $(shell /bin/bash -c 'printf "0x%08x" \ 1__ZRELADDR := $(shell /bin/bash -c 'printf "0x%08x" \
2 $$[$(CONFIG_MEMORY_START) + 0x8000]') 2 $$[$(CONFIG_MEMORY_START) + 0x8000]')
3 3
4 zreladdr-y := $(__ZRELADDR) 4 zreladdr-y += $(__ZRELADDR)
5 5
6# Unsupported legacy stuff 6# Unsupported legacy stuff
7# 7#
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 523f608eb8c..7e90d064ebc 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -42,6 +42,7 @@
42#include <linux/leds.h> 42#include <linux/leds.h>
43#include <linux/input/sh_keysc.h> 43#include <linux/input/sh_keysc.h>
44#include <linux/usb/r8a66597.h> 44#include <linux/usb/r8a66597.h>
45#include <linux/pm_clock.h>
45 46
46#include <media/sh_mobile_ceu.h> 47#include <media/sh_mobile_ceu.h>
47#include <media/sh_mobile_csi2.h> 48#include <media/sh_mobile_csi2.h>
@@ -1408,6 +1409,11 @@ static void __init ap4evb_init(void)
1408 sh7372_add_device_to_domain(&sh7372_a4lc, &lcdc_device); 1409 sh7372_add_device_to_domain(&sh7372_a4lc, &lcdc_device);
1409 sh7372_add_device_to_domain(&sh7372_a4mp, &fsi_device); 1410 sh7372_add_device_to_domain(&sh7372_a4mp, &fsi_device);
1410 1411
1412 sh7372_add_device_to_domain(&sh7372_a3sp, &sh_mmcif_device);
1413 sh7372_add_device_to_domain(&sh7372_a3sp, &sdhi0_device);
1414 sh7372_add_device_to_domain(&sh7372_a3sp, &sdhi1_device);
1415 sh7372_add_device_to_domain(&sh7372_a4r, &ceu_device);
1416
1411 hdmi_init_pm_clock(); 1417 hdmi_init_pm_clock();
1412 fsi_init_pm_clock(); 1418 fsi_init_pm_clock();
1413 sh7372_pm_init(); 1419 sh7372_pm_init();
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 17c19dc2560..00273dad5bf 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -39,7 +39,7 @@
39#include <linux/mtd/mtd.h> 39#include <linux/mtd/mtd.h>
40#include <linux/mtd/partitions.h> 40#include <linux/mtd/partitions.h>
41#include <linux/mtd/physmap.h> 41#include <linux/mtd/physmap.h>
42#include <linux/pm_runtime.h> 42#include <linux/pm_clock.h>
43#include <linux/smsc911x.h> 43#include <linux/smsc911x.h>
44#include <linux/sh_intc.h> 44#include <linux/sh_intc.h>
45#include <linux/tca6416_keypad.h> 45#include <linux/tca6416_keypad.h>
@@ -810,6 +810,7 @@ static struct usbhs_private usbhs1_private = {
810 }, 810 },
811 .driver_param = { 811 .driver_param = {
812 .buswait_bwait = 4, 812 .buswait_bwait = 4,
813 .has_otg = 1,
813 .pipe_type = usbhs1_pipe_cfg, 814 .pipe_type = usbhs1_pipe_cfg,
814 .pipe_size = ARRAY_SIZE(usbhs1_pipe_cfg), 815 .pipe_size = ARRAY_SIZE(usbhs1_pipe_cfg),
815 .d0_tx_id = SHDMA_SLAVE_USB1_TX, 816 .d0_tx_id = SHDMA_SLAVE_USB1_TX,
@@ -1588,6 +1589,15 @@ static void __init mackerel_init(void)
1588 sh7372_add_device_to_domain(&sh7372_a4lc, &lcdc_device); 1589 sh7372_add_device_to_domain(&sh7372_a4lc, &lcdc_device);
1589 sh7372_add_device_to_domain(&sh7372_a4lc, &hdmi_lcdc_device); 1590 sh7372_add_device_to_domain(&sh7372_a4lc, &hdmi_lcdc_device);
1590 sh7372_add_device_to_domain(&sh7372_a4mp, &fsi_device); 1591 sh7372_add_device_to_domain(&sh7372_a4mp, &fsi_device);
1592 sh7372_add_device_to_domain(&sh7372_a3sp, &usbhs0_device);
1593 sh7372_add_device_to_domain(&sh7372_a3sp, &usbhs1_device);
1594 sh7372_add_device_to_domain(&sh7372_a3sp, &sh_mmcif_device);
1595 sh7372_add_device_to_domain(&sh7372_a3sp, &sdhi0_device);
1596#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
1597 sh7372_add_device_to_domain(&sh7372_a3sp, &sdhi1_device);
1598#endif
1599 sh7372_add_device_to_domain(&sh7372_a3sp, &sdhi2_device);
1600 sh7372_add_device_to_domain(&sh7372_a4r, &ceu_device);
1591 1601
1592 hdmi_init_pm_clock(); 1602 hdmi_init_pm_clock();
1593 sh7372_pm_init(); 1603 sh7372_pm_init();
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index 06aecb31d9c..c0cdbf997c9 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -35,8 +35,8 @@ extern void sh7372_add_standard_devices(void);
35extern void sh7372_clock_init(void); 35extern void sh7372_clock_init(void);
36extern void sh7372_pinmux_init(void); 36extern void sh7372_pinmux_init(void);
37extern void sh7372_pm_init(void); 37extern void sh7372_pm_init(void);
38extern void sh7372_cpu_suspend(void); 38extern void sh7372_resume_core_standby_a3sm(void);
39extern void sh7372_cpu_resume(void); 39extern int sh7372_do_idle_a3sm(unsigned long unused);
40extern struct clk sh7372_extal1_clk; 40extern struct clk sh7372_extal1_clk;
41extern struct clk sh7372_extal2_clk; 41extern struct clk sh7372_extal2_clk;
42 42
diff --git a/arch/arm/mach-shmobile/include/mach/sh7372.h b/arch/arm/mach-shmobile/include/mach/sh7372.h
index 24e63a85e66..84532f9629b 100644
--- a/arch/arm/mach-shmobile/include/mach/sh7372.h
+++ b/arch/arm/mach-shmobile/include/mach/sh7372.h
@@ -479,7 +479,12 @@ struct platform_device;
479 479
480struct sh7372_pm_domain { 480struct sh7372_pm_domain {
481 struct generic_pm_domain genpd; 481 struct generic_pm_domain genpd;
482 struct dev_power_governor *gov;
483 void (*suspend)(void);
484 void (*resume)(void);
482 unsigned int bit_shift; 485 unsigned int bit_shift;
486 bool no_debug;
487 bool stay_on;
483}; 488};
484 489
485static inline struct sh7372_pm_domain *to_sh7372_pd(struct generic_pm_domain *d) 490static inline struct sh7372_pm_domain *to_sh7372_pd(struct generic_pm_domain *d)
@@ -491,16 +496,24 @@ static inline struct sh7372_pm_domain *to_sh7372_pd(struct generic_pm_domain *d)
491extern struct sh7372_pm_domain sh7372_a4lc; 496extern struct sh7372_pm_domain sh7372_a4lc;
492extern struct sh7372_pm_domain sh7372_a4mp; 497extern struct sh7372_pm_domain sh7372_a4mp;
493extern struct sh7372_pm_domain sh7372_d4; 498extern struct sh7372_pm_domain sh7372_d4;
499extern struct sh7372_pm_domain sh7372_a4r;
494extern struct sh7372_pm_domain sh7372_a3rv; 500extern struct sh7372_pm_domain sh7372_a3rv;
495extern struct sh7372_pm_domain sh7372_a3ri; 501extern struct sh7372_pm_domain sh7372_a3ri;
502extern struct sh7372_pm_domain sh7372_a3sp;
496extern struct sh7372_pm_domain sh7372_a3sg; 503extern struct sh7372_pm_domain sh7372_a3sg;
497 504
498extern void sh7372_init_pm_domain(struct sh7372_pm_domain *sh7372_pd); 505extern void sh7372_init_pm_domain(struct sh7372_pm_domain *sh7372_pd);
499extern void sh7372_add_device_to_domain(struct sh7372_pm_domain *sh7372_pd, 506extern void sh7372_add_device_to_domain(struct sh7372_pm_domain *sh7372_pd,
500 struct platform_device *pdev); 507 struct platform_device *pdev);
508extern void sh7372_pm_add_subdomain(struct sh7372_pm_domain *sh7372_pd,
509 struct sh7372_pm_domain *sh7372_sd);
501#else 510#else
502#define sh7372_init_pm_domain(pd) do { } while(0) 511#define sh7372_init_pm_domain(pd) do { } while(0)
503#define sh7372_add_device_to_domain(pd, pdev) do { } while(0) 512#define sh7372_add_device_to_domain(pd, pdev) do { } while(0)
513#define sh7372_pm_add_subdomain(pd, sd) do { } while(0)
504#endif /* CONFIG_PM */ 514#endif /* CONFIG_PM */
505 515
516extern void sh7372_intcs_suspend(void);
517extern void sh7372_intcs_resume(void);
518
506#endif /* __ASM_SH7372_H__ */ 519#endif /* __ASM_SH7372_H__ */
diff --git a/arch/arm/mach-shmobile/intc-sh7372.c b/arch/arm/mach-shmobile/intc-sh7372.c
index 739315e30eb..29cdc0522d9 100644
--- a/arch/arm/mach-shmobile/intc-sh7372.c
+++ b/arch/arm/mach-shmobile/intc-sh7372.c
@@ -606,9 +606,16 @@ static void intcs_demux(unsigned int irq, struct irq_desc *desc)
606 generic_handle_irq(intcs_evt2irq(evtcodeas)); 606 generic_handle_irq(intcs_evt2irq(evtcodeas));
607} 607}
608 608
609static void __iomem *intcs_ffd2;
610static void __iomem *intcs_ffd5;
611
609void __init sh7372_init_irq(void) 612void __init sh7372_init_irq(void)
610{ 613{
611 void __iomem *intevtsa = ioremap_nocache(0xffd20100, PAGE_SIZE); 614 void __iomem *intevtsa;
615
616 intcs_ffd2 = ioremap_nocache(0xffd20000, PAGE_SIZE);
617 intevtsa = intcs_ffd2 + 0x100;
618 intcs_ffd5 = ioremap_nocache(0xffd50000, PAGE_SIZE);
612 619
613 register_intc_controller(&intca_desc); 620 register_intc_controller(&intca_desc);
614 register_intc_controller(&intcs_desc); 621 register_intc_controller(&intcs_desc);
@@ -617,3 +624,46 @@ void __init sh7372_init_irq(void)
617 irq_set_handler_data(evt2irq(0xf80), (void *)intevtsa); 624 irq_set_handler_data(evt2irq(0xf80), (void *)intevtsa);
618 irq_set_chained_handler(evt2irq(0xf80), intcs_demux); 625 irq_set_chained_handler(evt2irq(0xf80), intcs_demux);
619} 626}
627
628static unsigned short ffd2[0x200];
629static unsigned short ffd5[0x100];
630
631void sh7372_intcs_suspend(void)
632{
633 int k;
634
635 for (k = 0x00; k <= 0x30; k += 4)
636 ffd2[k] = __raw_readw(intcs_ffd2 + k);
637
638 for (k = 0x80; k <= 0xb0; k += 4)
639 ffd2[k] = __raw_readb(intcs_ffd2 + k);
640
641 for (k = 0x180; k <= 0x188; k += 4)
642 ffd2[k] = __raw_readb(intcs_ffd2 + k);
643
644 for (k = 0x00; k <= 0x3c; k += 4)
645 ffd5[k] = __raw_readw(intcs_ffd5 + k);
646
647 for (k = 0x80; k <= 0x9c; k += 4)
648 ffd5[k] = __raw_readb(intcs_ffd5 + k);
649}
650
651void sh7372_intcs_resume(void)
652{
653 int k;
654
655 for (k = 0x00; k <= 0x30; k += 4)
656 __raw_writew(ffd2[k], intcs_ffd2 + k);
657
658 for (k = 0x80; k <= 0xb0; k += 4)
659 __raw_writeb(ffd2[k], intcs_ffd2 + k);
660
661 for (k = 0x180; k <= 0x188; k += 4)
662 __raw_writeb(ffd2[k], intcs_ffd2 + k);
663
664 for (k = 0x00; k <= 0x3c; k += 4)
665 __raw_writew(ffd5[k], intcs_ffd5 + k);
666
667 for (k = 0x80; k <= 0x9c; k += 4)
668 __raw_writeb(ffd5[k], intcs_ffd5 + k);
669}
diff --git a/arch/arm/mach-shmobile/platsmp.c b/arch/arm/mach-shmobile/platsmp.c
index 66f980625a3..e4e485fa253 100644
--- a/arch/arm/mach-shmobile/platsmp.c
+++ b/arch/arm/mach-shmobile/platsmp.c
@@ -56,6 +56,12 @@ void __init smp_init_cpus(void)
56 unsigned int ncores = shmobile_smp_get_core_count(); 56 unsigned int ncores = shmobile_smp_get_core_count();
57 unsigned int i; 57 unsigned int i;
58 58
59 if (ncores > nr_cpu_ids) {
60 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
61 ncores, nr_cpu_ids);
62 ncores = nr_cpu_ids;
63 }
64
59 for (i = 0; i < ncores; i++) 65 for (i = 0; i < ncores; i++)
60 set_cpu_possible(i, true); 66 set_cpu_possible(i, true);
61 67
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
index 933fb411be0..79612737c5b 100644
--- a/arch/arm/mach-shmobile/pm-sh7372.c
+++ b/arch/arm/mach-shmobile/pm-sh7372.c
@@ -15,23 +15,61 @@
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/pm_runtime.h> 18#include <linux/pm_clock.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/irq.h>
22#include <linux/bitrev.h>
21#include <asm/system.h> 23#include <asm/system.h>
22#include <asm/io.h> 24#include <asm/io.h>
23#include <asm/tlbflush.h> 25#include <asm/tlbflush.h>
26#include <asm/suspend.h>
24#include <mach/common.h> 27#include <mach/common.h>
25#include <mach/sh7372.h> 28#include <mach/sh7372.h>
26 29
27#define SMFRAM 0xe6a70000 30/* DBG */
28#define SYSTBCR 0xe6150024 31#define DBGREG1 0xe6100020
29#define SBAR 0xe6180020 32#define DBGREG9 0xe6100040
30#define APARMBAREA 0xe6f10020
31 33
34/* CPGA */
35#define SYSTBCR 0xe6150024
36#define MSTPSR0 0xe6150030
37#define MSTPSR1 0xe6150038
38#define MSTPSR2 0xe6150040
39#define MSTPSR3 0xe6150048
40#define MSTPSR4 0xe615004c
41#define PLLC01STPCR 0xe61500c8
42
43/* SYSC */
32#define SPDCR 0xe6180008 44#define SPDCR 0xe6180008
33#define SWUCR 0xe6180014 45#define SWUCR 0xe6180014
46#define SBAR 0xe6180020
47#define WUPRMSK 0xe6180028
48#define WUPSMSK 0xe618002c
49#define WUPSMSK2 0xe6180048
34#define PSTR 0xe6180080 50#define PSTR 0xe6180080
51#define WUPSFAC 0xe6180098
52#define IRQCR 0xe618022c
53#define IRQCR2 0xe6180238
54#define IRQCR3 0xe6180244
55#define IRQCR4 0xe6180248
56#define PDNSEL 0xe6180254
57
58/* INTC */
59#define ICR1A 0xe6900000
60#define ICR2A 0xe6900004
61#define ICR3A 0xe6900008
62#define ICR4A 0xe690000c
63#define INTMSK00A 0xe6900040
64#define INTMSK10A 0xe6900044
65#define INTMSK20A 0xe6900048
66#define INTMSK30A 0xe690004c
67
68/* MFIS */
69#define SMFRAM 0xe6a70000
70
71/* AP-System Core */
72#define APARMBAREA 0xe6f10020
35 73
36#define PSTR_RETRIES 100 74#define PSTR_RETRIES 100
37#define PSTR_DELAY_US 10 75#define PSTR_DELAY_US 10
@@ -43,6 +81,12 @@ static int pd_power_down(struct generic_pm_domain *genpd)
43 struct sh7372_pm_domain *sh7372_pd = to_sh7372_pd(genpd); 81 struct sh7372_pm_domain *sh7372_pd = to_sh7372_pd(genpd);
44 unsigned int mask = 1 << sh7372_pd->bit_shift; 82 unsigned int mask = 1 << sh7372_pd->bit_shift;
45 83
84 if (sh7372_pd->suspend)
85 sh7372_pd->suspend();
86
87 if (sh7372_pd->stay_on)
88 return 0;
89
46 if (__raw_readl(PSTR) & mask) { 90 if (__raw_readl(PSTR) & mask) {
47 unsigned int retry_count; 91 unsigned int retry_count;
48 92
@@ -55,8 +99,9 @@ static int pd_power_down(struct generic_pm_domain *genpd)
55 } 99 }
56 } 100 }
57 101
58 pr_debug("sh7372 power domain down 0x%08x -> PSTR = 0x%08x\n", 102 if (!sh7372_pd->no_debug)
59 mask, __raw_readl(PSTR)); 103 pr_debug("sh7372 power domain down 0x%08x -> PSTR = 0x%08x\n",
104 mask, __raw_readl(PSTR));
60 105
61 return 0; 106 return 0;
62} 107}
@@ -68,6 +113,9 @@ static int pd_power_up(struct generic_pm_domain *genpd)
68 unsigned int retry_count; 113 unsigned int retry_count;
69 int ret = 0; 114 int ret = 0;
70 115
116 if (sh7372_pd->stay_on)
117 goto out;
118
71 if (__raw_readl(PSTR) & mask) 119 if (__raw_readl(PSTR) & mask)
72 goto out; 120 goto out;
73 121
@@ -84,66 +132,48 @@ static int pd_power_up(struct generic_pm_domain *genpd)
84 if (__raw_readl(SWUCR) & mask) 132 if (__raw_readl(SWUCR) & mask)
85 ret = -EIO; 133 ret = -EIO;
86 134
135 if (!sh7372_pd->no_debug)
136 pr_debug("sh7372 power domain up 0x%08x -> PSTR = 0x%08x\n",
137 mask, __raw_readl(PSTR));
138
87 out: 139 out:
88 pr_debug("sh7372 power domain up 0x%08x -> PSTR = 0x%08x\n", 140 if (ret == 0 && sh7372_pd->resume)
89 mask, __raw_readl(PSTR)); 141 sh7372_pd->resume();
90 142
91 return ret; 143 return ret;
92} 144}
93 145
94static int pd_power_up_a3rv(struct generic_pm_domain *genpd) 146static void sh7372_a4r_suspend(void)
95{ 147{
96 int ret = pd_power_up(genpd); 148 sh7372_intcs_suspend();
97 149 __raw_writel(0x300fffff, WUPRMSK); /* avoid wakeup */
98 /* force A4LC on after A3RV has been requested on */
99 pm_genpd_poweron(&sh7372_a4lc.genpd);
100
101 return ret;
102} 150}
103 151
104static int pd_power_down_a3rv(struct generic_pm_domain *genpd) 152static bool pd_active_wakeup(struct device *dev)
105{ 153{
106 int ret = pd_power_down(genpd); 154 return true;
107
108 /* try to power down A4LC after A3RV is requested off */
109 genpd_queue_power_off_work(&sh7372_a4lc.genpd);
110
111 return ret;
112} 155}
113 156
114static int pd_power_down_a4lc(struct generic_pm_domain *genpd) 157static bool sh7372_power_down_forbidden(struct dev_pm_domain *domain)
115{ 158{
116 /* only power down A4LC if A3RV is off */ 159 return false;
117 if (!(__raw_readl(PSTR) & (1 << sh7372_a3rv.bit_shift)))
118 return pd_power_down(genpd);
119
120 return -EBUSY;
121} 160}
122 161
123static bool pd_active_wakeup(struct device *dev) 162struct dev_power_governor sh7372_always_on_gov = {
124{ 163 .power_down_ok = sh7372_power_down_forbidden,
125 return true; 164};
126}
127 165
128void sh7372_init_pm_domain(struct sh7372_pm_domain *sh7372_pd) 166void sh7372_init_pm_domain(struct sh7372_pm_domain *sh7372_pd)
129{ 167{
130 struct generic_pm_domain *genpd = &sh7372_pd->genpd; 168 struct generic_pm_domain *genpd = &sh7372_pd->genpd;
131 169
132 pm_genpd_init(genpd, NULL, false); 170 pm_genpd_init(genpd, sh7372_pd->gov, false);
133 genpd->stop_device = pm_clk_suspend; 171 genpd->stop_device = pm_clk_suspend;
134 genpd->start_device = pm_clk_resume; 172 genpd->start_device = pm_clk_resume;
173 genpd->dev_irq_safe = true;
135 genpd->active_wakeup = pd_active_wakeup; 174 genpd->active_wakeup = pd_active_wakeup;
136 175 genpd->power_off = pd_power_down;
137 if (sh7372_pd == &sh7372_a4lc) { 176 genpd->power_on = pd_power_up;
138 genpd->power_off = pd_power_down_a4lc;
139 genpd->power_on = pd_power_up;
140 } else if (sh7372_pd == &sh7372_a3rv) {
141 genpd->power_off = pd_power_down_a3rv;
142 genpd->power_on = pd_power_up_a3rv;
143 } else {
144 genpd->power_off = pd_power_down;
145 genpd->power_on = pd_power_up;
146 }
147 genpd->power_on(&sh7372_pd->genpd); 177 genpd->power_on(&sh7372_pd->genpd);
148} 178}
149 179
@@ -152,11 +182,15 @@ void sh7372_add_device_to_domain(struct sh7372_pm_domain *sh7372_pd,
152{ 182{
153 struct device *dev = &pdev->dev; 183 struct device *dev = &pdev->dev;
154 184
155 if (!dev->power.subsys_data) {
156 pm_clk_init(dev);
157 pm_clk_add(dev, NULL);
158 }
159 pm_genpd_add_device(&sh7372_pd->genpd, dev); 185 pm_genpd_add_device(&sh7372_pd->genpd, dev);
186 if (pm_clk_no_clocks(dev))
187 pm_clk_add(dev, NULL);
188}
189
190void sh7372_pm_add_subdomain(struct sh7372_pm_domain *sh7372_pd,
191 struct sh7372_pm_domain *sh7372_sd)
192{
193 pm_genpd_add_subdomain(&sh7372_pd->genpd, &sh7372_sd->genpd);
160} 194}
161 195
162struct sh7372_pm_domain sh7372_a4lc = { 196struct sh7372_pm_domain sh7372_a4lc = {
@@ -171,6 +205,14 @@ struct sh7372_pm_domain sh7372_d4 = {
171 .bit_shift = 3, 205 .bit_shift = 3,
172}; 206};
173 207
208struct sh7372_pm_domain sh7372_a4r = {
209 .bit_shift = 5,
210 .gov = &sh7372_always_on_gov,
211 .suspend = sh7372_a4r_suspend,
212 .resume = sh7372_intcs_resume,
213 .stay_on = true,
214};
215
174struct sh7372_pm_domain sh7372_a3rv = { 216struct sh7372_pm_domain sh7372_a3rv = {
175 .bit_shift = 6, 217 .bit_shift = 6,
176}; 218};
@@ -179,39 +221,187 @@ struct sh7372_pm_domain sh7372_a3ri = {
179 .bit_shift = 8, 221 .bit_shift = 8,
180}; 222};
181 223
224struct sh7372_pm_domain sh7372_a3sp = {
225 .bit_shift = 11,
226 .gov = &sh7372_always_on_gov,
227 .no_debug = true,
228};
229
182struct sh7372_pm_domain sh7372_a3sg = { 230struct sh7372_pm_domain sh7372_a3sg = {
183 .bit_shift = 13, 231 .bit_shift = 13,
184}; 232};
185 233
186#endif /* CONFIG_PM */ 234#endif /* CONFIG_PM */
187 235
236#if defined(CONFIG_SUSPEND) || defined(CONFIG_CPU_IDLE)
237static int sh7372_do_idle_core_standby(unsigned long unused)
238{
239 cpu_do_idle(); /* WFI when SYSTBCR == 0x10 -> Core Standby */
240 return 0;
241}
242
188static void sh7372_enter_core_standby(void) 243static void sh7372_enter_core_standby(void)
189{ 244{
190 void __iomem *smfram = (void __iomem *)SMFRAM; 245 /* set reset vector, translate 4k */
246 __raw_writel(__pa(sh7372_resume_core_standby_a3sm), SBAR);
247 __raw_writel(0, APARMBAREA);
191 248
192 __raw_writel(0, APARMBAREA); /* translate 4k */ 249 /* enter sleep mode with SYSTBCR to 0x10 */
193 __raw_writel(__pa(sh7372_cpu_resume), SBAR); /* set reset vector */ 250 __raw_writel(0x10, SYSTBCR);
194 __raw_writel(0x10, SYSTBCR); /* enable core standby */ 251 cpu_suspend(0, sh7372_do_idle_core_standby);
252 __raw_writel(0, SYSTBCR);
195 253
196 __raw_writel(0, smfram + 0x3c); /* clear page table address */ 254 /* disable reset vector translation */
255 __raw_writel(0, SBAR);
256}
257#endif
258
259#ifdef CONFIG_SUSPEND
260static void sh7372_enter_a3sm_common(int pllc0_on)
261{
262 /* set reset vector, translate 4k */
263 __raw_writel(__pa(sh7372_resume_core_standby_a3sm), SBAR);
264 __raw_writel(0, APARMBAREA);
265
266 if (pllc0_on)
267 __raw_writel(0, PLLC01STPCR);
268 else
269 __raw_writel(1 << 28, PLLC01STPCR);
270
271 __raw_writel(0, PDNSEL); /* power-down A3SM only, not A4S */
272 __raw_readl(WUPSFAC); /* read wakeup int. factor before sleep */
273 cpu_suspend(0, sh7372_do_idle_a3sm);
274 __raw_readl(WUPSFAC); /* read wakeup int. factor after wakeup */
275
276 /* disable reset vector translation */
277 __raw_writel(0, SBAR);
278}
279
280static int sh7372_a3sm_valid(unsigned long *mskp, unsigned long *msk2p)
281{
282 unsigned long mstpsr0, mstpsr1, mstpsr2, mstpsr3, mstpsr4;
283 unsigned long msk, msk2;
284
285 /* check active clocks to determine potential wakeup sources */
286
287 mstpsr0 = __raw_readl(MSTPSR0);
288 if ((mstpsr0 & 0x00000003) != 0x00000003) {
289 pr_debug("sh7372 mstpsr0 0x%08lx\n", mstpsr0);
290 return 0;
291 }
292
293 mstpsr1 = __raw_readl(MSTPSR1);
294 if ((mstpsr1 & 0xff079b7f) != 0xff079b7f) {
295 pr_debug("sh7372 mstpsr1 0x%08lx\n", mstpsr1);
296 return 0;
297 }
197 298
198 sh7372_cpu_suspend(); 299 mstpsr2 = __raw_readl(MSTPSR2);
199 cpu_init(); 300 if ((mstpsr2 & 0x000741ff) != 0x000741ff) {
301 pr_debug("sh7372 mstpsr2 0x%08lx\n", mstpsr2);
302 return 0;
303 }
200 304
201 /* if page table address is non-NULL then we have been powered down */ 305 mstpsr3 = __raw_readl(MSTPSR3);
202 if (__raw_readl(smfram + 0x3c)) { 306 if ((mstpsr3 & 0x1a60f010) != 0x1a60f010) {
203 __raw_writel(__raw_readl(smfram + 0x40), 307 pr_debug("sh7372 mstpsr3 0x%08lx\n", mstpsr3);
204 __va(__raw_readl(smfram + 0x3c))); 308 return 0;
309 }
205 310
206 flush_tlb_all(); 311 mstpsr4 = __raw_readl(MSTPSR4);
207 set_cr(__raw_readl(smfram + 0x38)); 312 if ((mstpsr4 & 0x00008cf0) != 0x00008cf0) {
313 pr_debug("sh7372 mstpsr4 0x%08lx\n", mstpsr4);
314 return 0;
208 } 315 }
209 316
210 __raw_writel(0, SYSTBCR); /* disable core standby */ 317 msk = 0;
211 __raw_writel(0, SBAR); /* disable reset vector translation */ 318 msk2 = 0;
319
320 /* make bitmaps of limited number of wakeup sources */
321
322 if ((mstpsr2 & (1 << 23)) == 0) /* SPU2 */
323 msk |= 1 << 31;
324
325 if ((mstpsr2 & (1 << 12)) == 0) /* MFI_MFIM */
326 msk |= 1 << 21;
327
328 if ((mstpsr4 & (1 << 3)) == 0) /* KEYSC */
329 msk |= 1 << 2;
330
331 if ((mstpsr1 & (1 << 24)) == 0) /* CMT0 */
332 msk |= 1 << 1;
333
334 if ((mstpsr3 & (1 << 29)) == 0) /* CMT1 */
335 msk |= 1 << 1;
336
337 if ((mstpsr4 & (1 << 0)) == 0) /* CMT2 */
338 msk |= 1 << 1;
339
340 if ((mstpsr2 & (1 << 13)) == 0) /* MFI_MFIS */
341 msk2 |= 1 << 17;
342
343 *mskp = msk;
344 *msk2p = msk2;
345
346 return 1;
347}
348
349static void sh7372_icr_to_irqcr(unsigned long icr, u16 *irqcr1p, u16 *irqcr2p)
350{
351 u16 tmp, irqcr1, irqcr2;
352 int k;
353
354 irqcr1 = 0;
355 irqcr2 = 0;
356
357 /* convert INTCA ICR register layout to SYSC IRQCR+IRQCR2 */
358 for (k = 0; k <= 7; k++) {
359 tmp = (icr >> ((7 - k) * 4)) & 0xf;
360 irqcr1 |= (tmp & 0x03) << (k * 2);
361 irqcr2 |= (tmp >> 2) << (k * 2);
362 }
363
364 *irqcr1p = irqcr1;
365 *irqcr2p = irqcr2;
366}
367
368static void sh7372_setup_a3sm(unsigned long msk, unsigned long msk2)
369{
370 u16 irqcrx_low, irqcrx_high, irqcry_low, irqcry_high;
371 unsigned long tmp;
372
373 /* read IRQ0A -> IRQ15A mask */
374 tmp = bitrev8(__raw_readb(INTMSK00A));
375 tmp |= bitrev8(__raw_readb(INTMSK10A)) << 8;
376
377 /* setup WUPSMSK from clocks and external IRQ mask */
378 msk = (~msk & 0xc030000f) | (tmp << 4);
379 __raw_writel(msk, WUPSMSK);
380
381 /* propage level/edge trigger for external IRQ 0->15 */
382 sh7372_icr_to_irqcr(__raw_readl(ICR1A), &irqcrx_low, &irqcry_low);
383 sh7372_icr_to_irqcr(__raw_readl(ICR2A), &irqcrx_high, &irqcry_high);
384 __raw_writel((irqcrx_high << 16) | irqcrx_low, IRQCR);
385 __raw_writel((irqcry_high << 16) | irqcry_low, IRQCR2);
386
387 /* read IRQ16A -> IRQ31A mask */
388 tmp = bitrev8(__raw_readb(INTMSK20A));
389 tmp |= bitrev8(__raw_readb(INTMSK30A)) << 8;
390
391 /* setup WUPSMSK2 from clocks and external IRQ mask */
392 msk2 = (~msk2 & 0x00030000) | tmp;
393 __raw_writel(msk2, WUPSMSK2);
394
395 /* propage level/edge trigger for external IRQ 16->31 */
396 sh7372_icr_to_irqcr(__raw_readl(ICR3A), &irqcrx_low, &irqcry_low);
397 sh7372_icr_to_irqcr(__raw_readl(ICR4A), &irqcrx_high, &irqcry_high);
398 __raw_writel((irqcrx_high << 16) | irqcrx_low, IRQCR3);
399 __raw_writel((irqcry_high << 16) | irqcry_low, IRQCR4);
212} 400}
401#endif
213 402
214#ifdef CONFIG_CPU_IDLE 403#ifdef CONFIG_CPU_IDLE
404
215static void sh7372_cpuidle_setup(struct cpuidle_device *dev) 405static void sh7372_cpuidle_setup(struct cpuidle_device *dev)
216{ 406{
217 struct cpuidle_state *state; 407 struct cpuidle_state *state;
@@ -239,9 +429,25 @@ static void sh7372_cpuidle_init(void) {}
239#endif 429#endif
240 430
241#ifdef CONFIG_SUSPEND 431#ifdef CONFIG_SUSPEND
432
242static int sh7372_enter_suspend(suspend_state_t suspend_state) 433static int sh7372_enter_suspend(suspend_state_t suspend_state)
243{ 434{
244 sh7372_enter_core_standby(); 435 unsigned long msk, msk2;
436
437 /* check active clocks to determine potential wakeup sources */
438 if (sh7372_a3sm_valid(&msk, &msk2)) {
439
440 /* convert INTC mask and sense to SYSC mask and sense */
441 sh7372_setup_a3sm(msk, msk2);
442
443 /* enter A3SM sleep with PLLC0 off */
444 pr_debug("entering A3SM\n");
445 sh7372_enter_a3sm_common(0);
446 } else {
447 /* default to Core Standby that supports all wakeup sources */
448 pr_debug("entering Core Standby\n");
449 sh7372_enter_core_standby();
450 }
245 return 0; 451 return 0;
246} 452}
247 453
@@ -253,9 +459,6 @@ static void sh7372_suspend_init(void)
253static void sh7372_suspend_init(void) {} 459static void sh7372_suspend_init(void) {}
254#endif 460#endif
255 461
256#define DBGREG1 0xe6100020
257#define DBGREG9 0xe6100040
258
259void __init sh7372_pm_init(void) 462void __init sh7372_pm_init(void)
260{ 463{
261 /* enable DBG hardware block to kick SYSC */ 464 /* enable DBG hardware block to kick SYSC */
@@ -263,6 +466,9 @@ void __init sh7372_pm_init(void)
263 __raw_writel(0x0000a501, DBGREG9); 466 __raw_writel(0x0000a501, DBGREG9);
264 __raw_writel(0x00000000, DBGREG1); 467 __raw_writel(0x00000000, DBGREG1);
265 468
469 /* do not convert A3SM, A3SP, A3SG, A4R power down into A4S */
470 __raw_writel(0, PDNSEL);
471
266 sh7372_suspend_init(); 472 sh7372_suspend_init();
267 sh7372_cpuidle_init(); 473 sh7372_cpuidle_init();
268} 474}
diff --git a/arch/arm/mach-shmobile/pm_runtime.c b/arch/arm/mach-shmobile/pm_runtime.c
index 6ec454e1e06..bd5c6a3b8c5 100644
--- a/arch/arm/mach-shmobile/pm_runtime.c
+++ b/arch/arm/mach-shmobile/pm_runtime.c
@@ -15,6 +15,7 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/pm_runtime.h> 16#include <linux/pm_runtime.h>
17#include <linux/pm_domain.h> 17#include <linux/pm_domain.h>
18#include <linux/pm_clock.h>
18#include <linux/platform_device.h> 19#include <linux/platform_device.h>
19#include <linux/clk.h> 20#include <linux/clk.h>
20#include <linux/sh_clk.h> 21#include <linux/sh_clk.h>
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index 2d9b1b1a253..2380389e6ac 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -30,6 +30,7 @@
30#include <linux/sh_dma.h> 30#include <linux/sh_dma.h>
31#include <linux/sh_intc.h> 31#include <linux/sh_intc.h>
32#include <linux/sh_timer.h> 32#include <linux/sh_timer.h>
33#include <linux/pm_domain.h>
33#include <mach/hardware.h> 34#include <mach/hardware.h>
34#include <mach/sh7372.h> 35#include <mach/sh7372.h>
35#include <asm/mach-types.h> 36#include <asm/mach-types.h>
@@ -990,9 +991,14 @@ void __init sh7372_add_standard_devices(void)
990 sh7372_init_pm_domain(&sh7372_a4lc); 991 sh7372_init_pm_domain(&sh7372_a4lc);
991 sh7372_init_pm_domain(&sh7372_a4mp); 992 sh7372_init_pm_domain(&sh7372_a4mp);
992 sh7372_init_pm_domain(&sh7372_d4); 993 sh7372_init_pm_domain(&sh7372_d4);
994 sh7372_init_pm_domain(&sh7372_a4r);
993 sh7372_init_pm_domain(&sh7372_a3rv); 995 sh7372_init_pm_domain(&sh7372_a3rv);
994 sh7372_init_pm_domain(&sh7372_a3ri); 996 sh7372_init_pm_domain(&sh7372_a3ri);
995 sh7372_init_pm_domain(&sh7372_a3sg); 997 sh7372_init_pm_domain(&sh7372_a3sg);
998 sh7372_init_pm_domain(&sh7372_a3sp);
999
1000 sh7372_pm_add_subdomain(&sh7372_a4lc, &sh7372_a3rv);
1001 sh7372_pm_add_subdomain(&sh7372_a4r, &sh7372_a4lc);
996 1002
997 platform_add_devices(sh7372_early_devices, 1003 platform_add_devices(sh7372_early_devices,
998 ARRAY_SIZE(sh7372_early_devices)); 1004 ARRAY_SIZE(sh7372_early_devices));
@@ -1003,6 +1009,25 @@ void __init sh7372_add_standard_devices(void)
1003 sh7372_add_device_to_domain(&sh7372_a3rv, &vpu_device); 1009 sh7372_add_device_to_domain(&sh7372_a3rv, &vpu_device);
1004 sh7372_add_device_to_domain(&sh7372_a4mp, &spu0_device); 1010 sh7372_add_device_to_domain(&sh7372_a4mp, &spu0_device);
1005 sh7372_add_device_to_domain(&sh7372_a4mp, &spu1_device); 1011 sh7372_add_device_to_domain(&sh7372_a4mp, &spu1_device);
1012 sh7372_add_device_to_domain(&sh7372_a3sp, &scif0_device);
1013 sh7372_add_device_to_domain(&sh7372_a3sp, &scif1_device);
1014 sh7372_add_device_to_domain(&sh7372_a3sp, &scif2_device);
1015 sh7372_add_device_to_domain(&sh7372_a3sp, &scif3_device);
1016 sh7372_add_device_to_domain(&sh7372_a3sp, &scif4_device);
1017 sh7372_add_device_to_domain(&sh7372_a3sp, &scif5_device);
1018 sh7372_add_device_to_domain(&sh7372_a3sp, &scif6_device);
1019 sh7372_add_device_to_domain(&sh7372_a3sp, &iic1_device);
1020 sh7372_add_device_to_domain(&sh7372_a3sp, &dma0_device);
1021 sh7372_add_device_to_domain(&sh7372_a3sp, &dma1_device);
1022 sh7372_add_device_to_domain(&sh7372_a3sp, &dma2_device);
1023 sh7372_add_device_to_domain(&sh7372_a3sp, &usb_dma0_device);
1024 sh7372_add_device_to_domain(&sh7372_a3sp, &usb_dma1_device);
1025 sh7372_add_device_to_domain(&sh7372_a4r, &iic0_device);
1026 sh7372_add_device_to_domain(&sh7372_a4r, &veu0_device);
1027 sh7372_add_device_to_domain(&sh7372_a4r, &veu1_device);
1028 sh7372_add_device_to_domain(&sh7372_a4r, &veu2_device);
1029 sh7372_add_device_to_domain(&sh7372_a4r, &veu3_device);
1030 sh7372_add_device_to_domain(&sh7372_a4r, &jpu_device);
1006} 1031}
1007 1032
1008void __init sh7372_add_early_devices(void) 1033void __init sh7372_add_early_devices(void)
diff --git a/arch/arm/mach-shmobile/sleep-sh7372.S b/arch/arm/mach-shmobile/sleep-sh7372.S
index d37d3ca4d18..f3ab3c5810e 100644
--- a/arch/arm/mach-shmobile/sleep-sh7372.S
+++ b/arch/arm/mach-shmobile/sleep-sh7372.S
@@ -30,58 +30,20 @@
30 */ 30 */
31 31
32#include <linux/linkage.h> 32#include <linux/linkage.h>
33#include <linux/init.h>
34#include <asm/memory.h>
33#include <asm/assembler.h> 35#include <asm/assembler.h>
34 36
35#define SMFRAM 0xe6a70000 37#if defined(CONFIG_SUSPEND) || defined(CONFIG_CPU_IDLE)
36 38 .align 12
37 .align 39 .text
38kernel_flush: 40 .global sh7372_resume_core_standby_a3sm
39 .word v7_flush_dcache_all 41sh7372_resume_core_standby_a3sm:
40 42 ldr pc, 1f
41 .align 3 431: .long cpu_resume - PAGE_OFFSET + PLAT_PHYS_OFFSET
42ENTRY(sh7372_cpu_suspend)
43 stmfd sp!, {r0-r12, lr} @ save registers on stack
44
45 ldr r8, =SMFRAM
46
47 mov r4, sp @ Store sp
48 mrs r5, spsr @ Store spsr
49 mov r6, lr @ Store lr
50 stmia r8!, {r4-r6}
51
52 mrc p15, 0, r4, c1, c0, 2 @ Coprocessor access control register
53 mrc p15, 0, r5, c2, c0, 0 @ TTBR0
54 mrc p15, 0, r6, c2, c0, 1 @ TTBR1
55 mrc p15, 0, r7, c2, c0, 2 @ TTBCR
56 stmia r8!, {r4-r7}
57
58 mrc p15, 0, r4, c3, c0, 0 @ Domain access Control Register
59 mrc p15, 0, r5, c10, c2, 0 @ PRRR
60 mrc p15, 0, r6, c10, c2, 1 @ NMRR
61 stmia r8!,{r4-r6}
62
63 mrc p15, 0, r4, c13, c0, 1 @ Context ID
64 mrc p15, 0, r5, c13, c0, 2 @ User r/w thread and process ID
65 mrc p15, 0, r6, c12, c0, 0 @ Secure or NS vector base address
66 mrs r7, cpsr @ Store current cpsr
67 stmia r8!, {r4-r7}
68
69 mrc p15, 0, r4, c1, c0, 0 @ save control register
70 stmia r8!, {r4}
71
72 /*
73 * jump out to kernel flush routine
74 * - reuse that code is better
75 * - it executes in a cached space so is faster than refetch per-block
76 * - should be faster and will change with kernel
77 * - 'might' have to copy address, load and jump to it
78 * Flush all data from the L1 data cache before disabling
79 * SCTLR.C bit.
80 */
81 ldr r1, kernel_flush
82 mov lr, pc
83 bx r1
84 44
45 .global sh7372_do_idle_a3sm
46sh7372_do_idle_a3sm:
85 /* 47 /*
86 * Clear the SCTLR.C bit to prevent further data cache 48 * Clear the SCTLR.C bit to prevent further data cache
87 * allocation. Clearing SCTLR.C would make all the data accesses 49 * allocation. Clearing SCTLR.C would make all the data accesses
@@ -92,10 +54,13 @@ ENTRY(sh7372_cpu_suspend)
92 mcr p15, 0, r0, c1, c0, 0 54 mcr p15, 0, r0, c1, c0, 0
93 isb 55 isb
94 56
57 /* disable L2 cache in the aux control register */
58 mrc p15, 0, r10, c1, c0, 1
59 bic r10, r10, #2
60 mcr p15, 0, r10, c1, c0, 1
61
95 /* 62 /*
96 * Invalidate L1 data cache. Even though only invalidate is 63 * Invalidate data cache again.
97 * necessary exported flush API is used here. Doing clean
98 * on already clean cache would be almost NOP.
99 */ 64 */
100 ldr r1, kernel_flush 65 ldr r1, kernel_flush
101 blx r1 66 blx r1
@@ -115,146 +80,16 @@ ENTRY(sh7372_cpu_suspend)
115 dsb 80 dsb
116 dmb 81 dmb
117 82
118/* 83#define SPDCR 0xe6180008
119 * =================================== 84#define A3SM (1 << 12)
120 * == WFI instruction => Enter idle ==
121 * ===================================
122 */
123 wfi @ wait for interrupt
124
125/*
126 * ===================================
127 * == Resume path for non-OFF modes ==
128 * ===================================
129 */
130 mrc p15, 0, r0, c1, c0, 0
131 tst r0, #(1 << 2) @ Check C bit enabled?
132 orreq r0, r0, #(1 << 2) @ Enable the C bit if cleared
133 mcreq p15, 0, r0, c1, c0, 0
134 isb
135
136/*
137 * ===================================
138 * == Exit point from non-OFF modes ==
139 * ===================================
140 */
141 ldmfd sp!, {r0-r12, pc} @ restore regs and return
142 85
143 .pool 86 /* A3SM power down */
87 ldr r0, =SPDCR
88 ldr r1, =A3SM
89 str r1, [r0]
901:
91 b 1b
144 92
145 .align 12 93kernel_flush:
146 .text 94 .word v7_flush_dcache_all
147 .global sh7372_cpu_resume 95#endif
148sh7372_cpu_resume:
149
150 mov r1, #0
151 /*
152 * Invalidate all instruction caches to PoU
153 * and flush branch target cache
154 */
155 mcr p15, 0, r1, c7, c5, 0
156
157 ldr r3, =SMFRAM
158
159 ldmia r3!, {r4-r6}
160 mov sp, r4 @ Restore sp
161 msr spsr_cxsf, r5 @ Restore spsr
162 mov lr, r6 @ Restore lr
163
164 ldmia r3!, {r4-r7}
165 mcr p15, 0, r4, c1, c0, 2 @ Coprocessor access Control Register
166 mcr p15, 0, r5, c2, c0, 0 @ TTBR0
167 mcr p15, 0, r6, c2, c0, 1 @ TTBR1
168 mcr p15, 0, r7, c2, c0, 2 @ TTBCR
169
170 ldmia r3!,{r4-r6}
171 mcr p15, 0, r4, c3, c0, 0 @ Domain access Control Register
172 mcr p15, 0, r5, c10, c2, 0 @ PRRR
173 mcr p15, 0, r6, c10, c2, 1 @ NMRR
174
175 ldmia r3!,{r4-r7}
176 mcr p15, 0, r4, c13, c0, 1 @ Context ID
177 mcr p15, 0, r5, c13, c0, 2 @ User r/w thread and process ID
178 mrc p15, 0, r6, c12, c0, 0 @ Secure or NS vector base address
179 msr cpsr, r7 @ store cpsr
180
181 /* Starting to enable MMU here */
182 mrc p15, 0, r7, c2, c0, 2 @ Read TTBRControl
183 /* Extract N (0:2) bits and decide whether to use TTBR0 or TTBR1 */
184 and r7, #0x7
185 cmp r7, #0x0
186 beq usettbr0
187ttbr_error:
188 /*
189 * More work needs to be done to support N[0:2] value other than 0
190 * So looping here so that the error can be detected
191 */
192 b ttbr_error
193
194 .align
195cache_pred_disable_mask:
196 .word 0xFFFFE7FB
197ttbrbit_mask:
198 .word 0xFFFFC000
199table_index_mask:
200 .word 0xFFF00000
201table_entry:
202 .word 0x00000C02
203usettbr0:
204
205 mrc p15, 0, r2, c2, c0, 0
206 ldr r5, ttbrbit_mask
207 and r2, r5
208 mov r4, pc
209 ldr r5, table_index_mask
210 and r4, r5 @ r4 = 31 to 20 bits of pc
211 /* Extract the value to be written to table entry */
212 ldr r6, table_entry
213 /* r6 has the value to be written to table entry */
214 add r6, r6, r4
215 /* Getting the address of table entry to modify */
216 lsr r4, #18
217 /* r2 has the location which needs to be modified */
218 add r2, r4
219 ldr r4, [r2]
220 str r6, [r2] /* modify the table entry */
221
222 mov r7, r6
223 mov r5, r2
224 mov r6, r4
225 /* r5 = original page table address */
226 /* r6 = original page table data */
227
228 mov r0, #0
229 mcr p15, 0, r0, c7, c5, 4 @ Flush prefetch buffer
230 mcr p15, 0, r0, c7, c5, 6 @ Invalidate branch predictor array
231 mcr p15, 0, r0, c8, c5, 0 @ Invalidate instruction TLB
232 mcr p15, 0, r0, c8, c6, 0 @ Invalidate data TLB
233
234 /*
235 * Restore control register. This enables the MMU.
236 * The caches and prediction are not enabled here, they
237 * will be enabled after restoring the MMU table entry.
238 */
239 ldmia r3!, {r4}
240 stmia r3!, {r5} /* save original page table address */
241 stmia r3!, {r6} /* save original page table data */
242 stmia r3!, {r7} /* save modified page table data */
243
244 ldr r2, cache_pred_disable_mask
245 and r4, r2
246 mcr p15, 0, r4, c1, c0, 0
247 dsb
248 isb
249
250 ldr r0, =restoremmu_on
251 bx r0
252
253/*
254 * ==============================
255 * == Exit point from OFF mode ==
256 * ==============================
257 */
258restoremmu_on:
259
260 ldmfd sp!, {r0-r12, pc} @ restore regs and return
diff --git a/arch/arm/mach-spear3xx/Makefile.boot b/arch/arm/mach-spear3xx/Makefile.boot
index 7a1f3c0eadb..4674a4c221d 100644
--- a/arch/arm/mach-spear3xx/Makefile.boot
+++ b/arch/arm/mach-spear3xx/Makefile.boot
@@ -1,3 +1,3 @@
1zreladdr-y := 0x00008000 1zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-spear6xx/Makefile.boot b/arch/arm/mach-spear6xx/Makefile.boot
index 7a1f3c0eadb..4674a4c221d 100644
--- a/arch/arm/mach-spear6xx/Makefile.boot
+++ b/arch/arm/mach-spear6xx/Makefile.boot
@@ -1,3 +1,3 @@
1zreladdr-y := 0x00008000 1zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-tcc8k/Makefile.boot b/arch/arm/mach-tcc8k/Makefile.boot
index f135c9deae1..5e02d4156b0 100644
--- a/arch/arm/mach-tcc8k/Makefile.boot
+++ b/arch/arm/mach-tcc8k/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x20008000 1 zreladdr-y += 0x20008000
2params_phys-y := 0x20000100 2params_phys-y := 0x20000100
3initrd_phys-y := 0x20800000 3initrd_phys-y := 0x20800000
diff --git a/arch/arm/mach-tegra/Makefile.boot b/arch/arm/mach-tegra/Makefile.boot
index 428ad122be0..5e870d29eca 100644
--- a/arch/arm/mach-tegra/Makefile.boot
+++ b/arch/arm/mach-tegra/Makefile.boot
@@ -1,4 +1,4 @@
1zreladdr-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00008000 1zreladdr-$(CONFIG_ARCH_TEGRA_2x_SOC) += 0x00008000
2params_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00000100 2params_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00000100
3initrd_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00800000 3initrd_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00800000
4 4
diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c
index 846cd7d69e3..c78ce41cca1 100644
--- a/arch/arm/mach-tegra/board-harmony.c
+++ b/arch/arm/mach-tegra/board-harmony.c
@@ -123,8 +123,8 @@ static struct platform_device *harmony_devices[] __initdata = {
123 &harmony_audio_device, 123 &harmony_audio_device,
124}; 124};
125 125
126static void __init tegra_harmony_fixup(struct machine_desc *desc, 126static void __init tegra_harmony_fixup(struct tag *tags, char **cmdline,
127 struct tag *tags, char **cmdline, struct meminfo *mi) 127 struct meminfo *mi)
128{ 128{
129 mi->nr_banks = 2; 129 mi->nr_banks = 2;
130 mi->bank[0].start = PHYS_OFFSET; 130 mi->bank[0].start = PHYS_OFFSET;
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index ea2f79c9879..5e6bc771964 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -84,8 +84,8 @@ static void paz00_usb_init(void)
84 platform_device_register(&tegra_ehci3_device); 84 platform_device_register(&tegra_ehci3_device);
85} 85}
86 86
87static void __init tegra_paz00_fixup(struct machine_desc *desc, 87static void __init tegra_paz00_fixup(struct tag *tags, char **cmdline,
88 struct tag *tags, char **cmdline, struct meminfo *mi) 88 struct meminfo *mi)
89{ 89{
90 mi->nr_banks = 1; 90 mi->nr_banks = 1;
91 mi->bank[0].start = PHYS_OFFSET; 91 mi->bank[0].start = PHYS_OFFSET;
diff --git a/arch/arm/mach-tegra/board-trimslice.c b/arch/arm/mach-tegra/board-trimslice.c
index 89a6d2adc1d..652c3404d0e 100644
--- a/arch/arm/mach-tegra/board-trimslice.c
+++ b/arch/arm/mach-tegra/board-trimslice.c
@@ -126,8 +126,8 @@ static void trimslice_usb_init(void)
126 platform_device_register(&tegra_ehci1_device); 126 platform_device_register(&tegra_ehci1_device);
127} 127}
128 128
129static void __init tegra_trimslice_fixup(struct machine_desc *desc, 129static void __init tegra_trimslice_fixup(struct tag *tags, char **cmdline,
130 struct tag *tags, char **cmdline, struct meminfo *mi) 130 struct meminfo *mi)
131{ 131{
132 mi->nr_banks = 2; 132 mi->nr_banks = 2;
133 mi->bank[0].start = PHYS_OFFSET; 133 mi->bank[0].start = PHYS_OFFSET;
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index 0886cbccdde..7d2b5d03c1d 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -114,10 +114,10 @@ void __init smp_init_cpus(void)
114{ 114{
115 unsigned int i, ncores = scu_get_core_count(scu_base); 115 unsigned int i, ncores = scu_get_core_count(scu_base);
116 116
117 if (ncores > NR_CPUS) { 117 if (ncores > nr_cpu_ids) {
118 printk(KERN_ERR "Tegra: no. of cores (%u) greater than configured (%u), clipping\n", 118 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
119 ncores, NR_CPUS); 119 ncores, nr_cpu_ids);
120 ncores = NR_CPUS; 120 ncores = nr_cpu_ids;
121 } 121 }
122 122
123 for (i = 0; i < ncores; i++) 123 for (i = 0; i < ncores; i++)
diff --git a/arch/arm/mach-u300/Kconfig b/arch/arm/mach-u300/Kconfig
index 32a7b0f7e9f..449fd6a8dbd 100644
--- a/arch/arm/mach-u300/Kconfig
+++ b/arch/arm/mach-u300/Kconfig
@@ -6,6 +6,8 @@ comment "ST-Ericsson Mobile Platform Products"
6 6
7config MACH_U300 7config MACH_U300
8 bool "U300" 8 bool "U300"
9 select PINCTRL
10 select PINMUX_U300
9 11
10comment "ST-Ericsson U300/U330/U335/U365 Feature Selections" 12comment "ST-Ericsson U300/U330/U335/U365 Feature Selections"
11 13
diff --git a/arch/arm/mach-u300/Makefile b/arch/arm/mach-u300/Makefile
index 8fd354aaf0a..285538124e5 100644
--- a/arch/arm/mach-u300/Makefile
+++ b/arch/arm/mach-u300/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the linux kernel, U300 machine. 2# Makefile for the linux kernel, U300 machine.
3# 3#
4 4
5obj-y := core.o clock.o timer.o padmux.o 5obj-y := core.o clock.o timer.o
6obj-m := 6obj-m :=
7obj-n := 7obj-n :=
8obj- := 8obj- :=
diff --git a/arch/arm/mach-u300/Makefile.boot b/arch/arm/mach-u300/Makefile.boot
index 6fbfc6ea2d3..69357affbd7 100644
--- a/arch/arm/mach-u300/Makefile.boot
+++ b/arch/arm/mach-u300/Makefile.boot
@@ -4,10 +4,10 @@
4# INITRD_PHYS must be in RAM 4# INITRD_PHYS must be in RAM
5 5
6ifdef CONFIG_MACH_U300_SINGLE_RAM 6ifdef CONFIG_MACH_U300_SINGLE_RAM
7 zreladdr-y := 0x28E08000 7 zreladdr-y += 0x28E08000
8 params_phys-y := 0x28E00100 8 params_phys-y := 0x28E00100
9else 9else
10 zreladdr-y := 0x48008000 10 zreladdr-y += 0x48008000
11 params_phys-y := 0x48000100 11 params_phys-y := 0x48000100
12endif 12endif
13 13
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index 399c89f14df..2f5929bdeaa 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -25,6 +25,8 @@
25#include <linux/err.h> 25#include <linux/err.h>
26#include <linux/mtd/nand.h> 26#include <linux/mtd/nand.h>
27#include <linux/mtd/fsmc.h> 27#include <linux/mtd/fsmc.h>
28#include <linux/pinctrl/machine.h>
29#include <linux/pinctrl/pinmux.h>
28 30
29#include <asm/types.h> 31#include <asm/types.h>
30#include <asm/setup.h> 32#include <asm/setup.h>
@@ -1535,6 +1537,14 @@ static struct coh901318_platform coh901318_platform = {
1535 .max_channels = U300_DMA_CHANNELS, 1537 .max_channels = U300_DMA_CHANNELS,
1536}; 1538};
1537 1539
1540static struct resource pinmux_resources[] = {
1541 {
1542 .start = U300_SYSCON_BASE,
1543 .end = U300_SYSCON_BASE + SZ_4K - 1,
1544 .flags = IORESOURCE_MEM,
1545 },
1546};
1547
1538static struct platform_device wdog_device = { 1548static struct platform_device wdog_device = {
1539 .name = "coh901327_wdog", 1549 .name = "coh901327_wdog",
1540 .id = -1, 1550 .id = -1,
@@ -1630,6 +1640,72 @@ static struct platform_device dma_device = {
1630 }, 1640 },
1631}; 1641};
1632 1642
1643static struct platform_device pinmux_device = {
1644 .name = "pinmux-u300",
1645 .id = -1,
1646 .num_resources = ARRAY_SIZE(pinmux_resources),
1647 .resource = pinmux_resources,
1648};
1649
1650/* Pinmux settings */
1651static struct pinmux_map u300_pinmux_map[] = {
1652 /* anonymous maps for chip power and EMIFs */
1653 PINMUX_MAP_PRIMARY_SYS_HOG("POWER", "power"),
1654 PINMUX_MAP_PRIMARY_SYS_HOG("EMIF0", "emif0"),
1655 PINMUX_MAP_PRIMARY_SYS_HOG("EMIF1", "emif1"),
1656 /* per-device maps for MMC/SD, SPI and UART */
1657 PINMUX_MAP_PRIMARY("MMCSD", "mmc0", "mmci"),
1658 PINMUX_MAP_PRIMARY("SPI", "spi0", "pl022"),
1659 PINMUX_MAP_PRIMARY("UART0", "uart0", "uart0"),
1660};
1661
1662struct u300_mux_hog {
1663 const char *name;
1664 struct device *dev;
1665 struct pinmux *pmx;
1666};
1667
1668static struct u300_mux_hog u300_mux_hogs[] = {
1669 {
1670 .name = "uart0",
1671 .dev = &uart0_device.dev,
1672 },
1673 {
1674 .name = "spi0",
1675 .dev = &pl022_device.dev,
1676 },
1677 {
1678 .name = "mmc0",
1679 .dev = &mmcsd_device.dev,
1680 },
1681};
1682
1683static int __init u300_pinmux_fetch(void)
1684{
1685 int i;
1686
1687 for (i = 0; i < ARRAY_SIZE(u300_mux_hogs); i++) {
1688 struct pinmux *pmx;
1689 int ret;
1690
1691 pmx = pinmux_get(u300_mux_hogs[i].dev, NULL);
1692 if (IS_ERR(pmx)) {
1693 pr_err("u300: could not get pinmux hog %s\n",
1694 u300_mux_hogs[i].name);
1695 continue;
1696 }
1697 ret = pinmux_enable(pmx);
1698 if (ret) {
1699 pr_err("u300: could enable pinmux hog %s\n",
1700 u300_mux_hogs[i].name);
1701 continue;
1702 }
1703 u300_mux_hogs[i].pmx = pmx;
1704 }
1705 return 0;
1706}
1707subsys_initcall(u300_pinmux_fetch);
1708
1633/* 1709/*
1634 * Notice that AMBA devices are initialized before platform devices. 1710 * Notice that AMBA devices are initialized before platform devices.
1635 * 1711 *
@@ -1643,10 +1719,10 @@ static struct platform_device *platform_devs[] __initdata = {
1643 &gpio_device, 1719 &gpio_device,
1644 &nand_device, 1720 &nand_device,
1645 &wdog_device, 1721 &wdog_device,
1646 &ave_device 1722 &ave_device,
1723 &pinmux_device,
1647}; 1724};
1648 1725
1649
1650/* 1726/*
1651 * Interrupts: the U300 platforms have two pl190 ARM PrimeCells connected 1727 * Interrupts: the U300 platforms have two pl190 ARM PrimeCells connected
1652 * together so some interrupts are connected to the first one and some 1728 * together so some interrupts are connected to the first one and some
@@ -1828,6 +1904,10 @@ void __init u300_init_devices(void)
1828 1904
1829 u300_assign_physmem(); 1905 u300_assign_physmem();
1830 1906
1907 /* Initialize pinmuxing */
1908 pinmux_register_mappings(u300_pinmux_map,
1909 ARRAY_SIZE(u300_pinmux_map));
1910
1831 /* Register subdevices on the I2C buses */ 1911 /* Register subdevices on the I2C buses */
1832 u300_i2c_register_board_devices(); 1912 u300_i2c_register_board_devices();
1833 1913
diff --git a/arch/arm/mach-u300/include/mach/syscon.h b/arch/arm/mach-u300/include/mach/syscon.h
index 7444f5c7da9..6e84f07a7c6 100644
--- a/arch/arm/mach-u300/include/mach/syscon.h
+++ b/arch/arm/mach-u300/include/mach/syscon.h
@@ -234,91 +234,6 @@
234#define U300_SYSCON_ECCR_EMIF_1_RET_OUT_CLK_EN_N_DISABLE (0x0004) 234#define U300_SYSCON_ECCR_EMIF_1_RET_OUT_CLK_EN_N_DISABLE (0x0004)
235#define U300_SYSCON_ECCR_EMIF_MEMCLK_RET_EN_N_DISABLE (0x0002) 235#define U300_SYSCON_ECCR_EMIF_MEMCLK_RET_EN_N_DISABLE (0x0002)
236#define U300_SYSCON_ECCR_EMIF_SDRCLK_RET_EN_N_DISABLE (0x0001) 236#define U300_SYSCON_ECCR_EMIF_SDRCLK_RET_EN_N_DISABLE (0x0001)
237/* PAD MUX Control register 1 (LOW) 16bit (R/W) */
238#define U300_SYSCON_PMC1LR (0x007C)
239#define U300_SYSCON_PMC1LR_MASK (0xFFFF)
240#define U300_SYSCON_PMC1LR_CDI_MASK (0xC000)
241#define U300_SYSCON_PMC1LR_CDI_CDI (0x0000)
242#define U300_SYSCON_PMC1LR_CDI_EMIF (0x4000)
243#ifdef CONFIG_MACH_U300_BS335
244#define U300_SYSCON_PMC1LR_CDI_CDI2 (0x8000)
245#define U300_SYSCON_PMC1LR_CDI_WCDMA_APP_GPIO (0xC000)
246#elif CONFIG_MACH_U300_BS365
247#define U300_SYSCON_PMC1LR_CDI_GPIO (0x8000)
248#define U300_SYSCON_PMC1LR_CDI_WCDMA (0xC000)
249#endif
250#define U300_SYSCON_PMC1LR_PDI_MASK (0x3000)
251#define U300_SYSCON_PMC1LR_PDI_PDI (0x0000)
252#define U300_SYSCON_PMC1LR_PDI_EGG (0x1000)
253#define U300_SYSCON_PMC1LR_PDI_WCDMA (0x3000)
254#define U300_SYSCON_PMC1LR_MMCSD_MASK (0x0C00)
255#define U300_SYSCON_PMC1LR_MMCSD_MMCSD (0x0000)
256#define U300_SYSCON_PMC1LR_MMCSD_MSPRO (0x0400)
257#define U300_SYSCON_PMC1LR_MMCSD_DSP (0x0800)
258#define U300_SYSCON_PMC1LR_MMCSD_WCDMA (0x0C00)
259#define U300_SYSCON_PMC1LR_ETM_MASK (0x0300)
260#define U300_SYSCON_PMC1LR_ETM_ACC (0x0000)
261#define U300_SYSCON_PMC1LR_ETM_APP (0x0100)
262#define U300_SYSCON_PMC1LR_EMIF_1_CS2_MASK (0x00C0)
263#define U300_SYSCON_PMC1LR_EMIF_1_CS2_STATIC (0x0000)
264#define U300_SYSCON_PMC1LR_EMIF_1_CS2_NFIF (0x0040)
265#define U300_SYSCON_PMC1LR_EMIF_1_CS2_SDRAM (0x0080)
266#define U300_SYSCON_PMC1LR_EMIF_1_CS2_STATIC_2GB (0x00C0)
267#define U300_SYSCON_PMC1LR_EMIF_1_CS1_MASK (0x0030)
268#define U300_SYSCON_PMC1LR_EMIF_1_CS1_STATIC (0x0000)
269#define U300_SYSCON_PMC1LR_EMIF_1_CS1_NFIF (0x0010)
270#define U300_SYSCON_PMC1LR_EMIF_1_CS1_SDRAM (0x0020)
271#define U300_SYSCON_PMC1LR_EMIF_1_CS1_SEMI (0x0030)
272#define U300_SYSCON_PMC1LR_EMIF_1_CS0_MASK (0x000C)
273#define U300_SYSCON_PMC1LR_EMIF_1_CS0_STATIC (0x0000)
274#define U300_SYSCON_PMC1LR_EMIF_1_CS0_NFIF (0x0004)
275#define U300_SYSCON_PMC1LR_EMIF_1_CS0_SDRAM (0x0008)
276#define U300_SYSCON_PMC1LR_EMIF_1_CS0_SEMI (0x000C)
277#define U300_SYSCON_PMC1LR_EMIF_1_MASK (0x0003)
278#define U300_SYSCON_PMC1LR_EMIF_1_STATIC (0x0000)
279#define U300_SYSCON_PMC1LR_EMIF_1_SDRAM0 (0x0001)
280#define U300_SYSCON_PMC1LR_EMIF_1_SDRAM1 (0x0002)
281#define U300_SYSCON_PMC1LR_EMIF_1 (0x0003)
282/* PAD MUX Control register 2 (HIGH) 16bit (R/W) */
283#define U300_SYSCON_PMC1HR (0x007E)
284#define U300_SYSCON_PMC1HR_MASK (0xFFFF)
285#define U300_SYSCON_PMC1HR_MISC_2_MASK (0xC000)
286#define U300_SYSCON_PMC1HR_MISC_2_APP_GPIO (0x0000)
287#define U300_SYSCON_PMC1HR_MISC_2_MSPRO (0x4000)
288#define U300_SYSCON_PMC1HR_MISC_2_DSP (0x8000)
289#define U300_SYSCON_PMC1HR_MISC_2_AAIF (0xC000)
290#define U300_SYSCON_PMC1HR_APP_GPIO_2_MASK (0x3000)
291#define U300_SYSCON_PMC1HR_APP_GPIO_2_APP_GPIO (0x0000)
292#define U300_SYSCON_PMC1HR_APP_GPIO_2_NFIF (0x1000)
293#define U300_SYSCON_PMC1HR_APP_GPIO_2_DSP (0x2000)
294#define U300_SYSCON_PMC1HR_APP_GPIO_2_AAIF (0x3000)
295#define U300_SYSCON_PMC1HR_APP_GPIO_1_MASK (0x0C00)
296#define U300_SYSCON_PMC1HR_APP_GPIO_1_APP_GPIO (0x0000)
297#define U300_SYSCON_PMC1HR_APP_GPIO_1_MMC (0x0400)
298#define U300_SYSCON_PMC1HR_APP_GPIO_1_DSP (0x0800)
299#define U300_SYSCON_PMC1HR_APP_GPIO_1_AAIF (0x0C00)
300#define U300_SYSCON_PMC1HR_APP_SPI_CS_2_MASK (0x0300)
301#define U300_SYSCON_PMC1HR_APP_SPI_CS_2_APP_GPIO (0x0000)
302#define U300_SYSCON_PMC1HR_APP_SPI_CS_2_SPI (0x0100)
303#define U300_SYSCON_PMC1HR_APP_SPI_CS_2_AAIF (0x0300)
304#define U300_SYSCON_PMC1HR_APP_SPI_CS_1_MASK (0x00C0)
305#define U300_SYSCON_PMC1HR_APP_SPI_CS_1_APP_GPIO (0x0000)
306#define U300_SYSCON_PMC1HR_APP_SPI_CS_1_SPI (0x0040)
307#define U300_SYSCON_PMC1HR_APP_SPI_CS_1_AAIF (0x00C0)
308#define U300_SYSCON_PMC1HR_APP_SPI_2_MASK (0x0030)
309#define U300_SYSCON_PMC1HR_APP_SPI_2_APP_GPIO (0x0000)
310#define U300_SYSCON_PMC1HR_APP_SPI_2_SPI (0x0010)
311#define U300_SYSCON_PMC1HR_APP_SPI_2_DSP (0x0020)
312#define U300_SYSCON_PMC1HR_APP_SPI_2_AAIF (0x0030)
313#define U300_SYSCON_PMC1HR_APP_UART0_2_MASK (0x000C)
314#define U300_SYSCON_PMC1HR_APP_UART0_2_APP_GPIO (0x0000)
315#define U300_SYSCON_PMC1HR_APP_UART0_2_UART0 (0x0004)
316#define U300_SYSCON_PMC1HR_APP_UART0_2_NFIF_CS (0x0008)
317#define U300_SYSCON_PMC1HR_APP_UART0_2_AAIF (0x000C)
318#define U300_SYSCON_PMC1HR_APP_UART0_1_MASK (0x0003)
319#define U300_SYSCON_PMC1HR_APP_UART0_1_APP_GPIO (0x0000)
320#define U300_SYSCON_PMC1HR_APP_UART0_1_UART0 (0x0001)
321#define U300_SYSCON_PMC1HR_APP_UART0_1_AAIF (0x0003)
322/* Step one for killing the applications system 16bit (-/W) */ 237/* Step one for killing the applications system 16bit (-/W) */
323#define U300_SYSCON_KA1R (0x0080) 238#define U300_SYSCON_KA1R (0x0080)
324#define U300_SYSCON_KA1R_MASK (0xFFFF) 239#define U300_SYSCON_KA1R_MASK (0xFFFF)
@@ -357,57 +272,6 @@
357#define U300_SYSCON_PUCR_EMIF_1_16BIT_PU_ENABLE (0x0080) 272#define U300_SYSCON_PUCR_EMIF_1_16BIT_PU_ENABLE (0x0080)
358#define U300_SYSCON_PUCR_EMIF_1_8BIT_PU_ENABLE (0x0040) 273#define U300_SYSCON_PUCR_EMIF_1_8BIT_PU_ENABLE (0x0040)
359#define U300_SYSCON_PUCR_KEY_IN_PU_EN_MASK (0x003F) 274#define U300_SYSCON_PUCR_KEY_IN_PU_EN_MASK (0x003F)
360/* Padmux 2 control */
361#define U300_SYSCON_PMC2R (0x100)
362#define U300_SYSCON_PMC2R_APP_MISC_0_MASK (0x00C0)
363#define U300_SYSCON_PMC2R_APP_MISC_0_APP_GPIO (0x0000)
364#define U300_SYSCON_PMC2R_APP_MISC_0_EMIF_SDRAM (0x0040)
365#define U300_SYSCON_PMC2R_APP_MISC_0_MMC (0x0080)
366#define U300_SYSCON_PMC2R_APP_MISC_0_CDI2 (0x00C0)
367#define U300_SYSCON_PMC2R_APP_MISC_1_MASK (0x0300)
368#define U300_SYSCON_PMC2R_APP_MISC_1_APP_GPIO (0x0000)
369#define U300_SYSCON_PMC2R_APP_MISC_1_EMIF_SDRAM (0x0100)
370#define U300_SYSCON_PMC2R_APP_MISC_1_MMC (0x0200)
371#define U300_SYSCON_PMC2R_APP_MISC_1_CDI2 (0x0300)
372#define U300_SYSCON_PMC2R_APP_MISC_2_MASK (0x0C00)
373#define U300_SYSCON_PMC2R_APP_MISC_2_APP_GPIO (0x0000)
374#define U300_SYSCON_PMC2R_APP_MISC_2_EMIF_SDRAM (0x0400)
375#define U300_SYSCON_PMC2R_APP_MISC_2_MMC (0x0800)
376#define U300_SYSCON_PMC2R_APP_MISC_2_CDI2 (0x0C00)
377#define U300_SYSCON_PMC2R_APP_MISC_3_MASK (0x3000)
378#define U300_SYSCON_PMC2R_APP_MISC_3_APP_GPIO (0x0000)
379#define U300_SYSCON_PMC2R_APP_MISC_3_EMIF_SDRAM (0x1000)
380#define U300_SYSCON_PMC2R_APP_MISC_3_MMC (0x2000)
381#define U300_SYSCON_PMC2R_APP_MISC_3_CDI2 (0x3000)
382#define U300_SYSCON_PMC2R_APP_MISC_4_MASK (0xC000)
383#define U300_SYSCON_PMC2R_APP_MISC_4_APP_GPIO (0x0000)
384#define U300_SYSCON_PMC2R_APP_MISC_4_EMIF_SDRAM (0x4000)
385#define U300_SYSCON_PMC2R_APP_MISC_4_MMC (0x8000)
386#define U300_SYSCON_PMC2R_APP_MISC_4_ACC_GPIO (0xC000)
387/* TODO: More SYSCON registers missing */
388#define U300_SYSCON_PMC3R (0x10c)
389#define U300_SYSCON_PMC3R_APP_MISC_11_MASK (0xc000)
390#define U300_SYSCON_PMC3R_APP_MISC_11_SPI (0x4000)
391#define U300_SYSCON_PMC3R_APP_MISC_10_MASK (0x3000)
392#define U300_SYSCON_PMC3R_APP_MISC_10_SPI (0x1000)
393/* TODO: Missing other configs */
394#define U300_SYSCON_PMC4R (0x168)
395#define U300_SYSCON_PMC4R_APP_MISC_12_MASK (0x0003)
396#define U300_SYSCON_PMC4R_APP_MISC_12_APP_GPIO (0x0000)
397#define U300_SYSCON_PMC4R_APP_MISC_13_MASK (0x000C)
398#define U300_SYSCON_PMC4R_APP_MISC_13_CDI (0x0000)
399#define U300_SYSCON_PMC4R_APP_MISC_13_SMIA (0x0004)
400#define U300_SYSCON_PMC4R_APP_MISC_13_SMIA2 (0x0008)
401#define U300_SYSCON_PMC4R_APP_MISC_13_APP_GPIO (0x000C)
402#define U300_SYSCON_PMC4R_APP_MISC_14_MASK (0x0030)
403#define U300_SYSCON_PMC4R_APP_MISC_14_CDI (0x0000)
404#define U300_SYSCON_PMC4R_APP_MISC_14_SMIA (0x0010)
405#define U300_SYSCON_PMC4R_APP_MISC_14_CDI2 (0x0020)
406#define U300_SYSCON_PMC4R_APP_MISC_14_APP_GPIO (0x0030)
407#define U300_SYSCON_PMC4R_APP_MISC_16_MASK (0x0300)
408#define U300_SYSCON_PMC4R_APP_MISC_16_APP_GPIO_13 (0x0000)
409#define U300_SYSCON_PMC4R_APP_MISC_16_APP_UART1_CTS (0x0100)
410#define U300_SYSCON_PMC4R_APP_MISC_16_EMIF_1_STATIC_CS5_N (0x0200)
411/* SYS_0_CLK_CONTROL first clock control 16bit (R/W) */ 275/* SYS_0_CLK_CONTROL first clock control 16bit (R/W) */
412#define U300_SYSCON_S0CCR (0x120) 276#define U300_SYSCON_S0CCR (0x120)
413#define U300_SYSCON_S0CCR_FIELD_MASK (0x43FF) 277#define U300_SYSCON_S0CCR_FIELD_MASK (0x43FF)
diff --git a/arch/arm/mach-u300/mmc.c b/arch/arm/mach-u300/mmc.c
index 677ccef5cd3..d5e4a98a9ab 100644
--- a/arch/arm/mach-u300/mmc.c
+++ b/arch/arm/mach-u300/mmc.c
@@ -21,7 +21,6 @@
21#include <mach/dma_channels.h> 21#include <mach/dma_channels.h>
22 22
23#include "mmc.h" 23#include "mmc.h"
24#include "padmux.h"
25 24
26static struct mmci_platform_data mmc0_plat_data = { 25static struct mmci_platform_data mmc0_plat_data = {
27 /* 26 /*
@@ -45,24 +44,9 @@ static struct mmci_platform_data mmc0_plat_data = {
45int __devinit mmc_init(struct amba_device *adev) 44int __devinit mmc_init(struct amba_device *adev)
46{ 45{
47 struct device *mmcsd_device = &adev->dev; 46 struct device *mmcsd_device = &adev->dev;
48 struct pmx *pmx;
49 int ret = 0; 47 int ret = 0;
50 48
51 mmcsd_device->platform_data = &mmc0_plat_data; 49 mmcsd_device->platform_data = &mmc0_plat_data;
52 50
53 /*
54 * Setup padmuxing for MMC. Since this must always be
55 * compiled into the kernel, pmx is never released.
56 */
57 pmx = pmx_get(mmcsd_device, U300_APP_PMX_MMC_SETTING);
58
59 if (IS_ERR(pmx))
60 pr_warning("Could not get padmux handle\n");
61 else {
62 ret = pmx_activate(mmcsd_device, pmx);
63 if (IS_ERR_VALUE(ret))
64 pr_warning("Could not activate padmuxing\n");
65 }
66
67 return ret; 51 return ret;
68} 52}
diff --git a/arch/arm/mach-u300/padmux.c b/arch/arm/mach-u300/padmux.c
deleted file mode 100644
index 4c93c6cefd3..00000000000
--- a/arch/arm/mach-u300/padmux.c
+++ /dev/null
@@ -1,367 +0,0 @@
1/*
2 *
3 * arch/arm/mach-u300/padmux.c
4 *
5 *
6 * Copyright (C) 2009 ST-Ericsson AB
7 * License terms: GNU General Public License (GPL) version 2
8 * U300 PADMUX functions
9 * Author: Martin Persson <martin.persson@stericsson.com>
10 */
11
12#include <linux/module.h>
13#include <linux/kernel.h>
14#include <linux/device.h>
15#include <linux/err.h>
16#include <linux/errno.h>
17#include <linux/io.h>
18#include <linux/mutex.h>
19#include <linux/string.h>
20#include <linux/bug.h>
21#include <linux/debugfs.h>
22#include <linux/seq_file.h>
23#include <mach/u300-regs.h>
24#include <mach/syscon.h>
25#include "padmux.h"
26
27static DEFINE_MUTEX(pmx_mutex);
28
29const u32 pmx_registers[] = {
30 (U300_SYSCON_VBASE + U300_SYSCON_PMC1LR),
31 (U300_SYSCON_VBASE + U300_SYSCON_PMC1HR),
32 (U300_SYSCON_VBASE + U300_SYSCON_PMC2R),
33 (U300_SYSCON_VBASE + U300_SYSCON_PMC3R),
34 (U300_SYSCON_VBASE + U300_SYSCON_PMC4R)
35};
36
37/* High level functionality */
38
39/* Lazy dog:
40 * onmask = {
41 * {"PMC1LR" mask, "PMC1LR" value},
42 * {"PMC1HR" mask, "PMC1HR" value},
43 * {"PMC2R" mask, "PMC2R" value},
44 * {"PMC3R" mask, "PMC3R" value},
45 * {"PMC4R" mask, "PMC4R" value}
46 * }
47 */
48static struct pmx mmc_setting = {
49 .setting = U300_APP_PMX_MMC_SETTING,
50 .default_on = false,
51 .activated = false,
52 .name = "MMC",
53 .onmask = {
54 {U300_SYSCON_PMC1LR_MMCSD_MASK,
55 U300_SYSCON_PMC1LR_MMCSD_MMCSD},
56 {0, 0},
57 {0, 0},
58 {0, 0},
59 {U300_SYSCON_PMC4R_APP_MISC_12_MASK,
60 U300_SYSCON_PMC4R_APP_MISC_12_APP_GPIO}
61 },
62};
63
64static struct pmx spi_setting = {
65 .setting = U300_APP_PMX_SPI_SETTING,
66 .default_on = false,
67 .activated = false,
68 .name = "SPI",
69 .onmask = {{0, 0},
70 {U300_SYSCON_PMC1HR_APP_SPI_2_MASK |
71 U300_SYSCON_PMC1HR_APP_SPI_CS_1_MASK |
72 U300_SYSCON_PMC1HR_APP_SPI_CS_2_MASK,
73 U300_SYSCON_PMC1HR_APP_SPI_2_SPI |
74 U300_SYSCON_PMC1HR_APP_SPI_CS_1_SPI |
75 U300_SYSCON_PMC1HR_APP_SPI_CS_2_SPI},
76 {0, 0},
77 {0, 0},
78 {0, 0}
79 },
80};
81
82/* Available padmux settings */
83static struct pmx *pmx_settings[] = {
84 &mmc_setting,
85 &spi_setting,
86};
87
88static void update_registers(struct pmx *pmx, bool activate)
89{
90 u16 regval, val, mask;
91 int i;
92
93 for (i = 0; i < ARRAY_SIZE(pmx_registers); i++) {
94 if (activate)
95 val = pmx->onmask[i].val;
96 else
97 val = 0;
98
99 mask = pmx->onmask[i].mask;
100 if (mask != 0) {
101 regval = readw(pmx_registers[i]);
102 regval &= ~mask;
103 regval |= val;
104 writew(regval, pmx_registers[i]);
105 }
106 }
107}
108
109struct pmx *pmx_get(struct device *dev, enum pmx_settings setting)
110{
111 int i;
112 struct pmx *pmx = ERR_PTR(-ENOENT);
113
114 if (dev == NULL)
115 return ERR_PTR(-EINVAL);
116
117 mutex_lock(&pmx_mutex);
118 for (i = 0; i < ARRAY_SIZE(pmx_settings); i++) {
119
120 if (setting == pmx_settings[i]->setting) {
121
122 if (pmx_settings[i]->dev != NULL) {
123 WARN(1, "padmux: required setting "
124 "in use by another consumer\n");
125 } else {
126 pmx = pmx_settings[i];
127 pmx->dev = dev;
128 dev_dbg(dev, "padmux: setting nr %d is now "
129 "bound to %s and ready to use\n",
130 setting, dev_name(dev));
131 break;
132 }
133 }
134 }
135 mutex_unlock(&pmx_mutex);
136
137 return pmx;
138}
139EXPORT_SYMBOL(pmx_get);
140
141int pmx_put(struct device *dev, struct pmx *pmx)
142{
143 int i;
144 int ret = -ENOENT;
145
146 if (pmx == NULL || dev == NULL)
147 return -EINVAL;
148
149 mutex_lock(&pmx_mutex);
150 for (i = 0; i < ARRAY_SIZE(pmx_settings); i++) {
151
152 if (pmx->setting == pmx_settings[i]->setting) {
153
154 if (dev != pmx->dev) {
155 WARN(1, "padmux: cannot release handle as "
156 "it is bound to another consumer\n");
157 ret = -EINVAL;
158 break;
159 } else {
160 pmx_settings[i]->dev = NULL;
161 ret = 0;
162 break;
163 }
164 }
165 }
166 mutex_unlock(&pmx_mutex);
167
168 return ret;
169}
170EXPORT_SYMBOL(pmx_put);
171
172int pmx_activate(struct device *dev, struct pmx *pmx)
173{
174 int i, j, ret;
175 ret = 0;
176
177 if (pmx == NULL || dev == NULL)
178 return -EINVAL;
179
180 mutex_lock(&pmx_mutex);
181
182 /* Make sure the required bits are not used */
183 for (i = 0; i < ARRAY_SIZE(pmx_settings); i++) {
184
185 if (pmx_settings[i]->dev == NULL || pmx_settings[i] == pmx)
186 continue;
187
188 for (j = 0; j < ARRAY_SIZE(pmx_registers); j++) {
189
190 if (pmx_settings[i]->onmask[j].mask & pmx->
191 onmask[j].mask) {
192 /* More than one entry on the same bits */
193 WARN(1, "padmux: cannot activate "
194 "setting. Bit conflict with "
195 "an active setting\n");
196
197 ret = -EUSERS;
198 goto exit;
199 }
200 }
201 }
202 update_registers(pmx, true);
203 pmx->activated = true;
204 dev_dbg(dev, "padmux: setting nr %d is activated\n",
205 pmx->setting);
206
207exit:
208 mutex_unlock(&pmx_mutex);
209 return ret;
210}
211EXPORT_SYMBOL(pmx_activate);
212
213int pmx_deactivate(struct device *dev, struct pmx *pmx)
214{
215 int i;
216 int ret = -ENOENT;
217
218 if (pmx == NULL || dev == NULL)
219 return -EINVAL;
220
221 mutex_lock(&pmx_mutex);
222 for (i = 0; i < ARRAY_SIZE(pmx_settings); i++) {
223
224 if (pmx_settings[i]->dev == NULL)
225 continue;
226
227 if (pmx->setting == pmx_settings[i]->setting) {
228
229 if (dev != pmx->dev) {
230 WARN(1, "padmux: cannot deactivate "
231 "pmx setting as it was activated "
232 "by another consumer\n");
233
234 ret = -EBUSY;
235 continue;
236 } else {
237 update_registers(pmx, false);
238 pmx_settings[i]->dev = NULL;
239 pmx->activated = false;
240 ret = 0;
241 dev_dbg(dev, "padmux: setting nr %d is deactivated",
242 pmx->setting);
243 break;
244 }
245 }
246 }
247 mutex_unlock(&pmx_mutex);
248
249 return ret;
250}
251EXPORT_SYMBOL(pmx_deactivate);
252
253/*
254 * For internal use only. If it is to be exported,
255 * it should be reentrant. Notice that pmx_activate
256 * (i.e. runtime settings) always override default settings.
257 */
258static int pmx_set_default(void)
259{
260 /* Used to identify several entries on the same bits */
261 u16 modbits[ARRAY_SIZE(pmx_registers)];
262
263 int i, j;
264
265 memset(modbits, 0, ARRAY_SIZE(pmx_registers) * sizeof(u16));
266
267 for (i = 0; i < ARRAY_SIZE(pmx_settings); i++) {
268
269 if (!pmx_settings[i]->default_on)
270 continue;
271
272 for (j = 0; j < ARRAY_SIZE(pmx_registers); j++) {
273
274 /* Make sure there is only one entry on the same bits */
275 if (modbits[j] & pmx_settings[i]->onmask[j].mask) {
276 BUG();
277 return -EUSERS;
278 }
279 modbits[j] |= pmx_settings[i]->onmask[j].mask;
280 }
281 update_registers(pmx_settings[i], true);
282 }
283 return 0;
284}
285
286#if (defined(CONFIG_DEBUG_FS) && defined(CONFIG_U300_DEBUG))
287static int pmx_show(struct seq_file *s, void *data)
288{
289 int i;
290 seq_printf(s, "-------------------------------------------------\n");
291 seq_printf(s, "SETTING BOUND TO DEVICE STATE\n");
292 seq_printf(s, "-------------------------------------------------\n");
293 mutex_lock(&pmx_mutex);
294 for (i = 0; i < ARRAY_SIZE(pmx_settings); i++) {
295 /* Format pmx and device name nicely */
296 char cdp[33];
297 int chars;
298
299 chars = snprintf(&cdp[0], 17, "%s", pmx_settings[i]->name);
300 while (chars < 16) {
301 cdp[chars] = ' ';
302 chars++;
303 }
304 chars = snprintf(&cdp[16], 17, "%s", pmx_settings[i]->dev ?
305 dev_name(pmx_settings[i]->dev) : "N/A");
306 while (chars < 16) {
307 cdp[chars+16] = ' ';
308 chars++;
309 }
310 cdp[32] = '\0';
311
312 seq_printf(s,
313 "%s\t%s\n",
314 &cdp[0],
315 pmx_settings[i]->activated ?
316 "ACTIVATED" : "DEACTIVATED"
317 );
318
319 }
320 mutex_unlock(&pmx_mutex);
321 return 0;
322}
323
324static int pmx_open(struct inode *inode, struct file *file)
325{
326 return single_open(file, pmx_show, NULL);
327}
328
329static const struct file_operations pmx_operations = {
330 .owner = THIS_MODULE,
331 .open = pmx_open,
332 .read = seq_read,
333 .llseek = seq_lseek,
334 .release = single_release,
335};
336
337static int __init init_pmx_read_debugfs(void)
338{
339 /* Expose a simple debugfs interface to view pmx settings */
340 (void) debugfs_create_file("padmux", S_IFREG | S_IRUGO,
341 NULL, NULL,
342 &pmx_operations);
343 return 0;
344}
345
346/*
347 * This needs to come in after the core_initcall(),
348 * because debugfs is not available until
349 * the subsystems come up.
350 */
351module_init(init_pmx_read_debugfs);
352#endif
353
354static int __init pmx_init(void)
355{
356 int ret;
357
358 ret = pmx_set_default();
359
360 if (IS_ERR_VALUE(ret))
361 pr_crit("padmux: default settings could not be set\n");
362
363 return 0;
364}
365
366/* Should be initialized before consumers */
367core_initcall(pmx_init);
diff --git a/arch/arm/mach-u300/padmux.h b/arch/arm/mach-u300/padmux.h
deleted file mode 100644
index 6e8b8606409..00000000000
--- a/arch/arm/mach-u300/padmux.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 *
3 * arch/arm/mach-u300/padmux.h
4 *
5 *
6 * Copyright (C) 2009 ST-Ericsson AB
7 * License terms: GNU General Public License (GPL) version 2
8 * U300 PADMUX API
9 * Author: Martin Persson <martin.persson@stericsson.com>
10 */
11
12#ifndef __MACH_U300_PADMUX_H
13#define __MACH_U300_PADMUX_H
14
15enum pmx_settings {
16 U300_APP_PMX_MMC_SETTING,
17 U300_APP_PMX_SPI_SETTING
18};
19
20struct pmx_onmask {
21 u16 mask; /* Mask bits */
22 u16 val; /* Value when active */
23};
24
25struct pmx {
26 struct device *dev;
27 enum pmx_settings setting;
28 char *name;
29 bool activated;
30 bool default_on;
31 struct pmx_onmask onmask[];
32};
33
34struct pmx *pmx_get(struct device *dev, enum pmx_settings setting);
35int pmx_put(struct device *dev, struct pmx *pmx);
36int pmx_activate(struct device *dev, struct pmx *pmx);
37int pmx_deactivate(struct device *dev, struct pmx *pmx);
38
39#endif
diff --git a/arch/arm/mach-u300/spi.c b/arch/arm/mach-u300/spi.c
index 7b597e2b19e..a1affacfa59 100644
--- a/arch/arm/mach-u300/spi.c
+++ b/arch/arm/mach-u300/spi.c
@@ -14,8 +14,6 @@
14#include <mach/coh901318.h> 14#include <mach/coh901318.h>
15#include <mach/dma_channels.h> 15#include <mach/dma_channels.h>
16 16
17#include "padmux.h"
18
19/* 17/*
20 * The following is for the actual devices on the SSP/SPI bus 18 * The following is for the actual devices on the SSP/SPI bus
21 */ 19 */
@@ -95,25 +93,7 @@ static struct pl022_ssp_controller ssp_platform_data = {
95 93
96void __init u300_spi_init(struct amba_device *adev) 94void __init u300_spi_init(struct amba_device *adev)
97{ 95{
98 struct pmx *pmx;
99
100 adev->dev.platform_data = &ssp_platform_data; 96 adev->dev.platform_data = &ssp_platform_data;
101 /*
102 * Setup padmuxing for SPI. Since this must always be
103 * compiled into the kernel, pmx is never released.
104 */
105 pmx = pmx_get(&adev->dev, U300_APP_PMX_SPI_SETTING);
106
107 if (IS_ERR(pmx))
108 dev_warn(&adev->dev, "Could not get padmux handle\n");
109 else {
110 int ret;
111
112 ret = pmx_activate(&adev->dev, pmx);
113 if (IS_ERR_VALUE(ret))
114 dev_warn(&adev->dev, "Could not activate padmuxing\n");
115 }
116
117} 97}
118 98
119void __init u300_spi_register_board_devices(void) 99void __init u300_spi_register_board_devices(void)
diff --git a/arch/arm/mach-ux500/Makefile.boot b/arch/arm/mach-ux500/Makefile.boot
index c7e75acfe6c..ff0a4b5b0a8 100644
--- a/arch/arm/mach-ux500/Makefile.boot
+++ b/arch/arm/mach-ux500/Makefile.boot
@@ -1,4 +1,4 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4 4
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
index a33df5f4c27..eb5199102cf 100644
--- a/arch/arm/mach-ux500/platsmp.c
+++ b/arch/arm/mach-ux500/platsmp.c
@@ -156,12 +156,10 @@ void __init smp_init_cpus(void)
156 ncores = scu_base ? scu_get_core_count(scu_base) : 1; 156 ncores = scu_base ? scu_get_core_count(scu_base) : 1;
157 157
158 /* sanity check */ 158 /* sanity check */
159 if (ncores > NR_CPUS) { 159 if (ncores > nr_cpu_ids) {
160 printk(KERN_WARNING 160 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
161 "U8500: no. of cores (%d) greater than configured " 161 ncores, nr_cpu_ids);
162 "maximum of %d - clipping\n", 162 ncores = nr_cpu_ids;
163 ncores, NR_CPUS);
164 ncores = NR_CPUS;
165 } 163 }
166 164
167 for (i = 0; i < ncores; i++) 165 for (i = 0; i < ncores; i++)
diff --git a/arch/arm/mach-versatile/Makefile.boot b/arch/arm/mach-versatile/Makefile.boot
index c7e75acfe6c..ff0a4b5b0a8 100644
--- a/arch/arm/mach-versatile/Makefile.boot
+++ b/arch/arm/mach-versatile/Makefile.boot
@@ -1,4 +1,4 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4 4
diff --git a/arch/arm/mach-vexpress/Makefile.boot b/arch/arm/mach-vexpress/Makefile.boot
index 07c2d9c457e..8630b3d10a4 100644
--- a/arch/arm/mach-vexpress/Makefile.boot
+++ b/arch/arm/mach-vexpress/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x60008000 1 zreladdr-y += 0x60008000
2params_phys-y := 0x60000100 2params_phys-y := 0x60000100
3initrd_phys-y := 0x60800000 3initrd_phys-y := 0x60800000
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c
index bfd32f52c2d..2b1e836a76e 100644
--- a/arch/arm/mach-vexpress/ct-ca9x4.c
+++ b/arch/arm/mach-vexpress/ct-ca9x4.c
@@ -221,6 +221,12 @@ static void ct_ca9x4_init_cpu_map(void)
221{ 221{
222 int i, ncores = scu_get_core_count(MMIO_P2V(A9_MPCORE_SCU)); 222 int i, ncores = scu_get_core_count(MMIO_P2V(A9_MPCORE_SCU));
223 223
224 if (ncores > nr_cpu_ids) {
225 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
226 ncores, nr_cpu_ids);
227 ncores = nr_cpu_ids;
228 }
229
224 for (i = 0; i < ncores; ++i) 230 for (i = 0; i < ncores; ++i)
225 set_cpu_possible(i, true); 231 set_cpu_possible(i, true);
226 232
diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c
index ea4cbfb90a6..3668cf91d2d 100644
--- a/arch/arm/mach-vexpress/hotplug.c
+++ b/arch/arm/mach-vexpress/hotplug.c
@@ -13,6 +13,7 @@
13#include <linux/smp.h> 13#include <linux/smp.h>
14 14
15#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
16#include <asm/system.h>
16 17
17extern volatile int pen_release; 18extern volatile int pen_release;
18 19
@@ -62,13 +63,7 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
62 * code will have already disabled interrupts 63 * code will have already disabled interrupts
63 */ 64 */
64 for (;;) { 65 for (;;) {
65 /* 66 wfi();
66 * here's the WFI
67 */
68 asm(".word 0xe320f003\n"
69 :
70 :
71 : "memory", "cc");
72 67
73 if (pen_release == cpu) { 68 if (pen_release == cpu) {
74 /* 69 /*
diff --git a/arch/arm/mach-vexpress/include/mach/io.h b/arch/arm/mach-vexpress/include/mach/io.h
index 748bb524ee7..13522d86685 100644
--- a/arch/arm/mach-vexpress/include/mach/io.h
+++ b/arch/arm/mach-vexpress/include/mach/io.h
@@ -20,8 +20,6 @@
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#define IO_SPACE_LIMIT 0xffffffff
24
25#define __io(a) __typesafe_io(a) 23#define __io(a) __typesafe_io(a)
26#define __mem_pci(a) (a) 24#define __mem_pci(a) (a)
27 25
diff --git a/arch/arm/mach-vt8500/Makefile.boot b/arch/arm/mach-vt8500/Makefile.boot
index a8acc4e2490..b79c41cdfdf 100644
--- a/arch/arm/mach-vt8500/Makefile.boot
+++ b/arch/arm/mach-vt8500/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x01000000 3initrd_phys-y := 0x01000000
diff --git a/arch/arm/mach-vt8500/include/mach/io.h b/arch/arm/mach-vt8500/include/mach/io.h
index 9077239f78c..46181eecf27 100644
--- a/arch/arm/mach-vt8500/include/mach/io.h
+++ b/arch/arm/mach-vt8500/include/mach/io.h
@@ -20,8 +20,6 @@
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#define IO_SPACE_LIMIT 0xffff
24
25#define __io(a) __typesafe_io((a) + 0xf0000000) 23#define __io(a) __typesafe_io((a) + 0xf0000000)
26#define __mem_pci(a) (a) 24#define __mem_pci(a) (a)
27 25
diff --git a/arch/arm/mach-w90x900/Makefile.boot b/arch/arm/mach-w90x900/Makefile.boot
index a057b546b6e..6c3d421c2d1 100644
--- a/arch/arm/mach-w90x900/Makefile.boot
+++ b/arch/arm/mach-w90x900/Makefile.boot
@@ -1,3 +1,3 @@
1zreladdr-y := 0x00008000 1zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3 3
diff --git a/arch/arm/mach-w90x900/cpu.c b/arch/arm/mach-w90x900/cpu.c
index 83c56324a47..0a235e50233 100644
--- a/arch/arm/mach-w90x900/cpu.c
+++ b/arch/arm/mach-w90x900/cpu.c
@@ -60,7 +60,7 @@ static DEFINE_CLK(emc, 7);
60static DEFINE_SUBCLK(rmii, 2); 60static DEFINE_SUBCLK(rmii, 2);
61static DEFINE_CLK(usbd, 8); 61static DEFINE_CLK(usbd, 8);
62static DEFINE_CLK(usbh, 9); 62static DEFINE_CLK(usbh, 9);
63static DEFINE_CLK(g2d, 10);; 63static DEFINE_CLK(g2d, 10);
64static DEFINE_CLK(pwm, 18); 64static DEFINE_CLK(pwm, 18);
65static DEFINE_CLK(ps2, 24); 65static DEFINE_CLK(ps2, 24);
66static DEFINE_CLK(kpi, 25); 66static DEFINE_CLK(kpi, 25);
diff --git a/arch/arm/mach-zynq/Makefile.boot b/arch/arm/mach-zynq/Makefile.boot
index 67039c3e0c4..760a0efe758 100644
--- a/arch/arm/mach-zynq/Makefile.boot
+++ b/arch/arm/mach-zynq/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index cfbcf8b9559..c335c76e0d8 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -86,16 +86,6 @@ core_param(alignment, ai_usermode, int, 0600);
86#define UM_FIXUP (1 << 1) 86#define UM_FIXUP (1 << 1)
87#define UM_SIGNAL (1 << 2) 87#define UM_SIGNAL (1 << 2)
88 88
89#ifdef CONFIG_PROC_FS
90static const char *usermode_action[] = {
91 "ignored",
92 "warn",
93 "fixup",
94 "fixup+warn",
95 "signal",
96 "signal+warn"
97};
98
99/* Return true if and only if the ARMv6 unaligned access model is in use. */ 89/* Return true if and only if the ARMv6 unaligned access model is in use. */
100static bool cpu_is_v6_unaligned(void) 90static bool cpu_is_v6_unaligned(void)
101{ 91{
@@ -123,6 +113,16 @@ static int safe_usermode(int new_usermode, bool warn)
123 return new_usermode; 113 return new_usermode;
124} 114}
125 115
116#ifdef CONFIG_PROC_FS
117static const char *usermode_action[] = {
118 "ignored",
119 "warn",
120 "fixup",
121 "fixup+warn",
122 "signal",
123 "signal+warn"
124};
125
126static int alignment_proc_show(struct seq_file *m, void *v) 126static int alignment_proc_show(struct seq_file *m, void *v)
127{ 127{
128 seq_printf(m, "User:\t\t%lu\n", ai_user); 128 seq_printf(m, "User:\t\t%lu\n", ai_user);
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 9ecfdb51195..8ac9e9f8479 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -16,9 +16,12 @@
16 * along with this program; if not, write to the Free Software 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 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19#include <linux/err.h>
19#include <linux/init.h> 20#include <linux/init.h>
20#include <linux/spinlock.h> 21#include <linux/spinlock.h>
21#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/of.h>
24#include <linux/of_address.h>
22 25
23#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
24#include <asm/hardware/cache-l2x0.h> 27#include <asm/hardware/cache-l2x0.h>
@@ -26,15 +29,23 @@
26#define CACHE_LINE_SIZE 32 29#define CACHE_LINE_SIZE 32
27 30
28static void __iomem *l2x0_base; 31static void __iomem *l2x0_base;
29static DEFINE_SPINLOCK(l2x0_lock); 32static DEFINE_RAW_SPINLOCK(l2x0_lock);
30static uint32_t l2x0_way_mask; /* Bitmask of active ways */ 33static uint32_t l2x0_way_mask; /* Bitmask of active ways */
31static uint32_t l2x0_size; 34static uint32_t l2x0_size;
32 35
36struct l2x0_regs l2x0_saved_regs;
37
38struct l2x0_of_data {
39 void (*setup)(const struct device_node *, __u32 *, __u32 *);
40 void (*save)(void);
41 void (*resume)(void);
42};
43
33static inline void cache_wait_way(void __iomem *reg, unsigned long mask) 44static inline void cache_wait_way(void __iomem *reg, unsigned long mask)
34{ 45{
35 /* wait for cache operation by line or way to complete */ 46 /* wait for cache operation by line or way to complete */
36 while (readl_relaxed(reg) & mask) 47 while (readl_relaxed(reg) & mask)
37 ; 48 cpu_relax();
38} 49}
39 50
40#ifdef CONFIG_CACHE_PL310 51#ifdef CONFIG_CACHE_PL310
@@ -115,9 +126,9 @@ static void l2x0_cache_sync(void)
115{ 126{
116 unsigned long flags; 127 unsigned long flags;
117 128
118 spin_lock_irqsave(&l2x0_lock, flags); 129 raw_spin_lock_irqsave(&l2x0_lock, flags);
119 cache_sync(); 130 cache_sync();
120 spin_unlock_irqrestore(&l2x0_lock, flags); 131 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
121} 132}
122 133
123static void __l2x0_flush_all(void) 134static void __l2x0_flush_all(void)
@@ -134,9 +145,9 @@ static void l2x0_flush_all(void)
134 unsigned long flags; 145 unsigned long flags;
135 146
136 /* clean all ways */ 147 /* clean all ways */
137 spin_lock_irqsave(&l2x0_lock, flags); 148 raw_spin_lock_irqsave(&l2x0_lock, flags);
138 __l2x0_flush_all(); 149 __l2x0_flush_all();
139 spin_unlock_irqrestore(&l2x0_lock, flags); 150 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
140} 151}
141 152
142static void l2x0_clean_all(void) 153static void l2x0_clean_all(void)
@@ -144,11 +155,11 @@ static void l2x0_clean_all(void)
144 unsigned long flags; 155 unsigned long flags;
145 156
146 /* clean all ways */ 157 /* clean all ways */
147 spin_lock_irqsave(&l2x0_lock, flags); 158 raw_spin_lock_irqsave(&l2x0_lock, flags);
148 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_CLEAN_WAY); 159 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_CLEAN_WAY);
149 cache_wait_way(l2x0_base + L2X0_CLEAN_WAY, l2x0_way_mask); 160 cache_wait_way(l2x0_base + L2X0_CLEAN_WAY, l2x0_way_mask);
150 cache_sync(); 161 cache_sync();
151 spin_unlock_irqrestore(&l2x0_lock, flags); 162 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
152} 163}
153 164
154static void l2x0_inv_all(void) 165static void l2x0_inv_all(void)
@@ -156,13 +167,13 @@ static void l2x0_inv_all(void)
156 unsigned long flags; 167 unsigned long flags;
157 168
158 /* invalidate all ways */ 169 /* invalidate all ways */
159 spin_lock_irqsave(&l2x0_lock, flags); 170 raw_spin_lock_irqsave(&l2x0_lock, flags);
160 /* Invalidating when L2 is enabled is a nono */ 171 /* Invalidating when L2 is enabled is a nono */
161 BUG_ON(readl(l2x0_base + L2X0_CTRL) & 1); 172 BUG_ON(readl(l2x0_base + L2X0_CTRL) & 1);
162 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_INV_WAY); 173 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_INV_WAY);
163 cache_wait_way(l2x0_base + L2X0_INV_WAY, l2x0_way_mask); 174 cache_wait_way(l2x0_base + L2X0_INV_WAY, l2x0_way_mask);
164 cache_sync(); 175 cache_sync();
165 spin_unlock_irqrestore(&l2x0_lock, flags); 176 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
166} 177}
167 178
168static void l2x0_inv_range(unsigned long start, unsigned long end) 179static void l2x0_inv_range(unsigned long start, unsigned long end)
@@ -170,7 +181,7 @@ static void l2x0_inv_range(unsigned long start, unsigned long end)
170 void __iomem *base = l2x0_base; 181 void __iomem *base = l2x0_base;
171 unsigned long flags; 182 unsigned long flags;
172 183
173 spin_lock_irqsave(&l2x0_lock, flags); 184 raw_spin_lock_irqsave(&l2x0_lock, flags);
174 if (start & (CACHE_LINE_SIZE - 1)) { 185 if (start & (CACHE_LINE_SIZE - 1)) {
175 start &= ~(CACHE_LINE_SIZE - 1); 186 start &= ~(CACHE_LINE_SIZE - 1);
176 debug_writel(0x03); 187 debug_writel(0x03);
@@ -195,13 +206,13 @@ static void l2x0_inv_range(unsigned long start, unsigned long end)
195 } 206 }
196 207
197 if (blk_end < end) { 208 if (blk_end < end) {
198 spin_unlock_irqrestore(&l2x0_lock, flags); 209 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
199 spin_lock_irqsave(&l2x0_lock, flags); 210 raw_spin_lock_irqsave(&l2x0_lock, flags);
200 } 211 }
201 } 212 }
202 cache_wait(base + L2X0_INV_LINE_PA, 1); 213 cache_wait(base + L2X0_INV_LINE_PA, 1);
203 cache_sync(); 214 cache_sync();
204 spin_unlock_irqrestore(&l2x0_lock, flags); 215 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
205} 216}
206 217
207static void l2x0_clean_range(unsigned long start, unsigned long end) 218static void l2x0_clean_range(unsigned long start, unsigned long end)
@@ -214,7 +225,7 @@ static void l2x0_clean_range(unsigned long start, unsigned long end)
214 return; 225 return;
215 } 226 }
216 227
217 spin_lock_irqsave(&l2x0_lock, flags); 228 raw_spin_lock_irqsave(&l2x0_lock, flags);
218 start &= ~(CACHE_LINE_SIZE - 1); 229 start &= ~(CACHE_LINE_SIZE - 1);
219 while (start < end) { 230 while (start < end) {
220 unsigned long blk_end = start + min(end - start, 4096UL); 231 unsigned long blk_end = start + min(end - start, 4096UL);
@@ -225,13 +236,13 @@ static void l2x0_clean_range(unsigned long start, unsigned long end)
225 } 236 }
226 237
227 if (blk_end < end) { 238 if (blk_end < end) {
228 spin_unlock_irqrestore(&l2x0_lock, flags); 239 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
229 spin_lock_irqsave(&l2x0_lock, flags); 240 raw_spin_lock_irqsave(&l2x0_lock, flags);
230 } 241 }
231 } 242 }
232 cache_wait(base + L2X0_CLEAN_LINE_PA, 1); 243 cache_wait(base + L2X0_CLEAN_LINE_PA, 1);
233 cache_sync(); 244 cache_sync();
234 spin_unlock_irqrestore(&l2x0_lock, flags); 245 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
235} 246}
236 247
237static void l2x0_flush_range(unsigned long start, unsigned long end) 248static void l2x0_flush_range(unsigned long start, unsigned long end)
@@ -244,7 +255,7 @@ static void l2x0_flush_range(unsigned long start, unsigned long end)
244 return; 255 return;
245 } 256 }
246 257
247 spin_lock_irqsave(&l2x0_lock, flags); 258 raw_spin_lock_irqsave(&l2x0_lock, flags);
248 start &= ~(CACHE_LINE_SIZE - 1); 259 start &= ~(CACHE_LINE_SIZE - 1);
249 while (start < end) { 260 while (start < end) {
250 unsigned long blk_end = start + min(end - start, 4096UL); 261 unsigned long blk_end = start + min(end - start, 4096UL);
@@ -257,27 +268,27 @@ static void l2x0_flush_range(unsigned long start, unsigned long end)
257 debug_writel(0x00); 268 debug_writel(0x00);
258 269
259 if (blk_end < end) { 270 if (blk_end < end) {
260 spin_unlock_irqrestore(&l2x0_lock, flags); 271 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
261 spin_lock_irqsave(&l2x0_lock, flags); 272 raw_spin_lock_irqsave(&l2x0_lock, flags);
262 } 273 }
263 } 274 }
264 cache_wait(base + L2X0_CLEAN_INV_LINE_PA, 1); 275 cache_wait(base + L2X0_CLEAN_INV_LINE_PA, 1);
265 cache_sync(); 276 cache_sync();
266 spin_unlock_irqrestore(&l2x0_lock, flags); 277 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
267} 278}
268 279
269static void l2x0_disable(void) 280static void l2x0_disable(void)
270{ 281{
271 unsigned long flags; 282 unsigned long flags;
272 283
273 spin_lock_irqsave(&l2x0_lock, flags); 284 raw_spin_lock_irqsave(&l2x0_lock, flags);
274 __l2x0_flush_all(); 285 __l2x0_flush_all();
275 writel_relaxed(0, l2x0_base + L2X0_CTRL); 286 writel_relaxed(0, l2x0_base + L2X0_CTRL);
276 dsb(); 287 dsb();
277 spin_unlock_irqrestore(&l2x0_lock, flags); 288 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
278} 289}
279 290
280static void __init l2x0_unlock(__u32 cache_id) 291static void l2x0_unlock(__u32 cache_id)
281{ 292{
282 int lockregs; 293 int lockregs;
283 int i; 294 int i;
@@ -353,6 +364,8 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
353 /* l2x0 controller is disabled */ 364 /* l2x0 controller is disabled */
354 writel_relaxed(aux, l2x0_base + L2X0_AUX_CTRL); 365 writel_relaxed(aux, l2x0_base + L2X0_AUX_CTRL);
355 366
367 l2x0_saved_regs.aux_ctrl = aux;
368
356 l2x0_inv_all(); 369 l2x0_inv_all();
357 370
358 /* enable L2X0 */ 371 /* enable L2X0 */
@@ -372,3 +385,202 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
372 printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n", 385 printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n",
373 ways, cache_id, aux, l2x0_size); 386 ways, cache_id, aux, l2x0_size);
374} 387}
388
389#ifdef CONFIG_OF
390static void __init l2x0_of_setup(const struct device_node *np,
391 __u32 *aux_val, __u32 *aux_mask)
392{
393 u32 data[2] = { 0, 0 };
394 u32 tag = 0;
395 u32 dirty = 0;
396 u32 val = 0, mask = 0;
397
398 of_property_read_u32(np, "arm,tag-latency", &tag);
399 if (tag) {
400 mask |= L2X0_AUX_CTRL_TAG_LATENCY_MASK;
401 val |= (tag - 1) << L2X0_AUX_CTRL_TAG_LATENCY_SHIFT;
402 }
403
404 of_property_read_u32_array(np, "arm,data-latency",
405 data, ARRAY_SIZE(data));
406 if (data[0] && data[1]) {
407 mask |= L2X0_AUX_CTRL_DATA_RD_LATENCY_MASK |
408 L2X0_AUX_CTRL_DATA_WR_LATENCY_MASK;
409 val |= ((data[0] - 1) << L2X0_AUX_CTRL_DATA_RD_LATENCY_SHIFT) |
410 ((data[1] - 1) << L2X0_AUX_CTRL_DATA_WR_LATENCY_SHIFT);
411 }
412
413 of_property_read_u32(np, "arm,dirty-latency", &dirty);
414 if (dirty) {
415 mask |= L2X0_AUX_CTRL_DIRTY_LATENCY_MASK;
416 val |= (dirty - 1) << L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT;
417 }
418
419 *aux_val &= ~mask;
420 *aux_val |= val;
421 *aux_mask &= ~mask;
422}
423
424static void __init pl310_of_setup(const struct device_node *np,
425 __u32 *aux_val, __u32 *aux_mask)
426{
427 u32 data[3] = { 0, 0, 0 };
428 u32 tag[3] = { 0, 0, 0 };
429 u32 filter[2] = { 0, 0 };
430
431 of_property_read_u32_array(np, "arm,tag-latency", tag, ARRAY_SIZE(tag));
432 if (tag[0] && tag[1] && tag[2])
433 writel_relaxed(
434 ((tag[0] - 1) << L2X0_LATENCY_CTRL_RD_SHIFT) |
435 ((tag[1] - 1) << L2X0_LATENCY_CTRL_WR_SHIFT) |
436 ((tag[2] - 1) << L2X0_LATENCY_CTRL_SETUP_SHIFT),
437 l2x0_base + L2X0_TAG_LATENCY_CTRL);
438
439 of_property_read_u32_array(np, "arm,data-latency",
440 data, ARRAY_SIZE(data));
441 if (data[0] && data[1] && data[2])
442 writel_relaxed(
443 ((data[0] - 1) << L2X0_LATENCY_CTRL_RD_SHIFT) |
444 ((data[1] - 1) << L2X0_LATENCY_CTRL_WR_SHIFT) |
445 ((data[2] - 1) << L2X0_LATENCY_CTRL_SETUP_SHIFT),
446 l2x0_base + L2X0_DATA_LATENCY_CTRL);
447
448 of_property_read_u32_array(np, "arm,filter-ranges",
449 filter, ARRAY_SIZE(filter));
450 if (filter[1]) {
451 writel_relaxed(ALIGN(filter[0] + filter[1], SZ_1M),
452 l2x0_base + L2X0_ADDR_FILTER_END);
453 writel_relaxed((filter[0] & ~(SZ_1M - 1)) | L2X0_ADDR_FILTER_EN,
454 l2x0_base + L2X0_ADDR_FILTER_START);
455 }
456}
457
458static void __init pl310_save(void)
459{
460 u32 l2x0_revision = readl_relaxed(l2x0_base + L2X0_CACHE_ID) &
461 L2X0_CACHE_ID_RTL_MASK;
462
463 l2x0_saved_regs.tag_latency = readl_relaxed(l2x0_base +
464 L2X0_TAG_LATENCY_CTRL);
465 l2x0_saved_regs.data_latency = readl_relaxed(l2x0_base +
466 L2X0_DATA_LATENCY_CTRL);
467 l2x0_saved_regs.filter_end = readl_relaxed(l2x0_base +
468 L2X0_ADDR_FILTER_END);
469 l2x0_saved_regs.filter_start = readl_relaxed(l2x0_base +
470 L2X0_ADDR_FILTER_START);
471
472 if (l2x0_revision >= L2X0_CACHE_ID_RTL_R2P0) {
473 /*
474 * From r2p0, there is Prefetch offset/control register
475 */
476 l2x0_saved_regs.prefetch_ctrl = readl_relaxed(l2x0_base +
477 L2X0_PREFETCH_CTRL);
478 /*
479 * From r3p0, there is Power control register
480 */
481 if (l2x0_revision >= L2X0_CACHE_ID_RTL_R3P0)
482 l2x0_saved_regs.pwr_ctrl = readl_relaxed(l2x0_base +
483 L2X0_POWER_CTRL);
484 }
485}
486
487static void l2x0_resume(void)
488{
489 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) {
490 /* restore aux ctrl and enable l2 */
491 l2x0_unlock(readl_relaxed(l2x0_base + L2X0_CACHE_ID));
492
493 writel_relaxed(l2x0_saved_regs.aux_ctrl, l2x0_base +
494 L2X0_AUX_CTRL);
495
496 l2x0_inv_all();
497
498 writel_relaxed(1, l2x0_base + L2X0_CTRL);
499 }
500}
501
502static void pl310_resume(void)
503{
504 u32 l2x0_revision;
505
506 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) {
507 /* restore pl310 setup */
508 writel_relaxed(l2x0_saved_regs.tag_latency,
509 l2x0_base + L2X0_TAG_LATENCY_CTRL);
510 writel_relaxed(l2x0_saved_regs.data_latency,
511 l2x0_base + L2X0_DATA_LATENCY_CTRL);
512 writel_relaxed(l2x0_saved_regs.filter_end,
513 l2x0_base + L2X0_ADDR_FILTER_END);
514 writel_relaxed(l2x0_saved_regs.filter_start,
515 l2x0_base + L2X0_ADDR_FILTER_START);
516
517 l2x0_revision = readl_relaxed(l2x0_base + L2X0_CACHE_ID) &
518 L2X0_CACHE_ID_RTL_MASK;
519
520 if (l2x0_revision >= L2X0_CACHE_ID_RTL_R2P0) {
521 writel_relaxed(l2x0_saved_regs.prefetch_ctrl,
522 l2x0_base + L2X0_PREFETCH_CTRL);
523 if (l2x0_revision >= L2X0_CACHE_ID_RTL_R3P0)
524 writel_relaxed(l2x0_saved_regs.pwr_ctrl,
525 l2x0_base + L2X0_POWER_CTRL);
526 }
527 }
528
529 l2x0_resume();
530}
531
532static const struct l2x0_of_data pl310_data = {
533 pl310_of_setup,
534 pl310_save,
535 pl310_resume,
536};
537
538static const struct l2x0_of_data l2x0_data = {
539 l2x0_of_setup,
540 NULL,
541 l2x0_resume,
542};
543
544static const struct of_device_id l2x0_ids[] __initconst = {
545 { .compatible = "arm,pl310-cache", .data = (void *)&pl310_data },
546 { .compatible = "arm,l220-cache", .data = (void *)&l2x0_data },
547 { .compatible = "arm,l210-cache", .data = (void *)&l2x0_data },
548 {}
549};
550
551int __init l2x0_of_init(__u32 aux_val, __u32 aux_mask)
552{
553 struct device_node *np;
554 struct l2x0_of_data *data;
555 struct resource res;
556
557 np = of_find_matching_node(NULL, l2x0_ids);
558 if (!np)
559 return -ENODEV;
560
561 if (of_address_to_resource(np, 0, &res))
562 return -ENODEV;
563
564 l2x0_base = ioremap(res.start, resource_size(&res));
565 if (!l2x0_base)
566 return -ENOMEM;
567
568 l2x0_saved_regs.phy_base = res.start;
569
570 data = of_match_node(l2x0_ids, np)->data;
571
572 /* L2 configuration can only be changed if the cache is disabled */
573 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) {
574 if (data->setup)
575 data->setup(np, &aux_val, &aux_mask);
576 }
577
578 if (data->save)
579 data->save();
580
581 l2x0_init(l2x0_base, aux_val, aux_mask);
582
583 outer_cache.resume = data->resume;
584 return 0;
585}
586#endif
diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c
index b0ee9ba3cfa..93aac068da9 100644
--- a/arch/arm/mm/context.c
+++ b/arch/arm/mm/context.c
@@ -16,7 +16,7 @@
16#include <asm/mmu_context.h> 16#include <asm/mmu_context.h>
17#include <asm/tlbflush.h> 17#include <asm/tlbflush.h>
18 18
19static DEFINE_SPINLOCK(cpu_asid_lock); 19static DEFINE_RAW_SPINLOCK(cpu_asid_lock);
20unsigned int cpu_last_asid = ASID_FIRST_VERSION; 20unsigned int cpu_last_asid = ASID_FIRST_VERSION;
21#ifdef CONFIG_SMP 21#ifdef CONFIG_SMP
22DEFINE_PER_CPU(struct mm_struct *, current_mm); 22DEFINE_PER_CPU(struct mm_struct *, current_mm);
@@ -31,7 +31,7 @@ DEFINE_PER_CPU(struct mm_struct *, current_mm);
31void __init_new_context(struct task_struct *tsk, struct mm_struct *mm) 31void __init_new_context(struct task_struct *tsk, struct mm_struct *mm)
32{ 32{
33 mm->context.id = 0; 33 mm->context.id = 0;
34 spin_lock_init(&mm->context.id_lock); 34 raw_spin_lock_init(&mm->context.id_lock);
35} 35}
36 36
37static void flush_context(void) 37static void flush_context(void)
@@ -58,7 +58,7 @@ static void set_mm_context(struct mm_struct *mm, unsigned int asid)
58 * the broadcast. This function is also called via IPI so the 58 * the broadcast. This function is also called via IPI so the
59 * mm->context.id_lock has to be IRQ-safe. 59 * mm->context.id_lock has to be IRQ-safe.
60 */ 60 */
61 spin_lock_irqsave(&mm->context.id_lock, flags); 61 raw_spin_lock_irqsave(&mm->context.id_lock, flags);
62 if (likely((mm->context.id ^ cpu_last_asid) >> ASID_BITS)) { 62 if (likely((mm->context.id ^ cpu_last_asid) >> ASID_BITS)) {
63 /* 63 /*
64 * Old version of ASID found. Set the new one and 64 * Old version of ASID found. Set the new one and
@@ -67,7 +67,7 @@ static void set_mm_context(struct mm_struct *mm, unsigned int asid)
67 mm->context.id = asid; 67 mm->context.id = asid;
68 cpumask_clear(mm_cpumask(mm)); 68 cpumask_clear(mm_cpumask(mm));
69 } 69 }
70 spin_unlock_irqrestore(&mm->context.id_lock, flags); 70 raw_spin_unlock_irqrestore(&mm->context.id_lock, flags);
71 71
72 /* 72 /*
73 * Set the mm_cpumask(mm) bit for the current CPU. 73 * Set the mm_cpumask(mm) bit for the current CPU.
@@ -117,7 +117,7 @@ void __new_context(struct mm_struct *mm)
117{ 117{
118 unsigned int asid; 118 unsigned int asid;
119 119
120 spin_lock(&cpu_asid_lock); 120 raw_spin_lock(&cpu_asid_lock);
121#ifdef CONFIG_SMP 121#ifdef CONFIG_SMP
122 /* 122 /*
123 * Check the ASID again, in case the change was broadcast from 123 * Check the ASID again, in case the change was broadcast from
@@ -125,7 +125,7 @@ void __new_context(struct mm_struct *mm)
125 */ 125 */
126 if (unlikely(((mm->context.id ^ cpu_last_asid) >> ASID_BITS) == 0)) { 126 if (unlikely(((mm->context.id ^ cpu_last_asid) >> ASID_BITS) == 0)) {
127 cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm)); 127 cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm));
128 spin_unlock(&cpu_asid_lock); 128 raw_spin_unlock(&cpu_asid_lock);
129 return; 129 return;
130 } 130 }
131#endif 131#endif
@@ -153,5 +153,5 @@ void __new_context(struct mm_struct *mm)
153 } 153 }
154 154
155 set_mm_context(mm, asid); 155 set_mm_context(mm, asid);
156 spin_unlock(&cpu_asid_lock); 156 raw_spin_unlock(&cpu_asid_lock);
157} 157}
diff --git a/arch/arm/mm/copypage-v4mc.c b/arch/arm/mm/copypage-v4mc.c
index b8061519ce7..7d0a8c23034 100644
--- a/arch/arm/mm/copypage-v4mc.c
+++ b/arch/arm/mm/copypage-v4mc.c
@@ -30,7 +30,7 @@
30#define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \ 30#define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \
31 L_PTE_MT_MINICACHE) 31 L_PTE_MT_MINICACHE)
32 32
33static DEFINE_SPINLOCK(minicache_lock); 33static DEFINE_RAW_SPINLOCK(minicache_lock);
34 34
35/* 35/*
36 * ARMv4 mini-dcache optimised copy_user_highpage 36 * ARMv4 mini-dcache optimised copy_user_highpage
@@ -76,14 +76,14 @@ void v4_mc_copy_user_highpage(struct page *to, struct page *from,
76 if (!test_and_set_bit(PG_dcache_clean, &from->flags)) 76 if (!test_and_set_bit(PG_dcache_clean, &from->flags))
77 __flush_dcache_page(page_mapping(from), from); 77 __flush_dcache_page(page_mapping(from), from);
78 78
79 spin_lock(&minicache_lock); 79 raw_spin_lock(&minicache_lock);
80 80
81 set_pte_ext(TOP_PTE(0xffff8000), pfn_pte(page_to_pfn(from), minicache_pgprot), 0); 81 set_pte_ext(TOP_PTE(0xffff8000), pfn_pte(page_to_pfn(from), minicache_pgprot), 0);
82 flush_tlb_kernel_page(0xffff8000); 82 flush_tlb_kernel_page(0xffff8000);
83 83
84 mc_copy_user_page((void *)0xffff8000, kto); 84 mc_copy_user_page((void *)0xffff8000, kto);
85 85
86 spin_unlock(&minicache_lock); 86 raw_spin_unlock(&minicache_lock);
87 87
88 kunmap_atomic(kto, KM_USER1); 88 kunmap_atomic(kto, KM_USER1);
89} 89}
diff --git a/arch/arm/mm/copypage-v6.c b/arch/arm/mm/copypage-v6.c
index 63cca009713..3d9a1552cef 100644
--- a/arch/arm/mm/copypage-v6.c
+++ b/arch/arm/mm/copypage-v6.c
@@ -27,7 +27,7 @@
27#define from_address (0xffff8000) 27#define from_address (0xffff8000)
28#define to_address (0xffffc000) 28#define to_address (0xffffc000)
29 29
30static DEFINE_SPINLOCK(v6_lock); 30static DEFINE_RAW_SPINLOCK(v6_lock);
31 31
32/* 32/*
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
@@ -88,7 +88,7 @@ static void v6_copy_user_highpage_aliasing(struct page *to,
88 * Now copy the page using the same cache colour as the 88 * Now copy the page using the same cache colour as the
89 * pages ultimate destination. 89 * pages ultimate destination.
90 */ 90 */
91 spin_lock(&v6_lock); 91 raw_spin_lock(&v6_lock);
92 92
93 set_pte_ext(TOP_PTE(from_address) + offset, pfn_pte(page_to_pfn(from), PAGE_KERNEL), 0); 93 set_pte_ext(TOP_PTE(from_address) + offset, pfn_pte(page_to_pfn(from), PAGE_KERNEL), 0);
94 set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(to), PAGE_KERNEL), 0); 94 set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(to), PAGE_KERNEL), 0);
@@ -101,7 +101,7 @@ static void v6_copy_user_highpage_aliasing(struct page *to,
101 101
102 copy_page((void *)kto, (void *)kfrom); 102 copy_page((void *)kto, (void *)kfrom);
103 103
104 spin_unlock(&v6_lock); 104 raw_spin_unlock(&v6_lock);
105} 105}
106 106
107/* 107/*
@@ -121,13 +121,13 @@ static void v6_clear_user_highpage_aliasing(struct page *page, unsigned long vad
121 * Now clear the page using the same cache colour as 121 * Now clear the page using the same cache colour as
122 * the pages ultimate destination. 122 * the pages ultimate destination.
123 */ 123 */
124 spin_lock(&v6_lock); 124 raw_spin_lock(&v6_lock);
125 125
126 set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(page), PAGE_KERNEL), 0); 126 set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(page), PAGE_KERNEL), 0);
127 flush_tlb_kernel_page(to); 127 flush_tlb_kernel_page(to);
128 clear_page((void *)to); 128 clear_page((void *)to);
129 129
130 spin_unlock(&v6_lock); 130 raw_spin_unlock(&v6_lock);
131} 131}
132 132
133struct cpu_user_fns v6_user_fns __initdata = { 133struct cpu_user_fns v6_user_fns __initdata = {
diff --git a/arch/arm/mm/copypage-xscale.c b/arch/arm/mm/copypage-xscale.c
index 649bbcd325b..610c24ced31 100644
--- a/arch/arm/mm/copypage-xscale.c
+++ b/arch/arm/mm/copypage-xscale.c
@@ -32,7 +32,7 @@
32#define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \ 32#define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \
33 L_PTE_MT_MINICACHE) 33 L_PTE_MT_MINICACHE)
34 34
35static DEFINE_SPINLOCK(minicache_lock); 35static DEFINE_RAW_SPINLOCK(minicache_lock);
36 36
37/* 37/*
38 * XScale mini-dcache optimised copy_user_highpage 38 * XScale mini-dcache optimised copy_user_highpage
@@ -98,14 +98,14 @@ void xscale_mc_copy_user_highpage(struct page *to, struct page *from,
98 if (!test_and_set_bit(PG_dcache_clean, &from->flags)) 98 if (!test_and_set_bit(PG_dcache_clean, &from->flags))
99 __flush_dcache_page(page_mapping(from), from); 99 __flush_dcache_page(page_mapping(from), from);
100 100
101 spin_lock(&minicache_lock); 101 raw_spin_lock(&minicache_lock);
102 102
103 set_pte_ext(TOP_PTE(COPYPAGE_MINICACHE), pfn_pte(page_to_pfn(from), minicache_pgprot), 0); 103 set_pte_ext(TOP_PTE(COPYPAGE_MINICACHE), pfn_pte(page_to_pfn(from), minicache_pgprot), 0);
104 flush_tlb_kernel_page(COPYPAGE_MINICACHE); 104 flush_tlb_kernel_page(COPYPAGE_MINICACHE);
105 105
106 mc_copy_user_page((void *)COPYPAGE_MINICACHE, kto); 106 mc_copy_user_page((void *)COPYPAGE_MINICACHE, kto);
107 107
108 spin_unlock(&minicache_lock); 108 raw_spin_unlock(&minicache_lock);
109 109
110 kunmap_atomic(kto, KM_USER1); 110 kunmap_atomic(kto, KM_USER1);
111} 111}
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index c3ff82f92d9..235eb775fc7 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -123,8 +123,8 @@ static void __dma_free_buffer(struct page *page, size_t size)
123#endif 123#endif
124 124
125#define CONSISTENT_OFFSET(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PAGE_SHIFT) 125#define CONSISTENT_OFFSET(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PAGE_SHIFT)
126#define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PGDIR_SHIFT) 126#define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PMD_SHIFT)
127#define NUM_CONSISTENT_PTES (CONSISTENT_DMA_SIZE >> PGDIR_SHIFT) 127#define NUM_CONSISTENT_PTES (CONSISTENT_DMA_SIZE >> PMD_SHIFT)
128 128
129/* 129/*
130 * These are the page tables (2MB each) covering uncached, DMA consistent allocations 130 * These are the page tables (2MB each) covering uncached, DMA consistent allocations
@@ -183,7 +183,7 @@ static int __init consistent_init(void)
183 } 183 }
184 184
185 consistent_pte[i++] = pte; 185 consistent_pte[i++] = pte;
186 base += (1 << PGDIR_SHIFT); 186 base += PMD_SIZE;
187 } while (base < CONSISTENT_END); 187 } while (base < CONSISTENT_END);
188 188
189 return ret; 189 return ret;
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index 3b5ea68acbb..aa33949fef6 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -20,6 +20,7 @@
20#include <linux/highmem.h> 20#include <linux/highmem.h>
21#include <linux/perf_event.h> 21#include <linux/perf_event.h>
22 22
23#include <asm/exception.h>
23#include <asm/system.h> 24#include <asm/system.h>
24#include <asm/pgtable.h> 25#include <asm/pgtable.h>
25#include <asm/tlbflush.h> 26#include <asm/tlbflush.h>
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index cc7e2d8be9a..f8037ba338a 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -496,6 +496,13 @@ static void __init free_unused_memmap(struct meminfo *mi)
496 */ 496 */
497 bank_start = min(bank_start, 497 bank_start = min(bank_start,
498 ALIGN(prev_bank_end, PAGES_PER_SECTION)); 498 ALIGN(prev_bank_end, PAGES_PER_SECTION));
499#else
500 /*
501 * Align down here since the VM subsystem insists that the
502 * memmap entries are valid from the bank start aligned to
503 * MAX_ORDER_NR_PAGES.
504 */
505 bank_start = round_down(bank_start, MAX_ORDER_NR_PAGES);
499#endif 506#endif
500 /* 507 /*
501 * If we had a previous bank, and there is a space 508 * If we had a previous bank, and there is a space
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index ab506272b2d..bdb248c4f55 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -289,6 +289,27 @@ __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
289} 289}
290EXPORT_SYMBOL(__arm_ioremap); 290EXPORT_SYMBOL(__arm_ioremap);
291 291
292/*
293 * Remap an arbitrary physical address space into the kernel virtual
294 * address space as memory. Needed when the kernel wants to execute
295 * code in external memory. This is needed for reprogramming source
296 * clocks that would affect normal memory for example. Please see
297 * CONFIG_GENERIC_ALLOCATOR for allocating external memory.
298 */
299void __iomem *
300__arm_ioremap_exec(unsigned long phys_addr, size_t size, bool cached)
301{
302 unsigned int mtype;
303
304 if (cached)
305 mtype = MT_MEMORY;
306 else
307 mtype = MT_MEMORY_NONCACHED;
308
309 return __arm_ioremap_caller(phys_addr, size, mtype,
310 __builtin_return_address(0));
311}
312
292void __iounmap(volatile void __iomem *io_addr) 313void __iounmap(volatile void __iomem *io_addr)
293{ 314{
294 void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr); 315 void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);
diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h
index 010566799c8..ad7cce3bc43 100644
--- a/arch/arm/mm/mm.h
+++ b/arch/arm/mm/mm.h
@@ -12,8 +12,8 @@ static inline pmd_t *pmd_off_k(unsigned long virt)
12 12
13struct mem_type { 13struct mem_type {
14 pteval_t prot_pte; 14 pteval_t prot_pte;
15 unsigned int prot_l1; 15 pmdval_t prot_l1;
16 unsigned int prot_sect; 16 pmdval_t prot_sect;
17 unsigned int domain; 17 unsigned int domain;
18}; 18};
19 19
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 594d677b92c..226f1804be1 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -60,7 +60,7 @@ EXPORT_SYMBOL(pgprot_kernel);
60struct cachepolicy { 60struct cachepolicy {
61 const char policy[16]; 61 const char policy[16];
62 unsigned int cr_mask; 62 unsigned int cr_mask;
63 unsigned int pmd; 63 pmdval_t pmd;
64 pteval_t pte; 64 pteval_t pte;
65}; 65};
66 66
@@ -288,7 +288,7 @@ static void __init build_mem_type_table(void)
288{ 288{
289 struct cachepolicy *cp; 289 struct cachepolicy *cp;
290 unsigned int cr = get_cr(); 290 unsigned int cr = get_cr();
291 unsigned int user_pgprot, kern_pgprot, vecs_pgprot; 291 pteval_t user_pgprot, kern_pgprot, vecs_pgprot;
292 int cpu_arch = cpu_architecture(); 292 int cpu_arch = cpu_architecture();
293 int i; 293 int i;
294 294
@@ -863,14 +863,14 @@ static inline void prepare_page_table(void)
863 /* 863 /*
864 * Clear out all the mappings below the kernel image. 864 * Clear out all the mappings below the kernel image.
865 */ 865 */
866 for (addr = 0; addr < MODULES_VADDR; addr += PGDIR_SIZE) 866 for (addr = 0; addr < MODULES_VADDR; addr += PMD_SIZE)
867 pmd_clear(pmd_off_k(addr)); 867 pmd_clear(pmd_off_k(addr));
868 868
869#ifdef CONFIG_XIP_KERNEL 869#ifdef CONFIG_XIP_KERNEL
870 /* The XIP kernel is mapped in the module area -- skip over it */ 870 /* The XIP kernel is mapped in the module area -- skip over it */
871 addr = ((unsigned long)_etext + PGDIR_SIZE - 1) & PGDIR_MASK; 871 addr = ((unsigned long)_etext + PMD_SIZE - 1) & PMD_MASK;
872#endif 872#endif
873 for ( ; addr < PAGE_OFFSET; addr += PGDIR_SIZE) 873 for ( ; addr < PAGE_OFFSET; addr += PMD_SIZE)
874 pmd_clear(pmd_off_k(addr)); 874 pmd_clear(pmd_off_k(addr));
875 875
876 /* 876 /*
@@ -885,10 +885,12 @@ static inline void prepare_page_table(void)
885 * memory bank, up to the end of the vmalloc region. 885 * memory bank, up to the end of the vmalloc region.
886 */ 886 */
887 for (addr = __phys_to_virt(end); 887 for (addr = __phys_to_virt(end);
888 addr < VMALLOC_END; addr += PGDIR_SIZE) 888 addr < VMALLOC_END; addr += PMD_SIZE)
889 pmd_clear(pmd_off_k(addr)); 889 pmd_clear(pmd_off_k(addr));
890} 890}
891 891
892#define SWAPPER_PG_DIR_SIZE (PTRS_PER_PGD * sizeof(pgd_t))
893
892/* 894/*
893 * Reserve the special regions of memory 895 * Reserve the special regions of memory
894 */ 896 */
@@ -898,7 +900,7 @@ void __init arm_mm_memblock_reserve(void)
898 * Reserve the page tables. These are already in use, 900 * Reserve the page tables. These are already in use,
899 * and can only be in node 0. 901 * and can only be in node 0.
900 */ 902 */
901 memblock_reserve(__pa(swapper_pg_dir), PTRS_PER_PGD * sizeof(pgd_t)); 903 memblock_reserve(__pa(swapper_pg_dir), SWAPPER_PG_DIR_SIZE);
902 904
903#ifdef CONFIG_SA1111 905#ifdef CONFIG_SA1111
904 /* 906 /*
@@ -926,7 +928,7 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
926 */ 928 */
927 vectors_page = early_alloc(PAGE_SIZE); 929 vectors_page = early_alloc(PAGE_SIZE);
928 930
929 for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE) 931 for (addr = VMALLOC_END; addr; addr += PMD_SIZE)
930 pmd_clear(pmd_off_k(addr)); 932 pmd_clear(pmd_off_k(addr));
931 933
932 /* 934 /*
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 9049c0764db..9591c8e9fb8 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -218,7 +218,7 @@ ENDPROC(cpu_v7_set_pte_ext)
218/* Suspend/resume support: derived from arch/arm/mach-s5pv210/sleep.S */ 218/* Suspend/resume support: derived from arch/arm/mach-s5pv210/sleep.S */
219.globl cpu_v7_suspend_size 219.globl cpu_v7_suspend_size
220.equ cpu_v7_suspend_size, 4 * 9 220.equ cpu_v7_suspend_size, 4 * 9
221#ifdef CONFIG_PM_SLEEP 221#ifdef CONFIG_ARM_CPU_SUSPEND
222ENTRY(cpu_v7_do_suspend) 222ENTRY(cpu_v7_do_suspend)
223 stmfd sp!, {r4 - r11, lr} 223 stmfd sp!, {r4 - r11, lr}
224 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID 224 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID
diff --git a/arch/arm/plat-mxc/Kconfig b/arch/arm/plat-mxc/Kconfig
index a5353fc0793..4c8fdbcc946 100644
--- a/arch/arm/plat-mxc/Kconfig
+++ b/arch/arm/plat-mxc/Kconfig
@@ -39,7 +39,7 @@ config ARCH_MX503
39 select ARCH_MX50_SUPPORTED 39 select ARCH_MX50_SUPPORTED
40 select ARCH_MX53_SUPPORTED 40 select ARCH_MX53_SUPPORTED
41 help 41 help
42 This enables support for machines using Freescale's i.MX50 and i.MX51 42 This enables support for machines using Freescale's i.MX50 and i.MX53
43 processors. 43 processors.
44 44
45config ARCH_MX51 45config ARCH_MX51
diff --git a/arch/arm/plat-mxc/devices.c b/arch/arm/plat-mxc/devices.c
index 0d6ed31bdbf..a34b2ae895f 100644
--- a/arch/arm/plat-mxc/devices.c
+++ b/arch/arm/plat-mxc/devices.c
@@ -37,59 +37,6 @@ int __init mxc_register_device(struct platform_device *pdev, void *data)
37 return ret; 37 return ret;
38} 38}
39 39
40struct platform_device *__init imx_add_platform_device_dmamask(
41 const char *name, int id,
42 const struct resource *res, unsigned int num_resources,
43 const void *data, size_t size_data, u64 dmamask)
44{
45 int ret = -ENOMEM;
46 struct platform_device *pdev;
47
48 pdev = platform_device_alloc(name, id);
49 if (!pdev)
50 goto err;
51
52 if (dmamask) {
53 /*
54 * This memory isn't freed when the device is put,
55 * I don't have a nice idea for that though. Conceptually
56 * dma_mask in struct device should not be a pointer.
57 * See http://thread.gmane.org/gmane.linux.kernel.pci/9081
58 */
59 pdev->dev.dma_mask =
60 kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);
61 if (!pdev->dev.dma_mask)
62 /* ret is still -ENOMEM; */
63 goto err;
64
65 *pdev->dev.dma_mask = dmamask;
66 pdev->dev.coherent_dma_mask = dmamask;
67 }
68
69 if (res) {
70 ret = platform_device_add_resources(pdev, res, num_resources);
71 if (ret)
72 goto err;
73 }
74
75 if (data) {
76 ret = platform_device_add_data(pdev, data, size_data);
77 if (ret)
78 goto err;
79 }
80
81 ret = platform_device_add(pdev);
82 if (ret) {
83err:
84 if (dmamask)
85 kfree(pdev->dev.dma_mask);
86 platform_device_put(pdev);
87 return ERR_PTR(ret);
88 }
89
90 return pdev;
91}
92
93struct device mxc_aips_bus = { 40struct device mxc_aips_bus = {
94 .init_name = "mxc_aips", 41 .init_name = "mxc_aips",
95 .parent = &platform_bus, 42 .parent = &platform_bus,
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index 524538aabc4..543525d76a6 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -14,10 +14,22 @@
14extern struct device mxc_aips_bus; 14extern struct device mxc_aips_bus;
15extern struct device mxc_ahb_bus; 15extern struct device mxc_ahb_bus;
16 16
17struct platform_device *imx_add_platform_device_dmamask( 17static inline struct platform_device *imx_add_platform_device_dmamask(
18 const char *name, int id, 18 const char *name, int id,
19 const struct resource *res, unsigned int num_resources, 19 const struct resource *res, unsigned int num_resources,
20 const void *data, size_t size_data, u64 dmamask); 20 const void *data, size_t size_data, u64 dmamask)
21{
22 struct platform_device_info pdevinfo = {
23 .name = name,
24 .id = id,
25 .res = res,
26 .num_res = num_resources,
27 .data = data,
28 .size_data = size_data,
29 .dma_mask = dmamask,
30 };
31 return platform_device_register_full(&pdevinfo);
32}
21 33
22static inline struct platform_device *imx_add_platform_device( 34static inline struct platform_device *imx_add_platform_device(
23 const char *name, int id, 35 const char *name, int id,
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index bb8f4a6b3e3..5b605a9eb09 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -14,6 +14,7 @@ config ARCH_OMAP1
14 select CLKDEV_LOOKUP 14 select CLKDEV_LOOKUP
15 select CLKSRC_MMIO 15 select CLKSRC_MMIO
16 select GENERIC_IRQ_CHIP 16 select GENERIC_IRQ_CHIP
17 select HAVE_IDE
17 help 18 help
18 "Systems based on omap7xx, omap15xx or omap16xx" 19 "Systems based on omap7xx, omap15xx or omap16xx"
19 20
diff --git a/arch/arm/plat-s5p/Kconfig b/arch/arm/plat-s5p/Kconfig
index 9843c954c04..9a197e55f66 100644
--- a/arch/arm/plat-s5p/Kconfig
+++ b/arch/arm/plat-s5p/Kconfig
@@ -22,7 +22,6 @@ config PLAT_S5P
22 select PLAT_SAMSUNG 22 select PLAT_SAMSUNG
23 select SAMSUNG_CLKSRC 23 select SAMSUNG_CLKSRC
24 select SAMSUNG_IRQ_VIC_TIMER 24 select SAMSUNG_IRQ_VIC_TIMER
25 select SAMSUNG_IRQ_UART
26 help 25 help
27 Base platform code for Samsung's S5P series SoC. 26 Base platform code for Samsung's S5P series SoC.
28 27
diff --git a/arch/arm/plat-s5p/dev-uart.c b/arch/arm/plat-s5p/dev-uart.c
index afaf87fdb93..c9308db3618 100644
--- a/arch/arm/plat-s5p/dev-uart.c
+++ b/arch/arm/plat-s5p/dev-uart.c
@@ -32,20 +32,10 @@ static struct resource s5p_uart0_resource[] = {
32 .flags = IORESOURCE_MEM, 32 .flags = IORESOURCE_MEM,
33 }, 33 },
34 [1] = { 34 [1] = {
35 .start = IRQ_S5P_UART_RX0, 35 .start = IRQ_UART0,
36 .end = IRQ_S5P_UART_RX0, 36 .end = IRQ_UART0,
37 .flags = IORESOURCE_IRQ, 37 .flags = IORESOURCE_IRQ,
38 }, 38 },
39 [2] = {
40 .start = IRQ_S5P_UART_TX0,
41 .end = IRQ_S5P_UART_TX0,
42 .flags = IORESOURCE_IRQ,
43 },
44 [3] = {
45 .start = IRQ_S5P_UART_ERR0,
46 .end = IRQ_S5P_UART_ERR0,
47 .flags = IORESOURCE_IRQ,
48 }
49}; 39};
50 40
51static struct resource s5p_uart1_resource[] = { 41static struct resource s5p_uart1_resource[] = {
@@ -55,18 +45,8 @@ static struct resource s5p_uart1_resource[] = {
55 .flags = IORESOURCE_MEM, 45 .flags = IORESOURCE_MEM,
56 }, 46 },
57 [1] = { 47 [1] = {
58 .start = IRQ_S5P_UART_RX1, 48 .start = IRQ_UART1,
59 .end = IRQ_S5P_UART_RX1, 49 .end = IRQ_UART1,
60 .flags = IORESOURCE_IRQ,
61 },
62 [2] = {
63 .start = IRQ_S5P_UART_TX1,
64 .end = IRQ_S5P_UART_TX1,
65 .flags = IORESOURCE_IRQ,
66 },
67 [3] = {
68 .start = IRQ_S5P_UART_ERR1,
69 .end = IRQ_S5P_UART_ERR1,
70 .flags = IORESOURCE_IRQ, 50 .flags = IORESOURCE_IRQ,
71 }, 51 },
72}; 52};
@@ -78,18 +58,8 @@ static struct resource s5p_uart2_resource[] = {
78 .flags = IORESOURCE_MEM, 58 .flags = IORESOURCE_MEM,
79 }, 59 },
80 [1] = { 60 [1] = {
81 .start = IRQ_S5P_UART_RX2, 61 .start = IRQ_UART2,
82 .end = IRQ_S5P_UART_RX2, 62 .end = IRQ_UART2,
83 .flags = IORESOURCE_IRQ,
84 },
85 [2] = {
86 .start = IRQ_S5P_UART_TX2,
87 .end = IRQ_S5P_UART_TX2,
88 .flags = IORESOURCE_IRQ,
89 },
90 [3] = {
91 .start = IRQ_S5P_UART_ERR2,
92 .end = IRQ_S5P_UART_ERR2,
93 .flags = IORESOURCE_IRQ, 63 .flags = IORESOURCE_IRQ,
94 }, 64 },
95}; 65};
@@ -102,18 +72,8 @@ static struct resource s5p_uart3_resource[] = {
102 .flags = IORESOURCE_MEM, 72 .flags = IORESOURCE_MEM,
103 }, 73 },
104 [1] = { 74 [1] = {
105 .start = IRQ_S5P_UART_RX3, 75 .start = IRQ_UART3,
106 .end = IRQ_S5P_UART_RX3, 76 .end = IRQ_UART3,
107 .flags = IORESOURCE_IRQ,
108 },
109 [2] = {
110 .start = IRQ_S5P_UART_TX3,
111 .end = IRQ_S5P_UART_TX3,
112 .flags = IORESOURCE_IRQ,
113 },
114 [3] = {
115 .start = IRQ_S5P_UART_ERR3,
116 .end = IRQ_S5P_UART_ERR3,
117 .flags = IORESOURCE_IRQ, 77 .flags = IORESOURCE_IRQ,
118 }, 78 },
119#endif 79#endif
@@ -127,18 +87,8 @@ static struct resource s5p_uart4_resource[] = {
127 .flags = IORESOURCE_MEM, 87 .flags = IORESOURCE_MEM,
128 }, 88 },
129 [1] = { 89 [1] = {
130 .start = IRQ_S5P_UART_RX4, 90 .start = IRQ_UART4,
131 .end = IRQ_S5P_UART_RX4, 91 .end = IRQ_UART4,
132 .flags = IORESOURCE_IRQ,
133 },
134 [2] = {
135 .start = IRQ_S5P_UART_TX4,
136 .end = IRQ_S5P_UART_TX4,
137 .flags = IORESOURCE_IRQ,
138 },
139 [3] = {
140 .start = IRQ_S5P_UART_ERR4,
141 .end = IRQ_S5P_UART_ERR4,
142 .flags = IORESOURCE_IRQ, 92 .flags = IORESOURCE_IRQ,
143 }, 93 },
144#endif 94#endif
@@ -152,18 +102,8 @@ static struct resource s5p_uart5_resource[] = {
152 .flags = IORESOURCE_MEM, 102 .flags = IORESOURCE_MEM,
153 }, 103 },
154 [1] = { 104 [1] = {
155 .start = IRQ_S5P_UART_RX5, 105 .start = IRQ_UART5,
156 .end = IRQ_S5P_UART_RX5, 106 .end = IRQ_UART5,
157 .flags = IORESOURCE_IRQ,
158 },
159 [2] = {
160 .start = IRQ_S5P_UART_TX5,
161 .end = IRQ_S5P_UART_TX5,
162 .flags = IORESOURCE_IRQ,
163 },
164 [3] = {
165 .start = IRQ_S5P_UART_ERR5,
166 .end = IRQ_S5P_UART_ERR5,
167 .flags = IORESOURCE_IRQ, 107 .flags = IORESOURCE_IRQ,
168 }, 108 },
169#endif 109#endif
diff --git a/arch/arm/plat-s5p/include/plat/irqs.h b/arch/arm/plat-s5p/include/plat/irqs.h
index ba9121c60a2..144dbfc6506 100644
--- a/arch/arm/plat-s5p/include/plat/irqs.h
+++ b/arch/arm/plat-s5p/include/plat/irqs.h
@@ -37,41 +37,6 @@
37#define IRQ_VIC1_BASE S5P_VIC1_BASE 37#define IRQ_VIC1_BASE S5P_VIC1_BASE
38#define IRQ_VIC2_BASE S5P_VIC2_BASE 38#define IRQ_VIC2_BASE S5P_VIC2_BASE
39 39
40/* UART interrupts, each UART has 4 intterupts per channel so
41 * use the space between the ISA and S3C main interrupts. Note, these
42 * are not in the same order as the S3C24XX series! */
43
44#define IRQ_S5P_UART_BASE0 (16)
45#define IRQ_S5P_UART_BASE1 (20)
46#define IRQ_S5P_UART_BASE2 (24)
47#define IRQ_S5P_UART_BASE3 (28)
48
49#define UART_IRQ_RXD (0)
50#define UART_IRQ_ERR (1)
51#define UART_IRQ_TXD (2)
52
53#define IRQ_S5P_UART_RX0 (IRQ_S5P_UART_BASE0 + UART_IRQ_RXD)
54#define IRQ_S5P_UART_TX0 (IRQ_S5P_UART_BASE0 + UART_IRQ_TXD)
55#define IRQ_S5P_UART_ERR0 (IRQ_S5P_UART_BASE0 + UART_IRQ_ERR)
56
57#define IRQ_S5P_UART_RX1 (IRQ_S5P_UART_BASE1 + UART_IRQ_RXD)
58#define IRQ_S5P_UART_TX1 (IRQ_S5P_UART_BASE1 + UART_IRQ_TXD)
59#define IRQ_S5P_UART_ERR1 (IRQ_S5P_UART_BASE1 + UART_IRQ_ERR)
60
61#define IRQ_S5P_UART_RX2 (IRQ_S5P_UART_BASE2 + UART_IRQ_RXD)
62#define IRQ_S5P_UART_TX2 (IRQ_S5P_UART_BASE2 + UART_IRQ_TXD)
63#define IRQ_S5P_UART_ERR2 (IRQ_S5P_UART_BASE2 + UART_IRQ_ERR)
64
65#define IRQ_S5P_UART_RX3 (IRQ_S5P_UART_BASE3 + UART_IRQ_RXD)
66#define IRQ_S5P_UART_TX3 (IRQ_S5P_UART_BASE3 + UART_IRQ_TXD)
67#define IRQ_S5P_UART_ERR3 (IRQ_S5P_UART_BASE3 + UART_IRQ_ERR)
68
69/* S3C compatibilty defines */
70#define IRQ_S3CUART_RX0 IRQ_S5P_UART_RX0
71#define IRQ_S3CUART_RX1 IRQ_S5P_UART_RX1
72#define IRQ_S3CUART_RX2 IRQ_S5P_UART_RX2
73#define IRQ_S3CUART_RX3 IRQ_S5P_UART_RX3
74
75/* VIC based IRQs */ 40/* VIC based IRQs */
76 41
77#define S5P_IRQ_VIC0(x) (S5P_VIC0_BASE + (x)) 42#define S5P_IRQ_VIC0(x) (S5P_VIC0_BASE + (x))
diff --git a/arch/arm/plat-s5p/irq-gpioint.c b/arch/arm/plat-s5p/irq-gpioint.c
index f88216d2399..c65eb791d1b 100644
--- a/arch/arm/plat-s5p/irq-gpioint.c
+++ b/arch/arm/plat-s5p/irq-gpioint.c
@@ -163,9 +163,9 @@ static __init int s5p_gpioint_add(struct s3c_gpio_chip *chip)
163 ct->chip.irq_mask = irq_gc_mask_set_bit; 163 ct->chip.irq_mask = irq_gc_mask_set_bit;
164 ct->chip.irq_unmask = irq_gc_mask_clr_bit; 164 ct->chip.irq_unmask = irq_gc_mask_clr_bit;
165 ct->chip.irq_set_type = s5p_gpioint_set_type, 165 ct->chip.irq_set_type = s5p_gpioint_set_type,
166 ct->regs.ack = PEND_OFFSET + REG_OFFSET(chip->group); 166 ct->regs.ack = PEND_OFFSET + REG_OFFSET(group - bank->start);
167 ct->regs.mask = MASK_OFFSET + REG_OFFSET(chip->group); 167 ct->regs.mask = MASK_OFFSET + REG_OFFSET(group - bank->start);
168 ct->regs.type = CON_OFFSET + REG_OFFSET(chip->group); 168 ct->regs.type = CON_OFFSET + REG_OFFSET(group - bank->start);
169 irq_setup_generic_chip(gc, IRQ_MSK(chip->chip.ngpio), 169 irq_setup_generic_chip(gc, IRQ_MSK(chip->chip.ngpio),
170 IRQ_GC_INIT_MASK_CACHE, 170 IRQ_GC_INIT_MASK_CACHE,
171 IRQ_NOREQUEST | IRQ_NOPROBE, 0); 171 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
diff --git a/arch/arm/plat-s5p/irq.c b/arch/arm/plat-s5p/irq.c
index a97c08957f4..afdaa1082b9 100644
--- a/arch/arm/plat-s5p/irq.c
+++ b/arch/arm/plat-s5p/irq.c
@@ -17,42 +17,10 @@
17 17
18#include <asm/hardware/vic.h> 18#include <asm/hardware/vic.h>
19 19
20#include <linux/serial_core.h>
21#include <mach/map.h> 20#include <mach/map.h>
22#include <plat/regs-timer.h> 21#include <plat/regs-timer.h>
23#include <plat/regs-serial.h>
24#include <plat/cpu.h> 22#include <plat/cpu.h>
25#include <plat/irq-vic-timer.h> 23#include <plat/irq-vic-timer.h>
26#include <plat/irq-uart.h>
27
28/*
29 * Note, we make use of the fact that the parent IRQs, IRQ_UART[0..3]
30 * are consecutive when looking up the interrupt in the demux routines.
31 */
32static struct s3c_uart_irq uart_irqs[] = {
33 [0] = {
34 .regs = S5P_VA_UART0,
35 .base_irq = IRQ_S5P_UART_BASE0,
36 .parent_irq = IRQ_UART0,
37 },
38 [1] = {
39 .regs = S5P_VA_UART1,
40 .base_irq = IRQ_S5P_UART_BASE1,
41 .parent_irq = IRQ_UART1,
42 },
43 [2] = {
44 .regs = S5P_VA_UART2,
45 .base_irq = IRQ_S5P_UART_BASE2,
46 .parent_irq = IRQ_UART2,
47 },
48#if CONFIG_SERIAL_SAMSUNG_UARTS > 3
49 [3] = {
50 .regs = S5P_VA_UART3,
51 .base_irq = IRQ_S5P_UART_BASE3,
52 .parent_irq = IRQ_UART3,
53 },
54#endif
55};
56 24
57void __init s5p_init_irq(u32 *vic, u32 num_vic) 25void __init s5p_init_irq(u32 *vic, u32 num_vic)
58{ 26{
@@ -65,6 +33,4 @@ void __init s5p_init_irq(u32 *vic, u32 num_vic)
65#endif 33#endif
66 34
67 s3c_init_vic_timer_irq(5, IRQ_TIMER0); 35 s3c_init_vic_timer_irq(5, IRQ_TIMER0);
68
69 s3c_init_uart_irqs(uart_irqs, ARRAY_SIZE(uart_irqs));
70} 36}
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index b3e10659e4b..dffa37bc4a0 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -65,11 +65,6 @@ config SAMSUNG_IRQ_VIC_TIMER
65 help 65 help
66 Internal configuration to build the VIC timer interrupt code. 66 Internal configuration to build the VIC timer interrupt code.
67 67
68config SAMSUNG_IRQ_UART
69 bool
70 help
71 Internal configuration to build the IRQ UART demux code.
72
73# options for gpio configuration support 68# options for gpio configuration support
74 69
75config SAMSUNG_GPIOLIB_4BIT 70config SAMSUNG_GPIOLIB_4BIT
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 853764ba8cc..1105922342f 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -21,7 +21,6 @@ obj-y += dev-asocdma.o
21 21
22obj-$(CONFIG_SAMSUNG_CLKSRC) += clock-clksrc.o 22obj-$(CONFIG_SAMSUNG_CLKSRC) += clock-clksrc.o
23 23
24obj-$(CONFIG_SAMSUNG_IRQ_UART) += irq-uart.o
25obj-$(CONFIG_SAMSUNG_IRQ_VIC_TIMER) += irq-vic-timer.o 24obj-$(CONFIG_SAMSUNG_IRQ_VIC_TIMER) += irq-vic-timer.o
26 25
27# ADC 26# ADC
diff --git a/arch/arm/plat-samsung/include/plat/regs-serial.h b/arch/arm/plat-samsung/include/plat/regs-serial.h
index bac36fa3bec..72073484702 100644
--- a/arch/arm/plat-samsung/include/plat/regs-serial.h
+++ b/arch/arm/plat-samsung/include/plat/regs-serial.h
@@ -186,6 +186,11 @@
186#define S3C64XX_UINTSP 0x34 186#define S3C64XX_UINTSP 0x34
187#define S3C64XX_UINTM 0x38 187#define S3C64XX_UINTM 0x38
188 188
189#define S3C64XX_UINTM_RXD (0)
190#define S3C64XX_UINTM_TXD (2)
191#define S3C64XX_UINTM_RXD_MSK (1 << S3C64XX_UINTM_RXD)
192#define S3C64XX_UINTM_TXD_MSK (1 << S3C64XX_UINTM_TXD)
193
189/* Following are specific to S5PV210 */ 194/* Following are specific to S5PV210 */
190#define S5PV210_UCON_CLKMASK (1<<10) 195#define S5PV210_UCON_CLKMASK (1<<10)
191#define S5PV210_UCON_PCLK (0<<10) 196#define S5PV210_UCON_PCLK (0<<10)
diff --git a/arch/arm/plat-samsung/irq-uart.c b/arch/arm/plat-samsung/irq-uart.c
deleted file mode 100644
index 3014c7226bd..00000000000
--- a/arch/arm/plat-samsung/irq-uart.c
+++ /dev/null
@@ -1,96 +0,0 @@
1/* arch/arm/plat-samsung/irq-uart.c
2 * originally part of arch/arm/plat-s3c64xx/irq.c
3 *
4 * Copyright 2008 Openmoko, Inc.
5 * Copyright 2008 Simtec Electronics
6 * Ben Dooks <ben@simtec.co.uk>
7 * http://armlinux.simtec.co.uk/
8 *
9 * Samsung- UART Interrupt handling
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/kernel.h>
17#include <linux/interrupt.h>
18#include <linux/serial_core.h>
19#include <linux/irq.h>
20#include <linux/io.h>
21
22#include <asm/mach/irq.h>
23
24#include <mach/map.h>
25#include <plat/irq-uart.h>
26#include <plat/regs-serial.h>
27#include <plat/cpu.h>
28
29/* Note, we make use of the fact that the parent IRQs, IRQ_UART[0..3]
30 * are consecutive when looking up the interrupt in the demux routines.
31 */
32static void s3c_irq_demux_uart(unsigned int irq, struct irq_desc *desc)
33{
34 struct s3c_uart_irq *uirq = desc->irq_data.handler_data;
35 struct irq_chip *chip = irq_get_chip(irq);
36 u32 pend = __raw_readl(uirq->regs + S3C64XX_UINTP);
37 int base = uirq->base_irq;
38
39 chained_irq_enter(chip, desc);
40
41 if (pend & (1 << 0))
42 generic_handle_irq(base);
43 if (pend & (1 << 1))
44 generic_handle_irq(base + 1);
45 if (pend & (1 << 2))
46 generic_handle_irq(base + 2);
47 if (pend & (1 << 3))
48 generic_handle_irq(base + 3);
49
50 chained_irq_exit(chip, desc);
51}
52
53static void __init s3c_init_uart_irq(struct s3c_uart_irq *uirq)
54{
55 void __iomem *reg_base = uirq->regs;
56 struct irq_chip_generic *gc;
57 struct irq_chip_type *ct;
58
59 /* mask all interrupts at the start. */
60 __raw_writel(0xf, reg_base + S3C64XX_UINTM);
61
62 gc = irq_alloc_generic_chip("s3c-uart", 1, uirq->base_irq, reg_base,
63 handle_level_irq);
64
65 if (!gc) {
66 pr_err("%s: irq_alloc_generic_chip for IRQ %u failed\n",
67 __func__, uirq->base_irq);
68 return;
69 }
70
71 ct = gc->chip_types;
72 ct->chip.irq_ack = irq_gc_ack_set_bit;
73 ct->chip.irq_mask = irq_gc_mask_set_bit;
74 ct->chip.irq_unmask = irq_gc_mask_clr_bit;
75 ct->regs.ack = S3C64XX_UINTP;
76 ct->regs.mask = S3C64XX_UINTM;
77 irq_setup_generic_chip(gc, IRQ_MSK(4), IRQ_GC_INIT_MASK_CACHE,
78 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
79
80 irq_set_handler_data(uirq->parent_irq, uirq);
81 irq_set_chained_handler(uirq->parent_irq, s3c_irq_demux_uart);
82}
83
84/**
85 * s3c_init_uart_irqs() - initialise UART IRQs and the necessary demuxing
86 * @irq: The interrupt data for registering
87 * @nr_irqs: The number of interrupt descriptions in @irq.
88 *
89 * Register the UART interrupts specified by @irq including the demuxing
90 * routines. This supports the S3C6400 and newer style of devices.
91 */
92void __init s3c_init_uart_irqs(struct s3c_uart_irq *irq, unsigned int nr_irqs)
93{
94 for (; nr_irqs > 0; nr_irqs--, irq++)
95 s3c_init_uart_irq(irq);
96}
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index 62cc8f98117..5bdeef96984 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -12,10 +12,9 @@
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# XXX: This is a cut-down version of the file; it contains only machines that 15# This is a cut-down version of the file; it contains only machines that
16# XXX: are in mainline or have been submitted to the machine database within 16# are merged into mainline or have been edited in the machine database
17# XXX: the last 12 months. If your entry is missing please email rmk at 17# within the last 12 months. References to machine_is_NAME() do not count!
18# XXX: <linux@arm.linux.org.uk>
19# 18#
20# Last update: Sat May 7 08:48:24 2011 19# Last update: Sat May 7 08:48:24 2011
21# 20#
@@ -65,6 +64,7 @@ h7201 ARCH_H7201 H7201 161
65h7202 ARCH_H7202 H7202 162 64h7202 ARCH_H7202 H7202 162
66iq80321 ARCH_IQ80321 IQ80321 169 65iq80321 ARCH_IQ80321 IQ80321 169
67ks8695 ARCH_KS8695 KS8695 180 66ks8695 ARCH_KS8695 KS8695 180
67karo ARCH_KARO KARO 190
68smdk2410 ARCH_SMDK2410 SMDK2410 193 68smdk2410 ARCH_SMDK2410 SMDK2410 193
69ceiva ARCH_CEIVA CEIVA 200 69ceiva ARCH_CEIVA CEIVA 200
70voiceblue MACH_VOICEBLUE VOICEBLUE 218 70voiceblue MACH_VOICEBLUE VOICEBLUE 218
@@ -188,6 +188,7 @@ omap_2430sdp MACH_OMAP_2430SDP OMAP_2430SDP 900
188davinci_evm MACH_DAVINCI_EVM DAVINCI_EVM 901 188davinci_evm MACH_DAVINCI_EVM DAVINCI_EVM 901
189palmz72 MACH_PALMZ72 PALMZ72 904 189palmz72 MACH_PALMZ72 PALMZ72 904
190nxdb500 MACH_NXDB500 NXDB500 905 190nxdb500 MACH_NXDB500 NXDB500 905
191apf9328 MACH_APF9328 APF9328 906
191palmt5 MACH_PALMT5 PALMT5 917 192palmt5 MACH_PALMT5 PALMT5 917
192palmtc MACH_PALMTC PALMTC 918 193palmtc MACH_PALMTC PALMTC 918
193omap_apollon MACH_OMAP_APOLLON OMAP_APOLLON 919 194omap_apollon MACH_OMAP_APOLLON OMAP_APOLLON 919
@@ -271,10 +272,12 @@ pcm038 MACH_PCM038 PCM038 1551
271ts_x09 MACH_TS209 TS209 1565 272ts_x09 MACH_TS209 TS209 1565
272at91cap9adk MACH_AT91CAP9ADK AT91CAP9ADK 1566 273at91cap9adk MACH_AT91CAP9ADK AT91CAP9ADK 1566
273mx31moboard MACH_MX31MOBOARD MX31MOBOARD 1574 274mx31moboard MACH_MX31MOBOARD MX31MOBOARD 1574
275vision_ep9307 MACH_VISION_EP9307 VISION_EP9307 1578
274terastation_pro2 MACH_TERASTATION_PRO2 TERASTATION_PRO2 1584 276terastation_pro2 MACH_TERASTATION_PRO2 TERASTATION_PRO2 1584
275linkstation_pro MACH_LINKSTATION_PRO LINKSTATION_PRO 1585 277linkstation_pro MACH_LINKSTATION_PRO LINKSTATION_PRO 1585
276e350 MACH_E350 E350 1596 278e350 MACH_E350 E350 1596
277ts409 MACH_TS409 TS409 1601 279ts409 MACH_TS409 TS409 1601
280rsi_ews MACH_RSI_EWS RSI_EWS 1609
278cm_x300 MACH_CM_X300 CM_X300 1616 281cm_x300 MACH_CM_X300 CM_X300 1616
279at91sam9g20ek MACH_AT91SAM9G20EK AT91SAM9G20EK 1624 282at91sam9g20ek MACH_AT91SAM9G20EK AT91SAM9G20EK 1624
280smdk6410 MACH_SMDK6410 SMDK6410 1626 283smdk6410 MACH_SMDK6410 SMDK6410 1626
@@ -331,6 +334,7 @@ smdkc100 MACH_SMDKC100 SMDKC100 1826
331tavorevb MACH_TAVOREVB TAVOREVB 1827 334tavorevb MACH_TAVOREVB TAVOREVB 1827
332saar MACH_SAAR SAAR 1828 335saar MACH_SAAR SAAR 1828
333at91sam9m10g45ek MACH_AT91SAM9M10G45EK AT91SAM9M10G45EK 1830 336at91sam9m10g45ek MACH_AT91SAM9M10G45EK AT91SAM9M10G45EK 1830
337usb_a9g20 MACH_USB_A9G20 USB_A9G20 1841
334mxlads MACH_MXLADS MXLADS 1851 338mxlads MACH_MXLADS MXLADS 1851
335linkstation_mini MACH_LINKSTATION_MINI LINKSTATION_MINI 1858 339linkstation_mini MACH_LINKSTATION_MINI LINKSTATION_MINI 1858
336afeb9260 MACH_AFEB9260 AFEB9260 1859 340afeb9260 MACH_AFEB9260 AFEB9260 1859
@@ -369,6 +373,7 @@ pcm043 MACH_PCM043 PCM043 2072
369sheevaplug MACH_SHEEVAPLUG SHEEVAPLUG 2097 373sheevaplug MACH_SHEEVAPLUG SHEEVAPLUG 2097
370avengers_lite MACH_AVENGERS_LITE AVENGERS_LITE 2104 374avengers_lite MACH_AVENGERS_LITE AVENGERS_LITE 2104
371mx51_babbage MACH_MX51_BABBAGE MX51_BABBAGE 2125 375mx51_babbage MACH_MX51_BABBAGE MX51_BABBAGE 2125
376tx37 MACH_TX37 TX37 2127
372rd78x00_masa MACH_RD78X00_MASA RD78X00_MASA 2135 377rd78x00_masa MACH_RD78X00_MASA RD78X00_MASA 2135
373dm355_leopard MACH_DM355_LEOPARD DM355_LEOPARD 2138 378dm355_leopard MACH_DM355_LEOPARD DM355_LEOPARD 2138
374ts219 MACH_TS219 TS219 2139 379ts219 MACH_TS219 TS219 2139
@@ -379,6 +384,7 @@ omap_4430sdp MACH_OMAP_4430SDP OMAP_4430SDP 2160
379magx_zn5 MACH_MAGX_ZN5 MAGX_ZN5 2162 384magx_zn5 MACH_MAGX_ZN5 MAGX_ZN5 2162
380btmavb101 MACH_BTMAVB101 BTMAVB101 2172 385btmavb101 MACH_BTMAVB101 BTMAVB101 2172
381btmawb101 MACH_BTMAWB101 BTMAWB101 2173 386btmawb101 MACH_BTMAWB101 BTMAWB101 2173
387tx25 MACH_TX25 TX25 2177
382omap3_torpedo MACH_OMAP3_TORPEDO OMAP3_TORPEDO 2178 388omap3_torpedo MACH_OMAP3_TORPEDO OMAP3_TORPEDO 2178
383anw6410 MACH_ANW6410 ANW6410 2183 389anw6410 MACH_ANW6410 ANW6410 2183
384imx27_visstrim_m10 MACH_IMX27_VISSTRIM_M10 IMX27_VISSTRIM_M10 2187 390imx27_visstrim_m10 MACH_IMX27_VISSTRIM_M10 IMX27_VISSTRIM_M10 2187
@@ -423,6 +429,7 @@ raumfeld_rc MACH_RAUMFELD_RC RAUMFELD_RC 2413
423raumfeld_connector MACH_RAUMFELD_CONNECTOR RAUMFELD_CONNECTOR 2414 429raumfeld_connector MACH_RAUMFELD_CONNECTOR RAUMFELD_CONNECTOR 2414
424raumfeld_speaker MACH_RAUMFELD_SPEAKER RAUMFELD_SPEAKER 2415 430raumfeld_speaker MACH_RAUMFELD_SPEAKER RAUMFELD_SPEAKER 2415
425tnetv107x MACH_TNETV107X TNETV107X 2418 431tnetv107x MACH_TNETV107X TNETV107X 2418
432mx51_m2id MACH_MX51_M2ID MX51_M2ID 2428
426smdkv210 MACH_SMDKV210 SMDKV210 2456 433smdkv210 MACH_SMDKV210 SMDKV210 2456
427omap_zoom3 MACH_OMAP_ZOOM3 OMAP_ZOOM3 2464 434omap_zoom3 MACH_OMAP_ZOOM3 OMAP_ZOOM3 2464
428omap_3630sdp MACH_OMAP_3630SDP OMAP_3630SDP 2465 435omap_3630sdp MACH_OMAP_3630SDP OMAP_3630SDP 2465
@@ -433,14 +440,17 @@ omapl138_hawkboard MACH_OMAPL138_HAWKBOARD OMAPL138_HAWKBOARD 2495
433ts41x MACH_TS41X TS41X 2502 440ts41x MACH_TS41X TS41X 2502
434phy3250 MACH_PHY3250 PHY3250 2511 441phy3250 MACH_PHY3250 PHY3250 2511
435mini6410 MACH_MINI6410 MINI6410 2520 442mini6410 MACH_MINI6410 MINI6410 2520
443tx51 MACH_TX51 TX51 2529
436mx28evk MACH_MX28EVK MX28EVK 2531 444mx28evk MACH_MX28EVK MX28EVK 2531
437smartq5 MACH_SMARTQ5 SMARTQ5 2534 445smartq5 MACH_SMARTQ5 SMARTQ5 2534
438davinci_dm6467tevm MACH_DAVINCI_DM6467TEVM DAVINCI_DM6467TEVM 2548 446davinci_dm6467tevm MACH_DAVINCI_DM6467TEVM DAVINCI_DM6467TEVM 2548
439mxt_td60 MACH_MXT_TD60 MXT_TD60 2550 447mxt_td60 MACH_MXT_TD60 MXT_TD60 2550
440riot_bei2 MACH_RIOT_BEI2 RIOT_BEI2 2576 448riot_bei2 MACH_RIOT_BEI2 RIOT_BEI2 2576
441riot_x37 MACH_RIOT_X37 RIOT_X37 2578 449riot_x37 MACH_RIOT_X37 RIOT_X37 2578
450pca101 MACH_PCA101 PCA101 2595
442capc7117 MACH_CAPC7117 CAPC7117 2612 451capc7117 MACH_CAPC7117 CAPC7117 2612
443icontrol MACH_ICONTROL ICONTROL 2624 452icontrol MACH_ICONTROL ICONTROL 2624
453gplugd MACH_GPLUGD GPLUGD 2625
444qsd8x50a_st1_5 MACH_QSD8X50A_ST1_5 QSD8X50A_ST1_5 2627 454qsd8x50a_st1_5 MACH_QSD8X50A_ST1_5 QSD8X50A_ST1_5 2627
445mx23evk MACH_MX23EVK MX23EVK 2629 455mx23evk MACH_MX23EVK MX23EVK 2629
446ap4evb MACH_AP4EVB AP4EVB 2630 456ap4evb MACH_AP4EVB AP4EVB 2630
@@ -1113,3 +1123,5 @@ blissc MACH_BLISSC BLISSC 3491
1113thales_adc MACH_THALES_ADC THALES_ADC 3492 1123thales_adc MACH_THALES_ADC THALES_ADC 3492
1114ubisys_p9d_evp MACH_UBISYS_P9D_EVP UBISYS_P9D_EVP 3493 1124ubisys_p9d_evp MACH_UBISYS_P9D_EVP UBISYS_P9D_EVP 3493
1115atdgp318 MACH_ATDGP318 ATDGP318 3494 1125atdgp318 MACH_ATDGP318 ATDGP318 3494
1126smdk4212 MACH_SMDK4212 SMDK4212 3638
1127smdk4412 MACH_SMDK4412 SMDK4412 3765
diff --git a/arch/arm/vfp/Makefile b/arch/arm/vfp/Makefile
index 6de73aab019..a81404c09d5 100644
--- a/arch/arm/vfp/Makefile
+++ b/arch/arm/vfp/Makefile
@@ -7,7 +7,7 @@
7# ccflags-y := -DDEBUG 7# ccflags-y := -DDEBUG
8# asflags-y := -DDEBUG 8# asflags-y := -DDEBUG
9 9
10KBUILD_AFLAGS :=$(KBUILD_AFLAGS:-msoft-float=-Wa,-mfpu=softvfp+vfp) 10KBUILD_AFLAGS :=$(KBUILD_AFLAGS:-msoft-float=-Wa,-mfpu=softvfp+vfp -mfloat-abi=soft)
11LDFLAGS +=--no-warn-mismatch 11LDFLAGS +=--no-warn-mismatch
12 12
13obj-y += vfp.o 13obj-y += vfp.o
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 17addacb169..408b055c585 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -282,8 +282,8 @@ config ETRAX_RTC
282 Enables drivers for the Real-Time Clock battery-backed chips on 282 Enables drivers for the Real-Time Clock battery-backed chips on
283 some products. The kernel reads the time when booting, and 283 some products. The kernel reads the time when booting, and
284 the date can be set using ioctl(fd, RTC_SET_TIME, &rt) with rt a 284 the date can be set using ioctl(fd, RTC_SET_TIME, &rt) with rt a
285 rtc_time struct (see <file:include/asm-cris/rtc.h>) on the /dev/rtc 285 rtc_time struct (see <file:arch/cris/include/asm/rtc.h>) on the
286 device. You can check the time with cat /proc/rtc, but 286 /dev/rtc device. You can check the time with cat /proc/rtc, but
287 normal time reading should be done using libc function time and 287 normal time reading should be done using libc function time and
288 friends. 288 friends.
289 289
diff --git a/arch/cris/arch-v10/Kconfig b/arch/cris/arch-v10/Kconfig
index adc164e9933..df9a38b4f18 100644
--- a/arch/cris/arch-v10/Kconfig
+++ b/arch/cris/arch-v10/Kconfig
@@ -24,8 +24,8 @@ config ETRAX_PA_LEDS
24 help 24 help
25 The ETRAX network driver is responsible for flashing LED's when 25 The ETRAX network driver is responsible for flashing LED's when
26 packets arrive and are sent. It uses macros defined in 26 packets arrive and are sent. It uses macros defined in
27 <file:include/asm-cris/io.h>, and those macros are defined after what 27 <file:arch/cris/include/asm/io.h>, and those macros are defined after
28 YOU choose in this option. The actual bits used are configured 28 what YOU choose in this option. The actual bits used are configured
29 separately. Select this if the LEDs are on port PA. Some products 29 separately. Select this if the LEDs are on port PA. Some products
30 put the leds on PB or a memory-mapped latch (CSP0) instead. 30 put the leds on PB or a memory-mapped latch (CSP0) instead.
31 31
@@ -34,8 +34,8 @@ config ETRAX_PB_LEDS
34 help 34 help
35 The ETRAX network driver is responsible for flashing LED's when 35 The ETRAX network driver is responsible for flashing LED's when
36 packets arrive and are sent. It uses macros defined in 36 packets arrive and are sent. It uses macros defined in
37 <file:include/asm-cris/io.h>, and those macros are defined after what 37 <file:arch/cris/include/asm/io.h>, and those macros are defined after
38 YOU choose in this option. The actual bits used are configured 38 what YOU choose in this option. The actual bits used are configured
39 separately. Select this if the LEDs are on port PB. Some products 39 separately. Select this if the LEDs are on port PB. Some products
40 put the leds on PA or a memory-mapped latch (CSP0) instead. 40 put the leds on PA or a memory-mapped latch (CSP0) instead.
41 41
@@ -44,8 +44,8 @@ config ETRAX_CSP0_LEDS
44 help 44 help
45 The ETRAX network driver is responsible for flashing LED's when 45 The ETRAX network driver is responsible for flashing LED's when
46 packets arrive and are sent. It uses macros defined in 46 packets arrive and are sent. It uses macros defined in
47 <file:include/asm-cris/io.h>, and those macros are defined after what 47 <file:arch/cris/include/asm/io.h>, and those macros are defined after
48 YOU choose in this option. The actual bits used are configured 48 what YOU choose in this option. The actual bits used are configured
49 separately. Select this if the LEDs are on a memory-mapped latch 49 separately. Select this if the LEDs are on a memory-mapped latch
50 using chip select CSP0, this is mapped at 0x90000000. 50 using chip select CSP0, this is mapped at 0x90000000.
51 Some products put the leds on PA or PB instead. 51 Some products put the leds on PA or PB instead.
diff --git a/arch/cris/arch-v10/drivers/Kconfig b/arch/cris/arch-v10/drivers/Kconfig
index 0d722177992..32d90867a98 100644
--- a/arch/cris/arch-v10/drivers/Kconfig
+++ b/arch/cris/arch-v10/drivers/Kconfig
@@ -4,6 +4,7 @@ config ETRAX_ETHERNET
4 bool "Ethernet support" 4 bool "Ethernet support"
5 depends on ETRAX_ARCH_V10 5 depends on ETRAX_ARCH_V10
6 select NET_ETHERNET 6 select NET_ETHERNET
7 select NET_CORE
7 select MII 8 select MII
8 help 9 help
9 This option enables the ETRAX 100LX built-in 10/100Mbit Ethernet 10 This option enables the ETRAX 100LX built-in 10/100Mbit Ethernet
diff --git a/arch/cris/arch-v32/drivers/Kconfig b/arch/cris/arch-v32/drivers/Kconfig
index 41a2732e8b9..e47e9c3401b 100644
--- a/arch/cris/arch-v32/drivers/Kconfig
+++ b/arch/cris/arch-v32/drivers/Kconfig
@@ -4,6 +4,7 @@ config ETRAX_ETHERNET
4 bool "Ethernet support" 4 bool "Ethernet support"
5 depends on ETRAX_ARCH_V32 5 depends on ETRAX_ARCH_V32
6 select NET_ETHERNET 6 select NET_ETHERNET
7 select NET_CORE
7 select MII 8 select MII
8 help 9 help
9 This option enables the ETRAX FS built-in 10/100Mbit Ethernet 10 This option enables the ETRAX FS built-in 10/100Mbit Ethernet
diff --git a/arch/cris/arch-v32/lib/nand_init.S b/arch/cris/arch-v32/lib/nand_init.S
deleted file mode 100644
index d671fed451c..00000000000
--- a/arch/cris/arch-v32/lib/nand_init.S
+++ /dev/null
@@ -1,178 +0,0 @@
1##=============================================================================
2##
3## nand_init.S
4##
5## The bootrom copies data from the NAND flash to the internal RAM but
6## due to a bug/feature we can only trust the 256 first bytes. So this
7## code copies more data from NAND flash to internal RAM. Obvioulsy this
8## code must fit in the first 256 bytes so alter with care.
9##
10## Some notes about the bug/feature for future reference:
11## The bootrom copies the first 127 KB from NAND flash to internal
12## memory. The problem is that it does a bytewise copy. NAND flashes
13## does autoincrement on the address so for a 16-bite device each
14## read/write increases the address by two. So the copy loop in the
15## bootrom will discard every second byte. This is solved by inserting
16## zeroes in every second byte in the first erase block.
17##
18## The bootrom also incorrectly assumes that it can read the flash
19## linear with only one read command but the flash will actually
20## switch between normal area and spare area if you do that so we
21## can't trust more than the first 256 bytes.
22##
23##=============================================================================
24
25#include <arch/hwregs/asm/reg_map_asm.h>
26#include <arch/hwregs/asm/gio_defs_asm.h>
27#include <arch/hwregs/asm/pinmux_defs_asm.h>
28#include <arch/hwregs/asm/bif_core_defs_asm.h>
29#include <arch/hwregs/asm/config_defs_asm.h>
30
31;; There are 8-bit NAND flashes and 16-bit NAND flashes.
32;; We need to treat them slightly different.
33#if CONFIG_ETRAX_FLASH_BUSWIDTH==2
34#define PAGE_SIZE 256
35#else
36#error 2
37#define PAGE_SIZE 512
38#endif
39#define ERASE_BLOCK 16384
40
41;; GPIO pins connected to NAND flash
42#define CE 4
43#define CLE 5
44#define ALE 6
45#define BY 7
46
47;; Address space for NAND flash
48#define NAND_RD_ADDR 0x90000000
49#define NAND_WR_ADDR 0x94000000
50
51#define READ_CMD 0x00
52
53;; Readability macros
54#define CSP_MASK \
55 REG_MASK(bif_core, rw_grp3_cfg, gated_csp0) | \
56 REG_MASK(bif_core, rw_grp3_cfg, gated_csp1)
57#define CSP_VAL \
58 REG_STATE(bif_core, rw_grp3_cfg, gated_csp0, rd) | \
59 REG_STATE(bif_core, rw_grp3_cfg, gated_csp1, wr)
60
61;;----------------------------------------------------------------------------
62;; Macros to set/clear GPIO bits
63
64.macro SET x
65 or.b (1<<\x),$r9
66 move.d $r9, [$r2]
67.endm
68
69.macro CLR x
70 and.b ~(1<<\x),$r9
71 move.d $r9, [$r2]
72.endm
73
74;;----------------------------------------------------------------------------
75
76nand_boot:
77 ;; Check if nand boot was selected
78 move.d REG_ADDR(config, regi_config, r_bootsel), $r0
79 move.d [$r0], $r0
80 and.d REG_MASK(config, r_bootsel, boot_mode), $r0
81 cmp.d REG_STATE(config, r_bootsel, boot_mode, nand), $r0
82 bne normal_boot ; No NAND boot
83 nop
84
85copy_nand_to_ram:
86 ;; copy_nand_to_ram
87 ;; Arguments
88 ;; r10 - destination
89 ;; r11 - source offset
90 ;; r12 - size
91 ;; r13 - Address to jump to after completion
92 ;; Note : r10-r12 are clobbered on return
93 ;; Registers used:
94 ;; r0 - NAND_RD_ADDR
95 ;; r1 - NAND_WR_ADDR
96 ;; r2 - reg_gio_rw_pa_dout
97 ;; r3 - reg_gio_r_pa_din
98 ;; r4 - tmp
99 ;; r5 - byte counter within a page
100 ;; r6 - reg_pinmux_rw_pa
101 ;; r7 - reg_gio_rw_pa_oe
102 ;; r8 - reg_bif_core_rw_grp3_cfg
103 ;; r9 - reg_gio_rw_pa_dout shadow
104 move.d 0x90000000, $r0
105 move.d 0x94000000, $r1
106 move.d REG_ADDR(gio, regi_gio, rw_pa_dout), $r2
107 move.d REG_ADDR(gio, regi_gio, r_pa_din), $r3
108 move.d REG_ADDR(pinmux, regi_pinmux, rw_pa), $r6
109 move.d REG_ADDR(gio, regi_gio, rw_pa_oe), $r7
110 move.d REG_ADDR(bif_core, regi_bif_core, rw_grp3_cfg), $r8
111
112#if CONFIG_ETRAX_FLASH_BUSWIDTH==2
113 lsrq 1, $r11
114#endif
115 ;; Set up GPIO
116 move.d [$r2], $r9
117 move.d [$r7], $r4
118 or.b (1<<ALE) | (1 << CLE) | (1<<CE), $r4
119 move.d $r4, [$r7]
120
121 ;; Set up bif
122 move.d [$r8], $r4
123 and.d CSP_MASK, $r4
124 or.d CSP_VAL, $r4
125 move.d $r4, [$r8]
126
1271: ;; Copy one page
128 CLR CE
129 SET CLE
130 moveq READ_CMD, $r4
131 move.b $r4, [$r1]
132 moveq 20, $r4
1332: bne 2b
134 subq 1, $r4
135 CLR CLE
136 SET ALE
137 clear.w [$r1] ; Column address = 0
138 move.d $r11, $r4
139 lsrq 8, $r4
140 move.b $r4, [$r1] ; Row address
141 lsrq 8, $r4
142 move.b $r4, [$r1] ; Row address
143 moveq 20, $r4
1442: bne 2b
145 subq 1, $r4
146 CLR ALE
1472: move.d [$r3], $r4
148 and.d 1 << BY, $r4
149 beq 2b
150 movu.w PAGE_SIZE, $r5
1512: ; Copy one byte/word
152#if CONFIG_ETRAX_FLASH_BUSWIDTH==2
153 move.w [$r0], $r4
154#else
155 move.b [$r0], $r4
156#endif
157 subq 1, $r5
158 bne 2b
159#if CONFIG_ETRAX_FLASH_BUSWIDTH==2
160 move.w $r4, [$r10+]
161 subu.w PAGE_SIZE*2, $r12
162#else
163 move.b $r4, [$r10+]
164 subu.w PAGE_SIZE, $r12
165#endif
166 bpl 1b
167 addu.w PAGE_SIZE, $r11
168
169 ;; End of copy
170 jump $r13
171 nop
172
173 ;; This will warn if the code above is too large. If you consider
174 ;; to remove this you don't understand the bug/feature.
175 .org 256
176 .org ERASE_BLOCK
177
178normal_boot:
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 091ed6192ae..d1f377f5d3b 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -160,7 +160,7 @@ config VT_CONSOLE
160 160
161config HW_CONSOLE 161config HW_CONSOLE
162 bool 162 bool
163 depends on VT && !S390 && !UM 163 depends on VT
164 default y 164 default y
165 165
166comment "Unix98 PTY support" 166comment "Unix98 PTY support"
@@ -195,7 +195,7 @@ config UNIX98_PTYS
195 195
196source "drivers/char/pcmcia/Kconfig" 196source "drivers/char/pcmcia/Kconfig"
197 197
198source "drivers/serial/Kconfig" 198source "drivers/tty/serial/Kconfig"
199 199
200source "drivers/i2c/Kconfig" 200source "drivers/i2c/Kconfig"
201 201
diff --git a/arch/ia64/configs/generic_defconfig b/arch/ia64/configs/generic_defconfig
index 0e5cd1405e0..43ab1cd097a 100644
--- a/arch/ia64/configs/generic_defconfig
+++ b/arch/ia64/configs/generic_defconfig
@@ -234,4 +234,4 @@ CONFIG_CRYPTO_MD5=y
234# CONFIG_CRYPTO_ANSI_CPRNG is not set 234# CONFIG_CRYPTO_ANSI_CPRNG is not set
235CONFIG_CRC_T10DIF=y 235CONFIG_CRC_T10DIF=y
236CONFIG_MISC_DEVICES=y 236CONFIG_MISC_DEVICES=y
237CONFIG_DMAR=y 237CONFIG_INTEL_IOMMU=y
diff --git a/arch/ia64/dig/Makefile b/arch/ia64/dig/Makefile
index 2f7caddf093..ae16ec4f630 100644
--- a/arch/ia64/dig/Makefile
+++ b/arch/ia64/dig/Makefile
@@ -6,7 +6,7 @@
6# 6#
7 7
8obj-y := setup.o 8obj-y := setup.o
9ifeq ($(CONFIG_DMAR), y) 9ifeq ($(CONFIG_INTEL_IOMMU), y)
10obj-$(CONFIG_IA64_GENERIC) += machvec.o machvec_vtd.o 10obj-$(CONFIG_IA64_GENERIC) += machvec.o machvec_vtd.o
11else 11else
12obj-$(CONFIG_IA64_GENERIC) += machvec.o 12obj-$(CONFIG_IA64_GENERIC) += machvec.o
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 80241fe03f5..f5f4ef149aa 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -915,7 +915,7 @@ sba_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt)
915 * @dir: R/W or both. 915 * @dir: R/W or both.
916 * @attrs: optional dma attributes 916 * @attrs: optional dma attributes
917 * 917 *
918 * See Documentation/PCI/PCI-DMA-mapping.txt 918 * See Documentation/DMA-API-HOWTO.txt
919 */ 919 */
920static dma_addr_t sba_map_page(struct device *dev, struct page *page, 920static dma_addr_t sba_map_page(struct device *dev, struct page *page,
921 unsigned long poff, size_t size, 921 unsigned long poff, size_t size,
@@ -1044,7 +1044,7 @@ sba_mark_clean(struct ioc *ioc, dma_addr_t iova, size_t size)
1044 * @dir: R/W or both. 1044 * @dir: R/W or both.
1045 * @attrs: optional dma attributes 1045 * @attrs: optional dma attributes
1046 * 1046 *
1047 * See Documentation/PCI/PCI-DMA-mapping.txt 1047 * See Documentation/DMA-API-HOWTO.txt
1048 */ 1048 */
1049static void sba_unmap_page(struct device *dev, dma_addr_t iova, size_t size, 1049static void sba_unmap_page(struct device *dev, dma_addr_t iova, size_t size,
1050 enum dma_data_direction dir, struct dma_attrs *attrs) 1050 enum dma_data_direction dir, struct dma_attrs *attrs)
@@ -1127,7 +1127,7 @@ void sba_unmap_single_attrs(struct device *dev, dma_addr_t iova, size_t size,
1127 * @size: number of bytes mapped in driver buffer. 1127 * @size: number of bytes mapped in driver buffer.
1128 * @dma_handle: IOVA of new buffer. 1128 * @dma_handle: IOVA of new buffer.
1129 * 1129 *
1130 * See Documentation/PCI/PCI-DMA-mapping.txt 1130 * See Documentation/DMA-API-HOWTO.txt
1131 */ 1131 */
1132static void * 1132static void *
1133sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flags) 1133sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flags)
@@ -1190,7 +1190,7 @@ sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp
1190 * @vaddr: virtual address IOVA of "consistent" buffer. 1190 * @vaddr: virtual address IOVA of "consistent" buffer.
1191 * @dma_handler: IO virtual address of "consistent" buffer. 1191 * @dma_handler: IO virtual address of "consistent" buffer.
1192 * 1192 *
1193 * See Documentation/PCI/PCI-DMA-mapping.txt 1193 * See Documentation/DMA-API-HOWTO.txt
1194 */ 1194 */
1195static void sba_free_coherent (struct device *dev, size_t size, void *vaddr, 1195static void sba_free_coherent (struct device *dev, size_t size, void *vaddr,
1196 dma_addr_t dma_handle) 1196 dma_addr_t dma_handle)
@@ -1453,7 +1453,7 @@ static void sba_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist,
1453 * @dir: R/W or both. 1453 * @dir: R/W or both.
1454 * @attrs: optional dma attributes 1454 * @attrs: optional dma attributes
1455 * 1455 *
1456 * See Documentation/PCI/PCI-DMA-mapping.txt 1456 * See Documentation/DMA-API-HOWTO.txt
1457 */ 1457 */
1458static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist, 1458static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist,
1459 int nents, enum dma_data_direction dir, 1459 int nents, enum dma_data_direction dir,
@@ -1549,7 +1549,7 @@ static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist,
1549 * @dir: R/W or both. 1549 * @dir: R/W or both.
1550 * @attrs: optional dma attributes 1550 * @attrs: optional dma attributes
1551 * 1551 *
1552 * See Documentation/PCI/PCI-DMA-mapping.txt 1552 * See Documentation/DMA-API-HOWTO.txt
1553 */ 1553 */
1554static void sba_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist, 1554static void sba_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist,
1555 int nents, enum dma_data_direction dir, 1555 int nents, enum dma_data_direction dir,
diff --git a/arch/ia64/hp/sim/simeth.c b/arch/ia64/hp/sim/simeth.c
index 7e81966ce48..47afcc61f6e 100644
--- a/arch/ia64/hp/sim/simeth.c
+++ b/arch/ia64/hp/sim/simeth.c
@@ -172,7 +172,7 @@ static const struct net_device_ops simeth_netdev_ops = {
172 .ndo_stop = simeth_close, 172 .ndo_stop = simeth_close,
173 .ndo_start_xmit = simeth_tx, 173 .ndo_start_xmit = simeth_tx,
174 .ndo_get_stats = simeth_get_stats, 174 .ndo_get_stats = simeth_get_stats,
175 .ndo_set_multicast_list = set_multicast_list, /* not yet used */ 175 .ndo_set_rx_mode = set_multicast_list, /* not yet used */
176 176
177}; 177};
178 178
diff --git a/arch/ia64/include/asm/device.h b/arch/ia64/include/asm/device.h
index d66d446b127..d05e78f6db9 100644
--- a/arch/ia64/include/asm/device.h
+++ b/arch/ia64/include/asm/device.h
@@ -10,7 +10,7 @@ struct dev_archdata {
10#ifdef CONFIG_ACPI 10#ifdef CONFIG_ACPI
11 void *acpi_handle; 11 void *acpi_handle;
12#endif 12#endif
13#ifdef CONFIG_DMAR 13#ifdef CONFIG_INTEL_IOMMU
14 void *iommu; /* hook for IOMMU specific extension */ 14 void *iommu; /* hook for IOMMU specific extension */
15#endif 15#endif
16}; 16};
diff --git a/arch/ia64/include/asm/iommu.h b/arch/ia64/include/asm/iommu.h
index 745e095fe82..105c93b00b1 100644
--- a/arch/ia64/include/asm/iommu.h
+++ b/arch/ia64/include/asm/iommu.h
@@ -7,12 +7,14 @@
7 7
8extern void pci_iommu_shutdown(void); 8extern void pci_iommu_shutdown(void);
9extern void no_iommu_init(void); 9extern void no_iommu_init(void);
10#ifdef CONFIG_INTEL_IOMMU
10extern int force_iommu, no_iommu; 11extern int force_iommu, no_iommu;
11extern int iommu_detected;
12#ifdef CONFIG_DMAR
13extern int iommu_pass_through; 12extern int iommu_pass_through;
13extern int iommu_detected;
14#else 14#else
15#define iommu_pass_through (0) 15#define iommu_pass_through (0)
16#define no_iommu (1)
17#define iommu_detected (0)
16#endif 18#endif
17extern void iommu_dma_init(void); 19extern void iommu_dma_init(void);
18extern void machvec_init(const char *name); 20extern void machvec_init(const char *name);
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 73b5f785e70..127dd7be346 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -139,7 +139,7 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
139 return channel ? isa_irq_to_vector(15) : isa_irq_to_vector(14); 139 return channel ? isa_irq_to_vector(15) : isa_irq_to_vector(14);
140} 140}
141 141
142#ifdef CONFIG_DMAR 142#ifdef CONFIG_INTEL_IOMMU
143extern void pci_iommu_alloc(void); 143extern void pci_iommu_alloc(void);
144#endif 144#endif
145#endif /* _ASM_IA64_PCI_H */ 145#endif /* _ASM_IA64_PCI_H */
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index 395c2f216dd..d959c84904b 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -43,7 +43,7 @@ obj-$(CONFIG_IA64_ESI) += esi.o
43ifneq ($(CONFIG_IA64_ESI),) 43ifneq ($(CONFIG_IA64_ESI),)
44obj-y += esi_stub.o # must be in kernel proper 44obj-y += esi_stub.o # must be in kernel proper
45endif 45endif
46obj-$(CONFIG_DMAR) += pci-dma.o 46obj-$(CONFIG_INTEL_IOMMU) += pci-dma.o
47obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o 47obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o
48 48
49obj-$(CONFIG_BINFMT_ELF) += elfcore.o 49obj-$(CONFIG_BINFMT_ELF) += elfcore.o
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 3be485a300b..bfb4d01e0e5 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -88,7 +88,7 @@ acpi_get_sysname(void)
88 struct acpi_table_rsdp *rsdp; 88 struct acpi_table_rsdp *rsdp;
89 struct acpi_table_xsdt *xsdt; 89 struct acpi_table_xsdt *xsdt;
90 struct acpi_table_header *hdr; 90 struct acpi_table_header *hdr;
91#ifdef CONFIG_DMAR 91#ifdef CONFIG_INTEL_IOMMU
92 u64 i, nentries; 92 u64 i, nentries;
93#endif 93#endif
94 94
@@ -125,7 +125,7 @@ acpi_get_sysname(void)
125 return "xen"; 125 return "xen";
126 } 126 }
127 127
128#ifdef CONFIG_DMAR 128#ifdef CONFIG_INTEL_IOMMU
129 /* Look for Intel IOMMU */ 129 /* Look for Intel IOMMU */
130 nentries = (hdr->length - sizeof(*hdr)) / 130 nentries = (hdr->length - sizeof(*hdr)) /
131 sizeof(xsdt->table_offset_entry[0]); 131 sizeof(xsdt->table_offset_entry[0]);
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c
index 009df5434a7..94e0db72d4a 100644
--- a/arch/ia64/kernel/msi_ia64.c
+++ b/arch/ia64/kernel/msi_ia64.c
@@ -131,7 +131,7 @@ void arch_teardown_msi_irq(unsigned int irq)
131 return ia64_teardown_msi_irq(irq); 131 return ia64_teardown_msi_irq(irq);
132} 132}
133 133
134#ifdef CONFIG_DMAR 134#ifdef CONFIG_INTEL_IOMMU
135#ifdef CONFIG_SMP 135#ifdef CONFIG_SMP
136static int dmar_msi_set_affinity(struct irq_data *data, 136static int dmar_msi_set_affinity(struct irq_data *data,
137 const struct cpumask *mask, bool force) 137 const struct cpumask *mask, bool force)
@@ -210,5 +210,5 @@ int arch_setup_dmar_msi(unsigned int irq)
210 "edge"); 210 "edge");
211 return 0; 211 return 0;
212} 212}
213#endif /* CONFIG_DMAR */ 213#endif /* CONFIG_INTEL_IOMMU */
214 214
diff --git a/arch/ia64/kernel/pci-dma.c b/arch/ia64/kernel/pci-dma.c
index f6b1ff0aea7..c16162c7086 100644
--- a/arch/ia64/kernel/pci-dma.c
+++ b/arch/ia64/kernel/pci-dma.c
@@ -14,7 +14,7 @@
14 14
15#include <asm/system.h> 15#include <asm/system.h>
16 16
17#ifdef CONFIG_DMAR 17#ifdef CONFIG_INTEL_IOMMU
18 18
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20 20
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index b92b9445255..6c4e9aaa70c 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -10,6 +10,7 @@ config M32R
10 select HAVE_GENERIC_HARDIRQS 10 select HAVE_GENERIC_HARDIRQS
11 select GENERIC_IRQ_PROBE 11 select GENERIC_IRQ_PROBE
12 select GENERIC_IRQ_SHOW 12 select GENERIC_IRQ_SHOW
13 select GENERIC_ATOMIC64
13 14
14config SBUS 15config SBUS
15 bool 16 bool
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 9e8ee9d2b8c..6c28582fb98 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -21,6 +21,15 @@ config ARCH_HAS_ILOG2_U32
21config ARCH_HAS_ILOG2_U64 21config ARCH_HAS_ILOG2_U64
22 bool 22 bool
23 23
24config GENERIC_CLOCKEVENTS
25 bool
26
27config GENERIC_CMOS_UPDATE
28 def_bool !MMU
29
30config GENERIC_GPIO
31 bool
32
24config GENERIC_HWEIGHT 33config GENERIC_HWEIGHT
25 bool 34 bool
26 default y 35 default y
@@ -29,10 +38,16 @@ config GENERIC_CALIBRATE_DELAY
29 bool 38 bool
30 default y 39 default y
31 40
41config GENERIC_IOMAP
42 def_bool MMU
43
32config TIME_LOW_RES 44config TIME_LOW_RES
33 bool 45 bool
34 default y 46 default y
35 47
48config ARCH_USES_GETTIMEOFFSET
49 def_bool MMU
50
36config NO_IOPORT 51config NO_IOPORT
37 def_bool y 52 def_bool y
38 53
@@ -62,13 +77,31 @@ config MMU
62 Select if you want MMU-based virtualised addressing space 77 Select if you want MMU-based virtualised addressing space
63 support by paged memory management. If unsure, say 'Y'. 78 support by paged memory management. If unsure, say 'Y'.
64 79
65menu "Platform dependent setup" 80config MMU_MOTOROLA
81 bool
82
83config MMU_SUN3
84 bool
85 depends on MMU && !MMU_MOTOROLA
86
87menu "Platform setup"
88
89source arch/m68k/Kconfig.cpu
90
91source arch/m68k/Kconfig.machine
92
93source arch/m68k/Kconfig.bus
94
95endmenu
96
97menu "Kernel Features"
66 98
67if MMU 99if COLDFIRE
68source arch/m68k/Kconfig.mmu 100source "kernel/Kconfig.preempt"
69endif 101endif
70if !MMU 102
71source arch/m68k/Kconfig.nommu 103if !MMU || COLDFIRE
104source "kernel/time/Kconfig"
72endif 105endif
73 106
74source "mm/Kconfig" 107source "mm/Kconfig"
@@ -85,9 +118,9 @@ if !MMU
85menu "Power management options" 118menu "Power management options"
86 119
87config PM 120config PM
88 bool "Power Management support" 121 bool "Power Management support"
89 help 122 help
90 Support processor power management modes 123 Support processor power management modes
91 124
92endmenu 125endmenu
93endif 126endif
@@ -96,151 +129,7 @@ source "net/Kconfig"
96 129
97source "drivers/Kconfig" 130source "drivers/Kconfig"
98 131
99if MMU 132source "arch/m68k/Kconfig.devices"
100
101menu "Character devices"
102
103config ATARI_MFPSER
104 tristate "Atari MFP serial support"
105 depends on ATARI
106 ---help---
107 If you like to use the MFP serial ports ("Modem1", "Serial1") under
108 Linux, say Y. The driver equally supports all kinds of MFP serial
109 ports and automatically detects whether Serial1 is available.
110
111 To compile this driver as a module, choose M here.
112
113 Note for Falcon users: You also have an MFP port, it's just not
114 wired to the outside... But you could use the port under Linux.
115
116config ATARI_MIDI
117 tristate "Atari MIDI serial support"
118 depends on ATARI
119 help
120 If you want to use your Atari's MIDI port in Linux, say Y.
121
122 To compile this driver as a module, choose M here.
123
124config ATARI_DSP56K
125 tristate "Atari DSP56k support (EXPERIMENTAL)"
126 depends on ATARI && EXPERIMENTAL
127 help
128 If you want to be able to use the DSP56001 in Falcons, say Y. This
129 driver is still experimental, and if you don't know what it is, or
130 if you don't have this processor, just say N.
131
132 To compile this driver as a module, choose M here.
133
134config AMIGA_BUILTIN_SERIAL
135 tristate "Amiga builtin serial support"
136 depends on AMIGA
137 help
138 If you want to use your Amiga's built-in serial port in Linux,
139 answer Y.
140
141 To compile this driver as a module, choose M here.
142
143config MULTIFACE_III_TTY
144 tristate "Multiface Card III serial support"
145 depends on AMIGA
146 help
147 If you want to use a Multiface III card's serial port in Linux,
148 answer Y.
149
150 To compile this driver as a module, choose M here.
151
152config GVPIOEXT
153 tristate "GVP IO-Extender support"
154 depends on PARPORT=n && ZORRO
155 help
156 If you want to use a GVP IO-Extender serial card in Linux, say Y.
157 Otherwise, say N.
158
159config GVPIOEXT_LP
160 tristate "GVP IO-Extender parallel printer support"
161 depends on GVPIOEXT
162 help
163 Say Y to enable driving a printer from the parallel port on your
164 GVP IO-Extender card, N otherwise.
165
166config GVPIOEXT_PLIP
167 tristate "GVP IO-Extender PLIP support"
168 depends on GVPIOEXT
169 help
170 Say Y to enable doing IP over the parallel port on your GVP
171 IO-Extender card, N otherwise.
172
173config MAC_HID
174 bool
175 depends on INPUT_ADBHID
176 default y
177
178config HPDCA
179 tristate "HP DCA serial support"
180 depends on DIO && SERIAL_8250
181 help
182 If you want to use the internal "DCA" serial ports on an HP300
183 machine, say Y here.
184
185config HPAPCI
186 tristate "HP APCI serial support"
187 depends on HP300 && SERIAL_8250 && EXPERIMENTAL
188 help
189 If you want to use the internal "APCI" serial ports on an HP400
190 machine, say Y here.
191
192config MVME147_SCC
193 bool "SCC support for MVME147 serial ports"
194 depends on MVME147 && BROKEN
195 help
196 This is the driver for the serial ports on the Motorola MVME147
197 boards. Everyone using one of these boards should say Y here.
198
199config MVME162_SCC
200 bool "SCC support for MVME162 serial ports"
201 depends on MVME16x && BROKEN
202 help
203 This is the driver for the serial ports on the Motorola MVME162 and
204 172 boards. Everyone using one of these boards should say Y here.
205
206config BVME6000_SCC
207 bool "SCC support for BVME6000 serial ports"
208 depends on BVME6000 && BROKEN
209 help
210 This is the driver for the serial ports on the BVME4000 and BVME6000
211 boards from BVM Ltd. Everyone using one of these boards should say
212 Y here.
213
214config DN_SERIAL
215 bool "Support for DN serial port (dummy)"
216 depends on APOLLO
217
218config SERIAL_CONSOLE
219 bool "Support for serial port console"
220 depends on (AMIGA || ATARI || SUN3 || SUN3X || VME || APOLLO) && (ATARI_MFPSER=y || ATARI_MIDI=y || AMIGA_BUILTIN_SERIAL=y || GVPIOEXT=y || MULTIFACE_III_TTY=y || SERIAL=y || MVME147_SCC || SERIAL167 || MVME162_SCC || BVME6000_SCC || DN_SERIAL)
221 ---help---
222 If you say Y here, it will be possible to use a serial port as the
223 system console (the system console is the device which receives all
224 kernel messages and warnings and which allows logins in single user
225 mode). This could be useful if some terminal or printer is connected
226 to that serial port.
227
228 Even if you say Y here, the currently visible virtual console
229 (/dev/tty0) will still be used as the system console by default, but
230 you can alter that using a kernel command line option such as
231 "console=ttyS1". (Try "man bootparam" or see the documentation of
232 your boot loader (lilo or loadlin) about how to pass options to the
233 kernel at boot time.)
234
235 If you don't have a VGA card installed and you say Y here, the
236 kernel will automatically use the first serial line, /dev/ttyS0, as
237 system console.
238
239 If unsure, say N.
240
241endmenu
242
243endif
244 133
245source "fs/Kconfig" 134source "fs/Kconfig"
246 135
diff --git a/arch/m68k/Kconfig.bus b/arch/m68k/Kconfig.bus
new file mode 100644
index 00000000000..8294f0c1785
--- /dev/null
+++ b/arch/m68k/Kconfig.bus
@@ -0,0 +1,55 @@
1if MMU
2
3comment "Bus Support"
4
5config NUBUS
6 bool
7 depends on MAC
8 default y
9
10config ZORRO
11 bool "Amiga Zorro (AutoConfig) bus support"
12 depends on AMIGA
13 help
14 This enables support for the Zorro bus in the Amiga. If you have
15 expansion cards in your Amiga that conform to the Amiga
16 AutoConfig(tm) specification, say Y, otherwise N. Note that even
17 expansion cards that do not fit in the Zorro slots but fit in e.g.
18 the CPU slot may fall in this category, so you have to say Y to let
19 Linux use these.
20
21config AMIGA_PCMCIA
22 bool "Amiga 1200/600 PCMCIA support (EXPERIMENTAL)"
23 depends on AMIGA && EXPERIMENTAL
24 help
25 Include support in the kernel for pcmcia on Amiga 1200 and Amiga
26 600. If you intend to use pcmcia cards say Y; otherwise say N.
27
28config ISA
29 bool
30 depends on Q40 || AMIGA_PCMCIA
31 default y
32 help
33 Find out whether you have ISA slots on your motherboard. ISA is the
34 name of a bus system, i.e. the way the CPU talks to the other stuff
35 inside your box. Other bus systems are PCI, EISA, MicroChannel
36 (MCA) or VESA. ISA is an older system, now being displaced by PCI;
37 newer boards don't support it. If you have ISA, say Y, otherwise N.
38
39config GENERIC_ISA_DMA
40 def_bool ISA
41
42source "drivers/pci/Kconfig"
43
44source "drivers/zorro/Kconfig"
45
46endif
47
48if !MMU
49
50config ISA_DMA_API
51 def_bool !M5272
52
53source "drivers/pcmcia/Kconfig"
54
55endif
diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
new file mode 100644
index 00000000000..e632b2d1210
--- /dev/null
+++ b/arch/m68k/Kconfig.cpu
@@ -0,0 +1,429 @@
1comment "Processor Type"
2
3config M68000
4 bool
5 select CPU_HAS_NO_BITFIELDS
6 help
7 The Freescale (was Motorola) 68000 CPU is the first generation of
8 the well known M68K family of processors. The CPU core as well as
9 being available as a stand alone CPU was also used in many
10 System-On-Chip devices (eg 68328, 68302, etc). It does not contain
11 a paging MMU.
12
13config MCPU32
14 bool
15 select CPU_HAS_NO_BITFIELDS
16 help
17 The Freescale (was then Motorola) CPU32 is a CPU core that is
18 based on the 68020 processor. For the most part it is used in
19 System-On-Chip parts, and does not contain a paging MMU.
20
21config COLDFIRE
22 bool
23 select GENERIC_GPIO
24 select ARCH_REQUIRE_GPIOLIB
25 select CPU_HAS_NO_BITFIELDS
26 help
27 The Freescale ColdFire family of processors is a modern derivitive
28 of the 68000 processor family. They are mainly targeted at embedded
29 applications, and are all System-On-Chip (SOC) devices, as opposed
30 to stand alone CPUs. They implement a subset of the original 68000
31 processor instruction set.
32
33config M68020
34 bool "68020 support"
35 depends on MMU
36 help
37 If you anticipate running this kernel on a computer with a MC68020
38 processor, say Y. Otherwise, say N. Note that the 68020 requires a
39 68851 MMU (Memory Management Unit) to run Linux/m68k, except on the
40 Sun 3, which provides its own version.
41
42config M68030
43 bool "68030 support"
44 depends on MMU && !MMU_SUN3
45 help
46 If you anticipate running this kernel on a computer with a MC68030
47 processor, say Y. Otherwise, say N. Note that a MC68EC030 will not
48 work, as it does not include an MMU (Memory Management Unit).
49
50config M68040
51 bool "68040 support"
52 depends on MMU && !MMU_SUN3
53 help
54 If you anticipate running this kernel on a computer with a MC68LC040
55 or MC68040 processor, say Y. Otherwise, say N. Note that an
56 MC68EC040 will not work, as it does not include an MMU (Memory
57 Management Unit).
58
59config M68060
60 bool "68060 support"
61 depends on MMU && !MMU_SUN3
62 help
63 If you anticipate running this kernel on a computer with a MC68060
64 processor, say Y. Otherwise, say N.
65
66config M68328
67 bool "MC68328"
68 depends on !MMU
69 select M68000
70 help
71 Motorola 68328 processor support.
72
73config M68EZ328
74 bool "MC68EZ328"
75 depends on !MMU
76 select M68000
77 help
78 Motorola 68EX328 processor support.
79
80config M68VZ328
81 bool "MC68VZ328"
82 depends on !MMU
83 select M68000
84 help
85 Motorola 68VZ328 processor support.
86
87config M68360
88 bool "MC68360"
89 depends on !MMU
90 select MCPU32
91 help
92 Motorola 68360 processor support.
93
94config M5206
95 bool "MCF5206"
96 depends on !MMU
97 select COLDFIRE
98 select COLDFIRE_SW_A7
99 select HAVE_MBAR
100 help
101 Motorola ColdFire 5206 processor support.
102
103config M5206e
104 bool "MCF5206e"
105 depends on !MMU
106 select COLDFIRE
107 select COLDFIRE_SW_A7
108 select HAVE_MBAR
109 help
110 Motorola ColdFire 5206e processor support.
111
112config M520x
113 bool "MCF520x"
114 depends on !MMU
115 select COLDFIRE
116 select GENERIC_CLOCKEVENTS
117 select HAVE_CACHE_SPLIT
118 help
119 Freescale Coldfire 5207/5208 processor support.
120
121config M523x
122 bool "MCF523x"
123 depends on !MMU
124 select COLDFIRE
125 select GENERIC_CLOCKEVENTS
126 select HAVE_CACHE_SPLIT
127 select HAVE_IPSBAR
128 help
129 Freescale Coldfire 5230/1/2/4/5 processor support
130
131config M5249
132 bool "MCF5249"
133 depends on !MMU
134 select COLDFIRE
135 select COLDFIRE_SW_A7
136 select HAVE_MBAR
137 help
138 Motorola ColdFire 5249 processor support.
139
140config M527x
141 bool
142
143config M5271
144 bool "MCF5271"
145 depends on !MMU
146 select COLDFIRE
147 select M527x
148 select HAVE_CACHE_SPLIT
149 select HAVE_IPSBAR
150 select GENERIC_CLOCKEVENTS
151 help
152 Freescale (Motorola) ColdFire 5270/5271 processor support.
153
154config M5272
155 bool "MCF5272"
156 depends on !MMU
157 select COLDFIRE
158 select COLDFIRE_SW_A7
159 select HAVE_MBAR
160 help
161 Motorola ColdFire 5272 processor support.
162
163config M5275
164 bool "MCF5275"
165 depends on !MMU
166 select COLDFIRE
167 select M527x
168 select HAVE_CACHE_SPLIT
169 select HAVE_IPSBAR
170 select GENERIC_CLOCKEVENTS
171 help
172 Freescale (Motorola) ColdFire 5274/5275 processor support.
173
174config M528x
175 bool "MCF528x"
176 depends on !MMU
177 select COLDFIRE
178 select GENERIC_CLOCKEVENTS
179 select HAVE_CACHE_SPLIT
180 select HAVE_IPSBAR
181 help
182 Motorola ColdFire 5280/5282 processor support.
183
184config M5307
185 bool "MCF5307"
186 depends on !MMU
187 select COLDFIRE
188 select COLDFIRE_SW_A7
189 select HAVE_CACHE_CB
190 select HAVE_MBAR
191 help
192 Motorola ColdFire 5307 processor support.
193
194config M532x
195 bool "MCF532x"
196 depends on !MMU
197 select COLDFIRE
198 select HAVE_CACHE_CB
199 help
200 Freescale (Motorola) ColdFire 532x processor support.
201
202config M5407
203 bool "MCF5407"
204 depends on !MMU
205 select COLDFIRE
206 select COLDFIRE_SW_A7
207 select HAVE_CACHE_CB
208 select HAVE_MBAR
209 help
210 Motorola ColdFire 5407 processor support.
211
212config M54xx
213 bool
214
215config M547x
216 bool "MCF547x"
217 depends on !MMU
218 select COLDFIRE
219 select M54xx
220 select HAVE_CACHE_CB
221 select HAVE_MBAR
222 help
223 Freescale ColdFire 5470/5471/5472/5473/5474/5475 processor support.
224
225config M548x
226 bool "MCF548x"
227 depends on !MMU
228 select COLDFIRE
229 select M54xx
230 select HAVE_CACHE_CB
231 select HAVE_MBAR
232 help
233 Freescale ColdFire 5480/5481/5482/5483/5484/5485 processor support.
234
235
236comment "Processor Specific Options"
237
238config M68KFPU_EMU
239 bool "Math emulation support (EXPERIMENTAL)"
240 depends on MMU
241 depends on EXPERIMENTAL
242 help
243 At some point in the future, this will cause floating-point math
244 instructions to be emulated by the kernel on machines that lack a
245 floating-point math coprocessor. Thrill-seekers and chronically
246 sleep-deprived psychotic hacker types can say Y now, everyone else
247 should probably wait a while.
248
249config M68KFPU_EMU_EXTRAPREC
250 bool "Math emulation extra precision"
251 depends on M68KFPU_EMU
252 help
253 The fpu uses normally a few bit more during calculations for
254 correct rounding, the emulator can (often) do the same but this
255 extra calculation can cost quite some time, so you can disable
256 it here. The emulator will then "only" calculate with a 64 bit
257 mantissa and round slightly incorrect, what is more than enough
258 for normal usage.
259
260config M68KFPU_EMU_ONLY
261 bool "Math emulation only kernel"
262 depends on M68KFPU_EMU
263 help
264 This option prevents any floating-point instructions from being
265 compiled into the kernel, thereby the kernel doesn't save any
266 floating point context anymore during task switches, so this
267 kernel will only be usable on machines without a floating-point
268 math coprocessor. This makes the kernel a bit faster as no tests
269 needs to be executed whether a floating-point instruction in the
270 kernel should be executed or not.
271
272config ADVANCED
273 bool "Advanced configuration options"
274 depends on MMU
275 ---help---
276 This gives you access to some advanced options for the CPU. The
277 defaults should be fine for most users, but these options may make
278 it possible for you to improve performance somewhat if you know what
279 you are doing.
280
281 Note that the answer to this question won't directly affect the
282 kernel: saying N will just cause the configurator to skip all
283 the questions about these options.
284
285 Most users should say N to this question.
286
287config RMW_INSNS
288 bool "Use read-modify-write instructions"
289 depends on ADVANCED
290 ---help---
291 This allows to use certain instructions that work with indivisible
292 read-modify-write bus cycles. While this is faster than the
293 workaround of disabling interrupts, it can conflict with DMA
294 ( = direct memory access) on many Amiga systems, and it is also said
295 to destabilize other machines. It is very likely that this will
296 cause serious problems on any Amiga or Atari Medusa if set. The only
297 configuration where it should work are 68030-based Ataris, where it
298 apparently improves performance. But you've been warned! Unless you
299 really know what you are doing, say N. Try Y only if you're quite
300 adventurous.
301
302config SINGLE_MEMORY_CHUNK
303 bool "Use one physical chunk of memory only" if ADVANCED && !SUN3
304 depends on MMU
305 default y if SUN3
306 select NEED_MULTIPLE_NODES
307 help
308 Ignore all but the first contiguous chunk of physical memory for VM
309 purposes. This will save a few bytes kernel size and may speed up
310 some operations. Say N if not sure.
311
312config ARCH_DISCONTIGMEM_ENABLE
313 def_bool MMU && !SINGLE_MEMORY_CHUNK
314
315config 060_WRITETHROUGH
316 bool "Use write-through caching for 68060 supervisor accesses"
317 depends on ADVANCED && M68060
318 ---help---
319 The 68060 generally uses copyback caching of recently accessed data.
320 Copyback caching means that memory writes will be held in an on-chip
321 cache and only written back to memory some time later. Saying Y
322 here will force supervisor (kernel) accesses to use writethrough
323 caching. Writethrough caching means that data is written to memory
324 straight away, so that cache and memory data always agree.
325 Writethrough caching is less efficient, but is needed for some
326 drivers on 68060 based systems where the 68060 bus snooping signal
327 is hardwired on. The 53c710 SCSI driver is known to suffer from
328 this problem.
329
330config M68K_L2_CACHE
331 bool
332 depends on MAC
333 default y
334
335config NODES_SHIFT
336 int
337 default "3"
338 depends on !SINGLE_MEMORY_CHUNK
339
340config FPU
341 bool
342
343config COLDFIRE_SW_A7
344 bool
345
346config HAVE_CACHE_SPLIT
347 bool
348
349config HAVE_CACHE_CB
350 bool
351
352config HAVE_MBAR
353 bool
354
355config HAVE_IPSBAR
356 bool
357
358config CLOCK_SET
359 bool "Enable setting the CPU clock frequency"
360 depends on COLDFIRE
361 default n
362 help
363 On some CPU's you do not need to know what the core CPU clock
364 frequency is. On these you can disable clock setting. On some
365 traditional 68K parts, and on all ColdFire parts you need to set
366 the appropriate CPU clock frequency. On these devices many of the
367 onboard peripherals derive their timing from the master CPU clock
368 frequency.
369
370config CLOCK_FREQ
371 int "Set the core clock frequency"
372 default "66666666"
373 depends on CLOCK_SET
374 help
375 Define the CPU clock frequency in use. This is the core clock
376 frequency, it may or may not be the same as the external clock
377 crystal fitted to your board. Some processors have an internal
378 PLL and can have their frequency programmed at run time, others
379 use internal dividers. In general the kernel won't setup a PLL
380 if it is fitted (there are some exceptions). This value will be
381 specific to the exact CPU that you are using.
382
383config OLDMASK
384 bool "Old mask 5307 (1H55J) silicon"
385 depends on M5307
386 help
387 Build support for the older revision ColdFire 5307 silicon.
388 Specifically this is the 1H55J mask revision.
389
390if HAVE_CACHE_SPLIT
391choice
392 prompt "Split Cache Configuration"
393 default CACHE_I
394
395config CACHE_I
396 bool "Instruction"
397 help
398 Use all of the ColdFire CPU cache memory as an instruction cache.
399
400config CACHE_D
401 bool "Data"
402 help
403 Use all of the ColdFire CPU cache memory as a data cache.
404
405config CACHE_BOTH
406 bool "Both"
407 help
408 Split the ColdFire CPU cache, and use half as an instruction cache
409 and half as a data cache.
410endchoice
411endif
412
413if HAVE_CACHE_CB
414choice
415 prompt "Data cache mode"
416 default CACHE_WRITETHRU
417
418config CACHE_WRITETHRU
419 bool "Write-through"
420 help
421 The ColdFire CPU cache is set into Write-through mode.
422
423config CACHE_COPYBACK
424 bool "Copy-back"
425 help
426 The ColdFire CPU cache is set into Copy-back mode.
427endchoice
428endif
429
diff --git a/arch/m68k/Kconfig.devices b/arch/m68k/Kconfig.devices
new file mode 100644
index 00000000000..d214034be6a
--- /dev/null
+++ b/arch/m68k/Kconfig.devices
@@ -0,0 +1,123 @@
1if MMU
2
3config ARCH_MAY_HAVE_PC_FDC
4 bool
5 depends on BROKEN && (Q40 || SUN3X)
6 default y
7
8menu "Platform devices"
9
10config HEARTBEAT
11 bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || MAC ||Q40
12 default y if !AMIGA && !APOLLO && !ATARI && !MAC && !Q40 && HP300
13 help
14 Use the power-on LED on your machine as a load meter. The exact
15 behavior is platform-dependent, but normally the flash frequency is
16 a hyperbolic function of the 5-minute load average.
17
18# We have a dedicated heartbeat LED. :-)
19config PROC_HARDWARE
20 bool "/proc/hardware support"
21 help
22 Say Y here to support the /proc/hardware file, which gives you
23 access to information about the machine you're running on,
24 including the model, CPU, MMU, clock speed, BogoMIPS rating,
25 and memory size.
26
27endmenu
28
29menu "Character devices"
30
31config ATARI_MFPSER
32 tristate "Atari MFP serial support"
33 depends on ATARI
34 ---help---
35 If you like to use the MFP serial ports ("Modem1", "Serial1") under
36 Linux, say Y. The driver equally supports all kinds of MFP serial
37 ports and automatically detects whether Serial1 is available.
38
39 To compile this driver as a module, choose M here.
40
41 Note for Falcon users: You also have an MFP port, it's just not
42 wired to the outside... But you could use the port under Linux.
43
44config ATARI_MIDI
45 tristate "Atari MIDI serial support"
46 depends on ATARI
47 help
48 If you want to use your Atari's MIDI port in Linux, say Y.
49
50 To compile this driver as a module, choose M here.
51
52config ATARI_DSP56K
53 tristate "Atari DSP56k support (EXPERIMENTAL)"
54 depends on ATARI && EXPERIMENTAL
55 help
56 If you want to be able to use the DSP56001 in Falcons, say Y. This
57 driver is still experimental, and if you don't know what it is, or
58 if you don't have this processor, just say N.
59
60 To compile this driver as a module, choose M here.
61
62config AMIGA_BUILTIN_SERIAL
63 tristate "Amiga builtin serial support"
64 depends on AMIGA
65 help
66 If you want to use your Amiga's built-in serial port in Linux,
67 answer Y.
68
69 To compile this driver as a module, choose M here.
70
71config MULTIFACE_III_TTY
72 tristate "Multiface Card III serial support"
73 depends on AMIGA
74 help
75 If you want to use a Multiface III card's serial port in Linux,
76 answer Y.
77
78 To compile this driver as a module, choose M here.
79
80config HPDCA
81 tristate "HP DCA serial support"
82 depends on DIO && SERIAL_8250
83 help
84 If you want to use the internal "DCA" serial ports on an HP300
85 machine, say Y here.
86
87config HPAPCI
88 tristate "HP APCI serial support"
89 depends on HP300 && SERIAL_8250 && EXPERIMENTAL
90 help
91 If you want to use the internal "APCI" serial ports on an HP400
92 machine, say Y here.
93
94config DN_SERIAL
95 bool "Support for DN serial port (dummy)"
96 depends on APOLLO
97
98config SERIAL_CONSOLE
99 bool "Support for serial port console"
100 depends on (AMIGA || ATARI || SUN3 || SUN3X || VME || APOLLO) && (ATARI_MFPSER=y || ATARI_MIDI=y || AMIGA_BUILTIN_SERIAL=y || MULTIFACE_III_TTY=y || SERIAL=y || SERIAL167 || DN_SERIAL)
101 ---help---
102 If you say Y here, it will be possible to use a serial port as the
103 system console (the system console is the device which receives all
104 kernel messages and warnings and which allows logins in single user
105 mode). This could be useful if some terminal or printer is connected
106 to that serial port.
107
108 Even if you say Y here, the currently visible virtual console
109 (/dev/tty0) will still be used as the system console by default, but
110 you can alter that using a kernel command line option such as
111 "console=ttyS1". (Try "man bootparam" or see the documentation of
112 your boot loader (lilo or loadlin) about how to pass options to the
113 kernel at boot time.)
114
115 If you don't have a VGA card installed and you say Y here, the
116 kernel will automatically use the first serial line, /dev/ttyS0, as
117 system console.
118
119 If unsure, say N.
120
121endmenu
122
123endif
diff --git a/arch/m68k/Kconfig.nommu b/arch/m68k/Kconfig.machine
index ff46383112a..ef4a26aff78 100644
--- a/arch/m68k/Kconfig.nommu
+++ b/arch/m68k/Kconfig.machine
@@ -1,297 +1,142 @@
1config FPU 1comment "Machine Types"
2 bool 2
3 default n 3config AMIGA
4 4 bool "Amiga support"
5config GENERIC_GPIO 5 depends on MMU
6 bool 6 select MMU_MOTOROLA if MMU
7 default n 7 help
8 8 This option enables support for the Amiga series of computers. If
9config GENERIC_CMOS_UPDATE 9 you plan to use this kernel on an Amiga, say Y here and browse the
10 bool 10 material available in <file:Documentation/m68k>; otherwise say N.
11 default y 11
12 12config ATARI
13config GENERIC_CLOCKEVENTS 13 bool "Atari support"
14 bool 14 depends on MMU
15 default n 15 select MMU_MOTOROLA if MMU
16 16 help
17config M68000 17 This option enables support for the 68000-based Atari series of
18 bool 18 computers (including the TT, Falcon and Medusa). If you plan to use
19 select CPU_HAS_NO_BITFIELDS 19 this kernel on an Atari, say Y here and browse the material
20 help 20 available in <file:Documentation/m68k>; otherwise say N.
21 The Freescale (was Motorola) 68000 CPU is the first generation of 21
22 the well known M68K family of processors. The CPU core as well as 22config MAC
23 being available as a stand alone CPU was also used in many 23 bool "Macintosh support"
24 System-On-Chip devices (eg 68328, 68302, etc). It does not contain 24 depends on MMU
25 a paging MMU. 25 select MMU_MOTOROLA if MMU
26 26 help
27config MCPU32 27 This option enables support for the Apple Macintosh series of
28 bool 28 computers (yes, there is experimental support now, at least for part
29 select CPU_HAS_NO_BITFIELDS 29 of the series).
30 help 30
31 The Freescale (was then Motorola) CPU32 is a CPU core that is 31 Say N unless you're willing to code the remaining necessary support.
32 based on the 68020 processor. For the most part it is used in 32 ;)
33 System-On-Chip parts, and does not contain a paging MMU. 33
34 34config APOLLO
35config COLDFIRE 35 bool "Apollo support"
36 bool 36 depends on MMU
37 select GENERIC_GPIO 37 select MMU_MOTOROLA if MMU
38 select ARCH_REQUIRE_GPIOLIB 38 help
39 select CPU_HAS_NO_BITFIELDS 39 Say Y here if you want to run Linux on an MC680x0-based Apollo
40 help 40 Domain workstation such as the DN3500.
41 The Freescale ColdFire family of processors is a modern derivitive 41
42 of the 68000 processor family. They are mainly targeted at embedded 42config VME
43 applications, and are all System-On-Chip (SOC) devices, as opposed 43 bool "VME (Motorola and BVM) support"
44 to stand alone CPUs. They implement a subset of the original 68000 44 depends on MMU
45 processor instruction set. 45 select MMU_MOTOROLA if MMU
46 46 help
47config COLDFIRE_SW_A7 47 Say Y here if you want to build a kernel for a 680x0 based VME
48 bool 48 board. Boards currently supported include Motorola boards MVME147,
49 default n 49 MVME162, MVME166, MVME167, MVME172, and MVME177. BVME4000 and
50 50 BVME6000 boards from BVM Ltd are also supported.
51config HAVE_CACHE_SPLIT 51
52 bool 52config MVME147
53 53 bool "MVME147 support"
54config HAVE_CACHE_CB 54 depends on MMU
55 bool 55 depends on VME
56 56 help
57config HAVE_MBAR 57 Say Y to include support for early Motorola VME boards. This will
58 bool 58 build a kernel which can run on MVME147 single-board computers. If
59 59 you select this option you will have to select the appropriate
60config HAVE_IPSBAR 60 drivers for SCSI, Ethernet and serial ports later on.
61 bool 61
62 62config MVME16x
63choice 63 bool "MVME162, 166 and 167 support"
64 prompt "CPU" 64 depends on MMU
65 default M68EZ328 65 depends on VME
66 66 help
67config M68328 67 Say Y to include support for Motorola VME boards. This will build a
68 bool "MC68328" 68 kernel which can run on MVME162, MVME166, MVME167, MVME172, and
69 select M68000 69 MVME177 boards. If you select this option you will have to select
70 help 70 the appropriate drivers for SCSI, Ethernet and serial ports later
71 Motorola 68328 processor support. 71 on.
72 72
73config M68EZ328 73config BVME6000
74 bool "MC68EZ328" 74 bool "BVME4000 and BVME6000 support"
75 select M68000 75 depends on MMU
76 help 76 depends on VME
77 Motorola 68EX328 processor support. 77 help
78 78 Say Y to include support for VME boards from BVM Ltd. This will
79config M68VZ328 79 build a kernel which can run on BVME4000 and BVME6000 boards. If
80 bool "MC68VZ328" 80 you select this option you will have to select the appropriate
81 select M68000 81 drivers for SCSI, Ethernet and serial ports later on.
82 help 82
83 Motorola 68VZ328 processor support. 83config HP300
84 84 bool "HP9000/300 and HP9000/400 support"
85config M68360 85 depends on MMU
86 bool "MC68360" 86 select MMU_MOTOROLA if MMU
87 select MCPU32 87 help
88 help 88 This option enables support for the HP9000/300 and HP9000/400 series
89 Motorola 68360 processor support. 89 of workstations. Support for these machines is still somewhat
90 90 experimental. If you plan to try to use the kernel on such a machine
91config M5206 91 say Y here.
92 bool "MCF5206" 92 Everybody else says N.
93 select COLDFIRE 93
94 select COLDFIRE_SW_A7 94config SUN3X
95 select HAVE_MBAR 95 bool "Sun3x support"
96 help 96 depends on MMU
97 Motorola ColdFire 5206 processor support. 97 select MMU_MOTOROLA if MMU
98 select M68030
99 help
100 This option enables support for the Sun 3x series of workstations.
101 Be warned that this support is very experimental.
102 Note that Sun 3x kernels are not compatible with Sun 3 hardware.
103 General Linux information on the Sun 3x series (now discontinued)
104 is at <http://www.angelfire.com/ca2/tech68k/sun3.html>.
105
106 If you don't want to compile a kernel for a Sun 3x, say N.
107
108config Q40
109 bool "Q40/Q60 support"
110 depends on MMU
111 select MMU_MOTOROLA if MMU
112 help
113 The Q40 is a Motorola 68040-based successor to the Sinclair QL
114 manufactured in Germany. There is an official Q40 home page at
115 <http://www.q40.de/>. This option enables support for the Q40 and
116 Q60. Select your CPU below. For 68LC060 don't forget to enable FPU
117 emulation.
118
119config SUN3
120 bool "Sun3 support"
121 depends on MMU
122 depends on !MMU_MOTOROLA
123 select MMU_SUN3 if MMU
124 select M68020
125 help
126 This option enables support for the Sun 3 series of workstations
127 (3/50, 3/60, 3/1xx, 3/2xx systems). Enabling this option requires
128 that all other hardware types must be disabled, as Sun 3 kernels
129 are incompatible with all other m68k targets (including Sun 3x!).
130
131 If you don't want to compile a kernel exclusively for a Sun 3, say N.
98 132
99config M5206e 133config PILOT
100 bool "MCF5206e"
101 select COLDFIRE
102 select COLDFIRE_SW_A7
103 select HAVE_MBAR
104 help
105 Motorola ColdFire 5206e processor support.
106
107config M520x
108 bool "MCF520x"
109 select COLDFIRE
110 select GENERIC_CLOCKEVENTS
111 select HAVE_CACHE_SPLIT
112 help
113 Freescale Coldfire 5207/5208 processor support.
114
115config M523x
116 bool "MCF523x"
117 select COLDFIRE
118 select GENERIC_CLOCKEVENTS
119 select HAVE_CACHE_SPLIT
120 select HAVE_IPSBAR
121 help
122 Freescale Coldfire 5230/1/2/4/5 processor support
123
124config M5249
125 bool "MCF5249"
126 select COLDFIRE
127 select COLDFIRE_SW_A7
128 select HAVE_MBAR
129 help
130 Motorola ColdFire 5249 processor support.
131
132config M5271
133 bool "MCF5271"
134 select COLDFIRE
135 select HAVE_CACHE_SPLIT
136 select HAVE_IPSBAR
137 help
138 Freescale (Motorola) ColdFire 5270/5271 processor support.
139
140config M5272
141 bool "MCF5272"
142 select COLDFIRE
143 select COLDFIRE_SW_A7
144 select HAVE_MBAR
145 help
146 Motorola ColdFire 5272 processor support.
147
148config M5275
149 bool "MCF5275"
150 select COLDFIRE
151 select HAVE_CACHE_SPLIT
152 select HAVE_IPSBAR
153 help
154 Freescale (Motorola) ColdFire 5274/5275 processor support.
155
156config M528x
157 bool "MCF528x"
158 select COLDFIRE
159 select GENERIC_CLOCKEVENTS
160 select HAVE_CACHE_SPLIT
161 select HAVE_IPSBAR
162 help
163 Motorola ColdFire 5280/5282 processor support.
164
165config M5307
166 bool "MCF5307"
167 select COLDFIRE
168 select COLDFIRE_SW_A7
169 select HAVE_CACHE_CB
170 select HAVE_MBAR
171 help
172 Motorola ColdFire 5307 processor support.
173
174config M532x
175 bool "MCF532x"
176 select COLDFIRE
177 select HAVE_CACHE_CB
178 help
179 Freescale (Motorola) ColdFire 532x processor support.
180
181config M5407
182 bool "MCF5407"
183 select COLDFIRE
184 select COLDFIRE_SW_A7
185 select HAVE_CACHE_CB
186 select HAVE_MBAR
187 help
188 Motorola ColdFire 5407 processor support.
189
190config M547x
191 bool "MCF547x"
192 select COLDFIRE
193 select HAVE_CACHE_CB
194 select HAVE_MBAR
195 help
196 Freescale ColdFire 5470/5471/5472/5473/5474/5475 processor support.
197
198config M548x
199 bool "MCF548x"
200 select COLDFIRE
201 select HAVE_CACHE_CB
202 select HAVE_MBAR
203 help
204 Freescale ColdFire 5480/5481/5482/5483/5484/5485 processor support.
205
206endchoice
207
208config M527x
209 bool
210 depends on (M5271 || M5275)
211 select GENERIC_CLOCKEVENTS
212 default y
213
214config M54xx
215 bool 134 bool
216 depends on (M548x || M547x)
217 default y
218
219config CLOCK_SET
220 bool "Enable setting the CPU clock frequency"
221 default n
222 help
223 On some CPU's you do not need to know what the core CPU clock
224 frequency is. On these you can disable clock setting. On some
225 traditional 68K parts, and on all ColdFire parts you need to set
226 the appropriate CPU clock frequency. On these devices many of the
227 onboard peripherals derive their timing from the master CPU clock
228 frequency.
229
230config CLOCK_FREQ
231 int "Set the core clock frequency"
232 default "66666666"
233 depends on CLOCK_SET
234 help
235 Define the CPU clock frequency in use. This is the core clock
236 frequency, it may or may not be the same as the external clock
237 crystal fitted to your board. Some processors have an internal
238 PLL and can have their frequency programmed at run time, others
239 use internal dividers. In general the kernel won't setup a PLL
240 if it is fitted (there are some exceptions). This value will be
241 specific to the exact CPU that you are using.
242
243config OLDMASK
244 bool "Old mask 5307 (1H55J) silicon"
245 depends on M5307
246 help
247 Build support for the older revision ColdFire 5307 silicon.
248 Specifically this is the 1H55J mask revision.
249
250if HAVE_CACHE_SPLIT
251choice
252 prompt "Split Cache Configuration"
253 default CACHE_I
254
255config CACHE_I
256 bool "Instruction"
257 help
258 Use all of the ColdFire CPU cache memory as an instruction cache.
259
260config CACHE_D
261 bool "Data"
262 help
263 Use all of the ColdFire CPU cache memory as a data cache.
264
265config CACHE_BOTH
266 bool "Both"
267 help
268 Split the ColdFire CPU cache, and use half as an instruction cache
269 and half as a data cache.
270endchoice
271endif
272
273if HAVE_CACHE_CB
274choice
275 prompt "Data cache mode"
276 default CACHE_WRITETHRU
277
278config CACHE_WRITETHRU
279 bool "Write-through"
280 help
281 The ColdFire CPU cache is set into Write-through mode.
282
283config CACHE_COPYBACK
284 bool "Copy-back"
285 help
286 The ColdFire CPU cache is set into Copy-back mode.
287endchoice
288endif
289
290comment "Platform"
291 135
292config PILOT3 136config PILOT3
293 bool "Pilot 1000/5000, PalmPilot Personal/Pro, or PalmIII support" 137 bool "Pilot 1000/5000, PalmPilot Personal/Pro, or PalmIII support"
294 depends on M68328 138 depends on M68328
139 select PILOT
295 help 140 help
296 Support for the Palm Pilot 1000/5000, Personal/Pro and PalmIII. 141 Support for the Palm Pilot 1000/5000, Personal/Pro and PalmIII.
297 142
@@ -302,7 +147,7 @@ config XCOPILOT_BUGS
302 Support the bugs of Xcopilot. 147 Support the bugs of Xcopilot.
303 148
304config UC5272 149config UC5272
305 bool 'Arcturus Networks uC5272 dimm board support' 150 bool "Arcturus Networks uC5272 dimm board support"
306 depends on M5272 151 depends on M5272
307 help 152 help
308 Support for the Arcturus Networks uC5272 dimm board. 153 Support for the Arcturus Networks uC5272 dimm board.
@@ -356,15 +201,23 @@ config UCQUICC
356 help 201 help
357 Support for the Lineo uCquicc board. 202 Support for the Lineo uCquicc board.
358 203
204config ARNEWSH
205 bool
206
359config ARN5206 207config ARN5206
360 bool "Arnewsh 5206 board support" 208 bool "Arnewsh 5206 board support"
361 depends on M5206 209 depends on M5206
210 select ARNEWSH
362 help 211 help
363 Support for the Arnewsh 5206 board. 212 Support for the Arnewsh 5206 board.
364 213
214config FREESCALE
215 bool
216
365config M5206eC3 217config M5206eC3
366 bool "Motorola M5206eC3 board support" 218 bool "Motorola M5206eC3 board support"
367 depends on M5206e 219 depends on M5206e
220 select FREESCALE
368 help 221 help
369 Support for the Motorola M5206eC3 board. 222 Support for the Motorola M5206eC3 board.
370 223
@@ -377,75 +230,92 @@ config ELITE
377config M5208EVB 230config M5208EVB
378 bool "Freescale M5208EVB board support" 231 bool "Freescale M5208EVB board support"
379 depends on M520x 232 depends on M520x
233 select FREESCALE
380 help 234 help
381 Support for the Freescale Coldfire M5208EVB. 235 Support for the Freescale Coldfire M5208EVB.
382 236
383config M5235EVB 237config M5235EVB
384 bool "Freescale M5235EVB support" 238 bool "Freescale M5235EVB support"
385 depends on M523x 239 depends on M523x
240 select FREESCALE
386 help 241 help
387 Support for the Freescale M5235EVB board. 242 Support for the Freescale M5235EVB board.
388 243
389config M5249C3 244config M5249C3
390 bool "Motorola M5249C3 board support" 245 bool "Motorola M5249C3 board support"
391 depends on M5249 246 depends on M5249
247 select FREESCALE
392 help 248 help
393 Support for the Motorola M5249C3 board. 249 Support for the Motorola M5249C3 board.
394 250
395config M5271EVB 251config M5271EVB
396 bool "Freescale (Motorola) M5271EVB board support" 252 bool "Freescale (Motorola) M5271EVB board support"
397 depends on M5271 253 depends on M5271
254 select FREESCALE
398 help 255 help
399 Support for the Freescale (Motorola) M5271EVB board. 256 Support for the Freescale (Motorola) M5271EVB board.
400 257
401config M5275EVB 258config M5275EVB
402 bool "Freescale (Motorola) M5275EVB board support" 259 bool "Freescale (Motorola) M5275EVB board support"
403 depends on M5275 260 depends on M5275
261 select FREESCALE
404 help 262 help
405 Support for the Freescale (Motorola) M5275EVB board. 263 Support for the Freescale (Motorola) M5275EVB board.
406 264
407config M5272C3 265config M5272C3
408 bool "Motorola M5272C3 board support" 266 bool "Motorola M5272C3 board support"
409 depends on M5272 267 depends on M5272
268 select FREESCALE
410 help 269 help
411 Support for the Motorola M5272C3 board. 270 Support for the Motorola M5272C3 board.
412 271
272config senTec
273 bool
274
413config COBRA5272 275config COBRA5272
414 bool "senTec COBRA5272 board support" 276 bool "senTec COBRA5272 board support"
415 depends on M5272 277 depends on M5272
278 select senTec
416 help 279 help
417 Support for the senTec COBRA5272 board. 280 Support for the senTec COBRA5272 board.
418 281
282config AVNET
283 bool
284
419config AVNET5282 285config AVNET5282
420 bool "Avnet 5282 board support" 286 bool "Avnet 5282 board support"
421 depends on M528x 287 depends on M528x
288 select AVNET
422 help 289 help
423 Support for the Avnet 5282 board. 290 Support for the Avnet 5282 board.
424 291
425config M5282EVB 292config M5282EVB
426 bool "Motorola M5282EVB board support" 293 bool "Motorola M5282EVB board support"
427 depends on M528x 294 depends on M528x
295 select FREESCALE
428 help 296 help
429 Support for the Motorola M5282EVB board. 297 Support for the Motorola M5282EVB board.
430 298
431config COBRA5282 299config COBRA5282
432 bool "senTec COBRA5282 board support" 300 bool "senTec COBRA5282 board support"
433 depends on M528x 301 depends on M528x
302 select senTec
434 help 303 help
435 Support for the senTec COBRA5282 board. 304 Support for the senTec COBRA5282 board.
436 305
437config SOM5282EM 306config SOM5282EM
438 bool "EMAC.Inc SOM5282EM board support" 307 bool "EMAC.Inc SOM5282EM board support"
439 depends on M528x 308 depends on M528x
309 select EMAC_INC
440 help 310 help
441 Support for the EMAC.Inc SOM5282EM module. 311 Support for the EMAC.Inc SOM5282EM module.
442 312
443config WILDFIRE 313config WILDFIRE
444 bool "Intec Automation Inc. WildFire board support" 314 bool "Intec Automation Inc. WildFire board support"
445 depends on M528x 315 depends on M528x
446 help 316 help
447 Support for the Intec Automation Inc. WildFire. 317 Support for the Intec Automation Inc. WildFire.
448 318
449config WILDFIREMOD 319config WILDFIREMOD
450 bool "Intec Automation Inc. WildFire module support" 320 bool "Intec Automation Inc. WildFire module support"
451 depends on M528x 321 depends on M528x
@@ -455,12 +325,14 @@ config WILDFIREMOD
455config ARN5307 325config ARN5307
456 bool "Arnewsh 5307 board support" 326 bool "Arnewsh 5307 board support"
457 depends on M5307 327 depends on M5307
328 select ARNEWSH
458 help 329 help
459 Support for the Arnewsh 5307 board. 330 Support for the Arnewsh 5307 board.
460 331
461config M5307C3 332config M5307C3
462 bool "Motorola M5307C3 board support" 333 bool "Motorola M5307C3 board support"
463 depends on M5307 334 depends on M5307
335 select FREESCALE
464 help 336 help
465 Support for the Motorola M5307C3 board. 337 Support for the Motorola M5307C3 board.
466 338
@@ -473,6 +345,7 @@ config SECUREEDGEMP3
473config M5329EVB 345config M5329EVB
474 bool "Freescale (Motorola) M5329EVB board support" 346 bool "Freescale (Motorola) M5329EVB board support"
475 depends on M532x 347 depends on M532x
348 select FREESCALE
476 help 349 help
477 Support for the Freescale (Motorola) M5329EVB board. 350 Support for the Freescale (Motorola) M5329EVB board.
478 351
@@ -485,6 +358,7 @@ config COBRA5329
485config M5407C3 358config M5407C3
486 bool "Motorola M5407C3 board support" 359 bool "Motorola M5407C3 board support"
487 depends on M5407 360 depends on M5407
361 select FREESCALE
488 help 362 help
489 Support for the Motorola M5407C3 board. 363 Support for the Motorola M5407C3 board.
490 364
@@ -524,9 +398,13 @@ config SNAPGEAR
524 help 398 help
525 Special additional support for SnapGear router boards. 399 Special additional support for SnapGear router boards.
526 400
401config SNEHA
402 bool
403
527config CPU16B 404config CPU16B
528 bool "Sneha Technologies S.L. Sarasvati board support" 405 bool "Sneha Technologies S.L. Sarasvati board support"
529 depends on M5272 406 depends on M5272
407 select SNEHA
530 help 408 help
531 Support for the SNEHA CPU16B board. 409 Support for the SNEHA CPU16B board.
532 410
@@ -536,63 +414,20 @@ config MOD5272
536 help 414 help
537 Support for the Netburner MOD-5272 board. 415 Support for the Netburner MOD-5272 board.
538 416
417config SAVANT
418 bool
419
539config SAVANTrosie1 420config SAVANTrosie1
540 bool "Savant Rosie1 board support" 421 bool "Savant Rosie1 board support"
541 depends on M523x 422 depends on M523x
423 select SAVANT
542 help 424 help
543 Support for the Savant Rosie1 board. 425 Support for the Savant Rosie1 board.
544 426
545config ROMFS_FROM_ROM
546 bool "ROMFS image not RAM resident"
547 depends on (NETtel || SNAPGEAR)
548 help
549 The ROMfs filesystem will stay resident in the FLASH/ROM, not be
550 moved into RAM.
551
552config PILOT
553 bool
554 default y
555 depends on (PILOT3 || PILOT5)
556
557config ARNEWSH
558 bool
559 default y
560 depends on (ARN5206 || ARN5307)
561
562config FREESCALE
563 bool
564 default y
565 depends on (M5206eC3 || M5208EVB || M5235EVB || M5249C3 || M5271EVB || M5272C3 || M5275EVB || M5282EVB || M5307C3 || M5329EVB || M5407C3)
566
567config HW_FEITH
568 bool
569 default y
570 depends on (CLEOPATRA || CANCam || SCALES)
571
572config senTec
573 bool
574 default y
575 depends on (COBRA5272 || COBRA5282)
576
577config EMAC_INC
578 bool
579 default y
580 depends on (SOM5282EM)
581 427
582config SNEHA 428if !MMU || COLDFIRE
583 bool
584 default y
585 depends on CPU16B
586 429
587config SAVANT 430comment "Machine Options"
588 bool
589 default y
590 depends on SAVANTrosie1
591
592config AVNET
593 bool
594 default y
595 depends on (AVNET5282)
596 431
597config UBOOT 432config UBOOT
598 bool "Support for U-Boot command line parameters" 433 bool "Support for U-Boot command line parameters"
@@ -673,33 +508,6 @@ config KERNELBASE
673 a system with the RAM based at address 0, and leaving enough room 508 a system with the RAM based at address 0, and leaving enough room
674 for the theoretical maximum number of 256 vectors. 509 for the theoretical maximum number of 256 vectors.
675 510
676choice
677 prompt "RAM bus width"
678 default RAMAUTOBIT
679
680config RAMAUTOBIT
681 bool "AUTO"
682 help
683 Select the physical RAM data bus size. Not needed on most platforms,
684 so you can generally choose AUTO.
685
686config RAM8BIT
687 bool "8bit"
688 help
689 Configure RAM bus to be 8 bits wide.
690
691config RAM16BIT
692 bool "16bit"
693 help
694 Configure RAM bus to be 16 bits wide.
695
696config RAM32BIT
697 bool "32bit"
698 help
699 Configure RAM bus to be 32 bits wide.
700
701endchoice
702
703comment "ROM configuration" 511comment "ROM configuration"
704 512
705config ROM 513config ROM
@@ -772,16 +580,4 @@ config ROMKERNEL
772 580
773endchoice 581endchoice
774 582
775if COLDFIRE
776source "kernel/Kconfig.preempt"
777endif 583endif
778
779source "kernel/time/Kconfig"
780
781config ISA_DMA_API
782 bool
783 depends on !M5272
784 default y
785
786source "drivers/pcmcia/Kconfig"
787
diff --git a/arch/m68k/Kconfig.mmu b/arch/m68k/Kconfig.mmu
deleted file mode 100644
index 13e20bbc407..00000000000
--- a/arch/m68k/Kconfig.mmu
+++ /dev/null
@@ -1,411 +0,0 @@
1config GENERIC_IOMAP
2 bool
3 default y
4
5config ARCH_MAY_HAVE_PC_FDC
6 bool
7 depends on BROKEN && (Q40 || SUN3X)
8 default y
9
10config ARCH_USES_GETTIMEOFFSET
11 def_bool y
12
13config EISA
14 bool
15 ---help---
16 The Extended Industry Standard Architecture (EISA) bus was
17 developed as an open alternative to the IBM MicroChannel bus.
18
19 The EISA bus provided some of the features of the IBM MicroChannel
20 bus while maintaining backward compatibility with cards made for
21 the older ISA bus. The EISA bus saw limited use between 1988 and
22 1995 when it was made obsolete by the PCI bus.
23
24 Say Y here if you are building a kernel for an EISA-based machine.
25
26 Otherwise, say N.
27
28config MCA
29 bool
30 help
31 MicroChannel Architecture is found in some IBM PS/2 machines and
32 laptops. It is a bus system similar to PCI or ISA. See
33 <file:Documentation/mca.txt> (and especially the web page given
34 there) before attempting to build an MCA bus kernel.
35
36config PCMCIA
37 tristate
38 ---help---
39 Say Y here if you want to attach PCMCIA- or PC-cards to your Linux
40 computer. These are credit-card size devices such as network cards,
41 modems or hard drives often used with laptops computers. There are
42 actually two varieties of these cards: the older 16 bit PCMCIA cards
43 and the newer 32 bit CardBus cards. If you want to use CardBus
44 cards, you need to say Y here and also to "CardBus support" below.
45
46 To use your PC-cards, you will need supporting software from David
47 Hinds' pcmcia-cs package (see the file <file:Documentation/Changes>
48 for location). Please also read the PCMCIA-HOWTO, available from
49 <http://www.tldp.org/docs.html#howto>.
50
51 To compile this driver as modules, choose M here: the
52 modules will be called pcmcia_core and ds.
53
54config AMIGA
55 bool "Amiga support"
56 select MMU_MOTOROLA if MMU
57 help
58 This option enables support for the Amiga series of computers. If
59 you plan to use this kernel on an Amiga, say Y here and browse the
60 material available in <file:Documentation/m68k>; otherwise say N.
61
62config ATARI
63 bool "Atari support"
64 select MMU_MOTOROLA if MMU
65 help
66 This option enables support for the 68000-based Atari series of
67 computers (including the TT, Falcon and Medusa). If you plan to use
68 this kernel on an Atari, say Y here and browse the material
69 available in <file:Documentation/m68k>; otherwise say N.
70
71config MAC
72 bool "Macintosh support"
73 select MMU_MOTOROLA if MMU
74 help
75 This option enables support for the Apple Macintosh series of
76 computers (yes, there is experimental support now, at least for part
77 of the series).
78
79 Say N unless you're willing to code the remaining necessary support.
80 ;)
81
82config NUBUS
83 bool
84 depends on MAC
85 default y
86
87config M68K_L2_CACHE
88 bool
89 depends on MAC
90 default y
91
92config APOLLO
93 bool "Apollo support"
94 select MMU_MOTOROLA if MMU
95 help
96 Say Y here if you want to run Linux on an MC680x0-based Apollo
97 Domain workstation such as the DN3500.
98
99config VME
100 bool "VME (Motorola and BVM) support"
101 select MMU_MOTOROLA if MMU
102 help
103 Say Y here if you want to build a kernel for a 680x0 based VME
104 board. Boards currently supported include Motorola boards MVME147,
105 MVME162, MVME166, MVME167, MVME172, and MVME177. BVME4000 and
106 BVME6000 boards from BVM Ltd are also supported.
107
108config MVME147
109 bool "MVME147 support"
110 depends on VME
111 help
112 Say Y to include support for early Motorola VME boards. This will
113 build a kernel which can run on MVME147 single-board computers. If
114 you select this option you will have to select the appropriate
115 drivers for SCSI, Ethernet and serial ports later on.
116
117config MVME16x
118 bool "MVME162, 166 and 167 support"
119 depends on VME
120 help
121 Say Y to include support for Motorola VME boards. This will build a
122 kernel which can run on MVME162, MVME166, MVME167, MVME172, and
123 MVME177 boards. If you select this option you will have to select
124 the appropriate drivers for SCSI, Ethernet and serial ports later
125 on.
126
127config BVME6000
128 bool "BVME4000 and BVME6000 support"
129 depends on VME
130 help
131 Say Y to include support for VME boards from BVM Ltd. This will
132 build a kernel which can run on BVME4000 and BVME6000 boards. If
133 you select this option you will have to select the appropriate
134 drivers for SCSI, Ethernet and serial ports later on.
135
136config HP300
137 bool "HP9000/300 and HP9000/400 support"
138 select MMU_MOTOROLA if MMU
139 help
140 This option enables support for the HP9000/300 and HP9000/400 series
141 of workstations. Support for these machines is still somewhat
142 experimental. If you plan to try to use the kernel on such a machine
143 say Y here.
144 Everybody else says N.
145
146config DIO
147 bool "DIO bus support"
148 depends on HP300
149 default y
150 help
151 Say Y here to enable support for the "DIO" expansion bus used in
152 HP300 machines. If you are using such a system you almost certainly
153 want this.
154
155config SUN3X
156 bool "Sun3x support"
157 select MMU_MOTOROLA if MMU
158 select M68030
159 help
160 This option enables support for the Sun 3x series of workstations.
161 Be warned that this support is very experimental.
162 Note that Sun 3x kernels are not compatible with Sun 3 hardware.
163 General Linux information on the Sun 3x series (now discontinued)
164 is at <http://www.angelfire.com/ca2/tech68k/sun3.html>.
165
166 If you don't want to compile a kernel for a Sun 3x, say N.
167
168config Q40
169 bool "Q40/Q60 support"
170 select MMU_MOTOROLA if MMU
171 help
172 The Q40 is a Motorola 68040-based successor to the Sinclair QL
173 manufactured in Germany. There is an official Q40 home page at
174 <http://www.q40.de/>. This option enables support for the Q40 and
175 Q60. Select your CPU below. For 68LC060 don't forget to enable FPU
176 emulation.
177
178config SUN3
179 bool "Sun3 support"
180 depends on !MMU_MOTOROLA
181 select MMU_SUN3 if MMU
182 select M68020
183 help
184 This option enables support for the Sun 3 series of workstations
185 (3/50, 3/60, 3/1xx, 3/2xx systems). Enabling this option requires
186 that all other hardware types must be disabled, as Sun 3 kernels
187 are incompatible with all other m68k targets (including Sun 3x!).
188
189 If you don't want to compile a kernel exclusively for a Sun 3, say N.
190
191config NATFEAT
192 bool "ARAnyM emulator support"
193 depends on ATARI
194 help
195 This option enables support for ARAnyM native features, such as
196 access to a disk image as /dev/hda.
197
198config NFBLOCK
199 tristate "NatFeat block device support"
200 depends on BLOCK && NATFEAT
201 help
202 Say Y to include support for the ARAnyM NatFeat block device
203 which allows direct access to the hard drives without using
204 the hardware emulation.
205
206config NFCON
207 tristate "NatFeat console driver"
208 depends on NATFEAT
209 help
210 Say Y to include support for the ARAnyM NatFeat console driver
211 which allows the console output to be redirected to the stderr
212 output of ARAnyM.
213
214config NFETH
215 tristate "NatFeat Ethernet support"
216 depends on NET_ETHERNET && NATFEAT
217 help
218 Say Y to include support for the ARAnyM NatFeat network device
219 which will emulate a regular ethernet device while presenting an
220 ethertap device to the host system.
221
222comment "Processor type"
223
224config M68020
225 bool "68020 support"
226 help
227 If you anticipate running this kernel on a computer with a MC68020
228 processor, say Y. Otherwise, say N. Note that the 68020 requires a
229 68851 MMU (Memory Management Unit) to run Linux/m68k, except on the
230 Sun 3, which provides its own version.
231
232config M68030
233 bool "68030 support"
234 depends on !MMU_SUN3
235 help
236 If you anticipate running this kernel on a computer with a MC68030
237 processor, say Y. Otherwise, say N. Note that a MC68EC030 will not
238 work, as it does not include an MMU (Memory Management Unit).
239
240config M68040
241 bool "68040 support"
242 depends on !MMU_SUN3
243 help
244 If you anticipate running this kernel on a computer with a MC68LC040
245 or MC68040 processor, say Y. Otherwise, say N. Note that an
246 MC68EC040 will not work, as it does not include an MMU (Memory
247 Management Unit).
248
249config M68060
250 bool "68060 support"
251 depends on !MMU_SUN3
252 help
253 If you anticipate running this kernel on a computer with a MC68060
254 processor, say Y. Otherwise, say N.
255
256config MMU_MOTOROLA
257 bool
258
259config MMU_SUN3
260 bool
261 depends on MMU && !MMU_MOTOROLA
262
263config M68KFPU_EMU
264 bool "Math emulation support (EXPERIMENTAL)"
265 depends on EXPERIMENTAL
266 help
267 At some point in the future, this will cause floating-point math
268 instructions to be emulated by the kernel on machines that lack a
269 floating-point math coprocessor. Thrill-seekers and chronically
270 sleep-deprived psychotic hacker types can say Y now, everyone else
271 should probably wait a while.
272
273config M68KFPU_EMU_EXTRAPREC
274 bool "Math emulation extra precision"
275 depends on M68KFPU_EMU
276 help
277 The fpu uses normally a few bit more during calculations for
278 correct rounding, the emulator can (often) do the same but this
279 extra calculation can cost quite some time, so you can disable
280 it here. The emulator will then "only" calculate with a 64 bit
281 mantissa and round slightly incorrect, what is more than enough
282 for normal usage.
283
284config M68KFPU_EMU_ONLY
285 bool "Math emulation only kernel"
286 depends on M68KFPU_EMU
287 help
288 This option prevents any floating-point instructions from being
289 compiled into the kernel, thereby the kernel doesn't save any
290 floating point context anymore during task switches, so this
291 kernel will only be usable on machines without a floating-point
292 math coprocessor. This makes the kernel a bit faster as no tests
293 needs to be executed whether a floating-point instruction in the
294 kernel should be executed or not.
295
296config ADVANCED
297 bool "Advanced configuration options"
298 ---help---
299 This gives you access to some advanced options for the CPU. The
300 defaults should be fine for most users, but these options may make
301 it possible for you to improve performance somewhat if you know what
302 you are doing.
303
304 Note that the answer to this question won't directly affect the
305 kernel: saying N will just cause the configurator to skip all
306 the questions about these options.
307
308 Most users should say N to this question.
309
310config RMW_INSNS
311 bool "Use read-modify-write instructions"
312 depends on ADVANCED
313 ---help---
314 This allows to use certain instructions that work with indivisible
315 read-modify-write bus cycles. While this is faster than the
316 workaround of disabling interrupts, it can conflict with DMA
317 ( = direct memory access) on many Amiga systems, and it is also said
318 to destabilize other machines. It is very likely that this will
319 cause serious problems on any Amiga or Atari Medusa if set. The only
320 configuration where it should work are 68030-based Ataris, where it
321 apparently improves performance. But you've been warned! Unless you
322 really know what you are doing, say N. Try Y only if you're quite
323 adventurous.
324
325config SINGLE_MEMORY_CHUNK
326 bool "Use one physical chunk of memory only" if ADVANCED && !SUN3
327 default y if SUN3
328 select NEED_MULTIPLE_NODES
329 help
330 Ignore all but the first contiguous chunk of physical memory for VM
331 purposes. This will save a few bytes kernel size and may speed up
332 some operations. Say N if not sure.
333
334config 060_WRITETHROUGH
335 bool "Use write-through caching for 68060 supervisor accesses"
336 depends on ADVANCED && M68060
337 ---help---
338 The 68060 generally uses copyback caching of recently accessed data.
339 Copyback caching means that memory writes will be held in an on-chip
340 cache and only written back to memory some time later. Saying Y
341 here will force supervisor (kernel) accesses to use writethrough
342 caching. Writethrough caching means that data is written to memory
343 straight away, so that cache and memory data always agree.
344 Writethrough caching is less efficient, but is needed for some
345 drivers on 68060 based systems where the 68060 bus snooping signal
346 is hardwired on. The 53c710 SCSI driver is known to suffer from
347 this problem.
348
349config ARCH_DISCONTIGMEM_ENABLE
350 def_bool !SINGLE_MEMORY_CHUNK
351
352config NODES_SHIFT
353 int
354 default "3"
355 depends on !SINGLE_MEMORY_CHUNK
356
357config ZORRO
358 bool "Amiga Zorro (AutoConfig) bus support"
359 depends on AMIGA
360 help
361 This enables support for the Zorro bus in the Amiga. If you have
362 expansion cards in your Amiga that conform to the Amiga
363 AutoConfig(tm) specification, say Y, otherwise N. Note that even
364 expansion cards that do not fit in the Zorro slots but fit in e.g.
365 the CPU slot may fall in this category, so you have to say Y to let
366 Linux use these.
367
368config AMIGA_PCMCIA
369 bool "Amiga 1200/600 PCMCIA support (EXPERIMENTAL)"
370 depends on AMIGA && EXPERIMENTAL
371 help
372 Include support in the kernel for pcmcia on Amiga 1200 and Amiga
373 600. If you intend to use pcmcia cards say Y; otherwise say N.
374
375config HEARTBEAT
376 bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || MAC ||Q40
377 default y if !AMIGA && !APOLLO && !ATARI && !MAC && !Q40 && HP300
378 help
379 Use the power-on LED on your machine as a load meter. The exact
380 behavior is platform-dependent, but normally the flash frequency is
381 a hyperbolic function of the 5-minute load average.
382
383# We have a dedicated heartbeat LED. :-)
384config PROC_HARDWARE
385 bool "/proc/hardware support"
386 help
387 Say Y here to support the /proc/hardware file, which gives you
388 access to information about the machine you're running on,
389 including the model, CPU, MMU, clock speed, BogoMIPS rating,
390 and memory size.
391
392config ISA
393 bool
394 depends on Q40 || AMIGA_PCMCIA
395 default y
396 help
397 Find out whether you have ISA slots on your motherboard. ISA is the
398 name of a bus system, i.e. the way the CPU talks to the other stuff
399 inside your box. Other bus systems are PCI, EISA, MicroChannel
400 (MCA) or VESA. ISA is an older system, now being displaced by PCI;
401 newer boards don't support it. If you have ISA, say Y, otherwise N.
402
403config GENERIC_ISA_DMA
404 bool
405 depends on Q40 || AMIGA_PCMCIA
406 default y
407
408source "drivers/pci/Kconfig"
409
410source "drivers/zorro/Kconfig"
411
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index be46cadd401..cf318f20c64 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -1,7 +1,171 @@
1#
2# m68k/Makefile
3#
4# This file is included by the global makefile so that you can add your own
5# architecture-specific flags and dependencies. Remember to do have actions
6# for "archclean" and "archdep" for cleaning up and making dependencies for
7# this architecture
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# Copyright (C) 1994 by Hamish Macdonald
14# Copyright (C) 2002,2011 Greg Ungerer <gerg@snapgear.com>
15#
16
1KBUILD_DEFCONFIG := multi_defconfig 17KBUILD_DEFCONFIG := multi_defconfig
2 18
19#
20# Enable processor type. Ordering of these is important - we want to
21# use the minimum processor type of the range we support. The logic
22# for 680x0 will only allow use of the -m68060 or -m68040 if no other
23# 680x0 type is specified - and no option is specified for 68030 or
24# 68020. The other m68k/ColdFire types always specify some type of
25# compiler cpu type flag.
26#
27ifndef CONFIG_M68040
28cpuflags-$(CONFIG_M68060) := -m68060
29endif
30ifndef CONFIG_M68060
31cpuflags-$(CONFIG_M68040) := -m68040
32endif
33cpuflags-$(CONFIG_M68030) :=
34cpuflags-$(CONFIG_M68020) :=
35cpuflags-$(CONFIG_M68360) := -m68332
36cpuflags-$(CONFIG_M68000) := -m68000
37cpuflags-$(CONFIG_M54xx) := $(call cc-option,-mcpu=5475,-m5200)
38cpuflags-$(CONFIG_M5407) := $(call cc-option,-mcpu=5407,-m5200)
39cpuflags-$(CONFIG_M532x) := $(call cc-option,-mcpu=532x,-m5307)
40cpuflags-$(CONFIG_M5307) := $(call cc-option,-mcpu=5307,-m5200)
41cpuflags-$(CONFIG_M528x) := $(call cc-option,-mcpu=528x,-m5307)
42cpuflags-$(CONFIG_M5275) := $(call cc-option,-mcpu=5275,-m5307)
43cpuflags-$(CONFIG_M5272) := $(call cc-option,-mcpu=5272,-m5307)
44cpuflags-$(CONFIG_M5271) := $(call cc-option,-mcpu=5271,-m5307)
45cpuflags-$(CONFIG_M523x) := $(call cc-option,-mcpu=523x,-m5307)
46cpuflags-$(CONFIG_M5249) := $(call cc-option,-mcpu=5249,-m5200)
47cpuflags-$(CONFIG_M520x) := $(call cc-option,-mcpu=5208,-m5200)
48cpuflags-$(CONFIG_M5206e) := $(call cc-option,-mcpu=5206e,-m5200)
49cpuflags-$(CONFIG_M5206) := $(call cc-option,-mcpu=5206,-m5200)
50
51KBUILD_AFLAGS += $(cpuflags-y)
52KBUILD_CFLAGS += $(cpuflags-y) -pipe
3ifdef CONFIG_MMU 53ifdef CONFIG_MMU
4include $(srctree)/arch/m68k/Makefile_mm 54# without -fno-strength-reduce the 53c7xx.c driver fails ;-(
55KBUILD_CFLAGS += -fno-strength-reduce -ffixed-a2
56else
57# we can use a m68k-linux-gcc toolchain with these in place
58KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\"
59KBUILD_CFLAGS += -D__uClinux__
60KBUILD_AFLAGS += -D__uClinux__
61endif
62
63LDFLAGS := -m m68kelf
64KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds
65ifneq ($(SUBARCH),$(ARCH))
66 ifeq ($(CROSS_COMPILE),)
67 CROSS_COMPILE := $(call cc-cross-prefix, \
68 m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-)
69 endif
70endif
71
72ifdef CONFIG_SUN3
73LDFLAGS_vmlinux = -N
74endif
75
76CHECKFLAGS += -D__mc68000__
77
78
79ifdef CONFIG_KGDB
80# If configured for kgdb support, include debugging infos and keep the
81# frame pointer
82KBUILD_CFLAGS := $(subst -fomit-frame-pointer,,$(KBUILD_CFLAGS)) -g
83endif
84
85#
86# Select the assembler head startup code. Order is important. The default
87# head code is first, processor specific selections can override it after.
88#
89head-y := arch/m68k/kernel/head.o
90head-$(CONFIG_SUN3) := arch/m68k/kernel/sun3-head.o
91head-$(CONFIG_M68360) := arch/m68k/platform/68360/head.o
92head-$(CONFIG_M68000) := arch/m68k/platform/68328/head.o
93head-$(CONFIG_COLDFIRE) := arch/m68k/platform/coldfire/head.o
94
95core-y += arch/m68k/kernel/ arch/m68k/mm/
96libs-y += arch/m68k/lib/
97
98core-$(CONFIG_Q40) += arch/m68k/q40/
99core-$(CONFIG_AMIGA) += arch/m68k/amiga/
100core-$(CONFIG_ATARI) += arch/m68k/atari/
101core-$(CONFIG_MAC) += arch/m68k/mac/
102core-$(CONFIG_HP300) += arch/m68k/hp300/
103core-$(CONFIG_APOLLO) += arch/m68k/apollo/
104core-$(CONFIG_MVME147) += arch/m68k/mvme147/
105core-$(CONFIG_MVME16x) += arch/m68k/mvme16x/
106core-$(CONFIG_BVME6000) += arch/m68k/bvme6000/
107core-$(CONFIG_SUN3X) += arch/m68k/sun3x/ arch/m68k/sun3/
108core-$(CONFIG_SUN3) += arch/m68k/sun3/ arch/m68k/sun3/prom/
109core-$(CONFIG_NATFEAT) += arch/m68k/emu/
110core-$(CONFIG_M68040) += arch/m68k/fpsp040/
111core-$(CONFIG_M68060) += arch/m68k/ifpsp060/
112core-$(CONFIG_M68KFPU_EMU) += arch/m68k/math-emu/
113core-$(CONFIG_M68360) += arch/m68k/platform/68360/
114core-$(CONFIG_M68000) += arch/m68k/platform/68328/
115core-$(CONFIG_M68EZ328) += arch/m68k/platform/68EZ328/
116core-$(CONFIG_M68VZ328) += arch/m68k/platform/68VZ328/
117core-$(CONFIG_COLDFIRE) += arch/m68k/platform/coldfire/
118core-$(CONFIG_M5206) += arch/m68k/platform/5206/
119core-$(CONFIG_M5206e) += arch/m68k/platform/5206/
120core-$(CONFIG_M520x) += arch/m68k/platform/520x/
121core-$(CONFIG_M523x) += arch/m68k/platform/523x/
122core-$(CONFIG_M5249) += arch/m68k/platform/5249/
123core-$(CONFIG_M527x) += arch/m68k/platform/527x/
124core-$(CONFIG_M5272) += arch/m68k/platform/5272/
125core-$(CONFIG_M528x) += arch/m68k/platform/528x/
126core-$(CONFIG_M5307) += arch/m68k/platform/5307/
127core-$(CONFIG_M532x) += arch/m68k/platform/532x/
128core-$(CONFIG_M5407) += arch/m68k/platform/5407/
129core-$(CONFIG_M54xx) += arch/m68k/platform/54xx/
130
131
132all: zImage
133
134lilo: vmlinux
135 if [ -f $(INSTALL_PATH)/vmlinux ]; then mv -f $(INSTALL_PATH)/vmlinux $(INSTALL_PATH)/vmlinux.old; fi
136 if [ -f $(INSTALL_PATH)/System.map ]; then mv -f $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi
137 cat vmlinux > $(INSTALL_PATH)/vmlinux
138 cp System.map $(INSTALL_PATH)/System.map
139 if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
140
141zImage compressed: vmlinux.gz
142
143vmlinux.gz: vmlinux
144
145ifndef CONFIG_KGDB
146 cp vmlinux vmlinux.tmp
147 $(STRIP) vmlinux.tmp
148 gzip -9c vmlinux.tmp >vmlinux.gz
149 rm vmlinux.tmp
5else 150else
6include $(srctree)/arch/m68k/Makefile_no 151 gzip -9c vmlinux >vmlinux.gz
7endif 152endif
153
154bzImage: vmlinux.bz2
155
156vmlinux.bz2: vmlinux
157
158ifndef CONFIG_KGDB
159 cp vmlinux vmlinux.tmp
160 $(STRIP) vmlinux.tmp
161 bzip2 -1c vmlinux.tmp >vmlinux.bz2
162 rm vmlinux.tmp
163else
164 bzip2 -1c vmlinux >vmlinux.bz2
165endif
166
167archclean:
168 rm -f vmlinux.gz vmlinux.bz2
169
170install:
171 sh $(srctree)/arch/m68k/install.sh $(KERNELRELEASE) vmlinux.gz System.map "$(INSTALL_PATH)"
diff --git a/arch/m68k/Makefile_mm b/arch/m68k/Makefile_mm
deleted file mode 100644
index d449b6d5aec..00000000000
--- a/arch/m68k/Makefile_mm
+++ /dev/null
@@ -1,121 +0,0 @@
1#
2# m68k/Makefile
3#
4# This file is included by the global makefile so that you can add your own
5# architecture-specific flags and dependencies. Remember to do have actions
6# for "archclean" and "archdep" for cleaning up and making dependencies for
7# this architecture
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# Copyright (C) 1994 by Hamish Macdonald
14#
15
16# override top level makefile
17AS += -m68020
18LDFLAGS := -m m68kelf
19KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds
20ifneq ($(SUBARCH),$(ARCH))
21 ifeq ($(CROSS_COMPILE),)
22 CROSS_COMPILE := $(call cc-cross-prefix, \
23 m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-)
24 endif
25endif
26
27ifdef CONFIG_SUN3
28LDFLAGS_vmlinux = -N
29endif
30
31CHECKFLAGS += -D__mc68000__
32
33# without -fno-strength-reduce the 53c7xx.c driver fails ;-(
34KBUILD_CFLAGS += -pipe -fno-strength-reduce -ffixed-a2
35
36# enable processor switch if compiled only for a single cpu
37ifndef CONFIG_M68020
38ifndef CONFIG_M68030
39
40ifndef CONFIG_M68060
41KBUILD_CFLAGS += -m68040
42endif
43
44ifndef CONFIG_M68040
45KBUILD_CFLAGS += -m68060
46endif
47
48endif
49endif
50
51ifdef CONFIG_KGDB
52# If configured for kgdb support, include debugging infos and keep the
53# frame pointer
54KBUILD_CFLAGS := $(subst -fomit-frame-pointer,,$(KBUILD_CFLAGS)) -g
55endif
56
57ifndef CONFIG_SUN3
58head-y := arch/m68k/kernel/head.o
59else
60head-y := arch/m68k/kernel/sun3-head.o
61endif
62
63core-y += arch/m68k/kernel/ arch/m68k/mm/
64libs-y += arch/m68k/lib/
65
66core-$(CONFIG_Q40) += arch/m68k/q40/
67core-$(CONFIG_AMIGA) += arch/m68k/amiga/
68core-$(CONFIG_ATARI) += arch/m68k/atari/
69core-$(CONFIG_MAC) += arch/m68k/mac/
70core-$(CONFIG_HP300) += arch/m68k/hp300/
71core-$(CONFIG_APOLLO) += arch/m68k/apollo/
72core-$(CONFIG_MVME147) += arch/m68k/mvme147/
73core-$(CONFIG_MVME16x) += arch/m68k/mvme16x/
74core-$(CONFIG_BVME6000) += arch/m68k/bvme6000/
75core-$(CONFIG_SUN3X) += arch/m68k/sun3x/ arch/m68k/sun3/
76core-$(CONFIG_SUN3) += arch/m68k/sun3/ arch/m68k/sun3/prom/
77core-$(CONFIG_NATFEAT) += arch/m68k/emu/
78core-$(CONFIG_M68040) += arch/m68k/fpsp040/
79core-$(CONFIG_M68060) += arch/m68k/ifpsp060/
80core-$(CONFIG_M68KFPU_EMU) += arch/m68k/math-emu/
81
82all: zImage
83
84lilo: vmlinux
85 if [ -f $(INSTALL_PATH)/vmlinux ]; then mv -f $(INSTALL_PATH)/vmlinux $(INSTALL_PATH)/vmlinux.old; fi
86 if [ -f $(INSTALL_PATH)/System.map ]; then mv -f $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi
87 cat vmlinux > $(INSTALL_PATH)/vmlinux
88 cp System.map $(INSTALL_PATH)/System.map
89 if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
90
91zImage compressed: vmlinux.gz
92
93vmlinux.gz: vmlinux
94
95ifndef CONFIG_KGDB
96 cp vmlinux vmlinux.tmp
97 $(STRIP) vmlinux.tmp
98 gzip -9c vmlinux.tmp >vmlinux.gz
99 rm vmlinux.tmp
100else
101 gzip -9c vmlinux >vmlinux.gz
102endif
103
104bzImage: vmlinux.bz2
105
106vmlinux.bz2: vmlinux
107
108ifndef CONFIG_KGDB
109 cp vmlinux vmlinux.tmp
110 $(STRIP) vmlinux.tmp
111 bzip2 -1c vmlinux.tmp >vmlinux.bz2
112 rm vmlinux.tmp
113else
114 bzip2 -1c vmlinux >vmlinux.bz2
115endif
116
117archclean:
118 rm -f vmlinux.gz vmlinux.bz2
119
120install:
121 sh $(srctree)/arch/m68k/install.sh $(KERNELRELEASE) vmlinux.gz System.map "$(INSTALL_PATH)"
diff --git a/arch/m68k/Makefile_no b/arch/m68k/Makefile_no
deleted file mode 100644
index 844d3f17226..00000000000
--- a/arch/m68k/Makefile_no
+++ /dev/null
@@ -1,124 +0,0 @@
1#
2# arch/m68k/Makefile
3#
4# This file is subject to the terms and conditions of the GNU General Public
5# License. See the file "COPYING" in the main directory of this archive
6# for more details.
7#
8# (C) Copyright 2002, Greg Ungerer <gerg@snapgear.com>
9#
10
11platform-$(CONFIG_M68328) := 68328
12platform-$(CONFIG_M68EZ328) := 68EZ328
13platform-$(CONFIG_M68VZ328) := 68VZ328
14platform-$(CONFIG_M68360) := 68360
15platform-$(CONFIG_M5206) := 5206
16platform-$(CONFIG_M5206e) := 5206
17platform-$(CONFIG_M520x) := 520x
18platform-$(CONFIG_M523x) := 523x
19platform-$(CONFIG_M5249) := 5249
20platform-$(CONFIG_M527x) := 527x
21platform-$(CONFIG_M5272) := 5272
22platform-$(CONFIG_M528x) := 528x
23platform-$(CONFIG_M5307) := 5307
24platform-$(CONFIG_M532x) := 532x
25platform-$(CONFIG_M5407) := 5407
26platform-$(CONFIG_M54xx) := 54xx
27PLATFORM := $(platform-y)
28
29board-$(CONFIG_PILOT) := pilot
30board-$(CONFIG_UC5272) := UC5272
31board-$(CONFIG_UC5282) := UC5282
32board-$(CONFIG_UCSIMM) := ucsimm
33board-$(CONFIG_UCDIMM) := ucdimm
34board-$(CONFIG_UCQUICC) := uCquicc
35board-$(CONFIG_DRAGEN2) := de2
36board-$(CONFIG_ARNEWSH) := ARNEWSH
37board-$(CONFIG_FREESCALE) := FREESCALE
38board-$(CONFIG_M5235EVB) := M5235EVB
39board-$(CONFIG_M5271EVB) := M5271EVB
40board-$(CONFIG_M5275EVB) := M5275EVB
41board-$(CONFIG_M5282EVB) := M5282EVB
42board-$(CONFIG_ELITE) := eLITE
43board-$(CONFIG_NETtel) := NETtel
44board-$(CONFIG_SECUREEDGEMP3) := MP3
45board-$(CONFIG_CLEOPATRA) := CLEOPATRA
46board-$(CONFIG_senTec) := senTec
47board-$(CONFIG_SNEHA) := SNEHA
48board-$(CONFIG_M5208EVB) := M5208EVB
49board-$(CONFIG_MOD5272) := MOD5272
50board-$(CONFIG_AVNET) := AVNET
51board-$(CONFIG_SAVANT) := SAVANT
52BOARD := $(board-y)
53
54model-$(CONFIG_RAMKERNEL) := ram
55model-$(CONFIG_ROMKERNEL) := rom
56MODEL := $(model-y)
57
58#
59# Some code support is grouped together for a common cpu-subclass (for
60# example all ColdFire cpu's are very similar). Determine the sub-class
61# for the selected cpu. ONLY need to define this for the non-base member
62# of the family.
63#
64cpuclass-$(CONFIG_M5206) := coldfire
65cpuclass-$(CONFIG_M5206e) := coldfire
66cpuclass-$(CONFIG_M520x) := coldfire
67cpuclass-$(CONFIG_M523x) := coldfire
68cpuclass-$(CONFIG_M5249) := coldfire
69cpuclass-$(CONFIG_M527x) := coldfire
70cpuclass-$(CONFIG_M5272) := coldfire
71cpuclass-$(CONFIG_M528x) := coldfire
72cpuclass-$(CONFIG_M5307) := coldfire
73cpuclass-$(CONFIG_M532x) := coldfire
74cpuclass-$(CONFIG_M5407) := coldfire
75cpuclass-$(CONFIG_M54xx) := coldfire
76cpuclass-$(CONFIG_M68328) := 68328
77cpuclass-$(CONFIG_M68EZ328) := 68328
78cpuclass-$(CONFIG_M68VZ328) := 68328
79cpuclass-$(CONFIG_M68360) := 68360
80CPUCLASS := $(cpuclass-y)
81
82ifneq ($(CPUCLASS),$(PLATFORM))
83CLASSDIR := arch/m68k/platform/$(cpuclass-y)/
84endif
85
86export PLATFORM BOARD MODEL CPUCLASS
87
88#
89# Some CFLAG additions based on specific CPU type.
90#
91cflags-$(CONFIG_M5206) := $(call cc-option,-mcpu=5206,-m5200)
92cflags-$(CONFIG_M5206e) := $(call cc-option,-mcpu=5206e,-m5200)
93cflags-$(CONFIG_M520x) := $(call cc-option,-mcpu=5208,-m5200)
94cflags-$(CONFIG_M523x) := $(call cc-option,-mcpu=523x,-m5307)
95cflags-$(CONFIG_M5249) := $(call cc-option,-mcpu=5249,-m5200)
96cflags-$(CONFIG_M5271) := $(call cc-option,-mcpu=5271,-m5307)
97cflags-$(CONFIG_M5272) := $(call cc-option,-mcpu=5272,-m5307)
98cflags-$(CONFIG_M5275) := $(call cc-option,-mcpu=5275,-m5307)
99cflags-$(CONFIG_M528x) := $(call cc-option,-mcpu=528x,-m5307)
100cflags-$(CONFIG_M5307) := $(call cc-option,-mcpu=5307,-m5200)
101cflags-$(CONFIG_M532x) := $(call cc-option,-mcpu=532x,-m5307)
102cflags-$(CONFIG_M5407) := $(call cc-option,-mcpu=5407,-m5200)
103cflags-$(CONFIG_M54xx) := $(call cc-option,-mcpu=5475,-m5200)
104cflags-$(CONFIG_M68328) := -m68000
105cflags-$(CONFIG_M68EZ328) := -m68000
106cflags-$(CONFIG_M68VZ328) := -m68000
107cflags-$(CONFIG_M68360) := -m68332
108
109KBUILD_AFLAGS += $(cflags-y)
110
111KBUILD_CFLAGS += $(cflags-y)
112KBUILD_CFLAGS += -D__linux__
113KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\"
114
115head-y := arch/m68k/platform/$(cpuclass-y)/head.o
116
117core-y += arch/m68k/kernel/ \
118 arch/m68k/mm/ \
119 $(CLASSDIR) \
120 arch/m68k/platform/$(PLATFORM)/
121libs-y += arch/m68k/lib/
122
123archclean:
124
diff --git a/arch/m68k/include/asm/entry.h b/arch/m68k/include/asm/entry.h
index 876eec6f2b5..c3c5a8643e1 100644
--- a/arch/m68k/include/asm/entry.h
+++ b/arch/m68k/include/asm/entry.h
@@ -1,5 +1,254 @@
1#ifdef __uClinux__ 1#ifndef __M68K_ENTRY_H
2#include "entry_no.h" 2#define __M68K_ENTRY_H
3
4#include <asm/setup.h>
5#include <asm/page.h>
6#ifdef __ASSEMBLY__
7#include <asm/thread_info.h>
8#endif
9
10/*
11 * Stack layout in 'ret_from_exception':
12 *
13 * This allows access to the syscall arguments in registers d1-d5
14 *
15 * 0(sp) - d1
16 * 4(sp) - d2
17 * 8(sp) - d3
18 * C(sp) - d4
19 * 10(sp) - d5
20 * 14(sp) - a0
21 * 18(sp) - a1
22 * 1C(sp) - a2
23 * 20(sp) - d0
24 * 24(sp) - orig_d0
25 * 28(sp) - stack adjustment
26 * 2C(sp) - [ sr ] [ format & vector ]
27 * 2E(sp) - [ pc-hiword ] [ sr ]
28 * 30(sp) - [ pc-loword ] [ pc-hiword ]
29 * 32(sp) - [ format & vector ] [ pc-loword ]
30 * ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
31 * M68K COLDFIRE
32 */
33
34/* the following macro is used when enabling interrupts */
35#if defined(MACH_ATARI_ONLY)
36 /* block out HSYNC on the atari */
37#define ALLOWINT (~0x400)
38#define MAX_NOINT_IPL 3
3#else 39#else
4#include "entry_mm.h" 40 /* portable version */
41#define ALLOWINT (~0x700)
42#define MAX_NOINT_IPL 0
43#endif /* machine compilation types */
44
45#ifdef __ASSEMBLY__
46/*
47 * This defines the normal kernel pt-regs layout.
48 *
49 * regs a3-a6 and d6-d7 are preserved by C code
50 * the kernel doesn't mess with usp unless it needs to
51 */
52#define SWITCH_STACK_SIZE (6*4+4) /* includes return address */
53
54#ifdef CONFIG_COLDFIRE
55#ifdef CONFIG_COLDFIRE_SW_A7
56/*
57 * This is made a little more tricky on older ColdFires. There is no
58 * separate supervisor and user stack pointers. Need to artificially
59 * construct a usp in software... When doing this we need to disable
60 * interrupts, otherwise bad things will happen.
61 */
62.globl sw_usp
63.globl sw_ksp
64
65.macro SAVE_ALL_SYS
66 move #0x2700,%sr /* disable intrs */
67 btst #5,%sp@(2) /* from user? */
68 bnes 6f /* no, skip */
69 movel %sp,sw_usp /* save user sp */
70 addql #8,sw_usp /* remove exception */
71 movel sw_ksp,%sp /* kernel sp */
72 subql #8,%sp /* room for exception */
73 clrl %sp@- /* stkadj */
74 movel %d0,%sp@- /* orig d0 */
75 movel %d0,%sp@- /* d0 */
76 lea %sp@(-32),%sp /* space for 8 regs */
77 moveml %d1-%d5/%a0-%a2,%sp@
78 movel sw_usp,%a0 /* get usp */
79 movel %a0@-,%sp@(PT_OFF_PC) /* copy exception program counter */
80 movel %a0@-,%sp@(PT_OFF_FORMATVEC)/*copy exception format/vector/sr */
81 bra 7f
82 6:
83 clrl %sp@- /* stkadj */
84 movel %d0,%sp@- /* orig d0 */
85 movel %d0,%sp@- /* d0 */
86 lea %sp@(-32),%sp /* space for 8 regs */
87 moveml %d1-%d5/%a0-%a2,%sp@
88 7:
89.endm
90
91.macro SAVE_ALL_INT
92 SAVE_ALL_SYS
93 moveq #-1,%d0 /* not system call entry */
94 movel %d0,%sp@(PT_OFF_ORIG_D0)
95.endm
96
97.macro RESTORE_USER
98 move #0x2700,%sr /* disable intrs */
99 movel sw_usp,%a0 /* get usp */
100 movel %sp@(PT_OFF_PC),%a0@- /* copy exception program counter */
101 movel %sp@(PT_OFF_FORMATVEC),%a0@-/*copy exception format/vector/sr */
102 moveml %sp@,%d1-%d5/%a0-%a2
103 lea %sp@(32),%sp /* space for 8 regs */
104 movel %sp@+,%d0
105 addql #4,%sp /* orig d0 */
106 addl %sp@+,%sp /* stkadj */
107 addql #8,%sp /* remove exception */
108 movel %sp,sw_ksp /* save ksp */
109 subql #8,sw_usp /* set exception */
110 movel sw_usp,%sp /* restore usp */
111 rte
112.endm
113
114.macro RDUSP
115 movel sw_usp,%a3
116.endm
117
118.macro WRUSP
119 movel %a3,sw_usp
120.endm
121
122#else /* !CONFIG_COLDFIRE_SW_A7 */
123/*
124 * Modern ColdFire parts have separate supervisor and user stack
125 * pointers. Simple load and restore macros for this case.
126 */
127.macro SAVE_ALL_SYS
128 move #0x2700,%sr /* disable intrs */
129 clrl %sp@- /* stkadj */
130 movel %d0,%sp@- /* orig d0 */
131 movel %d0,%sp@- /* d0 */
132 lea %sp@(-32),%sp /* space for 8 regs */
133 moveml %d1-%d5/%a0-%a2,%sp@
134.endm
135
136.macro SAVE_ALL_INT
137 move #0x2700,%sr /* disable intrs */
138 clrl %sp@- /* stkadj */
139 pea -1:w /* orig d0 */
140 movel %d0,%sp@- /* d0 */
141 lea %sp@(-32),%sp /* space for 8 regs */
142 moveml %d1-%d5/%a0-%a2,%sp@
143.endm
144
145.macro RESTORE_USER
146 moveml %sp@,%d1-%d5/%a0-%a2
147 lea %sp@(32),%sp /* space for 8 regs */
148 movel %sp@+,%d0
149 addql #4,%sp /* orig d0 */
150 addl %sp@+,%sp /* stkadj */
151 rte
152.endm
153
154.macro RDUSP
155 /*move %usp,%a3*/
156 .word 0x4e6b
157.endm
158
159.macro WRUSP
160 /*move %a3,%usp*/
161 .word 0x4e63
162.endm
163
164#endif /* !CONFIG_COLDFIRE_SW_A7 */
165
166.macro SAVE_SWITCH_STACK
167 lea %sp@(-24),%sp /* 6 regs */
168 moveml %a3-%a6/%d6-%d7,%sp@
169.endm
170
171.macro RESTORE_SWITCH_STACK
172 moveml %sp@,%a3-%a6/%d6-%d7
173 lea %sp@(24),%sp /* 6 regs */
174.endm
175
176#else /* !CONFIG_COLDFIRE */
177
178/*
179 * All other types of m68k parts (68000, 680x0, CPU32) have the same
180 * entry and exit code.
181 */
182
183/*
184 * a -1 in the orig_d0 field signifies
185 * that the stack frame is NOT for syscall
186 */
187.macro SAVE_ALL_INT
188 clrl %sp@- /* stk_adj */
189 pea -1:w /* orig d0 */
190 movel %d0,%sp@- /* d0 */
191 moveml %d1-%d5/%a0-%a2,%sp@-
192.endm
193
194.macro SAVE_ALL_SYS
195 clrl %sp@- /* stk_adj */
196 movel %d0,%sp@- /* orig d0 */
197 movel %d0,%sp@- /* d0 */
198 moveml %d1-%d5/%a0-%a2,%sp@-
199.endm
200
201.macro RESTORE_ALL
202 moveml %sp@+,%a0-%a2/%d1-%d5
203 movel %sp@+,%d0
204 addql #4,%sp /* orig d0 */
205 addl %sp@+,%sp /* stk adj */
206 rte
207.endm
208
209
210.macro SAVE_SWITCH_STACK
211 moveml %a3-%a6/%d6-%d7,%sp@-
212.endm
213
214.macro RESTORE_SWITCH_STACK
215 moveml %sp@+,%a3-%a6/%d6-%d7
216.endm
217
218#endif /* !CONFIG_COLDFIRE */
219
220/*
221 * Register %a2 is reserved and set to current task on MMU enabled systems.
222 * Non-MMU systems do not reserve %a2 in this way, and this definition is
223 * not used for them.
224 */
225#define curptr a2
226
227#define GET_CURRENT(tmp) get_current tmp
228.macro get_current reg=%d0
229 movel %sp,\reg
230 andw #-THREAD_SIZE,\reg
231 movel \reg,%curptr
232 movel %curptr@,%curptr
233.endm
234
235#else /* C source */
236
237#define STR(X) STR1(X)
238#define STR1(X) #X
239
240#define SAVE_ALL_INT \
241 "clrl %%sp@-;" /* stk_adj */ \
242 "pea -1:w;" /* orig d0 = -1 */ \
243 "movel %%d0,%%sp@-;" /* d0 */ \
244 "moveml %%d1-%%d5/%%a0-%%a2,%%sp@-"
245
246#define GET_CURRENT(tmp) \
247 "movel %%sp,"#tmp"\n\t" \
248 "andw #-"STR(THREAD_SIZE)","#tmp"\n\t" \
249 "movel "#tmp",%%a2\n\t" \
250 "movel %%a2@,%%a2"
251
5#endif 252#endif
253
254#endif /* __M68K_ENTRY_H */
diff --git a/arch/m68k/include/asm/entry_mm.h b/arch/m68k/include/asm/entry_mm.h
deleted file mode 100644
index 73b8c8fbed9..00000000000
--- a/arch/m68k/include/asm/entry_mm.h
+++ /dev/null
@@ -1,128 +0,0 @@
1#ifndef __M68K_ENTRY_H
2#define __M68K_ENTRY_H
3
4#include <asm/setup.h>
5#include <asm/page.h>
6#ifdef __ASSEMBLY__
7#include <asm/thread_info.h>
8#endif
9
10/*
11 * Stack layout in 'ret_from_exception':
12 *
13 * This allows access to the syscall arguments in registers d1-d5
14 *
15 * 0(sp) - d1
16 * 4(sp) - d2
17 * 8(sp) - d3
18 * C(sp) - d4
19 * 10(sp) - d5
20 * 14(sp) - a0
21 * 18(sp) - a1
22 * 1C(sp) - a2
23 * 20(sp) - d0
24 * 24(sp) - orig_d0
25 * 28(sp) - stack adjustment
26 * 2C(sp) - sr
27 * 2E(sp) - pc
28 * 32(sp) - format & vector
29 */
30
31/*
32 * 97/05/14 Andreas: Register %a2 is now set to the current task throughout
33 * the whole kernel.
34 */
35
36/* the following macro is used when enabling interrupts */
37#if defined(MACH_ATARI_ONLY)
38 /* block out HSYNC on the atari */
39#define ALLOWINT (~0x400)
40#define MAX_NOINT_IPL 3
41#else
42 /* portable version */
43#define ALLOWINT (~0x700)
44#define MAX_NOINT_IPL 0
45#endif /* machine compilation types */
46
47#ifdef __ASSEMBLY__
48
49#define curptr a2
50
51LFLUSH_I_AND_D = 0x00000808
52
53#define SAVE_ALL_INT save_all_int
54#define SAVE_ALL_SYS save_all_sys
55#define RESTORE_ALL restore_all
56/*
57 * This defines the normal kernel pt-regs layout.
58 *
59 * regs a3-a6 and d6-d7 are preserved by C code
60 * the kernel doesn't mess with usp unless it needs to
61 */
62
63/*
64 * a -1 in the orig_d0 field signifies
65 * that the stack frame is NOT for syscall
66 */
67.macro save_all_int
68 clrl %sp@- | stk_adj
69 pea -1:w | orig d0
70 movel %d0,%sp@- | d0
71 moveml %d1-%d5/%a0-%a1/%curptr,%sp@-
72.endm
73
74.macro save_all_sys
75 clrl %sp@- | stk_adj
76 movel %d0,%sp@- | orig d0
77 movel %d0,%sp@- | d0
78 moveml %d1-%d5/%a0-%a1/%curptr,%sp@-
79.endm
80
81.macro restore_all
82 moveml %sp@+,%a0-%a1/%curptr/%d1-%d5
83 movel %sp@+,%d0
84 addql #4,%sp | orig d0
85 addl %sp@+,%sp | stk adj
86 rte
87.endm
88
89#define SWITCH_STACK_SIZE (6*4+4) /* includes return address */
90
91#define SAVE_SWITCH_STACK save_switch_stack
92#define RESTORE_SWITCH_STACK restore_switch_stack
93#define GET_CURRENT(tmp) get_current tmp
94
95.macro save_switch_stack
96 moveml %a3-%a6/%d6-%d7,%sp@-
97.endm
98
99.macro restore_switch_stack
100 moveml %sp@+,%a3-%a6/%d6-%d7
101.endm
102
103.macro get_current reg=%d0
104 movel %sp,\reg
105 andw #-THREAD_SIZE,\reg
106 movel \reg,%curptr
107 movel %curptr@,%curptr
108.endm
109
110#else /* C source */
111
112#define STR(X) STR1(X)
113#define STR1(X) #X
114
115#define SAVE_ALL_INT \
116 "clrl %%sp@-;" /* stk_adj */ \
117 "pea -1:w;" /* orig d0 = -1 */ \
118 "movel %%d0,%%sp@-;" /* d0 */ \
119 "moveml %%d1-%%d5/%%a0-%%a2,%%sp@-"
120#define GET_CURRENT(tmp) \
121 "movel %%sp,"#tmp"\n\t" \
122 "andw #-"STR(THREAD_SIZE)","#tmp"\n\t" \
123 "movel "#tmp",%%a2\n\t" \
124 "movel %%a2@,%%a2"
125
126#endif
127
128#endif /* __M68K_ENTRY_H */
diff --git a/arch/m68k/include/asm/entry_no.h b/arch/m68k/include/asm/entry_no.h
deleted file mode 100644
index 68611e3dbb1..00000000000
--- a/arch/m68k/include/asm/entry_no.h
+++ /dev/null
@@ -1,181 +0,0 @@
1#ifndef __M68KNOMMU_ENTRY_H
2#define __M68KNOMMU_ENTRY_H
3
4#include <asm/setup.h>
5#include <asm/page.h>
6
7/*
8 * Stack layout in 'ret_from_exception':
9 *
10 * This allows access to the syscall arguments in registers d1-d5
11 *
12 * 0(sp) - d1
13 * 4(sp) - d2
14 * 8(sp) - d3
15 * C(sp) - d4
16 * 10(sp) - d5
17 * 14(sp) - a0
18 * 18(sp) - a1
19 * 1C(sp) - a2
20 * 20(sp) - d0
21 * 24(sp) - orig_d0
22 * 28(sp) - stack adjustment
23 * 2C(sp) - [ sr ] [ format & vector ]
24 * 2E(sp) - [ pc-hiword ] [ sr ]
25 * 30(sp) - [ pc-loword ] [ pc-hiword ]
26 * 32(sp) - [ format & vector ] [ pc-loword ]
27 * ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
28 * M68K COLDFIRE
29 */
30
31#define ALLOWINT (~0x700)
32
33#ifdef __ASSEMBLY__
34
35#define SWITCH_STACK_SIZE (6*4+4) /* Includes return address */
36
37/*
38 * This defines the normal kernel pt-regs layout.
39 *
40 * regs are a2-a6 and d6-d7 preserved by C code
41 * the kernel doesn't mess with usp unless it needs to
42 */
43
44#ifdef CONFIG_COLDFIRE
45#ifdef CONFIG_COLDFIRE_SW_A7
46/*
47 * This is made a little more tricky on older ColdFires. There is no
48 * separate supervisor and user stack pointers. Need to artificially
49 * construct a usp in software... When doing this we need to disable
50 * interrupts, otherwise bad things will happen.
51 */
52.globl sw_usp
53.globl sw_ksp
54
55.macro SAVE_ALL
56 move #0x2700,%sr /* disable intrs */
57 btst #5,%sp@(2) /* from user? */
58 bnes 6f /* no, skip */
59 movel %sp,sw_usp /* save user sp */
60 addql #8,sw_usp /* remove exception */
61 movel sw_ksp,%sp /* kernel sp */
62 subql #8,%sp /* room for exception */
63 clrl %sp@- /* stkadj */
64 movel %d0,%sp@- /* orig d0 */
65 movel %d0,%sp@- /* d0 */
66 lea %sp@(-32),%sp /* space for 8 regs */
67 moveml %d1-%d5/%a0-%a2,%sp@
68 movel sw_usp,%a0 /* get usp */
69 movel %a0@-,%sp@(PT_OFF_PC) /* copy exception program counter */
70 movel %a0@-,%sp@(PT_OFF_FORMATVEC)/*copy exception format/vector/sr */
71 bra 7f
72 6:
73 clrl %sp@- /* stkadj */
74 movel %d0,%sp@- /* orig d0 */
75 movel %d0,%sp@- /* d0 */
76 lea %sp@(-32),%sp /* space for 8 regs */
77 moveml %d1-%d5/%a0-%a2,%sp@
78 7:
79.endm
80
81.macro RESTORE_USER
82 move #0x2700,%sr /* disable intrs */
83 movel sw_usp,%a0 /* get usp */
84 movel %sp@(PT_OFF_PC),%a0@- /* copy exception program counter */
85 movel %sp@(PT_OFF_FORMATVEC),%a0@-/*copy exception format/vector/sr */
86 moveml %sp@,%d1-%d5/%a0-%a2
87 lea %sp@(32),%sp /* space for 8 regs */
88 movel %sp@+,%d0
89 addql #4,%sp /* orig d0 */
90 addl %sp@+,%sp /* stkadj */
91 addql #8,%sp /* remove exception */
92 movel %sp,sw_ksp /* save ksp */
93 subql #8,sw_usp /* set exception */
94 movel sw_usp,%sp /* restore usp */
95 rte
96.endm
97
98.macro RDUSP
99 movel sw_usp,%a3
100.endm
101
102.macro WRUSP
103 movel %a3,sw_usp
104.endm
105
106#else /* !CONFIG_COLDFIRE_SW_A7 */
107/*
108 * Modern ColdFire parts have separate supervisor and user stack
109 * pointers. Simple load and restore macros for this case.
110 */
111.macro SAVE_ALL
112 move #0x2700,%sr /* disable intrs */
113 clrl %sp@- /* stkadj */
114 movel %d0,%sp@- /* orig d0 */
115 movel %d0,%sp@- /* d0 */
116 lea %sp@(-32),%sp /* space for 8 regs */
117 moveml %d1-%d5/%a0-%a2,%sp@
118.endm
119
120.macro RESTORE_USER
121 moveml %sp@,%d1-%d5/%a0-%a2
122 lea %sp@(32),%sp /* space for 8 regs */
123 movel %sp@+,%d0
124 addql #4,%sp /* orig d0 */
125 addl %sp@+,%sp /* stkadj */
126 rte
127.endm
128
129.macro RDUSP
130 /*move %usp,%a3*/
131 .word 0x4e6b
132.endm
133
134.macro WRUSP
135 /*move %a3,%usp*/
136 .word 0x4e63
137.endm
138
139#endif /* !CONFIG_COLDFIRE_SW_A7 */
140
141.macro SAVE_SWITCH_STACK
142 lea %sp@(-24),%sp /* 6 regs */
143 moveml %a3-%a6/%d6-%d7,%sp@
144.endm
145
146.macro RESTORE_SWITCH_STACK
147 moveml %sp@,%a3-%a6/%d6-%d7
148 lea %sp@(24),%sp /* 6 regs */
149.endm
150
151#else /* !CONFIG_COLDFIRE */
152
153/*
154 * Standard 68k interrupt entry and exit macros.
155 */
156.macro SAVE_ALL
157 clrl %sp@- /* stkadj */
158 movel %d0,%sp@- /* orig d0 */
159 movel %d0,%sp@- /* d0 */
160 moveml %d1-%d5/%a0-%a2,%sp@-
161.endm
162
163.macro RESTORE_ALL
164 moveml %sp@+,%a0-%a2/%d1-%d5
165 movel %sp@+,%d0
166 addql #4,%sp /* orig d0 */
167 addl %sp@+,%sp /* stkadj */
168 rte
169.endm
170
171.macro SAVE_SWITCH_STACK
172 moveml %a3-%a6/%d6-%d7,%sp@-
173.endm
174
175.macro RESTORE_SWITCH_STACK
176 moveml %sp@+,%a3-%a6/%d6-%d7
177.endm
178
179#endif /* !COLDFIRE_SW_A7 */
180#endif /* __ASSEMBLY__ */
181#endif /* __M68KNOMMU_ENTRY_H */
diff --git a/arch/m68k/include/asm/m520xsim.h b/arch/m68k/include/asm/m520xsim.h
index b6bf2c518ba..eda62de7e60 100644
--- a/arch/m68k/include/asm/m520xsim.h
+++ b/arch/m68k/include/asm/m520xsim.h
@@ -90,15 +90,13 @@
90#define MCFGPIO_PDDR_FECH 0xFC0A4013 90#define MCFGPIO_PDDR_FECH 0xFC0A4013
91#define MCFGPIO_PDDR_FECL 0xFC0A4014 91#define MCFGPIO_PDDR_FECL 0xFC0A4014
92 92
93#define MCFGPIO_PPDSDR_BUSCTL 0xFC0A401A 93#define MCFGPIO_PPDSDR_CS 0xFC0A401A
94#define MCFGPIO_PPDSDR_BE 0xFC0A401B 94#define MCFGPIO_PPDSDR_FECI2C 0xFC0A401B
95#define MCFGPIO_PPDSDR_CS 0xFC0A401C 95#define MCFGPIO_PPDSDR_QSPI 0xFC0A401C
96#define MCFGPIO_PPDSDR_FECI2C 0xFC0A401D 96#define MCFGPIO_PPDSDR_TIMER 0xFC0A401D
97#define MCFGPIO_PPDSDR_QSPI 0xFC0A401E 97#define MCFGPIO_PPDSDR_UART 0xFC0A401E
98#define MCFGPIO_PPDSDR_TIMER 0xFC0A401F 98#define MCFGPIO_PPDSDR_FECH 0xFC0A401F
99#define MCFGPIO_PPDSDR_UART 0xFC0A4021 99#define MCFGPIO_PPDSDR_FECL 0xFC0A4020
100#define MCFGPIO_PPDSDR_FECH 0xFC0A4021
101#define MCFGPIO_PPDSDR_FECL 0xFC0A4022
102 100
103#define MCFGPIO_PCLRR_BUSCTL 0xFC0A4024 101#define MCFGPIO_PCLRR_BUSCTL 0xFC0A4024
104#define MCFGPIO_PCLRR_BE 0xFC0A4025 102#define MCFGPIO_PCLRR_BE 0xFC0A4025
@@ -113,11 +111,11 @@
113/* 111/*
114 * Generic GPIO support 112 * Generic GPIO support
115 */ 113 */
116#define MCFGPIO_PODR MCFGPIO_PODR_BUSCTL 114#define MCFGPIO_PODR MCFGPIO_PODR_CS
117#define MCFGPIO_PDDR MCFGPIO_PDDR_BUSCTL 115#define MCFGPIO_PDDR MCFGPIO_PDDR_CS
118#define MCFGPIO_PPDR MCFGPIO_PPDSDR_BUSCTL 116#define MCFGPIO_PPDR MCFGPIO_PPDSDR_CS
119#define MCFGPIO_SETR MCFGPIO_PPDSDR_BUSCTL 117#define MCFGPIO_SETR MCFGPIO_PPDSDR_CS
120#define MCFGPIO_CLRR MCFGPIO_PCLRR_BUSCTL 118#define MCFGPIO_CLRR MCFGPIO_PCLRR_CS
121 119
122#define MCFGPIO_PIN_MAX 80 120#define MCFGPIO_PIN_MAX 80
123#define MCFGPIO_IRQ_MAX 8 121#define MCFGPIO_IRQ_MAX 8
diff --git a/arch/m68k/include/asm/mcfqspi.h b/arch/m68k/include/asm/mcfqspi.h
index 39d90d51111..7fe631972f1 100644
--- a/arch/m68k/include/asm/mcfqspi.h
+++ b/arch/m68k/include/asm/mcfqspi.h
@@ -24,9 +24,11 @@
24#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) 24#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x)
25#define MCFQSPI_IOBASE (MCF_IPSBAR + 0x340) 25#define MCFQSPI_IOBASE (MCF_IPSBAR + 0x340)
26#elif defined(CONFIG_M5249) 26#elif defined(CONFIG_M5249)
27#define MCFQSPI_IOBASE (MCF_MBAR + 0x300) 27#define MCFQSPI_IOBASE (MCF_MBAR + 0x300)
28#elif defined(CONFIG_M520x) || defined(CONFIG_M532x) 28#elif defined(CONFIG_M520x)
29#define MCFQSPI_IOBASE 0xFC058000 29#define MCFQSPI_IOBASE 0xFC05C000
30#elif defined(CONFIG_M532x)
31#define MCFQSPI_IOBASE 0xFC058000
30#endif 32#endif
31#define MCFQSPI_IOSIZE 0x40 33#define MCFQSPI_IOSIZE 0x40
32 34
diff --git a/arch/m68k/include/asm/page_no.h b/arch/m68k/include/asm/page_no.h
index 90595721185..a8d1c60eb9c 100644
--- a/arch/m68k/include/asm/page_no.h
+++ b/arch/m68k/include/asm/page_no.h
@@ -5,6 +5,9 @@
5 5
6extern unsigned long memory_start; 6extern unsigned long memory_start;
7extern unsigned long memory_end; 7extern unsigned long memory_end;
8extern unsigned long _rambase;
9extern unsigned long _ramstart;
10extern unsigned long _ramend;
8 11
9#define get_user_page(vaddr) __get_free_page(GFP_KERNEL) 12#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
10#define free_user_page(page, addr) free_page(addr) 13#define free_user_page(page, addr) free_page(addr)
diff --git a/arch/m68k/include/asm/processor.h b/arch/m68k/include/asm/processor.h
index d8ef53ac03f..568facf3027 100644
--- a/arch/m68k/include/asm/processor.h
+++ b/arch/m68k/include/asm/processor.h
@@ -135,6 +135,12 @@ do { \
135 wrusp(_usp); \ 135 wrusp(_usp); \
136} while(0) 136} while(0)
137 137
138static inline int handle_kernel_fault(struct pt_regs *regs)
139{
140 /* Any fault in kernel is fatal on non-mmu */
141 return 0;
142}
143
138#endif 144#endif
139 145
140/* Forward declaration, a strange C thing */ 146/* Forward declaration, a strange C thing */
diff --git a/arch/m68k/include/asm/sections.h b/arch/m68k/include/asm/sections.h
index d64967ecfec..5277e52715e 100644
--- a/arch/m68k/include/asm/sections.h
+++ b/arch/m68k/include/asm/sections.h
@@ -3,4 +3,6 @@
3 3
4#include <asm-generic/sections.h> 4#include <asm-generic/sections.h>
5 5
6extern char _sbss[], _ebss[];
7
6#endif /* _ASM_M68K_SECTIONS_H */ 8#endif /* _ASM_M68K_SECTIONS_H */
diff --git a/arch/m68k/kernel/Makefile b/arch/m68k/kernel/Makefile
index c482ebc9dd5..e7f0f2e5ad4 100644
--- a/arch/m68k/kernel/Makefile
+++ b/arch/m68k/kernel/Makefile
@@ -1,5 +1,21 @@
1ifdef CONFIG_MMU 1#
2include arch/m68k/kernel/Makefile_mm 2# Makefile for the linux kernel.
3else 3#
4include arch/m68k/kernel/Makefile_no 4
5extra-$(CONFIG_MMU) := head.o
6extra-$(CONFIG_SUN3) := sun3-head.o
7extra-y += vmlinux.lds
8
9obj-y := entry.o m68k_ksyms.o module.o process.o ptrace.o setup.o signal.o \
10 sys_m68k.o syscalltable.o time.o traps.o
11
12obj-$(CONFIG_MMU) += ints.o devres.o vectors.o
13devres-$(CONFIG_MMU) = ../../../kernel/irq/devres.o
14
15ifndef CONFIG_MMU_SUN3
16obj-y += dma.o
5endif 17endif
18ifndef CONFIG_MMU
19obj-y += init_task.o irq.o
20endif
21
diff --git a/arch/m68k/kernel/Makefile_mm b/arch/m68k/kernel/Makefile_mm
deleted file mode 100644
index aced6780457..00000000000
--- a/arch/m68k/kernel/Makefile_mm
+++ /dev/null
@@ -1,17 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5ifndef CONFIG_SUN3
6 extra-y := head.o
7else
8 extra-y := sun3-head.o
9endif
10extra-y += vmlinux.lds
11
12obj-y := entry.o process.o traps.o ints.o signal.o ptrace.o module.o \
13 sys_m68k.o time.o setup.o m68k_ksyms.o devres.o syscalltable.o
14
15devres-y = ../../../kernel/irq/devres.o
16
17obj-y$(CONFIG_MMU_SUN3) += dma.o # no, it's not a typo
diff --git a/arch/m68k/kernel/Makefile_no b/arch/m68k/kernel/Makefile_no
deleted file mode 100644
index 37c3fc074c0..00000000000
--- a/arch/m68k/kernel/Makefile_no
+++ /dev/null
@@ -1,10 +0,0 @@
1#
2# Makefile for arch/m68knommu/kernel.
3#
4
5extra-y := vmlinux.lds
6
7obj-y += dma.o entry.o init_task.o irq.o m68k_ksyms.o process.o ptrace.o \
8 setup.o signal.o syscalltable.o sys_m68k.o time.o traps.o
9
10obj-$(CONFIG_MODULES) += module.o
diff --git a/arch/m68k/kernel/entry_no.S b/arch/m68k/kernel/entry_no.S
index 5f0f6b598b5..1b4289061a6 100644
--- a/arch/m68k/kernel/entry_no.S
+++ b/arch/m68k/kernel/entry_no.S
@@ -43,7 +43,7 @@
43.globl sys_vfork 43.globl sys_vfork
44 44
45ENTRY(buserr) 45ENTRY(buserr)
46 SAVE_ALL 46 SAVE_ALL_INT
47 moveq #-1,%d0 47 moveq #-1,%d0
48 movel %d0,%sp@(PT_OFF_ORIG_D0) 48 movel %d0,%sp@(PT_OFF_ORIG_D0)
49 movel %sp,%sp@- /* stack frame pointer argument */ 49 movel %sp,%sp@- /* stack frame pointer argument */
@@ -52,7 +52,7 @@ ENTRY(buserr)
52 jra ret_from_exception 52 jra ret_from_exception
53 53
54ENTRY(trap) 54ENTRY(trap)
55 SAVE_ALL 55 SAVE_ALL_INT
56 moveq #-1,%d0 56 moveq #-1,%d0
57 movel %d0,%sp@(PT_OFF_ORIG_D0) 57 movel %d0,%sp@(PT_OFF_ORIG_D0)
58 movel %sp,%sp@- /* stack frame pointer argument */ 58 movel %sp,%sp@- /* stack frame pointer argument */
@@ -64,7 +64,7 @@ ENTRY(trap)
64 64
65.globl dbginterrupt 65.globl dbginterrupt
66ENTRY(dbginterrupt) 66ENTRY(dbginterrupt)
67 SAVE_ALL 67 SAVE_ALL_INT
68 moveq #-1,%d0 68 moveq #-1,%d0
69 movel %d0,%sp@(PT_OFF_ORIG_D0) 69 movel %d0,%sp@(PT_OFF_ORIG_D0)
70 movel %sp,%sp@- /* stack frame pointer argument */ 70 movel %sp,%sp@- /* stack frame pointer argument */
diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c
index 16b2de7f510..2ed8c0fb151 100644
--- a/arch/m68k/kernel/setup_no.c
+++ b/arch/m68k/kernel/setup_no.c
@@ -36,6 +36,7 @@
36#include <asm/irq.h> 36#include <asm/irq.h>
37#include <asm/machdep.h> 37#include <asm/machdep.h>
38#include <asm/pgtable.h> 38#include <asm/pgtable.h>
39#include <asm/sections.h>
39 40
40unsigned long memory_start; 41unsigned long memory_start;
41unsigned long memory_end; 42unsigned long memory_end;
@@ -80,9 +81,6 @@ void (*mach_power_off)(void);
80#define CPU_INSTR_PER_JIFFY 16 81#define CPU_INSTR_PER_JIFFY 16
81#endif 82#endif
82 83
83extern int _stext, _etext, _sdata, _edata, _sbss, _ebss, _end;
84extern int _ramstart, _ramend;
85
86#if defined(CONFIG_UBOOT) 84#if defined(CONFIG_UBOOT)
87/* 85/*
88 * parse_uboot_commandline 86 * parse_uboot_commandline
diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c
index c98add3f5f0..89362f2bb56 100644
--- a/arch/m68k/kernel/traps.c
+++ b/arch/m68k/kernel/traps.c
@@ -1,5 +1,1107 @@
1#ifdef CONFIG_MMU 1/*
2#include "traps_mm.c" 2 * linux/arch/m68k/kernel/traps.c
3 *
4 * Copyright (C) 1993, 1994 by Hamish Macdonald
5 *
6 * 68040 fixes by Michael Rausch
7 * 68040 fixes by Martin Apel
8 * 68040 fixes and writeback by Richard Zidlicky
9 * 68060 fixes by Roman Hodek
10 * 68060 fixes by Jesper Skov
11 *
12 * This file is subject to the terms and conditions of the GNU General Public
13 * License. See the file COPYING in the main directory of this archive
14 * for more details.
15 */
16
17/*
18 * Sets up all exception vectors
19 */
20
21#include <linux/sched.h>
22#include <linux/signal.h>
23#include <linux/kernel.h>
24#include <linux/mm.h>
25#include <linux/module.h>
26#include <linux/user.h>
27#include <linux/string.h>
28#include <linux/linkage.h>
29#include <linux/init.h>
30#include <linux/ptrace.h>
31#include <linux/kallsyms.h>
32
33#include <asm/setup.h>
34#include <asm/fpu.h>
35#include <asm/system.h>
36#include <asm/uaccess.h>
37#include <asm/traps.h>
38#include <asm/pgalloc.h>
39#include <asm/machdep.h>
40#include <asm/siginfo.h>
41
42
43static const char *vec_names[] = {
44 [VEC_RESETSP] = "RESET SP",
45 [VEC_RESETPC] = "RESET PC",
46 [VEC_BUSERR] = "BUS ERROR",
47 [VEC_ADDRERR] = "ADDRESS ERROR",
48 [VEC_ILLEGAL] = "ILLEGAL INSTRUCTION",
49 [VEC_ZERODIV] = "ZERO DIVIDE",
50 [VEC_CHK] = "CHK",
51 [VEC_TRAP] = "TRAPcc",
52 [VEC_PRIV] = "PRIVILEGE VIOLATION",
53 [VEC_TRACE] = "TRACE",
54 [VEC_LINE10] = "LINE 1010",
55 [VEC_LINE11] = "LINE 1111",
56 [VEC_RESV12] = "UNASSIGNED RESERVED 12",
57 [VEC_COPROC] = "COPROCESSOR PROTOCOL VIOLATION",
58 [VEC_FORMAT] = "FORMAT ERROR",
59 [VEC_UNINT] = "UNINITIALIZED INTERRUPT",
60 [VEC_RESV16] = "UNASSIGNED RESERVED 16",
61 [VEC_RESV17] = "UNASSIGNED RESERVED 17",
62 [VEC_RESV18] = "UNASSIGNED RESERVED 18",
63 [VEC_RESV19] = "UNASSIGNED RESERVED 19",
64 [VEC_RESV20] = "UNASSIGNED RESERVED 20",
65 [VEC_RESV21] = "UNASSIGNED RESERVED 21",
66 [VEC_RESV22] = "UNASSIGNED RESERVED 22",
67 [VEC_RESV23] = "UNASSIGNED RESERVED 23",
68 [VEC_SPUR] = "SPURIOUS INTERRUPT",
69 [VEC_INT1] = "LEVEL 1 INT",
70 [VEC_INT2] = "LEVEL 2 INT",
71 [VEC_INT3] = "LEVEL 3 INT",
72 [VEC_INT4] = "LEVEL 4 INT",
73 [VEC_INT5] = "LEVEL 5 INT",
74 [VEC_INT6] = "LEVEL 6 INT",
75 [VEC_INT7] = "LEVEL 7 INT",
76 [VEC_SYS] = "SYSCALL",
77 [VEC_TRAP1] = "TRAP #1",
78 [VEC_TRAP2] = "TRAP #2",
79 [VEC_TRAP3] = "TRAP #3",
80 [VEC_TRAP4] = "TRAP #4",
81 [VEC_TRAP5] = "TRAP #5",
82 [VEC_TRAP6] = "TRAP #6",
83 [VEC_TRAP7] = "TRAP #7",
84 [VEC_TRAP8] = "TRAP #8",
85 [VEC_TRAP9] = "TRAP #9",
86 [VEC_TRAP10] = "TRAP #10",
87 [VEC_TRAP11] = "TRAP #11",
88 [VEC_TRAP12] = "TRAP #12",
89 [VEC_TRAP13] = "TRAP #13",
90 [VEC_TRAP14] = "TRAP #14",
91 [VEC_TRAP15] = "TRAP #15",
92 [VEC_FPBRUC] = "FPCP BSUN",
93 [VEC_FPIR] = "FPCP INEXACT",
94 [VEC_FPDIVZ] = "FPCP DIV BY 0",
95 [VEC_FPUNDER] = "FPCP UNDERFLOW",
96 [VEC_FPOE] = "FPCP OPERAND ERROR",
97 [VEC_FPOVER] = "FPCP OVERFLOW",
98 [VEC_FPNAN] = "FPCP SNAN",
99 [VEC_FPUNSUP] = "FPCP UNSUPPORTED OPERATION",
100 [VEC_MMUCFG] = "MMU CONFIGURATION ERROR",
101 [VEC_MMUILL] = "MMU ILLEGAL OPERATION ERROR",
102 [VEC_MMUACC] = "MMU ACCESS LEVEL VIOLATION ERROR",
103 [VEC_RESV59] = "UNASSIGNED RESERVED 59",
104 [VEC_UNIMPEA] = "UNASSIGNED RESERVED 60",
105 [VEC_UNIMPII] = "UNASSIGNED RESERVED 61",
106 [VEC_RESV62] = "UNASSIGNED RESERVED 62",
107 [VEC_RESV63] = "UNASSIGNED RESERVED 63",
108};
109
110static const char *space_names[] = {
111 [0] = "Space 0",
112 [USER_DATA] = "User Data",
113 [USER_PROGRAM] = "User Program",
114#ifndef CONFIG_SUN3
115 [3] = "Space 3",
3#else 116#else
4#include "traps_no.c" 117 [FC_CONTROL] = "Control",
118#endif
119 [4] = "Space 4",
120 [SUPER_DATA] = "Super Data",
121 [SUPER_PROGRAM] = "Super Program",
122 [CPU_SPACE] = "CPU"
123};
124
125void die_if_kernel(char *,struct pt_regs *,int);
126asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
127 unsigned long error_code);
128int send_fault_sig(struct pt_regs *regs);
129
130asmlinkage void trap_c(struct frame *fp);
131
132#if defined (CONFIG_M68060)
133static inline void access_error060 (struct frame *fp)
134{
135 unsigned long fslw = fp->un.fmt4.pc; /* is really FSLW for access error */
136
137#ifdef DEBUG
138 printk("fslw=%#lx, fa=%#lx\n", fslw, fp->un.fmt4.effaddr);
139#endif
140
141 if (fslw & MMU060_BPE) {
142 /* branch prediction error -> clear branch cache */
143 __asm__ __volatile__ ("movec %/cacr,%/d0\n\t"
144 "orl #0x00400000,%/d0\n\t"
145 "movec %/d0,%/cacr"
146 : : : "d0" );
147 /* return if there's no other error */
148 if (!(fslw & MMU060_ERR_BITS) && !(fslw & MMU060_SEE))
149 return;
150 }
151
152 if (fslw & (MMU060_DESC_ERR | MMU060_WP | MMU060_SP)) {
153 unsigned long errorcode;
154 unsigned long addr = fp->un.fmt4.effaddr;
155
156 if (fslw & MMU060_MA)
157 addr = (addr + PAGE_SIZE - 1) & PAGE_MASK;
158
159 errorcode = 1;
160 if (fslw & MMU060_DESC_ERR) {
161 __flush_tlb040_one(addr);
162 errorcode = 0;
163 }
164 if (fslw & MMU060_W)
165 errorcode |= 2;
166#ifdef DEBUG
167 printk("errorcode = %d\n", errorcode );
168#endif
169 do_page_fault(&fp->ptregs, addr, errorcode);
170 } else if (fslw & (MMU060_SEE)){
171 /* Software Emulation Error.
172 * fault during mem_read/mem_write in ifpsp060/os.S
173 */
174 send_fault_sig(&fp->ptregs);
175 } else if (!(fslw & (MMU060_RE|MMU060_WE)) ||
176 send_fault_sig(&fp->ptregs) > 0) {
177 printk("pc=%#lx, fa=%#lx\n", fp->ptregs.pc, fp->un.fmt4.effaddr);
178 printk( "68060 access error, fslw=%lx\n", fslw );
179 trap_c( fp );
180 }
181}
182#endif /* CONFIG_M68060 */
183
184#if defined (CONFIG_M68040)
185static inline unsigned long probe040(int iswrite, unsigned long addr, int wbs)
186{
187 unsigned long mmusr;
188 mm_segment_t old_fs = get_fs();
189
190 set_fs(MAKE_MM_SEG(wbs));
191
192 if (iswrite)
193 asm volatile (".chip 68040; ptestw (%0); .chip 68k" : : "a" (addr));
194 else
195 asm volatile (".chip 68040; ptestr (%0); .chip 68k" : : "a" (addr));
196
197 asm volatile (".chip 68040; movec %%mmusr,%0; .chip 68k" : "=r" (mmusr));
198
199 set_fs(old_fs);
200
201 return mmusr;
202}
203
204static inline int do_040writeback1(unsigned short wbs, unsigned long wba,
205 unsigned long wbd)
206{
207 int res = 0;
208 mm_segment_t old_fs = get_fs();
209
210 /* set_fs can not be moved, otherwise put_user() may oops */
211 set_fs(MAKE_MM_SEG(wbs));
212
213 switch (wbs & WBSIZ_040) {
214 case BA_SIZE_BYTE:
215 res = put_user(wbd & 0xff, (char __user *)wba);
216 break;
217 case BA_SIZE_WORD:
218 res = put_user(wbd & 0xffff, (short __user *)wba);
219 break;
220 case BA_SIZE_LONG:
221 res = put_user(wbd, (int __user *)wba);
222 break;
223 }
224
225 /* set_fs can not be moved, otherwise put_user() may oops */
226 set_fs(old_fs);
227
228
229#ifdef DEBUG
230 printk("do_040writeback1, res=%d\n",res);
231#endif
232
233 return res;
234}
235
236/* after an exception in a writeback the stack frame corresponding
237 * to that exception is discarded, set a few bits in the old frame
238 * to simulate what it should look like
239 */
240static inline void fix_xframe040(struct frame *fp, unsigned long wba, unsigned short wbs)
241{
242 fp->un.fmt7.faddr = wba;
243 fp->un.fmt7.ssw = wbs & 0xff;
244 if (wba != current->thread.faddr)
245 fp->un.fmt7.ssw |= MA_040;
246}
247
248static inline void do_040writebacks(struct frame *fp)
249{
250 int res = 0;
251#if 0
252 if (fp->un.fmt7.wb1s & WBV_040)
253 printk("access_error040: cannot handle 1st writeback. oops.\n");
254#endif
255
256 if ((fp->un.fmt7.wb2s & WBV_040) &&
257 !(fp->un.fmt7.wb2s & WBTT_040)) {
258 res = do_040writeback1(fp->un.fmt7.wb2s, fp->un.fmt7.wb2a,
259 fp->un.fmt7.wb2d);
260 if (res)
261 fix_xframe040(fp, fp->un.fmt7.wb2a, fp->un.fmt7.wb2s);
262 else
263 fp->un.fmt7.wb2s = 0;
264 }
265
266 /* do the 2nd wb only if the first one was successful (except for a kernel wb) */
267 if (fp->un.fmt7.wb3s & WBV_040 && (!res || fp->un.fmt7.wb3s & 4)) {
268 res = do_040writeback1(fp->un.fmt7.wb3s, fp->un.fmt7.wb3a,
269 fp->un.fmt7.wb3d);
270 if (res)
271 {
272 fix_xframe040(fp, fp->un.fmt7.wb3a, fp->un.fmt7.wb3s);
273
274 fp->un.fmt7.wb2s = fp->un.fmt7.wb3s;
275 fp->un.fmt7.wb3s &= (~WBV_040);
276 fp->un.fmt7.wb2a = fp->un.fmt7.wb3a;
277 fp->un.fmt7.wb2d = fp->un.fmt7.wb3d;
278 }
279 else
280 fp->un.fmt7.wb3s = 0;
281 }
282
283 if (res)
284 send_fault_sig(&fp->ptregs);
285}
286
287/*
288 * called from sigreturn(), must ensure userspace code didn't
289 * manipulate exception frame to circumvent protection, then complete
290 * pending writebacks
291 * we just clear TM2 to turn it into a userspace access
292 */
293asmlinkage void berr_040cleanup(struct frame *fp)
294{
295 fp->un.fmt7.wb2s &= ~4;
296 fp->un.fmt7.wb3s &= ~4;
297
298 do_040writebacks(fp);
299}
300
301static inline void access_error040(struct frame *fp)
302{
303 unsigned short ssw = fp->un.fmt7.ssw;
304 unsigned long mmusr;
305
306#ifdef DEBUG
307 printk("ssw=%#x, fa=%#lx\n", ssw, fp->un.fmt7.faddr);
308 printk("wb1s=%#x, wb2s=%#x, wb3s=%#x\n", fp->un.fmt7.wb1s,
309 fp->un.fmt7.wb2s, fp->un.fmt7.wb3s);
310 printk ("wb2a=%lx, wb3a=%lx, wb2d=%lx, wb3d=%lx\n",
311 fp->un.fmt7.wb2a, fp->un.fmt7.wb3a,
312 fp->un.fmt7.wb2d, fp->un.fmt7.wb3d);
313#endif
314
315 if (ssw & ATC_040) {
316 unsigned long addr = fp->un.fmt7.faddr;
317 unsigned long errorcode;
318
319 /*
320 * The MMU status has to be determined AFTER the address
321 * has been corrected if there was a misaligned access (MA).
322 */
323 if (ssw & MA_040)
324 addr = (addr + 7) & -8;
325
326 /* MMU error, get the MMUSR info for this access */
327 mmusr = probe040(!(ssw & RW_040), addr, ssw);
328#ifdef DEBUG
329 printk("mmusr = %lx\n", mmusr);
330#endif
331 errorcode = 1;
332 if (!(mmusr & MMU_R_040)) {
333 /* clear the invalid atc entry */
334 __flush_tlb040_one(addr);
335 errorcode = 0;
336 }
337
338 /* despite what documentation seems to say, RMW
339 * accesses have always both the LK and RW bits set */
340 if (!(ssw & RW_040) || (ssw & LK_040))
341 errorcode |= 2;
342
343 if (do_page_fault(&fp->ptregs, addr, errorcode)) {
344#ifdef DEBUG
345 printk("do_page_fault() !=0\n");
346#endif
347 if (user_mode(&fp->ptregs)){
348 /* delay writebacks after signal delivery */
349#ifdef DEBUG
350 printk(".. was usermode - return\n");
351#endif
352 return;
353 }
354 /* disable writeback into user space from kernel
355 * (if do_page_fault didn't fix the mapping,
356 * the writeback won't do good)
357 */
358disable_wb:
359#ifdef DEBUG
360 printk(".. disabling wb2\n");
361#endif
362 if (fp->un.fmt7.wb2a == fp->un.fmt7.faddr)
363 fp->un.fmt7.wb2s &= ~WBV_040;
364 if (fp->un.fmt7.wb3a == fp->un.fmt7.faddr)
365 fp->un.fmt7.wb3s &= ~WBV_040;
366 }
367 } else {
368 /* In case of a bus error we either kill the process or expect
369 * the kernel to catch the fault, which then is also responsible
370 * for cleaning up the mess.
371 */
372 current->thread.signo = SIGBUS;
373 current->thread.faddr = fp->un.fmt7.faddr;
374 if (send_fault_sig(&fp->ptregs) >= 0)
375 printk("68040 bus error (ssw=%x, faddr=%lx)\n", ssw,
376 fp->un.fmt7.faddr);
377 goto disable_wb;
378 }
379
380 do_040writebacks(fp);
381}
382#endif /* CONFIG_M68040 */
383
384#if defined(CONFIG_SUN3)
385#include <asm/sun3mmu.h>
386
387extern int mmu_emu_handle_fault (unsigned long, int, int);
388
389/* sun3 version of bus_error030 */
390
391static inline void bus_error030 (struct frame *fp)
392{
393 unsigned char buserr_type = sun3_get_buserr ();
394 unsigned long addr, errorcode;
395 unsigned short ssw = fp->un.fmtb.ssw;
396 extern unsigned long _sun3_map_test_start, _sun3_map_test_end;
397
398#ifdef DEBUG
399 if (ssw & (FC | FB))
400 printk ("Instruction fault at %#010lx\n",
401 ssw & FC ?
402 fp->ptregs.format == 0xa ? fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2
403 :
404 fp->ptregs.format == 0xa ? fp->ptregs.pc + 4 : fp->un.fmtb.baddr);
405 if (ssw & DF)
406 printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n",
407 ssw & RW ? "read" : "write",
408 fp->un.fmtb.daddr,
409 space_names[ssw & DFC], fp->ptregs.pc);
410#endif
411
412 /*
413 * Check if this page should be demand-mapped. This needs to go before
414 * the testing for a bad kernel-space access (demand-mapping applies
415 * to kernel accesses too).
416 */
417
418 if ((ssw & DF)
419 && (buserr_type & (SUN3_BUSERR_PROTERR | SUN3_BUSERR_INVALID))) {
420 if (mmu_emu_handle_fault (fp->un.fmtb.daddr, ssw & RW, 0))
421 return;
422 }
423
424 /* Check for kernel-space pagefault (BAD). */
425 if (fp->ptregs.sr & PS_S) {
426 /* kernel fault must be a data fault to user space */
427 if (! ((ssw & DF) && ((ssw & DFC) == USER_DATA))) {
428 // try checking the kernel mappings before surrender
429 if (mmu_emu_handle_fault (fp->un.fmtb.daddr, ssw & RW, 1))
430 return;
431 /* instruction fault or kernel data fault! */
432 if (ssw & (FC | FB))
433 printk ("Instruction fault at %#010lx\n",
434 fp->ptregs.pc);
435 if (ssw & DF) {
436 /* was this fault incurred testing bus mappings? */
437 if((fp->ptregs.pc >= (unsigned long)&_sun3_map_test_start) &&
438 (fp->ptregs.pc <= (unsigned long)&_sun3_map_test_end)) {
439 send_fault_sig(&fp->ptregs);
440 return;
441 }
442
443 printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n",
444 ssw & RW ? "read" : "write",
445 fp->un.fmtb.daddr,
446 space_names[ssw & DFC], fp->ptregs.pc);
447 }
448 printk ("BAD KERNEL BUSERR\n");
449
450 die_if_kernel("Oops", &fp->ptregs,0);
451 force_sig(SIGKILL, current);
452 return;
453 }
454 } else {
455 /* user fault */
456 if (!(ssw & (FC | FB)) && !(ssw & DF))
457 /* not an instruction fault or data fault! BAD */
458 panic ("USER BUSERR w/o instruction or data fault");
459 }
460
461
462 /* First handle the data fault, if any. */
463 if (ssw & DF) {
464 addr = fp->un.fmtb.daddr;
465
466// errorcode bit 0: 0 -> no page 1 -> protection fault
467// errorcode bit 1: 0 -> read fault 1 -> write fault
468
469// (buserr_type & SUN3_BUSERR_PROTERR) -> protection fault
470// (buserr_type & SUN3_BUSERR_INVALID) -> invalid page fault
471
472 if (buserr_type & SUN3_BUSERR_PROTERR)
473 errorcode = 0x01;
474 else if (buserr_type & SUN3_BUSERR_INVALID)
475 errorcode = 0x00;
476 else {
477#ifdef DEBUG
478 printk ("*** unexpected busfault type=%#04x\n", buserr_type);
479 printk ("invalid %s access at %#lx from pc %#lx\n",
480 !(ssw & RW) ? "write" : "read", addr,
481 fp->ptregs.pc);
482#endif
483 die_if_kernel ("Oops", &fp->ptregs, buserr_type);
484 force_sig (SIGBUS, current);
485 return;
486 }
487
488//todo: wtf is RM bit? --m
489 if (!(ssw & RW) || ssw & RM)
490 errorcode |= 0x02;
491
492 /* Handle page fault. */
493 do_page_fault (&fp->ptregs, addr, errorcode);
494
495 /* Retry the data fault now. */
496 return;
497 }
498
499 /* Now handle the instruction fault. */
500
501 /* Get the fault address. */
502 if (fp->ptregs.format == 0xA)
503 addr = fp->ptregs.pc + 4;
504 else
505 addr = fp->un.fmtb.baddr;
506 if (ssw & FC)
507 addr -= 2;
508
509 if (buserr_type & SUN3_BUSERR_INVALID) {
510 if (!mmu_emu_handle_fault (fp->un.fmtb.daddr, 1, 0))
511 do_page_fault (&fp->ptregs, addr, 0);
512 } else {
513#ifdef DEBUG
514 printk ("protection fault on insn access (segv).\n");
515#endif
516 force_sig (SIGSEGV, current);
517 }
518}
519#else
520#if defined(CPU_M68020_OR_M68030)
521static inline void bus_error030 (struct frame *fp)
522{
523 volatile unsigned short temp;
524 unsigned short mmusr;
525 unsigned long addr, errorcode;
526 unsigned short ssw = fp->un.fmtb.ssw;
527#ifdef DEBUG
528 unsigned long desc;
529
530 printk ("pid = %x ", current->pid);
531 printk ("SSW=%#06x ", ssw);
532
533 if (ssw & (FC | FB))
534 printk ("Instruction fault at %#010lx\n",
535 ssw & FC ?
536 fp->ptregs.format == 0xa ? fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2
537 :
538 fp->ptregs.format == 0xa ? fp->ptregs.pc + 4 : fp->un.fmtb.baddr);
539 if (ssw & DF)
540 printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n",
541 ssw & RW ? "read" : "write",
542 fp->un.fmtb.daddr,
543 space_names[ssw & DFC], fp->ptregs.pc);
544#endif
545
546 /* ++andreas: If a data fault and an instruction fault happen
547 at the same time map in both pages. */
548
549 /* First handle the data fault, if any. */
550 if (ssw & DF) {
551 addr = fp->un.fmtb.daddr;
552
553#ifdef DEBUG
554 asm volatile ("ptestr %3,%2@,#7,%0\n\t"
555 "pmove %%psr,%1@"
556 : "=a&" (desc)
557 : "a" (&temp), "a" (addr), "d" (ssw));
558#else
559 asm volatile ("ptestr %2,%1@,#7\n\t"
560 "pmove %%psr,%0@"
561 : : "a" (&temp), "a" (addr), "d" (ssw));
562#endif
563 mmusr = temp;
564
565#ifdef DEBUG
566 printk("mmusr is %#x for addr %#lx in task %p\n",
567 mmusr, addr, current);
568 printk("descriptor address is %#lx, contents %#lx\n",
569 __va(desc), *(unsigned long *)__va(desc));
570#endif
571
572 errorcode = (mmusr & MMU_I) ? 0 : 1;
573 if (!(ssw & RW) || (ssw & RM))
574 errorcode |= 2;
575
576 if (mmusr & (MMU_I | MMU_WP)) {
577 if (ssw & 4) {
578 printk("Data %s fault at %#010lx in %s (pc=%#lx)\n",
579 ssw & RW ? "read" : "write",
580 fp->un.fmtb.daddr,
581 space_names[ssw & DFC], fp->ptregs.pc);
582 goto buserr;
583 }
584 /* Don't try to do anything further if an exception was
585 handled. */
586 if (do_page_fault (&fp->ptregs, addr, errorcode) < 0)
587 return;
588 } else if (!(mmusr & MMU_I)) {
589 /* probably a 020 cas fault */
590 if (!(ssw & RM) && send_fault_sig(&fp->ptregs) > 0)
591 printk("unexpected bus error (%#x,%#x)\n", ssw, mmusr);
592 } else if (mmusr & (MMU_B|MMU_L|MMU_S)) {
593 printk("invalid %s access at %#lx from pc %#lx\n",
594 !(ssw & RW) ? "write" : "read", addr,
595 fp->ptregs.pc);
596 die_if_kernel("Oops",&fp->ptregs,mmusr);
597 force_sig(SIGSEGV, current);
598 return;
599 } else {
600#if 0
601 static volatile long tlong;
602#endif
603
604 printk("weird %s access at %#lx from pc %#lx (ssw is %#x)\n",
605 !(ssw & RW) ? "write" : "read", addr,
606 fp->ptregs.pc, ssw);
607 asm volatile ("ptestr #1,%1@,#0\n\t"
608 "pmove %%psr,%0@"
609 : /* no outputs */
610 : "a" (&temp), "a" (addr));
611 mmusr = temp;
612
613 printk ("level 0 mmusr is %#x\n", mmusr);
614#if 0
615 asm volatile ("pmove %%tt0,%0@"
616 : /* no outputs */
617 : "a" (&tlong));
618 printk("tt0 is %#lx, ", tlong);
619 asm volatile ("pmove %%tt1,%0@"
620 : /* no outputs */
621 : "a" (&tlong));
622 printk("tt1 is %#lx\n", tlong);
623#endif
624#ifdef DEBUG
625 printk("Unknown SIGSEGV - 1\n");
626#endif
627 die_if_kernel("Oops",&fp->ptregs,mmusr);
628 force_sig(SIGSEGV, current);
629 return;
630 }
631
632 /* setup an ATC entry for the access about to be retried */
633 if (!(ssw & RW) || (ssw & RM))
634 asm volatile ("ploadw %1,%0@" : /* no outputs */
635 : "a" (addr), "d" (ssw));
636 else
637 asm volatile ("ploadr %1,%0@" : /* no outputs */
638 : "a" (addr), "d" (ssw));
639 }
640
641 /* Now handle the instruction fault. */
642
643 if (!(ssw & (FC|FB)))
644 return;
645
646 if (fp->ptregs.sr & PS_S) {
647 printk("Instruction fault at %#010lx\n",
648 fp->ptregs.pc);
649 buserr:
650 printk ("BAD KERNEL BUSERR\n");
651 die_if_kernel("Oops",&fp->ptregs,0);
652 force_sig(SIGKILL, current);
653 return;
654 }
655
656 /* get the fault address */
657 if (fp->ptregs.format == 10)
658 addr = fp->ptregs.pc + 4;
659 else
660 addr = fp->un.fmtb.baddr;
661 if (ssw & FC)
662 addr -= 2;
663
664 if ((ssw & DF) && ((addr ^ fp->un.fmtb.daddr) & PAGE_MASK) == 0)
665 /* Insn fault on same page as data fault. But we
666 should still create the ATC entry. */
667 goto create_atc_entry;
668
669#ifdef DEBUG
670 asm volatile ("ptestr #1,%2@,#7,%0\n\t"
671 "pmove %%psr,%1@"
672 : "=a&" (desc)
673 : "a" (&temp), "a" (addr));
674#else
675 asm volatile ("ptestr #1,%1@,#7\n\t"
676 "pmove %%psr,%0@"
677 : : "a" (&temp), "a" (addr));
678#endif
679 mmusr = temp;
680
681#ifdef DEBUG
682 printk ("mmusr is %#x for addr %#lx in task %p\n",
683 mmusr, addr, current);
684 printk ("descriptor address is %#lx, contents %#lx\n",
685 __va(desc), *(unsigned long *)__va(desc));
686#endif
687
688 if (mmusr & MMU_I)
689 do_page_fault (&fp->ptregs, addr, 0);
690 else if (mmusr & (MMU_B|MMU_L|MMU_S)) {
691 printk ("invalid insn access at %#lx from pc %#lx\n",
692 addr, fp->ptregs.pc);
693#ifdef DEBUG
694 printk("Unknown SIGSEGV - 2\n");
695#endif
696 die_if_kernel("Oops",&fp->ptregs,mmusr);
697 force_sig(SIGSEGV, current);
698 return;
699 }
700
701create_atc_entry:
702 /* setup an ATC entry for the access about to be retried */
703 asm volatile ("ploadr #2,%0@" : /* no outputs */
704 : "a" (addr));
705}
706#endif /* CPU_M68020_OR_M68030 */
707#endif /* !CONFIG_SUN3 */
708
709asmlinkage void buserr_c(struct frame *fp)
710{
711 /* Only set esp0 if coming from user mode */
712 if (user_mode(&fp->ptregs))
713 current->thread.esp0 = (unsigned long) fp;
714
715#ifdef DEBUG
716 printk ("*** Bus Error *** Format is %x\n", fp->ptregs.format);
717#endif
718
719 switch (fp->ptregs.format) {
720#if defined (CONFIG_M68060)
721 case 4: /* 68060 access error */
722 access_error060 (fp);
723 break;
724#endif
725#if defined (CONFIG_M68040)
726 case 0x7: /* 68040 access error */
727 access_error040 (fp);
728 break;
729#endif
730#if defined (CPU_M68020_OR_M68030)
731 case 0xa:
732 case 0xb:
733 bus_error030 (fp);
734 break;
735#endif
736 default:
737 die_if_kernel("bad frame format",&fp->ptregs,0);
738#ifdef DEBUG
739 printk("Unknown SIGSEGV - 4\n");
740#endif
741 force_sig(SIGSEGV, current);
742 }
743}
744
745
746static int kstack_depth_to_print = 48;
747
748void show_trace(unsigned long *stack)
749{
750 unsigned long *endstack;
751 unsigned long addr;
752 int i;
753
754 printk("Call Trace:");
755 addr = (unsigned long)stack + THREAD_SIZE - 1;
756 endstack = (unsigned long *)(addr & -THREAD_SIZE);
757 i = 0;
758 while (stack + 1 <= endstack) {
759 addr = *stack++;
760 /*
761 * If the address is either in the text segment of the
762 * kernel, or in the region which contains vmalloc'ed
763 * memory, it *may* be the address of a calling
764 * routine; if so, print it so that someone tracing
765 * down the cause of the crash will be able to figure
766 * out the call path that was taken.
767 */
768 if (__kernel_text_address(addr)) {
769#ifndef CONFIG_KALLSYMS
770 if (i % 5 == 0)
771 printk("\n ");
772#endif
773 printk(" [<%08lx>] %pS\n", addr, (void *)addr);
774 i++;
775 }
776 }
777 printk("\n");
778}
779
780void show_registers(struct pt_regs *regs)
781{
782 struct frame *fp = (struct frame *)regs;
783 mm_segment_t old_fs = get_fs();
784 u16 c, *cp;
785 unsigned long addr;
786 int i;
787
788 print_modules();
789 printk("PC: [<%08lx>] %pS\n", regs->pc, (void *)regs->pc);
790 printk("SR: %04x SP: %p a2: %08lx\n", regs->sr, regs, regs->a2);
791 printk("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
792 regs->d0, regs->d1, regs->d2, regs->d3);
793 printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
794 regs->d4, regs->d5, regs->a0, regs->a1);
795
796 printk("Process %s (pid: %d, task=%p)\n",
797 current->comm, task_pid_nr(current), current);
798 addr = (unsigned long)&fp->un;
799 printk("Frame format=%X ", regs->format);
800 switch (regs->format) {
801 case 0x2:
802 printk("instr addr=%08lx\n", fp->un.fmt2.iaddr);
803 addr += sizeof(fp->un.fmt2);
804 break;
805 case 0x3:
806 printk("eff addr=%08lx\n", fp->un.fmt3.effaddr);
807 addr += sizeof(fp->un.fmt3);
808 break;
809 case 0x4:
810 printk((CPU_IS_060 ? "fault addr=%08lx fslw=%08lx\n"
811 : "eff addr=%08lx pc=%08lx\n"),
812 fp->un.fmt4.effaddr, fp->un.fmt4.pc);
813 addr += sizeof(fp->un.fmt4);
814 break;
815 case 0x7:
816 printk("eff addr=%08lx ssw=%04x faddr=%08lx\n",
817 fp->un.fmt7.effaddr, fp->un.fmt7.ssw, fp->un.fmt7.faddr);
818 printk("wb 1 stat/addr/data: %04x %08lx %08lx\n",
819 fp->un.fmt7.wb1s, fp->un.fmt7.wb1a, fp->un.fmt7.wb1dpd0);
820 printk("wb 2 stat/addr/data: %04x %08lx %08lx\n",
821 fp->un.fmt7.wb2s, fp->un.fmt7.wb2a, fp->un.fmt7.wb2d);
822 printk("wb 3 stat/addr/data: %04x %08lx %08lx\n",
823 fp->un.fmt7.wb3s, fp->un.fmt7.wb3a, fp->un.fmt7.wb3d);
824 printk("push data: %08lx %08lx %08lx %08lx\n",
825 fp->un.fmt7.wb1dpd0, fp->un.fmt7.pd1, fp->un.fmt7.pd2,
826 fp->un.fmt7.pd3);
827 addr += sizeof(fp->un.fmt7);
828 break;
829 case 0x9:
830 printk("instr addr=%08lx\n", fp->un.fmt9.iaddr);
831 addr += sizeof(fp->un.fmt9);
832 break;
833 case 0xa:
834 printk("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n",
835 fp->un.fmta.ssw, fp->un.fmta.isc, fp->un.fmta.isb,
836 fp->un.fmta.daddr, fp->un.fmta.dobuf);
837 addr += sizeof(fp->un.fmta);
838 break;
839 case 0xb:
840 printk("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n",
841 fp->un.fmtb.ssw, fp->un.fmtb.isc, fp->un.fmtb.isb,
842 fp->un.fmtb.daddr, fp->un.fmtb.dobuf);
843 printk("baddr=%08lx dibuf=%08lx ver=%x\n",
844 fp->un.fmtb.baddr, fp->un.fmtb.dibuf, fp->un.fmtb.ver);
845 addr += sizeof(fp->un.fmtb);
846 break;
847 default:
848 printk("\n");
849 }
850 show_stack(NULL, (unsigned long *)addr);
851
852 printk("Code:");
853 set_fs(KERNEL_DS);
854 cp = (u16 *)regs->pc;
855 for (i = -8; i < 16; i++) {
856 if (get_user(c, cp + i) && i >= 0) {
857 printk(" Bad PC value.");
858 break;
859 }
860 printk(i ? " %04x" : " <%04x>", c);
861 }
862 set_fs(old_fs);
863 printk ("\n");
864}
865
866void show_stack(struct task_struct *task, unsigned long *stack)
867{
868 unsigned long *p;
869 unsigned long *endstack;
870 int i;
871
872 if (!stack) {
873 if (task)
874 stack = (unsigned long *)task->thread.esp0;
875 else
876 stack = (unsigned long *)&stack;
877 }
878 endstack = (unsigned long *)(((unsigned long)stack + THREAD_SIZE - 1) & -THREAD_SIZE);
879
880 printk("Stack from %08lx:", (unsigned long)stack);
881 p = stack;
882 for (i = 0; i < kstack_depth_to_print; i++) {
883 if (p + 1 > endstack)
884 break;
885 if (i % 8 == 0)
886 printk("\n ");
887 printk(" %08lx", *p++);
888 }
889 printk("\n");
890 show_trace(stack);
891}
892
893/*
894 * The architecture-independent backtrace generator
895 */
896void dump_stack(void)
897{
898 unsigned long stack;
899
900 show_trace(&stack);
901}
902
903EXPORT_SYMBOL(dump_stack);
904
905/*
906 * The vector number returned in the frame pointer may also contain
907 * the "fs" (Fault Status) bits on ColdFire. These are in the bottom
908 * 2 bits, and upper 2 bits. So we need to mask out the real vector
909 * number before using it in comparisons. You don't need to do this on
910 * real 68k parts, but it won't hurt either.
911 */
912
913void bad_super_trap (struct frame *fp)
914{
915 int vector = (fp->ptregs.vector >> 2) & 0xff;
916
917 console_verbose();
918 if (vector < ARRAY_SIZE(vec_names))
919 printk ("*** %s *** FORMAT=%X\n",
920 vec_names[vector],
921 fp->ptregs.format);
922 else
923 printk ("*** Exception %d *** FORMAT=%X\n",
924 vector, fp->ptregs.format);
925 if (vector == VEC_ADDRERR && CPU_IS_020_OR_030) {
926 unsigned short ssw = fp->un.fmtb.ssw;
927
928 printk ("SSW=%#06x ", ssw);
929
930 if (ssw & RC)
931 printk ("Pipe stage C instruction fault at %#010lx\n",
932 (fp->ptregs.format) == 0xA ?
933 fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2);
934 if (ssw & RB)
935 printk ("Pipe stage B instruction fault at %#010lx\n",
936 (fp->ptregs.format) == 0xA ?
937 fp->ptregs.pc + 4 : fp->un.fmtb.baddr);
938 if (ssw & DF)
939 printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n",
940 ssw & RW ? "read" : "write",
941 fp->un.fmtb.daddr, space_names[ssw & DFC],
942 fp->ptregs.pc);
943 }
944 printk ("Current process id is %d\n", task_pid_nr(current));
945 die_if_kernel("BAD KERNEL TRAP", &fp->ptregs, 0);
946}
947
948asmlinkage void trap_c(struct frame *fp)
949{
950 int sig;
951 int vector = (fp->ptregs.vector >> 2) & 0xff;
952 siginfo_t info;
953
954 if (fp->ptregs.sr & PS_S) {
955 if (vector == VEC_TRACE) {
956 /* traced a trapping instruction on a 68020/30,
957 * real exception will be executed afterwards.
958 */
959 } else if (!handle_kernel_fault(&fp->ptregs))
960 bad_super_trap(fp);
961 return;
962 }
963
964 /* send the appropriate signal to the user program */
965 switch (vector) {
966 case VEC_ADDRERR:
967 info.si_code = BUS_ADRALN;
968 sig = SIGBUS;
969 break;
970 case VEC_ILLEGAL:
971 case VEC_LINE10:
972 case VEC_LINE11:
973 info.si_code = ILL_ILLOPC;
974 sig = SIGILL;
975 break;
976 case VEC_PRIV:
977 info.si_code = ILL_PRVOPC;
978 sig = SIGILL;
979 break;
980 case VEC_COPROC:
981 info.si_code = ILL_COPROC;
982 sig = SIGILL;
983 break;
984 case VEC_TRAP1:
985 case VEC_TRAP2:
986 case VEC_TRAP3:
987 case VEC_TRAP4:
988 case VEC_TRAP5:
989 case VEC_TRAP6:
990 case VEC_TRAP7:
991 case VEC_TRAP8:
992 case VEC_TRAP9:
993 case VEC_TRAP10:
994 case VEC_TRAP11:
995 case VEC_TRAP12:
996 case VEC_TRAP13:
997 case VEC_TRAP14:
998 info.si_code = ILL_ILLTRP;
999 sig = SIGILL;
1000 break;
1001 case VEC_FPBRUC:
1002 case VEC_FPOE:
1003 case VEC_FPNAN:
1004 info.si_code = FPE_FLTINV;
1005 sig = SIGFPE;
1006 break;
1007 case VEC_FPIR:
1008 info.si_code = FPE_FLTRES;
1009 sig = SIGFPE;
1010 break;
1011 case VEC_FPDIVZ:
1012 info.si_code = FPE_FLTDIV;
1013 sig = SIGFPE;
1014 break;
1015 case VEC_FPUNDER:
1016 info.si_code = FPE_FLTUND;
1017 sig = SIGFPE;
1018 break;
1019 case VEC_FPOVER:
1020 info.si_code = FPE_FLTOVF;
1021 sig = SIGFPE;
1022 break;
1023 case VEC_ZERODIV:
1024 info.si_code = FPE_INTDIV;
1025 sig = SIGFPE;
1026 break;
1027 case VEC_CHK:
1028 case VEC_TRAP:
1029 info.si_code = FPE_INTOVF;
1030 sig = SIGFPE;
1031 break;
1032 case VEC_TRACE: /* ptrace single step */
1033 info.si_code = TRAP_TRACE;
1034 sig = SIGTRAP;
1035 break;
1036 case VEC_TRAP15: /* breakpoint */
1037 info.si_code = TRAP_BRKPT;
1038 sig = SIGTRAP;
1039 break;
1040 default:
1041 info.si_code = ILL_ILLOPC;
1042 sig = SIGILL;
1043 break;
1044 }
1045 info.si_signo = sig;
1046 info.si_errno = 0;
1047 switch (fp->ptregs.format) {
1048 default:
1049 info.si_addr = (void *) fp->ptregs.pc;
1050 break;
1051 case 2:
1052 info.si_addr = (void *) fp->un.fmt2.iaddr;
1053 break;
1054 case 7:
1055 info.si_addr = (void *) fp->un.fmt7.effaddr;
1056 break;
1057 case 9:
1058 info.si_addr = (void *) fp->un.fmt9.iaddr;
1059 break;
1060 case 10:
1061 info.si_addr = (void *) fp->un.fmta.daddr;
1062 break;
1063 case 11:
1064 info.si_addr = (void *) fp->un.fmtb.daddr;
1065 break;
1066 }
1067 force_sig_info (sig, &info, current);
1068}
1069
1070void die_if_kernel (char *str, struct pt_regs *fp, int nr)
1071{
1072 if (!(fp->sr & PS_S))
1073 return;
1074
1075 console_verbose();
1076 printk("%s: %08x\n",str,nr);
1077 show_registers(fp);
1078 add_taint(TAINT_DIE);
1079 do_exit(SIGSEGV);
1080}
1081
1082asmlinkage void set_esp0(unsigned long ssp)
1083{
1084 current->thread.esp0 = ssp;
1085}
1086
1087/*
1088 * This function is called if an error occur while accessing
1089 * user-space from the fpsp040 code.
1090 */
1091asmlinkage void fpsp040_die(void)
1092{
1093 do_exit(SIGSEGV);
1094}
1095
1096#ifdef CONFIG_M68KFPU_EMU
1097asmlinkage void fpemu_signal(int signal, int code, void *addr)
1098{
1099 siginfo_t info;
1100
1101 info.si_signo = signal;
1102 info.si_errno = 0;
1103 info.si_code = code;
1104 info.si_addr = addr;
1105 force_sig_info(signal, &info, current);
1106}
5#endif 1107#endif
diff --git a/arch/m68k/kernel/traps_mm.c b/arch/m68k/kernel/traps_mm.c
deleted file mode 100644
index 4022bbc2887..00000000000
--- a/arch/m68k/kernel/traps_mm.c
+++ /dev/null
@@ -1,1207 +0,0 @@
1/*
2 * linux/arch/m68k/kernel/traps.c
3 *
4 * Copyright (C) 1993, 1994 by Hamish Macdonald
5 *
6 * 68040 fixes by Michael Rausch
7 * 68040 fixes by Martin Apel
8 * 68040 fixes and writeback by Richard Zidlicky
9 * 68060 fixes by Roman Hodek
10 * 68060 fixes by Jesper Skov
11 *
12 * This file is subject to the terms and conditions of the GNU General Public
13 * License. See the file COPYING in the main directory of this archive
14 * for more details.
15 */
16
17/*
18 * Sets up all exception vectors
19 */
20
21#include <linux/sched.h>
22#include <linux/signal.h>
23#include <linux/kernel.h>
24#include <linux/mm.h>
25#include <linux/module.h>
26#include <linux/user.h>
27#include <linux/string.h>
28#include <linux/linkage.h>
29#include <linux/init.h>
30#include <linux/ptrace.h>
31#include <linux/kallsyms.h>
32
33#include <asm/setup.h>
34#include <asm/fpu.h>
35#include <asm/system.h>
36#include <asm/uaccess.h>
37#include <asm/traps.h>
38#include <asm/pgalloc.h>
39#include <asm/machdep.h>
40#include <asm/siginfo.h>
41
42/* assembler routines */
43asmlinkage void system_call(void);
44asmlinkage void buserr(void);
45asmlinkage void trap(void);
46asmlinkage void nmihandler(void);
47#ifdef CONFIG_M68KFPU_EMU
48asmlinkage void fpu_emu(void);
49#endif
50
51e_vector vectors[256];
52
53/* nmi handler for the Amiga */
54asm(".text\n"
55 __ALIGN_STR "\n"
56 "nmihandler: rte");
57
58/*
59 * this must be called very early as the kernel might
60 * use some instruction that are emulated on the 060
61 * and so we're prepared for early probe attempts (e.g. nf_init).
62 */
63void __init base_trap_init(void)
64{
65 if (MACH_IS_SUN3X) {
66 extern e_vector *sun3x_prom_vbr;
67
68 __asm__ volatile ("movec %%vbr, %0" : "=r" (sun3x_prom_vbr));
69 }
70
71 /* setup the exception vector table */
72 __asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)vectors));
73
74 if (CPU_IS_060) {
75 /* set up ISP entry points */
76 asmlinkage void unimp_vec(void) asm ("_060_isp_unimp");
77
78 vectors[VEC_UNIMPII] = unimp_vec;
79 }
80
81 vectors[VEC_BUSERR] = buserr;
82 vectors[VEC_ILLEGAL] = trap;
83 vectors[VEC_SYS] = system_call;
84}
85
86void __init trap_init (void)
87{
88 int i;
89
90 for (i = VEC_SPUR; i <= VEC_INT7; i++)
91 vectors[i] = bad_inthandler;
92
93 for (i = 0; i < VEC_USER; i++)
94 if (!vectors[i])
95 vectors[i] = trap;
96
97 for (i = VEC_USER; i < 256; i++)
98 vectors[i] = bad_inthandler;
99
100#ifdef CONFIG_M68KFPU_EMU
101 if (FPU_IS_EMU)
102 vectors[VEC_LINE11] = fpu_emu;
103#endif
104
105 if (CPU_IS_040 && !FPU_IS_EMU) {
106 /* set up FPSP entry points */
107 asmlinkage void dz_vec(void) asm ("dz");
108 asmlinkage void inex_vec(void) asm ("inex");
109 asmlinkage void ovfl_vec(void) asm ("ovfl");
110 asmlinkage void unfl_vec(void) asm ("unfl");
111 asmlinkage void snan_vec(void) asm ("snan");
112 asmlinkage void operr_vec(void) asm ("operr");
113 asmlinkage void bsun_vec(void) asm ("bsun");
114 asmlinkage void fline_vec(void) asm ("fline");
115 asmlinkage void unsupp_vec(void) asm ("unsupp");
116
117 vectors[VEC_FPDIVZ] = dz_vec;
118 vectors[VEC_FPIR] = inex_vec;
119 vectors[VEC_FPOVER] = ovfl_vec;
120 vectors[VEC_FPUNDER] = unfl_vec;
121 vectors[VEC_FPNAN] = snan_vec;
122 vectors[VEC_FPOE] = operr_vec;
123 vectors[VEC_FPBRUC] = bsun_vec;
124 vectors[VEC_LINE11] = fline_vec;
125 vectors[VEC_FPUNSUP] = unsupp_vec;
126 }
127
128 if (CPU_IS_060 && !FPU_IS_EMU) {
129 /* set up IFPSP entry points */
130 asmlinkage void snan_vec6(void) asm ("_060_fpsp_snan");
131 asmlinkage void operr_vec6(void) asm ("_060_fpsp_operr");
132 asmlinkage void ovfl_vec6(void) asm ("_060_fpsp_ovfl");
133 asmlinkage void unfl_vec6(void) asm ("_060_fpsp_unfl");
134 asmlinkage void dz_vec6(void) asm ("_060_fpsp_dz");
135 asmlinkage void inex_vec6(void) asm ("_060_fpsp_inex");
136 asmlinkage void fline_vec6(void) asm ("_060_fpsp_fline");
137 asmlinkage void unsupp_vec6(void) asm ("_060_fpsp_unsupp");
138 asmlinkage void effadd_vec6(void) asm ("_060_fpsp_effadd");
139
140 vectors[VEC_FPNAN] = snan_vec6;
141 vectors[VEC_FPOE] = operr_vec6;
142 vectors[VEC_FPOVER] = ovfl_vec6;
143 vectors[VEC_FPUNDER] = unfl_vec6;
144 vectors[VEC_FPDIVZ] = dz_vec6;
145 vectors[VEC_FPIR] = inex_vec6;
146 vectors[VEC_LINE11] = fline_vec6;
147 vectors[VEC_FPUNSUP] = unsupp_vec6;
148 vectors[VEC_UNIMPEA] = effadd_vec6;
149 }
150
151 /* if running on an amiga, make the NMI interrupt do nothing */
152 if (MACH_IS_AMIGA) {
153 vectors[VEC_INT7] = nmihandler;
154 }
155}
156
157
158static const char *vec_names[] = {
159 [VEC_RESETSP] = "RESET SP",
160 [VEC_RESETPC] = "RESET PC",
161 [VEC_BUSERR] = "BUS ERROR",
162 [VEC_ADDRERR] = "ADDRESS ERROR",
163 [VEC_ILLEGAL] = "ILLEGAL INSTRUCTION",
164 [VEC_ZERODIV] = "ZERO DIVIDE",
165 [VEC_CHK] = "CHK",
166 [VEC_TRAP] = "TRAPcc",
167 [VEC_PRIV] = "PRIVILEGE VIOLATION",
168 [VEC_TRACE] = "TRACE",
169 [VEC_LINE10] = "LINE 1010",
170 [VEC_LINE11] = "LINE 1111",
171 [VEC_RESV12] = "UNASSIGNED RESERVED 12",
172 [VEC_COPROC] = "COPROCESSOR PROTOCOL VIOLATION",
173 [VEC_FORMAT] = "FORMAT ERROR",
174 [VEC_UNINT] = "UNINITIALIZED INTERRUPT",
175 [VEC_RESV16] = "UNASSIGNED RESERVED 16",
176 [VEC_RESV17] = "UNASSIGNED RESERVED 17",
177 [VEC_RESV18] = "UNASSIGNED RESERVED 18",
178 [VEC_RESV19] = "UNASSIGNED RESERVED 19",
179 [VEC_RESV20] = "UNASSIGNED RESERVED 20",
180 [VEC_RESV21] = "UNASSIGNED RESERVED 21",
181 [VEC_RESV22] = "UNASSIGNED RESERVED 22",
182 [VEC_RESV23] = "UNASSIGNED RESERVED 23",
183 [VEC_SPUR] = "SPURIOUS INTERRUPT",
184 [VEC_INT1] = "LEVEL 1 INT",
185 [VEC_INT2] = "LEVEL 2 INT",
186 [VEC_INT3] = "LEVEL 3 INT",
187 [VEC_INT4] = "LEVEL 4 INT",
188 [VEC_INT5] = "LEVEL 5 INT",
189 [VEC_INT6] = "LEVEL 6 INT",
190 [VEC_INT7] = "LEVEL 7 INT",
191 [VEC_SYS] = "SYSCALL",
192 [VEC_TRAP1] = "TRAP #1",
193 [VEC_TRAP2] = "TRAP #2",
194 [VEC_TRAP3] = "TRAP #3",
195 [VEC_TRAP4] = "TRAP #4",
196 [VEC_TRAP5] = "TRAP #5",
197 [VEC_TRAP6] = "TRAP #6",
198 [VEC_TRAP7] = "TRAP #7",
199 [VEC_TRAP8] = "TRAP #8",
200 [VEC_TRAP9] = "TRAP #9",
201 [VEC_TRAP10] = "TRAP #10",
202 [VEC_TRAP11] = "TRAP #11",
203 [VEC_TRAP12] = "TRAP #12",
204 [VEC_TRAP13] = "TRAP #13",
205 [VEC_TRAP14] = "TRAP #14",
206 [VEC_TRAP15] = "TRAP #15",
207 [VEC_FPBRUC] = "FPCP BSUN",
208 [VEC_FPIR] = "FPCP INEXACT",
209 [VEC_FPDIVZ] = "FPCP DIV BY 0",
210 [VEC_FPUNDER] = "FPCP UNDERFLOW",
211 [VEC_FPOE] = "FPCP OPERAND ERROR",
212 [VEC_FPOVER] = "FPCP OVERFLOW",
213 [VEC_FPNAN] = "FPCP SNAN",
214 [VEC_FPUNSUP] = "FPCP UNSUPPORTED OPERATION",
215 [VEC_MMUCFG] = "MMU CONFIGURATION ERROR",
216 [VEC_MMUILL] = "MMU ILLEGAL OPERATION ERROR",
217 [VEC_MMUACC] = "MMU ACCESS LEVEL VIOLATION ERROR",
218 [VEC_RESV59] = "UNASSIGNED RESERVED 59",
219 [VEC_UNIMPEA] = "UNASSIGNED RESERVED 60",
220 [VEC_UNIMPII] = "UNASSIGNED RESERVED 61",
221 [VEC_RESV62] = "UNASSIGNED RESERVED 62",
222 [VEC_RESV63] = "UNASSIGNED RESERVED 63",
223};
224
225static const char *space_names[] = {
226 [0] = "Space 0",
227 [USER_DATA] = "User Data",
228 [USER_PROGRAM] = "User Program",
229#ifndef CONFIG_SUN3
230 [3] = "Space 3",
231#else
232 [FC_CONTROL] = "Control",
233#endif
234 [4] = "Space 4",
235 [SUPER_DATA] = "Super Data",
236 [SUPER_PROGRAM] = "Super Program",
237 [CPU_SPACE] = "CPU"
238};
239
240void die_if_kernel(char *,struct pt_regs *,int);
241asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
242 unsigned long error_code);
243int send_fault_sig(struct pt_regs *regs);
244
245asmlinkage void trap_c(struct frame *fp);
246
247#if defined (CONFIG_M68060)
248static inline void access_error060 (struct frame *fp)
249{
250 unsigned long fslw = fp->un.fmt4.pc; /* is really FSLW for access error */
251
252#ifdef DEBUG
253 printk("fslw=%#lx, fa=%#lx\n", fslw, fp->un.fmt4.effaddr);
254#endif
255
256 if (fslw & MMU060_BPE) {
257 /* branch prediction error -> clear branch cache */
258 __asm__ __volatile__ ("movec %/cacr,%/d0\n\t"
259 "orl #0x00400000,%/d0\n\t"
260 "movec %/d0,%/cacr"
261 : : : "d0" );
262 /* return if there's no other error */
263 if (!(fslw & MMU060_ERR_BITS) && !(fslw & MMU060_SEE))
264 return;
265 }
266
267 if (fslw & (MMU060_DESC_ERR | MMU060_WP | MMU060_SP)) {
268 unsigned long errorcode;
269 unsigned long addr = fp->un.fmt4.effaddr;
270
271 if (fslw & MMU060_MA)
272 addr = (addr + PAGE_SIZE - 1) & PAGE_MASK;
273
274 errorcode = 1;
275 if (fslw & MMU060_DESC_ERR) {
276 __flush_tlb040_one(addr);
277 errorcode = 0;
278 }
279 if (fslw & MMU060_W)
280 errorcode |= 2;
281#ifdef DEBUG
282 printk("errorcode = %d\n", errorcode );
283#endif
284 do_page_fault(&fp->ptregs, addr, errorcode);
285 } else if (fslw & (MMU060_SEE)){
286 /* Software Emulation Error.
287 * fault during mem_read/mem_write in ifpsp060/os.S
288 */
289 send_fault_sig(&fp->ptregs);
290 } else if (!(fslw & (MMU060_RE|MMU060_WE)) ||
291 send_fault_sig(&fp->ptregs) > 0) {
292 printk("pc=%#lx, fa=%#lx\n", fp->ptregs.pc, fp->un.fmt4.effaddr);
293 printk( "68060 access error, fslw=%lx\n", fslw );
294 trap_c( fp );
295 }
296}
297#endif /* CONFIG_M68060 */
298
299#if defined (CONFIG_M68040)
300static inline unsigned long probe040(int iswrite, unsigned long addr, int wbs)
301{
302 unsigned long mmusr;
303 mm_segment_t old_fs = get_fs();
304
305 set_fs(MAKE_MM_SEG(wbs));
306
307 if (iswrite)
308 asm volatile (".chip 68040; ptestw (%0); .chip 68k" : : "a" (addr));
309 else
310 asm volatile (".chip 68040; ptestr (%0); .chip 68k" : : "a" (addr));
311
312 asm volatile (".chip 68040; movec %%mmusr,%0; .chip 68k" : "=r" (mmusr));
313
314 set_fs(old_fs);
315
316 return mmusr;
317}
318
319static inline int do_040writeback1(unsigned short wbs, unsigned long wba,
320 unsigned long wbd)
321{
322 int res = 0;
323 mm_segment_t old_fs = get_fs();
324
325 /* set_fs can not be moved, otherwise put_user() may oops */
326 set_fs(MAKE_MM_SEG(wbs));
327
328 switch (wbs & WBSIZ_040) {
329 case BA_SIZE_BYTE:
330 res = put_user(wbd & 0xff, (char __user *)wba);
331 break;
332 case BA_SIZE_WORD:
333 res = put_user(wbd & 0xffff, (short __user *)wba);
334 break;
335 case BA_SIZE_LONG:
336 res = put_user(wbd, (int __user *)wba);
337 break;
338 }
339
340 /* set_fs can not be moved, otherwise put_user() may oops */
341 set_fs(old_fs);
342
343
344#ifdef DEBUG
345 printk("do_040writeback1, res=%d\n",res);
346#endif
347
348 return res;
349}
350
351/* after an exception in a writeback the stack frame corresponding
352 * to that exception is discarded, set a few bits in the old frame
353 * to simulate what it should look like
354 */
355static inline void fix_xframe040(struct frame *fp, unsigned long wba, unsigned short wbs)
356{
357 fp->un.fmt7.faddr = wba;
358 fp->un.fmt7.ssw = wbs & 0xff;
359 if (wba != current->thread.faddr)
360 fp->un.fmt7.ssw |= MA_040;
361}
362
363static inline void do_040writebacks(struct frame *fp)
364{
365 int res = 0;
366#if 0
367 if (fp->un.fmt7.wb1s & WBV_040)
368 printk("access_error040: cannot handle 1st writeback. oops.\n");
369#endif
370
371 if ((fp->un.fmt7.wb2s & WBV_040) &&
372 !(fp->un.fmt7.wb2s & WBTT_040)) {
373 res = do_040writeback1(fp->un.fmt7.wb2s, fp->un.fmt7.wb2a,
374 fp->un.fmt7.wb2d);
375 if (res)
376 fix_xframe040(fp, fp->un.fmt7.wb2a, fp->un.fmt7.wb2s);
377 else
378 fp->un.fmt7.wb2s = 0;
379 }
380
381 /* do the 2nd wb only if the first one was successful (except for a kernel wb) */
382 if (fp->un.fmt7.wb3s & WBV_040 && (!res || fp->un.fmt7.wb3s & 4)) {
383 res = do_040writeback1(fp->un.fmt7.wb3s, fp->un.fmt7.wb3a,
384 fp->un.fmt7.wb3d);
385 if (res)
386 {
387 fix_xframe040(fp, fp->un.fmt7.wb3a, fp->un.fmt7.wb3s);
388
389 fp->un.fmt7.wb2s = fp->un.fmt7.wb3s;
390 fp->un.fmt7.wb3s &= (~WBV_040);
391 fp->un.fmt7.wb2a = fp->un.fmt7.wb3a;
392 fp->un.fmt7.wb2d = fp->un.fmt7.wb3d;
393 }
394 else
395 fp->un.fmt7.wb3s = 0;
396 }
397
398 if (res)
399 send_fault_sig(&fp->ptregs);
400}
401
402/*
403 * called from sigreturn(), must ensure userspace code didn't
404 * manipulate exception frame to circumvent protection, then complete
405 * pending writebacks
406 * we just clear TM2 to turn it into a userspace access
407 */
408asmlinkage void berr_040cleanup(struct frame *fp)
409{
410 fp->un.fmt7.wb2s &= ~4;
411 fp->un.fmt7.wb3s &= ~4;
412
413 do_040writebacks(fp);
414}
415
416static inline void access_error040(struct frame *fp)
417{
418 unsigned short ssw = fp->un.fmt7.ssw;
419 unsigned long mmusr;
420
421#ifdef DEBUG
422 printk("ssw=%#x, fa=%#lx\n", ssw, fp->un.fmt7.faddr);
423 printk("wb1s=%#x, wb2s=%#x, wb3s=%#x\n", fp->un.fmt7.wb1s,
424 fp->un.fmt7.wb2s, fp->un.fmt7.wb3s);
425 printk ("wb2a=%lx, wb3a=%lx, wb2d=%lx, wb3d=%lx\n",
426 fp->un.fmt7.wb2a, fp->un.fmt7.wb3a,
427 fp->un.fmt7.wb2d, fp->un.fmt7.wb3d);
428#endif
429
430 if (ssw & ATC_040) {
431 unsigned long addr = fp->un.fmt7.faddr;
432 unsigned long errorcode;
433
434 /*
435 * The MMU status has to be determined AFTER the address
436 * has been corrected if there was a misaligned access (MA).
437 */
438 if (ssw & MA_040)
439 addr = (addr + 7) & -8;
440
441 /* MMU error, get the MMUSR info for this access */
442 mmusr = probe040(!(ssw & RW_040), addr, ssw);
443#ifdef DEBUG
444 printk("mmusr = %lx\n", mmusr);
445#endif
446 errorcode = 1;
447 if (!(mmusr & MMU_R_040)) {
448 /* clear the invalid atc entry */
449 __flush_tlb040_one(addr);
450 errorcode = 0;
451 }
452
453 /* despite what documentation seems to say, RMW
454 * accesses have always both the LK and RW bits set */
455 if (!(ssw & RW_040) || (ssw & LK_040))
456 errorcode |= 2;
457
458 if (do_page_fault(&fp->ptregs, addr, errorcode)) {
459#ifdef DEBUG
460 printk("do_page_fault() !=0\n");
461#endif
462 if (user_mode(&fp->ptregs)){
463 /* delay writebacks after signal delivery */
464#ifdef DEBUG
465 printk(".. was usermode - return\n");
466#endif
467 return;
468 }
469 /* disable writeback into user space from kernel
470 * (if do_page_fault didn't fix the mapping,
471 * the writeback won't do good)
472 */
473disable_wb:
474#ifdef DEBUG
475 printk(".. disabling wb2\n");
476#endif
477 if (fp->un.fmt7.wb2a == fp->un.fmt7.faddr)
478 fp->un.fmt7.wb2s &= ~WBV_040;
479 if (fp->un.fmt7.wb3a == fp->un.fmt7.faddr)
480 fp->un.fmt7.wb3s &= ~WBV_040;
481 }
482 } else {
483 /* In case of a bus error we either kill the process or expect
484 * the kernel to catch the fault, which then is also responsible
485 * for cleaning up the mess.
486 */
487 current->thread.signo = SIGBUS;
488 current->thread.faddr = fp->un.fmt7.faddr;
489 if (send_fault_sig(&fp->ptregs) >= 0)
490 printk("68040 bus error (ssw=%x, faddr=%lx)\n", ssw,
491 fp->un.fmt7.faddr);
492 goto disable_wb;
493 }
494
495 do_040writebacks(fp);
496}
497#endif /* CONFIG_M68040 */
498
499#if defined(CONFIG_SUN3)
500#include <asm/sun3mmu.h>
501
502extern int mmu_emu_handle_fault (unsigned long, int, int);
503
504/* sun3 version of bus_error030 */
505
506static inline void bus_error030 (struct frame *fp)
507{
508 unsigned char buserr_type = sun3_get_buserr ();
509 unsigned long addr, errorcode;
510 unsigned short ssw = fp->un.fmtb.ssw;
511 extern unsigned long _sun3_map_test_start, _sun3_map_test_end;
512
513#ifdef DEBUG
514 if (ssw & (FC | FB))
515 printk ("Instruction fault at %#010lx\n",
516 ssw & FC ?
517 fp->ptregs.format == 0xa ? fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2
518 :
519 fp->ptregs.format == 0xa ? fp->ptregs.pc + 4 : fp->un.fmtb.baddr);
520 if (ssw & DF)
521 printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n",
522 ssw & RW ? "read" : "write",
523 fp->un.fmtb.daddr,
524 space_names[ssw & DFC], fp->ptregs.pc);
525#endif
526
527 /*
528 * Check if this page should be demand-mapped. This needs to go before
529 * the testing for a bad kernel-space access (demand-mapping applies
530 * to kernel accesses too).
531 */
532
533 if ((ssw & DF)
534 && (buserr_type & (SUN3_BUSERR_PROTERR | SUN3_BUSERR_INVALID))) {
535 if (mmu_emu_handle_fault (fp->un.fmtb.daddr, ssw & RW, 0))
536 return;
537 }
538
539 /* Check for kernel-space pagefault (BAD). */
540 if (fp->ptregs.sr & PS_S) {
541 /* kernel fault must be a data fault to user space */
542 if (! ((ssw & DF) && ((ssw & DFC) == USER_DATA))) {
543 // try checking the kernel mappings before surrender
544 if (mmu_emu_handle_fault (fp->un.fmtb.daddr, ssw & RW, 1))
545 return;
546 /* instruction fault or kernel data fault! */
547 if (ssw & (FC | FB))
548 printk ("Instruction fault at %#010lx\n",
549 fp->ptregs.pc);
550 if (ssw & DF) {
551 /* was this fault incurred testing bus mappings? */
552 if((fp->ptregs.pc >= (unsigned long)&_sun3_map_test_start) &&
553 (fp->ptregs.pc <= (unsigned long)&_sun3_map_test_end)) {
554 send_fault_sig(&fp->ptregs);
555 return;
556 }
557
558 printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n",
559 ssw & RW ? "read" : "write",
560 fp->un.fmtb.daddr,
561 space_names[ssw & DFC], fp->ptregs.pc);
562 }
563 printk ("BAD KERNEL BUSERR\n");
564
565 die_if_kernel("Oops", &fp->ptregs,0);
566 force_sig(SIGKILL, current);
567 return;
568 }
569 } else {
570 /* user fault */
571 if (!(ssw & (FC | FB)) && !(ssw & DF))
572 /* not an instruction fault or data fault! BAD */
573 panic ("USER BUSERR w/o instruction or data fault");
574 }
575
576
577 /* First handle the data fault, if any. */
578 if (ssw & DF) {
579 addr = fp->un.fmtb.daddr;
580
581// errorcode bit 0: 0 -> no page 1 -> protection fault
582// errorcode bit 1: 0 -> read fault 1 -> write fault
583
584// (buserr_type & SUN3_BUSERR_PROTERR) -> protection fault
585// (buserr_type & SUN3_BUSERR_INVALID) -> invalid page fault
586
587 if (buserr_type & SUN3_BUSERR_PROTERR)
588 errorcode = 0x01;
589 else if (buserr_type & SUN3_BUSERR_INVALID)
590 errorcode = 0x00;
591 else {
592#ifdef DEBUG
593 printk ("*** unexpected busfault type=%#04x\n", buserr_type);
594 printk ("invalid %s access at %#lx from pc %#lx\n",
595 !(ssw & RW) ? "write" : "read", addr,
596 fp->ptregs.pc);
597#endif
598 die_if_kernel ("Oops", &fp->ptregs, buserr_type);
599 force_sig (SIGBUS, current);
600 return;
601 }
602
603//todo: wtf is RM bit? --m
604 if (!(ssw & RW) || ssw & RM)
605 errorcode |= 0x02;
606
607 /* Handle page fault. */
608 do_page_fault (&fp->ptregs, addr, errorcode);
609
610 /* Retry the data fault now. */
611 return;
612 }
613
614 /* Now handle the instruction fault. */
615
616 /* Get the fault address. */
617 if (fp->ptregs.format == 0xA)
618 addr = fp->ptregs.pc + 4;
619 else
620 addr = fp->un.fmtb.baddr;
621 if (ssw & FC)
622 addr -= 2;
623
624 if (buserr_type & SUN3_BUSERR_INVALID) {
625 if (!mmu_emu_handle_fault (fp->un.fmtb.daddr, 1, 0))
626 do_page_fault (&fp->ptregs, addr, 0);
627 } else {
628#ifdef DEBUG
629 printk ("protection fault on insn access (segv).\n");
630#endif
631 force_sig (SIGSEGV, current);
632 }
633}
634#else
635#if defined(CPU_M68020_OR_M68030)
636static inline void bus_error030 (struct frame *fp)
637{
638 volatile unsigned short temp;
639 unsigned short mmusr;
640 unsigned long addr, errorcode;
641 unsigned short ssw = fp->un.fmtb.ssw;
642#ifdef DEBUG
643 unsigned long desc;
644
645 printk ("pid = %x ", current->pid);
646 printk ("SSW=%#06x ", ssw);
647
648 if (ssw & (FC | FB))
649 printk ("Instruction fault at %#010lx\n",
650 ssw & FC ?
651 fp->ptregs.format == 0xa ? fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2
652 :
653 fp->ptregs.format == 0xa ? fp->ptregs.pc + 4 : fp->un.fmtb.baddr);
654 if (ssw & DF)
655 printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n",
656 ssw & RW ? "read" : "write",
657 fp->un.fmtb.daddr,
658 space_names[ssw & DFC], fp->ptregs.pc);
659#endif
660
661 /* ++andreas: If a data fault and an instruction fault happen
662 at the same time map in both pages. */
663
664 /* First handle the data fault, if any. */
665 if (ssw & DF) {
666 addr = fp->un.fmtb.daddr;
667
668#ifdef DEBUG
669 asm volatile ("ptestr %3,%2@,#7,%0\n\t"
670 "pmove %%psr,%1@"
671 : "=a&" (desc)
672 : "a" (&temp), "a" (addr), "d" (ssw));
673#else
674 asm volatile ("ptestr %2,%1@,#7\n\t"
675 "pmove %%psr,%0@"
676 : : "a" (&temp), "a" (addr), "d" (ssw));
677#endif
678 mmusr = temp;
679
680#ifdef DEBUG
681 printk("mmusr is %#x for addr %#lx in task %p\n",
682 mmusr, addr, current);
683 printk("descriptor address is %#lx, contents %#lx\n",
684 __va(desc), *(unsigned long *)__va(desc));
685#endif
686
687 errorcode = (mmusr & MMU_I) ? 0 : 1;
688 if (!(ssw & RW) || (ssw & RM))
689 errorcode |= 2;
690
691 if (mmusr & (MMU_I | MMU_WP)) {
692 if (ssw & 4) {
693 printk("Data %s fault at %#010lx in %s (pc=%#lx)\n",
694 ssw & RW ? "read" : "write",
695 fp->un.fmtb.daddr,
696 space_names[ssw & DFC], fp->ptregs.pc);
697 goto buserr;
698 }
699 /* Don't try to do anything further if an exception was
700 handled. */
701 if (do_page_fault (&fp->ptregs, addr, errorcode) < 0)
702 return;
703 } else if (!(mmusr & MMU_I)) {
704 /* probably a 020 cas fault */
705 if (!(ssw & RM) && send_fault_sig(&fp->ptregs) > 0)
706 printk("unexpected bus error (%#x,%#x)\n", ssw, mmusr);
707 } else if (mmusr & (MMU_B|MMU_L|MMU_S)) {
708 printk("invalid %s access at %#lx from pc %#lx\n",
709 !(ssw & RW) ? "write" : "read", addr,
710 fp->ptregs.pc);
711 die_if_kernel("Oops",&fp->ptregs,mmusr);
712 force_sig(SIGSEGV, current);
713 return;
714 } else {
715#if 0
716 static volatile long tlong;
717#endif
718
719 printk("weird %s access at %#lx from pc %#lx (ssw is %#x)\n",
720 !(ssw & RW) ? "write" : "read", addr,
721 fp->ptregs.pc, ssw);
722 asm volatile ("ptestr #1,%1@,#0\n\t"
723 "pmove %%psr,%0@"
724 : /* no outputs */
725 : "a" (&temp), "a" (addr));
726 mmusr = temp;
727
728 printk ("level 0 mmusr is %#x\n", mmusr);
729#if 0
730 asm volatile ("pmove %%tt0,%0@"
731 : /* no outputs */
732 : "a" (&tlong));
733 printk("tt0 is %#lx, ", tlong);
734 asm volatile ("pmove %%tt1,%0@"
735 : /* no outputs */
736 : "a" (&tlong));
737 printk("tt1 is %#lx\n", tlong);
738#endif
739#ifdef DEBUG
740 printk("Unknown SIGSEGV - 1\n");
741#endif
742 die_if_kernel("Oops",&fp->ptregs,mmusr);
743 force_sig(SIGSEGV, current);
744 return;
745 }
746
747 /* setup an ATC entry for the access about to be retried */
748 if (!(ssw & RW) || (ssw & RM))
749 asm volatile ("ploadw %1,%0@" : /* no outputs */
750 : "a" (addr), "d" (ssw));
751 else
752 asm volatile ("ploadr %1,%0@" : /* no outputs */
753 : "a" (addr), "d" (ssw));
754 }
755
756 /* Now handle the instruction fault. */
757
758 if (!(ssw & (FC|FB)))
759 return;
760
761 if (fp->ptregs.sr & PS_S) {
762 printk("Instruction fault at %#010lx\n",
763 fp->ptregs.pc);
764 buserr:
765 printk ("BAD KERNEL BUSERR\n");
766 die_if_kernel("Oops",&fp->ptregs,0);
767 force_sig(SIGKILL, current);
768 return;
769 }
770
771 /* get the fault address */
772 if (fp->ptregs.format == 10)
773 addr = fp->ptregs.pc + 4;
774 else
775 addr = fp->un.fmtb.baddr;
776 if (ssw & FC)
777 addr -= 2;
778
779 if ((ssw & DF) && ((addr ^ fp->un.fmtb.daddr) & PAGE_MASK) == 0)
780 /* Insn fault on same page as data fault. But we
781 should still create the ATC entry. */
782 goto create_atc_entry;
783
784#ifdef DEBUG
785 asm volatile ("ptestr #1,%2@,#7,%0\n\t"
786 "pmove %%psr,%1@"
787 : "=a&" (desc)
788 : "a" (&temp), "a" (addr));
789#else
790 asm volatile ("ptestr #1,%1@,#7\n\t"
791 "pmove %%psr,%0@"
792 : : "a" (&temp), "a" (addr));
793#endif
794 mmusr = temp;
795
796#ifdef DEBUG
797 printk ("mmusr is %#x for addr %#lx in task %p\n",
798 mmusr, addr, current);
799 printk ("descriptor address is %#lx, contents %#lx\n",
800 __va(desc), *(unsigned long *)__va(desc));
801#endif
802
803 if (mmusr & MMU_I)
804 do_page_fault (&fp->ptregs, addr, 0);
805 else if (mmusr & (MMU_B|MMU_L|MMU_S)) {
806 printk ("invalid insn access at %#lx from pc %#lx\n",
807 addr, fp->ptregs.pc);
808#ifdef DEBUG
809 printk("Unknown SIGSEGV - 2\n");
810#endif
811 die_if_kernel("Oops",&fp->ptregs,mmusr);
812 force_sig(SIGSEGV, current);
813 return;
814 }
815
816create_atc_entry:
817 /* setup an ATC entry for the access about to be retried */
818 asm volatile ("ploadr #2,%0@" : /* no outputs */
819 : "a" (addr));
820}
821#endif /* CPU_M68020_OR_M68030 */
822#endif /* !CONFIG_SUN3 */
823
824asmlinkage void buserr_c(struct frame *fp)
825{
826 /* Only set esp0 if coming from user mode */
827 if (user_mode(&fp->ptregs))
828 current->thread.esp0 = (unsigned long) fp;
829
830#ifdef DEBUG
831 printk ("*** Bus Error *** Format is %x\n", fp->ptregs.format);
832#endif
833
834 switch (fp->ptregs.format) {
835#if defined (CONFIG_M68060)
836 case 4: /* 68060 access error */
837 access_error060 (fp);
838 break;
839#endif
840#if defined (CONFIG_M68040)
841 case 0x7: /* 68040 access error */
842 access_error040 (fp);
843 break;
844#endif
845#if defined (CPU_M68020_OR_M68030)
846 case 0xa:
847 case 0xb:
848 bus_error030 (fp);
849 break;
850#endif
851 default:
852 die_if_kernel("bad frame format",&fp->ptregs,0);
853#ifdef DEBUG
854 printk("Unknown SIGSEGV - 4\n");
855#endif
856 force_sig(SIGSEGV, current);
857 }
858}
859
860
861static int kstack_depth_to_print = 48;
862
863void show_trace(unsigned long *stack)
864{
865 unsigned long *endstack;
866 unsigned long addr;
867 int i;
868
869 printk("Call Trace:");
870 addr = (unsigned long)stack + THREAD_SIZE - 1;
871 endstack = (unsigned long *)(addr & -THREAD_SIZE);
872 i = 0;
873 while (stack + 1 <= endstack) {
874 addr = *stack++;
875 /*
876 * If the address is either in the text segment of the
877 * kernel, or in the region which contains vmalloc'ed
878 * memory, it *may* be the address of a calling
879 * routine; if so, print it so that someone tracing
880 * down the cause of the crash will be able to figure
881 * out the call path that was taken.
882 */
883 if (__kernel_text_address(addr)) {
884#ifndef CONFIG_KALLSYMS
885 if (i % 5 == 0)
886 printk("\n ");
887#endif
888 printk(" [<%08lx>] %pS\n", addr, (void *)addr);
889 i++;
890 }
891 }
892 printk("\n");
893}
894
895void show_registers(struct pt_regs *regs)
896{
897 struct frame *fp = (struct frame *)regs;
898 mm_segment_t old_fs = get_fs();
899 u16 c, *cp;
900 unsigned long addr;
901 int i;
902
903 print_modules();
904 printk("PC: [<%08lx>] %pS\n", regs->pc, (void *)regs->pc);
905 printk("SR: %04x SP: %p a2: %08lx\n", regs->sr, regs, regs->a2);
906 printk("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
907 regs->d0, regs->d1, regs->d2, regs->d3);
908 printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
909 regs->d4, regs->d5, regs->a0, regs->a1);
910
911 printk("Process %s (pid: %d, task=%p)\n",
912 current->comm, task_pid_nr(current), current);
913 addr = (unsigned long)&fp->un;
914 printk("Frame format=%X ", regs->format);
915 switch (regs->format) {
916 case 0x2:
917 printk("instr addr=%08lx\n", fp->un.fmt2.iaddr);
918 addr += sizeof(fp->un.fmt2);
919 break;
920 case 0x3:
921 printk("eff addr=%08lx\n", fp->un.fmt3.effaddr);
922 addr += sizeof(fp->un.fmt3);
923 break;
924 case 0x4:
925 printk((CPU_IS_060 ? "fault addr=%08lx fslw=%08lx\n"
926 : "eff addr=%08lx pc=%08lx\n"),
927 fp->un.fmt4.effaddr, fp->un.fmt4.pc);
928 addr += sizeof(fp->un.fmt4);
929 break;
930 case 0x7:
931 printk("eff addr=%08lx ssw=%04x faddr=%08lx\n",
932 fp->un.fmt7.effaddr, fp->un.fmt7.ssw, fp->un.fmt7.faddr);
933 printk("wb 1 stat/addr/data: %04x %08lx %08lx\n",
934 fp->un.fmt7.wb1s, fp->un.fmt7.wb1a, fp->un.fmt7.wb1dpd0);
935 printk("wb 2 stat/addr/data: %04x %08lx %08lx\n",
936 fp->un.fmt7.wb2s, fp->un.fmt7.wb2a, fp->un.fmt7.wb2d);
937 printk("wb 3 stat/addr/data: %04x %08lx %08lx\n",
938 fp->un.fmt7.wb3s, fp->un.fmt7.wb3a, fp->un.fmt7.wb3d);
939 printk("push data: %08lx %08lx %08lx %08lx\n",
940 fp->un.fmt7.wb1dpd0, fp->un.fmt7.pd1, fp->un.fmt7.pd2,
941 fp->un.fmt7.pd3);
942 addr += sizeof(fp->un.fmt7);
943 break;
944 case 0x9:
945 printk("instr addr=%08lx\n", fp->un.fmt9.iaddr);
946 addr += sizeof(fp->un.fmt9);
947 break;
948 case 0xa:
949 printk("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n",
950 fp->un.fmta.ssw, fp->un.fmta.isc, fp->un.fmta.isb,
951 fp->un.fmta.daddr, fp->un.fmta.dobuf);
952 addr += sizeof(fp->un.fmta);
953 break;
954 case 0xb:
955 printk("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n",
956 fp->un.fmtb.ssw, fp->un.fmtb.isc, fp->un.fmtb.isb,
957 fp->un.fmtb.daddr, fp->un.fmtb.dobuf);
958 printk("baddr=%08lx dibuf=%08lx ver=%x\n",
959 fp->un.fmtb.baddr, fp->un.fmtb.dibuf, fp->un.fmtb.ver);
960 addr += sizeof(fp->un.fmtb);
961 break;
962 default:
963 printk("\n");
964 }
965 show_stack(NULL, (unsigned long *)addr);
966
967 printk("Code:");
968 set_fs(KERNEL_DS);
969 cp = (u16 *)regs->pc;
970 for (i = -8; i < 16; i++) {
971 if (get_user(c, cp + i) && i >= 0) {
972 printk(" Bad PC value.");
973 break;
974 }
975 printk(i ? " %04x" : " <%04x>", c);
976 }
977 set_fs(old_fs);
978 printk ("\n");
979}
980
981void show_stack(struct task_struct *task, unsigned long *stack)
982{
983 unsigned long *p;
984 unsigned long *endstack;
985 int i;
986
987 if (!stack) {
988 if (task)
989 stack = (unsigned long *)task->thread.esp0;
990 else
991 stack = (unsigned long *)&stack;
992 }
993 endstack = (unsigned long *)(((unsigned long)stack + THREAD_SIZE - 1) & -THREAD_SIZE);
994
995 printk("Stack from %08lx:", (unsigned long)stack);
996 p = stack;
997 for (i = 0; i < kstack_depth_to_print; i++) {
998 if (p + 1 > endstack)
999 break;
1000 if (i % 8 == 0)
1001 printk("\n ");
1002 printk(" %08lx", *p++);
1003 }
1004 printk("\n");
1005 show_trace(stack);
1006}
1007
1008/*
1009 * The architecture-independent backtrace generator
1010 */
1011void dump_stack(void)
1012{
1013 unsigned long stack;
1014
1015 show_trace(&stack);
1016}
1017
1018EXPORT_SYMBOL(dump_stack);
1019
1020void bad_super_trap (struct frame *fp)
1021{
1022 console_verbose();
1023 if (fp->ptregs.vector < 4 * ARRAY_SIZE(vec_names))
1024 printk ("*** %s *** FORMAT=%X\n",
1025 vec_names[(fp->ptregs.vector) >> 2],
1026 fp->ptregs.format);
1027 else
1028 printk ("*** Exception %d *** FORMAT=%X\n",
1029 (fp->ptregs.vector) >> 2,
1030 fp->ptregs.format);
1031 if (fp->ptregs.vector >> 2 == VEC_ADDRERR && CPU_IS_020_OR_030) {
1032 unsigned short ssw = fp->un.fmtb.ssw;
1033
1034 printk ("SSW=%#06x ", ssw);
1035
1036 if (ssw & RC)
1037 printk ("Pipe stage C instruction fault at %#010lx\n",
1038 (fp->ptregs.format) == 0xA ?
1039 fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2);
1040 if (ssw & RB)
1041 printk ("Pipe stage B instruction fault at %#010lx\n",
1042 (fp->ptregs.format) == 0xA ?
1043 fp->ptregs.pc + 4 : fp->un.fmtb.baddr);
1044 if (ssw & DF)
1045 printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n",
1046 ssw & RW ? "read" : "write",
1047 fp->un.fmtb.daddr, space_names[ssw & DFC],
1048 fp->ptregs.pc);
1049 }
1050 printk ("Current process id is %d\n", task_pid_nr(current));
1051 die_if_kernel("BAD KERNEL TRAP", &fp->ptregs, 0);
1052}
1053
1054asmlinkage void trap_c(struct frame *fp)
1055{
1056 int sig;
1057 siginfo_t info;
1058
1059 if (fp->ptregs.sr & PS_S) {
1060 if (fp->ptregs.vector == VEC_TRACE << 2) {
1061 /* traced a trapping instruction on a 68020/30,
1062 * real exception will be executed afterwards.
1063 */
1064 } else if (!handle_kernel_fault(&fp->ptregs))
1065 bad_super_trap(fp);
1066 return;
1067 }
1068
1069 /* send the appropriate signal to the user program */
1070 switch ((fp->ptregs.vector) >> 2) {
1071 case VEC_ADDRERR:
1072 info.si_code = BUS_ADRALN;
1073 sig = SIGBUS;
1074 break;
1075 case VEC_ILLEGAL:
1076 case VEC_LINE10:
1077 case VEC_LINE11:
1078 info.si_code = ILL_ILLOPC;
1079 sig = SIGILL;
1080 break;
1081 case VEC_PRIV:
1082 info.si_code = ILL_PRVOPC;
1083 sig = SIGILL;
1084 break;
1085 case VEC_COPROC:
1086 info.si_code = ILL_COPROC;
1087 sig = SIGILL;
1088 break;
1089 case VEC_TRAP1:
1090 case VEC_TRAP2:
1091 case VEC_TRAP3:
1092 case VEC_TRAP4:
1093 case VEC_TRAP5:
1094 case VEC_TRAP6:
1095 case VEC_TRAP7:
1096 case VEC_TRAP8:
1097 case VEC_TRAP9:
1098 case VEC_TRAP10:
1099 case VEC_TRAP11:
1100 case VEC_TRAP12:
1101 case VEC_TRAP13:
1102 case VEC_TRAP14:
1103 info.si_code = ILL_ILLTRP;
1104 sig = SIGILL;
1105 break;
1106 case VEC_FPBRUC:
1107 case VEC_FPOE:
1108 case VEC_FPNAN:
1109 info.si_code = FPE_FLTINV;
1110 sig = SIGFPE;
1111 break;
1112 case VEC_FPIR:
1113 info.si_code = FPE_FLTRES;
1114 sig = SIGFPE;
1115 break;
1116 case VEC_FPDIVZ:
1117 info.si_code = FPE_FLTDIV;
1118 sig = SIGFPE;
1119 break;
1120 case VEC_FPUNDER:
1121 info.si_code = FPE_FLTUND;
1122 sig = SIGFPE;
1123 break;
1124 case VEC_FPOVER:
1125 info.si_code = FPE_FLTOVF;
1126 sig = SIGFPE;
1127 break;
1128 case VEC_ZERODIV:
1129 info.si_code = FPE_INTDIV;
1130 sig = SIGFPE;
1131 break;
1132 case VEC_CHK:
1133 case VEC_TRAP:
1134 info.si_code = FPE_INTOVF;
1135 sig = SIGFPE;
1136 break;
1137 case VEC_TRACE: /* ptrace single step */
1138 info.si_code = TRAP_TRACE;
1139 sig = SIGTRAP;
1140 break;
1141 case VEC_TRAP15: /* breakpoint */
1142 info.si_code = TRAP_BRKPT;
1143 sig = SIGTRAP;
1144 break;
1145 default:
1146 info.si_code = ILL_ILLOPC;
1147 sig = SIGILL;
1148 break;
1149 }
1150 info.si_signo = sig;
1151 info.si_errno = 0;
1152 switch (fp->ptregs.format) {
1153 default:
1154 info.si_addr = (void *) fp->ptregs.pc;
1155 break;
1156 case 2:
1157 info.si_addr = (void *) fp->un.fmt2.iaddr;
1158 break;
1159 case 7:
1160 info.si_addr = (void *) fp->un.fmt7.effaddr;
1161 break;
1162 case 9:
1163 info.si_addr = (void *) fp->un.fmt9.iaddr;
1164 break;
1165 case 10:
1166 info.si_addr = (void *) fp->un.fmta.daddr;
1167 break;
1168 case 11:
1169 info.si_addr = (void *) fp->un.fmtb.daddr;
1170 break;
1171 }
1172 force_sig_info (sig, &info, current);
1173}
1174
1175void die_if_kernel (char *str, struct pt_regs *fp, int nr)
1176{
1177 if (!(fp->sr & PS_S))
1178 return;
1179
1180 console_verbose();
1181 printk("%s: %08x\n",str,nr);
1182 show_registers(fp);
1183 add_taint(TAINT_DIE);
1184 do_exit(SIGSEGV);
1185}
1186
1187/*
1188 * This function is called if an error occur while accessing
1189 * user-space from the fpsp040 code.
1190 */
1191asmlinkage void fpsp040_die(void)
1192{
1193 do_exit(SIGSEGV);
1194}
1195
1196#ifdef CONFIG_M68KFPU_EMU
1197asmlinkage void fpemu_signal(int signal, int code, void *addr)
1198{
1199 siginfo_t info;
1200
1201 info.si_signo = signal;
1202 info.si_errno = 0;
1203 info.si_code = code;
1204 info.si_addr = addr;
1205 force_sig_info(signal, &info, current);
1206}
1207#endif
diff --git a/arch/m68k/kernel/traps_no.c b/arch/m68k/kernel/traps_no.c
deleted file mode 100644
index e67b8c80695..00000000000
--- a/arch/m68k/kernel/traps_no.c
+++ /dev/null
@@ -1,361 +0,0 @@
1/*
2 * linux/arch/m68knommu/kernel/traps.c
3 *
4 * Copyright (C) 1993, 1994 by Hamish Macdonald
5 *
6 * 68040 fixes by Michael Rausch
7 * 68040 fixes by Martin Apel
8 * 68060 fixes by Roman Hodek
9 * 68060 fixes by Jesper Skov
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
16/*
17 * Sets up all exception vectors
18 */
19#include <linux/sched.h>
20#include <linux/signal.h>
21#include <linux/kernel.h>
22#include <linux/mm.h>
23#include <linux/module.h>
24#include <linux/types.h>
25#include <linux/user.h>
26#include <linux/string.h>
27#include <linux/linkage.h>
28#include <linux/init.h>
29#include <linux/ptrace.h>
30#include <linux/kallsyms.h>
31
32#include <asm/setup.h>
33#include <asm/fpu.h>
34#include <asm/system.h>
35#include <asm/uaccess.h>
36#include <asm/traps.h>
37#include <asm/pgtable.h>
38#include <asm/machdep.h>
39#include <asm/siginfo.h>
40
41static char const * const vec_names[] = {
42 "RESET SP", "RESET PC", "BUS ERROR", "ADDRESS ERROR",
43 "ILLEGAL INSTRUCTION", "ZERO DIVIDE", "CHK", "TRAPcc",
44 "PRIVILEGE VIOLATION", "TRACE", "LINE 1010", "LINE 1111",
45 "UNASSIGNED RESERVED 12", "COPROCESSOR PROTOCOL VIOLATION",
46 "FORMAT ERROR", "UNINITIALIZED INTERRUPT",
47 "UNASSIGNED RESERVED 16", "UNASSIGNED RESERVED 17",
48 "UNASSIGNED RESERVED 18", "UNASSIGNED RESERVED 19",
49 "UNASSIGNED RESERVED 20", "UNASSIGNED RESERVED 21",
50 "UNASSIGNED RESERVED 22", "UNASSIGNED RESERVED 23",
51 "SPURIOUS INTERRUPT", "LEVEL 1 INT", "LEVEL 2 INT", "LEVEL 3 INT",
52 "LEVEL 4 INT", "LEVEL 5 INT", "LEVEL 6 INT", "LEVEL 7 INT",
53 "SYSCALL", "TRAP #1", "TRAP #2", "TRAP #3",
54 "TRAP #4", "TRAP #5", "TRAP #6", "TRAP #7",
55 "TRAP #8", "TRAP #9", "TRAP #10", "TRAP #11",
56 "TRAP #12", "TRAP #13", "TRAP #14", "TRAP #15",
57 "FPCP BSUN", "FPCP INEXACT", "FPCP DIV BY 0", "FPCP UNDERFLOW",
58 "FPCP OPERAND ERROR", "FPCP OVERFLOW", "FPCP SNAN",
59 "FPCP UNSUPPORTED OPERATION",
60 "MMU CONFIGURATION ERROR"
61};
62
63void die_if_kernel(char *str, struct pt_regs *fp, int nr)
64{
65 if (!(fp->sr & PS_S))
66 return;
67
68 console_verbose();
69 printk(KERN_EMERG "%s: %08x\n",str,nr);
70 printk(KERN_EMERG "PC: [<%08lx>]\nSR: %04x SP: %p a2: %08lx\n",
71 fp->pc, fp->sr, fp, fp->a2);
72 printk(KERN_EMERG "d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
73 fp->d0, fp->d1, fp->d2, fp->d3);
74 printk(KERN_EMERG "d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
75 fp->d4, fp->d5, fp->a0, fp->a1);
76
77 printk(KERN_EMERG "Process %s (pid: %d, stackpage=%08lx)\n",
78 current->comm, current->pid, PAGE_SIZE+(unsigned long)current);
79 show_stack(NULL, (unsigned long *)(fp + 1));
80 add_taint(TAINT_DIE);
81 do_exit(SIGSEGV);
82}
83
84asmlinkage void buserr_c(struct frame *fp)
85{
86 /* Only set esp0 if coming from user mode */
87 if (user_mode(&fp->ptregs))
88 current->thread.esp0 = (unsigned long) fp;
89
90#if defined(DEBUG)
91 printk (KERN_DEBUG "*** Bus Error *** Format is %x\n", fp->ptregs.format);
92#endif
93
94 die_if_kernel("bad frame format",&fp->ptregs,0);
95#if defined(DEBUG)
96 printk(KERN_DEBUG "Unknown SIGSEGV - 4\n");
97#endif
98 force_sig(SIGSEGV, current);
99}
100
101static void print_this_address(unsigned long addr, int i)
102{
103#ifdef CONFIG_KALLSYMS
104 printk(KERN_EMERG " [%08lx] ", addr);
105 print_symbol(KERN_CONT "%s\n", addr);
106#else
107 if (i % 5)
108 printk(KERN_CONT " [%08lx] ", addr);
109 else
110 printk(KERN_EMERG " [%08lx] ", addr);
111 i++;
112#endif
113}
114
115int kstack_depth_to_print = 48;
116
117static void __show_stack(struct task_struct *task, unsigned long *stack)
118{
119 unsigned long *endstack, addr;
120#ifdef CONFIG_FRAME_POINTER
121 unsigned long *last_stack;
122#endif
123 int i;
124
125 if (!stack)
126 stack = (unsigned long *)task->thread.ksp;
127
128 addr = (unsigned long) stack;
129 endstack = (unsigned long *) PAGE_ALIGN(addr);
130
131 printk(KERN_EMERG "Stack from %08lx:", (unsigned long)stack);
132 for (i = 0; i < kstack_depth_to_print; i++) {
133 if (stack + 1 + i > endstack)
134 break;
135 if (i % 8 == 0)
136 printk(KERN_EMERG " ");
137 printk(KERN_CONT " %08lx", *(stack + i));
138 }
139 printk("\n");
140 i = 0;
141
142#ifdef CONFIG_FRAME_POINTER
143 printk(KERN_EMERG "Call Trace:\n");
144
145 last_stack = stack - 1;
146 while (stack <= endstack && stack > last_stack) {
147
148 addr = *(stack + 1);
149 print_this_address(addr, i);
150 i++;
151
152 last_stack = stack;
153 stack = (unsigned long *)*stack;
154 }
155 printk("\n");
156#else
157 printk(KERN_EMERG "Call Trace with CONFIG_FRAME_POINTER disabled:\n");
158 while (stack <= endstack) {
159 addr = *stack++;
160 /*
161 * If the address is either in the text segment of the kernel,
162 * or in a region which is occupied by a module then it *may*
163 * be the address of a calling routine; if so, print it so that
164 * someone tracing down the cause of the crash will be able to
165 * figure out the call path that was taken.
166 */
167 if (__kernel_text_address(addr)) {
168 print_this_address(addr, i);
169 i++;
170 }
171 }
172 printk(KERN_CONT "\n");
173#endif
174}
175
176void bad_super_trap(struct frame *fp)
177{
178 int vector = (fp->ptregs.vector >> 2) & 0xff;
179
180 console_verbose();
181 if (vector < ARRAY_SIZE(vec_names))
182 printk (KERN_WARNING "*** %s *** FORMAT=%X\n",
183 vec_names[vector],
184 fp->ptregs.format);
185 else
186 printk (KERN_WARNING "*** Exception %d *** FORMAT=%X\n",
187 vector,
188 fp->ptregs.format);
189 printk (KERN_WARNING "Current process id is %d\n", current->pid);
190 die_if_kernel("BAD KERNEL TRAP", &fp->ptregs, 0);
191}
192
193asmlinkage void trap_c(struct frame *fp)
194{
195 int sig;
196 int vector = (fp->ptregs.vector >> 2) & 0xff;
197 siginfo_t info;
198
199 if (fp->ptregs.sr & PS_S) {
200 if (vector == VEC_TRACE) {
201 /* traced a trapping instruction */
202 } else
203 bad_super_trap(fp);
204 return;
205 }
206
207 /* send the appropriate signal to the user program */
208 switch (vector) {
209 case VEC_ADDRERR:
210 info.si_code = BUS_ADRALN;
211 sig = SIGBUS;
212 break;
213 case VEC_ILLEGAL:
214 case VEC_LINE10:
215 case VEC_LINE11:
216 info.si_code = ILL_ILLOPC;
217 sig = SIGILL;
218 break;
219 case VEC_PRIV:
220 info.si_code = ILL_PRVOPC;
221 sig = SIGILL;
222 break;
223 case VEC_COPROC:
224 info.si_code = ILL_COPROC;
225 sig = SIGILL;
226 break;
227 case VEC_TRAP1: /* gdbserver breakpoint */
228 fp->ptregs.pc -= 2;
229 info.si_code = TRAP_TRACE;
230 sig = SIGTRAP;
231 break;
232 case VEC_TRAP2:
233 case VEC_TRAP3:
234 case VEC_TRAP4:
235 case VEC_TRAP5:
236 case VEC_TRAP6:
237 case VEC_TRAP7:
238 case VEC_TRAP8:
239 case VEC_TRAP9:
240 case VEC_TRAP10:
241 case VEC_TRAP11:
242 case VEC_TRAP12:
243 case VEC_TRAP13:
244 case VEC_TRAP14:
245 info.si_code = ILL_ILLTRP;
246 sig = SIGILL;
247 break;
248 case VEC_FPBRUC:
249 case VEC_FPOE:
250 case VEC_FPNAN:
251 info.si_code = FPE_FLTINV;
252 sig = SIGFPE;
253 break;
254 case VEC_FPIR:
255 info.si_code = FPE_FLTRES;
256 sig = SIGFPE;
257 break;
258 case VEC_FPDIVZ:
259 info.si_code = FPE_FLTDIV;
260 sig = SIGFPE;
261 break;
262 case VEC_FPUNDER:
263 info.si_code = FPE_FLTUND;
264 sig = SIGFPE;
265 break;
266 case VEC_FPOVER:
267 info.si_code = FPE_FLTOVF;
268 sig = SIGFPE;
269 break;
270 case VEC_ZERODIV:
271 info.si_code = FPE_INTDIV;
272 sig = SIGFPE;
273 break;
274 case VEC_CHK:
275 case VEC_TRAP:
276 info.si_code = FPE_INTOVF;
277 sig = SIGFPE;
278 break;
279 case VEC_TRACE: /* ptrace single step */
280 info.si_code = TRAP_TRACE;
281 sig = SIGTRAP;
282 break;
283 case VEC_TRAP15: /* breakpoint */
284 info.si_code = TRAP_BRKPT;
285 sig = SIGTRAP;
286 break;
287 default:
288 info.si_code = ILL_ILLOPC;
289 sig = SIGILL;
290 break;
291 }
292 info.si_signo = sig;
293 info.si_errno = 0;
294 switch (fp->ptregs.format) {
295 default:
296 info.si_addr = (void *) fp->ptregs.pc;
297 break;
298 case 2:
299 info.si_addr = (void *) fp->un.fmt2.iaddr;
300 break;
301 case 7:
302 info.si_addr = (void *) fp->un.fmt7.effaddr;
303 break;
304 case 9:
305 info.si_addr = (void *) fp->un.fmt9.iaddr;
306 break;
307 case 10:
308 info.si_addr = (void *) fp->un.fmta.daddr;
309 break;
310 case 11:
311 info.si_addr = (void *) fp->un.fmtb.daddr;
312 break;
313 }
314 force_sig_info (sig, &info, current);
315}
316
317asmlinkage void set_esp0(unsigned long ssp)
318{
319 current->thread.esp0 = ssp;
320}
321
322/*
323 * The architecture-independent backtrace generator
324 */
325void dump_stack(void)
326{
327 /*
328 * We need frame pointers for this little trick, which works as follows:
329 *
330 * +------------+ 0x00
331 * | Next SP | -> 0x0c
332 * +------------+ 0x04
333 * | Caller |
334 * +------------+ 0x08
335 * | Local vars | -> our stack var
336 * +------------+ 0x0c
337 * | Next SP | -> 0x18, that is what we pass to show_stack()
338 * +------------+ 0x10
339 * | Caller |
340 * +------------+ 0x14
341 * | Local vars |
342 * +------------+ 0x18
343 * | ... |
344 * +------------+
345 */
346
347 unsigned long *stack;
348
349 stack = (unsigned long *)&stack;
350 stack++;
351 __show_stack(current, stack);
352}
353EXPORT_SYMBOL(dump_stack);
354
355void show_stack(struct task_struct *task, unsigned long *stack)
356{
357 if (!stack && !task)
358 dump_stack();
359 else
360 __show_stack(task, stack);
361}
diff --git a/arch/m68k/kernel/vectors.c b/arch/m68k/kernel/vectors.c
new file mode 100644
index 00000000000..147b03fbc71
--- /dev/null
+++ b/arch/m68k/kernel/vectors.c
@@ -0,0 +1,145 @@
1/*
2 * vectors.c
3 *
4 * Copyright (C) 1993, 1994 by Hamish Macdonald
5 *
6 * 68040 fixes by Michael Rausch
7 * 68040 fixes by Martin Apel
8 * 68040 fixes and writeback by Richard Zidlicky
9 * 68060 fixes by Roman Hodek
10 * 68060 fixes by Jesper Skov
11 *
12 * This file is subject to the terms and conditions of the GNU General Public
13 * License. See the file COPYING in the main directory of this archive
14 * for more details.
15 */
16
17/*
18 * Sets up all exception vectors
19 */
20#include <linux/sched.h>
21#include <linux/kernel.h>
22#include <linux/linkage.h>
23#include <linux/init.h>
24#include <linux/kallsyms.h>
25
26#include <asm/setup.h>
27#include <asm/fpu.h>
28#include <asm/system.h>
29#include <asm/traps.h>
30
31/* assembler routines */
32asmlinkage void system_call(void);
33asmlinkage void buserr(void);
34asmlinkage void trap(void);
35asmlinkage void nmihandler(void);
36#ifdef CONFIG_M68KFPU_EMU
37asmlinkage void fpu_emu(void);
38#endif
39
40e_vector vectors[256];
41
42/* nmi handler for the Amiga */
43asm(".text\n"
44 __ALIGN_STR "\n"
45 "nmihandler: rte");
46
47/*
48 * this must be called very early as the kernel might
49 * use some instruction that are emulated on the 060
50 * and so we're prepared for early probe attempts (e.g. nf_init).
51 */
52void __init base_trap_init(void)
53{
54 if (MACH_IS_SUN3X) {
55 extern e_vector *sun3x_prom_vbr;
56
57 __asm__ volatile ("movec %%vbr, %0" : "=r" (sun3x_prom_vbr));
58 }
59
60 /* setup the exception vector table */
61 __asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)vectors));
62
63 if (CPU_IS_060) {
64 /* set up ISP entry points */
65 asmlinkage void unimp_vec(void) asm ("_060_isp_unimp");
66
67 vectors[VEC_UNIMPII] = unimp_vec;
68 }
69
70 vectors[VEC_BUSERR] = buserr;
71 vectors[VEC_ILLEGAL] = trap;
72 vectors[VEC_SYS] = system_call;
73}
74
75void __init trap_init (void)
76{
77 int i;
78
79 for (i = VEC_SPUR; i <= VEC_INT7; i++)
80 vectors[i] = bad_inthandler;
81
82 for (i = 0; i < VEC_USER; i++)
83 if (!vectors[i])
84 vectors[i] = trap;
85
86 for (i = VEC_USER; i < 256; i++)
87 vectors[i] = bad_inthandler;
88
89#ifdef CONFIG_M68KFPU_EMU
90 if (FPU_IS_EMU)
91 vectors[VEC_LINE11] = fpu_emu;
92#endif
93
94 if (CPU_IS_040 && !FPU_IS_EMU) {
95 /* set up FPSP entry points */
96 asmlinkage void dz_vec(void) asm ("dz");
97 asmlinkage void inex_vec(void) asm ("inex");
98 asmlinkage void ovfl_vec(void) asm ("ovfl");
99 asmlinkage void unfl_vec(void) asm ("unfl");
100 asmlinkage void snan_vec(void) asm ("snan");
101 asmlinkage void operr_vec(void) asm ("operr");
102 asmlinkage void bsun_vec(void) asm ("bsun");
103 asmlinkage void fline_vec(void) asm ("fline");
104 asmlinkage void unsupp_vec(void) asm ("unsupp");
105
106 vectors[VEC_FPDIVZ] = dz_vec;
107 vectors[VEC_FPIR] = inex_vec;
108 vectors[VEC_FPOVER] = ovfl_vec;
109 vectors[VEC_FPUNDER] = unfl_vec;
110 vectors[VEC_FPNAN] = snan_vec;
111 vectors[VEC_FPOE] = operr_vec;
112 vectors[VEC_FPBRUC] = bsun_vec;
113 vectors[VEC_LINE11] = fline_vec;
114 vectors[VEC_FPUNSUP] = unsupp_vec;
115 }
116
117 if (CPU_IS_060 && !FPU_IS_EMU) {
118 /* set up IFPSP entry points */
119 asmlinkage void snan_vec6(void) asm ("_060_fpsp_snan");
120 asmlinkage void operr_vec6(void) asm ("_060_fpsp_operr");
121 asmlinkage void ovfl_vec6(void) asm ("_060_fpsp_ovfl");
122 asmlinkage void unfl_vec6(void) asm ("_060_fpsp_unfl");
123 asmlinkage void dz_vec6(void) asm ("_060_fpsp_dz");
124 asmlinkage void inex_vec6(void) asm ("_060_fpsp_inex");
125 asmlinkage void fline_vec6(void) asm ("_060_fpsp_fline");
126 asmlinkage void unsupp_vec6(void) asm ("_060_fpsp_unsupp");
127 asmlinkage void effadd_vec6(void) asm ("_060_fpsp_effadd");
128
129 vectors[VEC_FPNAN] = snan_vec6;
130 vectors[VEC_FPOE] = operr_vec6;
131 vectors[VEC_FPOVER] = ovfl_vec6;
132 vectors[VEC_FPUNDER] = unfl_vec6;
133 vectors[VEC_FPDIVZ] = dz_vec6;
134 vectors[VEC_FPIR] = inex_vec6;
135 vectors[VEC_LINE11] = fline_vec6;
136 vectors[VEC_FPUNSUP] = unsupp_vec6;
137 vectors[VEC_UNIMPEA] = effadd_vec6;
138 }
139
140 /* if running on an amiga, make the NMI interrupt do nothing */
141 if (MACH_IS_AMIGA) {
142 vectors[VEC_INT7] = nmihandler;
143 }
144}
145
diff --git a/arch/m68k/kernel/vmlinux.lds_no.S b/arch/m68k/kernel/vmlinux.lds_no.S
index 7dc4087a954..4e238934083 100644
--- a/arch/m68k/kernel/vmlinux.lds_no.S
+++ b/arch/m68k/kernel/vmlinux.lds_no.S
@@ -77,7 +77,6 @@ SECTIONS {
77 77
78 *(.rodata) *(.rodata.*) 78 *(.rodata) *(.rodata.*)
79 *(__vermagic) /* Kernel version magic */ 79 *(__vermagic) /* Kernel version magic */
80 *(__markers_strings)
81 *(.rodata1) 80 *(.rodata1)
82 *(.rodata.str1.1) 81 *(.rodata.str1.1)
83 82
diff --git a/arch/m68k/lib/memcpy.c b/arch/m68k/lib/memcpy.c
index 06488931697..10ca051d56b 100644
--- a/arch/m68k/lib/memcpy.c
+++ b/arch/m68k/lib/memcpy.c
@@ -22,6 +22,15 @@ void *memcpy(void *to, const void *from, size_t n)
22 from = cfrom; 22 from = cfrom;
23 n--; 23 n--;
24 } 24 }
25#if defined(CONFIG_M68000)
26 if ((long)from & 1) {
27 char *cto = to;
28 const char *cfrom = from;
29 for (; n; n--)
30 *cto++ = *cfrom++;
31 return xto;
32 }
33#endif
25 if (n > 2 && (long)to & 2) { 34 if (n > 2 && (long)to & 2) {
26 short *sto = to; 35 short *sto = to;
27 const short *sfrom = from; 36 const short *sfrom = from;
diff --git a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c
index 900d899f332..f92190c159b 100644
--- a/arch/m68k/mac/macints.c
+++ b/arch/m68k/mac/macints.c
@@ -370,7 +370,7 @@ int mac_irq_pending(unsigned int irq)
370 break; 370 break;
371 case 4: 371 case 4:
372 if (psc_present) 372 if (psc_present)
373 psc_irq_pending(irq); 373 return psc_irq_pending(irq);
374 break; 374 break;
375 } 375 }
376 return 0; 376 return 0;
diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c
index e023fc6b37e..eb915551de6 100644
--- a/arch/m68k/mac/misc.c
+++ b/arch/m68k/mac/misc.c
@@ -304,35 +304,41 @@ static void via_write_pram(int offset, __u8 data)
304static long via_read_time(void) 304static long via_read_time(void)
305{ 305{
306 union { 306 union {
307 __u8 cdata[4]; 307 __u8 cdata[4];
308 long idata; 308 long idata;
309 } result, last_result; 309 } result, last_result;
310 int ct; 310 int count = 1;
311
312 via_pram_command(0x81, &last_result.cdata[3]);
313 via_pram_command(0x85, &last_result.cdata[2]);
314 via_pram_command(0x89, &last_result.cdata[1]);
315 via_pram_command(0x8D, &last_result.cdata[0]);
311 316
312 /* 317 /*
313 * The NetBSD guys say to loop until you get the same reading 318 * The NetBSD guys say to loop until you get the same reading
314 * twice in a row. 319 * twice in a row.
315 */ 320 */
316 321
317 ct = 0; 322 while (1) {
318 do {
319 if (++ct > 10) {
320 printk("via_read_time: couldn't get valid time, "
321 "last read = 0x%08lx and 0x%08lx\n",
322 last_result.idata, result.idata);
323 break;
324 }
325
326 last_result.idata = result.idata;
327 result.idata = 0;
328
329 via_pram_command(0x81, &result.cdata[3]); 323 via_pram_command(0x81, &result.cdata[3]);
330 via_pram_command(0x85, &result.cdata[2]); 324 via_pram_command(0x85, &result.cdata[2]);
331 via_pram_command(0x89, &result.cdata[1]); 325 via_pram_command(0x89, &result.cdata[1]);
332 via_pram_command(0x8D, &result.cdata[0]); 326 via_pram_command(0x8D, &result.cdata[0]);
333 } while (result.idata != last_result.idata);
334 327
335 return result.idata - RTC_OFFSET; 328 if (result.idata == last_result.idata)
329 return result.idata - RTC_OFFSET;
330
331 if (++count > 10)
332 break;
333
334 last_result.idata = result.idata;
335 }
336
337 pr_err("via_read_time: failed to read a stable value; "
338 "got 0x%08lx then 0x%08lx\n",
339 last_result.idata, result.idata);
340
341 return 0;
336} 342}
337 343
338/* 344/*
diff --git a/arch/m68k/mm/init_no.c b/arch/m68k/mm/init_no.c
index 50cd12cf28d..1e33d39ca9a 100644
--- a/arch/m68k/mm/init_no.c
+++ b/arch/m68k/mm/init_no.c
@@ -32,6 +32,7 @@
32#include <linux/gfp.h> 32#include <linux/gfp.h>
33 33
34#include <asm/setup.h> 34#include <asm/setup.h>
35#include <asm/sections.h>
35#include <asm/segment.h> 36#include <asm/segment.h>
36#include <asm/page.h> 37#include <asm/page.h>
37#include <asm/pgtable.h> 38#include <asm/pgtable.h>
@@ -44,9 +45,6 @@
44 */ 45 */
45void *empty_zero_page; 46void *empty_zero_page;
46 47
47extern unsigned long memory_start;
48extern unsigned long memory_end;
49
50/* 48/*
51 * paging_init() continues the virtual memory environment setup which 49 * paging_init() continues the virtual memory environment setup which
52 * was begun by the code in arch/head.S. 50 * was begun by the code in arch/head.S.
@@ -78,8 +76,6 @@ void __init mem_init(void)
78{ 76{
79 int codek = 0, datak = 0, initk = 0; 77 int codek = 0, datak = 0, initk = 0;
80 unsigned long tmp; 78 unsigned long tmp;
81 extern char _etext, _stext, _sdata, _ebss, __init_begin, __init_end;
82 extern unsigned int _ramend, _rambase;
83 unsigned long len = _ramend - _rambase; 79 unsigned long len = _ramend - _rambase;
84 unsigned long start_mem = memory_start; /* DAVIDM - these must start at end of kernel */ 80 unsigned long start_mem = memory_start; /* DAVIDM - these must start at end of kernel */
85 unsigned long end_mem = memory_end; /* DAVIDM - this must not include kernel stack at top */ 81 unsigned long end_mem = memory_end; /* DAVIDM - this must not include kernel stack at top */
@@ -95,9 +91,9 @@ void __init mem_init(void)
95 /* this will put all memory onto the freelists */ 91 /* this will put all memory onto the freelists */
96 totalram_pages = free_all_bootmem(); 92 totalram_pages = free_all_bootmem();
97 93
98 codek = (&_etext - &_stext) >> 10; 94 codek = (_etext - _stext) >> 10;
99 datak = (&_ebss - &_sdata) >> 10; 95 datak = (_ebss - _sdata) >> 10;
100 initk = (&__init_begin - &__init_end) >> 10; 96 initk = (__init_begin - __init_end) >> 10;
101 97
102 tmp = nr_free_pages() << PAGE_SHIFT; 98 tmp = nr_free_pages() << PAGE_SHIFT;
103 printk(KERN_INFO "Memory available: %luk/%luk RAM, (%dk kernel code, %dk data)\n", 99 printk(KERN_INFO "Memory available: %luk/%luk RAM, (%dk kernel code, %dk data)\n",
@@ -129,22 +125,21 @@ void free_initmem(void)
129{ 125{
130#ifdef CONFIG_RAMKERNEL 126#ifdef CONFIG_RAMKERNEL
131 unsigned long addr; 127 unsigned long addr;
132 extern char __init_begin, __init_end;
133 /* 128 /*
134 * The following code should be cool even if these sections 129 * The following code should be cool even if these sections
135 * are not page aligned. 130 * are not page aligned.
136 */ 131 */
137 addr = PAGE_ALIGN((unsigned long)(&__init_begin)); 132 addr = PAGE_ALIGN((unsigned long) __init_begin);
138 /* next to check that the page we free is not a partial page */ 133 /* next to check that the page we free is not a partial page */
139 for (; addr + PAGE_SIZE < (unsigned long)(&__init_end); addr +=PAGE_SIZE) { 134 for (; addr + PAGE_SIZE < ((unsigned long) __init_end); addr += PAGE_SIZE) {
140 ClearPageReserved(virt_to_page(addr)); 135 ClearPageReserved(virt_to_page(addr));
141 init_page_count(virt_to_page(addr)); 136 init_page_count(virt_to_page(addr));
142 free_page(addr); 137 free_page(addr);
143 totalram_pages++; 138 totalram_pages++;
144 } 139 }
145 pr_notice("Freeing unused kernel memory: %luk freed (0x%x - 0x%x)\n", 140 pr_notice("Freeing unused kernel memory: %luk freed (0x%x - 0x%x)\n",
146 (addr - PAGE_ALIGN((long) &__init_begin)) >> 10, 141 (addr - PAGE_ALIGN((unsigned long) __init_begin)) >> 10,
147 (int)(PAGE_ALIGN((unsigned long)(&__init_begin))), 142 (int)(PAGE_ALIGN((unsigned long) __init_begin)),
148 (int)(addr - PAGE_SIZE)); 143 (int)(addr - PAGE_SIZE));
149#endif 144#endif
150} 145}
diff --git a/arch/m68k/platform/520x/config.c b/arch/m68k/platform/520x/config.c
index 621238f1a21..8a98683f1b1 100644
--- a/arch/m68k/platform/520x/config.c
+++ b/arch/m68k/platform/520x/config.c
@@ -91,9 +91,9 @@ static struct resource m520x_qspi_resources[] = {
91 }, 91 },
92}; 92};
93 93
94#define MCFQSPI_CS0 62 94#define MCFQSPI_CS0 46
95#define MCFQSPI_CS1 63 95#define MCFQSPI_CS1 47
96#define MCFQSPI_CS2 44 96#define MCFQSPI_CS2 27
97 97
98static int m520x_cs_setup(struct mcfqspi_cs_control *cs_control) 98static int m520x_cs_setup(struct mcfqspi_cs_control *cs_control)
99{ 99{
diff --git a/arch/m68k/platform/520x/gpio.c b/arch/m68k/platform/520x/gpio.c
index d757328563d..9bcc3e4b60c 100644
--- a/arch/m68k/platform/520x/gpio.c
+++ b/arch/m68k/platform/520x/gpio.c
@@ -38,42 +38,6 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
38 }, 38 },
39 { 39 {
40 .gpio_chip = { 40 .gpio_chip = {
41 .label = "BUSCTL",
42 .request = mcf_gpio_request,
43 .free = mcf_gpio_free,
44 .direction_input = mcf_gpio_direction_input,
45 .direction_output = mcf_gpio_direction_output,
46 .get = mcf_gpio_get_value,
47 .set = mcf_gpio_set_value_fast,
48 .base = 8,
49 .ngpio = 4,
50 },
51 .pddr = (void __iomem *) MCFGPIO_PDDR_BUSCTL,
52 .podr = (void __iomem *) MCFGPIO_PODR_BUSCTL,
53 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_BUSCTL,
54 .setr = (void __iomem *) MCFGPIO_PPDSDR_BUSCTL,
55 .clrr = (void __iomem *) MCFGPIO_PCLRR_BUSCTL,
56 },
57 {
58 .gpio_chip = {
59 .label = "BE",
60 .request = mcf_gpio_request,
61 .free = mcf_gpio_free,
62 .direction_input = mcf_gpio_direction_input,
63 .direction_output = mcf_gpio_direction_output,
64 .get = mcf_gpio_get_value,
65 .set = mcf_gpio_set_value_fast,
66 .base = 16,
67 .ngpio = 4,
68 },
69 .pddr = (void __iomem *) MCFGPIO_PDDR_BE,
70 .podr = (void __iomem *) MCFGPIO_PODR_BE,
71 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_BE,
72 .setr = (void __iomem *) MCFGPIO_PPDSDR_BE,
73 .clrr = (void __iomem *) MCFGPIO_PCLRR_BE,
74 },
75 {
76 .gpio_chip = {
77 .label = "CS", 41 .label = "CS",
78 .request = mcf_gpio_request, 42 .request = mcf_gpio_request,
79 .free = mcf_gpio_free, 43 .free = mcf_gpio_free,
@@ -81,7 +45,7 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
81 .direction_output = mcf_gpio_direction_output, 45 .direction_output = mcf_gpio_direction_output,
82 .get = mcf_gpio_get_value, 46 .get = mcf_gpio_get_value,
83 .set = mcf_gpio_set_value_fast, 47 .set = mcf_gpio_set_value_fast,
84 .base = 25, 48 .base = 9,
85 .ngpio = 3, 49 .ngpio = 3,
86 }, 50 },
87 .pddr = (void __iomem *) MCFGPIO_PDDR_CS, 51 .pddr = (void __iomem *) MCFGPIO_PDDR_CS,
@@ -99,7 +63,7 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
99 .direction_output = mcf_gpio_direction_output, 63 .direction_output = mcf_gpio_direction_output,
100 .get = mcf_gpio_get_value, 64 .get = mcf_gpio_get_value,
101 .set = mcf_gpio_set_value_fast, 65 .set = mcf_gpio_set_value_fast,
102 .base = 32, 66 .base = 16,
103 .ngpio = 4, 67 .ngpio = 4,
104 }, 68 },
105 .pddr = (void __iomem *) MCFGPIO_PDDR_FECI2C, 69 .pddr = (void __iomem *) MCFGPIO_PDDR_FECI2C,
@@ -117,7 +81,7 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
117 .direction_output = mcf_gpio_direction_output, 81 .direction_output = mcf_gpio_direction_output,
118 .get = mcf_gpio_get_value, 82 .get = mcf_gpio_get_value,
119 .set = mcf_gpio_set_value_fast, 83 .set = mcf_gpio_set_value_fast,
120 .base = 40, 84 .base = 24,
121 .ngpio = 4, 85 .ngpio = 4,
122 }, 86 },
123 .pddr = (void __iomem *) MCFGPIO_PDDR_QSPI, 87 .pddr = (void __iomem *) MCFGPIO_PDDR_QSPI,
@@ -135,7 +99,7 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
135 .direction_output = mcf_gpio_direction_output, 99 .direction_output = mcf_gpio_direction_output,
136 .get = mcf_gpio_get_value, 100 .get = mcf_gpio_get_value,
137 .set = mcf_gpio_set_value_fast, 101 .set = mcf_gpio_set_value_fast,
138 .base = 48, 102 .base = 32,
139 .ngpio = 4, 103 .ngpio = 4,
140 }, 104 },
141 .pddr = (void __iomem *) MCFGPIO_PDDR_TIMER, 105 .pddr = (void __iomem *) MCFGPIO_PDDR_TIMER,
@@ -153,7 +117,7 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
153 .direction_output = mcf_gpio_direction_output, 117 .direction_output = mcf_gpio_direction_output,
154 .get = mcf_gpio_get_value, 118 .get = mcf_gpio_get_value,
155 .set = mcf_gpio_set_value_fast, 119 .set = mcf_gpio_set_value_fast,
156 .base = 56, 120 .base = 40,
157 .ngpio = 8, 121 .ngpio = 8,
158 }, 122 },
159 .pddr = (void __iomem *) MCFGPIO_PDDR_UART, 123 .pddr = (void __iomem *) MCFGPIO_PDDR_UART,
@@ -171,7 +135,7 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
171 .direction_output = mcf_gpio_direction_output, 135 .direction_output = mcf_gpio_direction_output,
172 .get = mcf_gpio_get_value, 136 .get = mcf_gpio_get_value,
173 .set = mcf_gpio_set_value_fast, 137 .set = mcf_gpio_set_value_fast,
174 .base = 64, 138 .base = 48,
175 .ngpio = 8, 139 .ngpio = 8,
176 }, 140 },
177 .pddr = (void __iomem *) MCFGPIO_PDDR_FECH, 141 .pddr = (void __iomem *) MCFGPIO_PDDR_FECH,
@@ -189,7 +153,7 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
189 .direction_output = mcf_gpio_direction_output, 153 .direction_output = mcf_gpio_direction_output,
190 .get = mcf_gpio_get_value, 154 .get = mcf_gpio_get_value,
191 .set = mcf_gpio_set_value_fast, 155 .set = mcf_gpio_set_value_fast,
192 .base = 72, 156 .base = 56,
193 .ngpio = 8, 157 .ngpio = 8,
194 }, 158 },
195 .pddr = (void __iomem *) MCFGPIO_PDDR_FECL, 159 .pddr = (void __iomem *) MCFGPIO_PDDR_FECL,
diff --git a/arch/m68k/platform/68328/Makefile b/arch/m68k/platform/68328/Makefile
index 5e5435552d5..e4dfd8fde06 100644
--- a/arch/m68k/platform/68328/Makefile
+++ b/arch/m68k/platform/68328/Makefile
@@ -2,7 +2,10 @@
2# Makefile for arch/m68knommu/platform/68328. 2# Makefile for arch/m68knommu/platform/68328.
3# 3#
4 4
5head-y = head-$(MODEL).o 5model-y := ram
6model-$(CONFIG_ROMKERNEL) := rom
7
8head-y = head-$(model-y).o
6head-$(CONFIG_PILOT) = head-pilot.o 9head-$(CONFIG_PILOT) = head-pilot.o
7head-$(CONFIG_DRAGEN2) = head-de2.o 10head-$(CONFIG_DRAGEN2) = head-de2.o
8 11
diff --git a/arch/m68k/platform/68328/entry.S b/arch/m68k/platform/68328/entry.S
index 293e1eba9ac..5c39b80ed7d 100644
--- a/arch/m68k/platform/68328/entry.S
+++ b/arch/m68k/platform/68328/entry.S
@@ -67,7 +67,7 @@ ret_from_signal:
67 jra ret_from_exception 67 jra ret_from_exception
68 68
69ENTRY(system_call) 69ENTRY(system_call)
70 SAVE_ALL 70 SAVE_ALL_SYS
71 71
72 /* save top of frame*/ 72 /* save top of frame*/
73 pea %sp@ 73 pea %sp@
@@ -129,7 +129,7 @@ Lsignal_return:
129 * This is the main interrupt handler, responsible for calling process_int() 129 * This is the main interrupt handler, responsible for calling process_int()
130 */ 130 */
131inthandler1: 131inthandler1:
132 SAVE_ALL 132 SAVE_ALL_INT
133 movew %sp@(PT_OFF_FORMATVEC), %d0 133 movew %sp@(PT_OFF_FORMATVEC), %d0
134 and #0x3ff, %d0 134 and #0x3ff, %d0
135 135
@@ -140,7 +140,7 @@ inthandler1:
140 bra ret_from_interrupt 140 bra ret_from_interrupt
141 141
142inthandler2: 142inthandler2:
143 SAVE_ALL 143 SAVE_ALL_INT
144 movew %sp@(PT_OFF_FORMATVEC), %d0 144 movew %sp@(PT_OFF_FORMATVEC), %d0
145 and #0x3ff, %d0 145 and #0x3ff, %d0
146 146
@@ -151,7 +151,7 @@ inthandler2:
151 bra ret_from_interrupt 151 bra ret_from_interrupt
152 152
153inthandler3: 153inthandler3:
154 SAVE_ALL 154 SAVE_ALL_INT
155 movew %sp@(PT_OFF_FORMATVEC), %d0 155 movew %sp@(PT_OFF_FORMATVEC), %d0
156 and #0x3ff, %d0 156 and #0x3ff, %d0
157 157
@@ -162,7 +162,7 @@ inthandler3:
162 bra ret_from_interrupt 162 bra ret_from_interrupt
163 163
164inthandler4: 164inthandler4:
165 SAVE_ALL 165 SAVE_ALL_INT
166 movew %sp@(PT_OFF_FORMATVEC), %d0 166 movew %sp@(PT_OFF_FORMATVEC), %d0
167 and #0x3ff, %d0 167 and #0x3ff, %d0
168 168
@@ -173,7 +173,7 @@ inthandler4:
173 bra ret_from_interrupt 173 bra ret_from_interrupt
174 174
175inthandler5: 175inthandler5:
176 SAVE_ALL 176 SAVE_ALL_INT
177 movew %sp@(PT_OFF_FORMATVEC), %d0 177 movew %sp@(PT_OFF_FORMATVEC), %d0
178 and #0x3ff, %d0 178 and #0x3ff, %d0
179 179
@@ -184,7 +184,7 @@ inthandler5:
184 bra ret_from_interrupt 184 bra ret_from_interrupt
185 185
186inthandler6: 186inthandler6:
187 SAVE_ALL 187 SAVE_ALL_INT
188 movew %sp@(PT_OFF_FORMATVEC), %d0 188 movew %sp@(PT_OFF_FORMATVEC), %d0
189 and #0x3ff, %d0 189 and #0x3ff, %d0
190 190
@@ -195,7 +195,7 @@ inthandler6:
195 bra ret_from_interrupt 195 bra ret_from_interrupt
196 196
197inthandler7: 197inthandler7:
198 SAVE_ALL 198 SAVE_ALL_INT
199 movew %sp@(PT_OFF_FORMATVEC), %d0 199 movew %sp@(PT_OFF_FORMATVEC), %d0
200 and #0x3ff, %d0 200 and #0x3ff, %d0
201 201
@@ -206,7 +206,7 @@ inthandler7:
206 bra ret_from_interrupt 206 bra ret_from_interrupt
207 207
208inthandler: 208inthandler:
209 SAVE_ALL 209 SAVE_ALL_INT
210 movew %sp@(PT_OFF_FORMATVEC), %d0 210 movew %sp@(PT_OFF_FORMATVEC), %d0
211 and #0x3ff, %d0 211 and #0x3ff, %d0
212 212
diff --git a/arch/m68k/platform/68360/Makefile b/arch/m68k/platform/68360/Makefile
index cf5af73a578..f6f43438304 100644
--- a/arch/m68k/platform/68360/Makefile
+++ b/arch/m68k/platform/68360/Makefile
@@ -1,10 +1,12 @@
1# 1#
2# Makefile for arch/m68knommu/platform/68360. 2# Makefile for arch/m68knommu/platform/68360.
3# 3#
4model-y := ram
5model-$(CONFIG_ROMKERNEL) := rom
4 6
5obj-y := config.o commproc.o entry.o ints.o 7obj-y := config.o commproc.o entry.o ints.o
6 8
7extra-y := head.o 9extra-y := head.o
8 10
9$(obj)/head.o: $(obj)/head-$(MODEL).o 11$(obj)/head.o: $(obj)/head-$(model-y).o
10 ln -sf head-$(MODEL).o $(obj)/head.o 12 ln -sf head-$(model-y).o $(obj)/head.o
diff --git a/arch/m68k/platform/68360/entry.S b/arch/m68k/platform/68360/entry.S
index abbb89672ea..aa47d1d4992 100644
--- a/arch/m68k/platform/68360/entry.S
+++ b/arch/m68k/platform/68360/entry.S
@@ -63,7 +63,7 @@ ret_from_signal:
63 jra ret_from_exception 63 jra ret_from_exception
64 64
65ENTRY(system_call) 65ENTRY(system_call)
66 SAVE_ALL 66 SAVE_ALL_SYS
67 67
68 /* save top of frame*/ 68 /* save top of frame*/
69 pea %sp@ 69 pea %sp@
@@ -125,7 +125,7 @@ Lsignal_return:
125 * This is the main interrupt handler, responsible for calling do_IRQ() 125 * This is the main interrupt handler, responsible for calling do_IRQ()
126 */ 126 */
127inthandler: 127inthandler:
128 SAVE_ALL 128 SAVE_ALL_INT
129 movew %sp@(PT_OFF_FORMATVEC), %d0 129 movew %sp@(PT_OFF_FORMATVEC), %d0
130 and.l #0x3ff, %d0 130 and.l #0x3ff, %d0
131 lsr.l #0x02, %d0 131 lsr.l #0x02, %d0
diff --git a/arch/m68k/platform/coldfire/entry.S b/arch/m68k/platform/coldfire/entry.S
index bd27242c2f4..3157461a8d1 100644
--- a/arch/m68k/platform/coldfire/entry.S
+++ b/arch/m68k/platform/coldfire/entry.S
@@ -61,7 +61,7 @@ enosys:
61 bra 1f 61 bra 1f
62 62
63ENTRY(system_call) 63ENTRY(system_call)
64 SAVE_ALL 64 SAVE_ALL_SYS
65 move #0x2000,%sr /* enable intrs again */ 65 move #0x2000,%sr /* enable intrs again */
66 66
67 cmpl #NR_syscalls,%d0 67 cmpl #NR_syscalls,%d0
@@ -165,9 +165,7 @@ Lsignal_return:
165 * sources). Calls up to high level code to do all the work. 165 * sources). Calls up to high level code to do all the work.
166 */ 166 */
167ENTRY(inthandler) 167ENTRY(inthandler)
168 SAVE_ALL 168 SAVE_ALL_INT
169 moveq #-1,%d0
170 movel %d0,%sp@(PT_OFF_ORIG_D0)
171 169
172 movew %sp@(PT_OFF_FORMATVEC),%d0 /* put exception # in d0 */ 170 movew %sp@(PT_OFF_FORMATVEC),%d0 /* put exception # in d0 */
173 andl #0x03fc,%d0 /* mask out vector only */ 171 andl #0x03fc,%d0 /* mask out vector only */
diff --git a/arch/m68k/q40/README b/arch/m68k/q40/README
index b26d5f55e91..93f4c4cd3c4 100644
--- a/arch/m68k/q40/README
+++ b/arch/m68k/q40/README
@@ -31,7 +31,7 @@ drivers used by the Q40, apart from the very obvious (console etc.):
31 char/joystick/* # most of this should work, not 31 char/joystick/* # most of this should work, not
32 # in default config.in 32 # in default config.in
33 block/q40ide.c # startup for ide 33 block/q40ide.c # startup for ide
34 ide* # see Documentation/ide.txt 34 ide* # see Documentation/ide/ide.txt
35 floppy.c # normal PC driver, DMA emu in asm/floppy.h 35 floppy.c # normal PC driver, DMA emu in asm/floppy.h
36 # and arch/m68k/kernel/entry.S 36 # and arch/m68k/kernel/entry.S
37 # see drivers/block/README.fd 37 # see drivers/block/README.fd
diff --git a/arch/microblaze/include/asm/dma-mapping.h b/arch/microblaze/include/asm/dma-mapping.h
index 8fbb0ec1023..a569514cf19 100644
--- a/arch/microblaze/include/asm/dma-mapping.h
+++ b/arch/microblaze/include/asm/dma-mapping.h
@@ -16,7 +16,7 @@
16#define _ASM_MICROBLAZE_DMA_MAPPING_H 16#define _ASM_MICROBLAZE_DMA_MAPPING_H
17 17
18/* 18/*
19 * See Documentation/PCI/PCI-DMA-mapping.txt and 19 * See Documentation/DMA-API-HOWTO.txt and
20 * Documentation/DMA-API.txt for documentation. 20 * Documentation/DMA-API.txt for documentation.
21 */ 21 */
22 22
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
index 213f2d67166..36a133e5ee3 100644
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -304,11 +304,11 @@ asmlinkage void __init mmu_init(void)
304 /* Map in all of RAM starting at CONFIG_KERNEL_START */ 304 /* Map in all of RAM starting at CONFIG_KERNEL_START */
305 mapin_ram(); 305 mapin_ram();
306 306
307#ifdef HIGHMEM_START_BOOL 307#ifdef CONFIG_HIGHMEM_START_BOOL
308 ioremap_base = HIGHMEM_START; 308 ioremap_base = CONFIG_HIGHMEM_START;
309#else 309#else
310 ioremap_base = 0xfe000000UL; /* for now, could be 0xfffff000 */ 310 ioremap_base = 0xfe000000UL; /* for now, could be 0xfffff000 */
311#endif /* CONFIG_HIGHMEM */ 311#endif /* CONFIG_HIGHMEM_START_BOOL */
312 ioremap_bot = ioremap_base; 312 ioremap_bot = ioremap_base;
313 313
314 /* Initialize the context management stuff */ 314 /* Initialize the context management stuff */
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index b122adc8bdb..4cbc6d8de21 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -92,15 +92,8 @@ config BCM47XX
92 select DMA_NONCOHERENT 92 select DMA_NONCOHERENT
93 select HW_HAS_PCI 93 select HW_HAS_PCI
94 select IRQ_CPU 94 select IRQ_CPU
95 select SYS_HAS_CPU_MIPS32_R1
96 select SYS_SUPPORTS_32BIT_KERNEL 95 select SYS_SUPPORTS_32BIT_KERNEL
97 select SYS_SUPPORTS_LITTLE_ENDIAN 96 select SYS_SUPPORTS_LITTLE_ENDIAN
98 select SSB
99 select SSB_DRIVER_MIPS
100 select SSB_DRIVER_EXTIF
101 select SSB_EMBEDDED
102 select SSB_B43_PCI_BRIDGE if PCI
103 select SSB_PCICORE_HOSTMODE if PCI
104 select GENERIC_GPIO 97 select GENERIC_GPIO
105 select SYS_HAS_EARLY_PRINTK 98 select SYS_HAS_EARLY_PRINTK
106 select CFE 99 select CFE
@@ -791,6 +784,7 @@ endchoice
791 784
792source "arch/mips/alchemy/Kconfig" 785source "arch/mips/alchemy/Kconfig"
793source "arch/mips/ath79/Kconfig" 786source "arch/mips/ath79/Kconfig"
787source "arch/mips/bcm47xx/Kconfig"
794source "arch/mips/bcm63xx/Kconfig" 788source "arch/mips/bcm63xx/Kconfig"
795source "arch/mips/jazz/Kconfig" 789source "arch/mips/jazz/Kconfig"
796source "arch/mips/jz4740/Kconfig" 790source "arch/mips/jz4740/Kconfig"
diff --git a/arch/mips/bcm47xx/Kconfig b/arch/mips/bcm47xx/Kconfig
new file mode 100644
index 00000000000..6210b8d8410
--- /dev/null
+++ b/arch/mips/bcm47xx/Kconfig
@@ -0,0 +1,31 @@
1if BCM47XX
2
3config BCM47XX_SSB
4 bool "SSB Support for Broadcom BCM47XX"
5 select SYS_HAS_CPU_MIPS32_R1
6 select SSB
7 select SSB_DRIVER_MIPS
8 select SSB_DRIVER_EXTIF
9 select SSB_EMBEDDED
10 select SSB_B43_PCI_BRIDGE if PCI
11 select SSB_PCICORE_HOSTMODE if PCI
12 default y
13 help
14 Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support.
15
16 This will generate an image with support for SSB and MIPS32 R1 instruction set.
17
18config BCM47XX_BCMA
19 bool "BCMA Support for Broadcom BCM47XX"
20 select SYS_HAS_CPU_MIPS32_R2
21 select BCMA
22 select BCMA_HOST_SOC
23 select BCMA_DRIVER_MIPS
24 select BCMA_DRIVER_PCI_HOSTMODE if PCI
25 default y
26 help
27 Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus.
28
29 This will generate an image with support for BCMA and MIPS32 R2 instruction set.
30
31endif
diff --git a/arch/mips/bcm47xx/Makefile b/arch/mips/bcm47xx/Makefile
index 7465e8a72d9..4add17349ff 100644
--- a/arch/mips/bcm47xx/Makefile
+++ b/arch/mips/bcm47xx/Makefile
@@ -3,4 +3,5 @@
3# under Linux. 3# under Linux.
4# 4#
5 5
6obj-y := gpio.o irq.o nvram.o prom.o serial.o setup.o time.o wgt634u.o 6obj-y += gpio.o irq.o nvram.o prom.o serial.o setup.o time.o
7obj-$(CONFIG_BCM47XX_SSB) += wgt634u.o
diff --git a/arch/mips/bcm47xx/gpio.c b/arch/mips/bcm47xx/gpio.c
index e4a5ee9c972..57b425fd4d4 100644
--- a/arch/mips/bcm47xx/gpio.c
+++ b/arch/mips/bcm47xx/gpio.c
@@ -20,42 +20,82 @@ static DECLARE_BITMAP(gpio_in_use, BCM47XX_EXTIF_GPIO_LINES);
20 20
21int gpio_request(unsigned gpio, const char *tag) 21int gpio_request(unsigned gpio, const char *tag)
22{ 22{
23 if (ssb_chipco_available(&ssb_bcm47xx.chipco) && 23 switch (bcm47xx_bus_type) {
24 ((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES)) 24#ifdef CONFIG_BCM47XX_SSB
25 return -EINVAL; 25 case BCM47XX_BUS_TYPE_SSB:
26 if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco) &&
27 ((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES))
28 return -EINVAL;
26 29
27 if (ssb_extif_available(&ssb_bcm47xx.extif) && 30 if (ssb_extif_available(&bcm47xx_bus.ssb.extif) &&
28 ((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES)) 31 ((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES))
29 return -EINVAL; 32 return -EINVAL;
30 33
31 if (test_and_set_bit(gpio, gpio_in_use)) 34 if (test_and_set_bit(gpio, gpio_in_use))
32 return -EBUSY; 35 return -EBUSY;
33 36
34 return 0; 37 return 0;
38#endif
39#ifdef CONFIG_BCM47XX_BCMA
40 case BCM47XX_BUS_TYPE_BCMA:
41 if (gpio >= BCM47XX_CHIPCO_GPIO_LINES)
42 return -EINVAL;
43
44 if (test_and_set_bit(gpio, gpio_in_use))
45 return -EBUSY;
46
47 return 0;
48#endif
49 }
50 return -EINVAL;
35} 51}
36EXPORT_SYMBOL(gpio_request); 52EXPORT_SYMBOL(gpio_request);
37 53
38void gpio_free(unsigned gpio) 54void gpio_free(unsigned gpio)
39{ 55{
40 if (ssb_chipco_available(&ssb_bcm47xx.chipco) && 56 switch (bcm47xx_bus_type) {
41 ((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES)) 57#ifdef CONFIG_BCM47XX_SSB
42 return; 58 case BCM47XX_BUS_TYPE_SSB:
59 if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco) &&
60 ((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES))
61 return;
62
63 if (ssb_extif_available(&bcm47xx_bus.ssb.extif) &&
64 ((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES))
65 return;
43 66
44 if (ssb_extif_available(&ssb_bcm47xx.extif) && 67 clear_bit(gpio, gpio_in_use);
45 ((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES))
46 return; 68 return;
69#endif
70#ifdef CONFIG_BCM47XX_BCMA
71 case BCM47XX_BUS_TYPE_BCMA:
72 if (gpio >= BCM47XX_CHIPCO_GPIO_LINES)
73 return;
47 74
48 clear_bit(gpio, gpio_in_use); 75 clear_bit(gpio, gpio_in_use);
76 return;
77#endif
78 }
49} 79}
50EXPORT_SYMBOL(gpio_free); 80EXPORT_SYMBOL(gpio_free);
51 81
52int gpio_to_irq(unsigned gpio) 82int gpio_to_irq(unsigned gpio)
53{ 83{
54 if (ssb_chipco_available(&ssb_bcm47xx.chipco)) 84 switch (bcm47xx_bus_type) {
55 return ssb_mips_irq(ssb_bcm47xx.chipco.dev) + 2; 85#ifdef CONFIG_BCM47XX_SSB
56 else if (ssb_extif_available(&ssb_bcm47xx.extif)) 86 case BCM47XX_BUS_TYPE_SSB:
57 return ssb_mips_irq(ssb_bcm47xx.extif.dev) + 2; 87 if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco))
58 else 88 return ssb_mips_irq(bcm47xx_bus.ssb.chipco.dev) + 2;
59 return -EINVAL; 89 else if (ssb_extif_available(&bcm47xx_bus.ssb.extif))
90 return ssb_mips_irq(bcm47xx_bus.ssb.extif.dev) + 2;
91 else
92 return -EINVAL;
93#endif
94#ifdef CONFIG_BCM47XX_BCMA
95 case BCM47XX_BUS_TYPE_BCMA:
96 return bcma_core_mips_irq(bcm47xx_bus.bcma.bus.drv_cc.core) + 2;
97#endif
98 }
99 return -EINVAL;
60} 100}
61EXPORT_SYMBOL_GPL(gpio_to_irq); 101EXPORT_SYMBOL_GPL(gpio_to_irq);
diff --git a/arch/mips/bcm47xx/irq.c b/arch/mips/bcm47xx/irq.c
index 325757acd02..8cf3833b2d2 100644
--- a/arch/mips/bcm47xx/irq.c
+++ b/arch/mips/bcm47xx/irq.c
@@ -26,6 +26,7 @@
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/irq.h> 27#include <linux/irq.h>
28#include <asm/irq_cpu.h> 28#include <asm/irq_cpu.h>
29#include <bcm47xx.h>
29 30
30void plat_irq_dispatch(void) 31void plat_irq_dispatch(void)
31{ 32{
@@ -51,5 +52,16 @@ void plat_irq_dispatch(void)
51 52
52void __init arch_init_irq(void) 53void __init arch_init_irq(void)
53{ 54{
55#ifdef CONFIG_BCM47XX_BCMA
56 if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA) {
57 bcma_write32(bcm47xx_bus.bcma.bus.drv_mips.core,
58 BCMA_MIPS_MIPS74K_INTMASK(5), 1 << 31);
59 /*
60 * the kernel reads the timer irq from some register and thinks
61 * it's #5, but we offset it by 2 and route to #7
62 */
63 cp0_compare_irq = 7;
64 }
65#endif
54 mips_cpu_irq_init(); 66 mips_cpu_irq_init();
55} 67}
diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
index 54db815bc86..a84e3bb7387 100644
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
@@ -26,14 +26,35 @@ static char nvram_buf[NVRAM_SPACE];
26/* Probe for NVRAM header */ 26/* Probe for NVRAM header */
27static void early_nvram_init(void) 27static void early_nvram_init(void)
28{ 28{
29 struct ssb_mipscore *mcore = &ssb_bcm47xx.mipscore; 29#ifdef CONFIG_BCM47XX_SSB
30 struct ssb_mipscore *mcore_ssb;
31#endif
32#ifdef CONFIG_BCM47XX_BCMA
33 struct bcma_drv_cc *bcma_cc;
34#endif
30 struct nvram_header *header; 35 struct nvram_header *header;
31 int i; 36 int i;
32 u32 base, lim, off; 37 u32 base = 0;
38 u32 lim = 0;
39 u32 off;
33 u32 *src, *dst; 40 u32 *src, *dst;
34 41
35 base = mcore->flash_window; 42 switch (bcm47xx_bus_type) {
36 lim = mcore->flash_window_size; 43#ifdef CONFIG_BCM47XX_SSB
44 case BCM47XX_BUS_TYPE_SSB:
45 mcore_ssb = &bcm47xx_bus.ssb.mipscore;
46 base = mcore_ssb->flash_window;
47 lim = mcore_ssb->flash_window_size;
48 break;
49#endif
50#ifdef CONFIG_BCM47XX_BCMA
51 case BCM47XX_BUS_TYPE_BCMA:
52 bcma_cc = &bcm47xx_bus.bcma.bus.drv_cc;
53 base = bcma_cc->pflash.window;
54 lim = bcma_cc->pflash.window_size;
55 break;
56#endif
57 }
37 58
38 off = FLASH_MIN; 59 off = FLASH_MIN;
39 while (off <= lim) { 60 while (off <= lim) {
diff --git a/arch/mips/bcm47xx/serial.c b/arch/mips/bcm47xx/serial.c
index 59c11afdb2a..57981e4fe2b 100644
--- a/arch/mips/bcm47xx/serial.c
+++ b/arch/mips/bcm47xx/serial.c
@@ -23,10 +23,11 @@ static struct platform_device uart8250_device = {
23 }, 23 },
24}; 24};
25 25
26static int __init uart8250_init(void) 26#ifdef CONFIG_BCM47XX_SSB
27static int __init uart8250_init_ssb(void)
27{ 28{
28 int i; 29 int i;
29 struct ssb_mipscore *mcore = &(ssb_bcm47xx.mipscore); 30 struct ssb_mipscore *mcore = &(bcm47xx_bus.ssb.mipscore);
30 31
31 memset(&uart8250_data, 0, sizeof(uart8250_data)); 32 memset(&uart8250_data, 0, sizeof(uart8250_data));
32 33
@@ -44,6 +45,47 @@ static int __init uart8250_init(void)
44 } 45 }
45 return platform_device_register(&uart8250_device); 46 return platform_device_register(&uart8250_device);
46} 47}
48#endif
49
50#ifdef CONFIG_BCM47XX_BCMA
51static int __init uart8250_init_bcma(void)
52{
53 int i;
54 struct bcma_drv_cc *cc = &(bcm47xx_bus.bcma.bus.drv_cc);
55
56 memset(&uart8250_data, 0, sizeof(uart8250_data));
57
58 for (i = 0; i < cc->nr_serial_ports; i++) {
59 struct plat_serial8250_port *p = &(uart8250_data[i]);
60 struct bcma_serial_port *bcma_port;
61 bcma_port = &(cc->serial_ports[i]);
62
63 p->mapbase = (unsigned int) bcma_port->regs;
64 p->membase = (void *) bcma_port->regs;
65 p->irq = bcma_port->irq + 2;
66 p->uartclk = bcma_port->baud_base;
67 p->regshift = bcma_port->reg_shift;
68 p->iotype = UPIO_MEM;
69 p->flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ;
70 }
71 return platform_device_register(&uart8250_device);
72}
73#endif
74
75static int __init uart8250_init(void)
76{
77 switch (bcm47xx_bus_type) {
78#ifdef CONFIG_BCM47XX_SSB
79 case BCM47XX_BUS_TYPE_SSB:
80 return uart8250_init_ssb();
81#endif
82#ifdef CONFIG_BCM47XX_BCMA
83 case BCM47XX_BUS_TYPE_BCMA:
84 return uart8250_init_bcma();
85#endif
86 }
87 return -EINVAL;
88}
47 89
48module_init(uart8250_init); 90module_init(uart8250_init);
49 91
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index cfae81571de..17c3d14d7c4 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -29,21 +29,36 @@
29#include <linux/types.h> 29#include <linux/types.h>
30#include <linux/ssb/ssb.h> 30#include <linux/ssb/ssb.h>
31#include <linux/ssb/ssb_embedded.h> 31#include <linux/ssb/ssb_embedded.h>
32#include <linux/bcma/bcma_soc.h>
32#include <asm/bootinfo.h> 33#include <asm/bootinfo.h>
33#include <asm/reboot.h> 34#include <asm/reboot.h>
34#include <asm/time.h> 35#include <asm/time.h>
35#include <bcm47xx.h> 36#include <bcm47xx.h>
36#include <asm/mach-bcm47xx/nvram.h> 37#include <asm/mach-bcm47xx/nvram.h>
37 38
38struct ssb_bus ssb_bcm47xx; 39union bcm47xx_bus bcm47xx_bus;
39EXPORT_SYMBOL(ssb_bcm47xx); 40EXPORT_SYMBOL(bcm47xx_bus);
41
42enum bcm47xx_bus_type bcm47xx_bus_type;
43EXPORT_SYMBOL(bcm47xx_bus_type);
40 44
41static void bcm47xx_machine_restart(char *command) 45static void bcm47xx_machine_restart(char *command)
42{ 46{
43 printk(KERN_ALERT "Please stand by while rebooting the system...\n"); 47 printk(KERN_ALERT "Please stand by while rebooting the system...\n");
44 local_irq_disable(); 48 local_irq_disable();
45 /* Set the watchdog timer to reset immediately */ 49 /* Set the watchdog timer to reset immediately */
46 ssb_watchdog_timer_set(&ssb_bcm47xx, 1); 50 switch (bcm47xx_bus_type) {
51#ifdef CONFIG_BCM47XX_SSB
52 case BCM47XX_BUS_TYPE_SSB:
53 ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 1);
54 break;
55#endif
56#ifdef CONFIG_BCM47XX_BCMA
57 case BCM47XX_BUS_TYPE_BCMA:
58 bcma_chipco_watchdog_timer_set(&bcm47xx_bus.bcma.bus.drv_cc, 1);
59 break;
60#endif
61 }
47 while (1) 62 while (1)
48 cpu_relax(); 63 cpu_relax();
49} 64}
@@ -52,11 +67,23 @@ static void bcm47xx_machine_halt(void)
52{ 67{
53 /* Disable interrupts and watchdog and spin forever */ 68 /* Disable interrupts and watchdog and spin forever */
54 local_irq_disable(); 69 local_irq_disable();
55 ssb_watchdog_timer_set(&ssb_bcm47xx, 0); 70 switch (bcm47xx_bus_type) {
71#ifdef CONFIG_BCM47XX_SSB
72 case BCM47XX_BUS_TYPE_SSB:
73 ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 0);
74 break;
75#endif
76#ifdef CONFIG_BCM47XX_BCMA
77 case BCM47XX_BUS_TYPE_BCMA:
78 bcma_chipco_watchdog_timer_set(&bcm47xx_bus.bcma.bus.drv_cc, 0);
79 break;
80#endif
81 }
56 while (1) 82 while (1)
57 cpu_relax(); 83 cpu_relax();
58} 84}
59 85
86#ifdef CONFIG_BCM47XX_SSB
60#define READ_FROM_NVRAM(_outvar, name, buf) \ 87#define READ_FROM_NVRAM(_outvar, name, buf) \
61 if (nvram_getprefix(prefix, name, buf, sizeof(buf)) >= 0)\ 88 if (nvram_getprefix(prefix, name, buf, sizeof(buf)) >= 0)\
62 sprom->_outvar = simple_strtoul(buf, NULL, 0); 89 sprom->_outvar = simple_strtoul(buf, NULL, 0);
@@ -247,7 +274,7 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,
247 return 0; 274 return 0;
248} 275}
249 276
250void __init plat_mem_setup(void) 277static void __init bcm47xx_register_ssb(void)
251{ 278{
252 int err; 279 int err;
253 char buf[100]; 280 char buf[100];
@@ -258,12 +285,12 @@ void __init plat_mem_setup(void)
258 printk(KERN_WARNING "bcm47xx: someone else already registered" 285 printk(KERN_WARNING "bcm47xx: someone else already registered"
259 " a ssb SPROM callback handler (err %d)\n", err); 286 " a ssb SPROM callback handler (err %d)\n", err);
260 287
261 err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE, 288 err = ssb_bus_ssbbus_register(&(bcm47xx_bus.ssb), SSB_ENUM_BASE,
262 bcm47xx_get_invariants); 289 bcm47xx_get_invariants);
263 if (err) 290 if (err)
264 panic("Failed to initialize SSB bus (err %d)\n", err); 291 panic("Failed to initialize SSB bus (err %d)\n", err);
265 292
266 mcore = &ssb_bcm47xx.mipscore; 293 mcore = &bcm47xx_bus.ssb.mipscore;
267 if (nvram_getenv("kernel_args", buf, sizeof(buf)) >= 0) { 294 if (nvram_getenv("kernel_args", buf, sizeof(buf)) >= 0) {
268 if (strstr(buf, "console=ttyS1")) { 295 if (strstr(buf, "console=ttyS1")) {
269 struct ssb_serial_port port; 296 struct ssb_serial_port port;
@@ -276,8 +303,57 @@ void __init plat_mem_setup(void)
276 memcpy(&mcore->serial_ports[1], &port, sizeof(port)); 303 memcpy(&mcore->serial_ports[1], &port, sizeof(port));
277 } 304 }
278 } 305 }
306}
307#endif
308
309#ifdef CONFIG_BCM47XX_BCMA
310static void __init bcm47xx_register_bcma(void)
311{
312 int err;
313
314 err = bcma_host_soc_register(&bcm47xx_bus.bcma);
315 if (err)
316 panic("Failed to initialize BCMA bus (err %d)\n", err);
317}
318#endif
319
320void __init plat_mem_setup(void)
321{
322 struct cpuinfo_mips *c = &current_cpu_data;
323
324 if (c->cputype == CPU_74K) {
325 printk(KERN_INFO "bcm47xx: using bcma bus\n");
326#ifdef CONFIG_BCM47XX_BCMA
327 bcm47xx_bus_type = BCM47XX_BUS_TYPE_BCMA;
328 bcm47xx_register_bcma();
329#endif
330 } else {
331 printk(KERN_INFO "bcm47xx: using ssb bus\n");
332#ifdef CONFIG_BCM47XX_SSB
333 bcm47xx_bus_type = BCM47XX_BUS_TYPE_SSB;
334 bcm47xx_register_ssb();
335#endif
336 }
279 337
280 _machine_restart = bcm47xx_machine_restart; 338 _machine_restart = bcm47xx_machine_restart;
281 _machine_halt = bcm47xx_machine_halt; 339 _machine_halt = bcm47xx_machine_halt;
282 pm_power_off = bcm47xx_machine_halt; 340 pm_power_off = bcm47xx_machine_halt;
283} 341}
342
343static int __init bcm47xx_register_bus_complete(void)
344{
345 switch (bcm47xx_bus_type) {
346#ifdef CONFIG_BCM47XX_SSB
347 case BCM47XX_BUS_TYPE_SSB:
348 /* Nothing to do */
349 break;
350#endif
351#ifdef CONFIG_BCM47XX_BCMA
352 case BCM47XX_BUS_TYPE_BCMA:
353 bcma_bus_register(&bcm47xx_bus.bcma.bus);
354 break;
355#endif
356 }
357 return 0;
358}
359device_initcall(bcm47xx_register_bus_complete);
diff --git a/arch/mips/bcm47xx/time.c b/arch/mips/bcm47xx/time.c
index 0c6f47b3fd9..536374dcba7 100644
--- a/arch/mips/bcm47xx/time.c
+++ b/arch/mips/bcm47xx/time.c
@@ -30,7 +30,7 @@
30 30
31void __init plat_time_init(void) 31void __init plat_time_init(void)
32{ 32{
33 unsigned long hz; 33 unsigned long hz = 0;
34 34
35 /* 35 /*
36 * Use deterministic values for initial counter interrupt 36 * Use deterministic values for initial counter interrupt
@@ -39,7 +39,19 @@ void __init plat_time_init(void)
39 write_c0_count(0); 39 write_c0_count(0);
40 write_c0_compare(0xffff); 40 write_c0_compare(0xffff);
41 41
42 hz = ssb_cpu_clock(&ssb_bcm47xx.mipscore) / 2; 42 switch (bcm47xx_bus_type) {
43#ifdef CONFIG_BCM47XX_SSB
44 case BCM47XX_BUS_TYPE_SSB:
45 hz = ssb_cpu_clock(&bcm47xx_bus.ssb.mipscore) / 2;
46 break;
47#endif
48#ifdef CONFIG_BCM47XX_BCMA
49 case BCM47XX_BUS_TYPE_BCMA:
50 hz = bcma_cpu_clock(&bcm47xx_bus.bcma.bus.drv_mips) / 2;
51 break;
52#endif
53 }
54
43 if (!hz) 55 if (!hz)
44 hz = 100000000; 56 hz = 100000000;
45 57
diff --git a/arch/mips/bcm47xx/wgt634u.c b/arch/mips/bcm47xx/wgt634u.c
index 74d06965326..e9f9ec8d443 100644
--- a/arch/mips/bcm47xx/wgt634u.c
+++ b/arch/mips/bcm47xx/wgt634u.c
@@ -108,7 +108,7 @@ static irqreturn_t gpio_interrupt(int irq, void *ignored)
108 108
109 /* Interrupts are shared, check if the current one is 109 /* Interrupts are shared, check if the current one is
110 a GPIO interrupt. */ 110 a GPIO interrupt. */
111 if (!ssb_chipco_irq_status(&ssb_bcm47xx.chipco, 111 if (!ssb_chipco_irq_status(&bcm47xx_bus.ssb.chipco,
112 SSB_CHIPCO_IRQ_GPIO)) 112 SSB_CHIPCO_IRQ_GPIO))
113 return IRQ_NONE; 113 return IRQ_NONE;
114 114
@@ -132,22 +132,26 @@ static int __init wgt634u_init(void)
132 * machine. Use the MAC address as an heuristic. Netgear Inc. has 132 * machine. Use the MAC address as an heuristic. Netgear Inc. has
133 * been allocated ranges 00:09:5b:xx:xx:xx and 00:0f:b5:xx:xx:xx. 133 * been allocated ranges 00:09:5b:xx:xx:xx and 00:0f:b5:xx:xx:xx.
134 */ 134 */
135 u8 *et0mac;
135 136
136 u8 *et0mac = ssb_bcm47xx.sprom.et0mac; 137 if (bcm47xx_bus_type != BCM47XX_BUS_TYPE_SSB)
138 return -ENODEV;
139
140 et0mac = bcm47xx_bus.ssb.sprom.et0mac;
137 141
138 if (et0mac[0] == 0x00 && 142 if (et0mac[0] == 0x00 &&
139 ((et0mac[1] == 0x09 && et0mac[2] == 0x5b) || 143 ((et0mac[1] == 0x09 && et0mac[2] == 0x5b) ||
140 (et0mac[1] == 0x0f && et0mac[2] == 0xb5))) { 144 (et0mac[1] == 0x0f && et0mac[2] == 0xb5))) {
141 struct ssb_mipscore *mcore = &ssb_bcm47xx.mipscore; 145 struct ssb_mipscore *mcore = &bcm47xx_bus.ssb.mipscore;
142 146
143 printk(KERN_INFO "WGT634U machine detected.\n"); 147 printk(KERN_INFO "WGT634U machine detected.\n");
144 148
145 if (!request_irq(gpio_to_irq(WGT634U_GPIO_RESET), 149 if (!request_irq(gpio_to_irq(WGT634U_GPIO_RESET),
146 gpio_interrupt, IRQF_SHARED, 150 gpio_interrupt, IRQF_SHARED,
147 "WGT634U GPIO", &ssb_bcm47xx.chipco)) { 151 "WGT634U GPIO", &bcm47xx_bus.ssb.chipco)) {
148 gpio_direction_input(WGT634U_GPIO_RESET); 152 gpio_direction_input(WGT634U_GPIO_RESET);
149 gpio_intmask(WGT634U_GPIO_RESET, 1); 153 gpio_intmask(WGT634U_GPIO_RESET, 1);
150 ssb_chipco_irq_mask(&ssb_bcm47xx.chipco, 154 ssb_chipco_irq_mask(&bcm47xx_bus.ssb.chipco,
151 SSB_CHIPCO_IRQ_GPIO, 155 SSB_CHIPCO_IRQ_GPIO,
152 SSB_CHIPCO_IRQ_GPIO); 156 SSB_CHIPCO_IRQ_GPIO);
153 } 157 }
diff --git a/arch/mips/include/asm/lasat/lasat.h b/arch/mips/include/asm/lasat/lasat.h
index a1ada1c27c1..e8ff70f80e1 100644
--- a/arch/mips/include/asm/lasat/lasat.h
+++ b/arch/mips/include/asm/lasat/lasat.h
@@ -41,10 +41,8 @@ enum lasat_mtdparts {
41 41
42/* 42/*
43 * The format of the data record in the EEPROM. 43 * The format of the data record in the EEPROM.
44 * See Documentation/LASAT/eeprom.txt for a detailed description 44 * See the LASAT Hardware Configuration field specification for a detailed
45 * of the fields in this struct, and the LASAT Hardware Configuration 45 * description of the config field.
46 * field specification for a detailed description of the config
47 * field.
48 */ 46 */
49#include <linux/types.h> 47#include <linux/types.h>
50 48
diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
index d008f47a28b..de95e0723e2 100644
--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
@@ -19,7 +19,29 @@
19#ifndef __ASM_BCM47XX_H 19#ifndef __ASM_BCM47XX_H
20#define __ASM_BCM47XX_H 20#define __ASM_BCM47XX_H
21 21
22/* SSB bus */ 22#include <linux/ssb/ssb.h>
23extern struct ssb_bus ssb_bcm47xx; 23#include <linux/bcma/bcma.h>
24#include <linux/bcma/bcma_soc.h>
25
26enum bcm47xx_bus_type {
27#ifdef CONFIG_BCM47XX_SSB
28 BCM47XX_BUS_TYPE_SSB,
29#endif
30#ifdef CONFIG_BCM47XX_BCMA
31 BCM47XX_BUS_TYPE_BCMA,
32#endif
33};
34
35union bcm47xx_bus {
36#ifdef CONFIG_BCM47XX_SSB
37 struct ssb_bus ssb;
38#endif
39#ifdef CONFIG_BCM47XX_BCMA
40 struct bcma_soc bcma;
41#endif
42};
43
44extern union bcm47xx_bus bcm47xx_bus;
45extern enum bcm47xx_bus_type bcm47xx_bus_type;
24 46
25#endif /* __ASM_BCM47XX_H */ 47#endif /* __ASM_BCM47XX_H */
diff --git a/arch/mips/include/asm/mach-bcm47xx/gpio.h b/arch/mips/include/asm/mach-bcm47xx/gpio.h
index 98504142124..76961cabeed 100644
--- a/arch/mips/include/asm/mach-bcm47xx/gpio.h
+++ b/arch/mips/include/asm/mach-bcm47xx/gpio.h
@@ -10,6 +10,7 @@
10#define __BCM47XX_GPIO_H 10#define __BCM47XX_GPIO_H
11 11
12#include <linux/ssb/ssb_embedded.h> 12#include <linux/ssb/ssb_embedded.h>
13#include <linux/bcma/bcma.h>
13#include <asm/mach-bcm47xx/bcm47xx.h> 14#include <asm/mach-bcm47xx/bcm47xx.h>
14 15
15#define BCM47XX_EXTIF_GPIO_LINES 5 16#define BCM47XX_EXTIF_GPIO_LINES 5
@@ -21,41 +22,118 @@ extern int gpio_to_irq(unsigned gpio);
21 22
22static inline int gpio_get_value(unsigned gpio) 23static inline int gpio_get_value(unsigned gpio)
23{ 24{
24 return ssb_gpio_in(&ssb_bcm47xx, 1 << gpio); 25 switch (bcm47xx_bus_type) {
26#ifdef CONFIG_BCM47XX_SSB
27 case BCM47XX_BUS_TYPE_SSB:
28 return ssb_gpio_in(&bcm47xx_bus.ssb, 1 << gpio);
29#endif
30#ifdef CONFIG_BCM47XX_BCMA
31 case BCM47XX_BUS_TYPE_BCMA:
32 return bcma_chipco_gpio_in(&bcm47xx_bus.bcma.bus.drv_cc,
33 1 << gpio);
34#endif
35 }
36 return -EINVAL;
25} 37}
26 38
27static inline void gpio_set_value(unsigned gpio, int value) 39static inline void gpio_set_value(unsigned gpio, int value)
28{ 40{
29 ssb_gpio_out(&ssb_bcm47xx, 1 << gpio, value ? 1 << gpio : 0); 41 switch (bcm47xx_bus_type) {
42#ifdef CONFIG_BCM47XX_SSB
43 case BCM47XX_BUS_TYPE_SSB:
44 ssb_gpio_out(&bcm47xx_bus.ssb, 1 << gpio,
45 value ? 1 << gpio : 0);
46 return;
47#endif
48#ifdef CONFIG_BCM47XX_BCMA
49 case BCM47XX_BUS_TYPE_BCMA:
50 bcma_chipco_gpio_out(&bcm47xx_bus.bcma.bus.drv_cc, 1 << gpio,
51 value ? 1 << gpio : 0);
52 return;
53#endif
54 }
30} 55}
31 56
32static inline int gpio_direction_input(unsigned gpio) 57static inline int gpio_direction_input(unsigned gpio)
33{ 58{
34 ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 0); 59 switch (bcm47xx_bus_type) {
35 return 0; 60#ifdef CONFIG_BCM47XX_SSB
61 case BCM47XX_BUS_TYPE_SSB:
62 ssb_gpio_outen(&bcm47xx_bus.ssb, 1 << gpio, 0);
63 return 0;
64#endif
65#ifdef CONFIG_BCM47XX_BCMA
66 case BCM47XX_BUS_TYPE_BCMA:
67 bcma_chipco_gpio_outen(&bcm47xx_bus.bcma.bus.drv_cc, 1 << gpio,
68 0);
69 return 0;
70#endif
71 }
72 return -EINVAL;
36} 73}
37 74
38static inline int gpio_direction_output(unsigned gpio, int value) 75static inline int gpio_direction_output(unsigned gpio, int value)
39{ 76{
40 /* first set the gpio out value */ 77 switch (bcm47xx_bus_type) {
41 ssb_gpio_out(&ssb_bcm47xx, 1 << gpio, value ? 1 << gpio : 0); 78#ifdef CONFIG_BCM47XX_SSB
42 /* then set the gpio mode */ 79 case BCM47XX_BUS_TYPE_SSB:
43 ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 1 << gpio); 80 /* first set the gpio out value */
44 return 0; 81 ssb_gpio_out(&bcm47xx_bus.ssb, 1 << gpio,
82 value ? 1 << gpio : 0);
83 /* then set the gpio mode */
84 ssb_gpio_outen(&bcm47xx_bus.ssb, 1 << gpio, 1 << gpio);
85 return 0;
86#endif
87#ifdef CONFIG_BCM47XX_BCMA
88 case BCM47XX_BUS_TYPE_BCMA:
89 /* first set the gpio out value */
90 bcma_chipco_gpio_out(&bcm47xx_bus.bcma.bus.drv_cc, 1 << gpio,
91 value ? 1 << gpio : 0);
92 /* then set the gpio mode */
93 bcma_chipco_gpio_outen(&bcm47xx_bus.bcma.bus.drv_cc, 1 << gpio,
94 1 << gpio);
95 return 0;
96#endif
97 }
98 return -EINVAL;
45} 99}
46 100
47static inline int gpio_intmask(unsigned gpio, int value) 101static inline int gpio_intmask(unsigned gpio, int value)
48{ 102{
49 ssb_gpio_intmask(&ssb_bcm47xx, 1 << gpio, 103 switch (bcm47xx_bus_type) {
50 value ? 1 << gpio : 0); 104#ifdef CONFIG_BCM47XX_SSB
51 return 0; 105 case BCM47XX_BUS_TYPE_SSB:
106 ssb_gpio_intmask(&bcm47xx_bus.ssb, 1 << gpio,
107 value ? 1 << gpio : 0);
108 return 0;
109#endif
110#ifdef CONFIG_BCM47XX_BCMA
111 case BCM47XX_BUS_TYPE_BCMA:
112 bcma_chipco_gpio_intmask(&bcm47xx_bus.bcma.bus.drv_cc,
113 1 << gpio, value ? 1 << gpio : 0);
114 return 0;
115#endif
116 }
117 return -EINVAL;
52} 118}
53 119
54static inline int gpio_polarity(unsigned gpio, int value) 120static inline int gpio_polarity(unsigned gpio, int value)
55{ 121{
56 ssb_gpio_polarity(&ssb_bcm47xx, 1 << gpio, 122 switch (bcm47xx_bus_type) {
57 value ? 1 << gpio : 0); 123#ifdef CONFIG_BCM47XX_SSB
58 return 0; 124 case BCM47XX_BUS_TYPE_SSB:
125 ssb_gpio_polarity(&bcm47xx_bus.ssb, 1 << gpio,
126 value ? 1 << gpio : 0);
127 return 0;
128#endif
129#ifdef CONFIG_BCM47XX_BCMA
130 case BCM47XX_BUS_TYPE_BCMA:
131 bcma_chipco_gpio_polarity(&bcm47xx_bus.bcma.bus.drv_cc,
132 1 << gpio, value ? 1 << gpio : 0);
133 return 0;
134#endif
135 }
136 return -EINVAL;
59} 137}
60 138
61 139
diff --git a/arch/mips/pci/pci-bcm47xx.c b/arch/mips/pci/pci-bcm47xx.c
index 455f8e50a00..400535a955d 100644
--- a/arch/mips/pci/pci-bcm47xx.c
+++ b/arch/mips/pci/pci-bcm47xx.c
@@ -25,6 +25,7 @@
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/pci.h> 26#include <linux/pci.h>
27#include <linux/ssb/ssb.h> 27#include <linux/ssb/ssb.h>
28#include <bcm47xx.h>
28 29
29int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 30int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
30{ 31{
@@ -33,9 +34,13 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
33 34
34int pcibios_plat_dev_init(struct pci_dev *dev) 35int pcibios_plat_dev_init(struct pci_dev *dev)
35{ 36{
37#ifdef CONFIG_BCM47XX_SSB
36 int res; 38 int res;
37 u8 slot, pin; 39 u8 slot, pin;
38 40
41 if (bcm47xx_bus_type != BCM47XX_BUS_TYPE_SSB)
42 return 0;
43
39 res = ssb_pcibios_plat_dev_init(dev); 44 res = ssb_pcibios_plat_dev_init(dev);
40 if (res < 0) { 45 if (res < 0) {
41 printk(KERN_ALERT "PCI: Failed to init device %s\n", 46 printk(KERN_ALERT "PCI: Failed to init device %s\n",
@@ -55,5 +60,6 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
55 } 60 }
56 61
57 dev->irq = res; 62 dev->irq = res;
63#endif
58 return 0; 64 return 0;
59} 65}
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_serial.c b/arch/mips/pmc-sierra/msp71xx/msp_serial.c
index f7261628d8a..a1c7c7da233 100644
--- a/arch/mips/pmc-sierra/msp71xx/msp_serial.c
+++ b/arch/mips/pmc-sierra/msp71xx/msp_serial.c
@@ -27,6 +27,7 @@
27#include <linux/serial.h> 27#include <linux/serial.h>
28#include <linux/serial_core.h> 28#include <linux/serial_core.h>
29#include <linux/serial_reg.h> 29#include <linux/serial_reg.h>
30#include <linux/slab.h>
30 31
31#include <asm/bootinfo.h> 32#include <asm/bootinfo.h>
32#include <asm/io.h> 33#include <asm/io.h>
@@ -38,6 +39,55 @@
38#include <msp_int.h> 39#include <msp_int.h>
39#include <msp_regs.h> 40#include <msp_regs.h>
40 41
42struct msp_uart_data {
43 int last_lcr;
44};
45
46static void msp_serial_out(struct uart_port *p, int offset, int value)
47{
48 struct msp_uart_data *d = p->private_data;
49
50 if (offset == UART_LCR)
51 d->last_lcr = value;
52
53 offset <<= p->regshift;
54 writeb(value, p->membase + offset);
55}
56
57static unsigned int msp_serial_in(struct uart_port *p, int offset)
58{
59 offset <<= p->regshift;
60
61 return readb(p->membase + offset);
62}
63
64static int msp_serial_handle_irq(struct uart_port *p)
65{
66 struct msp_uart_data *d = p->private_data;
67 unsigned int iir = readb(p->membase + (UART_IIR << p->regshift));
68
69 if (serial8250_handle_irq(p, iir)) {
70 return 1;
71 } else if ((iir & UART_IIR_BUSY) == UART_IIR_BUSY) {
72 /*
73 * The DesignWare APB UART has an Busy Detect (0x07) interrupt
74 * meaning an LCR write attempt occurred while the UART was
75 * busy. The interrupt must be cleared by reading the UART
76 * status register (USR) and the LCR re-written.
77 *
78 * Note: MSP reserves 0x20 bytes of address space for the UART
79 * and the USR is mapped in a separate block at an offset of
80 * 0xc0 from the start of the UART.
81 */
82 (void)readb(p->membase + 0xc0);
83 writeb(d->last_lcr, p->membase + (UART_LCR << p->regshift));
84
85 return 1;
86 }
87
88 return 0;
89}
90
41void __init msp_serial_setup(void) 91void __init msp_serial_setup(void)
42{ 92{
43 char *s; 93 char *s;
@@ -59,13 +109,22 @@ void __init msp_serial_setup(void)
59 up.irq = MSP_INT_UART0; 109 up.irq = MSP_INT_UART0;
60 up.uartclk = uartclk; 110 up.uartclk = uartclk;
61 up.regshift = 2; 111 up.regshift = 2;
62 up.iotype = UPIO_DWAPB; /* UPIO_MEM like */ 112 up.iotype = UPIO_MEM;
63 up.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 113 up.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
64 up.type = PORT_16550A; 114 up.type = PORT_16550A;
65 up.line = 0; 115 up.line = 0;
66 up.private_data = (void*)UART0_STATUS_REG; 116 up.serial_out = msp_serial_out;
67 if (early_serial_setup(&up)) 117 up.serial_in = msp_serial_in;
68 printk(KERN_ERR "Early serial init of port 0 failed\n"); 118 up.handle_irq = msp_serial_handle_irq;
119 up.private_data = kzalloc(sizeof(struct msp_uart_data), GFP_KERNEL);
120 if (!up.private_data) {
121 pr_err("failed to allocate uart private data\n");
122 return;
123 }
124 if (early_serial_setup(&up)) {
125 kfree(up.private_data);
126 pr_err("Early serial init of port 0 failed\n");
127 }
69 128
70 /* Initialize the second serial port, if one exists */ 129 /* Initialize the second serial port, if one exists */
71 switch (mips_machtype) { 130 switch (mips_machtype) {
@@ -88,6 +147,8 @@ void __init msp_serial_setup(void)
88 up.irq = MSP_INT_UART1; 147 up.irq = MSP_INT_UART1;
89 up.line = 1; 148 up.line = 1;
90 up.private_data = (void*)UART1_STATUS_REG; 149 up.private_data = (void*)UART1_STATUS_REG;
91 if (early_serial_setup(&up)) 150 if (early_serial_setup(&up)) {
92 printk(KERN_ERR "Early serial init of port 1 failed\n"); 151 kfree(up.private_data);
152 pr_err("Early serial init of port 1 failed\n");
153 }
93} 154}
diff --git a/arch/mips/txx9/generic/setup_tx4939.c b/arch/mips/txx9/generic/setup_tx4939.c
index e9f95dcde37..ba3cec3155d 100644
--- a/arch/mips/txx9/generic/setup_tx4939.c
+++ b/arch/mips/txx9/generic/setup_tx4939.c
@@ -321,7 +321,7 @@ void __init tx4939_sio_init(unsigned int sclk, unsigned int cts_mask)
321static u32 tx4939_get_eth_speed(struct net_device *dev) 321static u32 tx4939_get_eth_speed(struct net_device *dev)
322{ 322{
323 struct ethtool_cmd cmd; 323 struct ethtool_cmd cmd;
324 if (dev_ethtool_get_settings(dev, &cmd)) 324 if (__ethtool_get_settings(dev, &cmd))
325 return 100; /* default 100Mbps */ 325 return 100; /* default 100Mbps */
326 326
327 return ethtool_cmd_speed(&cmd); 327 return ethtool_cmd_speed(&cmd);
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index 1f870340ebd..f093b3a8a4a 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -195,7 +195,7 @@ config SMP
195 singleprocessor machines. On a singleprocessor machine, the kernel 195 singleprocessor machines. On a singleprocessor machine, the kernel
196 will run faster if you say N here. 196 will run faster if you say N here.
197 197
198 See also <file:Documentation/i386/IO-APIC.txt>, 198 See also <file:Documentation/x86/i386/IO-APIC.txt>,
199 <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at 199 <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at
200 <http://www.tldp.org/docs.html#howto>. 200 <http://www.tldp.org/docs.html#howto>.
201 201
diff --git a/arch/mn10300/kernel/irq.c b/arch/mn10300/kernel/irq.c
index 2623d19f4f4..2381df83bd0 100644
--- a/arch/mn10300/kernel/irq.c
+++ b/arch/mn10300/kernel/irq.c
@@ -260,7 +260,6 @@ void set_intr_level(int irq, u16 level)
260/* 260/*
261 * mark an interrupt to be ACK'd after interrupt handlers have been run rather 261 * mark an interrupt to be ACK'd after interrupt handlers have been run rather
262 * than before 262 * than before
263 * - see Documentation/mn10300/features.txt
264 */ 263 */
265void mn10300_set_lateack_irq_type(int irq) 264void mn10300_set_lateack_irq_type(int irq)
266{ 265{
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 4558bafbd1a..9460e1c266d 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -1,6 +1,6 @@
1# 1#
2# For a description of the syntax of this configuration file, 2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/config-language.txt. 3# see Documentation/kbuild/kconfig-language.txt.
4# 4#
5 5
6config OPENRISC 6config OPENRISC
diff --git a/arch/openrisc/include/asm/dma-mapping.h b/arch/openrisc/include/asm/dma-mapping.h
index 60b47223390..b206ba4608b 100644
--- a/arch/openrisc/include/asm/dma-mapping.h
+++ b/arch/openrisc/include/asm/dma-mapping.h
@@ -18,7 +18,7 @@
18#define __ASM_OPENRISC_DMA_MAPPING_H 18#define __ASM_OPENRISC_DMA_MAPPING_H
19 19
20/* 20/*
21 * See Documentation/PCI/PCI-DMA-mapping.txt and 21 * See Documentation/DMA-API-HOWTO.txt and
22 * Documentation/DMA-API.txt for documentation. 22 * Documentation/DMA-API.txt for documentation.
23 * 23 *
24 * This file is written with the intention of eventually moving over 24 * This file is written with the intention of eventually moving over
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index e077b0bf56c..fdfd8be29e9 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -169,9 +169,7 @@ config 64BIT
169 169
170choice 170choice
171 prompt "Kernel page size" 171 prompt "Kernel page size"
172 default PARISC_PAGE_SIZE_4KB if !64BIT 172 default PARISC_PAGE_SIZE_4KB
173 default PARISC_PAGE_SIZE_4KB if 64BIT
174# default PARISC_PAGE_SIZE_16KB if 64BIT
175 173
176config PARISC_PAGE_SIZE_4KB 174config PARISC_PAGE_SIZE_4KB
177 bool "4KB" 175 bool "4KB"
diff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h
index 890531e32fe..467bbd510ea 100644
--- a/arch/parisc/include/asm/dma-mapping.h
+++ b/arch/parisc/include/asm/dma-mapping.h
@@ -5,7 +5,7 @@
5#include <asm/cacheflush.h> 5#include <asm/cacheflush.h>
6#include <asm/scatterlist.h> 6#include <asm/scatterlist.h>
7 7
8/* See Documentation/PCI/PCI-DMA-mapping.txt */ 8/* See Documentation/DMA-API-HOWTO.txt */
9struct hppa_dma_ops { 9struct hppa_dma_ops {
10 int (*dma_supported)(struct device *dev, u64 mask); 10 int (*dma_supported)(struct device *dev, u64 mask);
11 void *(*alloc_consistent)(struct device *dev, size_t size, dma_addr_t *iova, gfp_t flag); 11 void *(*alloc_consistent)(struct device *dev, size_t size, dma_addr_t *iova, gfp_t flag);
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index a029f74a3c5..d047edea250 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -2,7 +2,7 @@
2** PARISC 1.1 Dynamic DMA mapping support. 2** PARISC 1.1 Dynamic DMA mapping support.
3** This implementation is for PA-RISC platforms that do not support 3** This implementation is for PA-RISC platforms that do not support
4** I/O TLBs (aka DMA address translation hardware). 4** I/O TLBs (aka DMA address translation hardware).
5** See Documentation/PCI/PCI-DMA-mapping.txt for interface definitions. 5** See Documentation/DMA-API-HOWTO.txt for interface definitions.
6** 6**
7** (c) Copyright 1999,2000 Hewlett-Packard Company 7** (c) Copyright 1999,2000 Hewlett-Packard Company
8** (c) Copyright 2000 Grant Grundler 8** (c) Copyright 2000 Grant Grundler
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 6926b61acfe..47682b67fd3 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -656,6 +656,8 @@ config SBUS
656 656
657config FSL_SOC 657config FSL_SOC
658 bool 658 bool
659 select HAVE_CAN_FLEXCAN if NET && CAN
660 select PPC_CLOCK if CAN_FLEXCAN
659 661
660config FSL_PCI 662config FSL_PCI
661 bool 663 bool
diff --git a/arch/powerpc/boot/dts/p1010rdb.dts b/arch/powerpc/boot/dts/p1010rdb.dts
index 6b33b73a5ba..d6c669c888e 100644
--- a/arch/powerpc/boot/dts/p1010rdb.dts
+++ b/arch/powerpc/boot/dts/p1010rdb.dts
@@ -23,6 +23,8 @@
23 ethernet2 = &enet2; 23 ethernet2 = &enet2;
24 pci0 = &pci0; 24 pci0 = &pci0;
25 pci1 = &pci1; 25 pci1 = &pci1;
26 can0 = &can0;
27 can1 = &can1;
26 }; 28 };
27 29
28 memory { 30 memory {
@@ -169,14 +171,6 @@
169 }; 171 };
170 }; 172 };
171 173
172 can0@1c000 {
173 fsl,flexcan-clock-source = "platform";
174 };
175
176 can1@1d000 {
177 fsl,flexcan-clock-source = "platform";
178 };
179
180 usb@22000 { 174 usb@22000 {
181 phy_type = "utmi"; 175 phy_type = "utmi";
182 }; 176 };
diff --git a/arch/powerpc/boot/dts/p1010si.dtsi b/arch/powerpc/boot/dts/p1010si.dtsi
index 7f51104f2e3..cabe0a453ae 100644
--- a/arch/powerpc/boot/dts/p1010si.dtsi
+++ b/arch/powerpc/boot/dts/p1010si.dtsi
@@ -140,20 +140,18 @@
140 interrupt-parent = <&mpic>; 140 interrupt-parent = <&mpic>;
141 }; 141 };
142 142
143 can0@1c000 { 143 can0: can@1c000 {
144 compatible = "fsl,flexcan-v1.0"; 144 compatible = "fsl,p1010-flexcan";
145 reg = <0x1c000 0x1000>; 145 reg = <0x1c000 0x1000>;
146 interrupts = <48 0x2>; 146 interrupts = <48 0x2>;
147 interrupt-parent = <&mpic>; 147 interrupt-parent = <&mpic>;
148 fsl,flexcan-clock-divider = <2>;
149 }; 148 };
150 149
151 can1@1d000 { 150 can1: can@1d000 {
152 compatible = "fsl,flexcan-v1.0"; 151 compatible = "fsl,p1010-flexcan";
153 reg = <0x1d000 0x1000>; 152 reg = <0x1d000 0x1000>;
154 interrupts = <61 0x2>; 153 interrupts = <61 0x2>;
155 interrupt-parent = <&mpic>; 154 interrupt-parent = <&mpic>;
156 fsl,flexcan-clock-divider = <2>;
157 }; 155 };
158 156
159 L2: l2-cache-controller@20000 { 157 L2: l2-cache-controller@20000 {
diff --git a/arch/powerpc/configs/40x/acadia_defconfig b/arch/powerpc/configs/40x/acadia_defconfig
index 4182c772340..ed3bab72a83 100644
--- a/arch/powerpc/configs/40x/acadia_defconfig
+++ b/arch/powerpc/configs/40x/acadia_defconfig
@@ -44,12 +44,13 @@ CONFIG_BLK_DEV_RAM=y
44CONFIG_BLK_DEV_RAM_SIZE=35000 44CONFIG_BLK_DEV_RAM_SIZE=35000
45# CONFIG_MISC_DEVICES is not set 45# CONFIG_MISC_DEVICES is not set
46CONFIG_NETDEVICES=y 46CONFIG_NETDEVICES=y
47CONFIG_NET_ETHERNET=y 47CONFIG_ETHERNET=y
48CONFIG_NET_VENDOR_IBM=y
48CONFIG_MII=y 49CONFIG_MII=y
49CONFIG_IBM_NEW_EMAC=y 50CONFIG_IBM_EMAC=y
50CONFIG_IBM_NEW_EMAC_RXB=256 51CONFIG_IBM_EMAC_RXB=256
51CONFIG_IBM_NEW_EMAC_TXB=256 52CONFIG_IBM_EMAC_TXB=256
52CONFIG_IBM_NEW_EMAC_DEBUG=y 53CONFIG_IBM_EMAC_DEBUG=y
53# CONFIG_NETDEV_1000 is not set 54# CONFIG_NETDEV_1000 is not set
54# CONFIG_NETDEV_10000 is not set 55# CONFIG_NETDEV_10000 is not set
55# CONFIG_INPUT is not set 56# CONFIG_INPUT is not set
diff --git a/arch/powerpc/configs/40x/ep405_defconfig b/arch/powerpc/configs/40x/ep405_defconfig
index 2dbb293163f..17582a3420f 100644
--- a/arch/powerpc/configs/40x/ep405_defconfig
+++ b/arch/powerpc/configs/40x/ep405_defconfig
@@ -42,8 +42,9 @@ CONFIG_PROC_DEVICETREE=y
42CONFIG_BLK_DEV_RAM=y 42CONFIG_BLK_DEV_RAM=y
43CONFIG_BLK_DEV_RAM_SIZE=35000 43CONFIG_BLK_DEV_RAM_SIZE=35000
44CONFIG_NETDEVICES=y 44CONFIG_NETDEVICES=y
45CONFIG_NET_ETHERNET=y 45CONFIG_ETHERNET=y
46CONFIG_IBM_NEW_EMAC=y 46CONFIG_NET_VENDOR_IBM=y
47CONFIG_IBM_EMAC=y
47# CONFIG_INPUT is not set 48# CONFIG_INPUT is not set
48# CONFIG_SERIO is not set 49# CONFIG_SERIO is not set
49# CONFIG_VT is not set 50# CONFIG_VT is not set
diff --git a/arch/powerpc/configs/40x/hcu4_defconfig b/arch/powerpc/configs/40x/hcu4_defconfig
index ebeb4accad6..dba263c1d3a 100644
--- a/arch/powerpc/configs/40x/hcu4_defconfig
+++ b/arch/powerpc/configs/40x/hcu4_defconfig
@@ -43,8 +43,9 @@ CONFIG_PROC_DEVICETREE=y
43CONFIG_BLK_DEV_RAM=y 43CONFIG_BLK_DEV_RAM=y
44CONFIG_BLK_DEV_RAM_SIZE=35000 44CONFIG_BLK_DEV_RAM_SIZE=35000
45CONFIG_NETDEVICES=y 45CONFIG_NETDEVICES=y
46CONFIG_NET_ETHERNET=y 46CONFIG_ETHERNET=y
47CONFIG_IBM_NEW_EMAC=y 47CONFIG_NET_VENDOR_IBM=y
48CONFIG_IBM_EMAC=y
48# CONFIG_INPUT is not set 49# CONFIG_INPUT is not set
49# CONFIG_SERIO is not set 50# CONFIG_SERIO is not set
50# CONFIG_VT is not set 51# CONFIG_VT is not set
diff --git a/arch/powerpc/configs/40x/kilauea_defconfig b/arch/powerpc/configs/40x/kilauea_defconfig
index 532ea9d93a1..f2d4be936e0 100644
--- a/arch/powerpc/configs/40x/kilauea_defconfig
+++ b/arch/powerpc/configs/40x/kilauea_defconfig
@@ -51,10 +51,11 @@ CONFIG_BLK_DEV_RAM=y
51CONFIG_BLK_DEV_RAM_SIZE=35000 51CONFIG_BLK_DEV_RAM_SIZE=35000
52# CONFIG_MISC_DEVICES is not set 52# CONFIG_MISC_DEVICES is not set
53CONFIG_NETDEVICES=y 53CONFIG_NETDEVICES=y
54CONFIG_NET_ETHERNET=y 54CONFIG_ETHERNET=y
55CONFIG_IBM_NEW_EMAC=y 55CONFIG_NET_VENDOR_IBM=y
56CONFIG_IBM_NEW_EMAC_RXB=256 56CONFIG_IBM_EMAC=y
57CONFIG_IBM_NEW_EMAC_TXB=256 57CONFIG_IBM_EMAC_RXB=256
58CONFIG_IBM_EMAC_TXB=256
58# CONFIG_NETDEV_1000 is not set 59# CONFIG_NETDEV_1000 is not set
59# CONFIG_NETDEV_10000 is not set 60# CONFIG_NETDEV_10000 is not set
60# CONFIG_INPUT is not set 61# CONFIG_INPUT is not set
diff --git a/arch/powerpc/configs/40x/makalu_defconfig b/arch/powerpc/configs/40x/makalu_defconfig
index 3c142ac1b34..42b979355f9 100644
--- a/arch/powerpc/configs/40x/makalu_defconfig
+++ b/arch/powerpc/configs/40x/makalu_defconfig
@@ -43,10 +43,11 @@ CONFIG_BLK_DEV_RAM=y
43CONFIG_BLK_DEV_RAM_SIZE=35000 43CONFIG_BLK_DEV_RAM_SIZE=35000
44# CONFIG_MISC_DEVICES is not set 44# CONFIG_MISC_DEVICES is not set
45CONFIG_NETDEVICES=y 45CONFIG_NETDEVICES=y
46CONFIG_NET_ETHERNET=y 46CONFIG_ETHERNET=y
47CONFIG_IBM_NEW_EMAC=y 47CONFIG_NET_VENDOR_IBM=y
48CONFIG_IBM_NEW_EMAC_RXB=256 48CONFIG_IBM_EMAC=y
49CONFIG_IBM_NEW_EMAC_TXB=256 49CONFIG_IBM_EMAC_RXB=256
50CONFIG_IBM_EMAC_TXB=256
50# CONFIG_NETDEV_1000 is not set 51# CONFIG_NETDEV_1000 is not set
51# CONFIG_NETDEV_10000 is not set 52# CONFIG_NETDEV_10000 is not set
52# CONFIG_INPUT is not set 53# CONFIG_INPUT is not set
diff --git a/arch/powerpc/configs/40x/walnut_defconfig b/arch/powerpc/configs/40x/walnut_defconfig
index ff57d4828ff..aa1a4cac370 100644
--- a/arch/powerpc/configs/40x/walnut_defconfig
+++ b/arch/powerpc/configs/40x/walnut_defconfig
@@ -40,8 +40,9 @@ CONFIG_PROC_DEVICETREE=y
40CONFIG_BLK_DEV_RAM=y 40CONFIG_BLK_DEV_RAM=y
41CONFIG_BLK_DEV_RAM_SIZE=35000 41CONFIG_BLK_DEV_RAM_SIZE=35000
42CONFIG_NETDEVICES=y 42CONFIG_NETDEVICES=y
43CONFIG_NET_ETHERNET=y 43CONFIG_ETHERNET=y
44CONFIG_IBM_NEW_EMAC=y 44CONFIG_NET_VENDOR_IBM=y
45CONFIG_IBM_EMAC=y
45# CONFIG_INPUT is not set 46# CONFIG_INPUT is not set
46# CONFIG_SERIO is not set 47# CONFIG_SERIO is not set
47# CONFIG_VT is not set 48# CONFIG_VT is not set
diff --git a/arch/powerpc/configs/44x/arches_defconfig b/arch/powerpc/configs/44x/arches_defconfig
index 3ed16d5c909..329f9a3b892 100644
--- a/arch/powerpc/configs/44x/arches_defconfig
+++ b/arch/powerpc/configs/44x/arches_defconfig
@@ -44,10 +44,11 @@ CONFIG_BLK_DEV_RAM=y
44CONFIG_BLK_DEV_RAM_SIZE=35000 44CONFIG_BLK_DEV_RAM_SIZE=35000
45# CONFIG_MISC_DEVICES is not set 45# CONFIG_MISC_DEVICES is not set
46CONFIG_NETDEVICES=y 46CONFIG_NETDEVICES=y
47CONFIG_NET_ETHERNET=y 47CONFIG_ETHERNET=y
48CONFIG_IBM_NEW_EMAC=y 48CONFIG_NET_VENDOR_IBM=y
49CONFIG_IBM_NEW_EMAC_RXB=256 49CONFIG_IBM_EMAC=y
50CONFIG_IBM_NEW_EMAC_TXB=256 50CONFIG_IBM_EMAC_RXB=256
51CONFIG_IBM_EMAC_TXB=256
51# CONFIG_NETDEV_1000 is not set 52# CONFIG_NETDEV_1000 is not set
52# CONFIG_NETDEV_10000 is not set 53# CONFIG_NETDEV_10000 is not set
53# CONFIG_INPUT is not set 54# CONFIG_INPUT is not set
diff --git a/arch/powerpc/configs/44x/bamboo_defconfig b/arch/powerpc/configs/44x/bamboo_defconfig
index b1b7d2c5c05..cef7d62560c 100644
--- a/arch/powerpc/configs/44x/bamboo_defconfig
+++ b/arch/powerpc/configs/44x/bamboo_defconfig
@@ -32,8 +32,9 @@ CONFIG_PROC_DEVICETREE=y
32CONFIG_BLK_DEV_RAM=y 32CONFIG_BLK_DEV_RAM=y
33CONFIG_BLK_DEV_RAM_SIZE=35000 33CONFIG_BLK_DEV_RAM_SIZE=35000
34CONFIG_NETDEVICES=y 34CONFIG_NETDEVICES=y
35CONFIG_NET_ETHERNET=y 35CONFIG_ETHERNET=y
36CONFIG_IBM_NEW_EMAC=y 36CONFIG_NET_VENDOR_IBM=y
37CONFIG_IBM_EMAC=y
37# CONFIG_INPUT is not set 38# CONFIG_INPUT is not set
38# CONFIG_SERIO is not set 39# CONFIG_SERIO is not set
39# CONFIG_VT is not set 40# CONFIG_VT is not set
diff --git a/arch/powerpc/configs/44x/bluestone_defconfig b/arch/powerpc/configs/44x/bluestone_defconfig
index 30a0a8e08fd..20c8d26d7fc 100644
--- a/arch/powerpc/configs/44x/bluestone_defconfig
+++ b/arch/powerpc/configs/44x/bluestone_defconfig
@@ -38,10 +38,11 @@ CONFIG_PROC_DEVICETREE=y
38CONFIG_BLK_DEV_RAM=y 38CONFIG_BLK_DEV_RAM=y
39CONFIG_BLK_DEV_RAM_SIZE=35000 39CONFIG_BLK_DEV_RAM_SIZE=35000
40CONFIG_NETDEVICES=y 40CONFIG_NETDEVICES=y
41CONFIG_NET_ETHERNET=y 41CONFIG_ETHERNET=y
42CONFIG_IBM_NEW_EMAC=y 42CONFIG_NET_VENDOR_IBM=y
43CONFIG_IBM_NEW_EMAC_RXB=256 43CONFIG_IBM_EMAC=y
44CONFIG_IBM_NEW_EMAC_TXB=256 44CONFIG_IBM_EMAC_RXB=256
45CONFIG_IBM_EMAC_TXB=256
45CONFIG_SERIAL_8250=y 46CONFIG_SERIAL_8250=y
46CONFIG_SERIAL_8250_CONSOLE=y 47CONFIG_SERIAL_8250_CONSOLE=y
47CONFIG_SERIAL_8250_NR_UARTS=2 48CONFIG_SERIAL_8250_NR_UARTS=2
diff --git a/arch/powerpc/configs/44x/canyonlands_defconfig b/arch/powerpc/configs/44x/canyonlands_defconfig
index a46942aac69..d5be93e6e92 100644
--- a/arch/powerpc/configs/44x/canyonlands_defconfig
+++ b/arch/powerpc/configs/44x/canyonlands_defconfig
@@ -49,10 +49,11 @@ CONFIG_BLK_DEV_RAM=y
49CONFIG_BLK_DEV_RAM_SIZE=35000 49CONFIG_BLK_DEV_RAM_SIZE=35000
50# CONFIG_MISC_DEVICES is not set 50# CONFIG_MISC_DEVICES is not set
51CONFIG_NETDEVICES=y 51CONFIG_NETDEVICES=y
52CONFIG_NET_ETHERNET=y 52CONFIG_ETHERNET=y
53CONFIG_IBM_NEW_EMAC=y 53CONFIG_NET_VENDOR_IBM=y
54CONFIG_IBM_NEW_EMAC_RXB=256 54CONFIG_IBM_EMAC=y
55CONFIG_IBM_NEW_EMAC_TXB=256 55CONFIG_IBM_EMAC_RXB=256
56CONFIG_IBM_EMAC_TXB=256
56# CONFIG_NETDEV_1000 is not set 57# CONFIG_NETDEV_1000 is not set
57# CONFIG_NETDEV_10000 is not set 58# CONFIG_NETDEV_10000 is not set
58# CONFIG_INPUT is not set 59# CONFIG_INPUT is not set
diff --git a/arch/powerpc/configs/44x/ebony_defconfig b/arch/powerpc/configs/44x/ebony_defconfig
index 07d77e51f1b..f9269fc4ffc 100644
--- a/arch/powerpc/configs/44x/ebony_defconfig
+++ b/arch/powerpc/configs/44x/ebony_defconfig
@@ -40,8 +40,9 @@ CONFIG_PROC_DEVICETREE=y
40CONFIG_BLK_DEV_RAM=y 40CONFIG_BLK_DEV_RAM=y
41CONFIG_BLK_DEV_RAM_SIZE=35000 41CONFIG_BLK_DEV_RAM_SIZE=35000
42CONFIG_NETDEVICES=y 42CONFIG_NETDEVICES=y
43CONFIG_NET_ETHERNET=y 43CONFIG_ETHERNET=y
44CONFIG_IBM_NEW_EMAC=y 44CONFIG_NET_VENDOR_IBM=y
45CONFIG_IBM_EMAC=y
45# CONFIG_INPUT is not set 46# CONFIG_INPUT is not set
46# CONFIG_SERIO is not set 47# CONFIG_SERIO is not set
47# CONFIG_VT is not set 48# CONFIG_VT is not set
diff --git a/arch/powerpc/configs/44x/eiger_defconfig b/arch/powerpc/configs/44x/eiger_defconfig
index 2ce7e9aff09..9be089038fd 100644
--- a/arch/powerpc/configs/44x/eiger_defconfig
+++ b/arch/powerpc/configs/44x/eiger_defconfig
@@ -55,10 +55,11 @@ CONFIG_FUSION=y
55CONFIG_FUSION_SAS=y 55CONFIG_FUSION_SAS=y
56CONFIG_I2O=y 56CONFIG_I2O=y
57CONFIG_NETDEVICES=y 57CONFIG_NETDEVICES=y
58CONFIG_NET_ETHERNET=y 58CONFIG_ETHERNET=y
59CONFIG_IBM_NEW_EMAC=y 59CONFIG_NET_VENDOR_IBM=y
60CONFIG_IBM_NEW_EMAC_RXB=256 60CONFIG_IBM_EMAC=y
61CONFIG_IBM_NEW_EMAC_TXB=256 61CONFIG_IBM_EMAC_RXB=256
62CONFIG_IBM_EMAC_TXB=256
62CONFIG_E1000E=y 63CONFIG_E1000E=y
63# CONFIG_NETDEV_10000 is not set 64# CONFIG_NETDEV_10000 is not set
64# CONFIG_INPUT is not set 65# CONFIG_INPUT is not set
diff --git a/arch/powerpc/configs/44x/icon_defconfig b/arch/powerpc/configs/44x/icon_defconfig
index 18730ff9de7..82f73035a7c 100644
--- a/arch/powerpc/configs/44x/icon_defconfig
+++ b/arch/powerpc/configs/44x/icon_defconfig
@@ -56,8 +56,9 @@ CONFIG_FUSION_SAS=y
56CONFIG_FUSION_CTL=y 56CONFIG_FUSION_CTL=y
57CONFIG_FUSION_LOGGING=y 57CONFIG_FUSION_LOGGING=y
58CONFIG_NETDEVICES=y 58CONFIG_NETDEVICES=y
59CONFIG_NET_ETHERNET=y 59CONFIG_ETHERNET=y
60CONFIG_IBM_NEW_EMAC=y 60CONFIG_NET_VENDOR_IBM=y
61CONFIG_IBM_EMAC=y
61# CONFIG_NETDEV_1000 is not set 62# CONFIG_NETDEV_1000 is not set
62# CONFIG_NETDEV_10000 is not set 63# CONFIG_NETDEV_10000 is not set
63# CONFIG_WLAN is not set 64# CONFIG_WLAN is not set
diff --git a/arch/powerpc/configs/44x/katmai_defconfig b/arch/powerpc/configs/44x/katmai_defconfig
index 34c09144a69..109562c3c6b 100644
--- a/arch/powerpc/configs/44x/katmai_defconfig
+++ b/arch/powerpc/configs/44x/katmai_defconfig
@@ -42,8 +42,9 @@ CONFIG_BLK_DEV_RAM=y
42CONFIG_BLK_DEV_RAM_SIZE=35000 42CONFIG_BLK_DEV_RAM_SIZE=35000
43CONFIG_MACINTOSH_DRIVERS=y 43CONFIG_MACINTOSH_DRIVERS=y
44CONFIG_NETDEVICES=y 44CONFIG_NETDEVICES=y
45CONFIG_NET_ETHERNET=y 45CONFIG_ETHERNET=y
46CONFIG_IBM_NEW_EMAC=y 46CONFIG_NET_VENDOR_IBM=y
47CONFIG_IBM_EMAC=y
47# CONFIG_INPUT is not set 48# CONFIG_INPUT is not set
48# CONFIG_SERIO is not set 49# CONFIG_SERIO is not set
49# CONFIG_VT is not set 50# CONFIG_VT is not set
diff --git a/arch/powerpc/configs/44x/redwood_defconfig b/arch/powerpc/configs/44x/redwood_defconfig
index 01cc2b1a7f9..48802811da7 100644
--- a/arch/powerpc/configs/44x/redwood_defconfig
+++ b/arch/powerpc/configs/44x/redwood_defconfig
@@ -53,11 +53,12 @@ CONFIG_FUSION=y
53CONFIG_FUSION_SAS=y 53CONFIG_FUSION_SAS=y
54CONFIG_I2O=y 54CONFIG_I2O=y
55CONFIG_NETDEVICES=y 55CONFIG_NETDEVICES=y
56CONFIG_NET_ETHERNET=y 56CONFIG_ETHERNET=y
57CONFIG_IBM_NEW_EMAC=y 57CONFIG_NET_VENDOR_IBM=y
58CONFIG_IBM_NEW_EMAC_RXB=256 58CONFIG_IBM_EMAC=y
59CONFIG_IBM_NEW_EMAC_TXB=256 59CONFIG_IBM_EMAC_RXB=256
60CONFIG_IBM_NEW_EMAC_DEBUG=y 60CONFIG_IBM_EMAC_TXB=256
61CONFIG_IBM_EMAC_DEBUG=y
61CONFIG_E1000E=y 62CONFIG_E1000E=y
62# CONFIG_NETDEV_10000 is not set 63# CONFIG_NETDEV_10000 is not set
63# CONFIG_INPUT is not set 64# CONFIG_INPUT is not set
diff --git a/arch/powerpc/configs/44x/sam440ep_defconfig b/arch/powerpc/configs/44x/sam440ep_defconfig
index dfcffede16a..ca088cd581a 100644
--- a/arch/powerpc/configs/44x/sam440ep_defconfig
+++ b/arch/powerpc/configs/44x/sam440ep_defconfig
@@ -44,8 +44,9 @@ CONFIG_ATA=y
44# CONFIG_SATA_PMP is not set 44# CONFIG_SATA_PMP is not set
45CONFIG_SATA_SIL=y 45CONFIG_SATA_SIL=y
46CONFIG_NETDEVICES=y 46CONFIG_NETDEVICES=y
47CONFIG_NET_ETHERNET=y 47CONFIG_ETHERNET=y
48CONFIG_IBM_NEW_EMAC=y 48CONFIG_NET_VENDOR_IBM=y
49CONFIG_IBM_EMAC=y
49# CONFIG_NETDEV_1000 is not set 50# CONFIG_NETDEV_1000 is not set
50# CONFIG_NETDEV_10000 is not set 51# CONFIG_NETDEV_10000 is not set
51CONFIG_INPUT_FF_MEMLESS=m 52CONFIG_INPUT_FF_MEMLESS=m
diff --git a/arch/powerpc/configs/44x/sequoia_defconfig b/arch/powerpc/configs/44x/sequoia_defconfig
index 47e399f2892..b7a653b626d 100644
--- a/arch/powerpc/configs/44x/sequoia_defconfig
+++ b/arch/powerpc/configs/44x/sequoia_defconfig
@@ -46,8 +46,9 @@ CONFIG_PROC_DEVICETREE=y
46CONFIG_BLK_DEV_RAM=y 46CONFIG_BLK_DEV_RAM=y
47CONFIG_BLK_DEV_RAM_SIZE=35000 47CONFIG_BLK_DEV_RAM_SIZE=35000
48CONFIG_NETDEVICES=y 48CONFIG_NETDEVICES=y
49CONFIG_NET_ETHERNET=y 49CONFIG_ETHERNET=y
50CONFIG_IBM_NEW_EMAC=y 50CONFIG_NET_VENDOR_IBM=y
51CONFIG_IBM_EMAC=y
51# CONFIG_INPUT is not set 52# CONFIG_INPUT is not set
52# CONFIG_SERIO is not set 53# CONFIG_SERIO is not set
53# CONFIG_VT is not set 54# CONFIG_VT is not set
diff --git a/arch/powerpc/configs/44x/taishan_defconfig b/arch/powerpc/configs/44x/taishan_defconfig
index a6a002ed568..30de97f158a 100644
--- a/arch/powerpc/configs/44x/taishan_defconfig
+++ b/arch/powerpc/configs/44x/taishan_defconfig
@@ -40,8 +40,9 @@ CONFIG_BLK_DEV_RAM=y
40CONFIG_BLK_DEV_RAM_SIZE=35000 40CONFIG_BLK_DEV_RAM_SIZE=35000
41CONFIG_MACINTOSH_DRIVERS=y 41CONFIG_MACINTOSH_DRIVERS=y
42CONFIG_NETDEVICES=y 42CONFIG_NETDEVICES=y
43CONFIG_NET_ETHERNET=y 43CONFIG_ETHERNET=y
44CONFIG_IBM_NEW_EMAC=y 44CONFIG_NET_VENDOR_IBM=y
45CONFIG_IBM_EMAC=y
45# CONFIG_INPUT is not set 46# CONFIG_INPUT is not set
46# CONFIG_SERIO is not set 47# CONFIG_SERIO is not set
47# CONFIG_VT is not set 48# CONFIG_VT is not set
diff --git a/arch/powerpc/configs/44x/warp_defconfig b/arch/powerpc/configs/44x/warp_defconfig
index abf74dc1f79..105bc56f4b2 100644
--- a/arch/powerpc/configs/44x/warp_defconfig
+++ b/arch/powerpc/configs/44x/warp_defconfig
@@ -54,9 +54,10 @@ CONFIG_BLK_DEV_SD=y
54CONFIG_SCSI_SPI_ATTRS=y 54CONFIG_SCSI_SPI_ATTRS=y
55# CONFIG_SCSI_LOWLEVEL is not set 55# CONFIG_SCSI_LOWLEVEL is not set
56CONFIG_NETDEVICES=y 56CONFIG_NETDEVICES=y
57CONFIG_NET_ETHERNET=y 57CONFIG_ETHERNET=y
58CONFIG_NET_VENDOR_IBM=y
58CONFIG_MII=y 59CONFIG_MII=y
59CONFIG_IBM_NEW_EMAC=y 60CONFIG_IBM_EMAC=y
60# CONFIG_NETDEV_1000 is not set 61# CONFIG_NETDEV_1000 is not set
61# CONFIG_NETDEV_10000 is not set 62# CONFIG_NETDEV_10000 is not set
62# CONFIG_INPUT is not set 63# CONFIG_INPUT is not set
diff --git a/arch/powerpc/configs/ppc40x_defconfig b/arch/powerpc/configs/ppc40x_defconfig
index bfd634b5ada..7cb703b948b 100644
--- a/arch/powerpc/configs/ppc40x_defconfig
+++ b/arch/powerpc/configs/ppc40x_defconfig
@@ -50,8 +50,9 @@ CONFIG_BLK_DEV_RAM=y
50CONFIG_BLK_DEV_RAM_SIZE=35000 50CONFIG_BLK_DEV_RAM_SIZE=35000
51CONFIG_XILINX_SYSACE=m 51CONFIG_XILINX_SYSACE=m
52CONFIG_NETDEVICES=y 52CONFIG_NETDEVICES=y
53CONFIG_NET_ETHERNET=y 53CONFIG_ETHERNET=y
54CONFIG_IBM_NEW_EMAC=y 54CONFIG_NET_VENDOR_IBM=y
55CONFIG_IBM_EMAC=y
55# CONFIG_INPUT is not set 56# CONFIG_INPUT is not set
56CONFIG_SERIO=m 57CONFIG_SERIO=m
57# CONFIG_SERIO_I8042 is not set 58# CONFIG_SERIO_I8042 is not set
diff --git a/arch/powerpc/configs/ppc44x_defconfig b/arch/powerpc/configs/ppc44x_defconfig
index 47133202a62..6cdf1c0d2c8 100644
--- a/arch/powerpc/configs/ppc44x_defconfig
+++ b/arch/powerpc/configs/ppc44x_defconfig
@@ -63,8 +63,9 @@ CONFIG_BLK_DEV_SD=m
63# CONFIG_SCSI_LOWLEVEL is not set 63# CONFIG_SCSI_LOWLEVEL is not set
64CONFIG_NETDEVICES=y 64CONFIG_NETDEVICES=y
65CONFIG_TUN=m 65CONFIG_TUN=m
66CONFIG_NET_ETHERNET=y 66CONFIG_ETHERNET=y
67CONFIG_IBM_NEW_EMAC=y 67CONFIG_NET_VENDOR_IBM=y
68CONFIG_IBM_EMAC=y
68# CONFIG_INPUT is not set 69# CONFIG_INPUT is not set
69CONFIG_SERIO=m 70CONFIG_SERIO=m
70# CONFIG_SERIO_I8042 is not set 71# CONFIG_SERIO_I8042 is not set
diff --git a/arch/powerpc/include/asm/qe.h b/arch/powerpc/include/asm/qe.h
index 0947b36e534..5e0b6d511e1 100644
--- a/arch/powerpc/include/asm/qe.h
+++ b/arch/powerpc/include/asm/qe.h
@@ -196,7 +196,7 @@ static inline int qe_alive_during_sleep(void)
196 196
197/* Structure that defines QE firmware binary files. 197/* Structure that defines QE firmware binary files.
198 * 198 *
199 * See Documentation/powerpc/qe-firmware.txt for a description of these 199 * See Documentation/powerpc/qe_firmware.txt for a description of these
200 * fields. 200 * fields.
201 */ 201 */
202struct qe_firmware { 202struct qe_firmware {
diff --git a/arch/powerpc/include/asm/udbg.h b/arch/powerpc/include/asm/udbg.h
index 93e05d1b34b..5354ae91bdd 100644
--- a/arch/powerpc/include/asm/udbg.h
+++ b/arch/powerpc/include/asm/udbg.h
@@ -54,6 +54,7 @@ extern void __init udbg_init_40x_realmode(void);
54extern void __init udbg_init_cpm(void); 54extern void __init udbg_init_cpm(void);
55extern void __init udbg_init_usbgecko(void); 55extern void __init udbg_init_usbgecko(void);
56extern void __init udbg_init_wsp(void); 56extern void __init udbg_init_wsp(void);
57extern void __init udbg_init_ehv_bc(void);
57 58
58#endif /* __KERNEL__ */ 59#endif /* __KERNEL__ */
59#endif /* _ASM_POWERPC_UDBG_H */ 60#endif /* _ASM_POWERPC_UDBG_H */
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index faa82c1f3f6..b4607a91d1f 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -67,6 +67,8 @@ void __init udbg_early_init(void)
67 udbg_init_usbgecko(); 67 udbg_init_usbgecko();
68#elif defined(CONFIG_PPC_EARLY_DEBUG_WSP) 68#elif defined(CONFIG_PPC_EARLY_DEBUG_WSP)
69 udbg_init_wsp(); 69 udbg_init_wsp();
70#elif defined(CONFIG_PPC_EARLY_DEBUG_EHV_BC)
71 udbg_init_ehv_bc();
70#endif 72#endif
71 73
72#ifdef CONFIG_PPC_EARLY_DEBUG 74#ifdef CONFIG_PPC_EARLY_DEBUG
diff --git a/arch/powerpc/platforms/40x/Kconfig b/arch/powerpc/platforms/40x/Kconfig
index d733d7ca939..b5d87067a58 100644
--- a/arch/powerpc/platforms/40x/Kconfig
+++ b/arch/powerpc/platforms/40x/Kconfig
@@ -130,21 +130,21 @@ config 405GP
130 bool 130 bool
131 select IBM405_ERR77 131 select IBM405_ERR77
132 select IBM405_ERR51 132 select IBM405_ERR51
133 select IBM_NEW_EMAC_ZMII 133 select IBM_EMAC_ZMII
134 134
135config 405EP 135config 405EP
136 bool 136 bool
137 137
138config 405EX 138config 405EX
139 bool 139 bool
140 select IBM_NEW_EMAC_EMAC4 140 select IBM_EMAC_EMAC4
141 select IBM_NEW_EMAC_RGMII 141 select IBM_EMAC_RGMII
142 142
143config 405EZ 143config 405EZ
144 bool 144 bool
145 select IBM_NEW_EMAC_NO_FLOW_CTRL 145 select IBM_EMAC_NO_FLOW_CTRL
146 select IBM_NEW_EMAC_MAL_CLR_ICINTSTAT 146 select IBM_EMAC_MAL_CLR_ICINTSTAT
147 select IBM_NEW_EMAC_MAL_COMMON_ERR 147 select IBM_EMAC_MAL_COMMON_ERR
148 148
149config 405GPR 149config 405GPR
150 bool 150 bool
diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig
index e958b6f48ec..762322ce24a 100644
--- a/arch/powerpc/platforms/44x/Kconfig
+++ b/arch/powerpc/platforms/44x/Kconfig
@@ -23,7 +23,7 @@ config BLUESTONE
23 default n 23 default n
24 select PPC44x_SIMPLE 24 select PPC44x_SIMPLE
25 select APM821xx 25 select APM821xx
26 select IBM_NEW_EMAC_RGMII 26 select IBM_EMAC_RGMII
27 help 27 help
28 This option enables support for the APM APM821xx Evaluation board. 28 This option enables support for the APM APM821xx Evaluation board.
29 29
@@ -122,8 +122,8 @@ config CANYONLANDS
122 select PPC4xx_PCI_EXPRESS 122 select PPC4xx_PCI_EXPRESS
123 select PCI_MSI 123 select PCI_MSI
124 select PPC4xx_MSI 124 select PPC4xx_MSI
125 select IBM_NEW_EMAC_RGMII 125 select IBM_EMAC_RGMII
126 select IBM_NEW_EMAC_ZMII 126 select IBM_EMAC_ZMII
127 help 127 help
128 This option enables support for the AMCC PPC460EX evaluation board. 128 This option enables support for the AMCC PPC460EX evaluation board.
129 129
@@ -135,8 +135,8 @@ config GLACIER
135 select 460EX # Odd since it uses 460GT but the effects are the same 135 select 460EX # Odd since it uses 460GT but the effects are the same
136 select PCI 136 select PCI
137 select PPC4xx_PCI_EXPRESS 137 select PPC4xx_PCI_EXPRESS
138 select IBM_NEW_EMAC_RGMII 138 select IBM_EMAC_RGMII
139 select IBM_NEW_EMAC_ZMII 139 select IBM_EMAC_ZMII
140 help 140 help
141 This option enables support for the AMCC PPC460GT evaluation board. 141 This option enables support for the AMCC PPC460GT evaluation board.
142 142
@@ -161,7 +161,7 @@ config EIGER
161 select 460SX 161 select 460SX
162 select PCI 162 select PCI
163 select PPC4xx_PCI_EXPRESS 163 select PPC4xx_PCI_EXPRESS
164 select IBM_NEW_EMAC_RGMII 164 select IBM_EMAC_RGMII
165 help 165 help
166 This option enables support for the AMCC PPC460SX evaluation board. 166 This option enables support for the AMCC PPC460SX evaluation board.
167 167
@@ -260,59 +260,59 @@ config 440EP
260 bool 260 bool
261 select PPC_FPU 261 select PPC_FPU
262 select IBM440EP_ERR42 262 select IBM440EP_ERR42
263 select IBM_NEW_EMAC_ZMII 263 select IBM_EMAC_ZMII
264 select USB_ARCH_HAS_OHCI 264 select USB_ARCH_HAS_OHCI
265 265
266config 440EPX 266config 440EPX
267 bool 267 bool
268 select PPC_FPU 268 select PPC_FPU
269 select IBM_NEW_EMAC_EMAC4 269 select IBM_EMAC_EMAC4
270 select IBM_NEW_EMAC_RGMII 270 select IBM_EMAC_RGMII
271 select IBM_NEW_EMAC_ZMII 271 select IBM_EMAC_ZMII
272 272
273config 440GRX 273config 440GRX
274 bool 274 bool
275 select IBM_NEW_EMAC_EMAC4 275 select IBM_EMAC_EMAC4
276 select IBM_NEW_EMAC_RGMII 276 select IBM_EMAC_RGMII
277 select IBM_NEW_EMAC_ZMII 277 select IBM_EMAC_ZMII
278 278
279config 440GP 279config 440GP
280 bool 280 bool
281 select IBM_NEW_EMAC_ZMII 281 select IBM_EMAC_ZMII
282 282
283config 440GX 283config 440GX
284 bool 284 bool
285 select IBM_NEW_EMAC_EMAC4 285 select IBM_EMAC_EMAC4
286 select IBM_NEW_EMAC_RGMII 286 select IBM_EMAC_RGMII
287 select IBM_NEW_EMAC_ZMII #test only 287 select IBM_EMAC_ZMII #test only
288 select IBM_NEW_EMAC_TAH #test only 288 select IBM_EMAC_TAH #test only
289 289
290config 440SP 290config 440SP
291 bool 291 bool
292 292
293config 440SPe 293config 440SPe
294 bool 294 bool
295 select IBM_NEW_EMAC_EMAC4 295 select IBM_EMAC_EMAC4
296 296
297config 460EX 297config 460EX
298 bool 298 bool
299 select PPC_FPU 299 select PPC_FPU
300 select IBM_NEW_EMAC_EMAC4 300 select IBM_EMAC_EMAC4
301 select IBM_NEW_EMAC_TAH 301 select IBM_EMAC_TAH
302 302
303config 460SX 303config 460SX
304 bool 304 bool
305 select PPC_FPU 305 select PPC_FPU
306 select IBM_NEW_EMAC_EMAC4 306 select IBM_EMAC_EMAC4
307 select IBM_NEW_EMAC_RGMII 307 select IBM_EMAC_RGMII
308 select IBM_NEW_EMAC_ZMII 308 select IBM_EMAC_ZMII
309 select IBM_NEW_EMAC_TAH 309 select IBM_EMAC_TAH
310 310
311config APM821xx 311config APM821xx
312 bool 312 bool
313 select PPC_FPU 313 select PPC_FPU
314 select IBM_NEW_EMAC_EMAC4 314 select IBM_EMAC_EMAC4
315 select IBM_NEW_EMAC_TAH 315 select IBM_EMAC_TAH
316 316
317# 44x errata/workaround config symbols, selected by the CPU models above 317# 44x errata/workaround config symbols, selected by the CPU models above
318config IBM440EP_ERR42 318config IBM440EP_ERR42
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index 498534cd526..12f5932dadc 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -80,7 +80,7 @@ config P1010_RDB
80config P1022_DS 80config P1022_DS
81 bool "Freescale P1022 DS" 81 bool "Freescale P1022 DS"
82 select DEFAULT_UIMAGE 82 select DEFAULT_UIMAGE
83 select CONFIG_PHYS_64BIT # The DTS has 36-bit addresses 83 select PHYS_64BIT # The DTS has 36-bit addresses
84 select SWIOTLB 84 select SWIOTLB
85 help 85 help
86 This option enables support for the Freescale P1022DS reference board. 86 This option enables support for the Freescale P1022DS reference board.
diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig
index 67d5009b4e8..2e7ff0c5cf4 100644
--- a/arch/powerpc/platforms/cell/Kconfig
+++ b/arch/powerpc/platforms/cell/Kconfig
@@ -17,10 +17,10 @@ config PPC_CELL_NATIVE
17 select PPC_CELL_COMMON 17 select PPC_CELL_COMMON
18 select MPIC 18 select MPIC
19 select PPC_IO_WORKAROUNDS 19 select PPC_IO_WORKAROUNDS
20 select IBM_NEW_EMAC_EMAC4 20 select IBM_EMAC_EMAC4
21 select IBM_NEW_EMAC_RGMII 21 select IBM_EMAC_RGMII
22 select IBM_NEW_EMAC_ZMII #test only 22 select IBM_EMAC_ZMII #test only
23 select IBM_NEW_EMAC_TAH #test only 23 select IBM_EMAC_TAH #test only
24 default n 24 default n
25 25
26config PPC_IBM_CELL_BLADE 26config PPC_IBM_CELL_BLADE
diff --git a/arch/powerpc/platforms/embedded6xx/storcenter.c b/arch/powerpc/platforms/embedded6xx/storcenter.c
index 613070e9ddb..f1eebcae9bf 100644
--- a/arch/powerpc/platforms/embedded6xx/storcenter.c
+++ b/arch/powerpc/platforms/embedded6xx/storcenter.c
@@ -77,7 +77,7 @@ static void __init storcenter_setup_arch(void)
77} 77}
78 78
79/* 79/*
80 * Interrupt setup and service. Interrrupts on the turbostation come 80 * Interrupt setup and service. Interrupts on the turbostation come
81 * from the four PCI slots plus onboard 8241 devices: I2C, DUART. 81 * from the four PCI slots plus onboard 8241 devices: I2C, DUART.
82 */ 82 */
83static void __init storcenter_init_IRQ(void) 83static void __init storcenter_init_IRQ(void)
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 904c6cbaf45..3363fbc964f 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -382,7 +382,7 @@ static void qe_upload_microcode(const void *base,
382/* 382/*
383 * Upload a microcode to the I-RAM at a specific address. 383 * Upload a microcode to the I-RAM at a specific address.
384 * 384 *
385 * See Documentation/powerpc/qe-firmware.txt for information on QE microcode 385 * See Documentation/powerpc/qe_firmware.txt for information on QE microcode
386 * uploading. 386 * uploading.
387 * 387 *
388 * Currently, only version 1 is supported, so the 'version' field must be 388 * Currently, only version 1 is supported, so the 'version' field must be
diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c
index 984cd202915..3330feca750 100644
--- a/arch/powerpc/sysdev/uic.c
+++ b/arch/powerpc/sysdev/uic.c
@@ -47,7 +47,7 @@ struct uic {
47 int index; 47 int index;
48 int dcrbase; 48 int dcrbase;
49 49
50 spinlock_t lock; 50 raw_spinlock_t lock;
51 51
52 /* The remapper for this UIC */ 52 /* The remapper for this UIC */
53 struct irq_host *irqhost; 53 struct irq_host *irqhost;
@@ -61,14 +61,14 @@ static void uic_unmask_irq(struct irq_data *d)
61 u32 er, sr; 61 u32 er, sr;
62 62
63 sr = 1 << (31-src); 63 sr = 1 << (31-src);
64 spin_lock_irqsave(&uic->lock, flags); 64 raw_spin_lock_irqsave(&uic->lock, flags);
65 /* ack level-triggered interrupts here */ 65 /* ack level-triggered interrupts here */
66 if (irqd_is_level_type(d)) 66 if (irqd_is_level_type(d))
67 mtdcr(uic->dcrbase + UIC_SR, sr); 67 mtdcr(uic->dcrbase + UIC_SR, sr);
68 er = mfdcr(uic->dcrbase + UIC_ER); 68 er = mfdcr(uic->dcrbase + UIC_ER);
69 er |= sr; 69 er |= sr;
70 mtdcr(uic->dcrbase + UIC_ER, er); 70 mtdcr(uic->dcrbase + UIC_ER, er);
71 spin_unlock_irqrestore(&uic->lock, flags); 71 raw_spin_unlock_irqrestore(&uic->lock, flags);
72} 72}
73 73
74static void uic_mask_irq(struct irq_data *d) 74static void uic_mask_irq(struct irq_data *d)
@@ -78,11 +78,11 @@ static void uic_mask_irq(struct irq_data *d)
78 unsigned long flags; 78 unsigned long flags;
79 u32 er; 79 u32 er;
80 80
81 spin_lock_irqsave(&uic->lock, flags); 81 raw_spin_lock_irqsave(&uic->lock, flags);
82 er = mfdcr(uic->dcrbase + UIC_ER); 82 er = mfdcr(uic->dcrbase + UIC_ER);
83 er &= ~(1 << (31 - src)); 83 er &= ~(1 << (31 - src));
84 mtdcr(uic->dcrbase + UIC_ER, er); 84 mtdcr(uic->dcrbase + UIC_ER, er);
85 spin_unlock_irqrestore(&uic->lock, flags); 85 raw_spin_unlock_irqrestore(&uic->lock, flags);
86} 86}
87 87
88static void uic_ack_irq(struct irq_data *d) 88static void uic_ack_irq(struct irq_data *d)
@@ -91,9 +91,9 @@ static void uic_ack_irq(struct irq_data *d)
91 unsigned int src = irqd_to_hwirq(d); 91 unsigned int src = irqd_to_hwirq(d);
92 unsigned long flags; 92 unsigned long flags;
93 93
94 spin_lock_irqsave(&uic->lock, flags); 94 raw_spin_lock_irqsave(&uic->lock, flags);
95 mtdcr(uic->dcrbase + UIC_SR, 1 << (31-src)); 95 mtdcr(uic->dcrbase + UIC_SR, 1 << (31-src));
96 spin_unlock_irqrestore(&uic->lock, flags); 96 raw_spin_unlock_irqrestore(&uic->lock, flags);
97} 97}
98 98
99static void uic_mask_ack_irq(struct irq_data *d) 99static void uic_mask_ack_irq(struct irq_data *d)
@@ -104,7 +104,7 @@ static void uic_mask_ack_irq(struct irq_data *d)
104 u32 er, sr; 104 u32 er, sr;
105 105
106 sr = 1 << (31-src); 106 sr = 1 << (31-src);
107 spin_lock_irqsave(&uic->lock, flags); 107 raw_spin_lock_irqsave(&uic->lock, flags);
108 er = mfdcr(uic->dcrbase + UIC_ER); 108 er = mfdcr(uic->dcrbase + UIC_ER);
109 er &= ~sr; 109 er &= ~sr;
110 mtdcr(uic->dcrbase + UIC_ER, er); 110 mtdcr(uic->dcrbase + UIC_ER, er);
@@ -118,7 +118,7 @@ static void uic_mask_ack_irq(struct irq_data *d)
118 */ 118 */
119 if (!irqd_is_level_type(d)) 119 if (!irqd_is_level_type(d))
120 mtdcr(uic->dcrbase + UIC_SR, sr); 120 mtdcr(uic->dcrbase + UIC_SR, sr);
121 spin_unlock_irqrestore(&uic->lock, flags); 121 raw_spin_unlock_irqrestore(&uic->lock, flags);
122} 122}
123 123
124static int uic_set_irq_type(struct irq_data *d, unsigned int flow_type) 124static int uic_set_irq_type(struct irq_data *d, unsigned int flow_type)
@@ -152,7 +152,7 @@ static int uic_set_irq_type(struct irq_data *d, unsigned int flow_type)
152 152
153 mask = ~(1 << (31 - src)); 153 mask = ~(1 << (31 - src));
154 154
155 spin_lock_irqsave(&uic->lock, flags); 155 raw_spin_lock_irqsave(&uic->lock, flags);
156 tr = mfdcr(uic->dcrbase + UIC_TR); 156 tr = mfdcr(uic->dcrbase + UIC_TR);
157 pr = mfdcr(uic->dcrbase + UIC_PR); 157 pr = mfdcr(uic->dcrbase + UIC_PR);
158 tr = (tr & mask) | (trigger << (31-src)); 158 tr = (tr & mask) | (trigger << (31-src));
@@ -161,7 +161,7 @@ static int uic_set_irq_type(struct irq_data *d, unsigned int flow_type)
161 mtdcr(uic->dcrbase + UIC_PR, pr); 161 mtdcr(uic->dcrbase + UIC_PR, pr);
162 mtdcr(uic->dcrbase + UIC_TR, tr); 162 mtdcr(uic->dcrbase + UIC_TR, tr);
163 163
164 spin_unlock_irqrestore(&uic->lock, flags); 164 raw_spin_unlock_irqrestore(&uic->lock, flags);
165 165
166 return 0; 166 return 0;
167} 167}
@@ -254,7 +254,7 @@ static struct uic * __init uic_init_one(struct device_node *node)
254 if (! uic) 254 if (! uic)
255 return NULL; /* FIXME: panic? */ 255 return NULL; /* FIXME: panic? */
256 256
257 spin_lock_init(&uic->lock); 257 raw_spin_lock_init(&uic->lock);
258 indexp = of_get_property(node, "cell-index", &len); 258 indexp = of_get_property(node, "cell-index", &len);
259 if (!indexp || (len != sizeof(u32))) { 259 if (!indexp || (len != sizeof(u32))) {
260 printk(KERN_ERR "uic: Device node %s has missing or invalid " 260 printk(KERN_ERR "uic: Device node %s has missing or invalid "
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index ed5cb5af528..6b99fc3f9b6 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -91,6 +91,7 @@ config S390
91 select HAVE_ARCH_MUTEX_CPU_RELAX 91 select HAVE_ARCH_MUTEX_CPU_RELAX
92 select HAVE_ARCH_JUMP_LABEL if !MARCH_G5 92 select HAVE_ARCH_JUMP_LABEL if !MARCH_G5
93 select HAVE_RCU_TABLE_FREE if SMP 93 select HAVE_RCU_TABLE_FREE if SMP
94 select ARCH_SAVE_PAGE_KEYS if HIBERNATION
94 select ARCH_INLINE_SPIN_TRYLOCK 95 select ARCH_INLINE_SPIN_TRYLOCK
95 select ARCH_INLINE_SPIN_TRYLOCK_BH 96 select ARCH_INLINE_SPIN_TRYLOCK_BH
96 select ARCH_INLINE_SPIN_LOCK 97 select ARCH_INLINE_SPIN_LOCK
diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c
index 6023c6dc1fb..74c8f5e76ce 100644
--- a/arch/s390/hypfs/hypfs_diag.c
+++ b/arch/s390/hypfs/hypfs_diag.c
@@ -562,10 +562,9 @@ static int dbfs_d204_create(void **data, void **data_free_ptr, size_t *size)
562 void *base; 562 void *base;
563 563
564 buf_size = PAGE_SIZE * (diag204_buf_pages + 1) + sizeof(d204->hdr); 564 buf_size = PAGE_SIZE * (diag204_buf_pages + 1) + sizeof(d204->hdr);
565 base = vmalloc(buf_size); 565 base = vzalloc(buf_size);
566 if (!base) 566 if (!base)
567 return -ENOMEM; 567 return -ENOMEM;
568 memset(base, 0, buf_size);
569 d204 = page_align_ptr(base + sizeof(d204->hdr)) - sizeof(d204->hdr); 568 d204 = page_align_ptr(base + sizeof(d204->hdr)) - sizeof(d204->hdr);
570 rc = diag204_do_store(d204->buf, diag204_buf_pages); 569 rc = diag204_do_store(d204->buf, diag204_buf_pages);
571 if (rc) { 570 if (rc) {
diff --git a/arch/s390/include/asm/qdio.h b/arch/s390/include/asm/qdio.h
index 15c97625df8..21993623da9 100644
--- a/arch/s390/include/asm/qdio.h
+++ b/arch/s390/include/asm/qdio.h
@@ -123,6 +123,40 @@ struct slibe {
123}; 123};
124 124
125/** 125/**
126 * struct qaob - queue asynchronous operation block
127 * @res0: reserved parameters
128 * @res1: reserved parameter
129 * @res2: reserved parameter
130 * @res3: reserved parameter
131 * @aorc: asynchronous operation return code
132 * @flags: internal flags
133 * @cbtbs: control block type
134 * @sb_count: number of storage blocks
135 * @sba: storage block element addresses
136 * @dcount: size of storage block elements
137 * @user0: user defineable value
138 * @res4: reserved paramater
139 * @user1: user defineable value
140 * @user2: user defineable value
141 */
142struct qaob {
143 u64 res0[6];
144 u8 res1;
145 u8 res2;
146 u8 res3;
147 u8 aorc;
148 u8 flags;
149 u16 cbtbs;
150 u8 sb_count;
151 u64 sba[QDIO_MAX_ELEMENTS_PER_BUFFER];
152 u16 dcount[QDIO_MAX_ELEMENTS_PER_BUFFER];
153 u64 user0;
154 u64 res4[2];
155 u64 user1;
156 u64 user2;
157} __attribute__ ((packed, aligned(256)));
158
159/**
126 * struct slib - storage list information block (SLIB) 160 * struct slib - storage list information block (SLIB)
127 * @nsliba: next SLIB address (if any) 161 * @nsliba: next SLIB address (if any)
128 * @sla: SL address 162 * @sla: SL address
@@ -225,6 +259,41 @@ struct slsb {
225#define CHSC_AC2_DATA_DIV_AVAILABLE 0x0010 259#define CHSC_AC2_DATA_DIV_AVAILABLE 0x0010
226#define CHSC_AC2_DATA_DIV_ENABLED 0x0002 260#define CHSC_AC2_DATA_DIV_ENABLED 0x0002
227 261
262/**
263 * struct qdio_outbuf_state - SBAL related asynchronous operation information
264 * (for communication with upper layer programs)
265 * (only required for use with completion queues)
266 * @flags: flags indicating state of buffer
267 * @aob: pointer to QAOB used for the particular SBAL
268 * @user: pointer to upper layer program's state information related to SBAL
269 * (stored in user1 data of QAOB)
270 */
271struct qdio_outbuf_state {
272 u8 flags;
273 struct qaob *aob;
274 void *user;
275};
276
277#define QDIO_OUTBUF_STATE_FLAG_NONE 0x00
278#define QDIO_OUTBUF_STATE_FLAG_PENDING 0x01
279
280#define CHSC_AC1_INITIATE_INPUTQ 0x80
281
282
283/* qdio adapter-characteristics-1 flag */
284#define AC1_SIGA_INPUT_NEEDED 0x40 /* process input queues */
285#define AC1_SIGA_OUTPUT_NEEDED 0x20 /* process output queues */
286#define AC1_SIGA_SYNC_NEEDED 0x10 /* ask hypervisor to sync */
287#define AC1_AUTOMATIC_SYNC_ON_THININT 0x08 /* set by hypervisor */
288#define AC1_AUTOMATIC_SYNC_ON_OUT_PCI 0x04 /* set by hypervisor */
289#define AC1_SC_QEBSM_AVAILABLE 0x02 /* available for subchannel */
290#define AC1_SC_QEBSM_ENABLED 0x01 /* enabled for subchannel */
291
292#define CHSC_AC2_DATA_DIV_AVAILABLE 0x0010
293#define CHSC_AC2_DATA_DIV_ENABLED 0x0002
294
295#define CHSC_AC3_FORMAT2_CQ_AVAILABLE 0x8000
296
228struct qdio_ssqd_desc { 297struct qdio_ssqd_desc {
229 u8 flags; 298 u8 flags;
230 u8:8; 299 u8:8;
@@ -243,8 +312,7 @@ struct qdio_ssqd_desc {
243 u64 sch_token; 312 u64 sch_token;
244 u8 mro; 313 u8 mro;
245 u8 mri; 314 u8 mri;
246 u8:8; 315 u16 qdioac3;
247 u8 sbalic;
248 u16:16; 316 u16:16;
249 u8:8; 317 u8:8;
250 u8 mmwc; 318 u8 mmwc;
@@ -280,9 +348,11 @@ typedef void qdio_handler_t(struct ccw_device *, unsigned int, int,
280 * @no_output_qs: number of output queues 348 * @no_output_qs: number of output queues
281 * @input_handler: handler to be called for input queues 349 * @input_handler: handler to be called for input queues
282 * @output_handler: handler to be called for output queues 350 * @output_handler: handler to be called for output queues
351 * @queue_start_poll: polling handlers (one per input queue or NULL)
283 * @int_parm: interruption parameter 352 * @int_parm: interruption parameter
284 * @input_sbal_addr_array: address of no_input_qs * 128 pointers 353 * @input_sbal_addr_array: address of no_input_qs * 128 pointers
285 * @output_sbal_addr_array: address of no_output_qs * 128 pointers 354 * @output_sbal_addr_array: address of no_output_qs * 128 pointers
355 * @output_sbal_state_array: no_output_qs * 128 state info (for CQ or NULL)
286 */ 356 */
287struct qdio_initialize { 357struct qdio_initialize {
288 struct ccw_device *cdev; 358 struct ccw_device *cdev;
@@ -297,11 +367,12 @@ struct qdio_initialize {
297 unsigned int no_output_qs; 367 unsigned int no_output_qs;
298 qdio_handler_t *input_handler; 368 qdio_handler_t *input_handler;
299 qdio_handler_t *output_handler; 369 qdio_handler_t *output_handler;
300 void (*queue_start_poll) (struct ccw_device *, int, unsigned long); 370 void (**queue_start_poll) (struct ccw_device *, int, unsigned long);
301 int scan_threshold; 371 int scan_threshold;
302 unsigned long int_parm; 372 unsigned long int_parm;
303 void **input_sbal_addr_array; 373 void **input_sbal_addr_array;
304 void **output_sbal_addr_array; 374 void **output_sbal_addr_array;
375 struct qdio_outbuf_state *output_sbal_state_array;
305}; 376};
306 377
307#define QDIO_STATE_INACTIVE 0x00000002 /* after qdio_cleanup */ 378#define QDIO_STATE_INACTIVE 0x00000002 /* after qdio_cleanup */
@@ -316,6 +387,7 @@ struct qdio_initialize {
316extern int qdio_allocate(struct qdio_initialize *); 387extern int qdio_allocate(struct qdio_initialize *);
317extern int qdio_establish(struct qdio_initialize *); 388extern int qdio_establish(struct qdio_initialize *);
318extern int qdio_activate(struct ccw_device *); 389extern int qdio_activate(struct ccw_device *);
390extern void qdio_release_aob(struct qaob *);
319extern int do_QDIO(struct ccw_device *, unsigned int, int, unsigned int, 391extern int do_QDIO(struct ccw_device *, unsigned int, int, unsigned int,
320 unsigned int); 392 unsigned int);
321extern int qdio_start_irq(struct ccw_device *, int); 393extern int qdio_start_irq(struct ccw_device *, int);
diff --git a/arch/s390/kernel/suspend.c b/arch/s390/kernel/suspend.c
index cf9e5c6d552..b6f9afed74e 100644
--- a/arch/s390/kernel/suspend.c
+++ b/arch/s390/kernel/suspend.c
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9#include <linux/pfn.h> 9#include <linux/pfn.h>
10#include <linux/mm.h>
10#include <asm/system.h> 11#include <asm/system.h>
11 12
12/* 13/*
@@ -14,6 +15,123 @@
14 */ 15 */
15extern const void __nosave_begin, __nosave_end; 16extern const void __nosave_begin, __nosave_end;
16 17
18/*
19 * The restore of the saved pages in an hibernation image will set
20 * the change and referenced bits in the storage key for each page.
21 * Overindication of the referenced bits after an hibernation cycle
22 * does not cause any harm but the overindication of the change bits
23 * would cause trouble.
24 * Use the ARCH_SAVE_PAGE_KEYS hooks to save the storage key of each
25 * page to the most significant byte of the associated page frame
26 * number in the hibernation image.
27 */
28
29/*
30 * Key storage is allocated as a linked list of pages.
31 * The size of the keys array is (PAGE_SIZE - sizeof(long))
32 */
33struct page_key_data {
34 struct page_key_data *next;
35 unsigned char data[];
36};
37
38#define PAGE_KEY_DATA_SIZE (PAGE_SIZE - sizeof(struct page_key_data *))
39
40static struct page_key_data *page_key_data;
41static struct page_key_data *page_key_rp, *page_key_wp;
42static unsigned long page_key_rx, page_key_wx;
43
44/*
45 * For each page in the hibernation image one additional byte is
46 * stored in the most significant byte of the page frame number.
47 * On suspend no additional memory is required but on resume the
48 * keys need to be memorized until the page data has been restored.
49 * Only then can the storage keys be set to their old state.
50 */
51unsigned long page_key_additional_pages(unsigned long pages)
52{
53 return DIV_ROUND_UP(pages, PAGE_KEY_DATA_SIZE);
54}
55
56/*
57 * Free page_key_data list of arrays.
58 */
59void page_key_free(void)
60{
61 struct page_key_data *pkd;
62
63 while (page_key_data) {
64 pkd = page_key_data;
65 page_key_data = pkd->next;
66 free_page((unsigned long) pkd);
67 }
68}
69
70/*
71 * Allocate page_key_data list of arrays with enough room to store
72 * one byte for each page in the hibernation image.
73 */
74int page_key_alloc(unsigned long pages)
75{
76 struct page_key_data *pk;
77 unsigned long size;
78
79 size = DIV_ROUND_UP(pages, PAGE_KEY_DATA_SIZE);
80 while (size--) {
81 pk = (struct page_key_data *) get_zeroed_page(GFP_KERNEL);
82 if (!pk) {
83 page_key_free();
84 return -ENOMEM;
85 }
86 pk->next = page_key_data;
87 page_key_data = pk;
88 }
89 page_key_rp = page_key_wp = page_key_data;
90 page_key_rx = page_key_wx = 0;
91 return 0;
92}
93
94/*
95 * Save the storage key into the upper 8 bits of the page frame number.
96 */
97void page_key_read(unsigned long *pfn)
98{
99 unsigned long addr;
100
101 addr = (unsigned long) page_address(pfn_to_page(*pfn));
102 *(unsigned char *) pfn = (unsigned char) page_get_storage_key(addr);
103}
104
105/*
106 * Extract the storage key from the upper 8 bits of the page frame number
107 * and store it in the page_key_data list of arrays.
108 */
109void page_key_memorize(unsigned long *pfn)
110{
111 page_key_wp->data[page_key_wx] = *(unsigned char *) pfn;
112 *(unsigned char *) pfn = 0;
113 if (++page_key_wx < PAGE_KEY_DATA_SIZE)
114 return;
115 page_key_wp = page_key_wp->next;
116 page_key_wx = 0;
117}
118
119/*
120 * Get the next key from the page_key_data list of arrays and set the
121 * storage key of the page referred by @address. If @address refers to
122 * a "safe" page the swsusp_arch_resume code will transfer the storage
123 * key from the buffer page to the original page.
124 */
125void page_key_write(void *address)
126{
127 page_set_storage_key((unsigned long) address,
128 page_key_rp->data[page_key_rx], 0);
129 if (++page_key_rx >= PAGE_KEY_DATA_SIZE)
130 return;
131 page_key_rp = page_key_rp->next;
132 page_key_rx = 0;
133}
134
17int pfn_is_nosave(unsigned long pfn) 135int pfn_is_nosave(unsigned long pfn)
18{ 136{
19 unsigned long nosave_begin_pfn = PFN_DOWN(__pa(&__nosave_begin)); 137 unsigned long nosave_begin_pfn = PFN_DOWN(__pa(&__nosave_begin));
diff --git a/arch/s390/kernel/swsusp_asm64.S b/arch/s390/kernel/swsusp_asm64.S
index 51bcdb50a23..acb78cdee89 100644
--- a/arch/s390/kernel/swsusp_asm64.S
+++ b/arch/s390/kernel/swsusp_asm64.S
@@ -136,11 +136,14 @@ ENTRY(swsusp_arch_resume)
1360: 1360:
137 lg %r2,8(%r1) 137 lg %r2,8(%r1)
138 lg %r4,0(%r1) 138 lg %r4,0(%r1)
139 iske %r0,%r4
139 lghi %r3,PAGE_SIZE 140 lghi %r3,PAGE_SIZE
140 lghi %r5,PAGE_SIZE 141 lghi %r5,PAGE_SIZE
1411: 1421:
142 mvcle %r2,%r4,0 143 mvcle %r2,%r4,0
143 jo 1b 144 jo 1b
145 lg %r2,8(%r1)
146 sske %r0,%r2
144 lg %r1,16(%r1) 147 lg %r1,16(%r1)
145 ltgr %r1,%r1 148 ltgr %r1,%r1
146 jnz 0b 149 jnz 0b
diff --git a/arch/sh/include/asm/sh_eth.h b/arch/sh/include/asm/sh_eth.h
deleted file mode 100644
index 0f325da0f92..00000000000
--- a/arch/sh/include/asm/sh_eth.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef __ASM_SH_ETH_H__
2#define __ASM_SH_ETH_H__
3
4#include <linux/phy.h>
5
6enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN};
7enum {
8 SH_ETH_REG_GIGABIT,
9 SH_ETH_REG_FAST_SH4,
10 SH_ETH_REG_FAST_SH3_SH2
11};
12
13struct sh_eth_plat_data {
14 int phy;
15 int edmac_endian;
16 int register_type;
17 phy_interface_t phy_interface;
18 void (*set_mdio_gate)(unsigned long addr);
19
20 unsigned char mac_addr[6];
21 unsigned no_ether_link:1;
22 unsigned ether_link_active_low:1;
23};
24
25#endif
diff --git a/arch/sparc/include/asm/pgtsrmmu.h b/arch/sparc/include/asm/pgtsrmmu.h
index 1407c07bdad..f6ae2b2b687 100644
--- a/arch/sparc/include/asm/pgtsrmmu.h
+++ b/arch/sparc/include/asm/pgtsrmmu.h
@@ -280,7 +280,7 @@ static inline unsigned long srmmu_hwprobe(unsigned long vaddr)
280 return retval; 280 return retval;
281} 281}
282#else 282#else
283#define srmmu_hwprobe(addr) (srmmu_swprobe(addr, 0) & SRMMU_PTE_PMASK) 283#define srmmu_hwprobe(addr) srmmu_swprobe(addr, 0)
284#endif 284#endif
285 285
286static inline int 286static inline int
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 1e94f946570..8aa0d440858 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -230,7 +230,8 @@ static void pci_parse_of_addrs(struct platform_device *op,
230 res = &dev->resource[(i - PCI_BASE_ADDRESS_0) >> 2]; 230 res = &dev->resource[(i - PCI_BASE_ADDRESS_0) >> 2];
231 } else if (i == dev->rom_base_reg) { 231 } else if (i == dev->rom_base_reg) {
232 res = &dev->resource[PCI_ROM_RESOURCE]; 232 res = &dev->resource[PCI_ROM_RESOURCE];
233 flags |= IORESOURCE_READONLY | IORESOURCE_CACHEABLE; 233 flags |= IORESOURCE_READONLY | IORESOURCE_CACHEABLE
234 | IORESOURCE_SIZEALIGN;
234 } else { 235 } else {
235 printk(KERN_ERR "PCI: bad cfg reg num 0x%x\n", i); 236 printk(KERN_ERR "PCI: bad cfg reg num 0x%x\n", i);
236 continue; 237 continue;
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c
index 1ba95aff5d5..2caa556db86 100644
--- a/arch/sparc/kernel/signal32.c
+++ b/arch/sparc/kernel/signal32.c
@@ -273,10 +273,7 @@ void do_sigreturn32(struct pt_regs *regs)
273 case 1: set.sig[0] = seta[0] + (((long)seta[1]) << 32); 273 case 1: set.sig[0] = seta[0] + (((long)seta[1]) << 32);
274 } 274 }
275 sigdelsetmask(&set, ~_BLOCKABLE); 275 sigdelsetmask(&set, ~_BLOCKABLE);
276 spin_lock_irq(&current->sighand->siglock); 276 set_current_blocked(&set);
277 current->blocked = set;
278 recalc_sigpending();
279 spin_unlock_irq(&current->sighand->siglock);
280 return; 277 return;
281 278
282segv: 279segv:
@@ -377,10 +374,7 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
377 case 1: set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32); 374 case 1: set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32);
378 } 375 }
379 sigdelsetmask(&set, ~_BLOCKABLE); 376 sigdelsetmask(&set, ~_BLOCKABLE);
380 spin_lock_irq(&current->sighand->siglock); 377 set_current_blocked(&set);
381 current->blocked = set;
382 recalc_sigpending();
383 spin_unlock_irq(&current->sighand->siglock);
384 return; 378 return;
385segv: 379segv:
386 force_sig(SIGSEGV, current); 380 force_sig(SIGSEGV, current);
@@ -782,6 +776,7 @@ static inline int handle_signal32(unsigned long signr, struct k_sigaction *ka,
782 siginfo_t *info, 776 siginfo_t *info,
783 sigset_t *oldset, struct pt_regs *regs) 777 sigset_t *oldset, struct pt_regs *regs)
784{ 778{
779 sigset_t blocked;
785 int err; 780 int err;
786 781
787 if (ka->sa.sa_flags & SA_SIGINFO) 782 if (ka->sa.sa_flags & SA_SIGINFO)
@@ -792,12 +787,10 @@ static inline int handle_signal32(unsigned long signr, struct k_sigaction *ka,
792 if (err) 787 if (err)
793 return err; 788 return err;
794 789
795 spin_lock_irq(&current->sighand->siglock); 790 sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask);
796 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
797 if (!(ka->sa.sa_flags & SA_NOMASK)) 791 if (!(ka->sa.sa_flags & SA_NOMASK))
798 sigaddset(&current->blocked,signr); 792 sigaddset(&blocked, signr);
799 recalc_sigpending(); 793 set_current_blocked(&blocked);
800 spin_unlock_irq(&current->sighand->siglock);
801 794
802 tracehook_signal_handler(signr, info, ka, regs, 0); 795 tracehook_signal_handler(signr, info, ka, regs, 0);
803 796
@@ -881,7 +874,7 @@ void do_signal32(sigset_t *oldset, struct pt_regs * regs,
881 */ 874 */
882 if (current_thread_info()->status & TS_RESTORE_SIGMASK) { 875 if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
883 current_thread_info()->status &= ~TS_RESTORE_SIGMASK; 876 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
884 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 877 set_current_blocked(&current->saved_sigmask);
885 } 878 }
886} 879}
887 880
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c
index 04ede8f04ad..8ce247ac04c 100644
--- a/arch/sparc/kernel/signal_32.c
+++ b/arch/sparc/kernel/signal_32.c
@@ -62,12 +62,13 @@ struct rt_signal_frame {
62 62
63static int _sigpause_common(old_sigset_t set) 63static int _sigpause_common(old_sigset_t set)
64{ 64{
65 set &= _BLOCKABLE; 65 sigset_t blocked;
66 spin_lock_irq(&current->sighand->siglock); 66
67 current->saved_sigmask = current->blocked; 67 current->saved_sigmask = current->blocked;
68 siginitset(&current->blocked, set); 68
69 recalc_sigpending(); 69 set &= _BLOCKABLE;
70 spin_unlock_irq(&current->sighand->siglock); 70 siginitset(&blocked, set);
71 set_current_blocked(&blocked);
71 72
72 current->state = TASK_INTERRUPTIBLE; 73 current->state = TASK_INTERRUPTIBLE;
73 schedule(); 74 schedule();
@@ -139,10 +140,7 @@ asmlinkage void do_sigreturn(struct pt_regs *regs)
139 goto segv_and_exit; 140 goto segv_and_exit;
140 141
141 sigdelsetmask(&set, ~_BLOCKABLE); 142 sigdelsetmask(&set, ~_BLOCKABLE);
142 spin_lock_irq(&current->sighand->siglock); 143 set_current_blocked(&set);
143 current->blocked = set;
144 recalc_sigpending();
145 spin_unlock_irq(&current->sighand->siglock);
146 return; 144 return;
147 145
148segv_and_exit: 146segv_and_exit:
@@ -209,10 +207,7 @@ asmlinkage void do_rt_sigreturn(struct pt_regs *regs)
209 } 207 }
210 208
211 sigdelsetmask(&set, ~_BLOCKABLE); 209 sigdelsetmask(&set, ~_BLOCKABLE);
212 spin_lock_irq(&current->sighand->siglock); 210 set_current_blocked(&set);
213 current->blocked = set;
214 recalc_sigpending();
215 spin_unlock_irq(&current->sighand->siglock);
216 return; 211 return;
217segv: 212segv:
218 force_sig(SIGSEGV, current); 213 force_sig(SIGSEGV, current);
@@ -470,6 +465,7 @@ static inline int
470handle_signal(unsigned long signr, struct k_sigaction *ka, 465handle_signal(unsigned long signr, struct k_sigaction *ka,
471 siginfo_t *info, sigset_t *oldset, struct pt_regs *regs) 466 siginfo_t *info, sigset_t *oldset, struct pt_regs *regs)
472{ 467{
468 sigset_t blocked;
473 int err; 469 int err;
474 470
475 if (ka->sa.sa_flags & SA_SIGINFO) 471 if (ka->sa.sa_flags & SA_SIGINFO)
@@ -480,12 +476,10 @@ handle_signal(unsigned long signr, struct k_sigaction *ka,
480 if (err) 476 if (err)
481 return err; 477 return err;
482 478
483 spin_lock_irq(&current->sighand->siglock); 479 sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask);
484 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
485 if (!(ka->sa.sa_flags & SA_NOMASK)) 480 if (!(ka->sa.sa_flags & SA_NOMASK))
486 sigaddset(&current->blocked, signr); 481 sigaddset(&blocked, signr);
487 recalc_sigpending(); 482 set_current_blocked(&blocked);
488 spin_unlock_irq(&current->sighand->siglock);
489 483
490 tracehook_signal_handler(signr, info, ka, regs, 0); 484 tracehook_signal_handler(signr, info, ka, regs, 0);
491 485
@@ -581,7 +575,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
581 */ 575 */
582 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 576 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
583 clear_thread_flag(TIF_RESTORE_SIGMASK); 577 clear_thread_flag(TIF_RESTORE_SIGMASK);
584 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 578 set_current_blocked(&current->saved_sigmask);
585 } 579 }
586} 580}
587 581
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c
index 47509df3b89..a2b81598d90 100644
--- a/arch/sparc/kernel/signal_64.c
+++ b/arch/sparc/kernel/signal_64.c
@@ -70,10 +70,7 @@ asmlinkage void sparc64_set_context(struct pt_regs *regs)
70 goto do_sigsegv; 70 goto do_sigsegv;
71 } 71 }
72 sigdelsetmask(&set, ~_BLOCKABLE); 72 sigdelsetmask(&set, ~_BLOCKABLE);
73 spin_lock_irq(&current->sighand->siglock); 73 set_current_blocked(&set);
74 current->blocked = set;
75 recalc_sigpending();
76 spin_unlock_irq(&current->sighand->siglock);
77 } 74 }
78 if (test_thread_flag(TIF_32BIT)) { 75 if (test_thread_flag(TIF_32BIT)) {
79 pc &= 0xffffffff; 76 pc &= 0xffffffff;
@@ -242,12 +239,13 @@ struct rt_signal_frame {
242 239
243static long _sigpause_common(old_sigset_t set) 240static long _sigpause_common(old_sigset_t set)
244{ 241{
245 set &= _BLOCKABLE; 242 sigset_t blocked;
246 spin_lock_irq(&current->sighand->siglock); 243
247 current->saved_sigmask = current->blocked; 244 current->saved_sigmask = current->blocked;
248 siginitset(&current->blocked, set); 245
249 recalc_sigpending(); 246 set &= _BLOCKABLE;
250 spin_unlock_irq(&current->sighand->siglock); 247 siginitset(&blocked, set);
248 set_current_blocked(&blocked);
251 249
252 current->state = TASK_INTERRUPTIBLE; 250 current->state = TASK_INTERRUPTIBLE;
253 schedule(); 251 schedule();
@@ -327,10 +325,7 @@ void do_rt_sigreturn(struct pt_regs *regs)
327 pt_regs_clear_syscall(regs); 325 pt_regs_clear_syscall(regs);
328 326
329 sigdelsetmask(&set, ~_BLOCKABLE); 327 sigdelsetmask(&set, ~_BLOCKABLE);
330 spin_lock_irq(&current->sighand->siglock); 328 set_current_blocked(&set);
331 current->blocked = set;
332 recalc_sigpending();
333 spin_unlock_irq(&current->sighand->siglock);
334 return; 329 return;
335segv: 330segv:
336 force_sig(SIGSEGV, current); 331 force_sig(SIGSEGV, current);
@@ -484,18 +479,17 @@ static inline int handle_signal(unsigned long signr, struct k_sigaction *ka,
484 siginfo_t *info, 479 siginfo_t *info,
485 sigset_t *oldset, struct pt_regs *regs) 480 sigset_t *oldset, struct pt_regs *regs)
486{ 481{
482 sigset_t blocked;
487 int err; 483 int err;
488 484
489 err = setup_rt_frame(ka, regs, signr, oldset, 485 err = setup_rt_frame(ka, regs, signr, oldset,
490 (ka->sa.sa_flags & SA_SIGINFO) ? info : NULL); 486 (ka->sa.sa_flags & SA_SIGINFO) ? info : NULL);
491 if (err) 487 if (err)
492 return err; 488 return err;
493 spin_lock_irq(&current->sighand->siglock); 489 sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask);
494 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
495 if (!(ka->sa.sa_flags & SA_NOMASK)) 490 if (!(ka->sa.sa_flags & SA_NOMASK))
496 sigaddset(&current->blocked,signr); 491 sigaddset(&blocked, signr);
497 recalc_sigpending(); 492 set_current_blocked(&blocked);
498 spin_unlock_irq(&current->sighand->siglock);
499 493
500 tracehook_signal_handler(signr, info, ka, regs, 0); 494 tracehook_signal_handler(signr, info, ka, regs, 0);
501 495
@@ -601,7 +595,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
601 */ 595 */
602 if (current_thread_info()->status & TS_RESTORE_SIGMASK) { 596 if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
603 current_thread_info()->status &= ~TS_RESTORE_SIGMASK; 597 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
604 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 598 set_current_blocked(&current->saved_sigmask);
605 } 599 }
606} 600}
607 601
diff --git a/arch/sparc/mm/leon_mm.c b/arch/sparc/mm/leon_mm.c
index e485a680499..13c2169822a 100644
--- a/arch/sparc/mm/leon_mm.c
+++ b/arch/sparc/mm/leon_mm.c
@@ -162,7 +162,7 @@ ready:
162 printk(KERN_INFO "swprobe: padde %x\n", paddr_calc); 162 printk(KERN_INFO "swprobe: padde %x\n", paddr_calc);
163 if (paddr) 163 if (paddr)
164 *paddr = paddr_calc; 164 *paddr = paddr_calc;
165 return paddrbase; 165 return pte;
166} 166}
167 167
168void leon_flush_icache_all(void) 168void leon_flush_icache_all(void)
diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S
index fc94607f0bd..aecc8ed5f39 100644
--- a/arch/tile/kernel/intvec_32.S
+++ b/arch/tile/kernel/intvec_32.S
@@ -21,7 +21,7 @@
21#include <asm/ptrace.h> 21#include <asm/ptrace.h>
22#include <asm/thread_info.h> 22#include <asm/thread_info.h>
23#include <asm/irqflags.h> 23#include <asm/irqflags.h>
24#include <linux/atomic.h> 24#include <asm/atomic_32.h>
25#include <asm/asm-offsets.h> 25#include <asm/asm-offsets.h>
26#include <hv/hypervisor.h> 26#include <hv/hypervisor.h>
27#include <arch/abi.h> 27#include <arch/abi.h>
diff --git a/arch/tile/lib/atomic_asm_32.S b/arch/tile/lib/atomic_asm_32.S
index 1f75a2a5610..30638042691 100644
--- a/arch/tile/lib/atomic_asm_32.S
+++ b/arch/tile/lib/atomic_asm_32.S
@@ -70,7 +70,7 @@
70 */ 70 */
71 71
72#include <linux/linkage.h> 72#include <linux/linkage.h>
73#include <linux/atomic.h> 73#include <asm/atomic_32.h>
74#include <asm/page.h> 74#include <asm/page.h>
75#include <asm/processor.h> 75#include <asm/processor.h>
76 76
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 22745b47c82..a492e59883a 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -368,7 +368,7 @@ static const struct net_device_ops uml_netdev_ops = {
368 .ndo_open = uml_net_open, 368 .ndo_open = uml_net_open,
369 .ndo_stop = uml_net_close, 369 .ndo_stop = uml_net_close,
370 .ndo_start_xmit = uml_net_start_xmit, 370 .ndo_start_xmit = uml_net_start_xmit,
371 .ndo_set_multicast_list = uml_net_set_multicast_list, 371 .ndo_set_rx_mode = uml_net_set_multicast_list,
372 .ndo_tx_timeout = uml_net_tx_timeout, 372 .ndo_tx_timeout = uml_net_tx_timeout,
373 .ndo_set_mac_address = eth_mac_addr, 373 .ndo_set_mac_address = eth_mac_addr,
374 .ndo_change_mtu = uml_net_change_mtu, 374 .ndo_change_mtu = uml_net_change_mtu,
diff --git a/arch/unicore32/include/asm/io.h b/arch/unicore32/include/asm/io.h
index 4bd87f3d13d..1a5c5a5eb39 100644
--- a/arch/unicore32/include/asm/io.h
+++ b/arch/unicore32/include/asm/io.h
@@ -32,7 +32,7 @@ extern void __uc32_iounmap(volatile void __iomem *addr);
32 * ioremap and friends. 32 * ioremap and friends.
33 * 33 *
34 * ioremap takes a PCI memory address, as specified in 34 * ioremap takes a PCI memory address, as specified in
35 * Documentation/IO-mapping.txt. 35 * Documentation/io-mapping.txt.
36 * 36 *
37 */ 37 */
38#define ioremap(cookie, size) __uc32_ioremap(cookie, size) 38#define ioremap(cookie, size) __uc32_ioremap(cookie, size)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 6a47bb22657..9037289617a 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -130,7 +130,7 @@ config SBUS
130 bool 130 bool
131 131
132config NEED_DMA_MAP_STATE 132config NEED_DMA_MAP_STATE
133 def_bool (X86_64 || DMAR || DMA_API_DEBUG) 133 def_bool (X86_64 || INTEL_IOMMU || DMA_API_DEBUG)
134 134
135config NEED_SG_DMA_LENGTH 135config NEED_SG_DMA_LENGTH
136 def_bool y 136 def_bool y
@@ -220,7 +220,7 @@ config ARCH_SUPPORTS_DEBUG_PAGEALLOC
220 220
221config HAVE_INTEL_TXT 221config HAVE_INTEL_TXT
222 def_bool y 222 def_bool y
223 depends on EXPERIMENTAL && DMAR && ACPI 223 depends on EXPERIMENTAL && INTEL_IOMMU && ACPI
224 224
225config X86_32_SMP 225config X86_32_SMP
226 def_bool y 226 def_bool y
@@ -279,7 +279,7 @@ config SMP
279 Y to "Enhanced Real Time Clock Support", below. The "Advanced Power 279 Y to "Enhanced Real Time Clock Support", below. The "Advanced Power
280 Management" code will be disabled if you say Y here. 280 Management" code will be disabled if you say Y here.
281 281
282 See also <file:Documentation/i386/IO-APIC.txt>, 282 See also <file:Documentation/x86/i386/IO-APIC.txt>,
283 <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at 283 <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at
284 <http://www.tldp.org/docs.html#howto>. 284 <http://www.tldp.org/docs.html#howto>.
285 285
@@ -287,7 +287,7 @@ config SMP
287 287
288config X86_X2APIC 288config X86_X2APIC
289 bool "Support x2apic" 289 bool "Support x2apic"
290 depends on X86_LOCAL_APIC && X86_64 && INTR_REMAP 290 depends on X86_LOCAL_APIC && X86_64 && IRQ_REMAP
291 ---help--- 291 ---help---
292 This enables x2apic support on CPUs that have this feature. 292 This enables x2apic support on CPUs that have this feature.
293 293
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index c0f8a5c8891..bf56e179327 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -139,7 +139,7 @@ config IOMMU_DEBUG
139 code. When you use it make sure you have a big enough 139 code. When you use it make sure you have a big enough
140 IOMMU/AGP aperture. Most of the options enabled by this can 140 IOMMU/AGP aperture. Most of the options enabled by this can
141 be set more finegrained using the iommu= command line 141 be set more finegrained using the iommu= command line
142 options. See Documentation/x86_64/boot-options.txt for more 142 options. See Documentation/x86/x86_64/boot-options.txt for more
143 details. 143 details.
144 144
145config IOMMU_STRESS 145config IOMMU_STRESS
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index 93e689f4bd8..bdb4d458ec8 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -129,7 +129,7 @@ start_sys_seg: .word SYSSEG # obsolete and meaningless, but just
129 129
130type_of_loader: .byte 0 # 0 means ancient bootloader, newer 130type_of_loader: .byte 0 # 0 means ancient bootloader, newer
131 # bootloaders know to change this. 131 # bootloaders know to change this.
132 # See Documentation/i386/boot.txt for 132 # See Documentation/x86/boot.txt for
133 # assigned ids 133 # assigned ids
134 134
135# flags, unused bits must be zero (RFU) bit within loadflags 135# flags, unused bits must be zero (RFU) bit within loadflags
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index 22a0dc8e51d..058a35b8286 100644
--- a/arch/x86/configs/x86_64_defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -67,8 +67,8 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
67CONFIG_CPU_FREQ_GOV_ONDEMAND=y 67CONFIG_CPU_FREQ_GOV_ONDEMAND=y
68CONFIG_X86_ACPI_CPUFREQ=y 68CONFIG_X86_ACPI_CPUFREQ=y
69CONFIG_PCI_MMCONFIG=y 69CONFIG_PCI_MMCONFIG=y
70CONFIG_DMAR=y 70CONFIG_INTEL_IOMMU=y
71# CONFIG_DMAR_DEFAULT_ON is not set 71# CONFIG_INTEL_IOMMU_DEFAULT_ON is not set
72CONFIG_PCIEPORTBUS=y 72CONFIG_PCIEPORTBUS=y
73CONFIG_PCCARD=y 73CONFIG_PCCARD=y
74CONFIG_YENTA=y 74CONFIG_YENTA=y
diff --git a/arch/x86/include/asm/device.h b/arch/x86/include/asm/device.h
index 029f230ab63..63a2a03d7d5 100644
--- a/arch/x86/include/asm/device.h
+++ b/arch/x86/include/asm/device.h
@@ -8,7 +8,7 @@ struct dev_archdata {
8#ifdef CONFIG_X86_64 8#ifdef CONFIG_X86_64
9struct dma_map_ops *dma_ops; 9struct dma_map_ops *dma_ops;
10#endif 10#endif
11#if defined(CONFIG_DMAR) || defined(CONFIG_AMD_IOMMU) 11#if defined(CONFIG_INTEL_IOMMU) || defined(CONFIG_AMD_IOMMU)
12 void *iommu; /* hook for IOMMU specific extension */ 12 void *iommu; /* hook for IOMMU specific extension */
13#endif 13#endif
14}; 14};
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index d4c419f883a..ed3065fd631 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -2,7 +2,7 @@
2#define _ASM_X86_DMA_MAPPING_H 2#define _ASM_X86_DMA_MAPPING_H
3 3
4/* 4/*
5 * IOMMU interface. See Documentation/PCI/PCI-DMA-mapping.txt and 5 * IOMMU interface. See Documentation/DMA-API-HOWTO.txt and
6 * Documentation/DMA-API.txt for documentation. 6 * Documentation/DMA-API.txt for documentation.
7 */ 7 */
8 8
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
index 09199052060..eb92a6ed2be 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -119,7 +119,7 @@ struct irq_cfg {
119 cpumask_var_t old_domain; 119 cpumask_var_t old_domain;
120 u8 vector; 120 u8 vector;
121 u8 move_in_progress : 1; 121 u8 move_in_progress : 1;
122#ifdef CONFIG_INTR_REMAP 122#ifdef CONFIG_IRQ_REMAP
123 struct irq_2_iommu irq_2_iommu; 123 struct irq_2_iommu irq_2_iommu;
124#endif 124#endif
125}; 125};
diff --git a/arch/x86/include/asm/hyperv.h b/arch/x86/include/asm/hyperv.h
index 5df477ac3af..b80420bcd09 100644
--- a/arch/x86/include/asm/hyperv.h
+++ b/arch/x86/include/asm/hyperv.h
@@ -189,5 +189,6 @@
189#define HV_STATUS_INVALID_HYPERCALL_CODE 2 189#define HV_STATUS_INVALID_HYPERCALL_CODE 2
190#define HV_STATUS_INVALID_HYPERCALL_INPUT 3 190#define HV_STATUS_INVALID_HYPERCALL_INPUT 3
191#define HV_STATUS_INVALID_ALIGNMENT 4 191#define HV_STATUS_INVALID_ALIGNMENT 4
192#define HV_STATUS_INSUFFICIENT_BUFFERS 19
192 193
193#endif 194#endif
diff --git a/arch/x86/include/asm/irq_remapping.h b/arch/x86/include/asm/irq_remapping.h
index 1c23360fb2d..47d99934580 100644
--- a/arch/x86/include/asm/irq_remapping.h
+++ b/arch/x86/include/asm/irq_remapping.h
@@ -3,7 +3,8 @@
3 3
4#define IRTE_DEST(dest) ((x2apic_mode) ? dest : dest << 8) 4#define IRTE_DEST(dest) ((x2apic_mode) ? dest : dest << 8)
5 5
6#ifdef CONFIG_INTR_REMAP 6#ifdef CONFIG_IRQ_REMAP
7static void irq_remap_modify_chip_defaults(struct irq_chip *chip);
7static inline void prepare_irte(struct irte *irte, int vector, 8static inline void prepare_irte(struct irte *irte, int vector,
8 unsigned int dest) 9 unsigned int dest)
9{ 10{
@@ -36,6 +37,9 @@ static inline bool irq_remapped(struct irq_cfg *cfg)
36{ 37{
37 return false; 38 return false;
38} 39}
40static inline void irq_remap_modify_chip_defaults(struct irq_chip *chip)
41{
42}
39#endif 43#endif
40 44
41#endif /* _ASM_X86_IRQ_REMAPPING_H */ 45#endif /* _ASM_X86_IRQ_REMAPPING_H */
diff --git a/arch/x86/include/asm/nmi.h b/arch/x86/include/asm/nmi.h
index 4886a68f267..fd3f9f18cf3 100644
--- a/arch/x86/include/asm/nmi.h
+++ b/arch/x86/include/asm/nmi.h
@@ -22,27 +22,26 @@ void arch_trigger_all_cpu_backtrace(void);
22#define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace 22#define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace
23#endif 23#endif
24 24
25/* 25#define NMI_FLAG_FIRST 1
26 * Define some priorities for the nmi notifier call chain. 26
27 * 27enum {
28 * Create a local nmi bit that has a higher priority than 28 NMI_LOCAL=0,
29 * external nmis, because the local ones are more frequent. 29 NMI_UNKNOWN,
30 * 30 NMI_MAX
31 * Also setup some default high/normal/low settings for 31};
32 * subsystems to registers with. Using 4 bits to separate 32
33 * the priorities. This can go a lot higher if needed be. 33#define NMI_DONE 0
34 */ 34#define NMI_HANDLED 1
35 35
36#define NMI_LOCAL_SHIFT 16 /* randomly picked */ 36typedef int (*nmi_handler_t)(unsigned int, struct pt_regs *);
37#define NMI_LOCAL_BIT (1ULL << NMI_LOCAL_SHIFT) 37
38#define NMI_HIGH_PRIOR (1ULL << 8) 38int register_nmi_handler(unsigned int, nmi_handler_t, unsigned long,
39#define NMI_NORMAL_PRIOR (1ULL << 4) 39 const char *);
40#define NMI_LOW_PRIOR (1ULL << 0) 40
41#define NMI_LOCAL_HIGH_PRIOR (NMI_LOCAL_BIT | NMI_HIGH_PRIOR) 41void unregister_nmi_handler(unsigned int, const char *);
42#define NMI_LOCAL_NORMAL_PRIOR (NMI_LOCAL_BIT | NMI_NORMAL_PRIOR)
43#define NMI_LOCAL_LOW_PRIOR (NMI_LOCAL_BIT | NMI_LOW_PRIOR)
44 42
45void stop_nmi(void); 43void stop_nmi(void);
46void restart_nmi(void); 44void restart_nmi(void);
45void local_touch_nmi(void);
47 46
48#endif /* _ASM_X86_NMI_H */ 47#endif /* _ASM_X86_NMI_H */
diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
index 094fb30817a..f61c62f7d5d 100644
--- a/arch/x86/include/asm/perf_event.h
+++ b/arch/x86/include/asm/perf_event.h
@@ -29,6 +29,9 @@
29#define ARCH_PERFMON_EVENTSEL_INV (1ULL << 23) 29#define ARCH_PERFMON_EVENTSEL_INV (1ULL << 23)
30#define ARCH_PERFMON_EVENTSEL_CMASK 0xFF000000ULL 30#define ARCH_PERFMON_EVENTSEL_CMASK 0xFF000000ULL
31 31
32#define AMD_PERFMON_EVENTSEL_GUESTONLY (1ULL << 40)
33#define AMD_PERFMON_EVENTSEL_HOSTONLY (1ULL << 41)
34
32#define AMD64_EVENTSEL_EVENT \ 35#define AMD64_EVENTSEL_EVENT \
33 (ARCH_PERFMON_EVENTSEL_EVENT | (0x0FULL << 32)) 36 (ARCH_PERFMON_EVENTSEL_EVENT | (0x0FULL << 32))
34#define INTEL_ARCH_EVENT_MASK \ 37#define INTEL_ARCH_EVENT_MASK \
@@ -43,14 +46,17 @@
43#define AMD64_RAW_EVENT_MASK \ 46#define AMD64_RAW_EVENT_MASK \
44 (X86_RAW_EVENT_MASK | \ 47 (X86_RAW_EVENT_MASK | \
45 AMD64_EVENTSEL_EVENT) 48 AMD64_EVENTSEL_EVENT)
49#define AMD64_NUM_COUNTERS 4
50#define AMD64_NUM_COUNTERS_F15H 6
51#define AMD64_NUM_COUNTERS_MAX AMD64_NUM_COUNTERS_F15H
46 52
47#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 0x3c 53#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 0x3c
48#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) 54#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8)
49#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX 0 55#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX 0
50#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT \ 56#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT \
51 (1 << (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX)) 57 (1 << (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX))
52 58
53#define ARCH_PERFMON_BRANCH_MISSES_RETIRED 6 59#define ARCH_PERFMON_BRANCH_MISSES_RETIRED 6
54 60
55/* 61/*
56 * Intel "Architectural Performance Monitoring" CPUID 62 * Intel "Architectural Performance Monitoring" CPUID
@@ -110,6 +116,35 @@ union cpuid10_edx {
110 */ 116 */
111#define X86_PMC_IDX_FIXED_BTS (X86_PMC_IDX_FIXED + 16) 117#define X86_PMC_IDX_FIXED_BTS (X86_PMC_IDX_FIXED + 16)
112 118
119/*
120 * IBS cpuid feature detection
121 */
122
123#define IBS_CPUID_FEATURES 0x8000001b
124
125/*
126 * Same bit mask as for IBS cpuid feature flags (Fn8000_001B_EAX), but
127 * bit 0 is used to indicate the existence of IBS.
128 */
129#define IBS_CAPS_AVAIL (1U<<0)
130#define IBS_CAPS_FETCHSAM (1U<<1)
131#define IBS_CAPS_OPSAM (1U<<2)
132#define IBS_CAPS_RDWROPCNT (1U<<3)
133#define IBS_CAPS_OPCNT (1U<<4)
134#define IBS_CAPS_BRNTRGT (1U<<5)
135#define IBS_CAPS_OPCNTEXT (1U<<6)
136
137#define IBS_CAPS_DEFAULT (IBS_CAPS_AVAIL \
138 | IBS_CAPS_FETCHSAM \
139 | IBS_CAPS_OPSAM)
140
141/*
142 * IBS APIC setup
143 */
144#define IBSCTL 0x1cc
145#define IBSCTL_LVT_OFFSET_VALID (1ULL<<8)
146#define IBSCTL_LVT_OFFSET_MASK 0x0F
147
113/* IbsFetchCtl bits/masks */ 148/* IbsFetchCtl bits/masks */
114#define IBS_FETCH_RAND_EN (1ULL<<57) 149#define IBS_FETCH_RAND_EN (1ULL<<57)
115#define IBS_FETCH_VAL (1ULL<<49) 150#define IBS_FETCH_VAL (1ULL<<49)
@@ -124,6 +159,8 @@ union cpuid10_edx {
124#define IBS_OP_MAX_CNT 0x0000FFFFULL 159#define IBS_OP_MAX_CNT 0x0000FFFFULL
125#define IBS_OP_MAX_CNT_EXT 0x007FFFFFULL /* not a register bit mask */ 160#define IBS_OP_MAX_CNT_EXT 0x007FFFFFULL /* not a register bit mask */
126 161
162extern u32 get_ibs_caps(void);
163
127#ifdef CONFIG_PERF_EVENTS 164#ifdef CONFIG_PERF_EVENTS
128extern void perf_events_lapic_init(void); 165extern void perf_events_lapic_init(void);
129 166
@@ -159,7 +196,19 @@ extern unsigned long perf_misc_flags(struct pt_regs *regs);
159 ); \ 196 ); \
160} 197}
161 198
199struct perf_guest_switch_msr {
200 unsigned msr;
201 u64 host, guest;
202};
203
204extern struct perf_guest_switch_msr *perf_guest_get_msrs(int *nr);
162#else 205#else
206static inline perf_guest_switch_msr *perf_guest_get_msrs(int *nr)
207{
208 *nr = 0;
209 return NULL;
210}
211
163static inline void perf_events_lapic_init(void) { } 212static inline void perf_events_lapic_init(void) { }
164#endif 213#endif
165 214
diff --git a/arch/x86/include/asm/reboot.h b/arch/x86/include/asm/reboot.h
index 3250e3d605d..92f297069e8 100644
--- a/arch/x86/include/asm/reboot.h
+++ b/arch/x86/include/asm/reboot.h
@@ -23,7 +23,7 @@ void machine_real_restart(unsigned int type);
23#define MRR_BIOS 0 23#define MRR_BIOS 0
24#define MRR_APM 1 24#define MRR_APM 1
25 25
26typedef void (*nmi_shootdown_cb)(int, struct die_args*); 26typedef void (*nmi_shootdown_cb)(int, struct pt_regs*);
27void nmi_shootdown_cpus(nmi_shootdown_cb callback); 27void nmi_shootdown_cpus(nmi_shootdown_cb callback);
28 28
29#endif /* _ASM_X86_REBOOT_H */ 29#endif /* _ASM_X86_REBOOT_H */
diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h
index 7ff4669580c..c34f96c2f7a 100644
--- a/arch/x86/include/asm/xen/page.h
+++ b/arch/x86/include/asm/xen/page.h
@@ -12,6 +12,7 @@
12#include <asm/pgtable.h> 12#include <asm/pgtable.h>
13 13
14#include <xen/interface/xen.h> 14#include <xen/interface/xen.h>
15#include <xen/grant_table.h>
15#include <xen/features.h> 16#include <xen/features.h>
16 17
17/* Xen machine address */ 18/* Xen machine address */
@@ -48,14 +49,11 @@ extern unsigned long set_phys_range_identity(unsigned long pfn_s,
48 unsigned long pfn_e); 49 unsigned long pfn_e);
49 50
50extern int m2p_add_override(unsigned long mfn, struct page *page, 51extern int m2p_add_override(unsigned long mfn, struct page *page,
51 bool clear_pte); 52 struct gnttab_map_grant_ref *kmap_op);
52extern int m2p_remove_override(struct page *page, bool clear_pte); 53extern int m2p_remove_override(struct page *page, bool clear_pte);
53extern struct page *m2p_find_override(unsigned long mfn); 54extern struct page *m2p_find_override(unsigned long mfn);
54extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn); 55extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn);
55 56
56#ifdef CONFIG_XEN_DEBUG_FS
57extern int p2m_dump_show(struct seq_file *m, void *v);
58#endif
59static inline unsigned long pfn_to_mfn(unsigned long pfn) 57static inline unsigned long pfn_to_mfn(unsigned long pfn)
60{ 58{
61 unsigned long mfn; 59 unsigned long mfn;
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 82f2912155a..8baca3c4871 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -19,7 +19,7 @@ endif
19 19
20obj-y := process_$(BITS).o signal.o entry_$(BITS).o 20obj-y := process_$(BITS).o signal.o entry_$(BITS).o
21obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o 21obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o
22obj-y += time.o ioport.o ldt.o dumpstack.o 22obj-y += time.o ioport.o ldt.o dumpstack.o nmi.o
23obj-y += setup.o x86_init.o i8259.o irqinit.o jump_label.o 23obj-y += setup.o x86_init.o i8259.o irqinit.o jump_label.o
24obj-$(CONFIG_IRQ_WORK) += irq_work.o 24obj-$(CONFIG_IRQ_WORK) += irq_work.o
25obj-y += probe_roms.o 25obj-y += probe_roms.o
diff --git a/arch/x86/kernel/amd_gart_64.c b/arch/x86/kernel/amd_gart_64.c
index 8a439d364b9..b1e7c7f7a0a 100644
--- a/arch/x86/kernel/amd_gart_64.c
+++ b/arch/x86/kernel/amd_gart_64.c
@@ -5,7 +5,7 @@
5 * This allows to use PCI devices that only support 32bit addresses on systems 5 * This allows to use PCI devices that only support 32bit addresses on systems
6 * with more than 4GB. 6 * with more than 4GB.
7 * 7 *
8 * See Documentation/PCI/PCI-DMA-mapping.txt for the interface specification. 8 * See Documentation/DMA-API-HOWTO.txt for the interface specification.
9 * 9 *
10 * Copyright 2002 Andi Kleen, SuSE Labs. 10 * Copyright 2002 Andi Kleen, SuSE Labs.
11 * Subject to the GNU General Public License v2 only. 11 * Subject to the GNU General Public License v2 only.
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 52fa56399a5..a2fd72e0ab3 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1437,27 +1437,21 @@ void enable_x2apic(void)
1437 1437
1438int __init enable_IR(void) 1438int __init enable_IR(void)
1439{ 1439{
1440#ifdef CONFIG_INTR_REMAP 1440#ifdef CONFIG_IRQ_REMAP
1441 if (!intr_remapping_supported()) { 1441 if (!intr_remapping_supported()) {
1442 pr_debug("intr-remapping not supported\n"); 1442 pr_debug("intr-remapping not supported\n");
1443 return 0; 1443 return -1;
1444 } 1444 }
1445 1445
1446 if (!x2apic_preenabled && skip_ioapic_setup) { 1446 if (!x2apic_preenabled && skip_ioapic_setup) {
1447 pr_info("Skipped enabling intr-remap because of skipping " 1447 pr_info("Skipped enabling intr-remap because of skipping "
1448 "io-apic setup\n"); 1448 "io-apic setup\n");
1449 return 0; 1449 return -1;
1450 } 1450 }
1451 1451
1452 if (enable_intr_remapping(x2apic_supported())) 1452 return enable_intr_remapping();
1453 return 0;
1454
1455 pr_info("Enabled Interrupt-remapping\n");
1456
1457 return 1;
1458
1459#endif 1453#endif
1460 return 0; 1454 return -1;
1461} 1455}
1462 1456
1463void __init enable_IR_x2apic(void) 1457void __init enable_IR_x2apic(void)
@@ -1481,11 +1475,11 @@ void __init enable_IR_x2apic(void)
1481 mask_ioapic_entries(); 1475 mask_ioapic_entries();
1482 1476
1483 if (dmar_table_init_ret) 1477 if (dmar_table_init_ret)
1484 ret = 0; 1478 ret = -1;
1485 else 1479 else
1486 ret = enable_IR(); 1480 ret = enable_IR();
1487 1481
1488 if (!ret) { 1482 if (ret < 0) {
1489 /* IR is required if there is APIC ID > 255 even when running 1483 /* IR is required if there is APIC ID > 255 even when running
1490 * under KVM 1484 * under KVM
1491 */ 1485 */
@@ -1499,6 +1493,9 @@ void __init enable_IR_x2apic(void)
1499 x2apic_force_phys(); 1493 x2apic_force_phys();
1500 } 1494 }
1501 1495
1496 if (ret == IRQ_REMAP_XAPIC_MODE)
1497 goto nox2apic;
1498
1502 x2apic_enabled = 1; 1499 x2apic_enabled = 1;
1503 1500
1504 if (x2apic_supported() && !x2apic_mode) { 1501 if (x2apic_supported() && !x2apic_mode) {
@@ -1508,19 +1505,21 @@ void __init enable_IR_x2apic(void)
1508 } 1505 }
1509 1506
1510nox2apic: 1507nox2apic:
1511 if (!ret) /* IR enabling failed */ 1508 if (ret < 0) /* IR enabling failed */
1512 restore_ioapic_entries(); 1509 restore_ioapic_entries();
1513 legacy_pic->restore_mask(); 1510 legacy_pic->restore_mask();
1514 local_irq_restore(flags); 1511 local_irq_restore(flags);
1515 1512
1516out: 1513out:
1517 if (x2apic_enabled) 1514 if (x2apic_enabled || !x2apic_supported())
1518 return; 1515 return;
1519 1516
1520 if (x2apic_preenabled) 1517 if (x2apic_preenabled)
1521 panic("x2apic: enabled by BIOS but kernel init failed."); 1518 panic("x2apic: enabled by BIOS but kernel init failed.");
1522 else if (cpu_has_x2apic) 1519 else if (ret == IRQ_REMAP_XAPIC_MODE)
1523 pr_info("Not enabling x2apic, Intr-remapping init failed.\n"); 1520 pr_info("x2apic not enabled, IRQ remapping is in xapic mode\n");
1521 else if (ret < 0)
1522 pr_info("x2apic not enabled, IRQ remapping init failed\n");
1524} 1523}
1525 1524
1526#ifdef CONFIG_X86_64 1525#ifdef CONFIG_X86_64
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
index d5e57db0f7b..31cb9ae992b 100644
--- a/arch/x86/kernel/apic/hw_nmi.c
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -60,22 +60,10 @@ void arch_trigger_all_cpu_backtrace(void)
60} 60}
61 61
62static int __kprobes 62static int __kprobes
63arch_trigger_all_cpu_backtrace_handler(struct notifier_block *self, 63arch_trigger_all_cpu_backtrace_handler(unsigned int cmd, struct pt_regs *regs)
64 unsigned long cmd, void *__args)
65{ 64{
66 struct die_args *args = __args;
67 struct pt_regs *regs;
68 int cpu; 65 int cpu;
69 66
70 switch (cmd) {
71 case DIE_NMI:
72 break;
73
74 default:
75 return NOTIFY_DONE;
76 }
77
78 regs = args->regs;
79 cpu = smp_processor_id(); 67 cpu = smp_processor_id();
80 68
81 if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) { 69 if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
@@ -86,21 +74,16 @@ arch_trigger_all_cpu_backtrace_handler(struct notifier_block *self,
86 show_regs(regs); 74 show_regs(regs);
87 arch_spin_unlock(&lock); 75 arch_spin_unlock(&lock);
88 cpumask_clear_cpu(cpu, to_cpumask(backtrace_mask)); 76 cpumask_clear_cpu(cpu, to_cpumask(backtrace_mask));
89 return NOTIFY_STOP; 77 return NMI_HANDLED;
90 } 78 }
91 79
92 return NOTIFY_DONE; 80 return NMI_DONE;
93} 81}
94 82
95static __read_mostly struct notifier_block backtrace_notifier = {
96 .notifier_call = arch_trigger_all_cpu_backtrace_handler,
97 .next = NULL,
98 .priority = NMI_LOCAL_LOW_PRIOR,
99};
100
101static int __init register_trigger_all_cpu_backtrace(void) 83static int __init register_trigger_all_cpu_backtrace(void)
102{ 84{
103 register_die_notifier(&backtrace_notifier); 85 register_nmi_handler(NMI_LOCAL, arch_trigger_all_cpu_backtrace_handler,
86 0, "arch_bt");
104 return 0; 87 return 0;
105} 88}
106early_initcall(register_trigger_all_cpu_backtrace); 89early_initcall(register_trigger_all_cpu_backtrace);
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 8eb863e27ea..229e19f3eb5 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -394,13 +394,21 @@ union entry_union {
394 struct IO_APIC_route_entry entry; 394 struct IO_APIC_route_entry entry;
395}; 395};
396 396
397static struct IO_APIC_route_entry __ioapic_read_entry(int apic, int pin)
398{
399 union entry_union eu;
400
401 eu.w1 = io_apic_read(apic, 0x10 + 2 * pin);
402 eu.w2 = io_apic_read(apic, 0x11 + 2 * pin);
403 return eu.entry;
404}
405
397static struct IO_APIC_route_entry ioapic_read_entry(int apic, int pin) 406static struct IO_APIC_route_entry ioapic_read_entry(int apic, int pin)
398{ 407{
399 union entry_union eu; 408 union entry_union eu;
400 unsigned long flags; 409 unsigned long flags;
401 raw_spin_lock_irqsave(&ioapic_lock, flags); 410 raw_spin_lock_irqsave(&ioapic_lock, flags);
402 eu.w1 = io_apic_read(apic, 0x10 + 2 * pin); 411 eu.entry = __ioapic_read_entry(apic, pin);
403 eu.w2 = io_apic_read(apic, 0x11 + 2 * pin);
404 raw_spin_unlock_irqrestore(&ioapic_lock, flags); 412 raw_spin_unlock_irqrestore(&ioapic_lock, flags);
405 return eu.entry; 413 return eu.entry;
406} 414}
@@ -529,18 +537,6 @@ static void io_apic_modify_irq(struct irq_cfg *cfg,
529 __io_apic_modify_irq(entry, mask_and, mask_or, final); 537 __io_apic_modify_irq(entry, mask_and, mask_or, final);
530} 538}
531 539
532static void __mask_and_edge_IO_APIC_irq(struct irq_pin_list *entry)
533{
534 __io_apic_modify_irq(entry, ~IO_APIC_REDIR_LEVEL_TRIGGER,
535 IO_APIC_REDIR_MASKED, NULL);
536}
537
538static void __unmask_and_level_IO_APIC_irq(struct irq_pin_list *entry)
539{
540 __io_apic_modify_irq(entry, ~IO_APIC_REDIR_MASKED,
541 IO_APIC_REDIR_LEVEL_TRIGGER, NULL);
542}
543
544static void io_apic_sync(struct irq_pin_list *entry) 540static void io_apic_sync(struct irq_pin_list *entry)
545{ 541{
546 /* 542 /*
@@ -585,6 +581,66 @@ static void unmask_ioapic_irq(struct irq_data *data)
585 unmask_ioapic(data->chip_data); 581 unmask_ioapic(data->chip_data);
586} 582}
587 583
584/*
585 * IO-APIC versions below 0x20 don't support EOI register.
586 * For the record, here is the information about various versions:
587 * 0Xh 82489DX
588 * 1Xh I/OAPIC or I/O(x)APIC which are not PCI 2.2 Compliant
589 * 2Xh I/O(x)APIC which is PCI 2.2 Compliant
590 * 30h-FFh Reserved
591 *
592 * Some of the Intel ICH Specs (ICH2 to ICH5) documents the io-apic
593 * version as 0x2. This is an error with documentation and these ICH chips
594 * use io-apic's of version 0x20.
595 *
596 * For IO-APIC's with EOI register, we use that to do an explicit EOI.
597 * Otherwise, we simulate the EOI message manually by changing the trigger
598 * mode to edge and then back to level, with RTE being masked during this.
599 */
600static void __eoi_ioapic_pin(int apic, int pin, int vector, struct irq_cfg *cfg)
601{
602 if (mpc_ioapic_ver(apic) >= 0x20) {
603 /*
604 * Intr-remapping uses pin number as the virtual vector
605 * in the RTE. Actual vector is programmed in
606 * intr-remapping table entry. Hence for the io-apic
607 * EOI we use the pin number.
608 */
609 if (cfg && irq_remapped(cfg))
610 io_apic_eoi(apic, pin);
611 else
612 io_apic_eoi(apic, vector);
613 } else {
614 struct IO_APIC_route_entry entry, entry1;
615
616 entry = entry1 = __ioapic_read_entry(apic, pin);
617
618 /*
619 * Mask the entry and change the trigger mode to edge.
620 */
621 entry1.mask = 1;
622 entry1.trigger = IOAPIC_EDGE;
623
624 __ioapic_write_entry(apic, pin, entry1);
625
626 /*
627 * Restore the previous level triggered entry.
628 */
629 __ioapic_write_entry(apic, pin, entry);
630 }
631}
632
633static void eoi_ioapic_irq(unsigned int irq, struct irq_cfg *cfg)
634{
635 struct irq_pin_list *entry;
636 unsigned long flags;
637
638 raw_spin_lock_irqsave(&ioapic_lock, flags);
639 for_each_irq_pin(entry, cfg->irq_2_pin)
640 __eoi_ioapic_pin(entry->apic, entry->pin, cfg->vector, cfg);
641 raw_spin_unlock_irqrestore(&ioapic_lock, flags);
642}
643
588static void clear_IO_APIC_pin(unsigned int apic, unsigned int pin) 644static void clear_IO_APIC_pin(unsigned int apic, unsigned int pin)
589{ 645{
590 struct IO_APIC_route_entry entry; 646 struct IO_APIC_route_entry entry;
@@ -593,10 +649,44 @@ static void clear_IO_APIC_pin(unsigned int apic, unsigned int pin)
593 entry = ioapic_read_entry(apic, pin); 649 entry = ioapic_read_entry(apic, pin);
594 if (entry.delivery_mode == dest_SMI) 650 if (entry.delivery_mode == dest_SMI)
595 return; 651 return;
652
653 /*
654 * Make sure the entry is masked and re-read the contents to check
655 * if it is a level triggered pin and if the remote-IRR is set.
656 */
657 if (!entry.mask) {
658 entry.mask = 1;
659 ioapic_write_entry(apic, pin, entry);
660 entry = ioapic_read_entry(apic, pin);
661 }
662
663 if (entry.irr) {
664 unsigned long flags;
665
666 /*
667 * Make sure the trigger mode is set to level. Explicit EOI
668 * doesn't clear the remote-IRR if the trigger mode is not
669 * set to level.
670 */
671 if (!entry.trigger) {
672 entry.trigger = IOAPIC_LEVEL;
673 ioapic_write_entry(apic, pin, entry);
674 }
675
676 raw_spin_lock_irqsave(&ioapic_lock, flags);
677 __eoi_ioapic_pin(apic, pin, entry.vector, NULL);
678 raw_spin_unlock_irqrestore(&ioapic_lock, flags);
679 }
680
596 /* 681 /*
597 * Disable it in the IO-APIC irq-routing table: 682 * Clear the rest of the bits in the IO-APIC RTE except for the mask
683 * bit.
598 */ 684 */
599 ioapic_mask_entry(apic, pin); 685 ioapic_mask_entry(apic, pin);
686 entry = ioapic_read_entry(apic, pin);
687 if (entry.irr)
688 printk(KERN_ERR "Unable to reset IRR for apic: %d, pin :%d\n",
689 mpc_ioapic_id(apic), pin);
600} 690}
601 691
602static void clear_IO_APIC (void) 692static void clear_IO_APIC (void)
@@ -1202,7 +1292,6 @@ void __setup_vector_irq(int cpu)
1202} 1292}
1203 1293
1204static struct irq_chip ioapic_chip; 1294static struct irq_chip ioapic_chip;
1205static struct irq_chip ir_ioapic_chip;
1206 1295
1207#ifdef CONFIG_X86_32 1296#ifdef CONFIG_X86_32
1208static inline int IO_APIC_irq_trigger(int irq) 1297static inline int IO_APIC_irq_trigger(int irq)
@@ -1246,7 +1335,7 @@ static void ioapic_register_intr(unsigned int irq, struct irq_cfg *cfg,
1246 1335
1247 if (irq_remapped(cfg)) { 1336 if (irq_remapped(cfg)) {
1248 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); 1337 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
1249 chip = &ir_ioapic_chip; 1338 irq_remap_modify_chip_defaults(chip);
1250 fasteoi = trigger != 0; 1339 fasteoi = trigger != 0;
1251 } 1340 }
1252 1341
@@ -2255,7 +2344,7 @@ ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
2255 return ret; 2344 return ret;
2256} 2345}
2257 2346
2258#ifdef CONFIG_INTR_REMAP 2347#ifdef CONFIG_IRQ_REMAP
2259 2348
2260/* 2349/*
2261 * Migrate the IO-APIC irq in the presence of intr-remapping. 2350 * Migrate the IO-APIC irq in the presence of intr-remapping.
@@ -2267,6 +2356,9 @@ ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
2267 * updated vector information), by using a virtual vector (io-apic pin number). 2356 * updated vector information), by using a virtual vector (io-apic pin number).
2268 * Real vector that is used for interrupting cpu will be coming from 2357 * Real vector that is used for interrupting cpu will be coming from
2269 * the interrupt-remapping table entry. 2358 * the interrupt-remapping table entry.
2359 *
2360 * As the migration is a simple atomic update of IRTE, the same mechanism
2361 * is used to migrate MSI irq's in the presence of interrupt-remapping.
2270 */ 2362 */
2271static int 2363static int
2272ir_ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask, 2364ir_ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
@@ -2291,10 +2383,16 @@ ir_ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
2291 irte.dest_id = IRTE_DEST(dest); 2383 irte.dest_id = IRTE_DEST(dest);
2292 2384
2293 /* 2385 /*
2294 * Modified the IRTE and flushes the Interrupt entry cache. 2386 * Atomically updates the IRTE with the new destination, vector
2387 * and flushes the interrupt entry cache.
2295 */ 2388 */
2296 modify_irte(irq, &irte); 2389 modify_irte(irq, &irte);
2297 2390
2391 /*
2392 * After this point, all the interrupts will start arriving
2393 * at the new destination. So, time to cleanup the previous
2394 * vector allocation.
2395 */
2298 if (cfg->move_in_progress) 2396 if (cfg->move_in_progress)
2299 send_cleanup_vector(cfg); 2397 send_cleanup_vector(cfg);
2300 2398
@@ -2407,48 +2505,6 @@ static void ack_apic_edge(struct irq_data *data)
2407 2505
2408atomic_t irq_mis_count; 2506atomic_t irq_mis_count;
2409 2507
2410/*
2411 * IO-APIC versions below 0x20 don't support EOI register.
2412 * For the record, here is the information about various versions:
2413 * 0Xh 82489DX
2414 * 1Xh I/OAPIC or I/O(x)APIC which are not PCI 2.2 Compliant
2415 * 2Xh I/O(x)APIC which is PCI 2.2 Compliant
2416 * 30h-FFh Reserved
2417 *
2418 * Some of the Intel ICH Specs (ICH2 to ICH5) documents the io-apic
2419 * version as 0x2. This is an error with documentation and these ICH chips
2420 * use io-apic's of version 0x20.
2421 *
2422 * For IO-APIC's with EOI register, we use that to do an explicit EOI.
2423 * Otherwise, we simulate the EOI message manually by changing the trigger
2424 * mode to edge and then back to level, with RTE being masked during this.
2425*/
2426static void eoi_ioapic_irq(unsigned int irq, struct irq_cfg *cfg)
2427{
2428 struct irq_pin_list *entry;
2429 unsigned long flags;
2430
2431 raw_spin_lock_irqsave(&ioapic_lock, flags);
2432 for_each_irq_pin(entry, cfg->irq_2_pin) {
2433 if (mpc_ioapic_ver(entry->apic) >= 0x20) {
2434 /*
2435 * Intr-remapping uses pin number as the virtual vector
2436 * in the RTE. Actual vector is programmed in
2437 * intr-remapping table entry. Hence for the io-apic
2438 * EOI we use the pin number.
2439 */
2440 if (irq_remapped(cfg))
2441 io_apic_eoi(entry->apic, entry->pin);
2442 else
2443 io_apic_eoi(entry->apic, cfg->vector);
2444 } else {
2445 __mask_and_edge_IO_APIC_irq(entry);
2446 __unmask_and_level_IO_APIC_irq(entry);
2447 }
2448 }
2449 raw_spin_unlock_irqrestore(&ioapic_lock, flags);
2450}
2451
2452static void ack_apic_level(struct irq_data *data) 2508static void ack_apic_level(struct irq_data *data)
2453{ 2509{
2454 struct irq_cfg *cfg = data->chip_data; 2510 struct irq_cfg *cfg = data->chip_data;
@@ -2552,7 +2608,7 @@ static void ack_apic_level(struct irq_data *data)
2552 } 2608 }
2553} 2609}
2554 2610
2555#ifdef CONFIG_INTR_REMAP 2611#ifdef CONFIG_IRQ_REMAP
2556static void ir_ack_apic_edge(struct irq_data *data) 2612static void ir_ack_apic_edge(struct irq_data *data)
2557{ 2613{
2558 ack_APIC_irq(); 2614 ack_APIC_irq();
@@ -2563,7 +2619,23 @@ static void ir_ack_apic_level(struct irq_data *data)
2563 ack_APIC_irq(); 2619 ack_APIC_irq();
2564 eoi_ioapic_irq(data->irq, data->chip_data); 2620 eoi_ioapic_irq(data->irq, data->chip_data);
2565} 2621}
2566#endif /* CONFIG_INTR_REMAP */ 2622
2623static void ir_print_prefix(struct irq_data *data, struct seq_file *p)
2624{
2625 seq_printf(p, " IR-%s", data->chip->name);
2626}
2627
2628static void irq_remap_modify_chip_defaults(struct irq_chip *chip)
2629{
2630 chip->irq_print_chip = ir_print_prefix;
2631 chip->irq_ack = ir_ack_apic_edge;
2632 chip->irq_eoi = ir_ack_apic_level;
2633
2634#ifdef CONFIG_SMP
2635 chip->irq_set_affinity = ir_ioapic_set_affinity;
2636#endif
2637}
2638#endif /* CONFIG_IRQ_REMAP */
2567 2639
2568static struct irq_chip ioapic_chip __read_mostly = { 2640static struct irq_chip ioapic_chip __read_mostly = {
2569 .name = "IO-APIC", 2641 .name = "IO-APIC",
@@ -2578,21 +2650,6 @@ static struct irq_chip ioapic_chip __read_mostly = {
2578 .irq_retrigger = ioapic_retrigger_irq, 2650 .irq_retrigger = ioapic_retrigger_irq,
2579}; 2651};
2580 2652
2581static struct irq_chip ir_ioapic_chip __read_mostly = {
2582 .name = "IR-IO-APIC",
2583 .irq_startup = startup_ioapic_irq,
2584 .irq_mask = mask_ioapic_irq,
2585 .irq_unmask = unmask_ioapic_irq,
2586#ifdef CONFIG_INTR_REMAP
2587 .irq_ack = ir_ack_apic_edge,
2588 .irq_eoi = ir_ack_apic_level,
2589#ifdef CONFIG_SMP
2590 .irq_set_affinity = ir_ioapic_set_affinity,
2591#endif
2592#endif
2593 .irq_retrigger = ioapic_retrigger_irq,
2594};
2595
2596static inline void init_IO_APIC_traps(void) 2653static inline void init_IO_APIC_traps(void)
2597{ 2654{
2598 struct irq_cfg *cfg; 2655 struct irq_cfg *cfg;
@@ -3144,45 +3201,6 @@ msi_set_affinity(struct irq_data *data, const struct cpumask *mask, bool force)
3144 3201
3145 return 0; 3202 return 0;
3146} 3203}
3147#ifdef CONFIG_INTR_REMAP
3148/*
3149 * Migrate the MSI irq to another cpumask. This migration is
3150 * done in the process context using interrupt-remapping hardware.
3151 */
3152static int
3153ir_msi_set_affinity(struct irq_data *data, const struct cpumask *mask,
3154 bool force)
3155{
3156 struct irq_cfg *cfg = data->chip_data;
3157 unsigned int dest, irq = data->irq;
3158 struct irte irte;
3159
3160 if (get_irte(irq, &irte))
3161 return -1;
3162
3163 if (__ioapic_set_affinity(data, mask, &dest))
3164 return -1;
3165
3166 irte.vector = cfg->vector;
3167 irte.dest_id = IRTE_DEST(dest);
3168
3169 /*
3170 * atomically update the IRTE with the new destination and vector.
3171 */
3172 modify_irte(irq, &irte);
3173
3174 /*
3175 * After this point, all the interrupts will start arriving
3176 * at the new destination. So, time to cleanup the previous
3177 * vector allocation.
3178 */
3179 if (cfg->move_in_progress)
3180 send_cleanup_vector(cfg);
3181
3182 return 0;
3183}
3184
3185#endif
3186#endif /* CONFIG_SMP */ 3204#endif /* CONFIG_SMP */
3187 3205
3188/* 3206/*
@@ -3200,19 +3218,6 @@ static struct irq_chip msi_chip = {
3200 .irq_retrigger = ioapic_retrigger_irq, 3218 .irq_retrigger = ioapic_retrigger_irq,
3201}; 3219};
3202 3220
3203static struct irq_chip msi_ir_chip = {
3204 .name = "IR-PCI-MSI",
3205 .irq_unmask = unmask_msi_irq,
3206 .irq_mask = mask_msi_irq,
3207#ifdef CONFIG_INTR_REMAP
3208 .irq_ack = ir_ack_apic_edge,
3209#ifdef CONFIG_SMP
3210 .irq_set_affinity = ir_msi_set_affinity,
3211#endif
3212#endif
3213 .irq_retrigger = ioapic_retrigger_irq,
3214};
3215
3216/* 3221/*
3217 * Map the PCI dev to the corresponding remapping hardware unit 3222 * Map the PCI dev to the corresponding remapping hardware unit
3218 * and allocate 'nvec' consecutive interrupt-remapping table entries 3223 * and allocate 'nvec' consecutive interrupt-remapping table entries
@@ -3255,7 +3260,7 @@ static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int irq)
3255 3260
3256 if (irq_remapped(irq_get_chip_data(irq))) { 3261 if (irq_remapped(irq_get_chip_data(irq))) {
3257 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); 3262 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
3258 chip = &msi_ir_chip; 3263 irq_remap_modify_chip_defaults(chip);
3259 } 3264 }
3260 3265
3261 irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge"); 3266 irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge");
@@ -3328,7 +3333,7 @@ void native_teardown_msi_irq(unsigned int irq)
3328 destroy_irq(irq); 3333 destroy_irq(irq);
3329} 3334}
3330 3335
3331#if defined (CONFIG_DMAR) || defined (CONFIG_INTR_REMAP) 3336#ifdef CONFIG_DMAR_TABLE
3332#ifdef CONFIG_SMP 3337#ifdef CONFIG_SMP
3333static int 3338static int
3334dmar_msi_set_affinity(struct irq_data *data, const struct cpumask *mask, 3339dmar_msi_set_affinity(struct irq_data *data, const struct cpumask *mask,
@@ -3409,19 +3414,6 @@ static int hpet_msi_set_affinity(struct irq_data *data,
3409 3414
3410#endif /* CONFIG_SMP */ 3415#endif /* CONFIG_SMP */
3411 3416
3412static struct irq_chip ir_hpet_msi_type = {
3413 .name = "IR-HPET_MSI",
3414 .irq_unmask = hpet_msi_unmask,
3415 .irq_mask = hpet_msi_mask,
3416#ifdef CONFIG_INTR_REMAP
3417 .irq_ack = ir_ack_apic_edge,
3418#ifdef CONFIG_SMP
3419 .irq_set_affinity = ir_msi_set_affinity,
3420#endif
3421#endif
3422 .irq_retrigger = ioapic_retrigger_irq,
3423};
3424
3425static struct irq_chip hpet_msi_type = { 3417static struct irq_chip hpet_msi_type = {
3426 .name = "HPET_MSI", 3418 .name = "HPET_MSI",
3427 .irq_unmask = hpet_msi_unmask, 3419 .irq_unmask = hpet_msi_unmask,
@@ -3458,7 +3450,7 @@ int arch_setup_hpet_msi(unsigned int irq, unsigned int id)
3458 hpet_msi_write(irq_get_handler_data(irq), &msg); 3450 hpet_msi_write(irq_get_handler_data(irq), &msg);
3459 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); 3451 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
3460 if (irq_remapped(irq_get_chip_data(irq))) 3452 if (irq_remapped(irq_get_chip_data(irq)))
3461 chip = &ir_hpet_msi_type; 3453 irq_remap_modify_chip_defaults(chip);
3462 3454
3463 irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge"); 3455 irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge");
3464 return 0; 3456 return 0;
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 34b18594e72..75be00ecfff 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -672,18 +672,11 @@ void __cpuinit uv_cpu_init(void)
672/* 672/*
673 * When NMI is received, print a stack trace. 673 * When NMI is received, print a stack trace.
674 */ 674 */
675int uv_handle_nmi(struct notifier_block *self, unsigned long reason, void *data) 675int uv_handle_nmi(unsigned int reason, struct pt_regs *regs)
676{ 676{
677 unsigned long real_uv_nmi; 677 unsigned long real_uv_nmi;
678 int bid; 678 int bid;
679 679
680 if (reason != DIE_NMIUNKNOWN)
681 return NOTIFY_OK;
682
683 if (in_crash_kexec)
684 /* do nothing if entering the crash kernel */
685 return NOTIFY_OK;
686
687 /* 680 /*
688 * Each blade has an MMR that indicates when an NMI has been sent 681 * Each blade has an MMR that indicates when an NMI has been sent
689 * to cpus on the blade. If an NMI is detected, atomically 682 * to cpus on the blade. If an NMI is detected, atomically
@@ -704,7 +697,7 @@ int uv_handle_nmi(struct notifier_block *self, unsigned long reason, void *data)
704 } 697 }
705 698
706 if (likely(__get_cpu_var(cpu_last_nmi_count) == uv_blade_info[bid].nmi_count)) 699 if (likely(__get_cpu_var(cpu_last_nmi_count) == uv_blade_info[bid].nmi_count))
707 return NOTIFY_DONE; 700 return NMI_DONE;
708 701
709 __get_cpu_var(cpu_last_nmi_count) = uv_blade_info[bid].nmi_count; 702 __get_cpu_var(cpu_last_nmi_count) = uv_blade_info[bid].nmi_count;
710 703
@@ -717,17 +710,12 @@ int uv_handle_nmi(struct notifier_block *self, unsigned long reason, void *data)
717 dump_stack(); 710 dump_stack();
718 spin_unlock(&uv_nmi_lock); 711 spin_unlock(&uv_nmi_lock);
719 712
720 return NOTIFY_STOP; 713 return NMI_HANDLED;
721} 714}
722 715
723static struct notifier_block uv_dump_stack_nmi_nb = {
724 .notifier_call = uv_handle_nmi,
725 .priority = NMI_LOCAL_LOW_PRIOR - 1,
726};
727
728void uv_register_nmi_notifier(void) 716void uv_register_nmi_notifier(void)
729{ 717{
730 if (register_die_notifier(&uv_dump_stack_nmi_nb)) 718 if (register_nmi_handler(NMI_UNKNOWN, uv_handle_nmi, 0, "uv"))
731 printk(KERN_WARNING "UV NMI handler failed to register\n"); 719 printk(KERN_WARNING "UV NMI handler failed to register\n");
732} 720}
733 721
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 0371c484bb8..a46bd383953 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -249,8 +249,6 @@ extern int (*console_blank_hook)(int);
249#define APM_MINOR_DEV 134 249#define APM_MINOR_DEV 134
250 250
251/* 251/*
252 * See Documentation/Config.help for the configuration options.
253 *
254 * Various options can be changed at boot time as follows: 252 * Various options can be changed at boot time as follows:
255 * (We allow underscores for compatibility with the modules code) 253 * (We allow underscores for compatibility with the modules code)
256 * apm=on/off enable/disable APM 254 * apm=on/off enable/disable APM
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
index 6042981d030..fe6eb197f84 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -28,10 +28,15 @@ obj-$(CONFIG_CPU_SUP_UMC_32) += umc.o
28 28
29obj-$(CONFIG_PERF_EVENTS) += perf_event.o 29obj-$(CONFIG_PERF_EVENTS) += perf_event.o
30 30
31ifdef CONFIG_PERF_EVENTS
32obj-$(CONFIG_CPU_SUP_AMD) += perf_event_amd.o
33obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_p6.o perf_event_p4.o perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o
34endif
35
31obj-$(CONFIG_X86_MCE) += mcheck/ 36obj-$(CONFIG_X86_MCE) += mcheck/
32obj-$(CONFIG_MTRR) += mtrr/ 37obj-$(CONFIG_MTRR) += mtrr/
33 38
34obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o 39obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o perf_event_amd_ibs.o
35 40
36quiet_cmd_mkcapflags = MKCAP $@ 41quiet_cmd_mkcapflags = MKCAP $@
37 cmd_mkcapflags = $(PERL) $(srctree)/$(src)/mkcapflags.pl $< $@ 42 cmd_mkcapflags = $(PERL) $(srctree)/$(src)/mkcapflags.pl $< $@
diff --git a/arch/x86/kernel/cpu/mcheck/mce-inject.c b/arch/x86/kernel/cpu/mcheck/mce-inject.c
index 0ed633c5048..6199232161c 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-inject.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c
@@ -78,27 +78,20 @@ static void raise_exception(struct mce *m, struct pt_regs *pregs)
78 78
79static cpumask_var_t mce_inject_cpumask; 79static cpumask_var_t mce_inject_cpumask;
80 80
81static int mce_raise_notify(struct notifier_block *self, 81static int mce_raise_notify(unsigned int cmd, struct pt_regs *regs)
82 unsigned long val, void *data)
83{ 82{
84 struct die_args *args = (struct die_args *)data;
85 int cpu = smp_processor_id(); 83 int cpu = smp_processor_id();
86 struct mce *m = &__get_cpu_var(injectm); 84 struct mce *m = &__get_cpu_var(injectm);
87 if (val != DIE_NMI || !cpumask_test_cpu(cpu, mce_inject_cpumask)) 85 if (!cpumask_test_cpu(cpu, mce_inject_cpumask))
88 return NOTIFY_DONE; 86 return NMI_DONE;
89 cpumask_clear_cpu(cpu, mce_inject_cpumask); 87 cpumask_clear_cpu(cpu, mce_inject_cpumask);
90 if (m->inject_flags & MCJ_EXCEPTION) 88 if (m->inject_flags & MCJ_EXCEPTION)
91 raise_exception(m, args->regs); 89 raise_exception(m, regs);
92 else if (m->status) 90 else if (m->status)
93 raise_poll(m); 91 raise_poll(m);
94 return NOTIFY_STOP; 92 return NMI_HANDLED;
95} 93}
96 94
97static struct notifier_block mce_raise_nb = {
98 .notifier_call = mce_raise_notify,
99 .priority = NMI_LOCAL_NORMAL_PRIOR,
100};
101
102/* Inject mce on current CPU */ 95/* Inject mce on current CPU */
103static int raise_local(void) 96static int raise_local(void)
104{ 97{
@@ -216,7 +209,8 @@ static int inject_init(void)
216 return -ENOMEM; 209 return -ENOMEM;
217 printk(KERN_INFO "Machine check injector initialized\n"); 210 printk(KERN_INFO "Machine check injector initialized\n");
218 mce_chrdev_ops.write = mce_write; 211 mce_chrdev_ops.write = mce_write;
219 register_die_notifier(&mce_raise_nb); 212 register_nmi_handler(NMI_LOCAL, mce_raise_notify, 0,
213 "mce_notify");
220 return 0; 214 return 0;
221} 215}
222 216
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 08363b04212..fce51ad1f36 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -908,9 +908,6 @@ void do_machine_check(struct pt_regs *regs, long error_code)
908 908
909 percpu_inc(mce_exception_count); 909 percpu_inc(mce_exception_count);
910 910
911 if (notify_die(DIE_NMI, "machine check", regs, error_code,
912 18, SIGKILL) == NOTIFY_STOP)
913 goto out;
914 if (!banks) 911 if (!banks)
915 goto out; 912 goto out;
916 913
@@ -1140,6 +1137,15 @@ static void mce_start_timer(unsigned long data)
1140 add_timer_on(t, smp_processor_id()); 1137 add_timer_on(t, smp_processor_id());
1141} 1138}
1142 1139
1140/* Must not be called in IRQ context where del_timer_sync() can deadlock */
1141static void mce_timer_delete_all(void)
1142{
1143 int cpu;
1144
1145 for_each_online_cpu(cpu)
1146 del_timer_sync(&per_cpu(mce_timer, cpu));
1147}
1148
1143static void mce_do_trigger(struct work_struct *work) 1149static void mce_do_trigger(struct work_struct *work)
1144{ 1150{
1145 call_usermodehelper(mce_helper, mce_helper_argv, NULL, UMH_NO_WAIT); 1151 call_usermodehelper(mce_helper, mce_helper_argv, NULL, UMH_NO_WAIT);
@@ -1750,7 +1756,6 @@ static struct syscore_ops mce_syscore_ops = {
1750 1756
1751static void mce_cpu_restart(void *data) 1757static void mce_cpu_restart(void *data)
1752{ 1758{
1753 del_timer_sync(&__get_cpu_var(mce_timer));
1754 if (!mce_available(__this_cpu_ptr(&cpu_info))) 1759 if (!mce_available(__this_cpu_ptr(&cpu_info)))
1755 return; 1760 return;
1756 __mcheck_cpu_init_generic(); 1761 __mcheck_cpu_init_generic();
@@ -1760,16 +1765,15 @@ static void mce_cpu_restart(void *data)
1760/* Reinit MCEs after user configuration changes */ 1765/* Reinit MCEs after user configuration changes */
1761static void mce_restart(void) 1766static void mce_restart(void)
1762{ 1767{
1768 mce_timer_delete_all();
1763 on_each_cpu(mce_cpu_restart, NULL, 1); 1769 on_each_cpu(mce_cpu_restart, NULL, 1);
1764} 1770}
1765 1771
1766/* Toggle features for corrected errors */ 1772/* Toggle features for corrected errors */
1767static void mce_disable_ce(void *all) 1773static void mce_disable_cmci(void *data)
1768{ 1774{
1769 if (!mce_available(__this_cpu_ptr(&cpu_info))) 1775 if (!mce_available(__this_cpu_ptr(&cpu_info)))
1770 return; 1776 return;
1771 if (all)
1772 del_timer_sync(&__get_cpu_var(mce_timer));
1773 cmci_clear(); 1777 cmci_clear();
1774} 1778}
1775 1779
@@ -1852,7 +1856,8 @@ static ssize_t set_ignore_ce(struct sys_device *s,
1852 if (mce_ignore_ce ^ !!new) { 1856 if (mce_ignore_ce ^ !!new) {
1853 if (new) { 1857 if (new) {
1854 /* disable ce features */ 1858 /* disable ce features */
1855 on_each_cpu(mce_disable_ce, (void *)1, 1); 1859 mce_timer_delete_all();
1860 on_each_cpu(mce_disable_cmci, NULL, 1);
1856 mce_ignore_ce = 1; 1861 mce_ignore_ce = 1;
1857 } else { 1862 } else {
1858 /* enable ce features */ 1863 /* enable ce features */
@@ -1875,7 +1880,7 @@ static ssize_t set_cmci_disabled(struct sys_device *s,
1875 if (mce_cmci_disabled ^ !!new) { 1880 if (mce_cmci_disabled ^ !!new) {
1876 if (new) { 1881 if (new) {
1877 /* disable cmci */ 1882 /* disable cmci */
1878 on_each_cpu(mce_disable_ce, NULL, 1); 1883 on_each_cpu(mce_disable_cmci, NULL, 1);
1879 mce_cmci_disabled = 1; 1884 mce_cmci_disabled = 1;
1880 } else { 1885 } else {
1881 /* enable cmci */ 1886 /* enable cmci */
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel.c b/arch/x86/kernel/cpu/mcheck/mce_intel.c
index 8694ef56459..38e49bc95ff 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_intel.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_intel.c
@@ -28,7 +28,7 @@ static DEFINE_PER_CPU(mce_banks_t, mce_banks_owned);
28 * cmci_discover_lock protects against parallel discovery attempts 28 * cmci_discover_lock protects against parallel discovery attempts
29 * which could race against each other. 29 * which could race against each other.
30 */ 30 */
31static DEFINE_SPINLOCK(cmci_discover_lock); 31static DEFINE_RAW_SPINLOCK(cmci_discover_lock);
32 32
33#define CMCI_THRESHOLD 1 33#define CMCI_THRESHOLD 1
34 34
@@ -85,7 +85,7 @@ static void cmci_discover(int banks, int boot)
85 int hdr = 0; 85 int hdr = 0;
86 int i; 86 int i;
87 87
88 spin_lock_irqsave(&cmci_discover_lock, flags); 88 raw_spin_lock_irqsave(&cmci_discover_lock, flags);
89 for (i = 0; i < banks; i++) { 89 for (i = 0; i < banks; i++) {
90 u64 val; 90 u64 val;
91 91
@@ -116,7 +116,7 @@ static void cmci_discover(int banks, int boot)
116 WARN_ON(!test_bit(i, __get_cpu_var(mce_poll_banks))); 116 WARN_ON(!test_bit(i, __get_cpu_var(mce_poll_banks)));
117 } 117 }
118 } 118 }
119 spin_unlock_irqrestore(&cmci_discover_lock, flags); 119 raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
120 if (hdr) 120 if (hdr)
121 printk(KERN_CONT "\n"); 121 printk(KERN_CONT "\n");
122} 122}
@@ -150,7 +150,7 @@ void cmci_clear(void)
150 150
151 if (!cmci_supported(&banks)) 151 if (!cmci_supported(&banks))
152 return; 152 return;
153 spin_lock_irqsave(&cmci_discover_lock, flags); 153 raw_spin_lock_irqsave(&cmci_discover_lock, flags);
154 for (i = 0; i < banks; i++) { 154 for (i = 0; i < banks; i++) {
155 if (!test_bit(i, __get_cpu_var(mce_banks_owned))) 155 if (!test_bit(i, __get_cpu_var(mce_banks_owned)))
156 continue; 156 continue;
@@ -160,7 +160,7 @@ void cmci_clear(void)
160 wrmsrl(MSR_IA32_MCx_CTL2(i), val); 160 wrmsrl(MSR_IA32_MCx_CTL2(i), val);
161 __clear_bit(i, __get_cpu_var(mce_banks_owned)); 161 __clear_bit(i, __get_cpu_var(mce_banks_owned));
162 } 162 }
163 spin_unlock_irqrestore(&cmci_discover_lock, flags); 163 raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
164} 164}
165 165
166/* 166/*
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index cfa62ec090e..640891014b2 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -32,6 +32,8 @@
32#include <asm/smp.h> 32#include <asm/smp.h>
33#include <asm/alternative.h> 33#include <asm/alternative.h>
34 34
35#include "perf_event.h"
36
35#if 0 37#if 0
36#undef wrmsrl 38#undef wrmsrl
37#define wrmsrl(msr, val) \ 39#define wrmsrl(msr, val) \
@@ -43,283 +45,17 @@ do { \
43} while (0) 45} while (0)
44#endif 46#endif
45 47
46/* 48struct x86_pmu x86_pmu __read_mostly;
47 * | NHM/WSM | SNB |
48 * register -------------------------------
49 * | HT | no HT | HT | no HT |
50 *-----------------------------------------
51 * offcore | core | core | cpu | core |
52 * lbr_sel | core | core | cpu | core |
53 * ld_lat | cpu | core | cpu | core |
54 *-----------------------------------------
55 *
56 * Given that there is a small number of shared regs,
57 * we can pre-allocate their slot in the per-cpu
58 * per-core reg tables.
59 */
60enum extra_reg_type {
61 EXTRA_REG_NONE = -1, /* not used */
62
63 EXTRA_REG_RSP_0 = 0, /* offcore_response_0 */
64 EXTRA_REG_RSP_1 = 1, /* offcore_response_1 */
65
66 EXTRA_REG_MAX /* number of entries needed */
67};
68
69struct event_constraint {
70 union {
71 unsigned long idxmsk[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
72 u64 idxmsk64;
73 };
74 u64 code;
75 u64 cmask;
76 int weight;
77};
78
79struct amd_nb {
80 int nb_id; /* NorthBridge id */
81 int refcnt; /* reference count */
82 struct perf_event *owners[X86_PMC_IDX_MAX];
83 struct event_constraint event_constraints[X86_PMC_IDX_MAX];
84};
85
86struct intel_percore;
87
88#define MAX_LBR_ENTRIES 16
89
90struct cpu_hw_events {
91 /*
92 * Generic x86 PMC bits
93 */
94 struct perf_event *events[X86_PMC_IDX_MAX]; /* in counter order */
95 unsigned long active_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
96 unsigned long running[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
97 int enabled;
98
99 int n_events;
100 int n_added;
101 int n_txn;
102 int assign[X86_PMC_IDX_MAX]; /* event to counter assignment */
103 u64 tags[X86_PMC_IDX_MAX];
104 struct perf_event *event_list[X86_PMC_IDX_MAX]; /* in enabled order */
105
106 unsigned int group_flag;
107
108 /*
109 * Intel DebugStore bits
110 */
111 struct debug_store *ds;
112 u64 pebs_enabled;
113
114 /*
115 * Intel LBR bits
116 */
117 int lbr_users;
118 void *lbr_context;
119 struct perf_branch_stack lbr_stack;
120 struct perf_branch_entry lbr_entries[MAX_LBR_ENTRIES];
121
122 /*
123 * manage shared (per-core, per-cpu) registers
124 * used on Intel NHM/WSM/SNB
125 */
126 struct intel_shared_regs *shared_regs;
127
128 /*
129 * AMD specific bits
130 */
131 struct amd_nb *amd_nb;
132};
133
134#define __EVENT_CONSTRAINT(c, n, m, w) {\
135 { .idxmsk64 = (n) }, \
136 .code = (c), \
137 .cmask = (m), \
138 .weight = (w), \
139}
140
141#define EVENT_CONSTRAINT(c, n, m) \
142 __EVENT_CONSTRAINT(c, n, m, HWEIGHT(n))
143
144/*
145 * Constraint on the Event code.
146 */
147#define INTEL_EVENT_CONSTRAINT(c, n) \
148 EVENT_CONSTRAINT(c, n, ARCH_PERFMON_EVENTSEL_EVENT)
149
150/*
151 * Constraint on the Event code + UMask + fixed-mask
152 *
153 * filter mask to validate fixed counter events.
154 * the following filters disqualify for fixed counters:
155 * - inv
156 * - edge
157 * - cnt-mask
158 * The other filters are supported by fixed counters.
159 * The any-thread option is supported starting with v3.
160 */
161#define FIXED_EVENT_CONSTRAINT(c, n) \
162 EVENT_CONSTRAINT(c, (1ULL << (32+n)), X86_RAW_EVENT_MASK)
163
164/*
165 * Constraint on the Event code + UMask
166 */
167#define INTEL_UEVENT_CONSTRAINT(c, n) \
168 EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK)
169
170#define EVENT_CONSTRAINT_END \
171 EVENT_CONSTRAINT(0, 0, 0)
172
173#define for_each_event_constraint(e, c) \
174 for ((e) = (c); (e)->weight; (e)++)
175
176/*
177 * Per register state.
178 */
179struct er_account {
180 raw_spinlock_t lock; /* per-core: protect structure */
181 u64 config; /* extra MSR config */
182 u64 reg; /* extra MSR number */
183 atomic_t ref; /* reference count */
184};
185
186/*
187 * Extra registers for specific events.
188 *
189 * Some events need large masks and require external MSRs.
190 * Those extra MSRs end up being shared for all events on
191 * a PMU and sometimes between PMU of sibling HT threads.
192 * In either case, the kernel needs to handle conflicting
193 * accesses to those extra, shared, regs. The data structure
194 * to manage those registers is stored in cpu_hw_event.
195 */
196struct extra_reg {
197 unsigned int event;
198 unsigned int msr;
199 u64 config_mask;
200 u64 valid_mask;
201 int idx; /* per_xxx->regs[] reg index */
202};
203
204#define EVENT_EXTRA_REG(e, ms, m, vm, i) { \
205 .event = (e), \
206 .msr = (ms), \
207 .config_mask = (m), \
208 .valid_mask = (vm), \
209 .idx = EXTRA_REG_##i \
210 }
211
212#define INTEL_EVENT_EXTRA_REG(event, msr, vm, idx) \
213 EVENT_EXTRA_REG(event, msr, ARCH_PERFMON_EVENTSEL_EVENT, vm, idx)
214
215#define EVENT_EXTRA_END EVENT_EXTRA_REG(0, 0, 0, 0, RSP_0)
216
217union perf_capabilities {
218 struct {
219 u64 lbr_format : 6;
220 u64 pebs_trap : 1;
221 u64 pebs_arch_reg : 1;
222 u64 pebs_format : 4;
223 u64 smm_freeze : 1;
224 };
225 u64 capabilities;
226};
227
228/*
229 * struct x86_pmu - generic x86 pmu
230 */
231struct x86_pmu {
232 /*
233 * Generic x86 PMC bits
234 */
235 const char *name;
236 int version;
237 int (*handle_irq)(struct pt_regs *);
238 void (*disable_all)(void);
239 void (*enable_all)(int added);
240 void (*enable)(struct perf_event *);
241 void (*disable)(struct perf_event *);
242 int (*hw_config)(struct perf_event *event);
243 int (*schedule_events)(struct cpu_hw_events *cpuc, int n, int *assign);
244 unsigned eventsel;
245 unsigned perfctr;
246 u64 (*event_map)(int);
247 int max_events;
248 int num_counters;
249 int num_counters_fixed;
250 int cntval_bits;
251 u64 cntval_mask;
252 int apic;
253 u64 max_period;
254 struct event_constraint *
255 (*get_event_constraints)(struct cpu_hw_events *cpuc,
256 struct perf_event *event);
257
258 void (*put_event_constraints)(struct cpu_hw_events *cpuc,
259 struct perf_event *event);
260 struct event_constraint *event_constraints;
261 void (*quirks)(void);
262 int perfctr_second_write;
263
264 int (*cpu_prepare)(int cpu);
265 void (*cpu_starting)(int cpu);
266 void (*cpu_dying)(int cpu);
267 void (*cpu_dead)(int cpu);
268
269 /*
270 * Intel Arch Perfmon v2+
271 */
272 u64 intel_ctrl;
273 union perf_capabilities intel_cap;
274 49
275 /* 50DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = {
276 * Intel DebugStore bits
277 */
278 int bts, pebs;
279 int bts_active, pebs_active;
280 int pebs_record_size;
281 void (*drain_pebs)(struct pt_regs *regs);
282 struct event_constraint *pebs_constraints;
283
284 /*
285 * Intel LBR
286 */
287 unsigned long lbr_tos, lbr_from, lbr_to; /* MSR base regs */
288 int lbr_nr; /* hardware stack size */
289
290 /*
291 * Extra registers for events
292 */
293 struct extra_reg *extra_regs;
294 unsigned int er_flags;
295};
296
297#define ERF_NO_HT_SHARING 1
298#define ERF_HAS_RSP_1 2
299
300static struct x86_pmu x86_pmu __read_mostly;
301
302static DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = {
303 .enabled = 1, 51 .enabled = 1,
304}; 52};
305 53
306static int x86_perf_event_set_period(struct perf_event *event); 54u64 __read_mostly hw_cache_event_ids
307
308/*
309 * Generalized hw caching related hw_event table, filled
310 * in on a per model basis. A value of 0 means
311 * 'not supported', -1 means 'hw_event makes no sense on
312 * this CPU', any other value means the raw hw_event
313 * ID.
314 */
315
316#define C(x) PERF_COUNT_HW_CACHE_##x
317
318static u64 __read_mostly hw_cache_event_ids
319 [PERF_COUNT_HW_CACHE_MAX] 55 [PERF_COUNT_HW_CACHE_MAX]
320 [PERF_COUNT_HW_CACHE_OP_MAX] 56 [PERF_COUNT_HW_CACHE_OP_MAX]
321 [PERF_COUNT_HW_CACHE_RESULT_MAX]; 57 [PERF_COUNT_HW_CACHE_RESULT_MAX];
322static u64 __read_mostly hw_cache_extra_regs 58u64 __read_mostly hw_cache_extra_regs
323 [PERF_COUNT_HW_CACHE_MAX] 59 [PERF_COUNT_HW_CACHE_MAX]
324 [PERF_COUNT_HW_CACHE_OP_MAX] 60 [PERF_COUNT_HW_CACHE_OP_MAX]
325 [PERF_COUNT_HW_CACHE_RESULT_MAX]; 61 [PERF_COUNT_HW_CACHE_RESULT_MAX];
@@ -329,8 +65,7 @@ static u64 __read_mostly hw_cache_extra_regs
329 * Can only be executed on the CPU where the event is active. 65 * Can only be executed on the CPU where the event is active.
330 * Returns the delta events processed. 66 * Returns the delta events processed.
331 */ 67 */
332static u64 68u64 x86_perf_event_update(struct perf_event *event)
333x86_perf_event_update(struct perf_event *event)
334{ 69{
335 struct hw_perf_event *hwc = &event->hw; 70 struct hw_perf_event *hwc = &event->hw;
336 int shift = 64 - x86_pmu.cntval_bits; 71 int shift = 64 - x86_pmu.cntval_bits;
@@ -373,30 +108,6 @@ again:
373 return new_raw_count; 108 return new_raw_count;
374} 109}
375 110
376static inline int x86_pmu_addr_offset(int index)
377{
378 int offset;
379
380 /* offset = X86_FEATURE_PERFCTR_CORE ? index << 1 : index */
381 alternative_io(ASM_NOP2,
382 "shll $1, %%eax",
383 X86_FEATURE_PERFCTR_CORE,
384 "=a" (offset),
385 "a" (index));
386
387 return offset;
388}
389
390static inline unsigned int x86_pmu_config_addr(int index)
391{
392 return x86_pmu.eventsel + x86_pmu_addr_offset(index);
393}
394
395static inline unsigned int x86_pmu_event_addr(int index)
396{
397 return x86_pmu.perfctr + x86_pmu_addr_offset(index);
398}
399
400/* 111/*
401 * Find and validate any extra registers to set up. 112 * Find and validate any extra registers to set up.
402 */ 113 */
@@ -532,9 +243,6 @@ msr_fail:
532 return false; 243 return false;
533} 244}
534 245
535static void reserve_ds_buffers(void);
536static void release_ds_buffers(void);
537
538static void hw_perf_event_destroy(struct perf_event *event) 246static void hw_perf_event_destroy(struct perf_event *event)
539{ 247{
540 if (atomic_dec_and_mutex_lock(&active_events, &pmc_reserve_mutex)) { 248 if (atomic_dec_and_mutex_lock(&active_events, &pmc_reserve_mutex)) {
@@ -583,7 +291,7 @@ set_ext_hw_attr(struct hw_perf_event *hwc, struct perf_event *event)
583 return x86_pmu_extra_regs(val, event); 291 return x86_pmu_extra_regs(val, event);
584} 292}
585 293
586static int x86_setup_perfctr(struct perf_event *event) 294int x86_setup_perfctr(struct perf_event *event)
587{ 295{
588 struct perf_event_attr *attr = &event->attr; 296 struct perf_event_attr *attr = &event->attr;
589 struct hw_perf_event *hwc = &event->hw; 297 struct hw_perf_event *hwc = &event->hw;
@@ -647,7 +355,7 @@ static int x86_setup_perfctr(struct perf_event *event)
647 return 0; 355 return 0;
648} 356}
649 357
650static int x86_pmu_hw_config(struct perf_event *event) 358int x86_pmu_hw_config(struct perf_event *event)
651{ 359{
652 if (event->attr.precise_ip) { 360 if (event->attr.precise_ip) {
653 int precise = 0; 361 int precise = 0;
@@ -723,7 +431,7 @@ static int __x86_pmu_event_init(struct perf_event *event)
723 return x86_pmu.hw_config(event); 431 return x86_pmu.hw_config(event);
724} 432}
725 433
726static void x86_pmu_disable_all(void) 434void x86_pmu_disable_all(void)
727{ 435{
728 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 436 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
729 int idx; 437 int idx;
@@ -758,15 +466,7 @@ static void x86_pmu_disable(struct pmu *pmu)
758 x86_pmu.disable_all(); 466 x86_pmu.disable_all();
759} 467}
760 468
761static inline void __x86_pmu_enable_event(struct hw_perf_event *hwc, 469void x86_pmu_enable_all(int added)
762 u64 enable_mask)
763{
764 if (hwc->extra_reg.reg)
765 wrmsrl(hwc->extra_reg.reg, hwc->extra_reg.config);
766 wrmsrl(hwc->config_base, hwc->config | enable_mask);
767}
768
769static void x86_pmu_enable_all(int added)
770{ 470{
771 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 471 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
772 int idx; 472 int idx;
@@ -788,7 +488,7 @@ static inline int is_x86_event(struct perf_event *event)
788 return event->pmu == &pmu; 488 return event->pmu == &pmu;
789} 489}
790 490
791static int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign) 491int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign)
792{ 492{
793 struct event_constraint *c, *constraints[X86_PMC_IDX_MAX]; 493 struct event_constraint *c, *constraints[X86_PMC_IDX_MAX];
794 unsigned long used_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)]; 494 unsigned long used_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
@@ -959,7 +659,6 @@ static inline int match_prev_assignment(struct hw_perf_event *hwc,
959} 659}
960 660
961static void x86_pmu_start(struct perf_event *event, int flags); 661static void x86_pmu_start(struct perf_event *event, int flags);
962static void x86_pmu_stop(struct perf_event *event, int flags);
963 662
964static void x86_pmu_enable(struct pmu *pmu) 663static void x86_pmu_enable(struct pmu *pmu)
965{ 664{
@@ -1031,21 +730,13 @@ static void x86_pmu_enable(struct pmu *pmu)
1031 x86_pmu.enable_all(added); 730 x86_pmu.enable_all(added);
1032} 731}
1033 732
1034static inline void x86_pmu_disable_event(struct perf_event *event)
1035{
1036 struct hw_perf_event *hwc = &event->hw;
1037
1038 wrmsrl(hwc->config_base, hwc->config);
1039}
1040
1041static DEFINE_PER_CPU(u64 [X86_PMC_IDX_MAX], pmc_prev_left); 733static DEFINE_PER_CPU(u64 [X86_PMC_IDX_MAX], pmc_prev_left);
1042 734
1043/* 735/*
1044 * Set the next IRQ period, based on the hwc->period_left value. 736 * Set the next IRQ period, based on the hwc->period_left value.
1045 * To be called with the event disabled in hw: 737 * To be called with the event disabled in hw:
1046 */ 738 */
1047static int 739int x86_perf_event_set_period(struct perf_event *event)
1048x86_perf_event_set_period(struct perf_event *event)
1049{ 740{
1050 struct hw_perf_event *hwc = &event->hw; 741 struct hw_perf_event *hwc = &event->hw;
1051 s64 left = local64_read(&hwc->period_left); 742 s64 left = local64_read(&hwc->period_left);
@@ -1105,7 +796,7 @@ x86_perf_event_set_period(struct perf_event *event)
1105 return ret; 796 return ret;
1106} 797}
1107 798
1108static void x86_pmu_enable_event(struct perf_event *event) 799void x86_pmu_enable_event(struct perf_event *event)
1109{ 800{
1110 if (__this_cpu_read(cpu_hw_events.enabled)) 801 if (__this_cpu_read(cpu_hw_events.enabled))
1111 __x86_pmu_enable_event(&event->hw, 802 __x86_pmu_enable_event(&event->hw,
@@ -1244,7 +935,7 @@ void perf_event_print_debug(void)
1244 local_irq_restore(flags); 935 local_irq_restore(flags);
1245} 936}
1246 937
1247static void x86_pmu_stop(struct perf_event *event, int flags) 938void x86_pmu_stop(struct perf_event *event, int flags)
1248{ 939{
1249 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 940 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1250 struct hw_perf_event *hwc = &event->hw; 941 struct hw_perf_event *hwc = &event->hw;
@@ -1297,7 +988,7 @@ static void x86_pmu_del(struct perf_event *event, int flags)
1297 perf_event_update_userpage(event); 988 perf_event_update_userpage(event);
1298} 989}
1299 990
1300static int x86_pmu_handle_irq(struct pt_regs *regs) 991int x86_pmu_handle_irq(struct pt_regs *regs)
1301{ 992{
1302 struct perf_sample_data data; 993 struct perf_sample_data data;
1303 struct cpu_hw_events *cpuc; 994 struct cpu_hw_events *cpuc;
@@ -1367,109 +1058,28 @@ void perf_events_lapic_init(void)
1367 apic_write(APIC_LVTPC, APIC_DM_NMI); 1058 apic_write(APIC_LVTPC, APIC_DM_NMI);
1368} 1059}
1369 1060
1370struct pmu_nmi_state {
1371 unsigned int marked;
1372 int handled;
1373};
1374
1375static DEFINE_PER_CPU(struct pmu_nmi_state, pmu_nmi);
1376
1377static int __kprobes 1061static int __kprobes
1378perf_event_nmi_handler(struct notifier_block *self, 1062perf_event_nmi_handler(unsigned int cmd, struct pt_regs *regs)
1379 unsigned long cmd, void *__args)
1380{ 1063{
1381 struct die_args *args = __args;
1382 unsigned int this_nmi;
1383 int handled;
1384
1385 if (!atomic_read(&active_events)) 1064 if (!atomic_read(&active_events))
1386 return NOTIFY_DONE; 1065 return NMI_DONE;
1387
1388 switch (cmd) {
1389 case DIE_NMI:
1390 break;
1391 case DIE_NMIUNKNOWN:
1392 this_nmi = percpu_read(irq_stat.__nmi_count);
1393 if (this_nmi != __this_cpu_read(pmu_nmi.marked))
1394 /* let the kernel handle the unknown nmi */
1395 return NOTIFY_DONE;
1396 /*
1397 * This one is a PMU back-to-back nmi. Two events
1398 * trigger 'simultaneously' raising two back-to-back
1399 * NMIs. If the first NMI handles both, the latter
1400 * will be empty and daze the CPU. So, we drop it to
1401 * avoid false-positive 'unknown nmi' messages.
1402 */
1403 return NOTIFY_STOP;
1404 default:
1405 return NOTIFY_DONE;
1406 }
1407
1408 handled = x86_pmu.handle_irq(args->regs);
1409 if (!handled)
1410 return NOTIFY_DONE;
1411
1412 this_nmi = percpu_read(irq_stat.__nmi_count);
1413 if ((handled > 1) ||
1414 /* the next nmi could be a back-to-back nmi */
1415 ((__this_cpu_read(pmu_nmi.marked) == this_nmi) &&
1416 (__this_cpu_read(pmu_nmi.handled) > 1))) {
1417 /*
1418 * We could have two subsequent back-to-back nmis: The
1419 * first handles more than one counter, the 2nd
1420 * handles only one counter and the 3rd handles no
1421 * counter.
1422 *
1423 * This is the 2nd nmi because the previous was
1424 * handling more than one counter. We will mark the
1425 * next (3rd) and then drop it if unhandled.
1426 */
1427 __this_cpu_write(pmu_nmi.marked, this_nmi + 1);
1428 __this_cpu_write(pmu_nmi.handled, handled);
1429 }
1430 1066
1431 return NOTIFY_STOP; 1067 return x86_pmu.handle_irq(regs);
1432} 1068}
1433 1069
1434static __read_mostly struct notifier_block perf_event_nmi_notifier = { 1070struct event_constraint emptyconstraint;
1435 .notifier_call = perf_event_nmi_handler, 1071struct event_constraint unconstrained;
1436 .next = NULL,
1437 .priority = NMI_LOCAL_LOW_PRIOR,
1438};
1439
1440static struct event_constraint unconstrained;
1441static struct event_constraint emptyconstraint;
1442
1443static struct event_constraint *
1444x86_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
1445{
1446 struct event_constraint *c;
1447
1448 if (x86_pmu.event_constraints) {
1449 for_each_event_constraint(c, x86_pmu.event_constraints) {
1450 if ((event->hw.config & c->cmask) == c->code)
1451 return c;
1452 }
1453 }
1454
1455 return &unconstrained;
1456}
1457
1458#include "perf_event_amd.c"
1459#include "perf_event_p6.c"
1460#include "perf_event_p4.c"
1461#include "perf_event_intel_lbr.c"
1462#include "perf_event_intel_ds.c"
1463#include "perf_event_intel.c"
1464 1072
1465static int __cpuinit 1073static int __cpuinit
1466x86_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu) 1074x86_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
1467{ 1075{
1468 unsigned int cpu = (long)hcpu; 1076 unsigned int cpu = (long)hcpu;
1077 struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu);
1469 int ret = NOTIFY_OK; 1078 int ret = NOTIFY_OK;
1470 1079
1471 switch (action & ~CPU_TASKS_FROZEN) { 1080 switch (action & ~CPU_TASKS_FROZEN) {
1472 case CPU_UP_PREPARE: 1081 case CPU_UP_PREPARE:
1082 cpuc->kfree_on_online = NULL;
1473 if (x86_pmu.cpu_prepare) 1083 if (x86_pmu.cpu_prepare)
1474 ret = x86_pmu.cpu_prepare(cpu); 1084 ret = x86_pmu.cpu_prepare(cpu);
1475 break; 1085 break;
@@ -1479,6 +1089,10 @@ x86_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
1479 x86_pmu.cpu_starting(cpu); 1089 x86_pmu.cpu_starting(cpu);
1480 break; 1090 break;
1481 1091
1092 case CPU_ONLINE:
1093 kfree(cpuc->kfree_on_online);
1094 break;
1095
1482 case CPU_DYING: 1096 case CPU_DYING:
1483 if (x86_pmu.cpu_dying) 1097 if (x86_pmu.cpu_dying)
1484 x86_pmu.cpu_dying(cpu); 1098 x86_pmu.cpu_dying(cpu);
@@ -1557,7 +1171,7 @@ static int __init init_hw_perf_events(void)
1557 ((1LL << x86_pmu.num_counters_fixed)-1) << X86_PMC_IDX_FIXED; 1171 ((1LL << x86_pmu.num_counters_fixed)-1) << X86_PMC_IDX_FIXED;
1558 1172
1559 perf_events_lapic_init(); 1173 perf_events_lapic_init();
1560 register_die_notifier(&perf_event_nmi_notifier); 1174 register_nmi_handler(NMI_LOCAL, perf_event_nmi_handler, 0, "PMI");
1561 1175
1562 unconstrained = (struct event_constraint) 1176 unconstrained = (struct event_constraint)
1563 __EVENT_CONSTRAINT(0, (1ULL << x86_pmu.num_counters) - 1, 1177 __EVENT_CONSTRAINT(0, (1ULL << x86_pmu.num_counters) - 1,
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h
new file mode 100644
index 00000000000..b9698d40ac4
--- /dev/null
+++ b/arch/x86/kernel/cpu/perf_event.h
@@ -0,0 +1,505 @@
1/*
2 * Performance events x86 architecture header
3 *
4 * Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de>
5 * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar
6 * Copyright (C) 2009 Jaswinder Singh Rajput
7 * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter
8 * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
9 * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com>
10 * Copyright (C) 2009 Google, Inc., Stephane Eranian
11 *
12 * For licencing details see kernel-base/COPYING
13 */
14
15#include <linux/perf_event.h>
16
17/*
18 * | NHM/WSM | SNB |
19 * register -------------------------------
20 * | HT | no HT | HT | no HT |
21 *-----------------------------------------
22 * offcore | core | core | cpu | core |
23 * lbr_sel | core | core | cpu | core |
24 * ld_lat | cpu | core | cpu | core |
25 *-----------------------------------------
26 *
27 * Given that there is a small number of shared regs,
28 * we can pre-allocate their slot in the per-cpu
29 * per-core reg tables.
30 */
31enum extra_reg_type {
32 EXTRA_REG_NONE = -1, /* not used */
33
34 EXTRA_REG_RSP_0 = 0, /* offcore_response_0 */
35 EXTRA_REG_RSP_1 = 1, /* offcore_response_1 */
36
37 EXTRA_REG_MAX /* number of entries needed */
38};
39
40struct event_constraint {
41 union {
42 unsigned long idxmsk[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
43 u64 idxmsk64;
44 };
45 u64 code;
46 u64 cmask;
47 int weight;
48};
49
50struct amd_nb {
51 int nb_id; /* NorthBridge id */
52 int refcnt; /* reference count */
53 struct perf_event *owners[X86_PMC_IDX_MAX];
54 struct event_constraint event_constraints[X86_PMC_IDX_MAX];
55};
56
57/* The maximal number of PEBS events: */
58#define MAX_PEBS_EVENTS 4
59
60/*
61 * A debug store configuration.
62 *
63 * We only support architectures that use 64bit fields.
64 */
65struct debug_store {
66 u64 bts_buffer_base;
67 u64 bts_index;
68 u64 bts_absolute_maximum;
69 u64 bts_interrupt_threshold;
70 u64 pebs_buffer_base;
71 u64 pebs_index;
72 u64 pebs_absolute_maximum;
73 u64 pebs_interrupt_threshold;
74 u64 pebs_event_reset[MAX_PEBS_EVENTS];
75};
76
77/*
78 * Per register state.
79 */
80struct er_account {
81 raw_spinlock_t lock; /* per-core: protect structure */
82 u64 config; /* extra MSR config */
83 u64 reg; /* extra MSR number */
84 atomic_t ref; /* reference count */
85};
86
87/*
88 * Per core/cpu state
89 *
90 * Used to coordinate shared registers between HT threads or
91 * among events on a single PMU.
92 */
93struct intel_shared_regs {
94 struct er_account regs[EXTRA_REG_MAX];
95 int refcnt; /* per-core: #HT threads */
96 unsigned core_id; /* per-core: core id */
97};
98
99#define MAX_LBR_ENTRIES 16
100
101struct cpu_hw_events {
102 /*
103 * Generic x86 PMC bits
104 */
105 struct perf_event *events[X86_PMC_IDX_MAX]; /* in counter order */
106 unsigned long active_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
107 unsigned long running[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
108 int enabled;
109
110 int n_events;
111 int n_added;
112 int n_txn;
113 int assign[X86_PMC_IDX_MAX]; /* event to counter assignment */
114 u64 tags[X86_PMC_IDX_MAX];
115 struct perf_event *event_list[X86_PMC_IDX_MAX]; /* in enabled order */
116
117 unsigned int group_flag;
118
119 /*
120 * Intel DebugStore bits
121 */
122 struct debug_store *ds;
123 u64 pebs_enabled;
124
125 /*
126 * Intel LBR bits
127 */
128 int lbr_users;
129 void *lbr_context;
130 struct perf_branch_stack lbr_stack;
131 struct perf_branch_entry lbr_entries[MAX_LBR_ENTRIES];
132
133 /*
134 * Intel host/guest exclude bits
135 */
136 u64 intel_ctrl_guest_mask;
137 u64 intel_ctrl_host_mask;
138 struct perf_guest_switch_msr guest_switch_msrs[X86_PMC_IDX_MAX];
139
140 /*
141 * manage shared (per-core, per-cpu) registers
142 * used on Intel NHM/WSM/SNB
143 */
144 struct intel_shared_regs *shared_regs;
145
146 /*
147 * AMD specific bits
148 */
149 struct amd_nb *amd_nb;
150
151 void *kfree_on_online;
152};
153
154#define __EVENT_CONSTRAINT(c, n, m, w) {\
155 { .idxmsk64 = (n) }, \
156 .code = (c), \
157 .cmask = (m), \
158 .weight = (w), \
159}
160
161#define EVENT_CONSTRAINT(c, n, m) \
162 __EVENT_CONSTRAINT(c, n, m, HWEIGHT(n))
163
164/*
165 * Constraint on the Event code.
166 */
167#define INTEL_EVENT_CONSTRAINT(c, n) \
168 EVENT_CONSTRAINT(c, n, ARCH_PERFMON_EVENTSEL_EVENT)
169
170/*
171 * Constraint on the Event code + UMask + fixed-mask
172 *
173 * filter mask to validate fixed counter events.
174 * the following filters disqualify for fixed counters:
175 * - inv
176 * - edge
177 * - cnt-mask
178 * The other filters are supported by fixed counters.
179 * The any-thread option is supported starting with v3.
180 */
181#define FIXED_EVENT_CONSTRAINT(c, n) \
182 EVENT_CONSTRAINT(c, (1ULL << (32+n)), X86_RAW_EVENT_MASK)
183
184/*
185 * Constraint on the Event code + UMask
186 */
187#define INTEL_UEVENT_CONSTRAINT(c, n) \
188 EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK)
189
190#define EVENT_CONSTRAINT_END \
191 EVENT_CONSTRAINT(0, 0, 0)
192
193#define for_each_event_constraint(e, c) \
194 for ((e) = (c); (e)->weight; (e)++)
195
196/*
197 * Extra registers for specific events.
198 *
199 * Some events need large masks and require external MSRs.
200 * Those extra MSRs end up being shared for all events on
201 * a PMU and sometimes between PMU of sibling HT threads.
202 * In either case, the kernel needs to handle conflicting
203 * accesses to those extra, shared, regs. The data structure
204 * to manage those registers is stored in cpu_hw_event.
205 */
206struct extra_reg {
207 unsigned int event;
208 unsigned int msr;
209 u64 config_mask;
210 u64 valid_mask;
211 int idx; /* per_xxx->regs[] reg index */
212};
213
214#define EVENT_EXTRA_REG(e, ms, m, vm, i) { \
215 .event = (e), \
216 .msr = (ms), \
217 .config_mask = (m), \
218 .valid_mask = (vm), \
219 .idx = EXTRA_REG_##i \
220 }
221
222#define INTEL_EVENT_EXTRA_REG(event, msr, vm, idx) \
223 EVENT_EXTRA_REG(event, msr, ARCH_PERFMON_EVENTSEL_EVENT, vm, idx)
224
225#define EVENT_EXTRA_END EVENT_EXTRA_REG(0, 0, 0, 0, RSP_0)
226
227union perf_capabilities {
228 struct {
229 u64 lbr_format:6;
230 u64 pebs_trap:1;
231 u64 pebs_arch_reg:1;
232 u64 pebs_format:4;
233 u64 smm_freeze:1;
234 };
235 u64 capabilities;
236};
237
238/*
239 * struct x86_pmu - generic x86 pmu
240 */
241struct x86_pmu {
242 /*
243 * Generic x86 PMC bits
244 */
245 const char *name;
246 int version;
247 int (*handle_irq)(struct pt_regs *);
248 void (*disable_all)(void);
249 void (*enable_all)(int added);
250 void (*enable)(struct perf_event *);
251 void (*disable)(struct perf_event *);
252 int (*hw_config)(struct perf_event *event);
253 int (*schedule_events)(struct cpu_hw_events *cpuc, int n, int *assign);
254 unsigned eventsel;
255 unsigned perfctr;
256 u64 (*event_map)(int);
257 int max_events;
258 int num_counters;
259 int num_counters_fixed;
260 int cntval_bits;
261 u64 cntval_mask;
262 int apic;
263 u64 max_period;
264 struct event_constraint *
265 (*get_event_constraints)(struct cpu_hw_events *cpuc,
266 struct perf_event *event);
267
268 void (*put_event_constraints)(struct cpu_hw_events *cpuc,
269 struct perf_event *event);
270 struct event_constraint *event_constraints;
271 void (*quirks)(void);
272 int perfctr_second_write;
273
274 int (*cpu_prepare)(int cpu);
275 void (*cpu_starting)(int cpu);
276 void (*cpu_dying)(int cpu);
277 void (*cpu_dead)(int cpu);
278
279 /*
280 * Intel Arch Perfmon v2+
281 */
282 u64 intel_ctrl;
283 union perf_capabilities intel_cap;
284
285 /*
286 * Intel DebugStore bits
287 */
288 int bts, pebs;
289 int bts_active, pebs_active;
290 int pebs_record_size;
291 void (*drain_pebs)(struct pt_regs *regs);
292 struct event_constraint *pebs_constraints;
293
294 /*
295 * Intel LBR
296 */
297 unsigned long lbr_tos, lbr_from, lbr_to; /* MSR base regs */
298 int lbr_nr; /* hardware stack size */
299
300 /*
301 * Extra registers for events
302 */
303 struct extra_reg *extra_regs;
304 unsigned int er_flags;
305
306 /*
307 * Intel host/guest support (KVM)
308 */
309 struct perf_guest_switch_msr *(*guest_get_msrs)(int *nr);
310};
311
312#define ERF_NO_HT_SHARING 1
313#define ERF_HAS_RSP_1 2
314
315extern struct x86_pmu x86_pmu __read_mostly;
316
317DECLARE_PER_CPU(struct cpu_hw_events, cpu_hw_events);
318
319int x86_perf_event_set_period(struct perf_event *event);
320
321/*
322 * Generalized hw caching related hw_event table, filled
323 * in on a per model basis. A value of 0 means
324 * 'not supported', -1 means 'hw_event makes no sense on
325 * this CPU', any other value means the raw hw_event
326 * ID.
327 */
328
329#define C(x) PERF_COUNT_HW_CACHE_##x
330
331extern u64 __read_mostly hw_cache_event_ids
332 [PERF_COUNT_HW_CACHE_MAX]
333 [PERF_COUNT_HW_CACHE_OP_MAX]
334 [PERF_COUNT_HW_CACHE_RESULT_MAX];
335extern u64 __read_mostly hw_cache_extra_regs
336 [PERF_COUNT_HW_CACHE_MAX]
337 [PERF_COUNT_HW_CACHE_OP_MAX]
338 [PERF_COUNT_HW_CACHE_RESULT_MAX];
339
340u64 x86_perf_event_update(struct perf_event *event);
341
342static inline int x86_pmu_addr_offset(int index)
343{
344 int offset;
345
346 /* offset = X86_FEATURE_PERFCTR_CORE ? index << 1 : index */
347 alternative_io(ASM_NOP2,
348 "shll $1, %%eax",
349 X86_FEATURE_PERFCTR_CORE,
350 "=a" (offset),
351 "a" (index));
352
353 return offset;
354}
355
356static inline unsigned int x86_pmu_config_addr(int index)
357{
358 return x86_pmu.eventsel + x86_pmu_addr_offset(index);
359}
360
361static inline unsigned int x86_pmu_event_addr(int index)
362{
363 return x86_pmu.perfctr + x86_pmu_addr_offset(index);
364}
365
366int x86_setup_perfctr(struct perf_event *event);
367
368int x86_pmu_hw_config(struct perf_event *event);
369
370void x86_pmu_disable_all(void);
371
372static inline void __x86_pmu_enable_event(struct hw_perf_event *hwc,
373 u64 enable_mask)
374{
375 if (hwc->extra_reg.reg)
376 wrmsrl(hwc->extra_reg.reg, hwc->extra_reg.config);
377 wrmsrl(hwc->config_base, hwc->config | enable_mask);
378}
379
380void x86_pmu_enable_all(int added);
381
382int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign);
383
384void x86_pmu_stop(struct perf_event *event, int flags);
385
386static inline void x86_pmu_disable_event(struct perf_event *event)
387{
388 struct hw_perf_event *hwc = &event->hw;
389
390 wrmsrl(hwc->config_base, hwc->config);
391}
392
393void x86_pmu_enable_event(struct perf_event *event);
394
395int x86_pmu_handle_irq(struct pt_regs *regs);
396
397extern struct event_constraint emptyconstraint;
398
399extern struct event_constraint unconstrained;
400
401#ifdef CONFIG_CPU_SUP_AMD
402
403int amd_pmu_init(void);
404
405#else /* CONFIG_CPU_SUP_AMD */
406
407static inline int amd_pmu_init(void)
408{
409 return 0;
410}
411
412#endif /* CONFIG_CPU_SUP_AMD */
413
414#ifdef CONFIG_CPU_SUP_INTEL
415
416int intel_pmu_save_and_restart(struct perf_event *event);
417
418struct event_constraint *
419x86_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event);
420
421struct intel_shared_regs *allocate_shared_regs(int cpu);
422
423int intel_pmu_init(void);
424
425void init_debug_store_on_cpu(int cpu);
426
427void fini_debug_store_on_cpu(int cpu);
428
429void release_ds_buffers(void);
430
431void reserve_ds_buffers(void);
432
433extern struct event_constraint bts_constraint;
434
435void intel_pmu_enable_bts(u64 config);
436
437void intel_pmu_disable_bts(void);
438
439int intel_pmu_drain_bts_buffer(void);
440
441extern struct event_constraint intel_core2_pebs_event_constraints[];
442
443extern struct event_constraint intel_atom_pebs_event_constraints[];
444
445extern struct event_constraint intel_nehalem_pebs_event_constraints[];
446
447extern struct event_constraint intel_westmere_pebs_event_constraints[];
448
449extern struct event_constraint intel_snb_pebs_event_constraints[];
450
451struct event_constraint *intel_pebs_constraints(struct perf_event *event);
452
453void intel_pmu_pebs_enable(struct perf_event *event);
454
455void intel_pmu_pebs_disable(struct perf_event *event);
456
457void intel_pmu_pebs_enable_all(void);
458
459void intel_pmu_pebs_disable_all(void);
460
461void intel_ds_init(void);
462
463void intel_pmu_lbr_reset(void);
464
465void intel_pmu_lbr_enable(struct perf_event *event);
466
467void intel_pmu_lbr_disable(struct perf_event *event);
468
469void intel_pmu_lbr_enable_all(void);
470
471void intel_pmu_lbr_disable_all(void);
472
473void intel_pmu_lbr_read(void);
474
475void intel_pmu_lbr_init_core(void);
476
477void intel_pmu_lbr_init_nhm(void);
478
479void intel_pmu_lbr_init_atom(void);
480
481int p4_pmu_init(void);
482
483int p6_pmu_init(void);
484
485#else /* CONFIG_CPU_SUP_INTEL */
486
487static inline void reserve_ds_buffers(void)
488{
489}
490
491static inline void release_ds_buffers(void)
492{
493}
494
495static inline int intel_pmu_init(void)
496{
497 return 0;
498}
499
500static inline struct intel_shared_regs *allocate_shared_regs(int cpu)
501{
502 return NULL;
503}
504
505#endif /* CONFIG_CPU_SUP_INTEL */
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index 941caa2e449..aeefd45697a 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -1,4 +1,10 @@
1#ifdef CONFIG_CPU_SUP_AMD 1#include <linux/perf_event.h>
2#include <linux/types.h>
3#include <linux/init.h>
4#include <linux/slab.h>
5#include <asm/apicdef.h>
6
7#include "perf_event.h"
2 8
3static __initconst const u64 amd_hw_cache_event_ids 9static __initconst const u64 amd_hw_cache_event_ids
4 [PERF_COUNT_HW_CACHE_MAX] 10 [PERF_COUNT_HW_CACHE_MAX]
@@ -132,6 +138,19 @@ static int amd_pmu_hw_config(struct perf_event *event)
132 if (ret) 138 if (ret)
133 return ret; 139 return ret;
134 140
141 if (event->attr.exclude_host && event->attr.exclude_guest)
142 /*
143 * When HO == GO == 1 the hardware treats that as GO == HO == 0
144 * and will count in both modes. We don't want to count in that
145 * case so we emulate no-counting by setting US = OS = 0.
146 */
147 event->hw.config &= ~(ARCH_PERFMON_EVENTSEL_USR |
148 ARCH_PERFMON_EVENTSEL_OS);
149 else if (event->attr.exclude_host)
150 event->hw.config |= AMD_PERFMON_EVENTSEL_GUESTONLY;
151 else if (event->attr.exclude_guest)
152 event->hw.config |= AMD_PERFMON_EVENTSEL_HOSTONLY;
153
135 if (event->attr.type != PERF_TYPE_RAW) 154 if (event->attr.type != PERF_TYPE_RAW)
136 return 0; 155 return 0;
137 156
@@ -350,7 +369,7 @@ static void amd_pmu_cpu_starting(int cpu)
350 continue; 369 continue;
351 370
352 if (nb->nb_id == nb_id) { 371 if (nb->nb_id == nb_id) {
353 kfree(cpuc->amd_nb); 372 cpuc->kfree_on_online = cpuc->amd_nb;
354 cpuc->amd_nb = nb; 373 cpuc->amd_nb = nb;
355 break; 374 break;
356 } 375 }
@@ -392,7 +411,7 @@ static __initconst const struct x86_pmu amd_pmu = {
392 .perfctr = MSR_K7_PERFCTR0, 411 .perfctr = MSR_K7_PERFCTR0,
393 .event_map = amd_pmu_event_map, 412 .event_map = amd_pmu_event_map,
394 .max_events = ARRAY_SIZE(amd_perfmon_event_map), 413 .max_events = ARRAY_SIZE(amd_perfmon_event_map),
395 .num_counters = 4, 414 .num_counters = AMD64_NUM_COUNTERS,
396 .cntval_bits = 48, 415 .cntval_bits = 48,
397 .cntval_mask = (1ULL << 48) - 1, 416 .cntval_mask = (1ULL << 48) - 1,
398 .apic = 1, 417 .apic = 1,
@@ -556,7 +575,7 @@ static __initconst const struct x86_pmu amd_pmu_f15h = {
556 .perfctr = MSR_F15H_PERF_CTR, 575 .perfctr = MSR_F15H_PERF_CTR,
557 .event_map = amd_pmu_event_map, 576 .event_map = amd_pmu_event_map,
558 .max_events = ARRAY_SIZE(amd_perfmon_event_map), 577 .max_events = ARRAY_SIZE(amd_perfmon_event_map),
559 .num_counters = 6, 578 .num_counters = AMD64_NUM_COUNTERS_F15H,
560 .cntval_bits = 48, 579 .cntval_bits = 48,
561 .cntval_mask = (1ULL << 48) - 1, 580 .cntval_mask = (1ULL << 48) - 1,
562 .apic = 1, 581 .apic = 1,
@@ -573,7 +592,7 @@ static __initconst const struct x86_pmu amd_pmu_f15h = {
573#endif 592#endif
574}; 593};
575 594
576static __init int amd_pmu_init(void) 595__init int amd_pmu_init(void)
577{ 596{
578 /* Performance-monitoring supported from K7 and later: */ 597 /* Performance-monitoring supported from K7 and later: */
579 if (boot_cpu_data.x86 < 6) 598 if (boot_cpu_data.x86 < 6)
@@ -602,12 +621,3 @@ static __init int amd_pmu_init(void)
602 621
603 return 0; 622 return 0;
604} 623}
605
606#else /* CONFIG_CPU_SUP_AMD */
607
608static int amd_pmu_init(void)
609{
610 return 0;
611}
612
613#endif
diff --git a/arch/x86/kernel/cpu/perf_event_amd_ibs.c b/arch/x86/kernel/cpu/perf_event_amd_ibs.c
new file mode 100644
index 00000000000..ab6343d2182
--- /dev/null
+++ b/arch/x86/kernel/cpu/perf_event_amd_ibs.c
@@ -0,0 +1,294 @@
1/*
2 * Performance events - AMD IBS
3 *
4 * Copyright (C) 2011 Advanced Micro Devices, Inc., Robert Richter
5 *
6 * For licencing details see kernel-base/COPYING
7 */
8
9#include <linux/perf_event.h>
10#include <linux/module.h>
11#include <linux/pci.h>
12
13#include <asm/apic.h>
14
15static u32 ibs_caps;
16
17#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD)
18
19static struct pmu perf_ibs;
20
21static int perf_ibs_init(struct perf_event *event)
22{
23 if (perf_ibs.type != event->attr.type)
24 return -ENOENT;
25 return 0;
26}
27
28static int perf_ibs_add(struct perf_event *event, int flags)
29{
30 return 0;
31}
32
33static void perf_ibs_del(struct perf_event *event, int flags)
34{
35}
36
37static struct pmu perf_ibs = {
38 .event_init= perf_ibs_init,
39 .add= perf_ibs_add,
40 .del= perf_ibs_del,
41};
42
43static __init int perf_event_ibs_init(void)
44{
45 if (!ibs_caps)
46 return -ENODEV; /* ibs not supported by the cpu */
47
48 perf_pmu_register(&perf_ibs, "ibs", -1);
49 printk(KERN_INFO "perf: AMD IBS detected (0x%08x)\n", ibs_caps);
50
51 return 0;
52}
53
54#else /* defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD) */
55
56static __init int perf_event_ibs_init(void) { return 0; }
57
58#endif
59
60/* IBS - apic initialization, for perf and oprofile */
61
62static __init u32 __get_ibs_caps(void)
63{
64 u32 caps;
65 unsigned int max_level;
66
67 if (!boot_cpu_has(X86_FEATURE_IBS))
68 return 0;
69
70 /* check IBS cpuid feature flags */
71 max_level = cpuid_eax(0x80000000);
72 if (max_level < IBS_CPUID_FEATURES)
73 return IBS_CAPS_DEFAULT;
74
75 caps = cpuid_eax(IBS_CPUID_FEATURES);
76 if (!(caps & IBS_CAPS_AVAIL))
77 /* cpuid flags not valid */
78 return IBS_CAPS_DEFAULT;
79
80 return caps;
81}
82
83u32 get_ibs_caps(void)
84{
85 return ibs_caps;
86}
87
88EXPORT_SYMBOL(get_ibs_caps);
89
90static inline int get_eilvt(int offset)
91{
92 return !setup_APIC_eilvt(offset, 0, APIC_EILVT_MSG_NMI, 1);
93}
94
95static inline int put_eilvt(int offset)
96{
97 return !setup_APIC_eilvt(offset, 0, 0, 1);
98}
99
100/*
101 * Check and reserve APIC extended interrupt LVT offset for IBS if available.
102 */
103static inline int ibs_eilvt_valid(void)
104{
105 int offset;
106 u64 val;
107 int valid = 0;
108
109 preempt_disable();
110
111 rdmsrl(MSR_AMD64_IBSCTL, val);
112 offset = val & IBSCTL_LVT_OFFSET_MASK;
113
114 if (!(val & IBSCTL_LVT_OFFSET_VALID)) {
115 pr_err(FW_BUG "cpu %d, invalid IBS interrupt offset %d (MSR%08X=0x%016llx)\n",
116 smp_processor_id(), offset, MSR_AMD64_IBSCTL, val);
117 goto out;
118 }
119
120 if (!get_eilvt(offset)) {
121 pr_err(FW_BUG "cpu %d, IBS interrupt offset %d not available (MSR%08X=0x%016llx)\n",
122 smp_processor_id(), offset, MSR_AMD64_IBSCTL, val);
123 goto out;
124 }
125
126 valid = 1;
127out:
128 preempt_enable();
129
130 return valid;
131}
132
133static int setup_ibs_ctl(int ibs_eilvt_off)
134{
135 struct pci_dev *cpu_cfg;
136 int nodes;
137 u32 value = 0;
138
139 nodes = 0;
140 cpu_cfg = NULL;
141 do {
142 cpu_cfg = pci_get_device(PCI_VENDOR_ID_AMD,
143 PCI_DEVICE_ID_AMD_10H_NB_MISC,
144 cpu_cfg);
145 if (!cpu_cfg)
146 break;
147 ++nodes;
148 pci_write_config_dword(cpu_cfg, IBSCTL, ibs_eilvt_off
149 | IBSCTL_LVT_OFFSET_VALID);
150 pci_read_config_dword(cpu_cfg, IBSCTL, &value);
151 if (value != (ibs_eilvt_off | IBSCTL_LVT_OFFSET_VALID)) {
152 pci_dev_put(cpu_cfg);
153 printk(KERN_DEBUG "Failed to setup IBS LVT offset, "
154 "IBSCTL = 0x%08x\n", value);
155 return -EINVAL;
156 }
157 } while (1);
158
159 if (!nodes) {
160 printk(KERN_DEBUG "No CPU node configured for IBS\n");
161 return -ENODEV;
162 }
163
164 return 0;
165}
166
167/*
168 * This runs only on the current cpu. We try to find an LVT offset and
169 * setup the local APIC. For this we must disable preemption. On
170 * success we initialize all nodes with this offset. This updates then
171 * the offset in the IBS_CTL per-node msr. The per-core APIC setup of
172 * the IBS interrupt vector is handled by perf_ibs_cpu_notifier that
173 * is using the new offset.
174 */
175static int force_ibs_eilvt_setup(void)
176{
177 int offset;
178 int ret;
179
180 preempt_disable();
181 /* find the next free available EILVT entry, skip offset 0 */
182 for (offset = 1; offset < APIC_EILVT_NR_MAX; offset++) {
183 if (get_eilvt(offset))
184 break;
185 }
186 preempt_enable();
187
188 if (offset == APIC_EILVT_NR_MAX) {
189 printk(KERN_DEBUG "No EILVT entry available\n");
190 return -EBUSY;
191 }
192
193 ret = setup_ibs_ctl(offset);
194 if (ret)
195 goto out;
196
197 if (!ibs_eilvt_valid()) {
198 ret = -EFAULT;
199 goto out;
200 }
201
202 pr_err(FW_BUG "using offset %d for IBS interrupts\n", offset);
203 pr_err(FW_BUG "workaround enabled for IBS LVT offset\n");
204
205 return 0;
206out:
207 preempt_disable();
208 put_eilvt(offset);
209 preempt_enable();
210 return ret;
211}
212
213static inline int get_ibs_lvt_offset(void)
214{
215 u64 val;
216
217 rdmsrl(MSR_AMD64_IBSCTL, val);
218 if (!(val & IBSCTL_LVT_OFFSET_VALID))
219 return -EINVAL;
220
221 return val & IBSCTL_LVT_OFFSET_MASK;
222}
223
224static void setup_APIC_ibs(void *dummy)
225{
226 int offset;
227
228 offset = get_ibs_lvt_offset();
229 if (offset < 0)
230 goto failed;
231
232 if (!setup_APIC_eilvt(offset, 0, APIC_EILVT_MSG_NMI, 0))
233 return;
234failed:
235 pr_warn("perf: IBS APIC setup failed on cpu #%d\n",
236 smp_processor_id());
237}
238
239static void clear_APIC_ibs(void *dummy)
240{
241 int offset;
242
243 offset = get_ibs_lvt_offset();
244 if (offset >= 0)
245 setup_APIC_eilvt(offset, 0, APIC_EILVT_MSG_FIX, 1);
246}
247
248static int __cpuinit
249perf_ibs_cpu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
250{
251 switch (action & ~CPU_TASKS_FROZEN) {
252 case CPU_STARTING:
253 setup_APIC_ibs(NULL);
254 break;
255 case CPU_DYING:
256 clear_APIC_ibs(NULL);
257 break;
258 default:
259 break;
260 }
261
262 return NOTIFY_OK;
263}
264
265static __init int amd_ibs_init(void)
266{
267 u32 caps;
268 int ret;
269
270 caps = __get_ibs_caps();
271 if (!caps)
272 return -ENODEV; /* ibs not supported by the cpu */
273
274 if (!ibs_eilvt_valid()) {
275 ret = force_ibs_eilvt_setup();
276 if (ret) {
277 pr_err("Failed to setup IBS, %d\n", ret);
278 return ret;
279 }
280 }
281
282 get_online_cpus();
283 ibs_caps = caps;
284 /* make ibs_caps visible to other cpus: */
285 smp_mb();
286 perf_cpu_notifier(perf_ibs_cpu_notifier);
287 smp_call_function(setup_APIC_ibs, NULL, 1);
288 put_online_cpus();
289
290 return perf_event_ibs_init();
291}
292
293/* Since we need the pci subsystem to init ibs we can't do this earlier: */
294device_initcall(amd_ibs_init);
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index f88af2c2a56..e09ca20e86e 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -1,16 +1,19 @@
1#ifdef CONFIG_CPU_SUP_INTEL
2
3/* 1/*
4 * Per core/cpu state 2 * Per core/cpu state
5 * 3 *
6 * Used to coordinate shared registers between HT threads or 4 * Used to coordinate shared registers between HT threads or
7 * among events on a single PMU. 5 * among events on a single PMU.
8 */ 6 */
9struct intel_shared_regs { 7
10 struct er_account regs[EXTRA_REG_MAX]; 8#include <linux/stddef.h>
11 int refcnt; /* per-core: #HT threads */ 9#include <linux/types.h>
12 unsigned core_id; /* per-core: core id */ 10#include <linux/init.h>
13}; 11#include <linux/slab.h>
12
13#include <asm/hardirq.h>
14#include <asm/apic.h>
15
16#include "perf_event.h"
14 17
15/* 18/*
16 * Intel PerfMon, used on Core and later. 19 * Intel PerfMon, used on Core and later.
@@ -746,7 +749,8 @@ static void intel_pmu_enable_all(int added)
746 749
747 intel_pmu_pebs_enable_all(); 750 intel_pmu_pebs_enable_all();
748 intel_pmu_lbr_enable_all(); 751 intel_pmu_lbr_enable_all();
749 wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, x86_pmu.intel_ctrl); 752 wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL,
753 x86_pmu.intel_ctrl & ~cpuc->intel_ctrl_guest_mask);
750 754
751 if (test_bit(X86_PMC_IDX_FIXED_BTS, cpuc->active_mask)) { 755 if (test_bit(X86_PMC_IDX_FIXED_BTS, cpuc->active_mask)) {
752 struct perf_event *event = 756 struct perf_event *event =
@@ -869,6 +873,7 @@ static void intel_pmu_disable_fixed(struct hw_perf_event *hwc)
869static void intel_pmu_disable_event(struct perf_event *event) 873static void intel_pmu_disable_event(struct perf_event *event)
870{ 874{
871 struct hw_perf_event *hwc = &event->hw; 875 struct hw_perf_event *hwc = &event->hw;
876 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
872 877
873 if (unlikely(hwc->idx == X86_PMC_IDX_FIXED_BTS)) { 878 if (unlikely(hwc->idx == X86_PMC_IDX_FIXED_BTS)) {
874 intel_pmu_disable_bts(); 879 intel_pmu_disable_bts();
@@ -876,6 +881,9 @@ static void intel_pmu_disable_event(struct perf_event *event)
876 return; 881 return;
877 } 882 }
878 883
884 cpuc->intel_ctrl_guest_mask &= ~(1ull << hwc->idx);
885 cpuc->intel_ctrl_host_mask &= ~(1ull << hwc->idx);
886
879 if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) { 887 if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) {
880 intel_pmu_disable_fixed(hwc); 888 intel_pmu_disable_fixed(hwc);
881 return; 889 return;
@@ -921,6 +929,7 @@ static void intel_pmu_enable_fixed(struct hw_perf_event *hwc)
921static void intel_pmu_enable_event(struct perf_event *event) 929static void intel_pmu_enable_event(struct perf_event *event)
922{ 930{
923 struct hw_perf_event *hwc = &event->hw; 931 struct hw_perf_event *hwc = &event->hw;
932 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
924 933
925 if (unlikely(hwc->idx == X86_PMC_IDX_FIXED_BTS)) { 934 if (unlikely(hwc->idx == X86_PMC_IDX_FIXED_BTS)) {
926 if (!__this_cpu_read(cpu_hw_events.enabled)) 935 if (!__this_cpu_read(cpu_hw_events.enabled))
@@ -930,6 +939,11 @@ static void intel_pmu_enable_event(struct perf_event *event)
930 return; 939 return;
931 } 940 }
932 941
942 if (event->attr.exclude_host)
943 cpuc->intel_ctrl_guest_mask |= (1ull << hwc->idx);
944 if (event->attr.exclude_guest)
945 cpuc->intel_ctrl_host_mask |= (1ull << hwc->idx);
946
933 if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) { 947 if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) {
934 intel_pmu_enable_fixed(hwc); 948 intel_pmu_enable_fixed(hwc);
935 return; 949 return;
@@ -945,7 +959,7 @@ static void intel_pmu_enable_event(struct perf_event *event)
945 * Save and restart an expired event. Called by NMI contexts, 959 * Save and restart an expired event. Called by NMI contexts,
946 * so it has to be careful about preempting normal event ops: 960 * so it has to be careful about preempting normal event ops:
947 */ 961 */
948static int intel_pmu_save_and_restart(struct perf_event *event) 962int intel_pmu_save_and_restart(struct perf_event *event)
949{ 963{
950 x86_perf_event_update(event); 964 x86_perf_event_update(event);
951 return x86_perf_event_set_period(event); 965 return x86_perf_event_set_period(event);
@@ -1197,6 +1211,21 @@ intel_shared_regs_constraints(struct cpu_hw_events *cpuc,
1197 return c; 1211 return c;
1198} 1212}
1199 1213
1214struct event_constraint *
1215x86_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
1216{
1217 struct event_constraint *c;
1218
1219 if (x86_pmu.event_constraints) {
1220 for_each_event_constraint(c, x86_pmu.event_constraints) {
1221 if ((event->hw.config & c->cmask) == c->code)
1222 return c;
1223 }
1224 }
1225
1226 return &unconstrained;
1227}
1228
1200static struct event_constraint * 1229static struct event_constraint *
1201intel_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event) 1230intel_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
1202{ 1231{
@@ -1284,12 +1313,84 @@ static int intel_pmu_hw_config(struct perf_event *event)
1284 return 0; 1313 return 0;
1285} 1314}
1286 1315
1316struct perf_guest_switch_msr *perf_guest_get_msrs(int *nr)
1317{
1318 if (x86_pmu.guest_get_msrs)
1319 return x86_pmu.guest_get_msrs(nr);
1320 *nr = 0;
1321 return NULL;
1322}
1323EXPORT_SYMBOL_GPL(perf_guest_get_msrs);
1324
1325static struct perf_guest_switch_msr *intel_guest_get_msrs(int *nr)
1326{
1327 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1328 struct perf_guest_switch_msr *arr = cpuc->guest_switch_msrs;
1329
1330 arr[0].msr = MSR_CORE_PERF_GLOBAL_CTRL;
1331 arr[0].host = x86_pmu.intel_ctrl & ~cpuc->intel_ctrl_guest_mask;
1332 arr[0].guest = x86_pmu.intel_ctrl & ~cpuc->intel_ctrl_host_mask;
1333
1334 *nr = 1;
1335 return arr;
1336}
1337
1338static struct perf_guest_switch_msr *core_guest_get_msrs(int *nr)
1339{
1340 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1341 struct perf_guest_switch_msr *arr = cpuc->guest_switch_msrs;
1342 int idx;
1343
1344 for (idx = 0; idx < x86_pmu.num_counters; idx++) {
1345 struct perf_event *event = cpuc->events[idx];
1346
1347 arr[idx].msr = x86_pmu_config_addr(idx);
1348 arr[idx].host = arr[idx].guest = 0;
1349
1350 if (!test_bit(idx, cpuc->active_mask))
1351 continue;
1352
1353 arr[idx].host = arr[idx].guest =
1354 event->hw.config | ARCH_PERFMON_EVENTSEL_ENABLE;
1355
1356 if (event->attr.exclude_host)
1357 arr[idx].host &= ~ARCH_PERFMON_EVENTSEL_ENABLE;
1358 else if (event->attr.exclude_guest)
1359 arr[idx].guest &= ~ARCH_PERFMON_EVENTSEL_ENABLE;
1360 }
1361
1362 *nr = x86_pmu.num_counters;
1363 return arr;
1364}
1365
1366static void core_pmu_enable_event(struct perf_event *event)
1367{
1368 if (!event->attr.exclude_host)
1369 x86_pmu_enable_event(event);
1370}
1371
1372static void core_pmu_enable_all(int added)
1373{
1374 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1375 int idx;
1376
1377 for (idx = 0; idx < x86_pmu.num_counters; idx++) {
1378 struct hw_perf_event *hwc = &cpuc->events[idx]->hw;
1379
1380 if (!test_bit(idx, cpuc->active_mask) ||
1381 cpuc->events[idx]->attr.exclude_host)
1382 continue;
1383
1384 __x86_pmu_enable_event(hwc, ARCH_PERFMON_EVENTSEL_ENABLE);
1385 }
1386}
1387
1287static __initconst const struct x86_pmu core_pmu = { 1388static __initconst const struct x86_pmu core_pmu = {
1288 .name = "core", 1389 .name = "core",
1289 .handle_irq = x86_pmu_handle_irq, 1390 .handle_irq = x86_pmu_handle_irq,
1290 .disable_all = x86_pmu_disable_all, 1391 .disable_all = x86_pmu_disable_all,
1291 .enable_all = x86_pmu_enable_all, 1392 .enable_all = core_pmu_enable_all,
1292 .enable = x86_pmu_enable_event, 1393 .enable = core_pmu_enable_event,
1293 .disable = x86_pmu_disable_event, 1394 .disable = x86_pmu_disable_event,
1294 .hw_config = x86_pmu_hw_config, 1395 .hw_config = x86_pmu_hw_config,
1295 .schedule_events = x86_schedule_events, 1396 .schedule_events = x86_schedule_events,
@@ -1307,9 +1408,10 @@ static __initconst const struct x86_pmu core_pmu = {
1307 .get_event_constraints = intel_get_event_constraints, 1408 .get_event_constraints = intel_get_event_constraints,
1308 .put_event_constraints = intel_put_event_constraints, 1409 .put_event_constraints = intel_put_event_constraints,
1309 .event_constraints = intel_core_event_constraints, 1410 .event_constraints = intel_core_event_constraints,
1411 .guest_get_msrs = core_guest_get_msrs,
1310}; 1412};
1311 1413
1312static struct intel_shared_regs *allocate_shared_regs(int cpu) 1414struct intel_shared_regs *allocate_shared_regs(int cpu)
1313{ 1415{
1314 struct intel_shared_regs *regs; 1416 struct intel_shared_regs *regs;
1315 int i; 1417 int i;
@@ -1362,7 +1464,7 @@ static void intel_pmu_cpu_starting(int cpu)
1362 1464
1363 pc = per_cpu(cpu_hw_events, i).shared_regs; 1465 pc = per_cpu(cpu_hw_events, i).shared_regs;
1364 if (pc && pc->core_id == core_id) { 1466 if (pc && pc->core_id == core_id) {
1365 kfree(cpuc->shared_regs); 1467 cpuc->kfree_on_online = cpuc->shared_regs;
1366 cpuc->shared_regs = pc; 1468 cpuc->shared_regs = pc;
1367 break; 1469 break;
1368 } 1470 }
@@ -1413,6 +1515,7 @@ static __initconst const struct x86_pmu intel_pmu = {
1413 .cpu_prepare = intel_pmu_cpu_prepare, 1515 .cpu_prepare = intel_pmu_cpu_prepare,
1414 .cpu_starting = intel_pmu_cpu_starting, 1516 .cpu_starting = intel_pmu_cpu_starting,
1415 .cpu_dying = intel_pmu_cpu_dying, 1517 .cpu_dying = intel_pmu_cpu_dying,
1518 .guest_get_msrs = intel_guest_get_msrs,
1416}; 1519};
1417 1520
1418static void intel_clovertown_quirks(void) 1521static void intel_clovertown_quirks(void)
@@ -1441,7 +1544,7 @@ static void intel_clovertown_quirks(void)
1441 x86_pmu.pebs_constraints = NULL; 1544 x86_pmu.pebs_constraints = NULL;
1442} 1545}
1443 1546
1444static __init int intel_pmu_init(void) 1547__init int intel_pmu_init(void)
1445{ 1548{
1446 union cpuid10_edx edx; 1549 union cpuid10_edx edx;
1447 union cpuid10_eax eax; 1550 union cpuid10_eax eax;
@@ -1597,7 +1700,7 @@ static __init int intel_pmu_init(void)
1597 intel_pmu_lbr_init_nhm(); 1700 intel_pmu_lbr_init_nhm();
1598 1701
1599 x86_pmu.event_constraints = intel_snb_event_constraints; 1702 x86_pmu.event_constraints = intel_snb_event_constraints;
1600 x86_pmu.pebs_constraints = intel_snb_pebs_events; 1703 x86_pmu.pebs_constraints = intel_snb_pebs_event_constraints;
1601 x86_pmu.extra_regs = intel_snb_extra_regs; 1704 x86_pmu.extra_regs = intel_snb_extra_regs;
1602 /* all extra regs are per-cpu when HT is on */ 1705 /* all extra regs are per-cpu when HT is on */
1603 x86_pmu.er_flags |= ERF_HAS_RSP_1; 1706 x86_pmu.er_flags |= ERF_HAS_RSP_1;
@@ -1628,16 +1731,3 @@ static __init int intel_pmu_init(void)
1628 } 1731 }
1629 return 0; 1732 return 0;
1630} 1733}
1631
1632#else /* CONFIG_CPU_SUP_INTEL */
1633
1634static int intel_pmu_init(void)
1635{
1636 return 0;
1637}
1638
1639static struct intel_shared_regs *allocate_shared_regs(int cpu)
1640{
1641 return NULL;
1642}
1643#endif /* CONFIG_CPU_SUP_INTEL */
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 1b1ef3addcf..c0d238f49db 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -1,7 +1,10 @@
1#ifdef CONFIG_CPU_SUP_INTEL 1#include <linux/bitops.h>
2#include <linux/types.h>
3#include <linux/slab.h>
2 4
3/* The maximal number of PEBS events: */ 5#include <asm/perf_event.h>
4#define MAX_PEBS_EVENTS 4 6
7#include "perf_event.h"
5 8
6/* The size of a BTS record in bytes: */ 9/* The size of a BTS record in bytes: */
7#define BTS_RECORD_SIZE 24 10#define BTS_RECORD_SIZE 24
@@ -37,24 +40,7 @@ struct pebs_record_nhm {
37 u64 status, dla, dse, lat; 40 u64 status, dla, dse, lat;
38}; 41};
39 42
40/* 43void init_debug_store_on_cpu(int cpu)
41 * A debug store configuration.
42 *
43 * We only support architectures that use 64bit fields.
44 */
45struct debug_store {
46 u64 bts_buffer_base;
47 u64 bts_index;
48 u64 bts_absolute_maximum;
49 u64 bts_interrupt_threshold;
50 u64 pebs_buffer_base;
51 u64 pebs_index;
52 u64 pebs_absolute_maximum;
53 u64 pebs_interrupt_threshold;
54 u64 pebs_event_reset[MAX_PEBS_EVENTS];
55};
56
57static void init_debug_store_on_cpu(int cpu)
58{ 44{
59 struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds; 45 struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;
60 46
@@ -66,7 +52,7 @@ static void init_debug_store_on_cpu(int cpu)
66 (u32)((u64)(unsigned long)ds >> 32)); 52 (u32)((u64)(unsigned long)ds >> 32));
67} 53}
68 54
69static void fini_debug_store_on_cpu(int cpu) 55void fini_debug_store_on_cpu(int cpu)
70{ 56{
71 if (!per_cpu(cpu_hw_events, cpu).ds) 57 if (!per_cpu(cpu_hw_events, cpu).ds)
72 return; 58 return;
@@ -175,7 +161,7 @@ static void release_ds_buffer(int cpu)
175 kfree(ds); 161 kfree(ds);
176} 162}
177 163
178static void release_ds_buffers(void) 164void release_ds_buffers(void)
179{ 165{
180 int cpu; 166 int cpu;
181 167
@@ -194,7 +180,7 @@ static void release_ds_buffers(void)
194 put_online_cpus(); 180 put_online_cpus();
195} 181}
196 182
197static void reserve_ds_buffers(void) 183void reserve_ds_buffers(void)
198{ 184{
199 int bts_err = 0, pebs_err = 0; 185 int bts_err = 0, pebs_err = 0;
200 int cpu; 186 int cpu;
@@ -260,10 +246,10 @@ static void reserve_ds_buffers(void)
260 * BTS 246 * BTS
261 */ 247 */
262 248
263static struct event_constraint bts_constraint = 249struct event_constraint bts_constraint =
264 EVENT_CONSTRAINT(0, 1ULL << X86_PMC_IDX_FIXED_BTS, 0); 250 EVENT_CONSTRAINT(0, 1ULL << X86_PMC_IDX_FIXED_BTS, 0);
265 251
266static void intel_pmu_enable_bts(u64 config) 252void intel_pmu_enable_bts(u64 config)
267{ 253{
268 unsigned long debugctlmsr; 254 unsigned long debugctlmsr;
269 255
@@ -282,7 +268,7 @@ static void intel_pmu_enable_bts(u64 config)
282 update_debugctlmsr(debugctlmsr); 268 update_debugctlmsr(debugctlmsr);
283} 269}
284 270
285static void intel_pmu_disable_bts(void) 271void intel_pmu_disable_bts(void)
286{ 272{
287 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 273 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
288 unsigned long debugctlmsr; 274 unsigned long debugctlmsr;
@@ -299,7 +285,7 @@ static void intel_pmu_disable_bts(void)
299 update_debugctlmsr(debugctlmsr); 285 update_debugctlmsr(debugctlmsr);
300} 286}
301 287
302static int intel_pmu_drain_bts_buffer(void) 288int intel_pmu_drain_bts_buffer(void)
303{ 289{
304 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 290 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
305 struct debug_store *ds = cpuc->ds; 291 struct debug_store *ds = cpuc->ds;
@@ -361,7 +347,7 @@ static int intel_pmu_drain_bts_buffer(void)
361/* 347/*
362 * PEBS 348 * PEBS
363 */ 349 */
364static struct event_constraint intel_core2_pebs_event_constraints[] = { 350struct event_constraint intel_core2_pebs_event_constraints[] = {
365 INTEL_UEVENT_CONSTRAINT(0x00c0, 0x1), /* INST_RETIRED.ANY */ 351 INTEL_UEVENT_CONSTRAINT(0x00c0, 0x1), /* INST_RETIRED.ANY */
366 INTEL_UEVENT_CONSTRAINT(0xfec1, 0x1), /* X87_OPS_RETIRED.ANY */ 352 INTEL_UEVENT_CONSTRAINT(0xfec1, 0x1), /* X87_OPS_RETIRED.ANY */
367 INTEL_UEVENT_CONSTRAINT(0x00c5, 0x1), /* BR_INST_RETIRED.MISPRED */ 353 INTEL_UEVENT_CONSTRAINT(0x00c5, 0x1), /* BR_INST_RETIRED.MISPRED */
@@ -370,14 +356,14 @@ static struct event_constraint intel_core2_pebs_event_constraints[] = {
370 EVENT_CONSTRAINT_END 356 EVENT_CONSTRAINT_END
371}; 357};
372 358
373static struct event_constraint intel_atom_pebs_event_constraints[] = { 359struct event_constraint intel_atom_pebs_event_constraints[] = {
374 INTEL_UEVENT_CONSTRAINT(0x00c0, 0x1), /* INST_RETIRED.ANY */ 360 INTEL_UEVENT_CONSTRAINT(0x00c0, 0x1), /* INST_RETIRED.ANY */
375 INTEL_UEVENT_CONSTRAINT(0x00c5, 0x1), /* MISPREDICTED_BRANCH_RETIRED */ 361 INTEL_UEVENT_CONSTRAINT(0x00c5, 0x1), /* MISPREDICTED_BRANCH_RETIRED */
376 INTEL_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED.* */ 362 INTEL_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED.* */
377 EVENT_CONSTRAINT_END 363 EVENT_CONSTRAINT_END
378}; 364};
379 365
380static struct event_constraint intel_nehalem_pebs_event_constraints[] = { 366struct event_constraint intel_nehalem_pebs_event_constraints[] = {
381 INTEL_EVENT_CONSTRAINT(0x0b, 0xf), /* MEM_INST_RETIRED.* */ 367 INTEL_EVENT_CONSTRAINT(0x0b, 0xf), /* MEM_INST_RETIRED.* */
382 INTEL_EVENT_CONSTRAINT(0x0f, 0xf), /* MEM_UNCORE_RETIRED.* */ 368 INTEL_EVENT_CONSTRAINT(0x0f, 0xf), /* MEM_UNCORE_RETIRED.* */
383 INTEL_UEVENT_CONSTRAINT(0x010c, 0xf), /* MEM_STORE_RETIRED.DTLB_MISS */ 369 INTEL_UEVENT_CONSTRAINT(0x010c, 0xf), /* MEM_STORE_RETIRED.DTLB_MISS */
@@ -392,7 +378,7 @@ static struct event_constraint intel_nehalem_pebs_event_constraints[] = {
392 EVENT_CONSTRAINT_END 378 EVENT_CONSTRAINT_END
393}; 379};
394 380
395static struct event_constraint intel_westmere_pebs_event_constraints[] = { 381struct event_constraint intel_westmere_pebs_event_constraints[] = {
396 INTEL_EVENT_CONSTRAINT(0x0b, 0xf), /* MEM_INST_RETIRED.* */ 382 INTEL_EVENT_CONSTRAINT(0x0b, 0xf), /* MEM_INST_RETIRED.* */
397 INTEL_EVENT_CONSTRAINT(0x0f, 0xf), /* MEM_UNCORE_RETIRED.* */ 383 INTEL_EVENT_CONSTRAINT(0x0f, 0xf), /* MEM_UNCORE_RETIRED.* */
398 INTEL_UEVENT_CONSTRAINT(0x010c, 0xf), /* MEM_STORE_RETIRED.DTLB_MISS */ 384 INTEL_UEVENT_CONSTRAINT(0x010c, 0xf), /* MEM_STORE_RETIRED.DTLB_MISS */
@@ -407,7 +393,7 @@ static struct event_constraint intel_westmere_pebs_event_constraints[] = {
407 EVENT_CONSTRAINT_END 393 EVENT_CONSTRAINT_END
408}; 394};
409 395
410static struct event_constraint intel_snb_pebs_events[] = { 396struct event_constraint intel_snb_pebs_event_constraints[] = {
411 INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */ 397 INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */
412 INTEL_UEVENT_CONSTRAINT(0x01c2, 0xf), /* UOPS_RETIRED.ALL */ 398 INTEL_UEVENT_CONSTRAINT(0x01c2, 0xf), /* UOPS_RETIRED.ALL */
413 INTEL_UEVENT_CONSTRAINT(0x02c2, 0xf), /* UOPS_RETIRED.RETIRE_SLOTS */ 399 INTEL_UEVENT_CONSTRAINT(0x02c2, 0xf), /* UOPS_RETIRED.RETIRE_SLOTS */
@@ -428,8 +414,7 @@ static struct event_constraint intel_snb_pebs_events[] = {
428 EVENT_CONSTRAINT_END 414 EVENT_CONSTRAINT_END
429}; 415};
430 416
431static struct event_constraint * 417struct event_constraint *intel_pebs_constraints(struct perf_event *event)
432intel_pebs_constraints(struct perf_event *event)
433{ 418{
434 struct event_constraint *c; 419 struct event_constraint *c;
435 420
@@ -446,7 +431,7 @@ intel_pebs_constraints(struct perf_event *event)
446 return &emptyconstraint; 431 return &emptyconstraint;
447} 432}
448 433
449static void intel_pmu_pebs_enable(struct perf_event *event) 434void intel_pmu_pebs_enable(struct perf_event *event)
450{ 435{
451 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 436 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
452 struct hw_perf_event *hwc = &event->hw; 437 struct hw_perf_event *hwc = &event->hw;
@@ -460,7 +445,7 @@ static void intel_pmu_pebs_enable(struct perf_event *event)
460 intel_pmu_lbr_enable(event); 445 intel_pmu_lbr_enable(event);
461} 446}
462 447
463static void intel_pmu_pebs_disable(struct perf_event *event) 448void intel_pmu_pebs_disable(struct perf_event *event)
464{ 449{
465 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 450 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
466 struct hw_perf_event *hwc = &event->hw; 451 struct hw_perf_event *hwc = &event->hw;
@@ -475,7 +460,7 @@ static void intel_pmu_pebs_disable(struct perf_event *event)
475 intel_pmu_lbr_disable(event); 460 intel_pmu_lbr_disable(event);
476} 461}
477 462
478static void intel_pmu_pebs_enable_all(void) 463void intel_pmu_pebs_enable_all(void)
479{ 464{
480 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 465 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
481 466
@@ -483,7 +468,7 @@ static void intel_pmu_pebs_enable_all(void)
483 wrmsrl(MSR_IA32_PEBS_ENABLE, cpuc->pebs_enabled); 468 wrmsrl(MSR_IA32_PEBS_ENABLE, cpuc->pebs_enabled);
484} 469}
485 470
486static void intel_pmu_pebs_disable_all(void) 471void intel_pmu_pebs_disable_all(void)
487{ 472{
488 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 473 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
489 474
@@ -576,8 +561,6 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs)
576 return 0; 561 return 0;
577} 562}
578 563
579static int intel_pmu_save_and_restart(struct perf_event *event);
580
581static void __intel_pmu_pebs_event(struct perf_event *event, 564static void __intel_pmu_pebs_event(struct perf_event *event,
582 struct pt_regs *iregs, void *__pebs) 565 struct pt_regs *iregs, void *__pebs)
583{ 566{
@@ -716,7 +699,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
716 * BTS, PEBS probe and setup 699 * BTS, PEBS probe and setup
717 */ 700 */
718 701
719static void intel_ds_init(void) 702void intel_ds_init(void)
720{ 703{
721 /* 704 /*
722 * No support for 32bit formats 705 * No support for 32bit formats
@@ -749,15 +732,3 @@ static void intel_ds_init(void)
749 } 732 }
750 } 733 }
751} 734}
752
753#else /* CONFIG_CPU_SUP_INTEL */
754
755static void reserve_ds_buffers(void)
756{
757}
758
759static void release_ds_buffers(void)
760{
761}
762
763#endif /* CONFIG_CPU_SUP_INTEL */
diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
index d202c1bece1..3fab3de3ce9 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
@@ -1,4 +1,10 @@
1#ifdef CONFIG_CPU_SUP_INTEL 1#include <linux/perf_event.h>
2#include <linux/types.h>
3
4#include <asm/perf_event.h>
5#include <asm/msr.h>
6
7#include "perf_event.h"
2 8
3enum { 9enum {
4 LBR_FORMAT_32 = 0x00, 10 LBR_FORMAT_32 = 0x00,
@@ -48,7 +54,7 @@ static void intel_pmu_lbr_reset_64(void)
48 } 54 }
49} 55}
50 56
51static void intel_pmu_lbr_reset(void) 57void intel_pmu_lbr_reset(void)
52{ 58{
53 if (!x86_pmu.lbr_nr) 59 if (!x86_pmu.lbr_nr)
54 return; 60 return;
@@ -59,7 +65,7 @@ static void intel_pmu_lbr_reset(void)
59 intel_pmu_lbr_reset_64(); 65 intel_pmu_lbr_reset_64();
60} 66}
61 67
62static void intel_pmu_lbr_enable(struct perf_event *event) 68void intel_pmu_lbr_enable(struct perf_event *event)
63{ 69{
64 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 70 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
65 71
@@ -81,7 +87,7 @@ static void intel_pmu_lbr_enable(struct perf_event *event)
81 cpuc->lbr_users++; 87 cpuc->lbr_users++;
82} 88}
83 89
84static void intel_pmu_lbr_disable(struct perf_event *event) 90void intel_pmu_lbr_disable(struct perf_event *event)
85{ 91{
86 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 92 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
87 93
@@ -95,7 +101,7 @@ static void intel_pmu_lbr_disable(struct perf_event *event)
95 __intel_pmu_lbr_disable(); 101 __intel_pmu_lbr_disable();
96} 102}
97 103
98static void intel_pmu_lbr_enable_all(void) 104void intel_pmu_lbr_enable_all(void)
99{ 105{
100 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 106 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
101 107
@@ -103,7 +109,7 @@ static void intel_pmu_lbr_enable_all(void)
103 __intel_pmu_lbr_enable(); 109 __intel_pmu_lbr_enable();
104} 110}
105 111
106static void intel_pmu_lbr_disable_all(void) 112void intel_pmu_lbr_disable_all(void)
107{ 113{
108 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 114 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
109 115
@@ -178,7 +184,7 @@ static void intel_pmu_lbr_read_64(struct cpu_hw_events *cpuc)
178 cpuc->lbr_stack.nr = i; 184 cpuc->lbr_stack.nr = i;
179} 185}
180 186
181static void intel_pmu_lbr_read(void) 187void intel_pmu_lbr_read(void)
182{ 188{
183 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 189 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
184 190
@@ -191,7 +197,7 @@ static void intel_pmu_lbr_read(void)
191 intel_pmu_lbr_read_64(cpuc); 197 intel_pmu_lbr_read_64(cpuc);
192} 198}
193 199
194static void intel_pmu_lbr_init_core(void) 200void intel_pmu_lbr_init_core(void)
195{ 201{
196 x86_pmu.lbr_nr = 4; 202 x86_pmu.lbr_nr = 4;
197 x86_pmu.lbr_tos = 0x01c9; 203 x86_pmu.lbr_tos = 0x01c9;
@@ -199,7 +205,7 @@ static void intel_pmu_lbr_init_core(void)
199 x86_pmu.lbr_to = 0x60; 205 x86_pmu.lbr_to = 0x60;
200} 206}
201 207
202static void intel_pmu_lbr_init_nhm(void) 208void intel_pmu_lbr_init_nhm(void)
203{ 209{
204 x86_pmu.lbr_nr = 16; 210 x86_pmu.lbr_nr = 16;
205 x86_pmu.lbr_tos = 0x01c9; 211 x86_pmu.lbr_tos = 0x01c9;
@@ -207,12 +213,10 @@ static void intel_pmu_lbr_init_nhm(void)
207 x86_pmu.lbr_to = 0x6c0; 213 x86_pmu.lbr_to = 0x6c0;
208} 214}
209 215
210static void intel_pmu_lbr_init_atom(void) 216void intel_pmu_lbr_init_atom(void)
211{ 217{
212 x86_pmu.lbr_nr = 8; 218 x86_pmu.lbr_nr = 8;
213 x86_pmu.lbr_tos = 0x01c9; 219 x86_pmu.lbr_tos = 0x01c9;
214 x86_pmu.lbr_from = 0x40; 220 x86_pmu.lbr_from = 0x40;
215 x86_pmu.lbr_to = 0x60; 221 x86_pmu.lbr_to = 0x60;
216} 222}
217
218#endif /* CONFIG_CPU_SUP_INTEL */
diff --git a/arch/x86/kernel/cpu/perf_event_p4.c b/arch/x86/kernel/cpu/perf_event_p4.c
index 7809d2bcb20..492bf1358a7 100644
--- a/arch/x86/kernel/cpu/perf_event_p4.c
+++ b/arch/x86/kernel/cpu/perf_event_p4.c
@@ -7,9 +7,13 @@
7 * For licencing details see kernel-base/COPYING 7 * For licencing details see kernel-base/COPYING
8 */ 8 */
9 9
10#ifdef CONFIG_CPU_SUP_INTEL 10#include <linux/perf_event.h>
11 11
12#include <asm/perf_event_p4.h> 12#include <asm/perf_event_p4.h>
13#include <asm/hardirq.h>
14#include <asm/apic.h>
15
16#include "perf_event.h"
13 17
14#define P4_CNTR_LIMIT 3 18#define P4_CNTR_LIMIT 3
15/* 19/*
@@ -1303,7 +1307,7 @@ static __initconst const struct x86_pmu p4_pmu = {
1303 .perfctr_second_write = 1, 1307 .perfctr_second_write = 1,
1304}; 1308};
1305 1309
1306static __init int p4_pmu_init(void) 1310__init int p4_pmu_init(void)
1307{ 1311{
1308 unsigned int low, high; 1312 unsigned int low, high;
1309 1313
@@ -1326,5 +1330,3 @@ static __init int p4_pmu_init(void)
1326 1330
1327 return 0; 1331 return 0;
1328} 1332}
1329
1330#endif /* CONFIG_CPU_SUP_INTEL */
diff --git a/arch/x86/kernel/cpu/perf_event_p6.c b/arch/x86/kernel/cpu/perf_event_p6.c
index 20c097e3386..c7181befecd 100644
--- a/arch/x86/kernel/cpu/perf_event_p6.c
+++ b/arch/x86/kernel/cpu/perf_event_p6.c
@@ -1,4 +1,7 @@
1#ifdef CONFIG_CPU_SUP_INTEL 1#include <linux/perf_event.h>
2#include <linux/types.h>
3
4#include "perf_event.h"
2 5
3/* 6/*
4 * Not sure about some of these 7 * Not sure about some of these
@@ -114,7 +117,7 @@ static __initconst const struct x86_pmu p6_pmu = {
114 .event_constraints = p6_event_constraints, 117 .event_constraints = p6_event_constraints,
115}; 118};
116 119
117static __init int p6_pmu_init(void) 120__init int p6_pmu_init(void)
118{ 121{
119 switch (boot_cpu_data.x86_model) { 122 switch (boot_cpu_data.x86_model) {
120 case 1: 123 case 1:
@@ -138,5 +141,3 @@ static __init int p6_pmu_init(void)
138 141
139 return 0; 142 return 0;
140} 143}
141
142#endif /* CONFIG_CPU_SUP_INTEL */
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 764c7c2b181..13ad89971d4 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -32,15 +32,12 @@ int in_crash_kexec;
32 32
33#if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC) 33#if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC)
34 34
35static void kdump_nmi_callback(int cpu, struct die_args *args) 35static void kdump_nmi_callback(int cpu, struct pt_regs *regs)
36{ 36{
37 struct pt_regs *regs;
38#ifdef CONFIG_X86_32 37#ifdef CONFIG_X86_32
39 struct pt_regs fixed_regs; 38 struct pt_regs fixed_regs;
40#endif 39#endif
41 40
42 regs = args->regs;
43
44#ifdef CONFIG_X86_32 41#ifdef CONFIG_X86_32
45 if (!user_mode_vm(regs)) { 42 if (!user_mode_vm(regs)) {
46 crash_fixup_ss_esp(&fixed_regs, regs); 43 crash_fixup_ss_esp(&fixed_regs, regs);
diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c
index 3fee346ef54..cacdd46d184 100644
--- a/arch/x86/kernel/jump_label.c
+++ b/arch/x86/kernel/jump_label.c
@@ -42,7 +42,7 @@ void arch_jump_label_transform(struct jump_entry *entry,
42 put_online_cpus(); 42 put_online_cpus();
43} 43}
44 44
45void arch_jump_label_text_poke_early(jump_label_t addr) 45void __init_or_module arch_jump_label_text_poke_early(jump_label_t addr)
46{ 46{
47 text_poke_early((void *)addr, ideal_nops[NOP_ATOMIC5], 47 text_poke_early((void *)addr, ideal_nops[NOP_ATOMIC5],
48 JUMP_LABEL_NOP_SIZE); 48 JUMP_LABEL_NOP_SIZE);
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index 00354d4919a..faba5771aca 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -511,28 +511,37 @@ single_step_cont(struct pt_regs *regs, struct die_args *args)
511 511
512static int was_in_debug_nmi[NR_CPUS]; 512static int was_in_debug_nmi[NR_CPUS];
513 513
514static int __kgdb_notify(struct die_args *args, unsigned long cmd) 514static int kgdb_nmi_handler(unsigned int cmd, struct pt_regs *regs)
515{ 515{
516 struct pt_regs *regs = args->regs;
517
518 switch (cmd) { 516 switch (cmd) {
519 case DIE_NMI: 517 case NMI_LOCAL:
520 if (atomic_read(&kgdb_active) != -1) { 518 if (atomic_read(&kgdb_active) != -1) {
521 /* KGDB CPU roundup */ 519 /* KGDB CPU roundup */
522 kgdb_nmicallback(raw_smp_processor_id(), regs); 520 kgdb_nmicallback(raw_smp_processor_id(), regs);
523 was_in_debug_nmi[raw_smp_processor_id()] = 1; 521 was_in_debug_nmi[raw_smp_processor_id()] = 1;
524 touch_nmi_watchdog(); 522 touch_nmi_watchdog();
525 return NOTIFY_STOP; 523 return NMI_HANDLED;
526 } 524 }
527 return NOTIFY_DONE; 525 break;
528 526
529 case DIE_NMIUNKNOWN: 527 case NMI_UNKNOWN:
530 if (was_in_debug_nmi[raw_smp_processor_id()]) { 528 if (was_in_debug_nmi[raw_smp_processor_id()]) {
531 was_in_debug_nmi[raw_smp_processor_id()] = 0; 529 was_in_debug_nmi[raw_smp_processor_id()] = 0;
532 return NOTIFY_STOP; 530 return NMI_HANDLED;
533 } 531 }
534 return NOTIFY_DONE; 532 break;
533 default:
534 /* do nothing */
535 break;
536 }
537 return NMI_DONE;
538}
539
540static int __kgdb_notify(struct die_args *args, unsigned long cmd)
541{
542 struct pt_regs *regs = args->regs;
535 543
544 switch (cmd) {
536 case DIE_DEBUG: 545 case DIE_DEBUG:
537 if (atomic_read(&kgdb_cpu_doing_single_step) != -1) { 546 if (atomic_read(&kgdb_cpu_doing_single_step) != -1) {
538 if (user_mode(regs)) 547 if (user_mode(regs))
@@ -590,11 +599,6 @@ kgdb_notify(struct notifier_block *self, unsigned long cmd, void *ptr)
590 599
591static struct notifier_block kgdb_notifier = { 600static struct notifier_block kgdb_notifier = {
592 .notifier_call = kgdb_notify, 601 .notifier_call = kgdb_notify,
593
594 /*
595 * Lowest-prio notifier priority, we want to be notified last:
596 */
597 .priority = NMI_LOCAL_LOW_PRIOR,
598}; 602};
599 603
600/** 604/**
@@ -605,7 +609,31 @@ static struct notifier_block kgdb_notifier = {
605 */ 609 */
606int kgdb_arch_init(void) 610int kgdb_arch_init(void)
607{ 611{
608 return register_die_notifier(&kgdb_notifier); 612 int retval;
613
614 retval = register_die_notifier(&kgdb_notifier);
615 if (retval)
616 goto out;
617
618 retval = register_nmi_handler(NMI_LOCAL, kgdb_nmi_handler,
619 0, "kgdb");
620 if (retval)
621 goto out1;
622
623 retval = register_nmi_handler(NMI_UNKNOWN, kgdb_nmi_handler,
624 0, "kgdb");
625
626 if (retval)
627 goto out2;
628
629 return retval;
630
631out2:
632 unregister_nmi_handler(NMI_LOCAL, "kgdb");
633out1:
634 unregister_die_notifier(&kgdb_notifier);
635out:
636 return retval;
609} 637}
610 638
611static void kgdb_hw_overflow_handler(struct perf_event *event, 639static void kgdb_hw_overflow_handler(struct perf_event *event,
@@ -673,6 +701,8 @@ void kgdb_arch_exit(void)
673 breakinfo[i].pev = NULL; 701 breakinfo[i].pev = NULL;
674 } 702 }
675 } 703 }
704 unregister_nmi_handler(NMI_UNKNOWN, "kgdb");
705 unregister_nmi_handler(NMI_LOCAL, "kgdb");
676 unregister_die_notifier(&kgdb_notifier); 706 unregister_die_notifier(&kgdb_notifier);
677} 707}
678 708
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
index f1a6244d7d9..7da647d8b64 100644
--- a/arch/x86/kernel/kprobes.c
+++ b/arch/x86/kernel/kprobes.c
@@ -75,8 +75,11 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
75 /* 75 /*
76 * Undefined/reserved opcodes, conditional jump, Opcode Extension 76 * Undefined/reserved opcodes, conditional jump, Opcode Extension
77 * Groups, and some special opcodes can not boost. 77 * Groups, and some special opcodes can not boost.
78 * This is non-const and volatile to keep gcc from statically
79 * optimizing it out, as variable_test_bit makes gcc think only
80 * *(unsigned long*) is used.
78 */ 81 */
79static const u32 twobyte_is_boostable[256 / 32] = { 82static volatile u32 twobyte_is_boostable[256 / 32] = {
80 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ 83 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
81 /* ---------------------------------------------- */ 84 /* ---------------------------------------------- */
82 W(0x00, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0) | /* 00 */ 85 W(0x00, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0) | /* 00 */
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
new file mode 100644
index 00000000000..7ec5bd140b8
--- /dev/null
+++ b/arch/x86/kernel/nmi.c
@@ -0,0 +1,433 @@
1/*
2 * Copyright (C) 1991, 1992 Linus Torvalds
3 * Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs
4 * Copyright (C) 2011 Don Zickus Red Hat, Inc.
5 *
6 * Pentium III FXSR, SSE support
7 * Gareth Hughes <gareth@valinux.com>, May 2000
8 */
9
10/*
11 * Handle hardware traps and faults.
12 */
13#include <linux/spinlock.h>
14#include <linux/kprobes.h>
15#include <linux/kdebug.h>
16#include <linux/nmi.h>
17#include <linux/delay.h>
18#include <linux/hardirq.h>
19#include <linux/slab.h>
20
21#include <linux/mca.h>
22
23#if defined(CONFIG_EDAC)
24#include <linux/edac.h>
25#endif
26
27#include <linux/atomic.h>
28#include <asm/traps.h>
29#include <asm/mach_traps.h>
30#include <asm/nmi.h>
31
32#define NMI_MAX_NAMELEN 16
33struct nmiaction {
34 struct list_head list;
35 nmi_handler_t handler;
36 unsigned int flags;
37 char *name;
38};
39
40struct nmi_desc {
41 spinlock_t lock;
42 struct list_head head;
43};
44
45static struct nmi_desc nmi_desc[NMI_MAX] =
46{
47 {
48 .lock = __SPIN_LOCK_UNLOCKED(&nmi_desc[0].lock),
49 .head = LIST_HEAD_INIT(nmi_desc[0].head),
50 },
51 {
52 .lock = __SPIN_LOCK_UNLOCKED(&nmi_desc[1].lock),
53 .head = LIST_HEAD_INIT(nmi_desc[1].head),
54 },
55
56};
57
58struct nmi_stats {
59 unsigned int normal;
60 unsigned int unknown;
61 unsigned int external;
62 unsigned int swallow;
63};
64
65static DEFINE_PER_CPU(struct nmi_stats, nmi_stats);
66
67static int ignore_nmis;
68
69int unknown_nmi_panic;
70/*
71 * Prevent NMI reason port (0x61) being accessed simultaneously, can
72 * only be used in NMI handler.
73 */
74static DEFINE_RAW_SPINLOCK(nmi_reason_lock);
75
76static int __init setup_unknown_nmi_panic(char *str)
77{
78 unknown_nmi_panic = 1;
79 return 1;
80}
81__setup("unknown_nmi_panic", setup_unknown_nmi_panic);
82
83#define nmi_to_desc(type) (&nmi_desc[type])
84
85static int notrace __kprobes nmi_handle(unsigned int type, struct pt_regs *regs, bool b2b)
86{
87 struct nmi_desc *desc = nmi_to_desc(type);
88 struct nmiaction *a;
89 int handled=0;
90
91 rcu_read_lock();
92
93 /*
94 * NMIs are edge-triggered, which means if you have enough
95 * of them concurrently, you can lose some because only one
96 * can be latched at any given time. Walk the whole list
97 * to handle those situations.
98 */
99 list_for_each_entry_rcu(a, &desc->head, list)
100 handled += a->handler(type, regs);
101
102 rcu_read_unlock();
103
104 /* return total number of NMI events handled */
105 return handled;
106}
107
108static int __setup_nmi(unsigned int type, struct nmiaction *action)
109{
110 struct nmi_desc *desc = nmi_to_desc(type);
111 unsigned long flags;
112
113 spin_lock_irqsave(&desc->lock, flags);
114
115 /*
116 * most handlers of type NMI_UNKNOWN never return because
117 * they just assume the NMI is theirs. Just a sanity check
118 * to manage expectations
119 */
120 WARN_ON_ONCE(type == NMI_UNKNOWN && !list_empty(&desc->head));
121
122 /*
123 * some handlers need to be executed first otherwise a fake
124 * event confuses some handlers (kdump uses this flag)
125 */
126 if (action->flags & NMI_FLAG_FIRST)
127 list_add_rcu(&action->list, &desc->head);
128 else
129 list_add_tail_rcu(&action->list, &desc->head);
130
131 spin_unlock_irqrestore(&desc->lock, flags);
132 return 0;
133}
134
135static struct nmiaction *__free_nmi(unsigned int type, const char *name)
136{
137 struct nmi_desc *desc = nmi_to_desc(type);
138 struct nmiaction *n;
139 unsigned long flags;
140
141 spin_lock_irqsave(&desc->lock, flags);
142
143 list_for_each_entry_rcu(n, &desc->head, list) {
144 /*
145 * the name passed in to describe the nmi handler
146 * is used as the lookup key
147 */
148 if (!strcmp(n->name, name)) {
149 WARN(in_nmi(),
150 "Trying to free NMI (%s) from NMI context!\n", n->name);
151 list_del_rcu(&n->list);
152 break;
153 }
154 }
155
156 spin_unlock_irqrestore(&desc->lock, flags);
157 synchronize_rcu();
158 return (n);
159}
160
161int register_nmi_handler(unsigned int type, nmi_handler_t handler,
162 unsigned long nmiflags, const char *devname)
163{
164 struct nmiaction *action;
165 int retval = -ENOMEM;
166
167 if (!handler)
168 return -EINVAL;
169
170 action = kzalloc(sizeof(struct nmiaction), GFP_KERNEL);
171 if (!action)
172 goto fail_action;
173
174 action->handler = handler;
175 action->flags = nmiflags;
176 action->name = kstrndup(devname, NMI_MAX_NAMELEN, GFP_KERNEL);
177 if (!action->name)
178 goto fail_action_name;
179
180 retval = __setup_nmi(type, action);
181
182 if (retval)
183 goto fail_setup_nmi;
184
185 return retval;
186
187fail_setup_nmi:
188 kfree(action->name);
189fail_action_name:
190 kfree(action);
191fail_action:
192
193 return retval;
194}
195EXPORT_SYMBOL_GPL(register_nmi_handler);
196
197void unregister_nmi_handler(unsigned int type, const char *name)
198{
199 struct nmiaction *a;
200
201 a = __free_nmi(type, name);
202 if (a) {
203 kfree(a->name);
204 kfree(a);
205 }
206}
207
208EXPORT_SYMBOL_GPL(unregister_nmi_handler);
209
210static notrace __kprobes void
211pci_serr_error(unsigned char reason, struct pt_regs *regs)
212{
213 pr_emerg("NMI: PCI system error (SERR) for reason %02x on CPU %d.\n",
214 reason, smp_processor_id());
215
216 /*
217 * On some machines, PCI SERR line is used to report memory
218 * errors. EDAC makes use of it.
219 */
220#if defined(CONFIG_EDAC)
221 if (edac_handler_set()) {
222 edac_atomic_assert_error();
223 return;
224 }
225#endif
226
227 if (panic_on_unrecovered_nmi)
228 panic("NMI: Not continuing");
229
230 pr_emerg("Dazed and confused, but trying to continue\n");
231
232 /* Clear and disable the PCI SERR error line. */
233 reason = (reason & NMI_REASON_CLEAR_MASK) | NMI_REASON_CLEAR_SERR;
234 outb(reason, NMI_REASON_PORT);
235}
236
237static notrace __kprobes void
238io_check_error(unsigned char reason, struct pt_regs *regs)
239{
240 unsigned long i;
241
242 pr_emerg(
243 "NMI: IOCK error (debug interrupt?) for reason %02x on CPU %d.\n",
244 reason, smp_processor_id());
245 show_registers(regs);
246
247 if (panic_on_io_nmi)
248 panic("NMI IOCK error: Not continuing");
249
250 /* Re-enable the IOCK line, wait for a few seconds */
251 reason = (reason & NMI_REASON_CLEAR_MASK) | NMI_REASON_CLEAR_IOCHK;
252 outb(reason, NMI_REASON_PORT);
253
254 i = 20000;
255 while (--i) {
256 touch_nmi_watchdog();
257 udelay(100);
258 }
259
260 reason &= ~NMI_REASON_CLEAR_IOCHK;
261 outb(reason, NMI_REASON_PORT);
262}
263
264static notrace __kprobes void
265unknown_nmi_error(unsigned char reason, struct pt_regs *regs)
266{
267 int handled;
268
269 /*
270 * Use 'false' as back-to-back NMIs are dealt with one level up.
271 * Of course this makes having multiple 'unknown' handlers useless
272 * as only the first one is ever run (unless it can actually determine
273 * if it caused the NMI)
274 */
275 handled = nmi_handle(NMI_UNKNOWN, regs, false);
276 if (handled) {
277 __this_cpu_add(nmi_stats.unknown, handled);
278 return;
279 }
280
281 __this_cpu_add(nmi_stats.unknown, 1);
282
283#ifdef CONFIG_MCA
284 /*
285 * Might actually be able to figure out what the guilty party
286 * is:
287 */
288 if (MCA_bus) {
289 mca_handle_nmi();
290 return;
291 }
292#endif
293 pr_emerg("Uhhuh. NMI received for unknown reason %02x on CPU %d.\n",
294 reason, smp_processor_id());
295
296 pr_emerg("Do you have a strange power saving mode enabled?\n");
297 if (unknown_nmi_panic || panic_on_unrecovered_nmi)
298 panic("NMI: Not continuing");
299
300 pr_emerg("Dazed and confused, but trying to continue\n");
301}
302
303static DEFINE_PER_CPU(bool, swallow_nmi);
304static DEFINE_PER_CPU(unsigned long, last_nmi_rip);
305
306static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
307{
308 unsigned char reason = 0;
309 int handled;
310 bool b2b = false;
311
312 /*
313 * CPU-specific NMI must be processed before non-CPU-specific
314 * NMI, otherwise we may lose it, because the CPU-specific
315 * NMI can not be detected/processed on other CPUs.
316 */
317
318 /*
319 * Back-to-back NMIs are interesting because they can either
320 * be two NMI or more than two NMIs (any thing over two is dropped
321 * due to NMI being edge-triggered). If this is the second half
322 * of the back-to-back NMI, assume we dropped things and process
323 * more handlers. Otherwise reset the 'swallow' NMI behaviour
324 */
325 if (regs->ip == __this_cpu_read(last_nmi_rip))
326 b2b = true;
327 else
328 __this_cpu_write(swallow_nmi, false);
329
330 __this_cpu_write(last_nmi_rip, regs->ip);
331
332 handled = nmi_handle(NMI_LOCAL, regs, b2b);
333 __this_cpu_add(nmi_stats.normal, handled);
334 if (handled) {
335 /*
336 * There are cases when a NMI handler handles multiple
337 * events in the current NMI. One of these events may
338 * be queued for in the next NMI. Because the event is
339 * already handled, the next NMI will result in an unknown
340 * NMI. Instead lets flag this for a potential NMI to
341 * swallow.
342 */
343 if (handled > 1)
344 __this_cpu_write(swallow_nmi, true);
345 return;
346 }
347
348 /* Non-CPU-specific NMI: NMI sources can be processed on any CPU */
349 raw_spin_lock(&nmi_reason_lock);
350 reason = get_nmi_reason();
351
352 if (reason & NMI_REASON_MASK) {
353 if (reason & NMI_REASON_SERR)
354 pci_serr_error(reason, regs);
355 else if (reason & NMI_REASON_IOCHK)
356 io_check_error(reason, regs);
357#ifdef CONFIG_X86_32
358 /*
359 * Reassert NMI in case it became active
360 * meanwhile as it's edge-triggered:
361 */
362 reassert_nmi();
363#endif
364 __this_cpu_add(nmi_stats.external, 1);
365 raw_spin_unlock(&nmi_reason_lock);
366 return;
367 }
368 raw_spin_unlock(&nmi_reason_lock);
369
370 /*
371 * Only one NMI can be latched at a time. To handle
372 * this we may process multiple nmi handlers at once to
373 * cover the case where an NMI is dropped. The downside
374 * to this approach is we may process an NMI prematurely,
375 * while its real NMI is sitting latched. This will cause
376 * an unknown NMI on the next run of the NMI processing.
377 *
378 * We tried to flag that condition above, by setting the
379 * swallow_nmi flag when we process more than one event.
380 * This condition is also only present on the second half
381 * of a back-to-back NMI, so we flag that condition too.
382 *
383 * If both are true, we assume we already processed this
384 * NMI previously and we swallow it. Otherwise we reset
385 * the logic.
386 *
387 * There are scenarios where we may accidentally swallow
388 * a 'real' unknown NMI. For example, while processing
389 * a perf NMI another perf NMI comes in along with a
390 * 'real' unknown NMI. These two NMIs get combined into
391 * one (as descibed above). When the next NMI gets
392 * processed, it will be flagged by perf as handled, but
393 * noone will know that there was a 'real' unknown NMI sent
394 * also. As a result it gets swallowed. Or if the first
395 * perf NMI returns two events handled then the second
396 * NMI will get eaten by the logic below, again losing a
397 * 'real' unknown NMI. But this is the best we can do
398 * for now.
399 */
400 if (b2b && __this_cpu_read(swallow_nmi))
401 __this_cpu_add(nmi_stats.swallow, 1);
402 else
403 unknown_nmi_error(reason, regs);
404}
405
406dotraplinkage notrace __kprobes void
407do_nmi(struct pt_regs *regs, long error_code)
408{
409 nmi_enter();
410
411 inc_irq_stat(__nmi_count);
412
413 if (!ignore_nmis)
414 default_do_nmi(regs);
415
416 nmi_exit();
417}
418
419void stop_nmi(void)
420{
421 ignore_nmis++;
422}
423
424void restart_nmi(void)
425{
426 ignore_nmis--;
427}
428
429/* reset the back-to-back NMI logic */
430void local_touch_nmi(void)
431{
432 __this_cpu_write(last_nmi_rip, 0);
433}
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index b49d00da2ae..622872054fb 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -117,8 +117,8 @@ again:
117} 117}
118 118
119/* 119/*
120 * See <Documentation/x86_64/boot-options.txt> for the iommu kernel parameter 120 * See <Documentation/x86/x86_64/boot-options.txt> for the iommu kernel
121 * documentation. 121 * parameter documentation.
122 */ 122 */
123static __init int iommu_setup(char *p) 123static __init int iommu_setup(char *p)
124{ 124{
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 7a3b65107a2..795b79f984c 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -57,6 +57,7 @@
57#include <asm/idle.h> 57#include <asm/idle.h>
58#include <asm/syscalls.h> 58#include <asm/syscalls.h>
59#include <asm/debugreg.h> 59#include <asm/debugreg.h>
60#include <asm/nmi.h>
60 61
61asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); 62asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
62 63
@@ -107,6 +108,7 @@ void cpu_idle(void)
107 if (cpu_is_offline(cpu)) 108 if (cpu_is_offline(cpu))
108 play_dead(); 109 play_dead();
109 110
111 local_touch_nmi();
110 local_irq_disable(); 112 local_irq_disable();
111 /* Don't trace irqs off for idle */ 113 /* Don't trace irqs off for idle */
112 stop_critical_timings(); 114 stop_critical_timings();
@@ -262,7 +264,7 @@ EXPORT_SYMBOL_GPL(start_thread);
262 264
263 265
264/* 266/*
265 * switch_to(x,yn) should switch tasks from x to y. 267 * switch_to(x,y) should switch tasks from x to y.
266 * 268 *
267 * We fsave/fwait so that an exception goes off at the right time 269 * We fsave/fwait so that an exception goes off at the right time
268 * (as a call from the fsave or fwait in effect) rather than to 270 * (as a call from the fsave or fwait in effect) rather than to
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index f693e44e1bf..3bd7e6eebf3 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -51,6 +51,7 @@
51#include <asm/idle.h> 51#include <asm/idle.h>
52#include <asm/syscalls.h> 52#include <asm/syscalls.h>
53#include <asm/debugreg.h> 53#include <asm/debugreg.h>
54#include <asm/nmi.h>
54 55
55asmlinkage extern void ret_from_fork(void); 56asmlinkage extern void ret_from_fork(void);
56 57
@@ -133,6 +134,7 @@ void cpu_idle(void)
133 * from here on, until they go to idle. 134 * from here on, until they go to idle.
134 * Otherwise, idle callbacks can misfire. 135 * Otherwise, idle callbacks can misfire.
135 */ 136 */
137 local_touch_nmi();
136 local_irq_disable(); 138 local_irq_disable();
137 enter_idle(); 139 enter_idle();
138 /* Don't trace irqs off for idle */ 140 /* Don't trace irqs off for idle */
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 9242436e993..e334be1182b 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -464,7 +464,7 @@ static inline void kb_wait(void)
464 } 464 }
465} 465}
466 466
467static void vmxoff_nmi(int cpu, struct die_args *args) 467static void vmxoff_nmi(int cpu, struct pt_regs *regs)
468{ 468{
469 cpu_emergency_vmxoff(); 469 cpu_emergency_vmxoff();
470} 470}
@@ -736,14 +736,10 @@ static nmi_shootdown_cb shootdown_callback;
736 736
737static atomic_t waiting_for_crash_ipi; 737static atomic_t waiting_for_crash_ipi;
738 738
739static int crash_nmi_callback(struct notifier_block *self, 739static int crash_nmi_callback(unsigned int val, struct pt_regs *regs)
740 unsigned long val, void *data)
741{ 740{
742 int cpu; 741 int cpu;
743 742
744 if (val != DIE_NMI)
745 return NOTIFY_OK;
746
747 cpu = raw_smp_processor_id(); 743 cpu = raw_smp_processor_id();
748 744
749 /* Don't do anything if this handler is invoked on crashing cpu. 745 /* Don't do anything if this handler is invoked on crashing cpu.
@@ -751,10 +747,10 @@ static int crash_nmi_callback(struct notifier_block *self,
751 * an NMI if system was initially booted with nmi_watchdog parameter. 747 * an NMI if system was initially booted with nmi_watchdog parameter.
752 */ 748 */
753 if (cpu == crashing_cpu) 749 if (cpu == crashing_cpu)
754 return NOTIFY_STOP; 750 return NMI_HANDLED;
755 local_irq_disable(); 751 local_irq_disable();
756 752
757 shootdown_callback(cpu, (struct die_args *)data); 753 shootdown_callback(cpu, regs);
758 754
759 atomic_dec(&waiting_for_crash_ipi); 755 atomic_dec(&waiting_for_crash_ipi);
760 /* Assume hlt works */ 756 /* Assume hlt works */
@@ -762,7 +758,7 @@ static int crash_nmi_callback(struct notifier_block *self,
762 for (;;) 758 for (;;)
763 cpu_relax(); 759 cpu_relax();
764 760
765 return 1; 761 return NMI_HANDLED;
766} 762}
767 763
768static void smp_send_nmi_allbutself(void) 764static void smp_send_nmi_allbutself(void)
@@ -770,12 +766,6 @@ static void smp_send_nmi_allbutself(void)
770 apic->send_IPI_allbutself(NMI_VECTOR); 766 apic->send_IPI_allbutself(NMI_VECTOR);
771} 767}
772 768
773static struct notifier_block crash_nmi_nb = {
774 .notifier_call = crash_nmi_callback,
775 /* we want to be the first one called */
776 .priority = NMI_LOCAL_HIGH_PRIOR+1,
777};
778
779/* Halt all other CPUs, calling the specified function on each of them 769/* Halt all other CPUs, calling the specified function on each of them
780 * 770 *
781 * This function can be used to halt all other CPUs on crash 771 * This function can be used to halt all other CPUs on crash
@@ -794,7 +784,8 @@ void nmi_shootdown_cpus(nmi_shootdown_cb callback)
794 784
795 atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1); 785 atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1);
796 /* Would it be better to replace the trap vector here? */ 786 /* Would it be better to replace the trap vector here? */
797 if (register_die_notifier(&crash_nmi_nb)) 787 if (register_nmi_handler(NMI_LOCAL, crash_nmi_callback,
788 NMI_FLAG_FIRST, "crash"))
798 return; /* return what? */ 789 return; /* return what? */
799 /* Ensure the new callback function is set before sending 790 /* Ensure the new callback function is set before sending
800 * out the NMI 791 * out the NMI
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 6913369c234..a8e3eb83466 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -81,15 +81,6 @@ gate_desc idt_table[NR_VECTORS] __page_aligned_data = { { { { 0, 0 } } }, };
81DECLARE_BITMAP(used_vectors, NR_VECTORS); 81DECLARE_BITMAP(used_vectors, NR_VECTORS);
82EXPORT_SYMBOL_GPL(used_vectors); 82EXPORT_SYMBOL_GPL(used_vectors);
83 83
84static int ignore_nmis;
85
86int unknown_nmi_panic;
87/*
88 * Prevent NMI reason port (0x61) being accessed simultaneously, can
89 * only be used in NMI handler.
90 */
91static DEFINE_RAW_SPINLOCK(nmi_reason_lock);
92
93static inline void conditional_sti(struct pt_regs *regs) 84static inline void conditional_sti(struct pt_regs *regs)
94{ 85{
95 if (regs->flags & X86_EFLAGS_IF) 86 if (regs->flags & X86_EFLAGS_IF)
@@ -307,152 +298,6 @@ gp_in_kernel:
307 die("general protection fault", regs, error_code); 298 die("general protection fault", regs, error_code);
308} 299}
309 300
310static int __init setup_unknown_nmi_panic(char *str)
311{
312 unknown_nmi_panic = 1;
313 return 1;
314}
315__setup("unknown_nmi_panic", setup_unknown_nmi_panic);
316
317static notrace __kprobes void
318pci_serr_error(unsigned char reason, struct pt_regs *regs)
319{
320 pr_emerg("NMI: PCI system error (SERR) for reason %02x on CPU %d.\n",
321 reason, smp_processor_id());
322
323 /*
324 * On some machines, PCI SERR line is used to report memory
325 * errors. EDAC makes use of it.
326 */
327#if defined(CONFIG_EDAC)
328 if (edac_handler_set()) {
329 edac_atomic_assert_error();
330 return;
331 }
332#endif
333
334 if (panic_on_unrecovered_nmi)
335 panic("NMI: Not continuing");
336
337 pr_emerg("Dazed and confused, but trying to continue\n");
338
339 /* Clear and disable the PCI SERR error line. */
340 reason = (reason & NMI_REASON_CLEAR_MASK) | NMI_REASON_CLEAR_SERR;
341 outb(reason, NMI_REASON_PORT);
342}
343
344static notrace __kprobes void
345io_check_error(unsigned char reason, struct pt_regs *regs)
346{
347 unsigned long i;
348
349 pr_emerg(
350 "NMI: IOCK error (debug interrupt?) for reason %02x on CPU %d.\n",
351 reason, smp_processor_id());
352 show_registers(regs);
353
354 if (panic_on_io_nmi)
355 panic("NMI IOCK error: Not continuing");
356
357 /* Re-enable the IOCK line, wait for a few seconds */
358 reason = (reason & NMI_REASON_CLEAR_MASK) | NMI_REASON_CLEAR_IOCHK;
359 outb(reason, NMI_REASON_PORT);
360
361 i = 20000;
362 while (--i) {
363 touch_nmi_watchdog();
364 udelay(100);
365 }
366
367 reason &= ~NMI_REASON_CLEAR_IOCHK;
368 outb(reason, NMI_REASON_PORT);
369}
370
371static notrace __kprobes void
372unknown_nmi_error(unsigned char reason, struct pt_regs *regs)
373{
374 if (notify_die(DIE_NMIUNKNOWN, "nmi", regs, reason, 2, SIGINT) ==
375 NOTIFY_STOP)
376 return;
377#ifdef CONFIG_MCA
378 /*
379 * Might actually be able to figure out what the guilty party
380 * is:
381 */
382 if (MCA_bus) {
383 mca_handle_nmi();
384 return;
385 }
386#endif
387 pr_emerg("Uhhuh. NMI received for unknown reason %02x on CPU %d.\n",
388 reason, smp_processor_id());
389
390 pr_emerg("Do you have a strange power saving mode enabled?\n");
391 if (unknown_nmi_panic || panic_on_unrecovered_nmi)
392 panic("NMI: Not continuing");
393
394 pr_emerg("Dazed and confused, but trying to continue\n");
395}
396
397static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
398{
399 unsigned char reason = 0;
400
401 /*
402 * CPU-specific NMI must be processed before non-CPU-specific
403 * NMI, otherwise we may lose it, because the CPU-specific
404 * NMI can not be detected/processed on other CPUs.
405 */
406 if (notify_die(DIE_NMI, "nmi", regs, 0, 2, SIGINT) == NOTIFY_STOP)
407 return;
408
409 /* Non-CPU-specific NMI: NMI sources can be processed on any CPU */
410 raw_spin_lock(&nmi_reason_lock);
411 reason = get_nmi_reason();
412
413 if (reason & NMI_REASON_MASK) {
414 if (reason & NMI_REASON_SERR)
415 pci_serr_error(reason, regs);
416 else if (reason & NMI_REASON_IOCHK)
417 io_check_error(reason, regs);
418#ifdef CONFIG_X86_32
419 /*
420 * Reassert NMI in case it became active
421 * meanwhile as it's edge-triggered:
422 */
423 reassert_nmi();
424#endif
425 raw_spin_unlock(&nmi_reason_lock);
426 return;
427 }
428 raw_spin_unlock(&nmi_reason_lock);
429
430 unknown_nmi_error(reason, regs);
431}
432
433dotraplinkage notrace __kprobes void
434do_nmi(struct pt_regs *regs, long error_code)
435{
436 nmi_enter();
437
438 inc_irq_stat(__nmi_count);
439
440 if (!ignore_nmis)
441 default_do_nmi(regs);
442
443 nmi_exit();
444}
445
446void stop_nmi(void)
447{
448 ignore_nmis++;
449}
450
451void restart_nmi(void)
452{
453 ignore_nmis--;
454}
455
456/* May run on IST stack. */ 301/* May run on IST stack. */
457dotraplinkage void __kprobes do_int3(struct pt_regs *regs, long error_code) 302dotraplinkage void __kprobes do_int3(struct pt_regs *regs, long error_code)
458{ 303{
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index 18ae83dd1cd..b56c65de384 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -56,7 +56,7 @@ DEFINE_VVAR(struct vsyscall_gtod_data, vsyscall_gtod_data) =
56 .lock = __SEQLOCK_UNLOCKED(__vsyscall_gtod_data.lock), 56 .lock = __SEQLOCK_UNLOCKED(__vsyscall_gtod_data.lock),
57}; 57};
58 58
59static enum { EMULATE, NATIVE, NONE } vsyscall_mode = EMULATE; 59static enum { EMULATE, NATIVE, NONE } vsyscall_mode = NATIVE;
60 60
61static int __init vsyscall_setup(char *str) 61static int __init vsyscall_setup(char *str)
62{ 62{
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 30326443ab8..87488b93a65 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -63,9 +63,8 @@ static void __init find_early_table_space(unsigned long end, int use_pse,
63#ifdef CONFIG_X86_32 63#ifdef CONFIG_X86_32
64 /* for fixmap */ 64 /* for fixmap */
65 tables += roundup(__end_of_fixed_addresses * sizeof(pte_t), PAGE_SIZE); 65 tables += roundup(__end_of_fixed_addresses * sizeof(pte_t), PAGE_SIZE);
66
67 good_end = max_pfn_mapped << PAGE_SHIFT;
68#endif 66#endif
67 good_end = max_pfn_mapped << PAGE_SHIFT;
69 68
70 base = memblock_find_in_range(start, good_end, tables, PAGE_SIZE); 69 base = memblock_find_in_range(start, good_end, tables, PAGE_SIZE);
71 if (base == MEMBLOCK_ERROR) 70 if (base == MEMBLOCK_ERROR)
diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
index 67421f38a21..de54b9b278a 100644
--- a/arch/x86/mm/mmio-mod.c
+++ b/arch/x86/mm/mmio-mod.c
@@ -29,7 +29,6 @@
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/uaccess.h> 30#include <linux/uaccess.h>
31#include <linux/io.h> 31#include <linux/io.h>
32#include <linux/version.h>
33#include <linux/kallsyms.h> 32#include <linux/kallsyms.h>
34#include <asm/pgtable.h> 33#include <asm/pgtable.h>
35#include <linux/mmiotrace.h> 34#include <linux/mmiotrace.h>
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index 68894fdc034..75f9528e037 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -61,26 +61,15 @@ u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
61} 61}
62 62
63 63
64static int profile_exceptions_notify(struct notifier_block *self, 64static int profile_exceptions_notify(unsigned int val, struct pt_regs *regs)
65 unsigned long val, void *data)
66{ 65{
67 struct die_args *args = (struct die_args *)data; 66 if (ctr_running)
68 int ret = NOTIFY_DONE; 67 model->check_ctrs(regs, &__get_cpu_var(cpu_msrs));
69 68 else if (!nmi_enabled)
70 switch (val) { 69 return NMI_DONE;
71 case DIE_NMI: 70 else
72 if (ctr_running) 71 model->stop(&__get_cpu_var(cpu_msrs));
73 model->check_ctrs(args->regs, &__get_cpu_var(cpu_msrs)); 72 return NMI_HANDLED;
74 else if (!nmi_enabled)
75 break;
76 else
77 model->stop(&__get_cpu_var(cpu_msrs));
78 ret = NOTIFY_STOP;
79 break;
80 default:
81 break;
82 }
83 return ret;
84} 73}
85 74
86static void nmi_cpu_save_registers(struct op_msrs *msrs) 75static void nmi_cpu_save_registers(struct op_msrs *msrs)
@@ -355,20 +344,14 @@ static void nmi_cpu_setup(void *dummy)
355 int cpu = smp_processor_id(); 344 int cpu = smp_processor_id();
356 struct op_msrs *msrs = &per_cpu(cpu_msrs, cpu); 345 struct op_msrs *msrs = &per_cpu(cpu_msrs, cpu);
357 nmi_cpu_save_registers(msrs); 346 nmi_cpu_save_registers(msrs);
358 spin_lock(&oprofilefs_lock); 347 raw_spin_lock(&oprofilefs_lock);
359 model->setup_ctrs(model, msrs); 348 model->setup_ctrs(model, msrs);
360 nmi_cpu_setup_mux(cpu, msrs); 349 nmi_cpu_setup_mux(cpu, msrs);
361 spin_unlock(&oprofilefs_lock); 350 raw_spin_unlock(&oprofilefs_lock);
362 per_cpu(saved_lvtpc, cpu) = apic_read(APIC_LVTPC); 351 per_cpu(saved_lvtpc, cpu) = apic_read(APIC_LVTPC);
363 apic_write(APIC_LVTPC, APIC_DM_NMI); 352 apic_write(APIC_LVTPC, APIC_DM_NMI);
364} 353}
365 354
366static struct notifier_block profile_exceptions_nb = {
367 .notifier_call = profile_exceptions_notify,
368 .next = NULL,
369 .priority = NMI_LOCAL_LOW_PRIOR,
370};
371
372static void nmi_cpu_restore_registers(struct op_msrs *msrs) 355static void nmi_cpu_restore_registers(struct op_msrs *msrs)
373{ 356{
374 struct op_msr *counters = msrs->counters; 357 struct op_msr *counters = msrs->counters;
@@ -402,8 +385,6 @@ static void nmi_cpu_shutdown(void *dummy)
402 apic_write(APIC_LVTPC, per_cpu(saved_lvtpc, cpu)); 385 apic_write(APIC_LVTPC, per_cpu(saved_lvtpc, cpu));
403 apic_write(APIC_LVTERR, v); 386 apic_write(APIC_LVTERR, v);
404 nmi_cpu_restore_registers(msrs); 387 nmi_cpu_restore_registers(msrs);
405 if (model->cpu_down)
406 model->cpu_down();
407} 388}
408 389
409static void nmi_cpu_up(void *dummy) 390static void nmi_cpu_up(void *dummy)
@@ -508,7 +489,8 @@ static int nmi_setup(void)
508 ctr_running = 0; 489 ctr_running = 0;
509 /* make variables visible to the nmi handler: */ 490 /* make variables visible to the nmi handler: */
510 smp_mb(); 491 smp_mb();
511 err = register_die_notifier(&profile_exceptions_nb); 492 err = register_nmi_handler(NMI_LOCAL, profile_exceptions_notify,
493 0, "oprofile");
512 if (err) 494 if (err)
513 goto fail; 495 goto fail;
514 496
@@ -538,7 +520,7 @@ static void nmi_shutdown(void)
538 put_online_cpus(); 520 put_online_cpus();
539 /* make variables visible to the nmi handler: */ 521 /* make variables visible to the nmi handler: */
540 smp_mb(); 522 smp_mb();
541 unregister_die_notifier(&profile_exceptions_nb); 523 unregister_nmi_handler(NMI_LOCAL, "oprofile");
542 msrs = &get_cpu_var(cpu_msrs); 524 msrs = &get_cpu_var(cpu_msrs);
543 model->shutdown(msrs); 525 model->shutdown(msrs);
544 free_msrs(); 526 free_msrs();
diff --git a/arch/x86/oprofile/nmi_timer_int.c b/arch/x86/oprofile/nmi_timer_int.c
index 720bf5a53c5..7f8052cd662 100644
--- a/arch/x86/oprofile/nmi_timer_int.c
+++ b/arch/x86/oprofile/nmi_timer_int.c
@@ -18,32 +18,16 @@
18#include <asm/apic.h> 18#include <asm/apic.h>
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20 20
21static int profile_timer_exceptions_notify(struct notifier_block *self, 21static int profile_timer_exceptions_notify(unsigned int val, struct pt_regs *regs)
22 unsigned long val, void *data)
23{ 22{
24 struct die_args *args = (struct die_args *)data; 23 oprofile_add_sample(regs, 0);
25 int ret = NOTIFY_DONE; 24 return NMI_HANDLED;
26
27 switch (val) {
28 case DIE_NMI:
29 oprofile_add_sample(args->regs, 0);
30 ret = NOTIFY_STOP;
31 break;
32 default:
33 break;
34 }
35 return ret;
36} 25}
37 26
38static struct notifier_block profile_timer_exceptions_nb = {
39 .notifier_call = profile_timer_exceptions_notify,
40 .next = NULL,
41 .priority = NMI_LOW_PRIOR,
42};
43
44static int timer_start(void) 27static int timer_start(void)
45{ 28{
46 if (register_die_notifier(&profile_timer_exceptions_nb)) 29 if (register_nmi_handler(NMI_LOCAL, profile_timer_exceptions_notify,
30 0, "oprofile-timer"))
47 return 1; 31 return 1;
48 return 0; 32 return 0;
49} 33}
@@ -51,7 +35,7 @@ static int timer_start(void)
51 35
52static void timer_stop(void) 36static void timer_stop(void)
53{ 37{
54 unregister_die_notifier(&profile_timer_exceptions_nb); 38 unregister_nmi_handler(NMI_LOCAL, "oprofile-timer");
55 synchronize_sched(); /* Allow already-started NMIs to complete. */ 39 synchronize_sched(); /* Allow already-started NMIs to complete. */
56} 40}
57 41
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c
index 9cbb710dc94..303f0863782 100644
--- a/arch/x86/oprofile/op_model_amd.c
+++ b/arch/x86/oprofile/op_model_amd.c
@@ -29,8 +29,6 @@
29#include "op_x86_model.h" 29#include "op_x86_model.h"
30#include "op_counter.h" 30#include "op_counter.h"
31 31
32#define NUM_COUNTERS 4
33#define NUM_COUNTERS_F15H 6
34#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX 32#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
35#define NUM_VIRT_COUNTERS 32 33#define NUM_VIRT_COUNTERS 32
36#else 34#else
@@ -70,62 +68,12 @@ static struct ibs_config ibs_config;
70static struct ibs_state ibs_state; 68static struct ibs_state ibs_state;
71 69
72/* 70/*
73 * IBS cpuid feature detection
74 */
75
76#define IBS_CPUID_FEATURES 0x8000001b
77
78/*
79 * Same bit mask as for IBS cpuid feature flags (Fn8000_001B_EAX), but
80 * bit 0 is used to indicate the existence of IBS.
81 */
82#define IBS_CAPS_AVAIL (1U<<0)
83#define IBS_CAPS_FETCHSAM (1U<<1)
84#define IBS_CAPS_OPSAM (1U<<2)
85#define IBS_CAPS_RDWROPCNT (1U<<3)
86#define IBS_CAPS_OPCNT (1U<<4)
87#define IBS_CAPS_BRNTRGT (1U<<5)
88#define IBS_CAPS_OPCNTEXT (1U<<6)
89
90#define IBS_CAPS_DEFAULT (IBS_CAPS_AVAIL \
91 | IBS_CAPS_FETCHSAM \
92 | IBS_CAPS_OPSAM)
93
94/*
95 * IBS APIC setup
96 */
97#define IBSCTL 0x1cc
98#define IBSCTL_LVT_OFFSET_VALID (1ULL<<8)
99#define IBSCTL_LVT_OFFSET_MASK 0x0F
100
101/*
102 * IBS randomization macros 71 * IBS randomization macros
103 */ 72 */
104#define IBS_RANDOM_BITS 12 73#define IBS_RANDOM_BITS 12
105#define IBS_RANDOM_MASK ((1ULL << IBS_RANDOM_BITS) - 1) 74#define IBS_RANDOM_MASK ((1ULL << IBS_RANDOM_BITS) - 1)
106#define IBS_RANDOM_MAXCNT_OFFSET (1ULL << (IBS_RANDOM_BITS - 5)) 75#define IBS_RANDOM_MAXCNT_OFFSET (1ULL << (IBS_RANDOM_BITS - 5))
107 76
108static u32 get_ibs_caps(void)
109{
110 u32 ibs_caps;
111 unsigned int max_level;
112
113 if (!boot_cpu_has(X86_FEATURE_IBS))
114 return 0;
115
116 /* check IBS cpuid feature flags */
117 max_level = cpuid_eax(0x80000000);
118 if (max_level < IBS_CPUID_FEATURES)
119 return IBS_CAPS_DEFAULT;
120
121 ibs_caps = cpuid_eax(IBS_CPUID_FEATURES);
122 if (!(ibs_caps & IBS_CAPS_AVAIL))
123 /* cpuid flags not valid */
124 return IBS_CAPS_DEFAULT;
125
126 return ibs_caps;
127}
128
129/* 77/*
130 * 16-bit Linear Feedback Shift Register (LFSR) 78 * 16-bit Linear Feedback Shift Register (LFSR)
131 * 79 *
@@ -316,81 +264,6 @@ static void op_amd_stop_ibs(void)
316 wrmsrl(MSR_AMD64_IBSOPCTL, 0); 264 wrmsrl(MSR_AMD64_IBSOPCTL, 0);
317} 265}
318 266
319static inline int get_eilvt(int offset)
320{
321 return !setup_APIC_eilvt(offset, 0, APIC_EILVT_MSG_NMI, 1);
322}
323
324static inline int put_eilvt(int offset)
325{
326 return !setup_APIC_eilvt(offset, 0, 0, 1);
327}
328
329static inline int ibs_eilvt_valid(void)
330{
331 int offset;
332 u64 val;
333 int valid = 0;
334
335 preempt_disable();
336
337 rdmsrl(MSR_AMD64_IBSCTL, val);
338 offset = val & IBSCTL_LVT_OFFSET_MASK;
339
340 if (!(val & IBSCTL_LVT_OFFSET_VALID)) {
341 pr_err(FW_BUG "cpu %d, invalid IBS interrupt offset %d (MSR%08X=0x%016llx)\n",
342 smp_processor_id(), offset, MSR_AMD64_IBSCTL, val);
343 goto out;
344 }
345
346 if (!get_eilvt(offset)) {
347 pr_err(FW_BUG "cpu %d, IBS interrupt offset %d not available (MSR%08X=0x%016llx)\n",
348 smp_processor_id(), offset, MSR_AMD64_IBSCTL, val);
349 goto out;
350 }
351
352 valid = 1;
353out:
354 preempt_enable();
355
356 return valid;
357}
358
359static inline int get_ibs_offset(void)
360{
361 u64 val;
362
363 rdmsrl(MSR_AMD64_IBSCTL, val);
364 if (!(val & IBSCTL_LVT_OFFSET_VALID))
365 return -EINVAL;
366
367 return val & IBSCTL_LVT_OFFSET_MASK;
368}
369
370static void setup_APIC_ibs(void)
371{
372 int offset;
373
374 offset = get_ibs_offset();
375 if (offset < 0)
376 goto failed;
377
378 if (!setup_APIC_eilvt(offset, 0, APIC_EILVT_MSG_NMI, 0))
379 return;
380failed:
381 pr_warn("oprofile: IBS APIC setup failed on cpu #%d\n",
382 smp_processor_id());
383}
384
385static void clear_APIC_ibs(void)
386{
387 int offset;
388
389 offset = get_ibs_offset();
390 if (offset >= 0)
391 setup_APIC_eilvt(offset, 0, APIC_EILVT_MSG_FIX, 1);
392}
393
394#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX 267#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
395 268
396static void op_mux_switch_ctrl(struct op_x86_model_spec const *model, 269static void op_mux_switch_ctrl(struct op_x86_model_spec const *model,
@@ -439,7 +312,7 @@ static int op_amd_fill_in_addresses(struct op_msrs * const msrs)
439 goto fail; 312 goto fail;
440 } 313 }
441 /* both registers must be reserved */ 314 /* both registers must be reserved */
442 if (num_counters == NUM_COUNTERS_F15H) { 315 if (num_counters == AMD64_NUM_COUNTERS_F15H) {
443 msrs->counters[i].addr = MSR_F15H_PERF_CTR + (i << 1); 316 msrs->counters[i].addr = MSR_F15H_PERF_CTR + (i << 1);
444 msrs->controls[i].addr = MSR_F15H_PERF_CTL + (i << 1); 317 msrs->controls[i].addr = MSR_F15H_PERF_CTL + (i << 1);
445 } else { 318 } else {
@@ -504,15 +377,6 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model,
504 val |= op_x86_get_ctrl(model, &counter_config[virt]); 377 val |= op_x86_get_ctrl(model, &counter_config[virt]);
505 wrmsrl(msrs->controls[i].addr, val); 378 wrmsrl(msrs->controls[i].addr, val);
506 } 379 }
507
508 if (ibs_caps)
509 setup_APIC_ibs();
510}
511
512static void op_amd_cpu_shutdown(void)
513{
514 if (ibs_caps)
515 clear_APIC_ibs();
516} 380}
517 381
518static int op_amd_check_ctrs(struct pt_regs * const regs, 382static int op_amd_check_ctrs(struct pt_regs * const regs,
@@ -575,86 +439,6 @@ static void op_amd_stop(struct op_msrs const * const msrs)
575 op_amd_stop_ibs(); 439 op_amd_stop_ibs();
576} 440}
577 441
578static int setup_ibs_ctl(int ibs_eilvt_off)
579{
580 struct pci_dev *cpu_cfg;
581 int nodes;
582 u32 value = 0;
583
584 nodes = 0;
585 cpu_cfg = NULL;
586 do {
587 cpu_cfg = pci_get_device(PCI_VENDOR_ID_AMD,
588 PCI_DEVICE_ID_AMD_10H_NB_MISC,
589 cpu_cfg);
590 if (!cpu_cfg)
591 break;
592 ++nodes;
593 pci_write_config_dword(cpu_cfg, IBSCTL, ibs_eilvt_off
594 | IBSCTL_LVT_OFFSET_VALID);
595 pci_read_config_dword(cpu_cfg, IBSCTL, &value);
596 if (value != (ibs_eilvt_off | IBSCTL_LVT_OFFSET_VALID)) {
597 pci_dev_put(cpu_cfg);
598 printk(KERN_DEBUG "Failed to setup IBS LVT offset, "
599 "IBSCTL = 0x%08x\n", value);
600 return -EINVAL;
601 }
602 } while (1);
603
604 if (!nodes) {
605 printk(KERN_DEBUG "No CPU node configured for IBS\n");
606 return -ENODEV;
607 }
608
609 return 0;
610}
611
612/*
613 * This runs only on the current cpu. We try to find an LVT offset and
614 * setup the local APIC. For this we must disable preemption. On
615 * success we initialize all nodes with this offset. This updates then
616 * the offset in the IBS_CTL per-node msr. The per-core APIC setup of
617 * the IBS interrupt vector is called from op_amd_setup_ctrs()/op_-
618 * amd_cpu_shutdown() using the new offset.
619 */
620static int force_ibs_eilvt_setup(void)
621{
622 int offset;
623 int ret;
624
625 preempt_disable();
626 /* find the next free available EILVT entry, skip offset 0 */
627 for (offset = 1; offset < APIC_EILVT_NR_MAX; offset++) {
628 if (get_eilvt(offset))
629 break;
630 }
631 preempt_enable();
632
633 if (offset == APIC_EILVT_NR_MAX) {
634 printk(KERN_DEBUG "No EILVT entry available\n");
635 return -EBUSY;
636 }
637
638 ret = setup_ibs_ctl(offset);
639 if (ret)
640 goto out;
641
642 if (!ibs_eilvt_valid()) {
643 ret = -EFAULT;
644 goto out;
645 }
646
647 pr_err(FW_BUG "using offset %d for IBS interrupts\n", offset);
648 pr_err(FW_BUG "workaround enabled for IBS LVT offset\n");
649
650 return 0;
651out:
652 preempt_disable();
653 put_eilvt(offset);
654 preempt_enable();
655 return ret;
656}
657
658/* 442/*
659 * check and reserve APIC extended interrupt LVT offset for IBS if 443 * check and reserve APIC extended interrupt LVT offset for IBS if
660 * available 444 * available
@@ -667,17 +451,6 @@ static void init_ibs(void)
667 if (!ibs_caps) 451 if (!ibs_caps)
668 return; 452 return;
669 453
670 if (ibs_eilvt_valid())
671 goto out;
672
673 if (!force_ibs_eilvt_setup())
674 goto out;
675
676 /* Failed to setup ibs */
677 ibs_caps = 0;
678 return;
679
680out:
681 printk(KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n", ibs_caps); 454 printk(KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n", ibs_caps);
682} 455}
683 456
@@ -741,9 +514,9 @@ static int op_amd_init(struct oprofile_operations *ops)
741 ops->create_files = setup_ibs_files; 514 ops->create_files = setup_ibs_files;
742 515
743 if (boot_cpu_data.x86 == 0x15) { 516 if (boot_cpu_data.x86 == 0x15) {
744 num_counters = NUM_COUNTERS_F15H; 517 num_counters = AMD64_NUM_COUNTERS_F15H;
745 } else { 518 } else {
746 num_counters = NUM_COUNTERS; 519 num_counters = AMD64_NUM_COUNTERS;
747 } 520 }
748 521
749 op_amd_spec.num_counters = num_counters; 522 op_amd_spec.num_counters = num_counters;
@@ -760,7 +533,6 @@ struct op_x86_model_spec op_amd_spec = {
760 .init = op_amd_init, 533 .init = op_amd_init,
761 .fill_in_addresses = &op_amd_fill_in_addresses, 534 .fill_in_addresses = &op_amd_fill_in_addresses,
762 .setup_ctrs = &op_amd_setup_ctrs, 535 .setup_ctrs = &op_amd_setup_ctrs,
763 .cpu_down = &op_amd_cpu_shutdown,
764 .check_ctrs = &op_amd_check_ctrs, 536 .check_ctrs = &op_amd_check_ctrs,
765 .start = &op_amd_start, 537 .start = &op_amd_start,
766 .stop = &op_amd_stop, 538 .stop = &op_amd_stop,
diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c
index 94b745045e4..d90528ea541 100644
--- a/arch/x86/oprofile/op_model_ppro.c
+++ b/arch/x86/oprofile/op_model_ppro.c
@@ -28,7 +28,7 @@ static int counter_width = 32;
28 28
29#define MSR_PPRO_EVENTSEL_RESERVED ((0xFFFFFFFFULL<<32)|(1ULL<<21)) 29#define MSR_PPRO_EVENTSEL_RESERVED ((0xFFFFFFFFULL<<32)|(1ULL<<21))
30 30
31static u64 *reset_value; 31static u64 reset_value[OP_MAX_COUNTER];
32 32
33static void ppro_shutdown(struct op_msrs const * const msrs) 33static void ppro_shutdown(struct op_msrs const * const msrs)
34{ 34{
@@ -40,10 +40,6 @@ static void ppro_shutdown(struct op_msrs const * const msrs)
40 release_perfctr_nmi(MSR_P6_PERFCTR0 + i); 40 release_perfctr_nmi(MSR_P6_PERFCTR0 + i);
41 release_evntsel_nmi(MSR_P6_EVNTSEL0 + i); 41 release_evntsel_nmi(MSR_P6_EVNTSEL0 + i);
42 } 42 }
43 if (reset_value) {
44 kfree(reset_value);
45 reset_value = NULL;
46 }
47} 43}
48 44
49static int ppro_fill_in_addresses(struct op_msrs * const msrs) 45static int ppro_fill_in_addresses(struct op_msrs * const msrs)
@@ -79,13 +75,6 @@ static void ppro_setup_ctrs(struct op_x86_model_spec const *model,
79 u64 val; 75 u64 val;
80 int i; 76 int i;
81 77
82 if (!reset_value) {
83 reset_value = kzalloc(sizeof(reset_value[0]) * num_counters,
84 GFP_ATOMIC);
85 if (!reset_value)
86 return;
87 }
88
89 if (cpu_has_arch_perfmon) { 78 if (cpu_has_arch_perfmon) {
90 union cpuid10_eax eax; 79 union cpuid10_eax eax;
91 eax.full = cpuid_eax(0xa); 80 eax.full = cpuid_eax(0xa);
@@ -141,13 +130,6 @@ static int ppro_check_ctrs(struct pt_regs * const regs,
141 u64 val; 130 u64 val;
142 int i; 131 int i;
143 132
144 /*
145 * This can happen if perf counters are in use when
146 * we steal the die notifier NMI.
147 */
148 if (unlikely(!reset_value))
149 goto out;
150
151 for (i = 0; i < num_counters; ++i) { 133 for (i = 0; i < num_counters; ++i) {
152 if (!reset_value[i]) 134 if (!reset_value[i])
153 continue; 135 continue;
@@ -158,7 +140,6 @@ static int ppro_check_ctrs(struct pt_regs * const regs,
158 wrmsrl(msrs->counters[i].addr, -reset_value[i]); 140 wrmsrl(msrs->counters[i].addr, -reset_value[i]);
159 } 141 }
160 142
161out:
162 /* Only P6 based Pentium M need to re-unmask the apic vector but it 143 /* Only P6 based Pentium M need to re-unmask the apic vector but it
163 * doesn't hurt other P6 variant */ 144 * doesn't hurt other P6 variant */
164 apic_write(APIC_LVTPC, apic_read(APIC_LVTPC) & ~APIC_LVT_MASKED); 145 apic_write(APIC_LVTPC, apic_read(APIC_LVTPC) & ~APIC_LVT_MASKED);
@@ -179,8 +160,6 @@ static void ppro_start(struct op_msrs const * const msrs)
179 u64 val; 160 u64 val;
180 int i; 161 int i;
181 162
182 if (!reset_value)
183 return;
184 for (i = 0; i < num_counters; ++i) { 163 for (i = 0; i < num_counters; ++i) {
185 if (reset_value[i]) { 164 if (reset_value[i]) {
186 rdmsrl(msrs->controls[i].addr, val); 165 rdmsrl(msrs->controls[i].addr, val);
@@ -196,8 +175,6 @@ static void ppro_stop(struct op_msrs const * const msrs)
196 u64 val; 175 u64 val;
197 int i; 176 int i;
198 177
199 if (!reset_value)
200 return;
201 for (i = 0; i < num_counters; ++i) { 178 for (i = 0; i < num_counters; ++i) {
202 if (!reset_value[i]) 179 if (!reset_value[i])
203 continue; 180 continue;
@@ -242,7 +219,7 @@ static void arch_perfmon_setup_counters(void)
242 eax.split.bit_width = 40; 219 eax.split.bit_width = 40;
243 } 220 }
244 221
245 num_counters = eax.split.num_counters; 222 num_counters = min((int)eax.split.num_counters, OP_MAX_COUNTER);
246 223
247 op_arch_perfmon_spec.num_counters = num_counters; 224 op_arch_perfmon_spec.num_counters = num_counters;
248 op_arch_perfmon_spec.num_controls = num_counters; 225 op_arch_perfmon_spec.num_controls = num_counters;
diff --git a/arch/x86/oprofile/op_x86_model.h b/arch/x86/oprofile/op_x86_model.h
index 89017fa1fd6..71e8a67337e 100644
--- a/arch/x86/oprofile/op_x86_model.h
+++ b/arch/x86/oprofile/op_x86_model.h
@@ -43,7 +43,6 @@ struct op_x86_model_spec {
43 int (*fill_in_addresses)(struct op_msrs * const msrs); 43 int (*fill_in_addresses)(struct op_msrs * const msrs);
44 void (*setup_ctrs)(struct op_x86_model_spec const *model, 44 void (*setup_ctrs)(struct op_x86_model_spec const *model,
45 struct op_msrs const * const msrs); 45 struct op_msrs const * const msrs);
46 void (*cpu_down)(void);
47 int (*check_ctrs)(struct pt_regs * const regs, 46 int (*check_ctrs)(struct pt_regs * const regs,
48 struct op_msrs const * const msrs); 47 struct op_msrs const * const msrs);
49 void (*start)(struct op_msrs const * const msrs); 48 void (*start)(struct op_msrs const * const msrs);
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index 1017c7bee38..492ade8c978 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -175,8 +175,10 @@ static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
175 "pcifront-msi-x" : 175 "pcifront-msi-x" :
176 "pcifront-msi", 176 "pcifront-msi",
177 DOMID_SELF); 177 DOMID_SELF);
178 if (irq < 0) 178 if (irq < 0) {
179 ret = irq;
179 goto free; 180 goto free;
181 }
180 i++; 182 i++;
181 } 183 }
182 kfree(v); 184 kfree(v);
@@ -221,8 +223,10 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
221 if (msg.data != XEN_PIRQ_MSI_DATA || 223 if (msg.data != XEN_PIRQ_MSI_DATA ||
222 xen_irq_from_pirq(pirq) < 0) { 224 xen_irq_from_pirq(pirq) < 0) {
223 pirq = xen_allocate_pirq_msi(dev, msidesc); 225 pirq = xen_allocate_pirq_msi(dev, msidesc);
224 if (pirq < 0) 226 if (pirq < 0) {
227 irq = -ENODEV;
225 goto error; 228 goto error;
229 }
226 xen_msi_compose_msg(dev, pirq, &msg); 230 xen_msi_compose_msg(dev, pirq, &msg);
227 __write_msi_msg(msidesc, &msg); 231 __write_msi_msg(msidesc, &msg);
228 dev_dbg(&dev->dev, "xen: msi bound to pirq=%d\n", pirq); 232 dev_dbg(&dev->dev, "xen: msi bound to pirq=%d\n", pirq);
@@ -244,10 +248,12 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
244error: 248error:
245 dev_err(&dev->dev, 249 dev_err(&dev->dev,
246 "Xen PCI frontend has not registered MSI/MSI-X support!\n"); 250 "Xen PCI frontend has not registered MSI/MSI-X support!\n");
247 return -ENODEV; 251 return irq;
248} 252}
249 253
250#ifdef CONFIG_XEN_DOM0 254#ifdef CONFIG_XEN_DOM0
255static bool __read_mostly pci_seg_supported = true;
256
251static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) 257static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
252{ 258{
253 int ret = 0; 259 int ret = 0;
@@ -265,10 +271,11 @@ static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
265 271
266 memset(&map_irq, 0, sizeof(map_irq)); 272 memset(&map_irq, 0, sizeof(map_irq));
267 map_irq.domid = domid; 273 map_irq.domid = domid;
268 map_irq.type = MAP_PIRQ_TYPE_MSI; 274 map_irq.type = MAP_PIRQ_TYPE_MSI_SEG;
269 map_irq.index = -1; 275 map_irq.index = -1;
270 map_irq.pirq = -1; 276 map_irq.pirq = -1;
271 map_irq.bus = dev->bus->number; 277 map_irq.bus = dev->bus->number |
278 (pci_domain_nr(dev->bus) << 16);
272 map_irq.devfn = dev->devfn; 279 map_irq.devfn = dev->devfn;
273 280
274 if (type == PCI_CAP_ID_MSIX) { 281 if (type == PCI_CAP_ID_MSIX) {
@@ -285,7 +292,20 @@ static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
285 map_irq.entry_nr = msidesc->msi_attrib.entry_nr; 292 map_irq.entry_nr = msidesc->msi_attrib.entry_nr;
286 } 293 }
287 294
288 ret = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq); 295 ret = -EINVAL;
296 if (pci_seg_supported)
297 ret = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq,
298 &map_irq);
299 if (ret == -EINVAL && !pci_domain_nr(dev->bus)) {
300 map_irq.type = MAP_PIRQ_TYPE_MSI;
301 map_irq.index = -1;
302 map_irq.pirq = -1;
303 map_irq.bus = dev->bus->number;
304 ret = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq,
305 &map_irq);
306 if (ret != -EINVAL)
307 pci_seg_supported = false;
308 }
289 if (ret) { 309 if (ret) {
290 dev_warn(&dev->dev, "xen map irq failed %d for %d domain\n", 310 dev_warn(&dev->dev, "xen map irq failed %d for %d domain\n",
291 ret, domid); 311 ret, domid);
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c
index 58425adc22c..e6379526675 100644
--- a/arch/x86/platform/mrst/mrst.c
+++ b/arch/x86/platform/mrst/mrst.c
@@ -14,6 +14,8 @@
14 14
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/interrupt.h>
18#include <linux/scatterlist.h>
17#include <linux/sfi.h> 19#include <linux/sfi.h>
18#include <linux/intel_pmic_gpio.h> 20#include <linux/intel_pmic_gpio.h>
19#include <linux/spi/spi.h> 21#include <linux/spi/spi.h>
@@ -392,6 +394,7 @@ static void __init *max3111_platform_data(void *info)
392 struct spi_board_info *spi_info = info; 394 struct spi_board_info *spi_info = info;
393 int intr = get_gpio_by_name("max3111_int"); 395 int intr = get_gpio_by_name("max3111_int");
394 396
397 spi_info->mode = SPI_MODE_0;
395 if (intr == -1) 398 if (intr == -1)
396 return NULL; 399 return NULL;
397 spi_info->irq = intr + MRST_IRQ_OFFSET; 400 spi_info->irq = intr + MRST_IRQ_OFFSET;
@@ -678,38 +681,40 @@ static int __init sfi_parse_devs(struct sfi_table_header *table)
678 pentry = (struct sfi_device_table_entry *)sb->pentry; 681 pentry = (struct sfi_device_table_entry *)sb->pentry;
679 682
680 for (i = 0; i < num; i++, pentry++) { 683 for (i = 0; i < num; i++, pentry++) {
681 if (pentry->irq != (u8)0xff) { /* native RTE case */ 684 int irq = pentry->irq;
685
686 if (irq != (u8)0xff) { /* native RTE case */
682 /* these SPI2 devices are not exposed to system as PCI 687 /* these SPI2 devices are not exposed to system as PCI
683 * devices, but they have separate RTE entry in IOAPIC 688 * devices, but they have separate RTE entry in IOAPIC
684 * so we have to enable them one by one here 689 * so we have to enable them one by one here
685 */ 690 */
686 ioapic = mp_find_ioapic(pentry->irq); 691 ioapic = mp_find_ioapic(irq);
687 irq_attr.ioapic = ioapic; 692 irq_attr.ioapic = ioapic;
688 irq_attr.ioapic_pin = pentry->irq; 693 irq_attr.ioapic_pin = irq;
689 irq_attr.trigger = 1; 694 irq_attr.trigger = 1;
690 irq_attr.polarity = 1; 695 irq_attr.polarity = 1;
691 io_apic_set_pci_routing(NULL, pentry->irq, &irq_attr); 696 io_apic_set_pci_routing(NULL, irq, &irq_attr);
692 } else 697 } else
693 pentry->irq = 0; /* No irq */ 698 irq = 0; /* No irq */
694 699
695 switch (pentry->type) { 700 switch (pentry->type) {
696 case SFI_DEV_TYPE_IPC: 701 case SFI_DEV_TYPE_IPC:
697 /* ID as IRQ is a hack that will go away */ 702 /* ID as IRQ is a hack that will go away */
698 pdev = platform_device_alloc(pentry->name, pentry->irq); 703 pdev = platform_device_alloc(pentry->name, irq);
699 if (pdev == NULL) { 704 if (pdev == NULL) {
700 pr_err("out of memory for SFI platform device '%s'.\n", 705 pr_err("out of memory for SFI platform device '%s'.\n",
701 pentry->name); 706 pentry->name);
702 continue; 707 continue;
703 } 708 }
704 install_irq_resource(pdev, pentry->irq); 709 install_irq_resource(pdev, irq);
705 pr_debug("info[%2d]: IPC bus, name = %16.16s, " 710 pr_debug("info[%2d]: IPC bus, name = %16.16s, "
706 "irq = 0x%2x\n", i, pentry->name, pentry->irq); 711 "irq = 0x%2x\n", i, pentry->name, irq);
707 sfi_handle_ipc_dev(pdev); 712 sfi_handle_ipc_dev(pdev);
708 break; 713 break;
709 case SFI_DEV_TYPE_SPI: 714 case SFI_DEV_TYPE_SPI:
710 memset(&spi_info, 0, sizeof(spi_info)); 715 memset(&spi_info, 0, sizeof(spi_info));
711 strncpy(spi_info.modalias, pentry->name, SFI_NAME_LEN); 716 strncpy(spi_info.modalias, pentry->name, SFI_NAME_LEN);
712 spi_info.irq = pentry->irq; 717 spi_info.irq = irq;
713 spi_info.bus_num = pentry->host_num; 718 spi_info.bus_num = pentry->host_num;
714 spi_info.chip_select = pentry->addr; 719 spi_info.chip_select = pentry->addr;
715 spi_info.max_speed_hz = pentry->max_freq; 720 spi_info.max_speed_hz = pentry->max_freq;
@@ -726,7 +731,7 @@ static int __init sfi_parse_devs(struct sfi_table_header *table)
726 memset(&i2c_info, 0, sizeof(i2c_info)); 731 memset(&i2c_info, 0, sizeof(i2c_info));
727 bus = pentry->host_num; 732 bus = pentry->host_num;
728 strncpy(i2c_info.type, pentry->name, SFI_NAME_LEN); 733 strncpy(i2c_info.type, pentry->name, SFI_NAME_LEN);
729 i2c_info.irq = pentry->irq; 734 i2c_info.irq = irq;
730 i2c_info.addr = pentry->addr; 735 i2c_info.addr = pentry->addr;
731 pr_debug("info[%2d]: I2C bus = %d, name = %16.16s, " 736 pr_debug("info[%2d]: I2C bus = %d, name = %16.16s, "
732 "irq = 0x%2x, addr = 0x%x\n", i, bus, 737 "irq = 0x%2x, addr = 0x%x\n", i, bus,
diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig
index 5cc821cb2e0..26c731a106a 100644
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -25,8 +25,7 @@ config XEN_PRIVILEGED_GUEST
25 25
26config XEN_PVHVM 26config XEN_PVHVM
27 def_bool y 27 def_bool y
28 depends on XEN 28 depends on XEN && PCI && X86_LOCAL_APIC
29 depends on X86_LOCAL_APIC
30 29
31config XEN_MAX_DOMAIN_MEMORY 30config XEN_MAX_DOMAIN_MEMORY
32 int 31 int
@@ -49,11 +48,3 @@ config XEN_DEBUG_FS
49 help 48 help
50 Enable statistics output and various tuning options in debugfs. 49 Enable statistics output and various tuning options in debugfs.
51 Enabling this option may incur a significant performance overhead. 50 Enabling this option may incur a significant performance overhead.
52
53config XEN_DEBUG
54 bool "Enable Xen debug checks"
55 depends on XEN
56 default n
57 help
58 Enable various WARN_ON checks in the Xen MMU code.
59 Enabling this option WILL incur a significant performance overhead.
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 2d69617950f..da8afd576a6 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -251,6 +251,7 @@ static void __init xen_init_cpuid_mask(void)
251 ~((1 << X86_FEATURE_APIC) | /* disable local APIC */ 251 ~((1 << X86_FEATURE_APIC) | /* disable local APIC */
252 (1 << X86_FEATURE_ACPI)); /* disable ACPI */ 252 (1 << X86_FEATURE_ACPI)); /* disable ACPI */
253 ax = 1; 253 ax = 1;
254 cx = 0;
254 xen_cpuid(&ax, &bx, &cx, &dx); 255 xen_cpuid(&ax, &bx, &cx, &dx);
255 256
256 xsave_mask = 257 xsave_mask =
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 3dd53f997b1..87f6673b120 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -495,41 +495,6 @@ static pte_t xen_make_pte(pteval_t pte)
495} 495}
496PV_CALLEE_SAVE_REGS_THUNK(xen_make_pte); 496PV_CALLEE_SAVE_REGS_THUNK(xen_make_pte);
497 497
498#ifdef CONFIG_XEN_DEBUG
499pte_t xen_make_pte_debug(pteval_t pte)
500{
501 phys_addr_t addr = (pte & PTE_PFN_MASK);
502 phys_addr_t other_addr;
503 bool io_page = false;
504 pte_t _pte;
505
506 if (pte & _PAGE_IOMAP)
507 io_page = true;
508
509 _pte = xen_make_pte(pte);
510
511 if (!addr)
512 return _pte;
513
514 if (io_page &&
515 (xen_initial_domain() || addr >= ISA_END_ADDRESS)) {
516 other_addr = pfn_to_mfn(addr >> PAGE_SHIFT) << PAGE_SHIFT;
517 WARN_ONCE(addr != other_addr,
518 "0x%lx is using VM_IO, but it is 0x%lx!\n",
519 (unsigned long)addr, (unsigned long)other_addr);
520 } else {
521 pteval_t iomap_set = (_pte.pte & PTE_FLAGS_MASK) & _PAGE_IOMAP;
522 other_addr = (_pte.pte & PTE_PFN_MASK);
523 WARN_ONCE((addr == other_addr) && (!io_page) && (!iomap_set),
524 "0x%lx is missing VM_IO (and wasn't fixed)!\n",
525 (unsigned long)addr);
526 }
527
528 return _pte;
529}
530PV_CALLEE_SAVE_REGS_THUNK(xen_make_pte_debug);
531#endif
532
533static pgd_t xen_make_pgd(pgdval_t pgd) 498static pgd_t xen_make_pgd(pgdval_t pgd)
534{ 499{
535 pgd = pte_pfn_to_mfn(pgd); 500 pgd = pte_pfn_to_mfn(pgd);
@@ -1992,9 +1957,6 @@ void __init xen_ident_map_ISA(void)
1992 1957
1993static void __init xen_post_allocator_init(void) 1958static void __init xen_post_allocator_init(void)
1994{ 1959{
1995#ifdef CONFIG_XEN_DEBUG
1996 pv_mmu_ops.make_pte = PV_CALLEE_SAVE(xen_make_pte_debug);
1997#endif
1998 pv_mmu_ops.set_pte = xen_set_pte; 1960 pv_mmu_ops.set_pte = xen_set_pte;
1999 pv_mmu_ops.set_pmd = xen_set_pmd; 1961 pv_mmu_ops.set_pmd = xen_set_pmd;
2000 pv_mmu_ops.set_pud = xen_set_pud; 1962 pv_mmu_ops.set_pud = xen_set_pud;
@@ -2404,17 +2366,3 @@ out:
2404 return err; 2366 return err;
2405} 2367}
2406EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_range); 2368EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_range);
2407
2408#ifdef CONFIG_XEN_DEBUG_FS
2409static int p2m_dump_open(struct inode *inode, struct file *filp)
2410{
2411 return single_open(filp, p2m_dump_show, NULL);
2412}
2413
2414static const struct file_operations p2m_dump_fops = {
2415 .open = p2m_dump_open,
2416 .read = seq_read,
2417 .llseek = seq_lseek,
2418 .release = single_release,
2419};
2420#endif /* CONFIG_XEN_DEBUG_FS */
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 58efeb9d544..1b267e75158 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -161,7 +161,9 @@
161#include <asm/xen/page.h> 161#include <asm/xen/page.h>
162#include <asm/xen/hypercall.h> 162#include <asm/xen/hypercall.h>
163#include <asm/xen/hypervisor.h> 163#include <asm/xen/hypervisor.h>
164#include <xen/grant_table.h>
164 165
166#include "multicalls.h"
165#include "xen-ops.h" 167#include "xen-ops.h"
166 168
167static void __init m2p_override_init(void); 169static void __init m2p_override_init(void);
@@ -676,7 +678,8 @@ static unsigned long mfn_hash(unsigned long mfn)
676} 678}
677 679
678/* Add an MFN override for a particular page */ 680/* Add an MFN override for a particular page */
679int m2p_add_override(unsigned long mfn, struct page *page, bool clear_pte) 681int m2p_add_override(unsigned long mfn, struct page *page,
682 struct gnttab_map_grant_ref *kmap_op)
680{ 683{
681 unsigned long flags; 684 unsigned long flags;
682 unsigned long pfn; 685 unsigned long pfn;
@@ -692,16 +695,28 @@ int m2p_add_override(unsigned long mfn, struct page *page, bool clear_pte)
692 "m2p_add_override: pfn %lx not mapped", pfn)) 695 "m2p_add_override: pfn %lx not mapped", pfn))
693 return -EINVAL; 696 return -EINVAL;
694 } 697 }
695 698 WARN_ON(PagePrivate(page));
696 page->private = mfn; 699 SetPagePrivate(page);
700 set_page_private(page, mfn);
697 page->index = pfn_to_mfn(pfn); 701 page->index = pfn_to_mfn(pfn);
698 702
699 if (unlikely(!set_phys_to_machine(pfn, FOREIGN_FRAME(mfn)))) 703 if (unlikely(!set_phys_to_machine(pfn, FOREIGN_FRAME(mfn))))
700 return -ENOMEM; 704 return -ENOMEM;
701 705
702 if (clear_pte && !PageHighMem(page)) 706 if (kmap_op != NULL) {
703 /* Just zap old mapping for now */ 707 if (!PageHighMem(page)) {
704 pte_clear(&init_mm, address, ptep); 708 struct multicall_space mcs =
709 xen_mc_entry(sizeof(*kmap_op));
710
711 MULTI_grant_table_op(mcs.mc,
712 GNTTABOP_map_grant_ref, kmap_op, 1);
713
714 xen_mc_issue(PARAVIRT_LAZY_MMU);
715 }
716 /* let's use dev_bus_addr to record the old mfn instead */
717 kmap_op->dev_bus_addr = page->index;
718 page->index = (unsigned long) kmap_op;
719 }
705 spin_lock_irqsave(&m2p_override_lock, flags); 720 spin_lock_irqsave(&m2p_override_lock, flags);
706 list_add(&page->lru, &m2p_overrides[mfn_hash(mfn)]); 721 list_add(&page->lru, &m2p_overrides[mfn_hash(mfn)]);
707 spin_unlock_irqrestore(&m2p_override_lock, flags); 722 spin_unlock_irqrestore(&m2p_override_lock, flags);
@@ -735,13 +750,56 @@ int m2p_remove_override(struct page *page, bool clear_pte)
735 spin_lock_irqsave(&m2p_override_lock, flags); 750 spin_lock_irqsave(&m2p_override_lock, flags);
736 list_del(&page->lru); 751 list_del(&page->lru);
737 spin_unlock_irqrestore(&m2p_override_lock, flags); 752 spin_unlock_irqrestore(&m2p_override_lock, flags);
738 set_phys_to_machine(pfn, page->index); 753 WARN_ON(!PagePrivate(page));
754 ClearPagePrivate(page);
739 755
740 if (clear_pte && !PageHighMem(page)) 756 if (clear_pte) {
741 set_pte_at(&init_mm, address, ptep, 757 struct gnttab_map_grant_ref *map_op =
742 pfn_pte(pfn, PAGE_KERNEL)); 758 (struct gnttab_map_grant_ref *) page->index;
743 /* No tlb flush necessary because the caller already 759 set_phys_to_machine(pfn, map_op->dev_bus_addr);
744 * left the pte unmapped. */ 760 if (!PageHighMem(page)) {
761 struct multicall_space mcs;
762 struct gnttab_unmap_grant_ref *unmap_op;
763
764 /*
765 * It might be that we queued all the m2p grant table
766 * hypercalls in a multicall, then m2p_remove_override
767 * get called before the multicall has actually been
768 * issued. In this case handle is going to -1 because
769 * it hasn't been modified yet.
770 */
771 if (map_op->handle == -1)
772 xen_mc_flush();
773 /*
774 * Now if map_op->handle is negative it means that the
775 * hypercall actually returned an error.
776 */
777 if (map_op->handle == GNTST_general_error) {
778 printk(KERN_WARNING "m2p_remove_override: "
779 "pfn %lx mfn %lx, failed to modify kernel mappings",
780 pfn, mfn);
781 return -1;
782 }
783
784 mcs = xen_mc_entry(
785 sizeof(struct gnttab_unmap_grant_ref));
786 unmap_op = mcs.args;
787 unmap_op->host_addr = map_op->host_addr;
788 unmap_op->handle = map_op->handle;
789 unmap_op->dev_bus_addr = 0;
790
791 MULTI_grant_table_op(mcs.mc,
792 GNTTABOP_unmap_grant_ref, unmap_op, 1);
793
794 xen_mc_issue(PARAVIRT_LAZY_MMU);
795
796 set_pte_at(&init_mm, address, ptep,
797 pfn_pte(pfn, PAGE_KERNEL));
798 __flush_tlb_single(address);
799 map_op->host_addr = 0;
800 }
801 } else
802 set_phys_to_machine(pfn, page->index);
745 803
746 return 0; 804 return 0;
747} 805}
@@ -758,7 +816,7 @@ struct page *m2p_find_override(unsigned long mfn)
758 spin_lock_irqsave(&m2p_override_lock, flags); 816 spin_lock_irqsave(&m2p_override_lock, flags);
759 817
760 list_for_each_entry(p, bucket, lru) { 818 list_for_each_entry(p, bucket, lru) {
761 if (p->private == mfn) { 819 if (page_private(p) == mfn) {
762 ret = p; 820 ret = p;
763 break; 821 break;
764 } 822 }
@@ -782,17 +840,21 @@ unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn)
782EXPORT_SYMBOL_GPL(m2p_find_override_pfn); 840EXPORT_SYMBOL_GPL(m2p_find_override_pfn);
783 841
784#ifdef CONFIG_XEN_DEBUG_FS 842#ifdef CONFIG_XEN_DEBUG_FS
785 843#include <linux/debugfs.h>
786int p2m_dump_show(struct seq_file *m, void *v) 844#include "debugfs.h"
845static int p2m_dump_show(struct seq_file *m, void *v)
787{ 846{
788 static const char * const level_name[] = { "top", "middle", 847 static const char * const level_name[] = { "top", "middle",
789 "entry", "abnormal" }; 848 "entry", "abnormal", "error"};
790 static const char * const type_name[] = { "identity", "missing",
791 "pfn", "abnormal"};
792#define TYPE_IDENTITY 0 849#define TYPE_IDENTITY 0
793#define TYPE_MISSING 1 850#define TYPE_MISSING 1
794#define TYPE_PFN 2 851#define TYPE_PFN 2
795#define TYPE_UNKNOWN 3 852#define TYPE_UNKNOWN 3
853 static const char * const type_name[] = {
854 [TYPE_IDENTITY] = "identity",
855 [TYPE_MISSING] = "missing",
856 [TYPE_PFN] = "pfn",
857 [TYPE_UNKNOWN] = "abnormal"};
796 unsigned long pfn, prev_pfn_type = 0, prev_pfn_level = 0; 858 unsigned long pfn, prev_pfn_type = 0, prev_pfn_level = 0;
797 unsigned int uninitialized_var(prev_level); 859 unsigned int uninitialized_var(prev_level);
798 unsigned int uninitialized_var(prev_type); 860 unsigned int uninitialized_var(prev_type);
@@ -856,4 +918,32 @@ int p2m_dump_show(struct seq_file *m, void *v)
856#undef TYPE_PFN 918#undef TYPE_PFN
857#undef TYPE_UNKNOWN 919#undef TYPE_UNKNOWN
858} 920}
859#endif 921
922static int p2m_dump_open(struct inode *inode, struct file *filp)
923{
924 return single_open(filp, p2m_dump_show, NULL);
925}
926
927static const struct file_operations p2m_dump_fops = {
928 .open = p2m_dump_open,
929 .read = seq_read,
930 .llseek = seq_lseek,
931 .release = single_release,
932};
933
934static struct dentry *d_mmu_debug;
935
936static int __init xen_p2m_debugfs(void)
937{
938 struct dentry *d_xen = xen_init_debugfs();
939
940 if (d_xen == NULL)
941 return -ENOMEM;
942
943 d_mmu_debug = debugfs_create_dir("mmu", d_xen);
944
945 debugfs_create_file("p2m", 0600, d_mmu_debug, NULL, &p2m_dump_fops);
946 return 0;
947}
948fs_initcall(xen_p2m_debugfs);
949#endif /* CONFIG_XEN_DEBUG_FS */
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 46d6d21dbdb..38d0af4fefe 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -37,7 +37,10 @@ extern void xen_syscall_target(void);
37extern void xen_syscall32_target(void); 37extern void xen_syscall32_target(void);
38 38
39/* Amount of extra memory space we add to the e820 ranges */ 39/* Amount of extra memory space we add to the e820 ranges */
40phys_addr_t xen_extra_mem_start, xen_extra_mem_size; 40struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS] __initdata;
41
42/* Number of pages released from the initial allocation. */
43unsigned long xen_released_pages;
41 44
42/* 45/*
43 * The maximum amount of extra memory compared to the base size. The 46 * The maximum amount of extra memory compared to the base size. The
@@ -51,48 +54,47 @@ phys_addr_t xen_extra_mem_start, xen_extra_mem_size;
51 */ 54 */
52#define EXTRA_MEM_RATIO (10) 55#define EXTRA_MEM_RATIO (10)
53 56
54static void __init xen_add_extra_mem(unsigned long pages) 57static void __init xen_add_extra_mem(u64 start, u64 size)
55{ 58{
56 unsigned long pfn; 59 unsigned long pfn;
60 int i;
57 61
58 u64 size = (u64)pages * PAGE_SIZE; 62 for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) {
59 u64 extra_start = xen_extra_mem_start + xen_extra_mem_size; 63 /* Add new region. */
60 64 if (xen_extra_mem[i].size == 0) {
61 if (!pages) 65 xen_extra_mem[i].start = start;
62 return; 66 xen_extra_mem[i].size = size;
63 67 break;
64 e820_add_region(extra_start, size, E820_RAM); 68 }
65 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); 69 /* Append to existing region. */
66 70 if (xen_extra_mem[i].start + xen_extra_mem[i].size == start) {
67 memblock_x86_reserve_range(extra_start, extra_start + size, "XEN EXTRA"); 71 xen_extra_mem[i].size += size;
72 break;
73 }
74 }
75 if (i == XEN_EXTRA_MEM_MAX_REGIONS)
76 printk(KERN_WARNING "Warning: not enough extra memory regions\n");
68 77
69 xen_extra_mem_size += size; 78 memblock_x86_reserve_range(start, start + size, "XEN EXTRA");
70 79
71 xen_max_p2m_pfn = PFN_DOWN(extra_start + size); 80 xen_max_p2m_pfn = PFN_DOWN(start + size);
72 81
73 for (pfn = PFN_DOWN(extra_start); pfn <= xen_max_p2m_pfn; pfn++) 82 for (pfn = PFN_DOWN(start); pfn <= xen_max_p2m_pfn; pfn++)
74 __set_phys_to_machine(pfn, INVALID_P2M_ENTRY); 83 __set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
75} 84}
76 85
77static unsigned long __init xen_release_chunk(phys_addr_t start_addr, 86static unsigned long __init xen_release_chunk(unsigned long start,
78 phys_addr_t end_addr) 87 unsigned long end)
79{ 88{
80 struct xen_memory_reservation reservation = { 89 struct xen_memory_reservation reservation = {
81 .address_bits = 0, 90 .address_bits = 0,
82 .extent_order = 0, 91 .extent_order = 0,
83 .domid = DOMID_SELF 92 .domid = DOMID_SELF
84 }; 93 };
85 unsigned long start, end;
86 unsigned long len = 0; 94 unsigned long len = 0;
87 unsigned long pfn; 95 unsigned long pfn;
88 int ret; 96 int ret;
89 97
90 start = PFN_UP(start_addr);
91 end = PFN_DOWN(end_addr);
92
93 if (end <= start)
94 return 0;
95
96 for(pfn = start; pfn < end; pfn++) { 98 for(pfn = start; pfn < end; pfn++) {
97 unsigned long mfn = pfn_to_mfn(pfn); 99 unsigned long mfn = pfn_to_mfn(pfn);
98 100
@@ -117,72 +119,52 @@ static unsigned long __init xen_release_chunk(phys_addr_t start_addr,
117 return len; 119 return len;
118} 120}
119 121
120static unsigned long __init xen_return_unused_memory(unsigned long max_pfn, 122static unsigned long __init xen_set_identity_and_release(
121 const struct e820map *e820) 123 const struct e820entry *list, size_t map_size, unsigned long nr_pages)
122{ 124{
123 phys_addr_t max_addr = PFN_PHYS(max_pfn); 125 phys_addr_t start = 0;
124 phys_addr_t last_end = ISA_END_ADDRESS;
125 unsigned long released = 0; 126 unsigned long released = 0;
126 int i;
127
128 /* Free any unused memory above the low 1Mbyte. */
129 for (i = 0; i < e820->nr_map && last_end < max_addr; i++) {
130 phys_addr_t end = e820->map[i].addr;
131 end = min(max_addr, end);
132
133 if (last_end < end)
134 released += xen_release_chunk(last_end, end);
135 last_end = max(last_end, e820->map[i].addr + e820->map[i].size);
136 }
137
138 if (last_end < max_addr)
139 released += xen_release_chunk(last_end, max_addr);
140
141 printk(KERN_INFO "released %lu pages of unused memory\n", released);
142 return released;
143}
144
145static unsigned long __init xen_set_identity(const struct e820entry *list,
146 ssize_t map_size)
147{
148 phys_addr_t last = xen_initial_domain() ? 0 : ISA_END_ADDRESS;
149 phys_addr_t start_pci = last;
150 const struct e820entry *entry;
151 unsigned long identity = 0; 127 unsigned long identity = 0;
128 const struct e820entry *entry;
152 int i; 129 int i;
153 130
131 /*
132 * Combine non-RAM regions and gaps until a RAM region (or the
133 * end of the map) is reached, then set the 1:1 map and
134 * release the pages (if available) in those non-RAM regions.
135 *
136 * The combined non-RAM regions are rounded to a whole number
137 * of pages so any partial pages are accessible via the 1:1
138 * mapping. This is needed for some BIOSes that put (for
139 * example) the DMI tables in a reserved region that begins on
140 * a non-page boundary.
141 */
154 for (i = 0, entry = list; i < map_size; i++, entry++) { 142 for (i = 0, entry = list; i < map_size; i++, entry++) {
155 phys_addr_t start = entry->addr; 143 phys_addr_t end = entry->addr + entry->size;
156 phys_addr_t end = start + entry->size;
157 144
158 if (start < last) 145 if (entry->type == E820_RAM || i == map_size - 1) {
159 start = last; 146 unsigned long start_pfn = PFN_DOWN(start);
147 unsigned long end_pfn = PFN_UP(end);
160 148
161 if (end <= start) 149 if (entry->type == E820_RAM)
162 continue; 150 end_pfn = PFN_UP(entry->addr);
163 151
164 /* Skip over the 1MB region. */ 152 if (start_pfn < end_pfn) {
165 if (last > end) 153 if (start_pfn < nr_pages)
166 continue; 154 released += xen_release_chunk(
155 start_pfn, min(end_pfn, nr_pages));
167 156
168 if ((entry->type == E820_RAM) || (entry->type == E820_UNUSABLE)) {
169 if (start > start_pci)
170 identity += set_phys_range_identity( 157 identity += set_phys_range_identity(
171 PFN_UP(start_pci), PFN_DOWN(start)); 158 start_pfn, end_pfn);
172 159 }
173 /* Without saving 'last' we would gooble RAM too 160 start = end;
174 * at the end of the loop. */
175 last = end;
176 start_pci = end;
177 continue;
178 } 161 }
179 start_pci = min(start, start_pci);
180 last = end;
181 } 162 }
182 if (last > start_pci) 163
183 identity += set_phys_range_identity( 164 printk(KERN_INFO "Released %lu pages of unused memory\n", released);
184 PFN_UP(start_pci), PFN_DOWN(last)); 165 printk(KERN_INFO "Set %ld page(s) to 1-1 mapping\n", identity);
185 return identity; 166
167 return released;
186} 168}
187 169
188static unsigned long __init xen_get_max_pages(void) 170static unsigned long __init xen_get_max_pages(void)
@@ -197,21 +179,32 @@ static unsigned long __init xen_get_max_pages(void)
197 return min(max_pages, MAX_DOMAIN_PAGES); 179 return min(max_pages, MAX_DOMAIN_PAGES);
198} 180}
199 181
182static void xen_align_and_add_e820_region(u64 start, u64 size, int type)
183{
184 u64 end = start + size;
185
186 /* Align RAM regions to page boundaries. */
187 if (type == E820_RAM) {
188 start = PAGE_ALIGN(start);
189 end &= ~((u64)PAGE_SIZE - 1);
190 }
191
192 e820_add_region(start, end - start, type);
193}
194
200/** 195/**
201 * machine_specific_memory_setup - Hook for machine specific memory setup. 196 * machine_specific_memory_setup - Hook for machine specific memory setup.
202 **/ 197 **/
203char * __init xen_memory_setup(void) 198char * __init xen_memory_setup(void)
204{ 199{
205 static struct e820entry map[E820MAX] __initdata; 200 static struct e820entry map[E820MAX] __initdata;
206 static struct e820entry map_raw[E820MAX] __initdata;
207 201
208 unsigned long max_pfn = xen_start_info->nr_pages; 202 unsigned long max_pfn = xen_start_info->nr_pages;
209 unsigned long long mem_end; 203 unsigned long long mem_end;
210 int rc; 204 int rc;
211 struct xen_memory_map memmap; 205 struct xen_memory_map memmap;
206 unsigned long max_pages;
212 unsigned long extra_pages = 0; 207 unsigned long extra_pages = 0;
213 unsigned long extra_limit;
214 unsigned long identity_pages = 0;
215 int i; 208 int i;
216 int op; 209 int op;
217 210
@@ -237,58 +230,65 @@ char * __init xen_memory_setup(void)
237 } 230 }
238 BUG_ON(rc); 231 BUG_ON(rc);
239 232
240 memcpy(map_raw, map, sizeof(map)); 233 /* Make sure the Xen-supplied memory map is well-ordered. */
241 e820.nr_map = 0; 234 sanitize_e820_map(map, memmap.nr_entries, &memmap.nr_entries);
242 xen_extra_mem_start = mem_end; 235
243 for (i = 0; i < memmap.nr_entries; i++) { 236 max_pages = xen_get_max_pages();
244 unsigned long long end; 237 if (max_pages > max_pfn)
245 238 extra_pages += max_pages - max_pfn;
246 /* Guard against non-page aligned E820 entries. */ 239
247 if (map[i].type == E820_RAM) 240 /*
248 map[i].size -= (map[i].size + map[i].addr) % PAGE_SIZE; 241 * Set P2M for all non-RAM pages and E820 gaps to be identity
249 242 * type PFNs. Any RAM pages that would be made inaccesible by
250 end = map[i].addr + map[i].size; 243 * this are first released.
251 if (map[i].type == E820_RAM && end > mem_end) { 244 */
252 /* RAM off the end - may be partially included */ 245 xen_released_pages = xen_set_identity_and_release(
253 u64 delta = min(map[i].size, end - mem_end); 246 map, memmap.nr_entries, max_pfn);
254 247 extra_pages += xen_released_pages;
255 map[i].size -= delta; 248
256 end -= delta; 249 /*
257 250 * Clamp the amount of extra memory to a EXTRA_MEM_RATIO
258 extra_pages += PFN_DOWN(delta); 251 * factor the base size. On non-highmem systems, the base
259 /* 252 * size is the full initial memory allocation; on highmem it
260 * Set RAM below 4GB that is not for us to be unusable. 253 * is limited to the max size of lowmem, so that it doesn't
261 * This prevents "System RAM" address space from being 254 * get completely filled.
262 * used as potential resource for I/O address (happens 255 *
263 * when 'allocate_resource' is called). 256 * In principle there could be a problem in lowmem systems if
264 */ 257 * the initial memory is also very large with respect to
265 if (delta && 258 * lowmem, but we won't try to deal with that here.
266 (xen_initial_domain() && end < 0x100000000ULL)) 259 */
267 e820_add_region(end, delta, E820_UNUSABLE); 260 extra_pages = min(EXTRA_MEM_RATIO * min(max_pfn, PFN_DOWN(MAXMEM)),
261 extra_pages);
262
263 i = 0;
264 while (i < memmap.nr_entries) {
265 u64 addr = map[i].addr;
266 u64 size = map[i].size;
267 u32 type = map[i].type;
268
269 if (type == E820_RAM) {
270 if (addr < mem_end) {
271 size = min(size, mem_end - addr);
272 } else if (extra_pages) {
273 size = min(size, (u64)extra_pages * PAGE_SIZE);
274 extra_pages -= size / PAGE_SIZE;
275 xen_add_extra_mem(addr, size);
276 } else
277 type = E820_UNUSABLE;
268 } 278 }
269 279
270 if (map[i].size > 0 && end > xen_extra_mem_start) 280 xen_align_and_add_e820_region(addr, size, type);
271 xen_extra_mem_start = end;
272 281
273 /* Add region if any remains */ 282 map[i].addr += size;
274 if (map[i].size > 0) 283 map[i].size -= size;
275 e820_add_region(map[i].addr, map[i].size, map[i].type); 284 if (map[i].size == 0)
285 i++;
276 } 286 }
277 /* Align the balloon area so that max_low_pfn does not get set
278 * to be at the _end_ of the PCI gap at the far end (fee01000).
279 * Note that xen_extra_mem_start gets set in the loop above to be
280 * past the last E820 region. */
281 if (xen_initial_domain() && (xen_extra_mem_start < (1ULL<<32)))
282 xen_extra_mem_start = (1ULL<<32);
283 287
284 /* 288 /*
285 * In domU, the ISA region is normal, usable memory, but we 289 * In domU, the ISA region is normal, usable memory, but we
286 * reserve ISA memory anyway because too many things poke 290 * reserve ISA memory anyway because too many things poke
287 * about in there. 291 * about in there.
288 *
289 * In Dom0, the host E820 information can leave gaps in the
290 * ISA range, which would cause us to release those pages. To
291 * avoid this, we unconditionally reserve them here.
292 */ 292 */
293 e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS, 293 e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS,
294 E820_RESERVED); 294 E820_RESERVED);
@@ -305,44 +305,6 @@ char * __init xen_memory_setup(void)
305 305
306 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); 306 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
307 307
308 extra_limit = xen_get_max_pages();
309 if (max_pfn + extra_pages > extra_limit) {
310 if (extra_limit > max_pfn)
311 extra_pages = extra_limit - max_pfn;
312 else
313 extra_pages = 0;
314 }
315
316 extra_pages += xen_return_unused_memory(xen_start_info->nr_pages, &e820);
317
318 /*
319 * Clamp the amount of extra memory to a EXTRA_MEM_RATIO
320 * factor the base size. On non-highmem systems, the base
321 * size is the full initial memory allocation; on highmem it
322 * is limited to the max size of lowmem, so that it doesn't
323 * get completely filled.
324 *
325 * In principle there could be a problem in lowmem systems if
326 * the initial memory is also very large with respect to
327 * lowmem, but we won't try to deal with that here.
328 */
329 extra_limit = min(EXTRA_MEM_RATIO * min(max_pfn, PFN_DOWN(MAXMEM)),
330 max_pfn + extra_pages);
331
332 if (extra_limit >= max_pfn)
333 extra_pages = extra_limit - max_pfn;
334 else
335 extra_pages = 0;
336
337 xen_add_extra_mem(extra_pages);
338
339 /*
340 * Set P2M for all non-RAM pages and E820 gaps to be identity
341 * type PFNs. We supply it with the non-sanitized version
342 * of the E820.
343 */
344 identity_pages = xen_set_identity(map_raw, memmap.nr_entries);
345 printk(KERN_INFO "Set %ld page(s) to 1-1 mapping.\n", identity_pages);
346 return "Xen"; 308 return "Xen";
347} 309}
348 310
diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c
index f717e20d961..7dde2445642 100644
--- a/arch/xtensa/platforms/iss/network.c
+++ b/arch/xtensa/platforms/iss/network.c
@@ -633,7 +633,7 @@ static const struct net_device_ops iss_netdev_ops = {
633 .ndo_set_mac_address = iss_net_set_mac, 633 .ndo_set_mac_address = iss_net_set_mac,
634 //.ndo_do_ioctl = iss_net_ioctl, 634 //.ndo_do_ioctl = iss_net_ioctl,
635 .ndo_tx_timeout = iss_net_tx_timeout, 635 .ndo_tx_timeout = iss_net_tx_timeout,
636 .ndo_set_multicast_list = iss_net_set_multicast_list, 636 .ndo_set_rx_mode = iss_net_set_multicast_list,
637}; 637};
638 638
639static int iss_net_configure(int index, char *init) 639static int iss_net_configure(int index, char *init)