aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/Makefile83
-rw-r--r--arch/alpha/kernel/entry.S9
-rw-r--r--arch/alpha/kernel/ptrace.c46
-rw-r--r--arch/alpha/kernel/vmlinux.lds.S260
-rw-r--r--arch/alpha/mm/fault.c2
-rw-r--r--arch/arm/Kconfig23
-rw-r--r--arch/arm/Kconfig-nommu2
-rw-r--r--arch/arm/Makefile2
-rw-r--r--arch/arm/boot/compressed/head-xscale.S4
-rw-r--r--arch/arm/common/Makefile1
-rw-r--r--arch/arm/common/dmabounce.c4
-rw-r--r--arch/arm/common/it8152.c387
-rw-r--r--arch/arm/configs/cm_x270_defconfig1410
-rw-r--r--arch/arm/configs/omap_h2_1610_defconfig399
-rw-r--r--arch/arm/configs/omap_osk_5912_defconfig1073
-rw-r--r--arch/arm/kernel/bios32.c28
-rw-r--r--arch/arm/kernel/calls.S1
-rw-r--r--arch/arm/kernel/ptrace.c4
-rw-r--r--arch/arm/kernel/relocate_kernel.S29
-rw-r--r--arch/arm/kernel/setup.c51
-rw-r--r--arch/arm/mach-at91/Kconfig25
-rw-r--r--arch/arm/mach-at91/Makefile5
-rw-r--r--arch/arm/mach-at91/at91rm9200_time.c195
-rw-r--r--arch/arm/mach-at91/at91x40.c67
-rw-r--r--arch/arm/mach-at91/at91x40_time.c80
-rw-r--r--arch/arm/mach-at91/board-eb01.c44
-rw-r--r--arch/arm/mach-at91/generic.h3
-rw-r--r--arch/arm/mach-clps7500/core.c6
-rw-r--r--arch/arm/mach-ep93xx/Kconfig6
-rw-r--r--arch/arm/mach-ep93xx/Makefile1
-rw-r--r--arch/arm/mach-ep93xx/edb9307.c91
-rw-r--r--arch/arm/mach-footbridge/isa.c45
-rw-r--r--arch/arm/mach-imx/cpufreq.c1
-rw-r--r--arch/arm/mach-ns9xxx/Makefile2
-rw-r--r--arch/arm/mach-ns9xxx/board-a9m9750dev.c70
-rw-r--r--arch/arm/mach-ns9xxx/gpio.c190
-rw-r--r--arch/arm/mach-ns9xxx/irq.c50
-rw-r--r--arch/arm/mach-ns9xxx/time.c172
-rw-r--r--arch/arm/mach-omap1/Kconfig38
-rw-r--r--arch/arm/mach-omap1/Makefile3
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c120
-rw-r--r--arch/arm/mach-omap1/board-h2.c124
-rw-r--r--arch/arm/mach-omap1/board-h3.c80
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c98
-rw-r--r--arch/arm/mach-omap1/board-osk.c119
-rw-r--r--arch/arm/mach-omap1/board-palmte.c377
-rw-r--r--arch/arm/mach-omap1/board-palmtt.c357
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c383
-rw-r--r--arch/arm/mach-omap1/board-sx1.c494
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c2
-rw-r--r--arch/arm/mach-omap1/clock.c34
-rw-r--r--arch/arm/mach-omap1/clock.h35
-rw-r--r--arch/arm/mach-omap1/leds-innovator.c3
-rw-r--r--arch/arm/mach-omap1/mux.c24
-rw-r--r--arch/arm/mach-omap1/pm.c5
-rw-r--r--arch/arm/mach-omap2/Kconfig11
-rw-r--r--arch/arm/mach-omap2/Makefile1
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c218
-rw-r--r--arch/arm/mach-omap2/board-apollon.c99
-rw-r--r--arch/arm/mach-omap2/board-h4.c46
-rw-r--r--arch/arm/mach-omap2/devices.c6
-rw-r--r--arch/arm/mach-omap2/gpmc.c47
-rw-r--r--arch/arm/mach-omap2/id.c6
-rw-r--r--arch/arm/mach-omap2/io.c22
-rw-r--r--arch/arm/mach-omap2/irq.c19
-rw-r--r--arch/arm/mach-omap2/memory.c18
-rw-r--r--arch/arm/mach-omap2/mux.c38
-rw-r--r--arch/arm/mach-omap2/usb-tusb6010.c349
-rw-r--r--arch/arm/mach-pxa/Kconfig34
-rw-r--r--arch/arm/mach-pxa/Makefile47
-rw-r--r--arch/arm/mach-pxa/clock.c79
-rw-r--r--arch/arm/mach-pxa/clock.h43
-rw-r--r--arch/arm/mach-pxa/cm-x270-pci.c218
-rw-r--r--arch/arm/mach-pxa/cm-x270-pci.h13
-rw-r--r--arch/arm/mach-pxa/cm-x270.c645
-rw-r--r--arch/arm/mach-pxa/devices.h3
-rw-r--r--arch/arm/mach-pxa/generic.c184
-rw-r--r--arch/arm/mach-pxa/generic.h26
-rw-r--r--arch/arm/mach-pxa/irq.c80
-rw-r--r--arch/arm/mach-pxa/lubbock.c19
-rw-r--r--arch/arm/mach-pxa/mainstone.c19
-rw-r--r--arch/arm/mach-pxa/mfp.c235
-rw-r--r--arch/arm/mach-pxa/pxa25x.c90
-rw-r--r--arch/arm/mach-pxa/pxa27x.c127
-rw-r--r--arch/arm/mach-pxa/pxa300.c93
-rw-r--r--arch/arm/mach-pxa/pxa320.c88
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c216
-rw-r--r--arch/arm/mach-pxa/time.c53
-rw-r--r--arch/arm/mach-pxa/zylonite.c184
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa300.c188
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa320.c173
-rw-r--r--arch/arm/mach-s3c2410/dma.c2
-rw-r--r--arch/arm/mach-s3c2410/mach-amlm5900.c54
-rw-r--r--arch/arm/mach-s3c2410/mach-bast.c83
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c56
-rw-r--r--arch/arm/mach-s3c2410/mach-qt2410.c219
-rw-r--r--arch/arm/mach-s3c2412/dma.c2
-rw-r--r--arch/arm/mach-s3c2412/irq.c58
-rw-r--r--arch/arm/mach-s3c2412/s3c2412.c5
-rw-r--r--arch/arm/mach-s3c2440/dma.c2
-rw-r--r--arch/arm/mach-s3c2440/mach-rx3715.c72
-rw-r--r--arch/arm/mach-s3c2440/mach-smdk2440.c78
-rw-r--r--arch/arm/mach-s3c2443/dma.c2
-rw-r--r--arch/arm/mach-s3c2443/irq.c4
-rw-r--r--arch/arm/mach-sa1100/cpu-sa1110.c1
-rw-r--r--arch/arm/mm/Kconfig4
-rw-r--r--arch/arm/mm/consistent.c4
-rw-r--r--arch/arm/mm/fault.c2
-rw-r--r--arch/arm/nwfpe/ARM-gcc.h2
-rw-r--r--arch/arm/nwfpe/entry.S25
-rw-r--r--arch/arm/nwfpe/fpa11.inl8
-rw-r--r--arch/arm/plat-omap/Kconfig9
-rw-r--r--arch/arm/plat-omap/Makefile1
-rw-r--r--arch/arm/plat-omap/cpu-omap.c1
-rw-r--r--arch/arm/plat-omap/debug-devices.c86
-rw-r--r--arch/arm/plat-omap/dma.c6
-rw-r--r--arch/arm/plat-s3c24xx/dma.c2
-rw-r--r--arch/arm/plat-s3c24xx/sleep.S8
-rw-r--r--arch/avr32/kernel/kprobes.c2
-rw-r--r--arch/avr32/kernel/ptrace.c5
-rw-r--r--arch/avr32/mm/fault.c2
-rw-r--r--arch/blackfin/kernel/ptrace.c6
-rw-r--r--arch/blackfin/mach-bf533/cpu.c2
-rw-r--r--arch/blackfin/mach-bf537/boards/generic_board.c2
-rw-r--r--arch/blackfin/mach-bf537/boards/pnav10.c2
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c2
-rw-r--r--arch/blackfin/mach-bf548/boards/ezkit.c6
-rw-r--r--arch/cris/arch-v10/kernel/ptrace.c4
-rw-r--r--arch/cris/arch-v10/kernel/time.c8
-rw-r--r--arch/cris/arch-v32/kernel/ptrace.c4
-rw-r--r--arch/cris/arch-v32/kernel/smp.c8
-rw-r--r--arch/cris/mm/fault.c2
-rw-r--r--arch/frv/kernel/time.c5
-rw-r--r--arch/frv/mm/fault.c2
-rw-r--r--arch/i386/Kconfig26
-rw-r--r--arch/ia64/Kconfig19
-rw-r--r--arch/ia64/configs/sn2_defconfig443
-rw-r--r--arch/ia64/hp/common/Makefile1
-rw-r--r--arch/ia64/hp/common/aml_nfw.c236
-rw-r--r--arch/ia64/hp/common/sba_iommu.c14
-rw-r--r--arch/ia64/hp/sim/simscsi.c10
-rw-r--r--arch/ia64/kernel/cpufreq/acpi-cpufreq.c2
-rw-r--r--arch/ia64/kernel/crash.c13
-rw-r--r--arch/ia64/kernel/gate.lds.S135
-rw-r--r--arch/ia64/kernel/kprobes.c2
-rw-r--r--arch/ia64/kernel/machine_kexec.c6
-rw-r--r--arch/ia64/kernel/mca.c88
-rw-r--r--arch/ia64/kernel/mca_drv.h2
-rw-r--r--arch/ia64/kernel/palinfo.c6
-rw-r--r--arch/ia64/kernel/perfmon.c7
-rw-r--r--arch/ia64/kernel/salinfo.c4
-rw-r--r--arch/ia64/kernel/setup.c12
-rw-r--r--arch/ia64/kernel/smpboot.c18
-rw-r--r--arch/ia64/kernel/topology.c12
-rw-r--r--arch/ia64/kernel/uncached.c4
-rw-r--r--arch/ia64/mm/discontig.c8
-rw-r--r--arch/ia64/mm/fault.c2
-rw-r--r--arch/ia64/mm/hugetlbpage.c4
-rw-r--r--arch/ia64/mm/init.c20
-rw-r--r--arch/ia64/sn/kernel/tiocx.c3
-rw-r--r--arch/ia64/sn/pci/pci_dma.c11
-rw-r--r--arch/m32r/kernel/ptrace.c50
-rw-r--r--arch/m32r/kernel/time.c8
-rw-r--r--arch/m32r/mm/fault.c2
-rw-r--r--arch/m68k/atari/atakeyb.c104
-rw-r--r--arch/m68k/kernel/ptrace.c4
-rw-r--r--arch/m68k/mm/fault.c2
-rw-r--r--arch/mips/Kconfig2
-rw-r--r--arch/mips/au1000/common/au1xxx_irqmap.c2
-rw-r--r--arch/mips/au1000/common/dbdma.c2
-rw-r--r--arch/mips/au1000/common/irq.c662
-rw-r--r--arch/mips/au1000/common/prom.c61
-rw-r--r--arch/mips/au1000/common/setup.c5
-rw-r--r--arch/mips/au1000/db1x00/init.c10
-rw-r--r--arch/mips/au1000/db1x00/irqmap.c2
-rw-r--r--arch/mips/au1000/mtx-1/init.c6
-rw-r--r--arch/mips/au1000/mtx-1/irqmap.c2
-rw-r--r--arch/mips/au1000/pb1000/init.c10
-rw-r--r--arch/mips/au1000/pb1000/irqmap.c2
-rw-r--r--arch/mips/au1000/pb1100/init.c10
-rw-r--r--arch/mips/au1000/pb1100/irqmap.c2
-rw-r--r--arch/mips/au1000/pb1200/board_setup.c6
-rw-r--r--arch/mips/au1000/pb1200/init.c10
-rw-r--r--arch/mips/au1000/pb1200/irqmap.c4
-rw-r--r--arch/mips/au1000/pb1500/init.c10
-rw-r--r--arch/mips/au1000/pb1500/irqmap.c2
-rw-r--r--arch/mips/au1000/pb1550/init.c10
-rw-r--r--arch/mips/au1000/pb1550/irqmap.c2
-rw-r--r--arch/mips/au1000/xxs1500/init.c10
-rw-r--r--arch/mips/au1000/xxs1500/irqmap.c2
-rw-r--r--arch/mips/jmr3927/rbhma3100/setup.c2
-rw-r--r--arch/mips/kernel/ptrace.c4
-rw-r--r--arch/mips/kernel/smp.c6
-rw-r--r--arch/mips/kernel/time.c2
-rw-r--r--arch/mips/kernel/traps.c21
-rw-r--r--arch/mips/kernel/vmlinux.lds.S15
-rw-r--r--arch/mips/kernel/vpe.c27
-rw-r--r--arch/mips/lasat/interrupt.c8
-rw-r--r--arch/mips/mipssim/sim_cmdline.c5
-rw-r--r--arch/mips/mm/c-r4k.c10
-rw-r--r--arch/mips/mm/fault.c2
-rw-r--r--arch/mips/mm/init.c19
-rw-r--r--arch/mips/mm/tlbex.c96
-rw-r--r--arch/mips/pci/pci-lasat.c19
-rw-r--r--arch/mips/sgi-ip22/Makefile2
-rw-r--r--arch/mips/sgi-ip22/ip22-reset.c9
-rw-r--r--arch/mips/sgi-ip32/ip32-irq.c162
-rw-r--r--arch/mips/sgi-ip32/ip32-setup.c2
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c2
-rw-r--r--arch/parisc/kernel/ptrace.c4
-rw-r--r--arch/parisc/mm/fault.c2
-rw-r--r--arch/powerpc/Kconfig1
-rw-r--r--arch/powerpc/kernel/dma_64.c5
-rw-r--r--arch/powerpc/kernel/ibmebus.c11
-rw-r--r--arch/powerpc/kernel/iommu.c23
-rw-r--r--arch/powerpc/kernel/kprobes.c2
-rw-r--r--arch/powerpc/kernel/of_device.c37
-rw-r--r--arch/powerpc/kernel/ptrace.c4
-rw-r--r--arch/powerpc/kernel/setup-common.c20
-rw-r--r--arch/powerpc/kernel/setup_64.c3
-rw-r--r--arch/powerpc/kernel/smp.c4
-rw-r--r--arch/powerpc/kernel/vdso32/vdso32.lds.S219
-rw-r--r--arch/powerpc/kernel/vdso64/vdso64.lds.S225
-rw-r--r--arch/powerpc/kernel/vio.c16
-rw-r--r--arch/powerpc/mm/init_64.c67
-rw-r--r--arch/powerpc/mm/mem.c45
-rw-r--r--arch/powerpc/platforms/52xx/lite5200.c14
-rw-r--r--arch/powerpc/platforms/cell/axon_msi.c11
-rw-r--r--arch/powerpc/platforms/cell/cbe_cpufreq.c4
-rw-r--r--arch/powerpc/platforms/pasemi/cpufreq.c2
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_32.c1
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_64.c1
-rw-r--r--arch/powerpc/platforms/ps3/system-bus.c17
-rw-r--r--arch/powerpc/sysdev/dcr.c4
-rw-r--r--arch/powerpc/sysdev/mpic.c4
-rw-r--r--arch/ppc/mm/fault.c2
-rw-r--r--arch/s390/appldata/appldata_base.c59
-rw-r--r--arch/s390/kernel/audit.c7
-rw-r--r--arch/s390/kernel/audit.h15
-rw-r--r--arch/s390/kernel/compat_audit.c1
-rw-r--r--arch/s390/kernel/cpcmd.c100
-rw-r--r--arch/s390/kernel/dis.c5
-rw-r--r--arch/s390/kernel/entry.S12
-rw-r--r--arch/s390/kernel/entry64.S9
-rw-r--r--arch/s390/kernel/ipl.c4
-rw-r--r--arch/s390/kernel/kprobes.c2
-rw-r--r--arch/s390/kernel/ptrace.c5
-rw-r--r--arch/s390/kernel/vmlinux.lds.S234
-rw-r--r--arch/s390/mm/fault.c4
-rw-r--r--arch/sh/Kconfig53
-rw-r--r--arch/sh/Kconfig.debug6
-rw-r--r--arch/sh/Makefile4
-rw-r--r--arch/sh/boards/hp6xx/hp6xx_apm.c9
-rw-r--r--arch/sh/boards/hp6xx/setup.c35
-rw-r--r--arch/sh/boards/magicpanelr2/Kconfig13
-rw-r--r--arch/sh/boards/magicpanelr2/Makefile5
-rw-r--r--arch/sh/boards/magicpanelr2/setup.c394
-rw-r--r--arch/sh/boards/mpc1211/setup.c2
-rw-r--r--arch/sh/boards/renesas/r7780rp/Makefile5
-rw-r--r--arch/sh/boards/renesas/r7780rp/irq-r7780mp.c61
-rw-r--r--arch/sh/boards/renesas/r7780rp/irq-r7780rp.c6
-rw-r--r--arch/sh/boards/renesas/r7780rp/irq-r7785rp.c46
-rw-r--r--arch/sh/boards/renesas/r7780rp/setup.c70
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/Kconfig19
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/irq.c179
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/setup.c95
-rw-r--r--arch/sh/boards/renesas/x3proto/Makefile1
-rw-r--r--arch/sh/boards/renesas/x3proto/ilsel.c151
-rw-r--r--arch/sh/boards/renesas/x3proto/setup.c136
-rw-r--r--arch/sh/boards/se/7206/io.c31
-rw-r--r--arch/sh/boards/se/7206/setup.c19
-rw-r--r--arch/sh/boards/se/7343/irq.c7
-rw-r--r--arch/sh/boards/se/7343/setup.c2
-rw-r--r--arch/sh/boards/se/770x/setup.c10
-rw-r--r--arch/sh/boards/se/7722/setup.c9
-rw-r--r--arch/sh/boards/se/7751/setup.c11
-rw-r--r--arch/sh/boards/se/7780/irq.c28
-rw-r--r--arch/sh/boards/se/7780/setup.c7
-rw-r--r--arch/sh/boards/sh03/setup.c28
-rw-r--r--arch/sh/boards/shmin/setup.c26
-rw-r--r--arch/sh/boards/snapgear/setup.c30
-rw-r--r--arch/sh/boards/titan/setup.c30
-rw-r--r--arch/sh/cchips/Kconfig13
-rw-r--r--arch/sh/cchips/hd6446x/hd64461.c13
-rw-r--r--arch/sh/cchips/hd6446x/hd64465/setup.c7
-rw-r--r--arch/sh/cchips/voyagergx/irq.c188
-rw-r--r--arch/sh/configs/dreamcast_defconfig155
-rw-r--r--arch/sh/configs/hp6xx_defconfig559
-rw-r--r--arch/sh/configs/magicpanelr2_defconfig925
-rw-r--r--arch/sh/configs/rts7751r2d1_defconfig (renamed from arch/sh/configs/rts7751r2d_defconfig)472
-rw-r--r--arch/sh/configs/rts7751r2dplus_defconfig1167
-rw-r--r--arch/sh/configs/se7206_defconfig223
-rw-r--r--arch/sh/configs/shx3_defconfig456
-rw-r--r--arch/sh/drivers/dma/Kconfig1
-rw-r--r--arch/sh/drivers/dma/dma-sh.c13
-rw-r--r--arch/sh/drivers/heartbeat.c70
-rw-r--r--arch/sh/drivers/pci/ops-rts7751r2d.c8
-rw-r--r--arch/sh/drivers/pci/pci-sh7780.c13
-rw-r--r--arch/sh/kernel/cpu/clock.c2
-rw-r--r--arch/sh/kernel/cpu/init.c27
-rw-r--r--arch/sh/kernel/cpu/irq/Makefile4
-rw-r--r--arch/sh/kernel/cpu/irq/intc.c562
-rw-r--r--arch/sh/kernel/cpu/irq/intc2.c86
-rw-r--r--arch/sh/kernel/cpu/sh2/probe.c19
-rw-r--r--arch/sh/kernel/cpu/sh2/setup-sh7619.c93
-rw-r--r--arch/sh/kernel/cpu/sh2a/probe.c18
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-sh7206.c217
-rw-r--r--arch/sh/kernel/cpu/sh3/Makefile10
-rw-r--r--arch/sh/kernel/cpu/sh3/probe.c48
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh7705.c172
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh7708.c43
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh7709.c145
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh770x.c224
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh7710.c200
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh7720.c210
-rw-r--r--arch/sh/kernel/cpu/sh4/probe.c178
-rw-r--r--arch/sh/kernel/cpu/sh4/setup-sh7750.c54
-rw-r--r--arch/sh/kernel/cpu/sh4/setup-sh7760.c253
-rw-r--r--arch/sh/kernel/cpu/sh4/sq.c4
-rw-r--r--arch/sh/kernel/cpu/sh4a/Makefile6
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7343.c4
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7722.c38
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7770.c4
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7780.c91
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7785.c304
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-shx3.c234
-rw-r--r--arch/sh/kernel/cpu/sh4a/smp-shx3.c120
-rw-r--r--arch/sh/kernel/cpufreq.c4
-rw-r--r--arch/sh/kernel/early_printk.c49
-rw-r--r--arch/sh/kernel/entry-common.S2
-rw-r--r--arch/sh/kernel/head.S18
-rw-r--r--arch/sh/kernel/kgdb_stub.c53
-rw-r--r--arch/sh/kernel/process.c8
-rw-r--r--arch/sh/kernel/ptrace.c4
-rw-r--r--arch/sh/kernel/setup.c15
-rw-r--r--arch/sh/kernel/sh_ksyms.c18
-rw-r--r--arch/sh/kernel/signal.c10
-rw-r--r--arch/sh/kernel/smp.c307
-rw-r--r--arch/sh/kernel/syscalls.S18
-rw-r--r--arch/sh/kernel/timers/timer-tmu.c3
-rw-r--r--arch/sh/kernel/traps.c5
-rw-r--r--arch/sh/kernel/vmlinux.lds.S10
-rw-r--r--arch/sh/kernel/vsyscall/vsyscall.lds.S77
-rw-r--r--arch/sh/mm/Kconfig67
-rw-r--r--arch/sh/mm/Makefile23
-rw-r--r--arch/sh/mm/cache-sh4.c81
-rw-r--r--arch/sh/mm/copy_page.S169
-rw-r--r--arch/sh/mm/fault-nommu.c64
-rw-r--r--arch/sh/mm/fault.c2
-rw-r--r--arch/sh/mm/init.c6
-rw-r--r--arch/sh/mm/pmb.c2
-rw-r--r--arch/sh/mm/tlb-sh4.c55
-rw-r--r--arch/sh64/Kconfig51
-rw-r--r--arch/sh64/Kconfig.debug13
-rw-r--r--arch/sh64/Makefile6
-rw-r--r--arch/sh64/configs/cayman_defconfig258
-rw-r--r--arch/sh64/configs/harp_defconfig756
-rw-r--r--arch/sh64/configs/sim_defconfig566
-rw-r--r--arch/sh64/kernel/Makefile2
-rw-r--r--arch/sh64/kernel/alphanum.c1
-rw-r--r--arch/sh64/kernel/ptrace.c4
-rw-r--r--arch/sh64/kernel/sh_ksyms.c32
-rw-r--r--arch/sh64/kernel/time.c14
-rw-r--r--arch/sh64/kernel/vmlinux.lds.S60
-rw-r--r--arch/sh64/lib/c-checksum.c3
-rw-r--r--arch/sh64/lib/io.c29
-rw-r--r--arch/sh64/lib/iomap.c10
-rw-r--r--arch/sh64/mach-cayman/setup.c10
-rw-r--r--arch/sh64/mach-harp/Makefile13
-rw-r--r--arch/sh64/mach-harp/setup.c25
-rw-r--r--arch/sh64/mach-romram/Makefile14
-rw-r--r--arch/sh64/mach-romram/setup.c141
-rw-r--r--arch/sh64/mach-sim/Makefile13
-rw-r--r--arch/sh64/mach-sim/setup.c53
-rw-r--r--arch/sh64/mm/Makefile4
-rw-r--r--arch/sh64/mm/consistent.c (renamed from arch/sh64/kernel/pci-dma.c)4
-rw-r--r--arch/sh64/mm/fault.c2
-rw-r--r--arch/sh64/mm/init.c4
-rw-r--r--arch/sh64/mm/ioremap.c7
-rw-r--r--arch/sparc/Kconfig.debug4
-rw-r--r--arch/sparc/kernel/ioport.c25
-rw-r--r--arch/sparc/kernel/irq.c12
-rw-r--r--arch/sparc/kernel/of_device.c5
-rw-r--r--arch/sparc/kernel/time.c4
-rw-r--r--arch/sparc/kernel/vmlinux.lds.S165
-rw-r--r--arch/sparc/mm/fault.c2
-rw-r--r--arch/sparc/mm/io-unit.c12
-rw-r--r--arch/sparc/mm/iommu.c10
-rw-r--r--arch/sparc/mm/sun4c.c10
-rw-r--r--arch/sparc64/Kconfig2
-rw-r--r--arch/sparc64/defconfig38
-rw-r--r--arch/sparc64/kernel/Makefile1
-rw-r--r--arch/sparc64/kernel/auxio.c4
-rw-r--r--arch/sparc64/kernel/entry.S14
-rw-r--r--arch/sparc64/kernel/iommu.c39
-rw-r--r--arch/sparc64/kernel/irq.c610
-rw-r--r--arch/sparc64/kernel/kprobes.c2
-rw-r--r--arch/sparc64/kernel/ktlb.S16
-rw-r--r--arch/sparc64/kernel/of_device.c5
-rw-r--r--arch/sparc64/kernel/pci.c60
-rw-r--r--arch/sparc64/kernel/pci_fire.c279
-rw-r--r--arch/sparc64/kernel/pci_impl.h32
-rw-r--r--arch/sparc64/kernel/pci_msi.c433
-rw-r--r--arch/sparc64/kernel/pci_psycho.c6
-rw-r--r--arch/sparc64/kernel/pci_schizo.c3
-rw-r--r--arch/sparc64/kernel/pci_sun4v.c437
-rw-r--r--arch/sparc64/kernel/power.c4
-rw-r--r--arch/sparc64/kernel/smp.c17
-rw-r--r--arch/sparc64/kernel/sun4v_ivec.S22
-rw-r--r--arch/sparc64/kernel/sys_sparc.c15
-rw-r--r--arch/sparc64/kernel/time.c4
-rw-r--r--arch/sparc64/kernel/traps.c4
-rw-r--r--arch/sparc64/kernel/us2e_cpufreq.c1
-rw-r--r--arch/sparc64/kernel/vmlinux.lds.S211
-rw-r--r--arch/sparc64/lib/xor.S12
-rw-r--r--arch/sparc64/mm/fault.c2
-rw-r--r--arch/sparc64/mm/init.c59
-rw-r--r--arch/um/Kconfig244
-rw-r--r--arch/um/Kconfig.char141
-rw-r--r--arch/um/Kconfig.debug47
-rw-r--r--arch/um/Kconfig.i38614
-rw-r--r--arch/um/Kconfig.net22
-rw-r--r--arch/um/Kconfig.x86_6414
-rw-r--r--arch/um/Makefile41
-rw-r--r--arch/um/Makefile-i38614
-rw-r--r--arch/um/Makefile-x86_643
-rw-r--r--arch/um/defconfig11
-rw-r--r--arch/um/drivers/Makefile11
-rw-r--r--arch/um/drivers/chan_kern.c211
-rw-r--r--arch/um/drivers/chan_user.c211
-rw-r--r--arch/um/drivers/cow_user.c133
-rw-r--r--arch/um/drivers/daemon.h20
-rw-r--r--arch/um/drivers/daemon_kern.c34
-rw-r--r--arch/um/drivers/daemon_user.c92
-rw-r--r--arch/um/drivers/fd.c69
-rw-r--r--arch/um/drivers/harddog_kern.c2
-rw-r--r--arch/um/drivers/harddog_user.c58
-rw-r--r--arch/um/drivers/hostaudio_kern.c118
-rw-r--r--arch/um/drivers/line.c237
-rw-r--r--arch/um/drivers/mcast.h16
-rw-r--r--arch/um/drivers/mcast_kern.c56
-rw-r--r--arch/um/drivers/mcast_user.c73
-rw-r--r--arch/um/drivers/mconsole_kern.c289
-rw-r--r--arch/um/drivers/mconsole_user.c119
-rw-r--r--arch/um/drivers/mmapper_kern.c64
-rw-r--r--arch/um/drivers/net_kern.c278
-rw-r--r--arch/um/drivers/net_user.c126
-rw-r--r--arch/um/drivers/null.c28
-rw-r--r--arch/um/drivers/pcap_kern.c38
-rw-r--r--arch/um/drivers/pcap_user.c58
-rw-r--r--arch/um/drivers/port_kern.c86
-rw-r--r--arch/um/drivers/port_user.c73
-rw-r--r--arch/um/drivers/pty.c30
-rw-r--r--arch/um/drivers/slip_kern.c38
-rw-r--r--arch/um/drivers/slip_user.c129
-rw-r--r--arch/um/drivers/slirp_kern.c59
-rw-r--r--arch/um/drivers/slirp_user.c74
-rw-r--r--arch/um/drivers/tty.c37
-rw-r--r--arch/um/drivers/ubd_kern.c2
-rw-r--r--arch/um/drivers/vde.h32
-rw-r--r--arch/um/drivers/vde_kern.c129
-rw-r--r--arch/um/drivers/vde_user.c127
-rw-r--r--arch/um/drivers/xterm.c28
-rw-r--r--arch/um/include/arch.h4
-rw-r--r--arch/um/include/as-layout.h27
-rw-r--r--arch/um/include/choose-mode.h38
-rw-r--r--arch/um/include/common-offsets.h10
-rw-r--r--arch/um/include/irq_user.h10
-rw-r--r--arch/um/include/kern_util.h30
-rw-r--r--arch/um/include/mconsole.h15
-rw-r--r--arch/um/include/mem.h21
-rw-r--r--arch/um/include/mode.h30
-rw-r--r--arch/um/include/mode_kern.h17
-rw-r--r--arch/um/include/net_kern.h13
-rw-r--r--arch/um/include/net_user.h4
-rw-r--r--arch/um/include/os.h69
-rw-r--r--arch/um/include/registers.h10
-rw-r--r--arch/um/include/skas/mmu-skas.h23
-rw-r--r--arch/um/include/skas/mode-skas.h9
-rw-r--r--arch/um/include/skas/mode_kern_skas.h41
-rw-r--r--arch/um/include/skas/skas.h5
-rw-r--r--arch/um/include/skas/uaccess-skas.h21
-rw-r--r--arch/um/include/sysdep-i386/kernel-offsets.h1
-rw-r--r--arch/um/include/sysdep-i386/ptrace.h133
-rw-r--r--arch/um/include/sysdep-i386/sigcontext.h30
-rw-r--r--arch/um/include/sysdep-i386/stub.h14
-rw-r--r--arch/um/include/sysdep-i386/thread.h11
-rw-r--r--arch/um/include/sysdep-x86_64/ptrace.h277
-rw-r--r--arch/um/include/sysdep-x86_64/sigcontext.h28
-rw-r--r--arch/um/include/sysdep-x86_64/stub.h13
-rw-r--r--arch/um/include/sysdep-x86_64/thread.h10
-rw-r--r--arch/um/include/task.h2
-rw-r--r--arch/um/include/tlb.h27
-rw-r--r--arch/um/include/tt/debug.h18
-rw-r--r--arch/um/include/tt/mmu-tt.h12
-rw-r--r--arch/um/include/tt/mode-tt.h23
-rw-r--r--arch/um/include/tt/mode_kern_tt.h40
-rw-r--r--arch/um/include/tt/tt.h37
-rw-r--r--arch/um/include/tt/uaccess-tt.h46
-rw-r--r--arch/um/include/um_mmu.h40
-rw-r--r--arch/um/include/um_uaccess.h64
-rw-r--r--arch/um/include/uml_uaccess.h24
-rw-r--r--arch/um/include/user.h8
-rw-r--r--arch/um/kernel/Makefile7
-rw-r--r--arch/um/kernel/dyn.lds.S2
-rw-r--r--arch/um/kernel/exec.c58
-rw-r--r--arch/um/kernel/init_task.c13
-rw-r--r--arch/um/kernel/irq.c113
-rw-r--r--arch/um/kernel/ksyms.c41
-rw-r--r--arch/um/kernel/mem.c2
-rw-r--r--arch/um/kernel/physmem.c69
-rw-r--r--arch/um/kernel/process.c226
-rw-r--r--arch/um/kernel/ptrace.c141
-rw-r--r--arch/um/kernel/reboot.c57
-rw-r--r--arch/um/kernel/signal.c59
-rw-r--r--arch/um/kernel/skas/Makefile4
-rw-r--r--arch/um/kernel/skas/clone.c6
-rw-r--r--arch/um/kernel/skas/exec.c40
-rw-r--r--arch/um/kernel/skas/mem.c22
-rw-r--r--arch/um/kernel/skas/mmu.c81
-rw-r--r--arch/um/kernel/skas/process.c187
-rw-r--r--arch/um/kernel/skas/syscall.c21
-rw-r--r--arch/um/kernel/skas/tlb.c164
-rw-r--r--arch/um/kernel/skas/uaccess.c146
-rw-r--r--arch/um/kernel/smp.c36
-rw-r--r--arch/um/kernel/syscall.c40
-rw-r--r--arch/um/kernel/time.c223
-rw-r--r--arch/um/kernel/tlb.c418
-rw-r--r--arch/um/kernel/trap.c129
-rw-r--r--arch/um/kernel/tt/Makefile14
-rw-r--r--arch/um/kernel/tt/exec_kern.c84
-rw-r--r--arch/um/kernel/tt/exec_user.c56
-rw-r--r--arch/um/kernel/tt/gdb.c280
-rw-r--r--arch/um/kernel/tt/gdb_kern.c40
-rw-r--r--arch/um/kernel/tt/include/mode-tt.h34
-rw-r--r--arch/um/kernel/tt/ksyms.c29
-rw-r--r--arch/um/kernel/tt/mem.c34
-rw-r--r--arch/um/kernel/tt/mem_user.c49
-rw-r--r--arch/um/kernel/tt/process_kern.c461
-rw-r--r--arch/um/kernel/tt/ptproxy/Makefile10
-rw-r--r--arch/um/kernel/tt/ptproxy/proxy.c377
-rw-r--r--arch/um/kernel/tt/ptproxy/ptproxy.h61
-rw-r--r--arch/um/kernel/tt/ptproxy/ptrace.c237
-rw-r--r--arch/um/kernel/tt/ptproxy/sysdep.c70
-rw-r--r--arch/um/kernel/tt/ptproxy/sysdep.h25
-rw-r--r--arch/um/kernel/tt/ptproxy/wait.c85
-rw-r--r--arch/um/kernel/tt/ptproxy/wait.h15
-rw-r--r--arch/um/kernel/tt/syscall_kern.c46
-rw-r--r--arch/um/kernel/tt/syscall_user.c60
-rw-r--r--arch/um/kernel/tt/tlb.c120
-rw-r--r--arch/um/kernel/tt/tracer.c461
-rw-r--r--arch/um/kernel/tt/trap_user.c70
-rw-r--r--arch/um/kernel/tt/uaccess.c73
-rw-r--r--arch/um/kernel/tt/uaccess_user.c105
-rw-r--r--arch/um/kernel/uaccess.c2
-rw-r--r--arch/um/kernel/um_arch.c217
-rw-r--r--arch/um/kernel/uml.lds.S7
-rw-r--r--arch/um/os-Linux/Makefile15
-rw-r--r--arch/um/os-Linux/aio.c122
-rw-r--r--arch/um/os-Linux/drivers/etap.h16
-rw-r--r--arch/um/os-Linux/drivers/ethertap_kern.c52
-rw-r--r--arch/um/os-Linux/drivers/ethertap_user.c132
-rw-r--r--arch/um/os-Linux/drivers/tuntap.h13
-rw-r--r--arch/um/os-Linux/drivers/tuntap_kern.c35
-rw-r--r--arch/um/os-Linux/drivers/tuntap_user.c102
-rw-r--r--arch/um/os-Linux/file.c130
-rw-r--r--arch/um/os-Linux/helper.c8
-rw-r--r--arch/um/os-Linux/irq.c6
-rw-r--r--arch/um/os-Linux/main.c120
-rw-r--r--arch/um/os-Linux/mem.c6
-rw-r--r--arch/um/os-Linux/process.c175
-rw-r--r--arch/um/os-Linux/registers.c57
-rw-r--r--arch/um/os-Linux/signal.c131
-rw-r--r--arch/um/os-Linux/skas/mem.c109
-rw-r--r--arch/um/os-Linux/skas/process.c316
-rw-r--r--arch/um/os-Linux/skas/trap.c51
-rw-r--r--arch/um/os-Linux/start_up.c218
-rw-r--r--arch/um/os-Linux/sys-i386/Makefile4
-rw-r--r--arch/um/os-Linux/sys-i386/registers.c129
-rw-r--r--arch/um/os-Linux/sys-x86_64/Makefile4
-rw-r--r--arch/um/os-Linux/sys-x86_64/registers.c75
-rw-r--r--arch/um/os-Linux/time.c111
-rw-r--r--arch/um/os-Linux/tls.c40
-rw-r--r--arch/um/os-Linux/trap.c23
-rw-r--r--arch/um/os-Linux/tt.c196
-rw-r--r--arch/um/os-Linux/uaccess.c2
-rw-r--r--arch/um/os-Linux/umid.c137
-rw-r--r--arch/um/os-Linux/util.c38
-rw-r--r--arch/um/scripts/Makefile.rules4
-rw-r--r--arch/um/sys-i386/Makefile20
-rw-r--r--arch/um/sys-i386/bugs.c108
-rw-r--r--arch/um/sys-i386/fault.c10
-rw-r--r--arch/um/sys-i386/ldt.c306
-rw-r--r--arch/um/sys-i386/ptrace.c368
-rw-r--r--arch/um/sys-i386/ptrace_user.c100
-rw-r--r--arch/um/sys-i386/sigcontext.c71
-rw-r--r--arch/um/sys-i386/signal.c409
-rw-r--r--arch/um/sys-i386/stub.S9
-rw-r--r--arch/um/sys-i386/stub_segv.c4
-rw-r--r--arch/um/sys-i386/tls.c101
-rw-r--r--arch/um/sys-i386/unmap.c25
-rw-r--r--arch/um/sys-i386/user-offsets.c6
-rw-r--r--arch/um/sys-x86_64/Makefile15
-rw-r--r--arch/um/sys-x86_64/bugs.c2
-rw-r--r--arch/um/sys-x86_64/fault.c9
-rw-r--r--arch/um/sys-x86_64/ptrace.c154
-rw-r--r--arch/um/sys-x86_64/sigcontext.c39
-rw-r--r--arch/um/sys-x86_64/signal.c297
-rw-r--r--arch/um/sys-x86_64/stub.S9
-rw-r--r--arch/um/sys-x86_64/stub_segv.c3
-rw-r--r--arch/um/sys-x86_64/syscalls.c108
-rw-r--r--arch/um/sys-x86_64/tls.c4
-rw-r--r--arch/um/sys-x86_64/unmap.c25
-rw-r--r--arch/um/sys-x86_64/user-offsets.c9
-rw-r--r--arch/v850/kernel/fpga85e2c.c5
-rw-r--r--arch/v850/kernel/time.c11
-rw-r--r--arch/x86/kernel/Makefile_326
-rw-r--r--arch/x86/kernel/Makefile_644
-rw-r--r--arch/x86/kernel/alternative.c1
-rw-r--r--arch/x86/kernel/apic_64.c372
-rw-r--r--arch/x86/kernel/bugs_64.c2
-rw-r--r--arch/x86/kernel/cpu/bugs.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c3
-rw-r--r--arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c1
-rw-r--r--arch/x86/kernel/cpu/cpufreq/e_powersaver.c1
-rw-r--r--arch/x86/kernel/cpu/cpufreq/elanfreq.c1
-rw-r--r--arch/x86/kernel/cpu/cpufreq/gx-suspmod.c1
-rw-r--r--arch/x86/kernel/cpu/cpufreq/longhaul.c5
-rw-r--r--arch/x86/kernel/cpu/cpufreq/p4-clockmod.c3
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k6.c1
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k7.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c23
-rw-r--r--arch/x86/kernel/cpu/cpufreq/sc520_freq.c1
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c1
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-ich.c3
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-smi.c1
-rw-r--r--arch/x86/kernel/cpu/proc.c3
-rw-r--r--arch/x86/kernel/cpuid.c2
-rw-r--r--arch/x86/kernel/crash_dump_32.c2
-rw-r--r--arch/x86/kernel/crash_dump_64.c2
-rw-r--r--arch/x86/kernel/entry_32.S4
-rw-r--r--arch/x86/kernel/entry_64.S23
-rw-r--r--arch/x86/kernel/geode_32.c4
-rw-r--r--arch/x86/kernel/head64.c2
-rw-r--r--arch/x86/kernel/hpet.c (renamed from arch/x86/kernel/hpet_32.c)250
-rw-r--r--arch/x86/kernel/hpet_64.c493
-rw-r--r--arch/x86/kernel/i387_32.c2
-rw-r--r--arch/x86/kernel/i387_64.c2
-rw-r--r--arch/x86/kernel/i8237.c2
-rw-r--r--arch/x86/kernel/i8253.c (renamed from arch/x86/kernel/i8253_32.c)6
-rw-r--r--arch/x86/kernel/i8259_32.c1
-rw-r--r--arch/x86/kernel/i8259_64.c46
-rw-r--r--arch/x86/kernel/io_apic_32.c4
-rw-r--r--arch/x86/kernel/ioport_32.c2
-rw-r--r--arch/x86/kernel/ioport_64.c2
-rw-r--r--arch/x86/kernel/irq_32.c2
-rw-r--r--arch/x86/kernel/irq_64.c2
-rw-r--r--arch/x86/kernel/kprobes_32.c18
-rw-r--r--arch/x86/kernel/kprobes_64.c16
-rw-r--r--arch/x86/kernel/ldt_32.c2
-rw-r--r--arch/x86/kernel/ldt_64.c2
-rw-r--r--arch/x86/kernel/machine_kexec_32.c2
-rw-r--r--arch/x86/kernel/machine_kexec_64.c2
-rw-r--r--arch/x86/kernel/mca_32.c1
-rw-r--r--arch/x86/kernel/mce_amd_64.c6
-rw-r--r--arch/x86/kernel/mfgpt_32.c362
-rw-r--r--arch/x86/kernel/msr.c2
-rw-r--r--arch/x86/kernel/nmi_32.c5
-rw-r--r--arch/x86/kernel/nmi_64.c4
-rw-r--r--arch/x86/kernel/pci-calgary_64.c24
-rw-r--r--arch/x86/kernel/pci-dma_32.c3
-rw-r--r--arch/x86/kernel/pci-dma_64.c1
-rw-r--r--arch/x86/kernel/pci-gart_64.c65
-rw-r--r--arch/x86/kernel/pci-nommu_64.c5
-rw-r--r--arch/x86/kernel/process_32.c2
-rw-r--r--arch/x86/kernel/process_64.c8
-rw-r--r--arch/x86/kernel/ptrace_32.c6
-rw-r--r--arch/x86/kernel/ptrace_64.c6
-rw-r--r--arch/x86/kernel/quirks.c205
-rw-r--r--arch/x86/kernel/reboot_32.c4
-rw-r--r--arch/x86/kernel/reboot_fixups_32.c8
-rw-r--r--arch/x86/kernel/scx200_32.c12
-rw-r--r--arch/x86/kernel/setup_32.c2
-rw-r--r--arch/x86/kernel/setup_64.c42
-rw-r--r--arch/x86/kernel/signal_32.c2
-rw-r--r--arch/x86/kernel/signal_64.c2
-rw-r--r--arch/x86/kernel/smpboot_32.c68
-rw-r--r--arch/x86/kernel/smpboot_64.c59
-rw-r--r--arch/x86/kernel/stacktrace.c2
-rw-r--r--arch/x86/kernel/summit_32.c2
-rw-r--r--arch/x86/kernel/sys_i386_32.c2
-rw-r--r--arch/x86/kernel/sys_x86_64.c4
-rw-r--r--arch/x86/kernel/sysenter_32.c2
-rw-r--r--arch/x86/kernel/time_32.c5
-rw-r--r--arch/x86/kernel/time_64.c179
-rw-r--r--arch/x86/kernel/topology.c2
-rw-r--r--arch/x86/kernel/traps_32.c2
-rw-r--r--arch/x86/kernel/traps_64.c2
-rw-r--r--arch/x86/kernel/tsc_32.c6
-rw-r--r--arch/x86/kernel/tsc_64.c93
-rw-r--r--arch/x86/kernel/tsc_sync.c2
-rw-r--r--arch/x86/kernel/vm86_32.c2
-rw-r--r--arch/x86/kernel/vsyscall_64.c2
-rw-r--r--arch/x86/lib/copy_user_nocache_64.S1
-rw-r--r--arch/x86/lib/thunk_64.S4
-rw-r--r--arch/x86/mm/fault_32.c45
-rw-r--r--arch/x86/mm/fault_64.c44
-rw-r--r--arch/x86/mm/init_32.c5
-rw-r--r--arch/x86/mm/init_64.c51
-rw-r--r--arch/x86/oprofile/op_model_p4.c2
-rw-r--r--arch/x86/pci/acpi.c194
-rw-r--r--arch/x86/pci/common.c19
-rw-r--r--arch/x86/pci/fixup.c47
-rw-r--r--arch/x86/pci/i386.c13
-rw-r--r--arch/x86/pci/irq.c39
-rw-r--r--arch/x86/pci/pci.h2
-rw-r--r--arch/x86/xen/smp.c18
-rw-r--r--arch/x86_64/Kconfig20
-rw-r--r--arch/xtensa/kernel/ptrace.c4
-rw-r--r--arch/xtensa/mm/fault.c2
720 files changed, 29597 insertions, 19097 deletions
diff --git a/arch/alpha/Makefile b/arch/alpha/Makefile
index 2f283b2fb164..63104ebd1806 100644
--- a/arch/alpha/Makefile
+++ b/arch/alpha/Makefile
@@ -12,73 +12,22 @@ NM := $(NM) -B
12 12
13LDFLAGS_vmlinux := -static -N #-relax 13LDFLAGS_vmlinux := -static -N #-relax
14CHECKFLAGS += -D__alpha__ -m64 14CHECKFLAGS += -D__alpha__ -m64
15cflags-y := -pipe -mno-fp-regs -ffixed-8 15cflags-y := -pipe -mno-fp-regs -ffixed-8 -msmall-data
16 16
17# Determine if we can use the BWX instructions with GAS. 17cpuflags-$(CONFIG_ALPHA_EV67) := -mcpu=ev67
18old_gas := $(shell if $(AS) --version 2>&1 | grep 'version 2.7' > /dev/null; then echo y; else echo n; fi) 18cpuflags-$(CONFIG_ALPHA_EV6) := -mcpu=ev6
19 19cpuflags-$(CONFIG_ALPHA_POLARIS) := -mcpu=pca56
20ifeq ($(old_gas),y) 20cpuflags-$(CONFIG_ALPHA_SX164) := -mcpu=pca56
21$(error The assembler '$(AS)' does not support the BWX instruction) 21cpuflags-$(CONFIG_ALPHA_EV56) := -mcpu=ev56
22endif 22cpuflags-$(CONFIG_ALPHA_EV5) := -mcpu=ev5
23 23cpuflags-$(CONFIG_ALPHA_EV4) := -mcpu=ev4
24# Determine if GCC understands the -mcpu= option. 24# If GENERIC, make sure to turn off any instruction set extensions that
25have_mcpu := $(call cc-option-yn, -mcpu=ev5) 25# the host compiler might have on by default. Given that EV4 and EV5
26have_mcpu_pca56 := $(call cc-option-yn, -mcpu=pca56) 26# have the same instruction set, prefer EV5 because an EV5 schedule is
27have_mcpu_ev6 := $(call cc-option-yn, -mcpu=ev6) 27# more likely to keep an EV4 processor busy than vice-versa.
28have_mcpu_ev67 := $(call cc-option-yn, -mcpu=ev67) 28cpuflags-$(CONFIG_ALPHA_GENERIC) := -mcpu=ev5
29have_msmall_data := $(call cc-option-yn, -msmall-data) 29
30 30cflags-y += $(cpuflags-y)
31cflags-$(have_msmall_data) += -msmall-data
32
33# Turn on the proper cpu optimizations.
34ifeq ($(have_mcpu),y)
35 mcpu_done := n
36 # If GENERIC, make sure to turn off any instruction set extensions that
37 # the host compiler might have on by default. Given that EV4 and EV5
38 # have the same instruction set, prefer EV5 because an EV5 schedule is
39 # more likely to keep an EV4 processor busy than vice-versa.
40 ifeq ($(CONFIG_ALPHA_GENERIC),y)
41 mcpu := ev5
42 mcpu_done := y
43 endif
44 ifeq ($(mcpu_done)$(CONFIG_ALPHA_SX164)$(have_mcpu_pca56),nyy)
45 mcpu := pca56
46 mcpu_done := y
47 endif
48 ifeq ($(mcpu_done)$(CONFIG_ALPHA_POLARIS)$(have_mcpu_pca56),nyy)
49 mcpu := pca56
50 mcpu_done := y
51 endif
52 ifeq ($(mcpu_done)$(CONFIG_ALPHA_EV4),ny)
53 mcpu := ev4
54 mcpu_done := y
55 endif
56 ifeq ($(mcpu_done)$(CONFIG_ALPHA_EV56),ny)
57 mcpu := ev56
58 mcpu_done := y
59 endif
60 ifeq ($(mcpu_done)$(CONFIG_ALPHA_EV5),ny)
61 mcpu := ev5
62 mcpu_done := y
63 endif
64 ifeq ($(mcpu_done)$(CONFIG_ALPHA_EV67)$(have_mcpu_ev67),nyy)
65 mcpu := ev67
66 mcpu_done := y
67 endif
68 ifeq ($(mcpu_done)$(CONFIG_ALPHA_EV6),ny)
69 ifeq ($(have_mcpu_ev6),y)
70 mcpu := ev6
71 else
72 ifeq ($(have_mcpu_pca56),y)
73 mcpu := pca56
74 else
75 mcpu=ev56
76 endif
77 endif
78 mcpu_done := y
79 endif
80 cflags-$(mcpu_done) += -mcpu=$(mcpu)
81endif
82 31
83 32
84# For TSUNAMI, we must have the assembler not emulate our instructions. 33# For TSUNAMI, we must have the assembler not emulate our instructions.
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
index debc8f03886c..5fc61e281ac7 100644
--- a/arch/alpha/kernel/entry.S
+++ b/arch/alpha/kernel/entry.S
@@ -917,15 +917,6 @@ sys_pipe:
917.end sys_pipe 917.end sys_pipe
918 918
919 .align 4 919 .align 4
920 .globl sys_ptrace
921 .ent sys_ptrace
922sys_ptrace:
923 .prologue 0
924 mov $sp, $20
925 jmp $31, do_sys_ptrace
926.end sys_ptrace
927
928 .align 4
929 .globl sys_execve 920 .globl sys_execve
930 .ent sys_execve 921 .ent sys_execve
931sys_execve: 922sys_execve:
diff --git a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c
index 83a781842266..1e9ad52c460e 100644
--- a/arch/alpha/kernel/ptrace.c
+++ b/arch/alpha/kernel/ptrace.c
@@ -260,38 +260,12 @@ void ptrace_disable(struct task_struct *child)
260 ptrace_cancel_bpt(child); 260 ptrace_cancel_bpt(child);
261} 261}
262 262
263asmlinkage long 263long arch_ptrace(struct task_struct *child, long request, long addr, long data)
264do_sys_ptrace(long request, long pid, long addr, long data,
265 struct pt_regs *regs)
266{ 264{
267 struct task_struct *child;
268 unsigned long tmp; 265 unsigned long tmp;
269 size_t copied; 266 size_t copied;
270 long ret; 267 long ret;
271 268
272 lock_kernel();
273 DBG(DBG_MEM, ("request=%ld pid=%ld addr=0x%lx data=0x%lx\n",
274 request, pid, addr, data));
275 if (request == PTRACE_TRACEME) {
276 ret = ptrace_traceme();
277 goto out_notsk;
278 }
279
280 child = ptrace_get_task_struct(pid);
281 if (IS_ERR(child)) {
282 ret = PTR_ERR(child);
283 goto out_notsk;
284 }
285
286 if (request == PTRACE_ATTACH) {
287 ret = ptrace_attach(child);
288 goto out;
289 }
290
291 ret = ptrace_check_attach(child, request == PTRACE_KILL);
292 if (ret < 0)
293 goto out;
294
295 switch (request) { 269 switch (request) {
296 /* When I and D space are separate, these will need to be fixed. */ 270 /* When I and D space are separate, these will need to be fixed. */
297 case PTRACE_PEEKTEXT: /* read word at location addr. */ 271 case PTRACE_PEEKTEXT: /* read word at location addr. */
@@ -301,13 +275,13 @@ do_sys_ptrace(long request, long pid, long addr, long data,
301 if (copied != sizeof(tmp)) 275 if (copied != sizeof(tmp))
302 break; 276 break;
303 277
304 regs->r0 = 0; /* special return: no errors */ 278 force_successful_syscall_return();
305 ret = tmp; 279 ret = tmp;
306 break; 280 break;
307 281
308 /* Read register number ADDR. */ 282 /* Read register number ADDR. */
309 case PTRACE_PEEKUSR: 283 case PTRACE_PEEKUSR:
310 regs->r0 = 0; /* special return: no errors */ 284 force_successful_syscall_return();
311 ret = get_reg(child, addr); 285 ret = get_reg(child, addr);
312 DBG(DBG_MEM, ("peek $%ld->%#lx\n", addr, ret)); 286 DBG(DBG_MEM, ("peek $%ld->%#lx\n", addr, ret));
313 break; 287 break;
@@ -353,7 +327,7 @@ do_sys_ptrace(long request, long pid, long addr, long data,
353 /* make sure single-step breakpoint is gone. */ 327 /* make sure single-step breakpoint is gone. */
354 ptrace_cancel_bpt(child); 328 ptrace_cancel_bpt(child);
355 wake_up_process(child); 329 wake_up_process(child);
356 goto out; 330 break;
357 331
358 case PTRACE_SINGLESTEP: /* execute single instruction. */ 332 case PTRACE_SINGLESTEP: /* execute single instruction. */
359 ret = -EIO; 333 ret = -EIO;
@@ -366,20 +340,12 @@ do_sys_ptrace(long request, long pid, long addr, long data,
366 wake_up_process(child); 340 wake_up_process(child);
367 /* give it a chance to run. */ 341 /* give it a chance to run. */
368 ret = 0; 342 ret = 0;
369 goto out; 343 break;
370
371 case PTRACE_DETACH: /* detach a process that was attached. */
372 ret = ptrace_detach(child, data);
373 goto out;
374 344
375 default: 345 default:
376 ret = ptrace_request(child, request, addr, data); 346 ret = ptrace_request(child, request, addr, data);
377 goto out; 347 break;
378 } 348 }
379 out:
380 put_task_struct(child);
381 out_notsk:
382 unlock_kernel();
383 return ret; 349 return ret;
384} 350}
385 351
diff --git a/arch/alpha/kernel/vmlinux.lds.S b/arch/alpha/kernel/vmlinux.lds.S
index 7af07d3ad5f0..55c05b511f4c 100644
--- a/arch/alpha/kernel/vmlinux.lds.S
+++ b/arch/alpha/kernel/vmlinux.lds.S
@@ -1,4 +1,5 @@
1#include <asm-generic/vmlinux.lds.h> 1#include <asm-generic/vmlinux.lds.h>
2#include <asm/page.h>
2 3
3OUTPUT_FORMAT("elf64-alpha") 4OUTPUT_FORMAT("elf64-alpha")
4OUTPUT_ARCH(alpha) 5OUTPUT_ARCH(alpha)
@@ -8,138 +9,145 @@ jiffies = jiffies_64;
8SECTIONS 9SECTIONS
9{ 10{
10#ifdef CONFIG_ALPHA_LEGACY_START_ADDRESS 11#ifdef CONFIG_ALPHA_LEGACY_START_ADDRESS
11 . = 0xfffffc0000310000; 12 . = 0xfffffc0000310000;
12#else 13#else
13 . = 0xfffffc0001010000; 14 . = 0xfffffc0001010000;
14#endif 15#endif
15 16
16 _text = .; /* Text and read-only data */ 17 _text = .; /* Text and read-only data */
17 .text : { 18 .text : {
18 *(.text.head) 19 *(.text.head)
19 TEXT_TEXT 20 TEXT_TEXT
20 SCHED_TEXT 21 SCHED_TEXT
21 LOCK_TEXT 22 LOCK_TEXT
22 *(.fixup) 23 *(.fixup)
23 *(.gnu.warning) 24 *(.gnu.warning)
24 } :kernel 25 } :kernel
25 _etext = .; /* End of text section */ 26 _etext = .; /* End of text section */
26 27
27 . = ALIGN(16); 28 /* Exception table */
28 __start___ex_table = .; /* Exception table */ 29 . = ALIGN(16);
29 __ex_table : { *(__ex_table) } 30 __ex_table : {
30 __stop___ex_table = .; 31 __start___ex_table = .;
31 32 *(__ex_table)
32 NOTES :kernel :note 33 __stop___ex_table = .;
33 .dummy : { *(.dummy) } :kernel 34 }
34 35
35 RODATA 36 NOTES :kernel :note
36 37 .dummy : {
37 /* Will be freed after init */ 38 *(.dummy)
38 . = ALIGN(8192); /* Init code and data */ 39 } :kernel
39 __init_begin = .; 40
40 .init.text : { 41 RODATA
41 _sinittext = .; 42
42 *(.init.text) 43 /* Will be freed after init */
43 _einittext = .; 44 . = ALIGN(PAGE_SIZE);
44 } 45 /* Init code and data */
45 .init.data : { *(.init.data) } 46 __init_begin = .;
46 47 .init.text : {
47 . = ALIGN(16); 48 _sinittext = .;
48 __setup_start = .; 49 *(.init.text)
49 .init.setup : { *(.init.setup) } 50 _einittext = .;
50 __setup_end = .; 51 }
51 52 .init.data : {
52 . = ALIGN(8); 53 *(.init.data)
53 __initcall_start = .; 54 }
54 .initcall.init : { 55
55 INITCALLS 56 . = ALIGN(16);
56 } 57 .init.setup : {
57 __initcall_end = .; 58 __setup_start = .;
59 *(.init.setup)
60 __setup_end = .;
61 }
62
63 . = ALIGN(8);
64 .initcall.init : {
65 __initcall_start = .;
66 INITCALLS
67 __initcall_end = .;
68 }
58 69
59#ifdef CONFIG_BLK_DEV_INITRD 70#ifdef CONFIG_BLK_DEV_INITRD
60 . = ALIGN(8192); 71 . = ALIGN(PAGE_SIZE);
61 __initramfs_start = .; 72 .init.ramfs : {
62 .init.ramfs : { *(.init.ramfs) } 73 __initramfs_start = .;
63 __initramfs_end = .; 74 *(.init.ramfs)
75 __initramfs_end = .;
76 }
64#endif 77#endif
65 78
66 . = ALIGN(8); 79 . = ALIGN(8);
67 .con_initcall.init : { 80 .con_initcall.init : {
68 __con_initcall_start = .; 81 __con_initcall_start = .;
69 *(.con_initcall.init) 82 *(.con_initcall.init)
70 __con_initcall_end = .; 83 __con_initcall_end = .;
71 } 84 }
72 85
73 . = ALIGN(8); 86 . = ALIGN(8);
74 SECURITY_INIT 87 SECURITY_INIT
75 88
76 PERCPU(8192) 89 PERCPU(PAGE_SIZE)
77 90
78 . = ALIGN(2*8192); 91 . = ALIGN(2 * PAGE_SIZE);
79 __init_end = .; 92 __init_end = .;
80 /* Freed after init ends here */ 93 /* Freed after init ends here */
81 94
82 /* Note 2 page alignment above. */ 95 /* Note 2 page alignment above. */
83 .data.init_thread : { *(.data.init_thread) } 96 .data.init_thread : {
84 97 *(.data.init_thread)
85 . = ALIGN(8192); 98 }
86 .data.page_aligned : { *(.data.page_aligned) } 99
87 100 . = ALIGN(PAGE_SIZE);
88 . = ALIGN(64); 101 .data.page_aligned : {
89 .data.cacheline_aligned : { *(.data.cacheline_aligned) } 102 *(.data.page_aligned)
90 103 }
91 _data = .; 104
92 .data : { /* Data */ 105 . = ALIGN(64);
93 DATA_DATA 106 .data.cacheline_aligned : {
94 CONSTRUCTORS 107 *(.data.cacheline_aligned)
95 } 108 }
96 109
97 .got : { *(.got) } 110 _data = .;
98 .sdata : { *(.sdata) } 111 /* Data */
99 112 .data : {
100 _edata = .; /* End of data section */ 113 DATA_DATA
101 114 CONSTRUCTORS
102 __bss_start = .; 115 }
103 .sbss : { *(.sbss) *(.scommon) } 116
104 .bss : { *(.bss) *(COMMON) } 117 .got : {
105 __bss_stop = .; 118 *(.got)
106 119 }
107 _end = .; 120 .sdata : {
108 121 *(.sdata)
109 /* Sections to be discarded */ 122 }
110 /DISCARD/ : { *(.exit.text) *(.exit.data) *(.exitcall.exit) } 123 _edata = .; /* End of data section */
111 124
112 .mdebug 0 : { *(.mdebug) } 125 __bss_start = .;
113 .note 0 : { *(.note) } 126 .sbss : {
114 .comment 0 : { *(.comment) } 127 *(.sbss)
115 128 *(.scommon)
116 /* Stabs debugging sections */ 129 }
117 .stab 0 : { *(.stab) } 130 .bss : {
118 .stabstr 0 : { *(.stabstr) } 131 *(.bss)
119 .stab.excl 0 : { *(.stab.excl) } 132 *(COMMON)
120 .stab.exclstr 0 : { *(.stab.exclstr) } 133 }
121 .stab.index 0 : { *(.stab.index) } 134 __bss_stop = .;
122 .stab.indexstr 0 : { *(.stab.indexstr) } 135 _end = .;
123 /* DWARF 1 */ 136
124 .debug 0 : { *(.debug) } 137 /* Sections to be discarded */
125 .line 0 : { *(.line) } 138 /DISCARD/ : {
126 /* GNU DWARF 1 extensions */ 139 *(.exit.text)
127 .debug_srcinfo 0 : { *(.debug_srcinfo) } 140 *(.exit.data)
128 .debug_sfnames 0 : { *(.debug_sfnames) } 141 *(.exitcall.exit)
129 /* DWARF 1.1 and DWARF 2 */ 142 }
130 .debug_aranges 0 : { *(.debug_aranges) } 143
131 .debug_pubnames 0 : { *(.debug_pubnames) } 144 .mdebug 0 : {
132 /* DWARF 2 */ 145 *(.mdebug)
133 .debug_info 0 : { *(.debug_info) } 146 }
134 .debug_abbrev 0 : { *(.debug_abbrev) } 147 .note 0 : {
135 .debug_line 0 : { *(.debug_line) } 148 *(.note)
136 .debug_frame 0 : { *(.debug_frame) } 149 }
137 .debug_str 0 : { *(.debug_str) } 150
138 .debug_loc 0 : { *(.debug_loc) } 151 STABS_DEBUG
139 .debug_macinfo 0 : { *(.debug_macinfo) } 152 DWARF_DEBUG
140 /* SGI/MIPS DWARF 2 extensions */
141 .debug_weaknames 0 : { *(.debug_weaknames) }
142 .debug_funcnames 0 : { *(.debug_funcnames) }
143 .debug_typenames 0 : { *(.debug_typenames) }
144 .debug_varnames 0 : { *(.debug_varnames) }
145} 153}
diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c
index a0e18da594d9..25154df3055a 100644
--- a/arch/alpha/mm/fault.c
+++ b/arch/alpha/mm/fault.c
@@ -197,7 +197,7 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
197 current->comm, current->pid); 197 current->comm, current->pid);
198 if (!user_mode(regs)) 198 if (!user_mode(regs))
199 goto no_context; 199 goto no_context;
200 do_exit(SIGKILL); 200 do_group_exit(SIGKILL);
201 201
202 do_sigbus: 202 do_sigbus:
203 /* Send a sigbus, regardless of whether we were in kernel 203 /* Send a sigbus, regardless of whether we were in kernel
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 691aae309c8a..0a0c88d0039c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -318,6 +318,9 @@ config ARCH_KS8695
318 318
319config ARCH_NS9XXX 319config ARCH_NS9XXX
320 bool "NetSilicon NS9xxx" 320 bool "NetSilicon NS9xxx"
321 select GENERIC_GPIO
322 select GENERIC_TIME
323 select GENERIC_CLOCKEVENTS
321 help 324 help
322 Say Y here if you intend to run this kernel on a NetSilicon NS9xxx 325 Say Y here if you intend to run this kernel on a NetSilicon NS9xxx
323 System. 326 System.
@@ -336,14 +339,14 @@ config ARCH_PNX4008
336 This enables support for Philips PNX4008 mobile platform. 339 This enables support for Philips PNX4008 mobile platform.
337 340
338config ARCH_PXA 341config ARCH_PXA
339 bool "PXA2xx-based" 342 bool "PXA2xx/PXA3xx-based"
340 depends on MMU 343 depends on MMU
341 select ARCH_MTD_XIP 344 select ARCH_MTD_XIP
342 select GENERIC_GPIO 345 select GENERIC_GPIO
343 select GENERIC_TIME 346 select GENERIC_TIME
344 select GENERIC_CLOCKEVENTS 347 select GENERIC_CLOCKEVENTS
345 help 348 help
346 Support for Intel's PXA2XX processor line. 349 Support for Intel/Marvell's PXA2xx/PXA3xx processor line.
347 350
348config ARCH_RPC 351config ARCH_RPC
349 bool "RiscPC" 352 bool "RiscPC"
@@ -486,7 +489,7 @@ source arch/arm/mm/Kconfig
486config IWMMXT 489config IWMMXT
487 bool "Enable iWMMXt support" 490 bool "Enable iWMMXt support"
488 depends on CPU_XSCALE || CPU_XSC3 491 depends on CPU_XSCALE || CPU_XSC3
489 default y if PXA27x 492 default y if PXA27x || PXA3xx
490 help 493 help
491 Enable support for iWMMXt context switching at run time if 494 Enable support for iWMMXt context switching at run time if
492 running on a CPU that supports it. 495 running on a CPU that supports it.
@@ -994,6 +997,10 @@ source "drivers/pnp/Kconfig"
994 997
995source "drivers/block/Kconfig" 998source "drivers/block/Kconfig"
996 999
1000# misc before ide - BLK_DEV_SGIIOC4 depends on SGI_IOC4
1001
1002source "drivers/misc/Kconfig"
1003
997if PCMCIA || ARCH_CLPS7500 || ARCH_IOP32X || ARCH_IOP33X || ARCH_IXP4XX \ 1004if PCMCIA || ARCH_CLPS7500 || ARCH_IOP32X || ARCH_IOP33X || ARCH_IXP4XX \
998 || ARCH_L7200 || ARCH_LH7A40X || ARCH_PXA || ARCH_RPC \ 1005 || ARCH_L7200 || ARCH_LH7A40X || ARCH_PXA || ARCH_RPC \
999 || ARCH_S3C2410 || ARCH_SA1100 || ARCH_SHARK || FOOTBRIDGE \ 1006 || ARCH_S3C2410 || ARCH_SA1100 || ARCH_SHARK || FOOTBRIDGE \
@@ -1029,16 +1036,16 @@ source "drivers/spi/Kconfig"
1029 1036
1030source "drivers/w1/Kconfig" 1037source "drivers/w1/Kconfig"
1031 1038
1039source "drivers/power/Kconfig"
1040
1032source "drivers/hwmon/Kconfig" 1041source "drivers/hwmon/Kconfig"
1033 1042
1034#source "drivers/l3/Kconfig" 1043source "drivers/ssb/Kconfig"
1035 1044
1036source "drivers/misc/Kconfig" 1045#source "drivers/l3/Kconfig"
1037 1046
1038source "drivers/mfd/Kconfig" 1047source "drivers/mfd/Kconfig"
1039 1048
1040source "drivers/leds/Kconfig"
1041
1042source "drivers/media/Kconfig" 1049source "drivers/media/Kconfig"
1043 1050
1044source "drivers/video/Kconfig" 1051source "drivers/video/Kconfig"
@@ -1051,6 +1058,8 @@ source "drivers/usb/Kconfig"
1051 1058
1052source "drivers/mmc/Kconfig" 1059source "drivers/mmc/Kconfig"
1053 1060
1061source "drivers/leds/Kconfig"
1062
1054source "drivers/rtc/Kconfig" 1063source "drivers/rtc/Kconfig"
1055 1064
1056source "drivers/dma/Kconfig" 1065source "drivers/dma/Kconfig"
diff --git a/arch/arm/Kconfig-nommu b/arch/arm/Kconfig-nommu
index f087376748d1..901e6dff8437 100644
--- a/arch/arm/Kconfig-nommu
+++ b/arch/arm/Kconfig-nommu
@@ -26,7 +26,7 @@ config FLASH_SIZE
26 default 0x00400000 26 default 0x00400000
27 27
28config PROCESSOR_ID 28config PROCESSOR_ID
29 hex 29 hex 'Hard wire the processor ID'
30 default 0x00007700 30 default 0x00007700
31 depends on !CPU_CP15 31 depends on !CPU_CP15
32 help 32 help
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 0d450e757e0e..35e56c99ad1d 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -12,7 +12,7 @@
12 12
13LDFLAGS_vmlinux :=-p --no-undefined -X 13LDFLAGS_vmlinux :=-p --no-undefined -X
14CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET) 14CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
15OBJCOPYFLAGS :=-O binary -R .note -R .comment -S 15OBJCOPYFLAGS :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
16GZFLAGS :=-9 16GZFLAGS :=-9
17#KBUILD_CFLAGS +=-pipe 17#KBUILD_CFLAGS +=-pipe
18# Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb: 18# Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb:
diff --git a/arch/arm/boot/compressed/head-xscale.S b/arch/arm/boot/compressed/head-xscale.S
index 236bbe578312..67ea99ef6521 100644
--- a/arch/arm/boot/compressed/head-xscale.S
+++ b/arch/arm/boot/compressed/head-xscale.S
@@ -33,10 +33,6 @@ __XScale_start:
33 bic r0, r0, #0x1000 @ clear Icache 33 bic r0, r0, #0x1000 @ clear Icache
34 mcr p15, 0, r0, c1, c0, 0 34 mcr p15, 0, r0, c1, c0, 0
35 35
36#ifdef CONFIG_ARCH_LUBBOCK
37 mov r7, #MACH_TYPE_LUBBOCK
38#endif
39
40#ifdef CONFIG_ARCH_COTULLA_IDP 36#ifdef CONFIG_ARCH_COTULLA_IDP
41 mov r7, #MACH_TYPE_COTULLA_IDP 37 mov r7, #MACH_TYPE_COTULLA_IDP
42#endif 38#endif
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index e1289a256ce5..3d0b9fa42f84 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -17,3 +17,4 @@ obj-$(CONFIG_SHARPSL_PM) += sharpsl_pm.o
17obj-$(CONFIG_SHARP_SCOOP) += scoop.o 17obj-$(CONFIG_SHARP_SCOOP) += scoop.o
18obj-$(CONFIG_ARCH_IXP2000) += uengine.o 18obj-$(CONFIG_ARCH_IXP2000) += uengine.o
19obj-$(CONFIG_ARCH_IXP23XX) += uengine.o 19obj-$(CONFIG_ARCH_IXP23XX) += uengine.o
20obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c
index b36b1e8a105d..44ab0dad4035 100644
--- a/arch/arm/common/dmabounce.c
+++ b/arch/arm/common/dmabounce.c
@@ -263,7 +263,7 @@ map_single(struct device *dev, void *ptr, size_t size,
263 * We don't need to sync the DMA buffer since 263 * We don't need to sync the DMA buffer since
264 * it was allocated via the coherent allocators. 264 * it was allocated via the coherent allocators.
265 */ 265 */
266 consistent_sync(ptr, size, dir); 266 dma_cache_maint(ptr, size, dir);
267 } 267 }
268 268
269 return dma_addr; 269 return dma_addr;
@@ -383,7 +383,7 @@ sync_single(struct device *dev, dma_addr_t dma_addr, size_t size,
383 * via the coherent allocators. 383 * via the coherent allocators.
384 */ 384 */
385 } else { 385 } else {
386 consistent_sync(dma_to_virt(dev, dma_addr), size, dir); 386 dma_cache_maint(dma_to_virt(dev, dma_addr), size, dir);
387 } 387 }
388} 388}
389 389
diff --git a/arch/arm/common/it8152.c b/arch/arm/common/it8152.c
new file mode 100644
index 000000000000..c03de9bfd76b
--- /dev/null
+++ b/arch/arm/common/it8152.c
@@ -0,0 +1,387 @@
1/*
2 * linux/arch/arm/common/it8152.c
3 *
4 * Copyright Compulab Ltd, 2002-2007
5 * Mike Rapoport <mike@compulab.co.il>
6 *
7 * The DMA bouncing part is taken from arch/arm/mach-ixp4xx/common-pci.c
8 * (see this file for respective copyrights)
9 *
10 * Thanks to Guennadi Liakhovetski <gl@dsa-ac.de> for IRQ enumberation
11 * and demux code.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 */
17
18#include <linux/sched.h>
19#include <linux/kernel.h>
20#include <linux/pci.h>
21#include <linux/ptrace.h>
22#include <linux/interrupt.h>
23#include <linux/mm.h>
24#include <linux/slab.h>
25#include <linux/init.h>
26#include <linux/ioport.h>
27#include <linux/irq.h>
28#include <linux/io.h>
29
30#include <asm/mach/pci.h>
31#include <asm/hardware/it8152.h>
32
33#define MAX_SLOTS 21
34
35static void it8152_mask_irq(unsigned int irq)
36{
37 if (irq >= IT8152_LD_IRQ(0)) {
38 __raw_writel((__raw_readl(IT8152_INTC_LDCNIMR) |
39 (1 << (irq - IT8152_LD_IRQ(0)))),
40 IT8152_INTC_LDCNIMR);
41 } else if (irq >= IT8152_LP_IRQ(0)) {
42 __raw_writel((__raw_readl(IT8152_INTC_LPCNIMR) |
43 (1 << (irq - IT8152_LP_IRQ(0)))),
44 IT8152_INTC_LPCNIMR);
45 } else if (irq >= IT8152_PD_IRQ(0)) {
46 __raw_writel((__raw_readl(IT8152_INTC_PDCNIMR) |
47 (1 << (irq - IT8152_PD_IRQ(0)))),
48 IT8152_INTC_PDCNIMR);
49 }
50}
51
52static void it8152_unmask_irq(unsigned int irq)
53{
54 if (irq >= IT8152_LD_IRQ(0)) {
55 __raw_writel((__raw_readl(IT8152_INTC_LDCNIMR) &
56 ~(1 << (irq - IT8152_LD_IRQ(0)))),
57 IT8152_INTC_LDCNIMR);
58 } else if (irq >= IT8152_LP_IRQ(0)) {
59 __raw_writel((__raw_readl(IT8152_INTC_LPCNIMR) &
60 ~(1 << (irq - IT8152_LP_IRQ(0)))),
61 IT8152_INTC_LPCNIMR);
62 } else if (irq >= IT8152_PD_IRQ(0)) {
63 __raw_writel((__raw_readl(IT8152_INTC_PDCNIMR) &
64 ~(1 << (irq - IT8152_PD_IRQ(0)))),
65 IT8152_INTC_PDCNIMR);
66 }
67}
68
69static inline void it8152_irq(int irq)
70{
71 struct irq_desc *desc;
72
73 printk(KERN_DEBUG "===> %s: irq=%d\n", __FUNCTION__, irq);
74
75 desc = irq_desc + irq;
76 desc_handle_irq(irq, desc);
77}
78
79static struct irq_chip it8152_irq_chip = {
80 .name = "it8152",
81 .ack = it8152_mask_irq,
82 .mask = it8152_mask_irq,
83 .unmask = it8152_unmask_irq,
84};
85
86void it8152_init_irq(void)
87{
88 int irq;
89
90 __raw_writel((0xffff), IT8152_INTC_PDCNIMR);
91 __raw_writel((0), IT8152_INTC_PDCNIRR);
92 __raw_writel((0xffff), IT8152_INTC_LPCNIMR);
93 __raw_writel((0), IT8152_INTC_LPCNIRR);
94 __raw_writel((0xffff), IT8152_INTC_LDCNIMR);
95 __raw_writel((0), IT8152_INTC_LDCNIRR);
96
97 for (irq = IT8152_IRQ(0); irq <= IT8152_LAST_IRQ; irq++) {
98 set_irq_chip(irq, &it8152_irq_chip);
99 set_irq_handler(irq, handle_level_irq);
100 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
101 }
102}
103
104void it8152_irq_demux(unsigned int irq, struct irq_desc *desc)
105{
106 int bits_pd, bits_lp, bits_ld;
107 int i;
108
109 printk(KERN_DEBUG "=> %s: irq = %d\n", __FUNCTION__, irq);
110
111 while (1) {
112 /* Read all */
113 bits_pd = __raw_readl(IT8152_INTC_PDCNIRR);
114 bits_lp = __raw_readl(IT8152_INTC_LPCNIRR);
115 bits_ld = __raw_readl(IT8152_INTC_LDCNIRR);
116
117 /* Ack */
118 __raw_writel((~bits_pd), IT8152_INTC_PDCNIRR);
119 __raw_writel((~bits_lp), IT8152_INTC_LPCNIRR);
120 __raw_writel((~bits_ld), IT8152_INTC_LDCNIRR);
121
122 if (!(bits_ld | bits_lp | bits_pd)) {
123 /* Re-read to guarantee, that there was a moment of
124 time, when they all three were 0. */
125 bits_pd = __raw_readl(IT8152_INTC_PDCNIRR);
126 bits_lp = __raw_readl(IT8152_INTC_LPCNIRR);
127 if (!(bits_ld | bits_lp | bits_pd))
128 return;
129 }
130
131 bits_pd &= ((1 << IT8152_PD_IRQ_COUNT) - 1);
132 while (bits_pd) {
133 i = __ffs(bits_pd);
134 it8152_irq(IT8152_PD_IRQ(i));
135 bits_pd &= ~(1 << i);
136 }
137
138 bits_lp &= ((1 << IT8152_LP_IRQ_COUNT) - 1);
139 while (bits_lp) {
140 i = __ffs(bits_pd);
141 it8152_irq(IT8152_LP_IRQ(i));
142 bits_lp &= ~(1 << i);
143 }
144
145 bits_ld &= ((1 << IT8152_LD_IRQ_COUNT) - 1);
146 while (bits_ld) {
147 i = __ffs(bits_pd);
148 it8152_irq(IT8152_LD_IRQ(i));
149 bits_ld &= ~(1 << i);
150 }
151 }
152}
153
154/* mapping for on-chip devices */
155int __init it8152_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
156{
157 if ((dev->vendor == PCI_VENDOR_ID_ITE) &&
158 (dev->device == PCI_DEVICE_ID_ITE_8152)) {
159 if ((dev->class >> 8) == PCI_CLASS_MULTIMEDIA_AUDIO)
160 return IT8152_AUDIO_INT;
161 if ((dev->class >> 8) == PCI_CLASS_SERIAL_USB)
162 return IT8152_USB_INT;
163 if ((dev->class >> 8) == PCI_CLASS_SYSTEM_DMA)
164 return IT8152_CDMA_INT;
165 }
166
167 return 0;
168}
169
170static unsigned long it8152_pci_dev_base_address(struct pci_bus *bus,
171 unsigned int devfn)
172{
173 unsigned long addr = 0;
174
175 if (bus->number == 0) {
176 if (devfn < PCI_DEVFN(MAX_SLOTS, 0))
177 addr = (devfn << 8);
178 } else
179 addr = (bus->number << 16) | (devfn << 8);
180
181 return addr;
182}
183
184static int it8152_pci_read_config(struct pci_bus *bus,
185 unsigned int devfn, int where,
186 int size, u32 *value)
187{
188 unsigned long addr = it8152_pci_dev_base_address(bus, devfn);
189 u32 v;
190 int shift;
191
192 shift = (where & 3);
193
194 __raw_writel((addr + where), IT8152_PCI_CFG_ADDR);
195 v = (__raw_readl(IT8152_PCI_CFG_DATA) >> (8 * (shift)));
196
197 *value = v;
198
199 return PCIBIOS_SUCCESSFUL;
200}
201
202static int it8152_pci_write_config(struct pci_bus *bus,
203 unsigned int devfn, int where,
204 int size, u32 value)
205{
206 unsigned long addr = it8152_pci_dev_base_address(bus, devfn);
207 u32 v, vtemp, mask = 0;
208 int shift;
209
210 if (size == 1)
211 mask = 0xff;
212 if (size == 2)
213 mask = 0xffff;
214
215 shift = (where & 3);
216
217 __raw_writel((addr + where), IT8152_PCI_CFG_ADDR);
218 vtemp = __raw_readl(IT8152_PCI_CFG_DATA);
219
220 if (mask)
221 vtemp &= ~(mask << (8 * shift));
222 else
223 vtemp = 0;
224
225 v = (value << (8 * shift));
226 __raw_writel((addr + where), IT8152_PCI_CFG_ADDR);
227 __raw_writel((v | vtemp), IT8152_PCI_CFG_DATA);
228
229 return PCIBIOS_SUCCESSFUL;
230}
231
232static struct pci_ops it8152_ops = {
233 .read = it8152_pci_read_config,
234 .write = it8152_pci_write_config,
235};
236
237static struct resource it8152_io = {
238 .name = "IT8152 PCI I/O region",
239 .flags = IORESOURCE_IO,
240};
241
242static struct resource it8152_mem = {
243 .name = "IT8152 PCI memory region",
244 .start = 0x10000000,
245 .end = 0x13e00000,
246 .flags = IORESOURCE_MEM,
247};
248
249/*
250 * The following functions are needed for DMA bouncing.
251 * ITE8152 chip can addrees up to 64MByte, so all the devices
252 * connected to ITE8152 (PCI and USB) should have limited DMA window
253 */
254
255/*
256 * Setup DMA mask to 64MB on devices connected to ITE8152. Ignore all
257 * other devices.
258 */
259static int it8152_pci_platform_notify(struct device *dev)
260{
261 if (dev->bus == &pci_bus_type) {
262 if (dev->dma_mask)
263 *dev->dma_mask = (SZ_64M - 1) | PHYS_OFFSET;
264 dev->coherent_dma_mask = (SZ_64M - 1) | PHYS_OFFSET;
265 dmabounce_register_dev(dev, 2048, 4096);
266 }
267 return 0;
268}
269
270static int it8152_pci_platform_notify_remove(struct device *dev)
271{
272 if (dev->bus == &pci_bus_type)
273 dmabounce_unregister_dev(dev);
274
275 return 0;
276}
277
278int dma_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t size)
279{
280 dev_dbg(dev, "%s: dma_addr %08x, size %08x\n",
281 __FUNCTION__, dma_addr, size);
282 return (dev->bus == &pci_bus_type) &&
283 ((dma_addr + size - PHYS_OFFSET) >= SZ_64M);
284}
285
286/*
287 * We override these so we properly do dmabounce otherwise drivers
288 * are able to set the dma_mask to 0xffffffff and we can no longer
289 * trap bounces. :(
290 *
291 * We just return true on everyhing except for < 64MB in which case
292 * we will fail miseralby and die since we can't handle that case.
293 */
294int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
295{
296 printk(KERN_DEBUG "%s: %s %llx\n",
297 __FUNCTION__, dev->dev.bus_id, mask);
298 if (mask >= PHYS_OFFSET + SZ_64M - 1)
299 return 0;
300
301 return -EIO;
302}
303
304int
305pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
306{
307 printk(KERN_DEBUG "%s: %s %llx\n",
308 __FUNCTION__, dev->dev.bus_id, mask);
309 if (mask >= PHYS_OFFSET + SZ_64M - 1)
310 return 0;
311
312 return -EIO;
313}
314
315int __init it8152_pci_setup(int nr, struct pci_sys_data *sys)
316{
317 it8152_io.start = IT8152_IO_BASE + 0x12000;
318 it8152_io.end = IT8152_IO_BASE + 0x12000 + 0x100000;
319
320 sys->mem_offset = 0x10000000;
321 sys->io_offset = IT8152_IO_BASE;
322
323 if (request_resource(&ioport_resource, &it8152_io)) {
324 printk(KERN_ERR "PCI: unable to allocate IO region\n");
325 goto err0;
326 }
327 if (request_resource(&iomem_resource, &it8152_mem)) {
328 printk(KERN_ERR "PCI: unable to allocate memory region\n");
329 goto err1;
330 }
331
332 sys->resource[0] = &it8152_io;
333 sys->resource[1] = &it8152_mem;
334
335 if (platform_notify || platform_notify_remove) {
336 printk(KERN_ERR "PCI: Can't use platform_notify\n");
337 goto err2;
338 }
339
340 platform_notify = it8152_pci_platform_notify;
341 platform_notify_remove = it8152_pci_platform_notify_remove;
342
343 return 1;
344
345err2:
346 release_resource(&it8152_io);
347err1:
348 release_resource(&it8152_mem);
349err0:
350 return -EBUSY;
351}
352
353/*
354 * If we set up a device for bus mastering, we need to check the latency
355 * timer as we don't have even crappy BIOSes to set it properly.
356 * The implementation is from arch/i386/pci/i386.c
357 */
358unsigned int pcibios_max_latency = 255;
359
360void pcibios_set_master(struct pci_dev *dev)
361{
362 u8 lat;
363
364 /* no need to update on-chip OHCI controller */
365 if ((dev->vendor == PCI_VENDOR_ID_ITE) &&
366 (dev->device == PCI_DEVICE_ID_ITE_8152) &&
367 ((dev->class >> 8) == PCI_CLASS_SERIAL_USB))
368 return;
369
370 pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat);
371 if (lat < 16)
372 lat = (64 <= pcibios_max_latency) ? 64 : pcibios_max_latency;
373 else if (lat > pcibios_max_latency)
374 lat = pcibios_max_latency;
375 else
376 return;
377 printk(KERN_DEBUG "PCI: Setting latency timer of device %s to %d\n",
378 pci_name(dev), lat);
379 pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
380}
381
382
383struct pci_bus * __init it8152_pci_scan_bus(int nr, struct pci_sys_data *sys)
384{
385 return pci_scan_bus(nr, &it8152_ops, sys);
386}
387
diff --git a/arch/arm/configs/cm_x270_defconfig b/arch/arm/configs/cm_x270_defconfig
new file mode 100644
index 000000000000..5cab08397ae7
--- /dev/null
+++ b/arch/arm/configs/cm_x270_defconfig
@@ -0,0 +1,1410 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22
4# Wed Jul 18 14:11:48 2007
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10# CONFIG_GENERIC_CLOCKEVENTS is not set
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
17CONFIG_HARDIRQS_SW_RESEND=y
18CONFIG_GENERIC_IRQ_PROBE=y
19CONFIG_RWSEM_GENERIC_SPINLOCK=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_GENERIC_HWEIGHT=y
23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ZONE_DMA=y
25CONFIG_ARCH_MTD_XIP=y
26CONFIG_VECTORS_BASE=0xffff0000
27CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
28
29#
30# Code maturity level options
31#
32CONFIG_EXPERIMENTAL=y
33CONFIG_BROKEN_ON_SMP=y
34CONFIG_INIT_ENV_ARG_LIMIT=32
35
36#
37# General setup
38#
39CONFIG_LOCALVERSION=""
40# CONFIG_LOCALVERSION_AUTO is not set
41CONFIG_SWAP=y
42CONFIG_SYSVIPC=y
43CONFIG_SYSVIPC_SYSCTL=y
44# CONFIG_POSIX_MQUEUE is not set
45# CONFIG_BSD_PROCESS_ACCT is not set
46# CONFIG_TASKSTATS is not set
47# CONFIG_USER_NS is not set
48# CONFIG_AUDIT is not set
49CONFIG_IKCONFIG=y
50CONFIG_IKCONFIG_PROC=y
51CONFIG_LOG_BUF_SHIFT=17
52CONFIG_SYSFS_DEPRECATED=y
53# CONFIG_RELAY is not set
54CONFIG_BLK_DEV_INITRD=y
55CONFIG_INITRAMFS_SOURCE=""
56CONFIG_CC_OPTIMIZE_FOR_SIZE=y
57CONFIG_SYSCTL=y
58CONFIG_EMBEDDED=y
59CONFIG_UID16=y
60CONFIG_SYSCTL_SYSCALL=y
61CONFIG_KALLSYMS=y
62# CONFIG_KALLSYMS_ALL is not set
63# CONFIG_KALLSYMS_EXTRA_PASS is not set
64CONFIG_HOTPLUG=y
65CONFIG_PRINTK=y
66CONFIG_BUG=y
67CONFIG_ELF_CORE=y
68CONFIG_BASE_FULL=y
69CONFIG_FUTEX=y
70CONFIG_ANON_INODES=y
71# CONFIG_EPOLL is not set
72# CONFIG_SIGNALFD is not set
73# CONFIG_TIMERFD is not set
74# CONFIG_EVENTFD is not set
75CONFIG_SHMEM=y
76CONFIG_VM_EVENT_COUNTERS=y
77CONFIG_SLAB=y
78# CONFIG_SLUB is not set
79# CONFIG_SLOB is not set
80CONFIG_RT_MUTEXES=y
81# CONFIG_TINY_SHMEM is not set
82CONFIG_BASE_SMALL=0
83CONFIG_MODULES=y
84CONFIG_MODULE_UNLOAD=y
85CONFIG_MODULE_FORCE_UNLOAD=y
86# CONFIG_MODVERSIONS is not set
87# CONFIG_MODULE_SRCVERSION_ALL is not set
88CONFIG_KMOD=y
89CONFIG_BLOCK=y
90# CONFIG_LBD is not set
91# CONFIG_BLK_DEV_IO_TRACE is not set
92# CONFIG_LSF is not set
93# CONFIG_BLK_DEV_BSG is not set
94
95#
96# IO Schedulers
97#
98CONFIG_IOSCHED_NOOP=y
99CONFIG_IOSCHED_AS=y
100CONFIG_IOSCHED_DEADLINE=y
101CONFIG_IOSCHED_CFQ=y
102CONFIG_DEFAULT_AS=y
103# CONFIG_DEFAULT_DEADLINE is not set
104# CONFIG_DEFAULT_CFQ is not set
105# CONFIG_DEFAULT_NOOP is not set
106CONFIG_DEFAULT_IOSCHED="anticipatory"
107
108#
109# System Type
110#
111# CONFIG_ARCH_AAEC2000 is not set
112# CONFIG_ARCH_INTEGRATOR is not set
113# CONFIG_ARCH_REALVIEW is not set
114# CONFIG_ARCH_VERSATILE is not set
115# CONFIG_ARCH_AT91 is not set
116# CONFIG_ARCH_CLPS7500 is not set
117# CONFIG_ARCH_CLPS711X is not set
118# CONFIG_ARCH_CO285 is not set
119# CONFIG_ARCH_EBSA110 is not set
120# CONFIG_ARCH_EP93XX is not set
121# CONFIG_ARCH_FOOTBRIDGE is not set
122# CONFIG_ARCH_NETX is not set
123# CONFIG_ARCH_H720X is not set
124# CONFIG_ARCH_IMX is not set
125# CONFIG_ARCH_IOP13XX is not set
126# CONFIG_ARCH_IOP32X is not set
127# CONFIG_ARCH_IOP33X is not set
128# CONFIG_ARCH_IXP23XX is not set
129# CONFIG_ARCH_IXP2000 is not set
130# CONFIG_ARCH_IXP4XX is not set
131# CONFIG_ARCH_L7200 is not set
132# CONFIG_ARCH_KS8695 is not set
133# CONFIG_ARCH_NS9XXX is not set
134# CONFIG_ARCH_PNX4008 is not set
135CONFIG_ARCH_PXA=y
136# CONFIG_ARCH_RPC is not set
137# CONFIG_ARCH_SA1100 is not set
138# CONFIG_ARCH_S3C2410 is not set
139# CONFIG_ARCH_SHARK is not set
140# CONFIG_ARCH_LH7A40X is not set
141# CONFIG_ARCH_DAVINCI is not set
142# CONFIG_ARCH_OMAP is not set
143CONFIG_DMABOUNCE=y
144
145#
146# Intel PXA2xx Implementations
147#
148# CONFIG_ARCH_LUBBOCK is not set
149# CONFIG_MACH_LOGICPD_PXA270 is not set
150# CONFIG_MACH_MAINSTONE is not set
151# CONFIG_ARCH_PXA_IDP is not set
152# CONFIG_PXA_SHARPSL is not set
153# CONFIG_MACH_TRIZEPS4 is not set
154CONFIG_MACH_ARMCORE=y
155CONFIG_PXA27x=y
156
157#
158# Processor Type
159#
160CONFIG_CPU_32=y
161CONFIG_CPU_XSCALE=y
162CONFIG_CPU_32v5=y
163CONFIG_CPU_ABRT_EV5T=y
164CONFIG_CPU_CACHE_VIVT=y
165CONFIG_CPU_TLB_V4WBI=y
166CONFIG_CPU_CP15=y
167CONFIG_CPU_CP15_MMU=y
168
169#
170# Processor Features
171#
172CONFIG_ARM_THUMB=y
173# CONFIG_CPU_DCACHE_DISABLE is not set
174# CONFIG_OUTER_CACHE is not set
175CONFIG_IWMMXT=y
176CONFIG_XSCALE_PMU=y
177
178#
179# Bus support
180#
181CONFIG_PCI=y
182CONFIG_PCI_SYSCALL=y
183CONFIG_PCI_HOST_ITE8152=y
184# CONFIG_ARCH_SUPPORTS_MSI is not set
185# CONFIG_PCI_DEBUG is not set
186
187#
188# PCCARD (PCMCIA/CardBus) support
189#
190# CONFIG_PCCARD is not set
191
192#
193# Kernel Features
194#
195# CONFIG_TICK_ONESHOT is not set
196# CONFIG_PREEMPT is not set
197# CONFIG_NO_IDLE_HZ is not set
198CONFIG_HZ=100
199# CONFIG_AEABI is not set
200# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
201CONFIG_SELECT_MEMORY_MODEL=y
202CONFIG_FLATMEM_MANUAL=y
203# CONFIG_DISCONTIGMEM_MANUAL is not set
204# CONFIG_SPARSEMEM_MANUAL is not set
205CONFIG_FLATMEM=y
206CONFIG_FLAT_NODE_MEM_MAP=y
207# CONFIG_SPARSEMEM_STATIC is not set
208CONFIG_SPLIT_PTLOCK_CPUS=4096
209# CONFIG_RESOURCES_64BIT is not set
210CONFIG_ZONE_DMA_FLAG=1
211CONFIG_BOUNCE=y
212CONFIG_VIRT_TO_BUS=y
213CONFIG_ALIGNMENT_TRAP=y
214
215#
216# Boot options
217#
218CONFIG_ZBOOT_ROM_TEXT=0x0
219CONFIG_ZBOOT_ROM_BSS=0x0
220CONFIG_CMDLINE=""
221# CONFIG_XIP_KERNEL is not set
222# CONFIG_KEXEC is not set
223
224#
225# Floating point emulation
226#
227
228#
229# At least one emulation must be selected
230#
231CONFIG_FPE_NWFPE=y
232# CONFIG_FPE_NWFPE_XP is not set
233# CONFIG_FPE_FASTFPE is not set
234
235#
236# Userspace binary formats
237#
238CONFIG_BINFMT_ELF=y
239# CONFIG_BINFMT_AOUT is not set
240# CONFIG_BINFMT_MISC is not set
241# CONFIG_ARTHUR is not set
242
243#
244# Power management options
245#
246CONFIG_PM=y
247# CONFIG_PM_LEGACY is not set
248# CONFIG_PM_DEBUG is not set
249# CONFIG_PM_SYSFS_DEPRECATED is not set
250# CONFIG_APM_EMULATION is not set
251
252#
253# Networking
254#
255CONFIG_NET=y
256
257#
258# Networking options
259#
260CONFIG_PACKET=y
261# CONFIG_PACKET_MMAP is not set
262CONFIG_UNIX=y
263CONFIG_XFRM=y
264# CONFIG_XFRM_USER is not set
265# CONFIG_XFRM_SUB_POLICY is not set
266# CONFIG_XFRM_MIGRATE is not set
267# CONFIG_NET_KEY is not set
268CONFIG_INET=y
269# CONFIG_IP_MULTICAST is not set
270# CONFIG_IP_ADVANCED_ROUTER is not set
271CONFIG_IP_FIB_HASH=y
272CONFIG_IP_PNP=y
273CONFIG_IP_PNP_DHCP=y
274CONFIG_IP_PNP_BOOTP=y
275# CONFIG_IP_PNP_RARP is not set
276# CONFIG_NET_IPIP is not set
277# CONFIG_NET_IPGRE is not set
278# CONFIG_ARPD is not set
279# CONFIG_SYN_COOKIES is not set
280# CONFIG_INET_AH is not set
281# CONFIG_INET_ESP is not set
282# CONFIG_INET_IPCOMP is not set
283# CONFIG_INET_XFRM_TUNNEL is not set
284# CONFIG_INET_TUNNEL is not set
285CONFIG_INET_XFRM_MODE_TRANSPORT=y
286CONFIG_INET_XFRM_MODE_TUNNEL=y
287CONFIG_INET_XFRM_MODE_BEET=y
288CONFIG_INET_DIAG=y
289CONFIG_INET_TCP_DIAG=y
290# CONFIG_TCP_CONG_ADVANCED is not set
291CONFIG_TCP_CONG_CUBIC=y
292CONFIG_DEFAULT_TCP_CONG="cubic"
293# CONFIG_TCP_MD5SIG is not set
294# CONFIG_IPV6 is not set
295# CONFIG_INET6_XFRM_TUNNEL is not set
296# CONFIG_INET6_TUNNEL is not set
297# CONFIG_NETWORK_SECMARK is not set
298# CONFIG_NETFILTER is not set
299# CONFIG_IP_DCCP is not set
300# CONFIG_IP_SCTP is not set
301# CONFIG_TIPC is not set
302# CONFIG_ATM is not set
303# CONFIG_BRIDGE is not set
304# CONFIG_VLAN_8021Q is not set
305# CONFIG_DECNET is not set
306# CONFIG_LLC2 is not set
307# CONFIG_IPX is not set
308# CONFIG_ATALK is not set
309# CONFIG_X25 is not set
310# CONFIG_LAPB is not set
311# CONFIG_ECONET is not set
312# CONFIG_WAN_ROUTER is not set
313
314#
315# QoS and/or fair queueing
316#
317# CONFIG_NET_SCHED is not set
318
319#
320# Network testing
321#
322# CONFIG_NET_PKTGEN is not set
323# CONFIG_HAMRADIO is not set
324# CONFIG_IRDA is not set
325# CONFIG_BT is not set
326# CONFIG_AF_RXRPC is not set
327
328#
329# Wireless
330#
331# CONFIG_CFG80211 is not set
332CONFIG_WIRELESS_EXT=y
333# CONFIG_MAC80211 is not set
334CONFIG_IEEE80211=m
335# CONFIG_IEEE80211_DEBUG is not set
336CONFIG_IEEE80211_CRYPT_WEP=m
337CONFIG_IEEE80211_CRYPT_CCMP=m
338# CONFIG_IEEE80211_CRYPT_TKIP is not set
339# CONFIG_IEEE80211_SOFTMAC is not set
340# CONFIG_RFKILL is not set
341# CONFIG_NET_9P is not set
342
343#
344# Device Drivers
345#
346
347#
348# Generic Driver Options
349#
350CONFIG_STANDALONE=y
351CONFIG_PREVENT_FIRMWARE_BUILD=y
352CONFIG_FW_LOADER=y
353# CONFIG_DEBUG_DRIVER is not set
354# CONFIG_DEBUG_DEVRES is not set
355# CONFIG_SYS_HYPERVISOR is not set
356# CONFIG_CONNECTOR is not set
357CONFIG_MTD=m
358# CONFIG_MTD_DEBUG is not set
359# CONFIG_MTD_CONCAT is not set
360CONFIG_MTD_PARTITIONS=y
361# CONFIG_MTD_REDBOOT_PARTS is not set
362# CONFIG_MTD_AFS_PARTS is not set
363
364#
365# User Modules And Translation Layers
366#
367CONFIG_MTD_CHAR=m
368CONFIG_MTD_BLKDEVS=m
369CONFIG_MTD_BLOCK=m
370# CONFIG_MTD_BLOCK_RO is not set
371# CONFIG_FTL is not set
372# CONFIG_NFTL is not set
373# CONFIG_INFTL is not set
374# CONFIG_RFD_FTL is not set
375# CONFIG_SSFDC is not set
376
377#
378# RAM/ROM/Flash chip drivers
379#
380# CONFIG_MTD_CFI is not set
381# CONFIG_MTD_JEDECPROBE is not set
382CONFIG_MTD_MAP_BANK_WIDTH_1=y
383CONFIG_MTD_MAP_BANK_WIDTH_2=y
384CONFIG_MTD_MAP_BANK_WIDTH_4=y
385# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
386# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
387# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
388CONFIG_MTD_CFI_I1=y
389CONFIG_MTD_CFI_I2=y
390# CONFIG_MTD_CFI_I4 is not set
391# CONFIG_MTD_CFI_I8 is not set
392# CONFIG_MTD_RAM is not set
393# CONFIG_MTD_ROM is not set
394# CONFIG_MTD_ABSENT is not set
395
396#
397# Mapping drivers for chip access
398#
399# CONFIG_MTD_COMPLEX_MAPPINGS is not set
400# CONFIG_MTD_SHARP_SL is not set
401# CONFIG_MTD_PLATRAM is not set
402
403#
404# Self-contained MTD device drivers
405#
406# CONFIG_MTD_PMC551 is not set
407# CONFIG_MTD_SLRAM is not set
408# CONFIG_MTD_PHRAM is not set
409# CONFIG_MTD_MTDRAM is not set
410# CONFIG_MTD_BLOCK2MTD is not set
411
412#
413# Disk-On-Chip Device Drivers
414#
415# CONFIG_MTD_DOC2000 is not set
416# CONFIG_MTD_DOC2001 is not set
417# CONFIG_MTD_DOC2001PLUS is not set
418CONFIG_MTD_NAND=m
419# CONFIG_MTD_NAND_VERIFY_WRITE is not set
420# CONFIG_MTD_NAND_ECC_SMC is not set
421# CONFIG_MTD_NAND_MUSEUM_IDS is not set
422# CONFIG_MTD_NAND_H1900 is not set
423CONFIG_MTD_NAND_IDS=m
424# CONFIG_MTD_NAND_DISKONCHIP is not set
425# CONFIG_MTD_NAND_SHARPSL is not set
426# CONFIG_MTD_NAND_CAFE is not set
427CONFIG_MTD_NAND_CM_X270=m
428# CONFIG_MTD_NAND_NANDSIM is not set
429# CONFIG_MTD_NAND_PLATFORM is not set
430# CONFIG_MTD_ONENAND is not set
431
432#
433# UBI - Unsorted block images
434#
435# CONFIG_MTD_UBI is not set
436# CONFIG_PARPORT is not set
437CONFIG_BLK_DEV=y
438# CONFIG_BLK_CPQ_DA is not set
439# CONFIG_BLK_CPQ_CISS_DA is not set
440# CONFIG_BLK_DEV_DAC960 is not set
441# CONFIG_BLK_DEV_UMEM is not set
442# CONFIG_BLK_DEV_COW_COMMON is not set
443CONFIG_BLK_DEV_LOOP=y
444# CONFIG_BLK_DEV_CRYPTOLOOP is not set
445# CONFIG_BLK_DEV_NBD is not set
446# CONFIG_BLK_DEV_SX8 is not set
447# CONFIG_BLK_DEV_UB is not set
448CONFIG_BLK_DEV_RAM=y
449CONFIG_BLK_DEV_RAM_COUNT=16
450CONFIG_BLK_DEV_RAM_SIZE=12000
451CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
452# CONFIG_CDROM_PKTCDVD is not set
453# CONFIG_ATA_OVER_ETH is not set
454CONFIG_IDE=m
455CONFIG_IDE_MAX_HWIFS=4
456CONFIG_BLK_DEV_IDE=m
457
458#
459# Please see Documentation/ide.txt for help/info on IDE drives
460#
461# CONFIG_BLK_DEV_IDE_SATA is not set
462CONFIG_BLK_DEV_IDEDISK=m
463# CONFIG_IDEDISK_MULTI_MODE is not set
464CONFIG_BLK_DEV_IDECD=m
465# CONFIG_BLK_DEV_IDETAPE is not set
466# CONFIG_BLK_DEV_IDEFLOPPY is not set
467# CONFIG_BLK_DEV_IDESCSI is not set
468# CONFIG_IDE_TASK_IOCTL is not set
469CONFIG_IDE_PROC_FS=y
470
471#
472# IDE chipset support/bugfixes
473#
474# CONFIG_IDE_GENERIC is not set
475# CONFIG_BLK_DEV_IDEPCI is not set
476# CONFIG_IDEPCI_PCIBUS_ORDER is not set
477# CONFIG_IDE_ARM is not set
478# CONFIG_BLK_DEV_IDEDMA is not set
479# CONFIG_BLK_DEV_HD is not set
480
481#
482# SCSI device support
483#
484# CONFIG_RAID_ATTRS is not set
485CONFIG_SCSI=y
486CONFIG_SCSI_DMA=y
487# CONFIG_SCSI_TGT is not set
488# CONFIG_SCSI_NETLINK is not set
489# CONFIG_SCSI_PROC_FS is not set
490
491#
492# SCSI support type (disk, tape, CD-ROM)
493#
494CONFIG_BLK_DEV_SD=y
495# CONFIG_CHR_DEV_ST is not set
496# CONFIG_CHR_DEV_OSST is not set
497# CONFIG_BLK_DEV_SR is not set
498# CONFIG_CHR_DEV_SG is not set
499# CONFIG_CHR_DEV_SCH is not set
500
501#
502# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
503#
504# CONFIG_SCSI_MULTI_LUN is not set
505# CONFIG_SCSI_CONSTANTS is not set
506# CONFIG_SCSI_LOGGING is not set
507# CONFIG_SCSI_SCAN_ASYNC is not set
508CONFIG_SCSI_WAIT_SCAN=m
509
510#
511# SCSI Transports
512#
513# CONFIG_SCSI_SPI_ATTRS is not set
514# CONFIG_SCSI_FC_ATTRS is not set
515# CONFIG_SCSI_ISCSI_ATTRS is not set
516# CONFIG_SCSI_SAS_ATTRS is not set
517# CONFIG_SCSI_SAS_LIBSAS is not set
518
519#
520# SCSI low-level drivers
521#
522# CONFIG_ISCSI_TCP is not set
523# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
524# CONFIG_SCSI_3W_9XXX is not set
525# CONFIG_SCSI_ACARD is not set
526# CONFIG_SCSI_AACRAID is not set
527# CONFIG_SCSI_AIC7XXX is not set
528# CONFIG_SCSI_AIC7XXX_OLD is not set
529# CONFIG_SCSI_AIC79XX is not set
530# CONFIG_SCSI_AIC94XX is not set
531# CONFIG_SCSI_DPT_I2O is not set
532# CONFIG_SCSI_ARCMSR is not set
533# CONFIG_MEGARAID_NEWGEN is not set
534# CONFIG_MEGARAID_LEGACY is not set
535# CONFIG_MEGARAID_SAS is not set
536# CONFIG_SCSI_HPTIOP is not set
537# CONFIG_SCSI_DMX3191D is not set
538# CONFIG_SCSI_FUTURE_DOMAIN is not set
539# CONFIG_SCSI_IPS is not set
540# CONFIG_SCSI_INITIO is not set
541# CONFIG_SCSI_INIA100 is not set
542# CONFIG_SCSI_STEX is not set
543# CONFIG_SCSI_SYM53C8XX_2 is not set
544# CONFIG_SCSI_QLOGIC_1280 is not set
545# CONFIG_SCSI_QLA_FC is not set
546# CONFIG_SCSI_QLA_ISCSI is not set
547# CONFIG_SCSI_LPFC is not set
548# CONFIG_SCSI_DC395x is not set
549# CONFIG_SCSI_DC390T is not set
550# CONFIG_SCSI_NSP32 is not set
551# CONFIG_SCSI_DEBUG is not set
552# CONFIG_SCSI_SRP is not set
553# CONFIG_ATA is not set
554# CONFIG_MD is not set
555
556#
557# Fusion MPT device support
558#
559# CONFIG_FUSION is not set
560# CONFIG_FUSION_SPI is not set
561# CONFIG_FUSION_FC is not set
562# CONFIG_FUSION_SAS is not set
563
564#
565# IEEE 1394 (FireWire) support
566#
567# CONFIG_FIREWIRE is not set
568# CONFIG_IEEE1394 is not set
569# CONFIG_I2O is not set
570CONFIG_NETDEVICES=y
571# CONFIG_NETDEVICES_MULTIQUEUE is not set
572# CONFIG_DUMMY is not set
573# CONFIG_BONDING is not set
574# CONFIG_MACVLAN is not set
575# CONFIG_EQUALIZER is not set
576# CONFIG_TUN is not set
577# CONFIG_ARCNET is not set
578# CONFIG_PHYLIB is not set
579CONFIG_NET_ETHERNET=y
580CONFIG_MII=y
581# CONFIG_AX88796 is not set
582# CONFIG_HAPPYMEAL is not set
583# CONFIG_SUNGEM is not set
584# CONFIG_CASSINI is not set
585# CONFIG_NET_VENDOR_3COM is not set
586# CONFIG_SMC91X is not set
587CONFIG_DM9000=y
588# CONFIG_SMC911X is not set
589# CONFIG_NET_TULIP is not set
590# CONFIG_HP100 is not set
591CONFIG_NET_PCI=y
592# CONFIG_PCNET32 is not set
593# CONFIG_AMD8111_ETH is not set
594# CONFIG_ADAPTEC_STARFIRE is not set
595# CONFIG_B44 is not set
596# CONFIG_FORCEDETH is not set
597# CONFIG_DGRS is not set
598# CONFIG_EEPRO100 is not set
599# CONFIG_E100 is not set
600# CONFIG_FEALNX is not set
601# CONFIG_NATSEMI is not set
602# CONFIG_NE2K_PCI is not set
603# CONFIG_8139CP is not set
604CONFIG_8139TOO=m
605# CONFIG_8139TOO_PIO is not set
606# CONFIG_8139TOO_TUNE_TWISTER is not set
607# CONFIG_8139TOO_8129 is not set
608# CONFIG_8139_OLD_RX_RESET is not set
609# CONFIG_SIS900 is not set
610# CONFIG_EPIC100 is not set
611# CONFIG_SUNDANCE is not set
612# CONFIG_TLAN is not set
613# CONFIG_VIA_RHINE is not set
614# CONFIG_SC92031 is not set
615CONFIG_NETDEV_1000=y
616# CONFIG_ACENIC is not set
617# CONFIG_DL2K is not set
618# CONFIG_E1000 is not set
619# CONFIG_NS83820 is not set
620# CONFIG_HAMACHI is not set
621# CONFIG_YELLOWFIN is not set
622# CONFIG_R8169 is not set
623# CONFIG_SIS190 is not set
624# CONFIG_SKGE is not set
625# CONFIG_SKY2 is not set
626# CONFIG_VIA_VELOCITY is not set
627# CONFIG_TIGON3 is not set
628# CONFIG_BNX2 is not set
629# CONFIG_QLA3XXX is not set
630# CONFIG_ATL1 is not set
631CONFIG_NETDEV_10000=y
632# CONFIG_CHELSIO_T1 is not set
633# CONFIG_CHELSIO_T3 is not set
634# CONFIG_IXGB is not set
635# CONFIG_S2IO is not set
636# CONFIG_MYRI10GE is not set
637# CONFIG_NETXEN_NIC is not set
638# CONFIG_MLX4_CORE is not set
639# CONFIG_TR is not set
640
641#
642# Wireless LAN
643#
644# CONFIG_WLAN_PRE80211 is not set
645# CONFIG_WLAN_80211 is not set
646
647#
648# USB Network Adapters
649#
650# CONFIG_USB_CATC is not set
651# CONFIG_USB_KAWETH is not set
652# CONFIG_USB_PEGASUS is not set
653# CONFIG_USB_RTL8150 is not set
654# CONFIG_USB_USBNET_MII is not set
655# CONFIG_USB_USBNET is not set
656# CONFIG_WAN is not set
657# CONFIG_FDDI is not set
658# CONFIG_HIPPI is not set
659# CONFIG_PPP is not set
660# CONFIG_SLIP is not set
661# CONFIG_NET_FC is not set
662# CONFIG_SHAPER is not set
663# CONFIG_NETCONSOLE is not set
664# CONFIG_NETPOLL is not set
665# CONFIG_NET_POLL_CONTROLLER is not set
666# CONFIG_ISDN is not set
667
668#
669# Input device support
670#
671CONFIG_INPUT=y
672# CONFIG_INPUT_FF_MEMLESS is not set
673# CONFIG_INPUT_POLLDEV is not set
674
675#
676# Userland interfaces
677#
678# CONFIG_INPUT_MOUSEDEV is not set
679# CONFIG_INPUT_JOYDEV is not set
680# CONFIG_INPUT_TSDEV is not set
681CONFIG_INPUT_EVDEV=y
682# CONFIG_INPUT_EVBUG is not set
683
684#
685# Input Device Drivers
686#
687# CONFIG_INPUT_KEYBOARD is not set
688# CONFIG_INPUT_MOUSE is not set
689# CONFIG_INPUT_JOYSTICK is not set
690# CONFIG_INPUT_TABLET is not set
691CONFIG_INPUT_TOUCHSCREEN=y
692# CONFIG_TOUCHSCREEN_GUNZE is not set
693# CONFIG_TOUCHSCREEN_ELO is not set
694# CONFIG_TOUCHSCREEN_MTOUCH is not set
695# CONFIG_TOUCHSCREEN_MK712 is not set
696# CONFIG_TOUCHSCREEN_PENMOUNT is not set
697# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
698# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
699CONFIG_TOUCHSCREEN_UCB1400=m
700# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
701# CONFIG_INPUT_MISC is not set
702
703#
704# Hardware I/O ports
705#
706# CONFIG_SERIO is not set
707# CONFIG_GAMEPORT is not set
708
709#
710# Character devices
711#
712CONFIG_VT=y
713CONFIG_VT_CONSOLE=y
714CONFIG_HW_CONSOLE=y
715# CONFIG_VT_HW_CONSOLE_BINDING is not set
716# CONFIG_SERIAL_NONSTANDARD is not set
717
718#
719# Serial drivers
720#
721# CONFIG_SERIAL_8250 is not set
722
723#
724# Non-8250 serial port support
725#
726CONFIG_SERIAL_PXA=y
727CONFIG_SERIAL_PXA_CONSOLE=y
728CONFIG_SERIAL_CORE=y
729CONFIG_SERIAL_CORE_CONSOLE=y
730# CONFIG_SERIAL_JSM is not set
731CONFIG_UNIX98_PTYS=y
732CONFIG_LEGACY_PTYS=y
733CONFIG_LEGACY_PTY_COUNT=256
734# CONFIG_IPMI_HANDLER is not set
735# CONFIG_WATCHDOG is not set
736CONFIG_HW_RANDOM=m
737# CONFIG_NVRAM is not set
738# CONFIG_R3964 is not set
739# CONFIG_APPLICOM is not set
740# CONFIG_DRM is not set
741# CONFIG_RAW_DRIVER is not set
742# CONFIG_TCG_TPM is not set
743CONFIG_DEVPORT=y
744# CONFIG_I2C is not set
745
746#
747# SPI support
748#
749# CONFIG_SPI is not set
750# CONFIG_SPI_MASTER is not set
751# CONFIG_W1 is not set
752# CONFIG_HWMON is not set
753CONFIG_MISC_DEVICES=y
754# CONFIG_PHANTOM is not set
755# CONFIG_EEPROM_93CX6 is not set
756# CONFIG_SGI_IOC4 is not set
757# CONFIG_TIFM_CORE is not set
758
759#
760# Multifunction device drivers
761#
762# CONFIG_MFD_SM501 is not set
763
764#
765# LED devices
766#
767CONFIG_NEW_LEDS=y
768CONFIG_LEDS_CLASS=y
769
770#
771# LED drivers
772#
773CONFIG_LEDS_CM_X270=y
774
775#
776# LED Triggers
777#
778CONFIG_LEDS_TRIGGERS=y
779# CONFIG_LEDS_TRIGGER_TIMER is not set
780# CONFIG_LEDS_TRIGGER_IDE_DISK is not set
781CONFIG_LEDS_TRIGGER_HEARTBEAT=y
782
783#
784# Multimedia devices
785#
786# CONFIG_VIDEO_DEV is not set
787# CONFIG_DVB_CORE is not set
788CONFIG_DAB=y
789# CONFIG_USB_DABUSB is not set
790
791#
792# Graphics support
793#
794# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
795
796#
797# Display device support
798#
799# CONFIG_DISPLAY_SUPPORT is not set
800# CONFIG_VGASTATE is not set
801CONFIG_FB=y
802# CONFIG_FIRMWARE_EDID is not set
803# CONFIG_FB_DDC is not set
804CONFIG_FB_CFB_FILLRECT=y
805CONFIG_FB_CFB_COPYAREA=y
806CONFIG_FB_CFB_IMAGEBLIT=y
807# CONFIG_FB_SYS_FILLRECT is not set
808# CONFIG_FB_SYS_COPYAREA is not set
809# CONFIG_FB_SYS_IMAGEBLIT is not set
810# CONFIG_FB_SYS_FOPS is not set
811CONFIG_FB_DEFERRED_IO=y
812# CONFIG_FB_SVGALIB is not set
813# CONFIG_FB_MACMODES is not set
814# CONFIG_FB_BACKLIGHT is not set
815# CONFIG_FB_MODE_HELPERS is not set
816# CONFIG_FB_TILEBLITTING is not set
817
818#
819# Frame buffer hardware drivers
820#
821# CONFIG_FB_CIRRUS is not set
822# CONFIG_FB_PM2 is not set
823# CONFIG_FB_CYBER2000 is not set
824# CONFIG_FB_ASILIANT is not set
825# CONFIG_FB_IMSTT is not set
826# CONFIG_FB_S1D13XXX is not set
827# CONFIG_FB_NVIDIA is not set
828# CONFIG_FB_RIVA is not set
829# CONFIG_FB_MATROX is not set
830# CONFIG_FB_RADEON is not set
831# CONFIG_FB_ATY128 is not set
832# CONFIG_FB_ATY is not set
833# CONFIG_FB_S3 is not set
834# CONFIG_FB_SAVAGE is not set
835# CONFIG_FB_SIS is not set
836# CONFIG_FB_NEOMAGIC is not set
837# CONFIG_FB_KYRO is not set
838# CONFIG_FB_3DFX is not set
839# CONFIG_FB_VOODOO1 is not set
840# CONFIG_FB_VT8623 is not set
841# CONFIG_FB_TRIDENT is not set
842# CONFIG_FB_ARK is not set
843# CONFIG_FB_PM3 is not set
844CONFIG_FB_PXA=y
845# CONFIG_FB_PXA_PARAMETERS is not set
846CONFIG_FB_MBX=m
847# CONFIG_FB_VIRTUAL is not set
848
849#
850# Console display driver support
851#
852# CONFIG_VGA_CONSOLE is not set
853CONFIG_DUMMY_CONSOLE=y
854CONFIG_FRAMEBUFFER_CONSOLE=y
855# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
856# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
857# CONFIG_FONTS is not set
858CONFIG_FONT_8x8=y
859CONFIG_FONT_8x16=y
860CONFIG_LOGO=y
861CONFIG_LOGO_LINUX_MONO=y
862CONFIG_LOGO_LINUX_VGA16=y
863CONFIG_LOGO_LINUX_CLUT224=y
864
865#
866# Sound
867#
868CONFIG_SOUND=m
869
870#
871# Advanced Linux Sound Architecture
872#
873CONFIG_SND=m
874CONFIG_SND_TIMER=m
875CONFIG_SND_PCM=m
876# CONFIG_SND_SEQUENCER is not set
877CONFIG_SND_OSSEMUL=y
878CONFIG_SND_MIXER_OSS=m
879CONFIG_SND_PCM_OSS=m
880CONFIG_SND_PCM_OSS_PLUGINS=y
881# CONFIG_SND_DYNAMIC_MINORS is not set
882CONFIG_SND_SUPPORT_OLD_API=y
883CONFIG_SND_VERBOSE_PROCFS=y
884# CONFIG_SND_VERBOSE_PRINTK is not set
885# CONFIG_SND_DEBUG is not set
886
887#
888# Generic devices
889#
890CONFIG_SND_AC97_CODEC=m
891# CONFIG_SND_DUMMY is not set
892# CONFIG_SND_MTPAV is not set
893# CONFIG_SND_SERIAL_U16550 is not set
894# CONFIG_SND_MPU401 is not set
895
896#
897# PCI devices
898#
899# CONFIG_SND_AD1889 is not set
900# CONFIG_SND_ALS300 is not set
901# CONFIG_SND_ALI5451 is not set
902# CONFIG_SND_ATIIXP is not set
903# CONFIG_SND_ATIIXP_MODEM is not set
904# CONFIG_SND_AU8810 is not set
905# CONFIG_SND_AU8820 is not set
906# CONFIG_SND_AU8830 is not set
907# CONFIG_SND_AZT3328 is not set
908# CONFIG_SND_BT87X is not set
909# CONFIG_SND_CA0106 is not set
910# CONFIG_SND_CMIPCI is not set
911# CONFIG_SND_CS4281 is not set
912# CONFIG_SND_CS46XX is not set
913# CONFIG_SND_DARLA20 is not set
914# CONFIG_SND_GINA20 is not set
915# CONFIG_SND_LAYLA20 is not set
916# CONFIG_SND_DARLA24 is not set
917# CONFIG_SND_GINA24 is not set
918# CONFIG_SND_LAYLA24 is not set
919# CONFIG_SND_MONA is not set
920# CONFIG_SND_MIA is not set
921# CONFIG_SND_ECHO3G is not set
922# CONFIG_SND_INDIGO is not set
923# CONFIG_SND_INDIGOIO is not set
924# CONFIG_SND_INDIGODJ is not set
925# CONFIG_SND_EMU10K1 is not set
926# CONFIG_SND_EMU10K1X is not set
927# CONFIG_SND_ENS1370 is not set
928# CONFIG_SND_ENS1371 is not set
929# CONFIG_SND_ES1938 is not set
930# CONFIG_SND_ES1968 is not set
931# CONFIG_SND_FM801 is not set
932# CONFIG_SND_HDA_INTEL is not set
933# CONFIG_SND_HDSP is not set
934# CONFIG_SND_HDSPM is not set
935# CONFIG_SND_ICE1712 is not set
936# CONFIG_SND_ICE1724 is not set
937# CONFIG_SND_INTEL8X0 is not set
938# CONFIG_SND_INTEL8X0M is not set
939# CONFIG_SND_KORG1212 is not set
940# CONFIG_SND_MAESTRO3 is not set
941# CONFIG_SND_MIXART is not set
942# CONFIG_SND_NM256 is not set
943# CONFIG_SND_PCXHR is not set
944# CONFIG_SND_RIPTIDE is not set
945# CONFIG_SND_RME32 is not set
946# CONFIG_SND_RME96 is not set
947# CONFIG_SND_RME9652 is not set
948# CONFIG_SND_SONICVIBES is not set
949# CONFIG_SND_TRIDENT is not set
950# CONFIG_SND_VIA82XX is not set
951# CONFIG_SND_VIA82XX_MODEM is not set
952# CONFIG_SND_VX222 is not set
953# CONFIG_SND_YMFPCI is not set
954# CONFIG_SND_AC97_POWER_SAVE is not set
955
956#
957# ALSA ARM devices
958#
959CONFIG_SND_PXA2XX_PCM=m
960CONFIG_SND_PXA2XX_AC97=m
961
962#
963# USB devices
964#
965# CONFIG_SND_USB_AUDIO is not set
966# CONFIG_SND_USB_CAIAQ is not set
967
968#
969# System on Chip audio support
970#
971# CONFIG_SND_SOC is not set
972
973#
974# Open Sound System
975#
976# CONFIG_SOUND_PRIME is not set
977CONFIG_AC97_BUS=m
978CONFIG_HID_SUPPORT=y
979CONFIG_HID=y
980# CONFIG_HID_DEBUG is not set
981
982#
983# USB Input Devices
984#
985CONFIG_USB_HID=y
986# CONFIG_USB_HIDINPUT_POWERBOOK is not set
987# CONFIG_HID_FF is not set
988# CONFIG_USB_HIDDEV is not set
989CONFIG_USB_SUPPORT=y
990CONFIG_USB_ARCH_HAS_HCD=y
991CONFIG_USB_ARCH_HAS_OHCI=y
992CONFIG_USB_ARCH_HAS_EHCI=y
993CONFIG_USB=y
994# CONFIG_USB_DEBUG is not set
995
996#
997# Miscellaneous USB options
998#
999CONFIG_USB_DEVICEFS=y
1000# CONFIG_USB_DEVICE_CLASS is not set
1001# CONFIG_USB_DYNAMIC_MINORS is not set
1002# CONFIG_USB_SUSPEND is not set
1003# CONFIG_USB_PERSIST is not set
1004# CONFIG_USB_OTG is not set
1005
1006#
1007# USB Host Controller Drivers
1008#
1009# CONFIG_USB_EHCI_HCD is not set
1010# CONFIG_USB_ISP116X_HCD is not set
1011CONFIG_USB_OHCI_HCD=y
1012# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1013# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1014CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1015# CONFIG_USB_UHCI_HCD is not set
1016# CONFIG_USB_SL811_HCD is not set
1017# CONFIG_USB_R8A66597_HCD is not set
1018
1019#
1020# USB Device Class drivers
1021#
1022# CONFIG_USB_ACM is not set
1023# CONFIG_USB_PRINTER is not set
1024
1025#
1026# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
1027#
1028
1029#
1030# may also be needed; see USB_STORAGE Help for more information
1031#
1032CONFIG_USB_STORAGE=y
1033# CONFIG_USB_STORAGE_DEBUG is not set
1034# CONFIG_USB_STORAGE_DATAFAB is not set
1035# CONFIG_USB_STORAGE_FREECOM is not set
1036# CONFIG_USB_STORAGE_DPCM is not set
1037# CONFIG_USB_STORAGE_USBAT is not set
1038# CONFIG_USB_STORAGE_SDDR09 is not set
1039# CONFIG_USB_STORAGE_SDDR55 is not set
1040# CONFIG_USB_STORAGE_JUMPSHOT is not set
1041# CONFIG_USB_STORAGE_ALAUDA is not set
1042# CONFIG_USB_STORAGE_KARMA is not set
1043# CONFIG_USB_LIBUSUAL is not set
1044
1045#
1046# USB Imaging devices
1047#
1048# CONFIG_USB_MDC800 is not set
1049# CONFIG_USB_MICROTEK is not set
1050CONFIG_USB_MON=y
1051
1052#
1053# USB port drivers
1054#
1055
1056#
1057# USB Serial Converter support
1058#
1059# CONFIG_USB_SERIAL is not set
1060
1061#
1062# USB Miscellaneous drivers
1063#
1064# CONFIG_USB_EMI62 is not set
1065# CONFIG_USB_EMI26 is not set
1066# CONFIG_USB_ADUTUX is not set
1067# CONFIG_USB_AUERSWALD is not set
1068# CONFIG_USB_RIO500 is not set
1069# CONFIG_USB_LEGOTOWER is not set
1070# CONFIG_USB_LCD is not set
1071# CONFIG_USB_BERRY_CHARGE is not set
1072# CONFIG_USB_LED is not set
1073# CONFIG_USB_CYPRESS_CY7C63 is not set
1074# CONFIG_USB_CYTHERM is not set
1075# CONFIG_USB_PHIDGET is not set
1076# CONFIG_USB_IDMOUSE is not set
1077# CONFIG_USB_FTDI_ELAN is not set
1078# CONFIG_USB_APPLEDISPLAY is not set
1079# CONFIG_USB_LD is not set
1080# CONFIG_USB_TRANCEVIBRATOR is not set
1081# CONFIG_USB_IOWARRIOR is not set
1082# CONFIG_USB_TEST is not set
1083
1084#
1085# USB DSL modem support
1086#
1087
1088#
1089# USB Gadget Support
1090#
1091# CONFIG_USB_GADGET is not set
1092CONFIG_MMC=m
1093# CONFIG_MMC_DEBUG is not set
1094# CONFIG_MMC_UNSAFE_RESUME is not set
1095
1096#
1097# MMC/SD Card Drivers
1098#
1099CONFIG_MMC_BLOCK=m
1100CONFIG_MMC_BLOCK_BOUNCE=y
1101
1102#
1103# MMC/SD Host Controller Drivers
1104#
1105CONFIG_MMC_PXA=m
1106# CONFIG_MMC_SDHCI is not set
1107# CONFIG_MMC_TIFM_SD is not set
1108
1109#
1110# Real Time Clock
1111#
1112CONFIG_RTC_LIB=y
1113CONFIG_RTC_CLASS=y
1114CONFIG_RTC_HCTOSYS=y
1115CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
1116# CONFIG_RTC_DEBUG is not set
1117
1118#
1119# RTC interfaces
1120#
1121CONFIG_RTC_INTF_SYSFS=y
1122CONFIG_RTC_INTF_PROC=y
1123CONFIG_RTC_INTF_DEV=y
1124# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1125# CONFIG_RTC_DRV_TEST is not set
1126
1127#
1128# Platform RTC drivers
1129#
1130# CONFIG_RTC_DRV_CMOS is not set
1131# CONFIG_RTC_DRV_DS1553 is not set
1132# CONFIG_RTC_DRV_DS1742 is not set
1133# CONFIG_RTC_DRV_M48T86 is not set
1134# CONFIG_RTC_DRV_M48T59 is not set
1135CONFIG_RTC_DRV_V3020=y
1136
1137#
1138# on-CPU RTC drivers
1139#
1140CONFIG_RTC_DRV_SA1100=y
1141
1142#
1143# DMA Engine support
1144#
1145# CONFIG_DMA_ENGINE is not set
1146
1147#
1148# DMA Clients
1149#
1150
1151#
1152# DMA Devices
1153#
1154
1155#
1156# File systems
1157#
1158CONFIG_EXT2_FS=y
1159# CONFIG_EXT2_FS_XATTR is not set
1160# CONFIG_EXT2_FS_XIP is not set
1161CONFIG_EXT3_FS=y
1162CONFIG_EXT3_FS_XATTR=y
1163# CONFIG_EXT3_FS_POSIX_ACL is not set
1164# CONFIG_EXT3_FS_SECURITY is not set
1165# CONFIG_EXT4DEV_FS is not set
1166CONFIG_JBD=y
1167# CONFIG_JBD_DEBUG is not set
1168CONFIG_FS_MBCACHE=y
1169# CONFIG_REISERFS_FS is not set
1170# CONFIG_JFS_FS is not set
1171# CONFIG_FS_POSIX_ACL is not set
1172# CONFIG_XFS_FS is not set
1173# CONFIG_GFS2_FS is not set
1174# CONFIG_OCFS2_FS is not set
1175# CONFIG_MINIX_FS is not set
1176# CONFIG_ROMFS_FS is not set
1177CONFIG_INOTIFY=y
1178CONFIG_INOTIFY_USER=y
1179# CONFIG_QUOTA is not set
1180CONFIG_DNOTIFY=y
1181# CONFIG_AUTOFS_FS is not set
1182# CONFIG_AUTOFS4_FS is not set
1183# CONFIG_FUSE_FS is not set
1184
1185#
1186# CD-ROM/DVD Filesystems
1187#
1188# CONFIG_ISO9660_FS is not set
1189# CONFIG_UDF_FS is not set
1190
1191#
1192# DOS/FAT/NT Filesystems
1193#
1194CONFIG_FAT_FS=y
1195CONFIG_MSDOS_FS=y
1196CONFIG_VFAT_FS=y
1197CONFIG_FAT_DEFAULT_CODEPAGE=437
1198CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1199# CONFIG_NTFS_FS is not set
1200
1201#
1202# Pseudo filesystems
1203#
1204CONFIG_PROC_FS=y
1205CONFIG_PROC_SYSCTL=y
1206CONFIG_SYSFS=y
1207CONFIG_TMPFS=y
1208# CONFIG_TMPFS_POSIX_ACL is not set
1209# CONFIG_HUGETLB_PAGE is not set
1210CONFIG_RAMFS=y
1211# CONFIG_CONFIGFS_FS is not set
1212
1213#
1214# Miscellaneous filesystems
1215#
1216# CONFIG_ADFS_FS is not set
1217# CONFIG_AFFS_FS is not set
1218# CONFIG_HFS_FS is not set
1219# CONFIG_HFSPLUS_FS is not set
1220# CONFIG_BEFS_FS is not set
1221# CONFIG_BFS_FS is not set
1222# CONFIG_EFS_FS is not set
1223# CONFIG_JFFS2_FS is not set
1224# CONFIG_CRAMFS is not set
1225# CONFIG_VXFS_FS is not set
1226# CONFIG_HPFS_FS is not set
1227# CONFIG_QNX4FS_FS is not set
1228# CONFIG_SYSV_FS is not set
1229# CONFIG_UFS_FS is not set
1230
1231#
1232# Network File Systems
1233#
1234CONFIG_NFS_FS=y
1235CONFIG_NFS_V3=y
1236# CONFIG_NFS_V3_ACL is not set
1237# CONFIG_NFS_V4 is not set
1238# CONFIG_NFS_DIRECTIO is not set
1239# CONFIG_NFSD is not set
1240CONFIG_ROOT_NFS=y
1241CONFIG_LOCKD=y
1242CONFIG_LOCKD_V4=y
1243CONFIG_NFS_COMMON=y
1244CONFIG_SUNRPC=y
1245# CONFIG_SUNRPC_BIND34 is not set
1246# CONFIG_RPCSEC_GSS_KRB5 is not set
1247# CONFIG_RPCSEC_GSS_SPKM3 is not set
1248CONFIG_SMB_FS=y
1249# CONFIG_SMB_NLS_DEFAULT is not set
1250# CONFIG_CIFS is not set
1251# CONFIG_NCP_FS is not set
1252# CONFIG_CODA_FS is not set
1253# CONFIG_AFS_FS is not set
1254
1255#
1256# Partition Types
1257#
1258# CONFIG_PARTITION_ADVANCED is not set
1259CONFIG_MSDOS_PARTITION=y
1260
1261#
1262# Native Language Support
1263#
1264CONFIG_NLS=y
1265CONFIG_NLS_DEFAULT="iso8859-1"
1266CONFIG_NLS_CODEPAGE_437=y
1267# CONFIG_NLS_CODEPAGE_737 is not set
1268# CONFIG_NLS_CODEPAGE_775 is not set
1269# CONFIG_NLS_CODEPAGE_850 is not set
1270# CONFIG_NLS_CODEPAGE_852 is not set
1271# CONFIG_NLS_CODEPAGE_855 is not set
1272# CONFIG_NLS_CODEPAGE_857 is not set
1273# CONFIG_NLS_CODEPAGE_860 is not set
1274# CONFIG_NLS_CODEPAGE_861 is not set
1275# CONFIG_NLS_CODEPAGE_862 is not set
1276# CONFIG_NLS_CODEPAGE_863 is not set
1277# CONFIG_NLS_CODEPAGE_864 is not set
1278# CONFIG_NLS_CODEPAGE_865 is not set
1279# CONFIG_NLS_CODEPAGE_866 is not set
1280# CONFIG_NLS_CODEPAGE_869 is not set
1281# CONFIG_NLS_CODEPAGE_936 is not set
1282# CONFIG_NLS_CODEPAGE_950 is not set
1283# CONFIG_NLS_CODEPAGE_932 is not set
1284# CONFIG_NLS_CODEPAGE_949 is not set
1285# CONFIG_NLS_CODEPAGE_874 is not set
1286# CONFIG_NLS_ISO8859_8 is not set
1287# CONFIG_NLS_CODEPAGE_1250 is not set
1288# CONFIG_NLS_CODEPAGE_1251 is not set
1289# CONFIG_NLS_ASCII is not set
1290CONFIG_NLS_ISO8859_1=y
1291# CONFIG_NLS_ISO8859_2 is not set
1292# CONFIG_NLS_ISO8859_3 is not set
1293# CONFIG_NLS_ISO8859_4 is not set
1294# CONFIG_NLS_ISO8859_5 is not set
1295# CONFIG_NLS_ISO8859_6 is not set
1296# CONFIG_NLS_ISO8859_7 is not set
1297# CONFIG_NLS_ISO8859_9 is not set
1298# CONFIG_NLS_ISO8859_13 is not set
1299# CONFIG_NLS_ISO8859_14 is not set
1300# CONFIG_NLS_ISO8859_15 is not set
1301# CONFIG_NLS_KOI8_R is not set
1302# CONFIG_NLS_KOI8_U is not set
1303# CONFIG_NLS_UTF8 is not set
1304
1305#
1306# Distributed Lock Manager
1307#
1308# CONFIG_DLM is not set
1309
1310#
1311# Profiling support
1312#
1313# CONFIG_PROFILING is not set
1314
1315#
1316# Kernel hacking
1317#
1318# CONFIG_PRINTK_TIME is not set
1319CONFIG_ENABLE_MUST_CHECK=y
1320CONFIG_MAGIC_SYSRQ=y
1321# CONFIG_UNUSED_SYMBOLS is not set
1322# CONFIG_DEBUG_FS is not set
1323# CONFIG_HEADERS_CHECK is not set
1324CONFIG_DEBUG_KERNEL=y
1325# CONFIG_DEBUG_SHIRQ is not set
1326# CONFIG_DETECT_SOFTLOCKUP is not set
1327CONFIG_SCHED_DEBUG=y
1328# CONFIG_SCHEDSTATS is not set
1329# CONFIG_TIMER_STATS is not set
1330# CONFIG_DEBUG_SLAB is not set
1331# CONFIG_DEBUG_RT_MUTEXES is not set
1332# CONFIG_RT_MUTEX_TESTER is not set
1333# CONFIG_DEBUG_SPINLOCK is not set
1334# CONFIG_DEBUG_MUTEXES is not set
1335# CONFIG_DEBUG_LOCK_ALLOC is not set
1336# CONFIG_PROVE_LOCKING is not set
1337# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1338# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1339# CONFIG_DEBUG_KOBJECT is not set
1340# CONFIG_DEBUG_BUGVERBOSE is not set
1341CONFIG_DEBUG_INFO=y
1342# CONFIG_DEBUG_VM is not set
1343# CONFIG_DEBUG_LIST is not set
1344CONFIG_FRAME_POINTER=y
1345CONFIG_FORCED_INLINING=y
1346# CONFIG_RCU_TORTURE_TEST is not set
1347# CONFIG_FAULT_INJECTION is not set
1348CONFIG_DEBUG_USER=y
1349CONFIG_DEBUG_ERRORS=y
1350CONFIG_DEBUG_LL=y
1351# CONFIG_DEBUG_ICEDCC is not set
1352
1353#
1354# Security options
1355#
1356# CONFIG_KEYS is not set
1357# CONFIG_SECURITY is not set
1358CONFIG_CRYPTO=y
1359CONFIG_CRYPTO_ALGAPI=m
1360CONFIG_CRYPTO_BLKCIPHER=m
1361CONFIG_CRYPTO_MANAGER=m
1362# CONFIG_CRYPTO_HMAC is not set
1363# CONFIG_CRYPTO_XCBC is not set
1364# CONFIG_CRYPTO_NULL is not set
1365# CONFIG_CRYPTO_MD4 is not set
1366# CONFIG_CRYPTO_MD5 is not set
1367# CONFIG_CRYPTO_SHA1 is not set
1368# CONFIG_CRYPTO_SHA256 is not set
1369# CONFIG_CRYPTO_SHA512 is not set
1370# CONFIG_CRYPTO_WP512 is not set
1371# CONFIG_CRYPTO_TGR192 is not set
1372# CONFIG_CRYPTO_GF128MUL is not set
1373CONFIG_CRYPTO_ECB=m
1374CONFIG_CRYPTO_CBC=m
1375CONFIG_CRYPTO_PCBC=m
1376# CONFIG_CRYPTO_LRW is not set
1377# CONFIG_CRYPTO_CRYPTD is not set
1378# CONFIG_CRYPTO_DES is not set
1379# CONFIG_CRYPTO_FCRYPT is not set
1380# CONFIG_CRYPTO_BLOWFISH is not set
1381# CONFIG_CRYPTO_TWOFISH is not set
1382# CONFIG_CRYPTO_SERPENT is not set
1383CONFIG_CRYPTO_AES=m
1384# CONFIG_CRYPTO_CAST5 is not set
1385# CONFIG_CRYPTO_CAST6 is not set
1386# CONFIG_CRYPTO_TEA is not set
1387CONFIG_CRYPTO_ARC4=m
1388# CONFIG_CRYPTO_KHAZAD is not set
1389# CONFIG_CRYPTO_ANUBIS is not set
1390# CONFIG_CRYPTO_DEFLATE is not set
1391# CONFIG_CRYPTO_MICHAEL_MIC is not set
1392# CONFIG_CRYPTO_CRC32C is not set
1393# CONFIG_CRYPTO_CAMELLIA is not set
1394# CONFIG_CRYPTO_TEST is not set
1395CONFIG_CRYPTO_HW=y
1396
1397#
1398# Library routines
1399#
1400CONFIG_BITREVERSE=y
1401# CONFIG_CRC_CCITT is not set
1402# CONFIG_CRC16 is not set
1403# CONFIG_CRC_ITU_T is not set
1404CONFIG_CRC32=y
1405# CONFIG_CRC7 is not set
1406# CONFIG_LIBCRC32C is not set
1407CONFIG_PLIST=y
1408CONFIG_HAS_IOMEM=y
1409CONFIG_HAS_IOPORT=y
1410CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/omap_h2_1610_defconfig b/arch/arm/configs/omap_h2_1610_defconfig
index b0efd4ca9935..b8a78ab49cdd 100644
--- a/arch/arm/configs/omap_h2_1610_defconfig
+++ b/arch/arm/configs/omap_h2_1610_defconfig
@@ -1,41 +1,58 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.17 3# Linux kernel version: 2.6.23-rc6
4# Thu Jun 29 15:25:18 2006 4# Mon Sep 17 14:21:45 2007
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
7CONFIG_MMU=y 11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
17CONFIG_HARDIRQS_SW_RESEND=y
18CONFIG_GENERIC_IRQ_PROBE=y
8CONFIG_RWSEM_GENERIC_SPINLOCK=y 19CONFIG_RWSEM_GENERIC_SPINLOCK=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
9CONFIG_GENERIC_HWEIGHT=y 22CONFIG_GENERIC_HWEIGHT=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y 23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ZONE_DMA=y
11CONFIG_VECTORS_BASE=0xffff0000 25CONFIG_VECTORS_BASE=0xffff0000
12CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
13 27
14# 28#
15# Code maturity level options 29# General setup
16# 30#
17CONFIG_EXPERIMENTAL=y 31CONFIG_EXPERIMENTAL=y
18CONFIG_BROKEN_ON_SMP=y 32CONFIG_BROKEN_ON_SMP=y
19CONFIG_LOCK_KERNEL=y 33CONFIG_LOCK_KERNEL=y
20CONFIG_INIT_ENV_ARG_LIMIT=32 34CONFIG_INIT_ENV_ARG_LIMIT=32
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION="" 35CONFIG_LOCALVERSION=""
26CONFIG_LOCALVERSION_AUTO=y 36CONFIG_LOCALVERSION_AUTO=y
27CONFIG_SWAP=y 37CONFIG_SWAP=y
28CONFIG_SYSVIPC=y 38CONFIG_SYSVIPC=y
39CONFIG_SYSVIPC_SYSCTL=y
29# CONFIG_POSIX_MQUEUE is not set 40# CONFIG_POSIX_MQUEUE is not set
30# CONFIG_BSD_PROCESS_ACCT is not set 41# CONFIG_BSD_PROCESS_ACCT is not set
31CONFIG_SYSCTL=y 42# CONFIG_TASKSTATS is not set
43# CONFIG_USER_NS is not set
32# CONFIG_AUDIT is not set 44# CONFIG_AUDIT is not set
33# CONFIG_IKCONFIG is not set 45# CONFIG_IKCONFIG is not set
46CONFIG_LOG_BUF_SHIFT=14
47# CONFIG_SYSFS_DEPRECATED is not set
34# CONFIG_RELAY is not set 48# CONFIG_RELAY is not set
49CONFIG_BLK_DEV_INITRD=y
35CONFIG_INITRAMFS_SOURCE="" 50CONFIG_INITRAMFS_SOURCE=""
36CONFIG_UID16=y
37CONFIG_CC_OPTIMIZE_FOR_SIZE=y 51CONFIG_CC_OPTIMIZE_FOR_SIZE=y
52CONFIG_SYSCTL=y
38# CONFIG_EMBEDDED is not set 53# CONFIG_EMBEDDED is not set
54CONFIG_UID16=y
55CONFIG_SYSCTL_SYSCALL=y
39CONFIG_KALLSYMS=y 56CONFIG_KALLSYMS=y
40# CONFIG_KALLSYMS_EXTRA_PASS is not set 57# CONFIG_KALLSYMS_EXTRA_PASS is not set
41CONFIG_HOTPLUG=y 58CONFIG_HOTPLUG=y
@@ -44,27 +61,30 @@ CONFIG_BUG=y
44CONFIG_ELF_CORE=y 61CONFIG_ELF_CORE=y
45CONFIG_BASE_FULL=y 62CONFIG_BASE_FULL=y
46CONFIG_FUTEX=y 63CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y
47CONFIG_EPOLL=y 65CONFIG_EPOLL=y
66CONFIG_SIGNALFD=y
67CONFIG_TIMERFD=y
68CONFIG_EVENTFD=y
48CONFIG_SHMEM=y 69CONFIG_SHMEM=y
70CONFIG_VM_EVENT_COUNTERS=y
49CONFIG_SLAB=y 71CONFIG_SLAB=y
72# CONFIG_SLUB is not set
73# CONFIG_SLOB is not set
74CONFIG_RT_MUTEXES=y
50# CONFIG_TINY_SHMEM is not set 75# CONFIG_TINY_SHMEM is not set
51CONFIG_BASE_SMALL=0 76CONFIG_BASE_SMALL=0
52# CONFIG_SLOB is not set
53
54#
55# Loadable module support
56#
57CONFIG_MODULES=y 77CONFIG_MODULES=y
58CONFIG_MODULE_UNLOAD=y 78CONFIG_MODULE_UNLOAD=y
59# CONFIG_MODULE_FORCE_UNLOAD is not set 79# CONFIG_MODULE_FORCE_UNLOAD is not set
60# CONFIG_MODVERSIONS is not set 80# CONFIG_MODVERSIONS is not set
61# CONFIG_MODULE_SRCVERSION_ALL is not set 81# CONFIG_MODULE_SRCVERSION_ALL is not set
62# CONFIG_KMOD is not set 82# CONFIG_KMOD is not set
63 83CONFIG_BLOCK=y
64# 84# CONFIG_LBD is not set
65# Block layer
66#
67# CONFIG_BLK_DEV_IO_TRACE is not set 85# CONFIG_BLK_DEV_IO_TRACE is not set
86# CONFIG_LSF is not set
87# CONFIG_BLK_DEV_BSG is not set
68 88
69# 89#
70# IO Schedulers 90# IO Schedulers
@@ -86,7 +106,7 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
86# CONFIG_ARCH_INTEGRATOR is not set 106# CONFIG_ARCH_INTEGRATOR is not set
87# CONFIG_ARCH_REALVIEW is not set 107# CONFIG_ARCH_REALVIEW is not set
88# CONFIG_ARCH_VERSATILE is not set 108# CONFIG_ARCH_VERSATILE is not set
89# CONFIG_ARCH_AT91RM9200 is not set 109# CONFIG_ARCH_AT91 is not set
90# CONFIG_ARCH_CLPS7500 is not set 110# CONFIG_ARCH_CLPS7500 is not set
91# CONFIG_ARCH_CLPS711X is not set 111# CONFIG_ARCH_CLPS711X is not set
92# CONFIG_ARCH_CO285 is not set 112# CONFIG_ARCH_CO285 is not set
@@ -96,11 +116,16 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
96# CONFIG_ARCH_NETX is not set 116# CONFIG_ARCH_NETX is not set
97# CONFIG_ARCH_H720X is not set 117# CONFIG_ARCH_H720X is not set
98# CONFIG_ARCH_IMX is not set 118# CONFIG_ARCH_IMX is not set
99# CONFIG_ARCH_IOP3XX is not set 119# CONFIG_ARCH_IOP13XX is not set
100# CONFIG_ARCH_IXP4XX is not set 120# CONFIG_ARCH_IOP32X is not set
101# CONFIG_ARCH_IXP2000 is not set 121# CONFIG_ARCH_IOP33X is not set
102# CONFIG_ARCH_IXP23XX is not set 122# CONFIG_ARCH_IXP23XX is not set
123# CONFIG_ARCH_IXP2000 is not set
124# CONFIG_ARCH_IXP4XX is not set
103# CONFIG_ARCH_L7200 is not set 125# CONFIG_ARCH_L7200 is not set
126# CONFIG_ARCH_KS8695 is not set
127# CONFIG_ARCH_NS9XXX is not set
128# CONFIG_ARCH_MXC is not set
104# CONFIG_ARCH_PNX4008 is not set 129# CONFIG_ARCH_PNX4008 is not set
105# CONFIG_ARCH_PXA is not set 130# CONFIG_ARCH_PXA is not set
106# CONFIG_ARCH_RPC is not set 131# CONFIG_ARCH_RPC is not set
@@ -108,6 +133,7 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
108# CONFIG_ARCH_S3C2410 is not set 133# CONFIG_ARCH_S3C2410 is not set
109# CONFIG_ARCH_SHARK is not set 134# CONFIG_ARCH_SHARK is not set
110# CONFIG_ARCH_LH7A40X is not set 135# CONFIG_ARCH_LH7A40X is not set
136# CONFIG_ARCH_DAVINCI is not set
111CONFIG_ARCH_OMAP=y 137CONFIG_ARCH_OMAP=y
112 138
113# 139#
@@ -124,6 +150,7 @@ CONFIG_ARCH_OMAP1=y
124CONFIG_OMAP_MUX=y 150CONFIG_OMAP_MUX=y
125# CONFIG_OMAP_MUX_DEBUG is not set 151# CONFIG_OMAP_MUX_DEBUG is not set
126CONFIG_OMAP_MUX_WARNINGS=y 152CONFIG_OMAP_MUX_WARNINGS=y
153CONFIG_OMAP_MCBSP=y
127# CONFIG_OMAP_MPU_TIMER is not set 154# CONFIG_OMAP_MPU_TIMER is not set
128CONFIG_OMAP_32K_TIMER=y 155CONFIG_OMAP_32K_TIMER=y
129CONFIG_OMAP_32K_TIMER_HZ=128 156CONFIG_OMAP_32K_TIMER_HZ=128
@@ -162,6 +189,14 @@ CONFIG_OMAP_ARM_192MHZ=y
162# CONFIG_OMAP_ARM_30MHZ is not set 189# CONFIG_OMAP_ARM_30MHZ is not set
163 190
164# 191#
192# Boot options
193#
194
195#
196# Power management
197#
198
199#
165# Processor Type 200# Processor Type
166# 201#
167CONFIG_CPU_32=y 202CONFIG_CPU_32=y
@@ -171,6 +206,8 @@ CONFIG_CPU_ABRT_EV5TJ=y
171CONFIG_CPU_CACHE_VIVT=y 206CONFIG_CPU_CACHE_VIVT=y
172CONFIG_CPU_COPY_V4WB=y 207CONFIG_CPU_COPY_V4WB=y
173CONFIG_CPU_TLB_V4WBI=y 208CONFIG_CPU_TLB_V4WBI=y
209CONFIG_CPU_CP15=y
210CONFIG_CPU_CP15_MMU=y
174 211
175# 212#
176# Processor Features 213# Processor Features
@@ -180,10 +217,13 @@ CONFIG_ARM_THUMB=y
180# CONFIG_CPU_DCACHE_DISABLE is not set 217# CONFIG_CPU_DCACHE_DISABLE is not set
181# CONFIG_CPU_DCACHE_WRITETHROUGH is not set 218# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
182# CONFIG_CPU_CACHE_ROUND_ROBIN is not set 219# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
220# CONFIG_OUTER_CACHE is not set
183 221
184# 222#
185# Bus support 223# Bus support
186# 224#
225# CONFIG_PCI_SYSCALL is not set
226# CONFIG_ARCH_SUPPORTS_MSI is not set
187 227
188# 228#
189# PCCARD (PCMCIA/CardBus) support 229# PCCARD (PCMCIA/CardBus) support
@@ -193,10 +233,13 @@ CONFIG_ARM_THUMB=y
193# 233#
194# Kernel Features 234# Kernel Features
195# 235#
236CONFIG_TICK_ONESHOT=y
237CONFIG_NO_HZ=y
238CONFIG_HIGH_RES_TIMERS=y
196CONFIG_PREEMPT=y 239CONFIG_PREEMPT=y
197CONFIG_NO_IDLE_HZ=y
198CONFIG_HZ=128 240CONFIG_HZ=128
199# CONFIG_AEABI is not set 241CONFIG_AEABI=y
242CONFIG_OABI_COMPAT=y
200# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 243# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
201CONFIG_SELECT_MEMORY_MODEL=y 244CONFIG_SELECT_MEMORY_MODEL=y
202CONFIG_FLATMEM_MANUAL=y 245CONFIG_FLATMEM_MANUAL=y
@@ -206,6 +249,10 @@ CONFIG_FLATMEM=y
206CONFIG_FLAT_NODE_MEM_MAP=y 249CONFIG_FLAT_NODE_MEM_MAP=y
207# CONFIG_SPARSEMEM_STATIC is not set 250# CONFIG_SPARSEMEM_STATIC is not set
208CONFIG_SPLIT_PTLOCK_CPUS=4096 251CONFIG_SPLIT_PTLOCK_CPUS=4096
252# CONFIG_RESOURCES_64BIT is not set
253CONFIG_ZONE_DMA_FLAG=1
254CONFIG_BOUNCE=y
255CONFIG_VIRT_TO_BUS=y
209# CONFIG_LEDS is not set 256# CONFIG_LEDS is not set
210CONFIG_ALIGNMENT_TRAP=y 257CONFIG_ALIGNMENT_TRAP=y
211 258
@@ -216,6 +263,7 @@ CONFIG_ZBOOT_ROM_TEXT=0x0
216CONFIG_ZBOOT_ROM_BSS=0x0 263CONFIG_ZBOOT_ROM_BSS=0x0
217CONFIG_CMDLINE="mem=32M console=ttyS0,115200n8 root=0801 ro init=/bin/sh" 264CONFIG_CMDLINE="mem=32M console=ttyS0,115200n8 root=0801 ro init=/bin/sh"
218# CONFIG_XIP_KERNEL is not set 265# CONFIG_XIP_KERNEL is not set
266# CONFIG_KEXEC is not set
219 267
220# 268#
221# CPU Frequency scaling 269# CPU Frequency scaling
@@ -251,7 +299,6 @@ CONFIG_FPE_NWFPE=y
251CONFIG_BINFMT_ELF=y 299CONFIG_BINFMT_ELF=y
252CONFIG_BINFMT_AOUT=y 300CONFIG_BINFMT_AOUT=y
253# CONFIG_BINFMT_MISC is not set 301# CONFIG_BINFMT_MISC is not set
254# CONFIG_ARTHUR is not set
255 302
256# 303#
257# Power management options 304# Power management options
@@ -259,7 +306,10 @@ CONFIG_BINFMT_AOUT=y
259CONFIG_PM=y 306CONFIG_PM=y
260# CONFIG_PM_LEGACY is not set 307# CONFIG_PM_LEGACY is not set
261# CONFIG_PM_DEBUG is not set 308# CONFIG_PM_DEBUG is not set
262# CONFIG_APM is not set 309CONFIG_PM_SLEEP=y
310CONFIG_SUSPEND_UP_POSSIBLE=y
311CONFIG_SUSPEND=y
312# CONFIG_APM_EMULATION is not set
263 313
264# 314#
265# Networking 315# Networking
@@ -269,12 +319,13 @@ CONFIG_NET=y
269# 319#
270# Networking options 320# Networking options
271# 321#
272# CONFIG_NETDEBUG is not set
273CONFIG_PACKET=y 322CONFIG_PACKET=y
274# CONFIG_PACKET_MMAP is not set 323# CONFIG_PACKET_MMAP is not set
275CONFIG_UNIX=y 324CONFIG_UNIX=y
276CONFIG_XFRM=y 325CONFIG_XFRM=y
277# CONFIG_XFRM_USER is not set 326# CONFIG_XFRM_USER is not set
327# CONFIG_XFRM_SUB_POLICY is not set
328# CONFIG_XFRM_MIGRATE is not set
278# CONFIG_NET_KEY is not set 329# CONFIG_NET_KEY is not set
279CONFIG_INET=y 330CONFIG_INET=y
280# CONFIG_IP_MULTICAST is not set 331# CONFIG_IP_MULTICAST is not set
@@ -295,29 +346,20 @@ CONFIG_IP_PNP_BOOTP=y
295# CONFIG_INET_TUNNEL is not set 346# CONFIG_INET_TUNNEL is not set
296CONFIG_INET_XFRM_MODE_TRANSPORT=y 347CONFIG_INET_XFRM_MODE_TRANSPORT=y
297CONFIG_INET_XFRM_MODE_TUNNEL=y 348CONFIG_INET_XFRM_MODE_TUNNEL=y
349CONFIG_INET_XFRM_MODE_BEET=y
298CONFIG_INET_DIAG=y 350CONFIG_INET_DIAG=y
299CONFIG_INET_TCP_DIAG=y 351CONFIG_INET_TCP_DIAG=y
300# CONFIG_TCP_CONG_ADVANCED is not set 352# CONFIG_TCP_CONG_ADVANCED is not set
301CONFIG_TCP_CONG_BIC=y 353CONFIG_TCP_CONG_CUBIC=y
354CONFIG_DEFAULT_TCP_CONG="cubic"
355# CONFIG_TCP_MD5SIG is not set
302# CONFIG_IPV6 is not set 356# CONFIG_IPV6 is not set
303# CONFIG_INET6_XFRM_TUNNEL is not set 357# CONFIG_INET6_XFRM_TUNNEL is not set
304# CONFIG_INET6_TUNNEL is not set 358# CONFIG_INET6_TUNNEL is not set
305# CONFIG_NETWORK_SECMARK is not set 359# CONFIG_NETWORK_SECMARK is not set
306# CONFIG_NETFILTER is not set 360# CONFIG_NETFILTER is not set
307
308#
309# DCCP Configuration (EXPERIMENTAL)
310#
311# CONFIG_IP_DCCP is not set 361# CONFIG_IP_DCCP is not set
312
313#
314# SCTP Configuration (EXPERIMENTAL)
315#
316# CONFIG_IP_SCTP is not set 362# CONFIG_IP_SCTP is not set
317
318#
319# TIPC Configuration (EXPERIMENTAL)
320#
321# CONFIG_TIPC is not set 363# CONFIG_TIPC is not set
322# CONFIG_ATM is not set 364# CONFIG_ATM is not set
323# CONFIG_BRIDGE is not set 365# CONFIG_BRIDGE is not set
@@ -328,7 +370,6 @@ CONFIG_TCP_CONG_BIC=y
328# CONFIG_ATALK is not set 370# CONFIG_ATALK is not set
329# CONFIG_X25 is not set 371# CONFIG_X25 is not set
330# CONFIG_LAPB is not set 372# CONFIG_LAPB is not set
331# CONFIG_NET_DIVERT is not set
332# CONFIG_ECONET is not set 373# CONFIG_ECONET is not set
333# CONFIG_WAN_ROUTER is not set 374# CONFIG_WAN_ROUTER is not set
334 375
@@ -344,7 +385,17 @@ CONFIG_TCP_CONG_BIC=y
344# CONFIG_HAMRADIO is not set 385# CONFIG_HAMRADIO is not set
345# CONFIG_IRDA is not set 386# CONFIG_IRDA is not set
346# CONFIG_BT is not set 387# CONFIG_BT is not set
388# CONFIG_AF_RXRPC is not set
389
390#
391# Wireless
392#
393# CONFIG_CFG80211 is not set
394# CONFIG_WIRELESS_EXT is not set
395# CONFIG_MAC80211 is not set
347# CONFIG_IEEE80211 is not set 396# CONFIG_IEEE80211 is not set
397# CONFIG_RFKILL is not set
398# CONFIG_NET_9P is not set
348 399
349# 400#
350# Device Drivers 401# Device Drivers
@@ -357,29 +408,10 @@ CONFIG_STANDALONE=y
357CONFIG_PREVENT_FIRMWARE_BUILD=y 408CONFIG_PREVENT_FIRMWARE_BUILD=y
358# CONFIG_FW_LOADER is not set 409# CONFIG_FW_LOADER is not set
359# CONFIG_SYS_HYPERVISOR is not set 410# CONFIG_SYS_HYPERVISOR is not set
360
361#
362# Connector - unified userspace <-> kernelspace linker
363#
364# CONFIG_CONNECTOR is not set 411# CONFIG_CONNECTOR is not set
365
366#
367# Memory Technology Devices (MTD)
368#
369# CONFIG_MTD is not set 412# CONFIG_MTD is not set
370
371#
372# Parallel port support
373#
374# CONFIG_PARPORT is not set 413# CONFIG_PARPORT is not set
375 414CONFIG_BLK_DEV=y
376#
377# Plug and Play support
378#
379
380#
381# Block devices
382#
383# CONFIG_BLK_DEV_COW_COMMON is not set 415# CONFIG_BLK_DEV_COW_COMMON is not set
384CONFIG_BLK_DEV_LOOP=y 416CONFIG_BLK_DEV_LOOP=y
385# CONFIG_BLK_DEV_CRYPTOLOOP is not set 417# CONFIG_BLK_DEV_CRYPTOLOOP is not set
@@ -387,7 +419,7 @@ CONFIG_BLK_DEV_LOOP=y
387CONFIG_BLK_DEV_RAM=y 419CONFIG_BLK_DEV_RAM=y
388CONFIG_BLK_DEV_RAM_COUNT=16 420CONFIG_BLK_DEV_RAM_COUNT=16
389CONFIG_BLK_DEV_RAM_SIZE=8192 421CONFIG_BLK_DEV_RAM_SIZE=8192
390CONFIG_BLK_DEV_INITRD=y 422CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
391# CONFIG_CDROM_PKTCDVD is not set 423# CONFIG_CDROM_PKTCDVD is not set
392CONFIG_ATA_OVER_ETH=m 424CONFIG_ATA_OVER_ETH=m
393 425
@@ -396,6 +428,9 @@ CONFIG_ATA_OVER_ETH=m
396# 428#
397# CONFIG_RAID_ATTRS is not set 429# CONFIG_RAID_ATTRS is not set
398CONFIG_SCSI=y 430CONFIG_SCSI=y
431CONFIG_SCSI_DMA=y
432# CONFIG_SCSI_TGT is not set
433# CONFIG_SCSI_NETLINK is not set
399CONFIG_SCSI_PROC_FS=y 434CONFIG_SCSI_PROC_FS=y
400 435
401# 436#
@@ -414,82 +449,42 @@ CONFIG_SCSI_PROC_FS=y
414# CONFIG_SCSI_MULTI_LUN is not set 449# CONFIG_SCSI_MULTI_LUN is not set
415# CONFIG_SCSI_CONSTANTS is not set 450# CONFIG_SCSI_CONSTANTS is not set
416# CONFIG_SCSI_LOGGING is not set 451# CONFIG_SCSI_LOGGING is not set
452# CONFIG_SCSI_SCAN_ASYNC is not set
453CONFIG_SCSI_WAIT_SCAN=m
417 454
418# 455#
419# SCSI Transport Attributes 456# SCSI Transports
420# 457#
421# CONFIG_SCSI_SPI_ATTRS is not set 458# CONFIG_SCSI_SPI_ATTRS is not set
422# CONFIG_SCSI_FC_ATTRS is not set 459# CONFIG_SCSI_FC_ATTRS is not set
423# CONFIG_SCSI_ISCSI_ATTRS is not set 460# CONFIG_SCSI_ISCSI_ATTRS is not set
424# CONFIG_SCSI_SAS_ATTRS is not set 461# CONFIG_SCSI_SAS_LIBSAS is not set
425 462CONFIG_SCSI_LOWLEVEL=y
426#
427# SCSI low-level drivers
428#
429# CONFIG_ISCSI_TCP is not set 463# CONFIG_ISCSI_TCP is not set
430# CONFIG_SCSI_SATA is not set
431# CONFIG_SCSI_DEBUG is not set 464# CONFIG_SCSI_DEBUG is not set
432 465# CONFIG_ATA is not set
433#
434# Multi-device support (RAID and LVM)
435#
436# CONFIG_MD is not set 466# CONFIG_MD is not set
437
438#
439# Fusion MPT device support
440#
441# CONFIG_FUSION is not set
442
443#
444# IEEE 1394 (FireWire) support
445#
446
447#
448# I2O device support
449#
450
451#
452# Network device support
453#
454CONFIG_NETDEVICES=y 467CONFIG_NETDEVICES=y
468# CONFIG_NETDEVICES_MULTIQUEUE is not set
455# CONFIG_DUMMY is not set 469# CONFIG_DUMMY is not set
456# CONFIG_BONDING is not set 470# CONFIG_BONDING is not set
471# CONFIG_MACVLAN is not set
457# CONFIG_EQUALIZER is not set 472# CONFIG_EQUALIZER is not set
458# CONFIG_TUN is not set 473# CONFIG_TUN is not set
459
460#
461# PHY device support
462#
463# CONFIG_PHYLIB is not set 474# CONFIG_PHYLIB is not set
464
465#
466# Ethernet (10 or 100Mbit)
467#
468CONFIG_NET_ETHERNET=y 475CONFIG_NET_ETHERNET=y
469CONFIG_MII=y 476CONFIG_MII=y
477# CONFIG_AX88796 is not set
470CONFIG_SMC91X=y 478CONFIG_SMC91X=y
471# CONFIG_DM9000 is not set 479# CONFIG_DM9000 is not set
480CONFIG_NETDEV_1000=y
481CONFIG_NETDEV_10000=y
472 482
473# 483#
474# Ethernet (1000 Mbit) 484# Wireless LAN
475#
476
477#
478# Ethernet (10000 Mbit)
479#
480
481#
482# Token Ring devices
483#
484
485#
486# Wireless LAN (non-hamradio)
487#
488# CONFIG_NET_RADIO is not set
489
490#
491# Wan interfaces
492# 485#
486# CONFIG_WLAN_PRE80211 is not set
487# CONFIG_WLAN_80211 is not set
493# CONFIG_WAN is not set 488# CONFIG_WAN is not set
494CONFIG_PPP=y 489CONFIG_PPP=y
495# CONFIG_PPP_MULTILINK is not set 490# CONFIG_PPP_MULTILINK is not set
@@ -500,24 +495,24 @@ CONFIG_PPP=y
500# CONFIG_PPP_BSDCOMP is not set 495# CONFIG_PPP_BSDCOMP is not set
501# CONFIG_PPP_MPPE is not set 496# CONFIG_PPP_MPPE is not set
502# CONFIG_PPPOE is not set 497# CONFIG_PPPOE is not set
498# CONFIG_PPPOL2TP is not set
503CONFIG_SLIP=y 499CONFIG_SLIP=y
504CONFIG_SLIP_COMPRESSED=y 500CONFIG_SLIP_COMPRESSED=y
501CONFIG_SLHC=y
505# CONFIG_SLIP_SMART is not set 502# CONFIG_SLIP_SMART is not set
506# CONFIG_SLIP_MODE_SLIP6 is not set 503# CONFIG_SLIP_MODE_SLIP6 is not set
507# CONFIG_SHAPER is not set 504# CONFIG_SHAPER is not set
508# CONFIG_NETCONSOLE is not set 505# CONFIG_NETCONSOLE is not set
509# CONFIG_NETPOLL is not set 506# CONFIG_NETPOLL is not set
510# CONFIG_NET_POLL_CONTROLLER is not set 507# CONFIG_NET_POLL_CONTROLLER is not set
511
512#
513# ISDN subsystem
514#
515# CONFIG_ISDN is not set 508# CONFIG_ISDN is not set
516 509
517# 510#
518# Input device support 511# Input device support
519# 512#
520CONFIG_INPUT=y 513CONFIG_INPUT=y
514# CONFIG_INPUT_FF_MEMLESS is not set
515# CONFIG_INPUT_POLLDEV is not set
521 516
522# 517#
523# Userland interfaces 518# Userland interfaces
@@ -537,8 +532,14 @@ CONFIG_INPUT_EVBUG=y
537# CONFIG_INPUT_KEYBOARD is not set 532# CONFIG_INPUT_KEYBOARD is not set
538# CONFIG_INPUT_MOUSE is not set 533# CONFIG_INPUT_MOUSE is not set
539# CONFIG_INPUT_JOYSTICK is not set 534# CONFIG_INPUT_JOYSTICK is not set
535# CONFIG_INPUT_TABLET is not set
540# CONFIG_INPUT_TOUCHSCREEN is not set 536# CONFIG_INPUT_TOUCHSCREEN is not set
541CONFIG_INPUT_MISC=y 537CONFIG_INPUT_MISC=y
538# CONFIG_INPUT_ATI_REMOTE is not set
539# CONFIG_INPUT_ATI_REMOTE2 is not set
540# CONFIG_INPUT_KEYSPAN_REMOTE is not set
541# CONFIG_INPUT_POWERMATE is not set
542# CONFIG_INPUT_YEALINK is not set
542CONFIG_INPUT_UINPUT=y 543CONFIG_INPUT_UINPUT=y
543 544
544# 545#
@@ -574,15 +575,7 @@ CONFIG_SERIAL_CORE=y
574CONFIG_SERIAL_CORE_CONSOLE=y 575CONFIG_SERIAL_CORE_CONSOLE=y
575CONFIG_UNIX98_PTYS=y 576CONFIG_UNIX98_PTYS=y
576# CONFIG_LEGACY_PTYS is not set 577# CONFIG_LEGACY_PTYS is not set
577
578#
579# IPMI
580#
581# CONFIG_IPMI_HANDLER is not set 578# CONFIG_IPMI_HANDLER is not set
582
583#
584# Watchdog Cards
585#
586CONFIG_WATCHDOG=y 579CONFIG_WATCHDOG=y
587CONFIG_WATCHDOG_NOWAYOUT=y 580CONFIG_WATCHDOG_NOWAYOUT=y
588 581
@@ -590,25 +583,12 @@ CONFIG_WATCHDOG_NOWAYOUT=y
590# Watchdog Device Drivers 583# Watchdog Device Drivers
591# 584#
592# CONFIG_SOFT_WATCHDOG is not set 585# CONFIG_SOFT_WATCHDOG is not set
586# CONFIG_OMAP_WATCHDOG is not set
593# CONFIG_HW_RANDOM is not set 587# CONFIG_HW_RANDOM is not set
594# CONFIG_NVRAM is not set 588# CONFIG_NVRAM is not set
595# CONFIG_DTLK is not set
596# CONFIG_R3964 is not set 589# CONFIG_R3964 is not set
597
598#
599# Ftape, the floppy tape device driver
600#
601# CONFIG_RAW_DRIVER is not set 590# CONFIG_RAW_DRIVER is not set
602
603#
604# TPM devices
605#
606# CONFIG_TCG_TPM is not set 591# CONFIG_TCG_TPM is not set
607# CONFIG_TELCLOCK is not set
608
609#
610# I2C support
611#
612# CONFIG_I2C is not set 592# CONFIG_I2C is not set
613 593
614# 594#
@@ -616,61 +596,70 @@ CONFIG_WATCHDOG_NOWAYOUT=y
616# 596#
617# CONFIG_SPI is not set 597# CONFIG_SPI is not set
618# CONFIG_SPI_MASTER is not set 598# CONFIG_SPI_MASTER is not set
619 599# CONFIG_W1 is not set
620#
621# Dallas's 1-wire bus
622#
623
624#
625# Hardware Monitoring support
626#
627CONFIG_HWMON=y 600CONFIG_HWMON=y
628# CONFIG_HWMON_VID is not set 601# CONFIG_HWMON_VID is not set
629# CONFIG_SENSORS_ABITUGURU is not set 602# CONFIG_SENSORS_ABITUGURU is not set
603# CONFIG_SENSORS_ABITUGURU3 is not set
630# CONFIG_SENSORS_F71805F is not set 604# CONFIG_SENSORS_F71805F is not set
605# CONFIG_SENSORS_IT87 is not set
606# CONFIG_SENSORS_PC87360 is not set
607# CONFIG_SENSORS_PC87427 is not set
608# CONFIG_SENSORS_SMSC47M1 is not set
609# CONFIG_SENSORS_SMSC47B397 is not set
610# CONFIG_SENSORS_VT1211 is not set
611# CONFIG_SENSORS_W83627HF is not set
612# CONFIG_SENSORS_W83627EHF is not set
631# CONFIG_HWMON_DEBUG_CHIP is not set 613# CONFIG_HWMON_DEBUG_CHIP is not set
614CONFIG_MISC_DEVICES=y
615# CONFIG_EEPROM_93CX6 is not set
632 616
633# 617#
634# Misc devices 618# Multifunction device drivers
635#
636
637#
638# LED devices
639# 619#
620# CONFIG_MFD_SM501 is not set
640# CONFIG_NEW_LEDS is not set 621# CONFIG_NEW_LEDS is not set
641 622
642# 623#
643# LED drivers
644#
645
646#
647# LED Triggers
648#
649
650#
651# Multimedia devices 624# Multimedia devices
652# 625#
653# CONFIG_VIDEO_DEV is not set 626# CONFIG_VIDEO_DEV is not set
654CONFIG_VIDEO_V4L2=y 627# CONFIG_DVB_CORE is not set
628CONFIG_DAB=y
655 629
656# 630#
657# Digital Video Broadcasting Devices 631# Graphics support
658# 632#
659# CONFIG_DVB is not set 633# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
660 634
661# 635#
662# Graphics support 636# Display device support
663# 637#
664CONFIG_FIRMWARE_EDID=y 638# CONFIG_DISPLAY_SUPPORT is not set
639# CONFIG_VGASTATE is not set
640CONFIG_VIDEO_OUTPUT_CONTROL=m
665CONFIG_FB=y 641CONFIG_FB=y
642CONFIG_FIRMWARE_EDID=y
643# CONFIG_FB_DDC is not set
666# CONFIG_FB_CFB_FILLRECT is not set 644# CONFIG_FB_CFB_FILLRECT is not set
667# CONFIG_FB_CFB_COPYAREA is not set 645# CONFIG_FB_CFB_COPYAREA is not set
668# CONFIG_FB_CFB_IMAGEBLIT is not set 646# CONFIG_FB_CFB_IMAGEBLIT is not set
647# CONFIG_FB_SYS_FILLRECT is not set
648# CONFIG_FB_SYS_COPYAREA is not set
649# CONFIG_FB_SYS_IMAGEBLIT is not set
650# CONFIG_FB_SYS_FOPS is not set
651CONFIG_FB_DEFERRED_IO=y
652# CONFIG_FB_SVGALIB is not set
669# CONFIG_FB_MACMODES is not set 653# CONFIG_FB_MACMODES is not set
670# CONFIG_FB_BACKLIGHT is not set 654# CONFIG_FB_BACKLIGHT is not set
671CONFIG_FB_MODE_HELPERS=y 655CONFIG_FB_MODE_HELPERS=y
672# CONFIG_FB_TILEBLITTING is not set 656# CONFIG_FB_TILEBLITTING is not set
657
658#
659# Frame buffer hardware drivers
660#
673# CONFIG_FB_S1D13XXX is not set 661# CONFIG_FB_S1D13XXX is not set
662# CONFIG_FB_OMAP is not set
674# CONFIG_FB_VIRTUAL is not set 663# CONFIG_FB_VIRTUAL is not set
675 664
676# 665#
@@ -679,6 +668,7 @@ CONFIG_FB_MODE_HELPERS=y
679# CONFIG_VGA_CONSOLE is not set 668# CONFIG_VGA_CONSOLE is not set
680CONFIG_DUMMY_CONSOLE=y 669CONFIG_DUMMY_CONSOLE=y
681CONFIG_FRAMEBUFFER_CONSOLE=y 670CONFIG_FRAMEBUFFER_CONSOLE=y
671# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
682# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set 672# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
683CONFIG_FONTS=y 673CONFIG_FONTS=y
684CONFIG_FONT_8x8=y 674CONFIG_FONT_8x8=y
@@ -691,15 +681,10 @@ CONFIG_FONT_8x16=y
691# CONFIG_FONT_SUN8x16 is not set 681# CONFIG_FONT_SUN8x16 is not set
692# CONFIG_FONT_SUN12x22 is not set 682# CONFIG_FONT_SUN12x22 is not set
693# CONFIG_FONT_10x18 is not set 683# CONFIG_FONT_10x18 is not set
694
695#
696# Logo configuration
697#
698CONFIG_LOGO=y 684CONFIG_LOGO=y
699# CONFIG_LOGO_LINUX_MONO is not set 685# CONFIG_LOGO_LINUX_MONO is not set
700# CONFIG_LOGO_LINUX_VGA16 is not set 686# CONFIG_LOGO_LINUX_VGA16 is not set
701CONFIG_LOGO_LINUX_CLUT224=y 687CONFIG_LOGO_LINUX_CLUT224=y
702# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
703 688
704# 689#
705# Sound 690# Sound
@@ -717,10 +702,10 @@ CONFIG_SOUND=y
717CONFIG_SOUND_PRIME=y 702CONFIG_SOUND_PRIME=y
718# CONFIG_SOUND_MSNDCLAS is not set 703# CONFIG_SOUND_MSNDCLAS is not set
719# CONFIG_SOUND_MSNDPIN is not set 704# CONFIG_SOUND_MSNDPIN is not set
720 705CONFIG_HID_SUPPORT=y
721# 706CONFIG_HID=y
722# USB support 707CONFIG_HID_DEBUG=y
723# 708CONFIG_USB_SUPPORT=y
724CONFIG_USB_ARCH_HAS_HCD=y 709CONFIG_USB_ARCH_HAS_HCD=y
725CONFIG_USB_ARCH_HAS_OHCI=y 710CONFIG_USB_ARCH_HAS_OHCI=y
726# CONFIG_USB_ARCH_HAS_EHCI is not set 711# CONFIG_USB_ARCH_HAS_EHCI is not set
@@ -734,17 +719,22 @@ CONFIG_USB_ARCH_HAS_OHCI=y
734# USB Gadget Support 719# USB Gadget Support
735# 720#
736# CONFIG_USB_GADGET is not set 721# CONFIG_USB_GADGET is not set
722# CONFIG_MMC is not set
723CONFIG_RTC_LIB=y
724# CONFIG_RTC_CLASS is not set
737 725
738# 726#
739# MMC/SD Card support 727# DMA Engine support
740# 728#
741# CONFIG_MMC is not set 729# CONFIG_DMA_ENGINE is not set
742 730
743# 731#
744# Real Time Clock 732# DMA Clients
733#
734
735#
736# DMA Devices
745# 737#
746CONFIG_RTC_LIB=y
747# CONFIG_RTC_CLASS is not set
748 738
749# 739#
750# File systems 740# File systems
@@ -753,10 +743,12 @@ CONFIG_EXT2_FS=y
753# CONFIG_EXT2_FS_XATTR is not set 743# CONFIG_EXT2_FS_XATTR is not set
754# CONFIG_EXT2_FS_XIP is not set 744# CONFIG_EXT2_FS_XIP is not set
755# CONFIG_EXT3_FS is not set 745# CONFIG_EXT3_FS is not set
746# CONFIG_EXT4DEV_FS is not set
756# CONFIG_REISERFS_FS is not set 747# CONFIG_REISERFS_FS is not set
757# CONFIG_JFS_FS is not set 748# CONFIG_JFS_FS is not set
758# CONFIG_FS_POSIX_ACL is not set 749# CONFIG_FS_POSIX_ACL is not set
759# CONFIG_XFS_FS is not set 750# CONFIG_XFS_FS is not set
751# CONFIG_GFS2_FS is not set
760# CONFIG_OCFS2_FS is not set 752# CONFIG_OCFS2_FS is not set
761# CONFIG_MINIX_FS is not set 753# CONFIG_MINIX_FS is not set
762CONFIG_ROMFS_FS=y 754CONFIG_ROMFS_FS=y
@@ -787,6 +779,7 @@ CONFIG_FAT_DEFAULT_CODEPAGE=437
787# Pseudo filesystems 779# Pseudo filesystems
788# 780#
789CONFIG_PROC_FS=y 781CONFIG_PROC_FS=y
782CONFIG_PROC_SYSCTL=y
790CONFIG_SYSFS=y 783CONFIG_SYSFS=y
791# CONFIG_TMPFS is not set 784# CONFIG_TMPFS is not set
792# CONFIG_HUGETLB_PAGE is not set 785# CONFIG_HUGETLB_PAGE is not set
@@ -825,6 +818,7 @@ CONFIG_LOCKD_V4=y
825CONFIG_NFS_COMMON=y 818CONFIG_NFS_COMMON=y
826CONFIG_SUNRPC=y 819CONFIG_SUNRPC=y
827CONFIG_SUNRPC_GSS=y 820CONFIG_SUNRPC_GSS=y
821# CONFIG_SUNRPC_BIND34 is not set
828CONFIG_RPCSEC_GSS_KRB5=y 822CONFIG_RPCSEC_GSS_KRB5=y
829# CONFIG_RPCSEC_GSS_SPKM3 is not set 823# CONFIG_RPCSEC_GSS_SPKM3 is not set
830# CONFIG_SMB_FS is not set 824# CONFIG_SMB_FS is not set
@@ -832,7 +826,6 @@ CONFIG_RPCSEC_GSS_KRB5=y
832# CONFIG_NCP_FS is not set 826# CONFIG_NCP_FS is not set
833# CONFIG_CODA_FS is not set 827# CONFIG_CODA_FS is not set
834# CONFIG_AFS_FS is not set 828# CONFIG_AFS_FS is not set
835# CONFIG_9P_FS is not set
836 829
837# 830#
838# Partition Types 831# Partition Types
@@ -885,6 +878,11 @@ CONFIG_NLS_DEFAULT="iso8859-1"
885# CONFIG_NLS_UTF8 is not set 878# CONFIG_NLS_UTF8 is not set
886 879
887# 880#
881# Distributed Lock Manager
882#
883# CONFIG_DLM is not set
884
885#
888# Profiling support 886# Profiling support
889# 887#
890# CONFIG_PROFILING is not set 888# CONFIG_PROFILING is not set
@@ -893,13 +891,14 @@ CONFIG_NLS_DEFAULT="iso8859-1"
893# Kernel hacking 891# Kernel hacking
894# 892#
895# CONFIG_PRINTK_TIME is not set 893# CONFIG_PRINTK_TIME is not set
894CONFIG_ENABLE_MUST_CHECK=y
896# CONFIG_MAGIC_SYSRQ is not set 895# CONFIG_MAGIC_SYSRQ is not set
896# CONFIG_UNUSED_SYMBOLS is not set
897# CONFIG_DEBUG_FS is not set
898# CONFIG_HEADERS_CHECK is not set
897# CONFIG_DEBUG_KERNEL is not set 899# CONFIG_DEBUG_KERNEL is not set
898CONFIG_LOG_BUF_SHIFT=14
899CONFIG_DEBUG_BUGVERBOSE=y 900CONFIG_DEBUG_BUGVERBOSE=y
900# CONFIG_DEBUG_FS is not set
901CONFIG_FRAME_POINTER=y 901CONFIG_FRAME_POINTER=y
902# CONFIG_UNWIND_INFO is not set
903# CONFIG_DEBUG_USER is not set 902# CONFIG_DEBUG_USER is not set
904 903
905# 904#
@@ -907,12 +906,12 @@ CONFIG_FRAME_POINTER=y
907# 906#
908# CONFIG_KEYS is not set 907# CONFIG_KEYS is not set
909# CONFIG_SECURITY is not set 908# CONFIG_SECURITY is not set
910
911#
912# Cryptographic options
913#
914CONFIG_CRYPTO=y 909CONFIG_CRYPTO=y
910CONFIG_CRYPTO_ALGAPI=y
911CONFIG_CRYPTO_BLKCIPHER=y
912CONFIG_CRYPTO_MANAGER=y
915# CONFIG_CRYPTO_HMAC is not set 913# CONFIG_CRYPTO_HMAC is not set
914# CONFIG_CRYPTO_XCBC is not set
916# CONFIG_CRYPTO_NULL is not set 915# CONFIG_CRYPTO_NULL is not set
917# CONFIG_CRYPTO_MD4 is not set 916# CONFIG_CRYPTO_MD4 is not set
918CONFIG_CRYPTO_MD5=y 917CONFIG_CRYPTO_MD5=y
@@ -921,7 +920,14 @@ CONFIG_CRYPTO_MD5=y
921# CONFIG_CRYPTO_SHA512 is not set 920# CONFIG_CRYPTO_SHA512 is not set
922# CONFIG_CRYPTO_WP512 is not set 921# CONFIG_CRYPTO_WP512 is not set
923# CONFIG_CRYPTO_TGR192 is not set 922# CONFIG_CRYPTO_TGR192 is not set
923# CONFIG_CRYPTO_GF128MUL is not set
924CONFIG_CRYPTO_ECB=m
925CONFIG_CRYPTO_CBC=y
926CONFIG_CRYPTO_PCBC=m
927# CONFIG_CRYPTO_LRW is not set
928# CONFIG_CRYPTO_CRYPTD is not set
924CONFIG_CRYPTO_DES=y 929CONFIG_CRYPTO_DES=y
930# CONFIG_CRYPTO_FCRYPT is not set
925# CONFIG_CRYPTO_BLOWFISH is not set 931# CONFIG_CRYPTO_BLOWFISH is not set
926# CONFIG_CRYPTO_TWOFISH is not set 932# CONFIG_CRYPTO_TWOFISH is not set
927# CONFIG_CRYPTO_SERPENT is not set 933# CONFIG_CRYPTO_SERPENT is not set
@@ -935,17 +941,22 @@ CONFIG_CRYPTO_DES=y
935# CONFIG_CRYPTO_DEFLATE is not set 941# CONFIG_CRYPTO_DEFLATE is not set
936# CONFIG_CRYPTO_MICHAEL_MIC is not set 942# CONFIG_CRYPTO_MICHAEL_MIC is not set
937# CONFIG_CRYPTO_CRC32C is not set 943# CONFIG_CRYPTO_CRC32C is not set
944# CONFIG_CRYPTO_CAMELLIA is not set
938# CONFIG_CRYPTO_TEST is not set 945# CONFIG_CRYPTO_TEST is not set
939 946CONFIG_CRYPTO_HW=y
940#
941# Hardware crypto devices
942#
943 947
944# 948#
945# Library routines 949# Library routines
946# 950#
951CONFIG_BITREVERSE=y
947# CONFIG_CRC_CCITT is not set 952# CONFIG_CRC_CCITT is not set
948# CONFIG_CRC16 is not set 953# CONFIG_CRC16 is not set
954# CONFIG_CRC_ITU_T is not set
949CONFIG_CRC32=y 955CONFIG_CRC32=y
956# CONFIG_CRC7 is not set
950# CONFIG_LIBCRC32C is not set 957# CONFIG_LIBCRC32C is not set
951CONFIG_ZLIB_INFLATE=y 958CONFIG_ZLIB_INFLATE=y
959CONFIG_PLIST=y
960CONFIG_HAS_IOMEM=y
961CONFIG_HAS_IOPORT=y
962CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/omap_osk_5912_defconfig b/arch/arm/configs/omap_osk_5912_defconfig
new file mode 100644
index 000000000000..8c1f15c7c45c
--- /dev/null
+++ b/arch/arm/configs/omap_osk_5912_defconfig
@@ -0,0 +1,1073 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23-rc6
4# Mon Sep 17 14:15:05 2007
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
17CONFIG_HARDIRQS_SW_RESEND=y
18CONFIG_GENERIC_IRQ_PROBE=y
19CONFIG_RWSEM_GENERIC_SPINLOCK=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_GENERIC_HWEIGHT=y
23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ZONE_DMA=y
25CONFIG_VECTORS_BASE=0xffff0000
26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
27
28#
29# General setup
30#
31CONFIG_EXPERIMENTAL=y
32CONFIG_BROKEN_ON_SMP=y
33CONFIG_INIT_ENV_ARG_LIMIT=32
34CONFIG_LOCALVERSION=""
35CONFIG_LOCALVERSION_AUTO=y
36CONFIG_SWAP=y
37CONFIG_SYSVIPC=y
38CONFIG_SYSVIPC_SYSCTL=y
39# CONFIG_POSIX_MQUEUE is not set
40# CONFIG_BSD_PROCESS_ACCT is not set
41# CONFIG_TASKSTATS is not set
42# CONFIG_USER_NS is not set
43# CONFIG_AUDIT is not set
44# CONFIG_IKCONFIG is not set
45CONFIG_LOG_BUF_SHIFT=14
46# CONFIG_SYSFS_DEPRECATED is not set
47# CONFIG_RELAY is not set
48CONFIG_BLK_DEV_INITRD=y
49CONFIG_INITRAMFS_SOURCE=""
50CONFIG_CC_OPTIMIZE_FOR_SIZE=y
51CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_KALLSYMS=y
56# CONFIG_KALLSYMS_EXTRA_PASS is not set
57CONFIG_HOTPLUG=y
58CONFIG_PRINTK=y
59CONFIG_BUG=y
60CONFIG_ELF_CORE=y
61CONFIG_BASE_FULL=y
62CONFIG_FUTEX=y
63CONFIG_ANON_INODES=y
64CONFIG_EPOLL=y
65CONFIG_SIGNALFD=y
66CONFIG_TIMERFD=y
67CONFIG_EVENTFD=y
68CONFIG_SHMEM=y
69CONFIG_VM_EVENT_COUNTERS=y
70CONFIG_SLAB=y
71# CONFIG_SLUB is not set
72# CONFIG_SLOB is not set
73CONFIG_RT_MUTEXES=y
74# CONFIG_TINY_SHMEM is not set
75CONFIG_BASE_SMALL=0
76CONFIG_MODULES=y
77CONFIG_MODULE_UNLOAD=y
78# CONFIG_MODULE_FORCE_UNLOAD is not set
79# CONFIG_MODVERSIONS is not set
80# CONFIG_MODULE_SRCVERSION_ALL is not set
81CONFIG_KMOD=y
82CONFIG_BLOCK=y
83# CONFIG_LBD is not set
84# CONFIG_BLK_DEV_IO_TRACE is not set
85# CONFIG_LSF is not set
86# CONFIG_BLK_DEV_BSG is not set
87
88#
89# IO Schedulers
90#
91CONFIG_IOSCHED_NOOP=y
92CONFIG_IOSCHED_AS=y
93CONFIG_IOSCHED_DEADLINE=y
94CONFIG_IOSCHED_CFQ=y
95# CONFIG_DEFAULT_AS is not set
96# CONFIG_DEFAULT_DEADLINE is not set
97CONFIG_DEFAULT_CFQ=y
98# CONFIG_DEFAULT_NOOP is not set
99CONFIG_DEFAULT_IOSCHED="cfq"
100
101#
102# System Type
103#
104# CONFIG_ARCH_AAEC2000 is not set
105# CONFIG_ARCH_INTEGRATOR is not set
106# CONFIG_ARCH_REALVIEW is not set
107# CONFIG_ARCH_VERSATILE is not set
108# CONFIG_ARCH_AT91 is not set
109# CONFIG_ARCH_CLPS7500 is not set
110# CONFIG_ARCH_CLPS711X is not set
111# CONFIG_ARCH_CO285 is not set
112# CONFIG_ARCH_EBSA110 is not set
113# CONFIG_ARCH_EP93XX is not set
114# CONFIG_ARCH_FOOTBRIDGE is not set
115# CONFIG_ARCH_NETX is not set
116# CONFIG_ARCH_H720X is not set
117# CONFIG_ARCH_IMX is not set
118# CONFIG_ARCH_IOP13XX is not set
119# CONFIG_ARCH_IOP32X is not set
120# CONFIG_ARCH_IOP33X is not set
121# CONFIG_ARCH_IXP23XX is not set
122# CONFIG_ARCH_IXP2000 is not set
123# CONFIG_ARCH_IXP4XX is not set
124# CONFIG_ARCH_L7200 is not set
125# CONFIG_ARCH_KS8695 is not set
126# CONFIG_ARCH_NS9XXX is not set
127# CONFIG_ARCH_MXC is not set
128# CONFIG_ARCH_PNX4008 is not set
129# CONFIG_ARCH_PXA is not set
130# CONFIG_ARCH_RPC is not set
131# CONFIG_ARCH_SA1100 is not set
132# CONFIG_ARCH_S3C2410 is not set
133# CONFIG_ARCH_SHARK is not set
134# CONFIG_ARCH_LH7A40X is not set
135# CONFIG_ARCH_DAVINCI is not set
136CONFIG_ARCH_OMAP=y
137
138#
139# TI OMAP Implementations
140#
141CONFIG_ARCH_OMAP_OTG=y
142CONFIG_ARCH_OMAP1=y
143# CONFIG_ARCH_OMAP2 is not set
144
145#
146# OMAP Feature Selections
147#
148CONFIG_OMAP_RESET_CLOCKS=y
149CONFIG_OMAP_MUX=y
150# CONFIG_OMAP_MUX_DEBUG is not set
151CONFIG_OMAP_MUX_WARNINGS=y
152CONFIG_OMAP_MCBSP=y
153# CONFIG_OMAP_MPU_TIMER is not set
154CONFIG_OMAP_32K_TIMER=y
155CONFIG_OMAP_32K_TIMER_HZ=128
156# CONFIG_OMAP_DM_TIMER is not set
157CONFIG_OMAP_LL_DEBUG_UART1=y
158# CONFIG_OMAP_LL_DEBUG_UART2 is not set
159# CONFIG_OMAP_LL_DEBUG_UART3 is not set
160CONFIG_OMAP_SERIAL_WAKE=y
161
162#
163# OMAP Core Type
164#
165# CONFIG_ARCH_OMAP730 is not set
166# CONFIG_ARCH_OMAP15XX is not set
167CONFIG_ARCH_OMAP16XX=y
168
169#
170# OMAP Board Type
171#
172# CONFIG_MACH_OMAP_INNOVATOR is not set
173# CONFIG_MACH_OMAP_H2 is not set
174# CONFIG_MACH_OMAP_H3 is not set
175CONFIG_MACH_OMAP_OSK=y
176# CONFIG_OMAP_OSK_MISTRAL is not set
177# CONFIG_MACH_NOKIA770 is not set
178# CONFIG_MACH_OMAP_GENERIC is not set
179
180#
181# OMAP CPU Speed
182#
183# CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER is not set
184# CONFIG_OMAP_ARM_216MHZ is not set
185CONFIG_OMAP_ARM_192MHZ=y
186# CONFIG_OMAP_ARM_168MHZ is not set
187# CONFIG_OMAP_ARM_120MHZ is not set
188# CONFIG_OMAP_ARM_60MHZ is not set
189# CONFIG_OMAP_ARM_30MHZ is not set
190
191#
192# Boot options
193#
194
195#
196# Power management
197#
198
199#
200# Processor Type
201#
202CONFIG_CPU_32=y
203CONFIG_CPU_ARM926T=y
204CONFIG_CPU_32v5=y
205CONFIG_CPU_ABRT_EV5TJ=y
206CONFIG_CPU_CACHE_VIVT=y
207CONFIG_CPU_COPY_V4WB=y
208CONFIG_CPU_TLB_V4WBI=y
209CONFIG_CPU_CP15=y
210CONFIG_CPU_CP15_MMU=y
211
212#
213# Processor Features
214#
215# CONFIG_ARM_THUMB is not set
216# CONFIG_CPU_ICACHE_DISABLE is not set
217# CONFIG_CPU_DCACHE_DISABLE is not set
218# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
219# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
220# CONFIG_OUTER_CACHE is not set
221
222#
223# Bus support
224#
225# CONFIG_PCI_SYSCALL is not set
226# CONFIG_ARCH_SUPPORTS_MSI is not set
227
228#
229# PCCARD (PCMCIA/CardBus) support
230#
231CONFIG_PCCARD=y
232# CONFIG_PCMCIA_DEBUG is not set
233CONFIG_PCMCIA=y
234CONFIG_PCMCIA_LOAD_CIS=y
235CONFIG_PCMCIA_IOCTL=y
236
237#
238# PC-card bridges
239#
240CONFIG_OMAP_CF=y
241
242#
243# Kernel Features
244#
245CONFIG_TICK_ONESHOT=y
246CONFIG_NO_HZ=y
247CONFIG_HIGH_RES_TIMERS=y
248# CONFIG_PREEMPT is not set
249CONFIG_HZ=128
250CONFIG_AEABI=y
251CONFIG_OABI_COMPAT=y
252# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
253CONFIG_SELECT_MEMORY_MODEL=y
254CONFIG_FLATMEM_MANUAL=y
255# CONFIG_DISCONTIGMEM_MANUAL is not set
256# CONFIG_SPARSEMEM_MANUAL is not set
257CONFIG_FLATMEM=y
258CONFIG_FLAT_NODE_MEM_MAP=y
259# CONFIG_SPARSEMEM_STATIC is not set
260CONFIG_SPLIT_PTLOCK_CPUS=4096
261# CONFIG_RESOURCES_64BIT is not set
262CONFIG_ZONE_DMA_FLAG=1
263CONFIG_BOUNCE=y
264CONFIG_VIRT_TO_BUS=y
265# CONFIG_LEDS is not set
266CONFIG_ALIGNMENT_TRAP=y
267
268#
269# Boot options
270#
271CONFIG_ZBOOT_ROM_TEXT=0x0
272CONFIG_ZBOOT_ROM_BSS=0x0
273CONFIG_CMDLINE="mem=32M console=ttyS0,115200 initrd=0x10400000,8M root=/dev/ram0 rw"
274# CONFIG_XIP_KERNEL is not set
275# CONFIG_KEXEC is not set
276
277#
278# CPU Frequency scaling
279#
280# CONFIG_CPU_FREQ is not set
281
282#
283# Floating point emulation
284#
285
286#
287# At least one emulation must be selected
288#
289CONFIG_FPE_NWFPE=y
290# CONFIG_FPE_NWFPE_XP is not set
291# CONFIG_FPE_FASTFPE is not set
292# CONFIG_VFP is not set
293
294#
295# Userspace binary formats
296#
297CONFIG_BINFMT_ELF=y
298# CONFIG_BINFMT_AOUT is not set
299# CONFIG_BINFMT_MISC is not set
300
301#
302# Power management options
303#
304CONFIG_PM=y
305# CONFIG_PM_LEGACY is not set
306# CONFIG_PM_DEBUG is not set
307CONFIG_PM_SLEEP=y
308CONFIG_SUSPEND_UP_POSSIBLE=y
309CONFIG_SUSPEND=y
310# CONFIG_APM_EMULATION is not set
311
312#
313# Networking
314#
315CONFIG_NET=y
316
317#
318# Networking options
319#
320CONFIG_PACKET=m
321# CONFIG_PACKET_MMAP is not set
322CONFIG_UNIX=y
323CONFIG_XFRM=y
324# CONFIG_XFRM_USER is not set
325# CONFIG_XFRM_SUB_POLICY is not set
326# CONFIG_XFRM_MIGRATE is not set
327# CONFIG_NET_KEY is not set
328CONFIG_INET=y
329CONFIG_IP_MULTICAST=y
330# CONFIG_IP_ADVANCED_ROUTER is not set
331CONFIG_IP_FIB_HASH=y
332CONFIG_IP_PNP=y
333CONFIG_IP_PNP_DHCP=y
334CONFIG_IP_PNP_BOOTP=y
335# CONFIG_IP_PNP_RARP is not set
336# CONFIG_NET_IPIP is not set
337# CONFIG_NET_IPGRE is not set
338# CONFIG_IP_MROUTE is not set
339# CONFIG_ARPD is not set
340# CONFIG_SYN_COOKIES is not set
341# CONFIG_INET_AH is not set
342# CONFIG_INET_ESP is not set
343# CONFIG_INET_IPCOMP is not set
344# CONFIG_INET_XFRM_TUNNEL is not set
345# CONFIG_INET_TUNNEL is not set
346CONFIG_INET_XFRM_MODE_TRANSPORT=y
347CONFIG_INET_XFRM_MODE_TUNNEL=y
348CONFIG_INET_XFRM_MODE_BEET=y
349CONFIG_INET_DIAG=y
350CONFIG_INET_TCP_DIAG=y
351# CONFIG_TCP_CONG_ADVANCED is not set
352CONFIG_TCP_CONG_CUBIC=y
353CONFIG_DEFAULT_TCP_CONG="cubic"
354# CONFIG_TCP_MD5SIG is not set
355# CONFIG_IPV6 is not set
356# CONFIG_INET6_XFRM_TUNNEL is not set
357# CONFIG_INET6_TUNNEL is not set
358# CONFIG_NETWORK_SECMARK is not set
359# CONFIG_NETFILTER is not set
360# CONFIG_IP_DCCP is not set
361# CONFIG_IP_SCTP is not set
362# CONFIG_TIPC is not set
363# CONFIG_ATM is not set
364# CONFIG_BRIDGE is not set
365# CONFIG_VLAN_8021Q is not set
366# CONFIG_DECNET is not set
367# CONFIG_LLC2 is not set
368# CONFIG_IPX is not set
369# CONFIG_ATALK is not set
370# CONFIG_X25 is not set
371# CONFIG_LAPB is not set
372# CONFIG_ECONET is not set
373# CONFIG_WAN_ROUTER is not set
374
375#
376# QoS and/or fair queueing
377#
378# CONFIG_NET_SCHED is not set
379
380#
381# Network testing
382#
383# CONFIG_NET_PKTGEN is not set
384# CONFIG_HAMRADIO is not set
385# CONFIG_IRDA is not set
386# CONFIG_BT is not set
387# CONFIG_AF_RXRPC is not set
388
389#
390# Wireless
391#
392# CONFIG_CFG80211 is not set
393# CONFIG_WIRELESS_EXT is not set
394# CONFIG_MAC80211 is not set
395# CONFIG_IEEE80211 is not set
396# CONFIG_RFKILL is not set
397# CONFIG_NET_9P is not set
398
399#
400# Device Drivers
401#
402
403#
404# Generic Driver Options
405#
406CONFIG_STANDALONE=y
407CONFIG_PREVENT_FIRMWARE_BUILD=y
408CONFIG_FW_LOADER=y
409# CONFIG_SYS_HYPERVISOR is not set
410# CONFIG_CONNECTOR is not set
411CONFIG_MTD=y
412# CONFIG_MTD_DEBUG is not set
413# CONFIG_MTD_CONCAT is not set
414CONFIG_MTD_PARTITIONS=y
415# CONFIG_MTD_REDBOOT_PARTS is not set
416CONFIG_MTD_CMDLINE_PARTS=y
417# CONFIG_MTD_AFS_PARTS is not set
418
419#
420# User Modules And Translation Layers
421#
422CONFIG_MTD_CHAR=y
423CONFIG_MTD_BLKDEVS=y
424CONFIG_MTD_BLOCK=y
425# CONFIG_FTL is not set
426# CONFIG_NFTL is not set
427# CONFIG_INFTL is not set
428# CONFIG_RFD_FTL is not set
429# CONFIG_SSFDC is not set
430
431#
432# RAM/ROM/Flash chip drivers
433#
434CONFIG_MTD_CFI=y
435# CONFIG_MTD_JEDECPROBE is not set
436CONFIG_MTD_GEN_PROBE=y
437# CONFIG_MTD_CFI_ADV_OPTIONS is not set
438CONFIG_MTD_MAP_BANK_WIDTH_1=y
439CONFIG_MTD_MAP_BANK_WIDTH_2=y
440CONFIG_MTD_MAP_BANK_WIDTH_4=y
441# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
442# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
443# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
444CONFIG_MTD_CFI_I1=y
445CONFIG_MTD_CFI_I2=y
446# CONFIG_MTD_CFI_I4 is not set
447# CONFIG_MTD_CFI_I8 is not set
448CONFIG_MTD_CFI_INTELEXT=y
449# CONFIG_MTD_CFI_AMDSTD is not set
450# CONFIG_MTD_CFI_STAA is not set
451CONFIG_MTD_CFI_UTIL=y
452# CONFIG_MTD_RAM is not set
453# CONFIG_MTD_ROM is not set
454# CONFIG_MTD_ABSENT is not set
455
456#
457# Mapping drivers for chip access
458#
459# CONFIG_MTD_COMPLEX_MAPPINGS is not set
460# CONFIG_MTD_PHYSMAP is not set
461# CONFIG_MTD_ARM_INTEGRATOR is not set
462CONFIG_MTD_OMAP_NOR=y
463# CONFIG_MTD_PLATRAM is not set
464
465#
466# Self-contained MTD device drivers
467#
468# CONFIG_MTD_SLRAM is not set
469# CONFIG_MTD_PHRAM is not set
470# CONFIG_MTD_MTDRAM is not set
471# CONFIG_MTD_BLOCK2MTD is not set
472
473#
474# Disk-On-Chip Device Drivers
475#
476# CONFIG_MTD_DOC2000 is not set
477# CONFIG_MTD_DOC2001 is not set
478# CONFIG_MTD_DOC2001PLUS is not set
479# CONFIG_MTD_NAND is not set
480# CONFIG_MTD_ONENAND is not set
481
482#
483# UBI - Unsorted block images
484#
485# CONFIG_MTD_UBI is not set
486# CONFIG_PARPORT is not set
487CONFIG_BLK_DEV=y
488# CONFIG_BLK_DEV_COW_COMMON is not set
489CONFIG_BLK_DEV_LOOP=y
490# CONFIG_BLK_DEV_CRYPTOLOOP is not set
491# CONFIG_BLK_DEV_NBD is not set
492CONFIG_BLK_DEV_RAM=y
493CONFIG_BLK_DEV_RAM_COUNT=16
494CONFIG_BLK_DEV_RAM_SIZE=8192
495CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
496# CONFIG_CDROM_PKTCDVD is not set
497# CONFIG_ATA_OVER_ETH is not set
498CONFIG_IDE=m
499CONFIG_BLK_DEV_IDE=m
500
501#
502# Please see Documentation/ide.txt for help/info on IDE drives
503#
504# CONFIG_BLK_DEV_IDE_SATA is not set
505CONFIG_BLK_DEV_IDEDISK=m
506# CONFIG_IDEDISK_MULTI_MODE is not set
507CONFIG_BLK_DEV_IDECS=m
508# CONFIG_BLK_DEV_IDECD is not set
509# CONFIG_BLK_DEV_IDETAPE is not set
510# CONFIG_BLK_DEV_IDEFLOPPY is not set
511# CONFIG_IDE_TASK_IOCTL is not set
512CONFIG_IDE_PROC_FS=y
513
514#
515# IDE chipset support/bugfixes
516#
517# CONFIG_IDE_GENERIC is not set
518# CONFIG_IDEPCI_PCIBUS_ORDER is not set
519# CONFIG_IDE_ARM is not set
520# CONFIG_BLK_DEV_IDEDMA is not set
521# CONFIG_BLK_DEV_HD is not set
522
523#
524# SCSI device support
525#
526# CONFIG_RAID_ATTRS is not set
527# CONFIG_SCSI is not set
528# CONFIG_SCSI_DMA is not set
529# CONFIG_SCSI_NETLINK is not set
530# CONFIG_ATA is not set
531# CONFIG_MD is not set
532CONFIG_NETDEVICES=y
533# CONFIG_NETDEVICES_MULTIQUEUE is not set
534# CONFIG_DUMMY is not set
535# CONFIG_BONDING is not set
536# CONFIG_MACVLAN is not set
537# CONFIG_EQUALIZER is not set
538# CONFIG_TUN is not set
539# CONFIG_PHYLIB is not set
540CONFIG_NET_ETHERNET=y
541CONFIG_MII=y
542# CONFIG_AX88796 is not set
543CONFIG_SMC91X=y
544# CONFIG_DM9000 is not set
545CONFIG_NETDEV_1000=y
546CONFIG_NETDEV_10000=y
547
548#
549# Wireless LAN
550#
551# CONFIG_WLAN_PRE80211 is not set
552# CONFIG_WLAN_80211 is not set
553# CONFIG_NET_PCMCIA is not set
554# CONFIG_WAN is not set
555CONFIG_PPP=y
556CONFIG_PPP_MULTILINK=y
557# CONFIG_PPP_FILTER is not set
558# CONFIG_PPP_ASYNC is not set
559# CONFIG_PPP_SYNC_TTY is not set
560# CONFIG_PPP_DEFLATE is not set
561# CONFIG_PPP_BSDCOMP is not set
562# CONFIG_PPP_MPPE is not set
563# CONFIG_PPPOE is not set
564# CONFIG_PPPOL2TP is not set
565# CONFIG_SLIP is not set
566CONFIG_SLHC=y
567# CONFIG_SHAPER is not set
568# CONFIG_NETCONSOLE is not set
569# CONFIG_NETPOLL is not set
570# CONFIG_NET_POLL_CONTROLLER is not set
571# CONFIG_ISDN is not set
572
573#
574# Input device support
575#
576CONFIG_INPUT=y
577# CONFIG_INPUT_FF_MEMLESS is not set
578# CONFIG_INPUT_POLLDEV is not set
579
580#
581# Userland interfaces
582#
583CONFIG_INPUT_MOUSEDEV=y
584# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
585CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
586CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
587# CONFIG_INPUT_JOYDEV is not set
588# CONFIG_INPUT_TSDEV is not set
589CONFIG_INPUT_EVDEV=y
590# CONFIG_INPUT_EVBUG is not set
591
592#
593# Input Device Drivers
594#
595CONFIG_INPUT_KEYBOARD=y
596# CONFIG_KEYBOARD_ATKBD is not set
597# CONFIG_KEYBOARD_SUNKBD is not set
598# CONFIG_KEYBOARD_LKKBD is not set
599# CONFIG_KEYBOARD_XTKBD is not set
600# CONFIG_KEYBOARD_NEWTON is not set
601# CONFIG_KEYBOARD_STOWAWAY is not set
602CONFIG_KEYBOARD_OMAP=y
603# CONFIG_KEYBOARD_GPIO is not set
604# CONFIG_INPUT_MOUSE is not set
605# CONFIG_INPUT_JOYSTICK is not set
606# CONFIG_INPUT_TABLET is not set
607CONFIG_INPUT_TOUCHSCREEN=y
608# CONFIG_TOUCHSCREEN_FUJITSU is not set
609# CONFIG_TOUCHSCREEN_GUNZE is not set
610# CONFIG_TOUCHSCREEN_ELO is not set
611# CONFIG_TOUCHSCREEN_MTOUCH is not set
612# CONFIG_TOUCHSCREEN_MK712 is not set
613# CONFIG_TOUCHSCREEN_PENMOUNT is not set
614# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
615# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
616# CONFIG_TOUCHSCREEN_UCB1400 is not set
617# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
618# CONFIG_INPUT_MISC is not set
619
620#
621# Hardware I/O ports
622#
623# CONFIG_SERIO is not set
624# CONFIG_GAMEPORT is not set
625
626#
627# Character devices
628#
629CONFIG_VT=y
630CONFIG_VT_CONSOLE=y
631CONFIG_HW_CONSOLE=y
632# CONFIG_VT_HW_CONSOLE_BINDING is not set
633# CONFIG_SERIAL_NONSTANDARD is not set
634
635#
636# Serial drivers
637#
638CONFIG_SERIAL_8250=y
639CONFIG_SERIAL_8250_CONSOLE=y
640# CONFIG_SERIAL_8250_CS is not set
641CONFIG_SERIAL_8250_NR_UARTS=4
642CONFIG_SERIAL_8250_RUNTIME_UARTS=4
643# CONFIG_SERIAL_8250_EXTENDED is not set
644
645#
646# Non-8250 serial port support
647#
648CONFIG_SERIAL_CORE=y
649CONFIG_SERIAL_CORE_CONSOLE=y
650CONFIG_UNIX98_PTYS=y
651CONFIG_LEGACY_PTYS=y
652CONFIG_LEGACY_PTY_COUNT=256
653# CONFIG_IPMI_HANDLER is not set
654# CONFIG_WATCHDOG is not set
655CONFIG_HW_RANDOM=m
656CONFIG_HW_RANDOM_OMAP=m
657# CONFIG_NVRAM is not set
658# CONFIG_R3964 is not set
659
660#
661# PCMCIA character devices
662#
663# CONFIG_SYNCLINK_CS is not set
664# CONFIG_CARDMAN_4000 is not set
665# CONFIG_CARDMAN_4040 is not set
666# CONFIG_RAW_DRIVER is not set
667# CONFIG_TCG_TPM is not set
668CONFIG_I2C=y
669CONFIG_I2C_BOARDINFO=y
670CONFIG_I2C_CHARDEV=y
671
672#
673# I2C Algorithms
674#
675# CONFIG_I2C_ALGOBIT is not set
676# CONFIG_I2C_ALGOPCF is not set
677# CONFIG_I2C_ALGOPCA is not set
678
679#
680# I2C Hardware Bus support
681#
682# CONFIG_I2C_GPIO is not set
683# CONFIG_I2C_OCORES is not set
684CONFIG_I2C_OMAP=y
685# CONFIG_I2C_PARPORT_LIGHT is not set
686# CONFIG_I2C_SIMTEC is not set
687# CONFIG_I2C_TAOS_EVM is not set
688# CONFIG_I2C_STUB is not set
689
690#
691# Miscellaneous I2C Chip support
692#
693# CONFIG_SENSORS_DS1337 is not set
694# CONFIG_SENSORS_DS1374 is not set
695# CONFIG_DS1682 is not set
696# CONFIG_SENSORS_EEPROM is not set
697# CONFIG_SENSORS_PCF8574 is not set
698# CONFIG_SENSORS_PCA9539 is not set
699# CONFIG_SENSORS_PCF8591 is not set
700# CONFIG_ISP1301_OMAP is not set
701CONFIG_TPS65010=y
702# CONFIG_SENSORS_MAX6875 is not set
703# CONFIG_SENSORS_TSL2550 is not set
704# CONFIG_I2C_DEBUG_CORE is not set
705# CONFIG_I2C_DEBUG_ALGO is not set
706# CONFIG_I2C_DEBUG_BUS is not set
707# CONFIG_I2C_DEBUG_CHIP is not set
708
709#
710# SPI support
711#
712# CONFIG_SPI is not set
713# CONFIG_SPI_MASTER is not set
714# CONFIG_W1 is not set
715CONFIG_HWMON=y
716# CONFIG_HWMON_VID is not set
717# CONFIG_SENSORS_ABITUGURU is not set
718# CONFIG_SENSORS_ABITUGURU3 is not set
719# CONFIG_SENSORS_AD7418 is not set
720# CONFIG_SENSORS_ADM1021 is not set
721# CONFIG_SENSORS_ADM1025 is not set
722# CONFIG_SENSORS_ADM1026 is not set
723# CONFIG_SENSORS_ADM1029 is not set
724# CONFIG_SENSORS_ADM1031 is not set
725# CONFIG_SENSORS_ADM9240 is not set
726# CONFIG_SENSORS_ASB100 is not set
727# CONFIG_SENSORS_ATXP1 is not set
728# CONFIG_SENSORS_DS1621 is not set
729# CONFIG_SENSORS_F71805F is not set
730# CONFIG_SENSORS_FSCHER is not set
731# CONFIG_SENSORS_FSCPOS is not set
732# CONFIG_SENSORS_GL518SM is not set
733# CONFIG_SENSORS_GL520SM is not set
734# CONFIG_SENSORS_IT87 is not set
735# CONFIG_SENSORS_LM63 is not set
736# CONFIG_SENSORS_LM75 is not set
737# CONFIG_SENSORS_LM77 is not set
738# CONFIG_SENSORS_LM78 is not set
739# CONFIG_SENSORS_LM80 is not set
740# CONFIG_SENSORS_LM83 is not set
741# CONFIG_SENSORS_LM85 is not set
742# CONFIG_SENSORS_LM87 is not set
743# CONFIG_SENSORS_LM90 is not set
744# CONFIG_SENSORS_LM92 is not set
745# CONFIG_SENSORS_LM93 is not set
746# CONFIG_SENSORS_MAX1619 is not set
747# CONFIG_SENSORS_MAX6650 is not set
748# CONFIG_SENSORS_PC87360 is not set
749# CONFIG_SENSORS_PC87427 is not set
750# CONFIG_SENSORS_DME1737 is not set
751# CONFIG_SENSORS_SMSC47M1 is not set
752# CONFIG_SENSORS_SMSC47M192 is not set
753# CONFIG_SENSORS_SMSC47B397 is not set
754# CONFIG_SENSORS_THMC50 is not set
755# CONFIG_SENSORS_VT1211 is not set
756# CONFIG_SENSORS_W83781D is not set
757# CONFIG_SENSORS_W83791D is not set
758# CONFIG_SENSORS_W83792D is not set
759# CONFIG_SENSORS_W83793 is not set
760# CONFIG_SENSORS_W83L785TS is not set
761# CONFIG_SENSORS_W83627HF is not set
762# CONFIG_SENSORS_W83627EHF is not set
763# CONFIG_HWMON_DEBUG_CHIP is not set
764CONFIG_MISC_DEVICES=y
765# CONFIG_EEPROM_93CX6 is not set
766
767#
768# Multifunction device drivers
769#
770# CONFIG_MFD_SM501 is not set
771# CONFIG_NEW_LEDS is not set
772
773#
774# Multimedia devices
775#
776# CONFIG_VIDEO_DEV is not set
777# CONFIG_DVB_CORE is not set
778CONFIG_DAB=y
779
780#
781# Graphics support
782#
783# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
784
785#
786# Display device support
787#
788# CONFIG_DISPLAY_SUPPORT is not set
789# CONFIG_VGASTATE is not set
790CONFIG_VIDEO_OUTPUT_CONTROL=m
791CONFIG_FB=y
792CONFIG_FIRMWARE_EDID=y
793# CONFIG_FB_DDC is not set
794# CONFIG_FB_CFB_FILLRECT is not set
795# CONFIG_FB_CFB_COPYAREA is not set
796# CONFIG_FB_CFB_IMAGEBLIT is not set
797# CONFIG_FB_SYS_FILLRECT is not set
798# CONFIG_FB_SYS_COPYAREA is not set
799# CONFIG_FB_SYS_IMAGEBLIT is not set
800# CONFIG_FB_SYS_FOPS is not set
801CONFIG_FB_DEFERRED_IO=y
802# CONFIG_FB_SVGALIB is not set
803# CONFIG_FB_MACMODES is not set
804# CONFIG_FB_BACKLIGHT is not set
805CONFIG_FB_MODE_HELPERS=y
806# CONFIG_FB_TILEBLITTING is not set
807
808#
809# Frame buffer hardware drivers
810#
811# CONFIG_FB_S1D13XXX is not set
812# CONFIG_FB_OMAP is not set
813# CONFIG_FB_VIRTUAL is not set
814
815#
816# Console display driver support
817#
818# CONFIG_VGA_CONSOLE is not set
819CONFIG_DUMMY_CONSOLE=y
820CONFIG_FRAMEBUFFER_CONSOLE=y
821# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
822# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
823CONFIG_FONTS=y
824CONFIG_FONT_8x8=y
825# CONFIG_FONT_8x16 is not set
826# CONFIG_FONT_6x11 is not set
827# CONFIG_FONT_7x14 is not set
828# CONFIG_FONT_PEARL_8x8 is not set
829# CONFIG_FONT_ACORN_8x8 is not set
830# CONFIG_FONT_MINI_4x6 is not set
831# CONFIG_FONT_SUN8x16 is not set
832# CONFIG_FONT_SUN12x22 is not set
833# CONFIG_FONT_10x18 is not set
834CONFIG_LOGO=y
835# CONFIG_LOGO_LINUX_MONO is not set
836# CONFIG_LOGO_LINUX_VGA16 is not set
837CONFIG_LOGO_LINUX_CLUT224=y
838
839#
840# Sound
841#
842# CONFIG_SOUND is not set
843CONFIG_HID_SUPPORT=y
844CONFIG_HID=y
845CONFIG_HID_DEBUG=y
846CONFIG_USB_SUPPORT=y
847CONFIG_USB_ARCH_HAS_HCD=y
848CONFIG_USB_ARCH_HAS_OHCI=y
849# CONFIG_USB_ARCH_HAS_EHCI is not set
850# CONFIG_USB is not set
851
852#
853# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
854#
855
856#
857# USB Gadget Support
858#
859# CONFIG_USB_GADGET is not set
860# CONFIG_MMC is not set
861CONFIG_RTC_LIB=y
862# CONFIG_RTC_CLASS is not set
863
864#
865# DMA Engine support
866#
867# CONFIG_DMA_ENGINE is not set
868
869#
870# DMA Clients
871#
872
873#
874# DMA Devices
875#
876
877#
878# File systems
879#
880CONFIG_EXT2_FS=y
881# CONFIG_EXT2_FS_XATTR is not set
882# CONFIG_EXT2_FS_XIP is not set
883# CONFIG_EXT3_FS is not set
884# CONFIG_EXT4DEV_FS is not set
885# CONFIG_REISERFS_FS is not set
886# CONFIG_JFS_FS is not set
887# CONFIG_FS_POSIX_ACL is not set
888# CONFIG_XFS_FS is not set
889# CONFIG_GFS2_FS is not set
890# CONFIG_OCFS2_FS is not set
891# CONFIG_MINIX_FS is not set
892# CONFIG_ROMFS_FS is not set
893CONFIG_INOTIFY=y
894CONFIG_INOTIFY_USER=y
895# CONFIG_QUOTA is not set
896CONFIG_DNOTIFY=y
897CONFIG_AUTOFS_FS=y
898CONFIG_AUTOFS4_FS=y
899# CONFIG_FUSE_FS is not set
900
901#
902# CD-ROM/DVD Filesystems
903#
904# CONFIG_ISO9660_FS is not set
905# CONFIG_UDF_FS is not set
906
907#
908# DOS/FAT/NT Filesystems
909#
910CONFIG_FAT_FS=m
911CONFIG_MSDOS_FS=m
912CONFIG_VFAT_FS=m
913CONFIG_FAT_DEFAULT_CODEPAGE=437
914CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
915# CONFIG_NTFS_FS is not set
916
917#
918# Pseudo filesystems
919#
920CONFIG_PROC_FS=y
921CONFIG_PROC_SYSCTL=y
922CONFIG_SYSFS=y
923# CONFIG_TMPFS is not set
924# CONFIG_HUGETLB_PAGE is not set
925CONFIG_RAMFS=y
926# CONFIG_CONFIGFS_FS is not set
927
928#
929# Miscellaneous filesystems
930#
931# CONFIG_ADFS_FS is not set
932# CONFIG_AFFS_FS is not set
933# CONFIG_HFS_FS is not set
934# CONFIG_HFSPLUS_FS is not set
935# CONFIG_BEFS_FS is not set
936# CONFIG_BFS_FS is not set
937# CONFIG_EFS_FS is not set
938CONFIG_JFFS2_FS=y
939CONFIG_JFFS2_FS_DEBUG=0
940CONFIG_JFFS2_FS_WRITEBUFFER=y
941# CONFIG_JFFS2_SUMMARY is not set
942# CONFIG_JFFS2_FS_XATTR is not set
943# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
944CONFIG_JFFS2_ZLIB=y
945CONFIG_JFFS2_RTIME=y
946# CONFIG_JFFS2_RUBIN is not set
947# CONFIG_CRAMFS is not set
948# CONFIG_VXFS_FS is not set
949# CONFIG_HPFS_FS is not set
950# CONFIG_QNX4FS_FS is not set
951# CONFIG_SYSV_FS is not set
952# CONFIG_UFS_FS is not set
953
954#
955# Network File Systems
956#
957CONFIG_NFS_FS=y
958CONFIG_NFS_V3=y
959# CONFIG_NFS_V3_ACL is not set
960# CONFIG_NFS_V4 is not set
961# CONFIG_NFS_DIRECTIO is not set
962# CONFIG_NFSD is not set
963CONFIG_ROOT_NFS=y
964CONFIG_LOCKD=y
965CONFIG_LOCKD_V4=y
966CONFIG_NFS_COMMON=y
967CONFIG_SUNRPC=y
968# CONFIG_SUNRPC_BIND34 is not set
969# CONFIG_RPCSEC_GSS_KRB5 is not set
970# CONFIG_RPCSEC_GSS_SPKM3 is not set
971# CONFIG_SMB_FS is not set
972# CONFIG_CIFS is not set
973# CONFIG_NCP_FS is not set
974# CONFIG_CODA_FS is not set
975# CONFIG_AFS_FS is not set
976
977#
978# Partition Types
979#
980# CONFIG_PARTITION_ADVANCED is not set
981CONFIG_MSDOS_PARTITION=y
982
983#
984# Native Language Support
985#
986CONFIG_NLS=m
987CONFIG_NLS_DEFAULT="iso8859-1"
988CONFIG_NLS_CODEPAGE_437=m
989# CONFIG_NLS_CODEPAGE_737 is not set
990# CONFIG_NLS_CODEPAGE_775 is not set
991# CONFIG_NLS_CODEPAGE_850 is not set
992# CONFIG_NLS_CODEPAGE_852 is not set
993# CONFIG_NLS_CODEPAGE_855 is not set
994# CONFIG_NLS_CODEPAGE_857 is not set
995# CONFIG_NLS_CODEPAGE_860 is not set
996# CONFIG_NLS_CODEPAGE_861 is not set
997# CONFIG_NLS_CODEPAGE_862 is not set
998# CONFIG_NLS_CODEPAGE_863 is not set
999# CONFIG_NLS_CODEPAGE_864 is not set
1000# CONFIG_NLS_CODEPAGE_865 is not set
1001# CONFIG_NLS_CODEPAGE_866 is not set
1002# CONFIG_NLS_CODEPAGE_869 is not set
1003# CONFIG_NLS_CODEPAGE_936 is not set
1004# CONFIG_NLS_CODEPAGE_950 is not set
1005# CONFIG_NLS_CODEPAGE_932 is not set
1006# CONFIG_NLS_CODEPAGE_949 is not set
1007# CONFIG_NLS_CODEPAGE_874 is not set
1008# CONFIG_NLS_ISO8859_8 is not set
1009# CONFIG_NLS_CODEPAGE_1250 is not set
1010# CONFIG_NLS_CODEPAGE_1251 is not set
1011# CONFIG_NLS_ASCII is not set
1012CONFIG_NLS_ISO8859_1=m
1013# CONFIG_NLS_ISO8859_2 is not set
1014# CONFIG_NLS_ISO8859_3 is not set
1015# CONFIG_NLS_ISO8859_4 is not set
1016# CONFIG_NLS_ISO8859_5 is not set
1017# CONFIG_NLS_ISO8859_6 is not set
1018# CONFIG_NLS_ISO8859_7 is not set
1019# CONFIG_NLS_ISO8859_9 is not set
1020# CONFIG_NLS_ISO8859_13 is not set
1021# CONFIG_NLS_ISO8859_14 is not set
1022# CONFIG_NLS_ISO8859_15 is not set
1023# CONFIG_NLS_KOI8_R is not set
1024# CONFIG_NLS_KOI8_U is not set
1025# CONFIG_NLS_UTF8 is not set
1026
1027#
1028# Distributed Lock Manager
1029#
1030# CONFIG_DLM is not set
1031
1032#
1033# Profiling support
1034#
1035# CONFIG_PROFILING is not set
1036
1037#
1038# Kernel hacking
1039#
1040# CONFIG_PRINTK_TIME is not set
1041CONFIG_ENABLE_MUST_CHECK=y
1042# CONFIG_MAGIC_SYSRQ is not set
1043# CONFIG_UNUSED_SYMBOLS is not set
1044# CONFIG_DEBUG_FS is not set
1045# CONFIG_HEADERS_CHECK is not set
1046# CONFIG_DEBUG_KERNEL is not set
1047CONFIG_DEBUG_BUGVERBOSE=y
1048CONFIG_FRAME_POINTER=y
1049# CONFIG_DEBUG_USER is not set
1050
1051#
1052# Security options
1053#
1054# CONFIG_KEYS is not set
1055# CONFIG_SECURITY is not set
1056# CONFIG_CRYPTO is not set
1057
1058#
1059# Library routines
1060#
1061CONFIG_BITREVERSE=y
1062# CONFIG_CRC_CCITT is not set
1063# CONFIG_CRC16 is not set
1064# CONFIG_CRC_ITU_T is not set
1065CONFIG_CRC32=y
1066# CONFIG_CRC7 is not set
1067# CONFIG_LIBCRC32C is not set
1068CONFIG_ZLIB_INFLATE=y
1069CONFIG_ZLIB_DEFLATE=y
1070CONFIG_PLIST=y
1071CONFIG_HAS_IOMEM=y
1072CONFIG_HAS_IOPORT=y
1073CONFIG_HAS_DMA=y
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index a2dd930d11ef..e5747547b44c 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -279,6 +279,25 @@ static void __devinit pci_fixup_cy82c693(struct pci_dev *dev)
279} 279}
280DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693, pci_fixup_cy82c693); 280DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693, pci_fixup_cy82c693);
281 281
282static void __init pci_fixup_it8152(struct pci_dev *dev)
283{
284 int i;
285 /* fixup for ITE 8152 devices */
286 /* FIXME: add defines for class 0x68000 and 0x80103 */
287 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_HOST ||
288 dev->class == 0x68000 ||
289 dev->class == 0x80103) {
290 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
291 dev->resource[i].start = 0;
292 dev->resource[i].end = 0;
293 dev->resource[i].flags = 0;
294 }
295 }
296}
297DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8152, pci_fixup_it8152);
298
299
300
282void __devinit pcibios_update_irq(struct pci_dev *dev, int irq) 301void __devinit pcibios_update_irq(struct pci_dev *dev, int irq)
283{ 302{
284 if (debug_pci) 303 if (debug_pci)
@@ -292,9 +311,12 @@ void __devinit pcibios_update_irq(struct pci_dev *dev, int irq)
292 */ 311 */
293static inline int pdev_bad_for_parity(struct pci_dev *dev) 312static inline int pdev_bad_for_parity(struct pci_dev *dev)
294{ 313{
295 return (dev->vendor == PCI_VENDOR_ID_INTERG && 314 return ((dev->vendor == PCI_VENDOR_ID_INTERG &&
296 (dev->device == PCI_DEVICE_ID_INTERG_2000 || 315 (dev->device == PCI_DEVICE_ID_INTERG_2000 ||
297 dev->device == PCI_DEVICE_ID_INTERG_2010)); 316 dev->device == PCI_DEVICE_ID_INTERG_2010)) ||
317 (dev->vendor == PCI_VENDOR_ID_ITE &&
318 dev->device == PCI_DEVICE_ID_ITE_8152));
319
298} 320}
299 321
300/* 322/*
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index a98d0c933db0..cecf658e3625 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -361,6 +361,7 @@
361 CALL(sys_signalfd) 361 CALL(sys_signalfd)
362/* 350 */ CALL(sys_timerfd) 362/* 350 */ CALL(sys_timerfd)
363 CALL(sys_eventfd) 363 CALL(sys_eventfd)
364 CALL(sys_fallocate)
364#ifndef syscalls_counted 365#ifndef syscalls_counted
365.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls 366.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls
366#define syscalls_counted 367#define syscalls_counted
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 78c9f1a3d41f..5feee722ea98 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -731,10 +731,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
731 ret = 0; 731 ret = 0;
732 break; 732 break;
733 733
734 case PTRACE_DETACH:
735 ret = ptrace_detach(child, data);
736 break;
737
738 case PTRACE_GETREGS: 734 case PTRACE_GETREGS:
739 ret = ptrace_getregs(child, (void __user *)data); 735 ret = ptrace_getregs(child, (void __user *)data);
740 break; 736 break;
diff --git a/arch/arm/kernel/relocate_kernel.S b/arch/arm/kernel/relocate_kernel.S
index 7baadae7cb27..062c111c572f 100644
--- a/arch/arm/kernel/relocate_kernel.S
+++ b/arch/arm/kernel/relocate_kernel.S
@@ -7,6 +7,23 @@
7 .globl relocate_new_kernel 7 .globl relocate_new_kernel
8relocate_new_kernel: 8relocate_new_kernel:
9 9
10 /* Move boot params back to where the kernel expects them */
11
12 ldr r0,kexec_boot_params_address
13 teq r0,#0
14 beq 8f
15
16 ldr r1,kexec_boot_params_copy
17 mov r6,#KEXEC_BOOT_PARAMS_SIZE/4
187:
19 ldr r5,[r1],#4
20 str r5,[r0],#4
21 subs r6,r6,#1
22 bne 7b
23
248:
25 /* Boot params moved, now go on with the kernel */
26
10 ldr r0,kexec_indirection_page 27 ldr r0,kexec_indirection_page
11 ldr r1,kexec_start_address 28 ldr r1,kexec_start_address
12 29
@@ -50,7 +67,7 @@ relocate_new_kernel:
50 mov lr,r1 67 mov lr,r1
51 mov r0,#0 68 mov r0,#0
52 ldr r1,kexec_mach_type 69 ldr r1,kexec_mach_type
53 mov r2,#0 70 ldr r2,kexec_boot_params_address
54 mov pc,lr 71 mov pc,lr
55 72
56 .globl kexec_start_address 73 .globl kexec_start_address
@@ -65,6 +82,16 @@ kexec_indirection_page:
65kexec_mach_type: 82kexec_mach_type:
66 .long 0x0 83 .long 0x0
67 84
85 /* phy addr where new kernel will expect to find boot params */
86 .globl kexec_boot_params_address
87kexec_boot_params_address:
88 .long 0x0
89
90 /* phy addr where old kernel put a copy of orig boot params */
91 .globl kexec_boot_params_copy
92kexec_boot_params_copy:
93 .long 0x0
94
68relocate_new_kernel_end: 95relocate_new_kernel_end:
69 96
70 .globl relocate_new_kernel_size 97 .globl relocate_new_kernel_size
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 4de432ec903a..bf56eb337df1 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -24,6 +24,7 @@
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/smp.h> 25#include <linux/smp.h>
26#include <linux/fs.h> 26#include <linux/fs.h>
27#include <linux/kexec.h>
27 28
28#include <asm/cpu.h> 29#include <asm/cpu.h>
29#include <asm/elf.h> 30#include <asm/elf.h>
@@ -304,10 +305,23 @@ int cpu_architecture(void)
304 cpu_arch = (processor_id >> 16) & 7; 305 cpu_arch = (processor_id >> 16) & 7;
305 if (cpu_arch) 306 if (cpu_arch)
306 cpu_arch += CPU_ARCH_ARMv3; 307 cpu_arch += CPU_ARCH_ARMv3;
307 } else { 308 } else if ((processor_id & 0x000f0000) == 0x000f0000) {
308 /* the revised CPUID */ 309 unsigned int mmfr0;
309 cpu_arch = ((processor_id >> 12) & 0xf) - 0xb + CPU_ARCH_ARMv6; 310
310 } 311 /* Revised CPUID format. Read the Memory Model Feature
312 * Register 0 and check for VMSAv7 or PMSAv7 */
313 asm("mrc p15, 0, %0, c0, c1, 4"
314 : "=r" (mmfr0));
315 if ((mmfr0 & 0x0000000f) == 0x00000003 ||
316 (mmfr0 & 0x000000f0) == 0x00000030)
317 cpu_arch = CPU_ARCH_ARMv7;
318 else if ((mmfr0 & 0x0000000f) == 0x00000002 ||
319 (mmfr0 & 0x000000f0) == 0x00000020)
320 cpu_arch = CPU_ARCH_ARMv6;
321 else
322 cpu_arch = CPU_ARCH_UNKNOWN;
323 } else
324 cpu_arch = CPU_ARCH_UNKNOWN;
311 325
312 return cpu_arch; 326 return cpu_arch;
313} 327}
@@ -770,6 +784,23 @@ static int __init customize_machine(void)
770} 784}
771arch_initcall(customize_machine); 785arch_initcall(customize_machine);
772 786
787#ifdef CONFIG_KEXEC
788
789/* Physical addr of where the boot params should be for this machine */
790extern unsigned long kexec_boot_params_address;
791
792/* Physical addr of the buffer into which the boot params are copied */
793extern unsigned long kexec_boot_params_copy;
794
795/* Pointer to the boot params buffer, for manipulation and display */
796unsigned long kexec_boot_params;
797EXPORT_SYMBOL(kexec_boot_params);
798
799/* The buffer itself - make sure it is sized correctly */
800static unsigned long kexec_boot_params_buf[(KEXEC_BOOT_PARAMS_SIZE + 3) / 4];
801
802#endif
803
773void __init setup_arch(char **cmdline_p) 804void __init setup_arch(char **cmdline_p)
774{ 805{
775 struct tag *tags = (struct tag *)&init_tags; 806 struct tag *tags = (struct tag *)&init_tags;
@@ -788,6 +819,18 @@ void __init setup_arch(char **cmdline_p)
788 else if (mdesc->boot_params) 819 else if (mdesc->boot_params)
789 tags = phys_to_virt(mdesc->boot_params); 820 tags = phys_to_virt(mdesc->boot_params);
790 821
822#ifdef CONFIG_KEXEC
823 kexec_boot_params_copy = virt_to_phys(kexec_boot_params_buf);
824 kexec_boot_params = (unsigned long)kexec_boot_params_buf;
825 if (__atags_pointer) {
826 kexec_boot_params_address = __atags_pointer;
827 memcpy((void *)kexec_boot_params, tags, KEXEC_BOOT_PARAMS_SIZE);
828 } else if (mdesc->boot_params) {
829 kexec_boot_params_address = mdesc->boot_params;
830 memcpy((void *)kexec_boot_params, tags, KEXEC_BOOT_PARAMS_SIZE);
831 }
832#endif
833
791 /* 834 /*
792 * If we have the old style parameters, convert them to 835 * If we have the old style parameters, convert them to
793 * a tag list. 836 * a tag list.
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index a31157f1655a..05a9f8a1b45e 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -7,6 +7,8 @@ choice
7 7
8config ARCH_AT91RM9200 8config ARCH_AT91RM9200
9 bool "AT91RM9200" 9 bool "AT91RM9200"
10 select GENERIC_TIME
11 select GENERIC_CLOCKEVENTS
10 12
11config ARCH_AT91SAM9260 13config ARCH_AT91SAM9260
12 bool "AT91SAM9260 or AT91SAM9XE" 14 bool "AT91SAM9260 or AT91SAM9XE"
@@ -20,8 +22,15 @@ config ARCH_AT91SAM9263
20config ARCH_AT91SAM9RL 22config ARCH_AT91SAM9RL
21 bool "AT91SAM9RL" 23 bool "AT91SAM9RL"
22 24
25config ARCH_AT91X40
26 bool "AT91x40"
27
23endchoice 28endchoice
24 29
30config AT91_PMC_UNIT
31 bool
32 default !ARCH_AT91X40
33
25# ---------------------------------------------------------- 34# ----------------------------------------------------------
26 35
27if ARCH_AT91RM9200 36if ARCH_AT91RM9200
@@ -169,6 +178,22 @@ endif
169 178
170# ---------------------------------------------------------- 179# ----------------------------------------------------------
171 180
181if ARCH_AT91X40
182
183comment "AT91X40 Board Type"
184
185config MACH_AT91EB01
186 bool "Atmel AT91EB01 Evaluation Kit"
187 help
188 Select this if you are using Atmel's AT91EB01 Evaluation Kit.
189 It is also a popular target for simulators such as GDB's
190 ARM simulator (commonly known as the ARMulator) and the
191 Skyeye simulator.
192
193endif
194
195# ----------------------------------------------------------
196
172comment "AT91 Board Options" 197comment "AT91 Board Options"
173 198
174config MTD_AT91_DATAFLASH_CARD 199config MTD_AT91_DATAFLASH_CARD
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index a4d80eb056ee..a21f08c64ea6 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -2,11 +2,12 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5obj-y := clock.o irq.o gpio.o 5obj-y := irq.o gpio.o
6obj-m := 6obj-m :=
7obj-n := 7obj-n :=
8obj- := 8obj- :=
9 9
10obj-$(CONFIG_AT91_PMC_UNIT) += clock.o
10obj-$(CONFIG_PM) += pm.o 11obj-$(CONFIG_PM) += pm.o
11 12
12# CPU-specific support 13# CPU-specific support
@@ -15,6 +16,7 @@ obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260.o at91sam926x_time.o at91sam9260_d
15obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261.o at91sam926x_time.o at91sam9261_devices.o 16obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261.o at91sam926x_time.o at91sam9261_devices.o
16obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_devices.o 17obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_devices.o
17obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o 18obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o
19obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o
18 20
19# AT91RM9200 board-specific support 21# AT91RM9200 board-specific support
20obj-$(CONFIG_MACH_ONEARM) += board-1arm.o 22obj-$(CONFIG_MACH_ONEARM) += board-1arm.o
@@ -27,6 +29,7 @@ obj-$(CONFIG_MACH_KB9200) += board-kb9202.o
27obj-$(CONFIG_MACH_ATEB9200) += board-eb9200.o 29obj-$(CONFIG_MACH_ATEB9200) += board-eb9200.o
28obj-$(CONFIG_MACH_KAFA) += board-kafa.o 30obj-$(CONFIG_MACH_KAFA) += board-kafa.o
29obj-$(CONFIG_MACH_PICOTUX2XX) += board-picotux200.o 31obj-$(CONFIG_MACH_PICOTUX2XX) += board-picotux200.o
32obj-$(CONFIG_MACH_AT91EB01) += board-eb01.o
30 33
31# AT91SAM9260 board-specific support 34# AT91SAM9260 board-specific support
32obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o 35obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c
index a6340357585d..50392ff71513 100644
--- a/arch/arm/mach-at91/at91rm9200_time.c
+++ b/arch/arm/mach-at91/at91rm9200_time.c
@@ -19,70 +19,64 @@
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21 21
22#include <linux/init.h> 22#include <linux/kernel.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/kernel.h> 25#include <linux/clockchips.h>
26#include <linux/sched.h>
27#include <linux/time.h>
28 26
29#include <asm/hardware.h>
30#include <asm/io.h>
31#include <asm/mach/time.h> 27#include <asm/mach/time.h>
32 28
33#include <asm/arch/at91_st.h> 29#include <asm/arch/at91_st.h>
34 30
35static unsigned long last_crtr; 31static unsigned long last_crtr;
32static u32 irqmask;
33static struct clock_event_device clkevt;
36 34
37/* 35/*
38 * The ST_CRTR is updated asynchronously to the master clock. It is therefore 36 * The ST_CRTR is updated asynchronously to the master clock ... but
39 * necessary to read it twice (with the same value) to ensure accuracy. 37 * the updates as seen by the CPU don't seem to be strictly monotonic.
38 * Waiting until we read the same value twice avoids glitching.
40 */ 39 */
41static inline unsigned long read_CRTR(void) { 40static inline unsigned long read_CRTR(void)
41{
42 unsigned long x1, x2; 42 unsigned long x1, x2;
43 43
44 x1 = at91_sys_read(AT91_ST_CRTR);
44 do { 45 do {
45 x1 = at91_sys_read(AT91_ST_CRTR);
46 x2 = at91_sys_read(AT91_ST_CRTR); 46 x2 = at91_sys_read(AT91_ST_CRTR);
47 } while (x1 != x2); 47 if (x1 == x2)
48 48 break;
49 x1 = x2;
50 } while (1);
49 return x1; 51 return x1;
50} 52}
51 53
52/* 54/*
53 * Returns number of microseconds since last timer interrupt. Note that interrupts
54 * will have been disabled by do_gettimeofday()
55 * 'LATCH' is hwclock ticks (see CLOCK_TICK_RATE in timex.h) per jiffy.
56 * 'tick' is usecs per jiffy (linux/timex.h).
57 */
58static unsigned long at91rm9200_gettimeoffset(void)
59{
60 unsigned long elapsed;
61
62 elapsed = (read_CRTR() - last_crtr) & AT91_ST_ALMV;
63
64 return (unsigned long)(elapsed * (tick_nsec / 1000)) / LATCH;
65}
66
67/*
68 * IRQ handler for the timer. 55 * IRQ handler for the timer.
69 */ 56 */
70static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id) 57static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id)
71{ 58{
72 if (at91_sys_read(AT91_ST_SR) & AT91_ST_PITS) { /* This is a shared interrupt */ 59 u32 sr = at91_sys_read(AT91_ST_SR) & irqmask;
73 write_seqlock(&xtime_lock);
74 60
75 while (((read_CRTR() - last_crtr) & AT91_ST_ALMV) >= LATCH) { 61 /* simulate "oneshot" timer with alarm */
76 timer_tick(); 62 if (sr & AT91_ST_ALMS) {
77 last_crtr = (last_crtr + LATCH) & AT91_ST_ALMV; 63 clkevt.event_handler(&clkevt);
78 } 64 return IRQ_HANDLED;
65 }
79 66
80 write_sequnlock(&xtime_lock); 67 /* periodic mode should handle delayed ticks */
68 if (sr & AT91_ST_PITS) {
69 u32 crtr = read_CRTR();
81 70
71 while (((crtr - last_crtr) & AT91_ST_CRTV) >= LATCH) {
72 last_crtr += LATCH;
73 clkevt.event_handler(&clkevt);
74 }
82 return IRQ_HANDLED; 75 return IRQ_HANDLED;
83 } 76 }
84 else 77
85 return IRQ_NONE; /* not handled */ 78 /* this irq is shared ... */
79 return IRQ_NONE;
86} 80}
87 81
88static struct irqaction at91rm9200_timer_irq = { 82static struct irqaction at91rm9200_timer_irq = {
@@ -91,56 +85,127 @@ static struct irqaction at91rm9200_timer_irq = {
91 .handler = at91rm9200_timer_interrupt 85 .handler = at91rm9200_timer_interrupt
92}; 86};
93 87
94void at91rm9200_timer_reset(void) 88static cycle_t read_clk32k(void)
95{ 89{
96 last_crtr = 0; 90 return read_CRTR();
91}
97 92
98 /* Real time counter incremented every 30.51758 microseconds */ 93static struct clocksource clk32k = {
99 at91_sys_write(AT91_ST_RTMR, 1); 94 .name = "32k_counter",
95 .rating = 150,
96 .read = read_clk32k,
97 .mask = CLOCKSOURCE_MASK(20),
98 .shift = 10,
99 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
100};
101
102static void
103clkevt32k_mode(enum clock_event_mode mode, struct clock_event_device *dev)
104{
105 /* Disable and flush pending timer interrupts */
106 at91_sys_write(AT91_ST_IDR, AT91_ST_PITS | AT91_ST_ALMS);
107 (void) at91_sys_read(AT91_ST_SR);
100 108
101 /* Set Period Interval timer */ 109 last_crtr = read_CRTR();
102 at91_sys_write(AT91_ST_PIMR, LATCH); 110 switch (mode) {
111 case CLOCK_EVT_MODE_PERIODIC:
112 /* PIT for periodic irqs; fixed rate of 1/HZ */
113 irqmask = AT91_ST_PITS;
114 at91_sys_write(AT91_ST_PIMR, LATCH);
115 break;
116 case CLOCK_EVT_MODE_ONESHOT:
117 /* ALM for oneshot irqs, set by next_event()
118 * before 32 seconds have passed
119 */
120 irqmask = AT91_ST_ALMS;
121 at91_sys_write(AT91_ST_RTAR, last_crtr);
122 break;
123 case CLOCK_EVT_MODE_SHUTDOWN:
124 case CLOCK_EVT_MODE_UNUSED:
125 case CLOCK_EVT_MODE_RESUME:
126 irqmask = 0;
127 break;
128 }
129 at91_sys_write(AT91_ST_IER, irqmask);
130}
103 131
104 /* Clear any pending interrupts */ 132static int
133clkevt32k_next_event(unsigned long delta, struct clock_event_device *dev)
134{
135 unsigned long flags;
136 u32 alm;
137 int status = 0;
138
139 BUG_ON(delta < 2);
140
141 /* Use "raw" primitives so we behave correctly on RT kernels. */
142 raw_local_irq_save(flags);
143
144 /* The alarm IRQ uses absolute time (now+delta), not the relative
145 * time (delta) in our calling convention. Like all clockevents
146 * using such "match" hardware, we have a race to defend against.
147 *
148 * Our defense here is to have set up the clockevent device so the
149 * delta is at least two. That way we never end up writing RTAR
150 * with the value then held in CRTR ... which would mean the match
151 * wouldn't trigger until 32 seconds later, after CRTR wraps.
152 */
153 alm = read_CRTR();
154
155 /* Cancel any pending alarm; flush any pending IRQ */
156 at91_sys_write(AT91_ST_RTAR, alm);
105 (void) at91_sys_read(AT91_ST_SR); 157 (void) at91_sys_read(AT91_ST_SR);
106 158
107 /* Enable Period Interval Timer interrupt */ 159 /* Schedule alarm by writing RTAR. */
108 at91_sys_write(AT91_ST_IER, AT91_ST_PITS); 160 alm += delta;
161 at91_sys_write(AT91_ST_RTAR, alm);
162
163 raw_local_irq_restore(flags);
164 return status;
109} 165}
110 166
167static struct clock_event_device clkevt = {
168 .name = "at91_tick",
169 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
170 .shift = 32,
171 .rating = 150,
172 .cpumask = CPU_MASK_CPU0,
173 .set_next_event = clkevt32k_next_event,
174 .set_mode = clkevt32k_mode,
175};
176
111/* 177/*
112 * Set up timer interrupt. 178 * ST (system timer) module supports both clockevents and clocksource.
113 */ 179 */
114void __init at91rm9200_timer_init(void) 180void __init at91rm9200_timer_init(void)
115{ 181{
116 /* Disable all timer interrupts */ 182 /* Disable all timer interrupts, and clear any pending ones */
117 at91_sys_write(AT91_ST_IDR, AT91_ST_PITS | AT91_ST_WDOVF | AT91_ST_RTTINC | AT91_ST_ALMS); 183 at91_sys_write(AT91_ST_IDR,
118 (void) at91_sys_read(AT91_ST_SR); /* Clear any pending interrupts */ 184 AT91_ST_PITS | AT91_ST_WDOVF | AT91_ST_RTTINC | AT91_ST_ALMS);
185 (void) at91_sys_read(AT91_ST_SR);
119 186
120 /* Make IRQs happen for the system timer */ 187 /* Make IRQs happen for the system timer */
121 setup_irq(AT91_ID_SYS, &at91rm9200_timer_irq); 188 setup_irq(AT91_ID_SYS, &at91rm9200_timer_irq);
122 189
123 /* Change the kernel's 'tick' value to 10009 usec. (the default is 10000) */ 190 /* The 32KiHz "Slow Clock" (tick every 30517.58 nanoseconds) is used
124 tick_usec = (LATCH * 1000000) / CLOCK_TICK_RATE; 191 * directly for the clocksource and all clockevents, after adjusting
192 * its prescaler from the 1 Hz default.
193 */
194 at91_sys_write(AT91_ST_RTMR, 1);
125 195
126 /* Initialize and enable the timer interrupt */ 196 /* Setup timer clockevent, with minimum of two ticks (important!!) */
127 at91rm9200_timer_reset(); 197 clkevt.mult = div_sc(AT91_SLOW_CLOCK, NSEC_PER_SEC, clkevt.shift);
128} 198 clkevt.max_delta_ns = clockevent_delta2ns(AT91_ST_ALMV, &clkevt);
199 clkevt.min_delta_ns = clockevent_delta2ns(2, &clkevt) + 1;
200 clkevt.cpumask = cpumask_of_cpu(0);
201 clockevents_register_device(&clkevt);
129 202
130#ifdef CONFIG_PM 203 /* register clocksource */
131static void at91rm9200_timer_suspend(void) 204 clk32k.mult = clocksource_hz2mult(AT91_SLOW_CLOCK, clk32k.shift);
132{ 205 clocksource_register(&clk32k);
133 /* disable Period Interval Timer interrupt */
134 at91_sys_write(AT91_ST_IDR, AT91_ST_PITS);
135} 206}
136#else
137#define at91rm9200_timer_suspend NULL
138#endif
139 207
140struct sys_timer at91rm9200_timer = { 208struct sys_timer at91rm9200_timer = {
141 .init = at91rm9200_timer_init, 209 .init = at91rm9200_timer_init,
142 .offset = at91rm9200_gettimeoffset,
143 .suspend = at91rm9200_timer_suspend,
144 .resume = at91rm9200_timer_reset,
145}; 210};
146 211
diff --git a/arch/arm/mach-at91/at91x40.c b/arch/arm/mach-at91/at91x40.c
new file mode 100644
index 000000000000..1de121fc55f4
--- /dev/null
+++ b/arch/arm/mach-at91/at91x40.c
@@ -0,0 +1,67 @@
1/*
2 * arch/arm/mach-at91/at91x40.c
3 *
4 * (C) Copyright 2007, Greg Ungerer <gerg@snapgear.com>
5 * Copyright (C) 2005 SAN People
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/irq.h>
16#include <asm/mach/arch.h>
17#include <asm/arch/at91x40.h>
18#include <asm/arch/at91_st.h>
19#include "generic.h"
20
21/*
22 * This is used in the gpio code, stub locally.
23 */
24int clk_enable(struct clk *clk)
25{
26 return 0;
27}
28
29void __init at91x40_initialize(unsigned long main_clock)
30{
31 at91_extern_irq = (1 << AT91X40_ID_IRQ0) | (1 << AT91X40_ID_IRQ1)
32 | (1 << AT91X40_ID_IRQ2);
33}
34
35/*
36 * The default interrupt priority levels (0 = lowest, 7 = highest).
37 */
38static unsigned int at91x40_default_irq_priority[NR_AIC_IRQS] __initdata = {
39 7, /* Advanced Interrupt Controller (FIQ) */
40 0, /* System Peripherals */
41 0, /* USART 0 */
42 0, /* USART 1 */
43 2, /* Timer Counter 0 */
44 2, /* Timer Counter 1 */
45 2, /* Timer Counter 2 */
46 0, /* Watchdog timer */
47 0, /* Parallel IO Controller A */
48 0, /* Reserved */
49 0, /* Reserved */
50 0, /* Reserved */
51 0, /* Reserved */
52 0, /* Reserved */
53 0, /* Reserved */
54 0, /* Reserved */
55 0, /* External IRQ0 */
56 0, /* External IRQ1 */
57 0, /* External IRQ2 */
58};
59
60void __init at91x40_init_interrupts(unsigned int priority[NR_AIC_IRQS])
61{
62 if (!priority)
63 priority = at91x40_default_irq_priority;
64
65 at91_aic_init(priority);
66}
67
diff --git a/arch/arm/mach-at91/at91x40_time.c b/arch/arm/mach-at91/at91x40_time.c
new file mode 100644
index 000000000000..eddc882f1b4a
--- /dev/null
+++ b/arch/arm/mach-at91/at91x40_time.c
@@ -0,0 +1,80 @@
1/*
2 * arch/arm/mach-at91/at91x40_time.c
3 *
4 * (C) Copyright 2007, Greg Ungerer <gerg@snapgear.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/interrupt.h>
24#include <linux/irq.h>
25#include <linux/time.h>
26#include <asm/hardware.h>
27#include <asm/io.h>
28#include <asm/mach/time.h>
29#include <asm/arch/at91_tc.h>
30
31/*
32 * 3 counter/timer units present.
33 */
34#define AT91_TC_CLK0BASE 0
35#define AT91_TC_CLK1BASE 0x40
36#define AT91_TC_CLK2BASE 0x80
37
38static unsigned long at91x40_gettimeoffset(void)
39{
40 return (at91_sys_read(AT91_TC + AT91_TC_CLK1BASE + AT91_TC_CV) * 1000000 / (AT91X40_MASTER_CLOCK / 128));
41}
42
43static irqreturn_t at91x40_timer_interrupt(int irq, void *dev_id)
44{
45 at91_sys_read(AT91_TC + AT91_TC_CLK1BASE + AT91_TC_SR);
46 timer_tick();
47 return IRQ_HANDLED;
48}
49
50static struct irqaction at91x40_timer_irq = {
51 .name = "at91_tick",
52 .flags = IRQF_DISABLED | IRQF_TIMER,
53 .handler = at91x40_timer_interrupt
54};
55
56void __init at91x40_timer_init(void)
57{
58 unsigned int v;
59
60 at91_sys_write(AT91_TC + AT91_TC_BCR, 0);
61 v = at91_sys_read(AT91_TC + AT91_TC_BMR);
62 v = (v & ~AT91_TC_TC1XC1S) | AT91_TC_TC1XC1S_NONE;
63 at91_sys_write(AT91_TC + AT91_TC_BMR, v);
64
65 at91_sys_write(AT91_TC + AT91_TC_CLK1BASE + AT91_TC_CCR, AT91_TC_CLKDIS);
66 at91_sys_write(AT91_TC + AT91_TC_CLK1BASE + AT91_TC_CMR, (AT91_TC_TIMER_CLOCK4 | AT91_TC_CPCTRG));
67 at91_sys_write(AT91_TC + AT91_TC_CLK1BASE + AT91_TC_IDR, 0xffffffff);
68 at91_sys_write(AT91_TC + AT91_TC_CLK1BASE + AT91_TC_RC, (AT91X40_MASTER_CLOCK / 128) / HZ - 1);
69 at91_sys_write(AT91_TC + AT91_TC_CLK1BASE + AT91_TC_IER, (1<<4));
70
71 setup_irq(AT91X40_ID_TC1, &at91x40_timer_irq);
72
73 at91_sys_write(AT91_TC + AT91_TC_CLK1BASE + AT91_TC_CCR, (AT91_TC_SWTRG | AT91_TC_CLKEN));
74}
75
76struct sys_timer at91x40_timer = {
77 .init = at91x40_timer_init,
78 .offset = at91x40_gettimeoffset,
79};
80
diff --git a/arch/arm/mach-at91/board-eb01.c b/arch/arm/mach-at91/board-eb01.c
new file mode 100644
index 000000000000..0c1e3858e7df
--- /dev/null
+++ b/arch/arm/mach-at91/board-eb01.c
@@ -0,0 +1,44 @@
1/*
2 * arch/arm/mach-at91/board-eb01.c
3 *
4 * (C) Copyright 2007, Greg Ungerer <gerg@snapgear.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/module.h>
24#include <linux/platform_device.h>
25#include <linux/irq.h>
26#include <asm/mach-types.h>
27#include <asm/hardware.h>
28#include <asm/mach/arch.h>
29#include <asm/mach/map.h>
30#include <asm/arch/board.h>
31#include "generic.h"
32
33static void __init at91eb01_map_io(void)
34{
35 at91x40_initialize(40000000);
36}
37
38MACHINE_START(AT91EB01, "Atmel AT91 EB01")
39 /* Maintainer: Greg Ungerer <gerg@snapgear.com> */
40 .timer = &at91x40_timer,
41 .init_irq = at91x40_init_interrupts,
42 .map_io = at91eb01_map_io,
43MACHINE_END
44
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index 68ed71a3e6c6..77d4c0a37842 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -14,6 +14,7 @@ extern void __init at91sam9260_initialize(unsigned long main_clock);
14extern void __init at91sam9261_initialize(unsigned long main_clock); 14extern void __init at91sam9261_initialize(unsigned long main_clock);
15extern void __init at91sam9263_initialize(unsigned long main_clock); 15extern void __init at91sam9263_initialize(unsigned long main_clock);
16extern void __init at91sam9rl_initialize(unsigned long main_clock); 16extern void __init at91sam9rl_initialize(unsigned long main_clock);
17extern void __init at91x40_initialize(unsigned long main_clock);
17 18
18 /* Interrupts */ 19 /* Interrupts */
19extern void __init at91rm9200_init_interrupts(unsigned int priority[]); 20extern void __init at91rm9200_init_interrupts(unsigned int priority[]);
@@ -21,12 +22,14 @@ extern void __init at91sam9260_init_interrupts(unsigned int priority[]);
21extern void __init at91sam9261_init_interrupts(unsigned int priority[]); 22extern void __init at91sam9261_init_interrupts(unsigned int priority[]);
22extern void __init at91sam9263_init_interrupts(unsigned int priority[]); 23extern void __init at91sam9263_init_interrupts(unsigned int priority[]);
23extern void __init at91sam9rl_init_interrupts(unsigned int priority[]); 24extern void __init at91sam9rl_init_interrupts(unsigned int priority[]);
25extern void __init at91x40_init_interrupts(unsigned int priority[]);
24extern void __init at91_aic_init(unsigned int priority[]); 26extern void __init at91_aic_init(unsigned int priority[]);
25 27
26 /* Timer */ 28 /* Timer */
27struct sys_timer; 29struct sys_timer;
28extern struct sys_timer at91rm9200_timer; 30extern struct sys_timer at91rm9200_timer;
29extern struct sys_timer at91sam926x_timer; 31extern struct sys_timer at91sam926x_timer;
32extern struct sys_timer at91x40_timer;
30 33
31 /* Clocks */ 34 /* Clocks */
32extern int __init at91_clock_init(unsigned long main_clock); 35extern int __init at91_clock_init(unsigned long main_clock);
diff --git a/arch/arm/mach-clps7500/core.c b/arch/arm/mach-clps7500/core.c
index 4dde34f25e63..986205ec9269 100644
--- a/arch/arm/mach-clps7500/core.c
+++ b/arch/arm/mach-clps7500/core.c
@@ -193,7 +193,11 @@ static struct irq_chip clps7500_no_chip = {
193 .unmask = cl7500_no_action, 193 .unmask = cl7500_no_action,
194}; 194};
195 195
196static struct irqaction irq_isa = { no_action, 0, CPU_MASK_NONE, "isa", NULL, NULL }; 196static struct irqaction irq_isa = {
197 .handler = no_action,
198 .mask = CPU_MASK_NONE,
199 .name = "isa",
200};
197 201
198static void __init clps7500_init_irq(void) 202static void __init clps7500_init_irq(void)
199{ 203{
diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig
index 575a21dabd2f..ea8549bfbef2 100644
--- a/arch/arm/mach-ep93xx/Kconfig
+++ b/arch/arm/mach-ep93xx/Kconfig
@@ -27,6 +27,12 @@ config MACH_EDB9302A
27 Say 'Y' here if you want your kernel to support the Cirrus 27 Say 'Y' here if you want your kernel to support the Cirrus
28 Logic EDB9302A Evaluation Board. 28 Logic EDB9302A Evaluation Board.
29 29
30config MACH_EDB9307
31 bool "Support Cirrus Logic EDB9307"
32 help
33 Say 'Y' here if you want your kernel to support the Cirrus
34 Logic EDB9307 Evaluation Board.
35
30config MACH_EDB9312 36config MACH_EDB9312
31 bool "Support Cirrus Logic EDB9312" 37 bool "Support Cirrus Logic EDB9312"
32 help 38 help
diff --git a/arch/arm/mach-ep93xx/Makefile b/arch/arm/mach-ep93xx/Makefile
index 0d3bf932654e..0ecf99761feb 100644
--- a/arch/arm/mach-ep93xx/Makefile
+++ b/arch/arm/mach-ep93xx/Makefile
@@ -9,6 +9,7 @@ obj- :=
9obj-$(CONFIG_MACH_ADSSPHERE) += adssphere.o 9obj-$(CONFIG_MACH_ADSSPHERE) += adssphere.o
10obj-$(CONFIG_MACH_EDB9302) += edb9302.o 10obj-$(CONFIG_MACH_EDB9302) += edb9302.o
11obj-$(CONFIG_MACH_EDB9302A) += edb9302a.o 11obj-$(CONFIG_MACH_EDB9302A) += edb9302a.o
12obj-$(CONFIG_MACH_EDB9307) += edb9307.o
12obj-$(CONFIG_MACH_EDB9312) += edb9312.o 13obj-$(CONFIG_MACH_EDB9312) += edb9312.o
13obj-$(CONFIG_MACH_EDB9315) += edb9315.o 14obj-$(CONFIG_MACH_EDB9315) += edb9315.o
14obj-$(CONFIG_MACH_EDB9315A) += edb9315a.o 15obj-$(CONFIG_MACH_EDB9315A) += edb9315a.o
diff --git a/arch/arm/mach-ep93xx/edb9307.c b/arch/arm/mach-ep93xx/edb9307.c
new file mode 100644
index 000000000000..d6a5698da91f
--- /dev/null
+++ b/arch/arm/mach-ep93xx/edb9307.c
@@ -0,0 +1,91 @@
1/*
2 * arch/arm/mach-ep93xx/edb9307.c
3 * Cirrus Logic EDB9307 support.
4 *
5 * Copyright (C) 2007 Herbert Valerio Riedel <hvr@gnu.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or (at
10 * your option) any later version.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/mm.h>
16#include <linux/sched.h>
17#include <linux/interrupt.h>
18#include <linux/ioport.h>
19#include <linux/mtd/physmap.h>
20#include <linux/platform_device.h>
21#include <asm/io.h>
22#include <asm/hardware.h>
23#include <asm/mach-types.h>
24#include <asm/mach/arch.h>
25
26static struct physmap_flash_data edb9307_flash_data = {
27 .width = 4,
28};
29
30static struct resource edb9307_flash_resource = {
31 .start = 0x60000000,
32 .end = 0x61ffffff,
33 .flags = IORESOURCE_MEM,
34};
35
36static struct platform_device edb9307_flash = {
37 .name = "physmap-flash",
38 .id = 0,
39 .dev = {
40 .platform_data = &edb9307_flash_data,
41 },
42 .num_resources = 1,
43 .resource = &edb9307_flash_resource,
44};
45
46static struct ep93xx_eth_data edb9307_eth_data = {
47 .phy_id = 1,
48};
49
50static struct resource edb9307_eth_resource[] = {
51 {
52 .start = EP93XX_ETHERNET_PHYS_BASE,
53 .end = EP93XX_ETHERNET_PHYS_BASE + 0xffff,
54 .flags = IORESOURCE_MEM,
55 }, {
56 .start = IRQ_EP93XX_ETHERNET,
57 .end = IRQ_EP93XX_ETHERNET,
58 .flags = IORESOURCE_IRQ,
59 }
60};
61
62static struct platform_device edb9307_eth_device = {
63 .name = "ep93xx-eth",
64 .id = -1,
65 .dev = {
66 .platform_data = &edb9307_eth_data,
67 },
68 .num_resources = 2,
69 .resource = edb9307_eth_resource,
70};
71
72static void __init edb9307_init_machine(void)
73{
74 ep93xx_init_devices();
75 platform_device_register(&edb9307_flash);
76
77 memcpy(edb9307_eth_data.dev_addr,
78 (void *)(EP93XX_ETHERNET_BASE + 0x50), 6);
79 platform_device_register(&edb9307_eth_device);
80}
81
82MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board")
83 /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */
84 .phys_io = EP93XX_APB_PHYS_BASE,
85 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
86 .boot_params = 0x00000100,
87 .map_io = ep93xx_map_io,
88 .init_irq = ep93xx_init_irq,
89 .timer = &ep93xx_timer,
90 .init_machine = edb9307_init_machine,
91MACHINE_END
diff --git a/arch/arm/mach-footbridge/isa.c b/arch/arm/mach-footbridge/isa.c
index 28846c7edaaf..725a219d0ed5 100644
--- a/arch/arm/mach-footbridge/isa.c
+++ b/arch/arm/mach-footbridge/isa.c
@@ -12,6 +12,39 @@
12 12
13#include <asm/irq.h> 13#include <asm/irq.h>
14 14
15static struct resource rtc_resources[] = {
16 [0] = {
17 .start = 0x70,
18 .end = 0x73,
19 .flags = IORESOURCE_IO,
20 },
21 [1] = {
22 .start = IRQ_ISA_RTC_ALARM,
23 .end = IRQ_ISA_RTC_ALARM,
24 .flags = IORESOURCE_IRQ,
25 }
26};
27
28static struct platform_device rtc_device = {
29 .name = "rtc_cmos",
30 .id = -1,
31 .resource = rtc_resources,
32 .num_resources = ARRAY_SIZE(rtc_resources),
33};
34
35static struct resource serial_resources[] = {
36 [0] = {
37 .start = 0x3f8,
38 .end = 0x3ff,
39 .flags = IORESOURCE_IO,
40 },
41 [1] = {
42 .start = 0x2f8,
43 .end = 0x2ff,
44 .flags = IORESOURCE_IO,
45 },
46};
47
15static struct plat_serial8250_port serial_platform_data[] = { 48static struct plat_serial8250_port serial_platform_data[] = {
16 { 49 {
17 .iobase = 0x3f8, 50 .iobase = 0x3f8,
@@ -38,11 +71,21 @@ static struct platform_device serial_device = {
38 .dev = { 71 .dev = {
39 .platform_data = serial_platform_data, 72 .platform_data = serial_platform_data,
40 }, 73 },
74 .resource = serial_resources,
75 .num_resources = ARRAY_SIZE(serial_resources),
41}; 76};
42 77
43static int __init footbridge_isa_init(void) 78static int __init footbridge_isa_init(void)
44{ 79{
45 return platform_device_register(&serial_device); 80 int err;
81
82 err = platform_device_register(&rtc_device);
83 if (err)
84 printk(KERN_ERR "Unable to register RTC device: %d\n", err);
85 err = platform_device_register(&serial_device);
86 if (err)
87 printk(KERN_ERR "Unable to register serial device: %d\n", err);
88 return 0;
46} 89}
47 90
48arch_initcall(footbridge_isa_init); 91arch_initcall(footbridge_isa_init);
diff --git a/arch/arm/mach-imx/cpufreq.c b/arch/arm/mach-imx/cpufreq.c
index 467d899fbe75..e548ba74a4d2 100644
--- a/arch/arm/mach-imx/cpufreq.c
+++ b/arch/arm/mach-imx/cpufreq.c
@@ -269,7 +269,6 @@ static int __init imx_cpufreq_driver_init(struct cpufreq_policy *policy)
269 return -EINVAL; 269 return -EINVAL;
270 270
271 policy->cur = policy->min = policy->max = imx_get_speed(0); 271 policy->cur = policy->min = policy->max = imx_get_speed(0);
272 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
273 policy->cpuinfo.min_freq = 8000; 272 policy->cpuinfo.min_freq = 8000;
274 policy->cpuinfo.max_freq = 200000; 273 policy->cpuinfo.max_freq = 200000;
275 /* Manual states, that PLL stabilizes in two CLK32 periods */ 274 /* Manual states, that PLL stabilizes in two CLK32 periods */
diff --git a/arch/arm/mach-ns9xxx/Makefile b/arch/arm/mach-ns9xxx/Makefile
index 4476411b8140..6fb82b855a55 100644
--- a/arch/arm/mach-ns9xxx/Makefile
+++ b/arch/arm/mach-ns9xxx/Makefile
@@ -1,4 +1,4 @@
1obj-y := irq.o time.o generic.o 1obj-y := irq.o time.o generic.o gpio.o
2 2
3obj-$(CONFIG_MACH_CC9P9360DEV) += mach-cc9p9360dev.o 3obj-$(CONFIG_MACH_CC9P9360DEV) += mach-cc9p9360dev.o
4obj-$(CONFIG_MACH_CC9P9360JS) += mach-cc9p9360js.o 4obj-$(CONFIG_MACH_CC9P9360JS) += mach-cc9p9360js.o
diff --git a/arch/arm/mach-ns9xxx/board-a9m9750dev.c b/arch/arm/mach-ns9xxx/board-a9m9750dev.c
index 925048e7adfe..0f65177f9e5f 100644
--- a/arch/arm/mach-ns9xxx/board-a9m9750dev.c
+++ b/arch/arm/mach-ns9xxx/board-a9m9750dev.c
@@ -13,6 +13,7 @@
13#include <linux/irq.h> 13#include <linux/irq.h>
14 14
15#include <asm/mach/map.h> 15#include <asm/mach/map.h>
16#include <asm/gpio.h>
16 17
17#include <asm/arch-ns9xxx/board.h> 18#include <asm/arch-ns9xxx/board.h>
18#include <asm/arch-ns9xxx/regs-sys.h> 19#include <asm/arch-ns9xxx/regs-sys.h>
@@ -44,7 +45,13 @@ static void a9m9750dev_fpga_ack_irq(unsigned int irq)
44 45
45static void a9m9750dev_fpga_mask_irq(unsigned int irq) 46static void a9m9750dev_fpga_mask_irq(unsigned int irq)
46{ 47{
47 FPGA_IER &= ~(1 << (irq - FPGA_IRQ(0))); 48 u8 ier;
49
50 ier = __raw_readb(FPGA_IER);
51
52 ier &= ~(1 << (irq - FPGA_IRQ(0)));
53
54 __raw_writeb(ier, FPGA_IER);
48} 55}
49 56
50static void a9m9750dev_fpga_maskack_irq(unsigned int irq) 57static void a9m9750dev_fpga_maskack_irq(unsigned int irq)
@@ -55,7 +62,13 @@ static void a9m9750dev_fpga_maskack_irq(unsigned int irq)
55 62
56static void a9m9750dev_fpga_unmask_irq(unsigned int irq) 63static void a9m9750dev_fpga_unmask_irq(unsigned int irq)
57{ 64{
58 FPGA_IER |= 1 << (irq - FPGA_IRQ(0)); 65 u8 ier;
66
67 ier = __raw_readb(FPGA_IER);
68
69 ier |= 1 << (irq - FPGA_IRQ(0));
70
71 __raw_writeb(ier, FPGA_IER);
59} 72}
60 73
61static struct irq_chip a9m9750dev_fpga_chip = { 74static struct irq_chip a9m9750dev_fpga_chip = {
@@ -68,30 +81,34 @@ static struct irq_chip a9m9750dev_fpga_chip = {
68static void a9m9750dev_fpga_demux_handler(unsigned int irq, 81static void a9m9750dev_fpga_demux_handler(unsigned int irq,
69 struct irq_desc *desc) 82 struct irq_desc *desc)
70{ 83{
71 int stat = FPGA_ISR; 84 u8 stat = __raw_readb(FPGA_ISR);
85
86 desc->chip->mask_ack(irq);
72 87
73 while (stat != 0) { 88 while (stat != 0) {
74 int irqno = fls(stat) - 1; 89 int irqno = fls(stat) - 1;
90 struct irq_desc *fpgadesc;
75 91
76 stat &= ~(1 << irqno); 92 stat &= ~(1 << irqno);
77 93
78 desc = irq_desc + FPGA_IRQ(irqno); 94 fpgadesc = irq_desc + FPGA_IRQ(irqno);
79 95
80 desc_handle_irq(FPGA_IRQ(irqno), desc); 96 desc_handle_irq(FPGA_IRQ(irqno), fpgadesc);
81 } 97 }
98
99 desc->chip->unmask(irq);
82} 100}
83 101
84void __init board_a9m9750dev_init_irq(void) 102void __init board_a9m9750dev_init_irq(void)
85{ 103{
86 u32 reg; 104 u32 eic;
87 int i; 105 int i;
88 106
89 /* 107 if (gpio_request(11, "board a9m9750dev extirq2") == 0)
90 * configure gpio for IRQ_EXT2 108 ns9xxx_gpio_configure(11, 0, 1);
91 * use GPIO 11, because GPIO 32 is used for the LCD 109 else
92 */ 110 printk(KERN_ERR "%s: cannot get gpio 11 for IRQ_EXT2\n",
93 /* XXX: proper GPIO handling */ 111 __func__);
94 BBU_GCONFb1(1) &= ~0x2000;
95 112
96 for (i = FPGA_IRQ(0); i <= FPGA_IRQ(7); ++i) { 113 for (i = FPGA_IRQ(0); i <= FPGA_IRQ(7); ++i) {
97 set_irq_chip(i, &a9m9750dev_fpga_chip); 114 set_irq_chip(i, &a9m9750dev_fpga_chip);
@@ -100,10 +117,10 @@ void __init board_a9m9750dev_init_irq(void)
100 } 117 }
101 118
102 /* IRQ_EXT2: level sensitive + active low */ 119 /* IRQ_EXT2: level sensitive + active low */
103 reg = SYS_EIC(2); 120 eic = __raw_readl(SYS_EIC(2));
104 REGSET(reg, SYS_EIC, PLTY, AL); 121 REGSET(eic, SYS_EIC, PLTY, AL);
105 REGSET(reg, SYS_EIC, LVEDG, LEVEL); 122 REGSET(eic, SYS_EIC, LVEDG, LEVEL);
106 SYS_EIC(2) = reg; 123 __raw_writel(eic, SYS_EIC(2));
107 124
108 set_irq_chained_handler(IRQ_EXT2, 125 set_irq_chained_handler(IRQ_EXT2,
109 a9m9750dev_fpga_demux_handler); 126 a9m9750dev_fpga_demux_handler);
@@ -167,17 +184,18 @@ void __init board_a9m9750dev_init_machine(void)
167 u32 reg; 184 u32 reg;
168 185
169 /* setup static CS0: memory base ... */ 186 /* setup static CS0: memory base ... */
170 REGSETIM(SYS_SMCSSMB(0), SYS_SMCSSMB, CSxB, 187 reg = __raw_readl(SYS_SMCSSMB(0));
171 NS9XXX_CSxSTAT_PHYS(0) >> 12); 188 REGSETIM(reg, SYS_SMCSSMB, CSxB, NS9XXX_CSxSTAT_PHYS(0) >> 12);
189 __raw_writel(reg, SYS_SMCSSMB(0));
172 190
173 /* ... and mask */ 191 /* ... and mask */
174 reg = SYS_SMCSSMM(0); 192 reg = __raw_readl(SYS_SMCSSMM(0));
175 REGSETIM(reg, SYS_SMCSSMM, CSxM, 0xfffff); 193 REGSETIM(reg, SYS_SMCSSMM, CSxM, 0xfffff);
176 REGSET(reg, SYS_SMCSSMM, CSEx, EN); 194 REGSET(reg, SYS_SMCSSMM, CSEx, EN);
177 SYS_SMCSSMM(0) = reg; 195 __raw_writel(reg, SYS_SMCSSMM(0));
178 196
179 /* setup static CS0: memory configuration */ 197 /* setup static CS0: memory configuration */
180 reg = MEM_SMC(0); 198 reg = __raw_readl(MEM_SMC(0));
181 REGSET(reg, MEM_SMC, PSMC, OFF); 199 REGSET(reg, MEM_SMC, PSMC, OFF);
182 REGSET(reg, MEM_SMC, BSMC, OFF); 200 REGSET(reg, MEM_SMC, BSMC, OFF);
183 REGSET(reg, MEM_SMC, EW, OFF); 201 REGSET(reg, MEM_SMC, EW, OFF);
@@ -185,13 +203,13 @@ void __init board_a9m9750dev_init_machine(void)
185 REGSET(reg, MEM_SMC, PC, AL); 203 REGSET(reg, MEM_SMC, PC, AL);
186 REGSET(reg, MEM_SMC, PM, DIS); 204 REGSET(reg, MEM_SMC, PM, DIS);
187 REGSET(reg, MEM_SMC, MW, 8); 205 REGSET(reg, MEM_SMC, MW, 8);
188 MEM_SMC(0) = reg; 206 __raw_writel(reg, MEM_SMC(0));
189 207
190 /* setup static CS0: timing */ 208 /* setup static CS0: timing */
191 MEM_SMWED(0) = 0x2; 209 __raw_writel(0x2, MEM_SMWED(0));
192 MEM_SMOED(0) = 0x2; 210 __raw_writel(0x2, MEM_SMOED(0));
193 MEM_SMRD(0) = 0x6; 211 __raw_writel(0x6, MEM_SMRD(0));
194 MEM_SMWD(0) = 0x6; 212 __raw_writel(0x6, MEM_SMWD(0));
195 213
196 platform_add_devices(board_a9m9750dev_devices, 214 platform_add_devices(board_a9m9750dev_devices,
197 ARRAY_SIZE(board_a9m9750dev_devices)); 215 ARRAY_SIZE(board_a9m9750dev_devices));
diff --git a/arch/arm/mach-ns9xxx/gpio.c b/arch/arm/mach-ns9xxx/gpio.c
new file mode 100644
index 000000000000..b2230213b983
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/gpio.c
@@ -0,0 +1,190 @@
1/*
2 * arch/arm/mach-ns9xxx/gpio.c
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#include <linux/compiler.h>
12#include <linux/init.h>
13#include <linux/spinlock.h>
14#include <linux/module.h>
15
16#include <asm/arch-ns9xxx/gpio.h>
17#include <asm/arch-ns9xxx/processor.h>
18#include <asm/arch-ns9xxx/regs-bbu.h>
19#include <asm/io.h>
20#include <asm/bug.h>
21#include <asm/types.h>
22#include <asm/bitops.h>
23
24#if defined(CONFIG_PROCESSOR_NS9360)
25#define GPIO_MAX 72
26#elif defined(CONFIG_PROCESSOR_NS9750)
27#define GPIO_MAX 49
28#endif
29
30/* protects BBU_GCONFx and BBU_GCTRLx */
31static spinlock_t gpio_lock = __SPIN_LOCK_UNLOCKED(gpio_lock);
32
33/* only access gpiores with atomic ops */
34static DECLARE_BITMAP(gpiores, GPIO_MAX);
35
36static inline int ns9xxx_valid_gpio(unsigned gpio)
37{
38#if defined(CONFIG_PROCESSOR_NS9360)
39 if (processor_is_ns9360())
40 return gpio <= 72;
41 else
42#endif
43#if defined(CONFIG_PROCESSOR_NS9750)
44 if (processor_is_ns9750())
45 return gpio <= 49;
46 else
47#endif
48 BUG();
49}
50
51static inline void __iomem *ns9xxx_gpio_get_gconfaddr(unsigned gpio)
52{
53 if (gpio < 56)
54 return BBU_GCONFb1(gpio / 8);
55 else
56 /*
57 * this could be optimised away on
58 * ns9750 only builds, but it isn't ...
59 */
60 return BBU_GCONFb2((gpio - 56) / 8);
61}
62
63static inline void __iomem *ns9xxx_gpio_get_gctrladdr(unsigned gpio)
64{
65 if (gpio < 32)
66 return BBU_GCTRL1;
67 else if (gpio < 64)
68 return BBU_GCTRL2;
69 else
70 /* this could be optimised away on ns9750 only builds */
71 return BBU_GCTRL3;
72}
73
74static inline void __iomem *ns9xxx_gpio_get_gstataddr(unsigned gpio)
75{
76 if (gpio < 32)
77 return BBU_GSTAT1;
78 else if (gpio < 64)
79 return BBU_GSTAT2;
80 else
81 /* this could be optimised away on ns9750 only builds */
82 return BBU_GSTAT3;
83}
84
85int gpio_request(unsigned gpio, const char *label)
86{
87 if (likely(ns9xxx_valid_gpio(gpio)))
88 return test_and_set_bit(gpio, gpiores) ? -EBUSY : 0;
89 else
90 return -EINVAL;
91}
92EXPORT_SYMBOL(gpio_request);
93
94void gpio_free(unsigned gpio)
95{
96 clear_bit(gpio, gpiores);
97 return;
98}
99EXPORT_SYMBOL(gpio_free);
100
101/*
102 * each gpio can serve for 4 different purposes [0..3]. These are called
103 * "functions" and passed in the parameter func. Functions 0-2 are always some
104 * special things, function 3 is GPIO. If func == 3 dir specifies input or
105 * output, and with inv you can enable an inverter (independent of func).
106 */
107static int __ns9xxx_gpio_configure(unsigned gpio, int dir, int inv, int func)
108{
109 void __iomem *conf = ns9xxx_gpio_get_gconfaddr(gpio);
110 u32 confval;
111 unsigned long flags;
112
113 spin_lock_irqsave(&gpio_lock, flags);
114
115 confval = __raw_readl(conf);
116 REGSETIM_IDX(confval, BBU_GCONFx, DIR, gpio & 7, dir);
117 REGSETIM_IDX(confval, BBU_GCONFx, INV, gpio & 7, inv);
118 REGSETIM_IDX(confval, BBU_GCONFx, FUNC, gpio & 7, func);
119 __raw_writel(confval, conf);
120
121 spin_unlock_irqrestore(&gpio_lock, flags);
122
123 return 0;
124}
125
126int ns9xxx_gpio_configure(unsigned gpio, int inv, int func)
127{
128 if (likely(ns9xxx_valid_gpio(gpio))) {
129 if (func == 3) {
130 printk(KERN_WARNING "use gpio_direction_input "
131 "or gpio_direction_output\n");
132 return -EINVAL;
133 } else
134 return __ns9xxx_gpio_configure(gpio, 0, inv, func);
135 } else
136 return -EINVAL;
137}
138EXPORT_SYMBOL(ns9xxx_gpio_configure);
139
140int gpio_direction_input(unsigned gpio)
141{
142 if (likely(ns9xxx_valid_gpio(gpio))) {
143 return __ns9xxx_gpio_configure(gpio, 0, 0, 3);
144 } else
145 return -EINVAL;
146}
147EXPORT_SYMBOL(gpio_direction_input);
148
149int gpio_direction_output(unsigned gpio, int value)
150{
151 if (likely(ns9xxx_valid_gpio(gpio))) {
152 gpio_set_value(gpio, value);
153
154 return __ns9xxx_gpio_configure(gpio, 1, 0, 3);
155 } else
156 return -EINVAL;
157}
158EXPORT_SYMBOL(gpio_direction_output);
159
160int gpio_get_value(unsigned gpio)
161{
162 void __iomem *stat = ns9xxx_gpio_get_gstataddr(gpio);
163 int ret;
164
165 ret = 1 & (__raw_readl(stat) >> (gpio & 31));
166
167 return ret;
168}
169EXPORT_SYMBOL(gpio_get_value);
170
171void gpio_set_value(unsigned gpio, int value)
172{
173 void __iomem *ctrl = ns9xxx_gpio_get_gctrladdr(gpio);
174 u32 ctrlval;
175 unsigned long flags;
176
177 spin_lock_irqsave(&gpio_lock, flags);
178
179 ctrlval = __raw_readl(ctrl);
180
181 if (value)
182 ctrlval |= 1 << (gpio & 31);
183 else
184 ctrlval &= ~(1 << (gpio & 31));
185
186 __raw_writel(ctrlval, ctrl);
187
188 spin_unlock_irqrestore(&gpio_lock, flags);
189}
190EXPORT_SYMBOL(gpio_set_value);
diff --git a/arch/arm/mach-ns9xxx/irq.c b/arch/arm/mach-ns9xxx/irq.c
index b8c7b00522e6..00001b874e97 100644
--- a/arch/arm/mach-ns9xxx/irq.c
+++ b/arch/arm/mach-ns9xxx/irq.c
@@ -9,6 +9,7 @@
9 * the Free Software Foundation. 9 * the Free Software Foundation.
10 */ 10 */
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <asm/io.h>
12#include <asm/mach/irq.h> 13#include <asm/mach/irq.h>
13#include <asm/mach-types.h> 14#include <asm/mach-types.h>
14#include <asm/arch-ns9xxx/regs-sys.h> 15#include <asm/arch-ns9xxx/regs-sys.h>
@@ -17,48 +18,17 @@
17 18
18#include "generic.h" 19#include "generic.h"
19 20
20static void ns9xxx_ack_irq_timer(unsigned int irq)
21{
22 u32 tc = SYS_TC(irq - IRQ_TIMER0);
23
24 /*
25 * If the timer is programmed to halt on terminal count, the
26 * timer must be disabled before clearing the interrupt.
27 */
28 if (REGGET(tc, SYS_TCx, REN) == 0) {
29 REGSET(tc, SYS_TCx, TEN, DIS);
30 SYS_TC(irq - IRQ_TIMER0) = tc;
31 }
32
33 REGSET(tc, SYS_TCx, INTC, SET);
34 SYS_TC(irq - IRQ_TIMER0) = tc;
35
36 REGSET(tc, SYS_TCx, INTC, UNSET);
37 SYS_TC(irq - IRQ_TIMER0) = tc;
38}
39
40static void (*ns9xxx_ack_irq_functions[NR_IRQS])(unsigned int) = {
41 [IRQ_TIMER0] = ns9xxx_ack_irq_timer,
42 [IRQ_TIMER1] = ns9xxx_ack_irq_timer,
43 [IRQ_TIMER2] = ns9xxx_ack_irq_timer,
44 [IRQ_TIMER3] = ns9xxx_ack_irq_timer,
45};
46
47static void ns9xxx_mask_irq(unsigned int irq) 21static void ns9xxx_mask_irq(unsigned int irq)
48{ 22{
49 /* XXX: better use cpp symbols */ 23 /* XXX: better use cpp symbols */
50 SYS_IC(irq / 4) &= ~(1 << (7 + 8 * (3 - (irq & 3)))); 24 u32 ic = __raw_readl(SYS_IC(irq / 4));
25 ic &= ~(1 << (7 + 8 * (3 - (irq & 3))));
26 __raw_writel(ic, SYS_IC(irq / 4));
51} 27}
52 28
53static void ns9xxx_ack_irq(unsigned int irq) 29static void ns9xxx_ack_irq(unsigned int irq)
54{ 30{
55 if (!ns9xxx_ack_irq_functions[irq]) { 31 __raw_writel(0, SYS_ISRADDR);
56 printk(KERN_ERR "no ack function for irq %u\n", irq);
57 BUG();
58 }
59
60 ns9xxx_ack_irq_functions[irq](irq);
61 SYS_ISRADDR = 0;
62} 32}
63 33
64static void ns9xxx_maskack_irq(unsigned int irq) 34static void ns9xxx_maskack_irq(unsigned int irq)
@@ -70,7 +40,9 @@ static void ns9xxx_maskack_irq(unsigned int irq)
70static void ns9xxx_unmask_irq(unsigned int irq) 40static void ns9xxx_unmask_irq(unsigned int irq)
71{ 41{
72 /* XXX: better use cpp symbols */ 42 /* XXX: better use cpp symbols */
73 SYS_IC(irq / 4) |= 1 << (7 + 8 * (3 - (irq & 3))); 43 u32 ic = __raw_readl(SYS_IC(irq / 4));
44 ic |= 1 << (7 + 8 * (3 - (irq & 3)));
45 __raw_writel(ic, SYS_IC(irq / 4));
74} 46}
75 47
76static struct irq_chip ns9xxx_chip = { 48static struct irq_chip ns9xxx_chip = {
@@ -86,14 +58,14 @@ void __init ns9xxx_init_irq(void)
86 58
87 /* disable all IRQs */ 59 /* disable all IRQs */
88 for (i = 0; i < 8; ++i) 60 for (i = 0; i < 8; ++i)
89 SYS_IC(i) = (4 * i) << 24 | (4 * i + 1) << 16 | 61 __raw_writel((4 * i) << 24 | (4 * i + 1) << 16 |
90 (4 * i + 2) << 8 | (4 * i + 3); 62 (4 * i + 2) << 8 | (4 * i + 3), SYS_IC(i));
91 63
92 /* simple interrupt prio table: 64 /* simple interrupt prio table:
93 * prio(x) < prio(y) <=> x < y 65 * prio(x) < prio(y) <=> x < y
94 */ 66 */
95 for (i = 0; i < 32; ++i) 67 for (i = 0; i < 32; ++i)
96 SYS_IVA(i) = i; 68 __raw_writel(i, SYS_IVA(i));
97 69
98 for (i = IRQ_WATCHDOG; i <= IRQ_EXT3; ++i) { 70 for (i = IRQ_WATCHDOG; i <= IRQ_EXT3; ++i) {
99 set_irq_chip(i, &ns9xxx_chip); 71 set_irq_chip(i, &ns9xxx_chip);
diff --git a/arch/arm/mach-ns9xxx/time.c b/arch/arm/mach-ns9xxx/time.c
index b97d0c54a388..c3dd1f4acb99 100644
--- a/arch/arm/mach-ns9xxx/time.c
+++ b/arch/arm/mach-ns9xxx/time.c
@@ -11,78 +11,174 @@
11#include <linux/jiffies.h> 11#include <linux/jiffies.h>
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/stringify.h>
15#include <linux/clocksource.h>
16#include <linux/clockchips.h>
17
14#include <asm/arch-ns9xxx/regs-sys.h> 18#include <asm/arch-ns9xxx/regs-sys.h>
15#include <asm/arch-ns9xxx/clock.h> 19#include <asm/arch-ns9xxx/clock.h>
16#include <asm/arch-ns9xxx/irqs.h> 20#include <asm/arch-ns9xxx/irqs.h>
17#include <asm/arch/system.h> 21#include <asm/arch/system.h>
18#include "generic.h" 22#include "generic.h"
19 23
20#define TIMERCLOCKSELECT 64 24#define TIMER_CLOCKSOURCE 0
25#define TIMER_CLOCKEVENT 1
26static u32 latch;
27
28static cycle_t ns9xxx_clocksource_read(void)
29{
30 return __raw_readl(SYS_TR(TIMER_CLOCKSOURCE));
31}
21 32
22static u32 usecs_per_tick; 33static struct clocksource ns9xxx_clocksource = {
34 .name = "ns9xxx-timer" __stringify(TIMER_CLOCKSOURCE),
35 .rating = 300,
36 .read = ns9xxx_clocksource_read,
37 .mask = CLOCKSOURCE_MASK(32),
38 .shift = 20,
39 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
40};
23 41
24static irqreturn_t 42static void ns9xxx_clockevent_setmode(enum clock_event_mode mode,
25ns9xxx_timer_interrupt(int irq, void *dev_id) 43 struct clock_event_device *clk)
26{ 44{
27 write_seqlock(&xtime_lock); 45 u32 tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT));
28 timer_tick(); 46
29 write_sequnlock(&xtime_lock); 47 switch(mode) {
48 case CLOCK_EVT_MODE_PERIODIC:
49 __raw_writel(latch, SYS_TRC(TIMER_CLOCKEVENT));
50 REGSET(tc, SYS_TCx, REN, EN);
51 REGSET(tc, SYS_TCx, INTS, EN);
52 REGSET(tc, SYS_TCx, TEN, EN);
53 break;
54
55 case CLOCK_EVT_MODE_ONESHOT:
56 REGSET(tc, SYS_TCx, REN, DIS);
57 REGSET(tc, SYS_TCx, INTS, EN);
58
59 /* fall through */
60
61 case CLOCK_EVT_MODE_UNUSED:
62 case CLOCK_EVT_MODE_SHUTDOWN:
63 case CLOCK_EVT_MODE_RESUME:
64 default:
65 REGSET(tc, SYS_TCx, TEN, DIS);
66 break;
67 }
68
69 __raw_writel(tc, SYS_TC(TIMER_CLOCKEVENT));
70}
30 71
31 return IRQ_HANDLED; 72static int ns9xxx_clockevent_setnextevent(unsigned long evt,
73 struct clock_event_device *clk)
74{
75 u32 tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT));
76
77 if (REGGET(tc, SYS_TCx, TEN)) {
78 REGSET(tc, SYS_TCx, TEN, DIS);
79 __raw_writel(tc, SYS_TC(TIMER_CLOCKEVENT));
80 }
81
82 REGSET(tc, SYS_TCx, TEN, EN);
83
84 __raw_writel(evt, SYS_TRC(TIMER_CLOCKEVENT));
85
86 __raw_writel(tc, SYS_TC(TIMER_CLOCKEVENT));
87
88 return 0;
32} 89}
33 90
34static unsigned long ns9xxx_timer_gettimeoffset(void) 91static struct clock_event_device ns9xxx_clockevent_device = {
92 .name = "ns9xxx-timer" __stringify(TIMER_CLOCKEVENT),
93 .shift = 20,
94 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
95 .set_mode = ns9xxx_clockevent_setmode,
96 .set_next_event = ns9xxx_clockevent_setnextevent,
97};
98
99static irqreturn_t ns9xxx_clockevent_handler(int irq, void *dev_id)
35{ 100{
36 /* return the microseconds which have passed since the last interrupt 101 int timerno = irq - IRQ_TIMER0;
37 * was _serviced_. That is, if an interrupt is pending or the counter 102 u32 tc;
38 * reloads, return one period more. */
39 103
40 u32 counter1 = SYS_TR(0); 104 struct clock_event_device *evt = &ns9xxx_clockevent_device;
41 int pending = SYS_ISR & (1 << IRQ_TIMER0);
42 u32 counter2 = SYS_TR(0);
43 u32 elapsed;
44 105
45 if (pending || counter2 > counter1) 106 /* clear irq */
46 elapsed = 2 * SYS_TRC(0) - counter2; 107 tc = __raw_readl(SYS_TC(timerno));
47 else 108 if (REGGET(tc, SYS_TCx, REN) == SYS_TCx_REN_DIS) {
48 elapsed = SYS_TRC(0) - counter1; 109 REGSET(tc, SYS_TCx, TEN, DIS);
110 __raw_writel(tc, SYS_TC(timerno));
111 }
112 REGSET(tc, SYS_TCx, INTC, SET);
113 __raw_writel(tc, SYS_TC(timerno));
114 REGSET(tc, SYS_TCx, INTC, UNSET);
115 __raw_writel(tc, SYS_TC(timerno));
49 116
50 return (elapsed * usecs_per_tick) >> 16; 117 evt->event_handler(evt);
51 118
119 return IRQ_HANDLED;
52} 120}
53 121
54static struct irqaction ns9xxx_timer_irq = { 122static struct irqaction ns9xxx_clockevent_action = {
55 .name = "NS9xxx Timer Tick", 123 .name = "ns9xxx-timer" __stringify(TIMER_CLOCKEVENT),
56 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 124 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
57 .handler = ns9xxx_timer_interrupt, 125 .handler = ns9xxx_clockevent_handler,
58}; 126};
59 127
60static void __init ns9xxx_timer_init(void) 128static void __init ns9xxx_timer_init(void)
61{ 129{
62 int tc; 130 int tc;
63 131
64 usecs_per_tick = 132 tc = __raw_readl(SYS_TC(TIMER_CLOCKSOURCE));
65 SH_DIV(1000000 * TIMERCLOCKSELECT, ns9xxx_cpuclock(), 16); 133 if (REGGET(tc, SYS_TCx, TEN)) {
134 REGSET(tc, SYS_TCx, TEN, DIS);
135 __raw_writel(tc, SYS_TC(TIMER_CLOCKSOURCE));
136 }
66 137
67 /* disable timer */ 138 __raw_writel(0, SYS_TRC(TIMER_CLOCKSOURCE));
68 if ((tc = SYS_TC(0)) & SYS_TCx_TEN)
69 SYS_TC(0) = tc & ~SYS_TCx_TEN;
70
71 SYS_TRC(0) = SH_DIV(ns9xxx_cpuclock(), (TIMERCLOCKSELECT * HZ), 0);
72 139
73 REGSET(tc, SYS_TCx, TEN, EN); 140 REGSET(tc, SYS_TCx, TEN, EN);
74 REGSET(tc, SYS_TCx, TLCS, DIV64); /* This must match TIMERCLOCKSELECT */
75 REGSET(tc, SYS_TCx, INTS, EN);
76 REGSET(tc, SYS_TCx, UDS, DOWN);
77 REGSET(tc, SYS_TCx, TDBG, STOP); 141 REGSET(tc, SYS_TCx, TDBG, STOP);
142 REGSET(tc, SYS_TCx, TLCS, CPU);
143 REGSET(tc, SYS_TCx, TM, IEE);
144 REGSET(tc, SYS_TCx, INTS, DIS);
145 REGSET(tc, SYS_TCx, UDS, UP);
78 REGSET(tc, SYS_TCx, TSZ, 32); 146 REGSET(tc, SYS_TCx, TSZ, 32);
79 REGSET(tc, SYS_TCx, REN, EN); 147 REGSET(tc, SYS_TCx, REN, EN);
80 SYS_TC(0) = tc;
81 148
82 setup_irq(IRQ_TIMER0, &ns9xxx_timer_irq); 149 __raw_writel(tc, SYS_TC(TIMER_CLOCKSOURCE));
150
151 ns9xxx_clocksource.mult = clocksource_hz2mult(ns9xxx_cpuclock(),
152 ns9xxx_clocksource.shift);
153
154 clocksource_register(&ns9xxx_clocksource);
155
156 latch = SH_DIV(ns9xxx_cpuclock(), HZ, 0);
157
158 tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT));
159 REGSET(tc, SYS_TCx, TEN, DIS);
160 REGSET(tc, SYS_TCx, TDBG, STOP);
161 REGSET(tc, SYS_TCx, TLCS, CPU);
162 REGSET(tc, SYS_TCx, TM, IEE);
163 REGSET(tc, SYS_TCx, INTS, DIS);
164 REGSET(tc, SYS_TCx, UDS, DOWN);
165 REGSET(tc, SYS_TCx, TSZ, 32);
166 REGSET(tc, SYS_TCx, REN, EN);
167 __raw_writel(tc, SYS_TC(TIMER_CLOCKEVENT));
168
169 ns9xxx_clockevent_device.mult = div_sc(ns9xxx_cpuclock(),
170 NSEC_PER_SEC, ns9xxx_clockevent_device.shift);
171 ns9xxx_clockevent_device.max_delta_ns =
172 clockevent_delta2ns(-1, &ns9xxx_clockevent_device);
173 ns9xxx_clockevent_device.min_delta_ns =
174 clockevent_delta2ns(1, &ns9xxx_clockevent_device);
175
176 ns9xxx_clockevent_device.cpumask = cpumask_of_cpu(0);
177 clockevents_register_device(&ns9xxx_clockevent_device);
178
179 setup_irq(IRQ_TIMER0 + TIMER_CLOCKEVENT, &ns9xxx_clockevent_action);
83} 180}
84 181
85struct sys_timer ns9xxx_timer = { 182struct sys_timer ns9xxx_timer = {
86 .init = ns9xxx_timer_init, 183 .init = ns9xxx_timer_init,
87 .offset = ns9xxx_timer_gettimeoffset,
88}; 184};
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
index f6ecdd3a2478..79f0b1f8497b 100644
--- a/arch/arm/mach-omap1/Kconfig
+++ b/arch/arm/mach-omap1/Kconfig
@@ -84,11 +84,39 @@ config MACH_OMAP_PALMTE
84 bool "Palm Tungsten E" 84 bool "Palm Tungsten E"
85 depends on ARCH_OMAP1 && ARCH_OMAP15XX 85 depends on ARCH_OMAP1 && ARCH_OMAP15XX
86 help 86 help
87 Support for the Palm Tungsten E PDA. Currently only the LCD panel 87 Support for the Palm Tungsten E PDA. To boot the kernel, you'll
88 is supported. To boot the kernel, you'll need a PalmOS compatible 88 need a PalmOS compatible bootloader; check out
89 bootloader; check out http://palmtelinux.sourceforge.net for more 89 http://palmtelinux.sourceforge.net/ for more information.
90 information. 90 Say Y here if you have this PDA model, say N otherwise.
91 Say Y here if you have such a PDA, say NO otherwise. 91
92config MACH_OMAP_PALMZ71
93 bool "Palm Zire71"
94 depends on ARCH_OMAP1 && ARCH_OMAP15XX
95 help
96 Support for the Palm Zire71 PDA. To boot the kernel,
97 you'll need a PalmOS compatible bootloader; check out
98 http://hackndev.com/palm/z71 for more informations.
99 Say Y here if you have such a PDA, say N otherwise.
100
101config MACH_OMAP_PALMTT
102 bool "Palm Tungsten|T"
103 depends on ARCH_OMAP1 && ARCH_OMAP15XX
104 help
105 Support for the Palm Tungsten|T PDA. To boot the kernel, you'll
106 need a PalmOS compatible bootloader (Garux); check out
107 http://www.hackndev.com/palm/tt/ for more information.
108 Say Y here if you have this PDA model, say N otherwise.
109
110config MACH_SX1
111 bool "Siemens SX1"
112 depends on ARCH_OMAP1 && ARCH_OMAP15XX
113 help
114 Support for the Siemens SX1 phone. To boot the kernel,
115 you'll need a SX1 compatible bootloader; check out
116 http://forum.oslik.ru and
117 http://www.handhelds.org/moin/moin.cgi/SiemensSX1
118 for more information.
119 Say Y here if you have such a phone, say NO otherwise.
92 120
93config MACH_NOKIA770 121config MACH_NOKIA770
94 bool "Nokia 770" 122 bool "Nokia 770"
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index a8b9a00cea22..391b6f4827f6 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -22,8 +22,11 @@ obj-$(CONFIG_MACH_OMAP_OSK) += board-osk.o
22obj-$(CONFIG_MACH_OMAP_H3) += board-h3.o 22obj-$(CONFIG_MACH_OMAP_H3) += board-h3.o
23obj-$(CONFIG_MACH_VOICEBLUE) += board-voiceblue.o 23obj-$(CONFIG_MACH_VOICEBLUE) += board-voiceblue.o
24obj-$(CONFIG_MACH_OMAP_PALMTE) += board-palmte.o 24obj-$(CONFIG_MACH_OMAP_PALMTE) += board-palmte.o
25obj-$(CONFIG_MACH_OMAP_PALMZ71) += board-palmz71.o
26obj-$(CONFIG_MACH_OMAP_PALMTT) += board-palmtt.o
25obj-$(CONFIG_MACH_NOKIA770) += board-nokia770.o 27obj-$(CONFIG_MACH_NOKIA770) += board-nokia770.o
26obj-$(CONFIG_MACH_AMS_DELTA) += board-ams-delta.o 28obj-$(CONFIG_MACH_AMS_DELTA) += board-ams-delta.o
29obj-$(CONFIG_MACH_SX1) += board-sx1.o
27 30
28ifeq ($(CONFIG_ARCH_OMAP15XX),y) 31ifeq ($(CONFIG_ARCH_OMAP15XX),y)
29# Innovator-1510 FPGA 32# Innovator-1510 FPGA
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 8437d065ada5..c73ca61e585e 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -14,6 +14,7 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/input.h>
17#include <linux/platform_device.h> 18#include <linux/platform_device.h>
18 19
19#include <asm/hardware.h> 20#include <asm/hardware.h>
@@ -23,6 +24,7 @@
23 24
24#include <asm/arch/board-ams-delta.h> 25#include <asm/arch/board-ams-delta.h>
25#include <asm/arch/gpio.h> 26#include <asm/arch/gpio.h>
27#include <asm/arch/keypad.h>
26#include <asm/arch/mux.h> 28#include <asm/arch/mux.h>
27#include <asm/arch/usb.h> 29#include <asm/arch/usb.h>
28#include <asm/arch/board.h> 30#include <asm/arch/board.h>
@@ -31,6 +33,86 @@
31static u8 ams_delta_latch1_reg; 33static u8 ams_delta_latch1_reg;
32static u16 ams_delta_latch2_reg; 34static u16 ams_delta_latch2_reg;
33 35
36static int ams_delta_keymap[] = {
37 KEY(0, 0, KEY_F1), /* Advert */
38
39 KEY(3, 0, KEY_COFFEE), /* Games */
40 KEY(2, 0, KEY_QUESTION), /* Directory */
41 KEY(3, 2, KEY_CONNECT), /* Internet */
42 KEY(2, 1, KEY_SHOP), /* Services */
43 KEY(1, 1, KEY_PHONE), /* VoiceMail */
44
45 KEY(1, 0, KEY_DELETE), /* Delete */
46 KEY(2, 2, KEY_PLAY), /* Play */
47 KEY(0, 1, KEY_PAGEUP), /* Up */
48 KEY(3, 1, KEY_PAGEDOWN), /* Down */
49 KEY(0, 2, KEY_EMAIL), /* ReadEmail */
50 KEY(1, 2, KEY_STOP), /* Stop */
51
52 /* Numeric keypad portion */
53 KEY(7, 0, KEY_KP1),
54 KEY(6, 0, KEY_KP2),
55 KEY(5, 0, KEY_KP3),
56 KEY(7, 1, KEY_KP4),
57 KEY(6, 1, KEY_KP5),
58 KEY(5, 1, KEY_KP6),
59 KEY(7, 2, KEY_KP7),
60 KEY(6, 2, KEY_KP8),
61 KEY(5, 2, KEY_KP9),
62 KEY(6, 3, KEY_KP0),
63 KEY(7, 3, KEY_KPASTERISK),
64 KEY(5, 3, KEY_KPDOT), /* # key */
65 KEY(2, 7, KEY_NUMLOCK), /* Mute */
66 KEY(1, 7, KEY_KPMINUS), /* Recall */
67 KEY(1, 6, KEY_KPPLUS), /* Redial */
68 KEY(6, 7, KEY_KPSLASH), /* Handsfree */
69 KEY(0, 6, KEY_ENTER), /* Video */
70
71 KEY(4, 7, KEY_CAMERA), /* Photo */
72
73 KEY(4, 0, KEY_F2), /* Home */
74 KEY(4, 1, KEY_F3), /* Office */
75 KEY(4, 2, KEY_F4), /* Mobile */
76 KEY(7, 7, KEY_F5), /* SMS */
77 KEY(5, 7, KEY_F6), /* Email */
78
79 /* QWERTY portion of keypad */
80 KEY(4, 3, KEY_Q),
81 KEY(3, 3, KEY_W),
82 KEY(2, 3, KEY_E),
83 KEY(1, 3, KEY_R),
84 KEY(0, 3, KEY_T),
85 KEY(7, 4, KEY_Y),
86 KEY(6, 4, KEY_U),
87 KEY(5, 4, KEY_I),
88 KEY(4, 4, KEY_O),
89 KEY(3, 4, KEY_P),
90
91 KEY(2, 4, KEY_A),
92 KEY(1, 4, KEY_S),
93 KEY(0, 4, KEY_D),
94 KEY(7, 5, KEY_F),
95 KEY(6, 5, KEY_G),
96 KEY(5, 5, KEY_H),
97 KEY(4, 5, KEY_J),
98 KEY(3, 5, KEY_K),
99 KEY(2, 5, KEY_L),
100
101 KEY(1, 5, KEY_Z),
102 KEY(0, 5, KEY_X),
103 KEY(7, 6, KEY_C),
104 KEY(6, 6, KEY_V),
105 KEY(5, 6, KEY_B),
106 KEY(4, 6, KEY_N),
107 KEY(3, 6, KEY_M),
108 KEY(2, 6, KEY_SPACE),
109
110 KEY(0, 7, KEY_LEFTSHIFT), /* Vol up */
111 KEY(3, 7, KEY_LEFTCTRL), /* Vol down */
112
113 0
114};
115
34void ams_delta_latch1_write(u8 mask, u8 value) 116void ams_delta_latch1_write(u8 mask, u8 value)
35{ 117{
36 ams_delta_latch1_reg &= ~mask; 118 ams_delta_latch1_reg &= ~mask;
@@ -76,6 +158,10 @@ static struct map_desc ams_delta_io_desc[] __initdata = {
76 } 158 }
77}; 159};
78 160
161static struct omap_lcd_config ams_delta_lcd_config __initdata = {
162 .ctrl_name = "internal",
163};
164
79static struct omap_uart_config ams_delta_uart_config __initdata = { 165static struct omap_uart_config ams_delta_uart_config __initdata = {
80 .enabled_uarts = 1, 166 .enabled_uarts = 1,
81}; 167};
@@ -87,16 +173,50 @@ static struct omap_usb_config ams_delta_usb_config __initdata = {
87}; 173};
88 174
89static struct omap_board_config_kernel ams_delta_config[] = { 175static struct omap_board_config_kernel ams_delta_config[] = {
176 { OMAP_TAG_LCD, &ams_delta_lcd_config },
90 { OMAP_TAG_UART, &ams_delta_uart_config }, 177 { OMAP_TAG_UART, &ams_delta_uart_config },
91 { OMAP_TAG_USB, &ams_delta_usb_config }, 178 { OMAP_TAG_USB, &ams_delta_usb_config },
92}; 179};
93 180
181static struct resource ams_delta_kp_resources[] = {
182 [0] = {
183 .start = INT_KEYBOARD,
184 .end = INT_KEYBOARD,
185 .flags = IORESOURCE_IRQ,
186 },
187};
188
189static struct omap_kp_platform_data ams_delta_kp_data = {
190 .rows = 8,
191 .cols = 8,
192 .keymap = ams_delta_keymap,
193 .keymapsize = ARRAY_SIZE(ams_delta_keymap),
194 .delay = 9,
195};
196
197static struct platform_device ams_delta_kp_device = {
198 .name = "omap-keypad",
199 .id = -1,
200 .dev = {
201 .platform_data = &ams_delta_kp_data,
202 },
203 .num_resources = ARRAY_SIZE(ams_delta_kp_resources),
204 .resource = ams_delta_kp_resources,
205};
206
207static struct platform_device ams_delta_lcd_device = {
208 .name = "lcd_ams_delta",
209 .id = -1,
210};
211
94static struct platform_device ams_delta_led_device = { 212static struct platform_device ams_delta_led_device = {
95 .name = "ams-delta-led", 213 .name = "ams-delta-led",
96 .id = -1 214 .id = -1
97}; 215};
98 216
99static struct platform_device *ams_delta_devices[] __initdata = { 217static struct platform_device *ams_delta_devices[] __initdata = {
218 &ams_delta_kp_device,
219 &ams_delta_lcd_device,
100 &ams_delta_led_device, 220 &ams_delta_led_device,
101}; 221};
102 222
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 48c8c9195dc3..b0921622566f 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -20,22 +20,23 @@
20 */ 20 */
21 21
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/init.h>
24#include <linux/platform_device.h> 23#include <linux/platform_device.h>
25#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/i2c.h>
26#include <linux/mtd/mtd.h> 26#include <linux/mtd/mtd.h>
27#include <linux/mtd/nand.h> 27#include <linux/mtd/nand.h>
28#include <linux/mtd/partitions.h> 28#include <linux/mtd/partitions.h>
29#include <linux/input.h> 29#include <linux/input.h>
30#include <linux/workqueue.h>
31 30
32#include <asm/hardware.h> 31#include <asm/hardware.h>
32#include <asm/gpio.h>
33
33#include <asm/mach-types.h> 34#include <asm/mach-types.h>
34#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
35#include <asm/mach/flash.h> 36#include <asm/mach/flash.h>
36#include <asm/mach/map.h> 37#include <asm/mach/map.h>
37 38
38#include <asm/arch/gpio.h> 39#include <asm/arch/tps65010.h>
39#include <asm/arch/mux.h> 40#include <asm/arch/mux.h>
40#include <asm/arch/tc.h> 41#include <asm/arch/tc.h>
41#include <asm/arch/irda.h> 42#include <asm/arch/irda.h>
@@ -139,6 +140,66 @@ static struct platform_device h2_nor_device = {
139 .resource = &h2_nor_resource, 140 .resource = &h2_nor_resource,
140}; 141};
141 142
143#if 0 /* REVISIT: Enable when nand_platform_data is applied */
144
145static struct mtd_partition h2_nand_partitions[] = {
146#if 0
147 /* REVISIT: enable these partitions if you make NAND BOOT
148 * work on your H2 (rev C or newer); published versions of
149 * x-load only support P2 and H3.
150 */
151 {
152 .name = "xloader",
153 .offset = 0,
154 .size = 64 * 1024,
155 .mask_flags = MTD_WRITEABLE, /* force read-only */
156 },
157 {
158 .name = "bootloader",
159 .offset = MTDPART_OFS_APPEND,
160 .size = 256 * 1024,
161 .mask_flags = MTD_WRITEABLE, /* force read-only */
162 },
163 {
164 .name = "params",
165 .offset = MTDPART_OFS_APPEND,
166 .size = 192 * 1024,
167 },
168 {
169 .name = "kernel",
170 .offset = MTDPART_OFS_APPEND,
171 .size = 2 * SZ_1M,
172 },
173#endif
174 {
175 .name = "filesystem",
176 .size = MTDPART_SIZ_FULL,
177 .offset = MTDPART_OFS_APPEND,
178 },
179};
180
181/* dip switches control NAND chip access: 8 bit, 16 bit, or neither */
182static struct nand_platform_data h2_nand_data = {
183 .options = NAND_SAMSUNG_LP_OPTIONS,
184 .parts = h2_nand_partitions,
185 .nr_parts = ARRAY_SIZE(h2_nand_partitions),
186};
187
188static struct resource h2_nand_resource = {
189 .flags = IORESOURCE_MEM,
190};
191
192static struct platform_device h2_nand_device = {
193 .name = "omapnand",
194 .id = 0,
195 .dev = {
196 .platform_data = &h2_nand_data,
197 },
198 .num_resources = 1,
199 .resource = &h2_nand_resource,
200};
201#endif
202
142static struct resource h2_smc91x_resources[] = { 203static struct resource h2_smc91x_resources[] = {
143 [0] = { 204 [0] = {
144 .start = OMAP1610_ETHR_START, /* Physical */ 205 .start = OMAP1610_ETHR_START, /* Physical */
@@ -218,11 +279,15 @@ static struct resource h2_irda_resources[] = {
218 .flags = IORESOURCE_IRQ, 279 .flags = IORESOURCE_IRQ,
219 }, 280 },
220}; 281};
282
283static u64 irda_dmamask = 0xffffffff;
284
221static struct platform_device h2_irda_device = { 285static struct platform_device h2_irda_device = {
222 .name = "omapirda", 286 .name = "omapirda",
223 .id = 0, 287 .id = 0,
224 .dev = { 288 .dev = {
225 .platform_data = &h2_irda_data, 289 .platform_data = &h2_irda_data,
290 .dma_mask = &irda_dmamask,
226 }, 291 },
227 .num_resources = ARRAY_SIZE(h2_irda_resources), 292 .num_resources = ARRAY_SIZE(h2_irda_resources),
228 .resource = h2_irda_resources, 293 .resource = h2_irda_resources,
@@ -270,6 +335,7 @@ static struct platform_device h2_mcbsp1_device = {
270 335
271static struct platform_device *h2_devices[] __initdata = { 336static struct platform_device *h2_devices[] __initdata = {
272 &h2_nor_device, 337 &h2_nor_device,
338 //&h2_nand_device,
273 &h2_smc91x_device, 339 &h2_smc91x_device,
274 &h2_irda_device, 340 &h2_irda_device,
275 &h2_kp_device, 341 &h2_kp_device,
@@ -277,6 +343,20 @@ static struct platform_device *h2_devices[] __initdata = {
277 &h2_mcbsp1_device, 343 &h2_mcbsp1_device,
278}; 344};
279 345
346static struct i2c_board_info __initdata h2_i2c_board_info[] = {
347 {
348 I2C_BOARD_INFO("tps65010", 0x48),
349 .type = "tps65010",
350 .irq = OMAP_GPIO_IRQ(58),
351 },
352 /* TODO when driver support is ready:
353 * - isp1301 OTG transceiver
354 * - optional ov9640 camera sensor at 0x30
355 * - pcf9754 for aGPS control
356 * - ... etc
357 */
358};
359
280static void __init h2_init_smc91x(void) 360static void __init h2_init_smc91x(void)
281{ 361{
282 if ((omap_request_gpio(0)) < 0) { 362 if ((omap_request_gpio(0)) < 0) {
@@ -333,6 +413,13 @@ static struct omap_board_config_kernel h2_config[] __initdata = {
333 { OMAP_TAG_LCD, &h2_lcd_config }, 413 { OMAP_TAG_LCD, &h2_lcd_config },
334}; 414};
335 415
416#define H2_NAND_RB_GPIO_PIN 62
417
418static int h2_nand_dev_ready(struct nand_platform_data *data)
419{
420 return omap_get_gpio_datain(H2_NAND_RB_GPIO_PIN);
421}
422
336static void __init h2_init(void) 423static void __init h2_init(void)
337{ 424{
338 /* Here we assume the NOR boot config: NOR on CS3 (possibly swapped 425 /* Here we assume the NOR boot config: NOR on CS3 (possibly swapped
@@ -347,6 +434,13 @@ static void __init h2_init(void)
347 h2_nor_resource.end = h2_nor_resource.start = omap_cs3_phys(); 434 h2_nor_resource.end = h2_nor_resource.start = omap_cs3_phys();
348 h2_nor_resource.end += SZ_32M - 1; 435 h2_nor_resource.end += SZ_32M - 1;
349 436
437#if 0 /* REVISIT: Enable when nand_platform_data is applied */
438 h2_nand_resource.end = h2_nand_resource.start = OMAP_CS2B_PHYS;
439 h2_nand_resource.end += SZ_4K - 1;
440 if (!(omap_request_gpio(H2_NAND_RB_GPIO_PIN)))
441 h2_nand_data.dev_ready = h2_nand_dev_ready;
442#endif
443
350 omap_cfg_reg(L3_1610_FLASH_CS2B_OE); 444 omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
351 omap_cfg_reg(M8_1610_FLASH_CS2B_WE); 445 omap_cfg_reg(M8_1610_FLASH_CS2B_WE);
352 446
@@ -367,6 +461,14 @@ static void __init h2_init(void)
367 omap_board_config = h2_config; 461 omap_board_config = h2_config;
368 omap_board_config_size = ARRAY_SIZE(h2_config); 462 omap_board_config_size = ARRAY_SIZE(h2_config);
369 omap_serial_init(); 463 omap_serial_init();
464
465 /* irq for tps65010 chip */
466 omap_cfg_reg(W4_GPIO58);
467 if (gpio_request(58, "tps65010") == 0)
468 gpio_direction_input(58);
469
470 i2c_register_board_info(1, h2_i2c_board_info,
471 ARRAY_SIZE(h2_i2c_board_info));
370} 472}
371 473
372static void __init h2_map_io(void) 474static void __init h2_map_io(void)
@@ -374,6 +476,22 @@ static void __init h2_map_io(void)
374 omap1_map_common_io(); 476 omap1_map_common_io();
375} 477}
376 478
479#ifdef CONFIG_TPS65010
480static int __init h2_tps_init(void)
481{
482 if (!machine_is_omap_h2())
483 return 0;
484
485 /* gpio3 for SD, gpio4 for VDD_DSP */
486 /* FIXME send power to DSP iff it's configured */
487
488 /* Enable LOW_PWR */
489 tps65010_set_low_pwr(ON);
490 return 0;
491}
492fs_initcall(h2_tps_init);
493#endif
494
377MACHINE_START(OMAP_H2, "TI-H2") 495MACHINE_START(OMAP_H2, "TI-H2")
378 /* Maintainer: Imre Deak <imre.deak@nokia.com> */ 496 /* Maintainer: Imre Deak <imre.deak@nokia.com> */
379 .phys_io = 0xfff00000, 497 .phys_io = 0xfff00000,
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 79d4ef4c54d4..4f84ae273a1f 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -21,6 +21,7 @@
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/workqueue.h> 23#include <linux/workqueue.h>
24#include <linux/i2c.h>
24#include <linux/mtd/mtd.h> 25#include <linux/mtd/mtd.h>
25#include <linux/mtd/nand.h> 26#include <linux/mtd/nand.h>
26#include <linux/mtd/partitions.h> 27#include <linux/mtd/partitions.h>
@@ -29,12 +30,14 @@
29#include <asm/setup.h> 30#include <asm/setup.h>
30#include <asm/page.h> 31#include <asm/page.h>
31#include <asm/hardware.h> 32#include <asm/hardware.h>
33#include <asm/gpio.h>
34
32#include <asm/mach-types.h> 35#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 36#include <asm/mach/arch.h>
34#include <asm/mach/flash.h> 37#include <asm/mach/flash.h>
35#include <asm/mach/map.h> 38#include <asm/mach/map.h>
36 39
37#include <asm/arch/gpio.h> 40#include <asm/arch/tps65010.h>
38#include <asm/arch/gpioexpander.h> 41#include <asm/arch/gpioexpander.h>
39#include <asm/arch/irqs.h> 42#include <asm/arch/irqs.h>
40#include <asm/arch/mux.h> 43#include <asm/arch/mux.h>
@@ -44,6 +47,8 @@
44#include <asm/arch/keypad.h> 47#include <asm/arch/keypad.h>
45#include <asm/arch/dma.h> 48#include <asm/arch/dma.h>
46#include <asm/arch/common.h> 49#include <asm/arch/common.h>
50#include <asm/arch/mcbsp.h>
51#include <asm/arch/omap-alsa.h>
47 52
48extern int omap_gpio_init(void); 53extern int omap_gpio_init(void);
49 54
@@ -351,11 +356,14 @@ static struct resource h3_irda_resources[] = {
351 }, 356 },
352}; 357};
353 358
359static u64 irda_dmamask = 0xffffffff;
360
354static struct platform_device h3_irda_device = { 361static struct platform_device h3_irda_device = {
355 .name = "omapirda", 362 .name = "omapirda",
356 .id = 0, 363 .id = 0,
357 .dev = { 364 .dev = {
358 .platform_data = &h3_irda_data, 365 .platform_data = &h3_irda_data,
366 .dma_mask = &irda_dmamask,
359 }, 367 },
360 .num_resources = ARRAY_SIZE(h3_irda_resources), 368 .num_resources = ARRAY_SIZE(h3_irda_resources),
361 .resource = h3_irda_resources, 369 .resource = h3_irda_resources,
@@ -366,6 +374,41 @@ static struct platform_device h3_lcd_device = {
366 .id = -1, 374 .id = -1,
367}; 375};
368 376
377static struct omap_mcbsp_reg_cfg mcbsp_regs = {
378 .spcr2 = FREE | FRST | GRST | XRST | XINTM(3),
379 .spcr1 = RINTM(3) | RRST,
380 .rcr2 = RPHASE | RFRLEN2(OMAP_MCBSP_WORD_8) |
381 RWDLEN2(OMAP_MCBSP_WORD_16) | RDATDLY(1),
382 .rcr1 = RFRLEN1(OMAP_MCBSP_WORD_8) | RWDLEN1(OMAP_MCBSP_WORD_16),
383 .xcr2 = XPHASE | XFRLEN2(OMAP_MCBSP_WORD_8) |
384 XWDLEN2(OMAP_MCBSP_WORD_16) | XDATDLY(1) | XFIG,
385 .xcr1 = XFRLEN1(OMAP_MCBSP_WORD_8) | XWDLEN1(OMAP_MCBSP_WORD_16),
386 .srgr1 = FWID(15),
387 .srgr2 = GSYNC | CLKSP | FSGM | FPER(31),
388
389 .pcr0 = CLKRM | SCLKME | FSXP | FSRP | CLKXP | CLKRP,
390 //.pcr0 = CLKXP | CLKRP, /* mcbsp: slave */
391};
392
393static struct omap_alsa_codec_config alsa_config = {
394 .name = "H3 TSC2101",
395 .mcbsp_regs_alsa = &mcbsp_regs,
396 .codec_configure_dev = NULL, // tsc2101_configure,
397 .codec_set_samplerate = NULL, // tsc2101_set_samplerate,
398 .codec_clock_setup = NULL, // tsc2101_clock_setup,
399 .codec_clock_on = NULL, // tsc2101_clock_on,
400 .codec_clock_off = NULL, // tsc2101_clock_off,
401 .get_default_samplerate = NULL, // tsc2101_get_default_samplerate,
402};
403
404static struct platform_device h3_mcbsp1_device = {
405 .name = "omap_alsa_mcbsp",
406 .id = 1,
407 .dev = {
408 .platform_data = &alsa_config,
409 },
410};
411
369static struct platform_device *devices[] __initdata = { 412static struct platform_device *devices[] __initdata = {
370 &nor_device, 413 &nor_device,
371 &nand_device, 414 &nand_device,
@@ -374,6 +417,7 @@ static struct platform_device *devices[] __initdata = {
374 &h3_irda_device, 417 &h3_irda_device,
375 &h3_kp_device, 418 &h3_kp_device,
376 &h3_lcd_device, 419 &h3_lcd_device,
420 &h3_mcbsp1_device,
377}; 421};
378 422
379static struct omap_usb_config h3_usb_config __initdata = { 423static struct omap_usb_config h3_usb_config __initdata = {
@@ -413,6 +457,19 @@ static struct omap_board_config_kernel h3_config[] = {
413 { OMAP_TAG_LCD, &h3_lcd_config }, 457 { OMAP_TAG_LCD, &h3_lcd_config },
414}; 458};
415 459
460static struct i2c_board_info __initdata h3_i2c_board_info[] = {
461 {
462 I2C_BOARD_INFO("tps65010", 0x48),
463 .type = "tps65013",
464 /* .irq = OMAP_GPIO_IRQ(??), */
465 },
466 /* TODO when driver support is ready:
467 * - isp1301 OTG transceiver
468 * - optional ov9640 camera sensor at 0x30
469 * - ...
470 */
471};
472
416#define H3_NAND_RB_GPIO_PIN 10 473#define H3_NAND_RB_GPIO_PIN 10
417 474
418static int nand_dev_ready(struct nand_platform_data *data) 475static int nand_dev_ready(struct nand_platform_data *data)
@@ -446,6 +503,10 @@ static void __init h3_init(void)
446 omap_board_config = h3_config; 503 omap_board_config = h3_config;
447 omap_board_config_size = ARRAY_SIZE(h3_config); 504 omap_board_config_size = ARRAY_SIZE(h3_config);
448 omap_serial_init(); 505 omap_serial_init();
506
507 /* FIXME setup irq for tps65013 chip */
508 i2c_register_board_info(1, h3_i2c_board_info,
509 ARRAY_SIZE(h3_i2c_board_info));
449} 510}
450 511
451static void __init h3_init_smc91x(void) 512static void __init h3_init_smc91x(void)
@@ -470,6 +531,23 @@ static void __init h3_map_io(void)
470 omap1_map_common_io(); 531 omap1_map_common_io();
471} 532}
472 533
534#ifdef CONFIG_TPS65010
535static int __init h3_tps_init(void)
536{
537 if (!machine_is_omap_h3())
538 return 0;
539
540 /* gpio4 for SD, gpio3 for VDD_DSP */
541 /* FIXME send power to DSP iff it's configured */
542
543 /* Enable LOW_PWR */
544 tps65013_set_low_pwr(ON);
545
546 return 0;
547}
548fs_initcall(h3_tps_init);
549#endif
550
473MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board") 551MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
474 /* Maintainer: Texas Instruments, Inc. */ 552 /* Maintainer: Texas Instruments, Inc. */
475 .phys_io = 0xfff00000, 553 .phys_io = 0xfff00000,
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 70014f751bc4..22db19a53647 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -33,6 +33,12 @@
33#include <asm/arch/dsp_common.h> 33#include <asm/arch/dsp_common.h>
34#include <asm/arch/aic23.h> 34#include <asm/arch/aic23.h>
35#include <asm/arch/gpio.h> 35#include <asm/arch/gpio.h>
36#include <asm/arch/omapfb.h>
37#include <asm/arch/lcd_mipid.h>
38
39#include "../plat-omap/dsp/dsp_common.h"
40
41#define ADS7846_PENDOWN_GPIO 15
36 42
37static void __init omap_nokia770_init_irq(void) 43static void __init omap_nokia770_init_irq(void)
38{ 44{
@@ -91,9 +97,44 @@ static struct platform_device nokia770_kp_device = {
91}; 97};
92 98
93static struct platform_device *nokia770_devices[] __initdata = { 99static struct platform_device *nokia770_devices[] __initdata = {
94 &nokia770_kp_device, 100 &nokia770_kp_device,
101};
102
103static void mipid_shutdown(struct mipid_platform_data *pdata)
104{
105 if (pdata->nreset_gpio != -1) {
106 printk(KERN_INFO "shutdown LCD\n");
107 omap_set_gpio_dataout(pdata->nreset_gpio, 0);
108 msleep(120);
109 }
110}
111
112static struct mipid_platform_data nokia770_mipid_platform_data = {
113 .shutdown = mipid_shutdown,
95}; 114};
96 115
116static void mipid_dev_init(void)
117{
118 const struct omap_lcd_config *conf;
119
120 conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
121 if (conf != NULL) {
122 nokia770_mipid_platform_data.nreset_gpio = conf->nreset_gpio;
123 nokia770_mipid_platform_data.data_lines = conf->data_lines;
124 }
125}
126
127static void ads7846_dev_init(void)
128{
129 if (omap_request_gpio(ADS7846_PENDOWN_GPIO) < 0)
130 printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
131}
132
133static int ads7846_get_pendown_state(void)
134{
135 return !omap_get_gpio_datain(ADS7846_PENDOWN_GPIO);
136}
137
97static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata = { 138static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata = {
98 .x_max = 0x0fff, 139 .x_max = 0x0fff,
99 .y_max = 0x0fff, 140 .y_max = 0x0fff,
@@ -101,14 +142,17 @@ static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata =
101 .pressure_max = 255, 142 .pressure_max = 255,
102 .debounce_max = 10, 143 .debounce_max = 10,
103 .debounce_tol = 3, 144 .debounce_tol = 3,
145 .debounce_rep = 1,
146 .get_pendown_state = ads7846_get_pendown_state,
104}; 147};
105 148
106static struct spi_board_info nokia770_spi_board_info[] __initdata = { 149static struct spi_board_info nokia770_spi_board_info[] __initdata = {
107 [0] = { 150 [0] = {
108 .modalias = "lcd_mipid", 151 .modalias = "lcd_mipid",
109 .bus_num = 2, 152 .bus_num = 2,
110 .chip_select = 3, 153 .chip_select = 3,
111 .max_speed_hz = 12000000, 154 .max_speed_hz = 12000000,
155 .platform_data = &nokia770_mipid_platform_data,
112 }, 156 },
113 [1] = { 157 [1] = {
114 .modalias = "ads7846", 158 .modalias = "ads7846",
@@ -153,6 +197,7 @@ static struct omap_board_config_kernel nokia770_config[] = {
153 { OMAP_TAG_MMC, &nokia770_mmc_config }, 197 { OMAP_TAG_MMC, &nokia770_mmc_config },
154}; 198};
155 199
200#if defined(CONFIG_OMAP_DSP)
156/* 201/*
157 * audio power control 202 * audio power control
158 */ 203 */
@@ -183,7 +228,7 @@ static void nokia770_audio_pwr_up(void)
183 clk_enable(dspxor_ck); 228 clk_enable(dspxor_ck);
184 229
185 /* Turn on codec */ 230 /* Turn on codec */
186 tlv320aic23_power_up(); 231 aic23_power_up();
187 232
188 if (omap_get_gpio_datain(HEADPHONE_GPIO)) 233 if (omap_get_gpio_datain(HEADPHONE_GPIO))
189 /* HP not connected, turn on amplifier */ 234 /* HP not connected, turn on amplifier */
@@ -197,7 +242,7 @@ static void codec_delayed_power_down(struct work_struct *work)
197{ 242{
198 down(&audio_pwr_sem); 243 down(&audio_pwr_sem);
199 if (audio_pwr_state == -1) 244 if (audio_pwr_state == -1)
200 tlv320aic23_power_down(); 245 aic23_power_down();
201 clk_disable(dspxor_ck); 246 clk_disable(dspxor_ck);
202 up(&audio_pwr_sem); 247 up(&audio_pwr_sem);
203} 248}
@@ -213,7 +258,8 @@ static void nokia770_audio_pwr_down(void)
213 schedule_delayed_work(&codec_power_down_work, HZ / 20); /* 50ms */ 258 schedule_delayed_work(&codec_power_down_work, HZ / 20); /* 50ms */
214} 259}
215 260
216void nokia770_audio_pwr_up_request(int stage) 261static int
262nokia770_audio_pwr_up_request(struct dsp_kfunc_device *kdev, int stage)
217{ 263{
218 down(&audio_pwr_sem); 264 down(&audio_pwr_sem);
219 if (audio_pwr_state == -1) 265 if (audio_pwr_state == -1)
@@ -221,9 +267,11 @@ void nokia770_audio_pwr_up_request(int stage)
221 /* force audio_pwr_state = 0, even if it was 1. */ 267 /* force audio_pwr_state = 0, even if it was 1. */
222 audio_pwr_state = 0; 268 audio_pwr_state = 0;
223 up(&audio_pwr_sem); 269 up(&audio_pwr_sem);
270 return 0;
224} 271}
225 272
226void nokia770_audio_pwr_down_request(int stage) 273static int
274nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage)
227{ 275{
228 down(&audio_pwr_sem); 276 down(&audio_pwr_sem);
229 switch (stage) { 277 switch (stage) {
@@ -239,8 +287,39 @@ void nokia770_audio_pwr_down_request(int stage)
239 break; 287 break;
240 } 288 }
241 up(&audio_pwr_sem); 289 up(&audio_pwr_sem);
290 return 0;
242} 291}
243 292
293static struct dsp_kfunc_device nokia770_audio_device = {
294 .name = "audio",
295 .type = DSP_KFUNC_DEV_TYPE_AUDIO,
296 .enable = nokia770_audio_pwr_up_request,
297 .disable = nokia770_audio_pwr_down_request,
298};
299
300static __init int omap_dsp_init(void)
301{
302 int ret;
303
304 dspxor_ck = clk_get(0, "dspxor_ck");
305 if (IS_ERR(dspxor_ck)) {
306 printk(KERN_ERR "couldn't acquire dspxor_ck\n");
307 return PTR_ERR(dspxor_ck);
308 }
309
310 ret = dsp_kfunc_device_register(&nokia770_audio_device);
311 if (ret) {
312 printk(KERN_ERR
313 "KFUNC device registration faild: %s\n",
314 nokia770_audio_device.name);
315 goto out;
316 }
317 return 0;
318 out:
319 return ret;
320}
321#endif /* CONFIG_OMAP_DSP */
322
244static void __init omap_nokia770_init(void) 323static void __init omap_nokia770_init(void)
245{ 324{
246 nokia770_config[0].data = &nokia770_usb_config; 325 nokia770_config[0].data = &nokia770_usb_config;
@@ -250,10 +329,11 @@ static void __init omap_nokia770_init(void)
250 ARRAY_SIZE(nokia770_spi_board_info)); 329 ARRAY_SIZE(nokia770_spi_board_info));
251 omap_board_config = nokia770_config; 330 omap_board_config = nokia770_config;
252 omap_board_config_size = ARRAY_SIZE(nokia770_config); 331 omap_board_config_size = ARRAY_SIZE(nokia770_config);
332 omap_gpio_init();
253 omap_serial_init(); 333 omap_serial_init();
254 omap_dsp_audio_pwr_up_request = nokia770_audio_pwr_up_request; 334 omap_dsp_init();
255 omap_dsp_audio_pwr_down_request = nokia770_audio_pwr_down_request; 335 ads7846_dev_init();
256 dspxor_ck = clk_get(0, "dspxor_ck"); 336 mipid_dev_init();
257} 337}
258 338
259static void __init omap_nokia770_map_io(void) 339static void __init omap_nokia770_map_io(void)
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index e7130293a03f..5db182da322b 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -29,20 +29,24 @@
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/platform_device.h> 31#include <linux/platform_device.h>
32#include <linux/interrupt.h>
32#include <linux/irq.h> 33#include <linux/irq.h>
33#include <linux/interrupt.h> 34#include <linux/interrupt.h>
35#include <linux/i2c.h>
34 36
35#include <linux/mtd/mtd.h> 37#include <linux/mtd/mtd.h>
36#include <linux/mtd/partitions.h> 38#include <linux/mtd/partitions.h>
37 39
38#include <asm/hardware.h> 40#include <asm/hardware.h>
41#include <asm/gpio.h>
42
39#include <asm/mach-types.h> 43#include <asm/mach-types.h>
40#include <asm/mach/arch.h> 44#include <asm/mach/arch.h>
41#include <asm/mach/map.h> 45#include <asm/mach/map.h>
42#include <asm/mach/flash.h> 46#include <asm/mach/flash.h>
43 47
44#include <asm/arch/gpio.h>
45#include <asm/arch/usb.h> 48#include <asm/arch/usb.h>
49#include <asm/arch/tps65010.h>
46#include <asm/arch/mux.h> 50#include <asm/arch/mux.h>
47#include <asm/arch/tc.h> 51#include <asm/arch/tc.h>
48#include <asm/arch/common.h> 52#include <asm/arch/common.h>
@@ -179,6 +183,19 @@ static struct platform_device *osk5912_devices[] __initdata = {
179 &osk5912_mcbsp1_device, 183 &osk5912_mcbsp1_device,
180}; 184};
181 185
186static struct i2c_board_info __initdata osk_i2c_board_info[] = {
187 {
188 I2C_BOARD_INFO("tps65010", 0x48),
189 .type = "tps65010",
190 .irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1)),
191 },
192 /* TODO when driver support is ready:
193 * - aic23 audio chip at 0x1a
194 * - on Mistral, 24c04 eeprom at 0x50
195 * - optionally on Mistral, ov9640 camera sensor at 0x30
196 */
197};
198
182static void __init osk_init_smc91x(void) 199static void __init osk_init_smc91x(void)
183{ 200{
184 if ((omap_request_gpio(0)) < 0) { 201 if ((omap_request_gpio(0)) < 0) {
@@ -292,6 +309,18 @@ static struct platform_device osk5912_kp_device = {
292 .resource = osk5912_kp_resources, 309 .resource = osk5912_kp_resources,
293}; 310};
294 311
312static struct omap_backlight_config mistral_bl_data = {
313 .default_intensity = 0xa0,
314};
315
316static struct platform_device mistral_bl_device = {
317 .name = "omap-bl",
318 .id = -1,
319 .dev = {
320 .platform_data = &mistral_bl_data,
321 },
322};
323
295static struct platform_device osk5912_lcd_device = { 324static struct platform_device osk5912_lcd_device = {
296 .name = "lcd_osk", 325 .name = "lcd_osk",
297 .id = -1, 326 .id = -1,
@@ -299,6 +328,7 @@ static struct platform_device osk5912_lcd_device = {
299 328
300static struct platform_device *mistral_devices[] __initdata = { 329static struct platform_device *mistral_devices[] __initdata = {
301 &osk5912_kp_device, 330 &osk5912_kp_device,
331 &mistral_bl_device,
302 &osk5912_lcd_device, 332 &osk5912_lcd_device,
303}; 333};
304 334
@@ -342,6 +372,38 @@ static void __init osk_mistral_init(void)
342 * can't talk to the ads or even the i2c eeprom. 372 * can't talk to the ads or even the i2c eeprom.
343 */ 373 */
344 374
375 /* parallel camera interface */
376 omap_cfg_reg(J15_1610_CAM_LCLK);
377 omap_cfg_reg(J18_1610_CAM_D7);
378 omap_cfg_reg(J19_1610_CAM_D6);
379 omap_cfg_reg(J14_1610_CAM_D5);
380 omap_cfg_reg(K18_1610_CAM_D4);
381 omap_cfg_reg(K19_1610_CAM_D3);
382 omap_cfg_reg(K15_1610_CAM_D2);
383 omap_cfg_reg(K14_1610_CAM_D1);
384 omap_cfg_reg(L19_1610_CAM_D0);
385 omap_cfg_reg(L18_1610_CAM_VS);
386 omap_cfg_reg(L15_1610_CAM_HS);
387 omap_cfg_reg(M19_1610_CAM_RSTZ);
388 omap_cfg_reg(Y15_1610_CAM_OUTCLK);
389
390 /* serial camera interface */
391 omap_cfg_reg(H19_1610_CAM_EXCLK);
392 omap_cfg_reg(W13_1610_CCP_CLKM);
393 omap_cfg_reg(Y12_1610_CCP_CLKP);
394 /* CCP_DATAM CONFLICTS WITH UART1.TX (and serial console) */
395 // omap_cfg_reg(Y14_1610_CCP_DATAM);
396 omap_cfg_reg(W14_1610_CCP_DATAP);
397
398 /* CAM_PWDN */
399 if (omap_request_gpio(11) == 0) {
400 omap_cfg_reg(N20_1610_GPIO11);
401 omap_set_gpio_direction(11, 0 /* out */);
402 omap_set_gpio_dataout(11, 0 /* off */);
403 } else
404 pr_debug("OSK+Mistral: CAM_PWDN is awol\n");
405
406
345 // omap_cfg_reg(P19_1610_GPIO6); // BUSY 407 // omap_cfg_reg(P19_1610_GPIO6); // BUSY
346 omap_cfg_reg(P20_1610_GPIO4); // PENIRQ 408 omap_cfg_reg(P20_1610_GPIO4); // PENIRQ
347 set_irq_type(OMAP_GPIO_IRQ(4), IRQT_FALLING); 409 set_irq_type(OMAP_GPIO_IRQ(4), IRQT_FALLING);
@@ -372,6 +434,15 @@ static void __init osk_mistral_init(void)
372 } else 434 } else
373 printk(KERN_ERR "OSK+Mistral: wakeup button is awol\n"); 435 printk(KERN_ERR "OSK+Mistral: wakeup button is awol\n");
374 436
437 /* LCD: backlight, and power; power controls other devices on the
438 * board, like the touchscreen, EEPROM, and wakeup (!) switch.
439 */
440 omap_cfg_reg(PWL);
441 if (omap_request_gpio(2) == 0) {
442 omap_set_gpio_direction(2, 0 /* out */);
443 omap_set_gpio_dataout(2, 1 /* on */);
444 }
445
375 platform_add_devices(mistral_devices, ARRAY_SIZE(mistral_devices)); 446 platform_add_devices(mistral_devices, ARRAY_SIZE(mistral_devices));
376} 447}
377#else 448#else
@@ -397,6 +468,14 @@ static void __init osk_init(void)
397 omap_board_config_size = ARRAY_SIZE(osk_config); 468 omap_board_config_size = ARRAY_SIZE(osk_config);
398 USB_TRANSCEIVER_CTRL_REG |= (3 << 1); 469 USB_TRANSCEIVER_CTRL_REG |= (3 << 1);
399 470
471 /* irq for tps65010 chip */
472 /* bootloader effectively does: omap_cfg_reg(U19_1610_MPUIO1); */
473 if (gpio_request(OMAP_MPUIO(1), "tps65010") == 0)
474 gpio_direction_input(OMAP_MPUIO(1));
475
476 i2c_register_board_info(1, osk_i2c_board_info,
477 ARRAY_SIZE(osk_i2c_board_info));
478
400 omap_serial_init(); 479 omap_serial_init();
401 osk_mistral_init(); 480 osk_mistral_init();
402} 481}
@@ -406,6 +485,44 @@ static void __init osk_map_io(void)
406 omap1_map_common_io(); 485 omap1_map_common_io();
407} 486}
408 487
488#ifdef CONFIG_TPS65010
489static int __init osk_tps_init(void)
490{
491 if (!machine_is_omap_osk())
492 return 0;
493
494 /* Let LED1 (D9) blink */
495 tps65010_set_led(LED1, BLINK);
496
497 /* Disable LED 2 (D2) */
498 tps65010_set_led(LED2, OFF);
499
500 /* Set GPIO 1 HIGH to disable VBUS power supply;
501 * OHCI driver powers it up/down as needed.
502 */
503 tps65010_set_gpio_out_value(GPIO1, HIGH);
504
505 /* Set GPIO 2 low to turn on LED D3 */
506 tps65010_set_gpio_out_value(GPIO2, HIGH);
507
508 /* Set GPIO 3 low to take ethernet out of reset */
509 tps65010_set_gpio_out_value(GPIO3, LOW);
510
511 /* gpio4 for VDD_DSP */
512 /* FIXME send power to DSP iff it's configured */
513
514 /* Enable LOW_PWR */
515 tps65010_set_low_pwr(ON);
516
517 /* Switch VLDO2 to 3.0V for AIC23 */
518 tps65010_config_vregs1(TPS_LDO2_ENABLE | TPS_VLDO2_3_0V
519 | TPS_LDO1_ENABLE);
520
521 return 0;
522}
523fs_initcall(osk_tps_init);
524#endif
525
409MACHINE_START(OMAP_OSK, "TI-OSK") 526MACHINE_START(OMAP_OSK, "TI-OSK")
410 /* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */ 527 /* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */
411 .phys_io = 0xfff00000, 528 .phys_io = 0xfff00000,
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 015824185629..2f9d00a00135 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -17,49 +17,189 @@
17 17
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/input.h>
20#include <linux/platform_device.h> 21#include <linux/platform_device.h>
21#include <linux/notifier.h> 22#include <linux/mtd/mtd.h>
22#include <linux/clk.h> 23#include <linux/mtd/partitions.h>
24#include <linux/spi/spi.h>
25#include <linux/spi/tsc2102.h>
26#include <linux/interrupt.h>
23 27
28#include <asm/apm.h>
24#include <asm/hardware.h> 29#include <asm/hardware.h>
25#include <asm/mach-types.h> 30#include <asm/mach-types.h>
26#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
27#include <asm/mach/map.h> 32#include <asm/mach/map.h>
33#include <asm/mach/flash.h>
28 34
29#include <asm/arch/gpio.h> 35#include <asm/arch/gpio.h>
30#include <asm/arch/mux.h> 36#include <asm/arch/mux.h>
31#include <asm/arch/usb.h> 37#include <asm/arch/usb.h>
38#include <asm/arch/tc.h>
39#include <asm/arch/dma.h>
32#include <asm/arch/board.h> 40#include <asm/arch/board.h>
41#include <asm/arch/irda.h>
42#include <asm/arch/keypad.h>
33#include <asm/arch/common.h> 43#include <asm/arch/common.h>
44#include <asm/arch/mcbsp.h>
45#include <asm/arch/omap-alsa.h>
34 46
35static void __init omap_generic_init_irq(void) 47static void __init omap_palmte_init_irq(void)
36{ 48{
37 omap1_init_common_hw(); 49 omap1_init_common_hw();
38 omap_init_irq(); 50 omap_init_irq();
51 omap_gpio_init();
39} 52}
40 53
54static int palmte_keymap[] = {
55 KEY(0, 0, KEY_F1),
56 KEY(0, 1, KEY_F2),
57 KEY(0, 2, KEY_F3),
58 KEY(0, 3, KEY_F4),
59 KEY(0, 4, KEY_POWER),
60 KEY(1, 0, KEY_LEFT),
61 KEY(1, 1, KEY_DOWN),
62 KEY(1, 2, KEY_UP),
63 KEY(1, 3, KEY_RIGHT),
64 KEY(1, 4, KEY_CENTER),
65 0,
66};
67
68static struct omap_kp_platform_data palmte_kp_data = {
69 .rows = 8,
70 .cols = 8,
71 .keymap = palmte_keymap,
72 .rep = 1,
73 .delay = 12,
74};
75
76static struct resource palmte_kp_resources[] = {
77 [0] = {
78 .start = INT_KEYBOARD,
79 .end = INT_KEYBOARD,
80 .flags = IORESOURCE_IRQ,
81 },
82};
83
84static struct platform_device palmte_kp_device = {
85 .name = "omap-keypad",
86 .id = -1,
87 .dev = {
88 .platform_data = &palmte_kp_data,
89 },
90 .num_resources = ARRAY_SIZE(palmte_kp_resources),
91 .resource = palmte_kp_resources,
92};
93
94static struct mtd_partition palmte_rom_partitions[] = {
95 /* PalmOS "Small ROM", contains the bootloader and the debugger */
96 {
97 .name = "smallrom",
98 .offset = 0,
99 .size = 0xa000,
100 .mask_flags = MTD_WRITEABLE,
101 },
102 /* PalmOS "Big ROM", a filesystem with all the OS code and data */
103 {
104 .name = "bigrom",
105 .offset = SZ_128K,
106 /*
107 * 0x5f0000 bytes big in the multi-language ("EFIGS") version,
108 * 0x7b0000 bytes in the English-only ("enUS") version.
109 */
110 .size = 0x7b0000,
111 .mask_flags = MTD_WRITEABLE,
112 },
113};
114
115static struct flash_platform_data palmte_rom_data = {
116 .map_name = "map_rom",
117 .width = 2,
118 .parts = palmte_rom_partitions,
119 .nr_parts = ARRAY_SIZE(palmte_rom_partitions),
120};
121
122static struct resource palmte_rom_resource = {
123 .start = OMAP_CS0_PHYS,
124 .end = OMAP_CS0_PHYS + SZ_8M - 1,
125 .flags = IORESOURCE_MEM,
126};
127
128static struct platform_device palmte_rom_device = {
129 .name = "omapflash",
130 .id = -1,
131 .dev = {
132 .platform_data = &palmte_rom_data,
133 },
134 .num_resources = 1,
135 .resource = &palmte_rom_resource,
136};
137
41static struct platform_device palmte_lcd_device = { 138static struct platform_device palmte_lcd_device = {
42 .name = "lcd_palmte", 139 .name = "lcd_palmte",
43 .id = -1, 140 .id = -1,
44}; 141};
45 142
143static struct omap_backlight_config palmte_backlight_config = {
144 .default_intensity = 0xa0,
145};
146
147static struct platform_device palmte_backlight_device = {
148 .name = "omap-bl",
149 .id = -1,
150 .dev = {
151 .platform_data = &palmte_backlight_config,
152 },
153};
154
155static struct omap_irda_config palmte_irda_config = {
156 .transceiver_cap = IR_SIRMODE,
157 .rx_channel = OMAP_DMA_UART3_RX,
158 .tx_channel = OMAP_DMA_UART3_TX,
159 .dest_start = UART3_THR,
160 .src_start = UART3_RHR,
161 .tx_trigger = 0,
162 .rx_trigger = 0,
163};
164
165static struct resource palmte_irda_resources[] = {
166 [0] = {
167 .start = INT_UART3,
168 .end = INT_UART3,
169 .flags = IORESOURCE_IRQ,
170 },
171};
172
173static struct platform_device palmte_irda_device = {
174 .name = "omapirda",
175 .id = -1,
176 .dev = {
177 .platform_data = &palmte_irda_config,
178 },
179 .num_resources = ARRAY_SIZE(palmte_irda_resources),
180 .resource = palmte_irda_resources,
181};
182
46static struct platform_device *devices[] __initdata = { 183static struct platform_device *devices[] __initdata = {
184 &palmte_rom_device,
185 &palmte_kp_device,
47 &palmte_lcd_device, 186 &palmte_lcd_device,
187 &palmte_backlight_device,
188 &palmte_irda_device,
48}; 189};
49 190
50static struct omap_usb_config palmte_usb_config __initdata = { 191static struct omap_usb_config palmte_usb_config __initdata = {
51 .register_dev = 1, 192 .register_dev = 1, /* Mini-B only receptacle */
52 .hmc_mode = 0, 193 .hmc_mode = 0,
53 .pins[0] = 3, 194 .pins[0] = 2,
54}; 195};
55 196
56static struct omap_mmc_config palmte_mmc_config __initdata = { 197static struct omap_mmc_config palmte_mmc_config __initdata = {
57 .mmc [0] = { 198 .mmc[0] = {
58 .enabled = 1, 199 .enabled = 1,
59 .wire4 = 1, 200 .wp_pin = PALMTE_MMC_WP_GPIO,
60 .wp_pin = OMAP_MPUIO(3), 201 .power_pin = PALMTE_MMC_POWER_GPIO,
61 .power_pin = -1, 202 .switch_pin = PALMTE_MMC_SWITCH_GPIO,
62 .switch_pin = -1,
63 }, 203 },
64}; 204};
65 205
@@ -67,21 +207,222 @@ static struct omap_lcd_config palmte_lcd_config __initdata = {
67 .ctrl_name = "internal", 207 .ctrl_name = "internal",
68}; 208};
69 209
210static struct omap_uart_config palmte_uart_config __initdata = {
211 .enabled_uarts = (1 << 0) | (1 << 1) | (0 << 2),
212};
213
214static struct omap_mcbsp_reg_cfg palmte_mcbsp1_regs = {
215 .spcr2 = FRST | GRST | XRST | XINTM(3),
216 .xcr2 = XDATDLY(1) | XFIG,
217 .xcr1 = XWDLEN1(OMAP_MCBSP_WORD_32),
218 .pcr0 = SCLKME | FSXP | CLKXP,
219};
220
221static struct omap_alsa_codec_config palmte_alsa_config = {
222 .name = "TSC2102 audio",
223 .mcbsp_regs_alsa = &palmte_mcbsp1_regs,
224 .codec_configure_dev = NULL, /* tsc2102_configure, */
225 .codec_set_samplerate = NULL, /* tsc2102_set_samplerate, */
226 .codec_clock_setup = NULL, /* tsc2102_clock_setup, */
227 .codec_clock_on = NULL, /* tsc2102_clock_on, */
228 .codec_clock_off = NULL, /* tsc2102_clock_off, */
229 .get_default_samplerate = NULL, /* tsc2102_get_default_samplerate, */
230};
231
232#ifdef CONFIG_APM
233/*
234 * Values measured in 10 minute intervals averaged over 10 samples.
235 * May differ slightly from device to device but should be accurate
236 * enough to give basic idea of battery life left and trigger
237 * potential alerts.
238 */
239static const int palmte_battery_sample[] = {
240 2194, 2157, 2138, 2120,
241 2104, 2089, 2075, 2061,
242 2048, 2038, 2026, 2016,
243 2008, 1998, 1989, 1980,
244 1970, 1958, 1945, 1928,
245 1910, 1888, 1860, 1827,
246 1791, 1751, 1709, 1656,
247};
248
249#define INTERVAL 10
250#define BATTERY_HIGH_TRESHOLD 66
251#define BATTERY_LOW_TRESHOLD 33
252
253static void palmte_get_power_status(struct apm_power_info *info, int *battery)
254{
255 int charging, batt, hi, lo, mid;
256
257 charging = !omap_get_gpio_datain(PALMTE_DC_GPIO);
258 batt = battery[0];
259 if (charging)
260 batt -= 60;
261
262 hi = ARRAY_SIZE(palmte_battery_sample);
263 lo = 0;
264
265 info->battery_flag = 0;
266 info->units = APM_UNITS_MINS;
267
268 if (batt > palmte_battery_sample[lo]) {
269 info->battery_life = 100;
270 info->time = INTERVAL * ARRAY_SIZE(palmte_battery_sample);
271 } else if (batt <= palmte_battery_sample[hi - 1]) {
272 info->battery_life = 0;
273 info->time = 0;
274 } else {
275 while (hi > lo + 1) {
276 mid = (hi + lo) >> 2;
277 if (batt <= palmte_battery_sample[mid])
278 lo = mid;
279 else
280 hi = mid;
281 }
282
283 mid = palmte_battery_sample[lo] - palmte_battery_sample[hi];
284 hi = palmte_battery_sample[lo] - batt;
285 info->battery_life = 100 - (100 * lo + 100 * hi / mid) /
286 ARRAY_SIZE(palmte_battery_sample);
287 info->time = INTERVAL * (ARRAY_SIZE(palmte_battery_sample) -
288 lo) - INTERVAL * hi / mid;
289 }
290
291 if (charging) {
292 info->ac_line_status = APM_AC_ONLINE;
293 info->battery_status = APM_BATTERY_STATUS_CHARGING;
294 info->battery_flag |= APM_BATTERY_FLAG_CHARGING;
295 } else {
296 info->ac_line_status = APM_AC_OFFLINE;
297 if (info->battery_life > BATTERY_HIGH_TRESHOLD)
298 info->battery_status = APM_BATTERY_STATUS_HIGH;
299 else if (info->battery_life > BATTERY_LOW_TRESHOLD)
300 info->battery_status = APM_BATTERY_STATUS_LOW;
301 else
302 info->battery_status = APM_BATTERY_STATUS_CRITICAL;
303 }
304
305 if (info->battery_life > BATTERY_HIGH_TRESHOLD)
306 info->battery_flag |= APM_BATTERY_FLAG_HIGH;
307 else if (info->battery_life > BATTERY_LOW_TRESHOLD)
308 info->battery_flag |= APM_BATTERY_FLAG_LOW;
309 else
310 info->battery_flag |= APM_BATTERY_FLAG_CRITICAL;
311}
312#else
313#define palmte_get_power_status NULL
314#endif
315
316static struct tsc2102_config palmte_tsc2102_config = {
317 .use_internal = 0,
318 .monitor = TSC_BAT1 | TSC_AUX | TSC_TEMP,
319 .temp_at25c = { 2200, 2615 },
320 .apm_report = palmte_get_power_status,
321 .alsa_config = &palmte_alsa_config,
322};
323
70static struct omap_board_config_kernel palmte_config[] = { 324static struct omap_board_config_kernel palmte_config[] = {
71 { OMAP_TAG_USB, &palmte_usb_config }, 325 { OMAP_TAG_USB, &palmte_usb_config },
72 { OMAP_TAG_MMC, &palmte_mmc_config }, 326 { OMAP_TAG_MMC, &palmte_mmc_config },
73 { OMAP_TAG_LCD, &palmte_lcd_config }, 327 { OMAP_TAG_LCD, &palmte_lcd_config },
328 { OMAP_TAG_UART, &palmte_uart_config },
74}; 329};
75 330
76static void __init omap_generic_init(void) 331static struct spi_board_info palmte_spi_info[] __initdata = {
332 {
333 .modalias = "tsc2102",
334 .bus_num = 2, /* uWire (officially) */
335 .chip_select = 0, /* As opposed to 3 */
336 .irq = OMAP_GPIO_IRQ(PALMTE_PINTDAV_GPIO),
337 .platform_data = &palmte_tsc2102_config,
338 .max_speed_hz = 8000000,
339 },
340};
341
342/* Periodically check for changes on important input pins */
343struct timer_list palmte_pin_timer;
344int prev_power, prev_headphones;
345
346static void palmte_pin_handler(unsigned long data) {
347 int power, headphones;
348
349 power = !omap_get_gpio_datain(PALMTE_DC_GPIO);
350 headphones = omap_get_gpio_datain(PALMTE_HEADPHONES_GPIO);
351
352 if (power && !prev_power)
353 printk(KERN_INFO "PM: cable connected\n");
354 else if (!power && prev_power)
355 printk(KERN_INFO "PM: cable disconnected\n");
356
357 if (headphones && !prev_headphones) {
358 /* Headphones connected, disable speaker */
359 omap_set_gpio_dataout(PALMTE_SPEAKER_GPIO, 0);
360 printk(KERN_INFO "PM: speaker off\n");
361 } else if (!headphones && prev_headphones) {
362 /* Headphones unplugged, re-enable speaker */
363 omap_set_gpio_dataout(PALMTE_SPEAKER_GPIO, 1);
364 printk(KERN_INFO "PM: speaker on\n");
365 }
366
367 prev_power = power;
368 prev_headphones = headphones;
369 mod_timer(&palmte_pin_timer, jiffies + msecs_to_jiffies(500));
370}
371
372static void __init palmte_gpio_setup(void)
373{
374 /* Set TSC2102 PINTDAV pin as input */
375 if (omap_request_gpio(PALMTE_PINTDAV_GPIO)) {
376 printk(KERN_ERR "Could not reserve PINTDAV GPIO!\n");
377 return;
378 }
379 omap_set_gpio_direction(PALMTE_PINTDAV_GPIO, 1);
380
381 /* Monitor cable-connected signals */
382 if (omap_request_gpio(PALMTE_DC_GPIO) ||
383 omap_request_gpio(PALMTE_USB_OR_DC_GPIO) ||
384 omap_request_gpio(PALMTE_USBDETECT_GPIO)) {
385 printk(KERN_ERR "Could not reserve cable signal GPIO!\n");
386 return;
387 }
388 omap_set_gpio_direction(PALMTE_DC_GPIO, 1);
389 omap_set_gpio_direction(PALMTE_USB_OR_DC_GPIO, 1);
390 omap_set_gpio_direction(PALMTE_USBDETECT_GPIO, 1);
391
392 /* Set speaker-enable pin as output */
393 if (omap_request_gpio(PALMTE_SPEAKER_GPIO)) {
394 printk(KERN_ERR "Could not reserve speaker GPIO!\n");
395 return;
396 }
397 omap_set_gpio_direction(PALMTE_SPEAKER_GPIO, 0);
398
399 /* Monitor the headphones-connected signal */
400 if (omap_request_gpio(PALMTE_HEADPHONES_GPIO)) {
401 printk(KERN_ERR "Could not reserve headphones signal GPIO!\n");
402 return;
403 }
404 omap_set_gpio_direction(PALMTE_HEADPHONES_GPIO, 1);
405
406 prev_power = omap_get_gpio_datain(PALMTE_DC_GPIO);
407 prev_headphones = !omap_get_gpio_datain(PALMTE_HEADPHONES_GPIO);
408 setup_timer(&palmte_pin_timer, palmte_pin_handler, 0);
409 palmte_pin_handler(0);
410}
411
412static void __init omap_palmte_init(void)
77{ 413{
78 omap_board_config = palmte_config; 414 omap_board_config = palmte_config;
79 omap_board_config_size = ARRAY_SIZE(palmte_config); 415 omap_board_config_size = ARRAY_SIZE(palmte_config);
80 416
81 platform_add_devices(devices, ARRAY_SIZE(devices)); 417 platform_add_devices(devices, ARRAY_SIZE(devices));
418
419 spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info));
420
421 omap_serial_init();
422 palmte_gpio_setup();
82} 423}
83 424
84static void __init omap_generic_map_io(void) 425static void __init omap_palmte_map_io(void)
85{ 426{
86 omap1_map_common_io(); 427 omap1_map_common_io();
87} 428}
@@ -90,8 +431,8 @@ MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
90 .phys_io = 0xfff00000, 431 .phys_io = 0xfff00000,
91 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 432 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
92 .boot_params = 0x10000100, 433 .boot_params = 0x10000100,
93 .map_io = omap_generic_map_io, 434 .map_io = omap_palmte_map_io,
94 .init_irq = omap_generic_init_irq, 435 .init_irq = omap_palmte_init_irq,
95 .init_machine = omap_generic_init, 436 .init_machine = omap_palmte_init,
96 .timer = &omap_timer, 437 .timer = &omap_timer,
97MACHINE_END 438MACHINE_END
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
new file mode 100644
index 000000000000..e47010fec275
--- /dev/null
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -0,0 +1,357 @@
1/*
2 * linux/arch/arm/mach-omap1/board-palmtt.c
3 *
4 * Modified from board-palmtt2.c
5 *
6 * Modified and amended for Palm Tungsten|T
7 * by Marek Vasut <marek.vasut@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/delay.h>
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/notifier.h>
19#include <linux/clk.h>
20#include <linux/input.h>
21#include <linux/interrupt.h>
22#include <linux/mtd/mtd.h>
23#include <linux/mtd/partitions.h>
24#include <linux/leds.h>
25
26#include <asm/hardware.h>
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <asm/mach/map.h>
30#include <asm/mach/flash.h>
31
32#include <asm/arch/led.h>
33#include <asm/arch/mcbsp.h>
34#include <asm/arch/gpio.h>
35#include <asm/arch/mux.h>
36#include <asm/arch/usb.h>
37#include <asm/arch/dma.h>
38#include <asm/arch/tc.h>
39#include <asm/arch/board.h>
40#include <asm/arch/irda.h>
41#include <asm/arch/keypad.h>
42#include <asm/arch/common.h>
43#include <asm/arch/omap-alsa.h>
44
45#include <linux/input.h>
46#include <linux/spi/spi.h>
47#include <linux/spi/ads7846.h>
48
49static int palmtt_keymap[] = {
50 KEY(0, 0, KEY_ESC),
51 KEY(0, 1, KEY_SPACE),
52 KEY(0, 2, KEY_LEFTCTRL),
53 KEY(0, 3, KEY_TAB),
54 KEY(0, 4, KEY_ENTER),
55 KEY(1, 0, KEY_LEFT),
56 KEY(1, 1, KEY_DOWN),
57 KEY(1, 2, KEY_UP),
58 KEY(1, 3, KEY_RIGHT),
59 KEY(2, 0, KEY_SLEEP),
60 KEY(2, 4, KEY_Y),
61 0
62};
63
64static struct mtd_partition palmtt_partitions[] = {
65 {
66 .name = "write8k",
67 .offset = 0,
68 .size = SZ_8K,
69 .mask_flags = 0,
70 },
71 {
72 .name = "PalmOS-BootLoader(ro)",
73 .offset = SZ_8K,
74 .size = 7 * SZ_8K,
75 .mask_flags = MTD_WRITEABLE,
76 },
77 {
78 .name = "u-boot",
79 .offset = MTDPART_OFS_APPEND,
80 .size = 8 * SZ_8K,
81 .mask_flags = 0,
82 },
83 {
84 .name = "PalmOS-FS(ro)",
85 .offset = MTDPART_OFS_APPEND,
86 .size = 7 * SZ_1M + 4 * SZ_64K - 16 * SZ_8K,
87 .mask_flags = MTD_WRITEABLE,
88 },
89 {
90 .name = "u-boot(rez)",
91 .offset = MTDPART_OFS_APPEND,
92 .size = SZ_128K,
93 .mask_flags = 0
94 },
95 {
96 .name = "empty",
97 .offset = MTDPART_OFS_APPEND,
98 .size = MTDPART_SIZ_FULL,
99 .mask_flags = 0
100 }
101};
102
103static struct flash_platform_data palmtt_flash_data = {
104 .map_name = "cfi_probe",
105 .width = 2,
106 .parts = palmtt_partitions,
107 .nr_parts = ARRAY_SIZE(palmtt_partitions),
108};
109
110static struct resource palmtt_flash_resource = {
111 .start = OMAP_CS0_PHYS,
112 .end = OMAP_CS0_PHYS + SZ_8M - 1,
113 .flags = IORESOURCE_MEM,
114};
115
116static struct platform_device palmtt_flash_device = {
117 .name = "omapflash",
118 .id = 0,
119 .dev = {
120 .platform_data = &palmtt_flash_data,
121 },
122 .num_resources = 1,
123 .resource = &palmtt_flash_resource,
124};
125
126#define DEFAULT_BITPERSAMPLE 16
127
128static struct omap_mcbsp_reg_cfg mcbsp_regs = {
129 .spcr2 = FREE | FRST | GRST | XRST | XINTM(3),
130 .spcr1 = RINTM(3) | RRST,
131 .rcr2 = RPHASE | RFRLEN2(OMAP_MCBSP_WORD_8) |
132 RWDLEN2(OMAP_MCBSP_WORD_16) | RDATDLY(0),
133 .rcr1 = RFRLEN1(OMAP_MCBSP_WORD_8) |
134 RWDLEN1(OMAP_MCBSP_WORD_16),
135 .xcr2 = XPHASE | XFRLEN2(OMAP_MCBSP_WORD_8) |
136 XWDLEN2(OMAP_MCBSP_WORD_16) | XDATDLY(0) | XFIG,
137 .xcr1 = XFRLEN1(OMAP_MCBSP_WORD_8) |
138 XWDLEN1(OMAP_MCBSP_WORD_16),
139 .srgr1 = FWID(DEFAULT_BITPERSAMPLE - 1),
140 .srgr2 = GSYNC | CLKSP | FSGM |
141 FPER(DEFAULT_BITPERSAMPLE * 2 - 1),
142 .pcr0 = CLKXP | CLKRP, /* mcbsp: slave */
143};
144
145static struct omap_alsa_codec_config alsa_config = {
146 .name = "PalmTT AIC23",
147 .mcbsp_regs_alsa = &mcbsp_regs,
148 .codec_configure_dev = NULL, // aic23_configure,
149 .codec_set_samplerate = NULL, // aic23_set_samplerate,
150 .codec_clock_setup = NULL, // aic23_clock_setup,
151 .codec_clock_on = NULL, // aic23_clock_on,
152 .codec_clock_off = NULL, // aic23_clock_off,
153 .get_default_samplerate = NULL, // aic23_get_default_samplerate,
154};
155
156static struct platform_device palmtt_mcbsp1_device = {
157 .name = "omap_alsa_mcbsp",
158 .id = 1,
159 .dev = {
160 .platform_data = &alsa_config,
161 },
162};
163
164static struct resource palmtt_kp_resources[] = {
165 [0] = {
166 .start = INT_KEYBOARD,
167 .end = INT_KEYBOARD,
168 .flags = IORESOURCE_IRQ,
169 },
170};
171
172static struct omap_kp_platform_data palmtt_kp_data = {
173 .rows = 6,
174 .cols = 3,
175 .keymap = palmtt_keymap,
176};
177
178static struct platform_device palmtt_kp_device = {
179 .name = "omap-keypad",
180 .id = -1,
181 .dev = {
182 .platform_data = &palmtt_kp_data,
183 },
184 .num_resources = ARRAY_SIZE(palmtt_kp_resources),
185 .resource = palmtt_kp_resources,
186};
187
188static struct platform_device palmtt_lcd_device = {
189 .name = "lcd_palmtt",
190 .id = -1,
191};
192static struct omap_irda_config palmtt_irda_config = {
193 .transceiver_cap = IR_SIRMODE,
194 .rx_channel = OMAP_DMA_UART3_RX,
195 .tx_channel = OMAP_DMA_UART3_TX,
196 .dest_start = UART3_THR,
197 .src_start = UART3_RHR,
198 .tx_trigger = 0,
199 .rx_trigger = 0,
200};
201
202static struct resource palmtt_irda_resources[] = {
203 [0] = {
204 .start = INT_UART3,
205 .end = INT_UART3,
206 .flags = IORESOURCE_IRQ,
207 },
208};
209
210static struct platform_device palmtt_irda_device = {
211 .name = "omapirda",
212 .id = -1,
213 .dev = {
214 .platform_data = &palmtt_irda_config,
215 },
216 .num_resources = ARRAY_SIZE(palmtt_irda_resources),
217 .resource = palmtt_irda_resources,
218};
219
220static struct platform_device palmtt_spi_device = {
221 .name = "spi_palmtt",
222 .id = -1,
223};
224
225static struct omap_backlight_config palmtt_backlight_config = {
226 .default_intensity = 0xa0,
227};
228
229static struct platform_device palmtt_backlight_device = {
230 .name = "omap-bl",
231 .id = -1,
232 .dev = {
233 .platform_data= &palmtt_backlight_config,
234 },
235};
236
237static struct omap_led_config palmtt_led_config[] = {
238 {
239 .cdev = {
240 .name = "palmtt:led0",
241 },
242 .gpio = PALMTT_LED_GPIO,
243 },
244};
245
246static struct omap_led_platform_data palmtt_led_data = {
247 .nr_leds = ARRAY_SIZE(palmtt_led_config),
248 .leds = palmtt_led_config,
249};
250
251static struct platform_device palmtt_led_device = {
252 .name = "omap-led",
253 .id = -1,
254 .dev = {
255 .platform_data = &palmtt_led_data,
256 },
257};
258
259static struct platform_device *palmtt_devices[] __initdata = {
260 &palmtt_flash_device,
261 &palmtt_mcbsp1_device,
262 &palmtt_kp_device,
263 &palmtt_lcd_device,
264 &palmtt_irda_device,
265 &palmtt_spi_device,
266 &palmtt_backlight_device,
267 &palmtt_led_device,
268};
269
270static int palmtt_get_pendown_state(void)
271{
272 return !omap_get_gpio_datain(6);
273}
274
275static const struct ads7846_platform_data palmtt_ts_info = {
276 .model = 7846,
277 .vref_delay_usecs = 100, /* internal, no capacitor */
278 .x_plate_ohms = 419,
279 .y_plate_ohms = 486,
280 .get_pendown_state = palmtt_get_pendown_state,
281};
282
283static struct spi_board_info __initdata palmtt_boardinfo[] = {
284 {
285 /* MicroWire (bus 2) CS0 has an ads7846e */
286 .modalias = "ads7846",
287 .platform_data = &palmtt_ts_info,
288 .irq = OMAP_GPIO_IRQ(6),
289 .max_speed_hz = 120000 /* max sample rate at 3V */
290 * 26 /* command + data + overhead */,
291 .bus_num = 2,
292 .chip_select = 0,
293 }
294};
295
296static void __init omap_palmtt_init_irq(void)
297{
298 omap1_init_common_hw();
299 omap_init_irq();
300}
301
302static struct omap_usb_config palmtt_usb_config __initdata = {
303 .register_dev = 1,
304 .hmc_mode = 0,
305 .pins[0] = 2,
306};
307
308static struct omap_lcd_config palmtt_lcd_config __initdata = {
309 .ctrl_name = "internal",
310};
311
312static struct omap_uart_config palmtt_uart_config __initdata = {
313 .enabled_uarts = (1 << 0) | (1 << 1) | (0 << 2),
314};
315
316static struct omap_board_config_kernel palmtt_config[] = {
317 { OMAP_TAG_USB, &palmtt_usb_config },
318 { OMAP_TAG_LCD, &palmtt_lcd_config },
319 { OMAP_TAG_UART, &palmtt_uart_config },
320};
321
322static void __init omap_mpu_wdt_mode(int mode) {
323 if (mode)
324 omap_writew(0x8000, OMAP_WDT_TIMER_MODE);
325 else {
326 omap_writew(0x00f5, OMAP_WDT_TIMER_MODE);
327 omap_writew(0x00a0, OMAP_WDT_TIMER_MODE);
328 }
329}
330
331static void __init omap_palmtt_init(void)
332{
333 omap_mpu_wdt_mode(0);
334
335 omap_board_config = palmtt_config;
336 omap_board_config_size = ARRAY_SIZE(palmtt_config);
337
338 platform_add_devices(palmtt_devices, ARRAY_SIZE(palmtt_devices));
339
340 spi_register_board_info(palmtt_boardinfo,ARRAY_SIZE(palmtt_boardinfo));
341 omap_serial_init();
342}
343
344static void __init omap_palmtt_map_io(void)
345{
346 omap1_map_common_io();
347}
348
349MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
350 .phys_io = 0xfff00000,
351 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
352 .boot_params = 0x10000100,
353 .map_io = omap_palmtt_map_io,
354 .init_irq = omap_palmtt_init_irq,
355 .init_machine = omap_palmtt_init,
356 .timer = &omap_timer,
357MACHINE_END
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
new file mode 100644
index 000000000000..c275d517764a
--- /dev/null
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -0,0 +1,383 @@
1/*
2 * linux/arch/arm/mach-omap1/board-palmz71.c
3 *
4 * Modified from board-generic.c
5 *
6 * Support for the Palm Zire71 PDA.
7 *
8 * Original version : Laurent Gonzalez
9 *
10 * Modified for zire71 : Marek Vasut
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 */
16
17#include <linux/delay.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/platform_device.h>
21#include <linux/notifier.h>
22#include <linux/clk.h>
23#include <linux/irq.h>
24#include <linux/input.h>
25#include <linux/interrupt.h>
26#include <linux/mtd/mtd.h>
27#include <linux/mtd/partitions.h>
28
29#include <asm/hardware.h>
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <asm/mach/map.h>
33#include <asm/mach/flash.h>
34
35#include <asm/arch/mcbsp.h>
36#include <asm/arch/gpio.h>
37#include <asm/arch/mux.h>
38#include <asm/arch/usb.h>
39#include <asm/arch/dma.h>
40#include <asm/arch/tc.h>
41#include <asm/arch/board.h>
42#include <asm/arch/irda.h>
43#include <asm/arch/keypad.h>
44#include <asm/arch/common.h>
45#include <asm/arch/omap-alsa.h>
46
47#include <linux/input.h>
48#include <linux/spi/spi.h>
49#include <linux/spi/ads7846.h>
50
51static void __init
52omap_palmz71_init_irq(void)
53{
54 omap1_init_common_hw();
55 omap_init_irq();
56 omap_gpio_init();
57}
58
59static int palmz71_keymap[] = {
60 KEY(0, 0, KEY_F1),
61 KEY(0, 1, KEY_F2),
62 KEY(0, 2, KEY_F3),
63 KEY(0, 3, KEY_F4),
64 KEY(0, 4, KEY_POWER),
65 KEY(1, 0, KEY_LEFT),
66 KEY(1, 1, KEY_DOWN),
67 KEY(1, 2, KEY_UP),
68 KEY(1, 3, KEY_RIGHT),
69 KEY(1, 4, KEY_CENTER),
70 KEY(2, 0, KEY_CAMERA),
71 0,
72};
73
74static struct omap_kp_platform_data palmz71_kp_data = {
75 .rows = 8,
76 .cols = 8,
77 .keymap = palmz71_keymap,
78 .rep = 1,
79 .delay = 80,
80};
81
82static struct resource palmz71_kp_resources[] = {
83 [0] = {
84 .start = INT_KEYBOARD,
85 .end = INT_KEYBOARD,
86 .flags = IORESOURCE_IRQ,
87 },
88};
89
90static struct platform_device palmz71_kp_device = {
91 .name = "omap-keypad",
92 .id = -1,
93 .dev = {
94 .platform_data = &palmz71_kp_data,
95 },
96 .num_resources = ARRAY_SIZE(palmz71_kp_resources),
97 .resource = palmz71_kp_resources,
98};
99
100static struct mtd_partition palmz71_rom_partitions[] = {
101 /* PalmOS "Small ROM", contains the bootloader and the debugger */
102 {
103 .name = "smallrom",
104 .offset = 0,
105 .size = 0xa000,
106 .mask_flags = MTD_WRITEABLE,
107 },
108 /* PalmOS "Big ROM", a filesystem with all the OS code and data */
109 {
110 .name = "bigrom",
111 .offset = SZ_128K,
112 /*
113 * 0x5f0000 bytes big in the multi-language ("EFIGS") version,
114 * 0x7b0000 bytes in the English-only ("enUS") version.
115 */
116 .size = 0x7b0000,
117 .mask_flags = MTD_WRITEABLE,
118 },
119};
120
121static struct flash_platform_data palmz71_rom_data = {
122 .map_name = "map_rom",
123 .name = "onboardrom",
124 .width = 2,
125 .parts = palmz71_rom_partitions,
126 .nr_parts = ARRAY_SIZE(palmz71_rom_partitions),
127};
128
129static struct resource palmz71_rom_resource = {
130 .start = OMAP_CS0_PHYS,
131 .end = OMAP_CS0_PHYS + SZ_8M - 1,
132 .flags = IORESOURCE_MEM,
133};
134
135static struct platform_device palmz71_rom_device = {
136 .name = "omapflash",
137 .id = -1,
138 .dev = {
139 .platform_data = &palmz71_rom_data,
140 },
141 .num_resources = 1,
142 .resource = &palmz71_rom_resource,
143};
144
145static struct platform_device palmz71_lcd_device = {
146 .name = "lcd_palmz71",
147 .id = -1,
148};
149
150static struct omap_irda_config palmz71_irda_config = {
151 .transceiver_cap = IR_SIRMODE,
152 .rx_channel = OMAP_DMA_UART3_RX,
153 .tx_channel = OMAP_DMA_UART3_TX,
154 .dest_start = UART3_THR,
155 .src_start = UART3_RHR,
156 .tx_trigger = 0,
157 .rx_trigger = 0,
158};
159
160static struct resource palmz71_irda_resources[] = {
161 [0] = {
162 .start = INT_UART3,
163 .end = INT_UART3,
164 .flags = IORESOURCE_IRQ,
165 },
166};
167
168static struct platform_device palmz71_irda_device = {
169 .name = "omapirda",
170 .id = -1,
171 .dev = {
172 .platform_data = &palmz71_irda_config,
173 },
174 .num_resources = ARRAY_SIZE(palmz71_irda_resources),
175 .resource = palmz71_irda_resources,
176};
177
178static struct platform_device palmz71_spi_device = {
179 .name = "spi_palmz71",
180 .id = -1,
181};
182
183#define DEFAULT_BITPERSAMPLE 16
184
185static struct omap_mcbsp_reg_cfg mcbsp_regs = {
186 .spcr2 = FREE | FRST | GRST | XRST | XINTM(3),
187 .spcr1 = RINTM(3) | RRST,
188 .rcr2 = RPHASE | RFRLEN2(OMAP_MCBSP_WORD_8) |
189 RWDLEN2(OMAP_MCBSP_WORD_16) | RDATDLY(0),
190 .rcr1 = RFRLEN1(OMAP_MCBSP_WORD_8) | RWDLEN1(OMAP_MCBSP_WORD_16),
191 .xcr2 = XPHASE | XFRLEN2(OMAP_MCBSP_WORD_8) |
192 XWDLEN2(OMAP_MCBSP_WORD_16) | XDATDLY(0) | XFIG,
193 .xcr1 = XFRLEN1(OMAP_MCBSP_WORD_8) | XWDLEN1(OMAP_MCBSP_WORD_16),
194 .srgr1 = FWID(DEFAULT_BITPERSAMPLE - 1),
195 .srgr2 = GSYNC | CLKSP | FSGM | FPER(DEFAULT_BITPERSAMPLE * 2 - 1),
196 .pcr0 = CLKXP | CLKRP, /* mcbsp: slave */
197};
198
199static struct omap_alsa_codec_config alsa_config = {
200 .name = "PalmZ71 AIC23",
201 .mcbsp_regs_alsa = &mcbsp_regs,
202 .codec_configure_dev = NULL, /* aic23_configure */
203 .codec_set_samplerate = NULL, /* aic23_set_samplerate */
204 .codec_clock_setup = NULL, /* aic23_clock_setup */
205 .codec_clock_on = NULL, /* aic23_clock_on */
206 .codec_clock_off = NULL, /* aic23_clock_off */
207 .get_default_samplerate = NULL, /* aic23_get_default_samplerate */
208};
209
210static struct platform_device palmz71_mcbsp1_device = {
211 .name = "omap_alsa_mcbsp",
212 .id = 1,
213 .dev = {
214 .platform_data = &alsa_config,
215 },
216};
217
218static struct omap_backlight_config palmz71_backlight_config = {
219 .default_intensity = 0xa0,
220};
221
222static struct platform_device palmz71_backlight_device = {
223 .name = "omap-bl",
224 .id = -1,
225 .dev = {
226 .platform_data = &palmz71_backlight_config,
227 },
228};
229
230static struct platform_device *devices[] __initdata = {
231 &palmz71_rom_device,
232 &palmz71_kp_device,
233 &palmz71_mcbsp1_device,
234 &palmz71_lcd_device,
235 &palmz71_irda_device,
236 &palmz71_spi_device,
237 &palmz71_backlight_device,
238};
239
240static int
241palmz71_get_pendown_state(void)
242{
243 return !omap_get_gpio_datain(PALMZ71_PENIRQ_GPIO);
244}
245
246static const struct ads7846_platform_data palmz71_ts_info = {
247 .model = 7846,
248 .vref_delay_usecs = 100, /* internal, no capacitor */
249 .x_plate_ohms = 419,
250 .y_plate_ohms = 486,
251 .get_pendown_state = palmz71_get_pendown_state,
252};
253
254static struct spi_board_info __initdata palmz71_boardinfo[] = { {
255 /* MicroWire (bus 2) CS0 has an ads7846e */
256 .modalias = "ads7846",
257 .platform_data = &palmz71_ts_info,
258 .irq = OMAP_GPIO_IRQ(PALMZ71_PENIRQ_GPIO),
259 .max_speed_hz = 120000 /* max sample rate at 3V */
260 * 26 /* command + data + overhead */,
261 .bus_num = 2,
262 .chip_select = 0,
263} };
264
265static struct omap_usb_config palmz71_usb_config __initdata = {
266 .register_dev = 1, /* Mini-B only receptacle */
267 .hmc_mode = 0,
268 .pins[0] = 2,
269};
270
271static struct omap_mmc_config palmz71_mmc_config __initdata = {
272 .mmc[0] = {
273 .enabled = 1,
274 .wire4 = 0,
275 .wp_pin = PALMZ71_MMC_WP_GPIO,
276 .power_pin = -1,
277 .switch_pin = PALMZ71_MMC_IN_GPIO,
278 },
279};
280
281static struct omap_lcd_config palmz71_lcd_config __initdata = {
282 .ctrl_name = "internal",
283};
284
285static struct omap_uart_config palmz71_uart_config __initdata = {
286 .enabled_uarts = (1 << 0) | (1 << 1) | (0 << 2),
287};
288
289static struct omap_board_config_kernel palmz71_config[] = {
290 {OMAP_TAG_USB, &palmz71_usb_config},
291 {OMAP_TAG_MMC, &palmz71_mmc_config},
292 {OMAP_TAG_LCD, &palmz71_lcd_config},
293 {OMAP_TAG_UART, &palmz71_uart_config},
294};
295
296static irqreturn_t
297palmz71_powercable(int irq, void *dev_id)
298{
299 if (omap_get_gpio_datain(PALMZ71_USBDETECT_GPIO)) {
300 printk(KERN_INFO "PM: Power cable connected\n");
301 set_irq_type(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO),
302 IRQT_FALLING);
303 } else {
304 printk(KERN_INFO "PM: Power cable disconnected\n");
305 set_irq_type(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO),
306 IRQT_RISING);
307 }
308 return IRQ_HANDLED;
309}
310
311static void __init
312omap_mpu_wdt_mode(int mode)
313{
314 if (mode)
315 omap_writew(0x8000, OMAP_WDT_TIMER_MODE);
316 else {
317 omap_writew(0x00f5, OMAP_WDT_TIMER_MODE);
318 omap_writew(0x00a0, OMAP_WDT_TIMER_MODE);
319 }
320}
321
322static void __init
323palmz71_gpio_setup(int early)
324{
325 if (early) {
326 /* Only set GPIO1 so we have a working serial */
327 omap_set_gpio_dataout(1, 1);
328 omap_set_gpio_direction(1, 0);
329 } else {
330 /* Set MMC/SD host WP pin as input */
331 if (omap_request_gpio(PALMZ71_MMC_WP_GPIO)) {
332 printk(KERN_ERR "Could not reserve WP GPIO!\n");
333 return;
334 }
335 omap_set_gpio_direction(PALMZ71_MMC_WP_GPIO, 1);
336
337 /* Monitor the Power-cable-connected signal */
338 if (omap_request_gpio(PALMZ71_USBDETECT_GPIO)) {
339 printk(KERN_ERR
340 "Could not reserve cable signal GPIO!\n");
341 return;
342 }
343 omap_set_gpio_direction(PALMZ71_USBDETECT_GPIO, 1);
344 if (request_irq(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO),
345 palmz71_powercable, IRQF_SAMPLE_RANDOM,
346 "palmz71-cable", 0))
347 printk(KERN_ERR
348 "IRQ request for power cable failed!\n");
349 palmz71_powercable(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO), 0);
350 }
351}
352
353static void __init
354omap_palmz71_init(void)
355{
356 palmz71_gpio_setup(1);
357 omap_mpu_wdt_mode(0);
358
359 omap_board_config = palmz71_config;
360 omap_board_config_size = ARRAY_SIZE(palmz71_config);
361
362 platform_add_devices(devices, ARRAY_SIZE(devices));
363
364 spi_register_board_info(palmz71_boardinfo,
365 ARRAY_SIZE(palmz71_boardinfo));
366 omap_serial_init();
367 palmz71_gpio_setup(0);
368}
369
370static void __init
371omap_palmz71_map_io(void)
372{
373 omap1_map_common_io();
374}
375
376MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")
377 .phys_io = 0xfff00000,
378 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
379 .boot_params = 0x10000100,.map_io = omap_palmz71_map_io,
380 .init_irq = omap_palmz71_init_irq,
381 .init_machine = omap_palmz71_init,
382 .timer = &omap_timer,
383MACHINE_END
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
new file mode 100644
index 000000000000..2743d639aa05
--- /dev/null
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -0,0 +1,494 @@
1/*
2* linux/arch/arm/mach-omap1/board-sx1.c
3*
4* Modified from board-generic.c
5*
6* Support for the Siemens SX1 mobile phone.
7*
8* Original version : Vladimir Ananiev (Vovan888-at-gmail com)
9*
10* Maintainters : Vladimir Ananiev (aka Vovan888), Sergge
11* oslik.ru
12*
13* This program is free software; you can redistribute it and/or modify
14* it under the terms of the GNU General Public License version 2 as
15* published by the Free Software Foundation.
16*/
17
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/input.h>
21#include <linux/platform_device.h>
22#include <linux/notifier.h>
23#include <linux/mtd/mtd.h>
24#include <linux/mtd/partitions.h>
25#include <linux/types.h>
26#include <linux/i2c.h>
27#include <linux/errno.h>
28
29#include <asm/hardware.h>
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <asm/mach/flash.h>
33#include <asm/mach/map.h>
34
35#include <asm/arch/gpio.h>
36#include <asm/arch/mux.h>
37#include <asm/arch/irda.h>
38#include <asm/arch/usb.h>
39#include <asm/arch/tc.h>
40#include <asm/arch/board.h>
41#include <asm/arch/common.h>
42#include <asm/arch/mcbsp.h>
43#include <asm/arch/omap-alsa.h>
44#include <asm/arch/keypad.h>
45
46/* Write to I2C device */
47int i2c_write_byte(u8 devaddr, u8 regoffset, u8 value)
48{
49 struct i2c_adapter *adap;
50 int err;
51 struct i2c_msg msg[1];
52 unsigned char data[2];
53
54 adap = i2c_get_adapter(0);
55 if (!adap)
56 return -ENODEV;
57 msg->addr = devaddr; /* I2C address of chip */
58 msg->flags = 0;
59 msg->len = 2;
60 msg->buf = data;
61 data[0] = regoffset; /* register num */
62 data[1] = value; /* register data */
63 err = i2c_transfer(adap, msg, 1);
64 if (err >= 0)
65 return 0;
66 return err;
67}
68
69/* Read from I2C device */
70int i2c_read_byte(u8 devaddr, u8 regoffset, u8 * value)
71{
72 struct i2c_adapter *adap;
73 int err;
74 struct i2c_msg msg[1];
75 unsigned char data[2];
76
77 adap = i2c_get_adapter(0);
78 if (!adap)
79 return -ENODEV;
80
81 msg->addr = devaddr; /* I2C address of chip */
82 msg->flags = 0;
83 msg->len = 1;
84 msg->buf = data;
85 data[0] = regoffset; /* register num */
86 err = i2c_transfer(adap, msg, 1);
87
88 msg->addr = devaddr; /* I2C address */
89 msg->flags = I2C_M_RD;
90 msg->len = 1;
91 msg->buf = data;
92 err = i2c_transfer(adap, msg, 1);
93 *value = data[0];
94
95 if (err >= 0)
96 return 0;
97 return err;
98}
99/* set keyboard backlight intensity */
100int sx1_setkeylight(u8 keylight)
101{
102 if (keylight > SOFIA_MAX_LIGHT_VAL)
103 keylight = SOFIA_MAX_LIGHT_VAL;
104 return i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_KEYLIGHT_REG, keylight);
105}
106/* get current keylight intensity */
107int sx1_getkeylight(u8 * keylight)
108{
109 return i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_KEYLIGHT_REG, keylight);
110}
111/* set LCD backlight intensity */
112int sx1_setbacklight(u8 backlight)
113{
114 if (backlight > SOFIA_MAX_LIGHT_VAL)
115 backlight = SOFIA_MAX_LIGHT_VAL;
116 return i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_BACKLIGHT_REG, backlight);
117}
118/* get current LCD backlight intensity */
119int sx1_getbacklight (u8 * backlight)
120{
121 return i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_BACKLIGHT_REG, backlight);
122}
123/* set LCD backlight power on/off */
124int sx1_setmmipower(u8 onoff)
125{
126 int err;
127 u8 dat = 0;
128 err = i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat);
129 if (err < 0)
130 return err;
131 if (onoff)
132 dat |= SOFIA_MMILIGHT_POWER;
133 else
134 dat &= ~SOFIA_MMILIGHT_POWER;
135 return i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat);
136}
137/* set MMC power on/off */
138int sx1_setmmcpower(u8 onoff)
139{
140 int err;
141 u8 dat = 0;
142 err = i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat);
143 if (err < 0)
144 return err;
145 if (onoff)
146 dat |= SOFIA_MMC_POWER;
147 else
148 dat &= ~SOFIA_MMC_POWER;
149 return i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat);
150}
151/* set USB power on/off */
152int sx1_setusbpower(u8 onoff)
153{
154 int err;
155 u8 dat = 0;
156 err = i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat);
157 if (err < 0)
158 return err;
159 if (onoff)
160 dat |= SOFIA_USB_POWER;
161 else
162 dat &= ~SOFIA_USB_POWER;
163 return i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat);
164}
165
166EXPORT_SYMBOL(sx1_setkeylight);
167EXPORT_SYMBOL(sx1_getkeylight);
168EXPORT_SYMBOL(sx1_setbacklight);
169EXPORT_SYMBOL(sx1_getbacklight);
170EXPORT_SYMBOL(sx1_setmmipower);
171EXPORT_SYMBOL(sx1_setmmcpower);
172EXPORT_SYMBOL(sx1_setusbpower);
173
174/*----------- Keypad -------------------------*/
175
176static int sx1_keymap[] = {
177 KEY(5, 3, GROUP_0 | 117), /* camera Qt::Key_F17 */
178 KEY(0, 4, GROUP_0 | 114), /* voice memo Qt::Key_F14 */
179 KEY(1, 4, GROUP_2 | 114), /* voice memo */
180 KEY(2, 4, GROUP_3 | 114), /* voice memo */
181 KEY(0, 0, GROUP_1 | KEY_F12), /* red button Qt::Key_Hangup */
182 KEY(4, 3, GROUP_1 | KEY_LEFT),
183 KEY(2, 3, GROUP_1 | KEY_DOWN),
184 KEY(1, 3, GROUP_1 | KEY_RIGHT),
185 KEY(0, 3, GROUP_1 | KEY_UP),
186 KEY(3, 3, GROUP_1 | KEY_POWER), /* joystick press or Qt::Key_Select */
187 KEY(5, 0, GROUP_1 | KEY_1),
188 KEY(4, 0, GROUP_1 | KEY_2),
189 KEY(3, 0, GROUP_1 | KEY_3),
190 KEY(3, 4, GROUP_1 | KEY_4),
191 KEY(4, 4, GROUP_1 | KEY_5),
192 KEY(5, 4, GROUP_1 | KEY_KPASTERISK),/* "*" */
193 KEY(4, 1, GROUP_1 | KEY_6),
194 KEY(5, 1, GROUP_1 | KEY_7),
195 KEY(3, 1, GROUP_1 | KEY_8),
196 KEY(3, 2, GROUP_1 | KEY_9),
197 KEY(5, 2, GROUP_1 | KEY_0),
198 KEY(4, 2, GROUP_1 | 113), /* # F13 Toggle input method Qt::Key_F13 */
199 KEY(0, 1, GROUP_1 | KEY_F11), /* green button Qt::Key_Call */
200 KEY(1, 2, GROUP_1 | KEY_YEN), /* left soft Qt::Key_Context1 */
201 KEY(2, 2, GROUP_1 | KEY_F8), /* right soft Qt::Key_Back */
202 KEY(2, 1, GROUP_1 | KEY_LEFTSHIFT), /* shift */
203 KEY(1, 1, GROUP_1 | KEY_BACKSPACE), /* C (clear) */
204 KEY(0, 2, GROUP_1 | KEY_F7), /* menu Qt::Key_Menu */
205 0
206};
207
208static struct resource sx1_kp_resources[] = {
209 [0] = {
210 .start = INT_KEYBOARD,
211 .end = INT_KEYBOARD,
212 .flags = IORESOURCE_IRQ,
213 },
214};
215
216static struct omap_kp_platform_data sx1_kp_data = {
217 .rows = 6,
218 .cols = 6,
219 .keymap = sx1_keymap,
220 .keymapsize = ARRAY_SIZE(sx1_keymap),
221 .delay = 80,
222};
223
224static struct platform_device sx1_kp_device = {
225 .name = "omap-keypad",
226 .id = -1,
227 .dev = {
228 .platform_data = &sx1_kp_data,
229 },
230 .num_resources = ARRAY_SIZE(sx1_kp_resources),
231 .resource = sx1_kp_resources,
232};
233
234/*----------- IRDA -------------------------*/
235
236static struct omap_irda_config sx1_irda_data = {
237 .transceiver_cap = IR_SIRMODE,
238 .rx_channel = OMAP_DMA_UART3_RX,
239 .tx_channel = OMAP_DMA_UART3_TX,
240 .dest_start = UART3_THR,
241 .src_start = UART3_RHR,
242 .tx_trigger = 0,
243 .rx_trigger = 0,
244};
245
246static struct resource sx1_irda_resources[] = {
247 [0] = {
248 .start = INT_UART3,
249 .end = INT_UART3,
250 .flags = IORESOURCE_IRQ,
251 },
252};
253
254static u64 irda_dmamask = 0xffffffff;
255
256static struct platform_device sx1_irda_device = {
257 .name = "omapirda",
258 .id = 0,
259 .dev = {
260 .platform_data = &sx1_irda_data,
261 .dma_mask = &irda_dmamask,
262 },
263 .num_resources = ARRAY_SIZE(sx1_irda_resources),
264 .resource = sx1_irda_resources,
265};
266
267/*----------- McBSP & Sound -------------------------*/
268
269/* Playback interface - McBSP1 */
270static struct omap_mcbsp_reg_cfg mcbsp1_regs = {
271 .spcr2 = XINTM(3), /* SPCR2=30 */
272 .spcr1 = RINTM(3), /* SPCR1=30 */
273 .rcr2 = 0, /* RCR2 =00 */
274 .rcr1 = RFRLEN1(1) | RWDLEN1(OMAP_MCBSP_WORD_16), /* RCR1=140 */
275 .xcr2 = 0, /* XCR2 = 0 */
276 .xcr1 = XFRLEN1(1) | XWDLEN1(OMAP_MCBSP_WORD_16), /* XCR1 = 140 */
277 .srgr1 = FWID(15) | CLKGDV(12), /* SRGR1=0f0c */
278 .srgr2 = FSGM | FPER(31), /* SRGR2=101f */
279 .pcr0 = FSXM | FSRM | CLKXM | CLKRM | FSXP | FSRP | CLKXP | CLKRP,
280 /* PCR0 =0f0f */
281};
282
283/* TODO: PCM interface - McBSP2 */
284static struct omap_mcbsp_reg_cfg mcbsp2_regs = {
285 .spcr2 = FRST | GRST | XRST | XINTM(3), /* SPCR2=F1 */
286 .spcr1 = RINTM(3) | RRST, /* SPCR1=30 */
287 .rcr2 = 0, /* RCR2 =00 */
288 .rcr1 = RFRLEN1(1) | RWDLEN1(OMAP_MCBSP_WORD_16), /* RCR1 = 140 */
289 .xcr2 = 0, /* XCR2 = 0 */
290 .xcr1 = XFRLEN1(1) | XWDLEN1(OMAP_MCBSP_WORD_16), /* XCR1 = 140 */
291 .srgr1 = FWID(15) | CLKGDV(12), /* SRGR1=0f0c */
292 .srgr2 = FSGM | FPER(31), /* SRGR2=101f */
293 .pcr0 = FSXM | FSRM | CLKXM | CLKRM | FSXP | FSRP | CLKXP | CLKRP,
294 /* PCR0=0f0f */
295 /* mcbsp: slave */
296};
297
298static struct omap_alsa_codec_config sx1_alsa_config = {
299 .name = "SX1 EGold",
300 .mcbsp_regs_alsa = &mcbsp1_regs,
301};
302
303static struct platform_device sx1_mcbsp1_device = {
304 .name = "omap_alsa_mcbsp",
305 .id = 1,
306 .dev = {
307 .platform_data = &sx1_alsa_config,
308 },
309};
310
311/*----------- MTD -------------------------*/
312
313static struct mtd_partition sx1_partitions[] = {
314 /* bootloader (U-Boot, etc) in first sector */
315 {
316 .name = "bootloader",
317 .offset = 0x01800000,
318 .size = SZ_128K,
319 .mask_flags = MTD_WRITEABLE, /* force read-only */
320 },
321 /* bootloader params in the next sector */
322 {
323 .name = "params",
324 .offset = MTDPART_OFS_APPEND,
325 .size = SZ_128K,
326 .mask_flags = 0,
327 },
328 /* kernel */
329 {
330 .name = "kernel",
331 .offset = MTDPART_OFS_APPEND,
332 .size = SZ_2M - 2 * SZ_128K,
333 .mask_flags = 0
334 },
335 /* file system */
336 {
337 .name = "filesystem",
338 .offset = MTDPART_OFS_APPEND,
339 .size = MTDPART_SIZ_FULL,
340 .mask_flags = 0
341 }
342};
343
344static struct flash_platform_data sx1_flash_data = {
345 .map_name = "cfi_probe",
346 .width = 2,
347 .parts = sx1_partitions,
348 .nr_parts = ARRAY_SIZE(sx1_partitions),
349};
350
351#ifdef CONFIG_SX1_OLD_FLASH
352/* MTD Intel StrataFlash - old flashes */
353static struct resource sx1_old_flash_resource[] = {
354 [0] = {
355 .start = OMAP_CS0_PHYS, /* Physical */
356 .end = OMAP_CS0_PHYS + SZ_16M - 1,,
357 .flags = IORESOURCE_MEM,
358 },
359 [1] = {
360 .start = OMAP_CS1_PHYS,
361 .end = OMAP_CS1_PHYS + SZ_8M - 1,
362 .flags = IORESOURCE_MEM,
363 },
364};
365
366static struct platform_device sx1_flash_device = {
367 .name = "omapflash",
368 .id = 0,
369 .dev = {
370 .platform_data = &sx1_flash_data,
371 },
372 .num_resources = 2,
373 .resource = &sx1_old_flash_resource,
374};
375#else
376/* MTD Intel 4000 flash - new flashes */
377static struct resource sx1_new_flash_resource = {
378 .start = OMAP_CS0_PHYS,
379 .end = OMAP_CS0_PHYS + SZ_32M - 1,
380 .flags = IORESOURCE_MEM,
381};
382
383static struct platform_device sx1_flash_device = {
384 .name = "omapflash",
385 .id = 0,
386 .dev = {
387 .platform_data = &sx1_flash_data,
388 },
389 .num_resources = 1,
390 .resource = &sx1_new_flash_resource,
391};
392#endif
393
394/*----------- USB -------------------------*/
395
396static struct omap_usb_config sx1_usb_config __initdata = {
397 .otg = 0,
398 .register_dev = 1,
399 .register_host = 0,
400 .hmc_mode = 0,
401 .pins[0] = 2,
402 .pins[1] = 0,
403 .pins[2] = 0,
404};
405
406/*----------- MMC -------------------------*/
407
408static struct omap_mmc_config sx1_mmc_config __initdata = {
409 .mmc [0] = {
410 .enabled = 1,
411 .wire4 = 0,
412 .wp_pin = -1,
413 .power_pin = -1, /* power is in Sofia */
414 .switch_pin = OMAP_MPUIO(3),
415 },
416};
417
418/*----------- LCD -------------------------*/
419
420static struct platform_device sx1_lcd_device = {
421 .name = "lcd_sx1",
422 .id = -1,
423};
424
425static struct omap_lcd_config sx1_lcd_config __initdata = {
426 .ctrl_name = "internal",
427};
428
429/*-----------------------------------------*/
430static struct platform_device *sx1_devices[] __initdata = {
431 &sx1_flash_device,
432 &sx1_kp_device,
433 &sx1_lcd_device,
434 &sx1_mcbsp1_device,
435 &sx1_irda_device,
436};
437/*-----------------------------------------*/
438
439static struct omap_uart_config sx1_uart_config __initdata = {
440 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
441};
442
443static struct omap_board_config_kernel sx1_config[] = {
444 { OMAP_TAG_USB, &sx1_usb_config },
445 { OMAP_TAG_MMC, &sx1_mmc_config },
446 { OMAP_TAG_LCD, &sx1_lcd_config },
447 { OMAP_TAG_UART, &sx1_uart_config },
448};
449/*-----------------------------------------*/
450static void __init omap_sx1_init(void)
451{
452 platform_add_devices(sx1_devices, ARRAY_SIZE(sx1_devices));
453
454 omap_board_config = sx1_config;
455 omap_board_config_size = ARRAY_SIZE(sx1_config);
456 omap_serial_init();
457
458 /* turn on USB power */
459 /* sx1_setusbpower(1); cant do it here because i2c is not ready */
460 omap_request_gpio(1); /* A_IRDA_OFF */
461 omap_request_gpio(11); /* A_SWITCH */
462 omap_request_gpio(15); /* A_USB_ON */
463 omap_set_gpio_direction(1, 0);/* gpio1 -> output */
464 omap_set_gpio_direction(11, 0);/* gpio11 -> output */
465 omap_set_gpio_direction(15, 0);/* gpio15 -> output */
466 /* set GPIO data */
467 omap_set_gpio_dataout(1, 1);/*A_IRDA_OFF = 1 */
468 omap_set_gpio_dataout(11, 0);/*A_SWITCH = 0 */
469 omap_set_gpio_dataout(15, 0);/*A_USB_ON = 0 */
470
471}
472/*----------------------------------------*/
473static void __init omap_sx1_init_irq(void)
474{
475 omap1_init_common_hw();
476 omap_init_irq();
477 omap_gpio_init();
478}
479/*----------------------------------------*/
480
481static void __init omap_sx1_map_io(void)
482{
483 omap1_map_common_io();
484}
485
486MACHINE_START(SX1, "OMAP310 based Siemens SX1")
487 .phys_io = 0xfff00000,
488 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
489 .boot_params = 0x10000100,
490 .map_io = omap_sx1_map_io,
491 .init_irq = omap_sx1_init_irq,
492 .init_machine = omap_sx1_init,
493 .timer = &omap_timer,
494MACHINE_END
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index 447a586eb334..214dd19889ac 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -235,7 +235,7 @@ static struct notifier_block panic_block = {
235static int __init voiceblue_setup(void) 235static int __init voiceblue_setup(void)
236{ 236{
237 /* Setup panic notifier */ 237 /* Setup panic notifier */
238 notifier_chain_register(&panic_notifier_list, &panic_block); 238 atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
239 239
240 return 0; 240 return 0;
241} 241}
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index f625f6dd228a..5d9faa68d2ec 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -49,6 +49,15 @@ static void omap1_uart_recalc(struct clk * clk)
49 clk->rate = 12000000; 49 clk->rate = 12000000;
50} 50}
51 51
52static void omap1_sossi_recalc(struct clk *clk)
53{
54 u32 div = omap_readl(MOD_CONF_CTRL_1);
55
56 div = (div >> 17) & 0x7;
57 div++;
58 clk->rate = clk->parent->rate / div;
59}
60
52static int omap1_clk_enable_dsp_domain(struct clk *clk) 61static int omap1_clk_enable_dsp_domain(struct clk *clk)
53{ 62{
54 int retval; 63 int retval;
@@ -396,6 +405,31 @@ static int omap1_set_ext_clk_rate(struct clk * clk, unsigned long rate)
396 return 0; 405 return 0;
397} 406}
398 407
408static int omap1_set_sossi_rate(struct clk *clk, unsigned long rate)
409{
410 u32 l;
411 int div;
412 unsigned long p_rate;
413
414 p_rate = clk->parent->rate;
415 /* Round towards slower frequency */
416 div = (p_rate + rate - 1) / rate;
417 div--;
418 if (div < 0 || div > 7)
419 return -EINVAL;
420
421 l = omap_readl(MOD_CONF_CTRL_1);
422 l &= ~(7 << 17);
423 l |= div << 17;
424 omap_writel(l, MOD_CONF_CTRL_1);
425
426 clk->rate = p_rate / (div + 1);
427 if (unlikely(clk->flags & RATE_PROPAGATES))
428 propagate_rate(clk);
429
430 return 0;
431}
432
399static long omap1_round_ext_clk_rate(struct clk * clk, unsigned long rate) 433static long omap1_round_ext_clk_rate(struct clk * clk, unsigned long rate)
400{ 434{
401 return 96000000 / calc_ext_dsor(rate); 435 return 96000000 / calc_ext_dsor(rate);
diff --git a/arch/arm/mach-omap1/clock.h b/arch/arm/mach-omap1/clock.h
index f7df00205c4a..6eadf72828d8 100644
--- a/arch/arm/mach-omap1/clock.h
+++ b/arch/arm/mach-omap1/clock.h
@@ -17,6 +17,8 @@ static int omap1_clk_enable_generic(struct clk * clk);
17static void omap1_clk_disable_generic(struct clk * clk); 17static void omap1_clk_disable_generic(struct clk * clk);
18static void omap1_ckctl_recalc(struct clk * clk); 18static void omap1_ckctl_recalc(struct clk * clk);
19static void omap1_watchdog_recalc(struct clk * clk); 19static void omap1_watchdog_recalc(struct clk * clk);
20static int omap1_set_sossi_rate(struct clk *clk, unsigned long rate);
21static void omap1_sossi_recalc(struct clk *clk);
20static void omap1_ckctl_recalc_dsp_domain(struct clk * clk); 22static void omap1_ckctl_recalc_dsp_domain(struct clk * clk);
21static int omap1_clk_enable_dsp_domain(struct clk * clk); 23static int omap1_clk_enable_dsp_domain(struct clk * clk);
22static int omap1_clk_set_rate_dsp_domain(struct clk * clk, unsigned long rate); 24static int omap1_clk_set_rate_dsp_domain(struct clk * clk, unsigned long rate);
@@ -168,9 +170,10 @@ static struct clk ck_dpll1 = {
168 170
169static struct arm_idlect1_clk ck_dpll1out = { 171static struct arm_idlect1_clk ck_dpll1out = {
170 .clk = { 172 .clk = {
171 .name = "ck_dpll1out", 173 .name = "ck_dpll1out",
172 .parent = &ck_dpll1, 174 .parent = &ck_dpll1,
173 .flags = CLOCK_IN_OMAP16XX | CLOCK_IDLE_CONTROL, 175 .flags = CLOCK_IN_OMAP16XX | CLOCK_IDLE_CONTROL |
176 ENABLE_REG_32BIT | RATE_PROPAGATES,
174 .enable_reg = (void __iomem *)ARM_IDLECT2, 177 .enable_reg = (void __iomem *)ARM_IDLECT2,
175 .enable_bit = EN_CKOUT_ARM, 178 .enable_bit = EN_CKOUT_ARM,
176 .recalc = &followparent_recalc, 179 .recalc = &followparent_recalc,
@@ -180,6 +183,19 @@ static struct arm_idlect1_clk ck_dpll1out = {
180 .idlect_shift = 12, 183 .idlect_shift = 12,
181}; 184};
182 185
186static struct clk sossi_ck = {
187 .name = "ck_sossi",
188 .parent = &ck_dpll1out.clk,
189 .flags = CLOCK_IN_OMAP16XX | CLOCK_NO_IDLE_PARENT |
190 ENABLE_REG_32BIT,
191 .enable_reg = (void __iomem *)MOD_CONF_CTRL_1,
192 .enable_bit = 16,
193 .recalc = &omap1_sossi_recalc,
194 .set_rate = &omap1_set_sossi_rate,
195 .enable = &omap1_clk_enable_generic,
196 .disable = &omap1_clk_disable_generic,
197};
198
183static struct clk arm_ck = { 199static struct clk arm_ck = {
184 .name = "arm_ck", 200 .name = "arm_ck",
185 .parent = &ck_dpll1, 201 .parent = &ck_dpll1,
@@ -282,7 +298,7 @@ static struct clk arminth_ck16xx = {
282static struct clk dsp_ck = { 298static struct clk dsp_ck = {
283 .name = "dsp_ck", 299 .name = "dsp_ck",
284 .parent = &ck_dpll1, 300 .parent = &ck_dpll1,
285 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | 301 .flags = CLOCK_IN_OMAP310 | CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
286 RATE_CKCTL, 302 RATE_CKCTL,
287 .enable_reg = (void __iomem *)ARM_CKCTL, 303 .enable_reg = (void __iomem *)ARM_CKCTL,
288 .enable_bit = EN_DSPCK, 304 .enable_bit = EN_DSPCK,
@@ -295,7 +311,7 @@ static struct clk dsp_ck = {
295static struct clk dspmmu_ck = { 311static struct clk dspmmu_ck = {
296 .name = "dspmmu_ck", 312 .name = "dspmmu_ck",
297 .parent = &ck_dpll1, 313 .parent = &ck_dpll1,
298 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | 314 .flags = CLOCK_IN_OMAP310 | CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
299 RATE_CKCTL | ALWAYS_ENABLED, 315 RATE_CKCTL | ALWAYS_ENABLED,
300 .rate_offset = CKCTL_DSPMMUDIV_OFFSET, 316 .rate_offset = CKCTL_DSPMMUDIV_OFFSET,
301 .recalc = &omap1_ckctl_recalc, 317 .recalc = &omap1_ckctl_recalc,
@@ -306,7 +322,7 @@ static struct clk dspmmu_ck = {
306static struct clk dspper_ck = { 322static struct clk dspper_ck = {
307 .name = "dspper_ck", 323 .name = "dspper_ck",
308 .parent = &ck_dpll1, 324 .parent = &ck_dpll1,
309 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | 325 .flags = CLOCK_IN_OMAP310 | CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
310 RATE_CKCTL | VIRTUAL_IO_ADDRESS, 326 RATE_CKCTL | VIRTUAL_IO_ADDRESS,
311 .enable_reg = (void __iomem *)DSP_IDLECT2, 327 .enable_reg = (void __iomem *)DSP_IDLECT2,
312 .enable_bit = EN_PERCK, 328 .enable_bit = EN_PERCK,
@@ -320,7 +336,7 @@ static struct clk dspper_ck = {
320static struct clk dspxor_ck = { 336static struct clk dspxor_ck = {
321 .name = "dspxor_ck", 337 .name = "dspxor_ck",
322 .parent = &ck_ref, 338 .parent = &ck_ref,
323 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | 339 .flags = CLOCK_IN_OMAP310 | CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
324 VIRTUAL_IO_ADDRESS, 340 VIRTUAL_IO_ADDRESS,
325 .enable_reg = (void __iomem *)DSP_IDLECT2, 341 .enable_reg = (void __iomem *)DSP_IDLECT2,
326 .enable_bit = EN_XORPCK, 342 .enable_bit = EN_XORPCK,
@@ -332,7 +348,7 @@ static struct clk dspxor_ck = {
332static struct clk dsptim_ck = { 348static struct clk dsptim_ck = {
333 .name = "dsptim_ck", 349 .name = "dsptim_ck",
334 .parent = &ck_ref, 350 .parent = &ck_ref,
335 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | 351 .flags = CLOCK_IN_OMAP310 | CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
336 VIRTUAL_IO_ADDRESS, 352 VIRTUAL_IO_ADDRESS,
337 .enable_reg = (void __iomem *)DSP_IDLECT2, 353 .enable_reg = (void __iomem *)DSP_IDLECT2,
338 .enable_bit = EN_DSPTIMCK, 354 .enable_bit = EN_DSPTIMCK,
@@ -374,7 +390,7 @@ static struct clk arminth_ck1510 = {
374 390
375static struct clk tipb_ck = { 391static struct clk tipb_ck = {
376 /* No-idle controlled by "tc_ck" */ 392 /* No-idle controlled by "tc_ck" */
377 .name = "tibp_ck", 393 .name = "tipb_ck",
378 .parent = &tc_ck.clk, 394 .parent = &tc_ck.clk,
379 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP310 | 395 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP310 |
380 ALWAYS_ENABLED, 396 ALWAYS_ENABLED,
@@ -733,7 +749,7 @@ remains active during MPU idle whenever this is enabled */
733static struct clk i2c_fck = { 749static struct clk i2c_fck = {
734 .name = "i2c_fck", 750 .name = "i2c_fck",
735 .id = 1, 751 .id = 1,
736 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | 752 .flags = CLOCK_IN_OMAP310 | CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
737 VIRTUAL_CLOCK | CLOCK_NO_IDLE_PARENT | 753 VIRTUAL_CLOCK | CLOCK_NO_IDLE_PARENT |
738 ALWAYS_ENABLED, 754 ALWAYS_ENABLED,
739 .parent = &armxor_ck.clk, 755 .parent = &armxor_ck.clk,
@@ -760,6 +776,7 @@ static struct clk * onchip_clks[] = {
760 &ck_dpll1, 776 &ck_dpll1,
761 /* CK_GEN1 clocks */ 777 /* CK_GEN1 clocks */
762 &ck_dpll1out.clk, 778 &ck_dpll1out.clk,
779 &sossi_ck,
763 &arm_ck, 780 &arm_ck,
764 &armper_ck.clk, 781 &armper_ck.clk,
765 &arm_gpio_ck, 782 &arm_gpio_ck,
diff --git a/arch/arm/mach-omap1/leds-innovator.c b/arch/arm/mach-omap1/leds-innovator.c
index a0cd001ac39a..e7835d6f53a0 100644
--- a/arch/arm/mach-omap1/leds-innovator.c
+++ b/arch/arm/mach-omap1/leds-innovator.c
@@ -95,8 +95,5 @@ void innovator_leds_event(led_event_t evt)
95 break; 95 break;
96 } 96 }
97 97
98 if (led_state & LED_STATE_ENABLED)
99 ;
100
101 local_irq_restore(flags); 98 local_irq_restore(flags);
102} 99}
diff --git a/arch/arm/mach-omap1/mux.c b/arch/arm/mach-omap1/mux.c
index 5432335bc493..52c70e5fcf65 100644
--- a/arch/arm/mach-omap1/mux.c
+++ b/arch/arm/mach-omap1/mux.c
@@ -283,6 +283,30 @@ MUX_CFG("R11_1610_CF_IOIS16", B, 0, 3, 2, 16, 1, 2, 1, 1)
283MUX_CFG("V10_1610_CF_IREQ", A, 24, 3, 2, 14, 0, 2, 0, 1) 283MUX_CFG("V10_1610_CF_IREQ", A, 24, 3, 2, 14, 0, 2, 0, 1)
284MUX_CFG("W10_1610_CF_RESET", A, 18, 3, 2, 12, 1, 2, 1, 1) 284MUX_CFG("W10_1610_CF_RESET", A, 18, 3, 2, 12, 1, 2, 1, 1)
285MUX_CFG("W11_1610_CF_CD1", 10, 15, 3, 3, 8, 1, 3, 1, 1) 285MUX_CFG("W11_1610_CF_CD1", 10, 15, 3, 3, 8, 1, 3, 1, 1)
286
287/* parallel camera */
288MUX_CFG("J15_1610_CAM_LCLK", 4, 24, 0, 0, 18, 1, 0, 0, 0)
289MUX_CFG("J18_1610_CAM_D7", 4, 27, 0, 0, 19, 1, 0, 0, 0)
290MUX_CFG("J19_1610_CAM_D6", 5, 0, 0, 0, 20, 1, 0, 0, 0)
291MUX_CFG("J14_1610_CAM_D5", 5, 3, 0, 0, 21, 1, 0, 0, 0)
292MUX_CFG("K18_1610_CAM_D4", 5, 6, 0, 0, 22, 1, 0, 0, 0)
293MUX_CFG("K19_1610_CAM_D3", 5, 9, 0, 0, 23, 1, 0, 0, 0)
294MUX_CFG("K15_1610_CAM_D2", 5, 12, 0, 0, 24, 1, 0, 0, 0)
295MUX_CFG("K14_1610_CAM_D1", 5, 15, 0, 0, 25, 1, 0, 0, 0)
296MUX_CFG("L19_1610_CAM_D0", 5, 18, 0, 0, 26, 1, 0, 0, 0)
297MUX_CFG("L18_1610_CAM_VS", 5, 21, 0, 0, 27, 1, 0, 0, 0)
298MUX_CFG("L15_1610_CAM_HS", 5, 24, 0, 0, 28, 1, 0, 0, 0)
299MUX_CFG("M19_1610_CAM_RSTZ", 5, 27, 0, 0, 29, 0, 0, 0, 0)
300MUX_CFG("Y15_1610_CAM_OUTCLK", A, 0, 6, 2, 6, 0, 2, 0, 0)
301
302/* serial camera */
303MUX_CFG("H19_1610_CAM_EXCLK", 4, 21, 0, 0, 17, 0, 0, 0, 0)
304 /* REVISIT 5912 spec sez CCP_* can't pullup or pulldown ... ? */
305MUX_CFG("Y12_1610_CCP_CLKP", 8, 18, 6, 1, 24, 1, 1, 0, 0)
306MUX_CFG("W13_1610_CCP_CLKM", 9, 0, 6, 1, 28, 1, 1, 0, 0)
307MUX_CFG("W14_1610_CCP_DATAP", 9, 24, 6, 2, 4, 1, 2, 0, 0)
308MUX_CFG("Y14_1610_CCP_DATAM", 9, 21, 6, 2, 3, 1, 2, 0, 0)
309
286}; 310};
287#endif /* CONFIG_ARCH_OMAP15XX || CONFIG_ARCH_OMAP16XX */ 311#endif /* CONFIG_ARCH_OMAP15XX || CONFIG_ARCH_OMAP16XX */
288 312
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 2e68be607295..089b8208de0e 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -153,11 +153,8 @@ void omap_pm_idle(void)
153 use_idlect1 = omap_dm_timer_modify_idlect_mask(use_idlect1); 153 use_idlect1 = omap_dm_timer_modify_idlect_mask(use_idlect1);
154#endif 154#endif
155 155
156 if (omap_dma_running()) { 156 if (omap_dma_running())
157 use_idlect1 &= ~(1 << 6); 157 use_idlect1 &= ~(1 << 6);
158 if (omap_lcd_dma_ext_running())
159 use_idlect1 &= ~(1 << 12);
160 }
161 158
162 /* We should be able to remove the do_sleep variable and multiple 159 /* We should be able to remove the do_sleep variable and multiple
163 * tests above as soon as drivers, timer and DMA code have been fixed. 160 * tests above as soon as drivers, timer and DMA code have been fixed.
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 7393109f5c30..7069c9d536f1 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -11,6 +11,10 @@ config ARCH_OMAP2420
11 select OMAP_DM_TIMER 11 select OMAP_DM_TIMER
12 select ARCH_OMAP_OTG 12 select ARCH_OMAP_OTG
13 13
14config ARCH_OMAP2430
15 bool "OMAP2430 support"
16 depends on ARCH_OMAP24XX
17
14comment "OMAP Board Type" 18comment "OMAP Board Type"
15 depends on ARCH_OMAP2 19 depends on ARCH_OMAP2
16 20
@@ -21,8 +25,13 @@ config MACH_OMAP_GENERIC
21config MACH_OMAP_H4 25config MACH_OMAP_H4
22 bool "OMAP 2420 H4 board" 26 bool "OMAP 2420 H4 board"
23 depends on ARCH_OMAP2 && ARCH_OMAP24XX 27 depends on ARCH_OMAP2 && ARCH_OMAP24XX
24 select OMAP_DEBUG_LEDS if LEDS || LEDS_OMAP_DEBUG 28 select OMAP_DEBUG_DEVICES
25 29
26config MACH_OMAP_APOLLON 30config MACH_OMAP_APOLLON
27 bool "OMAP 2420 Apollon board" 31 bool "OMAP 2420 Apollon board"
28 depends on ARCH_OMAP2 && ARCH_OMAP24XX 32 depends on ARCH_OMAP2 && ARCH_OMAP24XX
33
34config MACH_OMAP_2430SDP
35 bool "OMAP 2430 SDP board"
36 depends on ARCH_OMAP2 && ARCH_OMAP24XX
37
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 266d88e77bdc..b05b738d31e6 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -14,5 +14,6 @@ obj-$(CONFIG_PM) += pm.o pm-domain.o sleep.o
14# Specific board support 14# Specific board support
15obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o 15obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o
16obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o 16obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o
17obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o
17obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o 18obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o
18 19
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
new file mode 100644
index 000000000000..7e76fbf19b5d
--- /dev/null
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -0,0 +1,218 @@
1/*
2 * linux/arch/arm/mach-omap2/board-2430sdp.c
3 *
4 * Copyright (C) 2006 Texas Instruments
5 *
6 * Modified from mach-omap2/board-generic.c
7 *
8 * Initial Code : Based on a patch from Komal Shah and Richard Woodruff
9 * Updated the Code for 2430 SDP : Syed Mohammed Khasim
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/init.h>
18#include <linux/platform_device.h>
19#include <linux/mtd/mtd.h>
20#include <linux/mtd/partitions.h>
21#include <linux/delay.h>
22#include <linux/err.h>
23#include <linux/clk.h>
24
25#include <asm/hardware.h>
26#include <asm/mach-types.h>
27#include <asm/mach/arch.h>
28#include <asm/mach/map.h>
29#include <asm/mach/flash.h>
30
31#include <asm/arch/gpio.h>
32#include <asm/arch/mux.h>
33#include <asm/arch/board.h>
34#include <asm/arch/common.h>
35#include <asm/arch/gpmc.h>
36#include "prcm-regs.h"
37
38#include <asm/io.h>
39
40
41#define SDP2430_FLASH_CS 0
42#define SDP2430_SMC91X_CS 5
43
44static struct mtd_partition sdp2430_partitions[] = {
45 /* bootloader (U-Boot, etc) in first sector */
46 {
47 .name = "bootloader",
48 .offset = 0,
49 .size = SZ_256K,
50 .mask_flags = MTD_WRITEABLE, /* force read-only */
51 },
52 /* bootloader params in the next sector */
53 {
54 .name = "params",
55 .offset = MTDPART_OFS_APPEND,
56 .size = SZ_128K,
57 .mask_flags = 0,
58 },
59 /* kernel */
60 {
61 .name = "kernel",
62 .offset = MTDPART_OFS_APPEND,
63 .size = SZ_2M,
64 .mask_flags = 0
65 },
66 /* file system */
67 {
68 .name = "filesystem",
69 .offset = MTDPART_OFS_APPEND,
70 .size = MTDPART_SIZ_FULL,
71 .mask_flags = 0
72 }
73};
74
75static struct flash_platform_data sdp2430_flash_data = {
76 .map_name = "cfi_probe",
77 .width = 2,
78 .parts = sdp2430_partitions,
79 .nr_parts = ARRAY_SIZE(sdp2430_partitions),
80};
81
82static struct resource sdp2430_flash_resource = {
83 .start = SDP2430_CS0_BASE,
84 .end = SDP2430_CS0_BASE + SZ_64M - 1,
85 .flags = IORESOURCE_MEM,
86};
87
88static struct platform_device sdp2430_flash_device = {
89 .name = "omapflash",
90 .id = 0,
91 .dev = {
92 .platform_data = &sdp2430_flash_data,
93 },
94 .num_resources = 1,
95 .resource = &sdp2430_flash_resource,
96};
97
98static struct resource sdp2430_smc91x_resources[] = {
99 [0] = {
100 .start = SDP2430_CS0_BASE,
101 .end = SDP2430_CS0_BASE + SZ_64M - 1,
102 .flags = IORESOURCE_MEM,
103 },
104 [1] = {
105 .start = OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ),
106 .end = OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ),
107 .flags = IORESOURCE_IRQ,
108 },
109};
110
111static struct platform_device sdp2430_smc91x_device = {
112 .name = "smc91x",
113 .id = -1,
114 .num_resources = ARRAY_SIZE(sdp2430_smc91x_resources),
115 .resource = sdp2430_smc91x_resources,
116};
117
118static struct platform_device *sdp2430_devices[] __initdata = {
119 &sdp2430_smc91x_device,
120 &sdp2430_flash_device,
121};
122
123static inline void __init sdp2430_init_smc91x(void)
124{
125 int eth_cs;
126 unsigned long cs_mem_base;
127 unsigned int rate;
128 struct clk *l3ck;
129
130 eth_cs = SDP2430_SMC91X_CS;
131
132 l3ck = clk_get(NULL, "core_l3_ck");
133 if (IS_ERR(l3ck))
134 rate = 100000000;
135 else
136 rate = clk_get_rate(l3ck);
137
138 /* Make sure CS1 timings are correct, for 2430 always muxed */
139 gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1, 0x00011200);
140
141 if (rate >= 160000000) {
142 gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f01);
143 gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080803);
144 gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1c0b1c0a);
145 gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F);
146 gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4);
147 } else if (rate >= 130000000) {
148 gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00);
149 gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802);
150 gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09);
151 gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F);
152 gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4);
153 } else { /* rate = 100000000 */
154 gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00);
155 gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802);
156 gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09);
157 gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x031A1F1F);
158 gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000003C2);
159 }
160
161 if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
162 printk(KERN_ERR "Failed to request GPMC mem for smc91x\n");
163 return;
164 }
165
166 sdp2430_smc91x_resources[0].start = cs_mem_base + 0x300;
167 sdp2430_smc91x_resources[0].end = cs_mem_base + 0x30f;
168 udelay(100);
169
170 if (omap_request_gpio(OMAP24XX_ETHR_GPIO_IRQ) < 0) {
171 printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
172 OMAP24XX_ETHR_GPIO_IRQ);
173 gpmc_cs_free(eth_cs);
174 return;
175 }
176 omap_set_gpio_direction(OMAP24XX_ETHR_GPIO_IRQ, 1);
177
178}
179
180static void __init omap_2430sdp_init_irq(void)
181{
182 omap2_init_common_hw();
183 omap_init_irq();
184 omap_gpio_init();
185 sdp2430_init_smc91x();
186}
187
188static struct omap_uart_config sdp2430_uart_config __initdata = {
189 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
190};
191
192static struct omap_board_config_kernel sdp2430_config[] = {
193 {OMAP_TAG_UART, &sdp2430_uart_config},
194};
195
196static void __init omap_2430sdp_init(void)
197{
198 platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices));
199 omap_board_config = sdp2430_config;
200 omap_board_config_size = ARRAY_SIZE(sdp2430_config);
201 omap_serial_init();
202}
203
204static void __init omap_2430sdp_map_io(void)
205{
206 omap2_map_common_io();
207}
208
209MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
210 /* Maintainer: Syed Khasim - Texas Instruments Inc */
211 .phys_io = 0x48000000,
212 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
213 .boot_params = 0x80000100,
214 .map_io = omap_2430sdp_map_io,
215 .init_irq = omap_2430sdp_init_irq,
216 .init_machine = omap_2430sdp_init,
217 .timer = &omap_timer,
218MACHINE_END
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index 878ff9181d0e..3bb49c17c858 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -25,6 +25,8 @@
25#include <linux/irq.h> 25#include <linux/irq.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/leds.h>
29#include <linux/irq.h>
28 30
29#include <asm/hardware.h> 31#include <asm/hardware.h>
30#include <asm/mach-types.h> 32#include <asm/mach-types.h>
@@ -32,10 +34,12 @@
32#include <asm/mach/flash.h> 34#include <asm/mach/flash.h>
33 35
34#include <asm/arch/gpio.h> 36#include <asm/arch/gpio.h>
37#include <asm/arch/led.h>
35#include <asm/arch/mux.h> 38#include <asm/arch/mux.h>
36#include <asm/arch/usb.h> 39#include <asm/arch/usb.h>
37#include <asm/arch/board.h> 40#include <asm/arch/board.h>
38#include <asm/arch/common.h> 41#include <asm/arch/common.h>
42#include <asm/arch/gpmc.h>
39#include "prcm-regs.h" 43#include "prcm-regs.h"
40 44
41/* LED & Switch macros */ 45/* LED & Switch macros */
@@ -46,6 +50,9 @@
46#define SW_UP_GPIO17 17 50#define SW_UP_GPIO17 17
47#define SW_DOWN_GPIO58 58 51#define SW_DOWN_GPIO58 58
48 52
53#define APOLLON_FLASH_CS 0
54#define APOLLON_ETH_CS 1
55
49static struct mtd_partition apollon_partitions[] = { 56static struct mtd_partition apollon_partitions[] = {
50 { 57 {
51 .name = "X-Loader + U-Boot", 58 .name = "X-Loader + U-Boot",
@@ -85,10 +92,10 @@ static struct flash_platform_data apollon_flash_data = {
85 .nr_parts = ARRAY_SIZE(apollon_partitions), 92 .nr_parts = ARRAY_SIZE(apollon_partitions),
86}; 93};
87 94
88static struct resource apollon_flash_resource = { 95static struct resource apollon_flash_resource[] = {
89 .start = APOLLON_CS0_BASE, 96 [0] = {
90 .end = APOLLON_CS0_BASE + SZ_128K, 97 .flags = IORESOURCE_MEM,
91 .flags = IORESOURCE_MEM, 98 },
92}; 99};
93 100
94static struct platform_device apollon_onenand_device = { 101static struct platform_device apollon_onenand_device = {
@@ -97,14 +104,24 @@ static struct platform_device apollon_onenand_device = {
97 .dev = { 104 .dev = {
98 .platform_data = &apollon_flash_data, 105 .platform_data = &apollon_flash_data,
99 }, 106 },
100 .num_resources = ARRAY_SIZE(&apollon_flash_resource), 107 .num_resources = ARRAY_SIZE(apollon_flash_resource),
101 .resource = &apollon_flash_resource, 108 .resource = apollon_flash_resource,
102}; 109};
103 110
111static void __init apollon_flash_init(void)
112{
113 unsigned long base;
114
115 if (gpmc_cs_request(APOLLON_FLASH_CS, SZ_128K, &base) < 0) {
116 printk(KERN_ERR "Cannot request OneNAND GPMC CS\n");
117 return;
118 }
119 apollon_flash_resource[0].start = base;
120 apollon_flash_resource[0].end = base + SZ_128K - 1;
121}
122
104static struct resource apollon_smc91x_resources[] = { 123static struct resource apollon_smc91x_resources[] = {
105 [0] = { 124 [0] = {
106 .start = APOLLON_ETHR_START, /* Physical */
107 .end = APOLLON_ETHR_START + 0xf,
108 .flags = IORESOURCE_MEM, 125 .flags = IORESOURCE_MEM,
109 }, 126 },
110 [1] = { 127 [1] = {
@@ -126,14 +143,51 @@ static struct platform_device apollon_lcd_device = {
126 .id = -1, 143 .id = -1,
127}; 144};
128 145
146static struct omap_led_config apollon_led_config[] = {
147 {
148 .cdev = {
149 .name = "apollon:led0",
150 },
151 .gpio = LED0_GPIO13,
152 },
153 {
154 .cdev = {
155 .name = "apollon:led1",
156 },
157 .gpio = LED1_GPIO14,
158 },
159 {
160 .cdev = {
161 .name = "apollon:led2",
162 },
163 .gpio = LED2_GPIO15,
164 },
165};
166
167static struct omap_led_platform_data apollon_led_data = {
168 .nr_leds = ARRAY_SIZE(apollon_led_config),
169 .leds = apollon_led_config,
170};
171
172static struct platform_device apollon_led_device = {
173 .name = "omap-led",
174 .id = -1,
175 .dev = {
176 .platform_data = &apollon_led_data,
177 },
178};
179
129static struct platform_device *apollon_devices[] __initdata = { 180static struct platform_device *apollon_devices[] __initdata = {
130 &apollon_onenand_device, 181 &apollon_onenand_device,
131 &apollon_smc91x_device, 182 &apollon_smc91x_device,
132 &apollon_lcd_device, 183 &apollon_lcd_device,
184 &apollon_led_device,
133}; 185};
134 186
135static inline void __init apollon_init_smc91x(void) 187static inline void __init apollon_init_smc91x(void)
136{ 188{
189 unsigned long base;
190
137 /* Make sure CS1 timings are correct */ 191 /* Make sure CS1 timings are correct */
138 GPMC_CONFIG1_1 = 0x00011203; 192 GPMC_CONFIG1_1 = 0x00011203;
139 GPMC_CONFIG2_1 = 0x001f1f01; 193 GPMC_CONFIG2_1 = 0x001f1f01;
@@ -141,13 +195,20 @@ static inline void __init apollon_init_smc91x(void)
141 GPMC_CONFIG4_1 = 0x1c091c09; 195 GPMC_CONFIG4_1 = 0x1c091c09;
142 GPMC_CONFIG5_1 = 0x041f1f1f; 196 GPMC_CONFIG5_1 = 0x041f1f1f;
143 GPMC_CONFIG6_1 = 0x000004c4; 197 GPMC_CONFIG6_1 = 0x000004c4;
144 GPMC_CONFIG7_1 = 0x00000f40 | (APOLLON_CS1_BASE >> 24); 198
199 if (gpmc_cs_request(APOLLON_ETH_CS, SZ_16M, &base) < 0) {
200 printk(KERN_ERR "Failed to request GPMC CS for smc91x\n");
201 return;
202 }
203 apollon_smc91x_resources[0].start = base + 0x300;
204 apollon_smc91x_resources[0].end = base + 0x30f;
145 udelay(100); 205 udelay(100);
146 206
147 omap_cfg_reg(W4__24XX_GPIO74); 207 omap_cfg_reg(W4__24XX_GPIO74);
148 if (omap_request_gpio(APOLLON_ETHR_GPIO_IRQ) < 0) { 208 if (omap_request_gpio(APOLLON_ETHR_GPIO_IRQ) < 0) {
149 printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", 209 printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
150 APOLLON_ETHR_GPIO_IRQ); 210 APOLLON_ETHR_GPIO_IRQ);
211 gpmc_cs_free(APOLLON_ETH_CS);
151 return; 212 return;
152 } 213 }
153 omap_set_gpio_direction(APOLLON_ETHR_GPIO_IRQ, 1); 214 omap_set_gpio_direction(APOLLON_ETHR_GPIO_IRQ, 1);
@@ -175,6 +236,13 @@ static struct omap_mmc_config apollon_mmc_config __initdata = {
175 }, 236 },
176}; 237};
177 238
239static struct omap_usb_config apollon_usb_config __initdata = {
240 .register_dev = 1,
241 .hmc_mode = 0x14, /* 0:dev 1:host1 2:disable */
242
243 .pins[0] = 6,
244};
245
178static struct omap_lcd_config apollon_lcd_config __initdata = { 246static struct omap_lcd_config apollon_lcd_config __initdata = {
179 .ctrl_name = "internal", 247 .ctrl_name = "internal",
180}; 248};
@@ -182,6 +250,7 @@ static struct omap_lcd_config apollon_lcd_config __initdata = {
182static struct omap_board_config_kernel apollon_config[] = { 250static struct omap_board_config_kernel apollon_config[] = {
183 { OMAP_TAG_UART, &apollon_uart_config }, 251 { OMAP_TAG_UART, &apollon_uart_config },
184 { OMAP_TAG_MMC, &apollon_mmc_config }, 252 { OMAP_TAG_MMC, &apollon_mmc_config },
253 { OMAP_TAG_USB, &apollon_usb_config },
185 { OMAP_TAG_LCD, &apollon_lcd_config }, 254 { OMAP_TAG_LCD, &apollon_lcd_config },
186}; 255};
187 256
@@ -250,10 +319,22 @@ static void __init apollon_sw_init(void)
250 return; 319 return;
251} 320}
252 321
322static void __init apollon_usb_init(void)
323{
324 /* USB device */
325 /* DEVICE_SUSPEND */
326 omap_cfg_reg(P21_242X_GPIO12);
327 omap_request_gpio(12);
328 omap_set_gpio_direction(12, 0); /* OUT */
329 omap_set_gpio_dataout(12, 0);
330}
331
253static void __init omap_apollon_init(void) 332static void __init omap_apollon_init(void)
254{ 333{
255 apollon_led_init(); 334 apollon_led_init();
256 apollon_sw_init(); 335 apollon_sw_init();
336 apollon_flash_init();
337 apollon_usb_init();
257 338
258 /* REVISIT: where's the correct place */ 339 /* REVISIT: where's the correct place */
259 omap_cfg_reg(W19_24XX_SYS_NIRQ); 340 omap_cfg_reg(W19_24XX_SYS_NIRQ);
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 452193f01531..f125f432cc3e 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -131,26 +131,6 @@ static struct platform_device h4_flash_device = {
131 .resource = &h4_flash_resource, 131 .resource = &h4_flash_resource,
132}; 132};
133 133
134static struct resource h4_smc91x_resources[] = {
135 [0] = {
136 .start = OMAP24XX_ETHR_START, /* Physical */
137 .end = OMAP24XX_ETHR_START + 0xf,
138 .flags = IORESOURCE_MEM,
139 },
140 [1] = {
141 .start = OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ),
142 .end = OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ),
143 .flags = IORESOURCE_IRQ,
144 },
145};
146
147static struct platform_device h4_smc91x_device = {
148 .name = "smc91x",
149 .id = -1,
150 .num_resources = ARRAY_SIZE(h4_smc91x_resources),
151 .resource = h4_smc91x_resources,
152};
153
154/* Select between the IrDA and aGPS module 134/* Select between the IrDA and aGPS module
155 */ 135 */
156static int h4_select_irda(struct device *dev, int state) 136static int h4_select_irda(struct device *dev, int state)
@@ -266,29 +246,14 @@ static struct platform_device h4_lcd_device = {
266 .id = -1, 246 .id = -1,
267}; 247};
268 248
269static struct resource h4_led_resources[] = {
270 [0] = {
271 .flags = IORESOURCE_MEM,
272 },
273};
274
275static struct platform_device h4_led_device = {
276 .name = "omap_dbg_led",
277 .id = -1,
278 .num_resources = ARRAY_SIZE(h4_led_resources),
279 .resource = h4_led_resources,
280};
281
282static struct platform_device *h4_devices[] __initdata = { 249static struct platform_device *h4_devices[] __initdata = {
283 &h4_smc91x_device,
284 &h4_flash_device, 250 &h4_flash_device,
285 &h4_irda_device, 251 &h4_irda_device,
286 &h4_kp_device, 252 &h4_kp_device,
287 &h4_lcd_device, 253 &h4_lcd_device,
288 &h4_led_device,
289}; 254};
290 255
291static inline void __init h4_init_smc91x(void) 256static inline void __init h4_init_debug(void)
292{ 257{
293 /* Make sure CS1 timings are correct */ 258 /* Make sure CS1 timings are correct */
294 GPMC_CONFIG1_1 = 0x00011200; 259 GPMC_CONFIG1_1 = 0x00011200;
@@ -301,12 +266,8 @@ static inline void __init h4_init_smc91x(void)
301 udelay(100); 266 udelay(100);
302 267
303 omap_cfg_reg(M15_24XX_GPIO92); 268 omap_cfg_reg(M15_24XX_GPIO92);
304 if (omap_request_gpio(OMAP24XX_ETHR_GPIO_IRQ) < 0) { 269 if (debug_card_init(cs_mem_base, OMAP24XX_ETHR_GPIO_IRQ) < 0)
305 printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", 270 gpmc_cs_free(eth_cs);
306 OMAP24XX_ETHR_GPIO_IRQ);
307 return;
308 }
309 omap_set_gpio_direction(OMAP24XX_ETHR_GPIO_IRQ, 1);
310} 271}
311 272
312static void __init omap_h4_init_irq(void) 273static void __init omap_h4_init_irq(void)
@@ -314,7 +275,6 @@ static void __init omap_h4_init_irq(void)
314 omap2_init_common_hw(); 275 omap2_init_common_hw();
315 omap_init_irq(); 276 omap_init_irq();
316 omap_gpio_init(); 277 omap_gpio_init();
317 h4_init_smc91x();
318} 278}
319 279
320static struct omap_uart_config h4_uart_config __initdata = { 280static struct omap_uart_config h4_uart_config __initdata = {
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 52ec2f2d6360..b603bc5f8e5b 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -55,8 +55,10 @@ static void omap_init_i2c(void)
55 if (machine_is_omap_h4()) 55 if (machine_is_omap_h4())
56 return; 56 return;
57 57
58 omap_cfg_reg(J15_24XX_I2C2_SCL); 58 if (!cpu_is_omap2430()) {
59 omap_cfg_reg(H19_24XX_I2C2_SDA); 59 omap_cfg_reg(J15_24XX_I2C2_SCL);
60 omap_cfg_reg(H19_24XX_I2C2_SDA);
61 }
60 (void) platform_device_register(&omap_i2c_device2); 62 (void) platform_device_register(&omap_i2c_device2);
61} 63}
62 64
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index e290b989aa94..5a4cc2076a7d 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -22,7 +22,14 @@
22 22
23#undef DEBUG 23#undef DEBUG
24 24
25#ifdef CONFIG_ARCH_OMAP2420
25#define GPMC_BASE 0x6800a000 26#define GPMC_BASE 0x6800a000
27#endif
28
29#ifdef CONFIG_ARCH_OMAP2430
30#define GPMC_BASE 0x6E000000
31#endif
32
26#define GPMC_REVISION 0x00 33#define GPMC_REVISION 0x00
27#define GPMC_SYSCONFIG 0x10 34#define GPMC_SYSCONFIG 0x10
28#define GPMC_SYSSTATUS 0x14 35#define GPMC_SYSSTATUS 0x14
@@ -88,7 +95,7 @@ u32 gpmc_cs_read_reg(int cs, int idx)
88} 95}
89 96
90/* TODO: Add support for gpmc_fck to clock framework and use it */ 97/* TODO: Add support for gpmc_fck to clock framework and use it */
91static unsigned long gpmc_get_fclk_period(void) 98unsigned long gpmc_get_fclk_period(void)
92{ 99{
93 /* In picoseconds */ 100 /* In picoseconds */
94 return 1000000000 / ((clk_get_rate(gpmc_l3_clk)) / 1000); 101 return 1000000000 / ((clk_get_rate(gpmc_l3_clk)) / 1000);
@@ -104,6 +111,13 @@ unsigned int gpmc_ns_to_ticks(unsigned int time_ns)
104 return (time_ns * 1000 + tick_ps - 1) / tick_ps; 111 return (time_ns * 1000 + tick_ps - 1) / tick_ps;
105} 112}
106 113
114unsigned int gpmc_round_ns_to_ticks(unsigned int time_ns)
115{
116 unsigned long ticks = gpmc_ns_to_ticks(time_ns);
117
118 return ticks * gpmc_get_fclk_period() / 1000;
119}
120
107#ifdef DEBUG 121#ifdef DEBUG
108static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit, 122static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
109 int time, const char *name) 123 int time, const char *name)
@@ -120,15 +134,21 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
120 else 134 else
121 ticks = gpmc_ns_to_ticks(time); 135 ticks = gpmc_ns_to_ticks(time);
122 nr_bits = end_bit - st_bit + 1; 136 nr_bits = end_bit - st_bit + 1;
123 if (ticks >= 1 << nr_bits) 137 if (ticks >= 1 << nr_bits) {
138#ifdef DEBUG
139 printk(KERN_INFO "GPMC CS%d: %-10s* %3d ns, %3d ticks >= %d\n",
140 cs, name, time, ticks, 1 << nr_bits);
141#endif
124 return -1; 142 return -1;
143 }
125 144
126 mask = (1 << nr_bits) - 1; 145 mask = (1 << nr_bits) - 1;
127 l = gpmc_cs_read_reg(cs, reg); 146 l = gpmc_cs_read_reg(cs, reg);
128#ifdef DEBUG 147#ifdef DEBUG
129 printk(KERN_INFO "GPMC CS%d: %-10s: %d ticks, %3lu ns (was %i ticks)\n", 148 printk(KERN_INFO
149 "GPMC CS%d: %-10s: %3d ticks, %3lu ns (was %3i ticks) %3d ns\n",
130 cs, name, ticks, gpmc_get_fclk_period() * ticks / 1000, 150 cs, name, ticks, gpmc_get_fclk_period() * ticks / 1000,
131 (l >> st_bit) & mask); 151 (l >> st_bit) & mask, time);
132#endif 152#endif
133 l &= ~(mask << st_bit); 153 l &= ~(mask << st_bit);
134 l |= ticks << st_bit; 154 l |= ticks << st_bit;
@@ -157,7 +177,7 @@ int gpmc_cs_calc_divider(int cs, unsigned int sync_clk)
157 div = l / gpmc_get_fclk_period(); 177 div = l / gpmc_get_fclk_period();
158 if (div > 4) 178 if (div > 4)
159 return -1; 179 return -1;
160 if (div < 0) 180 if (div <= 0)
161 div = 1; 181 div = 1;
162 182
163 return div; 183 return div;
@@ -191,14 +211,19 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t)
191 211
192 GPMC_SET_ONE(GPMC_CS_CONFIG5, 24, 27, page_burst_access); 212 GPMC_SET_ONE(GPMC_CS_CONFIG5, 24, 27, page_burst_access);
193 213
214 /* caller is expected to have initialized CONFIG1 to cover
215 * at least sync vs async
216 */
217 l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
218 if (l & (GPMC_CONFIG1_READTYPE_SYNC | GPMC_CONFIG1_WRITETYPE_SYNC)) {
194#ifdef DEBUG 219#ifdef DEBUG
195 printk(KERN_INFO "GPMC CS%d CLK period is %lu (div %d)\n", 220 printk(KERN_INFO "GPMC CS%d CLK period is %lu ns (div %d)\n",
196 cs, gpmc_get_fclk_period(), div); 221 cs, (div * gpmc_get_fclk_period()) / 1000, div);
197#endif 222#endif
198 223 l &= ~0x03;
199 l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); 224 l |= (div - 1);
200 l &= ~0x03; 225 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, l);
201 l |= (div - 1); 226 }
202 227
203 return 0; 228 return 0;
204} 229}
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 871ace4fccb8..4dfd878d7968 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -17,7 +17,13 @@
17 17
18#include <asm/io.h> 18#include <asm/io.h>
19 19
20#if defined(CONFIG_ARCH_OMAP2420)
20#define OMAP24XX_TAP_BASE io_p2v(0x48014000) 21#define OMAP24XX_TAP_BASE io_p2v(0x48014000)
22#endif
23
24#if defined(CONFIG_ARCH_OMAP2430)
25#define OMAP24XX_TAP_BASE io_p2v(0x4900A000)
26#endif
21 27
22#define OMAP_TAP_IDCODE 0x0204 28#define OMAP_TAP_IDCODE 0x0204
23#define OMAP_TAP_PROD_ID 0x0208 29#define OMAP_TAP_PROD_ID 0x0208
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 82dc70f6b779..5a4091f582ed 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -5,6 +5,7 @@
5 * 5 *
6 * Copyright (C) 2005 Nokia Corporation 6 * Copyright (C) 2005 Nokia Corporation
7 * Author: Juha Yrjölä <juha.yrjola@nokia.com> 7 * Author: Juha Yrjölä <juha.yrjola@nokia.com>
8 * Updated map desc to add 2430 support : <x0khasim@ti.com>
8 * 9 *
9 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
@@ -26,6 +27,7 @@
26extern void omap_sram_init(void); 27extern void omap_sram_init(void);
27extern int omap2_clk_init(void); 28extern int omap2_clk_init(void);
28extern void omap2_check_revision(void); 29extern void omap2_check_revision(void);
30extern void omap2_init_memory(void);
29extern void gpmc_init(void); 31extern void gpmc_init(void);
30extern void omapfb_reserve_sdram(void); 32extern void omapfb_reserve_sdram(void);
31 33
@@ -40,6 +42,20 @@ static struct map_desc omap2_io_desc[] __initdata = {
40 .length = L3_24XX_SIZE, 42 .length = L3_24XX_SIZE,
41 .type = MT_DEVICE 43 .type = MT_DEVICE
42 }, 44 },
45#ifdef CONFIG_ARCH_OMAP2430
46 {
47 .virtual = L4_WK_243X_VIRT,
48 .pfn = __phys_to_pfn(L4_WK_243X_PHYS),
49 .length = L4_WK_243X_SIZE,
50 .type = MT_DEVICE
51 },
52 {
53 .virtual = OMAP243X_GPMC_VIRT,
54 .pfn = __phys_to_pfn(OMAP243X_GPMC_PHYS),
55 .length = OMAP243X_GPMC_SIZE,
56 .type = MT_DEVICE
57 },
58#endif
43 { 59 {
44 .virtual = DSP_MEM_24XX_VIRT, 60 .virtual = DSP_MEM_24XX_VIRT,
45 .pfn = __phys_to_pfn(DSP_MEM_24XX_PHYS), 61 .pfn = __phys_to_pfn(DSP_MEM_24XX_PHYS),
@@ -80,5 +96,11 @@ void __init omap2_init_common_hw(void)
80{ 96{
81 omap2_mux_init(); 97 omap2_mux_init();
82 omap2_clk_init(); 98 omap2_clk_init();
99/*
100 * Need to Fix this for 2430
101 */
102#ifndef CONFIG_ARCH_OMAP2430
103 omap2_init_memory();
104#endif
83 gpmc_init(); 105 gpmc_init();
84} 106}
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index a39d30680300..f064f725e724 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -37,7 +37,7 @@ static struct omap_irq_bank {
37} __attribute__ ((aligned(4))) irq_banks[] = { 37} __attribute__ ((aligned(4))) irq_banks[] = {
38 { 38 {
39 /* MPU INTC */ 39 /* MPU INTC */
40 .base_reg = OMAP24XX_IC_BASE, 40 .base_reg = IO_ADDRESS(OMAP24XX_IC_BASE),
41 .nr_irqs = 96, 41 .nr_irqs = 96,
42 }, { 42 }, {
43 /* XXX: DSP INTC */ 43 /* XXX: DSP INTC */
@@ -47,7 +47,7 @@ static struct omap_irq_bank {
47/* XXX: FIQ and additional INTC support (only MPU at the moment) */ 47/* XXX: FIQ and additional INTC support (only MPU at the moment) */
48static void omap_ack_irq(unsigned int irq) 48static void omap_ack_irq(unsigned int irq)
49{ 49{
50 omap_writel(0x1, irq_banks[0].base_reg + INTC_CONTROL); 50 __raw_writel(0x1, irq_banks[0].base_reg + INTC_CONTROL);
51} 51}
52 52
53static void omap_mask_irq(unsigned int irq) 53static void omap_mask_irq(unsigned int irq)
@@ -60,7 +60,7 @@ static void omap_mask_irq(unsigned int irq)
60 irq %= 32; 60 irq %= 32;
61 } 61 }
62 62
63 omap_writel(1 << irq, irq_banks[0].base_reg + INTC_MIR_SET0 + offset); 63 __raw_writel(1 << irq, irq_banks[0].base_reg + INTC_MIR_SET0 + offset);
64} 64}
65 65
66static void omap_unmask_irq(unsigned int irq) 66static void omap_unmask_irq(unsigned int irq)
@@ -73,7 +73,7 @@ static void omap_unmask_irq(unsigned int irq)
73 irq %= 32; 73 irq %= 32;
74 } 74 }
75 75
76 omap_writel(1 << irq, irq_banks[0].base_reg + INTC_MIR_CLEAR0 + offset); 76 __raw_writel(1 << irq, irq_banks[0].base_reg + INTC_MIR_CLEAR0 + offset);
77} 77}
78 78
79static void omap_mask_ack_irq(unsigned int irq) 79static void omap_mask_ack_irq(unsigned int irq)
@@ -93,17 +93,20 @@ static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank)
93{ 93{
94 unsigned long tmp; 94 unsigned long tmp;
95 95
96 tmp = omap_readl(bank->base_reg + INTC_REVISION) & 0xff; 96 tmp = __raw_readl(bank->base_reg + INTC_REVISION) & 0xff;
97 printk(KERN_INFO "IRQ: Found an INTC at 0x%08lx " 97 printk(KERN_INFO "IRQ: Found an INTC at 0x%08lx "
98 "(revision %ld.%ld) with %d interrupts\n", 98 "(revision %ld.%ld) with %d interrupts\n",
99 bank->base_reg, tmp >> 4, tmp & 0xf, bank->nr_irqs); 99 bank->base_reg, tmp >> 4, tmp & 0xf, bank->nr_irqs);
100 100
101 tmp = omap_readl(bank->base_reg + INTC_SYSCONFIG); 101 tmp = __raw_readl(bank->base_reg + INTC_SYSCONFIG);
102 tmp |= 1 << 1; /* soft reset */ 102 tmp |= 1 << 1; /* soft reset */
103 omap_writel(tmp, bank->base_reg + INTC_SYSCONFIG); 103 __raw_writel(tmp, bank->base_reg + INTC_SYSCONFIG);
104 104
105 while (!(omap_readl(bank->base_reg + INTC_SYSSTATUS) & 0x1)) 105 while (!(__raw_readl(bank->base_reg + INTC_SYSSTATUS) & 0x1))
106 /* Wait for reset to complete */; 106 /* Wait for reset to complete */;
107
108 /* Enable autoidle */
109 __raw_writel(1 << 0, bank->base_reg + INTC_SYSCONFIG);
107} 110}
108 111
109void __init omap_init_irq(void) 112void __init omap_init_irq(void)
diff --git a/arch/arm/mach-omap2/memory.c b/arch/arm/mach-omap2/memory.c
index 85cbc2a2e663..3e5d8cd4ea4f 100644
--- a/arch/arm/mach-omap2/memory.c
+++ b/arch/arm/mach-omap2/memory.c
@@ -30,6 +30,7 @@
30#include "prcm-regs.h" 30#include "prcm-regs.h"
31#include "memory.h" 31#include "memory.h"
32 32
33
33static struct memory_timings mem_timings; 34static struct memory_timings mem_timings;
34 35
35u32 omap2_memory_get_slow_dll_ctrl(void) 36u32 omap2_memory_get_slow_dll_ctrl(void)
@@ -99,3 +100,20 @@ void omap2_init_memory_params(u32 force_lock_to_unlock_mode)
99 /* 90 degree phase for anything below 133Mhz + disable DLL filter */ 100 /* 90 degree phase for anything below 133Mhz + disable DLL filter */
100 mem_timings.slow_dll_ctrl |= ((1 << 1) | (3 << 8)); 101 mem_timings.slow_dll_ctrl |= ((1 << 1) | (3 << 8));
101} 102}
103
104/* turn on smart idle modes for SDRAM scheduler and controller */
105void __init omap2_init_memory(void)
106{
107 u32 l;
108
109 l = SMS_SYSCONFIG;
110 l &= ~(0x3 << 3);
111 l |= (0x2 << 3);
112 SMS_SYSCONFIG = l;
113
114 l = SDRC_SYSCONFIG;
115 l &= ~(0x3 << 3);
116 l |= (0x2 << 3);
117 SDRC_SYSCONFIG = l;
118
119}
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 0439906d5da7..05750975d746 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -53,8 +53,8 @@ MUX_CFG_24XX("W19_24XX_SYS_NIRQ", 0x12c, 0, 1, 1, 1)
53MUX_CFG_24XX("W14_24XX_SYS_CLKOUT", 0x137, 0, 1, 1, 1) 53MUX_CFG_24XX("W14_24XX_SYS_CLKOUT", 0x137, 0, 1, 1, 1)
54 54
55/* 24xx GPMC chipselects, wait pin monitoring */ 55/* 24xx GPMC chipselects, wait pin monitoring */
56MUX_CFG_24XX("E2_GPMC_NCS2", 0x08e, 0, 1, 1, 1) 56MUX_CFG_24XX("E2_GPMC_NCS2", 0x08e, 0, 1, 1, 1)
57MUX_CFG_24XX("L2_GPMC_NCS7", 0x093, 0, 1, 1, 1) 57MUX_CFG_24XX("L2_GPMC_NCS7", 0x093, 0, 1, 1, 1)
58MUX_CFG_24XX("L3_GPMC_WAIT0", 0x09a, 0, 1, 1, 1) 58MUX_CFG_24XX("L3_GPMC_WAIT0", 0x09a, 0, 1, 1, 1)
59MUX_CFG_24XX("N7_GPMC_WAIT1", 0x09b, 0, 1, 1, 1) 59MUX_CFG_24XX("N7_GPMC_WAIT1", 0x09b, 0, 1, 1, 1)
60MUX_CFG_24XX("M1_GPMC_WAIT2", 0x09c, 0, 1, 1, 1) 60MUX_CFG_24XX("M1_GPMC_WAIT2", 0x09c, 0, 1, 1, 1)
@@ -67,18 +67,18 @@ MUX_CFG_24XX("W15_24XX_MCBSP2_DR", 0x126, 1, 1, 0, 1)
67MUX_CFG_24XX("V15_24XX_MCBSP2_DX", 0x127, 1, 1, 0, 1) 67MUX_CFG_24XX("V15_24XX_MCBSP2_DX", 0x127, 1, 1, 0, 1)
68 68
69/* 24xx GPIO */ 69/* 24xx GPIO */
70MUX_CFG_24XX("M21_242X_GPIO11", 0x0c9, 3, 1, 1, 1) 70MUX_CFG_24XX("M21_242X_GPIO11", 0x0c9, 3, 1, 1, 1)
71MUX_CFG_24XX("P21_242X_GPIO12", 0x0ca, 3, 0, 0, 1) 71MUX_CFG_24XX("P21_242X_GPIO12", 0x0ca, 3, 0, 0, 1)
72MUX_CFG_24XX("AA10_242X_GPIO13", 0x0e5, 3, 0, 0, 1) 72MUX_CFG_24XX("AA10_242X_GPIO13", 0x0e5, 3, 0, 0, 1)
73MUX_CFG_24XX("AA6_242X_GPIO14", 0x0e6, 3, 0, 0, 1) 73MUX_CFG_24XX("AA6_242X_GPIO14", 0x0e6, 3, 0, 0, 1)
74MUX_CFG_24XX("AA4_242X_GPIO15", 0x0e7, 3, 0, 0, 1) 74MUX_CFG_24XX("AA4_242X_GPIO15", 0x0e7, 3, 0, 0, 1)
75MUX_CFG_24XX("Y11_242X_GPIO16", 0x0e8, 3, 0, 0, 1) 75MUX_CFG_24XX("Y11_242X_GPIO16", 0x0e8, 3, 0, 0, 1)
76MUX_CFG_24XX("AA12_242X_GPIO17", 0x0e9, 3, 0, 0, 1) 76MUX_CFG_24XX("AA12_242X_GPIO17", 0x0e9, 3, 0, 0, 1)
77MUX_CFG_24XX("AA8_242X_GPIO58", 0x0ea, 3, 0, 0, 1) 77MUX_CFG_24XX("AA8_242X_GPIO58", 0x0ea, 3, 0, 0, 1)
78MUX_CFG_24XX("Y20_24XX_GPIO60", 0x12c, 3, 0, 0, 1) 78MUX_CFG_24XX("Y20_24XX_GPIO60", 0x12c, 3, 0, 0, 1)
79MUX_CFG_24XX("W4__24XX_GPIO74", 0x0f2, 3, 0, 0, 1) 79MUX_CFG_24XX("W4__24XX_GPIO74", 0x0f2, 3, 0, 0, 1)
80MUX_CFG_24XX("M15_24XX_GPIO92", 0x10a, 3, 0, 0, 1) 80MUX_CFG_24XX("M15_24XX_GPIO92", 0x10a, 3, 0, 0, 1)
81MUX_CFG_24XX("J15_24XX_GPIO99", 0x113, 3, 1, 1, 1) 81MUX_CFG_24XX("J15_24XX_GPIO99", 0x113, 3, 1, 1, 1)
82MUX_CFG_24XX("V14_24XX_GPIO117", 0x128, 3, 1, 0, 1) 82MUX_CFG_24XX("V14_24XX_GPIO117", 0x128, 3, 1, 0, 1)
83MUX_CFG_24XX("P14_24XX_GPIO125", 0x140, 3, 1, 1, 1) 83MUX_CFG_24XX("P14_24XX_GPIO125", 0x140, 3, 1, 1, 1)
84 84
@@ -95,17 +95,17 @@ MUX_CFG_24XX("T3_242X_GPIO55", 0xd9, 3, 0, 0, 1)
95MUX_CFG_24XX("U2_242X_GPIO56", 0xda, 3, 0, 0, 1) 95MUX_CFG_24XX("U2_242X_GPIO56", 0xda, 3, 0, 0, 1)
96 96
97/* 24xx external DMA requests */ 97/* 24xx external DMA requests */
98MUX_CFG_24XX("AA10_242X_DMAREQ0", 0x0e5, 2, 0, 0, 1) 98MUX_CFG_24XX("AA10_242X_DMAREQ0", 0x0e5, 2, 0, 0, 1)
99MUX_CFG_24XX("AA6_242X_DMAREQ1", 0x0e6, 2, 0, 0, 1) 99MUX_CFG_24XX("AA6_242X_DMAREQ1", 0x0e6, 2, 0, 0, 1)
100MUX_CFG_24XX("E4_242X_DMAREQ2", 0x074, 2, 0, 0, 1) 100MUX_CFG_24XX("E4_242X_DMAREQ2", 0x074, 2, 0, 0, 1)
101MUX_CFG_24XX("G4_242X_DMAREQ3", 0x073, 2, 0, 0, 1) 101MUX_CFG_24XX("G4_242X_DMAREQ3", 0x073, 2, 0, 0, 1)
102MUX_CFG_24XX("D3_242X_DMAREQ4", 0x072, 2, 0, 0, 1) 102MUX_CFG_24XX("D3_242X_DMAREQ4", 0x072, 2, 0, 0, 1)
103MUX_CFG_24XX("E3_242X_DMAREQ5", 0x071, 2, 0, 0, 1) 103MUX_CFG_24XX("E3_242X_DMAREQ5", 0x071, 2, 0, 0, 1)
104 104
105/* TSC IRQ */ 105/* TSC IRQ */
106MUX_CFG_24XX("P20_24XX_TSC_IRQ", 0x108, 0, 0, 0, 1) 106MUX_CFG_24XX("P20_24XX_TSC_IRQ", 0x108, 0, 0, 0, 1)
107 107
108/* UART3 */ 108/* UART3 */
109MUX_CFG_24XX("K15_24XX_UART3_TX", 0x118, 0, 0, 0, 1) 109MUX_CFG_24XX("K15_24XX_UART3_TX", 0x118, 0, 0, 0, 1)
110MUX_CFG_24XX("K14_24XX_UART3_RX", 0x119, 0, 0, 0, 1) 110MUX_CFG_24XX("K14_24XX_UART3_RX", 0x119, 0, 0, 0, 1)
111 111
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c
new file mode 100644
index 000000000000..80bb42eb5082
--- /dev/null
+++ b/arch/arm/mach-omap2/usb-tusb6010.c
@@ -0,0 +1,349 @@
1/*
2 * linux/arch/arm/mach-omap2/usb-tusb6010.c
3 *
4 * Copyright (C) 2006 Nokia Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/types.h>
12#include <linux/errno.h>
13#include <linux/delay.h>
14#include <linux/platform_device.h>
15
16#include <linux/usb/musb.h>
17
18#include <asm/arch/gpmc.h>
19#include <asm/arch/gpio.h>
20#include <asm/arch/mux.h>
21
22
23static u8 async_cs, sync_cs;
24static unsigned refclk_psec;
25
26
27/* t2_ps, when quantized to fclk units, must happen no earlier than
28 * the clock after after t1_NS.
29 *
30 * Return a possibly updated value of t2_ps, converted to nsec.
31 */
32static unsigned
33next_clk(unsigned t1_NS, unsigned t2_ps, unsigned fclk_ps)
34{
35 unsigned t1_ps = t1_NS * 1000;
36 unsigned t1_f, t2_f;
37
38 if ((t1_ps + fclk_ps) < t2_ps)
39 return t2_ps / 1000;
40
41 t1_f = (t1_ps + fclk_ps - 1) / fclk_ps;
42 t2_f = (t2_ps + fclk_ps - 1) / fclk_ps;
43
44 if (t1_f >= t2_f)
45 t2_f = t1_f + 1;
46
47 return (t2_f * fclk_ps) / 1000;
48}
49
50/* NOTE: timings are from tusb 6010 datasheet Rev 1.8, 12-Sept 2006 */
51
52static int tusb_set_async_mode(unsigned sysclk_ps, unsigned fclk_ps)
53{
54 struct gpmc_timings t;
55 unsigned t_acsnh_advnh = sysclk_ps + 3000;
56 unsigned tmp;
57
58 memset(&t, 0, sizeof(t));
59
60 /* CS_ON = t_acsnh_acsnl */
61 t.cs_on = 8;
62 /* ADV_ON = t_acsnh_advnh - t_advn */
63 t.adv_on = next_clk(t.cs_on, t_acsnh_advnh - 7000, fclk_ps);
64
65 /*
66 * READ ... from omap2420 TRM fig 12-13
67 */
68
69 /* ADV_RD_OFF = t_acsnh_advnh */
70 t.adv_rd_off = next_clk(t.adv_on, t_acsnh_advnh, fclk_ps);
71
72 /* OE_ON = t_acsnh_advnh + t_advn_oen (then wait for nRDY) */
73 t.oe_on = next_clk(t.adv_on, t_acsnh_advnh + 1000, fclk_ps);
74
75 /* ACCESS = counters continue only after nRDY */
76 tmp = t.oe_on * 1000 + 300;
77 t.access = next_clk(t.oe_on, tmp, fclk_ps);
78
79 /* OE_OFF = after data gets sampled */
80 tmp = t.access * 1000;
81 t.oe_off = next_clk(t.access, tmp, fclk_ps);
82
83 t.cs_rd_off = t.oe_off;
84
85 tmp = t.cs_rd_off * 1000 + 7000 /* t_acsn_rdy_z */;
86 t.rd_cycle = next_clk(t.cs_rd_off, tmp, fclk_ps);
87
88 /*
89 * WRITE ... from omap2420 TRM fig 12-15
90 */
91
92 /* ADV_WR_OFF = t_acsnh_advnh */
93 t.adv_wr_off = t.adv_rd_off;
94
95 /* WE_ON = t_acsnh_advnh + t_advn_wen (then wait for nRDY) */
96 t.we_on = next_clk(t.adv_wr_off, t_acsnh_advnh + 1000, fclk_ps);
97
98 /* WE_OFF = after data gets sampled */
99 tmp = t.we_on * 1000 + 300;
100 t.we_off = next_clk(t.we_on, tmp, fclk_ps);
101
102 t.cs_wr_off = t.we_off;
103
104 tmp = t.cs_wr_off * 1000 + 7000 /* t_acsn_rdy_z */;
105 t.wr_cycle = next_clk(t.cs_wr_off, tmp, fclk_ps);
106
107 return gpmc_cs_set_timings(async_cs, &t);
108}
109
110static int tusb_set_sync_mode(unsigned sysclk_ps, unsigned fclk_ps)
111{
112 struct gpmc_timings t;
113 unsigned t_scsnh_advnh = sysclk_ps + 3000;
114 unsigned tmp;
115
116 memset(&t, 0, sizeof(t));
117 t.cs_on = 8;
118
119 /* ADV_ON = t_acsnh_advnh - t_advn */
120 t.adv_on = next_clk(t.cs_on, t_scsnh_advnh - 7000, fclk_ps);
121
122 /* GPMC_CLK rate = fclk rate / div */
123 t.sync_clk = 12 /* 11.1 nsec */;
124 tmp = (t.sync_clk * 1000 + fclk_ps - 1) / fclk_ps;
125 if (tmp > 4)
126 return -ERANGE;
127 if (tmp <= 0)
128 tmp = 1;
129 t.page_burst_access = (fclk_ps * tmp) / 1000;
130
131 /*
132 * READ ... based on omap2420 TRM fig 12-19, 12-20
133 */
134
135 /* ADV_RD_OFF = t_scsnh_advnh */
136 t.adv_rd_off = next_clk(t.adv_on, t_scsnh_advnh, fclk_ps);
137
138 /* OE_ON = t_scsnh_advnh + t_advn_oen * fclk_ps (then wait for nRDY) */
139 tmp = (t.adv_rd_off * 1000) + (3 * fclk_ps);
140 t.oe_on = next_clk(t.adv_on, tmp, fclk_ps);
141
142 /* ACCESS = number of clock cycles after t_adv_eon */
143 tmp = (t.oe_on * 1000) + (5 * fclk_ps);
144 t.access = next_clk(t.oe_on, tmp, fclk_ps);
145
146 /* OE_OFF = after data gets sampled */
147 tmp = (t.access * 1000) + (1 * fclk_ps);
148 t.oe_off = next_clk(t.access, tmp, fclk_ps);
149
150 t.cs_rd_off = t.oe_off;
151
152 tmp = t.cs_rd_off * 1000 + 7000 /* t_scsn_rdy_z */;
153 t.rd_cycle = next_clk(t.cs_rd_off, tmp, fclk_ps);
154
155 /*
156 * WRITE ... based on omap2420 TRM fig 12-21
157 */
158
159 /* ADV_WR_OFF = t_scsnh_advnh */
160 t.adv_wr_off = t.adv_rd_off;
161
162 /* WE_ON = t_scsnh_advnh + t_advn_wen * fclk_ps (then wait for nRDY) */
163 tmp = (t.adv_wr_off * 1000) + (3 * fclk_ps);
164 t.we_on = next_clk(t.adv_wr_off, tmp, fclk_ps);
165
166 /* WE_OFF = number of clock cycles after t_adv_wen */
167 tmp = (t.we_on * 1000) + (6 * fclk_ps);
168 t.we_off = next_clk(t.we_on, tmp, fclk_ps);
169
170 t.cs_wr_off = t.we_off;
171
172 tmp = t.cs_wr_off * 1000 + 7000 /* t_scsn_rdy_z */;
173 t.wr_cycle = next_clk(t.cs_wr_off, tmp, fclk_ps);
174
175 return gpmc_cs_set_timings(sync_cs, &t);
176}
177
178extern unsigned long gpmc_get_fclk_period(void);
179
180/* tusb driver calls this when it changes the chip's clocking */
181int tusb6010_platform_retime(unsigned is_refclk)
182{
183 static const char error[] =
184 KERN_ERR "tusb6010 %s retime error %d\n";
185
186 unsigned fclk_ps = gpmc_get_fclk_period();
187 unsigned sysclk_ps;
188 int status;
189
190 if (!refclk_psec)
191 return -ENODEV;
192
193 sysclk_ps = is_refclk ? refclk_psec : TUSB6010_OSCCLK_60;
194
195 status = tusb_set_async_mode(sysclk_ps, fclk_ps);
196 if (status < 0) {
197 printk(error, "async", status);
198 goto done;
199 }
200 status = tusb_set_sync_mode(sysclk_ps, fclk_ps);
201 if (status < 0)
202 printk(error, "sync", status);
203done:
204 return status;
205}
206EXPORT_SYMBOL_GPL(tusb6010_platform_retime);
207
208static struct resource tusb_resources[] = {
209 /* Order is significant! The start/end fields
210 * are updated during setup..
211 */
212 { /* Asynchronous access */
213 .flags = IORESOURCE_MEM,
214 },
215 { /* Synchronous access */
216 .flags = IORESOURCE_MEM,
217 },
218 { /* IRQ */
219 .flags = IORESOURCE_IRQ,
220 },
221};
222
223static u64 tusb_dmamask = ~(u32)0;
224
225static struct platform_device tusb_device = {
226 .name = "musb_hdrc",
227 .id = -1,
228 .dev = {
229 .dma_mask = &tusb_dmamask,
230 .coherent_dma_mask = 0xffffffff,
231 },
232 .num_resources = ARRAY_SIZE(tusb_resources),
233 .resource = tusb_resources,
234};
235
236
237/* this may be called only from board-*.c setup code */
238int __init
239tusb6010_setup_interface(struct musb_hdrc_platform_data *data,
240 unsigned ps_refclk, unsigned waitpin,
241 unsigned async, unsigned sync,
242 unsigned irq, unsigned dmachan)
243{
244 int status;
245 static char error[] __initdata =
246 KERN_ERR "tusb6010 init error %d, %d\n";
247
248 /* ASYNC region, primarily for PIO */
249 status = gpmc_cs_request(async, SZ_16M, (unsigned long *)
250 &tusb_resources[0].start);
251 if (status < 0) {
252 printk(error, 1, status);
253 return status;
254 }
255 tusb_resources[0].end = tusb_resources[0].start + 0x9ff;
256 async_cs = async;
257 gpmc_cs_write_reg(async, GPMC_CS_CONFIG1,
258 GPMC_CONFIG1_PAGE_LEN(2)
259 | GPMC_CONFIG1_WAIT_READ_MON
260 | GPMC_CONFIG1_WAIT_WRITE_MON
261 | GPMC_CONFIG1_WAIT_PIN_SEL(waitpin)
262 | GPMC_CONFIG1_READTYPE_ASYNC
263 | GPMC_CONFIG1_WRITETYPE_ASYNC
264 | GPMC_CONFIG1_DEVICESIZE_16
265 | GPMC_CONFIG1_DEVICETYPE_NOR
266 | GPMC_CONFIG1_MUXADDDATA);
267
268
269 /* SYNC region, primarily for DMA */
270 status = gpmc_cs_request(sync, SZ_16M, (unsigned long *)
271 &tusb_resources[1].start);
272 if (status < 0) {
273 printk(error, 2, status);
274 return status;
275 }
276 tusb_resources[1].end = tusb_resources[1].start + 0x9ff;
277 sync_cs = sync;
278 gpmc_cs_write_reg(sync, GPMC_CS_CONFIG1,
279 GPMC_CONFIG1_READMULTIPLE_SUPP
280 | GPMC_CONFIG1_READTYPE_SYNC
281 | GPMC_CONFIG1_WRITEMULTIPLE_SUPP
282 | GPMC_CONFIG1_WRITETYPE_SYNC
283 | GPMC_CONFIG1_CLKACTIVATIONTIME(1)
284 | GPMC_CONFIG1_PAGE_LEN(2)
285 | GPMC_CONFIG1_WAIT_READ_MON
286 | GPMC_CONFIG1_WAIT_WRITE_MON
287 | GPMC_CONFIG1_WAIT_PIN_SEL(waitpin)
288 | GPMC_CONFIG1_DEVICESIZE_16
289 | GPMC_CONFIG1_DEVICETYPE_NOR
290 | GPMC_CONFIG1_MUXADDDATA
291 /* fclk divider gets set later */
292 );
293
294 /* IRQ */
295 status = omap_request_gpio(irq);
296 if (status < 0) {
297 printk(error, 3, status);
298 return status;
299 }
300 omap_set_gpio_direction(irq, 1);
301 tusb_resources[2].start = irq + IH_GPIO_BASE;
302
303 /* set up memory timings ... can speed them up later */
304 if (!ps_refclk) {
305 printk(error, 4, status);
306 return -ENODEV;
307 }
308 refclk_psec = ps_refclk;
309 status = tusb6010_platform_retime(1);
310 if (status < 0) {
311 printk(error, 5, status);
312 return status;
313 }
314
315 /* finish device setup ... */
316 if (!data) {
317 printk(error, 6, status);
318 return -ENODEV;
319 }
320 data->multipoint = 1;
321 tusb_device.dev.platform_data = data;
322
323 /* REVISIT let the driver know what DMA channels work */
324 if (!dmachan)
325 tusb_device.dev.dma_mask = NULL;
326 else {
327 /* assume OMAP 2420 ES2.0 and later */
328 if (dmachan & (1 << 0))
329 omap_cfg_reg(AA10_242X_DMAREQ0);
330 if (dmachan & (1 << 1))
331 omap_cfg_reg(AA6_242X_DMAREQ1);
332 if (dmachan & (1 << 2))
333 omap_cfg_reg(E4_242X_DMAREQ2);
334 if (dmachan & (1 << 3))
335 omap_cfg_reg(G4_242X_DMAREQ3);
336 if (dmachan & (1 << 4))
337 omap_cfg_reg(D3_242X_DMAREQ4);
338 if (dmachan & (1 << 5))
339 omap_cfg_reg(E3_242X_DMAREQ5);
340 }
341
342 /* so far so good ... register the device */
343 status = platform_device_register(&tusb_device);
344 if (status < 0) {
345 printk(error, 7, status);
346 return status;
347 }
348 return 0;
349}
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 5ebec6d88b51..656d49661a29 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -1,6 +1,24 @@
1if ARCH_PXA 1if ARCH_PXA
2 2
3menu "Intel PXA2xx Implementations" 3menu "Intel PXA2xx/PXA3xx Implementations"
4
5if PXA3xx
6
7menu "Supported PXA3xx Processor Variants"
8
9config CPU_PXA300
10 bool "PXA300 (codename Monahans-L)"
11
12config CPU_PXA310
13 bool "PXA310 (codename Monahans-LV)"
14 select CPU_PXA300
15
16config CPU_PXA320
17 bool "PXA320 (codename Monahans-P)"
18
19endmenu
20
21endif
4 22
5choice 23choice
6 prompt "Select target board" 24 prompt "Select target board"
@@ -41,6 +59,15 @@ config MACH_EM_X270
41 bool "CompuLab EM-x270 platform" 59 bool "CompuLab EM-x270 platform"
42 select PXA27x 60 select PXA27x
43 61
62config MACH_ZYLONITE
63 bool "PXA3xx Development Platform"
64 select PXA3xx
65
66config MACH_ARMCORE
67 bool "CompuLab CM-X270 modules"
68 select PXA27x
69 select IWMMXT
70
44endchoice 71endchoice
45 72
46if PXA_SHARPSL 73if PXA_SHARPSL
@@ -130,6 +157,11 @@ config PXA27x
130 help 157 help
131 Select code specific to PXA27x variants 158 Select code specific to PXA27x variants
132 159
160config PXA3xx
161 bool
162 help
163 Select code specific to PXA3xx variants
164
133config PXA_SHARP_C7xx 165config PXA_SHARP_C7xx
134 bool 166 bool
135 select PXA_SSP 167 select PXA_SSP
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index 7d6ab5c59ab9..4263527e5123 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -3,36 +3,51 @@
3# 3#
4 4
5# Common support (must be linked before board specific support) 5# Common support (must be linked before board specific support)
6obj-y += clock.o generic.o irq.o dma.o time.o 6obj-y += clock.o generic.o irq.o dma.o time.o
7obj-$(CONFIG_PXA25x) += pxa25x.o 7obj-$(CONFIG_PXA25x) += pxa25x.o
8obj-$(CONFIG_PXA27x) += pxa27x.o 8obj-$(CONFIG_PXA27x) += pxa27x.o
9obj-$(CONFIG_PXA3xx) += pxa3xx.o mfp.o
10obj-$(CONFIG_CPU_PXA300) += pxa300.o
11obj-$(CONFIG_CPU_PXA320) += pxa320.o
9 12
10# Specific board support 13# Specific board support
11obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o 14obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o
12obj-$(CONFIG_MACH_LOGICPD_PXA270) += lpd270.o 15obj-$(CONFIG_MACH_LOGICPD_PXA270) += lpd270.o
13obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o 16obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o
14obj-$(CONFIG_ARCH_PXA_IDP) += idp.o 17obj-$(CONFIG_ARCH_PXA_IDP) += idp.o
15obj-$(CONFIG_MACH_TRIZEPS4) += trizeps4.o 18obj-$(CONFIG_MACH_TRIZEPS4) += trizeps4.o
16obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o corgi_pm.o 19obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o corgi_pm.o
17obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o spitz_pm.o 20obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o spitz_pm.o
18obj-$(CONFIG_MACH_AKITA) += akita-ioexp.o 21obj-$(CONFIG_MACH_AKITA) += akita-ioexp.o
19obj-$(CONFIG_MACH_POODLE) += poodle.o corgi_ssp.o 22obj-$(CONFIG_MACH_POODLE) += poodle.o corgi_ssp.o
20obj-$(CONFIG_MACH_TOSA) += tosa.o 23obj-$(CONFIG_MACH_TOSA) += tosa.o
21obj-$(CONFIG_MACH_EM_X270) += em-x270.o 24obj-$(CONFIG_MACH_EM_X270) += em-x270.o
25
26ifeq ($(CONFIG_MACH_ZYLONITE),y)
27 obj-y += zylonite.o
28 obj-$(CONFIG_CPU_PXA300) += zylonite_pxa300.o
29 obj-$(CONFIG_CPU_PXA320) += zylonite_pxa320.o
30endif
31
32obj-$(CONFIG_MACH_ARMCORE) += cm-x270.o
22 33
23# Support for blinky lights 34# Support for blinky lights
24led-y := leds.o 35led-y := leds.o
25led-$(CONFIG_ARCH_LUBBOCK) += leds-lubbock.o 36led-$(CONFIG_ARCH_LUBBOCK) += leds-lubbock.o
26led-$(CONFIG_MACH_MAINSTONE) += leds-mainstone.o 37led-$(CONFIG_MACH_MAINSTONE) += leds-mainstone.o
27led-$(CONFIG_ARCH_PXA_IDP) += leds-idp.o 38led-$(CONFIG_ARCH_PXA_IDP) += leds-idp.o
28led-$(CONFIG_MACH_TRIZEPS4) += leds-trizeps4.o 39led-$(CONFIG_MACH_TRIZEPS4) += leds-trizeps4.o
29 40
30obj-$(CONFIG_LEDS) += $(led-y) 41obj-$(CONFIG_LEDS) += $(led-y)
31 42
32# Misc features 43# Misc features
33obj-$(CONFIG_PM) += pm.o sleep.o 44obj-$(CONFIG_PM) += pm.o sleep.o
34obj-$(CONFIG_PXA_SSP) += ssp.o 45obj-$(CONFIG_PXA_SSP) += ssp.o
35 46
36ifeq ($(CONFIG_PXA27x),y) 47ifeq ($(CONFIG_PXA27x),y)
37obj-$(CONFIG_PM) += standby.o 48obj-$(CONFIG_PM) += standby.o
49endif
50
51ifeq ($(CONFIG_PCI),y)
52obj-$(CONFIG_MACH_ARMCORE) += cm-x270-pci.o
38endif 53endif
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c
index 34a31caa6f9d..83ef5ecaf432 100644
--- a/arch/arm/mach-pxa/clock.c
+++ b/arch/arm/mach-pxa/clock.c
@@ -9,19 +9,15 @@
9#include <linux/string.h> 9#include <linux/string.h>
10#include <linux/clk.h> 10#include <linux/clk.h>
11#include <linux/spinlock.h> 11#include <linux/spinlock.h>
12#include <linux/platform_device.h>
13#include <linux/delay.h>
12 14
13#include <asm/arch/pxa-regs.h> 15#include <asm/arch/pxa-regs.h>
14#include <asm/hardware.h> 16#include <asm/hardware.h>
15 17
16struct clk { 18#include "devices.h"
17 struct list_head node; 19#include "generic.h"
18 unsigned long rate; 20#include "clock.h"
19 struct module *owner;
20 const char *name;
21 unsigned int enabled;
22 void (*enable)(void);
23 void (*disable)(void);
24};
25 21
26static LIST_HEAD(clocks); 22static LIST_HEAD(clocks);
27static DEFINE_MUTEX(clocks_mutex); 23static DEFINE_MUTEX(clocks_mutex);
@@ -33,7 +29,8 @@ struct clk *clk_get(struct device *dev, const char *id)
33 29
34 mutex_lock(&clocks_mutex); 30 mutex_lock(&clocks_mutex);
35 list_for_each_entry(p, &clocks, node) { 31 list_for_each_entry(p, &clocks, node) {
36 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { 32 if (strcmp(id, p->name) == 0 &&
33 (p->dev == NULL || p->dev == dev)) {
37 clk = p; 34 clk = p;
38 break; 35 break;
39 } 36 }
@@ -46,7 +43,6 @@ EXPORT_SYMBOL(clk_get);
46 43
47void clk_put(struct clk *clk) 44void clk_put(struct clk *clk)
48{ 45{
49 module_put(clk->owner);
50} 46}
51EXPORT_SYMBOL(clk_put); 47EXPORT_SYMBOL(clk_put);
52 48
@@ -56,8 +52,12 @@ int clk_enable(struct clk *clk)
56 52
57 spin_lock_irqsave(&clocks_lock, flags); 53 spin_lock_irqsave(&clocks_lock, flags);
58 if (clk->enabled++ == 0) 54 if (clk->enabled++ == 0)
59 clk->enable(); 55 clk->ops->enable(clk);
60 spin_unlock_irqrestore(&clocks_lock, flags); 56 spin_unlock_irqrestore(&clocks_lock, flags);
57
58 if (clk->delay)
59 udelay(clk->delay);
60
61 return 0; 61 return 0;
62} 62}
63EXPORT_SYMBOL(clk_enable); 63EXPORT_SYMBOL(clk_enable);
@@ -70,54 +70,75 @@ void clk_disable(struct clk *clk)
70 70
71 spin_lock_irqsave(&clocks_lock, flags); 71 spin_lock_irqsave(&clocks_lock, flags);
72 if (--clk->enabled == 0) 72 if (--clk->enabled == 0)
73 clk->disable(); 73 clk->ops->disable(clk);
74 spin_unlock_irqrestore(&clocks_lock, flags); 74 spin_unlock_irqrestore(&clocks_lock, flags);
75} 75}
76EXPORT_SYMBOL(clk_disable); 76EXPORT_SYMBOL(clk_disable);
77 77
78unsigned long clk_get_rate(struct clk *clk) 78unsigned long clk_get_rate(struct clk *clk)
79{ 79{
80 return clk->rate; 80 unsigned long rate;
81
82 rate = clk->rate;
83 if (clk->ops->getrate)
84 rate = clk->ops->getrate(clk);
85
86 return rate;
81} 87}
82EXPORT_SYMBOL(clk_get_rate); 88EXPORT_SYMBOL(clk_get_rate);
83 89
84 90
85static void clk_gpio27_enable(void) 91static void clk_gpio27_enable(struct clk *clk)
86{ 92{
87 pxa_gpio_mode(GPIO11_3_6MHz_MD); 93 pxa_gpio_mode(GPIO11_3_6MHz_MD);
88} 94}
89 95
90static void clk_gpio27_disable(void) 96static void clk_gpio27_disable(struct clk *clk)
91{ 97{
92} 98}
93 99
94static struct clk clk_gpio27 = { 100static const struct clkops clk_gpio27_ops = {
95 .name = "GPIO27_CLK",
96 .rate = 3686400,
97 .enable = clk_gpio27_enable, 101 .enable = clk_gpio27_enable,
98 .disable = clk_gpio27_disable, 102 .disable = clk_gpio27_disable,
99}; 103};
100 104
101int clk_register(struct clk *clk) 105
106void clk_cken_enable(struct clk *clk)
102{ 107{
103 mutex_lock(&clocks_mutex); 108 CKEN |= 1 << clk->cken;
104 list_add(&clk->node, &clocks);
105 mutex_unlock(&clocks_mutex);
106 return 0;
107} 109}
108EXPORT_SYMBOL(clk_register);
109 110
110void clk_unregister(struct clk *clk) 111void clk_cken_disable(struct clk *clk)
111{ 112{
113 CKEN &= ~(1 << clk->cken);
114}
115
116const struct clkops clk_cken_ops = {
117 .enable = clk_cken_enable,
118 .disable = clk_cken_disable,
119};
120
121static struct clk common_clks[] = {
122 {
123 .name = "GPIO27_CLK",
124 .ops = &clk_gpio27_ops,
125 .rate = 3686400,
126 },
127};
128
129void clks_register(struct clk *clks, size_t num)
130{
131 int i;
132
112 mutex_lock(&clocks_mutex); 133 mutex_lock(&clocks_mutex);
113 list_del(&clk->node); 134 for (i = 0; i < num; i++)
135 list_add(&clks[i].node, &clocks);
114 mutex_unlock(&clocks_mutex); 136 mutex_unlock(&clocks_mutex);
115} 137}
116EXPORT_SYMBOL(clk_unregister);
117 138
118static int __init clk_init(void) 139static int __init clk_init(void)
119{ 140{
120 clk_register(&clk_gpio27); 141 clks_register(common_clks, ARRAY_SIZE(common_clks));
121 return 0; 142 return 0;
122} 143}
123arch_initcall(clk_init); 144arch_initcall(clk_init);
diff --git a/arch/arm/mach-pxa/clock.h b/arch/arm/mach-pxa/clock.h
new file mode 100644
index 000000000000..bc6b77e1592e
--- /dev/null
+++ b/arch/arm/mach-pxa/clock.h
@@ -0,0 +1,43 @@
1struct clk;
2
3struct clkops {
4 void (*enable)(struct clk *);
5 void (*disable)(struct clk *);
6 unsigned long (*getrate)(struct clk *);
7};
8
9struct clk {
10 struct list_head node;
11 const char *name;
12 struct device *dev;
13 const struct clkops *ops;
14 unsigned long rate;
15 unsigned int cken;
16 unsigned int delay;
17 unsigned int enabled;
18};
19
20#define INIT_CKEN(_name, _cken, _rate, _delay, _dev) \
21 { \
22 .name = _name, \
23 .dev = _dev, \
24 .ops = &clk_cken_ops, \
25 .rate = _rate, \
26 .cken = CKEN_##_cken, \
27 .delay = _delay, \
28 }
29
30#define INIT_CK(_name, _cken, _ops, _dev) \
31 { \
32 .name = _name, \
33 .dev = _dev, \
34 .ops = _ops, \
35 .cken = CKEN_##_cken, \
36 }
37
38extern const struct clkops clk_cken_ops;
39
40void clk_cken_enable(struct clk *clk);
41void clk_cken_disable(struct clk *clk);
42
43void clks_register(struct clk *clks, size_t num);
diff --git a/arch/arm/mach-pxa/cm-x270-pci.c b/arch/arm/mach-pxa/cm-x270-pci.c
new file mode 100644
index 000000000000..878d3b9b8633
--- /dev/null
+++ b/arch/arm/mach-pxa/cm-x270-pci.c
@@ -0,0 +1,218 @@
1/*
2 * linux/arch/arm/mach-pxa/cm-x270-pci.c
3 *
4 * PCI bios-type initialisation for PCI machines
5 *
6 * Bits taken from various places.
7 *
8 * Copyright (C) 2007 Compulab, Ltd.
9 * Mike Rapoport <mike@compulab.co.il>
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/pci.h>
18#include <linux/init.h>
19#include <linux/device.h>
20#include <linux/platform_device.h>
21#include <linux/irq.h>
22
23#include <asm/mach/pci.h>
24#include <asm/arch/cm-x270.h>
25#include <asm/arch/pxa-regs.h>
26#include <asm/mach-types.h>
27
28#include <asm/hardware/it8152.h>
29
30unsigned long it8152_base_address = CMX270_IT8152_VIRT;
31
32/*
33 * Only first 64MB of memory can be accessed via PCI.
34 * We use GFP_DMA to allocate safe buffers to do map/unmap.
35 * This is really ugly and we need a better way of specifying
36 * DMA-capable regions of memory.
37 */
38void __init cmx270_pci_adjust_zones(int node, unsigned long *zone_size,
39 unsigned long *zhole_size)
40{
41 unsigned int sz = SZ_64M >> PAGE_SHIFT;
42
43 printk(KERN_INFO "Adjusting zones for CM-x270\n");
44
45 /*
46 * Only adjust if > 64M on current system
47 */
48 if (node || (zone_size[0] <= sz))
49 return;
50
51 zone_size[1] = zone_size[0] - sz;
52 zone_size[0] = sz;
53 zhole_size[1] = zhole_size[0];
54 zhole_size[0] = 0;
55}
56
57static void cmx270_it8152_irq_demux(unsigned int irq, struct irq_desc *desc)
58{
59 /* clear our parent irq */
60 GEDR(GPIO_IT8152_IRQ) = GPIO_bit(GPIO_IT8152_IRQ);
61
62 it8152_irq_demux(irq, desc);
63}
64
65void __cmx270_pci_init_irq(void)
66{
67 it8152_init_irq();
68 pxa_gpio_mode(IRQ_TO_GPIO(GPIO_IT8152_IRQ));
69 set_irq_type(IRQ_GPIO(GPIO_IT8152_IRQ), IRQT_RISING);
70
71 set_irq_chained_handler(IRQ_GPIO(GPIO_IT8152_IRQ),
72 cmx270_it8152_irq_demux);
73}
74
75#ifdef CONFIG_PM
76static unsigned long sleep_save_ite[10];
77
78void __cmx270_pci_suspend(void)
79{
80 /* save ITE state */
81 sleep_save_ite[0] = __raw_readl(IT8152_INTC_PDCNIMR);
82 sleep_save_ite[1] = __raw_readl(IT8152_INTC_LPCNIMR);
83 sleep_save_ite[2] = __raw_readl(IT8152_INTC_LPNIAR);
84
85 /* Clear ITE IRQ's */
86 __raw_writel((0), IT8152_INTC_PDCNIRR);
87 __raw_writel((0), IT8152_INTC_LPCNIRR);
88}
89
90void __cmx270_pci_resume(void)
91{
92 /* restore IT8152 state */
93 __raw_writel((sleep_save_ite[0]), IT8152_INTC_PDCNIMR);
94 __raw_writel((sleep_save_ite[1]), IT8152_INTC_LPCNIMR);
95 __raw_writel((sleep_save_ite[2]), IT8152_INTC_LPNIAR);
96}
97#else
98void cmx270_pci_suspend(void) {}
99void cmx270_pci_resume(void) {}
100#endif
101
102/* PCI IRQ mapping*/
103static int __init cmx270_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
104{
105 int irq;
106
107 printk(KERN_DEBUG "===> %s: %s slot=%x, pin=%x\n", __FUNCTION__,
108 pci_name(dev), slot, pin);
109
110 irq = it8152_pci_map_irq(dev, slot, pin);
111 if (irq)
112 return irq;
113
114 /*
115 Here comes the ugly part. The routing is baseboard specific,
116 but defining a platform for each possible base of CM-x270 is
117 unrealistic. Here we keep mapping for ATXBase and SB-x270.
118 */
119 /* ATXBASE PCI slot */
120 if (slot == 7)
121 return IT8152_PCI_INTA;
122
123 /* ATXBase/SB-x270 CardBus */
124 if (slot == 8 || slot == 0)
125 return IT8152_PCI_INTB;
126
127 /* ATXBase Ethernet */
128 if (slot == 9)
129 return IT8152_PCI_INTA;
130
131 /* SB-x270 Ethernet */
132 if (slot == 16)
133 return IT8152_PCI_INTA;
134
135 /* PC104+ interrupt routing */
136 if ((slot == 17) || (slot == 19))
137 return IT8152_PCI_INTA;
138 if ((slot == 18) || (slot == 20))
139 return IT8152_PCI_INTB;
140
141 return(0);
142}
143
144static struct pci_bus * __init
145cmx270_pci_scan_bus(int nr, struct pci_sys_data *sys)
146{
147 printk(KERN_INFO "Initializing CM-X270 PCI subsystem\n");
148
149 __raw_writel(0x800, IT8152_PCI_CFG_ADDR);
150 if (__raw_readl(IT8152_PCI_CFG_DATA) == 0x81521283) {
151 printk(KERN_INFO "PCI Bridge found.\n");
152
153 /* set PCI I/O base at 0 */
154 writel(0x848, IT8152_PCI_CFG_ADDR);
155 writel(0, IT8152_PCI_CFG_DATA);
156
157 /* set PCI memory base at 0 */
158 writel(0x840, IT8152_PCI_CFG_ADDR);
159 writel(0, IT8152_PCI_CFG_DATA);
160
161 writel(0x20, IT8152_GPIO_GPDR);
162
163 /* CardBus Controller on ATXbase baseboard */
164 writel(0x4000, IT8152_PCI_CFG_ADDR);
165 if (readl(IT8152_PCI_CFG_DATA) == 0xAC51104C) {
166 printk(KERN_INFO "CardBus Bridge found.\n");
167
168 /* Configure socket 0 */
169 writel(0x408C, IT8152_PCI_CFG_ADDR);
170 writel(0x1022, IT8152_PCI_CFG_DATA);
171
172 writel(0x4080, IT8152_PCI_CFG_ADDR);
173 writel(0x3844d060, IT8152_PCI_CFG_DATA);
174
175 writel(0x4090, IT8152_PCI_CFG_ADDR);
176 writel(((readl(IT8152_PCI_CFG_DATA) & 0xffff) |
177 0x60440000),
178 IT8152_PCI_CFG_DATA);
179
180 writel(0x4018, IT8152_PCI_CFG_ADDR);
181 writel(0xb0000000, IT8152_PCI_CFG_DATA);
182
183 /* Configure socket 1 */
184 writel(0x418C, IT8152_PCI_CFG_ADDR);
185 writel(0x1022, IT8152_PCI_CFG_DATA);
186
187 writel(0x4180, IT8152_PCI_CFG_ADDR);
188 writel(0x3844d060, IT8152_PCI_CFG_DATA);
189
190 writel(0x4190, IT8152_PCI_CFG_ADDR);
191 writel(((readl(IT8152_PCI_CFG_DATA) & 0xffff) |
192 0x60440000),
193 IT8152_PCI_CFG_DATA);
194
195 writel(0x4118, IT8152_PCI_CFG_ADDR);
196 writel(0xb0000000, IT8152_PCI_CFG_DATA);
197 }
198 }
199 return it8152_pci_scan_bus(nr, sys);
200}
201
202static struct hw_pci cmx270_pci __initdata = {
203 .swizzle = pci_std_swizzle,
204 .map_irq = cmx270_pci_map_irq,
205 .nr_controllers = 1,
206 .setup = it8152_pci_setup,
207 .scan = cmx270_pci_scan_bus,
208};
209
210static int __init cmx270_init_pci(void)
211{
212 if (machine_is_armcore())
213 pci_common_init(&cmx270_pci);
214
215 return 0;
216}
217
218subsys_initcall(cmx270_init_pci);
diff --git a/arch/arm/mach-pxa/cm-x270-pci.h b/arch/arm/mach-pxa/cm-x270-pci.h
new file mode 100644
index 000000000000..ffe37b66f9a0
--- /dev/null
+++ b/arch/arm/mach-pxa/cm-x270-pci.h
@@ -0,0 +1,13 @@
1extern void __cmx270_pci_init_irq(void);
2extern void __cmx270_pci_suspend(void);
3extern void __cmx270_pci_resume(void);
4
5#ifdef CONFIG_PCI
6#define cmx270_pci_init_irq __cmx270_pci_init_irq
7#define cmx270_pci_suspend __cmx270_pci_suspend
8#define cmx270_pci_resume __cmx270_pci_resume
9#else
10#define cmx270_pci_init_irq() do {} while (0)
11#define cmx270_pci_suspend() do {} while (0)
12#define cmx270_pci_resume() do {} while (0)
13#endif
diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
new file mode 100644
index 000000000000..177664ccb2e2
--- /dev/null
+++ b/arch/arm/mach-pxa/cm-x270.c
@@ -0,0 +1,645 @@
1/*
2 * linux/arch/arm/mach-pxa/cm-x270.c
3 *
4 * Copyright (C) 2007 CompuLab, Ltd.
5 * Mike Rapoport <mike@compulab.co.il>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/types.h>
13#include <linux/pm.h>
14#include <linux/fb.h>
15#include <linux/platform_device.h>
16#include <linux/irq.h>
17#include <linux/sysdev.h>
18#include <linux/io.h>
19#include <linux/delay.h>
20
21#include <linux/dm9000.h>
22#include <linux/rtc-v3020.h>
23#include <linux/serial_8250.h>
24
25#include <video/mbxfb.h>
26
27#include <asm/mach/arch.h>
28#include <asm/mach-types.h>
29#include <asm/mach/map.h>
30
31#include <asm/arch/pxa-regs.h>
32#include <asm/arch/pxafb.h>
33#include <asm/arch/ohci.h>
34#include <asm/arch/mmc.h>
35#include <asm/arch/bitfield.h>
36#include <asm/arch/cm-x270.h>
37
38#include <asm/hardware/it8152.h>
39
40#include "generic.h"
41#include "cm-x270-pci.h"
42
43#define RTC_PHYS_BASE (PXA_CS1_PHYS + (5 << 22))
44#define DM9000_PHYS_BASE (PXA_CS1_PHYS + (6 << 22))
45
46static struct resource cmx270_dm9k_resource[] = {
47 [0] = {
48 .start = DM9000_PHYS_BASE,
49 .end = DM9000_PHYS_BASE + 4,
50 .flags = IORESOURCE_MEM,
51 },
52 [1] = {
53 .start = DM9000_PHYS_BASE + 8,
54 .end = DM9000_PHYS_BASE + 8 + 500,
55 .flags = IORESOURCE_MEM,
56 },
57 [2] = {
58 .start = CMX270_ETHIRQ,
59 .end = CMX270_ETHIRQ,
60 .flags = IORESOURCE_IRQ,
61 }
62};
63
64/* for the moment we limit ourselves to 32bit IO until some
65 * better IO routines can be written and tested
66 */
67static struct dm9000_plat_data cmx270_dm9k_platdata = {
68 .flags = DM9000_PLATF_32BITONLY,
69};
70
71/* Ethernet device */
72static struct platform_device cmx270_device_dm9k = {
73 .name = "dm9000",
74 .id = 0,
75 .num_resources = ARRAY_SIZE(cmx270_dm9k_resource),
76 .resource = cmx270_dm9k_resource,
77 .dev = {
78 .platform_data = &cmx270_dm9k_platdata,
79 }
80};
81
82/* audio device */
83static struct platform_device cmx270_audio_device = {
84 .name = "pxa2xx-ac97",
85 .id = -1,
86};
87
88/* touchscreen controller */
89static struct platform_device cmx270_ts_device = {
90 .name = "ucb1400_ts",
91 .id = -1,
92};
93
94/* RTC */
95static struct resource cmx270_v3020_resource[] = {
96 [0] = {
97 .start = RTC_PHYS_BASE,
98 .end = RTC_PHYS_BASE + 4,
99 .flags = IORESOURCE_MEM,
100 },
101};
102
103struct v3020_platform_data cmx270_v3020_pdata = {
104 .leftshift = 16,
105};
106
107static struct platform_device cmx270_rtc_device = {
108 .name = "v3020",
109 .num_resources = ARRAY_SIZE(cmx270_v3020_resource),
110 .resource = cmx270_v3020_resource,
111 .id = -1,
112 .dev = {
113 .platform_data = &cmx270_v3020_pdata,
114 }
115};
116
117/*
118 * CM-X270 LEDs
119 */
120static struct platform_device cmx270_led_device = {
121 .name = "cm-x270-led",
122 .id = -1,
123};
124
125/* 2700G graphics */
126static u64 fb_dma_mask = ~(u64)0;
127
128static struct resource cmx270_2700G_resource[] = {
129 /* frame buffer memory including ODFB and External SDRAM */
130 [0] = {
131 .start = MARATHON_PHYS,
132 .end = MARATHON_PHYS + 0x02000000,
133 .flags = IORESOURCE_MEM,
134 },
135 /* Marathon registers */
136 [1] = {
137 .start = MARATHON_PHYS + 0x03fe0000,
138 .end = MARATHON_PHYS + 0x03ffffff,
139 .flags = IORESOURCE_MEM,
140 },
141};
142
143static unsigned long save_lcd_regs[10];
144
145static int cmx270_marathon_probe(struct fb_info *fb)
146{
147 /* save PXA-270 pin settings before enabling 2700G */
148 save_lcd_regs[0] = GPDR1;
149 save_lcd_regs[1] = GPDR2;
150 save_lcd_regs[2] = GAFR1_U;
151 save_lcd_regs[3] = GAFR2_L;
152 save_lcd_regs[4] = GAFR2_U;
153
154 /* Disable PXA-270 on-chip controller driving pins */
155 GPDR1 &= ~(0xfc000000);
156 GPDR2 &= ~(0x00c03fff);
157 GAFR1_U &= ~(0xfff00000);
158 GAFR2_L &= ~(0x0fffffff);
159 GAFR2_U &= ~(0x0000f000);
160 return 0;
161}
162
163static int cmx270_marathon_remove(struct fb_info *fb)
164{
165 GPDR1 = save_lcd_regs[0];
166 GPDR2 = save_lcd_regs[1];
167 GAFR1_U = save_lcd_regs[2];
168 GAFR2_L = save_lcd_regs[3];
169 GAFR2_U = save_lcd_regs[4];
170 return 0;
171}
172
173static struct mbxfb_platform_data cmx270_2700G_data = {
174 .xres = {
175 .min = 240,
176 .max = 1200,
177 .defval = 640,
178 },
179 .yres = {
180 .min = 240,
181 .max = 1200,
182 .defval = 480,
183 },
184 .bpp = {
185 .min = 16,
186 .max = 32,
187 .defval = 16,
188 },
189 .memsize = 8*1024*1024,
190 .probe = cmx270_marathon_probe,
191 .remove = cmx270_marathon_remove,
192};
193
194static struct platform_device cmx270_2700G = {
195 .name = "mbx-fb",
196 .dev = {
197 .platform_data = &cmx270_2700G_data,
198 .dma_mask = &fb_dma_mask,
199 .coherent_dma_mask = 0xffffffff,
200 },
201 .num_resources = ARRAY_SIZE(cmx270_2700G_resource),
202 .resource = cmx270_2700G_resource,
203 .id = -1,
204};
205
206static u64 ata_dma_mask = ~(u64)0;
207
208static struct platform_device cmx270_ata = {
209 .name = "pata_cm_x270",
210 .id = -1,
211 .dev = {
212 .dma_mask = &ata_dma_mask,
213 .coherent_dma_mask = 0xffffffff,
214 },
215};
216
217/* platform devices */
218static struct platform_device *platform_devices[] __initdata = {
219 &cmx270_device_dm9k,
220 &cmx270_audio_device,
221 &cmx270_rtc_device,
222 &cmx270_2700G,
223 &cmx270_led_device,
224 &cmx270_ts_device,
225 &cmx270_ata,
226};
227
228/* Map PCI companion and IDE/General Purpose CS statically */
229static struct map_desc cmx270_io_desc[] __initdata = {
230 [0] = { /* IDE/general purpose space */
231 .virtual = CMX270_IDE104_VIRT,
232 .pfn = __phys_to_pfn(CMX270_IDE104_PHYS),
233 .length = SZ_64M - SZ_8M,
234 .type = MT_DEVICE
235 },
236 [1] = { /* PCI bridge */
237 .virtual = CMX270_IT8152_VIRT,
238 .pfn = __phys_to_pfn(CMX270_IT8152_PHYS),
239 .length = SZ_64M,
240 .type = MT_DEVICE
241 },
242};
243
244/*
245 Display definitions
246 keep these for backwards compatibility, although symbolic names (as
247 e.g. in lpd270.c) looks better
248*/
249#define MTYPE_STN320x240 0
250#define MTYPE_TFT640x480 1
251#define MTYPE_CRT640x480 2
252#define MTYPE_CRT800x600 3
253#define MTYPE_TFT320x240 6
254#define MTYPE_STN640x480 7
255
256static struct pxafb_mode_info generic_stn_320x240_mode = {
257 .pixclock = 76923,
258 .bpp = 8,
259 .xres = 320,
260 .yres = 240,
261 .hsync_len = 3,
262 .vsync_len = 2,
263 .left_margin = 3,
264 .upper_margin = 0,
265 .right_margin = 3,
266 .lower_margin = 0,
267 .sync = (FB_SYNC_HOR_HIGH_ACT |
268 FB_SYNC_VERT_HIGH_ACT),
269 .cmap_greyscale = 0,
270};
271
272static struct pxafb_mach_info generic_stn_320x240 = {
273 .modes = &generic_stn_320x240_mode,
274 .num_modes = 1,
275 .lccr0 = 0,
276 .lccr3 = (LCCR3_PixClkDiv(0x03) |
277 LCCR3_Acb(0xff) |
278 LCCR3_PCP),
279 .cmap_inverse = 0,
280 .cmap_static = 0,
281};
282
283static struct pxafb_mode_info generic_tft_640x480_mode = {
284 .pixclock = 38461,
285 .bpp = 8,
286 .xres = 640,
287 .yres = 480,
288 .hsync_len = 60,
289 .vsync_len = 2,
290 .left_margin = 70,
291 .upper_margin = 10,
292 .right_margin = 70,
293 .lower_margin = 5,
294 .sync = 0,
295 .cmap_greyscale = 0,
296};
297
298static struct pxafb_mach_info generic_tft_640x480 = {
299 .modes = &generic_tft_640x480_mode,
300 .num_modes = 1,
301 .lccr0 = (LCCR0_PAS),
302 .lccr3 = (LCCR3_PixClkDiv(0x01) |
303 LCCR3_Acb(0xff) |
304 LCCR3_PCP),
305 .cmap_inverse = 0,
306 .cmap_static = 0,
307};
308
309static struct pxafb_mode_info generic_crt_640x480_mode = {
310 .pixclock = 38461,
311 .bpp = 8,
312 .xres = 640,
313 .yres = 480,
314 .hsync_len = 63,
315 .vsync_len = 2,
316 .left_margin = 81,
317 .upper_margin = 33,
318 .right_margin = 16,
319 .lower_margin = 10,
320 .sync = (FB_SYNC_HOR_HIGH_ACT |
321 FB_SYNC_VERT_HIGH_ACT),
322 .cmap_greyscale = 0,
323};
324
325static struct pxafb_mach_info generic_crt_640x480 = {
326 .modes = &generic_crt_640x480_mode,
327 .num_modes = 1,
328 .lccr0 = (LCCR0_PAS),
329 .lccr3 = (LCCR3_PixClkDiv(0x01) |
330 LCCR3_Acb(0xff)),
331 .cmap_inverse = 0,
332 .cmap_static = 0,
333};
334
335static struct pxafb_mode_info generic_crt_800x600_mode = {
336 .pixclock = 28846,
337 .bpp = 8,
338 .xres = 800,
339 .yres = 600,
340 .hsync_len = 63,
341 .vsync_len = 2,
342 .left_margin = 26,
343 .upper_margin = 21,
344 .right_margin = 26,
345 .lower_margin = 11,
346 .sync = (FB_SYNC_HOR_HIGH_ACT |
347 FB_SYNC_VERT_HIGH_ACT),
348 .cmap_greyscale = 0,
349};
350
351static struct pxafb_mach_info generic_crt_800x600 = {
352 .modes = &generic_crt_800x600_mode,
353 .num_modes = 1,
354 .lccr0 = (LCCR0_PAS),
355 .lccr3 = (LCCR3_PixClkDiv(0x02) |
356 LCCR3_Acb(0xff)),
357 .cmap_inverse = 0,
358 .cmap_static = 0,
359};
360
361static struct pxafb_mode_info generic_tft_320x240_mode = {
362 .pixclock = 134615,
363 .bpp = 16,
364 .xres = 320,
365 .yres = 240,
366 .hsync_len = 63,
367 .vsync_len = 7,
368 .left_margin = 75,
369 .upper_margin = 0,
370 .right_margin = 15,
371 .lower_margin = 15,
372 .sync = 0,
373 .cmap_greyscale = 0,
374};
375
376static struct pxafb_mach_info generic_tft_320x240 = {
377 .modes = &generic_tft_320x240_mode,
378 .num_modes = 1,
379 .lccr0 = (LCCR0_PAS),
380 .lccr3 = (LCCR3_PixClkDiv(0x06) |
381 LCCR3_Acb(0xff) |
382 LCCR3_PCP),
383 .cmap_inverse = 0,
384 .cmap_static = 0,
385};
386
387static struct pxafb_mode_info generic_stn_640x480_mode = {
388 .pixclock = 57692,
389 .bpp = 8,
390 .xres = 640,
391 .yres = 480,
392 .hsync_len = 4,
393 .vsync_len = 2,
394 .left_margin = 10,
395 .upper_margin = 5,
396 .right_margin = 10,
397 .lower_margin = 5,
398 .sync = (FB_SYNC_HOR_HIGH_ACT |
399 FB_SYNC_VERT_HIGH_ACT),
400 .cmap_greyscale = 0,
401};
402
403static struct pxafb_mach_info generic_stn_640x480 = {
404 .modes = &generic_stn_640x480_mode,
405 .num_modes = 1,
406 .lccr0 = 0,
407 .lccr3 = (LCCR3_PixClkDiv(0x02) |
408 LCCR3_Acb(0xff)),
409 .cmap_inverse = 0,
410 .cmap_static = 0,
411};
412
413static struct pxafb_mach_info *cmx270_display = &generic_crt_640x480;
414
415static int __init cmx270_set_display(char *str)
416{
417 int disp_type = simple_strtol(str, NULL, 0);
418 switch (disp_type) {
419 case MTYPE_STN320x240:
420 cmx270_display = &generic_stn_320x240;
421 break;
422 case MTYPE_TFT640x480:
423 cmx270_display = &generic_tft_640x480;
424 break;
425 case MTYPE_CRT640x480:
426 cmx270_display = &generic_crt_640x480;
427 break;
428 case MTYPE_CRT800x600:
429 cmx270_display = &generic_crt_800x600;
430 break;
431 case MTYPE_TFT320x240:
432 cmx270_display = &generic_tft_320x240;
433 break;
434 case MTYPE_STN640x480:
435 cmx270_display = &generic_stn_640x480;
436 break;
437 default: /* fallback to CRT 640x480 */
438 cmx270_display = &generic_crt_640x480;
439 break;
440 }
441 return 1;
442}
443
444/*
445 This should be done really early to get proper configuration for
446 frame buffer.
447 Indeed, pxafb parameters can be used istead, but CM-X270 bootloader
448 has limitied line length for kernel command line, and also it will
449 break compatibitlty with proprietary releases already in field.
450*/
451__setup("monitor=", cmx270_set_display);
452
453/* PXA27x OHCI controller setup */
454static int cmx270_ohci_init(struct device *dev)
455{
456 /* Set the Power Control Polarity Low */
457 UHCHR = (UHCHR | UHCHR_PCPL) &
458 ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE);
459
460 return 0;
461}
462
463static struct pxaohci_platform_data cmx270_ohci_platform_data = {
464 .port_mode = PMM_PERPORT_MODE,
465 .init = cmx270_ohci_init,
466};
467
468
469static int cmx270_mci_init(struct device *dev,
470 irq_handler_t cmx270_detect_int,
471 void *data)
472{
473 int err;
474
475 /*
476 * setup GPIO for PXA27x MMC controller
477 */
478 pxa_gpio_mode(GPIO32_MMCCLK_MD);
479 pxa_gpio_mode(GPIO112_MMCCMD_MD);
480 pxa_gpio_mode(GPIO92_MMCDAT0_MD);
481 pxa_gpio_mode(GPIO109_MMCDAT1_MD);
482 pxa_gpio_mode(GPIO110_MMCDAT2_MD);
483 pxa_gpio_mode(GPIO111_MMCDAT3_MD);
484
485 /* SB-X270 uses GPIO105 as SD power enable */
486 pxa_gpio_mode(105 | GPIO_OUT);
487
488 /* card detect IRQ on GPIO 83 */
489 pxa_gpio_mode(IRQ_TO_GPIO(CMX270_MMC_IRQ));
490 set_irq_type(CMX270_MMC_IRQ, IRQT_FALLING);
491
492 err = request_irq(CMX270_MMC_IRQ, cmx270_detect_int,
493 IRQF_DISABLED | IRQF_TRIGGER_FALLING,
494 "MMC card detect", data);
495 if (err) {
496 printk(KERN_ERR "cmx270_mci_init: MMC/SD: can't"
497 " request MMC card detect IRQ\n");
498 return -1;
499 }
500
501 return 0;
502}
503
504static void cmx270_mci_setpower(struct device *dev, unsigned int vdd)
505{
506 struct pxamci_platform_data *p_d = dev->platform_data;
507
508 if ((1 << vdd) & p_d->ocr_mask) {
509 printk(KERN_DEBUG "%s: on\n", __FUNCTION__);
510 GPCR(105) = GPIO_bit(105);
511 } else {
512 GPSR(105) = GPIO_bit(105);
513 printk(KERN_DEBUG "%s: off\n", __FUNCTION__);
514 }
515}
516
517static void cmx270_mci_exit(struct device *dev, void *data)
518{
519 free_irq(CMX270_MMC_IRQ, data);
520}
521
522static struct pxamci_platform_data cmx270_mci_platform_data = {
523 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
524 .init = cmx270_mci_init,
525 .setpower = cmx270_mci_setpower,
526 .exit = cmx270_mci_exit,
527};
528
529#ifdef CONFIG_PM
530static unsigned long sleep_save_msc[10];
531
532static int cmx270_suspend(struct sys_device *dev, pm_message_t state)
533{
534 cmx270_pci_suspend();
535
536 /* save MSC registers */
537 sleep_save_msc[0] = MSC0;
538 sleep_save_msc[1] = MSC1;
539 sleep_save_msc[2] = MSC2;
540
541 /* setup power saving mode registers */
542 PCFR = 0x0;
543 PSLR = 0xff400000;
544 PMCR = 0x00000005;
545 PWER = 0x80000000;
546 PFER = 0x00000000;
547 PRER = 0x00000000;
548 PGSR0 = 0xC0018800;
549 PGSR1 = 0x004F0002;
550 PGSR2 = 0x6021C000;
551 PGSR3 = 0x00020000;
552
553 return 0;
554}
555
556static int cmx270_resume(struct sys_device *dev)
557{
558 cmx270_pci_resume();
559
560 /* restore MSC registers */
561 MSC0 = sleep_save_msc[0];
562 MSC1 = sleep_save_msc[1];
563 MSC2 = sleep_save_msc[2];
564
565 return 0;
566}
567
568static struct sysdev_class cmx270_pm_sysclass = {
569 set_kset_name("pm"),
570 .resume = cmx270_resume,
571 .suspend = cmx270_suspend,
572};
573
574static struct sys_device cmx270_pm_device = {
575 .cls = &cmx270_pm_sysclass,
576};
577
578static int __init cmx270_pm_init(void)
579{
580 int error;
581 error = sysdev_class_register(&cmx270_pm_sysclass);
582 if (error == 0)
583 error = sysdev_register(&cmx270_pm_device);
584 return error;
585}
586#else
587static int __init cmx270_pm_init(void) { return 0; }
588#endif
589
590static void __init cmx270_init(void)
591{
592 cmx270_pm_init();
593
594 set_pxa_fb_info(cmx270_display);
595
596 /* register CM-X270 platform devices */
597 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
598
599 /* set MCI and OHCI platform parameters */
600 pxa_set_mci_info(&cmx270_mci_platform_data);
601 pxa_set_ohci_info(&cmx270_ohci_platform_data);
602
603 /* This enables the STUART */
604 pxa_gpio_mode(GPIO46_STRXD_MD);
605 pxa_gpio_mode(GPIO47_STTXD_MD);
606
607 /* This enables the BTUART */
608 pxa_gpio_mode(GPIO42_BTRXD_MD);
609 pxa_gpio_mode(GPIO43_BTTXD_MD);
610 pxa_gpio_mode(GPIO44_BTCTS_MD);
611 pxa_gpio_mode(GPIO45_BTRTS_MD);
612}
613
614static void __init cmx270_init_irq(void)
615{
616 pxa27x_init_irq();
617
618
619 cmx270_pci_init_irq();
620
621 /* Setup interrupt for dm9000 */
622 pxa_gpio_mode(IRQ_TO_GPIO(CMX270_ETHIRQ));
623 set_irq_type(CMX270_ETHIRQ, IRQT_RISING);
624
625 /* Setup interrupt for 2700G */
626 pxa_gpio_mode(IRQ_TO_GPIO(CMX270_GFXIRQ));
627 set_irq_type(CMX270_GFXIRQ, IRQT_FALLING);
628}
629
630static void __init cmx270_map_io(void)
631{
632 pxa_map_io();
633 iotable_init(cmx270_io_desc, ARRAY_SIZE(cmx270_io_desc));
634}
635
636
637MACHINE_START(ARMCORE, "Compulab CM-x270")
638 .boot_params = 0xa0000100,
639 .phys_io = 0x40000000,
640 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
641 .map_io = cmx270_map_io,
642 .init_irq = cmx270_init_irq,
643 .timer = &pxa_timer,
644 .init_machine = cmx270_init,
645MACHINE_END
diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h
index 636fdb1c049c..94c8d5cdd60a 100644
--- a/arch/arm/mach-pxa/devices.h
+++ b/arch/arm/mach-pxa/devices.h
@@ -9,3 +9,6 @@ extern struct platform_device pxa_device_i2c;
9extern struct platform_device pxa_device_i2s; 9extern struct platform_device pxa_device_i2s;
10extern struct platform_device pxa_device_ficp; 10extern struct platform_device pxa_device_ficp;
11extern struct platform_device pxa_device_rtc; 11extern struct platform_device pxa_device_rtc;
12
13extern struct platform_device pxa27x_device_i2c_power;
14extern struct platform_device pxa27x_device_ohci;
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 5510f6fdce55..1c34946ee16e 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -25,10 +25,6 @@
25#include <linux/pm.h> 25#include <linux/pm.h>
26#include <linux/string.h> 26#include <linux/string.h>
27 27
28#include <linux/sched.h>
29#include <asm/cnt32_to_63.h>
30#include <asm/div64.h>
31
32#include <asm/hardware.h> 28#include <asm/hardware.h>
33#include <asm/irq.h> 29#include <asm/irq.h>
34#include <asm/system.h> 30#include <asm/system.h>
@@ -47,66 +43,39 @@
47#include "generic.h" 43#include "generic.h"
48 44
49/* 45/*
50 * This is the PXA2xx sched_clock implementation. This has a resolution 46 * Get the clock frequency as reflected by CCCR and the turbo flag.
51 * of at least 308ns and a maximum value that depends on the value of 47 * We assume these values have been applied via a fcs.
52 * CLOCK_TICK_RATE. 48 * If info is not 0 we also display the current settings.
53 *
54 * The return value is guaranteed to be monotonic in that range as
55 * long as there is always less than 582 seconds between successive
56 * calls to this function.
57 */ 49 */
58unsigned long long sched_clock(void) 50unsigned int get_clk_frequency_khz(int info)
59{ 51{
60 unsigned long long v = cnt32_to_63(OSCR); 52 if (cpu_is_pxa21x() || cpu_is_pxa25x())
61 /* Note: top bit ov v needs cleared unless multiplier is even. */ 53 return pxa25x_get_clk_frequency_khz(info);
62 54 else if (cpu_is_pxa27x())
63#if CLOCK_TICK_RATE == 3686400 55 return pxa27x_get_clk_frequency_khz(info);
64 /* 1E9 / 3686400 => 78125 / 288, max value = 32025597s (370 days). */ 56 else
65 /* The <<1 is used to get rid of tick.hi top bit */ 57 return pxa3xx_get_clk_frequency_khz(info);
66 v *= 78125<<1; 58}
67 do_div(v, 288<<1); 59EXPORT_SYMBOL(get_clk_frequency_khz);
68#elif CLOCK_TICK_RATE == 3250000
69 /* 1E9 / 3250000 => 4000 / 13, max value = 709490156s (8211 days) */
70 v *= 4000;
71 do_div(v, 13);
72#elif CLOCK_TICK_RATE == 3249600
73 /* 1E9 / 3249600 => 625000 / 2031, max value = 4541295s (52 days) */
74 v *= 625000;
75 do_div(v, 2031);
76#else
77#warning "consider fixing sched_clock for your value of CLOCK_TICK_RATE"
78 /*
79 * 96-bit math to perform tick * NSEC_PER_SEC / CLOCK_TICK_RATE for
80 * any value of CLOCK_TICK_RATE. Max value is in the 80 thousand
81 * years range and truncation to unsigned long long limits it to
82 * sched_clock's max range of ~584 years. This is nice but with
83 * higher computation cost.
84 */
85 {
86 union {
87 unsigned long long val;
88 struct { unsigned long lo, hi; };
89 } x;
90 unsigned long long y;
91
92 x.val = v;
93 x.hi &= 0x7fffffff;
94 y = (unsigned long long)x.lo * NSEC_PER_SEC;
95 x.lo = y;
96 y = (y >> 32) + (unsigned long long)x.hi * NSEC_PER_SEC;
97 x.hi = do_div(y, CLOCK_TICK_RATE);
98 do_div(x.val, CLOCK_TICK_RATE);
99 x.hi += y;
100 v = x.val;
101 }
102#endif
103 60
104 return v; 61/*
62 * Return the current memory clock frequency in units of 10kHz
63 */
64unsigned int get_memclk_frequency_10khz(void)
65{
66 if (cpu_is_pxa21x() || cpu_is_pxa25x())
67 return pxa25x_get_memclk_frequency_10khz();
68 else if (cpu_is_pxa27x())
69 return pxa27x_get_memclk_frequency_10khz();
70 else
71 return pxa3xx_get_memclk_frequency_10khz();
105} 72}
73EXPORT_SYMBOL(get_memclk_frequency_10khz);
106 74
107/* 75/*
108 * Handy function to set GPIO alternate functions 76 * Handy function to set GPIO alternate functions
109 */ 77 */
78int pxa_last_gpio;
110 79
111int pxa_gpio_mode(int gpio_mode) 80int pxa_gpio_mode(int gpio_mode)
112{ 81{
@@ -115,7 +84,7 @@ int pxa_gpio_mode(int gpio_mode)
115 int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8; 84 int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8;
116 int gafr; 85 int gafr;
117 86
118 if (gpio > PXA_LAST_GPIO) 87 if (gpio > pxa_last_gpio)
119 return -EINVAL; 88 return -EINVAL;
120 89
121 local_irq_save(flags); 90 local_irq_save(flags);
@@ -136,6 +105,44 @@ int pxa_gpio_mode(int gpio_mode)
136 105
137EXPORT_SYMBOL(pxa_gpio_mode); 106EXPORT_SYMBOL(pxa_gpio_mode);
138 107
108int gpio_direction_input(unsigned gpio)
109{
110 unsigned long flags;
111 u32 mask;
112
113 if (gpio > pxa_last_gpio)
114 return -EINVAL;
115
116 mask = GPIO_bit(gpio);
117 local_irq_save(flags);
118 GPDR(gpio) &= ~mask;
119 local_irq_restore(flags);
120
121 return 0;
122}
123EXPORT_SYMBOL(gpio_direction_input);
124
125int gpio_direction_output(unsigned gpio, int value)
126{
127 unsigned long flags;
128 u32 mask;
129
130 if (gpio > pxa_last_gpio)
131 return -EINVAL;
132
133 mask = GPIO_bit(gpio);
134 local_irq_save(flags);
135 if (value)
136 GPSR(gpio) = mask;
137 else
138 GPCR(gpio) = mask;
139 GPDR(gpio) |= mask;
140 local_irq_restore(flags);
141
142 return 0;
143}
144EXPORT_SYMBOL(gpio_direction_output);
145
139/* 146/*
140 * Return GPIO level 147 * Return GPIO level
141 */ 148 */
@@ -159,7 +166,7 @@ EXPORT_SYMBOL(pxa_gpio_set_value);
159/* 166/*
160 * Routine to safely enable or disable a clock in the CKEN 167 * Routine to safely enable or disable a clock in the CKEN
161 */ 168 */
162void pxa_set_cken(int clock, int enable) 169void __pxa_set_cken(int clock, int enable)
163{ 170{
164 unsigned long flags; 171 unsigned long flags;
165 local_irq_save(flags); 172 local_irq_save(flags);
@@ -172,7 +179,7 @@ void pxa_set_cken(int clock, int enable)
172 local_irq_restore(flags); 179 local_irq_restore(flags);
173} 180}
174 181
175EXPORT_SYMBOL(pxa_set_cken); 182EXPORT_SYMBOL(__pxa_set_cken);
176 183
177/* 184/*
178 * Intel PXA2xx internal register mapping. 185 * Intel PXA2xx internal register mapping.
@@ -329,21 +336,80 @@ void __init set_pxa_fb_parent(struct device *parent_dev)
329 pxa_device_fb.dev.parent = parent_dev; 336 pxa_device_fb.dev.parent = parent_dev;
330} 337}
331 338
339static struct resource pxa_resource_ffuart[] = {
340 {
341 .start = __PREG(FFUART),
342 .end = __PREG(FFUART) + 35,
343 .flags = IORESOURCE_MEM,
344 }, {
345 .start = IRQ_FFUART,
346 .end = IRQ_FFUART,
347 .flags = IORESOURCE_IRQ,
348 }
349};
350
332struct platform_device pxa_device_ffuart= { 351struct platform_device pxa_device_ffuart= {
333 .name = "pxa2xx-uart", 352 .name = "pxa2xx-uart",
334 .id = 0, 353 .id = 0,
354 .resource = pxa_resource_ffuart,
355 .num_resources = ARRAY_SIZE(pxa_resource_ffuart),
335}; 356};
357
358static struct resource pxa_resource_btuart[] = {
359 {
360 .start = __PREG(BTUART),
361 .end = __PREG(BTUART) + 35,
362 .flags = IORESOURCE_MEM,
363 }, {
364 .start = IRQ_BTUART,
365 .end = IRQ_BTUART,
366 .flags = IORESOURCE_IRQ,
367 }
368};
369
336struct platform_device pxa_device_btuart = { 370struct platform_device pxa_device_btuart = {
337 .name = "pxa2xx-uart", 371 .name = "pxa2xx-uart",
338 .id = 1, 372 .id = 1,
373 .resource = pxa_resource_btuart,
374 .num_resources = ARRAY_SIZE(pxa_resource_btuart),
339}; 375};
376
377static struct resource pxa_resource_stuart[] = {
378 {
379 .start = __PREG(STUART),
380 .end = __PREG(STUART) + 35,
381 .flags = IORESOURCE_MEM,
382 }, {
383 .start = IRQ_STUART,
384 .end = IRQ_STUART,
385 .flags = IORESOURCE_IRQ,
386 }
387};
388
340struct platform_device pxa_device_stuart = { 389struct platform_device pxa_device_stuart = {
341 .name = "pxa2xx-uart", 390 .name = "pxa2xx-uart",
342 .id = 2, 391 .id = 2,
392 .resource = pxa_resource_stuart,
393 .num_resources = ARRAY_SIZE(pxa_resource_stuart),
343}; 394};
395
396static struct resource pxa_resource_hwuart[] = {
397 {
398 .start = __PREG(HWUART),
399 .end = __PREG(HWUART) + 47,
400 .flags = IORESOURCE_MEM,
401 }, {
402 .start = IRQ_HWUART,
403 .end = IRQ_HWUART,
404 .flags = IORESOURCE_IRQ,
405 }
406};
407
344struct platform_device pxa_device_hwuart = { 408struct platform_device pxa_device_hwuart = {
345 .name = "pxa2xx-uart", 409 .name = "pxa2xx-uart",
346 .id = 3, 410 .id = 3,
411 .resource = pxa_resource_hwuart,
412 .num_resources = ARRAY_SIZE(pxa_resource_hwuart),
347}; 413};
348 414
349static struct resource pxai2c_resources[] = { 415static struct resource pxai2c_resources[] = {
diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h
index 91ab2ad8b34b..b30f240a16c7 100644
--- a/arch/arm/mach-pxa/generic.h
+++ b/arch/arm/mach-pxa/generic.h
@@ -15,14 +15,40 @@ extern struct sys_timer pxa_timer;
15extern void __init pxa_init_irq_low(void); 15extern void __init pxa_init_irq_low(void);
16extern void __init pxa_init_irq_high(void); 16extern void __init pxa_init_irq_high(void);
17extern void __init pxa_init_irq_gpio(int gpio_nr); 17extern void __init pxa_init_irq_gpio(int gpio_nr);
18extern void __init pxa_init_irq_set_wake(int (*set_wake)(unsigned int, unsigned int));
18extern void __init pxa25x_init_irq(void); 19extern void __init pxa25x_init_irq(void);
19extern void __init pxa27x_init_irq(void); 20extern void __init pxa27x_init_irq(void);
21extern void __init pxa3xx_init_irq(void);
20extern void __init pxa_map_io(void); 22extern void __init pxa_map_io(void);
21 23
22extern unsigned int get_clk_frequency_khz(int info); 24extern unsigned int get_clk_frequency_khz(int info);
25extern int pxa_last_gpio;
23 26
24#define SET_BANK(__nr,__start,__size) \ 27#define SET_BANK(__nr,__start,__size) \
25 mi->bank[__nr].start = (__start), \ 28 mi->bank[__nr].start = (__start), \
26 mi->bank[__nr].size = (__size), \ 29 mi->bank[__nr].size = (__size), \
27 mi->bank[__nr].node = (((unsigned)(__start) - PHYS_OFFSET) >> 27) 30 mi->bank[__nr].node = (((unsigned)(__start) - PHYS_OFFSET) >> 27)
28 31
32#ifdef CONFIG_PXA25x
33extern unsigned pxa25x_get_clk_frequency_khz(int);
34extern unsigned pxa25x_get_memclk_frequency_10khz(void);
35#else
36#define pxa25x_get_clk_frequency_khz(x) (0)
37#define pxa25x_get_memclk_frequency_10khz() (0)
38#endif
39
40#ifdef CONFIG_PXA27x
41extern unsigned pxa27x_get_clk_frequency_khz(int);
42extern unsigned pxa27x_get_memclk_frequency_10khz(void);
43#else
44#define pxa27x_get_clk_frequency_khz(x) (0)
45#define pxa27x_get_memclk_frequency_10khz() (0)
46#endif
47
48#ifdef CONFIG_PXA3xx
49extern unsigned pxa3xx_get_clk_frequency_khz(int);
50extern unsigned pxa3xx_get_memclk_frequency_10khz(void);
51#else
52#define pxa3xx_get_clk_frequency_khz(x) (0)
53#define pxa3xx_get_memclk_frequency_10khz() (0)
54#endif
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index ae2ae08032d7..07acb45b16ea 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -38,33 +38,11 @@ static void pxa_unmask_low_irq(unsigned int irq)
38 ICMR |= (1 << irq); 38 ICMR |= (1 << irq);
39} 39}
40 40
41static int pxa_set_wake(unsigned int irq, unsigned int on)
42{
43 u32 mask;
44
45 switch (irq) {
46 case IRQ_RTCAlrm:
47 mask = PWER_RTC;
48 break;
49#ifdef CONFIG_PXA27x
50 /* REVISIT can handle USBH1, USBH2, USB, MSL, USIM, ... */
51#endif
52 default:
53 return -EINVAL;
54 }
55 if (on)
56 PWER |= mask;
57 else
58 PWER &= ~mask;
59 return 0;
60}
61
62static struct irq_chip pxa_internal_chip_low = { 41static struct irq_chip pxa_internal_chip_low = {
63 .name = "SC", 42 .name = "SC",
64 .ack = pxa_mask_low_irq, 43 .ack = pxa_mask_low_irq,
65 .mask = pxa_mask_low_irq, 44 .mask = pxa_mask_low_irq,
66 .unmask = pxa_unmask_low_irq, 45 .unmask = pxa_unmask_low_irq,
67 .set_wake = pxa_set_wake,
68}; 46};
69 47
70void __init pxa_init_irq_low(void) 48void __init pxa_init_irq_low(void)
@@ -87,7 +65,7 @@ void __init pxa_init_irq_low(void)
87 } 65 }
88} 66}
89 67
90#ifdef CONFIG_PXA27x 68#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
91 69
92/* 70/*
93 * This is for the second set of internal IRQs as found on the PXA27x. 71 * This is for the second set of internal IRQs as found on the PXA27x.
@@ -125,26 +103,6 @@ void __init pxa_init_irq_high(void)
125} 103}
126#endif 104#endif
127 105
128/* Note that if an input/irq line ever gets changed to an output during
129 * suspend, the relevant PWER, PRER, and PFER bits should be cleared.
130 */
131#ifdef CONFIG_PXA27x
132
133/* PXA27x: Various gpios can issue wakeup events. This logic only
134 * handles the simple cases, not the WEMUX2 and WEMUX3 options
135 */
136#define PXA27x_GPIO_NOWAKE_MASK \
137 ((1 << 8) | (1 << 7) | (1 << 6) | (1 << 5) | (1 << 2))
138#define WAKEMASK(gpio) \
139 (((gpio) <= 15) \
140 ? ((1 << (gpio)) & ~PXA27x_GPIO_NOWAKE_MASK) \
141 : ((gpio == 35) ? (1 << 24) : 0))
142#else
143
144/* pxa 210, 250, 255, 26x: gpios 0..15 can issue wakeups */
145#define WAKEMASK(gpio) (((gpio) <= 15) ? (1 << (gpio)) : 0)
146#endif
147
148/* 106/*
149 * PXA GPIO edge detection for IRQs: 107 * PXA GPIO edge detection for IRQs:
150 * IRQs are generated on Falling-Edge, Rising-Edge, or both. 108 * IRQs are generated on Falling-Edge, Rising-Edge, or both.
@@ -158,11 +116,9 @@ static long GPIO_IRQ_mask[4];
158static int pxa_gpio_irq_type(unsigned int irq, unsigned int type) 116static int pxa_gpio_irq_type(unsigned int irq, unsigned int type)
159{ 117{
160 int gpio, idx; 118 int gpio, idx;
161 u32 mask;
162 119
163 gpio = IRQ_TO_GPIO(irq); 120 gpio = IRQ_TO_GPIO(irq);
164 idx = gpio >> 5; 121 idx = gpio >> 5;
165 mask = WAKEMASK(gpio);
166 122
167 if (type == IRQT_PROBE) { 123 if (type == IRQT_PROBE) {
168 /* Don't mess with enabled GPIOs using preconfigured edges or 124 /* Don't mess with enabled GPIOs using preconfigured edges or
@@ -182,19 +138,15 @@ static int pxa_gpio_irq_type(unsigned int irq, unsigned int type)
182 if (type & __IRQT_RISEDGE) { 138 if (type & __IRQT_RISEDGE) {
183 /* printk("rising "); */ 139 /* printk("rising "); */
184 __set_bit (gpio, GPIO_IRQ_rising_edge); 140 __set_bit (gpio, GPIO_IRQ_rising_edge);
185 PRER |= mask;
186 } else { 141 } else {
187 __clear_bit (gpio, GPIO_IRQ_rising_edge); 142 __clear_bit (gpio, GPIO_IRQ_rising_edge);
188 PRER &= ~mask;
189 } 143 }
190 144
191 if (type & __IRQT_FALEDGE) { 145 if (type & __IRQT_FALEDGE) {
192 /* printk("falling "); */ 146 /* printk("falling "); */
193 __set_bit (gpio, GPIO_IRQ_falling_edge); 147 __set_bit (gpio, GPIO_IRQ_falling_edge);
194 PFER |= mask;
195 } else { 148 } else {
196 __clear_bit (gpio, GPIO_IRQ_falling_edge); 149 __clear_bit (gpio, GPIO_IRQ_falling_edge);
197 PFER &= ~mask;
198 } 150 }
199 151
200 /* printk("edges\n"); */ 152 /* printk("edges\n"); */
@@ -213,29 +165,12 @@ static void pxa_ack_low_gpio(unsigned int irq)
213 GEDR0 = (1 << (irq - IRQ_GPIO0)); 165 GEDR0 = (1 << (irq - IRQ_GPIO0));
214} 166}
215 167
216static int pxa_set_gpio_wake(unsigned int irq, unsigned int on)
217{
218 int gpio = IRQ_TO_GPIO(irq);
219 u32 mask = WAKEMASK(gpio);
220
221 if (!mask)
222 return -EINVAL;
223
224 if (on)
225 PWER |= mask;
226 else
227 PWER &= ~mask;
228 return 0;
229}
230
231
232static struct irq_chip pxa_low_gpio_chip = { 168static struct irq_chip pxa_low_gpio_chip = {
233 .name = "GPIO-l", 169 .name = "GPIO-l",
234 .ack = pxa_ack_low_gpio, 170 .ack = pxa_ack_low_gpio,
235 .mask = pxa_mask_low_irq, 171 .mask = pxa_mask_low_irq,
236 .unmask = pxa_unmask_low_irq, 172 .unmask = pxa_unmask_low_irq,
237 .set_type = pxa_gpio_irq_type, 173 .set_type = pxa_gpio_irq_type,
238 .set_wake = pxa_set_gpio_wake,
239}; 174};
240 175
241/* 176/*
@@ -342,13 +277,14 @@ static struct irq_chip pxa_muxed_gpio_chip = {
342 .mask = pxa_mask_muxed_gpio, 277 .mask = pxa_mask_muxed_gpio,
343 .unmask = pxa_unmask_muxed_gpio, 278 .unmask = pxa_unmask_muxed_gpio,
344 .set_type = pxa_gpio_irq_type, 279 .set_type = pxa_gpio_irq_type,
345 .set_wake = pxa_set_gpio_wake,
346}; 280};
347 281
348void __init pxa_init_irq_gpio(int gpio_nr) 282void __init pxa_init_irq_gpio(int gpio_nr)
349{ 283{
350 int irq, i; 284 int irq, i;
351 285
286 pxa_last_gpio = gpio_nr - 1;
287
352 /* clear all GPIO edge detects */ 288 /* clear all GPIO edge detects */
353 for (i = 0; i < gpio_nr; i += 32) { 289 for (i = 0; i < gpio_nr; i += 32) {
354 GFER(i) = 0; 290 GFER(i) = 0;
@@ -375,3 +311,13 @@ void __init pxa_init_irq_gpio(int gpio_nr)
375 set_irq_chip(IRQ_GPIO_2_x, &pxa_internal_chip_low); 311 set_irq_chip(IRQ_GPIO_2_x, &pxa_internal_chip_low);
376 set_irq_chained_handler(IRQ_GPIO_2_x, pxa_gpio_demux_handler); 312 set_irq_chained_handler(IRQ_GPIO_2_x, pxa_gpio_demux_handler);
377} 313}
314
315void __init pxa_init_irq_set_wake(int (*set_wake)(unsigned int, unsigned int))
316{
317 pxa_internal_chip_low.set_wake = set_wake;
318#ifdef CONFIG_PXA27x
319 pxa_internal_chip_high.set_wake = set_wake;
320#endif
321 pxa_low_gpio_chip.set_wake = set_wake;
322 pxa_muxed_gpio_chip.set_wake = set_wake;
323}
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index e70048fd00a5..011a1a72b61c 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -512,6 +512,25 @@ static void __init lubbock_map_io(void)
512 pxa_gpio_mode(GPIO44_BTCTS_MD); 512 pxa_gpio_mode(GPIO44_BTCTS_MD);
513 pxa_gpio_mode(GPIO45_BTRTS_MD); 513 pxa_gpio_mode(GPIO45_BTRTS_MD);
514 514
515 GPSR(GPIO48_nPOE) =
516 GPIO_bit(GPIO48_nPOE) |
517 GPIO_bit(GPIO49_nPWE) |
518 GPIO_bit(GPIO50_nPIOR) |
519 GPIO_bit(GPIO51_nPIOW) |
520 GPIO_bit(GPIO52_nPCE_1) |
521 GPIO_bit(GPIO53_nPCE_2);
522
523 pxa_gpio_mode(GPIO48_nPOE_MD);
524 pxa_gpio_mode(GPIO49_nPWE_MD);
525 pxa_gpio_mode(GPIO50_nPIOR_MD);
526 pxa_gpio_mode(GPIO51_nPIOW_MD);
527 pxa_gpio_mode(GPIO52_nPCE_1_MD);
528 pxa_gpio_mode(GPIO53_nPCE_2_MD);
529 pxa_gpio_mode(GPIO54_pSKTSEL_MD);
530 pxa_gpio_mode(GPIO55_nPREG_MD);
531 pxa_gpio_mode(GPIO56_nPWAIT_MD);
532 pxa_gpio_mode(GPIO57_nIOIS16_MD);
533
515 /* This is for the SMC chip select */ 534 /* This is for the SMC chip select */
516 pxa_gpio_mode(GPIO79_nCS_3_MD); 535 pxa_gpio_mode(GPIO79_nCS_3_MD);
517 536
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index b02c79c7e6a3..a4bc3483cbb3 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -444,6 +444,25 @@ static void __init mainstone_init(void)
444 */ 444 */
445 pxa_gpio_mode(GPIO45_SYSCLK_AC97_MD); 445 pxa_gpio_mode(GPIO45_SYSCLK_AC97_MD);
446 446
447 GPSR(GPIO48_nPOE) =
448 GPIO_bit(GPIO48_nPOE) |
449 GPIO_bit(GPIO49_nPWE) |
450 GPIO_bit(GPIO50_nPIOR) |
451 GPIO_bit(GPIO51_nPIOW) |
452 GPIO_bit(GPIO85_nPCE_1) |
453 GPIO_bit(GPIO54_nPCE_2);
454
455 pxa_gpio_mode(GPIO48_nPOE_MD);
456 pxa_gpio_mode(GPIO49_nPWE_MD);
457 pxa_gpio_mode(GPIO50_nPIOR_MD);
458 pxa_gpio_mode(GPIO51_nPIOW_MD);
459 pxa_gpio_mode(GPIO85_nPCE_1_MD);
460 pxa_gpio_mode(GPIO54_nPCE_2_MD);
461 pxa_gpio_mode(GPIO79_pSKTSEL_MD);
462 pxa_gpio_mode(GPIO55_nPREG_MD);
463 pxa_gpio_mode(GPIO56_nPWAIT_MD);
464 pxa_gpio_mode(GPIO57_nIOIS16_MD);
465
447 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 466 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
448 467
449 /* reading Mainstone's "Virtual Configuration Register" 468 /* reading Mainstone's "Virtual Configuration Register"
diff --git a/arch/arm/mach-pxa/mfp.c b/arch/arm/mach-pxa/mfp.c
new file mode 100644
index 000000000000..5cd3cadbbd10
--- /dev/null
+++ b/arch/arm/mach-pxa/mfp.c
@@ -0,0 +1,235 @@
1/*
2 * linux/arch/arm/mach-pxa/mfp.c
3 *
4 * PXA3xx Multi-Function Pin Support
5 *
6 * Copyright (C) 2007 Marvell Internation Ltd.
7 *
8 * 2007-08-21: eric miao <eric.y.miao@gmail.com>
9 * initial version
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/module.h>
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/io.h>
20
21#include <asm/hardware.h>
22#include <asm/arch/mfp.h>
23
24/* mfp_spin_lock is used to ensure that MFP register configuration
25 * (most likely a read-modify-write operation) is atomic, and that
26 * mfp_table[] is consistent
27 */
28static DEFINE_SPINLOCK(mfp_spin_lock);
29
30static void __iomem *mfpr_mmio_base = (void __iomem *)&__REG(MFPR_BASE);
31static struct pxa3xx_mfp_pin mfp_table[MFP_PIN_MAX];
32
33#define mfpr_readl(off) \
34 __raw_readl(mfpr_mmio_base + (off))
35
36#define mfpr_writel(off, val) \
37 __raw_writel(val, mfpr_mmio_base + (off))
38
39/*
40 * perform a read-back of any MFPR register to make sure the
41 * previous writings are finished
42 */
43#define mfpr_sync() (void)__raw_readl(mfpr_mmio_base + 0)
44
45static inline void __mfp_config(int pin, unsigned long val)
46{
47 unsigned long off = mfp_table[pin].mfpr_off;
48
49 mfp_table[pin].mfpr_val = val;
50 mfpr_writel(off, val);
51}
52
53void pxa3xx_mfp_config(mfp_cfg_t *mfp_cfgs, int num)
54{
55 int i, pin;
56 unsigned long val, flags;
57 mfp_cfg_t *mfp_cfg = mfp_cfgs;
58
59 spin_lock_irqsave(&mfp_spin_lock, flags);
60
61 for (i = 0; i < num; i++, mfp_cfg++) {
62 pin = MFP_CFG_PIN(*mfp_cfg);
63 val = MFP_CFG_VAL(*mfp_cfg);
64
65 BUG_ON(pin >= MFP_PIN_MAX);
66
67 __mfp_config(pin, val);
68 }
69
70 mfpr_sync();
71 spin_unlock_irqrestore(&mfp_spin_lock, flags);
72}
73
74unsigned long pxa3xx_mfp_read(int mfp)
75{
76 unsigned long val, flags;
77
78 BUG_ON(mfp >= MFP_PIN_MAX);
79
80 spin_lock_irqsave(&mfp_spin_lock, flags);
81 val = mfpr_readl(mfp_table[mfp].mfpr_off);
82 spin_unlock_irqrestore(&mfp_spin_lock, flags);
83
84 return val;
85}
86
87void pxa3xx_mfp_write(int mfp, unsigned long val)
88{
89 unsigned long flags;
90
91 BUG_ON(mfp >= MFP_PIN_MAX);
92
93 spin_lock_irqsave(&mfp_spin_lock, flags);
94 mfpr_writel(mfp_table[mfp].mfpr_off, val);
95 mfpr_sync();
96 spin_unlock_irqrestore(&mfp_spin_lock, flags);
97}
98
99void pxa3xx_mfp_set_afds(int mfp, int af, int ds)
100{
101 uint32_t mfpr_off, mfpr_val;
102 unsigned long flags;
103
104 BUG_ON(mfp >= MFP_PIN_MAX);
105
106 spin_lock_irqsave(&mfp_spin_lock, flags);
107 mfpr_off = mfp_table[mfp].mfpr_off;
108
109 mfpr_val = mfpr_readl(mfpr_off);
110 mfpr_val &= ~(MFPR_AF_MASK | MFPR_DRV_MASK);
111 mfpr_val |= (((af & 0x7) << MFPR_ALT_OFFSET) |
112 ((ds & 0x7) << MFPR_DRV_OFFSET));
113
114 mfpr_writel(mfpr_off, mfpr_val);
115 mfpr_sync();
116
117 spin_unlock_irqrestore(&mfp_spin_lock, flags);
118}
119
120void pxa3xx_mfp_set_rdh(int mfp, int rdh)
121{
122 uint32_t mfpr_off, mfpr_val;
123 unsigned long flags;
124
125 BUG_ON(mfp >= MFP_PIN_MAX);
126
127 spin_lock_irqsave(&mfp_spin_lock, flags);
128
129 mfpr_off = mfp_table[mfp].mfpr_off;
130
131 mfpr_val = mfpr_readl(mfpr_off);
132 mfpr_val &= ~MFPR_RDH_MASK;
133
134 if (likely(rdh))
135 mfpr_val |= (1u << MFPR_SS_OFFSET);
136
137 mfpr_writel(mfpr_off, mfpr_val);
138 mfpr_sync();
139
140 spin_unlock_irqrestore(&mfp_spin_lock, flags);
141}
142
143void pxa3xx_mfp_set_lpm(int mfp, int lpm)
144{
145 uint32_t mfpr_off, mfpr_val;
146 unsigned long flags;
147
148 BUG_ON(mfp >= MFP_PIN_MAX);
149
150 spin_lock_irqsave(&mfp_spin_lock, flags);
151
152 mfpr_off = mfp_table[mfp].mfpr_off;
153 mfpr_val = mfpr_readl(mfpr_off);
154 mfpr_val &= ~MFPR_LPM_MASK;
155
156 if (lpm & 0x1) mfpr_val |= 1u << MFPR_SON_OFFSET;
157 if (lpm & 0x2) mfpr_val |= 1u << MFPR_SD_OFFSET;
158 if (lpm & 0x4) mfpr_val |= 1u << MFPR_PU_OFFSET;
159 if (lpm & 0x8) mfpr_val |= 1u << MFPR_PD_OFFSET;
160 if (lpm &0x10) mfpr_val |= 1u << MFPR_PS_OFFSET;
161
162 mfpr_writel(mfpr_off, mfpr_val);
163 mfpr_sync();
164
165 spin_unlock_irqrestore(&mfp_spin_lock, flags);
166}
167
168void pxa3xx_mfp_set_pull(int mfp, int pull)
169{
170 uint32_t mfpr_off, mfpr_val;
171 unsigned long flags;
172
173 BUG_ON(mfp >= MFP_PIN_MAX);
174
175 spin_lock_irqsave(&mfp_spin_lock, flags);
176
177 mfpr_off = mfp_table[mfp].mfpr_off;
178 mfpr_val = mfpr_readl(mfpr_off);
179 mfpr_val &= ~MFPR_PULL_MASK;
180 mfpr_val |= ((pull & 0x7u) << MFPR_PD_OFFSET);
181
182 mfpr_writel(mfpr_off, mfpr_val);
183 mfpr_sync();
184
185 spin_unlock_irqrestore(&mfp_spin_lock, flags);
186}
187
188void pxa3xx_mfp_set_edge(int mfp, int edge)
189{
190 uint32_t mfpr_off, mfpr_val;
191 unsigned long flags;
192
193 BUG_ON(mfp >= MFP_PIN_MAX);
194
195 spin_lock_irqsave(&mfp_spin_lock, flags);
196
197 mfpr_off = mfp_table[mfp].mfpr_off;
198 mfpr_val = mfpr_readl(mfpr_off);
199
200 mfpr_val &= ~MFPR_EDGE_MASK;
201 mfpr_val |= (edge & 0x3u) << MFPR_ERE_OFFSET;
202 mfpr_val |= (!edge & 0x1) << MFPR_EC_OFFSET;
203
204 mfpr_writel(mfpr_off, mfpr_val);
205 mfpr_sync();
206
207 spin_unlock_irqrestore(&mfp_spin_lock, flags);
208}
209
210void __init pxa3xx_mfp_init_addr(struct pxa3xx_mfp_addr_map *map)
211{
212 struct pxa3xx_mfp_addr_map *p;
213 unsigned long offset, flags;
214 int i;
215
216 spin_lock_irqsave(&mfp_spin_lock, flags);
217
218 for (p = map; p->start != MFP_PIN_INVALID; p++) {
219 offset = p->offset;
220 i = p->start;
221
222 do {
223 mfp_table[i].mfpr_off = offset;
224 mfp_table[i].mfpr_val = 0;
225 offset += 4; i++;
226 } while ((i <= p->end) && (p->end != -1));
227 }
228
229 spin_unlock_irqrestore(&mfp_spin_lock, flags);
230}
231
232void __init pxa3xx_init_mfp(void)
233{
234 memset(mfp_table, 0, sizeof(mfp_table));
235}
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 6dfcca72e90f..0d6a72504caa 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -30,6 +30,7 @@
30 30
31#include "generic.h" 31#include "generic.h"
32#include "devices.h" 32#include "devices.h"
33#include "clock.h"
33 34
34/* 35/*
35 * Various clock factors driven by the CCCR register. 36 * Various clock factors driven by the CCCR register.
@@ -53,7 +54,7 @@ static unsigned char N2_clk_mult[8] = { 0, 0, 2, 3, 4, 0, 6, 0 };
53 * We assume these values have been applied via a fcs. 54 * We assume these values have been applied via a fcs.
54 * If info is not 0 we also display the current settings. 55 * If info is not 0 we also display the current settings.
55 */ 56 */
56unsigned int get_clk_frequency_khz(int info) 57unsigned int pxa25x_get_clk_frequency_khz(int info)
57{ 58{
58 unsigned long cccr, turbo; 59 unsigned long cccr, turbo;
59 unsigned int l, L, m, M, n2, N; 60 unsigned int l, L, m, M, n2, N;
@@ -86,27 +87,48 @@ unsigned int get_clk_frequency_khz(int info)
86 return (turbo & 1) ? (N/1000) : (M/1000); 87 return (turbo & 1) ? (N/1000) : (M/1000);
87} 88}
88 89
89EXPORT_SYMBOL(get_clk_frequency_khz);
90
91/* 90/*
92 * Return the current memory clock frequency in units of 10kHz 91 * Return the current memory clock frequency in units of 10kHz
93 */ 92 */
94unsigned int get_memclk_frequency_10khz(void) 93unsigned int pxa25x_get_memclk_frequency_10khz(void)
95{ 94{
96 return L_clk_mult[(CCCR >> 0) & 0x1f] * BASE_CLK / 10000; 95 return L_clk_mult[(CCCR >> 0) & 0x1f] * BASE_CLK / 10000;
97} 96}
98 97
99EXPORT_SYMBOL(get_memclk_frequency_10khz); 98static unsigned long clk_pxa25x_lcd_getrate(struct clk *clk)
100
101/*
102 * Return the current LCD clock frequency in units of 10kHz
103 */
104unsigned int get_lcdclk_frequency_10khz(void)
105{ 99{
106 return get_memclk_frequency_10khz(); 100 return pxa25x_get_memclk_frequency_10khz() * 10000;
107} 101}
108 102
109EXPORT_SYMBOL(get_lcdclk_frequency_10khz); 103static const struct clkops clk_pxa25x_lcd_ops = {
104 .enable = clk_cken_enable,
105 .disable = clk_cken_disable,
106 .getrate = clk_pxa25x_lcd_getrate,
107};
108
109/*
110 * 3.6864MHz -> OST, GPIO, SSP, PWM, PLLs (95.842MHz, 147.456MHz)
111 * 95.842MHz -> MMC 19.169MHz, I2C 31.949MHz, FICP 47.923MHz, USB 47.923MHz
112 * 147.456MHz -> UART 14.7456MHz, AC97 12.288MHz, I2S 5.672MHz (allegedly)
113 */
114static struct clk pxa25x_clks[] = {
115 INIT_CK("LCDCLK", LCD, &clk_pxa25x_lcd_ops, &pxa_device_fb.dev),
116 INIT_CKEN("UARTCLK", FFUART, 14745600, 1, &pxa_device_ffuart.dev),
117 INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev),
118 INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev),
119 INIT_CKEN("UARTCLK", STUART, 14745600, 1, NULL),
120 INIT_CKEN("UDCCLK", USB, 47923000, 5, &pxa_device_udc.dev),
121 INIT_CKEN("MMCCLK", MMC, 19169000, 0, &pxa_device_mci.dev),
122 INIT_CKEN("I2CCLK", I2C, 31949000, 0, &pxa_device_i2c.dev),
123 /*
124 INIT_CKEN("PWMCLK", PWM0, 3686400, 0, NULL),
125 INIT_CKEN("PWMCLK", PWM0, 3686400, 0, NULL),
126 INIT_CKEN("SSPCLK", SSP, 3686400, 0, NULL),
127 INIT_CKEN("I2SCLK", I2S, 14745600, 0, NULL),
128 INIT_CKEN("NSSPCLK", NSSP, 3686400, 0, NULL),
129 */
130 INIT_CKEN("FICPCLK", FICP, 47923000, 0, NULL),
131};
110 132
111#ifdef CONFIG_PM 133#ifdef CONFIG_PM
112 134
@@ -205,10 +227,52 @@ static void __init pxa25x_init_pm(void)
205} 227}
206#endif 228#endif
207 229
230/* PXA25x: supports wakeup from GPIO0..GPIO15 and RTC alarm
231 */
232
233static int pxa25x_set_wake(unsigned int irq, unsigned int on)
234{
235 int gpio = IRQ_TO_GPIO(irq);
236 uint32_t gpio_bit, mask = 0;
237
238 if (gpio >= 0 && gpio <= 15) {
239 gpio_bit = GPIO_bit(gpio);
240 mask = gpio_bit;
241 if (on) {
242 if (GRER(gpio) | gpio_bit)
243 PRER |= gpio_bit;
244 else
245 PRER &= ~gpio_bit;
246
247 if (GFER(gpio) | gpio_bit)
248 PFER |= gpio_bit;
249 else
250 PFER &= ~gpio_bit;
251 }
252 goto set_pwer;
253 }
254
255 if (irq == IRQ_RTCAlrm) {
256 mask = PWER_RTC;
257 goto set_pwer;
258 }
259
260 return -EINVAL;
261
262set_pwer:
263 if (on)
264 PWER |= mask;
265 else
266 PWER &=~mask;
267
268 return 0;
269}
270
208void __init pxa25x_init_irq(void) 271void __init pxa25x_init_irq(void)
209{ 272{
210 pxa_init_irq_low(); 273 pxa_init_irq_low();
211 pxa_init_irq_gpio(85); 274 pxa_init_irq_gpio(85);
275 pxa_init_irq_set_wake(pxa25x_set_wake);
212} 276}
213 277
214static struct platform_device *pxa25x_devices[] __initdata = { 278static struct platform_device *pxa25x_devices[] __initdata = {
@@ -229,6 +293,8 @@ static int __init pxa25x_init(void)
229 int ret = 0; 293 int ret = 0;
230 294
231 if (cpu_is_pxa21x() || cpu_is_pxa25x()) { 295 if (cpu_is_pxa21x() || cpu_is_pxa25x()) {
296 clks_register(pxa25x_clks, ARRAY_SIZE(pxa25x_clks));
297
232 if ((ret = pxa_init_dma(16))) 298 if ((ret = pxa_init_dma(16)))
233 return ret; 299 return ret;
234#ifdef CONFIG_PM 300#ifdef CONFIG_PM
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 203371ab19db..2d7fc39732e4 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -27,6 +27,7 @@
27 27
28#include "generic.h" 28#include "generic.h"
29#include "devices.h" 29#include "devices.h"
30#include "clock.h"
30 31
31/* Crystal clock: 13MHz */ 32/* Crystal clock: 13MHz */
32#define BASE_CLK 13000000 33#define BASE_CLK 13000000
@@ -36,7 +37,7 @@
36 * We assume these values have been applied via a fcs. 37 * We assume these values have been applied via a fcs.
37 * If info is not 0 we also display the current settings. 38 * If info is not 0 we also display the current settings.
38 */ 39 */
39unsigned int get_clk_frequency_khz( int info) 40unsigned int pxa27x_get_clk_frequency_khz(int info)
40{ 41{
41 unsigned long ccsr, clkcfg; 42 unsigned long ccsr, clkcfg;
42 unsigned int l, L, m, M, n2, N, S; 43 unsigned int l, L, m, M, n2, N, S;
@@ -79,7 +80,7 @@ unsigned int get_clk_frequency_khz( int info)
79 * Return the current mem clock frequency in units of 10kHz as 80 * Return the current mem clock frequency in units of 10kHz as
80 * reflected by CCCR[A], B, and L 81 * reflected by CCCR[A], B, and L
81 */ 82 */
82unsigned int get_memclk_frequency_10khz(void) 83unsigned int pxa27x_get_memclk_frequency_10khz(void)
83{ 84{
84 unsigned long ccsr, clkcfg; 85 unsigned long ccsr, clkcfg;
85 unsigned int l, L, m, M; 86 unsigned int l, L, m, M;
@@ -104,7 +105,7 @@ unsigned int get_memclk_frequency_10khz(void)
104/* 105/*
105 * Return the current LCD clock frequency in units of 10kHz as 106 * Return the current LCD clock frequency in units of 10kHz as
106 */ 107 */
107unsigned int get_lcdclk_frequency_10khz(void) 108static unsigned int pxa27x_get_lcdclk_frequency_10khz(void)
108{ 109{
109 unsigned long ccsr; 110 unsigned long ccsr;
110 unsigned int l, L, k, K; 111 unsigned int l, L, k, K;
@@ -120,9 +121,47 @@ unsigned int get_lcdclk_frequency_10khz(void)
120 return (K / 10000); 121 return (K / 10000);
121} 122}
122 123
123EXPORT_SYMBOL(get_clk_frequency_khz); 124static unsigned long clk_pxa27x_lcd_getrate(struct clk *clk)
124EXPORT_SYMBOL(get_memclk_frequency_10khz); 125{
125EXPORT_SYMBOL(get_lcdclk_frequency_10khz); 126 return pxa27x_get_lcdclk_frequency_10khz() * 10000;
127}
128
129static const struct clkops clk_pxa27x_lcd_ops = {
130 .enable = clk_cken_enable,
131 .disable = clk_cken_disable,
132 .getrate = clk_pxa27x_lcd_getrate,
133};
134
135static struct clk pxa27x_clks[] = {
136 INIT_CK("LCDCLK", LCD, &clk_pxa27x_lcd_ops, &pxa_device_fb.dev),
137 INIT_CK("CAMCLK", CAMERA, &clk_pxa27x_lcd_ops, NULL),
138
139 INIT_CKEN("UARTCLK", FFUART, 14857000, 1, &pxa_device_ffuart.dev),
140 INIT_CKEN("UARTCLK", BTUART, 14857000, 1, &pxa_device_btuart.dev),
141 INIT_CKEN("UARTCLK", STUART, 14857000, 1, NULL),
142
143 INIT_CKEN("I2SCLK", I2S, 14682000, 0, &pxa_device_i2s.dev),
144 INIT_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev),
145 INIT_CKEN("UDCCLK", USB, 48000000, 5, &pxa_device_udc.dev),
146 INIT_CKEN("MMCCLK", MMC, 19500000, 0, &pxa_device_mci.dev),
147 INIT_CKEN("FICPCLK", FICP, 48000000, 0, &pxa_device_ficp.dev),
148
149 INIT_CKEN("USBCLK", USB, 48000000, 0, &pxa27x_device_ohci.dev),
150 INIT_CKEN("I2CCLK", PWRI2C, 13000000, 0, &pxa27x_device_i2c_power.dev),
151 INIT_CKEN("KBDCLK", KEYPAD, 32768, 0, NULL),
152
153 /*
154 INIT_CKEN("PWMCLK", PWM0, 13000000, 0, NULL),
155 INIT_CKEN("SSPCLK", SSP1, 13000000, 0, NULL),
156 INIT_CKEN("SSPCLK", SSP2, 13000000, 0, NULL),
157 INIT_CKEN("SSPCLK", SSP3, 13000000, 0, NULL),
158 INIT_CKEN("MSLCLK", MSL, 48000000, 0, NULL),
159 INIT_CKEN("USIMCLK", USIM, 48000000, 0, NULL),
160 INIT_CKEN("MSTKCLK", MEMSTK, 19500000, 0, NULL),
161 INIT_CKEN("IMCLK", IM, 0, 0, NULL),
162 INIT_CKEN("MEMCLK", MEMC, 0, 0, NULL),
163 */
164};
126 165
127#ifdef CONFIG_PM 166#ifdef CONFIG_PM
128 167
@@ -267,6 +306,69 @@ static void __init pxa27x_init_pm(void)
267} 306}
268#endif 307#endif
269 308
309/* PXA27x: Various gpios can issue wakeup events. This logic only
310 * handles the simple cases, not the WEMUX2 and WEMUX3 options
311 */
312#define PXA27x_GPIO_NOWAKE_MASK \
313 ((1 << 8) | (1 << 7) | (1 << 6) | (1 << 5) | (1 << 2))
314#define WAKEMASK(gpio) \
315 (((gpio) <= 15) \
316 ? ((1 << (gpio)) & ~PXA27x_GPIO_NOWAKE_MASK) \
317 : ((gpio == 35) ? (1 << 24) : 0))
318
319static int pxa27x_set_wake(unsigned int irq, unsigned int on)
320{
321 int gpio = IRQ_TO_GPIO(irq);
322 uint32_t mask;
323
324 if ((gpio >= 0 && gpio <= 15) || (gpio == 35)) {
325 if (WAKEMASK(gpio) == 0)
326 return -EINVAL;
327
328 mask = WAKEMASK(gpio);
329
330 if (on) {
331 if (GRER(gpio) | GPIO_bit(gpio))
332 PRER |= mask;
333 else
334 PRER &= ~mask;
335
336 if (GFER(gpio) | GPIO_bit(gpio))
337 PFER |= mask;
338 else
339 PFER &= ~mask;
340 }
341 goto set_pwer;
342 }
343
344 switch (irq) {
345 case IRQ_RTCAlrm:
346 mask = PWER_RTC;
347 break;
348 case IRQ_USB:
349 mask = 1u << 26;
350 break;
351 default:
352 return -EINVAL;
353 }
354
355set_pwer:
356 if (on)
357 PWER |= mask;
358 else
359 PWER &=~mask;
360
361 return 0;
362}
363
364void __init pxa27x_init_irq(void)
365{
366 pxa_init_irq_low();
367 pxa_init_irq_high();
368 pxa_init_irq_gpio(128);
369 pxa_init_irq_set_wake(pxa27x_set_wake);
370}
371
270/* 372/*
271 * device registration specific to PXA27x. 373 * device registration specific to PXA27x.
272 */ 374 */
@@ -286,7 +388,7 @@ static struct resource pxa27x_ohci_resources[] = {
286 }, 388 },
287}; 389};
288 390
289static struct platform_device pxa27x_device_ohci = { 391struct platform_device pxa27x_device_ohci = {
290 .name = "pxa27x-ohci", 392 .name = "pxa27x-ohci",
291 .id = -1, 393 .id = -1,
292 .dev = { 394 .dev = {
@@ -314,7 +416,7 @@ static struct resource i2c_power_resources[] = {
314 }, 416 },
315}; 417};
316 418
317static struct platform_device pxa27x_device_i2c_power = { 419struct platform_device pxa27x_device_i2c_power = {
318 .name = "pxa2xx-i2c", 420 .name = "pxa2xx-i2c",
319 .id = 1, 421 .id = 1,
320 .resource = i2c_power_resources, 422 .resource = i2c_power_resources,
@@ -336,17 +438,12 @@ static struct platform_device *devices[] __initdata = {
336 &pxa27x_device_ohci, 438 &pxa27x_device_ohci,
337}; 439};
338 440
339void __init pxa27x_init_irq(void)
340{
341 pxa_init_irq_low();
342 pxa_init_irq_high();
343 pxa_init_irq_gpio(128);
344}
345
346static int __init pxa27x_init(void) 441static int __init pxa27x_init(void)
347{ 442{
348 int ret = 0; 443 int ret = 0;
349 if (cpu_is_pxa27x()) { 444 if (cpu_is_pxa27x()) {
445 clks_register(pxa27x_clks, ARRAY_SIZE(pxa27x_clks));
446
350 if ((ret = pxa_init_dma(32))) 447 if ((ret = pxa_init_dma(32)))
351 return ret; 448 return ret;
352#ifdef CONFIG_PM 449#ifdef CONFIG_PM
diff --git a/arch/arm/mach-pxa/pxa300.c b/arch/arm/mach-pxa/pxa300.c
new file mode 100644
index 000000000000..5363b1322652
--- /dev/null
+++ b/arch/arm/mach-pxa/pxa300.c
@@ -0,0 +1,93 @@
1/*
2 * linux/arch/arm/mach-pxa/pxa300.c
3 *
4 * Code specific to PXA300/PXA310
5 *
6 * Copyright (C) 2007 Marvell Internation Ltd.
7 *
8 * 2007-08-21: eric miao <eric.y.miao@gmail.com>
9 * initial version
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/module.h>
17#include <linux/kernel.h>
18
19#include <asm/hardware.h>
20#include <asm/arch/mfp-pxa300.h>
21
22static struct pxa3xx_mfp_addr_map pxa300_mfp_addr_map[] __initdata = {
23
24 MFP_ADDR_X(GPIO0, GPIO2, 0x00b4),
25 MFP_ADDR_X(GPIO3, GPIO26, 0x027c),
26 MFP_ADDR_X(GPIO27, GPIO127, 0x0400),
27 MFP_ADDR_X(GPIO0_2, GPIO6_2, 0x02ec),
28
29 MFP_ADDR(nBE0, 0x0204),
30 MFP_ADDR(nBE1, 0x0208),
31
32 MFP_ADDR(nLUA, 0x0244),
33 MFP_ADDR(nLLA, 0x0254),
34
35 MFP_ADDR(DF_CLE_nOE, 0x0240),
36 MFP_ADDR(DF_nRE_nOE, 0x0200),
37 MFP_ADDR(DF_ALE_nWE, 0x020C),
38 MFP_ADDR(DF_INT_RnB, 0x00C8),
39 MFP_ADDR(DF_nCS0, 0x0248),
40 MFP_ADDR(DF_nCS1, 0x0278),
41 MFP_ADDR(DF_nWE, 0x00CC),
42
43 MFP_ADDR(DF_ADDR0, 0x0210),
44 MFP_ADDR(DF_ADDR1, 0x0214),
45 MFP_ADDR(DF_ADDR2, 0x0218),
46 MFP_ADDR(DF_ADDR3, 0x021C),
47
48 MFP_ADDR(DF_IO0, 0x0220),
49 MFP_ADDR(DF_IO1, 0x0228),
50 MFP_ADDR(DF_IO2, 0x0230),
51 MFP_ADDR(DF_IO3, 0x0238),
52 MFP_ADDR(DF_IO4, 0x0258),
53 MFP_ADDR(DF_IO5, 0x0260),
54 MFP_ADDR(DF_IO6, 0x0268),
55 MFP_ADDR(DF_IO7, 0x0270),
56 MFP_ADDR(DF_IO8, 0x0224),
57 MFP_ADDR(DF_IO9, 0x022C),
58 MFP_ADDR(DF_IO10, 0x0234),
59 MFP_ADDR(DF_IO11, 0x023C),
60 MFP_ADDR(DF_IO12, 0x025C),
61 MFP_ADDR(DF_IO13, 0x0264),
62 MFP_ADDR(DF_IO14, 0x026C),
63 MFP_ADDR(DF_IO15, 0x0274),
64
65 MFP_ADDR_END,
66};
67
68/* override pxa300 MFP register addresses */
69static struct pxa3xx_mfp_addr_map pxa310_mfp_addr_map[] __initdata = {
70 MFP_ADDR_X(GPIO30, GPIO98, 0x0418),
71 MFP_ADDR_X(GPIO7_2, GPIO12_2, 0x052C),
72
73 MFP_ADDR(ULPI_STP, 0x040C),
74 MFP_ADDR(ULPI_NXT, 0x0410),
75 MFP_ADDR(ULPI_DIR, 0x0414),
76
77 MFP_ADDR_END,
78};
79
80static int __init pxa300_init(void)
81{
82 if (cpu_is_pxa300() || cpu_is_pxa310()) {
83 pxa3xx_init_mfp();
84 pxa3xx_mfp_init_addr(pxa300_mfp_addr_map);
85 }
86
87 if (cpu_is_pxa310())
88 pxa3xx_mfp_init_addr(pxa310_mfp_addr_map);
89
90 return 0;
91}
92
93core_initcall(pxa300_init);
diff --git a/arch/arm/mach-pxa/pxa320.c b/arch/arm/mach-pxa/pxa320.c
new file mode 100644
index 000000000000..cd9eba5b3df9
--- /dev/null
+++ b/arch/arm/mach-pxa/pxa320.c
@@ -0,0 +1,88 @@
1/*
2 * linux/arch/arm/mach-pxa/pxa320.c
3 *
4 * Code specific to PXA320
5 *
6 * Copyright (C) 2007 Marvell Internation Ltd.
7 *
8 * 2007-08-21: eric miao <eric.y.miao@gmail.com>
9 * initial version
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/module.h>
17#include <linux/kernel.h>
18
19#include <asm/hardware.h>
20#include <asm/arch/mfp.h>
21#include <asm/arch/mfp-pxa320.h>
22
23static struct pxa3xx_mfp_addr_map pxa320_mfp_addr_map[] __initdata = {
24
25 MFP_ADDR_X(GPIO0, GPIO4, 0x0124),
26 MFP_ADDR_X(GPIO5, GPIO26, 0x028C),
27 MFP_ADDR_X(GPIO27, GPIO62, 0x0400),
28 MFP_ADDR_X(GPIO63, GPIO73, 0x04B4),
29 MFP_ADDR_X(GPIO74, GPIO98, 0x04F0),
30 MFP_ADDR_X(GPIO99, GPIO127, 0x0600),
31 MFP_ADDR_X(GPIO0_2, GPIO5_2, 0x0674),
32 MFP_ADDR_X(GPIO6_2, GPIO13_2, 0x0494),
33 MFP_ADDR_X(GPIO14_2, GPIO17_2, 0x04E0),
34
35 MFP_ADDR(nXCVREN, 0x0138),
36 MFP_ADDR(DF_CLE_nOE, 0x0204),
37 MFP_ADDR(DF_nADV1_ALE, 0x0208),
38 MFP_ADDR(DF_SCLK_S, 0x020C),
39 MFP_ADDR(DF_SCLK_E, 0x0210),
40 MFP_ADDR(nBE0, 0x0214),
41 MFP_ADDR(nBE1, 0x0218),
42 MFP_ADDR(DF_nADV2_ALE, 0x021C),
43 MFP_ADDR(DF_INT_RnB, 0x0220),
44 MFP_ADDR(DF_nCS0, 0x0224),
45 MFP_ADDR(DF_nCS1, 0x0228),
46 MFP_ADDR(DF_nWE, 0x022C),
47 MFP_ADDR(DF_nRE_nOE, 0x0230),
48 MFP_ADDR(nLUA, 0x0234),
49 MFP_ADDR(nLLA, 0x0238),
50 MFP_ADDR(DF_ADDR0, 0x023C),
51 MFP_ADDR(DF_ADDR1, 0x0240),
52 MFP_ADDR(DF_ADDR2, 0x0244),
53 MFP_ADDR(DF_ADDR3, 0x0248),
54 MFP_ADDR(DF_IO0, 0x024C),
55 MFP_ADDR(DF_IO8, 0x0250),
56 MFP_ADDR(DF_IO1, 0x0254),
57 MFP_ADDR(DF_IO9, 0x0258),
58 MFP_ADDR(DF_IO2, 0x025C),
59 MFP_ADDR(DF_IO10, 0x0260),
60 MFP_ADDR(DF_IO3, 0x0264),
61 MFP_ADDR(DF_IO11, 0x0268),
62 MFP_ADDR(DF_IO4, 0x026C),
63 MFP_ADDR(DF_IO12, 0x0270),
64 MFP_ADDR(DF_IO5, 0x0274),
65 MFP_ADDR(DF_IO13, 0x0278),
66 MFP_ADDR(DF_IO6, 0x027C),
67 MFP_ADDR(DF_IO14, 0x0280),
68 MFP_ADDR(DF_IO7, 0x0284),
69 MFP_ADDR(DF_IO15, 0x0288),
70
71 MFP_ADDR_END,
72};
73
74static void __init pxa320_init_mfp(void)
75{
76 pxa3xx_init_mfp();
77 pxa3xx_mfp_init_addr(pxa320_mfp_addr_map);
78}
79
80static int __init pxa320_init(void)
81{
82 if (cpu_is_pxa320())
83 pxa320_init_mfp();
84
85 return 0;
86}
87
88core_initcall(pxa320_init);
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
new file mode 100644
index 000000000000..39f0de8c189e
--- /dev/null
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -0,0 +1,216 @@
1/*
2 * linux/arch/arm/mach-pxa/pxa3xx.c
3 *
4 * code specific to pxa3xx aka Monahans
5 *
6 * Copyright (C) 2006 Marvell International Ltd.
7 *
8 * 2007-09-02: eric miao <eric.y.miao@gmail.com>
9 * initial version
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/module.h>
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/pm.h>
20#include <linux/platform_device.h>
21#include <linux/irq.h>
22
23#include <asm/hardware.h>
24#include <asm/arch/pxa3xx-regs.h>
25#include <asm/arch/ohci.h>
26#include <asm/arch/pm.h>
27#include <asm/arch/dma.h>
28#include <asm/arch/ssp.h>
29
30#include "generic.h"
31#include "devices.h"
32#include "clock.h"
33
34/* Crystal clock: 13MHz */
35#define BASE_CLK 13000000
36
37/* Ring Oscillator Clock: 60MHz */
38#define RO_CLK 60000000
39
40#define ACCR_D0CS (1 << 26)
41
42/* crystal frequency to static memory controller multiplier (SMCFS) */
43static unsigned char smcfs_mult[8] = { 6, 0, 8, 0, 0, 16, };
44
45/* crystal frequency to HSIO bus frequency multiplier (HSS) */
46static unsigned char hss_mult[4] = { 8, 12, 16, 0 };
47
48/*
49 * Get the clock frequency as reflected by CCSR and the turbo flag.
50 * We assume these values have been applied via a fcs.
51 * If info is not 0 we also display the current settings.
52 */
53unsigned int pxa3xx_get_clk_frequency_khz(int info)
54{
55 unsigned long acsr, xclkcfg;
56 unsigned int t, xl, xn, hss, ro, XL, XN, CLK, HSS;
57
58 /* Read XCLKCFG register turbo bit */
59 __asm__ __volatile__("mrc\tp14, 0, %0, c6, c0, 0" : "=r"(xclkcfg));
60 t = xclkcfg & 0x1;
61
62 acsr = ACSR;
63
64 xl = acsr & 0x1f;
65 xn = (acsr >> 8) & 0x7;
66 hss = (acsr >> 14) & 0x3;
67
68 XL = xl * BASE_CLK;
69 XN = xn * XL;
70
71 ro = acsr & ACCR_D0CS;
72
73 CLK = (ro) ? RO_CLK : ((t) ? XN : XL);
74 HSS = (ro) ? RO_CLK : hss_mult[hss] * BASE_CLK;
75
76 if (info) {
77 pr_info("RO Mode clock: %d.%02dMHz (%sactive)\n",
78 RO_CLK / 1000000, (RO_CLK % 1000000) / 10000,
79 (ro) ? "" : "in");
80 pr_info("Run Mode clock: %d.%02dMHz (*%d)\n",
81 XL / 1000000, (XL % 1000000) / 10000, xl);
82 pr_info("Turbo Mode clock: %d.%02dMHz (*%d, %sactive)\n",
83 XN / 1000000, (XN % 1000000) / 10000, xn,
84 (t) ? "" : "in");
85 pr_info("HSIO bus clock: %d.%02dMHz\n",
86 HSS / 1000000, (HSS % 1000000) / 10000);
87 }
88
89 return CLK;
90}
91
92/*
93 * Return the current static memory controller clock frequency
94 * in units of 10kHz
95 */
96unsigned int pxa3xx_get_memclk_frequency_10khz(void)
97{
98 unsigned long acsr;
99 unsigned int smcfs, clk = 0;
100
101 acsr = ACSR;
102
103 smcfs = (acsr >> 23) & 0x7;
104 clk = (acsr & ACCR_D0CS) ? RO_CLK : smcfs_mult[smcfs] * BASE_CLK;
105
106 return (clk / 10000);
107}
108
109/*
110 * Return the current HSIO bus clock frequency
111 */
112static unsigned long clk_pxa3xx_hsio_getrate(struct clk *clk)
113{
114 unsigned long acsr;
115 unsigned int hss, hsio_clk;
116
117 acsr = ACSR;
118
119 hss = (acsr >> 14) & 0x3;
120 hsio_clk = (acsr & ACCR_D0CS) ? RO_CLK : hss_mult[hss] * BASE_CLK;
121
122 return hsio_clk;
123}
124
125static void clk_pxa3xx_cken_enable(struct clk *clk)
126{
127 unsigned long mask = 1ul << (clk->cken & 0x1f);
128
129 local_irq_disable();
130
131 if (clk->cken < 32)
132 CKENA |= mask;
133 else
134 CKENB |= mask;
135
136 local_irq_enable();
137}
138
139static void clk_pxa3xx_cken_disable(struct clk *clk)
140{
141 unsigned long mask = 1ul << (clk->cken & 0x1f);
142
143 local_irq_disable();
144
145 if (clk->cken < 32)
146 CKENA &= ~mask;
147 else
148 CKENB &= ~mask;
149
150 local_irq_enable();
151}
152
153static const struct clkops clk_pxa3xx_hsio_ops = {
154 .enable = clk_pxa3xx_cken_enable,
155 .disable = clk_pxa3xx_cken_disable,
156 .getrate = clk_pxa3xx_hsio_getrate,
157};
158
159static struct clk pxa3xx_clks[] = {
160 INIT_CK("LCDCLK", LCD, &clk_pxa3xx_hsio_ops, &pxa_device_fb.dev),
161 INIT_CK("CAMCLK", CAMERA, &clk_pxa3xx_hsio_ops, NULL),
162
163 INIT_CKEN("UARTCLK", FFUART, 14857000, 1, &pxa_device_ffuart.dev),
164 INIT_CKEN("UARTCLK", BTUART, 14857000, 1, &pxa_device_btuart.dev),
165 INIT_CKEN("UARTCLK", STUART, 14857000, 1, NULL),
166
167 INIT_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev),
168 INIT_CKEN("UDCCLK", UDC, 48000000, 5, &pxa_device_udc.dev),
169};
170
171void __init pxa3xx_init_irq(void)
172{
173 /* enable CP6 access */
174 u32 value;
175 __asm__ __volatile__("mrc p15, 0, %0, c15, c1, 0\n": "=r"(value));
176 value |= (1 << 6);
177 __asm__ __volatile__("mcr p15, 0, %0, c15, c1, 0\n": :"r"(value));
178
179 pxa_init_irq_low();
180 pxa_init_irq_high();
181 pxa_init_irq_gpio(128);
182}
183
184/*
185 * device registration specific to PXA3xx.
186 */
187
188static struct platform_device *devices[] __initdata = {
189 &pxa_device_mci,
190 &pxa_device_udc,
191 &pxa_device_fb,
192 &pxa_device_ffuart,
193 &pxa_device_btuart,
194 &pxa_device_stuart,
195 &pxa_device_i2c,
196 &pxa_device_i2s,
197 &pxa_device_ficp,
198 &pxa_device_rtc,
199};
200
201static int __init pxa3xx_init(void)
202{
203 int ret = 0;
204
205 if (cpu_is_pxa3xx()) {
206 clks_register(pxa3xx_clks, ARRAY_SIZE(pxa3xx_clks));
207
208 if ((ret = pxa_init_dma(32)))
209 return ret;
210
211 return platform_add_devices(devices, ARRAY_SIZE(devices));
212 }
213 return 0;
214}
215
216subsys_initcall(pxa3xx_init);
diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c
index 98d27e646b09..ec4286c7931c 100644
--- a/arch/arm/mach-pxa/time.c
+++ b/arch/arm/mach-pxa/time.c
@@ -16,10 +16,48 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/clockchips.h> 18#include <linux/clockchips.h>
19#include <linux/sched.h>
19 20
21#include <asm/div64.h>
22#include <asm/cnt32_to_63.h>
20#include <asm/mach/irq.h> 23#include <asm/mach/irq.h>
21#include <asm/mach/time.h> 24#include <asm/mach/time.h>
22#include <asm/arch/pxa-regs.h> 25#include <asm/arch/pxa-regs.h>
26#include <asm/mach-types.h>
27
28/*
29 * This is PXA's sched_clock implementation. This has a resolution
30 * of at least 308 ns and a maximum value of 208 days.
31 *
32 * The return value is guaranteed to be monotonic in that range as
33 * long as there is always less than 582 seconds between successive
34 * calls to sched_clock() which should always be the case in practice.
35 */
36
37#define OSCR2NS_SCALE_FACTOR 10
38
39static unsigned long oscr2ns_scale;
40
41static void __init set_oscr2ns_scale(unsigned long oscr_rate)
42{
43 unsigned long long v = 1000000000ULL << OSCR2NS_SCALE_FACTOR;
44 do_div(v, oscr_rate);
45 oscr2ns_scale = v;
46 /*
47 * We want an even value to automatically clear the top bit
48 * returned by cnt32_to_63() without an additional run time
49 * instruction. So if the LSB is 1 then round it up.
50 */
51 if (oscr2ns_scale & 1)
52 oscr2ns_scale++;
53}
54
55unsigned long long sched_clock(void)
56{
57 unsigned long long v = cnt32_to_63(OSCR);
58 return (v * oscr2ns_scale) >> OSCR2NS_SCALE_FACTOR;
59}
60
23 61
24static irqreturn_t 62static irqreturn_t
25pxa_ost0_interrupt(int irq, void *dev_id) 63pxa_ost0_interrupt(int irq, void *dev_id)
@@ -149,18 +187,29 @@ static struct irqaction pxa_ost0_irq = {
149 187
150static void __init pxa_timer_init(void) 188static void __init pxa_timer_init(void)
151{ 189{
190 unsigned long clock_tick_rate;
191
152 OIER = 0; 192 OIER = 0;
153 OSSR = OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3; 193 OSSR = OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3;
154 194
195 if (cpu_is_pxa21x() || cpu_is_pxa25x())
196 clock_tick_rate = 3686400;
197 else if (machine_is_mainstone())
198 clock_tick_rate = 3249600;
199 else
200 clock_tick_rate = 3250000;
201
202 set_oscr2ns_scale(clock_tick_rate);
203
155 ckevt_pxa_osmr0.mult = 204 ckevt_pxa_osmr0.mult =
156 div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC, ckevt_pxa_osmr0.shift); 205 div_sc(clock_tick_rate, NSEC_PER_SEC, ckevt_pxa_osmr0.shift);
157 ckevt_pxa_osmr0.max_delta_ns = 206 ckevt_pxa_osmr0.max_delta_ns =
158 clockevent_delta2ns(0x7fffffff, &ckevt_pxa_osmr0); 207 clockevent_delta2ns(0x7fffffff, &ckevt_pxa_osmr0);
159 ckevt_pxa_osmr0.min_delta_ns = 208 ckevt_pxa_osmr0.min_delta_ns =
160 clockevent_delta2ns(MIN_OSCR_DELTA, &ckevt_pxa_osmr0) + 1; 209 clockevent_delta2ns(MIN_OSCR_DELTA, &ckevt_pxa_osmr0) + 1;
161 210
162 cksrc_pxa_oscr0.mult = 211 cksrc_pxa_oscr0.mult =
163 clocksource_hz2mult(CLOCK_TICK_RATE, cksrc_pxa_oscr0.shift); 212 clocksource_hz2mult(clock_tick_rate, cksrc_pxa_oscr0.shift);
164 213
165 setup_irq(IRQ_OST0, &pxa_ost0_irq); 214 setup_irq(IRQ_OST0, &pxa_ost0_irq);
166 215
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c
new file mode 100644
index 000000000000..3f18d760dd1b
--- /dev/null
+++ b/arch/arm/mach-pxa/zylonite.c
@@ -0,0 +1,184 @@
1/*
2 * linux/arch/arm/mach-pxa/zylonite.c
3 *
4 * Support for the PXA3xx Development Platform (aka Zylonite)
5 *
6 * Copyright (C) 2006 Marvell International Ltd.
7 *
8 * 2007-09-04: eric miao <eric.y.miao@gmail.com>
9 * rewrite to align with latest kernel
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/module.h>
17#include <linux/kernel.h>
18#include <linux/interrupt.h>
19#include <linux/init.h>
20#include <linux/platform_device.h>
21
22#include <asm/mach-types.h>
23#include <asm/mach/arch.h>
24#include <asm/hardware.h>
25#include <asm/arch/gpio.h>
26#include <asm/arch/pxafb.h>
27#include <asm/arch/zylonite.h>
28
29#include "generic.h"
30
31int gpio_backlight;
32int gpio_eth_irq;
33
34int lcd_id;
35int lcd_orientation;
36
37static struct resource smc91x_resources[] = {
38 [0] = {
39 .start = ZYLONITE_ETH_PHYS + 0x300,
40 .end = ZYLONITE_ETH_PHYS + 0xfffff,
41 .flags = IORESOURCE_MEM,
42 },
43 [1] = {
44 .start = -1, /* for run-time assignment */
45 .end = -1,
46 .flags = IORESOURCE_IRQ,
47 }
48};
49
50static struct platform_device smc91x_device = {
51 .name = "smc91x",
52 .id = 0,
53 .num_resources = ARRAY_SIZE(smc91x_resources),
54 .resource = smc91x_resources,
55};
56
57#if defined(CONFIG_FB_PXA) || (CONFIG_FB_PXA_MODULES)
58static void zylonite_backlight_power(int on)
59{
60 gpio_set_value(gpio_backlight, on);
61}
62
63static struct pxafb_mode_info toshiba_ltm035a776c_mode = {
64 .pixclock = 110000,
65 .xres = 240,
66 .yres = 320,
67 .bpp = 16,
68 .hsync_len = 4,
69 .left_margin = 6,
70 .right_margin = 4,
71 .vsync_len = 2,
72 .upper_margin = 2,
73 .lower_margin = 3,
74 .sync = FB_SYNC_VERT_HIGH_ACT,
75};
76
77static struct pxafb_mode_info toshiba_ltm04c380k_mode = {
78 .pixclock = 50000,
79 .xres = 640,
80 .yres = 480,
81 .bpp = 16,
82 .hsync_len = 1,
83 .left_margin = 0x9f,
84 .right_margin = 1,
85 .vsync_len = 44,
86 .upper_margin = 0,
87 .lower_margin = 0,
88 .sync = FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT,
89};
90
91static struct pxafb_mach_info zylonite_toshiba_lcd_info = {
92 .num_modes = 1,
93 .lccr0 = LCCR0_Act,
94 .lccr3 = LCCR3_PCP,
95 .pxafb_backlight_power = zylonite_backlight_power,
96};
97
98static struct pxafb_mode_info sharp_ls037_modes[] = {
99 [0] = {
100 .pixclock = 158000,
101 .xres = 240,
102 .yres = 320,
103 .bpp = 16,
104 .hsync_len = 4,
105 .left_margin = 39,
106 .right_margin = 39,
107 .vsync_len = 1,
108 .upper_margin = 2,
109 .lower_margin = 3,
110 .sync = 0,
111 },
112 [1] = {
113 .pixclock = 39700,
114 .xres = 480,
115 .yres = 640,
116 .bpp = 16,
117 .hsync_len = 8,
118 .left_margin = 81,
119 .right_margin = 81,
120 .vsync_len = 1,
121 .upper_margin = 2,
122 .lower_margin = 7,
123 .sync = 0,
124 },
125};
126
127static struct pxafb_mach_info zylonite_sharp_lcd_info = {
128 .modes = sharp_ls037_modes,
129 .num_modes = 2,
130 .lccr0 = LCCR0_Act,
131 .lccr3 = LCCR3_PCP | LCCR3_HSP | LCCR3_VSP,
132 .pxafb_backlight_power = zylonite_backlight_power,
133};
134
135static void __init zylonite_init_lcd(void)
136{
137 /* backlight GPIO: output, default on */
138 gpio_direction_output(gpio_backlight, 1);
139
140 if (lcd_id & 0x20) {
141 set_pxa_fb_info(&zylonite_sharp_lcd_info);
142 return;
143 }
144
145 /* legacy LCD panels, it would be handy here if LCD panel type can
146 * be decided at run-time
147 */
148 if (1)
149 zylonite_toshiba_lcd_info.modes = &toshiba_ltm035a776c_mode;
150 else
151 zylonite_toshiba_lcd_info.modes = &toshiba_ltm04c380k_mode;
152
153 set_pxa_fb_info(&zylonite_toshiba_lcd_info);
154}
155#else
156static inline void zylonite_init_lcd(void) {}
157#endif
158
159static void __init zylonite_init(void)
160{
161 /* board-processor specific initialization */
162 zylonite_pxa300_init();
163 zylonite_pxa320_init();
164
165 /*
166 * Note: We depend that the bootloader set
167 * the correct value to MSC register for SMC91x.
168 */
169 smc91x_resources[1].start = gpio_to_irq(gpio_eth_irq);
170 smc91x_resources[1].end = gpio_to_irq(gpio_eth_irq);
171 platform_device_register(&smc91x_device);
172
173 zylonite_init_lcd();
174}
175
176MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)")
177 .phys_io = 0x40000000,
178 .boot_params = 0xa0000100,
179 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
180 .map_io = pxa_map_io,
181 .init_irq = pxa3xx_init_irq,
182 .timer = &pxa_timer,
183 .init_machine = zylonite_init,
184MACHINE_END
diff --git a/arch/arm/mach-pxa/zylonite_pxa300.c b/arch/arm/mach-pxa/zylonite_pxa300.c
new file mode 100644
index 000000000000..b5fbd2f4c693
--- /dev/null
+++ b/arch/arm/mach-pxa/zylonite_pxa300.c
@@ -0,0 +1,188 @@
1/*
2 * linux/arch/arm/mach-pxa/zylonite_pxa300.c
3 *
4 * PXA300/PXA310 specific support code for the
5 * PXA3xx Development Platform (aka Zylonite)
6 *
7 * Copyright (C) 2007 Marvell Internation Ltd.
8 * 2007-08-21: eric miao <eric.y.miao@gmail.com>
9 * initial version
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/module.h>
17#include <linux/kernel.h>
18#include <linux/init.h>
19
20#include <asm/gpio.h>
21#include <asm/arch/mfp-pxa300.h>
22#include <asm/arch/zylonite.h>
23
24#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
25
26/* PXA300/PXA310 common configurations */
27static mfp_cfg_t common_mfp_cfg[] __initdata = {
28 /* LCD */
29 GPIO54_LCD_LDD_0,
30 GPIO55_LCD_LDD_1,
31 GPIO56_LCD_LDD_2,
32 GPIO57_LCD_LDD_3,
33 GPIO58_LCD_LDD_4,
34 GPIO59_LCD_LDD_5,
35 GPIO60_LCD_LDD_6,
36 GPIO61_LCD_LDD_7,
37 GPIO62_LCD_LDD_8,
38 GPIO63_LCD_LDD_9,
39 GPIO64_LCD_LDD_10,
40 GPIO65_LCD_LDD_11,
41 GPIO66_LCD_LDD_12,
42 GPIO67_LCD_LDD_13,
43 GPIO68_LCD_LDD_14,
44 GPIO69_LCD_LDD_15,
45 GPIO70_LCD_LDD_16,
46 GPIO71_LCD_LDD_17,
47 GPIO72_LCD_FCLK,
48 GPIO73_LCD_LCLK,
49 GPIO74_LCD_PCLK,
50 GPIO75_LCD_BIAS,
51 GPIO76_LCD_VSYNC,
52 GPIO127_LCD_CS_N,
53
54 /* BTUART */
55 GPIO111_UART2_RTS,
56 GPIO112_UART2_RXD,
57 GPIO113_UART2_TXD,
58 GPIO114_UART2_CTS,
59
60 /* STUART */
61 GPIO109_UART3_TXD,
62 GPIO110_UART3_RXD,
63
64 /* AC97 */
65 GPIO23_AC97_nACRESET,
66 GPIO24_AC97_SYSCLK,
67 GPIO29_AC97_BITCLK,
68 GPIO25_AC97_SDATA_IN_0,
69 GPIO27_AC97_SDATA_OUT,
70 GPIO28_AC97_SYNC,
71
72 /* Keypad */
73 GPIO107_KP_DKIN_0,
74 GPIO108_KP_DKIN_1,
75 GPIO115_KP_MKIN_0,
76 GPIO116_KP_MKIN_1,
77 GPIO117_KP_MKIN_2,
78 GPIO118_KP_MKIN_3,
79 GPIO119_KP_MKIN_4,
80 GPIO120_KP_MKIN_5,
81 GPIO2_2_KP_MKIN_6,
82 GPIO3_2_KP_MKIN_7,
83 GPIO121_KP_MKOUT_0,
84 GPIO122_KP_MKOUT_1,
85 GPIO123_KP_MKOUT_2,
86 GPIO124_KP_MKOUT_3,
87 GPIO125_KP_MKOUT_4,
88 GPIO4_2_KP_MKOUT_5,
89 GPIO5_2_KP_MKOUT_6,
90 GPIO6_2_KP_MKOUT_7,
91};
92
93static mfp_cfg_t pxa300_mfp_cfg[] __initdata = {
94 /* FFUART */
95 GPIO30_UART1_RXD,
96 GPIO31_UART1_TXD,
97 GPIO32_UART1_CTS,
98 GPIO37_UART1_RTS,
99 GPIO33_UART1_DCD,
100 GPIO34_UART1_DSR,
101 GPIO35_UART1_RI,
102 GPIO36_UART1_DTR,
103
104 /* Ethernet */
105 GPIO2_nCS3,
106 GPIO99_GPIO,
107};
108
109static mfp_cfg_t pxa310_mfp_cfg[] __initdata = {
110 /* FFUART */
111 GPIO99_UART1_RXD,
112 GPIO100_UART1_TXD,
113 GPIO101_UART1_CTS,
114 GPIO106_UART1_RTS,
115
116 /* Ethernet */
117 GPIO2_nCS3,
118 GPIO102_GPIO,
119};
120
121#define NUM_LCD_DETECT_PINS 7
122
123static int lcd_detect_pins[] __initdata = {
124 MFP_PIN_GPIO71, /* LCD_LDD_17 - ORIENT */
125 MFP_PIN_GPIO70, /* LCD_LDD_16 - LCDID[5] */
126 MFP_PIN_GPIO75, /* LCD_BIAS - LCDID[4] */
127 MFP_PIN_GPIO73, /* LCD_LCLK - LCDID[3] */
128 MFP_PIN_GPIO72, /* LCD_FCLK - LCDID[2] */
129 MFP_PIN_GPIO127,/* LCD_CS_N - LCDID[1] */
130 MFP_PIN_GPIO76, /* LCD_VSYNC - LCDID[0] */
131};
132
133static void __init zylonite_detect_lcd_panel(void)
134{
135 unsigned long mfpr_save[NUM_LCD_DETECT_PINS];
136 int i, gpio, id = 0;
137
138 /* save the original MFP settings of these pins and configure
139 * them as GPIO Input, DS01X, Pull Neither, Edge Clear
140 */
141 for (i = 0; i < NUM_LCD_DETECT_PINS; i++) {
142 mfpr_save[i] = pxa3xx_mfp_read(lcd_detect_pins[i]);
143 pxa3xx_mfp_write(lcd_detect_pins[i], 0x8440);
144 }
145
146 for (i = 0; i < NUM_LCD_DETECT_PINS; i++) {
147 id = id << 1;
148 gpio = mfp_to_gpio(lcd_detect_pins[i]);
149 gpio_direction_input(gpio);
150
151 if (gpio_get_value(gpio))
152 id = id | 0x1;
153 }
154
155 /* lcd id, flush out bit 1 */
156 lcd_id = id & 0x3d;
157
158 /* lcd orientation, portrait or landscape */
159 lcd_orientation = (id >> 6) & 0x1;
160
161 /* restore the original MFP settings */
162 for (i = 0; i < NUM_LCD_DETECT_PINS; i++)
163 pxa3xx_mfp_write(lcd_detect_pins[i], mfpr_save[i]);
164}
165
166void __init zylonite_pxa300_init(void)
167{
168 if (cpu_is_pxa300() || cpu_is_pxa310()) {
169 /* initialize MFP */
170 pxa3xx_mfp_config(ARRAY_AND_SIZE(common_mfp_cfg));
171
172 /* detect LCD panel */
173 zylonite_detect_lcd_panel();
174
175 /* GPIO pin assignment */
176 gpio_backlight = mfp_to_gpio(MFP_PIN_GPIO20);
177 }
178
179 if (cpu_is_pxa300()) {
180 pxa3xx_mfp_config(ARRAY_AND_SIZE(pxa300_mfp_cfg));
181 gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO99);
182 }
183
184 if (cpu_is_pxa310()) {
185 pxa3xx_mfp_config(ARRAY_AND_SIZE(pxa310_mfp_cfg));
186 gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO102);
187 }
188}
diff --git a/arch/arm/mach-pxa/zylonite_pxa320.c b/arch/arm/mach-pxa/zylonite_pxa320.c
new file mode 100644
index 000000000000..63cb36be086b
--- /dev/null
+++ b/arch/arm/mach-pxa/zylonite_pxa320.c
@@ -0,0 +1,173 @@
1/*
2 * linux/arch/arm/mach-pxa/zylonite_pxa320.c
3 *
4 * PXA320 specific support code for the
5 * PXA3xx Development Platform (aka Zylonite)
6 *
7 * Copyright (C) 2007 Marvell Internation Ltd.
8 * 2007-08-21: eric miao <eric.y.miao@gmail.com>
9 * initial version
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/module.h>
17#include <linux/kernel.h>
18#include <linux/init.h>
19
20#include <asm/arch/gpio.h>
21#include <asm/arch/mfp-pxa320.h>
22#include <asm/arch/zylonite.h>
23
24#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
25
26static mfp_cfg_t mfp_cfg[] __initdata = {
27 /* LCD */
28 GPIO6_2_LCD_LDD_0,
29 GPIO7_2_LCD_LDD_1,
30 GPIO8_2_LCD_LDD_2,
31 GPIO9_2_LCD_LDD_3,
32 GPIO10_2_LCD_LDD_4,
33 GPIO11_2_LCD_LDD_5,
34 GPIO12_2_LCD_LDD_6,
35 GPIO13_2_LCD_LDD_7,
36 GPIO63_LCD_LDD_8,
37 GPIO64_LCD_LDD_9,
38 GPIO65_LCD_LDD_10,
39 GPIO66_LCD_LDD_11,
40 GPIO67_LCD_LDD_12,
41 GPIO68_LCD_LDD_13,
42 GPIO69_LCD_LDD_14,
43 GPIO70_LCD_LDD_15,
44 GPIO71_LCD_LDD_16,
45 GPIO72_LCD_LDD_17,
46 GPIO73_LCD_CS_N,
47 GPIO74_LCD_VSYNC,
48 GPIO14_2_LCD_FCLK,
49 GPIO15_2_LCD_LCLK,
50 GPIO16_2_LCD_PCLK,
51 GPIO17_2_LCD_BIAS,
52
53 /* FFUART */
54 GPIO41_UART1_RXD,
55 GPIO42_UART1_TXD,
56 GPIO43_UART1_CTS,
57 GPIO44_UART1_DCD,
58 GPIO45_UART1_DSR,
59 GPIO46_UART1_RI,
60 GPIO47_UART1_DTR,
61 GPIO48_UART1_RTS,
62
63 /* AC97 */
64 GPIO34_AC97_SYSCLK,
65 GPIO35_AC97_SDATA_IN_0,
66 GPIO37_AC97_SDATA_OUT,
67 GPIO38_AC97_SYNC,
68 GPIO39_AC97_BITCLK,
69 GPIO40_AC97_nACRESET,
70
71 /* I2C */
72 GPIO32_I2C_SCL,
73 GPIO33_I2C_SDA,
74
75 /* Keypad */
76 GPIO105_KP_DKIN_0,
77 GPIO106_KP_DKIN_1,
78 GPIO113_KP_MKIN_0,
79 GPIO114_KP_MKIN_1,
80 GPIO115_KP_MKIN_2,
81 GPIO116_KP_MKIN_3,
82 GPIO117_KP_MKIN_4,
83 GPIO118_KP_MKIN_5,
84 GPIO119_KP_MKIN_6,
85 GPIO120_KP_MKIN_7,
86 GPIO121_KP_MKOUT_0,
87 GPIO122_KP_MKOUT_1,
88 GPIO123_KP_MKOUT_2,
89 GPIO124_KP_MKOUT_3,
90 GPIO125_KP_MKOUT_4,
91 GPIO126_KP_MKOUT_5,
92 GPIO127_KP_MKOUT_6,
93 GPIO5_2_KP_MKOUT_7,
94
95 /* Ethernet */
96 GPIO4_nCS3,
97 GPIO90_GPIO,
98};
99
100#define NUM_LCD_DETECT_PINS 7
101
102static int lcd_detect_pins[] __initdata = {
103 MFP_PIN_GPIO72, /* LCD_LDD_17 - ORIENT */
104 MFP_PIN_GPIO71, /* LCD_LDD_16 - LCDID[5] */
105 MFP_PIN_GPIO17_2, /* LCD_BIAS - LCDID[4] */
106 MFP_PIN_GPIO15_2, /* LCD_LCLK - LCDID[3] */
107 MFP_PIN_GPIO14_2, /* LCD_FCLK - LCDID[2] */
108 MFP_PIN_GPIO73, /* LCD_CS_N - LCDID[1] */
109 MFP_PIN_GPIO74, /* LCD_VSYNC - LCDID[0] */
110 /*
111 * set the MFP_PIN_GPIO 14/15/17 to alternate function other than
112 * GPIO to avoid input level confliction with 14_2, 15_2, 17_2
113 */
114 MFP_PIN_GPIO14,
115 MFP_PIN_GPIO15,
116 MFP_PIN_GPIO17,
117};
118
119static int lcd_detect_mfpr[] __initdata = {
120 /* AF0, DS 1X, Pull Neither, Edge Clear */
121 0x8440, 0x8440, 0x8440, 0x8440, 0x8440, 0x8440, 0x8440,
122 0xc442, /* Backlight, Pull-Up, AF2 */
123 0x8445, /* AF5 */
124 0x8445, /* AF5 */
125};
126
127static void __init zylonite_detect_lcd_panel(void)
128{
129 unsigned long mfpr_save[ARRAY_SIZE(lcd_detect_pins)];
130 int i, gpio, id = 0;
131
132 /* save the original MFP settings of these pins and configure them
133 * as GPIO Input, DS01X, Pull Neither, Edge Clear
134 */
135 for (i = 0; i < ARRAY_SIZE(lcd_detect_pins); i++) {
136 mfpr_save[i] = pxa3xx_mfp_read(lcd_detect_pins[i]);
137 pxa3xx_mfp_write(lcd_detect_pins[i], lcd_detect_mfpr[i]);
138 }
139
140 for (i = 0; i < NUM_LCD_DETECT_PINS; i++) {
141 id = id << 1;
142 gpio = mfp_to_gpio(lcd_detect_pins[i]);
143 gpio_direction_input(gpio);
144
145 if (gpio_get_value(gpio))
146 id = id | 0x1;
147 }
148
149 /* lcd id, flush out bit 1 */
150 lcd_id = id & 0x3d;
151
152 /* lcd orientation, portrait or landscape */
153 lcd_orientation = (id >> 6) & 0x1;
154
155 /* restore the original MFP settings */
156 for (i = 0; i < ARRAY_SIZE(lcd_detect_pins); i++)
157 pxa3xx_mfp_write(lcd_detect_pins[i], mfpr_save[i]);
158}
159
160void __init zylonite_pxa320_init(void)
161{
162 if (cpu_is_pxa320()) {
163 /* initialize MFP */
164 pxa3xx_mfp_config(ARRAY_AND_SIZE(mfp_cfg));
165
166 /* detect LCD panel */
167 zylonite_detect_lcd_panel();
168
169 /* GPIO pin assignment */
170 gpio_backlight = mfp_to_gpio(MFP_PIN_GPIO14);
171 gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO9);
172 }
173}
diff --git a/arch/arm/mach-s3c2410/dma.c b/arch/arm/mach-s3c2410/dma.c
index 80d83739ab9f..8f12e855ef5f 100644
--- a/arch/arm/mach-s3c2410/dma.c
+++ b/arch/arm/mach-s3c2410/dma.c
@@ -145,7 +145,7 @@ static struct s3c24xx_dma_order __initdata s3c2410_dma_order = {
145 }, 145 },
146}; 146};
147 147
148static int s3c2410_dma_add(struct sys_device *sysdev) 148static int __init s3c2410_dma_add(struct sys_device *sysdev)
149{ 149{
150 s3c2410_dma_init(); 150 s3c2410_dma_init();
151 s3c24xx_dma_order_set(&s3c2410_dma_order); 151 s3c24xx_dma_order_set(&s3c2410_dma_order);
diff --git a/arch/arm/mach-s3c2410/mach-amlm5900.c b/arch/arm/mach-s3c2410/mach-amlm5900.c
index 43bb5e106302..a67a0685664d 100644
--- a/arch/arm/mach-s3c2410/mach-amlm5900.c
+++ b/arch/arm/mach-s3c2410/mach-amlm5900.c
@@ -168,13 +168,31 @@ static void __init amlm5900_map_io(void)
168} 168}
169 169
170#ifdef CONFIG_FB_S3C2410 170#ifdef CONFIG_FB_S3C2410
171static struct s3c2410fb_mach_info __initdata amlm5900_lcd_info = { 171static struct s3c2410fb_display __initdata amlm5900_lcd_info = {
172 .width = 160, 172 .width = 160,
173 .height = 160, 173 .height = 160,
174 174
175/* commented out until stn patch is submitted 175 .type = S3C2410_LCDCON1_STN4,
176* .type = S3C2410_LCDCON1_STN4, 176
177*/ 177 .pixclock = 680000, /* HCLK = 100MHz */
178 .xres = 160,
179 .yres = 160,
180 .bpp = 4,
181 .left_margin = 1 << (4 + 3),
182 .right_margin = 8 << 3,
183 .hsync_len = 48,
184 .upper_margin = 0,
185 .lower_margin = 0,
186
187 .lcdcon5 = 0x00000001,
188};
189
190static struct s3c2410fb_mach_info __initdata amlm5900_fb_info = {
191
192 .displays = &amlm5900_lcd_info,
193 .num_displays = 1,
194 .default_display = 0,
195
178 .gpccon = 0xaaaaaaaa, 196 .gpccon = 0xaaaaaaaa,
179 .gpccon_mask = 0xffffffff, 197 .gpccon_mask = 0xffffffff,
180 .gpcup = 0x0000ffff, 198 .gpcup = 0x0000ffff,
@@ -184,32 +202,6 @@ static struct s3c2410fb_mach_info __initdata amlm5900_lcd_info = {
184 .gpdcon_mask = 0xffffffff, 202 .gpdcon_mask = 0xffffffff,
185 .gpdup = 0x0000ffff, 203 .gpdup = 0x0000ffff,
186 .gpdup_mask = 0xffffffff, 204 .gpdup_mask = 0xffffffff,
187
188 .xres = {
189 .min = 160,
190 .max = 160,
191 .defval = 160,
192 },
193
194 .yres = {
195 .min = 160,
196 .max = 160,
197 .defval = 160,
198 },
199
200 .bpp = {
201 .min = 4,
202 .max = 4,
203 .defval = 4,
204 },
205
206 .regs = {
207 .lcdcon1 = 0x00008225,
208 .lcdcon2 = 0x0027c000,
209 .lcdcon3 = 0x00182708,
210 .lcdcon4 = 0x00000002,
211 .lcdcon5 = 0x00000001,
212 }
213}; 205};
214#endif 206#endif
215 207
@@ -239,7 +231,7 @@ static void __init amlm5900_init(void)
239{ 231{
240 amlm5900_init_pm(); 232 amlm5900_init_pm();
241#ifdef CONFIG_FB_S3C2410 233#ifdef CONFIG_FB_S3C2410
242 s3c24xx_fb_set_platdata(&amlm5900_lcd_info); 234 s3c24xx_fb_set_platdata(&amlm5900_fb_info);
243#endif 235#endif
244 platform_add_devices(amlm5900_devices, ARRAY_SIZE(amlm5900_devices)); 236 platform_add_devices(amlm5900_devices, ARRAY_SIZE(amlm5900_devices));
245} 237}
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c
index bc926992b4e4..587864fe25fb 100644
--- a/arch/arm/mach-s3c2410/mach-bast.c
+++ b/arch/arm/mach-s3c2410/mach-bast.c
@@ -467,35 +467,70 @@ static struct platform_device bast_device_axpp = {
467 467
468/* LCD/VGA controller */ 468/* LCD/VGA controller */
469 469
470static struct s3c2410fb_mach_info __initdata bast_lcd_info = { 470static struct s3c2410fb_display __initdata bast_lcd_info[] = {
471 .width = 640, 471 {
472 .height = 480, 472 .type = S3C2410_LCDCON1_TFT,
473 473 .width = 640,
474 .xres = { 474 .height = 480,
475 .min = 320, 475
476 .max = 1024, 476 .pixclock = 33333,
477 .defval = 640, 477 .xres = 640,
478 }, 478 .yres = 480,
479 .bpp = 4,
480 .left_margin = 40,
481 .right_margin = 20,
482 .hsync_len = 88,
483 .upper_margin = 30,
484 .lower_margin = 32,
485 .vsync_len = 3,
479 486
480 .yres = { 487 .lcdcon5 = 0x00014b02,
481 .min = 240,
482 .max = 600,
483 .defval = 480,
484 }, 488 },
489 {
490 .type = S3C2410_LCDCON1_TFT,
491 .width = 640,
492 .height = 480,
493
494 .pixclock = 33333,
495 .xres = 640,
496 .yres = 480,
497 .bpp = 8,
498 .left_margin = 40,
499 .right_margin = 20,
500 .hsync_len = 88,
501 .upper_margin = 30,
502 .lower_margin = 32,
503 .vsync_len = 3,
485 504
486 .bpp = { 505 .lcdcon5 = 0x00014b02,
487 .min = 4,
488 .max = 16,
489 .defval = 8,
490 }, 506 },
507 {
508 .type = S3C2410_LCDCON1_TFT,
509 .width = 640,
510 .height = 480,
511
512 .pixclock = 33333,
513 .xres = 640,
514 .yres = 480,
515 .bpp = 16,
516 .left_margin = 40,
517 .right_margin = 20,
518 .hsync_len = 88,
519 .upper_margin = 30,
520 .lower_margin = 32,
521 .vsync_len = 3,
491 522
492 .regs = {
493 .lcdcon1 = 0x00000176,
494 .lcdcon2 = 0x1d77c7c2,
495 .lcdcon3 = 0x013a7f13,
496 .lcdcon4 = 0x00000057,
497 .lcdcon5 = 0x00014b02, 523 .lcdcon5 = 0x00014b02,
498 } 524 },
525};
526
527/* LCD/VGA controller */
528
529static struct s3c2410fb_mach_info __initdata bast_fb_info = {
530
531 .displays = bast_lcd_info,
532 .num_displays = ARRAY_SIZE(bast_lcd_info),
533 .default_display = 4,
499}; 534};
500 535
501/* Standard BAST devices */ 536/* Standard BAST devices */
@@ -552,7 +587,7 @@ static void __init bast_map_io(void)
552 587
553static void __init bast_init(void) 588static void __init bast_init(void)
554{ 589{
555 s3c24xx_fb_set_platdata(&bast_lcd_info); 590 s3c24xx_fb_set_platdata(&bast_fb_info);
556 platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices)); 591 platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices));
557} 592}
558 593
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index 9a172b4ad720..7c1145e87c12 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -133,29 +133,31 @@ static struct s3c2410_udc_mach_info h1940_udc_cfg __initdata = {
133/** 133/**
134 * Set lcd on or off 134 * Set lcd on or off
135 **/ 135 **/
136static struct s3c2410fb_mach_info h1940_lcdcfg __initdata = { 136static struct s3c2410fb_display h1940_lcd __initdata = {
137 .fixed_syncs= 1, 137 .lcdcon5= S3C2410_LCDCON5_FRM565 | \
138 .regs={ 138 S3C2410_LCDCON5_INVVLINE | \
139 .lcdcon1= S3C2410_LCDCON1_TFT16BPP | \ 139 S3C2410_LCDCON5_HWSWP,
140 S3C2410_LCDCON1_TFT | \ 140
141 S3C2410_LCDCON1_CLKVAL(0x0C), 141 .type = S3C2410_LCDCON1_TFT,
142 142 .width = 240,
143 .lcdcon2= S3C2410_LCDCON2_VBPD(7) | \ 143 .height = 320,
144 S3C2410_LCDCON2_LINEVAL(319) | \ 144 .pixclock = 260000,
145 S3C2410_LCDCON2_VFPD(6) | \ 145 .xres = 240,
146 S3C2410_LCDCON2_VSPW(0), 146 .yres = 320,
147 147 .bpp = 16,
148 .lcdcon3= S3C2410_LCDCON3_HBPD(19) | \ 148 .left_margin = 20,
149 S3C2410_LCDCON3_HOZVAL(239) | \ 149 .right_margin = 8,
150 S3C2410_LCDCON3_HFPD(7), 150 .hsync_len = 4,
151 151 .upper_margin = 8,
152 .lcdcon4= S3C2410_LCDCON4_MVAL(0) | \ 152 .lower_margin = 7,
153 S3C2410_LCDCON4_HSPW(3), 153 .vsync_len = 1,
154 154};
155 .lcdcon5= S3C2410_LCDCON5_FRM565 | \ 155
156 S3C2410_LCDCON5_INVVLINE | \ 156static struct s3c2410fb_mach_info h1940_fb_info __initdata = {
157 S3C2410_LCDCON5_HWSWP, 157 .displays = &h1940_lcd,
158 }, 158 .num_displays = 1,
159 .default_display = 0,
160
159 .lpcsel= 0x02, 161 .lpcsel= 0x02,
160 .gpccon= 0xaa940659, 162 .gpccon= 0xaa940659,
161 .gpccon_mask= 0xffffffff, 163 .gpccon_mask= 0xffffffff,
@@ -165,12 +167,6 @@ static struct s3c2410fb_mach_info h1940_lcdcfg __initdata = {
165 .gpdcon_mask= 0xffffffff, 167 .gpdcon_mask= 0xffffffff,
166 .gpdup= 0x0000faff, 168 .gpdup= 0x0000faff,
167 .gpdup_mask= 0xffffffff, 169 .gpdup_mask= 0xffffffff,
168
169 .width= 240,
170 .height= 320,
171 .xres= {240,240,240},
172 .yres= {320,320,320},
173 .bpp= {16,16,16},
174}; 170};
175 171
176static struct platform_device s3c_device_leds = { 172static struct platform_device s3c_device_leds = {
@@ -217,7 +213,7 @@ static void __init h1940_init(void)
217{ 213{
218 u32 tmp; 214 u32 tmp;
219 215
220 s3c24xx_fb_set_platdata(&h1940_lcdcfg); 216 s3c24xx_fb_set_platdata(&h1940_fb_info);
221 s3c24xx_udc_set_platdata(&h1940_udc_cfg); 217 s3c24xx_udc_set_platdata(&h1940_udc_cfg);
222 218
223 /* Turn off suspend on both USB ports, and switch the 219 /* Turn off suspend on both USB ports, and switch the
diff --git a/arch/arm/mach-s3c2410/mach-qt2410.c b/arch/arm/mach-s3c2410/mach-qt2410.c
index e670b1e1631b..a1caf4b0adac 100644
--- a/arch/arm/mach-s3c2410/mach-qt2410.c
+++ b/arch/arm/mach-s3c2410/mach-qt2410.c
@@ -95,157 +95,83 @@ static struct s3c2410_uartcfg smdk2410_uartcfgs[] = {
95 95
96/* LCD driver info */ 96/* LCD driver info */
97 97
98/* Configuration for 640x480 SHARP LQ080V3DG01 */ 98static struct s3c2410fb_display qt2410_lcd_cfg[] __initdata = {
99static struct s3c2410fb_mach_info qt2410_biglcd_cfg __initdata = { 99 {
100 .regs = { 100 /* Configuration for 640x480 SHARP LQ080V3DG01 */
101 101 .lcdcon5 = S3C2410_LCDCON5_FRM565 |
102 .lcdcon1 = S3C2410_LCDCON1_TFT16BPP | 102 S3C2410_LCDCON5_INVVLINE |
103 S3C2410_LCDCON1_TFT | 103 S3C2410_LCDCON5_INVVFRAME |
104 S3C2410_LCDCON1_CLKVAL(0x01), /* HCLK/4 */ 104 S3C2410_LCDCON5_PWREN |
105 105 S3C2410_LCDCON5_HWSWP,
106 .lcdcon2 = S3C2410_LCDCON2_VBPD(18) | /* 19 */ 106
107 S3C2410_LCDCON2_LINEVAL(479) | 107 .type = S3C2410_LCDCON1_TFT,
108 S3C2410_LCDCON2_VFPD(10) | /* 11 */ 108 .width = 640,
109 S3C2410_LCDCON2_VSPW(14), /* 15 */ 109 .height = 480,
110 110
111 .lcdcon3 = S3C2410_LCDCON3_HBPD(43) | /* 44 */ 111 .pixclock = 40000, /* HCLK/4 */
112 S3C2410_LCDCON3_HOZVAL(639) | /* 640 */ 112 .xres = 640,
113 S3C2410_LCDCON3_HFPD(115), /* 116 */ 113 .yres = 480,
114 114 .bpp = 16,
115 .lcdcon4 = S3C2410_LCDCON4_MVAL(0) | 115 .left_margin = 44,
116 S3C2410_LCDCON4_HSPW(95), /* 96 */ 116 .right_margin = 116,
117 117 .hsync_len = 96,
118 .lcdcon5 = S3C2410_LCDCON5_FRM565 | 118 .upper_margin = 19,
119 S3C2410_LCDCON5_INVVLINE | 119 .lower_margin = 11,
120 S3C2410_LCDCON5_INVVFRAME | 120 .vsync_len = 15,
121 S3C2410_LCDCON5_PWREN |
122 S3C2410_LCDCON5_HWSWP,
123 }, 121 },
124 122 {
125 .lpcsel = ((0xCE6) & ~7) | 1<<4, 123 /* Configuration for 480x640 toppoly TD028TTEC1 */
126 124 .lcdcon5 = S3C2410_LCDCON5_FRM565 |
127 .width = 640, 125 S3C2410_LCDCON5_INVVLINE |
128 .height = 480, 126 S3C2410_LCDCON5_INVVFRAME |
129 127 S3C2410_LCDCON5_PWREN |
130 .xres = { 128 S3C2410_LCDCON5_HWSWP,
131 .min = 640, 129
132 .max = 640, 130 .type = S3C2410_LCDCON1_TFT,
133 .defval = 640, 131 .width = 480,
134 }, 132 .height = 640,
135 133 .pixclock = 40000, /* HCLK/4 */
136 .yres = { 134 .xres = 480,
137 .min = 480, 135 .yres = 640,
138 .max = 480, 136 .bpp = 16,
139 .defval = 480, 137 .left_margin = 8,
140 }, 138 .right_margin = 24,
141 139 .hsync_len = 8,
142 .bpp = { 140 .upper_margin = 2,
143 .min = 16, 141 .lower_margin = 4,
144 .max = 16, 142 .vsync_len = 2,
145 .defval = 16,
146 },
147};
148
149/* Configuration for 480x640 toppoly TD028TTEC1 */
150static struct s3c2410fb_mach_info qt2410_prodlcd_cfg __initdata = {
151 .regs = {
152
153 .lcdcon1 = S3C2410_LCDCON1_TFT16BPP |
154 S3C2410_LCDCON1_TFT |
155 S3C2410_LCDCON1_CLKVAL(0x01), /* HCLK/4 */
156
157 .lcdcon2 = S3C2410_LCDCON2_VBPD(1) | /* 2 */
158 S3C2410_LCDCON2_LINEVAL(639) |/* 640 */
159 S3C2410_LCDCON2_VFPD(3) | /* 4 */
160 S3C2410_LCDCON2_VSPW(1), /* 2 */
161
162 .lcdcon3 = S3C2410_LCDCON3_HBPD(7) | /* 8 */
163 S3C2410_LCDCON3_HOZVAL(479) | /* 479 */
164 S3C2410_LCDCON3_HFPD(23), /* 24 */
165
166 .lcdcon4 = S3C2410_LCDCON4_MVAL(0) |
167 S3C2410_LCDCON4_HSPW(7), /* 8 */
168
169 .lcdcon5 = S3C2410_LCDCON5_FRM565 |
170 S3C2410_LCDCON5_INVVLINE |
171 S3C2410_LCDCON5_INVVFRAME |
172 S3C2410_LCDCON5_PWREN |
173 S3C2410_LCDCON5_HWSWP,
174 },
175
176 .lpcsel = ((0xCE6) & ~7) | 1<<4,
177
178 .width = 480,
179 .height = 640,
180
181 .xres = {
182 .min = 480,
183 .max = 480,
184 .defval = 480,
185 }, 143 },
186 144 {
187 .yres = { 145 /* Config for 240x320 LCD */
188 .min = 640, 146 .lcdcon5 = S3C2410_LCDCON5_FRM565 |
189 .max = 640, 147 S3C2410_LCDCON5_INVVLINE |
190 .defval = 640, 148 S3C2410_LCDCON5_INVVFRAME |
191 }, 149 S3C2410_LCDCON5_PWREN |
192 150 S3C2410_LCDCON5_HWSWP,
193 .bpp = { 151
194 .min = 16, 152 .type = S3C2410_LCDCON1_TFT,
195 .max = 16, 153 .width = 240,
196 .defval = 16, 154 .height = 320,
155 .pixclock = 100000, /* HCLK/10 */
156 .xres = 240,
157 .yres = 320,
158 .bpp = 16,
159 .left_margin = 13,
160 .right_margin = 8,
161 .hsync_len = 4,
162 .upper_margin = 2,
163 .lower_margin = 7,
164 .vsync_len = 4,
197 }, 165 },
198}; 166};
199 167
200/* Config for 240x320 LCD */
201static struct s3c2410fb_mach_info qt2410_lcd_cfg __initdata = {
202 .regs = {
203
204 .lcdcon1 = S3C2410_LCDCON1_TFT16BPP |
205 S3C2410_LCDCON1_TFT |
206 S3C2410_LCDCON1_CLKVAL(0x04),
207
208 .lcdcon2 = S3C2410_LCDCON2_VBPD(1) |
209 S3C2410_LCDCON2_LINEVAL(319) |
210 S3C2410_LCDCON2_VFPD(6) |
211 S3C2410_LCDCON2_VSPW(3),
212
213 .lcdcon3 = S3C2410_LCDCON3_HBPD(12) |
214 S3C2410_LCDCON3_HOZVAL(239) |
215 S3C2410_LCDCON3_HFPD(7),
216 168
217 .lcdcon4 = S3C2410_LCDCON4_MVAL(0) | 169static struct s3c2410fb_mach_info qt2410_fb_info __initdata = {
218 S3C2410_LCDCON4_HSPW(3), 170 .displays = qt2410_lcd_cfg,
219 171 .num_displays = ARRAY_SIZE(qt2410_lcd_cfg),
220 .lcdcon5 = S3C2410_LCDCON5_FRM565 | 172 .default_display = 0,
221 S3C2410_LCDCON5_INVVLINE |
222 S3C2410_LCDCON5_INVVFRAME |
223 S3C2410_LCDCON5_PWREN |
224 S3C2410_LCDCON5_HWSWP,
225 },
226 173
227 .lpcsel = ((0xCE6) & ~7) | 1<<4, 174 .lpcsel = ((0xCE6) & ~7) | 1<<4,
228
229 .width = 240,
230 .height = 320,
231
232 .xres = {
233 .min = 240,
234 .max = 240,
235 .defval = 240,
236 },
237
238 .yres = {
239 .min = 320,
240 .max = 320,
241 .defval = 320,
242 },
243
244 .bpp = {
245 .min = 16,
246 .max = 16,
247 .defval = 16,
248 },
249}; 175};
250 176
251/* CS8900 */ 177/* CS8900 */
@@ -408,16 +334,17 @@ static void __init qt2410_machine_init(void)
408 334
409 switch (tft_type) { 335 switch (tft_type) {
410 case 'p': /* production */ 336 case 'p': /* production */
411 s3c24xx_fb_set_platdata(&qt2410_prodlcd_cfg); 337 qt2410_fb_info.default_display = 1;
412 break; 338 break;
413 case 'b': /* big */ 339 case 'b': /* big */
414 s3c24xx_fb_set_platdata(&qt2410_biglcd_cfg); 340 qt2410_fb_info.default_display = 0;
415 break; 341 break;
416 case 's': /* small */ 342 case 's': /* small */
417 default: 343 default:
418 s3c24xx_fb_set_platdata(&qt2410_lcd_cfg); 344 qt2410_fb_info.default_display = 2;
419 break; 345 break;
420 } 346 }
347 s3c24xx_fb_set_platdata(&qt2410_fb_info);
421 348
422 s3c2410_gpio_cfgpin(S3C2410_GPB0, S3C2410_GPIO_OUTPUT); 349 s3c2410_gpio_cfgpin(S3C2410_GPB0, S3C2410_GPIO_OUTPUT);
423 s3c2410_gpio_setpin(S3C2410_GPB0, 1); 350 s3c2410_gpio_setpin(S3C2410_GPB0, 1);
diff --git a/arch/arm/mach-s3c2412/dma.c b/arch/arm/mach-s3c2412/dma.c
index 4b9425c1bf72..53c1d5bbce19 100644
--- a/arch/arm/mach-s3c2412/dma.c
+++ b/arch/arm/mach-s3c2412/dma.c
@@ -144,7 +144,7 @@ static struct s3c24xx_dma_selection __initdata s3c2412_dma_sel = {
144 .map_size = ARRAY_SIZE(s3c2412_dma_mappings), 144 .map_size = ARRAY_SIZE(s3c2412_dma_mappings),
145}; 145};
146 146
147static int s3c2412_dma_add(struct sys_device *sysdev) 147static int __init s3c2412_dma_add(struct sys_device *sysdev)
148{ 148{
149 s3c2410_dma_init(); 149 s3c2410_dma_init();
150 return s3c24xx_dma_init_map(&s3c2412_dma_sel); 150 return s3c24xx_dma_init_map(&s3c2412_dma_sel);
diff --git a/arch/arm/mach-s3c2412/irq.c b/arch/arm/mach-s3c2412/irq.c
index f0d66828f965..e9d0c769f5da 100644
--- a/arch/arm/mach-s3c2412/irq.c
+++ b/arch/arm/mach-s3c2412/irq.c
@@ -38,6 +38,9 @@
38#include <asm/plat-s3c24xx/irq.h> 38#include <asm/plat-s3c24xx/irq.h>
39#include <asm/plat-s3c24xx/pm.h> 39#include <asm/plat-s3c24xx/pm.h>
40 40
41#define INTMSK(start, end) ((1 << ((end) + 1 - (start))) - 1)
42#define INTMSK_SUB(start, end) (INTMSK(start, end) << ((start - S3C2410_IRQSUB(0))))
43
41/* the s3c2412 changes the behaviour of IRQ_EINT0 through IRQ_EINT3 by 44/* the s3c2412 changes the behaviour of IRQ_EINT0 through IRQ_EINT3 by
42 * having them turn up in both the INT* and the EINT* registers. Whilst 45 * having them turn up in both the INT* and the EINT* registers. Whilst
43 * both show the status, they both now need to be acked when the IRQs 46 * both show the status, they both now need to be acked when the IRQs
@@ -105,6 +108,51 @@ static struct irq_chip s3c2412_irq_eint0t4 = {
105 .set_type = s3c_irqext_type, 108 .set_type = s3c_irqext_type,
106}; 109};
107 110
111#define INTBIT(x) (1 << ((x) - S3C2410_IRQSUB(0)))
112
113/* CF and SDI sub interrupts */
114
115static void s3c2412_irq_demux_cfsdi(unsigned int irq, struct irq_desc *desc)
116{
117 unsigned int subsrc, submsk;
118
119 subsrc = __raw_readl(S3C2410_SUBSRCPND);
120 submsk = __raw_readl(S3C2410_INTSUBMSK);
121
122 subsrc &= ~submsk;
123
124 if (subsrc & INTBIT(IRQ_S3C2412_SDI))
125 desc_handle_irq(IRQ_S3C2412_SDI, irq_desc + IRQ_S3C2412_SDI);
126
127 if (subsrc & INTBIT(IRQ_S3C2412_CF))
128 desc_handle_irq(IRQ_S3C2412_CF, irq_desc + IRQ_S3C2412_CF);
129}
130
131#define INTMSK_CFSDI (1UL << (IRQ_S3C2412_CFSDI - IRQ_EINT0))
132#define SUBMSK_CFSDI INTMSK_SUB(IRQ_S3C2412_SDI, IRQ_S3C2412_CF)
133
134static void s3c2412_irq_cfsdi_mask(unsigned int irqno)
135{
136 s3c_irqsub_mask(irqno, INTMSK_CFSDI, SUBMSK_CFSDI);
137}
138
139static void s3c2412_irq_cfsdi_unmask(unsigned int irqno)
140{
141 s3c_irqsub_unmask(irqno, INTMSK_CFSDI);
142}
143
144static void s3c2412_irq_cfsdi_ack(unsigned int irqno)
145{
146 s3c_irqsub_maskack(irqno, INTMSK_CFSDI, SUBMSK_CFSDI);
147}
148
149static struct irq_chip s3c2412_irq_cfsdi = {
150 .name = "s3c2412-cfsdi",
151 .ack = s3c2412_irq_cfsdi_ack,
152 .mask = s3c2412_irq_cfsdi_mask,
153 .unmask = s3c2412_irq_cfsdi_unmask,
154};
155
108static int s3c2412_irq_add(struct sys_device *sysdev) 156static int s3c2412_irq_add(struct sys_device *sysdev)
109{ 157{
110 unsigned int irqno; 158 unsigned int irqno;
@@ -115,6 +163,16 @@ static int s3c2412_irq_add(struct sys_device *sysdev)
115 set_irq_flags(irqno, IRQF_VALID); 163 set_irq_flags(irqno, IRQF_VALID);
116 } 164 }
117 165
166 /* add demux support for CF/SDI */
167
168 set_irq_chained_handler(IRQ_S3C2412_CFSDI, s3c2412_irq_demux_cfsdi);
169
170 for (irqno = IRQ_S3C2412_SDI; irqno <= IRQ_S3C2412_CF; irqno++) {
171 set_irq_chip(irqno, &s3c2412_irq_cfsdi);
172 set_irq_handler(irqno, handle_level_irq);
173 set_irq_flags(irqno, IRQF_VALID);
174 }
175
118 return 0; 176 return 0;
119} 177}
120 178
diff --git a/arch/arm/mach-s3c2412/s3c2412.c b/arch/arm/mach-s3c2412/s3c2412.c
index e0ccb404623f..4f92a1562d77 100644
--- a/arch/arm/mach-s3c2412/s3c2412.c
+++ b/arch/arm/mach-s3c2412/s3c2412.c
@@ -78,6 +78,11 @@ void __init s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no)
78 s3c_device_lcd.name = "s3c2412-lcd"; 78 s3c_device_lcd.name = "s3c2412-lcd";
79 s3c_device_nand.name = "s3c2412-nand"; 79 s3c_device_nand.name = "s3c2412-nand";
80 80
81 /* alter IRQ of SDI controller */
82
83 s3c_device_sdi.resource[1].start = IRQ_S3C2412_SDI;
84 s3c_device_sdi.resource[1].end = IRQ_S3C2412_SDI;
85
81 /* spi channel related changes, s3c2412/13 specific */ 86 /* spi channel related changes, s3c2412/13 specific */
82 s3c_device_spi0.name = "s3c2412-spi"; 87 s3c_device_spi0.name = "s3c2412-spi";
83 s3c_device_spi0.resource[0].end = S3C24XX_PA_SPI + 0x24; 88 s3c_device_spi0.resource[0].end = S3C24XX_PA_SPI + 0x24;
diff --git a/arch/arm/mach-s3c2440/dma.c b/arch/arm/mach-s3c2440/dma.c
index f509f062e749..0b1260827ac6 100644
--- a/arch/arm/mach-s3c2440/dma.c
+++ b/arch/arm/mach-s3c2440/dma.c
@@ -190,7 +190,7 @@ static struct s3c24xx_dma_order __initdata s3c2440_dma_order = {
190 }, 190 },
191}; 191};
192 192
193static int s3c2440_dma_add(struct sys_device *sysdev) 193static int __init s3c2440_dma_add(struct sys_device *sysdev)
194{ 194{
195 s3c2410_dma_init(); 195 s3c2410_dma_init();
196 s3c24xx_dma_order_set(&s3c2440_dma_order); 196 s3c24xx_dma_order_set(&s3c2440_dma_order);
diff --git a/arch/arm/mach-s3c2440/mach-rx3715.c b/arch/arm/mach-s3c2440/mach-rx3715.c
index b59e6d39f2f2..bac40c4878a5 100644
--- a/arch/arm/mach-s3c2440/mach-rx3715.c
+++ b/arch/arm/mach-s3c2440/mach-rx3715.c
@@ -110,28 +110,32 @@ static struct s3c2410_uartcfg rx3715_uartcfgs[] = {
110 110
111/* framebuffer lcd controller information */ 111/* framebuffer lcd controller information */
112 112
113static struct s3c2410fb_mach_info rx3715_lcdcfg __initdata = { 113static struct s3c2410fb_display rx3715_lcdcfg __initdata = {
114 .regs = { 114 .lcdcon5 = S3C2410_LCDCON5_INVVLINE |
115 .lcdcon1 = S3C2410_LCDCON1_TFT16BPP | \ 115 S3C2410_LCDCON5_FRM565 |
116 S3C2410_LCDCON1_TFT | \ 116 S3C2410_LCDCON5_HWSWP,
117 S3C2410_LCDCON1_CLKVAL(0x0C), 117
118 118 .type = S3C2410_LCDCON1_TFT,
119 .lcdcon2 = S3C2410_LCDCON2_VBPD(5) | \ 119 .width = 240,
120 S3C2410_LCDCON2_LINEVAL(319) | \ 120 .height = 320,
121 S3C2410_LCDCON2_VFPD(6) | \ 121
122 S3C2410_LCDCON2_VSPW(2), 122 .pixclock = 260000,
123 123 .xres = 240,
124 .lcdcon3 = S3C2410_LCDCON3_HBPD(35) | \ 124 .yres = 320,
125 S3C2410_LCDCON3_HOZVAL(239) | \ 125 .bpp = 16,
126 S3C2410_LCDCON3_HFPD(35), 126 .left_margin = 36,
127 127 .right_margin = 36,
128 .lcdcon4 = S3C2410_LCDCON4_MVAL(0) | \ 128 .hsync_len = 8,
129 S3C2410_LCDCON4_HSPW(7), 129 .upper_margin = 6,
130 130 .lower_margin = 7,
131 .lcdcon5 = S3C2410_LCDCON5_INVVLINE | 131 .vsync_len = 3,
132 S3C2410_LCDCON5_FRM565 | 132};
133 S3C2410_LCDCON5_HWSWP, 133
134 }, 134static struct s3c2410fb_mach_info rx3715_fb_info __initdata = {
135
136 .displays = &rx3715_lcdcfg,
137 .num_displays = 1,
138 .default_display = 0,
135 139
136 .lpcsel = 0xf82, 140 .lpcsel = 0xf82,
137 141
@@ -144,28 +148,6 @@ static struct s3c2410fb_mach_info rx3715_lcdcfg __initdata = {
144 .gpdcon_mask = 0xffc0fff0, 148 .gpdcon_mask = 0xffc0fff0,
145 .gpdup = 0x0000faff, 149 .gpdup = 0x0000faff,
146 .gpdup_mask = 0xffffffff, 150 .gpdup_mask = 0xffffffff,
147
148 .fixed_syncs = 1,
149 .width = 240,
150 .height = 320,
151
152 .xres = {
153 .min = 240,
154 .max = 240,
155 .defval = 240,
156 },
157
158 .yres = {
159 .max = 320,
160 .min = 320,
161 .defval = 320,
162 },
163
164 .bpp = {
165 .min = 16,
166 .max = 16,
167 .defval = 16,
168 },
169}; 151};
170 152
171static struct mtd_partition rx3715_nand_part[] = { 153static struct mtd_partition rx3715_nand_part[] = {
@@ -224,7 +206,7 @@ static void __init rx3715_init_machine(void)
224#endif 206#endif
225 s3c2410_pm_init(); 207 s3c2410_pm_init();
226 208
227 s3c24xx_fb_set_platdata(&rx3715_lcdcfg); 209 s3c24xx_fb_set_platdata(&rx3715_fb_info);
228 platform_add_devices(rx3715_devices, ARRAY_SIZE(rx3715_devices)); 210 platform_add_devices(rx3715_devices, ARRAY_SIZE(rx3715_devices));
229} 211}
230 212
diff --git a/arch/arm/mach-s3c2440/mach-smdk2440.c b/arch/arm/mach-s3c2440/mach-smdk2440.c
index 670115b8a12e..4552828bf800 100644
--- a/arch/arm/mach-s3c2440/mach-smdk2440.c
+++ b/arch/arm/mach-s3c2440/mach-smdk2440.c
@@ -103,31 +103,35 @@ static struct s3c2410_uartcfg smdk2440_uartcfgs[] __initdata = {
103 103
104/* LCD driver info */ 104/* LCD driver info */
105 105
106static struct s3c2410fb_mach_info smdk2440_lcd_cfg __initdata = { 106static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = {
107 .regs = { 107
108 108 .lcdcon5 = S3C2410_LCDCON5_FRM565 |
109 .lcdcon1 = S3C2410_LCDCON1_TFT16BPP | 109 S3C2410_LCDCON5_INVVLINE |
110 S3C2410_LCDCON1_TFT | 110 S3C2410_LCDCON5_INVVFRAME |
111 S3C2410_LCDCON1_CLKVAL(0x04), 111 S3C2410_LCDCON5_PWREN |
112 112 S3C2410_LCDCON5_HWSWP,
113 .lcdcon2 = S3C2410_LCDCON2_VBPD(7) | 113
114 S3C2410_LCDCON2_LINEVAL(319) | 114 .type = S3C2410_LCDCON1_TFT,
115 S3C2410_LCDCON2_VFPD(6) | 115
116 S3C2410_LCDCON2_VSPW(3), 116 .width = 240,
117 117 .height = 320,
118 .lcdcon3 = S3C2410_LCDCON3_HBPD(19) | 118
119 S3C2410_LCDCON3_HOZVAL(239) | 119 .pixclock = 166667, /* HCLK 60 MHz, divisor 10 */
120 S3C2410_LCDCON3_HFPD(7), 120 .xres = 240,
121 121 .yres = 320,
122 .lcdcon4 = S3C2410_LCDCON4_MVAL(0) | 122 .bpp = 16,
123 S3C2410_LCDCON4_HSPW(3), 123 .left_margin = 20,
124 124 .right_margin = 8,
125 .lcdcon5 = S3C2410_LCDCON5_FRM565 | 125 .hsync_len = 4,
126 S3C2410_LCDCON5_INVVLINE | 126 .upper_margin = 8,
127 S3C2410_LCDCON5_INVVFRAME | 127 .lower_margin = 7,
128 S3C2410_LCDCON5_PWREN | 128 .vsync_len = 4,
129 S3C2410_LCDCON5_HWSWP, 129};
130 }, 130
131static struct s3c2410fb_mach_info smdk2440_fb_info __initdata = {
132 .displays = &smdk2440_lcd_cfg,
133 .num_displays = 1,
134 .default_display = 0,
131 135
132#if 0 136#if 0
133 /* currently setup by downloader */ 137 /* currently setup by downloader */
@@ -142,28 +146,6 @@ static struct s3c2410fb_mach_info smdk2440_lcd_cfg __initdata = {
142#endif 146#endif
143 147
144 .lpcsel = ((0xCE6) & ~7) | 1<<4, 148 .lpcsel = ((0xCE6) & ~7) | 1<<4,
145 .type = S3C2410_LCDCON1_TFT16BPP,
146
147 .width = 240,
148 .height = 320,
149
150 .xres = {
151 .min = 240,
152 .max = 240,
153 .defval = 240,
154 },
155
156 .yres = {
157 .min = 320,
158 .max = 320,
159 .defval = 320,
160 },
161
162 .bpp = {
163 .min = 16,
164 .max = 16,
165 .defval = 16,
166 },
167}; 149};
168 150
169static struct platform_device *smdk2440_devices[] __initdata = { 151static struct platform_device *smdk2440_devices[] __initdata = {
@@ -183,7 +165,7 @@ static void __init smdk2440_map_io(void)
183 165
184static void __init smdk2440_machine_init(void) 166static void __init smdk2440_machine_init(void)
185{ 167{
186 s3c24xx_fb_set_platdata(&smdk2440_lcd_cfg); 168 s3c24xx_fb_set_platdata(&smdk2440_fb_info);
187 169
188 platform_add_devices(smdk2440_devices, ARRAY_SIZE(smdk2440_devices)); 170 platform_add_devices(smdk2440_devices, ARRAY_SIZE(smdk2440_devices));
189 smdk_machine_init(); 171 smdk_machine_init();
diff --git a/arch/arm/mach-s3c2443/dma.c b/arch/arm/mach-s3c2443/dma.c
index fc3ede82af8f..f6c006d4297b 100644
--- a/arch/arm/mach-s3c2443/dma.c
+++ b/arch/arm/mach-s3c2443/dma.c
@@ -162,7 +162,7 @@ static struct s3c24xx_dma_selection __initdata s3c2443_dma_sel = {
162 .map_size = ARRAY_SIZE(s3c2443_dma_mappings), 162 .map_size = ARRAY_SIZE(s3c2443_dma_mappings),
163}; 163};
164 164
165static int s3c2443_dma_add(struct sys_device *sysdev) 165static int __init s3c2443_dma_add(struct sys_device *sysdev)
166{ 166{
167 s3c24xx_dma_init(6, IRQ_S3C2443_DMA0, 0x100); 167 s3c24xx_dma_init(6, IRQ_S3C2443_DMA0, 0x100);
168 return s3c24xx_dma_init_map(&s3c2443_dma_sel); 168 return s3c24xx_dma_init_map(&s3c2443_dma_sel);
diff --git a/arch/arm/mach-s3c2443/irq.c b/arch/arm/mach-s3c2443/irq.c
index 6cd4818f3f0d..f9ad498a6fc0 100644
--- a/arch/arm/mach-s3c2443/irq.c
+++ b/arch/arm/mach-s3c2443/irq.c
@@ -252,7 +252,7 @@ static int __init s3c2443_add_sub(unsigned int base,
252 return 0; 252 return 0;
253} 253}
254 254
255static int s3c2443_irq_add(struct sys_device *sysdev) 255static int __init s3c2443_irq_add(struct sys_device *sysdev)
256{ 256{
257 printk("S3C2443: IRQ Support\n"); 257 printk("S3C2443: IRQ Support\n");
258 258
@@ -280,7 +280,7 @@ static struct sysdev_driver s3c2443_irq_driver = {
280 .add = s3c2443_irq_add, 280 .add = s3c2443_irq_add,
281}; 281};
282 282
283static int s3c2443_irq_init(void) 283static int __init s3c2443_irq_init(void)
284{ 284{
285 return sysdev_driver_register(&s3c2443_sysclass, &s3c2443_irq_driver); 285 return sysdev_driver_register(&s3c2443_sysclass, &s3c2443_irq_driver);
286} 286}
diff --git a/arch/arm/mach-sa1100/cpu-sa1110.c b/arch/arm/mach-sa1100/cpu-sa1110.c
index 78f4c1346044..36b47ff5af11 100644
--- a/arch/arm/mach-sa1100/cpu-sa1110.c
+++ b/arch/arm/mach-sa1100/cpu-sa1110.c
@@ -331,7 +331,6 @@ static int __init sa1110_cpu_init(struct cpufreq_policy *policy)
331 if (policy->cpu != 0) 331 if (policy->cpu != 0)
332 return -EINVAL; 332 return -EINVAL;
333 policy->cur = policy->min = policy->max = sa11x0_getspeed(0); 333 policy->cur = policy->min = policy->max = sa11x0_getspeed(0);
334 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
335 policy->cpuinfo.min_freq = 59000; 334 policy->cpuinfo.min_freq = 59000;
336 policy->cpuinfo.max_freq = 287000; 335 policy->cpuinfo.max_freq = 287000;
337 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; 336 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 12161ae445da..7868f4dc1d00 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -322,7 +322,7 @@ config CPU_SA1100
322# XScale 322# XScale
323config CPU_XSCALE 323config CPU_XSCALE
324 bool 324 bool
325 depends on ARCH_IOP32X || ARCH_IOP33X || ARCH_PXA || ARCH_IXP4XX || ARCH_IXP2000 325 depends on ARCH_IOP32X || ARCH_IOP33X || PXA25x || PXA27x || ARCH_IXP4XX || ARCH_IXP2000
326 default y 326 default y
327 select CPU_32v5 327 select CPU_32v5
328 select CPU_ABRT_EV5T 328 select CPU_ABRT_EV5T
@@ -333,7 +333,7 @@ config CPU_XSCALE
333# XScale Core Version 3 333# XScale Core Version 3
334config CPU_XSC3 334config CPU_XSC3
335 bool 335 bool
336 depends on ARCH_IXP23XX || ARCH_IOP13XX 336 depends on ARCH_IXP23XX || ARCH_IOP13XX || PXA3xx
337 default y 337 default y
338 select CPU_32v5 338 select CPU_32v5
339 select CPU_ABRT_EV5T 339 select CPU_ABRT_EV5T
diff --git a/arch/arm/mm/consistent.c b/arch/arm/mm/consistent.c
index 1f9f94f9af4b..cefdf2f9f26e 100644
--- a/arch/arm/mm/consistent.c
+++ b/arch/arm/mm/consistent.c
@@ -481,7 +481,7 @@ core_initcall(consistent_init);
481 * platforms with CONFIG_DMABOUNCE. 481 * platforms with CONFIG_DMABOUNCE.
482 * Use the driver DMA support - see dma-mapping.h (dma_sync_*) 482 * Use the driver DMA support - see dma-mapping.h (dma_sync_*)
483 */ 483 */
484void consistent_sync(const void *start, size_t size, int direction) 484void dma_cache_maint(const void *start, size_t size, int direction)
485{ 485{
486 const void *end = start + size; 486 const void *end = start + size;
487 487
@@ -504,4 +504,4 @@ void consistent_sync(const void *start, size_t size, int direction)
504 BUG(); 504 BUG();
505 } 505 }
506} 506}
507EXPORT_SYMBOL(consistent_sync); 507EXPORT_SYMBOL(dma_cache_maint);
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index 846cce48e2b7..59ed1d05b71b 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -266,7 +266,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
266 * the page fault gracefully. 266 * the page fault gracefully.
267 */ 267 */
268 printk("VM: killing process %s\n", tsk->comm); 268 printk("VM: killing process %s\n", tsk->comm);
269 do_exit(SIGKILL); 269 do_group_exit(SIGKILL);
270 return 0; 270 return 0;
271 } 271 }
272 if (fault & VM_FAULT_SIGBUS) { 272 if (fault & VM_FAULT_SIGBUS) {
diff --git a/arch/arm/nwfpe/ARM-gcc.h b/arch/arm/nwfpe/ARM-gcc.h
index e6598470b076..436e54aa02ec 100644
--- a/arch/arm/nwfpe/ARM-gcc.h
+++ b/arch/arm/nwfpe/ARM-gcc.h
@@ -68,7 +68,7 @@ a compiler does not support explicit inlining, this macro should be defined
68to be `static'. 68to be `static'.
69------------------------------------------------------------------------------- 69-------------------------------------------------------------------------------
70*/ 70*/
71#define INLINE extern __inline__ 71#define INLINE static inline
72 72
73 73
74/* For use as a GCC soft-float library we need some special function names. */ 74/* For use as a GCC soft-float library we need some special function names. */
diff --git a/arch/arm/nwfpe/entry.S b/arch/arm/nwfpe/entry.S
index 1dc13bc6d810..48bca0db4607 100644
--- a/arch/arm/nwfpe/entry.S
+++ b/arch/arm/nwfpe/entry.S
@@ -70,13 +70,24 @@ floating point instructions. GCC attempts to group floating point
70instructions to allow the emulator to spread the cost of the trap over 70instructions to allow the emulator to spread the cost of the trap over
71several floating point instructions. */ 71several floating point instructions. */
72 72
73#include <asm/asm-offsets.h>
74
73 .globl nwfpe_enter 75 .globl nwfpe_enter
74nwfpe_enter: 76nwfpe_enter:
75 mov r4, lr @ save the failure-return addresses 77 mov r4, lr @ save the failure-return addresses
76 mov sl, sp @ we access the registers via 'sl' 78 mov sl, sp @ we access the registers via 'sl'
77 79
78 ldr r5, [sp, #60] @ get contents of PC; 80 ldr r5, [sp, #S_PC] @ get contents of PC;
81 mov r6, r0 @ save the opcode
79emulate: 82emulate:
83 ldr r1, [sp, #S_PSR] @ fetch the PSR
84 bl checkCondition @ check the condition
85 cmp r0, #0 @ r0 = 0 ==> condition failed
86
87 @ if condition code failed to match, next insn
88 beq next @ get the next instruction;
89
90 mov r0, r6 @ prepare for EmulateAll()
80 bl EmulateAll @ emulate the instruction 91 bl EmulateAll @ emulate the instruction
81 cmp r0, #0 @ was emulation successful 92 cmp r0, #0 @ was emulation successful
82 moveq pc, r4 @ no, return failure 93 moveq pc, r4 @ no, return failure
@@ -91,18 +102,10 @@ next:
91 teqne r2, #0x0E000000 102 teqne r2, #0x0E000000
92 movne pc, r9 @ return ok if not a fp insn 103 movne pc, r9 @ return ok if not a fp insn
93 104
94 str r5, [sp, #60] @ update PC copy in regs 105 str r5, [sp, #S_PC] @ update PC copy in regs
95 106
96 mov r0, r6 @ save a copy 107 mov r0, r6 @ save a copy
97 ldr r1, [sp, #64] @ fetch the condition codes 108 b emulate @ check condition and emulate
98 bl checkCondition @ check the condition
99 cmp r0, #0 @ r0 = 0 ==> condition failed
100
101 @ if condition code failed to match, next insn
102 beq next @ get the next instruction;
103
104 mov r0, r6 @ prepare for EmulateAll()
105 b emulate @ if r0 != 0, goto EmulateAll
106 109
107 @ We need to be prepared for the instructions at .Lx1 and .Lx2 110 @ We need to be prepared for the instructions at .Lx1 and .Lx2
108 @ to fault. Emit the appropriate exception gunk to fix things up. 111 @ to fault. Emit the appropriate exception gunk to fix things up.
diff --git a/arch/arm/nwfpe/fpa11.inl b/arch/arm/nwfpe/fpa11.inl
index 10c3caf2868f..ab8d6826245f 100644
--- a/arch/arm/nwfpe/fpa11.inl
+++ b/arch/arm/nwfpe/fpa11.inl
@@ -22,13 +22,13 @@
22#include "fpa11.h" 22#include "fpa11.h"
23 23
24/* Read and write floating point status register */ 24/* Read and write floating point status register */
25extern __inline__ unsigned int readFPSR(void) 25static inline unsigned int readFPSR(void)
26{ 26{
27 FPA11 *fpa11 = GET_FPA11(); 27 FPA11 *fpa11 = GET_FPA11();
28 return (fpa11->fpsr); 28 return (fpa11->fpsr);
29} 29}
30 30
31extern __inline__ void writeFPSR(FPSR reg) 31static inline void writeFPSR(FPSR reg)
32{ 32{
33 FPA11 *fpa11 = GET_FPA11(); 33 FPA11 *fpa11 = GET_FPA11();
34 /* the sysid byte in the status register is readonly */ 34 /* the sysid byte in the status register is readonly */
@@ -36,14 +36,14 @@ extern __inline__ void writeFPSR(FPSR reg)
36} 36}
37 37
38/* Read and write floating point control register */ 38/* Read and write floating point control register */
39extern __inline__ FPCR readFPCR(void) 39static inline FPCR readFPCR(void)
40{ 40{
41 FPA11 *fpa11 = GET_FPA11(); 41 FPA11 *fpa11 = GET_FPA11();
42 /* clear SB, AB and DA bits before returning FPCR */ 42 /* clear SB, AB and DA bits before returning FPCR */
43 return (fpa11->fpcr & ~MASK_RFC); 43 return (fpa11->fpcr & ~MASK_RFC);
44} 44}
45 45
46extern __inline__ void writeFPCR(FPCR reg) 46static inline void writeFPCR(FPCR reg)
47{ 47{
48 FPA11 *fpa11 = GET_FPA11(); 48 FPA11 *fpa11 = GET_FPA11();
49 fpa11->fpcr &= ~MASK_WFC; /* clear SB, AB and DA bits */ 49 fpa11->fpcr &= ~MASK_WFC; /* clear SB, AB and DA bits */
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index cfc69f3842fd..c1f7e5a819a3 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -20,10 +20,15 @@ endchoice
20 20
21comment "OMAP Feature Selections" 21comment "OMAP Feature Selections"
22 22
23config OMAP_DEBUG_LEDS 23config OMAP_DEBUG_DEVICES
24 bool 24 bool
25 help 25 help
26 For debug card leds on TI reference boards. 26 For debug cards on TI reference boards.
27
28config OMAP_DEBUG_LEDS
29 bool
30 depends on OMAP_DEBUG_DEVICES
31 default y if LEDS || LEDS_OMAP_DEBUG
27 32
28config OMAP_RESET_CLOCKS 33config OMAP_RESET_CLOCKS
29 bool "Reset unused clocks during boot" 34 bool "Reset unused clocks during boot"
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index 41a3c1cf3bd4..2549129aabc6 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -17,4 +17,5 @@ obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o
17 17
18obj-$(CONFIG_CPU_FREQ) += cpu-omap.o 18obj-$(CONFIG_CPU_FREQ) += cpu-omap.o
19obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o 19obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o
20obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o
20obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o 21obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o
diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c
index a0c71dca2373..c0d63b0c61c9 100644
--- a/arch/arm/plat-omap/cpu-omap.c
+++ b/arch/arm/plat-omap/cpu-omap.c
@@ -108,7 +108,6 @@ static int __init omap_cpu_init(struct cpufreq_policy *policy)
108 if (policy->cpu != 0) 108 if (policy->cpu != 0)
109 return -EINVAL; 109 return -EINVAL;
110 policy->cur = policy->min = policy->max = omap_getspeed(0); 110 policy->cur = policy->min = policy->max = omap_getspeed(0);
111 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
112 policy->cpuinfo.min_freq = clk_round_rate(mpu_clk, 0) / 1000; 111 policy->cpuinfo.min_freq = clk_round_rate(mpu_clk, 0) / 1000;
113 policy->cpuinfo.max_freq = clk_round_rate(mpu_clk, VERY_HI_RATE) / 1000; 112 policy->cpuinfo.max_freq = clk_round_rate(mpu_clk, VERY_HI_RATE) / 1000;
114 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; 113 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
diff --git a/arch/arm/plat-omap/debug-devices.c b/arch/arm/plat-omap/debug-devices.c
new file mode 100644
index 000000000000..83a5f8b91857
--- /dev/null
+++ b/arch/arm/plat-omap/debug-devices.c
@@ -0,0 +1,86 @@
1/*
2 * linux/arch/arm/plat-omap/debug-devices.c
3 *
4 * Copyright (C) 2005 Nokia Corporation
5 * Modified from mach-omap2/board-h4.c
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/platform_device.h>
15
16#include <asm/hardware.h>
17#include <asm/io.h>
18
19#include <asm/arch/board.h>
20#include <asm/arch/gpio.h>
21
22
23/* Many OMAP development platforms reuse the same "debug board"; these
24 * platforms include H2, H3, H4, and Perseus2.
25 */
26
27static struct resource smc91x_resources[] = {
28 [0] = {
29 .flags = IORESOURCE_MEM,
30 },
31 [1] = {
32 .flags = IORESOURCE_IRQ,
33 },
34};
35
36static struct platform_device smc91x_device = {
37 .name = "smc91x",
38 .id = -1,
39 .num_resources = ARRAY_SIZE(smc91x_resources),
40 .resource = smc91x_resources,
41};
42
43static struct resource led_resources[] = {
44 [0] = {
45 .flags = IORESOURCE_MEM,
46 },
47};
48
49static struct platform_device led_device = {
50 .name = "omap_dbg_led",
51 .id = -1,
52 .num_resources = ARRAY_SIZE(led_resources),
53 .resource = led_resources,
54};
55
56static struct platform_device *debug_devices[] __initdata = {
57 &smc91x_device,
58 &led_device,
59 /* ps2 kbd + mouse ports */
60 /* 4 extra uarts */
61 /* 6 input dip switches */
62 /* 8 output pins */
63};
64
65int __init debug_card_init(u32 addr, unsigned gpio)
66{
67 int status;
68
69 smc91x_resources[0].start = addr + 0x300;
70 smc91x_resources[0].end = addr + 0x30f;
71
72 smc91x_resources[1].start = OMAP_GPIO_IRQ(gpio);
73 smc91x_resources[1].end = OMAP_GPIO_IRQ(gpio);
74
75 status = omap_request_gpio(gpio);
76 if (status < 0) {
77 printk(KERN_ERR "GPIO%d unavailable for smc91x IRQ\n", gpio);
78 return status;
79 }
80 omap_set_gpio_direction(gpio, 1);
81
82 led_resources[0].start = addr;
83 led_resources[0].end = addr + SZ_4K - 1;
84
85 return platform_add_devices(debug_devices, ARRAY_SIZE(debug_devices));
86}
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 88d5b6d9f950..05a38498cbe0 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -1347,11 +1347,6 @@ void omap_stop_lcd_dma(void)
1347 omap_writew(w, OMAP1610_DMA_LCD_CTRL); 1347 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
1348} 1348}
1349 1349
1350int omap_lcd_dma_ext_running(void)
1351{
1352 return lcd_dma.ext_ctrl && lcd_dma.active;
1353}
1354
1355/*----------------------------------------------------------------------------*/ 1350/*----------------------------------------------------------------------------*/
1356 1351
1357static int __init omap_init_dma(void) 1352static int __init omap_init_dma(void)
@@ -1493,7 +1488,6 @@ EXPORT_SYMBOL(omap_free_lcd_dma);
1493EXPORT_SYMBOL(omap_enable_lcd_dma); 1488EXPORT_SYMBOL(omap_enable_lcd_dma);
1494EXPORT_SYMBOL(omap_setup_lcd_dma); 1489EXPORT_SYMBOL(omap_setup_lcd_dma);
1495EXPORT_SYMBOL(omap_stop_lcd_dma); 1490EXPORT_SYMBOL(omap_stop_lcd_dma);
1496EXPORT_SYMBOL(omap_lcd_dma_ext_running);
1497EXPORT_SYMBOL(omap_set_lcd_dma_b1); 1491EXPORT_SYMBOL(omap_set_lcd_dma_b1);
1498EXPORT_SYMBOL(omap_set_lcd_dma_single_transfer); 1492EXPORT_SYMBOL(omap_set_lcd_dma_single_transfer);
1499EXPORT_SYMBOL(omap_set_lcd_dma_ext_controller); 1493EXPORT_SYMBOL(omap_set_lcd_dma_ext_controller);
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index 6d048490c559..992ca435a922 100644
--- a/arch/arm/plat-s3c24xx/dma.c
+++ b/arch/arm/plat-s3c24xx/dma.c
@@ -1372,7 +1372,7 @@ int __init s3c24xx_dma_init(unsigned int channels, unsigned int irq,
1372 return ret; 1372 return ret;
1373} 1373}
1374 1374
1375int s3c2410_dma_init(void) 1375int __init s3c2410_dma_init(void)
1376{ 1376{
1377 return s3c24xx_dma_init(4, IRQ_DMA0, 0x40); 1377 return s3c24xx_dma_init(4, IRQ_DMA0, 0x40);
1378} 1378}
diff --git a/arch/arm/plat-s3c24xx/sleep.S b/arch/arm/plat-s3c24xx/sleep.S
index d47113bbc34c..a646cbe8244c 100644
--- a/arch/arm/plat-s3c24xx/sleep.S
+++ b/arch/arm/plat-s3c24xx/sleep.S
@@ -96,6 +96,14 @@ resume_with_mmu:
96s3c2410_sleep_save_phys: 96s3c2410_sleep_save_phys:
97 .word 0 97 .word 0
98 98
99
100 /* sleep magic, to allow the bootloader to check for an valid
101 * image to resume to. Must be the first word before the
102 * s3c2410_cpu_resume entry.
103 */
104
105 .word 0x2bedf00d
106
99 /* s3c2410_cpu_resume 107 /* s3c2410_cpu_resume
100 * 108 *
101 * resume code entry for bootloader to call 109 * resume code entry for bootloader to call
diff --git a/arch/avr32/kernel/kprobes.c b/arch/avr32/kernel/kprobes.c
index 4942ee662e0b..20b1c9d8f945 100644
--- a/arch/avr32/kernel/kprobes.c
+++ b/arch/avr32/kernel/kprobes.c
@@ -22,6 +22,8 @@ DEFINE_PER_CPU(struct kprobe *, current_kprobe);
22static unsigned long kprobe_status; 22static unsigned long kprobe_status;
23static struct pt_regs jprobe_saved_regs; 23static struct pt_regs jprobe_saved_regs;
24 24
25struct kretprobe_blackpoint kretprobe_blacklist[] = {{NULL, NULL}};
26
25int __kprobes arch_prepare_kprobe(struct kprobe *p) 27int __kprobes arch_prepare_kprobe(struct kprobe *p)
26{ 28{
27 int ret = 0; 29 int ret = 0;
diff --git a/arch/avr32/kernel/ptrace.c b/arch/avr32/kernel/ptrace.c
index 39060cbeb2a3..9e16b8a447f2 100644
--- a/arch/avr32/kernel/ptrace.c
+++ b/arch/avr32/kernel/ptrace.c
@@ -227,11 +227,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
227 ret = 0; 227 ret = 0;
228 break; 228 break;
229 229
230 /* Detach a process that was attached */
231 case PTRACE_DETACH:
232 ret = ptrace_detach(child, data);
233 break;
234
235 case PTRACE_GETREGS: 230 case PTRACE_GETREGS:
236 ret = ptrace_getregs(child, (void __user *)data); 231 ret = ptrace_getregs(child, (void __user *)data);
237 break; 232 break;
diff --git a/arch/avr32/mm/fault.c b/arch/avr32/mm/fault.c
index ae2d2c593b2b..11472f8701bd 100644
--- a/arch/avr32/mm/fault.c
+++ b/arch/avr32/mm/fault.c
@@ -216,7 +216,7 @@ out_of_memory:
216 } 216 }
217 printk("VM: Killing process %s\n", tsk->comm); 217 printk("VM: Killing process %s\n", tsk->comm);
218 if (user_mode(regs)) 218 if (user_mode(regs))
219 do_exit(SIGKILL); 219 do_group_exit(SIGKILL);
220 goto no_context; 220 goto no_context;
221 221
222do_sigbus: 222do_sigbus:
diff --git a/arch/blackfin/kernel/ptrace.c b/arch/blackfin/kernel/ptrace.c
index 64ce5fea8609..85caf9b711a1 100644
--- a/arch/blackfin/kernel/ptrace.c
+++ b/arch/blackfin/kernel/ptrace.c
@@ -385,12 +385,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
385 break; 385 break;
386 } 386 }
387 387
388 case PTRACE_DETACH:
389 { /* detach a process that was attached. */
390 ret = ptrace_detach(child, data);
391 break;
392 }
393
394 case PTRACE_GETREGS: 388 case PTRACE_GETREGS:
395 { 389 {
396 390
diff --git a/arch/blackfin/mach-bf533/cpu.c b/arch/blackfin/mach-bf533/cpu.c
index 6fd9cfd0a31b..b7a0e0fbd9af 100644
--- a/arch/blackfin/mach-bf533/cpu.c
+++ b/arch/blackfin/mach-bf533/cpu.c
@@ -118,8 +118,6 @@ static int __init __bf533_cpu_init(struct cpufreq_policy *policy)
118 if (policy->cpu != 0) 118 if (policy->cpu != 0)
119 return -EINVAL; 119 return -EINVAL;
120 120
121 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
122
123 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; 121 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
124 /*Now ,only support one cpu */ 122 /*Now ,only support one cpu */
125 policy->cur = bf533_getfreq(0); 123 policy->cur = bf533_getfreq(0);
diff --git a/arch/blackfin/mach-bf537/boards/generic_board.c b/arch/blackfin/mach-bf537/boards/generic_board.c
index 5e9d09eb8579..6668c8e4a3fc 100644
--- a/arch/blackfin/mach-bf537/boards/generic_board.c
+++ b/arch/blackfin/mach-bf537/boards/generic_board.c
@@ -40,7 +40,7 @@
40#include <linux/pata_platform.h> 40#include <linux/pata_platform.h>
41#include <linux/irq.h> 41#include <linux/irq.h>
42#include <linux/interrupt.h> 42#include <linux/interrupt.h>
43#include <linux/usb_sl811.h> 43#include <linux/usb/sl811.h>
44#include <asm/dma.h> 44#include <asm/dma.h>
45#include <asm/bfin5xx_spi.h> 45#include <asm/bfin5xx_spi.h>
46#include <asm/reboot.h> 46#include <asm/reboot.h>
diff --git a/arch/blackfin/mach-bf537/boards/pnav10.c b/arch/blackfin/mach-bf537/boards/pnav10.c
index 20507e92a3a4..f83a2544004d 100644
--- a/arch/blackfin/mach-bf537/boards/pnav10.c
+++ b/arch/blackfin/mach-bf537/boards/pnav10.c
@@ -40,7 +40,7 @@
40#include <linux/irq.h> 40#include <linux/irq.h>
41#include <asm/dma.h> 41#include <asm/dma.h>
42#include <asm/bfin5xx_spi.h> 42#include <asm/bfin5xx_spi.h>
43#include <linux/usb_sl811.h> 43#include <linux/usb/sl811.h>
44 44
45#include <linux/spi/ad7877.h> 45#include <linux/spi/ad7877.h>
46 46
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index 47d7d4a0e73d..f42ba3aa86d7 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -40,7 +40,7 @@
40#include <linux/pata_platform.h> 40#include <linux/pata_platform.h>
41#include <linux/irq.h> 41#include <linux/irq.h>
42#include <linux/interrupt.h> 42#include <linux/interrupt.h>
43#include <linux/usb_sl811.h> 43#include <linux/usb/sl811.h>
44#include <asm/dma.h> 44#include <asm/dma.h>
45#include <asm/bfin5xx_spi.h> 45#include <asm/bfin5xx_spi.h>
46#include <asm/reboot.h> 46#include <asm/reboot.h>
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c
index 2c47db494f7d..046e6d84bbfc 100644
--- a/arch/blackfin/mach-bf548/boards/ezkit.c
+++ b/arch/blackfin/mach-bf548/boards/ezkit.c
@@ -88,7 +88,7 @@ static struct platform_device bf54x_lq043_device = {
88#endif 88#endif
89 89
90#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE) 90#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
91static int bf548_keymap[] = { 91static const unsigned int bf548_keymap[] = {
92 KEYVAL(0, 0, KEY_ENTER), 92 KEYVAL(0, 0, KEY_ENTER),
93 KEYVAL(0, 1, KEY_HELP), 93 KEYVAL(0, 1, KEY_HELP),
94 KEYVAL(0, 2, KEY_0), 94 KEYVAL(0, 2, KEY_0),
@@ -110,8 +110,8 @@ static int bf548_keymap[] = {
110static struct bfin_kpad_platform_data bf54x_kpad_data = { 110static struct bfin_kpad_platform_data bf54x_kpad_data = {
111 .rows = 4, 111 .rows = 4,
112 .cols = 4, 112 .cols = 4,
113 .keymap = bf548_keymap, 113 .keymap = bf548_keymap,
114 .keymapsize = ARRAY_SIZE(bf548_keymap), 114 .keymapsize = ARRAY_SIZE(bf548_keymap),
115 .repeat = 0, 115 .repeat = 0,
116 .debounce_time = 5000, /* ns (5ms) */ 116 .debounce_time = 5000, /* ns (5ms) */
117 .coldrive_time = 1000, /* ns (1ms) */ 117 .coldrive_time = 1000, /* ns (1ms) */
diff --git a/arch/cris/arch-v10/kernel/ptrace.c b/arch/cris/arch-v10/kernel/ptrace.c
index f4f9db698b44..b570ae9b6cad 100644
--- a/arch/cris/arch-v10/kernel/ptrace.c
+++ b/arch/cris/arch-v10/kernel/ptrace.c
@@ -177,10 +177,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
177 ret = 0; 177 ret = 0;
178 break; 178 break;
179 179
180 case PTRACE_DETACH:
181 ret = ptrace_detach(child, data);
182 break;
183
184 /* Get all GP registers from the child. */ 180 /* Get all GP registers from the child. */
185 case PTRACE_GETREGS: { 181 case PTRACE_GETREGS: {
186 int i; 182 int i;
diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c
index 077e973c33f0..575a14bb1106 100644
--- a/arch/cris/arch-v10/kernel/time.c
+++ b/arch/cris/arch-v10/kernel/time.c
@@ -254,8 +254,12 @@ timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
254 * it needs to be IRQF_DISABLED to make the jiffies update work properly 254 * it needs to be IRQF_DISABLED to make the jiffies update work properly
255 */ 255 */
256 256
257static struct irqaction irq2 = { timer_interrupt, IRQF_SHARED | IRQF_DISABLED, 257static struct irqaction irq2 = {
258 CPU_MASK_NONE, "timer", NULL, NULL}; 258 .handler = timer_interrupt,
259 .flags = IRQF_SHARED | IRQF_DISABLED,
260 .mask = CPU_MASK_NONE,
261 .name = "timer",
262};
259 263
260void __init 264void __init
261time_init(void) 265time_init(void)
diff --git a/arch/cris/arch-v32/kernel/ptrace.c b/arch/cris/arch-v32/kernel/ptrace.c
index 38ece0cd47cb..2df60529a8af 100644
--- a/arch/cris/arch-v32/kernel/ptrace.c
+++ b/arch/cris/arch-v32/kernel/ptrace.c
@@ -245,10 +245,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
245 break; 245 break;
246 246
247 } 247 }
248 case PTRACE_DETACH:
249 ret = ptrace_detach(child, data);
250 break;
251
252 /* Get all GP registers from the child. */ 248 /* Get all GP registers from the child. */
253 case PTRACE_GETREGS: { 249 case PTRACE_GETREGS: {
254 int i; 250 int i;
diff --git a/arch/cris/arch-v32/kernel/smp.c b/arch/cris/arch-v32/kernel/smp.c
index 77e655f26560..697494bc2de1 100644
--- a/arch/cris/arch-v32/kernel/smp.c
+++ b/arch/cris/arch-v32/kernel/smp.c
@@ -63,8 +63,12 @@ static unsigned long irq_regs[NR_CPUS] =
63 63
64static irqreturn_t crisv32_ipi_interrupt(int irq, void *dev_id, struct pt_regs *regs); 64static irqreturn_t crisv32_ipi_interrupt(int irq, void *dev_id, struct pt_regs *regs);
65static int send_ipi(int vector, int wait, cpumask_t cpu_mask); 65static int send_ipi(int vector, int wait, cpumask_t cpu_mask);
66static struct irqaction irq_ipi = { crisv32_ipi_interrupt, IRQF_DISABLED, 66static struct irqaction irq_ipi = {
67 CPU_MASK_NONE, "ipi", NULL, NULL}; 67 .handler = crisv32_ipi_interrupt,
68 .flags = IRQF_DISABLED,
69 .mask = CPU_MASK_NONE,
70 .name = "ipi",
71};
68 72
69extern void cris_mmu_init(void); 73extern void cris_mmu_init(void);
70extern void cris_timer_init(void); 74extern void cris_timer_init(void);
diff --git a/arch/cris/mm/fault.c b/arch/cris/mm/fault.c
index 8672ab7d7978..8aab81430695 100644
--- a/arch/cris/mm/fault.c
+++ b/arch/cris/mm/fault.c
@@ -360,7 +360,7 @@ do_page_fault(unsigned long address, struct pt_regs *regs,
360 up_read(&mm->mmap_sem); 360 up_read(&mm->mmap_sem);
361 printk("VM: killing process %s\n", tsk->comm); 361 printk("VM: killing process %s\n", tsk->comm);
362 if (user_mode(regs)) 362 if (user_mode(regs))
363 do_exit(SIGKILL); 363 do_group_exit(SIGKILL);
364 goto no_context; 364 goto no_context;
365 365
366 do_sigbus: 366 do_sigbus:
diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c
index ed588d73d7d8..e83e0bccfab9 100644
--- a/arch/frv/kernel/time.c
+++ b/arch/frv/kernel/time.c
@@ -43,7 +43,10 @@ unsigned long __delay_loops_MHz;
43static irqreturn_t timer_interrupt(int irq, void *dummy); 43static irqreturn_t timer_interrupt(int irq, void *dummy);
44 44
45static struct irqaction timer_irq = { 45static struct irqaction timer_irq = {
46 timer_interrupt, IRQF_DISABLED, CPU_MASK_NONE, "timer", NULL, NULL 46 .handler = timer_interrupt,
47 .flags = IRQF_DISABLED,
48 .mask = CPU_MASK_NONE,
49 .name = "timer",
47}; 50};
48 51
49static inline int set_rtc_mmss(unsigned long nowtime) 52static inline int set_rtc_mmss(unsigned long nowtime)
diff --git a/arch/frv/mm/fault.c b/arch/frv/mm/fault.c
index 6798fa0257b1..05093d41d98e 100644
--- a/arch/frv/mm/fault.c
+++ b/arch/frv/mm/fault.c
@@ -259,7 +259,7 @@ asmlinkage void do_page_fault(int datammu, unsigned long esr0, unsigned long ear
259 up_read(&mm->mmap_sem); 259 up_read(&mm->mmap_sem);
260 printk("VM: killing process %s\n", current->comm); 260 printk("VM: killing process %s\n", current->comm);
261 if (user_mode(__frame)) 261 if (user_mode(__frame))
262 do_exit(SIGKILL); 262 do_group_exit(SIGKILL);
263 goto no_context; 263 goto no_context;
264 264
265 do_sigbus: 265 do_sigbus:
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 2d85e4b87307..bf9aafad4978 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -214,6 +214,17 @@ config X86_ES7000
214 214
215endchoice 215endchoice
216 216
217config SCHED_NO_NO_OMIT_FRAME_POINTER
218 bool "Single-depth WCHAN output"
219 default y
220 help
221 Calculate simpler /proc/<PID>/wchan values. If this option
222 is disabled then wchan values will recurse back to the
223 caller function. This provides more accurate wchan values,
224 at the expense of slightly more scheduling overhead.
225
226 If in doubt, say "Y".
227
217config PARAVIRT 228config PARAVIRT
218 bool "Paravirtualization support (EXPERIMENTAL)" 229 bool "Paravirtualization support (EXPERIMENTAL)"
219 depends on EXPERIMENTAL 230 depends on EXPERIMENTAL
@@ -1137,6 +1148,11 @@ config PCI_MMCONFIG
1137 depends on PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY) 1148 depends on PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY)
1138 default y 1149 default y
1139 1150
1151config PCI_DOMAINS
1152 bool
1153 depends on PCI
1154 default y
1155
1140source "drivers/pci/pcie/Kconfig" 1156source "drivers/pci/pcie/Kconfig"
1141 1157
1142source "drivers/pci/Kconfig" 1158source "drivers/pci/Kconfig"
@@ -1206,6 +1222,16 @@ config SCx200HR_TIMER
1206 processor goes idle (as is done by the scheduler). The 1222 processor goes idle (as is done by the scheduler). The
1207 other workaround is idle=poll boot option. 1223 other workaround is idle=poll boot option.
1208 1224
1225config GEODE_MFGPT_TIMER
1226 bool "Geode Multi-Function General Purpose Timer (MFGPT) events"
1227 depends on MGEODE_LX && GENERIC_TIME && GENERIC_CLOCKEVENTS
1228 default y
1229 help
1230 This driver provides a clock event source based on the MFGPT
1231 timer(s) in the CS5535 and CS5536 companion chip for the geode.
1232 MFGPTs have a better resolution and max interval than the
1233 generic PIT, and are suitable for use as high-res timers.
1234
1209config K8_NB 1235config K8_NB
1210 def_bool y 1236 def_bool y
1211 depends on AGP_AMD64 1237 depends on AGP_AMD64
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 8c39913d1729..59b91ac861ac 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -54,6 +54,11 @@ config ARCH_HAS_ILOG2_U64
54 bool 54 bool
55 default n 55 default n
56 56
57config HUGETLB_PAGE_SIZE_VARIABLE
58 bool
59 depends on HUGETLB_PAGE
60 default y
61
57config GENERIC_FIND_NEXT_BIT 62config GENERIC_FIND_NEXT_BIT
58 bool 63 bool
59 default y 64 default y
@@ -300,6 +305,9 @@ config HOTPLUG_CPU
300config ARCH_ENABLE_MEMORY_HOTPLUG 305config ARCH_ENABLE_MEMORY_HOTPLUG
301 def_bool y 306 def_bool y
302 307
308config ARCH_ENABLE_MEMORY_HOTREMOVE
309 def_bool y
310
303config SCHED_SMT 311config SCHED_SMT
304 bool "SMT scheduler support" 312 bool "SMT scheduler support"
305 depends on SMP 313 depends on SMP
@@ -348,6 +356,7 @@ config ARCH_FLATMEM_ENABLE
348config ARCH_SPARSEMEM_ENABLE 356config ARCH_SPARSEMEM_ENABLE
349 def_bool y 357 def_bool y
350 depends on ARCH_DISCONTIGMEM_ENABLE 358 depends on ARCH_DISCONTIGMEM_ENABLE
359 select SPARSEMEM_VMEMMAP_ENABLE
351 360
352config ARCH_DISCONTIGMEM_DEFAULT 361config ARCH_DISCONTIGMEM_DEFAULT
353 def_bool y if (IA64_SGI_SN2 || IA64_GENERIC || IA64_HP_ZX1 || IA64_HP_ZX1_SWIOTLB) 362 def_bool y if (IA64_SGI_SN2 || IA64_GENERIC || IA64_HP_ZX1 || IA64_HP_ZX1_SWIOTLB)
@@ -461,6 +470,16 @@ config IA64_ESI
461 firmware extensions, such as the ability to inject memory-errors 470 firmware extensions, such as the ability to inject memory-errors
462 for test-purposes. If you're unsure, say N. 471 for test-purposes. If you're unsure, say N.
463 472
473config IA64_HP_AML_NFW
474 bool "Support ACPI AML calls to native firmware"
475 help
476 This driver installs a global ACPI Operation Region handler for
477 region 0xA1. AML methods can use this OpRegion to call arbitrary
478 native firmware functions. The driver installs the OpRegion
479 handler if there is an HPQ5001 device or if the user supplies
480 the "force" module parameter, e.g., with the "aml_nfw.force"
481 kernel command line option.
482
464source "drivers/sn/Kconfig" 483source "drivers/sn/Kconfig"
465 484
466config KEXEC 485config KEXEC
diff --git a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig
index 9aecfceeb38c..449d3e75bfc2 100644
--- a/arch/ia64/configs/sn2_defconfig
+++ b/arch/ia64/configs/sn2_defconfig
@@ -1,40 +1,40 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.19-rc1 3# Linux kernel version: 2.6.23-rc6
4# Mon Oct 9 10:53:59 2006 4# Tue Sep 18 11:24:01 2007
5# 5#
6CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 6CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
7 7
8# 8#
9# Code maturity level options 9# General setup
10# 10#
11CONFIG_EXPERIMENTAL=y 11CONFIG_EXPERIMENTAL=y
12CONFIG_LOCK_KERNEL=y 12CONFIG_LOCK_KERNEL=y
13CONFIG_INIT_ENV_ARG_LIMIT=32 13CONFIG_INIT_ENV_ARG_LIMIT=32
14
15#
16# General setup
17#
18CONFIG_LOCALVERSION="" 14CONFIG_LOCALVERSION=""
19# CONFIG_LOCALVERSION_AUTO is not set 15# CONFIG_LOCALVERSION_AUTO is not set
20CONFIG_SWAP=y 16CONFIG_SWAP=y
21CONFIG_SYSVIPC=y 17CONFIG_SYSVIPC=y
22# CONFIG_IPC_NS is not set 18CONFIG_SYSVIPC_SYSCTL=y
23CONFIG_POSIX_MQUEUE=y 19CONFIG_POSIX_MQUEUE=y
24# CONFIG_BSD_PROCESS_ACCT is not set 20# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_TASKSTATS=y 21CONFIG_TASKSTATS=y
26# CONFIG_TASK_DELAY_ACCT is not set 22# CONFIG_TASK_DELAY_ACCT is not set
27# CONFIG_UTS_NS is not set 23CONFIG_TASK_XACCT=y
24CONFIG_TASK_IO_ACCOUNTING=y
25# CONFIG_USER_NS is not set
28# CONFIG_AUDIT is not set 26# CONFIG_AUDIT is not set
29# CONFIG_IKCONFIG is not set 27# CONFIG_IKCONFIG is not set
28CONFIG_LOG_BUF_SHIFT=20
30CONFIG_CPUSETS=y 29CONFIG_CPUSETS=y
30CONFIG_SYSFS_DEPRECATED=y
31CONFIG_RELAY=y 31CONFIG_RELAY=y
32CONFIG_BLK_DEV_INITRD=y
32CONFIG_INITRAMFS_SOURCE="" 33CONFIG_INITRAMFS_SOURCE=""
33CONFIG_CC_OPTIMIZE_FOR_SIZE=y 34CONFIG_CC_OPTIMIZE_FOR_SIZE=y
34CONFIG_TASK_XACCT=y
35CONFIG_SYSCTL=y 35CONFIG_SYSCTL=y
36# CONFIG_EMBEDDED is not set 36# CONFIG_EMBEDDED is not set
37# CONFIG_SYSCTL_SYSCALL is not set 37CONFIG_SYSCTL_SYSCALL=y
38CONFIG_KALLSYMS=y 38CONFIG_KALLSYMS=y
39CONFIG_KALLSYMS_ALL=y 39CONFIG_KALLSYMS_ALL=y
40# CONFIG_KALLSYMS_EXTRA_PASS is not set 40# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -44,18 +44,20 @@ CONFIG_BUG=y
44CONFIG_ELF_CORE=y 44CONFIG_ELF_CORE=y
45CONFIG_BASE_FULL=y 45CONFIG_BASE_FULL=y
46CONFIG_FUTEX=y 46CONFIG_FUTEX=y
47CONFIG_ANON_INODES=y
47CONFIG_EPOLL=y 48CONFIG_EPOLL=y
49CONFIG_SIGNALFD=y
50CONFIG_TIMERFD=y
51CONFIG_EVENTFD=y
48CONFIG_SHMEM=y 52CONFIG_SHMEM=y
49CONFIG_SLUB=y
50CONFIG_VM_EVENT_COUNTERS=y 53CONFIG_VM_EVENT_COUNTERS=y
54CONFIG_SLUB_DEBUG=y
55# CONFIG_SLAB is not set
56CONFIG_SLUB=y
57# CONFIG_SLOB is not set
51CONFIG_RT_MUTEXES=y 58CONFIG_RT_MUTEXES=y
52# CONFIG_TINY_SHMEM is not set 59# CONFIG_TINY_SHMEM is not set
53CONFIG_BASE_SMALL=0 60CONFIG_BASE_SMALL=0
54# CONFIG_SLOB is not set
55
56#
57# Loadable module support
58#
59CONFIG_MODULES=y 61CONFIG_MODULES=y
60CONFIG_MODULE_UNLOAD=y 62CONFIG_MODULE_UNLOAD=y
61# CONFIG_MODULE_FORCE_UNLOAD is not set 63# CONFIG_MODULE_FORCE_UNLOAD is not set
@@ -63,12 +65,9 @@ CONFIG_MODULE_UNLOAD=y
63# CONFIG_MODULE_SRCVERSION_ALL is not set 65# CONFIG_MODULE_SRCVERSION_ALL is not set
64CONFIG_KMOD=y 66CONFIG_KMOD=y
65CONFIG_STOP_MACHINE=y 67CONFIG_STOP_MACHINE=y
66
67#
68# Block layer
69#
70CONFIG_BLOCK=y 68CONFIG_BLOCK=y
71# CONFIG_BLK_DEV_IO_TRACE is not set 69# CONFIG_BLK_DEV_IO_TRACE is not set
70CONFIG_BLK_DEV_BSG=y
72 71
73# 72#
74# IO Schedulers 73# IO Schedulers
@@ -88,12 +87,15 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
88# 87#
89CONFIG_IA64=y 88CONFIG_IA64=y
90CONFIG_64BIT=y 89CONFIG_64BIT=y
90CONFIG_QUICKLIST=y
91CONFIG_MMU=y 91CONFIG_MMU=y
92CONFIG_SWIOTLB=y
93CONFIG_RWSEM_XCHGADD_ALGORITHM=y 92CONFIG_RWSEM_XCHGADD_ALGORITHM=y
93# CONFIG_ARCH_HAS_ILOG2_U32 is not set
94# CONFIG_ARCH_HAS_ILOG2_U64 is not set
94CONFIG_GENERIC_FIND_NEXT_BIT=y 95CONFIG_GENERIC_FIND_NEXT_BIT=y
95CONFIG_GENERIC_CALIBRATE_DELAY=y 96CONFIG_GENERIC_CALIBRATE_DELAY=y
96CONFIG_GENERIC_TIME=y 97CONFIG_GENERIC_TIME=y
98CONFIG_GENERIC_TIME_VSYSCALL=y
97CONFIG_DMI=y 99CONFIG_DMI=y
98CONFIG_EFI=y 100CONFIG_EFI=y
99CONFIG_GENERIC_IOMAP=y 101CONFIG_GENERIC_IOMAP=y
@@ -116,6 +118,7 @@ CONFIG_IA64_PAGE_SIZE_16KB=y
116CONFIG_PGTABLE_4=y 118CONFIG_PGTABLE_4=y
117# CONFIG_HZ_100 is not set 119# CONFIG_HZ_100 is not set
118CONFIG_HZ_250=y 120CONFIG_HZ_250=y
121# CONFIG_HZ_300 is not set
119# CONFIG_HZ_1000 is not set 122# CONFIG_HZ_1000 is not set
120CONFIG_HZ=250 123CONFIG_HZ=250
121CONFIG_IA64_L1_CACHE_SHIFT=7 124CONFIG_IA64_L1_CACHE_SHIFT=7
@@ -128,7 +131,10 @@ CONFIG_NR_CPUS=1024
128# CONFIG_HOTPLUG_CPU is not set 131# CONFIG_HOTPLUG_CPU is not set
129CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 132CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
130CONFIG_SCHED_SMT=y 133CONFIG_SCHED_SMT=y
131CONFIG_PREEMPT=y 134CONFIG_PREEMPT_NONE=y
135# CONFIG_PREEMPT_VOLUNTARY is not set
136# CONFIG_PREEMPT is not set
137CONFIG_PREEMPT_BKL=y
132CONFIG_SELECT_MEMORY_MODEL=y 138CONFIG_SELECT_MEMORY_MODEL=y
133# CONFIG_FLATMEM_MANUAL is not set 139# CONFIG_FLATMEM_MANUAL is not set
134CONFIG_DISCONTIGMEM_MANUAL=y 140CONFIG_DISCONTIGMEM_MANUAL=y
@@ -140,6 +146,9 @@ CONFIG_NEED_MULTIPLE_NODES=y
140CONFIG_SPLIT_PTLOCK_CPUS=4 146CONFIG_SPLIT_PTLOCK_CPUS=4
141CONFIG_MIGRATION=y 147CONFIG_MIGRATION=y
142CONFIG_RESOURCES_64BIT=y 148CONFIG_RESOURCES_64BIT=y
149CONFIG_ZONE_DMA_FLAG=0
150CONFIG_NR_QUICK=1
151CONFIG_VIRT_TO_BUS=y
143CONFIG_ARCH_SELECT_MEMORY_MODEL=y 152CONFIG_ARCH_SELECT_MEMORY_MODEL=y
144CONFIG_ARCH_DISCONTIGMEM_ENABLE=y 153CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
145CONFIG_ARCH_FLATMEM_ENABLE=y 154CONFIG_ARCH_FLATMEM_ENABLE=y
@@ -154,16 +163,17 @@ CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
154CONFIG_HAVE_ARCH_NODEDATA_EXTENSION=y 163CONFIG_HAVE_ARCH_NODEDATA_EXTENSION=y
155CONFIG_IA32_SUPPORT=y 164CONFIG_IA32_SUPPORT=y
156CONFIG_COMPAT=y 165CONFIG_COMPAT=y
166CONFIG_COMPAT_FOR_U64_ALIGNMENT=y
157CONFIG_IA64_MCA_RECOVERY=y 167CONFIG_IA64_MCA_RECOVERY=y
158CONFIG_PERFMON=y 168CONFIG_PERFMON=y
159CONFIG_IA64_PALINFO=y 169CONFIG_IA64_PALINFO=y
170CONFIG_IA64_MC_ERR_INJECT=y
160CONFIG_SGI_SN=y 171CONFIG_SGI_SN=y
161# CONFIG_IA64_ESI is not set 172# CONFIG_IA64_ESI is not set
162 173
163# 174#
164# SN Devices 175# SN Devices
165# 176#
166CONFIG_SGI_IOC4=y
167CONFIG_SGI_IOC3=y 177CONFIG_SGI_IOC3=y
168 178
169# 179#
@@ -171,6 +181,7 @@ CONFIG_SGI_IOC3=y
171# 181#
172CONFIG_EFI_VARS=y 182CONFIG_EFI_VARS=y
173CONFIG_EFI_PCDP=y 183CONFIG_EFI_PCDP=y
184CONFIG_DMIID=y
174CONFIG_BINFMT_ELF=y 185CONFIG_BINFMT_ELF=y
175# CONFIG_BINFMT_MISC is not set 186# CONFIG_BINFMT_MISC is not set
176 187
@@ -180,12 +191,9 @@ CONFIG_BINFMT_ELF=y
180CONFIG_PM=y 191CONFIG_PM=y
181# CONFIG_PM_LEGACY is not set 192# CONFIG_PM_LEGACY is not set
182# CONFIG_PM_DEBUG is not set 193# CONFIG_PM_DEBUG is not set
183# CONFIG_PM_SYSFS_DEPRECATED is not set
184
185#
186# ACPI (Advanced Configuration and Power Interface) Support
187#
188CONFIG_ACPI=y 194CONFIG_ACPI=y
195# CONFIG_ACPI_PROCFS is not set
196CONFIG_ACPI_PROC_EVENT=y
189# CONFIG_ACPI_BUTTON is not set 197# CONFIG_ACPI_BUTTON is not set
190# CONFIG_ACPI_FAN is not set 198# CONFIG_ACPI_FAN is not set
191# CONFIG_ACPI_DOCK is not set 199# CONFIG_ACPI_DOCK is not set
@@ -208,17 +216,14 @@ CONFIG_ACPI_SYSTEM=y
208# 216#
209CONFIG_PCI=y 217CONFIG_PCI=y
210CONFIG_PCI_DOMAINS=y 218CONFIG_PCI_DOMAINS=y
219CONFIG_PCI_SYSCALL=y
211CONFIG_PCIEPORTBUS=y 220CONFIG_PCIEPORTBUS=y
212CONFIG_HOTPLUG_PCI_PCIE=y 221CONFIG_HOTPLUG_PCI_PCIE=y
213# CONFIG_HOTPLUG_PCI_PCIE_POLL_EVENT_MODE is not set 222# CONFIG_HOTPLUG_PCI_PCIE_POLL_EVENT_MODE is not set
214CONFIG_PCIEAER=y 223CONFIG_PCIEAER=y
224CONFIG_ARCH_SUPPORTS_MSI=y
215# CONFIG_PCI_MSI is not set 225# CONFIG_PCI_MSI is not set
216# CONFIG_PCI_MULTITHREAD_PROBE is not set
217# CONFIG_PCI_DEBUG is not set 226# CONFIG_PCI_DEBUG is not set
218
219#
220# PCI Hotplug Support
221#
222CONFIG_HOTPLUG_PCI=y 227CONFIG_HOTPLUG_PCI=y
223# CONFIG_HOTPLUG_PCI_FAKE is not set 228# CONFIG_HOTPLUG_PCI_FAKE is not set
224# CONFIG_HOTPLUG_PCI_ACPI is not set 229# CONFIG_HOTPLUG_PCI_ACPI is not set
@@ -239,13 +244,13 @@ CONFIG_NET=y
239# 244#
240# Networking options 245# Networking options
241# 246#
242# CONFIG_NETDEBUG is not set
243CONFIG_PACKET=y 247CONFIG_PACKET=y
244CONFIG_PACKET_MMAP=y 248CONFIG_PACKET_MMAP=y
245CONFIG_UNIX=y 249CONFIG_UNIX=y
246CONFIG_XFRM=y 250CONFIG_XFRM=y
247# CONFIG_XFRM_USER is not set 251# CONFIG_XFRM_USER is not set
248# CONFIG_XFRM_SUB_POLICY is not set 252# CONFIG_XFRM_SUB_POLICY is not set
253# CONFIG_XFRM_MIGRATE is not set
249# CONFIG_NET_KEY is not set 254# CONFIG_NET_KEY is not set
250CONFIG_INET=y 255CONFIG_INET=y
251CONFIG_IP_MULTICAST=y 256CONFIG_IP_MULTICAST=y
@@ -261,7 +266,7 @@ CONFIG_SYN_COOKIES=y
261# CONFIG_INET_ESP is not set 266# CONFIG_INET_ESP is not set
262# CONFIG_INET_IPCOMP is not set 267# CONFIG_INET_IPCOMP is not set
263# CONFIG_INET_XFRM_TUNNEL is not set 268# CONFIG_INET_XFRM_TUNNEL is not set
264# CONFIG_INET_TUNNEL is not set 269CONFIG_INET_TUNNEL=m
265CONFIG_INET_XFRM_MODE_TRANSPORT=y 270CONFIG_INET_XFRM_MODE_TRANSPORT=y
266CONFIG_INET_XFRM_MODE_TUNNEL=y 271CONFIG_INET_XFRM_MODE_TUNNEL=y
267CONFIG_INET_XFRM_MODE_BEET=y 272CONFIG_INET_XFRM_MODE_BEET=y
@@ -270,9 +275,11 @@ CONFIG_INET_TCP_DIAG=m
270# CONFIG_TCP_CONG_ADVANCED is not set 275# CONFIG_TCP_CONG_ADVANCED is not set
271CONFIG_TCP_CONG_CUBIC=y 276CONFIG_TCP_CONG_CUBIC=y
272CONFIG_DEFAULT_TCP_CONG="cubic" 277CONFIG_DEFAULT_TCP_CONG="cubic"
278# CONFIG_TCP_MD5SIG is not set
273CONFIG_IPV6=m 279CONFIG_IPV6=m
274# CONFIG_IPV6_PRIVACY is not set 280# CONFIG_IPV6_PRIVACY is not set
275# CONFIG_IPV6_ROUTER_PREF is not set 281# CONFIG_IPV6_ROUTER_PREF is not set
282# CONFIG_IPV6_OPTIMISTIC_DAD is not set
276# CONFIG_INET6_AH is not set 283# CONFIG_INET6_AH is not set
277# CONFIG_INET6_ESP is not set 284# CONFIG_INET6_ESP is not set
278# CONFIG_INET6_IPCOMP is not set 285# CONFIG_INET6_IPCOMP is not set
@@ -283,25 +290,13 @@ CONFIG_INET6_XFRM_MODE_TRANSPORT=m
283CONFIG_INET6_XFRM_MODE_TUNNEL=m 290CONFIG_INET6_XFRM_MODE_TUNNEL=m
284CONFIG_INET6_XFRM_MODE_BEET=m 291CONFIG_INET6_XFRM_MODE_BEET=m
285# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 292# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
293CONFIG_IPV6_SIT=m
286# CONFIG_IPV6_TUNNEL is not set 294# CONFIG_IPV6_TUNNEL is not set
287# CONFIG_IPV6_SUBTREES is not set
288# CONFIG_IPV6_MULTIPLE_TABLES is not set 295# CONFIG_IPV6_MULTIPLE_TABLES is not set
289# CONFIG_NETWORK_SECMARK is not set 296# CONFIG_NETWORK_SECMARK is not set
290# CONFIG_NETFILTER is not set 297# CONFIG_NETFILTER is not set
291
292#
293# DCCP Configuration (EXPERIMENTAL)
294#
295# CONFIG_IP_DCCP is not set 298# CONFIG_IP_DCCP is not set
296
297#
298# SCTP Configuration (EXPERIMENTAL)
299#
300# CONFIG_IP_SCTP is not set 299# CONFIG_IP_SCTP is not set
301
302#
303# TIPC Configuration (EXPERIMENTAL)
304#
305# CONFIG_TIPC is not set 300# CONFIG_TIPC is not set
306# CONFIG_ATM is not set 301# CONFIG_ATM is not set
307# CONFIG_BRIDGE is not set 302# CONFIG_BRIDGE is not set
@@ -327,7 +322,17 @@ CONFIG_INET6_XFRM_MODE_BEET=m
327# CONFIG_HAMRADIO is not set 322# CONFIG_HAMRADIO is not set
328# CONFIG_IRDA is not set 323# CONFIG_IRDA is not set
329# CONFIG_BT is not set 324# CONFIG_BT is not set
325# CONFIG_AF_RXRPC is not set
326
327#
328# Wireless
329#
330# CONFIG_CFG80211 is not set
331# CONFIG_WIRELESS_EXT is not set
332# CONFIG_MAC80211 is not set
330# CONFIG_IEEE80211 is not set 333# CONFIG_IEEE80211 is not set
334# CONFIG_RFKILL is not set
335# CONFIG_NET_9P is not set
331 336
332# 337#
333# Device Drivers 338# Device Drivers
@@ -340,31 +345,19 @@ CONFIG_STANDALONE=y
340CONFIG_PREVENT_FIRMWARE_BUILD=y 345CONFIG_PREVENT_FIRMWARE_BUILD=y
341CONFIG_FW_LOADER=y 346CONFIG_FW_LOADER=y
342# CONFIG_DEBUG_DRIVER is not set 347# CONFIG_DEBUG_DRIVER is not set
348# CONFIG_DEBUG_DEVRES is not set
343# CONFIG_SYS_HYPERVISOR is not set 349# CONFIG_SYS_HYPERVISOR is not set
344
345#
346# Connector - unified userspace <-> kernelspace linker
347#
348# CONFIG_CONNECTOR is not set 350# CONFIG_CONNECTOR is not set
349
350#
351# Memory Technology Devices (MTD)
352#
353# CONFIG_MTD is not set 351# CONFIG_MTD is not set
354
355#
356# Parallel port support
357#
358# CONFIG_PARPORT is not set 352# CONFIG_PARPORT is not set
353CONFIG_PNP=y
354# CONFIG_PNP_DEBUG is not set
359 355
360# 356#
361# Plug and Play support 357# Protocols
362#
363# CONFIG_PNP is not set
364
365#
366# Block devices
367# 358#
359CONFIG_PNPACPI=y
360CONFIG_BLK_DEV=y
368# CONFIG_BLK_CPQ_DA is not set 361# CONFIG_BLK_CPQ_DA is not set
369# CONFIG_BLK_CPQ_CISS_DA is not set 362# CONFIG_BLK_CPQ_CISS_DA is not set
370# CONFIG_BLK_DEV_DAC960 is not set 363# CONFIG_BLK_DEV_DAC960 is not set
@@ -379,13 +372,13 @@ CONFIG_BLK_DEV_RAM=y
379CONFIG_BLK_DEV_RAM_COUNT=16 372CONFIG_BLK_DEV_RAM_COUNT=16
380CONFIG_BLK_DEV_RAM_SIZE=4096 373CONFIG_BLK_DEV_RAM_SIZE=4096
381CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 374CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
382CONFIG_BLK_DEV_INITRD=y
383# CONFIG_CDROM_PKTCDVD is not set 375# CONFIG_CDROM_PKTCDVD is not set
384CONFIG_ATA_OVER_ETH=m 376CONFIG_ATA_OVER_ETH=m
385 377CONFIG_MISC_DEVICES=y
386# 378# CONFIG_PHANTOM is not set
387# ATA/ATAPI/MFM/RLL support 379# CONFIG_EEPROM_93CX6 is not set
388# 380CONFIG_SGI_IOC4=y
381# CONFIG_TIFM_CORE is not set
389CONFIG_IDE=y 382CONFIG_IDE=y
390CONFIG_IDE_MAX_HWIFS=4 383CONFIG_IDE_MAX_HWIFS=4
391CONFIG_BLK_DEV_IDE=y 384CONFIG_BLK_DEV_IDE=y
@@ -400,20 +393,23 @@ CONFIG_BLK_DEV_IDECD=y
400# CONFIG_BLK_DEV_IDETAPE is not set 393# CONFIG_BLK_DEV_IDETAPE is not set
401# CONFIG_BLK_DEV_IDEFLOPPY is not set 394# CONFIG_BLK_DEV_IDEFLOPPY is not set
402# CONFIG_BLK_DEV_IDESCSI is not set 395# CONFIG_BLK_DEV_IDESCSI is not set
396# CONFIG_BLK_DEV_IDEACPI is not set
403# CONFIG_IDE_TASK_IOCTL is not set 397# CONFIG_IDE_TASK_IOCTL is not set
398CONFIG_IDE_PROC_FS=y
404 399
405# 400#
406# IDE chipset support/bugfixes 401# IDE chipset support/bugfixes
407# 402#
408CONFIG_IDE_GENERIC=y 403CONFIG_IDE_GENERIC=y
404# CONFIG_BLK_DEV_IDEPNP is not set
409CONFIG_BLK_DEV_IDEPCI=y 405CONFIG_BLK_DEV_IDEPCI=y
410CONFIG_IDEPCI_SHARE_IRQ=y 406CONFIG_IDEPCI_SHARE_IRQ=y
407CONFIG_IDEPCI_PCIBUS_ORDER=y
411# CONFIG_BLK_DEV_OFFBOARD is not set 408# CONFIG_BLK_DEV_OFFBOARD is not set
412# CONFIG_BLK_DEV_GENERIC is not set 409# CONFIG_BLK_DEV_GENERIC is not set
413# CONFIG_BLK_DEV_OPTI621 is not set 410# CONFIG_BLK_DEV_OPTI621 is not set
414CONFIG_BLK_DEV_IDEDMA_PCI=y 411CONFIG_BLK_DEV_IDEDMA_PCI=y
415# CONFIG_BLK_DEV_IDEDMA_FORCED is not set 412# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
416CONFIG_IDEDMA_PCI_AUTO=y
417# CONFIG_IDEDMA_ONLYDISK is not set 413# CONFIG_IDEDMA_ONLYDISK is not set
418# CONFIG_BLK_DEV_AEC62XX is not set 414# CONFIG_BLK_DEV_AEC62XX is not set
419# CONFIG_BLK_DEV_ALI15X3 is not set 415# CONFIG_BLK_DEV_ALI15X3 is not set
@@ -428,6 +424,7 @@ CONFIG_IDEDMA_PCI_AUTO=y
428# CONFIG_BLK_DEV_JMICRON is not set 424# CONFIG_BLK_DEV_JMICRON is not set
429# CONFIG_BLK_DEV_SC1200 is not set 425# CONFIG_BLK_DEV_SC1200 is not set
430# CONFIG_BLK_DEV_PIIX is not set 426# CONFIG_BLK_DEV_PIIX is not set
427# CONFIG_BLK_DEV_IT8213 is not set
431# CONFIG_BLK_DEV_IT821X is not set 428# CONFIG_BLK_DEV_IT821X is not set
432# CONFIG_BLK_DEV_NS87415 is not set 429# CONFIG_BLK_DEV_NS87415 is not set
433# CONFIG_BLK_DEV_PDC202XX_OLD is not set 430# CONFIG_BLK_DEV_PDC202XX_OLD is not set
@@ -438,10 +435,10 @@ CONFIG_BLK_DEV_SGIIOC4=y
438# CONFIG_BLK_DEV_SLC90E66 is not set 435# CONFIG_BLK_DEV_SLC90E66 is not set
439# CONFIG_BLK_DEV_TRM290 is not set 436# CONFIG_BLK_DEV_TRM290 is not set
440# CONFIG_BLK_DEV_VIA82CXXX is not set 437# CONFIG_BLK_DEV_VIA82CXXX is not set
438# CONFIG_BLK_DEV_TC86C001 is not set
441# CONFIG_IDE_ARM is not set 439# CONFIG_IDE_ARM is not set
442CONFIG_BLK_DEV_IDEDMA=y 440CONFIG_BLK_DEV_IDEDMA=y
443# CONFIG_IDEDMA_IVB is not set 441# CONFIG_IDEDMA_IVB is not set
444CONFIG_IDEDMA_AUTO=y
445# CONFIG_BLK_DEV_HD is not set 442# CONFIG_BLK_DEV_HD is not set
446 443
447# 444#
@@ -449,6 +446,8 @@ CONFIG_IDEDMA_AUTO=y
449# 446#
450# CONFIG_RAID_ATTRS is not set 447# CONFIG_RAID_ATTRS is not set
451CONFIG_SCSI=y 448CONFIG_SCSI=y
449CONFIG_SCSI_DMA=y
450# CONFIG_SCSI_TGT is not set
452CONFIG_SCSI_NETLINK=y 451CONFIG_SCSI_NETLINK=y
453CONFIG_SCSI_PROC_FS=y 452CONFIG_SCSI_PROC_FS=y
454 453
@@ -469,6 +468,8 @@ CONFIG_CHR_DEV_SCH=m
469# CONFIG_SCSI_MULTI_LUN is not set 468# CONFIG_SCSI_MULTI_LUN is not set
470CONFIG_SCSI_CONSTANTS=y 469CONFIG_SCSI_CONSTANTS=y
471# CONFIG_SCSI_LOGGING is not set 470# CONFIG_SCSI_LOGGING is not set
471# CONFIG_SCSI_SCAN_ASYNC is not set
472CONFIG_SCSI_WAIT_SCAN=m
472 473
473# 474#
474# SCSI Transports 475# SCSI Transports
@@ -478,11 +479,9 @@ CONFIG_SCSI_FC_ATTRS=y
478CONFIG_SCSI_ISCSI_ATTRS=m 479CONFIG_SCSI_ISCSI_ATTRS=m
479CONFIG_SCSI_SAS_ATTRS=y 480CONFIG_SCSI_SAS_ATTRS=y
480CONFIG_SCSI_SAS_LIBSAS=y 481CONFIG_SCSI_SAS_LIBSAS=y
482# CONFIG_SCSI_SAS_ATA is not set
481# CONFIG_SCSI_SAS_LIBSAS_DEBUG is not set 483# CONFIG_SCSI_SAS_LIBSAS_DEBUG is not set
482 484CONFIG_SCSI_LOWLEVEL=y
483#
484# SCSI low-level drivers
485#
486CONFIG_ISCSI_TCP=m 485CONFIG_ISCSI_TCP=m
487# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 486# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
488# CONFIG_SCSI_3W_9XXX is not set 487# CONFIG_SCSI_3W_9XXX is not set
@@ -512,11 +511,10 @@ CONFIG_SCSI_QLA_FC=y
512# CONFIG_SCSI_DC395x is not set 511# CONFIG_SCSI_DC395x is not set
513# CONFIG_SCSI_DC390T is not set 512# CONFIG_SCSI_DC390T is not set
514# CONFIG_SCSI_DEBUG is not set 513# CONFIG_SCSI_DEBUG is not set
515 514# CONFIG_SCSI_SRP is not set
516#
517# Serial ATA (prod) and Parallel ATA (experimental) drivers
518#
519CONFIG_ATA=y 515CONFIG_ATA=y
516CONFIG_ATA_NONSTANDARD=y
517CONFIG_ATA_ACPI=y
520# CONFIG_SATA_AHCI is not set 518# CONFIG_SATA_AHCI is not set
521# CONFIG_SATA_SVW is not set 519# CONFIG_SATA_SVW is not set
522# CONFIG_ATA_PIIX is not set 520# CONFIG_ATA_PIIX is not set
@@ -532,10 +530,12 @@ CONFIG_ATA=y
532# CONFIG_SATA_ULI is not set 530# CONFIG_SATA_ULI is not set
533# CONFIG_SATA_VIA is not set 531# CONFIG_SATA_VIA is not set
534CONFIG_SATA_VITESSE=y 532CONFIG_SATA_VITESSE=y
533# CONFIG_SATA_INIC162X is not set
535# CONFIG_PATA_ALI is not set 534# CONFIG_PATA_ALI is not set
536# CONFIG_PATA_AMD is not set 535# CONFIG_PATA_AMD is not set
537# CONFIG_PATA_ARTOP is not set 536# CONFIG_PATA_ARTOP is not set
538# CONFIG_PATA_ATIIXP is not set 537# CONFIG_PATA_ATIIXP is not set
538# CONFIG_PATA_CMD640_PCI is not set
539# CONFIG_PATA_CMD64X is not set 539# CONFIG_PATA_CMD64X is not set
540# CONFIG_PATA_CS5520 is not set 540# CONFIG_PATA_CS5520 is not set
541# CONFIG_PATA_CS5530 is not set 541# CONFIG_PATA_CS5530 is not set
@@ -547,8 +547,10 @@ CONFIG_SATA_VITESSE=y
547# CONFIG_PATA_HPT3X2N is not set 547# CONFIG_PATA_HPT3X2N is not set
548# CONFIG_PATA_HPT3X3 is not set 548# CONFIG_PATA_HPT3X3 is not set
549# CONFIG_PATA_IT821X is not set 549# CONFIG_PATA_IT821X is not set
550# CONFIG_PATA_IT8213 is not set
550# CONFIG_PATA_JMICRON is not set 551# CONFIG_PATA_JMICRON is not set
551# CONFIG_PATA_TRIFLEX is not set 552# CONFIG_PATA_TRIFLEX is not set
553# CONFIG_PATA_MARVELL is not set
552# CONFIG_PATA_MPIIX is not set 554# CONFIG_PATA_MPIIX is not set
553# CONFIG_PATA_OLDPIIX is not set 555# CONFIG_PATA_OLDPIIX is not set
554# CONFIG_PATA_NETCELL is not set 556# CONFIG_PATA_NETCELL is not set
@@ -565,10 +567,6 @@ CONFIG_SATA_VITESSE=y
565# CONFIG_PATA_SIS is not set 567# CONFIG_PATA_SIS is not set
566# CONFIG_PATA_VIA is not set 568# CONFIG_PATA_VIA is not set
567# CONFIG_PATA_WINBOND is not set 569# CONFIG_PATA_WINBOND is not set
568
569#
570# Multi-device support (RAID and LVM)
571#
572CONFIG_MD=y 570CONFIG_MD=y
573CONFIG_BLK_DEV_MD=y 571CONFIG_BLK_DEV_MD=y
574CONFIG_MD_LINEAR=y 572CONFIG_MD_LINEAR=y
@@ -587,6 +585,8 @@ CONFIG_DM_MIRROR=m
587CONFIG_DM_ZERO=m 585CONFIG_DM_ZERO=m
588CONFIG_DM_MULTIPATH=m 586CONFIG_DM_MULTIPATH=m
589CONFIG_DM_MULTIPATH_EMC=m 587CONFIG_DM_MULTIPATH_EMC=m
588# CONFIG_DM_MULTIPATH_RDAC is not set
589# CONFIG_DM_DELAY is not set
590 590
591# 591#
592# Fusion MPT device support 592# Fusion MPT device support
@@ -597,43 +597,25 @@ CONFIG_FUSION_FC=y
597CONFIG_FUSION_SAS=y 597CONFIG_FUSION_SAS=y
598CONFIG_FUSION_MAX_SGE=128 598CONFIG_FUSION_MAX_SGE=128
599CONFIG_FUSION_CTL=m 599CONFIG_FUSION_CTL=m
600CONFIG_FUSION_LOGGING=y
600 601
601# 602#
602# IEEE 1394 (FireWire) support 603# IEEE 1394 (FireWire) support
603# 604#
605# CONFIG_FIREWIRE is not set
604# CONFIG_IEEE1394 is not set 606# CONFIG_IEEE1394 is not set
605
606#
607# I2O device support
608#
609# CONFIG_I2O is not set 607# CONFIG_I2O is not set
610
611#
612# Network device support
613#
614CONFIG_NETDEVICES=y 608CONFIG_NETDEVICES=y
609# CONFIG_NETDEVICES_MULTIQUEUE is not set
615# CONFIG_DUMMY is not set 610# CONFIG_DUMMY is not set
616# CONFIG_BONDING is not set 611# CONFIG_BONDING is not set
612# CONFIG_MACVLAN is not set
617# CONFIG_EQUALIZER is not set 613# CONFIG_EQUALIZER is not set
618# CONFIG_TUN is not set 614# CONFIG_TUN is not set
619 615# CONFIG_NET_SB1000 is not set
620#
621# ARCnet devices
622#
623# CONFIG_ARCNET is not set 616# CONFIG_ARCNET is not set
624
625#
626# PHY device support
627#
628
629#
630# Ethernet (10 or 100Mbit)
631#
632# CONFIG_NET_ETHERNET is not set 617# CONFIG_NET_ETHERNET is not set
633 618CONFIG_NETDEV_1000=y
634#
635# Ethernet (1000 Mbit)
636#
637# CONFIG_ACENIC is not set 619# CONFIG_ACENIC is not set
638# CONFIG_DL2K is not set 620# CONFIG_DL2K is not set
639# CONFIG_E1000 is not set 621# CONFIG_E1000 is not set
@@ -645,32 +627,39 @@ CONFIG_NETDEVICES=y
645# CONFIG_SKGE is not set 627# CONFIG_SKGE is not set
646# CONFIG_SKY2 is not set 628# CONFIG_SKY2 is not set
647# CONFIG_SK98LIN is not set 629# CONFIG_SK98LIN is not set
630# CONFIG_VIA_VELOCITY is not set
648CONFIG_TIGON3=y 631CONFIG_TIGON3=y
649# CONFIG_BNX2 is not set 632# CONFIG_BNX2 is not set
650# CONFIG_QLA3XXX is not set 633# CONFIG_QLA3XXX is not set
651 634# CONFIG_ATL1 is not set
652# 635CONFIG_NETDEV_10000=y
653# Ethernet (10000 Mbit)
654#
655CONFIG_CHELSIO_T1=m 636CONFIG_CHELSIO_T1=m
637CONFIG_CHELSIO_T1_1G=y
638# CONFIG_CHELSIO_T1_NAPI is not set
639CONFIG_CHELSIO_T3=m
656# CONFIG_IXGB is not set 640# CONFIG_IXGB is not set
657CONFIG_S2IO=m 641CONFIG_S2IO=m
658# CONFIG_S2IO_NAPI is not set 642# CONFIG_S2IO_NAPI is not set
659# CONFIG_MYRI10GE is not set 643# CONFIG_MYRI10GE is not set
660 644# CONFIG_NETXEN_NIC is not set
661# 645# CONFIG_MLX4_CORE is not set
662# Token Ring devices
663#
664# CONFIG_TR is not set 646# CONFIG_TR is not set
665 647
666# 648#
667# Wireless LAN (non-hamradio) 649# Wireless LAN
668# 650#
669# CONFIG_NET_RADIO is not set 651# CONFIG_WLAN_PRE80211 is not set
652# CONFIG_WLAN_80211 is not set
670 653
671# 654#
672# Wan interfaces 655# USB Network Adapters
673# 656#
657# CONFIG_USB_CATC is not set
658# CONFIG_USB_KAWETH is not set
659# CONFIG_USB_PEGASUS is not set
660# CONFIG_USB_RTL8150 is not set
661# CONFIG_USB_USBNET_MII is not set
662# CONFIG_USB_USBNET is not set
674# CONFIG_WAN is not set 663# CONFIG_WAN is not set
675# CONFIG_FDDI is not set 664# CONFIG_FDDI is not set
676# CONFIG_HIPPI is not set 665# CONFIG_HIPPI is not set
@@ -680,18 +669,9 @@ CONFIG_S2IO=m
680# CONFIG_SHAPER is not set 669# CONFIG_SHAPER is not set
681CONFIG_NETCONSOLE=y 670CONFIG_NETCONSOLE=y
682CONFIG_NETPOLL=y 671CONFIG_NETPOLL=y
683# CONFIG_NETPOLL_RX is not set
684# CONFIG_NETPOLL_TRAP is not set 672# CONFIG_NETPOLL_TRAP is not set
685CONFIG_NET_POLL_CONTROLLER=y 673CONFIG_NET_POLL_CONTROLLER=y
686
687#
688# ISDN subsystem
689#
690# CONFIG_ISDN is not set 674# CONFIG_ISDN is not set
691
692#
693# Telephony Support
694#
695# CONFIG_PHONE is not set 675# CONFIG_PHONE is not set
696 676
697# 677#
@@ -699,6 +679,7 @@ CONFIG_NET_POLL_CONTROLLER=y
699# 679#
700CONFIG_INPUT=y 680CONFIG_INPUT=y
701# CONFIG_INPUT_FF_MEMLESS is not set 681# CONFIG_INPUT_FF_MEMLESS is not set
682# CONFIG_INPUT_POLLDEV is not set
702 683
703# 684#
704# Userland interfaces 685# Userland interfaces
@@ -718,6 +699,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
718# CONFIG_INPUT_KEYBOARD is not set 699# CONFIG_INPUT_KEYBOARD is not set
719# CONFIG_INPUT_MOUSE is not set 700# CONFIG_INPUT_MOUSE is not set
720# CONFIG_INPUT_JOYSTICK is not set 701# CONFIG_INPUT_JOYSTICK is not set
702# CONFIG_INPUT_TABLET is not set
721# CONFIG_INPUT_TOUCHSCREEN is not set 703# CONFIG_INPUT_TOUCHSCREEN is not set
722# CONFIG_INPUT_MISC is not set 704# CONFIG_INPUT_MISC is not set
723 705
@@ -741,6 +723,7 @@ CONFIG_SERIAL_NONSTANDARD=y
741# CONFIG_DIGIEPCA is not set 723# CONFIG_DIGIEPCA is not set
742# CONFIG_MOXA_INTELLIO is not set 724# CONFIG_MOXA_INTELLIO is not set
743# CONFIG_MOXA_SMARTIO is not set 725# CONFIG_MOXA_SMARTIO is not set
726# CONFIG_MOXA_SMARTIO_NEW is not set
744# CONFIG_ISI is not set 727# CONFIG_ISI is not set
745# CONFIG_SYNCLINKMP is not set 728# CONFIG_SYNCLINKMP is not set
746# CONFIG_SYNCLINK_GT is not set 729# CONFIG_SYNCLINK_GT is not set
@@ -752,7 +735,6 @@ CONFIG_SERIAL_NONSTANDARD=y
752CONFIG_SGI_SNSC=y 735CONFIG_SGI_SNSC=y
753CONFIG_SGI_TIOCX=y 736CONFIG_SGI_TIOCX=y
754CONFIG_SGI_MBCS=m 737CONFIG_SGI_MBCS=m
755CONFIG_MSPEC=y
756 738
757# 739#
758# Serial drivers 740# Serial drivers
@@ -771,28 +753,13 @@ CONFIG_SERIAL_SGI_IOC3=y
771CONFIG_UNIX98_PTYS=y 753CONFIG_UNIX98_PTYS=y
772CONFIG_LEGACY_PTYS=y 754CONFIG_LEGACY_PTYS=y
773CONFIG_LEGACY_PTY_COUNT=256 755CONFIG_LEGACY_PTY_COUNT=256
774
775#
776# IPMI
777#
778# CONFIG_IPMI_HANDLER is not set 756# CONFIG_IPMI_HANDLER is not set
779
780#
781# Watchdog Cards
782#
783# CONFIG_WATCHDOG is not set 757# CONFIG_WATCHDOG is not set
784# CONFIG_HW_RANDOM is not set 758# CONFIG_HW_RANDOM is not set
785CONFIG_EFI_RTC=y 759CONFIG_EFI_RTC=y
786# CONFIG_DTLK is not set
787# CONFIG_R3964 is not set 760# CONFIG_R3964 is not set
788# CONFIG_APPLICOM is not set 761# CONFIG_APPLICOM is not set
789
790#
791# Ftape, the floppy tape device driver
792#
793CONFIG_AGP=y 762CONFIG_AGP=y
794# CONFIG_AGP_SIS is not set
795# CONFIG_AGP_VIA is not set
796CONFIG_AGP_SGI_TIOCA=y 763CONFIG_AGP_SGI_TIOCA=y
797# CONFIG_DRM is not set 764# CONFIG_DRM is not set
798CONFIG_RAW_DRIVER=m 765CONFIG_RAW_DRIVER=m
@@ -800,16 +767,8 @@ CONFIG_MAX_RAW_DEVS=256
800# CONFIG_HPET is not set 767# CONFIG_HPET is not set
801# CONFIG_HANGCHECK_TIMER is not set 768# CONFIG_HANGCHECK_TIMER is not set
802CONFIG_MMTIMER=y 769CONFIG_MMTIMER=y
803
804#
805# TPM devices
806#
807# CONFIG_TCG_TPM is not set 770# CONFIG_TCG_TPM is not set
808# CONFIG_TELCLOCK is not set 771CONFIG_DEVPORT=y
809
810#
811# I2C support
812#
813# CONFIG_I2C is not set 772# CONFIG_I2C is not set
814 773
815# 774#
@@ -817,37 +776,33 @@ CONFIG_MMTIMER=y
817# 776#
818# CONFIG_SPI is not set 777# CONFIG_SPI is not set
819# CONFIG_SPI_MASTER is not set 778# CONFIG_SPI_MASTER is not set
820 779# CONFIG_W1 is not set
821# 780# CONFIG_POWER_SUPPLY is not set
822# Dallas's 1-wire bus
823#
824
825#
826# Hardware Monitoring support
827#
828# CONFIG_HWMON is not set 781# CONFIG_HWMON is not set
829# CONFIG_HWMON_VID is not set
830 782
831# 783#
832# Misc devices 784# Multifunction device drivers
833# 785#
834# CONFIG_TIFM_CORE is not set 786# CONFIG_MFD_SM501 is not set
835 787
836# 788#
837# Multimedia devices 789# Multimedia devices
838# 790#
839# CONFIG_VIDEO_DEV is not set 791# CONFIG_VIDEO_DEV is not set
792# CONFIG_DVB_CORE is not set
793# CONFIG_DAB is not set
840 794
841# 795#
842# Digital Video Broadcasting Devices 796# Graphics support
843# 797#
844# CONFIG_DVB is not set 798# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
845# CONFIG_USB_DABUSB is not set
846 799
847# 800#
848# Graphics support 801# Display device support
849# 802#
850CONFIG_FIRMWARE_EDID=y 803# CONFIG_DISPLAY_SUPPORT is not set
804# CONFIG_VGASTATE is not set
805CONFIG_VIDEO_OUTPUT_CONTROL=m
851# CONFIG_FB is not set 806# CONFIG_FB is not set
852 807
853# 808#
@@ -856,16 +811,29 @@ CONFIG_FIRMWARE_EDID=y
856CONFIG_VGA_CONSOLE=y 811CONFIG_VGA_CONSOLE=y
857# CONFIG_VGACON_SOFT_SCROLLBACK is not set 812# CONFIG_VGACON_SOFT_SCROLLBACK is not set
858CONFIG_DUMMY_CONSOLE=y 813CONFIG_DUMMY_CONSOLE=y
859# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
860 814
861# 815#
862# Sound 816# Sound
863# 817#
864# CONFIG_SOUND is not set 818# CONFIG_SOUND is not set
819CONFIG_HID_SUPPORT=y
820CONFIG_HID=y
821CONFIG_HID_DEBUG=y
865 822
866# 823#
867# USB support 824# USB Input Devices
825#
826CONFIG_USB_HID=m
827# CONFIG_USB_HIDINPUT_POWERBOOK is not set
828# CONFIG_HID_FF is not set
829# CONFIG_USB_HIDDEV is not set
830
831#
832# USB HID Boot Protocol drivers
868# 833#
834# CONFIG_USB_KBD is not set
835# CONFIG_USB_MOUSE is not set
836CONFIG_USB_SUPPORT=y
869CONFIG_USB_ARCH_HAS_HCD=y 837CONFIG_USB_ARCH_HAS_HCD=y
870CONFIG_USB_ARCH_HAS_OHCI=y 838CONFIG_USB_ARCH_HAS_OHCI=y
871CONFIG_USB_ARCH_HAS_EHCI=y 839CONFIG_USB_ARCH_HAS_EHCI=y
@@ -876,9 +844,10 @@ CONFIG_USB=m
876# Miscellaneous USB options 844# Miscellaneous USB options
877# 845#
878# CONFIG_USB_DEVICEFS is not set 846# CONFIG_USB_DEVICEFS is not set
879# CONFIG_USB_BANDWIDTH is not set 847CONFIG_USB_DEVICE_CLASS=y
880# CONFIG_USB_DYNAMIC_MINORS is not set 848# CONFIG_USB_DYNAMIC_MINORS is not set
881# CONFIG_USB_SUSPEND is not set 849# CONFIG_USB_SUSPEND is not set
850# CONFIG_USB_PERSIST is not set
882# CONFIG_USB_OTG is not set 851# CONFIG_USB_OTG is not set
883 852
884# 853#
@@ -890,10 +859,12 @@ CONFIG_USB_EHCI_HCD=m
890# CONFIG_USB_EHCI_TT_NEWSCHED is not set 859# CONFIG_USB_EHCI_TT_NEWSCHED is not set
891# CONFIG_USB_ISP116X_HCD is not set 860# CONFIG_USB_ISP116X_HCD is not set
892CONFIG_USB_OHCI_HCD=m 861CONFIG_USB_OHCI_HCD=m
893# CONFIG_USB_OHCI_BIG_ENDIAN is not set 862# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
863# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
894CONFIG_USB_OHCI_LITTLE_ENDIAN=y 864CONFIG_USB_OHCI_LITTLE_ENDIAN=y
895CONFIG_USB_UHCI_HCD=m 865CONFIG_USB_UHCI_HCD=m
896# CONFIG_USB_SL811_HCD is not set 866# CONFIG_USB_SL811_HCD is not set
867# CONFIG_USB_R8A66597_HCD is not set
897 868
898# 869#
899# USB Device Class drivers 870# USB Device Class drivers
@@ -912,47 +883,10 @@ CONFIG_USB_UHCI_HCD=m
912# CONFIG_USB_LIBUSUAL is not set 883# CONFIG_USB_LIBUSUAL is not set
913 884
914# 885#
915# USB Input Devices
916#
917CONFIG_USB_HID=m
918CONFIG_USB_HIDINPUT=y
919# CONFIG_USB_HIDINPUT_POWERBOOK is not set
920# CONFIG_HID_FF is not set
921# CONFIG_USB_HIDDEV is not set
922
923#
924# USB HID Boot Protocol drivers
925#
926# CONFIG_USB_KBD is not set
927# CONFIG_USB_MOUSE is not set
928# CONFIG_USB_AIPTEK is not set
929# CONFIG_USB_WACOM is not set
930# CONFIG_USB_ACECAD is not set
931# CONFIG_USB_KBTAB is not set
932# CONFIG_USB_POWERMATE is not set
933# CONFIG_USB_TOUCHSCREEN is not set
934# CONFIG_USB_YEALINK is not set
935# CONFIG_USB_XPAD is not set
936# CONFIG_USB_ATI_REMOTE is not set
937# CONFIG_USB_ATI_REMOTE2 is not set
938# CONFIG_USB_KEYSPAN_REMOTE is not set
939# CONFIG_USB_APPLETOUCH is not set
940# CONFIG_USB_TRANCEVIBRATOR is not set
941
942#
943# USB Imaging devices 886# USB Imaging devices
944# 887#
945# CONFIG_USB_MDC800 is not set 888# CONFIG_USB_MDC800 is not set
946# CONFIG_USB_MICROTEK is not set 889# CONFIG_USB_MICROTEK is not set
947
948#
949# USB Network Adapters
950#
951# CONFIG_USB_CATC is not set
952# CONFIG_USB_KAWETH is not set
953# CONFIG_USB_PEGASUS is not set
954# CONFIG_USB_RTL8150 is not set
955# CONFIG_USB_USBNET is not set
956CONFIG_USB_MON=y 890CONFIG_USB_MON=y
957 891
958# 892#
@@ -974,6 +908,7 @@ CONFIG_USB_MON=y
974# CONFIG_USB_RIO500 is not set 908# CONFIG_USB_RIO500 is not set
975# CONFIG_USB_LEGOTOWER is not set 909# CONFIG_USB_LEGOTOWER is not set
976# CONFIG_USB_LCD is not set 910# CONFIG_USB_LCD is not set
911# CONFIG_USB_BERRY_CHARGE is not set
977# CONFIG_USB_LED is not set 912# CONFIG_USB_LED is not set
978# CONFIG_USB_CYPRESS_CY7C63 is not set 913# CONFIG_USB_CYPRESS_CY7C63 is not set
979# CONFIG_USB_CYTHERM is not set 914# CONFIG_USB_CYTHERM is not set
@@ -983,6 +918,8 @@ CONFIG_USB_MON=y
983# CONFIG_USB_APPLEDISPLAY is not set 918# CONFIG_USB_APPLEDISPLAY is not set
984# CONFIG_USB_SISUSBVGA is not set 919# CONFIG_USB_SISUSBVGA is not set
985# CONFIG_USB_LD is not set 920# CONFIG_USB_LD is not set
921# CONFIG_USB_TRANCEVIBRATOR is not set
922# CONFIG_USB_IOWARRIOR is not set
986 923
987# 924#
988# USB DSL modem support 925# USB DSL modem support
@@ -992,48 +929,24 @@ CONFIG_USB_MON=y
992# USB Gadget Support 929# USB Gadget Support
993# 930#
994# CONFIG_USB_GADGET is not set 931# CONFIG_USB_GADGET is not set
995
996#
997# MMC/SD Card support
998#
999# CONFIG_MMC is not set 932# CONFIG_MMC is not set
1000
1001#
1002# LED devices
1003#
1004# CONFIG_NEW_LEDS is not set 933# CONFIG_NEW_LEDS is not set
1005
1006#
1007# LED drivers
1008#
1009
1010#
1011# LED Triggers
1012#
1013
1014#
1015# InfiniBand support
1016#
1017CONFIG_INFINIBAND=m 934CONFIG_INFINIBAND=m
1018# CONFIG_INFINIBAND_USER_MAD is not set 935# CONFIG_INFINIBAND_USER_MAD is not set
1019CONFIG_INFINIBAND_USER_ACCESS=m 936CONFIG_INFINIBAND_USER_ACCESS=m
937CONFIG_INFINIBAND_USER_MEM=y
1020CONFIG_INFINIBAND_ADDR_TRANS=y 938CONFIG_INFINIBAND_ADDR_TRANS=y
1021CONFIG_INFINIBAND_MTHCA=m 939CONFIG_INFINIBAND_MTHCA=m
1022CONFIG_INFINIBAND_MTHCA_DEBUG=y 940CONFIG_INFINIBAND_MTHCA_DEBUG=y
1023# CONFIG_INFINIBAND_AMSO1100 is not set 941# CONFIG_INFINIBAND_AMSO1100 is not set
942# CONFIG_INFINIBAND_CXGB3 is not set
943# CONFIG_MLX4_INFINIBAND is not set
1024CONFIG_INFINIBAND_IPOIB=m 944CONFIG_INFINIBAND_IPOIB=m
945# CONFIG_INFINIBAND_IPOIB_CM is not set
1025CONFIG_INFINIBAND_IPOIB_DEBUG=y 946CONFIG_INFINIBAND_IPOIB_DEBUG=y
1026# CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set 947# CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set
1027CONFIG_INFINIBAND_SRP=m 948CONFIG_INFINIBAND_SRP=m
1028# CONFIG_INFINIBAND_ISER is not set 949# CONFIG_INFINIBAND_ISER is not set
1029
1030#
1031# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
1032#
1033
1034#
1035# Real Time Clock
1036#
1037# CONFIG_RTC_CLASS is not set 950# CONFIG_RTC_CLASS is not set
1038 951
1039# 952#
@@ -1050,6 +963,12 @@ CONFIG_INFINIBAND_SRP=m
1050# 963#
1051 964
1052# 965#
966# Userspace I/O
967#
968# CONFIG_UIO is not set
969CONFIG_MSPEC=y
970
971#
1053# File systems 972# File systems
1054# 973#
1055CONFIG_EXT2_FS=y 974CONFIG_EXT2_FS=y
@@ -1061,6 +980,7 @@ CONFIG_EXT3_FS=y
1061CONFIG_EXT3_FS_XATTR=y 980CONFIG_EXT3_FS_XATTR=y
1062CONFIG_EXT3_FS_POSIX_ACL=y 981CONFIG_EXT3_FS_POSIX_ACL=y
1063CONFIG_EXT3_FS_SECURITY=y 982CONFIG_EXT3_FS_SECURITY=y
983# CONFIG_EXT4DEV_FS is not set
1064CONFIG_JBD=y 984CONFIG_JBD=y
1065# CONFIG_JBD_DEBUG is not set 985# CONFIG_JBD_DEBUG is not set
1066CONFIG_FS_MBCACHE=y 986CONFIG_FS_MBCACHE=y
@@ -1161,6 +1081,7 @@ CONFIG_EXPORTFS=m
1161CONFIG_NFS_COMMON=y 1081CONFIG_NFS_COMMON=y
1162CONFIG_SUNRPC=m 1082CONFIG_SUNRPC=m
1163CONFIG_SUNRPC_GSS=m 1083CONFIG_SUNRPC_GSS=m
1084# CONFIG_SUNRPC_BIND34 is not set
1164CONFIG_RPCSEC_GSS_KRB5=m 1085CONFIG_RPCSEC_GSS_KRB5=m
1165# CONFIG_RPCSEC_GSS_SPKM3 is not set 1086# CONFIG_RPCSEC_GSS_SPKM3 is not set
1166CONFIG_SMB_FS=m 1087CONFIG_SMB_FS=m
@@ -1174,7 +1095,6 @@ CONFIG_CIFS=m
1174# CONFIG_NCP_FS is not set 1095# CONFIG_NCP_FS is not set
1175# CONFIG_CODA_FS is not set 1096# CONFIG_CODA_FS is not set
1176# CONFIG_AFS_FS is not set 1097# CONFIG_AFS_FS is not set
1177# CONFIG_9P_FS is not set
1178 1098
1179# 1099#
1180# Partition Types 1100# Partition Types
@@ -1196,6 +1116,7 @@ CONFIG_SGI_PARTITION=y
1196# CONFIG_SUN_PARTITION is not set 1116# CONFIG_SUN_PARTITION is not set
1197# CONFIG_KARMA_PARTITION is not set 1117# CONFIG_KARMA_PARTITION is not set
1198CONFIG_EFI_PARTITION=y 1118CONFIG_EFI_PARTITION=y
1119# CONFIG_SYSV68_PARTITION is not set
1199 1120
1200# 1121#
1201# Native Language Support 1122# Native Language Support
@@ -1244,18 +1165,25 @@ CONFIG_NLS_UTF8=y
1244# 1165#
1245# Distributed Lock Manager 1166# Distributed Lock Manager
1246# 1167#
1168# CONFIG_DLM is not set
1247 1169
1248# 1170#
1249# Library routines 1171# Library routines
1250# 1172#
1173CONFIG_BITREVERSE=y
1251# CONFIG_CRC_CCITT is not set 1174# CONFIG_CRC_CCITT is not set
1252CONFIG_CRC16=m 1175CONFIG_CRC16=m
1176# CONFIG_CRC_ITU_T is not set
1253CONFIG_CRC32=y 1177CONFIG_CRC32=y
1178# CONFIG_CRC7 is not set
1254CONFIG_LIBCRC32C=m 1179CONFIG_LIBCRC32C=m
1255CONFIG_ZLIB_INFLATE=m 1180CONFIG_ZLIB_INFLATE=m
1256CONFIG_ZLIB_DEFLATE=m 1181CONFIG_ZLIB_DEFLATE=m
1257CONFIG_GENERIC_ALLOCATOR=y 1182CONFIG_GENERIC_ALLOCATOR=y
1258CONFIG_PLIST=y 1183CONFIG_PLIST=y
1184CONFIG_HAS_IOMEM=y
1185CONFIG_HAS_IOPORT=y
1186CONFIG_HAS_DMA=y
1259CONFIG_GENERIC_HARDIRQS=y 1187CONFIG_GENERIC_HARDIRQS=y
1260CONFIG_GENERIC_IRQ_PROBE=y 1188CONFIG_GENERIC_IRQ_PROBE=y
1261CONFIG_GENERIC_PENDING_IRQ=y 1189CONFIG_GENERIC_PENDING_IRQ=y
@@ -1274,25 +1202,28 @@ CONFIG_IRQ_PER_CPU=y
1274CONFIG_ENABLE_MUST_CHECK=y 1202CONFIG_ENABLE_MUST_CHECK=y
1275CONFIG_MAGIC_SYSRQ=y 1203CONFIG_MAGIC_SYSRQ=y
1276# CONFIG_UNUSED_SYMBOLS is not set 1204# CONFIG_UNUSED_SYMBOLS is not set
1205# CONFIG_DEBUG_FS is not set
1206# CONFIG_HEADERS_CHECK is not set
1277CONFIG_DEBUG_KERNEL=y 1207CONFIG_DEBUG_KERNEL=y
1278CONFIG_LOG_BUF_SHIFT=20 1208# CONFIG_DEBUG_SHIRQ is not set
1279CONFIG_DETECT_SOFTLOCKUP=y 1209CONFIG_DETECT_SOFTLOCKUP=y
1210CONFIG_SCHED_DEBUG=y
1280# CONFIG_SCHEDSTATS is not set 1211# CONFIG_SCHEDSTATS is not set
1281# CONFIG_DEBUG_SLAB is not set 1212# CONFIG_TIMER_STATS is not set
1213# CONFIG_SLUB_DEBUG_ON is not set
1282# CONFIG_DEBUG_RT_MUTEXES is not set 1214# CONFIG_DEBUG_RT_MUTEXES is not set
1283# CONFIG_RT_MUTEX_TESTER is not set 1215# CONFIG_RT_MUTEX_TESTER is not set
1284# CONFIG_DEBUG_SPINLOCK is not set 1216# CONFIG_DEBUG_SPINLOCK is not set
1285# CONFIG_DEBUG_MUTEXES is not set 1217# CONFIG_DEBUG_MUTEXES is not set
1286# CONFIG_DEBUG_RWSEMS is not set
1287# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1218# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1288# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1219# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1289# CONFIG_DEBUG_KOBJECT is not set 1220# CONFIG_DEBUG_KOBJECT is not set
1290CONFIG_DEBUG_INFO=y 1221CONFIG_DEBUG_INFO=y
1291# CONFIG_DEBUG_FS is not set
1292# CONFIG_DEBUG_VM is not set 1222# CONFIG_DEBUG_VM is not set
1293# CONFIG_DEBUG_LIST is not set 1223# CONFIG_DEBUG_LIST is not set
1294CONFIG_FORCED_INLINING=y 1224CONFIG_FORCED_INLINING=y
1295# CONFIG_RCU_TORTURE_TEST is not set 1225# CONFIG_RCU_TORTURE_TEST is not set
1226# CONFIG_FAULT_INJECTION is not set
1296CONFIG_IA64_GRANULE_16MB=y 1227CONFIG_IA64_GRANULE_16MB=y
1297# CONFIG_IA64_GRANULE_64MB is not set 1228# CONFIG_IA64_GRANULE_64MB is not set
1298# CONFIG_IA64_PRINT_HAZARDS is not set 1229# CONFIG_IA64_PRINT_HAZARDS is not set
@@ -1306,16 +1237,17 @@ CONFIG_SYSVIPC_COMPAT=y
1306# 1237#
1307# CONFIG_KEYS is not set 1238# CONFIG_KEYS is not set
1308# CONFIG_SECURITY is not set 1239# CONFIG_SECURITY is not set
1309 1240CONFIG_XOR_BLOCKS=y
1310# 1241CONFIG_ASYNC_CORE=y
1311# Cryptographic options 1242CONFIG_ASYNC_MEMCPY=y
1312# 1243CONFIG_ASYNC_XOR=y
1313CONFIG_CRYPTO=y 1244CONFIG_CRYPTO=y
1314CONFIG_CRYPTO_ALGAPI=y 1245CONFIG_CRYPTO_ALGAPI=y
1315CONFIG_CRYPTO_BLKCIPHER=m 1246CONFIG_CRYPTO_BLKCIPHER=m
1316CONFIG_CRYPTO_HASH=y 1247CONFIG_CRYPTO_HASH=y
1317CONFIG_CRYPTO_MANAGER=m 1248CONFIG_CRYPTO_MANAGER=y
1318CONFIG_CRYPTO_HMAC=y 1249CONFIG_CRYPTO_HMAC=y
1250# CONFIG_CRYPTO_XCBC is not set
1319# CONFIG_CRYPTO_NULL is not set 1251# CONFIG_CRYPTO_NULL is not set
1320# CONFIG_CRYPTO_MD4 is not set 1252# CONFIG_CRYPTO_MD4 is not set
1321CONFIG_CRYPTO_MD5=y 1253CONFIG_CRYPTO_MD5=y
@@ -1324,9 +1256,14 @@ CONFIG_CRYPTO_SHA1=m
1324# CONFIG_CRYPTO_SHA512 is not set 1256# CONFIG_CRYPTO_SHA512 is not set
1325# CONFIG_CRYPTO_WP512 is not set 1257# CONFIG_CRYPTO_WP512 is not set
1326# CONFIG_CRYPTO_TGR192 is not set 1258# CONFIG_CRYPTO_TGR192 is not set
1259# CONFIG_CRYPTO_GF128MUL is not set
1327CONFIG_CRYPTO_ECB=m 1260CONFIG_CRYPTO_ECB=m
1328CONFIG_CRYPTO_CBC=m 1261CONFIG_CRYPTO_CBC=m
1262CONFIG_CRYPTO_PCBC=m
1263# CONFIG_CRYPTO_LRW is not set
1264# CONFIG_CRYPTO_CRYPTD is not set
1329CONFIG_CRYPTO_DES=m 1265CONFIG_CRYPTO_DES=m
1266# CONFIG_CRYPTO_FCRYPT is not set
1330# CONFIG_CRYPTO_BLOWFISH is not set 1267# CONFIG_CRYPTO_BLOWFISH is not set
1331# CONFIG_CRYPTO_TWOFISH is not set 1268# CONFIG_CRYPTO_TWOFISH is not set
1332# CONFIG_CRYPTO_SERPENT is not set 1269# CONFIG_CRYPTO_SERPENT is not set
@@ -1340,8 +1277,6 @@ CONFIG_CRYPTO_DES=m
1340CONFIG_CRYPTO_DEFLATE=m 1277CONFIG_CRYPTO_DEFLATE=m
1341# CONFIG_CRYPTO_MICHAEL_MIC is not set 1278# CONFIG_CRYPTO_MICHAEL_MIC is not set
1342CONFIG_CRYPTO_CRC32C=m 1279CONFIG_CRYPTO_CRC32C=m
1280# CONFIG_CRYPTO_CAMELLIA is not set
1343# CONFIG_CRYPTO_TEST is not set 1281# CONFIG_CRYPTO_TEST is not set
1344 1282# CONFIG_CRYPTO_HW is not set
1345#
1346# Hardware crypto devices
1347#
diff --git a/arch/ia64/hp/common/Makefile b/arch/ia64/hp/common/Makefile
index f61a60057ff7..9e179dd06b85 100644
--- a/arch/ia64/hp/common/Makefile
+++ b/arch/ia64/hp/common/Makefile
@@ -8,3 +8,4 @@
8obj-y := sba_iommu.o 8obj-y := sba_iommu.o
9obj-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += hwsw_iommu.o 9obj-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += hwsw_iommu.o
10obj-$(CONFIG_IA64_GENERIC) += hwsw_iommu.o 10obj-$(CONFIG_IA64_GENERIC) += hwsw_iommu.o
11obj-$(CONFIG_IA64_HP_AML_NFW) += aml_nfw.o
diff --git a/arch/ia64/hp/common/aml_nfw.c b/arch/ia64/hp/common/aml_nfw.c
new file mode 100644
index 000000000000..4abd2c79bb1d
--- /dev/null
+++ b/arch/ia64/hp/common/aml_nfw.c
@@ -0,0 +1,236 @@
1/*
2 * OpRegion handler to allow AML to call native firmware
3 *
4 * (c) Copyright 2007 Hewlett-Packard Development Company, L.P.
5 * Bjorn Helgaas <bjorn.helgaas@hp.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This driver implements HP Open Source Review Board proposal 1842,
12 * which was approved on 9/20/2006.
13 *
14 * For technical documentation, see the HP SPPA Firmware EAS, Appendix F.
15 *
16 * ACPI does not define a mechanism for AML methods to call native firmware
17 * interfaces such as PAL or SAL. This OpRegion handler adds such a mechanism.
18 * After the handler is installed, an AML method can call native firmware by
19 * storing the arguments and firmware entry point to specific offsets in the
20 * OpRegion. When AML reads the "return value" offset from the OpRegion, this
21 * handler loads up the arguments, makes the firmware call, and returns the
22 * result.
23 */
24
25#include <linux/module.h>
26#include <acpi/acpi_bus.h>
27#include <acpi/acpi_drivers.h>
28#include <asm/sal.h>
29
30MODULE_AUTHOR("Bjorn Helgaas <bjorn.helgaas@hp.com>");
31MODULE_LICENSE("GPL");
32MODULE_DESCRIPTION("ACPI opregion handler for native firmware calls");
33
34static int force_register;
35module_param_named(force, force_register, bool, 0);
36MODULE_PARM_DESC(force, "Install opregion handler even without HPQ5001 device");
37
38#define AML_NFW_SPACE 0xA1
39
40struct ia64_pdesc {
41 void *ip;
42 void *gp;
43};
44
45/*
46 * N.B. The layout of this structure is defined in the HP SPPA FW EAS, and
47 * the member offsets are embedded in AML methods.
48 */
49struct ia64_nfw_context {
50 u64 arg[8];
51 struct ia64_sal_retval ret;
52 u64 ip;
53 u64 gp;
54 u64 pad[2];
55};
56
57static void *virt_map(u64 address)
58{
59 if (address & (1UL << 63))
60 return (void *) (__IA64_UNCACHED_OFFSET | address);
61
62 return __va(address);
63}
64
65static void aml_nfw_execute(struct ia64_nfw_context *c)
66{
67 struct ia64_pdesc virt_entry;
68 ia64_sal_handler entry;
69
70 virt_entry.ip = virt_map(c->ip);
71 virt_entry.gp = virt_map(c->gp);
72
73 entry = (ia64_sal_handler) &virt_entry;
74
75 IA64_FW_CALL(entry, c->ret,
76 c->arg[0], c->arg[1], c->arg[2], c->arg[3],
77 c->arg[4], c->arg[5], c->arg[6], c->arg[7]);
78}
79
80static void aml_nfw_read_arg(u8 *offset, u32 bit_width, acpi_integer *value)
81{
82 switch (bit_width) {
83 case 8:
84 *value = *(u8 *)offset;
85 break;
86 case 16:
87 *value = *(u16 *)offset;
88 break;
89 case 32:
90 *value = *(u32 *)offset;
91 break;
92 case 64:
93 *value = *(u64 *)offset;
94 break;
95 }
96}
97
98static void aml_nfw_write_arg(u8 *offset, u32 bit_width, acpi_integer *value)
99{
100 switch (bit_width) {
101 case 8:
102 *(u8 *) offset = *value;
103 break;
104 case 16:
105 *(u16 *) offset = *value;
106 break;
107 case 32:
108 *(u32 *) offset = *value;
109 break;
110 case 64:
111 *(u64 *) offset = *value;
112 break;
113 }
114}
115
116static acpi_status aml_nfw_handler(u32 function, acpi_physical_address address,
117 u32 bit_width, acpi_integer *value, void *handler_context,
118 void *region_context)
119{
120 struct ia64_nfw_context *context = handler_context;
121 u8 *offset = (u8 *) context + address;
122
123 if (bit_width != 8 && bit_width != 16 &&
124 bit_width != 32 && bit_width != 64)
125 return AE_BAD_PARAMETER;
126
127 if (address + (bit_width >> 3) > sizeof(struct ia64_nfw_context))
128 return AE_BAD_PARAMETER;
129
130 switch (function) {
131 case ACPI_READ:
132 if (address == offsetof(struct ia64_nfw_context, ret))
133 aml_nfw_execute(context);
134 aml_nfw_read_arg(offset, bit_width, value);
135 break;
136 case ACPI_WRITE:
137 aml_nfw_write_arg(offset, bit_width, value);
138 break;
139 }
140
141 return AE_OK;
142}
143
144static struct ia64_nfw_context global_context;
145static int global_handler_registered;
146
147static int aml_nfw_add_global_handler(void)
148{
149 acpi_status status;
150
151 if (global_handler_registered)
152 return 0;
153
154 status = acpi_install_address_space_handler(ACPI_ROOT_OBJECT,
155 AML_NFW_SPACE, aml_nfw_handler, NULL, &global_context);
156 if (ACPI_FAILURE(status))
157 return -ENODEV;
158
159 global_handler_registered = 1;
160 printk(KERN_INFO "Global 0x%02X opregion handler registered\n",
161 AML_NFW_SPACE);
162 return 0;
163}
164
165static int aml_nfw_remove_global_handler(void)
166{
167 acpi_status status;
168
169 if (!global_handler_registered)
170 return 0;
171
172 status = acpi_remove_address_space_handler(ACPI_ROOT_OBJECT,
173 AML_NFW_SPACE, aml_nfw_handler);
174 if (ACPI_FAILURE(status))
175 return -ENODEV;
176
177 global_handler_registered = 0;
178 printk(KERN_INFO "Global 0x%02X opregion handler removed\n",
179 AML_NFW_SPACE);
180 return 0;
181}
182
183static int aml_nfw_add(struct acpi_device *device)
184{
185 /*
186 * We would normally allocate a new context structure and install
187 * the address space handler for the specific device we found.
188 * But the HP-UX implementation shares a single global context
189 * and always puts the handler at the root, so we'll do the same.
190 */
191 return aml_nfw_add_global_handler();
192}
193
194static int aml_nfw_remove(struct acpi_device *device, int type)
195{
196 return aml_nfw_remove_global_handler();
197}
198
199static const struct acpi_device_id aml_nfw_ids[] = {
200 {"HPQ5001", 0},
201 {"", 0}
202};
203
204static struct acpi_driver acpi_aml_nfw_driver = {
205 .name = "native firmware",
206 .ids = aml_nfw_ids,
207 .ops = {
208 .add = aml_nfw_add,
209 .remove = aml_nfw_remove,
210 },
211};
212
213static int __init aml_nfw_init(void)
214{
215 int result;
216
217 if (force_register)
218 aml_nfw_add_global_handler();
219
220 result = acpi_bus_register_driver(&acpi_aml_nfw_driver);
221 if (result < 0) {
222 aml_nfw_remove_global_handler();
223 return result;
224 }
225
226 return 0;
227}
228
229static void __exit aml_nfw_exit(void)
230{
231 acpi_bus_unregister_driver(&acpi_aml_nfw_driver);
232 aml_nfw_remove_global_handler();
233}
234
235module_init(aml_nfw_init);
236module_exit(aml_nfw_exit);
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index e980e7aa2306..4338f4123f31 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -396,7 +396,7 @@ sba_dump_sg( struct ioc *ioc, struct scatterlist *startsg, int nents)
396 printk(KERN_DEBUG " %d : DMA %08lx/%05x CPU %p\n", nents, 396 printk(KERN_DEBUG " %d : DMA %08lx/%05x CPU %p\n", nents,
397 startsg->dma_address, startsg->dma_length, 397 startsg->dma_address, startsg->dma_length,
398 sba_sg_address(startsg)); 398 sba_sg_address(startsg));
399 startsg++; 399 startsg = sg_next(startsg);
400 } 400 }
401} 401}
402 402
@@ -409,7 +409,7 @@ sba_check_sg( struct ioc *ioc, struct scatterlist *startsg, int nents)
409 while (the_nents-- > 0) { 409 while (the_nents-- > 0) {
410 if (sba_sg_address(the_sg) == 0x0UL) 410 if (sba_sg_address(the_sg) == 0x0UL)
411 sba_dump_sg(NULL, startsg, nents); 411 sba_dump_sg(NULL, startsg, nents);
412 the_sg++; 412 the_sg = sg_next(the_sg);
413 } 413 }
414} 414}
415 415
@@ -1201,7 +1201,7 @@ sba_fill_pdir(
1201 u32 pide = startsg->dma_address & ~PIDE_FLAG; 1201 u32 pide = startsg->dma_address & ~PIDE_FLAG;
1202 dma_offset = (unsigned long) pide & ~iovp_mask; 1202 dma_offset = (unsigned long) pide & ~iovp_mask;
1203 startsg->dma_address = 0; 1203 startsg->dma_address = 0;
1204 dma_sg++; 1204 dma_sg = sg_next(dma_sg);
1205 dma_sg->dma_address = pide | ioc->ibase; 1205 dma_sg->dma_address = pide | ioc->ibase;
1206 pdirp = &(ioc->pdir_base[pide >> iovp_shift]); 1206 pdirp = &(ioc->pdir_base[pide >> iovp_shift]);
1207 n_mappings++; 1207 n_mappings++;
@@ -1228,7 +1228,7 @@ sba_fill_pdir(
1228 pdirp++; 1228 pdirp++;
1229 } while (cnt > 0); 1229 } while (cnt > 0);
1230 } 1230 }
1231 startsg++; 1231 startsg = sg_next(startsg);
1232 } 1232 }
1233 /* force pdir update */ 1233 /* force pdir update */
1234 wmb(); 1234 wmb();
@@ -1297,7 +1297,7 @@ sba_coalesce_chunks( struct ioc *ioc,
1297 while (--nents > 0) { 1297 while (--nents > 0) {
1298 unsigned long vaddr; /* tmp */ 1298 unsigned long vaddr; /* tmp */
1299 1299
1300 startsg++; 1300 startsg = sg_next(startsg);
1301 1301
1302 /* PARANOID */ 1302 /* PARANOID */
1303 startsg->dma_address = startsg->dma_length = 0; 1303 startsg->dma_address = startsg->dma_length = 0;
@@ -1407,7 +1407,7 @@ int sba_map_sg(struct device *dev, struct scatterlist *sglist, int nents, int di
1407#ifdef ALLOW_IOV_BYPASS_SG 1407#ifdef ALLOW_IOV_BYPASS_SG
1408 ASSERT(to_pci_dev(dev)->dma_mask); 1408 ASSERT(to_pci_dev(dev)->dma_mask);
1409 if (likely((ioc->dma_mask & ~to_pci_dev(dev)->dma_mask) == 0)) { 1409 if (likely((ioc->dma_mask & ~to_pci_dev(dev)->dma_mask) == 0)) {
1410 for (sg = sglist ; filled < nents ; filled++, sg++){ 1410 for_each_sg(sglist, sg, nents, filled) {
1411 sg->dma_length = sg->length; 1411 sg->dma_length = sg->length;
1412 sg->dma_address = virt_to_phys(sba_sg_address(sg)); 1412 sg->dma_address = virt_to_phys(sba_sg_address(sg));
1413 } 1413 }
@@ -1501,7 +1501,7 @@ void sba_unmap_sg (struct device *dev, struct scatterlist *sglist, int nents, in
1501 while (nents && sglist->dma_length) { 1501 while (nents && sglist->dma_length) {
1502 1502
1503 sba_unmap_single(dev, sglist->dma_address, sglist->dma_length, dir); 1503 sba_unmap_single(dev, sglist->dma_address, sglist->dma_length, dir);
1504 sglist++; 1504 sglist = sg_next(sglist);
1505 nents--; 1505 nents--;
1506 } 1506 }
1507 1507
diff --git a/arch/ia64/hp/sim/simscsi.c b/arch/ia64/hp/sim/simscsi.c
index 4552a1cf5b33..a3a558a06757 100644
--- a/arch/ia64/hp/sim/simscsi.c
+++ b/arch/ia64/hp/sim/simscsi.c
@@ -360,6 +360,7 @@ static struct scsi_host_template driver_template = {
360 .max_sectors = 1024, 360 .max_sectors = 1024,
361 .cmd_per_lun = SIMSCSI_REQ_QUEUE_LEN, 361 .cmd_per_lun = SIMSCSI_REQ_QUEUE_LEN,
362 .use_clustering = DISABLE_CLUSTERING, 362 .use_clustering = DISABLE_CLUSTERING,
363 .use_sg_chaining = ENABLE_SG_CHAINING,
363}; 364};
364 365
365static int __init 366static int __init
@@ -372,8 +373,13 @@ simscsi_init(void)
372 return -ENOMEM; 373 return -ENOMEM;
373 374
374 error = scsi_add_host(host, NULL); 375 error = scsi_add_host(host, NULL);
375 if (!error) 376 if (error)
376 scsi_scan_host(host); 377 goto free_host;
378 scsi_scan_host(host);
379 return 0;
380
381 free_host:
382 scsi_host_put(host);
377 return error; 383 return error;
378} 384}
379 385
diff --git a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
index 8c6ec7070844..b8498ea62068 100644
--- a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
+++ b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
@@ -321,8 +321,6 @@ acpi_cpufreq_cpu_init (
321 data->acpi_data.states[i].transition_latency * 1000; 321 data->acpi_data.states[i].transition_latency * 1000;
322 } 322 }
323 } 323 }
324 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
325
326 policy->cur = processor_get_freq(data, policy->cpu); 324 policy->cur = processor_get_freq(data, policy->cpu);
327 325
328 /* table init */ 326 /* table init */
diff --git a/arch/ia64/kernel/crash.c b/arch/ia64/kernel/crash.c
index 1d64ef478dde..f1cf2df97a2d 100644
--- a/arch/ia64/kernel/crash.c
+++ b/arch/ia64/kernel/crash.c
@@ -118,11 +118,6 @@ machine_crash_shutdown(struct pt_regs *pt)
118static void 118static void
119machine_kdump_on_init(void) 119machine_kdump_on_init(void)
120{ 120{
121 if (!ia64_kimage) {
122 printk(KERN_NOTICE "machine_kdump_on_init(): "
123 "kdump not configured\n");
124 return;
125 }
126 local_irq_disable(); 121 local_irq_disable();
127 kexec_disable_iosapic(); 122 kexec_disable_iosapic();
128 machine_kexec(ia64_kimage); 123 machine_kexec(ia64_kimage);
@@ -156,6 +151,14 @@ kdump_init_notifier(struct notifier_block *self, unsigned long val, void *data)
156 if (!kdump_on_init) 151 if (!kdump_on_init)
157 return NOTIFY_DONE; 152 return NOTIFY_DONE;
158 153
154 if (!ia64_kimage) {
155 if (val == DIE_INIT_MONARCH_LEAVE)
156 ia64_mca_printk(KERN_NOTICE
157 "%s: kdump not configured\n",
158 __FUNCTION__);
159 return NOTIFY_DONE;
160 }
161
159 if (val != DIE_INIT_MONARCH_LEAVE && 162 if (val != DIE_INIT_MONARCH_LEAVE &&
160 val != DIE_INIT_SLAVE_LEAVE && 163 val != DIE_INIT_SLAVE_LEAVE &&
161 val != DIE_INIT_MONARCH_PROCESS && 164 val != DIE_INIT_MONARCH_PROCESS &&
diff --git a/arch/ia64/kernel/gate.lds.S b/arch/ia64/kernel/gate.lds.S
index 6d198339bf85..44817d97ab43 100644
--- a/arch/ia64/kernel/gate.lds.S
+++ b/arch/ia64/kernel/gate.lds.S
@@ -1,7 +1,8 @@
1/* 1/*
2 * Linker script for gate DSO. The gate pages are an ELF shared object prelinked to its 2 * Linker script for gate DSO. The gate pages are an ELF shared object
3 * virtual address, with only one read-only segment and one execute-only segment (both fit 3 * prelinked to its virtual address, with only one read-only segment and
4 * in one page). This script controls its layout. 4 * one execute-only segment (both fit in one page). This script controls
5 * its layout.
5 */ 6 */
6 7
7 8
@@ -9,72 +10,80 @@
9 10
10SECTIONS 11SECTIONS
11{ 12{
12 . = GATE_ADDR + SIZEOF_HEADERS; 13 . = GATE_ADDR + SIZEOF_HEADERS;
13 14
14 .hash : { *(.hash) } :readable 15 .hash : { *(.hash) } :readable
15 .gnu.hash : { *(.gnu.hash) } 16 .gnu.hash : { *(.gnu.hash) }
16 .dynsym : { *(.dynsym) } 17 .dynsym : { *(.dynsym) }
17 .dynstr : { *(.dynstr) } 18 .dynstr : { *(.dynstr) }
18 .gnu.version : { *(.gnu.version) } 19 .gnu.version : { *(.gnu.version) }
19 .gnu.version_d : { *(.gnu.version_d) } 20 .gnu.version_d : { *(.gnu.version_d) }
20 .gnu.version_r : { *(.gnu.version_r) } 21 .gnu.version_r : { *(.gnu.version_r) }
21 .dynamic : { *(.dynamic) } :readable :dynamic 22
22 23 .dynamic : { *(.dynamic) } :readable :dynamic
23 /* 24
24 * This linker script is used both with -r and with -shared. For the layouts to match, 25 /*
25 * we need to skip more than enough space for the dynamic symbol table et al. If this 26 * This linker script is used both with -r and with -shared. For
26 * amount is insufficient, ld -shared will barf. Just increase it here. 27 * the layouts to match, we need to skip more than enough space for
27 */ 28 * the dynamic symbol table et al. If this amount is insufficient,
28 . = GATE_ADDR + 0x500; 29 * ld -shared will barf. Just increase it here.
29 30 */
30 .data.patch : { 31 . = GATE_ADDR + 0x500;
31 __start_gate_mckinley_e9_patchlist = .; 32
32 *(.data.patch.mckinley_e9) 33 .data.patch : {
33 __end_gate_mckinley_e9_patchlist = .; 34 __start_gate_mckinley_e9_patchlist = .;
34 35 *(.data.patch.mckinley_e9)
35 __start_gate_vtop_patchlist = .; 36 __end_gate_mckinley_e9_patchlist = .;
36 *(.data.patch.vtop) 37
37 __end_gate_vtop_patchlist = .; 38 __start_gate_vtop_patchlist = .;
38 39 *(.data.patch.vtop)
39 __start_gate_fsyscall_patchlist = .; 40 __end_gate_vtop_patchlist = .;
40 *(.data.patch.fsyscall_table) 41
41 __end_gate_fsyscall_patchlist = .; 42 __start_gate_fsyscall_patchlist = .;
42 43 *(.data.patch.fsyscall_table)
43 __start_gate_brl_fsys_bubble_down_patchlist = .; 44 __end_gate_fsyscall_patchlist = .;
44 *(.data.patch.brl_fsys_bubble_down) 45
45 __end_gate_brl_fsys_bubble_down_patchlist = .; 46 __start_gate_brl_fsys_bubble_down_patchlist = .;
46 } :readable 47 *(.data.patch.brl_fsys_bubble_down)
47 .IA_64.unwind_info : { *(.IA_64.unwind_info*) } 48 __end_gate_brl_fsys_bubble_down_patchlist = .;
48 .IA_64.unwind : { *(.IA_64.unwind*) } :readable :unwind 49 } :readable
50
51 .IA_64.unwind_info : { *(.IA_64.unwind_info*) }
52 .IA_64.unwind : { *(.IA_64.unwind*) } :readable :unwind
49#ifdef HAVE_BUGGY_SEGREL 53#ifdef HAVE_BUGGY_SEGREL
50 .text (GATE_ADDR + PAGE_SIZE) : { *(.text) *(.text.*) } :readable 54 .text (GATE_ADDR + PAGE_SIZE) : { *(.text) *(.text.*) } :readable
51#else 55#else
52 . = ALIGN (PERCPU_PAGE_SIZE) + (. & (PERCPU_PAGE_SIZE - 1)); 56 . = ALIGN(PERCPU_PAGE_SIZE) + (. & (PERCPU_PAGE_SIZE - 1));
53 .text : { *(.text) *(.text.*) } :epc 57 .text : { *(.text) *(.text.*) } :epc
54#endif 58#endif
55 59
56 /DISCARD/ : { 60 /DISCARD/ : {
57 *(.got.plt) *(.got) 61 *(.got.plt) *(.got)
58 *(.data .data.* .gnu.linkonce.d.*) 62 *(.data .data.* .gnu.linkonce.d.*)
59 *(.dynbss) 63 *(.dynbss)
60 *(.bss .bss.* .gnu.linkonce.b.*) 64 *(.bss .bss.* .gnu.linkonce.b.*)
61 *(__ex_table) 65 *(__ex_table)
62 *(__mca_table) 66 *(__mca_table)
63 } 67 }
64} 68}
65 69
66/* 70/*
71 * ld does not recognize this name token; use the constant.
72 */
73#define PT_IA_64_UNWIND 0x70000001
74
75/*
67 * We must supply the ELF program headers explicitly to get just one 76 * We must supply the ELF program headers explicitly to get just one
68 * PT_LOAD segment, and set the flags explicitly to make segments read-only. 77 * PT_LOAD segment, and set the flags explicitly to make segments read-only.
69 */ 78 */
70PHDRS 79PHDRS
71{ 80{
72 readable PT_LOAD FILEHDR PHDRS FLAGS(4); /* PF_R */ 81 readable PT_LOAD FILEHDR PHDRS FLAGS(4); /* PF_R */
73#ifndef HAVE_BUGGY_SEGREL 82#ifndef HAVE_BUGGY_SEGREL
74 epc PT_LOAD FILEHDR PHDRS FLAGS(1); /* PF_X */ 83 epc PT_LOAD FILEHDR PHDRS FLAGS(1); /* PF_X */
75#endif 84#endif
76 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ 85 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
77 unwind 0x70000001; /* PT_IA_64_UNWIND, but ld doesn't match the name */ 86 unwind PT_IA_64_UNWIND;
78} 87}
79 88
80/* 89/*
@@ -82,14 +91,14 @@ PHDRS
82 */ 91 */
83VERSION 92VERSION
84{ 93{
85 LINUX_2.5 { 94 LINUX_2.5 {
86 global: 95 global:
87 __kernel_syscall_via_break; 96 __kernel_syscall_via_break;
88 __kernel_syscall_via_epc; 97 __kernel_syscall_via_epc;
89 __kernel_sigtramp; 98 __kernel_sigtramp;
90 99
91 local: *; 100 local: *;
92 }; 101 };
93} 102}
94 103
95/* The ELF entry point can be used to set the AT_SYSINFO value. */ 104/* The ELF entry point can be used to set the AT_SYSINFO value. */
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c
index 5dc98b5abcfb..5fd65d8302c8 100644
--- a/arch/ia64/kernel/kprobes.c
+++ b/arch/ia64/kernel/kprobes.c
@@ -40,6 +40,8 @@ extern void jprobe_inst_return(void);
40DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; 40DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
41DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); 41DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
42 42
43struct kretprobe_blackpoint kretprobe_blacklist[] = {{NULL, NULL}};
44
43enum instruction_type {A, I, M, F, B, L, X, u}; 45enum instruction_type {A, I, M, F, B, L, X, u};
44static enum instruction_type bundle_encoding[32][3] = { 46static enum instruction_type bundle_encoding[32][3] = {
45 { M, I, I }, /* 00 */ 47 { M, I, I }, /* 00 */
diff --git a/arch/ia64/kernel/machine_kexec.c b/arch/ia64/kernel/machine_kexec.c
index 4f0f3b8c1ee2..58e943a5d95c 100644
--- a/arch/ia64/kernel/machine_kexec.c
+++ b/arch/ia64/kernel/machine_kexec.c
@@ -79,7 +79,6 @@ static void ia64_machine_kexec(struct unw_frame_info *info, void *arg)
79 relocate_new_kernel_t rnk; 79 relocate_new_kernel_t rnk;
80 void *pal_addr = efi_get_pal_addr(); 80 void *pal_addr = efi_get_pal_addr();
81 unsigned long code_addr = (unsigned long)page_address(image->control_code_page); 81 unsigned long code_addr = (unsigned long)page_address(image->control_code_page);
82 unsigned long vector;
83 int ii; 82 int ii;
84 83
85 BUG_ON(!image); 84 BUG_ON(!image);
@@ -107,11 +106,8 @@ static void ia64_machine_kexec(struct unw_frame_info *info, void *arg)
107 /* unmask TPR and clear any pending interrupts */ 106 /* unmask TPR and clear any pending interrupts */
108 ia64_setreg(_IA64_REG_CR_TPR, 0); 107 ia64_setreg(_IA64_REG_CR_TPR, 0);
109 ia64_srlz_d(); 108 ia64_srlz_d();
110 vector = ia64_get_ivr(); 109 while (ia64_get_ivr() != IA64_SPURIOUS_INT_VECTOR)
111 while (vector != IA64_SPURIOUS_INT_VECTOR) {
112 ia64_eoi(); 110 ia64_eoi();
113 vector = ia64_get_ivr();
114 }
115 platform_kernel_launch_event(); 111 platform_kernel_launch_event();
116 rnk = (relocate_new_kernel_t)&code_addr; 112 rnk = (relocate_new_kernel_t)&code_addr;
117 (*rnk)(image->head, image->start, ia64_boot_param, 113 (*rnk)(image->head, image->start, ia64_boot_param,
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 63b73f3d4c9f..cc87025e8f54 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -701,8 +701,7 @@ ia64_mca_cmc_vector_enable_keventd(struct work_struct *unused)
701/* 701/*
702 * ia64_mca_wakeup 702 * ia64_mca_wakeup
703 * 703 *
704 * Send an inter-cpu interrupt to wake-up a particular cpu 704 * Send an inter-cpu interrupt to wake-up a particular cpu.
705 * and mark that cpu to be out of rendez.
706 * 705 *
707 * Inputs : cpuid 706 * Inputs : cpuid
708 * Outputs : None 707 * Outputs : None
@@ -711,14 +710,12 @@ static void
711ia64_mca_wakeup(int cpu) 710ia64_mca_wakeup(int cpu)
712{ 711{
713 platform_send_ipi(cpu, IA64_MCA_WAKEUP_VECTOR, IA64_IPI_DM_INT, 0); 712 platform_send_ipi(cpu, IA64_MCA_WAKEUP_VECTOR, IA64_IPI_DM_INT, 0);
714 ia64_mc_info.imi_rendez_checkin[cpu] = IA64_MCA_RENDEZ_CHECKIN_NOTDONE;
715
716} 713}
717 714
718/* 715/*
719 * ia64_mca_wakeup_all 716 * ia64_mca_wakeup_all
720 * 717 *
721 * Wakeup all the cpus which have rendez'ed previously. 718 * Wakeup all the slave cpus which have rendez'ed previously.
722 * 719 *
723 * Inputs : None 720 * Inputs : None
724 * Outputs : None 721 * Outputs : None
@@ -741,7 +738,10 @@ ia64_mca_wakeup_all(void)
741 * 738 *
742 * This is handler used to put slave processors into spinloop 739 * This is handler used to put slave processors into spinloop
743 * while the monarch processor does the mca handling and later 740 * while the monarch processor does the mca handling and later
744 * wake each slave up once the monarch is done. 741 * wake each slave up once the monarch is done. The state
742 * IA64_MCA_RENDEZ_CHECKIN_DONE indicates the cpu is rendez'ed
743 * in SAL. The state IA64_MCA_RENDEZ_CHECKIN_NOTDONE indicates
744 * the cpu has come out of OS rendezvous.
745 * 745 *
746 * Inputs : None 746 * Inputs : None
747 * Outputs : None 747 * Outputs : None
@@ -778,6 +778,7 @@ ia64_mca_rendez_int_handler(int rendez_irq, void *arg)
778 (long)&nd, 0, 0) == NOTIFY_STOP) 778 (long)&nd, 0, 0) == NOTIFY_STOP)
779 ia64_mca_spin(__FUNCTION__); 779 ia64_mca_spin(__FUNCTION__);
780 780
781 ia64_mc_info.imi_rendez_checkin[cpu] = IA64_MCA_RENDEZ_CHECKIN_NOTDONE;
781 /* Enable all interrupts */ 782 /* Enable all interrupts */
782 local_irq_restore(flags); 783 local_irq_restore(flags);
783 return IRQ_HANDLED; 784 return IRQ_HANDLED;
@@ -1135,30 +1136,27 @@ no_mod:
1135static void 1136static void
1136ia64_wait_for_slaves(int monarch, const char *type) 1137ia64_wait_for_slaves(int monarch, const char *type)
1137{ 1138{
1138 int c, wait = 0, missing = 0; 1139 int c, i , wait;
1139 for_each_online_cpu(c) { 1140
1140 if (c == monarch) 1141 /*
1141 continue; 1142 * wait 5 seconds total for slaves (arbitrary)
1142 if (ia64_mc_info.imi_rendez_checkin[c] == IA64_MCA_RENDEZ_CHECKIN_NOTDONE) { 1143 */
1143 udelay(1000); /* short wait first */ 1144 for (i = 0; i < 5000; i++) {
1144 wait = 1; 1145 wait = 0;
1145 break; 1146 for_each_online_cpu(c) {
1146 } 1147 if (c == monarch)
1147 } 1148 continue;
1148 if (!wait) 1149 if (ia64_mc_info.imi_rendez_checkin[c]
1149 goto all_in; 1150 == IA64_MCA_RENDEZ_CHECKIN_NOTDONE) {
1150 for_each_online_cpu(c) { 1151 udelay(1000); /* short wait */
1151 if (c == monarch) 1152 wait = 1;
1152 continue; 1153 break;
1153 if (ia64_mc_info.imi_rendez_checkin[c] == IA64_MCA_RENDEZ_CHECKIN_NOTDONE) { 1154 }
1154 udelay(5*1000000); /* wait 5 seconds for slaves (arbitrary) */
1155 if (ia64_mc_info.imi_rendez_checkin[c] == IA64_MCA_RENDEZ_CHECKIN_NOTDONE)
1156 missing = 1;
1157 break;
1158 } 1155 }
1156 if (!wait)
1157 goto all_in;
1159 } 1158 }
1160 if (!missing) 1159
1161 goto all_in;
1162 /* 1160 /*
1163 * Maybe slave(s) dead. Print buffered messages immediately. 1161 * Maybe slave(s) dead. Print buffered messages immediately.
1164 */ 1162 */
@@ -1224,26 +1222,27 @@ ia64_mca_handler(struct pt_regs *regs, struct switch_stack *sw,
1224 if (notify_die(DIE_MCA_MONARCH_ENTER, "MCA", regs, (long)&nd, 0, 0) 1222 if (notify_die(DIE_MCA_MONARCH_ENTER, "MCA", regs, (long)&nd, 0, 0)
1225 == NOTIFY_STOP) 1223 == NOTIFY_STOP)
1226 ia64_mca_spin(__FUNCTION__); 1224 ia64_mca_spin(__FUNCTION__);
1225
1226 ia64_mc_info.imi_rendez_checkin[cpu] = IA64_MCA_RENDEZ_CHECKIN_CONCURRENT_MCA;
1227 if (sos->monarch) { 1227 if (sos->monarch) {
1228 ia64_wait_for_slaves(cpu, "MCA"); 1228 ia64_wait_for_slaves(cpu, "MCA");
1229
1230 /* Wakeup all the processors which are spinning in the
1231 * rendezvous loop. They will leave SAL, then spin in the OS
1232 * with interrupts disabled until this monarch cpu leaves the
1233 * MCA handler. That gets control back to the OS so we can
1234 * backtrace the other cpus, backtrace when spinning in SAL
1235 * does not work.
1236 */
1237 ia64_mca_wakeup_all();
1238 if (notify_die(DIE_MCA_MONARCH_PROCESS, "MCA", regs, (long)&nd, 0, 0)
1239 == NOTIFY_STOP)
1240 ia64_mca_spin(__FUNCTION__);
1229 } else { 1241 } else {
1230 ia64_mc_info.imi_rendez_checkin[cpu] = IA64_MCA_RENDEZ_CHECKIN_CONCURRENT_MCA;
1231 while (cpu_isset(cpu, mca_cpu)) 1242 while (cpu_isset(cpu, mca_cpu))
1232 cpu_relax(); /* spin until monarch wakes us */ 1243 cpu_relax(); /* spin until monarch wakes us */
1233 ia64_mc_info.imi_rendez_checkin[cpu] = IA64_MCA_RENDEZ_CHECKIN_NOTDONE;
1234 } 1244 }
1235 1245
1236 /* Wakeup all the processors which are spinning in the rendezvous loop.
1237 * They will leave SAL, then spin in the OS with interrupts disabled
1238 * until this monarch cpu leaves the MCA handler. That gets control
1239 * back to the OS so we can backtrace the other cpus, backtrace when
1240 * spinning in SAL does not work.
1241 */
1242 ia64_mca_wakeup_all();
1243 if (notify_die(DIE_MCA_MONARCH_PROCESS, "MCA", regs, (long)&nd, 0, 0)
1244 == NOTIFY_STOP)
1245 ia64_mca_spin(__FUNCTION__);
1246
1247 /* Get the MCA error record and log it */ 1246 /* Get the MCA error record and log it */
1248 ia64_mca_log_sal_error_record(SAL_INFO_TYPE_MCA); 1247 ia64_mca_log_sal_error_record(SAL_INFO_TYPE_MCA);
1249 1248
@@ -1277,21 +1276,22 @@ ia64_mca_handler(struct pt_regs *regs, struct switch_stack *sw,
1277 /* wake up the next monarch cpu, 1276 /* wake up the next monarch cpu,
1278 * and put this cpu in the rendez loop. 1277 * and put this cpu in the rendez loop.
1279 */ 1278 */
1280 ia64_mc_info.imi_rendez_checkin[cpu] = IA64_MCA_RENDEZ_CHECKIN_CONCURRENT_MCA;
1281 for_each_online_cpu(i) { 1279 for_each_online_cpu(i) {
1282 if (cpu_isset(i, mca_cpu)) { 1280 if (cpu_isset(i, mca_cpu)) {
1283 monarch_cpu = i; 1281 monarch_cpu = i;
1284 cpu_clear(i, mca_cpu); /* wake next cpu */ 1282 cpu_clear(i, mca_cpu); /* wake next cpu */
1285 while (monarch_cpu != -1) 1283 while (monarch_cpu != -1)
1286 cpu_relax(); /* spin until last cpu leaves */ 1284 cpu_relax(); /* spin until last cpu leaves */
1287 ia64_mc_info.imi_rendez_checkin[cpu] = IA64_MCA_RENDEZ_CHECKIN_NOTDONE;
1288 set_curr_task(cpu, previous_current); 1285 set_curr_task(cpu, previous_current);
1286 ia64_mc_info.imi_rendez_checkin[cpu]
1287 = IA64_MCA_RENDEZ_CHECKIN_NOTDONE;
1289 return; 1288 return;
1290 } 1289 }
1291 } 1290 }
1292 } 1291 }
1293 set_curr_task(cpu, previous_current); 1292 set_curr_task(cpu, previous_current);
1294 monarch_cpu = -1; 1293 ia64_mc_info.imi_rendez_checkin[cpu] = IA64_MCA_RENDEZ_CHECKIN_NOTDONE;
1294 monarch_cpu = -1; /* This frees the slaves and previous monarchs */
1295} 1295}
1296 1296
1297static DECLARE_WORK(cmc_disable_work, ia64_mca_cmc_vector_disable_keventd); 1297static DECLARE_WORK(cmc_disable_work, ia64_mca_cmc_vector_disable_keventd);
diff --git a/arch/ia64/kernel/mca_drv.h b/arch/ia64/kernel/mca_drv.h
index c85e943ba5fd..485e34d0b199 100644
--- a/arch/ia64/kernel/mca_drv.h
+++ b/arch/ia64/kernel/mca_drv.h
@@ -118,7 +118,5 @@ struct mca_table_entry {
118 118
119extern const struct mca_table_entry *search_mca_tables (unsigned long addr); 119extern const struct mca_table_entry *search_mca_tables (unsigned long addr);
120extern int mca_recover_range(unsigned long); 120extern int mca_recover_range(unsigned long);
121extern void ia64_mca_printk(const char * fmt, ...)
122 __attribute__ ((format (printf, 1, 2)));
123extern void ia64_mlogbuf_dump(void); 121extern void ia64_mlogbuf_dump(void);
124 122
diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c
index 85829e27785c..6ef6ffb943a0 100644
--- a/arch/ia64/kernel/palinfo.c
+++ b/arch/ia64/kernel/palinfo.c
@@ -907,7 +907,7 @@ palinfo_read_entry(char *page, char **start, off_t off, int count, int *eof, voi
907 return len; 907 return len;
908} 908}
909 909
910static void 910static void __cpuinit
911create_palinfo_proc_entries(unsigned int cpu) 911create_palinfo_proc_entries(unsigned int cpu)
912{ 912{
913# define CPUSTR "cpu%d" 913# define CPUSTR "cpu%d"
@@ -968,7 +968,7 @@ remove_palinfo_proc_entries(unsigned int hcpu)
968 } 968 }
969} 969}
970 970
971static int palinfo_cpu_callback(struct notifier_block *nfb, 971static int __cpuinit palinfo_cpu_callback(struct notifier_block *nfb,
972 unsigned long action, void *hcpu) 972 unsigned long action, void *hcpu)
973{ 973{
974 unsigned int hotcpu = (unsigned long)hcpu; 974 unsigned int hotcpu = (unsigned long)hcpu;
@@ -986,7 +986,7 @@ static int palinfo_cpu_callback(struct notifier_block *nfb,
986 return NOTIFY_OK; 986 return NOTIFY_OK;
987} 987}
988 988
989static struct notifier_block palinfo_cpu_notifier = 989static struct notifier_block palinfo_cpu_notifier __cpuinitdata =
990{ 990{
991 .notifier_call = palinfo_cpu_callback, 991 .notifier_call = palinfo_cpu_callback,
992 .priority = 0, 992 .priority = 0,
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 14b8e5a6222b..f55fa07849c4 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -1538,13 +1538,6 @@ init_pfm_fs(void)
1538 return err; 1538 return err;
1539} 1539}
1540 1540
1541static void __exit
1542exit_pfm_fs(void)
1543{
1544 unregister_filesystem(&pfm_fs_type);
1545 mntput(pfmfs_mnt);
1546}
1547
1548static ssize_t 1541static ssize_t
1549pfm_read(struct file *filp, char __user *buf, size_t size, loff_t *ppos) 1542pfm_read(struct file *filp, char __user *buf, size_t size, loff_t *ppos)
1550{ 1543{
diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c
index 25cd75f50ab1..779c3cca206c 100644
--- a/arch/ia64/kernel/salinfo.c
+++ b/arch/ia64/kernel/salinfo.c
@@ -574,7 +574,7 @@ static const struct file_operations salinfo_data_fops = {
574 .write = salinfo_log_write, 574 .write = salinfo_log_write,
575}; 575};
576 576
577static int __devinit 577static int __cpuinit
578salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu) 578salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
579{ 579{
580 unsigned int i, cpu = (unsigned long)hcpu; 580 unsigned int i, cpu = (unsigned long)hcpu;
@@ -615,7 +615,7 @@ salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu
615 return NOTIFY_OK; 615 return NOTIFY_OK;
616} 616}
617 617
618static struct notifier_block salinfo_cpu_notifier = 618static struct notifier_block salinfo_cpu_notifier __cpuinitdata =
619{ 619{
620 .notifier_call = salinfo_cpu_callback, 620 .notifier_call = salinfo_cpu_callback,
621 .priority = 0, 621 .priority = 0,
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 9e392a30d197..777c8d8bd5e7 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -528,10 +528,6 @@ setup_arch (char **cmdline_p)
528 528
529#ifdef CONFIG_SMP 529#ifdef CONFIG_SMP
530 cpu_physical_id(0) = hard_smp_processor_id(); 530 cpu_physical_id(0) = hard_smp_processor_id();
531
532 cpu_set(0, cpu_sibling_map[0]);
533 cpu_set(0, cpu_core_map[0]);
534
535 check_for_logical_procs(); 531 check_for_logical_procs();
536 if (smp_num_cpucores > 1) 532 if (smp_num_cpucores > 1)
537 printk(KERN_INFO 533 printk(KERN_INFO
@@ -873,6 +869,14 @@ cpu_init (void)
873 void *cpu_data; 869 void *cpu_data;
874 870
875 cpu_data = per_cpu_init(); 871 cpu_data = per_cpu_init();
872 /*
873 * insert boot cpu into sibling and core mapes
874 * (must be done after per_cpu area is setup)
875 */
876 if (smp_processor_id() == 0) {
877 cpu_set(0, per_cpu(cpu_sibling_map, 0));
878 cpu_set(0, cpu_core_map[0]);
879 }
876 880
877 /* 881 /*
878 * We set ar.k3 so that assembly code in MCA handler can compute 882 * We set ar.k3 so that assembly code in MCA handler can compute
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 308772f7cddc..c57dbce25c12 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -138,7 +138,9 @@ cpumask_t cpu_possible_map = CPU_MASK_NONE;
138EXPORT_SYMBOL(cpu_possible_map); 138EXPORT_SYMBOL(cpu_possible_map);
139 139
140cpumask_t cpu_core_map[NR_CPUS] __cacheline_aligned; 140cpumask_t cpu_core_map[NR_CPUS] __cacheline_aligned;
141cpumask_t cpu_sibling_map[NR_CPUS] __cacheline_aligned; 141DEFINE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map);
142EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
143
142int smp_num_siblings = 1; 144int smp_num_siblings = 1;
143int smp_num_cpucores = 1; 145int smp_num_cpucores = 1;
144 146
@@ -650,12 +652,12 @@ clear_cpu_sibling_map(int cpu)
650{ 652{
651 int i; 653 int i;
652 654
653 for_each_cpu_mask(i, cpu_sibling_map[cpu]) 655 for_each_cpu_mask(i, per_cpu(cpu_sibling_map, cpu))
654 cpu_clear(cpu, cpu_sibling_map[i]); 656 cpu_clear(cpu, per_cpu(cpu_sibling_map, i));
655 for_each_cpu_mask(i, cpu_core_map[cpu]) 657 for_each_cpu_mask(i, cpu_core_map[cpu])
656 cpu_clear(cpu, cpu_core_map[i]); 658 cpu_clear(cpu, cpu_core_map[i]);
657 659
658 cpu_sibling_map[cpu] = cpu_core_map[cpu] = CPU_MASK_NONE; 660 per_cpu(cpu_sibling_map, cpu) = cpu_core_map[cpu] = CPU_MASK_NONE;
659} 661}
660 662
661static void 663static void
@@ -666,7 +668,7 @@ remove_siblinginfo(int cpu)
666 if (cpu_data(cpu)->threads_per_core == 1 && 668 if (cpu_data(cpu)->threads_per_core == 1 &&
667 cpu_data(cpu)->cores_per_socket == 1) { 669 cpu_data(cpu)->cores_per_socket == 1) {
668 cpu_clear(cpu, cpu_core_map[cpu]); 670 cpu_clear(cpu, cpu_core_map[cpu]);
669 cpu_clear(cpu, cpu_sibling_map[cpu]); 671 cpu_clear(cpu, per_cpu(cpu_sibling_map, cpu));
670 return; 672 return;
671 } 673 }
672 674
@@ -807,8 +809,8 @@ set_cpu_sibling_map(int cpu)
807 cpu_set(i, cpu_core_map[cpu]); 809 cpu_set(i, cpu_core_map[cpu]);
808 cpu_set(cpu, cpu_core_map[i]); 810 cpu_set(cpu, cpu_core_map[i]);
809 if (cpu_data(cpu)->core_id == cpu_data(i)->core_id) { 811 if (cpu_data(cpu)->core_id == cpu_data(i)->core_id) {
810 cpu_set(i, cpu_sibling_map[cpu]); 812 cpu_set(i, per_cpu(cpu_sibling_map, cpu));
811 cpu_set(cpu, cpu_sibling_map[i]); 813 cpu_set(cpu, per_cpu(cpu_sibling_map, i));
812 } 814 }
813 } 815 }
814 } 816 }
@@ -839,7 +841,7 @@ __cpu_up (unsigned int cpu)
839 841
840 if (cpu_data(cpu)->threads_per_core == 1 && 842 if (cpu_data(cpu)->threads_per_core == 1 &&
841 cpu_data(cpu)->cores_per_socket == 1) { 843 cpu_data(cpu)->cores_per_socket == 1) {
842 cpu_set(cpu, cpu_sibling_map[cpu]); 844 cpu_set(cpu, per_cpu(cpu_sibling_map, cpu));
843 cpu_set(cpu, cpu_core_map[cpu]); 845 cpu_set(cpu, cpu_core_map[cpu]);
844 return 0; 846 return 0;
845 } 847 }
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index 94ae3c87d828..14261fee5f4d 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -118,11 +118,11 @@ struct cpu_cache_info {
118 struct kobject kobj; 118 struct kobject kobj;
119}; 119};
120 120
121static struct cpu_cache_info all_cpu_cache_info[NR_CPUS]; 121static struct cpu_cache_info all_cpu_cache_info[NR_CPUS] __cpuinitdata;
122#define LEAF_KOBJECT_PTR(x,y) (&all_cpu_cache_info[x].cache_leaves[y]) 122#define LEAF_KOBJECT_PTR(x,y) (&all_cpu_cache_info[x].cache_leaves[y])
123 123
124#ifdef CONFIG_SMP 124#ifdef CONFIG_SMP
125static void cache_shared_cpu_map_setup( unsigned int cpu, 125static void __cpuinit cache_shared_cpu_map_setup( unsigned int cpu,
126 struct cache_info * this_leaf) 126 struct cache_info * this_leaf)
127{ 127{
128 pal_cache_shared_info_t csi; 128 pal_cache_shared_info_t csi;
@@ -157,7 +157,7 @@ static void cache_shared_cpu_map_setup( unsigned int cpu,
157 &csi) == PAL_STATUS_SUCCESS); 157 &csi) == PAL_STATUS_SUCCESS);
158} 158}
159#else 159#else
160static void cache_shared_cpu_map_setup(unsigned int cpu, 160static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu,
161 struct cache_info * this_leaf) 161 struct cache_info * this_leaf)
162{ 162{
163 cpu_set(cpu, this_leaf->shared_cpu_map); 163 cpu_set(cpu, this_leaf->shared_cpu_map);
@@ -428,13 +428,13 @@ static struct notifier_block __cpuinitdata cache_cpu_notifier =
428 .notifier_call = cache_cpu_callback 428 .notifier_call = cache_cpu_callback
429}; 429};
430 430
431static int __cpuinit cache_sysfs_init(void) 431static int __init cache_sysfs_init(void)
432{ 432{
433 int i; 433 int i;
434 434
435 for_each_online_cpu(i) { 435 for_each_online_cpu(i) {
436 cache_cpu_callback(&cache_cpu_notifier, CPU_ONLINE, 436 struct sys_device *sys_dev = get_cpu_sysdev((unsigned int)i);
437 (void *)(long)i); 437 cache_add_dev(sys_dev);
438 } 438 }
439 439
440 register_hotcpu_notifier(&cache_cpu_notifier); 440 register_hotcpu_notifier(&cache_cpu_notifier);
diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c
index c58e933694d5..a7be4f203420 100644
--- a/arch/ia64/kernel/uncached.c
+++ b/arch/ia64/kernel/uncached.c
@@ -196,7 +196,7 @@ unsigned long uncached_alloc_page(int starting_nid)
196 nid = starting_nid; 196 nid = starting_nid;
197 197
198 do { 198 do {
199 if (!node_online(nid)) 199 if (!node_state(nid, N_HIGH_MEMORY))
200 continue; 200 continue;
201 uc_pool = &uncached_pools[nid]; 201 uc_pool = &uncached_pools[nid];
202 if (uc_pool->pool == NULL) 202 if (uc_pool->pool == NULL)
@@ -268,7 +268,7 @@ static int __init uncached_init(void)
268{ 268{
269 int nid; 269 int nid;
270 270
271 for_each_online_node(nid) { 271 for_each_node_state(nid, N_ONLINE) {
272 uncached_pools[nid].pool = gen_pool_create(PAGE_SHIFT, nid); 272 uncached_pools[nid].pool = gen_pool_create(PAGE_SHIFT, nid);
273 mutex_init(&uncached_pools[nid].add_chunk_mutex); 273 mutex_init(&uncached_pools[nid].add_chunk_mutex);
274 } 274 }
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 0d34585058c8..5628067a74d2 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -715,3 +715,11 @@ void arch_refresh_nodedata(int update_node, pg_data_t *update_pgdat)
715 scatter_node_data(); 715 scatter_node_data();
716} 716}
717#endif 717#endif
718
719#ifdef CONFIG_SPARSEMEM_VMEMMAP
720int __meminit vmemmap_populate(struct page *start_page,
721 unsigned long size, int node)
722{
723 return vmemmap_populate_basepages(start_page, size, node);
724}
725#endif
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c
index 9150ffaff9e8..32f26253c4e8 100644
--- a/arch/ia64/mm/fault.c
+++ b/arch/ia64/mm/fault.c
@@ -281,6 +281,6 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
281 } 281 }
282 printk(KERN_CRIT "VM: killing process %s\n", current->comm); 282 printk(KERN_CRIT "VM: killing process %s\n", current->comm);
283 if (user_mode(regs)) 283 if (user_mode(regs))
284 do_exit(SIGKILL); 284 do_group_exit(SIGKILL);
285 goto no_context; 285 goto no_context;
286} 286}
diff --git a/arch/ia64/mm/hugetlbpage.c b/arch/ia64/mm/hugetlbpage.c
index a9ff685aea25..d3ce8f3bcaa6 100644
--- a/arch/ia64/mm/hugetlbpage.c
+++ b/arch/ia64/mm/hugetlbpage.c
@@ -194,6 +194,6 @@ static int __init hugetlb_setup_sz(char *str)
194 * override here with new page shift. 194 * override here with new page shift.
195 */ 195 */
196 ia64_set_rr(HPAGE_REGION_BASE, hpage_shift << 2); 196 ia64_set_rr(HPAGE_REGION_BASE, hpage_shift << 2);
197 return 1; 197 return 0;
198} 198}
199__setup("hugepagesz=", hugetlb_setup_sz); 199early_param("hugepagesz", hugetlb_setup_sz);
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index c14abefabafa..3e10152abbf0 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -54,15 +54,12 @@ struct page *zero_page_memmap_ptr; /* map entry for zero page */
54EXPORT_SYMBOL(zero_page_memmap_ptr); 54EXPORT_SYMBOL(zero_page_memmap_ptr);
55 55
56void 56void
57lazy_mmu_prot_update (pte_t pte) 57__ia64_sync_icache_dcache (pte_t pte)
58{ 58{
59 unsigned long addr; 59 unsigned long addr;
60 struct page *page; 60 struct page *page;
61 unsigned long order; 61 unsigned long order;
62 62
63 if (!pte_exec(pte))
64 return; /* not an executable page... */
65
66 page = pte_page(pte); 63 page = pte_page(pte);
67 addr = (unsigned long) page_address(page); 64 addr = (unsigned long) page_address(page);
68 65
@@ -721,10 +718,21 @@ int arch_add_memory(int nid, u64 start, u64 size)
721 718
722 return ret; 719 return ret;
723} 720}
724 721#ifdef CONFIG_MEMORY_HOTREMOVE
725int remove_memory(u64 start, u64 size) 722int remove_memory(u64 start, u64 size)
726{ 723{
727 return -EINVAL; 724 unsigned long start_pfn, end_pfn;
725 unsigned long timeout = 120 * HZ;
726 int ret;
727 start_pfn = start >> PAGE_SHIFT;
728 end_pfn = start_pfn + (size >> PAGE_SHIFT);
729 ret = offline_pages(start_pfn, end_pfn, timeout);
730 if (ret)
731 goto out;
732 /* we can free mem_map at this point */
733out:
734 return ret;
728} 735}
729EXPORT_SYMBOL_GPL(remove_memory); 736EXPORT_SYMBOL_GPL(remove_memory);
737#endif /* CONFIG_MEMORY_HOTREMOVE */
730#endif 738#endif
diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c
index 5a289e4de838..a88eba3314d7 100644
--- a/arch/ia64/sn/kernel/tiocx.c
+++ b/arch/ia64/sn/kernel/tiocx.c
@@ -66,8 +66,7 @@ static int tiocx_match(struct device *dev, struct device_driver *drv)
66 66
67} 67}
68 68
69static int tiocx_uevent(struct device *dev, char **envp, int num_envp, 69static int tiocx_uevent(struct device *dev, struct kobj_uevent_env *env)
70 char *buffer, int buffer_size)
71{ 70{
72 return -ENODEV; 71 return -ENODEV;
73} 72}
diff --git a/arch/ia64/sn/pci/pci_dma.c b/arch/ia64/sn/pci/pci_dma.c
index d79ddacfba2d..ecd8a52b9b9e 100644
--- a/arch/ia64/sn/pci/pci_dma.c
+++ b/arch/ia64/sn/pci/pci_dma.c
@@ -218,16 +218,17 @@ EXPORT_SYMBOL(sn_dma_unmap_single);
218 * 218 *
219 * Unmap a set of streaming mode DMA translations. 219 * Unmap a set of streaming mode DMA translations.
220 */ 220 */
221void sn_dma_unmap_sg(struct device *dev, struct scatterlist *sg, 221void sn_dma_unmap_sg(struct device *dev, struct scatterlist *sgl,
222 int nhwentries, int direction) 222 int nhwentries, int direction)
223{ 223{
224 int i; 224 int i;
225 struct pci_dev *pdev = to_pci_dev(dev); 225 struct pci_dev *pdev = to_pci_dev(dev);
226 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); 226 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);
227 struct scatterlist *sg;
227 228
228 BUG_ON(dev->bus != &pci_bus_type); 229 BUG_ON(dev->bus != &pci_bus_type);
229 230
230 for (i = 0; i < nhwentries; i++, sg++) { 231 for_each_sg(sgl, sg, nhwentries, i) {
231 provider->dma_unmap(pdev, sg->dma_address, direction); 232 provider->dma_unmap(pdev, sg->dma_address, direction);
232 sg->dma_address = (dma_addr_t) NULL; 233 sg->dma_address = (dma_addr_t) NULL;
233 sg->dma_length = 0; 234 sg->dma_length = 0;
@@ -244,11 +245,11 @@ EXPORT_SYMBOL(sn_dma_unmap_sg);
244 * 245 *
245 * Maps each entry of @sg for DMA. 246 * Maps each entry of @sg for DMA.
246 */ 247 */
247int sn_dma_map_sg(struct device *dev, struct scatterlist *sg, int nhwentries, 248int sn_dma_map_sg(struct device *dev, struct scatterlist *sgl, int nhwentries,
248 int direction) 249 int direction)
249{ 250{
250 unsigned long phys_addr; 251 unsigned long phys_addr;
251 struct scatterlist *saved_sg = sg; 252 struct scatterlist *saved_sg = sgl, *sg;
252 struct pci_dev *pdev = to_pci_dev(dev); 253 struct pci_dev *pdev = to_pci_dev(dev);
253 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); 254 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);
254 int i; 255 int i;
@@ -258,7 +259,7 @@ int sn_dma_map_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
258 /* 259 /*
259 * Setup a DMA address for each entry in the scatterlist. 260 * Setup a DMA address for each entry in the scatterlist.
260 */ 261 */
261 for (i = 0; i < nhwentries; i++, sg++) { 262 for_each_sg(sgl, sg, nhwentries, i) {
262 phys_addr = SG_ENT_PHYS_ADDRESS(sg); 263 phys_addr = SG_ENT_PHYS_ADDRESS(sg);
263 sg->dma_address = provider->dma_map(pdev, 264 sg->dma_address = provider->dma_map(pdev,
264 phys_addr, sg->length, 265 phys_addr, sg->length,
diff --git a/arch/m32r/kernel/ptrace.c b/arch/m32r/kernel/ptrace.c
index 62a51429306e..ed4d0756c5db 100644
--- a/arch/m32r/kernel/ptrace.c
+++ b/arch/m32r/kernel/ptrace.c
@@ -570,7 +570,7 @@ withdraw_debug_trap(struct pt_regs *regs)
570 } 570 }
571} 571}
572 572
573static void 573void
574init_debug_traps(struct task_struct *child) 574init_debug_traps(struct task_struct *child)
575{ 575{
576 struct debug_trap *p = &child->thread.debug_trap; 576 struct debug_trap *p = &child->thread.debug_trap;
@@ -593,8 +593,8 @@ void ptrace_disable(struct task_struct *child)
593 /* nothing to do.. */ 593 /* nothing to do.. */
594} 594}
595 595
596static int 596long
597do_ptrace(long request, struct task_struct *child, long addr, long data) 597arch_ptrace(struct task_struct *child, long request, long addr, long data)
598{ 598{
599 int ret; 599 int ret;
600 600
@@ -704,14 +704,6 @@ do_ptrace(long request, struct task_struct *child, long addr, long data)
704 break; 704 break;
705 } 705 }
706 706
707 /*
708 * detach a process that was attached.
709 */
710 case PTRACE_DETACH:
711 ret = 0;
712 ret = ptrace_detach(child, data);
713 break;
714
715 case PTRACE_GETREGS: 707 case PTRACE_GETREGS:
716 ret = ptrace_getregs(child, (void __user *)data); 708 ret = ptrace_getregs(child, (void __user *)data);
717 break; 709 break;
@@ -728,42 +720,6 @@ do_ptrace(long request, struct task_struct *child, long addr, long data)
728 return ret; 720 return ret;
729} 721}
730 722
731asmlinkage long sys_ptrace(long request, long pid, long addr, long data)
732{
733 struct task_struct *child;
734 int ret;
735
736 lock_kernel();
737 if (request == PTRACE_TRACEME) {
738 ret = ptrace_traceme();
739 goto out;
740 }
741
742 child = ptrace_get_task_struct(pid);
743 if (IS_ERR(child)) {
744 ret = PTR_ERR(child);
745 goto out;
746 }
747
748 if (request == PTRACE_ATTACH) {
749 ret = ptrace_attach(child);
750 if (ret == 0)
751 init_debug_traps(child);
752 goto out_tsk;
753 }
754
755 ret = ptrace_check_attach(child, request == PTRACE_KILL);
756 if (ret == 0)
757 ret = do_ptrace(request, child, addr, data);
758
759out_tsk:
760 put_task_struct(child);
761out:
762 unlock_kernel();
763
764 return ret;
765}
766
767/* notification of system call entry/exit 723/* notification of system call entry/exit
768 * - triggered by current->work.syscall_trace 724 * - triggered by current->work.syscall_trace
769 */ 725 */
diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c
index 3858c9f39ba5..994cc1556355 100644
--- a/arch/m32r/kernel/time.c
+++ b/arch/m32r/kernel/time.c
@@ -228,8 +228,12 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
228 return IRQ_HANDLED; 228 return IRQ_HANDLED;
229} 229}
230 230
231struct irqaction irq0 = { timer_interrupt, IRQF_DISABLED, CPU_MASK_NONE, 231struct irqaction irq0 = {
232 "MFT2", NULL, NULL }; 232 .handler = timer_interrupt,
233 .flags = IRQF_DISABLED,
234 .mask = CPU_MASK_NONE,
235 .name = "MFT2",
236};
233 237
234void __init time_init(void) 238void __init time_init(void)
235{ 239{
diff --git a/arch/m32r/mm/fault.c b/arch/m32r/mm/fault.c
index 676a1c443d28..70a766aad3e0 100644
--- a/arch/m32r/mm/fault.c
+++ b/arch/m32r/mm/fault.c
@@ -278,7 +278,7 @@ out_of_memory:
278 } 278 }
279 printk("VM: killing process %s\n", tsk->comm); 279 printk("VM: killing process %s\n", tsk->comm);
280 if (error_code & ACE_USERMODE) 280 if (error_code & ACE_USERMODE)
281 do_exit(SIGKILL); 281 do_group_exit(SIGKILL);
282 goto no_context; 282 goto no_context;
283 283
284do_sigbus: 284do_sigbus:
diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c
index 2b5f64726a2e..880add120eb3 100644
--- a/arch/m68k/atari/atakeyb.c
+++ b/arch/m68k/atari/atakeyb.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/atari/atakeyb.c
3 *
4 * Atari Keyboard driver for 680x0 Linux 2 * Atari Keyboard driver for 680x0 Linux
5 * 3 *
6 * This file is subject to the terms and conditions of the GNU General Public 4 * This file is subject to the terms and conditions of the GNU General Public
@@ -11,6 +9,9 @@
11/* 9/*
12 * Atari support by Robert de Vries 10 * Atari support by Robert de Vries
13 * enhanced by Bjoern Brauel and Roman Hodek 11 * enhanced by Bjoern Brauel and Roman Hodek
12 *
13 * 2.6 and input cleanup (removed autorepeat stuff) for 2.6.21
14 * 06/07 Michael Schmitz
14 */ 15 */
15 16
16#include <linux/module.h> 17#include <linux/module.h>
@@ -32,7 +33,6 @@
32#include <asm/atari_joystick.h> 33#include <asm/atari_joystick.h>
33#include <asm/irq.h> 34#include <asm/irq.h>
34 35
35static void atakeyb_rep(unsigned long ignore);
36extern unsigned int keymap_count; 36extern unsigned int keymap_count;
37 37
38/* Hook for MIDI serial driver */ 38/* Hook for MIDI serial driver */
@@ -104,25 +104,6 @@ static unsigned long broken_keys[128/(sizeof(unsigned long)*8)] = { 0, };
104 * - Keypad Left/Right Parenthesis mapped to new K_PPAREN[LR] 104 * - Keypad Left/Right Parenthesis mapped to new K_PPAREN[LR]
105 */ 105 */
106 106
107static u_short ataplain_map[NR_KEYS] __initdata = {
108 0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
109 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf008, 0xf009,
110 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
111 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73,
112 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b,
113 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
114 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf200,
115 0xf703, 0xf020, 0xf207, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
116 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf200, 0xf200, 0xf114,
117 0xf603, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200,
118 0xf600, 0xf200, 0xf115, 0xf07f, 0xf200, 0xf200, 0xf200, 0xf200,
119 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
120 0xf200, 0xf1ff, 0xf11b, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf307,
121 0xf308, 0xf309, 0xf304, 0xf305, 0xf306, 0xf301, 0xf302, 0xf303,
122 0xf300, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
123 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
124};
125
126typedef enum kb_state_t { 107typedef enum kb_state_t {
127 KEYBOARD, AMOUSE, RMOUSE, JOYSTICK, CLOCK, RESYNC 108 KEYBOARD, AMOUSE, RMOUSE, JOYSTICK, CLOCK, RESYNC
128} KB_STATE_T; 109} KB_STATE_T;
@@ -137,41 +118,6 @@ typedef struct keyboard_state {
137 118
138KEYBOARD_STATE kb_state; 119KEYBOARD_STATE kb_state;
139 120
140#define DEFAULT_KEYB_REP_DELAY (HZ/4)
141#define DEFAULT_KEYB_REP_RATE (HZ/25)
142
143/* These could be settable by some ioctl() in future... */
144static unsigned int key_repeat_delay = DEFAULT_KEYB_REP_DELAY;
145static unsigned int key_repeat_rate = DEFAULT_KEYB_REP_RATE;
146
147static unsigned char rep_scancode;
148static struct timer_list atakeyb_rep_timer = {
149 .function = atakeyb_rep,
150};
151
152static void atakeyb_rep(unsigned long ignore)
153{
154 /* Disable keyboard for the time we call handle_scancode(), else a race
155 * in the keyboard tty queue may happen */
156 atari_disable_irq(IRQ_MFP_ACIA);
157 del_timer(&atakeyb_rep_timer);
158
159 /* A keyboard int may have come in before we disabled the irq, so
160 * double-check whether rep_scancode is still != 0 */
161 if (rep_scancode) {
162 init_timer(&atakeyb_rep_timer);
163 atakeyb_rep_timer.expires = jiffies + key_repeat_rate;
164 add_timer(&atakeyb_rep_timer);
165
166 //handle_scancode(rep_scancode, 1);
167 if (atari_input_keyboard_interrupt_hook)
168 atari_input_keyboard_interrupt_hook(rep_scancode, 1);
169 }
170
171 atari_enable_irq(IRQ_MFP_ACIA);
172}
173
174
175/* ++roman: If a keyboard overrun happened, we can't tell in general how much 121/* ++roman: If a keyboard overrun happened, we can't tell in general how much
176 * bytes have been lost and in which state of the packet structure we are now. 122 * bytes have been lost and in which state of the packet structure we are now.
177 * This usually causes keyboards bytes to be interpreted as mouse movements 123 * This usually causes keyboards bytes to be interpreted as mouse movements
@@ -209,9 +155,6 @@ repeat:
209 /* ...happens often if interrupts were disabled for too long */ 155 /* ...happens often if interrupts were disabled for too long */
210 printk(KERN_DEBUG "Keyboard overrun\n"); 156 printk(KERN_DEBUG "Keyboard overrun\n");
211 scancode = acia.key_data; 157 scancode = acia.key_data;
212 /* Turn off autorepeating in case a break code has been lost */
213 del_timer(&atakeyb_rep_timer);
214 rep_scancode = 0;
215 if (ikbd_self_test) 158 if (ikbd_self_test)
216 /* During self test, don't do resyncing, just process the code */ 159 /* During self test, don't do resyncing, just process the code */
217 goto interpret_scancode; 160 goto interpret_scancode;
@@ -281,11 +224,12 @@ repeat:
281 * make codes instead. Therefore, simply ignore 224 * make codes instead. Therefore, simply ignore
282 * break_flag... 225 * break_flag...
283 */ 226 */
284 int keyval = plain_map[scancode], keytyp; 227 int keyval, keytyp;
285 228
286 set_bit(scancode, broken_keys); 229 set_bit(scancode, broken_keys);
287 self_test_last_rcv = jiffies; 230 self_test_last_rcv = jiffies;
288 keyval = plain_map[scancode]; 231 /* new Linux scancodes; approx. */
232 keyval = scancode;
289 keytyp = KTYP(keyval) - 0xf0; 233 keytyp = KTYP(keyval) - 0xf0;
290 keyval = KVAL(keyval); 234 keyval = KVAL(keyval);
291 235
@@ -301,19 +245,6 @@ repeat:
301 } else if (test_bit(scancode, broken_keys)) 245 } else if (test_bit(scancode, broken_keys))
302 break; 246 break;
303 247
304#if 0 // FIXME; hangs at boot
305 if (break_flag) {
306 del_timer(&atakeyb_rep_timer);
307 rep_scancode = 0;
308 } else {
309 del_timer(&atakeyb_rep_timer);
310 rep_scancode = scancode;
311 atakeyb_rep_timer.expires = jiffies + key_repeat_delay;
312 add_timer(&atakeyb_rep_timer);
313 }
314#endif
315
316 // handle_scancode(scancode, !break_flag);
317 if (atari_input_keyboard_interrupt_hook) 248 if (atari_input_keyboard_interrupt_hook)
318 atari_input_keyboard_interrupt_hook((unsigned char)scancode, !break_flag); 249 atari_input_keyboard_interrupt_hook((unsigned char)scancode, !break_flag);
319 break; 250 break;
@@ -639,9 +570,6 @@ int __init atari_keyb_init(void)
639 if (atari_keyb_done) 570 if (atari_keyb_done)
640 return 0; 571 return 0;
641 572
642 /* setup key map */
643 memcpy(key_maps[0], ataplain_map, sizeof(plain_map));
644
645 kb_state.state = KEYBOARD; 573 kb_state.state = KEYBOARD;
646 kb_state.len = 0; 574 kb_state.len = 0;
647 575
@@ -704,26 +632,6 @@ int __init atari_keyb_init(void)
704 return 0; 632 return 0;
705} 633}
706 634
707int atari_kbdrate(struct kbd_repeat *k)
708{
709 if (k->delay > 0) {
710 /* convert from msec to jiffies */
711 key_repeat_delay = (k->delay * HZ + 500) / 1000;
712 if (key_repeat_delay < 1)
713 key_repeat_delay = 1;
714 }
715 if (k->period > 0) {
716 key_repeat_rate = (k->period * HZ + 500) / 1000;
717 if (key_repeat_rate < 1)
718 key_repeat_rate = 1;
719 }
720
721 k->delay = key_repeat_delay * 1000 / HZ;
722 k->period = key_repeat_rate * 1000 / HZ;
723
724 return 0;
725}
726
727int atari_kbd_translate(unsigned char keycode, unsigned char *keycodep, char raw_mode) 635int atari_kbd_translate(unsigned char keycode, unsigned char *keycodep, char raw_mode)
728{ 636{
729#ifdef CONFIG_MAGIC_SYSRQ 637#ifdef CONFIG_MAGIC_SYSRQ
diff --git a/arch/m68k/kernel/ptrace.c b/arch/m68k/kernel/ptrace.c
index e792d3cba4c7..2075543c2d92 100644
--- a/arch/m68k/kernel/ptrace.c
+++ b/arch/m68k/kernel/ptrace.c
@@ -226,10 +226,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
226 wake_up_process(child); 226 wake_up_process(child);
227 break; 227 break;
228 228
229 case PTRACE_DETACH: /* detach a process that was attached. */
230 ret = ptrace_detach(child, data);
231 break;
232
233 case PTRACE_GETREGS: /* Get all gp regs from the child. */ 229 case PTRACE_GETREGS: /* Get all gp regs from the child. */
234 for (i = 0; i < 19; i++) { 230 for (i = 0; i < 19; i++) {
235 tmp = get_reg(child, i); 231 tmp = get_reg(child, i);
diff --git a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c
index 578b48f47b9e..eaa618681159 100644
--- a/arch/m68k/mm/fault.c
+++ b/arch/m68k/mm/fault.c
@@ -188,7 +188,7 @@ out_of_memory:
188 188
189 printk("VM: killing process %s\n", current->comm); 189 printk("VM: killing process %s\n", current->comm);
190 if (user_mode(regs)) 190 if (user_mode(regs))
191 do_exit(SIGKILL); 191 do_group_exit(SIGKILL);
192 192
193no_context: 193no_context:
194 current->thread.signo = SIGBUS; 194 current->thread.signo = SIGBUS;
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index f943736541cb..235d4514e0a9 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -133,6 +133,7 @@ config LASAT
133 select DMA_NONCOHERENT 133 select DMA_NONCOHERENT
134 select SYS_HAS_EARLY_PRINTK 134 select SYS_HAS_EARLY_PRINTK
135 select HW_HAS_PCI 135 select HW_HAS_PCI
136 select IRQ_CPU
136 select PCI_GT64XXX_PCI0 137 select PCI_GT64XXX_PCI0
137 select MIPS_NILE4 138 select MIPS_NILE4
138 select R5000_CPU_SCACHE 139 select R5000_CPU_SCACHE
@@ -410,6 +411,7 @@ config SGI_IP32
410 select BOOT_ELF32 411 select BOOT_ELF32
411 select DMA_NONCOHERENT 412 select DMA_NONCOHERENT
412 select HW_HAS_PCI 413 select HW_HAS_PCI
414 select IRQ_CPU
413 select R5000_CPU_SCACHE 415 select R5000_CPU_SCACHE
414 select RM7000_CPU_SCACHE 416 select RM7000_CPU_SCACHE
415 select SYS_HAS_CPU_R5000 417 select SYS_HAS_CPU_R5000
diff --git a/arch/mips/au1000/common/au1xxx_irqmap.c b/arch/mips/au1000/common/au1xxx_irqmap.c
index 7acfe9bf5fc3..98a4e34b0248 100644
--- a/arch/mips/au1000/common/au1xxx_irqmap.c
+++ b/arch/mips/au1000/common/au1xxx_irqmap.c
@@ -54,7 +54,7 @@
54 * Careful if you change match 2 request! 54 * Careful if you change match 2 request!
55 * The interrupt handler is called directly from the low level dispatch code. 55 * The interrupt handler is called directly from the low level dispatch code.
56 */ 56 */
57au1xxx_irq_map_t __initdata au1xxx_ic0_map[] = { 57struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
58 58
59#if defined(CONFIG_SOC_AU1000) 59#if defined(CONFIG_SOC_AU1000)
60 { AU1000_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 60 { AU1000_UART0_INT, INTC_INT_HIGH_LEVEL, 0},
diff --git a/arch/mips/au1000/common/dbdma.c b/arch/mips/au1000/common/dbdma.c
index 461cf0139737..9d6ad43fded6 100644
--- a/arch/mips/au1000/common/dbdma.c
+++ b/arch/mips/au1000/common/dbdma.c
@@ -859,7 +859,7 @@ dbdma_interrupt(int irq, void *dev_id)
859 859
860 intstat = dbdma_gptr->ddma_intstat; 860 intstat = dbdma_gptr->ddma_intstat;
861 au_sync(); 861 au_sync();
862 chan_index = au_ffs(intstat) - 1; 862 chan_index = ffs(intstat);
863 863
864 ctp = chan_tab_ptr[chan_index]; 864 ctp = chan_tab_ptr[chan_index];
865 cp = ctp->chan_ptr; 865 cp = ctp->chan_ptr;
diff --git a/arch/mips/au1000/common/irq.c b/arch/mips/au1000/common/irq.c
index a6640b998c6e..c00f308fd505 100644
--- a/arch/mips/au1000/common/irq.c
+++ b/arch/mips/au1000/common/irq.c
@@ -26,39 +26,18 @@
26 * with this program; if not, write to the Free Software Foundation, Inc., 26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA. 27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 */ 28 */
29#include <linux/errno.h> 29#include <linux/bitops.h>
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/irq.h> 31#include <linux/io.h>
32#include <linux/kernel_stat.h>
33#include <linux/module.h>
34#include <linux/signal.h>
35#include <linux/sched.h>
36#include <linux/types.h>
37#include <linux/interrupt.h> 32#include <linux/interrupt.h>
38#include <linux/ioport.h> 33#include <linux/irq.h>
39#include <linux/timex.h>
40#include <linux/slab.h>
41#include <linux/random.h>
42#include <linux/delay.h>
43#include <linux/bitops.h>
44 34
45#include <asm/bootinfo.h>
46#include <asm/io.h>
47#include <asm/mipsregs.h> 35#include <asm/mipsregs.h>
48#include <asm/system.h>
49#include <asm/mach-au1x00/au1000.h> 36#include <asm/mach-au1x00/au1000.h>
50#ifdef CONFIG_MIPS_PB1000 37#ifdef CONFIG_MIPS_PB1000
51#include <asm/mach-pb1x00/pb1000.h> 38#include <asm/mach-pb1x00/pb1000.h>
52#endif 39#endif
53 40
54#undef DEBUG_IRQ
55#ifdef DEBUG_IRQ
56/* note: prints function name for you */
57#define DPRINTK(fmt, args...) printk("%s: " fmt, __FUNCTION__ , ## args)
58#else
59#define DPRINTK(fmt, args...)
60#endif
61
62#define EXT_INTC0_REQ0 2 /* IP 2 */ 41#define EXT_INTC0_REQ0 2 /* IP 2 */
63#define EXT_INTC0_REQ1 3 /* IP 3 */ 42#define EXT_INTC0_REQ1 3 /* IP 3 */
64#define EXT_INTC1_REQ0 4 /* IP 4 */ 43#define EXT_INTC1_REQ0 4 /* IP 4 */
@@ -69,16 +48,98 @@ void (*board_init_irq)(void);
69 48
70static DEFINE_SPINLOCK(irq_lock); 49static DEFINE_SPINLOCK(irq_lock);
71 50
51#ifdef CONFIG_PM
52
53/*
54 * Save/restore the interrupt controller state.
55 * Called from the save/restore core registers as part of the
56 * au_sleep function in power.c.....maybe I should just pm_register()
57 * them instead?
58 */
59static unsigned int sleep_intctl_config0[2];
60static unsigned int sleep_intctl_config1[2];
61static unsigned int sleep_intctl_config2[2];
62static unsigned int sleep_intctl_src[2];
63static unsigned int sleep_intctl_assign[2];
64static unsigned int sleep_intctl_wake[2];
65static unsigned int sleep_intctl_mask[2];
66
67void save_au1xxx_intctl(void)
68{
69 sleep_intctl_config0[0] = au_readl(IC0_CFG0RD);
70 sleep_intctl_config1[0] = au_readl(IC0_CFG1RD);
71 sleep_intctl_config2[0] = au_readl(IC0_CFG2RD);
72 sleep_intctl_src[0] = au_readl(IC0_SRCRD);
73 sleep_intctl_assign[0] = au_readl(IC0_ASSIGNRD);
74 sleep_intctl_wake[0] = au_readl(IC0_WAKERD);
75 sleep_intctl_mask[0] = au_readl(IC0_MASKRD);
76
77 sleep_intctl_config0[1] = au_readl(IC1_CFG0RD);
78 sleep_intctl_config1[1] = au_readl(IC1_CFG1RD);
79 sleep_intctl_config2[1] = au_readl(IC1_CFG2RD);
80 sleep_intctl_src[1] = au_readl(IC1_SRCRD);
81 sleep_intctl_assign[1] = au_readl(IC1_ASSIGNRD);
82 sleep_intctl_wake[1] = au_readl(IC1_WAKERD);
83 sleep_intctl_mask[1] = au_readl(IC1_MASKRD);
84}
85
86/*
87 * For most restore operations, we clear the entire register and
88 * then set the bits we found during the save.
89 */
90void restore_au1xxx_intctl(void)
91{
92 au_writel(0xffffffff, IC0_MASKCLR); au_sync();
93
94 au_writel(0xffffffff, IC0_CFG0CLR); au_sync();
95 au_writel(sleep_intctl_config0[0], IC0_CFG0SET); au_sync();
96 au_writel(0xffffffff, IC0_CFG1CLR); au_sync();
97 au_writel(sleep_intctl_config1[0], IC0_CFG1SET); au_sync();
98 au_writel(0xffffffff, IC0_CFG2CLR); au_sync();
99 au_writel(sleep_intctl_config2[0], IC0_CFG2SET); au_sync();
100 au_writel(0xffffffff, IC0_SRCCLR); au_sync();
101 au_writel(sleep_intctl_src[0], IC0_SRCSET); au_sync();
102 au_writel(0xffffffff, IC0_ASSIGNCLR); au_sync();
103 au_writel(sleep_intctl_assign[0], IC0_ASSIGNSET); au_sync();
104 au_writel(0xffffffff, IC0_WAKECLR); au_sync();
105 au_writel(sleep_intctl_wake[0], IC0_WAKESET); au_sync();
106 au_writel(0xffffffff, IC0_RISINGCLR); au_sync();
107 au_writel(0xffffffff, IC0_FALLINGCLR); au_sync();
108 au_writel(0x00000000, IC0_TESTBIT); au_sync();
109
110 au_writel(0xffffffff, IC1_MASKCLR); au_sync();
111
112 au_writel(0xffffffff, IC1_CFG0CLR); au_sync();
113 au_writel(sleep_intctl_config0[1], IC1_CFG0SET); au_sync();
114 au_writel(0xffffffff, IC1_CFG1CLR); au_sync();
115 au_writel(sleep_intctl_config1[1], IC1_CFG1SET); au_sync();
116 au_writel(0xffffffff, IC1_CFG2CLR); au_sync();
117 au_writel(sleep_intctl_config2[1], IC1_CFG2SET); au_sync();
118 au_writel(0xffffffff, IC1_SRCCLR); au_sync();
119 au_writel(sleep_intctl_src[1], IC1_SRCSET); au_sync();
120 au_writel(0xffffffff, IC1_ASSIGNCLR); au_sync();
121 au_writel(sleep_intctl_assign[1], IC1_ASSIGNSET); au_sync();
122 au_writel(0xffffffff, IC1_WAKECLR); au_sync();
123 au_writel(sleep_intctl_wake[1], IC1_WAKESET); au_sync();
124 au_writel(0xffffffff, IC1_RISINGCLR); au_sync();
125 au_writel(0xffffffff, IC1_FALLINGCLR); au_sync();
126 au_writel(0x00000000, IC1_TESTBIT); au_sync();
127
128 au_writel(sleep_intctl_mask[1], IC1_MASKSET); au_sync();
129
130 au_writel(sleep_intctl_mask[0], IC0_MASKSET); au_sync();
131}
132#endif /* CONFIG_PM */
133
72 134
73inline void local_enable_irq(unsigned int irq_nr) 135inline void local_enable_irq(unsigned int irq_nr)
74{ 136{
75 if (irq_nr > AU1000_LAST_INTC0_INT) { 137 if (irq_nr > AU1000_LAST_INTC0_INT) {
76 au_writel(1<<(irq_nr-32), IC1_MASKSET); 138 au_writel(1 << (irq_nr - 32), IC1_MASKSET);
77 au_writel(1<<(irq_nr-32), IC1_WAKESET); 139 au_writel(1 << (irq_nr - 32), IC1_WAKESET);
78 } 140 } else {
79 else { 141 au_writel(1 << irq_nr, IC0_MASKSET);
80 au_writel(1<<irq_nr, IC0_MASKSET); 142 au_writel(1 << irq_nr, IC0_WAKESET);
81 au_writel(1<<irq_nr, IC0_WAKESET);
82 } 143 }
83 au_sync(); 144 au_sync();
84} 145}
@@ -87,12 +148,11 @@ inline void local_enable_irq(unsigned int irq_nr)
87inline void local_disable_irq(unsigned int irq_nr) 148inline void local_disable_irq(unsigned int irq_nr)
88{ 149{
89 if (irq_nr > AU1000_LAST_INTC0_INT) { 150 if (irq_nr > AU1000_LAST_INTC0_INT) {
90 au_writel(1<<(irq_nr-32), IC1_MASKCLR); 151 au_writel(1 << (irq_nr - 32), IC1_MASKCLR);
91 au_writel(1<<(irq_nr-32), IC1_WAKECLR); 152 au_writel(1 << (irq_nr - 32), IC1_WAKECLR);
92 } 153 } else {
93 else { 154 au_writel(1 << irq_nr, IC0_MASKCLR);
94 au_writel(1<<irq_nr, IC0_MASKCLR); 155 au_writel(1 << irq_nr, IC0_WAKECLR);
95 au_writel(1<<irq_nr, IC0_WAKECLR);
96 } 156 }
97 au_sync(); 157 au_sync();
98} 158}
@@ -101,12 +161,11 @@ inline void local_disable_irq(unsigned int irq_nr)
101static inline void mask_and_ack_rise_edge_irq(unsigned int irq_nr) 161static inline void mask_and_ack_rise_edge_irq(unsigned int irq_nr)
102{ 162{
103 if (irq_nr > AU1000_LAST_INTC0_INT) { 163 if (irq_nr > AU1000_LAST_INTC0_INT) {
104 au_writel(1<<(irq_nr-32), IC1_RISINGCLR); 164 au_writel(1 << (irq_nr - 32), IC1_RISINGCLR);
105 au_writel(1<<(irq_nr-32), IC1_MASKCLR); 165 au_writel(1 << (irq_nr - 32), IC1_MASKCLR);
106 } 166 } else {
107 else { 167 au_writel(1 << irq_nr, IC0_RISINGCLR);
108 au_writel(1<<irq_nr, IC0_RISINGCLR); 168 au_writel(1 << irq_nr, IC0_MASKCLR);
109 au_writel(1<<irq_nr, IC0_MASKCLR);
110 } 169 }
111 au_sync(); 170 au_sync();
112} 171}
@@ -115,12 +174,11 @@ static inline void mask_and_ack_rise_edge_irq(unsigned int irq_nr)
115static inline void mask_and_ack_fall_edge_irq(unsigned int irq_nr) 174static inline void mask_and_ack_fall_edge_irq(unsigned int irq_nr)
116{ 175{
117 if (irq_nr > AU1000_LAST_INTC0_INT) { 176 if (irq_nr > AU1000_LAST_INTC0_INT) {
118 au_writel(1<<(irq_nr-32), IC1_FALLINGCLR); 177 au_writel(1 << (irq_nr - 32), IC1_FALLINGCLR);
119 au_writel(1<<(irq_nr-32), IC1_MASKCLR); 178 au_writel(1 << (irq_nr - 32), IC1_MASKCLR);
120 } 179 } else {
121 else { 180 au_writel(1 << irq_nr, IC0_FALLINGCLR);
122 au_writel(1<<irq_nr, IC0_FALLINGCLR); 181 au_writel(1 << irq_nr, IC0_MASKCLR);
123 au_writel(1<<irq_nr, IC0_MASKCLR);
124 } 182 }
125 au_sync(); 183 au_sync();
126} 184}
@@ -132,14 +190,13 @@ static inline void mask_and_ack_either_edge_irq(unsigned int irq_nr)
132 * both edges at once, or if we do, that we don't care. 190 * both edges at once, or if we do, that we don't care.
133 */ 191 */
134 if (irq_nr > AU1000_LAST_INTC0_INT) { 192 if (irq_nr > AU1000_LAST_INTC0_INT) {
135 au_writel(1<<(irq_nr-32), IC1_FALLINGCLR); 193 au_writel(1 << (irq_nr - 32), IC1_FALLINGCLR);
136 au_writel(1<<(irq_nr-32), IC1_RISINGCLR); 194 au_writel(1 << (irq_nr - 32), IC1_RISINGCLR);
137 au_writel(1<<(irq_nr-32), IC1_MASKCLR); 195 au_writel(1 << (irq_nr - 32), IC1_MASKCLR);
138 } 196 } else {
139 else { 197 au_writel(1 << irq_nr, IC0_FALLINGCLR);
140 au_writel(1<<irq_nr, IC0_FALLINGCLR); 198 au_writel(1 << irq_nr, IC0_RISINGCLR);
141 au_writel(1<<irq_nr, IC0_RISINGCLR); 199 au_writel(1 << irq_nr, IC0_MASKCLR);
142 au_writel(1<<irq_nr, IC0_MASKCLR);
143 } 200 }
144 au_sync(); 201 au_sync();
145} 202}
@@ -162,9 +219,9 @@ static inline void mask_and_ack_level_irq(unsigned int irq_nr)
162 219
163static void end_irq(unsigned int irq_nr) 220static void end_irq(unsigned int irq_nr)
164{ 221{
165 if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))) { 222 if (!(irq_desc[irq_nr].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
166 local_enable_irq(irq_nr); 223 local_enable_irq(irq_nr);
167 } 224
168#if defined(CONFIG_MIPS_PB1000) 225#if defined(CONFIG_MIPS_PB1000)
169 if (irq_nr == AU1000_GPIO_15) { 226 if (irq_nr == AU1000_GPIO_15) {
170 au_writel(0x4000, PB1000_MDR); /* enable int */ 227 au_writel(0x4000, PB1000_MDR); /* enable int */
@@ -181,15 +238,12 @@ unsigned long save_local_and_disable(int controller)
181 spin_lock_irqsave(&irq_lock, flags); 238 spin_lock_irqsave(&irq_lock, flags);
182 if (controller) { 239 if (controller) {
183 mask = au_readl(IC1_MASKSET); 240 mask = au_readl(IC1_MASKSET);
184 for (i=32; i<64; i++) { 241 for (i = 32; i < 64; i++)
185 local_disable_irq(i); 242 local_disable_irq(i);
186 } 243 } else {
187 }
188 else {
189 mask = au_readl(IC0_MASKSET); 244 mask = au_readl(IC0_MASKSET);
190 for (i=0; i<32; i++) { 245 for (i = 0; i < 32; i++)
191 local_disable_irq(i); 246 local_disable_irq(i);
192 }
193 } 247 }
194 spin_unlock_irqrestore(&irq_lock, flags); 248 spin_unlock_irqrestore(&irq_lock, flags);
195 249
@@ -202,10 +256,10 @@ void restore_local_and_enable(int controller, unsigned long mask)
202 unsigned long flags, new_mask; 256 unsigned long flags, new_mask;
203 257
204 spin_lock_irqsave(&irq_lock, flags); 258 spin_lock_irqsave(&irq_lock, flags);
205 for (i=0; i<32; i++) { 259 for (i = 0; i < 32; i++) {
206 if (mask & (1<<i)) { 260 if (mask & (1 << i)) {
207 if (controller) 261 if (controller)
208 local_enable_irq(i+32); 262 local_enable_irq(i + 32);
209 else 263 else
210 local_enable_irq(i); 264 local_enable_irq(i);
211 } 265 }
@@ -220,39 +274,39 @@ void restore_local_and_enable(int controller, unsigned long mask)
220 274
221 275
222static struct irq_chip rise_edge_irq_type = { 276static struct irq_chip rise_edge_irq_type = {
223 .name = "Au1000 Rise Edge", 277 .name = "Au1000 Rise Edge",
224 .ack = mask_and_ack_rise_edge_irq, 278 .ack = mask_and_ack_rise_edge_irq,
225 .mask = local_disable_irq, 279 .mask = local_disable_irq,
226 .mask_ack = mask_and_ack_rise_edge_irq, 280 .mask_ack = mask_and_ack_rise_edge_irq,
227 .unmask = local_enable_irq, 281 .unmask = local_enable_irq,
228 .end = end_irq, 282 .end = end_irq,
229}; 283};
230 284
231static struct irq_chip fall_edge_irq_type = { 285static struct irq_chip fall_edge_irq_type = {
232 .name = "Au1000 Fall Edge", 286 .name = "Au1000 Fall Edge",
233 .ack = mask_and_ack_fall_edge_irq, 287 .ack = mask_and_ack_fall_edge_irq,
234 .mask = local_disable_irq, 288 .mask = local_disable_irq,
235 .mask_ack = mask_and_ack_fall_edge_irq, 289 .mask_ack = mask_and_ack_fall_edge_irq,
236 .unmask = local_enable_irq, 290 .unmask = local_enable_irq,
237 .end = end_irq, 291 .end = end_irq,
238}; 292};
239 293
240static struct irq_chip either_edge_irq_type = { 294static struct irq_chip either_edge_irq_type = {
241 .name = "Au1000 Rise or Fall Edge", 295 .name = "Au1000 Rise or Fall Edge",
242 .ack = mask_and_ack_either_edge_irq, 296 .ack = mask_and_ack_either_edge_irq,
243 .mask = local_disable_irq, 297 .mask = local_disable_irq,
244 .mask_ack = mask_and_ack_either_edge_irq, 298 .mask_ack = mask_and_ack_either_edge_irq,
245 .unmask = local_enable_irq, 299 .unmask = local_enable_irq,
246 .end = end_irq, 300 .end = end_irq,
247}; 301};
248 302
249static struct irq_chip level_irq_type = { 303static struct irq_chip level_irq_type = {
250 .name = "Au1000 Level", 304 .name = "Au1000 Level",
251 .ack = mask_and_ack_level_irq, 305 .ack = mask_and_ack_level_irq,
252 .mask = local_disable_irq, 306 .mask = local_disable_irq,
253 .mask_ack = mask_and_ack_level_irq, 307 .mask_ack = mask_and_ack_level_irq,
254 .unmask = local_enable_irq, 308 .unmask = local_enable_irq,
255 .end = end_irq, 309 .end = end_irq,
256}; 310};
257 311
258#ifdef CONFIG_PM 312#ifdef CONFIG_PM
@@ -263,7 +317,8 @@ void startup_match20_interrupt(irq_handler_t handler)
263 static struct irqaction action; 317 static struct irqaction action;
264 memset(&action, 0, sizeof(struct irqaction)); 318 memset(&action, 0, sizeof(struct irqaction));
265 319
266 /* This is a big problem.... since we didn't use request_irq 320 /*
321 * This is a big problem.... since we didn't use request_irq
267 * when kernel/irq.c calls probe_irq_xxx this interrupt will 322 * when kernel/irq.c calls probe_irq_xxx this interrupt will
268 * be probed for usage. This will end up disabling the device :( 323 * be probed for usage. This will end up disabling the device :(
269 * Give it a bogus "action" pointer -- this will keep it from 324 * Give it a bogus "action" pointer -- this will keep it from
@@ -292,173 +347,112 @@ static void setup_local_irq(unsigned int irq_nr, int type, int int_req)
292 /* Config2[n], Config1[n], Config0[n] */ 347 /* Config2[n], Config1[n], Config0[n] */
293 if (irq_nr > AU1000_LAST_INTC0_INT) { 348 if (irq_nr > AU1000_LAST_INTC0_INT) {
294 switch (type) { 349 switch (type) {
295 case INTC_INT_RISE_EDGE: /* 0:0:1 */ 350 case INTC_INT_RISE_EDGE: /* 0:0:1 */
296 au_writel(1<<(irq_nr-32), IC1_CFG2CLR); 351 au_writel(1 << (irq_nr - 32), IC1_CFG2CLR);
297 au_writel(1<<(irq_nr-32), IC1_CFG1CLR); 352 au_writel(1 << (irq_nr - 32), IC1_CFG1CLR);
298 au_writel(1<<(irq_nr-32), IC1_CFG0SET); 353 au_writel(1 << (irq_nr - 32), IC1_CFG0SET);
299 set_irq_chip(irq_nr, &rise_edge_irq_type); 354 set_irq_chip(irq_nr, &rise_edge_irq_type);
300 break; 355 break;
301 case INTC_INT_FALL_EDGE: /* 0:1:0 */ 356 case INTC_INT_FALL_EDGE: /* 0:1:0 */
302 au_writel(1<<(irq_nr-32), IC1_CFG2CLR); 357 au_writel(1 << (irq_nr - 32), IC1_CFG2CLR);
303 au_writel(1<<(irq_nr-32), IC1_CFG1SET); 358 au_writel(1 << (irq_nr - 32), IC1_CFG1SET);
304 au_writel(1<<(irq_nr-32), IC1_CFG0CLR); 359 au_writel(1 << (irq_nr - 32), IC1_CFG0CLR);
305 set_irq_chip(irq_nr, &fall_edge_irq_type); 360 set_irq_chip(irq_nr, &fall_edge_irq_type);
306 break; 361 break;
307 case INTC_INT_RISE_AND_FALL_EDGE: /* 0:1:1 */ 362 case INTC_INT_RISE_AND_FALL_EDGE: /* 0:1:1 */
308 au_writel(1<<(irq_nr-32), IC1_CFG2CLR); 363 au_writel(1 << (irq_nr - 32), IC1_CFG2CLR);
309 au_writel(1<<(irq_nr-32), IC1_CFG1SET); 364 au_writel(1 << (irq_nr - 32), IC1_CFG1SET);
310 au_writel(1<<(irq_nr-32), IC1_CFG0SET); 365 au_writel(1 << (irq_nr - 32), IC1_CFG0SET);
311 set_irq_chip(irq_nr, &either_edge_irq_type); 366 set_irq_chip(irq_nr, &either_edge_irq_type);
312 break; 367 break;
313 case INTC_INT_HIGH_LEVEL: /* 1:0:1 */ 368 case INTC_INT_HIGH_LEVEL: /* 1:0:1 */
314 au_writel(1<<(irq_nr-32), IC1_CFG2SET); 369 au_writel(1 << (irq_nr - 32), IC1_CFG2SET);
315 au_writel(1<<(irq_nr-32), IC1_CFG1CLR); 370 au_writel(1 << (irq_nr - 32), IC1_CFG1CLR);
316 au_writel(1<<(irq_nr-32), IC1_CFG0SET); 371 au_writel(1 << (irq_nr - 32), IC1_CFG0SET);
317 set_irq_chip(irq_nr, &level_irq_type); 372 set_irq_chip(irq_nr, &level_irq_type);
318 break; 373 break;
319 case INTC_INT_LOW_LEVEL: /* 1:1:0 */ 374 case INTC_INT_LOW_LEVEL: /* 1:1:0 */
320 au_writel(1<<(irq_nr-32), IC1_CFG2SET); 375 au_writel(1 << (irq_nr - 32), IC1_CFG2SET);
321 au_writel(1<<(irq_nr-32), IC1_CFG1SET); 376 au_writel(1 << (irq_nr - 32), IC1_CFG1SET);
322 au_writel(1<<(irq_nr-32), IC1_CFG0CLR); 377 au_writel(1 << (irq_nr - 32), IC1_CFG0CLR);
323 set_irq_chip(irq_nr, &level_irq_type); 378 set_irq_chip(irq_nr, &level_irq_type);
324 break; 379 break;
325 case INTC_INT_DISABLED: /* 0:0:0 */ 380 case INTC_INT_DISABLED: /* 0:0:0 */
326 au_writel(1<<(irq_nr-32), IC1_CFG0CLR); 381 au_writel(1 << (irq_nr - 32), IC1_CFG0CLR);
327 au_writel(1<<(irq_nr-32), IC1_CFG1CLR); 382 au_writel(1 << (irq_nr - 32), IC1_CFG1CLR);
328 au_writel(1<<(irq_nr-32), IC1_CFG2CLR); 383 au_writel(1 << (irq_nr - 32), IC1_CFG2CLR);
329 break; 384 break;
330 default: /* disable the interrupt */ 385 default: /* disable the interrupt */
331 printk("unexpected int type %d (irq %d)\n", type, irq_nr); 386 printk(KERN_WARNING "unexpected int type %d (irq %d)\n",
332 au_writel(1<<(irq_nr-32), IC1_CFG0CLR); 387 type, irq_nr);
333 au_writel(1<<(irq_nr-32), IC1_CFG1CLR); 388 au_writel(1 << (irq_nr - 32), IC1_CFG0CLR);
334 au_writel(1<<(irq_nr-32), IC1_CFG2CLR); 389 au_writel(1 << (irq_nr - 32), IC1_CFG1CLR);
335 return; 390 au_writel(1 << (irq_nr - 32), IC1_CFG2CLR);
391 return;
336 } 392 }
337 if (int_req) /* assign to interrupt request 1 */ 393 if (int_req) /* assign to interrupt request 1 */
338 au_writel(1<<(irq_nr-32), IC1_ASSIGNCLR); 394 au_writel(1 << (irq_nr - 32), IC1_ASSIGNCLR);
339 else /* assign to interrupt request 0 */ 395 else /* assign to interrupt request 0 */
340 au_writel(1<<(irq_nr-32), IC1_ASSIGNSET); 396 au_writel(1 << (irq_nr - 32), IC1_ASSIGNSET);
341 au_writel(1<<(irq_nr-32), IC1_SRCSET); 397 au_writel(1 << (irq_nr - 32), IC1_SRCSET);
342 au_writel(1<<(irq_nr-32), IC1_MASKCLR); 398 au_writel(1 << (irq_nr - 32), IC1_MASKCLR);
343 au_writel(1<<(irq_nr-32), IC1_WAKECLR); 399 au_writel(1 << (irq_nr - 32), IC1_WAKECLR);
344 } 400 } else {
345 else {
346 switch (type) { 401 switch (type) {
347 case INTC_INT_RISE_EDGE: /* 0:0:1 */ 402 case INTC_INT_RISE_EDGE: /* 0:0:1 */
348 au_writel(1<<irq_nr, IC0_CFG2CLR); 403 au_writel(1 << irq_nr, IC0_CFG2CLR);
349 au_writel(1<<irq_nr, IC0_CFG1CLR); 404 au_writel(1 << irq_nr, IC0_CFG1CLR);
350 au_writel(1<<irq_nr, IC0_CFG0SET); 405 au_writel(1 << irq_nr, IC0_CFG0SET);
351 set_irq_chip(irq_nr, &rise_edge_irq_type); 406 set_irq_chip(irq_nr, &rise_edge_irq_type);
352 break; 407 break;
353 case INTC_INT_FALL_EDGE: /* 0:1:0 */ 408 case INTC_INT_FALL_EDGE: /* 0:1:0 */
354 au_writel(1<<irq_nr, IC0_CFG2CLR); 409 au_writel(1 << irq_nr, IC0_CFG2CLR);
355 au_writel(1<<irq_nr, IC0_CFG1SET); 410 au_writel(1 << irq_nr, IC0_CFG1SET);
356 au_writel(1<<irq_nr, IC0_CFG0CLR); 411 au_writel(1 << irq_nr, IC0_CFG0CLR);
357 set_irq_chip(irq_nr, &fall_edge_irq_type); 412 set_irq_chip(irq_nr, &fall_edge_irq_type);
358 break; 413 break;
359 case INTC_INT_RISE_AND_FALL_EDGE: /* 0:1:1 */ 414 case INTC_INT_RISE_AND_FALL_EDGE: /* 0:1:1 */
360 au_writel(1<<irq_nr, IC0_CFG2CLR); 415 au_writel(1 << irq_nr, IC0_CFG2CLR);
361 au_writel(1<<irq_nr, IC0_CFG1SET); 416 au_writel(1 << irq_nr, IC0_CFG1SET);
362 au_writel(1<<irq_nr, IC0_CFG0SET); 417 au_writel(1 << irq_nr, IC0_CFG0SET);
363 set_irq_chip(irq_nr, &either_edge_irq_type); 418 set_irq_chip(irq_nr, &either_edge_irq_type);
364 break; 419 break;
365 case INTC_INT_HIGH_LEVEL: /* 1:0:1 */ 420 case INTC_INT_HIGH_LEVEL: /* 1:0:1 */
366 au_writel(1<<irq_nr, IC0_CFG2SET); 421 au_writel(1 << irq_nr, IC0_CFG2SET);
367 au_writel(1<<irq_nr, IC0_CFG1CLR); 422 au_writel(1 << irq_nr, IC0_CFG1CLR);
368 au_writel(1<<irq_nr, IC0_CFG0SET); 423 au_writel(1 << irq_nr, IC0_CFG0SET);
369 set_irq_chip(irq_nr, &level_irq_type); 424 set_irq_chip(irq_nr, &level_irq_type);
370 break; 425 break;
371 case INTC_INT_LOW_LEVEL: /* 1:1:0 */ 426 case INTC_INT_LOW_LEVEL: /* 1:1:0 */
372 au_writel(1<<irq_nr, IC0_CFG2SET); 427 au_writel(1 << irq_nr, IC0_CFG2SET);
373 au_writel(1<<irq_nr, IC0_CFG1SET); 428 au_writel(1 << irq_nr, IC0_CFG1SET);
374 au_writel(1<<irq_nr, IC0_CFG0CLR); 429 au_writel(1 << irq_nr, IC0_CFG0CLR);
375 set_irq_chip(irq_nr, &level_irq_type); 430 set_irq_chip(irq_nr, &level_irq_type);
376 break; 431 break;
377 case INTC_INT_DISABLED: /* 0:0:0 */ 432 case INTC_INT_DISABLED: /* 0:0:0 */
378 au_writel(1<<irq_nr, IC0_CFG0CLR); 433 au_writel(1 << irq_nr, IC0_CFG0CLR);
379 au_writel(1<<irq_nr, IC0_CFG1CLR); 434 au_writel(1 << irq_nr, IC0_CFG1CLR);
380 au_writel(1<<irq_nr, IC0_CFG2CLR); 435 au_writel(1 << irq_nr, IC0_CFG2CLR);
381 break; 436 break;
382 default: /* disable the interrupt */ 437 default: /* disable the interrupt */
383 printk("unexpected int type %d (irq %d)\n", type, irq_nr); 438 printk(KERN_WARNING "unexpected int type %d (irq %d)\n",
384 au_writel(1<<irq_nr, IC0_CFG0CLR); 439 type, irq_nr);
385 au_writel(1<<irq_nr, IC0_CFG1CLR); 440 au_writel(1 << irq_nr, IC0_CFG0CLR);
386 au_writel(1<<irq_nr, IC0_CFG2CLR); 441 au_writel(1 << irq_nr, IC0_CFG1CLR);
387 return; 442 au_writel(1 << irq_nr, IC0_CFG2CLR);
443 return;
388 } 444 }
389 if (int_req) /* assign to interrupt request 1 */ 445 if (int_req) /* assign to interrupt request 1 */
390 au_writel(1<<irq_nr, IC0_ASSIGNCLR); 446 au_writel(1 << irq_nr, IC0_ASSIGNCLR);
391 else /* assign to interrupt request 0 */ 447 else /* assign to interrupt request 0 */
392 au_writel(1<<irq_nr, IC0_ASSIGNSET); 448 au_writel(1 << irq_nr, IC0_ASSIGNSET);
393 au_writel(1<<irq_nr, IC0_SRCSET); 449 au_writel(1 << irq_nr, IC0_SRCSET);
394 au_writel(1<<irq_nr, IC0_MASKCLR); 450 au_writel(1 << irq_nr, IC0_MASKCLR);
395 au_writel(1<<irq_nr, IC0_WAKECLR); 451 au_writel(1 << irq_nr, IC0_WAKECLR);
396 } 452 }
397 au_sync(); 453 au_sync();
398} 454}
399 455
400
401void __init arch_init_irq(void)
402{
403 int i;
404 unsigned long cp0_status;
405 au1xxx_irq_map_t *imp;
406 extern au1xxx_irq_map_t au1xxx_irq_map[];
407 extern au1xxx_irq_map_t au1xxx_ic0_map[];
408 extern int au1xxx_nr_irqs;
409 extern int au1xxx_ic0_nr_irqs;
410
411 cp0_status = read_c0_status();
412
413 /* Initialize interrupt controllers to a safe state.
414 */
415 au_writel(0xffffffff, IC0_CFG0CLR);
416 au_writel(0xffffffff, IC0_CFG1CLR);
417 au_writel(0xffffffff, IC0_CFG2CLR);
418 au_writel(0xffffffff, IC0_MASKCLR);
419 au_writel(0xffffffff, IC0_ASSIGNSET);
420 au_writel(0xffffffff, IC0_WAKECLR);
421 au_writel(0xffffffff, IC0_SRCSET);
422 au_writel(0xffffffff, IC0_FALLINGCLR);
423 au_writel(0xffffffff, IC0_RISINGCLR);
424 au_writel(0x00000000, IC0_TESTBIT);
425
426 au_writel(0xffffffff, IC1_CFG0CLR);
427 au_writel(0xffffffff, IC1_CFG1CLR);
428 au_writel(0xffffffff, IC1_CFG2CLR);
429 au_writel(0xffffffff, IC1_MASKCLR);
430 au_writel(0xffffffff, IC1_ASSIGNSET);
431 au_writel(0xffffffff, IC1_WAKECLR);
432 au_writel(0xffffffff, IC1_SRCSET);
433 au_writel(0xffffffff, IC1_FALLINGCLR);
434 au_writel(0xffffffff, IC1_RISINGCLR);
435 au_writel(0x00000000, IC1_TESTBIT);
436
437 /* Initialize IC0, which is fixed per processor.
438 */
439 imp = au1xxx_ic0_map;
440 for (i=0; i<au1xxx_ic0_nr_irqs; i++) {
441 setup_local_irq(imp->im_irq, imp->im_type, imp->im_request);
442 imp++;
443 }
444
445 /* Now set up the irq mapping for the board.
446 */
447 imp = au1xxx_irq_map;
448 for (i=0; i<au1xxx_nr_irqs; i++) {
449 setup_local_irq(imp->im_irq, imp->im_type, imp->im_request);
450 imp++;
451 }
452
453 set_c0_status(ALLINTS);
454
455 /* Board specific IRQ initialization.
456 */
457 if (board_init_irq)
458 (*board_init_irq)();
459}
460
461
462/* 456/*
463 * Interrupts are nested. Even if an interrupt handler is registered 457 * Interrupts are nested. Even if an interrupt handler is registered
464 * as "fast", we might get another interrupt before we return from 458 * as "fast", we might get another interrupt before we return from
@@ -468,26 +462,27 @@ void __init arch_init_irq(void)
468static void intc0_req0_irqdispatch(void) 462static void intc0_req0_irqdispatch(void)
469{ 463{
470 int irq = 0; 464 int irq = 0;
471 static unsigned long intc0_req0 = 0; 465 static unsigned long intc0_req0;
472 466
473 intc0_req0 |= au_readl(IC0_REQ0INT); 467 intc0_req0 |= au_readl(IC0_REQ0INT);
474 468
475 if (!intc0_req0) 469 if (!intc0_req0)
476 return; 470 return;
471
477#ifdef AU1000_USB_DEV_REQ_INT 472#ifdef AU1000_USB_DEV_REQ_INT
478 /* 473 /*
479 * Because of the tight timing of SETUP token to reply 474 * Because of the tight timing of SETUP token to reply
480 * transactions, the USB devices-side packet complete 475 * transactions, the USB devices-side packet complete
481 * interrupt needs the highest priority. 476 * interrupt needs the highest priority.
482 */ 477 */
483 if ((intc0_req0 & (1<<AU1000_USB_DEV_REQ_INT))) { 478 if ((intc0_req0 & (1 << AU1000_USB_DEV_REQ_INT))) {
484 intc0_req0 &= ~(1<<AU1000_USB_DEV_REQ_INT); 479 intc0_req0 &= ~(1 << AU1000_USB_DEV_REQ_INT);
485 do_IRQ(AU1000_USB_DEV_REQ_INT); 480 do_IRQ(AU1000_USB_DEV_REQ_INT);
486 return; 481 return;
487 } 482 }
488#endif 483#endif
489 irq = au_ffs(intc0_req0) - 1; 484 irq = ffs(intc0_req0);
490 intc0_req0 &= ~(1<<irq); 485 intc0_req0 &= ~(1 << irq);
491 do_IRQ(irq); 486 do_IRQ(irq);
492} 487}
493 488
@@ -495,15 +490,15 @@ static void intc0_req0_irqdispatch(void)
495static void intc0_req1_irqdispatch(void) 490static void intc0_req1_irqdispatch(void)
496{ 491{
497 int irq = 0; 492 int irq = 0;
498 static unsigned long intc0_req1 = 0; 493 static unsigned long intc0_req1;
499 494
500 intc0_req1 |= au_readl(IC0_REQ1INT); 495 intc0_req1 |= au_readl(IC0_REQ1INT);
501 496
502 if (!intc0_req1) 497 if (!intc0_req1)
503 return; 498 return;
504 499
505 irq = au_ffs(intc0_req1) - 1; 500 irq = ffs(intc0_req1);
506 intc0_req1 &= ~(1<<irq); 501 intc0_req1 &= ~(1 << irq);
507 do_IRQ(irq); 502 do_IRQ(irq);
508} 503}
509 504
@@ -515,15 +510,15 @@ static void intc0_req1_irqdispatch(void)
515static void intc1_req0_irqdispatch(void) 510static void intc1_req0_irqdispatch(void)
516{ 511{
517 int irq = 0; 512 int irq = 0;
518 static unsigned long intc1_req0 = 0; 513 static unsigned long intc1_req0;
519 514
520 intc1_req0 |= au_readl(IC1_REQ0INT); 515 intc1_req0 |= au_readl(IC1_REQ0INT);
521 516
522 if (!intc1_req0) 517 if (!intc1_req0)
523 return; 518 return;
524 519
525 irq = au_ffs(intc1_req0) - 1; 520 irq = ffs(intc1_req0);
526 intc1_req0 &= ~(1<<irq); 521 intc1_req0 &= ~(1 << irq);
527 irq += 32; 522 irq += 32;
528 do_IRQ(irq); 523 do_IRQ(irq);
529} 524}
@@ -532,102 +527,19 @@ static void intc1_req0_irqdispatch(void)
532static void intc1_req1_irqdispatch(void) 527static void intc1_req1_irqdispatch(void)
533{ 528{
534 int irq = 0; 529 int irq = 0;
535 static unsigned long intc1_req1 = 0; 530 static unsigned long intc1_req1;
536 531
537 intc1_req1 |= au_readl(IC1_REQ1INT); 532 intc1_req1 |= au_readl(IC1_REQ1INT);
538 533
539 if (!intc1_req1) 534 if (!intc1_req1)
540 return; 535 return;
541 536
542 irq = au_ffs(intc1_req1) - 1; 537 irq = ffs(intc1_req1);
543 intc1_req1 &= ~(1<<irq); 538 intc1_req1 &= ~(1 << irq);
544 irq += 32; 539 irq += 32;
545 do_IRQ(irq); 540 do_IRQ(irq);
546} 541}
547 542
548#ifdef CONFIG_PM
549
550/* Save/restore the interrupt controller state.
551 * Called from the save/restore core registers as part of the
552 * au_sleep function in power.c.....maybe I should just pm_register()
553 * them instead?
554 */
555static unsigned int sleep_intctl_config0[2];
556static unsigned int sleep_intctl_config1[2];
557static unsigned int sleep_intctl_config2[2];
558static unsigned int sleep_intctl_src[2];
559static unsigned int sleep_intctl_assign[2];
560static unsigned int sleep_intctl_wake[2];
561static unsigned int sleep_intctl_mask[2];
562
563void
564save_au1xxx_intctl(void)
565{
566 sleep_intctl_config0[0] = au_readl(IC0_CFG0RD);
567 sleep_intctl_config1[0] = au_readl(IC0_CFG1RD);
568 sleep_intctl_config2[0] = au_readl(IC0_CFG2RD);
569 sleep_intctl_src[0] = au_readl(IC0_SRCRD);
570 sleep_intctl_assign[0] = au_readl(IC0_ASSIGNRD);
571 sleep_intctl_wake[0] = au_readl(IC0_WAKERD);
572 sleep_intctl_mask[0] = au_readl(IC0_MASKRD);
573
574 sleep_intctl_config0[1] = au_readl(IC1_CFG0RD);
575 sleep_intctl_config1[1] = au_readl(IC1_CFG1RD);
576 sleep_intctl_config2[1] = au_readl(IC1_CFG2RD);
577 sleep_intctl_src[1] = au_readl(IC1_SRCRD);
578 sleep_intctl_assign[1] = au_readl(IC1_ASSIGNRD);
579 sleep_intctl_wake[1] = au_readl(IC1_WAKERD);
580 sleep_intctl_mask[1] = au_readl(IC1_MASKRD);
581}
582
583/* For most restore operations, we clear the entire register and
584 * then set the bits we found during the save.
585 */
586void
587restore_au1xxx_intctl(void)
588{
589 au_writel(0xffffffff, IC0_MASKCLR); au_sync();
590
591 au_writel(0xffffffff, IC0_CFG0CLR); au_sync();
592 au_writel(sleep_intctl_config0[0], IC0_CFG0SET); au_sync();
593 au_writel(0xffffffff, IC0_CFG1CLR); au_sync();
594 au_writel(sleep_intctl_config1[0], IC0_CFG1SET); au_sync();
595 au_writel(0xffffffff, IC0_CFG2CLR); au_sync();
596 au_writel(sleep_intctl_config2[0], IC0_CFG2SET); au_sync();
597 au_writel(0xffffffff, IC0_SRCCLR); au_sync();
598 au_writel(sleep_intctl_src[0], IC0_SRCSET); au_sync();
599 au_writel(0xffffffff, IC0_ASSIGNCLR); au_sync();
600 au_writel(sleep_intctl_assign[0], IC0_ASSIGNSET); au_sync();
601 au_writel(0xffffffff, IC0_WAKECLR); au_sync();
602 au_writel(sleep_intctl_wake[0], IC0_WAKESET); au_sync();
603 au_writel(0xffffffff, IC0_RISINGCLR); au_sync();
604 au_writel(0xffffffff, IC0_FALLINGCLR); au_sync();
605 au_writel(0x00000000, IC0_TESTBIT); au_sync();
606
607 au_writel(0xffffffff, IC1_MASKCLR); au_sync();
608
609 au_writel(0xffffffff, IC1_CFG0CLR); au_sync();
610 au_writel(sleep_intctl_config0[1], IC1_CFG0SET); au_sync();
611 au_writel(0xffffffff, IC1_CFG1CLR); au_sync();
612 au_writel(sleep_intctl_config1[1], IC1_CFG1SET); au_sync();
613 au_writel(0xffffffff, IC1_CFG2CLR); au_sync();
614 au_writel(sleep_intctl_config2[1], IC1_CFG2SET); au_sync();
615 au_writel(0xffffffff, IC1_SRCCLR); au_sync();
616 au_writel(sleep_intctl_src[1], IC1_SRCSET); au_sync();
617 au_writel(0xffffffff, IC1_ASSIGNCLR); au_sync();
618 au_writel(sleep_intctl_assign[1], IC1_ASSIGNSET); au_sync();
619 au_writel(0xffffffff, IC1_WAKECLR); au_sync();
620 au_writel(sleep_intctl_wake[1], IC1_WAKESET); au_sync();
621 au_writel(0xffffffff, IC1_RISINGCLR); au_sync();
622 au_writel(0xffffffff, IC1_FALLINGCLR); au_sync();
623 au_writel(0x00000000, IC1_TESTBIT); au_sync();
624
625 au_writel(sleep_intctl_mask[1], IC1_MASKSET); au_sync();
626
627 au_writel(sleep_intctl_mask[0], IC0_MASKSET); au_sync();
628}
629#endif /* CONFIG_PM */
630
631asmlinkage void plat_irq_dispatch(void) 543asmlinkage void plat_irq_dispatch(void)
632{ 544{
633 unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM; 545 unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
@@ -645,3 +557,63 @@ asmlinkage void plat_irq_dispatch(void)
645 else 557 else
646 spurious_interrupt(); 558 spurious_interrupt();
647} 559}
560
561void __init arch_init_irq(void)
562{
563 int i;
564 unsigned long cp0_status;
565 struct au1xxx_irqmap *imp;
566 extern struct au1xxx_irqmap au1xxx_irq_map[];
567 extern struct au1xxx_irqmap au1xxx_ic0_map[];
568 extern int au1xxx_nr_irqs;
569 extern int au1xxx_ic0_nr_irqs;
570
571 cp0_status = read_c0_status();
572
573 /* Initialize interrupt controllers to a safe state.
574 */
575 au_writel(0xffffffff, IC0_CFG0CLR);
576 au_writel(0xffffffff, IC0_CFG1CLR);
577 au_writel(0xffffffff, IC0_CFG2CLR);
578 au_writel(0xffffffff, IC0_MASKCLR);
579 au_writel(0xffffffff, IC0_ASSIGNSET);
580 au_writel(0xffffffff, IC0_WAKECLR);
581 au_writel(0xffffffff, IC0_SRCSET);
582 au_writel(0xffffffff, IC0_FALLINGCLR);
583 au_writel(0xffffffff, IC0_RISINGCLR);
584 au_writel(0x00000000, IC0_TESTBIT);
585
586 au_writel(0xffffffff, IC1_CFG0CLR);
587 au_writel(0xffffffff, IC1_CFG1CLR);
588 au_writel(0xffffffff, IC1_CFG2CLR);
589 au_writel(0xffffffff, IC1_MASKCLR);
590 au_writel(0xffffffff, IC1_ASSIGNSET);
591 au_writel(0xffffffff, IC1_WAKECLR);
592 au_writel(0xffffffff, IC1_SRCSET);
593 au_writel(0xffffffff, IC1_FALLINGCLR);
594 au_writel(0xffffffff, IC1_RISINGCLR);
595 au_writel(0x00000000, IC1_TESTBIT);
596
597 /* Initialize IC0, which is fixed per processor.
598 */
599 imp = au1xxx_ic0_map;
600 for (i = 0; i < au1xxx_ic0_nr_irqs; i++) {
601 setup_local_irq(imp->im_irq, imp->im_type, imp->im_request);
602 imp++;
603 }
604
605 /* Now set up the irq mapping for the board.
606 */
607 imp = au1xxx_irq_map;
608 for (i = 0; i < au1xxx_nr_irqs; i++) {
609 setup_local_irq(imp->im_irq, imp->im_type, imp->im_request);
610 imp++;
611 }
612
613 set_c0_status(ALLINTS);
614
615 /* Board specific IRQ initialization.
616 */
617 if (board_init_irq)
618 (*board_init_irq)();
619}
diff --git a/arch/mips/au1000/common/prom.c b/arch/mips/au1000/common/prom.c
index a8637cdb5b4b..90d70695aa60 100644
--- a/arch/mips/au1000/common/prom.c
+++ b/arch/mips/au1000/common/prom.c
@@ -33,7 +33,6 @@
33 * with this program; if not, write to the Free Software Foundation, Inc., 33 * with this program; if not, write to the Free Software Foundation, Inc.,
34 * 675 Mass Ave, Cambridge, MA 02139, USA. 34 * 675 Mass Ave, Cambridge, MA 02139, USA.
35 */ 35 */
36
37#include <linux/module.h> 36#include <linux/module.h>
38#include <linux/kernel.h> 37#include <linux/kernel.h>
39#include <linux/init.h> 38#include <linux/init.h>
@@ -41,18 +40,16 @@
41 40
42#include <asm/bootinfo.h> 41#include <asm/bootinfo.h>
43 42
44/* #define DEBUG_CMDLINE */ 43int prom_argc;
45 44char **prom_argv;
46extern int prom_argc; 45char **prom_envp;
47extern char **prom_argv, **prom_envp;
48
49 46
50char * __init_or_module prom_getcmdline(void) 47char * __init_or_module prom_getcmdline(void)
51{ 48{
52 return &(arcs_cmdline[0]); 49 return &(arcs_cmdline[0]);
53} 50}
54 51
55void prom_init_cmdline(void) 52void prom_init_cmdline(void)
56{ 53{
57 char *cp; 54 char *cp;
58 int actr; 55 int actr;
@@ -61,7 +58,7 @@ void prom_init_cmdline(void)
61 58
62 cp = &(arcs_cmdline[0]); 59 cp = &(arcs_cmdline[0]);
63 while(actr < prom_argc) { 60 while(actr < prom_argc) {
64 strcpy(cp, prom_argv[actr]); 61 strcpy(cp, prom_argv[actr]);
65 cp += strlen(prom_argv[actr]); 62 cp += strlen(prom_argv[actr]);
66 *cp++ = ' '; 63 *cp++ = ' ';
67 actr++; 64 actr++;
@@ -70,10 +67,8 @@ void prom_init_cmdline(void)
70 --cp; 67 --cp;
71 if (prom_argc > 1) 68 if (prom_argc > 1)
72 *cp = '\0'; 69 *cp = '\0';
73
74} 70}
75 71
76
77char *prom_getenv(char *envname) 72char *prom_getenv(char *envname)
78{ 73{
79 /* 74 /*
@@ -95,21 +90,23 @@ char *prom_getenv(char *envname)
95 } 90 }
96 env++; 91 env++;
97 } 92 }
93
98 return NULL; 94 return NULL;
99} 95}
100 96
101inline unsigned char str2hexnum(unsigned char c) 97static inline unsigned char str2hexnum(unsigned char c)
102{ 98{
103 if(c >= '0' && c <= '9') 99 if (c >= '0' && c <= '9')
104 return c - '0'; 100 return c - '0';
105 if(c >= 'a' && c <= 'f') 101 if (c >= 'a' && c <= 'f')
106 return c - 'a' + 10; 102 return c - 'a' + 10;
107 if(c >= 'A' && c <= 'F') 103 if (c >= 'A' && c <= 'F')
108 return c - 'A' + 10; 104 return c - 'A' + 10;
105
109 return 0; /* foo */ 106 return 0; /* foo */
110} 107}
111 108
112inline void str2eaddr(unsigned char *ea, unsigned char *str) 109static inline void str2eaddr(unsigned char *ea, unsigned char *str)
113{ 110{
114 int i; 111 int i;
115 112
@@ -124,35 +121,29 @@ inline void str2eaddr(unsigned char *ea, unsigned char *str)
124 } 121 }
125} 122}
126 123
127int get_ethernet_addr(char *ethernet_addr) 124int prom_get_ethernet_addr(char *ethernet_addr)
128{ 125{
129 char *ethaddr_str; 126 char *ethaddr_str;
127 char *argptr;
130 128
131 ethaddr_str = prom_getenv("ethaddr"); 129 /* Check the environment variables first */
130 ethaddr_str = prom_getenv("ethaddr");
132 if (!ethaddr_str) { 131 if (!ethaddr_str) {
133 printk("ethaddr not set in boot prom\n"); 132 /* Check command line */
134 return -1; 133 argptr = prom_getcmdline();
135 } 134 ethaddr_str = strstr(argptr, "ethaddr=");
136 str2eaddr(ethernet_addr, ethaddr_str); 135 if (!ethaddr_str)
137 136 return -1;
138#if 0
139 {
140 int i;
141 137
142 printk("get_ethernet_addr: "); 138 ethaddr_str += strlen("ethaddr=");
143 for (i=0; i<5; i++)
144 printk("%02x:", (unsigned char)*(ethernet_addr+i));
145 printk("%02x\n", *(ethernet_addr+i));
146 } 139 }
147#endif 140
141 str2eaddr(ethernet_addr, ethaddr_str);
148 142
149 return 0; 143 return 0;
150} 144}
145EXPORT_SYMBOL(prom_get_ethernet_addr);
151 146
152void __init prom_free_prom_memory(void) 147void __init prom_free_prom_memory(void)
153{ 148{
154} 149}
155
156EXPORT_SYMBOL(prom_getcmdline);
157EXPORT_SYMBOL(get_ethernet_addr);
158EXPORT_SYMBOL(str2eaddr);
diff --git a/arch/mips/au1000/common/setup.c b/arch/mips/au1000/common/setup.c
index b212c0726125..a90d425d4651 100644
--- a/arch/mips/au1000/common/setup.c
+++ b/arch/mips/au1000/common/setup.c
@@ -40,10 +40,11 @@
40#include <asm/mipsregs.h> 40#include <asm/mipsregs.h>
41#include <asm/reboot.h> 41#include <asm/reboot.h>
42#include <asm/pgtable.h> 42#include <asm/pgtable.h>
43#include <asm/mach-au1x00/au1000.h>
44#include <asm/time.h> 43#include <asm/time.h>
45 44
46extern char * prom_getcmdline(void); 45#include <au1000.h>
46#include <prom.h>
47
47extern void __init board_setup(void); 48extern void __init board_setup(void);
48extern void au1000_restart(char *); 49extern void au1000_restart(char *);
49extern void au1000_halt(void); 50extern void au1000_halt(void);
diff --git a/arch/mips/au1000/db1x00/init.c b/arch/mips/au1000/db1x00/init.c
index 4d7bcfc8cf73..43298fd9459c 100644
--- a/arch/mips/au1000/db1x00/init.c
+++ b/arch/mips/au1000/db1x00/init.c
@@ -31,15 +31,13 @@
31#include <linux/mm.h> 31#include <linux/mm.h>
32#include <linux/sched.h> 32#include <linux/sched.h>
33#include <linux/bootmem.h> 33#include <linux/bootmem.h>
34#include <asm/addrspace.h>
35#include <asm/bootinfo.h>
36#include <linux/string.h> 34#include <linux/string.h>
37#include <linux/kernel.h> 35#include <linux/kernel.h>
38 36
39int prom_argc; 37#include <asm/addrspace.h>
40char **prom_argv, **prom_envp; 38#include <asm/bootinfo.h>
41extern void __init prom_init_cmdline(void); 39
42extern char *prom_getenv(char *envname); 40#include <prom.h>
43 41
44const char *get_system_type(void) 42const char *get_system_type(void)
45{ 43{
diff --git a/arch/mips/au1000/db1x00/irqmap.c b/arch/mips/au1000/db1x00/irqmap.c
index 3e5729145c2b..09cea03411b0 100644
--- a/arch/mips/au1000/db1x00/irqmap.c
+++ b/arch/mips/au1000/db1x00/irqmap.c
@@ -79,7 +79,7 @@ char irq_tab_alchemy[][5] __initdata = {
79#endif 79#endif
80 80
81 81
82au1xxx_irq_map_t __initdata au1xxx_irq_map[] = { 82struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
83 83
84#ifndef CONFIG_MIPS_MIRAGE 84#ifndef CONFIG_MIPS_MIRAGE
85#ifdef CONFIG_MIPS_DB1550 85#ifdef CONFIG_MIPS_DB1550
diff --git a/arch/mips/au1000/mtx-1/init.c b/arch/mips/au1000/mtx-1/init.c
index 2aa7b2ed6a8c..cdeae3212a2d 100644
--- a/arch/mips/au1000/mtx-1/init.c
+++ b/arch/mips/au1000/mtx-1/init.c
@@ -34,13 +34,11 @@
34#include <linux/init.h> 34#include <linux/init.h>
35#include <linux/mm.h> 35#include <linux/mm.h>
36#include <linux/bootmem.h> 36#include <linux/bootmem.h>
37
37#include <asm/addrspace.h> 38#include <asm/addrspace.h>
38#include <asm/bootinfo.h> 39#include <asm/bootinfo.h>
39 40
40int prom_argc; 41#include <prom.h>
41char **prom_argv, **prom_envp;
42extern void __init prom_init_cmdline(void);
43extern char *prom_getenv(char *envname);
44 42
45const char *get_system_type(void) 43const char *get_system_type(void)
46{ 44{
diff --git a/arch/mips/au1000/mtx-1/irqmap.c b/arch/mips/au1000/mtx-1/irqmap.c
index a4fa0f227e42..49c612aeddcf 100644
--- a/arch/mips/au1000/mtx-1/irqmap.c
+++ b/arch/mips/au1000/mtx-1/irqmap.c
@@ -58,7 +58,7 @@ char irq_tab_alchemy[][5] __initdata = {
58 [7] = { -1, INTD, INTC, INTX, INTX}, /* IDSEL 07 - AdapterD-Slot1 (bottom) */ 58 [7] = { -1, INTD, INTC, INTX, INTX}, /* IDSEL 07 - AdapterD-Slot1 (bottom) */
59}; 59};
60 60
61au1xxx_irq_map_t __initdata au1xxx_irq_map[] = { 61struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
62 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0}, 62 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0},
63 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 }, 63 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
64 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 }, 64 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
diff --git a/arch/mips/au1000/pb1000/init.c b/arch/mips/au1000/pb1000/init.c
index 4535f7208e18..ddccaf6997d0 100644
--- a/arch/mips/au1000/pb1000/init.c
+++ b/arch/mips/au1000/pb1000/init.c
@@ -30,15 +30,13 @@
30#include <linux/mm.h> 30#include <linux/mm.h>
31#include <linux/sched.h> 31#include <linux/sched.h>
32#include <linux/bootmem.h> 32#include <linux/bootmem.h>
33#include <asm/addrspace.h>
34#include <asm/bootinfo.h>
35#include <linux/string.h> 33#include <linux/string.h>
36#include <linux/kernel.h> 34#include <linux/kernel.h>
37 35
38int prom_argc; 36#include <asm/addrspace.h>
39char **prom_argv, **prom_envp; 37#include <asm/bootinfo.h>
40extern void __init prom_init_cmdline(void); 38
41extern char *prom_getenv(char *envname); 39#include <prom.h>
42 40
43const char *get_system_type(void) 41const char *get_system_type(void)
44{ 42{
diff --git a/arch/mips/au1000/pb1000/irqmap.c b/arch/mips/au1000/pb1000/irqmap.c
index 156500ba467f..88e354508204 100644
--- a/arch/mips/au1000/pb1000/irqmap.c
+++ b/arch/mips/au1000/pb1000/irqmap.c
@@ -47,7 +47,7 @@
47#include <asm/system.h> 47#include <asm/system.h>
48#include <asm/mach-au1x00/au1000.h> 48#include <asm/mach-au1x00/au1000.h>
49 49
50au1xxx_irq_map_t __initdata au1xxx_irq_map[] = { 50struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
51 { AU1000_GPIO_15, INTC_INT_LOW_LEVEL, 0 }, 51 { AU1000_GPIO_15, INTC_INT_LOW_LEVEL, 0 },
52}; 52};
53 53
diff --git a/arch/mips/au1000/pb1100/init.c b/arch/mips/au1000/pb1100/init.c
index 7ba6852de7cd..c93fd39b4aba 100644
--- a/arch/mips/au1000/pb1100/init.c
+++ b/arch/mips/au1000/pb1100/init.c
@@ -31,15 +31,13 @@
31#include <linux/mm.h> 31#include <linux/mm.h>
32#include <linux/sched.h> 32#include <linux/sched.h>
33#include <linux/bootmem.h> 33#include <linux/bootmem.h>
34#include <asm/addrspace.h>
35#include <asm/bootinfo.h>
36#include <linux/string.h> 34#include <linux/string.h>
37#include <linux/kernel.h> 35#include <linux/kernel.h>
38 36
39int prom_argc; 37#include <asm/addrspace.h>
40char **prom_argv, **prom_envp; 38#include <asm/bootinfo.h>
41extern void __init prom_init_cmdline(void); 39
42extern char *prom_getenv(char *envname); 40#include <prom.h>
43 41
44const char *get_system_type(void) 42const char *get_system_type(void)
45{ 43{
diff --git a/arch/mips/au1000/pb1100/irqmap.c b/arch/mips/au1000/pb1100/irqmap.c
index d986916221b7..880456bf8c11 100644
--- a/arch/mips/au1000/pb1100/irqmap.c
+++ b/arch/mips/au1000/pb1100/irqmap.c
@@ -47,7 +47,7 @@
47#include <asm/system.h> 47#include <asm/system.h>
48#include <asm/mach-au1x00/au1000.h> 48#include <asm/mach-au1x00/au1000.h>
49 49
50au1xxx_irq_map_t __initdata au1xxx_irq_map[] = { 50struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
51 { AU1000_GPIO_9, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card Fully_Interted# 51 { AU1000_GPIO_9, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card Fully_Interted#
52 { AU1000_GPIO_10, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card STSCHG# 52 { AU1000_GPIO_10, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card STSCHG#
53 { AU1000_GPIO_11, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card IRQ# 53 { AU1000_GPIO_11, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card IRQ#
diff --git a/arch/mips/au1000/pb1200/board_setup.c b/arch/mips/au1000/pb1200/board_setup.c
index 2122515f79d7..5dbc9868f598 100644
--- a/arch/mips/au1000/pb1200/board_setup.c
+++ b/arch/mips/au1000/pb1200/board_setup.c
@@ -41,8 +41,10 @@
41#include <asm/mipsregs.h> 41#include <asm/mipsregs.h>
42#include <asm/reboot.h> 42#include <asm/reboot.h>
43#include <asm/pgtable.h> 43#include <asm/pgtable.h>
44#include <asm/mach-au1x00/au1000.h> 44
45#include <asm/mach-au1x00/au1xxx_dbdma.h> 45#include <au1000.h>
46#include <au1xxx_dbdma.h>
47#include <prom.h>
46 48
47#ifdef CONFIG_MIPS_PB1200 49#ifdef CONFIG_MIPS_PB1200
48#include <asm/mach-pb1x00/pb1200.h> 50#include <asm/mach-pb1x00/pb1200.h>
diff --git a/arch/mips/au1000/pb1200/init.c b/arch/mips/au1000/pb1200/init.c
index 5a70029d5388..c251570749ee 100644
--- a/arch/mips/au1000/pb1200/init.c
+++ b/arch/mips/au1000/pb1200/init.c
@@ -31,15 +31,13 @@
31#include <linux/mm.h> 31#include <linux/mm.h>
32#include <linux/sched.h> 32#include <linux/sched.h>
33#include <linux/bootmem.h> 33#include <linux/bootmem.h>
34#include <asm/addrspace.h>
35#include <asm/bootinfo.h>
36#include <linux/string.h> 34#include <linux/string.h>
37#include <linux/kernel.h> 35#include <linux/kernel.h>
38 36
39int prom_argc; 37#include <asm/addrspace.h>
40char **prom_argv, **prom_envp; 38#include <asm/bootinfo.h>
41extern void __init prom_init_cmdline(void); 39
42extern char *prom_getenv(char *envname); 40#include <prom.h>
43 41
44const char *get_system_type(void) 42const char *get_system_type(void)
45{ 43{
diff --git a/arch/mips/au1000/pb1200/irqmap.c b/arch/mips/au1000/pb1200/irqmap.c
index 7c708db04a88..3bee274445f5 100644
--- a/arch/mips/au1000/pb1200/irqmap.c
+++ b/arch/mips/au1000/pb1200/irqmap.c
@@ -54,7 +54,7 @@
54#define PB1200_INT_END DB1200_INT_END 54#define PB1200_INT_END DB1200_INT_END
55#endif 55#endif
56 56
57au1xxx_irq_map_t __initdata au1xxx_irq_map[] = { 57struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
58 { AU1000_GPIO_7, INTC_INT_LOW_LEVEL, 0 }, // This is exteranl interrupt cascade 58 { AU1000_GPIO_7, INTC_INT_LOW_LEVEL, 0 }, // This is exteranl interrupt cascade
59}; 59};
60 60
@@ -74,7 +74,7 @@ irqreturn_t pb1200_cascade_handler( int irq, void *dev_id)
74 bcsr->int_status = bisr; 74 bcsr->int_status = bisr;
75 for( ; bisr; bisr &= (bisr-1) ) 75 for( ; bisr; bisr &= (bisr-1) )
76 { 76 {
77 extirq_nr = (PB1200_INT_BEGIN-1) + au_ffs(bisr); 77 extirq_nr = PB1200_INT_BEGIN + au_ffs(bisr);
78 /* Ack and dispatch IRQ */ 78 /* Ack and dispatch IRQ */
79 do_IRQ(extirq_nr); 79 do_IRQ(extirq_nr);
80 } 80 }
diff --git a/arch/mips/au1000/pb1500/init.c b/arch/mips/au1000/pb1500/init.c
index e58a9d6c5021..507d4b204161 100644
--- a/arch/mips/au1000/pb1500/init.c
+++ b/arch/mips/au1000/pb1500/init.c
@@ -31,15 +31,13 @@
31#include <linux/mm.h> 31#include <linux/mm.h>
32#include <linux/sched.h> 32#include <linux/sched.h>
33#include <linux/bootmem.h> 33#include <linux/bootmem.h>
34#include <asm/addrspace.h>
35#include <asm/bootinfo.h>
36#include <linux/string.h> 34#include <linux/string.h>
37#include <linux/kernel.h> 35#include <linux/kernel.h>
38 36
39int prom_argc; 37#include <asm/addrspace.h>
40char **prom_argv, **prom_envp; 38#include <asm/bootinfo.h>
41extern void __init prom_init_cmdline(void); 39
42extern char *prom_getenv(char *envname); 40#include <prom.h>
43 41
44const char *get_system_type(void) 42const char *get_system_type(void)
45{ 43{
diff --git a/arch/mips/au1000/pb1500/irqmap.c b/arch/mips/au1000/pb1500/irqmap.c
index 409d1612bb63..810f695e24bb 100644
--- a/arch/mips/au1000/pb1500/irqmap.c
+++ b/arch/mips/au1000/pb1500/irqmap.c
@@ -52,7 +52,7 @@ char irq_tab_alchemy[][5] __initdata = {
52 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot */ 52 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot */
53}; 53};
54 54
55au1xxx_irq_map_t __initdata au1xxx_irq_map[] = { 55struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
56 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0}, 56 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0},
57 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 }, 57 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
58 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 }, 58 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
diff --git a/arch/mips/au1000/pb1550/init.c b/arch/mips/au1000/pb1550/init.c
index fad53bf5aad1..b03eee601e36 100644
--- a/arch/mips/au1000/pb1550/init.c
+++ b/arch/mips/au1000/pb1550/init.c
@@ -31,15 +31,13 @@
31#include <linux/mm.h> 31#include <linux/mm.h>
32#include <linux/sched.h> 32#include <linux/sched.h>
33#include <linux/bootmem.h> 33#include <linux/bootmem.h>
34#include <asm/addrspace.h>
35#include <asm/bootinfo.h>
36#include <linux/string.h> 34#include <linux/string.h>
37#include <linux/kernel.h> 35#include <linux/kernel.h>
38 36
39int prom_argc; 37#include <asm/addrspace.h>
40char **prom_argv, **prom_envp; 38#include <asm/bootinfo.h>
41extern void __init prom_init_cmdline(void); 39
42extern char *prom_getenv(char *envname); 40#include <prom.h>
43 41
44const char *get_system_type(void) 42const char *get_system_type(void)
45{ 43{
diff --git a/arch/mips/au1000/pb1550/irqmap.c b/arch/mips/au1000/pb1550/irqmap.c
index 24a9d186cf5a..56becab28e5d 100644
--- a/arch/mips/au1000/pb1550/irqmap.c
+++ b/arch/mips/au1000/pb1550/irqmap.c
@@ -52,7 +52,7 @@ char irq_tab_alchemy[][5] __initdata = {
52 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot 1 (right) */ 52 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot 1 (right) */
53}; 53};
54 54
55au1xxx_irq_map_t __initdata au1xxx_irq_map[] = { 55struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
56 { AU1000_GPIO_0, INTC_INT_LOW_LEVEL, 0 }, 56 { AU1000_GPIO_0, INTC_INT_LOW_LEVEL, 0 },
57 { AU1000_GPIO_1, INTC_INT_LOW_LEVEL, 0 }, 57 { AU1000_GPIO_1, INTC_INT_LOW_LEVEL, 0 },
58}; 58};
diff --git a/arch/mips/au1000/xxs1500/init.c b/arch/mips/au1000/xxs1500/init.c
index 9f839c36f69e..6532939f377a 100644
--- a/arch/mips/au1000/xxs1500/init.c
+++ b/arch/mips/au1000/xxs1500/init.c
@@ -30,15 +30,13 @@
30#include <linux/mm.h> 30#include <linux/mm.h>
31#include <linux/sched.h> 31#include <linux/sched.h>
32#include <linux/bootmem.h> 32#include <linux/bootmem.h>
33#include <asm/addrspace.h>
34#include <asm/bootinfo.h>
35#include <linux/string.h> 33#include <linux/string.h>
36#include <linux/kernel.h> 34#include <linux/kernel.h>
37 35
38int prom_argc; 36#include <asm/addrspace.h>
39char **prom_argv, **prom_envp; 37#include <asm/bootinfo.h>
40extern void __init prom_init_cmdline(void); 38
41extern char *prom_getenv(char *envname); 39#include <prom.h>
42 40
43const char *get_system_type(void) 41const char *get_system_type(void)
44{ 42{
diff --git a/arch/mips/au1000/xxs1500/irqmap.c b/arch/mips/au1000/xxs1500/irqmap.c
index 3844c6429e27..389349295d70 100644
--- a/arch/mips/au1000/xxs1500/irqmap.c
+++ b/arch/mips/au1000/xxs1500/irqmap.c
@@ -47,7 +47,7 @@
47#include <asm/system.h> 47#include <asm/system.h>
48#include <asm/au1000.h> 48#include <asm/au1000.h>
49 49
50au1xxx_irq_map_t __initdata au1xxx_irq_map[] = { 50struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
51 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0}, 51 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0},
52 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 }, 52 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
53 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 }, 53 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
diff --git a/arch/mips/jmr3927/rbhma3100/setup.c b/arch/mips/jmr3927/rbhma3100/setup.c
index 7f14f70a1b88..0c7aee1682cd 100644
--- a/arch/mips/jmr3927/rbhma3100/setup.c
+++ b/arch/mips/jmr3927/rbhma3100/setup.c
@@ -425,7 +425,7 @@ static int __init jmr3927_rtc_init(void)
425 .flags = IORESOURCE_MEM, 425 .flags = IORESOURCE_MEM,
426 }; 426 };
427 struct platform_device *dev; 427 struct platform_device *dev;
428 dev = platform_device_register_simple("ds1742", -1, &res, 1); 428 dev = platform_device_register_simple("rtc-ds1742", -1, &res, 1);
429 return IS_ERR(dev) ? PTR_ERR(dev) : 0; 429 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
430} 430}
431device_initcall(jmr3927_rtc_init); 431device_initcall(jmr3927_rtc_init);
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index 58aa6fec1146..999f7853de26 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -435,10 +435,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
435 wake_up_process(child); 435 wake_up_process(child);
436 break; 436 break;
437 437
438 case PTRACE_DETACH: /* detach a process that was attached. */
439 ret = ptrace_detach(child, data);
440 break;
441
442 case PTRACE_GET_THREAD_AREA: 438 case PTRACE_GET_THREAD_AREA:
443 ret = put_user(task_thread_info(child)->tp_value, 439 ret = put_user(task_thread_info(child)->tp_value,
444 (unsigned long __user *) data); 440 (unsigned long __user *) data);
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 432f2e376aea..63989e9df4f9 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -379,7 +379,7 @@ void flush_tlb_mm(struct mm_struct *mm)
379 unsigned int cpu; 379 unsigned int cpu;
380 380
381 cpu_clear(smp_processor_id(), mask); 381 cpu_clear(smp_processor_id(), mask);
382 for_each_online_cpu(cpu) 382 for_each_cpu_mask(cpu, mask)
383 if (cpu_context(cpu, mm)) 383 if (cpu_context(cpu, mm))
384 cpu_context(cpu, mm) = 0; 384 cpu_context(cpu, mm) = 0;
385 } 385 }
@@ -419,7 +419,7 @@ void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned l
419 unsigned int cpu; 419 unsigned int cpu;
420 420
421 cpu_clear(smp_processor_id(), mask); 421 cpu_clear(smp_processor_id(), mask);
422 for_each_online_cpu(cpu) 422 for_each_cpu_mask(cpu, mask)
423 if (cpu_context(cpu, mm)) 423 if (cpu_context(cpu, mm))
424 cpu_context(cpu, mm) = 0; 424 cpu_context(cpu, mm) = 0;
425 } 425 }
@@ -466,7 +466,7 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
466 unsigned int cpu; 466 unsigned int cpu;
467 467
468 cpu_clear(smp_processor_id(), mask); 468 cpu_clear(smp_processor_id(), mask);
469 for_each_online_cpu(cpu) 469 for_each_cpu_mask(cpu, mask)
470 if (cpu_context(cpu, vma->vm_mm)) 470 if (cpu_context(cpu, vma->vm_mm))
471 cpu_context(cpu, vma->vm_mm) = 0; 471 cpu_context(cpu, vma->vm_mm) = 0;
472 } 472 }
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 5892491b40eb..05b365167a09 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -421,7 +421,7 @@ void __cpuinit mips_clockevent_init(void)
421 cd->mult = div_sc((unsigned long) mips_freq, NSEC_PER_SEC, 32); 421 cd->mult = div_sc((unsigned long) mips_freq, NSEC_PER_SEC, 32);
422 cd->shift = 32; 422 cd->shift = 32;
423 cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd); 423 cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd);
424 cd->min_delta_ns = clockevent_delta2ns(0x30, cd); 424 cd->min_delta_ns = clockevent_delta2ns(0x300, cd);
425 425
426 cd->rating = 300; 426 cd->rating = 300;
427 cd->irq = irq; 427 cd->irq = irq;
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 632bce1bf420..9c0c478d71ac 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -104,7 +104,7 @@ static int __init set_raw_show_trace(char *str)
104__setup("raw_show_trace", set_raw_show_trace); 104__setup("raw_show_trace", set_raw_show_trace);
105#endif 105#endif
106 106
107static void show_backtrace(struct task_struct *task, struct pt_regs *regs) 107static void show_backtrace(struct task_struct *task, const struct pt_regs *regs)
108{ 108{
109 unsigned long sp = regs->regs[29]; 109 unsigned long sp = regs->regs[29];
110 unsigned long ra = regs->regs[31]; 110 unsigned long ra = regs->regs[31];
@@ -126,7 +126,8 @@ static void show_backtrace(struct task_struct *task, struct pt_regs *regs)
126 * This routine abuses get_user()/put_user() to reference pointers 126 * This routine abuses get_user()/put_user() to reference pointers
127 * with at least a bit of error checking ... 127 * with at least a bit of error checking ...
128 */ 128 */
129static void show_stacktrace(struct task_struct *task, struct pt_regs *regs) 129static void show_stacktrace(struct task_struct *task,
130 const struct pt_regs *regs)
130{ 131{
131 const int field = 2 * sizeof(unsigned long); 132 const int field = 2 * sizeof(unsigned long);
132 long stackdata; 133 long stackdata;
@@ -203,7 +204,7 @@ static void show_code(unsigned int __user *pc)
203 } 204 }
204} 205}
205 206
206void show_regs(struct pt_regs *regs) 207static void __show_regs(const struct pt_regs *regs)
207{ 208{
208 const int field = 2 * sizeof(unsigned long); 209 const int field = 2 * sizeof(unsigned long);
209 unsigned int cause = regs->cp0_cause; 210 unsigned int cause = regs->cp0_cause;
@@ -299,9 +300,17 @@ void show_regs(struct pt_regs *regs)
299 cpu_name_string()); 300 cpu_name_string());
300} 301}
301 302
302void show_registers(struct pt_regs *regs) 303/*
304 * FIXME: really the generic show_regs should take a const pointer argument.
305 */
306void show_regs(struct pt_regs *regs)
307{
308 __show_regs((struct pt_regs *)regs);
309}
310
311void show_registers(const struct pt_regs *regs)
303{ 312{
304 show_regs(regs); 313 __show_regs(regs);
305 print_modules(); 314 print_modules();
306 printk("Process %s (pid: %d, threadinfo=%p, task=%p)\n", 315 printk("Process %s (pid: %d, threadinfo=%p, task=%p)\n",
307 current->comm, current->pid, current_thread_info(), current); 316 current->comm, current->pid, current_thread_info(), current);
@@ -312,7 +321,7 @@ void show_registers(struct pt_regs *regs)
312 321
313static DEFINE_SPINLOCK(die_lock); 322static DEFINE_SPINLOCK(die_lock);
314 323
315void __noreturn die(const char * str, struct pt_regs * regs) 324void __noreturn die(const char * str, const struct pt_regs * regs)
316{ 325{
317 static int die_counter; 326 static int die_counter;
318#ifdef CONFIG_MIPS_MT_SMTC 327#ifdef CONFIG_MIPS_MT_SMTC
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 84f9a4cc6f2f..2781cff1485e 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -5,6 +5,10 @@
5#define mips mips 5#define mips mips
6OUTPUT_ARCH(mips) 6OUTPUT_ARCH(mips)
7ENTRY(kernel_entry) 7ENTRY(kernel_entry)
8PHDRS {
9 text PT_LOAD FLAGS(7); /* RWX */
10 note PT_NOTE FLAGS(4); /* R__ */
11}
8jiffies = JIFFIES; 12jiffies = JIFFIES;
9 13
10SECTIONS 14SECTIONS
@@ -22,7 +26,6 @@ SECTIONS
22 */ 26 */
23 27
24 /* . = 0xa800000000300000; */ 28 /* . = 0xa800000000300000; */
25 /* . = 0xa800000000300000; */
26 . = 0xffffffff80300000; 29 . = 0xffffffff80300000;
27#endif 30#endif
28 . = LOADADDR; 31 . = LOADADDR;
@@ -32,9 +35,10 @@ SECTIONS
32 TEXT_TEXT 35 TEXT_TEXT
33 SCHED_TEXT 36 SCHED_TEXT
34 LOCK_TEXT 37 LOCK_TEXT
38 KPROBES_TEXT
35 *(.fixup) 39 *(.fixup)
36 *(.gnu.warning) 40 *(.gnu.warning)
37 } =0 41 } :text = 0
38 _etext = .; /* End of text section */ 42 _etext = .; /* End of text section */
39 43
40 /* Exception table */ 44 /* Exception table */
@@ -51,6 +55,10 @@ SECTIONS
51 *(__dbe_table) 55 *(__dbe_table)
52 __stop___dbe_table = .; 56 __stop___dbe_table = .;
53 } 57 }
58
59 NOTES :text :note
60 .dummy : { *(.dummy) } :text
61
54 RODATA 62 RODATA
55 63
56 /* writeable */ 64 /* writeable */
@@ -201,7 +209,4 @@ SECTIONS
201 *(.gptab.bss) 209 *(.gptab.bss)
202 *(.gptab.sbss) 210 *(.gptab.sbss)
203 } 211 }
204 .note : {
205 *(.note)
206 }
207} 212}
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 61b729fa0548..df8cbe4c7c0d 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -1317,7 +1317,8 @@ static void kspd_sp_exit( int sp_id)
1317} 1317}
1318#endif 1318#endif
1319 1319
1320static ssize_t store_kill(struct class_device *dev, const char *buf, size_t len) 1320static ssize_t store_kill(struct device *dev, struct device_attribute *attr,
1321 const char *buf, size_t len)
1321{ 1322{
1322 struct vpe *vpe = get_vpe(tclimit); 1323 struct vpe *vpe = get_vpe(tclimit);
1323 struct vpe_notifications *not; 1324 struct vpe_notifications *not;
@@ -1334,14 +1335,16 @@ static ssize_t store_kill(struct class_device *dev, const char *buf, size_t len)
1334 return len; 1335 return len;
1335} 1336}
1336 1337
1337static ssize_t show_ntcs(struct class_device *cd, char *buf) 1338static ssize_t show_ntcs(struct device *cd, struct device_attribute *attr,
1339 char *buf)
1338{ 1340{
1339 struct vpe *vpe = get_vpe(tclimit); 1341 struct vpe *vpe = get_vpe(tclimit);
1340 1342
1341 return sprintf(buf, "%d\n", vpe->ntcs); 1343 return sprintf(buf, "%d\n", vpe->ntcs);
1342} 1344}
1343 1345
1344static ssize_t store_ntcs(struct class_device *dev, const char *buf, size_t len) 1346static ssize_t store_ntcs(struct device *dev, struct device_attribute *attr,
1347 const char *buf, size_t len)
1345{ 1348{
1346 struct vpe *vpe = get_vpe(tclimit); 1349 struct vpe *vpe = get_vpe(tclimit);
1347 unsigned long new; 1350 unsigned long new;
@@ -1362,13 +1365,13 @@ out_einval:
1362 return -EINVAL;; 1365 return -EINVAL;;
1363} 1366}
1364 1367
1365static struct class_device_attribute vpe_class_attributes[] = { 1368static struct device_attribute vpe_class_attributes[] = {
1366 __ATTR(kill, S_IWUSR, NULL, store_kill), 1369 __ATTR(kill, S_IWUSR, NULL, store_kill),
1367 __ATTR(ntcs, S_IRUGO | S_IWUSR, show_ntcs, store_ntcs), 1370 __ATTR(ntcs, S_IRUGO | S_IWUSR, show_ntcs, store_ntcs),
1368 {} 1371 {}
1369}; 1372};
1370 1373
1371static void vpe_class_device_release(struct class_device *cd) 1374static void vpe_device_release(struct device *cd)
1372{ 1375{
1373 kfree(cd); 1376 kfree(cd);
1374} 1377}
@@ -1376,11 +1379,11 @@ static void vpe_class_device_release(struct class_device *cd)
1376struct class vpe_class = { 1379struct class vpe_class = {
1377 .name = "vpe", 1380 .name = "vpe",
1378 .owner = THIS_MODULE, 1381 .owner = THIS_MODULE,
1379 .release = vpe_class_device_release, 1382 .dev_release = vpe_device_release,
1380 .class_dev_attrs = vpe_class_attributes, 1383 .dev_attrs = vpe_class_attributes,
1381}; 1384};
1382 1385
1383struct class_device vpe_device; 1386struct device vpe_device;
1384 1387
1385static int __init vpe_module_init(void) 1388static int __init vpe_module_init(void)
1386{ 1389{
@@ -1423,12 +1426,12 @@ static int __init vpe_module_init(void)
1423 goto out_chrdev; 1426 goto out_chrdev;
1424 } 1427 }
1425 1428
1426 class_device_initialize(&vpe_device); 1429 device_initialize(&vpe_device);
1427 vpe_device.class = &vpe_class, 1430 vpe_device.class = &vpe_class,
1428 vpe_device.parent = NULL, 1431 vpe_device.parent = NULL,
1429 strlcpy(vpe_device.class_id, "vpe1", BUS_ID_SIZE); 1432 strlcpy(vpe_device.bus_id, "vpe1", BUS_ID_SIZE);
1430 vpe_device.devt = MKDEV(major, minor); 1433 vpe_device.devt = MKDEV(major, minor);
1431 err = class_device_add(&vpe_device); 1434 err = device_add(&vpe_device);
1432 if (err) { 1435 if (err) {
1433 printk(KERN_ERR "Adding vpe_device failed\n"); 1436 printk(KERN_ERR "Adding vpe_device failed\n");
1434 goto out_class; 1437 goto out_class;
@@ -1573,7 +1576,7 @@ static void __exit vpe_module_exit(void)
1573 } 1576 }
1574 } 1577 }
1575 1578
1576 class_device_del(&vpe_device); 1579 device_del(&vpe_device);
1577 unregister_chrdev(major, module_name); 1580 unregister_chrdev(major, module_name);
1578} 1581}
1579 1582
diff --git a/arch/mips/lasat/interrupt.c b/arch/mips/lasat/interrupt.c
index 5f35289bfff5..ba9692be3564 100644
--- a/arch/mips/lasat/interrupt.c
+++ b/arch/mips/lasat/interrupt.c
@@ -26,6 +26,7 @@
26#include <linux/kernel_stat.h> 26#include <linux/kernel_stat.h>
27 27
28#include <asm/bootinfo.h> 28#include <asm/bootinfo.h>
29#include <asm/irq_cpu.h>
29#include <asm/lasat/lasatint.h> 30#include <asm/lasat/lasatint.h>
30#include <asm/time.h> 31#include <asm/time.h>
31#include <asm/gdb-stub.h> 32#include <asm/gdb-stub.h>
@@ -88,7 +89,7 @@ asmlinkage void plat_irq_dispatch(void)
88 int irq; 89 int irq;
89 90
90 if (cause & CAUSEF_IP7) { /* R4000 count / compare IRQ */ 91 if (cause & CAUSEF_IP7) { /* R4000 count / compare IRQ */
91 ll_timer_interrupt(7); 92 do_IRQ(7);
92 return; 93 return;
93 } 94 }
94 95
@@ -96,7 +97,7 @@ asmlinkage void plat_irq_dispatch(void)
96 97
97 /* if int_status == 0, then the interrupt has already been cleared */ 98 /* if int_status == 0, then the interrupt has already been cleared */
98 if (int_status) { 99 if (int_status) {
99 irq = ls1bit32(int_status); 100 irq = LASATINT_BASE + ls1bit32(int_status);
100 101
101 do_IRQ(irq); 102 do_IRQ(irq);
102 } 103 }
@@ -125,6 +126,7 @@ void __init arch_init_irq(void)
125 panic("arch_init_irq: mips_machtype incorrect"); 126 panic("arch_init_irq: mips_machtype incorrect");
126 } 127 }
127 128
128 for (i = 0; i <= LASATINT_END; i++) 129 mips_cpu_irq_init();
130 for (i = LASATINT_BASE; i <= LASATINT_END; i++)
129 set_irq_chip_and_handler(i, &lasat_irq_type, handle_level_irq); 131 set_irq_chip_and_handler(i, &lasat_irq_type, handle_level_irq);
130} 132}
diff --git a/arch/mips/mipssim/sim_cmdline.c b/arch/mips/mipssim/sim_cmdline.c
index c63021a5dc6c..74240e1ce5a5 100644
--- a/arch/mips/mipssim/sim_cmdline.c
+++ b/arch/mips/mipssim/sim_cmdline.c
@@ -28,8 +28,5 @@ char * __init prom_getcmdline(void)
28 28
29void __init prom_init_cmdline(void) 29void __init prom_init_cmdline(void)
30{ 30{
31 char *cp; 31 /* XXX: Get boot line from environment? */
32 cp = arcs_cmdline;
33 /* Get boot line from environment? */
34 *cp = '\0';
35} 32}
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 971f6c047b8a..d7088331fb0f 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -983,11 +983,15 @@ static void __init probe_pcache(void)
983 983
984 printk("Primary instruction cache %ldkB, %s, %s, linesize %d bytes.\n", 984 printk("Primary instruction cache %ldkB, %s, %s, linesize %d bytes.\n",
985 icache_size >> 10, 985 icache_size >> 10,
986 cpu_has_vtag_icache ? "virtually tagged" : "physically tagged", 986 cpu_has_vtag_icache ? "VIVT" : "VIPT",
987 way_string[c->icache.ways], c->icache.linesz); 987 way_string[c->icache.ways], c->icache.linesz);
988 988
989 printk("Primary data cache %ldkB, %s, linesize %d bytes.\n", 989 printk("Primary data cache %ldkB, %s, %s, %s, linesize %d bytes\n",
990 dcache_size >> 10, way_string[c->dcache.ways], c->dcache.linesz); 990 dcache_size >> 10, way_string[c->dcache.ways],
991 (c->dcache.flags & MIPS_CACHE_PINDEX) ? "PIPT" : "VIPT",
992 (c->dcache.flags & MIPS_CACHE_ALIASES) ?
993 "cache aliases" : "no aliases",
994 c->dcache.linesz);
991} 995}
992 996
993/* 997/*
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index 521771b373de..5699c7713e2f 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -180,7 +180,7 @@ out_of_memory:
180 } 180 }
181 printk("VM: killing process %s\n", tsk->comm); 181 printk("VM: killing process %s\n", tsk->comm);
182 if (user_mode(regs)) 182 if (user_mode(regs))
183 do_exit(SIGKILL); 183 do_group_exit(SIGKILL);
184 goto no_context; 184 goto no_context;
185 185
186do_sigbus: 186do_sigbus:
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 5240432e6d1d..110ee7656b41 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -211,7 +211,7 @@ void copy_user_highpage(struct page *to, struct page *from,
211 void *vfrom, *vto; 211 void *vfrom, *vto;
212 212
213 vto = kmap_atomic(to, KM_USER1); 213 vto = kmap_atomic(to, KM_USER1);
214 if (cpu_has_dc_aliases && !Page_dcache_dirty(from)) { 214 if (cpu_has_dc_aliases && page_mapped(from)) {
215 vfrom = kmap_coherent(from, vaddr); 215 vfrom = kmap_coherent(from, vaddr);
216 copy_page(vto, vfrom); 216 copy_page(vto, vfrom);
217 kunmap_coherent(); 217 kunmap_coherent();
@@ -234,12 +234,15 @@ void copy_to_user_page(struct vm_area_struct *vma,
234 struct page *page, unsigned long vaddr, void *dst, const void *src, 234 struct page *page, unsigned long vaddr, void *dst, const void *src,
235 unsigned long len) 235 unsigned long len)
236{ 236{
237 if (cpu_has_dc_aliases) { 237 if (cpu_has_dc_aliases && page_mapped(page)) {
238 void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK); 238 void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
239 memcpy(vto, src, len); 239 memcpy(vto, src, len);
240 kunmap_coherent(); 240 kunmap_coherent();
241 } else 241 } else {
242 memcpy(dst, src, len); 242 memcpy(dst, src, len);
243 if (cpu_has_dc_aliases)
244 SetPageDcacheDirty(page);
245 }
243 if ((vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc) 246 if ((vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc)
244 flush_cache_page(vma, vaddr, page_to_pfn(page)); 247 flush_cache_page(vma, vaddr, page_to_pfn(page));
245} 248}
@@ -250,13 +253,15 @@ void copy_from_user_page(struct vm_area_struct *vma,
250 struct page *page, unsigned long vaddr, void *dst, const void *src, 253 struct page *page, unsigned long vaddr, void *dst, const void *src,
251 unsigned long len) 254 unsigned long len)
252{ 255{
253 if (cpu_has_dc_aliases) { 256 if (cpu_has_dc_aliases && page_mapped(page)) {
254 void *vfrom = 257 void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
255 kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
256 memcpy(dst, vfrom, len); 258 memcpy(dst, vfrom, len);
257 kunmap_coherent(); 259 kunmap_coherent();
258 } else 260 } else {
259 memcpy(dst, src, len); 261 memcpy(dst, src, len);
262 if (cpu_has_dc_aliases)
263 SetPageDcacheDirty(page);
264 }
260} 265}
261 266
262EXPORT_SYMBOL(copy_from_user_page); 267EXPORT_SYMBOL(copy_from_user_page);
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 01b0961acfb6..a61246d3533d 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -66,7 +66,7 @@ static inline int __maybe_unused r10000_llsc_war(void)
66 * why; it's not an issue caused by the core RTL. 66 * why; it's not an issue caused by the core RTL.
67 * 67 *
68 */ 68 */
69static int __init m4kc_tlbp_war(void) 69static __init int __attribute__((unused)) m4kc_tlbp_war(void)
70{ 70{
71 return (current_cpu_data.processor_id & 0xffff00) == 71 return (current_cpu_data.processor_id & 0xffff00) ==
72 (PRID_COMP_MIPS | PRID_IMP_4KC); 72 (PRID_COMP_MIPS | PRID_IMP_4KC);
@@ -140,7 +140,7 @@ struct insn {
140 | (e) << RE_SH \ 140 | (e) << RE_SH \
141 | (f) << FUNC_SH) 141 | (f) << FUNC_SH)
142 142
143static struct insn insn_table[] __initdata = { 143static __initdata struct insn insn_table[] = {
144 { insn_addiu, M(addiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 144 { insn_addiu, M(addiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
145 { insn_addu, M(spec_op, 0, 0, 0, 0, addu_op), RS | RT | RD }, 145 { insn_addu, M(spec_op, 0, 0, 0, 0, addu_op), RS | RT | RD },
146 { insn_and, M(spec_op, 0, 0, 0, 0, and_op), RS | RT | RD }, 146 { insn_and, M(spec_op, 0, 0, 0, 0, and_op), RS | RT | RD },
@@ -193,7 +193,7 @@ static struct insn insn_table[] __initdata = {
193 193
194#undef M 194#undef M
195 195
196static u32 __init build_rs(u32 arg) 196static __init u32 build_rs(u32 arg)
197{ 197{
198 if (arg & ~RS_MASK) 198 if (arg & ~RS_MASK)
199 printk(KERN_WARNING "TLB synthesizer field overflow\n"); 199 printk(KERN_WARNING "TLB synthesizer field overflow\n");
@@ -201,7 +201,7 @@ static u32 __init build_rs(u32 arg)
201 return (arg & RS_MASK) << RS_SH; 201 return (arg & RS_MASK) << RS_SH;
202} 202}
203 203
204static u32 __init build_rt(u32 arg) 204static __init u32 build_rt(u32 arg)
205{ 205{
206 if (arg & ~RT_MASK) 206 if (arg & ~RT_MASK)
207 printk(KERN_WARNING "TLB synthesizer field overflow\n"); 207 printk(KERN_WARNING "TLB synthesizer field overflow\n");
@@ -209,7 +209,7 @@ static u32 __init build_rt(u32 arg)
209 return (arg & RT_MASK) << RT_SH; 209 return (arg & RT_MASK) << RT_SH;
210} 210}
211 211
212static u32 __init build_rd(u32 arg) 212static __init u32 build_rd(u32 arg)
213{ 213{
214 if (arg & ~RD_MASK) 214 if (arg & ~RD_MASK)
215 printk(KERN_WARNING "TLB synthesizer field overflow\n"); 215 printk(KERN_WARNING "TLB synthesizer field overflow\n");
@@ -217,7 +217,7 @@ static u32 __init build_rd(u32 arg)
217 return (arg & RD_MASK) << RD_SH; 217 return (arg & RD_MASK) << RD_SH;
218} 218}
219 219
220static u32 __init build_re(u32 arg) 220static __init u32 build_re(u32 arg)
221{ 221{
222 if (arg & ~RE_MASK) 222 if (arg & ~RE_MASK)
223 printk(KERN_WARNING "TLB synthesizer field overflow\n"); 223 printk(KERN_WARNING "TLB synthesizer field overflow\n");
@@ -225,7 +225,7 @@ static u32 __init build_re(u32 arg)
225 return (arg & RE_MASK) << RE_SH; 225 return (arg & RE_MASK) << RE_SH;
226} 226}
227 227
228static u32 __init build_simm(s32 arg) 228static __init u32 build_simm(s32 arg)
229{ 229{
230 if (arg > 0x7fff || arg < -0x8000) 230 if (arg > 0x7fff || arg < -0x8000)
231 printk(KERN_WARNING "TLB synthesizer field overflow\n"); 231 printk(KERN_WARNING "TLB synthesizer field overflow\n");
@@ -233,7 +233,7 @@ static u32 __init build_simm(s32 arg)
233 return arg & 0xffff; 233 return arg & 0xffff;
234} 234}
235 235
236static u32 __init build_uimm(u32 arg) 236static __init u32 build_uimm(u32 arg)
237{ 237{
238 if (arg & ~IMM_MASK) 238 if (arg & ~IMM_MASK)
239 printk(KERN_WARNING "TLB synthesizer field overflow\n"); 239 printk(KERN_WARNING "TLB synthesizer field overflow\n");
@@ -241,7 +241,7 @@ static u32 __init build_uimm(u32 arg)
241 return arg & IMM_MASK; 241 return arg & IMM_MASK;
242} 242}
243 243
244static u32 __init build_bimm(s32 arg) 244static __init u32 build_bimm(s32 arg)
245{ 245{
246 if (arg > 0x1ffff || arg < -0x20000) 246 if (arg > 0x1ffff || arg < -0x20000)
247 printk(KERN_WARNING "TLB synthesizer field overflow\n"); 247 printk(KERN_WARNING "TLB synthesizer field overflow\n");
@@ -252,7 +252,7 @@ static u32 __init build_bimm(s32 arg)
252 return ((arg < 0) ? (1 << 15) : 0) | ((arg >> 2) & 0x7fff); 252 return ((arg < 0) ? (1 << 15) : 0) | ((arg >> 2) & 0x7fff);
253} 253}
254 254
255static u32 __init build_jimm(u32 arg) 255static __init u32 build_jimm(u32 arg)
256{ 256{
257 if (arg & ~((JIMM_MASK) << 2)) 257 if (arg & ~((JIMM_MASK) << 2))
258 printk(KERN_WARNING "TLB synthesizer field overflow\n"); 258 printk(KERN_WARNING "TLB synthesizer field overflow\n");
@@ -260,7 +260,7 @@ static u32 __init build_jimm(u32 arg)
260 return (arg >> 2) & JIMM_MASK; 260 return (arg >> 2) & JIMM_MASK;
261} 261}
262 262
263static u32 __init build_func(u32 arg) 263static __init u32 build_func(u32 arg)
264{ 264{
265 if (arg & ~FUNC_MASK) 265 if (arg & ~FUNC_MASK)
266 printk(KERN_WARNING "TLB synthesizer field overflow\n"); 266 printk(KERN_WARNING "TLB synthesizer field overflow\n");
@@ -268,7 +268,7 @@ static u32 __init build_func(u32 arg)
268 return arg & FUNC_MASK; 268 return arg & FUNC_MASK;
269} 269}
270 270
271static u32 __init build_set(u32 arg) 271static __init u32 build_set(u32 arg)
272{ 272{
273 if (arg & ~SET_MASK) 273 if (arg & ~SET_MASK)
274 printk(KERN_WARNING "TLB synthesizer field overflow\n"); 274 printk(KERN_WARNING "TLB synthesizer field overflow\n");
@@ -315,69 +315,69 @@ static void __init build_insn(u32 **buf, enum opcode opc, ...)
315} 315}
316 316
317#define I_u1u2u3(op) \ 317#define I_u1u2u3(op) \
318 static inline void i##op(u32 **buf, unsigned int a, \ 318 static inline void __init i##op(u32 **buf, unsigned int a, \
319 unsigned int b, unsigned int c) \ 319 unsigned int b, unsigned int c) \
320 { \ 320 { \
321 build_insn(buf, insn##op, a, b, c); \ 321 build_insn(buf, insn##op, a, b, c); \
322 } 322 }
323 323
324#define I_u2u1u3(op) \ 324#define I_u2u1u3(op) \
325 static inline void i##op(u32 **buf, unsigned int a, \ 325 static inline void __init i##op(u32 **buf, unsigned int a, \
326 unsigned int b, unsigned int c) \ 326 unsigned int b, unsigned int c) \
327 { \ 327 { \
328 build_insn(buf, insn##op, b, a, c); \ 328 build_insn(buf, insn##op, b, a, c); \
329 } 329 }
330 330
331#define I_u3u1u2(op) \ 331#define I_u3u1u2(op) \
332 static inline void i##op(u32 **buf, unsigned int a, \ 332 static inline void __init i##op(u32 **buf, unsigned int a, \
333 unsigned int b, unsigned int c) \ 333 unsigned int b, unsigned int c) \
334 { \ 334 { \
335 build_insn(buf, insn##op, b, c, a); \ 335 build_insn(buf, insn##op, b, c, a); \
336 } 336 }
337 337
338#define I_u1u2s3(op) \ 338#define I_u1u2s3(op) \
339 static inline void i##op(u32 **buf, unsigned int a, \ 339 static inline void __init i##op(u32 **buf, unsigned int a, \
340 unsigned int b, signed int c) \ 340 unsigned int b, signed int c) \
341 { \ 341 { \
342 build_insn(buf, insn##op, a, b, c); \ 342 build_insn(buf, insn##op, a, b, c); \
343 } 343 }
344 344
345#define I_u2s3u1(op) \ 345#define I_u2s3u1(op) \
346 static inline void i##op(u32 **buf, unsigned int a, \ 346 static inline void __init i##op(u32 **buf, unsigned int a, \
347 signed int b, unsigned int c) \ 347 signed int b, unsigned int c) \
348 { \ 348 { \
349 build_insn(buf, insn##op, c, a, b); \ 349 build_insn(buf, insn##op, c, a, b); \
350 } 350 }
351 351
352#define I_u2u1s3(op) \ 352#define I_u2u1s3(op) \
353 static inline void i##op(u32 **buf, unsigned int a, \ 353 static inline void __init i##op(u32 **buf, unsigned int a, \
354 unsigned int b, signed int c) \ 354 unsigned int b, signed int c) \
355 { \ 355 { \
356 build_insn(buf, insn##op, b, a, c); \ 356 build_insn(buf, insn##op, b, a, c); \
357 } 357 }
358 358
359#define I_u1u2(op) \ 359#define I_u1u2(op) \
360 static inline void i##op(u32 **buf, unsigned int a, \ 360 static inline void __init i##op(u32 **buf, unsigned int a, \
361 unsigned int b) \ 361 unsigned int b) \
362 { \ 362 { \
363 build_insn(buf, insn##op, a, b); \ 363 build_insn(buf, insn##op, a, b); \
364 } 364 }
365 365
366#define I_u1s2(op) \ 366#define I_u1s2(op) \
367 static inline void i##op(u32 **buf, unsigned int a, \ 367 static inline void __init i##op(u32 **buf, unsigned int a, \
368 signed int b) \ 368 signed int b) \
369 { \ 369 { \
370 build_insn(buf, insn##op, a, b); \ 370 build_insn(buf, insn##op, a, b); \
371 } 371 }
372 372
373#define I_u1(op) \ 373#define I_u1(op) \
374 static inline void i##op(u32 **buf, unsigned int a) \ 374 static inline void __init i##op(u32 **buf, unsigned int a) \
375 { \ 375 { \
376 build_insn(buf, insn##op, a); \ 376 build_insn(buf, insn##op, a); \
377 } 377 }
378 378
379#define I_0(op) \ 379#define I_0(op) \
380 static inline void i##op(u32 **buf) \ 380 static inline void __init i##op(u32 **buf) \
381 { \ 381 { \
382 build_insn(buf, insn##op); \ 382 build_insn(buf, insn##op); \
383 } 383 }
@@ -457,7 +457,7 @@ struct label {
457 enum label_id lab; 457 enum label_id lab;
458}; 458};
459 459
460static void __init build_label(struct label **lab, u32 *addr, 460static __init void build_label(struct label **lab, u32 *addr,
461 enum label_id l) 461 enum label_id l)
462{ 462{
463 (*lab)->addr = addr; 463 (*lab)->addr = addr;
@@ -526,34 +526,34 @@ L_LA(_r3000_write_probe_fail)
526#define i_ehb(buf) i_sll(buf, 0, 0, 3) 526#define i_ehb(buf) i_sll(buf, 0, 0, 3)
527 527
528#ifdef CONFIG_64BIT 528#ifdef CONFIG_64BIT
529static int __init __maybe_unused in_compat_space_p(long addr) 529static __init int __maybe_unused in_compat_space_p(long addr)
530{ 530{
531 /* Is this address in 32bit compat space? */ 531 /* Is this address in 32bit compat space? */
532 return (((addr) & 0xffffffff00000000L) == 0xffffffff00000000L); 532 return (((addr) & 0xffffffff00000000L) == 0xffffffff00000000L);
533} 533}
534 534
535static int __init __maybe_unused rel_highest(long val) 535static __init int __maybe_unused rel_highest(long val)
536{ 536{
537 return ((((val + 0x800080008000L) >> 48) & 0xffff) ^ 0x8000) - 0x8000; 537 return ((((val + 0x800080008000L) >> 48) & 0xffff) ^ 0x8000) - 0x8000;
538} 538}
539 539
540static int __init __maybe_unused rel_higher(long val) 540static __init int __maybe_unused rel_higher(long val)
541{ 541{
542 return ((((val + 0x80008000L) >> 32) & 0xffff) ^ 0x8000) - 0x8000; 542 return ((((val + 0x80008000L) >> 32) & 0xffff) ^ 0x8000) - 0x8000;
543} 543}
544#endif 544#endif
545 545
546static int __init rel_hi(long val) 546static __init int rel_hi(long val)
547{ 547{
548 return ((((val + 0x8000L) >> 16) & 0xffff) ^ 0x8000) - 0x8000; 548 return ((((val + 0x8000L) >> 16) & 0xffff) ^ 0x8000) - 0x8000;
549} 549}
550 550
551static int __init rel_lo(long val) 551static __init int rel_lo(long val)
552{ 552{
553 return ((val & 0xffff) ^ 0x8000) - 0x8000; 553 return ((val & 0xffff) ^ 0x8000) - 0x8000;
554} 554}
555 555
556static void __init i_LA_mostly(u32 **buf, unsigned int rs, long addr) 556static __init void i_LA_mostly(u32 **buf, unsigned int rs, long addr)
557{ 557{
558#ifdef CONFIG_64BIT 558#ifdef CONFIG_64BIT
559 if (!in_compat_space_p(addr)) { 559 if (!in_compat_space_p(addr)) {
@@ -571,7 +571,7 @@ static void __init i_LA_mostly(u32 **buf, unsigned int rs, long addr)
571 i_lui(buf, rs, rel_hi(addr)); 571 i_lui(buf, rs, rel_hi(addr));
572} 572}
573 573
574static void __init __maybe_unused i_LA(u32 **buf, unsigned int rs, 574static __init void __maybe_unused i_LA(u32 **buf, unsigned int rs,
575 long addr) 575 long addr)
576{ 576{
577 i_LA_mostly(buf, rs, addr); 577 i_LA_mostly(buf, rs, addr);
@@ -589,7 +589,7 @@ struct reloc {
589 enum label_id lab; 589 enum label_id lab;
590}; 590};
591 591
592static void __init r_mips_pc16(struct reloc **rel, u32 *addr, 592static __init void r_mips_pc16(struct reloc **rel, u32 *addr,
593 enum label_id l) 593 enum label_id l)
594{ 594{
595 (*rel)->addr = addr; 595 (*rel)->addr = addr;
@@ -614,7 +614,7 @@ static inline void __resolve_relocs(struct reloc *rel, struct label *lab)
614 } 614 }
615} 615}
616 616
617static void __init resolve_relocs(struct reloc *rel, struct label *lab) 617static __init void resolve_relocs(struct reloc *rel, struct label *lab)
618{ 618{
619 struct label *l; 619 struct label *l;
620 620
@@ -624,7 +624,7 @@ static void __init resolve_relocs(struct reloc *rel, struct label *lab)
624 __resolve_relocs(rel, l); 624 __resolve_relocs(rel, l);
625} 625}
626 626
627static void __init move_relocs(struct reloc *rel, u32 *first, u32 *end, 627static __init void move_relocs(struct reloc *rel, u32 *first, u32 *end,
628 long off) 628 long off)
629{ 629{
630 for (; rel->lab != label_invalid; rel++) 630 for (; rel->lab != label_invalid; rel++)
@@ -632,7 +632,7 @@ static void __init move_relocs(struct reloc *rel, u32 *first, u32 *end,
632 rel->addr += off; 632 rel->addr += off;
633} 633}
634 634
635static void __init move_labels(struct label *lab, u32 *first, u32 *end, 635static __init void move_labels(struct label *lab, u32 *first, u32 *end,
636 long off) 636 long off)
637{ 637{
638 for (; lab->lab != label_invalid; lab++) 638 for (; lab->lab != label_invalid; lab++)
@@ -640,7 +640,7 @@ static void __init move_labels(struct label *lab, u32 *first, u32 *end,
640 lab->addr += off; 640 lab->addr += off;
641} 641}
642 642
643static void __init copy_handler(struct reloc *rel, struct label *lab, 643static __init void copy_handler(struct reloc *rel, struct label *lab,
644 u32 *first, u32 *end, u32 *target) 644 u32 *first, u32 *end, u32 *target)
645{ 645{
646 long off = (long)(target - first); 646 long off = (long)(target - first);
@@ -651,7 +651,7 @@ static void __init copy_handler(struct reloc *rel, struct label *lab,
651 move_labels(lab, first, end, off); 651 move_labels(lab, first, end, off);
652} 652}
653 653
654static int __init __maybe_unused insn_has_bdelay(struct reloc *rel, 654static __init int __maybe_unused insn_has_bdelay(struct reloc *rel,
655 u32 *addr) 655 u32 *addr)
656{ 656{
657 for (; rel->lab != label_invalid; rel++) { 657 for (; rel->lab != label_invalid; rel++) {
@@ -743,11 +743,11 @@ il_bgez(u32 **p, struct reloc **r, unsigned int reg, enum label_id l)
743 * We deliberately chose a buffer size of 128, so we won't scribble 743 * We deliberately chose a buffer size of 128, so we won't scribble
744 * over anything important on overflow before we panic. 744 * over anything important on overflow before we panic.
745 */ 745 */
746static u32 tlb_handler[128] __initdata; 746static __initdata u32 tlb_handler[128];
747 747
748/* simply assume worst case size for labels and relocs */ 748/* simply assume worst case size for labels and relocs */
749static struct label labels[128] __initdata; 749static __initdata struct label labels[128];
750static struct reloc relocs[128] __initdata; 750static __initdata struct reloc relocs[128];
751 751
752/* 752/*
753 * The R3000 TLB handler is simple. 753 * The R3000 TLB handler is simple.
@@ -801,7 +801,7 @@ static void __init build_r3000_tlb_refill_handler(void)
801 * other one.To keep things simple, we first assume linear space, 801 * other one.To keep things simple, we first assume linear space,
802 * then we relocate it to the final handler layout as needed. 802 * then we relocate it to the final handler layout as needed.
803 */ 803 */
804static u32 final_handler[64] __initdata; 804static __initdata u32 final_handler[64];
805 805
806/* 806/*
807 * Hazards 807 * Hazards
@@ -825,7 +825,7 @@ static u32 final_handler[64] __initdata;
825 * 825 *
826 * As if we MIPS hackers wouldn't know how to nop pipelines happy ... 826 * As if we MIPS hackers wouldn't know how to nop pipelines happy ...
827 */ 827 */
828static void __init __maybe_unused build_tlb_probe_entry(u32 **p) 828static __init void __maybe_unused build_tlb_probe_entry(u32 **p)
829{ 829{
830 switch (current_cpu_type()) { 830 switch (current_cpu_type()) {
831 /* Found by experiment: R4600 v2.0 needs this, too. */ 831 /* Found by experiment: R4600 v2.0 needs this, too. */
@@ -849,7 +849,7 @@ static void __init __maybe_unused build_tlb_probe_entry(u32 **p)
849 */ 849 */
850enum tlb_write_entry { tlb_random, tlb_indexed }; 850enum tlb_write_entry { tlb_random, tlb_indexed };
851 851
852static void __init build_tlb_write_entry(u32 **p, struct label **l, 852static __init void build_tlb_write_entry(u32 **p, struct label **l,
853 struct reloc **r, 853 struct reloc **r,
854 enum tlb_write_entry wmode) 854 enum tlb_write_entry wmode)
855{ 855{
@@ -993,7 +993,7 @@ static void __init build_tlb_write_entry(u32 **p, struct label **l,
993 * TMP and PTR are scratch. 993 * TMP and PTR are scratch.
994 * TMP will be clobbered, PTR will hold the pmd entry. 994 * TMP will be clobbered, PTR will hold the pmd entry.
995 */ 995 */
996static void __init 996static __init void
997build_get_pmde64(u32 **p, struct label **l, struct reloc **r, 997build_get_pmde64(u32 **p, struct label **l, struct reloc **r,
998 unsigned int tmp, unsigned int ptr) 998 unsigned int tmp, unsigned int ptr)
999{ 999{
@@ -1054,7 +1054,7 @@ build_get_pmde64(u32 **p, struct label **l, struct reloc **r,
1054 * BVADDR is the faulting address, PTR is scratch. 1054 * BVADDR is the faulting address, PTR is scratch.
1055 * PTR will hold the pgd for vmalloc. 1055 * PTR will hold the pgd for vmalloc.
1056 */ 1056 */
1057static void __init 1057static __init void
1058build_get_pgd_vmalloc64(u32 **p, struct label **l, struct reloc **r, 1058build_get_pgd_vmalloc64(u32 **p, struct label **l, struct reloc **r,
1059 unsigned int bvaddr, unsigned int ptr) 1059 unsigned int bvaddr, unsigned int ptr)
1060{ 1060{
@@ -1118,7 +1118,7 @@ build_get_pgd_vmalloc64(u32 **p, struct label **l, struct reloc **r,
1118 * TMP and PTR are scratch. 1118 * TMP and PTR are scratch.
1119 * TMP will be clobbered, PTR will hold the pgd entry. 1119 * TMP will be clobbered, PTR will hold the pgd entry.
1120 */ 1120 */
1121static void __init __maybe_unused 1121static __init void __maybe_unused
1122build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr) 1122build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr)
1123{ 1123{
1124 long pgdc = (long)pgd_current; 1124 long pgdc = (long)pgd_current;
@@ -1153,7 +1153,7 @@ build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr)
1153 1153
1154#endif /* !CONFIG_64BIT */ 1154#endif /* !CONFIG_64BIT */
1155 1155
1156static void __init build_adjust_context(u32 **p, unsigned int ctx) 1156static __init void build_adjust_context(u32 **p, unsigned int ctx)
1157{ 1157{
1158 unsigned int shift = 4 - (PTE_T_LOG2 + 1) + PAGE_SHIFT - 12; 1158 unsigned int shift = 4 - (PTE_T_LOG2 + 1) + PAGE_SHIFT - 12;
1159 unsigned int mask = (PTRS_PER_PTE / 2 - 1) << (PTE_T_LOG2 + 1); 1159 unsigned int mask = (PTRS_PER_PTE / 2 - 1) << (PTE_T_LOG2 + 1);
@@ -1179,7 +1179,7 @@ static void __init build_adjust_context(u32 **p, unsigned int ctx)
1179 i_andi(p, ctx, ctx, mask); 1179 i_andi(p, ctx, ctx, mask);
1180} 1180}
1181 1181
1182static void __init build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr) 1182static __init void build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr)
1183{ 1183{
1184 /* 1184 /*
1185 * Bug workaround for the Nevada. It seems as if under certain 1185 * Bug workaround for the Nevada. It seems as if under certain
@@ -1204,7 +1204,7 @@ static void __init build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr)
1204 i_ADDU(p, ptr, ptr, tmp); /* add in offset */ 1204 i_ADDU(p, ptr, ptr, tmp); /* add in offset */
1205} 1205}
1206 1206
1207static void __init build_update_entries(u32 **p, unsigned int tmp, 1207static __init void build_update_entries(u32 **p, unsigned int tmp,
1208 unsigned int ptep) 1208 unsigned int ptep)
1209{ 1209{
1210 /* 1210 /*
diff --git a/arch/mips/pci/pci-lasat.c b/arch/mips/pci/pci-lasat.c
index 5abd5c7119be..174f314933b5 100644
--- a/arch/mips/pci/pci-lasat.c
+++ b/arch/mips/pci/pci-lasat.c
@@ -10,6 +10,7 @@
10#include <linux/pci.h> 10#include <linux/pci.h>
11#include <linux/types.h> 11#include <linux/types.h>
12#include <asm/bootinfo.h> 12#include <asm/bootinfo.h>
13#include <asm/lasat/lasatint.h>
13 14
14extern struct pci_ops nile4_pci_ops; 15extern struct pci_ops nile4_pci_ops;
15extern struct pci_ops gt64xxx_pci0_ops; 16extern struct pci_ops gt64xxx_pci0_ops;
@@ -54,15 +55,15 @@ static int __init lasat_pci_setup(void)
54 55
55arch_initcall(lasat_pci_setup); 56arch_initcall(lasat_pci_setup);
56 57
57#define LASATINT_ETH1 0 58#define LASATINT_ETH1 (LASATINT_BASE + 0)
58#define LASATINT_ETH0 1 59#define LASATINT_ETH0 (LASATINT_BASE + 1)
59#define LASATINT_HDC 2 60#define LASATINT_HDC (LASATINT_BASE + 2)
60#define LASATINT_COMP 3 61#define LASATINT_COMP (LASATINT_BASE + 3)
61#define LASATINT_HDLC 4 62#define LASATINT_HDLC (LASATINT_BASE + 4)
62#define LASATINT_PCIA 5 63#define LASATINT_PCIA (LASATINT_BASE + 5)
63#define LASATINT_PCIB 6 64#define LASATINT_PCIB (LASATINT_BASE + 6)
64#define LASATINT_PCIC 7 65#define LASATINT_PCIC (LASATINT_BASE + 7)
65#define LASATINT_PCID 8 66#define LASATINT_PCID (LASATINT_BASE + 8)
66 67
67int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 68int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
68{ 69{
diff --git a/arch/mips/sgi-ip22/Makefile b/arch/mips/sgi-ip22/Makefile
index 1fb3e353e212..e3acb51b70b5 100644
--- a/arch/mips/sgi-ip22/Makefile
+++ b/arch/mips/sgi-ip22/Makefile
@@ -7,3 +7,5 @@ obj-y += ip22-mc.o ip22-hpc.o ip22-int.o ip22-berr.o \
7 ip22-time.o ip22-nvram.o ip22-platform.o ip22-reset.o ip22-setup.o 7 ip22-time.o ip22-nvram.o ip22-platform.o ip22-reset.o ip22-setup.o
8 8
9obj-$(CONFIG_EISA) += ip22-eisa.o 9obj-$(CONFIG_EISA) += ip22-eisa.o
10
11EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/sgi-ip22/ip22-reset.c b/arch/mips/sgi-ip22/ip22-reset.c
index 63afd7e44428..a435b31cf031 100644
--- a/arch/mips/sgi-ip22/ip22-reset.c
+++ b/arch/mips/sgi-ip22/ip22-reset.c
@@ -232,11 +232,18 @@ static struct notifier_block panic_block = {
232 232
233static int __init reboot_setup(void) 233static int __init reboot_setup(void)
234{ 234{
235 int res;
236
235 _machine_restart = sgi_machine_restart; 237 _machine_restart = sgi_machine_restart;
236 _machine_halt = sgi_machine_halt; 238 _machine_halt = sgi_machine_halt;
237 pm_power_off = sgi_machine_power_off; 239 pm_power_off = sgi_machine_power_off;
238 240
239 request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL); 241 res = request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL);
242 if (res) {
243 printk(KERN_ERR "Allocation of front panel IRQ failed\n");
244 return res;
245 }
246
240 init_timer(&blink_timer); 247 init_timer(&blink_timer);
241 blink_timer.function = blink_timeout; 248 blink_timer.function = blink_timeout;
242 atomic_notifier_chain_register(&panic_notifier_list, &panic_block); 249 atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
diff --git a/arch/mips/sgi-ip32/ip32-irq.c b/arch/mips/sgi-ip32/ip32-irq.c
index 7f4b793c3df3..7e8094f617bf 100644
--- a/arch/mips/sgi-ip32/ip32-irq.c
+++ b/arch/mips/sgi-ip32/ip32-irq.c
@@ -20,6 +20,7 @@
20#include <linux/random.h> 20#include <linux/random.h>
21#include <linux/sched.h> 21#include <linux/sched.h>
22 22
23#include <asm/irq_cpu.h>
23#include <asm/mipsregs.h> 24#include <asm/mipsregs.h>
24#include <asm/signal.h> 25#include <asm/signal.h>
25#include <asm/system.h> 26#include <asm/system.h>
@@ -46,7 +47,8 @@ static void inline flush_mace_bus(void)
46#define DBG(x...) 47#define DBG(x...)
47#endif 48#endif
48 49
49/* O2 irq map 50/*
51 * O2 irq map
50 * 52 *
51 * IP0 -> software (ignored) 53 * IP0 -> software (ignored)
52 * IP1 -> software (ignored) 54 * IP1 -> software (ignored)
@@ -55,60 +57,60 @@ static void inline flush_mace_bus(void)
55 * IP4 -> (irq2) X unknown 57 * IP4 -> (irq2) X unknown
56 * IP5 -> (irq3) X unknown 58 * IP5 -> (irq3) X unknown
57 * IP6 -> (irq4) X unknown 59 * IP6 -> (irq4) X unknown
58 * IP7 -> (irq5) 0 CPU count/compare timer (system timer) 60 * IP7 -> (irq5) 7 CPU count/compare timer (system timer)
59 * 61 *
60 * crime: (C) 62 * crime: (C)
61 * 63 *
62 * CRIME_INT_STAT 31:0: 64 * CRIME_INT_STAT 31:0:
63 * 65 *
64 * 0 -> 1 Video in 1 66 * 0 -> 8 Video in 1
65 * 1 -> 2 Video in 2 67 * 1 -> 9 Video in 2
66 * 2 -> 3 Video out 68 * 2 -> 10 Video out
67 * 3 -> 4 Mace ethernet 69 * 3 -> 11 Mace ethernet
68 * 4 -> S SuperIO sub-interrupt 70 * 4 -> S SuperIO sub-interrupt
69 * 5 -> M Miscellaneous sub-interrupt 71 * 5 -> M Miscellaneous sub-interrupt
70 * 6 -> A Audio sub-interrupt 72 * 6 -> A Audio sub-interrupt
71 * 7 -> 8 PCI bridge errors 73 * 7 -> 15 PCI bridge errors
72 * 8 -> 9 PCI SCSI aic7xxx 0 74 * 8 -> 16 PCI SCSI aic7xxx 0
73 * 9 -> 10 PCI SCSI aic7xxx 1 75 * 9 -> 17 PCI SCSI aic7xxx 1
74 * 10 -> 11 PCI slot 0 76 * 10 -> 18 PCI slot 0
75 * 11 -> 12 unused (PCI slot 1) 77 * 11 -> 19 unused (PCI slot 1)
76 * 12 -> 13 unused (PCI slot 2) 78 * 12 -> 20 unused (PCI slot 2)
77 * 13 -> 14 unused (PCI shared 0) 79 * 13 -> 21 unused (PCI shared 0)
78 * 14 -> 15 unused (PCI shared 1) 80 * 14 -> 22 unused (PCI shared 1)
79 * 15 -> 16 unused (PCI shared 2) 81 * 15 -> 23 unused (PCI shared 2)
80 * 16 -> 17 GBE0 (E) 82 * 16 -> 24 GBE0 (E)
81 * 17 -> 18 GBE1 (E) 83 * 17 -> 25 GBE1 (E)
82 * 18 -> 19 GBE2 (E) 84 * 18 -> 26 GBE2 (E)
83 * 19 -> 20 GBE3 (E) 85 * 19 -> 27 GBE3 (E)
84 * 20 -> 21 CPU errors 86 * 20 -> 28 CPU errors
85 * 21 -> 22 Memory errors 87 * 21 -> 29 Memory errors
86 * 22 -> 23 RE empty edge (E) 88 * 22 -> 30 RE empty edge (E)
87 * 23 -> 24 RE full edge (E) 89 * 23 -> 31 RE full edge (E)
88 * 24 -> 25 RE idle edge (E) 90 * 24 -> 32 RE idle edge (E)
89 * 25 -> 26 RE empty level 91 * 25 -> 33 RE empty level
90 * 26 -> 27 RE full level 92 * 26 -> 34 RE full level
91 * 27 -> 28 RE idle level 93 * 27 -> 35 RE idle level
92 * 28 -> 29 unused (software 0) (E) 94 * 28 -> 36 unused (software 0) (E)
93 * 29 -> 30 unused (software 1) (E) 95 * 29 -> 37 unused (software 1) (E)
94 * 30 -> 31 unused (software 2) - crime 1.5 CPU SysCorError (E) 96 * 30 -> 38 unused (software 2) - crime 1.5 CPU SysCorError (E)
95 * 31 -> 32 VICE 97 * 31 -> 39 VICE
96 * 98 *
97 * S, M, A: Use the MACE ISA interrupt register 99 * S, M, A: Use the MACE ISA interrupt register
98 * MACE_ISA_INT_STAT 31:0 100 * MACE_ISA_INT_STAT 31:0
99 * 101 *
100 * 0-7 -> 33-40 Audio 102 * 0-7 -> 40-47 Audio
101 * 8 -> 41 RTC 103 * 8 -> 48 RTC
102 * 9 -> 42 Keyboard 104 * 9 -> 49 Keyboard
103 * 10 -> X Keyboard polled 105 * 10 -> X Keyboard polled
104 * 11 -> 44 Mouse 106 * 11 -> 51 Mouse
105 * 12 -> X Mouse polled 107 * 12 -> X Mouse polled
106 * 13-15 -> 46-48 Count/compare timers 108 * 13-15 -> 53-55 Count/compare timers
107 * 16-19 -> 49-52 Parallel (16 E) 109 * 16-19 -> 56-59 Parallel (16 E)
108 * 20-25 -> 53-58 Serial 1 (22 E) 110 * 20-25 -> 60-62 Serial 1 (22 E)
109 * 26-31 -> 59-64 Serial 2 (28 E) 111 * 26-31 -> 66-71 Serial 2 (28 E)
110 * 112 *
111 * Note that this means IRQs 5-7, 43, and 45 do not exist. This is a 113 * Note that this means IRQs 12-14, 50, and 52 do not exist. This is a
112 * different IRQ map than IRIX uses, but that's OK as Linux irq handling 114 * different IRQ map than IRIX uses, but that's OK as Linux irq handling
113 * is quite different anyway. 115 * is quite different anyway.
114 */ 116 */
@@ -131,36 +133,6 @@ struct irqaction cpuerr_irq = {
131}; 133};
132 134
133/* 135/*
134 * For interrupts wired from a single device to the CPU. Only the clock
135 * uses this it seems, which is IRQ 0 and IP7.
136 */
137
138static void enable_cpu_irq(unsigned int irq)
139{
140 set_c0_status(STATUSF_IP7);
141}
142
143static void disable_cpu_irq(unsigned int irq)
144{
145 clear_c0_status(STATUSF_IP7);
146}
147
148static void end_cpu_irq(unsigned int irq)
149{
150 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
151 enable_cpu_irq(irq);
152}
153
154static struct irq_chip ip32_cpu_interrupt = {
155 .name = "IP32 CPU",
156 .ack = disable_cpu_irq,
157 .mask = disable_cpu_irq,
158 .mask_ack = disable_cpu_irq,
159 .unmask = enable_cpu_irq,
160 .end = end_cpu_irq,
161};
162
163/*
164 * This is for pure CRIME interrupts - ie not MACE. The advantage? 136 * This is for pure CRIME interrupts - ie not MACE. The advantage?
165 * We get to split the register in half and do faster lookups. 137 * We get to split the register in half and do faster lookups.
166 */ 138 */
@@ -422,15 +394,23 @@ static void ip32_irq0(void)
422 uint64_t crime_int; 394 uint64_t crime_int;
423 int irq = 0; 395 int irq = 0;
424 396
397 /*
398 * Sanity check interrupt numbering enum.
399 * MACE got 32 interrupts and there are 32 MACE ISA interrupts daisy
400 * chained.
401 */
402 BUILD_BUG_ON(CRIME_VICE_IRQ - MACE_VID_IN1_IRQ != 31);
403 BUILD_BUG_ON(MACEISA_SERIAL2_RDMAOR_IRQ - MACEISA_AUDIO_SW_IRQ != 31);
404
425 crime_int = crime->istat & crime_mask; 405 crime_int = crime->istat & crime_mask;
426 irq = __ffs(crime_int); 406 irq = MACE_VID_IN1_IRQ + __ffs(crime_int);
427 crime_int = 1 << irq; 407 crime_int = 1 << irq;
428 408
429 if (crime_int & CRIME_MACEISA_INT_MASK) { 409 if (crime_int & CRIME_MACEISA_INT_MASK) {
430 unsigned long mace_int = mace->perif.ctrl.istat; 410 unsigned long mace_int = mace->perif.ctrl.istat;
431 irq = __ffs(mace_int & maceisa_mask) + 32; 411 irq = __ffs(mace_int & maceisa_mask) + MACEISA_AUDIO_SW_IRQ;
432 } 412 }
433 irq++; 413
434 DBG("*irq %u*\n", irq); 414 DBG("*irq %u*\n", irq);
435 do_IRQ(irq); 415 do_IRQ(irq);
436} 416}
@@ -457,7 +437,7 @@ static void ip32_irq4(void)
457 437
458static void ip32_irq5(void) 438static void ip32_irq5(void)
459{ 439{
460 do_IRQ(IP32_R4K_TIMER_IRQ); 440 do_IRQ(MIPS_CPU_IRQ_BASE + 7);
461} 441}
462 442
463asmlinkage void plat_irq_dispatch(void) 443asmlinkage void plat_irq_dispatch(void)
@@ -490,21 +470,25 @@ void __init arch_init_irq(void)
490 mace->perif.ctrl.istat = 0; 470 mace->perif.ctrl.istat = 0;
491 mace->perif.ctrl.imask = 0; 471 mace->perif.ctrl.imask = 0;
492 472
493 for (irq = 0; irq <= IP32_IRQ_MAX; irq++) { 473 mips_cpu_irq_init();
494 struct irq_chip *controller; 474 for (irq = MIPS_CPU_IRQ_BASE + 8; irq <= IP32_IRQ_MAX; irq++) {
495 475 struct irq_chip *chip;
496 if (irq == IP32_R4K_TIMER_IRQ) 476
497 controller = &ip32_cpu_interrupt; 477 switch (irq) {
498 else if (irq <= MACE_PCI_BRIDGE_IRQ && irq >= MACE_VID_IN1_IRQ) 478 case MACE_VID_IN1_IRQ ... MACE_PCI_BRIDGE_IRQ:
499 controller = &ip32_mace_interrupt; 479 chip = &ip32_mace_interrupt;
500 else if (irq <= MACEPCI_SHARED2_IRQ && irq >= MACEPCI_SCSI0_IRQ) 480 break;
501 controller = &ip32_macepci_interrupt; 481 case MACEPCI_SCSI0_IRQ ... MACEPCI_SHARED2_IRQ:
502 else if (irq <= CRIME_VICE_IRQ && irq >= CRIME_GBE0_IRQ) 482 chip = &ip32_macepci_interrupt;
503 controller = &ip32_crime_interrupt; 483 break;
504 else 484 case CRIME_GBE0_IRQ ... CRIME_VICE_IRQ:
505 controller = &ip32_maceisa_interrupt; 485 chip = &ip32_crime_interrupt;
506 486 break;
507 set_irq_chip(irq, controller); 487 default:
488 chip = &ip32_maceisa_interrupt;
489 }
490
491 set_irq_chip(irq, chip);
508 } 492 }
509 setup_irq(CRIME_MEMERR_IRQ, &memerr_irq); 493 setup_irq(CRIME_MEMERR_IRQ, &memerr_irq);
510 setup_irq(CRIME_CPUERR_IRQ, &cpuerr_irq); 494 setup_irq(CRIME_CPUERR_IRQ, &cpuerr_irq);
diff --git a/arch/mips/sgi-ip32/ip32-setup.c b/arch/mips/sgi-ip32/ip32-setup.c
index 4125a5ba119e..fc75bfcb0c0e 100644
--- a/arch/mips/sgi-ip32/ip32-setup.c
+++ b/arch/mips/sgi-ip32/ip32-setup.c
@@ -83,7 +83,7 @@ void __init plat_time_init(void)
83void __init plat_timer_setup(struct irqaction *irq) 83void __init plat_timer_setup(struct irqaction *irq)
84{ 84{
85 irq->handler = no_action; 85 irq->handler = no_action;
86 setup_irq(IP32_R4K_TIMER_IRQ, irq); 86 setup_irq(MIPS_CPU_IRQ_BASE + 7, irq);
87} 87}
88 88
89void __init plat_mem_setup(void) 89void __init plat_mem_setup(void)
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
index acaf613358c7..b97102a1c635 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
@@ -963,7 +963,7 @@ static int __init toshiba_rbtx4927_rtc_init(void)
963 .flags = IORESOURCE_MEM, 963 .flags = IORESOURCE_MEM,
964 }; 964 };
965 struct platform_device *dev = 965 struct platform_device *dev =
966 platform_device_register_simple("ds1742", -1, &res, 1); 966 platform_device_register_simple("rtc-ds1742", -1, &res, 1);
967 return IS_ERR(dev) ? PTR_ERR(dev) : 0; 967 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
968} 968}
969device_initcall(toshiba_rbtx4927_rtc_init); 969device_initcall(toshiba_rbtx4927_rtc_init);
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c
index 26ec774c5027..49c637970789 100644
--- a/arch/parisc/kernel/ptrace.c
+++ b/arch/parisc/kernel/ptrace.c
@@ -329,10 +329,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
329 /* give it a chance to run. */ 329 /* give it a chance to run. */
330 goto out_wake; 330 goto out_wake;
331 331
332 case PTRACE_DETACH:
333 ret = ptrace_detach(child, data);
334 goto out_tsk;
335
336 case PTRACE_GETEVENTMSG: 332 case PTRACE_GETEVENTMSG:
337 ret = put_user(child->ptrace_message, (unsigned int __user *) data); 333 ret = put_user(child->ptrace_message, (unsigned int __user *) data);
338 goto out_tsk; 334 goto out_tsk;
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c
index 7899ab87785a..1c091b415cd9 100644
--- a/arch/parisc/mm/fault.c
+++ b/arch/parisc/mm/fault.c
@@ -263,6 +263,6 @@ no_context:
263 up_read(&mm->mmap_sem); 263 up_read(&mm->mmap_sem);
264 printk(KERN_CRIT "VM: killing process %s\n", current->comm); 264 printk(KERN_CRIT "VM: killing process %s\n", current->comm);
265 if (user_mode(regs)) 265 if (user_mode(regs))
266 do_exit(SIGKILL); 266 do_group_exit(SIGKILL);
267 goto no_context; 267 goto no_context;
268} 268}
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 037664d496d7..5e001ad588a7 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -295,6 +295,7 @@ config ARCH_FLATMEM_ENABLE
295config ARCH_SPARSEMEM_ENABLE 295config ARCH_SPARSEMEM_ENABLE
296 def_bool y 296 def_bool y
297 depends on PPC64 297 depends on PPC64
298 select SPARSEMEM_VMEMMAP_ENABLE
298 299
299config ARCH_SPARSEMEM_DEFAULT 300config ARCH_SPARSEMEM_DEFAULT
300 def_bool y 301 def_bool y
diff --git a/arch/powerpc/kernel/dma_64.c b/arch/powerpc/kernel/dma_64.c
index 7b0e754383cf..9001104b56b0 100644
--- a/arch/powerpc/kernel/dma_64.c
+++ b/arch/powerpc/kernel/dma_64.c
@@ -154,12 +154,13 @@ static void dma_direct_unmap_single(struct device *dev, dma_addr_t dma_addr,
154{ 154{
155} 155}
156 156
157static int dma_direct_map_sg(struct device *dev, struct scatterlist *sg, 157static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
158 int nents, enum dma_data_direction direction) 158 int nents, enum dma_data_direction direction)
159{ 159{
160 struct scatterlist *sg;
160 int i; 161 int i;
161 162
162 for (i = 0; i < nents; i++, sg++) { 163 for_each_sg(sgl, sg, nents, i) {
163 sg->dma_address = (page_to_phys(sg->page) + sg->offset) | 164 sg->dma_address = (page_to_phys(sg->page) + sg->offset) |
164 dma_direct_offset; 165 dma_direct_offset;
165 sg->dma_length = sg->length; 166 sg->dma_length = sg->length;
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 53bf64623bd8..2e16ca5778a3 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -87,15 +87,16 @@ static void ibmebus_unmap_single(struct device *dev,
87} 87}
88 88
89static int ibmebus_map_sg(struct device *dev, 89static int ibmebus_map_sg(struct device *dev,
90 struct scatterlist *sg, 90 struct scatterlist *sgl,
91 int nents, enum dma_data_direction direction) 91 int nents, enum dma_data_direction direction)
92{ 92{
93 struct scatterlist *sg;
93 int i; 94 int i;
94 95
95 for (i = 0; i < nents; i++) { 96 for_each_sg(sgl, sg, nents, i) {
96 sg[i].dma_address = (dma_addr_t)page_address(sg[i].page) 97 sg->dma_address = (dma_addr_t)page_address(sg->page)
97 + sg[i].offset; 98 + sg->offset;
98 sg[i].dma_length = sg[i].length; 99 sg->dma_length = sg->length;
99 } 100 }
100 101
101 return nents; 102 return nents;
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index e4ec6eee81a8..306a6f75b6c5 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -277,7 +277,7 @@ int iommu_map_sg(struct iommu_table *tbl, struct scatterlist *sglist,
277 dma_addr_t dma_next = 0, dma_addr; 277 dma_addr_t dma_next = 0, dma_addr;
278 unsigned long flags; 278 unsigned long flags;
279 struct scatterlist *s, *outs, *segstart; 279 struct scatterlist *s, *outs, *segstart;
280 int outcount, incount; 280 int outcount, incount, i;
281 unsigned long handle; 281 unsigned long handle;
282 282
283 BUG_ON(direction == DMA_NONE); 283 BUG_ON(direction == DMA_NONE);
@@ -297,7 +297,7 @@ int iommu_map_sg(struct iommu_table *tbl, struct scatterlist *sglist,
297 297
298 spin_lock_irqsave(&(tbl->it_lock), flags); 298 spin_lock_irqsave(&(tbl->it_lock), flags);
299 299
300 for (s = outs; nelems; nelems--, s++) { 300 for_each_sg(sglist, s, nelems, i) {
301 unsigned long vaddr, npages, entry, slen; 301 unsigned long vaddr, npages, entry, slen;
302 302
303 slen = s->length; 303 slen = s->length;
@@ -341,7 +341,8 @@ int iommu_map_sg(struct iommu_table *tbl, struct scatterlist *sglist,
341 if (novmerge || (dma_addr != dma_next)) { 341 if (novmerge || (dma_addr != dma_next)) {
342 /* Can't merge: create a new segment */ 342 /* Can't merge: create a new segment */
343 segstart = s; 343 segstart = s;
344 outcount++; outs++; 344 outcount++;
345 outs = sg_next(outs);
345 DBG(" can't merge, new segment.\n"); 346 DBG(" can't merge, new segment.\n");
346 } else { 347 } else {
347 outs->dma_length += s->length; 348 outs->dma_length += s->length;
@@ -374,7 +375,7 @@ int iommu_map_sg(struct iommu_table *tbl, struct scatterlist *sglist,
374 * next entry of the sglist if we didn't fill the list completely 375 * next entry of the sglist if we didn't fill the list completely
375 */ 376 */
376 if (outcount < incount) { 377 if (outcount < incount) {
377 outs++; 378 outs = sg_next(outs);
378 outs->dma_address = DMA_ERROR_CODE; 379 outs->dma_address = DMA_ERROR_CODE;
379 outs->dma_length = 0; 380 outs->dma_length = 0;
380 } 381 }
@@ -385,7 +386,7 @@ int iommu_map_sg(struct iommu_table *tbl, struct scatterlist *sglist,
385 return outcount; 386 return outcount;
386 387
387 failure: 388 failure:
388 for (s = &sglist[0]; s <= outs; s++) { 389 for_each_sg(sglist, s, nelems, i) {
389 if (s->dma_length != 0) { 390 if (s->dma_length != 0) {
390 unsigned long vaddr, npages; 391 unsigned long vaddr, npages;
391 392
@@ -395,6 +396,8 @@ int iommu_map_sg(struct iommu_table *tbl, struct scatterlist *sglist,
395 s->dma_address = DMA_ERROR_CODE; 396 s->dma_address = DMA_ERROR_CODE;
396 s->dma_length = 0; 397 s->dma_length = 0;
397 } 398 }
399 if (s == outs)
400 break;
398 } 401 }
399 spin_unlock_irqrestore(&(tbl->it_lock), flags); 402 spin_unlock_irqrestore(&(tbl->it_lock), flags);
400 return 0; 403 return 0;
@@ -404,6 +407,7 @@ int iommu_map_sg(struct iommu_table *tbl, struct scatterlist *sglist,
404void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist, 407void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
405 int nelems, enum dma_data_direction direction) 408 int nelems, enum dma_data_direction direction)
406{ 409{
410 struct scatterlist *sg;
407 unsigned long flags; 411 unsigned long flags;
408 412
409 BUG_ON(direction == DMA_NONE); 413 BUG_ON(direction == DMA_NONE);
@@ -413,15 +417,16 @@ void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
413 417
414 spin_lock_irqsave(&(tbl->it_lock), flags); 418 spin_lock_irqsave(&(tbl->it_lock), flags);
415 419
420 sg = sglist;
416 while (nelems--) { 421 while (nelems--) {
417 unsigned int npages; 422 unsigned int npages;
418 dma_addr_t dma_handle = sglist->dma_address; 423 dma_addr_t dma_handle = sg->dma_address;
419 424
420 if (sglist->dma_length == 0) 425 if (sg->dma_length == 0)
421 break; 426 break;
422 npages = iommu_num_pages(dma_handle,sglist->dma_length); 427 npages = iommu_num_pages(dma_handle, sg->dma_length);
423 __iommu_free(tbl, dma_handle, npages); 428 __iommu_free(tbl, dma_handle, npages);
424 sglist++; 429 sg = sg_next(sg);
425 } 430 }
426 431
427 /* Flush/invalidate TLBs if necessary. As for iommu_free(), we 432 /* Flush/invalidate TLBs if necessary. As for iommu_free(), we
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 440f5a87271f..5338e4855712 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -38,6 +38,8 @@
38DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; 38DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
39DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); 39DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
40 40
41struct kretprobe_blackpoint kretprobe_blacklist[] = {{NULL, NULL}};
42
41int __kprobes arch_prepare_kprobe(struct kprobe *p) 43int __kprobes arch_prepare_kprobe(struct kprobe *p)
42{ 44{
43 int ret = 0; 45 int ret = 0;
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
index 89b911e83c04..8f3db32fac8b 100644
--- a/arch/powerpc/kernel/of_device.c
+++ b/arch/powerpc/kernel/of_device.c
@@ -57,26 +57,21 @@ ssize_t of_device_get_modalias(struct of_device *ofdev,
57 return tsize; 57 return tsize;
58} 58}
59 59
60int of_device_uevent(struct device *dev, 60int of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
61 char **envp, int num_envp, char *buffer, int buffer_size)
62{ 61{
63 struct of_device *ofdev; 62 struct of_device *ofdev;
64 const char *compat; 63 const char *compat;
65 int i = 0, length = 0, seen = 0, cplen, sl; 64 int seen = 0, cplen, sl;
66 65
67 if (!dev) 66 if (!dev)
68 return -ENODEV; 67 return -ENODEV;
69 68
70 ofdev = to_of_device(dev); 69 ofdev = to_of_device(dev);
71 70
72 if (add_uevent_var(envp, num_envp, &i, 71 if (add_uevent_var(env, "OF_NAME=%s", ofdev->node->name))
73 buffer, buffer_size, &length,
74 "OF_NAME=%s", ofdev->node->name))
75 return -ENOMEM; 72 return -ENOMEM;
76 73
77 if (add_uevent_var(envp, num_envp, &i, 74 if (add_uevent_var(env, "OF_TYPE=%s", ofdev->node->type))
78 buffer, buffer_size, &length,
79 "OF_TYPE=%s", ofdev->node->type))
80 return -ENOMEM; 75 return -ENOMEM;
81 76
82 /* Since the compatible field can contain pretty much anything 77 /* Since the compatible field can contain pretty much anything
@@ -85,9 +80,7 @@ int of_device_uevent(struct device *dev,
85 80
86 compat = of_get_property(ofdev->node, "compatible", &cplen); 81 compat = of_get_property(ofdev->node, "compatible", &cplen);
87 while (compat && *compat && cplen > 0) { 82 while (compat && *compat && cplen > 0) {
88 if (add_uevent_var(envp, num_envp, &i, 83 if (add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat))
89 buffer, buffer_size, &length,
90 "OF_COMPATIBLE_%d=%s", seen, compat))
91 return -ENOMEM; 84 return -ENOMEM;
92 85
93 sl = strlen (compat) + 1; 86 sl = strlen (compat) + 1;
@@ -96,25 +89,17 @@ int of_device_uevent(struct device *dev,
96 seen++; 89 seen++;
97 } 90 }
98 91
99 if (add_uevent_var(envp, num_envp, &i, 92 if (add_uevent_var(env, "OF_COMPATIBLE_N=%d", seen))
100 buffer, buffer_size, &length,
101 "OF_COMPATIBLE_N=%d", seen))
102 return -ENOMEM; 93 return -ENOMEM;
103 94
104 /* modalias is trickier, we add it in 2 steps */ 95 /* modalias is trickier, we add it in 2 steps */
105 if (add_uevent_var(envp, num_envp, &i, 96 if (add_uevent_var(env, "MODALIAS="))
106 buffer, buffer_size, &length,
107 "MODALIAS="))
108 return -ENOMEM; 97 return -ENOMEM;
109 98 sl = of_device_get_modalias(ofdev, &env->buf[env->buflen-1],
110 sl = of_device_get_modalias(ofdev, &buffer[length-1], 99 sizeof(env->buf) - env->buflen);
111 buffer_size-length); 100 if (sl >= (sizeof(env->buf) - env->buflen))
112 if (sl >= (buffer_size-length))
113 return -ENOMEM; 101 return -ENOMEM;
114 102 env->buflen += sl;
115 length += sl;
116
117 envp[i] = NULL;
118 103
119 return 0; 104 return 0;
120} 105}
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index cf7732cdd6c7..3e17d154d0d4 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -505,10 +505,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
505 ret = ptrace_set_debugreg(child, addr, data); 505 ret = ptrace_set_debugreg(child, addr, data);
506 break; 506 break;
507 507
508 case PTRACE_DETACH:
509 ret = ptrace_detach(child, data);
510 break;
511
512#ifdef CONFIG_PPC64 508#ifdef CONFIG_PPC64
513 case PTRACE_GETREGS64: 509 case PTRACE_GETREGS64:
514#endif 510#endif
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 36c90ba2d312..2de00f870edc 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -413,16 +413,28 @@ void __init smp_setup_cpu_maps(void)
413 of_node_put(dn); 413 of_node_put(dn);
414 } 414 }
415 415
416 vdso_data->processorCount = num_present_cpus();
417#endif /* CONFIG_PPC64 */
418}
419
420/*
421 * Being that cpu_sibling_map is now a per_cpu array, then it cannot
422 * be initialized until the per_cpu areas have been created. This
423 * function is now called from setup_per_cpu_areas().
424 */
425void __init smp_setup_cpu_sibling_map(void)
426{
427#if defined(CONFIG_PPC64)
428 int cpu;
429
416 /* 430 /*
417 * Do the sibling map; assume only two threads per processor. 431 * Do the sibling map; assume only two threads per processor.
418 */ 432 */
419 for_each_possible_cpu(cpu) { 433 for_each_possible_cpu(cpu) {
420 cpu_set(cpu, cpu_sibling_map[cpu]); 434 cpu_set(cpu, per_cpu(cpu_sibling_map, cpu));
421 if (cpu_has_feature(CPU_FTR_SMT)) 435 if (cpu_has_feature(CPU_FTR_SMT))
422 cpu_set(cpu ^ 0x1, cpu_sibling_map[cpu]); 436 cpu_set(cpu ^ 0x1, per_cpu(cpu_sibling_map, cpu));
423 } 437 }
424
425 vdso_data->processorCount = num_present_cpus();
426#endif /* CONFIG_PPC64 */ 438#endif /* CONFIG_PPC64 */
427} 439}
428#endif /* CONFIG_SMP */ 440#endif /* CONFIG_SMP */
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 008ab6823b02..0e014550b83f 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -597,6 +597,9 @@ void __init setup_per_cpu_areas(void)
597 paca[i].data_offset = ptr - __per_cpu_start; 597 paca[i].data_offset = ptr - __per_cpu_start;
598 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); 598 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
599 } 599 }
600
601 /* Now that per_cpu is setup, initialize cpu_sibling_map */
602 smp_setup_cpu_sibling_map();
600} 603}
601#endif 604#endif
602 605
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index d30f08fa0297..338950aeb6f6 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -61,11 +61,11 @@ struct thread_info *secondary_ti;
61 61
62cpumask_t cpu_possible_map = CPU_MASK_NONE; 62cpumask_t cpu_possible_map = CPU_MASK_NONE;
63cpumask_t cpu_online_map = CPU_MASK_NONE; 63cpumask_t cpu_online_map = CPU_MASK_NONE;
64cpumask_t cpu_sibling_map[NR_CPUS] = { [0 ... NR_CPUS-1] = CPU_MASK_NONE }; 64DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE;
65 65
66EXPORT_SYMBOL(cpu_online_map); 66EXPORT_SYMBOL(cpu_online_map);
67EXPORT_SYMBOL(cpu_possible_map); 67EXPORT_SYMBOL(cpu_possible_map);
68EXPORT_SYMBOL(cpu_sibling_map); 68EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
69 69
70/* SMP operations for this machine */ 70/* SMP operations for this machine */
71struct smp_ops_t *smp_ops; 71struct smp_ops_t *smp_ops;
diff --git a/arch/powerpc/kernel/vdso32/vdso32.lds.S b/arch/powerpc/kernel/vdso32/vdso32.lds.S
index 26e138c4ce17..9352ab5200e5 100644
--- a/arch/powerpc/kernel/vdso32/vdso32.lds.S
+++ b/arch/powerpc/kernel/vdso32/vdso32.lds.S
@@ -1,130 +1,147 @@
1
2/* 1/*
3 * This is the infamous ld script for the 32 bits vdso 2 * This is the infamous ld script for the 32 bits vdso
4 * library 3 * library
5 */ 4 */
6#include <asm/vdso.h> 5#include <asm/vdso.h>
7 6
8/* Default link addresses for the vDSOs */
9OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") 7OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
10OUTPUT_ARCH(powerpc:common) 8OUTPUT_ARCH(powerpc:common)
11ENTRY(_start) 9ENTRY(_start)
12 10
13SECTIONS 11SECTIONS
14{ 12{
15 . = VDSO32_LBASE + SIZEOF_HEADERS; 13 . = VDSO32_LBASE + SIZEOF_HEADERS;
16 .hash : { *(.hash) } :text 14
17 .gnu.hash : { *(.gnu.hash) } 15 .hash : { *(.hash) } :text
18 .dynsym : { *(.dynsym) } 16 .gnu.hash : { *(.gnu.hash) }
19 .dynstr : { *(.dynstr) } 17 .dynsym : { *(.dynsym) }
20 .gnu.version : { *(.gnu.version) } 18 .dynstr : { *(.dynstr) }
21 .gnu.version_d : { *(.gnu.version_d) } 19 .gnu.version : { *(.gnu.version) }
22 .gnu.version_r : { *(.gnu.version_r) } 20 .gnu.version_d : { *(.gnu.version_d) }
23 21 .gnu.version_r : { *(.gnu.version_r) }
24 .note : { *(.note.*) } :text :note 22
25 23 .note : { *(.note.*) } :text :note
26 . = ALIGN (16); 24
27 .text : 25 . = ALIGN(16);
28 { 26 .text : {
29 *(.text .stub .text.* .gnu.linkonce.t.*) 27 *(.text .stub .text.* .gnu.linkonce.t.*)
30 } 28 }
31 PROVIDE (__etext = .); 29 PROVIDE(__etext = .);
32 PROVIDE (_etext = .); 30 PROVIDE(_etext = .);
33 PROVIDE (etext = .); 31 PROVIDE(etext = .);
34 32
35 . = ALIGN(8); 33 . = ALIGN(8);
36 __ftr_fixup : { 34 __ftr_fixup : { *(__ftr_fixup) }
37 *(__ftr_fixup)
38 }
39 35
40#ifdef CONFIG_PPC64 36#ifdef CONFIG_PPC64
41 . = ALIGN(8); 37 . = ALIGN(8);
42 __fw_ftr_fixup : { 38 __fw_ftr_fixup : { *(__fw_ftr_fixup) }
43 *(__fw_ftr_fixup)
44 }
45#endif 39#endif
46 40
47 /* Other stuff is appended to the text segment: */ 41 /*
48 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 42 * Other stuff is appended to the text segment:
49 .rodata1 : { *(.rodata1) } 43 */
50 44 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
51 .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr 45 .rodata1 : { *(.rodata1) }
52 .eh_frame : { KEEP (*(.eh_frame)) } :text 46
53 .gcc_except_table : { *(.gcc_except_table) } 47 .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
54 .fixup : { *(.fixup) } 48 .eh_frame : { KEEP (*(.eh_frame)) } :text
55 49 .gcc_except_table : { *(.gcc_except_table) }
56 .dynamic : { *(.dynamic) } :text :dynamic 50 .fixup : { *(.fixup) }
57 .got : { *(.got) } 51
58 .plt : { *(.plt) } 52 .dynamic : { *(.dynamic) } :text :dynamic
59 53 .got : { *(.got) }
60 _end = .; 54 .plt : { *(.plt) }
61 __end = .; 55
62 PROVIDE (end = .); 56 _end = .;
63 57 __end = .;
64 58 PROVIDE(end = .);
65 /* Stabs debugging sections are here too 59
66 */ 60 /*
67 .stab 0 : { *(.stab) } 61 * Stabs debugging sections are here too.
68 .stabstr 0 : { *(.stabstr) } 62 */
69 .stab.excl 0 : { *(.stab.excl) } 63 .stab 0 : { *(.stab) }
70 .stab.exclstr 0 : { *(.stab.exclstr) } 64 .stabstr 0 : { *(.stabstr) }
71 .stab.index 0 : { *(.stab.index) } 65 .stab.excl 0 : { *(.stab.excl) }
72 .stab.indexstr 0 : { *(.stab.indexstr) } 66 .stab.exclstr 0 : { *(.stab.exclstr) }
73 .comment 0 : { *(.comment) } 67 .stab.index 0 : { *(.stab.index) }
74 .debug 0 : { *(.debug) } 68 .stab.indexstr 0 : { *(.stab.indexstr) }
75 .line 0 : { *(.line) } 69 .comment 0 : { *(.comment) }
76 70
77 .debug_srcinfo 0 : { *(.debug_srcinfo) } 71 /*
78 .debug_sfnames 0 : { *(.debug_sfnames) } 72 * DWARF debug sections.
79 73 * Symbols in the DWARF debugging sections are relative to the beginning
80 .debug_aranges 0 : { *(.debug_aranges) } 74 * of the section so we begin them at 0.
81 .debug_pubnames 0 : { *(.debug_pubnames) } 75 */
82 76 /* DWARF 1 */
83 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 77 .debug 0 : { *(.debug) }
84 .debug_abbrev 0 : { *(.debug_abbrev) } 78 .line 0 : { *(.line) }
85 .debug_line 0 : { *(.debug_line) } 79 /* GNU DWARF 1 extensions */
86 .debug_frame 0 : { *(.debug_frame) } 80 .debug_srcinfo 0 : { *(.debug_srcinfo) }
87 .debug_str 0 : { *(.debug_str) } 81 .debug_sfnames 0 : { *(.debug_sfnames) }
88 .debug_loc 0 : { *(.debug_loc) } 82 /* DWARF 1.1 and DWARF 2 */
89 .debug_macinfo 0 : { *(.debug_macinfo) } 83 .debug_aranges 0 : { *(.debug_aranges) }
90 84 .debug_pubnames 0 : { *(.debug_pubnames) }
91 .debug_weaknames 0 : { *(.debug_weaknames) } 85 /* DWARF 2 */
92 .debug_funcnames 0 : { *(.debug_funcnames) } 86 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
93 .debug_typenames 0 : { *(.debug_typenames) } 87 .debug_abbrev 0 : { *(.debug_abbrev) }
94 .debug_varnames 0 : { *(.debug_varnames) } 88 .debug_line 0 : { *(.debug_line) }
95 89 .debug_frame 0 : { *(.debug_frame) }
96 /DISCARD/ : { *(.note.GNU-stack) } 90 .debug_str 0 : { *(.debug_str) }
97 /DISCARD/ : { *(.data .data.* .gnu.linkonce.d.* .sdata*) } 91 .debug_loc 0 : { *(.debug_loc) }
98 /DISCARD/ : { *(.bss .sbss .dynbss .dynsbss) } 92 .debug_macinfo 0 : { *(.debug_macinfo) }
93 /* SGI/MIPS DWARF 2 extensions */
94 .debug_weaknames 0 : { *(.debug_weaknames) }
95 .debug_funcnames 0 : { *(.debug_funcnames) }
96 .debug_typenames 0 : { *(.debug_typenames) }
97 .debug_varnames 0 : { *(.debug_varnames) }
98
99 /DISCARD/ : {
100 *(.note.GNU-stack)
101 *(.data .data.* .gnu.linkonce.d.* .sdata*)
102 *(.bss .sbss .dynbss .dynsbss)
103 }
99} 104}
100 105
106/*
107 * Very old versions of ld do not recognize this name token; use the constant.
108 */
109#define PT_GNU_EH_FRAME 0x6474e550
101 110
111/*
112 * We must supply the ELF program headers explicitly to get just one
113 * PT_LOAD segment, and set the flags explicitly to make segments read-only.
114 */
102PHDRS 115PHDRS
103{ 116{
104 text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */ 117 text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
105 note PT_NOTE FLAGS(4); /* PF_R */ 118 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
106 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ 119 note PT_NOTE FLAGS(4); /* PF_R */
107 eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */ 120 eh_frame_hdr PT_GNU_EH_FRAME;
108} 121}
109 122
110
111/* 123/*
112 * This controls what symbols we export from the DSO. 124 * This controls what symbols we export from the DSO.
113 */ 125 */
114VERSION 126VERSION
115{ 127{
116 VDSO_VERSION_STRING { 128 VDSO_VERSION_STRING {
117 global: 129 global:
118 __kernel_datapage_offset; /* Has to be there for the kernel to find */ 130 /*
119 __kernel_get_syscall_map; 131 * Has to be there for the kernel to find
120 __kernel_gettimeofday; 132 */
121 __kernel_clock_gettime; 133 __kernel_datapage_offset;
122 __kernel_clock_getres; 134
123 __kernel_get_tbfreq; 135 __kernel_get_syscall_map;
124 __kernel_sync_dicache; 136 __kernel_gettimeofday;
125 __kernel_sync_dicache_p5; 137 __kernel_clock_gettime;
126 __kernel_sigtramp32; 138 __kernel_clock_getres;
127 __kernel_sigtramp_rt32; 139 __kernel_get_tbfreq;
128 local: *; 140 __kernel_sync_dicache;
129 }; 141 __kernel_sync_dicache_p5;
142 __kernel_sigtramp32;
143 __kernel_sigtramp_rt32;
144
145 local: *;
146 };
130} 147}
diff --git a/arch/powerpc/kernel/vdso64/vdso64.lds.S b/arch/powerpc/kernel/vdso64/vdso64.lds.S
index 2d70f35d50b5..932b3fdb34b9 100644
--- a/arch/powerpc/kernel/vdso64/vdso64.lds.S
+++ b/arch/powerpc/kernel/vdso64/vdso64.lds.S
@@ -10,100 +10,114 @@ ENTRY(_start)
10 10
11SECTIONS 11SECTIONS
12{ 12{
13 . = VDSO64_LBASE + SIZEOF_HEADERS; 13 . = VDSO64_LBASE + SIZEOF_HEADERS;
14 .hash : { *(.hash) } :text 14
15 .gnu.hash : { *(.gnu.hash) } 15 .hash : { *(.hash) } :text
16 .dynsym : { *(.dynsym) } 16 .gnu.hash : { *(.gnu.hash) }
17 .dynstr : { *(.dynstr) } 17 .dynsym : { *(.dynsym) }
18 .gnu.version : { *(.gnu.version) } 18 .dynstr : { *(.dynstr) }
19 .gnu.version_d : { *(.gnu.version_d) } 19 .gnu.version : { *(.gnu.version) }
20 .gnu.version_r : { *(.gnu.version_r) } 20 .gnu.version_d : { *(.gnu.version_d) }
21 21 .gnu.version_r : { *(.gnu.version_r) }
22 .note : { *(.note.*) } :text :note 22
23 23 .note : { *(.note.*) } :text :note
24 . = ALIGN (16); 24
25 .text : 25 . = ALIGN(16);
26 { 26 .text : {
27 *(.text .stub .text.* .gnu.linkonce.t.*) 27 *(.text .stub .text.* .gnu.linkonce.t.*)
28 *(.sfpr .glink) 28 *(.sfpr .glink)
29 } :text 29 } :text
30 PROVIDE (__etext = .); 30 PROVIDE(__etext = .);
31 PROVIDE (_etext = .); 31 PROVIDE(_etext = .);
32 PROVIDE (etext = .); 32 PROVIDE(etext = .);
33 33
34 . = ALIGN(8); 34 . = ALIGN(8);
35 __ftr_fixup : { 35 __ftr_fixup : { *(__ftr_fixup) }
36 *(__ftr_fixup) 36
37 } 37 . = ALIGN(8);
38 38 __fw_ftr_fixup : { *(__fw_ftr_fixup) }
39 . = ALIGN(8); 39
40 __fw_ftr_fixup : { 40 /*
41 *(__fw_ftr_fixup) 41 * Other stuff is appended to the text segment:
42 } 42 */
43 43 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
44 /* Other stuff is appended to the text segment: */ 44 .rodata1 : { *(.rodata1) }
45 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 45
46 .rodata1 : { *(.rodata1) } 46 .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
47 .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr 47 .eh_frame : { KEEP (*(.eh_frame)) } :text
48 .eh_frame : { KEEP (*(.eh_frame)) } :text 48 .gcc_except_table : { *(.gcc_except_table) }
49 .gcc_except_table : { *(.gcc_except_table) } 49
50 50 .opd ALIGN(8) : { KEEP (*(.opd)) }
51 .opd ALIGN(8) : { KEEP (*(.opd)) } 51 .got ALIGN(8) : { *(.got .toc) }
52 .got ALIGN(8) : { *(.got .toc) } 52 .rela.dyn ALIGN(8) : { *(.rela.dyn) }
53 .rela.dyn ALIGN(8) : { *(.rela.dyn) } 53
54 54 .dynamic : { *(.dynamic) } :text :dynamic
55 .dynamic : { *(.dynamic) } :text :dynamic 55
56 56 _end = .;
57 _end = .; 57 PROVIDE(end = .);
58 PROVIDE (end = .); 58
59 59 /*
60 /* Stabs debugging sections are here too 60 * Stabs debugging sections are here too.
61 */ 61 */
62 .stab 0 : { *(.stab) } 62 .stab 0 : { *(.stab) }
63 .stabstr 0 : { *(.stabstr) } 63 .stabstr 0 : { *(.stabstr) }
64 .stab.excl 0 : { *(.stab.excl) } 64 .stab.excl 0 : { *(.stab.excl) }
65 .stab.exclstr 0 : { *(.stab.exclstr) } 65 .stab.exclstr 0 : { *(.stab.exclstr) }
66 .stab.index 0 : { *(.stab.index) } 66 .stab.index 0 : { *(.stab.index) }
67 .stab.indexstr 0 : { *(.stab.indexstr) } 67 .stab.indexstr 0 : { *(.stab.indexstr) }
68 .comment 0 : { *(.comment) } 68 .comment 0 : { *(.comment) }
69 /* DWARF debug sectio/ns. 69
70 Symbols in the DWARF debugging sections are relative to the beginning 70 /*
71 of the section so we begin them at 0. */ 71 * DWARF debug sections.
72 /* DWARF 1 */ 72 * Symbols in the DWARF debugging sections are relative to the beginning
73 .debug 0 : { *(.debug) } 73 * of the section so we begin them at 0.
74 .line 0 : { *(.line) } 74 */
75 /* GNU DWARF 1 extensions */ 75 /* DWARF 1 */
76 .debug_srcinfo 0 : { *(.debug_srcinfo) } 76 .debug 0 : { *(.debug) }
77 .debug_sfnames 0 : { *(.debug_sfnames) } 77 .line 0 : { *(.line) }
78 /* DWARF 1.1 and DWARF 2 */ 78 /* GNU DWARF 1 extensions */
79 .debug_aranges 0 : { *(.debug_aranges) } 79 .debug_srcinfo 0 : { *(.debug_srcinfo) }
80 .debug_pubnames 0 : { *(.debug_pubnames) } 80 .debug_sfnames 0 : { *(.debug_sfnames) }
81 /* DWARF 2 */ 81 /* DWARF 1.1 and DWARF 2 */
82 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 82 .debug_aranges 0 : { *(.debug_aranges) }
83 .debug_abbrev 0 : { *(.debug_abbrev) } 83 .debug_pubnames 0 : { *(.debug_pubnames) }
84 .debug_line 0 : { *(.debug_line) } 84 /* DWARF 2 */
85 .debug_frame 0 : { *(.debug_frame) } 85 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
86 .debug_str 0 : { *(.debug_str) } 86 .debug_abbrev 0 : { *(.debug_abbrev) }
87 .debug_loc 0 : { *(.debug_loc) } 87 .debug_line 0 : { *(.debug_line) }
88 .debug_macinfo 0 : { *(.debug_macinfo) } 88 .debug_frame 0 : { *(.debug_frame) }
89 /* SGI/MIPS DWARF 2 extensions */ 89 .debug_str 0 : { *(.debug_str) }
90 .debug_weaknames 0 : { *(.debug_weaknames) } 90 .debug_loc 0 : { *(.debug_loc) }
91 .debug_funcnames 0 : { *(.debug_funcnames) } 91 .debug_macinfo 0 : { *(.debug_macinfo) }
92 .debug_typenames 0 : { *(.debug_typenames) } 92 /* SGI/MIPS DWARF 2 extensions */
93 .debug_varnames 0 : { *(.debug_varnames) } 93 .debug_weaknames 0 : { *(.debug_weaknames) }
94 94 .debug_funcnames 0 : { *(.debug_funcnames) }
95 /DISCARD/ : { *(.note.GNU-stack) } 95 .debug_typenames 0 : { *(.debug_typenames) }
96 /DISCARD/ : { *(.branch_lt) } 96 .debug_varnames 0 : { *(.debug_varnames) }
97 /DISCARD/ : { *(.data .data.* .gnu.linkonce.d.*) } 97
98 /DISCARD/ : { *(.bss .sbss .dynbss .dynsbss) } 98 /DISCARD/ : {
99 *(.note.GNU-stack)
100 *(.branch_lt)
101 *(.data .data.* .gnu.linkonce.d.* .sdata*)
102 *(.bss .sbss .dynbss .dynsbss)
103 }
99} 104}
100 105
106/*
107 * Very old versions of ld do not recognize this name token; use the constant.
108 */
109#define PT_GNU_EH_FRAME 0x6474e550
110
111/*
112 * We must supply the ELF program headers explicitly to get just one
113 * PT_LOAD segment, and set the flags explicitly to make segments read-only.
114 */
101PHDRS 115PHDRS
102{ 116{
103 text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */ 117 text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
104 note PT_NOTE FLAGS(4); /* PF_R */ 118 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
105 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ 119 note PT_NOTE FLAGS(4); /* PF_R */
106 eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */ 120 eh_frame_hdr PT_GNU_EH_FRAME;
107} 121}
108 122
109/* 123/*
@@ -111,17 +125,22 @@ PHDRS
111 */ 125 */
112VERSION 126VERSION
113{ 127{
114 VDSO_VERSION_STRING { 128 VDSO_VERSION_STRING {
115 global: 129 global:
116 __kernel_datapage_offset; /* Has to be there for the kernel to find */ 130 /*
117 __kernel_get_syscall_map; 131 * Has to be there for the kernel to find
118 __kernel_gettimeofday; 132 */
119 __kernel_clock_gettime; 133 __kernel_datapage_offset;
120 __kernel_clock_getres; 134
121 __kernel_get_tbfreq; 135 __kernel_get_syscall_map;
122 __kernel_sync_dicache; 136 __kernel_gettimeofday;
123 __kernel_sync_dicache_p5; 137 __kernel_clock_gettime;
124 __kernel_sigtramp_rt64; 138 __kernel_clock_getres;
125 local: *; 139 __kernel_get_tbfreq;
126 }; 140 __kernel_sync_dicache;
141 __kernel_sync_dicache_p5;
142 __kernel_sigtramp_rt64;
143
144 local: *;
145 };
127} 146}
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index cb22a3557c4e..19a5656001c0 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -317,30 +317,20 @@ static int vio_bus_match(struct device *dev, struct device_driver *drv)
317 return (ids != NULL) && (vio_match_device(ids, vio_dev) != NULL); 317 return (ids != NULL) && (vio_match_device(ids, vio_dev) != NULL);
318} 318}
319 319
320static int vio_hotplug(struct device *dev, char **envp, int num_envp, 320static int vio_hotplug(struct device *dev, struct kobj_uevent_env *env)
321 char *buffer, int buffer_size)
322{ 321{
323 const struct vio_dev *vio_dev = to_vio_dev(dev); 322 const struct vio_dev *vio_dev = to_vio_dev(dev);
324 struct device_node *dn; 323 struct device_node *dn;
325 const char *cp; 324 const char *cp;
326 int length;
327
328 if (!num_envp)
329 return -ENOMEM;
330 325
331 dn = dev->archdata.of_node; 326 dn = dev->archdata.of_node;
332 if (!dn) 327 if (!dn)
333 return -ENODEV; 328 return -ENODEV;
334 cp = of_get_property(dn, "compatible", &length); 329 cp = of_get_property(dn, "compatible", NULL);
335 if (!cp) 330 if (!cp)
336 return -ENODEV; 331 return -ENODEV;
337 332
338 envp[0] = buffer; 333 add_uevent_var(env, "MODALIAS=vio:T%sS%s", vio_dev->type, cp);
339 length = scnprintf(buffer, buffer_size, "MODALIAS=vio:T%sS%s",
340 vio_dev->type, cp);
341 if ((buffer_size - length) <= 0)
342 return -ENOMEM;
343 envp[1] = NULL;
344 return 0; 334 return 0;
345} 335}
346 336
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index fa90f6561b9f..29ed495444f5 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -183,3 +183,70 @@ void pgtable_cache_init(void)
183 zero_ctor); 183 zero_ctor);
184 } 184 }
185} 185}
186
187#ifdef CONFIG_SPARSEMEM_VMEMMAP
188/*
189 * Given an address within the vmemmap, determine the pfn of the page that
190 * represents the start of the section it is within. Note that we have to
191 * do this by hand as the proffered address may not be correctly aligned.
192 * Subtraction of non-aligned pointers produces undefined results.
193 */
194unsigned long __meminit vmemmap_section_start(unsigned long page)
195{
196 unsigned long offset = page - ((unsigned long)(vmemmap));
197
198 /* Return the pfn of the start of the section. */
199 return (offset / sizeof(struct page)) & PAGE_SECTION_MASK;
200}
201
202/*
203 * Check if this vmemmap page is already initialised. If any section
204 * which overlaps this vmemmap page is initialised then this page is
205 * initialised already.
206 */
207int __meminit vmemmap_populated(unsigned long start, int page_size)
208{
209 unsigned long end = start + page_size;
210
211 for (; start < end; start += (PAGES_PER_SECTION * sizeof(struct page)))
212 if (pfn_valid(vmemmap_section_start(start)))
213 return 1;
214
215 return 0;
216}
217
218int __meminit vmemmap_populate(struct page *start_page,
219 unsigned long nr_pages, int node)
220{
221 unsigned long mode_rw;
222 unsigned long start = (unsigned long)start_page;
223 unsigned long end = (unsigned long)(start_page + nr_pages);
224 unsigned long page_size = 1 << mmu_psize_defs[mmu_linear_psize].shift;
225
226 mode_rw = _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX;
227
228 /* Align to the page size of the linear mapping. */
229 start = _ALIGN_DOWN(start, page_size);
230
231 for (; start < end; start += page_size) {
232 int mapped;
233 void *p;
234
235 if (vmemmap_populated(start, page_size))
236 continue;
237
238 p = vmemmap_alloc_block(page_size, node);
239 if (!p)
240 return -ENOMEM;
241
242 printk(KERN_WARNING "vmemmap %08lx allocated at %p, "
243 "physical %p.\n", start, p, __pa(p));
244
245 mapped = htab_bolt_mapping(start, start + page_size,
246 __pa(p), mode_rw, mmu_linear_psize);
247 BUG_ON(mapped < 0);
248 }
249
250 return 0;
251}
252#endif
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 32dcfc9b0082..81eb96ec13b2 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -129,51 +129,6 @@ int __devinit arch_add_memory(int nid, u64 start, u64 size)
129 return __add_pages(zone, start_pfn, nr_pages); 129 return __add_pages(zone, start_pfn, nr_pages);
130} 130}
131 131
132/*
133 * First pass at this code will check to determine if the remove
134 * request is within the RMO. Do not allow removal within the RMO.
135 */
136int __devinit remove_memory(u64 start, u64 size)
137{
138 struct zone *zone;
139 unsigned long start_pfn, end_pfn, nr_pages;
140
141 start_pfn = start >> PAGE_SHIFT;
142 nr_pages = size >> PAGE_SHIFT;
143 end_pfn = start_pfn + nr_pages;
144
145 printk("%s(): Attempting to remove memoy in range "
146 "%lx to %lx\n", __func__, start, start+size);
147 /*
148 * check for range within RMO
149 */
150 zone = page_zone(pfn_to_page(start_pfn));
151
152 printk("%s(): memory will be removed from "
153 "the %s zone\n", __func__, zone->name);
154
155 /*
156 * not handling removing memory ranges that
157 * overlap multiple zones yet
158 */
159 if (end_pfn > (zone->zone_start_pfn + zone->spanned_pages))
160 goto overlap;
161
162 /* make sure it is NOT in RMO */
163 if ((start < lmb.rmo_size) || ((start+size) < lmb.rmo_size)) {
164 printk("%s(): range to be removed must NOT be in RMO!\n",
165 __func__);
166 goto in_rmo;
167 }
168
169 return __remove_pages(zone, start_pfn, nr_pages);
170
171overlap:
172 printk("%s(): memory range to be removed overlaps "
173 "multiple zones!!!\n", __func__);
174in_rmo:
175 return -1;
176}
177#endif /* CONFIG_MEMORY_HOTPLUG */ 132#endif /* CONFIG_MEMORY_HOTPLUG */
178 133
179void show_mem(void) 134void show_mem(void)
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index 0caa3d955c3b..65b7ae426238 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -18,6 +18,8 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/pci.h> 19#include <linux/pci.h>
20#include <linux/of.h> 20#include <linux/of.h>
21#include <linux/root_dev.h>
22#include <linux/initrd.h>
21#include <asm/time.h> 23#include <asm/time.h>
22#include <asm/io.h> 24#include <asm/io.h>
23#include <asm/machdep.h> 25#include <asm/machdep.h>
@@ -156,18 +158,6 @@ static void __init lite5200_setup_arch(void)
156 of_node_put(np); 158 of_node_put(np);
157 } 159 }
158#endif 160#endif
159
160#ifdef CONFIG_BLK_DEV_INITRD
161 if (initrd_start)
162 ROOT_DEV = Root_RAM0;
163 else
164#endif
165#ifdef CONFIG_ROOT_NFS
166 ROOT_DEV = Root_NFS;
167#else
168 ROOT_DEV = Root_HDA1;
169#endif
170
171} 161}
172 162
173/* 163/*
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c
index 1245b2f517bb..095988f13bf4 100644
--- a/arch/powerpc/platforms/cell/axon_msi.c
+++ b/arch/powerpc/platforms/cell/axon_msi.c
@@ -77,12 +77,7 @@ static void msic_dcr_write(struct axon_msic *msic, unsigned int dcr_n, u32 val)
77{ 77{
78 pr_debug("axon_msi: dcr_write(0x%x, 0x%x)\n", val, dcr_n); 78 pr_debug("axon_msi: dcr_write(0x%x, 0x%x)\n", val, dcr_n);
79 79
80 dcr_write(msic->dcr_host, msic->dcr_host.base + dcr_n, val); 80 dcr_write(msic->dcr_host, dcr_n, val);
81}
82
83static u32 msic_dcr_read(struct axon_msic *msic, unsigned int dcr_n)
84{
85 return dcr_read(msic->dcr_host, msic->dcr_host.base + dcr_n);
86} 81}
87 82
88static void axon_msi_cascade(unsigned int irq, struct irq_desc *desc) 83static void axon_msi_cascade(unsigned int irq, struct irq_desc *desc)
@@ -91,7 +86,7 @@ static void axon_msi_cascade(unsigned int irq, struct irq_desc *desc)
91 u32 write_offset, msi; 86 u32 write_offset, msi;
92 int idx; 87 int idx;
93 88
94 write_offset = msic_dcr_read(msic, MSIC_WRITE_OFFSET_REG); 89 write_offset = dcr_read(msic->dcr_host, MSIC_WRITE_OFFSET_REG);
95 pr_debug("axon_msi: original write_offset 0x%x\n", write_offset); 90 pr_debug("axon_msi: original write_offset 0x%x\n", write_offset);
96 91
97 /* write_offset doesn't wrap properly, so we have to mask it */ 92 /* write_offset doesn't wrap properly, so we have to mask it */
@@ -306,7 +301,7 @@ static int axon_msi_notify_reboot(struct notifier_block *nb,
306 list_for_each_entry(msic, &axon_msic_list, list) { 301 list_for_each_entry(msic, &axon_msic_list, list) {
307 pr_debug("axon_msi: disabling %s\n", 302 pr_debug("axon_msi: disabling %s\n",
308 msic->irq_host->of_node->full_name); 303 msic->irq_host->of_node->full_name);
309 tmp = msic_dcr_read(msic, MSIC_CTRL_REG); 304 tmp = dcr_read(msic->dcr_host, MSIC_CTRL_REG);
310 tmp &= ~MSIC_CTRL_ENABLE & ~MSIC_CTRL_IRQ_ENABLE; 305 tmp &= ~MSIC_CTRL_ENABLE & ~MSIC_CTRL_IRQ_ENABLE;
311 msic_dcr_write(msic, MSIC_CTRL_REG, tmp); 306 msic_dcr_write(msic, MSIC_CTRL_REG, tmp);
312 } 307 }
diff --git a/arch/powerpc/platforms/cell/cbe_cpufreq.c b/arch/powerpc/platforms/cell/cbe_cpufreq.c
index 901236fa0f07..13d5a87f13b1 100644
--- a/arch/powerpc/platforms/cell/cbe_cpufreq.c
+++ b/arch/powerpc/platforms/cell/cbe_cpufreq.c
@@ -107,8 +107,6 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy)
107 pr_debug("%d: %d\n", i, cbe_freqs[i].frequency); 107 pr_debug("%d: %d\n", i, cbe_freqs[i].frequency);
108 } 108 }
109 109
110 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
111
112 /* if DEBUG is enabled set_pmode() measures the latency 110 /* if DEBUG is enabled set_pmode() measures the latency
113 * of a transition */ 111 * of a transition */
114 policy->cpuinfo.transition_latency = 25000; 112 policy->cpuinfo.transition_latency = 25000;
@@ -119,7 +117,7 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy)
119 policy->cur = cbe_freqs[cur_pmode].frequency; 117 policy->cur = cbe_freqs[cur_pmode].frequency;
120 118
121#ifdef CONFIG_SMP 119#ifdef CONFIG_SMP
122 policy->cpus = cpu_sibling_map[policy->cpu]; 120 policy->cpus = per_cpu(cpu_sibling_map, policy->cpu);
123#endif 121#endif
124 122
125 cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu); 123 cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu);
diff --git a/arch/powerpc/platforms/pasemi/cpufreq.c b/arch/powerpc/platforms/pasemi/cpufreq.c
index 3ae083851b01..1cfb8b0c8fec 100644
--- a/arch/powerpc/platforms/pasemi/cpufreq.c
+++ b/arch/powerpc/platforms/pasemi/cpufreq.c
@@ -195,8 +195,6 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
195 pr_debug("%d: %d\n", i, pas_freqs[i].frequency); 195 pr_debug("%d: %d\n", i, pas_freqs[i].frequency);
196 } 196 }
197 197
198 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
199
200 policy->cpuinfo.transition_latency = get_gizmo_latency(); 198 policy->cpuinfo.transition_latency = get_gizmo_latency();
201 199
202 cur_astate = get_cur_astate(policy->cpu); 200 cur_astate = get_cur_astate(policy->cpu);
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c
index 1fe35dab0e9e..c04abcc28a7a 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_32.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_32.c
@@ -410,7 +410,6 @@ static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy)
410 if (policy->cpu != 0) 410 if (policy->cpu != 0)
411 return -ENODEV; 411 return -ENODEV;
412 412
413 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
414 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; 413 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
415 policy->cur = cur_freq; 414 policy->cur = cur_freq;
416 415
diff --git a/arch/powerpc/platforms/powermac/cpufreq_64.c b/arch/powerpc/platforms/powermac/cpufreq_64.c
index 00f50298c342..4dfb4bc242b5 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_64.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_64.c
@@ -357,7 +357,6 @@ static unsigned int g5_cpufreq_get_speed(unsigned int cpu)
357 357
358static int g5_cpufreq_cpu_init(struct cpufreq_policy *policy) 358static int g5_cpufreq_cpu_init(struct cpufreq_policy *policy)
359{ 359{
360 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
361 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; 360 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
362 policy->cur = g5_cpu_freqs[g5_query_freq()].frequency; 361 policy->cur = g5_cpu_freqs[g5_query_freq()].frequency;
363 /* secondary CPUs are tied to the primary one by the 362 /* secondary CPUs are tied to the primary one by the
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
index 4bb634a17e43..07e64b48e7fc 100644
--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -437,18 +437,12 @@ static void ps3_system_bus_shutdown(struct device *_dev)
437 dev_dbg(&dev->core, " <- %s:%d\n", __func__, __LINE__); 437 dev_dbg(&dev->core, " <- %s:%d\n", __func__, __LINE__);
438} 438}
439 439
440static int ps3_system_bus_uevent(struct device *_dev, char **envp, 440static int ps3_system_bus_uevent(struct device *_dev, struct kobj_uevent_env *env)
441 int num_envp, char *buffer, int buffer_size)
442{ 441{
443 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); 442 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
444 int i = 0, length = 0;
445 443
446 if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, 444 if (add_uevent_var(env, "MODALIAS=ps3:%d", dev->match_id))
447 &length, "MODALIAS=ps3:%d",
448 dev->match_id))
449 return -ENOMEM; 445 return -ENOMEM;
450
451 envp[i] = NULL;
452 return 0; 446 return 0;
453} 447}
454 448
@@ -622,17 +616,18 @@ static void ps3_unmap_single(struct device *_dev, dma_addr_t dma_addr,
622 } 616 }
623} 617}
624 618
625static int ps3_sb_map_sg(struct device *_dev, struct scatterlist *sg, int nents, 619static int ps3_sb_map_sg(struct device *_dev, struct scatterlist *sgl,
626 enum dma_data_direction direction) 620 int nents, enum dma_data_direction direction)
627{ 621{
628#if defined(CONFIG_PS3_DYNAMIC_DMA) 622#if defined(CONFIG_PS3_DYNAMIC_DMA)
629 BUG_ON("do"); 623 BUG_ON("do");
630 return -EPERM; 624 return -EPERM;
631#else 625#else
632 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); 626 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
627 struct scatterlist *sg;
633 int i; 628 int i;
634 629
635 for (i = 0; i < nents; i++, sg++) { 630 for_each_sg(sgl, sg, nents, i) {
636 int result = ps3_dma_map(dev->d_region, 631 int result = ps3_dma_map(dev->d_region,
637 page_to_phys(sg->page) + sg->offset, sg->length, 632 page_to_phys(sg->page) + sg->offset, sg->length,
638 &sg->dma_address, 0); 633 &sg->dma_address, 0);
diff --git a/arch/powerpc/sysdev/dcr.c b/arch/powerpc/sysdev/dcr.c
index ab11c0b29024..427027c7ea0f 100644
--- a/arch/powerpc/sysdev/dcr.c
+++ b/arch/powerpc/sysdev/dcr.c
@@ -126,13 +126,13 @@ dcr_host_t dcr_map(struct device_node *dev, unsigned int dcr_n,
126} 126}
127EXPORT_SYMBOL_GPL(dcr_map); 127EXPORT_SYMBOL_GPL(dcr_map);
128 128
129void dcr_unmap(dcr_host_t host, unsigned int dcr_n, unsigned int dcr_c) 129void dcr_unmap(dcr_host_t host, unsigned int dcr_c)
130{ 130{
131 dcr_host_t h = host; 131 dcr_host_t h = host;
132 132
133 if (h.token == NULL) 133 if (h.token == NULL)
134 return; 134 return;
135 h.token += dcr_n * h.stride; 135 h.token += host.base * h.stride;
136 iounmap(h.token); 136 iounmap(h.token);
137 h.token = NULL; 137 h.token = NULL;
138} 138}
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 893e65439e85..e47938899a92 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -156,7 +156,7 @@ static inline u32 _mpic_read(enum mpic_reg_type type,
156 switch(type) { 156 switch(type) {
157#ifdef CONFIG_PPC_DCR 157#ifdef CONFIG_PPC_DCR
158 case mpic_access_dcr: 158 case mpic_access_dcr:
159 return dcr_read(rb->dhost, rb->dhost.base + reg); 159 return dcr_read(rb->dhost, reg);
160#endif 160#endif
161 case mpic_access_mmio_be: 161 case mpic_access_mmio_be:
162 return in_be32(rb->base + (reg >> 2)); 162 return in_be32(rb->base + (reg >> 2));
@@ -173,7 +173,7 @@ static inline void _mpic_write(enum mpic_reg_type type,
173 switch(type) { 173 switch(type) {
174#ifdef CONFIG_PPC_DCR 174#ifdef CONFIG_PPC_DCR
175 case mpic_access_dcr: 175 case mpic_access_dcr:
176 return dcr_write(rb->dhost, rb->dhost.base + reg, value); 176 return dcr_write(rb->dhost, reg, value);
177#endif 177#endif
178 case mpic_access_mmio_be: 178 case mpic_access_mmio_be:
179 return out_be32(rb->base + (reg >> 2), value); 179 return out_be32(rb->base + (reg >> 2), value);
diff --git a/arch/ppc/mm/fault.c b/arch/ppc/mm/fault.c
index b98244e277fb..94913ddcf76e 100644
--- a/arch/ppc/mm/fault.c
+++ b/arch/ppc/mm/fault.c
@@ -297,7 +297,7 @@ out_of_memory:
297 } 297 }
298 printk("VM: killing process %s\n", current->comm); 298 printk("VM: killing process %s\n", current->comm);
299 if (user_mode(regs)) 299 if (user_mode(regs))
300 do_exit(SIGKILL); 300 do_group_exit(SIGKILL);
301 return SIGKILL; 301 return SIGKILL;
302 302
303do_sigbus: 303do_sigbus:
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index 62391fb1f61f..ac61cf43a7d9 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -547,8 +547,7 @@ static void __cpuinit appldata_online_cpu(int cpu)
547 spin_unlock(&appldata_timer_lock); 547 spin_unlock(&appldata_timer_lock);
548} 548}
549 549
550static void 550static void __cpuinit appldata_offline_cpu(int cpu)
551appldata_offline_cpu(int cpu)
552{ 551{
553 del_virt_timer(&per_cpu(appldata_timer, cpu)); 552 del_virt_timer(&per_cpu(appldata_timer, cpu));
554 if (atomic_dec_and_test(&appldata_expire_count)) { 553 if (atomic_dec_and_test(&appldata_expire_count)) {
@@ -560,9 +559,9 @@ appldata_offline_cpu(int cpu)
560 spin_unlock(&appldata_timer_lock); 559 spin_unlock(&appldata_timer_lock);
561} 560}
562 561
563static int __cpuinit 562static int __cpuinit appldata_cpu_notify(struct notifier_block *self,
564appldata_cpu_notify(struct notifier_block *self, 563 unsigned long action,
565 unsigned long action, void *hcpu) 564 void *hcpu)
566{ 565{
567 switch (action) { 566 switch (action) {
568 case CPU_ONLINE: 567 case CPU_ONLINE:
@@ -608,63 +607,15 @@ static int __init appldata_init(void)
608 register_hotcpu_notifier(&appldata_nb); 607 register_hotcpu_notifier(&appldata_nb);
609 608
610 appldata_sysctl_header = register_sysctl_table(appldata_dir_table); 609 appldata_sysctl_header = register_sysctl_table(appldata_dir_table);
611#ifdef MODULE
612 appldata_dir_table[0].de->owner = THIS_MODULE;
613 appldata_table[0].de->owner = THIS_MODULE;
614 appldata_table[1].de->owner = THIS_MODULE;
615#endif
616 610
617 P_DEBUG("Base interface initialized.\n"); 611 P_DEBUG("Base interface initialized.\n");
618 return 0; 612 return 0;
619} 613}
620 614
621/* 615__initcall(appldata_init);
622 * appldata_exit()
623 *
624 * stop timer, unregister /proc entries
625 */
626static void __exit appldata_exit(void)
627{
628 struct list_head *lh;
629 struct appldata_ops *ops;
630 int rc, i;
631 616
632 P_DEBUG("Unloading module ...\n");
633 /*
634 * ops list should be empty, but just in case something went wrong...
635 */
636 spin_lock(&appldata_ops_lock);
637 list_for_each(lh, &appldata_ops_list) {
638 ops = list_entry(lh, struct appldata_ops, list);
639 rc = appldata_diag(ops->record_nr, APPLDATA_STOP_REC,
640 (unsigned long) ops->data, ops->size,
641 ops->mod_lvl);
642 if (rc != 0) {
643 P_ERROR("STOP DIAG 0xDC for %s failed, "
644 "return code: %d\n", ops->name, rc);
645 }
646 }
647 spin_unlock(&appldata_ops_lock);
648
649 for_each_online_cpu(i)
650 appldata_offline_cpu(i);
651
652 appldata_timer_active = 0;
653
654 unregister_sysctl_table(appldata_sysctl_header);
655
656 destroy_workqueue(appldata_wq);
657 P_DEBUG("... module unloaded!\n");
658}
659/**************************** init / exit <END> ******************************/ 617/**************************** init / exit <END> ******************************/
660 618
661
662module_init(appldata_init);
663module_exit(appldata_exit);
664MODULE_LICENSE("GPL");
665MODULE_AUTHOR("Gerald Schaefer");
666MODULE_DESCRIPTION("Linux-VM Monitor Stream, base infrastructure");
667
668EXPORT_SYMBOL_GPL(appldata_register_ops); 619EXPORT_SYMBOL_GPL(appldata_register_ops);
669EXPORT_SYMBOL_GPL(appldata_unregister_ops); 620EXPORT_SYMBOL_GPL(appldata_unregister_ops);
670EXPORT_SYMBOL_GPL(appldata_diag); 621EXPORT_SYMBOL_GPL(appldata_diag);
diff --git a/arch/s390/kernel/audit.c b/arch/s390/kernel/audit.c
index d1c76fe10f29..f4932c22ebe4 100644
--- a/arch/s390/kernel/audit.c
+++ b/arch/s390/kernel/audit.c
@@ -2,6 +2,7 @@
2#include <linux/types.h> 2#include <linux/types.h>
3#include <linux/audit.h> 3#include <linux/audit.h>
4#include <asm/unistd.h> 4#include <asm/unistd.h>
5#include "audit.h"
5 6
6static unsigned dir_class[] = { 7static unsigned dir_class[] = {
7#include <asm-generic/audit_dir_write.h> 8#include <asm-generic/audit_dir_write.h>
@@ -40,7 +41,6 @@ int audit_classify_arch(int arch)
40int audit_classify_syscall(int abi, unsigned syscall) 41int audit_classify_syscall(int abi, unsigned syscall)
41{ 42{
42#ifdef CONFIG_COMPAT 43#ifdef CONFIG_COMPAT
43 extern int s390_classify_syscall(unsigned);
44 if (abi == AUDIT_ARCH_S390) 44 if (abi == AUDIT_ARCH_S390)
45 return s390_classify_syscall(syscall); 45 return s390_classify_syscall(syscall);
46#endif 46#endif
@@ -61,11 +61,6 @@ int audit_classify_syscall(int abi, unsigned syscall)
61static int __init audit_classes_init(void) 61static int __init audit_classes_init(void)
62{ 62{
63#ifdef CONFIG_COMPAT 63#ifdef CONFIG_COMPAT
64 extern __u32 s390_dir_class[];
65 extern __u32 s390_write_class[];
66 extern __u32 s390_read_class[];
67 extern __u32 s390_chattr_class[];
68 extern __u32 s390_signal_class[];
69 audit_register_class(AUDIT_CLASS_WRITE_32, s390_write_class); 64 audit_register_class(AUDIT_CLASS_WRITE_32, s390_write_class);
70 audit_register_class(AUDIT_CLASS_READ_32, s390_read_class); 65 audit_register_class(AUDIT_CLASS_READ_32, s390_read_class);
71 audit_register_class(AUDIT_CLASS_DIR_WRITE_32, s390_dir_class); 66 audit_register_class(AUDIT_CLASS_DIR_WRITE_32, s390_dir_class);
diff --git a/arch/s390/kernel/audit.h b/arch/s390/kernel/audit.h
new file mode 100644
index 000000000000..12b56f4b5a73
--- /dev/null
+++ b/arch/s390/kernel/audit.h
@@ -0,0 +1,15 @@
1#ifndef __ARCH_S390_KERNEL_AUDIT_H
2#define __ARCH_S390_KERNEL_AUDIT_H
3
4#include <linux/types.h>
5
6#ifdef CONFIG_COMPAT
7extern int s390_classify_syscall(unsigned);
8extern __u32 s390_dir_class[];
9extern __u32 s390_write_class[];
10extern __u32 s390_read_class[];
11extern __u32 s390_chattr_class[];
12extern __u32 s390_signal_class[];
13#endif /* CONFIG_COMPAT */
14
15#endif /* __ARCH_S390_KERNEL_AUDIT_H */
diff --git a/arch/s390/kernel/compat_audit.c b/arch/s390/kernel/compat_audit.c
index 0569f5126e49..d6487bf879e5 100644
--- a/arch/s390/kernel/compat_audit.c
+++ b/arch/s390/kernel/compat_audit.c
@@ -1,5 +1,6 @@
1#undef __s390x__ 1#undef __s390x__
2#include <asm/unistd.h> 2#include <asm/unistd.h>
3#include "audit.h"
3 4
4unsigned s390_dir_class[] = { 5unsigned s390_dir_class[] = {
5#include <asm-generic/audit_dir_write.h> 6#include <asm-generic/audit_dir_write.h>
diff --git a/arch/s390/kernel/cpcmd.c b/arch/s390/kernel/cpcmd.c
index 6c89f30c8e31..d8c1131e0815 100644
--- a/arch/s390/kernel/cpcmd.c
+++ b/arch/s390/kernel/cpcmd.c
@@ -2,7 +2,7 @@
2 * arch/s390/kernel/cpcmd.c 2 * arch/s390/kernel/cpcmd.c
3 * 3 *
4 * S390 version 4 * S390 version
5 * Copyright (C) 1999,2005 IBM Deutschland Entwicklung GmbH, IBM Corporation 5 * Copyright IBM Corp. 1999,2007
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), 6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
7 * Christian Borntraeger (cborntra@de.ibm.com), 7 * Christian Borntraeger (cborntra@de.ibm.com),
8 */ 8 */
@@ -21,6 +21,49 @@
21static DEFINE_SPINLOCK(cpcmd_lock); 21static DEFINE_SPINLOCK(cpcmd_lock);
22static char cpcmd_buf[241]; 22static char cpcmd_buf[241];
23 23
24static int diag8_noresponse(int cmdlen)
25{
26 register unsigned long reg2 asm ("2") = (addr_t) cpcmd_buf;
27 register unsigned long reg3 asm ("3") = cmdlen;
28
29 asm volatile(
30#ifndef CONFIG_64BIT
31 " diag %1,%0,0x8\n"
32#else /* CONFIG_64BIT */
33 " sam31\n"
34 " diag %1,%0,0x8\n"
35 " sam64\n"
36#endif /* CONFIG_64BIT */
37 : "+d" (reg3) : "d" (reg2) : "cc");
38 return reg3;
39}
40
41static int diag8_response(int cmdlen, char *response, int *rlen)
42{
43 register unsigned long reg2 asm ("2") = (addr_t) cpcmd_buf;
44 register unsigned long reg3 asm ("3") = (addr_t) response;
45 register unsigned long reg4 asm ("4") = cmdlen | 0x40000000L;
46 register unsigned long reg5 asm ("5") = *rlen;
47
48 asm volatile(
49#ifndef CONFIG_64BIT
50 " diag %2,%0,0x8\n"
51 " brc 8,1f\n"
52 " ar %1,%4\n"
53#else /* CONFIG_64BIT */
54 " sam31\n"
55 " diag %2,%0,0x8\n"
56 " sam64\n"
57 " brc 8,1f\n"
58 " agr %1,%4\n"
59#endif /* CONFIG_64BIT */
60 "1:\n"
61 : "+d" (reg4), "+d" (reg5)
62 : "d" (reg2), "d" (reg3), "d" (*rlen) : "cc");
63 *rlen = reg5;
64 return reg4;
65}
66
24/* 67/*
25 * __cpcmd has some restrictions over cpcmd 68 * __cpcmd has some restrictions over cpcmd
26 * - the response buffer must reside below 2GB (if any) 69 * - the response buffer must reside below 2GB (if any)
@@ -28,59 +71,27 @@ static char cpcmd_buf[241];
28 */ 71 */
29int __cpcmd(const char *cmd, char *response, int rlen, int *response_code) 72int __cpcmd(const char *cmd, char *response, int rlen, int *response_code)
30{ 73{
31 unsigned cmdlen; 74 int cmdlen;
32 int return_code, return_len; 75 int rc;
76 int response_len;
33 77
34 cmdlen = strlen(cmd); 78 cmdlen = strlen(cmd);
35 BUG_ON(cmdlen > 240); 79 BUG_ON(cmdlen > 240);
36 memcpy(cpcmd_buf, cmd, cmdlen); 80 memcpy(cpcmd_buf, cmd, cmdlen);
37 ASCEBC(cpcmd_buf, cmdlen); 81 ASCEBC(cpcmd_buf, cmdlen);
38 82
39 if (response != NULL && rlen > 0) { 83 if (response) {
40 register unsigned long reg2 asm ("2") = (addr_t) cpcmd_buf;
41 register unsigned long reg3 asm ("3") = (addr_t) response;
42 register unsigned long reg4 asm ("4") = cmdlen | 0x40000000L;
43 register unsigned long reg5 asm ("5") = rlen;
44
45 memset(response, 0, rlen); 84 memset(response, 0, rlen);
46 asm volatile( 85 response_len = rlen;
47#ifndef CONFIG_64BIT 86 rc = diag8_response(cmdlen, response, &rlen);
48 " diag %2,%0,0x8\n" 87 EBCASC(response, response_len);
49 " brc 8,1f\n"
50 " ar %1,%4\n"
51#else /* CONFIG_64BIT */
52 " sam31\n"
53 " diag %2,%0,0x8\n"
54 " sam64\n"
55 " brc 8,1f\n"
56 " agr %1,%4\n"
57#endif /* CONFIG_64BIT */
58 "1:\n"
59 : "+d" (reg4), "+d" (reg5)
60 : "d" (reg2), "d" (reg3), "d" (rlen) : "cc");
61 return_code = (int) reg4;
62 return_len = (int) reg5;
63 EBCASC(response, rlen);
64 } else { 88 } else {
65 register unsigned long reg2 asm ("2") = (addr_t) cpcmd_buf; 89 rc = diag8_noresponse(cmdlen);
66 register unsigned long reg3 asm ("3") = cmdlen;
67 return_len = 0;
68 asm volatile(
69#ifndef CONFIG_64BIT
70 " diag %1,%0,0x8\n"
71#else /* CONFIG_64BIT */
72 " sam31\n"
73 " diag %1,%0,0x8\n"
74 " sam64\n"
75#endif /* CONFIG_64BIT */
76 : "+d" (reg3) : "d" (reg2) : "cc");
77 return_code = (int) reg3;
78 } 90 }
79 if (response_code != NULL) 91 if (response_code)
80 *response_code = return_code; 92 *response_code = rc;
81 return return_len; 93 return rlen;
82} 94}
83
84EXPORT_SYMBOL(__cpcmd); 95EXPORT_SYMBOL(__cpcmd);
85 96
86int cpcmd(const char *cmd, char *response, int rlen, int *response_code) 97int cpcmd(const char *cmd, char *response, int rlen, int *response_code)
@@ -109,5 +120,4 @@ int cpcmd(const char *cmd, char *response, int rlen, int *response_code)
109 } 120 }
110 return len; 121 return len;
111} 122}
112
113EXPORT_SYMBOL(cpcmd); 123EXPORT_SYMBOL(cpcmd);
diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c
index 50d2235df732..c14a336f6300 100644
--- a/arch/s390/kernel/dis.c
+++ b/arch/s390/kernel/dis.c
@@ -1162,6 +1162,7 @@ static int print_insn(char *buffer, unsigned char *code, unsigned long addr)
1162 unsigned int value; 1162 unsigned int value;
1163 char separator; 1163 char separator;
1164 char *ptr; 1164 char *ptr;
1165 int i;
1165 1166
1166 ptr = buffer; 1167 ptr = buffer;
1167 insn = find_insn(code); 1168 insn = find_insn(code);
@@ -1169,7 +1170,8 @@ static int print_insn(char *buffer, unsigned char *code, unsigned long addr)
1169 ptr += sprintf(ptr, "%.5s\t", insn->name); 1170 ptr += sprintf(ptr, "%.5s\t", insn->name);
1170 /* Extract the operands. */ 1171 /* Extract the operands. */
1171 separator = 0; 1172 separator = 0;
1172 for (ops = formats[insn->format] + 1; *ops != 0; ops++) { 1173 for (ops = formats[insn->format] + 1, i = 0;
1174 *ops != 0 && i < 6; ops++, i++) {
1173 operand = operands + *ops; 1175 operand = operands + *ops;
1174 value = extract_operand(code, operand); 1176 value = extract_operand(code, operand);
1175 if ((operand->flags & OPERAND_INDEX) && value == 0) 1177 if ((operand->flags & OPERAND_INDEX) && value == 0)
@@ -1241,7 +1243,6 @@ void show_code(struct pt_regs *regs)
1241 } 1243 }
1242 /* Find a starting point for the disassembly. */ 1244 /* Find a starting point for the disassembly. */
1243 while (start < 32) { 1245 while (start < 32) {
1244 hops = 0;
1245 for (i = 0, hops = 0; start + i < 32 && hops < 3; hops++) { 1246 for (i = 0, hops = 0; start + i < 32 && hops < 3; hops++) {
1246 if (!find_insn(code + start + i)) 1247 if (!find_insn(code + start + i))
1247 break; 1248 break;
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index f3bceb165321..139ca153d5cc 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -68,9 +68,15 @@ STACK_SIZE = 1 << STACK_SHIFT
68 l %r1,BASED(.Ltrace_irq_off) 68 l %r1,BASED(.Ltrace_irq_off)
69 basr %r14,%r1 69 basr %r14,%r1
70 .endm 70 .endm
71
72 .macro LOCKDEP_SYS_EXIT
73 l %r1,BASED(.Llockdep_sys_exit)
74 basr %r14,%r1
75 .endm
71#else 76#else
72#define TRACE_IRQS_ON 77#define TRACE_IRQS_ON
73#define TRACE_IRQS_OFF 78#define TRACE_IRQS_OFF
79#define LOCKDEP_SYS_EXIT
74#endif 80#endif
75 81
76/* 82/*
@@ -260,6 +266,7 @@ sysc_return:
260 bno BASED(sysc_leave) 266 bno BASED(sysc_leave)
261 tm __TI_flags+3(%r9),_TIF_WORK_SVC 267 tm __TI_flags+3(%r9),_TIF_WORK_SVC
262 bnz BASED(sysc_work) # there is work to do (signals etc.) 268 bnz BASED(sysc_work) # there is work to do (signals etc.)
269 LOCKDEP_SYS_EXIT
263sysc_leave: 270sysc_leave:
264 RESTORE_ALL __LC_RETURN_PSW,1 271 RESTORE_ALL __LC_RETURN_PSW,1
265 272
@@ -283,6 +290,7 @@ sysc_work:
283 bo BASED(sysc_restart) 290 bo BASED(sysc_restart)
284 tm __TI_flags+3(%r9),_TIF_SINGLE_STEP 291 tm __TI_flags+3(%r9),_TIF_SINGLE_STEP
285 bo BASED(sysc_singlestep) 292 bo BASED(sysc_singlestep)
293 LOCKDEP_SYS_EXIT
286 b BASED(sysc_leave) 294 b BASED(sysc_leave)
287 295
288# 296#
@@ -572,6 +580,7 @@ io_return:
572#endif 580#endif
573 tm __TI_flags+3(%r9),_TIF_WORK_INT 581 tm __TI_flags+3(%r9),_TIF_WORK_INT
574 bnz BASED(io_work) # there is work to do (signals etc.) 582 bnz BASED(io_work) # there is work to do (signals etc.)
583 LOCKDEP_SYS_EXIT
575io_leave: 584io_leave:
576 RESTORE_ALL __LC_RETURN_PSW,0 585 RESTORE_ALL __LC_RETURN_PSW,0
577io_done: 586io_done:
@@ -618,6 +627,7 @@ io_work_loop:
618 bo BASED(io_reschedule) 627 bo BASED(io_reschedule)
619 tm __TI_flags+3(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK) 628 tm __TI_flags+3(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)
620 bnz BASED(io_sigpending) 629 bnz BASED(io_sigpending)
630 LOCKDEP_SYS_EXIT
621 b BASED(io_leave) 631 b BASED(io_leave)
622 632
623# 633#
@@ -1040,6 +1050,8 @@ cleanup_io_leave_insn:
1040.Ltrace_irq_on: .long trace_hardirqs_on 1050.Ltrace_irq_on: .long trace_hardirqs_on
1041.Ltrace_irq_off: 1051.Ltrace_irq_off:
1042 .long trace_hardirqs_off 1052 .long trace_hardirqs_off
1053.Llockdep_sys_exit:
1054 .long lockdep_sys_exit
1043#endif 1055#endif
1044.Lcritical_start: 1056.Lcritical_start:
1045 .long __critical_start + 0x80000000 1057 .long __critical_start + 0x80000000
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 9c0d5cc8269d..05e26d1fdf40 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -66,9 +66,14 @@ _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK | _TIF_NEED_RESCHED | \
66 .macro TRACE_IRQS_OFF 66 .macro TRACE_IRQS_OFF
67 brasl %r14,trace_hardirqs_off 67 brasl %r14,trace_hardirqs_off
68 .endm 68 .endm
69
70 .macro LOCKDEP_SYS_EXIT
71 brasl %r14,lockdep_sys_exit
72 .endm
69#else 73#else
70#define TRACE_IRQS_ON 74#define TRACE_IRQS_ON
71#define TRACE_IRQS_OFF 75#define TRACE_IRQS_OFF
76#define LOCKDEP_SYS_EXIT
72#endif 77#endif
73 78
74 .macro STORE_TIMER lc_offset 79 .macro STORE_TIMER lc_offset
@@ -255,6 +260,7 @@ sysc_return:
255 jno sysc_leave 260 jno sysc_leave
256 tm __TI_flags+7(%r9),_TIF_WORK_SVC 261 tm __TI_flags+7(%r9),_TIF_WORK_SVC
257 jnz sysc_work # there is work to do (signals etc.) 262 jnz sysc_work # there is work to do (signals etc.)
263 LOCKDEP_SYS_EXIT
258sysc_leave: 264sysc_leave:
259 RESTORE_ALL __LC_RETURN_PSW,1 265 RESTORE_ALL __LC_RETURN_PSW,1
260 266
@@ -278,6 +284,7 @@ sysc_work:
278 jo sysc_restart 284 jo sysc_restart
279 tm __TI_flags+7(%r9),_TIF_SINGLE_STEP 285 tm __TI_flags+7(%r9),_TIF_SINGLE_STEP
280 jo sysc_singlestep 286 jo sysc_singlestep
287 LOCKDEP_SYS_EXIT
281 j sysc_leave 288 j sysc_leave
282 289
283# 290#
@@ -558,6 +565,7 @@ io_return:
558#endif 565#endif
559 tm __TI_flags+7(%r9),_TIF_WORK_INT 566 tm __TI_flags+7(%r9),_TIF_WORK_INT
560 jnz io_work # there is work to do (signals etc.) 567 jnz io_work # there is work to do (signals etc.)
568 LOCKDEP_SYS_EXIT
561io_leave: 569io_leave:
562 RESTORE_ALL __LC_RETURN_PSW,0 570 RESTORE_ALL __LC_RETURN_PSW,0
563io_done: 571io_done:
@@ -605,6 +613,7 @@ io_work_loop:
605 jo io_reschedule 613 jo io_reschedule
606 tm __TI_flags+7(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK) 614 tm __TI_flags+7(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)
607 jnz io_sigpending 615 jnz io_sigpending
616 LOCKDEP_SYS_EXIT
608 j io_leave 617 j io_leave
609 618
610# 619#
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 8b8f136d9cc7..66b51901c87d 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -735,10 +735,10 @@ void do_reipl(void)
735 case REIPL_METHOD_CCW_VM: 735 case REIPL_METHOD_CCW_VM:
736 reipl_get_ascii_loadparm(loadparm); 736 reipl_get_ascii_loadparm(loadparm);
737 if (strlen(loadparm) == 0) 737 if (strlen(loadparm) == 0)
738 sprintf(buf, "IPL %X", 738 sprintf(buf, "IPL %X CLEAR",
739 reipl_block_ccw->ipl_info.ccw.devno); 739 reipl_block_ccw->ipl_info.ccw.devno);
740 else 740 else
741 sprintf(buf, "IPL %X LOADPARM '%s'", 741 sprintf(buf, "IPL %X CLEAR LOADPARM '%s'",
742 reipl_block_ccw->ipl_info.ccw.devno, loadparm); 742 reipl_block_ccw->ipl_info.ccw.devno, loadparm);
743 __cpcmd(buf, NULL, 0, NULL); 743 __cpcmd(buf, NULL, 0, NULL);
744 break; 744 break;
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index e40373d9fbce..c5549a206284 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -33,6 +33,8 @@
33DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; 33DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
34DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); 34DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
35 35
36struct kretprobe_blackpoint kretprobe_blacklist[] = {{NULL, NULL}};
37
36int __kprobes arch_prepare_kprobe(struct kprobe *p) 38int __kprobes arch_prepare_kprobe(struct kprobe *p)
37{ 39{
38 /* Make sure the probe isn't going on a difficult instruction */ 40 /* Make sure the probe isn't going on a difficult instruction */
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index f4503ca27630..1d81bf9488ae 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -683,11 +683,6 @@ do_ptrace(struct task_struct *child, long request, long addr, long data)
683 wake_up_process(child); 683 wake_up_process(child);
684 return 0; 684 return 0;
685 685
686 case PTRACE_DETACH:
687 /* detach a process that was attached. */
688 return ptrace_detach(child, data);
689
690
691 /* Do requests that differ for 31/64 bit */ 686 /* Do requests that differ for 31/64 bit */
692 default: 687 default:
693#ifdef CONFIG_COMPAT 688#ifdef CONFIG_COMPAT
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index b4622a3889b0..849120e3e28a 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -2,6 +2,7 @@
2 * Written by Martin Schwidefsky (schwidefsky@de.ibm.com) 2 * Written by Martin Schwidefsky (schwidefsky@de.ibm.com)
3 */ 3 */
4 4
5#include <asm/page.h>
5#include <asm-generic/vmlinux.lds.h> 6#include <asm-generic/vmlinux.lds.h>
6 7
7#ifndef CONFIG_64BIT 8#ifndef CONFIG_64BIT
@@ -18,121 +19,142 @@ jiffies = jiffies_64;
18 19
19SECTIONS 20SECTIONS
20{ 21{
21 . = 0x00000000; 22 . = 0x00000000;
22 _text = .; /* Text and read-only data */ 23 .text : {
23 .text : { 24 _text = .; /* Text and read-only data */
24 *(.text.head) 25 *(.text.head)
25 TEXT_TEXT 26 TEXT_TEXT
26 SCHED_TEXT 27 SCHED_TEXT
27 LOCK_TEXT 28 LOCK_TEXT
28 KPROBES_TEXT 29 KPROBES_TEXT
29 *(.fixup) 30 *(.fixup)
30 *(.gnu.warning) 31 *(.gnu.warning)
31 } = 0x0700 32 } = 0x0700
32 33
33 _etext = .; /* End of text section */ 34 _etext = .; /* End of text section */
34 35
35 RODATA 36 RODATA
36 37
37#ifdef CONFIG_SHARED_KERNEL 38#ifdef CONFIG_SHARED_KERNEL
38 . = ALIGN(1048576); /* VM shared segments are 1MB aligned */ 39 . = ALIGN(0x100000); /* VM shared segments are 1MB aligned */
39#endif 40#endif
40 41
41 . = ALIGN(4096); 42 . = ALIGN(PAGE_SIZE);
42 _eshared = .; /* End of shareable data */ 43 _eshared = .; /* End of shareable data */
43 44
44 . = ALIGN(16); /* Exception table */ 45 . = ALIGN(16); /* Exception table */
45 __start___ex_table = .; 46 __ex_table : {
46 __ex_table : { *(__ex_table) } 47 __start___ex_table = .;
47 __stop___ex_table = .; 48 *(__ex_table)
48 49 __stop___ex_table = .;
49 NOTES 50 }
50 51
51 BUG_TABLE 52 NOTES
52 53 BUG_TABLE
53 .data : { /* Data */ 54
54 DATA_DATA 55 .data : { /* Data */
55 CONSTRUCTORS 56 DATA_DATA
56 } 57 CONSTRUCTORS
57 58 }
58 . = ALIGN(4096); 59
59 __nosave_begin = .; 60 . = ALIGN(PAGE_SIZE);
60 .data_nosave : { *(.data.nosave) } 61 .data_nosave : {
61 . = ALIGN(4096); 62 __nosave_begin = .;
62 __nosave_end = .; 63 *(.data.nosave)
63 64 }
64 . = ALIGN(4096); 65 . = ALIGN(PAGE_SIZE);
65 .data.page_aligned : { *(.data.idt) } 66 __nosave_end = .;
66 67
67 . = ALIGN(256); 68 . = ALIGN(PAGE_SIZE);
68 .data.cacheline_aligned : { *(.data.cacheline_aligned) } 69 .data.page_aligned : {
69 70 *(.data.idt)
70 . = ALIGN(256); 71 }
71 .data.read_mostly : { *(.data.read_mostly) } 72
72 _edata = .; /* End of data section */ 73 . = ALIGN(0x100);
73 74 .data.cacheline_aligned : {
74 . = ALIGN(8192); /* init_task */ 75 *(.data.cacheline_aligned)
75 .data.init_task : { *(.data.init_task) } 76 }
76 77
77 /* will be freed after init */ 78 . = ALIGN(0x100);
78 . = ALIGN(4096); /* Init code and data */ 79 .data.read_mostly : {
79 __init_begin = .; 80 *(.data.read_mostly)
80 .init.text : { 81 }
81 _sinittext = .; 82 _edata = .; /* End of data section */
82 *(.init.text) 83
83 _einittext = .; 84 . = ALIGN(2 * PAGE_SIZE); /* init_task */
84 } 85 .data.init_task : {
85 /* 86 *(.data.init_task)
86 * .exit.text is discarded at runtime, not link time, 87 }
87 * to deal with references from __bug_table 88
88 */ 89 /* will be freed after init */
89 .exit.text : { *(.exit.text) } 90 . = ALIGN(PAGE_SIZE); /* Init code and data */
90 91 __init_begin = .;
91 .init.data : { *(.init.data) } 92 .init.text : {
92 . = ALIGN(256); 93 _sinittext = .;
93 __setup_start = .; 94 *(.init.text)
94 .init.setup : { *(.init.setup) } 95 _einittext = .;
95 __setup_end = .; 96 }
96 __initcall_start = .; 97 /*
97 .initcall.init : { 98 * .exit.text is discarded at runtime, not link time,
98 INITCALLS 99 * to deal with references from __bug_table
99 } 100 */
100 __initcall_end = .; 101 .exit.text : {
101 __con_initcall_start = .; 102 *(.exit.text)
102 .con_initcall.init : { *(.con_initcall.init) } 103 }
103 __con_initcall_end = .; 104
104 SECURITY_INIT 105 .init.data : {
106 *(.init.data)
107 }
108 . = ALIGN(0x100);
109 .init.setup : {
110 __setup_start = .;
111 *(.init.setup)
112 __setup_end = .;
113 }
114 .initcall.init : {
115 __initcall_start = .;
116 INITCALLS
117 __initcall_end = .;
118 }
119
120 .con_initcall.init : {
121 __con_initcall_start = .;
122 *(.con_initcall.init)
123 __con_initcall_end = .;
124 }
125 SECURITY_INIT
105 126
106#ifdef CONFIG_BLK_DEV_INITRD 127#ifdef CONFIG_BLK_DEV_INITRD
107 . = ALIGN(256); 128 . = ALIGN(0x100);
108 __initramfs_start = .; 129 .init.ramfs : {
109 .init.ramfs : { *(.init.initramfs) } 130 __initramfs_start = .;
110 . = ALIGN(2); 131 *(.init.ramfs)
111 __initramfs_end = .; 132 . = ALIGN(2);
133 __initramfs_end = .;
134 }
112#endif 135#endif
113 PERCPU(4096) 136
114 . = ALIGN(4096); 137 PERCPU(PAGE_SIZE)
115 __init_end = .; 138 . = ALIGN(PAGE_SIZE);
116 /* freed after init ends here */ 139 __init_end = .; /* freed after init ends here */
117 140
118 __bss_start = .; /* BSS */ 141 /* BSS */
119 .bss : { *(.bss) } 142 .bss : {
120 . = ALIGN(2); 143 __bss_start = .;
121 __bss_stop = .; 144 *(.bss)
122 145 . = ALIGN(2);
123 _end = . ; 146 __bss_stop = .;
124 147 }
125 /* Sections to be discarded */ 148
126 /DISCARD/ : { 149 _end = . ;
127 *(.exit.data) *(.exitcall.exit) 150
128 } 151 /* Sections to be discarded */
129 152 /DISCARD/ : {
130 /* Stabs debugging sections. */ 153 *(.exit.data)
131 .stab 0 : { *(.stab) } 154 *(.exitcall.exit)
132 .stabstr 0 : { *(.stabstr) } 155 }
133 .stab.excl 0 : { *(.stab.excl) } 156
134 .stab.exclstr 0 : { *(.stab.exclstr) } 157 /* Debugging sections. */
135 .stab.index 0 : { *(.stab.index) } 158 STABS_DEBUG
136 .stab.indexstr 0 : { *(.stab.indexstr) } 159 DWARF_DEBUG
137 .comment 0 : { *(.comment) }
138} 160}
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 54055194e9af..14c241ccdd4d 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -218,7 +218,7 @@ static int do_out_of_memory(struct pt_regs *regs, unsigned long error_code,
218 } 218 }
219 printk("VM: killing process %s\n", tsk->comm); 219 printk("VM: killing process %s\n", tsk->comm);
220 if (regs->psw.mask & PSW_MASK_PSTATE) 220 if (regs->psw.mask & PSW_MASK_PSTATE)
221 do_exit(SIGKILL); 221 do_group_exit(SIGKILL);
222 do_no_context(regs, error_code, address); 222 do_no_context(regs, error_code, address);
223 return 0; 223 return 0;
224} 224}
@@ -468,7 +468,7 @@ typedef struct {
468 __u64 refselmk; 468 __u64 refselmk;
469 __u64 refcmpmk; 469 __u64 refcmpmk;
470 __u64 reserved; 470 __u64 reserved;
471} __attribute__ ((packed)) pfault_refbk_t; 471} __attribute__ ((packed, aligned(8))) pfault_refbk_t;
472 472
473int pfault_init(void) 473int pfault_init(void)
474{ 474{
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 54878f07cf0c..44982c1dfa23 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -118,7 +118,7 @@ endchoice
118 118
119config SH_FPU 119config SH_FPU
120 bool "FPU support" 120 bool "FPU support"
121 depends on CPU_SH4 121 depends on CPU_HAS_FPU
122 default y 122 default y
123 help 123 help
124 Selecting this option will enable support for SH processors that 124 Selecting this option will enable support for SH processors that
@@ -178,12 +178,6 @@ config CPU_HAS_INTEVT
178config CPU_HAS_MASKREG_IRQ 178config CPU_HAS_MASKREG_IRQ
179 bool 179 bool
180 180
181config CPU_HAS_INTC_IRQ
182 bool
183
184config CPU_HAS_INTC2_IRQ
185 bool
186
187config CPU_HAS_IPR_IRQ 181config CPU_HAS_IPR_IRQ
188 bool 182 bool
189 183
@@ -205,6 +199,9 @@ config CPU_HAS_PTEA
205config CPU_HAS_DSP 199config CPU_HAS_DSP
206 bool 200 bool
207 201
202config CPU_HAS_FPU
203 bool
204
208endmenu 205endmenu
209 206
210menu "Board support" 207menu "Board support"
@@ -258,7 +255,6 @@ config SH_7780_SOLUTION_ENGINE
258 bool "SolutionEngine7780" 255 bool "SolutionEngine7780"
259 select SOLUTION_ENGINE 256 select SOLUTION_ENGINE
260 select SYS_SUPPORTS_PCI 257 select SYS_SUPPORTS_PCI
261 select CPU_HAS_INTC2_IRQ
262 depends on CPU_SUBTYPE_SH7780 258 depends on CPU_SUBTYPE_SH7780
263 help 259 help
264 Select 7780 SolutionEngine if configuring for a Renesas SH7780 260 Select 7780 SolutionEngine if configuring for a Renesas SH7780
@@ -309,7 +305,7 @@ config SH_MPC1211
309 305
310config SH_SH03 306config SH_SH03
311 bool "Interface CTP/PCI-SH03" 307 bool "Interface CTP/PCI-SH03"
312 depends on CPU_SUBTYPE_SH7751 && BROKEN 308 depends on CPU_SUBTYPE_SH7751
313 select CPU_HAS_IPR_IRQ 309 select CPU_HAS_IPR_IRQ
314 select SYS_SUPPORTS_PCI 310 select SYS_SUPPORTS_PCI
315 help 311 help
@@ -395,11 +391,22 @@ config SH_LBOX_RE2
395 help 391 help
396 Select L-BOX RE2 if configuring for the NTT COMWARE L-BOX RE2. 392 Select L-BOX RE2 if configuring for the NTT COMWARE L-BOX RE2.
397 393
394config SH_X3PROTO
395 bool "SH-X3 Prototype board"
396 depends on CPU_SUBTYPE_SHX3
397
398config SH_MAGIC_PANEL_R2
399 bool "Magic Panel R2"
400 depends on CPU_SUBTYPE_SH7720
401 help
402 Select Magic Panel R2 if configuring for Magic Panel R2.
403
398endmenu 404endmenu
399 405
400source "arch/sh/boards/renesas/hs7751rvoip/Kconfig" 406source "arch/sh/boards/renesas/hs7751rvoip/Kconfig"
401source "arch/sh/boards/renesas/rts7751r2d/Kconfig" 407source "arch/sh/boards/renesas/rts7751r2d/Kconfig"
402source "arch/sh/boards/renesas/r7780rp/Kconfig" 408source "arch/sh/boards/renesas/r7780rp/Kconfig"
409source "arch/sh/boards/magicpanelr2/Kconfig"
403 410
404menu "Timer and clock configuration" 411menu "Timer and clock configuration"
405 412
@@ -563,10 +570,19 @@ config NR_CPUS
563 570
564source "kernel/Kconfig.preempt" 571source "kernel/Kconfig.preempt"
565 572
566config NODES_SHIFT 573config GUSA
567 int 574 def_bool y
568 default "1" 575 depends on !SMP
569 depends on NEED_MULTIPLE_NODES 576 help
577 This enables support for gUSA (general UserSpace Atomicity).
578 This is the default implementation for both UP and non-ll/sc
579 CPUs, and is used by the libc, amongst others.
580
581 For additional information, design information can be found
582 in <http://lc.linux.or.jp/lc2002/papers/niibe0919p.pdf>.
583
584 This should only be disabled for special cases where alternate
585 atomicity implementations exist.
570 586
571endmenu 587endmenu
572 588
@@ -659,6 +675,17 @@ config SUPERHYWAY
659 tristate "SuperHyway Bus support" 675 tristate "SuperHyway Bus support"
660 depends on CPU_SUBTYPE_SH4_202 676 depends on CPU_SUBTYPE_SH4_202
661 677
678config MAPLE
679 bool "Maple Bus support"
680 depends on SH_DREAMCAST
681 help
682 The Maple Bus is SEGA's serial communication bus for peripherals
683 on the Dreamcast. Without this bus support you won't be able to
684 get your Dreamcast keyboard etc to work, so most users
685 probably want to say 'Y' here, unless you are only using the
686 Dreamcast with a serial line terminal or a remote network
687 connection.
688
662config CF_ENABLER 689config CF_ENABLER
663 bool "Compact Flash Enabler support" 690 bool "Compact Flash Enabler support"
664 depends on SOLUTION_ENGINE || SH_SH03 691 depends on SOLUTION_ENGINE || SH_SH03
diff --git a/arch/sh/Kconfig.debug b/arch/sh/Kconfig.debug
index 52f6a99c8ecc..b507b501f0cf 100644
--- a/arch/sh/Kconfig.debug
+++ b/arch/sh/Kconfig.debug
@@ -28,13 +28,17 @@ config EARLY_SCIF_CONSOLE
28 serial I/O. 28 serial I/O.
29 29
30config EARLY_SCIF_CONSOLE_PORT 30config EARLY_SCIF_CONSOLE_PORT
31 hex "SCIF port for early console" 31 hex
32 depends on EARLY_SCIF_CONSOLE 32 depends on EARLY_SCIF_CONSOLE
33 default "0xffe00000" if CPU_SUBTYPE_SH7780 33 default "0xffe00000" if CPU_SUBTYPE_SH7780
34 default "0xffea0000" if CPU_SUBTYPE_SH7785
34 default "0xfffe9800" if CPU_SUBTYPE_SH7206 35 default "0xfffe9800" if CPU_SUBTYPE_SH7206
35 default "0xf8420000" if CPU_SUBTYPE_SH7619 36 default "0xf8420000" if CPU_SUBTYPE_SH7619
36 default "0xa4400000" if CPU_SUBTYPE_SH7712 || CPU_SUBTYPE_SH7705 37 default "0xa4400000" if CPU_SUBTYPE_SH7712 || CPU_SUBTYPE_SH7705
38 default "0xa4430000" if CPU_SUBTYPE_SH7720
39 default "0xffc30000" if CPU_SUBTYPE_SHX3
37 default "0xffe80000" if CPU_SH4 40 default "0xffe80000" if CPU_SH4
41 default "0x00000000"
38 42
39config EARLY_PRINTK 43config EARLY_PRINTK
40 bool "Early printk support" 44 bool "Early printk support"
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 0353296c2c93..408342b175c8 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -118,6 +118,7 @@ machdir-$(CONFIG_SH_7751_SYSTEMH) += renesas/systemh
118machdir-$(CONFIG_SH_EDOSK7705) += renesas/edosk7705 118machdir-$(CONFIG_SH_EDOSK7705) += renesas/edosk7705
119machdir-$(CONFIG_SH_HIGHLANDER) += renesas/r7780rp 119machdir-$(CONFIG_SH_HIGHLANDER) += renesas/r7780rp
120machdir-$(CONFIG_SH_7710VOIPGW) += renesas/sh7710voipgw 120machdir-$(CONFIG_SH_7710VOIPGW) += renesas/sh7710voipgw
121machdir-$(CONFIG_SH_X3PROTO) += renesas/x3proto
121machdir-$(CONFIG_SH_SH4202_MICRODEV) += superh/microdev 122machdir-$(CONFIG_SH_SH4202_MICRODEV) += superh/microdev
122machdir-$(CONFIG_SH_LANDISK) += landisk 123machdir-$(CONFIG_SH_LANDISK) += landisk
123machdir-$(CONFIG_SH_TITAN) += titan 124machdir-$(CONFIG_SH_TITAN) += titan
@@ -125,6 +126,7 @@ machdir-$(CONFIG_SH_SHMIN) += shmin
125machdir-$(CONFIG_SH_7206_SOLUTION_ENGINE) += se/7206 126machdir-$(CONFIG_SH_7206_SOLUTION_ENGINE) += se/7206
126machdir-$(CONFIG_SH_7619_SOLUTION_ENGINE) += se/7619 127machdir-$(CONFIG_SH_7619_SOLUTION_ENGINE) += se/7619
127machdir-$(CONFIG_SH_LBOX_RE2) += lboxre2 128machdir-$(CONFIG_SH_LBOX_RE2) += lboxre2
129machdir-$(CONFIG_SH_MAGIC_PANEL_R2) += magicpanelr2
128 130
129incdir-y := $(notdir $(machdir-y)) 131incdir-y := $(notdir $(machdir-y))
130 132
@@ -135,7 +137,7 @@ endif
135 137
136# Companion chips 138# Companion chips
137core-$(CONFIG_HD6446X_SERIES) += arch/sh/cchips/hd6446x/ 139core-$(CONFIG_HD6446X_SERIES) += arch/sh/cchips/hd6446x/
138core-$(CONFIG_VOYAGERGX) += arch/sh/cchips/voyagergx/ 140core-$(CONFIG_MFD_SM501) += arch/sh/cchips/voyagergx/
139 141
140cpuincdir-$(CONFIG_CPU_SH2) := cpu-sh2 142cpuincdir-$(CONFIG_CPU_SH2) := cpu-sh2
141cpuincdir-$(CONFIG_CPU_SH2A) := cpu-sh2a 143cpuincdir-$(CONFIG_CPU_SH2A) := cpu-sh2a
diff --git a/arch/sh/boards/hp6xx/hp6xx_apm.c b/arch/sh/boards/hp6xx/hp6xx_apm.c
index d1c1460c8a06..640ca2a74f16 100644
--- a/arch/sh/boards/hp6xx/hp6xx_apm.c
+++ b/arch/sh/boards/hp6xx/hp6xx_apm.c
@@ -20,9 +20,9 @@
20#define APM_CRITICAL 10 20#define APM_CRITICAL 10
21#define APM_LOW 30 21#define APM_LOW 30
22 22
23#define HP680_BATTERY_MAX 875 23#define HP680_BATTERY_MAX 898
24#define HP680_BATTERY_MIN 600 24#define HP680_BATTERY_MIN 486
25#define HP680_BATTERY_AC_ON 900 25#define HP680_BATTERY_AC_ON 1023
26 26
27#define MODNAME "hp6x0_apm" 27#define MODNAME "hp6x0_apm"
28 28
@@ -65,7 +65,7 @@ static void hp6x0_apm_get_power_status(struct apm_power_info *info)
65 65
66static irqreturn_t hp6x0_apm_interrupt(int irq, void *dev) 66static irqreturn_t hp6x0_apm_interrupt(int irq, void *dev)
67{ 67{
68 if (!apm_suspended) 68 if (!APM_DISABLED)
69 apm_queue_event(APM_USER_SUSPEND); 69 apm_queue_event(APM_USER_SUSPEND);
70 70
71 return IRQ_HANDLED; 71 return IRQ_HANDLED;
@@ -91,7 +91,6 @@ static int __init hp6x0_apm_init(void)
91static void __exit hp6x0_apm_exit(void) 91static void __exit hp6x0_apm_exit(void)
92{ 92{
93 free_irq(HP680_BTN_IRQ, 0); 93 free_irq(HP680_BTN_IRQ, 0);
94 apm_get_info = NULL;
95} 94}
96 95
97module_init(hp6x0_apm_init); 96module_init(hp6x0_apm_init);
diff --git a/arch/sh/boards/hp6xx/setup.c b/arch/sh/boards/hp6xx/setup.c
index 7ae708930bac..2f414ac3c690 100644
--- a/arch/sh/boards/hp6xx/setup.c
+++ b/arch/sh/boards/hp6xx/setup.c
@@ -7,7 +7,7 @@
7 * May be copied or modified under the terms of the GNU General Public 7 * May be copied or modified under the terms of the GNU General Public
8 * License. See linux/COPYING for more information. 8 * License. See linux/COPYING for more information.
9 * 9 *
10 * Setup code for an HP680 (internal peripherials only) 10 * Setup code for HP620/HP660/HP680/HP690 (internal peripherials only)
11 */ 11 */
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/init.h> 13#include <linux/init.h>
@@ -19,7 +19,7 @@
19#include <asm/cpu/dac.h> 19#include <asm/cpu/dac.h>
20 20
21#define SCPCR 0xa4000116 21#define SCPCR 0xa4000116
22#define SCPDR 0xa4000136 22#define SCPDR 0xa4000136
23 23
24/* CF Slot */ 24/* CF Slot */
25static struct resource cf_ide_resources[] = { 25static struct resource cf_ide_resources[] = {
@@ -34,7 +34,7 @@ static struct resource cf_ide_resources[] = {
34 .flags = IORESOURCE_MEM, 34 .flags = IORESOURCE_MEM,
35 }, 35 },
36 [2] = { 36 [2] = {
37 .start = 93, 37 .start = 77,
38 .flags = IORESOURCE_IRQ, 38 .flags = IORESOURCE_IRQ,
39 }, 39 },
40}; 40};
@@ -46,10 +46,22 @@ static struct platform_device cf_ide_device = {
46 .resource = cf_ide_resources, 46 .resource = cf_ide_resources,
47}; 47};
48 48
49static struct platform_device jornadakbd_device = {
50 .name = "jornada680_kbd",
51 .id = -1,
52};
53
49static struct platform_device *hp6xx_devices[] __initdata = { 54static struct platform_device *hp6xx_devices[] __initdata = {
50 &cf_ide_device, 55 &cf_ide_device,
56 &jornadakbd_device,
51}; 57};
52 58
59static void __init hp6xx_init_irq(void)
60{
61 /* Gets touchscreen and powerbutton IRQ working */
62 plat_irq_setup_pins(IRQ_MODE_IRQ);
63}
64
53static int __init hp6xx_devices_setup(void) 65static int __init hp6xx_devices_setup(void)
54{ 66{
55 return platform_add_devices(hp6xx_devices, ARRAY_SIZE(hp6xx_devices)); 67 return platform_add_devices(hp6xx_devices, ARRAY_SIZE(hp6xx_devices));
@@ -61,11 +73,11 @@ static void __init hp6xx_setup(char **cmdline_p)
61 u16 v; 73 u16 v;
62 74
63 v = inw(HD64461_STBCR); 75 v = inw(HD64461_STBCR);
64 v |= HD64461_STBCR_SURTST | HD64461_STBCR_SIRST | 76 v |= HD64461_STBCR_SURTST | HD64461_STBCR_SIRST |
65 HD64461_STBCR_STM1ST | HD64461_STBCR_STM0ST | 77 HD64461_STBCR_STM1ST | HD64461_STBCR_STM0ST |
66 HD64461_STBCR_SAFEST | HD64461_STBCR_SPC0ST | 78 HD64461_STBCR_SAFEST | HD64461_STBCR_SPC0ST |
67 HD64461_STBCR_SMIAST | HD64461_STBCR_SAFECKE_OST | 79 HD64461_STBCR_SMIAST | HD64461_STBCR_SAFECKE_OST|
68 HD64461_STBCR_SAFECKE_IST; 80 HD64461_STBCR_SAFECKE_IST;
69#ifndef CONFIG_HD64461_ENABLER 81#ifndef CONFIG_HD64461_ENABLER
70 v |= HD64461_STBCR_SPC1ST; 82 v |= HD64461_STBCR_SPC1ST;
71#endif 83#endif
@@ -101,6 +113,9 @@ device_initcall(hp6xx_devices_setup);
101static struct sh_machine_vector mv_hp6xx __initmv = { 113static struct sh_machine_vector mv_hp6xx __initmv = {
102 .mv_name = "hp6xx", 114 .mv_name = "hp6xx",
103 .mv_setup = hp6xx_setup, 115 .mv_setup = hp6xx_setup,
104 .mv_nr_irqs = HD64461_IRQBASE + HD64461_IRQ_NUM, 116 /* IRQ's : CPU(64) + CCHIP(16) + FREE_TO_USE(6) */
117 .mv_nr_irqs = HD64461_IRQBASE + HD64461_IRQ_NUM + 6,
105 .mv_irq_demux = hd64461_irq_demux, 118 .mv_irq_demux = hd64461_irq_demux,
119 /* Enable IRQ0 -> IRQ3 in IRQ_MODE */
120 .mv_init_irq = hp6xx_init_irq,
106}; 121};
diff --git a/arch/sh/boards/magicpanelr2/Kconfig b/arch/sh/boards/magicpanelr2/Kconfig
new file mode 100644
index 000000000000..b0abddc3e84f
--- /dev/null
+++ b/arch/sh/boards/magicpanelr2/Kconfig
@@ -0,0 +1,13 @@
1if SH_MAGIC_PANEL_R2
2
3menu "Magic Panel R2 options"
4
5config SH_MAGIC_PANEL_R2_VERSION
6 int SH_MAGIC_PANEL_R2_VERSION
7 default "3"
8 help
9 Set the version of the Magic Panel R2
10
11endmenu
12
13endif
diff --git a/arch/sh/boards/magicpanelr2/Makefile b/arch/sh/boards/magicpanelr2/Makefile
new file mode 100644
index 000000000000..7a6d586b9072
--- /dev/null
+++ b/arch/sh/boards/magicpanelr2/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for the Magic Panel specific parts
3#
4
5obj-y := setup.o \ No newline at end of file
diff --git a/arch/sh/boards/magicpanelr2/setup.c b/arch/sh/boards/magicpanelr2/setup.c
new file mode 100644
index 000000000000..f3b8b07ea5d6
--- /dev/null
+++ b/arch/sh/boards/magicpanelr2/setup.c
@@ -0,0 +1,394 @@
1/*
2 * linux/arch/sh/boards/magicpanel/setup.c
3 *
4 * Copyright (C) 2007 Markus Brunner, Mark Jonas
5 *
6 * Magic Panel Release 2 board setup
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <linux/platform_device.h>
15#include <linux/delay.h>
16#include <linux/mtd/mtd.h>
17#include <linux/mtd/partitions.h>
18#include <linux/mtd/physmap.h>
19#include <linux/mtd/map.h>
20#include <asm/magicpanelr2.h>
21#include <asm/heartbeat.h>
22
23#define LAN9115_READY (ctrl_inl(0xA8000084UL) & 0x00000001UL)
24
25/* Prefer cmdline over RedBoot */
26static const char *probes[] = { "cmdlinepart", "RedBoot", NULL };
27
28/* Wait until reset finished. Timeout is 100ms. */
29static int __init ethernet_reset_finished(void)
30{
31 int i;
32
33 if (LAN9115_READY)
34 return 1;
35
36 for (i = 0; i < 10; ++i) {
37 mdelay(10);
38 if (LAN9115_READY)
39 return 1;
40 }
41
42 return 0;
43}
44
45static void __init reset_ethernet(void)
46{
47 /* PMDR: LAN_RESET=on */
48 CLRBITS_OUTB(0x10, PORT_PMDR);
49
50 udelay(200);
51
52 /* PMDR: LAN_RESET=off */
53 SETBITS_OUTB(0x10, PORT_PMDR);
54}
55
56static void __init setup_chip_select(void)
57{
58 /* CS2: LAN (0x08000000 - 0x0bffffff) */
59 /* no idle cycles, normal space, 8 bit data bus */
60 ctrl_outl(0x36db0400, CS2BCR);
61 /* (SW:1.5 WR:3 HW:1.5), ext. wait */
62 ctrl_outl(0x000003c0, CS2WCR);
63
64 /* CS4: CAN1 (0xb0000000 - 0xb3ffffff) */
65 /* no idle cycles, normal space, 8 bit data bus */
66 ctrl_outl(0x00000200, CS4BCR);
67 /* (SW:1.5 WR:3 HW:1.5), ext. wait */
68 ctrl_outl(0x00100981, CS4WCR);
69
70 /* CS5a: CAN2 (0xb4000000 - 0xb5ffffff) */
71 /* no idle cycles, normal space, 8 bit data bus */
72 ctrl_outl(0x00000200, CS5ABCR);
73 /* (SW:1.5 WR:3 HW:1.5), ext. wait */
74 ctrl_outl(0x00100981, CS5AWCR);
75
76 /* CS5b: CAN3 (0xb6000000 - 0xb7ffffff) */
77 /* no idle cycles, normal space, 8 bit data bus */
78 ctrl_outl(0x00000200, CS5BBCR);
79 /* (SW:1.5 WR:3 HW:1.5), ext. wait */
80 ctrl_outl(0x00100981, CS5BWCR);
81
82 /* CS6a: Rotary (0xb8000000 - 0xb9ffffff) */
83 /* no idle cycles, normal space, 8 bit data bus */
84 ctrl_outl(0x00000200, CS6ABCR);
85 /* (SW:1.5 WR:3 HW:1.5), no ext. wait */
86 ctrl_outl(0x001009C1, CS6AWCR);
87}
88
89static void __init setup_port_multiplexing(void)
90{
91 /* A7 GPO(LED8); A6 GPO(LED7); A5 GPO(LED6); A4 GPO(LED5);
92 * A3 GPO(LED4); A2 GPO(LED3); A1 GPO(LED2); A0 GPO(LED1);
93 */
94 ctrl_outw(0x5555, PORT_PACR); /* 01 01 01 01 01 01 01 01 */
95
96 /* B7 GPO(RST4); B6 GPO(RST3); B5 GPO(RST2); B4 GPO(RST1);
97 * B3 GPO(PB3); B2 GPO(PB2); B1 GPO(PB1); B0 GPO(PB0);
98 */
99 ctrl_outw(0x5555, PORT_PBCR); /* 01 01 01 01 01 01 01 01 */
100
101 /* C7 GPO(PC7); C6 GPO(PC6); C5 GPO(PC5); C4 GPO(PC4);
102 * C3 LCD_DATA3; C2 LCD_DATA2; C1 LCD_DATA1; C0 LCD_DATA0;
103 */
104 ctrl_outw(0x5500, PORT_PCCR); /* 01 01 01 01 00 00 00 00 */
105
106 /* D7 GPO(PD7); D6 GPO(PD6); D5 GPO(PD5); D4 GPO(PD4);
107 * D3 GPO(PD3); D2 GPO(PD2); D1 GPO(PD1); D0 GPO(PD0);
108 */
109 ctrl_outw(0x5555, PORT_PDCR); /* 01 01 01 01 01 01 01 01 */
110
111 /* E7 (x); E6 GPI(nu); E5 GPI(nu); E4 LCD_M_DISP;
112 * E3 LCD_CL1; E2 LCD_CL2; E1 LCD_DON; E0 LCD_FLM;
113 */
114 ctrl_outw(0x3C00, PORT_PECR); /* 00 11 11 00 00 00 00 00 */
115
116 /* F7 (x); F6 DA1(VLCD); F5 DA0(nc); F4 AN3;
117 * F3 AN2(MID_AD); F2 AN1(EARTH_AD); F1 AN0(TEMP); F0 GPI+(nc);
118 */
119 ctrl_outw(0x0002, PORT_PFCR); /* 00 00 00 00 00 00 00 10 */
120
121 /* G7 (x); G6 IRQ5(TOUCH_BUSY); G5 IRQ4(TOUCH_IRQ); G4 GPI(KEY2);
122 * G3 GPI(KEY1); G2 GPO(LED11); G1 GPO(LED10); G0 GPO(LED9);
123 */
124 ctrl_outw(0x03D5, PORT_PGCR); /* 00 00 00 11 11 01 01 01 */
125
126 /* H7 (x); H6 /RAS(BRAS); H5 /CAS(BCAS); H4 CKE(BCKE);
127 * H3 GPO(EARTH_OFF); H2 GPO(EARTH_TEST); H1 USB2_PWR; H0 USB1_PWR;
128 */
129 ctrl_outw(0x0050, PORT_PHCR); /* 00 00 00 00 01 01 00 00 */
130
131 /* J7 (x); J6 AUDCK; J5 ASEBRKAK; J4 AUDATA3;
132 * J3 AUDATA2; J2 AUDATA1; J1 AUDATA0; J0 AUDSYNC;
133 */
134 ctrl_outw(0x0000, PORT_PJCR); /* 00 00 00 00 00 00 00 00 */
135
136 /* K7 (x); K6 (x); K5 (x); K4 (x);
137 * K3 PINT7(/PWR2); K2 PINT6(/PWR1); K1 PINT5(nu); K0 PINT4(FLASH_READY)
138 */
139 ctrl_outw(0x00FF, PORT_PKCR); /* 00 00 00 00 11 11 11 11 */
140
141 /* L7 TRST; L6 TMS; L5 TDO; L4 TDI;
142 * L3 TCK; L2 (x); L1 (x); L0 (x);
143 */
144 ctrl_outw(0x0000, PORT_PLCR); /* 00 00 00 00 00 00 00 00 */
145
146 /* M7 GPO(CURRENT_SINK); M6 GPO(PWR_SWITCH); M5 GPO(LAN_SPEED);
147 * M4 GPO(LAN_RESET); M3 GPO(BUZZER); M2 GPO(LCD_BL);
148 * M1 CS5B(CAN3_CS); M0 GPI+(nc);
149 */
150 ctrl_outw(0x5552, PORT_PMCR); /* 01 01 01 01 01 01 00 10 */
151
152 /* CURRENT_SINK=off, PWR_SWITCH=off, LAN_SPEED=100MBit,
153 * LAN_RESET=off, BUZZER=off, LCD_BL=off
154 */
155#if CONFIG_SH_MAGIC_PANEL_R2_VERSION == 2
156 ctrl_outb(0x30, PORT_PMDR);
157#elif CONFIG_SH_MAGIC_PANEL_R2_VERSION == 3
158 ctrl_outb(0xF0, PORT_PMDR);
159#else
160#error Unknown revision of PLATFORM_MP_R2
161#endif
162
163 /* P7 (x); P6 (x); P5 (x);
164 * P4 GPO(nu); P3 IRQ3(LAN_IRQ); P2 IRQ2(CAN3_IRQ);
165 * P1 IRQ1(CAN2_IRQ); P0 IRQ0(CAN1_IRQ)
166 */
167 ctrl_outw(0x0100, PORT_PPCR); /* 00 00 00 01 00 00 00 00 */
168 ctrl_outb(0x10, PORT_PPDR);
169
170 /* R7 A25; R6 A24; R5 A23; R4 A22;
171 * R3 A21; R2 A20; R1 A19; R0 A0;
172 */
173 ctrl_outw(0x0000, PORT_PRCR); /* 00 00 00 00 00 00 00 00 */
174
175 /* S7 (x); S6 (x); S5 (x); S4 GPO(EEPROM_CS2);
176 * S3 GPO(EEPROM_CS1); S2 SIOF0_TXD; S1 SIOF0_RXD; S0 SIOF0_SCK;
177 */
178 ctrl_outw(0x0140, PORT_PSCR); /* 00 00 00 01 01 00 00 00 */
179
180 /* T7 (x); T6 (x); T5 (x); T4 COM1_CTS;
181 * T3 COM1_RTS; T2 COM1_TXD; T1 COM1_RXD; T0 GPO(WDOG)
182 */
183 ctrl_outw(0x0001, PORT_PTCR); /* 00 00 00 00 00 00 00 01 */
184
185 /* U7 (x); U6 (x); U5 (x); U4 GPI+(/AC_FAULT);
186 * U3 GPO(TOUCH_CS); U2 TOUCH_TXD; U1 TOUCH_RXD; U0 TOUCH_SCK;
187 */
188 ctrl_outw(0x0240, PORT_PUCR); /* 00 00 00 10 01 00 00 00 */
189
190 /* V7 (x); V6 (x); V5 (x); V4 GPO(MID2);
191 * V3 GPO(MID1); V2 CARD_TxD; V1 CARD_RxD; V0 GPI+(/BAT_FAULT);
192 */
193 ctrl_outw(0x0142, PORT_PVCR); /* 00 00 00 01 01 00 00 10 */
194}
195
196static void __init mpr2_setup(char **cmdline_p)
197{
198 __set_io_port_base(0xa0000000);
199
200 /* set Pin Select Register A:
201 * /PCC_CD1, /PCC_CD2, PCC_BVD1, PCC_BVD2,
202 * /IOIS16, IRQ4, IRQ5, USB1d_SUSPEND
203 */
204 ctrl_outw(0xAABC, PORT_PSELA);
205 /* set Pin Select Register B:
206 * /SCIF0_RTS, /SCIF0_CTS, LCD_VCPWC,
207 * LCD_VEPWC, IIC_SDA, IIC_SCL, Reserved
208 */
209 ctrl_outw(0x3C00, PORT_PSELB);
210 /* set Pin Select Register C:
211 * SIOF1_SCK, SIOF1_RxD, SCIF1_RxD, SCIF1_TxD, Reserved
212 */
213 ctrl_outw(0x0000, PORT_PSELC);
214 /* set Pin Select Register D: Reserved, SIOF1_TxD, Reserved, SIOF1_MCLK,
215 * Reserved, SIOF1_SYNC, Reserved, SCIF1_SCK, Reserved
216 */
217 ctrl_outw(0x0000, PORT_PSELD);
218 /* set USB TxRx Control: Reserved, DRV, Reserved, USB_TRANS, USB_SEL */
219 ctrl_outw(0x0101, PORT_UTRCTL);
220 /* set USB Clock Control: USSCS, USSTB, Reserved (HighByte always A5) */
221 ctrl_outw(0xA5C0, PORT_UCLKCR_W);
222
223 setup_chip_select();
224
225 setup_port_multiplexing();
226
227 reset_ethernet();
228
229 printk(KERN_INFO "Magic Panel Release 2 A.%i\n",
230 CONFIG_SH_MAGIC_PANEL_R2_VERSION);
231
232 if (ethernet_reset_finished() == 0)
233 printk(KERN_WARNING "Ethernet not ready\n");
234}
235
236static struct resource smc911x_resources[] = {
237 [0] = {
238 .start = 0xa8000000,
239 .end = 0xabffffff,
240 .flags = IORESOURCE_MEM,
241 },
242 [1] = {
243 .start = 35,
244 .end = 35,
245 .flags = IORESOURCE_IRQ,
246 },
247};
248
249static struct platform_device smc911x_device = {
250 .name = "smc911x",
251 .id = -1,
252 .num_resources = ARRAY_SIZE(smc911x_resources),
253 .resource = smc911x_resources,
254};
255
256static struct resource heartbeat_resources[] = {
257 [0] = {
258 .start = PA_LED,
259 .end = PA_LED,
260 .flags = IORESOURCE_MEM,
261 },
262};
263
264static struct heartbeat_data heartbeat_data = {
265 .flags = HEARTBEAT_INVERTED,
266};
267
268static struct platform_device heartbeat_device = {
269 .name = "heartbeat",
270 .id = -1,
271 .dev = {
272 .platform_data = &heartbeat_data,
273 },
274 .num_resources = ARRAY_SIZE(heartbeat_resources),
275 .resource = heartbeat_resources,
276};
277
278static struct mtd_partition *parsed_partitions;
279
280static struct mtd_partition mpr2_partitions[] = {
281 /* Reserved for bootloader, read-only */
282 {
283 .name = "Bootloader",
284 .offset = 0x00000000UL,
285 .size = MPR2_MTD_BOOTLOADER_SIZE,
286 .mask_flags = MTD_WRITEABLE,
287 },
288 /* Reserved for kernel image */
289 {
290 .name = "Kernel",
291 .offset = MTDPART_OFS_NXTBLK,
292 .size = MPR2_MTD_KERNEL_SIZE,
293 },
294 /* Rest is used for Flash FS */
295 {
296 .name = "Flash_FS",
297 .offset = MTDPART_OFS_NXTBLK,
298 .size = MTDPART_SIZ_FULL,
299 }
300};
301
302static struct physmap_flash_data flash_data = {
303 .width = 2,
304};
305
306static struct resource flash_resource = {
307 .start = 0x00000000,
308 .end = 0x2000000UL,
309 .flags = IORESOURCE_MEM,
310};
311
312static struct platform_device flash_device = {
313 .name = "physmap-flash",
314 .id = -1,
315 .resource = &flash_resource,
316 .num_resources = 1,
317 .dev = {
318 .platform_data = &flash_data,
319 },
320};
321
322static struct mtd_info *flash_mtd;
323
324static struct map_info mpr2_flash_map = {
325 .name = "Magic Panel R2 Flash",
326 .size = 0x2000000UL,
327 .bankwidth = 2,
328};
329
330static void __init set_mtd_partitions(void)
331{
332 int nr_parts = 0;
333
334 simple_map_init(&mpr2_flash_map);
335 flash_mtd = do_map_probe("cfi_probe", &mpr2_flash_map);
336 nr_parts = parse_mtd_partitions(flash_mtd, probes,
337 &parsed_partitions, 0);
338 /* If there is no partition table, used the hard coded table */
339 if (nr_parts <= 0) {
340 flash_data.parts = mpr2_partitions;
341 flash_data.nr_parts = ARRAY_SIZE(mpr2_partitions);
342 } else {
343 flash_data.nr_parts = nr_parts;
344 flash_data.parts = parsed_partitions;
345 }
346}
347
348/*
349 * Add all resources to the platform_device
350 */
351
352static struct platform_device *mpr2_devices[] __initdata = {
353 &heartbeat_device,
354 &smc911x_device,
355 &flash_device,
356};
357
358
359static int __init mpr2_devices_setup(void)
360{
361 set_mtd_partitions();
362 return platform_add_devices(mpr2_devices, ARRAY_SIZE(mpr2_devices));
363}
364device_initcall(mpr2_devices_setup);
365
366/*
367 * Initialize IRQ setting
368 */
369static void __init init_mpr2_IRQ(void)
370{
371 plat_irq_setup_pins(IRQ_MODE_IRQ); /* install handlers for IRQ0-5 */
372
373 set_irq_type(32, IRQ_TYPE_LEVEL_LOW); /* IRQ0 CAN1 */
374 set_irq_type(33, IRQ_TYPE_LEVEL_LOW); /* IRQ1 CAN2 */
375 set_irq_type(34, IRQ_TYPE_LEVEL_LOW); /* IRQ2 CAN3 */
376 set_irq_type(35, IRQ_TYPE_LEVEL_LOW); /* IRQ3 SMSC9115 */
377 set_irq_type(36, IRQ_TYPE_EDGE_RISING); /* IRQ4 touchscreen */
378 set_irq_type(37, IRQ_TYPE_EDGE_FALLING); /* IRQ5 touchscreen */
379
380 intc_set_priority(32, 13); /* IRQ0 CAN1 */
381 intc_set_priority(33, 13); /* IRQ0 CAN2 */
382 intc_set_priority(34, 13); /* IRQ0 CAN3 */
383 intc_set_priority(35, 6); /* IRQ3 SMSC9115 */
384}
385
386/*
387 * The Machine Vector
388 */
389
390static struct sh_machine_vector mv_mpr2 __initmv = {
391 .mv_name = "mpr2",
392 .mv_setup = mpr2_setup,
393 .mv_init_irq = init_mpr2_IRQ,
394};
diff --git a/arch/sh/boards/mpc1211/setup.c b/arch/sh/boards/mpc1211/setup.c
index 8ce03e00b0ae..fede36361dc7 100644
--- a/arch/sh/boards/mpc1211/setup.c
+++ b/arch/sh/boards/mpc1211/setup.c
@@ -285,7 +285,7 @@ static int put_smb_blk(unsigned char *p, int address, int command, int no)
285static struct resource heartbeat_resources[] = { 285static struct resource heartbeat_resources[] = {
286 [0] = { 286 [0] = {
287 .start = 0xa2000000, 287 .start = 0xa2000000,
288 .end = 0xa2000000 + 8 - 1, 288 .end = 0xa2000000,
289 .flags = IORESOURCE_MEM, 289 .flags = IORESOURCE_MEM,
290 }, 290 },
291}; 291};
diff --git a/arch/sh/boards/renesas/r7780rp/Makefile b/arch/sh/boards/renesas/r7780rp/Makefile
index b1d20afb4eb3..dd26182fbf58 100644
--- a/arch/sh/boards/renesas/r7780rp/Makefile
+++ b/arch/sh/boards/renesas/r7780rp/Makefile
@@ -1,9 +1,10 @@
1# 1#
2# Makefile for the R7780RP-1 specific parts of the kernel 2# Makefile for the R7780RP-1 specific parts of the kernel
3# 3#
4irqinit-y := irq-r7780rp.o 4irqinit-$(CONFIG_SH_R7780MP) := irq-r7780mp.o
5irqinit-$(CONFIG_SH_R7785RP) := irq-r7785rp.o 5irqinit-$(CONFIG_SH_R7785RP) := irq-r7785rp.o
6obj-y := setup.o irq.o $(irqinit-y) 6irqinit-$(CONFIG_SH_R7780RP) := irq-r7780rp.o irq.o
7obj-y := setup.o $(irqinit-y)
7 8
8ifneq ($(CONFIG_SH_R7785RP),y) 9ifneq ($(CONFIG_SH_R7785RP),y)
9obj-$(CONFIG_PUSH_SWITCH) += psw.o 10obj-$(CONFIG_PUSH_SWITCH) += psw.o
diff --git a/arch/sh/boards/renesas/r7780rp/irq-r7780mp.c b/arch/sh/boards/renesas/r7780rp/irq-r7780mp.c
new file mode 100644
index 000000000000..59b47fe061f9
--- /dev/null
+++ b/arch/sh/boards/renesas/r7780rp/irq-r7780mp.c
@@ -0,0 +1,61 @@
1/*
2 * Renesas Solutions Highlander R7780MP Support.
3 *
4 * Copyright (C) 2002 Atom Create Engineering Co., Ltd.
5 * Copyright (C) 2006 Paul Mundt
6 * Copyright (C) 2007 Magnus Damm
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <linux/io.h>
15#include <asm/r7780rp.h>
16
17enum {
18 UNUSED = 0,
19
20 /* board specific interrupt sources */
21 AX88796, /* Ethernet controller */
22 CF, /* Compact Flash */
23 PSW, /* Push Switch */
24 EXT1, /* EXT1n IRQ */
25 EXT4, /* EXT4n IRQ */
26};
27
28static struct intc_vect vectors[] __initdata = {
29 INTC_IRQ(CF, IRQ_CF),
30 INTC_IRQ(PSW, IRQ_PSW),
31 INTC_IRQ(AX88796, IRQ_AX88796),
32 INTC_IRQ(EXT1, IRQ_EXT1),
33 INTC_IRQ(EXT4, IRQ_EXT4),
34};
35
36static struct intc_mask_reg mask_registers[] __initdata = {
37 { 0xa4000000, 0, 16, /* IRLMSK */
38 { 0, 0, 0, 0, CF, 0, 0, 0,
39 0, 0, 0, EXT4, 0, EXT1, PSW, AX88796 } },
40};
41
42static unsigned char irl2irq[HL_NR_IRL] __initdata = {
43 0, IRQ_CF, 0, 0,
44 0, 0, 0, 0,
45 0, IRQ_EXT4, 0, IRQ_EXT1,
46 0, IRQ_AX88796, IRQ_PSW,
47};
48
49static DECLARE_INTC_DESC(intc_desc, "r7780mp", vectors,
50 NULL, NULL, mask_registers, NULL, NULL);
51
52unsigned char * __init highlander_init_irq_r7780mp(void)
53{
54 if ((ctrl_inw(0xa4000700) & 0xf000) == 0x2000) {
55 printk(KERN_INFO "Using r7780mp interrupt controller.\n");
56 register_intc_controller(&intc_desc);
57 return irl2irq;
58 }
59
60 return NULL;
61}
diff --git a/arch/sh/boards/renesas/r7780rp/irq-r7780rp.c b/arch/sh/boards/renesas/r7780rp/irq-r7780rp.c
index f5f358746c9e..fa4a534cade9 100644
--- a/arch/sh/boards/renesas/r7780rp/irq-r7780rp.c
+++ b/arch/sh/boards/renesas/r7780rp/irq-r7780rp.c
@@ -9,13 +9,15 @@
9 * for more details. 9 * for more details.
10 */ 10 */
11#include <linux/init.h> 11#include <linux/init.h>
12#include <asm/io.h> 12#include <linux/io.h>
13#include <asm/r7780rp.h> 13#include <asm/r7780rp.h>
14 14
15void __init highlander_init_irq(void) 15unsigned char * __init highlander_init_irq_r7780rp(void)
16{ 16{
17 int i; 17 int i;
18 18
19 for (i = 0; i < 15; i++) 19 for (i = 0; i < 15; i++)
20 make_r7780rp_irq(i); 20 make_r7780rp_irq(i);
21
22 return NULL;
21} 23}
diff --git a/arch/sh/boards/renesas/r7780rp/irq-r7785rp.c b/arch/sh/boards/renesas/r7780rp/irq-r7785rp.c
index dd6ec4ce44dc..b2c6a84673bd 100644
--- a/arch/sh/boards/renesas/r7780rp/irq-r7785rp.c
+++ b/arch/sh/boards/renesas/r7780rp/irq-r7785rp.c
@@ -1,19 +1,55 @@
1/* 1/*
2 * Renesas Solutions Highlander R7780RP-1 Support. 2 * Renesas Solutions Highlander R7785RP Support.
3 * 3 *
4 * Copyright (C) 2002 Atom Create Engineering Co., Ltd. 4 * Copyright (C) 2002 Atom Create Engineering Co., Ltd.
5 * Copyright (C) 2006 Paul Mundt 5 * Copyright (C) 2006 Paul Mundt
6 * Copyright (C) 2007 Magnus Damm
6 * 7 *
7 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
9 * for more details. 10 * for more details.
10 */ 11 */
11#include <linux/init.h> 12#include <linux/init.h>
12#include <asm/io.h> 13#include <linux/irq.h>
14#include <linux/io.h>
13#include <asm/r7780rp.h> 15#include <asm/r7780rp.h>
14 16
15void __init highlander_init_irq(void) 17enum {
18 UNUSED = 0,
19
20 /* board specific interrupt sources */
21 AX88796, /* Ethernet controller */
22 CF, /* Compact Flash */
23};
24
25static struct intc_vect vectors[] __initdata = {
26 INTC_IRQ(CF, IRQ_CF),
27 INTC_IRQ(AX88796, IRQ_AX88796),
28};
29
30static struct intc_mask_reg mask_registers[] __initdata = {
31 { 0xa4000010, 0, 16, /* IRLMCR1 */
32 { 0, 0, 0, 0, CF, AX88796, 0, 0,
33 0, 0, 0, 0, 0, 0, 0, 0 } },
34};
35
36static unsigned char irl2irq[HL_NR_IRL] __initdata = {
37 0, IRQ_CF, 0, 0,
38 0, 0, 0, 0,
39 0, 0, IRQ_AX88796, 0,
40 0, 0, 0,
41};
42
43static DECLARE_INTC_DESC(intc_desc, "r7785rp", vectors,
44 NULL, NULL, mask_registers, NULL, NULL);
45
46unsigned char * __init highlander_init_irq_r7785rp(void)
16{ 47{
48 if ((ctrl_inw(0xa4000158) & 0xf000) != 0x1000)
49 return NULL;
50
51 printk(KERN_INFO "Using r7785rp interrupt controller.\n");
52
17 ctrl_outw(0x0000, PA_IRLSSR1); /* FPGA IRLSSR1(CF_CD clear) */ 53 ctrl_outw(0x0000, PA_IRLSSR1); /* FPGA IRLSSR1(CF_CD clear) */
18 54
19 /* Setup the FPGA IRL */ 55 /* Setup the FPGA IRL */
@@ -24,6 +60,6 @@ void __init highlander_init_irq(void)
24 ctrl_outw(0x4321, PA_IRLPRE); /* FPGA IRLE */ 60 ctrl_outw(0x4321, PA_IRLPRE); /* FPGA IRLE */
25 ctrl_outw(0x0000, PA_IRLPRF); /* FPGA IRLF */ 61 ctrl_outw(0x0000, PA_IRLPRF); /* FPGA IRLF */
26 62
27 make_r7780rp_irq(1); /* CF card */ 63 register_intc_controller(&intc_desc);
28 make_r7780rp_irq(10); /* On-board ethernet */ 64 return irl2irq;
29} 65}
diff --git a/arch/sh/boards/renesas/r7780rp/setup.c b/arch/sh/boards/renesas/r7780rp/setup.c
index adb529d01bae..afe9de73666a 100644
--- a/arch/sh/boards/renesas/r7780rp/setup.c
+++ b/arch/sh/boards/renesas/r7780rp/setup.c
@@ -19,6 +19,7 @@
19#include <asm/machvec.h> 19#include <asm/machvec.h>
20#include <asm/r7780rp.h> 20#include <asm/r7780rp.h>
21#include <asm/clock.h> 21#include <asm/clock.h>
22#include <asm/heartbeat.h>
22#include <asm/io.h> 23#include <asm/io.h>
23 24
24static struct resource r8a66597_usb_host_resources[] = { 25static struct resource r8a66597_usb_host_resources[] = {
@@ -30,8 +31,8 @@ static struct resource r8a66597_usb_host_resources[] = {
30 }, 31 },
31 [1] = { 32 [1] = {
32 .name = "r8a66597_hcd", 33 .name = "r8a66597_hcd",
33 .start = 11, /* irq number */ 34 .start = IRQ_EXT1, /* irq number */
34 .end = 11, 35 .end = IRQ_EXT1,
35 .flags = IORESOURCE_IRQ, 36 .flags = IORESOURCE_IRQ,
36 }, 37 },
37}; 38};
@@ -56,8 +57,8 @@ static struct resource m66592_usb_peripheral_resources[] = {
56 }, 57 },
57 [1] = { 58 [1] = {
58 .name = "m66592_udc", 59 .name = "m66592_udc",
59 .start = 9, /* irq number */ 60 .start = IRQ_EXT4, /* irq number */
60 .end = 9, 61 .end = IRQ_EXT4,
61 .flags = IORESOURCE_IRQ, 62 .flags = IORESOURCE_IRQ,
62 }, 63 },
63}; 64};
@@ -85,11 +86,7 @@ static struct resource cf_ide_resources[] = {
85 .flags = IORESOURCE_MEM, 86 .flags = IORESOURCE_MEM,
86 }, 87 },
87 [2] = { 88 [2] = {
88#ifdef CONFIG_SH_R7780RP 89 .start = IRQ_CF,
89 .start = 4,
90#else
91 .start = 1,
92#endif
93 .flags = IORESOURCE_IRQ, 90 .flags = IORESOURCE_IRQ,
94 }, 91 },
95}; 92};
@@ -108,16 +105,23 @@ static struct platform_device cf_ide_device = {
108 }, 105 },
109}; 106};
110 107
111static unsigned char heartbeat_bit_pos[] = { 2, 1, 0, 3, 6, 5, 4, 7 };
112
113static struct resource heartbeat_resources[] = { 108static struct resource heartbeat_resources[] = {
114 [0] = { 109 [0] = {
115 .start = PA_OBLED, 110 .start = PA_OBLED,
116 .end = PA_OBLED + ARRAY_SIZE(heartbeat_bit_pos) - 1, 111 .end = PA_OBLED,
117 .flags = IORESOURCE_MEM, 112 .flags = IORESOURCE_MEM,
118 }, 113 },
119}; 114};
120 115
116#ifndef CONFIG_SH_R7785RP
117static unsigned char heartbeat_bit_pos[] = { 2, 1, 0, 3, 6, 5, 4, 7 };
118
119static struct heartbeat_data heartbeat_data = {
120 .bit_pos = heartbeat_bit_pos,
121 .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
122};
123#endif
124
121static struct platform_device heartbeat_device = { 125static struct platform_device heartbeat_device = {
122 .name = "heartbeat", 126 .name = "heartbeat",
123 .id = -1, 127 .id = -1,
@@ -125,7 +129,7 @@ static struct platform_device heartbeat_device = {
125 /* R7785RP has a slightly more sensible FPGA.. */ 129 /* R7785RP has a slightly more sensible FPGA.. */
126#ifndef CONFIG_SH_R7785RP 130#ifndef CONFIG_SH_R7785RP
127 .dev = { 131 .dev = {
128 .platform_data = heartbeat_bit_pos, 132 .platform_data = &heartbeat_data,
129 }, 133 },
130#endif 134#endif
131 .num_resources = ARRAY_SIZE(heartbeat_resources), 135 .num_resources = ARRAY_SIZE(heartbeat_resources),
@@ -217,12 +221,50 @@ static void __init highlander_setup(char **cmdline_p)
217 pm_power_off = r7780rp_power_off; 221 pm_power_off = r7780rp_power_off;
218} 222}
219 223
224static unsigned char irl2irq[HL_NR_IRL];
225
226int highlander_irq_demux(int irq)
227{
228 if (irq >= HL_NR_IRL || !irl2irq[irq])
229 return irq;
230
231 return irl2irq[irq];
232}
233
234void __init highlander_init_irq(void)
235{
236 unsigned char *ucp = NULL;
237
238 do {
239#ifdef CONFIG_SH_R7780MP
240 ucp = highlander_init_irq_r7780mp();
241 if (ucp)
242 break;
243#endif
244#ifdef CONFIG_SH_R7785RP
245 ucp = highlander_init_irq_r7785rp();
246 if (ucp)
247 break;
248#endif
249#ifdef CONFIG_SH_R7780RP
250 highlander_init_irq_r7780rp();
251 ucp = irl2irq;
252 break;
253#endif
254 } while (0);
255
256 if (ucp) {
257 plat_irq_setup_pins(IRQ_MODE_IRL3210);
258 memcpy(irl2irq, ucp, HL_NR_IRL);
259 }
260}
261
220/* 262/*
221 * The Machine Vector 263 * The Machine Vector
222 */ 264 */
223static struct sh_machine_vector mv_highlander __initmv = { 265static struct sh_machine_vector mv_highlander __initmv = {
224 .mv_name = "Highlander", 266 .mv_name = "Highlander",
225 .mv_nr_irqs = 109,
226 .mv_setup = highlander_setup, 267 .mv_setup = highlander_setup,
227 .mv_init_irq = highlander_init_irq, 268 .mv_init_irq = highlander_init_irq,
269 .mv_irq_demux = highlander_irq_demux,
228}; 270};
diff --git a/arch/sh/boards/renesas/rts7751r2d/Kconfig b/arch/sh/boards/renesas/rts7751r2d/Kconfig
index 7780d1fb13ff..8122a9667fc9 100644
--- a/arch/sh/boards/renesas/rts7751r2d/Kconfig
+++ b/arch/sh/boards/renesas/rts7751r2d/Kconfig
@@ -1,11 +1,22 @@
1if SH_RTS7751R2D 1if SH_RTS7751R2D
2 2
3menu "RTS7751R2D options" 3menu "RTS7751R2D Board Revision"
4 4
5config RTS7751R2D_REV11 5config RTS7751R2D_PLUS
6 bool "RTS7751R2D Rev. 1.1 board support" 6 bool "R2D-PLUS"
7 help 7 help
8 Selecting this option will support version rev. 1.1. 8 Selecting this option will configure the kernel for R2D-PLUS.
9
10 R2D-PLUS is the smaller of the two R2D board versions, equipped
11 with a single PCI slot.
12
13config RTS7751R2D_1
14 bool "R2D-1"
15 help
16 Selecting this option will configure the kernel for R2D-1.
17
18 R2D-1 is the larger of the two R2D board versions, equipped
19 with two PCI slots.
9endmenu 20endmenu
10 21
11endif 22endif
diff --git a/arch/sh/boards/renesas/rts7751r2d/irq.c b/arch/sh/boards/renesas/rts7751r2d/irq.c
index 0bae9041aceb..7cc2813adfe4 100644
--- a/arch/sh/boards/renesas/rts7751r2d/irq.c
+++ b/arch/sh/boards/renesas/rts7751r2d/irq.c
@@ -1,84 +1,159 @@
1/* 1/*
2 * linux/arch/sh/boards/renesas/rts7751r2d/irq.c 2 * linux/arch/sh/boards/renesas/rts7751r2d/irq.c
3 * 3 *
4 * Copyright (C) 2007 Magnus Damm
4 * Copyright (C) 2000 Kazumoto Kojima 5 * Copyright (C) 2000 Kazumoto Kojima
5 * 6 *
6 * Renesas Technology Sales RTS7751R2D Support. 7 * Renesas Technology Sales RTS7751R2D Support, R2D-PLUS and R2D-1.
7 * 8 *
8 * Modified for RTS7751R2D by 9 * Modified for RTS7751R2D by
9 * Atom Create Engineering Co., Ltd. 2002. 10 * Atom Create Engineering Co., Ltd. 2002.
10 */ 11 */
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/interrupt.h>
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <asm/voyagergx.h>
16#include <asm/rts7751r2d.h> 17#include <asm/rts7751r2d.h>
17 18
18#if defined(CONFIG_RTS7751R2D_REV11) 19#define R2D_NR_IRL 13
19static int mask_pos[] = {11, 9, 8, 12, 10, 6, 5, 4, 7, 14, 13, 0, 0, 0, 0};
20#else
21static int mask_pos[] = {6, 11, 9, 8, 12, 10, 5, 4, 7, 14, 13, 0, 0, 0, 0};
22#endif
23 20
24extern int voyagergx_irq_demux(int irq); 21enum {
25extern void setup_voyagergx_irq(void); 22 UNUSED = 0,
26 23
27static void enable_rts7751r2d_irq(unsigned int irq) 24 /* board specific interrupt sources (R2D-1 and R2D-PLUS) */
28{ 25 EXT, /* EXT_INT0-3 */
29 /* Set priority in IPR back to original value */ 26 RTC_T, RTC_A, /* Real Time Clock */
30 ctrl_outw(ctrl_inw(IRLCNTR1) | (1 << mask_pos[irq]), IRLCNTR1); 27 AX88796, /* Ethernet controller (R2D-1 board) */
31} 28 KEY, /* Key input (R2D-PLUS board) */
29 SDCARD, /* SD Card */
30 CF_CD, CF_IDE, /* CF Card Detect + CF IDE */
31 SM501, /* SM501 aka Voyager */
32 PCI_INTD_RTL8139, /* Ethernet controller */
33 PCI_INTC_PCI1520, /* Cardbus/PCMCIA bridge */
34 PCI_INTB_RTL8139, /* Ethernet controller with HUB (R2D-PLUS board) */
35 PCI_INTB_SLOT, /* PCI Slot 3.3v (R2D-1 board) */
36 PCI_INTA_SLOT, /* PCI Slot 3.3v */
37 TP, /* Touch Panel */
38};
32 39
33static void disable_rts7751r2d_irq(unsigned int irq) 40#ifdef CONFIG_RTS7751R2D_1
34{ 41
35 /* Set the priority in IPR to 0 */ 42/* Vectors for R2D-1 */
36 ctrl_outw(ctrl_inw(IRLCNTR1) & (0xffff ^ (1 << mask_pos[irq])), 43static struct intc_vect vectors_r2d_1[] __initdata = {
37 IRLCNTR1); 44 INTC_IRQ(EXT, IRQ_EXT),
38} 45 INTC_IRQ(RTC_T, IRQ_RTC_T), INTC_IRQ(RTC_A, IRQ_RTC_A),
46 INTC_IRQ(AX88796, IRQ_AX88796), INTC_IRQ(SDCARD, IRQ_SDCARD),
47 INTC_IRQ(CF_CD, IRQ_CF_CD), INTC_IRQ(CF_IDE, IRQ_CF_IDE), /* ng */
48 INTC_IRQ(SM501, IRQ_VOYAGER),
49 INTC_IRQ(PCI_INTD_RTL8139, IRQ_PCI_INTD),
50 INTC_IRQ(PCI_INTC_PCI1520, IRQ_PCI_INTC),
51 INTC_IRQ(PCI_INTB_SLOT, IRQ_PCI_INTB),
52 INTC_IRQ(PCI_INTA_SLOT, IRQ_PCI_INTA),
53 INTC_IRQ(TP, IRQ_TP),
54};
55
56/* IRLMSK mask register layout for R2D-1 */
57static struct intc_mask_reg mask_registers_r2d_1[] __initdata = {
58 { 0xa4000000, 0, 16, /* IRLMSK */
59 { TP, PCI_INTA_SLOT, PCI_INTB_SLOT,
60 PCI_INTC_PCI1520, PCI_INTD_RTL8139,
61 SM501, CF_IDE, CF_CD, SDCARD, AX88796,
62 RTC_A, RTC_T, 0, 0, 0, EXT } },
63};
64
65/* IRLn to IRQ table for R2D-1 */
66static unsigned char irl2irq_r2d_1[R2D_NR_IRL] __initdata = {
67 IRQ_PCI_INTD, IRQ_CF_IDE, IRQ_CF_CD, IRQ_PCI_INTC,
68 IRQ_VOYAGER, IRQ_AX88796, IRQ_RTC_A, IRQ_RTC_T,
69 IRQ_SDCARD, IRQ_PCI_INTA, IRQ_PCI_INTB, IRQ_EXT,
70 IRQ_TP,
71};
72
73static DECLARE_INTC_DESC(intc_desc_r2d_1, "r2d-1", vectors_r2d_1,
74 NULL, NULL, mask_registers_r2d_1, NULL, NULL);
75
76#endif /* CONFIG_RTS7751R2D_1 */
77
78#ifdef CONFIG_RTS7751R2D_PLUS
79
80/* Vectors for R2D-PLUS */
81static struct intc_vect vectors_r2d_plus[] __initdata = {
82 INTC_IRQ(EXT, IRQ_EXT),
83 INTC_IRQ(RTC_T, IRQ_RTC_T), INTC_IRQ(RTC_A, IRQ_RTC_A),
84 INTC_IRQ(KEY, IRQ_KEY), INTC_IRQ(SDCARD, IRQ_SDCARD),
85 INTC_IRQ(CF_CD, IRQ_CF_CD), INTC_IRQ(CF_IDE, IRQ_CF_IDE),
86 INTC_IRQ(SM501, IRQ_VOYAGER),
87 INTC_IRQ(PCI_INTD_RTL8139, IRQ_PCI_INTD),
88 INTC_IRQ(PCI_INTC_PCI1520, IRQ_PCI_INTC),
89 INTC_IRQ(PCI_INTB_RTL8139, IRQ_PCI_INTB),
90 INTC_IRQ(PCI_INTA_SLOT, IRQ_PCI_INTA),
91 INTC_IRQ(TP, IRQ_TP),
92};
93
94/* IRLMSK mask register layout for R2D-PLUS */
95static struct intc_mask_reg mask_registers_r2d_plus[] __initdata = {
96 { 0xa4000000, 0, 16, /* IRLMSK */
97 { TP, PCI_INTA_SLOT, PCI_INTB_RTL8139,
98 PCI_INTC_PCI1520, PCI_INTD_RTL8139,
99 SM501, CF_IDE, CF_CD, SDCARD, KEY,
100 RTC_A, RTC_T, 0, 0, 0, EXT } },
101};
102
103/* IRLn to IRQ table for R2D-PLUS */
104static unsigned char irl2irq_r2d_plus[R2D_NR_IRL] __initdata = {
105 IRQ_PCI_INTD, IRQ_CF_IDE, IRQ_CF_CD, IRQ_PCI_INTC,
106 IRQ_VOYAGER, IRQ_KEY, IRQ_RTC_A, IRQ_RTC_T,
107 IRQ_SDCARD, IRQ_PCI_INTA, IRQ_PCI_INTB, IRQ_EXT,
108 IRQ_TP,
109};
110
111static DECLARE_INTC_DESC(intc_desc_r2d_plus, "r2d-plus", vectors_r2d_plus,
112 NULL, NULL, mask_registers_r2d_plus, NULL, NULL);
113
114#endif /* CONFIG_RTS7751R2D_PLUS */
115
116static unsigned char irl2irq[R2D_NR_IRL];
39 117
40int rts7751r2d_irq_demux(int irq) 118int rts7751r2d_irq_demux(int irq)
41{ 119{
42 return voyagergx_irq_demux(irq); 120 if (irq >= R2D_NR_IRL || !irl2irq[irq])
43} 121 return irq;
44 122
45static struct irq_chip rts7751r2d_irq_chip __read_mostly = { 123 return irl2irq[irq];
46 .name = "rts7751r2d", 124}
47 .mask = disable_rts7751r2d_irq,
48 .unmask = enable_rts7751r2d_irq,
49 .mask_ack = disable_rts7751r2d_irq,
50};
51 125
52/* 126/*
53 * Initialize IRQ setting 127 * Initialize IRQ setting
54 */ 128 */
55void __init init_rts7751r2d_IRQ(void) 129void __init init_rts7751r2d_IRQ(void)
56{ 130{
57 int i; 131 struct intc_desc *d;
58 132
59 /* IRL0=KEY Input 133 switch (ctrl_inw(PA_VERREG) & 0xf0) {
60 * IRL1=Ethernet 134#ifdef CONFIG_RTS7751R2D_PLUS
61 * IRL2=CF Card 135 case 0x10:
62 * IRL3=CF Card Insert 136 printk(KERN_INFO "Using R2D-PLUS interrupt controller.\n");
63 * IRL4=PCMCIA 137 d = &intc_desc_r2d_plus;
64 * IRL5=VOYAGER 138 memcpy(irl2irq, irl2irq_r2d_plus, R2D_NR_IRL);
65 * IRL6=RTC Alarm 139 break;
66 * IRL7=RTC Timer 140#endif
67 * IRL8=SD Card 141#ifdef CONFIG_RTS7751R2D_1
68 * IRL9=PCI Slot #1 142 case 0x00: /* according to manual */
69 * IRL10=PCI Slot #2 143 case 0x30: /* in reality */
70 * IRL11=Extention #0 144 printk(KERN_INFO "Using R2D-1 interrupt controller.\n");
71 * IRL12=Extention #1 145 d = &intc_desc_r2d_1;
72 * IRL13=Extention #2 146 memcpy(irl2irq, irl2irq_r2d_1, R2D_NR_IRL);
73 * IRL14=Extention #3 147 break;
74 */ 148#endif
75 149 default:
76 for (i=0; i<15; i++) { 150 printk(KERN_INFO "Unknown R2D interrupt controller 0x%04x\n",
77 disable_irq_nosync(i); 151 ctrl_inw(PA_VERREG));
78 set_irq_chip_and_handler_name(i, &rts7751r2d_irq_chip, 152 return;
79 handle_level_irq, "level");
80 enable_rts7751r2d_irq(i);
81 } 153 }
82 154
155 register_intc_controller(d);
156#ifdef CONFIG_MFD_SM501
83 setup_voyagergx_irq(); 157 setup_voyagergx_irq();
158#endif
84} 159}
diff --git a/arch/sh/boards/renesas/rts7751r2d/setup.c b/arch/sh/boards/renesas/rts7751r2d/setup.c
index 6f7029d33241..37f2c0b447fe 100644
--- a/arch/sh/boards/renesas/rts7751r2d/setup.c
+++ b/arch/sh/boards/renesas/rts7751r2d/setup.c
@@ -45,20 +45,16 @@ static void __init voyagergx_serial_init(void)
45static struct resource cf_ide_resources[] = { 45static struct resource cf_ide_resources[] = {
46 [0] = { 46 [0] = {
47 .start = PA_AREA5_IO + 0x1000, 47 .start = PA_AREA5_IO + 0x1000,
48 .end = PA_AREA5_IO + 0x1000 + 0x08 - 1, 48 .end = PA_AREA5_IO + 0x1000 + 0x10 - 0x2,
49 .flags = IORESOURCE_MEM, 49 .flags = IORESOURCE_MEM,
50 }, 50 },
51 [1] = { 51 [1] = {
52 .start = PA_AREA5_IO + 0x80c, 52 .start = PA_AREA5_IO + 0x80c,
53 .end = PA_AREA5_IO + 0x80c + 0x16 - 1, 53 .end = PA_AREA5_IO + 0x80c,
54 .flags = IORESOURCE_MEM, 54 .flags = IORESOURCE_MEM,
55 }, 55 },
56 [2] = { 56 [2] = {
57#ifdef CONFIG_RTS7751R2D_REV11 57 .start = IRQ_CF_IDE,
58 .start = 1,
59#else
60 .start = 2,
61#endif
62 .flags = IORESOURCE_IRQ, 58 .flags = IORESOURCE_IRQ,
63 }, 59 },
64}; 60};
@@ -77,12 +73,28 @@ static struct platform_device cf_ide_device = {
77 }, 73 },
78}; 74};
79 75
76static struct resource heartbeat_resources[] = {
77 [0] = {
78 .start = PA_OUTPORT,
79 .end = PA_OUTPORT,
80 .flags = IORESOURCE_MEM,
81 },
82};
83
84static struct platform_device heartbeat_device = {
85 .name = "heartbeat",
86 .id = -1,
87 .num_resources = ARRAY_SIZE(heartbeat_resources),
88 .resource = heartbeat_resources,
89};
90
91#ifdef CONFIG_MFD_SM501
80static struct plat_serial8250_port uart_platform_data[] = { 92static struct plat_serial8250_port uart_platform_data[] = {
81 { 93 {
82 .membase = (void __iomem *)VOYAGER_UART_BASE, 94 .membase = (void __iomem *)VOYAGER_UART_BASE,
83 .mapbase = VOYAGER_UART_BASE, 95 .mapbase = VOYAGER_UART_BASE,
84 .iotype = UPIO_MEM, 96 .iotype = UPIO_MEM,
85 .irq = VOYAGER_UART0_IRQ, 97 .irq = IRQ_SM501_U0,
86 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, 98 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
87 .regshift = 2, 99 .regshift = 2,
88 .uartclk = (9600 * 16), 100 .uartclk = (9600 * 16),
@@ -98,21 +110,6 @@ static struct platform_device uart_device = {
98 }, 110 },
99}; 111};
100 112
101static struct resource heartbeat_resources[] = {
102 [0] = {
103 .start = PA_OUTPORT,
104 .end = PA_OUTPORT + 8 - 1,
105 .flags = IORESOURCE_MEM,
106 },
107};
108
109static struct platform_device heartbeat_device = {
110 .name = "heartbeat",
111 .id = -1,
112 .num_resources = ARRAY_SIZE(heartbeat_resources),
113 .resource = heartbeat_resources,
114};
115
116static struct resource sm501_resources[] = { 113static struct resource sm501_resources[] = {
117 [0] = { 114 [0] = {
118 .start = 0x10000000, 115 .start = 0x10000000,
@@ -125,7 +122,7 @@ static struct resource sm501_resources[] = {
125 .flags = IORESOURCE_MEM, 122 .flags = IORESOURCE_MEM,
126 }, 123 },
127 [2] = { 124 [2] = {
128 .start = 32, 125 .start = IRQ_SM501_CV,
129 .flags = IORESOURCE_IRQ, 126 .flags = IORESOURCE_IRQ,
130 }, 127 },
131}; 128};
@@ -137,22 +134,19 @@ static struct platform_device sm501_device = {
137 .resource = sm501_resources, 134 .resource = sm501_resources,
138}; 135};
139 136
137#endif /* CONFIG_MFD_SM501 */
138
140static struct platform_device *rts7751r2d_devices[] __initdata = { 139static struct platform_device *rts7751r2d_devices[] __initdata = {
140#ifdef CONFIG_MFD_SM501
141 &uart_device, 141 &uart_device,
142 &heartbeat_device,
143 &sm501_device, 142 &sm501_device,
143#endif
144 &cf_ide_device,
145 &heartbeat_device,
144}; 146};
145 147
146static int __init rts7751r2d_devices_setup(void) 148static int __init rts7751r2d_devices_setup(void)
147{ 149{
148 int ret;
149
150 if (ctrl_inw(PA_BVERREG) == 0x10) { /* only working on R2D-PLUS */
151 ret = platform_device_register(&cf_ide_device);
152 if (ret)
153 return ret;
154 }
155
156 return platform_add_devices(rts7751r2d_devices, 150 return platform_add_devices(rts7751r2d_devices,
157 ARRAY_SIZE(rts7751r2d_devices)); 151 ARRAY_SIZE(rts7751r2d_devices));
158} 152}
@@ -163,6 +157,34 @@ static void rts7751r2d_power_off(void)
163 ctrl_outw(0x0001, PA_POWOFF); 157 ctrl_outw(0x0001, PA_POWOFF);
164} 158}
165 159
160static inline unsigned char is_ide_ioaddr(unsigned long addr)
161{
162 return ((cf_ide_resources[0].start <= addr &&
163 addr <= cf_ide_resources[0].end) ||
164 (cf_ide_resources[1].start <= addr &&
165 addr <= cf_ide_resources[1].end));
166}
167
168void rts7751r2d_writeb(u8 b, void __iomem *addr)
169{
170 unsigned long tmp = (unsigned long __force)addr;
171
172 if (is_ide_ioaddr(tmp))
173 ctrl_outw((u16)b, tmp);
174 else
175 ctrl_outb(b, tmp);
176}
177
178u8 rts7751r2d_readb(void __iomem *addr)
179{
180 unsigned long tmp = (unsigned long __force)addr;
181
182 if (is_ide_ioaddr(tmp))
183 return ctrl_inw(tmp) & 0xff;
184 else
185 return ctrl_inb(tmp);
186}
187
166/* 188/*
167 * Initialize the board 189 * Initialize the board
168 */ 190 */
@@ -187,12 +209,11 @@ static void __init rts7751r2d_setup(char **cmdline_p)
187static struct sh_machine_vector mv_rts7751r2d __initmv = { 209static struct sh_machine_vector mv_rts7751r2d __initmv = {
188 .mv_name = "RTS7751R2D", 210 .mv_name = "RTS7751R2D",
189 .mv_setup = rts7751r2d_setup, 211 .mv_setup = rts7751r2d_setup,
190 .mv_nr_irqs = 72,
191
192 .mv_init_irq = init_rts7751r2d_IRQ, 212 .mv_init_irq = init_rts7751r2d_IRQ,
193 .mv_irq_demux = rts7751r2d_irq_demux, 213 .mv_irq_demux = rts7751r2d_irq_demux,
194 214 .mv_writeb = rts7751r2d_writeb,
195#ifdef CONFIG_USB_SM501 215 .mv_readb = rts7751r2d_readb,
216#if defined(CONFIG_MFD_SM501) && defined(CONFIG_USB_OHCI_HCD)
196 .mv_consistent_alloc = voyagergx_consistent_alloc, 217 .mv_consistent_alloc = voyagergx_consistent_alloc,
197 .mv_consistent_free = voyagergx_consistent_free, 218 .mv_consistent_free = voyagergx_consistent_free,
198#endif 219#endif
diff --git a/arch/sh/boards/renesas/x3proto/Makefile b/arch/sh/boards/renesas/x3proto/Makefile
new file mode 100644
index 000000000000..983e4551fecf
--- /dev/null
+++ b/arch/sh/boards/renesas/x3proto/Makefile
@@ -0,0 +1 @@
obj-y += setup.o ilsel.o
diff --git a/arch/sh/boards/renesas/x3proto/ilsel.c b/arch/sh/boards/renesas/x3proto/ilsel.c
new file mode 100644
index 000000000000..6d4454fef97c
--- /dev/null
+++ b/arch/sh/boards/renesas/x3proto/ilsel.c
@@ -0,0 +1,151 @@
1/*
2 * arch/sh/boards/renesas/x3proto/ilsel.c
3 *
4 * Helper routines for SH-X3 proto board ILSEL.
5 *
6 * Copyright (C) 2007 Paul Mundt
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/kernel.h>
14#include <linux/module.h>
15#include <linux/bitmap.h>
16#include <linux/io.h>
17#include <asm/ilsel.h>
18
19/*
20 * ILSEL is split across:
21 *
22 * ILSEL0 - 0xb8100004 [ Levels 1 - 4 ]
23 * ILSEL1 - 0xb8100006 [ Levels 5 - 8 ]
24 * ILSEL2 - 0xb8100008 [ Levels 9 - 12 ]
25 * ILSEL3 - 0xb810000a [ Levels 13 - 15 ]
26 *
27 * With each level being relative to an ilsel_source_t.
28 */
29#define ILSEL_BASE 0xb8100004
30#define ILSEL_LEVELS 15
31
32/*
33 * ILSEL level map, in descending order from the highest level down.
34 *
35 * Supported levels are 1 - 15 spread across ILSEL0 - ILSEL4, mapping
36 * directly to IRLs. As the IRQs are numbered in reverse order relative
37 * to the interrupt level, the level map is carefully managed to ensure a
38 * 1:1 mapping between the bit position and the IRQ number.
39 *
40 * This careful constructions allows ilsel_enable*() to be referenced
41 * directly for hooking up an ILSEL set and getting back an IRQ which can
42 * subsequently be used for internal accounting in the (optional) disable
43 * path.
44 */
45static unsigned long ilsel_level_map;
46
47static inline unsigned int ilsel_offset(unsigned int bit)
48{
49 return ILSEL_LEVELS - bit - 1;
50}
51
52static inline unsigned long mk_ilsel_addr(unsigned int bit)
53{
54 return ILSEL_BASE + ((ilsel_offset(bit) >> 1) & ~0x1);
55}
56
57static inline unsigned int mk_ilsel_shift(unsigned int bit)
58{
59 return (ilsel_offset(bit) & 0x3) << 2;
60}
61
62static void __ilsel_enable(ilsel_source_t set, unsigned int bit)
63{
64 unsigned int tmp, shift;
65 unsigned long addr;
66
67 addr = mk_ilsel_addr(bit);
68 shift = mk_ilsel_shift(bit);
69
70 pr_debug("%s: bit#%d: addr - 0x%08lx (shift %d, set %d)\n",
71 __FUNCTION__, bit, addr, shift, set);
72
73 tmp = ctrl_inw(addr);
74 tmp &= ~(0xf << shift);
75 tmp |= set << shift;
76 ctrl_outw(tmp, addr);
77}
78
79/**
80 * ilsel_enable - Enable an ILSEL set.
81 * @set: ILSEL source (see ilsel_source_t enum in include/asm-sh/ilsel.h).
82 *
83 * Enables a given non-aliased ILSEL source (<= ILSEL_KEY) at the highest
84 * available interrupt level. Callers should take care to order callsites
85 * noting descending interrupt levels. Aliasing FPGA and external board
86 * IRQs need to use ilsel_enable_fixed().
87 *
88 * The return value is an IRQ number that can later be taken down with
89 * ilsel_disable().
90 */
91int ilsel_enable(ilsel_source_t set)
92{
93 unsigned int bit;
94
95 /* Aliased sources must use ilsel_enable_fixed() */
96 BUG_ON(set > ILSEL_KEY);
97
98 do {
99 bit = find_first_zero_bit(&ilsel_level_map, ILSEL_LEVELS);
100 } while (test_and_set_bit(bit, &ilsel_level_map));
101
102 __ilsel_enable(set, bit);
103
104 return bit;
105}
106EXPORT_SYMBOL_GPL(ilsel_enable);
107
108/**
109 * ilsel_enable_fixed - Enable an ILSEL set at a fixed interrupt level
110 * @set: ILSEL source (see ilsel_source_t enum in include/asm-sh/ilsel.h).
111 * @level: Interrupt level (1 - 15)
112 *
113 * Enables a given ILSEL source at a fixed interrupt level. Necessary
114 * both for level reservation as well as for aliased sources that only
115 * exist on special ILSEL#s.
116 *
117 * Returns an IRQ number (as ilsel_enable()).
118 */
119int ilsel_enable_fixed(ilsel_source_t set, unsigned int level)
120{
121 unsigned int bit = ilsel_offset(level - 1);
122
123 if (test_and_set_bit(bit, &ilsel_level_map))
124 return -EBUSY;
125
126 __ilsel_enable(set, bit);
127
128 return bit;
129}
130EXPORT_SYMBOL_GPL(ilsel_enable_fixed);
131
132/**
133 * ilsel_disable - Disable an ILSEL set
134 * @irq: Bit position for ILSEL set value (retval from enable routines)
135 *
136 * Disable a previously enabled ILSEL set.
137 */
138void ilsel_disable(unsigned int irq)
139{
140 unsigned long addr;
141 unsigned int tmp;
142
143 addr = mk_ilsel_addr(irq);
144
145 tmp = ctrl_inw(addr);
146 tmp &= ~(0xf << mk_ilsel_shift(irq));
147 ctrl_outw(tmp, addr);
148
149 clear_bit(irq, &ilsel_level_map);
150}
151EXPORT_SYMBOL_GPL(ilsel_disable);
diff --git a/arch/sh/boards/renesas/x3proto/setup.c b/arch/sh/boards/renesas/x3proto/setup.c
new file mode 100644
index 000000000000..abc5b6d418fe
--- /dev/null
+++ b/arch/sh/boards/renesas/x3proto/setup.c
@@ -0,0 +1,136 @@
1/*
2 * arch/sh/boards/renesas/x3proto/setup.c
3 *
4 * Renesas SH-X3 Prototype Board Support.
5 *
6 * Copyright (C) 2007 Paul Mundt
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/kernel.h>
15#include <linux/io.h>
16#include <asm/ilsel.h>
17
18static struct resource heartbeat_resources[] = {
19 [0] = {
20 .start = 0xb8140020,
21 .end = 0xb8140020,
22 .flags = IORESOURCE_MEM,
23 },
24};
25
26static struct platform_device heartbeat_device = {
27 .name = "heartbeat",
28 .id = -1,
29 .num_resources = ARRAY_SIZE(heartbeat_resources),
30 .resource = heartbeat_resources,
31};
32
33static struct resource smc91x_resources[] = {
34 [0] = {
35 .start = 0x18000300,
36 .end = 0x18000300 + 0x10 - 1,
37 .flags = IORESOURCE_MEM,
38 },
39 [1] = {
40 /* Filled in by ilsel */
41 .flags = IORESOURCE_IRQ,
42 },
43};
44
45static struct platform_device smc91x_device = {
46 .name = "smc91x",
47 .id = -1,
48 .resource = smc91x_resources,
49 .num_resources = ARRAY_SIZE(smc91x_resources),
50};
51
52static struct resource r8a66597_usb_host_resources[] = {
53 [0] = {
54 .name = "r8a66597_hcd",
55 .start = 0x18040000,
56 .end = 0x18080000 - 1,
57 .flags = IORESOURCE_MEM,
58 },
59 [1] = {
60 .name = "r8a66597_hcd",
61 /* Filled in by ilsel */
62 .flags = IORESOURCE_IRQ,
63 },
64};
65
66static struct platform_device r8a66597_usb_host_device = {
67 .name = "r8a66597_hcd",
68 .id = -1,
69 .dev = {
70 .dma_mask = NULL, /* don't use dma */
71 .coherent_dma_mask = 0xffffffff,
72 },
73 .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources),
74 .resource = r8a66597_usb_host_resources,
75};
76
77static struct resource m66592_usb_peripheral_resources[] = {
78 [0] = {
79 .name = "m66592_udc",
80 .start = 0x18080000,
81 .end = 0x180c0000 - 1,
82 .flags = IORESOURCE_MEM,
83 },
84 [1] = {
85 .name = "m66592_udc",
86 /* Filled in by ilsel */
87 .flags = IORESOURCE_IRQ,
88 },
89};
90
91static struct platform_device m66592_usb_peripheral_device = {
92 .name = "m66592_udc",
93 .id = -1,
94 .dev = {
95 .dma_mask = NULL, /* don't use dma */
96 .coherent_dma_mask = 0xffffffff,
97 },
98 .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources),
99 .resource = m66592_usb_peripheral_resources,
100};
101
102static struct platform_device *x3proto_devices[] __initdata = {
103 &heartbeat_device,
104 &smc91x_device,
105 &r8a66597_usb_host_device,
106 &m66592_usb_peripheral_device,
107};
108
109static int __init x3proto_devices_setup(void)
110{
111 r8a66597_usb_host_resources[1].start =
112 r8a66597_usb_host_resources[1].end = ilsel_enable(ILSEL_USBH_I);
113
114 m66592_usb_peripheral_resources[1].start =
115 m66592_usb_peripheral_resources[1].end = ilsel_enable(ILSEL_USBP_I);
116
117 smc91x_resources[1].start =
118 smc91x_resources[1].end = ilsel_enable(ILSEL_LAN);
119
120 return platform_add_devices(x3proto_devices,
121 ARRAY_SIZE(x3proto_devices));
122}
123device_initcall(x3proto_devices_setup);
124
125static void __init x3proto_init_irq(void)
126{
127 plat_irq_setup_pins(IRQ_MODE_IRL3210);
128
129 /* Set ICR0.LVLMODE */
130 ctrl_outl(ctrl_inl(0xfe410000) | (1 << 21), 0xfe410000);
131}
132
133static struct sh_machine_vector mv_x3proto __initmv = {
134 .mv_name = "x3proto",
135 .mv_init_irq = x3proto_init_irq,
136};
diff --git a/arch/sh/boards/se/7206/io.c b/arch/sh/boards/se/7206/io.c
index b557273e0cbe..1308e618e044 100644
--- a/arch/sh/boards/se/7206/io.c
+++ b/arch/sh/boards/se/7206/io.c
@@ -26,22 +26,24 @@ static inline void delay(void)
26static inline volatile __u16 * 26static inline volatile __u16 *
27port2adr(unsigned int port) 27port2adr(unsigned int port)
28{ 28{
29 if (port >= 0x2000) 29 if (port >= 0x2000 && port < 0x2020)
30 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000)); 30 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
31 else if (port >= 0x300 || port < 0x310) 31 else if (port >= 0x300 && port < 0x310)
32 return (volatile __u16 *) (PA_SMSC + (port - 0x300)); 32 return (volatile __u16 *) (PA_SMSC + (port - 0x300));
33
34 return (volatile __u16 *)port;
33} 35}
34 36
35unsigned char se7206_inb(unsigned long port) 37unsigned char se7206_inb(unsigned long port)
36{ 38{
37 return (*port2adr(port))&0xff; 39 return (*port2adr(port)) & 0xff;
38} 40}
39 41
40unsigned char se7206_inb_p(unsigned long port) 42unsigned char se7206_inb_p(unsigned long port)
41{ 43{
42 unsigned long v; 44 unsigned long v;
43 45
44 v = (*port2adr(port))&0xff; 46 v = (*port2adr(port)) & 0xff;
45 delay(); 47 delay();
46 return v; 48 return v;
47} 49}
@@ -51,12 +53,6 @@ unsigned short se7206_inw(unsigned long port)
51 return *port2adr(port);; 53 return *port2adr(port);;
52} 54}
53 55
54unsigned int se7206_inl(unsigned long port)
55{
56 maybebadio(port);
57 return 0;
58}
59
60void se7206_outb(unsigned char value, unsigned long port) 56void se7206_outb(unsigned char value, unsigned long port)
61{ 57{
62 *(port2adr(port)) = value; 58 *(port2adr(port)) = value;
@@ -73,11 +69,6 @@ void se7206_outw(unsigned short value, unsigned long port)
73 *port2adr(port) = value; 69 *port2adr(port) = value;
74} 70}
75 71
76void se7206_outl(unsigned int value, unsigned long port)
77{
78 maybebadio(port);
79}
80
81void se7206_insb(unsigned long port, void *addr, unsigned long count) 72void se7206_insb(unsigned long port, void *addr, unsigned long count)
82{ 73{
83 volatile __u16 *p = port2adr(port); 74 volatile __u16 *p = port2adr(port);
@@ -95,11 +86,6 @@ void se7206_insw(unsigned long port, void *addr, unsigned long count)
95 *ap++ = *p; 86 *ap++ = *p;
96} 87}
97 88
98void se7206_insl(unsigned long port, void *addr, unsigned long count)
99{
100 maybebadio(port);
101}
102
103void se7206_outsb(unsigned long port, const void *addr, unsigned long count) 89void se7206_outsb(unsigned long port, const void *addr, unsigned long count)
104{ 90{
105 volatile __u16 *p = port2adr(port); 91 volatile __u16 *p = port2adr(port);
@@ -116,8 +102,3 @@ void se7206_outsw(unsigned long port, const void *addr, unsigned long count)
116 while (count--) 102 while (count--)
117 *p = *ap++; 103 *p = *ap++;
118} 104}
119
120void se7206_outsl(unsigned long port, const void *addr, unsigned long count)
121{
122 maybebadio(port);
123}
diff --git a/arch/sh/boards/se/7206/setup.c b/arch/sh/boards/se/7206/setup.c
index a074b62505ef..5b3ee089d91d 100644
--- a/arch/sh/boards/se/7206/setup.c
+++ b/arch/sh/boards/se/7206/setup.c
@@ -6,14 +6,13 @@
6 * Copyright (C) 2007 Paul Mundt 6 * Copyright (C) 2007 Paul Mundt
7 * 7 *
8 * Hitachi 7206 SolutionEngine Support. 8 * Hitachi 7206 SolutionEngine Support.
9 *
10 */ 9 */
11
12#include <linux/init.h> 10#include <linux/init.h>
13#include <linux/platform_device.h> 11#include <linux/platform_device.h>
14#include <asm/se7206.h> 12#include <asm/se7206.h>
15#include <asm/io.h> 13#include <asm/io.h>
16#include <asm/machvec.h> 14#include <asm/machvec.h>
15#include <asm/heartbeat.h>
17 16
18static struct resource smc91x_resources[] = { 17static struct resource smc91x_resources[] = {
19 [0] = { 18 [0] = {
@@ -37,10 +36,16 @@ static struct platform_device smc91x_device = {
37 36
38static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 }; 37static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
39 38
39static struct heartbeat_data heartbeat_data = {
40 .bit_pos = heartbeat_bit_pos,
41 .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
42 .regsize = 32,
43};
44
40static struct resource heartbeat_resources[] = { 45static struct resource heartbeat_resources[] = {
41 [0] = { 46 [0] = {
42 .start = PA_LED, 47 .start = PA_LED,
43 .end = PA_LED + ARRAY_SIZE(heartbeat_bit_pos) - 1, 48 .end = PA_LED,
44 .flags = IORESOURCE_MEM, 49 .flags = IORESOURCE_MEM,
45 }, 50 },
46}; 51};
@@ -49,7 +54,7 @@ static struct platform_device heartbeat_device = {
49 .name = "heartbeat", 54 .name = "heartbeat",
50 .id = -1, 55 .id = -1,
51 .dev = { 56 .dev = {
52 .platform_data = heartbeat_bit_pos, 57 .platform_data = &heartbeat_data,
53 }, 58 },
54 .num_resources = ARRAY_SIZE(heartbeat_resources), 59 .num_resources = ARRAY_SIZE(heartbeat_resources),
55 .resource = heartbeat_resources, 60 .resource = heartbeat_resources,
@@ -75,24 +80,18 @@ static struct sh_machine_vector mv_se __initmv = {
75 .mv_nr_irqs = 256, 80 .mv_nr_irqs = 256,
76 .mv_inb = se7206_inb, 81 .mv_inb = se7206_inb,
77 .mv_inw = se7206_inw, 82 .mv_inw = se7206_inw,
78 .mv_inl = se7206_inl,
79 .mv_outb = se7206_outb, 83 .mv_outb = se7206_outb,
80 .mv_outw = se7206_outw, 84 .mv_outw = se7206_outw,
81 .mv_outl = se7206_outl,
82 85
83 .mv_inb_p = se7206_inb_p, 86 .mv_inb_p = se7206_inb_p,
84 .mv_inw_p = se7206_inw, 87 .mv_inw_p = se7206_inw,
85 .mv_inl_p = se7206_inl,
86 .mv_outb_p = se7206_outb_p, 88 .mv_outb_p = se7206_outb_p,
87 .mv_outw_p = se7206_outw, 89 .mv_outw_p = se7206_outw,
88 .mv_outl_p = se7206_outl,
89 90
90 .mv_insb = se7206_insb, 91 .mv_insb = se7206_insb,
91 .mv_insw = se7206_insw, 92 .mv_insw = se7206_insw,
92 .mv_insl = se7206_insl,
93 .mv_outsb = se7206_outsb, 93 .mv_outsb = se7206_outsb,
94 .mv_outsw = se7206_outsw, 94 .mv_outsw = se7206_outsw,
95 .mv_outsl = se7206_outsl,
96 95
97 .mv_init_irq = init_se7206_IRQ, 96 .mv_init_irq = init_se7206_IRQ,
98}; 97};
diff --git a/arch/sh/boards/se/7343/irq.c b/arch/sh/boards/se/7343/irq.c
index 360153ecc55b..763f6deba814 100644
--- a/arch/sh/boards/se/7343/irq.c
+++ b/arch/sh/boards/se/7343/irq.c
@@ -99,8 +99,11 @@ shmse_irq_demux(int irq)
99 * 99 *
100 * We configure IRQ5 as a cascade IRQ. 100 * We configure IRQ5 as a cascade IRQ.
101 */ 101 */
102static struct irqaction irq5 = { no_action, 0, CPU_MASK_NONE, "IRQ5-cascade", 102static struct irqaction irq5 = {
103 NULL, NULL}; 103 .handler = no_action,
104 .mask = CPU_MASK_NONE,
105 .name = "IRQ5-cascade",
106};
104 107
105static struct ipr_data se7343_irq5_ipr_map[] = { 108static struct ipr_data se7343_irq5_ipr_map[] = {
106 { IRQ5_IRQ, IRQ5_IPR_ADDR+2, IRQ5_IPR_POS, IRQ5_PRIORITY }, 109 { IRQ5_IRQ, IRQ5_IPR_ADDR+2, IRQ5_IPR_POS, IRQ5_PRIORITY },
diff --git a/arch/sh/boards/se/7343/setup.c b/arch/sh/boards/se/7343/setup.c
index 8fec155e2ff7..c9431b3a051b 100644
--- a/arch/sh/boards/se/7343/setup.c
+++ b/arch/sh/boards/se/7343/setup.c
@@ -33,7 +33,7 @@ static struct platform_device smc91x_device = {
33static struct resource heartbeat_resources[] = { 33static struct resource heartbeat_resources[] = {
34 [0] = { 34 [0] = {
35 .start = PA_LED, 35 .start = PA_LED,
36 .end = PA_LED + 8 - 1, 36 .end = PA_LED,
37 .flags = IORESOURCE_MEM, 37 .flags = IORESOURCE_MEM,
38 }, 38 },
39}; 39};
diff --git a/arch/sh/boards/se/770x/setup.c b/arch/sh/boards/se/770x/setup.c
index 2962da148f3f..d07a3368f546 100644
--- a/arch/sh/boards/se/770x/setup.c
+++ b/arch/sh/boards/se/770x/setup.c
@@ -12,6 +12,7 @@
12#include <asm/se.h> 12#include <asm/se.h>
13#include <asm/io.h> 13#include <asm/io.h>
14#include <asm/smc37c93x.h> 14#include <asm/smc37c93x.h>
15#include <asm/heartbeat.h>
15 16
16void init_se_IRQ(void); 17void init_se_IRQ(void);
17 18
@@ -90,10 +91,15 @@ static struct platform_device cf_ide_device = {
90 91
91static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 }; 92static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
92 93
94static struct heartbeat_data heartbeat_data = {
95 .bit_pos = heartbeat_bit_pos,
96 .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
97};
98
93static struct resource heartbeat_resources[] = { 99static struct resource heartbeat_resources[] = {
94 [0] = { 100 [0] = {
95 .start = PA_LED, 101 .start = PA_LED,
96 .end = PA_LED + ARRAY_SIZE(heartbeat_bit_pos) - 1, 102 .end = PA_LED,
97 .flags = IORESOURCE_MEM, 103 .flags = IORESOURCE_MEM,
98 }, 104 },
99}; 105};
@@ -102,7 +108,7 @@ static struct platform_device heartbeat_device = {
102 .name = "heartbeat", 108 .name = "heartbeat",
103 .id = -1, 109 .id = -1,
104 .dev = { 110 .dev = {
105 .platform_data = heartbeat_bit_pos, 111 .platform_data = &heartbeat_data,
106 }, 112 },
107 .num_resources = ARRAY_SIZE(heartbeat_resources), 113 .num_resources = ARRAY_SIZE(heartbeat_resources),
108 .resource = heartbeat_resources, 114 .resource = heartbeat_resources,
diff --git a/arch/sh/boards/se/7722/setup.c b/arch/sh/boards/se/7722/setup.c
index 495fc7e2b60f..03b63457e178 100644
--- a/arch/sh/boards/se/7722/setup.c
+++ b/arch/sh/boards/se/7722/setup.c
@@ -18,12 +18,10 @@
18#include <asm/io.h> 18#include <asm/io.h>
19 19
20/* Heartbeat */ 20/* Heartbeat */
21static unsigned char heartbeat_bit_pos[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
22
23static struct resource heartbeat_resources[] = { 21static struct resource heartbeat_resources[] = {
24 [0] = { 22 [0] = {
25 .start = PA_LED, 23 .start = PA_LED,
26 .end = PA_LED + ARRAY_SIZE(heartbeat_bit_pos) - 1, 24 .end = PA_LED,
27 .flags = IORESOURCE_MEM, 25 .flags = IORESOURCE_MEM,
28 }, 26 },
29}; 27};
@@ -31,9 +29,6 @@ static struct resource heartbeat_resources[] = {
31static struct platform_device heartbeat_device = { 29static struct platform_device heartbeat_device = {
32 .name = "heartbeat", 30 .name = "heartbeat",
33 .id = -1, 31 .id = -1,
34 .dev = {
35 .platform_data = heartbeat_bit_pos,
36 },
37 .num_resources = ARRAY_SIZE(heartbeat_resources), 32 .num_resources = ARRAY_SIZE(heartbeat_resources),
38 .resource = heartbeat_resources, 33 .resource = heartbeat_resources,
39}; 34};
@@ -109,7 +104,7 @@ static void __init se7722_setup(char **cmdline_p)
109 ctrl_outl(0x00051001, MSTPCR0); 104 ctrl_outl(0x00051001, MSTPCR0);
110 ctrl_outl(0x00000000, MSTPCR1); 105 ctrl_outl(0x00000000, MSTPCR1);
111 /* KEYSC, VOU, BEU, CEU, VEU, VPU, LCDC */ 106 /* KEYSC, VOU, BEU, CEU, VEU, VPU, LCDC */
112 ctrl_outl(0xffffbfC0, MSTPCR2); 107 ctrl_outl(0xffffbfC0, MSTPCR2);
113 108
114 ctrl_outw(0x0000, PORT_PECR); /* PORT E 1 = IRQ5 ,E 0 = BS */ 109 ctrl_outw(0x0000, PORT_PECR); /* PORT E 1 = IRQ5 ,E 0 = BS */
115 ctrl_outw(0x1000, PORT_PJCR); /* PORT J 1 = IRQ1,J 0 =IRQ0 */ 110 ctrl_outw(0x1000, PORT_PJCR); /* PORT J 1 = IRQ1,J 0 =IRQ0 */
diff --git a/arch/sh/boards/se/7751/setup.c b/arch/sh/boards/se/7751/setup.c
index 7873d07e40c1..deefbfd92591 100644
--- a/arch/sh/boards/se/7751/setup.c
+++ b/arch/sh/boards/se/7751/setup.c
@@ -13,13 +13,19 @@
13#include <asm/machvec.h> 13#include <asm/machvec.h>
14#include <asm/se7751.h> 14#include <asm/se7751.h>
15#include <asm/io.h> 15#include <asm/io.h>
16#include <asm/heartbeat.h>
16 17
17static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 }; 18static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
18 19
20static struct heartbeat_data heartbeat_data = {
21 .bit_pos = heartbeat_bit_pos,
22 .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
23};
24
19static struct resource heartbeat_resources[] = { 25static struct resource heartbeat_resources[] = {
20 [0] = { 26 [0] = {
21 .start = PA_LED, 27 .start = PA_LED,
22 .end = PA_LED + ARRAY_SIZE(heartbeat_bit_pos) - 1, 28 .end = PA_LED,
23 .flags = IORESOURCE_MEM, 29 .flags = IORESOURCE_MEM,
24 }, 30 },
25}; 31};
@@ -28,14 +34,13 @@ static struct platform_device heartbeat_device = {
28 .name = "heartbeat", 34 .name = "heartbeat",
29 .id = -1, 35 .id = -1,
30 .dev = { 36 .dev = {
31 .platform_data = heartbeat_bit_pos, 37 .platform_data = &heartbeat_data,
32 }, 38 },
33 .num_resources = ARRAY_SIZE(heartbeat_resources), 39 .num_resources = ARRAY_SIZE(heartbeat_resources),
34 .resource = heartbeat_resources, 40 .resource = heartbeat_resources,
35}; 41};
36 42
37static struct platform_device *se7751_devices[] __initdata = { 43static struct platform_device *se7751_devices[] __initdata = {
38 &smc91x_device,
39 &heartbeat_device, 44 &heartbeat_device,
40}; 45};
41 46
diff --git a/arch/sh/boards/se/7780/irq.c b/arch/sh/boards/se/7780/irq.c
index 874914746009..6bd70da6bb47 100644
--- a/arch/sh/boards/se/7780/irq.c
+++ b/arch/sh/boards/se/7780/irq.c
@@ -16,32 +16,6 @@
16#include <asm/io.h> 16#include <asm/io.h>
17#include <asm/se7780.h> 17#include <asm/se7780.h>
18 18
19static struct intc2_data intc2_irq_table[] = {
20 { 2, 0, 31, 0, 31, 3 }, /* daughter board EXTINT1 */
21 { 4, 0, 30, 0, 30, 3 }, /* daughter board EXTINT2 */
22 { 6, 0, 29, 0, 29, 3 }, /* daughter board EXTINT3 */
23 { 8, 0, 28, 0, 28, 3 }, /* SMC 91C111 (LAN) */
24 { 10, 0, 27, 0, 27, 3 }, /* daughter board EXTINT4 */
25 { 4, 0, 30, 0, 30, 3 }, /* daughter board EXTINT5 */
26 { 2, 0, 31, 0, 31, 3 }, /* daughter board EXTINT6 */
27 { 2, 0, 31, 0, 31, 3 }, /* daughter board EXTINT7 */
28 { 2, 0, 31, 0, 31, 3 }, /* daughter board EXTINT8 */
29 { 0 , 0, 24, 0, 24, 3 }, /* SM501 */
30};
31
32static struct intc2_desc intc2_irq_desc __read_mostly = {
33 .prio_base = 0, /* N/A */
34 .msk_base = 0xffd00044,
35 .mskclr_base = 0xffd00064,
36
37 .intc2_data = intc2_irq_table,
38 .nr_irqs = ARRAY_SIZE(intc2_irq_table),
39
40 .chip = {
41 .name = "INTC2-se7780",
42 },
43};
44
45/* 19/*
46 * Initialize IRQ setting 20 * Initialize IRQ setting
47 */ 21 */
@@ -68,5 +42,5 @@ void __init init_se7780_IRQ(void)
68 /* FPGA + 0x0A */ 42 /* FPGA + 0x0A */
69 ctrl_outw((IRQPIN_PCCPW << IRQPOS_PCCPW), FPGA_INTSEL3); 43 ctrl_outw((IRQPIN_PCCPW << IRQPOS_PCCPW), FPGA_INTSEL3);
70 44
71 register_intc2_controller(&intc2_irq_desc); 45 plat_irq_setup_pins(IRQ_MODE_IRQ); /* install handlers for IRQ0-7 */
72} 46}
diff --git a/arch/sh/boards/se/7780/setup.c b/arch/sh/boards/se/7780/setup.c
index 723f2fd4d55b..76e53b26a808 100644
--- a/arch/sh/boards/se/7780/setup.c
+++ b/arch/sh/boards/se/7780/setup.c
@@ -16,12 +16,10 @@
16#include <asm/io.h> 16#include <asm/io.h>
17 17
18/* Heartbeat */ 18/* Heartbeat */
19static unsigned char heartbeat_bit_pos[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
20
21static struct resource heartbeat_resources[] = { 19static struct resource heartbeat_resources[] = {
22 [0] = { 20 [0] = {
23 .start = PA_LED, 21 .start = PA_LED,
24 .end = PA_LED + ARRAY_SIZE(heartbeat_bit_pos) - 1, 22 .end = PA_LED,
25 .flags = IORESOURCE_MEM, 23 .flags = IORESOURCE_MEM,
26 }, 24 },
27}; 25};
@@ -29,9 +27,6 @@ static struct resource heartbeat_resources[] = {
29static struct platform_device heartbeat_device = { 27static struct platform_device heartbeat_device = {
30 .name = "heartbeat", 28 .name = "heartbeat",
31 .id = -1, 29 .id = -1,
32 .dev = {
33 .platform_data = heartbeat_bit_pos,
34 },
35 .num_resources = ARRAY_SIZE(heartbeat_resources), 30 .num_resources = ARRAY_SIZE(heartbeat_resources),
36 .resource = heartbeat_resources, 31 .resource = heartbeat_resources,
37}; 32};
diff --git a/arch/sh/boards/sh03/setup.c b/arch/sh/boards/sh03/setup.c
index 9c031a8c0a1c..934ac4f1c48f 100644
--- a/arch/sh/boards/sh03/setup.c
+++ b/arch/sh/boards/sh03/setup.c
@@ -15,33 +15,9 @@
15#include <asm/sh03/sh03.h> 15#include <asm/sh03/sh03.h>
16#include <asm/addrspace.h> 16#include <asm/addrspace.h>
17 17
18static struct ipr_data ipr_irq_table[] = {
19 { IRL0_IRQ, 0, IRL0_IPR_POS, IRL0_PRIORITY },
20 { IRL1_IRQ, 0, IRL1_IPR_POS, IRL1_PRIORITY },
21 { IRL2_IRQ, 0, IRL2_IPR_POS, IRL2_PRIORITY },
22 { IRL3_IRQ, 0, IRL3_IPR_POS, IRL3_PRIORITY },
23};
24
25static unsigned long ipr_offsets[] = {
26 INTC_IPRD,
27};
28
29static struct ipr_desc ipr_irq_desc = {
30 .ipr_offsets = ipr_offsets,
31 .nr_offsets = ARRAY_SIZE(ipr_offsets),
32
33 .ipr_data = ipr_irq_table,
34 .nr_irqs = ARRAY_SIZE(ipr_irq_table),
35
36 .chip = {
37 .name = "IPR-sh03",
38 },
39};
40
41static void __init init_sh03_IRQ(void) 18static void __init init_sh03_IRQ(void)
42{ 19{
43 ctrl_outw(ctrl_inw(INTC_ICR) | INTC_ICR_IRLM, INTC_ICR); 20 plat_irq_setup_pins(IRQ_MODE_IRQ);
44 register_ipr_controller(&ipr_irq_desc);
45} 21}
46 22
47extern void *cf_io_base; 23extern void *cf_io_base;
@@ -68,7 +44,7 @@ static void __init sh03_setup(char **cmdline_p)
68static struct resource heartbeat_resources[] = { 44static struct resource heartbeat_resources[] = {
69 [0] = { 45 [0] = {
70 .start = 0xa0800000, 46 .start = 0xa0800000,
71 .end = 0xa0800000 + 8 - 1, 47 .end = 0xa0800000,
72 .flags = IORESOURCE_MEM, 48 .flags = IORESOURCE_MEM,
73 }, 49 },
74}; 50};
diff --git a/arch/sh/boards/shmin/setup.c b/arch/sh/boards/shmin/setup.c
index dfd124509f42..16e5dae8ecfb 100644
--- a/arch/sh/boards/shmin/setup.c
+++ b/arch/sh/boards/shmin/setup.c
@@ -14,36 +14,12 @@
14 14
15#define PFC_PHCR 0xa400010eUL 15#define PFC_PHCR 0xa400010eUL
16#define INTC_ICR1 0xa4000010UL 16#define INTC_ICR1 0xa4000010UL
17#define INTC_IPRC 0xa4000016UL
18
19static struct ipr_data ipr_irq_table[] = {
20 { 32, 0, 0, 0 },
21 { 33, 0, 4, 0 },
22 { 34, 0, 8, 8 },
23 { 35, 0, 12, 0 },
24};
25
26static unsigned long ipr_offsets[] = {
27 INTC_IPRC,
28};
29
30static struct ipr_desc ipr_irq_desc = {
31 .ipr_offsets = ipr_offsets,
32 .nr_offsets = ARRAY_SIZE(ipr_offsets),
33
34 .ipr_data = ipr_irq_table,
35 .nr_irqs = ARRAY_SIZE(ipr_irq_table),
36
37 .chip = {
38 .name = "IPR-shmin",
39 },
40};
41 17
42static void __init init_shmin_irq(void) 18static void __init init_shmin_irq(void)
43{ 19{
44 ctrl_outw(0x2a00, PFC_PHCR); // IRQ0-3=IRQ 20 ctrl_outw(0x2a00, PFC_PHCR); // IRQ0-3=IRQ
45 ctrl_outw(0x0aaa, INTC_ICR1); // IRQ0-3=IRQ-mode,Low-active. 21 ctrl_outw(0x0aaa, INTC_ICR1); // IRQ0-3=IRQ-mode,Low-active.
46 register_ipr_controller(&ipr_irq_desc); 22 plat_irq_setup_pins(IRQ_MODE_IRQ);
47} 23}
48 24
49static void __iomem *shmin_ioport_map(unsigned long port, unsigned int size) 25static void __iomem *shmin_ioport_map(unsigned long port, unsigned int size)
diff --git a/arch/sh/boards/snapgear/setup.c b/arch/sh/boards/snapgear/setup.c
index 84271d85a8dd..2b594f600002 100644
--- a/arch/sh/boards/snapgear/setup.c
+++ b/arch/sh/boards/snapgear/setup.c
@@ -68,37 +68,11 @@ module_init(eraseconfig_init);
68 * IRL3 = crypto 68 * IRL3 = crypto
69 */ 69 */
70 70
71static struct ipr_data ipr_irq_table[] = {
72 { IRL0_IRQ, 0, IRL0_IPR_POS, IRL0_PRIORITY },
73 { IRL1_IRQ, 0, IRL1_IPR_POS, IRL1_PRIORITY },
74 { IRL2_IRQ, 0, IRL2_IPR_POS, IRL2_PRIORITY },
75 { IRL3_IRQ, 0, IRL3_IPR_POS, IRL3_PRIORITY },
76};
77
78static unsigned long ipr_offsets[] = {
79 INTC_IPRD,
80};
81
82static struct ipr_desc ipr_irq_desc = {
83 .ipr_offsets = ipr_offsets,
84 .nr_offsets = ARRAY_SIZE(ipr_offsets),
85
86 .ipr_data = ipr_irq_table,
87 .nr_irqs = ARRAY_SIZE(ipr_irq_table),
88
89 .chip = {
90 .name = "IPR-snapgear",
91 },
92};
93
94static void __init init_snapgear_IRQ(void) 71static void __init init_snapgear_IRQ(void)
95{ 72{
96 /* enable individual interrupt mode for externals */
97 ctrl_outw(ctrl_inw(INTC_ICR) | INTC_ICR_IRLM, INTC_ICR);
98
99 printk("Setup SnapGear IRQ/IPR ...\n"); 73 printk("Setup SnapGear IRQ/IPR ...\n");
100 74 /* enable individual interrupt mode for externals */
101 register_ipr_controller(&ipr_irq_desc); 75 plat_irq_setup_pins(IRQ_MODE_IRQ);
102} 76}
103 77
104/* 78/*
diff --git a/arch/sh/boards/titan/setup.c b/arch/sh/boards/titan/setup.c
index 606d25a4b870..5de3b2ad71af 100644
--- a/arch/sh/boards/titan/setup.c
+++ b/arch/sh/boards/titan/setup.c
@@ -12,38 +12,10 @@
12#include <asm/titan.h> 12#include <asm/titan.h>
13#include <asm/io.h> 13#include <asm/io.h>
14 14
15static struct ipr_data ipr_irq_table[] = {
16 /* IRQ, IPR idx, shift, prio */
17 { TITAN_IRQ_WAN, 3, 12, 8 }, /* eth0 (WAN) */
18 { TITAN_IRQ_LAN, 3, 8, 8 }, /* eth1 (LAN) */
19 { TITAN_IRQ_MPCIA, 3, 4, 8 }, /* mPCI A (top) */
20 { TITAN_IRQ_USB, 3, 0, 8 }, /* mPCI B (bottom), USB */
21};
22
23static unsigned long ipr_offsets[] = { /* stolen from setup-sh7750.c */
24 0xffd00004UL, /* 0: IPRA */
25 0xffd00008UL, /* 1: IPRB */
26 0xffd0000cUL, /* 2: IPRC */
27 0xffd00010UL, /* 3: IPRD */
28};
29
30static struct ipr_desc ipr_irq_desc = {
31 .ipr_offsets = ipr_offsets,
32 .nr_offsets = ARRAY_SIZE(ipr_offsets),
33
34 .ipr_data = ipr_irq_table,
35 .nr_irqs = ARRAY_SIZE(ipr_irq_table),
36
37 .chip = {
38 .name = "IPR-titan",
39 },
40};
41static void __init init_titan_irq(void) 15static void __init init_titan_irq(void)
42{ 16{
43 /* enable individual interrupt mode for externals */ 17 /* enable individual interrupt mode for externals */
44 ipr_irq_enable_irlm(); 18 plat_irq_setup_pins(IRQ_MODE_IRQ);
45 /* register ipr irqs */
46 register_ipr_controller(&ipr_irq_desc);
47} 19}
48 20
49static struct sh_machine_vector mv_titan __initmv = { 21static struct sh_machine_vector mv_titan __initmv = {
diff --git a/arch/sh/cchips/Kconfig b/arch/sh/cchips/Kconfig
index 2e516e9a6ede..7892361eedc8 100644
--- a/arch/sh/cchips/Kconfig
+++ b/arch/sh/cchips/Kconfig
@@ -1,18 +1,5 @@
1menu "Companion Chips" 1menu "Companion Chips"
2 2
3config VOYAGERGX
4 bool "VoyagerGX chip support"
5 depends on SH_RTS7751R2D
6 help
7 Selecting this option will support Silicon Motion, Inc. SM501.
8 Designed to complement needs for the embedded industry, it
9 provides video and 2D capability. To reduce system cost a
10 wide variety of include I/O is supported, including analog RGB
11 and digital LCD Panel interface, 8-bit parallel interface, USB,
12 UART, IrDA, Zoom Video, AC97 or I2S, SSP, PWM, and I2C. There
13 are additional GPIO bits that can be used to interface to
14 external as well.
15
16config HD6446X_SERIES 3config HD6446X_SERIES
17 bool 4 bool
18 5
diff --git a/arch/sh/cchips/hd6446x/hd64461.c b/arch/sh/cchips/hd6446x/hd64461.c
index 97f6512aa1b7..f1a4a0763c59 100644
--- a/arch/sh/cchips/hd6446x/hd64461.c
+++ b/arch/sh/cchips/hd6446x/hd64461.c
@@ -14,6 +14,9 @@
14#include <asm/irq.h> 14#include <asm/irq.h>
15#include <asm/hd64461.h> 15#include <asm/hd64461.h>
16 16
17/* This belongs in cpu specific */
18#define INTC_ICR1 0xA4140010UL
19
17static void disable_hd64461_irq(unsigned int irq) 20static void disable_hd64461_irq(unsigned int irq)
18{ 21{
19 unsigned short nimr; 22 unsigned short nimr;
@@ -121,10 +124,15 @@ int hd64461_irq_demux(int irq)
121 } 124 }
122 } 125 }
123 } 126 }
124 return __irq_demux(irq); 127 return irq;
125} 128}
126 129
127static struct irqaction irq0 = { hd64461_interrupt, IRQF_DISABLED, CPU_MASK_NONE, "HD64461", NULL, NULL }; 130static struct irqaction irq0 = {
131 .handler = hd64461_interrupt,
132 .flags = IRQF_DISABLED,
133 .mask = CPU_MASK_NONE,
134 .name = "HD64461",
135};
128 136
129int __init setup_hd64461(void) 137int __init setup_hd64461(void)
130{ 138{
@@ -143,6 +151,7 @@ int __init setup_hd64461(void)
143#endif 151#endif
144 outw(0xffff, HD64461_NIMR); 152 outw(0xffff, HD64461_NIMR);
145 153
154 /* IRQ 80 -> 95 belongs to HD64461 */
146 for (i = HD64461_IRQBASE; i < HD64461_IRQBASE + 16; i++) { 155 for (i = HD64461_IRQBASE; i < HD64461_IRQBASE + 16; i++) {
147 irq_desc[i].chip = &hd64461_irq_type; 156 irq_desc[i].chip = &hd64461_irq_type;
148 } 157 }
diff --git a/arch/sh/cchips/hd6446x/hd64465/setup.c b/arch/sh/cchips/hd6446x/hd64465/setup.c
index d126e1f30dee..5cef0db4018b 100644
--- a/arch/sh/cchips/hd6446x/hd64465/setup.c
+++ b/arch/sh/cchips/hd6446x/hd64465/setup.c
@@ -147,7 +147,12 @@ int hd64465_irq_demux(int irq)
147 return irq; 147 return irq;
148} 148}
149 149
150static struct irqaction irq0 = { hd64465_interrupt, IRQF_DISABLED, CPU_MASK_NONE, "HD64465", NULL, NULL}; 150static struct irqaction irq0 = {
151 .handler = hd64465_interrupt,
152 .flags = IRQF_DISABLED,
153 .mask = CPU_MASK_NONE,
154 .name = "HD64465",
155};
151 156
152 157
153static int __init setup_hd64465(void) 158static int __init setup_hd64465(void)
diff --git a/arch/sh/cchips/voyagergx/irq.c b/arch/sh/cchips/voyagergx/irq.c
index d70e5c8461b5..ade303876841 100644
--- a/arch/sh/cchips/voyagergx/irq.c
+++ b/arch/sh/cchips/voyagergx/irq.c
@@ -23,149 +23,79 @@
23#include <asm/voyagergx.h> 23#include <asm/voyagergx.h>
24#include <asm/rts7751r2d.h> 24#include <asm/rts7751r2d.h>
25 25
26static void disable_voyagergx_irq(unsigned int irq) 26enum {
27{ 27 UNUSED = 0,
28 unsigned long val; 28
29 unsigned long mask = 1 << (irq - VOYAGER_IRQ_BASE); 29 /* voyager specific interrupt sources */
30 30 UP, G54, G53, G52, G51, G50, G49, G48,
31 pr_debug("disable_voyagergx_irq(%d): mask=%lx\n", irq, mask); 31 I2C, PW, DMA, PCI, I2S, AC, US,
32 val = readl((void __iomem *)VOYAGER_INT_MASK); 32 U1, U0, CV, MC, S1, S0,
33 val &= ~mask; 33 UH, TWOD, ZD, PV, CI,
34 writel(val, (void __iomem *)VOYAGER_INT_MASK);
35}
36
37static void enable_voyagergx_irq(unsigned int irq)
38{
39 unsigned long val;
40 unsigned long mask = 1 << (irq - VOYAGER_IRQ_BASE);
41
42 pr_debug("disable_voyagergx_irq(%d): mask=%lx\n", irq, mask);
43 val = readl((void __iomem *)VOYAGER_INT_MASK);
44 val |= mask;
45 writel(val, (void __iomem *)VOYAGER_INT_MASK);
46}
47
48static void mask_and_ack_voyagergx(unsigned int irq)
49{
50 disable_voyagergx_irq(irq);
51}
52
53static void end_voyagergx_irq(unsigned int irq)
54{
55 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
56 enable_voyagergx_irq(irq);
57}
58
59static unsigned int startup_voyagergx_irq(unsigned int irq)
60{
61 enable_voyagergx_irq(irq);
62 return 0;
63}
64
65static void shutdown_voyagergx_irq(unsigned int irq)
66{
67 disable_voyagergx_irq(irq);
68}
69
70static struct hw_interrupt_type voyagergx_irq_type = {
71 .typename = "VOYAGERGX-IRQ",
72 .startup = startup_voyagergx_irq,
73 .shutdown = shutdown_voyagergx_irq,
74 .enable = enable_voyagergx_irq,
75 .disable = disable_voyagergx_irq,
76 .ack = mask_and_ack_voyagergx,
77 .end = end_voyagergx_irq,
78}; 34};
79 35
80static irqreturn_t voyagergx_interrupt(int irq, void *dev_id) 36static struct intc_vect vectors[] __initdata = {
81{ 37 INTC_IRQ(UP, IRQ_SM501_UP), INTC_IRQ(G54, IRQ_SM501_G54),
82 printk(KERN_INFO 38 INTC_IRQ(G53, IRQ_SM501_G53), INTC_IRQ(G52, IRQ_SM501_G52),
83 "VoyagerGX: spurious interrupt, status: 0x%x\n", 39 INTC_IRQ(G51, IRQ_SM501_G51), INTC_IRQ(G50, IRQ_SM501_G50),
84 (unsigned int)readl((void __iomem *)INT_STATUS)); 40 INTC_IRQ(G49, IRQ_SM501_G49), INTC_IRQ(G48, IRQ_SM501_G48),
85 return IRQ_HANDLED; 41 INTC_IRQ(I2C, IRQ_SM501_I2C), INTC_IRQ(PW, IRQ_SM501_PW),
86} 42 INTC_IRQ(DMA, IRQ_SM501_DMA), INTC_IRQ(PCI, IRQ_SM501_PCI),
87 43 INTC_IRQ(I2S, IRQ_SM501_I2S), INTC_IRQ(AC, IRQ_SM501_AC),
88static struct { 44 INTC_IRQ(US, IRQ_SM501_US), INTC_IRQ(U1, IRQ_SM501_U1),
89 int (*func)(int, void *); 45 INTC_IRQ(U0, IRQ_SM501_U0), INTC_IRQ(CV, IRQ_SM501_CV),
90 void *dev; 46 INTC_IRQ(MC, IRQ_SM501_MC), INTC_IRQ(S1, IRQ_SM501_S1),
91} voyagergx_demux[VOYAGER_IRQ_NUM]; 47 INTC_IRQ(S0, IRQ_SM501_S0), INTC_IRQ(UH, IRQ_SM501_UH),
48 INTC_IRQ(TWOD, IRQ_SM501_2D), INTC_IRQ(ZD, IRQ_SM501_ZD),
49 INTC_IRQ(PV, IRQ_SM501_PV), INTC_IRQ(CI, IRQ_SM501_CI),
50};
92 51
93void voyagergx_register_irq_demux(int irq, 52static struct intc_mask_reg mask_registers[] __initdata = {
94 int (*demux)(int irq, void *dev), void *dev) 53 { VOYAGER_INT_MASK, 0, 32, /* "Interrupt Mask", MMIO_base + 0x30 */
95{ 54 { UP, G54, G53, G52, G51, G50, G49, G48,
96 voyagergx_demux[irq - VOYAGER_IRQ_BASE].func = demux; 55 I2C, PW, 0, DMA, PCI, I2S, AC, US,
97 voyagergx_demux[irq - VOYAGER_IRQ_BASE].dev = dev; 56 0, 0, U1, U0, CV, MC, S1, S0,
98} 57 0, UH, 0, 0, TWOD, ZD, PV, CI } },
58};
99 59
100void voyagergx_unregister_irq_demux(int irq) 60static DECLARE_INTC_DESC(intc_desc, "voyagergx", vectors,
101{ 61 NULL, NULL, mask_registers, NULL, NULL);
102 voyagergx_demux[irq - VOYAGER_IRQ_BASE].func = 0; 62
103} 63static unsigned int voyagergx_stat2irq[32] = {
64 IRQ_SM501_CI, IRQ_SM501_PV, IRQ_SM501_ZD, IRQ_SM501_2D,
65 0, 0, IRQ_SM501_UH, 0,
66 IRQ_SM501_S0, IRQ_SM501_S1, IRQ_SM501_MC, IRQ_SM501_CV,
67 IRQ_SM501_U0, IRQ_SM501_U1, 0, 0,
68 IRQ_SM501_US, IRQ_SM501_AC, IRQ_SM501_I2S, IRQ_SM501_PCI,
69 IRQ_SM501_DMA, 0, IRQ_SM501_PW, IRQ_SM501_I2C,
70 IRQ_SM501_G48, IRQ_SM501_G49, IRQ_SM501_G50, IRQ_SM501_G51,
71 IRQ_SM501_G52, IRQ_SM501_G53, IRQ_SM501_G54, IRQ_SM501_UP
72};
104 73
105int voyagergx_irq_demux(int irq) 74static void voyagergx_irq_demux(unsigned int irq, struct irq_desc *desc)
106{ 75{
107 76 unsigned long intv = ctrl_inl(INT_STATUS);
108 if (irq == IRQ_VOYAGER ) { 77 struct irq_desc *ext_desc;
109 unsigned long i = 0, bit __attribute__ ((unused)); 78 unsigned int ext_irq;
110 unsigned long val = readl((void __iomem *)INT_STATUS); 79 unsigned int k = 0;
111 80
112 if (val & (1 << 1)) 81 while (intv) {
113 i = 1; 82 ext_irq = voyagergx_stat2irq[k];
114 else if (val & (1 << 2)) 83 if (ext_irq && (intv & 1)) {
115 i = 2; 84 ext_desc = irq_desc + ext_irq;
116 else if (val & (1 << 6)) 85 handle_level_irq(ext_irq, ext_desc);
117 i = 6;
118 else if (val & (1 << 10))
119 i = 10;
120 else if (val & (1 << 11))
121 i = 11;
122 else if (val & (1 << 12))
123 i = 12;
124 else if (val & (1 << 17))
125 i = 17;
126 else
127 printk("Unexpected IRQ irq = %d status = 0x%08lx\n", irq, val);
128 pr_debug("voyagergx_irq_demux %ld \n", i);
129 if (i < VOYAGER_IRQ_NUM) {
130 irq = VOYAGER_IRQ_BASE + i;
131 if (voyagergx_demux[i].func != 0)
132 irq = voyagergx_demux[i].func(irq,
133 voyagergx_demux[i].dev);
134 } 86 }
87 intv >>= 1;
88 k++;
135 } 89 }
136 return irq;
137} 90}
138 91
139static struct irqaction irq0 = {
140 .name = "voyagergx",
141 .handler = voyagergx_interrupt,
142 .flags = IRQF_DISABLED,
143 .mask = CPU_MASK_NONE,
144};
145
146void __init setup_voyagergx_irq(void) 92void __init setup_voyagergx_irq(void)
147{ 93{
148 int i, flag; 94 printk(KERN_INFO "VoyagerGX on irq %d (mapped into %d to %d)\n",
149
150 printk(KERN_INFO "VoyagerGX configured at 0x%x on irq %d(mapped into %d to %d)\n",
151 VOYAGER_BASE,
152 IRQ_VOYAGER, 95 IRQ_VOYAGER,
153 VOYAGER_IRQ_BASE, 96 VOYAGER_IRQ_BASE,
154 VOYAGER_IRQ_BASE + VOYAGER_IRQ_NUM - 1); 97 VOYAGER_IRQ_BASE + VOYAGER_IRQ_NUM - 1);
155 98
156 for (i=0; i<VOYAGER_IRQ_NUM; i++) { 99 register_intc_controller(&intc_desc);
157 flag = 0; 100 set_irq_chained_handler(IRQ_VOYAGER, voyagergx_irq_demux);
158 switch (VOYAGER_IRQ_BASE + i) {
159 case VOYAGER_USBH_IRQ:
160 case VOYAGER_8051_IRQ:
161 case VOYAGER_UART0_IRQ:
162 case VOYAGER_UART1_IRQ:
163 case VOYAGER_AC97_IRQ:
164 flag = 1;
165 }
166 if (flag == 1)
167 irq_desc[VOYAGER_IRQ_BASE + i].chip = &voyagergx_irq_type;
168 }
169
170 setup_irq(IRQ_VOYAGER, &irq0);
171} 101}
diff --git a/arch/sh/configs/dreamcast_defconfig b/arch/sh/configs/dreamcast_defconfig
index 3fdd270eecf7..57728788b753 100644
--- a/arch/sh/configs/dreamcast_defconfig
+++ b/arch/sh/configs/dreamcast_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22-rc4 3# Linux kernel version: 2.6.23-rc7
4# Sat Jul 7 03:47:45 2007 4# Fri Sep 21 15:46:27 2007
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 7CONFIG_RWSEM_GENERIC_SPINLOCK=y
@@ -18,30 +18,26 @@ CONFIG_STACKTRACE_SUPPORT=y
18CONFIG_LOCKDEP_SUPPORT=y 18CONFIG_LOCKDEP_SUPPORT=y
19# CONFIG_ARCH_HAS_ILOG2_U32 is not set 19# CONFIG_ARCH_HAS_ILOG2_U32 is not set
20# CONFIG_ARCH_HAS_ILOG2_U64 is not set 20# CONFIG_ARCH_HAS_ILOG2_U64 is not set
21CONFIG_ARCH_NO_VIRT_TO_BUS=y
21CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
22 23
23# 24#
24# Code maturity level options 25# General setup
25# 26#
26CONFIG_EXPERIMENTAL=y 27CONFIG_EXPERIMENTAL=y
27CONFIG_BROKEN_ON_SMP=y 28CONFIG_BROKEN_ON_SMP=y
28CONFIG_LOCK_KERNEL=y 29CONFIG_LOCK_KERNEL=y
29CONFIG_INIT_ENV_ARG_LIMIT=32 30CONFIG_INIT_ENV_ARG_LIMIT=32
30
31#
32# General setup
33#
34CONFIG_LOCALVERSION="" 31CONFIG_LOCALVERSION=""
35CONFIG_LOCALVERSION_AUTO=y 32CONFIG_LOCALVERSION_AUTO=y
36CONFIG_SWAP=y 33CONFIG_SWAP=y
37CONFIG_SYSVIPC=y 34CONFIG_SYSVIPC=y
38# CONFIG_IPC_NS is not set
39CONFIG_SYSVIPC_SYSCTL=y 35CONFIG_SYSVIPC_SYSCTL=y
40# CONFIG_POSIX_MQUEUE is not set 36# CONFIG_POSIX_MQUEUE is not set
41CONFIG_BSD_PROCESS_ACCT=y 37CONFIG_BSD_PROCESS_ACCT=y
42# CONFIG_BSD_PROCESS_ACCT_V3 is not set 38# CONFIG_BSD_PROCESS_ACCT_V3 is not set
43# CONFIG_TASKSTATS is not set 39# CONFIG_TASKSTATS is not set
44# CONFIG_UTS_NS is not set 40# CONFIG_USER_NS is not set
45# CONFIG_AUDIT is not set 41# CONFIG_AUDIT is not set
46# CONFIG_IKCONFIG is not set 42# CONFIG_IKCONFIG is not set
47CONFIG_LOG_BUF_SHIFT=14 43CONFIG_LOG_BUF_SHIFT=14
@@ -64,7 +60,6 @@ CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 60CONFIG_ANON_INODES=y
65CONFIG_EPOLL=y 61CONFIG_EPOLL=y
66CONFIG_SIGNALFD=y 62CONFIG_SIGNALFD=y
67CONFIG_TIMERFD=y
68CONFIG_EVENTFD=y 63CONFIG_EVENTFD=y
69CONFIG_SHMEM=y 64CONFIG_SHMEM=y
70CONFIG_VM_EVENT_COUNTERS=y 65CONFIG_VM_EVENT_COUNTERS=y
@@ -74,24 +69,17 @@ CONFIG_SLAB=y
74CONFIG_RT_MUTEXES=y 69CONFIG_RT_MUTEXES=y
75# CONFIG_TINY_SHMEM is not set 70# CONFIG_TINY_SHMEM is not set
76CONFIG_BASE_SMALL=0 71CONFIG_BASE_SMALL=0
77
78#
79# Loadable module support
80#
81CONFIG_MODULES=y 72CONFIG_MODULES=y
82CONFIG_MODULE_UNLOAD=y 73CONFIG_MODULE_UNLOAD=y
83# CONFIG_MODULE_FORCE_UNLOAD is not set 74# CONFIG_MODULE_FORCE_UNLOAD is not set
84# CONFIG_MODVERSIONS is not set 75# CONFIG_MODVERSIONS is not set
85# CONFIG_MODULE_SRCVERSION_ALL is not set 76# CONFIG_MODULE_SRCVERSION_ALL is not set
86CONFIG_KMOD=y 77CONFIG_KMOD=y
87
88#
89# Block layer
90#
91CONFIG_BLOCK=y 78CONFIG_BLOCK=y
92# CONFIG_LBD is not set 79# CONFIG_LBD is not set
93# CONFIG_BLK_DEV_IO_TRACE is not set 80# CONFIG_BLK_DEV_IO_TRACE is not set
94# CONFIG_LSF is not set 81# CONFIG_LSF is not set
82# CONFIG_BLK_DEV_BSG is not set
95 83
96# 84#
97# IO Schedulers 85# IO Schedulers
@@ -112,7 +100,6 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
112CONFIG_CPU_SH4=y 100CONFIG_CPU_SH4=y
113# CONFIG_CPU_SUBTYPE_SH7619 is not set 101# CONFIG_CPU_SUBTYPE_SH7619 is not set
114# CONFIG_CPU_SUBTYPE_SH7206 is not set 102# CONFIG_CPU_SUBTYPE_SH7206 is not set
115# CONFIG_CPU_SUBTYPE_SH7300 is not set
116# CONFIG_CPU_SUBTYPE_SH7705 is not set 103# CONFIG_CPU_SUBTYPE_SH7705 is not set
117# CONFIG_CPU_SUBTYPE_SH7706 is not set 104# CONFIG_CPU_SUBTYPE_SH7706 is not set
118# CONFIG_CPU_SUBTYPE_SH7707 is not set 105# CONFIG_CPU_SUBTYPE_SH7707 is not set
@@ -120,6 +107,7 @@ CONFIG_CPU_SH4=y
120# CONFIG_CPU_SUBTYPE_SH7709 is not set 107# CONFIG_CPU_SUBTYPE_SH7709 is not set
121# CONFIG_CPU_SUBTYPE_SH7710 is not set 108# CONFIG_CPU_SUBTYPE_SH7710 is not set
122# CONFIG_CPU_SUBTYPE_SH7712 is not set 109# CONFIG_CPU_SUBTYPE_SH7712 is not set
110# CONFIG_CPU_SUBTYPE_SH7720 is not set
123# CONFIG_CPU_SUBTYPE_SH7750 is not set 111# CONFIG_CPU_SUBTYPE_SH7750 is not set
124CONFIG_CPU_SUBTYPE_SH7091=y 112CONFIG_CPU_SUBTYPE_SH7091=y
125# CONFIG_CPU_SUBTYPE_SH7750R is not set 113# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -134,7 +122,6 @@ CONFIG_CPU_SUBTYPE_SH7091=y
134# CONFIG_CPU_SUBTYPE_SH7780 is not set 122# CONFIG_CPU_SUBTYPE_SH7780 is not set
135# CONFIG_CPU_SUBTYPE_SH7785 is not set 123# CONFIG_CPU_SUBTYPE_SH7785 is not set
136# CONFIG_CPU_SUBTYPE_SHX3 is not set 124# CONFIG_CPU_SUBTYPE_SHX3 is not set
137# CONFIG_CPU_SUBTYPE_SH73180 is not set
138# CONFIG_CPU_SUBTYPE_SH7343 is not set 125# CONFIG_CPU_SUBTYPE_SH7343 is not set
139# CONFIG_CPU_SUBTYPE_SH7722 is not set 126# CONFIG_CPU_SUBTYPE_SH7722 is not set
140 127
@@ -177,7 +164,9 @@ CONFIG_NR_QUICK=2
177# Cache configuration 164# Cache configuration
178# 165#
179# CONFIG_SH_DIRECT_MAPPED is not set 166# CONFIG_SH_DIRECT_MAPPED is not set
180# CONFIG_SH_WRITETHROUGH is not set 167CONFIG_CACHE_WRITEBACK=y
168# CONFIG_CACHE_WRITETHROUGH is not set
169# CONFIG_CACHE_OFF is not set
181 170
182# 171#
183# Processor features 172# Processor features
@@ -185,12 +174,11 @@ CONFIG_NR_QUICK=2
185CONFIG_CPU_LITTLE_ENDIAN=y 174CONFIG_CPU_LITTLE_ENDIAN=y
186# CONFIG_CPU_BIG_ENDIAN is not set 175# CONFIG_CPU_BIG_ENDIAN is not set
187CONFIG_SH_FPU=y 176CONFIG_SH_FPU=y
188# CONFIG_SH_DSP is not set
189CONFIG_SH_STORE_QUEUES=y 177CONFIG_SH_STORE_QUEUES=y
190CONFIG_CPU_HAS_INTEVT=y 178CONFIG_CPU_HAS_INTEVT=y
191CONFIG_CPU_HAS_IPR_IRQ=y
192CONFIG_CPU_HAS_SR_RB=y 179CONFIG_CPU_HAS_SR_RB=y
193CONFIG_CPU_HAS_PTEA=y 180CONFIG_CPU_HAS_PTEA=y
181CONFIG_CPU_HAS_FPU=y
194 182
195# 183#
196# Board support 184# Board support
@@ -270,6 +258,7 @@ CONFIG_CMDLINE="console=ttySC1,115200 panic=3"
270# 258#
271# Bus options 259# Bus options
272# 260#
261CONFIG_MAPLE=y
273CONFIG_PCI=y 262CONFIG_PCI=y
274CONFIG_SH_PCIDMA_NONCOHERENT=y 263CONFIG_SH_PCIDMA_NONCOHERENT=y
275CONFIG_PCI_AUTO=y 264CONFIG_PCI_AUTO=y
@@ -368,6 +357,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
368# CONFIG_MAC80211 is not set 357# CONFIG_MAC80211 is not set
369# CONFIG_IEEE80211 is not set 358# CONFIG_IEEE80211 is not set
370# CONFIG_RFKILL is not set 359# CONFIG_RFKILL is not set
360# CONFIG_NET_9P is not set
371 361
372# 362#
373# Device Drivers 363# Device Drivers
@@ -380,27 +370,10 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
380CONFIG_PREVENT_FIRMWARE_BUILD=y 370CONFIG_PREVENT_FIRMWARE_BUILD=y
381# CONFIG_FW_LOADER is not set 371# CONFIG_FW_LOADER is not set
382# CONFIG_SYS_HYPERVISOR is not set 372# CONFIG_SYS_HYPERVISOR is not set
383
384#
385# Connector - unified userspace <-> kernelspace linker
386#
387# CONFIG_CONNECTOR is not set 373# CONFIG_CONNECTOR is not set
388# CONFIG_MTD is not set 374# CONFIG_MTD is not set
389
390#
391# Parallel port support
392#
393# CONFIG_PARPORT is not set 375# CONFIG_PARPORT is not set
394 376CONFIG_BLK_DEV=y
395#
396# Plug and Play support
397#
398# CONFIG_PNPACPI is not set
399
400#
401# Block devices
402#
403# CONFIG_BLK_CPQ_DA is not set
404# CONFIG_BLK_CPQ_CISS_DA is not set 377# CONFIG_BLK_CPQ_CISS_DA is not set
405# CONFIG_BLK_DEV_DAC960 is not set 378# CONFIG_BLK_DEV_DAC960 is not set
406# CONFIG_BLK_DEV_UMEM is not set 379# CONFIG_BLK_DEV_UMEM is not set
@@ -411,14 +384,11 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
411# CONFIG_BLK_DEV_RAM is not set 384# CONFIG_BLK_DEV_RAM is not set
412# CONFIG_CDROM_PKTCDVD is not set 385# CONFIG_CDROM_PKTCDVD is not set
413# CONFIG_ATA_OVER_ETH is not set 386# CONFIG_ATA_OVER_ETH is not set
414 387CONFIG_MISC_DEVICES=y
415#
416# Misc devices
417#
418# CONFIG_PHANTOM is not set 388# CONFIG_PHANTOM is not set
389# CONFIG_EEPROM_93CX6 is not set
419# CONFIG_SGI_IOC4 is not set 390# CONFIG_SGI_IOC4 is not set
420# CONFIG_TIFM_CORE is not set 391# CONFIG_TIFM_CORE is not set
421# CONFIG_BLINK is not set
422# CONFIG_IDE is not set 392# CONFIG_IDE is not set
423 393
424# 394#
@@ -426,12 +396,9 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
426# 396#
427# CONFIG_RAID_ATTRS is not set 397# CONFIG_RAID_ATTRS is not set
428# CONFIG_SCSI is not set 398# CONFIG_SCSI is not set
399# CONFIG_SCSI_DMA is not set
429# CONFIG_SCSI_NETLINK is not set 400# CONFIG_SCSI_NETLINK is not set
430# CONFIG_ATA is not set 401# CONFIG_ATA is not set
431
432#
433# Multi-device support (RAID and LVM)
434#
435# CONFIG_MD is not set 402# CONFIG_MD is not set
436 403
437# 404#
@@ -444,26 +411,16 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
444# 411#
445# CONFIG_FIREWIRE is not set 412# CONFIG_FIREWIRE is not set
446# CONFIG_IEEE1394 is not set 413# CONFIG_IEEE1394 is not set
447
448#
449# I2O device support
450#
451# CONFIG_I2O is not set 414# CONFIG_I2O is not set
452
453#
454# Network device support
455#
456CONFIG_NETDEVICES=y 415CONFIG_NETDEVICES=y
416# CONFIG_NETDEVICES_MULTIQUEUE is not set
457# CONFIG_DUMMY is not set 417# CONFIG_DUMMY is not set
458# CONFIG_BONDING is not set 418# CONFIG_BONDING is not set
419# CONFIG_MACVLAN is not set
459# CONFIG_EQUALIZER is not set 420# CONFIG_EQUALIZER is not set
460# CONFIG_TUN is not set 421# CONFIG_TUN is not set
461# CONFIG_ARCNET is not set 422# CONFIG_ARCNET is not set
462# CONFIG_PHYLIB is not set 423# CONFIG_PHYLIB is not set
463
464#
465# Ethernet (10 or 100Mbit)
466#
467CONFIG_NET_ETHERNET=y 424CONFIG_NET_ETHERNET=y
468CONFIG_MII=y 425CONFIG_MII=y
469# CONFIG_STNIC is not set 426# CONFIG_STNIC is not set
@@ -472,10 +429,6 @@ CONFIG_MII=y
472# CONFIG_CASSINI is not set 429# CONFIG_CASSINI is not set
473# CONFIG_NET_VENDOR_3COM is not set 430# CONFIG_NET_VENDOR_3COM is not set
474# CONFIG_SMC91X is not set 431# CONFIG_SMC91X is not set
475
476#
477# Tulip family network device support
478#
479# CONFIG_NET_TULIP is not set 432# CONFIG_NET_TULIP is not set
480# CONFIG_HP100 is not set 433# CONFIG_HP100 is not set
481CONFIG_NET_PCI=y 434CONFIG_NET_PCI=y
@@ -520,15 +473,7 @@ CONFIG_8139TOO=y
520# CONFIG_NETCONSOLE is not set 473# CONFIG_NETCONSOLE is not set
521# CONFIG_NETPOLL is not set 474# CONFIG_NETPOLL is not set
522# CONFIG_NET_POLL_CONTROLLER is not set 475# CONFIG_NET_POLL_CONTROLLER is not set
523
524#
525# ISDN subsystem
526#
527# CONFIG_ISDN is not set 476# CONFIG_ISDN is not set
528
529#
530# Telephony Support
531#
532# CONFIG_PHONE is not set 477# CONFIG_PHONE is not set
533 478
534# 479#
@@ -536,6 +481,7 @@ CONFIG_8139TOO=y
536# 481#
537CONFIG_INPUT=y 482CONFIG_INPUT=y
538# CONFIG_INPUT_FF_MEMLESS is not set 483# CONFIG_INPUT_FF_MEMLESS is not set
484# CONFIG_INPUT_POLLDEV is not set
539 485
540# 486#
541# Userland interfaces 487# Userland interfaces
@@ -606,10 +552,6 @@ CONFIG_SERIAL_CORE_CONSOLE=y
606CONFIG_UNIX98_PTYS=y 552CONFIG_UNIX98_PTYS=y
607CONFIG_LEGACY_PTYS=y 553CONFIG_LEGACY_PTYS=y
608CONFIG_LEGACY_PTY_COUNT=256 554CONFIG_LEGACY_PTY_COUNT=256
609
610#
611# IPMI
612#
613# CONFIG_IPMI_HANDLER is not set 555# CONFIG_IPMI_HANDLER is not set
614CONFIG_WATCHDOG=y 556CONFIG_WATCHDOG=y
615# CONFIG_WATCHDOG_NOWAYOUT is not set 557# CONFIG_WATCHDOG_NOWAYOUT is not set
@@ -631,10 +573,6 @@ CONFIG_HW_RANDOM=y
631# CONFIG_APPLICOM is not set 573# CONFIG_APPLICOM is not set
632# CONFIG_DRM is not set 574# CONFIG_DRM is not set
633# CONFIG_RAW_DRIVER is not set 575# CONFIG_RAW_DRIVER is not set
634
635#
636# TPM devices
637#
638# CONFIG_TCG_TPM is not set 576# CONFIG_TCG_TPM is not set
639CONFIG_DEVPORT=y 577CONFIG_DEVPORT=y
640# CONFIG_I2C is not set 578# CONFIG_I2C is not set
@@ -644,11 +582,8 @@ CONFIG_DEVPORT=y
644# 582#
645# CONFIG_SPI is not set 583# CONFIG_SPI is not set
646# CONFIG_SPI_MASTER is not set 584# CONFIG_SPI_MASTER is not set
647
648#
649# Dallas's 1-wire bus
650#
651# CONFIG_W1 is not set 585# CONFIG_W1 is not set
586# CONFIG_POWER_SUPPLY is not set
652# CONFIG_HWMON is not set 587# CONFIG_HWMON is not set
653 588
654# 589#
@@ -673,6 +608,7 @@ CONFIG_DEVPORT=y
673# 608#
674# CONFIG_DISPLAY_SUPPORT is not set 609# CONFIG_DISPLAY_SUPPORT is not set
675# CONFIG_VGASTATE is not set 610# CONFIG_VGASTATE is not set
611CONFIG_VIDEO_OUTPUT_CONTROL=m
676CONFIG_FB=y 612CONFIG_FB=y
677CONFIG_FIRMWARE_EDID=y 613CONFIG_FIRMWARE_EDID=y
678# CONFIG_FB_DDC is not set 614# CONFIG_FB_DDC is not set
@@ -699,7 +635,6 @@ CONFIG_FB_DEFERRED_IO=y
699# CONFIG_FB_ASILIANT is not set 635# CONFIG_FB_ASILIANT is not set
700# CONFIG_FB_IMSTT is not set 636# CONFIG_FB_IMSTT is not set
701CONFIG_FB_PVR2=y 637CONFIG_FB_PVR2=y
702# CONFIG_FB_EPSON1355 is not set
703# CONFIG_FB_S1D13XXX is not set 638# CONFIG_FB_S1D13XXX is not set
704# CONFIG_FB_NVIDIA is not set 639# CONFIG_FB_NVIDIA is not set
705# CONFIG_FB_RIVA is not set 640# CONFIG_FB_RIVA is not set
@@ -725,6 +660,7 @@ CONFIG_FB_PVR2=y
725# 660#
726CONFIG_DUMMY_CONSOLE=y 661CONFIG_DUMMY_CONSOLE=y
727CONFIG_FRAMEBUFFER_CONSOLE=y 662CONFIG_FRAMEBUFFER_CONSOLE=y
663# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
728# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set 664# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
729CONFIG_FONTS=y 665CONFIG_FONTS=y
730CONFIG_FONT_8x8=y 666CONFIG_FONT_8x8=y
@@ -749,16 +685,10 @@ CONFIG_LOGO_SUPERH_CLUT224=y
749# Sound 685# Sound
750# 686#
751# CONFIG_SOUND is not set 687# CONFIG_SOUND is not set
752 688CONFIG_HID_SUPPORT=y
753#
754# HID Devices
755#
756CONFIG_HID=y 689CONFIG_HID=y
757# CONFIG_HID_DEBUG is not set 690# CONFIG_HID_DEBUG is not set
758 691CONFIG_USB_SUPPORT=y
759#
760# USB support
761#
762CONFIG_USB_ARCH_HAS_HCD=y 692CONFIG_USB_ARCH_HAS_HCD=y
763CONFIG_USB_ARCH_HAS_OHCI=y 693CONFIG_USB_ARCH_HAS_OHCI=y
764CONFIG_USB_ARCH_HAS_EHCI=y 694CONFIG_USB_ARCH_HAS_EHCI=y
@@ -773,32 +703,8 @@ CONFIG_USB_ARCH_HAS_EHCI=y
773# 703#
774# CONFIG_USB_GADGET is not set 704# CONFIG_USB_GADGET is not set
775# CONFIG_MMC is not set 705# CONFIG_MMC is not set
776
777#
778# LED devices
779#
780# CONFIG_NEW_LEDS is not set 706# CONFIG_NEW_LEDS is not set
781
782#
783# LED drivers
784#
785
786#
787# LED Triggers
788#
789
790#
791# InfiniBand support
792#
793# CONFIG_INFINIBAND is not set 707# CONFIG_INFINIBAND is not set
794
795#
796# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
797#
798
799#
800# Real Time Clock
801#
802# CONFIG_RTC_CLASS is not set 708# CONFIG_RTC_CLASS is not set
803 709
804# 710#
@@ -815,6 +721,11 @@ CONFIG_USB_ARCH_HAS_EHCI=y
815# 721#
816 722
817# 723#
724# Userspace I/O
725#
726# CONFIG_UIO is not set
727
728#
818# File systems 729# File systems
819# 730#
820# CONFIG_EXT2_FS is not set 731# CONFIG_EXT2_FS is not set
@@ -890,7 +801,6 @@ CONFIG_RAMFS=y
890# CONFIG_NCP_FS is not set 801# CONFIG_NCP_FS is not set
891# CONFIG_CODA_FS is not set 802# CONFIG_CODA_FS is not set
892# CONFIG_AFS_FS is not set 803# CONFIG_AFS_FS is not set
893# CONFIG_9P_FS is not set
894 804
895# 805#
896# Partition Types 806# Partition Types
@@ -935,10 +845,6 @@ CONFIG_ENABLE_MUST_CHECK=y
935# 845#
936# CONFIG_KEYS is not set 846# CONFIG_KEYS is not set
937# CONFIG_SECURITY is not set 847# CONFIG_SECURITY is not set
938
939#
940# Cryptographic options
941#
942# CONFIG_CRYPTO is not set 848# CONFIG_CRYPTO is not set
943 849
944# 850#
@@ -949,6 +855,7 @@ CONFIG_BITREVERSE=y
949# CONFIG_CRC16 is not set 855# CONFIG_CRC16 is not set
950# CONFIG_CRC_ITU_T is not set 856# CONFIG_CRC_ITU_T is not set
951CONFIG_CRC32=y 857CONFIG_CRC32=y
858# CONFIG_CRC7 is not set
952# CONFIG_LIBCRC32C is not set 859# CONFIG_LIBCRC32C is not set
953CONFIG_PLIST=y 860CONFIG_PLIST=y
954CONFIG_HAS_IOMEM=y 861CONFIG_HAS_IOMEM=y
diff --git a/arch/sh/configs/hp6xx_defconfig b/arch/sh/configs/hp6xx_defconfig
index b931d9b2d579..756d38dc2f71 100644
--- a/arch/sh/configs/hp6xx_defconfig
+++ b/arch/sh/configs/hp6xx_defconfig
@@ -1,37 +1,47 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.18 3# Linux kernel version: 2.6.23-rc4
4# Tue Oct 3 11:10:06 2006 4# Tue Sep 11 19:42:44 2007
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 7CONFIG_RWSEM_GENERIC_SPINLOCK=y
8CONFIG_GENERIC_BUG=y
8CONFIG_GENERIC_FIND_NEXT_BIT=y 9CONFIG_GENERIC_FIND_NEXT_BIT=y
9CONFIG_GENERIC_HWEIGHT=y 10CONFIG_GENERIC_HWEIGHT=y
10CONFIG_GENERIC_HARDIRQS=y 11CONFIG_GENERIC_HARDIRQS=y
11CONFIG_GENERIC_IRQ_PROBE=y 12CONFIG_GENERIC_IRQ_PROBE=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y 13CONFIG_GENERIC_CALIBRATE_DELAY=y
14CONFIG_GENERIC_TIME=y
15CONFIG_GENERIC_CLOCKEVENTS=y
16CONFIG_SYS_SUPPORTS_PM=y
17CONFIG_SYS_SUPPORTS_APM_EMULATION=y
18CONFIG_STACKTRACE_SUPPORT=y
19CONFIG_LOCKDEP_SUPPORT=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_ARCH_NO_VIRT_TO_BUS=y
13CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 23CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
14 24
15# 25#
16# Code maturity level options 26# General setup
17# 27#
18CONFIG_EXPERIMENTAL=y 28CONFIG_EXPERIMENTAL=y
19CONFIG_BROKEN_ON_SMP=y 29CONFIG_BROKEN_ON_SMP=y
20CONFIG_INIT_ENV_ARG_LIMIT=32 30CONFIG_INIT_ENV_ARG_LIMIT=32
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION="" 31CONFIG_LOCALVERSION=""
26CONFIG_LOCALVERSION_AUTO=y 32CONFIG_LOCALVERSION_AUTO=y
27CONFIG_SWAP=y 33CONFIG_SWAP=y
28# CONFIG_SYSVIPC is not set 34# CONFIG_SYSVIPC is not set
29# CONFIG_BSD_PROCESS_ACCT is not set 35CONFIG_BSD_PROCESS_ACCT=y
30# CONFIG_UTS_NS is not set 36# CONFIG_BSD_PROCESS_ACCT_V3 is not set
31# CONFIG_IKCONFIG is not set 37# CONFIG_USER_NS is not set
38CONFIG_IKCONFIG=y
39CONFIG_IKCONFIG_PROC=y
40CONFIG_LOG_BUF_SHIFT=14
41CONFIG_SYSFS_DEPRECATED=y
32# CONFIG_RELAY is not set 42# CONFIG_RELAY is not set
33CONFIG_INITRAMFS_SOURCE="" 43# CONFIG_BLK_DEV_INITRD is not set
34CONFIG_CC_OPTIMIZE_FOR_SIZE=y 44# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
35CONFIG_SYSCTL=y 45CONFIG_SYSCTL=y
36CONFIG_EMBEDDED=y 46CONFIG_EMBEDDED=y
37CONFIG_UID16=y 47CONFIG_UID16=y
@@ -44,27 +54,25 @@ CONFIG_BUG=y
44CONFIG_ELF_CORE=y 54CONFIG_ELF_CORE=y
45CONFIG_BASE_FULL=y 55CONFIG_BASE_FULL=y
46CONFIG_FUTEX=y 56CONFIG_FUTEX=y
57CONFIG_ANON_INODES=y
47CONFIG_EPOLL=y 58CONFIG_EPOLL=y
59CONFIG_SIGNALFD=y
60CONFIG_TIMERFD=y
61CONFIG_EVENTFD=y
48CONFIG_SHMEM=y 62CONFIG_SHMEM=y
49CONFIG_SLAB=y
50CONFIG_VM_EVENT_COUNTERS=y 63CONFIG_VM_EVENT_COUNTERS=y
64CONFIG_SLAB=y
65# CONFIG_SLUB is not set
66# CONFIG_SLOB is not set
51CONFIG_RT_MUTEXES=y 67CONFIG_RT_MUTEXES=y
52# CONFIG_TINY_SHMEM is not set 68# CONFIG_TINY_SHMEM is not set
53CONFIG_BASE_SMALL=0 69CONFIG_BASE_SMALL=0
54# CONFIG_SLOB is not set
55
56#
57# Loadable module support
58#
59# CONFIG_MODULES is not set 70# CONFIG_MODULES is not set
60
61#
62# Block layer
63#
64CONFIG_BLOCK=y 71CONFIG_BLOCK=y
65# CONFIG_LBD is not set 72# CONFIG_LBD is not set
66# CONFIG_BLK_DEV_IO_TRACE is not set 73# CONFIG_BLK_DEV_IO_TRACE is not set
67# CONFIG_LSF is not set 74# CONFIG_LSF is not set
75# CONFIG_BLK_DEV_BSG is not set
68 76
69# 77#
70# IO Schedulers 78# IO Schedulers
@@ -82,55 +90,17 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
82# 90#
83# System type 91# System type
84# 92#
85# CONFIG_SH_SOLUTION_ENGINE is not set
86# CONFIG_SH_7751_SOLUTION_ENGINE is not set
87# CONFIG_SH_7300_SOLUTION_ENGINE is not set
88# CONFIG_SH_7343_SOLUTION_ENGINE is not set
89# CONFIG_SH_73180_SOLUTION_ENGINE is not set
90# CONFIG_SH_7751_SYSTEMH is not set
91CONFIG_SH_HP6XX=y
92# CONFIG_SH_EC3104 is not set
93# CONFIG_SH_SATURN is not set
94# CONFIG_SH_DREAMCAST is not set
95# CONFIG_SH_BIGSUR is not set
96# CONFIG_SH_MPC1211 is not set
97# CONFIG_SH_SH03 is not set
98# CONFIG_SH_SECUREEDGE5410 is not set
99# CONFIG_SH_HS7751RVOIP is not set
100# CONFIG_SH_7710VOIPGW is not set
101# CONFIG_SH_RTS7751R2D is not set
102# CONFIG_SH_R7780RP is not set
103# CONFIG_SH_EDOSK7705 is not set
104# CONFIG_SH_SH4202_MICRODEV is not set
105# CONFIG_SH_LANDISK is not set
106# CONFIG_SH_TITAN is not set
107# CONFIG_SH_SHMIN is not set
108# CONFIG_SH_UNKNOWN is not set
109
110#
111# Processor selection
112#
113CONFIG_CPU_SH3=y 93CONFIG_CPU_SH3=y
114 94# CONFIG_CPU_SUBTYPE_SH7619 is not set
115# 95# CONFIG_CPU_SUBTYPE_SH7206 is not set
116# SH-2 Processor Support
117#
118# CONFIG_CPU_SUBTYPE_SH7604 is not set
119
120#
121# SH-3 Processor Support
122#
123# CONFIG_CPU_SUBTYPE_SH7300 is not set
124# CONFIG_CPU_SUBTYPE_SH7705 is not set 96# CONFIG_CPU_SUBTYPE_SH7705 is not set
125# CONFIG_CPU_SUBTYPE_SH7706 is not set 97# CONFIG_CPU_SUBTYPE_SH7706 is not set
126# CONFIG_CPU_SUBTYPE_SH7707 is not set 98# CONFIG_CPU_SUBTYPE_SH7707 is not set
127# CONFIG_CPU_SUBTYPE_SH7708 is not set 99# CONFIG_CPU_SUBTYPE_SH7708 is not set
128CONFIG_CPU_SUBTYPE_SH7709=y 100CONFIG_CPU_SUBTYPE_SH7709=y
129# CONFIG_CPU_SUBTYPE_SH7710 is not set 101# CONFIG_CPU_SUBTYPE_SH7710 is not set
130 102# CONFIG_CPU_SUBTYPE_SH7712 is not set
131# 103# CONFIG_CPU_SUBTYPE_SH7720 is not set
132# SH-4 Processor Support
133#
134# CONFIG_CPU_SUBTYPE_SH7750 is not set 104# CONFIG_CPU_SUBTYPE_SH7750 is not set
135# CONFIG_CPU_SUBTYPE_SH7091 is not set 105# CONFIG_CPU_SUBTYPE_SH7091 is not set
136# CONFIG_CPU_SUBTYPE_SH7750R is not set 106# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -139,66 +109,78 @@ CONFIG_CPU_SUBTYPE_SH7709=y
139# CONFIG_CPU_SUBTYPE_SH7751R is not set 109# CONFIG_CPU_SUBTYPE_SH7751R is not set
140# CONFIG_CPU_SUBTYPE_SH7760 is not set 110# CONFIG_CPU_SUBTYPE_SH7760 is not set
141# CONFIG_CPU_SUBTYPE_SH4_202 is not set 111# CONFIG_CPU_SUBTYPE_SH4_202 is not set
142
143#
144# ST40 Processor Support
145#
146# CONFIG_CPU_SUBTYPE_ST40STB1 is not set 112# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
147# CONFIG_CPU_SUBTYPE_ST40GX1 is not set 113# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
148
149#
150# SH-4A Processor Support
151#
152# CONFIG_CPU_SUBTYPE_SH7770 is not set 114# CONFIG_CPU_SUBTYPE_SH7770 is not set
153# CONFIG_CPU_SUBTYPE_SH7780 is not set 115# CONFIG_CPU_SUBTYPE_SH7780 is not set
154 116# CONFIG_CPU_SUBTYPE_SH7785 is not set
155# 117# CONFIG_CPU_SUBTYPE_SHX3 is not set
156# SH4AL-DSP Processor Support
157#
158# CONFIG_CPU_SUBTYPE_SH73180 is not set
159# CONFIG_CPU_SUBTYPE_SH7343 is not set 118# CONFIG_CPU_SUBTYPE_SH7343 is not set
119# CONFIG_CPU_SUBTYPE_SH7722 is not set
160 120
161# 121#
162# Memory management options 122# Memory management options
163# 123#
124CONFIG_QUICKLIST=y
164CONFIG_MMU=y 125CONFIG_MMU=y
165CONFIG_PAGE_OFFSET=0x80000000 126CONFIG_PAGE_OFFSET=0x80000000
166CONFIG_MEMORY_START=0x0c000000 127CONFIG_MEMORY_START=0x0d000000
167CONFIG_MEMORY_SIZE=0x00400000 128CONFIG_MEMORY_SIZE=0x00400000
168CONFIG_VSYSCALL=y 129CONFIG_VSYSCALL=y
130CONFIG_ARCH_FLATMEM_ENABLE=y
131CONFIG_ARCH_SPARSEMEM_ENABLE=y
132CONFIG_ARCH_SPARSEMEM_DEFAULT=y
133CONFIG_MAX_ACTIVE_REGIONS=1
134CONFIG_ARCH_POPULATES_NODE_MAP=y
135CONFIG_ARCH_SELECT_MEMORY_MODEL=y
136CONFIG_PAGE_SIZE_4KB=y
137# CONFIG_PAGE_SIZE_8KB is not set
138# CONFIG_PAGE_SIZE_64KB is not set
169CONFIG_SELECT_MEMORY_MODEL=y 139CONFIG_SELECT_MEMORY_MODEL=y
170CONFIG_FLATMEM_MANUAL=y 140CONFIG_FLATMEM_MANUAL=y
171# CONFIG_DISCONTIGMEM_MANUAL is not set 141# CONFIG_DISCONTIGMEM_MANUAL is not set
172# CONFIG_SPARSEMEM_MANUAL is not set 142# CONFIG_SPARSEMEM_MANUAL is not set
173CONFIG_FLATMEM=y 143CONFIG_FLATMEM=y
174CONFIG_FLAT_NODE_MEM_MAP=y 144CONFIG_FLAT_NODE_MEM_MAP=y
175# CONFIG_SPARSEMEM_STATIC is not set 145CONFIG_SPARSEMEM_STATIC=y
176CONFIG_SPLIT_PTLOCK_CPUS=4 146CONFIG_SPLIT_PTLOCK_CPUS=4
177# CONFIG_RESOURCES_64BIT is not set 147# CONFIG_RESOURCES_64BIT is not set
148CONFIG_ZONE_DMA_FLAG=0
149CONFIG_NR_QUICK=2
178 150
179# 151#
180# Cache configuration 152# Cache configuration
181# 153#
182# CONFIG_SH_DIRECT_MAPPED is not set 154# CONFIG_SH_DIRECT_MAPPED is not set
183# CONFIG_SH_WRITETHROUGH is not set 155CONFIG_CACHE_WRITEBACK=y
184# CONFIG_SH_OCRAM is not set 156# CONFIG_CACHE_WRITETHROUGH is not set
157# CONFIG_CACHE_OFF is not set
185 158
186# 159#
187# Processor features 160# Processor features
188# 161#
189CONFIG_CPU_LITTLE_ENDIAN=y 162CONFIG_CPU_LITTLE_ENDIAN=y
163# CONFIG_CPU_BIG_ENDIAN is not set
190# CONFIG_SH_FPU_EMU is not set 164# CONFIG_SH_FPU_EMU is not set
191# CONFIG_SH_DSP is not set
192CONFIG_SH_ADC=y 165CONFIG_SH_ADC=y
193CONFIG_CPU_HAS_INTEVT=y 166CONFIG_CPU_HAS_INTEVT=y
194CONFIG_CPU_HAS_PINT_IRQ=y
195CONFIG_CPU_HAS_SR_RB=y 167CONFIG_CPU_HAS_SR_RB=y
196 168
197# 169#
198# Timer support 170# Board support
171#
172# CONFIG_SH_SOLUTION_ENGINE is not set
173CONFIG_SH_HP6XX=y
174
175#
176# Timer and clock configuration
199# 177#
200CONFIG_SH_TMU=y 178CONFIG_SH_TMU=y
179CONFIG_SH_TIMER_IRQ=16
201CONFIG_SH_PCLK_FREQ=22110000 180CONFIG_SH_PCLK_FREQ=22110000
181# CONFIG_TICK_ONESHOT is not set
182# CONFIG_NO_HZ is not set
183# CONFIG_HIGH_RES_TIMERS is not set
202 184
203# 185#
204# CPU Frequency scaling 186# CPU Frequency scaling
@@ -208,6 +190,7 @@ CONFIG_SH_PCLK_FREQ=22110000
208# 190#
209# DMA support 191# DMA support
210# 192#
193CONFIG_SH_DMA_API=y
211CONFIG_SH_DMA=y 194CONFIG_SH_DMA=y
212CONFIG_NR_ONCHIP_DMA_CHANNELS=4 195CONFIG_NR_ONCHIP_DMA_CHANNELS=4
213# CONFIG_NR_DMA_CHANNELS_BOOL is not set 196# CONFIG_NR_DMA_CHANNELS_BOOL is not set
@@ -223,14 +206,21 @@ CONFIG_HD64461_IOBASE=0xb0000000
223CONFIG_HD64461_ENABLER=y 206CONFIG_HD64461_ENABLER=y
224 207
225# 208#
209# Additional SuperH Device Drivers
210#
211# CONFIG_HEARTBEAT is not set
212# CONFIG_PUSH_SWITCH is not set
213
214#
226# Kernel features 215# Kernel features
227# 216#
228# CONFIG_HZ_100 is not set 217# CONFIG_HZ_100 is not set
229CONFIG_HZ_250=y 218CONFIG_HZ_250=y
219# CONFIG_HZ_300 is not set
230# CONFIG_HZ_1000 is not set 220# CONFIG_HZ_1000 is not set
231CONFIG_HZ=250 221CONFIG_HZ=250
232# CONFIG_KEXEC is not set 222# CONFIG_KEXEC is not set
233# CONFIG_SMP is not set 223# CONFIG_CRASH_DUMP is not set
234CONFIG_PREEMPT_NONE=y 224CONFIG_PREEMPT_NONE=y
235# CONFIG_PREEMPT_VOLUNTARY is not set 225# CONFIG_PREEMPT_VOLUNTARY is not set
236# CONFIG_PREEMPT is not set 226# CONFIG_PREEMPT is not set
@@ -240,14 +230,13 @@ CONFIG_PREEMPT_NONE=y
240# 230#
241CONFIG_ZERO_PAGE_OFFSET=0x00001000 231CONFIG_ZERO_PAGE_OFFSET=0x00001000
242CONFIG_BOOT_LINK_OFFSET=0x00800000 232CONFIG_BOOT_LINK_OFFSET=0x00800000
243# CONFIG_UBC_WAKEUP is not set
244# CONFIG_CMDLINE_BOOL is not set 233# CONFIG_CMDLINE_BOOL is not set
245 234
246# 235#
247# Bus options 236# Bus options
248# 237#
249CONFIG_ISA=y 238CONFIG_ISA=y
250# CONFIG_PCI is not set 239# CONFIG_ARCH_SUPPORTS_MSI is not set
251 240
252# 241#
253# PCCARD (PCMCIA/CardBus) support 242# PCCARD (PCMCIA/CardBus) support
@@ -266,14 +255,9 @@ CONFIG_PCMCIA_IOCTL=y
266CONFIG_PCMCIA_PROBE=y 255CONFIG_PCMCIA_PROBE=y
267 256
268# 257#
269# PCI Hotplug Support
270#
271
272#
273# Executable file formats 258# Executable file formats
274# 259#
275CONFIG_BINFMT_ELF=y 260CONFIG_BINFMT_ELF=y
276# CONFIG_BINFMT_FLAT is not set
277# CONFIG_BINFMT_MISC is not set 261# CONFIG_BINFMT_MISC is not set
278 262
279# 263#
@@ -282,8 +266,9 @@ CONFIG_BINFMT_ELF=y
282CONFIG_PM=y 266CONFIG_PM=y
283CONFIG_PM_LEGACY=y 267CONFIG_PM_LEGACY=y
284# CONFIG_PM_DEBUG is not set 268# CONFIG_PM_DEBUG is not set
285# CONFIG_PM_SYSFS_DEPRECATED is not set 269CONFIG_PM_SLEEP=y
286CONFIG_APM=y 270CONFIG_SUSPEND=y
271CONFIG_APM_EMULATION=y
287 272
288# 273#
289# Networking 274# Networking
@@ -301,109 +286,76 @@ CONFIG_APM=y
301CONFIG_PREVENT_FIRMWARE_BUILD=y 286CONFIG_PREVENT_FIRMWARE_BUILD=y
302CONFIG_FW_LOADER=y 287CONFIG_FW_LOADER=y
303# CONFIG_SYS_HYPERVISOR is not set 288# CONFIG_SYS_HYPERVISOR is not set
304
305#
306# Connector - unified userspace <-> kernelspace linker
307#
308
309#
310# Memory Technology Devices (MTD)
311#
312# CONFIG_MTD is not set 289# CONFIG_MTD is not set
313
314#
315# Parallel port support
316#
317# CONFIG_PARPORT is not set 290# CONFIG_PARPORT is not set
318
319#
320# Plug and Play support
321#
322# CONFIG_PNP is not set 291# CONFIG_PNP is not set
323 292CONFIG_BLK_DEV=y
324#
325# Block devices
326#
327# CONFIG_BLK_DEV_COW_COMMON is not set 293# CONFIG_BLK_DEV_COW_COMMON is not set
328# CONFIG_BLK_DEV_LOOP is not set 294# CONFIG_BLK_DEV_LOOP is not set
329CONFIG_BLK_DEV_RAM=y 295# CONFIG_BLK_DEV_RAM is not set
330CONFIG_BLK_DEV_RAM_COUNT=16
331CONFIG_BLK_DEV_RAM_SIZE=4096
332CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
333CONFIG_BLK_DEV_INITRD=y
334# CONFIG_CDROM_PKTCDVD is not set 296# CONFIG_CDROM_PKTCDVD is not set
335 297CONFIG_MISC_DEVICES=y
336# 298# CONFIG_EEPROM_93CX6 is not set
337# ATA/ATAPI/MFM/RLL support 299# CONFIG_IDE is not set
338#
339CONFIG_IDE=y
340CONFIG_IDE_MAX_HWIFS=4
341CONFIG_BLK_DEV_IDE=y
342
343#
344# Please see Documentation/ide.txt for help/info on IDE drives
345#
346# CONFIG_BLK_DEV_IDE_SATA is not set
347CONFIG_BLK_DEV_IDEDISK=y
348# CONFIG_IDEDISK_MULTI_MODE is not set
349CONFIG_BLK_DEV_IDECS=y
350# CONFIG_BLK_DEV_IDECD is not set
351# CONFIG_BLK_DEV_IDETAPE is not set
352# CONFIG_BLK_DEV_IDEFLOPPY is not set
353# CONFIG_IDE_TASK_IOCTL is not set
354
355#
356# IDE chipset support/bugfixes
357#
358CONFIG_IDE_GENERIC=y
359# CONFIG_IDE_ARM is not set
360# CONFIG_IDE_CHIPSETS is not set
361# CONFIG_BLK_DEV_IDEDMA is not set
362# CONFIG_IDEDMA_AUTO is not set
363# CONFIG_BLK_DEV_HD is not set
364 300
365# 301#
366# SCSI device support 302# SCSI device support
367# 303#
368# CONFIG_RAID_ATTRS is not set 304# CONFIG_RAID_ATTRS is not set
369# CONFIG_SCSI is not set 305CONFIG_SCSI=y
306CONFIG_SCSI_DMA=y
307# CONFIG_SCSI_TGT is not set
370# CONFIG_SCSI_NETLINK is not set 308# CONFIG_SCSI_NETLINK is not set
371 309CONFIG_SCSI_PROC_FS=y
372# 310
373# Serial ATA (prod) and Parallel ATA (experimental) drivers 311#
374# 312# SCSI support type (disk, tape, CD-ROM)
375# CONFIG_ATA is not set 313#
376 314CONFIG_BLK_DEV_SD=y
377# 315# CONFIG_CHR_DEV_ST is not set
378# Old CD-ROM drivers (not SCSI, not IDE) 316# CONFIG_CHR_DEV_OSST is not set
379# 317# CONFIG_BLK_DEV_SR is not set
380# CONFIG_CD_NO_IDESCSI is not set 318# CONFIG_CHR_DEV_SG is not set
381 319# CONFIG_CHR_DEV_SCH is not set
382# 320
383# Multi-device support (RAID and LVM) 321#
384# 322# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
323#
324# CONFIG_SCSI_MULTI_LUN is not set
325# CONFIG_SCSI_CONSTANTS is not set
326# CONFIG_SCSI_LOGGING is not set
327# CONFIG_SCSI_SCAN_ASYNC is not set
328
329#
330# SCSI Transports
331#
332# CONFIG_SCSI_SPI_ATTRS is not set
333# CONFIG_SCSI_FC_ATTRS is not set
334# CONFIG_SCSI_SAS_LIBSAS is not set
335CONFIG_SCSI_LOWLEVEL=y
336# CONFIG_SCSI_AHA152X is not set
337# CONFIG_SCSI_AIC7XXX_OLD is not set
338# CONFIG_SCSI_IN2000 is not set
339# CONFIG_SCSI_DTC3280 is not set
340# CONFIG_SCSI_FUTURE_DOMAIN is not set
341# CONFIG_SCSI_GENERIC_NCR5380 is not set
342# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
343# CONFIG_SCSI_NCR53C406A is not set
344# CONFIG_SCSI_PAS16 is not set
345# CONFIG_SCSI_PSI240I is not set
346# CONFIG_SCSI_QLOGIC_FAS is not set
347# CONFIG_SCSI_SYM53C416 is not set
348# CONFIG_SCSI_T128 is not set
349# CONFIG_SCSI_DEBUG is not set
350# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
351CONFIG_ATA=y
352# CONFIG_ATA_NONSTANDARD is not set
353# CONFIG_PATA_LEGACY is not set
354# CONFIG_PATA_PCMCIA is not set
355# CONFIG_PATA_QDI is not set
356# CONFIG_PATA_WINBOND_VLB is not set
357CONFIG_PATA_PLATFORM=y
385# CONFIG_MD is not set 358# CONFIG_MD is not set
386
387#
388# Fusion MPT device support
389#
390# CONFIG_FUSION is not set
391
392#
393# IEEE 1394 (FireWire) support
394#
395
396#
397# I2O device support
398#
399
400#
401# ISDN subsystem
402#
403
404#
405# Telephony Support
406#
407# CONFIG_PHONE is not set 359# CONFIG_PHONE is not set
408 360
409# 361#
@@ -411,19 +363,17 @@ CONFIG_IDE_GENERIC=y
411# 363#
412CONFIG_INPUT=y 364CONFIG_INPUT=y
413# CONFIG_INPUT_FF_MEMLESS is not set 365# CONFIG_INPUT_FF_MEMLESS is not set
366CONFIG_INPUT_POLLDEV=y
414 367
415# 368#
416# Userland interfaces 369# Userland interfaces
417# 370#
418CONFIG_INPUT_MOUSEDEV=y 371# CONFIG_INPUT_MOUSEDEV is not set
419CONFIG_INPUT_MOUSEDEV_PSAUX=y
420CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
421CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
422# CONFIG_INPUT_JOYDEV is not set 372# CONFIG_INPUT_JOYDEV is not set
423CONFIG_INPUT_TSDEV=y 373CONFIG_INPUT_TSDEV=y
424CONFIG_INPUT_TSDEV_SCREEN_X=240 374CONFIG_INPUT_TSDEV_SCREEN_X=240
425CONFIG_INPUT_TSDEV_SCREEN_Y=320 375CONFIG_INPUT_TSDEV_SCREEN_Y=320
426# CONFIG_INPUT_EVDEV is not set 376CONFIG_INPUT_EVDEV=y
427# CONFIG_INPUT_EVBUG is not set 377# CONFIG_INPUT_EVBUG is not set
428 378
429# 379#
@@ -436,9 +386,12 @@ CONFIG_INPUT_KEYBOARD=y
436# CONFIG_KEYBOARD_XTKBD is not set 386# CONFIG_KEYBOARD_XTKBD is not set
437# CONFIG_KEYBOARD_NEWTON is not set 387# CONFIG_KEYBOARD_NEWTON is not set
438# CONFIG_KEYBOARD_STOWAWAY is not set 388# CONFIG_KEYBOARD_STOWAWAY is not set
389CONFIG_KEYBOARD_HP6XX=y
439# CONFIG_INPUT_MOUSE is not set 390# CONFIG_INPUT_MOUSE is not set
440# CONFIG_INPUT_JOYSTICK is not set 391# CONFIG_INPUT_JOYSTICK is not set
392# CONFIG_INPUT_TABLET is not set
441CONFIG_INPUT_TOUCHSCREEN=y 393CONFIG_INPUT_TOUCHSCREEN=y
394# CONFIG_TOUCHSCREEN_FUJITSU is not set
442# CONFIG_TOUCHSCREEN_GUNZE is not set 395# CONFIG_TOUCHSCREEN_GUNZE is not set
443# CONFIG_TOUCHSCREEN_ELO is not set 396# CONFIG_TOUCHSCREEN_ELO is not set
444# CONFIG_TOUCHSCREEN_MTOUCH is not set 397# CONFIG_TOUCHSCREEN_MTOUCH is not set
@@ -447,6 +400,7 @@ CONFIG_TOUCHSCREEN_HP600=y
447# CONFIG_TOUCHSCREEN_PENMOUNT is not set 400# CONFIG_TOUCHSCREEN_PENMOUNT is not set
448# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set 401# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
449# CONFIG_TOUCHSCREEN_TOUCHWIN is not set 402# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
403# CONFIG_TOUCHSCREEN_UCB1400 is not set
450# CONFIG_INPUT_MISC is not set 404# CONFIG_INPUT_MISC is not set
451 405
452# 406#
@@ -476,46 +430,29 @@ CONFIG_HW_CONSOLE=y
476# 430#
477# Non-8250 serial port support 431# Non-8250 serial port support
478# 432#
479# CONFIG_SERIAL_SH_SCI is not set 433CONFIG_SERIAL_SH_SCI=y
434CONFIG_SERIAL_SH_SCI_NR_UARTS=3
435CONFIG_SERIAL_SH_SCI_CONSOLE=y
436CONFIG_SERIAL_CORE=y
437CONFIG_SERIAL_CORE_CONSOLE=y
480CONFIG_UNIX98_PTYS=y 438CONFIG_UNIX98_PTYS=y
481CONFIG_LEGACY_PTYS=y 439CONFIG_LEGACY_PTYS=y
482CONFIG_LEGACY_PTY_COUNT=256 440CONFIG_LEGACY_PTY_COUNT=64
483
484#
485# IPMI
486#
487# CONFIG_IPMI_HANDLER is not set 441# CONFIG_IPMI_HANDLER is not set
488
489#
490# Watchdog Cards
491#
492# CONFIG_WATCHDOG is not set 442# CONFIG_WATCHDOG is not set
493CONFIG_HW_RANDOM=y 443CONFIG_HW_RANDOM=y
494# CONFIG_GEN_RTC is not set
495# CONFIG_DTLK is not set 444# CONFIG_DTLK is not set
496# CONFIG_R3964 is not set 445# CONFIG_R3964 is not set
497 446
498# 447#
499# Ftape, the floppy tape device driver
500#
501
502#
503# PCMCIA character devices 448# PCMCIA character devices
504# 449#
505# CONFIG_SYNCLINK_CS is not set 450# CONFIG_SYNCLINK_CS is not set
506# CONFIG_CARDMAN_4000 is not set 451# CONFIG_CARDMAN_4000 is not set
507# CONFIG_CARDMAN_4040 is not set 452# CONFIG_CARDMAN_4040 is not set
508# CONFIG_RAW_DRIVER is not set 453# CONFIG_RAW_DRIVER is not set
509
510#
511# TPM devices
512#
513# CONFIG_TCG_TPM is not set 454# CONFIG_TCG_TPM is not set
514# CONFIG_TELCLOCK is not set 455CONFIG_DEVPORT=y
515
516#
517# I2C support
518#
519# CONFIG_I2C is not set 456# CONFIG_I2C is not set
520 457
521# 458#
@@ -523,48 +460,55 @@ CONFIG_HW_RANDOM=y
523# 460#
524# CONFIG_SPI is not set 461# CONFIG_SPI is not set
525# CONFIG_SPI_MASTER is not set 462# CONFIG_SPI_MASTER is not set
463# CONFIG_W1 is not set
464# CONFIG_POWER_SUPPLY is not set
465# CONFIG_HWMON is not set
526 466
527# 467#
528# Dallas's 1-wire bus 468# Multifunction device drivers
529#
530
531#
532# Hardware Monitoring support
533#
534CONFIG_HWMON=y
535# CONFIG_HWMON_VID is not set
536# CONFIG_SENSORS_ABITUGURU is not set
537# CONFIG_SENSORS_F71805F is not set
538# CONFIG_SENSORS_VT1211 is not set
539# CONFIG_HWMON_DEBUG_CHIP is not set
540
541#
542# Misc devices
543# 469#
470# CONFIG_MFD_SM501 is not set
544 471
545# 472#
546# Multimedia devices 473# Multimedia devices
547# 474#
548# CONFIG_VIDEO_DEV is not set 475# CONFIG_VIDEO_DEV is not set
549CONFIG_VIDEO_V4L2=y 476# CONFIG_DAB is not set
550 477
551# 478#
552# Digital Video Broadcasting Devices 479# Graphics support
553# 480#
481CONFIG_BACKLIGHT_LCD_SUPPORT=y
482CONFIG_LCD_CLASS_DEVICE=y
483CONFIG_BACKLIGHT_CLASS_DEVICE=y
484CONFIG_BACKLIGHT_HP680=y
554 485
555# 486#
556# Graphics support 487# Display device support
557# 488#
558CONFIG_FIRMWARE_EDID=y 489# CONFIG_DISPLAY_SUPPORT is not set
490# CONFIG_VGASTATE is not set
491CONFIG_VIDEO_OUTPUT_CONTROL=y
559CONFIG_FB=y 492CONFIG_FB=y
493CONFIG_FIRMWARE_EDID=y
494# CONFIG_FB_DDC is not set
560CONFIG_FB_CFB_FILLRECT=y 495CONFIG_FB_CFB_FILLRECT=y
561CONFIG_FB_CFB_COPYAREA=y 496CONFIG_FB_CFB_COPYAREA=y
562CONFIG_FB_CFB_IMAGEBLIT=y 497CONFIG_FB_CFB_IMAGEBLIT=y
498# CONFIG_FB_SYS_FILLRECT is not set
499# CONFIG_FB_SYS_COPYAREA is not set
500# CONFIG_FB_SYS_IMAGEBLIT is not set
501# CONFIG_FB_SYS_FOPS is not set
502CONFIG_FB_DEFERRED_IO=y
503# CONFIG_FB_SVGALIB is not set
563# CONFIG_FB_MACMODES is not set 504# CONFIG_FB_MACMODES is not set
564# CONFIG_FB_BACKLIGHT is not set 505# CONFIG_FB_BACKLIGHT is not set
565# CONFIG_FB_MODE_HELPERS is not set 506# CONFIG_FB_MODE_HELPERS is not set
566# CONFIG_FB_TILEBLITTING is not set 507# CONFIG_FB_TILEBLITTING is not set
567# CONFIG_FB_EPSON1355 is not set 508
509#
510# Frame buffer hardware drivers
511#
568# CONFIG_FB_S1D13XXX is not set 512# CONFIG_FB_S1D13XXX is not set
569CONFIG_FB_HIT=y 513CONFIG_FB_HIT=y
570# CONFIG_FB_VIRTUAL is not set 514# CONFIG_FB_VIRTUAL is not set
@@ -575,6 +519,7 @@ CONFIG_FB_HIT=y
575# CONFIG_MDA_CONSOLE is not set 519# CONFIG_MDA_CONSOLE is not set
576CONFIG_DUMMY_CONSOLE=y 520CONFIG_DUMMY_CONSOLE=y
577CONFIG_FRAMEBUFFER_CONSOLE=y 521CONFIG_FRAMEBUFFER_CONSOLE=y
522# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
578# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set 523# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
579CONFIG_FONTS=y 524CONFIG_FONTS=y
580# CONFIG_FONT_8x8 is not set 525# CONFIG_FONT_8x8 is not set
@@ -587,79 +532,49 @@ CONFIG_FONT_PEARL_8x8=y
587# CONFIG_FONT_SUN8x16 is not set 532# CONFIG_FONT_SUN8x16 is not set
588# CONFIG_FONT_SUN12x22 is not set 533# CONFIG_FONT_SUN12x22 is not set
589# CONFIG_FONT_10x18 is not set 534# CONFIG_FONT_10x18 is not set
590
591#
592# Logo configuration
593#
594# CONFIG_LOGO is not set 535# CONFIG_LOGO is not set
595# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
596 536
597# 537#
598# Sound 538# Sound
599# 539#
600CONFIG_SOUND=y 540# CONFIG_SOUND is not set
601 541# CONFIG_HID_SUPPORT is not set
602# 542# CONFIG_USB_SUPPORT is not set
603# Advanced Linux Sound Architecture
604#
605# CONFIG_SND is not set
606
607#
608# Open Sound System
609#
610CONFIG_SOUND_PRIME=y
611# CONFIG_OSS_OBSOLETE_DRIVER is not set
612# CONFIG_SOUND_MSNDCLAS is not set
613# CONFIG_SOUND_MSNDPIN is not set
614CONFIG_SOUND_SH_DAC_AUDIO=y
615CONFIG_SOUND_SH_DAC_AUDIO_CHANNEL=1
616
617#
618# USB support
619#
620# CONFIG_USB_ARCH_HAS_HCD is not set
621# CONFIG_USB_ARCH_HAS_OHCI is not set
622# CONFIG_USB_ARCH_HAS_EHCI is not set
623
624#
625# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
626#
627
628#
629# USB Gadget Support
630#
631# CONFIG_USB_GADGET is not set
632
633#
634# MMC/SD Card support
635#
636# CONFIG_MMC is not set 543# CONFIG_MMC is not set
637
638#
639# LED devices
640#
641# CONFIG_NEW_LEDS is not set 544# CONFIG_NEW_LEDS is not set
545CONFIG_RTC_LIB=y
546CONFIG_RTC_CLASS=y
547CONFIG_RTC_HCTOSYS=y
548CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
549# CONFIG_RTC_DEBUG is not set
642 550
643# 551#
644# LED drivers 552# RTC interfaces
645#
646
647#
648# LED Triggers
649# 553#
554CONFIG_RTC_INTF_SYSFS=y
555CONFIG_RTC_INTF_PROC=y
556CONFIG_RTC_INTF_DEV=y
557# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
558# CONFIG_RTC_DRV_TEST is not set
650 559
651# 560#
652# InfiniBand support 561# SPI RTC drivers
653# 562#
654 563
655# 564#
656# EDAC - error detection and reporting (RAS) (EXPERIMENTAL) 565# Platform RTC drivers
657# 566#
567# CONFIG_RTC_DRV_DS1553 is not set
568# CONFIG_RTC_DRV_STK17TA8 is not set
569# CONFIG_RTC_DRV_DS1742 is not set
570# CONFIG_RTC_DRV_M48T86 is not set
571# CONFIG_RTC_DRV_M48T59 is not set
572# CONFIG_RTC_DRV_V3020 is not set
658 573
659# 574#
660# Real Time Clock 575# on-CPU RTC drivers
661# 576#
662# CONFIG_RTC_CLASS is not set 577CONFIG_RTC_DRV_SH=y
663 578
664# 579#
665# DMA Engine support 580# DMA Engine support
@@ -675,16 +590,23 @@ CONFIG_SOUND_SH_DAC_AUDIO_CHANNEL=1
675# 590#
676 591
677# 592#
593# Userspace I/O
594#
595# CONFIG_UIO is not set
596
597#
678# File systems 598# File systems
679# 599#
680CONFIG_EXT2_FS=y 600CONFIG_EXT2_FS=y
681# CONFIG_EXT2_FS_XATTR is not set 601# CONFIG_EXT2_FS_XATTR is not set
682# CONFIG_EXT2_FS_XIP is not set 602# CONFIG_EXT2_FS_XIP is not set
683# CONFIG_EXT3_FS is not set 603# CONFIG_EXT3_FS is not set
604# CONFIG_EXT4DEV_FS is not set
684# CONFIG_REISERFS_FS is not set 605# CONFIG_REISERFS_FS is not set
685# CONFIG_JFS_FS is not set 606# CONFIG_JFS_FS is not set
686# CONFIG_FS_POSIX_ACL is not set 607# CONFIG_FS_POSIX_ACL is not set
687# CONFIG_XFS_FS is not set 608# CONFIG_XFS_FS is not set
609# CONFIG_GFS2_FS is not set
688# CONFIG_MINIX_FS is not set 610# CONFIG_MINIX_FS is not set
689# CONFIG_ROMFS_FS is not set 611# CONFIG_ROMFS_FS is not set
690CONFIG_INOTIFY=y 612CONFIG_INOTIFY=y
@@ -705,7 +627,7 @@ CONFIG_DNOTIFY=y
705# DOS/FAT/NT Filesystems 627# DOS/FAT/NT Filesystems
706# 628#
707CONFIG_FAT_FS=y 629CONFIG_FAT_FS=y
708# CONFIG_MSDOS_FS is not set 630CONFIG_MSDOS_FS=y
709CONFIG_VFAT_FS=y 631CONFIG_VFAT_FS=y
710CONFIG_FAT_DEFAULT_CODEPAGE=437 632CONFIG_FAT_DEFAULT_CODEPAGE=437
711CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" 633CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
@@ -755,7 +677,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
755# CONFIG_NLS_CODEPAGE_437 is not set 677# CONFIG_NLS_CODEPAGE_437 is not set
756# CONFIG_NLS_CODEPAGE_737 is not set 678# CONFIG_NLS_CODEPAGE_737 is not set
757# CONFIG_NLS_CODEPAGE_775 is not set 679# CONFIG_NLS_CODEPAGE_775 is not set
758# CONFIG_NLS_CODEPAGE_850 is not set 680CONFIG_NLS_CODEPAGE_850=y
759# CONFIG_NLS_CODEPAGE_852 is not set 681# CONFIG_NLS_CODEPAGE_852 is not set
760# CONFIG_NLS_CODEPAGE_855 is not set 682# CONFIG_NLS_CODEPAGE_855 is not set
761# CONFIG_NLS_CODEPAGE_857 is not set 683# CONFIG_NLS_CODEPAGE_857 is not set
@@ -799,34 +721,73 @@ CONFIG_NLS_DEFAULT="iso8859-1"
799# 721#
800# Kernel hacking 722# Kernel hacking
801# 723#
724CONFIG_TRACE_IRQFLAGS_SUPPORT=y
802# CONFIG_PRINTK_TIME is not set 725# CONFIG_PRINTK_TIME is not set
803CONFIG_ENABLE_MUST_CHECK=y 726CONFIG_ENABLE_MUST_CHECK=y
804# CONFIG_MAGIC_SYSRQ is not set 727# CONFIG_MAGIC_SYSRQ is not set
805# CONFIG_UNUSED_SYMBOLS is not set 728# CONFIG_UNUSED_SYMBOLS is not set
729# CONFIG_DEBUG_FS is not set
730# CONFIG_HEADERS_CHECK is not set
806# CONFIG_DEBUG_KERNEL is not set 731# CONFIG_DEBUG_KERNEL is not set
807CONFIG_LOG_BUF_SHIFT=14
808# CONFIG_DEBUG_BUGVERBOSE is not set 732# CONFIG_DEBUG_BUGVERBOSE is not set
809# CONFIG_DEBUG_FS is not set
810# CONFIG_UNWIND_INFO is not set
811# CONFIG_SH_STANDARD_BIOS is not set 733# CONFIG_SH_STANDARD_BIOS is not set
812# CONFIG_KGDB is not set 734# CONFIG_EARLY_SCIF_CONSOLE is not set
735# CONFIG_SH_KGDB is not set
813 736
814# 737#
815# Security options 738# Security options
816# 739#
817# CONFIG_KEYS is not set 740# CONFIG_KEYS is not set
818# CONFIG_SECURITY is not set 741# CONFIG_SECURITY is not set
819 742CONFIG_CRYPTO=y
820# 743CONFIG_CRYPTO_ALGAPI=y
821# Cryptographic options 744CONFIG_CRYPTO_BLKCIPHER=y
822# 745CONFIG_CRYPTO_MANAGER=y
823# CONFIG_CRYPTO is not set 746# CONFIG_CRYPTO_HMAC is not set
747# CONFIG_CRYPTO_XCBC is not set
748# CONFIG_CRYPTO_NULL is not set
749# CONFIG_CRYPTO_MD4 is not set
750CONFIG_CRYPTO_MD5=y
751# CONFIG_CRYPTO_SHA1 is not set
752# CONFIG_CRYPTO_SHA256 is not set
753# CONFIG_CRYPTO_SHA512 is not set
754# CONFIG_CRYPTO_WP512 is not set
755# CONFIG_CRYPTO_TGR192 is not set
756# CONFIG_CRYPTO_GF128MUL is not set
757CONFIG_CRYPTO_ECB=y
758CONFIG_CRYPTO_CBC=y
759CONFIG_CRYPTO_PCBC=y
760# CONFIG_CRYPTO_LRW is not set
761# CONFIG_CRYPTO_CRYPTD is not set
762# CONFIG_CRYPTO_DES is not set
763# CONFIG_CRYPTO_FCRYPT is not set
764# CONFIG_CRYPTO_BLOWFISH is not set
765# CONFIG_CRYPTO_TWOFISH is not set
766# CONFIG_CRYPTO_SERPENT is not set
767# CONFIG_CRYPTO_AES is not set
768# CONFIG_CRYPTO_CAST5 is not set
769# CONFIG_CRYPTO_CAST6 is not set
770# CONFIG_CRYPTO_TEA is not set
771# CONFIG_CRYPTO_ARC4 is not set
772# CONFIG_CRYPTO_KHAZAD is not set
773# CONFIG_CRYPTO_ANUBIS is not set
774# CONFIG_CRYPTO_DEFLATE is not set
775# CONFIG_CRYPTO_MICHAEL_MIC is not set
776# CONFIG_CRYPTO_CRC32C is not set
777# CONFIG_CRYPTO_CAMELLIA is not set
778# CONFIG_CRYPTO_HW is not set
824 779
825# 780#
826# Library routines 781# Library routines
827# 782#
783CONFIG_BITREVERSE=y
828# CONFIG_CRC_CCITT is not set 784# CONFIG_CRC_CCITT is not set
829# CONFIG_CRC16 is not set 785CONFIG_CRC16=y
786# CONFIG_CRC_ITU_T is not set
830CONFIG_CRC32=y 787CONFIG_CRC32=y
788# CONFIG_CRC7 is not set
831# CONFIG_LIBCRC32C is not set 789# CONFIG_LIBCRC32C is not set
832CONFIG_PLIST=y 790CONFIG_PLIST=y
791CONFIG_HAS_IOMEM=y
792CONFIG_HAS_IOPORT=y
793CONFIG_HAS_DMA=y
diff --git a/arch/sh/configs/magicpanelr2_defconfig b/arch/sh/configs/magicpanelr2_defconfig
new file mode 100644
index 000000000000..f8398a5f10ee
--- /dev/null
+++ b/arch/sh/configs/magicpanelr2_defconfig
@@ -0,0 +1,925 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23-rc2
4# Fri Aug 17 12:15:16 2007
5#
6CONFIG_SUPERH=y
7CONFIG_RWSEM_GENERIC_SPINLOCK=y
8CONFIG_GENERIC_BUG=y
9CONFIG_GENERIC_FIND_NEXT_BIT=y
10CONFIG_GENERIC_HWEIGHT=y
11CONFIG_GENERIC_HARDIRQS=y
12CONFIG_GENERIC_IRQ_PROBE=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y
14CONFIG_GENERIC_TIME=y
15CONFIG_GENERIC_CLOCKEVENTS=y
16CONFIG_STACKTRACE_SUPPORT=y
17CONFIG_LOCKDEP_SUPPORT=y
18# CONFIG_ARCH_HAS_ILOG2_U32 is not set
19# CONFIG_ARCH_HAS_ILOG2_U64 is not set
20CONFIG_ARCH_NO_VIRT_TO_BUS=y
21CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
22
23#
24# General setup
25#
26CONFIG_EXPERIMENTAL=y
27CONFIG_BROKEN_ON_SMP=y
28CONFIG_INIT_ENV_ARG_LIMIT=32
29CONFIG_LOCALVERSION=""
30# CONFIG_LOCALVERSION_AUTO is not set
31CONFIG_SWAP=y
32CONFIG_SYSVIPC=y
33CONFIG_SYSVIPC_SYSCTL=y
34CONFIG_POSIX_MQUEUE=y
35CONFIG_BSD_PROCESS_ACCT=y
36CONFIG_BSD_PROCESS_ACCT_V3=y
37# CONFIG_TASKSTATS is not set
38# CONFIG_USER_NS is not set
39CONFIG_AUDIT=y
40# CONFIG_IKCONFIG is not set
41CONFIG_LOG_BUF_SHIFT=17
42CONFIG_SYSFS_DEPRECATED=y
43CONFIG_RELAY=y
44CONFIG_BLK_DEV_INITRD=y
45CONFIG_INITRAMFS_SOURCE=""
46# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
47CONFIG_SYSCTL=y
48CONFIG_EMBEDDED=y
49CONFIG_UID16=y
50CONFIG_SYSCTL_SYSCALL=y
51CONFIG_KALLSYMS=y
52CONFIG_KALLSYMS_ALL=y
53# CONFIG_KALLSYMS_EXTRA_PASS is not set
54CONFIG_HOTPLUG=y
55CONFIG_PRINTK=y
56CONFIG_BUG=y
57CONFIG_ELF_CORE=y
58CONFIG_BASE_FULL=y
59CONFIG_FUTEX=y
60CONFIG_ANON_INODES=y
61CONFIG_EPOLL=y
62CONFIG_SIGNALFD=y
63CONFIG_TIMERFD=y
64CONFIG_EVENTFD=y
65CONFIG_SHMEM=y
66CONFIG_VM_EVENT_COUNTERS=y
67CONFIG_SLAB=y
68# CONFIG_SLUB is not set
69# CONFIG_SLOB is not set
70CONFIG_RT_MUTEXES=y
71# CONFIG_TINY_SHMEM is not set
72CONFIG_BASE_SMALL=0
73CONFIG_MODULES=y
74CONFIG_MODULE_UNLOAD=y
75# CONFIG_MODULE_FORCE_UNLOAD is not set
76CONFIG_MODVERSIONS=y
77CONFIG_MODULE_SRCVERSION_ALL=y
78CONFIG_KMOD=y
79CONFIG_BLOCK=y
80# CONFIG_LBD is not set
81# CONFIG_BLK_DEV_IO_TRACE is not set
82# CONFIG_LSF is not set
83# CONFIG_BLK_DEV_BSG is not set
84
85#
86# IO Schedulers
87#
88CONFIG_IOSCHED_NOOP=y
89# CONFIG_IOSCHED_AS is not set
90# CONFIG_IOSCHED_DEADLINE is not set
91# CONFIG_IOSCHED_CFQ is not set
92# CONFIG_DEFAULT_AS is not set
93# CONFIG_DEFAULT_DEADLINE is not set
94# CONFIG_DEFAULT_CFQ is not set
95CONFIG_DEFAULT_NOOP=y
96CONFIG_DEFAULT_IOSCHED="noop"
97
98#
99# System type
100#
101CONFIG_CPU_SH3=y
102# CONFIG_CPU_SUBTYPE_SH7619 is not set
103# CONFIG_CPU_SUBTYPE_SH7206 is not set
104# CONFIG_CPU_SUBTYPE_SH7705 is not set
105# CONFIG_CPU_SUBTYPE_SH7706 is not set
106# CONFIG_CPU_SUBTYPE_SH7707 is not set
107# CONFIG_CPU_SUBTYPE_SH7708 is not set
108# CONFIG_CPU_SUBTYPE_SH7709 is not set
109# CONFIG_CPU_SUBTYPE_SH7710 is not set
110# CONFIG_CPU_SUBTYPE_SH7712 is not set
111CONFIG_CPU_SUBTYPE_SH7720=y
112# CONFIG_CPU_SUBTYPE_SH7750 is not set
113# CONFIG_CPU_SUBTYPE_SH7091 is not set
114# CONFIG_CPU_SUBTYPE_SH7750R is not set
115# CONFIG_CPU_SUBTYPE_SH7750S is not set
116# CONFIG_CPU_SUBTYPE_SH7751 is not set
117# CONFIG_CPU_SUBTYPE_SH7751R is not set
118# CONFIG_CPU_SUBTYPE_SH7760 is not set
119# CONFIG_CPU_SUBTYPE_SH4_202 is not set
120# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
121# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
122# CONFIG_CPU_SUBTYPE_SH7770 is not set
123# CONFIG_CPU_SUBTYPE_SH7780 is not set
124# CONFIG_CPU_SUBTYPE_SH7785 is not set
125# CONFIG_CPU_SUBTYPE_SHX3 is not set
126# CONFIG_CPU_SUBTYPE_SH7343 is not set
127# CONFIG_CPU_SUBTYPE_SH7722 is not set
128
129#
130# Memory management options
131#
132CONFIG_QUICKLIST=y
133CONFIG_MMU=y
134CONFIG_PAGE_OFFSET=0x80000000
135CONFIG_MEMORY_START=0x0C000000
136CONFIG_MEMORY_SIZE=0x03F00000
137CONFIG_VSYSCALL=y
138CONFIG_ARCH_FLATMEM_ENABLE=y
139CONFIG_ARCH_SPARSEMEM_ENABLE=y
140CONFIG_ARCH_SPARSEMEM_DEFAULT=y
141CONFIG_MAX_ACTIVE_REGIONS=1
142CONFIG_ARCH_POPULATES_NODE_MAP=y
143CONFIG_ARCH_SELECT_MEMORY_MODEL=y
144CONFIG_PAGE_SIZE_4KB=y
145# CONFIG_PAGE_SIZE_8KB is not set
146# CONFIG_PAGE_SIZE_64KB is not set
147CONFIG_SELECT_MEMORY_MODEL=y
148CONFIG_FLATMEM_MANUAL=y
149# CONFIG_DISCONTIGMEM_MANUAL is not set
150# CONFIG_SPARSEMEM_MANUAL is not set
151CONFIG_FLATMEM=y
152CONFIG_FLAT_NODE_MEM_MAP=y
153CONFIG_SPARSEMEM_STATIC=y
154CONFIG_SPLIT_PTLOCK_CPUS=4
155# CONFIG_RESOURCES_64BIT is not set
156CONFIG_ZONE_DMA_FLAG=0
157CONFIG_NR_QUICK=2
158
159#
160# Cache configuration
161#
162# CONFIG_SH_DIRECT_MAPPED is not set
163CONFIG_CACHE_WRITEBACK=y
164# CONFIG_CACHE_WRITETHROUGH is not set
165# CONFIG_CACHE_OFF is not set
166
167#
168# Processor features
169#
170CONFIG_CPU_LITTLE_ENDIAN=y
171# CONFIG_CPU_BIG_ENDIAN is not set
172# CONFIG_SH_FPU_EMU is not set
173CONFIG_SH_DSP=y
174CONFIG_SH_ADC=y
175CONFIG_CPU_HAS_INTEVT=y
176CONFIG_CPU_HAS_INTC_IRQ=y
177CONFIG_CPU_HAS_SR_RB=y
178CONFIG_CPU_HAS_DSP=y
179
180#
181# Board support
182#
183CONFIG_SH_MAGIC_PANEL_R2=y
184
185#
186# Magic Panel R2 options
187#
188CONFIG_SH_MAGIC_PANEL_R2_VERSION=3
189
190#
191# Timer and clock configuration
192#
193CONFIG_SH_TMU=y
194CONFIG_SH_TIMER_IRQ=16
195CONFIG_SH_PCLK_FREQ=24000000
196# CONFIG_TICK_ONESHOT is not set
197# CONFIG_NO_HZ is not set
198# CONFIG_HIGH_RES_TIMERS is not set
199
200#
201# CPU Frequency scaling
202#
203# CONFIG_CPU_FREQ is not set
204
205#
206# DMA support
207#
208CONFIG_SH_DMA_API=y
209CONFIG_SH_DMA=y
210CONFIG_NR_ONCHIP_DMA_CHANNELS=6
211# CONFIG_NR_DMA_CHANNELS_BOOL is not set
212
213#
214# Companion Chips
215#
216
217#
218# Additional SuperH Device Drivers
219#
220CONFIG_HEARTBEAT=y
221# CONFIG_PUSH_SWITCH is not set
222
223#
224# Kernel features
225#
226# CONFIG_HZ_100 is not set
227CONFIG_HZ_250=y
228# CONFIG_HZ_300 is not set
229# CONFIG_HZ_1000 is not set
230CONFIG_HZ=250
231# CONFIG_KEXEC is not set
232# CONFIG_CRASH_DUMP is not set
233CONFIG_PREEMPT_NONE=y
234# CONFIG_PREEMPT_VOLUNTARY is not set
235# CONFIG_PREEMPT is not set
236
237#
238# Boot options
239#
240CONFIG_ZERO_PAGE_OFFSET=0x00001000
241CONFIG_BOOT_LINK_OFFSET=0x00800000
242# CONFIG_CMDLINE_BOOL is not set
243
244#
245# Bus options
246#
247# CONFIG_ARCH_SUPPORTS_MSI is not set
248
249#
250# PCCARD (PCMCIA/CardBus) support
251#
252# CONFIG_PCCARD is not set
253
254#
255# Executable file formats
256#
257CONFIG_BINFMT_ELF=y
258# CONFIG_BINFMT_MISC is not set
259
260#
261# Networking
262#
263CONFIG_NET=y
264
265#
266# Networking options
267#
268CONFIG_PACKET=y
269CONFIG_PACKET_MMAP=y
270CONFIG_UNIX=y
271# CONFIG_NET_KEY is not set
272CONFIG_INET=y
273# CONFIG_IP_MULTICAST is not set
274# CONFIG_IP_ADVANCED_ROUTER is not set
275CONFIG_IP_FIB_HASH=y
276CONFIG_IP_PNP=y
277CONFIG_IP_PNP_DHCP=y
278# CONFIG_IP_PNP_BOOTP is not set
279# CONFIG_IP_PNP_RARP is not set
280# CONFIG_NET_IPIP is not set
281# CONFIG_NET_IPGRE is not set
282# CONFIG_ARPD is not set
283# CONFIG_SYN_COOKIES is not set
284# CONFIG_INET_AH is not set
285# CONFIG_INET_ESP is not set
286# CONFIG_INET_IPCOMP is not set
287# CONFIG_INET_XFRM_TUNNEL is not set
288# CONFIG_INET_TUNNEL is not set
289# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
290# CONFIG_INET_XFRM_MODE_TUNNEL is not set
291# CONFIG_INET_XFRM_MODE_BEET is not set
292CONFIG_INET_DIAG=y
293CONFIG_INET_TCP_DIAG=y
294# CONFIG_TCP_CONG_ADVANCED is not set
295CONFIG_TCP_CONG_CUBIC=y
296CONFIG_DEFAULT_TCP_CONG="cubic"
297# CONFIG_TCP_MD5SIG is not set
298# CONFIG_IPV6 is not set
299# CONFIG_INET6_XFRM_TUNNEL is not set
300# CONFIG_INET6_TUNNEL is not set
301# CONFIG_NETWORK_SECMARK is not set
302# CONFIG_NETFILTER is not set
303# CONFIG_IP_DCCP is not set
304# CONFIG_IP_SCTP is not set
305# CONFIG_TIPC is not set
306# CONFIG_ATM is not set
307# CONFIG_BRIDGE is not set
308# CONFIG_VLAN_8021Q is not set
309# CONFIG_DECNET is not set
310# CONFIG_LLC2 is not set
311# CONFIG_IPX is not set
312# CONFIG_ATALK is not set
313# CONFIG_X25 is not set
314# CONFIG_LAPB is not set
315# CONFIG_ECONET is not set
316# CONFIG_WAN_ROUTER is not set
317
318#
319# QoS and/or fair queueing
320#
321# CONFIG_NET_SCHED is not set
322
323#
324# Network testing
325#
326# CONFIG_NET_PKTGEN is not set
327# CONFIG_HAMRADIO is not set
328# CONFIG_IRDA is not set
329# CONFIG_BT is not set
330# CONFIG_AF_RXRPC is not set
331
332#
333# Wireless
334#
335# CONFIG_CFG80211 is not set
336# CONFIG_WIRELESS_EXT is not set
337# CONFIG_MAC80211 is not set
338# CONFIG_IEEE80211 is not set
339# CONFIG_RFKILL is not set
340# CONFIG_NET_9P is not set
341
342#
343# Device Drivers
344#
345
346#
347# Generic Driver Options
348#
349# CONFIG_STANDALONE is not set
350# CONFIG_PREVENT_FIRMWARE_BUILD is not set
351CONFIG_FW_LOADER=y
352# CONFIG_DEBUG_DRIVER is not set
353# CONFIG_DEBUG_DEVRES is not set
354# CONFIG_SYS_HYPERVISOR is not set
355# CONFIG_CONNECTOR is not set
356CONFIG_MTD=y
357# CONFIG_MTD_DEBUG is not set
358# CONFIG_MTD_CONCAT is not set
359CONFIG_MTD_PARTITIONS=y
360CONFIG_MTD_REDBOOT_PARTS=y
361CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
362# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
363# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
364CONFIG_MTD_CMDLINE_PARTS=y
365
366#
367# User Modules And Translation Layers
368#
369CONFIG_MTD_CHAR=y
370CONFIG_MTD_BLKDEVS=y
371CONFIG_MTD_BLOCK=y
372# CONFIG_FTL is not set
373# CONFIG_NFTL is not set
374# CONFIG_INFTL is not set
375# CONFIG_RFD_FTL is not set
376# CONFIG_SSFDC is not set
377
378#
379# RAM/ROM/Flash chip drivers
380#
381CONFIG_MTD_CFI=y
382# CONFIG_MTD_JEDECPROBE is not set
383CONFIG_MTD_GEN_PROBE=y
384# CONFIG_MTD_CFI_ADV_OPTIONS is not set
385CONFIG_MTD_MAP_BANK_WIDTH_1=y
386CONFIG_MTD_MAP_BANK_WIDTH_2=y
387CONFIG_MTD_MAP_BANK_WIDTH_4=y
388# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
389# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
390# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
391CONFIG_MTD_CFI_I1=y
392CONFIG_MTD_CFI_I2=y
393# CONFIG_MTD_CFI_I4 is not set
394# CONFIG_MTD_CFI_I8 is not set
395# CONFIG_MTD_CFI_INTELEXT is not set
396CONFIG_MTD_CFI_AMDSTD=y
397# CONFIG_MTD_CFI_STAA is not set
398CONFIG_MTD_CFI_UTIL=y
399# CONFIG_MTD_RAM is not set
400# CONFIG_MTD_ROM is not set
401# CONFIG_MTD_ABSENT is not set
402
403#
404# Mapping drivers for chip access
405#
406# CONFIG_MTD_COMPLEX_MAPPINGS is not set
407CONFIG_MTD_PHYSMAP=y
408CONFIG_MTD_PHYSMAP_START=0x0000000
409CONFIG_MTD_PHYSMAP_LEN=0
410CONFIG_MTD_PHYSMAP_BANKWIDTH=0
411# CONFIG_MTD_SOLUTIONENGINE is not set
412# CONFIG_MTD_PLATRAM is not set
413
414#
415# Self-contained MTD device drivers
416#
417# CONFIG_MTD_SLRAM is not set
418# CONFIG_MTD_PHRAM is not set
419# CONFIG_MTD_MTDRAM is not set
420# CONFIG_MTD_BLOCK2MTD is not set
421
422#
423# Disk-On-Chip Device Drivers
424#
425# CONFIG_MTD_DOC2000 is not set
426# CONFIG_MTD_DOC2001 is not set
427# CONFIG_MTD_DOC2001PLUS is not set
428# CONFIG_MTD_NAND is not set
429# CONFIG_MTD_ONENAND is not set
430
431#
432# UBI - Unsorted block images
433#
434# CONFIG_MTD_UBI is not set
435# CONFIG_PARPORT is not set
436CONFIG_BLK_DEV=y
437# CONFIG_BLK_DEV_COW_COMMON is not set
438# CONFIG_BLK_DEV_LOOP is not set
439# CONFIG_BLK_DEV_NBD is not set
440CONFIG_BLK_DEV_RAM=y
441CONFIG_BLK_DEV_RAM_COUNT=16
442CONFIG_BLK_DEV_RAM_SIZE=65536
443CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
444# CONFIG_CDROM_PKTCDVD is not set
445# CONFIG_ATA_OVER_ETH is not set
446CONFIG_MISC_DEVICES=y
447# CONFIG_EEPROM_93CX6 is not set
448# CONFIG_IDE is not set
449
450#
451# SCSI device support
452#
453# CONFIG_RAID_ATTRS is not set
454# CONFIG_SCSI is not set
455# CONFIG_SCSI_DMA is not set
456# CONFIG_SCSI_NETLINK is not set
457# CONFIG_ATA is not set
458# CONFIG_MD is not set
459CONFIG_NETDEVICES=y
460# CONFIG_NETDEVICES_MULTIQUEUE is not set
461# CONFIG_DUMMY is not set
462# CONFIG_BONDING is not set
463# CONFIG_MACVLAN is not set
464# CONFIG_EQUALIZER is not set
465# CONFIG_TUN is not set
466# CONFIG_PHYLIB is not set
467CONFIG_NET_ETHERNET=y
468CONFIG_MII=y
469# CONFIG_STNIC is not set
470# CONFIG_SMC91X is not set
471CONFIG_SMC911X=y
472# CONFIG_NETDEV_1000 is not set
473# CONFIG_NETDEV_10000 is not set
474
475#
476# Wireless LAN
477#
478# CONFIG_WLAN_PRE80211 is not set
479# CONFIG_WLAN_80211 is not set
480# CONFIG_WAN is not set
481# CONFIG_PPP is not set
482# CONFIG_SLIP is not set
483# CONFIG_SHAPER is not set
484# CONFIG_NETCONSOLE is not set
485# CONFIG_NETPOLL is not set
486# CONFIG_NET_POLL_CONTROLLER is not set
487# CONFIG_ISDN is not set
488# CONFIG_PHONE is not set
489
490#
491# Input device support
492#
493CONFIG_INPUT=y
494# CONFIG_INPUT_FF_MEMLESS is not set
495# CONFIG_INPUT_POLLDEV is not set
496
497#
498# Userland interfaces
499#
500CONFIG_INPUT_MOUSEDEV=y
501CONFIG_INPUT_MOUSEDEV_PSAUX=y
502CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
503CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
504# CONFIG_INPUT_JOYDEV is not set
505# CONFIG_INPUT_TSDEV is not set
506CONFIG_INPUT_EVDEV=y
507# CONFIG_INPUT_EVBUG is not set
508
509#
510# Input Device Drivers
511#
512CONFIG_INPUT_KEYBOARD=y
513CONFIG_KEYBOARD_ATKBD=y
514# CONFIG_KEYBOARD_SUNKBD is not set
515# CONFIG_KEYBOARD_LKKBD is not set
516# CONFIG_KEYBOARD_XTKBD is not set
517# CONFIG_KEYBOARD_NEWTON is not set
518# CONFIG_KEYBOARD_STOWAWAY is not set
519CONFIG_INPUT_MOUSE=y
520# CONFIG_MOUSE_PS2 is not set
521# CONFIG_MOUSE_SERIAL is not set
522# CONFIG_MOUSE_VSXXXAA is not set
523# CONFIG_INPUT_JOYSTICK is not set
524# CONFIG_INPUT_TABLET is not set
525# CONFIG_INPUT_TOUCHSCREEN is not set
526# CONFIG_INPUT_MISC is not set
527
528#
529# Hardware I/O ports
530#
531CONFIG_SERIO=y
532# CONFIG_SERIO_I8042 is not set
533CONFIG_SERIO_SERPORT=y
534CONFIG_SERIO_LIBPS2=y
535# CONFIG_SERIO_RAW is not set
536# CONFIG_GAMEPORT is not set
537
538#
539# Character devices
540#
541CONFIG_VT=y
542CONFIG_VT_CONSOLE=y
543CONFIG_HW_CONSOLE=y
544# CONFIG_VT_HW_CONSOLE_BINDING is not set
545# CONFIG_SERIAL_NONSTANDARD is not set
546
547#
548# Serial drivers
549#
550CONFIG_SERIAL_8250=y
551CONFIG_SERIAL_8250_CONSOLE=y
552CONFIG_SERIAL_8250_NR_UARTS=48
553CONFIG_SERIAL_8250_RUNTIME_UARTS=4
554CONFIG_SERIAL_8250_EXTENDED=y
555# CONFIG_SERIAL_8250_MANY_PORTS is not set
556CONFIG_SERIAL_8250_SHARE_IRQ=y
557# CONFIG_SERIAL_8250_DETECT_IRQ is not set
558# CONFIG_SERIAL_8250_RSA is not set
559
560#
561# Non-8250 serial port support
562#
563CONFIG_SERIAL_SH_SCI=y
564CONFIG_SERIAL_SH_SCI_NR_UARTS=2
565CONFIG_SERIAL_SH_SCI_CONSOLE=y
566CONFIG_SERIAL_CORE=y
567CONFIG_SERIAL_CORE_CONSOLE=y
568CONFIG_UNIX98_PTYS=y
569CONFIG_LEGACY_PTYS=y
570CONFIG_LEGACY_PTY_COUNT=256
571# CONFIG_IPMI_HANDLER is not set
572# CONFIG_WATCHDOG is not set
573# CONFIG_HW_RANDOM is not set
574# CONFIG_R3964 is not set
575# CONFIG_RAW_DRIVER is not set
576# CONFIG_TCG_TPM is not set
577# CONFIG_I2C is not set
578
579#
580# SPI support
581#
582# CONFIG_SPI is not set
583# CONFIG_SPI_MASTER is not set
584# CONFIG_W1 is not set
585# CONFIG_POWER_SUPPLY is not set
586# CONFIG_HWMON is not set
587
588#
589# Multifunction device drivers
590#
591# CONFIG_MFD_SM501 is not set
592
593#
594# Multimedia devices
595#
596# CONFIG_VIDEO_DEV is not set
597# CONFIG_DVB_CORE is not set
598CONFIG_DAB=y
599
600#
601# Graphics support
602#
603# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
604
605#
606# Display device support
607#
608# CONFIG_DISPLAY_SUPPORT is not set
609# CONFIG_VGASTATE is not set
610# CONFIG_VIDEO_OUTPUT_CONTROL is not set
611# CONFIG_FB is not set
612
613#
614# Console display driver support
615#
616CONFIG_DUMMY_CONSOLE=y
617
618#
619# Sound
620#
621# CONFIG_SOUND is not set
622# CONFIG_HID_SUPPORT is not set
623# CONFIG_USB_SUPPORT is not set
624# CONFIG_MMC is not set
625# CONFIG_NEW_LEDS is not set
626CONFIG_RTC_LIB=y
627CONFIG_RTC_CLASS=y
628# CONFIG_RTC_HCTOSYS is not set
629# CONFIG_RTC_DEBUG is not set
630
631#
632# RTC interfaces
633#
634CONFIG_RTC_INTF_SYSFS=y
635CONFIG_RTC_INTF_PROC=y
636CONFIG_RTC_INTF_DEV=y
637# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
638# CONFIG_RTC_DRV_TEST is not set
639
640#
641# SPI RTC drivers
642#
643
644#
645# Platform RTC drivers
646#
647# CONFIG_RTC_DRV_DS1553 is not set
648# CONFIG_RTC_DRV_STK17TA8 is not set
649# CONFIG_RTC_DRV_DS1742 is not set
650# CONFIG_RTC_DRV_M48T86 is not set
651# CONFIG_RTC_DRV_M48T59 is not set
652# CONFIG_RTC_DRV_V3020 is not set
653
654#
655# on-CPU RTC drivers
656#
657CONFIG_RTC_DRV_SH=y
658
659#
660# DMA Engine support
661#
662# CONFIG_DMA_ENGINE is not set
663
664#
665# DMA Clients
666#
667
668#
669# DMA Devices
670#
671
672#
673# Userspace I/O
674#
675# CONFIG_UIO is not set
676
677#
678# File systems
679#
680CONFIG_EXT2_FS=y
681# CONFIG_EXT2_FS_XATTR is not set
682# CONFIG_EXT2_FS_XIP is not set
683CONFIG_EXT3_FS=y
684# CONFIG_EXT3_FS_XATTR is not set
685# CONFIG_EXT4DEV_FS is not set
686CONFIG_JBD=y
687# CONFIG_JBD_DEBUG is not set
688# CONFIG_REISERFS_FS is not set
689# CONFIG_JFS_FS is not set
690# CONFIG_FS_POSIX_ACL is not set
691# CONFIG_XFS_FS is not set
692# CONFIG_GFS2_FS is not set
693# CONFIG_OCFS2_FS is not set
694# CONFIG_MINIX_FS is not set
695# CONFIG_ROMFS_FS is not set
696# CONFIG_INOTIFY is not set
697# CONFIG_QUOTA is not set
698# CONFIG_DNOTIFY is not set
699# CONFIG_AUTOFS_FS is not set
700# CONFIG_AUTOFS4_FS is not set
701# CONFIG_FUSE_FS is not set
702
703#
704# CD-ROM/DVD Filesystems
705#
706# CONFIG_ISO9660_FS is not set
707# CONFIG_UDF_FS is not set
708
709#
710# DOS/FAT/NT Filesystems
711#
712# CONFIG_MSDOS_FS is not set
713# CONFIG_VFAT_FS is not set
714# CONFIG_NTFS_FS is not set
715
716#
717# Pseudo filesystems
718#
719CONFIG_PROC_FS=y
720CONFIG_PROC_KCORE=y
721CONFIG_PROC_SYSCTL=y
722CONFIG_SYSFS=y
723CONFIG_TMPFS=y
724# CONFIG_TMPFS_POSIX_ACL is not set
725# CONFIG_HUGETLBFS is not set
726# CONFIG_HUGETLB_PAGE is not set
727CONFIG_RAMFS=y
728# CONFIG_CONFIGFS_FS is not set
729
730#
731# Miscellaneous filesystems
732#
733# CONFIG_ADFS_FS is not set
734# CONFIG_AFFS_FS is not set
735# CONFIG_HFS_FS is not set
736# CONFIG_HFSPLUS_FS is not set
737# CONFIG_BEFS_FS is not set
738# CONFIG_BFS_FS is not set
739# CONFIG_EFS_FS is not set
740CONFIG_JFFS2_FS=y
741CONFIG_JFFS2_FS_DEBUG=0
742# CONFIG_JFFS2_FS_WRITEBUFFER is not set
743# CONFIG_JFFS2_SUMMARY is not set
744# CONFIG_JFFS2_FS_XATTR is not set
745# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
746CONFIG_JFFS2_ZLIB=y
747CONFIG_JFFS2_RTIME=y
748# CONFIG_JFFS2_RUBIN is not set
749# CONFIG_CRAMFS is not set
750# CONFIG_VXFS_FS is not set
751# CONFIG_HPFS_FS is not set
752# CONFIG_QNX4FS_FS is not set
753# CONFIG_SYSV_FS is not set
754# CONFIG_UFS_FS is not set
755
756#
757# Network File Systems
758#
759CONFIG_NFS_FS=y
760CONFIG_NFS_V3=y
761# CONFIG_NFS_V3_ACL is not set
762# CONFIG_NFS_V4 is not set
763# CONFIG_NFS_DIRECTIO is not set
764# CONFIG_NFSD is not set
765CONFIG_ROOT_NFS=y
766CONFIG_LOCKD=y
767CONFIG_LOCKD_V4=y
768CONFIG_NFS_COMMON=y
769CONFIG_SUNRPC=y
770CONFIG_SUNRPC_BIND34=y
771# CONFIG_RPCSEC_GSS_KRB5 is not set
772# CONFIG_RPCSEC_GSS_SPKM3 is not set
773# CONFIG_SMB_FS is not set
774# CONFIG_CIFS is not set
775# CONFIG_NCP_FS is not set
776# CONFIG_CODA_FS is not set
777# CONFIG_AFS_FS is not set
778
779#
780# Partition Types
781#
782# CONFIG_PARTITION_ADVANCED is not set
783CONFIG_MSDOS_PARTITION=y
784
785#
786# Native Language Support
787#
788CONFIG_NLS=y
789CONFIG_NLS_DEFAULT="cp437"
790CONFIG_NLS_CODEPAGE_437=y
791# CONFIG_NLS_CODEPAGE_737 is not set
792# CONFIG_NLS_CODEPAGE_775 is not set
793CONFIG_NLS_CODEPAGE_850=y
794# CONFIG_NLS_CODEPAGE_852 is not set
795# CONFIG_NLS_CODEPAGE_855 is not set
796# CONFIG_NLS_CODEPAGE_857 is not set
797# CONFIG_NLS_CODEPAGE_860 is not set
798# CONFIG_NLS_CODEPAGE_861 is not set
799# CONFIG_NLS_CODEPAGE_862 is not set
800# CONFIG_NLS_CODEPAGE_863 is not set
801# CONFIG_NLS_CODEPAGE_864 is not set
802# CONFIG_NLS_CODEPAGE_865 is not set
803# CONFIG_NLS_CODEPAGE_866 is not set
804# CONFIG_NLS_CODEPAGE_869 is not set
805# CONFIG_NLS_CODEPAGE_936 is not set
806# CONFIG_NLS_CODEPAGE_950 is not set
807# CONFIG_NLS_CODEPAGE_932 is not set
808# CONFIG_NLS_CODEPAGE_949 is not set
809# CONFIG_NLS_CODEPAGE_874 is not set
810# CONFIG_NLS_ISO8859_8 is not set
811# CONFIG_NLS_CODEPAGE_1250 is not set
812# CONFIG_NLS_CODEPAGE_1251 is not set
813# CONFIG_NLS_ASCII is not set
814CONFIG_NLS_ISO8859_1=y
815# CONFIG_NLS_ISO8859_2 is not set
816# CONFIG_NLS_ISO8859_3 is not set
817# CONFIG_NLS_ISO8859_4 is not set
818# CONFIG_NLS_ISO8859_5 is not set
819# CONFIG_NLS_ISO8859_6 is not set
820# CONFIG_NLS_ISO8859_7 is not set
821# CONFIG_NLS_ISO8859_9 is not set
822# CONFIG_NLS_ISO8859_13 is not set
823# CONFIG_NLS_ISO8859_14 is not set
824# CONFIG_NLS_ISO8859_15 is not set
825# CONFIG_NLS_KOI8_R is not set
826# CONFIG_NLS_KOI8_U is not set
827# CONFIG_NLS_UTF8 is not set
828
829#
830# Distributed Lock Manager
831#
832# CONFIG_DLM is not set
833
834#
835# Profiling support
836#
837# CONFIG_PROFILING is not set
838
839#
840# Kernel hacking
841#
842CONFIG_TRACE_IRQFLAGS_SUPPORT=y
843# CONFIG_PRINTK_TIME is not set
844CONFIG_ENABLE_MUST_CHECK=y
845CONFIG_MAGIC_SYSRQ=y
846# CONFIG_UNUSED_SYMBOLS is not set
847# CONFIG_DEBUG_FS is not set
848# CONFIG_HEADERS_CHECK is not set
849CONFIG_DEBUG_KERNEL=y
850# CONFIG_DEBUG_SHIRQ is not set
851# CONFIG_DETECT_SOFTLOCKUP is not set
852# CONFIG_SCHED_DEBUG is not set
853# CONFIG_SCHEDSTATS is not set
854# CONFIG_TIMER_STATS is not set
855# CONFIG_DEBUG_SLAB is not set
856# CONFIG_DEBUG_RT_MUTEXES is not set
857# CONFIG_RT_MUTEX_TESTER is not set
858# CONFIG_DEBUG_SPINLOCK is not set
859# CONFIG_DEBUG_MUTEXES is not set
860# CONFIG_DEBUG_LOCK_ALLOC is not set
861# CONFIG_PROVE_LOCKING is not set
862# CONFIG_LOCK_STAT is not set
863# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
864# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
865CONFIG_DEBUG_KOBJECT=y
866CONFIG_DEBUG_BUGVERBOSE=y
867CONFIG_DEBUG_INFO=y
868# CONFIG_DEBUG_VM is not set
869# CONFIG_DEBUG_LIST is not set
870CONFIG_FRAME_POINTER=y
871# CONFIG_FORCED_INLINING is not set
872# CONFIG_RCU_TORTURE_TEST is not set
873# CONFIG_FAULT_INJECTION is not set
874# CONFIG_SH_STANDARD_BIOS is not set
875CONFIG_EARLY_SCIF_CONSOLE=y
876CONFIG_EARLY_SCIF_CONSOLE_PORT=0xa4430000
877CONFIG_EARLY_PRINTK=y
878# CONFIG_DEBUG_BOOTMEM is not set
879# CONFIG_DEBUG_STACKOVERFLOW is not set
880# CONFIG_DEBUG_STACK_USAGE is not set
881# CONFIG_4KSTACKS is not set
882CONFIG_SH_KGDB=y
883
884#
885# KGDB configuration options
886#
887# CONFIG_MORE_COMPILE_OPTIONS is not set
888# CONFIG_KGDB_NMI is not set
889CONFIG_KGDB_SYSRQ=y
890
891#
892# Serial port setup
893#
894CONFIG_KGDB_DEFPORT=0
895CONFIG_KGDB_DEFBAUD=115200
896CONFIG_KGDB_DEFPARITY_N=y
897# CONFIG_KGDB_DEFPARITY_E is not set
898# CONFIG_KGDB_DEFPARITY_O is not set
899CONFIG_KGDB_DEFBITS_8=y
900# CONFIG_KGDB_DEFBITS_7 is not set
901
902#
903# Security options
904#
905# CONFIG_KEYS is not set
906# CONFIG_SECURITY is not set
907# CONFIG_CRYPTO is not set
908
909#
910# Library routines
911#
912CONFIG_BITREVERSE=y
913CONFIG_CRC_CCITT=m
914CONFIG_CRC16=m
915# CONFIG_CRC_ITU_T is not set
916CONFIG_CRC32=y
917# CONFIG_CRC7 is not set
918# CONFIG_LIBCRC32C is not set
919CONFIG_AUDIT_GENERIC=y
920CONFIG_ZLIB_INFLATE=y
921CONFIG_ZLIB_DEFLATE=y
922CONFIG_PLIST=y
923CONFIG_HAS_IOMEM=y
924CONFIG_HAS_IOPORT=y
925CONFIG_HAS_DMA=y
diff --git a/arch/sh/configs/rts7751r2d_defconfig b/arch/sh/configs/rts7751r2d1_defconfig
index b64f73b704d6..2dc754e5b733 100644
--- a/arch/sh/configs/rts7751r2d_defconfig
+++ b/arch/sh/configs/rts7751r2d1_defconfig
@@ -1,46 +1,47 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.21-rc1 3# Linux kernel version: 2.6.23-rc2
4# Thu Mar 1 16:42:40 2007 4# Tue Aug 14 18:04:44 2007
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 7CONFIG_RWSEM_GENERIC_SPINLOCK=y
8CONFIG_GENERIC_BUG=y
8CONFIG_GENERIC_FIND_NEXT_BIT=y 9CONFIG_GENERIC_FIND_NEXT_BIT=y
9CONFIG_GENERIC_HWEIGHT=y 10CONFIG_GENERIC_HWEIGHT=y
10CONFIG_GENERIC_HARDIRQS=y 11CONFIG_GENERIC_HARDIRQS=y
11CONFIG_GENERIC_IRQ_PROBE=y 12CONFIG_GENERIC_IRQ_PROBE=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y 13CONFIG_GENERIC_CALIBRATE_DELAY=y
13# CONFIG_GENERIC_TIME is not set 14CONFIG_GENERIC_TIME=y
15CONFIG_GENERIC_CLOCKEVENTS=y
16CONFIG_SYS_SUPPORTS_PCI=y
14CONFIG_STACKTRACE_SUPPORT=y 17CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y 18CONFIG_LOCKDEP_SUPPORT=y
16# CONFIG_ARCH_HAS_ILOG2_U32 is not set 19# CONFIG_ARCH_HAS_ILOG2_U32 is not set
17# CONFIG_ARCH_HAS_ILOG2_U64 is not set 20# CONFIG_ARCH_HAS_ILOG2_U64 is not set
21CONFIG_ARCH_NO_VIRT_TO_BUS=y
18CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
19 23
20# 24#
21# Code maturity level options 25# General setup
22# 26#
23CONFIG_EXPERIMENTAL=y 27CONFIG_EXPERIMENTAL=y
24CONFIG_BROKEN_ON_SMP=y 28CONFIG_BROKEN_ON_SMP=y
25CONFIG_INIT_ENV_ARG_LIMIT=32 29CONFIG_INIT_ENV_ARG_LIMIT=32
26
27#
28# General setup
29#
30CONFIG_LOCALVERSION="" 30CONFIG_LOCALVERSION=""
31CONFIG_LOCALVERSION_AUTO=y 31CONFIG_LOCALVERSION_AUTO=y
32CONFIG_SWAP=y 32CONFIG_SWAP=y
33CONFIG_SYSVIPC=y 33CONFIG_SYSVIPC=y
34# CONFIG_IPC_NS is not set
35CONFIG_SYSVIPC_SYSCTL=y 34CONFIG_SYSVIPC_SYSCTL=y
36# CONFIG_POSIX_MQUEUE is not set 35# CONFIG_POSIX_MQUEUE is not set
37# CONFIG_BSD_PROCESS_ACCT is not set 36# CONFIG_BSD_PROCESS_ACCT is not set
38# CONFIG_TASKSTATS is not set 37# CONFIG_TASKSTATS is not set
39# CONFIG_UTS_NS is not set 38# CONFIG_USER_NS is not set
40# CONFIG_AUDIT is not set 39# CONFIG_AUDIT is not set
41# CONFIG_IKCONFIG is not set 40# CONFIG_IKCONFIG is not set
41CONFIG_LOG_BUF_SHIFT=14
42CONFIG_SYSFS_DEPRECATED=y 42CONFIG_SYSFS_DEPRECATED=y
43# CONFIG_RELAY is not set 43# CONFIG_RELAY is not set
44# CONFIG_BLK_DEV_INITRD is not set
44# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 45# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
45CONFIG_SYSCTL=y 46CONFIG_SYSCTL=y
46CONFIG_EMBEDDED=y 47CONFIG_EMBEDDED=y
@@ -54,31 +55,29 @@ CONFIG_BUG=y
54CONFIG_ELF_CORE=y 55CONFIG_ELF_CORE=y
55CONFIG_BASE_FULL=y 56CONFIG_BASE_FULL=y
56CONFIG_FUTEX=y 57CONFIG_FUTEX=y
58CONFIG_ANON_INODES=y
57CONFIG_EPOLL=y 59CONFIG_EPOLL=y
60CONFIG_SIGNALFD=y
61CONFIG_TIMERFD=y
62CONFIG_EVENTFD=y
58CONFIG_SHMEM=y 63CONFIG_SHMEM=y
59CONFIG_SLAB=y
60CONFIG_VM_EVENT_COUNTERS=y 64CONFIG_VM_EVENT_COUNTERS=y
65CONFIG_SLAB=y
66# CONFIG_SLUB is not set
67# CONFIG_SLOB is not set
61CONFIG_RT_MUTEXES=y 68CONFIG_RT_MUTEXES=y
62# CONFIG_TINY_SHMEM is not set 69# CONFIG_TINY_SHMEM is not set
63CONFIG_BASE_SMALL=0 70CONFIG_BASE_SMALL=0
64# CONFIG_SLOB is not set
65
66#
67# Loadable module support
68#
69CONFIG_MODULES=y 71CONFIG_MODULES=y
70# CONFIG_MODULE_UNLOAD is not set 72# CONFIG_MODULE_UNLOAD is not set
71# CONFIG_MODVERSIONS is not set 73# CONFIG_MODVERSIONS is not set
72# CONFIG_MODULE_SRCVERSION_ALL is not set 74# CONFIG_MODULE_SRCVERSION_ALL is not set
73# CONFIG_KMOD is not set 75# CONFIG_KMOD is not set
74
75#
76# Block layer
77#
78CONFIG_BLOCK=y 76CONFIG_BLOCK=y
79# CONFIG_LBD is not set 77# CONFIG_LBD is not set
80# CONFIG_BLK_DEV_IO_TRACE is not set 78# CONFIG_BLK_DEV_IO_TRACE is not set
81# CONFIG_LSF is not set 79# CONFIG_LSF is not set
80# CONFIG_BLK_DEV_BSG is not set
82 81
83# 82#
84# IO Schedulers 83# IO Schedulers
@@ -96,61 +95,16 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
96# 95#
97# System type 96# System type
98# 97#
99# CONFIG_SH_SOLUTION_ENGINE is not set
100# CONFIG_SH_7751_SOLUTION_ENGINE is not set
101# CONFIG_SH_7300_SOLUTION_ENGINE is not set
102# CONFIG_SH_7343_SOLUTION_ENGINE is not set
103# CONFIG_SH_73180_SOLUTION_ENGINE is not set
104# CONFIG_SH_7751_SYSTEMH is not set
105# CONFIG_SH_HP6XX is not set
106# CONFIG_SH_SATURN is not set
107# CONFIG_SH_DREAMCAST is not set
108# CONFIG_SH_MPC1211 is not set
109# CONFIG_SH_SH03 is not set
110# CONFIG_SH_SECUREEDGE5410 is not set
111# CONFIG_SH_HS7751RVOIP is not set
112# CONFIG_SH_7710VOIPGW is not set
113CONFIG_SH_RTS7751R2D=y
114# CONFIG_SH_R7780RP is not set
115# CONFIG_SH_EDOSK7705 is not set
116# CONFIG_SH_SH4202_MICRODEV is not set
117# CONFIG_SH_LANDISK is not set
118# CONFIG_SH_TITAN is not set
119# CONFIG_SH_SHMIN is not set
120# CONFIG_SH_7206_SOLUTION_ENGINE is not set
121# CONFIG_SH_7619_SOLUTION_ENGINE is not set
122# CONFIG_SH_UNKNOWN is not set
123
124#
125# Processor selection
126#
127CONFIG_CPU_SH4=y 98CONFIG_CPU_SH4=y
128
129#
130# SH-2 Processor Support
131#
132# CONFIG_CPU_SUBTYPE_SH7604 is not set
133# CONFIG_CPU_SUBTYPE_SH7619 is not set 99# CONFIG_CPU_SUBTYPE_SH7619 is not set
134
135#
136# SH-2A Processor Support
137#
138# CONFIG_CPU_SUBTYPE_SH7206 is not set 100# CONFIG_CPU_SUBTYPE_SH7206 is not set
139
140#
141# SH-3 Processor Support
142#
143# CONFIG_CPU_SUBTYPE_SH7300 is not set
144# CONFIG_CPU_SUBTYPE_SH7705 is not set 101# CONFIG_CPU_SUBTYPE_SH7705 is not set
145# CONFIG_CPU_SUBTYPE_SH7706 is not set 102# CONFIG_CPU_SUBTYPE_SH7706 is not set
146# CONFIG_CPU_SUBTYPE_SH7707 is not set 103# CONFIG_CPU_SUBTYPE_SH7707 is not set
147# CONFIG_CPU_SUBTYPE_SH7708 is not set 104# CONFIG_CPU_SUBTYPE_SH7708 is not set
148# CONFIG_CPU_SUBTYPE_SH7709 is not set 105# CONFIG_CPU_SUBTYPE_SH7709 is not set
149# CONFIG_CPU_SUBTYPE_SH7710 is not set 106# CONFIG_CPU_SUBTYPE_SH7710 is not set
150 107# CONFIG_CPU_SUBTYPE_SH7712 is not set
151#
152# SH-4 Processor Support
153#
154# CONFIG_CPU_SUBTYPE_SH7750 is not set 108# CONFIG_CPU_SUBTYPE_SH7750 is not set
155# CONFIG_CPU_SUBTYPE_SH7091 is not set 109# CONFIG_CPU_SUBTYPE_SH7091 is not set
156# CONFIG_CPU_SUBTYPE_SH7750R is not set 110# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -159,35 +113,30 @@ CONFIG_CPU_SH4=y
159CONFIG_CPU_SUBTYPE_SH7751R=y 113CONFIG_CPU_SUBTYPE_SH7751R=y
160# CONFIG_CPU_SUBTYPE_SH7760 is not set 114# CONFIG_CPU_SUBTYPE_SH7760 is not set
161# CONFIG_CPU_SUBTYPE_SH4_202 is not set 115# CONFIG_CPU_SUBTYPE_SH4_202 is not set
162
163#
164# ST40 Processor Support
165#
166# CONFIG_CPU_SUBTYPE_ST40STB1 is not set 116# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
167# CONFIG_CPU_SUBTYPE_ST40GX1 is not set 117# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
168
169#
170# SH-4A Processor Support
171#
172# CONFIG_CPU_SUBTYPE_SH7770 is not set 118# CONFIG_CPU_SUBTYPE_SH7770 is not set
173# CONFIG_CPU_SUBTYPE_SH7780 is not set 119# CONFIG_CPU_SUBTYPE_SH7780 is not set
174# CONFIG_CPU_SUBTYPE_SH7785 is not set 120# CONFIG_CPU_SUBTYPE_SH7785 is not set
175 121# CONFIG_CPU_SUBTYPE_SHX3 is not set
176#
177# SH4AL-DSP Processor Support
178#
179# CONFIG_CPU_SUBTYPE_SH73180 is not set
180# CONFIG_CPU_SUBTYPE_SH7343 is not set 122# CONFIG_CPU_SUBTYPE_SH7343 is not set
181# CONFIG_CPU_SUBTYPE_SH7722 is not set 123# CONFIG_CPU_SUBTYPE_SH7722 is not set
182 124
183# 125#
184# Memory management options 126# Memory management options
185# 127#
128CONFIG_QUICKLIST=y
186CONFIG_MMU=y 129CONFIG_MMU=y
187CONFIG_PAGE_OFFSET=0x80000000 130CONFIG_PAGE_OFFSET=0x80000000
188CONFIG_MEMORY_START=0x0c000000 131CONFIG_MEMORY_START=0x0c000000
189CONFIG_MEMORY_SIZE=0x04000000 132CONFIG_MEMORY_SIZE=0x04000000
190CONFIG_VSYSCALL=y 133CONFIG_VSYSCALL=y
134CONFIG_ARCH_FLATMEM_ENABLE=y
135CONFIG_ARCH_SPARSEMEM_ENABLE=y
136CONFIG_ARCH_SPARSEMEM_DEFAULT=y
137CONFIG_MAX_ACTIVE_REGIONS=1
138CONFIG_ARCH_POPULATES_NODE_MAP=y
139CONFIG_ARCH_SELECT_MEMORY_MODEL=y
191CONFIG_PAGE_SIZE_4KB=y 140CONFIG_PAGE_SIZE_4KB=y
192# CONFIG_PAGE_SIZE_8KB is not set 141# CONFIG_PAGE_SIZE_8KB is not set
193# CONFIG_PAGE_SIZE_64KB is not set 142# CONFIG_PAGE_SIZE_64KB is not set
@@ -197,17 +146,19 @@ CONFIG_FLATMEM_MANUAL=y
197# CONFIG_SPARSEMEM_MANUAL is not set 146# CONFIG_SPARSEMEM_MANUAL is not set
198CONFIG_FLATMEM=y 147CONFIG_FLATMEM=y
199CONFIG_FLAT_NODE_MEM_MAP=y 148CONFIG_FLAT_NODE_MEM_MAP=y
200# CONFIG_SPARSEMEM_STATIC is not set 149CONFIG_SPARSEMEM_STATIC=y
201CONFIG_SPLIT_PTLOCK_CPUS=4 150CONFIG_SPLIT_PTLOCK_CPUS=4
202# CONFIG_RESOURCES_64BIT is not set 151# CONFIG_RESOURCES_64BIT is not set
203CONFIG_ZONE_DMA_FLAG=0 152CONFIG_ZONE_DMA_FLAG=0
153CONFIG_NR_QUICK=2
204 154
205# 155#
206# Cache configuration 156# Cache configuration
207# 157#
208# CONFIG_SH_DIRECT_MAPPED is not set 158# CONFIG_SH_DIRECT_MAPPED is not set
209# CONFIG_SH_WRITETHROUGH is not set 159CONFIG_CACHE_WRITEBACK=y
210# CONFIG_SH_OCRAM is not set 160# CONFIG_CACHE_WRITETHROUGH is not set
161# CONFIG_CACHE_OFF is not set
211 162
212# 163#
213# Processor features 164# Processor features
@@ -215,7 +166,6 @@ CONFIG_ZONE_DMA_FLAG=0
215CONFIG_CPU_LITTLE_ENDIAN=y 166CONFIG_CPU_LITTLE_ENDIAN=y
216# CONFIG_CPU_BIG_ENDIAN is not set 167# CONFIG_CPU_BIG_ENDIAN is not set
217CONFIG_SH_FPU=y 168CONFIG_SH_FPU=y
218# CONFIG_SH_DSP is not set
219# CONFIG_SH_STORE_QUEUES is not set 169# CONFIG_SH_STORE_QUEUES is not set
220CONFIG_CPU_HAS_INTEVT=y 170CONFIG_CPU_HAS_INTEVT=y
221CONFIG_CPU_HAS_INTC_IRQ=y 171CONFIG_CPU_HAS_INTC_IRQ=y
@@ -223,17 +173,31 @@ CONFIG_CPU_HAS_SR_RB=y
223CONFIG_CPU_HAS_PTEA=y 173CONFIG_CPU_HAS_PTEA=y
224 174
225# 175#
226# Timer support 176# Board support
227# 177#
228CONFIG_SH_TMU=y 178# CONFIG_SH_7751_SYSTEMH is not set
179# CONFIG_SH_SECUREEDGE5410 is not set
180# CONFIG_SH_HS7751RVOIP is not set
181CONFIG_SH_RTS7751R2D=y
182# CONFIG_SH_LANDISK is not set
183# CONFIG_SH_TITAN is not set
184# CONFIG_SH_LBOX_RE2 is not set
229 185
230# 186#
231# RTS7751R2D options 187# RTS7751R2D options
232# 188#
233CONFIG_RTS7751R2D_REV11=y 189# CONFIG_RTS7751R2D_PLUS is not set
190CONFIG_RTS7751R2D_1=y
191
192#
193# Timer and clock configuration
194#
195CONFIG_SH_TMU=y
234CONFIG_SH_TIMER_IRQ=16 196CONFIG_SH_TIMER_IRQ=16
235# CONFIG_NO_IDLE_HZ is not set
236CONFIG_SH_PCLK_FREQ=60000000 197CONFIG_SH_PCLK_FREQ=60000000
198# CONFIG_TICK_ONESHOT is not set
199# CONFIG_NO_HZ is not set
200# CONFIG_HIGH_RES_TIMERS is not set
237 201
238# 202#
239# CPU Frequency scaling 203# CPU Frequency scaling
@@ -244,19 +208,15 @@ CONFIG_SH_PCLK_FREQ=60000000
244# DMA support 208# DMA support
245# 209#
246# CONFIG_SH_DMA is not set 210# CONFIG_SH_DMA is not set
247# CONFIG_NR_ONCHIP_DMA_CHANNELS is not set
248# CONFIG_NR_DMA_CHANNELS_BOOL is not set
249 211
250# 212#
251# Companion Chips 213# Companion Chips
252# 214#
253CONFIG_VOYAGERGX=y
254# CONFIG_HD6446X_SERIES is not set
255CONFIG_HEARTBEAT=y
256 215
257# 216#
258# Additional SuperH Device Drivers 217# Additional SuperH Device Drivers
259# 218#
219CONFIG_HEARTBEAT=y
260# CONFIG_PUSH_SWITCH is not set 220# CONFIG_PUSH_SWITCH is not set
261 221
262# 222#
@@ -268,7 +228,7 @@ CONFIG_HZ_250=y
268# CONFIG_HZ_1000 is not set 228# CONFIG_HZ_1000 is not set
269CONFIG_HZ=250 229CONFIG_HZ=250
270# CONFIG_KEXEC is not set 230# CONFIG_KEXEC is not set
271# CONFIG_SMP is not set 231# CONFIG_CRASH_DUMP is not set
272CONFIG_PREEMPT_NONE=y 232CONFIG_PREEMPT_NONE=y
273# CONFIG_PREEMPT_VOLUNTARY is not set 233# CONFIG_PREEMPT_VOLUNTARY is not set
274# CONFIG_PREEMPT is not set 234# CONFIG_PREEMPT is not set
@@ -289,15 +249,12 @@ CONFIG_PCI=y
289CONFIG_SH_PCIDMA_NONCOHERENT=y 249CONFIG_SH_PCIDMA_NONCOHERENT=y
290CONFIG_PCI_AUTO=y 250CONFIG_PCI_AUTO=y
291CONFIG_PCI_AUTO_UPDATE_RESOURCES=y 251CONFIG_PCI_AUTO_UPDATE_RESOURCES=y
252# CONFIG_ARCH_SUPPORTS_MSI is not set
292 253
293# 254#
294# PCCARD (PCMCIA/CardBus) support 255# PCCARD (PCMCIA/CardBus) support
295# 256#
296# CONFIG_PCCARD is not set 257# CONFIG_PCCARD is not set
297
298#
299# PCI Hotplug Support
300#
301CONFIG_HOTPLUG_PCI=y 258CONFIG_HOTPLUG_PCI=y
302# CONFIG_HOTPLUG_PCI_FAKE is not set 259# CONFIG_HOTPLUG_PCI_FAKE is not set
303# CONFIG_HOTPLUG_PCI_CPCI is not set 260# CONFIG_HOTPLUG_PCI_CPCI is not set
@@ -307,15 +264,9 @@ CONFIG_HOTPLUG_PCI=y
307# Executable file formats 264# Executable file formats
308# 265#
309CONFIG_BINFMT_ELF=y 266CONFIG_BINFMT_ELF=y
310# CONFIG_BINFMT_FLAT is not set
311# CONFIG_BINFMT_MISC is not set 267# CONFIG_BINFMT_MISC is not set
312 268
313# 269#
314# Power management options (EXPERIMENTAL)
315#
316# CONFIG_PM is not set
317
318#
319# Networking 270# Networking
320# 271#
321CONFIG_NET=y 272CONFIG_NET=y
@@ -323,7 +274,6 @@ CONFIG_NET=y
323# 274#
324# Networking options 275# Networking options
325# 276#
326# CONFIG_NETDEBUG is not set
327CONFIG_PACKET=y 277CONFIG_PACKET=y
328# CONFIG_PACKET_MMAP is not set 278# CONFIG_PACKET_MMAP is not set
329CONFIG_UNIX=y 279CONFIG_UNIX=y
@@ -360,20 +310,8 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
360# CONFIG_INET6_TUNNEL is not set 310# CONFIG_INET6_TUNNEL is not set
361# CONFIG_NETWORK_SECMARK is not set 311# CONFIG_NETWORK_SECMARK is not set
362# CONFIG_NETFILTER is not set 312# CONFIG_NETFILTER is not set
363
364#
365# DCCP Configuration (EXPERIMENTAL)
366#
367# CONFIG_IP_DCCP is not set 313# CONFIG_IP_DCCP is not set
368
369#
370# SCTP Configuration (EXPERIMENTAL)
371#
372# CONFIG_IP_SCTP is not set 314# CONFIG_IP_SCTP is not set
373
374#
375# TIPC Configuration (EXPERIMENTAL)
376#
377# CONFIG_TIPC is not set 315# CONFIG_TIPC is not set
378# CONFIG_ATM is not set 316# CONFIG_ATM is not set
379# CONFIG_BRIDGE is not set 317# CONFIG_BRIDGE is not set
@@ -399,8 +337,17 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
399# CONFIG_HAMRADIO is not set 337# CONFIG_HAMRADIO is not set
400# CONFIG_IRDA is not set 338# CONFIG_IRDA is not set
401# CONFIG_BT is not set 339# CONFIG_BT is not set
402# CONFIG_IEEE80211 is not set 340# CONFIG_AF_RXRPC is not set
341
342#
343# Wireless
344#
345# CONFIG_CFG80211 is not set
403CONFIG_WIRELESS_EXT=y 346CONFIG_WIRELESS_EXT=y
347# CONFIG_MAC80211 is not set
348# CONFIG_IEEE80211 is not set
349# CONFIG_RFKILL is not set
350# CONFIG_NET_9P is not set
404 351
405# 352#
406# Device Drivers 353# Device Drivers
@@ -413,31 +360,10 @@ CONFIG_STANDALONE=y
413CONFIG_PREVENT_FIRMWARE_BUILD=y 360CONFIG_PREVENT_FIRMWARE_BUILD=y
414CONFIG_FW_LOADER=m 361CONFIG_FW_LOADER=m
415# CONFIG_SYS_HYPERVISOR is not set 362# CONFIG_SYS_HYPERVISOR is not set
416
417#
418# Connector - unified userspace <-> kernelspace linker
419#
420# CONFIG_CONNECTOR is not set 363# CONFIG_CONNECTOR is not set
421
422#
423# Memory Technology Devices (MTD)
424#
425# CONFIG_MTD is not set 364# CONFIG_MTD is not set
426
427#
428# Parallel port support
429#
430# CONFIG_PARPORT is not set 365# CONFIG_PARPORT is not set
431 366CONFIG_BLK_DEV=y
432#
433# Plug and Play support
434#
435# CONFIG_PNPACPI is not set
436
437#
438# Block devices
439#
440# CONFIG_BLK_CPQ_DA is not set
441# CONFIG_BLK_CPQ_CISS_DA is not set 367# CONFIG_BLK_CPQ_CISS_DA is not set
442# CONFIG_BLK_DEV_DAC960 is not set 368# CONFIG_BLK_DEV_DAC960 is not set
443# CONFIG_BLK_DEV_UMEM is not set 369# CONFIG_BLK_DEV_UMEM is not set
@@ -449,19 +375,13 @@ CONFIG_BLK_DEV_RAM=y
449CONFIG_BLK_DEV_RAM_COUNT=16 375CONFIG_BLK_DEV_RAM_COUNT=16
450CONFIG_BLK_DEV_RAM_SIZE=4096 376CONFIG_BLK_DEV_RAM_SIZE=4096
451CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 377CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
452# CONFIG_BLK_DEV_INITRD is not set
453# CONFIG_CDROM_PKTCDVD is not set 378# CONFIG_CDROM_PKTCDVD is not set
454# CONFIG_ATA_OVER_ETH is not set 379# CONFIG_ATA_OVER_ETH is not set
455 380CONFIG_MISC_DEVICES=y
456# 381# CONFIG_PHANTOM is not set
457# Misc devices 382# CONFIG_EEPROM_93CX6 is not set
458#
459# CONFIG_SGI_IOC4 is not set 383# CONFIG_SGI_IOC4 is not set
460# CONFIG_TIFM_CORE is not set 384# CONFIG_TIFM_CORE is not set
461
462#
463# ATA/ATAPI/MFM/RLL support
464#
465# CONFIG_IDE is not set 385# CONFIG_IDE is not set
466 386
467# 387#
@@ -469,6 +389,7 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
469# 389#
470# CONFIG_RAID_ATTRS is not set 390# CONFIG_RAID_ATTRS is not set
471CONFIG_SCSI=y 391CONFIG_SCSI=y
392CONFIG_SCSI_DMA=y
472# CONFIG_SCSI_TGT is not set 393# CONFIG_SCSI_TGT is not set
473# CONFIG_SCSI_NETLINK is not set 394# CONFIG_SCSI_NETLINK is not set
474CONFIG_SCSI_PROC_FS=y 395CONFIG_SCSI_PROC_FS=y
@@ -490,6 +411,7 @@ CONFIG_BLK_DEV_SD=y
490# CONFIG_SCSI_CONSTANTS is not set 411# CONFIG_SCSI_CONSTANTS is not set
491# CONFIG_SCSI_LOGGING is not set 412# CONFIG_SCSI_LOGGING is not set
492# CONFIG_SCSI_SCAN_ASYNC is not set 413# CONFIG_SCSI_SCAN_ASYNC is not set
414CONFIG_SCSI_WAIT_SCAN=m
493 415
494# 416#
495# SCSI Transports 417# SCSI Transports
@@ -497,12 +419,8 @@ CONFIG_BLK_DEV_SD=y
497# CONFIG_SCSI_SPI_ATTRS is not set 419# CONFIG_SCSI_SPI_ATTRS is not set
498# CONFIG_SCSI_FC_ATTRS is not set 420# CONFIG_SCSI_FC_ATTRS is not set
499# CONFIG_SCSI_ISCSI_ATTRS is not set 421# CONFIG_SCSI_ISCSI_ATTRS is not set
500# CONFIG_SCSI_SAS_ATTRS is not set
501# CONFIG_SCSI_SAS_LIBSAS is not set 422# CONFIG_SCSI_SAS_LIBSAS is not set
502 423CONFIG_SCSI_LOWLEVEL=y
503#
504# SCSI low-level drivers
505#
506# CONFIG_ISCSI_TCP is not set 424# CONFIG_ISCSI_TCP is not set
507# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 425# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
508# CONFIG_SCSI_3W_9XXX is not set 426# CONFIG_SCSI_3W_9XXX is not set
@@ -512,7 +430,6 @@ CONFIG_BLK_DEV_SD=y
512# CONFIG_SCSI_AIC7XXX_OLD is not set 430# CONFIG_SCSI_AIC7XXX_OLD is not set
513# CONFIG_SCSI_AIC79XX is not set 431# CONFIG_SCSI_AIC79XX is not set
514# CONFIG_SCSI_AIC94XX is not set 432# CONFIG_SCSI_AIC94XX is not set
515# CONFIG_SCSI_DPT_I2O is not set
516# CONFIG_SCSI_ARCMSR is not set 433# CONFIG_SCSI_ARCMSR is not set
517# CONFIG_MEGARAID_NEWGEN is not set 434# CONFIG_MEGARAID_NEWGEN is not set
518# CONFIG_MEGARAID_LEGACY is not set 435# CONFIG_MEGARAID_LEGACY is not set
@@ -535,10 +452,6 @@ CONFIG_BLK_DEV_SD=y
535# CONFIG_SCSI_NSP32 is not set 452# CONFIG_SCSI_NSP32 is not set
536# CONFIG_SCSI_DEBUG is not set 453# CONFIG_SCSI_DEBUG is not set
537# CONFIG_SCSI_SRP is not set 454# CONFIG_SCSI_SRP is not set
538
539#
540# Serial ATA (prod) and Parallel ATA (experimental) drivers
541#
542CONFIG_ATA=y 455CONFIG_ATA=y
543# CONFIG_ATA_NONSTANDARD is not set 456# CONFIG_ATA_NONSTANDARD is not set
544# CONFIG_SATA_AHCI is not set 457# CONFIG_SATA_AHCI is not set
@@ -561,6 +474,7 @@ CONFIG_ATA=y
561# CONFIG_PATA_AMD is not set 474# CONFIG_PATA_AMD is not set
562# CONFIG_PATA_ARTOP is not set 475# CONFIG_PATA_ARTOP is not set
563# CONFIG_PATA_ATIIXP is not set 476# CONFIG_PATA_ATIIXP is not set
477# CONFIG_PATA_CMD640_PCI is not set
564# CONFIG_PATA_CMD64X is not set 478# CONFIG_PATA_CMD64X is not set
565# CONFIG_PATA_CS5520 is not set 479# CONFIG_PATA_CS5520 is not set
566# CONFIG_PATA_CS5530 is not set 480# CONFIG_PATA_CS5530 is not set
@@ -593,10 +507,6 @@ CONFIG_ATA=y
593# CONFIG_PATA_VIA is not set 507# CONFIG_PATA_VIA is not set
594# CONFIG_PATA_WINBOND is not set 508# CONFIG_PATA_WINBOND is not set
595CONFIG_PATA_PLATFORM=y 509CONFIG_PATA_PLATFORM=y
596
597#
598# Multi-device support (RAID and LVM)
599#
600# CONFIG_MD is not set 510# CONFIG_MD is not set
601 511
602# 512#
@@ -610,35 +520,18 @@ CONFIG_PATA_PLATFORM=y
610# 520#
611# IEEE 1394 (FireWire) support 521# IEEE 1394 (FireWire) support
612# 522#
523# CONFIG_FIREWIRE is not set
613# CONFIG_IEEE1394 is not set 524# CONFIG_IEEE1394 is not set
614
615#
616# I2O device support
617#
618# CONFIG_I2O is not set 525# CONFIG_I2O is not set
619
620#
621# Network device support
622#
623CONFIG_NETDEVICES=y 526CONFIG_NETDEVICES=y
527# CONFIG_NETDEVICES_MULTIQUEUE is not set
624# CONFIG_DUMMY is not set 528# CONFIG_DUMMY is not set
625# CONFIG_BONDING is not set 529# CONFIG_BONDING is not set
530# CONFIG_MACVLAN is not set
626# CONFIG_EQUALIZER is not set 531# CONFIG_EQUALIZER is not set
627# CONFIG_TUN is not set 532# CONFIG_TUN is not set
628
629#
630# ARCnet devices
631#
632# CONFIG_ARCNET is not set 533# CONFIG_ARCNET is not set
633
634#
635# PHY device support
636#
637# CONFIG_PHYLIB is not set 534# CONFIG_PHYLIB is not set
638
639#
640# Ethernet (10 or 100Mbit)
641#
642CONFIG_NET_ETHERNET=y 535CONFIG_NET_ETHERNET=y
643CONFIG_MII=y 536CONFIG_MII=y
644# CONFIG_STNIC is not set 537# CONFIG_STNIC is not set
@@ -647,10 +540,6 @@ CONFIG_MII=y
647# CONFIG_CASSINI is not set 540# CONFIG_CASSINI is not set
648# CONFIG_NET_VENDOR_3COM is not set 541# CONFIG_NET_VENDOR_3COM is not set
649# CONFIG_SMC91X is not set 542# CONFIG_SMC91X is not set
650
651#
652# Tulip family network device support
653#
654# CONFIG_NET_TULIP is not set 543# CONFIG_NET_TULIP is not set
655# CONFIG_HP100 is not set 544# CONFIG_HP100 is not set
656CONFIG_NET_PCI=y 545CONFIG_NET_PCI=y
@@ -677,10 +566,7 @@ CONFIG_8139TOO=y
677# CONFIG_TLAN is not set 566# CONFIG_TLAN is not set
678# CONFIG_VIA_RHINE is not set 567# CONFIG_VIA_RHINE is not set
679# CONFIG_SC92031 is not set 568# CONFIG_SC92031 is not set
680 569CONFIG_NETDEV_1000=y
681#
682# Ethernet (1000 Mbit)
683#
684# CONFIG_ACENIC is not set 570# CONFIG_ACENIC is not set
685# CONFIG_DL2K is not set 571# CONFIG_DL2K is not set
686# CONFIG_E1000 is not set 572# CONFIG_E1000 is not set
@@ -691,61 +577,26 @@ CONFIG_8139TOO=y
691# CONFIG_SIS190 is not set 577# CONFIG_SIS190 is not set
692# CONFIG_SKGE is not set 578# CONFIG_SKGE is not set
693# CONFIG_SKY2 is not set 579# CONFIG_SKY2 is not set
694# CONFIG_SK98LIN is not set
695# CONFIG_VIA_VELOCITY is not set 580# CONFIG_VIA_VELOCITY is not set
696# CONFIG_TIGON3 is not set 581# CONFIG_TIGON3 is not set
697# CONFIG_BNX2 is not set 582# CONFIG_BNX2 is not set
698# CONFIG_QLA3XXX is not set 583# CONFIG_QLA3XXX is not set
699# CONFIG_ATL1 is not set 584# CONFIG_ATL1 is not set
700 585CONFIG_NETDEV_10000=y
701#
702# Ethernet (10000 Mbit)
703#
704# CONFIG_CHELSIO_T1 is not set 586# CONFIG_CHELSIO_T1 is not set
705# CONFIG_CHELSIO_T3 is not set 587# CONFIG_CHELSIO_T3 is not set
706# CONFIG_IXGB is not set 588# CONFIG_IXGB is not set
707# CONFIG_S2IO is not set 589# CONFIG_S2IO is not set
708# CONFIG_MYRI10GE is not set 590# CONFIG_MYRI10GE is not set
709# CONFIG_NETXEN_NIC is not set 591# CONFIG_NETXEN_NIC is not set
710 592# CONFIG_MLX4_CORE is not set
711#
712# Token Ring devices
713#
714# CONFIG_TR is not set 593# CONFIG_TR is not set
715 594
716# 595#
717# Wireless LAN (non-hamradio) 596# Wireless LAN
718#
719CONFIG_NET_RADIO=y
720# CONFIG_NET_WIRELESS_RTNETLINK is not set
721
722#
723# Obsolete Wireless cards support (pre-802.11)
724#
725# CONFIG_STRIP is not set
726
727#
728# Wireless 802.11b ISA/PCI cards support
729#
730# CONFIG_IPW2100 is not set
731# CONFIG_IPW2200 is not set
732CONFIG_HERMES=m
733# CONFIG_PLX_HERMES is not set
734# CONFIG_TMD_HERMES is not set
735# CONFIG_NORTEL_HERMES is not set
736# CONFIG_PCI_HERMES is not set
737# CONFIG_ATMEL is not set
738
739#
740# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support
741#
742# CONFIG_PRISM54 is not set
743# CONFIG_HOSTAP is not set
744CONFIG_NET_WIRELESS=y
745
746#
747# Wan interfaces
748# 597#
598# CONFIG_WLAN_PRE80211 is not set
599# CONFIG_WLAN_80211 is not set
749# CONFIG_WAN is not set 600# CONFIG_WAN is not set
750# CONFIG_FDDI is not set 601# CONFIG_FDDI is not set
751# CONFIG_HIPPI is not set 602# CONFIG_HIPPI is not set
@@ -756,15 +607,7 @@ CONFIG_NET_WIRELESS=y
756# CONFIG_NETCONSOLE is not set 607# CONFIG_NETCONSOLE is not set
757# CONFIG_NETPOLL is not set 608# CONFIG_NETPOLL is not set
758# CONFIG_NET_POLL_CONTROLLER is not set 609# CONFIG_NET_POLL_CONTROLLER is not set
759
760#
761# ISDN subsystem
762#
763# CONFIG_ISDN is not set 610# CONFIG_ISDN is not set
764
765#
766# Telephony Support
767#
768# CONFIG_PHONE is not set 611# CONFIG_PHONE is not set
769 612
770# 613#
@@ -772,6 +615,7 @@ CONFIG_NET_WIRELESS=y
772# 615#
773CONFIG_INPUT=y 616CONFIG_INPUT=y
774# CONFIG_INPUT_FF_MEMLESS is not set 617# CONFIG_INPUT_FF_MEMLESS is not set
618# CONFIG_INPUT_POLLDEV is not set
775 619
776# 620#
777# Userland interfaces 621# Userland interfaces
@@ -788,6 +632,7 @@ CONFIG_INPUT=y
788# CONFIG_INPUT_KEYBOARD is not set 632# CONFIG_INPUT_KEYBOARD is not set
789# CONFIG_INPUT_MOUSE is not set 633# CONFIG_INPUT_MOUSE is not set
790# CONFIG_INPUT_JOYSTICK is not set 634# CONFIG_INPUT_JOYSTICK is not set
635# CONFIG_INPUT_TABLET is not set
791# CONFIG_INPUT_TOUCHSCREEN is not set 636# CONFIG_INPUT_TOUCHSCREEN is not set
792# CONFIG_INPUT_MISC is not set 637# CONFIG_INPUT_MISC is not set
793 638
@@ -828,32 +673,15 @@ CONFIG_SERIAL_CORE_CONSOLE=y
828CONFIG_UNIX98_PTYS=y 673CONFIG_UNIX98_PTYS=y
829CONFIG_LEGACY_PTYS=y 674CONFIG_LEGACY_PTYS=y
830CONFIG_LEGACY_PTY_COUNT=256 675CONFIG_LEGACY_PTY_COUNT=256
831
832#
833# IPMI
834#
835# CONFIG_IPMI_HANDLER is not set 676# CONFIG_IPMI_HANDLER is not set
836
837#
838# Watchdog Cards
839#
840# CONFIG_WATCHDOG is not set 677# CONFIG_WATCHDOG is not set
841CONFIG_HW_RANDOM=y 678CONFIG_HW_RANDOM=y
842# CONFIG_GEN_RTC is not set
843# CONFIG_DTLK is not set
844# CONFIG_R3964 is not set 679# CONFIG_R3964 is not set
845# CONFIG_APPLICOM is not set 680# CONFIG_APPLICOM is not set
846# CONFIG_DRM is not set 681# CONFIG_DRM is not set
847# CONFIG_RAW_DRIVER is not set 682# CONFIG_RAW_DRIVER is not set
848
849#
850# TPM devices
851#
852# CONFIG_TCG_TPM is not set 683# CONFIG_TCG_TPM is not set
853 684CONFIG_DEVPORT=y
854#
855# I2C support
856#
857# CONFIG_I2C is not set 685# CONFIG_I2C is not set
858 686
859# 687#
@@ -861,21 +689,24 @@ CONFIG_HW_RANDOM=y
861# 689#
862# CONFIG_SPI is not set 690# CONFIG_SPI is not set
863# CONFIG_SPI_MASTER is not set 691# CONFIG_SPI_MASTER is not set
864
865#
866# Dallas's 1-wire bus
867#
868# CONFIG_W1 is not set 692# CONFIG_W1 is not set
869 693# CONFIG_POWER_SUPPLY is not set
870#
871# Hardware Monitoring support
872#
873CONFIG_HWMON=y 694CONFIG_HWMON=y
874# CONFIG_HWMON_VID is not set 695# CONFIG_HWMON_VID is not set
875# CONFIG_SENSORS_ABITUGURU is not set 696# CONFIG_SENSORS_ABITUGURU is not set
697# CONFIG_SENSORS_ABITUGURU3 is not set
876# CONFIG_SENSORS_F71805F is not set 698# CONFIG_SENSORS_F71805F is not set
699# CONFIG_SENSORS_IT87 is not set
700# CONFIG_SENSORS_PC87360 is not set
877# CONFIG_SENSORS_PC87427 is not set 701# CONFIG_SENSORS_PC87427 is not set
702# CONFIG_SENSORS_SIS5595 is not set
703# CONFIG_SENSORS_SMSC47M1 is not set
704# CONFIG_SENSORS_SMSC47B397 is not set
705# CONFIG_SENSORS_VIA686A is not set
878# CONFIG_SENSORS_VT1211 is not set 706# CONFIG_SENSORS_VT1211 is not set
707# CONFIG_SENSORS_VT8231 is not set
708# CONFIG_SENSORS_W83627HF is not set
709# CONFIG_SENSORS_W83627EHF is not set
879# CONFIG_HWMON_DEBUG_CHIP is not set 710# CONFIG_HWMON_DEBUG_CHIP is not set
880 711
881# 712#
@@ -887,22 +718,31 @@ CONFIG_MFD_SM501=y
887# Multimedia devices 718# Multimedia devices
888# 719#
889# CONFIG_VIDEO_DEV is not set 720# CONFIG_VIDEO_DEV is not set
721# CONFIG_DVB_CORE is not set
722CONFIG_DAB=y
890 723
891# 724#
892# Digital Video Broadcasting Devices 725# Graphics support
893# 726#
894# CONFIG_DVB is not set 727# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
895 728
896# 729#
897# Graphics support 730# Display device support
898# 731#
899# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 732# CONFIG_DISPLAY_SUPPORT is not set
733# CONFIG_VGASTATE is not set
734CONFIG_VIDEO_OUTPUT_CONTROL=m
900CONFIG_FB=y 735CONFIG_FB=y
901# CONFIG_FIRMWARE_EDID is not set 736# CONFIG_FIRMWARE_EDID is not set
902# CONFIG_FB_DDC is not set 737# CONFIG_FB_DDC is not set
903CONFIG_FB_CFB_FILLRECT=y 738CONFIG_FB_CFB_FILLRECT=y
904CONFIG_FB_CFB_COPYAREA=y 739CONFIG_FB_CFB_COPYAREA=y
905CONFIG_FB_CFB_IMAGEBLIT=y 740CONFIG_FB_CFB_IMAGEBLIT=y
741# CONFIG_FB_SYS_FILLRECT is not set
742# CONFIG_FB_SYS_COPYAREA is not set
743# CONFIG_FB_SYS_IMAGEBLIT is not set
744# CONFIG_FB_SYS_FOPS is not set
745CONFIG_FB_DEFERRED_IO=y
906# CONFIG_FB_SVGALIB is not set 746# CONFIG_FB_SVGALIB is not set
907# CONFIG_FB_MACMODES is not set 747# CONFIG_FB_MACMODES is not set
908# CONFIG_FB_BACKLIGHT is not set 748# CONFIG_FB_BACKLIGHT is not set
@@ -910,14 +750,13 @@ CONFIG_FB_CFB_IMAGEBLIT=y
910# CONFIG_FB_TILEBLITTING is not set 750# CONFIG_FB_TILEBLITTING is not set
911 751
912# 752#
913# Frambuffer hardware drivers 753# Frame buffer hardware drivers
914# 754#
915# CONFIG_FB_CIRRUS is not set 755# CONFIG_FB_CIRRUS is not set
916# CONFIG_FB_PM2 is not set 756# CONFIG_FB_PM2 is not set
917# CONFIG_FB_CYBER2000 is not set 757# CONFIG_FB_CYBER2000 is not set
918# CONFIG_FB_ASILIANT is not set 758# CONFIG_FB_ASILIANT is not set
919# CONFIG_FB_IMSTT is not set 759# CONFIG_FB_IMSTT is not set
920# CONFIG_FB_EPSON1355 is not set
921# CONFIG_FB_S1D13XXX is not set 760# CONFIG_FB_S1D13XXX is not set
922# CONFIG_FB_NVIDIA is not set 761# CONFIG_FB_NVIDIA is not set
923# CONFIG_FB_RIVA is not set 762# CONFIG_FB_RIVA is not set
@@ -932,7 +771,10 @@ CONFIG_FB_CFB_IMAGEBLIT=y
932# CONFIG_FB_KYRO is not set 771# CONFIG_FB_KYRO is not set
933# CONFIG_FB_3DFX is not set 772# CONFIG_FB_3DFX is not set
934# CONFIG_FB_VOODOO1 is not set 773# CONFIG_FB_VOODOO1 is not set
774# CONFIG_FB_VT8623 is not set
935# CONFIG_FB_TRIDENT is not set 775# CONFIG_FB_TRIDENT is not set
776# CONFIG_FB_ARK is not set
777# CONFIG_FB_PM3 is not set
936CONFIG_FB_SM501=y 778CONFIG_FB_SM501=y
937# CONFIG_FB_VIRTUAL is not set 779# CONFIG_FB_VIRTUAL is not set
938 780
@@ -941,14 +783,11 @@ CONFIG_FB_SM501=y
941# 783#
942CONFIG_DUMMY_CONSOLE=y 784CONFIG_DUMMY_CONSOLE=y
943CONFIG_FRAMEBUFFER_CONSOLE=y 785CONFIG_FRAMEBUFFER_CONSOLE=y
786# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
944# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set 787# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
945# CONFIG_FONTS is not set 788# CONFIG_FONTS is not set
946CONFIG_FONT_8x8=y 789CONFIG_FONT_8x8=y
947CONFIG_FONT_8x16=y 790CONFIG_FONT_8x16=y
948
949#
950# Logo configuration
951#
952CONFIG_LOGO=y 791CONFIG_LOGO=y
953# CONFIG_LOGO_LINUX_MONO is not set 792# CONFIG_LOGO_LINUX_MONO is not set
954# CONFIG_LOGO_LINUX_VGA16 is not set 793# CONFIG_LOGO_LINUX_VGA16 is not set
@@ -1048,35 +887,34 @@ CONFIG_SND_AC97_CODEC=m
1048# CONFIG_SND_VIA82XX_MODEM is not set 887# CONFIG_SND_VIA82XX_MODEM is not set
1049# CONFIG_SND_VX222 is not set 888# CONFIG_SND_VX222 is not set
1050CONFIG_SND_YMFPCI=m 889CONFIG_SND_YMFPCI=m
890CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL=y
1051# CONFIG_SND_AC97_POWER_SAVE is not set 891# CONFIG_SND_AC97_POWER_SAVE is not set
1052 892
1053# 893#
1054# SoC audio support 894# SUPERH devices
895#
896
897#
898# System on Chip audio support
1055# 899#
1056# CONFIG_SND_SOC is not set 900# CONFIG_SND_SOC is not set
1057 901
1058# 902#
903# SoC Audio support for SuperH
904#
905
906#
1059# Open Sound System 907# Open Sound System
1060# 908#
1061CONFIG_SOUND_PRIME=m 909CONFIG_SOUND_PRIME=m
1062# CONFIG_OBSOLETE_OSS is not set
1063# CONFIG_SOUND_BT878 is not set
1064# CONFIG_SOUND_ICH is not set
1065# CONFIG_SOUND_TRIDENT is not set 910# CONFIG_SOUND_TRIDENT is not set
1066# CONFIG_SOUND_MSNDCLAS is not set 911# CONFIG_SOUND_MSNDCLAS is not set
1067# CONFIG_SOUND_MSNDPIN is not set 912# CONFIG_SOUND_MSNDPIN is not set
1068# CONFIG_SOUND_VIA82CXXX is not set
1069CONFIG_AC97_BUS=m 913CONFIG_AC97_BUS=m
1070 914CONFIG_HID_SUPPORT=y
1071#
1072# HID Devices
1073#
1074CONFIG_HID=y 915CONFIG_HID=y
1075# CONFIG_HID_DEBUG is not set 916# CONFIG_HID_DEBUG is not set
1076 917CONFIG_USB_SUPPORT=y
1077#
1078# USB support
1079#
1080CONFIG_USB_ARCH_HAS_HCD=y 918CONFIG_USB_ARCH_HAS_HCD=y
1081CONFIG_USB_ARCH_HAS_OHCI=y 919CONFIG_USB_ARCH_HAS_OHCI=y
1082CONFIG_USB_ARCH_HAS_EHCI=y 920CONFIG_USB_ARCH_HAS_EHCI=y
@@ -1090,37 +928,9 @@ CONFIG_USB_ARCH_HAS_EHCI=y
1090# USB Gadget Support 928# USB Gadget Support
1091# 929#
1092# CONFIG_USB_GADGET is not set 930# CONFIG_USB_GADGET is not set
1093
1094#
1095# MMC/SD Card support
1096#
1097# CONFIG_MMC is not set 931# CONFIG_MMC is not set
1098
1099#
1100# LED devices
1101#
1102# CONFIG_NEW_LEDS is not set 932# CONFIG_NEW_LEDS is not set
1103
1104#
1105# LED drivers
1106#
1107
1108#
1109# LED Triggers
1110#
1111
1112#
1113# InfiniBand support
1114#
1115# CONFIG_INFINIBAND is not set 933# CONFIG_INFINIBAND is not set
1116
1117#
1118# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
1119#
1120
1121#
1122# Real Time Clock
1123#
1124CONFIG_RTC_LIB=y 934CONFIG_RTC_LIB=y
1125CONFIG_RTC_CLASS=y 935CONFIG_RTC_CLASS=y
1126CONFIG_RTC_HCTOSYS=y 936CONFIG_RTC_HCTOSYS=y
@@ -1134,18 +944,28 @@ CONFIG_RTC_INTF_SYSFS=y
1134CONFIG_RTC_INTF_PROC=y 944CONFIG_RTC_INTF_PROC=y
1135CONFIG_RTC_INTF_DEV=y 945CONFIG_RTC_INTF_DEV=y
1136# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set 946# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
947# CONFIG_RTC_DRV_TEST is not set
948
949#
950# SPI RTC drivers
951#
1137 952
1138# 953#
1139# RTC drivers 954# Platform RTC drivers
1140# 955#
1141# CONFIG_RTC_DRV_DS1553 is not set 956# CONFIG_RTC_DRV_DS1553 is not set
957# CONFIG_RTC_DRV_STK17TA8 is not set
1142# CONFIG_RTC_DRV_DS1742 is not set 958# CONFIG_RTC_DRV_DS1742 is not set
1143# CONFIG_RTC_DRV_M48T86 is not set 959# CONFIG_RTC_DRV_M48T86 is not set
1144CONFIG_RTC_DRV_SH=y 960# CONFIG_RTC_DRV_M48T59 is not set
1145# CONFIG_RTC_DRV_TEST is not set
1146# CONFIG_RTC_DRV_V3020 is not set 961# CONFIG_RTC_DRV_V3020 is not set
1147 962
1148# 963#
964# on-CPU RTC drivers
965#
966CONFIG_RTC_DRV_SH=y
967
968#
1149# DMA Engine support 969# DMA Engine support
1150# 970#
1151# CONFIG_DMA_ENGINE is not set 971# CONFIG_DMA_ENGINE is not set
@@ -1159,12 +979,9 @@ CONFIG_RTC_DRV_SH=y
1159# 979#
1160 980
1161# 981#
1162# Auxiliary Display support 982# Userspace I/O
1163#
1164
1165#
1166# Virtualization
1167# 983#
984# CONFIG_UIO is not set
1168 985
1169# 986#
1170# File systems 987# File systems
@@ -1247,7 +1064,6 @@ CONFIG_RAMFS=y
1247# CONFIG_NCP_FS is not set 1064# CONFIG_NCP_FS is not set
1248# CONFIG_CODA_FS is not set 1065# CONFIG_CODA_FS is not set
1249# CONFIG_AFS_FS is not set 1066# CONFIG_AFS_FS is not set
1250# CONFIG_9P_FS is not set
1251 1067
1252# 1068#
1253# Partition Types 1069# Partition Types
@@ -1321,7 +1137,6 @@ CONFIG_ENABLE_MUST_CHECK=y
1321# CONFIG_DEBUG_FS is not set 1137# CONFIG_DEBUG_FS is not set
1322# CONFIG_HEADERS_CHECK is not set 1138# CONFIG_HEADERS_CHECK is not set
1323# CONFIG_DEBUG_KERNEL is not set 1139# CONFIG_DEBUG_KERNEL is not set
1324CONFIG_LOG_BUF_SHIFT=14
1325# CONFIG_DEBUG_BUGVERBOSE is not set 1140# CONFIG_DEBUG_BUGVERBOSE is not set
1326# CONFIG_SH_STANDARD_BIOS is not set 1141# CONFIG_SH_STANDARD_BIOS is not set
1327CONFIG_EARLY_SCIF_CONSOLE=y 1142CONFIG_EARLY_SCIF_CONSOLE=y
@@ -1334,10 +1149,6 @@ CONFIG_EARLY_PRINTK=y
1334# 1149#
1335# CONFIG_KEYS is not set 1150# CONFIG_KEYS is not set
1336# CONFIG_SECURITY is not set 1151# CONFIG_SECURITY is not set
1337
1338#
1339# Cryptographic options
1340#
1341# CONFIG_CRYPTO is not set 1152# CONFIG_CRYPTO is not set
1342 1153
1343# 1154#
@@ -1346,8 +1157,11 @@ CONFIG_EARLY_PRINTK=y
1346CONFIG_BITREVERSE=y 1157CONFIG_BITREVERSE=y
1347# CONFIG_CRC_CCITT is not set 1158# CONFIG_CRC_CCITT is not set
1348# CONFIG_CRC16 is not set 1159# CONFIG_CRC16 is not set
1160# CONFIG_CRC_ITU_T is not set
1349CONFIG_CRC32=y 1161CONFIG_CRC32=y
1162# CONFIG_CRC7 is not set
1350# CONFIG_LIBCRC32C is not set 1163# CONFIG_LIBCRC32C is not set
1351CONFIG_PLIST=y 1164CONFIG_PLIST=y
1352CONFIG_HAS_IOMEM=y 1165CONFIG_HAS_IOMEM=y
1353CONFIG_HAS_IOPORT=y 1166CONFIG_HAS_IOPORT=y
1167CONFIG_HAS_DMA=y
diff --git a/arch/sh/configs/rts7751r2dplus_defconfig b/arch/sh/configs/rts7751r2dplus_defconfig
new file mode 100644
index 000000000000..4ff5a752dcd9
--- /dev/null
+++ b/arch/sh/configs/rts7751r2dplus_defconfig
@@ -0,0 +1,1167 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23-rc2
4# Tue Aug 14 16:33:08 2007
5#
6CONFIG_SUPERH=y
7CONFIG_RWSEM_GENERIC_SPINLOCK=y
8CONFIG_GENERIC_BUG=y
9CONFIG_GENERIC_FIND_NEXT_BIT=y
10CONFIG_GENERIC_HWEIGHT=y
11CONFIG_GENERIC_HARDIRQS=y
12CONFIG_GENERIC_IRQ_PROBE=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y
14CONFIG_GENERIC_TIME=y
15CONFIG_GENERIC_CLOCKEVENTS=y
16CONFIG_SYS_SUPPORTS_PCI=y
17CONFIG_STACKTRACE_SUPPORT=y
18CONFIG_LOCKDEP_SUPPORT=y
19# CONFIG_ARCH_HAS_ILOG2_U32 is not set
20# CONFIG_ARCH_HAS_ILOG2_U64 is not set
21CONFIG_ARCH_NO_VIRT_TO_BUS=y
22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
23
24#
25# General setup
26#
27CONFIG_EXPERIMENTAL=y
28CONFIG_BROKEN_ON_SMP=y
29CONFIG_INIT_ENV_ARG_LIMIT=32
30CONFIG_LOCALVERSION=""
31CONFIG_LOCALVERSION_AUTO=y
32CONFIG_SWAP=y
33CONFIG_SYSVIPC=y
34CONFIG_SYSVIPC_SYSCTL=y
35# CONFIG_POSIX_MQUEUE is not set
36# CONFIG_BSD_PROCESS_ACCT is not set
37# CONFIG_TASKSTATS is not set
38# CONFIG_USER_NS is not set
39# CONFIG_AUDIT is not set
40# CONFIG_IKCONFIG is not set
41CONFIG_LOG_BUF_SHIFT=14
42CONFIG_SYSFS_DEPRECATED=y
43# CONFIG_RELAY is not set
44# CONFIG_BLK_DEV_INITRD is not set
45# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
46CONFIG_SYSCTL=y
47CONFIG_EMBEDDED=y
48CONFIG_UID16=y
49# CONFIG_SYSCTL_SYSCALL is not set
50CONFIG_KALLSYMS=y
51# CONFIG_KALLSYMS_EXTRA_PASS is not set
52CONFIG_HOTPLUG=y
53CONFIG_PRINTK=y
54CONFIG_BUG=y
55CONFIG_ELF_CORE=y
56CONFIG_BASE_FULL=y
57CONFIG_FUTEX=y
58CONFIG_ANON_INODES=y
59CONFIG_EPOLL=y
60CONFIG_SIGNALFD=y
61CONFIG_TIMERFD=y
62CONFIG_EVENTFD=y
63CONFIG_SHMEM=y
64CONFIG_VM_EVENT_COUNTERS=y
65CONFIG_SLAB=y
66# CONFIG_SLUB is not set
67# CONFIG_SLOB is not set
68CONFIG_RT_MUTEXES=y
69# CONFIG_TINY_SHMEM is not set
70CONFIG_BASE_SMALL=0
71CONFIG_MODULES=y
72# CONFIG_MODULE_UNLOAD is not set
73# CONFIG_MODVERSIONS is not set
74# CONFIG_MODULE_SRCVERSION_ALL is not set
75# CONFIG_KMOD is not set
76CONFIG_BLOCK=y
77# CONFIG_LBD is not set
78# CONFIG_BLK_DEV_IO_TRACE is not set
79# CONFIG_LSF is not set
80# CONFIG_BLK_DEV_BSG is not set
81
82#
83# IO Schedulers
84#
85CONFIG_IOSCHED_NOOP=y
86CONFIG_IOSCHED_AS=y
87CONFIG_IOSCHED_DEADLINE=y
88CONFIG_IOSCHED_CFQ=y
89CONFIG_DEFAULT_AS=y
90# CONFIG_DEFAULT_DEADLINE is not set
91# CONFIG_DEFAULT_CFQ is not set
92# CONFIG_DEFAULT_NOOP is not set
93CONFIG_DEFAULT_IOSCHED="anticipatory"
94
95#
96# System type
97#
98CONFIG_CPU_SH4=y
99# CONFIG_CPU_SUBTYPE_SH7619 is not set
100# CONFIG_CPU_SUBTYPE_SH7206 is not set
101# CONFIG_CPU_SUBTYPE_SH7705 is not set
102# CONFIG_CPU_SUBTYPE_SH7706 is not set
103# CONFIG_CPU_SUBTYPE_SH7707 is not set
104# CONFIG_CPU_SUBTYPE_SH7708 is not set
105# CONFIG_CPU_SUBTYPE_SH7709 is not set
106# CONFIG_CPU_SUBTYPE_SH7710 is not set
107# CONFIG_CPU_SUBTYPE_SH7712 is not set
108# CONFIG_CPU_SUBTYPE_SH7750 is not set
109# CONFIG_CPU_SUBTYPE_SH7091 is not set
110# CONFIG_CPU_SUBTYPE_SH7750R is not set
111# CONFIG_CPU_SUBTYPE_SH7750S is not set
112# CONFIG_CPU_SUBTYPE_SH7751 is not set
113CONFIG_CPU_SUBTYPE_SH7751R=y
114# CONFIG_CPU_SUBTYPE_SH7760 is not set
115# CONFIG_CPU_SUBTYPE_SH4_202 is not set
116# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
117# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
118# CONFIG_CPU_SUBTYPE_SH7770 is not set
119# CONFIG_CPU_SUBTYPE_SH7780 is not set
120# CONFIG_CPU_SUBTYPE_SH7785 is not set
121# CONFIG_CPU_SUBTYPE_SHX3 is not set
122# CONFIG_CPU_SUBTYPE_SH7343 is not set
123# CONFIG_CPU_SUBTYPE_SH7722 is not set
124
125#
126# Memory management options
127#
128CONFIG_QUICKLIST=y
129CONFIG_MMU=y
130CONFIG_PAGE_OFFSET=0x80000000
131CONFIG_MEMORY_START=0x0c000000
132CONFIG_MEMORY_SIZE=0x04000000
133CONFIG_VSYSCALL=y
134CONFIG_ARCH_FLATMEM_ENABLE=y
135CONFIG_ARCH_SPARSEMEM_ENABLE=y
136CONFIG_ARCH_SPARSEMEM_DEFAULT=y
137CONFIG_MAX_ACTIVE_REGIONS=1
138CONFIG_ARCH_POPULATES_NODE_MAP=y
139CONFIG_ARCH_SELECT_MEMORY_MODEL=y
140CONFIG_PAGE_SIZE_4KB=y
141# CONFIG_PAGE_SIZE_8KB is not set
142# CONFIG_PAGE_SIZE_64KB is not set
143CONFIG_SELECT_MEMORY_MODEL=y
144CONFIG_FLATMEM_MANUAL=y
145# CONFIG_DISCONTIGMEM_MANUAL is not set
146# CONFIG_SPARSEMEM_MANUAL is not set
147CONFIG_FLATMEM=y
148CONFIG_FLAT_NODE_MEM_MAP=y
149CONFIG_SPARSEMEM_STATIC=y
150CONFIG_SPLIT_PTLOCK_CPUS=4
151# CONFIG_RESOURCES_64BIT is not set
152CONFIG_ZONE_DMA_FLAG=0
153CONFIG_NR_QUICK=2
154
155#
156# Cache configuration
157#
158# CONFIG_SH_DIRECT_MAPPED is not set
159CONFIG_CACHE_WRITEBACK=y
160# CONFIG_CACHE_WRITETHROUGH is not set
161# CONFIG_CACHE_OFF is not set
162
163#
164# Processor features
165#
166CONFIG_CPU_LITTLE_ENDIAN=y
167# CONFIG_CPU_BIG_ENDIAN is not set
168CONFIG_SH_FPU=y
169# CONFIG_SH_STORE_QUEUES is not set
170CONFIG_CPU_HAS_INTEVT=y
171CONFIG_CPU_HAS_INTC_IRQ=y
172CONFIG_CPU_HAS_SR_RB=y
173CONFIG_CPU_HAS_PTEA=y
174
175#
176# Board support
177#
178# CONFIG_SH_7751_SYSTEMH is not set
179# CONFIG_SH_SECUREEDGE5410 is not set
180# CONFIG_SH_HS7751RVOIP is not set
181CONFIG_SH_RTS7751R2D=y
182# CONFIG_SH_LANDISK is not set
183# CONFIG_SH_TITAN is not set
184# CONFIG_SH_LBOX_RE2 is not set
185
186#
187# RTS7751R2D options
188#
189CONFIG_RTS7751R2D_PLUS=y
190# CONFIG_RTS7751R2D_1 is not set
191
192#
193# Timer and clock configuration
194#
195CONFIG_SH_TMU=y
196CONFIG_SH_TIMER_IRQ=16
197CONFIG_SH_PCLK_FREQ=60000000
198# CONFIG_TICK_ONESHOT is not set
199# CONFIG_NO_HZ is not set
200# CONFIG_HIGH_RES_TIMERS is not set
201
202#
203# CPU Frequency scaling
204#
205# CONFIG_CPU_FREQ is not set
206
207#
208# DMA support
209#
210# CONFIG_SH_DMA is not set
211
212#
213# Companion Chips
214#
215
216#
217# Additional SuperH Device Drivers
218#
219CONFIG_HEARTBEAT=y
220# CONFIG_PUSH_SWITCH is not set
221
222#
223# Kernel features
224#
225# CONFIG_HZ_100 is not set
226CONFIG_HZ_250=y
227# CONFIG_HZ_300 is not set
228# CONFIG_HZ_1000 is not set
229CONFIG_HZ=250
230# CONFIG_KEXEC is not set
231# CONFIG_CRASH_DUMP is not set
232CONFIG_PREEMPT_NONE=y
233# CONFIG_PREEMPT_VOLUNTARY is not set
234# CONFIG_PREEMPT is not set
235
236#
237# Boot options
238#
239CONFIG_ZERO_PAGE_OFFSET=0x00010000
240CONFIG_BOOT_LINK_OFFSET=0x00800000
241# CONFIG_UBC_WAKEUP is not set
242CONFIG_CMDLINE_BOOL=y
243CONFIG_CMDLINE="console=tty0 console=ttySC0,115200 root=/dev/sda1 earlyprintk=serial"
244
245#
246# Bus options
247#
248CONFIG_PCI=y
249CONFIG_SH_PCIDMA_NONCOHERENT=y
250CONFIG_PCI_AUTO=y
251CONFIG_PCI_AUTO_UPDATE_RESOURCES=y
252# CONFIG_ARCH_SUPPORTS_MSI is not set
253
254#
255# PCCARD (PCMCIA/CardBus) support
256#
257# CONFIG_PCCARD is not set
258CONFIG_HOTPLUG_PCI=y
259# CONFIG_HOTPLUG_PCI_FAKE is not set
260# CONFIG_HOTPLUG_PCI_CPCI is not set
261# CONFIG_HOTPLUG_PCI_SHPC is not set
262
263#
264# Executable file formats
265#
266CONFIG_BINFMT_ELF=y
267# CONFIG_BINFMT_MISC is not set
268
269#
270# Networking
271#
272CONFIG_NET=y
273
274#
275# Networking options
276#
277CONFIG_PACKET=y
278# CONFIG_PACKET_MMAP is not set
279CONFIG_UNIX=y
280CONFIG_XFRM=y
281# CONFIG_XFRM_USER is not set
282# CONFIG_XFRM_SUB_POLICY is not set
283# CONFIG_XFRM_MIGRATE is not set
284# CONFIG_NET_KEY is not set
285CONFIG_INET=y
286# CONFIG_IP_MULTICAST is not set
287# CONFIG_IP_ADVANCED_ROUTER is not set
288CONFIG_IP_FIB_HASH=y
289# CONFIG_IP_PNP is not set
290# CONFIG_NET_IPIP is not set
291# CONFIG_NET_IPGRE is not set
292# CONFIG_ARPD is not set
293# CONFIG_SYN_COOKIES is not set
294# CONFIG_INET_AH is not set
295# CONFIG_INET_ESP is not set
296# CONFIG_INET_IPCOMP is not set
297# CONFIG_INET_XFRM_TUNNEL is not set
298# CONFIG_INET_TUNNEL is not set
299CONFIG_INET_XFRM_MODE_TRANSPORT=y
300CONFIG_INET_XFRM_MODE_TUNNEL=y
301CONFIG_INET_XFRM_MODE_BEET=y
302CONFIG_INET_DIAG=y
303CONFIG_INET_TCP_DIAG=y
304# CONFIG_TCP_CONG_ADVANCED is not set
305CONFIG_TCP_CONG_CUBIC=y
306CONFIG_DEFAULT_TCP_CONG="cubic"
307# CONFIG_TCP_MD5SIG is not set
308# CONFIG_IPV6 is not set
309# CONFIG_INET6_XFRM_TUNNEL is not set
310# CONFIG_INET6_TUNNEL is not set
311# CONFIG_NETWORK_SECMARK is not set
312# CONFIG_NETFILTER is not set
313# CONFIG_IP_DCCP is not set
314# CONFIG_IP_SCTP is not set
315# CONFIG_TIPC is not set
316# CONFIG_ATM is not set
317# CONFIG_BRIDGE is not set
318# CONFIG_VLAN_8021Q is not set
319# CONFIG_DECNET is not set
320# CONFIG_LLC2 is not set
321# CONFIG_IPX is not set
322# CONFIG_ATALK is not set
323# CONFIG_X25 is not set
324# CONFIG_LAPB is not set
325# CONFIG_ECONET is not set
326# CONFIG_WAN_ROUTER is not set
327
328#
329# QoS and/or fair queueing
330#
331# CONFIG_NET_SCHED is not set
332
333#
334# Network testing
335#
336# CONFIG_NET_PKTGEN is not set
337# CONFIG_HAMRADIO is not set
338# CONFIG_IRDA is not set
339# CONFIG_BT is not set
340# CONFIG_AF_RXRPC is not set
341
342#
343# Wireless
344#
345# CONFIG_CFG80211 is not set
346CONFIG_WIRELESS_EXT=y
347# CONFIG_MAC80211 is not set
348# CONFIG_IEEE80211 is not set
349# CONFIG_RFKILL is not set
350# CONFIG_NET_9P is not set
351
352#
353# Device Drivers
354#
355
356#
357# Generic Driver Options
358#
359CONFIG_STANDALONE=y
360CONFIG_PREVENT_FIRMWARE_BUILD=y
361CONFIG_FW_LOADER=m
362# CONFIG_SYS_HYPERVISOR is not set
363# CONFIG_CONNECTOR is not set
364# CONFIG_MTD is not set
365# CONFIG_PARPORT is not set
366CONFIG_BLK_DEV=y
367# CONFIG_BLK_CPQ_CISS_DA is not set
368# CONFIG_BLK_DEV_DAC960 is not set
369# CONFIG_BLK_DEV_UMEM is not set
370# CONFIG_BLK_DEV_COW_COMMON is not set
371# CONFIG_BLK_DEV_LOOP is not set
372# CONFIG_BLK_DEV_NBD is not set
373# CONFIG_BLK_DEV_SX8 is not set
374CONFIG_BLK_DEV_RAM=y
375CONFIG_BLK_DEV_RAM_COUNT=16
376CONFIG_BLK_DEV_RAM_SIZE=4096
377CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
378# CONFIG_CDROM_PKTCDVD is not set
379# CONFIG_ATA_OVER_ETH is not set
380CONFIG_MISC_DEVICES=y
381# CONFIG_PHANTOM is not set
382# CONFIG_EEPROM_93CX6 is not set
383# CONFIG_SGI_IOC4 is not set
384# CONFIG_TIFM_CORE is not set
385# CONFIG_IDE is not set
386
387#
388# SCSI device support
389#
390# CONFIG_RAID_ATTRS is not set
391CONFIG_SCSI=y
392CONFIG_SCSI_DMA=y
393# CONFIG_SCSI_TGT is not set
394# CONFIG_SCSI_NETLINK is not set
395CONFIG_SCSI_PROC_FS=y
396
397#
398# SCSI support type (disk, tape, CD-ROM)
399#
400CONFIG_BLK_DEV_SD=y
401# CONFIG_CHR_DEV_ST is not set
402# CONFIG_CHR_DEV_OSST is not set
403# CONFIG_BLK_DEV_SR is not set
404# CONFIG_CHR_DEV_SG is not set
405# CONFIG_CHR_DEV_SCH is not set
406
407#
408# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
409#
410# CONFIG_SCSI_MULTI_LUN is not set
411# CONFIG_SCSI_CONSTANTS is not set
412# CONFIG_SCSI_LOGGING is not set
413# CONFIG_SCSI_SCAN_ASYNC is not set
414CONFIG_SCSI_WAIT_SCAN=m
415
416#
417# SCSI Transports
418#
419# CONFIG_SCSI_SPI_ATTRS is not set
420# CONFIG_SCSI_FC_ATTRS is not set
421# CONFIG_SCSI_ISCSI_ATTRS is not set
422# CONFIG_SCSI_SAS_LIBSAS is not set
423CONFIG_SCSI_LOWLEVEL=y
424# CONFIG_ISCSI_TCP is not set
425# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
426# CONFIG_SCSI_3W_9XXX is not set
427# CONFIG_SCSI_ACARD is not set
428# CONFIG_SCSI_AACRAID is not set
429# CONFIG_SCSI_AIC7XXX is not set
430# CONFIG_SCSI_AIC7XXX_OLD is not set
431# CONFIG_SCSI_AIC79XX is not set
432# CONFIG_SCSI_AIC94XX is not set
433# CONFIG_SCSI_ARCMSR is not set
434# CONFIG_MEGARAID_NEWGEN is not set
435# CONFIG_MEGARAID_LEGACY is not set
436# CONFIG_MEGARAID_SAS is not set
437# CONFIG_SCSI_HPTIOP is not set
438# CONFIG_SCSI_DMX3191D is not set
439# CONFIG_SCSI_FUTURE_DOMAIN is not set
440# CONFIG_SCSI_IPS is not set
441# CONFIG_SCSI_INITIO is not set
442# CONFIG_SCSI_INIA100 is not set
443# CONFIG_SCSI_STEX is not set
444# CONFIG_SCSI_SYM53C8XX_2 is not set
445# CONFIG_SCSI_IPR is not set
446# CONFIG_SCSI_QLOGIC_1280 is not set
447# CONFIG_SCSI_QLA_FC is not set
448# CONFIG_SCSI_QLA_ISCSI is not set
449# CONFIG_SCSI_LPFC is not set
450# CONFIG_SCSI_DC395x is not set
451# CONFIG_SCSI_DC390T is not set
452# CONFIG_SCSI_NSP32 is not set
453# CONFIG_SCSI_DEBUG is not set
454# CONFIG_SCSI_SRP is not set
455CONFIG_ATA=y
456# CONFIG_ATA_NONSTANDARD is not set
457# CONFIG_SATA_AHCI is not set
458# CONFIG_SATA_SVW is not set
459# CONFIG_ATA_PIIX is not set
460# CONFIG_SATA_MV is not set
461# CONFIG_SATA_NV is not set
462# CONFIG_PDC_ADMA is not set
463# CONFIG_SATA_QSTOR is not set
464# CONFIG_SATA_PROMISE is not set
465# CONFIG_SATA_SX4 is not set
466# CONFIG_SATA_SIL is not set
467# CONFIG_SATA_SIL24 is not set
468# CONFIG_SATA_SIS is not set
469# CONFIG_SATA_ULI is not set
470# CONFIG_SATA_VIA is not set
471# CONFIG_SATA_VITESSE is not set
472# CONFIG_SATA_INIC162X is not set
473# CONFIG_PATA_ALI is not set
474# CONFIG_PATA_AMD is not set
475# CONFIG_PATA_ARTOP is not set
476# CONFIG_PATA_ATIIXP is not set
477# CONFIG_PATA_CMD640_PCI is not set
478# CONFIG_PATA_CMD64X is not set
479# CONFIG_PATA_CS5520 is not set
480# CONFIG_PATA_CS5530 is not set
481# CONFIG_PATA_CYPRESS is not set
482# CONFIG_PATA_EFAR is not set
483# CONFIG_ATA_GENERIC is not set
484# CONFIG_PATA_HPT366 is not set
485# CONFIG_PATA_HPT37X is not set
486# CONFIG_PATA_HPT3X2N is not set
487# CONFIG_PATA_HPT3X3 is not set
488# CONFIG_PATA_IT821X is not set
489# CONFIG_PATA_IT8213 is not set
490# CONFIG_PATA_JMICRON is not set
491# CONFIG_PATA_TRIFLEX is not set
492# CONFIG_PATA_MARVELL is not set
493# CONFIG_PATA_MPIIX is not set
494# CONFIG_PATA_OLDPIIX is not set
495# CONFIG_PATA_NETCELL is not set
496# CONFIG_PATA_NS87410 is not set
497# CONFIG_PATA_OPTI is not set
498# CONFIG_PATA_OPTIDMA is not set
499# CONFIG_PATA_PDC_OLD is not set
500# CONFIG_PATA_RADISYS is not set
501# CONFIG_PATA_RZ1000 is not set
502# CONFIG_PATA_SC1200 is not set
503# CONFIG_PATA_SERVERWORKS is not set
504# CONFIG_PATA_PDC2027X is not set
505# CONFIG_PATA_SIL680 is not set
506# CONFIG_PATA_SIS is not set
507# CONFIG_PATA_VIA is not set
508# CONFIG_PATA_WINBOND is not set
509CONFIG_PATA_PLATFORM=y
510# CONFIG_MD is not set
511
512#
513# Fusion MPT device support
514#
515# CONFIG_FUSION is not set
516# CONFIG_FUSION_SPI is not set
517# CONFIG_FUSION_FC is not set
518# CONFIG_FUSION_SAS is not set
519
520#
521# IEEE 1394 (FireWire) support
522#
523# CONFIG_FIREWIRE is not set
524# CONFIG_IEEE1394 is not set
525# CONFIG_I2O is not set
526CONFIG_NETDEVICES=y
527# CONFIG_NETDEVICES_MULTIQUEUE is not set
528# CONFIG_DUMMY is not set
529# CONFIG_BONDING is not set
530# CONFIG_MACVLAN is not set
531# CONFIG_EQUALIZER is not set
532# CONFIG_TUN is not set
533# CONFIG_ARCNET is not set
534# CONFIG_PHYLIB is not set
535CONFIG_NET_ETHERNET=y
536CONFIG_MII=y
537# CONFIG_STNIC is not set
538# CONFIG_HAPPYMEAL is not set
539# CONFIG_SUNGEM is not set
540# CONFIG_CASSINI is not set
541# CONFIG_NET_VENDOR_3COM is not set
542# CONFIG_SMC91X is not set
543# CONFIG_NET_TULIP is not set
544# CONFIG_HP100 is not set
545CONFIG_NET_PCI=y
546# CONFIG_PCNET32 is not set
547# CONFIG_AMD8111_ETH is not set
548# CONFIG_ADAPTEC_STARFIRE is not set
549# CONFIG_B44 is not set
550# CONFIG_FORCEDETH is not set
551# CONFIG_DGRS is not set
552# CONFIG_EEPRO100 is not set
553# CONFIG_E100 is not set
554# CONFIG_FEALNX is not set
555# CONFIG_NATSEMI is not set
556# CONFIG_NE2K_PCI is not set
557# CONFIG_8139CP is not set
558CONFIG_8139TOO=y
559# CONFIG_8139TOO_PIO is not set
560# CONFIG_8139TOO_TUNE_TWISTER is not set
561# CONFIG_8139TOO_8129 is not set
562# CONFIG_8139_OLD_RX_RESET is not set
563# CONFIG_SIS900 is not set
564# CONFIG_EPIC100 is not set
565# CONFIG_SUNDANCE is not set
566# CONFIG_TLAN is not set
567# CONFIG_VIA_RHINE is not set
568# CONFIG_SC92031 is not set
569CONFIG_NETDEV_1000=y
570# CONFIG_ACENIC is not set
571# CONFIG_DL2K is not set
572# CONFIG_E1000 is not set
573# CONFIG_NS83820 is not set
574# CONFIG_HAMACHI is not set
575# CONFIG_YELLOWFIN is not set
576# CONFIG_R8169 is not set
577# CONFIG_SIS190 is not set
578# CONFIG_SKGE is not set
579# CONFIG_SKY2 is not set
580# CONFIG_VIA_VELOCITY is not set
581# CONFIG_TIGON3 is not set
582# CONFIG_BNX2 is not set
583# CONFIG_QLA3XXX is not set
584# CONFIG_ATL1 is not set
585CONFIG_NETDEV_10000=y
586# CONFIG_CHELSIO_T1 is not set
587# CONFIG_CHELSIO_T3 is not set
588# CONFIG_IXGB is not set
589# CONFIG_S2IO is not set
590# CONFIG_MYRI10GE is not set
591# CONFIG_NETXEN_NIC is not set
592# CONFIG_MLX4_CORE is not set
593# CONFIG_TR is not set
594
595#
596# Wireless LAN
597#
598# CONFIG_WLAN_PRE80211 is not set
599# CONFIG_WLAN_80211 is not set
600# CONFIG_WAN is not set
601# CONFIG_FDDI is not set
602# CONFIG_HIPPI is not set
603# CONFIG_PPP is not set
604# CONFIG_SLIP is not set
605# CONFIG_NET_FC is not set
606# CONFIG_SHAPER is not set
607# CONFIG_NETCONSOLE is not set
608# CONFIG_NETPOLL is not set
609# CONFIG_NET_POLL_CONTROLLER is not set
610# CONFIG_ISDN is not set
611# CONFIG_PHONE is not set
612
613#
614# Input device support
615#
616CONFIG_INPUT=y
617# CONFIG_INPUT_FF_MEMLESS is not set
618# CONFIG_INPUT_POLLDEV is not set
619
620#
621# Userland interfaces
622#
623# CONFIG_INPUT_MOUSEDEV is not set
624# CONFIG_INPUT_JOYDEV is not set
625# CONFIG_INPUT_TSDEV is not set
626# CONFIG_INPUT_EVDEV is not set
627# CONFIG_INPUT_EVBUG is not set
628
629#
630# Input Device Drivers
631#
632# CONFIG_INPUT_KEYBOARD is not set
633# CONFIG_INPUT_MOUSE is not set
634# CONFIG_INPUT_JOYSTICK is not set
635# CONFIG_INPUT_TABLET is not set
636# CONFIG_INPUT_TOUCHSCREEN is not set
637# CONFIG_INPUT_MISC is not set
638
639#
640# Hardware I/O ports
641#
642# CONFIG_SERIO is not set
643# CONFIG_GAMEPORT is not set
644
645#
646# Character devices
647#
648CONFIG_VT=y
649CONFIG_VT_CONSOLE=y
650CONFIG_HW_CONSOLE=y
651CONFIG_VT_HW_CONSOLE_BINDING=y
652# CONFIG_SERIAL_NONSTANDARD is not set
653
654#
655# Serial drivers
656#
657CONFIG_SERIAL_8250=y
658# CONFIG_SERIAL_8250_CONSOLE is not set
659CONFIG_SERIAL_8250_PCI=y
660CONFIG_SERIAL_8250_NR_UARTS=4
661CONFIG_SERIAL_8250_RUNTIME_UARTS=4
662# CONFIG_SERIAL_8250_EXTENDED is not set
663
664#
665# Non-8250 serial port support
666#
667CONFIG_SERIAL_SH_SCI=y
668CONFIG_SERIAL_SH_SCI_NR_UARTS=1
669CONFIG_SERIAL_SH_SCI_CONSOLE=y
670CONFIG_SERIAL_CORE=y
671CONFIG_SERIAL_CORE_CONSOLE=y
672# CONFIG_SERIAL_JSM is not set
673CONFIG_UNIX98_PTYS=y
674CONFIG_LEGACY_PTYS=y
675CONFIG_LEGACY_PTY_COUNT=256
676# CONFIG_IPMI_HANDLER is not set
677# CONFIG_WATCHDOG is not set
678CONFIG_HW_RANDOM=y
679# CONFIG_R3964 is not set
680# CONFIG_APPLICOM is not set
681# CONFIG_DRM is not set
682# CONFIG_RAW_DRIVER is not set
683# CONFIG_TCG_TPM is not set
684CONFIG_DEVPORT=y
685# CONFIG_I2C is not set
686
687#
688# SPI support
689#
690# CONFIG_SPI is not set
691# CONFIG_SPI_MASTER is not set
692# CONFIG_W1 is not set
693# CONFIG_POWER_SUPPLY is not set
694CONFIG_HWMON=y
695# CONFIG_HWMON_VID is not set
696# CONFIG_SENSORS_ABITUGURU is not set
697# CONFIG_SENSORS_ABITUGURU3 is not set
698# CONFIG_SENSORS_F71805F is not set
699# CONFIG_SENSORS_IT87 is not set
700# CONFIG_SENSORS_PC87360 is not set
701# CONFIG_SENSORS_PC87427 is not set
702# CONFIG_SENSORS_SIS5595 is not set
703# CONFIG_SENSORS_SMSC47M1 is not set
704# CONFIG_SENSORS_SMSC47B397 is not set
705# CONFIG_SENSORS_VIA686A is not set
706# CONFIG_SENSORS_VT1211 is not set
707# CONFIG_SENSORS_VT8231 is not set
708# CONFIG_SENSORS_W83627HF is not set
709# CONFIG_SENSORS_W83627EHF is not set
710# CONFIG_HWMON_DEBUG_CHIP is not set
711
712#
713# Multifunction device drivers
714#
715CONFIG_MFD_SM501=y
716
717#
718# Multimedia devices
719#
720# CONFIG_VIDEO_DEV is not set
721# CONFIG_DVB_CORE is not set
722CONFIG_DAB=y
723
724#
725# Graphics support
726#
727# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
728
729#
730# Display device support
731#
732# CONFIG_DISPLAY_SUPPORT is not set
733# CONFIG_VGASTATE is not set
734CONFIG_VIDEO_OUTPUT_CONTROL=m
735CONFIG_FB=y
736# CONFIG_FIRMWARE_EDID is not set
737# CONFIG_FB_DDC is not set
738CONFIG_FB_CFB_FILLRECT=y
739CONFIG_FB_CFB_COPYAREA=y
740CONFIG_FB_CFB_IMAGEBLIT=y
741# CONFIG_FB_SYS_FILLRECT is not set
742# CONFIG_FB_SYS_COPYAREA is not set
743# CONFIG_FB_SYS_IMAGEBLIT is not set
744# CONFIG_FB_SYS_FOPS is not set
745CONFIG_FB_DEFERRED_IO=y
746# CONFIG_FB_SVGALIB is not set
747# CONFIG_FB_MACMODES is not set
748# CONFIG_FB_BACKLIGHT is not set
749# CONFIG_FB_MODE_HELPERS is not set
750# CONFIG_FB_TILEBLITTING is not set
751
752#
753# Frame buffer hardware drivers
754#
755# CONFIG_FB_CIRRUS is not set
756# CONFIG_FB_PM2 is not set
757# CONFIG_FB_CYBER2000 is not set
758# CONFIG_FB_ASILIANT is not set
759# CONFIG_FB_IMSTT is not set
760# CONFIG_FB_S1D13XXX is not set
761# CONFIG_FB_NVIDIA is not set
762# CONFIG_FB_RIVA is not set
763# CONFIG_FB_MATROX is not set
764# CONFIG_FB_RADEON is not set
765# CONFIG_FB_ATY128 is not set
766# CONFIG_FB_ATY is not set
767# CONFIG_FB_S3 is not set
768# CONFIG_FB_SAVAGE is not set
769# CONFIG_FB_SIS is not set
770# CONFIG_FB_NEOMAGIC is not set
771# CONFIG_FB_KYRO is not set
772# CONFIG_FB_3DFX is not set
773# CONFIG_FB_VOODOO1 is not set
774# CONFIG_FB_VT8623 is not set
775# CONFIG_FB_TRIDENT is not set
776# CONFIG_FB_ARK is not set
777# CONFIG_FB_PM3 is not set
778CONFIG_FB_SM501=y
779# CONFIG_FB_VIRTUAL is not set
780
781#
782# Console display driver support
783#
784CONFIG_DUMMY_CONSOLE=y
785CONFIG_FRAMEBUFFER_CONSOLE=y
786# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
787# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
788# CONFIG_FONTS is not set
789CONFIG_FONT_8x8=y
790CONFIG_FONT_8x16=y
791CONFIG_LOGO=y
792# CONFIG_LOGO_LINUX_MONO is not set
793# CONFIG_LOGO_LINUX_VGA16 is not set
794# CONFIG_LOGO_LINUX_CLUT224 is not set
795# CONFIG_LOGO_SUPERH_MONO is not set
796# CONFIG_LOGO_SUPERH_VGA16 is not set
797CONFIG_LOGO_SUPERH_CLUT224=y
798
799#
800# Sound
801#
802CONFIG_SOUND=y
803
804#
805# Advanced Linux Sound Architecture
806#
807CONFIG_SND=m
808CONFIG_SND_TIMER=m
809CONFIG_SND_PCM=m
810CONFIG_SND_HWDEP=m
811CONFIG_SND_RAWMIDI=m
812# CONFIG_SND_SEQUENCER is not set
813# CONFIG_SND_MIXER_OSS is not set
814# CONFIG_SND_PCM_OSS is not set
815# CONFIG_SND_DYNAMIC_MINORS is not set
816CONFIG_SND_SUPPORT_OLD_API=y
817CONFIG_SND_VERBOSE_PROCFS=y
818# CONFIG_SND_VERBOSE_PRINTK is not set
819# CONFIG_SND_DEBUG is not set
820
821#
822# Generic devices
823#
824CONFIG_SND_MPU401_UART=m
825CONFIG_SND_OPL3_LIB=m
826CONFIG_SND_AC97_CODEC=m
827# CONFIG_SND_DUMMY is not set
828# CONFIG_SND_MTPAV is not set
829# CONFIG_SND_SERIAL_U16550 is not set
830# CONFIG_SND_MPU401 is not set
831
832#
833# PCI devices
834#
835# CONFIG_SND_AD1889 is not set
836# CONFIG_SND_ALS300 is not set
837# CONFIG_SND_ALI5451 is not set
838# CONFIG_SND_ATIIXP is not set
839# CONFIG_SND_ATIIXP_MODEM is not set
840# CONFIG_SND_AU8810 is not set
841# CONFIG_SND_AU8820 is not set
842# CONFIG_SND_AU8830 is not set
843# CONFIG_SND_AZT3328 is not set
844# CONFIG_SND_BT87X is not set
845# CONFIG_SND_CA0106 is not set
846# CONFIG_SND_CMIPCI is not set
847# CONFIG_SND_CS4281 is not set
848# CONFIG_SND_CS46XX is not set
849# CONFIG_SND_DARLA20 is not set
850# CONFIG_SND_GINA20 is not set
851# CONFIG_SND_LAYLA20 is not set
852# CONFIG_SND_DARLA24 is not set
853# CONFIG_SND_GINA24 is not set
854# CONFIG_SND_LAYLA24 is not set
855# CONFIG_SND_MONA is not set
856# CONFIG_SND_MIA is not set
857# CONFIG_SND_ECHO3G is not set
858# CONFIG_SND_INDIGO is not set
859# CONFIG_SND_INDIGOIO is not set
860# CONFIG_SND_INDIGODJ is not set
861# CONFIG_SND_EMU10K1 is not set
862# CONFIG_SND_EMU10K1X is not set
863# CONFIG_SND_ENS1370 is not set
864# CONFIG_SND_ENS1371 is not set
865# CONFIG_SND_ES1938 is not set
866# CONFIG_SND_ES1968 is not set
867# CONFIG_SND_FM801 is not set
868# CONFIG_SND_HDA_INTEL is not set
869# CONFIG_SND_HDSP is not set
870# CONFIG_SND_HDSPM is not set
871# CONFIG_SND_ICE1712 is not set
872# CONFIG_SND_ICE1724 is not set
873# CONFIG_SND_INTEL8X0 is not set
874# CONFIG_SND_INTEL8X0M is not set
875# CONFIG_SND_KORG1212 is not set
876# CONFIG_SND_MAESTRO3 is not set
877# CONFIG_SND_MIXART is not set
878# CONFIG_SND_NM256 is not set
879# CONFIG_SND_PCXHR is not set
880# CONFIG_SND_RIPTIDE is not set
881# CONFIG_SND_RME32 is not set
882# CONFIG_SND_RME96 is not set
883# CONFIG_SND_RME9652 is not set
884# CONFIG_SND_SONICVIBES is not set
885# CONFIG_SND_TRIDENT is not set
886# CONFIG_SND_VIA82XX is not set
887# CONFIG_SND_VIA82XX_MODEM is not set
888# CONFIG_SND_VX222 is not set
889CONFIG_SND_YMFPCI=m
890CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL=y
891# CONFIG_SND_AC97_POWER_SAVE is not set
892
893#
894# SUPERH devices
895#
896
897#
898# System on Chip audio support
899#
900# CONFIG_SND_SOC is not set
901
902#
903# SoC Audio support for SuperH
904#
905
906#
907# Open Sound System
908#
909CONFIG_SOUND_PRIME=m
910# CONFIG_SOUND_TRIDENT is not set
911# CONFIG_SOUND_MSNDCLAS is not set
912# CONFIG_SOUND_MSNDPIN is not set
913CONFIG_AC97_BUS=m
914CONFIG_HID_SUPPORT=y
915CONFIG_HID=y
916# CONFIG_HID_DEBUG is not set
917CONFIG_USB_SUPPORT=y
918CONFIG_USB_ARCH_HAS_HCD=y
919CONFIG_USB_ARCH_HAS_OHCI=y
920CONFIG_USB_ARCH_HAS_EHCI=y
921# CONFIG_USB is not set
922
923#
924# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
925#
926
927#
928# USB Gadget Support
929#
930# CONFIG_USB_GADGET is not set
931# CONFIG_MMC is not set
932# CONFIG_NEW_LEDS is not set
933# CONFIG_INFINIBAND is not set
934CONFIG_RTC_LIB=y
935CONFIG_RTC_CLASS=y
936CONFIG_RTC_HCTOSYS=y
937CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
938# CONFIG_RTC_DEBUG is not set
939
940#
941# RTC interfaces
942#
943CONFIG_RTC_INTF_SYSFS=y
944CONFIG_RTC_INTF_PROC=y
945CONFIG_RTC_INTF_DEV=y
946# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
947# CONFIG_RTC_DRV_TEST is not set
948
949#
950# SPI RTC drivers
951#
952
953#
954# Platform RTC drivers
955#
956# CONFIG_RTC_DRV_DS1553 is not set
957# CONFIG_RTC_DRV_STK17TA8 is not set
958# CONFIG_RTC_DRV_DS1742 is not set
959# CONFIG_RTC_DRV_M48T86 is not set
960# CONFIG_RTC_DRV_M48T59 is not set
961# CONFIG_RTC_DRV_V3020 is not set
962
963#
964# on-CPU RTC drivers
965#
966CONFIG_RTC_DRV_SH=y
967
968#
969# DMA Engine support
970#
971# CONFIG_DMA_ENGINE is not set
972
973#
974# DMA Clients
975#
976
977#
978# DMA Devices
979#
980
981#
982# Userspace I/O
983#
984# CONFIG_UIO is not set
985
986#
987# File systems
988#
989CONFIG_EXT2_FS=y
990# CONFIG_EXT2_FS_XATTR is not set
991# CONFIG_EXT2_FS_XIP is not set
992# CONFIG_EXT3_FS is not set
993# CONFIG_EXT4DEV_FS is not set
994# CONFIG_REISERFS_FS is not set
995# CONFIG_JFS_FS is not set
996# CONFIG_FS_POSIX_ACL is not set
997# CONFIG_XFS_FS is not set
998# CONFIG_GFS2_FS is not set
999# CONFIG_OCFS2_FS is not set
1000CONFIG_MINIX_FS=y
1001# CONFIG_ROMFS_FS is not set
1002CONFIG_INOTIFY=y
1003CONFIG_INOTIFY_USER=y
1004# CONFIG_QUOTA is not set
1005CONFIG_DNOTIFY=y
1006# CONFIG_AUTOFS_FS is not set
1007# CONFIG_AUTOFS4_FS is not set
1008# CONFIG_FUSE_FS is not set
1009
1010#
1011# CD-ROM/DVD Filesystems
1012#
1013# CONFIG_ISO9660_FS is not set
1014# CONFIG_UDF_FS is not set
1015
1016#
1017# DOS/FAT/NT Filesystems
1018#
1019CONFIG_FAT_FS=y
1020CONFIG_MSDOS_FS=y
1021CONFIG_VFAT_FS=y
1022CONFIG_FAT_DEFAULT_CODEPAGE=437
1023CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1024# CONFIG_NTFS_FS is not set
1025
1026#
1027# Pseudo filesystems
1028#
1029CONFIG_PROC_FS=y
1030CONFIG_PROC_KCORE=y
1031CONFIG_PROC_SYSCTL=y
1032CONFIG_SYSFS=y
1033CONFIG_TMPFS=y
1034# CONFIG_TMPFS_POSIX_ACL is not set
1035# CONFIG_HUGETLBFS is not set
1036# CONFIG_HUGETLB_PAGE is not set
1037CONFIG_RAMFS=y
1038# CONFIG_CONFIGFS_FS is not set
1039
1040#
1041# Miscellaneous filesystems
1042#
1043# CONFIG_ADFS_FS is not set
1044# CONFIG_AFFS_FS is not set
1045# CONFIG_HFS_FS is not set
1046# CONFIG_HFSPLUS_FS is not set
1047# CONFIG_BEFS_FS is not set
1048# CONFIG_BFS_FS is not set
1049# CONFIG_EFS_FS is not set
1050# CONFIG_CRAMFS is not set
1051# CONFIG_VXFS_FS is not set
1052# CONFIG_HPFS_FS is not set
1053# CONFIG_QNX4FS_FS is not set
1054# CONFIG_SYSV_FS is not set
1055# CONFIG_UFS_FS is not set
1056
1057#
1058# Network File Systems
1059#
1060# CONFIG_NFS_FS is not set
1061# CONFIG_NFSD is not set
1062# CONFIG_SMB_FS is not set
1063# CONFIG_CIFS is not set
1064# CONFIG_NCP_FS is not set
1065# CONFIG_CODA_FS is not set
1066# CONFIG_AFS_FS is not set
1067
1068#
1069# Partition Types
1070#
1071# CONFIG_PARTITION_ADVANCED is not set
1072CONFIG_MSDOS_PARTITION=y
1073
1074#
1075# Native Language Support
1076#
1077CONFIG_NLS=y
1078CONFIG_NLS_DEFAULT="iso8859-1"
1079# CONFIG_NLS_CODEPAGE_437 is not set
1080# CONFIG_NLS_CODEPAGE_737 is not set
1081# CONFIG_NLS_CODEPAGE_775 is not set
1082# CONFIG_NLS_CODEPAGE_850 is not set
1083# CONFIG_NLS_CODEPAGE_852 is not set
1084# CONFIG_NLS_CODEPAGE_855 is not set
1085# CONFIG_NLS_CODEPAGE_857 is not set
1086# CONFIG_NLS_CODEPAGE_860 is not set
1087# CONFIG_NLS_CODEPAGE_861 is not set
1088# CONFIG_NLS_CODEPAGE_862 is not set
1089# CONFIG_NLS_CODEPAGE_863 is not set
1090# CONFIG_NLS_CODEPAGE_864 is not set
1091# CONFIG_NLS_CODEPAGE_865 is not set
1092# CONFIG_NLS_CODEPAGE_866 is not set
1093# CONFIG_NLS_CODEPAGE_869 is not set
1094# CONFIG_NLS_CODEPAGE_936 is not set
1095# CONFIG_NLS_CODEPAGE_950 is not set
1096CONFIG_NLS_CODEPAGE_932=y
1097# CONFIG_NLS_CODEPAGE_949 is not set
1098# CONFIG_NLS_CODEPAGE_874 is not set
1099# CONFIG_NLS_ISO8859_8 is not set
1100# CONFIG_NLS_CODEPAGE_1250 is not set
1101# CONFIG_NLS_CODEPAGE_1251 is not set
1102# CONFIG_NLS_ASCII is not set
1103# CONFIG_NLS_ISO8859_1 is not set
1104# CONFIG_NLS_ISO8859_2 is not set
1105# CONFIG_NLS_ISO8859_3 is not set
1106# CONFIG_NLS_ISO8859_4 is not set
1107# CONFIG_NLS_ISO8859_5 is not set
1108# CONFIG_NLS_ISO8859_6 is not set
1109# CONFIG_NLS_ISO8859_7 is not set
1110# CONFIG_NLS_ISO8859_9 is not set
1111# CONFIG_NLS_ISO8859_13 is not set
1112# CONFIG_NLS_ISO8859_14 is not set
1113# CONFIG_NLS_ISO8859_15 is not set
1114# CONFIG_NLS_KOI8_R is not set
1115# CONFIG_NLS_KOI8_U is not set
1116# CONFIG_NLS_UTF8 is not set
1117
1118#
1119# Distributed Lock Manager
1120#
1121# CONFIG_DLM is not set
1122
1123#
1124# Profiling support
1125#
1126CONFIG_PROFILING=y
1127CONFIG_OPROFILE=y
1128
1129#
1130# Kernel hacking
1131#
1132CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1133# CONFIG_PRINTK_TIME is not set
1134CONFIG_ENABLE_MUST_CHECK=y
1135# CONFIG_MAGIC_SYSRQ is not set
1136# CONFIG_UNUSED_SYMBOLS is not set
1137# CONFIG_DEBUG_FS is not set
1138# CONFIG_HEADERS_CHECK is not set
1139# CONFIG_DEBUG_KERNEL is not set
1140# CONFIG_DEBUG_BUGVERBOSE is not set
1141# CONFIG_SH_STANDARD_BIOS is not set
1142CONFIG_EARLY_SCIF_CONSOLE=y
1143CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe80000
1144CONFIG_EARLY_PRINTK=y
1145# CONFIG_SH_KGDB is not set
1146
1147#
1148# Security options
1149#
1150# CONFIG_KEYS is not set
1151# CONFIG_SECURITY is not set
1152# CONFIG_CRYPTO is not set
1153
1154#
1155# Library routines
1156#
1157CONFIG_BITREVERSE=y
1158# CONFIG_CRC_CCITT is not set
1159# CONFIG_CRC16 is not set
1160# CONFIG_CRC_ITU_T is not set
1161CONFIG_CRC32=y
1162# CONFIG_CRC7 is not set
1163# CONFIG_LIBCRC32C is not set
1164CONFIG_PLIST=y
1165CONFIG_HAS_IOMEM=y
1166CONFIG_HAS_IOPORT=y
1167CONFIG_HAS_DMA=y
diff --git a/arch/sh/configs/se7206_defconfig b/arch/sh/configs/se7206_defconfig
index f2f2a3c9c32d..0d0cda908270 100644
--- a/arch/sh/configs/se7206_defconfig
+++ b/arch/sh/configs/se7206_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22-rc4 3# Linux kernel version: 2.6.23-rc4
4# Fri Jun 15 19:37:46 2007 4# Thu Sep 13 16:40:16 2007
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 7CONFIG_RWSEM_GENERIC_SPINLOCK=y
@@ -17,25 +17,22 @@ CONFIG_STACKTRACE_SUPPORT=y
17CONFIG_LOCKDEP_SUPPORT=y 17CONFIG_LOCKDEP_SUPPORT=y
18# CONFIG_ARCH_HAS_ILOG2_U32 is not set 18# CONFIG_ARCH_HAS_ILOG2_U32 is not set
19# CONFIG_ARCH_HAS_ILOG2_U64 is not set 19# CONFIG_ARCH_HAS_ILOG2_U64 is not set
20CONFIG_ARCH_NO_VIRT_TO_BUS=y
20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 21CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
21 22
22# 23#
23# Code maturity level options 24# General setup
24# 25#
25CONFIG_EXPERIMENTAL=y 26CONFIG_EXPERIMENTAL=y
26CONFIG_BROKEN_ON_SMP=y 27CONFIG_BROKEN_ON_SMP=y
27CONFIG_INIT_ENV_ARG_LIMIT=32 28CONFIG_INIT_ENV_ARG_LIMIT=32
28
29#
30# General setup
31#
32CONFIG_LOCALVERSION="" 29CONFIG_LOCALVERSION=""
33# CONFIG_LOCALVERSION_AUTO is not set 30# CONFIG_LOCALVERSION_AUTO is not set
34# CONFIG_SYSVIPC is not set 31# CONFIG_SYSVIPC is not set
35# CONFIG_POSIX_MQUEUE is not set 32# CONFIG_POSIX_MQUEUE is not set
36# CONFIG_BSD_PROCESS_ACCT is not set 33# CONFIG_BSD_PROCESS_ACCT is not set
37# CONFIG_TASKSTATS is not set 34# CONFIG_TASKSTATS is not set
38# CONFIG_UTS_NS is not set 35# CONFIG_USER_NS is not set
39# CONFIG_AUDIT is not set 36# CONFIG_AUDIT is not set
40# CONFIG_IKCONFIG is not set 37# CONFIG_IKCONFIG is not set
41CONFIG_LOG_BUF_SHIFT=14 38CONFIG_LOG_BUF_SHIFT=14
@@ -60,23 +57,17 @@ CONFIG_SIGNALFD=y
60CONFIG_TIMERFD=y 57CONFIG_TIMERFD=y
61CONFIG_EVENTFD=y 58CONFIG_EVENTFD=y
62# CONFIG_VM_EVENT_COUNTERS is not set 59# CONFIG_VM_EVENT_COUNTERS is not set
63CONFIG_SLAB=y 60CONFIG_SLUB_DEBUG=y
64# CONFIG_SLUB is not set 61# CONFIG_SLAB is not set
62CONFIG_SLUB=y
65# CONFIG_SLOB is not set 63# CONFIG_SLOB is not set
66CONFIG_TINY_SHMEM=y 64CONFIG_TINY_SHMEM=y
67CONFIG_BASE_SMALL=1 65CONFIG_BASE_SMALL=1
68
69#
70# Loadable module support
71#
72# CONFIG_MODULES is not set 66# CONFIG_MODULES is not set
73
74#
75# Block layer
76#
77CONFIG_BLOCK=y 67CONFIG_BLOCK=y
78# CONFIG_LBD is not set 68# CONFIG_LBD is not set
79# CONFIG_LSF is not set 69# CONFIG_LSF is not set
70# CONFIG_BLK_DEV_BSG is not set
80 71
81# 72#
82# IO Schedulers 73# IO Schedulers
@@ -98,7 +89,6 @@ CONFIG_CPU_SH2=y
98CONFIG_CPU_SH2A=y 89CONFIG_CPU_SH2A=y
99# CONFIG_CPU_SUBTYPE_SH7619 is not set 90# CONFIG_CPU_SUBTYPE_SH7619 is not set
100CONFIG_CPU_SUBTYPE_SH7206=y 91CONFIG_CPU_SUBTYPE_SH7206=y
101# CONFIG_CPU_SUBTYPE_SH7300 is not set
102# CONFIG_CPU_SUBTYPE_SH7705 is not set 92# CONFIG_CPU_SUBTYPE_SH7705 is not set
103# CONFIG_CPU_SUBTYPE_SH7706 is not set 93# CONFIG_CPU_SUBTYPE_SH7706 is not set
104# CONFIG_CPU_SUBTYPE_SH7707 is not set 94# CONFIG_CPU_SUBTYPE_SH7707 is not set
@@ -106,6 +96,7 @@ CONFIG_CPU_SUBTYPE_SH7206=y
106# CONFIG_CPU_SUBTYPE_SH7709 is not set 96# CONFIG_CPU_SUBTYPE_SH7709 is not set
107# CONFIG_CPU_SUBTYPE_SH7710 is not set 97# CONFIG_CPU_SUBTYPE_SH7710 is not set
108# CONFIG_CPU_SUBTYPE_SH7712 is not set 98# CONFIG_CPU_SUBTYPE_SH7712 is not set
99# CONFIG_CPU_SUBTYPE_SH7720 is not set
109# CONFIG_CPU_SUBTYPE_SH7750 is not set 100# CONFIG_CPU_SUBTYPE_SH7750 is not set
110# CONFIG_CPU_SUBTYPE_SH7091 is not set 101# CONFIG_CPU_SUBTYPE_SH7091 is not set
111# CONFIG_CPU_SUBTYPE_SH7750R is not set 102# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -119,7 +110,7 @@ CONFIG_CPU_SUBTYPE_SH7206=y
119# CONFIG_CPU_SUBTYPE_SH7770 is not set 110# CONFIG_CPU_SUBTYPE_SH7770 is not set
120# CONFIG_CPU_SUBTYPE_SH7780 is not set 111# CONFIG_CPU_SUBTYPE_SH7780 is not set
121# CONFIG_CPU_SUBTYPE_SH7785 is not set 112# CONFIG_CPU_SUBTYPE_SH7785 is not set
122# CONFIG_CPU_SUBTYPE_SH73180 is not set 113# CONFIG_CPU_SUBTYPE_SHX3 is not set
123# CONFIG_CPU_SUBTYPE_SH7343 is not set 114# CONFIG_CPU_SUBTYPE_SH7343 is not set
124# CONFIG_CPU_SUBTYPE_SH7722 is not set 115# CONFIG_CPU_SUBTYPE_SH7722 is not set
125 116
@@ -136,15 +127,16 @@ CONFIG_ARCH_SPARSEMEM_DEFAULT=y
136CONFIG_MAX_ACTIVE_REGIONS=1 127CONFIG_MAX_ACTIVE_REGIONS=1
137CONFIG_ARCH_POPULATES_NODE_MAP=y 128CONFIG_ARCH_POPULATES_NODE_MAP=y
138CONFIG_ARCH_SELECT_MEMORY_MODEL=y 129CONFIG_ARCH_SELECT_MEMORY_MODEL=y
130CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
139CONFIG_PAGE_SIZE_4KB=y 131CONFIG_PAGE_SIZE_4KB=y
140# CONFIG_PAGE_SIZE_8KB is not set 132# CONFIG_PAGE_SIZE_8KB is not set
141# CONFIG_PAGE_SIZE_64KB is not set 133# CONFIG_PAGE_SIZE_64KB is not set
142CONFIG_SELECT_MEMORY_MODEL=y 134CONFIG_SELECT_MEMORY_MODEL=y
143CONFIG_FLATMEM_MANUAL=y 135# CONFIG_FLATMEM_MANUAL is not set
144# CONFIG_DISCONTIGMEM_MANUAL is not set 136# CONFIG_DISCONTIGMEM_MANUAL is not set
145# CONFIG_SPARSEMEM_MANUAL is not set 137CONFIG_SPARSEMEM_MANUAL=y
146CONFIG_FLATMEM=y 138CONFIG_SPARSEMEM=y
147CONFIG_FLAT_NODE_MEM_MAP=y 139CONFIG_HAVE_MEMORY_PRESENT=y
148CONFIG_SPARSEMEM_STATIC=y 140CONFIG_SPARSEMEM_STATIC=y
149CONFIG_SPLIT_PTLOCK_CPUS=4 141CONFIG_SPLIT_PTLOCK_CPUS=4
150# CONFIG_RESOURCES_64BIT is not set 142# CONFIG_RESOURCES_64BIT is not set
@@ -155,7 +147,9 @@ CONFIG_NR_QUICK=2
155# Cache configuration 147# Cache configuration
156# 148#
157# CONFIG_SH_DIRECT_MAPPED is not set 149# CONFIG_SH_DIRECT_MAPPED is not set
158# CONFIG_SH_WRITETHROUGH is not set 150CONFIG_CACHE_WRITEBACK=y
151# CONFIG_CACHE_WRITETHROUGH is not set
152# CONFIG_CACHE_OFF is not set
159 153
160# 154#
161# Processor features 155# Processor features
@@ -163,8 +157,6 @@ CONFIG_NR_QUICK=2
163# CONFIG_CPU_LITTLE_ENDIAN is not set 157# CONFIG_CPU_LITTLE_ENDIAN is not set
164CONFIG_CPU_BIG_ENDIAN=y 158CONFIG_CPU_BIG_ENDIAN=y
165# CONFIG_SH_FPU_EMU is not set 159# CONFIG_SH_FPU_EMU is not set
166# CONFIG_SH_DSP is not set
167CONFIG_CPU_HAS_IPR_IRQ=y
168 160
169# 161#
170# Board support 162# Board support
@@ -185,12 +177,23 @@ CONFIG_SH_CLK_MD=6
185# 177#
186# CPU Frequency scaling 178# CPU Frequency scaling
187# 179#
188# CONFIG_CPU_FREQ is not set 180CONFIG_CPU_FREQ=y
181CONFIG_CPU_FREQ_TABLE=y
182# CONFIG_CPU_FREQ_DEBUG is not set
183CONFIG_CPU_FREQ_STAT=y
184# CONFIG_CPU_FREQ_STAT_DETAILS is not set
185CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
186# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
187CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
188# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
189# CONFIG_CPU_FREQ_GOV_USERSPACE is not set
190# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set
191# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
192# CONFIG_SH_CPU_FREQ is not set
189 193
190# 194#
191# DMA support 195# DMA support
192# 196#
193# CONFIG_SH_DMA is not set
194 197
195# 198#
196# Companion Chips 199# Companion Chips
@@ -199,17 +202,17 @@ CONFIG_SH_CLK_MD=6
199# 202#
200# Additional SuperH Device Drivers 203# Additional SuperH Device Drivers
201# 204#
202# CONFIG_HEARTBEAT is not set 205CONFIG_HEARTBEAT=y
203# CONFIG_PUSH_SWITCH is not set 206# CONFIG_PUSH_SWITCH is not set
204 207
205# 208#
206# Kernel features 209# Kernel features
207# 210#
208CONFIG_HZ_100=y 211# CONFIG_HZ_100 is not set
209# CONFIG_HZ_250 is not set 212# CONFIG_HZ_250 is not set
210# CONFIG_HZ_300 is not set 213# CONFIG_HZ_300 is not set
211# CONFIG_HZ_1000 is not set 214CONFIG_HZ_1000=y
212CONFIG_HZ=100 215CONFIG_HZ=1000
213# CONFIG_KEXEC is not set 216# CONFIG_KEXEC is not set
214# CONFIG_CRASH_DUMP is not set 217# CONFIG_CRASH_DUMP is not set
215CONFIG_PREEMPT_NONE=y 218CONFIG_PREEMPT_NONE=y
@@ -221,11 +224,13 @@ CONFIG_PREEMPT_NONE=y
221# 224#
222CONFIG_ZERO_PAGE_OFFSET=0x00001000 225CONFIG_ZERO_PAGE_OFFSET=0x00001000
223CONFIG_BOOT_LINK_OFFSET=0x00800000 226CONFIG_BOOT_LINK_OFFSET=0x00800000
224# CONFIG_CMDLINE_BOOL is not set 227CONFIG_CMDLINE_BOOL=y
228CONFIG_CMDLINE="console=ttySC3,115200 earlyprintk=serial ignore_loglevel"
225 229
226# 230#
227# Bus options 231# Bus options
228# 232#
233# CONFIG_CF_ENABLER is not set
229# CONFIG_ARCH_SUPPORTS_MSI is not set 234# CONFIG_ARCH_SUPPORTS_MSI is not set
230 235
231# 236#
@@ -315,6 +320,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
315# CONFIG_MAC80211 is not set 320# CONFIG_MAC80211 is not set
316# CONFIG_IEEE80211 is not set 321# CONFIG_IEEE80211 is not set
317# CONFIG_RFKILL is not set 322# CONFIG_RFKILL is not set
323# CONFIG_NET_9P is not set
318 324
319# 325#
320# Device Drivers 326# Device Drivers
@@ -325,11 +331,9 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
325# 331#
326# CONFIG_STANDALONE is not set 332# CONFIG_STANDALONE is not set
327# CONFIG_PREVENT_FIRMWARE_BUILD is not set 333# CONFIG_PREVENT_FIRMWARE_BUILD is not set
334# CONFIG_DEBUG_DRIVER is not set
335# CONFIG_DEBUG_DEVRES is not set
328# CONFIG_SYS_HYPERVISOR is not set 336# CONFIG_SYS_HYPERVISOR is not set
329
330#
331# Connector - unified userspace <-> kernelspace linker
332#
333# CONFIG_CONNECTOR is not set 337# CONFIG_CONNECTOR is not set
334CONFIG_MTD=y 338CONFIG_MTD=y
335# CONFIG_MTD_DEBUG is not set 339# CONFIG_MTD_DEBUG is not set
@@ -411,31 +415,16 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=4
411# UBI - Unsorted block images 415# UBI - Unsorted block images
412# 416#
413# CONFIG_MTD_UBI is not set 417# CONFIG_MTD_UBI is not set
414
415#
416# Parallel port support
417#
418# CONFIG_PARPORT is not set 418# CONFIG_PARPORT is not set
419 419CONFIG_BLK_DEV=y
420#
421# Plug and Play support
422#
423# CONFIG_PNPACPI is not set
424
425#
426# Block devices
427#
428# CONFIG_BLK_DEV_COW_COMMON is not set 420# CONFIG_BLK_DEV_COW_COMMON is not set
429# CONFIG_BLK_DEV_LOOP is not set 421# CONFIG_BLK_DEV_LOOP is not set
430# CONFIG_BLK_DEV_NBD is not set 422# CONFIG_BLK_DEV_NBD is not set
431# CONFIG_BLK_DEV_RAM is not set 423# CONFIG_BLK_DEV_RAM is not set
432# CONFIG_CDROM_PKTCDVD is not set 424# CONFIG_CDROM_PKTCDVD is not set
433# CONFIG_ATA_OVER_ETH is not set 425# CONFIG_ATA_OVER_ETH is not set
434 426CONFIG_MISC_DEVICES=y
435# 427# CONFIG_EEPROM_93CX6 is not set
436# Misc devices
437#
438# CONFIG_BLINK is not set
439# CONFIG_IDE is not set 428# CONFIG_IDE is not set
440 429
441# 430#
@@ -443,27 +432,18 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=4
443# 432#
444# CONFIG_RAID_ATTRS is not set 433# CONFIG_RAID_ATTRS is not set
445# CONFIG_SCSI is not set 434# CONFIG_SCSI is not set
435# CONFIG_SCSI_DMA is not set
446# CONFIG_SCSI_NETLINK is not set 436# CONFIG_SCSI_NETLINK is not set
447# CONFIG_ATA is not set 437# CONFIG_ATA is not set
448
449#
450# Multi-device support (RAID and LVM)
451#
452# CONFIG_MD is not set 438# CONFIG_MD is not set
453
454#
455# Network device support
456#
457CONFIG_NETDEVICES=y 439CONFIG_NETDEVICES=y
440# CONFIG_NETDEVICES_MULTIQUEUE is not set
458# CONFIG_DUMMY is not set 441# CONFIG_DUMMY is not set
459# CONFIG_BONDING is not set 442# CONFIG_BONDING is not set
443# CONFIG_MACVLAN is not set
460# CONFIG_EQUALIZER is not set 444# CONFIG_EQUALIZER is not set
461# CONFIG_TUN is not set 445# CONFIG_TUN is not set
462# CONFIG_PHYLIB is not set 446# CONFIG_PHYLIB is not set
463
464#
465# Ethernet (10 or 100Mbit)
466#
467CONFIG_NET_ETHERNET=y 447CONFIG_NET_ETHERNET=y
468CONFIG_MII=y 448CONFIG_MII=y
469# CONFIG_STNIC is not set 449# CONFIG_STNIC is not set
@@ -483,15 +463,7 @@ CONFIG_NETDEV_10000=y
483# CONFIG_NETCONSOLE is not set 463# CONFIG_NETCONSOLE is not set
484# CONFIG_NETPOLL is not set 464# CONFIG_NETPOLL is not set
485# CONFIG_NET_POLL_CONTROLLER is not set 465# CONFIG_NET_POLL_CONTROLLER is not set
486
487#
488# ISDN subsystem
489#
490# CONFIG_ISDN is not set 466# CONFIG_ISDN is not set
491
492#
493# Telephony Support
494#
495# CONFIG_PHONE is not set 467# CONFIG_PHONE is not set
496 468
497# 469#
@@ -499,6 +471,7 @@ CONFIG_NETDEV_10000=y
499# 471#
500CONFIG_INPUT=y 472CONFIG_INPUT=y
501# CONFIG_INPUT_FF_MEMLESS is not set 473# CONFIG_INPUT_FF_MEMLESS is not set
474# CONFIG_INPUT_POLLDEV is not set
502 475
503# 476#
504# Userland interfaces 477# Userland interfaces
@@ -546,19 +519,11 @@ CONFIG_SERIAL_CORE=y
546CONFIG_SERIAL_CORE_CONSOLE=y 519CONFIG_SERIAL_CORE_CONSOLE=y
547# CONFIG_UNIX98_PTYS is not set 520# CONFIG_UNIX98_PTYS is not set
548# CONFIG_LEGACY_PTYS is not set 521# CONFIG_LEGACY_PTYS is not set
549
550#
551# IPMI
552#
553# CONFIG_IPMI_HANDLER is not set 522# CONFIG_IPMI_HANDLER is not set
554# CONFIG_WATCHDOG is not set 523# CONFIG_WATCHDOG is not set
555# CONFIG_HW_RANDOM is not set 524# CONFIG_HW_RANDOM is not set
556# CONFIG_R3964 is not set 525# CONFIG_R3964 is not set
557# CONFIG_RAW_DRIVER is not set 526# CONFIG_RAW_DRIVER is not set
558
559#
560# TPM devices
561#
562# CONFIG_TCG_TPM is not set 527# CONFIG_TCG_TPM is not set
563# CONFIG_I2C is not set 528# CONFIG_I2C is not set
564 529
@@ -567,11 +532,8 @@ CONFIG_SERIAL_CORE_CONSOLE=y
567# 532#
568# CONFIG_SPI is not set 533# CONFIG_SPI is not set
569# CONFIG_SPI_MASTER is not set 534# CONFIG_SPI_MASTER is not set
570
571#
572# Dallas's 1-wire bus
573#
574# CONFIG_W1 is not set 535# CONFIG_W1 is not set
536# CONFIG_POWER_SUPPLY is not set
575# CONFIG_HWMON is not set 537# CONFIG_HWMON is not set
576 538
577# 539#
@@ -596,25 +558,21 @@ CONFIG_DAB=y
596# 558#
597# CONFIG_DISPLAY_SUPPORT is not set 559# CONFIG_DISPLAY_SUPPORT is not set
598# CONFIG_VGASTATE is not set 560# CONFIG_VGASTATE is not set
561CONFIG_VIDEO_OUTPUT_CONTROL=y
599# CONFIG_FB is not set 562# CONFIG_FB is not set
600 563
601# 564#
602# Sound 565# Sound
603# 566#
604# CONFIG_SOUND is not set 567# CONFIG_SOUND is not set
605 568CONFIG_HID_SUPPORT=y
606#
607# HID Devices
608#
609CONFIG_HID=y 569CONFIG_HID=y
610# CONFIG_HID_DEBUG is not set 570# CONFIG_HID_DEBUG is not set
611 571CONFIG_USB_SUPPORT=y
612# 572CONFIG_USB_ARCH_HAS_HCD=y
613# USB support
614#
615# CONFIG_USB_ARCH_HAS_HCD is not set
616# CONFIG_USB_ARCH_HAS_OHCI is not set 573# CONFIG_USB_ARCH_HAS_OHCI is not set
617# CONFIG_USB_ARCH_HAS_EHCI is not set 574# CONFIG_USB_ARCH_HAS_EHCI is not set
575# CONFIG_USB is not set
618 576
619# 577#
620# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 578# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -625,31 +583,7 @@ CONFIG_HID=y
625# 583#
626# CONFIG_USB_GADGET is not set 584# CONFIG_USB_GADGET is not set
627# CONFIG_MMC is not set 585# CONFIG_MMC is not set
628
629#
630# LED devices
631#
632# CONFIG_NEW_LEDS is not set 586# CONFIG_NEW_LEDS is not set
633
634#
635# LED drivers
636#
637
638#
639# LED Triggers
640#
641
642#
643# InfiniBand support
644#
645
646#
647# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
648#
649
650#
651# Real Time Clock
652#
653# CONFIG_RTC_CLASS is not set 587# CONFIG_RTC_CLASS is not set
654 588
655# 589#
@@ -666,6 +600,11 @@ CONFIG_HID=y
666# 600#
667 601
668# 602#
603# Userspace I/O
604#
605# CONFIG_UIO is not set
606
607#
669# File systems 608# File systems
670# 609#
671# CONFIG_EXT2_FS is not set 610# CONFIG_EXT2_FS is not set
@@ -736,7 +675,6 @@ CONFIG_RAMFS=y
736# CONFIG_NCP_FS is not set 675# CONFIG_NCP_FS is not set
737# CONFIG_CODA_FS is not set 676# CONFIG_CODA_FS is not set
738# CONFIG_AFS_FS is not set 677# CONFIG_AFS_FS is not set
739# CONFIG_9P_FS is not set
740 678
741# 679#
742# Partition Types 680# Partition Types
@@ -752,12 +690,12 @@ CONFIG_MSDOS_PARTITION=y
752# 690#
753# Distributed Lock Manager 691# Distributed Lock Manager
754# 692#
755# CONFIG_DLM is not set
756 693
757# 694#
758# Profiling support 695# Profiling support
759# 696#
760# CONFIG_PROFILING is not set 697CONFIG_PROFILING=y
698# CONFIG_OPROFILE is not set
761 699
762# 700#
763# Kernel hacking 701# Kernel hacking
@@ -768,19 +706,41 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
768# CONFIG_MAGIC_SYSRQ is not set 706# CONFIG_MAGIC_SYSRQ is not set
769# CONFIG_UNUSED_SYMBOLS is not set 707# CONFIG_UNUSED_SYMBOLS is not set
770# CONFIG_HEADERS_CHECK is not set 708# CONFIG_HEADERS_CHECK is not set
771# CONFIG_DEBUG_KERNEL is not set 709CONFIG_DEBUG_KERNEL=y
772# CONFIG_DEBUG_BUGVERBOSE is not set 710# CONFIG_DEBUG_SHIRQ is not set
711CONFIG_DETECT_SOFTLOCKUP=y
712CONFIG_SCHED_DEBUG=y
713# CONFIG_SCHEDSTATS is not set
714# CONFIG_TIMER_STATS is not set
715CONFIG_SLUB_DEBUG_ON=y
716# CONFIG_DEBUG_SPINLOCK is not set
717# CONFIG_DEBUG_MUTEXES is not set
718# CONFIG_DEBUG_LOCK_ALLOC is not set
719# CONFIG_PROVE_LOCKING is not set
720# CONFIG_LOCK_STAT is not set
721CONFIG_DEBUG_SPINLOCK_SLEEP=y
722# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
723# CONFIG_DEBUG_KOBJECT is not set
724CONFIG_DEBUG_BUGVERBOSE=y
725CONFIG_DEBUG_INFO=y
726# CONFIG_DEBUG_VM is not set
727# CONFIG_DEBUG_LIST is not set
728CONFIG_FRAME_POINTER=y
729CONFIG_FORCED_INLINING=y
730# CONFIG_FAULT_INJECTION is not set
773# CONFIG_SH_STANDARD_BIOS is not set 731# CONFIG_SH_STANDARD_BIOS is not set
774# CONFIG_EARLY_SCIF_CONSOLE is not set 732CONFIG_EARLY_SCIF_CONSOLE=y
733CONFIG_EARLY_SCIF_CONSOLE_PORT=0xfffe9800
734CONFIG_EARLY_PRINTK=y
735# CONFIG_DEBUG_BOOTMEM is not set
736CONFIG_DEBUG_STACKOVERFLOW=y
737CONFIG_DEBUG_STACK_USAGE=y
738# CONFIG_4KSTACKS is not set
775 739
776# 740#
777# Security options 741# Security options
778# 742#
779# CONFIG_KEYS is not set 743# CONFIG_KEYS is not set
780
781#
782# Cryptographic options
783#
784# CONFIG_CRYPTO is not set 744# CONFIG_CRYPTO is not set
785 745
786# 746#
@@ -791,6 +751,7 @@ CONFIG_BITREVERSE=y
791# CONFIG_CRC16 is not set 751# CONFIG_CRC16 is not set
792# CONFIG_CRC_ITU_T is not set 752# CONFIG_CRC_ITU_T is not set
793CONFIG_CRC32=y 753CONFIG_CRC32=y
754# CONFIG_CRC7 is not set
794# CONFIG_LIBCRC32C is not set 755# CONFIG_LIBCRC32C is not set
795CONFIG_ZLIB_INFLATE=y 756CONFIG_ZLIB_INFLATE=y
796CONFIG_HAS_IOMEM=y 757CONFIG_HAS_IOMEM=y
diff --git a/arch/sh/configs/shx3_defconfig b/arch/sh/configs/shx3_defconfig
index 219bad558b10..a794c082709b 100644
--- a/arch/sh/configs/shx3_defconfig
+++ b/arch/sh/configs/shx3_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22-rc4 3# Linux kernel version: 2.6.23-rc7
4# Wed Jun 20 14:09:27 2007 4# Fri Sep 21 19:07:30 2007
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 7CONFIG_RWSEM_GENERIC_SPINLOCK=y
@@ -13,32 +13,33 @@ CONFIG_GENERIC_IRQ_PROBE=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y 13CONFIG_GENERIC_CALIBRATE_DELAY=y
14CONFIG_GENERIC_TIME=y 14CONFIG_GENERIC_TIME=y
15CONFIG_GENERIC_CLOCKEVENTS=y 15CONFIG_GENERIC_CLOCKEVENTS=y
16CONFIG_SYS_SUPPORTS_SMP=y
17CONFIG_SYS_SUPPORTS_NUMA=y
16CONFIG_STACKTRACE_SUPPORT=y 18CONFIG_STACKTRACE_SUPPORT=y
17CONFIG_LOCKDEP_SUPPORT=y 19CONFIG_LOCKDEP_SUPPORT=y
18# CONFIG_ARCH_HAS_ILOG2_U32 is not set 20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
19# CONFIG_ARCH_HAS_ILOG2_U64 is not set 21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_ARCH_NO_VIRT_TO_BUS=y
20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 23CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
21 24
22# 25#
23# Code maturity level options 26# General setup
24# 27#
25CONFIG_EXPERIMENTAL=y 28CONFIG_EXPERIMENTAL=y
26CONFIG_BROKEN_ON_SMP=y 29CONFIG_BROKEN_ON_SMP=y
27CONFIG_LOCK_KERNEL=y 30CONFIG_LOCK_KERNEL=y
28CONFIG_INIT_ENV_ARG_LIMIT=32 31CONFIG_INIT_ENV_ARG_LIMIT=32
29
30#
31# General setup
32#
33CONFIG_LOCALVERSION="" 32CONFIG_LOCALVERSION=""
34CONFIG_LOCALVERSION_AUTO=y 33CONFIG_LOCALVERSION_AUTO=y
35CONFIG_SWAP=y 34CONFIG_SWAP=y
36CONFIG_SYSVIPC=y 35CONFIG_SYSVIPC=y
37# CONFIG_IPC_NS is not set
38CONFIG_SYSVIPC_SYSCTL=y 36CONFIG_SYSVIPC_SYSCTL=y
37# CONFIG_POSIX_MQUEUE is not set
39CONFIG_BSD_PROCESS_ACCT=y 38CONFIG_BSD_PROCESS_ACCT=y
40# CONFIG_BSD_PROCESS_ACCT_V3 is not set 39# CONFIG_BSD_PROCESS_ACCT_V3 is not set
41# CONFIG_UTS_NS is not set 40# CONFIG_TASKSTATS is not set
41# CONFIG_USER_NS is not set
42# CONFIG_AUDIT is not set
42CONFIG_IKCONFIG=y 43CONFIG_IKCONFIG=y
43CONFIG_IKCONFIG_PROC=y 44CONFIG_IKCONFIG_PROC=y
44CONFIG_LOG_BUF_SHIFT=14 45CONFIG_LOG_BUF_SHIFT=14
@@ -63,34 +64,26 @@ CONFIG_FUTEX=y
63CONFIG_ANON_INODES=y 64CONFIG_ANON_INODES=y
64CONFIG_EPOLL=y 65CONFIG_EPOLL=y
65CONFIG_SIGNALFD=y 66CONFIG_SIGNALFD=y
66CONFIG_TIMERFD=y
67CONFIG_EVENTFD=y 67CONFIG_EVENTFD=y
68CONFIG_SHMEM=y 68CONFIG_SHMEM=y
69CONFIG_VM_EVENT_COUNTERS=y 69CONFIG_VM_EVENT_COUNTERS=y
70CONFIG_SLAB=y 70# CONFIG_SLAB is not set
71# CONFIG_SLUB is not set 71# CONFIG_SLUB is not set
72# CONFIG_SLOB is not set 72CONFIG_SLOB=y
73CONFIG_RT_MUTEXES=y 73CONFIG_RT_MUTEXES=y
74# CONFIG_TINY_SHMEM is not set 74# CONFIG_TINY_SHMEM is not set
75CONFIG_BASE_SMALL=0 75CONFIG_BASE_SMALL=0
76
77#
78# Loadable module support
79#
80CONFIG_MODULES=y 76CONFIG_MODULES=y
81CONFIG_MODULE_UNLOAD=y 77CONFIG_MODULE_UNLOAD=y
82# CONFIG_MODULE_FORCE_UNLOAD is not set 78# CONFIG_MODULE_FORCE_UNLOAD is not set
83# CONFIG_MODVERSIONS is not set 79# CONFIG_MODVERSIONS is not set
84# CONFIG_MODULE_SRCVERSION_ALL is not set 80# CONFIG_MODULE_SRCVERSION_ALL is not set
85CONFIG_KMOD=y 81CONFIG_KMOD=y
86
87#
88# Block layer
89#
90CONFIG_BLOCK=y 82CONFIG_BLOCK=y
91# CONFIG_LBD is not set 83# CONFIG_LBD is not set
92# CONFIG_BLK_DEV_IO_TRACE is not set 84# CONFIG_BLK_DEV_IO_TRACE is not set
93# CONFIG_LSF is not set 85# CONFIG_LSF is not set
86# CONFIG_BLK_DEV_BSG is not set
94 87
95# 88#
96# IO Schedulers 89# IO Schedulers
@@ -113,7 +106,6 @@ CONFIG_CPU_SH4A=y
113CONFIG_CPU_SHX3=y 106CONFIG_CPU_SHX3=y
114# CONFIG_CPU_SUBTYPE_SH7619 is not set 107# CONFIG_CPU_SUBTYPE_SH7619 is not set
115# CONFIG_CPU_SUBTYPE_SH7206 is not set 108# CONFIG_CPU_SUBTYPE_SH7206 is not set
116# CONFIG_CPU_SUBTYPE_SH7300 is not set
117# CONFIG_CPU_SUBTYPE_SH7705 is not set 109# CONFIG_CPU_SUBTYPE_SH7705 is not set
118# CONFIG_CPU_SUBTYPE_SH7706 is not set 110# CONFIG_CPU_SUBTYPE_SH7706 is not set
119# CONFIG_CPU_SUBTYPE_SH7707 is not set 111# CONFIG_CPU_SUBTYPE_SH7707 is not set
@@ -121,6 +113,7 @@ CONFIG_CPU_SHX3=y
121# CONFIG_CPU_SUBTYPE_SH7709 is not set 113# CONFIG_CPU_SUBTYPE_SH7709 is not set
122# CONFIG_CPU_SUBTYPE_SH7710 is not set 114# CONFIG_CPU_SUBTYPE_SH7710 is not set
123# CONFIG_CPU_SUBTYPE_SH7712 is not set 115# CONFIG_CPU_SUBTYPE_SH7712 is not set
116# CONFIG_CPU_SUBTYPE_SH7720 is not set
124# CONFIG_CPU_SUBTYPE_SH7750 is not set 117# CONFIG_CPU_SUBTYPE_SH7750 is not set
125# CONFIG_CPU_SUBTYPE_SH7091 is not set 118# CONFIG_CPU_SUBTYPE_SH7091 is not set
126# CONFIG_CPU_SUBTYPE_SH7750R is not set 119# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -135,7 +128,6 @@ CONFIG_CPU_SHX3=y
135# CONFIG_CPU_SUBTYPE_SH7780 is not set 128# CONFIG_CPU_SUBTYPE_SH7780 is not set
136# CONFIG_CPU_SUBTYPE_SH7785 is not set 129# CONFIG_CPU_SUBTYPE_SH7785 is not set
137CONFIG_CPU_SUBTYPE_SHX3=y 130CONFIG_CPU_SUBTYPE_SHX3=y
138# CONFIG_CPU_SUBTYPE_SH73180 is not set
139# CONFIG_CPU_SUBTYPE_SH7343 is not set 131# CONFIG_CPU_SUBTYPE_SH7343 is not set
140# CONFIG_CPU_SUBTYPE_SH7722 is not set 132# CONFIG_CPU_SUBTYPE_SH7722 is not set
141 133
@@ -148,12 +140,15 @@ CONFIG_PAGE_OFFSET=0x80000000
148CONFIG_MEMORY_START=0x0c000000 140CONFIG_MEMORY_START=0x0c000000
149CONFIG_MEMORY_SIZE=0x04000000 141CONFIG_MEMORY_SIZE=0x04000000
150CONFIG_VSYSCALL=y 142CONFIG_VSYSCALL=y
143# CONFIG_NUMA is not set
151CONFIG_ARCH_FLATMEM_ENABLE=y 144CONFIG_ARCH_FLATMEM_ENABLE=y
152CONFIG_ARCH_SPARSEMEM_ENABLE=y 145CONFIG_ARCH_SPARSEMEM_ENABLE=y
153CONFIG_ARCH_SPARSEMEM_DEFAULT=y 146CONFIG_ARCH_SPARSEMEM_DEFAULT=y
154CONFIG_MAX_ACTIVE_REGIONS=1 147CONFIG_MAX_ACTIVE_REGIONS=6
155CONFIG_ARCH_POPULATES_NODE_MAP=y 148CONFIG_ARCH_POPULATES_NODE_MAP=y
156CONFIG_ARCH_SELECT_MEMORY_MODEL=y 149CONFIG_ARCH_SELECT_MEMORY_MODEL=y
150CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
151CONFIG_ARCH_MEMORY_PROBE=y
157CONFIG_PAGE_SIZE_4KB=y 152CONFIG_PAGE_SIZE_4KB=y
158# CONFIG_PAGE_SIZE_8KB is not set 153# CONFIG_PAGE_SIZE_8KB is not set
159# CONFIG_PAGE_SIZE_64KB is not set 154# CONFIG_PAGE_SIZE_64KB is not set
@@ -163,12 +158,14 @@ CONFIG_HUGETLB_PAGE_SIZE_64K=y
163# CONFIG_HUGETLB_PAGE_SIZE_4MB is not set 158# CONFIG_HUGETLB_PAGE_SIZE_4MB is not set
164# CONFIG_HUGETLB_PAGE_SIZE_64MB is not set 159# CONFIG_HUGETLB_PAGE_SIZE_64MB is not set
165CONFIG_SELECT_MEMORY_MODEL=y 160CONFIG_SELECT_MEMORY_MODEL=y
166CONFIG_FLATMEM_MANUAL=y 161# CONFIG_FLATMEM_MANUAL is not set
167# CONFIG_DISCONTIGMEM_MANUAL is not set 162# CONFIG_DISCONTIGMEM_MANUAL is not set
168# CONFIG_SPARSEMEM_MANUAL is not set 163CONFIG_SPARSEMEM_MANUAL=y
169CONFIG_FLATMEM=y 164CONFIG_SPARSEMEM=y
170CONFIG_FLAT_NODE_MEM_MAP=y 165CONFIG_HAVE_MEMORY_PRESENT=y
171CONFIG_SPARSEMEM_STATIC=y 166CONFIG_SPARSEMEM_STATIC=y
167CONFIG_MEMORY_HOTPLUG=y
168CONFIG_MEMORY_HOTPLUG_SPARSE=y
172CONFIG_SPLIT_PTLOCK_CPUS=4 169CONFIG_SPLIT_PTLOCK_CPUS=4
173# CONFIG_RESOURCES_64BIT is not set 170# CONFIG_RESOURCES_64BIT is not set
174CONFIG_ZONE_DMA_FLAG=0 171CONFIG_ZONE_DMA_FLAG=0
@@ -178,24 +175,25 @@ CONFIG_NR_QUICK=2
178# Cache configuration 175# Cache configuration
179# 176#
180# CONFIG_SH_DIRECT_MAPPED is not set 177# CONFIG_SH_DIRECT_MAPPED is not set
181# CONFIG_SH_WRITETHROUGH is not set 178# CONFIG_CACHE_WRITEBACK is not set
179# CONFIG_CACHE_WRITETHROUGH is not set
180CONFIG_CACHE_OFF=y
182 181
183# 182#
184# Processor features 183# Processor features
185# 184#
186CONFIG_CPU_LITTLE_ENDIAN=y 185CONFIG_CPU_LITTLE_ENDIAN=y
187# CONFIG_CPU_BIG_ENDIAN is not set 186# CONFIG_CPU_BIG_ENDIAN is not set
188# CONFIG_SH_FPU is not set 187CONFIG_SH_FPU=y
189# CONFIG_SH_FPU_EMU is not set
190CONFIG_SH_DSP=y
191CONFIG_SH_STORE_QUEUES=y 188CONFIG_SH_STORE_QUEUES=y
192CONFIG_CPU_HAS_INTEVT=y 189CONFIG_CPU_HAS_INTEVT=y
193CONFIG_CPU_HAS_INTC2_IRQ=y
194CONFIG_CPU_HAS_SR_RB=y 190CONFIG_CPU_HAS_SR_RB=y
191CONFIG_CPU_HAS_FPU=y
195 192
196# 193#
197# Board support 194# Board support
198# 195#
196CONFIG_SH_X3PROTO=y
199 197
200# 198#
201# Timer and clock configuration 199# Timer and clock configuration
@@ -204,13 +202,25 @@ CONFIG_SH_TMU=y
204CONFIG_SH_TIMER_IRQ=16 202CONFIG_SH_TIMER_IRQ=16
205CONFIG_SH_PCLK_FREQ=50000000 203CONFIG_SH_PCLK_FREQ=50000000
206CONFIG_TICK_ONESHOT=y 204CONFIG_TICK_ONESHOT=y
207CONFIG_NO_HZ=y 205# CONFIG_NO_HZ is not set
208CONFIG_HIGH_RES_TIMERS=y 206CONFIG_HIGH_RES_TIMERS=y
209 207
210# 208#
211# CPU Frequency scaling 209# CPU Frequency scaling
212# 210#
213# CONFIG_CPU_FREQ is not set 211CONFIG_CPU_FREQ=y
212CONFIG_CPU_FREQ_TABLE=y
213# CONFIG_CPU_FREQ_DEBUG is not set
214CONFIG_CPU_FREQ_STAT=y
215# CONFIG_CPU_FREQ_STAT_DETAILS is not set
216CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
217# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
218CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
219CONFIG_CPU_FREQ_GOV_POWERSAVE=m
220CONFIG_CPU_FREQ_GOV_USERSPACE=m
221CONFIG_CPU_FREQ_GOV_ONDEMAND=m
222CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
223CONFIG_SH_CPU_FREQ=y
214 224
215# 225#
216# DMA support 226# DMA support
@@ -237,6 +247,7 @@ CONFIG_HZ_250=y
237CONFIG_HZ=250 247CONFIG_HZ=250
238CONFIG_KEXEC=y 248CONFIG_KEXEC=y
239# CONFIG_CRASH_DUMP is not set 249# CONFIG_CRASH_DUMP is not set
250# CONFIG_SMP is not set
240# CONFIG_PREEMPT_NONE is not set 251# CONFIG_PREEMPT_NONE is not set
241# CONFIG_PREEMPT_VOLUNTARY is not set 252# CONFIG_PREEMPT_VOLUNTARY is not set
242CONFIG_PREEMPT=y 253CONFIG_PREEMPT=y
@@ -249,7 +260,7 @@ CONFIG_ZERO_PAGE_OFFSET=0x00001000
249CONFIG_BOOT_LINK_OFFSET=0x00800000 260CONFIG_BOOT_LINK_OFFSET=0x00800000
250# CONFIG_UBC_WAKEUP is not set 261# CONFIG_UBC_WAKEUP is not set
251CONFIG_CMDLINE_BOOL=y 262CONFIG_CMDLINE_BOOL=y
252CONFIG_CMDLINE="console=ttySC0,115200 ip=192.168.1.2:::255.255.255.0 root=/dev/nfs nfsroot=192.168.1.1:/exports/devel/rfs/mobiler noaliencache earlyprintk=bios ignore_loglevel" 263CONFIG_CMDLINE="console=ttySC0,115200 earlyprintk=bios ignore_loglevel"
253 264
254# 265#
255# Bus options 266# Bus options
@@ -265,12 +276,106 @@ CONFIG_CMDLINE="console=ttySC0,115200 ip=192.168.1.2:::255.255.255.0 root=/dev/n
265# Executable file formats 276# Executable file formats
266# 277#
267CONFIG_BINFMT_ELF=y 278CONFIG_BINFMT_ELF=y
268# CONFIG_BINFMT_MISC is not set 279CONFIG_BINFMT_MISC=y
269 280
270# 281#
271# Networking 282# Networking
272# 283#
273# CONFIG_NET is not set 284CONFIG_NET=y
285
286#
287# Networking options
288#
289# CONFIG_PACKET is not set
290# CONFIG_UNIX is not set
291CONFIG_XFRM=y
292# CONFIG_XFRM_USER is not set
293# CONFIG_XFRM_SUB_POLICY is not set
294# CONFIG_XFRM_MIGRATE is not set
295# CONFIG_NET_KEY is not set
296CONFIG_INET=y
297# CONFIG_IP_MULTICAST is not set
298# CONFIG_IP_ADVANCED_ROUTER is not set
299CONFIG_IP_FIB_HASH=y
300CONFIG_IP_PNP=y
301CONFIG_IP_PNP_DHCP=y
302# CONFIG_IP_PNP_BOOTP is not set
303# CONFIG_IP_PNP_RARP is not set
304# CONFIG_NET_IPIP is not set
305# CONFIG_NET_IPGRE is not set
306# CONFIG_ARPD is not set
307# CONFIG_SYN_COOKIES is not set
308# CONFIG_INET_AH is not set
309# CONFIG_INET_ESP is not set
310# CONFIG_INET_IPCOMP is not set
311# CONFIG_INET_XFRM_TUNNEL is not set
312CONFIG_INET_TUNNEL=m
313CONFIG_INET_XFRM_MODE_TRANSPORT=y
314CONFIG_INET_XFRM_MODE_TUNNEL=y
315CONFIG_INET_XFRM_MODE_BEET=y
316CONFIG_INET_DIAG=y
317CONFIG_INET_TCP_DIAG=y
318# CONFIG_TCP_CONG_ADVANCED is not set
319CONFIG_TCP_CONG_CUBIC=y
320CONFIG_DEFAULT_TCP_CONG="cubic"
321# CONFIG_TCP_MD5SIG is not set
322CONFIG_IPV6=m
323# CONFIG_IPV6_PRIVACY is not set
324# CONFIG_IPV6_ROUTER_PREF is not set
325# CONFIG_IPV6_OPTIMISTIC_DAD is not set
326# CONFIG_INET6_AH is not set
327# CONFIG_INET6_ESP is not set
328# CONFIG_INET6_IPCOMP is not set
329# CONFIG_IPV6_MIP6 is not set
330# CONFIG_INET6_XFRM_TUNNEL is not set
331# CONFIG_INET6_TUNNEL is not set
332CONFIG_INET6_XFRM_MODE_TRANSPORT=m
333CONFIG_INET6_XFRM_MODE_TUNNEL=m
334CONFIG_INET6_XFRM_MODE_BEET=m
335# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
336CONFIG_IPV6_SIT=m
337# CONFIG_IPV6_TUNNEL is not set
338# CONFIG_IPV6_MULTIPLE_TABLES is not set
339# CONFIG_NETWORK_SECMARK is not set
340# CONFIG_NETFILTER is not set
341# CONFIG_IP_DCCP is not set
342# CONFIG_IP_SCTP is not set
343# CONFIG_TIPC is not set
344# CONFIG_ATM is not set
345# CONFIG_BRIDGE is not set
346# CONFIG_VLAN_8021Q is not set
347# CONFIG_DECNET is not set
348# CONFIG_LLC2 is not set
349# CONFIG_IPX is not set
350# CONFIG_ATALK is not set
351# CONFIG_X25 is not set
352# CONFIG_LAPB is not set
353# CONFIG_ECONET is not set
354# CONFIG_WAN_ROUTER is not set
355
356#
357# QoS and/or fair queueing
358#
359# CONFIG_NET_SCHED is not set
360
361#
362# Network testing
363#
364# CONFIG_NET_PKTGEN is not set
365# CONFIG_HAMRADIO is not set
366# CONFIG_IRDA is not set
367# CONFIG_BT is not set
368# CONFIG_AF_RXRPC is not set
369
370#
371# Wireless
372#
373# CONFIG_CFG80211 is not set
374# CONFIG_WIRELESS_EXT is not set
375# CONFIG_MAC80211 is not set
376# CONFIG_IEEE80211 is not set
377# CONFIG_RFKILL is not set
378# CONFIG_NET_9P is not set
274 379
275# 380#
276# Device Drivers 381# Device Drivers
@@ -285,37 +390,21 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
285# CONFIG_DEBUG_DRIVER is not set 390# CONFIG_DEBUG_DRIVER is not set
286# CONFIG_DEBUG_DEVRES is not set 391# CONFIG_DEBUG_DEVRES is not set
287# CONFIG_SYS_HYPERVISOR is not set 392# CONFIG_SYS_HYPERVISOR is not set
288 393# CONFIG_CONNECTOR is not set
289#
290# Connector - unified userspace <-> kernelspace linker
291#
292# CONFIG_MTD is not set 394# CONFIG_MTD is not set
293
294#
295# Parallel port support
296#
297# CONFIG_PARPORT is not set 395# CONFIG_PARPORT is not set
298 396CONFIG_BLK_DEV=y
299#
300# Plug and Play support
301#
302# CONFIG_PNPACPI is not set
303
304#
305# Block devices
306#
307# CONFIG_BLK_DEV_COW_COMMON is not set 397# CONFIG_BLK_DEV_COW_COMMON is not set
308# CONFIG_BLK_DEV_LOOP is not set 398# CONFIG_BLK_DEV_LOOP is not set
399# CONFIG_BLK_DEV_NBD is not set
309CONFIG_BLK_DEV_RAM=y 400CONFIG_BLK_DEV_RAM=y
310CONFIG_BLK_DEV_RAM_COUNT=16 401CONFIG_BLK_DEV_RAM_COUNT=16
311CONFIG_BLK_DEV_RAM_SIZE=4096 402CONFIG_BLK_DEV_RAM_SIZE=4096
312CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 403CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
313# CONFIG_CDROM_PKTCDVD is not set 404# CONFIG_CDROM_PKTCDVD is not set
314 405# CONFIG_ATA_OVER_ETH is not set
315# 406CONFIG_MISC_DEVICES=y
316# Misc devices 407# CONFIG_EEPROM_93CX6 is not set
317#
318# CONFIG_BLINK is not set
319# CONFIG_IDE is not set 408# CONFIG_IDE is not set
320 409
321# 410#
@@ -323,6 +412,7 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
323# 412#
324# CONFIG_RAID_ATTRS is not set 413# CONFIG_RAID_ATTRS is not set
325CONFIG_SCSI=y 414CONFIG_SCSI=y
415CONFIG_SCSI_DMA=y
326# CONFIG_SCSI_TGT is not set 416# CONFIG_SCSI_TGT is not set
327# CONFIG_SCSI_NETLINK is not set 417# CONFIG_SCSI_NETLINK is not set
328CONFIG_SCSI_PROC_FS=y 418CONFIG_SCSI_PROC_FS=y
@@ -351,73 +441,54 @@ CONFIG_SCSI_WAIT_SCAN=m
351# 441#
352# CONFIG_SCSI_SPI_ATTRS is not set 442# CONFIG_SCSI_SPI_ATTRS is not set
353# CONFIG_SCSI_FC_ATTRS is not set 443# CONFIG_SCSI_FC_ATTRS is not set
354# CONFIG_SCSI_SAS_ATTRS is not set 444# CONFIG_SCSI_ISCSI_ATTRS is not set
355# CONFIG_SCSI_SAS_LIBSAS is not set 445# CONFIG_SCSI_SAS_LIBSAS is not set
356 446CONFIG_SCSI_LOWLEVEL=y
357# 447# CONFIG_ISCSI_TCP is not set
358# SCSI low-level drivers
359#
360# CONFIG_SCSI_DEBUG is not set 448# CONFIG_SCSI_DEBUG is not set
361CONFIG_ATA=y 449CONFIG_ATA=y
362# CONFIG_ATA_NONSTANDARD is not set 450# CONFIG_ATA_NONSTANDARD is not set
363CONFIG_PATA_PLATFORM=y 451CONFIG_PATA_PLATFORM=y
364
365#
366# Multi-device support (RAID and LVM)
367#
368# CONFIG_MD is not set 452# CONFIG_MD is not set
369 453CONFIG_NETDEVICES=y
370# 454# CONFIG_NETDEVICES_MULTIQUEUE is not set
371# ISDN subsystem 455# CONFIG_DUMMY is not set
372# 456# CONFIG_BONDING is not set
373 457# CONFIG_MACVLAN is not set
374# 458# CONFIG_EQUALIZER is not set
375# Telephony Support 459# CONFIG_TUN is not set
376# 460# CONFIG_PHYLIB is not set
461CONFIG_NET_ETHERNET=y
462CONFIG_MII=y
463# CONFIG_STNIC is not set
464CONFIG_SMC91X=y
465# CONFIG_NETDEV_1000 is not set
466# CONFIG_NETDEV_10000 is not set
467
468#
469# Wireless LAN
470#
471# CONFIG_WLAN_PRE80211 is not set
472# CONFIG_WLAN_80211 is not set
473# CONFIG_WAN is not set
474# CONFIG_PPP is not set
475# CONFIG_SLIP is not set
476# CONFIG_SHAPER is not set
477# CONFIG_NETCONSOLE is not set
478# CONFIG_NETPOLL is not set
479# CONFIG_NET_POLL_CONTROLLER is not set
480# CONFIG_ISDN is not set
377# CONFIG_PHONE is not set 481# CONFIG_PHONE is not set
378 482
379# 483#
380# Input device support 484# Input device support
381# 485#
382CONFIG_INPUT=y 486# CONFIG_INPUT is not set
383# CONFIG_INPUT_FF_MEMLESS is not set
384
385#
386# Userland interfaces
387#
388CONFIG_INPUT_MOUSEDEV=y
389# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
390CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
391CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
392# CONFIG_INPUT_JOYDEV is not set
393# CONFIG_INPUT_TSDEV is not set
394# CONFIG_INPUT_EVDEV is not set
395# CONFIG_INPUT_EVBUG is not set
396
397#
398# Input Device Drivers
399#
400CONFIG_INPUT_KEYBOARD=y
401CONFIG_KEYBOARD_ATKBD=y
402# CONFIG_KEYBOARD_SUNKBD is not set
403# CONFIG_KEYBOARD_LKKBD is not set
404# CONFIG_KEYBOARD_XTKBD is not set
405# CONFIG_KEYBOARD_NEWTON is not set
406# CONFIG_KEYBOARD_STOWAWAY is not set
407# CONFIG_INPUT_MOUSE is not set
408# CONFIG_INPUT_JOYSTICK is not set
409# CONFIG_INPUT_TABLET is not set
410# CONFIG_INPUT_TOUCHSCREEN is not set
411# CONFIG_INPUT_MISC is not set
412 487
413# 488#
414# Hardware I/O ports 489# Hardware I/O ports
415# 490#
416CONFIG_SERIO=y 491# CONFIG_SERIO is not set
417# CONFIG_SERIO_I8042 is not set
418# CONFIG_SERIO_SERPORT is not set
419CONFIG_SERIO_LIBPS2=y
420# CONFIG_SERIO_RAW is not set
421# CONFIG_GAMEPORT is not set 492# CONFIG_GAMEPORT is not set
422 493
423# 494#
@@ -442,19 +513,18 @@ CONFIG_SERIAL_CORE_CONSOLE=y
442CONFIG_UNIX98_PTYS=y 513CONFIG_UNIX98_PTYS=y
443CONFIG_LEGACY_PTYS=y 514CONFIG_LEGACY_PTYS=y
444CONFIG_LEGACY_PTY_COUNT=256 515CONFIG_LEGACY_PTY_COUNT=256
516# CONFIG_IPMI_HANDLER is not set
517CONFIG_WATCHDOG=y
518# CONFIG_WATCHDOG_NOWAYOUT is not set
445 519
446# 520#
447# IPMI 521# Watchdog Device Drivers
448# 522#
449# CONFIG_IPMI_HANDLER is not set 523# CONFIG_SOFT_WATCHDOG is not set
450# CONFIG_WATCHDOG is not set 524# CONFIG_SH_WDT is not set
451CONFIG_HW_RANDOM=y 525# CONFIG_HW_RANDOM is not set
452# CONFIG_R3964 is not set 526# CONFIG_R3964 is not set
453# CONFIG_RAW_DRIVER is not set 527# CONFIG_RAW_DRIVER is not set
454
455#
456# TPM devices
457#
458# CONFIG_TCG_TPM is not set 528# CONFIG_TCG_TPM is not set
459# CONFIG_I2C is not set 529# CONFIG_I2C is not set
460 530
@@ -463,11 +533,8 @@ CONFIG_HW_RANDOM=y
463# 533#
464# CONFIG_SPI is not set 534# CONFIG_SPI is not set
465# CONFIG_SPI_MASTER is not set 535# CONFIG_SPI_MASTER is not set
466
467#
468# Dallas's 1-wire bus
469#
470# CONFIG_W1 is not set 536# CONFIG_W1 is not set
537# CONFIG_POWER_SUPPLY is not set
471# CONFIG_HWMON is not set 538# CONFIG_HWMON is not set
472 539
473# 540#
@@ -479,6 +546,7 @@ CONFIG_HW_RANDOM=y
479# Multimedia devices 546# Multimedia devices
480# 547#
481# CONFIG_VIDEO_DEV is not set 548# CONFIG_VIDEO_DEV is not set
549# CONFIG_DVB_CORE is not set
482# CONFIG_DAB is not set 550# CONFIG_DAB is not set
483 551
484# 552#
@@ -491,24 +559,18 @@ CONFIG_HW_RANDOM=y
491# 559#
492# CONFIG_DISPLAY_SUPPORT is not set 560# CONFIG_DISPLAY_SUPPORT is not set
493# CONFIG_VGASTATE is not set 561# CONFIG_VGASTATE is not set
562CONFIG_VIDEO_OUTPUT_CONTROL=m
494# CONFIG_FB is not set 563# CONFIG_FB is not set
495 564
496# 565#
497# Sound 566# Sound
498# 567#
499# CONFIG_SOUND is not set 568# CONFIG_SOUND is not set
500 569CONFIG_USB_SUPPORT=y
501# 570CONFIG_USB_ARCH_HAS_HCD=y
502# HID Devices
503#
504# CONFIG_HID is not set
505
506#
507# USB support
508#
509# CONFIG_USB_ARCH_HAS_HCD is not set
510# CONFIG_USB_ARCH_HAS_OHCI is not set 571# CONFIG_USB_ARCH_HAS_OHCI is not set
511# CONFIG_USB_ARCH_HAS_EHCI is not set 572# CONFIG_USB_ARCH_HAS_EHCI is not set
573# CONFIG_USB is not set
512 574
513# 575#
514# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 576# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -517,68 +579,32 @@ CONFIG_HW_RANDOM=y
517# 579#
518# USB Gadget Support 580# USB Gadget Support
519# 581#
520# CONFIG_USB_GADGET is not set 582CONFIG_USB_GADGET=y
583# CONFIG_USB_GADGET_DEBUG is not set
584# CONFIG_USB_GADGET_DEBUG_FILES is not set
585CONFIG_USB_GADGET_SELECTED=y
586# CONFIG_USB_GADGET_AMD5536UDC is not set
587# CONFIG_USB_GADGET_FSL_USB2 is not set
588# CONFIG_USB_GADGET_NET2280 is not set
589# CONFIG_USB_GADGET_PXA2XX is not set
590CONFIG_USB_GADGET_M66592=y
591CONFIG_USB_M66592=y
592# CONFIG_USB_GADGET_GOKU is not set
593# CONFIG_USB_GADGET_LH7A40X is not set
594# CONFIG_USB_GADGET_OMAP is not set
595# CONFIG_USB_GADGET_S3C2410 is not set
596# CONFIG_USB_GADGET_AT91 is not set
597# CONFIG_USB_GADGET_DUMMY_HCD is not set
598CONFIG_USB_GADGET_DUALSPEED=y
599# CONFIG_USB_ZERO is not set
600# CONFIG_USB_ETH is not set
601# CONFIG_USB_GADGETFS is not set
602# CONFIG_USB_FILE_STORAGE is not set
603# CONFIG_USB_G_SERIAL is not set
604# CONFIG_USB_MIDI_GADGET is not set
521# CONFIG_MMC is not set 605# CONFIG_MMC is not set
522
523#
524# LED devices
525#
526# CONFIG_NEW_LEDS is not set 606# CONFIG_NEW_LEDS is not set
527 607# CONFIG_RTC_CLASS is not set
528#
529# LED drivers
530#
531
532#
533# LED Triggers
534#
535
536#
537# InfiniBand support
538#
539
540#
541# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
542#
543
544#
545# Real Time Clock
546#
547CONFIG_RTC_LIB=y
548CONFIG_RTC_CLASS=y
549CONFIG_RTC_HCTOSYS=y
550CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
551# CONFIG_RTC_DEBUG is not set
552
553#
554# RTC interfaces
555#
556CONFIG_RTC_INTF_SYSFS=y
557CONFIG_RTC_INTF_PROC=y
558CONFIG_RTC_INTF_DEV=y
559# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
560# CONFIG_RTC_DRV_TEST is not set
561
562#
563# I2C RTC drivers
564#
565
566#
567# SPI RTC drivers
568#
569
570#
571# Platform RTC drivers
572#
573# CONFIG_RTC_DRV_DS1553 is not set
574# CONFIG_RTC_DRV_DS1742 is not set
575# CONFIG_RTC_DRV_M48T86 is not set
576# CONFIG_RTC_DRV_V3020 is not set
577
578#
579# on-CPU RTC drivers
580#
581CONFIG_RTC_DRV_SH=y
582 608
583# 609#
584# DMA Engine support 610# DMA Engine support
@@ -594,6 +620,11 @@ CONFIG_RTC_DRV_SH=y
594# 620#
595 621
596# 622#
623# Userspace I/O
624#
625CONFIG_UIO=m
626
627#
597# File systems 628# File systems
598# 629#
599CONFIG_EXT2_FS=y 630CONFIG_EXT2_FS=y
@@ -612,6 +643,7 @@ CONFIG_FS_MBCACHE=y
612# CONFIG_FS_POSIX_ACL is not set 643# CONFIG_FS_POSIX_ACL is not set
613# CONFIG_XFS_FS is not set 644# CONFIG_XFS_FS is not set
614# CONFIG_GFS2_FS is not set 645# CONFIG_GFS2_FS is not set
646# CONFIG_OCFS2_FS is not set
615# CONFIG_MINIX_FS is not set 647# CONFIG_MINIX_FS is not set
616# CONFIG_ROMFS_FS is not set 648# CONFIG_ROMFS_FS is not set
617CONFIG_INOTIFY=y 649CONFIG_INOTIFY=y
@@ -667,6 +699,17 @@ CONFIG_RAMFS=y
667# CONFIG_UFS_FS is not set 699# CONFIG_UFS_FS is not set
668 700
669# 701#
702# Network File Systems
703#
704# CONFIG_NFS_FS is not set
705# CONFIG_NFSD is not set
706# CONFIG_SMB_FS is not set
707# CONFIG_CIFS is not set
708# CONFIG_NCP_FS is not set
709# CONFIG_CODA_FS is not set
710# CONFIG_AFS_FS is not set
711
712#
670# Partition Types 713# Partition Types
671# 714#
672# CONFIG_PARTITION_ADVANCED is not set 715# CONFIG_PARTITION_ADVANCED is not set
@@ -678,6 +721,11 @@ CONFIG_MSDOS_PARTITION=y
678# CONFIG_NLS is not set 721# CONFIG_NLS is not set
679 722
680# 723#
724# Distributed Lock Manager
725#
726# CONFIG_DLM is not set
727
728#
681# Profiling support 729# Profiling support
682# 730#
683CONFIG_PROFILING=y 731CONFIG_PROFILING=y
@@ -687,31 +735,28 @@ CONFIG_PROFILING=y
687# Kernel hacking 735# Kernel hacking
688# 736#
689CONFIG_TRACE_IRQFLAGS_SUPPORT=y 737CONFIG_TRACE_IRQFLAGS_SUPPORT=y
690CONFIG_PRINTK_TIME=y 738# CONFIG_PRINTK_TIME is not set
691# CONFIG_ENABLE_MUST_CHECK is not set 739# CONFIG_ENABLE_MUST_CHECK is not set
692CONFIG_MAGIC_SYSRQ=y 740CONFIG_MAGIC_SYSRQ=y
693# CONFIG_UNUSED_SYMBOLS is not set 741# CONFIG_UNUSED_SYMBOLS is not set
694CONFIG_DEBUG_FS=y 742CONFIG_DEBUG_FS=y
695# CONFIG_HEADERS_CHECK is not set 743# CONFIG_HEADERS_CHECK is not set
696CONFIG_DEBUG_KERNEL=y 744CONFIG_DEBUG_KERNEL=y
697# CONFIG_DEBUG_SHIRQ is not set 745CONFIG_DEBUG_SHIRQ=y
698CONFIG_DETECT_SOFTLOCKUP=y 746CONFIG_DETECT_SOFTLOCKUP=y
747CONFIG_SCHED_DEBUG=y
699# CONFIG_SCHEDSTATS is not set 748# CONFIG_SCHEDSTATS is not set
700# CONFIG_TIMER_STATS is not set 749# CONFIG_TIMER_STATS is not set
701CONFIG_DEBUG_SLAB=y
702CONFIG_DEBUG_SLAB_LEAK=y
703CONFIG_DEBUG_PREEMPT=y 750CONFIG_DEBUG_PREEMPT=y
704# CONFIG_DEBUG_RT_MUTEXES is not set 751# CONFIG_DEBUG_RT_MUTEXES is not set
705# CONFIG_RT_MUTEX_TESTER is not set 752# CONFIG_RT_MUTEX_TESTER is not set
706CONFIG_DEBUG_SPINLOCK=y 753# CONFIG_DEBUG_SPINLOCK is not set
707CONFIG_DEBUG_MUTEXES=y 754# CONFIG_DEBUG_MUTEXES is not set
708CONFIG_DEBUG_LOCK_ALLOC=y 755# CONFIG_DEBUG_LOCK_ALLOC is not set
709# CONFIG_PROVE_LOCKING is not set 756# CONFIG_PROVE_LOCKING is not set
710CONFIG_LOCKDEP=y 757# CONFIG_LOCK_STAT is not set
711CONFIG_DEBUG_LOCKDEP=y
712# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 758# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
713# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 759# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
714CONFIG_STACKTRACE=y
715# CONFIG_DEBUG_KOBJECT is not set 760# CONFIG_DEBUG_KOBJECT is not set
716CONFIG_DEBUG_BUGVERBOSE=y 761CONFIG_DEBUG_BUGVERBOSE=y
717# CONFIG_DEBUG_INFO is not set 762# CONFIG_DEBUG_INFO is not set
@@ -735,10 +780,6 @@ CONFIG_DEBUG_STACK_USAGE=y
735# 780#
736# CONFIG_KEYS is not set 781# CONFIG_KEYS is not set
737# CONFIG_SECURITY is not set 782# CONFIG_SECURITY is not set
738
739#
740# Cryptographic options
741#
742# CONFIG_CRYPTO is not set 783# CONFIG_CRYPTO is not set
743 784
744# 785#
@@ -749,6 +790,7 @@ CONFIG_BITREVERSE=y
749# CONFIG_CRC16 is not set 790# CONFIG_CRC16 is not set
750# CONFIG_CRC_ITU_T is not set 791# CONFIG_CRC_ITU_T is not set
751CONFIG_CRC32=y 792CONFIG_CRC32=y
793# CONFIG_CRC7 is not set
752# CONFIG_LIBCRC32C is not set 794# CONFIG_LIBCRC32C is not set
753CONFIG_PLIST=y 795CONFIG_PLIST=y
754CONFIG_HAS_IOMEM=y 796CONFIG_HAS_IOMEM=y
diff --git a/arch/sh/drivers/dma/Kconfig b/arch/sh/drivers/dma/Kconfig
index ee711431e504..4e711a0c3dae 100644
--- a/arch/sh/drivers/dma/Kconfig
+++ b/arch/sh/drivers/dma/Kconfig
@@ -12,6 +12,7 @@ config SH_DMA
12config NR_ONCHIP_DMA_CHANNELS 12config NR_ONCHIP_DMA_CHANNELS
13 int 13 int
14 depends on SH_DMA 14 depends on SH_DMA
15 default "6" if CPU_SUBTYPE_SH7720
15 default "8" if CPU_SUBTYPE_SH7750R || CPU_SUBTYPE_SH7751R 16 default "8" if CPU_SUBTYPE_SH7750R || CPU_SUBTYPE_SH7751R
16 default "12" if CPU_SUBTYPE_SH7780 17 default "12" if CPU_SUBTYPE_SH7780
17 default "4" 18 default "4"
diff --git a/arch/sh/drivers/dma/dma-sh.c b/arch/sh/drivers/dma/dma-sh.c
index 06ed0609a95d..958bac1c585a 100644
--- a/arch/sh/drivers/dma/dma-sh.c
+++ b/arch/sh/drivers/dma/dma-sh.c
@@ -24,13 +24,19 @@ static int dmte_irq_map[] = {
24 DMTE1_IRQ, 24 DMTE1_IRQ,
25 DMTE2_IRQ, 25 DMTE2_IRQ,
26 DMTE3_IRQ, 26 DMTE3_IRQ,
27#if defined(CONFIG_CPU_SUBTYPE_SH7751R) || \ 27#if defined(CONFIG_CPU_SUBTYPE_SH7720) || \
28 defined(CONFIG_CPU_SUBTYPE_SH7751R) || \
28 defined(CONFIG_CPU_SUBTYPE_SH7760) || \ 29 defined(CONFIG_CPU_SUBTYPE_SH7760) || \
30 defined(CONFIG_CPU_SUBTYPE_SH7709) || \
29 defined(CONFIG_CPU_SUBTYPE_SH7780) 31 defined(CONFIG_CPU_SUBTYPE_SH7780)
30 DMTE4_IRQ, 32 DMTE4_IRQ,
31 DMTE5_IRQ, 33 DMTE5_IRQ,
34#endif
35#if defined(CONFIG_CPU_SUBTYPE_SH7751R) || \
36 defined(CONFIG_CPU_SUBTYPE_SH7760) || \
37 defined(CONFIG_CPU_SUBTYPE_SH7780)
32 DMTE6_IRQ, 38 DMTE6_IRQ,
33 DMTE7_IRQ, 39 DMTE7_IRQ,
34#endif 40#endif
35}; 41};
36 42
@@ -196,7 +202,8 @@ static int sh_dmac_get_dma_residue(struct dma_channel *chan)
196 return ctrl_inl(DMATCR[chan->chan]) << calc_xmit_shift(chan); 202 return ctrl_inl(DMATCR[chan->chan]) << calc_xmit_shift(chan);
197} 203}
198 204
199#ifdef CONFIG_CPU_SUBTYPE_SH7780 205#if defined(CONFIG_CPU_SUBTYPE_SH7720) || \
206 defined(CONFIG_CPU_SUBTYPE_SH7780)
200#define dmaor_read_reg() ctrl_inw(DMAOR) 207#define dmaor_read_reg() ctrl_inw(DMAOR)
201#define dmaor_write_reg(data) ctrl_outw(data, DMAOR) 208#define dmaor_write_reg(data) ctrl_outw(data, DMAOR)
202#else 209#else
diff --git a/arch/sh/drivers/heartbeat.c b/arch/sh/drivers/heartbeat.c
index 10c1828c9ff5..b76a14f12ce2 100644
--- a/arch/sh/drivers/heartbeat.c
+++ b/arch/sh/drivers/heartbeat.c
@@ -24,24 +24,44 @@
24#include <linux/sched.h> 24#include <linux/sched.h>
25#include <linux/timer.h> 25#include <linux/timer.h>
26#include <linux/io.h> 26#include <linux/io.h>
27#include <asm/heartbeat.h>
27 28
28#define DRV_NAME "heartbeat" 29#define DRV_NAME "heartbeat"
29#define DRV_VERSION "0.1.0" 30#define DRV_VERSION "0.1.1"
30 31
31struct heartbeat_data { 32static unsigned char default_bit_pos[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
32 void __iomem *base; 33
33 unsigned char bit_pos[8]; 34static inline void heartbeat_toggle_bit(struct heartbeat_data *hd,
34 struct timer_list timer; 35 unsigned bit, unsigned int inverted)
35}; 36{
37 unsigned int new;
38
39 new = (1 << hd->bit_pos[bit]);
40 if (inverted)
41 new = ~new;
42
43 switch (hd->regsize) {
44 case 32:
45 iowrite32(new, hd->base);
46 break;
47 case 16:
48 iowrite16(new, hd->base);
49 break;
50 default:
51 iowrite8(new, hd->base);
52 break;
53 }
54}
36 55
37static void heartbeat_timer(unsigned long data) 56static void heartbeat_timer(unsigned long data)
38{ 57{
39 struct heartbeat_data *hd = (struct heartbeat_data *)data; 58 struct heartbeat_data *hd = (struct heartbeat_data *)data;
40 static unsigned bit = 0, up = 1; 59 static unsigned bit = 0, up = 1;
41 60
42 ctrl_outw(1 << hd->bit_pos[bit], (unsigned long)hd->base); 61 heartbeat_toggle_bit(hd, bit, hd->flags & HEARTBEAT_INVERTED);
62
43 bit += up; 63 bit += up;
44 if ((bit == 0) || (bit == ARRAY_SIZE(hd->bit_pos)-1)) 64 if ((bit == 0) || (bit == (hd->nr_bits)-1))
45 up = -up; 65 up = -up;
46 66
47 mod_timer(&hd->timer, jiffies + (110 - ((300 << FSHIFT) / 67 mod_timer(&hd->timer, jiffies + (110 - ((300 << FSHIFT) /
@@ -64,21 +84,31 @@ static int heartbeat_drv_probe(struct platform_device *pdev)
64 return -EINVAL; 84 return -EINVAL;
65 } 85 }
66 86
67 hd = kmalloc(sizeof(struct heartbeat_data), GFP_KERNEL);
68 if (unlikely(!hd))
69 return -ENOMEM;
70
71 if (pdev->dev.platform_data) { 87 if (pdev->dev.platform_data) {
72 memcpy(hd->bit_pos, pdev->dev.platform_data, 88 hd = pdev->dev.platform_data;
73 ARRAY_SIZE(hd->bit_pos));
74 } else { 89 } else {
75 int i; 90 hd = kzalloc(sizeof(struct heartbeat_data), GFP_KERNEL);
91 if (unlikely(!hd))
92 return -ENOMEM;
93 }
94
95 hd->base = ioremap_nocache(res->start, res->end - res->start + 1);
96 if (!unlikely(hd->base)) {
97 dev_err(&pdev->dev, "ioremap failed\n");
98
99 if (!pdev->dev.platform_data)
100 kfree(hd);
101
102 return -ENXIO;
103 }
76 104
77 for (i = 0; i < ARRAY_SIZE(hd->bit_pos); i++) 105 if (!hd->nr_bits) {
78 hd->bit_pos[i] = i; 106 hd->bit_pos = default_bit_pos;
107 hd->nr_bits = ARRAY_SIZE(default_bit_pos);
79 } 108 }
80 109
81 hd->base = (void __iomem *)(unsigned long)res->start; 110 if (!hd->regsize)
111 hd->regsize = 8; /* default access size */
82 112
83 setup_timer(&hd->timer, heartbeat_timer, (unsigned long)hd); 113 setup_timer(&hd->timer, heartbeat_timer, (unsigned long)hd);
84 platform_set_drvdata(pdev, hd); 114 platform_set_drvdata(pdev, hd);
@@ -91,10 +121,12 @@ static int heartbeat_drv_remove(struct platform_device *pdev)
91 struct heartbeat_data *hd = platform_get_drvdata(pdev); 121 struct heartbeat_data *hd = platform_get_drvdata(pdev);
92 122
93 del_timer_sync(&hd->timer); 123 del_timer_sync(&hd->timer);
124 iounmap(hd->base);
94 125
95 platform_set_drvdata(pdev, NULL); 126 platform_set_drvdata(pdev, NULL);
96 127
97 kfree(hd); 128 if (!pdev->dev.platform_data)
129 kfree(hd);
98 130
99 return 0; 131 return 0;
100} 132}
diff --git a/arch/sh/drivers/pci/ops-rts7751r2d.c b/arch/sh/drivers/pci/ops-rts7751r2d.c
index 4a518d948049..ec8430c8d2d1 100644
--- a/arch/sh/drivers/pci/ops-rts7751r2d.c
+++ b/arch/sh/drivers/pci/ops-rts7751r2d.c
@@ -19,10 +19,10 @@
19#include "pci-sh4.h" 19#include "pci-sh4.h"
20 20
21static u8 rts7751r2d_irq_tab[] __initdata = { 21static u8 rts7751r2d_irq_tab[] __initdata = {
22 IRQ_PCISLOT1, 22 IRQ_PCI_INTA,
23 IRQ_PCISLOT2, 23 IRQ_PCI_INTB,
24 IRQ_PCMCIA, 24 IRQ_PCI_INTC,
25 IRQ_PCIETH, 25 IRQ_PCI_INTD,
26}; 26};
27 27
28int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) 28int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin)
diff --git a/arch/sh/drivers/pci/pci-sh7780.c b/arch/sh/drivers/pci/pci-sh7780.c
index 5508e45d4838..e516087fb435 100644
--- a/arch/sh/drivers/pci/pci-sh7780.c
+++ b/arch/sh/drivers/pci/pci-sh7780.c
@@ -79,19 +79,6 @@ static int __init sh7780_pci_init(void)
79 ctrl_outl(0xAAAA0000, INTC_ICR1); 79 ctrl_outl(0xAAAA0000, INTC_ICR1);
80 /* INTPRI: priority=3(all) */ 80 /* INTPRI: priority=3(all) */
81 ctrl_outl(0x33333333, INTC_INTPRI); 81 ctrl_outl(0x33333333, INTC_INTPRI);
82 } else {
83 /* INTC SH-4 Mode */
84 ctrl_outl(0x00200000, INTC_ICR0);
85 /* enable PCIINTA - PCIINTD */
86 ctrl_outl(0x00078000, INTC_INT2MSKCR);
87 /* disable IRL4-7 Interrupt */
88 ctrl_outl(0x40000000, INTC_INTMSK1);
89 /* disable IRL4-7 Interrupt */
90 ctrl_outl(0x0000fffe, INTC_INTMSK2);
91 /* enable IRL0-3 Interrupt */
92 ctrl_outl(0x80000000, INTC_INTMSKCLR1);
93 /* enable IRL0-3 Interrupt */
94 ctrl_outl(0xfffe0000, INTC_INTMSKCLR2);
95 } 82 }
96 83
97 if ((ret = sh4_pci_check_direct()) != 0) 84 if ((ret = sh4_pci_check_direct()) != 0)
diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c
index 92807ffa8e20..b5f1e23ed57c 100644
--- a/arch/sh/kernel/cpu/clock.c
+++ b/arch/sh/kernel/cpu/clock.c
@@ -83,6 +83,8 @@ static void propagate_rate(struct clk *clk)
83 continue; 83 continue;
84 if (likely(clkp->ops && clkp->ops->recalc)) 84 if (likely(clkp->ops && clkp->ops->recalc))
85 clkp->ops->recalc(clkp); 85 clkp->ops->recalc(clkp);
86 if (unlikely(clkp->flags & CLK_RATE_PROPAGATES))
87 propagate_rate(clkp);
86 } 88 }
87} 89}
88 90
diff --git a/arch/sh/kernel/cpu/init.c b/arch/sh/kernel/cpu/init.c
index 9172e97dc26a..c217c4bf0085 100644
--- a/arch/sh/kernel/cpu/init.c
+++ b/arch/sh/kernel/cpu/init.c
@@ -22,6 +22,7 @@
22#include <asm/cache.h> 22#include <asm/cache.h>
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/ubc.h> 24#include <asm/ubc.h>
25#include <asm/smp.h>
25 26
26/* 27/*
27 * Generic wrapper for command line arguments to disable on-chip 28 * Generic wrapper for command line arguments to disable on-chip
@@ -143,12 +144,15 @@ static void __init cache_init(void)
143 flags &= ~CCR_CACHE_EMODE; 144 flags &= ~CCR_CACHE_EMODE;
144#endif 145#endif
145 146
146#ifdef CONFIG_SH_WRITETHROUGH 147#if defined(CONFIG_CACHE_WRITETHROUGH)
147 /* Turn on Write-through caching */ 148 /* Write-through */
148 flags |= CCR_CACHE_WT; 149 flags |= CCR_CACHE_WT;
149#else 150#elif defined(CONFIG_CACHE_WRITEBACK)
150 /* .. or default to Write-back */ 151 /* Write-back */
151 flags |= CCR_CACHE_CB; 152 flags |= CCR_CACHE_CB;
153#else
154 /* Off */
155 flags &= ~CCR_CACHE_ENABLE;
152#endif 156#endif
153 157
154 ctrl_outl(flags, CCR); 158 ctrl_outl(flags, CCR);
@@ -213,8 +217,11 @@ static void __init dsp_init(void)
213 * Each processor family is still responsible for doing its own probing 217 * Each processor family is still responsible for doing its own probing
214 * and cache configuration in detect_cpu_and_cache_system(). 218 * and cache configuration in detect_cpu_and_cache_system().
215 */ 219 */
216asmlinkage void __init sh_cpu_init(void) 220
221asmlinkage void __cpuinit sh_cpu_init(void)
217{ 222{
223 current_thread_info()->cpu = hard_smp_processor_id();
224
218 /* First, probe the CPU */ 225 /* First, probe the CPU */
219 detect_cpu_and_cache_system(); 226 detect_cpu_and_cache_system();
220 227
@@ -224,9 +231,10 @@ asmlinkage void __init sh_cpu_init(void)
224 /* Init the cache */ 231 /* Init the cache */
225 cache_init(); 232 cache_init();
226 233
227 shm_align_mask = max_t(unsigned long, 234 if (raw_smp_processor_id() == 0)
228 current_cpu_data.dcache.way_size - 1, 235 shm_align_mask = max_t(unsigned long,
229 PAGE_SIZE - 1); 236 current_cpu_data.dcache.way_size - 1,
237 PAGE_SIZE - 1);
230 238
231 /* Disable the FPU */ 239 /* Disable the FPU */
232 if (fpu_disabled) { 240 if (fpu_disabled) {
@@ -265,6 +273,7 @@ asmlinkage void __init sh_cpu_init(void)
265 * like PTRACE_SINGLESTEP or doing hardware watchpoints in GDB. So .. 273 * like PTRACE_SINGLESTEP or doing hardware watchpoints in GDB. So ..
266 * we wake it up and hope that all is well. 274 * we wake it up and hope that all is well.
267 */ 275 */
268 ubc_wakeup(); 276 if (raw_smp_processor_id() == 0)
277 ubc_wakeup();
269 speculative_execution_init(); 278 speculative_execution_init();
270} 279}
diff --git a/arch/sh/kernel/cpu/irq/Makefile b/arch/sh/kernel/cpu/irq/Makefile
index 60bfc05cf354..8da8e178f09c 100644
--- a/arch/sh/kernel/cpu/irq/Makefile
+++ b/arch/sh/kernel/cpu/irq/Makefile
@@ -1,9 +1,7 @@
1# 1#
2# Makefile for the Linux/SuperH CPU-specifc IRQ handlers. 2# Makefile for the Linux/SuperH CPU-specifc IRQ handlers.
3# 3#
4obj-y += imask.o 4obj-y += imask.o intc.o
5 5
6obj-$(CONFIG_CPU_HAS_IPR_IRQ) += ipr.o 6obj-$(CONFIG_CPU_HAS_IPR_IRQ) += ipr.o
7obj-$(CONFIG_CPU_HAS_MASKREG_IRQ) += maskreg.o 7obj-$(CONFIG_CPU_HAS_MASKREG_IRQ) += maskreg.o
8obj-$(CONFIG_CPU_HAS_INTC_IRQ) += intc.o
9obj-$(CONFIG_CPU_HAS_INTC2_IRQ) += intc2.o
diff --git a/arch/sh/kernel/cpu/irq/intc.c b/arch/sh/kernel/cpu/irq/intc.c
index 9345a7130e9e..6ac018c15e03 100644
--- a/arch/sh/kernel/cpu/irq/intc.c
+++ b/arch/sh/kernel/cpu/irq/intc.c
@@ -20,145 +20,258 @@
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/bootmem.h>
24
25#define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \
26 ((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \
27 ((addr_e) << 16) | ((addr_d << 24)))
28
29#define _INTC_SHIFT(h) (h & 0x1f)
30#define _INTC_WIDTH(h) ((h >> 5) & 0xf)
31#define _INTC_FN(h) ((h >> 9) & 0xf)
32#define _INTC_MODE(h) ((h >> 13) & 0x7)
33#define _INTC_ADDR_E(h) ((h >> 16) & 0xff)
34#define _INTC_ADDR_D(h) ((h >> 24) & 0xff)
35
36struct intc_handle_int {
37 unsigned int irq;
38 unsigned long handle;
39};
40
41struct intc_desc_int {
42 unsigned long *reg;
43#ifdef CONFIG_SMP
44 unsigned long *smp;
45#endif
46 unsigned int nr_reg;
47 struct intc_handle_int *prio;
48 unsigned int nr_prio;
49 struct intc_handle_int *sense;
50 unsigned int nr_sense;
51 struct irq_chip chip;
52};
23 53
24#define _INTC_MK(fn, idx, bit, value) \ 54#ifdef CONFIG_SMP
25 ((fn) << 24 | ((value) << 16) | ((idx) << 8) | (bit)) 55#define IS_SMP(x) x.smp
26#define _INTC_FN(h) (h >> 24) 56#define INTC_REG(d, x, c) (d->reg[(x)] + ((d->smp[(x)] & 0xff) * c))
27#define _INTC_VALUE(h) ((h >> 16) & 0xff) 57#define SMP_NR(d, x) ((d->smp[(x)] >> 8) ? (d->smp[(x)] >> 8) : 1)
28#define _INTC_IDX(h) ((h >> 8) & 0xff) 58#else
29#define _INTC_BIT(h) (h & 0xff) 59#define IS_SMP(x) 0
60#define INTC_REG(d, x, c) (d->reg[(x)])
61#define SMP_NR(d, x) 1
62#endif
30 63
31#define _INTC_PTR(desc, member, data) \ 64static unsigned int intc_prio_level[NR_IRQS]; /* for now */
32 (desc->member + _INTC_IDX(data))
33 65
34static inline struct intc_desc *get_intc_desc(unsigned int irq) 66static inline struct intc_desc_int *get_intc_desc(unsigned int irq)
35{ 67{
36 struct irq_chip *chip = get_irq_chip(irq); 68 struct irq_chip *chip = get_irq_chip(irq);
37 return (void *)((char *)chip - offsetof(struct intc_desc, chip)); 69 return (void *)((char *)chip - offsetof(struct intc_desc_int, chip));
38} 70}
39 71
40static inline unsigned int set_field(unsigned int value, 72static inline unsigned int set_field(unsigned int value,
41 unsigned int field_value, 73 unsigned int field_value,
42 unsigned int width, 74 unsigned int handle)
43 unsigned int shift)
44{ 75{
76 unsigned int width = _INTC_WIDTH(handle);
77 unsigned int shift = _INTC_SHIFT(handle);
78
45 value &= ~(((1 << width) - 1) << shift); 79 value &= ~(((1 << width) - 1) << shift);
46 value |= field_value << shift; 80 value |= field_value << shift;
47 return value; 81 return value;
48} 82}
49 83
50static inline unsigned int set_prio_field(struct intc_desc *desc, 84static void write_8(unsigned long addr, unsigned long h, unsigned long data)
51 unsigned int value,
52 unsigned int priority,
53 unsigned int data)
54{ 85{
55 unsigned int width = _INTC_PTR(desc, prio_regs, data)->field_width; 86 ctrl_outb(set_field(0, data, h), addr);
56
57 return set_field(value, priority, width, _INTC_BIT(data));
58} 87}
59 88
60static void disable_prio_16(struct intc_desc *desc, unsigned int data) 89static void write_16(unsigned long addr, unsigned long h, unsigned long data)
61{ 90{
62 unsigned long addr = _INTC_PTR(desc, prio_regs, data)->reg; 91 ctrl_outw(set_field(0, data, h), addr);
63
64 ctrl_outw(set_prio_field(desc, ctrl_inw(addr), 0, data), addr);
65} 92}
66 93
67static void enable_prio_16(struct intc_desc *desc, unsigned int data) 94static void write_32(unsigned long addr, unsigned long h, unsigned long data)
68{ 95{
69 unsigned long addr = _INTC_PTR(desc, prio_regs, data)->reg; 96 ctrl_outl(set_field(0, data, h), addr);
70 unsigned int prio = _INTC_VALUE(data);
71
72 ctrl_outw(set_prio_field(desc, ctrl_inw(addr), prio, data), addr);
73} 97}
74 98
75static void disable_prio_32(struct intc_desc *desc, unsigned int data) 99static void modify_8(unsigned long addr, unsigned long h, unsigned long data)
76{ 100{
77 unsigned long addr = _INTC_PTR(desc, prio_regs, data)->reg; 101 ctrl_outb(set_field(ctrl_inb(addr), data, h), addr);
78
79 ctrl_outl(set_prio_field(desc, ctrl_inl(addr), 0, data), addr);
80} 102}
81 103
82static void enable_prio_32(struct intc_desc *desc, unsigned int data) 104static void modify_16(unsigned long addr, unsigned long h, unsigned long data)
83{ 105{
84 unsigned long addr = _INTC_PTR(desc, prio_regs, data)->reg; 106 ctrl_outw(set_field(ctrl_inw(addr), data, h), addr);
85 unsigned int prio = _INTC_VALUE(data);
86
87 ctrl_outl(set_prio_field(desc, ctrl_inl(addr), prio, data), addr);
88} 107}
89 108
90static void disable_mask_8(struct intc_desc *desc, unsigned int data) 109static void modify_32(unsigned long addr, unsigned long h, unsigned long data)
91{ 110{
92 ctrl_outb(1 << _INTC_BIT(data), 111 ctrl_outl(set_field(ctrl_inl(addr), data, h), addr);
93 _INTC_PTR(desc, mask_regs, data)->set_reg);
94} 112}
95 113
96static void enable_mask_8(struct intc_desc *desc, unsigned int data) 114enum { REG_FN_ERR = 0, REG_FN_WRITE_BASE = 1, REG_FN_MODIFY_BASE = 5 };
115
116static void (*intc_reg_fns[])(unsigned long addr,
117 unsigned long h,
118 unsigned long data) = {
119 [REG_FN_WRITE_BASE + 0] = write_8,
120 [REG_FN_WRITE_BASE + 1] = write_16,
121 [REG_FN_WRITE_BASE + 3] = write_32,
122 [REG_FN_MODIFY_BASE + 0] = modify_8,
123 [REG_FN_MODIFY_BASE + 1] = modify_16,
124 [REG_FN_MODIFY_BASE + 3] = modify_32,
125};
126
127enum { MODE_ENABLE_REG = 0, /* Bit(s) set -> interrupt enabled */
128 MODE_MASK_REG, /* Bit(s) set -> interrupt disabled */
129 MODE_DUAL_REG, /* Two registers, set bit to enable / disable */
130 MODE_PRIO_REG, /* Priority value written to enable interrupt */
131 MODE_PCLR_REG, /* Above plus all bits set to disable interrupt */
132};
133
134static void intc_mode_field(unsigned long addr,
135 unsigned long handle,
136 void (*fn)(unsigned long,
137 unsigned long,
138 unsigned long),
139 unsigned int irq)
97{ 140{
98 ctrl_outb(1 << _INTC_BIT(data), 141 fn(addr, handle, ((1 << _INTC_WIDTH(handle)) - 1));
99 _INTC_PTR(desc, mask_regs, data)->clr_reg);
100} 142}
101 143
102static void disable_mask_32(struct intc_desc *desc, unsigned int data) 144static void intc_mode_zero(unsigned long addr,
145 unsigned long handle,
146 void (*fn)(unsigned long,
147 unsigned long,
148 unsigned long),
149 unsigned int irq)
103{ 150{
104 ctrl_outl(1 << _INTC_BIT(data), 151 fn(addr, handle, 0);
105 _INTC_PTR(desc, mask_regs, data)->set_reg);
106} 152}
107 153
108static void enable_mask_32(struct intc_desc *desc, unsigned int data) 154static void intc_mode_prio(unsigned long addr,
155 unsigned long handle,
156 void (*fn)(unsigned long,
157 unsigned long,
158 unsigned long),
159 unsigned int irq)
109{ 160{
110 ctrl_outl(1 << _INTC_BIT(data), 161 fn(addr, handle, intc_prio_level[irq]);
111 _INTC_PTR(desc, mask_regs, data)->clr_reg);
112} 162}
113 163
114enum { REG_FN_ERROR=0, 164static void (*intc_enable_fns[])(unsigned long addr,
115 REG_FN_MASK_8, REG_FN_MASK_32, 165 unsigned long handle,
116 REG_FN_PRIO_16, REG_FN_PRIO_32 }; 166 void (*fn)(unsigned long,
117 167 unsigned long,
118static struct { 168 unsigned long),
119 void (*enable)(struct intc_desc *, unsigned int); 169 unsigned int irq) = {
120 void (*disable)(struct intc_desc *, unsigned int); 170 [MODE_ENABLE_REG] = intc_mode_field,
121} intc_reg_fns[] = { 171 [MODE_MASK_REG] = intc_mode_zero,
122 [REG_FN_MASK_8] = { enable_mask_8, disable_mask_8 }, 172 [MODE_DUAL_REG] = intc_mode_field,
123 [REG_FN_MASK_32] = { enable_mask_32, disable_mask_32 }, 173 [MODE_PRIO_REG] = intc_mode_prio,
124 [REG_FN_PRIO_16] = { enable_prio_16, disable_prio_16 }, 174 [MODE_PCLR_REG] = intc_mode_prio,
125 [REG_FN_PRIO_32] = { enable_prio_32, disable_prio_32 },
126}; 175};
127 176
128static void intc_enable(unsigned int irq) 177static void (*intc_disable_fns[])(unsigned long addr,
178 unsigned long handle,
179 void (*fn)(unsigned long,
180 unsigned long,
181 unsigned long),
182 unsigned int irq) = {
183 [MODE_ENABLE_REG] = intc_mode_zero,
184 [MODE_MASK_REG] = intc_mode_field,
185 [MODE_DUAL_REG] = intc_mode_field,
186 [MODE_PRIO_REG] = intc_mode_zero,
187 [MODE_PCLR_REG] = intc_mode_field,
188};
189
190static inline void _intc_enable(unsigned int irq, unsigned long handle)
129{ 191{
130 struct intc_desc *desc = get_intc_desc(irq); 192 struct intc_desc_int *d = get_intc_desc(irq);
131 unsigned int data = (unsigned int) get_irq_chip_data(irq); 193 unsigned long addr;
194 unsigned int cpu;
195
196 for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_E(handle)); cpu++) {
197 addr = INTC_REG(d, _INTC_ADDR_E(handle), cpu);
198 intc_enable_fns[_INTC_MODE(handle)](addr, handle, intc_reg_fns\
199 [_INTC_FN(handle)], irq);
200 }
201}
132 202
133 intc_reg_fns[_INTC_FN(data)].enable(desc, data); 203static void intc_enable(unsigned int irq)
204{
205 _intc_enable(irq, (unsigned long)get_irq_chip_data(irq));
134} 206}
135 207
136static void intc_disable(unsigned int irq) 208static void intc_disable(unsigned int irq)
137{ 209{
138 struct intc_desc *desc = get_intc_desc(irq); 210 struct intc_desc_int *d = get_intc_desc(irq);
139 unsigned int data = (unsigned int) get_irq_chip_data(irq); 211 unsigned long handle = (unsigned long) get_irq_chip_data(irq);
140 212 unsigned long addr;
141 intc_reg_fns[_INTC_FN(data)].disable(desc, data); 213 unsigned int cpu;
214
215 for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_D(handle)); cpu++) {
216 addr = INTC_REG(d, _INTC_ADDR_D(handle), cpu);
217 intc_disable_fns[_INTC_MODE(handle)](addr, handle,intc_reg_fns\
218 [_INTC_FN(handle)], irq);
219 }
142} 220}
143 221
144static void set_sense_16(struct intc_desc *desc, unsigned int data) 222static struct intc_handle_int *intc_find_irq(struct intc_handle_int *hp,
223 unsigned int nr_hp,
224 unsigned int irq)
145{ 225{
146 unsigned long addr = _INTC_PTR(desc, sense_regs, data)->reg; 226 int i;
147 unsigned int width = _INTC_PTR(desc, sense_regs, data)->field_width; 227
148 unsigned int bit = _INTC_BIT(data); 228 /* this doesn't scale well, but...
149 unsigned int value = _INTC_VALUE(data); 229 *
230 * this function should only be used for cerain uncommon
231 * operations such as intc_set_priority() and intc_set_sense()
232 * and in those rare cases performance doesn't matter that much.
233 * keeping the memory footprint low is more important.
234 *
235 * one rather simple way to speed this up and still keep the
236 * memory footprint down is to make sure the array is sorted
237 * and then perform a bisect to lookup the irq.
238 */
150 239
151 ctrl_outw(set_field(ctrl_inw(addr), value, width, bit), addr); 240 for (i = 0; i < nr_hp; i++) {
241 if ((hp + i)->irq != irq)
242 continue;
243
244 return hp + i;
245 }
246
247 return NULL;
152} 248}
153 249
154static void set_sense_32(struct intc_desc *desc, unsigned int data) 250int intc_set_priority(unsigned int irq, unsigned int prio)
155{ 251{
156 unsigned long addr = _INTC_PTR(desc, sense_regs, data)->reg; 252 struct intc_desc_int *d = get_intc_desc(irq);
157 unsigned int width = _INTC_PTR(desc, sense_regs, data)->field_width; 253 struct intc_handle_int *ihp;
158 unsigned int bit = _INTC_BIT(data); 254
159 unsigned int value = _INTC_VALUE(data); 255 if (!intc_prio_level[irq] || prio <= 1)
256 return -EINVAL;
257
258 ihp = intc_find_irq(d->prio, d->nr_prio, irq);
259 if (ihp) {
260 if (prio >= (1 << _INTC_WIDTH(ihp->handle)))
261 return -EINVAL;
160 262
161 ctrl_outl(set_field(ctrl_inl(addr), value, width, bit), addr); 263 intc_prio_level[irq] = prio;
264
265 /*
266 * only set secondary masking method directly
267 * primary masking method is using intc_prio_level[irq]
268 * priority level will be set during next enable()
269 */
270
271 if (_INTC_FN(ihp->handle) != REG_FN_ERR)
272 _intc_enable(irq, ihp->handle);
273 }
274 return 0;
162} 275}
163 276
164#define VALID(x) (x | 0x80) 277#define VALID(x) (x | 0x80)
@@ -172,79 +285,38 @@ static unsigned char intc_irq_sense_table[IRQ_TYPE_SENSE_MASK + 1] = {
172 285
173static int intc_set_sense(unsigned int irq, unsigned int type) 286static int intc_set_sense(unsigned int irq, unsigned int type)
174{ 287{
175 struct intc_desc *desc = get_intc_desc(irq); 288 struct intc_desc_int *d = get_intc_desc(irq);
176 unsigned char value = intc_irq_sense_table[type & IRQ_TYPE_SENSE_MASK]; 289 unsigned char value = intc_irq_sense_table[type & IRQ_TYPE_SENSE_MASK];
177 unsigned int i, j, data, bit; 290 struct intc_handle_int *ihp;
178 intc_enum enum_id = 0; 291 unsigned long addr;
179
180 for (i = 0; i < desc->nr_vectors; i++) {
181 struct intc_vect *vect = desc->vectors + i;
182
183 if (evt2irq(vect->vect) != irq)
184 continue;
185 292
186 enum_id = vect->enum_id; 293 if (!value)
187 break;
188 }
189
190 if (!enum_id || !value)
191 return -EINVAL; 294 return -EINVAL;
192 295
193 value ^= VALID(0); 296 ihp = intc_find_irq(d->sense, d->nr_sense, irq);
194 297 if (ihp) {
195 for (i = 0; i < desc->nr_sense_regs; i++) { 298 addr = INTC_REG(d, _INTC_ADDR_E(ihp->handle), 0);
196 struct intc_sense_reg *sr = desc->sense_regs + i; 299 intc_reg_fns[_INTC_FN(ihp->handle)](addr, ihp->handle, value);
197
198 for (j = 0; j < ARRAY_SIZE(sr->enum_ids); j++) {
199 if (sr->enum_ids[j] != enum_id)
200 continue;
201
202 bit = sr->reg_width - ((j + 1) * sr->field_width);
203 data = _INTC_MK(0, i, bit, value);
204
205 switch(sr->reg_width) {
206 case 16:
207 set_sense_16(desc, data);
208 break;
209 case 32:
210 set_sense_32(desc, data);
211 break;
212 }
213
214 return 0;
215 }
216 } 300 }
217 301 return 0;
218 return -EINVAL;
219} 302}
220 303
221static unsigned int __init intc_find_mask_handler(unsigned int width) 304static unsigned int __init intc_get_reg(struct intc_desc_int *d,
305 unsigned long address)
222{ 306{
223 switch (width) { 307 unsigned int k;
224 case 8:
225 return REG_FN_MASK_8;
226 case 32:
227 return REG_FN_MASK_32;
228 }
229 308
230 BUG(); 309 for (k = 0; k < d->nr_reg; k++) {
231 return REG_FN_ERROR; 310 if (d->reg[k] == address)
232} 311 return k;
233
234static unsigned int __init intc_find_prio_handler(unsigned int width)
235{
236 switch (width) {
237 case 16:
238 return REG_FN_PRIO_16;
239 case 32:
240 return REG_FN_PRIO_32;
241 } 312 }
242 313
243 BUG(); 314 BUG();
244 return REG_FN_ERROR; 315 return 0;
245} 316}
246 317
247static intc_enum __init intc_grp_id(struct intc_desc *desc, intc_enum enum_id) 318static intc_enum __init intc_grp_id(struct intc_desc *desc,
319 intc_enum enum_id)
248{ 320{
249 struct intc_group *g = desc->groups; 321 struct intc_group *g = desc->groups;
250 unsigned int i, j; 322 unsigned int i, j;
@@ -289,10 +361,12 @@ static unsigned int __init intc_prio_value(struct intc_desc *desc,
289} 361}
290 362
291static unsigned int __init intc_mask_data(struct intc_desc *desc, 363static unsigned int __init intc_mask_data(struct intc_desc *desc,
364 struct intc_desc_int *d,
292 intc_enum enum_id, int do_grps) 365 intc_enum enum_id, int do_grps)
293{ 366{
294 struct intc_mask_reg *mr = desc->mask_regs; 367 struct intc_mask_reg *mr = desc->mask_regs;
295 unsigned int i, j, fn; 368 unsigned int i, j, fn, mode;
369 unsigned long reg_e, reg_d;
296 370
297 for (i = 0; mr && enum_id && i < desc->nr_mask_regs; i++) { 371 for (i = 0; mr && enum_id && i < desc->nr_mask_regs; i++) {
298 mr = desc->mask_regs + i; 372 mr = desc->mask_regs + i;
@@ -301,25 +375,46 @@ static unsigned int __init intc_mask_data(struct intc_desc *desc,
301 if (mr->enum_ids[j] != enum_id) 375 if (mr->enum_ids[j] != enum_id)
302 continue; 376 continue;
303 377
304 fn = intc_find_mask_handler(mr->reg_width); 378 if (mr->set_reg && mr->clr_reg) {
305 if (fn == REG_FN_ERROR) 379 fn = REG_FN_WRITE_BASE;
306 return 0; 380 mode = MODE_DUAL_REG;
381 reg_e = mr->clr_reg;
382 reg_d = mr->set_reg;
383 } else {
384 fn = REG_FN_MODIFY_BASE;
385 if (mr->set_reg) {
386 mode = MODE_ENABLE_REG;
387 reg_e = mr->set_reg;
388 reg_d = mr->set_reg;
389 } else {
390 mode = MODE_MASK_REG;
391 reg_e = mr->clr_reg;
392 reg_d = mr->clr_reg;
393 }
394 }
307 395
308 return _INTC_MK(fn, i, (mr->reg_width - 1) - j, 0); 396 fn += (mr->reg_width >> 3) - 1;
397 return _INTC_MK(fn, mode,
398 intc_get_reg(d, reg_e),
399 intc_get_reg(d, reg_d),
400 1,
401 (mr->reg_width - 1) - j);
309 } 402 }
310 } 403 }
311 404
312 if (do_grps) 405 if (do_grps)
313 return intc_mask_data(desc, intc_grp_id(desc, enum_id), 0); 406 return intc_mask_data(desc, d, intc_grp_id(desc, enum_id), 0);
314 407
315 return 0; 408 return 0;
316} 409}
317 410
318static unsigned int __init intc_prio_data(struct intc_desc *desc, 411static unsigned int __init intc_prio_data(struct intc_desc *desc,
412 struct intc_desc_int *d,
319 intc_enum enum_id, int do_grps) 413 intc_enum enum_id, int do_grps)
320{ 414{
321 struct intc_prio_reg *pr = desc->prio_regs; 415 struct intc_prio_reg *pr = desc->prio_regs;
322 unsigned int i, j, fn, bit, prio; 416 unsigned int i, j, fn, mode, bit;
417 unsigned long reg_e, reg_d;
323 418
324 for (i = 0; pr && enum_id && i < desc->nr_prio_regs; i++) { 419 for (i = 0; pr && enum_id && i < desc->nr_prio_regs; i++) {
325 pr = desc->prio_regs + i; 420 pr = desc->prio_regs + i;
@@ -328,28 +423,72 @@ static unsigned int __init intc_prio_data(struct intc_desc *desc,
328 if (pr->enum_ids[j] != enum_id) 423 if (pr->enum_ids[j] != enum_id)
329 continue; 424 continue;
330 425
331 fn = intc_find_prio_handler(pr->reg_width); 426 if (pr->set_reg && pr->clr_reg) {
332 if (fn == REG_FN_ERROR) 427 fn = REG_FN_WRITE_BASE;
333 return 0; 428 mode = MODE_PCLR_REG;
429 reg_e = pr->set_reg;
430 reg_d = pr->clr_reg;
431 } else {
432 fn = REG_FN_MODIFY_BASE;
433 mode = MODE_PRIO_REG;
434 if (!pr->set_reg)
435 BUG();
436 reg_e = pr->set_reg;
437 reg_d = pr->set_reg;
438 }
334 439
335 prio = intc_prio_value(desc, enum_id, 1); 440 fn += (pr->reg_width >> 3) - 1;
336 bit = pr->reg_width - ((j + 1) * pr->field_width); 441 bit = pr->reg_width - ((j + 1) * pr->field_width);
337 442
338 BUG_ON(bit < 0); 443 BUG_ON(bit < 0);
339 444
340 return _INTC_MK(fn, i, bit, prio); 445 return _INTC_MK(fn, mode,
446 intc_get_reg(d, reg_e),
447 intc_get_reg(d, reg_d),
448 pr->field_width, bit);
341 } 449 }
342 } 450 }
343 451
344 if (do_grps) 452 if (do_grps)
345 return intc_prio_data(desc, intc_grp_id(desc, enum_id), 0); 453 return intc_prio_data(desc, d, intc_grp_id(desc, enum_id), 0);
346 454
347 return 0; 455 return 0;
348} 456}
349 457
350static void __init intc_register_irq(struct intc_desc *desc, intc_enum enum_id, 458static unsigned int __init intc_sense_data(struct intc_desc *desc,
459 struct intc_desc_int *d,
460 intc_enum enum_id)
461{
462 struct intc_sense_reg *sr = desc->sense_regs;
463 unsigned int i, j, fn, bit;
464
465 for (i = 0; sr && enum_id && i < desc->nr_sense_regs; i++) {
466 sr = desc->sense_regs + i;
467
468 for (j = 0; j < ARRAY_SIZE(sr->enum_ids); j++) {
469 if (sr->enum_ids[j] != enum_id)
470 continue;
471
472 fn = REG_FN_MODIFY_BASE;
473 fn += (sr->reg_width >> 3) - 1;
474 bit = sr->reg_width - ((j + 1) * sr->field_width);
475
476 BUG_ON(bit < 0);
477
478 return _INTC_MK(fn, 0, intc_get_reg(d, sr->reg),
479 0, sr->field_width, bit);
480 }
481 }
482
483 return 0;
484}
485
486static void __init intc_register_irq(struct intc_desc *desc,
487 struct intc_desc_int *d,
488 intc_enum enum_id,
351 unsigned int irq) 489 unsigned int irq)
352{ 490{
491 struct intc_handle_int *hp;
353 unsigned int data[2], primary; 492 unsigned int data[2], primary;
354 493
355 /* Prefer single interrupt source bitmap over other combinations: 494 /* Prefer single interrupt source bitmap over other combinations:
@@ -359,15 +498,15 @@ static void __init intc_register_irq(struct intc_desc *desc, intc_enum enum_id,
359 * 4. priority, multiple interrupt sources (groups) 498 * 4. priority, multiple interrupt sources (groups)
360 */ 499 */
361 500
362 data[0] = intc_mask_data(desc, enum_id, 0); 501 data[0] = intc_mask_data(desc, d, enum_id, 0);
363 data[1] = intc_prio_data(desc, enum_id, 0); 502 data[1] = intc_prio_data(desc, d, enum_id, 0);
364 503
365 primary = 0; 504 primary = 0;
366 if (!data[0] && data[1]) 505 if (!data[0] && data[1])
367 primary = 1; 506 primary = 1;
368 507
369 data[0] = data[0] ? data[0] : intc_mask_data(desc, enum_id, 1); 508 data[0] = data[0] ? data[0] : intc_mask_data(desc, d, enum_id, 1);
370 data[1] = data[1] ? data[1] : intc_prio_data(desc, enum_id, 1); 509 data[1] = data[1] ? data[1] : intc_prio_data(desc, d, enum_id, 1);
371 510
372 if (!data[primary]) 511 if (!data[primary])
373 primary ^= 1; 512 primary ^= 1;
@@ -375,31 +514,118 @@ static void __init intc_register_irq(struct intc_desc *desc, intc_enum enum_id,
375 BUG_ON(!data[primary]); /* must have primary masking method */ 514 BUG_ON(!data[primary]); /* must have primary masking method */
376 515
377 disable_irq_nosync(irq); 516 disable_irq_nosync(irq);
378 set_irq_chip_and_handler_name(irq, &desc->chip, 517 set_irq_chip_and_handler_name(irq, &d->chip,
379 handle_level_irq, "level"); 518 handle_level_irq, "level");
380 set_irq_chip_data(irq, (void *)data[primary]); 519 set_irq_chip_data(irq, (void *)data[primary]);
381 520
521 /* record the desired priority level */
522 intc_prio_level[irq] = intc_prio_value(desc, enum_id, 1);
523
382 /* enable secondary masking method if present */ 524 /* enable secondary masking method if present */
383 if (data[!primary]) 525 if (data[!primary])
384 intc_reg_fns[_INTC_FN(data[!primary])].enable(desc, 526 _intc_enable(irq, data[!primary]);
385 data[!primary]); 527
528 /* add irq to d->prio list if priority is available */
529 if (data[1]) {
530 hp = d->prio + d->nr_prio;
531 hp->irq = irq;
532 hp->handle = data[1];
533
534 if (primary) {
535 /*
536 * only secondary priority should access registers, so
537 * set _INTC_FN(h) = REG_FN_ERR for intc_set_priority()
538 */
539
540 hp->handle &= ~_INTC_MK(0x0f, 0, 0, 0, 0, 0);
541 hp->handle |= _INTC_MK(REG_FN_ERR, 0, 0, 0, 0, 0);
542 }
543 d->nr_prio++;
544 }
545
546 /* add irq to d->sense list if sense is available */
547 data[0] = intc_sense_data(desc, d, enum_id);
548 if (data[0]) {
549 (d->sense + d->nr_sense)->irq = irq;
550 (d->sense + d->nr_sense)->handle = data[0];
551 d->nr_sense++;
552 }
386 553
387 /* irq should be disabled by default */ 554 /* irq should be disabled by default */
388 desc->chip.mask(irq); 555 d->chip.mask(irq);
389} 556}
390 557
558static unsigned int __init save_reg(struct intc_desc_int *d,
559 unsigned int cnt,
560 unsigned long value,
561 unsigned int smp)
562{
563 if (value) {
564 d->reg[cnt] = value;
565#ifdef CONFIG_SMP
566 d->smp[cnt] = smp;
567#endif
568 return 1;
569 }
570
571 return 0;
572}
573
574
391void __init register_intc_controller(struct intc_desc *desc) 575void __init register_intc_controller(struct intc_desc *desc)
392{ 576{
393 unsigned int i; 577 unsigned int i, k, smp;
578 struct intc_desc_int *d;
579
580 d = alloc_bootmem(sizeof(*d));
581
582 d->nr_reg = desc->mask_regs ? desc->nr_mask_regs * 2 : 0;
583 d->nr_reg += desc->prio_regs ? desc->nr_prio_regs * 2 : 0;
584 d->nr_reg += desc->sense_regs ? desc->nr_sense_regs : 0;
585
586 d->reg = alloc_bootmem(d->nr_reg * sizeof(*d->reg));
587#ifdef CONFIG_SMP
588 d->smp = alloc_bootmem(d->nr_reg * sizeof(*d->smp));
589#endif
590 k = 0;
591
592 if (desc->mask_regs) {
593 for (i = 0; i < desc->nr_mask_regs; i++) {
594 smp = IS_SMP(desc->mask_regs[i]);
595 k += save_reg(d, k, desc->mask_regs[i].set_reg, smp);
596 k += save_reg(d, k, desc->mask_regs[i].clr_reg, smp);
597 }
598 }
599
600 if (desc->prio_regs) {
601 d->prio = alloc_bootmem(desc->nr_vectors * sizeof(*d->prio));
602
603 for (i = 0; i < desc->nr_prio_regs; i++) {
604 smp = IS_SMP(desc->prio_regs[i]);
605 k += save_reg(d, k, desc->prio_regs[i].set_reg, smp);
606 k += save_reg(d, k, desc->prio_regs[i].clr_reg, smp);
607 }
608 }
609
610 if (desc->sense_regs) {
611 d->sense = alloc_bootmem(desc->nr_vectors * sizeof(*d->sense));
612
613 for (i = 0; i < desc->nr_sense_regs; i++) {
614 k += save_reg(d, k, desc->sense_regs[i].reg, 0);
615 }
616 }
617
618 BUG_ON(k > 256); /* _INTC_ADDR_E() and _INTC_ADDR_D() are 8 bits */
394 619
395 desc->chip.mask = intc_disable; 620 d->chip.name = desc->name;
396 desc->chip.unmask = intc_enable; 621 d->chip.mask = intc_disable;
397 desc->chip.mask_ack = intc_disable; 622 d->chip.unmask = intc_enable;
398 desc->chip.set_type = intc_set_sense; 623 d->chip.mask_ack = intc_disable;
624 d->chip.set_type = intc_set_sense;
399 625
400 for (i = 0; i < desc->nr_vectors; i++) { 626 for (i = 0; i < desc->nr_vectors; i++) {
401 struct intc_vect *vect = desc->vectors + i; 627 struct intc_vect *vect = desc->vectors + i;
402 628
403 intc_register_irq(desc, vect->enum_id, evt2irq(vect->vect)); 629 intc_register_irq(desc, d, vect->enum_id, evt2irq(vect->vect));
404 } 630 }
405} 631}
diff --git a/arch/sh/kernel/cpu/irq/intc2.c b/arch/sh/kernel/cpu/irq/intc2.c
deleted file mode 100644
index cc5221390e09..000000000000
--- a/arch/sh/kernel/cpu/irq/intc2.c
+++ /dev/null
@@ -1,86 +0,0 @@
1/*
2 * Interrupt handling for INTC2-based IRQ.
3 *
4 * Copyright (C) 2001 David J. Mckay (david.mckay@st.com)
5 * Copyright (C) 2005, 2006 Paul Mundt (lethal@linux-sh.org)
6 *
7 * May be copied or modified under the terms of the GNU General Public
8 * License. See linux/COPYING for more information.
9 *
10 * These are the "new Hitachi style" interrupts, as present on the
11 * Hitachi 7751, the STM ST40 STB1, SH7760, and SH7780.
12 */
13#include <linux/kernel.h>
14#include <linux/interrupt.h>
15#include <linux/io.h>
16#include <asm/smp.h>
17
18static inline struct intc2_desc *get_intc2_desc(unsigned int irq)
19{
20 struct irq_chip *chip = get_irq_chip(irq);
21 return (void *)((char *)chip - offsetof(struct intc2_desc, chip));
22}
23
24static void disable_intc2_irq(unsigned int irq)
25{
26 struct intc2_data *p = get_irq_chip_data(irq);
27 struct intc2_desc *d = get_intc2_desc(irq);
28
29 ctrl_outl(1 << p->msk_shift, d->msk_base + p->msk_offset +
30 (hard_smp_processor_id() * 4));
31}
32
33static void enable_intc2_irq(unsigned int irq)
34{
35 struct intc2_data *p = get_irq_chip_data(irq);
36 struct intc2_desc *d = get_intc2_desc(irq);
37
38 ctrl_outl(1 << p->msk_shift, d->mskclr_base + p->msk_offset +
39 (hard_smp_processor_id() * 4));
40}
41
42/*
43 * Setup an INTC2 style interrupt.
44 * NOTE: Unlike IPR interrupts, parameters are not shifted by this code,
45 * allowing the use of the numbers straight out of the datasheet.
46 * For example:
47 * PIO1 which is INTPRI00[19,16] and INTMSK00[13]
48 * would be: ^ ^ ^ ^
49 * | | | |
50 * { 84, 0, 16, 0, 13 },
51 *
52 * in the intc2_data table.
53 */
54void register_intc2_controller(struct intc2_desc *desc)
55{
56 int i;
57
58 desc->chip.mask = disable_intc2_irq;
59 desc->chip.unmask = enable_intc2_irq;
60 desc->chip.mask_ack = disable_intc2_irq;
61
62 for (i = 0; i < desc->nr_irqs; i++) {
63 unsigned long ipr, flags;
64 struct intc2_data *p = desc->intc2_data + i;
65
66 disable_irq_nosync(p->irq);
67
68 if (desc->prio_base) {
69 /* Set the priority level */
70 local_irq_save(flags);
71
72 ipr = ctrl_inl(desc->prio_base + p->ipr_offset);
73 ipr &= ~(0xf << p->ipr_shift);
74 ipr |= p->priority << p->ipr_shift;
75 ctrl_outl(ipr, desc->prio_base + p->ipr_offset);
76
77 local_irq_restore(flags);
78 }
79
80 set_irq_chip_and_handler_name(p->irq, &desc->chip,
81 handle_level_irq, "level");
82 set_irq_chip_data(p->irq, p);
83
84 disable_intc2_irq(p->irq);
85 }
86}
diff --git a/arch/sh/kernel/cpu/sh2/probe.c b/arch/sh/kernel/cpu/sh2/probe.c
index abbf17427e52..5916d9096b99 100644
--- a/arch/sh/kernel/cpu/sh2/probe.c
+++ b/arch/sh/kernel/cpu/sh2/probe.c
@@ -10,26 +10,25 @@
10 * for more details. 10 * for more details.
11 */ 11 */
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/smp.h>
14#include <asm/processor.h> 13#include <asm/processor.h>
15#include <asm/cache.h> 14#include <asm/cache.h>
16 15
17int __init detect_cpu_and_cache_system(void) 16int __init detect_cpu_and_cache_system(void)
18{ 17{
19#if defined(CONFIG_CPU_SUBTYPE_SH7619) 18#if defined(CONFIG_CPU_SUBTYPE_SH7619)
20 current_cpu_data.type = CPU_SH7619; 19 boot_cpu_data.type = CPU_SH7619;
21 current_cpu_data.dcache.ways = 4; 20 boot_cpu_data.dcache.ways = 4;
22 current_cpu_data.dcache.way_incr = (1<<12); 21 boot_cpu_data.dcache.way_incr = (1<<12);
23 current_cpu_data.dcache.sets = 256; 22 boot_cpu_data.dcache.sets = 256;
24 current_cpu_data.dcache.entry_shift = 4; 23 boot_cpu_data.dcache.entry_shift = 4;
25 current_cpu_data.dcache.linesz = L1_CACHE_BYTES; 24 boot_cpu_data.dcache.linesz = L1_CACHE_BYTES;
26 current_cpu_data.dcache.flags = 0; 25 boot_cpu_data.dcache.flags = 0;
27#endif 26#endif
28 /* 27 /*
29 * SH-2 doesn't have separate caches 28 * SH-2 doesn't have separate caches
30 */ 29 */
31 current_cpu_data.dcache.flags |= SH_CACHE_COMBINED; 30 boot_cpu_data.dcache.flags |= SH_CACHE_COMBINED;
32 current_cpu_data.icache = current_cpu_data.dcache; 31 boot_cpu_data.icache = boot_cpu_data.dcache;
33 32
34 return 0; 33 return 0;
35} 34}
diff --git a/arch/sh/kernel/cpu/sh2/setup-sh7619.c b/arch/sh/kernel/cpu/sh2/setup-sh7619.c
index a979b981e6a3..ec6adc3f306f 100644
--- a/arch/sh/kernel/cpu/sh2/setup-sh7619.c
+++ b/arch/sh/kernel/cpu/sh2/setup-sh7619.c
@@ -12,6 +12,61 @@
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <asm/sci.h> 13#include <asm/sci.h>
14 14
15enum {
16 UNUSED = 0,
17
18 /* interrupt sources */
19 IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
20 WDT, EDMAC, CMT0, CMT1,
21 SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI,
22 SCIF1_ERI, SCIF1_RXI, SCIF1_BRI, SCIF1_TXI,
23 SCIF2_ERI, SCIF2_RXI, SCIF2_BRI, SCIF2_TXI,
24 HIF_HIFI, HIF_HIFBI,
25 DMAC0, DMAC1, DMAC2, DMAC3,
26 SIOF,
27
28 /* interrupt groups */
29 SCIF0, SCIF1, SCIF2,
30};
31
32static struct intc_vect vectors[] __initdata = {
33 INTC_IRQ(IRQ0, 64), INTC_IRQ(IRQ1, 65),
34 INTC_IRQ(IRQ2, 66), INTC_IRQ(IRQ3, 67),
35 INTC_IRQ(IRQ4, 80), INTC_IRQ(IRQ5, 81),
36 INTC_IRQ(IRQ6, 82), INTC_IRQ(IRQ7, 83),
37 INTC_IRQ(WDT, 84), INTC_IRQ(EDMAC, 85),
38 INTC_IRQ(CMT0, 86), INTC_IRQ(CMT1, 87),
39 INTC_IRQ(SCIF0_ERI, 88), INTC_IRQ(SCIF0_RXI, 89),
40 INTC_IRQ(SCIF0_BRI, 90), INTC_IRQ(SCIF0_TXI, 91),
41 INTC_IRQ(SCIF1_ERI, 92), INTC_IRQ(SCIF1_RXI, 93),
42 INTC_IRQ(SCIF1_BRI, 94), INTC_IRQ(SCIF1_TXI, 95),
43 INTC_IRQ(SCIF2_ERI, 96), INTC_IRQ(SCIF2_RXI, 97),
44 INTC_IRQ(SCIF2_BRI, 98), INTC_IRQ(SCIF2_TXI, 99),
45 INTC_IRQ(HIF_HIFI, 100), INTC_IRQ(HIF_HIFBI, 101),
46 INTC_IRQ(DMAC0, 104), INTC_IRQ(DMAC1, 105),
47 INTC_IRQ(DMAC2, 106), INTC_IRQ(DMAC3, 107),
48 INTC_IRQ(SIOF, 108),
49};
50
51static struct intc_group groups[] __initdata = {
52 INTC_GROUP(SCIF0, SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI),
53 INTC_GROUP(SCIF1, SCIF1_ERI, SCIF1_RXI, SCIF1_BRI, SCIF1_TXI),
54 INTC_GROUP(SCIF2, SCIF2_ERI, SCIF2_RXI, SCIF2_BRI, SCIF2_TXI),
55};
56
57static struct intc_prio_reg prio_registers[] __initdata = {
58 { 0xf8140006, 0, 16, 4, /* IPRA */ { IRQ0, IRQ1, IRQ2, IRQ3 } },
59 { 0xf8140008, 0, 16, 4, /* IPRB */ { IRQ4, IRQ5, IRQ6, IRQ7 } },
60 { 0xf8080000, 0, 16, 4, /* IPRC */ { WDT, EDMAC, CMT0, CMT1 } },
61 { 0xf8080002, 0, 16, 4, /* IPRD */ { SCIF0, SCIF1, SCIF2 } },
62 { 0xf8080004, 0, 16, 4, /* IPRE */ { HIF_HIFI, HIF_HIFBI } },
63 { 0xf8080006, 0, 16, 4, /* IPRF */ { DMAC0, DMAC1, DMAC2, DMAC3 } },
64 { 0xf8080008, 0, 16, 4, /* IPRG */ { SIOF } },
65};
66
67static DECLARE_INTC_DESC(intc_desc, "sh7619", vectors, groups,
68 NULL, NULL, prio_registers, NULL);
69
15static struct plat_sci_port sci_platform_data[] = { 70static struct plat_sci_port sci_platform_data[] = {
16 { 71 {
17 .mapbase = 0xf8400000, 72 .mapbase = 0xf8400000,
@@ -52,43 +107,7 @@ static int __init sh7619_devices_setup(void)
52} 107}
53__initcall(sh7619_devices_setup); 108__initcall(sh7619_devices_setup);
54 109
55static struct ipr_data ipr_irq_table[] = {
56 { 86, 0, 4, 2 }, /* CMI0 */
57 { 88, 1, 12, 3 }, /* SCIF0_ERI */
58 { 89, 1, 12, 3 }, /* SCIF0_RXI */
59 { 90, 1, 12, 3 }, /* SCIF0_BRI */
60 { 91, 1, 12, 3 }, /* SCIF0_TXI */
61 { 92, 1, 8, 3 }, /* SCIF1_ERI */
62 { 93, 1, 8, 3 }, /* SCIF1_RXI */
63 { 94, 1, 8, 3 }, /* SCIF1_BRI */
64 { 95, 1, 8, 3 }, /* SCIF1_TXI */
65 { 96, 1, 4, 3 }, /* SCIF2_ERI */
66 { 97, 1, 4, 3 }, /* SCIF2_RXI */
67 { 98, 1, 4, 3 }, /* SCIF2_BRI */
68 { 99, 1, 4, 3 }, /* SCIF2_TXI */
69};
70
71static unsigned long ipr_offsets[] = {
72 0xf8080000, /* IPRC */
73 0xf8080002, /* IPRD */
74 0xf8080004, /* IPRE */
75 0xf8080006, /* IPRF */
76 0xf8080008, /* IPRG */
77};
78
79static struct ipr_desc ipr_irq_desc = {
80 .ipr_offsets = ipr_offsets,
81 .nr_offsets = ARRAY_SIZE(ipr_offsets),
82
83 .ipr_data = ipr_irq_table,
84 .nr_irqs = ARRAY_SIZE(ipr_irq_table),
85
86 .chip = {
87 .name = "IPR-sh7619",
88 },
89};
90
91void __init plat_irq_setup(void) 110void __init plat_irq_setup(void)
92{ 111{
93 register_ipr_controller(&ipr_irq_desc); 112 register_intc_controller(&intc_desc);
94} 113}
diff --git a/arch/sh/kernel/cpu/sh2a/probe.c b/arch/sh/kernel/cpu/sh2a/probe.c
index f455c3509789..6d02465704b9 100644
--- a/arch/sh/kernel/cpu/sh2a/probe.c
+++ b/arch/sh/kernel/cpu/sh2a/probe.c
@@ -17,15 +17,15 @@
17int __init detect_cpu_and_cache_system(void) 17int __init detect_cpu_and_cache_system(void)
18{ 18{
19 /* Just SH7206 for now .. */ 19 /* Just SH7206 for now .. */
20 current_cpu_data.type = CPU_SH7206; 20 boot_cpu_data.type = CPU_SH7206;
21 current_cpu_data.flags |= CPU_HAS_OP32; 21 boot_cpu_data.flags |= CPU_HAS_OP32;
22 22
23 current_cpu_data.dcache.ways = 4; 23 boot_cpu_data.dcache.ways = 4;
24 current_cpu_data.dcache.way_incr = (1 << 11); 24 boot_cpu_data.dcache.way_incr = (1 << 11);
25 current_cpu_data.dcache.sets = 128; 25 boot_cpu_data.dcache.sets = 128;
26 current_cpu_data.dcache.entry_shift = 4; 26 boot_cpu_data.dcache.entry_shift = 4;
27 current_cpu_data.dcache.linesz = L1_CACHE_BYTES; 27 boot_cpu_data.dcache.linesz = L1_CACHE_BYTES;
28 current_cpu_data.dcache.flags = 0; 28 boot_cpu_data.dcache.flags = 0;
29 29
30 /* 30 /*
31 * The icache is the same as the dcache as far as this setup is 31 * The icache is the same as the dcache as far as this setup is
@@ -33,7 +33,7 @@ int __init detect_cpu_and_cache_system(void)
33 * lacks the U bit that the dcache has, none of this has any bearing 33 * lacks the U bit that the dcache has, none of this has any bearing
34 * on the cache info. 34 * on the cache info.
35 */ 35 */
36 current_cpu_data.icache = current_cpu_data.dcache; 36 boot_cpu_data.icache = boot_cpu_data.dcache;
37 37
38 return 0; 38 return 0;
39} 39}
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
index deab16500167..bd745aa87222 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
@@ -12,27 +12,184 @@
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <asm/sci.h> 13#include <asm/sci.h>
14 14
15enum {
16 UNUSED = 0,
17
18 /* interrupt sources */
19 IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
20 PINT0, PINT1, PINT2, PINT3, PINT4, PINT5, PINT6, PINT7,
21 ADC_ADI0, ADC_ADI1,
22 DMAC0_DEI, DMAC0_HEI, DMAC1_DEI, DMAC1_HEI,
23 DMAC2_DEI, DMAC2_HEI, DMAC3_DEI, DMAC3_HEI,
24 DMAC4_DEI, DMAC4_HEI, DMAC5_DEI, DMAC5_HEI,
25 DMAC6_DEI, DMAC6_HEI, DMAC7_DEI, DMAC7_HEI,
26 CMT0, CMT1, BSC, WDT,
27 MTU2_TGI0A, MTU2_TGI0B, MTU2_TGI0C, MTU2_TGI0D,
28 MTU2_TCI0V, MTU2_TGI0E, MTU2_TGI0F,
29 MTU2_TGI1A, MTU2_TGI1B, MTU2_TCI1V, MTU2_TCI1U,
30 MTU2_TGI2A, MTU2_TGI2B, MTU2_TCI2V, MTU2_TCI2U,
31 MTU2_TGI3A, MTU2_TGI3B, MTU2_TGI3C, MTU2_TGI3D, MTU2_TCI3V,
32 MTU2_TGI4A, MTU2_TGI4B, MTU2_TGI4C, MTU2_TGI4D, MTU2_TCI4V,
33 MTU2_TGI5U, MTU2_TGI5V, MTU2_TGI5W,
34 POE2_OEI1, POE2_OEI2,
35 MTU2S_TGI3A, MTU2S_TGI3B, MTU2S_TGI3C, MTU2S_TGI3D, MTU2S_TCI3V,
36 MTU2S_TGI4A, MTU2S_TGI4B, MTU2S_TGI4C, MTU2S_TGI4D, MTU2S_TCI4V,
37 MTU2S_TGI5U, MTU2S_TGI5V, MTU2S_TGI5W,
38 POE2_OEI3,
39 IIC3_STPI, IIC3_NAKI, IIC3_RXI, IIC3_TXI, IIC3_TEI,
40 SCIF0_BRI, SCIF0_ERI, SCIF0_RXI, SCIF0_TXI,
41 SCIF1_BRI, SCIF1_ERI, SCIF1_RXI, SCIF1_TXI,
42 SCIF2_BRI, SCIF2_ERI, SCIF2_RXI, SCIF2_TXI,
43 SCIF3_BRI, SCIF3_ERI, SCIF3_RXI, SCIF3_TXI,
44
45 /* interrupt groups */
46 PINT, DMAC0, DMAC1, DMAC2, DMAC3, DMAC4, DMAC5, DMAC6, DMAC7,
47 MTU0_ABCD, MTU0_VEF, MTU1_AB, MTU1_VU, MTU2_AB, MTU2_VU,
48 MTU3_ABCD, MTU4_ABCD, MTU5, POE2_12, MTU3S_ABCD, MTU4S_ABCD, MTU5S,
49 IIC3, SCIF0, SCIF1, SCIF2, SCIF3,
50};
51
52static struct intc_vect vectors[] __initdata = {
53 INTC_IRQ(IRQ0, 64), INTC_IRQ(IRQ1, 65),
54 INTC_IRQ(IRQ2, 66), INTC_IRQ(IRQ3, 67),
55 INTC_IRQ(IRQ4, 68), INTC_IRQ(IRQ5, 69),
56 INTC_IRQ(IRQ6, 70), INTC_IRQ(IRQ7, 71),
57 INTC_IRQ(PINT0, 80), INTC_IRQ(PINT1, 81),
58 INTC_IRQ(PINT2, 82), INTC_IRQ(PINT3, 83),
59 INTC_IRQ(PINT4, 84), INTC_IRQ(PINT5, 85),
60 INTC_IRQ(PINT6, 86), INTC_IRQ(PINT7, 87),
61 INTC_IRQ(ADC_ADI0, 92), INTC_IRQ(ADC_ADI1, 96),
62 INTC_IRQ(DMAC0_DEI, 108), INTC_IRQ(DMAC0_HEI, 109),
63 INTC_IRQ(DMAC1_DEI, 112), INTC_IRQ(DMAC1_HEI, 113),
64 INTC_IRQ(DMAC2_DEI, 116), INTC_IRQ(DMAC2_HEI, 117),
65 INTC_IRQ(DMAC3_DEI, 120), INTC_IRQ(DMAC3_HEI, 121),
66 INTC_IRQ(DMAC4_DEI, 124), INTC_IRQ(DMAC4_HEI, 125),
67 INTC_IRQ(DMAC5_DEI, 128), INTC_IRQ(DMAC5_HEI, 129),
68 INTC_IRQ(DMAC6_DEI, 132), INTC_IRQ(DMAC6_HEI, 133),
69 INTC_IRQ(DMAC7_DEI, 136), INTC_IRQ(DMAC7_HEI, 137),
70 INTC_IRQ(CMT0, 140), INTC_IRQ(CMT1, 144),
71 INTC_IRQ(BSC, 148), INTC_IRQ(WDT, 152),
72 INTC_IRQ(MTU2_TGI0A, 156), INTC_IRQ(MTU2_TGI0B, 157),
73 INTC_IRQ(MTU2_TGI0C, 158), INTC_IRQ(MTU2_TGI0D, 159),
74 INTC_IRQ(MTU2_TCI0V, 160),
75 INTC_IRQ(MTU2_TGI0E, 161), INTC_IRQ(MTU2_TGI0F, 162),
76 INTC_IRQ(MTU2_TGI1A, 164), INTC_IRQ(MTU2_TGI1B, 165),
77 INTC_IRQ(MTU2_TCI1V, 168), INTC_IRQ(MTU2_TCI1U, 169),
78 INTC_IRQ(MTU2_TGI2A, 172), INTC_IRQ(MTU2_TGI2B, 173),
79 INTC_IRQ(MTU2_TCI2V, 176), INTC_IRQ(MTU2_TCI2U, 177),
80 INTC_IRQ(MTU2_TGI3A, 180), INTC_IRQ(MTU2_TGI3B, 181),
81 INTC_IRQ(MTU2_TGI3C, 182), INTC_IRQ(MTU2_TGI3D, 183),
82 INTC_IRQ(MTU2_TCI3V, 184),
83 INTC_IRQ(MTU2_TGI4A, 188), INTC_IRQ(MTU2_TGI4B, 189),
84 INTC_IRQ(MTU2_TGI4C, 190), INTC_IRQ(MTU2_TGI4D, 191),
85 INTC_IRQ(MTU2_TCI4V, 192),
86 INTC_IRQ(MTU2_TGI5U, 196), INTC_IRQ(MTU2_TGI5V, 197),
87 INTC_IRQ(MTU2_TGI5W, 198),
88 INTC_IRQ(POE2_OEI1, 200), INTC_IRQ(POE2_OEI2, 201),
89 INTC_IRQ(MTU2S_TGI3A, 204), INTC_IRQ(MTU2S_TGI3B, 205),
90 INTC_IRQ(MTU2S_TGI3C, 206), INTC_IRQ(MTU2S_TGI3D, 207),
91 INTC_IRQ(MTU2S_TCI3V, 208),
92 INTC_IRQ(MTU2S_TGI4A, 212), INTC_IRQ(MTU2S_TGI4B, 213),
93 INTC_IRQ(MTU2S_TGI4C, 214), INTC_IRQ(MTU2S_TGI4D, 215),
94 INTC_IRQ(MTU2S_TCI4V, 216),
95 INTC_IRQ(MTU2S_TGI5U, 220), INTC_IRQ(MTU2S_TGI5V, 221),
96 INTC_IRQ(MTU2S_TGI5W, 222),
97 INTC_IRQ(POE2_OEI3, 224),
98 INTC_IRQ(IIC3_STPI, 228), INTC_IRQ(IIC3_NAKI, 229),
99 INTC_IRQ(IIC3_RXI, 230), INTC_IRQ(IIC3_TXI, 231),
100 INTC_IRQ(IIC3_TEI, 232),
101 INTC_IRQ(SCIF0_BRI, 240), INTC_IRQ(SCIF0_ERI, 241),
102 INTC_IRQ(SCIF0_RXI, 242), INTC_IRQ(SCIF0_TXI, 243),
103 INTC_IRQ(SCIF1_BRI, 244), INTC_IRQ(SCIF1_ERI, 245),
104 INTC_IRQ(SCIF1_RXI, 246), INTC_IRQ(SCIF1_TXI, 247),
105 INTC_IRQ(SCIF2_BRI, 248), INTC_IRQ(SCIF2_ERI, 249),
106 INTC_IRQ(SCIF2_RXI, 250), INTC_IRQ(SCIF2_TXI, 251),
107 INTC_IRQ(SCIF3_BRI, 252), INTC_IRQ(SCIF3_ERI, 253),
108 INTC_IRQ(SCIF3_RXI, 254), INTC_IRQ(SCIF3_TXI, 255),
109};
110
111static struct intc_group groups[] __initdata = {
112 INTC_GROUP(PINT, PINT0, PINT1, PINT2, PINT3,
113 PINT4, PINT5, PINT6, PINT7),
114 INTC_GROUP(DMAC0, DMAC0_DEI, DMAC0_HEI),
115 INTC_GROUP(DMAC1, DMAC1_DEI, DMAC1_HEI),
116 INTC_GROUP(DMAC2, DMAC2_DEI, DMAC2_HEI),
117 INTC_GROUP(DMAC3, DMAC3_DEI, DMAC3_HEI),
118 INTC_GROUP(DMAC4, DMAC4_DEI, DMAC4_HEI),
119 INTC_GROUP(DMAC5, DMAC5_DEI, DMAC5_HEI),
120 INTC_GROUP(DMAC6, DMAC6_DEI, DMAC6_HEI),
121 INTC_GROUP(DMAC7, DMAC7_DEI, DMAC7_HEI),
122 INTC_GROUP(MTU0_ABCD, MTU2_TGI0A, MTU2_TGI0B, MTU2_TGI0C, MTU2_TGI0D),
123 INTC_GROUP(MTU0_VEF, MTU2_TCI0V, MTU2_TGI0E, MTU2_TGI0F),
124 INTC_GROUP(MTU1_AB, MTU2_TGI1A, MTU2_TGI1B),
125 INTC_GROUP(MTU1_VU, MTU2_TCI1V, MTU2_TCI1U),
126 INTC_GROUP(MTU2_AB, MTU2_TGI2A, MTU2_TGI2B),
127 INTC_GROUP(MTU2_VU, MTU2_TCI2V, MTU2_TCI2U),
128 INTC_GROUP(MTU3_ABCD, MTU2_TGI3A, MTU2_TGI3B, MTU2_TGI3C, MTU2_TGI3D),
129 INTC_GROUP(MTU4_ABCD, MTU2_TGI4A, MTU2_TGI4B, MTU2_TGI4C, MTU2_TGI4D),
130 INTC_GROUP(MTU5, MTU2_TGI5U, MTU2_TGI5V, MTU2_TGI5W),
131 INTC_GROUP(POE2_12, POE2_OEI1, POE2_OEI2),
132 INTC_GROUP(MTU3S_ABCD, MTU2S_TGI3A, MTU2S_TGI3B,
133 MTU2S_TGI3C, MTU2S_TGI3D),
134 INTC_GROUP(MTU4S_ABCD, MTU2S_TGI4A, MTU2S_TGI4B,
135 MTU2S_TGI4C, MTU2S_TGI4D),
136 INTC_GROUP(MTU5S, MTU2S_TGI5U, MTU2S_TGI5V, MTU2S_TGI5W),
137 INTC_GROUP(IIC3, IIC3_STPI, IIC3_NAKI, IIC3_RXI, IIC3_TXI, IIC3_TEI),
138 INTC_GROUP(SCIF0, SCIF0_BRI, SCIF0_ERI, SCIF0_RXI, SCIF0_TXI),
139 INTC_GROUP(SCIF1, SCIF1_BRI, SCIF1_ERI, SCIF1_RXI, SCIF1_TXI),
140 INTC_GROUP(SCIF2, SCIF2_BRI, SCIF2_ERI, SCIF2_RXI, SCIF2_TXI),
141 INTC_GROUP(SCIF3, SCIF3_BRI, SCIF3_ERI, SCIF3_RXI, SCIF3_TXI),
142};
143
144static struct intc_prio_reg prio_registers[] __initdata = {
145 { 0xfffe0818, 0, 16, 4, /* IPR01 */ { IRQ0, IRQ1, IRQ2, IRQ3 } },
146 { 0xfffe081a, 0, 16, 4, /* IPR02 */ { IRQ4, IRQ5, IRQ6, IRQ7 } },
147 { 0xfffe0820, 0, 16, 4, /* IPR05 */ { PINT, 0, ADC_ADI0, ADC_ADI1 } },
148 { 0xfffe0c00, 0, 16, 4, /* IPR06 */ { DMAC0, DMAC1, DMAC2, DMAC3 } },
149 { 0xfffe0c02, 0, 16, 4, /* IPR07 */ { DMAC4, DMAC5, DMAC6, DMAC7 } },
150 { 0xfffe0c04, 0, 16, 4, /* IPR08 */ { CMT0, CMT1, BSC, WDT } },
151 { 0xfffe0c06, 0, 16, 4, /* IPR09 */ { MTU0_ABCD, MTU0_VEF,
152 MTU1_AB, MTU1_VU } },
153 { 0xfffe0c08, 0, 16, 4, /* IPR10 */ { MTU2_AB, MTU2_VU,
154 MTU3_ABCD, MTU2_TCI3V } },
155 { 0xfffe0c0a, 0, 16, 4, /* IPR11 */ { MTU4_ABCD, MTU2_TCI4V,
156 MTU5, POE2_12 } },
157 { 0xfffe0c0c, 0, 16, 4, /* IPR12 */ { MTU3S_ABCD, MTU2S_TCI3V,
158 MTU4S_ABCD, MTU2S_TCI4V } },
159 { 0xfffe0c0e, 0, 16, 4, /* IPR13 */ { MTU5S, POE2_OEI3, IIC3, 0 } },
160 { 0xfffe0c10, 0, 16, 4, /* IPR14 */ { SCIF0, SCIF1, SCIF2, SCIF3 } },
161};
162
163static struct intc_mask_reg mask_registers[] __initdata = {
164 { 0xfffe0808, 0, 16, /* PINTER */
165 { 0, 0, 0, 0, 0, 0, 0, 0,
166 PINT7, PINT6, PINT5, PINT4, PINT3, PINT2, PINT1, PINT0 } },
167};
168
169static DECLARE_INTC_DESC(intc_desc, "sh7206", vectors, groups,
170 NULL, mask_registers, prio_registers, NULL);
171
15static struct plat_sci_port sci_platform_data[] = { 172static struct plat_sci_port sci_platform_data[] = {
16 { 173 {
17 .mapbase = 0xfffe8000, 174 .mapbase = 0xfffe8000,
18 .flags = UPF_BOOT_AUTOCONF, 175 .flags = UPF_BOOT_AUTOCONF,
19 .type = PORT_SCIF, 176 .type = PORT_SCIF,
20 .irqs = { 241, 242, 243, 240}, 177 .irqs = { 241, 242, 243, 240 },
21 }, { 178 }, {
22 .mapbase = 0xfffe8800, 179 .mapbase = 0xfffe8800,
23 .flags = UPF_BOOT_AUTOCONF, 180 .flags = UPF_BOOT_AUTOCONF,
24 .type = PORT_SCIF, 181 .type = PORT_SCIF,
25 .irqs = { 247, 244, 245, 246}, 182 .irqs = { 245, 246, 247, 244 },
26 }, { 183 }, {
27 .mapbase = 0xfffe9000, 184 .mapbase = 0xfffe9000,
28 .flags = UPF_BOOT_AUTOCONF, 185 .flags = UPF_BOOT_AUTOCONF,
29 .type = PORT_SCIF, 186 .type = PORT_SCIF,
30 .irqs = { 249, 250, 251, 248}, 187 .irqs = { 249, 250, 251, 248 },
31 }, { 188 }, {
32 .mapbase = 0xfffe9800, 189 .mapbase = 0xfffe9800,
33 .flags = UPF_BOOT_AUTOCONF, 190 .flags = UPF_BOOT_AUTOCONF,
34 .type = PORT_SCIF, 191 .type = PORT_SCIF,
35 .irqs = { 253, 254, 255, 252}, 192 .irqs = { 253, 254, 255, 252 },
36 }, { 193 }, {
37 .flags = 0, 194 .flags = 0,
38 } 195 }
@@ -57,57 +214,7 @@ static int __init sh7206_devices_setup(void)
57} 214}
58__initcall(sh7206_devices_setup); 215__initcall(sh7206_devices_setup);
59 216
60static struct ipr_data ipr_irq_table[] = {
61 { 140, 7, 12, 2 }, /* CMI0 */
62 { 164, 8, 4, 2 }, /* MTU2_TGI1A */
63 { 240, 13, 12, 3 }, /* SCIF0_BRI */
64 { 241, 13, 12, 3 }, /* SCIF0_ERI */
65 { 242, 13, 12, 3 }, /* SCIF0_RXI */
66 { 243, 13, 12, 3 }, /* SCIF0_TXI */
67 { 244, 13, 8, 3 }, /* SCIF1_BRI */
68 { 245, 13, 8, 3 }, /* SCIF1_ERI */
69 { 246, 13, 8, 3 }, /* SCIF1_RXI */
70 { 247, 13, 8, 3 }, /* SCIF1_TXI */
71 { 248, 13, 4, 3 }, /* SCIF2_BRI */
72 { 249, 13, 4, 3 }, /* SCIF2_ERI */
73 { 250, 13, 4, 3 }, /* SCIF2_RXI */
74 { 251, 13, 4, 3 }, /* SCIF2_TXI */
75 { 252, 13, 0, 3 }, /* SCIF3_BRI */
76 { 253, 13, 0, 3 }, /* SCIF3_ERI */
77 { 254, 13, 0, 3 }, /* SCIF3_RXI */
78 { 255, 13, 0, 3 }, /* SCIF3_TXI */
79};
80
81static unsigned long ipr_offsets[] = {
82 0xfffe0818, /* IPR01 */
83 0xfffe081a, /* IPR02 */
84 0, /* unused */
85 0, /* unused */
86 0xfffe0820, /* IPR05 */
87 0xfffe0c00, /* IPR06 */
88 0xfffe0c02, /* IPR07 */
89 0xfffe0c04, /* IPR08 */
90 0xfffe0c06, /* IPR09 */
91 0xfffe0c08, /* IPR10 */
92 0xfffe0c0a, /* IPR11 */
93 0xfffe0c0c, /* IPR12 */
94 0xfffe0c0e, /* IPR13 */
95 0xfffe0c10, /* IPR14 */
96};
97
98static struct ipr_desc ipr_irq_desc = {
99 .ipr_offsets = ipr_offsets,
100 .nr_offsets = ARRAY_SIZE(ipr_offsets),
101
102 .ipr_data = ipr_irq_table,
103 .nr_irqs = ARRAY_SIZE(ipr_irq_table),
104
105 .chip = {
106 .name = "IPR-sh7206",
107 },
108};
109
110void __init plat_irq_setup(void) 217void __init plat_irq_setup(void)
111{ 218{
112 register_ipr_controller(&ipr_irq_desc); 219 register_intc_controller(&intc_desc);
113} 220}
diff --git a/arch/sh/kernel/cpu/sh3/Makefile b/arch/sh/kernel/cpu/sh3/Makefile
index 55b750763f66..646eb6933614 100644
--- a/arch/sh/kernel/cpu/sh3/Makefile
+++ b/arch/sh/kernel/cpu/sh3/Makefile
@@ -6,12 +6,13 @@ obj-y := ex.o probe.o entry.o
6 6
7# CPU subtype setup 7# CPU subtype setup
8obj-$(CONFIG_CPU_SUBTYPE_SH7705) += setup-sh7705.o 8obj-$(CONFIG_CPU_SUBTYPE_SH7705) += setup-sh7705.o
9obj-$(CONFIG_CPU_SUBTYPE_SH7706) += setup-sh7709.o 9obj-$(CONFIG_CPU_SUBTYPE_SH7706) += setup-sh770x.o
10obj-$(CONFIG_CPU_SUBTYPE_SH7707) += setup-sh7709.o 10obj-$(CONFIG_CPU_SUBTYPE_SH7707) += setup-sh770x.o
11obj-$(CONFIG_CPU_SUBTYPE_SH7708) += setup-sh7708.o 11obj-$(CONFIG_CPU_SUBTYPE_SH7708) += setup-sh770x.o
12obj-$(CONFIG_CPU_SUBTYPE_SH7709) += setup-sh7709.o 12obj-$(CONFIG_CPU_SUBTYPE_SH7709) += setup-sh770x.o
13obj-$(CONFIG_CPU_SUBTYPE_SH7710) += setup-sh7710.o 13obj-$(CONFIG_CPU_SUBTYPE_SH7710) += setup-sh7710.o
14obj-$(CONFIG_CPU_SUBTYPE_SH7712) += setup-sh7710.o 14obj-$(CONFIG_CPU_SUBTYPE_SH7712) += setup-sh7710.o
15obj-$(CONFIG_CPU_SUBTYPE_SH7720) += setup-sh7720.o
15 16
16# Primary on-chip clocks (common) 17# Primary on-chip clocks (common)
17clock-$(CONFIG_CPU_SH3) := clock-sh3.o 18clock-$(CONFIG_CPU_SH3) := clock-sh3.o
@@ -19,5 +20,6 @@ clock-$(CONFIG_CPU_SUBTYPE_SH7705) := clock-sh7705.o
19clock-$(CONFIG_CPU_SUBTYPE_SH7706) := clock-sh7706.o 20clock-$(CONFIG_CPU_SUBTYPE_SH7706) := clock-sh7706.o
20clock-$(CONFIG_CPU_SUBTYPE_SH7709) := clock-sh7709.o 21clock-$(CONFIG_CPU_SUBTYPE_SH7709) := clock-sh7709.o
21clock-$(CONFIG_CPU_SUBTYPE_SH7710) := clock-sh7710.o 22clock-$(CONFIG_CPU_SUBTYPE_SH7710) := clock-sh7710.o
23clock-$(CONFIG_CPU_SUBTYPE_SH7720) := clock-sh7710.o
22 24
23obj-y += $(clock-y) 25obj-y += $(clock-y)
diff --git a/arch/sh/kernel/cpu/sh3/probe.c b/arch/sh/kernel/cpu/sh3/probe.c
index 647623b22edc..bf579e061e09 100644
--- a/arch/sh/kernel/cpu/sh3/probe.c
+++ b/arch/sh/kernel/cpu/sh3/probe.c
@@ -50,44 +50,47 @@ int __init detect_cpu_and_cache_system(void)
50 50
51 back_to_P1(); 51 back_to_P1();
52 52
53 current_cpu_data.dcache.ways = 4; 53 boot_cpu_data.dcache.ways = 4;
54 current_cpu_data.dcache.entry_shift = 4; 54 boot_cpu_data.dcache.entry_shift = 4;
55 current_cpu_data.dcache.linesz = L1_CACHE_BYTES; 55 boot_cpu_data.dcache.linesz = L1_CACHE_BYTES;
56 current_cpu_data.dcache.flags = 0; 56 boot_cpu_data.dcache.flags = 0;
57 57
58 /* 58 /*
59 * 7709A/7729 has 16K cache (256-entry), while 7702 has only 59 * 7709A/7729 has 16K cache (256-entry), while 7702 has only
60 * 2K(direct) 7702 is not supported (yet) 60 * 2K(direct) 7702 is not supported (yet)
61 */ 61 */
62 if (data0 == data1 && data2 == data3) { /* Shadow */ 62 if (data0 == data1 && data2 == data3) { /* Shadow */
63 current_cpu_data.dcache.way_incr = (1 << 11); 63 boot_cpu_data.dcache.way_incr = (1 << 11);
64 current_cpu_data.dcache.entry_mask = 0x7f0; 64 boot_cpu_data.dcache.entry_mask = 0x7f0;
65 current_cpu_data.dcache.sets = 128; 65 boot_cpu_data.dcache.sets = 128;
66 current_cpu_data.type = CPU_SH7708; 66 boot_cpu_data.type = CPU_SH7708;
67 67
68 current_cpu_data.flags |= CPU_HAS_MMU_PAGE_ASSOC; 68 boot_cpu_data.flags |= CPU_HAS_MMU_PAGE_ASSOC;
69 } else { /* 7709A or 7729 */ 69 } else { /* 7709A or 7729 */
70 current_cpu_data.dcache.way_incr = (1 << 12); 70 boot_cpu_data.dcache.way_incr = (1 << 12);
71 current_cpu_data.dcache.entry_mask = 0xff0; 71 boot_cpu_data.dcache.entry_mask = 0xff0;
72 current_cpu_data.dcache.sets = 256; 72 boot_cpu_data.dcache.sets = 256;
73 current_cpu_data.type = CPU_SH7729; 73 boot_cpu_data.type = CPU_SH7729;
74 74
75#if defined(CONFIG_CPU_SUBTYPE_SH7706) 75#if defined(CONFIG_CPU_SUBTYPE_SH7706)
76 current_cpu_data.type = CPU_SH7706; 76 boot_cpu_data.type = CPU_SH7706;
77#endif 77#endif
78#if defined(CONFIG_CPU_SUBTYPE_SH7710) 78#if defined(CONFIG_CPU_SUBTYPE_SH7710)
79 current_cpu_data.type = CPU_SH7710; 79 boot_cpu_data.type = CPU_SH7710;
80#endif 80#endif
81#if defined(CONFIG_CPU_SUBTYPE_SH7712) 81#if defined(CONFIG_CPU_SUBTYPE_SH7712)
82 current_cpu_data.type = CPU_SH7712; 82 boot_cpu_data.type = CPU_SH7712;
83#endif
84#if defined(CONFIG_CPU_SUBTYPE_SH7720)
85 boot_cpu_data.type = CPU_SH7720;
83#endif 86#endif
84#if defined(CONFIG_CPU_SUBTYPE_SH7705) 87#if defined(CONFIG_CPU_SUBTYPE_SH7705)
85 current_cpu_data.type = CPU_SH7705; 88 boot_cpu_data.type = CPU_SH7705;
86 89
87#if defined(CONFIG_SH7705_CACHE_32KB) 90#if defined(CONFIG_SH7705_CACHE_32KB)
88 current_cpu_data.dcache.way_incr = (1 << 13); 91 boot_cpu_data.dcache.way_incr = (1 << 13);
89 current_cpu_data.dcache.entry_mask = 0x1ff0; 92 boot_cpu_data.dcache.entry_mask = 0x1ff0;
90 current_cpu_data.dcache.sets = 512; 93 boot_cpu_data.dcache.sets = 512;
91 ctrl_outl(CCR_CACHE_32KB, CCR3); 94 ctrl_outl(CCR_CACHE_32KB, CCR3);
92#else 95#else
93 ctrl_outl(CCR_CACHE_16KB, CCR3); 96 ctrl_outl(CCR_CACHE_16KB, CCR3);
@@ -98,9 +101,8 @@ int __init detect_cpu_and_cache_system(void)
98 /* 101 /*
99 * SH-3 doesn't have separate caches 102 * SH-3 doesn't have separate caches
100 */ 103 */
101 current_cpu_data.dcache.flags |= SH_CACHE_COMBINED; 104 boot_cpu_data.dcache.flags |= SH_CACHE_COMBINED;
102 current_cpu_data.icache = current_cpu_data.dcache; 105 boot_cpu_data.icache = boot_cpu_data.dcache;
103 106
104 return 0; 107 return 0;
105} 108}
106
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7705.c b/arch/sh/kernel/cpu/sh3/setup-sh7705.c
index ebd9d06d8bdd..f6c65f2659e9 100644
--- a/arch/sh/kernel/cpu/sh3/setup-sh7705.c
+++ b/arch/sh/kernel/cpu/sh3/setup-sh7705.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * SH7705 Setup 2 * SH7705 Setup
3 * 3 *
4 * Copyright (C) 2006 Paul Mundt 4 * Copyright (C) 2006, 2007 Paul Mundt
5 * Copyright (C) 2007 Nobuhiro Iwamatsu 5 * Copyright (C) 2007 Nobuhiro Iwamatsu
6 * 6 *
7 * This file is subject to the terms and conditions of the GNU General Public 7 * This file is subject to the terms and conditions of the GNU General Public
@@ -10,8 +10,90 @@
10 */ 10 */
11#include <linux/platform_device.h> 11#include <linux/platform_device.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/irq.h>
13#include <linux/serial.h> 14#include <linux/serial.h>
14#include <asm/sci.h> 15#include <asm/sci.h>
16#include <asm/rtc.h>
17
18enum {
19 UNUSED = 0,
20
21 /* interrupt sources */
22 IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5,
23 PINT07, PINT815,
24 DMAC_DEI0, DMAC_DEI1, DMAC_DEI2, DMAC_DEI3,
25 SCIF0_ERI, SCIF0_RXI, SCIF0_TXI,
26 SCIF2_ERI, SCIF2_RXI, SCIF2_TXI,
27 ADC_ADI,
28 USB_USI0, USB_USI1,
29 TPU0, TPU1, TPU2, TPU3,
30 TMU0, TMU1, TMU2_TUNI, TMU2_TICPI,
31 RTC_ATI, RTC_PRI, RTC_CUI,
32 WDT,
33 REF_RCMI,
34
35 /* interrupt groups */
36 RTC, TMU2, DMAC, USB, SCIF2, SCIF0,
37};
38
39static struct intc_vect vectors[] __initdata = {
40 INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0),
41 INTC_VECT(PINT07, 0x700), INTC_VECT(PINT815, 0x720),
42 INTC_VECT(DMAC_DEI0, 0x800), INTC_VECT(DMAC_DEI1, 0x820),
43 INTC_VECT(DMAC_DEI2, 0x840), INTC_VECT(DMAC_DEI3, 0x860),
44 INTC_VECT(SCIF0_ERI, 0x880), INTC_VECT(SCIF0_RXI, 0x8a0),
45 INTC_VECT(SCIF0_TXI, 0x8e0),
46 INTC_VECT(SCIF2_ERI, 0x900), INTC_VECT(SCIF2_RXI, 0x920),
47 INTC_VECT(SCIF2_TXI, 0x960),
48 INTC_VECT(ADC_ADI, 0x980),
49 INTC_VECT(USB_USI0, 0xa20), INTC_VECT(USB_USI1, 0xa40),
50 INTC_VECT(TPU0, 0xc00), INTC_VECT(TPU1, 0xc20),
51 INTC_VECT(TPU3, 0xc80), INTC_VECT(TPU1, 0xca0),
52 INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
53 INTC_VECT(TMU2_TUNI, 0x440), INTC_VECT(TMU2_TICPI, 0x460),
54 INTC_VECT(RTC_ATI, 0x480), INTC_VECT(RTC_PRI, 0x4a0),
55 INTC_VECT(RTC_CUI, 0x4c0),
56 INTC_VECT(WDT, 0x560),
57 INTC_VECT(REF_RCMI, 0x580),
58};
59
60static struct intc_group groups[] __initdata = {
61 INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI),
62 INTC_GROUP(TMU2, TMU2_TUNI, TMU2_TICPI),
63 INTC_GROUP(DMAC, DMAC_DEI0, DMAC_DEI1, DMAC_DEI2, DMAC_DEI3),
64 INTC_GROUP(USB, USB_USI0, USB_USI1),
65 INTC_GROUP(SCIF0, SCIF0_ERI, SCIF0_RXI, SCIF0_TXI),
66 INTC_GROUP(SCIF2, SCIF2_ERI, SCIF2_RXI, SCIF2_TXI),
67};
68
69static struct intc_prio priorities[] __initdata = {
70 INTC_PRIO(DMAC, 7),
71 INTC_PRIO(SCIF2, 3),
72 INTC_PRIO(SCIF0, 3),
73};
74
75static struct intc_prio_reg prio_registers[] __initdata = {
76 { 0xfffffee2, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, RTC } },
77 { 0xfffffee4, 0, 16, 4, /* IPRB */ { WDT, REF_RCMI, 0, 0 } },
78 { 0xa4000016, 0, 16, 4, /* IPRC */ { IRQ3, IRQ2, IRQ1, IRQ0 } },
79 { 0xa4000018, 0, 16, 4, /* IPRD */ { PINT07, PINT815, IRQ5, IRQ4 } },
80 { 0xa400001a, 0, 16, 4, /* IPRE */ { DMAC, SCIF0, SCIF2, ADC_ADI } },
81 { 0xa4080000, 0, 16, 4, /* IPRF */ { 0, 0, USB } },
82 { 0xa4080002, 0, 16, 4, /* IPRG */ { TPU0, TPU1 } },
83 { 0xa4080004, 0, 16, 4, /* IPRH */ { TPU2, TPU3 } },
84
85};
86
87static DECLARE_INTC_DESC(intc_desc, "sh7705", vectors, groups,
88 priorities, NULL, prio_registers, NULL);
89
90static struct intc_vect vectors_irq[] __initdata = {
91 INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620),
92 INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660),
93};
94
95static DECLARE_INTC_DESC(intc_desc_irq, "sh7705-irq", vectors_irq, NULL,
96 priorities, NULL, prio_registers, NULL);
15 97
16static struct plat_sci_port sci_platform_data[] = { 98static struct plat_sci_port sci_platform_data[] = {
17 { 99 {
@@ -37,8 +119,43 @@ static struct platform_device sci_device = {
37 }, 119 },
38}; 120};
39 121
122static struct resource rtc_resources[] = {
123 [0] = {
124 .start = 0xfffffec0,
125 .end = 0xfffffec0 + 0x1e,
126 .flags = IORESOURCE_IO,
127 },
128 [1] = {
129 .start = 20,
130 .flags = IORESOURCE_IRQ,
131 },
132 [2] = {
133 .start = 21,
134 .flags = IORESOURCE_IRQ,
135 },
136 [3] = {
137 .start = 22,
138 .flags = IORESOURCE_IRQ,
139 },
140};
141
142static struct sh_rtc_platform_info rtc_info = {
143 .capabilities = RTC_CAP_4_DIGIT_YEAR,
144};
145
146static struct platform_device rtc_device = {
147 .name = "sh-rtc",
148 .id = -1,
149 .num_resources = ARRAY_SIZE(rtc_resources),
150 .resource = rtc_resources,
151 .dev = {
152 .platform_data = &rtc_info,
153 },
154};
155
40static struct platform_device *sh7705_devices[] __initdata = { 156static struct platform_device *sh7705_devices[] __initdata = {
41 &sci_device, 157 &sci_device,
158 &rtc_device,
42}; 159};
43 160
44static int __init sh7705_devices_setup(void) 161static int __init sh7705_devices_setup(void)
@@ -48,51 +165,16 @@ static int __init sh7705_devices_setup(void)
48} 165}
49__initcall(sh7705_devices_setup); 166__initcall(sh7705_devices_setup);
50 167
51static struct ipr_data ipr_irq_table[] = { 168void __init plat_irq_setup_pins(int mode)
52 /* IRQ, IPR-idx, shift, priority */ 169{
53 { 16, 0, 12, 2 }, /* TMU0 TUNI*/ 170 if (mode == IRQ_MODE_IRQ) {
54 { 17, 0, 8, 2 }, /* TMU1 TUNI */ 171 register_intc_controller(&intc_desc_irq);
55 { 18, 0, 4, 2 }, /* TMU2 TUNI */ 172 return;
56 { 27, 1, 12, 2 }, /* WDT ITI */ 173 }
57 { 20, 0, 0, 2 }, /* RTC ATI (alarm) */ 174 BUG();
58 { 21, 0, 0, 2 }, /* RTC PRI (period) */ 175}
59 { 22, 0, 0, 2 }, /* RTC CUI (carry) */
60 { 48, 4, 12, 7 }, /* DMAC DMTE0 */
61 { 49, 4, 12, 7 }, /* DMAC DMTE1 */
62 { 50, 4, 12, 7 }, /* DMAC DMTE2 */
63 { 51, 4, 12, 7 }, /* DMAC DMTE3 */
64 { 52, 4, 8, 3 }, /* SCIF0 ERI */
65 { 53, 4, 8, 3 }, /* SCIF0 RXI */
66 { 55, 4, 8, 3 }, /* SCIF0 TXI */
67 { 56, 4, 4, 3 }, /* SCIF1 ERI */
68 { 57, 4, 4, 3 }, /* SCIF1 RXI */
69 { 59, 4, 4, 3 }, /* SCIF1 TXI */
70};
71
72static unsigned long ipr_offsets[] = {
73 0xFFFFFEE2, /* 0: IPRA */
74 0xFFFFFEE4, /* 1: IPRB */
75 0xA4000016, /* 2: IPRC */
76 0xA4000018, /* 3: IPRD */
77 0xA400001A, /* 4: IPRE */
78 0xA4080000, /* 5: IPRF */
79 0xA4080002, /* 6: IPRG */
80 0xA4080004, /* 7: IPRH */
81};
82
83static struct ipr_desc ipr_irq_desc = {
84 .ipr_offsets = ipr_offsets,
85 .nr_offsets = ARRAY_SIZE(ipr_offsets),
86
87 .ipr_data = ipr_irq_table,
88 .nr_irqs = ARRAY_SIZE(ipr_irq_table),
89
90 .chip = {
91 .name = "IPR-sh7705",
92 },
93};
94 176
95void __init plat_irq_setup(void) 177void __init plat_irq_setup(void)
96{ 178{
97 register_ipr_controller(&ipr_irq_desc); 179 register_intc_controller(&intc_desc);
98} 180}
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7708.c b/arch/sh/kernel/cpu/sh3/setup-sh7708.c
deleted file mode 100644
index f933723911ca..000000000000
--- a/arch/sh/kernel/cpu/sh3/setup-sh7708.c
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * SH7708 Setup
3 *
4 * Copyright (C) 2006 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/platform_device.h>
11#include <linux/init.h>
12#include <linux/serial.h>
13#include <asm/sci.h>
14
15static struct plat_sci_port sci_platform_data[] = {
16 {
17 .mapbase = 0xfffffe80,
18 .flags = UPF_BOOT_AUTOCONF,
19 .type = PORT_SCI,
20 .irqs = { 23, 24, 25, 0 },
21 }, {
22 .flags = 0,
23 }
24};
25
26static struct platform_device sci_device = {
27 .name = "sh-sci",
28 .id = -1,
29 .dev = {
30 .platform_data = sci_platform_data,
31 },
32};
33
34static struct platform_device *sh7708_devices[] __initdata = {
35 &sci_device,
36};
37
38static int __init sh7708_devices_setup(void)
39{
40 return platform_add_devices(sh7708_devices,
41 ARRAY_SIZE(sh7708_devices));
42}
43__initcall(sh7708_devices_setup);
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7709.c b/arch/sh/kernel/cpu/sh3/setup-sh7709.c
deleted file mode 100644
index 086f8e2545af..000000000000
--- a/arch/sh/kernel/cpu/sh3/setup-sh7709.c
+++ /dev/null
@@ -1,145 +0,0 @@
1/*
2 * SH7707/SH7709 Setup
3 *
4 * Copyright (C) 2006 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/platform_device.h>
11#include <linux/init.h>
12#include <linux/serial.h>
13#include <asm/sci.h>
14
15static struct resource rtc_resources[] = {
16 [0] = {
17 .start = 0xfffffec0,
18 .end = 0xfffffec0 + 0x1e,
19 .flags = IORESOURCE_IO,
20 },
21 [1] = {
22 .start = 20,
23 .flags = IORESOURCE_IRQ,
24 },
25 [2] = {
26 .start = 21,
27 .flags = IORESOURCE_IRQ,
28 },
29 [3] = {
30 .start = 22,
31 .flags = IORESOURCE_IRQ,
32 },
33};
34
35static struct plat_sci_port sci_platform_data[] = {
36 {
37 .mapbase = 0xfffffe80,
38 .flags = UPF_BOOT_AUTOCONF,
39 .type = PORT_SCI,
40 .irqs = { 23, 24, 25, 0 },
41 }, {
42 .mapbase = 0xa4000150,
43 .flags = UPF_BOOT_AUTOCONF,
44 .type = PORT_SCIF,
45 .irqs = { 56, 57, 59, 58 },
46 }, {
47 .mapbase = 0xa4000140,
48 .flags = UPF_BOOT_AUTOCONF,
49 .type = PORT_IRDA,
50 .irqs = { 52, 53, 55, 54 },
51 }, {
52 .flags = 0,
53 }
54};
55
56static struct platform_device sci_device = {
57 .name = "sh-sci",
58 .id = -1,
59 .dev = {
60 .platform_data = sci_platform_data,
61 },
62};
63
64static struct platform_device rtc_device = {
65 .name = "sh-rtc",
66 .id = -1,
67 .num_resources = ARRAY_SIZE(rtc_resources),
68 .resource = rtc_resources,
69};
70
71static struct platform_device *sh7709_devices[] __initdata = {
72 &sci_device,
73 &rtc_device,
74};
75
76static int __init sh7709_devices_setup(void)
77{
78 return platform_add_devices(sh7709_devices,
79 ARRAY_SIZE(sh7709_devices));
80}
81__initcall(sh7709_devices_setup);
82
83static struct ipr_data ipr_irq_table[] = {
84 { 16, 0, 12, 2 }, /* TMU TUNI0 */
85 { 17, 0, 8, 4 }, /* TMU TUNI1 */
86 { 18, 0, 4, 1 }, /* TMU TUNI1 */
87 { 19, 0, 4, 1 }, /* TMU TUNI1 */
88 { 20, 0, 0, 2 }, /* RTC CUI */
89 { 21, 0, 0, 2 }, /* RTC CUI */
90 { 22, 0, 0, 2 }, /* RTC CUI */
91
92 { 23, 1, 4, 3 }, /* SCI */
93 { 24, 1, 4, 3 }, /* SCI */
94 { 25, 1, 4, 3 }, /* SCI */
95 { 26, 1, 4, 3 }, /* SCI */
96 { 27, 1, 12, 3 }, /* WDT ITI */
97
98 { 32, 2, 0, 1 }, /* IRQ 0 */
99 { 33, 2, 4, 1 }, /* IRQ 1 */
100 { 34, 2, 8, 1 }, /* IRQ 2 APM */
101 { 35, 2, 12, 1 }, /* IRQ 3 TOUCHSCREEN */
102
103 { 36, 3, 0, 1 }, /* IRQ 4 */
104 { 37, 3, 4, 1 }, /* IRQ 5 */
105
106 { 48, 4, 12, 7 }, /* DMA */
107 { 49, 4, 12, 7 }, /* DMA */
108 { 50, 4, 12, 7 }, /* DMA */
109 { 51, 4, 12, 7 }, /* DMA */
110
111 { 52, 4, 8, 3 }, /* IRDA */
112 { 53, 4, 8, 3 }, /* IRDA */
113 { 54, 4, 8, 3 }, /* IRDA */
114 { 55, 4, 8, 3 }, /* IRDA */
115
116 { 56, 4, 4, 3 }, /* SCIF */
117 { 57, 4, 4, 3 }, /* SCIF */
118 { 58, 4, 4, 3 }, /* SCIF */
119 { 59, 4, 4, 3 }, /* SCIF */
120};
121
122static unsigned long ipr_offsets[] = {
123 0xfffffee2, /* 0: IPRA */
124 0xfffffee4, /* 1: IPRB */
125 0xa4000016, /* 2: IPRC */
126 0xa4000018, /* 3: IPRD */
127 0xa400001a, /* 4: IPRE */
128};
129
130static struct ipr_desc ipr_irq_desc = {
131 .ipr_offsets = ipr_offsets,
132 .nr_offsets = ARRAY_SIZE(ipr_offsets),
133
134 .ipr_data = ipr_irq_table,
135 .nr_irqs = ARRAY_SIZE(ipr_irq_table),
136
137 .chip = {
138 .name = "IPR-sh7709",
139 },
140};
141
142void __init plat_irq_setup(void)
143{
144 register_ipr_controller(&ipr_irq_desc);
145}
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh770x.c b/arch/sh/kernel/cpu/sh3/setup-sh770x.c
new file mode 100644
index 000000000000..60b04b1f9453
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh3/setup-sh770x.c
@@ -0,0 +1,224 @@
1/*
2 * SH3 Setup code for SH7706, SH7707, SH7708, SH7709
3 *
4 * Copyright (C) 2007 Magnus Damm
5 *
6 * Based on setup-sh7709.c
7 *
8 * Copyright (C) 2006 Paul Mundt
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
12 * for more details.
13 */
14#include <linux/init.h>
15#include <linux/io.h>
16#include <linux/irq.h>
17#include <linux/platform_device.h>
18#include <linux/serial.h>
19#include <asm/sci.h>
20
21enum {
22 UNUSED = 0,
23
24 /* interrupt sources */
25 IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5,
26 PINT07, PINT815,
27 DMAC_DEI0, DMAC_DEI1, DMAC_DEI2, DMAC_DEI3,
28 SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI,
29 SCIF2_ERI, SCIF2_RXI, SCIF2_BRI, SCIF2_TXI,
30 SCI_ERI, SCI_RXI, SCI_TXI, SCI_TEI,
31 ADC_ADI,
32 LCDC, PCC0, PCC1,
33 TMU0, TMU1, TMU2_TUNI, TMU2_TICPI,
34 RTC_ATI, RTC_PRI, RTC_CUI,
35 WDT,
36 REF_RCMI, REF_ROVI,
37
38 /* interrupt groups */
39 RTC, REF, TMU2, DMAC, SCI, SCIF2, SCIF0,
40};
41
42static struct intc_vect vectors[] __initdata = {
43 INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
44 INTC_VECT(TMU2_TUNI, 0x440), INTC_VECT(TMU2_TICPI, 0x460),
45 INTC_VECT(RTC_ATI, 0x480), INTC_VECT(RTC_PRI, 0x4a0),
46 INTC_VECT(RTC_CUI, 0x4c0),
47 INTC_VECT(SCI_ERI, 0x4e0), INTC_VECT(SCI_RXI, 0x500),
48 INTC_VECT(SCI_TXI, 0x520), INTC_VECT(SCI_TEI, 0x540),
49 INTC_VECT(WDT, 0x560),
50 INTC_VECT(REF_RCMI, 0x580),
51 INTC_VECT(REF_ROVI, 0x5a0),
52#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
53 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
54 defined(CONFIG_CPU_SUBTYPE_SH7709)
55 INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0),
56 INTC_VECT(DMAC_DEI0, 0x800), INTC_VECT(DMAC_DEI1, 0x820),
57 INTC_VECT(DMAC_DEI2, 0x840), INTC_VECT(DMAC_DEI3, 0x860),
58 INTC_VECT(ADC_ADI, 0x980),
59 INTC_VECT(SCIF2_ERI, 0x900), INTC_VECT(SCIF2_RXI, 0x920),
60 INTC_VECT(SCIF2_BRI, 0x940), INTC_VECT(SCIF2_TXI, 0x960),
61#endif
62#if defined(CONFIG_CPU_SUBTYPE_SH7707) || \
63 defined(CONFIG_CPU_SUBTYPE_SH7709)
64 INTC_VECT(PINT07, 0x700), INTC_VECT(PINT815, 0x720),
65 INTC_VECT(SCIF0_ERI, 0x880), INTC_VECT(SCIF0_RXI, 0x8a0),
66 INTC_VECT(SCIF0_BRI, 0x8c0), INTC_VECT(SCIF0_TXI, 0x8e0),
67#endif
68#if defined(CONFIG_CPU_SUBTYPE_SH7707)
69 INTC_VECT(LCDC, 0x9a0),
70 INTC_VECT(PCC0, 0x9c0), INTC_VECT(PCC1, 0x9e0),
71#endif
72};
73
74static struct intc_group groups[] __initdata = {
75 INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI),
76 INTC_GROUP(TMU2, TMU2_TUNI, TMU2_TICPI),
77 INTC_GROUP(REF, REF_RCMI, REF_ROVI),
78 INTC_GROUP(DMAC, DMAC_DEI0, DMAC_DEI1, DMAC_DEI2, DMAC_DEI3),
79 INTC_GROUP(SCI, SCI_ERI, SCI_RXI, SCI_TXI, SCI_TEI),
80 INTC_GROUP(SCIF0, SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI),
81 INTC_GROUP(SCIF2, SCIF2_ERI, SCIF2_RXI, SCIF2_BRI, SCIF2_TXI),
82};
83
84static struct intc_prio priorities[] __initdata = {
85 INTC_PRIO(DMAC, 7),
86 INTC_PRIO(SCI, 3),
87 INTC_PRIO(SCIF2, 3),
88 INTC_PRIO(SCIF0, 3),
89};
90
91static struct intc_prio_reg prio_registers[] __initdata = {
92 { 0xfffffee2, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, RTC } },
93 { 0xfffffee4, 0, 16, 4, /* IPRB */ { WDT, REF, SCI, 0 } },
94#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
95 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
96 defined(CONFIG_CPU_SUBTYPE_SH7709)
97 { 0xa4000016, 0, 16, 4, /* IPRC */ { IRQ3, IRQ2, IRQ1, IRQ0 } },
98 { 0xa4000018, 0, 16, 4, /* IPRD */ { 0, 0, IRQ5, IRQ4 } },
99 { 0xa400001a, 0, 16, 4, /* IPRE */ { DMAC, 0, SCIF2, ADC_ADI } },
100#endif
101#if defined(CONFIG_CPU_SUBTYPE_SH7707) || \
102 defined(CONFIG_CPU_SUBTYPE_SH7709)
103 { 0xa4000018, 0, 16, 4, /* IPRD */ { PINT07, PINT815, } },
104 { 0xa400001a, 0, 16, 4, /* IPRE */ { 0, SCIF0 } },
105#endif
106#if defined(CONFIG_CPU_SUBTYPE_SH7707)
107 { 0xa400001c, 0, 16, 4, /* IPRF */ { 0, LCDC, PCC0, PCC1, } },
108#endif
109};
110
111static DECLARE_INTC_DESC(intc_desc, "sh770x", vectors, groups,
112 priorities, NULL, prio_registers, NULL);
113
114#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
115 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
116 defined(CONFIG_CPU_SUBTYPE_SH7709)
117static struct intc_vect vectors_irq[] __initdata = {
118 INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620),
119 INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660),
120};
121
122static DECLARE_INTC_DESC(intc_desc_irq, "sh770x-irq", vectors_irq, NULL,
123 priorities, NULL, prio_registers, NULL);
124#endif
125
126static struct resource rtc_resources[] = {
127 [0] = {
128 .start = 0xfffffec0,
129 .end = 0xfffffec0 + 0x1e,
130 .flags = IORESOURCE_IO,
131 },
132 [1] = {
133 .start = 20,
134 .flags = IORESOURCE_IRQ,
135 },
136 [2] = {
137 .start = 21,
138 .flags = IORESOURCE_IRQ,
139 },
140 [3] = {
141 .start = 22,
142 .flags = IORESOURCE_IRQ,
143 },
144};
145
146static struct platform_device rtc_device = {
147 .name = "sh-rtc",
148 .id = -1,
149 .num_resources = ARRAY_SIZE(rtc_resources),
150 .resource = rtc_resources,
151};
152
153static struct plat_sci_port sci_platform_data[] = {
154 {
155 .mapbase = 0xfffffe80,
156 .flags = UPF_BOOT_AUTOCONF,
157 .type = PORT_SCI,
158 .irqs = { 23, 24, 25, 0 },
159 },
160#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
161 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
162 defined(CONFIG_CPU_SUBTYPE_SH7709)
163 {
164 .mapbase = 0xa4000150,
165 .flags = UPF_BOOT_AUTOCONF,
166 .type = PORT_SCIF,
167 .irqs = { 56, 57, 59, 58 },
168 },
169#endif
170#if defined(CONFIG_CPU_SUBTYPE_SH7707) || \
171 defined(CONFIG_CPU_SUBTYPE_SH7709)
172 {
173 .mapbase = 0xa4000140,
174 .flags = UPF_BOOT_AUTOCONF,
175 .type = PORT_IRDA,
176 .irqs = { 52, 53, 55, 54 },
177 },
178#endif
179 {
180 .flags = 0,
181 }
182};
183
184static struct platform_device sci_device = {
185 .name = "sh-sci",
186 .id = -1,
187 .dev = {
188 .platform_data = sci_platform_data,
189 },
190};
191
192static struct platform_device *sh770x_devices[] __initdata = {
193 &sci_device,
194 &rtc_device,
195};
196
197static int __init sh770x_devices_setup(void)
198{
199 return platform_add_devices(sh770x_devices,
200 ARRAY_SIZE(sh770x_devices));
201}
202__initcall(sh770x_devices_setup);
203
204#define INTC_ICR1 0xa4000010UL
205#define INTC_ICR1_IRQLVL (1<<14)
206
207void __init plat_irq_setup_pins(int mode)
208{
209 if (mode == IRQ_MODE_IRQ) {
210#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
211 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
212 defined(CONFIG_CPU_SUBTYPE_SH7709)
213 ctrl_outw(ctrl_inw(INTC_ICR1) & ~INTC_ICR1_IRQLVL, INTC_ICR1);
214 register_intc_controller(&intc_desc_irq);
215 return;
216#endif
217 }
218 BUG();
219}
220
221void __init plat_irq_setup(void)
222{
223 register_intc_controller(&intc_desc);
224}
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7710.c b/arch/sh/kernel/cpu/sh3/setup-sh7710.c
index 132284893373..84e5629fa841 100644
--- a/arch/sh/kernel/cpu/sh3/setup-sh7710.c
+++ b/arch/sh/kernel/cpu/sh3/setup-sh7710.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * SH7710 Setup 2 * SH3 Setup code for SH7710, SH7712
3 * 3 *
4 * Copyright (C) 2006 Paul Mundt 4 * Copyright (C) 2006, 2007 Paul Mundt
5 * Copyright (C) 2007 Nobuhiro Iwamatsu 5 * Copyright (C) 2007 Nobuhiro Iwamatsu
6 * 6 *
7 * This file is subject to the terms and conditions of the GNU General Public 7 * This file is subject to the terms and conditions of the GNU General Public
@@ -10,8 +10,140 @@
10 */ 10 */
11#include <linux/platform_device.h> 11#include <linux/platform_device.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/irq.h>
13#include <linux/serial.h> 14#include <linux/serial.h>
14#include <asm/sci.h> 15#include <asm/sci.h>
16#include <asm/rtc.h>
17
18enum {
19 UNUSED = 0,
20
21 /* interrupt sources */
22 IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5,
23 DMAC_DEI0, DMAC_DEI1, DMAC_DEI2, DMAC_DEI3,
24 SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI,
25 SCIF1_ERI, SCIF1_RXI, SCIF1_BRI, SCIF1_TXI,
26 DMAC_DEI4, DMAC_DEI5,
27 IPSEC,
28 EDMAC0, EDMAC1, EDMAC2,
29 SIOF0_ERI, SIOF0_TXI, SIOF0_RXI, SIOF0_CCI,
30 SIOF1_ERI, SIOF1_TXI, SIOF1_RXI, SIOF1_CCI,
31 TMU0, TMU1, TMU2,
32 RTC_ATI, RTC_PRI, RTC_CUI,
33 WDT,
34 REF,
35
36 /* interrupt groups */
37 RTC, DMAC1, SCIF0, SCIF1, DMAC2, SIOF0, SIOF1,
38};
39
40static struct intc_vect vectors[] __initdata = {
41 INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0),
42 INTC_VECT(DMAC_DEI0, 0x800), INTC_VECT(DMAC_DEI1, 0x820),
43 INTC_VECT(DMAC_DEI2, 0x840), INTC_VECT(DMAC_DEI3, 0x860),
44 INTC_VECT(SCIF0_ERI, 0x880), INTC_VECT(SCIF0_RXI, 0x8a0),
45 INTC_VECT(SCIF0_BRI, 0x8c0), INTC_VECT(SCIF0_TXI, 0x8e0),
46 INTC_VECT(SCIF1_ERI, 0x900), INTC_VECT(SCIF1_RXI, 0x920),
47 INTC_VECT(SCIF1_BRI, 0x940), INTC_VECT(SCIF1_TXI, 0x960),
48 INTC_VECT(DMAC_DEI4, 0xb80), INTC_VECT(DMAC_DEI5, 0xba0),
49#ifdef CONFIG_CPU_SUBTYPE_SH7710
50 INTC_VECT(IPSEC, 0xbe0),
51#endif
52 INTC_VECT(EDMAC0, 0xc00), INTC_VECT(EDMAC1, 0xc20),
53 INTC_VECT(EDMAC2, 0xc40),
54 INTC_VECT(SIOF0_ERI, 0xe00), INTC_VECT(SIOF0_TXI, 0xe20),
55 INTC_VECT(SIOF0_RXI, 0xe40), INTC_VECT(SIOF0_CCI, 0xe60),
56 INTC_VECT(SIOF1_ERI, 0xe80), INTC_VECT(SIOF1_TXI, 0xea0),
57 INTC_VECT(SIOF1_RXI, 0xec0), INTC_VECT(SIOF1_CCI, 0xee0),
58 INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
59 INTC_VECT(TMU2, 0x440),
60 INTC_VECT(RTC_ATI, 0x480), INTC_VECT(RTC_PRI, 0x4a0),
61 INTC_VECT(RTC_CUI, 0x4c0),
62 INTC_VECT(WDT, 0x560),
63 INTC_VECT(REF, 0x580),
64};
65
66static struct intc_group groups[] __initdata = {
67 INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI),
68 INTC_GROUP(DMAC1, DMAC_DEI0, DMAC_DEI1, DMAC_DEI2, DMAC_DEI3),
69 INTC_GROUP(SCIF0, SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI),
70 INTC_GROUP(SCIF1, SCIF1_ERI, SCIF1_RXI, SCIF1_BRI, SCIF1_TXI),
71 INTC_GROUP(DMAC2, DMAC_DEI4, DMAC_DEI5),
72 INTC_GROUP(SIOF0, SIOF0_ERI, SIOF0_TXI, SIOF0_RXI, SIOF0_CCI),
73 INTC_GROUP(SIOF1, SIOF1_ERI, SIOF1_TXI, SIOF1_RXI, SIOF1_CCI),
74};
75
76static struct intc_prio priorities[] __initdata = {
77 INTC_PRIO(DMAC1, 7),
78 INTC_PRIO(DMAC2, 7),
79 INTC_PRIO(SCIF0, 3),
80 INTC_PRIO(SCIF1, 3),
81 INTC_PRIO(SIOF0, 3),
82 INTC_PRIO(SIOF1, 3),
83 INTC_PRIO(EDMAC0, 5),
84 INTC_PRIO(EDMAC1, 5),
85 INTC_PRIO(EDMAC2, 5),
86};
87
88static struct intc_prio_reg prio_registers[] __initdata = {
89 { 0xfffffee2, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, RTC } },
90 { 0xfffffee4, 0, 16, 4, /* IPRB */ { WDT, REF, 0, 0 } },
91 { 0xa4000016, 0, 16, 4, /* IPRC */ { IRQ3, IRQ2, IRQ1, IRQ0 } },
92 { 0xa4000018, 0, 16, 4, /* IPRD */ { 0, 0, IRQ5, IRQ4 } },
93 { 0xa400001a, 0, 16, 4, /* IPRE */ { DMAC1, SCIF0, SCIF1 } },
94 { 0xa4080000, 0, 16, 4, /* IPRF */ { 0, DMAC2 } },
95#ifdef CONFIG_CPU_SUBTYPE_SH7710
96 { 0xa4080000, 0, 16, 4, /* IPRF */ { IPSEC } },
97#endif
98 { 0xa4080002, 0, 16, 4, /* IPRG */ { EDMAC0, EDMAC1, EDMAC2 } },
99 { 0xa4080004, 0, 16, 4, /* IPRH */ { 0, 0, 0, SIOF0 } },
100 { 0xa4080006, 0, 16, 4, /* IPRI */ { 0, 0, SIOF1 } },
101};
102
103static DECLARE_INTC_DESC(intc_desc, "sh7710", vectors, groups,
104 priorities, NULL, prio_registers, NULL);
105
106static struct intc_vect vectors_irq[] __initdata = {
107 INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620),
108 INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660),
109};
110
111static DECLARE_INTC_DESC(intc_desc_irq, "sh7710-irq", vectors_irq, NULL,
112 priorities, NULL, prio_registers, NULL);
113
114static struct resource rtc_resources[] = {
115 [0] = {
116 .start = 0xa413fec0,
117 .end = 0xa413fec0 + 0x1e,
118 .flags = IORESOURCE_IO,
119 },
120 [1] = {
121 .start = 20,
122 .flags = IORESOURCE_IRQ,
123 },
124 [2] = {
125 .start = 21,
126 .flags = IORESOURCE_IRQ,
127 },
128 [3] = {
129 .start = 22,
130 .flags = IORESOURCE_IRQ,
131 },
132};
133
134static struct sh_rtc_platform_info rtc_info = {
135 .capabilities = RTC_CAP_4_DIGIT_YEAR,
136};
137
138static struct platform_device rtc_device = {
139 .name = "sh-rtc",
140 .id = -1,
141 .num_resources = ARRAY_SIZE(rtc_resources),
142 .resource = rtc_resources,
143 .dev = {
144 .platform_data = &rtc_info,
145 },
146};
15 147
16static struct plat_sci_port sci_platform_data[] = { 148static struct plat_sci_port sci_platform_data[] = {
17 { 149 {
@@ -20,7 +152,7 @@ static struct plat_sci_port sci_platform_data[] = {
20 .type = PORT_SCIF, 152 .type = PORT_SCIF,
21 .irqs = { 52, 53, 55, 54 }, 153 .irqs = { 52, 53, 55, 54 },
22 }, { 154 }, {
23 .mapbase = 0xa4420000, 155 .mapbase = 0xa4410000,
24 .flags = UPF_BOOT_AUTOCONF, 156 .flags = UPF_BOOT_AUTOCONF,
25 .type = PORT_SCIF, 157 .type = PORT_SCIF,
26 .irqs = { 56, 57, 59, 58 }, 158 .irqs = { 56, 57, 59, 58 },
@@ -40,6 +172,7 @@ static struct platform_device sci_device = {
40 172
41static struct platform_device *sh7710_devices[] __initdata = { 173static struct platform_device *sh7710_devices[] __initdata = {
42 &sci_device, 174 &sci_device,
175 &rtc_device,
43}; 176};
44 177
45static int __init sh7710_devices_setup(void) 178static int __init sh7710_devices_setup(void)
@@ -49,59 +182,16 @@ static int __init sh7710_devices_setup(void)
49} 182}
50__initcall(sh7710_devices_setup); 183__initcall(sh7710_devices_setup);
51 184
52static struct ipr_data ipr_irq_table[] = { 185void __init plat_irq_setup_pins(int mode)
53 /* IRQ, IPR-idx, shift, priority */ 186{
54 { 16, 0, 12, 2 }, /* TMU0 TUNI*/ 187 if (mode == IRQ_MODE_IRQ) {
55 { 17, 0, 8, 2 }, /* TMU1 TUNI */ 188 register_intc_controller(&intc_desc_irq);
56 { 18, 0, 4, 2 }, /* TMU2 TUNI */ 189 return;
57 { 27, 1, 12, 2 }, /* WDT ITI */ 190 }
58 { 20, 0, 0, 2 }, /* RTC ATI (alarm) */ 191 BUG();
59 { 21, 0, 0, 2 }, /* RTC PRI (period) */ 192}
60 { 22, 0, 0, 2 }, /* RTC CUI (carry) */
61 { 48, 4, 12, 7 }, /* DMAC DMTE0 */
62 { 49, 4, 12, 7 }, /* DMAC DMTE1 */
63 { 50, 4, 12, 7 }, /* DMAC DMTE2 */
64 { 51, 4, 12, 7 }, /* DMAC DMTE3 */
65 { 52, 4, 8, 3 }, /* SCIF0 ERI */
66 { 53, 4, 8, 3 }, /* SCIF0 RXI */
67 { 54, 4, 8, 3 }, /* SCIF0 BRI */
68 { 55, 4, 8, 3 }, /* SCIF0 TXI */
69 { 56, 4, 4, 3 }, /* SCIF1 ERI */
70 { 57, 4, 4, 3 }, /* SCIF1 RXI */
71 { 58, 4, 4, 3 }, /* SCIF1 BRI */
72 { 59, 4, 4, 3 }, /* SCIF1 TXI */
73 { 76, 5, 8, 7 }, /* DMAC DMTE4 */
74 { 77, 5, 8, 7 }, /* DMAC DMTE5 */
75 { 80, 6, 12, 5 }, /* EDMAC EINT0 */
76 { 81, 6, 8, 5 }, /* EDMAC EINT1 */
77 { 82, 6, 4, 5 }, /* EDMAC EINT2 */
78};
79
80static unsigned long ipr_offsets[] = {
81 0xA414FEE2, /* 0: IPRA */
82 0xA414FEE4, /* 1: IPRB */
83 0xA4140016, /* 2: IPRC */
84 0xA4140018, /* 3: IPRD */
85 0xA414001A, /* 4: IPRE */
86 0xA4080000, /* 5: IPRF */
87 0xA4080002, /* 6: IPRG */
88 0xA4080004, /* 7: IPRH */
89 0xA4080006, /* 8: IPRI */
90};
91
92static struct ipr_desc ipr_irq_desc = {
93 .ipr_offsets = ipr_offsets,
94 .nr_offsets = ARRAY_SIZE(ipr_offsets),
95
96 .ipr_data = ipr_irq_table,
97 .nr_irqs = ARRAY_SIZE(ipr_irq_table),
98
99 .chip = {
100 .name = "IPR-sh7710",
101 },
102};
103 193
104void __init plat_irq_setup(void) 194void __init plat_irq_setup(void)
105{ 195{
106 register_ipr_controller(&ipr_irq_desc); 196 register_intc_controller(&intc_desc);
107} 197}
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7720.c b/arch/sh/kernel/cpu/sh3/setup-sh7720.c
new file mode 100644
index 000000000000..a0929b8a95ae
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh3/setup-sh7720.c
@@ -0,0 +1,210 @@
1/*
2 * SH7720 Setup
3 *
4 * Copyright (C) 2007 Markus Brunner, Mark Jonas
5 *
6 * Based on arch/sh/kernel/cpu/sh4/setup-sh7750.c:
7 *
8 * Copyright (C) 2006 Paul Mundt
9 * Copyright (C) 2006 Jamie Lenehan
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 */
15#include <linux/platform_device.h>
16#include <linux/init.h>
17#include <linux/serial.h>
18#include <linux/io.h>
19#include <asm/sci.h>
20#include <asm/rtc.h>
21
22#define INTC_ICR1 0xA4140010UL
23#define INTC_ICR_IRLM 0x4000
24#define INTC_ICR_IRQ (~INTC_ICR_IRLM)
25
26static struct resource rtc_resources[] = {
27 [0] = {
28 .start = 0xa413fec0,
29 .end = 0xa413fec0 + 0x28 - 1,
30 .flags = IORESOURCE_IO,
31 },
32 [1] = {
33 /* Period IRQ */
34 .start = 21,
35 .flags = IORESOURCE_IRQ,
36 },
37 [2] = {
38 /* Carry IRQ */
39 .start = 22,
40 .flags = IORESOURCE_IRQ,
41 },
42 [3] = {
43 /* Alarm IRQ */
44 .start = 20,
45 .flags = IORESOURCE_IRQ,
46 },
47};
48
49static struct sh_rtc_platform_info rtc_info = {
50 .capabilities = RTC_CAP_4_DIGIT_YEAR,
51};
52
53static struct platform_device rtc_device = {
54 .name = "sh-rtc",
55 .id = -1,
56 .num_resources = ARRAY_SIZE(rtc_resources),
57 .resource = rtc_resources,
58 .dev = {
59 .platform_data = &rtc_info,
60 },
61};
62
63static struct plat_sci_port sci_platform_data[] = {
64 {
65 .mapbase = 0xa4430000,
66 .flags = UPF_BOOT_AUTOCONF,
67 .type = PORT_SCIF,
68 .irqs = { 80, 80, 80, 80 },
69 }, {
70 .mapbase = 0xa4438000,
71 .flags = UPF_BOOT_AUTOCONF,
72 .type = PORT_SCIF,
73 .irqs = { 81, 81, 81, 81 },
74 }, {
75
76 .flags = 0,
77 }
78};
79
80static struct platform_device sci_device = {
81 .name = "sh-sci",
82 .id = -1,
83 .dev = {
84 .platform_data = sci_platform_data,
85 },
86};
87
88static struct platform_device *sh7720_devices[] __initdata = {
89 &rtc_device,
90 &sci_device,
91};
92
93static int __init sh7720_devices_setup(void)
94{
95 return platform_add_devices(sh7720_devices,
96 ARRAY_SIZE(sh7720_devices));
97}
98__initcall(sh7720_devices_setup);
99
100enum {
101 UNUSED = 0,
102
103 /* interrupt sources */
104 TMU0, TMU1, TMU2, RTC_ATI, RTC_PRI, RTC_CUI,
105 WDT, REF_RCMI, SIM_ERI, SIM_RXI, SIM_TXI, SIM_TEND,
106 IRQ0, IRQ1, IRQ2, IRQ3,
107 USBF_SPD, TMU_SUNI, IRQ5, IRQ4,
108 DMAC1_DEI0, DMAC1_DEI1, DMAC1_DEI2, DMAC1_DEI3, LCDC, SSL,
109 ADC, DMAC2_DEI4, DMAC2_DEI5, USBFI0, USBFI1, CMT,
110 SCIF0, SCIF1,
111 PINT07, PINT815, TPU0, TPU1, TPU2, TPU3, IIC,
112 SIOF0, SIOF1, MMCI0, MMCI1, MMCI2, MMCI3, PCC,
113 USBHI, AFEIF,
114 H_UDI,
115 /* interrupt groups */
116 TMU, RTC, SIM, DMAC1, USBFI, DMAC2, USB, TPU, MMC,
117};
118
119static struct intc_vect vectors[] __initdata = {
120 INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
121 INTC_VECT(TMU2, 0x440), INTC_VECT(RTC_ATI, 0x480),
122 INTC_VECT(RTC_PRI, 0x4a0), INTC_VECT(RTC_CUI, 0x4c0),
123 INTC_VECT(SIM_ERI, 0x4e0), INTC_VECT(SIM_RXI, 0x500),
124 INTC_VECT(SIM_TXI, 0x520), INTC_VECT(SIM_TEND, 0x540),
125 INTC_VECT(WDT, 0x560), INTC_VECT(REF_RCMI, 0x580),
126 /* H_UDI cannot be masked */ INTC_VECT(TMU_SUNI, 0x6c0),
127 INTC_VECT(USBF_SPD, 0x6e0), INTC_VECT(DMAC1_DEI0, 0x800),
128 INTC_VECT(DMAC1_DEI1, 0x820), INTC_VECT(DMAC1_DEI2, 0x840),
129 INTC_VECT(DMAC1_DEI3, 0x860), INTC_VECT(LCDC, 0x900),
130 INTC_VECT(SSL, 0x980), INTC_VECT(USBFI0, 0xa20),
131 INTC_VECT(USBFI1, 0xa40), INTC_VECT(USBHI, 0xa60),
132 INTC_VECT(DMAC2_DEI4, 0xb80), INTC_VECT(DMAC2_DEI5, 0xba0),
133 INTC_VECT(ADC, 0xbe0), INTC_VECT(SCIF0, 0xc00),
134 INTC_VECT(SCIF1, 0xc20), INTC_VECT(PINT07, 0xc80),
135 INTC_VECT(PINT815, 0xca0), INTC_VECT(SIOF0, 0xd00),
136 INTC_VECT(SIOF1, 0xd20), INTC_VECT(TPU0, 0xd80),
137 INTC_VECT(TPU1, 0xda0), INTC_VECT(TPU2, 0xdc0),
138 INTC_VECT(TPU3, 0xde0), INTC_VECT(IIC, 0xe00),
139 INTC_VECT(MMCI0, 0xe80), INTC_VECT(MMCI1, 0xea0),
140 INTC_VECT(MMCI2, 0xec0), INTC_VECT(MMCI3, 0xee0),
141 INTC_VECT(CMT, 0xf00), INTC_VECT(PCC, 0xf60),
142 INTC_VECT(AFEIF, 0xfe0),
143};
144
145static struct intc_group groups[] __initdata = {
146 INTC_GROUP(TMU, TMU0, TMU1, TMU2),
147 INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI),
148 INTC_GROUP(SIM, SIM_ERI, SIM_RXI, SIM_TXI, SIM_TEND),
149 INTC_GROUP(DMAC1, DMAC1_DEI0, DMAC1_DEI1, DMAC1_DEI2, DMAC1_DEI3),
150 INTC_GROUP(USBFI, USBFI0, USBFI1),
151 INTC_GROUP(DMAC2, DMAC2_DEI4, DMAC2_DEI5),
152 INTC_GROUP(TPU, TPU0, TPU1, TPU2, TPU3),
153 INTC_GROUP(MMC, MMCI0, MMCI1, MMCI2, MMCI3),
154};
155
156static struct intc_prio priorities[] __initdata = {
157 INTC_PRIO(SCIF0, 2),
158 INTC_PRIO(SCIF1, 2),
159 INTC_PRIO(DMAC1, 1),
160 INTC_PRIO(DMAC2, 1),
161 INTC_PRIO(RTC, 2),
162 INTC_PRIO(TMU, 2),
163 INTC_PRIO(TPU, 2),
164};
165
166static struct intc_prio_reg prio_registers[] __initdata = {
167 { 0xA414FEE2UL, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, RTC } },
168 { 0xA414FEE4UL, 0, 16, 4, /* IPRB */ { WDT, REF_RCMI, SIM, 0 } },
169 { 0xA4140016UL, 0, 16, 4, /* IPRC */ { IRQ3, IRQ2, IRQ1, IRQ0 } },
170 { 0xA4140018UL, 0, 16, 4, /* IPRD */ { USBF_SPD, TMU_SUNI, IRQ5, IRQ4 } },
171 { 0xA414001AUL, 0, 16, 4, /* IPRE */ { DMAC1, 0, LCDC, SSL } },
172 { 0xA4080000UL, 0, 16, 4, /* IPRF */ { ADC, DMAC2, USBFI, CMT } },
173 { 0xA4080002UL, 0, 16, 4, /* IPRG */ { SCIF0, SCIF1, 0, 0 } },
174 { 0xA4080004UL, 0, 16, 4, /* IPRH */ { PINT07, PINT815, TPU, IIC } },
175 { 0xA4080006UL, 0, 16, 4, /* IPRI */ { SIOF0, SIOF1, MMC, PCC } },
176 { 0xA4080008UL, 0, 16, 4, /* IPRJ */ { 0, USBHI, 0, AFEIF } },
177};
178
179static DECLARE_INTC_DESC(intc_desc, "sh7720", vectors, groups,
180 priorities, NULL, prio_registers, NULL);
181
182static struct intc_sense_reg sense_registers[] __initdata = {
183 { INTC_ICR1, 16, 2, { 0, 0, IRQ5, IRQ4, IRQ3, IRQ2, IRQ1, IRQ0 } },
184};
185
186static struct intc_vect vectors_irq[] __initdata = {
187 INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620),
188 INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660),
189 INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0),
190};
191
192static DECLARE_INTC_DESC(intc_irq_desc, "sh7720-irq", vectors_irq,
193 NULL, priorities, NULL, prio_registers, sense_registers);
194
195void __init plat_irq_setup_pins(int mode)
196{
197 switch (mode) {
198 case IRQ_MODE_IRQ:
199 ctrl_outw(ctrl_inw(INTC_ICR1) & INTC_ICR_IRQ, INTC_ICR1);
200 register_intc_controller(&intc_irq_desc);
201 break;
202 default:
203 BUG();
204 }
205}
206
207void __init plat_irq_setup(void)
208{
209 register_intc_controller(&intc_desc);
210}
diff --git a/arch/sh/kernel/cpu/sh4/probe.c b/arch/sh/kernel/cpu/sh4/probe.c
index 98d28fb1ce16..21375d777e99 100644
--- a/arch/sh/kernel/cpu/sh4/probe.c
+++ b/arch/sh/kernel/cpu/sh4/probe.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * CPU Subtype Probing for SH-4. 4 * CPU Subtype Probing for SH-4.
5 * 5 *
6 * Copyright (C) 2001 - 2006 Paul Mundt 6 * Copyright (C) 2001 - 2007 Paul Mundt
7 * Copyright (C) 2003 Richard Curnow 7 * Copyright (C) 2003 Richard Curnow
8 * 8 *
9 * This file is subject to the terms and conditions of the GNU General Public 9 * This file is subject to the terms and conditions of the GNU General Public
@@ -12,7 +12,6 @@
12 */ 12 */
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/smp.h>
16#include <asm/processor.h> 15#include <asm/processor.h>
17#include <asm/cache.h> 16#include <asm/cache.h>
18 17
@@ -36,37 +35,34 @@ int __init detect_cpu_and_cache_system(void)
36 /* 35 /*
37 * Setup some sane SH-4 defaults for the icache 36 * Setup some sane SH-4 defaults for the icache
38 */ 37 */
39 current_cpu_data.icache.way_incr = (1 << 13); 38 boot_cpu_data.icache.way_incr = (1 << 13);
40 current_cpu_data.icache.entry_shift = 5; 39 boot_cpu_data.icache.entry_shift = 5;
41 current_cpu_data.icache.sets = 256; 40 boot_cpu_data.icache.sets = 256;
42 current_cpu_data.icache.ways = 1; 41 boot_cpu_data.icache.ways = 1;
43 current_cpu_data.icache.linesz = L1_CACHE_BYTES; 42 boot_cpu_data.icache.linesz = L1_CACHE_BYTES;
44 43
45 /* 44 /*
46 * And again for the dcache .. 45 * And again for the dcache ..
47 */ 46 */
48 current_cpu_data.dcache.way_incr = (1 << 14); 47 boot_cpu_data.dcache.way_incr = (1 << 14);
49 current_cpu_data.dcache.entry_shift = 5; 48 boot_cpu_data.dcache.entry_shift = 5;
50 current_cpu_data.dcache.sets = 512; 49 boot_cpu_data.dcache.sets = 512;
51 current_cpu_data.dcache.ways = 1; 50 boot_cpu_data.dcache.ways = 1;
52 current_cpu_data.dcache.linesz = L1_CACHE_BYTES; 51 boot_cpu_data.dcache.linesz = L1_CACHE_BYTES;
53 52
54 /* 53 /*
55 * Setup some generic flags we can probe 54 * Setup some generic flags we can probe on SH-4A parts
56 * (L2 and DSP detection only work on SH-4A)
57 */ 55 */
58 if (((pvr >> 16) & 0xff) == 0x10) { 56 if (((pvr >> 16) & 0xff) == 0x10) {
59 if ((cvr & 0x02000000) == 0)
60 current_cpu_data.flags |= CPU_HAS_L2_CACHE;
61 if ((cvr & 0x10000000) == 0) 57 if ((cvr & 0x10000000) == 0)
62 current_cpu_data.flags |= CPU_HAS_DSP; 58 boot_cpu_data.flags |= CPU_HAS_DSP;
63 59
64 current_cpu_data.flags |= CPU_HAS_LLSC; 60 boot_cpu_data.flags |= CPU_HAS_LLSC;
65 } 61 }
66 62
67 /* FPU detection works for everyone */ 63 /* FPU detection works for everyone */
68 if ((cvr & 0x20000000) == 1) 64 if ((cvr & 0x20000000) == 1)
69 current_cpu_data.flags |= CPU_HAS_FPU; 65 boot_cpu_data.flags |= CPU_HAS_FPU;
70 66
71 /* Mask off the upper chip ID */ 67 /* Mask off the upper chip ID */
72 pvr &= 0xffff; 68 pvr &= 0xffff;
@@ -77,140 +73,140 @@ int __init detect_cpu_and_cache_system(void)
77 */ 73 */
78 switch (pvr) { 74 switch (pvr) {
79 case 0x205: 75 case 0x205:
80 current_cpu_data.type = CPU_SH7750; 76 boot_cpu_data.type = CPU_SH7750;
81 current_cpu_data.flags |= CPU_HAS_P2_FLUSH_BUG | CPU_HAS_FPU | 77 boot_cpu_data.flags |= CPU_HAS_P2_FLUSH_BUG | CPU_HAS_FPU |
82 CPU_HAS_PERF_COUNTER; 78 CPU_HAS_PERF_COUNTER;
83 break; 79 break;
84 case 0x206: 80 case 0x206:
85 current_cpu_data.type = CPU_SH7750S; 81 boot_cpu_data.type = CPU_SH7750S;
86 current_cpu_data.flags |= CPU_HAS_P2_FLUSH_BUG | CPU_HAS_FPU | 82 boot_cpu_data.flags |= CPU_HAS_P2_FLUSH_BUG | CPU_HAS_FPU |
87 CPU_HAS_PERF_COUNTER; 83 CPU_HAS_PERF_COUNTER;
88 break; 84 break;
89 case 0x1100: 85 case 0x1100:
90 current_cpu_data.type = CPU_SH7751; 86 boot_cpu_data.type = CPU_SH7751;
91 current_cpu_data.flags |= CPU_HAS_FPU; 87 boot_cpu_data.flags |= CPU_HAS_FPU;
92 break; 88 break;
93 case 0x2001: 89 case 0x2001:
94 case 0x2004: 90 case 0x2004:
95 current_cpu_data.type = CPU_SH7770; 91 boot_cpu_data.type = CPU_SH7770;
96 current_cpu_data.icache.ways = 4; 92 boot_cpu_data.icache.ways = 4;
97 current_cpu_data.dcache.ways = 4; 93 boot_cpu_data.dcache.ways = 4;
98 94
99 current_cpu_data.flags |= CPU_HAS_FPU | CPU_HAS_LLSC; 95 boot_cpu_data.flags |= CPU_HAS_FPU | CPU_HAS_LLSC;
100 break; 96 break;
101 case 0x2006: 97 case 0x2006:
102 case 0x200A: 98 case 0x200A:
103 if (prr == 0x61) 99 if (prr == 0x61)
104 current_cpu_data.type = CPU_SH7781; 100 boot_cpu_data.type = CPU_SH7781;
105 else 101 else
106 current_cpu_data.type = CPU_SH7780; 102 boot_cpu_data.type = CPU_SH7780;
107 103
108 current_cpu_data.icache.ways = 4; 104 boot_cpu_data.icache.ways = 4;
109 current_cpu_data.dcache.ways = 4; 105 boot_cpu_data.dcache.ways = 4;
110 106
111 current_cpu_data.flags |= CPU_HAS_FPU | CPU_HAS_PERF_COUNTER | 107 boot_cpu_data.flags |= CPU_HAS_FPU | CPU_HAS_PERF_COUNTER |
112 CPU_HAS_LLSC; 108 CPU_HAS_LLSC;
113 break; 109 break;
114 case 0x3000: 110 case 0x3000:
115 case 0x3003: 111 case 0x3003:
116 case 0x3009: 112 case 0x3009:
117 current_cpu_data.type = CPU_SH7343; 113 boot_cpu_data.type = CPU_SH7343;
118 current_cpu_data.icache.ways = 4; 114 boot_cpu_data.icache.ways = 4;
119 current_cpu_data.dcache.ways = 4; 115 boot_cpu_data.dcache.ways = 4;
120 current_cpu_data.flags |= CPU_HAS_LLSC; 116 boot_cpu_data.flags |= CPU_HAS_LLSC;
121 break; 117 break;
122 case 0x3004: 118 case 0x3004:
123 case 0x3007: 119 case 0x3007:
124 current_cpu_data.type = CPU_SH7785; 120 boot_cpu_data.type = CPU_SH7785;
125 current_cpu_data.icache.ways = 4; 121 boot_cpu_data.icache.ways = 4;
126 current_cpu_data.dcache.ways = 4; 122 boot_cpu_data.dcache.ways = 4;
127 current_cpu_data.flags |= CPU_HAS_FPU | CPU_HAS_PERF_COUNTER | 123 boot_cpu_data.flags |= CPU_HAS_FPU | CPU_HAS_PERF_COUNTER |
128 CPU_HAS_LLSC; 124 CPU_HAS_LLSC;
129 break; 125 break;
130 case 0x3008: 126 case 0x3008:
131 if (prr == 0xa0) { 127 if (prr == 0xa0) {
132 current_cpu_data.type = CPU_SH7722; 128 boot_cpu_data.type = CPU_SH7722;
133 current_cpu_data.icache.ways = 4; 129 boot_cpu_data.icache.ways = 4;
134 current_cpu_data.dcache.ways = 4; 130 boot_cpu_data.dcache.ways = 4;
135 current_cpu_data.flags |= CPU_HAS_LLSC; 131 boot_cpu_data.flags |= CPU_HAS_LLSC;
136 } 132 }
137 break; 133 break;
138 case 0x4000: /* 1st cut */ 134 case 0x4000: /* 1st cut */
139 case 0x4001: /* 2nd cut */ 135 case 0x4001: /* 2nd cut */
140 current_cpu_data.type = CPU_SHX3; 136 boot_cpu_data.type = CPU_SHX3;
141 current_cpu_data.icache.ways = 4; 137 boot_cpu_data.icache.ways = 4;
142 current_cpu_data.dcache.ways = 4; 138 boot_cpu_data.dcache.ways = 4;
143 current_cpu_data.flags |= CPU_HAS_FPU | CPU_HAS_PERF_COUNTER | 139 boot_cpu_data.flags |= CPU_HAS_FPU | CPU_HAS_PERF_COUNTER |
144 CPU_HAS_LLSC; 140 CPU_HAS_LLSC;
145 break; 141 break;
146 case 0x8000: 142 case 0x8000:
147 current_cpu_data.type = CPU_ST40RA; 143 boot_cpu_data.type = CPU_ST40RA;
148 current_cpu_data.flags |= CPU_HAS_FPU; 144 boot_cpu_data.flags |= CPU_HAS_FPU;
149 break; 145 break;
150 case 0x8100: 146 case 0x8100:
151 current_cpu_data.type = CPU_ST40GX1; 147 boot_cpu_data.type = CPU_ST40GX1;
152 current_cpu_data.flags |= CPU_HAS_FPU; 148 boot_cpu_data.flags |= CPU_HAS_FPU;
153 break; 149 break;
154 case 0x700: 150 case 0x700:
155 current_cpu_data.type = CPU_SH4_501; 151 boot_cpu_data.type = CPU_SH4_501;
156 current_cpu_data.icache.ways = 2; 152 boot_cpu_data.icache.ways = 2;
157 current_cpu_data.dcache.ways = 2; 153 boot_cpu_data.dcache.ways = 2;
158 break; 154 break;
159 case 0x600: 155 case 0x600:
160 current_cpu_data.type = CPU_SH4_202; 156 boot_cpu_data.type = CPU_SH4_202;
161 current_cpu_data.icache.ways = 2; 157 boot_cpu_data.icache.ways = 2;
162 current_cpu_data.dcache.ways = 2; 158 boot_cpu_data.dcache.ways = 2;
163 current_cpu_data.flags |= CPU_HAS_FPU; 159 boot_cpu_data.flags |= CPU_HAS_FPU;
164 break; 160 break;
165 case 0x500 ... 0x501: 161 case 0x500 ... 0x501:
166 switch (prr) { 162 switch (prr) {
167 case 0x10: 163 case 0x10:
168 current_cpu_data.type = CPU_SH7750R; 164 boot_cpu_data.type = CPU_SH7750R;
169 break; 165 break;
170 case 0x11: 166 case 0x11:
171 current_cpu_data.type = CPU_SH7751R; 167 boot_cpu_data.type = CPU_SH7751R;
172 break; 168 break;
173 case 0x50 ... 0x5f: 169 case 0x50 ... 0x5f:
174 current_cpu_data.type = CPU_SH7760; 170 boot_cpu_data.type = CPU_SH7760;
175 break; 171 break;
176 } 172 }
177 173
178 current_cpu_data.icache.ways = 2; 174 boot_cpu_data.icache.ways = 2;
179 current_cpu_data.dcache.ways = 2; 175 boot_cpu_data.dcache.ways = 2;
180 176
181 current_cpu_data.flags |= CPU_HAS_FPU; 177 boot_cpu_data.flags |= CPU_HAS_FPU;
182 178
183 break; 179 break;
184 default: 180 default:
185 current_cpu_data.type = CPU_SH_NONE; 181 boot_cpu_data.type = CPU_SH_NONE;
186 break; 182 break;
187 } 183 }
188 184
189#ifdef CONFIG_SH_DIRECT_MAPPED 185#ifdef CONFIG_SH_DIRECT_MAPPED
190 current_cpu_data.icache.ways = 1; 186 boot_cpu_data.icache.ways = 1;
191 current_cpu_data.dcache.ways = 1; 187 boot_cpu_data.dcache.ways = 1;
192#endif 188#endif
193 189
194#ifdef CONFIG_CPU_HAS_PTEA 190#ifdef CONFIG_CPU_HAS_PTEA
195 current_cpu_data.flags |= CPU_HAS_PTEA; 191 boot_cpu_data.flags |= CPU_HAS_PTEA;
196#endif 192#endif
197 193
198 /* 194 /*
199 * On anything that's not a direct-mapped cache, look to the CVR 195 * On anything that's not a direct-mapped cache, look to the CVR
200 * for I/D-cache specifics. 196 * for I/D-cache specifics.
201 */ 197 */
202 if (current_cpu_data.icache.ways > 1) { 198 if (boot_cpu_data.icache.ways > 1) {
203 size = sizes[(cvr >> 20) & 0xf]; 199 size = sizes[(cvr >> 20) & 0xf];
204 current_cpu_data.icache.way_incr = (size >> 1); 200 boot_cpu_data.icache.way_incr = (size >> 1);
205 current_cpu_data.icache.sets = (size >> 6); 201 boot_cpu_data.icache.sets = (size >> 6);
206 202
207 } 203 }
208 204
209 /* And the rest of the D-cache */ 205 /* And the rest of the D-cache */
210 if (current_cpu_data.dcache.ways > 1) { 206 if (boot_cpu_data.dcache.ways > 1) {
211 size = sizes[(cvr >> 16) & 0xf]; 207 size = sizes[(cvr >> 16) & 0xf];
212 current_cpu_data.dcache.way_incr = (size >> 1); 208 boot_cpu_data.dcache.way_incr = (size >> 1);
213 current_cpu_data.dcache.sets = (size >> 6); 209 boot_cpu_data.dcache.sets = (size >> 6);
214 } 210 }
215 211
216 /* 212 /*
@@ -218,7 +214,7 @@ int __init detect_cpu_and_cache_system(void)
218 * 214 *
219 * SH-4A's have an optional PIPT L2. 215 * SH-4A's have an optional PIPT L2.
220 */ 216 */
221 if (current_cpu_data.flags & CPU_HAS_L2_CACHE) { 217 if (boot_cpu_data.flags & CPU_HAS_L2_CACHE) {
222 /* 218 /*
223 * Size calculation is much more sensible 219 * Size calculation is much more sensible
224 * than it is for the L1. 220 * than it is for the L1.
@@ -229,22 +225,22 @@ int __init detect_cpu_and_cache_system(void)
229 225
230 BUG_ON(!size); 226 BUG_ON(!size);
231 227
232 current_cpu_data.scache.way_incr = (1 << 16); 228 boot_cpu_data.scache.way_incr = (1 << 16);
233 current_cpu_data.scache.entry_shift = 5; 229 boot_cpu_data.scache.entry_shift = 5;
234 current_cpu_data.scache.ways = 4; 230 boot_cpu_data.scache.ways = 4;
235 current_cpu_data.scache.linesz = L1_CACHE_BYTES; 231 boot_cpu_data.scache.linesz = L1_CACHE_BYTES;
236 232
237 current_cpu_data.scache.entry_mask = 233 boot_cpu_data.scache.entry_mask =
238 (current_cpu_data.scache.way_incr - 234 (boot_cpu_data.scache.way_incr -
239 current_cpu_data.scache.linesz); 235 boot_cpu_data.scache.linesz);
240 236
241 current_cpu_data.scache.sets = size / 237 boot_cpu_data.scache.sets = size /
242 (current_cpu_data.scache.linesz * 238 (boot_cpu_data.scache.linesz *
243 current_cpu_data.scache.ways); 239 boot_cpu_data.scache.ways);
244 240
245 current_cpu_data.scache.way_size = 241 boot_cpu_data.scache.way_size =
246 (current_cpu_data.scache.sets * 242 (boot_cpu_data.scache.sets *
247 current_cpu_data.scache.linesz); 243 boot_cpu_data.scache.linesz);
248 } 244 }
249 245
250 return 0; 246 return 0;
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7750.c b/arch/sh/kernel/cpu/sh4/setup-sh7750.c
index f2286de22bd5..523f68a9ce0e 100644
--- a/arch/sh/kernel/cpu/sh4/setup-sh7750.c
+++ b/arch/sh/kernel/cpu/sh4/setup-sh7750.c
@@ -104,7 +104,7 @@ enum {
104 DMAC, PCIC1, TMU2, RTC, SCI1, SCIF, REF, 104 DMAC, PCIC1, TMU2, RTC, SCI1, SCIF, REF,
105}; 105};
106 106
107static struct intc_vect vectors[] = { 107static struct intc_vect vectors[] __initdata = {
108 INTC_VECT(HUDI, 0x600), INTC_VECT(GPIOI, 0x620), 108 INTC_VECT(HUDI, 0x600), INTC_VECT(GPIOI, 0x620),
109 INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420), 109 INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
110 INTC_VECT(TMU2_TUNI, 0x440), INTC_VECT(TMU2_TICPI, 0x460), 110 INTC_VECT(TMU2_TUNI, 0x440), INTC_VECT(TMU2_TICPI, 0x460),
@@ -118,7 +118,7 @@ static struct intc_vect vectors[] = {
118 INTC_VECT(REF_RCMI, 0x580), INTC_VECT(REF_ROVI, 0x5a0), 118 INTC_VECT(REF_RCMI, 0x580), INTC_VECT(REF_ROVI, 0x5a0),
119}; 119};
120 120
121static struct intc_group groups[] = { 121static struct intc_group groups[] __initdata = {
122 INTC_GROUP(TMU2, TMU2_TUNI, TMU2_TICPI), 122 INTC_GROUP(TMU2, TMU2_TUNI, TMU2_TICPI),
123 INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI), 123 INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI),
124 INTC_GROUP(SCI1, SCI1_ERI, SCI1_RXI, SCI1_TXI, SCI1_TEI), 124 INTC_GROUP(SCI1, SCI1_ERI, SCI1_RXI, SCI1_TXI, SCI1_TEI),
@@ -126,20 +126,20 @@ static struct intc_group groups[] = {
126 INTC_GROUP(REF, REF_RCMI, REF_ROVI), 126 INTC_GROUP(REF, REF_RCMI, REF_ROVI),
127}; 127};
128 128
129static struct intc_prio priorities[] = { 129static struct intc_prio priorities[] __initdata = {
130 INTC_PRIO(SCIF, 3), 130 INTC_PRIO(SCIF, 3),
131 INTC_PRIO(SCI1, 3), 131 INTC_PRIO(SCI1, 3),
132 INTC_PRIO(DMAC, 7), 132 INTC_PRIO(DMAC, 7),
133}; 133};
134 134
135static struct intc_prio_reg prio_registers[] = { 135static struct intc_prio_reg prio_registers[] __initdata = {
136 { 0xffd00004, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, RTC } }, 136 { 0xffd00004, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, RTC } },
137 { 0xffd00008, 16, 4, /* IPRB */ { WDT, REF, SCI1, 0 } }, 137 { 0xffd00008, 0, 16, 4, /* IPRB */ { WDT, REF, SCI1, 0 } },
138 { 0xffd0000c, 16, 4, /* IPRC */ { GPIOI, DMAC, SCIF, HUDI } }, 138 { 0xffd0000c, 0, 16, 4, /* IPRC */ { GPIOI, DMAC, SCIF, HUDI } },
139 { 0xffd00010, 16, 4, /* IPRD */ { IRL0, IRL1, IRL2, IRL3 } }, 139 { 0xffd00010, 0, 16, 4, /* IPRD */ { IRL0, IRL1, IRL2, IRL3 } },
140 { 0xfe080000, 32, 4, /* INTPRI00 */ { 0, 0, 0, 0, 140 { 0xfe080000, 0, 32, 4, /* INTPRI00 */ { 0, 0, 0, 0,
141 TMU4, TMU3, 141 TMU4, TMU3,
142 PCIC1, PCIC0_PCISERR } }, 142 PCIC1, PCIC0_PCISERR } },
143}; 143};
144 144
145static DECLARE_INTC_DESC(intc_desc, "sh7750", vectors, groups, 145static DECLARE_INTC_DESC(intc_desc, "sh7750", vectors, groups,
@@ -150,13 +150,13 @@ static DECLARE_INTC_DESC(intc_desc, "sh7750", vectors, groups,
150 defined(CONFIG_CPU_SUBTYPE_SH7750S) || \ 150 defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
151 defined(CONFIG_CPU_SUBTYPE_SH7751) || \ 151 defined(CONFIG_CPU_SUBTYPE_SH7751) || \
152 defined(CONFIG_CPU_SUBTYPE_SH7091) 152 defined(CONFIG_CPU_SUBTYPE_SH7091)
153static struct intc_vect vectors_dma4[] = { 153static struct intc_vect vectors_dma4[] __initdata = {
154 INTC_VECT(DMAC_DMTE0, 0x640), INTC_VECT(DMAC_DMTE1, 0x660), 154 INTC_VECT(DMAC_DMTE0, 0x640), INTC_VECT(DMAC_DMTE1, 0x660),
155 INTC_VECT(DMAC_DMTE2, 0x680), INTC_VECT(DMAC_DMTE3, 0x6a0), 155 INTC_VECT(DMAC_DMTE2, 0x680), INTC_VECT(DMAC_DMTE3, 0x6a0),
156 INTC_VECT(DMAC_DMAE, 0x6c0), 156 INTC_VECT(DMAC_DMAE, 0x6c0),
157}; 157};
158 158
159static struct intc_group groups_dma4[] = { 159static struct intc_group groups_dma4[] __initdata = {
160 INTC_GROUP(DMAC, DMAC_DMTE0, DMAC_DMTE1, DMAC_DMTE2, 160 INTC_GROUP(DMAC, DMAC_DMTE0, DMAC_DMTE1, DMAC_DMTE2,
161 DMAC_DMTE3, DMAC_DMAE), 161 DMAC_DMTE3, DMAC_DMAE),
162}; 162};
@@ -168,7 +168,7 @@ static DECLARE_INTC_DESC(intc_desc_dma4, "sh7750_dma4",
168 168
169/* SH7750R and SH7751R both have 8-channel DMA controllers */ 169/* SH7750R and SH7751R both have 8-channel DMA controllers */
170#if defined(CONFIG_CPU_SUBTYPE_SH7750R) || defined(CONFIG_CPU_SUBTYPE_SH7751R) 170#if defined(CONFIG_CPU_SUBTYPE_SH7750R) || defined(CONFIG_CPU_SUBTYPE_SH7751R)
171static struct intc_vect vectors_dma8[] = { 171static struct intc_vect vectors_dma8[] __initdata = {
172 INTC_VECT(DMAC_DMTE0, 0x640), INTC_VECT(DMAC_DMTE1, 0x660), 172 INTC_VECT(DMAC_DMTE0, 0x640), INTC_VECT(DMAC_DMTE1, 0x660),
173 INTC_VECT(DMAC_DMTE2, 0x680), INTC_VECT(DMAC_DMTE3, 0x6a0), 173 INTC_VECT(DMAC_DMTE2, 0x680), INTC_VECT(DMAC_DMTE3, 0x6a0),
174 INTC_VECT(DMAC_DMTE4, 0x780), INTC_VECT(DMAC_DMTE5, 0x7a0), 174 INTC_VECT(DMAC_DMTE4, 0x780), INTC_VECT(DMAC_DMTE5, 0x7a0),
@@ -176,7 +176,7 @@ static struct intc_vect vectors_dma8[] = {
176 INTC_VECT(DMAC_DMAE, 0x6c0), 176 INTC_VECT(DMAC_DMAE, 0x6c0),
177}; 177};
178 178
179static struct intc_group groups_dma8[] = { 179static struct intc_group groups_dma8[] __initdata = {
180 INTC_GROUP(DMAC, DMAC_DMTE0, DMAC_DMTE1, DMAC_DMTE2, 180 INTC_GROUP(DMAC, DMAC_DMTE0, DMAC_DMTE1, DMAC_DMTE2,
181 DMAC_DMTE3, DMAC_DMTE4, DMAC_DMTE5, 181 DMAC_DMTE3, DMAC_DMTE4, DMAC_DMTE5,
182 DMAC_DMTE6, DMAC_DMTE7, DMAC_DMAE), 182 DMAC_DMTE6, DMAC_DMTE7, DMAC_DMAE),
@@ -191,11 +191,11 @@ static DECLARE_INTC_DESC(intc_desc_dma8, "sh7750_dma8",
191#if defined(CONFIG_CPU_SUBTYPE_SH7750R) || \ 191#if defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
192 defined(CONFIG_CPU_SUBTYPE_SH7751) || \ 192 defined(CONFIG_CPU_SUBTYPE_SH7751) || \
193 defined(CONFIG_CPU_SUBTYPE_SH7751R) 193 defined(CONFIG_CPU_SUBTYPE_SH7751R)
194static struct intc_vect vectors_tmu34[] = { 194static struct intc_vect vectors_tmu34[] __initdata = {
195 INTC_VECT(TMU3, 0xb00), INTC_VECT(TMU4, 0xb80), 195 INTC_VECT(TMU3, 0xb00), INTC_VECT(TMU4, 0xb80),
196}; 196};
197 197
198static struct intc_mask_reg mask_registers[] = { 198static struct intc_mask_reg mask_registers[] __initdata = {
199 { 0xfe080040, 0xfe080060, 32, /* INTMSK00 / INTMSKCLR00 */ 199 { 0xfe080040, 0xfe080060, 32, /* INTMSK00 / INTMSKCLR00 */
200 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 200 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
201 0, 0, 0, 0, 0, 0, TMU4, TMU3, 201 0, 0, 0, 0, 0, 0, TMU4, TMU3,
@@ -210,7 +210,7 @@ static DECLARE_INTC_DESC(intc_desc_tmu34, "sh7750_tmu34",
210#endif 210#endif
211 211
212/* SH7750S, SH7750R, SH7751 and SH7751R all have IRLM priority registers */ 212/* SH7750S, SH7750R, SH7751 and SH7751R all have IRLM priority registers */
213static struct intc_vect vectors_irlm[] = { 213static struct intc_vect vectors_irlm[] __initdata = {
214 INTC_VECT(IRL0, 0x240), INTC_VECT(IRL1, 0x2a0), 214 INTC_VECT(IRL0, 0x240), INTC_VECT(IRL1, 0x2a0),
215 INTC_VECT(IRL2, 0x300), INTC_VECT(IRL3, 0x360), 215 INTC_VECT(IRL2, 0x300), INTC_VECT(IRL3, 0x360),
216}; 216};
@@ -220,14 +220,14 @@ static DECLARE_INTC_DESC(intc_desc_irlm, "sh7750_irlm", vectors_irlm, NULL,
220 220
221/* SH7751 and SH7751R both have PCI */ 221/* SH7751 and SH7751R both have PCI */
222#if defined(CONFIG_CPU_SUBTYPE_SH7751) || defined(CONFIG_CPU_SUBTYPE_SH7751R) 222#if defined(CONFIG_CPU_SUBTYPE_SH7751) || defined(CONFIG_CPU_SUBTYPE_SH7751R)
223static struct intc_vect vectors_pci[] = { 223static struct intc_vect vectors_pci[] __initdata = {
224 INTC_VECT(PCIC0_PCISERR, 0xa00), INTC_VECT(PCIC1_PCIERR, 0xae0), 224 INTC_VECT(PCIC0_PCISERR, 0xa00), INTC_VECT(PCIC1_PCIERR, 0xae0),
225 INTC_VECT(PCIC1_PCIPWDWN, 0xac0), INTC_VECT(PCIC1_PCIPWON, 0xaa0), 225 INTC_VECT(PCIC1_PCIPWDWN, 0xac0), INTC_VECT(PCIC1_PCIPWON, 0xaa0),
226 INTC_VECT(PCIC1_PCIDMA0, 0xa80), INTC_VECT(PCIC1_PCIDMA1, 0xa60), 226 INTC_VECT(PCIC1_PCIDMA0, 0xa80), INTC_VECT(PCIC1_PCIDMA1, 0xa60),
227 INTC_VECT(PCIC1_PCIDMA2, 0xa40), INTC_VECT(PCIC1_PCIDMA3, 0xa20), 227 INTC_VECT(PCIC1_PCIDMA2, 0xa40), INTC_VECT(PCIC1_PCIDMA3, 0xa20),
228}; 228};
229 229
230static struct intc_group groups_pci[] = { 230static struct intc_group groups_pci[] __initdata = {
231 INTC_GROUP(PCIC1, PCIC1_PCIERR, PCIC1_PCIPWDWN, PCIC1_PCIPWON, 231 INTC_GROUP(PCIC1, PCIC1_PCIERR, PCIC1_PCIPWDWN, PCIC1_PCIPWON,
232 PCIC1_PCIDMA0, PCIC1_PCIDMA1, PCIC1_PCIDMA2, PCIC1_PCIDMA3), 232 PCIC1_PCIDMA0, PCIC1_PCIDMA1, PCIC1_PCIDMA2, PCIC1_PCIDMA3),
233}; 233};
@@ -282,13 +282,19 @@ void __init plat_irq_setup(void)
282#define INTC_ICR 0xffd00000UL 282#define INTC_ICR 0xffd00000UL
283#define INTC_ICR_IRLM (1<<7) 283#define INTC_ICR_IRLM (1<<7)
284 284
285/* enable individual interrupt mode for external interupts */ 285void __init plat_irq_setup_pins(int mode)
286void __init ipr_irq_enable_irlm(void)
287{ 286{
288#if defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7091) 287#if defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7091)
289 BUG(); /* impossible to mask interrupts on SH7750 and SH7091 */ 288 BUG(); /* impossible to mask interrupts on SH7750 and SH7091 */
289 return;
290#endif 290#endif
291 register_intc_controller(&intc_desc_irlm);
292 291
293 ctrl_outw(ctrl_inw(INTC_ICR) | INTC_ICR_IRLM, INTC_ICR); 292 switch (mode) {
293 case IRQ_MODE_IRQ: /* individual interrupt mode for IRL3-0 */
294 ctrl_outw(ctrl_inw(INTC_ICR) | INTC_ICR_IRLM, INTC_ICR);
295 register_intc_controller(&intc_desc_irlm);
296 break;
297 default:
298 BUG();
299 }
294} 300}
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7760.c b/arch/sh/kernel/cpu/sh4/setup-sh7760.c
index 47fa27056253..7a898cb1d940 100644
--- a/arch/sh/kernel/cpu/sh4/setup-sh7760.c
+++ b/arch/sh/kernel/cpu/sh4/setup-sh7760.c
@@ -12,6 +12,136 @@
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <asm/sci.h> 13#include <asm/sci.h>
14 14
15enum {
16 UNUSED = 0,
17
18 /* interrupt sources */
19 IRL0, IRL1, IRL2, IRL3,
20 HUDI, GPIOI,
21 DMAC_DMTE0, DMAC_DMTE1, DMAC_DMTE2, DMAC_DMTE3,
22 DMAC_DMTE4, DMAC_DMTE5, DMAC_DMTE6, DMAC_DMTE7,
23 DMAC_DMAE,
24 IRQ4, IRQ5, IRQ6, IRQ7,
25 HCAN20, HCAN21,
26 SSI0, SSI1,
27 HAC0, HAC1,
28 I2C0, I2C1,
29 USB, LCDC,
30 DMABRG0, DMABRG1, DMABRG2,
31 SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI,
32 SCIF1_ERI, SCIF1_RXI, SCIF1_BRI, SCIF1_TXI,
33 SCIF2_ERI, SCIF2_RXI, SCIF2_BRI, SCIF2_TXI,
34 SIM_ERI, SIM_RXI, SIM_TXI, SIM_TEI,
35 HSPI,
36 MMCIF0, MMCIF1, MMCIF2, MMCIF3,
37 MFI, ADC, CMT,
38 TMU0, TMU1, TMU2_TUNI, TMU2_TICPI,
39 WDT,
40 REF_RCMI, REF_ROVI,
41
42 /* interrupt groups */
43 DMAC, DMABRG, SCIF0, SCIF1, SCIF2, SIM, MMCIF, TMU2, REF,
44};
45
46static struct intc_vect vectors[] __initdata = {
47 INTC_VECT(HUDI, 0x600), INTC_VECT(GPIOI, 0x620),
48 INTC_VECT(DMAC_DMTE0, 0x640), INTC_VECT(DMAC_DMTE1, 0x660),
49 INTC_VECT(DMAC_DMTE2, 0x680), INTC_VECT(DMAC_DMTE3, 0x6a0),
50 INTC_VECT(DMAC_DMTE4, 0x780), INTC_VECT(DMAC_DMTE5, 0x7a0),
51 INTC_VECT(DMAC_DMTE6, 0x7c0), INTC_VECT(DMAC_DMTE7, 0x7e0),
52 INTC_VECT(DMAC_DMAE, 0x6c0),
53 INTC_VECT(IRQ4, 0x800), INTC_VECT(IRQ5, 0x820),
54 INTC_VECT(IRQ6, 0x840), INTC_VECT(IRQ6, 0x860),
55 INTC_VECT(HCAN20, 0x900), INTC_VECT(HCAN21, 0x920),
56 INTC_VECT(SSI0, 0x940), INTC_VECT(SSI1, 0x960),
57 INTC_VECT(HAC0, 0x980), INTC_VECT(HAC1, 0x9a0),
58 INTC_VECT(I2C0, 0x9c0), INTC_VECT(I2C1, 0x9e0),
59 INTC_VECT(USB, 0xa00), INTC_VECT(LCDC, 0xa20),
60 INTC_VECT(DMABRG0, 0xa80), INTC_VECT(DMABRG1, 0xaa0),
61 INTC_VECT(DMABRG2, 0xac0),
62 INTC_VECT(SCIF0_ERI, 0x880), INTC_VECT(SCIF0_RXI, 0x8a0),
63 INTC_VECT(SCIF0_BRI, 0x8c0), INTC_VECT(SCIF0_TXI, 0x8e0),
64 INTC_VECT(SCIF1_ERI, 0xb00), INTC_VECT(SCIF1_RXI, 0xb20),
65 INTC_VECT(SCIF1_BRI, 0xb40), INTC_VECT(SCIF1_TXI, 0xb60),
66 INTC_VECT(SCIF2_ERI, 0xb80), INTC_VECT(SCIF2_RXI, 0xba0),
67 INTC_VECT(SCIF2_BRI, 0xbc0), INTC_VECT(SCIF2_TXI, 0xbe0),
68 INTC_VECT(SIM_ERI, 0xc00), INTC_VECT(SIM_RXI, 0xc20),
69 INTC_VECT(SIM_TXI, 0xc40), INTC_VECT(SIM_TEI, 0xc60),
70 INTC_VECT(HSPI, 0xc80),
71 INTC_VECT(MMCIF0, 0xd00), INTC_VECT(MMCIF1, 0xd20),
72 INTC_VECT(MMCIF2, 0xd40), INTC_VECT(MMCIF3, 0xd60),
73 INTC_VECT(MFI, 0xe80), /* 0xf80 according to data sheet */
74 INTC_VECT(ADC, 0xf80), INTC_VECT(CMT, 0xfa0),
75 INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
76 INTC_VECT(TMU2_TUNI, 0x440), INTC_VECT(TMU2_TICPI, 0x460),
77 INTC_VECT(WDT, 0x560),
78 INTC_VECT(REF_RCMI, 0x580), INTC_VECT(REF_ROVI, 0x5a0),
79};
80
81static struct intc_group groups[] __initdata = {
82 INTC_GROUP(DMAC, DMAC_DMTE0, DMAC_DMTE1, DMAC_DMTE2,
83 DMAC_DMTE3, DMAC_DMTE4, DMAC_DMTE5,
84 DMAC_DMTE6, DMAC_DMTE7, DMAC_DMAE),
85 INTC_GROUP(DMABRG, DMABRG0, DMABRG1, DMABRG2),
86 INTC_GROUP(SCIF0, SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI),
87 INTC_GROUP(SCIF1, SCIF1_ERI, SCIF1_RXI, SCIF1_BRI, SCIF1_TXI),
88 INTC_GROUP(SCIF2, SCIF2_ERI, SCIF2_RXI, SCIF2_BRI, SCIF2_TXI),
89 INTC_GROUP(SIM, SIM_ERI, SIM_RXI, SIM_TXI, SIM_TEI),
90 INTC_GROUP(MMCIF, MMCIF0, MMCIF1, MMCIF2, MMCIF3),
91 INTC_GROUP(TMU2, TMU2_TUNI, TMU2_TICPI),
92 INTC_GROUP(REF, REF_RCMI, REF_ROVI),
93};
94
95static struct intc_prio priorities[] __initdata = {
96 INTC_PRIO(SCIF0, 3),
97 INTC_PRIO(SCIF1, 3),
98 INTC_PRIO(SCIF2, 3),
99 INTC_PRIO(SIM, 3),
100 INTC_PRIO(DMAC, 7),
101 INTC_PRIO(DMABRG, 13),
102};
103
104static struct intc_mask_reg mask_registers[] __initdata = {
105 { 0xfe080040, 0xfe080060, 32, /* INTMSK00 / INTMSKCLR00 */
106 { IRQ4, IRQ5, IRQ6, IRQ7, 0, 0, HCAN20, HCAN21,
107 SSI0, SSI1, HAC0, HAC1, I2C0, I2C1, USB, LCDC,
108 0, DMABRG0, DMABRG1, DMABRG2,
109 SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI,
110 SCIF1_ERI, SCIF1_RXI, SCIF1_BRI, SCIF1_TXI,
111 SCIF2_ERI, SCIF2_RXI, SCIF2_BRI, SCIF2_TXI, } },
112 { 0xfe080044, 0xfe080064, 32, /* INTMSK04 / INTMSKCLR04 */
113 { 0, 0, 0, 0, 0, 0, 0, 0,
114 SIM_ERI, SIM_RXI, SIM_TXI, SIM_TEI,
115 HSPI, MMCIF0, MMCIF1, MMCIF2,
116 MMCIF3, 0, 0, 0, 0, 0, 0, 0,
117 0, MFI, 0, 0, 0, 0, ADC, CMT, } },
118};
119
120static struct intc_prio_reg prio_registers[] __initdata = {
121 { 0xffd00004, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2 } },
122 { 0xffd00008, 0, 16, 4, /* IPRB */ { WDT, REF, 0, 0 } },
123 { 0xffd0000c, 0, 16, 4, /* IPRC */ { GPIOI, DMAC, 0, HUDI } },
124 { 0xffd00010, 0, 16, 4, /* IPRD */ { IRL0, IRL1, IRL2, IRL3 } },
125 { 0xfe080000, 0, 32, 4, /* INTPRI00 */ { IRQ4, IRQ5, IRQ6, IRQ7 } },
126 { 0xfe080004, 0, 32, 4, /* INTPRI04 */ { HCAN20, HCAN21, SSI0, SSI1,
127 HAC0, HAC1, I2C0, I2C1 } },
128 { 0xfe080008, 0, 32, 4, /* INTPRI08 */ { USB, LCDC, DMABRG, SCIF0,
129 SCIF1, SCIF2, SIM, HSPI } },
130 { 0xfe08000c, 0, 32, 4, /* INTPRI0C */ { 0, 0, MMCIF, 0,
131 MFI, 0, ADC, CMT } },
132};
133
134static DECLARE_INTC_DESC(intc_desc, "sh7760", vectors, groups,
135 priorities, mask_registers, prio_registers, NULL);
136
137static struct intc_vect vectors_irq[] __initdata = {
138 INTC_VECT(IRL0, 0x240), INTC_VECT(IRL1, 0x2a0),
139 INTC_VECT(IRL2, 0x300), INTC_VECT(IRL3, 0x360),
140};
141
142static DECLARE_INTC_DESC(intc_desc_irq, "sh7760-irq", vectors_irq, groups,
143 priorities, mask_registers, prio_registers, NULL);
144
15static struct plat_sci_port sci_platform_data[] = { 145static struct plat_sci_port sci_platform_data[] = {
16 { 146 {
17 .mapbase = 0xfe600000, 147 .mapbase = 0xfe600000,
@@ -29,6 +159,11 @@ static struct plat_sci_port sci_platform_data[] = {
29 .type = PORT_SCIF, 159 .type = PORT_SCIF,
30 .irqs = { 76, 77, 79, 78 }, 160 .irqs = { 76, 77, 79, 78 },
31 }, { 161 }, {
162 .mapbase = 0xfe480000,
163 .flags = UPF_BOOT_AUTOCONF,
164 .type = PORT_SCI,
165 .irqs = { 80, 81, 82, 0 },
166 }, {
32 .flags = 0, 167 .flags = 0,
33 } 168 }
34}; 169};
@@ -52,114 +187,18 @@ static int __init sh7760_devices_setup(void)
52} 187}
53__initcall(sh7760_devices_setup); 188__initcall(sh7760_devices_setup);
54 189
55static struct intc2_data intc2_irq_table[] = { 190void __init plat_irq_setup_pins(int mode)
56 {48, 0, 28, 0, 31, 3}, /* IRQ 4 */ 191{
57 {49, 0, 24, 0, 30, 3}, /* IRQ 3 */ 192 switch (mode) {
58 {50, 0, 20, 0, 29, 3}, /* IRQ 2 */ 193 case IRQ_MODE_IRQ:
59 {51, 0, 16, 0, 28, 3}, /* IRQ 1 */ 194 register_intc_controller(&intc_desc_irq);
60 {56, 4, 28, 0, 25, 3}, /* HCAN2_CHAN0 */ 195 break;
61 {57, 4, 24, 0, 24, 3}, /* HCAN2_CHAN1 */ 196 default:
62 {58, 4, 20, 0, 23, 3}, /* I2S_CHAN0 */ 197 BUG();
63 {59, 4, 16, 0, 22, 3}, /* I2S_CHAN1 */ 198 }
64 {60, 4, 12, 0, 21, 3}, /* AC97_CHAN0 */ 199}
65 {61, 4, 8, 0, 20, 3}, /* AC97_CHAN1 */
66 {62, 4, 4, 0, 19, 3}, /* I2C_CHAN0 */
67 {63, 4, 0, 0, 18, 3}, /* I2C_CHAN1 */
68 {52, 8, 16, 0, 11, 3}, /* SCIF0_ERI_IRQ */
69 {53, 8, 16, 0, 10, 3}, /* SCIF0_RXI_IRQ */
70 {54, 8, 16, 0, 9, 3}, /* SCIF0_BRI_IRQ */
71 {55, 8, 16, 0, 8, 3}, /* SCIF0_TXI_IRQ */
72 {64, 8, 28, 0, 17, 3}, /* USBHI_IRQ */
73 {65, 8, 24, 0, 16, 3}, /* LCDC */
74 {68, 8, 20, 0, 14, 13}, /* DMABRGI0_IRQ */
75 {69, 8, 20, 0, 13, 13}, /* DMABRGI1_IRQ */
76 {70, 8, 20, 0, 12, 13}, /* DMABRGI2_IRQ */
77 {72, 8, 12, 0, 7, 3}, /* SCIF1_ERI_IRQ */
78 {73, 8, 12, 0, 6, 3}, /* SCIF1_RXI_IRQ */
79 {74, 8, 12, 0, 5, 3}, /* SCIF1_BRI_IRQ */
80 {75, 8, 12, 0, 4, 3}, /* SCIF1_TXI_IRQ */
81 {76, 8, 8, 0, 3, 3}, /* SCIF2_ERI_IRQ */
82 {77, 8, 8, 0, 2, 3}, /* SCIF2_RXI_IRQ */
83 {78, 8, 8, 0, 1, 3}, /* SCIF2_BRI_IRQ */
84 {79, 8, 8, 0, 0, 3}, /* SCIF2_TXI_IRQ */
85 {80, 8, 4, 4, 23, 3}, /* SIM_ERI */
86 {81, 8, 4, 4, 22, 3}, /* SIM_RXI */
87 {82, 8, 4, 4, 21, 3}, /* SIM_TXI */
88 {83, 8, 4, 4, 20, 3}, /* SIM_TEI */
89 {84, 8, 0, 4, 19, 3}, /* HSPII */
90 {88, 12, 20, 4, 18, 3}, /* MMCI0 */
91 {89, 12, 20, 4, 17, 3}, /* MMCI1 */
92 {90, 12, 20, 4, 16, 3}, /* MMCI2 */
93 {91, 12, 20, 4, 15, 3}, /* MMCI3 */
94 {92, 12, 12, 4, 6, 3}, /* MFI */
95 {108,12, 4, 4, 1, 3}, /* ADC */
96 {109,12, 0, 4, 0, 3}, /* CMTI */
97};
98
99static struct intc2_desc intc2_irq_desc __read_mostly = {
100 .prio_base = 0xfe080000,
101 .msk_base = 0xfe080040,
102 .mskclr_base = 0xfe080060,
103
104 .intc2_data = intc2_irq_table,
105 .nr_irqs = ARRAY_SIZE(intc2_irq_table),
106
107 .chip = {
108 .name = "INTC2-sh7760",
109 },
110};
111
112static struct ipr_data ipr_irq_table[] = {
113 /* IRQ, IPR-idx, shift, priority */
114 { 16, 0, 12, 2 }, /* TMU0 TUNI*/
115 { 17, 0, 8, 2 }, /* TMU1 TUNI */
116 { 18, 0, 4, 2 }, /* TMU2 TUNI */
117 { 19, 0, 4, 2 }, /* TMU2 TIPCI */
118 { 27, 1, 12, 2 }, /* WDT ITI */
119 { 28, 1, 8, 2 }, /* REF RCMI */
120 { 29, 1, 8, 2 }, /* REF ROVI */
121 { 32, 2, 0, 7 }, /* HUDI */
122 { 33, 2, 12, 7 }, /* GPIOI */
123 { 34, 2, 8, 7 }, /* DMAC DMTE0 */
124 { 35, 2, 8, 7 }, /* DMAC DMTE1 */
125 { 36, 2, 8, 7 }, /* DMAC DMTE2 */
126 { 37, 2, 8, 7 }, /* DMAC DMTE3 */
127 { 38, 2, 8, 7 }, /* DMAC DMAE */
128 { 44, 2, 8, 7 }, /* DMAC DMTE4 */
129 { 45, 2, 8, 7 }, /* DMAC DMTE5 */
130 { 46, 2, 8, 7 }, /* DMAC DMTE6 */
131 { 47, 2, 8, 7 }, /* DMAC DMTE7 */
132/* these here are only valid if INTC_ICR bit 7 is set to 1!
133 * XXX: maybe CONFIG_SH_IRLMODE symbol? SH7751 could use it too */
134#if 0
135 { 2, 3, 12, 3 }, /* IRL0 */
136 { 5, 3, 8, 3 }, /* IRL1 */
137 { 8, 3, 4, 3 }, /* IRL2 */
138 { 11, 3, 0, 3 }, /* IRL3 */
139#endif
140};
141
142static unsigned long ipr_offsets[] = {
143 0xffd00004UL, /* 0: IPRA */
144 0xffd00008UL, /* 1: IPRB */
145 0xffd0000cUL, /* 2: IPRC */
146 0xffd00010UL, /* 3: IPRD */
147};
148
149static struct ipr_desc ipr_irq_desc = {
150 .ipr_offsets = ipr_offsets,
151 .nr_offsets = ARRAY_SIZE(ipr_offsets),
152
153 .ipr_data = ipr_irq_table,
154 .nr_irqs = ARRAY_SIZE(ipr_irq_table),
155
156 .chip = {
157 .name = "IPR-sh7760",
158 },
159};
160 200
161void __init plat_irq_setup(void) 201void __init plat_irq_setup(void)
162{ 202{
163 register_intc2_controller(&intc2_irq_desc); 203 register_intc_controller(&intc_desc);
164 register_ipr_controller(&ipr_irq_desc);
165} 204}
diff --git a/arch/sh/kernel/cpu/sh4/sq.c b/arch/sh/kernel/cpu/sh4/sq.c
index c21512c6044e..b22a78c807e6 100644
--- a/arch/sh/kernel/cpu/sh4/sq.c
+++ b/arch/sh/kernel/cpu/sh4/sq.c
@@ -58,11 +58,11 @@ do { \
58 */ 58 */
59void sq_flush_range(unsigned long start, unsigned int len) 59void sq_flush_range(unsigned long start, unsigned int len)
60{ 60{
61 volatile unsigned long *sq = (unsigned long *)start; 61 unsigned long *sq = (unsigned long *)start;
62 62
63 /* Flush the queues */ 63 /* Flush the queues */
64 for (len >>= 5; len--; sq += 8) 64 for (len >>= 5; len--; sq += 8)
65 prefetchw((void *)sq); 65 prefetchw(sq);
66 66
67 /* Wait for completion */ 67 /* Wait for completion */
68 store_queue_barrier(); 68 store_queue_barrier();
diff --git a/arch/sh/kernel/cpu/sh4a/Makefile b/arch/sh/kernel/cpu/sh4a/Makefile
index e6a1fb5f8484..24539873943a 100644
--- a/arch/sh/kernel/cpu/sh4a/Makefile
+++ b/arch/sh/kernel/cpu/sh4a/Makefile
@@ -10,6 +10,9 @@ obj-$(CONFIG_CPU_SUBTYPE_SH7343) += setup-sh7343.o
10obj-$(CONFIG_CPU_SUBTYPE_SH7722) += setup-sh7722.o 10obj-$(CONFIG_CPU_SUBTYPE_SH7722) += setup-sh7722.o
11obj-$(CONFIG_CPU_SUBTYPE_SHX3) += setup-shx3.o 11obj-$(CONFIG_CPU_SUBTYPE_SHX3) += setup-shx3.o
12 12
13# SMP setup
14smp-$(CONFIG_CPU_SUBTYPE_SHX3) := smp-shx3.o
15
13# Primary on-chip clocks (common) 16# Primary on-chip clocks (common)
14clock-$(CONFIG_CPU_SUBTYPE_SH7770) := clock-sh7770.o 17clock-$(CONFIG_CPU_SUBTYPE_SH7770) := clock-sh7770.o
15clock-$(CONFIG_CPU_SUBTYPE_SH7780) := clock-sh7780.o 18clock-$(CONFIG_CPU_SUBTYPE_SH7780) := clock-sh7780.o
@@ -18,4 +21,5 @@ clock-$(CONFIG_CPU_SUBTYPE_SH7343) := clock-sh7343.o
18clock-$(CONFIG_CPU_SUBTYPE_SH7722) := clock-sh7722.o 21clock-$(CONFIG_CPU_SUBTYPE_SH7722) := clock-sh7722.o
19clock-$(CONFIG_CPU_SUBTYPE_SHX3) := clock-shx3.o 22clock-$(CONFIG_CPU_SUBTYPE_SHX3) := clock-shx3.o
20 23
21obj-y += $(clock-y) 24obj-y += $(clock-y)
25obj-$(CONFIG_SMP) += $(smp-y)
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
index 91d61cf91ba1..c0a3f079dfdc 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
@@ -41,3 +41,7 @@ static int __init sh7343_devices_setup(void)
41 ARRAY_SIZE(sh7343_devices)); 41 ARRAY_SIZE(sh7343_devices));
42} 42}
43__initcall(sh7343_devices_setup); 43__initcall(sh7343_devices_setup);
44
45void __init plat_irq_setup(void)
46{
47}
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
index 25b913e07e2c..55f66104431d 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
@@ -84,7 +84,7 @@ enum {
84 SIM, RTC, DMAC0123, VIOVOU, USB, DMAC45, FLCTL, I2C, SDHI, 84 SIM, RTC, DMAC0123, VIOVOU, USB, DMAC45, FLCTL, I2C, SDHI,
85}; 85};
86 86
87static struct intc_vect vectors[] = { 87static struct intc_vect vectors[] __initdata = {
88 INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620), 88 INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620),
89 INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660), 89 INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660),
90 INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0), 90 INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0),
@@ -117,7 +117,7 @@ static struct intc_vect vectors[] = {
117 INTC_VECT(JPU, 0x560), INTC_VECT(LCDC, 0x580), 117 INTC_VECT(JPU, 0x560), INTC_VECT(LCDC, 0x580),
118}; 118};
119 119
120static struct intc_group groups[] = { 120static struct intc_group groups[] __initdata = {
121 INTC_GROUP(SIM, SIM_ERI, SIM_RXI, SIM_TXI, SIM_TEI), 121 INTC_GROUP(SIM, SIM_ERI, SIM_RXI, SIM_TXI, SIM_TEI),
122 INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI), 122 INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI),
123 INTC_GROUP(DMAC0123, DMAC0, DMAC1, DMAC2, DMAC3), 123 INTC_GROUP(DMAC0123, DMAC0, DMAC1, DMAC2, DMAC3),
@@ -130,7 +130,7 @@ static struct intc_group groups[] = {
130 INTC_GROUP(SDHI, SDHI0, SDHI1, SDHI2, SDHI3), 130 INTC_GROUP(SDHI, SDHI0, SDHI1, SDHI2, SDHI3),
131}; 131};
132 132
133static struct intc_prio priorities[] = { 133static struct intc_prio priorities[] __initdata = {
134 INTC_PRIO(SCIF0, 3), 134 INTC_PRIO(SCIF0, 3),
135 INTC_PRIO(SCIF1, 3), 135 INTC_PRIO(SCIF1, 3),
136 INTC_PRIO(SCIF2, 3), 136 INTC_PRIO(SCIF2, 3),
@@ -138,7 +138,7 @@ static struct intc_prio priorities[] = {
138 INTC_PRIO(TMU1, 2), 138 INTC_PRIO(TMU1, 2),
139}; 139};
140 140
141static struct intc_mask_reg mask_registers[] = { 141static struct intc_mask_reg mask_registers[] __initdata = {
142 { 0xa4080080, 0xa40800c0, 8, /* IMR0 / IMCR0 */ 142 { 0xa4080080, 0xa40800c0, 8, /* IMR0 / IMCR0 */
143 { } }, 143 { } },
144 { 0xa4080084, 0xa40800c4, 8, /* IMR1 / IMCR1 */ 144 { 0xa4080084, 0xa40800c4, 8, /* IMR1 / IMCR1 */
@@ -168,24 +168,24 @@ static struct intc_mask_reg mask_registers[] = {
168 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } }, 168 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
169}; 169};
170 170
171static struct intc_prio_reg prio_registers[] = { 171static struct intc_prio_reg prio_registers[] __initdata = {
172 { 0xa4080000, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, IRDA } }, 172 { 0xa4080000, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, IRDA } },
173 { 0xa4080004, 16, 4, /* IPRB */ { JPU, LCDC, SIM } }, 173 { 0xa4080004, 0, 16, 4, /* IPRB */ { JPU, LCDC, SIM } },
174 { 0xa4080008, 16, 4, /* IPRC */ { } }, 174 { 0xa4080008, 0, 16, 4, /* IPRC */ { } },
175 { 0xa408000c, 16, 4, /* IPRD */ { } }, 175 { 0xa408000c, 0, 16, 4, /* IPRD */ { } },
176 { 0xa4080010, 16, 4, /* IPRE */ { DMAC0123, VIOVOU, 0, VPU } }, 176 { 0xa4080010, 0, 16, 4, /* IPRE */ { DMAC0123, VIOVOU, 0, VPU } },
177 { 0xa4080014, 16, 4, /* IPRF */ { KEYSC, DMAC45, USB, CMT } }, 177 { 0xa4080014, 0, 16, 4, /* IPRF */ { KEYSC, DMAC45, USB, CMT } },
178 { 0xa4080018, 16, 4, /* IPRG */ { SCIF0, SCIF1, SCIF2 } }, 178 { 0xa4080018, 0, 16, 4, /* IPRG */ { SCIF0, SCIF1, SCIF2 } },
179 { 0xa408001c, 16, 4, /* IPRH */ { SIOF0, SIOF1, FLCTL, I2C } }, 179 { 0xa408001c, 0, 16, 4, /* IPRH */ { SIOF0, SIOF1, FLCTL, I2C } },
180 { 0xa4080020, 16, 4, /* IPRI */ { SIO, 0, TSIF, RTC } }, 180 { 0xa4080020, 0, 16, 4, /* IPRI */ { SIO, 0, TSIF, RTC } },
181 { 0xa4080024, 16, 4, /* IPRJ */ { 0, 0, SIU } }, 181 { 0xa4080024, 0, 16, 4, /* IPRJ */ { 0, 0, SIU } },
182 { 0xa4080028, 16, 4, /* IPRK */ { 0, 0, 0, SDHI } }, 182 { 0xa4080028, 0, 16, 4, /* IPRK */ { 0, 0, 0, SDHI } },
183 { 0xa408002c, 16, 4, /* IPRL */ { TWODG, 0, TPU } }, 183 { 0xa408002c, 0, 16, 4, /* IPRL */ { TWODG, 0, TPU } },
184 { 0xa4140010, 32, 4, /* INTPRI00 */ 184 { 0xa4140010, 0, 32, 4, /* INTPRI00 */
185 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } }, 185 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
186}; 186};
187 187
188static struct intc_sense_reg sense_registers[] = { 188static struct intc_sense_reg sense_registers[] __initdata = {
189 { 0xa414001c, 16, 2, /* ICR1 */ 189 { 0xa414001c, 16, 2, /* ICR1 */
190 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } }, 190 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
191}; 191};
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7770.c b/arch/sh/kernel/cpu/sh4a/setup-sh7770.c
index 6a04cc5f5aca..32f4f59a837b 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7770.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7770.c
@@ -51,3 +51,7 @@ static int __init sh7770_devices_setup(void)
51 ARRAY_SIZE(sh7770_devices)); 51 ARRAY_SIZE(sh7770_devices));
52} 52}
53__initcall(sh7770_devices_setup); 53__initcall(sh7770_devices_setup);
54
55void __init plat_irq_setup(void)
56{
57}
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
index a4127ec15203..e8fd33ff0605 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
@@ -10,6 +10,7 @@
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <linux/io.h>
13#include <asm/sci.h> 14#include <asm/sci.h>
14 15
15static struct resource rtc_resources[] = { 16static struct resource rtc_resources[] = {
@@ -114,7 +115,7 @@ enum {
114 PCIC5, SCIF1, MMCIF, TMU345, FLCTL, GPIO, 115 PCIC5, SCIF1, MMCIF, TMU345, FLCTL, GPIO,
115}; 116};
116 117
117static struct intc_vect vectors[] = { 118static struct intc_vect vectors[] __initdata = {
118 INTC_VECT(RTC_ATI, 0x480), INTC_VECT(RTC_PRI, 0x4a0), 119 INTC_VECT(RTC_ATI, 0x480), INTC_VECT(RTC_PRI, 0x4a0),
119 INTC_VECT(RTC_CUI, 0x4c0), 120 INTC_VECT(RTC_CUI, 0x4c0),
120 INTC_VECT(WDT, 0x560), 121 INTC_VECT(WDT, 0x560),
@@ -150,7 +151,7 @@ static struct intc_vect vectors[] = {
150 INTC_VECT(GPIOI2, 0xfc0), INTC_VECT(GPIOI3, 0xfe0), 151 INTC_VECT(GPIOI2, 0xfc0), INTC_VECT(GPIOI3, 0xfe0),
151}; 152};
152 153
153static struct intc_group groups[] = { 154static struct intc_group groups[] __initdata = {
154 INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI), 155 INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI),
155 INTC_GROUP(TMU012, TMU0, TMU1, TMU2, TMU2_TICPI), 156 INTC_GROUP(TMU012, TMU0, TMU1, TMU2, TMU2_TICPI),
156 INTC_GROUP(DMAC0, DMAC0_DMINT0, DMAC0_DMINT1, DMAC0_DMINT2, 157 INTC_GROUP(DMAC0, DMAC0_DMINT0, DMAC0_DMINT1, DMAC0_DMINT2,
@@ -167,12 +168,12 @@ static struct intc_group groups[] = {
167 INTC_GROUP(GPIO, GPIOI0, GPIOI1, GPIOI2, GPIOI3), 168 INTC_GROUP(GPIO, GPIOI0, GPIOI1, GPIOI2, GPIOI3),
168}; 169};
169 170
170static struct intc_prio priorities[] = { 171static struct intc_prio priorities[] __initdata = {
171 INTC_PRIO(SCIF0, 3), 172 INTC_PRIO(SCIF0, 3),
172 INTC_PRIO(SCIF1, 3), 173 INTC_PRIO(SCIF1, 3),
173}; 174};
174 175
175static struct intc_mask_reg mask_registers[] = { 176static struct intc_mask_reg mask_registers[] __initdata = {
176 { 0xffd40038, 0xffd4003c, 32, /* INT2MSKR / INT2MSKCR */ 177 { 0xffd40038, 0xffd4003c, 32, /* INT2MSKR / INT2MSKCR */
177 { 0, 0, 0, 0, 0, 0, GPIO, FLCTL, 178 { 0, 0, 0, 0, 0, 0, GPIO, FLCTL,
178 SSI, MMCIF, HSPI, SIOF, PCIC5, PCIINTD, PCIINTC, PCIINTB, 179 SSI, MMCIF, HSPI, SIOF, PCIC5, PCIINTD, PCIINTC, PCIINTB,
@@ -180,16 +181,18 @@ static struct intc_mask_reg mask_registers[] = {
180 HUDI, 0, WDT, SCIF1, SCIF0, RTC, TMU345, TMU012 } }, 181 HUDI, 0, WDT, SCIF1, SCIF0, RTC, TMU345, TMU012 } },
181}; 182};
182 183
183static struct intc_prio_reg prio_registers[] = { 184static struct intc_prio_reg prio_registers[] __initdata = {
184 { 0xffd40000, 32, 8, /* INT2PRI0 */ { TMU0, TMU1, TMU2, TMU2_TICPI } }, 185 { 0xffd40000, 0, 32, 8, /* INT2PRI0 */ { TMU0, TMU1,
185 { 0xffd40004, 32, 8, /* INT2PRI1 */ { TMU3, TMU4, TMU5, RTC } }, 186 TMU2, TMU2_TICPI } },
186 { 0xffd40008, 32, 8, /* INT2PRI2 */ { SCIF0, SCIF1, WDT } }, 187 { 0xffd40004, 0, 32, 8, /* INT2PRI1 */ { TMU3, TMU4, TMU5, RTC } },
187 { 0xffd4000c, 32, 8, /* INT2PRI3 */ { HUDI, DMAC0, DMAC1 } }, 188 { 0xffd40008, 0, 32, 8, /* INT2PRI2 */ { SCIF0, SCIF1, WDT } },
188 { 0xffd40010, 32, 8, /* INT2PRI4 */ { CMT, HAC, PCISERR, PCIINTA, } }, 189 { 0xffd4000c, 0, 32, 8, /* INT2PRI3 */ { HUDI, DMAC0, DMAC1 } },
189 { 0xffd40014, 32, 8, /* INT2PRI5 */ { PCIINTB, PCIINTC, 190 { 0xffd40010, 0, 32, 8, /* INT2PRI4 */ { CMT, HAC,
190 PCIINTD, PCIC5 } }, 191 PCISERR, PCIINTA, } },
191 { 0xffd40018, 32, 8, /* INT2PRI6 */ { SIOF, HSPI, MMCIF, SSI } }, 192 { 0xffd40014, 0, 32, 8, /* INT2PRI5 */ { PCIINTB, PCIINTC,
192 { 0xffd4001c, 32, 8, /* INT2PRI7 */ { FLCTL, GPIO } }, 193 PCIINTD, PCIC5 } },
194 { 0xffd40018, 0, 32, 8, /* INT2PRI6 */ { SIOF, HSPI, MMCIF, SSI } },
195 { 0xffd4001c, 0, 32, 8, /* INT2PRI7 */ { FLCTL, GPIO } },
193}; 196};
194 197
195static DECLARE_INTC_DESC(intc_desc, "sh7780", vectors, groups, priorities, 198static DECLARE_INTC_DESC(intc_desc, "sh7780", vectors, groups, priorities,
@@ -197,24 +200,24 @@ static DECLARE_INTC_DESC(intc_desc, "sh7780", vectors, groups, priorities,
197 200
198/* Support for external interrupt pins in IRQ mode */ 201/* Support for external interrupt pins in IRQ mode */
199 202
200static struct intc_vect irq_vectors[] = { 203static struct intc_vect irq_vectors[] __initdata = {
201 INTC_VECT(IRQ0, 0x240), INTC_VECT(IRQ1, 0x280), 204 INTC_VECT(IRQ0, 0x240), INTC_VECT(IRQ1, 0x280),
202 INTC_VECT(IRQ2, 0x2c0), INTC_VECT(IRQ3, 0x300), 205 INTC_VECT(IRQ2, 0x2c0), INTC_VECT(IRQ3, 0x300),
203 INTC_VECT(IRQ4, 0x340), INTC_VECT(IRQ5, 0x380), 206 INTC_VECT(IRQ4, 0x340), INTC_VECT(IRQ5, 0x380),
204 INTC_VECT(IRQ6, 0x3c0), INTC_VECT(IRQ7, 0x200), 207 INTC_VECT(IRQ6, 0x3c0), INTC_VECT(IRQ7, 0x200),
205}; 208};
206 209
207static struct intc_mask_reg irq_mask_registers[] = { 210static struct intc_mask_reg irq_mask_registers[] __initdata = {
208 { 0xffd00044, 0xffd00064, 32, /* INTMSK0 / INTMSKCLR0 */ 211 { 0xffd00044, 0xffd00064, 32, /* INTMSK0 / INTMSKCLR0 */
209 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } }, 212 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
210}; 213};
211 214
212static struct intc_prio_reg irq_prio_registers[] = { 215static struct intc_prio_reg irq_prio_registers[] __initdata = {
213 { 0xffd00010, 32, 4, /* INTPRI */ { IRQ0, IRQ1, IRQ2, IRQ3, 216 { 0xffd00010, 0, 32, 4, /* INTPRI */ { IRQ0, IRQ1, IRQ2, IRQ3,
214 IRQ4, IRQ5, IRQ6, IRQ7 } }, 217 IRQ4, IRQ5, IRQ6, IRQ7 } },
215}; 218};
216 219
217static struct intc_sense_reg irq_sense_registers[] = { 220static struct intc_sense_reg irq_sense_registers[] __initdata = {
218 { 0xffd0001c, 32, 2, /* ICR1 */ { IRQ0, IRQ1, IRQ2, IRQ3, 221 { 0xffd0001c, 32, 2, /* ICR1 */ { IRQ0, IRQ1, IRQ2, IRQ3,
219 IRQ4, IRQ5, IRQ6, IRQ7 } }, 222 IRQ4, IRQ5, IRQ6, IRQ7 } },
220}; 223};
@@ -225,7 +228,7 @@ static DECLARE_INTC_DESC(intc_irq_desc, "sh7780-irq", irq_vectors,
225 228
226/* External interrupt pins in IRL mode */ 229/* External interrupt pins in IRL mode */
227 230
228static struct intc_vect irl_vectors[] = { 231static struct intc_vect irl_vectors[] __initdata = {
229 INTC_VECT(IRL_LLLL, 0x200), INTC_VECT(IRL_LLLH, 0x220), 232 INTC_VECT(IRL_LLLL, 0x200), INTC_VECT(IRL_LLLH, 0x220),
230 INTC_VECT(IRL_LLHL, 0x240), INTC_VECT(IRL_LLHH, 0x260), 233 INTC_VECT(IRL_LLHL, 0x240), INTC_VECT(IRL_LLHH, 0x260),
231 INTC_VECT(IRL_LHLL, 0x280), INTC_VECT(IRL_LHLH, 0x2a0), 234 INTC_VECT(IRL_LHLL, 0x280), INTC_VECT(IRL_LHLH, 0x2a0),
@@ -236,16 +239,16 @@ static struct intc_vect irl_vectors[] = {
236 INTC_VECT(IRL_HHHL, 0x3c0), 239 INTC_VECT(IRL_HHHL, 0x3c0),
237}; 240};
238 241
239static struct intc_mask_reg irl3210_mask_registers[] = { 242static struct intc_mask_reg irl3210_mask_registers[] __initdata = {
240 { 0xffd00080, 0xffd00084, 32, /* INTMSK2 / INTMSKCLR2 */ 243 { 0xffd40080, 0xffd40084, 32, /* INTMSK2 / INTMSKCLR2 */
241 { IRL_LLLL, IRL_LLLH, IRL_LLHL, IRL_LLHH, 244 { IRL_LLLL, IRL_LLLH, IRL_LLHL, IRL_LLHH,
242 IRL_LHLL, IRL_LHLH, IRL_LHHL, IRL_LHHH, 245 IRL_LHLL, IRL_LHLH, IRL_LHHL, IRL_LHHH,
243 IRL_HLLL, IRL_HLLH, IRL_HLHL, IRL_HLHH, 246 IRL_HLLL, IRL_HLLH, IRL_HLHL, IRL_HLHH,
244 IRL_HHLL, IRL_HHLH, IRL_HHHL, } }, 247 IRL_HHLL, IRL_HHLH, IRL_HHHL, } },
245}; 248};
246 249
247static struct intc_mask_reg irl7654_mask_registers[] = { 250static struct intc_mask_reg irl7654_mask_registers[] __initdata = {
248 { 0xffd00080, 0xffd00084, 32, /* INTMSK2 / INTMSKCLR2 */ 251 { 0xffd40080, 0xffd40084, 32, /* INTMSK2 / INTMSKCLR2 */
249 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
250 IRL_LLLL, IRL_LLLH, IRL_LLHL, IRL_LLHH, 253 IRL_LLLL, IRL_LLLH, IRL_LLHL, IRL_LLHH,
251 IRL_LHLL, IRL_LHLH, IRL_LHHL, IRL_LHHH, 254 IRL_LHLL, IRL_LHLH, IRL_LHHL, IRL_LHHH,
@@ -259,8 +262,28 @@ static DECLARE_INTC_DESC(intc_irl7654_desc, "sh7780-irl7654", irl_vectors,
259static DECLARE_INTC_DESC(intc_irl3210_desc, "sh7780-irl3210", irl_vectors, 262static DECLARE_INTC_DESC(intc_irl3210_desc, "sh7780-irl3210", irl_vectors,
260 NULL, NULL, irl3210_mask_registers, NULL, NULL); 263 NULL, NULL, irl3210_mask_registers, NULL, NULL);
261 264
265#define INTC_ICR0 0xffd00000
266#define INTC_INTMSK0 0xffd00044
267#define INTC_INTMSK1 0xffd00048
268#define INTC_INTMSK2 0xffd40080
269#define INTC_INTMSKCLR1 0xffd00068
270#define INTC_INTMSKCLR2 0xffd40084
271
262void __init plat_irq_setup(void) 272void __init plat_irq_setup(void)
263{ 273{
274 /* disable IRQ7-0 */
275 ctrl_outl(0xff000000, INTC_INTMSK0);
276
277 /* disable IRL3-0 + IRL7-4 */
278 ctrl_outl(0xc0000000, INTC_INTMSK1);
279 ctrl_outl(0xfffefffe, INTC_INTMSK2);
280
281 /* select IRL mode for IRL3-0 + IRL7-4 */
282 ctrl_outl(ctrl_inl(INTC_ICR0) & ~0x00c00000, INTC_ICR0);
283
284 /* disable holding function, ie enable "SH-4 Mode" */
285 ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00200000, INTC_ICR0);
286
264 register_intc_controller(&intc_desc); 287 register_intc_controller(&intc_desc);
265} 288}
266 289
@@ -268,12 +291,28 @@ void __init plat_irq_setup_pins(int mode)
268{ 291{
269 switch (mode) { 292 switch (mode) {
270 case IRQ_MODE_IRQ: 293 case IRQ_MODE_IRQ:
294 /* select IRQ mode for IRL3-0 + IRL7-4 */
295 ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00c00000, INTC_ICR0);
271 register_intc_controller(&intc_irq_desc); 296 register_intc_controller(&intc_irq_desc);
272 break; 297 break;
273 case IRQ_MODE_IRL7654: 298 case IRQ_MODE_IRL7654:
274 register_intc_controller(&intc_irl7654_desc); 299 /* enable IRL7-4 but don't provide any masking */
300 ctrl_outl(0x40000000, INTC_INTMSKCLR1);
301 ctrl_outl(0x0000fffe, INTC_INTMSKCLR2);
275 break; 302 break;
276 case IRQ_MODE_IRL3210: 303 case IRQ_MODE_IRL3210:
304 /* enable IRL0-3 but don't provide any masking */
305 ctrl_outl(0x80000000, INTC_INTMSKCLR1);
306 ctrl_outl(0xfffe0000, INTC_INTMSKCLR2);
307 break;
308 case IRQ_MODE_IRL7654_MASK:
309 /* enable IRL7-4 and mask using cpu intc controller */
310 ctrl_outl(0x40000000, INTC_INTMSKCLR1);
311 register_intc_controller(&intc_irl7654_desc);
312 break;
313 case IRQ_MODE_IRL3210_MASK:
314 /* enable IRL0-3 and mask using cpu intc controller */
315 ctrl_outl(0x80000000, INTC_INTMSKCLR1);
277 register_intc_controller(&intc_irl3210_desc); 316 register_intc_controller(&intc_irl3210_desc);
278 break; 317 break;
279 default: 318 default:
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
index cf047562e43f..39b215d6cee5 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
@@ -10,6 +10,9 @@
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <linux/io.h>
14#include <linux/mm.h>
15#include <asm/mmzone.h>
13#include <asm/sci.h> 16#include <asm/sci.h>
14 17
15static struct plat_sci_port sci_platform_data[] = { 18static struct plat_sci_port sci_platform_data[] = {
@@ -72,46 +75,281 @@ static int __init sh7785_devices_setup(void)
72} 75}
73__initcall(sh7785_devices_setup); 76__initcall(sh7785_devices_setup);
74 77
75static struct intc2_data intc2_irq_table[] = { 78enum {
76 { 28, 0, 24, 0, 0, 2 }, /* TMU0 */ 79 UNUSED = 0,
77 80
78 { 40, 8, 24, 0, 2, 3 }, /* SCIF0 ERI */ 81 /* interrupt sources */
79 { 41, 8, 24, 0, 2, 3 }, /* SCIF0 RXI */ 82
80 { 42, 8, 24, 0, 2, 3 }, /* SCIF0 BRI */ 83 IRL0_LLLL, IRL0_LLLH, IRL0_LLHL, IRL0_LLHH,
81 { 43, 8, 24, 0, 2, 3 }, /* SCIF0 TXI */ 84 IRL0_LHLL, IRL0_LHLH, IRL0_LHHL, IRL0_LHHH,
82 85 IRL0_HLLL, IRL0_HLLH, IRL0_HLHL, IRL0_HLHH,
83 { 44, 8, 16, 0, 3, 3 }, /* SCIF1 ERI */ 86 IRL0_HHLL, IRL0_HHLH, IRL0_HHHL,
84 { 45, 8, 16, 0, 3, 3 }, /* SCIF1 RXI */ 87
85 { 46, 8, 16, 0, 3, 3 }, /* SCIF1 BRI */ 88 IRL4_LLLL, IRL4_LLLH, IRL4_LLHL, IRL4_LLHH,
86 { 47, 8, 16, 0, 3, 3 }, /* SCIF1 TXI */ 89 IRL4_LHLL, IRL4_LHLH, IRL4_LHHL, IRL4_LHHH,
87 90 IRL4_HLLL, IRL4_HLLH, IRL4_HLHL, IRL4_HLHH,
88 { 64, 0x14, 8, 0, 14, 2 }, /* PCIC0 */ 91 IRL4_HHLL, IRL4_HHLH, IRL4_HHHL,
89 { 65, 0x14, 0, 0, 15, 2 }, /* PCIC1 */ 92
90 { 66, 0x18, 24, 0, 16, 2 }, /* PCIC2 */ 93 IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
91 { 67, 0x18, 16, 0, 17, 2 }, /* PCIC3 */ 94 WDT,
92 { 68, 0x18, 8, 0, 18, 2 }, /* PCIC4 */ 95 TMU0, TMU1, TMU2, TMU2_TICPI,
93 96 HUDI,
94 { 60, 8, 8, 0, 4, 3 }, /* SCIF2 ERI, RXI, BRI, TXI */ 97 DMAC0_DMINT0, DMAC0_DMINT1, DMAC0_DMINT2, DMAC0_DMINT3,
95 { 60, 8, 0, 0, 5, 3 }, /* SCIF3 ERI, RXI, BRI, TXI */ 98 DMAC0_DMINT4, DMAC0_DMINT5, DMAC0_DMAE,
96 { 60, 12, 24, 0, 6, 3 }, /* SCIF4 ERI, RXI, BRI, TXI */ 99 SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI,
97 { 60, 12, 16, 0, 7, 3 }, /* SCIF5 ERI, RXI, BRI, TXI */ 100 SCIF1_ERI, SCIF1_RXI, SCIF1_BRI, SCIF1_TXI,
101 DMAC1_DMINT6, DMAC1_DMINT7, DMAC1_DMINT8, DMAC1_DMINT9,
102 DMAC1_DMINT10, DMAC1_DMINT11, DMAC1_DMAE,
103 HSPI,
104 SCIF2, SCIF3, SCIF4, SCIF5,
105 PCISERR, PCIINTA, PCIINTB, PCIINTC, PCIINTD,
106 PCIERR, PCIPWD3, PCIPWD2, PCIPWD1, PCIPWD0,
107 SIOF,
108 MMCIF_FSTAT, MMCIF_TRAN, MMCIF_ERR, MMCIF_FRDY,
109 DU,
110 GDTA_GACLI, GDTA_GAMCI, GDTA_GAERI,
111 TMU3, TMU4, TMU5,
112 SSI0, SSI1,
113 HAC0, HAC1,
114 FLCTL_FLSTE, FLCTL_FLEND, FLCTL_FLTRQ0, FLCTL_FLTRQ1,
115 GPIOI0, GPIOI1, GPIOI2, GPIOI3,
116
117 /* interrupt groups */
118
119 TMU012, DMAC0, SCIF0, SCIF1, DMAC1,
120 PCIC5, MMCIF, GDTA, TMU345, FLCTL, GPIO
98}; 121};
99 122
100static struct intc2_desc intc2_irq_desc __read_mostly = { 123static struct intc_vect vectors[] __initdata = {
101 .prio_base = 0xffd40000, 124 INTC_VECT(WDT, 0x560),
102 .msk_base = 0xffd40038, 125 INTC_VECT(TMU0, 0x580), INTC_VECT(TMU1, 0x5a0),
103 .mskclr_base = 0xffd4003c, 126 INTC_VECT(TMU2, 0x5c0), INTC_VECT(TMU2_TICPI, 0x5e0),
127 INTC_VECT(HUDI, 0x600),
128 INTC_VECT(DMAC0_DMINT0, 0x620), INTC_VECT(DMAC0_DMINT1, 0x640),
129 INTC_VECT(DMAC0_DMINT2, 0x660), INTC_VECT(DMAC0_DMINT3, 0x680),
130 INTC_VECT(DMAC0_DMINT4, 0x6a0), INTC_VECT(DMAC0_DMINT5, 0x6c0),
131 INTC_VECT(DMAC0_DMAE, 0x6e0),
132 INTC_VECT(SCIF0_ERI, 0x700), INTC_VECT(SCIF0_RXI, 0x720),
133 INTC_VECT(SCIF0_BRI, 0x740), INTC_VECT(SCIF0_TXI, 0x760),
134 INTC_VECT(SCIF1_ERI, 0x780), INTC_VECT(SCIF1_RXI, 0x7a0),
135 INTC_VECT(SCIF1_BRI, 0x7c0), INTC_VECT(SCIF1_TXI, 0x7e0),
136 INTC_VECT(DMAC1_DMINT6, 0x880), INTC_VECT(DMAC1_DMINT7, 0x8a0),
137 INTC_VECT(DMAC1_DMINT8, 0x8c0), INTC_VECT(DMAC1_DMINT9, 0x8e0),
138 INTC_VECT(DMAC1_DMINT10, 0x900), INTC_VECT(DMAC1_DMINT11, 0x920),
139 INTC_VECT(DMAC1_DMAE, 0x940),
140 INTC_VECT(HSPI, 0x960),
141 INTC_VECT(SCIF2, 0x980), INTC_VECT(SCIF3, 0x9a0),
142 INTC_VECT(SCIF4, 0x9c0), INTC_VECT(SCIF5, 0x9e0),
143 INTC_VECT(PCISERR, 0xa00), INTC_VECT(PCIINTA, 0xa20),
144 INTC_VECT(PCIINTB, 0xa40), INTC_VECT(PCIINTC, 0xa60),
145 INTC_VECT(PCIINTD, 0xa80), INTC_VECT(PCIERR, 0xaa0),
146 INTC_VECT(PCIPWD3, 0xac0), INTC_VECT(PCIPWD2, 0xae0),
147 INTC_VECT(PCIPWD1, 0xb00), INTC_VECT(PCIPWD0, 0xb20),
148 INTC_VECT(SIOF, 0xc00),
149 INTC_VECT(MMCIF_FSTAT, 0xd00), INTC_VECT(MMCIF_TRAN, 0xd20),
150 INTC_VECT(MMCIF_ERR, 0xd40), INTC_VECT(MMCIF_FRDY, 0xd60),
151 INTC_VECT(DU, 0xd80),
152 INTC_VECT(GDTA_GACLI, 0xda0), INTC_VECT(GDTA_GAMCI, 0xdc0),
153 INTC_VECT(GDTA_GAERI, 0xde0),
154 INTC_VECT(TMU3, 0xe00), INTC_VECT(TMU4, 0xe20),
155 INTC_VECT(TMU5, 0xe40),
156 INTC_VECT(SSI0, 0xe80), INTC_VECT(SSI1, 0xea0),
157 INTC_VECT(HAC0, 0xec0), INTC_VECT(HAC1, 0xee0),
158 INTC_VECT(FLCTL_FLSTE, 0xf00), INTC_VECT(FLCTL_FLEND, 0xf20),
159 INTC_VECT(FLCTL_FLTRQ0, 0xf40), INTC_VECT(FLCTL_FLTRQ1, 0xf60),
160 INTC_VECT(GPIOI0, 0xf80), INTC_VECT(GPIOI1, 0xfa0),
161 INTC_VECT(GPIOI2, 0xfc0), INTC_VECT(GPIOI3, 0xfe0),
162};
104 163
105 .intc2_data = intc2_irq_table, 164static struct intc_group groups[] __initdata = {
106 .nr_irqs = ARRAY_SIZE(intc2_irq_table), 165 INTC_GROUP(TMU012, TMU0, TMU1, TMU2, TMU2_TICPI),
166 INTC_GROUP(DMAC0, DMAC0_DMINT0, DMAC0_DMINT1, DMAC0_DMINT2,
167 DMAC0_DMINT3, DMAC0_DMINT4, DMAC0_DMINT5, DMAC0_DMAE),
168 INTC_GROUP(SCIF0, SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI),
169 INTC_GROUP(SCIF1, SCIF1_ERI, SCIF1_RXI, SCIF1_BRI, SCIF1_TXI),
170 INTC_GROUP(DMAC1, DMAC1_DMINT6, DMAC1_DMINT7, DMAC1_DMINT8,
171 DMAC1_DMINT9, DMAC1_DMINT10, DMAC1_DMINT11, DMAC1_DMAE),
172 INTC_GROUP(PCIC5, PCIERR, PCIPWD3, PCIPWD2, PCIPWD1, PCIPWD0),
173 INTC_GROUP(MMCIF, MMCIF_FSTAT, MMCIF_TRAN, MMCIF_ERR, MMCIF_FRDY),
174 INTC_GROUP(GDTA, GDTA_GACLI, GDTA_GAMCI, GDTA_GAERI),
175 INTC_GROUP(TMU345, TMU3, TMU4, TMU5),
176 INTC_GROUP(FLCTL, FLCTL_FLSTE, FLCTL_FLEND,
177 FLCTL_FLTRQ0, FLCTL_FLTRQ1),
178 INTC_GROUP(GPIO, GPIOI0, GPIOI1, GPIOI2, GPIOI3),
179};
107 180
108 .chip = { 181static struct intc_prio priorities[] __initdata = {
109 .name = "INTC2-sh7785", 182 INTC_PRIO(SCIF0, 3),
110 }, 183 INTC_PRIO(SCIF1, 3),
184 INTC_PRIO(SCIF2, 3),
185 INTC_PRIO(SCIF3, 3),
186 INTC_PRIO(SCIF4, 3),
187 INTC_PRIO(SCIF5, 3),
188};
189
190static struct intc_mask_reg mask_registers[] __initdata = {
191 { 0xffd00044, 0xffd00064, 32, /* INTMSK0 / INTMSKCLR0 */
192 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
193
194 { 0xffd40080, 0xffd40084, 32, /* INTMSK2 / INTMSKCLR2 */
195 { IRL0_LLLL, IRL0_LLLH, IRL0_LLHL, IRL0_LLHH,
196 IRL0_LHLL, IRL0_LHLH, IRL0_LHHL, IRL0_LHHH,
197 IRL0_HLLL, IRL0_HLLH, IRL0_HLHL, IRL0_HLHH,
198 IRL0_HHLL, IRL0_HHLH, IRL0_HHHL, 0,
199 IRL4_LLLL, IRL4_LLLH, IRL4_LLHL, IRL4_LLHH,
200 IRL4_LHLL, IRL4_LHLH, IRL4_LHHL, IRL4_LHHH,
201 IRL4_HLLL, IRL4_HLLH, IRL4_HLHL, IRL4_HLHH,
202 IRL4_HHLL, IRL4_HHLH, IRL4_HHHL, 0, } },
203
204 { 0xffd40038, 0xffd4003c, 32, /* INT2MSKR / INT2MSKCR */
205 { 0, 0, 0, GDTA, DU, SSI0, SSI1, GPIO,
206 FLCTL, MMCIF, HSPI, SIOF, PCIC5, PCIINTD, PCIINTC, PCIINTB,
207 PCIINTA, PCISERR, HAC1, HAC0, DMAC1, DMAC0, HUDI, WDT,
208 SCIF5, SCIF4, SCIF3, SCIF2, SCIF1, SCIF0, TMU345, TMU012 } },
209};
210
211static struct intc_prio_reg prio_registers[] __initdata = {
212 { 0xffd00010, 0, 32, 4, /* INTPRI */ { IRQ0, IRQ1, IRQ2, IRQ3,
213 IRQ4, IRQ5, IRQ6, IRQ7 } },
214 { 0xffd40000, 0, 32, 8, /* INT2PRI0 */ { TMU0, TMU1,
215 TMU2, TMU2_TICPI } },
216 { 0xffd40004, 0, 32, 8, /* INT2PRI1 */ { TMU3, TMU4, TMU5, } },
217 { 0xffd40008, 0, 32, 8, /* INT2PRI2 */ { SCIF0, SCIF1,
218 SCIF2, SCIF3 } },
219 { 0xffd4000c, 0, 32, 8, /* INT2PRI3 */ { SCIF4, SCIF5, WDT, } },
220 { 0xffd40010, 0, 32, 8, /* INT2PRI4 */ { HUDI, DMAC0, DMAC1, } },
221 { 0xffd40014, 0, 32, 8, /* INT2PRI5 */ { HAC0, HAC1,
222 PCISERR, PCIINTA } },
223 { 0xffd40018, 0, 32, 8, /* INT2PRI6 */ { PCIINTB, PCIINTC,
224 PCIINTD, PCIC5 } },
225 { 0xffd4001c, 0, 32, 8, /* INT2PRI7 */ { SIOF, HSPI, MMCIF, } },
226 { 0xffd40020, 0, 32, 8, /* INT2PRI8 */ { FLCTL, GPIO, SSI0, SSI1, } },
227 { 0xffd40024, 0, 32, 8, /* INT2PRI9 */ { DU, GDTA, } },
111}; 228};
112 229
230static DECLARE_INTC_DESC(intc_desc, "sh7785", vectors, groups, priorities,
231 mask_registers, prio_registers, NULL);
232
233/* Support for external interrupt pins in IRQ mode */
234
235static struct intc_vect vectors_irq0123[] __initdata = {
236 INTC_VECT(IRQ0, 0x240), INTC_VECT(IRQ1, 0x280),
237 INTC_VECT(IRQ2, 0x2c0), INTC_VECT(IRQ3, 0x300),
238};
239
240static struct intc_vect vectors_irq4567[] __initdata = {
241 INTC_VECT(IRQ4, 0x340), INTC_VECT(IRQ5, 0x380),
242 INTC_VECT(IRQ6, 0x3c0), INTC_VECT(IRQ7, 0x200),
243};
244
245static struct intc_sense_reg sense_registers[] __initdata = {
246 { 0xffd0001c, 32, 2, /* ICR1 */ { IRQ0, IRQ1, IRQ2, IRQ3,
247 IRQ4, IRQ5, IRQ6, IRQ7 } },
248};
249
250static DECLARE_INTC_DESC(intc_desc_irq0123, "sh7785-irq0123", vectors_irq0123,
251 NULL, NULL, mask_registers, prio_registers,
252 sense_registers);
253
254static DECLARE_INTC_DESC(intc_desc_irq4567, "sh7785-irq4567", vectors_irq4567,
255 NULL, NULL, mask_registers, prio_registers,
256 sense_registers);
257
258/* External interrupt pins in IRL mode */
259
260static struct intc_vect vectors_irl0123[] __initdata = {
261 INTC_VECT(IRL0_LLLL, 0x200), INTC_VECT(IRL0_LLLH, 0x220),
262 INTC_VECT(IRL0_LLHL, 0x240), INTC_VECT(IRL0_LLHH, 0x260),
263 INTC_VECT(IRL0_LHLL, 0x280), INTC_VECT(IRL0_LHLH, 0x2a0),
264 INTC_VECT(IRL0_LHHL, 0x2c0), INTC_VECT(IRL0_LHHH, 0x2e0),
265 INTC_VECT(IRL0_HLLL, 0x300), INTC_VECT(IRL0_HLLH, 0x320),
266 INTC_VECT(IRL0_HLHL, 0x340), INTC_VECT(IRL0_HLHH, 0x360),
267 INTC_VECT(IRL0_HHLL, 0x380), INTC_VECT(IRL0_HHLH, 0x3a0),
268 INTC_VECT(IRL0_HHHL, 0x3c0),
269};
270
271static struct intc_vect vectors_irl4567[] __initdata = {
272 INTC_VECT(IRL4_LLLL, 0xb00), INTC_VECT(IRL4_LLLH, 0xb20),
273 INTC_VECT(IRL4_LLHL, 0xb40), INTC_VECT(IRL4_LLHH, 0xb60),
274 INTC_VECT(IRL4_LHLL, 0xb80), INTC_VECT(IRL4_LHLH, 0xba0),
275 INTC_VECT(IRL4_LHHL, 0xbc0), INTC_VECT(IRL4_LHHH, 0xbe0),
276 INTC_VECT(IRL4_HLLL, 0xc00), INTC_VECT(IRL4_HLLH, 0xc20),
277 INTC_VECT(IRL4_HLHL, 0xc40), INTC_VECT(IRL4_HLHH, 0xc60),
278 INTC_VECT(IRL4_HHLL, 0xc80), INTC_VECT(IRL4_HHLH, 0xca0),
279 INTC_VECT(IRL4_HHHL, 0xcc0),
280};
281
282static DECLARE_INTC_DESC(intc_desc_irl0123, "sh7785-irl0123", vectors_irl0123,
283 NULL, NULL, mask_registers, NULL, NULL);
284
285static DECLARE_INTC_DESC(intc_desc_irl4567, "sh7785-irl4567", vectors_irl4567,
286 NULL, NULL, mask_registers, NULL, NULL);
287
288#define INTC_ICR0 0xffd00000
289#define INTC_INTMSK0 0xffd00044
290#define INTC_INTMSK1 0xffd00048
291#define INTC_INTMSK2 0xffd40080
292#define INTC_INTMSKCLR1 0xffd00068
293#define INTC_INTMSKCLR2 0xffd40084
294
113void __init plat_irq_setup(void) 295void __init plat_irq_setup(void)
114{ 296{
115 register_intc2_controller(&intc2_irq_desc); 297 /* disable IRQ3-0 + IRQ7-4 */
298 ctrl_outl(0xff000000, INTC_INTMSK0);
299
300 /* disable IRL3-0 + IRL7-4 */
301 ctrl_outl(0xc0000000, INTC_INTMSK1);
302 ctrl_outl(0xfffefffe, INTC_INTMSK2);
303
304 /* select IRL mode for IRL3-0 + IRL7-4 */
305 ctrl_outl(ctrl_inl(INTC_ICR0) & ~0x00c00000, INTC_ICR0);
306
307 /* disable holding function, ie enable "SH-4 Mode" */
308 ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00200000, INTC_ICR0);
309
310 register_intc_controller(&intc_desc);
311}
312
313void __init plat_irq_setup_pins(int mode)
314{
315 switch (mode) {
316 case IRQ_MODE_IRQ7654:
317 /* select IRQ mode for IRL7-4 */
318 ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00400000, INTC_ICR0);
319 register_intc_controller(&intc_desc_irq4567);
320 break;
321 case IRQ_MODE_IRQ3210:
322 /* select IRQ mode for IRL3-0 */
323 ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00800000, INTC_ICR0);
324 register_intc_controller(&intc_desc_irq0123);
325 break;
326 case IRQ_MODE_IRL7654:
327 /* enable IRL7-4 but don't provide any masking */
328 ctrl_outl(0x40000000, INTC_INTMSKCLR1);
329 ctrl_outl(0x0000fffe, INTC_INTMSKCLR2);
330 break;
331 case IRQ_MODE_IRL3210:
332 /* enable IRL0-3 but don't provide any masking */
333 ctrl_outl(0x80000000, INTC_INTMSKCLR1);
334 ctrl_outl(0xfffe0000, INTC_INTMSKCLR2);
335 break;
336 case IRQ_MODE_IRL7654_MASK:
337 /* enable IRL7-4 and mask using cpu intc controller */
338 ctrl_outl(0x40000000, INTC_INTMSKCLR1);
339 register_intc_controller(&intc_desc_irl4567);
340 break;
341 case IRQ_MODE_IRL3210_MASK:
342 /* enable IRL0-3 and mask using cpu intc controller */
343 ctrl_outl(0x80000000, INTC_INTMSKCLR1);
344 register_intc_controller(&intc_desc_irl0123);
345 break;
346 default:
347 BUG();
348 }
116} 349}
117 350
351void __init plat_mem_setup(void)
352{
353 /* Register the URAM space as Node 1 */
354 setup_bootmem_node(1, 0xe55f0000, 0xe5610000);
355}
diff --git a/arch/sh/kernel/cpu/sh4a/setup-shx3.c b/arch/sh/kernel/cpu/sh4a/setup-shx3.c
index 704c064f70dc..c6cdd7e3b049 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-shx3.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-shx3.c
@@ -11,6 +11,7 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <linux/io.h> 13#include <linux/io.h>
14#include <asm/mmzone.h>
14#include <asm/sci.h> 15#include <asm/sci.h>
15 16
16static struct plat_sci_port sci_platform_data[] = { 17static struct plat_sci_port sci_platform_data[] = {
@@ -58,28 +59,229 @@ static int __init shx3_devices_setup(void)
58} 59}
59__initcall(shx3_devices_setup); 60__initcall(shx3_devices_setup);
60 61
61static struct intc2_data intc2_irq_table[] = { 62enum {
62 { 16, 0, 0, 0, 1, 2 }, /* TMU0 */ 63 UNUSED = 0,
63 { 40, 4, 0, 0x20, 0, 3 }, /* SCIF0 ERI */ 64
64 { 41, 4, 0, 0x20, 1, 3 }, /* SCIF0 RXI */ 65 /* interrupt sources */
65 { 42, 4, 0, 0x20, 2, 3 }, /* SCIF0 BRI */ 66 IRL_LLLL, IRL_LLLH, IRL_LLHL, IRL_LLHH,
66 { 43, 4, 0, 0x20, 3, 3 }, /* SCIF0 TXI */ 67 IRL_LHLL, IRL_LHLH, IRL_LHHL, IRL_LHHH,
68 IRL_HLLL, IRL_HLLH, IRL_HLHL, IRL_HLHH,
69 IRL_HHLL, IRL_HHLH, IRL_HHHL,
70 IRQ0, IRQ1, IRQ2, IRQ3,
71 HUDII,
72 TMU0, TMU1, TMU2, TMU3, TMU4, TMU5,
73 PCII0, PCII1, PCII2, PCII3, PCII4,
74 PCII5, PCII6, PCII7, PCII8, PCII9,
75 SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI,
76 SCIF1_ERI, SCIF1_RXI, SCIF1_BRI, SCIF1_TXI,
77 SCIF2_ERI, SCIF2_RXI, SCIF2_BRI, SCIF2_TXI,
78 SCIF3_ERI, SCIF3_RXI, SCIF3_BRI, SCIF3_TXI,
79 DMAC0_DMINT0, DMAC0_DMINT1, DMAC0_DMINT2, DMAC0_DMINT3,
80 DMAC0_DMINT4, DMAC0_DMINT5, DMAC0_DMAE,
81 DU,
82 DMAC1_DMINT6, DMAC1_DMINT7, DMAC1_DMINT8, DMAC1_DMINT9,
83 DMAC1_DMINT10, DMAC1_DMINT11, DMAC1_DMAE,
84 IIC, VIN0, VIN1, VCORE0, ATAPI,
85 DTU0_TEND, DTU0_AE, DTU0_TMISS,
86 DTU1_TEND, DTU1_AE, DTU1_TMISS,
87 DTU2_TEND, DTU2_AE, DTU2_TMISS,
88 DTU3_TEND, DTU3_AE, DTU3_TMISS,
89 FE0, FE1,
90 GPIO0, GPIO1, GPIO2, GPIO3,
91 PAM, IRM,
92 INTICI0, INTICI1, INTICI2, INTICI3,
93 INTICI4, INTICI5, INTICI6, INTICI7,
94
95 /* interrupt groups */
96 IRL, PCII56789, SCIF0, SCIF1, SCIF2, SCIF3,
97 DMAC0, DMAC1, DTU0, DTU1, DTU2, DTU3,
98};
99
100static struct intc_vect vectors[] __initdata = {
101 INTC_VECT(HUDII, 0x3e0),
102 INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
103 INTC_VECT(TMU2, 0x440), INTC_VECT(TMU3, 0x460),
104 INTC_VECT(TMU4, 0x480), INTC_VECT(TMU5, 0x4a0),
105 INTC_VECT(PCII0, 0x500), INTC_VECT(PCII1, 0x520),
106 INTC_VECT(PCII2, 0x540), INTC_VECT(PCII3, 0x560),
107 INTC_VECT(PCII4, 0x580), INTC_VECT(PCII5, 0x5a0),
108 INTC_VECT(PCII6, 0x5c0), INTC_VECT(PCII7, 0x5e0),
109 INTC_VECT(PCII8, 0x600), INTC_VECT(PCII9, 0x620),
110 INTC_VECT(SCIF0_ERI, 0x700), INTC_VECT(SCIF0_RXI, 0x720),
111 INTC_VECT(SCIF0_BRI, 0x740), INTC_VECT(SCIF0_TXI, 0x760),
112 INTC_VECT(SCIF1_ERI, 0x780), INTC_VECT(SCIF1_RXI, 0x7a0),
113 INTC_VECT(SCIF1_BRI, 0x7c0), INTC_VECT(SCIF1_TXI, 0x7e0),
114 INTC_VECT(SCIF2_ERI, 0x800), INTC_VECT(SCIF2_RXI, 0x820),
115 INTC_VECT(SCIF2_BRI, 0x840), INTC_VECT(SCIF2_TXI, 0x860),
116 INTC_VECT(SCIF3_ERI, 0x880), INTC_VECT(SCIF3_RXI, 0x8a0),
117 INTC_VECT(SCIF3_BRI, 0x8c0), INTC_VECT(SCIF3_TXI, 0x8e0),
118 INTC_VECT(DMAC0_DMINT0, 0x900), INTC_VECT(DMAC0_DMINT1, 0x920),
119 INTC_VECT(DMAC0_DMINT2, 0x940), INTC_VECT(DMAC0_DMINT3, 0x960),
120 INTC_VECT(DMAC0_DMINT4, 0x980), INTC_VECT(DMAC0_DMINT5, 0x9a0),
121 INTC_VECT(DMAC0_DMAE, 0x9c0),
122 INTC_VECT(DU, 0x9e0),
123 INTC_VECT(DMAC1_DMINT6, 0xa00), INTC_VECT(DMAC1_DMINT7, 0xa20),
124 INTC_VECT(DMAC1_DMINT8, 0xa40), INTC_VECT(DMAC1_DMINT9, 0xa60),
125 INTC_VECT(DMAC1_DMINT10, 0xa80), INTC_VECT(DMAC1_DMINT11, 0xaa0),
126 INTC_VECT(DMAC1_DMAE, 0xac0),
127 INTC_VECT(IIC, 0xae0),
128 INTC_VECT(VIN0, 0xb00), INTC_VECT(VIN1, 0xb20),
129 INTC_VECT(VCORE0, 0xb00), INTC_VECT(ATAPI, 0xb60),
130 INTC_VECT(DTU0_TEND, 0xc00), INTC_VECT(DTU0_AE, 0xc20),
131 INTC_VECT(DTU0_TMISS, 0xc40),
132 INTC_VECT(DTU1_TEND, 0xc60), INTC_VECT(DTU1_AE, 0xc80),
133 INTC_VECT(DTU1_TMISS, 0xca0),
134 INTC_VECT(DTU2_TEND, 0xcc0), INTC_VECT(DTU2_AE, 0xce0),
135 INTC_VECT(DTU2_TMISS, 0xd00),
136 INTC_VECT(DTU3_TEND, 0xd20), INTC_VECT(DTU3_AE, 0xd40),
137 INTC_VECT(DTU3_TMISS, 0xd60),
138 INTC_VECT(FE0, 0xe00), INTC_VECT(FE1, 0xe20),
139 INTC_VECT(GPIO0, 0xe40), INTC_VECT(GPIO1, 0xe60),
140 INTC_VECT(GPIO2, 0xe80), INTC_VECT(GPIO3, 0xea0),
141 INTC_VECT(PAM, 0xec0), INTC_VECT(IRM, 0xee0),
142 INTC_VECT(INTICI0, 0xf00), INTC_VECT(INTICI1, 0xf20),
143 INTC_VECT(INTICI2, 0xf40), INTC_VECT(INTICI3, 0xf60),
144 INTC_VECT(INTICI4, 0xf80), INTC_VECT(INTICI5, 0xfa0),
145 INTC_VECT(INTICI6, 0xfc0), INTC_VECT(INTICI7, 0xfe0),
67}; 146};
68 147
69static struct intc2_desc intc2_irq_desc __read_mostly = { 148static struct intc_group groups[] __initdata = {
70 .prio_base = 0xfe410000, 149 INTC_GROUP(IRL, IRL_LLLL, IRL_LLLH, IRL_LLHL, IRL_LLHH,
71 .msk_base = 0xfe410820, 150 IRL_LHLL, IRL_LHLH, IRL_LHHL, IRL_LHHH,
72 .mskclr_base = 0xfe410850, 151 IRL_HLLL, IRL_HLLH, IRL_HLHL, IRL_HLHH,
152 IRL_HHLL, IRL_HHLH, IRL_HHHL),
153 INTC_GROUP(PCII56789, PCII5, PCII6, PCII7, PCII8, PCII9),
154 INTC_GROUP(SCIF0, SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI),
155 INTC_GROUP(SCIF1, SCIF1_ERI, SCIF1_RXI, SCIF1_BRI, SCIF1_TXI),
156 INTC_GROUP(SCIF2, SCIF2_ERI, SCIF2_RXI, SCIF2_BRI, SCIF2_TXI),
157 INTC_GROUP(SCIF3, SCIF3_ERI, SCIF3_RXI, SCIF3_BRI, SCIF3_TXI),
158 INTC_GROUP(DMAC0, DMAC0_DMINT0, DMAC0_DMINT1, DMAC0_DMINT2,
159 DMAC0_DMINT3, DMAC0_DMINT4, DMAC0_DMINT5, DMAC0_DMAE),
160 INTC_GROUP(DMAC1, DMAC1_DMINT6, DMAC1_DMINT7, DMAC1_DMINT8,
161 DMAC1_DMINT9, DMAC1_DMINT10, DMAC1_DMINT11),
162 INTC_GROUP(DTU0, DTU0_TEND, DTU0_AE, DTU0_TMISS),
163 INTC_GROUP(DTU1, DTU1_TEND, DTU1_AE, DTU1_TMISS),
164 INTC_GROUP(DTU2, DTU2_TEND, DTU2_AE, DTU2_TMISS),
165 INTC_GROUP(DTU3, DTU3_TEND, DTU3_AE, DTU3_TMISS),
166};
73 167
74 .intc2_data = intc2_irq_table, 168static struct intc_prio priorities[] __initdata = {
75 .nr_irqs = ARRAY_SIZE(intc2_irq_table), 169 INTC_PRIO(SCIF0, 3),
170 INTC_PRIO(SCIF1, 3),
171 INTC_PRIO(SCIF2, 3),
172 INTC_PRIO(SCIF3, 3),
173};
76 174
77 .chip = { 175static struct intc_mask_reg mask_registers[] __initdata = {
78 .name = "INTC2-SHX3", 176 { 0xfe410030, 0xfe410050, 32, /* CnINTMSK0 / CnINTMSKCLR0 */
79 }, 177 { IRQ0, IRQ1, IRQ2, IRQ3 } },
178 { 0xfe410040, 0xfe410060, 32, /* CnINTMSK1 / CnINTMSKCLR1 */
179 { IRL } },
180 { 0xfe410820, 0xfe410850, 32, /* CnINT2MSK0 / CnINT2MSKCLR0 */
181 { FE1, FE0, 0, ATAPI, VCORE0, VIN1, VIN0, IIC,
182 DU, GPIO3, GPIO2, GPIO1, GPIO0, PAM, 0, 0,
183 0, 0, 0, 0, 0, 0, 0, 0, /* HUDI bits ignored */
184 0, TMU5, TMU4, TMU3, TMU2, TMU1, TMU0, 0, } },
185 { 0xfe410830, 0xfe410860, 32, /* CnINT2MSK1 / CnINT2MSKCLR1 */
186 { 0, 0, 0, 0, DTU3, DTU2, DTU1, DTU0, /* IRM bits ignored */
187 PCII9, PCII8, PCII7, PCII6, PCII5, PCII4, PCII3, PCII2,
188 PCII1, PCII0, DMAC1_DMAE, DMAC1_DMINT11,
189 DMAC1_DMINT10, DMAC1_DMINT9, DMAC1_DMINT8, DMAC1_DMINT7,
190 DMAC1_DMINT6, DMAC0_DMAE, DMAC0_DMINT5, DMAC0_DMINT4,
191 DMAC0_DMINT3, DMAC0_DMINT2, DMAC0_DMINT1, DMAC0_DMINT0 } },
192 { 0xfe410840, 0xfe410870, 32, /* CnINT2MSK2 / CnINT2MSKCLR2 */
193 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
194 SCIF3_TXI, SCIF3_BRI, SCIF3_RXI, SCIF3_ERI,
195 SCIF2_TXI, SCIF2_BRI, SCIF2_RXI, SCIF2_ERI,
196 SCIF1_TXI, SCIF1_BRI, SCIF1_RXI, SCIF1_ERI,
197 SCIF0_TXI, SCIF0_BRI, SCIF0_RXI, SCIF0_ERI } },
198};
199
200static struct intc_prio_reg prio_registers[] __initdata = {
201 { 0xfe410010, 0, 32, 4, /* INTPRI */ { IRQ0, IRQ1, IRQ2, IRQ3 } },
202
203 { 0xfe410800, 0, 32, 4, /* INT2PRI0 */ { 0, HUDII, TMU5, TMU4,
204 TMU3, TMU2, TMU1, TMU0 } },
205 { 0xfe410804, 0, 32, 4, /* INT2PRI1 */ { DTU3, DTU2, DTU1, DTU0,
206 SCIF3, SCIF2,
207 SCIF1, SCIF0 } },
208 { 0xfe410808, 0, 32, 4, /* INT2PRI2 */ { DMAC1, DMAC0,
209 PCII56789, PCII4,
210 PCII3, PCII2,
211 PCII1, PCII0 } },
212 { 0xfe41080c, 0, 32, 4, /* INT2PRI3 */ { FE1, FE0, ATAPI, VCORE0,
213 VIN1, VIN0, IIC, DU} },
214 { 0xfe410810, 0, 32, 4, /* INT2PRI4 */ { 0, 0, PAM, GPIO3,
215 GPIO2, GPIO1, GPIO0, IRM } },
216 { 0xfe410090, 0xfe4100a0, 32, 4, /* CnICIPRI / CnICIPRICLR */
217 { INTICI7, INTICI6, INTICI5, INTICI4,
218 INTICI3, INTICI2, INTICI1, INTICI0 }, INTC_SMP(4, 4) },
219};
220
221static DECLARE_INTC_DESC(intc_desc, "shx3", vectors, groups, priorities,
222 mask_registers, prio_registers, NULL);
223
224/* Support for external interrupt pins in IRQ mode */
225static struct intc_vect vectors_irq[] __initdata = {
226 INTC_VECT(IRQ0, 0x240), INTC_VECT(IRQ1, 0x280),
227 INTC_VECT(IRQ2, 0x2c0), INTC_VECT(IRQ3, 0x300),
228};
229
230static struct intc_sense_reg sense_registers[] __initdata = {
231 { 0xfe41001c, 32, 2, /* ICR1 */ { IRQ0, IRQ1, IRQ2, IRQ3 } },
80}; 232};
81 233
234static DECLARE_INTC_DESC(intc_desc_irq, "shx3-irq", vectors_irq, groups,
235 priorities, mask_registers, prio_registers,
236 sense_registers);
237
238/* External interrupt pins in IRL mode */
239static struct intc_vect vectors_irl[] __initdata = {
240 INTC_VECT(IRL_LLLL, 0x200), INTC_VECT(IRL_LLLH, 0x220),
241 INTC_VECT(IRL_LLHL, 0x240), INTC_VECT(IRL_LLHH, 0x260),
242 INTC_VECT(IRL_LHLL, 0x280), INTC_VECT(IRL_LHLH, 0x2a0),
243 INTC_VECT(IRL_LHHL, 0x2c0), INTC_VECT(IRL_LHHH, 0x2e0),
244 INTC_VECT(IRL_HLLL, 0x300), INTC_VECT(IRL_HLLH, 0x320),
245 INTC_VECT(IRL_HLHL, 0x340), INTC_VECT(IRL_HLHH, 0x360),
246 INTC_VECT(IRL_HHLL, 0x380), INTC_VECT(IRL_HHLH, 0x3a0),
247 INTC_VECT(IRL_HHHL, 0x3c0),
248};
249
250static DECLARE_INTC_DESC(intc_desc_irl, "shx3-irl", vectors_irl, groups,
251 priorities, mask_registers, prio_registers, NULL);
252
253void __init plat_irq_setup_pins(int mode)
254{
255 switch (mode) {
256 case IRQ_MODE_IRQ:
257 register_intc_controller(&intc_desc_irq);
258 break;
259 case IRQ_MODE_IRL3210:
260 register_intc_controller(&intc_desc_irl);
261 break;
262 default:
263 BUG();
264 }
265}
266
82void __init plat_irq_setup(void) 267void __init plat_irq_setup(void)
83{ 268{
84 register_intc2_controller(&intc2_irq_desc); 269 register_intc_controller(&intc_desc);
270}
271
272void __init plat_mem_setup(void)
273{
274 unsigned int nid = 1;
275
276 /* Register CPU#0 URAM space as Node 1 */
277 setup_bootmem_node(nid++, 0x145f0000, 0x14610000); /* CPU0 */
278
279#if 0
280 /* XXX: Not yet.. */
281 setup_bootmem_node(nid++, 0x14df0000, 0x14e10000); /* CPU1 */
282 setup_bootmem_node(nid++, 0x155f0000, 0x15610000); /* CPU2 */
283 setup_bootmem_node(nid++, 0x15df0000, 0x15e10000); /* CPU3 */
284#endif
285
286 setup_bootmem_node(nid++, 0x16000000, 0x16020000); /* CSM */
85} 287}
diff --git a/arch/sh/kernel/cpu/sh4a/smp-shx3.c b/arch/sh/kernel/cpu/sh4a/smp-shx3.c
new file mode 100644
index 000000000000..e5e06845fa43
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh4a/smp-shx3.c
@@ -0,0 +1,120 @@
1/*
2 * SH-X3 SMP
3 *
4 * Copyright (C) 2007 Paul Mundt
5 * Copyright (C) 2007 Magnus Damm
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#include <linux/init.h>
12#include <linux/cpumask.h>
13#include <linux/smp.h>
14#include <linux/interrupt.h>
15#include <linux/io.h>
16
17void __init plat_smp_setup(void)
18{
19 unsigned int cpu = 0;
20 int i, num;
21
22 cpus_clear(cpu_possible_map);
23 cpu_set(cpu, cpu_possible_map);
24
25 __cpu_number_map[0] = 0;
26 __cpu_logical_map[0] = 0;
27
28 /*
29 * Do this stupidly for now.. we don't have an easy way to probe
30 * for the total number of cores.
31 */
32 for (i = 1, num = 0; i < NR_CPUS; i++) {
33 cpu_set(i, cpu_possible_map);
34 __cpu_number_map[i] = ++num;
35 __cpu_logical_map[num] = i;
36 }
37
38 printk(KERN_INFO "Detected %i available secondary CPU(s)\n", num);
39}
40
41void __init plat_prepare_cpus(unsigned int max_cpus)
42{
43}
44
45#define STBCR_REG(phys_id) (0xfe400004 | (phys_id << 12))
46#define RESET_REG(phys_id) (0xfe400008 | (phys_id << 12))
47
48#define STBCR_MSTP 0x00000001
49#define STBCR_RESET 0x00000002
50#define STBCR_LTSLP 0x80000000
51
52#define STBCR_AP_VAL (STBCR_RESET | STBCR_LTSLP)
53
54void plat_start_cpu(unsigned int cpu, unsigned long entry_point)
55{
56 ctrl_outl(entry_point, RESET_REG(cpu));
57
58 if (!(ctrl_inl(STBCR_REG(cpu)) & STBCR_MSTP))
59 ctrl_outl(STBCR_MSTP, STBCR_REG(cpu));
60
61 while (!(ctrl_inl(STBCR_REG(cpu)) & STBCR_MSTP))
62 ;
63
64 /* Start up secondary processor by sending a reset */
65 ctrl_outl(STBCR_AP_VAL, STBCR_REG(cpu));
66}
67
68int plat_smp_processor_id(void)
69{
70 return ctrl_inl(0xff000048); /* CPIDR */
71}
72
73void plat_send_ipi(unsigned int cpu, unsigned int message)
74{
75 unsigned long addr = 0xfe410070 + (cpu * 4);
76
77 BUG_ON(cpu >= 4);
78 BUG_ON(message >= SMP_MSG_NR);
79
80 ctrl_outl(1 << (message << 2), addr); /* C0INTICI..CnINTICI */
81}
82
83struct ipi_data {
84 void (*handler)(void *);
85 void *arg;
86 unsigned int message;
87};
88
89static irqreturn_t ipi_interrupt_handler(int irq, void *arg)
90{
91 struct ipi_data *id = arg;
92 unsigned int cpu = hard_smp_processor_id();
93 unsigned int offs = 4 * cpu;
94 unsigned int x;
95
96 x = ctrl_inl(0xfe410070 + offs); /* C0INITICI..CnINTICI */
97 x &= (1 << (id->message << 2));
98 ctrl_outl(x, 0xfe410080 + offs); /* C0INTICICLR..CnINTICICLR */
99
100 id->handler(id->arg);
101
102 return IRQ_HANDLED;
103}
104
105static struct ipi_data ipi_handlers[SMP_MSG_NR];
106
107int plat_register_ipi_handler(unsigned int message,
108 void (*handler)(void *), void *arg)
109{
110 struct ipi_data *id = &ipi_handlers[message];
111
112 BUG_ON(SMP_MSG_NR >= 8);
113 BUG_ON(message >= SMP_MSG_NR);
114
115 id->handler = handler;
116 id->arg = arg;
117 id->message = message;
118
119 return request_irq(104 + message, ipi_interrupt_handler, 0, "IPI", id);
120}
diff --git a/arch/sh/kernel/cpufreq.c b/arch/sh/kernel/cpufreq.c
index e61890217c50..e0590ffebd73 100644
--- a/arch/sh/kernel/cpufreq.c
+++ b/arch/sh/kernel/cpufreq.c
@@ -77,8 +77,6 @@ static int sh_cpufreq_target(struct cpufreq_policy *policy,
77 77
78static int sh_cpufreq_cpu_init(struct cpufreq_policy *policy) 78static int sh_cpufreq_cpu_init(struct cpufreq_policy *policy)
79{ 79{
80 printk(KERN_INFO "cpufreq: SuperH CPU frequency driver.\n");
81
82 if (!cpu_online(policy->cpu)) 80 if (!cpu_online(policy->cpu))
83 return -ENODEV; 81 return -ENODEV;
84 82
@@ -93,7 +91,6 @@ static int sh_cpufreq_cpu_init(struct cpufreq_policy *policy)
93 policy->cpuinfo.max_freq = (clk_round_rate(cpuclk, ~0UL) + 500) / 1000; 91 policy->cpuinfo.max_freq = (clk_round_rate(cpuclk, ~0UL) + 500) / 1000;
94 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; 92 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
95 93
96 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
97 policy->cur = sh_cpufreq_get(policy->cpu); 94 policy->cur = sh_cpufreq_get(policy->cpu);
98 policy->min = policy->cpuinfo.min_freq; 95 policy->min = policy->cpuinfo.min_freq;
99 policy->max = policy->cpuinfo.max_freq; 96 policy->max = policy->cpuinfo.max_freq;
@@ -144,6 +141,7 @@ static struct cpufreq_driver sh_cpufreq_driver = {
144 141
145static int __init sh_cpufreq_module_init(void) 142static int __init sh_cpufreq_module_init(void)
146{ 143{
144 printk(KERN_INFO "cpufreq: SuperH CPU frequency driver.\n");
147 return cpufreq_register_driver(&sh_cpufreq_driver); 145 return cpufreq_register_driver(&sh_cpufreq_driver);
148} 146}
149 147
diff --git a/arch/sh/kernel/early_printk.c b/arch/sh/kernel/early_printk.c
index 80b637c30203..2f30977558ad 100644
--- a/arch/sh/kernel/early_printk.c
+++ b/arch/sh/kernel/early_printk.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 1999, 2000 Niibe Yutaka 4 * Copyright (C) 1999, 2000 Niibe Yutaka
5 * Copyright (C) 2002 M. R. Brown 5 * Copyright (C) 2002 M. R. Brown
6 * Copyright (C) 2004 - 2006 Paul Mundt 6 * Copyright (C) 2004 - 2007 Paul Mundt
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
@@ -13,6 +13,7 @@
13#include <linux/tty.h> 13#include <linux/tty.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/delay.h>
16 17
17#ifdef CONFIG_SH_STANDARD_BIOS 18#ifdef CONFIG_SH_STANDARD_BIOS
18#include <asm/sh_bios.h> 19#include <asm/sh_bios.h>
@@ -62,6 +63,16 @@ static struct console bios_console = {
62#include <linux/serial_core.h> 63#include <linux/serial_core.h>
63#include "../../../drivers/serial/sh-sci.h" 64#include "../../../drivers/serial/sh-sci.h"
64 65
66#if defined(CONFIG_CPU_SUBTYPE_SH7720)
67#define EPK_SCSMR_VALUE 0x000
68#define EPK_SCBRR_VALUE 0x00C
69#define EPK_FIFO_SIZE 64
70#define EPK_FIFO_BITS (0x7f00 >> 8)
71#else
72#define EPK_FIFO_SIZE 16
73#define EPK_FIFO_BITS (0x1f00 >> 8)
74#endif
75
65static struct uart_port scif_port = { 76static struct uart_port scif_port = {
66 .mapbase = CONFIG_EARLY_SCIF_CONSOLE_PORT, 77 .mapbase = CONFIG_EARLY_SCIF_CONSOLE_PORT,
67 .membase = (char __iomem *)CONFIG_EARLY_SCIF_CONSOLE_PORT, 78 .membase = (char __iomem *)CONFIG_EARLY_SCIF_CONSOLE_PORT,
@@ -69,7 +80,7 @@ static struct uart_port scif_port = {
69 80
70static void scif_sercon_putc(int c) 81static void scif_sercon_putc(int c)
71{ 82{
72 while (((sci_in(&scif_port, SCFDR) & 0x1f00 >> 8) == 16)) 83 while (((sci_in(&scif_port, SCFDR) & EPK_FIFO_BITS) >= EPK_FIFO_SIZE))
73 ; 84 ;
74 85
75 sci_out(&scif_port, SCxTDR, c); 86 sci_out(&scif_port, SCxTDR, c);
@@ -105,7 +116,22 @@ static struct console scif_console = {
105 .index = -1, 116 .index = -1,
106}; 117};
107 118
108#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_SH_STANDARD_BIOS) 119#if !defined(CONFIG_SH_STANDARD_BIOS)
120#if defined(CONFIG_CPU_SUBTYPE_SH7720)
121static void scif_sercon_init(char *s)
122{
123 sci_out(&scif_port, SCSCR, 0x0000); /* clear TE and RE */
124 sci_out(&scif_port, SCFCR, 0x4006); /* reset */
125 sci_out(&scif_port, SCSCR, 0x0000); /* select internal clock */
126 sci_out(&scif_port, SCSMR, EPK_SCSMR_VALUE);
127 sci_out(&scif_port, SCBRR, EPK_SCBRR_VALUE);
128
129 mdelay(1); /* wait 1-bit time */
130
131 sci_out(&scif_port, SCFCR, 0x0030); /* TTRG=b'11 */
132 sci_out(&scif_port, SCSCR, 0x0030); /* TE, RE */
133}
134#elif defined(CONFIG_CPU_SH4)
109#define DEFAULT_BAUD 115200 135#define DEFAULT_BAUD 115200
110/* 136/*
111 * Simple SCIF init, primarily aimed at SH7750 and other similar SH-4 137 * Simple SCIF init, primarily aimed at SH7750 and other similar SH-4
@@ -146,7 +172,8 @@ static void scif_sercon_init(char *s)
146 ctrl_outw(0, scif_port.mapbase + 36); 172 ctrl_outw(0, scif_port.mapbase + 36);
147 ctrl_outw(0x30, scif_port.mapbase + 8); 173 ctrl_outw(0x30, scif_port.mapbase + 8);
148} 174}
149#endif /* CONFIG_CPU_SH4 && !CONFIG_SH_STANDARD_BIOS */ 175#endif /* defined(CONFIG_CPU_SUBTYPE_SH7720) */
176#endif /* !defined(CONFIG_SH_STANDARD_BIOS) */
150#endif /* CONFIG_EARLY_SCIF_CONSOLE */ 177#endif /* CONFIG_EARLY_SCIF_CONSOLE */
151 178
152/* 179/*
@@ -163,17 +190,12 @@ static struct console *early_console =
163#endif 190#endif
164 ; 191 ;
165 192
166static int __initdata keep_early; 193static int __init setup_early_printk(char *buf)
167static int early_console_initialized;
168
169int __init setup_early_printk(char *buf)
170{ 194{
171 if (!buf) 195 int keep_early = 0;
172 return 0;
173 196
174 if (early_console_initialized) 197 if (!buf)
175 return 0; 198 return 0;
176 early_console_initialized = 1;
177 199
178 if (strstr(buf, "keep")) 200 if (strstr(buf, "keep"))
179 keep_early = 1; 201 keep_early = 1;
@@ -186,7 +208,8 @@ int __init setup_early_printk(char *buf)
186 if (!strncmp(buf, "serial", 6)) { 208 if (!strncmp(buf, "serial", 6)) {
187 early_console = &scif_console; 209 early_console = &scif_console;
188 210
189#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_SH_STANDARD_BIOS) 211#if (defined(CONFIG_CPU_SH4) || defined(CONFIG_CPU_SUBTYPE_SH7720)) && \
212 !defined(CONFIG_SH_STANDARD_BIOS)
190 scif_sercon_init(buf + 6); 213 scif_sercon_init(buf + 6);
191#endif 214#endif
192 } 215 }
diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S
index b46728027195..e0317ed080c3 100644
--- a/arch/sh/kernel/entry-common.S
+++ b/arch/sh/kernel/entry-common.S
@@ -176,7 +176,7 @@ work_notifysig:
176 jmp @r1 176 jmp @r1
177 lds r0, pr 177 lds r0, pr
178work_resched: 178work_resched:
179#ifndef CONFIG_PREEMPT 179#if defined(CONFIG_GUSA) && !defined(CONFIG_PREEMPT)
180 ! gUSA handling 180 ! gUSA handling
181 mov.l @(OFF_SP,r15), r0 ! get user space stack pointer 181 mov.l @(OFF_SP,r15), r0 ! get user space stack pointer
182 mov r0, r1 182 mov r0, r1
diff --git a/arch/sh/kernel/head.S b/arch/sh/kernel/head.S
index 0bccc0ca5a0f..3338239717f1 100644
--- a/arch/sh/kernel/head.S
+++ b/arch/sh/kernel/head.S
@@ -54,8 +54,8 @@ ENTRY(_stext)
54 mov.l 1f, r0 ! MD=1, RB=0, BL=0, IMASK=0xF 54 mov.l 1f, r0 ! MD=1, RB=0, BL=0, IMASK=0xF
55 ldc r0, sr 55 ldc r0, sr
56 ! Initialize global interrupt mask 56 ! Initialize global interrupt mask
57 mov #0, r0
58#ifdef CONFIG_CPU_HAS_SR_RB 57#ifdef CONFIG_CPU_HAS_SR_RB
58 mov #0, r0
59 ldc r0, r6_bank 59 ldc r0, r6_bank
60#endif 60#endif
61 61
@@ -72,15 +72,18 @@ ENTRY(_stext)
72 ! 72 !
73 mov.l 2f, r0 73 mov.l 2f, r0
74 mov r0, r15 ! Set initial r15 (stack pointer) 74 mov r0, r15 ! Set initial r15 (stack pointer)
75 mov #(THREAD_SIZE >> 10), r1
76 shll8 r1 ! r1 = THREAD_SIZE
77 shll2 r1
78 sub r1, r0 !
79#ifdef CONFIG_CPU_HAS_SR_RB 75#ifdef CONFIG_CPU_HAS_SR_RB
76 mov.l 7f, r0
80 ldc r0, r7_bank ! ... and initial thread_info 77 ldc r0, r7_bank ! ... and initial thread_info
81#endif 78#endif
82 79
83 ! Clear BSS area 80 ! Clear BSS area
81#ifdef CONFIG_SMP
82 mov.l 3f, r0
83 cmp/eq #0, r0 ! skip clear if set to zero
84 bt 10f
85#endif
86
84 mov.l 3f, r1 87 mov.l 3f, r1
85 add #4, r1 88 add #4, r1
86 mov.l 4f, r2 89 mov.l 4f, r2
@@ -89,13 +92,14 @@ ENTRY(_stext)
89 bf/s 9b ! while (r1 < r2) 92 bf/s 9b ! while (r1 < r2)
90 mov.l r0,@-r2 93 mov.l r0,@-r2
91 94
9510:
92 ! Additional CPU initialization 96 ! Additional CPU initialization
93 mov.l 6f, r0 97 mov.l 6f, r0
94 jsr @r0 98 jsr @r0
95 nop 99 nop
96 100
97 SYNCO() ! Wait for pending instructions.. 101 SYNCO() ! Wait for pending instructions..
98 102
99 ! Start kernel 103 ! Start kernel
100 mov.l 5f, r0 104 mov.l 5f, r0
101 jmp @r0 105 jmp @r0
@@ -107,8 +111,10 @@ ENTRY(_stext)
107#else 111#else
1081: .long 0x400080F0 ! MD=1, RB=0, BL=0, FD=1, IMASK=0xF 1121: .long 0x400080F0 ! MD=1, RB=0, BL=0, FD=1, IMASK=0xF
109#endif 113#endif
114ENTRY(stack_start)
1102: .long init_thread_union+THREAD_SIZE 1152: .long init_thread_union+THREAD_SIZE
1113: .long __bss_start 1163: .long __bss_start
1124: .long _end 1174: .long _end
1135: .long start_kernel 1185: .long start_kernel
1146: .long sh_cpu_init 1196: .long sh_cpu_init
1207: .long init_thread_union
diff --git a/arch/sh/kernel/kgdb_stub.c b/arch/sh/kernel/kgdb_stub.c
index edd1ec214e6d..2fdc700dfd6e 100644
--- a/arch/sh/kernel/kgdb_stub.c
+++ b/arch/sh/kernel/kgdb_stub.c
@@ -150,13 +150,6 @@ struct kgdb_regs trap_registers;
150char kgdb_in_gdb_mode; 150char kgdb_in_gdb_mode;
151char in_nmi; /* Set during NMI to prevent reentry */ 151char in_nmi; /* Set during NMI to prevent reentry */
152int kgdb_nofault; /* Boolean to ignore bus errs (i.e. in GDB) */ 152int kgdb_nofault; /* Boolean to ignore bus errs (i.e. in GDB) */
153int kgdb_enabled = 1; /* Default to enabled, cmdline can disable */
154
155/* Exposed for user access */
156struct task_struct *kgdb_current;
157unsigned int kgdb_g_imask;
158int kgdb_trapa_val;
159int kgdb_excode;
160 153
161/* Default values for SCI (can override via kernel args in setup.c) */ 154/* Default values for SCI (can override via kernel args in setup.c) */
162#ifndef CONFIG_KGDB_DEFPORT 155#ifndef CONFIG_KGDB_DEFPORT
@@ -616,7 +609,7 @@ static short *get_step_address(void)
616 else 609 else
617 addr = trap_registers.pc + 2; 610 addr = trap_registers.pc + 2;
618 611
619 kgdb_flush_icache_range(addr, addr + 2); 612 flush_icache_range(addr, addr + 2);
620 return (short *) addr; 613 return (short *) addr;
621} 614}
622 615
@@ -639,8 +632,7 @@ static void do_single_step(void)
639 *addr = STEP_OPCODE; 632 *addr = STEP_OPCODE;
640 633
641 /* Flush and return */ 634 /* Flush and return */
642 kgdb_flush_icache_range((long) addr, (long) addr + 2); 635 flush_icache_range((long) addr, (long) addr + 2);
643 return;
644} 636}
645 637
646/* Undo a single step */ 638/* Undo a single step */
@@ -650,7 +642,7 @@ static void undo_single_step(void)
650 /* Use stepped_address in case we stopped elsewhere */ 642 /* Use stepped_address in case we stopped elsewhere */
651 if (stepped_opcode != 0) { 643 if (stepped_opcode != 0) {
652 *(short*)stepped_address = stepped_opcode; 644 *(short*)stepped_address = stepped_opcode;
653 kgdb_flush_icache_range(stepped_address, stepped_address + 2); 645 flush_icache_range(stepped_address, stepped_address + 2);
654 } 646 }
655 stepped_opcode = 0; 647 stepped_opcode = 0;
656} 648}
@@ -736,7 +728,7 @@ static void write_mem_msg(int binary)
736 ebin_to_mem(ptr, (char*)addr, length); 728 ebin_to_mem(ptr, (char*)addr, length);
737 else 729 else
738 hex_to_mem(ptr, (char*)addr, length); 730 hex_to_mem(ptr, (char*)addr, length);
739 kgdb_flush_icache_range(addr, addr + length); 731 flush_icache_range(addr, addr + length);
740 ptr = 0; 732 ptr = 0;
741 send_ok_msg(); 733 send_ok_msg();
742 } 734 }
@@ -815,14 +807,10 @@ static void set_regs_msg(void)
815/* 807/*
816 * Bring up the ports.. 808 * Bring up the ports..
817 */ 809 */
818static int kgdb_serial_setup(void) 810static int __init kgdb_serial_setup(void)
819{ 811{
820 extern int kgdb_console_setup(struct console *co, char *options);
821 struct console dummy; 812 struct console dummy;
822 813 return kgdb_console_setup(&dummy, 0);
823 kgdb_console_setup(&dummy, 0);
824
825 return 0;
826} 814}
827#else 815#else
828#define kgdb_serial_setup() 0 816#define kgdb_serial_setup() 0
@@ -833,22 +821,6 @@ static void kgdb_command_loop(const int excep_code, const int trapa_value)
833{ 821{
834 int sigval; 822 int sigval;
835 823
836 if (excep_code == NMI_VEC) {
837#ifndef CONFIG_KGDB_NMI
838 printk(KERN_NOTICE "KGDB: Ignoring unexpected NMI?\n");
839 return;
840#else /* CONFIG_KGDB_NMI */
841 if (!kgdb_enabled) {
842 kgdb_enabled = 1;
843 kgdb_init();
844 }
845#endif /* CONFIG_KGDB_NMI */
846 }
847
848 /* Ignore if we're disabled */
849 if (!kgdb_enabled)
850 return;
851
852 /* Enter GDB mode (e.g. after detach) */ 824 /* Enter GDB mode (e.g. after detach) */
853 if (!kgdb_in_gdb_mode) { 825 if (!kgdb_in_gdb_mode) {
854 /* Do serial setup, notify user, issue preemptive ack */ 826 /* Do serial setup, notify user, issue preemptive ack */
@@ -959,18 +931,10 @@ static void handle_exception(struct pt_regs *regs)
959 931
960 /* Get excode for command loop call, user access */ 932 /* Get excode for command loop call, user access */
961 asm("stc r2_bank, %0":"=r"(excep_code)); 933 asm("stc r2_bank, %0":"=r"(excep_code));
962 kgdb_excode = excep_code;
963
964 /* Other interesting environment items for reference */
965 asm("stc r6_bank, %0":"=r"(kgdb_g_imask));
966 kgdb_current = current;
967 kgdb_trapa_val = trapa_value;
968 934
969 /* Act on the exception */ 935 /* Act on the exception */
970 kgdb_command_loop(excep_code, trapa_value); 936 kgdb_command_loop(excep_code, trapa_value);
971 937
972 kgdb_current = NULL;
973
974 /* Copy back the (maybe modified) registers */ 938 /* Copy back the (maybe modified) registers */
975 for (count = 0; count < 16; count++) 939 for (count = 0; count < 16; count++)
976 regs->regs[count] = trap_registers.regs[count]; 940 regs->regs[count] = trap_registers.regs[count];
@@ -994,11 +958,8 @@ asmlinkage void kgdb_handle_exception(unsigned long r4, unsigned long r5,
994} 958}
995 959
996/* Initialise the KGDB data structures and serial configuration */ 960/* Initialise the KGDB data structures and serial configuration */
997int kgdb_init(void) 961int __init kgdb_init(void)
998{ 962{
999 if (!kgdb_enabled)
1000 return 1;
1001
1002 in_nmi = 0; 963 in_nmi = 0;
1003 kgdb_nofault = 0; 964 kgdb_nofault = 0;
1004 stepped_opcode = 0; 965 stepped_opcode = 0;
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index 15ae322dbd74..b4469992d6b2 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -19,6 +19,7 @@
19#include <linux/tick.h> 19#include <linux/tick.h>
20#include <linux/reboot.h> 20#include <linux/reboot.h>
21#include <linux/fs.h> 21#include <linux/fs.h>
22#include <linux/preempt.h>
22#include <asm/uaccess.h> 23#include <asm/uaccess.h>
23#include <asm/mmu_context.h> 24#include <asm/mmu_context.h>
24#include <asm/pgalloc.h> 25#include <asm/pgalloc.h>
@@ -349,12 +350,11 @@ struct task_struct *__switch_to(struct task_struct *prev,
349 unlazy_fpu(prev, task_pt_regs(prev)); 350 unlazy_fpu(prev, task_pt_regs(prev));
350#endif 351#endif
351 352
352#ifdef CONFIG_PREEMPT 353#if defined(CONFIG_GUSA) && defined(CONFIG_PREEMPT)
353 { 354 {
354 unsigned long flags;
355 struct pt_regs *regs; 355 struct pt_regs *regs;
356 356
357 local_irq_save(flags); 357 preempt_disable();
358 regs = task_pt_regs(prev); 358 regs = task_pt_regs(prev);
359 if (user_mode(regs) && regs->regs[15] >= 0xc0000000) { 359 if (user_mode(regs) && regs->regs[15] >= 0xc0000000) {
360 int offset = (int)regs->regs[15]; 360 int offset = (int)regs->regs[15];
@@ -365,7 +365,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
365 /* Go to rewind point */ 365 /* Go to rewind point */
366 regs->pc = regs->regs[0] + offset; 366 regs->pc = regs->regs[0] + offset;
367 } 367 }
368 local_irq_restore(flags); 368 preempt_enable_no_resched();
369 } 369 }
370#endif 370#endif
371 371
diff --git a/arch/sh/kernel/ptrace.c b/arch/sh/kernel/ptrace.c
index f64a2d2416d4..ac725f0aeb72 100644
--- a/arch/sh/kernel/ptrace.c
+++ b/arch/sh/kernel/ptrace.c
@@ -211,10 +211,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
211 break; 211 break;
212 } 212 }
213 213
214 case PTRACE_DETACH: /* detach a process that was attached. */
215 ret = ptrace_detach(child, data);
216 break;
217
218#ifdef CONFIG_SH_DSP 214#ifdef CONFIG_SH_DSP
219 case PTRACE_GETDSPREGS: { 215 case PTRACE_GETDSPREGS: {
220 unsigned long dp; 216 unsigned long dp;
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index 2cf7dec0d690..b3027a6775b9 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -22,6 +22,7 @@
22#include <linux/mm.h> 22#include <linux/mm.h>
23#include <linux/kexec.h> 23#include <linux/kexec.h>
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/smp.h>
25#include <asm/uaccess.h> 26#include <asm/uaccess.h>
26#include <asm/io.h> 27#include <asm/io.h>
27#include <asm/page.h> 28#include <asm/page.h>
@@ -42,7 +43,13 @@ extern void * __rd_start, * __rd_end;
42 * This value will be used at the very early stage of serial setup. 43 * This value will be used at the very early stage of serial setup.
43 * The bigger value means no problem. 44 * The bigger value means no problem.
44 */ 45 */
45struct sh_cpuinfo boot_cpu_data = { CPU_SH_NONE, 10000000, }; 46struct sh_cpuinfo cpu_data[NR_CPUS] __read_mostly = {
47 [0] = {
48 .type = CPU_SH_NONE,
49 .loops_per_jiffy = 10000000,
50 },
51};
52EXPORT_SYMBOL(cpu_data);
46 53
47/* 54/*
48 * The machine vector. First entry in .machvec.init, or clobbered by 55 * The machine vector. First entry in .machvec.init, or clobbered by
@@ -272,6 +279,10 @@ void __init setup_arch(char **cmdline_p)
272 sh_mv.mv_setup(cmdline_p); 279 sh_mv.mv_setup(cmdline_p);
273 280
274 paging_init(); 281 paging_init();
282
283#ifdef CONFIG_SMP
284 plat_smp_setup();
285#endif
275} 286}
276 287
277static const char *cpu_name[] = { 288static const char *cpu_name[] = {
@@ -279,7 +290,7 @@ static const char *cpu_name[] = {
279 [CPU_SH7705] = "SH7705", [CPU_SH7706] = "SH7706", 290 [CPU_SH7705] = "SH7705", [CPU_SH7706] = "SH7706",
280 [CPU_SH7707] = "SH7707", [CPU_SH7708] = "SH7708", 291 [CPU_SH7707] = "SH7707", [CPU_SH7708] = "SH7708",
281 [CPU_SH7709] = "SH7709", [CPU_SH7710] = "SH7710", 292 [CPU_SH7709] = "SH7709", [CPU_SH7710] = "SH7710",
282 [CPU_SH7712] = "SH7712", 293 [CPU_SH7712] = "SH7712", [CPU_SH7720] = "SH7720",
283 [CPU_SH7729] = "SH7729", [CPU_SH7750] = "SH7750", 294 [CPU_SH7729] = "SH7729", [CPU_SH7750] = "SH7750",
284 [CPU_SH7750S] = "SH7750S", [CPU_SH7750R] = "SH7750R", 295 [CPU_SH7750S] = "SH7750S", [CPU_SH7750R] = "SH7750R",
285 [CPU_SH7751] = "SH7751", [CPU_SH7751R] = "SH7751R", 296 [CPU_SH7751] = "SH7751", [CPU_SH7751R] = "SH7751R",
diff --git a/arch/sh/kernel/sh_ksyms.c b/arch/sh/kernel/sh_ksyms.c
index 37aef0a85197..548e4285b375 100644
--- a/arch/sh/kernel/sh_ksyms.c
+++ b/arch/sh/kernel/sh_ksyms.c
@@ -8,7 +8,7 @@
8#include <linux/vmalloc.h> 8#include <linux/vmalloc.h>
9#include <linux/pci.h> 9#include <linux/pci.h>
10#include <linux/irq.h> 10#include <linux/irq.h>
11 11#include <asm/sections.h>
12#include <asm/semaphore.h> 12#include <asm/semaphore.h>
13#include <asm/processor.h> 13#include <asm/processor.h>
14#include <asm/uaccess.h> 14#include <asm/uaccess.h>
@@ -43,7 +43,6 @@ EXPORT_SYMBOL(memcpy);
43EXPORT_SYMBOL(memset); 43EXPORT_SYMBOL(memset);
44EXPORT_SYMBOL(memmove); 44EXPORT_SYMBOL(memmove);
45EXPORT_SYMBOL(__copy_user); 45EXPORT_SYMBOL(__copy_user);
46EXPORT_SYMBOL(boot_cpu_data);
47 46
48#ifdef CONFIG_MMU 47#ifdef CONFIG_MMU
49EXPORT_SYMBOL(get_vm_area); 48EXPORT_SYMBOL(get_vm_area);
@@ -53,6 +52,7 @@ EXPORT_SYMBOL(get_vm_area);
53EXPORT_SYMBOL(__up); 52EXPORT_SYMBOL(__up);
54EXPORT_SYMBOL(__down); 53EXPORT_SYMBOL(__down);
55EXPORT_SYMBOL(__down_interruptible); 54EXPORT_SYMBOL(__down_interruptible);
55EXPORT_SYMBOL(__down_trylock);
56 56
57EXPORT_SYMBOL(__udelay); 57EXPORT_SYMBOL(__udelay);
58EXPORT_SYMBOL(__ndelay); 58EXPORT_SYMBOL(__ndelay);
@@ -128,7 +128,8 @@ DECLARE_EXPORT(__movstrSI12_i4);
128#endif /* __GNUC__ == 4 */ 128#endif /* __GNUC__ == 4 */
129#endif 129#endif
130 130
131#if defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB) 131#if !defined(CONFIG_CACHE_OFF) && (defined(CONFIG_CPU_SH4) || \
132 defined(CONFIG_SH7705_CACHE_32KB))
132/* needed by some modules */ 133/* needed by some modules */
133EXPORT_SYMBOL(flush_cache_all); 134EXPORT_SYMBOL(flush_cache_all);
134EXPORT_SYMBOL(flush_cache_range); 135EXPORT_SYMBOL(flush_cache_range);
@@ -136,17 +137,11 @@ EXPORT_SYMBOL(flush_dcache_page);
136EXPORT_SYMBOL(__flush_purge_region); 137EXPORT_SYMBOL(__flush_purge_region);
137#endif 138#endif
138 139
139#if defined(CONFIG_MMU) && (defined(CONFIG_CPU_SH4) || \ 140#if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_MMU) && \
140 defined(CONFIG_SH7705_CACHE_32KB)) 141 (defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB))
141EXPORT_SYMBOL(clear_user_page); 142EXPORT_SYMBOL(clear_user_page);
142#endif 143#endif
143 144
144EXPORT_SYMBOL(__down_trylock);
145
146#ifdef CONFIG_SMP
147EXPORT_SYMBOL(synchronize_irq);
148#endif
149
150EXPORT_SYMBOL(csum_partial); 145EXPORT_SYMBOL(csum_partial);
151EXPORT_SYMBOL(csum_partial_copy_generic); 146EXPORT_SYMBOL(csum_partial_copy_generic);
152#ifdef CONFIG_IPV6 147#ifdef CONFIG_IPV6
@@ -154,3 +149,4 @@ EXPORT_SYMBOL(csum_ipv6_magic);
154#endif 149#endif
155EXPORT_SYMBOL(clear_page); 150EXPORT_SYMBOL(clear_page);
156EXPORT_SYMBOL(__clear_user); 151EXPORT_SYMBOL(__clear_user);
152EXPORT_SYMBOL(_ebss);
diff --git a/arch/sh/kernel/signal.c b/arch/sh/kernel/signal.c
index 706d81ccd101..2f42442cf164 100644
--- a/arch/sh/kernel/signal.c
+++ b/arch/sh/kernel/signal.c
@@ -507,13 +507,11 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
507 ctrl_inw(regs->pc - 4)); 507 ctrl_inw(regs->pc - 4));
508 break; 508 break;
509 } 509 }
510#ifdef CONFIG_GUSA
510 } else { 511 } else {
511 /* gUSA handling */ 512 /* gUSA handling */
512#ifdef CONFIG_PREEMPT 513 preempt_disable();
513 unsigned long flags;
514 514
515 local_irq_save(flags);
516#endif
517 if (regs->regs[15] >= 0xc0000000) { 515 if (regs->regs[15] >= 0xc0000000) {
518 int offset = (int)regs->regs[15]; 516 int offset = (int)regs->regs[15];
519 517
@@ -524,8 +522,8 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
524 regs->pc = regs->regs[0] + offset - 522 regs->pc = regs->regs[0] + offset -
525 instruction_size(ctrl_inw(regs->pc-4)); 523 instruction_size(ctrl_inw(regs->pc-4));
526 } 524 }
527#ifdef CONFIG_PREEMPT 525
528 local_irq_restore(flags); 526 preempt_enable_no_resched();
529#endif 527#endif
530 } 528 }
531 529
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c
index 283e1425ced5..94075e1a1e61 100644
--- a/arch/sh/kernel/smp.c
+++ b/arch/sh/kernel/smp.c
@@ -3,68 +3,40 @@
3 * 3 *
4 * SMP support for the SuperH processors. 4 * SMP support for the SuperH processors.
5 * 5 *
6 * Copyright (C) 2002, 2003 Paul Mundt 6 * Copyright (C) 2002 - 2007 Paul Mundt
7 * Copyright (C) 2006 - 2007 Akio Idehara
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify it 9 * This file is subject to the terms and conditions of the GNU General Public
9 * under the terms of the GNU General Public License as published by the 10 * License. See the file "COPYING" in the main directory of this archive
10 * Free Software Foundation; either version 2 of the License, or (at your 11 * for more details.
11 * option) any later version.
12 */ 12 */
13
14#include <linux/err.h> 13#include <linux/err.h>
15#include <linux/cache.h> 14#include <linux/cache.h>
16#include <linux/cpumask.h> 15#include <linux/cpumask.h>
17#include <linux/delay.h> 16#include <linux/delay.h>
18#include <linux/init.h> 17#include <linux/init.h>
19#include <linux/interrupt.h>
20#include <linux/spinlock.h> 18#include <linux/spinlock.h>
21#include <linux/threads.h> 19#include <linux/mm.h>
22#include <linux/module.h> 20#include <linux/module.h>
23#include <linux/time.h> 21#include <linux/interrupt.h>
24#include <linux/timex.h>
25#include <linux/sched.h>
26#include <linux/module.h>
27
28#include <asm/atomic.h> 22#include <asm/atomic.h>
29#include <asm/processor.h> 23#include <asm/processor.h>
30#include <asm/system.h> 24#include <asm/system.h>
31#include <asm/mmu_context.h> 25#include <asm/mmu_context.h>
32#include <asm/smp.h> 26#include <asm/smp.h>
27#include <asm/cacheflush.h>
28#include <asm/sections.h>
33 29
34/* 30int __cpu_number_map[NR_CPUS]; /* Map physical to logical */
35 * This was written with the Sega Saturn (SMP SH-2 7604) in mind, 31int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */
36 * but is designed to be usable regardless if there's an MMU
37 * present or not.
38 */
39struct sh_cpuinfo cpu_data[NR_CPUS];
40
41extern void per_cpu_trap_init(void);
42 32
43cpumask_t cpu_possible_map; 33cpumask_t cpu_possible_map;
44EXPORT_SYMBOL(cpu_possible_map); 34EXPORT_SYMBOL(cpu_possible_map);
45 35
46cpumask_t cpu_online_map; 36cpumask_t cpu_online_map;
47EXPORT_SYMBOL(cpu_online_map); 37EXPORT_SYMBOL(cpu_online_map);
48static atomic_t cpus_booted = ATOMIC_INIT(0);
49 38
50/* These are defined by the board-specific code. */ 39static atomic_t cpus_booted = ATOMIC_INIT(0);
51
52/*
53 * Cause the function described by call_data to be executed on the passed
54 * cpu. When the function has finished, increment the finished field of
55 * call_data.
56 */
57void __smp_send_ipi(unsigned int cpu, unsigned int action);
58
59/*
60 * Find the number of available processors
61 */
62unsigned int __smp_probe_cpus(void);
63
64/*
65 * Start a particular processor
66 */
67void __smp_slave_init(unsigned int cpu);
68 40
69/* 41/*
70 * Run specified function on a particular processor. 42 * Run specified function on a particular processor.
@@ -73,74 +45,123 @@ void __smp_call_function(unsigned int cpu);
73 45
74static inline void __init smp_store_cpu_info(unsigned int cpu) 46static inline void __init smp_store_cpu_info(unsigned int cpu)
75{ 47{
76 cpu_data[cpu].loops_per_jiffy = loops_per_jiffy; 48 struct sh_cpuinfo *c = cpu_data + cpu;
49
50 c->loops_per_jiffy = loops_per_jiffy;
77} 51}
78 52
79void __init smp_prepare_cpus(unsigned int max_cpus) 53void __init smp_prepare_cpus(unsigned int max_cpus)
80{ 54{
81 unsigned int cpu = smp_processor_id(); 55 unsigned int cpu = smp_processor_id();
82 int i;
83 56
84 atomic_set(&cpus_booted, 1); 57 init_new_context(current, &init_mm);
85 smp_store_cpu_info(cpu); 58 current_thread_info()->cpu = cpu;
86 59 plat_prepare_cpus(max_cpus);
87 for (i = 0; i < __smp_probe_cpus(); i++) 60
88 cpu_set(i, cpu_possible_map); 61#ifndef CONFIG_HOTPLUG_CPU
62 cpu_present_map = cpu_possible_map;
63#endif
89} 64}
90 65
91void __devinit smp_prepare_boot_cpu(void) 66void __devinit smp_prepare_boot_cpu(void)
92{ 67{
93 unsigned int cpu = smp_processor_id(); 68 unsigned int cpu = smp_processor_id();
94 69
70 __cpu_number_map[0] = cpu;
71 __cpu_logical_map[0] = cpu;
72
95 cpu_set(cpu, cpu_online_map); 73 cpu_set(cpu, cpu_online_map);
96 cpu_set(cpu, cpu_possible_map); 74 cpu_set(cpu, cpu_possible_map);
97} 75}
98 76
99int __cpu_up(unsigned int cpu) 77asmlinkage void __cpuinit start_secondary(void)
100{ 78{
101 struct task_struct *tsk; 79 unsigned int cpu;
80 struct mm_struct *mm = &init_mm;
102 81
103 tsk = fork_idle(cpu); 82 atomic_inc(&mm->mm_count);
83 atomic_inc(&mm->mm_users);
84 current->active_mm = mm;
85 BUG_ON(current->mm);
86 enter_lazy_tlb(mm, current);
104 87
105 if (IS_ERR(tsk)) 88 per_cpu_trap_init();
106 panic("Failed forking idle task for cpu %d\n", cpu); 89
107 90 preempt_disable();
108 task_thread_info(tsk)->cpu = cpu; 91
92 local_irq_enable();
93
94 calibrate_delay();
95
96 cpu = smp_processor_id();
97 smp_store_cpu_info(cpu);
109 98
110 cpu_set(cpu, cpu_online_map); 99 cpu_set(cpu, cpu_online_map);
111 100
112 return 0; 101 cpu_idle();
113} 102}
114 103
115int start_secondary(void *unused) 104extern struct {
105 unsigned long sp;
106 unsigned long bss_start;
107 unsigned long bss_end;
108 void *start_kernel_fn;
109 void *cpu_init_fn;
110 void *thread_info;
111} stack_start;
112
113int __cpuinit __cpu_up(unsigned int cpu)
116{ 114{
117 unsigned int cpu; 115 struct task_struct *tsk;
116 unsigned long timeout;
118 117
119 cpu = smp_processor_id(); 118 tsk = fork_idle(cpu);
119 if (IS_ERR(tsk)) {
120 printk(KERN_ERR "Failed forking idle task for cpu %d\n", cpu);
121 return PTR_ERR(tsk);
122 }
120 123
121 atomic_inc(&init_mm.mm_count); 124 /* Fill in data in head.S for secondary cpus */
122 current->active_mm = &init_mm; 125 stack_start.sp = tsk->thread.sp;
126 stack_start.thread_info = tsk->stack;
127 stack_start.bss_start = 0; /* don't clear bss for secondary cpus */
128 stack_start.start_kernel_fn = start_secondary;
123 129
124 smp_store_cpu_info(cpu); 130 flush_cache_all();
125 131
126 __smp_slave_init(cpu); 132 plat_start_cpu(cpu, (unsigned long)_stext);
127 preempt_disable();
128 per_cpu_trap_init();
129
130 atomic_inc(&cpus_booted);
131 133
132 cpu_idle(); 134 timeout = jiffies + HZ;
133 return 0; 135 while (time_before(jiffies, timeout)) {
136 if (cpu_online(cpu))
137 break;
138
139 udelay(10);
140 }
141
142 if (cpu_online(cpu))
143 return 0;
144
145 return -ENOENT;
134} 146}
135 147
136void __init smp_cpus_done(unsigned int max_cpus) 148void __init smp_cpus_done(unsigned int max_cpus)
137{ 149{
138 smp_mb(); 150 unsigned long bogosum = 0;
151 int cpu;
152
153 for_each_online_cpu(cpu)
154 bogosum += cpu_data[cpu].loops_per_jiffy;
155
156 printk(KERN_INFO "SMP: Total of %d processors activated "
157 "(%lu.%02lu BogoMIPS).\n", num_online_cpus(),
158 bogosum / (500000/HZ),
159 (bogosum / (5000/HZ)) % 100);
139} 160}
140 161
141void smp_send_reschedule(int cpu) 162void smp_send_reschedule(int cpu)
142{ 163{
143 __smp_send_ipi(cpu, SMP_MSG_RESCHEDULE); 164 plat_send_ipi(cpu, SMP_MSG_RESCHEDULE);
144} 165}
145 166
146static void stop_this_cpu(void *unused) 167static void stop_this_cpu(void *unused)
@@ -157,7 +178,6 @@ void smp_send_stop(void)
157 smp_call_function(stop_this_cpu, 0, 1, 0); 178 smp_call_function(stop_this_cpu, 0, 1, 0);
158} 179}
159 180
160
161struct smp_fn_call_struct smp_fn_call = { 181struct smp_fn_call_struct smp_fn_call = {
162 .lock = SPIN_LOCK_UNLOCKED, 182 .lock = SPIN_LOCK_UNLOCKED,
163 .finished = ATOMIC_INIT(0), 183 .finished = ATOMIC_INIT(0),
@@ -175,9 +195,6 @@ int smp_call_function(void (*func)(void *info), void *info, int retry, int wait)
175 unsigned int nr_cpus = atomic_read(&cpus_booted); 195 unsigned int nr_cpus = atomic_read(&cpus_booted);
176 int i; 196 int i;
177 197
178 if (nr_cpus < 2)
179 return 0;
180
181 /* Can deadlock when called with interrupts disabled */ 198 /* Can deadlock when called with interrupts disabled */
182 WARN_ON(irqs_disabled()); 199 WARN_ON(irqs_disabled());
183 200
@@ -189,7 +206,7 @@ int smp_call_function(void (*func)(void *info), void *info, int retry, int wait)
189 206
190 for (i = 0; i < nr_cpus; i++) 207 for (i = 0; i < nr_cpus; i++)
191 if (i != smp_processor_id()) 208 if (i != smp_processor_id())
192 __smp_call_function(i); 209 plat_send_ipi(i, SMP_MSG_FUNCTION);
193 210
194 if (wait) 211 if (wait)
195 while (atomic_read(&smp_fn_call.finished) != (nr_cpus - 1)); 212 while (atomic_read(&smp_fn_call.finished) != (nr_cpus - 1));
@@ -205,3 +222,143 @@ int setup_profiling_timer(unsigned int multiplier)
205 return 0; 222 return 0;
206} 223}
207 224
225static void flush_tlb_all_ipi(void *info)
226{
227 local_flush_tlb_all();
228}
229
230void flush_tlb_all(void)
231{
232 on_each_cpu(flush_tlb_all_ipi, 0, 1, 1);
233}
234
235static void flush_tlb_mm_ipi(void *mm)
236{
237 local_flush_tlb_mm((struct mm_struct *)mm);
238}
239
240/*
241 * The following tlb flush calls are invoked when old translations are
242 * being torn down, or pte attributes are changing. For single threaded
243 * address spaces, a new context is obtained on the current cpu, and tlb
244 * context on other cpus are invalidated to force a new context allocation
245 * at switch_mm time, should the mm ever be used on other cpus. For
246 * multithreaded address spaces, intercpu interrupts have to be sent.
247 * Another case where intercpu interrupts are required is when the target
248 * mm might be active on another cpu (eg debuggers doing the flushes on
249 * behalf of debugees, kswapd stealing pages from another process etc).
250 * Kanoj 07/00.
251 */
252
253void flush_tlb_mm(struct mm_struct *mm)
254{
255 preempt_disable();
256
257 if ((atomic_read(&mm->mm_users) != 1) || (current->mm != mm)) {
258 smp_call_function(flush_tlb_mm_ipi, (void *)mm, 1, 1);
259 } else {
260 int i;
261 for (i = 0; i < num_online_cpus(); i++)
262 if (smp_processor_id() != i)
263 cpu_context(i, mm) = 0;
264 }
265 local_flush_tlb_mm(mm);
266
267 preempt_enable();
268}
269
270struct flush_tlb_data {
271 struct vm_area_struct *vma;
272 unsigned long addr1;
273 unsigned long addr2;
274};
275
276static void flush_tlb_range_ipi(void *info)
277{
278 struct flush_tlb_data *fd = (struct flush_tlb_data *)info;
279
280 local_flush_tlb_range(fd->vma, fd->addr1, fd->addr2);
281}
282
283void flush_tlb_range(struct vm_area_struct *vma,
284 unsigned long start, unsigned long end)
285{
286 struct mm_struct *mm = vma->vm_mm;
287
288 preempt_disable();
289 if ((atomic_read(&mm->mm_users) != 1) || (current->mm != mm)) {
290 struct flush_tlb_data fd;
291
292 fd.vma = vma;
293 fd.addr1 = start;
294 fd.addr2 = end;
295 smp_call_function(flush_tlb_range_ipi, (void *)&fd, 1, 1);
296 } else {
297 int i;
298 for (i = 0; i < num_online_cpus(); i++)
299 if (smp_processor_id() != i)
300 cpu_context(i, mm) = 0;
301 }
302 local_flush_tlb_range(vma, start, end);
303 preempt_enable();
304}
305
306static void flush_tlb_kernel_range_ipi(void *info)
307{
308 struct flush_tlb_data *fd = (struct flush_tlb_data *)info;
309
310 local_flush_tlb_kernel_range(fd->addr1, fd->addr2);
311}
312
313void flush_tlb_kernel_range(unsigned long start, unsigned long end)
314{
315 struct flush_tlb_data fd;
316
317 fd.addr1 = start;
318 fd.addr2 = end;
319 on_each_cpu(flush_tlb_kernel_range_ipi, (void *)&fd, 1, 1);
320}
321
322static void flush_tlb_page_ipi(void *info)
323{
324 struct flush_tlb_data *fd = (struct flush_tlb_data *)info;
325
326 local_flush_tlb_page(fd->vma, fd->addr1);
327}
328
329void flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
330{
331 preempt_disable();
332 if ((atomic_read(&vma->vm_mm->mm_users) != 1) ||
333 (current->mm != vma->vm_mm)) {
334 struct flush_tlb_data fd;
335
336 fd.vma = vma;
337 fd.addr1 = page;
338 smp_call_function(flush_tlb_page_ipi, (void *)&fd, 1, 1);
339 } else {
340 int i;
341 for (i = 0; i < num_online_cpus(); i++)
342 if (smp_processor_id() != i)
343 cpu_context(i, vma->vm_mm) = 0;
344 }
345 local_flush_tlb_page(vma, page);
346 preempt_enable();
347}
348
349static void flush_tlb_one_ipi(void *info)
350{
351 struct flush_tlb_data *fd = (struct flush_tlb_data *)info;
352 local_flush_tlb_one(fd->addr1, fd->addr2);
353}
354
355void flush_tlb_one(unsigned long asid, unsigned long vaddr)
356{
357 struct flush_tlb_data fd;
358
359 fd.addr1 = asid;
360 fd.addr2 = vaddr;
361
362 smp_call_function(flush_tlb_one_ipi, (void *)&fd, 1, 1);
363 local_flush_tlb_one(asid, vaddr);
364}
diff --git a/arch/sh/kernel/syscalls.S b/arch/sh/kernel/syscalls.S
index 91fb7024e06f..10bec45415ba 100644
--- a/arch/sh/kernel/syscalls.S
+++ b/arch/sh/kernel/syscalls.S
@@ -14,24 +14,6 @@
14#include <linux/sys.h> 14#include <linux/sys.h>
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16 16
17#if !defined(CONFIG_NFSD) && !defined(CONFIG_NFSD_MODULE)
18#define sys_nfsservctl sys_ni_syscall
19#endif
20
21#if !defined(CONFIG_MMU)
22#define sys_madvise sys_ni_syscall
23#define sys_readahead sys_ni_syscall
24#define sys_mprotect sys_ni_syscall
25#define sys_msync sys_ni_syscall
26#define sys_mlock sys_ni_syscall
27#define sys_munlock sys_ni_syscall
28#define sys_mlockall sys_ni_syscall
29#define sys_munlockall sys_ni_syscall
30#define sys_mremap sys_ni_syscall
31#define sys_mincore sys_ni_syscall
32#define sys_remap_file_pages sys_ni_syscall
33#endif
34
35 .data 17 .data
36ENTRY(sys_call_table) 18ENTRY(sys_call_table)
37 .long sys_restart_syscall /* 0 - old "setup()" system call*/ 19 .long sys_restart_syscall /* 0 - old "setup()" system call*/
diff --git a/arch/sh/kernel/timers/timer-tmu.c b/arch/sh/kernel/timers/timer-tmu.c
index 8a545d54e2d3..628ec9a15e38 100644
--- a/arch/sh/kernel/timers/timer-tmu.c
+++ b/arch/sh/kernel/timers/timer-tmu.c
@@ -173,7 +173,8 @@ static int tmu_timer_init(void)
173 173
174 tmu_timer_stop(); 174 tmu_timer_stop();
175 175
176#if !defined(CONFIG_CPU_SUBTYPE_SH7760) && \ 176#if !defined(CONFIG_CPU_SUBTYPE_SH7720) && \
177 !defined(CONFIG_CPU_SUBTYPE_SH7760) && \
177 !defined(CONFIG_CPU_SUBTYPE_SH7785) && \ 178 !defined(CONFIG_CPU_SUBTYPE_SH7785) && \
178 !defined(CONFIG_CPU_SUBTYPE_SHX3) 179 !defined(CONFIG_CPU_SUBTYPE_SHX3)
179 ctrl_outb(TMU_TOCR_INIT, TMU_TOCR); 180 ctrl_outb(TMU_TOCR_INIT, TMU_TOCR);
diff --git a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c
index 67015044d74a..dcb46e71da1c 100644
--- a/arch/sh/kernel/traps.c
+++ b/arch/sh/kernel/traps.c
@@ -807,12 +807,13 @@ static inline void __init gdb_vbr_init(void)
807} 807}
808#endif 808#endif
809 809
810void __init per_cpu_trap_init(void) 810void __cpuinit per_cpu_trap_init(void)
811{ 811{
812 extern void *vbr_base; 812 extern void *vbr_base;
813 813
814#ifdef CONFIG_SH_STANDARD_BIOS 814#ifdef CONFIG_SH_STANDARD_BIOS
815 gdb_vbr_init(); 815 if (raw_smp_processor_id() == 0)
816 gdb_vbr_init();
816#endif 817#endif
817 818
818 /* NOTE: The VBR value should be at P1 819 /* NOTE: The VBR value should be at P1
diff --git a/arch/sh/kernel/vmlinux.lds.S b/arch/sh/kernel/vmlinux.lds.S
index 9cb95af7b090..6d5abba2ee27 100644
--- a/arch/sh/kernel/vmlinux.lds.S
+++ b/arch/sh/kernel/vmlinux.lds.S
@@ -62,6 +62,8 @@ SECTIONS
62 __nosave_end = .; 62 __nosave_end = .;
63 63
64 PERCPU(PAGE_SIZE) 64 PERCPU(PAGE_SIZE)
65
66 . = ALIGN(L1_CACHE_BYTES);
65 .data.cacheline_aligned : { *(.data.cacheline_aligned) } 67 .data.cacheline_aligned : { *(.data.cacheline_aligned) }
66 68
67 _edata = .; /* End of data section */ 69 _edata = .; /* End of data section */
@@ -89,7 +91,14 @@ SECTIONS
89 __con_initcall_end = .; 91 __con_initcall_end = .;
90 SECURITY_INIT 92 SECURITY_INIT
91 93
94 /* .exit.text is discarded at runtime, not link time, to deal with
95 references from .rodata */
96 .exit.text : { *(.exit.text) }
97 .exit.data : { *(.exit.data) }
98
92#ifdef CONFIG_BLK_DEV_INITRD 99#ifdef CONFIG_BLK_DEV_INITRD
100 . = ALIGN(PAGE_SIZE);
101
93 __initramfs_start = .; 102 __initramfs_start = .;
94 .init.ramfs : { *(.init.ramfs) } 103 .init.ramfs : { *(.init.ramfs) }
95 __initramfs_end = .; 104 __initramfs_end = .;
@@ -107,6 +116,7 @@ SECTIONS
107 *(.bss.page_aligned) 116 *(.bss.page_aligned)
108 *(.bss) 117 *(.bss)
109 . = ALIGN(4); 118 . = ALIGN(4);
119 _ebss = .; /* uClinux MTD sucks */
110 _end = . ; 120 _end = . ;
111 } 121 }
112 122
diff --git a/arch/sh/kernel/vsyscall/vsyscall.lds.S b/arch/sh/kernel/vsyscall/vsyscall.lds.S
index b13c3d439fee..c9bf2af35d35 100644
--- a/arch/sh/kernel/vsyscall/vsyscall.lds.S
+++ b/arch/sh/kernel/vsyscall/vsyscall.lds.S
@@ -17,45 +17,52 @@ ENTRY(__kernel_vsyscall);
17 17
18SECTIONS 18SECTIONS
19{ 19{
20 . = SIZEOF_HEADERS; 20 . = SIZEOF_HEADERS;
21 21
22 .hash : { *(.hash) } :text 22 .hash : { *(.hash) } :text
23 .gnu.hash : { *(.gnu.hash) } 23 .gnu.hash : { *(.gnu.hash) }
24 .dynsym : { *(.dynsym) } 24 .dynsym : { *(.dynsym) }
25 .dynstr : { *(.dynstr) } 25 .dynstr : { *(.dynstr) }
26 .gnu.version : { *(.gnu.version) } 26 .gnu.version : { *(.gnu.version) }
27 .gnu.version_d : { *(.gnu.version_d) } 27 .gnu.version_d : { *(.gnu.version_d) }
28 .gnu.version_r : { *(.gnu.version_r) } 28 .gnu.version_r : { *(.gnu.version_r) }
29 29
30 /* This linker script is used both with -r and with -shared. 30 /*
31 For the layouts to match, we need to skip more than enough 31 * This linker script is used both with -r and with -shared.
32 space for the dynamic symbol table et al. If this amount 32 * For the layouts to match, we need to skip more than enough
33 is insufficient, ld -shared will barf. Just increase it here. */ 33 * space for the dynamic symbol table et al. If this amount
34 . = 0x400; 34 * is insufficient, ld -shared will barf. Just increase it here.
35 */
36 . = 0x400;
35 37
36 .text : { *(.text) } :text =0x90909090 38 .text : { *(.text) } :text =0x90909090
37 .note : { *(.note.*) } :text :note 39 .note : { *(.note.*) } :text :note
38 .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr 40 .eh_frame_hdr : { *(.eh_frame_hdr ) } :text :eh_frame_hdr
39 .eh_frame : { KEEP (*(.eh_frame)) } :text 41 .eh_frame : { KEEP (*(.eh_frame)) } :text
40 .dynamic : { *(.dynamic) } :text :dynamic 42 .dynamic : { *(.dynamic) } :text :dynamic
41 .useless : { 43 .useless : {
42 *(.got.plt) *(.got) 44 *(.got.plt) *(.got)
43 *(.data .data.* .gnu.linkonce.d.*) 45 *(.data .data.* .gnu.linkonce.d.*)
44 *(.dynbss) 46 *(.dynbss)
45 *(.bss .bss.* .gnu.linkonce.b.*) 47 *(.bss .bss.* .gnu.linkonce.b.*)
46 } :text 48 } :text
47} 49}
48 50
49/* 51/*
52 * Very old versions of ld do not recognize this name token; use the constant.
53 */
54#define PT_GNU_EH_FRAME 0x6474e550
55
56/*
50 * We must supply the ELF program headers explicitly to get just one 57 * We must supply the ELF program headers explicitly to get just one
51 * PT_LOAD segment, and set the flags explicitly to make segments read-only. 58 * PT_LOAD segment, and set the flags explicitly to make segments read-only.
52 */ 59 */
53PHDRS 60PHDRS
54{ 61{
55 text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */ 62 text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
56 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ 63 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
57 note PT_NOTE FLAGS(4); /* PF_R */ 64 note PT_NOTE FLAGS(4); /* PF_R */
58 eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */ 65 eh_frame_hdr PT_GNU_EH_FRAME;
59} 66}
60 67
61/* 68/*
@@ -63,12 +70,12 @@ PHDRS
63 */ 70 */
64VERSION 71VERSION
65{ 72{
66 LINUX_2.6 { 73 LINUX_2.6 {
67 global: 74 global:
68 __kernel_vsyscall; 75 __kernel_vsyscall;
69 __kernel_sigreturn; 76 __kernel_sigreturn;
70 __kernel_rt_sigreturn; 77 __kernel_rt_sigreturn;
71 78
72 local: *; 79 local: *;
73 }; 80 };
74} 81}
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index 43f3972a5fb9..cf446bbab5b0 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -2,7 +2,6 @@
2# Processor families 2# Processor families
3# 3#
4config CPU_SH2 4config CPU_SH2
5 select SH_WRITETHROUGH if !CPU_SH2A
6 bool 5 bool
7 6
8config CPU_SH2A 7config CPU_SH2A
@@ -19,6 +18,7 @@ config CPU_SH4
19 select CPU_HAS_INTEVT 18 select CPU_HAS_INTEVT
20 select CPU_HAS_SR_RB 19 select CPU_HAS_SR_RB
21 select CPU_HAS_PTEA if (!CPU_SUBTYPE_ST40 && !CPU_SH4A) || CPU_SHX2 20 select CPU_HAS_PTEA if (!CPU_SUBTYPE_ST40 && !CPU_SH4A) || CPU_SHX2
21 select CPU_HAS_FPU if !CPU_SH4AL_DSP
22 22
23config CPU_SH4A 23config CPU_SH4A
24 bool 24 bool
@@ -32,7 +32,6 @@ config CPU_SH4AL_DSP
32config CPU_SUBTYPE_ST40 32config CPU_SUBTYPE_ST40
33 bool 33 bool
34 select CPU_SH4 34 select CPU_SH4
35 select CPU_HAS_INTC2_IRQ
36 35
37config CPU_SHX2 36config CPU_SHX2
38 bool 37 bool
@@ -52,26 +51,22 @@ choice
52config CPU_SUBTYPE_SH7619 51config CPU_SUBTYPE_SH7619
53 bool "Support SH7619 processor" 52 bool "Support SH7619 processor"
54 select CPU_SH2 53 select CPU_SH2
55 select CPU_HAS_IPR_IRQ
56 54
57# SH-2A Processor Support 55# SH-2A Processor Support
58 56
59config CPU_SUBTYPE_SH7206 57config CPU_SUBTYPE_SH7206
60 bool "Support SH7206 processor" 58 bool "Support SH7206 processor"
61 select CPU_SH2A 59 select CPU_SH2A
62 select CPU_HAS_IPR_IRQ
63 60
64# SH-3 Processor Support 61# SH-3 Processor Support
65 62
66config CPU_SUBTYPE_SH7705 63config CPU_SUBTYPE_SH7705
67 bool "Support SH7705 processor" 64 bool "Support SH7705 processor"
68 select CPU_SH3 65 select CPU_SH3
69 select CPU_HAS_IPR_IRQ
70 66
71config CPU_SUBTYPE_SH7706 67config CPU_SUBTYPE_SH7706
72 bool "Support SH7706 processor" 68 bool "Support SH7706 processor"
73 select CPU_SH3 69 select CPU_SH3
74 select CPU_HAS_IPR_IRQ
75 help 70 help
76 Select SH7706 if you have a 133 Mhz SH-3 HD6417706 CPU. 71 Select SH7706 if you have a 133 Mhz SH-3 HD6417706 CPU.
77 72
@@ -91,14 +86,12 @@ config CPU_SUBTYPE_SH7708
91config CPU_SUBTYPE_SH7709 86config CPU_SUBTYPE_SH7709
92 bool "Support SH7709 processor" 87 bool "Support SH7709 processor"
93 select CPU_SH3 88 select CPU_SH3
94 select CPU_HAS_IPR_IRQ
95 help 89 help
96 Select SH7709 if you have a 80 Mhz SH-3 HD6417709 CPU. 90 Select SH7709 if you have a 80 Mhz SH-3 HD6417709 CPU.
97 91
98config CPU_SUBTYPE_SH7710 92config CPU_SUBTYPE_SH7710
99 bool "Support SH7710 processor" 93 bool "Support SH7710 processor"
100 select CPU_SH3 94 select CPU_SH3
101 select CPU_HAS_IPR_IRQ
102 select CPU_HAS_DSP 95 select CPU_HAS_DSP
103 help 96 help
104 Select SH7710 if you have a SH3-DSP SH7710 CPU. 97 Select SH7710 if you have a SH3-DSP SH7710 CPU.
@@ -106,24 +99,28 @@ config CPU_SUBTYPE_SH7710
106config CPU_SUBTYPE_SH7712 99config CPU_SUBTYPE_SH7712
107 bool "Support SH7712 processor" 100 bool "Support SH7712 processor"
108 select CPU_SH3 101 select CPU_SH3
109 select CPU_HAS_IPR_IRQ
110 select CPU_HAS_DSP 102 select CPU_HAS_DSP
111 help 103 help
112 Select SH7712 if you have a SH3-DSP SH7712 CPU. 104 Select SH7712 if you have a SH3-DSP SH7712 CPU.
113 105
106config CPU_SUBTYPE_SH7720
107 bool "Support SH7720 processor"
108 select CPU_SH3
109 select CPU_HAS_DSP
110 help
111 Select SH7720 if you have a SH3-DSP SH7720 CPU.
112
114# SH-4 Processor Support 113# SH-4 Processor Support
115 114
116config CPU_SUBTYPE_SH7750 115config CPU_SUBTYPE_SH7750
117 bool "Support SH7750 processor" 116 bool "Support SH7750 processor"
118 select CPU_SH4 117 select CPU_SH4
119 select CPU_HAS_INTC_IRQ
120 help 118 help
121 Select SH7750 if you have a 200 Mhz SH-4 HD6417750 CPU. 119 Select SH7750 if you have a 200 Mhz SH-4 HD6417750 CPU.
122 120
123config CPU_SUBTYPE_SH7091 121config CPU_SUBTYPE_SH7091
124 bool "Support SH7091 processor" 122 bool "Support SH7091 processor"
125 select CPU_SH4 123 select CPU_SH4
126 select CPU_HAS_INTC_IRQ
127 help 124 help
128 Select SH7091 if you have an SH-4 based Sega device (such as 125 Select SH7091 if you have an SH-4 based Sega device (such as
129 the Dreamcast, Naomi, and Naomi 2). 126 the Dreamcast, Naomi, and Naomi 2).
@@ -131,17 +128,14 @@ config CPU_SUBTYPE_SH7091
131config CPU_SUBTYPE_SH7750R 128config CPU_SUBTYPE_SH7750R
132 bool "Support SH7750R processor" 129 bool "Support SH7750R processor"
133 select CPU_SH4 130 select CPU_SH4
134 select CPU_HAS_INTC_IRQ
135 131
136config CPU_SUBTYPE_SH7750S 132config CPU_SUBTYPE_SH7750S
137 bool "Support SH7750S processor" 133 bool "Support SH7750S processor"
138 select CPU_SH4 134 select CPU_SH4
139 select CPU_HAS_INTC_IRQ
140 135
141config CPU_SUBTYPE_SH7751 136config CPU_SUBTYPE_SH7751
142 bool "Support SH7751 processor" 137 bool "Support SH7751 processor"
143 select CPU_SH4 138 select CPU_SH4
144 select CPU_HAS_INTC_IRQ
145 help 139 help
146 Select SH7751 if you have a 166 Mhz SH-4 HD6417751 CPU, 140 Select SH7751 if you have a 166 Mhz SH-4 HD6417751 CPU,
147 or if you have a HD6417751R CPU. 141 or if you have a HD6417751R CPU.
@@ -149,13 +143,10 @@ config CPU_SUBTYPE_SH7751
149config CPU_SUBTYPE_SH7751R 143config CPU_SUBTYPE_SH7751R
150 bool "Support SH7751R processor" 144 bool "Support SH7751R processor"
151 select CPU_SH4 145 select CPU_SH4
152 select CPU_HAS_INTC_IRQ
153 146
154config CPU_SUBTYPE_SH7760 147config CPU_SUBTYPE_SH7760
155 bool "Support SH7760 processor" 148 bool "Support SH7760 processor"
156 select CPU_SH4 149 select CPU_SH4
157 select CPU_HAS_INTC2_IRQ
158 select CPU_HAS_IPR_IRQ
159 150
160config CPU_SUBTYPE_SH4_202 151config CPU_SUBTYPE_SH4_202
161 bool "Support SH4-202 processor" 152 bool "Support SH4-202 processor"
@@ -185,19 +176,21 @@ config CPU_SUBTYPE_SH7770
185config CPU_SUBTYPE_SH7780 176config CPU_SUBTYPE_SH7780
186 bool "Support SH7780 processor" 177 bool "Support SH7780 processor"
187 select CPU_SH4A 178 select CPU_SH4A
188 select CPU_HAS_INTC_IRQ
189 179
190config CPU_SUBTYPE_SH7785 180config CPU_SUBTYPE_SH7785
191 bool "Support SH7785 processor" 181 bool "Support SH7785 processor"
192 select CPU_SH4A 182 select CPU_SH4A
193 select CPU_SHX2 183 select CPU_SHX2
194 select CPU_HAS_INTC2_IRQ 184 select ARCH_SPARSEMEM_ENABLE
185 select SYS_SUPPORTS_NUMA
195 186
196config CPU_SUBTYPE_SHX3 187config CPU_SUBTYPE_SHX3
197 bool "Support SH-X3 processor" 188 bool "Support SH-X3 processor"
198 select CPU_SH4A 189 select CPU_SH4A
199 select CPU_SHX3 190 select CPU_SHX3
200 select CPU_HAS_INTC2_IRQ 191 select ARCH_SPARSEMEM_ENABLE
192 select SYS_SUPPORTS_NUMA
193 select SYS_SUPPORTS_SMP
201 194
202# SH4AL-DSP Processor Support 195# SH4AL-DSP Processor Support
203 196
@@ -209,7 +202,6 @@ config CPU_SUBTYPE_SH7722
209 bool "Support SH7722 processor" 202 bool "Support SH7722 processor"
210 select CPU_SH4AL_DSP 203 select CPU_SH4AL_DSP
211 select CPU_SHX2 204 select CPU_SHX2
212 select CPU_HAS_INTC_IRQ
213 select ARCH_SPARSEMEM_ENABLE 205 select ARCH_SPARSEMEM_ENABLE
214 select SYS_SUPPORTS_NUMA 206 select SYS_SUPPORTS_NUMA
215 207
@@ -274,7 +266,7 @@ config 32BIT
274 266
275config X2TLB 267config X2TLB
276 bool "Enable extended TLB mode" 268 bool "Enable extended TLB mode"
277 depends on CPU_SHX2 && MMU && EXPERIMENTAL 269 depends on (CPU_SHX2 || CPU_SHX3) && MMU && EXPERIMENTAL
278 help 270 help
279 Selecting this option will enable the extended mode of the SH-X2 271 Selecting this option will enable the extended mode of the SH-X2
280 TLB. For legacy SH-X behaviour and interoperability, say N. For 272 TLB. For legacy SH-X behaviour and interoperability, say N. For
@@ -307,6 +299,7 @@ config NUMA
307 299
308config NODES_SHIFT 300config NODES_SHIFT
309 int 301 int
302 default "3" if CPU_SUBTYPE_SHX3
310 default "1" 303 default "1"
311 depends on NEED_MULTIPLE_NODES 304 depends on NEED_MULTIPLE_NODES
312 305
@@ -323,7 +316,9 @@ config ARCH_SPARSEMEM_DEFAULT
323 316
324config MAX_ACTIVE_REGIONS 317config MAX_ACTIVE_REGIONS
325 int 318 int
326 default "2" if (CPU_SUBTYPE_SH7722 && SPARSEMEM) 319 default "6" if (CPU_SUBTYPE_SHX3 && SPARSEMEM)
320 default "2" if SPARSEMEM && (CPU_SUBTYPE_SH7722 || \
321 CPU_SUBTYPE_SH7785)
327 default "1" 322 default "1"
328 323
329config ARCH_POPULATES_NODE_MAP 324config ARCH_POPULATES_NODE_MAP
@@ -342,25 +337,27 @@ config ARCH_MEMORY_PROBE
342 337
343choice 338choice
344 prompt "Kernel page size" 339 prompt "Kernel page size"
340 default PAGE_SIZE_8KB if X2TLB
345 default PAGE_SIZE_4KB 341 default PAGE_SIZE_4KB
346 342
347config PAGE_SIZE_4KB 343config PAGE_SIZE_4KB
348 bool "4kB" 344 bool "4kB"
345 depends on !X2TLB
349 help 346 help
350 This is the default page size used by all SuperH CPUs. 347 This is the default page size used by all SuperH CPUs.
351 348
352config PAGE_SIZE_8KB 349config PAGE_SIZE_8KB
353 bool "8kB" 350 bool "8kB"
354 depends on EXPERIMENTAL && X2TLB 351 depends on X2TLB
355 help 352 help
356 This enables 8kB pages as supported by SH-X2 and later MMUs. 353 This enables 8kB pages as supported by SH-X2 and later MMUs.
357 354
358config PAGE_SIZE_64KB 355config PAGE_SIZE_64KB
359 bool "64kB" 356 bool "64kB"
360 depends on EXPERIMENTAL && CPU_SH4 357 depends on CPU_SH4
361 help 358 help
362 This enables support for 64kB pages, possible on all SH-4 359 This enables support for 64kB pages, possible on all SH-4
363 CPUs and later. Highly experimental, not recommended. 360 CPUs and later.
364 361
365endchoice 362endchoice
366 363
@@ -412,8 +409,17 @@ config SH_DIRECT_MAPPED
412 Turn this option off for platforms that do not have a direct-mapped 409 Turn this option off for platforms that do not have a direct-mapped
413 cache, and you have no need to run the caches in such a configuration. 410 cache, and you have no need to run the caches in such a configuration.
414 411
415config SH_WRITETHROUGH 412choice
416 bool "Use write-through caching" 413 prompt "Cache mode"
414 default CACHE_WRITEBACK if CPU_SH2A || CPU_SH3 || CPU_SH4
415 default CACHE_WRITETHROUGH if (CPU_SH2 && !CPU_SH2A)
416
417config CACHE_WRITEBACK
418 bool "Write-back"
419 depends on CPU_SH2A || CPU_SH3 || CPU_SH4
420
421config CACHE_WRITETHROUGH
422 bool "Write-through"
417 help 423 help
418 Selecting this option will configure the caches in write-through 424 Selecting this option will configure the caches in write-through
419 mode, as opposed to the default write-back configuration. 425 mode, as opposed to the default write-back configuration.
@@ -424,4 +430,9 @@ config SH_WRITETHROUGH
424 430
425 If unsure, say N. 431 If unsure, say N.
426 432
433config CACHE_OFF
434 bool "Off"
435
436endchoice
437
427endmenu 438endmenu
diff --git a/arch/sh/mm/Makefile b/arch/sh/mm/Makefile
index 4061e89d84d0..ee30fb44dfe1 100644
--- a/arch/sh/mm/Makefile
+++ b/arch/sh/mm/Makefile
@@ -4,29 +4,32 @@
4 4
5obj-y := init.o extable.o consistent.o 5obj-y := init.o extable.o consistent.o
6 6
7obj-$(CONFIG_CPU_SH2) += cache-sh2.o 7ifndef CONFIG_CACHE_OFF
8obj-$(CONFIG_CPU_SH3) += cache-sh3.o 8obj-$(CONFIG_CPU_SH2) += cache-sh2.o
9obj-$(CONFIG_CPU_SH4) += cache-sh4.o 9obj-$(CONFIG_CPU_SH3) += cache-sh3.o
10obj-$(CONFIG_CPU_SH4) += cache-sh4.o
11obj-$(CONFIG_SH7705_CACHE_32KB) += cache-sh7705.o
12endif
10 13
11mmu-y := tlb-nommu.o pg-nommu.o 14mmu-y := tlb-nommu.o pg-nommu.o
12mmu-$(CONFIG_CPU_SH3) += fault-nommu.o
13mmu-$(CONFIG_CPU_SH4) += fault-nommu.o
14mmu-$(CONFIG_MMU) := fault.o clear_page.o copy_page.o tlb-flush.o \ 15mmu-$(CONFIG_MMU) := fault.o clear_page.o copy_page.o tlb-flush.o \
15 ioremap.o 16 ioremap.o
16 17
17obj-y += $(mmu-y) 18obj-y += $(mmu-y)
18 19
19ifdef CONFIG_DEBUG_FS 20ifdef CONFIG_DEBUG_FS
20obj-$(CONFIG_CPU_SH4) += cache-debugfs.o 21obj-$(CONFIG_CPU_SH4) += cache-debugfs.o
21endif 22endif
22 23
23ifdef CONFIG_MMU 24ifdef CONFIG_MMU
24obj-$(CONFIG_CPU_SH3) += tlb-sh3.o 25obj-$(CONFIG_CPU_SH3) += tlb-sh3.o
25obj-$(CONFIG_CPU_SH4) += tlb-sh4.o pg-sh4.o 26obj-$(CONFIG_CPU_SH4) += tlb-sh4.o
26obj-$(CONFIG_SH7705_CACHE_32KB) += pg-sh7705.o 27ifndef CONFIG_CACHE_OFF
28obj-$(CONFIG_CPU_SH4) += pg-sh4.o
29obj-$(CONFIG_SH7705_CACHE_32KB) += pg-sh7705.o
30endif
27endif 31endif
28 32
29obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o 33obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
30obj-$(CONFIG_SH7705_CACHE_32KB) += cache-sh7705.o
31obj-$(CONFIG_32BIT) += pmb.o 34obj-$(CONFIG_32BIT) += pmb.o
32obj-$(CONFIG_NUMA) += numa.o 35obj-$(CONFIG_NUMA) += numa.o
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c
index 86486326ef1d..226b190c5b9c 100644
--- a/arch/sh/mm/cache-sh4.c
+++ b/arch/sh/mm/cache-sh4.c
@@ -2,7 +2,7 @@
2 * arch/sh/mm/cache-sh4.c 2 * arch/sh/mm/cache-sh4.c
3 * 3 *
4 * Copyright (C) 1999, 2000, 2002 Niibe Yutaka 4 * Copyright (C) 1999, 2000, 2002 Niibe Yutaka
5 * Copyright (C) 2001 - 2006 Paul Mundt 5 * Copyright (C) 2001 - 2007 Paul Mundt
6 * Copyright (C) 2003 Richard Curnow 6 * Copyright (C) 2003 Richard Curnow
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
@@ -44,7 +44,7 @@ static void (*__flush_dcache_segment_fn)(unsigned long, unsigned long) =
44static void compute_alias(struct cache_info *c) 44static void compute_alias(struct cache_info *c)
45{ 45{
46 c->alias_mask = ((c->sets - 1) << c->entry_shift) & ~(PAGE_SIZE - 1); 46 c->alias_mask = ((c->sets - 1) << c->entry_shift) & ~(PAGE_SIZE - 1);
47 c->n_aliases = (c->alias_mask >> PAGE_SHIFT) + 1; 47 c->n_aliases = c->alias_mask ? (c->alias_mask >> PAGE_SHIFT) + 1 : 0;
48} 48}
49 49
50static void __init emit_cache_params(void) 50static void __init emit_cache_params(void)
@@ -54,21 +54,35 @@ static void __init emit_cache_params(void)
54 ctrl_inl(CCN_CVR), 54 ctrl_inl(CCN_CVR),
55 ctrl_inl(CCN_PRR)); 55 ctrl_inl(CCN_PRR));
56 printk("I-cache : n_ways=%d n_sets=%d way_incr=%d\n", 56 printk("I-cache : n_ways=%d n_sets=%d way_incr=%d\n",
57 current_cpu_data.icache.ways, 57 boot_cpu_data.icache.ways,
58 current_cpu_data.icache.sets, 58 boot_cpu_data.icache.sets,
59 current_cpu_data.icache.way_incr); 59 boot_cpu_data.icache.way_incr);
60 printk("I-cache : entry_mask=0x%08x alias_mask=0x%08x n_aliases=%d\n", 60 printk("I-cache : entry_mask=0x%08x alias_mask=0x%08x n_aliases=%d\n",
61 current_cpu_data.icache.entry_mask, 61 boot_cpu_data.icache.entry_mask,
62 current_cpu_data.icache.alias_mask, 62 boot_cpu_data.icache.alias_mask,
63 current_cpu_data.icache.n_aliases); 63 boot_cpu_data.icache.n_aliases);
64 printk("D-cache : n_ways=%d n_sets=%d way_incr=%d\n", 64 printk("D-cache : n_ways=%d n_sets=%d way_incr=%d\n",
65 current_cpu_data.dcache.ways, 65 boot_cpu_data.dcache.ways,
66 current_cpu_data.dcache.sets, 66 boot_cpu_data.dcache.sets,
67 current_cpu_data.dcache.way_incr); 67 boot_cpu_data.dcache.way_incr);
68 printk("D-cache : entry_mask=0x%08x alias_mask=0x%08x n_aliases=%d\n", 68 printk("D-cache : entry_mask=0x%08x alias_mask=0x%08x n_aliases=%d\n",
69 current_cpu_data.dcache.entry_mask, 69 boot_cpu_data.dcache.entry_mask,
70 current_cpu_data.dcache.alias_mask, 70 boot_cpu_data.dcache.alias_mask,
71 current_cpu_data.dcache.n_aliases); 71 boot_cpu_data.dcache.n_aliases);
72
73 /*
74 * Emit Secondary Cache parameters if the CPU has a probed L2.
75 */
76 if (boot_cpu_data.flags & CPU_HAS_L2_CACHE) {
77 printk("S-cache : n_ways=%d n_sets=%d way_incr=%d\n",
78 boot_cpu_data.scache.ways,
79 boot_cpu_data.scache.sets,
80 boot_cpu_data.scache.way_incr);
81 printk("S-cache : entry_mask=0x%08x alias_mask=0x%08x n_aliases=%d\n",
82 boot_cpu_data.scache.entry_mask,
83 boot_cpu_data.scache.alias_mask,
84 boot_cpu_data.scache.n_aliases);
85 }
72 86
73 if (!__flush_dcache_segment_fn) 87 if (!__flush_dcache_segment_fn)
74 panic("unknown number of cache ways\n"); 88 panic("unknown number of cache ways\n");
@@ -79,10 +93,11 @@ static void __init emit_cache_params(void)
79 */ 93 */
80void __init p3_cache_init(void) 94void __init p3_cache_init(void)
81{ 95{
82 compute_alias(&current_cpu_data.icache); 96 compute_alias(&boot_cpu_data.icache);
83 compute_alias(&current_cpu_data.dcache); 97 compute_alias(&boot_cpu_data.dcache);
98 compute_alias(&boot_cpu_data.scache);
84 99
85 switch (current_cpu_data.dcache.ways) { 100 switch (boot_cpu_data.dcache.ways) {
86 case 1: 101 case 1:
87 __flush_dcache_segment_fn = __flush_dcache_segment_1way; 102 __flush_dcache_segment_fn = __flush_dcache_segment_1way;
88 break; 103 break;
@@ -187,13 +202,13 @@ void flush_cache_sigtramp(unsigned long addr)
187 : "m" (__m(v))); 202 : "m" (__m(v)));
188 203
189 index = CACHE_IC_ADDRESS_ARRAY | 204 index = CACHE_IC_ADDRESS_ARRAY |
190 (v & current_cpu_data.icache.entry_mask); 205 (v & boot_cpu_data.icache.entry_mask);
191 206
192 local_irq_save(flags); 207 local_irq_save(flags);
193 jump_to_P2(); 208 jump_to_P2();
194 209
195 for (i = 0; i < current_cpu_data.icache.ways; 210 for (i = 0; i < boot_cpu_data.icache.ways;
196 i++, index += current_cpu_data.icache.way_incr) 211 i++, index += boot_cpu_data.icache.way_incr)
197 ctrl_outl(0, index); /* Clear out Valid-bit */ 212 ctrl_outl(0, index); /* Clear out Valid-bit */
198 213
199 back_to_P1(); 214 back_to_P1();
@@ -210,7 +225,7 @@ static inline void flush_cache_4096(unsigned long start,
210 * All types of SH-4 require PC to be in P2 to operate on the I-cache. 225 * All types of SH-4 require PC to be in P2 to operate on the I-cache.
211 * Some types of SH-4 require PC to be in P2 to operate on the D-cache. 226 * Some types of SH-4 require PC to be in P2 to operate on the D-cache.
212 */ 227 */
213 if ((current_cpu_data.flags & CPU_HAS_P2_FLUSH_BUG) || 228 if ((boot_cpu_data.flags & CPU_HAS_P2_FLUSH_BUG) ||
214 (start < CACHE_OC_ADDRESS_ARRAY)) 229 (start < CACHE_OC_ADDRESS_ARRAY))
215 exec_offset = 0x20000000; 230 exec_offset = 0x20000000;
216 231
@@ -232,7 +247,7 @@ void flush_dcache_page(struct page *page)
232 int i, n; 247 int i, n;
233 248
234 /* Loop all the D-cache */ 249 /* Loop all the D-cache */
235 n = current_cpu_data.dcache.n_aliases; 250 n = boot_cpu_data.dcache.n_aliases;
236 for (i = 0; i < n; i++, addr += 4096) 251 for (i = 0; i < n; i++, addr += 4096)
237 flush_cache_4096(addr, phys); 252 flush_cache_4096(addr, phys);
238 } 253 }
@@ -264,7 +279,7 @@ static inline void flush_icache_all(void)
264 279
265void flush_dcache_all(void) 280void flush_dcache_all(void)
266{ 281{
267 (*__flush_dcache_segment_fn)(0UL, current_cpu_data.dcache.way_size); 282 (*__flush_dcache_segment_fn)(0UL, boot_cpu_data.dcache.way_size);
268 wmb(); 283 wmb();
269} 284}
270 285
@@ -278,8 +293,8 @@ static void __flush_cache_mm(struct mm_struct *mm, unsigned long start,
278 unsigned long end) 293 unsigned long end)
279{ 294{
280 unsigned long d = 0, p = start & PAGE_MASK; 295 unsigned long d = 0, p = start & PAGE_MASK;
281 unsigned long alias_mask = current_cpu_data.dcache.alias_mask; 296 unsigned long alias_mask = boot_cpu_data.dcache.alias_mask;
282 unsigned long n_aliases = current_cpu_data.dcache.n_aliases; 297 unsigned long n_aliases = boot_cpu_data.dcache.n_aliases;
283 unsigned long select_bit; 298 unsigned long select_bit;
284 unsigned long all_aliases_mask; 299 unsigned long all_aliases_mask;
285 unsigned long addr_offset; 300 unsigned long addr_offset;
@@ -366,7 +381,7 @@ void flush_cache_mm(struct mm_struct *mm)
366 * If cache is only 4k-per-way, there are never any 'aliases'. Since 381 * If cache is only 4k-per-way, there are never any 'aliases'. Since
367 * the cache is physically tagged, the data can just be left in there. 382 * the cache is physically tagged, the data can just be left in there.
368 */ 383 */
369 if (current_cpu_data.dcache.n_aliases == 0) 384 if (boot_cpu_data.dcache.n_aliases == 0)
370 return; 385 return;
371 386
372 /* 387 /*
@@ -403,7 +418,7 @@ void flush_cache_page(struct vm_area_struct *vma, unsigned long address,
403 unsigned long phys = pfn << PAGE_SHIFT; 418 unsigned long phys = pfn << PAGE_SHIFT;
404 unsigned int alias_mask; 419 unsigned int alias_mask;
405 420
406 alias_mask = current_cpu_data.dcache.alias_mask; 421 alias_mask = boot_cpu_data.dcache.alias_mask;
407 422
408 /* We only need to flush D-cache when we have alias */ 423 /* We only need to flush D-cache when we have alias */
409 if ((address^phys) & alias_mask) { 424 if ((address^phys) & alias_mask) {
@@ -417,7 +432,7 @@ void flush_cache_page(struct vm_area_struct *vma, unsigned long address,
417 phys); 432 phys);
418 } 433 }
419 434
420 alias_mask = current_cpu_data.icache.alias_mask; 435 alias_mask = boot_cpu_data.icache.alias_mask;
421 if (vma->vm_flags & VM_EXEC) { 436 if (vma->vm_flags & VM_EXEC) {
422 /* 437 /*
423 * Evict entries from the portion of the cache from which code 438 * Evict entries from the portion of the cache from which code
@@ -449,7 +464,7 @@ void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
449 * If cache is only 4k-per-way, there are never any 'aliases'. Since 464 * If cache is only 4k-per-way, there are never any 'aliases'. Since
450 * the cache is physically tagged, the data can just be left in there. 465 * the cache is physically tagged, the data can just be left in there.
451 */ 466 */
452 if (current_cpu_data.dcache.n_aliases == 0) 467 if (boot_cpu_data.dcache.n_aliases == 0)
453 return; 468 return;
454 469
455 /* 470 /*
@@ -510,7 +525,7 @@ static void __flush_cache_4096(unsigned long addr, unsigned long phys,
510 unsigned long a, ea, p; 525 unsigned long a, ea, p;
511 unsigned long temp_pc; 526 unsigned long temp_pc;
512 527
513 dcache = &current_cpu_data.dcache; 528 dcache = &boot_cpu_data.dcache;
514 /* Write this way for better assembly. */ 529 /* Write this way for better assembly. */
515 way_count = dcache->ways; 530 way_count = dcache->ways;
516 way_incr = dcache->way_incr; 531 way_incr = dcache->way_incr;
@@ -585,7 +600,7 @@ static void __flush_dcache_segment_1way(unsigned long start,
585 base_addr = ((base_addr >> 16) << 16); 600 base_addr = ((base_addr >> 16) << 16);
586 base_addr |= start; 601 base_addr |= start;
587 602
588 dcache = &current_cpu_data.dcache; 603 dcache = &boot_cpu_data.dcache;
589 linesz = dcache->linesz; 604 linesz = dcache->linesz;
590 way_incr = dcache->way_incr; 605 way_incr = dcache->way_incr;
591 way_size = dcache->way_size; 606 way_size = dcache->way_size;
@@ -627,7 +642,7 @@ static void __flush_dcache_segment_2way(unsigned long start,
627 base_addr = ((base_addr >> 16) << 16); 642 base_addr = ((base_addr >> 16) << 16);
628 base_addr |= start; 643 base_addr |= start;
629 644
630 dcache = &current_cpu_data.dcache; 645 dcache = &boot_cpu_data.dcache;
631 linesz = dcache->linesz; 646 linesz = dcache->linesz;
632 way_incr = dcache->way_incr; 647 way_incr = dcache->way_incr;
633 way_size = dcache->way_size; 648 way_size = dcache->way_size;
@@ -686,7 +701,7 @@ static void __flush_dcache_segment_4way(unsigned long start,
686 base_addr = ((base_addr >> 16) << 16); 701 base_addr = ((base_addr >> 16) << 16);
687 base_addr |= start; 702 base_addr |= start;
688 703
689 dcache = &current_cpu_data.dcache; 704 dcache = &boot_cpu_data.dcache;
690 linesz = dcache->linesz; 705 linesz = dcache->linesz;
691 way_incr = dcache->way_incr; 706 way_incr = dcache->way_incr;
692 way_size = dcache->way_size; 707 way_size = dcache->way_size;
diff --git a/arch/sh/mm/copy_page.S b/arch/sh/mm/copy_page.S
index ae039f2da162..a81dbdb05596 100644
--- a/arch/sh/mm/copy_page.S
+++ b/arch/sh/mm/copy_page.S
@@ -141,47 +141,38 @@ ENTRY(__copy_user_page)
141 .long 9999b, 6000f ; \ 141 .long 9999b, 6000f ; \
142 .previous 142 .previous
143ENTRY(__copy_user) 143ENTRY(__copy_user)
144 tst r6,r6 ! Check explicitly for zero 144 ! Check if small number of bytes
145 bf 1f 145 mov #11,r0
146 rts
147 mov #0,r0 ! normal return
1481:
149 mov.l r10,@-r15
150 mov.l r9,@-r15
151 mov.l r8,@-r15
152 mov r4,r3 146 mov r4,r3
153 add r6,r3 ! last destination address 147 cmp/gt r0,r6 ! r6 (len) > r0 (11)
154 mov #12,r0 ! Check if small number of bytes 148 bf/s .L_cleanup_loop_no_pop
155 cmp/gt r0,r6 149 add r6,r3 ! last destination address
156 bt 2f 150
157 bra .L_cleanup_loop 151 ! Calculate bytes needed to align to src
158 nop 152 mov.l r11,@-r15
1592: 153 neg r5,r0
160 neg r5,r0 ! Calculate bytes needed to align source 154 mov.l r10,@-r15
161 add #4,r0 155 add #4,r0
156 mov.l r9,@-r15
162 and #3,r0 157 and #3,r0
158 mov.l r8,@-r15
163 tst r0,r0 159 tst r0,r0
164 bt .L_jump 160 bt 2f
165 mov r0,r1
166 161
167.L_loop1: 1621:
168 ! Copy bytes to align source 163 ! Copy bytes to long word align src
169EX( mov.b @r5+,r0 ) 164EX( mov.b @r5+,r1 )
170 dt r1 165 dt r0
171EX( mov.b r0,@r4 )
172 add #-1,r6 166 add #-1,r6
173 bf/s .L_loop1 167EX( mov.b r1,@r4 )
168 bf/s 1b
174 add #1,r4 169 add #1,r4
175 170
176.L_jump: 171 ! Jump to appropriate routine depending on dest
177 mov r6,r2 ! Calculate number of longwords to copy 1722: mov #3,r1
173 mov r6, r2
174 and r4,r1
178 shlr2 r2 175 shlr2 r2
179 tst r2,r2
180 bt .L_cleanup
181
182 mov r4,r0 ! Jump to appropriate routine
183 and #3,r0
184 mov r0,r1
185 shll2 r1 176 shll2 r1
186 mova .L_jump_tbl,r0 177 mova .L_jump_tbl,r0
187 mov.l @(r0,r1),r1 178 mov.l @(r0,r1),r1
@@ -195,43 +186,97 @@ EX( mov.b r0,@r4 )
195 .long .L_dest10 186 .long .L_dest10
196 .long .L_dest11 187 .long .L_dest11
197 188
189/*
190 * Come here if there are less than 12 bytes to copy
191 *
192 * Keep the branch target close, so the bf/s callee doesn't overflow
193 * and result in a more expensive branch being inserted. This is the
194 * fast-path for small copies, the jump via the jump table will hit the
195 * default slow-path cleanup. -PFM.
196 */
197.L_cleanup_loop_no_pop:
198 tst r6,r6 ! Check explicitly for zero
199 bt 1f
200
2012:
202EX( mov.b @r5+,r0 )
203 dt r6
204EX( mov.b r0,@r4 )
205 bf/s 2b
206 add #1,r4
207
2081: mov #0,r0 ! normal return
2095000:
210
211# Exception handler:
212.section .fixup, "ax"
2136000:
214 mov.l 8000f,r1
215 mov r3,r0
216 jmp @r1
217 sub r4,r0
218 .align 2
2198000: .long 5000b
220
221.previous
222 rts
223 nop
224
198! Destination = 00 225! Destination = 00
199 226
200.L_dest00: 227.L_dest00:
201 mov r2,r7 228 ! Skip the large copy for small transfers
202 shlr2 r7 229 mov #(32+32-4), r0
203 shlr r7 230 cmp/gt r6, r0 ! r0 (60) > r6 (len)
204 tst r7,r7 231 bt 1f
205 mov #7,r0 232
206 bt/s 1f 233 ! Align dest to a 32 byte boundary
207 and r0,r2 234 neg r4,r0
208 .align 2 235 add #0x20, r0
236 and #0x1f, r0
237 tst r0, r0
238 bt 2f
239
240 sub r0, r6
241 shlr2 r0
2423:
243EX( mov.l @r5+,r1 )
244 dt r0
245EX( mov.l r1,@r4 )
246 bf/s 3b
247 add #4,r4
248
2092: 2492:
210EX( mov.l @r5+,r0 ) 250EX( mov.l @r5+,r0 )
251EX( mov.l @r5+,r1 )
252EX( mov.l @r5+,r2 )
253EX( mov.l @r5+,r7 )
211EX( mov.l @r5+,r8 ) 254EX( mov.l @r5+,r8 )
212EX( mov.l @r5+,r9 ) 255EX( mov.l @r5+,r9 )
213EX( mov.l @r5+,r10 ) 256EX( mov.l @r5+,r10 )
214EX( mov.l r0,@r4 ) 257EX( mov.l @r5+,r11 )
215EX( mov.l r8,@(4,r4) ) 258EX( movca.l r0,@r4 )
216EX( mov.l r9,@(8,r4) ) 259 add #-32, r6
217EX( mov.l r10,@(12,r4) ) 260EX( mov.l r1,@(4,r4) )
218EX( mov.l @r5+,r0 ) 261 mov #32, r0
219EX( mov.l @r5+,r8 ) 262EX( mov.l r2,@(8,r4) )
220EX( mov.l @r5+,r9 ) 263 cmp/gt r6, r0 ! r0 (32) > r6 (len)
221EX( mov.l @r5+,r10 ) 264EX( mov.l r7,@(12,r4) )
222 dt r7 265EX( mov.l r8,@(16,r4) )
223EX( mov.l r0,@(16,r4) ) 266EX( mov.l r9,@(20,r4) )
224EX( mov.l r8,@(20,r4) ) 267EX( mov.l r10,@(24,r4) )
225EX( mov.l r9,@(24,r4) ) 268EX( mov.l r11,@(28,r4) )
226EX( mov.l r10,@(28,r4) )
227 bf/s 2b 269 bf/s 2b
228 add #32,r4 270 add #32,r4
229 tst r2,r2 271
2721: mov r6, r0
273 shlr2 r0
274 tst r0, r0
230 bt .L_cleanup 275 bt .L_cleanup
2311: 2761:
232EX( mov.l @r5+,r0 ) 277EX( mov.l @r5+,r1 )
233 dt r2 278 dt r0
234EX( mov.l r0,@r4 ) 279EX( mov.l r1,@r4 )
235 bf/s 1b 280 bf/s 1b
236 add #4,r4 281 add #4,r4
237 282
@@ -250,7 +295,7 @@ EX( mov.l r0,@r4 )
250 and r0,r2 295 and r0,r2
2512: 2962:
252 dt r7 297 dt r7
253#ifdef __LITTLE_ENDIAN__ 298#ifdef CONFIG_CPU_LITTLE_ENDIAN
254EX( mov.l @r5+,r0 ) 299EX( mov.l @r5+,r0 )
255EX( mov.l @r5+,r1 ) 300EX( mov.l @r5+,r1 )
256EX( mov.l @r5+,r8 ) 301EX( mov.l @r5+,r8 )
@@ -320,7 +365,7 @@ EX( mov.w r0,@(2,r4) )
3201: ! Read longword, write two words per iteration 3651: ! Read longword, write two words per iteration
321EX( mov.l @r5+,r0 ) 366EX( mov.l @r5+,r0 )
322 dt r2 367 dt r2
323#ifdef __LITTLE_ENDIAN__ 368#ifdef CONFIG_CPU_LITTLE_ENDIAN
324EX( mov.w r0,@r4 ) 369EX( mov.w r0,@r4 )
325 shlr16 r0 370 shlr16 r0
326EX( mov.w r0,@(2,r4) ) 371EX( mov.w r0,@(2,r4) )
@@ -342,7 +387,7 @@ EX( mov.w r0,@r4 )
342 ! Read longword, write byte, word, byte per iteration 387 ! Read longword, write byte, word, byte per iteration
343EX( mov.l @r5+,r0 ) 388EX( mov.l @r5+,r0 )
344 dt r2 389 dt r2
345#ifdef __LITTLE_ENDIAN__ 390#ifdef CONFIG_CPU_LITTLE_ENDIAN
346EX( mov.b r0,@r4 ) 391EX( mov.b r0,@r4 )
347 shlr8 r0 392 shlr8 r0
348 add #1,r4 393 add #1,r4
@@ -379,6 +424,7 @@ EX( mov.b r0,@r4 )
379 424
380.L_exit: 425.L_exit:
381 mov #0,r0 ! normal return 426 mov #0,r0 ! normal return
427
3825000: 4285000:
383 429
384# Exception handler: 430# Exception handler:
@@ -394,5 +440,6 @@ EX( mov.b r0,@r4 )
394.previous 440.previous
395 mov.l @r15+,r8 441 mov.l @r15+,r8
396 mov.l @r15+,r9 442 mov.l @r15+,r9
443 mov.l @r15+,r10
397 rts 444 rts
398 mov.l @r15+,r10 445 mov.l @r15+,r11
diff --git a/arch/sh/mm/fault-nommu.c b/arch/sh/mm/fault-nommu.c
deleted file mode 100644
index c6f5b51ec2c7..000000000000
--- a/arch/sh/mm/fault-nommu.c
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * arch/sh/mm/fault-nommu.c
3 *
4 * Copyright (C) 2002 - 2007 Paul Mundt
5 *
6 * Based on linux/arch/sh/mm/fault.c:
7 * Copyright (C) 1999 Niibe Yutaka
8 *
9 * Released under the terms of the GNU GPL v2.0.
10 */
11#include <linux/kernel.h>
12#include <linux/mm.h>
13#include <linux/hardirq.h>
14#include <linux/kprobes.h>
15#include <asm/system.h>
16#include <asm/ptrace.h>
17#include <asm/kgdb.h>
18
19/*
20 * This routine handles page faults. It determines the address,
21 * and the problem, and then passes it off to one of the appropriate
22 * routines.
23 */
24asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
25 unsigned long writeaccess,
26 unsigned long address)
27{
28 trace_hardirqs_on();
29 local_irq_enable();
30
31#if defined(CONFIG_SH_KGDB)
32 if (kgdb_nofault && kgdb_bus_err_hook)
33 kgdb_bus_err_hook();
34#endif
35
36 /*
37 * Oops. The kernel tried to access some bad page. We'll have to
38 * terminate things with extreme prejudice.
39 *
40 */
41 if (address < PAGE_SIZE) {
42 printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
43 } else {
44 printk(KERN_ALERT "Unable to handle kernel paging request");
45 }
46
47 printk(" at virtual address %08lx\n", address);
48 printk(KERN_ALERT "pc = %08lx\n", regs->pc);
49
50 die("Oops", regs, writeaccess);
51 do_exit(SIGKILL);
52}
53
54asmlinkage int __kprobes __do_page_fault(struct pt_regs *regs,
55 unsigned long writeaccess,
56 unsigned long address)
57{
58#if defined(CONFIG_SH_KGDB)
59 if (kgdb_nofault && kgdb_bus_err_hook)
60 kgdb_bus_err_hook();
61#endif
62
63 return (address >= TASK_SIZE);
64}
diff --git a/arch/sh/mm/fault.c b/arch/sh/mm/fault.c
index 04a39aa7f1f9..4729668ce5bf 100644
--- a/arch/sh/mm/fault.c
+++ b/arch/sh/mm/fault.c
@@ -214,7 +214,7 @@ out_of_memory:
214 } 214 }
215 printk("VM: killing process %s\n", tsk->comm); 215 printk("VM: killing process %s\n", tsk->comm);
216 if (user_mode(regs)) 216 if (user_mode(regs))
217 do_exit(SIGKILL); 217 do_group_exit(SIGKILL);
218 goto no_context; 218 goto no_context;
219 219
220do_sigbus: 220do_sigbus:
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index 82b68c789a5f..d5e160da64b2 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -294,12 +294,6 @@ int arch_add_memory(int nid, u64 start, u64 size)
294} 294}
295EXPORT_SYMBOL_GPL(arch_add_memory); 295EXPORT_SYMBOL_GPL(arch_add_memory);
296 296
297int remove_memory(u64 start, u64 size)
298{
299 return -EINVAL;
300}
301EXPORT_SYMBOL_GPL(remove_memory);
302
303#ifdef CONFIG_NUMA 297#ifdef CONFIG_NUMA
304int memory_add_physaddr_to_nid(u64 addr) 298int memory_add_physaddr_to_nid(u64 addr)
305{ 299{
diff --git a/arch/sh/mm/pmb.c b/arch/sh/mm/pmb.c
index a08a4a958add..7d43758dc244 100644
--- a/arch/sh/mm/pmb.c
+++ b/arch/sh/mm/pmb.c
@@ -145,7 +145,7 @@ repeat:
145 145
146 ctrl_outl(vpn | PMB_V, mk_pmb_addr(pos)); 146 ctrl_outl(vpn | PMB_V, mk_pmb_addr(pos));
147 147
148#ifdef CONFIG_SH_WRITETHROUGH 148#ifdef CONFIG_CACHE_WRITETHROUGH
149 /* 149 /*
150 * When we are in 32-bit address extended mode, CCR.CB becomes 150 * When we are in 32-bit address extended mode, CCR.CB becomes
151 * invalid, so care must be taken to manually adjust cacheable 151 * invalid, so care must be taken to manually adjust cacheable
diff --git a/arch/sh/mm/tlb-sh4.c b/arch/sh/mm/tlb-sh4.c
index f74cf667c8fa..2d1dd6044307 100644
--- a/arch/sh/mm/tlb-sh4.c
+++ b/arch/sh/mm/tlb-sh4.c
@@ -4,27 +4,14 @@
4 * SH-4 specific TLB operations 4 * SH-4 specific TLB operations
5 * 5 *
6 * Copyright (C) 1999 Niibe Yutaka 6 * Copyright (C) 1999 Niibe Yutaka
7 * Copyright (C) 2002 Paul Mundt 7 * Copyright (C) 2002 - 2007 Paul Mundt
8 * 8 *
9 * Released under the terms of the GNU GPL v2.0. 9 * Released under the terms of the GNU GPL v2.0.
10 */ 10 */
11#include <linux/signal.h>
12#include <linux/sched.h>
13#include <linux/kernel.h> 11#include <linux/kernel.h>
14#include <linux/errno.h>
15#include <linux/string.h>
16#include <linux/types.h>
17#include <linux/ptrace.h>
18#include <linux/mman.h>
19#include <linux/mm.h> 12#include <linux/mm.h>
20#include <linux/smp.h> 13#include <linux/io.h>
21#include <linux/smp_lock.h>
22#include <linux/interrupt.h>
23
24#include <asm/system.h> 14#include <asm/system.h>
25#include <asm/io.h>
26#include <asm/uaccess.h>
27#include <asm/pgalloc.h>
28#include <asm/mmu_context.h> 15#include <asm/mmu_context.h>
29#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
30 17
@@ -34,22 +21,27 @@ void update_mmu_cache(struct vm_area_struct * vma,
34 unsigned long flags; 21 unsigned long flags;
35 unsigned long pteval; 22 unsigned long pteval;
36 unsigned long vpn; 23 unsigned long vpn;
37 struct page *page;
38 unsigned long pfn;
39 24
40 /* Ptrace may call this routine. */ 25 /* Ptrace may call this routine. */
41 if (vma && current->active_mm != vma->vm_mm) 26 if (vma && current->active_mm != vma->vm_mm)
42 return; 27 return;
43 28
44 pfn = pte_pfn(pte); 29#ifndef CONFIG_CACHE_OFF
45 if (pfn_valid(pfn)) { 30 {
46 page = pfn_to_page(pfn); 31 unsigned long pfn = pte_pfn(pte);
47 if (!test_bit(PG_mapped, &page->flags)) { 32
48 unsigned long phys = pte_val(pte) & PTE_PHYS_MASK; 33 if (pfn_valid(pfn)) {
49 __flush_wback_region((void *)P1SEGADDR(phys), PAGE_SIZE); 34 struct page *page = pfn_to_page(pfn);
50 __set_bit(PG_mapped, &page->flags); 35
36 if (!test_bit(PG_mapped, &page->flags)) {
37 unsigned long phys = pte_val(pte) & PTE_PHYS_MASK;
38 __flush_wback_region((void *)P1SEGADDR(phys),
39 PAGE_SIZE);
40 __set_bit(PG_mapped, &page->flags);
41 }
51 } 42 }
52 } 43 }
44#endif
53 45
54 local_irq_save(flags); 46 local_irq_save(flags);
55 47
@@ -57,16 +49,26 @@ void update_mmu_cache(struct vm_area_struct * vma,
57 vpn = (address & MMU_VPN_MASK) | get_asid(); 49 vpn = (address & MMU_VPN_MASK) | get_asid();
58 ctrl_outl(vpn, MMU_PTEH); 50 ctrl_outl(vpn, MMU_PTEH);
59 51
60 pteval = pte_val(pte); 52 pteval = pte.pte_low;
61 53
62 /* Set PTEA register */ 54 /* Set PTEA register */
55#ifdef CONFIG_X2TLB
56 /*
57 * For the extended mode TLB this is trivial, only the ESZ and
58 * EPR bits need to be written out to PTEA, with the remainder of
59 * the protection bits (with the exception of the compat-mode SZ
60 * and PR bits, which are cleared) being written out in PTEL.
61 */
62 ctrl_outl(pte.pte_high, MMU_PTEA);
63#else
63 if (cpu_data->flags & CPU_HAS_PTEA) 64 if (cpu_data->flags & CPU_HAS_PTEA)
64 /* TODO: make this look less hacky */ 65 /* TODO: make this look less hacky */
65 ctrl_outl(((pteval >> 28) & 0xe) | (pteval & 0x1), MMU_PTEA); 66 ctrl_outl(((pteval >> 28) & 0xe) | (pteval & 0x1), MMU_PTEA);
67#endif
66 68
67 /* Set PTEL register */ 69 /* Set PTEL register */
68 pteval &= _PAGE_FLAGS_HARDWARE_MASK; /* drop software flags */ 70 pteval &= _PAGE_FLAGS_HARDWARE_MASK; /* drop software flags */
69#ifdef CONFIG_SH_WRITETHROUGH 71#ifdef CONFIG_CACHE_WRITETHROUGH
70 pteval |= _PAGE_WT; 72 pteval |= _PAGE_WT;
71#endif 73#endif
72 /* conveniently, we want all the software flags to be 0 anyway */ 74 /* conveniently, we want all the software flags to be 0 anyway */
@@ -93,4 +95,3 @@ void local_flush_tlb_one(unsigned long asid, unsigned long page)
93 ctrl_outl(data, addr); 95 ctrl_outl(data, addr);
94 back_to_P1(); 96 back_to_P1();
95} 97}
96
diff --git a/arch/sh64/Kconfig b/arch/sh64/Kconfig
index 5664631d8ae5..b3327ce8e82f 100644
--- a/arch/sh64/Kconfig
+++ b/arch/sh64/Kconfig
@@ -36,6 +36,14 @@ config GENERIC_CALIBRATE_DELAY
36 bool 36 bool
37 default y 37 default y
38 38
39config GENERIC_HARDIRQS
40 bool
41 default y
42
43config GENERIC_IRQ_PROBE
44 bool
45 default y
46
39config RWSEM_XCHGADD_ALGORITHM 47config RWSEM_XCHGADD_ALGORITHM
40 bool 48 bool
41 49
@@ -58,18 +66,12 @@ choice
58 prompt "SuperH system type" 66 prompt "SuperH system type"
59 default SH_SIMULATOR 67 default SH_SIMULATOR
60 68
61config SH_GENERIC
62 bool "Generic"
63
64config SH_SIMULATOR 69config SH_SIMULATOR
65 bool "Simulator" 70 bool "Simulator"
66 71
67config SH_CAYMAN 72config SH_CAYMAN
68 bool "Cayman" 73 bool "Cayman"
69 74
70config SH_ROMRAM
71 bool "ROM/RAM"
72
73config SH_HARP 75config SH_HARP
74 bool "ST50-Harp" 76 bool "ST50-Harp"
75 77
@@ -152,60 +154,54 @@ comment "Memory options"
152 154
153config CACHED_MEMORY_OFFSET 155config CACHED_MEMORY_OFFSET
154 hex "Cached Area Offset" 156 hex "Cached Area Offset"
155 depends on SH_HARP || SH_CAYMAN || SH_SIMULATOR
156 default "20000000" 157 default "20000000"
157 158
158config MEMORY_START 159config MEMORY_START
159 hex "Physical memory start address" 160 hex "Physical memory start address"
160 depends on SH_HARP || SH_CAYMAN || SH_SIMULATOR
161 default "80000000" 161 default "80000000"
162 162
163config MEMORY_SIZE_IN_MB 163config MEMORY_SIZE_IN_MB
164 int "Memory size (in MB)" if SH_HARP || SH_CAYMAN || SH_SIMULATOR 164 int "Memory size (in MB)"
165 default "64" if SH_HARP || SH_CAYMAN
166 default "8" if SH_SIMULATOR 165 default "8" if SH_SIMULATOR
166 default "64"
167 167
168comment "Cache options" 168comment "Cache options"
169 169
170config DCACHE_DISABLED
171 bool "DCache Disabling"
172 depends on SH_HARP || SH_CAYMAN || SH_SIMULATOR
173
174choice 170choice
175 prompt "DCache mode" 171 prompt "DCache mode"
176 depends on !DCACHE_DISABLED && !SH_SIMULATOR 172 default DCACHE_DISABLED if SH_SIMULATOR
177 default DCACHE_WRITE_BACK 173 default DCACHE_WRITE_BACK
178 174
179config DCACHE_WRITE_BACK 175config DCACHE_WRITE_BACK
180 bool "Write-back" 176 bool "Write-back"
177 depends on !SH_SIMULATOR
181 178
182config DCACHE_WRITE_THROUGH 179config DCACHE_WRITE_THROUGH
183 bool "Write-through" 180 bool "Write-through"
181 depends on !SH_SIMULATOR
182
183config DCACHE_DISABLED
184 bool "Disabled"
184 185
185endchoice 186endchoice
186 187
187config ICACHE_DISABLED 188config ICACHE_DISABLED
188 bool "ICache Disabling" 189 bool "ICache Disabling"
189 depends on SH_HARP || SH_CAYMAN || SH_SIMULATOR
190 190
191config PCIDEVICE_MEMORY_START 191config PCIDEVICE_MEMORY_START
192 hex 192 hex
193 depends on SH_HARP || SH_CAYMAN || SH_SIMULATOR
194 default "C0000000" 193 default "C0000000"
195 194
196config DEVICE_MEMORY_START 195config DEVICE_MEMORY_START
197 hex 196 hex
198 depends on SH_HARP || SH_CAYMAN || SH_SIMULATOR
199 default "E0000000" 197 default "E0000000"
200 198
201config FLASH_MEMORY_START 199config FLASH_MEMORY_START
202 hex "Flash memory/on-chip devices start address" 200 hex "Flash memory/on-chip devices start address"
203 depends on SH_HARP || SH_CAYMAN || SH_SIMULATOR
204 default "00000000" 201 default "00000000"
205 202
206config PCI_BLOCK_START 203config PCI_BLOCK_START
207 hex "PCI block start address" 204 hex "PCI block start address"
208 depends on SH_HARP || SH_CAYMAN || SH_SIMULATOR
209 default "40000000" 205 default "40000000"
210 206
211comment "CPU Subtype specific options" 207comment "CPU Subtype specific options"
@@ -214,8 +210,10 @@ config SH64_ID2815_WORKAROUND
214 bool "Include workaround for SH5-101 cut2 silicon defect ID2815" 210 bool "Include workaround for SH5-101 cut2 silicon defect ID2815"
215 211
216comment "Misc options" 212comment "Misc options"
213
217config HEARTBEAT 214config HEARTBEAT
218 bool "Heartbeat LED" 215 bool "Heartbeat LED"
216 depends on SH_CAYMAN
219 217
220config HDSP253_LED 218config HDSP253_LED
221 bool "Support for HDSP-253 LED" 219 bool "Support for HDSP-253 LED"
@@ -242,6 +240,7 @@ config SBUS
242 240
243config PCI 241config PCI
244 bool "PCI support" 242 bool "PCI support"
243 depends on SH_CAYMAN
245 help 244 help
246 Find out whether you have a PCI motherboard. PCI is the name of a 245 Find out whether you have a PCI motherboard. PCI is the name of a
247 bus system, i.e. the way the CPU talks to the other stuff inside 246 bus system, i.e. the way the CPU talks to the other stuff inside
@@ -294,15 +293,3 @@ source "security/Kconfig"
294source "crypto/Kconfig" 293source "crypto/Kconfig"
295 294
296source "lib/Kconfig" 295source "lib/Kconfig"
297
298#
299# Use the generic interrupt handling code in kernel/irq/:
300#
301config GENERIC_HARDIRQS
302 bool
303 default y
304
305config GENERIC_IRQ_PROBE
306 bool
307 default y
308
diff --git a/arch/sh64/Kconfig.debug b/arch/sh64/Kconfig.debug
index 26d842c07139..05c07c4e4ed6 100644
--- a/arch/sh64/Kconfig.debug
+++ b/arch/sh64/Kconfig.debug
@@ -5,9 +5,6 @@ source "lib/Kconfig.debug"
5config EARLY_PRINTK 5config EARLY_PRINTK
6 bool "Early SCIF console support" 6 bool "Early SCIF console support"
7 7
8config DEBUG_KERNEL_WITH_GDB_STUB
9 bool "GDB Stub kernel debug"
10
11config SH64_PROC_TLB 8config SH64_PROC_TLB
12 bool "Debug: report TLB fill/purge activity through /proc/tlb" 9 bool "Debug: report TLB fill/purge activity through /proc/tlb"
13 depends on PROC_FS 10 depends on PROC_FS
@@ -28,17 +25,9 @@ config POOR_MANS_STRACE
28 25
29config SH_ALPHANUMERIC 26config SH_ALPHANUMERIC
30 bool "Enable debug outputs to on-board alphanumeric display" 27 bool "Enable debug outputs to on-board alphanumeric display"
28 depends on SH_CAYMAN
31 29
32config SH_NO_BSS_INIT 30config SH_NO_BSS_INIT
33 bool "Avoid zeroing BSS (to speed-up startup on suitable platforms)" 31 bool "Avoid zeroing BSS (to speed-up startup on suitable platforms)"
34 32
35config FRAME_POINTER
36 bool "Compile the kernel with frame pointers"
37 default y if KGDB
38 help
39 If you say Y here the resulting kernel image will be slightly larger
40 and slower, but it will give very useful debugging information.
41 If you don't debug the kernel, you can say N, but we may not be able
42 to solve problems without frame pointers.
43
44endmenu 33endmenu
diff --git a/arch/sh64/Makefile b/arch/sh64/Makefile
index 9e874de0a096..8dac7e1a2be6 100644
--- a/arch/sh64/Makefile
+++ b/arch/sh64/Makefile
@@ -40,6 +40,8 @@ OBJCOPYFLAGS := -O binary -R .note -R .comment -R .stab -R .stabstr -S
40# 40#
41KBUILD_DEFCONFIG := cayman_defconfig 41KBUILD_DEFCONFIG := cayman_defconfig
42 42
43KBUILD_IMAGE := arch/$(ARCH)/boot/zImage
44
43ifdef LOADADDR 45ifdef LOADADDR
44LINKFLAGS += -Ttext $(word 1,$(LOADADDR)) 46LINKFLAGS += -Ttext $(word 1,$(LOADADDR))
45endif 47endif
@@ -47,7 +49,6 @@ endif
47machine-$(CONFIG_SH_CAYMAN) := cayman 49machine-$(CONFIG_SH_CAYMAN) := cayman
48machine-$(CONFIG_SH_SIMULATOR) := sim 50machine-$(CONFIG_SH_SIMULATOR) := sim
49machine-$(CONFIG_SH_HARP) := harp 51machine-$(CONFIG_SH_HARP) := harp
50machine-$(CONFIG_SH_ROMRAM) := romram
51 52
52head-y := arch/$(ARCH)/kernel/head.o arch/$(ARCH)/kernel/init_task.o 53head-y := arch/$(ARCH)/kernel/head.o arch/$(ARCH)/kernel/init_task.o
53 54
@@ -106,6 +107,5 @@ arch/$(ARCH)/lib/syscalltab.h: arch/sh64/kernel/syscalls.S
106CLEAN_FILES += arch/$(ARCH)/lib/syscalltab.h 107CLEAN_FILES += arch/$(ARCH)/lib/syscalltab.h
107 108
108define archhelp 109define archhelp
109 @echo ' zImage - Compressed kernel image (arch/sh64/boot/zImage)' 110 @echo '* zImage - Compressed kernel image'
110endef 111endef
111
diff --git a/arch/sh64/configs/cayman_defconfig b/arch/sh64/configs/cayman_defconfig
index 784434143343..91b59118c1b1 100644
--- a/arch/sh64/configs/cayman_defconfig
+++ b/arch/sh64/configs/cayman_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22 3# Linux kernel version: 2.6.23-rc8
4# Fri Jul 20 12:28:34 2007 4# Tue Oct 9 15:37:16 2007
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH64=y 7CONFIG_SUPERH64=y
@@ -11,21 +11,20 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
11CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
12CONFIG_GENERIC_HWEIGHT=y 12CONFIG_GENERIC_HWEIGHT=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y 13CONFIG_GENERIC_CALIBRATE_DELAY=y
14CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_IRQ_PROBE=y
14# CONFIG_ARCH_HAS_ILOG2_U32 is not set 16# CONFIG_ARCH_HAS_ILOG2_U32 is not set
15# CONFIG_ARCH_HAS_ILOG2_U64 is not set 17# CONFIG_ARCH_HAS_ILOG2_U64 is not set
18CONFIG_ARCH_NO_VIRT_TO_BUS=y
16CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 19CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
17 20
18# 21#
19# Code maturity level options 22# General setup
20# 23#
21CONFIG_EXPERIMENTAL=y 24CONFIG_EXPERIMENTAL=y
22CONFIG_BROKEN_ON_SMP=y 25CONFIG_BROKEN_ON_SMP=y
23CONFIG_LOCK_KERNEL=y 26CONFIG_LOCK_KERNEL=y
24CONFIG_INIT_ENV_ARG_LIMIT=32 27CONFIG_INIT_ENV_ARG_LIMIT=32
25
26#
27# General setup
28#
29CONFIG_LOCALVERSION="" 28CONFIG_LOCALVERSION=""
30CONFIG_LOCALVERSION_AUTO=y 29CONFIG_LOCALVERSION_AUTO=y
31CONFIG_SWAP=y 30CONFIG_SWAP=y
@@ -57,7 +56,6 @@ CONFIG_FUTEX=y
57CONFIG_ANON_INODES=y 56CONFIG_ANON_INODES=y
58CONFIG_EPOLL=y 57CONFIG_EPOLL=y
59CONFIG_SIGNALFD=y 58CONFIG_SIGNALFD=y
60CONFIG_TIMERFD=y
61CONFIG_EVENTFD=y 59CONFIG_EVENTFD=y
62CONFIG_SHMEM=y 60CONFIG_SHMEM=y
63CONFIG_VM_EVENT_COUNTERS=y 61CONFIG_VM_EVENT_COUNTERS=y
@@ -67,7 +65,12 @@ CONFIG_SLAB=y
67CONFIG_RT_MUTEXES=y 65CONFIG_RT_MUTEXES=y
68# CONFIG_TINY_SHMEM is not set 66# CONFIG_TINY_SHMEM is not set
69CONFIG_BASE_SMALL=0 67CONFIG_BASE_SMALL=0
70# CONFIG_MODULES is not set 68CONFIG_MODULES=y
69CONFIG_MODULE_UNLOAD=y
70# CONFIG_MODULE_FORCE_UNLOAD is not set
71# CONFIG_MODVERSIONS is not set
72# CONFIG_MODULE_SRCVERSION_ALL is not set
73CONFIG_KMOD=y
71CONFIG_BLOCK=y 74CONFIG_BLOCK=y
72# CONFIG_LBD is not set 75# CONFIG_LBD is not set
73# CONFIG_BLK_DEV_IO_TRACE is not set 76# CONFIG_BLK_DEV_IO_TRACE is not set
@@ -90,10 +93,8 @@ CONFIG_DEFAULT_IOSCHED="cfq"
90# 93#
91# System type 94# System type
92# 95#
93# CONFIG_SH_GENERIC is not set
94# CONFIG_SH_SIMULATOR is not set 96# CONFIG_SH_SIMULATOR is not set
95CONFIG_SH_CAYMAN=y 97CONFIG_SH_CAYMAN=y
96# CONFIG_SH_ROMRAM is not set
97# CONFIG_SH_HARP is not set 98# CONFIG_SH_HARP is not set
98CONFIG_CPU_SH5=y 99CONFIG_CPU_SH5=y
99CONFIG_CPU_SUBTYPE_SH5_101=y 100CONFIG_CPU_SUBTYPE_SH5_101=y
@@ -119,9 +120,9 @@ CONFIG_MEMORY_SIZE_IN_MB=128
119# 120#
120# Cache options 121# Cache options
121# 122#
122# CONFIG_DCACHE_DISABLED is not set
123CONFIG_DCACHE_WRITE_BACK=y 123CONFIG_DCACHE_WRITE_BACK=y
124# CONFIG_DCACHE_WRITE_THROUGH is not set 124# CONFIG_DCACHE_WRITE_THROUGH is not set
125# CONFIG_DCACHE_DISABLED is not set
125# CONFIG_ICACHE_DISABLED is not set 126# CONFIG_ICACHE_DISABLED is not set
126CONFIG_PCIDEVICE_MEMORY_START=C0000000 127CONFIG_PCIDEVICE_MEMORY_START=C0000000
127CONFIG_DEVICE_MEMORY_START=E0000000 128CONFIG_DEVICE_MEMORY_START=E0000000
@@ -151,7 +152,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
151# CONFIG_RESOURCES_64BIT is not set 152# CONFIG_RESOURCES_64BIT is not set
152CONFIG_ZONE_DMA_FLAG=0 153CONFIG_ZONE_DMA_FLAG=0
153CONFIG_NR_QUICK=1 154CONFIG_NR_QUICK=1
154CONFIG_VIRT_TO_BUS=y
155 155
156# 156#
157# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 157# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
@@ -276,7 +276,6 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
276# CONFIG_MTD is not set 276# CONFIG_MTD is not set
277# CONFIG_PARPORT is not set 277# CONFIG_PARPORT is not set
278CONFIG_BLK_DEV=y 278CONFIG_BLK_DEV=y
279# CONFIG_BLK_CPQ_DA is not set
280# CONFIG_BLK_CPQ_CISS_DA is not set 279# CONFIG_BLK_CPQ_CISS_DA is not set
281# CONFIG_BLK_DEV_DAC960 is not set 280# CONFIG_BLK_DEV_DAC960 is not set
282# CONFIG_BLK_DEV_UMEM is not set 281# CONFIG_BLK_DEV_UMEM is not set
@@ -325,6 +324,7 @@ CONFIG_SCSI_MULTI_LUN=y
325# CONFIG_SCSI_CONSTANTS is not set 324# CONFIG_SCSI_CONSTANTS is not set
326# CONFIG_SCSI_LOGGING is not set 325# CONFIG_SCSI_LOGGING is not set
327# CONFIG_SCSI_SCAN_ASYNC is not set 326# CONFIG_SCSI_SCAN_ASYNC is not set
327CONFIG_SCSI_WAIT_SCAN=m
328 328
329# 329#
330# SCSI Transports 330# SCSI Transports
@@ -332,12 +332,8 @@ CONFIG_SCSI_MULTI_LUN=y
332CONFIG_SCSI_SPI_ATTRS=y 332CONFIG_SCSI_SPI_ATTRS=y
333# CONFIG_SCSI_FC_ATTRS is not set 333# CONFIG_SCSI_FC_ATTRS is not set
334# CONFIG_SCSI_ISCSI_ATTRS is not set 334# CONFIG_SCSI_ISCSI_ATTRS is not set
335# CONFIG_SCSI_SAS_ATTRS is not set
336# CONFIG_SCSI_SAS_LIBSAS is not set 335# CONFIG_SCSI_SAS_LIBSAS is not set
337 336CONFIG_SCSI_LOWLEVEL=y
338#
339# SCSI low-level drivers
340#
341# CONFIG_ISCSI_TCP is not set 337# CONFIG_ISCSI_TCP is not set
342# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 338# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
343# CONFIG_SCSI_3W_9XXX is not set 339# CONFIG_SCSI_3W_9XXX is not set
@@ -347,7 +343,6 @@ CONFIG_SCSI_SPI_ATTRS=y
347# CONFIG_SCSI_AIC7XXX_OLD is not set 343# CONFIG_SCSI_AIC7XXX_OLD is not set
348# CONFIG_SCSI_AIC79XX is not set 344# CONFIG_SCSI_AIC79XX is not set
349# CONFIG_SCSI_AIC94XX is not set 345# CONFIG_SCSI_AIC94XX is not set
350# CONFIG_SCSI_DPT_I2O is not set
351# CONFIG_SCSI_ARCMSR is not set 346# CONFIG_SCSI_ARCMSR is not set
352# CONFIG_MEGARAID_NEWGEN is not set 347# CONFIG_MEGARAID_NEWGEN is not set
353# CONFIG_MEGARAID_LEGACY is not set 348# CONFIG_MEGARAID_LEGACY is not set
@@ -449,6 +444,7 @@ CONFIG_NETDEV_1000=y
449# CONFIG_SIS190 is not set 444# CONFIG_SIS190 is not set
450# CONFIG_SKGE is not set 445# CONFIG_SKGE is not set
451# CONFIG_SKY2 is not set 446# CONFIG_SKY2 is not set
447# CONFIG_SK98LIN is not set
452# CONFIG_VIA_VELOCITY is not set 448# CONFIG_VIA_VELOCITY is not set
453# CONFIG_TIGON3 is not set 449# CONFIG_TIGON3 is not set
454# CONFIG_BNX2 is not set 450# CONFIG_BNX2 is not set
@@ -572,7 +568,6 @@ CONFIG_WATCHDOG=y
572# Watchdog Device Drivers 568# Watchdog Device Drivers
573# 569#
574# CONFIG_SOFT_WATCHDOG is not set 570# CONFIG_SOFT_WATCHDOG is not set
575# CONFIG_SH_WDT is not set
576 571
577# 572#
578# PCI-based Watchdog Cards 573# PCI-based Watchdog Cards
@@ -586,7 +581,59 @@ CONFIG_HW_RANDOM=y
586# CONFIG_RAW_DRIVER is not set 581# CONFIG_RAW_DRIVER is not set
587# CONFIG_TCG_TPM is not set 582# CONFIG_TCG_TPM is not set
588CONFIG_DEVPORT=y 583CONFIG_DEVPORT=y
589# CONFIG_I2C is not set 584CONFIG_I2C=m
585CONFIG_I2C_BOARDINFO=y
586# CONFIG_I2C_CHARDEV is not set
587
588#
589# I2C Algorithms
590#
591# CONFIG_I2C_ALGOBIT is not set
592# CONFIG_I2C_ALGOPCF is not set
593# CONFIG_I2C_ALGOPCA is not set
594
595#
596# I2C Hardware Bus support
597#
598# CONFIG_I2C_ALI1535 is not set
599# CONFIG_I2C_ALI1563 is not set
600# CONFIG_I2C_ALI15X3 is not set
601# CONFIG_I2C_AMD756 is not set
602# CONFIG_I2C_AMD8111 is not set
603# CONFIG_I2C_I801 is not set
604# CONFIG_I2C_I810 is not set
605# CONFIG_I2C_PIIX4 is not set
606# CONFIG_I2C_NFORCE2 is not set
607# CONFIG_I2C_OCORES is not set
608# CONFIG_I2C_PARPORT_LIGHT is not set
609# CONFIG_I2C_PROSAVAGE is not set
610# CONFIG_I2C_SAVAGE4 is not set
611# CONFIG_I2C_SIMTEC is not set
612# CONFIG_I2C_SIS5595 is not set
613# CONFIG_I2C_SIS630 is not set
614# CONFIG_I2C_SIS96X is not set
615# CONFIG_I2C_TAOS_EVM is not set
616# CONFIG_I2C_STUB is not set
617# CONFIG_I2C_VIA is not set
618# CONFIG_I2C_VIAPRO is not set
619# CONFIG_I2C_VOODOO3 is not set
620
621#
622# Miscellaneous I2C Chip support
623#
624# CONFIG_SENSORS_DS1337 is not set
625# CONFIG_SENSORS_DS1374 is not set
626# CONFIG_DS1682 is not set
627# CONFIG_SENSORS_EEPROM is not set
628# CONFIG_SENSORS_PCF8574 is not set
629# CONFIG_SENSORS_PCA9539 is not set
630# CONFIG_SENSORS_PCF8591 is not set
631# CONFIG_SENSORS_MAX6875 is not set
632# CONFIG_SENSORS_TSL2550 is not set
633# CONFIG_I2C_DEBUG_CORE is not set
634# CONFIG_I2C_DEBUG_ALGO is not set
635# CONFIG_I2C_DEBUG_BUS is not set
636# CONFIG_I2C_DEBUG_CHIP is not set
590 637
591# 638#
592# SPI support 639# SPI support
@@ -599,16 +646,51 @@ CONFIG_HWMON=y
599# CONFIG_HWMON_VID is not set 646# CONFIG_HWMON_VID is not set
600# CONFIG_SENSORS_ABITUGURU is not set 647# CONFIG_SENSORS_ABITUGURU is not set
601# CONFIG_SENSORS_ABITUGURU3 is not set 648# CONFIG_SENSORS_ABITUGURU3 is not set
649# CONFIG_SENSORS_AD7418 is not set
650# CONFIG_SENSORS_ADM1021 is not set
651# CONFIG_SENSORS_ADM1025 is not set
652# CONFIG_SENSORS_ADM1026 is not set
653# CONFIG_SENSORS_ADM1029 is not set
654# CONFIG_SENSORS_ADM1031 is not set
655# CONFIG_SENSORS_ADM9240 is not set
656# CONFIG_SENSORS_ASB100 is not set
657# CONFIG_SENSORS_ATXP1 is not set
658# CONFIG_SENSORS_DS1621 is not set
602# CONFIG_SENSORS_F71805F is not set 659# CONFIG_SENSORS_F71805F is not set
660# CONFIG_SENSORS_FSCHER is not set
661# CONFIG_SENSORS_FSCPOS is not set
662# CONFIG_SENSORS_GL518SM is not set
663# CONFIG_SENSORS_GL520SM is not set
603# CONFIG_SENSORS_IT87 is not set 664# CONFIG_SENSORS_IT87 is not set
665# CONFIG_SENSORS_LM63 is not set
666# CONFIG_SENSORS_LM75 is not set
667# CONFIG_SENSORS_LM77 is not set
668# CONFIG_SENSORS_LM78 is not set
669# CONFIG_SENSORS_LM80 is not set
670# CONFIG_SENSORS_LM83 is not set
671# CONFIG_SENSORS_LM85 is not set
672# CONFIG_SENSORS_LM87 is not set
673# CONFIG_SENSORS_LM90 is not set
674# CONFIG_SENSORS_LM92 is not set
675# CONFIG_SENSORS_LM93 is not set
676# CONFIG_SENSORS_MAX1619 is not set
677# CONFIG_SENSORS_MAX6650 is not set
604# CONFIG_SENSORS_PC87360 is not set 678# CONFIG_SENSORS_PC87360 is not set
605# CONFIG_SENSORS_PC87427 is not set 679# CONFIG_SENSORS_PC87427 is not set
606# CONFIG_SENSORS_SIS5595 is not set 680# CONFIG_SENSORS_SIS5595 is not set
681# CONFIG_SENSORS_DME1737 is not set
607# CONFIG_SENSORS_SMSC47M1 is not set 682# CONFIG_SENSORS_SMSC47M1 is not set
683# CONFIG_SENSORS_SMSC47M192 is not set
608# CONFIG_SENSORS_SMSC47B397 is not set 684# CONFIG_SENSORS_SMSC47B397 is not set
685# CONFIG_SENSORS_THMC50 is not set
609# CONFIG_SENSORS_VIA686A is not set 686# CONFIG_SENSORS_VIA686A is not set
610# CONFIG_SENSORS_VT1211 is not set 687# CONFIG_SENSORS_VT1211 is not set
611# CONFIG_SENSORS_VT8231 is not set 688# CONFIG_SENSORS_VT8231 is not set
689# CONFIG_SENSORS_W83781D is not set
690# CONFIG_SENSORS_W83791D is not set
691# CONFIG_SENSORS_W83792D is not set
692# CONFIG_SENSORS_W83793 is not set
693# CONFIG_SENSORS_W83L785TS is not set
612# CONFIG_SENSORS_W83627HF is not set 694# CONFIG_SENSORS_W83627HF is not set
613# CONFIG_SENSORS_W83627EHF is not set 695# CONFIG_SENSORS_W83627EHF is not set
614# CONFIG_HWMON_DEBUG_CHIP is not set 696# CONFIG_HWMON_DEBUG_CHIP is not set
@@ -621,8 +703,115 @@ CONFIG_HWMON=y
621# 703#
622# Multimedia devices 704# Multimedia devices
623# 705#
624# CONFIG_VIDEO_DEV is not set 706CONFIG_VIDEO_DEV=m
625# CONFIG_DVB_CORE is not set 707# CONFIG_VIDEO_V4L1 is not set
708# CONFIG_VIDEO_V4L1_COMPAT is not set
709CONFIG_VIDEO_V4L2=y
710CONFIG_VIDEO_CAPTURE_DRIVERS=y
711# CONFIG_VIDEO_ADV_DEBUG is not set
712CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
713# CONFIG_VIDEO_VIVI is not set
714# CONFIG_VIDEO_SAA5246A is not set
715# CONFIG_VIDEO_SAA5249 is not set
716# CONFIG_TUNER_TEA5761 is not set
717# CONFIG_VIDEO_SAA7134 is not set
718# CONFIG_VIDEO_HEXIUM_ORION is not set
719# CONFIG_VIDEO_HEXIUM_GEMINI is not set
720# CONFIG_VIDEO_CX88 is not set
721# CONFIG_VIDEO_CAFE_CCIC is not set
722# CONFIG_RADIO_ADAPTERS is not set
723CONFIG_DVB_CORE=y
724# CONFIG_DVB_CORE_ATTACH is not set
725CONFIG_DVB_CAPTURE_DRIVERS=y
726
727#
728# Supported SAA7146 based PCI Adapters
729#
730
731#
732# Supported FlexCopII (B2C2) Adapters
733#
734# CONFIG_DVB_B2C2_FLEXCOP is not set
735
736#
737# Supported BT878 Adapters
738#
739
740#
741# Supported Pluto2 Adapters
742#
743# CONFIG_DVB_PLUTO2 is not set
744
745#
746# Supported DVB Frontends
747#
748
749#
750# Customise DVB Frontends
751#
752# CONFIG_DVB_FE_CUSTOMISE is not set
753
754#
755# DVB-S (satellite) frontends
756#
757# CONFIG_DVB_STV0299 is not set
758# CONFIG_DVB_CX24110 is not set
759# CONFIG_DVB_CX24123 is not set
760# CONFIG_DVB_TDA8083 is not set
761# CONFIG_DVB_MT312 is not set
762# CONFIG_DVB_VES1X93 is not set
763# CONFIG_DVB_S5H1420 is not set
764# CONFIG_DVB_TDA10086 is not set
765
766#
767# DVB-T (terrestrial) frontends
768#
769# CONFIG_DVB_SP8870 is not set
770# CONFIG_DVB_SP887X is not set
771# CONFIG_DVB_CX22700 is not set
772# CONFIG_DVB_CX22702 is not set
773# CONFIG_DVB_L64781 is not set
774# CONFIG_DVB_TDA1004X is not set
775# CONFIG_DVB_NXT6000 is not set
776# CONFIG_DVB_MT352 is not set
777# CONFIG_DVB_ZL10353 is not set
778# CONFIG_DVB_DIB3000MB is not set
779# CONFIG_DVB_DIB3000MC is not set
780# CONFIG_DVB_DIB7000M is not set
781# CONFIG_DVB_DIB7000P is not set
782
783#
784# DVB-C (cable) frontends
785#
786# CONFIG_DVB_VES1820 is not set
787# CONFIG_DVB_TDA10021 is not set
788# CONFIG_DVB_TDA10023 is not set
789# CONFIG_DVB_STV0297 is not set
790
791#
792# ATSC (North American/Korean Terrestrial/Cable DTV) frontends
793#
794# CONFIG_DVB_NXT200X is not set
795# CONFIG_DVB_OR51211 is not set
796# CONFIG_DVB_OR51132 is not set
797# CONFIG_DVB_BCM3510 is not set
798# CONFIG_DVB_LGDT330X is not set
799
800#
801# Tuners/PLL support
802#
803# CONFIG_DVB_PLL is not set
804# CONFIG_DVB_TDA826X is not set
805# CONFIG_DVB_TDA827X is not set
806# CONFIG_DVB_TUNER_QT1010 is not set
807# CONFIG_DVB_TUNER_MT2060 is not set
808
809#
810# Miscellaneous devices
811#
812# CONFIG_DVB_LNBP21 is not set
813# CONFIG_DVB_ISL6421 is not set
814# CONFIG_DVB_TUA6100 is not set
626CONFIG_DAB=y 815CONFIG_DAB=y
627 816
628# 817#
@@ -635,6 +824,7 @@ CONFIG_DAB=y
635# 824#
636# CONFIG_DISPLAY_SUPPORT is not set 825# CONFIG_DISPLAY_SUPPORT is not set
637# CONFIG_VGASTATE is not set 826# CONFIG_VGASTATE is not set
827CONFIG_VIDEO_OUTPUT_CONTROL=y
638CONFIG_FB=y 828CONFIG_FB=y
639CONFIG_FIRMWARE_EDID=y 829CONFIG_FIRMWARE_EDID=y
640# CONFIG_FB_DDC is not set 830# CONFIG_FB_DDC is not set
@@ -728,24 +918,8 @@ CONFIG_USB_ARCH_HAS_EHCI=y
728# 918#
729# CONFIG_USB_GADGET is not set 919# CONFIG_USB_GADGET is not set
730# CONFIG_MMC is not set 920# CONFIG_MMC is not set
731
732#
733# LED devices
734#
735# CONFIG_NEW_LEDS is not set 921# CONFIG_NEW_LEDS is not set
736
737#
738# LED drivers
739#
740
741#
742# LED Triggers
743#
744# CONFIG_INFINIBAND is not set 922# CONFIG_INFINIBAND is not set
745
746#
747# Real Time Clock
748#
749# CONFIG_RTC_CLASS is not set 923# CONFIG_RTC_CLASS is not set
750 924
751# 925#
@@ -929,9 +1103,9 @@ CONFIG_DEBUG_BUGVERBOSE=y
929# CONFIG_DEBUG_LIST is not set 1103# CONFIG_DEBUG_LIST is not set
930CONFIG_FRAME_POINTER=y 1104CONFIG_FRAME_POINTER=y
931CONFIG_FORCED_INLINING=y 1105CONFIG_FORCED_INLINING=y
1106# CONFIG_RCU_TORTURE_TEST is not set
932# CONFIG_FAULT_INJECTION is not set 1107# CONFIG_FAULT_INJECTION is not set
933# CONFIG_EARLY_PRINTK is not set 1108# CONFIG_EARLY_PRINTK is not set
934# CONFIG_DEBUG_KERNEL_WITH_GDB_STUB is not set
935CONFIG_SH64_PROC_TLB=y 1109CONFIG_SH64_PROC_TLB=y
936CONFIG_SH64_PROC_ASIDS=y 1110CONFIG_SH64_PROC_ASIDS=y
937CONFIG_SH64_SR_WATCH=y 1111CONFIG_SH64_SR_WATCH=y
@@ -960,5 +1134,3 @@ CONFIG_PLIST=y
960CONFIG_HAS_IOMEM=y 1134CONFIG_HAS_IOMEM=y
961CONFIG_HAS_IOPORT=y 1135CONFIG_HAS_IOPORT=y
962CONFIG_HAS_DMA=y 1136CONFIG_HAS_DMA=y
963CONFIG_GENERIC_HARDIRQS=y
964CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/sh64/configs/harp_defconfig b/arch/sh64/configs/harp_defconfig
new file mode 100644
index 000000000000..e4b84b51baf8
--- /dev/null
+++ b/arch/sh64/configs/harp_defconfig
@@ -0,0 +1,756 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23-rc8
4# Mon Oct 1 18:01:38 2007
5#
6CONFIG_SUPERH=y
7CONFIG_SUPERH64=y
8CONFIG_MMU=y
9CONFIG_QUICKLIST=y
10CONFIG_RWSEM_GENERIC_SPINLOCK=y
11CONFIG_GENERIC_FIND_NEXT_BIT=y
12CONFIG_GENERIC_HWEIGHT=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y
14CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_IRQ_PROBE=y
16# CONFIG_ARCH_HAS_ILOG2_U32 is not set
17# CONFIG_ARCH_HAS_ILOG2_U64 is not set
18CONFIG_ARCH_NO_VIRT_TO_BUS=y
19CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
20
21#
22# General setup
23#
24CONFIG_EXPERIMENTAL=y
25CONFIG_BROKEN_ON_SMP=y
26CONFIG_LOCK_KERNEL=y
27CONFIG_INIT_ENV_ARG_LIMIT=32
28CONFIG_LOCALVERSION=""
29CONFIG_LOCALVERSION_AUTO=y
30CONFIG_SWAP=y
31# CONFIG_SYSVIPC is not set
32CONFIG_POSIX_MQUEUE=y
33# CONFIG_BSD_PROCESS_ACCT is not set
34# CONFIG_TASKSTATS is not set
35# CONFIG_USER_NS is not set
36# CONFIG_AUDIT is not set
37# CONFIG_IKCONFIG is not set
38CONFIG_LOG_BUF_SHIFT=14
39CONFIG_SYSFS_DEPRECATED=y
40# CONFIG_RELAY is not set
41# CONFIG_BLK_DEV_INITRD is not set
42# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
43CONFIG_SYSCTL=y
44# CONFIG_EMBEDDED is not set
45CONFIG_UID16=y
46CONFIG_SYSCTL_SYSCALL=y
47CONFIG_KALLSYMS=y
48# CONFIG_KALLSYMS_ALL is not set
49# CONFIG_KALLSYMS_EXTRA_PASS is not set
50CONFIG_HOTPLUG=y
51CONFIG_PRINTK=y
52CONFIG_BUG=y
53CONFIG_ELF_CORE=y
54CONFIG_BASE_FULL=y
55CONFIG_FUTEX=y
56CONFIG_ANON_INODES=y
57CONFIG_EPOLL=y
58CONFIG_SIGNALFD=y
59CONFIG_EVENTFD=y
60CONFIG_SHMEM=y
61CONFIG_VM_EVENT_COUNTERS=y
62CONFIG_SLAB=y
63# CONFIG_SLUB is not set
64# CONFIG_SLOB is not set
65CONFIG_RT_MUTEXES=y
66# CONFIG_TINY_SHMEM is not set
67CONFIG_BASE_SMALL=0
68# CONFIG_MODULES is not set
69CONFIG_BLOCK=y
70# CONFIG_LBD is not set
71# CONFIG_BLK_DEV_IO_TRACE is not set
72# CONFIG_LSF is not set
73# CONFIG_BLK_DEV_BSG is not set
74
75#
76# IO Schedulers
77#
78CONFIG_IOSCHED_NOOP=y
79CONFIG_IOSCHED_AS=y
80CONFIG_IOSCHED_DEADLINE=y
81CONFIG_IOSCHED_CFQ=y
82# CONFIG_DEFAULT_AS is not set
83# CONFIG_DEFAULT_DEADLINE is not set
84CONFIG_DEFAULT_CFQ=y
85# CONFIG_DEFAULT_NOOP is not set
86CONFIG_DEFAULT_IOSCHED="cfq"
87
88#
89# System type
90#
91# CONFIG_SH_SIMULATOR is not set
92# CONFIG_SH_CAYMAN is not set
93CONFIG_SH_HARP=y
94CONFIG_CPU_SH5=y
95CONFIG_CPU_SUBTYPE_SH5_101=y
96# CONFIG_CPU_SUBTYPE_SH5_103 is not set
97CONFIG_LITTLE_ENDIAN=y
98# CONFIG_BIG_ENDIAN is not set
99CONFIG_SH_FPU=y
100# CONFIG_SH64_FPU_DENORM_FLUSH is not set
101CONFIG_SH64_PGTABLE_2_LEVEL=y
102# CONFIG_SH64_PGTABLE_3_LEVEL is not set
103CONFIG_HUGETLB_PAGE_SIZE_64K=y
104# CONFIG_HUGETLB_PAGE_SIZE_1MB is not set
105# CONFIG_HUGETLB_PAGE_SIZE_512MB is not set
106CONFIG_SH64_USER_MISALIGNED_FIXUP=y
107
108#
109# Memory options
110#
111CONFIG_CACHED_MEMORY_OFFSET=0x20000000
112CONFIG_MEMORY_START=0x80000000
113CONFIG_MEMORY_SIZE_IN_MB=128
114
115#
116# Cache options
117#
118CONFIG_DCACHE_WRITE_BACK=y
119# CONFIG_DCACHE_WRITE_THROUGH is not set
120# CONFIG_DCACHE_DISABLED is not set
121# CONFIG_ICACHE_DISABLED is not set
122CONFIG_PCIDEVICE_MEMORY_START=C0000000
123CONFIG_DEVICE_MEMORY_START=E0000000
124CONFIG_FLASH_MEMORY_START=0x00000000
125CONFIG_PCI_BLOCK_START=0x40000000
126
127#
128# CPU Subtype specific options
129#
130CONFIG_SH64_ID2815_WORKAROUND=y
131
132#
133# Misc options
134#
135# CONFIG_SH_DMA is not set
136CONFIG_PREEMPT=y
137CONFIG_SELECT_MEMORY_MODEL=y
138CONFIG_FLATMEM_MANUAL=y
139# CONFIG_DISCONTIGMEM_MANUAL is not set
140# CONFIG_SPARSEMEM_MANUAL is not set
141CONFIG_FLATMEM=y
142CONFIG_FLAT_NODE_MEM_MAP=y
143# CONFIG_SPARSEMEM_STATIC is not set
144CONFIG_SPLIT_PTLOCK_CPUS=4
145# CONFIG_RESOURCES_64BIT is not set
146CONFIG_ZONE_DMA_FLAG=0
147CONFIG_NR_QUICK=1
148
149#
150# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
151#
152# CONFIG_ARCH_SUPPORTS_MSI is not set
153
154#
155# PCCARD (PCMCIA/CardBus) support
156#
157# CONFIG_PCCARD is not set
158
159#
160# Executable file formats
161#
162CONFIG_BINFMT_ELF=y
163# CONFIG_BINFMT_MISC is not set
164
165#
166# Networking
167#
168CONFIG_NET=y
169
170#
171# Networking options
172#
173CONFIG_PACKET=y
174# CONFIG_PACKET_MMAP is not set
175CONFIG_UNIX=y
176CONFIG_XFRM=y
177# CONFIG_XFRM_USER is not set
178# CONFIG_XFRM_SUB_POLICY is not set
179# CONFIG_XFRM_MIGRATE is not set
180# CONFIG_NET_KEY is not set
181CONFIG_INET=y
182# CONFIG_IP_MULTICAST is not set
183# CONFIG_IP_ADVANCED_ROUTER is not set
184CONFIG_IP_FIB_HASH=y
185CONFIG_IP_PNP=y
186# CONFIG_IP_PNP_DHCP is not set
187# CONFIG_IP_PNP_BOOTP is not set
188# CONFIG_IP_PNP_RARP is not set
189# CONFIG_NET_IPIP is not set
190# CONFIG_NET_IPGRE is not set
191# CONFIG_ARPD is not set
192# CONFIG_SYN_COOKIES is not set
193# CONFIG_INET_AH is not set
194# CONFIG_INET_ESP is not set
195# CONFIG_INET_IPCOMP is not set
196# CONFIG_INET_XFRM_TUNNEL is not set
197# CONFIG_INET_TUNNEL is not set
198CONFIG_INET_XFRM_MODE_TRANSPORT=y
199CONFIG_INET_XFRM_MODE_TUNNEL=y
200CONFIG_INET_XFRM_MODE_BEET=y
201CONFIG_INET_DIAG=y
202CONFIG_INET_TCP_DIAG=y
203# CONFIG_TCP_CONG_ADVANCED is not set
204CONFIG_TCP_CONG_CUBIC=y
205CONFIG_DEFAULT_TCP_CONG="cubic"
206# CONFIG_TCP_MD5SIG is not set
207# CONFIG_IPV6 is not set
208# CONFIG_INET6_XFRM_TUNNEL is not set
209# CONFIG_INET6_TUNNEL is not set
210# CONFIG_NETWORK_SECMARK is not set
211# CONFIG_NETFILTER is not set
212# CONFIG_IP_DCCP is not set
213# CONFIG_IP_SCTP is not set
214# CONFIG_TIPC is not set
215# CONFIG_ATM is not set
216# CONFIG_BRIDGE is not set
217# CONFIG_VLAN_8021Q is not set
218# CONFIG_DECNET is not set
219# CONFIG_LLC2 is not set
220# CONFIG_IPX is not set
221# CONFIG_ATALK is not set
222# CONFIG_X25 is not set
223# CONFIG_LAPB is not set
224# CONFIG_ECONET is not set
225# CONFIG_WAN_ROUTER is not set
226
227#
228# QoS and/or fair queueing
229#
230# CONFIG_NET_SCHED is not set
231
232#
233# Network testing
234#
235# CONFIG_NET_PKTGEN is not set
236# CONFIG_HAMRADIO is not set
237# CONFIG_IRDA is not set
238# CONFIG_BT is not set
239# CONFIG_AF_RXRPC is not set
240
241#
242# Wireless
243#
244# CONFIG_CFG80211 is not set
245# CONFIG_WIRELESS_EXT is not set
246# CONFIG_MAC80211 is not set
247# CONFIG_IEEE80211 is not set
248# CONFIG_RFKILL is not set
249# CONFIG_NET_9P is not set
250
251#
252# Device Drivers
253#
254
255#
256# Generic Driver Options
257#
258CONFIG_STANDALONE=y
259CONFIG_PREVENT_FIRMWARE_BUILD=y
260# CONFIG_FW_LOADER is not set
261# CONFIG_DEBUG_DRIVER is not set
262# CONFIG_DEBUG_DEVRES is not set
263# CONFIG_SYS_HYPERVISOR is not set
264# CONFIG_CONNECTOR is not set
265# CONFIG_MTD is not set
266# CONFIG_PARPORT is not set
267CONFIG_BLK_DEV=y
268# CONFIG_BLK_DEV_COW_COMMON is not set
269CONFIG_BLK_DEV_LOOP=y
270# CONFIG_BLK_DEV_CRYPTOLOOP is not set
271# CONFIG_BLK_DEV_NBD is not set
272CONFIG_BLK_DEV_RAM=y
273CONFIG_BLK_DEV_RAM_COUNT=16
274CONFIG_BLK_DEV_RAM_SIZE=4096
275CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
276# CONFIG_CDROM_PKTCDVD is not set
277# CONFIG_ATA_OVER_ETH is not set
278CONFIG_MISC_DEVICES=y
279# CONFIG_EEPROM_93CX6 is not set
280# CONFIG_IDE is not set
281
282#
283# SCSI device support
284#
285# CONFIG_RAID_ATTRS is not set
286CONFIG_SCSI=y
287CONFIG_SCSI_DMA=y
288# CONFIG_SCSI_TGT is not set
289# CONFIG_SCSI_NETLINK is not set
290CONFIG_SCSI_PROC_FS=y
291
292#
293# SCSI support type (disk, tape, CD-ROM)
294#
295CONFIG_BLK_DEV_SD=y
296# CONFIG_CHR_DEV_ST is not set
297# CONFIG_CHR_DEV_OSST is not set
298# CONFIG_BLK_DEV_SR is not set
299# CONFIG_CHR_DEV_SG is not set
300# CONFIG_CHR_DEV_SCH is not set
301
302#
303# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
304#
305CONFIG_SCSI_MULTI_LUN=y
306# CONFIG_SCSI_CONSTANTS is not set
307# CONFIG_SCSI_LOGGING is not set
308# CONFIG_SCSI_SCAN_ASYNC is not set
309
310#
311# SCSI Transports
312#
313CONFIG_SCSI_SPI_ATTRS=y
314# CONFIG_SCSI_FC_ATTRS is not set
315# CONFIG_SCSI_ISCSI_ATTRS is not set
316# CONFIG_SCSI_SAS_LIBSAS is not set
317CONFIG_SCSI_LOWLEVEL=y
318# CONFIG_ISCSI_TCP is not set
319# CONFIG_SCSI_DEBUG is not set
320# CONFIG_ATA is not set
321# CONFIG_MD is not set
322CONFIG_NETDEVICES=y
323# CONFIG_NETDEVICES_MULTIQUEUE is not set
324# CONFIG_DUMMY is not set
325# CONFIG_BONDING is not set
326# CONFIG_MACVLAN is not set
327# CONFIG_EQUALIZER is not set
328# CONFIG_TUN is not set
329# CONFIG_PHYLIB is not set
330CONFIG_NET_ETHERNET=y
331# CONFIG_MII is not set
332# CONFIG_STNIC is not set
333# CONFIG_SMC91X is not set
334CONFIG_NETDEV_1000=y
335CONFIG_NETDEV_10000=y
336
337#
338# Wireless LAN
339#
340# CONFIG_WLAN_PRE80211 is not set
341# CONFIG_WLAN_80211 is not set
342# CONFIG_WAN is not set
343# CONFIG_PPP is not set
344# CONFIG_SLIP is not set
345# CONFIG_SHAPER is not set
346# CONFIG_NETCONSOLE is not set
347# CONFIG_NETPOLL is not set
348# CONFIG_NET_POLL_CONTROLLER is not set
349# CONFIG_ISDN is not set
350# CONFIG_PHONE is not set
351
352#
353# Input device support
354#
355CONFIG_INPUT=y
356# CONFIG_INPUT_FF_MEMLESS is not set
357# CONFIG_INPUT_POLLDEV is not set
358
359#
360# Userland interfaces
361#
362CONFIG_INPUT_MOUSEDEV=y
363# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
364CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
365CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
366# CONFIG_INPUT_JOYDEV is not set
367# CONFIG_INPUT_TSDEV is not set
368# CONFIG_INPUT_EVDEV is not set
369# CONFIG_INPUT_EVBUG is not set
370
371#
372# Input Device Drivers
373#
374# CONFIG_INPUT_KEYBOARD is not set
375# CONFIG_INPUT_MOUSE is not set
376# CONFIG_INPUT_JOYSTICK is not set
377# CONFIG_INPUT_TABLET is not set
378# CONFIG_INPUT_TOUCHSCREEN is not set
379# CONFIG_INPUT_MISC is not set
380
381#
382# Hardware I/O ports
383#
384# CONFIG_SERIO is not set
385# CONFIG_GAMEPORT is not set
386
387#
388# Character devices
389#
390CONFIG_VT=y
391CONFIG_VT_CONSOLE=y
392CONFIG_HW_CONSOLE=y
393# CONFIG_VT_HW_CONSOLE_BINDING is not set
394# CONFIG_SERIAL_NONSTANDARD is not set
395
396#
397# Serial drivers
398#
399# CONFIG_SERIAL_8250 is not set
400
401#
402# Non-8250 serial port support
403#
404CONFIG_SERIAL_SH_SCI=y
405CONFIG_SERIAL_SH_SCI_NR_UARTS=2
406CONFIG_SERIAL_SH_SCI_CONSOLE=y
407CONFIG_SERIAL_CORE=y
408CONFIG_SERIAL_CORE_CONSOLE=y
409CONFIG_UNIX98_PTYS=y
410CONFIG_LEGACY_PTYS=y
411CONFIG_LEGACY_PTY_COUNT=256
412# CONFIG_IPMI_HANDLER is not set
413CONFIG_WATCHDOG=y
414# CONFIG_WATCHDOG_NOWAYOUT is not set
415
416#
417# Watchdog Device Drivers
418#
419# CONFIG_SOFT_WATCHDOG is not set
420CONFIG_HW_RANDOM=y
421# CONFIG_R3964 is not set
422# CONFIG_RAW_DRIVER is not set
423# CONFIG_TCG_TPM is not set
424# CONFIG_I2C is not set
425
426#
427# SPI support
428#
429# CONFIG_SPI is not set
430# CONFIG_SPI_MASTER is not set
431# CONFIG_W1 is not set
432# CONFIG_POWER_SUPPLY is not set
433CONFIG_HWMON=y
434# CONFIG_HWMON_VID is not set
435# CONFIG_SENSORS_ABITUGURU is not set
436# CONFIG_SENSORS_ABITUGURU3 is not set
437# CONFIG_SENSORS_F71805F is not set
438# CONFIG_SENSORS_IT87 is not set
439# CONFIG_SENSORS_PC87360 is not set
440# CONFIG_SENSORS_PC87427 is not set
441# CONFIG_SENSORS_SMSC47M1 is not set
442# CONFIG_SENSORS_SMSC47B397 is not set
443# CONFIG_SENSORS_VT1211 is not set
444# CONFIG_SENSORS_W83627HF is not set
445# CONFIG_SENSORS_W83627EHF is not set
446# CONFIG_HWMON_DEBUG_CHIP is not set
447
448#
449# Multifunction device drivers
450#
451# CONFIG_MFD_SM501 is not set
452
453#
454# Multimedia devices
455#
456# CONFIG_VIDEO_DEV is not set
457# CONFIG_DVB_CORE is not set
458CONFIG_DAB=y
459
460#
461# Graphics support
462#
463# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
464
465#
466# Display device support
467#
468# CONFIG_DISPLAY_SUPPORT is not set
469# CONFIG_VGASTATE is not set
470CONFIG_VIDEO_OUTPUT_CONTROL=y
471CONFIG_FB=y
472CONFIG_FIRMWARE_EDID=y
473# CONFIG_FB_DDC is not set
474# CONFIG_FB_CFB_FILLRECT is not set
475# CONFIG_FB_CFB_COPYAREA is not set
476# CONFIG_FB_CFB_IMAGEBLIT is not set
477# CONFIG_FB_SYS_FILLRECT is not set
478# CONFIG_FB_SYS_COPYAREA is not set
479# CONFIG_FB_SYS_IMAGEBLIT is not set
480# CONFIG_FB_SYS_FOPS is not set
481CONFIG_FB_DEFERRED_IO=y
482# CONFIG_FB_SVGALIB is not set
483# CONFIG_FB_MACMODES is not set
484# CONFIG_FB_BACKLIGHT is not set
485CONFIG_FB_MODE_HELPERS=y
486# CONFIG_FB_TILEBLITTING is not set
487
488#
489# Frame buffer hardware drivers
490#
491# CONFIG_FB_S1D13XXX is not set
492# CONFIG_FB_VIRTUAL is not set
493
494#
495# Console display driver support
496#
497CONFIG_DUMMY_CONSOLE=y
498CONFIG_FRAMEBUFFER_CONSOLE=y
499# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
500# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
501CONFIG_FONTS=y
502# CONFIG_FONT_8x8 is not set
503CONFIG_FONT_8x16=y
504# CONFIG_FONT_6x11 is not set
505# CONFIG_FONT_7x14 is not set
506# CONFIG_FONT_PEARL_8x8 is not set
507# CONFIG_FONT_ACORN_8x8 is not set
508# CONFIG_FONT_MINI_4x6 is not set
509# CONFIG_FONT_SUN8x16 is not set
510# CONFIG_FONT_SUN12x22 is not set
511# CONFIG_FONT_10x18 is not set
512CONFIG_LOGO=y
513# CONFIG_LOGO_LINUX_MONO is not set
514# CONFIG_LOGO_LINUX_VGA16 is not set
515# CONFIG_LOGO_LINUX_CLUT224 is not set
516# CONFIG_LOGO_SUPERH_MONO is not set
517# CONFIG_LOGO_SUPERH_VGA16 is not set
518CONFIG_LOGO_SUPERH_CLUT224=y
519
520#
521# Sound
522#
523# CONFIG_SOUND is not set
524CONFIG_HID_SUPPORT=y
525CONFIG_HID=y
526# CONFIG_HID_DEBUG is not set
527CONFIG_USB_SUPPORT=y
528CONFIG_USB_ARCH_HAS_HCD=y
529# CONFIG_USB_ARCH_HAS_OHCI is not set
530# CONFIG_USB_ARCH_HAS_EHCI is not set
531# CONFIG_USB is not set
532
533#
534# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
535#
536
537#
538# USB Gadget Support
539#
540# CONFIG_USB_GADGET is not set
541# CONFIG_MMC is not set
542# CONFIG_NEW_LEDS is not set
543# CONFIG_RTC_CLASS is not set
544
545#
546# DMA Engine support
547#
548# CONFIG_DMA_ENGINE is not set
549
550#
551# DMA Clients
552#
553
554#
555# DMA Devices
556#
557
558#
559# Userspace I/O
560#
561# CONFIG_UIO is not set
562
563#
564# File systems
565#
566CONFIG_EXT2_FS=y
567# CONFIG_EXT2_FS_XATTR is not set
568# CONFIG_EXT2_FS_XIP is not set
569CONFIG_EXT3_FS=y
570CONFIG_EXT3_FS_XATTR=y
571# CONFIG_EXT3_FS_POSIX_ACL is not set
572# CONFIG_EXT3_FS_SECURITY is not set
573# CONFIG_EXT4DEV_FS is not set
574CONFIG_JBD=y
575# CONFIG_JBD_DEBUG is not set
576CONFIG_FS_MBCACHE=y
577# CONFIG_REISERFS_FS is not set
578# CONFIG_JFS_FS is not set
579# CONFIG_FS_POSIX_ACL is not set
580# CONFIG_XFS_FS is not set
581# CONFIG_GFS2_FS is not set
582# CONFIG_OCFS2_FS is not set
583CONFIG_MINIX_FS=y
584CONFIG_ROMFS_FS=y
585CONFIG_INOTIFY=y
586CONFIG_INOTIFY_USER=y
587# CONFIG_QUOTA is not set
588CONFIG_DNOTIFY=y
589# CONFIG_AUTOFS_FS is not set
590# CONFIG_AUTOFS4_FS is not set
591# CONFIG_FUSE_FS is not set
592
593#
594# CD-ROM/DVD Filesystems
595#
596# CONFIG_ISO9660_FS is not set
597# CONFIG_UDF_FS is not set
598
599#
600# DOS/FAT/NT Filesystems
601#
602# CONFIG_MSDOS_FS is not set
603# CONFIG_VFAT_FS is not set
604# CONFIG_NTFS_FS is not set
605
606#
607# Pseudo filesystems
608#
609CONFIG_PROC_FS=y
610CONFIG_PROC_KCORE=y
611CONFIG_PROC_SYSCTL=y
612CONFIG_SYSFS=y
613CONFIG_TMPFS=y
614# CONFIG_TMPFS_POSIX_ACL is not set
615CONFIG_HUGETLBFS=y
616CONFIG_HUGETLB_PAGE=y
617CONFIG_RAMFS=y
618# CONFIG_CONFIGFS_FS is not set
619
620#
621# Miscellaneous filesystems
622#
623# CONFIG_ADFS_FS is not set
624# CONFIG_AFFS_FS is not set
625# CONFIG_HFS_FS is not set
626# CONFIG_HFSPLUS_FS is not set
627# CONFIG_BEFS_FS is not set
628# CONFIG_BFS_FS is not set
629# CONFIG_EFS_FS is not set
630# CONFIG_CRAMFS is not set
631# CONFIG_VXFS_FS is not set
632# CONFIG_HPFS_FS is not set
633# CONFIG_QNX4FS_FS is not set
634# CONFIG_SYSV_FS is not set
635# CONFIG_UFS_FS is not set
636
637#
638# Network File Systems
639#
640CONFIG_NFS_FS=y
641CONFIG_NFS_V3=y
642# CONFIG_NFS_V3_ACL is not set
643# CONFIG_NFS_V4 is not set
644# CONFIG_NFS_DIRECTIO is not set
645# CONFIG_NFSD is not set
646CONFIG_ROOT_NFS=y
647CONFIG_LOCKD=y
648CONFIG_LOCKD_V4=y
649CONFIG_NFS_COMMON=y
650CONFIG_SUNRPC=y
651# CONFIG_SUNRPC_BIND34 is not set
652# CONFIG_RPCSEC_GSS_KRB5 is not set
653# CONFIG_RPCSEC_GSS_SPKM3 is not set
654# CONFIG_SMB_FS is not set
655# CONFIG_CIFS is not set
656# CONFIG_NCP_FS is not set
657# CONFIG_CODA_FS is not set
658# CONFIG_AFS_FS is not set
659
660#
661# Partition Types
662#
663CONFIG_PARTITION_ADVANCED=y
664# CONFIG_ACORN_PARTITION is not set
665# CONFIG_OSF_PARTITION is not set
666# CONFIG_AMIGA_PARTITION is not set
667# CONFIG_ATARI_PARTITION is not set
668# CONFIG_MAC_PARTITION is not set
669CONFIG_MSDOS_PARTITION=y
670# CONFIG_BSD_DISKLABEL is not set
671# CONFIG_MINIX_SUBPARTITION is not set
672# CONFIG_SOLARIS_X86_PARTITION is not set
673# CONFIG_UNIXWARE_DISKLABEL is not set
674# CONFIG_LDM_PARTITION is not set
675# CONFIG_SGI_PARTITION is not set
676# CONFIG_ULTRIX_PARTITION is not set
677# CONFIG_SUN_PARTITION is not set
678# CONFIG_KARMA_PARTITION is not set
679# CONFIG_EFI_PARTITION is not set
680# CONFIG_SYSV68_PARTITION is not set
681
682#
683# Native Language Support
684#
685# CONFIG_NLS is not set
686
687#
688# Distributed Lock Manager
689#
690# CONFIG_DLM is not set
691
692#
693# Profiling support
694#
695# CONFIG_PROFILING is not set
696
697#
698# Kernel hacking
699#
700# CONFIG_PRINTK_TIME is not set
701CONFIG_ENABLE_MUST_CHECK=y
702CONFIG_MAGIC_SYSRQ=y
703# CONFIG_UNUSED_SYMBOLS is not set
704CONFIG_DEBUG_FS=y
705# CONFIG_HEADERS_CHECK is not set
706CONFIG_DEBUG_KERNEL=y
707# CONFIG_DEBUG_SHIRQ is not set
708CONFIG_DETECT_SOFTLOCKUP=y
709CONFIG_SCHED_DEBUG=y
710CONFIG_SCHEDSTATS=y
711# CONFIG_TIMER_STATS is not set
712# CONFIG_DEBUG_SLAB is not set
713# CONFIG_DEBUG_RT_MUTEXES is not set
714# CONFIG_RT_MUTEX_TESTER is not set
715# CONFIG_DEBUG_SPINLOCK is not set
716# CONFIG_DEBUG_MUTEXES is not set
717# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
718# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
719# CONFIG_DEBUG_KOBJECT is not set
720CONFIG_DEBUG_BUGVERBOSE=y
721# CONFIG_DEBUG_INFO is not set
722# CONFIG_DEBUG_VM is not set
723# CONFIG_DEBUG_LIST is not set
724CONFIG_FRAME_POINTER=y
725CONFIG_FORCED_INLINING=y
726# CONFIG_FAULT_INJECTION is not set
727# CONFIG_EARLY_PRINTK is not set
728# CONFIG_DEBUG_KERNEL_WITH_GDB_STUB is not set
729CONFIG_SH64_PROC_TLB=y
730CONFIG_SH64_PROC_ASIDS=y
731CONFIG_SH64_SR_WATCH=y
732# CONFIG_POOR_MANS_STRACE is not set
733# CONFIG_SH_ALPHANUMERIC is not set
734# CONFIG_SH_NO_BSS_INIT is not set
735
736#
737# Security options
738#
739# CONFIG_KEYS is not set
740# CONFIG_SECURITY is not set
741# CONFIG_CRYPTO is not set
742
743#
744# Library routines
745#
746CONFIG_BITREVERSE=y
747# CONFIG_CRC_CCITT is not set
748# CONFIG_CRC16 is not set
749# CONFIG_CRC_ITU_T is not set
750CONFIG_CRC32=y
751# CONFIG_CRC7 is not set
752# CONFIG_LIBCRC32C is not set
753CONFIG_PLIST=y
754CONFIG_HAS_IOMEM=y
755CONFIG_HAS_IOPORT=y
756CONFIG_HAS_DMA=y
diff --git a/arch/sh64/configs/sim_defconfig b/arch/sh64/configs/sim_defconfig
new file mode 100644
index 000000000000..f83bae659dc3
--- /dev/null
+++ b/arch/sh64/configs/sim_defconfig
@@ -0,0 +1,566 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23-rc8
4# Mon Oct 1 17:50:35 2007
5#
6CONFIG_SUPERH=y
7CONFIG_SUPERH64=y
8CONFIG_MMU=y
9CONFIG_QUICKLIST=y
10CONFIG_RWSEM_GENERIC_SPINLOCK=y
11CONFIG_GENERIC_FIND_NEXT_BIT=y
12CONFIG_GENERIC_HWEIGHT=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y
14CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_IRQ_PROBE=y
16# CONFIG_ARCH_HAS_ILOG2_U32 is not set
17# CONFIG_ARCH_HAS_ILOG2_U64 is not set
18CONFIG_ARCH_NO_VIRT_TO_BUS=y
19CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
20
21#
22# General setup
23#
24CONFIG_EXPERIMENTAL=y
25CONFIG_BROKEN_ON_SMP=y
26CONFIG_LOCK_KERNEL=y
27CONFIG_INIT_ENV_ARG_LIMIT=32
28CONFIG_LOCALVERSION=""
29CONFIG_LOCALVERSION_AUTO=y
30CONFIG_SWAP=y
31# CONFIG_SYSVIPC is not set
32# CONFIG_BSD_PROCESS_ACCT is not set
33# CONFIG_USER_NS is not set
34# CONFIG_IKCONFIG is not set
35CONFIG_LOG_BUF_SHIFT=14
36CONFIG_SYSFS_DEPRECATED=y
37# CONFIG_RELAY is not set
38# CONFIG_BLK_DEV_INITRD is not set
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SYSCTL=y
41# CONFIG_EMBEDDED is not set
42CONFIG_UID16=y
43CONFIG_SYSCTL_SYSCALL=y
44CONFIG_KALLSYMS=y
45# CONFIG_KALLSYMS_ALL is not set
46# CONFIG_KALLSYMS_EXTRA_PASS is not set
47CONFIG_HOTPLUG=y
48CONFIG_PRINTK=y
49CONFIG_BUG=y
50CONFIG_ELF_CORE=y
51CONFIG_BASE_FULL=y
52CONFIG_FUTEX=y
53CONFIG_ANON_INODES=y
54CONFIG_EPOLL=y
55CONFIG_SIGNALFD=y
56CONFIG_EVENTFD=y
57CONFIG_SHMEM=y
58CONFIG_VM_EVENT_COUNTERS=y
59CONFIG_SLAB=y
60# CONFIG_SLUB is not set
61# CONFIG_SLOB is not set
62CONFIG_RT_MUTEXES=y
63# CONFIG_TINY_SHMEM is not set
64CONFIG_BASE_SMALL=0
65# CONFIG_MODULES is not set
66CONFIG_BLOCK=y
67# CONFIG_LBD is not set
68# CONFIG_BLK_DEV_IO_TRACE is not set
69# CONFIG_LSF is not set
70# CONFIG_BLK_DEV_BSG is not set
71
72#
73# IO Schedulers
74#
75CONFIG_IOSCHED_NOOP=y
76CONFIG_IOSCHED_AS=y
77CONFIG_IOSCHED_DEADLINE=y
78CONFIG_IOSCHED_CFQ=y
79# CONFIG_DEFAULT_AS is not set
80# CONFIG_DEFAULT_DEADLINE is not set
81CONFIG_DEFAULT_CFQ=y
82# CONFIG_DEFAULT_NOOP is not set
83CONFIG_DEFAULT_IOSCHED="cfq"
84
85#
86# System type
87#
88CONFIG_SH_SIMULATOR=y
89# CONFIG_SH_CAYMAN is not set
90# CONFIG_SH_HARP is not set
91CONFIG_CPU_SH5=y
92CONFIG_CPU_SUBTYPE_SH5_101=y
93# CONFIG_CPU_SUBTYPE_SH5_103 is not set
94CONFIG_LITTLE_ENDIAN=y
95# CONFIG_BIG_ENDIAN is not set
96CONFIG_SH_FPU=y
97# CONFIG_SH64_FPU_DENORM_FLUSH is not set
98CONFIG_SH64_PGTABLE_2_LEVEL=y
99# CONFIG_SH64_PGTABLE_3_LEVEL is not set
100CONFIG_HUGETLB_PAGE_SIZE_64K=y
101# CONFIG_HUGETLB_PAGE_SIZE_1MB is not set
102# CONFIG_HUGETLB_PAGE_SIZE_512MB is not set
103CONFIG_SH64_USER_MISALIGNED_FIXUP=y
104
105#
106# Memory options
107#
108CONFIG_CACHED_MEMORY_OFFSET=0x20000000
109CONFIG_MEMORY_START=0x80000000
110CONFIG_MEMORY_SIZE_IN_MB=128
111
112#
113# Cache options
114#
115# CONFIG_DCACHE_WRITE_BACK is not set
116# CONFIG_DCACHE_WRITE_THROUGH is not set
117CONFIG_DCACHE_DISABLED=y
118# CONFIG_ICACHE_DISABLED is not set
119CONFIG_PCIDEVICE_MEMORY_START=C0000000
120CONFIG_DEVICE_MEMORY_START=E0000000
121CONFIG_FLASH_MEMORY_START=0x00000000
122CONFIG_PCI_BLOCK_START=0x40000000
123
124#
125# CPU Subtype specific options
126#
127CONFIG_SH64_ID2815_WORKAROUND=y
128
129#
130# Misc options
131#
132# CONFIG_SH_DMA is not set
133CONFIG_PREEMPT=y
134CONFIG_SELECT_MEMORY_MODEL=y
135CONFIG_FLATMEM_MANUAL=y
136# CONFIG_DISCONTIGMEM_MANUAL is not set
137# CONFIG_SPARSEMEM_MANUAL is not set
138CONFIG_FLATMEM=y
139CONFIG_FLAT_NODE_MEM_MAP=y
140# CONFIG_SPARSEMEM_STATIC is not set
141CONFIG_SPLIT_PTLOCK_CPUS=4
142# CONFIG_RESOURCES_64BIT is not set
143CONFIG_ZONE_DMA_FLAG=0
144CONFIG_NR_QUICK=1
145
146#
147# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
148#
149# CONFIG_ARCH_SUPPORTS_MSI is not set
150
151#
152# PCCARD (PCMCIA/CardBus) support
153#
154# CONFIG_PCCARD is not set
155
156#
157# Executable file formats
158#
159CONFIG_BINFMT_ELF=y
160# CONFIG_BINFMT_MISC is not set
161
162#
163# Networking
164#
165# CONFIG_NET is not set
166
167#
168# Device Drivers
169#
170
171#
172# Generic Driver Options
173#
174CONFIG_STANDALONE=y
175CONFIG_PREVENT_FIRMWARE_BUILD=y
176# CONFIG_FW_LOADER is not set
177# CONFIG_DEBUG_DRIVER is not set
178# CONFIG_DEBUG_DEVRES is not set
179# CONFIG_SYS_HYPERVISOR is not set
180# CONFIG_MTD is not set
181# CONFIG_PARPORT is not set
182# CONFIG_BLK_DEV is not set
183# CONFIG_MISC_DEVICES is not set
184# CONFIG_IDE is not set
185
186#
187# SCSI device support
188#
189# CONFIG_RAID_ATTRS is not set
190CONFIG_SCSI=y
191CONFIG_SCSI_DMA=y
192# CONFIG_SCSI_TGT is not set
193# CONFIG_SCSI_NETLINK is not set
194CONFIG_SCSI_PROC_FS=y
195
196#
197# SCSI support type (disk, tape, CD-ROM)
198#
199CONFIG_BLK_DEV_SD=y
200# CONFIG_CHR_DEV_ST is not set
201# CONFIG_CHR_DEV_OSST is not set
202# CONFIG_BLK_DEV_SR is not set
203# CONFIG_CHR_DEV_SG is not set
204# CONFIG_CHR_DEV_SCH is not set
205
206#
207# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
208#
209CONFIG_SCSI_MULTI_LUN=y
210# CONFIG_SCSI_CONSTANTS is not set
211# CONFIG_SCSI_LOGGING is not set
212# CONFIG_SCSI_SCAN_ASYNC is not set
213
214#
215# SCSI Transports
216#
217CONFIG_SCSI_SPI_ATTRS=y
218# CONFIG_SCSI_FC_ATTRS is not set
219# CONFIG_SCSI_SAS_LIBSAS is not set
220CONFIG_SCSI_LOWLEVEL=y
221# CONFIG_SCSI_DEBUG is not set
222# CONFIG_ATA is not set
223# CONFIG_MD is not set
224# CONFIG_PHONE is not set
225
226#
227# Input device support
228#
229CONFIG_INPUT=y
230# CONFIG_INPUT_FF_MEMLESS is not set
231# CONFIG_INPUT_POLLDEV is not set
232
233#
234# Userland interfaces
235#
236CONFIG_INPUT_MOUSEDEV=y
237# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
238CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
239CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
240# CONFIG_INPUT_JOYDEV is not set
241# CONFIG_INPUT_TSDEV is not set
242# CONFIG_INPUT_EVDEV is not set
243# CONFIG_INPUT_EVBUG is not set
244
245#
246# Input Device Drivers
247#
248# CONFIG_INPUT_KEYBOARD is not set
249# CONFIG_INPUT_MOUSE is not set
250# CONFIG_INPUT_JOYSTICK is not set
251# CONFIG_INPUT_TABLET is not set
252# CONFIG_INPUT_TOUCHSCREEN is not set
253# CONFIG_INPUT_MISC is not set
254
255#
256# Hardware I/O ports
257#
258# CONFIG_SERIO is not set
259# CONFIG_GAMEPORT is not set
260
261#
262# Character devices
263#
264CONFIG_VT=y
265CONFIG_VT_CONSOLE=y
266CONFIG_HW_CONSOLE=y
267# CONFIG_VT_HW_CONSOLE_BINDING is not set
268# CONFIG_SERIAL_NONSTANDARD is not set
269
270#
271# Serial drivers
272#
273# CONFIG_SERIAL_8250 is not set
274
275#
276# Non-8250 serial port support
277#
278CONFIG_SERIAL_SH_SCI=y
279CONFIG_SERIAL_SH_SCI_NR_UARTS=2
280CONFIG_SERIAL_SH_SCI_CONSOLE=y
281CONFIG_SERIAL_CORE=y
282CONFIG_SERIAL_CORE_CONSOLE=y
283CONFIG_UNIX98_PTYS=y
284# CONFIG_LEGACY_PTYS is not set
285# CONFIG_IPMI_HANDLER is not set
286# CONFIG_WATCHDOG is not set
287# CONFIG_HW_RANDOM is not set
288# CONFIG_R3964 is not set
289# CONFIG_RAW_DRIVER is not set
290# CONFIG_TCG_TPM is not set
291# CONFIG_I2C is not set
292
293#
294# SPI support
295#
296# CONFIG_SPI is not set
297# CONFIG_SPI_MASTER is not set
298# CONFIG_W1 is not set
299# CONFIG_POWER_SUPPLY is not set
300# CONFIG_HWMON is not set
301
302#
303# Multifunction device drivers
304#
305# CONFIG_MFD_SM501 is not set
306
307#
308# Multimedia devices
309#
310# CONFIG_VIDEO_DEV is not set
311CONFIG_DAB=y
312
313#
314# Graphics support
315#
316# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
317
318#
319# Display device support
320#
321# CONFIG_DISPLAY_SUPPORT is not set
322# CONFIG_VGASTATE is not set
323CONFIG_VIDEO_OUTPUT_CONTROL=y
324CONFIG_FB=y
325CONFIG_FIRMWARE_EDID=y
326# CONFIG_FB_DDC is not set
327# CONFIG_FB_CFB_FILLRECT is not set
328# CONFIG_FB_CFB_COPYAREA is not set
329# CONFIG_FB_CFB_IMAGEBLIT is not set
330# CONFIG_FB_SYS_FILLRECT is not set
331# CONFIG_FB_SYS_COPYAREA is not set
332# CONFIG_FB_SYS_IMAGEBLIT is not set
333# CONFIG_FB_SYS_FOPS is not set
334CONFIG_FB_DEFERRED_IO=y
335# CONFIG_FB_SVGALIB is not set
336# CONFIG_FB_MACMODES is not set
337# CONFIG_FB_BACKLIGHT is not set
338CONFIG_FB_MODE_HELPERS=y
339# CONFIG_FB_TILEBLITTING is not set
340
341#
342# Frame buffer hardware drivers
343#
344# CONFIG_FB_S1D13XXX is not set
345# CONFIG_FB_VIRTUAL is not set
346
347#
348# Console display driver support
349#
350CONFIG_DUMMY_CONSOLE=y
351CONFIG_FRAMEBUFFER_CONSOLE=y
352# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
353# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
354CONFIG_FONTS=y
355# CONFIG_FONT_8x8 is not set
356CONFIG_FONT_8x16=y
357# CONFIG_FONT_6x11 is not set
358# CONFIG_FONT_7x14 is not set
359# CONFIG_FONT_PEARL_8x8 is not set
360# CONFIG_FONT_ACORN_8x8 is not set
361# CONFIG_FONT_MINI_4x6 is not set
362# CONFIG_FONT_SUN8x16 is not set
363# CONFIG_FONT_SUN12x22 is not set
364# CONFIG_FONT_10x18 is not set
365CONFIG_LOGO=y
366# CONFIG_LOGO_LINUX_MONO is not set
367# CONFIG_LOGO_LINUX_VGA16 is not set
368# CONFIG_LOGO_LINUX_CLUT224 is not set
369# CONFIG_LOGO_SUPERH_MONO is not set
370# CONFIG_LOGO_SUPERH_VGA16 is not set
371CONFIG_LOGO_SUPERH_CLUT224=y
372
373#
374# Sound
375#
376# CONFIG_SOUND is not set
377# CONFIG_HID_SUPPORT is not set
378# CONFIG_USB_SUPPORT is not set
379# CONFIG_MMC is not set
380# CONFIG_NEW_LEDS is not set
381# CONFIG_RTC_CLASS is not set
382
383#
384# DMA Engine support
385#
386# CONFIG_DMA_ENGINE is not set
387
388#
389# DMA Clients
390#
391
392#
393# DMA Devices
394#
395
396#
397# Userspace I/O
398#
399# CONFIG_UIO is not set
400
401#
402# File systems
403#
404CONFIG_EXT2_FS=y
405# CONFIG_EXT2_FS_XATTR is not set
406# CONFIG_EXT2_FS_XIP is not set
407CONFIG_EXT3_FS=y
408CONFIG_EXT3_FS_XATTR=y
409# CONFIG_EXT3_FS_POSIX_ACL is not set
410# CONFIG_EXT3_FS_SECURITY is not set
411# CONFIG_EXT4DEV_FS is not set
412CONFIG_JBD=y
413# CONFIG_JBD_DEBUG is not set
414CONFIG_FS_MBCACHE=y
415# CONFIG_REISERFS_FS is not set
416# CONFIG_JFS_FS is not set
417# CONFIG_FS_POSIX_ACL is not set
418# CONFIG_XFS_FS is not set
419# CONFIG_GFS2_FS is not set
420CONFIG_MINIX_FS=y
421CONFIG_ROMFS_FS=y
422CONFIG_INOTIFY=y
423CONFIG_INOTIFY_USER=y
424# CONFIG_QUOTA is not set
425CONFIG_DNOTIFY=y
426# CONFIG_AUTOFS_FS is not set
427# CONFIG_AUTOFS4_FS is not set
428# CONFIG_FUSE_FS is not set
429
430#
431# CD-ROM/DVD Filesystems
432#
433# CONFIG_ISO9660_FS is not set
434# CONFIG_UDF_FS is not set
435
436#
437# DOS/FAT/NT Filesystems
438#
439# CONFIG_MSDOS_FS is not set
440# CONFIG_VFAT_FS is not set
441# CONFIG_NTFS_FS is not set
442
443#
444# Pseudo filesystems
445#
446CONFIG_PROC_FS=y
447CONFIG_PROC_KCORE=y
448CONFIG_PROC_SYSCTL=y
449CONFIG_SYSFS=y
450CONFIG_TMPFS=y
451# CONFIG_TMPFS_POSIX_ACL is not set
452CONFIG_HUGETLBFS=y
453CONFIG_HUGETLB_PAGE=y
454CONFIG_RAMFS=y
455# CONFIG_CONFIGFS_FS is not set
456
457#
458# Miscellaneous filesystems
459#
460# CONFIG_ADFS_FS is not set
461# CONFIG_AFFS_FS is not set
462# CONFIG_HFS_FS is not set
463# CONFIG_HFSPLUS_FS is not set
464# CONFIG_BEFS_FS is not set
465# CONFIG_BFS_FS is not set
466# CONFIG_EFS_FS is not set
467# CONFIG_CRAMFS is not set
468# CONFIG_VXFS_FS is not set
469# CONFIG_HPFS_FS is not set
470# CONFIG_QNX4FS_FS is not set
471# CONFIG_SYSV_FS is not set
472# CONFIG_UFS_FS is not set
473
474#
475# Partition Types
476#
477CONFIG_PARTITION_ADVANCED=y
478# CONFIG_ACORN_PARTITION is not set
479# CONFIG_OSF_PARTITION is not set
480# CONFIG_AMIGA_PARTITION is not set
481# CONFIG_ATARI_PARTITION is not set
482# CONFIG_MAC_PARTITION is not set
483CONFIG_MSDOS_PARTITION=y
484# CONFIG_BSD_DISKLABEL is not set
485# CONFIG_MINIX_SUBPARTITION is not set
486# CONFIG_SOLARIS_X86_PARTITION is not set
487# CONFIG_UNIXWARE_DISKLABEL is not set
488# CONFIG_LDM_PARTITION is not set
489# CONFIG_SGI_PARTITION is not set
490# CONFIG_ULTRIX_PARTITION is not set
491# CONFIG_SUN_PARTITION is not set
492# CONFIG_KARMA_PARTITION is not set
493# CONFIG_EFI_PARTITION is not set
494# CONFIG_SYSV68_PARTITION is not set
495
496#
497# Native Language Support
498#
499# CONFIG_NLS is not set
500
501#
502# Profiling support
503#
504CONFIG_PROFILING=y
505# CONFIG_OPROFILE is not set
506
507#
508# Kernel hacking
509#
510# CONFIG_PRINTK_TIME is not set
511CONFIG_ENABLE_MUST_CHECK=y
512CONFIG_MAGIC_SYSRQ=y
513# CONFIG_UNUSED_SYMBOLS is not set
514CONFIG_DEBUG_FS=y
515# CONFIG_HEADERS_CHECK is not set
516CONFIG_DEBUG_KERNEL=y
517# CONFIG_DEBUG_SHIRQ is not set
518CONFIG_DETECT_SOFTLOCKUP=y
519CONFIG_SCHED_DEBUG=y
520CONFIG_SCHEDSTATS=y
521# CONFIG_TIMER_STATS is not set
522# CONFIG_DEBUG_SLAB is not set
523# CONFIG_DEBUG_RT_MUTEXES is not set
524# CONFIG_RT_MUTEX_TESTER is not set
525# CONFIG_DEBUG_SPINLOCK is not set
526# CONFIG_DEBUG_MUTEXES is not set
527# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
528# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
529# CONFIG_DEBUG_KOBJECT is not set
530CONFIG_DEBUG_BUGVERBOSE=y
531# CONFIG_DEBUG_INFO is not set
532# CONFIG_DEBUG_VM is not set
533# CONFIG_DEBUG_LIST is not set
534CONFIG_FRAME_POINTER=y
535CONFIG_FORCED_INLINING=y
536# CONFIG_FAULT_INJECTION is not set
537# CONFIG_EARLY_PRINTK is not set
538# CONFIG_DEBUG_KERNEL_WITH_GDB_STUB is not set
539CONFIG_SH64_PROC_TLB=y
540CONFIG_SH64_PROC_ASIDS=y
541CONFIG_SH64_SR_WATCH=y
542# CONFIG_POOR_MANS_STRACE is not set
543# CONFIG_SH_ALPHANUMERIC is not set
544CONFIG_SH_NO_BSS_INIT=y
545
546#
547# Security options
548#
549# CONFIG_KEYS is not set
550# CONFIG_SECURITY is not set
551# CONFIG_CRYPTO is not set
552
553#
554# Library routines
555#
556CONFIG_BITREVERSE=y
557# CONFIG_CRC_CCITT is not set
558# CONFIG_CRC16 is not set
559# CONFIG_CRC_ITU_T is not set
560CONFIG_CRC32=y
561# CONFIG_CRC7 is not set
562# CONFIG_LIBCRC32C is not set
563CONFIG_PLIST=y
564CONFIG_HAS_IOMEM=y
565CONFIG_HAS_IOPORT=y
566CONFIG_HAS_DMA=y
diff --git a/arch/sh64/kernel/Makefile b/arch/sh64/kernel/Makefile
index 5816657c079c..e3467bda6167 100644
--- a/arch/sh64/kernel/Makefile
+++ b/arch/sh64/kernel/Makefile
@@ -25,7 +25,7 @@ obj-$(CONFIG_SH_DMA) += dma.o
25obj-$(CONFIG_SH_FPU) += fpu.o 25obj-$(CONFIG_SH_FPU) += fpu.o
26obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 26obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
27obj-$(CONFIG_KALLSYMS) += unwind.o 27obj-$(CONFIG_KALLSYMS) += unwind.o
28obj-$(CONFIG_PCI) += pci-dma.o pcibios.o 28obj-$(CONFIG_PCI) += pcibios.o
29obj-$(CONFIG_MODULES) += module.o 29obj-$(CONFIG_MODULES) += module.o
30 30
31ifeq ($(CONFIG_PCI),y) 31ifeq ($(CONFIG_PCI),y)
diff --git a/arch/sh64/kernel/alphanum.c b/arch/sh64/kernel/alphanum.c
index 91707c1acd70..d1619d95fbaa 100644
--- a/arch/sh64/kernel/alphanum.c
+++ b/arch/sh64/kernel/alphanum.c
@@ -13,7 +13,6 @@
13#include <linux/sched.h> 13#include <linux/sched.h>
14 14
15void mach_alphanum(int pos, unsigned char val); 15void mach_alphanum(int pos, unsigned char val);
16void mach_led(int pos, int val);
17 16
18void print_seg(char *file, int line) 17void print_seg(char *file, int line)
19{ 18{
diff --git a/arch/sh64/kernel/ptrace.c b/arch/sh64/kernel/ptrace.c
index df06c6477468..8a2d339cf760 100644
--- a/arch/sh64/kernel/ptrace.c
+++ b/arch/sh64/kernel/ptrace.c
@@ -244,10 +244,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
244 break; 244 break;
245 } 245 }
246 246
247 case PTRACE_DETACH: /* detach a process that was attached. */
248 ret = ptrace_detach(child, data);
249 break;
250
251 default: 247 default:
252 ret = ptrace_request(child, request, addr, data); 248 ret = ptrace_request(child, request, addr, data);
253 break; 249 break;
diff --git a/arch/sh64/kernel/sh_ksyms.c b/arch/sh64/kernel/sh_ksyms.c
index 461ea3de316f..b1705acc8e64 100644
--- a/arch/sh64/kernel/sh_ksyms.c
+++ b/arch/sh64/kernel/sh_ksyms.c
@@ -31,16 +31,11 @@ extern int dump_fpu(struct pt_regs *, elf_fpregset_t *);
31 31
32/* platform dependent support */ 32/* platform dependent support */
33EXPORT_SYMBOL(dump_fpu); 33EXPORT_SYMBOL(dump_fpu);
34EXPORT_SYMBOL(iounmap);
35EXPORT_SYMBOL(enable_irq);
36EXPORT_SYMBOL(disable_irq);
37EXPORT_SYMBOL(kernel_thread); 34EXPORT_SYMBOL(kernel_thread);
38 35
39/* Networking helper routines. */ 36/* Networking helper routines. */
40EXPORT_SYMBOL(csum_partial_copy_nocheck); 37EXPORT_SYMBOL(csum_partial_copy_nocheck);
41 38
42EXPORT_SYMBOL(strstr);
43
44#ifdef CONFIG_VT 39#ifdef CONFIG_VT
45EXPORT_SYMBOL(screen_info); 40EXPORT_SYMBOL(screen_info);
46#endif 41#endif
@@ -50,27 +45,18 @@ EXPORT_SYMBOL(__down_trylock);
50EXPORT_SYMBOL(__up); 45EXPORT_SYMBOL(__up);
51EXPORT_SYMBOL(__put_user_asm_l); 46EXPORT_SYMBOL(__put_user_asm_l);
52EXPORT_SYMBOL(__get_user_asm_l); 47EXPORT_SYMBOL(__get_user_asm_l);
53EXPORT_SYMBOL(memcmp); 48EXPORT_SYMBOL(__copy_user);
54EXPORT_SYMBOL(memcpy); 49EXPORT_SYMBOL(memcpy);
55EXPORT_SYMBOL(memset); 50EXPORT_SYMBOL(udelay);
56EXPORT_SYMBOL(memscan); 51EXPORT_SYMBOL(__udelay);
57EXPORT_SYMBOL(strchr); 52EXPORT_SYMBOL(ndelay);
58EXPORT_SYMBOL(strlen); 53EXPORT_SYMBOL(__ndelay);
59
60EXPORT_SYMBOL(flush_dcache_page); 54EXPORT_SYMBOL(flush_dcache_page);
61
62/* For ext3 */
63EXPORT_SYMBOL(sh64_page_clear); 55EXPORT_SYMBOL(sh64_page_clear);
64 56
65/* Ugh. These come in from libgcc.a at link time. */ 57/* Ugh. These come in from libgcc.a at link time. */
58#define DECLARE_EXPORT(name) extern void name(void);EXPORT_SYMBOL(name)
66 59
67extern void __sdivsi3(void); 60DECLARE_EXPORT(__sdivsi3);
68extern void __muldi3(void); 61DECLARE_EXPORT(__muldi3);
69extern void __udivsi3(void); 62DECLARE_EXPORT(__udivsi3);
70extern char __div_table;
71EXPORT_SYMBOL(__sdivsi3);
72EXPORT_SYMBOL(__muldi3);
73EXPORT_SYMBOL(__udivsi3);
74EXPORT_SYMBOL(__div_table);
75
76
diff --git a/arch/sh64/kernel/time.c b/arch/sh64/kernel/time.c
index b37f4f4981d2..06f3c179e345 100644
--- a/arch/sh64/kernel/time.c
+++ b/arch/sh64/kernel/time.c
@@ -476,8 +476,18 @@ static irqreturn_t sh64_rtc_interrupt(int irq, void *dev_id)
476 return IRQ_HANDLED; 476 return IRQ_HANDLED;
477} 477}
478 478
479static struct irqaction irq0 = { timer_interrupt, IRQF_DISABLED, CPU_MASK_NONE, "timer", NULL, NULL}; 479static struct irqaction irq0 = {
480static struct irqaction irq1 = { sh64_rtc_interrupt, IRQF_DISABLED, CPU_MASK_NONE, "rtc", NULL, NULL}; 480 .handler = timer_interrupt,
481 .flags = IRQF_DISABLED,
482 .mask = CPU_MASK_NONE,
483 .name = "timer",
484};
485static struct irqaction irq1 = {
486 .handler = sh64_rtc_interrupt,
487 .flags = IRQF_DISABLED,
488 .mask = CPU_MASK_NONE,
489 .name = "rtc",
490};
481 491
482void __init time_init(void) 492void __init time_init(void)
483{ 493{
diff --git a/arch/sh64/kernel/vmlinux.lds.S b/arch/sh64/kernel/vmlinux.lds.S
index 267b4f9af2e1..f533a064da5f 100644
--- a/arch/sh64/kernel/vmlinux.lds.S
+++ b/arch/sh64/kernel/vmlinux.lds.S
@@ -30,14 +30,6 @@
30#define LOAD_OFFSET CONFIG_CACHED_MEMORY_OFFSET 30#define LOAD_OFFSET CONFIG_CACHED_MEMORY_OFFSET
31#include <asm-generic/vmlinux.lds.h> 31#include <asm-generic/vmlinux.lds.h>
32 32
33#ifdef NOTDEF
34#ifdef CONFIG_LITTLE_ENDIAN
35OUTPUT_FORMAT("elf32-sh64l-linux", "elf32-sh64l-linux", "elf32-sh64l-linux")
36#else
37OUTPUT_FORMAT("elf32-sh64", "elf32-sh64", "elf32-sh64")
38#endif
39#endif
40
41OUTPUT_ARCH(sh:sh5) 33OUTPUT_ARCH(sh:sh5)
42 34
43#define C_PHYS(x) AT (ADDR(x) - LOAD_OFFSET) 35#define C_PHYS(x) AT (ADDR(x) - LOAD_OFFSET)
@@ -74,10 +66,12 @@ SECTIONS
74 __ex_table : C_PHYS(__ex_table) { *(__ex_table) } 66 __ex_table : C_PHYS(__ex_table) { *(__ex_table) }
75 __stop___ex_table = .; 67 __stop___ex_table = .;
76 68
77 RODATA
78
79 _etext = .; /* End of text section */ 69 _etext = .; /* End of text section */
80 70
71 NOTES
72
73 RODATA
74
81 .data : C_PHYS(.data) { /* Data */ 75 .data : C_PHYS(.data) { /* Data */
82 DATA_DATA 76 DATA_DATA
83 CONSTRUCTORS 77 CONSTRUCTORS
@@ -86,13 +80,9 @@ SECTIONS
86 . = ALIGN(PAGE_SIZE); 80 . = ALIGN(PAGE_SIZE);
87 .data.page_aligned : C_PHYS(.data.page_aligned) { *(.data.page_aligned) } 81 .data.page_aligned : C_PHYS(.data.page_aligned) { *(.data.page_aligned) }
88 82
89 . = ALIGN(PAGE_SIZE); 83 PERCPU(PAGE_SIZE)
90 __per_cpu_start = .; 84
91 .data.percpu : C_PHYS(.data.percpu) { 85 . = ALIGN(L1_CACHE_BYTES);
92 *(.data.percpu)
93 *(.data.percpu.shared_aligned)
94 }
95 __per_cpu_end = . ;
96 .data.cacheline_aligned : C_PHYS(.data.cacheline_aligned) { *(.data.cacheline_aligned) } 86 .data.cacheline_aligned : C_PHYS(.data.cacheline_aligned) { *(.data.cacheline_aligned) }
97 87
98 _edata = .; /* End of data section */ 88 _edata = .; /* End of data section */
@@ -145,38 +135,6 @@ SECTIONS
145 *(.exitcall.exit) 135 *(.exitcall.exit)
146 } 136 }
147 137
148 /* Stabs debugging sections. */ 138 STABS_DEBUG
149 .stab 0 : C_PHYS(.stab) { *(.stab) } 139 DWARF_DEBUG
150 .stabstr 0 : C_PHYS(.stabstr) { *(.stabstr) }
151 .stab.excl 0 : C_PHYS(.stab.excl) { *(.stab.excl) }
152 .stab.exclstr 0 : C_PHYS(.stab.exclstr) { *(.stab.exclstr) }
153 .stab.index 0 : C_PHYS(.stab.index) { *(.stab.index) }
154 .stab.indexstr 0 : C_PHYS(.stab.indexstr) { *(.stab.indexstr) }
155 .comment 0 : C_PHYS(.comment) { *(.comment) }
156 /* DWARF debug sections.
157 Symbols in the DWARF debugging section are relative to the beginning
158 of the section so we begin .debug at 0. */
159 /* DWARF 1 */
160 .debug 0 : C_PHYS(.debug) { *(.debug) }
161 .line 0 : C_PHYS(.line) { *(.line) }
162 /* GNU DWARF 1 extensions */
163 .debug_srcinfo 0 : C_PHYS(.debug_srcinfo) { *(.debug_srcinfo) }
164 .debug_sfnames 0 : C_PHYS(.debug_sfnames) { *(.debug_sfnames) }
165 /* DWARF 1.1 and DWARF 2 */
166 .debug_aranges 0 : C_PHYS(.debug_aranges) { *(.debug_aranges) }
167 .debug_pubnames 0 : C_PHYS(.debug_pubnames) { *(.debug_pubnames) }
168 /* DWARF 2 */
169 .debug_info 0 : C_PHYS(.debug_info) { *(.debug_info) }
170 .debug_abbrev 0 : C_PHYS(.debug_abbrev) { *(.debug_abbrev) }
171 .debug_line 0 : C_PHYS(.debug_line) { *(.debug_line) }
172 .debug_frame 0 : C_PHYS(.debug_frame) { *(.debug_frame) }
173 .debug_str 0 : C_PHYS(.debug_str) { *(.debug_str) }
174 .debug_loc 0 : C_PHYS(.debug_loc) { *(.debug_loc) }
175 .debug_macinfo 0 : C_PHYS(.debug_macinfo) { *(.debug_macinfo) }
176 /* SGI/MIPS DWARF 2 extensions */
177 .debug_weaknames 0 : C_PHYS(.debug_weaknames) { *(.debug_weaknames) }
178 .debug_funcnames 0 : C_PHYS(.debug_funcnames) { *(.debug_funcnames) }
179 .debug_typenames 0 : C_PHYS(.debug_typenames) { *(.debug_typenames) }
180 .debug_varnames 0 : C_PHYS(.debug_varnames) { *(.debug_varnames) }
181 /* These must appear regardless of . */
182} 140}
diff --git a/arch/sh64/lib/c-checksum.c b/arch/sh64/lib/c-checksum.c
index bd5501760240..053137abd8a0 100644
--- a/arch/sh64/lib/c-checksum.c
+++ b/arch/sh64/lib/c-checksum.c
@@ -10,6 +10,7 @@
10#include <linux/string.h> 10#include <linux/string.h>
11#include <linux/errno.h> 11#include <linux/errno.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/module.h>
13#include <asm/byteorder.h> 14#include <asm/byteorder.h>
14#include <asm/uaccess.h> 15#include <asm/uaccess.h>
15 16
@@ -110,7 +111,7 @@ static unsigned long do_csum(const unsigned char *buff, int len)
110 if (odd) 111 if (odd)
111 result = ((result >> 8) & 0xff) | ((result & 0xff) << 8); 112 result = ((result >> 8) & 0xff) | ((result & 0xff) << 8);
112 113
113 pr_debug("\nCHECKSUM is 0x%x\n", result); 114 pr_debug("\nCHECKSUM is 0x%lx\n", result);
114 115
115 out: 116 out:
116 return result; 117 return result;
diff --git a/arch/sh64/lib/io.c b/arch/sh64/lib/io.c
index 587baa3dffb9..a3f3a2b8e25b 100644
--- a/arch/sh64/lib/io.c
+++ b/arch/sh64/lib/io.c
@@ -11,30 +11,11 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/delay.h> 13#include <linux/delay.h>
14#include <linux/module.h>
14#include <asm/system.h> 15#include <asm/system.h>
15#include <asm/processor.h> 16#include <asm/processor.h>
16#include <asm/io.h> 17#include <asm/io.h>
17 18
18/*
19 * readX/writeX() are used to access memory mapped devices. On some
20 * architectures the memory mapped IO stuff needs to be accessed
21 * differently. On the SuperH architecture, we just read/write the
22 * memory location directly.
23 */
24
25/* This is horrible at the moment - needs more work to do something sensible */
26#define IO_DELAY()
27
28#define OUT_DELAY(x,type) \
29void out##x##_p(unsigned type value,unsigned long port){out##x(value,port);IO_DELAY();}
30
31#define IN_DELAY(x,type) \
32unsigned type in##x##_p(unsigned long port) {unsigned type tmp=in##x(port);IO_DELAY();return tmp;}
33
34#if 1
35OUT_DELAY(b, long) OUT_DELAY(w, long) OUT_DELAY(l, long)
36 IN_DELAY(b, long) IN_DELAY(w, long) IN_DELAY(l, long)
37#endif
38/* Now for the string version of these functions */ 19/* Now for the string version of these functions */
39void outsb(unsigned long port, const void *addr, unsigned long count) 20void outsb(unsigned long port, const void *addr, unsigned long count)
40{ 21{
@@ -45,6 +26,7 @@ void outsb(unsigned long port, const void *addr, unsigned long count)
45 outb(*p, port); 26 outb(*p, port);
46 } 27 }
47} 28}
29EXPORT_SYMBOL(outsb);
48 30
49void insb(unsigned long port, void *addr, unsigned long count) 31void insb(unsigned long port, void *addr, unsigned long count)
50{ 32{
@@ -55,6 +37,7 @@ void insb(unsigned long port, void *addr, unsigned long count)
55 *p = inb(port); 37 *p = inb(port);
56 } 38 }
57} 39}
40EXPORT_SYMBOL(insb);
58 41
59/* For the 16 and 32 bit string functions, we have to worry about alignment. 42/* For the 16 and 32 bit string functions, we have to worry about alignment.
60 * The SH does not do unaligned accesses, so we have to read as bytes and 43 * The SH does not do unaligned accesses, so we have to read as bytes and
@@ -74,6 +57,7 @@ void outsw(unsigned long port, const void *addr, unsigned long count)
74 outw(tmp, port); 57 outw(tmp, port);
75 } 58 }
76} 59}
60EXPORT_SYMBOL(outsw);
77 61
78void insw(unsigned long port, void *addr, unsigned long count) 62void insw(unsigned long port, void *addr, unsigned long count)
79{ 63{
@@ -87,6 +71,7 @@ void insw(unsigned long port, void *addr, unsigned long count)
87 p[1] = (tmp >> 8) & 0xff; 71 p[1] = (tmp >> 8) & 0xff;
88 } 72 }
89} 73}
74EXPORT_SYMBOL(insw);
90 75
91void outsl(unsigned long port, const void *addr, unsigned long count) 76void outsl(unsigned long port, const void *addr, unsigned long count)
92{ 77{
@@ -100,6 +85,7 @@ void outsl(unsigned long port, const void *addr, unsigned long count)
100 outl(tmp, port); 85 outl(tmp, port);
101 } 86 }
102} 87}
88EXPORT_SYMBOL(outsl);
103 89
104void insl(unsigned long port, void *addr, unsigned long count) 90void insl(unsigned long port, void *addr, unsigned long count)
105{ 91{
@@ -116,6 +102,7 @@ void insl(unsigned long port, void *addr, unsigned long count)
116 102
117 } 103 }
118} 104}
105EXPORT_SYMBOL(insl);
119 106
120void memcpy_toio(void __iomem *to, const void *from, long count) 107void memcpy_toio(void __iomem *to, const void *from, long count)
121{ 108{
@@ -126,6 +113,7 @@ void memcpy_toio(void __iomem *to, const void *from, long count)
126 writeb(*p++, to++); 113 writeb(*p++, to++);
127 } 114 }
128} 115}
116EXPORT_SYMBOL(memcpy_toio);
129 117
130void memcpy_fromio(void *to, void __iomem *from, long count) 118void memcpy_fromio(void *to, void __iomem *from, long count)
131{ 119{
@@ -137,3 +125,4 @@ void memcpy_fromio(void *to, void __iomem *from, long count)
137 from++; 125 from++;
138 } 126 }
139} 127}
128EXPORT_SYMBOL(memcpy_fromio);
diff --git a/arch/sh64/lib/iomap.c b/arch/sh64/lib/iomap.c
index 5cd3d5e9c762..253d1e351d49 100644
--- a/arch/sh64/lib/iomap.c
+++ b/arch/sh64/lib/iomap.c
@@ -17,12 +17,15 @@ ioport_map(unsigned long port, unsigned int len)
17{ 17{
18 return (void __iomem *)port; 18 return (void __iomem *)port;
19} 19}
20EXPORT_SYMBOL(ioport_map);
20 21
21void ioport_unmap(void __iomem *addr) 22void ioport_unmap(void __iomem *addr)
22{ 23{
23 /* Nothing .. */ 24 /* Nothing .. */
24} 25}
26EXPORT_SYMBOL(ioport_unmap);
25 27
28#ifdef CONFIG_PCI
26void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) 29void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
27{ 30{
28 unsigned long start = pci_resource_start(dev, bar); 31 unsigned long start = pci_resource_start(dev, bar);
@@ -41,14 +44,11 @@ void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
41 /* What? */ 44 /* What? */
42 return NULL; 45 return NULL;
43} 46}
47EXPORT_SYMBOL(pci_iomap);
44 48
45void pci_iounmap(struct pci_dev *dev, void __iomem *addr) 49void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
46{ 50{
47 /* Nothing .. */ 51 /* Nothing .. */
48} 52}
49
50EXPORT_SYMBOL(ioport_map);
51EXPORT_SYMBOL(ioport_unmap);
52EXPORT_SYMBOL(pci_iomap);
53EXPORT_SYMBOL(pci_iounmap); 53EXPORT_SYMBOL(pci_iounmap);
54 54#endif
diff --git a/arch/sh64/mach-cayman/setup.c b/arch/sh64/mach-cayman/setup.c
index c3611cc2735f..726c520d7eb9 100644
--- a/arch/sh64/mach-cayman/setup.c
+++ b/arch/sh64/mach-cayman/setup.c
@@ -18,19 +18,11 @@
18 * lethal@linux-sh.org: 15th May 2003 18 * lethal@linux-sh.org: 15th May 2003
19 * Use the generic procfs cpuinfo interface, just return a valid board name. 19 * Use the generic procfs cpuinfo interface, just return a valid board name.
20 */ 20 */
21
22#include <linux/stddef.h>
23#include <linux/init.h> 21#include <linux/init.h>
24#include <linux/mm.h>
25#include <linux/bootmem.h>
26#include <linux/delay.h>
27#include <linux/kernel.h> 22#include <linux/kernel.h>
28#include <linux/seq_file.h>
29#include <asm/processor.h>
30#include <asm/platform.h> 23#include <asm/platform.h>
31#include <asm/io.h>
32#include <asm/irq.h> 24#include <asm/irq.h>
33#include <asm/page.h> 25#include <asm/io.h>
34 26
35/* 27/*
36 * Platform Dependent Interrupt Priorities. 28 * Platform Dependent Interrupt Priorities.
diff --git a/arch/sh64/mach-harp/Makefile b/arch/sh64/mach-harp/Makefile
index 63f065bad2f9..2f2963fa2131 100644
--- a/arch/sh64/mach-harp/Makefile
+++ b/arch/sh64/mach-harp/Makefile
@@ -1,14 +1 @@
1#
2# Makefile for the ST50 Harp specific parts of the kernel
3#
4# Note! Dependencies are done automagically by 'make dep', which also
5# removes any old dependencies. DON'T put your own dependencies here
6# unless it's something special (ie not a .c file).
7#
8
9O_TARGET := harp.o
10
11obj-y := setup.o obj-y := setup.o
12
13include $(TOPDIR)/Rules.make
14
diff --git a/arch/sh64/mach-harp/setup.c b/arch/sh64/mach-harp/setup.c
index fcd90afac297..05011cb369bb 100644
--- a/arch/sh64/mach-harp/setup.c
+++ b/arch/sh64/mach-harp/setup.c
@@ -17,20 +17,10 @@
17 * lethal@linux-sh.org: 15th May 2003 17 * lethal@linux-sh.org: 15th May 2003
18 * Use the generic procfs cpuinfo interface, just return a valid board name. 18 * Use the generic procfs cpuinfo interface, just return a valid board name.
19 */ 19 */
20
21#include <linux/stddef.h>
22#include <linux/init.h> 20#include <linux/init.h>
23#include <linux/mm.h>
24#include <linux/bootmem.h>
25#include <linux/delay.h>
26#include <linux/kernel.h> 21#include <linux/kernel.h>
27#include <asm/processor.h>
28#include <asm/platform.h> 22#include <asm/platform.h>
29#include <asm/io.h>
30#include <asm/irq.h> 23#include <asm/irq.h>
31#include <asm/page.h>
32
33#define RES_COUNT(res) ((sizeof((res))/sizeof(struct resource)))
34 24
35/* 25/*
36 * Platform Dependent Interrupt Priorities. 26 * Platform Dependent Interrupt Priorities.
@@ -78,8 +68,10 @@ struct resource io_resources[] = {
78}; 68};
79 69
80struct resource kram_resources[] = { 70struct resource kram_resources[] = {
81 { "Kernel code", 0, 0 }, /* These must be last in the array */ 71 /* These must be last in the array */
82 { "Kernel data", 0, 0 } /* These must be last in the array */ 72 { .name = "Kernel code", .start = 0, .end = 0 },
73 /* These must be last in the array */
74 { .name = "Kernel data", .start = 0, .end = 0 }
83}; 75};
84 76
85struct resource xram_resources[] = { 77struct resource xram_resources[] = {
@@ -95,13 +87,13 @@ struct sh64_platform platform_parms = {
95 .initial_root_dev = 0x0100, 87 .initial_root_dev = 0x0100,
96 .loader_type = 1, 88 .loader_type = 1,
97 .io_res_p = io_resources, 89 .io_res_p = io_resources,
98 .io_res_count = RES_COUNT(io_resources), 90 .io_res_count = ARRAY_SIZE(io_resources),
99 .kram_res_p = kram_resources, 91 .kram_res_p = kram_resources,
100 .kram_res_count = RES_COUNT(kram_resources), 92 .kram_res_count = ARRAY_SIZE(kram_resources),
101 .xram_res_p = xram_resources, 93 .xram_res_p = xram_resources,
102 .xram_res_count = RES_COUNT(xram_resources), 94 .xram_res_count = ARRAY_SIZE(xram_resources),
103 .rom_res_p = rom_resources, 95 .rom_res_p = rom_resources,
104 .rom_res_count = RES_COUNT(rom_resources), 96 .rom_res_count = ARRAY_SIZE(rom_resources),
105}; 97};
106 98
107int platform_int_priority[NR_INTC_IRQS] = { 99int platform_int_priority[NR_INTC_IRQS] = {
@@ -135,4 +127,3 @@ const char *get_system_type(void)
135{ 127{
136 return "ST50 Harp"; 128 return "ST50 Harp";
137} 129}
138
diff --git a/arch/sh64/mach-romram/Makefile b/arch/sh64/mach-romram/Makefile
deleted file mode 100644
index 02d05c05afa1..000000000000
--- a/arch/sh64/mach-romram/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
1#
2# Makefile for the SH-5 ROM/RAM specific parts of the kernel
3#
4# Note! Dependencies are done automagically by 'make dep', which also
5# removes any old dependencies. DON'T put your own dependencies here
6# unless it's something special (ie not a .c file).
7#
8
9O_TARGET := romram.o
10
11obj-y := setup.o
12
13include $(TOPDIR)/Rules.make
14
diff --git a/arch/sh64/mach-romram/setup.c b/arch/sh64/mach-romram/setup.c
deleted file mode 100644
index eb98a1640cc1..000000000000
--- a/arch/sh64/mach-romram/setup.c
+++ /dev/null
@@ -1,141 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * arch/sh64/mach-romram/setup.c
7 *
8 * SH-5 ROM/RAM Platform Support
9 *
10 * This file handles the architecture-dependent parts of initialization
11 *
12 * Copyright (C) 2000, 2001 Paolo Alberelli
13 *
14 * benedict.gaster@superh.com: 3rd May 2002
15 * Added support for ramdisk, removing statically linked romfs at the same time. *
16 *
17 * lethal@linux-sh.org: 15th May 2003
18 * Use the generic procfs cpuinfo interface, just return a valid board name.
19 *
20 * Sean.McGoogan@superh.com 17th Feb 2004
21 * copied from arch/sh64/mach-harp/setup.c
22 */
23
24#include <linux/stddef.h>
25#include <linux/init.h>
26#include <linux/mm.h>
27#include <linux/bootmem.h>
28#include <linux/delay.h>
29#include <linux/kernel.h>
30#include <asm/processor.h>
31#include <asm/platform.h>
32#include <asm/io.h>
33#include <asm/irq.h>
34#include <asm/page.h>
35
36#define RES_COUNT(res) ((sizeof((res))/sizeof(struct resource)))
37
38/*
39 * Platform Dependent Interrupt Priorities.
40 */
41
42/* Using defaults defined in irq.h */
43#define RES NO_PRIORITY /* Disabled */
44#define IR0 IRL0_PRIORITY /* IRLs */
45#define IR1 IRL1_PRIORITY
46#define IR2 IRL2_PRIORITY
47#define IR3 IRL3_PRIORITY
48#define PCA INTA_PRIORITY /* PCI Ints */
49#define PCB INTB_PRIORITY
50#define PCC INTC_PRIORITY
51#define PCD INTD_PRIORITY
52#define SER TOP_PRIORITY
53#define ERR TOP_PRIORITY
54#define PW0 TOP_PRIORITY
55#define PW1 TOP_PRIORITY
56#define PW2 TOP_PRIORITY
57#define PW3 TOP_PRIORITY
58#define DM0 NO_PRIORITY /* DMA Ints */
59#define DM1 NO_PRIORITY
60#define DM2 NO_PRIORITY
61#define DM3 NO_PRIORITY
62#define DAE NO_PRIORITY
63#define TU0 TIMER_PRIORITY /* TMU Ints */
64#define TU1 NO_PRIORITY
65#define TU2 NO_PRIORITY
66#define TI2 NO_PRIORITY
67#define ATI NO_PRIORITY /* RTC Ints */
68#define PRI NO_PRIORITY
69#define CUI RTC_PRIORITY
70#define ERI SCIF_PRIORITY /* SCIF Ints */
71#define RXI SCIF_PRIORITY
72#define BRI SCIF_PRIORITY
73#define TXI SCIF_PRIORITY
74#define ITI TOP_PRIORITY /* WDT Ints */
75
76/*
77 * Platform dependent structures: maps and parms block.
78 */
79struct resource io_resources[] = {
80 /* To be updated with external devices */
81};
82
83struct resource kram_resources[] = {
84 { "Kernel code", 0, 0 }, /* These must be last in the array */
85 { "Kernel data", 0, 0 } /* These must be last in the array */
86};
87
88struct resource xram_resources[] = {
89 /* To be updated with external devices */
90};
91
92struct resource rom_resources[] = {
93 /* To be updated with external devices */
94};
95
96struct sh64_platform platform_parms = {
97 .readonly_rootfs = 1,
98 .initial_root_dev = 0x0100,
99 .loader_type = 1,
100 .io_res_p = io_resources,
101 .io_res_count = RES_COUNT(io_resources),
102 .kram_res_p = kram_resources,
103 .kram_res_count = RES_COUNT(kram_resources),
104 .xram_res_p = xram_resources,
105 .xram_res_count = RES_COUNT(xram_resources),
106 .rom_res_p = rom_resources,
107 .rom_res_count = RES_COUNT(rom_resources),
108};
109
110int platform_int_priority[NR_INTC_IRQS] = {
111 IR0, IR1, IR2, IR3, PCA, PCB, PCC, PCD, /* IRQ 0- 7 */
112 RES, RES, RES, RES, SER, ERR, PW3, PW2, /* IRQ 8-15 */
113 PW1, PW0, DM0, DM1, DM2, DM3, DAE, RES, /* IRQ 16-23 */
114 RES, RES, RES, RES, RES, RES, RES, RES, /* IRQ 24-31 */
115 TU0, TU1, TU2, TI2, ATI, PRI, CUI, ERI, /* IRQ 32-39 */
116 RXI, BRI, TXI, RES, RES, RES, RES, RES, /* IRQ 40-47 */
117 RES, RES, RES, RES, RES, RES, RES, RES, /* IRQ 48-55 */
118 RES, RES, RES, RES, RES, RES, RES, ITI, /* IRQ 56-63 */
119};
120
121void __init platform_setup(void)
122{
123 /* ROM/RAM platform leaves the decision to head.S, for now */
124 platform_parms.fpu_flags = fpu_in_use;
125}
126
127void __init platform_monitor(void)
128{
129 /* Nothing yet .. */
130}
131
132void __init platform_reserve(void)
133{
134 /* Nothing yet .. */
135}
136
137const char *get_system_type(void)
138{
139 return "ROM/RAM";
140}
141
diff --git a/arch/sh64/mach-sim/Makefile b/arch/sh64/mach-sim/Makefile
index 819c4078fdc6..2f2963fa2131 100644
--- a/arch/sh64/mach-sim/Makefile
+++ b/arch/sh64/mach-sim/Makefile
@@ -1,14 +1 @@
1#
2# Makefile for the SH-5 Simulator specific parts of the kernel
3#
4# Note! Dependencies are done automagically by 'make dep', which also
5# removes any old dependencies. DON'T put your own dependencies here
6# unless it's something special (ie not a .c file).
7#
8
9O_TARGET := sim.o
10
11obj-y := setup.o obj-y := setup.o
12
13include $(TOPDIR)/Rules.make
14
diff --git a/arch/sh64/mach-sim/setup.c b/arch/sh64/mach-sim/setup.c
index f09400c1ad1b..e3386ec1ce1f 100644
--- a/arch/sh64/mach-sim/setup.c
+++ b/arch/sh64/mach-sim/setup.c
@@ -14,46 +14,10 @@
14 * lethal@linux-sh.org: 15th May 2003 14 * lethal@linux-sh.org: 15th May 2003
15 * Use the generic procfs cpuinfo interface, just return a valid board name. 15 * Use the generic procfs cpuinfo interface, just return a valid board name.
16 */ 16 */
17
18#include <linux/stddef.h>
19#include <linux/init.h> 17#include <linux/init.h>
20#include <linux/mm.h>
21#include <linux/bootmem.h>
22#include <linux/delay.h>
23#include <linux/kernel.h> 18#include <linux/kernel.h>
24#include <asm/addrspace.h>
25#include <asm/processor.h>
26#include <asm/platform.h> 19#include <asm/platform.h>
27#include <asm/io.h>
28#include <asm/irq.h> 20#include <asm/irq.h>
29#include <asm/page.h>
30
31#ifdef CONFIG_BLK_DEV_INITRD
32#include "../rootfs/rootfs.h"
33#endif
34
35static __init void platform_monitor(void);
36static __init void platform_setup(void);
37static __init void platform_reserve(void);
38
39
40#define PHYS_MEMORY CONFIG_MEMORY_SIZE_IN_MB*1024*1024
41
42#if (PHYS_MEMORY < P1SEG_FOOTPRINT_RAM)
43#error "Invalid kernel configuration. Physical memory below footprint requirements."
44#endif
45
46#define RAM_DISK_START CONFIG_MEMORY_START+P1SEG_INITRD_BLOCK /* Top of 4MB */
47#ifdef PLATFORM_ROMFS_SIZE
48#define RAM_DISK_SIZE (PAGE_ALIGN(PLATFORM_ROMFS_SIZE)) /* Variable Top */
49#if ((RAM_DISK_START + RAM_DISK_SIZE) > (CONFIG_MEMORY_START + PHYS_MEMORY))
50#error "Invalid kernel configuration. ROM RootFS exceeding physical memory."
51#endif
52#else
53#define RAM_DISK_SIZE P1SEG_INITRD_BLOCK_SIZE /* Top of 4MB */
54#endif
55
56#define RES_COUNT(res) ((sizeof((res))/sizeof(struct resource)))
57 21
58/* 22/*
59 * Platform Dependent Interrupt Priorities. 23 * Platform Dependent Interrupt Priorities.
@@ -101,8 +65,10 @@ struct resource io_resources[] = {
101}; 65};
102 66
103struct resource kram_resources[] = { 67struct resource kram_resources[] = {
104 { "Kernel code", 0, 0 }, /* These must be last in the array */ 68 /* These must be last in the array */
105 { "Kernel data", 0, 0 } /* These must be last in the array */ 69 { .name = "Kernel code", .start = 0, .end = 0 },
70 /* These must be last in the array */
71 { .name = "Kernel data", .start = 0, .end = 0 }
106}; 72};
107 73
108struct resource xram_resources[] = { 74struct resource xram_resources[] = {
@@ -117,16 +83,14 @@ struct sh64_platform platform_parms = {
117 .readonly_rootfs = 1, 83 .readonly_rootfs = 1,
118 .initial_root_dev = 0x0100, 84 .initial_root_dev = 0x0100,
119 .loader_type = 1, 85 .loader_type = 1,
120 .initrd_start = RAM_DISK_START,
121 .initrd_size = RAM_DISK_SIZE,
122 .io_res_p = io_resources, 86 .io_res_p = io_resources,
123 .io_res_count = RES_COUNT(io_resources), 87 .io_res_count = ARRAY_SIZE(io_resources),
124 .kram_res_p = kram_resources, 88 .kram_res_p = kram_resources,
125 .kram_res_count = RES_COUNT(kram_resources), 89 .kram_res_count = ARRAY_SIZE(kram_resources),
126 .xram_res_p = xram_resources, 90 .xram_res_p = xram_resources,
127 .xram_res_count = RES_COUNT(xram_resources), 91 .xram_res_count = ARRAY_SIZE(xram_resources),
128 .rom_res_p = rom_resources, 92 .rom_res_p = rom_resources,
129 .rom_res_count = RES_COUNT(rom_resources), 93 .rom_res_count = ARRAY_SIZE(rom_resources),
130}; 94};
131 95
132int platform_int_priority[NR_IRQS] = { 96int platform_int_priority[NR_IRQS] = {
@@ -160,4 +124,3 @@ const char *get_system_type(void)
160{ 124{
161 return "SH-5 Simulator"; 125 return "SH-5 Simulator";
162} 126}
163
diff --git a/arch/sh64/mm/Makefile b/arch/sh64/mm/Makefile
index ff19378ac90a..d0e813632480 100644
--- a/arch/sh64/mm/Makefile
+++ b/arch/sh64/mm/Makefile
@@ -13,7 +13,8 @@
13# unless it's something special (ie not a .c file). 13# unless it's something special (ie not a .c file).
14# 14#
15 15
16obj-y := init.o fault.o ioremap.o extable.o cache.o tlbmiss.o tlb.o 16obj-y := cache.o consistent.o extable.o fault.o init.o ioremap.o \
17 tlbmiss.o tlb.o
17 18
18obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o 19obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
19 20
@@ -41,4 +42,3 @@ CFLAGS_tlbmiss.o += -ffixed-r7 \
41 -ffixed-r41 -ffixed-r42 -ffixed-r43 \ 42 -ffixed-r41 -ffixed-r42 -ffixed-r43 \
42 -ffixed-r60 -ffixed-r61 -ffixed-r62 \ 43 -ffixed-r60 -ffixed-r61 -ffixed-r62 \
43 -fomit-frame-pointer 44 -fomit-frame-pointer
44
diff --git a/arch/sh64/kernel/pci-dma.c b/arch/sh64/mm/consistent.c
index a9328f894755..8875a2a40da7 100644
--- a/arch/sh64/kernel/pci-dma.c
+++ b/arch/sh64/mm/consistent.c
@@ -11,6 +11,7 @@
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/string.h> 12#include <linux/string.h>
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <linux/module.h>
14#include <asm/io.h> 15#include <asm/io.h>
15 16
16void *consistent_alloc(struct pci_dev *hwdev, size_t size, 17void *consistent_alloc(struct pci_dev *hwdev, size_t size,
@@ -36,6 +37,7 @@ void *consistent_alloc(struct pci_dev *hwdev, size_t size,
36 37
37 return vp; 38 return vp;
38} 39}
40EXPORT_SYMBOL(consistent_alloc);
39 41
40void consistent_free(struct pci_dev *hwdev, size_t size, 42void consistent_free(struct pci_dev *hwdev, size_t size,
41 void *vaddr, dma_addr_t dma_handle) 43 void *vaddr, dma_addr_t dma_handle)
@@ -47,4 +49,4 @@ void consistent_free(struct pci_dev *hwdev, size_t size,
47 49
48 iounmap(vaddr); 50 iounmap(vaddr);
49} 51}
50 52EXPORT_SYMBOL(consistent_free);
diff --git a/arch/sh64/mm/fault.c b/arch/sh64/mm/fault.c
index 0d069d82141f..dd81c669c79b 100644
--- a/arch/sh64/mm/fault.c
+++ b/arch/sh64/mm/fault.c
@@ -334,7 +334,7 @@ out_of_memory:
334 } 334 }
335 printk("VM: killing process %s\n", tsk->comm); 335 printk("VM: killing process %s\n", tsk->comm);
336 if (user_mode(regs)) 336 if (user_mode(regs))
337 do_exit(SIGKILL); 337 do_group_exit(SIGKILL);
338 goto no_context; 338 goto no_context;
339 339
340do_sigbus: 340do_sigbus:
diff --git a/arch/sh64/mm/init.c b/arch/sh64/mm/init.c
index 559717f30d1f..21cf42de23e2 100644
--- a/arch/sh64/mm/init.c
+++ b/arch/sh64/mm/init.c
@@ -22,10 +22,6 @@
22#include <asm/pgtable.h> 22#include <asm/pgtable.h>
23#include <asm/tlb.h> 23#include <asm/tlb.h>
24 24
25#ifdef CONFIG_BLK_DEV_INITRD
26#include <linux/blk.h>
27#endif
28
29DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 25DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
30 26
31/* 27/*
diff --git a/arch/sh64/mm/ioremap.c b/arch/sh64/mm/ioremap.c
index 990857756d44..535304e6601f 100644
--- a/arch/sh64/mm/ioremap.c
+++ b/arch/sh64/mm/ioremap.c
@@ -19,11 +19,12 @@
19#include <linux/sched.h> 19#include <linux/sched.h>
20#include <linux/string.h> 20#include <linux/string.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <asm/pgalloc.h>
23#include <asm/tlbflush.h>
24#include <linux/ioport.h> 22#include <linux/ioport.h>
25#include <linux/bootmem.h> 23#include <linux/bootmem.h>
26#include <linux/proc_fs.h> 24#include <linux/proc_fs.h>
25#include <linux/module.h>
26#include <asm/pgalloc.h>
27#include <asm/tlbflush.h>
27 28
28static void shmedia_mapioaddr(unsigned long, unsigned long); 29static void shmedia_mapioaddr(unsigned long, unsigned long);
29static unsigned long shmedia_ioremap(struct resource *, u32, int); 30static unsigned long shmedia_ioremap(struct resource *, u32, int);
@@ -80,6 +81,7 @@ void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flag
80 } 81 }
81 return (void *) (offset + (char *)addr); 82 return (void *) (offset + (char *)addr);
82} 83}
84EXPORT_SYMBOL(__ioremap);
83 85
84void iounmap(void *addr) 86void iounmap(void *addr)
85{ 87{
@@ -94,6 +96,7 @@ void iounmap(void *addr)
94 96
95 kfree(area); 97 kfree(area);
96} 98}
99EXPORT_SYMBOL(iounmap);
97 100
98static struct resource shmedia_iomap = { 101static struct resource shmedia_iomap = {
99 .name = "shmedia_iomap", 102 .name = "shmedia_iomap",
diff --git a/arch/sparc/Kconfig.debug b/arch/sparc/Kconfig.debug
index 120f6b529348..87dd496f15eb 100644
--- a/arch/sparc/Kconfig.debug
+++ b/arch/sparc/Kconfig.debug
@@ -1,5 +1,9 @@
1menu "Kernel hacking" 1menu "Kernel hacking"
2 2
3config TRACE_IRQFLAGS_SUPPORT
4 bool
5 default y
6
3source "lib/Kconfig.debug" 7source "lib/Kconfig.debug"
4 8
5config DEBUG_STACK_USAGE 9config DEBUG_STACK_USAGE
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 62182d2d7b0d..9c3ed88853f3 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -35,6 +35,7 @@
35#include <linux/slab.h> 35#include <linux/slab.h>
36#include <linux/pci.h> /* struct pci_dev */ 36#include <linux/pci.h> /* struct pci_dev */
37#include <linux/proc_fs.h> 37#include <linux/proc_fs.h>
38#include <linux/scatterlist.h>
38 39
39#include <asm/io.h> 40#include <asm/io.h>
40#include <asm/vaddrs.h> 41#include <asm/vaddrs.h>
@@ -717,19 +718,19 @@ void pci_unmap_page(struct pci_dev *hwdev,
717 * Device ownership issues as mentioned above for pci_map_single are 718 * Device ownership issues as mentioned above for pci_map_single are
718 * the same here. 719 * the same here.
719 */ 720 */
720int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, 721int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sgl, int nents,
721 int direction) 722 int direction)
722{ 723{
724 struct scatterlist *sg;
723 int n; 725 int n;
724 726
725 BUG_ON(direction == PCI_DMA_NONE); 727 BUG_ON(direction == PCI_DMA_NONE);
726 /* IIep is write-through, not flushing. */ 728 /* IIep is write-through, not flushing. */
727 for (n = 0; n < nents; n++) { 729 for_each_sg(sgl, sg, nents, n) {
728 BUG_ON(page_address(sg->page) == NULL); 730 BUG_ON(page_address(sg->page) == NULL);
729 sg->dvma_address = 731 sg->dvma_address =
730 virt_to_phys(page_address(sg->page)) + sg->offset; 732 virt_to_phys(page_address(sg->page)) + sg->offset;
731 sg->dvma_length = sg->length; 733 sg->dvma_length = sg->length;
732 sg++;
733 } 734 }
734 return nents; 735 return nents;
735} 736}
@@ -738,19 +739,19 @@ int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents,
738 * Again, cpu read rules concerning calls here are the same as for 739 * Again, cpu read rules concerning calls here are the same as for
739 * pci_unmap_single() above. 740 * pci_unmap_single() above.
740 */ 741 */
741void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, 742void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sgl, int nents,
742 int direction) 743 int direction)
743{ 744{
745 struct scatterlist *sg;
744 int n; 746 int n;
745 747
746 BUG_ON(direction == PCI_DMA_NONE); 748 BUG_ON(direction == PCI_DMA_NONE);
747 if (direction != PCI_DMA_TODEVICE) { 749 if (direction != PCI_DMA_TODEVICE) {
748 for (n = 0; n < nents; n++) { 750 for_each_sg(sgl, sg, nents, n) {
749 BUG_ON(page_address(sg->page) == NULL); 751 BUG_ON(page_address(sg->page) == NULL);
750 mmu_inval_dma_area( 752 mmu_inval_dma_area(
751 (unsigned long) page_address(sg->page), 753 (unsigned long) page_address(sg->page),
752 (sg->length + PAGE_SIZE-1) & PAGE_MASK); 754 (sg->length + PAGE_SIZE-1) & PAGE_MASK);
753 sg++;
754 } 755 }
755 } 756 }
756} 757}
@@ -789,34 +790,34 @@ void pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t ba, size_t
789 * The same as pci_dma_sync_single_* but for a scatter-gather list, 790 * The same as pci_dma_sync_single_* but for a scatter-gather list,
790 * same rules and usage. 791 * same rules and usage.
791 */ 792 */
792void pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction) 793void pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sgl, int nents, int direction)
793{ 794{
795 struct scatterlist *sg;
794 int n; 796 int n;
795 797
796 BUG_ON(direction == PCI_DMA_NONE); 798 BUG_ON(direction == PCI_DMA_NONE);
797 if (direction != PCI_DMA_TODEVICE) { 799 if (direction != PCI_DMA_TODEVICE) {
798 for (n = 0; n < nents; n++) { 800 for_each_sg(sgl, sg, nents, n) {
799 BUG_ON(page_address(sg->page) == NULL); 801 BUG_ON(page_address(sg->page) == NULL);
800 mmu_inval_dma_area( 802 mmu_inval_dma_area(
801 (unsigned long) page_address(sg->page), 803 (unsigned long) page_address(sg->page),
802 (sg->length + PAGE_SIZE-1) & PAGE_MASK); 804 (sg->length + PAGE_SIZE-1) & PAGE_MASK);
803 sg++;
804 } 805 }
805 } 806 }
806} 807}
807 808
808void pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction) 809void pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sgl, int nents, int direction)
809{ 810{
811 struct scatterlist *sg;
810 int n; 812 int n;
811 813
812 BUG_ON(direction == PCI_DMA_NONE); 814 BUG_ON(direction == PCI_DMA_NONE);
813 if (direction != PCI_DMA_TODEVICE) { 815 if (direction != PCI_DMA_TODEVICE) {
814 for (n = 0; n < nents; n++) { 816 for_each_sg(sgl, sg, nents, n) {
815 BUG_ON(page_address(sg->page) == NULL); 817 BUG_ON(page_address(sg->page) == NULL);
816 mmu_inval_dma_area( 818 mmu_inval_dma_area(
817 (unsigned long) page_address(sg->page), 819 (unsigned long) page_address(sg->page),
818 (sg->length + PAGE_SIZE-1) & PAGE_MASK); 820 (sg->length + PAGE_SIZE-1) & PAGE_MASK);
819 sg++;
820 } 821 }
821 } 822 }
822} 823}
diff --git a/arch/sparc/kernel/irq.c b/arch/sparc/kernel/irq.c
index b76dc03fc318..722d67d32961 100644
--- a/arch/sparc/kernel/irq.c
+++ b/arch/sparc/kernel/irq.c
@@ -56,7 +56,7 @@
56#define SMP_NOP2 56#define SMP_NOP2
57#define SMP_NOP3 57#define SMP_NOP3
58#endif /* SMP */ 58#endif /* SMP */
59unsigned long __local_irq_save(void) 59unsigned long __raw_local_irq_save(void)
60{ 60{
61 unsigned long retval; 61 unsigned long retval;
62 unsigned long tmp; 62 unsigned long tmp;
@@ -74,7 +74,7 @@ unsigned long __local_irq_save(void)
74 return retval; 74 return retval;
75} 75}
76 76
77void local_irq_enable(void) 77void raw_local_irq_enable(void)
78{ 78{
79 unsigned long tmp; 79 unsigned long tmp;
80 80
@@ -89,7 +89,7 @@ void local_irq_enable(void)
89 : "memory"); 89 : "memory");
90} 90}
91 91
92void local_irq_restore(unsigned long old_psr) 92void raw_local_irq_restore(unsigned long old_psr)
93{ 93{
94 unsigned long tmp; 94 unsigned long tmp;
95 95
@@ -105,9 +105,9 @@ void local_irq_restore(unsigned long old_psr)
105 : "memory"); 105 : "memory");
106} 106}
107 107
108EXPORT_SYMBOL(__local_irq_save); 108EXPORT_SYMBOL(__raw_local_irq_save);
109EXPORT_SYMBOL(local_irq_enable); 109EXPORT_SYMBOL(raw_local_irq_enable);
110EXPORT_SYMBOL(local_irq_restore); 110EXPORT_SYMBOL(raw_local_irq_restore);
111 111
112/* 112/*
113 * Dave Redman (djhr@tadpole.co.uk) 113 * Dave Redman (djhr@tadpole.co.uk)
diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c
index 36383f73d685..fb2caef79cec 100644
--- a/arch/sparc/kernel/of_device.c
+++ b/arch/sparc/kernel/of_device.c
@@ -588,7 +588,10 @@ __setup("of_debug=", of_debug);
588int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus) 588int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
589{ 589{
590 /* initialize common driver fields */ 590 /* initialize common driver fields */
591 drv->driver.name = drv->name; 591 if (!drv->driver.name)
592 drv->driver.name = drv->name;
593 if (!drv->driver.owner)
594 drv->driver.owner = drv->owner;
592 drv->driver.bus = bus; 595 drv->driver.bus = bus;
593 596
594 /* register with core */ 597 /* register with core */
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c
index 6a2513321620..4bf78a5e8e0f 100644
--- a/arch/sparc/kernel/time.c
+++ b/arch/sparc/kernel/time.c
@@ -347,9 +347,11 @@ static struct of_device_id clock_match[] = {
347}; 347};
348 348
349static struct of_platform_driver clock_driver = { 349static struct of_platform_driver clock_driver = {
350 .name = "clock",
351 .match_table = clock_match, 350 .match_table = clock_match,
352 .probe = clock_probe, 351 .probe = clock_probe,
352 .driver = {
353 .name = "clock",
354 },
353}; 355};
354 356
355 357
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index 15109c156e83..a8b4200f9cc3 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -1,6 +1,7 @@
1/* ld script to make SparcLinux kernel */ 1/* ld script to make SparcLinux kernel */
2 2
3#include <asm-generic/vmlinux.lds.h> 3#include <asm-generic/vmlinux.lds.h>
4#include <asm/page.h>
4 5
5OUTPUT_FORMAT("elf32-sparc", "elf32-sparc", "elf32-sparc") 6OUTPUT_FORMAT("elf32-sparc", "elf32-sparc", "elf32-sparc")
6OUTPUT_ARCH(sparc) 7OUTPUT_ARCH(sparc)
@@ -8,84 +9,104 @@ ENTRY(_start)
8jiffies = jiffies_64 + 4; 9jiffies = jiffies_64 + 4;
9SECTIONS 10SECTIONS
10{ 11{
11 . = 0x10000 + SIZEOF_HEADERS; 12 . = 0x10000 + SIZEOF_HEADERS;
12 .text 0xf0004000 : 13 .text 0xf0004000 :
13 { 14 {
14 _text = .; 15 _text = .;
15 TEXT_TEXT 16 TEXT_TEXT
16 SCHED_TEXT 17 SCHED_TEXT
17 LOCK_TEXT 18 LOCK_TEXT
18 *(.gnu.warning) 19 *(.gnu.warning)
19 } =0 20 } = 0
20 _etext = .; 21 _etext = .;
21 PROVIDE (etext = .); 22 PROVIDE (etext = .);
22 RODATA 23 RODATA
23 .data : 24 .data : {
24 { 25 DATA_DATA
25 DATA_DATA 26 CONSTRUCTORS
26 CONSTRUCTORS 27 }
27 } 28 .data1 : {
28 .data1 : { *(.data1) } 29 *(.data1)
29 _edata = .; 30 }
30 PROVIDE (edata = .); 31 _edata = .;
31 __start___fixup = .; 32 PROVIDE (edata = .);
32 .fixup : { *(.fixup) }
33 __stop___fixup = .;
34 __start___ex_table = .;
35 __ex_table : { *(__ex_table) }
36 __stop___ex_table = .;
37 33
38 NOTES 34 .fixup : {
35 __start___fixup = .;
36 *(.fixup)
37 __stop___fixup = .;
38 }
39 __ex_table : {
40 __start___ex_table = .;
41 *(__ex_table)
42 __stop___ex_table = .;
43 }
39 44
40 . = ALIGN(4096); 45 NOTES
41 __init_begin = .; 46
42 _sinittext = .; 47 . = ALIGN(PAGE_SIZE);
43 .init.text : { 48 __init_begin = .;
44 *(.init.text) 49 .init.text : {
45 } 50 _sinittext = .;
46 _einittext = .; 51 *(.init.text)
47 __init_text_end = .; 52 _einittext = .;
48 .init.data : { *(.init.data) } 53 }
49 . = ALIGN(16); 54 __init_text_end = .;
50 __setup_start = .; 55 .init.data : {
51 .init.setup : { *(.init.setup) } 56 *(.init.data)
52 __setup_end = .; 57 }
53 __initcall_start = .; 58 . = ALIGN(16);
54 .initcall.init : { 59 .init.setup : {
55 INITCALLS 60 __setup_start = .;
56 } 61 *(.init.setup)
57 __initcall_end = .; 62 __setup_end = .;
58 __con_initcall_start = .; 63 }
59 .con_initcall.init : { *(.con_initcall.init) } 64 .initcall.init : {
60 __con_initcall_end = .; 65 __initcall_start = .;
61 SECURITY_INIT 66 INITCALLS
67 __initcall_end = .;
68 }
69 .con_initcall.init : {
70 __con_initcall_start = .;
71 *(.con_initcall.init)
72 __con_initcall_end = .;
73 }
74 SECURITY_INIT
62 75
63#ifdef CONFIG_BLK_DEV_INITRD 76#ifdef CONFIG_BLK_DEV_INITRD
64 . = ALIGN(4096); 77 . = ALIGN(PAGE_SIZE);
65 __initramfs_start = .; 78 .init.ramfs : {
66 .init.ramfs : { *(.init.ramfs) } 79 __initramfs_start = .;
67 __initramfs_end = .; 80 *(.init.ramfs)
81 __initramfs_end = .;
82 }
68#endif 83#endif
69 84
70 PERCPU(4096) 85 PERCPU(PAGE_SIZE)
71 . = ALIGN(4096); 86 . = ALIGN(PAGE_SIZE);
72 __init_end = .; 87 __init_end = .;
73 . = ALIGN(32); 88 . = ALIGN(32);
74 .data.cacheline_aligned : { *(.data.cacheline_aligned) } 89 .data.cacheline_aligned : {
75 90 *(.data.cacheline_aligned)
76 __bss_start = .; 91 }
77 .sbss : { *(.sbss) *(.scommon) }
78 .bss :
79 {
80 *(.dynbss)
81 *(.bss)
82 *(COMMON)
83 }
84 _end = . ;
85 PROVIDE (end = .);
86 /DISCARD/ : { *(.exit.text) *(.exit.data) *(.exitcall.exit) }
87 92
88 STABS_DEBUG 93 __bss_start = .;
94 .sbss : {
95 *(.sbss)
96 *(.scommon) }
97 .bss : {
98 *(.dynbss)
99 *(.bss)
100 *(COMMON)
101 }
102 _end = . ;
103 PROVIDE (end = .);
104 /DISCARD/ : {
105 *(.exit.text)
106 *(.exit.data)
107 *(.exitcall.exit)
108 }
89 109
90 DWARF_DEBUG 110 STABS_DEBUG
111 DWARF_DEBUG
91} 112}
diff --git a/arch/sparc/mm/fault.c b/arch/sparc/mm/fault.c
index 50747fe44356..e4d9c8e19df5 100644
--- a/arch/sparc/mm/fault.c
+++ b/arch/sparc/mm/fault.c
@@ -369,7 +369,7 @@ out_of_memory:
369 up_read(&mm->mmap_sem); 369 up_read(&mm->mmap_sem);
370 printk("VM: killing process %s\n", tsk->comm); 370 printk("VM: killing process %s\n", tsk->comm);
371 if (from_user) 371 if (from_user)
372 do_exit(SIGKILL); 372 do_group_exit(SIGKILL);
373 goto no_context; 373 goto no_context;
374 374
375do_sigbus: 375do_sigbus:
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c
index 7c89893b1fe8..375b4db63704 100644
--- a/arch/sparc/mm/io-unit.c
+++ b/arch/sparc/mm/io-unit.c
@@ -11,8 +11,8 @@
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/highmem.h> /* pte_offset_map => kmap_atomic */ 12#include <linux/highmem.h> /* pte_offset_map => kmap_atomic */
13#include <linux/bitops.h> 13#include <linux/bitops.h>
14#include <linux/scatterlist.h>
14 15
15#include <asm/scatterlist.h>
16#include <asm/pgalloc.h> 16#include <asm/pgalloc.h>
17#include <asm/pgtable.h> 17#include <asm/pgtable.h>
18#include <asm/sbus.h> 18#include <asm/sbus.h>
@@ -144,8 +144,9 @@ static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus
144 spin_lock_irqsave(&iounit->lock, flags); 144 spin_lock_irqsave(&iounit->lock, flags);
145 while (sz != 0) { 145 while (sz != 0) {
146 --sz; 146 --sz;
147 sg[sz].dvma_address = iounit_get_area(iounit, (unsigned long)page_address(sg[sz].page) + sg[sz].offset, sg[sz].length); 147 sg->dvma_address = iounit_get_area(iounit, (unsigned long)page_address(sg->page) + sg->offset, sg->length);
148 sg[sz].dvma_length = sg[sz].length; 148 sg->dvma_length = sg->length;
149 sg = sg_next(sg);
149 } 150 }
150 spin_unlock_irqrestore(&iounit->lock, flags); 151 spin_unlock_irqrestore(&iounit->lock, flags);
151} 152}
@@ -173,11 +174,12 @@ static void iounit_release_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_
173 spin_lock_irqsave(&iounit->lock, flags); 174 spin_lock_irqsave(&iounit->lock, flags);
174 while (sz != 0) { 175 while (sz != 0) {
175 --sz; 176 --sz;
176 len = ((sg[sz].dvma_address & ~PAGE_MASK) + sg[sz].length + (PAGE_SIZE-1)) >> PAGE_SHIFT; 177 len = ((sg->dvma_address & ~PAGE_MASK) + sg->length + (PAGE_SIZE-1)) >> PAGE_SHIFT;
177 vaddr = (sg[sz].dvma_address - IOUNIT_DMA_BASE) >> PAGE_SHIFT; 178 vaddr = (sg->dvma_address - IOUNIT_DMA_BASE) >> PAGE_SHIFT;
178 IOD(("iounit_release %08lx-%08lx\n", (long)vaddr, (long)len+vaddr)); 179 IOD(("iounit_release %08lx-%08lx\n", (long)vaddr, (long)len+vaddr));
179 for (len += vaddr; vaddr < len; vaddr++) 180 for (len += vaddr; vaddr < len; vaddr++)
180 clear_bit(vaddr, iounit->bmap); 181 clear_bit(vaddr, iounit->bmap);
182 sg = sg_next(sg);
181 } 183 }
182 spin_unlock_irqrestore(&iounit->lock, flags); 184 spin_unlock_irqrestore(&iounit->lock, flags);
183} 185}
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c
index 52e907af9d29..283656d9f6ea 100644
--- a/arch/sparc/mm/iommu.c
+++ b/arch/sparc/mm/iommu.c
@@ -12,8 +12,8 @@
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/highmem.h> /* pte_offset_map => kmap_atomic */ 14#include <linux/highmem.h> /* pte_offset_map => kmap_atomic */
15#include <linux/scatterlist.h>
15 16
16#include <asm/scatterlist.h>
17#include <asm/pgalloc.h> 17#include <asm/pgalloc.h>
18#include <asm/pgtable.h> 18#include <asm/pgtable.h>
19#include <asm/sbus.h> 19#include <asm/sbus.h>
@@ -240,7 +240,7 @@ static void iommu_get_scsi_sgl_noflush(struct scatterlist *sg, int sz, struct sb
240 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT; 240 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT;
241 sg->dvma_address = iommu_get_one(sg->page, n, sbus) + sg->offset; 241 sg->dvma_address = iommu_get_one(sg->page, n, sbus) + sg->offset;
242 sg->dvma_length = (__u32) sg->length; 242 sg->dvma_length = (__u32) sg->length;
243 sg++; 243 sg = sg_next(sg);
244 } 244 }
245} 245}
246 246
@@ -254,7 +254,7 @@ static void iommu_get_scsi_sgl_gflush(struct scatterlist *sg, int sz, struct sbu
254 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT; 254 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT;
255 sg->dvma_address = iommu_get_one(sg->page, n, sbus) + sg->offset; 255 sg->dvma_address = iommu_get_one(sg->page, n, sbus) + sg->offset;
256 sg->dvma_length = (__u32) sg->length; 256 sg->dvma_length = (__u32) sg->length;
257 sg++; 257 sg = sg_next(sg);
258 } 258 }
259} 259}
260 260
@@ -285,7 +285,7 @@ static void iommu_get_scsi_sgl_pflush(struct scatterlist *sg, int sz, struct sbu
285 285
286 sg->dvma_address = iommu_get_one(sg->page, n, sbus) + sg->offset; 286 sg->dvma_address = iommu_get_one(sg->page, n, sbus) + sg->offset;
287 sg->dvma_length = (__u32) sg->length; 287 sg->dvma_length = (__u32) sg->length;
288 sg++; 288 sg = sg_next(sg);
289 } 289 }
290} 290}
291 291
@@ -325,7 +325,7 @@ static void iommu_release_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_b
325 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT; 325 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT;
326 iommu_release_one(sg->dvma_address & PAGE_MASK, n, sbus); 326 iommu_release_one(sg->dvma_address & PAGE_MASK, n, sbus);
327 sg->dvma_address = 0x21212121; 327 sg->dvma_address = 0x21212121;
328 sg++; 328 sg = sg_next(sg);
329 } 329 }
330} 330}
331 331
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
index 005a3e72d4f2..ee6708fc4492 100644
--- a/arch/sparc/mm/sun4c.c
+++ b/arch/sparc/mm/sun4c.c
@@ -17,8 +17,8 @@
17#include <linux/highmem.h> 17#include <linux/highmem.h>
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/seq_file.h> 19#include <linux/seq_file.h>
20#include <linux/scatterlist.h>
20 21
21#include <asm/scatterlist.h>
22#include <asm/page.h> 22#include <asm/page.h>
23#include <asm/pgalloc.h> 23#include <asm/pgalloc.h>
24#include <asm/pgtable.h> 24#include <asm/pgtable.h>
@@ -1228,8 +1228,9 @@ static void sun4c_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus *
1228{ 1228{
1229 while (sz != 0) { 1229 while (sz != 0) {
1230 --sz; 1230 --sz;
1231 sg[sz].dvma_address = (__u32)sun4c_lockarea(page_address(sg[sz].page) + sg[sz].offset, sg[sz].length); 1231 sg->dvma_address = (__u32)sun4c_lockarea(page_address(sg->page) + sg->offset, sg->length);
1232 sg[sz].dvma_length = sg[sz].length; 1232 sg->dvma_length = sg->length;
1233 sg = sg_next(sg);
1233 } 1234 }
1234} 1235}
1235 1236
@@ -1244,7 +1245,8 @@ static void sun4c_release_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_b
1244{ 1245{
1245 while (sz != 0) { 1246 while (sz != 0) {
1246 --sz; 1247 --sz;
1247 sun4c_unlockarea((char *)sg[sz].dvma_address, sg[sz].length); 1248 sun4c_unlockarea((char *)sg->dvma_address, sg->length);
1249 sg = sg_next(sg);
1248 } 1250 }
1249} 1251}
1250 1252
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index 33dabf588bdd..2f22fa90461a 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -240,10 +240,10 @@ config ARCH_SELECT_MEMORY_MODEL
240 240
241config ARCH_SPARSEMEM_ENABLE 241config ARCH_SPARSEMEM_ENABLE
242 def_bool y 242 def_bool y
243 select SPARSEMEM_VMEMMAP_ENABLE
243 244
244config ARCH_SPARSEMEM_DEFAULT 245config ARCH_SPARSEMEM_DEFAULT
245 def_bool y 246 def_bool y
246 select SPARSEMEM_STATIC
247 247
248source "mm/Kconfig" 248source "mm/Kconfig"
249 249
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index 7d07297db878..1aa2c4048e4b 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23-rc6 3# Linux kernel version: 2.6.23
4# Sun Sep 16 09:52:11 2007 4# Sat Oct 13 21:53:54 2007
5# 5#
6CONFIG_SPARC=y 6CONFIG_SPARC=y
7CONFIG_SPARC64=y 7CONFIG_SPARC64=y
@@ -69,7 +69,6 @@ CONFIG_FUTEX=y
69CONFIG_ANON_INODES=y 69CONFIG_ANON_INODES=y
70CONFIG_EPOLL=y 70CONFIG_EPOLL=y
71CONFIG_SIGNALFD=y 71CONFIG_SIGNALFD=y
72CONFIG_TIMERFD=y
73CONFIG_EVENTFD=y 72CONFIG_EVENTFD=y
74CONFIG_SHMEM=y 73CONFIG_SHMEM=y
75CONFIG_VM_EVENT_COUNTERS=y 74CONFIG_VM_EVENT_COUNTERS=y
@@ -89,6 +88,7 @@ CONFIG_KMOD=y
89CONFIG_BLOCK=y 88CONFIG_BLOCK=y
90CONFIG_BLK_DEV_IO_TRACE=y 89CONFIG_BLK_DEV_IO_TRACE=y
91CONFIG_BLK_DEV_BSG=y 90CONFIG_BLK_DEV_BSG=y
91CONFIG_BLOCK_COMPAT=y
92 92
93# 93#
94# IO Schedulers 94# IO Schedulers
@@ -111,6 +111,7 @@ CONFIG_GENERIC_HARDIRQS=y
111CONFIG_TICK_ONESHOT=y 111CONFIG_TICK_ONESHOT=y
112CONFIG_NO_HZ=y 112CONFIG_NO_HZ=y
113CONFIG_HIGH_RES_TIMERS=y 113CONFIG_HIGH_RES_TIMERS=y
114CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
114# CONFIG_SMP is not set 115# CONFIG_SMP is not set
115CONFIG_CPU_FREQ=y 116CONFIG_CPU_FREQ=y
116CONFIG_CPU_FREQ_TABLE=m 117CONFIG_CPU_FREQ_TABLE=m
@@ -119,6 +120,8 @@ CONFIG_CPU_FREQ_STAT=m
119CONFIG_CPU_FREQ_STAT_DETAILS=y 120CONFIG_CPU_FREQ_STAT_DETAILS=y
120CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y 121CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
121# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set 122# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
123# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
124# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
122CONFIG_CPU_FREQ_GOV_PERFORMANCE=y 125CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
123CONFIG_CPU_FREQ_GOV_POWERSAVE=m 126CONFIG_CPU_FREQ_GOV_POWERSAVE=m
124CONFIG_CPU_FREQ_GOV_USERSPACE=m 127CONFIG_CPU_FREQ_GOV_USERSPACE=m
@@ -213,6 +216,7 @@ CONFIG_INET_TUNNEL=y
213CONFIG_INET_XFRM_MODE_TRANSPORT=y 216CONFIG_INET_XFRM_MODE_TRANSPORT=y
214CONFIG_INET_XFRM_MODE_TUNNEL=y 217CONFIG_INET_XFRM_MODE_TUNNEL=y
215CONFIG_INET_XFRM_MODE_BEET=y 218CONFIG_INET_XFRM_MODE_BEET=y
219CONFIG_INET_LRO=y
216CONFIG_INET_DIAG=y 220CONFIG_INET_DIAG=y
217CONFIG_INET_TCP_DIAG=y 221CONFIG_INET_TCP_DIAG=y
218# CONFIG_TCP_CONG_ADVANCED is not set 222# CONFIG_TCP_CONG_ADVANCED is not set
@@ -304,6 +308,7 @@ CONFIG_NET_TCPPROBE=m
304# 308#
305# Generic Driver Options 309# Generic Driver Options
306# 310#
311CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
307CONFIG_STANDALONE=y 312CONFIG_STANDALONE=y
308# CONFIG_PREVENT_FIRMWARE_BUILD is not set 313# CONFIG_PREVENT_FIRMWARE_BUILD is not set
309CONFIG_FW_LOADER=y 314CONFIG_FW_LOADER=y
@@ -355,6 +360,11 @@ CONFIG_IDE_PROC_FS=y
355# IDE chipset support/bugfixes 360# IDE chipset support/bugfixes
356# 361#
357CONFIG_IDE_GENERIC=y 362CONFIG_IDE_GENERIC=y
363# CONFIG_BLK_DEV_PLATFORM is not set
364
365#
366# PCI IDE chipsets support
367#
358CONFIG_BLK_DEV_IDEPCI=y 368CONFIG_BLK_DEV_IDEPCI=y
359# CONFIG_IDEPCI_SHARE_IRQ is not set 369# CONFIG_IDEPCI_SHARE_IRQ is not set
360CONFIG_IDEPCI_PCIBUS_ORDER=y 370CONFIG_IDEPCI_PCIBUS_ORDER=y
@@ -391,7 +401,6 @@ CONFIG_BLK_DEV_ALI15X3=y
391# CONFIG_BLK_DEV_TC86C001 is not set 401# CONFIG_BLK_DEV_TC86C001 is not set
392# CONFIG_IDE_ARM is not set 402# CONFIG_IDE_ARM is not set
393CONFIG_BLK_DEV_IDEDMA=y 403CONFIG_BLK_DEV_IDEDMA=y
394# CONFIG_IDEDMA_IVB is not set
395# CONFIG_BLK_DEV_HD is not set 404# CONFIG_BLK_DEV_HD is not set
396 405
397# 406#
@@ -505,6 +514,8 @@ CONFIG_DUMMY=m
505# CONFIG_MACVLAN is not set 514# CONFIG_MACVLAN is not set
506# CONFIG_EQUALIZER is not set 515# CONFIG_EQUALIZER is not set
507# CONFIG_TUN is not set 516# CONFIG_TUN is not set
517# CONFIG_VETH is not set
518# CONFIG_IP1000 is not set
508# CONFIG_ARCNET is not set 519# CONFIG_ARCNET is not set
509# CONFIG_PHYLIB is not set 520# CONFIG_PHYLIB is not set
510CONFIG_NET_ETHERNET=y 521CONFIG_NET_ETHERNET=y
@@ -518,13 +529,16 @@ CONFIG_CASSINI=m
518# CONFIG_NET_VENDOR_3COM is not set 529# CONFIG_NET_VENDOR_3COM is not set
519# CONFIG_NET_TULIP is not set 530# CONFIG_NET_TULIP is not set
520# CONFIG_HP100 is not set 531# CONFIG_HP100 is not set
532# CONFIG_IBM_NEW_EMAC_ZMII is not set
533# CONFIG_IBM_NEW_EMAC_RGMII is not set
534# CONFIG_IBM_NEW_EMAC_TAH is not set
535# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
521CONFIG_NET_PCI=y 536CONFIG_NET_PCI=y
522# CONFIG_PCNET32 is not set 537# CONFIG_PCNET32 is not set
523# CONFIG_AMD8111_ETH is not set 538# CONFIG_AMD8111_ETH is not set
524# CONFIG_ADAPTEC_STARFIRE is not set 539# CONFIG_ADAPTEC_STARFIRE is not set
525# CONFIG_B44 is not set 540# CONFIG_B44 is not set
526# CONFIG_FORCEDETH is not set 541# CONFIG_FORCEDETH is not set
527# CONFIG_DGRS is not set
528# CONFIG_EEPRO100 is not set 542# CONFIG_EEPRO100 is not set
529# CONFIG_E100 is not set 543# CONFIG_E100 is not set
530# CONFIG_FEALNX is not set 544# CONFIG_FEALNX is not set
@@ -543,6 +557,7 @@ CONFIG_NETDEV_1000=y
543CONFIG_E1000=m 557CONFIG_E1000=m
544CONFIG_E1000_NAPI=y 558CONFIG_E1000_NAPI=y
545# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set 559# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
560# CONFIG_E1000E is not set
546# CONFIG_MYRI_SBUS is not set 561# CONFIG_MYRI_SBUS is not set
547# CONFIG_NS83820 is not set 562# CONFIG_NS83820 is not set
548# CONFIG_HAMACHI is not set 563# CONFIG_HAMACHI is not set
@@ -560,11 +575,14 @@ CONFIG_BNX2=m
560CONFIG_NETDEV_10000=y 575CONFIG_NETDEV_10000=y
561# CONFIG_CHELSIO_T1 is not set 576# CONFIG_CHELSIO_T1 is not set
562# CONFIG_CHELSIO_T3 is not set 577# CONFIG_CHELSIO_T3 is not set
578# CONFIG_IXGBE is not set
563# CONFIG_IXGB is not set 579# CONFIG_IXGB is not set
564# CONFIG_S2IO is not set 580# CONFIG_S2IO is not set
565# CONFIG_MYRI10GE is not set 581# CONFIG_MYRI10GE is not set
566# CONFIG_NETXEN_NIC is not set 582# CONFIG_NETXEN_NIC is not set
583# CONFIG_NIU is not set
567# CONFIG_MLX4_CORE is not set 584# CONFIG_MLX4_CORE is not set
585# CONFIG_TEHUTI is not set
568# CONFIG_TR is not set 586# CONFIG_TR is not set
569 587
570# 588#
@@ -820,6 +838,12 @@ CONFIG_HWMON=y
820# CONFIG_HWMON_DEBUG_CHIP is not set 838# CONFIG_HWMON_DEBUG_CHIP is not set
821 839
822# 840#
841# Sonics Silicon Backplane
842#
843CONFIG_SSB_POSSIBLE=y
844# CONFIG_SSB is not set
845
846#
823# Multifunction device drivers 847# Multifunction device drivers
824# 848#
825# CONFIG_MFD_SM501 is not set 849# CONFIG_MFD_SM501 is not set
@@ -1399,6 +1423,7 @@ CONFIG_ASYNC_MEMCPY=m
1399CONFIG_ASYNC_XOR=m 1423CONFIG_ASYNC_XOR=m
1400CONFIG_CRYPTO=y 1424CONFIG_CRYPTO=y
1401CONFIG_CRYPTO_ALGAPI=y 1425CONFIG_CRYPTO_ALGAPI=y
1426CONFIG_CRYPTO_AEAD=m
1402CONFIG_CRYPTO_BLKCIPHER=y 1427CONFIG_CRYPTO_BLKCIPHER=y
1403CONFIG_CRYPTO_HASH=y 1428CONFIG_CRYPTO_HASH=y
1404CONFIG_CRYPTO_MANAGER=y 1429CONFIG_CRYPTO_MANAGER=y
@@ -1417,6 +1442,7 @@ CONFIG_CRYPTO_ECB=m
1417CONFIG_CRYPTO_CBC=y 1442CONFIG_CRYPTO_CBC=y
1418CONFIG_CRYPTO_PCBC=m 1443CONFIG_CRYPTO_PCBC=m
1419CONFIG_CRYPTO_LRW=m 1444CONFIG_CRYPTO_LRW=m
1445CONFIG_CRYPTO_XTS=m
1420# CONFIG_CRYPTO_CRYPTD is not set 1446# CONFIG_CRYPTO_CRYPTD is not set
1421CONFIG_CRYPTO_DES=y 1447CONFIG_CRYPTO_DES=y
1422CONFIG_CRYPTO_FCRYPT=m 1448CONFIG_CRYPTO_FCRYPT=m
@@ -1431,11 +1457,13 @@ CONFIG_CRYPTO_TEA=m
1431CONFIG_CRYPTO_ARC4=m 1457CONFIG_CRYPTO_ARC4=m
1432CONFIG_CRYPTO_KHAZAD=m 1458CONFIG_CRYPTO_KHAZAD=m
1433CONFIG_CRYPTO_ANUBIS=m 1459CONFIG_CRYPTO_ANUBIS=m
1460CONFIG_CRYPTO_SEED=m
1434CONFIG_CRYPTO_DEFLATE=y 1461CONFIG_CRYPTO_DEFLATE=y
1435CONFIG_CRYPTO_MICHAEL_MIC=m 1462CONFIG_CRYPTO_MICHAEL_MIC=m
1436CONFIG_CRYPTO_CRC32C=m 1463CONFIG_CRYPTO_CRC32C=m
1437CONFIG_CRYPTO_CAMELLIA=m 1464CONFIG_CRYPTO_CAMELLIA=m
1438CONFIG_CRYPTO_TEST=m 1465CONFIG_CRYPTO_TEST=m
1466CONFIG_CRYPTO_AUTHENC=m
1439CONFIG_CRYPTO_HW=y 1467CONFIG_CRYPTO_HW=y
1440 1468
1441# 1469#
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile
index 40d2f3aae91e..112c46e66578 100644
--- a/arch/sparc64/kernel/Makefile
+++ b/arch/sparc64/kernel/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_STACKTRACE) += stacktrace.o
18obj-$(CONFIG_PCI) += ebus.o isa.o pci_common.o \ 18obj-$(CONFIG_PCI) += ebus.o isa.o pci_common.o \
19 pci_psycho.o pci_sabre.o pci_schizo.o \ 19 pci_psycho.o pci_sabre.o pci_schizo.o \
20 pci_sun4v.o pci_sun4v_asm.o pci_fire.o 20 pci_sun4v.o pci_sun4v_asm.o pci_fire.o
21obj-$(CONFIG_PCI_MSI) += pci_msi.o
21obj-$(CONFIG_SMP) += smp.o trampoline.o hvtramp.o 22obj-$(CONFIG_SMP) += smp.o trampoline.o hvtramp.o
22obj-$(CONFIG_SPARC32_COMPAT) += sys32.o sys_sparc32.o signal32.o 23obj-$(CONFIG_SPARC32_COMPAT) += sys32.o sys_sparc32.o signal32.o
23obj-$(CONFIG_BINFMT_ELF32) += binfmt_elf32.o 24obj-$(CONFIG_BINFMT_ELF32) += binfmt_elf32.o
diff --git a/arch/sparc64/kernel/auxio.c b/arch/sparc64/kernel/auxio.c
index 7b379761e9f8..c55f0293eacd 100644
--- a/arch/sparc64/kernel/auxio.c
+++ b/arch/sparc64/kernel/auxio.c
@@ -148,9 +148,11 @@ static int __devinit auxio_probe(struct of_device *dev, const struct of_device_i
148} 148}
149 149
150static struct of_platform_driver auxio_driver = { 150static struct of_platform_driver auxio_driver = {
151 .name = "auxio",
152 .match_table = auxio_match, 151 .match_table = auxio_match,
153 .probe = auxio_probe, 152 .probe = auxio_probe,
153 .driver = {
154 .name = "auxio",
155 },
154}; 156};
155 157
156static int __init auxio_init(void) 158static int __init auxio_init(void)
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S
index 8059531bf0ac..c9b0d7af64ae 100644
--- a/arch/sparc64/kernel/entry.S
+++ b/arch/sparc64/kernel/entry.S
@@ -429,16 +429,16 @@ do_ivec:
429 stxa %g0, [%g0] ASI_INTR_RECEIVE 429 stxa %g0, [%g0] ASI_INTR_RECEIVE
430 membar #Sync 430 membar #Sync
431 431
432 sethi %hi(ivector_table), %g2 432 sethi %hi(ivector_table_pa), %g2
433 sllx %g3, 3, %g3 433 ldx [%g2 + %lo(ivector_table_pa)], %g2
434 or %g2, %lo(ivector_table), %g2 434 sllx %g3, 4, %g3
435 add %g2, %g3, %g3 435 add %g2, %g3, %g3
436 436
437 TRAP_LOAD_IRQ_WORK(%g6, %g1) 437 TRAP_LOAD_IRQ_WORK_PA(%g6, %g1)
438 438
439 lduw [%g6], %g5 /* g5 = irq_work(cpu) */ 439 ldx [%g6], %g5
440 stw %g5, [%g3 + 0x00] /* bucket->irq_chain = g5 */ 440 stxa %g5, [%g3] ASI_PHYS_USE_EC
441 stw %g3, [%g6] /* irq_work(cpu) = bucket */ 441 stx %g3, [%g6]
442 wr %g0, 1 << PIL_DEVICE_IRQ, %set_softint 442 wr %g0, 1 << PIL_DEVICE_IRQ, %set_softint
443 retry 443 retry
444do_ivec_xcall: 444do_ivec_xcall:
diff --git a/arch/sparc64/kernel/iommu.c b/arch/sparc64/kernel/iommu.c
index b35a62167e9c..db3ffcf7a120 100644
--- a/arch/sparc64/kernel/iommu.c
+++ b/arch/sparc64/kernel/iommu.c
@@ -10,6 +10,7 @@
10#include <linux/device.h> 10#include <linux/device.h>
11#include <linux/dma-mapping.h> 11#include <linux/dma-mapping.h>
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/scatterlist.h>
13 14
14#ifdef CONFIG_PCI 15#ifdef CONFIG_PCI
15#include <linux/pci.h> 16#include <linux/pci.h>
@@ -480,7 +481,7 @@ static inline void fill_sg(iopte_t *iopte, struct scatterlist *sg,
480 unsigned long iopte_protection) 481 unsigned long iopte_protection)
481{ 482{
482 struct scatterlist *dma_sg = sg; 483 struct scatterlist *dma_sg = sg;
483 struct scatterlist *sg_end = sg + nelems; 484 struct scatterlist *sg_end = sg_last(sg, nelems);
484 int i; 485 int i;
485 486
486 for (i = 0; i < nused; i++) { 487 for (i = 0; i < nused; i++) {
@@ -515,7 +516,7 @@ static inline void fill_sg(iopte_t *iopte, struct scatterlist *sg,
515 len -= (IO_PAGE_SIZE - (tmp & (IO_PAGE_SIZE - 1UL))); 516 len -= (IO_PAGE_SIZE - (tmp & (IO_PAGE_SIZE - 1UL)));
516 break; 517 break;
517 } 518 }
518 sg++; 519 sg = sg_next(sg);
519 } 520 }
520 521
521 pteval = iopte_protection | (pteval & IOPTE_PAGE); 522 pteval = iopte_protection | (pteval & IOPTE_PAGE);
@@ -528,24 +529,24 @@ static inline void fill_sg(iopte_t *iopte, struct scatterlist *sg,
528 } 529 }
529 530
530 pteval = (pteval & IOPTE_PAGE) + len; 531 pteval = (pteval & IOPTE_PAGE) + len;
531 sg++; 532 sg = sg_next(sg);
532 533
533 /* Skip over any tail mappings we've fully mapped, 534 /* Skip over any tail mappings we've fully mapped,
534 * adjusting pteval along the way. Stop when we 535 * adjusting pteval along the way. Stop when we
535 * detect a page crossing event. 536 * detect a page crossing event.
536 */ 537 */
537 while (sg < sg_end && 538 while (sg != sg_end &&
538 (pteval << (64 - IO_PAGE_SHIFT)) != 0UL && 539 (pteval << (64 - IO_PAGE_SHIFT)) != 0UL &&
539 (pteval == SG_ENT_PHYS_ADDRESS(sg)) && 540 (pteval == SG_ENT_PHYS_ADDRESS(sg)) &&
540 ((pteval ^ 541 ((pteval ^
541 (SG_ENT_PHYS_ADDRESS(sg) + sg->length - 1UL)) >> IO_PAGE_SHIFT) == 0UL) { 542 (SG_ENT_PHYS_ADDRESS(sg) + sg->length - 1UL)) >> IO_PAGE_SHIFT) == 0UL) {
542 pteval += sg->length; 543 pteval += sg->length;
543 sg++; 544 sg = sg_next(sg);
544 } 545 }
545 if ((pteval << (64 - IO_PAGE_SHIFT)) == 0UL) 546 if ((pteval << (64 - IO_PAGE_SHIFT)) == 0UL)
546 pteval = ~0UL; 547 pteval = ~0UL;
547 } while (dma_npages != 0); 548 } while (dma_npages != 0);
548 dma_sg++; 549 dma_sg = sg_next(dma_sg);
549 } 550 }
550} 551}
551 552
@@ -606,7 +607,7 @@ static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist,
606 sgtmp = sglist; 607 sgtmp = sglist;
607 while (used && sgtmp->dma_length) { 608 while (used && sgtmp->dma_length) {
608 sgtmp->dma_address += dma_base; 609 sgtmp->dma_address += dma_base;
609 sgtmp++; 610 sgtmp = sg_next(sgtmp);
610 used--; 611 used--;
611 } 612 }
612 used = nelems - used; 613 used = nelems - used;
@@ -642,6 +643,7 @@ static void dma_4u_unmap_sg(struct device *dev, struct scatterlist *sglist,
642 struct strbuf *strbuf; 643 struct strbuf *strbuf;
643 iopte_t *base; 644 iopte_t *base;
644 unsigned long flags, ctx, i, npages; 645 unsigned long flags, ctx, i, npages;
646 struct scatterlist *sg, *sgprv;
645 u32 bus_addr; 647 u32 bus_addr;
646 648
647 if (unlikely(direction == DMA_NONE)) { 649 if (unlikely(direction == DMA_NONE)) {
@@ -654,11 +656,14 @@ static void dma_4u_unmap_sg(struct device *dev, struct scatterlist *sglist,
654 656
655 bus_addr = sglist->dma_address & IO_PAGE_MASK; 657 bus_addr = sglist->dma_address & IO_PAGE_MASK;
656 658
657 for (i = 1; i < nelems; i++) 659 sgprv = NULL;
658 if (sglist[i].dma_length == 0) 660 for_each_sg(sglist, sg, nelems, i) {
661 if (sg->dma_length == 0)
659 break; 662 break;
660 i--; 663 sgprv = sg;
661 npages = (IO_PAGE_ALIGN(sglist[i].dma_address + sglist[i].dma_length) - 664 }
665
666 npages = (IO_PAGE_ALIGN(sgprv->dma_address + sgprv->dma_length) -
662 bus_addr) >> IO_PAGE_SHIFT; 667 bus_addr) >> IO_PAGE_SHIFT;
663 668
664 base = iommu->page_table + 669 base = iommu->page_table +
@@ -730,6 +735,7 @@ static void dma_4u_sync_sg_for_cpu(struct device *dev,
730 struct iommu *iommu; 735 struct iommu *iommu;
731 struct strbuf *strbuf; 736 struct strbuf *strbuf;
732 unsigned long flags, ctx, npages, i; 737 unsigned long flags, ctx, npages, i;
738 struct scatterlist *sg, *sgprv;
733 u32 bus_addr; 739 u32 bus_addr;
734 740
735 iommu = dev->archdata.iommu; 741 iommu = dev->archdata.iommu;
@@ -753,11 +759,14 @@ static void dma_4u_sync_sg_for_cpu(struct device *dev,
753 759
754 /* Step 2: Kick data out of streaming buffers. */ 760 /* Step 2: Kick data out of streaming buffers. */
755 bus_addr = sglist[0].dma_address & IO_PAGE_MASK; 761 bus_addr = sglist[0].dma_address & IO_PAGE_MASK;
756 for(i = 1; i < nelems; i++) 762 sgprv = NULL;
757 if (!sglist[i].dma_length) 763 for_each_sg(sglist, sg, nelems, i) {
764 if (sg->dma_length == 0)
758 break; 765 break;
759 i--; 766 sgprv = sg;
760 npages = (IO_PAGE_ALIGN(sglist[i].dma_address + sglist[i].dma_length) 767 }
768
769 npages = (IO_PAGE_ALIGN(sgprv->dma_address + sgprv->dma_length)
761 - bus_addr) >> IO_PAGE_SHIFT; 770 - bus_addr) >> IO_PAGE_SHIFT;
762 strbuf_flush(strbuf, iommu, bus_addr, ctx, npages, direction); 771 strbuf_flush(strbuf, iommu, bus_addr, ctx, npages, direction);
763 772
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
index 23956096b3bf..f3922e5a89f6 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc64/kernel/irq.c
@@ -21,7 +21,6 @@
21#include <linux/seq_file.h> 21#include <linux/seq_file.h>
22#include <linux/bootmem.h> 22#include <linux/bootmem.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/msi.h>
25 24
26#include <asm/ptrace.h> 25#include <asm/ptrace.h>
27#include <asm/processor.h> 26#include <asm/processor.h>
@@ -43,6 +42,7 @@
43#include <asm/auxio.h> 42#include <asm/auxio.h>
44#include <asm/head.h> 43#include <asm/head.h>
45#include <asm/hypervisor.h> 44#include <asm/hypervisor.h>
45#include <asm/cacheflush.h>
46 46
47/* UPA nodes send interrupt packet to UltraSparc with first data reg 47/* UPA nodes send interrupt packet to UltraSparc with first data reg
48 * value low 5 (7 on Starfire) bits holding the IRQ identifier being 48 * value low 5 (7 on Starfire) bits holding the IRQ identifier being
@@ -52,86 +52,128 @@
52 * To make processing these packets efficient and race free we use 52 * To make processing these packets efficient and race free we use
53 * an array of irq buckets below. The interrupt vector handler in 53 * an array of irq buckets below. The interrupt vector handler in
54 * entry.S feeds incoming packets into per-cpu pil-indexed lists. 54 * entry.S feeds incoming packets into per-cpu pil-indexed lists.
55 * The IVEC handler does not need to act atomically, the PIL dispatch
56 * code uses CAS to get an atomic snapshot of the list and clear it
57 * at the same time.
58 * 55 *
59 * If you make changes to ino_bucket, please update hand coded assembler 56 * If you make changes to ino_bucket, please update hand coded assembler
60 * of the vectored interrupt trap handler(s) in entry.S and sun4v_ivec.S 57 * of the vectored interrupt trap handler(s) in entry.S and sun4v_ivec.S
61 */ 58 */
62struct ino_bucket { 59struct ino_bucket {
63 /* Next handler in per-CPU IRQ worklist. We know that 60/*0x00*/unsigned long __irq_chain_pa;
64 * bucket pointers have the high 32-bits clear, so to
65 * save space we only store the bits we need.
66 */
67/*0x00*/unsigned int irq_chain;
68 61
69 /* Virtual interrupt number assigned to this INO. */ 62 /* Virtual interrupt number assigned to this INO. */
70/*0x04*/unsigned int virt_irq; 63/*0x08*/unsigned int __virt_irq;
64/*0x0c*/unsigned int __pad;
71}; 65};
72 66
73#define NUM_IVECS (IMAP_INR + 1) 67#define NUM_IVECS (IMAP_INR + 1)
74struct ino_bucket ivector_table[NUM_IVECS] __attribute__ ((aligned (SMP_CACHE_BYTES))); 68struct ino_bucket *ivector_table;
75 69unsigned long ivector_table_pa;
76#define __irq_ino(irq) \ 70
77 (((struct ino_bucket *)(unsigned long)(irq)) - &ivector_table[0]) 71/* On several sun4u processors, it is illegal to mix bypass and
78#define __bucket(irq) ((struct ino_bucket *)(unsigned long)(irq)) 72 * non-bypass accesses. Therefore we access all INO buckets
79#define __irq(bucket) ((unsigned int)(unsigned long)(bucket)) 73 * using bypass accesses only.
80
81/* This has to be in the main kernel image, it cannot be
82 * turned into per-cpu data. The reason is that the main
83 * kernel image is locked into the TLB and this structure
84 * is accessed from the vectored interrupt trap handler. If
85 * access to this structure takes a TLB miss it could cause
86 * the 5-level sparc v9 trap stack to overflow.
87 */ 74 */
88#define irq_work(__cpu) &(trap_block[(__cpu)].irq_worklist) 75static unsigned long bucket_get_chain_pa(unsigned long bucket_pa)
76{
77 unsigned long ret;
78
79 __asm__ __volatile__("ldxa [%1] %2, %0"
80 : "=&r" (ret)
81 : "r" (bucket_pa +
82 offsetof(struct ino_bucket,
83 __irq_chain_pa)),
84 "i" (ASI_PHYS_USE_EC));
85
86 return ret;
87}
88
89static void bucket_clear_chain_pa(unsigned long bucket_pa)
90{
91 __asm__ __volatile__("stxa %%g0, [%0] %1"
92 : /* no outputs */
93 : "r" (bucket_pa +
94 offsetof(struct ino_bucket,
95 __irq_chain_pa)),
96 "i" (ASI_PHYS_USE_EC));
97}
98
99static unsigned int bucket_get_virt_irq(unsigned long bucket_pa)
100{
101 unsigned int ret;
102
103 __asm__ __volatile__("lduwa [%1] %2, %0"
104 : "=&r" (ret)
105 : "r" (bucket_pa +
106 offsetof(struct ino_bucket,
107 __virt_irq)),
108 "i" (ASI_PHYS_USE_EC));
109
110 return ret;
111}
112
113static void bucket_set_virt_irq(unsigned long bucket_pa,
114 unsigned int virt_irq)
115{
116 __asm__ __volatile__("stwa %0, [%1] %2"
117 : /* no outputs */
118 : "r" (virt_irq),
119 "r" (bucket_pa +
120 offsetof(struct ino_bucket,
121 __virt_irq)),
122 "i" (ASI_PHYS_USE_EC));
123}
124
125#define irq_work_pa(__cpu) &(trap_block[(__cpu)].irq_worklist_pa)
89 126
90static struct { 127static struct {
91 unsigned int irq;
92 unsigned int dev_handle; 128 unsigned int dev_handle;
93 unsigned int dev_ino; 129 unsigned int dev_ino;
94} virt_to_real_irq_table[NR_IRQS]; 130 unsigned int in_use;
131} virt_irq_table[NR_IRQS];
132static DEFINE_SPINLOCK(virt_irq_alloc_lock);
95 133
96static unsigned char virt_irq_alloc(unsigned int real_irq) 134unsigned char virt_irq_alloc(unsigned int dev_handle,
135 unsigned int dev_ino)
97{ 136{
137 unsigned long flags;
98 unsigned char ent; 138 unsigned char ent;
99 139
100 BUILD_BUG_ON(NR_IRQS >= 256); 140 BUILD_BUG_ON(NR_IRQS >= 256);
101 141
142 spin_lock_irqsave(&virt_irq_alloc_lock, flags);
143
102 for (ent = 1; ent < NR_IRQS; ent++) { 144 for (ent = 1; ent < NR_IRQS; ent++) {
103 if (!virt_to_real_irq_table[ent].irq) 145 if (!virt_irq_table[ent].in_use)
104 break; 146 break;
105 } 147 }
106 if (ent >= NR_IRQS) { 148 if (ent >= NR_IRQS) {
107 printk(KERN_ERR "IRQ: Out of virtual IRQs.\n"); 149 printk(KERN_ERR "IRQ: Out of virtual IRQs.\n");
108 return 0; 150 ent = 0;
151 } else {
152 virt_irq_table[ent].dev_handle = dev_handle;
153 virt_irq_table[ent].dev_ino = dev_ino;
154 virt_irq_table[ent].in_use = 1;
109 } 155 }
110 156
111 virt_to_real_irq_table[ent].irq = real_irq; 157 spin_unlock_irqrestore(&virt_irq_alloc_lock, flags);
112 158
113 return ent; 159 return ent;
114} 160}
115 161
116#ifdef CONFIG_PCI_MSI 162#ifdef CONFIG_PCI_MSI
117static void virt_irq_free(unsigned int virt_irq) 163void virt_irq_free(unsigned int virt_irq)
118{ 164{
119 unsigned int real_irq; 165 unsigned long flags;
120 166
121 if (virt_irq >= NR_IRQS) 167 if (virt_irq >= NR_IRQS)
122 return; 168 return;
123 169
124 real_irq = virt_to_real_irq_table[virt_irq].irq; 170 spin_lock_irqsave(&virt_irq_alloc_lock, flags);
125 virt_to_real_irq_table[virt_irq].irq = 0;
126 171
127 __bucket(real_irq)->virt_irq = 0; 172 virt_irq_table[virt_irq].in_use = 0;
128}
129#endif
130 173
131static unsigned int virt_to_real_irq(unsigned char virt_irq) 174 spin_unlock_irqrestore(&virt_irq_alloc_lock, flags);
132{
133 return virt_to_real_irq_table[virt_irq].irq;
134} 175}
176#endif
135 177
136/* 178/*
137 * /proc/interrupts printing: 179 * /proc/interrupts printing:
@@ -217,38 +259,8 @@ struct irq_handler_data {
217 void (*pre_handler)(unsigned int, void *, void *); 259 void (*pre_handler)(unsigned int, void *, void *);
218 void *pre_handler_arg1; 260 void *pre_handler_arg1;
219 void *pre_handler_arg2; 261 void *pre_handler_arg2;
220
221 u32 msi;
222}; 262};
223 263
224void sparc64_set_msi(unsigned int virt_irq, u32 msi)
225{
226 struct irq_handler_data *data = get_irq_chip_data(virt_irq);
227
228 if (data)
229 data->msi = msi;
230}
231
232u32 sparc64_get_msi(unsigned int virt_irq)
233{
234 struct irq_handler_data *data = get_irq_chip_data(virt_irq);
235
236 if (data)
237 return data->msi;
238 return 0xffffffff;
239}
240
241static inline struct ino_bucket *virt_irq_to_bucket(unsigned int virt_irq)
242{
243 unsigned int real_irq = virt_to_real_irq(virt_irq);
244 struct ino_bucket *bucket = NULL;
245
246 if (likely(real_irq))
247 bucket = __bucket(real_irq);
248
249 return bucket;
250}
251
252#ifdef CONFIG_SMP 264#ifdef CONFIG_SMP
253static int irq_choose_cpu(unsigned int virt_irq) 265static int irq_choose_cpu(unsigned int virt_irq)
254{ 266{
@@ -348,201 +360,152 @@ static void sun4u_irq_end(unsigned int virt_irq)
348 360
349static void sun4v_irq_enable(unsigned int virt_irq) 361static void sun4v_irq_enable(unsigned int virt_irq)
350{ 362{
351 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); 363 unsigned int ino = virt_irq_table[virt_irq].dev_ino;
352 unsigned int ino = bucket - &ivector_table[0]; 364 unsigned long cpuid = irq_choose_cpu(virt_irq);
353 365 int err;
354 if (likely(bucket)) {
355 unsigned long cpuid;
356 int err;
357 366
358 cpuid = irq_choose_cpu(virt_irq); 367 err = sun4v_intr_settarget(ino, cpuid);
359 368 if (err != HV_EOK)
360 err = sun4v_intr_settarget(ino, cpuid); 369 printk(KERN_ERR "sun4v_intr_settarget(%x,%lu): "
361 if (err != HV_EOK) 370 "err(%d)\n", ino, cpuid, err);
362 printk(KERN_ERR "sun4v_intr_settarget(%x,%lu): " 371 err = sun4v_intr_setstate(ino, HV_INTR_STATE_IDLE);
363 "err(%d)\n", ino, cpuid, err); 372 if (err != HV_EOK)
364 err = sun4v_intr_setstate(ino, HV_INTR_STATE_IDLE); 373 printk(KERN_ERR "sun4v_intr_setstate(%x): "
365 if (err != HV_EOK) 374 "err(%d)\n", ino, err);
366 printk(KERN_ERR "sun4v_intr_setstate(%x): " 375 err = sun4v_intr_setenabled(ino, HV_INTR_ENABLED);
367 "err(%d)\n", ino, err); 376 if (err != HV_EOK)
368 err = sun4v_intr_setenabled(ino, HV_INTR_ENABLED); 377 printk(KERN_ERR "sun4v_intr_setenabled(%x): err(%d)\n",
369 if (err != HV_EOK) 378 ino, err);
370 printk(KERN_ERR "sun4v_intr_setenabled(%x): err(%d)\n",
371 ino, err);
372 }
373} 379}
374 380
375static void sun4v_set_affinity(unsigned int virt_irq, cpumask_t mask) 381static void sun4v_set_affinity(unsigned int virt_irq, cpumask_t mask)
376{ 382{
377 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); 383 unsigned int ino = virt_irq_table[virt_irq].dev_ino;
378 unsigned int ino = bucket - &ivector_table[0]; 384 unsigned long cpuid = irq_choose_cpu(virt_irq);
385 int err;
379 386
380 if (likely(bucket)) { 387 err = sun4v_intr_settarget(ino, cpuid);
381 unsigned long cpuid; 388 if (err != HV_EOK)
382 int err; 389 printk(KERN_ERR "sun4v_intr_settarget(%x,%lu): "
383 390 "err(%d)\n", ino, cpuid, err);
384 cpuid = irq_choose_cpu(virt_irq);
385
386 err = sun4v_intr_settarget(ino, cpuid);
387 if (err != HV_EOK)
388 printk(KERN_ERR "sun4v_intr_settarget(%x,%lu): "
389 "err(%d)\n", ino, cpuid, err);
390 }
391} 391}
392 392
393static void sun4v_irq_disable(unsigned int virt_irq) 393static void sun4v_irq_disable(unsigned int virt_irq)
394{ 394{
395 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); 395 unsigned int ino = virt_irq_table[virt_irq].dev_ino;
396 unsigned int ino = bucket - &ivector_table[0]; 396 int err;
397
398 if (likely(bucket)) {
399 int err;
400
401 err = sun4v_intr_setenabled(ino, HV_INTR_DISABLED);
402 if (err != HV_EOK)
403 printk(KERN_ERR "sun4v_intr_setenabled(%x): "
404 "err(%d)\n", ino, err);
405 }
406}
407
408#ifdef CONFIG_PCI_MSI
409static void sun4v_msi_enable(unsigned int virt_irq)
410{
411 sun4v_irq_enable(virt_irq);
412 unmask_msi_irq(virt_irq);
413}
414 397
415static void sun4v_msi_disable(unsigned int virt_irq) 398 err = sun4v_intr_setenabled(ino, HV_INTR_DISABLED);
416{ 399 if (err != HV_EOK)
417 mask_msi_irq(virt_irq); 400 printk(KERN_ERR "sun4v_intr_setenabled(%x): "
418 sun4v_irq_disable(virt_irq); 401 "err(%d)\n", ino, err);
419} 402}
420#endif
421 403
422static void sun4v_irq_end(unsigned int virt_irq) 404static void sun4v_irq_end(unsigned int virt_irq)
423{ 405{
424 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); 406 unsigned int ino = virt_irq_table[virt_irq].dev_ino;
425 unsigned int ino = bucket - &ivector_table[0];
426 struct irq_desc *desc = irq_desc + virt_irq; 407 struct irq_desc *desc = irq_desc + virt_irq;
408 int err;
427 409
428 if (unlikely(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 410 if (unlikely(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
429 return; 411 return;
430 412
431 if (likely(bucket)) { 413 err = sun4v_intr_setstate(ino, HV_INTR_STATE_IDLE);
432 int err; 414 if (err != HV_EOK)
433 415 printk(KERN_ERR "sun4v_intr_setstate(%x): "
434 err = sun4v_intr_setstate(ino, HV_INTR_STATE_IDLE); 416 "err(%d)\n", ino, err);
435 if (err != HV_EOK)
436 printk(KERN_ERR "sun4v_intr_setstate(%x): "
437 "err(%d)\n", ino, err);
438 }
439} 417}
440 418
441static void sun4v_virq_enable(unsigned int virt_irq) 419static void sun4v_virq_enable(unsigned int virt_irq)
442{ 420{
443 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); 421 unsigned long cpuid, dev_handle, dev_ino;
444 422 int err;
445 if (likely(bucket)) { 423
446 unsigned long cpuid, dev_handle, dev_ino; 424 cpuid = irq_choose_cpu(virt_irq);
447 int err; 425
448 426 dev_handle = virt_irq_table[virt_irq].dev_handle;
449 cpuid = irq_choose_cpu(virt_irq); 427 dev_ino = virt_irq_table[virt_irq].dev_ino;
450 428
451 dev_handle = virt_to_real_irq_table[virt_irq].dev_handle; 429 err = sun4v_vintr_set_target(dev_handle, dev_ino, cpuid);
452 dev_ino = virt_to_real_irq_table[virt_irq].dev_ino; 430 if (err != HV_EOK)
453 431 printk(KERN_ERR "sun4v_vintr_set_target(%lx,%lx,%lu): "
454 err = sun4v_vintr_set_target(dev_handle, dev_ino, cpuid); 432 "err(%d)\n",
455 if (err != HV_EOK) 433 dev_handle, dev_ino, cpuid, err);
456 printk(KERN_ERR "sun4v_vintr_set_target(%lx,%lx,%lu): " 434 err = sun4v_vintr_set_state(dev_handle, dev_ino,
457 "err(%d)\n", 435 HV_INTR_STATE_IDLE);
458 dev_handle, dev_ino, cpuid, err); 436 if (err != HV_EOK)
459 err = sun4v_vintr_set_state(dev_handle, dev_ino, 437 printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx,"
460 HV_INTR_STATE_IDLE); 438 "HV_INTR_STATE_IDLE): err(%d)\n",
461 if (err != HV_EOK) 439 dev_handle, dev_ino, err);
462 printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx," 440 err = sun4v_vintr_set_valid(dev_handle, dev_ino,
463 "HV_INTR_STATE_IDLE): err(%d)\n", 441 HV_INTR_ENABLED);
464 dev_handle, dev_ino, err); 442 if (err != HV_EOK)
465 err = sun4v_vintr_set_valid(dev_handle, dev_ino, 443 printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx,"
466 HV_INTR_ENABLED); 444 "HV_INTR_ENABLED): err(%d)\n",
467 if (err != HV_EOK) 445 dev_handle, dev_ino, err);
468 printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx,"
469 "HV_INTR_ENABLED): err(%d)\n",
470 dev_handle, dev_ino, err);
471 }
472} 446}
473 447
474static void sun4v_virt_set_affinity(unsigned int virt_irq, cpumask_t mask) 448static void sun4v_virt_set_affinity(unsigned int virt_irq, cpumask_t mask)
475{ 449{
476 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); 450 unsigned long cpuid, dev_handle, dev_ino;
451 int err;
477 452
478 if (likely(bucket)) { 453 cpuid = irq_choose_cpu(virt_irq);
479 unsigned long cpuid, dev_handle, dev_ino;
480 int err;
481 454
482 cpuid = irq_choose_cpu(virt_irq); 455 dev_handle = virt_irq_table[virt_irq].dev_handle;
456 dev_ino = virt_irq_table[virt_irq].dev_ino;
483 457
484 dev_handle = virt_to_real_irq_table[virt_irq].dev_handle; 458 err = sun4v_vintr_set_target(dev_handle, dev_ino, cpuid);
485 dev_ino = virt_to_real_irq_table[virt_irq].dev_ino; 459 if (err != HV_EOK)
486 460 printk(KERN_ERR "sun4v_vintr_set_target(%lx,%lx,%lu): "
487 err = sun4v_vintr_set_target(dev_handle, dev_ino, cpuid); 461 "err(%d)\n",
488 if (err != HV_EOK) 462 dev_handle, dev_ino, cpuid, err);
489 printk(KERN_ERR "sun4v_vintr_set_target(%lx,%lx,%lu): "
490 "err(%d)\n",
491 dev_handle, dev_ino, cpuid, err);
492 }
493} 463}
494 464
495static void sun4v_virq_disable(unsigned int virt_irq) 465static void sun4v_virq_disable(unsigned int virt_irq)
496{ 466{
497 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); 467 unsigned long dev_handle, dev_ino;
468 int err;
498 469
499 if (likely(bucket)) { 470 dev_handle = virt_irq_table[virt_irq].dev_handle;
500 unsigned long dev_handle, dev_ino; 471 dev_ino = virt_irq_table[virt_irq].dev_ino;
501 int err;
502 472
503 dev_handle = virt_to_real_irq_table[virt_irq].dev_handle; 473 err = sun4v_vintr_set_valid(dev_handle, dev_ino,
504 dev_ino = virt_to_real_irq_table[virt_irq].dev_ino; 474 HV_INTR_DISABLED);
505 475 if (err != HV_EOK)
506 err = sun4v_vintr_set_valid(dev_handle, dev_ino, 476 printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx,"
507 HV_INTR_DISABLED); 477 "HV_INTR_DISABLED): err(%d)\n",
508 if (err != HV_EOK) 478 dev_handle, dev_ino, err);
509 printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx,"
510 "HV_INTR_DISABLED): err(%d)\n",
511 dev_handle, dev_ino, err);
512 }
513} 479}
514 480
515static void sun4v_virq_end(unsigned int virt_irq) 481static void sun4v_virq_end(unsigned int virt_irq)
516{ 482{
517 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
518 struct irq_desc *desc = irq_desc + virt_irq; 483 struct irq_desc *desc = irq_desc + virt_irq;
484 unsigned long dev_handle, dev_ino;
485 int err;
519 486
520 if (unlikely(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 487 if (unlikely(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
521 return; 488 return;
522 489
523 if (likely(bucket)) { 490 dev_handle = virt_irq_table[virt_irq].dev_handle;
524 unsigned long dev_handle, dev_ino; 491 dev_ino = virt_irq_table[virt_irq].dev_ino;
525 int err;
526 492
527 dev_handle = virt_to_real_irq_table[virt_irq].dev_handle; 493 err = sun4v_vintr_set_state(dev_handle, dev_ino,
528 dev_ino = virt_to_real_irq_table[virt_irq].dev_ino; 494 HV_INTR_STATE_IDLE);
529 495 if (err != HV_EOK)
530 err = sun4v_vintr_set_state(dev_handle, dev_ino, 496 printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx,"
531 HV_INTR_STATE_IDLE); 497 "HV_INTR_STATE_IDLE): err(%d)\n",
532 if (err != HV_EOK) 498 dev_handle, dev_ino, err);
533 printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx,"
534 "HV_INTR_STATE_IDLE): err(%d)\n",
535 dev_handle, dev_ino, err);
536 }
537} 499}
538 500
539static void run_pre_handler(unsigned int virt_irq) 501static void run_pre_handler(unsigned int virt_irq)
540{ 502{
541 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
542 struct irq_handler_data *data = get_irq_chip_data(virt_irq); 503 struct irq_handler_data *data = get_irq_chip_data(virt_irq);
504 unsigned int ino;
543 505
506 ino = virt_irq_table[virt_irq].dev_ino;
544 if (likely(data->pre_handler)) { 507 if (likely(data->pre_handler)) {
545 data->pre_handler(__irq_ino(__irq(bucket)), 508 data->pre_handler(ino,
546 data->pre_handler_arg1, 509 data->pre_handler_arg1,
547 data->pre_handler_arg2); 510 data->pre_handler_arg2);
548 } 511 }
@@ -573,28 +536,6 @@ static struct irq_chip sun4v_irq = {
573 .set_affinity = sun4v_set_affinity, 536 .set_affinity = sun4v_set_affinity,
574}; 537};
575 538
576static struct irq_chip sun4v_irq_ack = {
577 .typename = "sun4v+ack",
578 .enable = sun4v_irq_enable,
579 .disable = sun4v_irq_disable,
580 .ack = run_pre_handler,
581 .end = sun4v_irq_end,
582 .set_affinity = sun4v_set_affinity,
583};
584
585#ifdef CONFIG_PCI_MSI
586static struct irq_chip sun4v_msi = {
587 .typename = "sun4v+msi",
588 .mask = mask_msi_irq,
589 .unmask = unmask_msi_irq,
590 .enable = sun4v_msi_enable,
591 .disable = sun4v_msi_disable,
592 .ack = run_pre_handler,
593 .end = sun4v_irq_end,
594 .set_affinity = sun4v_set_affinity,
595};
596#endif
597
598static struct irq_chip sun4v_virq = { 539static struct irq_chip sun4v_virq = {
599 .typename = "vsun4v", 540 .typename = "vsun4v",
600 .enable = sun4v_virq_enable, 541 .enable = sun4v_virq_enable,
@@ -603,59 +544,48 @@ static struct irq_chip sun4v_virq = {
603 .set_affinity = sun4v_virt_set_affinity, 544 .set_affinity = sun4v_virt_set_affinity,
604}; 545};
605 546
606static struct irq_chip sun4v_virq_ack = {
607 .typename = "vsun4v+ack",
608 .enable = sun4v_virq_enable,
609 .disable = sun4v_virq_disable,
610 .ack = run_pre_handler,
611 .end = sun4v_virq_end,
612 .set_affinity = sun4v_virt_set_affinity,
613};
614
615void irq_install_pre_handler(int virt_irq, 547void irq_install_pre_handler(int virt_irq,
616 void (*func)(unsigned int, void *, void *), 548 void (*func)(unsigned int, void *, void *),
617 void *arg1, void *arg2) 549 void *arg1, void *arg2)
618{ 550{
619 struct irq_handler_data *data = get_irq_chip_data(virt_irq); 551 struct irq_handler_data *data = get_irq_chip_data(virt_irq);
620 struct irq_chip *chip; 552 struct irq_chip *chip = get_irq_chip(virt_irq);
553
554 if (WARN_ON(chip == &sun4v_irq || chip == &sun4v_virq)) {
555 printk(KERN_ERR "IRQ: Trying to install pre-handler on "
556 "sun4v irq %u\n", virt_irq);
557 return;
558 }
621 559
622 data->pre_handler = func; 560 data->pre_handler = func;
623 data->pre_handler_arg1 = arg1; 561 data->pre_handler_arg1 = arg1;
624 data->pre_handler_arg2 = arg2; 562 data->pre_handler_arg2 = arg2;
625 563
626 chip = get_irq_chip(virt_irq); 564 if (chip == &sun4u_irq_ack)
627 if (chip == &sun4u_irq_ack ||
628 chip == &sun4v_irq_ack ||
629 chip == &sun4v_virq_ack
630#ifdef CONFIG_PCI_MSI
631 || chip == &sun4v_msi
632#endif
633 )
634 return; 565 return;
635 566
636 chip = (chip == &sun4u_irq ? 567 set_irq_chip(virt_irq, &sun4u_irq_ack);
637 &sun4u_irq_ack :
638 (chip == &sun4v_irq ?
639 &sun4v_irq_ack : &sun4v_virq_ack));
640 set_irq_chip(virt_irq, chip);
641} 568}
642 569
643unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap) 570unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap)
644{ 571{
645 struct ino_bucket *bucket; 572 struct ino_bucket *bucket;
646 struct irq_handler_data *data; 573 struct irq_handler_data *data;
574 unsigned int virt_irq;
647 int ino; 575 int ino;
648 576
649 BUG_ON(tlb_type == hypervisor); 577 BUG_ON(tlb_type == hypervisor);
650 578
651 ino = (upa_readq(imap) & (IMAP_IGN | IMAP_INO)) + inofixup; 579 ino = (upa_readq(imap) & (IMAP_IGN | IMAP_INO)) + inofixup;
652 bucket = &ivector_table[ino]; 580 bucket = &ivector_table[ino];
653 if (!bucket->virt_irq) { 581 virt_irq = bucket_get_virt_irq(__pa(bucket));
654 bucket->virt_irq = virt_irq_alloc(__irq(bucket)); 582 if (!virt_irq) {
655 set_irq_chip(bucket->virt_irq, &sun4u_irq); 583 virt_irq = virt_irq_alloc(0, ino);
584 bucket_set_virt_irq(__pa(bucket), virt_irq);
585 set_irq_chip(virt_irq, &sun4u_irq);
656 } 586 }
657 587
658 data = get_irq_chip_data(bucket->virt_irq); 588 data = get_irq_chip_data(virt_irq);
659 if (unlikely(data)) 589 if (unlikely(data))
660 goto out; 590 goto out;
661 591
@@ -664,13 +594,13 @@ unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap)
664 prom_printf("IRQ: kzalloc(irq_handler_data) failed.\n"); 594 prom_printf("IRQ: kzalloc(irq_handler_data) failed.\n");
665 prom_halt(); 595 prom_halt();
666 } 596 }
667 set_irq_chip_data(bucket->virt_irq, data); 597 set_irq_chip_data(virt_irq, data);
668 598
669 data->imap = imap; 599 data->imap = imap;
670 data->iclr = iclr; 600 data->iclr = iclr;
671 601
672out: 602out:
673 return bucket->virt_irq; 603 return virt_irq;
674} 604}
675 605
676static unsigned int sun4v_build_common(unsigned long sysino, 606static unsigned int sun4v_build_common(unsigned long sysino,
@@ -678,16 +608,19 @@ static unsigned int sun4v_build_common(unsigned long sysino,
678{ 608{
679 struct ino_bucket *bucket; 609 struct ino_bucket *bucket;
680 struct irq_handler_data *data; 610 struct irq_handler_data *data;
611 unsigned int virt_irq;
681 612
682 BUG_ON(tlb_type != hypervisor); 613 BUG_ON(tlb_type != hypervisor);
683 614
684 bucket = &ivector_table[sysino]; 615 bucket = &ivector_table[sysino];
685 if (!bucket->virt_irq) { 616 virt_irq = bucket_get_virt_irq(__pa(bucket));
686 bucket->virt_irq = virt_irq_alloc(__irq(bucket)); 617 if (!virt_irq) {
687 set_irq_chip(bucket->virt_irq, chip); 618 virt_irq = virt_irq_alloc(0, sysino);
619 bucket_set_virt_irq(__pa(bucket), virt_irq);
620 set_irq_chip(virt_irq, chip);
688 } 621 }
689 622
690 data = get_irq_chip_data(bucket->virt_irq); 623 data = get_irq_chip_data(virt_irq);
691 if (unlikely(data)) 624 if (unlikely(data))
692 goto out; 625 goto out;
693 626
@@ -696,7 +629,7 @@ static unsigned int sun4v_build_common(unsigned long sysino,
696 prom_printf("IRQ: kzalloc(irq_handler_data) failed.\n"); 629 prom_printf("IRQ: kzalloc(irq_handler_data) failed.\n");
697 prom_halt(); 630 prom_halt();
698 } 631 }
699 set_irq_chip_data(bucket->virt_irq, data); 632 set_irq_chip_data(virt_irq, data);
700 633
701 /* Catch accidental accesses to these things. IMAP/ICLR handling 634 /* Catch accidental accesses to these things. IMAP/ICLR handling
702 * is done by hypervisor calls on sun4v platforms, not by direct 635 * is done by hypervisor calls on sun4v platforms, not by direct
@@ -706,7 +639,7 @@ static unsigned int sun4v_build_common(unsigned long sysino,
706 data->iclr = ~0UL; 639 data->iclr = ~0UL;
707 640
708out: 641out:
709 return bucket->virt_irq; 642 return virt_irq;
710} 643}
711 644
712unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino) 645unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino)
@@ -718,86 +651,52 @@ unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino)
718 651
719unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino) 652unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino)
720{ 653{
721 unsigned long sysino, hv_err;
722 unsigned int virq;
723
724 BUG_ON(devhandle & devino);
725
726 sysino = devhandle | devino;
727 BUG_ON(sysino & ~(IMAP_IGN | IMAP_INO));
728
729 hv_err = sun4v_vintr_set_cookie(devhandle, devino, sysino);
730 if (hv_err) {
731 prom_printf("IRQ: Fatal, cannot set cookie for [%x:%x] "
732 "err=%lu\n", devhandle, devino, hv_err);
733 prom_halt();
734 }
735
736 virq = sun4v_build_common(sysino, &sun4v_virq);
737
738 virt_to_real_irq_table[virq].dev_handle = devhandle;
739 virt_to_real_irq_table[virq].dev_ino = devino;
740
741 return virq;
742}
743
744#ifdef CONFIG_PCI_MSI
745unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p,
746 unsigned int msi_start, unsigned int msi_end)
747{
748 struct ino_bucket *bucket;
749 struct irq_handler_data *data; 654 struct irq_handler_data *data;
750 unsigned long sysino; 655 struct ino_bucket *bucket;
751 unsigned int devino; 656 unsigned long hv_err, cookie;
752 657 unsigned int virt_irq;
753 BUG_ON(tlb_type != hypervisor);
754
755 /* Find a free devino in the given range. */
756 for (devino = msi_start; devino < msi_end; devino++) {
757 sysino = sun4v_devino_to_sysino(devhandle, devino);
758 bucket = &ivector_table[sysino];
759 if (!bucket->virt_irq)
760 break;
761 }
762 if (devino >= msi_end)
763 return -ENOSPC;
764 658
765 sysino = sun4v_devino_to_sysino(devhandle, devino); 659 bucket = kzalloc(sizeof(struct ino_bucket), GFP_ATOMIC);
766 bucket = &ivector_table[sysino]; 660 if (unlikely(!bucket))
767 bucket->virt_irq = virt_irq_alloc(__irq(bucket)); 661 return 0;
768 *virt_irq_p = bucket->virt_irq; 662 __flush_dcache_range((unsigned long) bucket,
769 set_irq_chip(bucket->virt_irq, &sun4v_msi); 663 ((unsigned long) bucket +
664 sizeof(struct ino_bucket)));
770 665
771 data = get_irq_chip_data(bucket->virt_irq); 666 virt_irq = virt_irq_alloc(devhandle, devino);
772 if (unlikely(data)) 667 bucket_set_virt_irq(__pa(bucket), virt_irq);
773 return devino; 668 set_irq_chip(virt_irq, &sun4v_virq);
774 669
775 data = kzalloc(sizeof(struct irq_handler_data), GFP_ATOMIC); 670 data = kzalloc(sizeof(struct irq_handler_data), GFP_ATOMIC);
776 if (unlikely(!data)) { 671 if (unlikely(!data))
777 virt_irq_free(*virt_irq_p); 672 return 0;
778 return -ENOMEM; 673
779 } 674 set_irq_chip_data(virt_irq, data);
780 set_irq_chip_data(bucket->virt_irq, data);
781 675
676 /* Catch accidental accesses to these things. IMAP/ICLR handling
677 * is done by hypervisor calls on sun4v platforms, not by direct
678 * register accesses.
679 */
782 data->imap = ~0UL; 680 data->imap = ~0UL;
783 data->iclr = ~0UL; 681 data->iclr = ~0UL;
784 682
785 return devino; 683 cookie = ~__pa(bucket);
786} 684 hv_err = sun4v_vintr_set_cookie(devhandle, devino, cookie);
685 if (hv_err) {
686 prom_printf("IRQ: Fatal, cannot set cookie for [%x:%x] "
687 "err=%lu\n", devhandle, devino, hv_err);
688 prom_halt();
689 }
787 690
788void sun4v_destroy_msi(unsigned int virt_irq) 691 return virt_irq;
789{
790 virt_irq_free(virt_irq);
791} 692}
792#endif
793 693
794void ack_bad_irq(unsigned int virt_irq) 694void ack_bad_irq(unsigned int virt_irq)
795{ 695{
796 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); 696 unsigned int ino = virt_irq_table[virt_irq].dev_ino;
797 unsigned int ino = 0xdeadbeef;
798 697
799 if (bucket) 698 if (!ino)
800 ino = bucket - &ivector_table[0]; 699 ino = 0xdeadbeef;
801 700
802 printk(KERN_CRIT "Unexpected IRQ from ino[%x] virt_irq[%u]\n", 701 printk(KERN_CRIT "Unexpected IRQ from ino[%x] virt_irq[%u]\n",
803 ino, virt_irq); 702 ino, virt_irq);
@@ -805,7 +704,7 @@ void ack_bad_irq(unsigned int virt_irq)
805 704
806void handler_irq(int irq, struct pt_regs *regs) 705void handler_irq(int irq, struct pt_regs *regs)
807{ 706{
808 struct ino_bucket *bucket; 707 unsigned long pstate, bucket_pa;
809 struct pt_regs *old_regs; 708 struct pt_regs *old_regs;
810 709
811 clear_softint(1 << irq); 710 clear_softint(1 << irq);
@@ -813,15 +712,28 @@ void handler_irq(int irq, struct pt_regs *regs)
813 old_regs = set_irq_regs(regs); 712 old_regs = set_irq_regs(regs);
814 irq_enter(); 713 irq_enter();
815 714
816 /* Sliiiick... */ 715 /* Grab an atomic snapshot of the pending IVECs. */
817 bucket = __bucket(xchg32(irq_work(smp_processor_id()), 0)); 716 __asm__ __volatile__("rdpr %%pstate, %0\n\t"
818 while (bucket) { 717 "wrpr %0, %3, %%pstate\n\t"
819 struct ino_bucket *next = __bucket(bucket->irq_chain); 718 "ldx [%2], %1\n\t"
719 "stx %%g0, [%2]\n\t"
720 "wrpr %0, 0x0, %%pstate\n\t"
721 : "=&r" (pstate), "=&r" (bucket_pa)
722 : "r" (irq_work_pa(smp_processor_id())),
723 "i" (PSTATE_IE)
724 : "memory");
725
726 while (bucket_pa) {
727 unsigned long next_pa;
728 unsigned int virt_irq;
820 729
821 bucket->irq_chain = 0; 730 next_pa = bucket_get_chain_pa(bucket_pa);
822 __do_IRQ(bucket->virt_irq); 731 virt_irq = bucket_get_virt_irq(bucket_pa);
732 bucket_clear_chain_pa(bucket_pa);
823 733
824 bucket = next; 734 __do_IRQ(virt_irq);
735
736 bucket_pa = next_pa;
825 } 737 }
826 738
827 irq_exit(); 739 irq_exit();
@@ -921,7 +833,7 @@ void init_irqwork_curcpu(void)
921{ 833{
922 int cpu = hard_smp_processor_id(); 834 int cpu = hard_smp_processor_id();
923 835
924 trap_block[cpu].irq_worklist = 0; 836 trap_block[cpu].irq_worklist_pa = 0UL;
925} 837}
926 838
927/* Please be very careful with register_one_mondo() and 839/* Please be very careful with register_one_mondo() and
@@ -1035,9 +947,21 @@ static struct irqaction timer_irq_action = {
1035/* Only invoked on boot processor. */ 947/* Only invoked on boot processor. */
1036void __init init_IRQ(void) 948void __init init_IRQ(void)
1037{ 949{
950 unsigned long size;
951
1038 map_prom_timers(); 952 map_prom_timers();
1039 kill_prom_timer(); 953 kill_prom_timer();
1040 memset(&ivector_table[0], 0, sizeof(ivector_table)); 954
955 size = sizeof(struct ino_bucket) * NUM_IVECS;
956 ivector_table = alloc_bootmem_low(size);
957 if (!ivector_table) {
958 prom_printf("Fatal error, cannot allocate ivector_table\n");
959 prom_halt();
960 }
961 __flush_dcache_range((unsigned long) ivector_table,
962 ((unsigned long) ivector_table) + size);
963
964 ivector_table_pa = __pa(ivector_table);
1041 965
1042 if (tlb_type == hypervisor) 966 if (tlb_type == hypervisor)
1043 sun4v_init_mondo_queues(); 967 sun4v_init_mondo_queues();
diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc64/kernel/kprobes.c
index c93a15b785fa..d94f901d321e 100644
--- a/arch/sparc64/kernel/kprobes.c
+++ b/arch/sparc64/kernel/kprobes.c
@@ -42,6 +42,8 @@
42DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; 42DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
43DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); 43DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
44 44
45struct kretprobe_blackpoint kretprobe_blacklist[] = {{NULL, NULL}};
46
45int __kprobes arch_prepare_kprobe(struct kprobe *p) 47int __kprobes arch_prepare_kprobe(struct kprobe *p)
46{ 48{
47 p->ainsn.insn[0] = *p->addr; 49 p->ainsn.insn[0] = *p->addr;
diff --git a/arch/sparc64/kernel/ktlb.S b/arch/sparc64/kernel/ktlb.S
index d4024ac0d619..964527d2ffa0 100644
--- a/arch/sparc64/kernel/ktlb.S
+++ b/arch/sparc64/kernel/ktlb.S
@@ -226,6 +226,15 @@ kvmap_dtlb_load:
226 ba,pt %xcc, sun4v_dtlb_load 226 ba,pt %xcc, sun4v_dtlb_load
227 mov %g5, %g3 227 mov %g5, %g3
228 228
229kvmap_vmemmap:
230 sub %g4, %g5, %g5
231 srlx %g5, 22, %g5
232 sethi %hi(vmemmap_table), %g1
233 sllx %g5, 3, %g5
234 or %g1, %lo(vmemmap_table), %g1
235 ba,pt %xcc, kvmap_dtlb_load
236 ldx [%g1 + %g5], %g5
237
229kvmap_dtlb_nonlinear: 238kvmap_dtlb_nonlinear:
230 /* Catch kernel NULL pointer derefs. */ 239 /* Catch kernel NULL pointer derefs. */
231 sethi %hi(PAGE_SIZE), %g5 240 sethi %hi(PAGE_SIZE), %g5
@@ -233,6 +242,13 @@ kvmap_dtlb_nonlinear:
233 bleu,pn %xcc, kvmap_dtlb_longpath 242 bleu,pn %xcc, kvmap_dtlb_longpath
234 nop 243 nop
235 244
245 /* Do not use the TSB for vmemmap. */
246 mov (VMEMMAP_BASE >> 24), %g5
247 sllx %g5, 24, %g5
248 cmp %g4,%g5
249 bgeu,pn %xcc, kvmap_vmemmap
250 nop
251
236 KERN_TSB_LOOKUP_TL1(%g4, %g6, %g5, %g1, %g2, %g3, kvmap_dtlb_load) 252 KERN_TSB_LOOKUP_TL1(%g4, %g6, %g5, %g1, %g2, %g3, kvmap_dtlb_load)
237 253
238kvmap_dtlb_tsbmiss: 254kvmap_dtlb_tsbmiss:
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index 4cc77485f536..42d779866fba 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -872,7 +872,10 @@ __setup("of_debug=", of_debug);
872int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus) 872int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
873{ 873{
874 /* initialize common driver fields */ 874 /* initialize common driver fields */
875 drv->driver.name = drv->name; 875 if (!drv->driver.name)
876 drv->driver.name = drv->name;
877 if (!drv->driver.owner)
878 drv->driver.owner = drv->owner;
876 drv->driver.bus = bus; 879 drv->driver.bus = bus;
877 880
878 /* register with core */ 881 /* register with core */
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index e8dac81d8a0d..9b808640a193 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -29,8 +29,6 @@
29 29
30#include "pci_impl.h" 30#include "pci_impl.h"
31 31
32unsigned long pci_memspace_mask = 0xffffffffUL;
33
34#ifndef CONFIG_PCI 32#ifndef CONFIG_PCI
35/* A "nop" PCI implementation. */ 33/* A "nop" PCI implementation. */
36asmlinkage int sys_pciconfig_read(unsigned long bus, unsigned long dfn, 34asmlinkage int sys_pciconfig_read(unsigned long bus, unsigned long dfn,
@@ -1066,8 +1064,8 @@ static int __pci_mmap_make_offset_bus(struct pci_dev *pdev, struct vm_area_struc
1066 return 0; 1064 return 0;
1067} 1065}
1068 1066
1069/* Adjust vm_pgoff of VMA such that it is the physical page offset corresponding 1067/* Adjust vm_pgoff of VMA such that it is the physical page offset
1070 * to the 32-bit pci bus offset for DEV requested by the user. 1068 * corresponding to the 32-bit pci bus offset for DEV requested by the user.
1071 * 1069 *
1072 * Basically, the user finds the base address for his device which he wishes 1070 * Basically, the user finds the base address for his device which he wishes
1073 * to mmap. They read the 32-bit value from the config space base register, 1071 * to mmap. They read the 32-bit value from the config space base register,
@@ -1076,21 +1074,35 @@ static int __pci_mmap_make_offset_bus(struct pci_dev *pdev, struct vm_area_struc
1076 * 1074 *
1077 * Returns negative error code on failure, zero on success. 1075 * Returns negative error code on failure, zero on success.
1078 */ 1076 */
1079static int __pci_mmap_make_offset(struct pci_dev *dev, struct vm_area_struct *vma, 1077static int __pci_mmap_make_offset(struct pci_dev *pdev,
1078 struct vm_area_struct *vma,
1080 enum pci_mmap_state mmap_state) 1079 enum pci_mmap_state mmap_state)
1081{ 1080{
1082 unsigned long user_offset = vma->vm_pgoff << PAGE_SHIFT; 1081 unsigned long user_paddr, user_size;
1083 unsigned long user32 = user_offset & pci_memspace_mask; 1082 int i, err;
1084 unsigned long largest_base, this_base, addr32;
1085 int i;
1086 1083
1087 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_HOST) 1084 /* First compute the physical address in vma->vm_pgoff,
1088 return __pci_mmap_make_offset_bus(dev, vma, mmap_state); 1085 * making sure the user offset is within range in the
1086 * appropriate PCI space.
1087 */
1088 err = __pci_mmap_make_offset_bus(pdev, vma, mmap_state);
1089 if (err)
1090 return err;
1091
1092 /* If this is a mapping on a host bridge, any address
1093 * is OK.
1094 */
1095 if ((pdev->class >> 8) == PCI_CLASS_BRIDGE_HOST)
1096 return err;
1097
1098 /* Otherwise make sure it's in the range for one of the
1099 * device's resources.
1100 */
1101 user_paddr = vma->vm_pgoff << PAGE_SHIFT;
1102 user_size = vma->vm_end - vma->vm_start;
1089 1103
1090 /* Figure out which base address this is for. */
1091 largest_base = 0UL;
1092 for (i = 0; i <= PCI_ROM_RESOURCE; i++) { 1104 for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
1093 struct resource *rp = &dev->resource[i]; 1105 struct resource *rp = &pdev->resource[i];
1094 1106
1095 /* Active? */ 1107 /* Active? */
1096 if (!rp->flags) 1108 if (!rp->flags)
@@ -1108,26 +1120,14 @@ static int __pci_mmap_make_offset(struct pci_dev *dev, struct vm_area_struct *vm
1108 continue; 1120 continue;
1109 } 1121 }
1110 1122
1111 this_base = rp->start; 1123 if ((rp->start <= user_paddr) &&
1112 1124 (user_paddr + user_size) <= (rp->end + 1UL))
1113 addr32 = (this_base & PAGE_MASK) & pci_memspace_mask; 1125 break;
1114
1115 if (mmap_state == pci_mmap_io)
1116 addr32 &= 0xffffff;
1117
1118 if (addr32 <= user32 && this_base > largest_base)
1119 largest_base = this_base;
1120 } 1126 }
1121 1127
1122 if (largest_base == 0UL) 1128 if (i > PCI_ROM_RESOURCE)
1123 return -EINVAL; 1129 return -EINVAL;
1124 1130
1125 /* Now construct the final physical address. */
1126 if (mmap_state == pci_mmap_io)
1127 vma->vm_pgoff = (((largest_base & ~0xffffffUL) | user32) >> PAGE_SHIFT);
1128 else
1129 vma->vm_pgoff = (((largest_base & ~(pci_memspace_mask)) | user32) >> PAGE_SHIFT);
1130
1131 return 0; 1131 return 0;
1132} 1132}
1133 1133
diff --git a/arch/sparc64/kernel/pci_fire.c b/arch/sparc64/kernel/pci_fire.c
index 14d67fe21ab2..fef3b37487bf 100644
--- a/arch/sparc64/kernel/pci_fire.c
+++ b/arch/sparc64/kernel/pci_fire.c
@@ -6,9 +6,12 @@
6#include <linux/pci.h> 6#include <linux/pci.h>
7#include <linux/slab.h> 7#include <linux/slab.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/msi.h>
10#include <linux/irq.h>
9 11
10#include <asm/oplib.h> 12#include <asm/oplib.h>
11#include <asm/prom.h> 13#include <asm/prom.h>
14#include <asm/irq.h>
12 15
13#include "pci_impl.h" 16#include "pci_impl.h"
14 17
@@ -84,6 +87,266 @@ static int pci_fire_pbm_iommu_init(struct pci_pbm_info *pbm)
84 return 0; 87 return 0;
85} 88}
86 89
90#ifdef CONFIG_PCI_MSI
91struct pci_msiq_entry {
92 u64 word0;
93#define MSIQ_WORD0_RESV 0x8000000000000000UL
94#define MSIQ_WORD0_FMT_TYPE 0x7f00000000000000UL
95#define MSIQ_WORD0_FMT_TYPE_SHIFT 56
96#define MSIQ_WORD0_LEN 0x00ffc00000000000UL
97#define MSIQ_WORD0_LEN_SHIFT 46
98#define MSIQ_WORD0_ADDR0 0x00003fff00000000UL
99#define MSIQ_WORD0_ADDR0_SHIFT 32
100#define MSIQ_WORD0_RID 0x00000000ffff0000UL
101#define MSIQ_WORD0_RID_SHIFT 16
102#define MSIQ_WORD0_DATA0 0x000000000000ffffUL
103#define MSIQ_WORD0_DATA0_SHIFT 0
104
105#define MSIQ_TYPE_MSG 0x6
106#define MSIQ_TYPE_MSI32 0xb
107#define MSIQ_TYPE_MSI64 0xf
108
109 u64 word1;
110#define MSIQ_WORD1_ADDR1 0xffffffffffff0000UL
111#define MSIQ_WORD1_ADDR1_SHIFT 16
112#define MSIQ_WORD1_DATA1 0x000000000000ffffUL
113#define MSIQ_WORD1_DATA1_SHIFT 0
114
115 u64 resv[6];
116};
117
118/* All MSI registers are offset from pbm->pbm_regs */
119#define EVENT_QUEUE_BASE_ADDR_REG 0x010000UL
120#define EVENT_QUEUE_BASE_ADDR_ALL_ONES 0xfffc000000000000UL
121
122#define EVENT_QUEUE_CONTROL_SET(EQ) (0x011000UL + (EQ) * 0x8UL)
123#define EVENT_QUEUE_CONTROL_SET_OFLOW 0x0200000000000000UL
124#define EVENT_QUEUE_CONTROL_SET_EN 0x0000100000000000UL
125
126#define EVENT_QUEUE_CONTROL_CLEAR(EQ) (0x011200UL + (EQ) * 0x8UL)
127#define EVENT_QUEUE_CONTROL_CLEAR_OF 0x0200000000000000UL
128#define EVENT_QUEUE_CONTROL_CLEAR_E2I 0x0000800000000000UL
129#define EVENT_QUEUE_CONTROL_CLEAR_DIS 0x0000100000000000UL
130
131#define EVENT_QUEUE_STATE(EQ) (0x011400UL + (EQ) * 0x8UL)
132#define EVENT_QUEUE_STATE_MASK 0x0000000000000007UL
133#define EVENT_QUEUE_STATE_IDLE 0x0000000000000001UL
134#define EVENT_QUEUE_STATE_ACTIVE 0x0000000000000002UL
135#define EVENT_QUEUE_STATE_ERROR 0x0000000000000004UL
136
137#define EVENT_QUEUE_TAIL(EQ) (0x011600UL + (EQ) * 0x8UL)
138#define EVENT_QUEUE_TAIL_OFLOW 0x0200000000000000UL
139#define EVENT_QUEUE_TAIL_VAL 0x000000000000007fUL
140
141#define EVENT_QUEUE_HEAD(EQ) (0x011800UL + (EQ) * 0x8UL)
142#define EVENT_QUEUE_HEAD_VAL 0x000000000000007fUL
143
144#define MSI_MAP(MSI) (0x020000UL + (MSI) * 0x8UL)
145#define MSI_MAP_VALID 0x8000000000000000UL
146#define MSI_MAP_EQWR_N 0x4000000000000000UL
147#define MSI_MAP_EQNUM 0x000000000000003fUL
148
149#define MSI_CLEAR(MSI) (0x028000UL + (MSI) * 0x8UL)
150#define MSI_CLEAR_EQWR_N 0x4000000000000000UL
151
152#define IMONDO_DATA0 0x02C000UL
153#define IMONDO_DATA0_DATA 0xffffffffffffffc0UL
154
155#define IMONDO_DATA1 0x02C008UL
156#define IMONDO_DATA1_DATA 0xffffffffffffffffUL
157
158#define MSI_32BIT_ADDR 0x034000UL
159#define MSI_32BIT_ADDR_VAL 0x00000000ffff0000UL
160
161#define MSI_64BIT_ADDR 0x034008UL
162#define MSI_64BIT_ADDR_VAL 0xffffffffffff0000UL
163
164static int pci_fire_get_head(struct pci_pbm_info *pbm, unsigned long msiqid,
165 unsigned long *head)
166{
167 *head = fire_read(pbm->pbm_regs + EVENT_QUEUE_HEAD(msiqid));
168 return 0;
169}
170
171static int pci_fire_dequeue_msi(struct pci_pbm_info *pbm, unsigned long msiqid,
172 unsigned long *head, unsigned long *msi)
173{
174 unsigned long type_fmt, type, msi_num;
175 struct pci_msiq_entry *base, *ep;
176
177 base = (pbm->msi_queues + ((msiqid - pbm->msiq_first) * 8192));
178 ep = &base[*head];
179
180 if ((ep->word0 & MSIQ_WORD0_FMT_TYPE) == 0)
181 return 0;
182
183 type_fmt = ((ep->word0 & MSIQ_WORD0_FMT_TYPE) >>
184 MSIQ_WORD0_FMT_TYPE_SHIFT);
185 type = (type_fmt >> 3);
186 if (unlikely(type != MSIQ_TYPE_MSI32 &&
187 type != MSIQ_TYPE_MSI64))
188 return -EINVAL;
189
190 *msi = msi_num = ((ep->word0 & MSIQ_WORD0_DATA0) >>
191 MSIQ_WORD0_DATA0_SHIFT);
192
193 fire_write(pbm->pbm_regs + MSI_CLEAR(msi_num),
194 MSI_CLEAR_EQWR_N);
195
196 /* Clear the entry. */
197 ep->word0 &= ~MSIQ_WORD0_FMT_TYPE;
198
199 /* Go to next entry in ring. */
200 (*head)++;
201 if (*head >= pbm->msiq_ent_count)
202 *head = 0;
203
204 return 1;
205}
206
207static int pci_fire_set_head(struct pci_pbm_info *pbm, unsigned long msiqid,
208 unsigned long head)
209{
210 fire_write(pbm->pbm_regs + EVENT_QUEUE_HEAD(msiqid), head);
211 return 0;
212}
213
214static int pci_fire_msi_setup(struct pci_pbm_info *pbm, unsigned long msiqid,
215 unsigned long msi, int is_msi64)
216{
217 u64 val;
218
219 val = fire_read(pbm->pbm_regs + MSI_MAP(msi));
220 val &= ~(MSI_MAP_EQNUM);
221 val |= msiqid;
222 fire_write(pbm->pbm_regs + MSI_MAP(msi), val);
223
224 fire_write(pbm->pbm_regs + MSI_CLEAR(msi),
225 MSI_CLEAR_EQWR_N);
226
227 val = fire_read(pbm->pbm_regs + MSI_MAP(msi));
228 val |= MSI_MAP_VALID;
229 fire_write(pbm->pbm_regs + MSI_MAP(msi), val);
230
231 return 0;
232}
233
234static int pci_fire_msi_teardown(struct pci_pbm_info *pbm, unsigned long msi)
235{
236 unsigned long msiqid;
237 u64 val;
238
239 val = fire_read(pbm->pbm_regs + MSI_MAP(msi));
240 msiqid = (val & MSI_MAP_EQNUM);
241
242 val &= ~MSI_MAP_VALID;
243
244 fire_write(pbm->pbm_regs + MSI_MAP(msi), val);
245
246 return 0;
247}
248
249static int pci_fire_msiq_alloc(struct pci_pbm_info *pbm)
250{
251 unsigned long pages, order, i;
252
253 order = get_order(512 * 1024);
254 pages = __get_free_pages(GFP_KERNEL | __GFP_COMP, order);
255 if (pages == 0UL) {
256 printk(KERN_ERR "MSI: Cannot allocate MSI queues (o=%lu).\n",
257 order);
258 return -ENOMEM;
259 }
260 memset((char *)pages, 0, PAGE_SIZE << order);
261 pbm->msi_queues = (void *) pages;
262
263 fire_write(pbm->pbm_regs + EVENT_QUEUE_BASE_ADDR_REG,
264 (EVENT_QUEUE_BASE_ADDR_ALL_ONES |
265 __pa(pbm->msi_queues)));
266
267 fire_write(pbm->pbm_regs + IMONDO_DATA0,
268 pbm->portid << 6);
269 fire_write(pbm->pbm_regs + IMONDO_DATA1, 0);
270
271 fire_write(pbm->pbm_regs + MSI_32BIT_ADDR,
272 pbm->msi32_start);
273 fire_write(pbm->pbm_regs + MSI_64BIT_ADDR,
274 pbm->msi64_start);
275
276 for (i = 0; i < pbm->msiq_num; i++) {
277 fire_write(pbm->pbm_regs + EVENT_QUEUE_HEAD(i), 0);
278 fire_write(pbm->pbm_regs + EVENT_QUEUE_TAIL(i), 0);
279 }
280
281 return 0;
282}
283
284static void pci_fire_msiq_free(struct pci_pbm_info *pbm)
285{
286 unsigned long pages, order;
287
288 order = get_order(512 * 1024);
289 pages = (unsigned long) pbm->msi_queues;
290
291 free_pages(pages, order);
292
293 pbm->msi_queues = NULL;
294}
295
296static int pci_fire_msiq_build_irq(struct pci_pbm_info *pbm,
297 unsigned long msiqid,
298 unsigned long devino)
299{
300 unsigned long cregs = (unsigned long) pbm->pbm_regs;
301 unsigned long imap_reg, iclr_reg, int_ctrlr;
302 unsigned int virt_irq;
303 int fixup;
304 u64 val;
305
306 imap_reg = cregs + (0x001000UL + (devino * 0x08UL));
307 iclr_reg = cregs + (0x001400UL + (devino * 0x08UL));
308
309 /* XXX iterate amongst the 4 IRQ controllers XXX */
310 int_ctrlr = (1UL << 6);
311
312 val = fire_read(imap_reg);
313 val |= (1UL << 63) | int_ctrlr;
314 fire_write(imap_reg, val);
315
316 fixup = ((pbm->portid << 6) | devino) - int_ctrlr;
317
318 virt_irq = build_irq(fixup, iclr_reg, imap_reg);
319 if (!virt_irq)
320 return -ENOMEM;
321
322 fire_write(pbm->pbm_regs +
323 EVENT_QUEUE_CONTROL_SET(msiqid),
324 EVENT_QUEUE_CONTROL_SET_EN);
325
326 return virt_irq;
327}
328
329static const struct sparc64_msiq_ops pci_fire_msiq_ops = {
330 .get_head = pci_fire_get_head,
331 .dequeue_msi = pci_fire_dequeue_msi,
332 .set_head = pci_fire_set_head,
333 .msi_setup = pci_fire_msi_setup,
334 .msi_teardown = pci_fire_msi_teardown,
335 .msiq_alloc = pci_fire_msiq_alloc,
336 .msiq_free = pci_fire_msiq_free,
337 .msiq_build_irq = pci_fire_msiq_build_irq,
338};
339
340static void pci_fire_msi_init(struct pci_pbm_info *pbm)
341{
342 sparc64_pbm_msi_init(pbm, &pci_fire_msiq_ops);
343}
344#else /* CONFIG_PCI_MSI */
345static void pci_fire_msi_init(struct pci_pbm_info *pbm)
346{
347}
348#endif /* !(CONFIG_PCI_MSI) */
349
87/* Based at pbm->controller_regs */ 350/* Based at pbm->controller_regs */
88#define FIRE_PARITY_CONTROL 0x470010UL 351#define FIRE_PARITY_CONTROL 0x470010UL
89#define FIRE_PARITY_ENAB 0x8000000000000000UL 352#define FIRE_PARITY_ENAB 0x8000000000000000UL
@@ -176,6 +439,7 @@ static int pci_fire_pbm_init(struct pci_controller_info *p,
176{ 439{
177 const struct linux_prom64_registers *regs; 440 const struct linux_prom64_registers *regs;
178 struct pci_pbm_info *pbm; 441 struct pci_pbm_info *pbm;
442 int err;
179 443
180 if ((portid & 1) == 0) 444 if ((portid & 1) == 0)
181 pbm = &p->pbm_A; 445 pbm = &p->pbm_A;
@@ -208,7 +472,13 @@ static int pci_fire_pbm_init(struct pci_controller_info *p,
208 472
209 pci_fire_hw_init(pbm); 473 pci_fire_hw_init(pbm);
210 474
211 return pci_fire_pbm_iommu_init(pbm); 475 err = pci_fire_pbm_iommu_init(pbm);
476 if (err)
477 return err;
478
479 pci_fire_msi_init(pbm);
480
481 return 0;
212} 482}
213 483
214static inline int portid_compare(u32 x, u32 y) 484static inline int portid_compare(u32 x, u32 y)
@@ -249,13 +519,6 @@ void fire_pci_init(struct device_node *dp, const char *model_name)
249 519
250 p->pbm_B.iommu = iommu; 520 p->pbm_B.iommu = iommu;
251 521
252 /* XXX MSI support XXX */
253
254 /* Like PSYCHO and SCHIZO we have a 2GB aligned area
255 * for memory space.
256 */
257 pci_memspace_mask = 0x7fffffffUL;
258
259 if (pci_fire_pbm_init(p, dp, portid)) 522 if (pci_fire_pbm_init(p, dp, portid))
260 goto fatal_memory_error; 523 goto fatal_memory_error;
261 524
diff --git a/arch/sparc64/kernel/pci_impl.h b/arch/sparc64/kernel/pci_impl.h
index f660c2b685eb..4a50da13ce48 100644
--- a/arch/sparc64/kernel/pci_impl.h
+++ b/arch/sparc64/kernel/pci_impl.h
@@ -29,6 +29,33 @@
29#define PCI_STC_FLUSHFLAG_SET(STC) \ 29#define PCI_STC_FLUSHFLAG_SET(STC) \
30 (*((STC)->strbuf_flushflag) != 0UL) 30 (*((STC)->strbuf_flushflag) != 0UL)
31 31
32#ifdef CONFIG_PCI_MSI
33struct pci_pbm_info;
34struct sparc64_msiq_ops {
35 int (*get_head)(struct pci_pbm_info *pbm, unsigned long msiqid,
36 unsigned long *head);
37 int (*dequeue_msi)(struct pci_pbm_info *pbm, unsigned long msiqid,
38 unsigned long *head, unsigned long *msi);
39 int (*set_head)(struct pci_pbm_info *pbm, unsigned long msiqid,
40 unsigned long head);
41 int (*msi_setup)(struct pci_pbm_info *pbm, unsigned long msiqid,
42 unsigned long msi, int is_msi64);
43 int (*msi_teardown)(struct pci_pbm_info *pbm, unsigned long msi);
44 int (*msiq_alloc)(struct pci_pbm_info *pbm);
45 void (*msiq_free)(struct pci_pbm_info *pbm);
46 int (*msiq_build_irq)(struct pci_pbm_info *pbm, unsigned long msiqid,
47 unsigned long devino);
48};
49
50extern void sparc64_pbm_msi_init(struct pci_pbm_info *pbm,
51 const struct sparc64_msiq_ops *ops);
52
53struct sparc64_msiq_cookie {
54 struct pci_pbm_info *pbm;
55 unsigned long msiqid;
56};
57#endif
58
32struct pci_controller_info; 59struct pci_controller_info;
33 60
34struct pci_pbm_info { 61struct pci_pbm_info {
@@ -90,6 +117,8 @@ struct pci_pbm_info {
90 u32 msiq_ent_count; 117 u32 msiq_ent_count;
91 u32 msiq_first; 118 u32 msiq_first;
92 u32 msiq_first_devino; 119 u32 msiq_first_devino;
120 u32 msiq_rotor;
121 struct sparc64_msiq_cookie *msiq_irq_cookies;
93 u32 msi_num; 122 u32 msi_num;
94 u32 msi_first; 123 u32 msi_first;
95 u32 msi_data_mask; 124 u32 msi_data_mask;
@@ -100,9 +129,11 @@ struct pci_pbm_info {
100 u32 msi64_len; 129 u32 msi64_len;
101 void *msi_queues; 130 void *msi_queues;
102 unsigned long *msi_bitmap; 131 unsigned long *msi_bitmap;
132 unsigned int *msi_irq_table;
103 int (*setup_msi_irq)(unsigned int *virt_irq_p, struct pci_dev *pdev, 133 int (*setup_msi_irq)(unsigned int *virt_irq_p, struct pci_dev *pdev,
104 struct msi_desc *entry); 134 struct msi_desc *entry);
105 void (*teardown_msi_irq)(unsigned int virt_irq, struct pci_dev *pdev); 135 void (*teardown_msi_irq)(unsigned int virt_irq, struct pci_dev *pdev);
136 const struct sparc64_msiq_ops *msi_ops;
106#endif /* !(CONFIG_PCI_MSI) */ 137#endif /* !(CONFIG_PCI_MSI) */
107 138
108 /* This PBM's streaming buffer. */ 139 /* This PBM's streaming buffer. */
@@ -126,7 +157,6 @@ struct pci_controller_info {
126}; 157};
127 158
128extern struct pci_pbm_info *pci_pbm_root; 159extern struct pci_pbm_info *pci_pbm_root;
129extern unsigned long pci_memspace_mask;
130 160
131extern int pci_num_pbms; 161extern int pci_num_pbms;
132 162
diff --git a/arch/sparc64/kernel/pci_msi.c b/arch/sparc64/kernel/pci_msi.c
new file mode 100644
index 000000000000..31a165fd3e48
--- /dev/null
+++ b/arch/sparc64/kernel/pci_msi.c
@@ -0,0 +1,433 @@
1/* pci_msi.c: Sparc64 MSI support common layer.
2 *
3 * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
4 */
5#include <linux/kernel.h>
6#include <linux/interrupt.h>
7#include <linux/irq.h>
8
9#include "pci_impl.h"
10
11static irqreturn_t sparc64_msiq_interrupt(int irq, void *cookie)
12{
13 struct sparc64_msiq_cookie *msiq_cookie = cookie;
14 struct pci_pbm_info *pbm = msiq_cookie->pbm;
15 unsigned long msiqid = msiq_cookie->msiqid;
16 const struct sparc64_msiq_ops *ops;
17 unsigned long orig_head, head;
18 int err;
19
20 ops = pbm->msi_ops;
21
22 err = ops->get_head(pbm, msiqid, &head);
23 if (unlikely(err < 0))
24 goto err_get_head;
25
26 orig_head = head;
27 for (;;) {
28 unsigned long msi;
29
30 err = ops->dequeue_msi(pbm, msiqid, &head, &msi);
31 if (likely(err > 0))
32 __do_IRQ(pbm->msi_irq_table[msi - pbm->msi_first]);
33
34 if (unlikely(err < 0))
35 goto err_dequeue;
36
37 if (err == 0)
38 break;
39 }
40 if (likely(head != orig_head)) {
41 err = ops->set_head(pbm, msiqid, head);
42 if (unlikely(err < 0))
43 goto err_set_head;
44 }
45 return IRQ_HANDLED;
46
47err_get_head:
48 printk(KERN_EMERG "MSI: Get head on msiqid[%lu] gives error %d\n",
49 msiqid, err);
50 goto err_out;
51
52err_dequeue:
53 printk(KERN_EMERG "MSI: Dequeue head[%lu] from msiqid[%lu] "
54 "gives error %d\n",
55 head, msiqid, err);
56 goto err_out;
57
58err_set_head:
59 printk(KERN_EMERG "MSI: Set head[%lu] on msiqid[%lu] "
60 "gives error %d\n",
61 head, msiqid, err);
62 goto err_out;
63
64err_out:
65 return IRQ_NONE;
66}
67
68static u32 pick_msiq(struct pci_pbm_info *pbm)
69{
70 static DEFINE_SPINLOCK(rotor_lock);
71 unsigned long flags;
72 u32 ret, rotor;
73
74 spin_lock_irqsave(&rotor_lock, flags);
75
76 rotor = pbm->msiq_rotor;
77 ret = pbm->msiq_first + rotor;
78
79 if (++rotor >= pbm->msiq_num)
80 rotor = 0;
81 pbm->msiq_rotor = rotor;
82
83 spin_unlock_irqrestore(&rotor_lock, flags);
84
85 return ret;
86}
87
88
89static int alloc_msi(struct pci_pbm_info *pbm)
90{
91 int i;
92
93 for (i = 0; i < pbm->msi_num; i++) {
94 if (!test_and_set_bit(i, pbm->msi_bitmap))
95 return i + pbm->msi_first;
96 }
97
98 return -ENOENT;
99}
100
101static void free_msi(struct pci_pbm_info *pbm, int msi_num)
102{
103 msi_num -= pbm->msi_first;
104 clear_bit(msi_num, pbm->msi_bitmap);
105}
106
107static struct irq_chip msi_irq = {
108 .typename = "PCI-MSI",
109 .mask = mask_msi_irq,
110 .unmask = unmask_msi_irq,
111 .enable = unmask_msi_irq,
112 .disable = mask_msi_irq,
113 /* XXX affinity XXX */
114};
115
116int sparc64_setup_msi_irq(unsigned int *virt_irq_p,
117 struct pci_dev *pdev,
118 struct msi_desc *entry)
119{
120 struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller;
121 const struct sparc64_msiq_ops *ops = pbm->msi_ops;
122 struct msi_msg msg;
123 int msi, err;
124 u32 msiqid;
125
126 *virt_irq_p = virt_irq_alloc(0, 0);
127 err = -ENOMEM;
128 if (!*virt_irq_p)
129 goto out_err;
130
131 set_irq_chip(*virt_irq_p, &msi_irq);
132
133 err = alloc_msi(pbm);
134 if (unlikely(err < 0))
135 goto out_virt_irq_free;
136
137 msi = err;
138
139 msiqid = pick_msiq(pbm);
140
141 err = ops->msi_setup(pbm, msiqid, msi,
142 (entry->msi_attrib.is_64 ? 1 : 0));
143 if (err)
144 goto out_msi_free;
145
146 pbm->msi_irq_table[msi - pbm->msi_first] = *virt_irq_p;
147
148 if (entry->msi_attrib.is_64) {
149 msg.address_hi = pbm->msi64_start >> 32;
150 msg.address_lo = pbm->msi64_start & 0xffffffff;
151 } else {
152 msg.address_hi = 0;
153 msg.address_lo = pbm->msi32_start;
154 }
155 msg.data = msi;
156
157 set_irq_msi(*virt_irq_p, entry);
158 write_msi_msg(*virt_irq_p, &msg);
159
160 return 0;
161
162out_msi_free:
163 free_msi(pbm, msi);
164
165out_virt_irq_free:
166 set_irq_chip(*virt_irq_p, NULL);
167 virt_irq_free(*virt_irq_p);
168 *virt_irq_p = 0;
169
170out_err:
171 return err;
172}
173
174void sparc64_teardown_msi_irq(unsigned int virt_irq,
175 struct pci_dev *pdev)
176{
177 struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller;
178 const struct sparc64_msiq_ops *ops = pbm->msi_ops;
179 unsigned int msi_num;
180 int i, err;
181
182 for (i = 0; i < pbm->msi_num; i++) {
183 if (pbm->msi_irq_table[i] == virt_irq)
184 break;
185 }
186 if (i >= pbm->msi_num) {
187 printk(KERN_ERR "%s: teardown: No MSI for irq %u\n",
188 pbm->name, virt_irq);
189 return;
190 }
191
192 msi_num = pbm->msi_first + i;
193 pbm->msi_irq_table[i] = ~0U;
194
195 err = ops->msi_teardown(pbm, msi_num);
196 if (err) {
197 printk(KERN_ERR "%s: teardown: ops->teardown() on MSI %u, "
198 "irq %u, gives error %d\n",
199 pbm->name, msi_num, virt_irq, err);
200 return;
201 }
202
203 free_msi(pbm, msi_num);
204
205 set_irq_chip(virt_irq, NULL);
206 virt_irq_free(virt_irq);
207}
208
209static int msi_bitmap_alloc(struct pci_pbm_info *pbm)
210{
211 unsigned long size, bits_per_ulong;
212
213 bits_per_ulong = sizeof(unsigned long) * 8;
214 size = (pbm->msi_num + (bits_per_ulong - 1)) & ~(bits_per_ulong - 1);
215 size /= 8;
216 BUG_ON(size % sizeof(unsigned long));
217
218 pbm->msi_bitmap = kzalloc(size, GFP_KERNEL);
219 if (!pbm->msi_bitmap)
220 return -ENOMEM;
221
222 return 0;
223}
224
225static void msi_bitmap_free(struct pci_pbm_info *pbm)
226{
227 kfree(pbm->msi_bitmap);
228 pbm->msi_bitmap = NULL;
229}
230
231static int msi_table_alloc(struct pci_pbm_info *pbm)
232{
233 int size, i;
234
235 size = pbm->msiq_num * sizeof(struct sparc64_msiq_cookie);
236 pbm->msiq_irq_cookies = kzalloc(size, GFP_KERNEL);
237 if (!pbm->msiq_irq_cookies)
238 return -ENOMEM;
239
240 for (i = 0; i < pbm->msiq_num; i++) {
241 struct sparc64_msiq_cookie *p;
242
243 p = &pbm->msiq_irq_cookies[i];
244 p->pbm = pbm;
245 p->msiqid = pbm->msiq_first + i;
246 }
247
248 size = pbm->msi_num * sizeof(unsigned int);
249 pbm->msi_irq_table = kzalloc(size, GFP_KERNEL);
250 if (!pbm->msi_irq_table) {
251 kfree(pbm->msiq_irq_cookies);
252 pbm->msiq_irq_cookies = NULL;
253 return -ENOMEM;
254 }
255
256 return 0;
257}
258
259static void msi_table_free(struct pci_pbm_info *pbm)
260{
261 kfree(pbm->msiq_irq_cookies);
262 pbm->msiq_irq_cookies = NULL;
263
264 kfree(pbm->msi_irq_table);
265 pbm->msi_irq_table = NULL;
266}
267
268static int bringup_one_msi_queue(struct pci_pbm_info *pbm,
269 const struct sparc64_msiq_ops *ops,
270 unsigned long msiqid,
271 unsigned long devino)
272{
273 int irq = ops->msiq_build_irq(pbm, msiqid, devino);
274 int err;
275
276 if (irq < 0)
277 return irq;
278
279 err = request_irq(irq, sparc64_msiq_interrupt, 0,
280 "MSIQ",
281 &pbm->msiq_irq_cookies[msiqid - pbm->msiq_first]);
282 if (err)
283 return err;
284
285 return 0;
286}
287
288static int sparc64_bringup_msi_queues(struct pci_pbm_info *pbm,
289 const struct sparc64_msiq_ops *ops)
290{
291 int i;
292
293 for (i = 0; i < pbm->msiq_num; i++) {
294 unsigned long msiqid = i + pbm->msiq_first;
295 unsigned long devino = i + pbm->msiq_first_devino;
296 int err;
297
298 err = bringup_one_msi_queue(pbm, ops, msiqid, devino);
299 if (err)
300 return err;
301 }
302
303 return 0;
304}
305
306void sparc64_pbm_msi_init(struct pci_pbm_info *pbm,
307 const struct sparc64_msiq_ops *ops)
308{
309 const u32 *val;
310 int len;
311
312 val = of_get_property(pbm->prom_node, "#msi-eqs", &len);
313 if (!val || len != 4)
314 goto no_msi;
315 pbm->msiq_num = *val;
316 if (pbm->msiq_num) {
317 const struct msiq_prop {
318 u32 first_msiq;
319 u32 num_msiq;
320 u32 first_devino;
321 } *mqp;
322 const struct msi_range_prop {
323 u32 first_msi;
324 u32 num_msi;
325 } *mrng;
326 const struct addr_range_prop {
327 u32 msi32_high;
328 u32 msi32_low;
329 u32 msi32_len;
330 u32 msi64_high;
331 u32 msi64_low;
332 u32 msi64_len;
333 } *arng;
334
335 val = of_get_property(pbm->prom_node, "msi-eq-size", &len);
336 if (!val || len != 4)
337 goto no_msi;
338
339 pbm->msiq_ent_count = *val;
340
341 mqp = of_get_property(pbm->prom_node,
342 "msi-eq-to-devino", &len);
343 if (!mqp)
344 mqp = of_get_property(pbm->prom_node,
345 "msi-eq-devino", &len);
346 if (!mqp || len != sizeof(struct msiq_prop))
347 goto no_msi;
348
349 pbm->msiq_first = mqp->first_msiq;
350 pbm->msiq_first_devino = mqp->first_devino;
351
352 val = of_get_property(pbm->prom_node, "#msi", &len);
353 if (!val || len != 4)
354 goto no_msi;
355 pbm->msi_num = *val;
356
357 mrng = of_get_property(pbm->prom_node, "msi-ranges", &len);
358 if (!mrng || len != sizeof(struct msi_range_prop))
359 goto no_msi;
360 pbm->msi_first = mrng->first_msi;
361
362 val = of_get_property(pbm->prom_node, "msi-data-mask", &len);
363 if (!val || len != 4)
364 goto no_msi;
365 pbm->msi_data_mask = *val;
366
367 val = of_get_property(pbm->prom_node, "msix-data-width", &len);
368 if (!val || len != 4)
369 goto no_msi;
370 pbm->msix_data_width = *val;
371
372 arng = of_get_property(pbm->prom_node, "msi-address-ranges",
373 &len);
374 if (!arng || len != sizeof(struct addr_range_prop))
375 goto no_msi;
376 pbm->msi32_start = ((u64)arng->msi32_high << 32) |
377 (u64) arng->msi32_low;
378 pbm->msi64_start = ((u64)arng->msi64_high << 32) |
379 (u64) arng->msi64_low;
380 pbm->msi32_len = arng->msi32_len;
381 pbm->msi64_len = arng->msi64_len;
382
383 if (msi_bitmap_alloc(pbm))
384 goto no_msi;
385
386 if (msi_table_alloc(pbm)) {
387 msi_bitmap_free(pbm);
388 goto no_msi;
389 }
390
391 if (ops->msiq_alloc(pbm)) {
392 msi_table_free(pbm);
393 msi_bitmap_free(pbm);
394 goto no_msi;
395 }
396
397 if (sparc64_bringup_msi_queues(pbm, ops)) {
398 ops->msiq_free(pbm);
399 msi_table_free(pbm);
400 msi_bitmap_free(pbm);
401 goto no_msi;
402 }
403
404 printk(KERN_INFO "%s: MSI Queue first[%u] num[%u] count[%u] "
405 "devino[0x%x]\n",
406 pbm->name,
407 pbm->msiq_first, pbm->msiq_num,
408 pbm->msiq_ent_count,
409 pbm->msiq_first_devino);
410 printk(KERN_INFO "%s: MSI first[%u] num[%u] mask[0x%x] "
411 "width[%u]\n",
412 pbm->name,
413 pbm->msi_first, pbm->msi_num, pbm->msi_data_mask,
414 pbm->msix_data_width);
415 printk(KERN_INFO "%s: MSI addr32[0x%lx:0x%x] "
416 "addr64[0x%lx:0x%x]\n",
417 pbm->name,
418 pbm->msi32_start, pbm->msi32_len,
419 pbm->msi64_start, pbm->msi64_len);
420 printk(KERN_INFO "%s: MSI queues at RA [%016lx]\n",
421 pbm->name,
422 __pa(pbm->msi_queues));
423
424 pbm->msi_ops = ops;
425 pbm->setup_msi_irq = sparc64_setup_msi_irq;
426 pbm->teardown_msi_irq = sparc64_teardown_msi_irq;
427 }
428 return;
429
430no_msi:
431 pbm->msiq_num = 0;
432 printk(KERN_INFO "%s: No MSI support.\n", pbm->name);
433}
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c
index b6b4cfea5b5f..d27ee5d528a2 100644
--- a/arch/sparc64/kernel/pci_psycho.c
+++ b/arch/sparc64/kernel/pci_psycho.c
@@ -1058,12 +1058,6 @@ void psycho_init(struct device_node *dp, char *model_name)
1058 p->pbm_A.config_space = p->pbm_B.config_space = 1058 p->pbm_A.config_space = p->pbm_B.config_space =
1059 (pr_regs[2].phys_addr + PSYCHO_CONFIGSPACE); 1059 (pr_regs[2].phys_addr + PSYCHO_CONFIGSPACE);
1060 1060
1061 /*
1062 * Psycho's PCI MEM space is mapped to a 2GB aligned area, so
1063 * we need to adjust our MEM space mask.
1064 */
1065 pci_memspace_mask = 0x7fffffffUL;
1066
1067 psycho_controller_hwinit(&p->pbm_A); 1061 psycho_controller_hwinit(&p->pbm_A);
1068 1062
1069 if (psycho_iommu_init(&p->pbm_A)) 1063 if (psycho_iommu_init(&p->pbm_A))
diff --git a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc64/kernel/pci_schizo.c
index 3c30bfa1f3a3..9546ba9f5dee 100644
--- a/arch/sparc64/kernel/pci_schizo.c
+++ b/arch/sparc64/kernel/pci_schizo.c
@@ -1464,9 +1464,6 @@ static void __schizo_init(struct device_node *dp, char *model_name, int chip_typ
1464 1464
1465 p->pbm_B.iommu = iommu; 1465 p->pbm_B.iommu = iommu;
1466 1466
1467 /* Like PSYCHO we have a 2GB aligned area for memory space. */
1468 pci_memspace_mask = 0x7fffffffUL;
1469
1470 if (schizo_pbm_init(p, dp, portid, chip_type)) 1467 if (schizo_pbm_init(p, dp, portid, chip_type))
1471 goto fatal_memory_error; 1468 goto fatal_memory_error;
1472 1469
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
index da724b13e89e..cacacfae5451 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc64/kernel/pci_sun4v.c
@@ -13,6 +13,7 @@
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/msi.h> 14#include <linux/msi.h>
15#include <linux/log2.h> 15#include <linux/log2.h>
16#include <linux/scatterlist.h>
16 17
17#include <asm/iommu.h> 18#include <asm/iommu.h>
18#include <asm/irq.h> 19#include <asm/irq.h>
@@ -373,7 +374,7 @@ static inline long fill_sg(long entry, struct device *dev,
373 int nused, int nelems, unsigned long prot) 374 int nused, int nelems, unsigned long prot)
374{ 375{
375 struct scatterlist *dma_sg = sg; 376 struct scatterlist *dma_sg = sg;
376 struct scatterlist *sg_end = sg + nelems; 377 struct scatterlist *sg_end = sg_last(sg, nelems);
377 unsigned long flags; 378 unsigned long flags;
378 int i; 379 int i;
379 380
@@ -413,7 +414,7 @@ static inline long fill_sg(long entry, struct device *dev,
413 len -= (IO_PAGE_SIZE - (tmp & (IO_PAGE_SIZE - 1UL))); 414 len -= (IO_PAGE_SIZE - (tmp & (IO_PAGE_SIZE - 1UL)));
414 break; 415 break;
415 } 416 }
416 sg++; 417 sg = sg_next(sg);
417 } 418 }
418 419
419 pteval = (pteval & IOPTE_PAGE); 420 pteval = (pteval & IOPTE_PAGE);
@@ -431,24 +432,25 @@ static inline long fill_sg(long entry, struct device *dev,
431 } 432 }
432 433
433 pteval = (pteval & IOPTE_PAGE) + len; 434 pteval = (pteval & IOPTE_PAGE) + len;
434 sg++; 435 sg = sg_next(sg);
435 436
436 /* Skip over any tail mappings we've fully mapped, 437 /* Skip over any tail mappings we've fully mapped,
437 * adjusting pteval along the way. Stop when we 438 * adjusting pteval along the way. Stop when we
438 * detect a page crossing event. 439 * detect a page crossing event.
439 */ 440 */
440 while (sg < sg_end && 441 while ((pteval << (64 - IO_PAGE_SHIFT)) != 0UL &&
441 (pteval << (64 - IO_PAGE_SHIFT)) != 0UL &&
442 (pteval == SG_ENT_PHYS_ADDRESS(sg)) && 442 (pteval == SG_ENT_PHYS_ADDRESS(sg)) &&
443 ((pteval ^ 443 ((pteval ^
444 (SG_ENT_PHYS_ADDRESS(sg) + sg->length - 1UL)) >> IO_PAGE_SHIFT) == 0UL) { 444 (SG_ENT_PHYS_ADDRESS(sg) + sg->length - 1UL)) >> IO_PAGE_SHIFT) == 0UL) {
445 pteval += sg->length; 445 pteval += sg->length;
446 sg++; 446 if (sg == sg_end)
447 break;
448 sg = sg_next(sg);
447 } 449 }
448 if ((pteval << (64 - IO_PAGE_SHIFT)) == 0UL) 450 if ((pteval << (64 - IO_PAGE_SHIFT)) == 0UL)
449 pteval = ~0UL; 451 pteval = ~0UL;
450 } while (dma_npages != 0); 452 } while (dma_npages != 0);
451 dma_sg++; 453 dma_sg = sg_next(dma_sg);
452 } 454 }
453 455
454 if (unlikely(iommu_batch_end() < 0L)) 456 if (unlikely(iommu_batch_end() < 0L))
@@ -510,7 +512,7 @@ static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist,
510 sgtmp = sglist; 512 sgtmp = sglist;
511 while (used && sgtmp->dma_length) { 513 while (used && sgtmp->dma_length) {
512 sgtmp->dma_address += dma_base; 514 sgtmp->dma_address += dma_base;
513 sgtmp++; 515 sgtmp = sg_next(sgtmp);
514 used--; 516 used--;
515 } 517 }
516 used = nelems - used; 518 used = nelems - used;
@@ -545,6 +547,7 @@ static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist,
545 struct pci_pbm_info *pbm; 547 struct pci_pbm_info *pbm;
546 struct iommu *iommu; 548 struct iommu *iommu;
547 unsigned long flags, i, npages; 549 unsigned long flags, i, npages;
550 struct scatterlist *sg, *sgprv;
548 long entry; 551 long entry;
549 u32 devhandle, bus_addr; 552 u32 devhandle, bus_addr;
550 553
@@ -558,12 +561,15 @@ static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist,
558 devhandle = pbm->devhandle; 561 devhandle = pbm->devhandle;
559 562
560 bus_addr = sglist->dma_address & IO_PAGE_MASK; 563 bus_addr = sglist->dma_address & IO_PAGE_MASK;
561 564 sgprv = NULL;
562 for (i = 1; i < nelems; i++) 565 for_each_sg(sglist, sg, nelems, i) {
563 if (sglist[i].dma_length == 0) 566 if (sg->dma_length == 0)
564 break; 567 break;
565 i--; 568
566 npages = (IO_PAGE_ALIGN(sglist[i].dma_address + sglist[i].dma_length) - 569 sgprv = sg;
570 }
571
572 npages = (IO_PAGE_ALIGN(sgprv->dma_address + sgprv->dma_length) -
567 bus_addr) >> IO_PAGE_SHIFT; 573 bus_addr) >> IO_PAGE_SHIFT;
568 574
569 entry = ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT); 575 entry = ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT);
@@ -748,111 +754,102 @@ struct pci_sun4v_msiq_entry {
748 u64 reserved2; 754 u64 reserved2;
749}; 755};
750 756
751/* For now this just runs as a pre-handler for the real interrupt handler. 757static int pci_sun4v_get_head(struct pci_pbm_info *pbm, unsigned long msiqid,
752 * So we just walk through the queue and ACK all the entries, update the 758 unsigned long *head)
753 * head pointer, and return.
754 *
755 * In the longer term it would be nice to do something more integrated
756 * wherein we can pass in some of this MSI info to the drivers. This
757 * would be most useful for PCIe fabric error messages, although we could
758 * invoke those directly from the loop here in order to pass the info around.
759 */
760static void pci_sun4v_msi_prehandler(unsigned int ino, void *data1, void *data2)
761{ 759{
762 struct pci_pbm_info *pbm = data1; 760 unsigned long err, limit;
763 struct pci_sun4v_msiq_entry *base, *ep;
764 unsigned long msiqid, orig_head, head, type, err;
765
766 msiqid = (unsigned long) data2;
767 761
768 head = 0xdeadbeef; 762 err = pci_sun4v_msiq_gethead(pbm->devhandle, msiqid, head);
769 err = pci_sun4v_msiq_gethead(pbm->devhandle, msiqid, &head);
770 if (unlikely(err)) 763 if (unlikely(err))
771 goto hv_error_get; 764 return -ENXIO;
772
773 if (unlikely(head >= (pbm->msiq_ent_count * sizeof(struct pci_sun4v_msiq_entry))))
774 goto bad_offset;
775
776 head /= sizeof(struct pci_sun4v_msiq_entry);
777 orig_head = head;
778 base = (pbm->msi_queues + ((msiqid - pbm->msiq_first) *
779 (pbm->msiq_ent_count *
780 sizeof(struct pci_sun4v_msiq_entry))));
781 ep = &base[head];
782 while ((ep->version_type & MSIQ_TYPE_MASK) != 0) {
783 type = (ep->version_type & MSIQ_TYPE_MASK) >> MSIQ_TYPE_SHIFT;
784 if (unlikely(type != MSIQ_TYPE_MSI32 &&
785 type != MSIQ_TYPE_MSI64))
786 goto bad_type;
787
788 pci_sun4v_msi_setstate(pbm->devhandle,
789 ep->msi_data /* msi_num */,
790 HV_MSISTATE_IDLE);
791
792 /* Clear the entry. */
793 ep->version_type &= ~MSIQ_TYPE_MASK;
794
795 /* Go to next entry in ring. */
796 head++;
797 if (head >= pbm->msiq_ent_count)
798 head = 0;
799 ep = &base[head];
800 }
801 765
802 if (likely(head != orig_head)) { 766 limit = pbm->msiq_ent_count * sizeof(struct pci_sun4v_msiq_entry);
803 /* ACK entries by updating head pointer. */ 767 if (unlikely(*head >= limit))
804 head *= sizeof(struct pci_sun4v_msiq_entry); 768 return -EFBIG;
805 err = pci_sun4v_msiq_sethead(pbm->devhandle, msiqid, head);
806 if (unlikely(err))
807 goto hv_error_set;
808 }
809 return;
810 769
811hv_error_set: 770 return 0;
812 printk(KERN_EMERG "MSI: Hypervisor set head gives error %lu\n", err); 771}
813 goto hv_error_cont;
814 772
815hv_error_get: 773static int pci_sun4v_dequeue_msi(struct pci_pbm_info *pbm,
816 printk(KERN_EMERG "MSI: Hypervisor get head gives error %lu\n", err); 774 unsigned long msiqid, unsigned long *head,
775 unsigned long *msi)
776{
777 struct pci_sun4v_msiq_entry *ep;
778 unsigned long err, type;
817 779
818hv_error_cont: 780 /* Note: void pointer arithmetic, 'head' is a byte offset */
819 printk(KERN_EMERG "MSI: devhandle[%x] msiqid[%lx] head[%lu]\n", 781 ep = (pbm->msi_queues + ((msiqid - pbm->msiq_first) *
820 pbm->devhandle, msiqid, head); 782 (pbm->msiq_ent_count *
821 return; 783 sizeof(struct pci_sun4v_msiq_entry))) +
784 *head);
822 785
823bad_offset: 786 if ((ep->version_type & MSIQ_TYPE_MASK) == 0)
824 printk(KERN_EMERG "MSI: Hypervisor gives bad offset %lx max(%lx)\n", 787 return 0;
825 head, pbm->msiq_ent_count * sizeof(struct pci_sun4v_msiq_entry));
826 return;
827 788
828bad_type: 789 type = (ep->version_type & MSIQ_TYPE_MASK) >> MSIQ_TYPE_SHIFT;
829 printk(KERN_EMERG "MSI: Entry has bad type %lx\n", type); 790 if (unlikely(type != MSIQ_TYPE_MSI32 &&
830 return; 791 type != MSIQ_TYPE_MSI64))
792 return -EINVAL;
793
794 *msi = ep->msi_data;
795
796 err = pci_sun4v_msi_setstate(pbm->devhandle,
797 ep->msi_data /* msi_num */,
798 HV_MSISTATE_IDLE);
799 if (unlikely(err))
800 return -ENXIO;
801
802 /* Clear the entry. */
803 ep->version_type &= ~MSIQ_TYPE_MASK;
804
805 (*head) += sizeof(struct pci_sun4v_msiq_entry);
806 if (*head >=
807 (pbm->msiq_ent_count * sizeof(struct pci_sun4v_msiq_entry)))
808 *head = 0;
809
810 return 1;
831} 811}
832 812
833static int msi_bitmap_alloc(struct pci_pbm_info *pbm) 813static int pci_sun4v_set_head(struct pci_pbm_info *pbm, unsigned long msiqid,
814 unsigned long head)
834{ 815{
835 unsigned long size, bits_per_ulong; 816 unsigned long err;
836 817
837 bits_per_ulong = sizeof(unsigned long) * 8; 818 err = pci_sun4v_msiq_sethead(pbm->devhandle, msiqid, head);
838 size = (pbm->msi_num + (bits_per_ulong - 1)) & ~(bits_per_ulong - 1); 819 if (unlikely(err))
839 size /= 8; 820 return -EINVAL;
840 BUG_ON(size % sizeof(unsigned long));
841 821
842 pbm->msi_bitmap = kzalloc(size, GFP_KERNEL); 822 return 0;
843 if (!pbm->msi_bitmap) 823}
844 return -ENOMEM;
845 824
825static int pci_sun4v_msi_setup(struct pci_pbm_info *pbm, unsigned long msiqid,
826 unsigned long msi, int is_msi64)
827{
828 if (pci_sun4v_msi_setmsiq(pbm->devhandle, msi, msiqid,
829 (is_msi64 ?
830 HV_MSITYPE_MSI64 : HV_MSITYPE_MSI32)))
831 return -ENXIO;
832 if (pci_sun4v_msi_setstate(pbm->devhandle, msi, HV_MSISTATE_IDLE))
833 return -ENXIO;
834 if (pci_sun4v_msi_setvalid(pbm->devhandle, msi, HV_MSIVALID_VALID))
835 return -ENXIO;
846 return 0; 836 return 0;
847} 837}
848 838
849static void msi_bitmap_free(struct pci_pbm_info *pbm) 839static int pci_sun4v_msi_teardown(struct pci_pbm_info *pbm, unsigned long msi)
850{ 840{
851 kfree(pbm->msi_bitmap); 841 unsigned long err, msiqid;
852 pbm->msi_bitmap = NULL; 842
843 err = pci_sun4v_msi_getmsiq(pbm->devhandle, msi, &msiqid);
844 if (err)
845 return -ENXIO;
846
847 pci_sun4v_msi_setvalid(pbm->devhandle, msi, HV_MSIVALID_INVALID);
848
849 return 0;
853} 850}
854 851
855static int msi_queue_alloc(struct pci_pbm_info *pbm) 852static int pci_sun4v_msiq_alloc(struct pci_pbm_info *pbm)
856{ 853{
857 unsigned long q_size, alloc_size, pages, order; 854 unsigned long q_size, alloc_size, pages, order;
858 int i; 855 int i;
@@ -906,232 +903,59 @@ h_error:
906 return -EINVAL; 903 return -EINVAL;
907} 904}
908 905
909 906static void pci_sun4v_msiq_free(struct pci_pbm_info *pbm)
910static int alloc_msi(struct pci_pbm_info *pbm)
911{ 907{
908 unsigned long q_size, alloc_size, pages, order;
912 int i; 909 int i;
913 910
914 for (i = 0; i < pbm->msi_num; i++) { 911 for (i = 0; i < pbm->msiq_num; i++) {
915 if (!test_and_set_bit(i, pbm->msi_bitmap)) 912 unsigned long msiqid = pbm->msiq_first + i;
916 return i + pbm->msi_first;
917 }
918
919 return -ENOENT;
920}
921
922static void free_msi(struct pci_pbm_info *pbm, int msi_num)
923{
924 msi_num -= pbm->msi_first;
925 clear_bit(msi_num, pbm->msi_bitmap);
926}
927
928static int pci_sun4v_setup_msi_irq(unsigned int *virt_irq_p,
929 struct pci_dev *pdev,
930 struct msi_desc *entry)
931{
932 struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller;
933 unsigned long devino, msiqid;
934 struct msi_msg msg;
935 int msi_num, err;
936
937 *virt_irq_p = 0;
938
939 msi_num = alloc_msi(pbm);
940 if (msi_num < 0)
941 return msi_num;
942
943 err = sun4v_build_msi(pbm->devhandle, virt_irq_p,
944 pbm->msiq_first_devino,
945 (pbm->msiq_first_devino +
946 pbm->msiq_num));
947 if (err < 0)
948 goto out_err;
949 devino = err;
950
951 msiqid = ((devino - pbm->msiq_first_devino) +
952 pbm->msiq_first);
953
954 err = -EINVAL;
955 if (pci_sun4v_msiq_setstate(pbm->devhandle, msiqid, HV_MSIQSTATE_IDLE))
956 if (err)
957 goto out_err;
958
959 if (pci_sun4v_msiq_setvalid(pbm->devhandle, msiqid, HV_MSIQ_VALID))
960 goto out_err;
961
962 if (pci_sun4v_msi_setmsiq(pbm->devhandle,
963 msi_num, msiqid,
964 (entry->msi_attrib.is_64 ?
965 HV_MSITYPE_MSI64 : HV_MSITYPE_MSI32)))
966 goto out_err;
967
968 if (pci_sun4v_msi_setstate(pbm->devhandle, msi_num, HV_MSISTATE_IDLE))
969 goto out_err;
970
971 if (pci_sun4v_msi_setvalid(pbm->devhandle, msi_num, HV_MSIVALID_VALID))
972 goto out_err;
973
974 sparc64_set_msi(*virt_irq_p, msi_num);
975 913
976 if (entry->msi_attrib.is_64) { 914 (void) pci_sun4v_msiq_conf(pbm->devhandle, msiqid, 0UL, 0);
977 msg.address_hi = pbm->msi64_start >> 32;
978 msg.address_lo = pbm->msi64_start & 0xffffffff;
979 } else {
980 msg.address_hi = 0;
981 msg.address_lo = pbm->msi32_start;
982 } 915 }
983 msg.data = msi_num;
984 916
985 set_irq_msi(*virt_irq_p, entry); 917 q_size = pbm->msiq_ent_count * sizeof(struct pci_sun4v_msiq_entry);
986 write_msi_msg(*virt_irq_p, &msg); 918 alloc_size = (pbm->msiq_num * q_size);
987 919 order = get_order(alloc_size);
988 irq_install_pre_handler(*virt_irq_p,
989 pci_sun4v_msi_prehandler,
990 pbm, (void *) msiqid);
991 920
992 return 0; 921 pages = (unsigned long) pbm->msi_queues;
993 922
994out_err: 923 free_pages(pages, order);
995 free_msi(pbm, msi_num);
996 return err;
997 924
925 pbm->msi_queues = NULL;
998} 926}
999 927
1000static void pci_sun4v_teardown_msi_irq(unsigned int virt_irq, 928static int pci_sun4v_msiq_build_irq(struct pci_pbm_info *pbm,
1001 struct pci_dev *pdev) 929 unsigned long msiqid,
930 unsigned long devino)
1002{ 931{
1003 struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller; 932 unsigned int virt_irq = sun4v_build_irq(pbm->devhandle, devino);
1004 unsigned long msiqid, err;
1005 unsigned int msi_num;
1006
1007 msi_num = sparc64_get_msi(virt_irq);
1008 err = pci_sun4v_msi_getmsiq(pbm->devhandle, msi_num, &msiqid);
1009 if (err) {
1010 printk(KERN_ERR "%s: getmsiq gives error %lu\n",
1011 pbm->name, err);
1012 return;
1013 }
1014 933
1015 pci_sun4v_msi_setvalid(pbm->devhandle, msi_num, HV_MSIVALID_INVALID); 934 if (!virt_irq)
1016 pci_sun4v_msiq_setvalid(pbm->devhandle, msiqid, HV_MSIQ_INVALID); 935 return -ENOMEM;
1017 936
1018 free_msi(pbm, msi_num); 937 if (pci_sun4v_msiq_setstate(pbm->devhandle, msiqid, HV_MSIQSTATE_IDLE))
938 return -EINVAL;
939 if (pci_sun4v_msiq_setvalid(pbm->devhandle, msiqid, HV_MSIQ_VALID))
940 return -EINVAL;
1019 941
1020 /* The sun4v_destroy_msi() will liberate the devino and thus the MSIQ 942 return virt_irq;
1021 * allocation.
1022 */
1023 sun4v_destroy_msi(virt_irq);
1024} 943}
1025 944
945static const struct sparc64_msiq_ops pci_sun4v_msiq_ops = {
946 .get_head = pci_sun4v_get_head,
947 .dequeue_msi = pci_sun4v_dequeue_msi,
948 .set_head = pci_sun4v_set_head,
949 .msi_setup = pci_sun4v_msi_setup,
950 .msi_teardown = pci_sun4v_msi_teardown,
951 .msiq_alloc = pci_sun4v_msiq_alloc,
952 .msiq_free = pci_sun4v_msiq_free,
953 .msiq_build_irq = pci_sun4v_msiq_build_irq,
954};
955
1026static void pci_sun4v_msi_init(struct pci_pbm_info *pbm) 956static void pci_sun4v_msi_init(struct pci_pbm_info *pbm)
1027{ 957{
1028 const u32 *val; 958 sparc64_pbm_msi_init(pbm, &pci_sun4v_msiq_ops);
1029 int len;
1030
1031 val = of_get_property(pbm->prom_node, "#msi-eqs", &len);
1032 if (!val || len != 4)
1033 goto no_msi;
1034 pbm->msiq_num = *val;
1035 if (pbm->msiq_num) {
1036 const struct msiq_prop {
1037 u32 first_msiq;
1038 u32 num_msiq;
1039 u32 first_devino;
1040 } *mqp;
1041 const struct msi_range_prop {
1042 u32 first_msi;
1043 u32 num_msi;
1044 } *mrng;
1045 const struct addr_range_prop {
1046 u32 msi32_high;
1047 u32 msi32_low;
1048 u32 msi32_len;
1049 u32 msi64_high;
1050 u32 msi64_low;
1051 u32 msi64_len;
1052 } *arng;
1053
1054 val = of_get_property(pbm->prom_node, "msi-eq-size", &len);
1055 if (!val || len != 4)
1056 goto no_msi;
1057
1058 pbm->msiq_ent_count = *val;
1059
1060 mqp = of_get_property(pbm->prom_node,
1061 "msi-eq-to-devino", &len);
1062 if (!mqp || len != sizeof(struct msiq_prop))
1063 goto no_msi;
1064
1065 pbm->msiq_first = mqp->first_msiq;
1066 pbm->msiq_first_devino = mqp->first_devino;
1067
1068 val = of_get_property(pbm->prom_node, "#msi", &len);
1069 if (!val || len != 4)
1070 goto no_msi;
1071 pbm->msi_num = *val;
1072
1073 mrng = of_get_property(pbm->prom_node, "msi-ranges", &len);
1074 if (!mrng || len != sizeof(struct msi_range_prop))
1075 goto no_msi;
1076 pbm->msi_first = mrng->first_msi;
1077
1078 val = of_get_property(pbm->prom_node, "msi-data-mask", &len);
1079 if (!val || len != 4)
1080 goto no_msi;
1081 pbm->msi_data_mask = *val;
1082
1083 val = of_get_property(pbm->prom_node, "msix-data-width", &len);
1084 if (!val || len != 4)
1085 goto no_msi;
1086 pbm->msix_data_width = *val;
1087
1088 arng = of_get_property(pbm->prom_node, "msi-address-ranges",
1089 &len);
1090 if (!arng || len != sizeof(struct addr_range_prop))
1091 goto no_msi;
1092 pbm->msi32_start = ((u64)arng->msi32_high << 32) |
1093 (u64) arng->msi32_low;
1094 pbm->msi64_start = ((u64)arng->msi64_high << 32) |
1095 (u64) arng->msi64_low;
1096 pbm->msi32_len = arng->msi32_len;
1097 pbm->msi64_len = arng->msi64_len;
1098
1099 if (msi_bitmap_alloc(pbm))
1100 goto no_msi;
1101
1102 if (msi_queue_alloc(pbm)) {
1103 msi_bitmap_free(pbm);
1104 goto no_msi;
1105 }
1106
1107 printk(KERN_INFO "%s: MSI Queue first[%u] num[%u] count[%u] "
1108 "devino[0x%x]\n",
1109 pbm->name,
1110 pbm->msiq_first, pbm->msiq_num,
1111 pbm->msiq_ent_count,
1112 pbm->msiq_first_devino);
1113 printk(KERN_INFO "%s: MSI first[%u] num[%u] mask[0x%x] "
1114 "width[%u]\n",
1115 pbm->name,
1116 pbm->msi_first, pbm->msi_num, pbm->msi_data_mask,
1117 pbm->msix_data_width);
1118 printk(KERN_INFO "%s: MSI addr32[0x%lx:0x%x] "
1119 "addr64[0x%lx:0x%x]\n",
1120 pbm->name,
1121 pbm->msi32_start, pbm->msi32_len,
1122 pbm->msi64_start, pbm->msi64_len);
1123 printk(KERN_INFO "%s: MSI queues at RA [%p]\n",
1124 pbm->name,
1125 pbm->msi_queues);
1126 }
1127 pbm->setup_msi_irq = pci_sun4v_setup_msi_irq;
1128 pbm->teardown_msi_irq = pci_sun4v_teardown_msi_irq;
1129
1130 return;
1131
1132no_msi:
1133 pbm->msiq_num = 0;
1134 printk(KERN_INFO "%s: No MSI support.\n", pbm->name);
1135} 959}
1136#else /* CONFIG_PCI_MSI */ 960#else /* CONFIG_PCI_MSI */
1137static void pci_sun4v_msi_init(struct pci_pbm_info *pbm) 961static void pci_sun4v_msi_init(struct pci_pbm_info *pbm)
@@ -1237,11 +1061,6 @@ void __init sun4v_pci_init(struct device_node *dp, char *model_name)
1237 1061
1238 p->pbm_B.iommu = iommu; 1062 p->pbm_B.iommu = iommu;
1239 1063
1240 /* Like PSYCHO and SCHIZO we have a 2GB aligned area
1241 * for memory space.
1242 */
1243 pci_memspace_mask = 0x7fffffffUL;
1244
1245 pci_sun4v_pbm_init(p, dp, devhandle); 1064 pci_sun4v_pbm_init(p, dp, devhandle);
1246 return; 1065 return;
1247 1066
diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c
index 881a09ee4c4c..850cdffdd69c 100644
--- a/arch/sparc64/kernel/power.c
+++ b/arch/sparc64/kernel/power.c
@@ -105,9 +105,11 @@ static struct of_device_id power_match[] = {
105}; 105};
106 106
107static struct of_platform_driver power_driver = { 107static struct of_platform_driver power_driver = {
108 .name = "power",
109 .match_table = power_match, 108 .match_table = power_match,
110 .probe = power_probe, 109 .probe = power_probe,
110 .driver = {
111 .name = "power",
112 },
111}; 113};
112 114
113void __init power_init(void) 115void __init power_init(void)
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index c73b7a48b036..407d74a8a542 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -52,14 +52,13 @@ int sparc64_multi_core __read_mostly;
52 52
53cpumask_t cpu_possible_map __read_mostly = CPU_MASK_NONE; 53cpumask_t cpu_possible_map __read_mostly = CPU_MASK_NONE;
54cpumask_t cpu_online_map __read_mostly = CPU_MASK_NONE; 54cpumask_t cpu_online_map __read_mostly = CPU_MASK_NONE;
55cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly = 55DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE;
56 { [0 ... NR_CPUS-1] = CPU_MASK_NONE };
57cpumask_t cpu_core_map[NR_CPUS] __read_mostly = 56cpumask_t cpu_core_map[NR_CPUS] __read_mostly =
58 { [0 ... NR_CPUS-1] = CPU_MASK_NONE }; 57 { [0 ... NR_CPUS-1] = CPU_MASK_NONE };
59 58
60EXPORT_SYMBOL(cpu_possible_map); 59EXPORT_SYMBOL(cpu_possible_map);
61EXPORT_SYMBOL(cpu_online_map); 60EXPORT_SYMBOL(cpu_online_map);
62EXPORT_SYMBOL(cpu_sibling_map); 61EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
63EXPORT_SYMBOL(cpu_core_map); 62EXPORT_SYMBOL(cpu_core_map);
64 63
65static cpumask_t smp_commenced_mask; 64static cpumask_t smp_commenced_mask;
@@ -1261,16 +1260,16 @@ void __devinit smp_fill_in_sib_core_maps(void)
1261 for_each_present_cpu(i) { 1260 for_each_present_cpu(i) {
1262 unsigned int j; 1261 unsigned int j;
1263 1262
1264 cpus_clear(cpu_sibling_map[i]); 1263 cpus_clear(per_cpu(cpu_sibling_map, i));
1265 if (cpu_data(i).proc_id == -1) { 1264 if (cpu_data(i).proc_id == -1) {
1266 cpu_set(i, cpu_sibling_map[i]); 1265 cpu_set(i, per_cpu(cpu_sibling_map, i));
1267 continue; 1266 continue;
1268 } 1267 }
1269 1268
1270 for_each_present_cpu(j) { 1269 for_each_present_cpu(j) {
1271 if (cpu_data(i).proc_id == 1270 if (cpu_data(i).proc_id ==
1272 cpu_data(j).proc_id) 1271 cpu_data(j).proc_id)
1273 cpu_set(j, cpu_sibling_map[i]); 1272 cpu_set(j, per_cpu(cpu_sibling_map, i));
1274 } 1273 }
1275 } 1274 }
1276} 1275}
@@ -1342,9 +1341,9 @@ int __cpu_disable(void)
1342 cpu_clear(cpu, cpu_core_map[i]); 1341 cpu_clear(cpu, cpu_core_map[i]);
1343 cpus_clear(cpu_core_map[cpu]); 1342 cpus_clear(cpu_core_map[cpu]);
1344 1343
1345 for_each_cpu_mask(i, cpu_sibling_map[cpu]) 1344 for_each_cpu_mask(i, per_cpu(cpu_sibling_map, cpu))
1346 cpu_clear(cpu, cpu_sibling_map[i]); 1345 cpu_clear(cpu, per_cpu(cpu_sibling_map, i));
1347 cpus_clear(cpu_sibling_map[cpu]); 1346 cpus_clear(per_cpu(cpu_sibling_map, cpu));
1348 1347
1349 c = &cpu_data(cpu); 1348 c = &cpu_data(cpu);
1350 1349
diff --git a/arch/sparc64/kernel/sun4v_ivec.S b/arch/sparc64/kernel/sun4v_ivec.S
index 574bc248bca6..e2f8e1b4882a 100644
--- a/arch/sparc64/kernel/sun4v_ivec.S
+++ b/arch/sparc64/kernel/sun4v_ivec.S
@@ -96,19 +96,21 @@ sun4v_dev_mondo:
96 stxa %g2, [%g4] ASI_QUEUE 96 stxa %g2, [%g4] ASI_QUEUE
97 membar #Sync 97 membar #Sync
98 98
99 /* Get &__irq_work[smp_processor_id()] into %g1. */ 99 TRAP_LOAD_IRQ_WORK_PA(%g1, %g4)
100 TRAP_LOAD_IRQ_WORK(%g1, %g4)
101 100
102 /* Get &ivector_table[IVEC] into %g4. */ 101 /* For VIRQs, cookie is encoded as ~bucket_phys_addr */
103 sethi %hi(ivector_table), %g4 102 brlz,pt %g3, 1f
104 sllx %g3, 3, %g3 103 xnor %g3, %g0, %g4
105 or %g4, %lo(ivector_table), %g4 104
105 /* Get __pa(&ivector_table[IVEC]) into %g4. */
106 sethi %hi(ivector_table_pa), %g4
107 ldx [%g4 + %lo(ivector_table_pa)], %g4
108 sllx %g3, 4, %g3
106 add %g4, %g3, %g4 109 add %g4, %g3, %g4
107 110
108 /* Insert ivector_table[] entry into __irq_work[] queue. */ 1111: ldx [%g1], %g2
109 lduw [%g1], %g2 /* g2 = irq_work(cpu) */ 112 stxa %g2, [%g4] ASI_PHYS_USE_EC
110 stw %g2, [%g4 + 0x00] /* bucket->irq_chain = g2 */ 113 stx %g4, [%g1]
111 stw %g4, [%g1] /* irq_work(cpu) = bucket */
112 114
113 /* Signal the interrupt by setting (1 << pil) in %softint. */ 115 /* Signal the interrupt by setting (1 << pil) in %softint. */
114 wr %g0, 1 << PIL_DEVICE_IRQ, %set_softint 116 wr %g0, 1 << PIL_DEVICE_IRQ, %set_softint
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
index d108eeb0734f..0d5c50264945 100644
--- a/arch/sparc64/kernel/sys_sparc.c
+++ b/arch/sparc64/kernel/sys_sparc.c
@@ -436,7 +436,7 @@ out:
436asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second, 436asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second,
437 unsigned long third, void __user *ptr, long fifth) 437 unsigned long third, void __user *ptr, long fifth)
438{ 438{
439 int err; 439 long err;
440 440
441 /* No need for backward compatibility. We can start fresh... */ 441 /* No need for backward compatibility. We can start fresh... */
442 if (call <= SEMCTL) { 442 if (call <= SEMCTL) {
@@ -453,16 +453,9 @@ asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second,
453 err = sys_semget(first, (int)second, (int)third); 453 err = sys_semget(first, (int)second, (int)third);
454 goto out; 454 goto out;
455 case SEMCTL: { 455 case SEMCTL: {
456 union semun fourth; 456 err = sys_semctl(first, third,
457 err = -EINVAL; 457 (int)second | IPC_64,
458 if (!ptr) 458 (union semun) ptr);
459 goto out;
460 err = -EFAULT;
461 if (get_user(fourth.__pad,
462 (void __user * __user *) ptr))
463 goto out;
464 err = sys_semctl(first, (int)second | IPC_64,
465 (int)third, fourth);
466 goto out; 459 goto out;
467 } 460 }
468 default: 461 default:
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index 69cad1b653c1..cd8c740cba1d 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -764,9 +764,11 @@ static struct of_device_id clock_match[] = {
764}; 764};
765 765
766static struct of_platform_driver clock_driver = { 766static struct of_platform_driver clock_driver = {
767 .name = "clock",
768 .match_table = clock_match, 767 .match_table = clock_match,
769 .probe = clock_probe, 768 .probe = clock_probe,
769 .driver = {
770 .name = "clock",
771 },
770}; 772};
771 773
772static int __init clock_init(void) 774static int __init clock_init(void)
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index 6ef42b8e53d8..34573a55b6e5 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -2569,8 +2569,8 @@ void __init trap_init(void)
2569 offsetof(struct trap_per_cpu, tsb_huge)) || 2569 offsetof(struct trap_per_cpu, tsb_huge)) ||
2570 (TRAP_PER_CPU_TSB_HUGE_TEMP != 2570 (TRAP_PER_CPU_TSB_HUGE_TEMP !=
2571 offsetof(struct trap_per_cpu, tsb_huge_temp)) || 2571 offsetof(struct trap_per_cpu, tsb_huge_temp)) ||
2572 (TRAP_PER_CPU_IRQ_WORKLIST != 2572 (TRAP_PER_CPU_IRQ_WORKLIST_PA !=
2573 offsetof(struct trap_per_cpu, irq_worklist)) || 2573 offsetof(struct trap_per_cpu, irq_worklist_pa)) ||
2574 (TRAP_PER_CPU_CPU_MONDO_QMASK != 2574 (TRAP_PER_CPU_CPU_MONDO_QMASK !=
2575 offsetof(struct trap_per_cpu, cpu_mondo_qmask)) || 2575 offsetof(struct trap_per_cpu, cpu_mondo_qmask)) ||
2576 (TRAP_PER_CPU_DEV_MONDO_QMASK != 2576 (TRAP_PER_CPU_DEV_MONDO_QMASK !=
diff --git a/arch/sparc64/kernel/us2e_cpufreq.c b/arch/sparc64/kernel/us2e_cpufreq.c
index 1f83fe6a82d6..791c15138f3a 100644
--- a/arch/sparc64/kernel/us2e_cpufreq.c
+++ b/arch/sparc64/kernel/us2e_cpufreq.c
@@ -326,7 +326,6 @@ static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy)
326 table[2].index = 5; 326 table[2].index = 5;
327 table[3].frequency = CPUFREQ_TABLE_END; 327 table[3].frequency = CPUFREQ_TABLE_END;
328 328
329 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
330 policy->cpuinfo.transition_latency = 0; 329 policy->cpuinfo.transition_latency = 0;
331 policy->cur = clock_tick; 330 policy->cur = clock_tick;
332 331
diff --git a/arch/sparc64/kernel/vmlinux.lds.S b/arch/sparc64/kernel/vmlinux.lds.S
index b982fa3dd748..9fcd503bc04a 100644
--- a/arch/sparc64/kernel/vmlinux.lds.S
+++ b/arch/sparc64/kernel/vmlinux.lds.S
@@ -10,105 +10,138 @@ ENTRY(_start)
10jiffies = jiffies_64; 10jiffies = jiffies_64;
11SECTIONS 11SECTIONS
12{ 12{
13 swapper_low_pmd_dir = 0x0000000000402000; 13 swapper_low_pmd_dir = 0x0000000000402000;
14 . = 0x4000; 14 . = 0x4000;
15 .text 0x0000000000404000 : 15 .text 0x0000000000404000 : {
16 { 16 _text = .;
17 _text = .; 17 TEXT_TEXT
18 TEXT_TEXT 18 SCHED_TEXT
19 SCHED_TEXT 19 LOCK_TEXT
20 LOCK_TEXT 20 KPROBES_TEXT
21 KPROBES_TEXT 21 *(.gnu.warning)
22 *(.gnu.warning) 22 } = 0
23 } =0 23 _etext = .;
24 _etext = .; 24 PROVIDE (etext = .);
25 PROVIDE (etext = .);
26 25
27 RO_DATA(PAGE_SIZE) 26 RO_DATA(PAGE_SIZE)
27 .data : {
28 DATA_DATA
29 CONSTRUCTORS
30 }
31 .data1 : {
32 *(.data1)
33 }
34 . = ALIGN(64);
35 .data.cacheline_aligned : {
36 *(.data.cacheline_aligned)
37 }
38 . = ALIGN(64);
39 .data.read_mostly : {
40 *(.data.read_mostly)
41 }
42 _edata = .;
43 PROVIDE (edata = .);
44 .fixup : {
45 *(.fixup)
46 }
47 . = ALIGN(16);
48 __ex_table : {
49 __start___ex_table = .;
50 *(__ex_table)
51 __stop___ex_table = .;
52 }
53 NOTES
28 54
29 .data : 55 . = ALIGN(PAGE_SIZE);
30 { 56 .init.text : {
31 DATA_DATA 57 __init_begin = .;
32 CONSTRUCTORS 58 _sinittext = .;
33 } 59 *(.init.text)
34 .data1 : { *(.data1) } 60 _einittext = .;
35 . = ALIGN(64); 61 }
36 .data.cacheline_aligned : { *(.data.cacheline_aligned) } 62 .init.data : {
37 . = ALIGN(64); 63 *(.init.data)
38 .data.read_mostly : { *(.data.read_mostly) } 64 }
39 _edata = .; 65 . = ALIGN(16);
40 PROVIDE (edata = .); 66 .init.setup : {
41 .fixup : { *(.fixup) } 67 __setup_start = .;
68 *(.init.setup)
69 __setup_end = .;
70 }
71 .initcall.init : {
72 __initcall_start = .;
73 INITCALLS
74 __initcall_end = .;
75 }
76 .con_initcall.init : {
77 __con_initcall_start = .;
78 *(.con_initcall.init)
79 __con_initcall_end = .;
80 }
81 SECURITY_INIT
42 82
43 . = ALIGN(16); 83 . = ALIGN(4);
44 __start___ex_table = .; 84 .tsb_ldquad_phys_patch : {
45 __ex_table : { *(__ex_table) } 85 __tsb_ldquad_phys_patch = .;
46 __stop___ex_table = .; 86 *(.tsb_ldquad_phys_patch)
87 __tsb_ldquad_phys_patch_end = .;
88 }
47 89
48 NOTES 90 .tsb_phys_patch : {
91 __tsb_phys_patch = .;
92 *(.tsb_phys_patch)
93 __tsb_phys_patch_end = .;
94 }
49 95
50 . = ALIGN(PAGE_SIZE); 96 .cpuid_patch : {
51 __init_begin = .; 97 __cpuid_patch = .;
52 .init.text : { 98 *(.cpuid_patch)
53 _sinittext = .; 99 __cpuid_patch_end = .;
54 *(.init.text) 100 }
55 _einittext = .; 101
56 } 102 .sun4v_1insn_patch : {
57 .init.data : { *(.init.data) } 103 __sun4v_1insn_patch = .;
58 . = ALIGN(16); 104 *(.sun4v_1insn_patch)
59 __setup_start = .; 105 __sun4v_1insn_patch_end = .;
60 .init.setup : { *(.init.setup) } 106 }
61 __setup_end = .; 107 .sun4v_2insn_patch : {
62 __initcall_start = .; 108 __sun4v_2insn_patch = .;
63 .initcall.init : { 109 *(.sun4v_2insn_patch)
64 INITCALLS 110 __sun4v_2insn_patch_end = .;
65 } 111 }
66 __initcall_end = .;
67 __con_initcall_start = .;
68 .con_initcall.init : { *(.con_initcall.init) }
69 __con_initcall_end = .;
70 SECURITY_INIT
71 . = ALIGN(4);
72 __tsb_ldquad_phys_patch = .;
73 .tsb_ldquad_phys_patch : { *(.tsb_ldquad_phys_patch) }
74 __tsb_ldquad_phys_patch_end = .;
75 __tsb_phys_patch = .;
76 .tsb_phys_patch : { *(.tsb_phys_patch) }
77 __tsb_phys_patch_end = .;
78 __cpuid_patch = .;
79 .cpuid_patch : { *(.cpuid_patch) }
80 __cpuid_patch_end = .;
81 __sun4v_1insn_patch = .;
82 .sun4v_1insn_patch : { *(.sun4v_1insn_patch) }
83 __sun4v_1insn_patch_end = .;
84 __sun4v_2insn_patch = .;
85 .sun4v_2insn_patch : { *(.sun4v_2insn_patch) }
86 __sun4v_2insn_patch_end = .;
87 112
88#ifdef CONFIG_BLK_DEV_INITRD 113#ifdef CONFIG_BLK_DEV_INITRD
89 . = ALIGN(PAGE_SIZE); 114 . = ALIGN(PAGE_SIZE);
90 __initramfs_start = .; 115 .init.ramfs : {
91 .init.ramfs : { *(.init.ramfs) } 116 __initramfs_start = .;
92 __initramfs_end = .; 117 *(.init.ramfs)
118 __initramfs_end = .;
119 }
93#endif 120#endif
94 121
95 PERCPU(PAGE_SIZE) 122 PERCPU(PAGE_SIZE)
96 123
97 . = ALIGN(PAGE_SIZE); 124 . = ALIGN(PAGE_SIZE);
98 __init_end = .; 125 __init_end = .;
99 __bss_start = .; 126 __bss_start = .;
100 .sbss : { *(.sbss) *(.scommon) } 127 .sbss : {
101 .bss : 128 *(.sbss)
102 { 129 *(.scommon)
103 *(.dynbss) 130 }
104 *(.bss) 131 .bss : {
105 *(COMMON) 132 *(.dynbss)
106 } 133 *(.bss)
107 _end = . ; 134 *(COMMON)
108 PROVIDE (end = .); 135 }
109 /DISCARD/ : { *(.exit.text) *(.exit.data) *(.exitcall.exit) } 136 _end = . ;
137 PROVIDE (end = .);
110 138
111 STABS_DEBUG 139 /DISCARD/ : {
140 *(.exit.text)
141 *(.exit.data)
142 *(.exitcall.exit)
143 }
112 144
113 DWARF_DEBUG 145 STABS_DEBUG
146 DWARF_DEBUG
114} 147}
diff --git a/arch/sparc64/lib/xor.S b/arch/sparc64/lib/xor.S
index a79c8888170d..f44f58f40234 100644
--- a/arch/sparc64/lib/xor.S
+++ b/arch/sparc64/lib/xor.S
@@ -491,12 +491,12 @@ xor_niagara_4: /* %o0=bytes, %o1=dest, %o2=src1, %o3=src2, %o4=src3 */
491 ldda [%i1 + 0x10] %asi, %i2 /* %i2/%i3 = src1 + 0x10 */ 491 ldda [%i1 + 0x10] %asi, %i2 /* %i2/%i3 = src1 + 0x10 */
492 xor %g2, %i4, %g2 492 xor %g2, %i4, %g2
493 xor %g3, %i5, %g3 493 xor %g3, %i5, %g3
494 ldda [%i7 + 0x10] %asi, %i4 /* %i4/%i5 = src2 + 0x10 */ 494 ldda [%l7 + 0x10] %asi, %i4 /* %i4/%i5 = src2 + 0x10 */
495 xor %l0, %g2, %l0 495 xor %l0, %g2, %l0
496 xor %l1, %g3, %l1 496 xor %l1, %g3, %l1
497 stxa %l0, [%i0 + 0x00] %asi 497 stxa %l0, [%i0 + 0x00] %asi
498 stxa %l1, [%i0 + 0x08] %asi 498 stxa %l1, [%i0 + 0x08] %asi
499 ldda [%i6 + 0x10] %asi, %g2 /* %g2/%g3 = src3 + 0x10 */ 499 ldda [%l6 + 0x10] %asi, %g2 /* %g2/%g3 = src3 + 0x10 */
500 ldda [%i0 + 0x10] %asi, %l0 /* %l0/%l1 = dest + 0x10 */ 500 ldda [%i0 + 0x10] %asi, %l0 /* %l0/%l1 = dest + 0x10 */
501 501
502 xor %i4, %i2, %i4 502 xor %i4, %i2, %i4
@@ -504,12 +504,12 @@ xor_niagara_4: /* %o0=bytes, %o1=dest, %o2=src1, %o3=src2, %o4=src3 */
504 ldda [%i1 + 0x20] %asi, %i2 /* %i2/%i3 = src1 + 0x20 */ 504 ldda [%i1 + 0x20] %asi, %i2 /* %i2/%i3 = src1 + 0x20 */
505 xor %g2, %i4, %g2 505 xor %g2, %i4, %g2
506 xor %g3, %i5, %g3 506 xor %g3, %i5, %g3
507 ldda [%i7 + 0x20] %asi, %i4 /* %i4/%i5 = src2 + 0x20 */ 507 ldda [%l7 + 0x20] %asi, %i4 /* %i4/%i5 = src2 + 0x20 */
508 xor %l0, %g2, %l0 508 xor %l0, %g2, %l0
509 xor %l1, %g3, %l1 509 xor %l1, %g3, %l1
510 stxa %l0, [%i0 + 0x10] %asi 510 stxa %l0, [%i0 + 0x10] %asi
511 stxa %l1, [%i0 + 0x18] %asi 511 stxa %l1, [%i0 + 0x18] %asi
512 ldda [%i6 + 0x20] %asi, %g2 /* %g2/%g3 = src3 + 0x20 */ 512 ldda [%l6 + 0x20] %asi, %g2 /* %g2/%g3 = src3 + 0x20 */
513 ldda [%i0 + 0x20] %asi, %l0 /* %l0/%l1 = dest + 0x20 */ 513 ldda [%i0 + 0x20] %asi, %l0 /* %l0/%l1 = dest + 0x20 */
514 514
515 xor %i4, %i2, %i4 515 xor %i4, %i2, %i4
@@ -517,12 +517,12 @@ xor_niagara_4: /* %o0=bytes, %o1=dest, %o2=src1, %o3=src2, %o4=src3 */
517 ldda [%i1 + 0x30] %asi, %i2 /* %i2/%i3 = src1 + 0x30 */ 517 ldda [%i1 + 0x30] %asi, %i2 /* %i2/%i3 = src1 + 0x30 */
518 xor %g2, %i4, %g2 518 xor %g2, %i4, %g2
519 xor %g3, %i5, %g3 519 xor %g3, %i5, %g3
520 ldda [%i7 + 0x30] %asi, %i4 /* %i4/%i5 = src2 + 0x30 */ 520 ldda [%l7 + 0x30] %asi, %i4 /* %i4/%i5 = src2 + 0x30 */
521 xor %l0, %g2, %l0 521 xor %l0, %g2, %l0
522 xor %l1, %g3, %l1 522 xor %l1, %g3, %l1
523 stxa %l0, [%i0 + 0x20] %asi 523 stxa %l0, [%i0 + 0x20] %asi
524 stxa %l1, [%i0 + 0x28] %asi 524 stxa %l1, [%i0 + 0x28] %asi
525 ldda [%i6 + 0x30] %asi, %g2 /* %g2/%g3 = src3 + 0x30 */ 525 ldda [%l6 + 0x30] %asi, %g2 /* %g2/%g3 = src3 + 0x30 */
526 ldda [%i0 + 0x30] %asi, %l0 /* %l0/%l1 = dest + 0x30 */ 526 ldda [%i0 + 0x30] %asi, %l0 /* %l0/%l1 = dest + 0x30 */
527 527
528 prefetch [%i1 + 0x40], #one_read 528 prefetch [%i1 + 0x40], #one_read
diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c
index 9f7740eee8d2..e2027f27c0fe 100644
--- a/arch/sparc64/mm/fault.c
+++ b/arch/sparc64/mm/fault.c
@@ -463,7 +463,7 @@ out_of_memory:
463 up_read(&mm->mmap_sem); 463 up_read(&mm->mmap_sem);
464 printk("VM: killing process %s\n", current->comm); 464 printk("VM: killing process %s\n", current->comm);
465 if (!(regs->tstate & TSTATE_PRIV)) 465 if (!(regs->tstate & TSTATE_PRIV))
466 do_exit(SIGKILL); 466 do_group_exit(SIGKILL);
467 goto handle_kernel_fault; 467 goto handle_kernel_fault;
468 468
469intr_or_no_mm: 469intr_or_no_mm:
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index 3010227fe243..100c4456ed1e 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -631,7 +631,6 @@ void prom_world(int enter)
631 __asm__ __volatile__("flushw"); 631 __asm__ __volatile__("flushw");
632} 632}
633 633
634#ifdef DCACHE_ALIASING_POSSIBLE
635void __flush_dcache_range(unsigned long start, unsigned long end) 634void __flush_dcache_range(unsigned long start, unsigned long end)
636{ 635{
637 unsigned long va; 636 unsigned long va;
@@ -655,7 +654,6 @@ void __flush_dcache_range(unsigned long start, unsigned long end)
655 "i" (ASI_DCACHE_INVALIDATE)); 654 "i" (ASI_DCACHE_INVALIDATE));
656 } 655 }
657} 656}
658#endif /* DCACHE_ALIASING_POSSIBLE */
659 657
660/* get_new_mmu_context() uses "cache + 1". */ 658/* get_new_mmu_context() uses "cache + 1". */
661DEFINE_SPINLOCK(ctx_alloc_lock); 659DEFINE_SPINLOCK(ctx_alloc_lock);
@@ -1647,6 +1645,58 @@ EXPORT_SYMBOL(_PAGE_E);
1647unsigned long _PAGE_CACHE __read_mostly; 1645unsigned long _PAGE_CACHE __read_mostly;
1648EXPORT_SYMBOL(_PAGE_CACHE); 1646EXPORT_SYMBOL(_PAGE_CACHE);
1649 1647
1648#ifdef CONFIG_SPARSEMEM_VMEMMAP
1649
1650#define VMEMMAP_CHUNK_SHIFT 22
1651#define VMEMMAP_CHUNK (1UL << VMEMMAP_CHUNK_SHIFT)
1652#define VMEMMAP_CHUNK_MASK ~(VMEMMAP_CHUNK - 1UL)
1653#define VMEMMAP_ALIGN(x) (((x)+VMEMMAP_CHUNK-1UL)&VMEMMAP_CHUNK_MASK)
1654
1655#define VMEMMAP_SIZE ((((1UL << MAX_PHYSADDR_BITS) >> PAGE_SHIFT) * \
1656 sizeof(struct page *)) >> VMEMMAP_CHUNK_SHIFT)
1657unsigned long vmemmap_table[VMEMMAP_SIZE];
1658
1659int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node)
1660{
1661 unsigned long vstart = (unsigned long) start;
1662 unsigned long vend = (unsigned long) (start + nr);
1663 unsigned long phys_start = (vstart - VMEMMAP_BASE);
1664 unsigned long phys_end = (vend - VMEMMAP_BASE);
1665 unsigned long addr = phys_start & VMEMMAP_CHUNK_MASK;
1666 unsigned long end = VMEMMAP_ALIGN(phys_end);
1667 unsigned long pte_base;
1668
1669 pte_base = (_PAGE_VALID | _PAGE_SZ4MB_4U |
1670 _PAGE_CP_4U | _PAGE_CV_4U |
1671 _PAGE_P_4U | _PAGE_W_4U);
1672 if (tlb_type == hypervisor)
1673 pte_base = (_PAGE_VALID | _PAGE_SZ4MB_4V |
1674 _PAGE_CP_4V | _PAGE_CV_4V |
1675 _PAGE_P_4V | _PAGE_W_4V);
1676
1677 for (; addr < end; addr += VMEMMAP_CHUNK) {
1678 unsigned long *vmem_pp =
1679 vmemmap_table + (addr >> VMEMMAP_CHUNK_SHIFT);
1680 void *block;
1681
1682 if (!(*vmem_pp & _PAGE_VALID)) {
1683 block = vmemmap_alloc_block(1UL << 22, node);
1684 if (!block)
1685 return -ENOMEM;
1686
1687 *vmem_pp = pte_base | __pa(block);
1688
1689 printk(KERN_INFO "[%p-%p] page_structs=%lu "
1690 "node=%d entry=%lu/%lu\n", start, block, nr,
1691 node,
1692 addr >> VMEMMAP_CHUNK_SHIFT,
1693 VMEMMAP_SIZE >> VMEMMAP_CHUNK_SHIFT);
1694 }
1695 }
1696 return 0;
1697}
1698#endif /* CONFIG_SPARSEMEM_VMEMMAP */
1699
1650static void prot_init_common(unsigned long page_none, 1700static void prot_init_common(unsigned long page_none,
1651 unsigned long page_shared, 1701 unsigned long page_shared,
1652 unsigned long page_copy, 1702 unsigned long page_copy,
@@ -1911,9 +1961,4 @@ void online_page(struct page *page)
1911 num_physpages++; 1961 num_physpages++;
1912} 1962}
1913 1963
1914int remove_memory(u64 start, u64 size)
1915{
1916 return -EINVAL;
1917}
1918
1919#endif /* CONFIG_MEMORY_HOTPLUG */ 1964#endif /* CONFIG_MEMORY_HOTPLUG */
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index e6ff30266542..740d8a922e48 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -55,6 +55,14 @@ config GENERIC_BUG
55 default y 55 default y
56 depends on BUG 56 depends on BUG
57 57
58config GENERIC_TIME
59 bool
60 default y
61
62config GENERIC_CLOCKEVENTS
63 bool
64 default y
65
58# Used in kernel/irq/manage.c and include/linux/irq.h 66# Used in kernel/irq/manage.c and include/linux/irq.h
59config IRQ_RELEASE_METHOD 67config IRQ_RELEASE_METHOD
60 bool 68 bool
@@ -62,63 +70,25 @@ config IRQ_RELEASE_METHOD
62 70
63menu "UML-specific options" 71menu "UML-specific options"
64 72
65config MODE_TT
66 bool "Tracing thread support (DEPRECATED)"
67 default n
68 depends on BROKEN
69 help
70 This option controls whether tracing thread support is compiled
71 into UML. This option is largely obsolete, given that skas0 provides
72 skas security and performance without needing to patch the host.
73 It is safe to say 'N' here; saying 'Y' may cause additional problems
74 with the resulting binary even if you run UML in SKAS mode, and running
75 in TT mode is strongly *NOT RECOMMENDED*.
76
77config STATIC_LINK 73config STATIC_LINK
78 bool "Force a static link" 74 bool "Force a static link"
79 default n 75 default n
80 depends on !MODE_TT
81 help 76 help
82 If CONFIG_MODE_TT is disabled, then this option gives you the ability 77 This option gives you the ability to force a static link of UML.
83 to force a static link of UML. Normally, if only skas mode is built 78 Normally, UML is linked as a shared binary. This is inconvenient for
84 in to UML, it will be linked as a shared binary. This is inconvenient 79 use in a chroot jail. So, if you intend to run UML inside a chroot,
85 for use in a chroot jail. So, if you intend to run UML inside a 80 you probably want to say Y here.
86 chroot, and you disable CONFIG_MODE_TT, you probably want to say Y 81 Additionally, this option enables using higher memory spaces (up to
87 here. 82 2.75G) for UML.
88 Additionally, this option enables using higher memory spaces (up to
89 2.75G) for UML - disabling CONFIG_MODE_TT and enabling this option leads
90 to best results for this.
91
92config KERNEL_HALF_GIGS
93 int "Kernel address space size (in .5G units)"
94 default "1"
95 depends on MODE_TT
96 help
97 This determines the amount of address space that UML will allocate for
98 its own, measured in half Gigabyte units. The default is 1.
99 Change this only if you need to boot UML with an unusually large amount
100 of physical memory.
101
102config MODE_SKAS
103 bool "Separate Kernel Address Space support" if MODE_TT
104 default y
105 help
106 This option controls whether skas (separate kernel address space)
107 support is compiled in.
108 Unless you have specific needs to use TT mode (which applies almost only
109 to developers), you should say Y here.
110 SKAS mode will make use of the SKAS3 patch if it is applied on the host
111 (and your UML will run in SKAS3 mode), but if no SKAS patch is applied
112 on the host it will run in SKAS0 mode, which is anyway faster than TT
113 mode.
114 83
115source "arch/um/Kconfig.arch" 84source "arch/um/Kconfig.arch"
116source "mm/Kconfig" 85source "mm/Kconfig"
86source "kernel/time/Kconfig"
117 87
118config LD_SCRIPT_STATIC 88config LD_SCRIPT_STATIC
119 bool 89 bool
120 default y 90 default y
121 depends on MODE_TT || STATIC_LINK 91 depends on STATIC_LINK
122 92
123config LD_SCRIPT_DYN 93config LD_SCRIPT_DYN
124 bool 94 bool
@@ -128,18 +98,18 @@ config LD_SCRIPT_DYN
128config NET 98config NET
129 bool "Networking support" 99 bool "Networking support"
130 help 100 help
131 Unless you really know what you are doing, you should say Y here. 101 Unless you really know what you are doing, you should say Y here.
132 The reason is that some programs need kernel networking support even 102 The reason is that some programs need kernel networking support even
133 when running on a stand-alone machine that isn't connected to any 103 when running on a stand-alone machine that isn't connected to any
134 other computer. If you are upgrading from an older kernel, you 104 other computer. If you are upgrading from an older kernel, you
135 should consider updating your networking tools too because changes 105 should consider updating your networking tools too because changes
136 in the kernel and the tools often go hand in hand. The tools are 106 in the kernel and the tools often go hand in hand. The tools are
137 contained in the package net-tools, the location and version number 107 contained in the package net-tools, the location and version number
138 of which are given in <file:Documentation/Changes>. 108 of which are given in <file:Documentation/Changes>.
139 109
140 For a general introduction to Linux networking, it is highly 110 For a general introduction to Linux networking, it is highly
141 recommended to read the NET-HOWTO, available from 111 recommended to read the NET-HOWTO, available from
142 <http://www.tldp.org/docs.html#howto>. 112 <http://www.tldp.org/docs.html#howto>.
143 113
144 114
145source "fs/Kconfig.binfmt" 115source "fs/Kconfig.binfmt"
@@ -147,99 +117,99 @@ source "fs/Kconfig.binfmt"
147config HOSTFS 117config HOSTFS
148 tristate "Host filesystem" 118 tristate "Host filesystem"
149 help 119 help
150 While the User-Mode Linux port uses its own root file system for 120 While the User-Mode Linux port uses its own root file system for
151 booting and normal file access, this module lets the UML user 121 booting and normal file access, this module lets the UML user
152 access files stored on the host. It does not require any 122 access files stored on the host. It does not require any
153 network connection between the Host and UML. An example use of 123 network connection between the Host and UML. An example use of
154 this might be: 124 this might be:
155 125
156 mount none /tmp/fromhost -t hostfs -o /tmp/umlshare 126 mount none /tmp/fromhost -t hostfs -o /tmp/umlshare
157 127
158 where /tmp/fromhost is an empty directory inside UML and 128 where /tmp/fromhost is an empty directory inside UML and
159 /tmp/umlshare is a directory on the host with files the UML user 129 /tmp/umlshare is a directory on the host with files the UML user
160 wishes to access. 130 wishes to access.
161 131
162 For more information, see 132 For more information, see
163 <http://user-mode-linux.sourceforge.net/hostfs.html>. 133 <http://user-mode-linux.sourceforge.net/hostfs.html>.
164 134
165 If you'd like to be able to work with files stored on the host, 135 If you'd like to be able to work with files stored on the host,
166 say Y or M here; otherwise say N. 136 say Y or M here; otherwise say N.
167 137
168config HPPFS 138config HPPFS
169 tristate "HoneyPot ProcFS (EXPERIMENTAL)" 139 tristate "HoneyPot ProcFS (EXPERIMENTAL)"
170 depends on EXPERIMENTAL 140 depends on EXPERIMENTAL
171 help 141 help
172 hppfs (HoneyPot ProcFS) is a filesystem which allows UML /proc 142 hppfs (HoneyPot ProcFS) is a filesystem which allows UML /proc
173 entries to be overridden, removed, or fabricated from the host. 143 entries to be overridden, removed, or fabricated from the host.
174 Its purpose is to allow a UML to appear to be a physical machine 144 Its purpose is to allow a UML to appear to be a physical machine
175 by removing or changing anything in /proc which gives away the 145 by removing or changing anything in /proc which gives away the
176 identity of a UML. 146 identity of a UML.
177 147
178 See <http://user-mode-linux.sf.net/hppfs.html> for more information. 148 See <http://user-mode-linux.sf.net/hppfs.html> for more information.
179 149
180 You only need this if you are setting up a UML honeypot. Otherwise, 150 You only need this if you are setting up a UML honeypot. Otherwise,
181 it is safe to say 'N' here. 151 it is safe to say 'N' here.
182 152
183config MCONSOLE 153config MCONSOLE
184 bool "Management console" 154 bool "Management console"
185 default y 155 default y
186 help 156 help
187 The user mode linux management console is a low-level interface to 157 The user mode linux management console is a low-level interface to
188 the kernel, somewhat like the i386 SysRq interface. Since there is 158 the kernel, somewhat like the i386 SysRq interface. Since there is
189 a full-blown operating system running under every user mode linux 159 a full-blown operating system running under every user mode linux
190 instance, there is much greater flexibility possible than with the 160 instance, there is much greater flexibility possible than with the
191 SysRq mechanism. 161 SysRq mechanism.
192 162
193 If you answer 'Y' to this option, to use this feature, you need the 163 If you answer 'Y' to this option, to use this feature, you need the
194 mconsole client (called uml_mconsole) which is present in CVS in 164 mconsole client (called uml_mconsole) which is present in CVS in
195 2.4.5-9um and later (path /tools/mconsole), and is also in the 165 2.4.5-9um and later (path /tools/mconsole), and is also in the
196 distribution RPM package in 2.4.6 and later. 166 distribution RPM package in 2.4.6 and later.
197 167
198 It is safe to say 'Y' here. 168 It is safe to say 'Y' here.
199 169
200config MAGIC_SYSRQ 170config MAGIC_SYSRQ
201 bool "Magic SysRq key" 171 bool "Magic SysRq key"
202 depends on MCONSOLE 172 depends on MCONSOLE
203 ---help--- 173 help
204 If you say Y here, you will have some control over the system even 174 If you say Y here, you will have some control over the system even
205 if the system crashes for example during kernel debugging (e.g., you 175 if the system crashes for example during kernel debugging (e.g., you
206 will be able to flush the buffer cache to disk, reboot the system 176 will be able to flush the buffer cache to disk, reboot the system
207 immediately or dump some status information). A key for each of the 177 immediately or dump some status information). A key for each of the
208 possible requests is provided. 178 possible requests is provided.
209 179
210 This is the feature normally accomplished by pressing a key 180 This is the feature normally accomplished by pressing a key
211 while holding SysRq (Alt+PrintScreen). 181 while holding SysRq (Alt+PrintScreen).
212 182
213 On UML, this is accomplished by sending a "sysrq" command with 183 On UML, this is accomplished by sending a "sysrq" command with
214 mconsole, followed by the letter for the requested command. 184 mconsole, followed by the letter for the requested command.
215 185
216 The keys are documented in <file:Documentation/sysrq.txt>. Don't say Y 186 The keys are documented in <file:Documentation/sysrq.txt>. Don't say Y
217 unless you really know what this hack does. 187 unless you really know what this hack does.
218 188
219config SMP 189config SMP
220 bool "Symmetric multi-processing support (EXPERIMENTAL)" 190 bool "Symmetric multi-processing support (EXPERIMENTAL)"
221 default n 191 default n
222 #SMP_BROKEN is for x86_64. 192 #SMP_BROKEN is for x86_64.
223 depends on MODE_TT && EXPERIMENTAL && (!SMP_BROKEN || (BROKEN && SMP_BROKEN)) 193 depends on EXPERIMENTAL && (!SMP_BROKEN || (BROKEN && SMP_BROKEN))
224 help 194 help
225 This option enables UML SMP support. 195 This option enables UML SMP support.
226 It is NOT related to having a real SMP box. Not directly, at least. 196 It is NOT related to having a real SMP box. Not directly, at least.
227 197
228 UML implements virtual SMP by allowing as many processes to run 198 UML implements virtual SMP by allowing as many processes to run
229 simultaneously on the host as there are virtual processors configured. 199 simultaneously on the host as there are virtual processors configured.
230 200
231 Obviously, if the host is a uniprocessor, those processes will 201 Obviously, if the host is a uniprocessor, those processes will
232 timeshare, but, inside UML, will appear to be running simultaneously. 202 timeshare, but, inside UML, will appear to be running simultaneously.
233 If the host is a multiprocessor, then UML processes may run 203 If the host is a multiprocessor, then UML processes may run
234 simultaneously, depending on the host scheduler. 204 simultaneously, depending on the host scheduler.
235 205
236 This, however, is supported only in TT mode. So, if you use the SKAS 206 This, however, is supported only in TT mode. So, if you use the SKAS
237 patch on your host, switching to TT mode and enabling SMP usually gives 207 patch on your host, switching to TT mode and enabling SMP usually
238 you worse performances. 208 gives you worse performances.
239 Also, since the support for SMP has been under-developed, there could 209 Also, since the support for SMP has been under-developed, there could
240 be some bugs being exposed by enabling SMP. 210 be some bugs being exposed by enabling SMP.
241 211
242 If you don't know what to do, say N. 212 If you don't know what to do, say N.
243 213
244config NR_CPUS 214config NR_CPUS
245 int "Maximum number of CPUs (2-32)" 215 int "Maximum number of CPUs (2-32)"
@@ -251,29 +221,24 @@ config NEST_LEVEL
251 int "Nesting level" 221 int "Nesting level"
252 default "0" 222 default "0"
253 help 223 help
254 This is set to the number of layers of UMLs that this UML will be run 224 This is set to the number of layers of UMLs that this UML will be run
255 in. Normally, this is zero, meaning that it will run directly on the 225 in. Normally, this is zero, meaning that it will run directly on the
256 host. Setting it to one will build a UML that can run inside a UML 226 host. Setting it to one will build a UML that can run inside a UML
257 that is running on the host. Generally, if you intend this UML to run 227 that is running on the host. Generally, if you intend this UML to run
258 inside another UML, set CONFIG_NEST_LEVEL to one more than the host 228 inside another UML, set CONFIG_NEST_LEVEL to one more than the host
259 UML. 229 UML.
260
261 Note that if the hosting UML has its CONFIG_KERNEL_HALF_GIGS set to
262 greater than one, then the guest UML should have its CONFIG_NEST_LEVEL
263 set to the host's CONFIG_NEST_LEVEL + CONFIG_KERNEL_HALF_GIGS.
264 Only change this if you are running nested UMLs.
265 230
266config HIGHMEM 231config HIGHMEM
267 bool "Highmem support (EXPERIMENTAL)" 232 bool "Highmem support (EXPERIMENTAL)"
268 depends on !64BIT && EXPERIMENTAL 233 depends on !64BIT && EXPERIMENTAL
269 default n 234 default n
270 help 235 help
271 This was used to allow UML to run with big amounts of memory. 236 This was used to allow UML to run with big amounts of memory.
272 Currently it is unstable, so if unsure say N. 237 Currently it is unstable, so if unsure say N.
273 238
274 To use big amounts of memory, it is recommended to disable TT mode (i.e. 239 To use big amounts of memory, it is recommended enable static
275 CONFIG_MODE_TT) and enable static linking (i.e. CONFIG_STATIC_LINK) - 240 linking (i.e. CONFIG_STATIC_LINK) - this should allow the
276 this should allow the guest to use up to 2.75G of memory. 241 guest to use up to 2.75G of memory.
277 242
278config KERNEL_STACK_ORDER 243config KERNEL_STACK_ORDER
279 int "Kernel stack size order" 244 int "Kernel stack size order"
@@ -281,20 +246,9 @@ config KERNEL_STACK_ORDER
281 range 1 10 if 64BIT 246 range 1 10 if 64BIT
282 default 0 if !64BIT 247 default 0 if !64BIT
283 help 248 help
284 This option determines the size of UML kernel stacks. They will 249 This option determines the size of UML kernel stacks. They will
285 be 1 << order pages. The default is OK unless you're running Valgrind 250 be 1 << order pages. The default is OK unless you're running Valgrind
286 on UML, in which case, set this to 3. 251 on UML, in which case, set this to 3.
287
288config UML_REAL_TIME_CLOCK
289 bool "Real-time Clock"
290 default y
291 help
292 This option makes UML time deltas match wall clock deltas. This should
293 normally be enabled. The exception would be if you are debugging with
294 UML and spend long times with UML stopped at a breakpoint. In this
295 case, when UML is restarted, it will call the timer enough times to make
296 up for the time spent at the breakpoint. This could result in a
297 noticeable lag. If this is a problem, then disable this option.
298 252
299endmenu 253endmenu
300 254
diff --git a/arch/um/Kconfig.char b/arch/um/Kconfig.char
index a5b079d5e865..9a78d354f0b4 100644
--- a/arch/um/Kconfig.char
+++ b/arch/um/Kconfig.char
@@ -5,7 +5,7 @@ config STDERR_CONSOLE
5 bool "stderr console" 5 bool "stderr console"
6 default y 6 default y
7 help 7 help
8 console driver which dumps all printk messages to stderr. 8 console driver which dumps all printk messages to stderr.
9 9
10config STDIO_CONSOLE 10config STDIO_CONSOLE
11 bool 11 bool
@@ -14,60 +14,58 @@ config STDIO_CONSOLE
14config SSL 14config SSL
15 bool "Virtual serial line" 15 bool "Virtual serial line"
16 help 16 help
17 The User-Mode Linux environment allows you to create virtual serial 17 The User-Mode Linux environment allows you to create virtual serial
18 lines on the UML that are usually made to show up on the host as 18 lines on the UML that are usually made to show up on the host as
19 ttys or ptys. 19 ttys or ptys.
20 20
21 See <http://user-mode-linux.sourceforge.net/input.html> for more 21 See <http://user-mode-linux.sourceforge.net/input.html> for more
22 information and command line examples of how to use this facility. 22 information and command line examples of how to use this facility.
23 23
24 Unless you have a specific reason for disabling this, say Y. 24 Unless you have a specific reason for disabling this, say Y.
25 25
26config NULL_CHAN 26config NULL_CHAN
27 bool "null channel support" 27 bool "null channel support"
28 help 28 help
29 This option enables support for attaching UML consoles and serial 29 This option enables support for attaching UML consoles and serial
30 lines to a device similar to /dev/null. Data written to it disappears 30 lines to a device similar to /dev/null. Data written to it disappears
31 and there is never any data to be read. 31 and there is never any data to be read.
32 32
33config PORT_CHAN 33config PORT_CHAN
34 bool "port channel support" 34 bool "port channel support"
35 help 35 help
36 This option enables support for attaching UML consoles and serial 36 This option enables support for attaching UML consoles and serial
37 lines to host portals. They may be accessed with 'telnet <host> 37 lines to host portals. They may be accessed with 'telnet <host>
38 <port number>'. Any number of consoles and serial lines may be 38 <port number>'. Any number of consoles and serial lines may be
39 attached to a single portal, although what UML device you get when 39 attached to a single portal, although what UML device you get when
40 you telnet to that portal will be unpredictable. 40 you telnet to that portal will be unpredictable.
41 It is safe to say 'Y' here. 41 It is safe to say 'Y' here.
42 42
43config PTY_CHAN 43config PTY_CHAN
44 bool "pty channel support" 44 bool "pty channel support"
45 help 45 help
46 This option enables support for attaching UML consoles and serial 46 This option enables support for attaching UML consoles and serial
47 lines to host pseudo-terminals. Access to both traditional 47 lines to host pseudo-terminals. Access to both traditional
48 pseudo-terminals (/dev/pty*) and pts pseudo-terminals are controlled 48 pseudo-terminals (/dev/pty*) and pts pseudo-terminals are controlled
49 with this option. The assignment of UML devices to host devices 49 with this option. The assignment of UML devices to host devices
50 will be announced in the kernel message log. 50 will be announced in the kernel message log.
51 It is safe to say 'Y' here. 51 It is safe to say 'Y' here.
52 52
53config TTY_CHAN 53config TTY_CHAN
54 bool "tty channel support" 54 bool "tty channel support"
55 help 55 help
56 This option enables support for attaching UML consoles and serial 56 This option enables support for attaching UML consoles and serial
57 lines to host terminals. Access to both virtual consoles 57 lines to host terminals. Access to both virtual consoles
58 (/dev/tty*) and the slave side of pseudo-terminals (/dev/ttyp* and 58 (/dev/tty*) and the slave side of pseudo-terminals (/dev/ttyp* and
59 /dev/pts/*) are controlled by this option. 59 /dev/pts/*) are controlled by this option.
60 It is safe to say 'Y' here. 60 It is safe to say 'Y' here.
61 61
62config XTERM_CHAN 62config XTERM_CHAN
63 bool "xterm channel support" 63 bool "xterm channel support"
64 help 64 help
65 This option enables support for attaching UML consoles and serial 65 This option enables support for attaching UML consoles and serial
66 lines to xterms. Each UML device so assigned will be brought up in 66 lines to xterms. Each UML device so assigned will be brought up in
67 its own xterm. 67 its own xterm.
68 If you disable this option, then CONFIG_PT_PROXY will be disabled as 68 It is safe to say 'Y' here.
69 well, since UML's gdb currently requires an xterm.
70 It is safe to say 'Y' here.
71 69
72config NOCONFIG_CHAN 70config NOCONFIG_CHAN
73 bool 71 bool
@@ -77,39 +75,39 @@ config CON_ZERO_CHAN
77 string "Default main console channel initialization" 75 string "Default main console channel initialization"
78 default "fd:0,fd:1" 76 default "fd:0,fd:1"
79 help 77 help
80 This is the string describing the channel to which the main console 78 This is the string describing the channel to which the main console
81 will be attached by default. This value can be overridden from the 79 will be attached by default. This value can be overridden from the
82 command line. The default value is "fd:0,fd:1", which attaches the 80 command line. The default value is "fd:0,fd:1", which attaches the
83 main console to stdin and stdout. 81 main console to stdin and stdout.
84 It is safe to leave this unchanged. 82 It is safe to leave this unchanged.
85 83
86config CON_CHAN 84config CON_CHAN
87 string "Default console channel initialization" 85 string "Default console channel initialization"
88 default "xterm" 86 default "xterm"
89 help 87 help
90 This is the string describing the channel to which all consoles 88 This is the string describing the channel to which all consoles
91 except the main console will be attached by default. This value can 89 except the main console will be attached by default. This value can
92 be overridden from the command line. The default value is "xterm", 90 be overridden from the command line. The default value is "xterm",
93 which brings them up in xterms. 91 which brings them up in xterms.
94 It is safe to leave this unchanged, although you may wish to change 92 It is safe to leave this unchanged, although you may wish to change
95 this if you expect the UML that you build to be run in environments 93 this if you expect the UML that you build to be run in environments
96 which don't have X or xterm available. 94 which don't have X or xterm available.
97 95
98config SSL_CHAN 96config SSL_CHAN
99 string "Default serial line channel initialization" 97 string "Default serial line channel initialization"
100 default "pty" 98 default "pty"
101 help 99 help
102 This is the string describing the channel to which the serial lines 100 This is the string describing the channel to which the serial lines
103 will be attached by default. This value can be overridden from the 101 will be attached by default. This value can be overridden from the
104 command line. The default value is "pty", which attaches them to 102 command line. The default value is "pty", which attaches them to
105 traditional pseudo-terminals. 103 traditional pseudo-terminals.
106 It is safe to leave this unchanged, although you may wish to change 104 It is safe to leave this unchanged, although you may wish to change
107 this if you expect the UML that you build to be run in environments 105 this if you expect the UML that you build to be run in environments
108 which don't have a set of /dev/pty* devices. 106 which don't have a set of /dev/pty* devices.
109 107
110config UNIX98_PTYS 108config UNIX98_PTYS
111 bool "Unix98 PTY support" 109 bool "Unix98 PTY support"
112 ---help--- 110 help
113 A pseudo terminal (PTY) is a software device consisting of two 111 A pseudo terminal (PTY) is a software device consisting of two
114 halves: a master and a slave. The slave device behaves identical to 112 halves: a master and a slave. The slave device behaves identical to
115 a physical terminal; the master device is used by a process to 113 a physical terminal; the master device is used by a process to
@@ -132,7 +130,7 @@ config UNIX98_PTYS
132config LEGACY_PTYS 130config LEGACY_PTYS
133 bool "Legacy (BSD) PTY support" 131 bool "Legacy (BSD) PTY support"
134 default y 132 default y
135 ---help--- 133 help
136 A pseudo terminal (PTY) is a software device consisting of two 134 A pseudo terminal (PTY) is a software device consisting of two
137 halves: a master and a slave. The slave device behaves identical to 135 halves: a master and a slave. The slave device behaves identical to
138 a physical terminal; the master device is used by a process to 136 a physical terminal; the master device is used by a process to
@@ -170,7 +168,7 @@ config LEGACY_PTY_COUNT
170 int "Maximum number of legacy PTY in use" 168 int "Maximum number of legacy PTY in use"
171 depends on LEGACY_PTYS 169 depends on LEGACY_PTYS
172 default "256" 170 default "256"
173 ---help--- 171 help
174 The maximum number of legacy PTYs that can be used at any one time. 172 The maximum number of legacy PTYs that can be used at any one time.
175 The default is 256, and should be more than enough. Embedded 173 The default is 256, and should be more than enough. Embedded
176 systems may want to reduce this to save memory. 174 systems may want to reduce this to save memory.
@@ -196,10 +194,10 @@ config UML_WATCHDOG
196config UML_SOUND 194config UML_SOUND
197 tristate "Sound support" 195 tristate "Sound support"
198 help 196 help
199 This option enables UML sound support. If enabled, it will pull in 197 This option enables UML sound support. If enabled, it will pull in
200 soundcore and the UML hostaudio relay, which acts as a intermediary 198 soundcore and the UML hostaudio relay, which acts as a intermediary
201 between the host's dsp and mixer devices and the UML sound system. 199 between the host's dsp and mixer devices and the UML sound system.
202 It is safe to say 'Y' here. 200 It is safe to say 'Y' here.
203 201
204config SOUND 202config SOUND
205 tristate 203 tristate
@@ -217,22 +215,21 @@ config HW_RANDOM
217config UML_RANDOM 215config UML_RANDOM
218 tristate "Hardware random number generator" 216 tristate "Hardware random number generator"
219 help 217 help
220 This option enables UML's "hardware" random number generator. It 218 This option enables UML's "hardware" random number generator. It
221 attaches itself to the host's /dev/random, supplying as much entropy 219 attaches itself to the host's /dev/random, supplying as much entropy
222 as the host has, rather than the small amount the UML gets from its 220 as the host has, rather than the small amount the UML gets from its
223 own drivers. It registers itself as a standard hardware random number 221 own drivers. It registers itself as a standard hardware random number
224 generator, major 10, minor 183, and the canonical device name is 222 generator, major 10, minor 183, and the canonical device name is
225 /dev/hwrng. 223 /dev/hwrng.
226 The way to make use of this is to install the rng-tools package 224 The way to make use of this is to install the rng-tools package
227 (check your distro, or download from 225 (check your distro, or download from
228 http://sourceforge.net/projects/gkernel/). rngd periodically reads 226 http://sourceforge.net/projects/gkernel/). rngd periodically reads
229 /dev/hwrng and injects the entropy into /dev/random. 227 /dev/hwrng and injects the entropy into /dev/random.
230 228
231config MMAPPER 229config MMAPPER
232 tristate "iomem emulation driver" 230 tristate "iomem emulation driver"
233 help 231 help
234 This driver allows a host file to be used as emulated IO memory inside 232 This driver allows a host file to be used as emulated IO memory inside
235 UML. 233 UML.
236 234
237endmenu 235endmenu
238
diff --git a/arch/um/Kconfig.debug b/arch/um/Kconfig.debug
index c86f5eb29fd5..1f6462ffd3e8 100644
--- a/arch/um/Kconfig.debug
+++ b/arch/um/Kconfig.debug
@@ -2,50 +2,31 @@ menu "Kernel hacking"
2 2
3source "lib/Kconfig.debug" 3source "lib/Kconfig.debug"
4 4
5config CMDLINE_ON_HOST
6 bool "Show command line arguments on the host in TT mode"
7 depends on MODE_TT
8 default !DEBUG_INFO
9 help
10 This controls whether arguments in guest processes should be shown on
11 the host's ps output.
12 Enabling this option hinders debugging on some recent GDB versions
13 (because GDB gets "confused" when we do an execvp()). So probably you
14 should disable it.
15
16config PT_PROXY
17 bool "Enable ptrace proxy"
18 depends on XTERM_CHAN && DEBUG_INFO && MODE_TT
19 help
20 This option enables a debugging interface which allows gdb to debug
21 the kernel without needing to actually attach to kernel threads.
22 If you want to do kernel debugging, say Y here; otherwise say N.
23
24config GPROF 5config GPROF
25 bool "Enable gprof support" 6 bool "Enable gprof support"
26 depends on DEBUG_INFO && MODE_SKAS && !MODE_TT 7 depends on DEBUG_INFO
27 help 8 help
28 This allows profiling of a User-Mode Linux kernel with the gprof 9 This allows profiling of a User-Mode Linux kernel with the gprof
29 utility. 10 utility.
30 11
31 See <http://user-mode-linux.sourceforge.net/gprof.html> for more 12 See <http://user-mode-linux.sourceforge.net/gprof.html> for more
32 details. 13 details.
33 14
34 If you're involved in UML kernel development and want to use gprof, 15 If you're involved in UML kernel development and want to use gprof,
35 say Y. If you're unsure, say N. 16 say Y. If you're unsure, say N.
36 17
37config GCOV 18config GCOV
38 bool "Enable gcov support" 19 bool "Enable gcov support"
39 depends on DEBUG_INFO && MODE_SKAS 20 depends on DEBUG_INFO
40 help 21 help
41 This option allows developers to retrieve coverage data from a UML 22 This option allows developers to retrieve coverage data from a UML
42 session. 23 session.
43 24
44 See <http://user-mode-linux.sourceforge.net/gprof.html> for more 25 See <http://user-mode-linux.sourceforge.net/gprof.html> for more
45 details. 26 details.
46 27
47 If you're involved in UML kernel development and want to use gcov, 28 If you're involved in UML kernel development and want to use gcov,
48 say Y. If you're unsure, say N. 29 say Y. If you're unsure, say N.
49 30
50config DEBUG_STACK_USAGE 31config DEBUG_STACK_USAGE
51 bool "Stack utilization instrumentation" 32 bool "Stack utilization instrumentation"
diff --git a/arch/um/Kconfig.i386 b/arch/um/Kconfig.i386
index d6cffb27fff8..9876d80d85dd 100644
--- a/arch/um/Kconfig.i386
+++ b/arch/um/Kconfig.i386
@@ -65,20 +65,6 @@ config 3_LEVEL_PGTABLES
65 However, this it experimental on 32-bit architectures, so if unsure say 65 However, this it experimental on 32-bit architectures, so if unsure say
66 N (on x86-64 it's automatically enabled, instead, as it's safe there). 66 N (on x86-64 it's automatically enabled, instead, as it's safe there).
67 67
68config STUB_CODE
69 hex
70 default 0xbfffe000 if !HOST_VMSPLIT_2G
71 default 0x7fffe000 if HOST_VMSPLIT_2G
72
73config STUB_DATA
74 hex
75 default 0xbffff000 if !HOST_VMSPLIT_2G
76 default 0x7ffff000 if HOST_VMSPLIT_2G
77
78config STUB_START
79 hex
80 default STUB_CODE
81
82config ARCH_HAS_SC_SIGNALS 68config ARCH_HAS_SC_SIGNALS
83 bool 69 bool
84 default y 70 default y
diff --git a/arch/um/Kconfig.net b/arch/um/Kconfig.net
index 14a04ebdeae9..66e50026ade9 100644
--- a/arch/um/Kconfig.net
+++ b/arch/um/Kconfig.net
@@ -108,6 +108,28 @@ config UML_NET_DAEMON
108 more than one without conflict. If you don't need UML networking, 108 more than one without conflict. If you don't need UML networking,
109 say N. 109 say N.
110 110
111config UML_NET_VDE
112 bool "VDE transport"
113 depends on UML_NET
114 help
115 This User-Mode Linux network transport allows one or more running
116 UMLs on a single host to communicate with each other and also
117 with the rest of the world using Virtual Distributed Ethernet,
118 an improved fork of uml_switch.
119
120 You must have libvdeplug installed in order to build the vde
121 transport into UML.
122
123 To use this form of networking, you will need to run vde_switch
124 on the host.
125
126 For more information, see <http://wiki.virtualsquare.org/>
127 That site has a good overview of what VDE is and also examples
128 of the UML command line to use to enable VDE networking.
129
130 If you need UML networking with VDE,
131 say Y.
132
111config UML_NET_MCAST 133config UML_NET_MCAST
112 bool "Multicast transport" 134 bool "Multicast transport"
113 depends on UML_NET 135 depends on UML_NET
diff --git a/arch/um/Kconfig.x86_64 b/arch/um/Kconfig.x86_64
index f60e9e506424..d632e9a89cc3 100644
--- a/arch/um/Kconfig.x86_64
+++ b/arch/um/Kconfig.x86_64
@@ -17,24 +17,12 @@ config SEMAPHORE_SLEEPERS
17 17
18config TOP_ADDR 18config TOP_ADDR
19 hex 19 hex
20 default 0x80000000 20 default 0x7fc0000000
21 21
22config 3_LEVEL_PGTABLES 22config 3_LEVEL_PGTABLES
23 bool 23 bool
24 default y 24 default y
25 25
26config STUB_CODE
27 hex
28 default 0x7fbfffe000
29
30config STUB_DATA
31 hex
32 default 0x7fbffff000
33
34config STUB_START
35 hex
36 default STUB_CODE
37
38config ARCH_HAS_SC_SIGNALS 26config ARCH_HAS_SC_SIGNALS
39 bool 27 bool
40 default n 28 default n
diff --git a/arch/um/Makefile b/arch/um/Makefile
index d08d3bc518e3..82c2ac48040d 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -2,7 +2,7 @@
2# This file is included by the global makefile so that you can add your own 2# This file is included by the global makefile so that you can add your own
3# architecture-specific flags and dependencies. 3# architecture-specific flags and dependencies.
4# 4#
5# Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 5# Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
6# Licensed under the GPL 6# Licensed under the GPL
7# 7#
8 8
@@ -31,18 +31,9 @@ SYMLINK_HEADERS := $(foreach header,$(SYMLINK_HEADERS),include/asm-um/$(header))
31ARCH_SYMLINKS = include/asm-um/arch $(ARCH_DIR)/include/sysdep $(ARCH_DIR)/os \ 31ARCH_SYMLINKS = include/asm-um/arch $(ARCH_DIR)/include/sysdep $(ARCH_DIR)/os \
32 $(SYMLINK_HEADERS) $(ARCH_DIR)/include/uml-config.h 32 $(SYMLINK_HEADERS) $(ARCH_DIR)/include/uml-config.h
33 33
34um-modes-$(CONFIG_MODE_TT) += tt 34MODE_INCLUDE += -I$(srctree)/$(ARCH_DIR)/include/skas
35um-modes-$(CONFIG_MODE_SKAS) += skas
36 35
37MODE_INCLUDE += $(foreach mode,$(um-modes-y),\ 36include $(srctree)/$(ARCH_DIR)/Makefile-skas
38 -I$(srctree)/$(ARCH_DIR)/include/$(mode))
39
40MAKEFILES-INCL += $(foreach mode,$(um-modes-y),\
41 $(srctree)/$(ARCH_DIR)/Makefile-$(mode))
42
43ifneq ($(MAKEFILES-INCL),)
44 include $(MAKEFILES-INCL)
45endif
46 37
47ARCH_INCLUDE := -I$(ARCH_DIR)/include 38ARCH_INCLUDE := -I$(ARCH_DIR)/include
48ifneq ($(KBUILD_SRC),) 39ifneq ($(KBUILD_SRC),)
@@ -60,7 +51,8 @@ SYS_DIR := $(ARCH_DIR)/include/sysdep-$(SUBARCH)
60 51
61KBUILD_CFLAGS += $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \ 52KBUILD_CFLAGS += $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \
62 $(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \ 53 $(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \
63 -Din6addr_loopback=kernel_in6addr_loopback 54 -Din6addr_loopback=kernel_in6addr_loopback \
55 -Din6addr_any=kernel_in6addr_any
64 56
65KBUILD_AFLAGS += $(ARCH_INCLUDE) 57KBUILD_AFLAGS += $(ARCH_INCLUDE)
66 58
@@ -88,9 +80,8 @@ KBUILD_CFLAGS += $(call cc-option,-fno-unit-at-a-time,)
88# included; the values here are meaningless 80# included; the values here are meaningless
89 81
90CONFIG_NEST_LEVEL ?= 0 82CONFIG_NEST_LEVEL ?= 0
91CONFIG_KERNEL_HALF_GIGS ?= 0
92 83
93SIZE = (($(CONFIG_NEST_LEVEL) + $(CONFIG_KERNEL_HALF_GIGS)) * 0x20000000) 84SIZE = ($(CONFIG_NEST_LEVEL) * 0x20000000)
94 85
95PHONY += linux 86PHONY += linux
96 87
@@ -123,7 +114,6 @@ CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,)
123 $(call cc-option, -fno-stack-protector,) \ 114 $(call cc-option, -fno-stack-protector,) \
124 $(call cc-option, -fno-stack-protector-all,) 115 $(call cc-option, -fno-stack-protector-all,)
125 116
126CPP_MODE-$(CONFIG_MODE_TT) := -DMODE_TT
127CONFIG_KERNEL_STACK_ORDER ?= 2 117CONFIG_KERNEL_STACK_ORDER ?= 2
128STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] ) 118STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] )
129 119
@@ -131,13 +121,10 @@ ifndef START
131 START = $(shell echo $$[ $(TOP_ADDR) - $(SIZE) ] ) 121 START = $(shell echo $$[ $(TOP_ADDR) - $(SIZE) ] )
132endif 122endif
133 123
134CPPFLAGS_vmlinux.lds = -U$(SUBARCH) \ 124CPPFLAGS_vmlinux.lds = -U$(SUBARCH) -DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \
135 -DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \ 125 -DELF_FORMAT="$(ELF_FORMAT)" -DKERNEL_STACK_SIZE=$(STACK_SIZE)
136 -DELF_FORMAT="$(ELF_FORMAT)" $(CPP_MODE-y) \
137 -DKERNEL_STACK_SIZE=$(STACK_SIZE) \
138 -DUNMAP_PATH=arch/um/sys-$(SUBARCH)/unmap.o
139 126
140#The wrappers will select whether using "malloc" or the kernel allocator. 127# The wrappers will select whether using "malloc" or the kernel allocator.
141LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc 128LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
142 129
143CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) 130CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS)
@@ -150,8 +137,8 @@ define cmd_vmlinux__
150 FORCE ,$^) ; rm -f linux 137 FORCE ,$^) ; rm -f linux
151endef 138endef
152 139
153#When cleaning we don't include .config, so we don't include 140# When cleaning we don't include .config, so we don't include
154#TT or skas makefiles and don't clean skas_ptregs.h. 141# TT or skas makefiles and don't clean skas_ptregs.h.
155CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/include/uml-config.h \ 142CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/include/uml-config.h \
156 $(ARCH_DIR)/include/user_constants.h \ 143 $(ARCH_DIR)/include/user_constants.h \
157 $(ARCH_DIR)/include/kern_constants.h $(ARCH_DIR)/Kconfig.arch 144 $(ARCH_DIR)/include/kern_constants.h $(ARCH_DIR)/Kconfig.arch
@@ -176,9 +163,9 @@ include/asm-um/arch:
176 @echo ' SYMLINK $@' 163 @echo ' SYMLINK $@'
177ifneq ($(KBUILD_SRC),) 164ifneq ($(KBUILD_SRC),)
178 $(Q)mkdir -p $(objtree)/include/asm-um 165 $(Q)mkdir -p $(objtree)/include/asm-um
179 $(Q)ln -fsn $(srctree)/include/asm-$(SUBARCH) include/asm-um/arch 166 $(Q)ln -fsn $(srctree)/include/asm-$(HEADER_ARCH) include/asm-um/arch
180else 167else
181 $(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(SUBARCH) arch 168 $(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(HEADER_ARCH) arch
182endif 169endif
183 170
184$(objtree)/$(ARCH_DIR)/include: 171$(objtree)/$(ARCH_DIR)/include:
@@ -232,4 +219,4 @@ $(ARCH_DIR)/include/kern_constants.h: $(objtree)/$(ARCH_DIR)/include
232 @echo ' SYMLINK $@' 219 @echo ' SYMLINK $@'
233 $(Q)ln -sf ../../../include/asm-um/asm-offsets.h $@ 220 $(Q)ln -sf ../../../include/asm-um/asm-offsets.h $@
234 221
235export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS 222export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS HEADER_ARCH
diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386
index d10e4dc0dae8..0178df306939 100644
--- a/arch/um/Makefile-i386
+++ b/arch/um/Makefile-i386
@@ -1,17 +1,14 @@
1core-y += arch/um/sys-i386/ arch/i386/crypto/ 1core-y += arch/um/sys-i386/ arch/x86/crypto/
2 2
3TOP_ADDR := $(CONFIG_TOP_ADDR) 3TOP_ADDR := $(CONFIG_TOP_ADDR)
4 4
5ifeq ($(CONFIG_MODE_SKAS),y) 5START := 0x8048000
6 ifneq ($(CONFIG_MODE_TT),y)
7 START := 0x8048000
8 endif
9endif
10 6
11LDFLAGS += -m elf_i386 7LDFLAGS += -m elf_i386
12ELF_ARCH := $(SUBARCH) 8ELF_ARCH := $(SUBARCH)
13ELF_FORMAT := elf32-$(SUBARCH) 9ELF_FORMAT := elf32-$(SUBARCH)
14OBJCOPYFLAGS := -O binary -R .note -R .comment -S 10OBJCOPYFLAGS := -O binary -R .note -R .comment -S
11HEADER_ARCH := x86
15 12
16ifeq ("$(origin SUBARCH)", "command line") 13ifeq ("$(origin SUBARCH)", "command line")
17ifneq ("$(shell uname -m | sed -e s/i.86/i386/)", "$(SUBARCH)") 14ifneq ("$(shell uname -m | sed -e s/i.86/i386/)", "$(SUBARCH)")
@@ -24,6 +21,11 @@ export LDFLAGS HOSTCFLAGS HOSTLDFLAGS UML_OBJCOPYFLAGS
24endif 21endif
25endif 22endif
26 23
24CFLAGS += -DCONFIG_X86_32
25AFLAGS += -DCONFIG_X86_32
26CONFIG_X86_32 := y
27export CONFIG_X86_32
28
27ARCH_KERNEL_DEFINES += -U__$(SUBARCH)__ -U$(SUBARCH) 29ARCH_KERNEL_DEFINES += -U__$(SUBARCH)__ -U$(SUBARCH)
28 30
29# First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y. 31# First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y.
diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64
index bcfd6ea30030..fe5316f0c6a5 100644
--- a/arch/um/Makefile-x86_64
+++ b/arch/um/Makefile-x86_64
@@ -1,7 +1,7 @@
1# Copyright 2003 - 2004 Pathscale, Inc 1# Copyright 2003 - 2004 Pathscale, Inc
2# Released under the GPL 2# Released under the GPL
3 3
4core-y += arch/um/sys-x86_64/ arch/x86_64/crypto/ 4core-y += arch/um/sys-x86_64/ arch/x86/crypto/
5START := 0x60000000 5START := 0x60000000
6 6
7_extra_flags_ = -fno-builtin -m64 7_extra_flags_ = -fno-builtin -m64
@@ -18,6 +18,7 @@ KBUILD_CPPFLAGS += -m64
18 18
19ELF_ARCH := i386:x86-64 19ELF_ARCH := i386:x86-64
20ELF_FORMAT := elf64-x86-64 20ELF_FORMAT := elf64-x86-64
21HEADER_ARCH := x86
21 22
22# Not on all 64-bit distros /lib is a symlink to /lib64. PLD is an example. 23# Not on all 64-bit distros /lib is a symlink to /lib64. PLD is an example.
23 24
diff --git a/arch/um/defconfig b/arch/um/defconfig
index 1e0f677c2f46..f609edede065 100644
--- a/arch/um/defconfig
+++ b/arch/um/defconfig
@@ -12,9 +12,7 @@ CONFIG_IRQ_RELEASE_METHOD=y
12# 12#
13# UML-specific options 13# UML-specific options
14# 14#
15# CONFIG_MODE_TT is not set
16# CONFIG_STATIC_LINK is not set 15# CONFIG_STATIC_LINK is not set
17CONFIG_MODE_SKAS=y
18 16
19# 17#
20# Host processor type and features 18# Host processor type and features
@@ -61,9 +59,6 @@ CONFIG_SEMAPHORE_SLEEPERS=y
61# CONFIG_HOST_2G_2G is not set 59# CONFIG_HOST_2G_2G is not set
62CONFIG_TOP_ADDR=0xc0000000 60CONFIG_TOP_ADDR=0xc0000000
63# CONFIG_3_LEVEL_PGTABLES is not set 61# CONFIG_3_LEVEL_PGTABLES is not set
64CONFIG_STUB_CODE=0xbfffe000
65CONFIG_STUB_DATA=0xbffff000
66CONFIG_STUB_START=0xbfffe000
67CONFIG_ARCH_HAS_SC_SIGNALS=y 62CONFIG_ARCH_HAS_SC_SIGNALS=y
68CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA=y 63CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA=y
69CONFIG_GENERIC_HWEIGHT=y 64CONFIG_GENERIC_HWEIGHT=y
@@ -75,6 +70,9 @@ CONFIG_FLATMEM=y
75CONFIG_FLAT_NODE_MEM_MAP=y 70CONFIG_FLAT_NODE_MEM_MAP=y
76# CONFIG_SPARSEMEM_STATIC is not set 71# CONFIG_SPARSEMEM_STATIC is not set
77CONFIG_SPLIT_PTLOCK_CPUS=4 72CONFIG_SPLIT_PTLOCK_CPUS=4
73CONFIG_TICK_ONESHOT=y
74CONFIG_NO_HZ=y
75CONFIG_HIGH_RES_TIMERS=y
78CONFIG_LD_SCRIPT_DYN=y 76CONFIG_LD_SCRIPT_DYN=y
79CONFIG_NET=y 77CONFIG_NET=y
80CONFIG_BINFMT_ELF=y 78CONFIG_BINFMT_ELF=y
@@ -82,11 +80,10 @@ CONFIG_BINFMT_MISC=m
82# CONFIG_HOSTFS is not set 80# CONFIG_HOSTFS is not set
83# CONFIG_HPPFS is not set 81# CONFIG_HPPFS is not set
84CONFIG_MCONSOLE=y 82CONFIG_MCONSOLE=y
85# CONFIG_MAGIC_SYSRQ is not set 83CONFIG_MAGIC_SYSRQ=y
86CONFIG_NEST_LEVEL=0 84CONFIG_NEST_LEVEL=0
87# CONFIG_HIGHMEM is not set 85# CONFIG_HIGHMEM is not set
88CONFIG_KERNEL_STACK_ORDER=0 86CONFIG_KERNEL_STACK_ORDER=0
89CONFIG_UML_REAL_TIME_CLOCK=y
90 87
91# 88#
92# Code maturity level options 89# Code maturity level options
diff --git a/arch/um/drivers/Makefile b/arch/um/drivers/Makefile
index 0f780dd0d4c4..d283e7b022a0 100644
--- a/arch/um/drivers/Makefile
+++ b/arch/um/drivers/Makefile
@@ -19,10 +19,16 @@ harddog-objs := harddog_kern.o harddog_user.o
19 19
20LDFLAGS_pcap.o := -r $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libpcap.a) 20LDFLAGS_pcap.o := -r $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libpcap.a)
21 21
22targets := pcap_kern.o pcap_user.o 22LDFLAGS_vde.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libvdeplug.a)
23
24targets := pcap_kern.o pcap_user.o vde_kern.o vde_user.o
23 25
24$(obj)/pcap.o: $(obj)/pcap_kern.o $(obj)/pcap_user.o 26$(obj)/pcap.o: $(obj)/pcap_kern.o $(obj)/pcap_user.o
25 $(LD) -r -dp -o $@ $^ $(LDFLAGS) $(LDFLAGS_pcap.o) 27 $(LD) -r -dp -o $@ $^ $(LDFLAGS) $(LDFLAGS_pcap.o)
28
29$(obj)/vde.o: $(obj)/vde_kern.o $(obj)/vde_user.o
30 $(LD) -r -dp -o $@ $^ $(LDFLAGS) $(LDFLAGS_vde.o)
31
26#XXX: The call below does not work because the flags are added before the 32#XXX: The call below does not work because the flags are added before the
27# object name, so nothing from the library gets linked. 33# object name, so nothing from the library gets linked.
28#$(call if_changed,ld) 34#$(call if_changed,ld)
@@ -37,6 +43,7 @@ obj-$(CONFIG_STDERR_CONSOLE) += stderr_console.o
37obj-$(CONFIG_UML_NET_SLIP) += slip.o slip_common.o 43obj-$(CONFIG_UML_NET_SLIP) += slip.o slip_common.o
38obj-$(CONFIG_UML_NET_SLIRP) += slirp.o slip_common.o 44obj-$(CONFIG_UML_NET_SLIRP) += slirp.o slip_common.o
39obj-$(CONFIG_UML_NET_DAEMON) += daemon.o 45obj-$(CONFIG_UML_NET_DAEMON) += daemon.o
46obj-$(CONFIG_UML_NET_VDE) += vde.o
40obj-$(CONFIG_UML_NET_MCAST) += mcast.o 47obj-$(CONFIG_UML_NET_MCAST) += mcast.o
41obj-$(CONFIG_UML_NET_PCAP) += pcap.o 48obj-$(CONFIG_UML_NET_PCAP) += pcap.o
42obj-$(CONFIG_UML_NET) += net.o 49obj-$(CONFIG_UML_NET) += net.o
@@ -54,6 +61,6 @@ obj-$(CONFIG_BLK_DEV_COW_COMMON) += cow_user.o
54obj-$(CONFIG_UML_RANDOM) += random.o 61obj-$(CONFIG_UML_RANDOM) += random.o
55 62
56# pcap_user.o must be added explicitly. 63# pcap_user.o must be added explicitly.
57USER_OBJS := fd.o null.o pty.o tty.o xterm.o slip_common.o pcap_user.o 64USER_OBJS := fd.o null.o pty.o tty.o xterm.o slip_common.o pcap_user.o vde_user.o
58 65
59include arch/um/scripts/Makefile.rules 66include arch/um/scripts/Makefile.rules
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index 629b00e3b0b0..db3082b4da46 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -1,28 +1,19 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <linux/stddef.h>
7#include <linux/kernel.h>
8#include <linux/list.h>
9#include <linux/slab.h> 6#include <linux/slab.h>
10#include <linux/tty.h> 7#include <linux/tty.h>
11#include <linux/string.h>
12#include <linux/tty_flip.h> 8#include <linux/tty_flip.h>
13#include <asm/irq.h>
14#include "chan_kern.h" 9#include "chan_kern.h"
15#include "kern.h"
16#include "irq_user.h"
17#include "sigio.h"
18#include "line.h"
19#include "os.h" 10#include "os.h"
20 11
21#ifdef CONFIG_NOCONFIG_CHAN 12#ifdef CONFIG_NOCONFIG_CHAN
22static void *not_configged_init(char *str, int device, 13static void *not_configged_init(char *str, int device,
23 const struct chan_opts *opts) 14 const struct chan_opts *opts)
24{ 15{
25 printk("Using a channel type which is configured out of " 16 printk(KERN_ERR "Using a channel type which is configured out of "
26 "UML\n"); 17 "UML\n");
27 return NULL; 18 return NULL;
28} 19}
@@ -30,34 +21,34 @@ static void *not_configged_init(char *str, int device,
30static int not_configged_open(int input, int output, int primary, void *data, 21static int not_configged_open(int input, int output, int primary, void *data,
31 char **dev_out) 22 char **dev_out)
32{ 23{
33 printk("Using a channel type which is configured out of " 24 printk(KERN_ERR "Using a channel type which is configured out of "
34 "UML\n"); 25 "UML\n");
35 return -ENODEV; 26 return -ENODEV;
36} 27}
37 28
38static void not_configged_close(int fd, void *data) 29static void not_configged_close(int fd, void *data)
39{ 30{
40 printk("Using a channel type which is configured out of " 31 printk(KERN_ERR "Using a channel type which is configured out of "
41 "UML\n"); 32 "UML\n");
42} 33}
43 34
44static int not_configged_read(int fd, char *c_out, void *data) 35static int not_configged_read(int fd, char *c_out, void *data)
45{ 36{
46 printk("Using a channel type which is configured out of " 37 printk(KERN_ERR "Using a channel type which is configured out of "
47 "UML\n"); 38 "UML\n");
48 return -EIO; 39 return -EIO;
49} 40}
50 41
51static int not_configged_write(int fd, const char *buf, int len, void *data) 42static int not_configged_write(int fd, const char *buf, int len, void *data)
52{ 43{
53 printk("Using a channel type which is configured out of " 44 printk(KERN_ERR "Using a channel type which is configured out of "
54 "UML\n"); 45 "UML\n");
55 return -EIO; 46 return -EIO;
56} 47}
57 48
58static int not_configged_console_write(int fd, const char *buf, int len) 49static int not_configged_console_write(int fd, const char *buf, int len)
59{ 50{
60 printk("Using a channel type which is configured out of " 51 printk(KERN_ERR "Using a channel type which is configured out of "
61 "UML\n"); 52 "UML\n");
62 return -EIO; 53 return -EIO;
63} 54}
@@ -65,14 +56,14 @@ static int not_configged_console_write(int fd, const char *buf, int len)
65static int not_configged_window_size(int fd, void *data, unsigned short *rows, 56static int not_configged_window_size(int fd, void *data, unsigned short *rows,
66 unsigned short *cols) 57 unsigned short *cols)
67{ 58{
68 printk("Using a channel type which is configured out of " 59 printk(KERN_ERR "Using a channel type which is configured out of "
69 "UML\n"); 60 "UML\n");
70 return -ENODEV; 61 return -ENODEV;
71} 62}
72 63
73static void not_configged_free(void *data) 64static void not_configged_free(void *data)
74{ 65{
75 printk("Using a channel type which is configured out of " 66 printk(KERN_ERR "Using a channel type which is configured out of "
76 "UML\n"); 67 "UML\n");
77} 68}
78 69
@@ -89,64 +80,17 @@ static const struct chan_ops not_configged_ops = {
89}; 80};
90#endif /* CONFIG_NOCONFIG_CHAN */ 81#endif /* CONFIG_NOCONFIG_CHAN */
91 82
92void generic_close(int fd, void *unused)
93{
94 os_close_file(fd);
95}
96
97int generic_read(int fd, char *c_out, void *unused)
98{
99 int n;
100
101 n = os_read_file(fd, c_out, sizeof(*c_out));
102
103 if(n == -EAGAIN)
104 return 0;
105 else if(n == 0)
106 return -EIO;
107 return n;
108}
109
110/* XXX Trivial wrapper around os_write_file */
111
112int generic_write(int fd, const char *buf, int n, void *unused)
113{
114 return os_write_file(fd, buf, n);
115}
116
117int generic_window_size(int fd, void *unused, unsigned short *rows_out,
118 unsigned short *cols_out)
119{
120 int rows, cols;
121 int ret;
122
123 ret = os_window_size(fd, &rows, &cols);
124 if(ret < 0)
125 return ret;
126
127 ret = ((*rows_out != rows) || (*cols_out != cols));
128
129 *rows_out = rows;
130 *cols_out = cols;
131
132 return ret;
133}
134
135void generic_free(void *data)
136{
137 kfree(data);
138}
139
140static void tty_receive_char(struct tty_struct *tty, char ch) 83static void tty_receive_char(struct tty_struct *tty, char ch)
141{ 84{
142 if(tty == NULL) return; 85 if (tty == NULL)
86 return;
143 87
144 if(I_IXON(tty) && !I_IXOFF(tty) && !tty->raw) { 88 if (I_IXON(tty) && !I_IXOFF(tty) && !tty->raw) {
145 if(ch == STOP_CHAR(tty)){ 89 if (ch == STOP_CHAR(tty)) {
146 stop_tty(tty); 90 stop_tty(tty);
147 return; 91 return;
148 } 92 }
149 else if(ch == START_CHAR(tty)){ 93 else if (ch == START_CHAR(tty)) {
150 start_tty(tty); 94 start_tty(tty);
151 return; 95 return;
152 } 96 }
@@ -159,14 +103,14 @@ static int open_one_chan(struct chan *chan)
159{ 103{
160 int fd, err; 104 int fd, err;
161 105
162 if(chan->opened) 106 if (chan->opened)
163 return 0; 107 return 0;
164 108
165 if(chan->ops->open == NULL) 109 if (chan->ops->open == NULL)
166 fd = 0; 110 fd = 0;
167 else fd = (*chan->ops->open)(chan->input, chan->output, chan->primary, 111 else fd = (*chan->ops->open)(chan->input, chan->output, chan->primary,
168 chan->data, &chan->dev); 112 chan->data, &chan->dev);
169 if(fd < 0) 113 if (fd < 0)
170 return fd; 114 return fd;
171 115
172 err = os_set_fd_block(fd, 0); 116 err = os_set_fd_block(fd, 0);
@@ -187,10 +131,10 @@ int open_chan(struct list_head *chans)
187 struct chan *chan; 131 struct chan *chan;
188 int ret, err = 0; 132 int ret, err = 0;
189 133
190 list_for_each(ele, chans){ 134 list_for_each(ele, chans) {
191 chan = list_entry(ele, struct chan, list); 135 chan = list_entry(ele, struct chan, list);
192 ret = open_one_chan(chan); 136 ret = open_one_chan(chan);
193 if(chan->primary) 137 if (chan->primary)
194 err = ret; 138 err = ret;
195 } 139 }
196 return err; 140 return err;
@@ -201,9 +145,9 @@ void chan_enable_winch(struct list_head *chans, struct tty_struct *tty)
201 struct list_head *ele; 145 struct list_head *ele;
202 struct chan *chan; 146 struct chan *chan;
203 147
204 list_for_each(ele, chans){ 148 list_for_each(ele, chans) {
205 chan = list_entry(ele, struct chan, list); 149 chan = list_entry(ele, struct chan, list);
206 if(chan->primary && chan->output && chan->ops->winch){ 150 if (chan->primary && chan->output && chan->ops->winch) {
207 register_winch(chan->fd, tty); 151 register_winch(chan->fd, tty);
208 return; 152 return;
209 } 153 }
@@ -216,7 +160,7 @@ int enable_chan(struct line *line)
216 struct chan *chan; 160 struct chan *chan;
217 int err; 161 int err;
218 162
219 list_for_each(ele, &line->chan_list){ 163 list_for_each(ele, &line->chan_list) {
220 chan = list_entry(ele, struct chan, list); 164 chan = list_entry(ele, struct chan, list);
221 err = open_one_chan(chan); 165 err = open_one_chan(chan);
222 if (err) { 166 if (err) {
@@ -226,7 +170,7 @@ int enable_chan(struct line *line)
226 continue; 170 continue;
227 } 171 }
228 172
229 if(chan->enabled) 173 if (chan->enabled)
230 continue; 174 continue;
231 err = line_setup_irq(chan->fd, chan->input, chan->output, line, 175 err = line_setup_irq(chan->fd, chan->input, chan->output, line,
232 chan); 176 chan);
@@ -263,12 +207,12 @@ void free_irqs(void)
263 list_splice_init(&irqs_to_free, &list); 207 list_splice_init(&irqs_to_free, &list);
264 spin_unlock_irqrestore(&irqs_to_free_lock, flags); 208 spin_unlock_irqrestore(&irqs_to_free_lock, flags);
265 209
266 list_for_each(ele, &list){ 210 list_for_each(ele, &list) {
267 chan = list_entry(ele, struct chan, free_list); 211 chan = list_entry(ele, struct chan, free_list);
268 212
269 if(chan->input) 213 if (chan->input)
270 free_irq(chan->line->driver->read_irq, chan); 214 free_irq(chan->line->driver->read_irq, chan);
271 if(chan->output) 215 if (chan->output)
272 free_irq(chan->line->driver->write_irq, chan); 216 free_irq(chan->line->driver->write_irq, chan);
273 chan->enabled = 0; 217 chan->enabled = 0;
274 } 218 }
@@ -278,22 +222,22 @@ static void close_one_chan(struct chan *chan, int delay_free_irq)
278{ 222{
279 unsigned long flags; 223 unsigned long flags;
280 224
281 if(!chan->opened) 225 if (!chan->opened)
282 return; 226 return;
283 227
284 if(delay_free_irq){ 228 if (delay_free_irq) {
285 spin_lock_irqsave(&irqs_to_free_lock, flags); 229 spin_lock_irqsave(&irqs_to_free_lock, flags);
286 list_add(&chan->free_list, &irqs_to_free); 230 list_add(&chan->free_list, &irqs_to_free);
287 spin_unlock_irqrestore(&irqs_to_free_lock, flags); 231 spin_unlock_irqrestore(&irqs_to_free_lock, flags);
288 } 232 }
289 else { 233 else {
290 if(chan->input) 234 if (chan->input)
291 free_irq(chan->line->driver->read_irq, chan); 235 free_irq(chan->line->driver->read_irq, chan);
292 if(chan->output) 236 if (chan->output)
293 free_irq(chan->line->driver->write_irq, chan); 237 free_irq(chan->line->driver->write_irq, chan);
294 chan->enabled = 0; 238 chan->enabled = 0;
295 } 239 }
296 if(chan->ops->close != NULL) 240 if (chan->ops->close != NULL)
297 (*chan->ops->close)(chan->fd, chan->data); 241 (*chan->ops->close)(chan->fd, chan->data);
298 242
299 chan->opened = 0; 243 chan->opened = 0;
@@ -322,7 +266,7 @@ void deactivate_chan(struct list_head *chans, int irq)
322 list_for_each(ele, chans) { 266 list_for_each(ele, chans) {
323 chan = list_entry(ele, struct chan, list); 267 chan = list_entry(ele, struct chan, list);
324 268
325 if(chan->enabled && chan->input) 269 if (chan->enabled && chan->input)
326 deactivate_fd(chan->fd, irq); 270 deactivate_fd(chan->fd, irq);
327 } 271 }
328} 272}
@@ -335,7 +279,7 @@ void reactivate_chan(struct list_head *chans, int irq)
335 list_for_each(ele, chans) { 279 list_for_each(ele, chans) {
336 chan = list_entry(ele, struct chan, list); 280 chan = list_entry(ele, struct chan, list);
337 281
338 if(chan->enabled && chan->input) 282 if (chan->enabled && chan->input)
339 reactivate_fd(chan->fd, irq); 283 reactivate_fd(chan->fd, irq);
340 } 284 }
341} 285}
@@ -347,10 +291,14 @@ int write_chan(struct list_head *chans, const char *buf, int len,
347 struct chan *chan = NULL; 291 struct chan *chan = NULL;
348 int n, ret = 0; 292 int n, ret = 0;
349 293
294 if (len == 0)
295 return 0;
296
350 list_for_each(ele, chans) { 297 list_for_each(ele, chans) {
351 chan = list_entry(ele, struct chan, list); 298 chan = list_entry(ele, struct chan, list);
352 if (!chan->output || (chan->ops->write == NULL)) 299 if (!chan->output || (chan->ops->write == NULL))
353 continue; 300 continue;
301
354 n = chan->ops->write(chan->fd, buf, len, chan->data); 302 n = chan->ops->write(chan->fd, buf, len, chan->data);
355 if (chan->primary) { 303 if (chan->primary) {
356 ret = n; 304 ret = n;
@@ -367,12 +315,14 @@ int console_write_chan(struct list_head *chans, const char *buf, int len)
367 struct chan *chan; 315 struct chan *chan;
368 int n, ret = 0; 316 int n, ret = 0;
369 317
370 list_for_each(ele, chans){ 318 list_for_each(ele, chans) {
371 chan = list_entry(ele, struct chan, list); 319 chan = list_entry(ele, struct chan, list);
372 if(!chan->output || (chan->ops->console_write == NULL)) 320 if (!chan->output || (chan->ops->console_write == NULL))
373 continue; 321 continue;
322
374 n = chan->ops->console_write(chan->fd, buf, len); 323 n = chan->ops->console_write(chan->fd, buf, len);
375 if(chan->primary) ret = n; 324 if (chan->primary)
325 ret = n;
376 } 326 }
377 return ret; 327 return ret;
378} 328}
@@ -382,10 +332,11 @@ int console_open_chan(struct line *line, struct console *co)
382 int err; 332 int err;
383 333
384 err = open_chan(&line->chan_list); 334 err = open_chan(&line->chan_list);
385 if(err) 335 if (err)
386 return err; 336 return err;
387 337
388 printk("Console initialized on /dev/%s%d\n", co->name, co->index); 338 printk(KERN_INFO "Console initialized on /dev/%s%d\n", co->name,
339 co->index);
389 return 0; 340 return 0;
390} 341}
391 342
@@ -395,10 +346,10 @@ int chan_window_size(struct list_head *chans, unsigned short *rows_out,
395 struct list_head *ele; 346 struct list_head *ele;
396 struct chan *chan; 347 struct chan *chan;
397 348
398 list_for_each(ele, chans){ 349 list_for_each(ele, chans) {
399 chan = list_entry(ele, struct chan, list); 350 chan = list_entry(ele, struct chan, list);
400 if(chan->primary){ 351 if (chan->primary) {
401 if(chan->ops->window_size == NULL) 352 if (chan->ops->window_size == NULL)
402 return 0; 353 return 0;
403 return chan->ops->window_size(chan->fd, chan->data, 354 return chan->ops->window_size(chan->fd, chan->data,
404 rows_out, cols_out); 355 rows_out, cols_out);
@@ -413,10 +364,11 @@ static void free_one_chan(struct chan *chan, int delay_free_irq)
413 364
414 close_one_chan(chan, delay_free_irq); 365 close_one_chan(chan, delay_free_irq);
415 366
416 if(chan->ops->free != NULL) 367 if (chan->ops->free != NULL)
417 (*chan->ops->free)(chan->data); 368 (*chan->ops->free)(chan->data);
418 369
419 if(chan->primary && chan->output) ignore_sigio_fd(chan->fd); 370 if (chan->primary && chan->output)
371 ignore_sigio_fd(chan->fd);
420 kfree(chan); 372 kfree(chan);
421} 373}
422 374
@@ -425,7 +377,7 @@ static void free_chan(struct list_head *chans, int delay_free_irq)
425 struct list_head *ele, *next; 377 struct list_head *ele, *next;
426 struct chan *chan; 378 struct chan *chan;
427 379
428 list_for_each_safe(ele, next, chans){ 380 list_for_each_safe(ele, next, chans) {
429 chan = list_entry(ele, struct chan, list); 381 chan = list_entry(ele, struct chan, list);
430 free_one_chan(chan, delay_free_irq); 382 free_one_chan(chan, delay_free_irq);
431 } 383 }
@@ -436,14 +388,14 @@ static int one_chan_config_string(struct chan *chan, char *str, int size,
436{ 388{
437 int n = 0; 389 int n = 0;
438 390
439 if(chan == NULL){ 391 if (chan == NULL) {
440 CONFIG_CHUNK(str, size, n, "none", 1); 392 CONFIG_CHUNK(str, size, n, "none", 1);
441 return n; 393 return n;
442 } 394 }
443 395
444 CONFIG_CHUNK(str, size, n, chan->ops->type, 0); 396 CONFIG_CHUNK(str, size, n, chan->ops->type, 0);
445 397
446 if(chan->dev == NULL){ 398 if (chan->dev == NULL) {
447 CONFIG_CHUNK(str, size, n, "", 1); 399 CONFIG_CHUNK(str, size, n, "", 1);
448 return n; 400 return n;
449 } 401 }
@@ -463,7 +415,7 @@ static int chan_pair_config_string(struct chan *in, struct chan *out,
463 str += n; 415 str += n;
464 size -= n; 416 size -= n;
465 417
466 if(in == out){ 418 if (in == out) {
467 CONFIG_CHUNK(str, size, n, "", 1); 419 CONFIG_CHUNK(str, size, n, "", 1);
468 return n; 420 return n;
469 } 421 }
@@ -483,13 +435,13 @@ int chan_config_string(struct list_head *chans, char *str, int size,
483 struct list_head *ele; 435 struct list_head *ele;
484 struct chan *chan, *in = NULL, *out = NULL; 436 struct chan *chan, *in = NULL, *out = NULL;
485 437
486 list_for_each(ele, chans){ 438 list_for_each(ele, chans) {
487 chan = list_entry(ele, struct chan, list); 439 chan = list_entry(ele, struct chan, list);
488 if(!chan->primary) 440 if (!chan->primary)
489 continue; 441 continue;
490 if(chan->input) 442 if (chan->input)
491 in = chan; 443 in = chan;
492 if(chan->output) 444 if (chan->output)
493 out = chan; 445 out = chan;
494 } 446 }
495 447
@@ -548,27 +500,27 @@ static struct chan *parse_chan(struct line *line, char *str, int device,
548 500
549 ops = NULL; 501 ops = NULL;
550 data = NULL; 502 data = NULL;
551 for(i = 0; i < ARRAY_SIZE(chan_table); i++){ 503 for(i = 0; i < ARRAY_SIZE(chan_table); i++) {
552 entry = &chan_table[i]; 504 entry = &chan_table[i];
553 if(!strncmp(str, entry->key, strlen(entry->key))){ 505 if (!strncmp(str, entry->key, strlen(entry->key))) {
554 ops = entry->ops; 506 ops = entry->ops;
555 str += strlen(entry->key); 507 str += strlen(entry->key);
556 break; 508 break;
557 } 509 }
558 } 510 }
559 if(ops == NULL){ 511 if (ops == NULL) {
560 *error_out = "No match for configured backends"; 512 *error_out = "No match for configured backends";
561 return NULL; 513 return NULL;
562 } 514 }
563 515
564 data = (*ops->init)(str, device, opts); 516 data = (*ops->init)(str, device, opts);
565 if(data == NULL){ 517 if (data == NULL) {
566 *error_out = "Configuration failed"; 518 *error_out = "Configuration failed";
567 return NULL; 519 return NULL;
568 } 520 }
569 521
570 chan = kmalloc(sizeof(*chan), GFP_ATOMIC); 522 chan = kmalloc(sizeof(*chan), GFP_ATOMIC);
571 if(chan == NULL){ 523 if (chan == NULL) {
572 *error_out = "Memory allocation failed"; 524 *error_out = "Memory allocation failed";
573 return NULL; 525 return NULL;
574 } 526 }
@@ -594,26 +546,26 @@ int parse_chan_pair(char *str, struct line *line, int device,
594 struct chan *new, *chan; 546 struct chan *new, *chan;
595 char *in, *out; 547 char *in, *out;
596 548
597 if(!list_empty(chans)){ 549 if (!list_empty(chans)) {
598 chan = list_entry(chans->next, struct chan, list); 550 chan = list_entry(chans->next, struct chan, list);
599 free_chan(chans, 0); 551 free_chan(chans, 0);
600 INIT_LIST_HEAD(chans); 552 INIT_LIST_HEAD(chans);
601 } 553 }
602 554
603 out = strchr(str, ','); 555 out = strchr(str, ',');
604 if(out != NULL){ 556 if (out != NULL) {
605 in = str; 557 in = str;
606 *out = '\0'; 558 *out = '\0';
607 out++; 559 out++;
608 new = parse_chan(line, in, device, opts, error_out); 560 new = parse_chan(line, in, device, opts, error_out);
609 if(new == NULL) 561 if (new == NULL)
610 return -1; 562 return -1;
611 563
612 new->input = 1; 564 new->input = 1;
613 list_add(&new->list, chans); 565 list_add(&new->list, chans);
614 566
615 new = parse_chan(line, out, device, opts, error_out); 567 new = parse_chan(line, out, device, opts, error_out);
616 if(new == NULL) 568 if (new == NULL)
617 return -1; 569 return -1;
618 570
619 list_add(&new->list, chans); 571 list_add(&new->list, chans);
@@ -621,7 +573,7 @@ int parse_chan_pair(char *str, struct line *line, int device,
621 } 573 }
622 else { 574 else {
623 new = parse_chan(line, str, device, opts, error_out); 575 new = parse_chan(line, str, device, opts, error_out);
624 if(new == NULL) 576 if (new == NULL)
625 return -1; 577 return -1;
626 578
627 list_add(&new->list, chans); 579 list_add(&new->list, chans);
@@ -636,9 +588,9 @@ int chan_out_fd(struct list_head *chans)
636 struct list_head *ele; 588 struct list_head *ele;
637 struct chan *chan; 589 struct chan *chan;
638 590
639 list_for_each(ele, chans){ 591 list_for_each(ele, chans) {
640 chan = list_entry(ele, struct chan, list); 592 chan = list_entry(ele, struct chan, list);
641 if(chan->primary && chan->output) 593 if (chan->primary && chan->output)
642 return chan->fd; 594 return chan->fd;
643 } 595 }
644 return -1; 596 return -1;
@@ -652,23 +604,25 @@ void chan_interrupt(struct list_head *chans, struct delayed_work *task,
652 int err; 604 int err;
653 char c; 605 char c;
654 606
655 list_for_each_safe(ele, next, chans){ 607 list_for_each_safe(ele, next, chans) {
656 chan = list_entry(ele, struct chan, list); 608 chan = list_entry(ele, struct chan, list);
657 if(!chan->input || (chan->ops->read == NULL)) continue; 609 if (!chan->input || (chan->ops->read == NULL))
610 continue;
658 do { 611 do {
659 if (tty && !tty_buffer_request_room(tty, 1)) { 612 if (tty && !tty_buffer_request_room(tty, 1)) {
660 schedule_delayed_work(task, 1); 613 schedule_delayed_work(task, 1);
661 goto out; 614 goto out;
662 } 615 }
663 err = chan->ops->read(chan->fd, &c, chan->data); 616 err = chan->ops->read(chan->fd, &c, chan->data);
664 if(err > 0) 617 if (err > 0)
665 tty_receive_char(tty, c); 618 tty_receive_char(tty, c);
666 } while(err > 0); 619 } while (err > 0);
667 620
668 if(err == 0) reactivate_fd(chan->fd, irq); 621 if (err == 0)
669 if(err == -EIO){ 622 reactivate_fd(chan->fd, irq);
670 if(chan->primary){ 623 if (err == -EIO) {
671 if(tty != NULL) 624 if (chan->primary) {
625 if (tty != NULL)
672 tty_hangup(tty); 626 tty_hangup(tty);
673 close_chan(chans, 1); 627 close_chan(chans, 1);
674 return; 628 return;
@@ -677,5 +631,6 @@ void chan_interrupt(struct list_head *chans, struct delayed_work *task,
677 } 631 }
678 } 632 }
679 out: 633 out:
680 if(tty) tty_flip_buffer_push(tty); 634 if (tty)
635 tty_flip_buffer_push(tty);
681} 636}
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c
index 4d438f36ea2e..b88e93b3a39f 100644
--- a/arch/um/drivers/chan_user.c
+++ b/arch/um/drivers/chan_user.c
@@ -1,51 +1,107 @@
1/* 1/*
2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <unistd.h>
7#include <stdlib.h> 6#include <stdlib.h>
7#include <unistd.h>
8#include <errno.h> 8#include <errno.h>
9#include <termios.h>
10#include <string.h>
11#include <signal.h>
12#include <sched.h> 9#include <sched.h>
13#include <sys/stat.h> 10#include <signal.h>
11#include <termios.h>
14#include <sys/ioctl.h> 12#include <sys/ioctl.h>
15#include <sys/socket.h>
16#include "kern_util.h"
17#include "chan_user.h" 13#include "chan_user.h"
18#include "user.h"
19#include "os.h" 14#include "os.h"
20#include "choose-mode.h" 15#include "um_malloc.h"
21#include "mode.h" 16#include "user.h"
17
18void generic_close(int fd, void *unused)
19{
20 close(fd);
21}
22
23int generic_read(int fd, char *c_out, void *unused)
24{
25 int n;
26
27 n = read(fd, c_out, sizeof(*c_out));
28 if (n > 0)
29 return n;
30 else if (errno == EAGAIN)
31 return 0;
32 else if (n == 0)
33 return -EIO;
34 return -errno;
35}
36
37/* XXX Trivial wrapper around write */
38
39int generic_write(int fd, const char *buf, int n, void *unused)
40{
41 int err;
42
43 err = write(fd, buf, n);
44 if (err > 0)
45 return err;
46 else if (errno == EAGAIN)
47 return 0;
48 else if (err == 0)
49 return -EIO;
50 return -errno;
51}
52
53int generic_window_size(int fd, void *unused, unsigned short *rows_out,
54 unsigned short *cols_out)
55{
56 struct winsize size;
57 int ret;
58
59 if (ioctl(fd, TIOCGWINSZ, &size) < 0)
60 return -errno;
61
62 ret = ((*rows_out != size.ws_row) || (*cols_out != size.ws_col));
63
64 *rows_out = size.ws_row;
65 *cols_out = size.ws_col;
66
67 return ret;
68}
69
70void generic_free(void *data)
71{
72 kfree(data);
73}
22 74
23int generic_console_write(int fd, const char *buf, int n) 75int generic_console_write(int fd, const char *buf, int n)
24{ 76{
25 struct termios save, new; 77 struct termios save, new;
26 int err; 78 int err;
27 79
28 if(isatty(fd)){ 80 if (isatty(fd)) {
29 CATCH_EINTR(err = tcgetattr(fd, &save)); 81 CATCH_EINTR(err = tcgetattr(fd, &save));
30 if (err) 82 if (err)
31 goto error; 83 goto error;
32 new = save; 84 new = save;
33 /* The terminal becomes a bit less raw, to handle \n also as 85 /*
86 * The terminal becomes a bit less raw, to handle \n also as
34 * "Carriage Return", not only as "New Line". Otherwise, the new 87 * "Carriage Return", not only as "New Line". Otherwise, the new
35 * line won't start at the first column.*/ 88 * line won't start at the first column.
89 */
36 new.c_oflag |= OPOST; 90 new.c_oflag |= OPOST;
37 CATCH_EINTR(err = tcsetattr(fd, TCSAFLUSH, &new)); 91 CATCH_EINTR(err = tcsetattr(fd, TCSAFLUSH, &new));
38 if (err) 92 if (err)
39 goto error; 93 goto error;
40 } 94 }
41 err = generic_write(fd, buf, n, NULL); 95 err = generic_write(fd, buf, n, NULL);
42 /* Restore raw mode, in any case; we *must* ignore any error apart 96 /*
43 * EINTR, except for debug.*/ 97 * Restore raw mode, in any case; we *must* ignore any error apart
44 if(isatty(fd)) 98 * EINTR, except for debug.
99 */
100 if (isatty(fd))
45 CATCH_EINTR(tcsetattr(fd, TCSAFLUSH, &save)); 101 CATCH_EINTR(tcsetattr(fd, TCSAFLUSH, &save));
46 return(err); 102 return err;
47error: 103error:
48 return(-errno); 104 return -errno;
49} 105}
50 106
51/* 107/*
@@ -82,62 +138,73 @@ static int winch_thread(void *arg)
82 struct winch_data *data = arg; 138 struct winch_data *data = arg;
83 sigset_t sigs; 139 sigset_t sigs;
84 int pty_fd, pipe_fd; 140 int pty_fd, pipe_fd;
85 int count, err; 141 int count;
86 char c = 1; 142 char c = 1;
87 143
88 pty_fd = data->pty_fd; 144 pty_fd = data->pty_fd;
89 pipe_fd = data->pipe_fd; 145 pipe_fd = data->pipe_fd;
90 count = os_write_file(pipe_fd, &c, sizeof(c)); 146 count = write(pipe_fd, &c, sizeof(c));
91 if(count != sizeof(c)) 147 if (count != sizeof(c))
92 printk("winch_thread : failed to write synchronization " 148 printk(UM_KERN_ERR "winch_thread : failed to write "
93 "byte, err = %d\n", -count); 149 "synchronization byte, err = %d\n", -count);
94 150
95 /* We are not using SIG_IGN on purpose, so don't fix it as I thought to 151 /*
152 * We are not using SIG_IGN on purpose, so don't fix it as I thought to
96 * do! If using SIG_IGN, the sigsuspend() call below would not stop on 153 * do! If using SIG_IGN, the sigsuspend() call below would not stop on
97 * SIGWINCH. */ 154 * SIGWINCH.
155 */
98 156
99 signal(SIGWINCH, winch_handler); 157 signal(SIGWINCH, winch_handler);
100 sigfillset(&sigs); 158 sigfillset(&sigs);
101 /* Block all signals possible. */ 159 /* Block all signals possible. */
102 if(sigprocmask(SIG_SETMASK, &sigs, NULL) < 0){ 160 if (sigprocmask(SIG_SETMASK, &sigs, NULL) < 0) {
103 printk("winch_thread : sigprocmask failed, errno = %d\n", 161 printk(UM_KERN_ERR "winch_thread : sigprocmask failed, "
104 errno); 162 "errno = %d\n", errno);
105 exit(1); 163 exit(1);
106 } 164 }
107 /* In sigsuspend(), block anything else than SIGWINCH. */ 165 /* In sigsuspend(), block anything else than SIGWINCH. */
108 sigdelset(&sigs, SIGWINCH); 166 sigdelset(&sigs, SIGWINCH);
109 167
110 if(setsid() < 0){ 168 if (setsid() < 0) {
111 printk("winch_thread : setsid failed, errno = %d\n", errno); 169 printk(UM_KERN_ERR "winch_thread : setsid failed, errno = %d\n",
170 errno);
171 exit(1);
172 }
173
174 if (ioctl(pty_fd, TIOCSCTTY, 0) < 0) {
175 printk(UM_KERN_ERR "winch_thread : TIOCSCTTY failed on "
176 "fd %d err = %d\n", pty_fd, errno);
112 exit(1); 177 exit(1);
113 } 178 }
114 179
115 err = os_new_tty_pgrp(pty_fd, os_getpid()); 180 if (tcsetpgrp(pty_fd, os_getpid()) < 0) {
116 if(err < 0){ 181 printk(UM_KERN_ERR "winch_thread : tcsetpgrp failed on "
117 printk("winch_thread : new_tty_pgrp failed on fd %d, " 182 "fd %d err = %d\n", pty_fd, errno);
118 "err = %d\n", pty_fd, -err);
119 exit(1); 183 exit(1);
120 } 184 }
121 185
122 /* These are synchronization calls between various UML threads on the 186 /*
187 * These are synchronization calls between various UML threads on the
123 * host - since they are not different kernel threads, we cannot use 188 * host - since they are not different kernel threads, we cannot use
124 * kernel semaphores. We don't use SysV semaphores because they are 189 * kernel semaphores. We don't use SysV semaphores because they are
125 * persistent. */ 190 * persistent.
126 count = os_read_file(pipe_fd, &c, sizeof(c)); 191 */
127 if(count != sizeof(c)) 192 count = read(pipe_fd, &c, sizeof(c));
128 printk("winch_thread : failed to read synchronization byte, " 193 if (count != sizeof(c))
129 "err = %d\n", -count); 194 printk(UM_KERN_ERR "winch_thread : failed to read "
130 195 "synchronization byte, err = %d\n", errno);
131 while(1){ 196
132 /* This will be interrupted by SIGWINCH only, since 197 while(1) {
198 /*
199 * This will be interrupted by SIGWINCH only, since
133 * other signals are blocked. 200 * other signals are blocked.
134 */ 201 */
135 sigsuspend(&sigs); 202 sigsuspend(&sigs);
136 203
137 count = os_write_file(pipe_fd, &c, sizeof(c)); 204 count = write(pipe_fd, &c, sizeof(c));
138 if(count != sizeof(c)) 205 if (count != sizeof(c))
139 printk("winch_thread : write failed, err = %d\n", 206 printk(UM_KERN_ERR "winch_thread : write failed, "
140 -count); 207 "err = %d\n", errno);
141 } 208 }
142} 209}
143 210
@@ -149,44 +216,49 @@ static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out,
149 char c; 216 char c;
150 217
151 err = os_pipe(fds, 1, 1); 218 err = os_pipe(fds, 1, 1);
152 if(err < 0){ 219 if (err < 0) {
153 printk("winch_tramp : os_pipe failed, err = %d\n", -err); 220 printk(UM_KERN_ERR "winch_tramp : os_pipe failed, err = %d\n",
221 -err);
154 goto out; 222 goto out;
155 } 223 }
156 224
157 data = ((struct winch_data) { .pty_fd = fd, 225 data = ((struct winch_data) { .pty_fd = fd,
158 .pipe_fd = fds[1] } ); 226 .pipe_fd = fds[1] } );
159 /* CLONE_FILES so this thread doesn't hold open files which are open 227 /*
228 * CLONE_FILES so this thread doesn't hold open files which are open
160 * now, but later closed in a different thread. This is a 229 * now, but later closed in a different thread. This is a
161 * problem with /dev/net/tun, which if held open by this 230 * problem with /dev/net/tun, which if held open by this
162 * thread, prevents the TUN/TAP device from being reused. 231 * thread, prevents the TUN/TAP device from being reused.
163 */ 232 */
164 err = run_helper_thread(winch_thread, &data, CLONE_FILES, stack_out); 233 err = run_helper_thread(winch_thread, &data, CLONE_FILES, stack_out);
165 if(err < 0){ 234 if (err < 0) {
166 printk("fork of winch_thread failed - errno = %d\n", -err); 235 printk(UM_KERN_ERR "fork of winch_thread failed - errno = %d\n",
236 -err);
167 goto out_close; 237 goto out_close;
168 } 238 }
169 239
170 *fd_out = fds[0]; 240 *fd_out = fds[0];
171 n = os_read_file(fds[0], &c, sizeof(c)); 241 n = read(fds[0], &c, sizeof(c));
172 if(n != sizeof(c)){ 242 if (n != sizeof(c)) {
173 printk("winch_tramp : failed to read synchronization byte\n"); 243 printk(UM_KERN_ERR "winch_tramp : failed to read "
174 printk("read failed, err = %d\n", -n); 244 "synchronization byte\n");
175 printk("fd %d will not support SIGWINCH\n", fd); 245 printk(UM_KERN_ERR "read failed, err = %d\n", errno);
176 err = -EINVAL; 246 printk(UM_KERN_ERR "fd %d will not support SIGWINCH\n", fd);
247 err = -EINVAL;
177 goto out_close; 248 goto out_close;
178 } 249 }
179 250
180 if (os_set_fd_block(*fd_out, 0)) { 251 if (os_set_fd_block(*fd_out, 0)) {
181 printk("winch_tramp: failed to set thread_fd non-blocking.\n"); 252 printk(UM_KERN_ERR "winch_tramp: failed to set thread_fd "
253 "non-blocking.\n");
182 goto out_close; 254 goto out_close;
183 } 255 }
184 256
185 return err; 257 return err;
186 258
187 out_close: 259 out_close:
188 os_close_file(fds[1]); 260 close(fds[1]);
189 os_close_file(fds[0]); 261 close(fds[0]);
190 out: 262 out:
191 return err; 263 return err;
192} 264}
@@ -197,21 +269,20 @@ void register_winch(int fd, struct tty_struct *tty)
197 int pid, thread, count, thread_fd = -1; 269 int pid, thread, count, thread_fd = -1;
198 char c = 1; 270 char c = 1;
199 271
200 if(!isatty(fd)) 272 if (!isatty(fd))
201 return; 273 return;
202 274
203 pid = tcgetpgrp(fd); 275 pid = tcgetpgrp(fd);
204 if (!CHOOSE_MODE_PROC(is_tracer_winch, is_skas_winch, pid, fd, tty) && 276 if (!is_skas_winch(pid, fd, tty) && (pid == -1)) {
205 (pid == -1)) {
206 thread = winch_tramp(fd, tty, &thread_fd, &stack); 277 thread = winch_tramp(fd, tty, &thread_fd, &stack);
207 if (thread < 0) 278 if (thread < 0)
208 return; 279 return;
209 280
210 register_winch_irq(thread_fd, fd, thread, tty, stack); 281 register_winch_irq(thread_fd, fd, thread, tty, stack);
211 282
212 count = os_write_file(thread_fd, &c, sizeof(c)); 283 count = write(thread_fd, &c, sizeof(c));
213 if(count != sizeof(c)) 284 if (count != sizeof(c))
214 printk("register_winch : failed to write " 285 printk(UM_KERN_ERR "register_winch : failed to write "
215 "synchronization byte, err = %d\n", -count); 286 "synchronization byte, err = %d\n", errno);
216 } 287 }
217} 288}
diff --git a/arch/um/drivers/cow_user.c b/arch/um/drivers/cow_user.c
index 0ec4052db9c5..93f227a25ba4 100644
--- a/arch/um/drivers/cow_user.c
+++ b/arch/um/drivers/cow_user.c
@@ -1,17 +1,18 @@
1#include <stddef.h> 1/*
2#include <string.h> 2 * Copyright (C) 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
3#include <errno.h> 3 * Licensed under the GPL
4/* _XOPEN_SOURCE is needed for pread, but we define _GNU_SOURCE, which defines 4 */
5
6/*
7 * _XOPEN_SOURCE is needed for pread, but we define _GNU_SOURCE, which defines
5 * that. 8 * that.
6 */ 9 */
7#include <unistd.h> 10#include <unistd.h>
8#include <byteswap.h> 11#include <byteswap.h>
9#include <sys/time.h> 12#include <errno.h>
10#include <sys/param.h> 13#include <string.h>
11#include <sys/user.h> 14#include <arpa/inet.h>
12 15#include <asm/types.h>
13#include "os.h"
14
15#include "cow.h" 16#include "cow.h"
16#include "cow_sys.h" 17#include "cow_sys.h"
17 18
@@ -28,7 +29,8 @@ struct cow_header_v1 {
28 __s32 sectorsize; 29 __s32 sectorsize;
29} __attribute__((packed)); 30} __attribute__((packed));
30 31
31/* Define PATH_LEN_V3 as the usual value of MAXPATHLEN, just hard-code it in 32/*
33 * Define PATH_LEN_V3 as the usual value of MAXPATHLEN, just hard-code it in
32 * case other systems have different values for MAXPATHLEN. 34 * case other systems have different values for MAXPATHLEN.
33 * 35 *
34 * The same must hold for V2 - we want file format compatibility, not anything 36 * The same must hold for V2 - we want file format compatibility, not anything
@@ -46,7 +48,8 @@ struct cow_header_v2 {
46 __s32 sectorsize; 48 __s32 sectorsize;
47} __attribute__((packed)); 49} __attribute__((packed));
48 50
49/* Changes from V2 - 51/*
52 * Changes from V2 -
50 * PATH_LEN_V3 as described above 53 * PATH_LEN_V3 as described above
51 * Explicitly specify field bit lengths for systems with different 54 * Explicitly specify field bit lengths for systems with different
52 * lengths for the usual C types. Not sure whether char or 55 * lengths for the usual C types. Not sure whether char or
@@ -70,7 +73,8 @@ struct cow_header_v2 {
70 * Fixed (finally!) the rounding bug 73 * Fixed (finally!) the rounding bug
71 */ 74 */
72 75
73/* Until Dec2005, __attribute__((packed)) was left out from the below 76/*
77 * Until Dec2005, __attribute__((packed)) was left out from the below
74 * definition, leading on 64-bit systems to 4 bytes of padding after mtime, to 78 * definition, leading on 64-bit systems to 4 bytes of padding after mtime, to
75 * align size to 8-byte alignment. This shifted all fields above (no padding 79 * align size to 8-byte alignment. This shifted all fields above (no padding
76 * was present on 32-bit, no other padding was added). 80 * was present on 32-bit, no other padding was added).
@@ -122,7 +126,7 @@ void cow_sizes(int version, __u64 size, int sectorsize, int align,
122 int bitmap_offset, unsigned long *bitmap_len_out, 126 int bitmap_offset, unsigned long *bitmap_len_out,
123 int *data_offset_out) 127 int *data_offset_out)
124{ 128{
125 if(version < 3){ 129 if (version < 3) {
126 *bitmap_len_out = (size + sectorsize - 1) / (8 * sectorsize); 130 *bitmap_len_out = (size + sectorsize - 1) / (8 * sectorsize);
127 131
128 *data_offset_out = bitmap_offset + *bitmap_len_out; 132 *data_offset_out = bitmap_offset + *bitmap_len_out;
@@ -144,46 +148,46 @@ static int absolutize(char *to, int size, char *from)
144 char save_cwd[256], *slash; 148 char save_cwd[256], *slash;
145 int remaining; 149 int remaining;
146 150
147 if(getcwd(save_cwd, sizeof(save_cwd)) == NULL) { 151 if (getcwd(save_cwd, sizeof(save_cwd)) == NULL) {
148 cow_printf("absolutize : unable to get cwd - errno = %d\n", 152 cow_printf("absolutize : unable to get cwd - errno = %d\n",
149 errno); 153 errno);
150 return(-1); 154 return -1;
151 } 155 }
152 slash = strrchr(from, '/'); 156 slash = strrchr(from, '/');
153 if(slash != NULL){ 157 if (slash != NULL) {
154 *slash = '\0'; 158 *slash = '\0';
155 if(chdir(from)){ 159 if (chdir(from)) {
156 *slash = '/'; 160 *slash = '/';
157 cow_printf("absolutize : Can't cd to '%s' - " 161 cow_printf("absolutize : Can't cd to '%s' - "
158 "errno = %d\n", from, errno); 162 "errno = %d\n", from, errno);
159 return(-1); 163 return -1;
160 } 164 }
161 *slash = '/'; 165 *slash = '/';
162 if(getcwd(to, size) == NULL){ 166 if (getcwd(to, size) == NULL) {
163 cow_printf("absolutize : unable to get cwd of '%s' - " 167 cow_printf("absolutize : unable to get cwd of '%s' - "
164 "errno = %d\n", from, errno); 168 "errno = %d\n", from, errno);
165 return(-1); 169 return -1;
166 } 170 }
167 remaining = size - strlen(to); 171 remaining = size - strlen(to);
168 if(strlen(slash) + 1 > remaining){ 172 if (strlen(slash) + 1 > remaining) {
169 cow_printf("absolutize : unable to fit '%s' into %d " 173 cow_printf("absolutize : unable to fit '%s' into %d "
170 "chars\n", from, size); 174 "chars\n", from, size);
171 return(-1); 175 return -1;
172 } 176 }
173 strcat(to, slash); 177 strcat(to, slash);
174 } 178 }
175 else { 179 else {
176 if(strlen(save_cwd) + 1 + strlen(from) + 1 > size){ 180 if (strlen(save_cwd) + 1 + strlen(from) + 1 > size) {
177 cow_printf("absolutize : unable to fit '%s' into %d " 181 cow_printf("absolutize : unable to fit '%s' into %d "
178 "chars\n", from, size); 182 "chars\n", from, size);
179 return(-1); 183 return -1;
180 } 184 }
181 strcpy(to, save_cwd); 185 strcpy(to, save_cwd);
182 strcat(to, "/"); 186 strcat(to, "/");
183 strcat(to, from); 187 strcat(to, from);
184 } 188 }
185 chdir(save_cwd); 189 chdir(save_cwd);
186 return(0); 190 return 0;
187} 191}
188 192
189int write_cow_header(char *cow_file, int fd, char *backing_file, 193int write_cow_header(char *cow_file, int fd, char *backing_file,
@@ -194,22 +198,23 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
194 int err; 198 int err;
195 199
196 err = cow_seek_file(fd, 0); 200 err = cow_seek_file(fd, 0);
197 if(err < 0){ 201 if (err < 0) {
198 cow_printf("write_cow_header - lseek failed, err = %d\n", -err); 202 cow_printf("write_cow_header - lseek failed, err = %d\n", -err);
199 goto out; 203 goto out;
200 } 204 }
201 205
202 err = -ENOMEM; 206 err = -ENOMEM;
203 header = cow_malloc(sizeof(*header)); 207 header = cow_malloc(sizeof(*header));
204 if(header == NULL){ 208 if (header == NULL) {
205 cow_printf("write_cow_header - failed to allocate COW V3 header\n"); 209 cow_printf("write_cow_header - failed to allocate COW V3 "
210 "header\n");
206 goto out; 211 goto out;
207 } 212 }
208 header->magic = htonl(COW_MAGIC); 213 header->magic = htonl(COW_MAGIC);
209 header->version = htonl(COW_VERSION); 214 header->version = htonl(COW_VERSION);
210 215
211 err = -EINVAL; 216 err = -EINVAL;
212 if(strlen(backing_file) > sizeof(header->backing_file) - 1){ 217 if (strlen(backing_file) > sizeof(header->backing_file) - 1) {
213 /* Below, %zd is for a size_t value */ 218 /* Below, %zd is for a size_t value */
214 cow_printf("Backing file name \"%s\" is too long - names are " 219 cow_printf("Backing file name \"%s\" is too long - names are "
215 "limited to %zd characters\n", backing_file, 220 "limited to %zd characters\n", backing_file,
@@ -217,12 +222,12 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
217 goto out_free; 222 goto out_free;
218 } 223 }
219 224
220 if(absolutize(header->backing_file, sizeof(header->backing_file), 225 if (absolutize(header->backing_file, sizeof(header->backing_file),
221 backing_file)) 226 backing_file))
222 goto out_free; 227 goto out_free;
223 228
224 err = os_file_modtime(header->backing_file, &modtime); 229 err = os_file_modtime(header->backing_file, &modtime);
225 if(err < 0){ 230 if (err < 0) {
226 cow_printf("write_cow_header - backing file '%s' mtime " 231 cow_printf("write_cow_header - backing file '%s' mtime "
227 "request failed, err = %d\n", header->backing_file, 232 "request failed, err = %d\n", header->backing_file,
228 -err); 233 -err);
@@ -230,7 +235,7 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
230 } 235 }
231 236
232 err = cow_file_size(header->backing_file, size); 237 err = cow_file_size(header->backing_file, size);
233 if(err < 0){ 238 if (err < 0) {
234 cow_printf("write_cow_header - couldn't get size of " 239 cow_printf("write_cow_header - couldn't get size of "
235 "backing file '%s', err = %d\n", 240 "backing file '%s', err = %d\n",
236 header->backing_file, -err); 241 header->backing_file, -err);
@@ -244,7 +249,7 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
244 header->cow_format = COW_BITMAP; 249 header->cow_format = COW_BITMAP;
245 250
246 err = cow_write_file(fd, header, sizeof(*header)); 251 err = cow_write_file(fd, header, sizeof(*header));
247 if(err != sizeof(*header)){ 252 if (err != sizeof(*header)) {
248 cow_printf("write_cow_header - write of header to " 253 cow_printf("write_cow_header - write of header to "
249 "new COW file '%s' failed, err = %d\n", cow_file, 254 "new COW file '%s' failed, err = %d\n", cow_file,
250 -err); 255 -err);
@@ -254,14 +259,14 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
254 out_free: 259 out_free:
255 cow_free(header); 260 cow_free(header);
256 out: 261 out:
257 return(err); 262 return err;
258} 263}
259 264
260int file_reader(__u64 offset, char *buf, int len, void *arg) 265int file_reader(__u64 offset, char *buf, int len, void *arg)
261{ 266{
262 int fd = *((int *) arg); 267 int fd = *((int *) arg);
263 268
264 return(pread(fd, buf, len, offset)); 269 return pread(fd, buf, len, offset);
265} 270}
266 271
267/* XXX Need to sanity-check the values read from the header */ 272/* XXX Need to sanity-check the values read from the header */
@@ -278,31 +283,29 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
278 unsigned long version, magic; 283 unsigned long version, magic;
279 284
280 header = cow_malloc(sizeof(*header)); 285 header = cow_malloc(sizeof(*header));
281 if(header == NULL){ 286 if (header == NULL) {
282 cow_printf("read_cow_header - Failed to allocate header\n"); 287 cow_printf("read_cow_header - Failed to allocate header\n");
283 return(-ENOMEM); 288 return -ENOMEM;
284 } 289 }
285 err = -EINVAL; 290 err = -EINVAL;
286 n = (*reader)(0, (char *) header, sizeof(*header), arg); 291 n = (*reader)(0, (char *) header, sizeof(*header), arg);
287 if(n < offsetof(typeof(header->v1), backing_file)){ 292 if (n < offsetof(typeof(header->v1), backing_file)) {
288 cow_printf("read_cow_header - short header\n"); 293 cow_printf("read_cow_header - short header\n");
289 goto out; 294 goto out;
290 } 295 }
291 296
292 magic = header->v1.magic; 297 magic = header->v1.magic;
293 if(magic == COW_MAGIC) { 298 if (magic == COW_MAGIC)
294 version = header->v1.version; 299 version = header->v1.version;
295 } 300 else if (magic == ntohl(COW_MAGIC))
296 else if(magic == ntohl(COW_MAGIC)){
297 version = ntohl(header->v1.version); 301 version = ntohl(header->v1.version);
298 }
299 /* No error printed because the non-COW case comes through here */ 302 /* No error printed because the non-COW case comes through here */
300 else goto out; 303 else goto out;
301 304
302 *version_out = version; 305 *version_out = version;
303 306
304 if(version == 1){ 307 if (version == 1) {
305 if(n < sizeof(header->v1)){ 308 if (n < sizeof(header->v1)) {
306 cow_printf("read_cow_header - failed to read V1 " 309 cow_printf("read_cow_header - failed to read V1 "
307 "header\n"); 310 "header\n");
308 goto out; 311 goto out;
@@ -314,8 +317,8 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
314 *align_out = *sectorsize_out; 317 *align_out = *sectorsize_out;
315 file = header->v1.backing_file; 318 file = header->v1.backing_file;
316 } 319 }
317 else if(version == 2){ 320 else if (version == 2) {
318 if(n < sizeof(header->v2)){ 321 if (n < sizeof(header->v2)) {
319 cow_printf("read_cow_header - failed to read V2 " 322 cow_printf("read_cow_header - failed to read V2 "
320 "header\n"); 323 "header\n");
321 goto out; 324 goto out;
@@ -328,8 +331,8 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
328 file = header->v2.backing_file; 331 file = header->v2.backing_file;
329 } 332 }
330 /* This is very subtle - see above at union cow_header definition */ 333 /* This is very subtle - see above at union cow_header definition */
331 else if(version == 3 && (*((int*)header->v3.backing_file) != 0)){ 334 else if (version == 3 && (*((int*)header->v3.backing_file) != 0)) {
332 if(n < sizeof(header->v3)){ 335 if (n < sizeof(header->v3)) {
333 cow_printf("read_cow_header - failed to read V3 " 336 cow_printf("read_cow_header - failed to read V3 "
334 "header\n"); 337 "header\n");
335 goto out; 338 goto out;
@@ -345,17 +348,18 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
345 *bitmap_offset_out = ROUND_UP(sizeof(header->v3), *align_out); 348 *bitmap_offset_out = ROUND_UP(sizeof(header->v3), *align_out);
346 file = header->v3.backing_file; 349 file = header->v3.backing_file;
347 } 350 }
348 else if(version == 3){ 351 else if (version == 3) {
349 cow_printf("read_cow_header - broken V3 file with" 352 cow_printf("read_cow_header - broken V3 file with"
350 " 64-bit layout - recovering content.\n"); 353 " 64-bit layout - recovering content.\n");
351 354
352 if(n < sizeof(header->v3_b)){ 355 if (n < sizeof(header->v3_b)) {
353 cow_printf("read_cow_header - failed to read V3 " 356 cow_printf("read_cow_header - failed to read V3 "
354 "header\n"); 357 "header\n");
355 goto out; 358 goto out;
356 } 359 }
357 360
358 /* this was used until Dec2005 - 64bits are needed to represent 361 /*
362 * this was used until Dec2005 - 64bits are needed to represent
359 * 2038+. I.e. we can safely do this truncating cast. 363 * 2038+. I.e. we can safely do this truncating cast.
360 * 364 *
361 * Additionally, we must use ntohl() instead of ntohll(), since 365 * Additionally, we must use ntohl() instead of ntohll(), since
@@ -381,7 +385,7 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
381 } 385 }
382 err = -ENOMEM; 386 err = -ENOMEM;
383 *backing_file_out = cow_strdup(file); 387 *backing_file_out = cow_strdup(file);
384 if(*backing_file_out == NULL){ 388 if (*backing_file_out == NULL) {
385 cow_printf("read_cow_header - failed to allocate backing " 389 cow_printf("read_cow_header - failed to allocate backing "
386 "file\n"); 390 "file\n");
387 goto out; 391 goto out;
@@ -389,7 +393,7 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
389 err = 0; 393 err = 0;
390 out: 394 out:
391 cow_free(header); 395 cow_free(header);
392 return(err); 396 return err;
393} 397}
394 398
395int init_cow_file(int fd, char *cow_file, char *backing_file, int sectorsize, 399int init_cow_file(int fd, char *cow_file, char *backing_file, int sectorsize,
@@ -402,7 +406,7 @@ int init_cow_file(int fd, char *cow_file, char *backing_file, int sectorsize,
402 406
403 err = write_cow_header(cow_file, fd, backing_file, sectorsize, 407 err = write_cow_header(cow_file, fd, backing_file, sectorsize,
404 alignment, &size); 408 alignment, &size);
405 if(err) 409 if (err)
406 goto out; 410 goto out;
407 411
408 *bitmap_offset_out = ROUND_UP(sizeof(struct cow_header_v3), alignment); 412 *bitmap_offset_out = ROUND_UP(sizeof(struct cow_header_v3), alignment);
@@ -411,17 +415,18 @@ int init_cow_file(int fd, char *cow_file, char *backing_file, int sectorsize,
411 415
412 offset = *data_offset_out + size - sizeof(zero); 416 offset = *data_offset_out + size - sizeof(zero);
413 err = cow_seek_file(fd, offset); 417 err = cow_seek_file(fd, offset);
414 if(err < 0){ 418 if (err < 0) {
415 cow_printf("cow bitmap lseek failed : err = %d\n", -err); 419 cow_printf("cow bitmap lseek failed : err = %d\n", -err);
416 goto out; 420 goto out;
417 } 421 }
418 422
419 /* does not really matter how much we write it is just to set EOF 423 /*
424 * does not really matter how much we write it is just to set EOF
420 * this also sets the entire COW bitmap 425 * this also sets the entire COW bitmap
421 * to zero without having to allocate it 426 * to zero without having to allocate it
422 */ 427 */
423 err = cow_write_file(fd, &zero, sizeof(zero)); 428 err = cow_write_file(fd, &zero, sizeof(zero));
424 if(err != sizeof(zero)){ 429 if (err != sizeof(zero)) {
425 cow_printf("Write of bitmap to new COW file '%s' failed, " 430 cow_printf("Write of bitmap to new COW file '%s' failed, "
426 "err = %d\n", cow_file, -err); 431 "err = %d\n", cow_file, -err);
427 if (err >= 0) 432 if (err >= 0)
@@ -429,15 +434,7 @@ int init_cow_file(int fd, char *cow_file, char *backing_file, int sectorsize,
429 goto out; 434 goto out;
430 } 435 }
431 436
432 return(0); 437 return 0;
433
434 out: 438 out:
435 return(err); 439 return err;
436} 440}
437
438/*
439 * ---------------------------------------------------------------------------
440 * Local variables:
441 * c-file-style: "linux"
442 * End:
443 */
diff --git a/arch/um/drivers/daemon.h b/arch/um/drivers/daemon.h
index 3bc3cf6b94aa..6e0e891f8a00 100644
--- a/arch/um/drivers/daemon.h
+++ b/arch/um/drivers/daemon.h
@@ -1,8 +1,11 @@
1/* 1/*
2 * Copyright (C) 2001 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#ifndef __DAEMON_H__
7#define __DAEMON_H__
8
6#include "net_user.h" 9#include "net_user.h"
7 10
8#define SWITCH_VERSION 3 11#define SWITCH_VERSION 3
@@ -20,16 +23,7 @@ struct daemon_data {
20 23
21extern const struct net_user_info daemon_user_info; 24extern const struct net_user_info daemon_user_info;
22 25
23extern int daemon_user_write(int fd, void *buf, int len, 26extern int daemon_user_write(int fd, void *buf, int len,
24 struct daemon_data *pri); 27 struct daemon_data *pri);
25 28
26/* 29#endif
27 * Overrides for Emacs so that we follow Linus's tabbing style.
28 * Emacs will notice this stuff at the end of the file and automatically
29 * adjust the settings for this buffer only. This must remain at the end
30 * of the file.
31 * ---------------------------------------------------------------------------
32 * Local variables:
33 * c-file-style: "linux"
34 * End:
35 */
diff --git a/arch/um/drivers/daemon_kern.c b/arch/um/drivers/daemon_kern.c
index adeece11e596..d53ff52bb404 100644
--- a/arch/um/drivers/daemon_kern.c
+++ b/arch/um/drivers/daemon_kern.c
@@ -1,16 +1,14 @@
1/* 1/*
2 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and 2 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and
3 * James Leu (jleu@mindspring.net). 3 * James Leu (jleu@mindspring.net).
4 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 * Copyright (C) 2001 by various other people who didn't put their name here. 5 * Copyright (C) 2001 by various other people who didn't put their name here.
5 * Licensed under the GPL. 6 * Licensed under the GPL.
6 */ 7 */
7 8
8#include "linux/kernel.h"
9#include "linux/init.h" 9#include "linux/init.h"
10#include "linux/netdevice.h" 10#include <linux/netdevice.h>
11#include "linux/etherdevice.h"
12#include "net_kern.h" 11#include "net_kern.h"
13#include "net_user.h"
14#include "daemon.h" 12#include "daemon.h"
15 13
16struct daemon_init { 14struct daemon_init {
@@ -36,25 +34,21 @@ static void daemon_init(struct net_device *dev, void *data)
36 dpri->data_addr = NULL; 34 dpri->data_addr = NULL;
37 dpri->local_addr = NULL; 35 dpri->local_addr = NULL;
38 36
39 printk("daemon backend (uml_switch version %d) - %s:%s", 37 printk("daemon backend (uml_switch version %d) - %s:%s",
40 SWITCH_VERSION, dpri->sock_type, dpri->ctl_sock); 38 SWITCH_VERSION, dpri->sock_type, dpri->ctl_sock);
41 printk("\n"); 39 printk("\n");
42} 40}
43 41
44static int daemon_read(int fd, struct sk_buff **skb, 42static int daemon_read(int fd, struct sk_buff *skb, struct uml_net_private *lp)
45 struct uml_net_private *lp)
46{ 43{
47 *skb = ether_adjust_skb(*skb, ETH_HEADER_OTHER); 44 return net_recvfrom(fd, skb_mac_header(skb),
48 if(*skb == NULL) return(-ENOMEM); 45 skb->dev->mtu + ETH_HEADER_OTHER);
49 return(net_recvfrom(fd, skb_mac_header(*skb),
50 (*skb)->dev->mtu + ETH_HEADER_OTHER));
51} 46}
52 47
53static int daemon_write(int fd, struct sk_buff **skb, 48static int daemon_write(int fd, struct sk_buff *skb, struct uml_net_private *lp)
54 struct uml_net_private *lp)
55{ 49{
56 return(daemon_user_write(fd, (*skb)->data, (*skb)->len, 50 return daemon_user_write(fd, skb->data, skb->len,
57 (struct daemon_data *) &lp->user)); 51 (struct daemon_data *) &lp->user);
58} 52}
59 53
60static const struct net_kern_info daemon_kern_info = { 54static const struct net_kern_info daemon_kern_info = {
@@ -72,14 +66,14 @@ static int daemon_setup(char *str, char **mac_out, void *data)
72 *init = ((struct daemon_init) 66 *init = ((struct daemon_init)
73 { .sock_type = "unix", 67 { .sock_type = "unix",
74 .ctl_sock = "/tmp/uml.ctl" }); 68 .ctl_sock = "/tmp/uml.ctl" });
75 69
76 remain = split_if_spec(str, mac_out, &init->sock_type, &init->ctl_sock, 70 remain = split_if_spec(str, mac_out, &init->sock_type, &init->ctl_sock,
77 NULL); 71 NULL);
78 if(remain != NULL) 72 if (remain != NULL)
79 printk(KERN_WARNING "daemon_setup : Ignoring data socket " 73 printk(KERN_WARNING "daemon_setup : Ignoring data socket "
80 "specification\n"); 74 "specification\n");
81 75
82 return(1); 76 return 1;
83} 77}
84 78
85static struct transport daemon_transport = { 79static struct transport daemon_transport = {
diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c
index 8d2008f06682..f23c109a055c 100644
--- a/arch/um/drivers/daemon_user.c
+++ b/arch/um/drivers/daemon_user.c
@@ -1,24 +1,23 @@
1/* 1/*
2 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and 2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and
3 * James Leu (jleu@mindspring.net). 4 * James Leu (jleu@mindspring.net).
4 * Copyright (C) 2001 by various other people who didn't put their name here. 5 * Copyright (C) 2001 by various other people who didn't put their name here.
5 * Licensed under the GPL. 6 * Licensed under the GPL.
6 */ 7 */
7 8
8#include <errno.h>
9#include <unistd.h>
10#include <stdint.h> 9#include <stdint.h>
10#include <unistd.h>
11#include <errno.h>
12#include <sys/types.h>
11#include <sys/socket.h> 13#include <sys/socket.h>
12#include <sys/un.h>
13#include <sys/time.h> 14#include <sys/time.h>
14#include "net_user.h" 15#include <sys/un.h>
15#include "daemon.h" 16#include "daemon.h"
16#include "kern_util.h" 17#include "net_user.h"
17#include "user.h"
18#include "os.h" 18#include "os.h"
19#include "um_malloc.h" 19#include "um_malloc.h"
20 20#include "user.h"
21#define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER)
22 21
23enum request_type { REQ_NEW_CONTROL }; 22enum request_type { REQ_NEW_CONTROL };
24 23
@@ -36,8 +35,9 @@ static struct sockaddr_un *new_addr(void *name, int len)
36 struct sockaddr_un *sun; 35 struct sockaddr_un *sun;
37 36
38 sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL); 37 sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
39 if(sun == NULL){ 38 if (sun == NULL) {
40 printk("new_addr: allocation of sockaddr_un failed\n"); 39 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un "
40 "failed\n");
41 return NULL; 41 return NULL;
42 } 42 }
43 sun->sun_family = AF_UNIX; 43 sun->sun_family = AF_UNIX;
@@ -54,38 +54,39 @@ static int connect_to_switch(struct daemon_data *pri)
54 int fd, n, err; 54 int fd, n, err;
55 55
56 pri->control = socket(AF_UNIX, SOCK_STREAM, 0); 56 pri->control = socket(AF_UNIX, SOCK_STREAM, 0);
57 if(pri->control < 0){ 57 if (pri->control < 0) {
58 err = -errno; 58 err = -errno;
59 printk("daemon_open : control socket failed, errno = %d\n", 59 printk(UM_KERN_ERR "daemon_open : control socket failed, "
60 -err); 60 "errno = %d\n", -err);
61 return err; 61 return err;
62 } 62 }
63 63
64 if(connect(pri->control, (struct sockaddr *) ctl_addr, 64 if (connect(pri->control, (struct sockaddr *) ctl_addr,
65 sizeof(*ctl_addr)) < 0){ 65 sizeof(*ctl_addr)) < 0) {
66 err = -errno; 66 err = -errno;
67 printk("daemon_open : control connect failed, errno = %d\n", 67 printk(UM_KERN_ERR "daemon_open : control connect failed, "
68 -err); 68 "errno = %d\n", -err);
69 goto out; 69 goto out;
70 } 70 }
71 71
72 fd = socket(AF_UNIX, SOCK_DGRAM, 0); 72 fd = socket(AF_UNIX, SOCK_DGRAM, 0);
73 if(fd < 0){ 73 if (fd < 0) {
74 err = -errno; 74 err = -errno;
75 printk("daemon_open : data socket failed, errno = %d\n", 75 printk(UM_KERN_ERR "daemon_open : data socket failed, "
76 -err); 76 "errno = %d\n", -err);
77 goto out; 77 goto out;
78 } 78 }
79 if(bind(fd, (struct sockaddr *) local_addr, sizeof(*local_addr)) < 0){ 79 if (bind(fd, (struct sockaddr *) local_addr, sizeof(*local_addr)) < 0) {
80 err = -errno; 80 err = -errno;
81 printk("daemon_open : data bind failed, errno = %d\n", 81 printk(UM_KERN_ERR "daemon_open : data bind failed, "
82 -err); 82 "errno = %d\n", -err);
83 goto out_close; 83 goto out_close;
84 } 84 }
85 85
86 sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL); 86 sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
87 if(sun == NULL){ 87 if (sun == NULL) {
88 printk("new_addr: allocation of sockaddr_un failed\n"); 88 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un "
89 "failed\n");
89 err = -ENOMEM; 90 err = -ENOMEM;
90 goto out_close; 91 goto out_close;
91 } 92 }
@@ -94,18 +95,18 @@ static int connect_to_switch(struct daemon_data *pri)
94 req.version = SWITCH_VERSION; 95 req.version = SWITCH_VERSION;
95 req.type = REQ_NEW_CONTROL; 96 req.type = REQ_NEW_CONTROL;
96 req.sock = *local_addr; 97 req.sock = *local_addr;
97 n = os_write_file(pri->control, &req, sizeof(req)); 98 n = write(pri->control, &req, sizeof(req));
98 if(n != sizeof(req)){ 99 if (n != sizeof(req)) {
99 printk("daemon_open : control setup request failed, err = %d\n", 100 printk(UM_KERN_ERR "daemon_open : control setup request "
100 -n); 101 "failed, err = %d\n", -errno);
101 err = -ENOTCONN; 102 err = -ENOTCONN;
102 goto out_free; 103 goto out_free;
103 } 104 }
104 105
105 n = os_read_file(pri->control, sun, sizeof(*sun)); 106 n = read(pri->control, sun, sizeof(*sun));
106 if(n != sizeof(*sun)){ 107 if (n != sizeof(*sun)) {
107 printk("daemon_open : read of data socket failed, err = %d\n", 108 printk(UM_KERN_ERR "daemon_open : read of data socket failed, "
108 -n); 109 "err = %d\n", -errno);
109 err = -ENOTCONN; 110 err = -ENOTCONN;
110 goto out_free; 111 goto out_free;
111 } 112 }
@@ -116,9 +117,9 @@ static int connect_to_switch(struct daemon_data *pri)
116 out_free: 117 out_free:
117 kfree(sun); 118 kfree(sun);
118 out_close: 119 out_close:
119 os_close_file(fd); 120 close(fd);
120 out: 121 out:
121 os_close_file(pri->control); 122 close(pri->control);
122 return err; 123 return err;
123} 124}
124 125
@@ -132,8 +133,8 @@ static int daemon_user_init(void *data, void *dev)
132 int usecs; 133 int usecs;
133 } name; 134 } name;
134 135
135 if(!strcmp(pri->sock_type, "unix")) 136 if (!strcmp(pri->sock_type, "unix"))
136 pri->ctl_addr = new_addr(pri->ctl_sock, 137 pri->ctl_addr = new_addr(pri->ctl_sock,
137 strlen(pri->ctl_sock) + 1); 138 strlen(pri->ctl_sock) + 1);
138 name.zero = 0; 139 name.zero = 0;
139 name.pid = os_getpid(); 140 name.pid = os_getpid();
@@ -142,7 +143,7 @@ static int daemon_user_init(void *data, void *dev)
142 pri->local_addr = new_addr(&name, sizeof(name)); 143 pri->local_addr = new_addr(&name, sizeof(name));
143 pri->dev = dev; 144 pri->dev = dev;
144 pri->fd = connect_to_switch(pri); 145 pri->fd = connect_to_switch(pri);
145 if(pri->fd < 0){ 146 if (pri->fd < 0) {
146 kfree(pri->local_addr); 147 kfree(pri->local_addr);
147 pri->local_addr = NULL; 148 pri->local_addr = NULL;
148 return pri->fd; 149 return pri->fd;
@@ -161,9 +162,9 @@ static void daemon_remove(void *data)
161{ 162{
162 struct daemon_data *pri = data; 163 struct daemon_data *pri = data;
163 164
164 os_close_file(pri->fd); 165 close(pri->fd);
165 pri->fd = -1; 166 pri->fd = -1;
166 os_close_file(pri->control); 167 close(pri->control);
167 pri->control = -1; 168 pri->control = -1;
168 169
169 kfree(pri->data_addr); 170 kfree(pri->data_addr);
@@ -181,18 +182,13 @@ int daemon_user_write(int fd, void *buf, int len, struct daemon_data *pri)
181 return net_sendto(fd, buf, len, data_addr, sizeof(*data_addr)); 182 return net_sendto(fd, buf, len, data_addr, sizeof(*data_addr));
182} 183}
183 184
184static int daemon_set_mtu(int mtu, void *data)
185{
186 return mtu;
187}
188
189const struct net_user_info daemon_user_info = { 185const struct net_user_info daemon_user_info = {
190 .init = daemon_user_init, 186 .init = daemon_user_init,
191 .open = daemon_open, 187 .open = daemon_open,
192 .close = NULL, 188 .close = NULL,
193 .remove = daemon_remove, 189 .remove = daemon_remove,
194 .set_mtu = daemon_set_mtu,
195 .add_address = NULL, 190 .add_address = NULL,
196 .delete_address = NULL, 191 .delete_address = NULL,
197 .max_packet = MAX_PACKET - ETH_HEADER_OTHER 192 .mtu = ETH_MAX_PACKET,
193 .max_packet = ETH_MAX_PACKET + ETH_HEADER_OTHER,
198}; 194};
diff --git a/arch/um/drivers/fd.c b/arch/um/drivers/fd.c
index 39c01ffd45c9..0a2bb5b64b82 100644
--- a/arch/um/drivers/fd.c
+++ b/arch/um/drivers/fd.c
@@ -1,17 +1,18 @@
1/* 1/*
2 * Copyright (C) 2001 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stdio.h> 6#include <stdio.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#include <unistd.h> 8#include <unistd.h>
9#include <termios.h>
10#include <errno.h> 9#include <errno.h>
11#include "user.h" 10#include <termios.h>
12#include "chan_user.h" 11#include "chan_user.h"
12#include "kern_constants.h"
13#include "os.h" 13#include "os.h"
14#include "um_malloc.h" 14#include "um_malloc.h"
15#include "user.h"
15 16
16struct fd_chan { 17struct fd_chan {
17 int fd; 18 int fd;
@@ -26,22 +27,26 @@ static void *fd_init(char *str, int device, const struct chan_opts *opts)
26 char *end; 27 char *end;
27 int n; 28 int n;
28 29
29 if(*str != ':'){ 30 if (*str != ':') {
30 printk("fd_init : channel type 'fd' must specify a file " 31 printk(UM_KERN_ERR "fd_init : channel type 'fd' must specify a "
31 "descriptor\n"); 32 "file descriptor\n");
32 return(NULL); 33 return NULL;
33 } 34 }
34 str++; 35 str++;
35 n = strtoul(str, &end, 0); 36 n = strtoul(str, &end, 0);
36 if((*end != '\0') || (end == str)){ 37 if ((*end != '\0') || (end == str)) {
37 printk("fd_init : couldn't parse file descriptor '%s'\n", str); 38 printk(UM_KERN_ERR "fd_init : couldn't parse file descriptor "
38 return(NULL); 39 "'%s'\n", str);
40 return NULL;
39 } 41 }
42
40 data = kmalloc(sizeof(*data), UM_GFP_KERNEL); 43 data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
41 if(data == NULL) return(NULL); 44 if (data == NULL)
45 return NULL;
46
42 *data = ((struct fd_chan) { .fd = n, 47 *data = ((struct fd_chan) { .fd = n,
43 .raw = opts->raw }); 48 .raw = opts->raw });
44 return(data); 49 return data;
45} 50}
46 51
47static int fd_open(int input, int output, int primary, void *d, char **dev_out) 52static int fd_open(int input, int output, int primary, void *d, char **dev_out)
@@ -49,18 +54,18 @@ static int fd_open(int input, int output, int primary, void *d, char **dev_out)
49 struct fd_chan *data = d; 54 struct fd_chan *data = d;
50 int err; 55 int err;
51 56
52 if(data->raw && isatty(data->fd)){ 57 if (data->raw && isatty(data->fd)) {
53 CATCH_EINTR(err = tcgetattr(data->fd, &data->tt)); 58 CATCH_EINTR(err = tcgetattr(data->fd, &data->tt));
54 if(err) 59 if (err)
55 return(err); 60 return err;
56 61
57 err = raw(data->fd); 62 err = raw(data->fd);
58 if(err) 63 if (err)
59 return(err); 64 return err;
60 } 65 }
61 sprintf(data->str, "%d", data->fd); 66 sprintf(data->str, "%d", data->fd);
62 *dev_out = data->str; 67 *dev_out = data->str;
63 return(data->fd); 68 return data->fd;
64} 69}
65 70
66static void fd_close(int fd, void *d) 71static void fd_close(int fd, void *d)
@@ -68,13 +73,14 @@ static void fd_close(int fd, void *d)
68 struct fd_chan *data = d; 73 struct fd_chan *data = d;
69 int err; 74 int err;
70 75
71 if(data->raw && isatty(fd)){ 76 if (!data->raw || !isatty(fd))
72 CATCH_EINTR(err = tcsetattr(fd, TCSAFLUSH, &data->tt)); 77 return;
73 if(err) 78
74 printk("Failed to restore terminal state - " 79 CATCH_EINTR(err = tcsetattr(fd, TCSAFLUSH, &data->tt));
75 "errno = %d\n", -err); 80 if (err)
76 data->raw = 0; 81 printk(UM_KERN_ERR "Failed to restore terminal state - "
77 } 82 "errno = %d\n", -err);
83 data->raw = 0;
78} 84}
79 85
80const struct chan_ops fd_ops = { 86const struct chan_ops fd_ops = {
@@ -89,14 +95,3 @@ const struct chan_ops fd_ops = {
89 .free = generic_free, 95 .free = generic_free,
90 .winch = 1, 96 .winch = 1,
91}; 97};
92
93/*
94 * Overrides for Emacs so that we follow Linus's tabbing style.
95 * Emacs will notice this stuff at the end of the file and automatically
96 * adjust the settings for this buffer only. This must remain at the end
97 * of the file.
98 * ---------------------------------------------------------------------------
99 * Local variables:
100 * c-file-style: "linux"
101 * End:
102 */
diff --git a/arch/um/drivers/harddog_kern.c b/arch/um/drivers/harddog_kern.c
index 55601687b3bc..a9ad4bd6d953 100644
--- a/arch/um/drivers/harddog_kern.c
+++ b/arch/um/drivers/harddog_kern.c
@@ -69,7 +69,7 @@ static int harddog_open(struct inode *inode, struct file *file)
69 spin_lock(&lock); 69 spin_lock(&lock);
70 if(timer_alive) 70 if(timer_alive)
71 goto err; 71 goto err;
72#ifdef CONFIG_HARDDOG_NOWAYOUT 72#ifdef CONFIG_WATCHDOG_NOWAYOUT
73 __module_get(THIS_MODULE); 73 __module_get(THIS_MODULE);
74#endif 74#endif
75 75
diff --git a/arch/um/drivers/harddog_user.c b/arch/um/drivers/harddog_user.c
index 1171790f742c..b56f8e0196a9 100644
--- a/arch/um/drivers/harddog_user.c
+++ b/arch/um/drivers/harddog_user.c
@@ -1,16 +1,13 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stdio.h> 6#include <stdio.h>
7#include <unistd.h> 7#include <unistd.h>
8#include <errno.h> 8#include <errno.h>
9#include "user.h"
10#include "mconsole.h"
11#include "os.h" 9#include "os.h"
12#include "choose-mode.h" 10#include "user.h"
13#include "mode.h"
14 11
15struct dog_data { 12struct dog_data {
16 int stdin; 13 int stdin;
@@ -25,10 +22,10 @@ static void pre_exec(void *d)
25 dup2(data->stdin, 0); 22 dup2(data->stdin, 0);
26 dup2(data->stdout, 1); 23 dup2(data->stdout, 1);
27 dup2(data->stdout, 2); 24 dup2(data->stdout, 2);
28 os_close_file(data->stdin); 25 close(data->stdin);
29 os_close_file(data->stdout); 26 close(data->stdout);
30 os_close_file(data->close_me[0]); 27 close(data->close_me[0]);
31 os_close_file(data->close_me[1]); 28 close(data->close_me[1]);
32} 29}
33 30
34int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock) 31int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock)
@@ -42,13 +39,13 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock)
42 char **args = NULL; 39 char **args = NULL;
43 40
44 err = os_pipe(in_fds, 1, 0); 41 err = os_pipe(in_fds, 1, 0);
45 if(err < 0){ 42 if (err < 0) {
46 printk("harddog_open - os_pipe failed, err = %d\n", -err); 43 printk("harddog_open - os_pipe failed, err = %d\n", -err);
47 goto out; 44 goto out;
48 } 45 }
49 46
50 err = os_pipe(out_fds, 1, 0); 47 err = os_pipe(out_fds, 1, 0);
51 if(err < 0){ 48 if (err < 0) {
52 printk("harddog_open - os_pipe failed, err = %d\n", -err); 49 printk("harddog_open - os_pipe failed, err = %d\n", -err);
53 goto out_close_in; 50 goto out_close_in;
54 } 51 }
@@ -58,37 +55,37 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock)
58 data.close_me[0] = out_fds[1]; 55 data.close_me[0] = out_fds[1];
59 data.close_me[1] = in_fds[0]; 56 data.close_me[1] = in_fds[0];
60 57
61 if(sock != NULL){ 58 if (sock != NULL) {
62 mconsole_args[2] = sock; 59 mconsole_args[2] = sock;
63 args = mconsole_args; 60 args = mconsole_args;
64 } 61 }
65 else { 62 else {
66 /* XXX The os_getpid() is not SMP correct */ 63 /* XXX The os_getpid() is not SMP correct */
67 sprintf(pid_buf, "%d", CHOOSE_MODE(tracing_pid, os_getpid())); 64 sprintf(pid_buf, "%d", os_getpid());
68 args = pid_args; 65 args = pid_args;
69 } 66 }
70 67
71 pid = run_helper(pre_exec, &data, args); 68 pid = run_helper(pre_exec, &data, args);
72 69
73 os_close_file(out_fds[0]); 70 close(out_fds[0]);
74 os_close_file(in_fds[1]); 71 close(in_fds[1]);
75 72
76 if(pid < 0){ 73 if (pid < 0) {
77 err = -pid; 74 err = -pid;
78 printk("harddog_open - run_helper failed, errno = %d\n", -err); 75 printk("harddog_open - run_helper failed, errno = %d\n", -err);
79 goto out_close_out; 76 goto out_close_out;
80 } 77 }
81 78
82 n = os_read_file(in_fds[0], &c, sizeof(c)); 79 n = read(in_fds[0], &c, sizeof(c));
83 if(n == 0){ 80 if (n == 0) {
84 printk("harddog_open - EOF on watchdog pipe\n"); 81 printk("harddog_open - EOF on watchdog pipe\n");
85 helper_wait(pid); 82 helper_wait(pid);
86 err = -EIO; 83 err = -EIO;
87 goto out_close_out; 84 goto out_close_out;
88 } 85 }
89 else if(n < 0){ 86 else if (n < 0) {
90 printk("harddog_open - read of watchdog pipe failed, " 87 printk("harddog_open - read of watchdog pipe failed, "
91 "err = %d\n", -n); 88 "err = %d\n", errno);
92 helper_wait(pid); 89 helper_wait(pid);
93 err = n; 90 err = n;
94 goto out_close_out; 91 goto out_close_out;
@@ -98,19 +95,19 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock)
98 return 0; 95 return 0;
99 96
100 out_close_in: 97 out_close_in:
101 os_close_file(in_fds[0]); 98 close(in_fds[0]);
102 os_close_file(in_fds[1]); 99 close(in_fds[1]);
103 out_close_out: 100 out_close_out:
104 os_close_file(out_fds[0]); 101 close(out_fds[0]);
105 os_close_file(out_fds[1]); 102 close(out_fds[1]);
106 out: 103 out:
107 return err; 104 return err;
108} 105}
109 106
110void stop_watchdog(int in_fd, int out_fd) 107void stop_watchdog(int in_fd, int out_fd)
111{ 108{
112 os_close_file(in_fd); 109 close(in_fd);
113 os_close_file(out_fd); 110 close(out_fd);
114} 111}
115 112
116int ping_watchdog(int fd) 113int ping_watchdog(int fd)
@@ -118,10 +115,11 @@ int ping_watchdog(int fd)
118 int n; 115 int n;
119 char c = '\n'; 116 char c = '\n';
120 117
121 n = os_write_file(fd, &c, sizeof(c)); 118 n = write(fd, &c, sizeof(c));
122 if(n != sizeof(c)){ 119 if (n != sizeof(c)) {
123 printk("ping_watchdog - write failed, err = %d\n", -n); 120 printk("ping_watchdog - write failed, ret = %d, err = %d\n",
124 if(n < 0) 121 n, errno);
122 if (n < 0)
125 return n; 123 return n;
126 return -EIO; 124 return -EIO;
127 } 125 }
diff --git a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c
index 10e08a8c17c3..ff1b22b69e9c 100644
--- a/arch/um/drivers/hostaudio_kern.c
+++ b/arch/um/drivers/hostaudio_kern.c
@@ -1,16 +1,14 @@
1/* 1/*
2 * Copyright (C) 2002 Steve Schmidtke 2 * Copyright (C) 2002 Steve Schmidtke
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/fs.h"
6#include "linux/module.h" 7#include "linux/module.h"
7#include "linux/init.h"
8#include "linux/slab.h" 8#include "linux/slab.h"
9#include "linux/fs.h"
10#include "linux/sound.h" 9#include "linux/sound.h"
11#include "linux/soundcard.h" 10#include "linux/soundcard.h"
12#include "asm/uaccess.h" 11#include "asm/uaccess.h"
13#include "kern_util.h"
14#include "init.h" 12#include "init.h"
15#include "os.h" 13#include "os.h"
16 14
@@ -25,7 +23,8 @@ struct hostmixer_state {
25#define HOSTAUDIO_DEV_DSP "/dev/sound/dsp" 23#define HOSTAUDIO_DEV_DSP "/dev/sound/dsp"
26#define HOSTAUDIO_DEV_MIXER "/dev/sound/mixer" 24#define HOSTAUDIO_DEV_MIXER "/dev/sound/mixer"
27 25
28/* Changed either at boot time or module load time. At boot, this is 26/*
27 * Changed either at boot time or module load time. At boot, this is
29 * single-threaded; at module load, multiple modules would each have 28 * single-threaded; at module load, multiple modules would each have
30 * their own copy of these variables. 29 * their own copy of these variables.
31 */ 30 */
@@ -44,7 +43,7 @@ static char *mixer = HOSTAUDIO_DEV_MIXER;
44static int set_dsp(char *name, int *add) 43static int set_dsp(char *name, int *add)
45{ 44{
46 dsp = name; 45 dsp = name;
47 return(0); 46 return 0;
48} 47}
49 48
50__uml_setup("dsp=", set_dsp, "dsp=<dsp device>\n" DSP_HELP); 49__uml_setup("dsp=", set_dsp, "dsp=<dsp device>\n" DSP_HELP);
@@ -52,7 +51,7 @@ __uml_setup("dsp=", set_dsp, "dsp=<dsp device>\n" DSP_HELP);
52static int set_mixer(char *name, int *add) 51static int set_mixer(char *name, int *add)
53{ 52{
54 mixer = name; 53 mixer = name;
55 return(0); 54 return 0;
56} 55}
57 56
58__uml_setup("mixer=", set_mixer, "mixer=<mixer device>\n" MIXER_HELP); 57__uml_setup("mixer=", set_mixer, "mixer=<mixer device>\n" MIXER_HELP);
@@ -77,23 +76,23 @@ static ssize_t hostaudio_read(struct file *file, char __user *buffer,
77 int err; 76 int err;
78 77
79#ifdef DEBUG 78#ifdef DEBUG
80 printk("hostaudio: read called, count = %d\n", count); 79 printk(KERN_DEBUG "hostaudio: read called, count = %d\n", count);
81#endif 80#endif
82 81
83 kbuf = kmalloc(count, GFP_KERNEL); 82 kbuf = kmalloc(count, GFP_KERNEL);
84 if(kbuf == NULL) 83 if (kbuf == NULL)
85 return(-ENOMEM); 84 return -ENOMEM;
86 85
87 err = os_read_file(state->fd, kbuf, count); 86 err = os_read_file(state->fd, kbuf, count);
88 if(err < 0) 87 if (err < 0)
89 goto out; 88 goto out;
90 89
91 if(copy_to_user(buffer, kbuf, err)) 90 if (copy_to_user(buffer, kbuf, err))
92 err = -EFAULT; 91 err = -EFAULT;
93 92
94out: 93out:
95 kfree(kbuf); 94 kfree(kbuf);
96 return(err); 95 return err;
97} 96}
98 97
99static ssize_t hostaudio_write(struct file *file, const char __user *buffer, 98static ssize_t hostaudio_write(struct file *file, const char __user *buffer,
@@ -104,40 +103,40 @@ static ssize_t hostaudio_write(struct file *file, const char __user *buffer,
104 int err; 103 int err;
105 104
106#ifdef DEBUG 105#ifdef DEBUG
107 printk("hostaudio: write called, count = %d\n", count); 106 printk(KERN_DEBUG "hostaudio: write called, count = %d\n", count);
108#endif 107#endif
109 108
110 kbuf = kmalloc(count, GFP_KERNEL); 109 kbuf = kmalloc(count, GFP_KERNEL);
111 if(kbuf == NULL) 110 if (kbuf == NULL)
112 return(-ENOMEM); 111 return -ENOMEM;
113 112
114 err = -EFAULT; 113 err = -EFAULT;
115 if(copy_from_user(kbuf, buffer, count)) 114 if (copy_from_user(kbuf, buffer, count))
116 goto out; 115 goto out;
117 116
118 err = os_write_file(state->fd, kbuf, count); 117 err = os_write_file(state->fd, kbuf, count);
119 if(err < 0) 118 if (err < 0)
120 goto out; 119 goto out;
121 *ppos += err; 120 *ppos += err;
122 121
123 out: 122 out:
124 kfree(kbuf); 123 kfree(kbuf);
125 return(err); 124 return err;
126} 125}
127 126
128static unsigned int hostaudio_poll(struct file *file, 127static unsigned int hostaudio_poll(struct file *file,
129 struct poll_table_struct *wait) 128 struct poll_table_struct *wait)
130{ 129{
131 unsigned int mask = 0; 130 unsigned int mask = 0;
132 131
133#ifdef DEBUG 132#ifdef DEBUG
134 printk("hostaudio: poll called (unimplemented)\n"); 133 printk(KERN_DEBUG "hostaudio: poll called (unimplemented)\n");
135#endif 134#endif
136 135
137 return(mask); 136 return mask;
138} 137}
139 138
140static int hostaudio_ioctl(struct inode *inode, struct file *file, 139static int hostaudio_ioctl(struct inode *inode, struct file *file,
141 unsigned int cmd, unsigned long arg) 140 unsigned int cmd, unsigned long arg)
142{ 141{
143 struct hostaudio_state *state = file->private_data; 142 struct hostaudio_state *state = file->private_data;
@@ -145,7 +144,7 @@ static int hostaudio_ioctl(struct inode *inode, struct file *file,
145 int err; 144 int err;
146 145
147#ifdef DEBUG 146#ifdef DEBUG
148 printk("hostaudio: ioctl called, cmd = %u\n", cmd); 147 printk(KERN_DEBUG "hostaudio: ioctl called, cmd = %u\n", cmd);
149#endif 148#endif
150 switch(cmd){ 149 switch(cmd){
151 case SNDCTL_DSP_SPEED: 150 case SNDCTL_DSP_SPEED:
@@ -154,8 +153,8 @@ static int hostaudio_ioctl(struct inode *inode, struct file *file,
154 case SNDCTL_DSP_CHANNELS: 153 case SNDCTL_DSP_CHANNELS:
155 case SNDCTL_DSP_SUBDIVIDE: 154 case SNDCTL_DSP_SUBDIVIDE:
156 case SNDCTL_DSP_SETFRAGMENT: 155 case SNDCTL_DSP_SETFRAGMENT:
157 if(get_user(data, (int __user *) arg)) 156 if (get_user(data, (int __user *) arg))
158 return(-EFAULT); 157 return EFAULT;
159 break; 158 break;
160 default: 159 default:
161 break; 160 break;
@@ -170,14 +169,14 @@ static int hostaudio_ioctl(struct inode *inode, struct file *file,
170 case SNDCTL_DSP_CHANNELS: 169 case SNDCTL_DSP_CHANNELS:
171 case SNDCTL_DSP_SUBDIVIDE: 170 case SNDCTL_DSP_SUBDIVIDE:
172 case SNDCTL_DSP_SETFRAGMENT: 171 case SNDCTL_DSP_SETFRAGMENT:
173 if(put_user(data, (int __user *) arg)) 172 if (put_user(data, (int __user *) arg))
174 return(-EFAULT); 173 return -EFAULT;
175 break; 174 break;
176 default: 175 default:
177 break; 176 break;
178 } 177 }
179 178
180 return(err); 179 return err;
181} 180}
182 181
183static int hostaudio_open(struct inode *inode, struct file *file) 182static int hostaudio_open(struct inode *inode, struct file *file)
@@ -187,24 +186,26 @@ static int hostaudio_open(struct inode *inode, struct file *file)
187 int ret; 186 int ret;
188 187
189#ifdef DEBUG 188#ifdef DEBUG
190 printk("hostaudio: open called (host: %s)\n", dsp); 189 printk(KERN_DEBUG "hostaudio: open called (host: %s)\n", dsp);
191#endif 190#endif
192 191
193 state = kmalloc(sizeof(struct hostaudio_state), GFP_KERNEL); 192 state = kmalloc(sizeof(struct hostaudio_state), GFP_KERNEL);
194 if(state == NULL) 193 if (state == NULL)
195 return(-ENOMEM); 194 return -ENOMEM;
196 195
197 if(file->f_mode & FMODE_READ) r = 1; 196 if (file->f_mode & FMODE_READ)
198 if(file->f_mode & FMODE_WRITE) w = 1; 197 r = 1;
198 if (file->f_mode & FMODE_WRITE)
199 w = 1;
199 200
200 ret = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0); 201 ret = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0);
201 if(ret < 0){ 202 if (ret < 0) {
202 kfree(state); 203 kfree(state);
203 return(ret); 204 return ret;
204 } 205 }
205 state->fd = ret; 206 state->fd = ret;
206 file->private_data = state; 207 file->private_data = state;
207 return(0); 208 return 0;
208} 209}
209 210
210static int hostaudio_release(struct inode *inode, struct file *file) 211static int hostaudio_release(struct inode *inode, struct file *file)
@@ -212,26 +213,26 @@ static int hostaudio_release(struct inode *inode, struct file *file)
212 struct hostaudio_state *state = file->private_data; 213 struct hostaudio_state *state = file->private_data;
213 214
214#ifdef DEBUG 215#ifdef DEBUG
215 printk("hostaudio: release called\n"); 216 printk(KERN_DEBUG "hostaudio: release called\n");
216#endif 217#endif
217 os_close_file(state->fd); 218 os_close_file(state->fd);
218 kfree(state); 219 kfree(state);
219 220
220 return(0); 221 return 0;
221} 222}
222 223
223/* /dev/mixer file operations */ 224/* /dev/mixer file operations */
224 225
225static int hostmixer_ioctl_mixdev(struct inode *inode, struct file *file, 226static int hostmixer_ioctl_mixdev(struct inode *inode, struct file *file,
226 unsigned int cmd, unsigned long arg) 227 unsigned int cmd, unsigned long arg)
227{ 228{
228 struct hostmixer_state *state = file->private_data; 229 struct hostmixer_state *state = file->private_data;
229 230
230#ifdef DEBUG 231#ifdef DEBUG
231 printk("hostmixer: ioctl called\n"); 232 printk(KERN_DEBUG "hostmixer: ioctl called\n");
232#endif 233#endif
233 234
234 return(os_ioctl_generic(state->fd, cmd, arg)); 235 return os_ioctl_generic(state->fd, cmd, arg);
235} 236}
236 237
237static int hostmixer_open_mixdev(struct inode *inode, struct file *file) 238static int hostmixer_open_mixdev(struct inode *inode, struct file *file)
@@ -241,26 +242,29 @@ static int hostmixer_open_mixdev(struct inode *inode, struct file *file)
241 int ret; 242 int ret;
242 243
243#ifdef DEBUG 244#ifdef DEBUG
244 printk("hostmixer: open called (host: %s)\n", mixer); 245 printk(KERN_DEBUG "hostmixer: open called (host: %s)\n", mixer);
245#endif 246#endif
246 247
247 state = kmalloc(sizeof(struct hostmixer_state), GFP_KERNEL); 248 state = kmalloc(sizeof(struct hostmixer_state), GFP_KERNEL);
248 if(state == NULL) return(-ENOMEM); 249 if (state == NULL)
250 return -ENOMEM;
249 251
250 if(file->f_mode & FMODE_READ) r = 1; 252 if (file->f_mode & FMODE_READ)
251 if(file->f_mode & FMODE_WRITE) w = 1; 253 r = 1;
254 if (file->f_mode & FMODE_WRITE)
255 w = 1;
252 256
253 ret = os_open_file(mixer, of_set_rw(OPENFLAGS(), r, w), 0); 257 ret = os_open_file(mixer, of_set_rw(OPENFLAGS(), r, w), 0);
254 258
255 if(ret < 0){ 259 if (ret < 0) {
256 printk("hostaudio_open_mixdev failed to open '%s', err = %d\n", 260 printk(KERN_ERR "hostaudio_open_mixdev failed to open '%s', "
257 dsp, -ret); 261 "err = %d\n", dsp, -ret);
258 kfree(state); 262 kfree(state);
259 return(ret); 263 return ret;
260 } 264 }
261 265
262 file->private_data = state; 266 file->private_data = state;
263 return(0); 267 return 0;
264} 268}
265 269
266static int hostmixer_release(struct inode *inode, struct file *file) 270static int hostmixer_release(struct inode *inode, struct file *file)
@@ -268,13 +272,13 @@ static int hostmixer_release(struct inode *inode, struct file *file)
268 struct hostmixer_state *state = file->private_data; 272 struct hostmixer_state *state = file->private_data;
269 273
270#ifdef DEBUG 274#ifdef DEBUG
271 printk("hostmixer: release called\n"); 275 printk(KERN_DEBUG "hostmixer: release called\n");
272#endif 276#endif
273 277
274 os_close_file(state->fd); 278 os_close_file(state->fd);
275 kfree(state); 279 kfree(state);
276 280
277 return(0); 281 return 0;
278} 282}
279 283
280/* kernel module operations */ 284/* kernel module operations */
@@ -314,13 +318,13 @@ static int __init hostaudio_init_module(void)
314 dsp, mixer); 318 dsp, mixer);
315 319
316 module_data.dev_audio = register_sound_dsp(&hostaudio_fops, -1); 320 module_data.dev_audio = register_sound_dsp(&hostaudio_fops, -1);
317 if(module_data.dev_audio < 0){ 321 if (module_data.dev_audio < 0) {
318 printk(KERN_ERR "hostaudio: couldn't register DSP device!\n"); 322 printk(KERN_ERR "hostaudio: couldn't register DSP device!\n");
319 return -ENODEV; 323 return -ENODEV;
320 } 324 }
321 325
322 module_data.dev_mixer = register_sound_mixer(&hostmixer_fops, -1); 326 module_data.dev_mixer = register_sound_mixer(&hostmixer_fops, -1);
323 if(module_data.dev_mixer < 0){ 327 if (module_data.dev_mixer < 0) {
324 printk(KERN_ERR "hostmixer: couldn't register mixer " 328 printk(KERN_ERR "hostmixer: couldn't register mixer "
325 "device!\n"); 329 "device!\n");
326 unregister_sound_dsp(module_data.dev_audio); 330 unregister_sound_dsp(module_data.dev_audio);
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 3e0b68e297f2..76fe0b0da996 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -1,22 +1,14 @@
1/* 1/*
2 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/kernel.h" 6#include "linux/irqreturn.h"
7#include "linux/sched.h"
8#include "linux/slab.h"
9#include "linux/list.h"
10#include "linux/kd.h" 7#include "linux/kd.h"
11#include "linux/interrupt.h"
12#include "asm/uaccess.h"
13#include "chan_kern.h" 8#include "chan_kern.h"
9#include "irq_kern.h"
14#include "irq_user.h" 10#include "irq_user.h"
15#include "line.h"
16#include "kern.h"
17#include "kern_util.h"
18#include "os.h" 11#include "os.h"
19#include "irq_kern.h"
20 12
21#define LINE_BUFSIZE 4096 13#define LINE_BUFSIZE 4096
22 14
@@ -35,12 +27,13 @@ static void line_timer_cb(struct work_struct *work)
35{ 27{
36 struct line *line = container_of(work, struct line, task.work); 28 struct line *line = container_of(work, struct line, task.work);
37 29
38 if(!line->throttled) 30 if (!line->throttled)
39 chan_interrupt(&line->chan_list, &line->task, line->tty, 31 chan_interrupt(&line->chan_list, &line->task, line->tty,
40 line->driver->read_irq); 32 line->driver->read_irq);
41} 33}
42 34
43/* Returns the free space inside the ring buffer of this line. 35/*
36 * Returns the free space inside the ring buffer of this line.
44 * 37 *
45 * Should be called while holding line->lock (this does not modify datas). 38 * Should be called while holding line->lock (this does not modify datas).
46 */ 39 */
@@ -107,11 +100,12 @@ static int buffer_data(struct line *line, const char *buf, int len)
107{ 100{
108 int end, room; 101 int end, room;
109 102
110 if(line->buffer == NULL){ 103 if (line->buffer == NULL) {
111 line->buffer = kmalloc(LINE_BUFSIZE, GFP_ATOMIC); 104 line->buffer = kmalloc(LINE_BUFSIZE, GFP_ATOMIC);
112 if (line->buffer == NULL) { 105 if (line->buffer == NULL) {
113 printk("buffer_data - atomic allocation failed\n"); 106 printk(KERN_ERR "buffer_data - atomic allocation "
114 return(0); 107 "failed\n");
108 return 0;
115 } 109 }
116 line->head = line->buffer; 110 line->head = line->buffer;
117 line->tail = line->buffer; 111 line->tail = line->buffer;
@@ -122,7 +116,7 @@ static int buffer_data(struct line *line, const char *buf, int len)
122 116
123 end = line->buffer + LINE_BUFSIZE - line->tail; 117 end = line->buffer + LINE_BUFSIZE - line->tail;
124 118
125 if (len < end){ 119 if (len < end) {
126 memcpy(line->tail, buf, len); 120 memcpy(line->tail, buf, len);
127 line->tail += len; 121 line->tail += len;
128 } 122 }
@@ -162,8 +156,10 @@ static int flush_buffer(struct line *line)
162 if (n < 0) 156 if (n < 0)
163 return n; 157 return n;
164 if (n == count) { 158 if (n == count) {
165 /* We have flushed from ->head to buffer end, now we 159 /*
166 * must flush only from the beginning to ->tail.*/ 160 * We have flushed from ->head to buffer end, now we
161 * must flush only from the beginning to ->tail.
162 */
167 line->head = line->buffer; 163 line->head = line->buffer;
168 } else { 164 } else {
169 line->head += n; 165 line->head += n;
@@ -175,7 +171,7 @@ static int flush_buffer(struct line *line)
175 n = write_chan(&line->chan_list, line->head, count, 171 n = write_chan(&line->chan_list, line->head, count,
176 line->driver->write_irq); 172 line->driver->write_irq);
177 173
178 if(n < 0) 174 if (n < 0)
179 return n; 175 return n;
180 176
181 line->head += n; 177 line->head += n;
@@ -189,19 +185,18 @@ void line_flush_buffer(struct tty_struct *tty)
189 int err; 185 int err;
190 186
191 /*XXX: copied from line_write, verify if it is correct!*/ 187 /*XXX: copied from line_write, verify if it is correct!*/
192 if(tty->stopped) 188 if (tty->stopped)
193 return; 189 return;
194 190
195 spin_lock_irqsave(&line->lock, flags); 191 spin_lock_irqsave(&line->lock, flags);
196 err = flush_buffer(line); 192 err = flush_buffer(line);
197 /*if (err == 1)
198 err = 0;*/
199 spin_unlock_irqrestore(&line->lock, flags); 193 spin_unlock_irqrestore(&line->lock, flags);
200 //return err;
201} 194}
202 195
203/* We map both ->flush_chars and ->put_char (which go in pair) onto ->flush_buffer 196/*
204 * and ->write. Hope it's not that bad.*/ 197 * We map both ->flush_chars and ->put_char (which go in pair) onto
198 * ->flush_buffer and ->write. Hope it's not that bad.
199 */
205void line_flush_chars(struct tty_struct *tty) 200void line_flush_chars(struct tty_struct *tty)
206{ 201{
207 line_flush_buffer(tty); 202 line_flush_buffer(tty);
@@ -216,18 +211,15 @@ int line_write(struct tty_struct *tty, const unsigned char *buf, int len)
216{ 211{
217 struct line *line = tty->driver_data; 212 struct line *line = tty->driver_data;
218 unsigned long flags; 213 unsigned long flags;
219 int n, err, ret = 0; 214 int n, ret = 0;
220 215
221 if(tty->stopped) 216 if (tty->stopped)
222 return 0; 217 return 0;
223 218
224 spin_lock_irqsave(&line->lock, flags); 219 spin_lock_irqsave(&line->lock, flags);
225 if (line->head != line->tail) { 220 if (line->head != line->tail)
226 ret = buffer_data(line, buf, len); 221 ret = buffer_data(line, buf, len);
227 err = flush_buffer(line); 222 else {
228 if (err <= 0 && (err != -EAGAIN || !ret))
229 ret = err;
230 } else {
231 n = write_chan(&line->chan_list, buf, len, 223 n = write_chan(&line->chan_list, buf, len,
232 line->driver->write_irq); 224 line->driver->write_irq);
233 if (n < 0) { 225 if (n < 0) {
@@ -257,17 +249,17 @@ static const struct {
257} tty_ioctls[] = { 249} tty_ioctls[] = {
258 /* don't print these, they flood the log ... */ 250 /* don't print these, they flood the log ... */
259 { TCGETS, NULL, "TCGETS" }, 251 { TCGETS, NULL, "TCGETS" },
260 { TCSETS, NULL, "TCSETS" }, 252 { TCSETS, NULL, "TCSETS" },
261 { TCSETSW, NULL, "TCSETSW" }, 253 { TCSETSW, NULL, "TCSETSW" },
262 { TCFLSH, NULL, "TCFLSH" }, 254 { TCFLSH, NULL, "TCFLSH" },
263 { TCSBRK, NULL, "TCSBRK" }, 255 { TCSBRK, NULL, "TCSBRK" },
264 256
265 /* general tty stuff */ 257 /* general tty stuff */
266 { TCSETSF, KERN_DEBUG, "TCSETSF" }, 258 { TCSETSF, KERN_DEBUG, "TCSETSF" },
267 { TCGETA, KERN_DEBUG, "TCGETA" }, 259 { TCGETA, KERN_DEBUG, "TCGETA" },
268 { TIOCMGET, KERN_DEBUG, "TIOCMGET" }, 260 { TIOCMGET, KERN_DEBUG, "TIOCMGET" },
269 { TCSBRKP, KERN_DEBUG, "TCSBRKP" }, 261 { TCSBRKP, KERN_DEBUG, "TCSBRKP" },
270 { TIOCMSET, KERN_DEBUG, "TIOCMSET" }, 262 { TIOCMSET, KERN_DEBUG, "TIOCMSET" },
271 263
272 /* linux-specific ones */ 264 /* linux-specific ones */
273 { TIOCLINUX, KERN_INFO, "TIOCLINUX" }, 265 { TIOCLINUX, KERN_INFO, "TIOCLINUX" },
@@ -324,12 +316,7 @@ int line_ioctl(struct tty_struct *tty, struct file * file,
324 for (i = 0; i < ARRAY_SIZE(tty_ioctls); i++) 316 for (i = 0; i < ARRAY_SIZE(tty_ioctls); i++)
325 if (cmd == tty_ioctls[i].cmd) 317 if (cmd == tty_ioctls[i].cmd)
326 break; 318 break;
327 if (i < ARRAY_SIZE(tty_ioctls)) { 319 if (i == ARRAY_SIZE(tty_ioctls)) {
328 if (NULL != tty_ioctls[i].level)
329 printk("%s%s: %s: ioctl %s called\n",
330 tty_ioctls[i].level, __FUNCTION__,
331 tty->name, tty_ioctls[i].name);
332 } else {
333 printk(KERN_ERR "%s: %s: unknown ioctl: 0x%x\n", 320 printk(KERN_ERR "%s: %s: unknown ioctl: 0x%x\n",
334 __FUNCTION__, tty->name, cmd); 321 __FUNCTION__, tty->name, cmd);
335 } 322 }
@@ -355,11 +342,12 @@ void line_unthrottle(struct tty_struct *tty)
355 chan_interrupt(&line->chan_list, &line->task, tty, 342 chan_interrupt(&line->chan_list, &line->task, tty,
356 line->driver->read_irq); 343 line->driver->read_irq);
357 344
358 /* Maybe there is enough stuff pending that calling the interrupt 345 /*
346 * Maybe there is enough stuff pending that calling the interrupt
359 * throttles us again. In this case, line->throttled will be 1 347 * throttles us again. In this case, line->throttled will be 1
360 * again and we shouldn't turn the interrupt back on. 348 * again and we shouldn't turn the interrupt back on.
361 */ 349 */
362 if(!line->throttled) 350 if (!line->throttled)
363 reactivate_chan(&line->chan_list, line->driver->read_irq); 351 reactivate_chan(&line->chan_list, line->driver->read_irq);
364} 352}
365 353
@@ -370,27 +358,30 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
370 struct tty_struct *tty = line->tty; 358 struct tty_struct *tty = line->tty;
371 int err; 359 int err;
372 360
373 /* Interrupts are disabled here because we registered the interrupt with 361 /*
374 * IRQF_DISABLED (see line_setup_irq).*/ 362 * Interrupts are disabled here because we registered the interrupt with
363 * IRQF_DISABLED (see line_setup_irq).
364 */
375 365
376 spin_lock(&line->lock); 366 spin_lock(&line->lock);
377 err = flush_buffer(line); 367 err = flush_buffer(line);
378 if (err == 0) { 368 if (err == 0) {
379 return IRQ_NONE; 369 return IRQ_NONE;
380 } else if(err < 0) { 370 } else if (err < 0) {
381 line->head = line->buffer; 371 line->head = line->buffer;
382 line->tail = line->buffer; 372 line->tail = line->buffer;
383 } 373 }
384 spin_unlock(&line->lock); 374 spin_unlock(&line->lock);
385 375
386 if(tty == NULL) 376 if (tty == NULL)
387 return IRQ_NONE; 377 return IRQ_NONE;
388 378
389 if (test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags) && 379 if (test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags) &&
390 (tty->ldisc.write_wakeup != NULL)) 380 (tty->ldisc.write_wakeup != NULL))
391 (tty->ldisc.write_wakeup)(tty); 381 (tty->ldisc.write_wakeup)(tty);
392 382
393 /* BLOCKING mode 383 /*
384 * BLOCKING mode
394 * In blocking mode, everything sleeps on tty->write_wait. 385 * In blocking mode, everything sleeps on tty->write_wait.
395 * Sleeping in the console driver would break non-blocking 386 * Sleeping in the console driver would break non-blocking
396 * writes. 387 * writes.
@@ -420,7 +411,8 @@ int line_setup_irq(int fd, int input, int output, struct line *line, void *data)
420 return err; 411 return err;
421} 412}
422 413
423/* Normally, a driver like this can rely mostly on the tty layer 414/*
415 * Normally, a driver like this can rely mostly on the tty layer
424 * locking, particularly when it comes to the driver structure. 416 * locking, particularly when it comes to the driver structure.
425 * However, in this case, mconsole requests can come in "from the 417 * However, in this case, mconsole requests can come in "from the
426 * side", and race with opens and closes. 418 * side", and race with opens and closes.
@@ -442,11 +434,11 @@ int line_open(struct line *lines, struct tty_struct *tty)
442 int err = -ENODEV; 434 int err = -ENODEV;
443 435
444 spin_lock(&line->count_lock); 436 spin_lock(&line->count_lock);
445 if(!line->valid) 437 if (!line->valid)
446 goto out_unlock; 438 goto out_unlock;
447 439
448 err = 0; 440 err = 0;
449 if(tty->count > 1) 441 if (tty->count > 1)
450 goto out_unlock; 442 goto out_unlock;
451 443
452 spin_unlock(&line->count_lock); 444 spin_unlock(&line->count_lock);
@@ -460,7 +452,7 @@ int line_open(struct line *lines, struct tty_struct *tty)
460 452
461 INIT_DELAYED_WORK(&line->task, line_timer_cb); 453 INIT_DELAYED_WORK(&line->task, line_timer_cb);
462 454
463 if(!line->sigio){ 455 if (!line->sigio) {
464 chan_enable_winch(&line->chan_list, tty); 456 chan_enable_winch(&line->chan_list, tty);
465 line->sigio = 1; 457 line->sigio = 1;
466 } 458 }
@@ -481,20 +473,21 @@ void line_close(struct tty_struct *tty, struct file * filp)
481{ 473{
482 struct line *line = tty->driver_data; 474 struct line *line = tty->driver_data;
483 475
484 /* If line_open fails (and tty->driver_data is never set), 476 /*
477 * If line_open fails (and tty->driver_data is never set),
485 * tty_open will call line_close. So just return in this case. 478 * tty_open will call line_close. So just return in this case.
486 */ 479 */
487 if(line == NULL) 480 if (line == NULL)
488 return; 481 return;
489 482
490 /* We ignore the error anyway! */ 483 /* We ignore the error anyway! */
491 flush_buffer(line); 484 flush_buffer(line);
492 485
493 spin_lock(&line->count_lock); 486 spin_lock(&line->count_lock);
494 if(!line->valid) 487 if (!line->valid)
495 goto out_unlock; 488 goto out_unlock;
496 489
497 if(tty->count > 1) 490 if (tty->count > 1)
498 goto out_unlock; 491 goto out_unlock;
499 492
500 spin_unlock(&line->count_lock); 493 spin_unlock(&line->count_lock);
@@ -502,10 +495,10 @@ void line_close(struct tty_struct *tty, struct file * filp)
502 line->tty = NULL; 495 line->tty = NULL;
503 tty->driver_data = NULL; 496 tty->driver_data = NULL;
504 497
505 if(line->sigio){ 498 if (line->sigio) {
506 unregister_winch(tty); 499 unregister_winch(tty);
507 line->sigio = 0; 500 line->sigio = 0;
508 } 501 }
509 502
510 return; 503 return;
511 504
@@ -529,12 +522,12 @@ static int setup_one_line(struct line *lines, int n, char *init, int init_prio,
529 522
530 spin_lock(&line->count_lock); 523 spin_lock(&line->count_lock);
531 524
532 if(line->tty != NULL){ 525 if (line->tty != NULL) {
533 *error_out = "Device is already open"; 526 *error_out = "Device is already open";
534 goto out; 527 goto out;
535 } 528 }
536 529
537 if (line->init_pri <= init_prio){ 530 if (line->init_pri <= init_prio) {
538 line->init_pri = init_prio; 531 line->init_pri = init_prio;
539 if (!strcmp(init, "none")) 532 if (!strcmp(init, "none"))
540 line->valid = 0; 533 line->valid = 0;
@@ -549,7 +542,8 @@ out:
549 return err; 542 return err;
550} 543}
551 544
552/* Common setup code for both startup command line and mconsole initialization. 545/*
546 * Common setup code for both startup command line and mconsole initialization.
553 * @lines contains the array (of size @num) to modify; 547 * @lines contains the array (of size @num) to modify;
554 * @init is the setup string; 548 * @init is the setup string;
555 * @error_out is an error string in the case of failure; 549 * @error_out is an error string in the case of failure;
@@ -561,14 +555,16 @@ int line_setup(struct line *lines, unsigned int num, char *init,
561 int i, n, err; 555 int i, n, err;
562 char *end; 556 char *end;
563 557
564 if(*init == '=') { 558 if (*init == '=') {
565 /* We said con=/ssl= instead of con#=, so we are configuring all 559 /*
566 * consoles at once.*/ 560 * We said con=/ssl= instead of con#=, so we are configuring all
561 * consoles at once.
562 */
567 n = -1; 563 n = -1;
568 } 564 }
569 else { 565 else {
570 n = simple_strtoul(init, &end, 0); 566 n = simple_strtoul(init, &end, 0);
571 if(*end != '='){ 567 if (*end != '=') {
572 *error_out = "Couldn't parse device number"; 568 *error_out = "Couldn't parse device number";
573 return -EINVAL; 569 return -EINVAL;
574 } 570 }
@@ -580,16 +576,16 @@ int line_setup(struct line *lines, unsigned int num, char *init,
580 *error_out = "Device number out of range"; 576 *error_out = "Device number out of range";
581 return -EINVAL; 577 return -EINVAL;
582 } 578 }
583 else if (n >= 0){ 579 else if (n >= 0) {
584 err = setup_one_line(lines, n, init, INIT_ONE, error_out); 580 err = setup_one_line(lines, n, init, INIT_ONE, error_out);
585 if(err) 581 if (err)
586 return err; 582 return err;
587 } 583 }
588 else { 584 else {
589 for(i = 0; i < num; i++){ 585 for(i = 0; i < num; i++) {
590 err = setup_one_line(lines, i, init, INIT_ALL, 586 err = setup_one_line(lines, i, init, INIT_ALL,
591 error_out); 587 error_out);
592 if(err) 588 if (err)
593 return err; 589 return err;
594 } 590 }
595 } 591 }
@@ -603,18 +599,18 @@ int line_config(struct line *lines, unsigned int num, char *str,
603 char *new; 599 char *new;
604 int n; 600 int n;
605 601
606 if(*str == '='){ 602 if (*str == '=') {
607 *error_out = "Can't configure all devices from mconsole"; 603 *error_out = "Can't configure all devices from mconsole";
608 return -EINVAL; 604 return -EINVAL;
609 } 605 }
610 606
611 new = kstrdup(str, GFP_KERNEL); 607 new = kstrdup(str, GFP_KERNEL);
612 if(new == NULL){ 608 if (new == NULL) {
613 *error_out = "Failed to allocate memory"; 609 *error_out = "Failed to allocate memory";
614 return -ENOMEM; 610 return -ENOMEM;
615 } 611 }
616 n = line_setup(lines, num, new, error_out); 612 n = line_setup(lines, num, new, error_out);
617 if(n < 0) 613 if (n < 0)
618 return n; 614 return n;
619 615
620 line = &lines[n]; 616 line = &lines[n];
@@ -629,12 +625,12 @@ int line_get_config(char *name, struct line *lines, unsigned int num, char *str,
629 int dev, n = 0; 625 int dev, n = 0;
630 626
631 dev = simple_strtoul(name, &end, 0); 627 dev = simple_strtoul(name, &end, 0);
632 if((*end != '\0') || (end == name)){ 628 if ((*end != '\0') || (end == name)) {
633 *error_out = "line_get_config failed to parse device number"; 629 *error_out = "line_get_config failed to parse device number";
634 return 0; 630 return 0;
635 } 631 }
636 632
637 if((dev < 0) || (dev >= num)){ 633 if ((dev < 0) || (dev >= num)) {
638 *error_out = "device number out of range"; 634 *error_out = "device number out of range";
639 return 0; 635 return 0;
640 } 636 }
@@ -642,9 +638,9 @@ int line_get_config(char *name, struct line *lines, unsigned int num, char *str,
642 line = &lines[dev]; 638 line = &lines[dev];
643 639
644 spin_lock(&line->count_lock); 640 spin_lock(&line->count_lock);
645 if(!line->valid) 641 if (!line->valid)
646 CONFIG_CHUNK(str, size, n, "none", 1); 642 CONFIG_CHUNK(str, size, n, "none", 1);
647 else if(line->tty == NULL) 643 else if (line->tty == NULL)
648 CONFIG_CHUNK(str, size, n, line->init_str, 1); 644 CONFIG_CHUNK(str, size, n, line->init_str, 1);
649 else n = chan_config_string(&line->chan_list, str, size, error_out); 645 else n = chan_config_string(&line->chan_list, str, size, error_out);
650 spin_unlock(&line->count_lock); 646 spin_unlock(&line->count_lock);
@@ -655,16 +651,16 @@ int line_get_config(char *name, struct line *lines, unsigned int num, char *str,
655int line_id(char **str, int *start_out, int *end_out) 651int line_id(char **str, int *start_out, int *end_out)
656{ 652{
657 char *end; 653 char *end;
658 int n; 654 int n;
659 655
660 n = simple_strtoul(*str, &end, 0); 656 n = simple_strtoul(*str, &end, 0);
661 if((*end != '\0') || (end == *str)) 657 if ((*end != '\0') || (end == *str))
662 return -1; 658 return -1;
663 659
664 *str = end; 660 *str = end;
665 *start_out = n; 661 *start_out = n;
666 *end_out = n; 662 *end_out = n;
667 return n; 663 return n;
668} 664}
669 665
670int line_remove(struct line *lines, unsigned int num, int n, char **error_out) 666int line_remove(struct line *lines, unsigned int num, int n, char **error_out)
@@ -674,7 +670,7 @@ int line_remove(struct line *lines, unsigned int num, int n, char **error_out)
674 670
675 sprintf(config, "%d=none", n); 671 sprintf(config, "%d=none", n);
676 err = line_setup(lines, num, config, error_out); 672 err = line_setup(lines, num, config, error_out);
677 if(err >= 0) 673 if (err >= 0)
678 err = 0; 674 err = 0;
679 return err; 675 return err;
680} 676}
@@ -700,14 +696,14 @@ struct tty_driver *register_lines(struct line_driver *line_driver,
700 tty_set_operations(driver, ops); 696 tty_set_operations(driver, ops);
701 697
702 if (tty_register_driver(driver)) { 698 if (tty_register_driver(driver)) {
703 printk("%s: can't register %s driver\n", 699 printk(KERN_ERR "register_lines : can't register %s driver\n",
704 __FUNCTION__,line_driver->name); 700 line_driver->name);
705 put_tty_driver(driver); 701 put_tty_driver(driver);
706 return NULL; 702 return NULL;
707 } 703 }
708 704
709 for(i = 0; i < nlines; i++){ 705 for(i = 0; i < nlines; i++) {
710 if(!lines[i].valid) 706 if (!lines[i].valid)
711 tty_unregister_device(driver, i); 707 tty_unregister_device(driver, i);
712 } 708 }
713 709
@@ -724,20 +720,20 @@ void lines_init(struct line *lines, int nlines, struct chan_opts *opts)
724 char *error; 720 char *error;
725 int i; 721 int i;
726 722
727 for(i = 0; i < nlines; i++){ 723 for(i = 0; i < nlines; i++) {
728 line = &lines[i]; 724 line = &lines[i];
729 INIT_LIST_HEAD(&line->chan_list); 725 INIT_LIST_HEAD(&line->chan_list);
730 726
731 if(line->init_str == NULL) 727 if (line->init_str == NULL)
732 continue; 728 continue;
733 729
734 line->init_str = kstrdup(line->init_str, GFP_KERNEL); 730 line->init_str = kstrdup(line->init_str, GFP_KERNEL);
735 if(line->init_str == NULL) 731 if (line->init_str == NULL)
736 printk("lines_init - kstrdup returned NULL\n"); 732 printk(KERN_ERR "lines_init - kstrdup returned NULL\n");
737 733
738 if(parse_chan_pair(line->init_str, line, i, opts, &error)){ 734 if (parse_chan_pair(line->init_str, line, i, opts, &error)) {
739 printk("parse_chan_pair failed for device %d : %s\n", 735 printk(KERN_ERR "parse_chan_pair failed for "
740 i, error); 736 "device %d : %s\n", i, error);
741 line->valid = 0; 737 line->valid = 0;
742 } 738 }
743 } 739 }
@@ -775,14 +771,14 @@ static irqreturn_t winch_interrupt(int irq, void *data)
775 int err; 771 int err;
776 char c; 772 char c;
777 773
778 if(winch->fd != -1){ 774 if (winch->fd != -1) {
779 err = generic_read(winch->fd, &c, NULL); 775 err = generic_read(winch->fd, &c, NULL);
780 if(err < 0){ 776 if (err < 0) {
781 if(err != -EAGAIN){ 777 if (err != -EAGAIN) {
782 printk("winch_interrupt : read failed, " 778 printk(KERN_ERR "winch_interrupt : "
783 "errno = %d\n", -err); 779 "read failed, errno = %d\n", -err);
784 printk("fd %d is losing SIGWINCH support\n", 780 printk(KERN_ERR "fd %d is losing SIGWINCH "
785 winch->tty_fd); 781 "support\n", winch->tty_fd);
786 free_winch(winch, 0); 782 free_winch(winch, 0);
787 return IRQ_HANDLED; 783 return IRQ_HANDLED;
788 } 784 }
@@ -797,7 +793,7 @@ static irqreturn_t winch_interrupt(int irq, void *data)
797 kill_pgrp(tty->pgrp, SIGWINCH, 1); 793 kill_pgrp(tty->pgrp, SIGWINCH, 1);
798 } 794 }
799 out: 795 out:
800 if(winch->fd != -1) 796 if (winch->fd != -1)
801 reactivate_fd(winch->fd, WINCH_IRQ); 797 reactivate_fd(winch->fd, WINCH_IRQ);
802 return IRQ_HANDLED; 798 return IRQ_HANDLED;
803} 799}
@@ -809,7 +805,7 @@ void register_winch_irq(int fd, int tty_fd, int pid, struct tty_struct *tty,
809 805
810 winch = kmalloc(sizeof(*winch), GFP_KERNEL); 806 winch = kmalloc(sizeof(*winch), GFP_KERNEL);
811 if (winch == NULL) { 807 if (winch == NULL) {
812 printk("register_winch_irq - kmalloc failed\n"); 808 printk(KERN_ERR "register_winch_irq - kmalloc failed\n");
813 goto cleanup; 809 goto cleanup;
814 } 810 }
815 811
@@ -823,7 +819,8 @@ void register_winch_irq(int fd, int tty_fd, int pid, struct tty_struct *tty,
823 if (um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt, 819 if (um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt,
824 IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM, 820 IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM,
825 "winch", winch) < 0) { 821 "winch", winch) < 0) {
826 printk("register_winch_irq - failed to register IRQ\n"); 822 printk(KERN_ERR "register_winch_irq - failed to register "
823 "IRQ\n");
827 goto out_free; 824 goto out_free;
828 } 825 }
829 826
@@ -849,13 +846,13 @@ static void unregister_winch(struct tty_struct *tty)
849 846
850 spin_lock(&winch_handler_lock); 847 spin_lock(&winch_handler_lock);
851 848
852 list_for_each(ele, &winch_handlers){ 849 list_for_each(ele, &winch_handlers) {
853 winch = list_entry(ele, struct winch, list); 850 winch = list_entry(ele, struct winch, list);
854 if(winch->tty == tty){ 851 if (winch->tty == tty) {
855 free_winch(winch, 1); 852 free_winch(winch, 1);
856 break; 853 break;
857 } 854 }
858 } 855 }
859 spin_unlock(&winch_handler_lock); 856 spin_unlock(&winch_handler_lock);
860} 857}
861 858
@@ -866,7 +863,7 @@ static void winch_cleanup(void)
866 863
867 spin_lock(&winch_handler_lock); 864 spin_lock(&winch_handler_lock);
868 865
869 list_for_each_safe(ele, next, &winch_handlers){ 866 list_for_each_safe(ele, next, &winch_handlers) {
870 winch = list_entry(ele, struct winch, list); 867 winch = list_entry(ele, struct winch, list);
871 free_winch(winch, 1); 868 free_winch(winch, 1);
872 } 869 }
@@ -881,13 +878,13 @@ char *add_xterm_umid(char *base)
881 int len; 878 int len;
882 879
883 umid = get_umid(); 880 umid = get_umid();
884 if(*umid == '\0') 881 if (*umid == '\0')
885 return base; 882 return base;
886 883
887 len = strlen(base) + strlen(" ()") + strlen(umid) + 1; 884 len = strlen(base) + strlen(" ()") + strlen(umid) + 1;
888 title = kmalloc(len, GFP_KERNEL); 885 title = kmalloc(len, GFP_KERNEL);
889 if(title == NULL){ 886 if (title == NULL) {
890 printk("Failed to allocate buffer for xterm title\n"); 887 printk(KERN_ERR "Failed to allocate buffer for xterm title\n");
891 return base; 888 return base;
892 } 889 }
893 890
diff --git a/arch/um/drivers/mcast.h b/arch/um/drivers/mcast.h
index bc56af9d3e53..6fa282e896be 100644
--- a/arch/um/drivers/mcast.h
+++ b/arch/um/drivers/mcast.h
@@ -1,8 +1,11 @@
1/* 1/*
2 * Copyright (C) 2001 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#ifndef __DRIVERS_MCAST_H
7#define __DRIVERS_MCAST_H
8
6#include "net_user.h" 9#include "net_user.h"
7 10
8struct mcast_data { 11struct mcast_data {
@@ -18,13 +21,4 @@ extern const struct net_user_info mcast_user_info;
18extern int mcast_user_write(int fd, void *buf, int len, 21extern int mcast_user_write(int fd, void *buf, int len,
19 struct mcast_data *pri); 22 struct mcast_data *pri);
20 23
21/* 24#endif
22 * Overrides for Emacs so that we follow Linus's tabbing style.
23 * Emacs will notice this stuff at the end of the file and automatically
24 * adjust the settings for this buffer only. This must remain at the end
25 * of the file.
26 * ---------------------------------------------------------------------------
27 * Local variables:
28 * c-file-style: "linux"
29 * End:
30 */
diff --git a/arch/um/drivers/mcast_kern.c b/arch/um/drivers/mcast_kern.c
index e6b8e0dd72a8..822092f149be 100644
--- a/arch/um/drivers/mcast_kern.c
+++ b/arch/um/drivers/mcast_kern.c
@@ -1,24 +1,20 @@
1/* 1/*
2 * user-mode-linux networking multicast transport 2 * user-mode-linux networking multicast transport
3 * Copyright (C) 2001 by Harald Welte <laforge@gnumonks.org> 3 * Copyright (C) 2001 by Harald Welte <laforge@gnumonks.org>
4 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 * 5 *
5 * based on the existing uml-networking code, which is 6 * based on the existing uml-networking code, which is
6 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and 7 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and
7 * James Leu (jleu@mindspring.net). 8 * James Leu (jleu@mindspring.net).
8 * Copyright (C) 2001 by various other people who didn't put their name here. 9 * Copyright (C) 2001 by various other people who didn't put their name here.
9 * 10 *
10 * Licensed under the GPL. 11 * Licensed under the GPL.
11 */ 12 */
12 13
13#include "linux/kernel.h"
14#include "linux/init.h" 14#include "linux/init.h"
15#include "linux/netdevice.h" 15#include <linux/netdevice.h>
16#include "linux/etherdevice.h"
17#include "linux/in.h"
18#include "linux/inet.h"
19#include "net_kern.h"
20#include "net_user.h"
21#include "mcast.h" 16#include "mcast.h"
17#include "net_kern.h"
22 18
23struct mcast_init { 19struct mcast_init {
24 char *addr; 20 char *addr;
@@ -39,26 +35,20 @@ static void mcast_init(struct net_device *dev, void *data)
39 dpri->ttl = init->ttl; 35 dpri->ttl = init->ttl;
40 dpri->dev = dev; 36 dpri->dev = dev;
41 37
42 printk("mcast backend "); 38 printk("mcast backend multicast address: %s:%u, TTL:%u\n",
43 printk("multicast address: %s:%u, TTL:%u ",
44 dpri->addr, dpri->port, dpri->ttl); 39 dpri->addr, dpri->port, dpri->ttl);
45
46 printk("\n");
47} 40}
48 41
49static int mcast_read(int fd, struct sk_buff **skb, struct uml_net_private *lp) 42static int mcast_read(int fd, struct sk_buff *skb, struct uml_net_private *lp)
50{ 43{
51 *skb = ether_adjust_skb(*skb, ETH_HEADER_OTHER); 44 return net_recvfrom(fd, skb_mac_header(skb),
52 if(*skb == NULL) return(-ENOMEM); 45 skb->dev->mtu + ETH_HEADER_OTHER);
53 return(net_recvfrom(fd, skb_mac_header(*skb),
54 (*skb)->dev->mtu + ETH_HEADER_OTHER));
55} 46}
56 47
57static int mcast_write(int fd, struct sk_buff **skb, 48static int mcast_write(int fd, struct sk_buff *skb, struct uml_net_private *lp)
58 struct uml_net_private *lp)
59{ 49{
60 return mcast_user_write(fd, (*skb)->data, (*skb)->len, 50 return mcast_user_write(fd, skb->data, skb->len,
61 (struct mcast_data *) &lp->user); 51 (struct mcast_data *) &lp->user);
62} 52}
63 53
64static const struct net_kern_info mcast_kern_info = { 54static const struct net_kern_info mcast_kern_info = {
@@ -81,34 +71,34 @@ int mcast_setup(char *str, char **mac_out, void *data)
81 71
82 remain = split_if_spec(str, mac_out, &init->addr, &port_str, &ttl_str, 72 remain = split_if_spec(str, mac_out, &init->addr, &port_str, &ttl_str,
83 NULL); 73 NULL);
84 if(remain != NULL){ 74 if (remain != NULL) {
85 printk(KERN_ERR "mcast_setup - Extra garbage on " 75 printk(KERN_ERR "mcast_setup - Extra garbage on "
86 "specification : '%s'\n", remain); 76 "specification : '%s'\n", remain);
87 return(0); 77 return 0;
88 } 78 }
89 79
90 if(port_str != NULL){ 80 if (port_str != NULL) {
91 init->port = simple_strtoul(port_str, &last, 10); 81 init->port = simple_strtoul(port_str, &last, 10);
92 if((*last != '\0') || (last == port_str)){ 82 if ((*last != '\0') || (last == port_str)) {
93 printk(KERN_ERR "mcast_setup - Bad port : '%s'\n", 83 printk(KERN_ERR "mcast_setup - Bad port : '%s'\n",
94 port_str); 84 port_str);
95 return(0); 85 return 0;
96 } 86 }
97 } 87 }
98 88
99 if(ttl_str != NULL){ 89 if (ttl_str != NULL) {
100 init->ttl = simple_strtoul(ttl_str, &last, 10); 90 init->ttl = simple_strtoul(ttl_str, &last, 10);
101 if((*last != '\0') || (last == ttl_str)){ 91 if ((*last != '\0') || (last == ttl_str)) {
102 printk(KERN_ERR "mcast_setup - Bad ttl : '%s'\n", 92 printk(KERN_ERR "mcast_setup - Bad ttl : '%s'\n",
103 ttl_str); 93 ttl_str);
104 return(0); 94 return 0;
105 } 95 }
106 } 96 }
107 97
108 printk(KERN_INFO "Configured mcast device: %s:%u-%u\n", init->addr, 98 printk(KERN_INFO "Configured mcast device: %s:%u-%u\n", init->addr,
109 init->port, init->ttl); 99 init->port, init->ttl);
110 100
111 return(1); 101 return 1;
112} 102}
113 103
114static struct transport mcast_transport = { 104static struct transport mcast_transport = {
diff --git a/arch/um/drivers/mcast_user.c b/arch/um/drivers/mcast_user.c
index 236a3dfc297d..5f647d7a7292 100644
--- a/arch/um/drivers/mcast_user.c
+++ b/arch/um/drivers/mcast_user.c
@@ -1,9 +1,10 @@
1/* 1/*
2 * user-mode-linux networking multicast transport 2 * user-mode-linux networking multicast transport
3 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Copyright (C) 2001 by Harald Welte <laforge@gnumonks.org> 4 * Copyright (C) 2001 by Harald Welte <laforge@gnumonks.org>
4 * 5 *
5 * based on the existing uml-networking code, which is 6 * based on the existing uml-networking code, which is
6 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and 7 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and
7 * James Leu (jleu@mindspring.net). 8 * James Leu (jleu@mindspring.net).
8 * Copyright (C) 2001 by various other people who didn't put their name here. 9 * Copyright (C) 2001 by various other people who didn't put their name here.
9 * 10 *
@@ -11,28 +12,22 @@
11 * 12 *
12 */ 13 */
13 14
14#include <errno.h>
15#include <unistd.h> 15#include <unistd.h>
16#include <sys/socket.h> 16#include <errno.h>
17#include <sys/un.h>
18#include <sys/time.h>
19#include <netinet/in.h> 17#include <netinet/in.h>
20#include "net_user.h"
21#include "mcast.h" 18#include "mcast.h"
22#include "kern_util.h" 19#include "net_user.h"
23#include "user.h"
24#include "os.h"
25#include "um_malloc.h" 20#include "um_malloc.h"
26 21#include "user.h"
27#define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER)
28 22
29static struct sockaddr_in *new_addr(char *addr, unsigned short port) 23static struct sockaddr_in *new_addr(char *addr, unsigned short port)
30{ 24{
31 struct sockaddr_in *sin; 25 struct sockaddr_in *sin;
32 26
33 sin = kmalloc(sizeof(struct sockaddr_in), UM_GFP_KERNEL); 27 sin = kmalloc(sizeof(struct sockaddr_in), UM_GFP_KERNEL);
34 if(sin == NULL){ 28 if (sin == NULL) {
35 printk("new_addr: allocation of sockaddr_in failed\n"); 29 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_in "
30 "failed\n");
36 return NULL; 31 return NULL;
37 } 32 }
38 sin->sin_family = AF_INET; 33 sin->sin_family = AF_INET;
@@ -71,17 +66,17 @@ static int mcast_open(void *data)
71 66
72 fd = socket(AF_INET, SOCK_DGRAM, 0); 67 fd = socket(AF_INET, SOCK_DGRAM, 0);
73 68
74 if (fd < 0){ 69 if (fd < 0) {
75 err = -errno; 70 err = -errno;
76 printk("mcast_open : data socket failed, errno = %d\n", 71 printk(UM_KERN_ERR "mcast_open : data socket failed, "
77 errno); 72 "errno = %d\n", errno);
78 goto out; 73 goto out;
79 } 74 }
80 75
81 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0) { 76 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0) {
82 err = -errno; 77 err = -errno;
83 printk("mcast_open: SO_REUSEADDR failed, errno = %d\n", 78 printk(UM_KERN_ERR "mcast_open: SO_REUSEADDR failed, "
84 errno); 79 "errno = %d\n", errno);
85 goto out_close; 80 goto out_close;
86 } 81 }
87 82
@@ -89,45 +84,46 @@ static int mcast_open(void *data)
89 if (setsockopt(fd, SOL_IP, IP_MULTICAST_TTL, &pri->ttl, 84 if (setsockopt(fd, SOL_IP, IP_MULTICAST_TTL, &pri->ttl,
90 sizeof(pri->ttl)) < 0) { 85 sizeof(pri->ttl)) < 0) {
91 err = -errno; 86 err = -errno;
92 printk("mcast_open: IP_MULTICAST_TTL failed, error = %d\n", 87 printk(UM_KERN_ERR "mcast_open: IP_MULTICAST_TTL failed, "
93 errno); 88 "error = %d\n", errno);
94 goto out_close; 89 goto out_close;
95 } 90 }
96 91
97 /* set LOOP, so data does get fed back to local sockets */ 92 /* set LOOP, so data does get fed back to local sockets */
98 if (setsockopt(fd, SOL_IP, IP_MULTICAST_LOOP, &yes, sizeof(yes)) < 0) { 93 if (setsockopt(fd, SOL_IP, IP_MULTICAST_LOOP, &yes, sizeof(yes)) < 0) {
99 err = -errno; 94 err = -errno;
100 printk("mcast_open: IP_MULTICAST_LOOP failed, error = %d\n", 95 printk(UM_KERN_ERR "mcast_open: IP_MULTICAST_LOOP failed, "
101 errno); 96 "error = %d\n", errno);
102 goto out_close; 97 goto out_close;
103 } 98 }
104 99
105 /* bind socket to mcast address */ 100 /* bind socket to mcast address */
106 if (bind(fd, (struct sockaddr *) sin, sizeof(*sin)) < 0) { 101 if (bind(fd, (struct sockaddr *) sin, sizeof(*sin)) < 0) {
107 err = -errno; 102 err = -errno;
108 printk("mcast_open : data bind failed, errno = %d\n", errno); 103 printk(UM_KERN_ERR "mcast_open : data bind failed, "
104 "errno = %d\n", errno);
109 goto out_close; 105 goto out_close;
110 } 106 }
111 107
112 /* subscribe to the multicast group */ 108 /* subscribe to the multicast group */
113 mreq.imr_multiaddr.s_addr = sin->sin_addr.s_addr; 109 mreq.imr_multiaddr.s_addr = sin->sin_addr.s_addr;
114 mreq.imr_interface.s_addr = 0; 110 mreq.imr_interface.s_addr = 0;
115 if (setsockopt(fd, SOL_IP, IP_ADD_MEMBERSHIP, 111 if (setsockopt(fd, SOL_IP, IP_ADD_MEMBERSHIP,
116 &mreq, sizeof(mreq)) < 0) { 112 &mreq, sizeof(mreq)) < 0) {
117 err = -errno; 113 err = -errno;
118 printk("mcast_open: IP_ADD_MEMBERSHIP failed, error = %d\n", 114 printk(UM_KERN_ERR "mcast_open: IP_ADD_MEMBERSHIP failed, "
119 errno); 115 "error = %d\n", errno);
120 printk("There appears not to be a multicast-capable network " 116 printk(UM_KERN_ERR "There appears not to be a multicast-"
121 "interface on the host.\n"); 117 "capable network interface on the host.\n");
122 printk("eth0 should be configured in order to use the " 118 printk(UM_KERN_ERR "eth0 should be configured in order to use "
123 "multicast transport.\n"); 119 "the multicast transport.\n");
124 goto out_close; 120 goto out_close;
125 } 121 }
126 122
127 return fd; 123 return fd;
128 124
129 out_close: 125 out_close:
130 os_close_file(fd); 126 close(fd);
131 out: 127 out:
132 return err; 128 return err;
133} 129}
@@ -142,11 +138,11 @@ static void mcast_close(int fd, void *data)
142 mreq.imr_interface.s_addr = 0; 138 mreq.imr_interface.s_addr = 0;
143 if (setsockopt(fd, SOL_IP, IP_DROP_MEMBERSHIP, 139 if (setsockopt(fd, SOL_IP, IP_DROP_MEMBERSHIP,
144 &mreq, sizeof(mreq)) < 0) { 140 &mreq, sizeof(mreq)) < 0) {
145 printk("mcast_open: IP_DROP_MEMBERSHIP failed, error = %d\n", 141 printk(UM_KERN_ERR "mcast_open: IP_DROP_MEMBERSHIP failed, "
146 errno); 142 "error = %d\n", errno);
147 } 143 }
148 144
149 os_close_file(fd); 145 close(fd);
150} 146}
151 147
152int mcast_user_write(int fd, void *buf, int len, struct mcast_data *pri) 148int mcast_user_write(int fd, void *buf, int len, struct mcast_data *pri)
@@ -156,18 +152,13 @@ int mcast_user_write(int fd, void *buf, int len, struct mcast_data *pri)
156 return net_sendto(fd, buf, len, data_addr, sizeof(*data_addr)); 152 return net_sendto(fd, buf, len, data_addr, sizeof(*data_addr));
157} 153}
158 154
159static int mcast_set_mtu(int mtu, void *data)
160{
161 return mtu;
162}
163
164const struct net_user_info mcast_user_info = { 155const struct net_user_info mcast_user_info = {
165 .init = mcast_user_init, 156 .init = mcast_user_init,
166 .open = mcast_open, 157 .open = mcast_open,
167 .close = mcast_close, 158 .close = mcast_close,
168 .remove = mcast_remove, 159 .remove = mcast_remove,
169 .set_mtu = mcast_set_mtu,
170 .add_address = NULL, 160 .add_address = NULL,
171 .delete_address = NULL, 161 .delete_address = NULL,
172 .max_packet = MAX_PACKET - ETH_HEADER_OTHER 162 .mtu = ETH_MAX_PACKET,
163 .max_packet = ETH_MAX_PACKET + ETH_HEADER_OTHER,
173}; 164};
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index d87090507401..0f3c7d14a6e3 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -1,44 +1,35 @@
1/* 1/*
2 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) 2 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org)
3 * Copyright (C) 2001 - 2003 Jeff Dike (jdike@addtoit.com) 3 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 * Licensed under the GPL 4 * Licensed under the GPL
5 */ 5 */
6 6
7#include "linux/kernel.h" 7#include "linux/console.h"
8#include "linux/slab.h"
9#include "linux/init.h"
10#include "linux/notifier.h"
11#include "linux/reboot.h"
12#include "linux/utsname.h"
13#include "linux/ctype.h" 8#include "linux/ctype.h"
14#include "linux/interrupt.h" 9#include "linux/interrupt.h"
15#include "linux/sysrq.h" 10#include "linux/list.h"
16#include "linux/workqueue.h" 11#include "linux/mm.h"
17#include "linux/module.h" 12#include "linux/module.h"
18#include "linux/file.h" 13#include "linux/notifier.h"
19#include "linux/fs.h" 14#include "linux/reboot.h"
20#include "linux/namei.h"
21#include "linux/proc_fs.h" 15#include "linux/proc_fs.h"
16#include "linux/slab.h"
22#include "linux/syscalls.h" 17#include "linux/syscalls.h"
23#include "linux/list.h" 18#include "linux/utsname.h"
24#include "linux/mm.h" 19#include "linux/workqueue.h"
25#include "linux/console.h"
26#include "asm/irq.h"
27#include "asm/uaccess.h" 20#include "asm/uaccess.h"
21#include "init.h"
22#include "irq_kern.h"
23#include "irq_user.h"
28#include "kern_util.h" 24#include "kern_util.h"
29#include "kern.h"
30#include "mconsole.h" 25#include "mconsole.h"
31#include "mconsole_kern.h" 26#include "mconsole_kern.h"
32#include "irq_user.h"
33#include "init.h"
34#include "os.h" 27#include "os.h"
35#include "irq_kern.h"
36#include "choose-mode.h"
37 28
38static int do_unlink_socket(struct notifier_block *notifier, 29static int do_unlink_socket(struct notifier_block *notifier,
39 unsigned long what, void *data) 30 unsigned long what, void *data)
40{ 31{
41 return(mconsole_unlink_socket()); 32 return mconsole_unlink_socket();
42} 33}
43 34
44 35
@@ -59,10 +50,9 @@ static void mc_work_proc(struct work_struct *unused)
59 struct mconsole_entry *req; 50 struct mconsole_entry *req;
60 unsigned long flags; 51 unsigned long flags;
61 52
62 while(!list_empty(&mc_requests)){ 53 while (!list_empty(&mc_requests)) {
63 local_irq_save(flags); 54 local_irq_save(flags);
64 req = list_entry(mc_requests.next, struct mconsole_entry, 55 req = list_entry(mc_requests.next, struct mconsole_entry, list);
65 list);
66 list_del(&req->list); 56 list_del(&req->list);
67 local_irq_restore(flags); 57 local_irq_restore(flags);
68 req->request.cmd->handler(&req->request); 58 req->request.cmd->handler(&req->request);
@@ -80,12 +70,12 @@ static irqreturn_t mconsole_interrupt(int irq, void *dev_id)
80 static struct mc_request req; /* that's OK */ 70 static struct mc_request req; /* that's OK */
81 71
82 fd = (long) dev_id; 72 fd = (long) dev_id;
83 while (mconsole_get_request(fd, &req)){ 73 while (mconsole_get_request(fd, &req)) {
84 if(req.cmd->context == MCONSOLE_INTR) 74 if (req.cmd->context == MCONSOLE_INTR)
85 (*req.cmd->handler)(&req); 75 (*req.cmd->handler)(&req);
86 else { 76 else {
87 new = kmalloc(sizeof(*new), GFP_NOWAIT); 77 new = kmalloc(sizeof(*new), GFP_NOWAIT);
88 if(new == NULL) 78 if (new == NULL)
89 mconsole_reply(&req, "Out of memory", 1, 0); 79 mconsole_reply(&req, "Out of memory", 1, 0);
90 else { 80 else {
91 new->request = req; 81 new->request = req;
@@ -94,10 +84,10 @@ static irqreturn_t mconsole_interrupt(int irq, void *dev_id)
94 } 84 }
95 } 85 }
96 } 86 }
97 if(!list_empty(&mc_requests)) 87 if (!list_empty(&mc_requests))
98 schedule_work(&mconsole_work); 88 schedule_work(&mconsole_work);
99 reactivate_fd(fd, MCONSOLE_IRQ); 89 reactivate_fd(fd, MCONSOLE_IRQ);
100 return(IRQ_HANDLED); 90 return IRQ_HANDLED;
101} 91}
102 92
103void mconsole_version(struct mc_request *req) 93void mconsole_version(struct mc_request *req)
@@ -105,8 +95,8 @@ void mconsole_version(struct mc_request *req)
105 char version[256]; 95 char version[256];
106 96
107 sprintf(version, "%s %s %s %s %s", utsname()->sysname, 97 sprintf(version, "%s %s %s %s %s", utsname()->sysname,
108 utsname()->nodename, utsname()->release, 98 utsname()->nodename, utsname()->release, utsname()->version,
109 utsname()->version, utsname()->machine); 99 utsname()->machine);
110 mconsole_reply(req, version, 0, 0); 100 mconsole_reply(req, version, 0, 0);
111} 101}
112 102
@@ -118,7 +108,7 @@ void mconsole_log(struct mc_request *req)
118 ptr += strlen("log "); 108 ptr += strlen("log ");
119 109
120 len = req->len - (ptr - req->request.data); 110 len = req->len - (ptr - req->request.data);
121 printk("%.*s", len, ptr); 111 printk(KERN_WARNING "%.*s", len, ptr);
122 mconsole_reply(req, "", 0, 0); 112 mconsole_reply(req, "", 0, 0);
123} 113}
124 114
@@ -137,17 +127,17 @@ void mconsole_proc(struct mc_request *req)
137 char *ptr = req->request.data, *buf; 127 char *ptr = req->request.data, *buf;
138 128
139 ptr += strlen("proc"); 129 ptr += strlen("proc");
140 while(isspace(*ptr)) ptr++; 130 while (isspace(*ptr)) ptr++;
141 131
142 proc = get_fs_type("proc"); 132 proc = get_fs_type("proc");
143 if(proc == NULL){ 133 if (proc == NULL) {
144 mconsole_reply(req, "procfs not registered", 1, 0); 134 mconsole_reply(req, "procfs not registered", 1, 0);
145 goto out; 135 goto out;
146 } 136 }
147 137
148 super = (*proc->get_sb)(proc, 0, NULL, NULL); 138 super = (*proc->get_sb)(proc, 0, NULL, NULL);
149 put_filesystem(proc); 139 put_filesystem(proc);
150 if(super == NULL){ 140 if (super == NULL) {
151 mconsole_reply(req, "Failed to get procfs superblock", 1, 0); 141 mconsole_reply(req, "Failed to get procfs superblock", 1, 0);
152 goto out; 142 goto out;
153 } 143 }
@@ -162,29 +152,29 @@ void mconsole_proc(struct mc_request *req)
162 * if commenting out these two calls + the below read cycle. To 152 * if commenting out these two calls + the below read cycle. To
163 * make UML crash again, it was enough to readd either one.*/ 153 * make UML crash again, it was enough to readd either one.*/
164 err = link_path_walk(ptr, &nd); 154 err = link_path_walk(ptr, &nd);
165 if(err){ 155 if (err) {
166 mconsole_reply(req, "Failed to look up file", 1, 0); 156 mconsole_reply(req, "Failed to look up file", 1, 0);
167 goto out_kill; 157 goto out_kill;
168 } 158 }
169 159
170 file = dentry_open(nd.dentry, nd.mnt, O_RDONLY); 160 file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
171 if(IS_ERR(file)){ 161 if (IS_ERR(file)) {
172 mconsole_reply(req, "Failed to open file", 1, 0); 162 mconsole_reply(req, "Failed to open file", 1, 0);
173 goto out_kill; 163 goto out_kill;
174 } 164 }
175 /*END*/ 165 /*END*/
176 166
177 buf = kmalloc(PAGE_SIZE, GFP_KERNEL); 167 buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
178 if(buf == NULL){ 168 if (buf == NULL) {
179 mconsole_reply(req, "Failed to allocate buffer", 1, 0); 169 mconsole_reply(req, "Failed to allocate buffer", 1, 0);
180 goto out_fput; 170 goto out_fput;
181 } 171 }
182 172
183 if((file->f_op != NULL) && (file->f_op->read != NULL)){ 173 if ((file->f_op != NULL) && (file->f_op->read != NULL)) {
184 do { 174 do {
185 n = (*file->f_op->read)(file, buf, PAGE_SIZE - 1, 175 n = (*file->f_op->read)(file, buf, PAGE_SIZE - 1,
186 &file->f_pos); 176 &file->f_pos);
187 if(n >= 0){ 177 if (n >= 0) {
188 buf[n] = '\0'; 178 buf[n] = '\0';
189 mconsole_reply(req, buf, 0, (n > 0)); 179 mconsole_reply(req, buf, 0, (n > 0));
190 } 180 }
@@ -193,7 +183,7 @@ void mconsole_proc(struct mc_request *req)
193 1, 0); 183 1, 0);
194 goto out_free; 184 goto out_free;
195 } 185 }
196 } while(n > 0); 186 } while (n > 0);
197 } 187 }
198 else mconsole_reply(req, "", 0, 0); 188 else mconsole_reply(req, "", 0, 0);
199 189
@@ -217,18 +207,19 @@ void mconsole_proc(struct mc_request *req)
217 char *ptr = req->request.data; 207 char *ptr = req->request.data;
218 208
219 ptr += strlen("proc"); 209 ptr += strlen("proc");
220 while(isspace(*ptr)) ptr++; 210 while (isspace(*ptr))
211 ptr++;
221 snprintf(path, sizeof(path), "/proc/%s", ptr); 212 snprintf(path, sizeof(path), "/proc/%s", ptr);
222 213
223 fd = sys_open(path, 0, 0); 214 fd = sys_open(path, 0, 0);
224 if (fd < 0) { 215 if (fd < 0) {
225 mconsole_reply(req, "Failed to open file", 1, 0); 216 mconsole_reply(req, "Failed to open file", 1, 0);
226 printk("open %s: %d\n",path,fd); 217 printk(KERN_ERR "open %s: %d\n",path,fd);
227 goto out; 218 goto out;
228 } 219 }
229 220
230 buf = kmalloc(PAGE_SIZE, GFP_KERNEL); 221 buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
231 if(buf == NULL){ 222 if (buf == NULL) {
232 mconsole_reply(req, "Failed to allocate buffer", 1, 0); 223 mconsole_reply(req, "Failed to allocate buffer", 1, 0);
233 goto out_close; 224 goto out_close;
234 } 225 }
@@ -239,7 +230,7 @@ void mconsole_proc(struct mc_request *req)
239 mconsole_reply(req, "Read of file failed", 1, 0); 230 mconsole_reply(req, "Read of file failed", 1, 0);
240 goto out_free; 231 goto out_free;
241 } 232 }
242 /*Begin the file content on his own line.*/ 233 /* Begin the file content on his own line. */
243 if (first_chunk) { 234 if (first_chunk) {
244 mconsole_reply(req, "\n", 0, 1); 235 mconsole_reply(req, "\n", 0, 1);
245 first_chunk = 0; 236 first_chunk = 0;
@@ -351,12 +342,12 @@ static struct mc_device *mconsole_find_dev(char *name)
351 struct list_head *ele; 342 struct list_head *ele;
352 struct mc_device *dev; 343 struct mc_device *dev;
353 344
354 list_for_each(ele, &mconsole_devices){ 345 list_for_each(ele, &mconsole_devices) {
355 dev = list_entry(ele, struct mc_device, list); 346 dev = list_entry(ele, struct mc_device, list);
356 if(!strncmp(name, dev->name, strlen(dev->name))) 347 if (!strncmp(name, dev->name, strlen(dev->name)))
357 return(dev); 348 return dev;
358 } 349 }
359 return(NULL); 350 return NULL;
360} 351}
361 352
362#define UNPLUGGED_PER_PAGE \ 353#define UNPLUGGED_PER_PAGE \
@@ -378,15 +369,15 @@ static int mem_config(char *str, char **error_out)
378 int err = -EINVAL, i, add; 369 int err = -EINVAL, i, add;
379 char *ret; 370 char *ret;
380 371
381 if(str[0] != '='){ 372 if (str[0] != '=') {
382 *error_out = "Expected '=' after 'mem'"; 373 *error_out = "Expected '=' after 'mem'";
383 goto out; 374 goto out;
384 } 375 }
385 376
386 str++; 377 str++;
387 if(str[0] == '-') 378 if (str[0] == '-')
388 add = 0; 379 add = 0;
389 else if(str[0] == '+'){ 380 else if (str[0] == '+') {
390 add = 1; 381 add = 1;
391 } 382 }
392 else { 383 else {
@@ -396,7 +387,7 @@ static int mem_config(char *str, char **error_out)
396 387
397 str++; 388 str++;
398 diff = memparse(str, &ret); 389 diff = memparse(str, &ret);
399 if(*ret != '\0'){ 390 if (*ret != '\0') {
400 *error_out = "Failed to parse memory increment"; 391 *error_out = "Failed to parse memory increment";
401 goto out; 392 goto out;
402 } 393 }
@@ -404,17 +395,17 @@ static int mem_config(char *str, char **error_out)
404 diff /= PAGE_SIZE; 395 diff /= PAGE_SIZE;
405 396
406 down(&plug_mem_mutex); 397 down(&plug_mem_mutex);
407 for(i = 0; i < diff; i++){ 398 for (i = 0; i < diff; i++) {
408 struct unplugged_pages *unplugged; 399 struct unplugged_pages *unplugged;
409 void *addr; 400 void *addr;
410 401
411 if(add){ 402 if (add) {
412 if(list_empty(&unplugged_pages)) 403 if (list_empty(&unplugged_pages))
413 break; 404 break;
414 405
415 unplugged = list_entry(unplugged_pages.next, 406 unplugged = list_entry(unplugged_pages.next,
416 struct unplugged_pages, list); 407 struct unplugged_pages, list);
417 if(unplug_index > 0) 408 if (unplug_index > 0)
418 addr = unplugged->pages[--unplug_index]; 409 addr = unplugged->pages[--unplug_index];
419 else { 410 else {
420 list_del(&unplugged->list); 411 list_del(&unplugged->list);
@@ -429,11 +420,11 @@ static int mem_config(char *str, char **error_out)
429 struct page *page; 420 struct page *page;
430 421
431 page = alloc_page(GFP_ATOMIC); 422 page = alloc_page(GFP_ATOMIC);
432 if(page == NULL) 423 if (page == NULL)
433 break; 424 break;
434 425
435 unplugged = page_address(page); 426 unplugged = page_address(page);
436 if(unplug_index == UNPLUGGED_PER_PAGE){ 427 if (unplug_index == UNPLUGGED_PER_PAGE) {
437 list_add(&unplugged->list, &unplugged_pages); 428 list_add(&unplugged->list, &unplugged_pages);
438 unplug_index = 0; 429 unplug_index = 0;
439 } 430 }
@@ -445,9 +436,9 @@ static int mem_config(char *str, char **error_out)
445 struct unplugged_pages, 436 struct unplugged_pages,
446 list); 437 list);
447 err = os_drop_memory(addr, PAGE_SIZE); 438 err = os_drop_memory(addr, PAGE_SIZE);
448 if(err){ 439 if (err) {
449 printk("Failed to release memory - " 440 printk(KERN_ERR "Failed to release "
450 "errno = %d\n", err); 441 "memory - errno = %d\n", err);
451 *error_out = "Failed to release memory"; 442 *error_out = "Failed to release memory";
452 goto out_unlock; 443 goto out_unlock;
453 } 444 }
@@ -501,10 +492,10 @@ static struct mc_device mem_mc = {
501 492
502static int __init mem_mc_init(void) 493static int __init mem_mc_init(void)
503{ 494{
504 if(can_drop_memory()) 495 if (can_drop_memory())
505 mconsole_register_dev(&mem_mc); 496 mconsole_register_dev(&mem_mc);
506 else printk("Can't release memory to the host - memory hotplug won't " 497 else printk(KERN_ERR "Can't release memory to the host - memory "
507 "be supported\n"); 498 "hotplug won't be supported\n");
508 return 0; 499 return 0;
509} 500}
510 501
@@ -519,7 +510,7 @@ static void mconsole_get_config(int (*get_config)(char *, char *, int,
519 char default_buf[CONFIG_BUF_SIZE], *error, *buf; 510 char default_buf[CONFIG_BUF_SIZE], *error, *buf;
520 int n, size; 511 int n, size;
521 512
522 if(get_config == NULL){ 513 if (get_config == NULL) {
523 mconsole_reply(req, "No get_config routine defined", 1, 0); 514 mconsole_reply(req, "No get_config routine defined", 1, 0);
524 return; 515 return;
525 } 516 }
@@ -528,30 +519,30 @@ static void mconsole_get_config(int (*get_config)(char *, char *, int,
528 size = ARRAY_SIZE(default_buf); 519 size = ARRAY_SIZE(default_buf);
529 buf = default_buf; 520 buf = default_buf;
530 521
531 while(1){ 522 while (1) {
532 n = (*get_config)(name, buf, size, &error); 523 n = (*get_config)(name, buf, size, &error);
533 if(error != NULL){ 524 if (error != NULL) {
534 mconsole_reply(req, error, 1, 0); 525 mconsole_reply(req, error, 1, 0);
535 goto out; 526 goto out;
536 } 527 }
537 528
538 if(n <= size){ 529 if (n <= size) {
539 mconsole_reply(req, buf, 0, 0); 530 mconsole_reply(req, buf, 0, 0);
540 goto out; 531 goto out;
541 } 532 }
542 533
543 if(buf != default_buf) 534 if (buf != default_buf)
544 kfree(buf); 535 kfree(buf);
545 536
546 size = n; 537 size = n;
547 buf = kmalloc(size, GFP_KERNEL); 538 buf = kmalloc(size, GFP_KERNEL);
548 if(buf == NULL){ 539 if (buf == NULL) {
549 mconsole_reply(req, "Failed to allocate buffer", 1, 0); 540 mconsole_reply(req, "Failed to allocate buffer", 1, 0);
550 return; 541 return;
551 } 542 }
552 } 543 }
553 out: 544 out:
554 if(buf != default_buf) 545 if (buf != default_buf)
555 kfree(buf); 546 kfree(buf);
556} 547}
557 548
@@ -562,19 +553,20 @@ void mconsole_config(struct mc_request *req)
562 int err; 553 int err;
563 554
564 ptr += strlen("config"); 555 ptr += strlen("config");
565 while(isspace(*ptr)) ptr++; 556 while (isspace(*ptr))
557 ptr++;
566 dev = mconsole_find_dev(ptr); 558 dev = mconsole_find_dev(ptr);
567 if(dev == NULL){ 559 if (dev == NULL) {
568 mconsole_reply(req, "Bad configuration option", 1, 0); 560 mconsole_reply(req, "Bad configuration option", 1, 0);
569 return; 561 return;
570 } 562 }
571 563
572 name = &ptr[strlen(dev->name)]; 564 name = &ptr[strlen(dev->name)];
573 ptr = name; 565 ptr = name;
574 while((*ptr != '=') && (*ptr != '\0')) 566 while ((*ptr != '=') && (*ptr != '\0'))
575 ptr++; 567 ptr++;
576 568
577 if(*ptr == '='){ 569 if (*ptr == '=') {
578 err = (*dev->config)(name, &error_string); 570 err = (*dev->config)(name, &error_string);
579 mconsole_reply(req, error_string, err, 0); 571 mconsole_reply(req, error_string, err, 0);
580 } 572 }
@@ -589,9 +581,9 @@ void mconsole_remove(struct mc_request *req)
589 int err, start, end, n; 581 int err, start, end, n;
590 582
591 ptr += strlen("remove"); 583 ptr += strlen("remove");
592 while(isspace(*ptr)) ptr++; 584 while (isspace(*ptr)) ptr++;
593 dev = mconsole_find_dev(ptr); 585 dev = mconsole_find_dev(ptr);
594 if(dev == NULL){ 586 if (dev == NULL) {
595 mconsole_reply(req, "Bad remove option", 1, 0); 587 mconsole_reply(req, "Bad remove option", 1, 0);
596 return; 588 return;
597 } 589 }
@@ -600,11 +592,11 @@ void mconsole_remove(struct mc_request *req)
600 592
601 err = 1; 593 err = 1;
602 n = (*dev->id)(&ptr, &start, &end); 594 n = (*dev->id)(&ptr, &start, &end);
603 if(n < 0){ 595 if (n < 0) {
604 err_msg = "Couldn't parse device number"; 596 err_msg = "Couldn't parse device number";
605 goto out; 597 goto out;
606 } 598 }
607 else if((n < start) || (n > end)){ 599 else if ((n < start) || (n > end)) {
608 sprintf(error, "Invalid device number - must be between " 600 sprintf(error, "Invalid device number - must be between "
609 "%d and %d", start, end); 601 "%d and %d", start, end);
610 err_msg = error; 602 err_msg = error;
@@ -613,16 +605,16 @@ void mconsole_remove(struct mc_request *req)
613 605
614 err_msg = NULL; 606 err_msg = NULL;
615 err = (*dev->remove)(n, &err_msg); 607 err = (*dev->remove)(n, &err_msg);
616 switch(err){ 608 switch(err) {
617 case 0: 609 case 0:
618 err_msg = ""; 610 err_msg = "";
619 break; 611 break;
620 case -ENODEV: 612 case -ENODEV:
621 if(err_msg == NULL) 613 if (err_msg == NULL)
622 err_msg = "Device doesn't exist"; 614 err_msg = "Device doesn't exist";
623 break; 615 break;
624 case -EBUSY: 616 case -EBUSY:
625 if(err_msg == NULL) 617 if (err_msg == NULL)
626 err_msg = "Device is currently open"; 618 err_msg = "Device is currently open";
627 break; 619 break;
628 default: 620 default:
@@ -640,35 +632,28 @@ struct mconsole_output {
640static DEFINE_SPINLOCK(client_lock); 632static DEFINE_SPINLOCK(client_lock);
641static LIST_HEAD(clients); 633static LIST_HEAD(clients);
642static char console_buf[MCONSOLE_MAX_DATA]; 634static char console_buf[MCONSOLE_MAX_DATA];
643static int console_index = 0;
644 635
645static void console_write(struct console *console, const char *string, 636static void console_write(struct console *console, const char *string,
646 unsigned len) 637 unsigned int len)
647{ 638{
648 struct list_head *ele; 639 struct list_head *ele;
649 int n; 640 int n;
650 641
651 if(list_empty(&clients)) 642 if (list_empty(&clients))
652 return; 643 return;
653 644
654 while(1){ 645 while (len > 0) {
655 n = min((size_t) len, ARRAY_SIZE(console_buf) - console_index); 646 n = min((size_t) len, ARRAY_SIZE(console_buf));
656 strncpy(&console_buf[console_index], string, n); 647 strncpy(console_buf, string, n);
657 console_index += n;
658 string += n; 648 string += n;
659 len -= n; 649 len -= n;
660 if(len == 0)
661 return;
662 650
663 list_for_each(ele, &clients){ 651 list_for_each(ele, &clients) {
664 struct mconsole_output *entry; 652 struct mconsole_output *entry;
665 653
666 entry = list_entry(ele, struct mconsole_output, list); 654 entry = list_entry(ele, struct mconsole_output, list);
667 mconsole_reply_len(entry->req, console_buf, 655 mconsole_reply_len(entry->req, console_buf, n, 0, 1);
668 console_index, 0, 1);
669 } 656 }
670
671 console_index = 0;
672 } 657 }
673} 658}
674 659
@@ -698,8 +683,7 @@ static void with_console(struct mc_request *req, void (*proc)(void *),
698 683
699 (*proc)(arg); 684 (*proc)(arg);
700 685
701 mconsole_reply_len(req, console_buf, console_index, 0, 0); 686 mconsole_reply_len(req, "", 0, 0, 0);
702 console_index = 0;
703 687
704 spin_lock_irqsave(&client_lock, flags); 688 spin_lock_irqsave(&client_lock, flags);
705 list_del(&entry.list); 689 list_del(&entry.list);
@@ -707,6 +691,9 @@ static void with_console(struct mc_request *req, void (*proc)(void *),
707} 691}
708 692
709#ifdef CONFIG_MAGIC_SYSRQ 693#ifdef CONFIG_MAGIC_SYSRQ
694
695#include <linux/sysrq.h>
696
710static void sysrq_proc(void *arg) 697static void sysrq_proc(void *arg)
711{ 698{
712 char *op = arg; 699 char *op = arg;
@@ -718,12 +705,13 @@ void mconsole_sysrq(struct mc_request *req)
718 char *ptr = req->request.data; 705 char *ptr = req->request.data;
719 706
720 ptr += strlen("sysrq"); 707 ptr += strlen("sysrq");
721 while(isspace(*ptr)) ptr++; 708 while (isspace(*ptr)) ptr++;
722 709
723 /* With 'b', the system will shut down without a chance to reply, 710 /*
711 * With 'b', the system will shut down without a chance to reply,
724 * so in this case, we reply first. 712 * so in this case, we reply first.
725 */ 713 */
726 if(*ptr == 'b') 714 if (*ptr == 'b')
727 mconsole_reply(req, "", 0, 0); 715 mconsole_reply(req, "", 0, 0);
728 716
729 with_console(req, sysrq_proc, ptr); 717 with_console(req, sysrq_proc, ptr);
@@ -735,8 +723,6 @@ void mconsole_sysrq(struct mc_request *req)
735} 723}
736#endif 724#endif
737 725
738#ifdef CONFIG_MODE_SKAS
739
740static void stack_proc(void *arg) 726static void stack_proc(void *arg)
741{ 727{
742 struct task_struct *from = current, *to = arg; 728 struct task_struct *from = current, *to = arg;
@@ -745,29 +731,34 @@ static void stack_proc(void *arg)
745 switch_to(from, to, from); 731 switch_to(from, to, from);
746} 732}
747 733
748/* Mconsole stack trace 734/*
735 * Mconsole stack trace
749 * Added by Allan Graves, Jeff Dike 736 * Added by Allan Graves, Jeff Dike
750 * Dumps a stacks registers to the linux console. 737 * Dumps a stacks registers to the linux console.
751 * Usage stack <pid>. 738 * Usage stack <pid>.
752 */ 739 */
753static void do_stack_trace(struct mc_request *req) 740void mconsole_stack(struct mc_request *req)
754{ 741{
755 char *ptr = req->request.data; 742 char *ptr = req->request.data;
756 int pid_requested= -1; 743 int pid_requested= -1;
757 struct task_struct *from = NULL; 744 struct task_struct *from = NULL;
758 struct task_struct *to = NULL; 745 struct task_struct *to = NULL;
759 746
760 /* Would be nice: 747 /*
748 * Would be nice:
761 * 1) Send showregs output to mconsole. 749 * 1) Send showregs output to mconsole.
762 * 2) Add a way to stack dump all pids. 750 * 2) Add a way to stack dump all pids.
763 */ 751 */
764 752
765 ptr += strlen("stack"); 753 ptr += strlen("stack");
766 while(isspace(*ptr)) ptr++; 754 while (isspace(*ptr))
755 ptr++;
767 756
768 /* Should really check for multiple pids or reject bad args here */ 757 /*
758 * Should really check for multiple pids or reject bad args here
759 */
769 /* What do the arguments in mconsole_reply mean? */ 760 /* What do the arguments in mconsole_reply mean? */
770 if(sscanf(ptr, "%d", &pid_requested) == 0){ 761 if (sscanf(ptr, "%d", &pid_requested) == 0) {
771 mconsole_reply(req, "Please specify a pid", 1, 0); 762 mconsole_reply(req, "Please specify a pid", 1, 0);
772 return; 763 return;
773 } 764 }
@@ -775,25 +766,15 @@ static void do_stack_trace(struct mc_request *req)
775 from = current; 766 from = current;
776 767
777 to = find_task_by_pid(pid_requested); 768 to = find_task_by_pid(pid_requested);
778 if((to == NULL) || (pid_requested == 0)) { 769 if ((to == NULL) || (pid_requested == 0)) {
779 mconsole_reply(req, "Couldn't find that pid", 1, 0); 770 mconsole_reply(req, "Couldn't find that pid", 1, 0);
780 return; 771 return;
781 } 772 }
782 with_console(req, stack_proc, to); 773 with_console(req, stack_proc, to);
783} 774}
784#endif /* CONFIG_MODE_SKAS */
785 775
786void mconsole_stack(struct mc_request *req) 776/*
787{ 777 * Changed by mconsole_setup, which is __setup, and called before SMP is
788 /* This command doesn't work in TT mode, so let's check and then
789 * get out of here
790 */
791 CHOOSE_MODE(mconsole_reply(req, "Sorry, this doesn't work in TT mode",
792 1, 0),
793 do_stack_trace(req));
794}
795
796/* Changed by mconsole_setup, which is __setup, and called before SMP is
797 * active. 778 * active.
798 */ 779 */
799static char *notify_socket = NULL; 780static char *notify_socket = NULL;
@@ -805,13 +786,14 @@ static int __init mconsole_init(void)
805 int err; 786 int err;
806 char file[256]; 787 char file[256];
807 788
808 if(umid_file_name("mconsole", file, sizeof(file))) return(-1); 789 if (umid_file_name("mconsole", file, sizeof(file)))
790 return -1;
809 snprintf(mconsole_socket_name, sizeof(file), "%s", file); 791 snprintf(mconsole_socket_name, sizeof(file), "%s", file);
810 792
811 sock = os_create_unix_socket(file, sizeof(file), 1); 793 sock = os_create_unix_socket(file, sizeof(file), 1);
812 if (sock < 0){ 794 if (sock < 0) {
813 printk("Failed to initialize management console\n"); 795 printk(KERN_ERR "Failed to initialize management console\n");
814 return(1); 796 return 1;
815 } 797 }
816 798
817 register_reboot_notifier(&reboot_notifier); 799 register_reboot_notifier(&reboot_notifier);
@@ -819,14 +801,14 @@ static int __init mconsole_init(void)
819 err = um_request_irq(MCONSOLE_IRQ, sock, IRQ_READ, mconsole_interrupt, 801 err = um_request_irq(MCONSOLE_IRQ, sock, IRQ_READ, mconsole_interrupt,
820 IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM, 802 IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM,
821 "mconsole", (void *)sock); 803 "mconsole", (void *)sock);
822 if (err){ 804 if (err) {
823 printk("Failed to get IRQ for management console\n"); 805 printk(KERN_ERR "Failed to get IRQ for management console\n");
824 return(1); 806 return 1;
825 } 807 }
826 808
827 if(notify_socket != NULL){ 809 if (notify_socket != NULL) {
828 notify_socket = kstrdup(notify_socket, GFP_KERNEL); 810 notify_socket = kstrdup(notify_socket, GFP_KERNEL);
829 if(notify_socket != NULL) 811 if (notify_socket != NULL)
830 mconsole_notify(notify_socket, MCONSOLE_SOCKET, 812 mconsole_notify(notify_socket, MCONSOLE_SOCKET,
831 mconsole_socket_name, 813 mconsole_socket_name,
832 strlen(mconsole_socket_name) + 1); 814 strlen(mconsole_socket_name) + 1);
@@ -834,9 +816,9 @@ static int __init mconsole_init(void)
834 "string\n"); 816 "string\n");
835 } 817 }
836 818
837 printk("mconsole (version %d) initialized on %s\n", 819 printk(KERN_INFO "mconsole (version %d) initialized on %s\n",
838 MCONSOLE_VERSION, mconsole_socket_name); 820 MCONSOLE_VERSION, mconsole_socket_name);
839 return(0); 821 return 0;
840} 822}
841 823
842__initcall(mconsole_init); 824__initcall(mconsole_init);
@@ -847,10 +829,10 @@ static int write_proc_mconsole(struct file *file, const char __user *buffer,
847 char *buf; 829 char *buf;
848 830
849 buf = kmalloc(count + 1, GFP_KERNEL); 831 buf = kmalloc(count + 1, GFP_KERNEL);
850 if(buf == NULL) 832 if (buf == NULL)
851 return(-ENOMEM); 833 return -ENOMEM;
852 834
853 if(copy_from_user(buf, buffer, count)){ 835 if (copy_from_user(buf, buffer, count)) {
854 count = -EFAULT; 836 count = -EFAULT;
855 goto out; 837 goto out;
856 } 838 }
@@ -860,24 +842,26 @@ static int write_proc_mconsole(struct file *file, const char __user *buffer,
860 mconsole_notify(notify_socket, MCONSOLE_USER_NOTIFY, buf, count); 842 mconsole_notify(notify_socket, MCONSOLE_USER_NOTIFY, buf, count);
861 out: 843 out:
862 kfree(buf); 844 kfree(buf);
863 return(count); 845 return count;
864} 846}
865 847
866static int create_proc_mconsole(void) 848static int create_proc_mconsole(void)
867{ 849{
868 struct proc_dir_entry *ent; 850 struct proc_dir_entry *ent;
869 851
870 if(notify_socket == NULL) return(0); 852 if (notify_socket == NULL)
853 return 0;
871 854
872 ent = create_proc_entry("mconsole", S_IFREG | 0200, NULL); 855 ent = create_proc_entry("mconsole", S_IFREG | 0200, NULL);
873 if(ent == NULL){ 856 if (ent == NULL) {
874 printk(KERN_INFO "create_proc_mconsole : create_proc_entry failed\n"); 857 printk(KERN_INFO "create_proc_mconsole : create_proc_entry "
875 return(0); 858 "failed\n");
859 return 0;
876 } 860 }
877 861
878 ent->read_proc = NULL; 862 ent->read_proc = NULL;
879 ent->write_proc = write_proc_mconsole; 863 ent->write_proc = write_proc_mconsole;
880 return(0); 864 return 0;
881} 865}
882 866
883static DEFINE_SPINLOCK(notify_spinlock); 867static DEFINE_SPINLOCK(notify_spinlock);
@@ -894,19 +878,19 @@ void unlock_notify(void)
894 878
895__initcall(create_proc_mconsole); 879__initcall(create_proc_mconsole);
896 880
897#define NOTIFY "=notify:" 881#define NOTIFY "notify:"
898 882
899static int mconsole_setup(char *str) 883static int mconsole_setup(char *str)
900{ 884{
901 if(!strncmp(str, NOTIFY, strlen(NOTIFY))){ 885 if (!strncmp(str, NOTIFY, strlen(NOTIFY))) {
902 str += strlen(NOTIFY); 886 str += strlen(NOTIFY);
903 notify_socket = str; 887 notify_socket = str;
904 } 888 }
905 else printk(KERN_ERR "mconsole_setup : Unknown option - '%s'\n", str); 889 else printk(KERN_ERR "mconsole_setup : Unknown option - '%s'\n", str);
906 return(1); 890 return 1;
907} 891}
908 892
909__setup("mconsole", mconsole_setup); 893__setup("mconsole=", mconsole_setup);
910 894
911__uml_help(mconsole_setup, 895__uml_help(mconsole_setup,
912"mconsole=notify:<socket>\n" 896"mconsole=notify:<socket>\n"
@@ -921,11 +905,12 @@ static int notify_panic(struct notifier_block *self, unsigned long unused1,
921{ 905{
922 char *message = ptr; 906 char *message = ptr;
923 907
924 if(notify_socket == NULL) return(0); 908 if (notify_socket == NULL)
909 return 0;
925 910
926 mconsole_notify(notify_socket, MCONSOLE_PANIC, message, 911 mconsole_notify(notify_socket, MCONSOLE_PANIC, message,
927 strlen(message) + 1); 912 strlen(message) + 1);
928 return(0); 913 return 0;
929} 914}
930 915
931static struct notifier_block panic_exit_notifier = { 916static struct notifier_block panic_exit_notifier = {
@@ -938,14 +923,14 @@ static int add_notifier(void)
938{ 923{
939 atomic_notifier_chain_register(&panic_notifier_list, 924 atomic_notifier_chain_register(&panic_notifier_list,
940 &panic_exit_notifier); 925 &panic_exit_notifier);
941 return(0); 926 return 0;
942} 927}
943 928
944__initcall(add_notifier); 929__initcall(add_notifier);
945 930
946char *mconsole_notify_socket(void) 931char *mconsole_notify_socket(void)
947{ 932{
948 return(notify_socket); 933 return notify_socket;
949} 934}
950 935
951EXPORT_SYMBOL(mconsole_notify_socket); 936EXPORT_SYMBOL(mconsole_notify_socket);
diff --git a/arch/um/drivers/mconsole_user.c b/arch/um/drivers/mconsole_user.c
index f31e71546e52..430c024a19b0 100644
--- a/arch/um/drivers/mconsole_user.c
+++ b/arch/um/drivers/mconsole_user.c
@@ -1,25 +1,22 @@
1/* 1/*
2 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) 2 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org)
3 * Copyright (C) 2001 - 2003 Jeff Dike (jdike@addtoit.com) 3 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 * Licensed under the GPL 4 * Licensed under the GPL
5 */ 5 */
6 6
7#include <stdio.h>
8#include <stdlib.h>
9#include <errno.h> 7#include <errno.h>
10#include <signal.h> 8#include <string.h>
9#include <unistd.h>
11#include <sys/socket.h> 10#include <sys/socket.h>
12#include <sys/types.h>
13#include <sys/uio.h> 11#include <sys/uio.h>
14#include <sys/un.h> 12#include <sys/un.h>
15#include <unistd.h> 13#include "kern_constants.h"
16#include "user.h"
17#include "sysdep/ptrace.h"
18#include "mconsole.h" 14#include "mconsole.h"
19#include "os.h" 15#include "user.h"
20 16
21static struct mconsole_command commands[] = { 17static struct mconsole_command commands[] = {
22 /* With uts namespaces, uts information becomes process-specific, so 18 /*
19 * With uts namespaces, uts information becomes process-specific, so
23 * we need a process context. If we try handling this in interrupt 20 * we need a process context. If we try handling this in interrupt
24 * context, we may hit an exiting process without a valid uts 21 * context, we may hit an exiting process without a valid uts
25 * namespace. 22 * namespace.
@@ -36,7 +33,7 @@ static struct mconsole_command commands[] = {
36 { "go", mconsole_go, MCONSOLE_INTR }, 33 { "go", mconsole_go, MCONSOLE_INTR },
37 { "log", mconsole_log, MCONSOLE_INTR }, 34 { "log", mconsole_log, MCONSOLE_INTR },
38 { "proc", mconsole_proc, MCONSOLE_PROC }, 35 { "proc", mconsole_proc, MCONSOLE_PROC },
39 { "stack", mconsole_stack, MCONSOLE_INTR }, 36 { "stack", mconsole_stack, MCONSOLE_INTR },
40}; 37};
41 38
42/* Initialized in mconsole_init, which is an initcall */ 39/* Initialized in mconsole_init, which is an initcall */
@@ -44,21 +41,21 @@ char mconsole_socket_name[256];
44 41
45int mconsole_reply_v0(struct mc_request *req, char *reply) 42int mconsole_reply_v0(struct mc_request *req, char *reply)
46{ 43{
47 struct iovec iov; 44 struct iovec iov;
48 struct msghdr msg; 45 struct msghdr msg;
49 46
50 iov.iov_base = reply; 47 iov.iov_base = reply;
51 iov.iov_len = strlen(reply); 48 iov.iov_len = strlen(reply);
52 49
53 msg.msg_name = &(req->origin); 50 msg.msg_name = &(req->origin);
54 msg.msg_namelen = req->originlen; 51 msg.msg_namelen = req->originlen;
55 msg.msg_iov = &iov; 52 msg.msg_iov = &iov;
56 msg.msg_iovlen = 1; 53 msg.msg_iovlen = 1;
57 msg.msg_control = NULL; 54 msg.msg_control = NULL;
58 msg.msg_controllen = 0; 55 msg.msg_controllen = 0;
59 msg.msg_flags = 0; 56 msg.msg_flags = 0;
60 57
61 return sendmsg(req->originating_fd, &msg, 0); 58 return sendmsg(req->originating_fd, &msg, 0);
62} 59}
63 60
64static struct mconsole_command *mconsole_parse(struct mc_request *req) 61static struct mconsole_command *mconsole_parse(struct mc_request *req)
@@ -66,10 +63,10 @@ static struct mconsole_command *mconsole_parse(struct mc_request *req)
66 struct mconsole_command *cmd; 63 struct mconsole_command *cmd;
67 int i; 64 int i;
68 65
69 for(i = 0; i < ARRAY_SIZE(commands); i++){ 66 for (i = 0; i < ARRAY_SIZE(commands); i++) {
70 cmd = &commands[i]; 67 cmd = &commands[i];
71 if(!strncmp(req->request.data, cmd->command, 68 if (!strncmp(req->request.data, cmd->command,
72 strlen(cmd->command))){ 69 strlen(cmd->command))) {
73 return cmd; 70 return cmd;
74 } 71 }
75 } 72 }
@@ -94,9 +91,9 @@ int mconsole_get_request(int fd, struct mc_request *req)
94 91
95 req->originating_fd = fd; 92 req->originating_fd = fd;
96 93
97 if(req->request.magic != MCONSOLE_MAGIC){ 94 if (req->request.magic != MCONSOLE_MAGIC) {
98 /* Unversioned request */ 95 /* Unversioned request */
99 len = MIN(sizeof(req->request.data) - 1, 96 len = MIN(sizeof(req->request.data) - 1,
100 strlen((char *) &req->request)); 97 strlen((char *) &req->request));
101 memmove(req->request.data, &req->request, len); 98 memmove(req->request.data, &req->request, len);
102 req->request.data[len] = '\0'; 99 req->request.data[len] = '\0';
@@ -107,32 +104,33 @@ int mconsole_get_request(int fd, struct mc_request *req)
107 104
108 mconsole_reply_v0(req, "ERR Version 0 mconsole clients are " 105 mconsole_reply_v0(req, "ERR Version 0 mconsole clients are "
109 "not supported by this driver"); 106 "not supported by this driver");
110 return(0); 107 return 0;
111 } 108 }
112 109
113 if(req->request.len >= MCONSOLE_MAX_DATA){ 110 if (req->request.len >= MCONSOLE_MAX_DATA) {
114 mconsole_reply(req, "Request too large", 1, 0); 111 mconsole_reply(req, "Request too large", 1, 0);
115 return(0); 112 return 0;
116 } 113 }
117 if(req->request.version != MCONSOLE_VERSION){ 114 if (req->request.version != MCONSOLE_VERSION) {
118 mconsole_reply(req, "This driver only supports version " 115 mconsole_reply(req, "This driver only supports version "
119 STRING(MCONSOLE_VERSION) " clients", 1, 0); 116 STRING(MCONSOLE_VERSION) " clients", 1, 0);
120 } 117 }
121 118
122 req->request.data[req->request.len] = '\0'; 119 req->request.data[req->request.len] = '\0';
123 req->cmd = mconsole_parse(req); 120 req->cmd = mconsole_parse(req);
124 if(req->cmd == NULL){ 121 if (req->cmd == NULL) {
125 mconsole_reply(req, "Unknown command", 1, 0); 122 mconsole_reply(req, "Unknown command", 1, 0);
126 return(0); 123 return 0;
127 } 124 }
128 125
129 return(1); 126 return 1;
130} 127}
131 128
132int mconsole_reply_len(struct mc_request *req, const char *str, int total, 129int mconsole_reply_len(struct mc_request *req, const char *str, int total,
133 int err, int more) 130 int err, int more)
134{ 131{
135 /* XXX This is a stack consumption problem. It'd be nice to 132 /*
133 * XXX This is a stack consumption problem. It'd be nice to
136 * make it global and serialize access to it, but there are a 134 * make it global and serialize access to it, but there are a
137 * ton of callers to this function. 135 * ton of callers to this function.
138 */ 136 */
@@ -147,7 +145,7 @@ int mconsole_reply_len(struct mc_request *req, const char *str, int total,
147 145
148 len = MIN(total, MCONSOLE_MAX_DATA - 1); 146 len = MIN(total, MCONSOLE_MAX_DATA - 1);
149 147
150 if(len == total) reply.more = more; 148 if (len == total) reply.more = more;
151 else reply.more = 1; 149 else reply.more = 1;
152 150
153 memcpy(reply.data, str, len); 151 memcpy(reply.data, str, len);
@@ -161,9 +159,10 @@ int mconsole_reply_len(struct mc_request *req, const char *str, int total,
161 n = sendto(req->originating_fd, &reply, len, 0, 159 n = sendto(req->originating_fd, &reply, len, 0,
162 (struct sockaddr *) req->origin, req->originlen); 160 (struct sockaddr *) req->origin, req->originlen);
163 161
164 if(n < 0) return(-errno); 162 if (n < 0)
165 } while(total > 0); 163 return -errno;
166 return(0); 164 } while (total > 0);
165 return 0;
167} 166}
168 167
169int mconsole_reply(struct mc_request *req, const char *str, int err, int more) 168int mconsole_reply(struct mc_request *req, const char *str, int err, int more)
@@ -187,18 +186,18 @@ int mconsole_notify(char *sock_name, int type, const void *data, int len)
187 int n, err = 0; 186 int n, err = 0;
188 187
189 lock_notify(); 188 lock_notify();
190 if(notify_sock < 0){ 189 if (notify_sock < 0) {
191 notify_sock = socket(PF_UNIX, SOCK_DGRAM, 0); 190 notify_sock = socket(PF_UNIX, SOCK_DGRAM, 0);
192 if(notify_sock < 0){ 191 if (notify_sock < 0) {
193 err = -errno; 192 err = -errno;
194 printk("mconsole_notify - socket failed, errno = %d\n", 193 printk(UM_KERN_ERR "mconsole_notify - socket failed, "
195 err); 194 "errno = %d\n", errno);
196 } 195 }
197 } 196 }
198 unlock_notify(); 197 unlock_notify();
199 198
200 if(err) 199 if (err)
201 return(err); 200 return err;
202 201
203 target.sun_family = AF_UNIX; 202 target.sun_family = AF_UNIX;
204 strcpy(target.sun_path, sock_name); 203 strcpy(target.sun_path, sock_name);
@@ -212,22 +211,12 @@ int mconsole_notify(char *sock_name, int type, const void *data, int len)
212 211
213 err = 0; 212 err = 0;
214 len = sizeof(packet) + packet.len - sizeof(packet.data); 213 len = sizeof(packet) + packet.len - sizeof(packet.data);
215 n = sendto(notify_sock, &packet, len, 0, (struct sockaddr *) &target, 214 n = sendto(notify_sock, &packet, len, 0, (struct sockaddr *) &target,
216 sizeof(target)); 215 sizeof(target));
217 if(n < 0){ 216 if (n < 0) {
218 err = -errno; 217 err = -errno;
219 printk("mconsole_notify - sendto failed, errno = %d\n", errno); 218 printk(UM_KERN_ERR "mconsole_notify - sendto failed, "
219 "errno = %d\n", errno);
220 } 220 }
221 return(err); 221 return err;
222} 222}
223
224/*
225 * Overrides for Emacs so that we follow Linus's tabbing style.
226 * Emacs will notice this stuff at the end of the file and automatically
227 * adjust the settings for this buffer only. This must remain at the end
228 * of the file.
229 * ---------------------------------------------------------------------------
230 * Local variables:
231 * c-file-style: "linux"
232 * End:
233 */
diff --git a/arch/um/drivers/mmapper_kern.c b/arch/um/drivers/mmapper_kern.c
index 867666a02339..67b2f55a602f 100644
--- a/arch/um/drivers/mmapper_kern.c
+++ b/arch/um/drivers/mmapper_kern.c
@@ -9,27 +9,29 @@
9 * 9 *
10 */ 10 */
11 11
12#include <linux/init.h> 12#include <linux/stddef.h>
13#include <linux/module.h> 13#include <linux/types.h>
14#include <linux/mm.h>
15#include <linux/fs.h> 14#include <linux/fs.h>
15#include <linux/init.h>
16#include <linux/miscdevice.h> 16#include <linux/miscdevice.h>
17#include <linux/module.h>
18#include <linux/mm.h>
17#include <asm/uaccess.h> 19#include <asm/uaccess.h>
18#include "mem_user.h" 20#include "mem_user.h"
19 21
20/* These are set in mmapper_init, which is called at boot time */ 22/* These are set in mmapper_init, which is called at boot time */
21static unsigned long mmapper_size; 23static unsigned long mmapper_size;
22static unsigned long p_buf = 0; 24static unsigned long p_buf;
23static char *v_buf = NULL; 25static char *v_buf;
24 26
25static ssize_t 27static ssize_t mmapper_read(struct file *file, char __user *buf, size_t count,
26mmapper_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) 28 loff_t *ppos)
27{ 29{
28 return simple_read_from_buffer(buf, count, ppos, v_buf, mmapper_size); 30 return simple_read_from_buffer(buf, count, ppos, v_buf, mmapper_size);
29} 31}
30 32
31static ssize_t 33static ssize_t mmapper_write(struct file *file, const char __user *buf,
32mmapper_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) 34 size_t count, loff_t *ppos)
33{ 35{
34 if (*ppos > mmapper_size) 36 if (*ppos > mmapper_size)
35 return -EINVAL; 37 return -EINVAL;
@@ -39,48 +41,46 @@ mmapper_write(struct file *file, const char __user *buf, size_t count, loff_t *p
39 41
40 if (copy_from_user(&v_buf[*ppos], buf, count)) 42 if (copy_from_user(&v_buf[*ppos], buf, count))
41 return -EFAULT; 43 return -EFAULT;
42 44
43 return count; 45 return count;
44} 46}
45 47
46static int 48static int mmapper_ioctl(struct inode *inode, struct file *file,
47mmapper_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 49 unsigned int cmd, unsigned long arg)
48 unsigned long arg)
49{ 50{
50 return(-ENOIOCTLCMD); 51 return -ENOIOCTLCMD;
51} 52}
52 53
53static int 54static int mmapper_mmap(struct file *file, struct vm_area_struct *vma)
54mmapper_mmap(struct file *file, struct vm_area_struct * vma)
55{ 55{
56 int ret = -EINVAL; 56 int ret = -EINVAL;
57 int size; 57 int size;
58 58
59 if (vma->vm_pgoff != 0) 59 if (vma->vm_pgoff != 0)
60 goto out; 60 goto out;
61 61
62 size = vma->vm_end - vma->vm_start; 62 size = vma->vm_end - vma->vm_start;
63 if(size > mmapper_size) return(-EFAULT); 63 if (size > mmapper_size)
64 return -EFAULT;
64 65
65 /* XXX A comment above remap_pfn_range says it should only be 66 /*
67 * XXX A comment above remap_pfn_range says it should only be
66 * called when the mm semaphore is held 68 * called when the mm semaphore is held
67 */ 69 */
68 if (remap_pfn_range(vma, vma->vm_start, p_buf >> PAGE_SHIFT, size, 70 if (remap_pfn_range(vma, vma->vm_start, p_buf >> PAGE_SHIFT, size,
69 vma->vm_page_prot)) 71 vma->vm_page_prot))
70 goto out; 72 goto out;
71 ret = 0; 73 ret = 0;
72out: 74out:
73 return ret; 75 return ret;
74} 76}
75 77
76static int 78static int mmapper_open(struct inode *inode, struct file *file)
77mmapper_open(struct inode *inode, struct file *file)
78{ 79{
79 return 0; 80 return 0;
80} 81}
81 82
82static int 83static int mmapper_release(struct inode *inode, struct file *file)
83mmapper_release(struct inode *inode, struct file *file)
84{ 84{
85 return 0; 85 return 0;
86} 86}
@@ -95,7 +95,9 @@ static const struct file_operations mmapper_fops = {
95 .release = mmapper_release, 95 .release = mmapper_release,
96}; 96};
97 97
98/* No locking needed - only used (and modified) by below initcall and exitcall. */ 98/*
99 * No locking needed - only used (and modified) by below initcall and exitcall.
100 */
99static struct miscdevice mmapper_dev = { 101static struct miscdevice mmapper_dev = {
100 .minor = MISC_DYNAMIC_MINOR, 102 .minor = MISC_DYNAMIC_MINOR,
101 .name = "mmapper", 103 .name = "mmapper",
@@ -109,13 +111,13 @@ static int __init mmapper_init(void)
109 printk(KERN_INFO "Mapper v0.1\n"); 111 printk(KERN_INFO "Mapper v0.1\n");
110 112
111 v_buf = (char *) find_iomem("mmapper", &mmapper_size); 113 v_buf = (char *) find_iomem("mmapper", &mmapper_size);
112 if(mmapper_size == 0){ 114 if (mmapper_size == 0) {
113 printk(KERN_ERR "mmapper_init - find_iomem failed\n"); 115 printk(KERN_ERR "mmapper_init - find_iomem failed\n");
114 goto out; 116 goto out;
115 } 117 }
116 118
117 err = misc_register(&mmapper_dev); 119 err = misc_register(&mmapper_dev);
118 if(err){ 120 if (err) {
119 printk(KERN_ERR "mmapper - misc_register failed, err = %d\n", 121 printk(KERN_ERR "mmapper - misc_register failed, err = %d\n",
120 err); 122 err);
121 goto out; 123 goto out;
@@ -136,9 +138,3 @@ module_exit(mmapper_exit);
136 138
137MODULE_AUTHOR("Greg Lonnon <glonnon@ridgerun.com>"); 139MODULE_AUTHOR("Greg Lonnon <glonnon@ridgerun.com>");
138MODULE_DESCRIPTION("DSPLinux simulator mmapper driver"); 140MODULE_DESCRIPTION("DSPLinux simulator mmapper driver");
139/*
140 * ---------------------------------------------------------------------------
141 * Local variables:
142 * c-file-style: "linux"
143 * End:
144 */
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index d35d0c1ee7f4..8c01fa81a1ae 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -1,33 +1,28 @@
1/* 1/*
2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
2 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and 3 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and
3 * James Leu (jleu@mindspring.net). 4 * James Leu (jleu@mindspring.net).
4 * Copyright (C) 2001 by various other people who didn't put their name here. 5 * Copyright (C) 2001 by various other people who didn't put their name here.
5 * Licensed under the GPL. 6 * Licensed under the GPL.
6 */ 7 */
7 8
8#include "linux/kernel.h" 9#include <linux/bootmem.h>
9#include "linux/netdevice.h" 10#include <linux/etherdevice.h>
10#include "linux/rtnetlink.h" 11#include <linux/ethtool.h>
11#include "linux/skbuff.h" 12#include <linux/inetdevice.h>
12#include "linux/socket.h" 13#include <linux/init.h>
13#include "linux/spinlock.h" 14#include <linux/list.h>
14#include "linux/module.h" 15#include <linux/netdevice.h>
15#include "linux/init.h" 16#include <linux/platform_device.h>
16#include "linux/etherdevice.h" 17#include <linux/rtnetlink.h>
17#include "linux/list.h" 18#include <linux/skbuff.h>
18#include "linux/inetdevice.h" 19#include <linux/spinlock.h>
19#include "linux/ctype.h"
20#include "linux/bootmem.h"
21#include "linux/ethtool.h"
22#include "linux/platform_device.h"
23#include "asm/uaccess.h"
24#include "kern_util.h"
25#include "net_kern.h"
26#include "net_user.h"
27#include "mconsole_kern.h"
28#include "init.h" 20#include "init.h"
29#include "irq_user.h"
30#include "irq_kern.h" 21#include "irq_kern.h"
22#include "irq_user.h"
23#include "mconsole_kern.h"
24#include "net_kern.h"
25#include "net_user.h"
31 26
32static inline void set_ether_mac(struct net_device *dev, unsigned char *addr) 27static inline void set_ether_mac(struct net_device *dev, unsigned char *addr)
33{ 28{
@@ -39,6 +34,46 @@ static inline void set_ether_mac(struct net_device *dev, unsigned char *addr)
39static DEFINE_SPINLOCK(opened_lock); 34static DEFINE_SPINLOCK(opened_lock);
40static LIST_HEAD(opened); 35static LIST_HEAD(opened);
41 36
37/*
38 * The drop_skb is used when we can't allocate an skb. The
39 * packet is read into drop_skb in order to get the data off the
40 * connection to the host.
41 * It is reallocated whenever a maximum packet size is seen which is
42 * larger than any seen before. update_drop_skb is called from
43 * eth_configure when a new interface is added.
44 */
45static DEFINE_SPINLOCK(drop_lock);
46static struct sk_buff *drop_skb;
47static int drop_max;
48
49static int update_drop_skb(int max)
50{
51 struct sk_buff *new;
52 unsigned long flags;
53 int err = 0;
54
55 spin_lock_irqsave(&drop_lock, flags);
56
57 if (max <= drop_max)
58 goto out;
59
60 err = -ENOMEM;
61 new = dev_alloc_skb(max);
62 if (new == NULL)
63 goto out;
64
65 skb_put(new, max);
66
67 kfree_skb(drop_skb);
68 drop_skb = new;
69 drop_max = max;
70 err = 0;
71out:
72 spin_unlock_irqrestore(&drop_lock, flags);
73
74 return err;
75}
76
42static int uml_net_rx(struct net_device *dev) 77static int uml_net_rx(struct net_device *dev)
43{ 78{
44 struct uml_net_private *lp = dev->priv; 79 struct uml_net_private *lp = dev->priv;
@@ -46,16 +81,19 @@ static int uml_net_rx(struct net_device *dev)
46 struct sk_buff *skb; 81 struct sk_buff *skb;
47 82
48 /* If we can't allocate memory, try again next round. */ 83 /* If we can't allocate memory, try again next round. */
49 skb = dev_alloc_skb(dev->mtu); 84 skb = dev_alloc_skb(lp->max_packet);
50 if (skb == NULL) { 85 if (skb == NULL) {
86 drop_skb->dev = dev;
87 /* Read a packet into drop_skb and don't do anything with it. */
88 (*lp->read)(lp->fd, drop_skb, lp);
51 lp->stats.rx_dropped++; 89 lp->stats.rx_dropped++;
52 return 0; 90 return 0;
53 } 91 }
54 92
55 skb->dev = dev; 93 skb->dev = dev;
56 skb_put(skb, dev->mtu); 94 skb_put(skb, lp->max_packet);
57 skb_reset_mac_header(skb); 95 skb_reset_mac_header(skb);
58 pkt_len = (*lp->read)(lp->fd, &skb, lp); 96 pkt_len = (*lp->read)(lp->fd, skb, lp);
59 97
60 if (pkt_len > 0) { 98 if (pkt_len > 0) {
61 skb_trim(skb, pkt_len); 99 skb_trim(skb, pkt_len);
@@ -84,12 +122,12 @@ irqreturn_t uml_net_interrupt(int irq, void *dev_id)
84 struct uml_net_private *lp = dev->priv; 122 struct uml_net_private *lp = dev->priv;
85 int err; 123 int err;
86 124
87 if(!netif_running(dev)) 125 if (!netif_running(dev))
88 return(IRQ_NONE); 126 return IRQ_NONE;
89 127
90 spin_lock(&lp->lock); 128 spin_lock(&lp->lock);
91 while((err = uml_net_rx(dev)) > 0) ; 129 while ((err = uml_net_rx(dev)) > 0) ;
92 if(err < 0) { 130 if (err < 0) {
93 printk(KERN_ERR 131 printk(KERN_ERR
94 "Device '%s' read returned %d, shutting it down\n", 132 "Device '%s' read returned %d, shutting it down\n",
95 dev->name, err); 133 dev->name, err);
@@ -115,20 +153,20 @@ static int uml_net_open(struct net_device *dev)
115 struct uml_net_private *lp = dev->priv; 153 struct uml_net_private *lp = dev->priv;
116 int err; 154 int err;
117 155
118 if(lp->fd >= 0){ 156 if (lp->fd >= 0) {
119 err = -ENXIO; 157 err = -ENXIO;
120 goto out; 158 goto out;
121 } 159 }
122 160
123 lp->fd = (*lp->open)(&lp->user); 161 lp->fd = (*lp->open)(&lp->user);
124 if(lp->fd < 0){ 162 if (lp->fd < 0) {
125 err = lp->fd; 163 err = lp->fd;
126 goto out; 164 goto out;
127 } 165 }
128 166
129 err = um_request_irq(dev->irq, lp->fd, IRQ_READ, uml_net_interrupt, 167 err = um_request_irq(dev->irq, lp->fd, IRQ_READ, uml_net_interrupt,
130 IRQF_DISABLED | IRQF_SHARED, dev->name, dev); 168 IRQF_DISABLED | IRQF_SHARED, dev->name, dev);
131 if(err != 0){ 169 if (err != 0) {
132 printk(KERN_ERR "uml_net_open: failed to get irq(%d)\n", err); 170 printk(KERN_ERR "uml_net_open: failed to get irq(%d)\n", err);
133 err = -ENETUNREACH; 171 err = -ENETUNREACH;
134 goto out_close; 172 goto out_close;
@@ -141,7 +179,7 @@ static int uml_net_open(struct net_device *dev)
141 * is full when we get here. In this case, new data is never queued, 179 * is full when we get here. In this case, new data is never queued,
142 * SIGIOs never arrive, and the net never works. 180 * SIGIOs never arrive, and the net never works.
143 */ 181 */
144 while((err = uml_net_rx(dev)) > 0) ; 182 while ((err = uml_net_rx(dev)) > 0) ;
145 183
146 spin_lock(&opened_lock); 184 spin_lock(&opened_lock);
147 list_add(&lp->list, &opened); 185 list_add(&lp->list, &opened);
@@ -149,7 +187,7 @@ static int uml_net_open(struct net_device *dev)
149 187
150 return 0; 188 return 0;
151out_close: 189out_close:
152 if(lp->close != NULL) (*lp->close)(lp->fd, &lp->user); 190 if (lp->close != NULL) (*lp->close)(lp->fd, &lp->user);
153 lp->fd = -1; 191 lp->fd = -1;
154out: 192out:
155 return err; 193 return err;
@@ -162,7 +200,7 @@ static int uml_net_close(struct net_device *dev)
162 netif_stop_queue(dev); 200 netif_stop_queue(dev);
163 201
164 free_irq(dev->irq, dev); 202 free_irq(dev->irq, dev);
165 if(lp->close != NULL) 203 if (lp->close != NULL)
166 (*lp->close)(lp->fd, &lp->user); 204 (*lp->close)(lp->fd, &lp->user);
167 lp->fd = -1; 205 lp->fd = -1;
168 206
@@ -183,9 +221,9 @@ static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
183 221
184 spin_lock_irqsave(&lp->lock, flags); 222 spin_lock_irqsave(&lp->lock, flags);
185 223
186 len = (*lp->write)(lp->fd, &skb, lp); 224 len = (*lp->write)(lp->fd, skb, lp);
187 225
188 if(len == skb->len) { 226 if (len == skb->len) {
189 lp->stats.tx_packets++; 227 lp->stats.tx_packets++;
190 lp->stats.tx_bytes += skb->len; 228 lp->stats.tx_bytes += skb->len;
191 dev->trans_start = jiffies; 229 dev->trans_start = jiffies;
@@ -194,7 +232,7 @@ static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
194 /* this is normally done in the interrupt when tx finishes */ 232 /* this is normally done in the interrupt when tx finishes */
195 netif_wake_queue(dev); 233 netif_wake_queue(dev);
196 } 234 }
197 else if(len == 0){ 235 else if (len == 0) {
198 netif_start_queue(dev); 236 netif_start_queue(dev);
199 lp->stats.tx_dropped++; 237 lp->stats.tx_dropped++;
200 } 238 }
@@ -218,8 +256,10 @@ static struct net_device_stats *uml_net_get_stats(struct net_device *dev)
218 256
219static void uml_net_set_multicast_list(struct net_device *dev) 257static void uml_net_set_multicast_list(struct net_device *dev)
220{ 258{
221 if (dev->flags & IFF_PROMISC) return; 259 if (dev->flags & IFF_PROMISC)
222 else if (dev->mc_count) dev->flags |= IFF_ALLMULTI; 260 return;
261 else if (dev->mc_count)
262 dev->flags |= IFF_ALLMULTI;
223 else dev->flags &= ~IFF_ALLMULTI; 263 else dev->flags &= ~IFF_ALLMULTI;
224} 264}
225 265
@@ -243,22 +283,9 @@ static int uml_net_set_mac(struct net_device *dev, void *addr)
243 283
244static int uml_net_change_mtu(struct net_device *dev, int new_mtu) 284static int uml_net_change_mtu(struct net_device *dev, int new_mtu)
245{ 285{
246 struct uml_net_private *lp = dev->priv;
247 int err = 0;
248
249 spin_lock_irq(&lp->lock);
250
251 new_mtu = (*lp->set_mtu)(new_mtu, &lp->user);
252 if(new_mtu < 0){
253 err = new_mtu;
254 goto out;
255 }
256
257 dev->mtu = new_mtu; 286 dev->mtu = new_mtu;
258 287
259 out: 288 return 0;
260 spin_unlock_irq(&lp->lock);
261 return err;
262} 289}
263 290
264static void uml_net_get_drvinfo(struct net_device *dev, 291static void uml_net_get_drvinfo(struct net_device *dev,
@@ -288,13 +315,13 @@ static void setup_etheraddr(char *str, unsigned char *addr, char *name)
288 char *end; 315 char *end;
289 int i; 316 int i;
290 317
291 if(str == NULL) 318 if (str == NULL)
292 goto random; 319 goto random;
293 320
294 for(i=0;i<6;i++){ 321 for (i = 0;i < 6; i++) {
295 addr[i] = simple_strtoul(str, &end, 16); 322 addr[i] = simple_strtoul(str, &end, 16);
296 if((end == str) || 323 if ((end == str) ||
297 ((*end != ':') && (*end != ',') && (*end != '\0'))){ 324 ((*end != ':') && (*end != ',') && (*end != '\0'))) {
298 printk(KERN_ERR 325 printk(KERN_ERR
299 "setup_etheraddr: failed to parse '%s' " 326 "setup_etheraddr: failed to parse '%s' "
300 "as an ethernet address\n", str); 327 "as an ethernet address\n", str);
@@ -349,7 +376,7 @@ static void net_device_release(struct device *dev)
349 struct net_device *netdev = device->dev; 376 struct net_device *netdev = device->dev;
350 struct uml_net_private *lp = netdev->priv; 377 struct uml_net_private *lp = netdev->priv;
351 378
352 if(lp->remove != NULL) 379 if (lp->remove != NULL)
353 (*lp->remove)(&lp->user); 380 (*lp->remove)(&lp->user);
354 list_del(&device->list); 381 list_del(&device->list);
355 kfree(device); 382 kfree(device);
@@ -413,7 +440,7 @@ static void eth_configure(int n, void *init, char *mac,
413 device->pdev.name = DRIVER_NAME; 440 device->pdev.name = DRIVER_NAME;
414 device->pdev.dev.release = net_device_release; 441 device->pdev.dev.release = net_device_release;
415 device->pdev.dev.driver_data = device; 442 device->pdev.dev.driver_data = device;
416 if(platform_device_register(&device->pdev)) 443 if (platform_device_register(&device->pdev))
417 goto out_free_netdev; 444 goto out_free_netdev;
418 SET_NETDEV_DEV(dev,&device->pdev.dev); 445 SET_NETDEV_DEV(dev,&device->pdev.dev);
419 446
@@ -430,6 +457,7 @@ static void eth_configure(int n, void *init, char *mac,
430 .dev = dev, 457 .dev = dev,
431 .fd = -1, 458 .fd = -1,
432 .mac = { 0xfe, 0xfd, 0x0, 0x0, 0x0, 0x0}, 459 .mac = { 0xfe, 0xfd, 0x0, 0x0, 0x0, 0x0},
460 .max_packet = transport->user->max_packet,
433 .protocol = transport->kern->protocol, 461 .protocol = transport->kern->protocol,
434 .open = transport->user->open, 462 .open = transport->user->open,
435 .close = transport->user->close, 463 .close = transport->user->close,
@@ -437,8 +465,7 @@ static void eth_configure(int n, void *init, char *mac,
437 .read = transport->kern->read, 465 .read = transport->kern->read,
438 .write = transport->kern->write, 466 .write = transport->kern->write,
439 .add_address = transport->user->add_address, 467 .add_address = transport->user->add_address,
440 .delete_address = transport->user->delete_address, 468 .delete_address = transport->user->delete_address });
441 .set_mtu = transport->user->set_mtu });
442 469
443 init_timer(&lp->tl); 470 init_timer(&lp->tl);
444 spin_lock_init(&lp->lock); 471 spin_lock_init(&lp->lock);
@@ -450,7 +477,7 @@ static void eth_configure(int n, void *init, char *mac,
450 goto out_unregister; 477 goto out_unregister;
451 478
452 set_ether_mac(dev, device->mac); 479 set_ether_mac(dev, device->mac);
453 dev->mtu = transport->user->max_packet; 480 dev->mtu = transport->user->mtu;
454 dev->open = uml_net_open; 481 dev->open = uml_net_open;
455 dev->hard_start_xmit = uml_net_start_xmit; 482 dev->hard_start_xmit = uml_net_start_xmit;
456 dev->stop = uml_net_close; 483 dev->stop = uml_net_close;
@@ -463,6 +490,10 @@ static void eth_configure(int n, void *init, char *mac,
463 dev->watchdog_timeo = (HZ >> 1); 490 dev->watchdog_timeo = (HZ >> 1);
464 dev->irq = UM_ETH_IRQ; 491 dev->irq = UM_ETH_IRQ;
465 492
493 err = update_drop_skb(lp->max_packet);
494 if (err)
495 goto out_undo_user_init;
496
466 rtnl_lock(); 497 rtnl_lock();
467 err = register_netdevice(dev); 498 err = register_netdevice(dev);
468 rtnl_unlock(); 499 rtnl_unlock();
@@ -493,9 +524,9 @@ static struct uml_net *find_device(int n)
493 struct list_head *ele; 524 struct list_head *ele;
494 525
495 spin_lock(&devices_lock); 526 spin_lock(&devices_lock);
496 list_for_each(ele, &devices){ 527 list_for_each(ele, &devices) {
497 device = list_entry(ele, struct uml_net, list); 528 device = list_entry(ele, struct uml_net, list);
498 if(device->index == n) 529 if (device->index == n)
499 goto out; 530 goto out;
500 } 531 }
501 device = NULL; 532 device = NULL;
@@ -511,19 +542,19 @@ static int eth_parse(char *str, int *index_out, char **str_out,
511 int n, err = -EINVAL;; 542 int n, err = -EINVAL;;
512 543
513 n = simple_strtoul(str, &end, 0); 544 n = simple_strtoul(str, &end, 0);
514 if(end == str){ 545 if (end == str) {
515 *error_out = "Bad device number"; 546 *error_out = "Bad device number";
516 return err; 547 return err;
517 } 548 }
518 549
519 str = end; 550 str = end;
520 if(*str != '='){ 551 if (*str != '=') {
521 *error_out = "Expected '=' after device number"; 552 *error_out = "Expected '=' after device number";
522 return err; 553 return err;
523 } 554 }
524 555
525 str++; 556 str++;
526 if(find_device(n)){ 557 if (find_device(n)) {
527 *error_out = "Device already configured"; 558 *error_out = "Device already configured";
528 return err; 559 return err;
529 } 560 }
@@ -551,20 +582,20 @@ static int check_transport(struct transport *transport, char *eth, int n,
551 int len; 582 int len;
552 583
553 len = strlen(transport->name); 584 len = strlen(transport->name);
554 if(strncmp(eth, transport->name, len)) 585 if (strncmp(eth, transport->name, len))
555 return 0; 586 return 0;
556 587
557 eth += len; 588 eth += len;
558 if(*eth == ',') 589 if (*eth == ',')
559 eth++; 590 eth++;
560 else if(*eth != '\0') 591 else if (*eth != '\0')
561 return 0; 592 return 0;
562 593
563 *init_out = kmalloc(transport->setup_size, GFP_KERNEL); 594 *init_out = kmalloc(transport->setup_size, GFP_KERNEL);
564 if(*init_out == NULL) 595 if (*init_out == NULL)
565 return 1; 596 return 1;
566 597
567 if(!transport->setup(eth, mac_out, *init_out)){ 598 if (!transport->setup(eth, mac_out, *init_out)) {
568 kfree(*init_out); 599 kfree(*init_out);
569 *init_out = NULL; 600 *init_out = NULL;
570 } 601 }
@@ -584,13 +615,13 @@ void register_transport(struct transport *new)
584 list_add(&new->list, &transports); 615 list_add(&new->list, &transports);
585 spin_unlock(&transports_lock); 616 spin_unlock(&transports_lock);
586 617
587 list_for_each_safe(ele, next, &eth_cmd_line){ 618 list_for_each_safe(ele, next, &eth_cmd_line) {
588 eth = list_entry(ele, struct eth_init, list); 619 eth = list_entry(ele, struct eth_init, list);
589 match = check_transport(new, eth->init, eth->index, &init, 620 match = check_transport(new, eth->init, eth->index, &init,
590 &mac); 621 &mac);
591 if(!match) 622 if (!match)
592 continue; 623 continue;
593 else if(init != NULL){ 624 else if (init != NULL) {
594 eth_configure(eth->index, init, mac, new); 625 eth_configure(eth->index, init, mac, new);
595 kfree(init); 626 kfree(init);
596 } 627 }
@@ -607,11 +638,11 @@ static int eth_setup_common(char *str, int index)
607 int found = 0; 638 int found = 0;
608 639
609 spin_lock(&transports_lock); 640 spin_lock(&transports_lock);
610 list_for_each(ele, &transports){ 641 list_for_each(ele, &transports) {
611 transport = list_entry(ele, struct transport, list); 642 transport = list_entry(ele, struct transport, list);
612 if(!check_transport(transport, str, index, &init, &mac)) 643 if (!check_transport(transport, str, index, &init, &mac))
613 continue; 644 continue;
614 if(init != NULL){ 645 if (init != NULL) {
615 eth_configure(index, init, mac, transport); 646 eth_configure(index, init, mac, transport);
616 kfree(init); 647 kfree(init);
617 } 648 }
@@ -630,15 +661,15 @@ static int __init eth_setup(char *str)
630 int n, err; 661 int n, err;
631 662
632 err = eth_parse(str, &n, &str, &error); 663 err = eth_parse(str, &n, &str, &error);
633 if(err){ 664 if (err) {
634 printk(KERN_ERR "eth_setup - Couldn't parse '%s' : %s\n", 665 printk(KERN_ERR "eth_setup - Couldn't parse '%s' : %s\n",
635 str, error); 666 str, error);
636 return 1; 667 return 1;
637 } 668 }
638 669
639 new = alloc_bootmem(sizeof(*new)); 670 new = alloc_bootmem(sizeof(*new));
640 if (new == NULL){ 671 if (new == NULL) {
641 printk("eth_init : alloc_bootmem failed\n"); 672 printk(KERN_ERR "eth_init : alloc_bootmem failed\n");
642 return 1; 673 return 1;
643 } 674 }
644 675
@@ -661,36 +692,36 @@ static int net_config(char *str, char **error_out)
661 int n, err; 692 int n, err;
662 693
663 err = eth_parse(str, &n, &str, error_out); 694 err = eth_parse(str, &n, &str, error_out);
664 if(err) 695 if (err)
665 return err; 696 return err;
666 697
667 /* This string is broken up and the pieces used by the underlying 698 /* This string is broken up and the pieces used by the underlying
668 * driver. So, it is freed only if eth_setup_common fails. 699 * driver. So, it is freed only if eth_setup_common fails.
669 */ 700 */
670 str = kstrdup(str, GFP_KERNEL); 701 str = kstrdup(str, GFP_KERNEL);
671 if(str == NULL){ 702 if (str == NULL) {
672 *error_out = "net_config failed to strdup string"; 703 *error_out = "net_config failed to strdup string";
673 return -ENOMEM; 704 return -ENOMEM;
674 } 705 }
675 err = !eth_setup_common(str, n); 706 err = !eth_setup_common(str, n);
676 if(err) 707 if (err)
677 kfree(str); 708 kfree(str);
678 return(err); 709 return err;
679} 710}
680 711
681static int net_id(char **str, int *start_out, int *end_out) 712static int net_id(char **str, int *start_out, int *end_out)
682{ 713{
683 char *end; 714 char *end;
684 int n; 715 int n;
685 716
686 n = simple_strtoul(*str, &end, 0); 717 n = simple_strtoul(*str, &end, 0);
687 if((*end != '\0') || (end == *str)) 718 if ((*end != '\0') || (end == *str))
688 return -1; 719 return -1;
689 720
690 *start_out = n; 721 *start_out = n;
691 *end_out = n; 722 *end_out = n;
692 *str = end; 723 *str = end;
693 return n; 724 return n;
694} 725}
695 726
696static int net_remove(int n, char **error_out) 727static int net_remove(int n, char **error_out)
@@ -700,12 +731,12 @@ static int net_remove(int n, char **error_out)
700 struct uml_net_private *lp; 731 struct uml_net_private *lp;
701 732
702 device = find_device(n); 733 device = find_device(n);
703 if(device == NULL) 734 if (device == NULL)
704 return -ENODEV; 735 return -ENODEV;
705 736
706 dev = device->dev; 737 dev = device->dev;
707 lp = dev->priv; 738 lp = dev->priv;
708 if(lp->fd > 0) 739 if (lp->fd > 0)
709 return -EBUSY; 740 return -EBUSY;
710 unregister_netdev(dev); 741 unregister_netdev(dev);
711 platform_device_unregister(&device->pdev); 742 platform_device_unregister(&device->pdev);
@@ -731,13 +762,13 @@ static int uml_inetaddr_event(struct notifier_block *this, unsigned long event,
731 void (*proc)(unsigned char *, unsigned char *, void *); 762 void (*proc)(unsigned char *, unsigned char *, void *);
732 unsigned char addr_buf[4], netmask_buf[4]; 763 unsigned char addr_buf[4], netmask_buf[4];
733 764
734 if(dev->open != uml_net_open) 765 if (dev->open != uml_net_open)
735 return NOTIFY_DONE; 766 return NOTIFY_DONE;
736 767
737 lp = dev->priv; 768 lp = dev->priv;
738 769
739 proc = NULL; 770 proc = NULL;
740 switch (event){ 771 switch (event) {
741 case NETDEV_UP: 772 case NETDEV_UP:
742 proc = lp->add_address; 773 proc = lp->add_address;
743 break; 774 break;
@@ -745,7 +776,7 @@ static int uml_inetaddr_event(struct notifier_block *this, unsigned long event,
745 proc = lp->delete_address; 776 proc = lp->delete_address;
746 break; 777 break;
747 } 778 }
748 if(proc != NULL){ 779 if (proc != NULL) {
749 memcpy(addr_buf, &ifa->ifa_address, sizeof(addr_buf)); 780 memcpy(addr_buf, &ifa->ifa_address, sizeof(addr_buf));
750 memcpy(netmask_buf, &ifa->ifa_mask, sizeof(netmask_buf)); 781 memcpy(netmask_buf, &ifa->ifa_mask, sizeof(netmask_buf));
751 (*proc)(addr_buf, netmask_buf, &lp->user); 782 (*proc)(addr_buf, netmask_buf, &lp->user);
@@ -773,13 +804,13 @@ static int uml_net_init(void)
773 * addresses which have already been set up get handled properly. 804 * addresses which have already been set up get handled properly.
774 */ 805 */
775 spin_lock(&opened_lock); 806 spin_lock(&opened_lock);
776 list_for_each(ele, &opened){ 807 list_for_each(ele, &opened) {
777 lp = list_entry(ele, struct uml_net_private, list); 808 lp = list_entry(ele, struct uml_net_private, list);
778 ip = lp->dev->ip_ptr; 809 ip = lp->dev->ip_ptr;
779 if(ip == NULL) 810 if (ip == NULL)
780 continue; 811 continue;
781 in = ip->ifa_list; 812 in = ip->ifa_list;
782 while(in != NULL){ 813 while (in != NULL) {
783 uml_inetaddr_event(NULL, NETDEV_UP, in); 814 uml_inetaddr_event(NULL, NETDEV_UP, in);
784 in = in->ifa_next; 815 in = in->ifa_next;
785 } 816 }
@@ -797,12 +828,12 @@ static void close_devices(void)
797 struct uml_net_private *lp; 828 struct uml_net_private *lp;
798 829
799 spin_lock(&opened_lock); 830 spin_lock(&opened_lock);
800 list_for_each(ele, &opened){ 831 list_for_each(ele, &opened) {
801 lp = list_entry(ele, struct uml_net_private, list); 832 lp = list_entry(ele, struct uml_net_private, list);
802 free_irq(lp->dev->irq, lp->dev); 833 free_irq(lp->dev->irq, lp->dev);
803 if((lp->close != NULL) && (lp->fd >= 0)) 834 if ((lp->close != NULL) && (lp->fd >= 0))
804 (*lp->close)(lp->fd, &lp->user); 835 (*lp->close)(lp->fd, &lp->user);
805 if(lp->remove != NULL) 836 if (lp->remove != NULL)
806 (*lp->remove)(&lp->user); 837 (*lp->remove)(&lp->user);
807 } 838 }
808 spin_unlock(&opened_lock); 839 spin_unlock(&opened_lock);
@@ -810,19 +841,6 @@ static void close_devices(void)
810 841
811__uml_exitcall(close_devices); 842__uml_exitcall(close_devices);
812 843
813struct sk_buff *ether_adjust_skb(struct sk_buff *skb, int extra)
814{
815 if((skb != NULL) && (skb_tailroom(skb) < extra)){
816 struct sk_buff *skb2;
817
818 skb2 = skb_copy_expand(skb, 0, extra, GFP_ATOMIC);
819 dev_kfree_skb(skb);
820 skb = skb2;
821 }
822 if(skb != NULL) skb_put(skb, extra);
823 return(skb);
824}
825
826void iter_addresses(void *d, void (*cb)(unsigned char *, unsigned char *, 844void iter_addresses(void *d, void (*cb)(unsigned char *, unsigned char *,
827 void *), 845 void *),
828 void *arg) 846 void *arg)
@@ -832,9 +850,9 @@ void iter_addresses(void *d, void (*cb)(unsigned char *, unsigned char *,
832 struct in_ifaddr *in; 850 struct in_ifaddr *in;
833 unsigned char address[4], netmask[4]; 851 unsigned char address[4], netmask[4];
834 852
835 if(ip == NULL) return; 853 if (ip == NULL) return;
836 in = ip->ifa_list; 854 in = ip->ifa_list;
837 while(in != NULL){ 855 while (in != NULL) {
838 memcpy(address, &in->ifa_address, sizeof(address)); 856 memcpy(address, &in->ifa_address, sizeof(address));
839 memcpy(netmask, &in->ifa_mask, sizeof(netmask)); 857 memcpy(netmask, &in->ifa_mask, sizeof(netmask));
840 (*cb)(address, netmask, arg); 858 (*cb)(address, netmask, arg);
@@ -849,15 +867,15 @@ int dev_netmask(void *d, void *m)
849 struct in_ifaddr *in; 867 struct in_ifaddr *in;
850 __be32 *mask_out = m; 868 __be32 *mask_out = m;
851 869
852 if(ip == NULL) 870 if (ip == NULL)
853 return(1); 871 return 1;
854 872
855 in = ip->ifa_list; 873 in = ip->ifa_list;
856 if(in == NULL) 874 if (in == NULL)
857 return(1); 875 return 1;
858 876
859 *mask_out = in->ifa_mask; 877 *mask_out = in->ifa_mask;
860 return(0); 878 return 0;
861} 879}
862 880
863void *get_output_buffer(int *len_out) 881void *get_output_buffer(int *len_out)
@@ -865,7 +883,7 @@ void *get_output_buffer(int *len_out)
865 void *ret; 883 void *ret;
866 884
867 ret = (void *) __get_free_pages(GFP_KERNEL, 0); 885 ret = (void *) __get_free_pages(GFP_KERNEL, 0);
868 if(ret) *len_out = PAGE_SIZE; 886 if (ret) *len_out = PAGE_SIZE;
869 else *len_out = 0; 887 else *len_out = 0;
870 return ret; 888 return ret;
871} 889}
@@ -881,16 +899,16 @@ int tap_setup_common(char *str, char *type, char **dev_name, char **mac_out,
881 char *remain; 899 char *remain;
882 900
883 remain = split_if_spec(str, dev_name, mac_out, gate_addr, NULL); 901 remain = split_if_spec(str, dev_name, mac_out, gate_addr, NULL);
884 if(remain != NULL){ 902 if (remain != NULL) {
885 printk("tap_setup_common - Extra garbage on specification : " 903 printk(KERN_ERR "tap_setup_common - Extra garbage on "
886 "'%s'\n", remain); 904 "specification : '%s'\n", remain);
887 return(1); 905 return 1;
888 } 906 }
889 907
890 return(0); 908 return 0;
891} 909}
892 910
893unsigned short eth_protocol(struct sk_buff *skb) 911unsigned short eth_protocol(struct sk_buff *skb)
894{ 912{
895 return(eth_type_trans(skb, skb->dev)); 913 return eth_type_trans(skb, skb->dev);
896} 914}
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c
index da946e3e1bf2..90d7f2e8ead8 100644
--- a/arch/um/drivers/net_user.c
+++ b/arch/um/drivers/net_user.c
@@ -1,34 +1,32 @@
1/* 1/*
2 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stddef.h>
7#include <stdarg.h>
8#include <unistd.h>
9#include <stdio.h> 6#include <stdio.h>
7#include <unistd.h>
8#include <stdarg.h>
10#include <errno.h> 9#include <errno.h>
11#include <stdlib.h> 10#include <stddef.h>
12#include <string.h> 11#include <string.h>
13#include <sys/socket.h> 12#include <sys/socket.h>
14#include <sys/wait.h> 13#include <sys/wait.h>
15#include <sys/time.h>
16#include "user.h"
17#include "kern_util.h"
18#include "net_user.h" 14#include "net_user.h"
15#include "kern_constants.h"
19#include "os.h" 16#include "os.h"
20#include "um_malloc.h" 17#include "um_malloc.h"
21#include "kern_constants.h" 18#include "user.h"
22 19
23int tap_open_common(void *dev, char *gate_addr) 20int tap_open_common(void *dev, char *gate_addr)
24{ 21{
25 int tap_addr[4]; 22 int tap_addr[4];
26 23
27 if(gate_addr == NULL) 24 if (gate_addr == NULL)
28 return 0; 25 return 0;
29 if(sscanf(gate_addr, "%d.%d.%d.%d", &tap_addr[0], 26 if (sscanf(gate_addr, "%d.%d.%d.%d", &tap_addr[0],
30 &tap_addr[1], &tap_addr[2], &tap_addr[3]) != 4){ 27 &tap_addr[1], &tap_addr[2], &tap_addr[3]) != 4) {
31 printk("Invalid tap IP address - '%s'\n", gate_addr); 28 printk(UM_KERN_ERR "Invalid tap IP address - '%s'\n",
29 gate_addr);
32 return -EINVAL; 30 return -EINVAL;
33 } 31 }
34 return 0; 32 return 0;
@@ -38,15 +36,15 @@ void tap_check_ips(char *gate_addr, unsigned char *eth_addr)
38{ 36{
39 int tap_addr[4]; 37 int tap_addr[4];
40 38
41 if((gate_addr != NULL) && 39 if ((gate_addr != NULL) &&
42 (sscanf(gate_addr, "%d.%d.%d.%d", &tap_addr[0], 40 (sscanf(gate_addr, "%d.%d.%d.%d", &tap_addr[0],
43 &tap_addr[1], &tap_addr[2], &tap_addr[3]) == 4) && 41 &tap_addr[1], &tap_addr[2], &tap_addr[3]) == 4) &&
44 (eth_addr[0] == tap_addr[0]) && 42 (eth_addr[0] == tap_addr[0]) &&
45 (eth_addr[1] == tap_addr[1]) && 43 (eth_addr[1] == tap_addr[1]) &&
46 (eth_addr[2] == tap_addr[2]) && 44 (eth_addr[2] == tap_addr[2]) &&
47 (eth_addr[3] == tap_addr[3])){ 45 (eth_addr[3] == tap_addr[3])) {
48 printk("The tap IP address and the UML eth IP address" 46 printk(UM_KERN_ERR "The tap IP address and the UML eth IP "
49 " must be different\n"); 47 "address must be different\n");
50 } 48 }
51} 49}
52 50
@@ -57,24 +55,28 @@ void read_output(int fd, char *output, int len)
57 char c; 55 char c;
58 char *str; 56 char *str;
59 57
60 if(output == NULL){ 58 if (output == NULL) {
61 output = &c; 59 output = &c;
62 len = sizeof(c); 60 len = sizeof(c);
63 } 61 }
64 62
65 *output = '\0'; 63 *output = '\0';
66 ret = os_read_file(fd, &remain, sizeof(remain)); 64 ret = read(fd, &remain, sizeof(remain));
67 65
68 if (ret != sizeof(remain)) { 66 if (ret != sizeof(remain)) {
67 if (ret < 0)
68 ret = -errno;
69 expected = sizeof(remain); 69 expected = sizeof(remain);
70 str = "length"; 70 str = "length";
71 goto err; 71 goto err;
72 } 72 }
73 73
74 while(remain != 0){ 74 while (remain != 0) {
75 expected = (remain < len) ? remain : len; 75 expected = (remain < len) ? remain : len;
76 ret = os_read_file(fd, output, expected); 76 ret = read(fd, output, expected);
77 if (ret != expected) { 77 if (ret != expected) {
78 if (ret < 0)
79 ret = -errno;
78 str = "data"; 80 str = "data";
79 goto err; 81 goto err;
80 } 82 }
@@ -85,20 +87,22 @@ void read_output(int fd, char *output, int len)
85 87
86err: 88err:
87 if (ret < 0) 89 if (ret < 0)
88 printk("read_output - read of %s failed, errno = %d\n", str, -ret); 90 printk(UM_KERN_ERR "read_output - read of %s failed, "
91 "errno = %d\n", str, -ret);
89 else 92 else
90 printk("read_output - read of %s failed, read only %d of %d bytes\n", str, ret, expected); 93 printk(UM_KERN_ERR "read_output - read of %s failed, read only "
94 "%d of %d bytes\n", str, ret, expected);
91} 95}
92 96
93int net_read(int fd, void *buf, int len) 97int net_read(int fd, void *buf, int len)
94{ 98{
95 int n; 99 int n;
96 100
97 n = os_read_file(fd, buf, len); 101 n = read(fd, buf, len);
98 102
99 if(n == -EAGAIN) 103 if ((n < 0) && (errno == EAGAIN))
100 return 0; 104 return 0;
101 else if(n == 0) 105 else if (n == 0)
102 return -ENOTCONN; 106 return -ENOTCONN;
103 return n; 107 return n;
104} 108}
@@ -108,12 +112,12 @@ int net_recvfrom(int fd, void *buf, int len)
108 int n; 112 int n;
109 113
110 CATCH_EINTR(n = recvfrom(fd, buf, len, 0, NULL, NULL)); 114 CATCH_EINTR(n = recvfrom(fd, buf, len, 0, NULL, NULL));
111 if(n < 0){ 115 if (n < 0) {
112 if(errno == EAGAIN) 116 if (errno == EAGAIN)
113 return 0; 117 return 0;
114 return -errno; 118 return -errno;
115 } 119 }
116 else if(n == 0) 120 else if (n == 0)
117 return -ENOTCONN; 121 return -ENOTCONN;
118 return n; 122 return n;
119} 123}
@@ -122,11 +126,11 @@ int net_write(int fd, void *buf, int len)
122{ 126{
123 int n; 127 int n;
124 128
125 n = os_write_file(fd, buf, len); 129 n = write(fd, buf, len);
126 130
127 if(n == -EAGAIN) 131 if ((n < 0) && (errno == EAGAIN))
128 return 0; 132 return 0;
129 else if(n == 0) 133 else if (n == 0)
130 return -ENOTCONN; 134 return -ENOTCONN;
131 return n; 135 return n;
132} 136}
@@ -136,12 +140,12 @@ int net_send(int fd, void *buf, int len)
136 int n; 140 int n;
137 141
138 CATCH_EINTR(n = send(fd, buf, len, 0)); 142 CATCH_EINTR(n = send(fd, buf, len, 0));
139 if(n < 0){ 143 if (n < 0) {
140 if(errno == EAGAIN) 144 if (errno == EAGAIN)
141 return 0; 145 return 0;
142 return -errno; 146 return -errno;
143 } 147 }
144 else if(n == 0) 148 else if (n == 0)
145 return -ENOTCONN; 149 return -ENOTCONN;
146 return n; 150 return n;
147} 151}
@@ -152,12 +156,12 @@ int net_sendto(int fd, void *buf, int len, void *to, int sock_len)
152 156
153 CATCH_EINTR(n = sendto(fd, buf, len, 0, (struct sockaddr *) to, 157 CATCH_EINTR(n = sendto(fd, buf, len, 0, (struct sockaddr *) to,
154 sock_len)); 158 sock_len));
155 if(n < 0){ 159 if (n < 0) {
156 if(errno == EAGAIN) 160 if (errno == EAGAIN)
157 return 0; 161 return 0;
158 return -errno; 162 return -errno;
159 } 163 }
160 else if(n == 0) 164 else if (n == 0)
161 return -ENOTCONN; 165 return -ENOTCONN;
162 return n; 166 return n;
163} 167}
@@ -171,7 +175,7 @@ static void change_pre_exec(void *arg)
171{ 175{
172 struct change_pre_exec_data *data = arg; 176 struct change_pre_exec_data *data = arg;
173 177
174 os_close_file(data->close_me); 178 close(data->close_me);
175 dup2(data->stdout, 1); 179 dup2(data->stdout, 1);
176} 180}
177 181
@@ -181,8 +185,9 @@ static int change_tramp(char **argv, char *output, int output_len)
181 struct change_pre_exec_data pe_data; 185 struct change_pre_exec_data pe_data;
182 186
183 err = os_pipe(fds, 1, 0); 187 err = os_pipe(fds, 1, 0);
184 if(err < 0){ 188 if (err < 0) {
185 printk("change_tramp - pipe failed, err = %d\n", -err); 189 printk(UM_KERN_ERR "change_tramp - pipe failed, err = %d\n",
190 -err);
186 return err; 191 return err;
187 } 192 }
188 pe_data.close_me = fds[0]; 193 pe_data.close_me = fds[0];
@@ -192,8 +197,8 @@ static int change_tramp(char **argv, char *output, int output_len)
192 if (pid > 0) /* Avoid hang as we won't get data in failure case. */ 197 if (pid > 0) /* Avoid hang as we won't get data in failure case. */
193 read_output(fds[0], output, output_len); 198 read_output(fds[0], output, output_len);
194 199
195 os_close_file(fds[0]); 200 close(fds[0]);
196 os_close_file(fds[1]); 201 close(fds[1]);
197 202
198 if (pid > 0) 203 if (pid > 0)
199 CATCH_EINTR(err = waitpid(pid, NULL, 0)); 204 CATCH_EINTR(err = waitpid(pid, NULL, 0));
@@ -206,25 +211,26 @@ static void change(char *dev, char *what, unsigned char *addr,
206 char addr_buf[sizeof("255.255.255.255\0")]; 211 char addr_buf[sizeof("255.255.255.255\0")];
207 char netmask_buf[sizeof("255.255.255.255\0")]; 212 char netmask_buf[sizeof("255.255.255.255\0")];
208 char version[sizeof("nnnnn\0")]; 213 char version[sizeof("nnnnn\0")];
209 char *argv[] = { "uml_net", version, what, dev, addr_buf, 214 char *argv[] = { "uml_net", version, what, dev, addr_buf,
210 netmask_buf, NULL }; 215 netmask_buf, NULL };
211 char *output; 216 char *output;
212 int output_len, pid; 217 int output_len, pid;
213 218
214 sprintf(version, "%d", UML_NET_VERSION); 219 sprintf(version, "%d", UML_NET_VERSION);
215 sprintf(addr_buf, "%d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3]); 220 sprintf(addr_buf, "%d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3]);
216 sprintf(netmask_buf, "%d.%d.%d.%d", netmask[0], netmask[1], 221 sprintf(netmask_buf, "%d.%d.%d.%d", netmask[0], netmask[1],
217 netmask[2], netmask[3]); 222 netmask[2], netmask[3]);
218 223
219 output_len = UM_KERN_PAGE_SIZE; 224 output_len = UM_KERN_PAGE_SIZE;
220 output = kmalloc(output_len, UM_GFP_KERNEL); 225 output = kmalloc(output_len, UM_GFP_KERNEL);
221 if(output == NULL) 226 if (output == NULL)
222 printk("change : failed to allocate output buffer\n"); 227 printk(UM_KERN_ERR "change : failed to allocate output "
228 "buffer\n");
223 229
224 pid = change_tramp(argv, output, output_len); 230 pid = change_tramp(argv, output, output_len);
225 if(pid < 0) return; 231 if (pid < 0) return;
226 232
227 if(output != NULL){ 233 if (output != NULL) {
228 printk("%s", output); 234 printk("%s", output);
229 kfree(output); 235 kfree(output);
230 } 236 }
@@ -246,13 +252,13 @@ char *split_if_spec(char *str, ...)
246 va_list ap; 252 va_list ap;
247 253
248 va_start(ap, str); 254 va_start(ap, str);
249 while((arg = va_arg(ap, char **)) != NULL){ 255 while ((arg = va_arg(ap, char **)) != NULL) {
250 if(*str == '\0') 256 if (*str == '\0')
251 return NULL; 257 return NULL;
252 end = strchr(str, ','); 258 end = strchr(str, ',');
253 if(end != str) 259 if (end != str)
254 *arg = str; 260 *arg = str;
255 if(end == NULL) 261 if (end == NULL)
256 return NULL; 262 return NULL;
257 *end++ = '\0'; 263 *end++ = '\0';
258 str = end; 264 str = end;
diff --git a/arch/um/drivers/null.c b/arch/um/drivers/null.c
index 9016c68beee8..21ad3d7932b3 100644
--- a/arch/um/drivers/null.c
+++ b/arch/um/drivers/null.c
@@ -1,10 +1,11 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stdlib.h> 6#include <stddef.h>
7#include <errno.h> 7#include <errno.h>
8#include <fcntl.h>
8#include "chan_user.h" 9#include "chan_user.h"
9#include "os.h" 10#include "os.h"
10 11
@@ -13,19 +14,23 @@ static int null_chan;
13 14
14static void *null_init(char *str, int device, const struct chan_opts *opts) 15static void *null_init(char *str, int device, const struct chan_opts *opts)
15{ 16{
16 return(&null_chan); 17 return &null_chan;
17} 18}
18 19
19static int null_open(int input, int output, int primary, void *d, 20static int null_open(int input, int output, int primary, void *d,
20 char **dev_out) 21 char **dev_out)
21{ 22{
23 int fd;
24
22 *dev_out = NULL; 25 *dev_out = NULL;
23 return(os_open_file(DEV_NULL, of_rdwr(OPENFLAGS()), 0)); 26
27 fd = open(DEV_NULL, O_RDWR);
28 return (fd < 0) ? -errno : fd;
24} 29}
25 30
26static int null_read(int fd, char *c_out, void *unused) 31static int null_read(int fd, char *c_out, void *unused)
27{ 32{
28 return(-ENODEV); 33 return -ENODEV;
29} 34}
30 35
31static void null_free(void *data) 36static void null_free(void *data)
@@ -44,14 +49,3 @@ const struct chan_ops null_ops = {
44 .free = null_free, 49 .free = null_free,
45 .winch = 0, 50 .winch = 0,
46}; 51};
47
48/*
49 * Overrides for Emacs so that we follow Linus's tabbing style.
50 * Emacs will notice this stuff at the end of the file and automatically
51 * adjust the settings for this buffer only. This must remain at the end
52 * of the file.
53 * ---------------------------------------------------------------------------
54 * Local variables:
55 * c-file-style: "linux"
56 * End:
57 */
diff --git a/arch/um/drivers/pcap_kern.c b/arch/um/drivers/pcap_kern.c
index c329931673d6..3a750dd39be1 100644
--- a/arch/um/drivers/pcap_kern.c
+++ b/arch/um/drivers/pcap_kern.c
@@ -1,13 +1,11 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike <jdike@karaya.com> 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL. 3 * Licensed under the GPL.
4 */ 4 */
5 5
6#include "linux/init.h" 6#include "linux/init.h"
7#include "linux/netdevice.h" 7#include <linux/netdevice.h>
8#include "linux/etherdevice.h"
9#include "net_kern.h" 8#include "net_kern.h"
10#include "net_user.h"
11#include "pcap_user.h" 9#include "pcap_user.h"
12 10
13struct pcap_init { 11struct pcap_init {
@@ -33,19 +31,14 @@ void pcap_init(struct net_device *dev, void *data)
33 printk("pcap backend, host interface %s\n", ppri->host_if); 31 printk("pcap backend, host interface %s\n", ppri->host_if);
34} 32}
35 33
36static int pcap_read(int fd, struct sk_buff **skb, 34static int pcap_read(int fd, struct sk_buff *skb, struct uml_net_private *lp)
37 struct uml_net_private *lp)
38{ 35{
39 *skb = ether_adjust_skb(*skb, ETH_HEADER_OTHER); 36 return pcap_user_read(fd, skb_mac_header(skb),
40 if(*skb == NULL) 37 skb->dev->mtu + ETH_HEADER_OTHER,
41 return -ENOMEM;
42
43 return pcap_user_read(fd, skb_mac_header(*skb),
44 (*skb)->dev->mtu + ETH_HEADER_OTHER,
45 (struct pcap_data *) &lp->user); 38 (struct pcap_data *) &lp->user);
46} 39}
47 40
48static int pcap_write(int fd, struct sk_buff **skb, struct uml_net_private *lp) 41static int pcap_write(int fd, struct sk_buff *skb, struct uml_net_private *lp)
49{ 42{
50 return -EPERM; 43 return -EPERM;
51} 44}
@@ -71,28 +64,29 @@ int pcap_setup(char *str, char **mac_out, void *data)
71 64
72 remain = split_if_spec(str, &host_if, &init->filter, 65 remain = split_if_spec(str, &host_if, &init->filter,
73 &options[0], &options[1], mac_out, NULL); 66 &options[0], &options[1], mac_out, NULL);
74 if(remain != NULL){ 67 if (remain != NULL) {
75 printk(KERN_ERR "pcap_setup - Extra garbage on " 68 printk(KERN_ERR "pcap_setup - Extra garbage on "
76 "specification : '%s'\n", remain); 69 "specification : '%s'\n", remain);
77 return 0; 70 return 0;
78 } 71 }
79 72
80 if(host_if != NULL) 73 if (host_if != NULL)
81 init->host_if = host_if; 74 init->host_if = host_if;
82 75
83 for(i = 0; i < ARRAY_SIZE(options); i++){ 76 for (i = 0; i < ARRAY_SIZE(options); i++) {
84 if(options[i] == NULL) 77 if (options[i] == NULL)
85 continue; 78 continue;
86 if(!strcmp(options[i], "promisc")) 79 if (!strcmp(options[i], "promisc"))
87 init->promisc = 1; 80 init->promisc = 1;
88 else if(!strcmp(options[i], "nopromisc")) 81 else if (!strcmp(options[i], "nopromisc"))
89 init->promisc = 0; 82 init->promisc = 0;
90 else if(!strcmp(options[i], "optimize")) 83 else if (!strcmp(options[i], "optimize"))
91 init->optimize = 1; 84 init->optimize = 1;
92 else if(!strcmp(options[i], "nooptimize")) 85 else if (!strcmp(options[i], "nooptimize"))
93 init->optimize = 0; 86 init->optimize = 0;
94 else { 87 else {
95 printk("pcap_setup : bad option - '%s'\n", options[i]); 88 printk(KERN_ERR "pcap_setup : bad option - '%s'\n",
89 options[i]);
96 return 0; 90 return 0;
97 } 91 }
98 } 92 }
diff --git a/arch/um/drivers/pcap_user.c b/arch/um/drivers/pcap_user.c
index 1316456e2a28..e9809356c530 100644
--- a/arch/um/drivers/pcap_user.c
+++ b/arch/um/drivers/pcap_user.c
@@ -1,21 +1,17 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike <jdike@karaya.com> 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL. 3 * Licensed under the GPL.
4 */ 4 */
5 5
6#include <unistd.h>
7#include <stdlib.h>
8#include <string.h>
9#include <errno.h> 6#include <errno.h>
10#include <pcap.h> 7#include <pcap.h>
8#include <string.h>
11#include <asm/types.h> 9#include <asm/types.h>
12#include "net_user.h" 10#include "net_user.h"
13#include "pcap_user.h" 11#include "pcap_user.h"
14#include "user.h"
15#include "um_malloc.h"
16#include "kern_constants.h" 12#include "kern_constants.h"
17 13#include "um_malloc.h"
18#define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER) 14#include "user.h"
19 15
20#define PCAP_FD(p) (*(int *)(p)) 16#define PCAP_FD(p) (*(int *)(p))
21 17
@@ -25,8 +21,9 @@ static int pcap_user_init(void *data, void *dev)
25 pcap_t *p; 21 pcap_t *p;
26 char errors[PCAP_ERRBUF_SIZE]; 22 char errors[PCAP_ERRBUF_SIZE];
27 23
28 p = pcap_open_live(pri->host_if, MAX_PACKET, pri->promisc, 0, errors); 24 p = pcap_open_live(pri->host_if, ETH_MAX_PACKET + ETH_HEADER_OTHER,
29 if(p == NULL){ 25 pri->promisc, 0, errors);
26 if (p == NULL) {
30 printk(UM_KERN_ERR "pcap_user_init : pcap_open_live failed - " 27 printk(UM_KERN_ERR "pcap_user_init : pcap_open_live failed - "
31 "'%s'\n", errors); 28 "'%s'\n", errors);
32 return -EINVAL; 29 return -EINVAL;
@@ -43,50 +40,55 @@ static int pcap_open(void *data)
43 __u32 netmask; 40 __u32 netmask;
44 int err; 41 int err;
45 42
46 if(pri->pcap == NULL) 43 if (pri->pcap == NULL)
47 return -ENODEV; 44 return -ENODEV;
48 45
49 if(pri->filter != NULL){ 46 if (pri->filter != NULL) {
50 err = dev_netmask(pri->dev, &netmask); 47 err = dev_netmask(pri->dev, &netmask);
51 if(err < 0){ 48 if (err < 0) {
52 printk(UM_KERN_ERR "pcap_open : dev_netmask failed\n"); 49 printk(UM_KERN_ERR "pcap_open : dev_netmask failed\n");
53 return -EIO; 50 return -EIO;
54 } 51 }
55 52
56 pri->compiled = kmalloc(sizeof(struct bpf_program), UM_GFP_KERNEL); 53 pri->compiled = kmalloc(sizeof(struct bpf_program),
57 if(pri->compiled == NULL){ 54 UM_GFP_KERNEL);
55 if (pri->compiled == NULL) {
58 printk(UM_KERN_ERR "pcap_open : kmalloc failed\n"); 56 printk(UM_KERN_ERR "pcap_open : kmalloc failed\n");
59 return -ENOMEM; 57 return -ENOMEM;
60 } 58 }
61 59
62 err = pcap_compile(pri->pcap, 60 err = pcap_compile(pri->pcap,
63 (struct bpf_program *) pri->compiled, 61 (struct bpf_program *) pri->compiled,
64 pri->filter, pri->optimize, netmask); 62 pri->filter, pri->optimize, netmask);
65 if(err < 0){ 63 if (err < 0) {
66 printk(UM_KERN_ERR "pcap_open : pcap_compile failed - " 64 printk(UM_KERN_ERR "pcap_open : pcap_compile failed - "
67 "'%s'\n", pcap_geterr(pri->pcap)); 65 "'%s'\n", pcap_geterr(pri->pcap));
68 return -EIO; 66 goto out;
69 } 67 }
70 68
71 err = pcap_setfilter(pri->pcap, pri->compiled); 69 err = pcap_setfilter(pri->pcap, pri->compiled);
72 if(err < 0){ 70 if (err < 0) {
73 printk(UM_KERN_ERR "pcap_open : pcap_setfilter " 71 printk(UM_KERN_ERR "pcap_open : pcap_setfilter "
74 "failed - '%s'\n", pcap_geterr(pri->pcap)); 72 "failed - '%s'\n", pcap_geterr(pri->pcap));
75 return -EIO; 73 goto out;
76 } 74 }
77 } 75 }
78 76
79 return PCAP_FD(pri->pcap); 77 return PCAP_FD(pri->pcap);
78
79 out:
80 kfree(pri->compiled);
81 return -EIO;
80} 82}
81 83
82static void pcap_remove(void *data) 84static void pcap_remove(void *data)
83{ 85{
84 struct pcap_data *pri = data; 86 struct pcap_data *pri = data;
85 87
86 if(pri->compiled != NULL) 88 if (pri->compiled != NULL)
87 pcap_freecode(pri->compiled); 89 pcap_freecode(pri->compiled);
88 90
89 if(pri->pcap != NULL) 91 if (pri->pcap != NULL)
90 pcap_close(pri->pcap); 92 pcap_close(pri->pcap);
91} 93}
92 94
@@ -95,7 +97,7 @@ struct pcap_handler_data {
95 int len; 97 int len;
96}; 98};
97 99
98static void handler(u_char *data, const struct pcap_pkthdr *header, 100static void handler(u_char *data, const struct pcap_pkthdr *header,
99 const u_char *packet) 101 const u_char *packet)
100{ 102{
101 int len; 103 int len;
@@ -115,12 +117,12 @@ int pcap_user_read(int fd, void *buffer, int len, struct pcap_data *pri)
115 int n; 117 int n;
116 118
117 n = pcap_dispatch(pri->pcap, 1, handler, (u_char *) &hdata); 119 n = pcap_dispatch(pri->pcap, 1, handler, (u_char *) &hdata);
118 if(n < 0){ 120 if (n < 0) {
119 printk(UM_KERN_ERR "pcap_dispatch failed - %s\n", 121 printk(UM_KERN_ERR "pcap_dispatch failed - %s\n",
120 pcap_geterr(pri->pcap)); 122 pcap_geterr(pri->pcap));
121 return -EIO; 123 return -EIO;
122 } 124 }
123 else if(n == 0) 125 else if (n == 0)
124 return 0; 126 return 0;
125 return hdata.len; 127 return hdata.len;
126} 128}
@@ -130,8 +132,8 @@ const struct net_user_info pcap_user_info = {
130 .open = pcap_open, 132 .open = pcap_open,
131 .close = NULL, 133 .close = NULL,
132 .remove = pcap_remove, 134 .remove = pcap_remove,
133 .set_mtu = NULL,
134 .add_address = NULL, 135 .add_address = NULL,
135 .delete_address = NULL, 136 .delete_address = NULL,
136 .max_packet = MAX_PACKET - ETH_HEADER_OTHER 137 .mtu = ETH_MAX_PACKET,
138 .max_packet = ETH_MAX_PACKET + ETH_HEADER_OTHER,
137}; 139};
diff --git a/arch/um/drivers/port_kern.c b/arch/um/drivers/port_kern.c
index 1c8efd95c421..330543b3129b 100644
--- a/arch/um/drivers/port_kern.c
+++ b/arch/um/drivers/port_kern.c
@@ -1,24 +1,16 @@
1/* 1/*
2 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/list.h" 6#include "linux/completion.h"
7#include "linux/sched.h"
8#include "linux/slab.h"
9#include "linux/interrupt.h" 7#include "linux/interrupt.h"
10#include "linux/spinlock.h" 8#include "linux/list.h"
11#include "linux/errno.h"
12#include "asm/atomic.h" 9#include "asm/atomic.h"
13#include "asm/semaphore.h"
14#include "asm/errno.h"
15#include "kern_util.h"
16#include "kern.h"
17#include "irq_user.h"
18#include "irq_kern.h"
19#include "port.h"
20#include "init.h" 10#include "init.h"
11#include "irq_kern.h"
21#include "os.h" 12#include "os.h"
13#include "port.h"
22 14
23struct port_list { 15struct port_list {
24 struct list_head list; 16 struct list_head list;
@@ -53,8 +45,8 @@ static irqreturn_t pipe_interrupt(int irq, void *data)
53 int fd; 45 int fd;
54 46
55 fd = os_rcv_fd(conn->socket[0], &conn->helper_pid); 47 fd = os_rcv_fd(conn->socket[0], &conn->helper_pid);
56 if(fd < 0){ 48 if (fd < 0) {
57 if(fd == -EAGAIN) 49 if (fd == -EAGAIN)
58 return IRQ_NONE; 50 return IRQ_NONE;
59 51
60 printk(KERN_ERR "pipe_interrupt : os_rcv_fd returned %d\n", 52 printk(KERN_ERR "pipe_interrupt : os_rcv_fd returned %d\n",
@@ -81,18 +73,18 @@ static irqreturn_t pipe_interrupt(int irq, void *data)
81static int port_accept(struct port_list *port) 73static int port_accept(struct port_list *port)
82{ 74{
83 struct connection *conn; 75 struct connection *conn;
84 int fd, socket[2], pid, ret = 0; 76 int fd, socket[2], pid;
85 77
86 fd = port_connection(port->fd, socket, &pid); 78 fd = port_connection(port->fd, socket, &pid);
87 if(fd < 0){ 79 if (fd < 0) {
88 if(fd != -EAGAIN) 80 if (fd != -EAGAIN)
89 printk(KERN_ERR "port_accept : port_connection " 81 printk(KERN_ERR "port_accept : port_connection "
90 "returned %d\n", -fd); 82 "returned %d\n", -fd);
91 goto out; 83 goto out;
92 } 84 }
93 85
94 conn = kmalloc(sizeof(*conn), GFP_ATOMIC); 86 conn = kmalloc(sizeof(*conn), GFP_ATOMIC);
95 if(conn == NULL){ 87 if (conn == NULL) {
96 printk(KERN_ERR "port_accept : failed to allocate " 88 printk(KERN_ERR "port_accept : failed to allocate "
97 "connection\n"); 89 "connection\n");
98 goto out_close; 90 goto out_close;
@@ -104,17 +96,17 @@ static int port_accept(struct port_list *port)
104 .telnetd_pid = pid, 96 .telnetd_pid = pid,
105 .port = port }); 97 .port = port });
106 98
107 if(um_request_irq(TELNETD_IRQ, socket[0], IRQ_READ, pipe_interrupt, 99 if (um_request_irq(TELNETD_IRQ, socket[0], IRQ_READ, pipe_interrupt,
108 IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM, 100 IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM,
109 "telnetd", conn)){ 101 "telnetd", conn)) {
110 printk(KERN_ERR "port_accept : failed to get IRQ for " 102 printk(KERN_ERR "port_accept : failed to get IRQ for "
111 "telnetd\n"); 103 "telnetd\n");
112 goto out_free; 104 goto out_free;
113 } 105 }
114 106
115 if(atomic_read(&port->wait_count) == 0){ 107 if (atomic_read(&port->wait_count) == 0) {
116 os_write_file(fd, NO_WAITER_MSG, sizeof(NO_WAITER_MSG)); 108 os_write_file(fd, NO_WAITER_MSG, sizeof(NO_WAITER_MSG));
117 printk("No one waiting for port\n"); 109 printk(KERN_ERR "No one waiting for port\n");
118 } 110 }
119 list_add(&conn->list, &port->pending); 111 list_add(&conn->list, &port->pending);
120 return 1; 112 return 1;
@@ -123,28 +115,29 @@ static int port_accept(struct port_list *port)
123 kfree(conn); 115 kfree(conn);
124 out_close: 116 out_close:
125 os_close_file(fd); 117 os_close_file(fd);
126 if(pid != -1) 118 os_kill_process(pid, 1);
127 os_kill_process(pid, 1);
128 out: 119 out:
129 return ret; 120 return 0;
130} 121}
131 122
132static DECLARE_MUTEX(ports_sem); 123static DECLARE_MUTEX(ports_sem);
133static LIST_HEAD(ports); 124static LIST_HEAD(ports);
134 125
135void port_work_proc(struct work_struct *unused) 126static void port_work_proc(struct work_struct *unused)
136{ 127{
137 struct port_list *port; 128 struct port_list *port;
138 struct list_head *ele; 129 struct list_head *ele;
139 unsigned long flags; 130 unsigned long flags;
140 131
141 local_irq_save(flags); 132 local_irq_save(flags);
142 list_for_each(ele, &ports){ 133 list_for_each(ele, &ports) {
143 port = list_entry(ele, struct port_list, list); 134 port = list_entry(ele, struct port_list, list);
144 if(!port->has_connection) 135 if (!port->has_connection)
145 continue; 136 continue;
137
146 reactivate_fd(port->fd, ACCEPT_IRQ); 138 reactivate_fd(port->fd, ACCEPT_IRQ);
147 while(port_accept(port)) ; 139 while (port_accept(port))
140 ;
148 port->has_connection = 0; 141 port->has_connection = 0;
149 } 142 }
150 local_irq_restore(flags); 143 local_irq_restore(flags);
@@ -169,25 +162,27 @@ void *port_data(int port_num)
169 int fd; 162 int fd;
170 163
171 down(&ports_sem); 164 down(&ports_sem);
172 list_for_each(ele, &ports){ 165 list_for_each(ele, &ports) {
173 port = list_entry(ele, struct port_list, list); 166 port = list_entry(ele, struct port_list, list);
174 if(port->port == port_num) goto found; 167 if (port->port == port_num)
168 goto found;
175 } 169 }
176 port = kmalloc(sizeof(struct port_list), GFP_KERNEL); 170 port = kmalloc(sizeof(struct port_list), GFP_KERNEL);
177 if(port == NULL){ 171 if (port == NULL) {
178 printk(KERN_ERR "Allocation of port list failed\n"); 172 printk(KERN_ERR "Allocation of port list failed\n");
179 goto out; 173 goto out;
180 } 174 }
181 175
182 fd = port_listen_fd(port_num); 176 fd = port_listen_fd(port_num);
183 if(fd < 0){ 177 if (fd < 0) {
184 printk(KERN_ERR "binding to port %d failed, errno = %d\n", 178 printk(KERN_ERR "binding to port %d failed, errno = %d\n",
185 port_num, -fd); 179 port_num, -fd);
186 goto out_free; 180 goto out_free;
187 } 181 }
188 if(um_request_irq(ACCEPT_IRQ, fd, IRQ_READ, port_interrupt, 182
183 if (um_request_irq(ACCEPT_IRQ, fd, IRQ_READ, port_interrupt,
189 IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM, 184 IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM,
190 "port", port)){ 185 "port", port)) {
191 printk(KERN_ERR "Failed to get IRQ for port %d\n", port_num); 186 printk(KERN_ERR "Failed to get IRQ for port %d\n", port_num);
192 goto out_close; 187 goto out_close;
193 } 188 }
@@ -206,7 +201,7 @@ void *port_data(int port_num)
206 201
207 found: 202 found:
208 dev = kmalloc(sizeof(struct port_dev), GFP_KERNEL); 203 dev = kmalloc(sizeof(struct port_dev), GFP_KERNEL);
209 if(dev == NULL){ 204 if (dev == NULL) {
210 printk(KERN_ERR "Allocation of port device entry failed\n"); 205 printk(KERN_ERR "Allocation of port device entry failed\n");
211 goto out; 206 goto out;
212 } 207 }
@@ -216,10 +211,10 @@ void *port_data(int port_num)
216 .telnetd_pid = -1 }); 211 .telnetd_pid = -1 });
217 goto out; 212 goto out;
218 213
219 out_free:
220 kfree(port);
221 out_close: 214 out_close:
222 os_close_file(fd); 215 os_close_file(fd);
216 out_free:
217 kfree(port);
223 out: 218 out:
224 up(&ports_sem); 219 up(&ports_sem);
225 return dev; 220 return dev;
@@ -233,9 +228,9 @@ int port_wait(void *data)
233 int fd; 228 int fd;
234 229
235 atomic_inc(&port->wait_count); 230 atomic_inc(&port->wait_count);
236 while(1){ 231 while (1) {
237 fd = -ERESTARTSYS; 232 fd = -ERESTARTSYS;
238 if(wait_for_completion_interruptible(&port->done)) 233 if (wait_for_completion_interruptible(&port->done))
239 goto out; 234 goto out;
240 235
241 spin_lock(&port->lock); 236 spin_lock(&port->lock);
@@ -258,7 +253,8 @@ int port_wait(void *data)
258 */ 253 */
259 free_irq(TELNETD_IRQ, conn); 254 free_irq(TELNETD_IRQ, conn);
260 255
261 if(conn->fd >= 0) break; 256 if (conn->fd >= 0)
257 break;
262 os_close_file(conn->fd); 258 os_close_file(conn->fd);
263 kfree(conn); 259 kfree(conn);
264 } 260 }
@@ -276,9 +272,9 @@ void port_remove_dev(void *d)
276{ 272{
277 struct port_dev *dev = d; 273 struct port_dev *dev = d;
278 274
279 if(dev->helper_pid != -1) 275 if (dev->helper_pid != -1)
280 os_kill_process(dev->helper_pid, 0); 276 os_kill_process(dev->helper_pid, 0);
281 if(dev->telnetd_pid != -1) 277 if (dev->telnetd_pid != -1)
282 os_kill_process(dev->telnetd_pid, 1); 278 os_kill_process(dev->telnetd_pid, 1);
283 dev->helper_pid = -1; 279 dev->helper_pid = -1;
284 dev->telnetd_pid = -1; 280 dev->telnetd_pid = -1;
@@ -297,7 +293,7 @@ static void free_port(void)
297 struct list_head *ele; 293 struct list_head *ele;
298 struct port_list *port; 294 struct port_list *port;
299 295
300 list_for_each(ele, &ports){ 296 list_for_each(ele, &ports) {
301 port = list_entry(ele, struct port_list, list); 297 port = list_entry(ele, struct port_list, list);
302 free_irq_by_fd(port->fd); 298 free_irq_by_fd(port->fd);
303 os_close_file(port->fd); 299 os_close_file(port->fd);
diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c
index c799b00012c7..addd75902656 100644
--- a/arch/um/drivers/port_user.c
+++ b/arch/um/drivers/port_user.c
@@ -1,24 +1,20 @@
1/* 1/*
2 * Copyright (C) 2001 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stdio.h> 6#include <stdio.h>
7#include <stddef.h>
8#include <stdlib.h> 7#include <stdlib.h>
9#include <string.h>
10#include <errno.h> 8#include <errno.h>
11#include <unistd.h>
12#include <termios.h> 9#include <termios.h>
13#include <sys/socket.h> 10#include <unistd.h>
14#include <sys/un.h>
15#include <netinet/in.h> 11#include <netinet/in.h>
16#include "kern_util.h"
17#include "user.h"
18#include "chan_user.h" 12#include "chan_user.h"
19#include "port.h" 13#include "kern_constants.h"
20#include "os.h" 14#include "os.h"
15#include "port.h"
21#include "um_malloc.h" 16#include "um_malloc.h"
17#include "user.h"
22 18
23struct port_chan { 19struct port_chan {
24 int raw; 20 int raw;
@@ -34,24 +30,25 @@ static void *port_init(char *str, int device, const struct chan_opts *opts)
34 char *end; 30 char *end;
35 int port; 31 int port;
36 32
37 if(*str != ':'){ 33 if (*str != ':') {
38 printk("port_init : channel type 'port' must specify a " 34 printk(UM_KERN_ERR "port_init : channel type 'port' must "
39 "port number\n"); 35 "specify a port number\n");
40 return NULL; 36 return NULL;
41 } 37 }
42 str++; 38 str++;
43 port = strtoul(str, &end, 0); 39 port = strtoul(str, &end, 0);
44 if((*end != '\0') || (end == str)){ 40 if ((*end != '\0') || (end == str)) {
45 printk("port_init : couldn't parse port '%s'\n", str); 41 printk(UM_KERN_ERR "port_init : couldn't parse port '%s'\n",
42 str);
46 return NULL; 43 return NULL;
47 } 44 }
48 45
49 kern_data = port_data(port); 46 kern_data = port_data(port);
50 if(kern_data == NULL) 47 if (kern_data == NULL)
51 return NULL; 48 return NULL;
52 49
53 data = kmalloc(sizeof(*data), UM_GFP_KERNEL); 50 data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
54 if(data == NULL) 51 if (data == NULL)
55 goto err; 52 goto err;
56 53
57 *data = ((struct port_chan) { .raw = opts->raw, 54 *data = ((struct port_chan) { .raw = opts->raw,
@@ -79,13 +76,13 @@ static int port_open(int input, int output, int primary, void *d,
79 int fd, err; 76 int fd, err;
80 77
81 fd = port_wait(data->kernel_data); 78 fd = port_wait(data->kernel_data);
82 if((fd >= 0) && data->raw){ 79 if ((fd >= 0) && data->raw) {
83 CATCH_EINTR(err = tcgetattr(fd, &data->tt)); 80 CATCH_EINTR(err = tcgetattr(fd, &data->tt));
84 if(err) 81 if (err)
85 return err; 82 return err;
86 83
87 err = raw(fd); 84 err = raw(fd);
88 if(err) 85 if (err)
89 return err; 86 return err;
90 } 87 }
91 *dev_out = data->dev; 88 *dev_out = data->dev;
@@ -119,11 +116,11 @@ int port_listen_fd(int port)
119 int fd, err, arg; 116 int fd, err, arg;
120 117
121 fd = socket(PF_INET, SOCK_STREAM, 0); 118 fd = socket(PF_INET, SOCK_STREAM, 0);
122 if(fd == -1) 119 if (fd == -1)
123 return -errno; 120 return -errno;
124 121
125 arg = 1; 122 arg = 1;
126 if(setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &arg, sizeof(arg)) < 0){ 123 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &arg, sizeof(arg)) < 0) {
127 err = -errno; 124 err = -errno;
128 goto out; 125 goto out;
129 } 126 }
@@ -131,23 +128,23 @@ int port_listen_fd(int port)
131 addr.sin_family = AF_INET; 128 addr.sin_family = AF_INET;
132 addr.sin_port = htons(port); 129 addr.sin_port = htons(port);
133 addr.sin_addr.s_addr = htonl(INADDR_ANY); 130 addr.sin_addr.s_addr = htonl(INADDR_ANY);
134 if(bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0){ 131 if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
135 err = -errno; 132 err = -errno;
136 goto out; 133 goto out;
137 } 134 }
138 135
139 if(listen(fd, 1) < 0){ 136 if (listen(fd, 1) < 0) {
140 err = -errno; 137 err = -errno;
141 goto out; 138 goto out;
142 } 139 }
143 140
144 err = os_set_fd_block(fd, 0); 141 err = os_set_fd_block(fd, 0);
145 if(err < 0) 142 if (err < 0)
146 goto out; 143 goto out;
147 144
148 return fd; 145 return fd;
149 out: 146 out:
150 os_close_file(fd); 147 close(fd);
151 return err; 148 return err;
152} 149}
153 150
@@ -163,10 +160,10 @@ void port_pre_exec(void *arg)
163 dup2(data->sock_fd, 0); 160 dup2(data->sock_fd, 0);
164 dup2(data->sock_fd, 1); 161 dup2(data->sock_fd, 1);
165 dup2(data->sock_fd, 2); 162 dup2(data->sock_fd, 2);
166 os_close_file(data->sock_fd); 163 close(data->sock_fd);
167 dup2(data->pipe_fd, 3); 164 dup2(data->pipe_fd, 3);
168 os_shutdown_socket(3, 1, 0); 165 shutdown(3, SHUT_RD);
169 os_close_file(data->pipe_fd); 166 close(data->pipe_fd);
170} 167}
171 168
172int port_connection(int fd, int *socket, int *pid_out) 169int port_connection(int fd, int *socket, int *pid_out)
@@ -176,12 +173,12 @@ int port_connection(int fd, int *socket, int *pid_out)
176 "/usr/lib/uml/port-helper", NULL }; 173 "/usr/lib/uml/port-helper", NULL };
177 struct port_pre_exec_data data; 174 struct port_pre_exec_data data;
178 175
179 new = os_accept_connection(fd); 176 new = accept(fd, NULL, 0);
180 if(new < 0) 177 if (new < 0)
181 return new; 178 return -errno;
182 179
183 err = os_pipe(socket, 0, 0); 180 err = os_pipe(socket, 0, 0);
184 if(err < 0) 181 if (err < 0)
185 goto out_close; 182 goto out_close;
186 183
187 data = ((struct port_pre_exec_data) 184 data = ((struct port_pre_exec_data)
@@ -189,18 +186,18 @@ int port_connection(int fd, int *socket, int *pid_out)
189 .pipe_fd = socket[1] }); 186 .pipe_fd = socket[1] });
190 187
191 err = run_helper(port_pre_exec, &data, argv); 188 err = run_helper(port_pre_exec, &data, argv);
192 if(err < 0) 189 if (err < 0)
193 goto out_shutdown; 190 goto out_shutdown;
194 191
195 *pid_out = err; 192 *pid_out = err;
196 return new; 193 return new;
197 194
198 out_shutdown: 195 out_shutdown:
199 os_shutdown_socket(socket[0], 1, 1); 196 shutdown(socket[0], SHUT_RDWR);
200 os_close_file(socket[0]); 197 close(socket[0]);
201 os_shutdown_socket(socket[1], 1, 1); 198 shutdown(socket[1], SHUT_RDWR);
202 os_close_file(socket[1]); 199 close(socket[1]);
203 out_close: 200 out_close:
204 os_close_file(new); 201 close(new);
205 return err; 202 return err;
206} 203}
diff --git a/arch/um/drivers/pty.c b/arch/um/drivers/pty.c
index 1e3fd619a837..49c79dda6046 100644
--- a/arch/um/drivers/pty.c
+++ b/arch/um/drivers/pty.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) 2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -6,16 +6,16 @@
6#include <stdio.h> 6#include <stdio.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#include <unistd.h> 8#include <unistd.h>
9#include <string.h>
10#include <fcntl.h>
11#include <errno.h> 9#include <errno.h>
10#include <fcntl.h>
11#include <string.h>
12#include <termios.h> 12#include <termios.h>
13#include <sys/stat.h> 13#include <sys/stat.h>
14#include "chan_user.h" 14#include "chan_user.h"
15#include "os.h"
16#include "user.h"
17#include "kern_constants.h" 15#include "kern_constants.h"
16#include "os.h"
18#include "um_malloc.h" 17#include "um_malloc.h"
18#include "user.h"
19 19
20struct pty_chan { 20struct pty_chan {
21 void (*announce)(char *dev_name, int dev); 21 void (*announce)(char *dev_name, int dev);
@@ -33,7 +33,7 @@ static void *pty_chan_init(char *str, int device, const struct chan_opts *opts)
33 if (data == NULL) 33 if (data == NULL)
34 return NULL; 34 return NULL;
35 35
36 *data = ((struct pty_chan) { .announce = opts->announce, 36 *data = ((struct pty_chan) { .announce = opts->announce,
37 .dev = device, 37 .dev = device,
38 .raw = opts->raw }); 38 .raw = opts->raw });
39 return data; 39 return data;
@@ -56,11 +56,11 @@ static int pts_open(int input, int output, int primary, void *d,
56 if (data->raw) { 56 if (data->raw) {
57 CATCH_EINTR(err = tcgetattr(fd, &data->tt)); 57 CATCH_EINTR(err = tcgetattr(fd, &data->tt));
58 if (err) 58 if (err)
59 return err; 59 goto out_close;
60 60
61 err = raw(fd); 61 err = raw(fd);
62 if (err) 62 if (err)
63 return err; 63 goto out_close;
64 } 64 }
65 65
66 dev = ptsname(fd); 66 dev = ptsname(fd);
@@ -71,6 +71,10 @@ static int pts_open(int input, int output, int primary, void *d,
71 (*data->announce)(dev, data->dev); 71 (*data->announce)(dev, data->dev);
72 72
73 return fd; 73 return fd;
74
75out_close:
76 close(fd);
77 return err;
74} 78}
75 79
76static int getmaster(char *line) 80static int getmaster(char *line)
@@ -97,7 +101,7 @@ static int getmaster(char *line)
97 *tp = 't'; 101 *tp = 't';
98 err = access(line, R_OK | W_OK); 102 err = access(line, R_OK | W_OK);
99 *tp = 'p'; 103 *tp = 'p';
100 if(!err) 104 if (!err)
101 return master; 105 return master;
102 close(master); 106 close(master);
103 } 107 }
@@ -119,12 +123,14 @@ static int pty_open(int input, int output, int primary, void *d,
119 if (fd < 0) 123 if (fd < 0)
120 return fd; 124 return fd;
121 125
122 if(data->raw){ 126 if (data->raw) {
123 err = raw(fd); 127 err = raw(fd);
124 if (err) 128 if (err) {
129 close(fd);
125 return err; 130 return err;
131 }
126 } 132 }
127 133
128 if (data->announce) 134 if (data->announce)
129 (*data->announce)(dev, data->dev); 135 (*data->announce)(dev, data->dev);
130 136
diff --git a/arch/um/drivers/slip_kern.c b/arch/um/drivers/slip_kern.c
index 125c44f77638..ae67e7158e71 100644
--- a/arch/um/drivers/slip_kern.c
+++ b/arch/um/drivers/slip_kern.c
@@ -1,11 +1,12 @@
1#include "linux/kernel.h" 1/*
2#include "linux/stddef.h" 2 * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3#include "linux/init.h" 3 * Licensed under the GPL.
4#include "linux/netdevice.h" 4 */
5#include "linux/if_arp.h" 5
6#include <linux/if_arp.h>
7#include <linux/init.h>
8#include <linux/netdevice.h>
6#include "net_kern.h" 9#include "net_kern.h"
7#include "net_user.h"
8#include "kern.h"
9#include "slip.h" 10#include "slip.h"
10 11
11struct slip_init { 12struct slip_init {
@@ -43,21 +44,19 @@ void slip_init(struct net_device *dev, void *data)
43 44
44static unsigned short slip_protocol(struct sk_buff *skbuff) 45static unsigned short slip_protocol(struct sk_buff *skbuff)
45{ 46{
46 return(htons(ETH_P_IP)); 47 return htons(ETH_P_IP);
47} 48}
48 49
49static int slip_read(int fd, struct sk_buff **skb, 50static int slip_read(int fd, struct sk_buff *skb, struct uml_net_private *lp)
50 struct uml_net_private *lp)
51{ 51{
52 return(slip_user_read(fd, skb_mac_header(*skb), (*skb)->dev->mtu, 52 return slip_user_read(fd, skb_mac_header(skb), skb->dev->mtu,
53 (struct slip_data *) &lp->user)); 53 (struct slip_data *) &lp->user);
54} 54}
55 55
56static int slip_write(int fd, struct sk_buff **skb, 56static int slip_write(int fd, struct sk_buff *skb, struct uml_net_private *lp)
57 struct uml_net_private *lp)
58{ 57{
59 return(slip_user_write(fd, (*skb)->data, (*skb)->len, 58 return slip_user_write(fd, skb->data, skb->len,
60 (struct slip_data *) &lp->user)); 59 (struct slip_data *) &lp->user);
61} 60}
62 61
63const struct net_kern_info slip_kern_info = { 62const struct net_kern_info slip_kern_info = {
@@ -71,12 +70,11 @@ static int slip_setup(char *str, char **mac_out, void *data)
71{ 70{
72 struct slip_init *init = data; 71 struct slip_init *init = data;
73 72
74 *init = ((struct slip_init) 73 *init = ((struct slip_init) { .gate_addr = NULL });
75 { .gate_addr = NULL });
76 74
77 if(str[0] != '\0') 75 if (str[0] != '\0')
78 init->gate_addr = str; 76 init->gate_addr = str;
79 return(1); 77 return 1;
80} 78}
81 79
82static struct transport slip_transport = { 80static struct transport slip_transport = {
diff --git a/arch/um/drivers/slip_user.c b/arch/um/drivers/slip_user.c
index c0b73c28cff0..5f06204d6871 100644
--- a/arch/um/drivers/slip_user.c
+++ b/arch/um/drivers/slip_user.c
@@ -1,21 +1,22 @@
1/*
2 * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL.
4 */
5
1#include <stdio.h> 6#include <stdio.h>
2#include <stdlib.h> 7#include <stdlib.h>
3#include <unistd.h> 8#include <unistd.h>
4#include <stddef.h>
5#include <sched.h>
6#include <string.h>
7#include <errno.h> 9#include <errno.h>
10#include <fcntl.h>
11#include <string.h>
8#include <sys/termios.h> 12#include <sys/termios.h>
9#include <sys/wait.h> 13#include <sys/wait.h>
10#include <sys/signal.h> 14#include "kern_constants.h"
11#include "kern_util.h"
12#include "user.h"
13#include "net_user.h" 15#include "net_user.h"
14#include "slip.h"
15#include "slip_common.h"
16#include "os.h" 16#include "os.h"
17#include "slip.h"
17#include "um_malloc.h" 18#include "um_malloc.h"
18#include "kern_constants.h" 19#include "user.h"
19 20
20static int slip_user_init(void *data, void *dev) 21static int slip_user_init(void *data, void *dev)
21{ 22{
@@ -31,8 +32,9 @@ static int set_up_tty(int fd)
31 struct termios tios; 32 struct termios tios;
32 33
33 if (tcgetattr(fd, &tios) < 0) { 34 if (tcgetattr(fd, &tios) < 0) {
34 printk("could not get initial terminal attributes\n"); 35 printk(UM_KERN_ERR "could not get initial terminal "
35 return(-1); 36 "attributes\n");
37 return -1;
36 } 38 }
37 39
38 tios.c_cflag = CS8 | CREAD | HUPCL | CLOCAL; 40 tios.c_cflag = CS8 | CREAD | HUPCL | CLOCAL;
@@ -48,10 +50,10 @@ static int set_up_tty(int fd)
48 cfsetispeed(&tios, B38400); 50 cfsetispeed(&tios, B38400);
49 51
50 if (tcsetattr(fd, TCSAFLUSH, &tios) < 0) { 52 if (tcsetattr(fd, TCSAFLUSH, &tios) < 0) {
51 printk("failed to set terminal attributes\n"); 53 printk(UM_KERN_ERR "failed to set terminal attributes\n");
52 return(-1); 54 return -1;
53 } 55 }
54 return(0); 56 return 0;
55} 57}
56 58
57struct slip_pre_exec_data { 59struct slip_pre_exec_data {
@@ -64,9 +66,11 @@ static void slip_pre_exec(void *arg)
64{ 66{
65 struct slip_pre_exec_data *data = arg; 67 struct slip_pre_exec_data *data = arg;
66 68
67 if(data->stdin >= 0) dup2(data->stdin, 0); 69 if (data->stdin >= 0)
70 dup2(data->stdin, 0);
68 dup2(data->stdout, 1); 71 dup2(data->stdout, 1);
69 if(data->close_me >= 0) os_close_file(data->close_me); 72 if (data->close_me >= 0)
73 close(data->close_me);
70} 74}
71 75
72static int slip_tramp(char **argv, int fd) 76static int slip_tramp(char **argv, int fd)
@@ -76,8 +80,9 @@ static int slip_tramp(char **argv, int fd)
76 int status, pid, fds[2], err, output_len; 80 int status, pid, fds[2], err, output_len;
77 81
78 err = os_pipe(fds, 1, 0); 82 err = os_pipe(fds, 1, 0);
79 if(err < 0){ 83 if (err < 0) {
80 printk("slip_tramp : pipe failed, err = %d\n", -err); 84 printk(UM_KERN_ERR "slip_tramp : pipe failed, err = %d\n",
85 -err);
81 goto out; 86 goto out;
82 } 87 }
83 88
@@ -86,41 +91,42 @@ static int slip_tramp(char **argv, int fd)
86 pe_data.stdout = fds[1]; 91 pe_data.stdout = fds[1];
87 pe_data.close_me = fds[0]; 92 pe_data.close_me = fds[0];
88 err = run_helper(slip_pre_exec, &pe_data, argv); 93 err = run_helper(slip_pre_exec, &pe_data, argv);
89 if(err < 0) 94 if (err < 0)
90 goto out_close; 95 goto out_close;
91 pid = err; 96 pid = err;
92 97
93 output_len = UM_KERN_PAGE_SIZE; 98 output_len = UM_KERN_PAGE_SIZE;
94 output = kmalloc(output_len, UM_GFP_KERNEL); 99 output = kmalloc(output_len, UM_GFP_KERNEL);
95 if(output == NULL){ 100 if (output == NULL) {
96 printk("slip_tramp : failed to allocate output buffer\n"); 101 printk(UM_KERN_ERR "slip_tramp : failed to allocate output "
102 "buffer\n");
97 os_kill_process(pid, 1); 103 os_kill_process(pid, 1);
98 err = -ENOMEM; 104 err = -ENOMEM;
99 goto out_free; 105 goto out_free;
100 } 106 }
101 107
102 os_close_file(fds[1]); 108 close(fds[1]);
103 read_output(fds[0], output, output_len); 109 read_output(fds[0], output, output_len);
104 printk("%s", output); 110 printk("%s", output);
105 111
106 CATCH_EINTR(err = waitpid(pid, &status, 0)); 112 CATCH_EINTR(err = waitpid(pid, &status, 0));
107 if(err < 0) 113 if (err < 0)
108 err = errno; 114 err = errno;
109 else if(!WIFEXITED(status) || (WEXITSTATUS(status) != 0)){ 115 else if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) {
110 printk("'%s' didn't exit with status 0\n", argv[0]); 116 printk(UM_KERN_ERR "'%s' didn't exit with status 0\n", argv[0]);
111 err = -EINVAL; 117 err = -EINVAL;
112 } 118 }
113 else err = 0; 119 else err = 0;
114 120
115 os_close_file(fds[0]); 121 close(fds[0]);
116 122
117out_free: 123out_free:
118 kfree(output); 124 kfree(output);
119 return err; 125 return err;
120 126
121out_close: 127out_close:
122 os_close_file(fds[0]); 128 close(fds[0]);
123 os_close_file(fds[1]); 129 close(fds[1]);
124out: 130out:
125 return err; 131 return err;
126} 132}
@@ -130,60 +136,64 @@ static int slip_open(void *data)
130 struct slip_data *pri = data; 136 struct slip_data *pri = data;
131 char version_buf[sizeof("nnnnn\0")]; 137 char version_buf[sizeof("nnnnn\0")];
132 char gate_buf[sizeof("nnn.nnn.nnn.nnn\0")]; 138 char gate_buf[sizeof("nnn.nnn.nnn.nnn\0")];
133 char *argv[] = { "uml_net", version_buf, "slip", "up", gate_buf, 139 char *argv[] = { "uml_net", version_buf, "slip", "up", gate_buf,
134 NULL }; 140 NULL };
135 int sfd, mfd, err; 141 int sfd, mfd, err;
136 142
137 err = get_pty(); 143 err = get_pty();
138 if(err < 0){ 144 if (err < 0) {
139 printk("slip-open : Failed to open pty, err = %d\n", -err); 145 printk(UM_KERN_ERR "slip-open : Failed to open pty, err = %d\n",
146 -err);
140 goto out; 147 goto out;
141 } 148 }
142 mfd = err; 149 mfd = err;
143 150
144 err = os_open_file(ptsname(mfd), of_rdwr(OPENFLAGS()), 0); 151 err = open(ptsname(mfd), O_RDWR, 0);
145 if(err < 0){ 152 if (err < 0) {
146 printk("Couldn't open tty for slip line, err = %d\n", -err); 153 printk(UM_KERN_ERR "Couldn't open tty for slip line, "
154 "err = %d\n", -err);
147 goto out_close; 155 goto out_close;
148 } 156 }
149 sfd = err; 157 sfd = err;
150 158
151 if(set_up_tty(sfd)) 159 if (set_up_tty(sfd))
152 goto out_close2; 160 goto out_close2;
153 161
154 pri->slave = sfd; 162 pri->slave = sfd;
155 pri->slip.pos = 0; 163 pri->slip.pos = 0;
156 pri->slip.esc = 0; 164 pri->slip.esc = 0;
157 if(pri->gate_addr != NULL){ 165 if (pri->gate_addr != NULL) {
158 sprintf(version_buf, "%d", UML_NET_VERSION); 166 sprintf(version_buf, "%d", UML_NET_VERSION);
159 strcpy(gate_buf, pri->gate_addr); 167 strcpy(gate_buf, pri->gate_addr);
160 168
161 err = slip_tramp(argv, sfd); 169 err = slip_tramp(argv, sfd);
162 170
163 if(err < 0){ 171 if (err < 0) {
164 printk("slip_tramp failed - err = %d\n", -err); 172 printk(UM_KERN_ERR "slip_tramp failed - err = %d\n",
173 -err);
165 goto out_close2; 174 goto out_close2;
166 } 175 }
167 err = os_get_ifname(pri->slave, pri->name); 176 err = os_get_ifname(pri->slave, pri->name);
168 if(err < 0){ 177 if (err < 0) {
169 printk("get_ifname failed, err = %d\n", -err); 178 printk(UM_KERN_ERR "get_ifname failed, err = %d\n",
179 -err);
170 goto out_close2; 180 goto out_close2;
171 } 181 }
172 iter_addresses(pri->dev, open_addr, pri->name); 182 iter_addresses(pri->dev, open_addr, pri->name);
173 } 183 }
174 else { 184 else {
175 err = os_set_slip(sfd); 185 err = os_set_slip(sfd);
176 if(err < 0){ 186 if (err < 0) {
177 printk("Failed to set slip discipline encapsulation - " 187 printk(UM_KERN_ERR "Failed to set slip discipline "
178 "err = %d\n", -err); 188 "encapsulation - err = %d\n", -err);
179 goto out_close2; 189 goto out_close2;
180 } 190 }
181 } 191 }
182 return(mfd); 192 return mfd;
183out_close2: 193out_close2:
184 os_close_file(sfd); 194 close(sfd);
185out_close: 195out_close:
186 os_close_file(mfd); 196 close(mfd);
187out: 197out:
188 return err; 198 return err;
189} 199}
@@ -192,21 +202,21 @@ static void slip_close(int fd, void *data)
192{ 202{
193 struct slip_data *pri = data; 203 struct slip_data *pri = data;
194 char version_buf[sizeof("nnnnn\0")]; 204 char version_buf[sizeof("nnnnn\0")];
195 char *argv[] = { "uml_net", version_buf, "slip", "down", pri->name, 205 char *argv[] = { "uml_net", version_buf, "slip", "down", pri->name,
196 NULL }; 206 NULL };
197 int err; 207 int err;
198 208
199 if(pri->gate_addr != NULL) 209 if (pri->gate_addr != NULL)
200 iter_addresses(pri->dev, close_addr, pri->name); 210 iter_addresses(pri->dev, close_addr, pri->name);
201 211
202 sprintf(version_buf, "%d", UML_NET_VERSION); 212 sprintf(version_buf, "%d", UML_NET_VERSION);
203 213
204 err = slip_tramp(argv, pri->slave); 214 err = slip_tramp(argv, pri->slave);
205 215
206 if(err != 0) 216 if (err != 0)
207 printk("slip_tramp failed - errno = %d\n", -err); 217 printk(UM_KERN_ERR "slip_tramp failed - errno = %d\n", -err);
208 os_close_file(fd); 218 close(fd);
209 os_close_file(pri->slave); 219 close(pri->slave);
210 pri->slave = -1; 220 pri->slave = -1;
211} 221}
212 222
@@ -220,17 +230,13 @@ int slip_user_write(int fd, void *buf, int len, struct slip_data *pri)
220 return slip_proto_write(fd, buf, len, &pri->slip); 230 return slip_proto_write(fd, buf, len, &pri->slip);
221} 231}
222 232
223static int slip_set_mtu(int mtu, void *data)
224{
225 return(mtu);
226}
227
228static void slip_add_addr(unsigned char *addr, unsigned char *netmask, 233static void slip_add_addr(unsigned char *addr, unsigned char *netmask,
229 void *data) 234 void *data)
230{ 235{
231 struct slip_data *pri = data; 236 struct slip_data *pri = data;
232 237
233 if(pri->slave < 0) return; 238 if (pri->slave < 0)
239 return;
234 open_addr(addr, netmask, pri->name); 240 open_addr(addr, netmask, pri->name);
235} 241}
236 242
@@ -239,7 +245,8 @@ static void slip_del_addr(unsigned char *addr, unsigned char *netmask,
239{ 245{
240 struct slip_data *pri = data; 246 struct slip_data *pri = data;
241 247
242 if(pri->slave < 0) return; 248 if (pri->slave < 0)
249 return;
243 close_addr(addr, netmask, pri->name); 250 close_addr(addr, netmask, pri->name);
244} 251}
245 252
@@ -248,8 +255,8 @@ const struct net_user_info slip_user_info = {
248 .open = slip_open, 255 .open = slip_open,
249 .close = slip_close, 256 .close = slip_close,
250 .remove = NULL, 257 .remove = NULL,
251 .set_mtu = slip_set_mtu,
252 .add_address = slip_add_addr, 258 .add_address = slip_add_addr,
253 .delete_address = slip_del_addr, 259 .delete_address = slip_del_addr,
254 .max_packet = BUF_SIZE 260 .mtu = BUF_SIZE,
261 .max_packet = BUF_SIZE,
255}; 262};
diff --git a/arch/um/drivers/slirp_kern.c b/arch/um/drivers/slirp_kern.c
index 0a0324a6d290..240ee650865d 100644
--- a/arch/um/drivers/slirp_kern.c
+++ b/arch/um/drivers/slirp_kern.c
@@ -1,11 +1,14 @@
1#include "linux/kernel.h" 1/*
2#include "linux/stddef.h" 2 * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL.
4 */
5
6#include <linux/if_arp.h>
3#include "linux/init.h" 7#include "linux/init.h"
4#include "linux/netdevice.h" 8#include <linux/netdevice.h>
5#include "linux/if_arp.h" 9#include <linux/string.h>
6#include "net_kern.h" 10#include "net_kern.h"
7#include "net_user.h" 11#include "net_user.h"
8#include "kern.h"
9#include "slirp.h" 12#include "slirp.h"
10 13
11struct slirp_init { 14struct slirp_init {
@@ -39,29 +42,26 @@ void slirp_init(struct net_device *dev, void *data)
39 dev->tx_queue_len = 256; 42 dev->tx_queue_len = 256;
40 dev->flags = IFF_NOARP; 43 dev->flags = IFF_NOARP;
41 printk("SLIRP backend - command line:"); 44 printk("SLIRP backend - command line:");
42 for(i=0;spri->argw.argv[i]!=NULL;i++) { 45 for (i = 0; spri->argw.argv[i] != NULL; i++)
43 printk(" '%s'",spri->argw.argv[i]); 46 printk(" '%s'",spri->argw.argv[i]);
44 }
45 printk("\n"); 47 printk("\n");
46} 48}
47 49
48static unsigned short slirp_protocol(struct sk_buff *skbuff) 50static unsigned short slirp_protocol(struct sk_buff *skbuff)
49{ 51{
50 return(htons(ETH_P_IP)); 52 return htons(ETH_P_IP);
51} 53}
52 54
53static int slirp_read(int fd, struct sk_buff **skb, 55static int slirp_read(int fd, struct sk_buff *skb, struct uml_net_private *lp)
54 struct uml_net_private *lp)
55{ 56{
56 return(slirp_user_read(fd, skb_mac_header(*skb), (*skb)->dev->mtu, 57 return slirp_user_read(fd, skb_mac_header(skb), skb->dev->mtu,
57 (struct slirp_data *) &lp->user)); 58 (struct slirp_data *) &lp->user);
58} 59}
59 60
60static int slirp_write(int fd, struct sk_buff **skb, 61static int slirp_write(int fd, struct sk_buff *skb, struct uml_net_private *lp)
61 struct uml_net_private *lp)
62{ 62{
63 return(slirp_user_write(fd, (*skb)->data, (*skb)->len, 63 return slirp_user_write(fd, skb->data, skb->len,
64 (struct slirp_data *) &lp->user)); 64 (struct slirp_data *) &lp->user);
65} 65}
66 66
67const struct net_kern_info slirp_kern_info = { 67const struct net_kern_info slirp_kern_info = {
@@ -76,31 +76,32 @@ static int slirp_setup(char *str, char **mac_out, void *data)
76 struct slirp_init *init = data; 76 struct slirp_init *init = data;
77 int i=0; 77 int i=0;
78 78
79 *init = ((struct slirp_init) 79 *init = ((struct slirp_init) { .argw = { { "slirp", NULL } } });
80 { .argw = { { "slirp", NULL } } });
81 80
82 str = split_if_spec(str, mac_out, NULL); 81 str = split_if_spec(str, mac_out, NULL);
83 82
84 if(str == NULL) { /* no command line given after MAC addr */ 83 if (str == NULL) /* no command line given after MAC addr */
85 return(1); 84 return 1;
86 }
87 85
88 do { 86 do {
89 if(i>=SLIRP_MAX_ARGS-1) { 87 if (i >= SLIRP_MAX_ARGS - 1) {
90 printk("slirp_setup: truncating slirp arguments\n"); 88 printk(KERN_WARNING "slirp_setup: truncating slirp "
89 "arguments\n");
91 break; 90 break;
92 } 91 }
93 init->argw.argv[i++] = str; 92 init->argw.argv[i++] = str;
94 while(*str && *str!=',') { 93 while(*str && *str!=',') {
95 if(*str=='_') *str=' '; 94 if (*str == '_')
95 *str=' ';
96 str++; 96 str++;
97 } 97 }
98 if(*str!=',') 98 if (*str != ',')
99 break; 99 break;
100 *str++='\0'; 100 *str++ = '\0';
101 } while(1); 101 } while (1);
102 init->argw.argv[i]=NULL; 102
103 return(1); 103 init->argw.argv[i] = NULL;
104 return 1;
104} 105}
105 106
106static struct transport slirp_transport = { 107static struct transport slirp_transport = {
diff --git a/arch/um/drivers/slirp_user.c b/arch/um/drivers/slirp_user.c
index 0e462f64f227..1865089ff41a 100644
--- a/arch/um/drivers/slirp_user.c
+++ b/arch/um/drivers/slirp_user.c
@@ -1,18 +1,17 @@
1#include <stdio.h> 1/*
2#include <stdlib.h> 2 * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL.
4 */
5
3#include <unistd.h> 6#include <unistd.h>
4#include <stddef.h>
5#include <sched.h>
6#include <string.h>
7#include <errno.h> 7#include <errno.h>
8#include <string.h>
8#include <sys/wait.h> 9#include <sys/wait.h>
9#include <sys/signal.h> 10#include "kern_constants.h"
10#include "kern_util.h"
11#include "user.h"
12#include "net_user.h" 11#include "net_user.h"
13#include "slirp.h"
14#include "slip_common.h"
15#include "os.h" 12#include "os.h"
13#include "slirp.h"
14#include "user.h"
16 15
17static int slirp_user_init(void *data, void *dev) 16static int slirp_user_init(void *data, void *dev)
18{ 17{
@@ -31,8 +30,10 @@ static void slirp_pre_exec(void *arg)
31{ 30{
32 struct slirp_pre_exec_data *data = arg; 31 struct slirp_pre_exec_data *data = arg;
33 32
34 if(data->stdin != -1) dup2(data->stdin, 0); 33 if (data->stdin != -1)
35 if(data->stdout != -1) dup2(data->stdout, 1); 34 dup2(data->stdin, 0);
35 if (data->stdout != -1)
36 dup2(data->stdout, 1);
36} 37}
37 38
38static int slirp_tramp(char **argv, int fd) 39static int slirp_tramp(char **argv, int fd)
@@ -44,7 +45,7 @@ static int slirp_tramp(char **argv, int fd)
44 pe_data.stdout = fd; 45 pe_data.stdout = fd;
45 pid = run_helper(slirp_pre_exec, &pe_data, argv); 46 pid = run_helper(slirp_pre_exec, &pe_data, argv);
46 47
47 return(pid); 48 return pid;
48} 49}
49 50
50static int slirp_open(void *data) 51static int slirp_open(void *data)
@@ -53,12 +54,12 @@ static int slirp_open(void *data)
53 int fds[2], pid, err; 54 int fds[2], pid, err;
54 55
55 err = os_pipe(fds, 1, 1); 56 err = os_pipe(fds, 1, 1);
56 if(err) 57 if (err)
57 return(err); 58 return err;
58 59
59 err = slirp_tramp(pri->argw.argv, fds[1]); 60 err = slirp_tramp(pri->argw.argv, fds[1]);
60 if(err < 0){ 61 if (err < 0) {
61 printk("slirp_tramp failed - errno = %d\n", -err); 62 printk(UM_KERN_ERR "slirp_tramp failed - errno = %d\n", -err);
62 goto out; 63 goto out;
63 } 64 }
64 pid = err; 65 pid = err;
@@ -68,10 +69,10 @@ static int slirp_open(void *data)
68 pri->slip.esc = 0; 69 pri->slip.esc = 0;
69 pri->pid = err; 70 pri->pid = err;
70 71
71 return(fds[0]); 72 return fds[0];
72out: 73out:
73 os_close_file(fds[0]); 74 close(fds[0]);
74 os_close_file(fds[1]); 75 close(fds[1]);
75 return err; 76 return err;
76} 77}
77 78
@@ -80,31 +81,33 @@ static void slirp_close(int fd, void *data)
80 struct slirp_data *pri = data; 81 struct slirp_data *pri = data;
81 int status,err; 82 int status,err;
82 83
83 os_close_file(fd); 84 close(fd);
84 os_close_file(pri->slave); 85 close(pri->slave);
85 86
86 pri->slave = -1; 87 pri->slave = -1;
87 88
88 if(pri->pid<1) { 89 if (pri->pid<1) {
89 printk("slirp_close: no child process to shut down\n"); 90 printk(UM_KERN_ERR "slirp_close: no child process to shut "
91 "down\n");
90 return; 92 return;
91 } 93 }
92 94
93#if 0 95#if 0
94 if(kill(pri->pid, SIGHUP)<0) { 96 if (kill(pri->pid, SIGHUP)<0) {
95 printk("slirp_close: sending hangup to %d failed (%d)\n", 97 printk(UM_KERN_ERR "slirp_close: sending hangup to %d failed "
96 pri->pid, errno); 98 "(%d)\n", pri->pid, errno);
97 } 99 }
98#endif 100#endif
99 101
100 CATCH_EINTR(err = waitpid(pri->pid, &status, WNOHANG)); 102 CATCH_EINTR(err = waitpid(pri->pid, &status, WNOHANG));
101 if(err < 0) { 103 if (err < 0) {
102 printk("slirp_close: waitpid returned %d\n", errno); 104 printk(UM_KERN_ERR "slirp_close: waitpid returned %d\n", errno);
103 return; 105 return;
104 } 106 }
105 107
106 if(err == 0) { 108 if (err == 0) {
107 printk("slirp_close: process %d has not exited\n", pri->pid); 109 printk(UM_KERN_ERR "slirp_close: process %d has not exited\n",
110 pri->pid);
108 return; 111 return;
109 } 112 }
110 113
@@ -121,18 +124,13 @@ int slirp_user_write(int fd, void *buf, int len, struct slirp_data *pri)
121 return slip_proto_write(fd, buf, len, &pri->slip); 124 return slip_proto_write(fd, buf, len, &pri->slip);
122} 125}
123 126
124static int slirp_set_mtu(int mtu, void *data)
125{
126 return(mtu);
127}
128
129const struct net_user_info slirp_user_info = { 127const struct net_user_info slirp_user_info = {
130 .init = slirp_user_init, 128 .init = slirp_user_init,
131 .open = slirp_open, 129 .open = slirp_open,
132 .close = slirp_close, 130 .close = slirp_close,
133 .remove = NULL, 131 .remove = NULL,
134 .set_mtu = slirp_set_mtu,
135 .add_address = NULL, 132 .add_address = NULL,
136 .delete_address = NULL, 133 .delete_address = NULL,
137 .max_packet = BUF_SIZE 134 .mtu = BUF_SIZE,
135 .max_packet = BUF_SIZE,
138}; 136};
diff --git a/arch/um/drivers/tty.c b/arch/um/drivers/tty.c
index a9f87e19c5bf..c930fedc5172 100644
--- a/arch/um/drivers/tty.c
+++ b/arch/um/drivers/tty.c
@@ -1,16 +1,16 @@
1/* 1/*
2 * Copyright (C) 2001 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stdio.h>
7#include <termios.h>
8#include <errno.h> 6#include <errno.h>
9#include <unistd.h> 7#include <fcntl.h>
8#include <termios.h>
10#include "chan_user.h" 9#include "chan_user.h"
11#include "user.h" 10#include "kern_constants.h"
12#include "os.h" 11#include "os.h"
13#include "um_malloc.h" 12#include "um_malloc.h"
13#include "user.h"
14 14
15struct tty_chan { 15struct tty_chan {
16 char *dev; 16 char *dev;
@@ -22,15 +22,15 @@ static void *tty_chan_init(char *str, int device, const struct chan_opts *opts)
22{ 22{
23 struct tty_chan *data; 23 struct tty_chan *data;
24 24
25 if(*str != ':'){ 25 if (*str != ':') {
26 printk("tty_init : channel type 'tty' must specify " 26 printk(UM_KERN_ERR "tty_init : channel type 'tty' must specify "
27 "a device\n"); 27 "a device\n");
28 return NULL; 28 return NULL;
29 } 29 }
30 str++; 30 str++;
31 31
32 data = kmalloc(sizeof(*data), UM_GFP_KERNEL); 32 data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
33 if(data == NULL) 33 if (data == NULL)
34 return NULL; 34 return NULL;
35 *data = ((struct tty_chan) { .dev = str, 35 *data = ((struct tty_chan) { .dev = str,
36 .raw = opts->raw }); 36 .raw = opts->raw });
@@ -42,19 +42,26 @@ static int tty_open(int input, int output, int primary, void *d,
42 char **dev_out) 42 char **dev_out)
43{ 43{
44 struct tty_chan *data = d; 44 struct tty_chan *data = d;
45 int fd, err; 45 int fd, err, mode = 0;
46
47 if (input && output)
48 mode = O_RDWR;
49 else if (input)
50 mode = O_RDONLY;
51 else if (output)
52 mode = O_WRONLY;
46 53
47 fd = os_open_file(data->dev, of_set_rw(OPENFLAGS(), input, output), 0); 54 fd = open(data->dev, mode);
48 if(fd < 0) 55 if (fd < 0)
49 return fd; 56 return -errno;
50 57
51 if(data->raw){ 58 if (data->raw) {
52 CATCH_EINTR(err = tcgetattr(fd, &data->tt)); 59 CATCH_EINTR(err = tcgetattr(fd, &data->tt));
53 if(err) 60 if (err)
54 return err; 61 return err;
55 62
56 err = raw(fd); 63 err = raw(fd);
57 if(err) 64 if (err)
58 return err; 65 return err;
59 } 66 }
60 67
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 0eabe73c964d..25b248a02507 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -615,7 +615,7 @@ static int ubd_open_dev(struct ubd *ubd_dev)
615 blk_queue_max_sectors(ubd_dev->queue, 8 * sizeof(long)); 615 blk_queue_max_sectors(ubd_dev->queue, 8 * sizeof(long));
616 616
617 err = -ENOMEM; 617 err = -ENOMEM;
618 ubd_dev->cow.bitmap = (void *) vmalloc(ubd_dev->cow.bitmap_len); 618 ubd_dev->cow.bitmap = vmalloc(ubd_dev->cow.bitmap_len);
619 if(ubd_dev->cow.bitmap == NULL){ 619 if(ubd_dev->cow.bitmap == NULL){
620 printk(KERN_ERR "Failed to vmalloc COW bitmap\n"); 620 printk(KERN_ERR "Failed to vmalloc COW bitmap\n");
621 goto error; 621 goto error;
diff --git a/arch/um/drivers/vde.h b/arch/um/drivers/vde.h
new file mode 100644
index 000000000000..fc3a05902ba1
--- /dev/null
+++ b/arch/um/drivers/vde.h
@@ -0,0 +1,32 @@
1/*
2 * Copyright (C) 2007 Luca Bigliardi (shammash@artha.org).
3 * Licensed under the GPL.
4 */
5
6#ifndef __UM_VDE_H__
7#define __UM_VDE_H__
8
9struct vde_data {
10 char *vde_switch;
11 char *descr;
12 void *args;
13 void *conn;
14 void *dev;
15};
16
17struct vde_init {
18 char *vde_switch;
19 char *descr;
20 int port;
21 char *group;
22 int mode;
23};
24
25extern const struct net_user_info vde_user_info;
26
27extern void vde_init_libstuff(struct vde_data *vpri, struct vde_init *init);
28
29extern int vde_user_read(void *conn, void *buf, int len);
30extern int vde_user_write(void *conn, void *buf, int len);
31
32#endif
diff --git a/arch/um/drivers/vde_kern.c b/arch/um/drivers/vde_kern.c
new file mode 100644
index 000000000000..add7e722defb
--- /dev/null
+++ b/arch/um/drivers/vde_kern.c
@@ -0,0 +1,129 @@
1/*
2 * Copyright (C) 2007 Luca Bigliardi (shammash@artha.org).
3 * Licensed under the GPL.
4 *
5 * Transport usage:
6 * ethN=vde,<vde_switch>,<mac addr>,<port>,<group>,<mode>,<description>
7 *
8 */
9
10#include "linux/init.h"
11#include <linux/netdevice.h>
12#include "net_kern.h"
13#include "net_user.h"
14#include "vde.h"
15
16static void vde_init(struct net_device *dev, void *data)
17{
18 struct vde_init *init = data;
19 struct uml_net_private *pri;
20 struct vde_data *vpri;
21
22 pri = dev->priv;
23 vpri = (struct vde_data *) pri->user;
24
25 vpri->vde_switch = init->vde_switch;
26 vpri->descr = init->descr ? init->descr : "UML vde_transport";
27 vpri->args = NULL;
28 vpri->conn = NULL;
29 vpri->dev = dev;
30
31 printk("vde backend - %s, ", vpri->vde_switch ?
32 vpri->vde_switch : "(default socket)");
33
34 vde_init_libstuff(vpri, init);
35
36 printk("\n");
37}
38
39static int vde_read(int fd, struct sk_buff *skb, struct uml_net_private *lp)
40{
41 struct vde_data *pri = (struct vde_data *) &lp->user;
42
43 if (pri->conn != NULL)
44 return vde_user_read(pri->conn, skb_mac_header(skb),
45 skb->dev->mtu + ETH_HEADER_OTHER);
46
47 printk(KERN_ERR "vde_read - we have no VDECONN to read from");
48 return -EBADF;
49}
50
51static int vde_write(int fd, struct sk_buff *skb, struct uml_net_private *lp)
52{
53 struct vde_data *pri = (struct vde_data *) &lp->user;
54
55 if (pri->conn != NULL)
56 return vde_user_write((void *)pri->conn, skb->data,
57 skb->len);
58
59 printk(KERN_ERR "vde_write - we have no VDECONN to write to");
60 return -EBADF;
61}
62
63static const struct net_kern_info vde_kern_info = {
64 .init = vde_init,
65 .protocol = eth_protocol,
66 .read = vde_read,
67 .write = vde_write,
68};
69
70static int vde_setup(char *str, char **mac_out, void *data)
71{
72 struct vde_init *init = data;
73 char *remain, *port_str = NULL, *mode_str = NULL, *last;
74
75 *init = ((struct vde_init)
76 { .vde_switch = NULL,
77 .descr = NULL,
78 .port = 0,
79 .group = NULL,
80 .mode = 0 });
81
82 remain = split_if_spec(str, &init->vde_switch, mac_out, &port_str,
83 &init->group, &mode_str, &init->descr, NULL);
84
85 if (remain != NULL)
86 printk(KERN_WARNING "vde_setup - Ignoring extra data :"
87 "'%s'\n", remain);
88
89 if (port_str != NULL) {
90 init->port = simple_strtoul(port_str, &last, 10);
91 if ((*last != '\0') || (last == port_str)) {
92 printk(KERN_ERR "vde_setup - Bad port : '%s'\n",
93 port_str);
94 return 0;
95 }
96 }
97
98 if (mode_str != NULL) {
99 init->mode = simple_strtoul(mode_str, &last, 8);
100 if ((*last != '\0') || (last == mode_str)) {
101 printk(KERN_ERR "vde_setup - Bad mode : '%s'\n",
102 mode_str);
103 return 0;
104 }
105 }
106
107 printk(KERN_INFO "Configured vde device: %s\n", init->vde_switch ?
108 init->vde_switch : "(default socket)");
109
110 return 1;
111}
112
113static struct transport vde_transport = {
114 .list = LIST_HEAD_INIT(vde_transport.list),
115 .name = "vde",
116 .setup = vde_setup,
117 .user = &vde_user_info,
118 .kern = &vde_kern_info,
119 .private_size = sizeof(struct vde_data),
120 .setup_size = sizeof(struct vde_init),
121};
122
123static int register_vde(void)
124{
125 register_transport(&vde_transport);
126 return 0;
127}
128
129late_initcall(register_vde);
diff --git a/arch/um/drivers/vde_user.c b/arch/um/drivers/vde_user.c
new file mode 100644
index 000000000000..d9941fe5f931
--- /dev/null
+++ b/arch/um/drivers/vde_user.c
@@ -0,0 +1,127 @@
1/*
2 * Copyright (C) 2007 Luca Bigliardi (shammash@artha.org).
3 * Licensed under the GPL.
4 */
5
6#include <stddef.h>
7#include <errno.h>
8#include <libvdeplug.h>
9#include "kern_constants.h"
10#include "net_user.h"
11#include "um_malloc.h"
12#include "user.h"
13#include "vde.h"
14
15static int vde_user_init(void *data, void *dev)
16{
17 struct vde_data *pri = data;
18 VDECONN *conn = NULL;
19 int err = -EINVAL;
20
21 pri->dev = dev;
22
23 conn = vde_open(pri->vde_switch, pri->descr, pri->args);
24
25 if (conn == NULL) {
26 err = -errno;
27 printk(UM_KERN_ERR "vde_user_init: vde_open failed, "
28 "errno = %d\n", errno);
29 return err;
30 }
31
32 printk(UM_KERN_INFO "vde backend - connection opened\n");
33
34 pri->conn = conn;
35
36 return 0;
37}
38
39static int vde_user_open(void *data)
40{
41 struct vde_data *pri = data;
42
43 if (pri->conn != NULL)
44 return vde_datafd(pri->conn);
45
46 printk(UM_KERN_WARNING "vde_open - we have no VDECONN to open");
47 return -EINVAL;
48}
49
50static void vde_remove(void *data)
51{
52 struct vde_data *pri = data;
53
54 if (pri->conn != NULL) {
55 printk(UM_KERN_INFO "vde backend - closing connection\n");
56 vde_close(pri->conn);
57 pri->conn = NULL;
58 kfree(pri->args);
59 pri->args = NULL;
60 return;
61 }
62
63 printk(UM_KERN_WARNING "vde_remove - we have no VDECONN to remove");
64}
65
66const struct net_user_info vde_user_info = {
67 .init = vde_user_init,
68 .open = vde_user_open,
69 .close = NULL,
70 .remove = vde_remove,
71 .add_address = NULL,
72 .delete_address = NULL,
73 .mtu = ETH_MAX_PACKET,
74 .max_packet = ETH_MAX_PACKET + ETH_HEADER_OTHER,
75};
76
77void vde_init_libstuff(struct vde_data *vpri, struct vde_init *init)
78{
79 struct vde_open_args *args;
80
81 vpri->args = kmalloc(sizeof(struct vde_open_args), UM_GFP_KERNEL);
82 if (vpri->args == NULL) {
83 printk(UM_KERN_ERR "vde_init_libstuff - vde_open_args"
84 "allocation failed");
85 return;
86 }
87
88 args = vpri->args;
89
90 args->port = init->port;
91 args->group = init->group;
92 args->mode = init->mode ? init->mode : 0700;
93
94 args->port ? printk(UM_KERN_INFO "port %d", args->port) :
95 printk(UM_KERN_INFO "undefined port");
96}
97
98int vde_user_read(void *conn, void *buf, int len)
99{
100 VDECONN *vconn = conn;
101 int rv;
102
103 if (vconn == NULL)
104 return 0;
105
106 rv = vde_recv(vconn, buf, len, 0);
107 if (rv < 0) {
108 if (errno == EAGAIN)
109 return 0;
110 return -errno;
111 }
112 else if (rv == 0)
113 return -ENOTCONN;
114
115 return rv;
116}
117
118int vde_user_write(void *conn, void *buf, int len)
119{
120 VDECONN *vconn = conn;
121
122 if (vconn == NULL)
123 return 0;
124
125 return vde_send(vconn, buf, len, 0);
126}
127
diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c
index fd817e541543..8a1c18a9b240 100644
--- a/arch/um/drivers/xterm.c
+++ b/arch/um/drivers/xterm.c
@@ -1,20 +1,21 @@
1/* 1/*
2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) 2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stdlib.h> 6#include <stddef.h>
7#include <stdio.h> 7#include <stdio.h>
8#include <stdlib.h>
8#include <unistd.h> 9#include <unistd.h>
9#include <string.h>
10#include <errno.h> 10#include <errno.h>
11#include <string.h>
11#include <termios.h> 12#include <termios.h>
12#include "chan_user.h" 13#include "chan_user.h"
14#include "kern_constants.h"
13#include "os.h" 15#include "os.h"
14#include "init.h" 16#include "um_malloc.h"
15#include "user.h" 17#include "user.h"
16#include "xterm.h" 18#include "xterm.h"
17#include "kern_constants.h"
18 19
19struct xterm_chan { 20struct xterm_chan {
20 int pid; 21 int pid;
@@ -29,7 +30,7 @@ static void *xterm_init(char *str, int device, const struct chan_opts *opts)
29{ 30{
30 struct xterm_chan *data; 31 struct xterm_chan *data;
31 32
32 data = malloc(sizeof(*data)); 33 data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
33 if (data == NULL) 34 if (data == NULL)
34 return NULL; 35 return NULL;
35 *data = ((struct xterm_chan) { .pid = -1, 36 *data = ((struct xterm_chan) { .pid = -1,
@@ -95,8 +96,10 @@ static int xterm_open(int input, int output, int primary, void *d,
95 if (access(argv[4], X_OK) < 0) 96 if (access(argv[4], X_OK) < 0)
96 argv[4] = "port-helper"; 97 argv[4] = "port-helper";
97 98
98 /* Check that DISPLAY is set, this doesn't guarantee the xterm 99 /*
99 * will work but w/o it we can be pretty sure it won't. */ 100 * Check that DISPLAY is set, this doesn't guarantee the xterm
101 * will work but w/o it we can be pretty sure it won't.
102 */
100 if (getenv("DISPLAY") == NULL) { 103 if (getenv("DISPLAY") == NULL) {
101 printk(UM_KERN_ERR "xterm_open: $DISPLAY not set.\n"); 104 printk(UM_KERN_ERR "xterm_open: $DISPLAY not set.\n");
102 return -ENODEV; 105 return -ENODEV;
@@ -195,7 +198,7 @@ static int xterm_open(int input, int output, int primary, void *d,
195static void xterm_close(int fd, void *d) 198static void xterm_close(int fd, void *d)
196{ 199{
197 struct xterm_chan *data = d; 200 struct xterm_chan *data = d;
198 201
199 if (data->pid != -1) 202 if (data->pid != -1)
200 os_kill_process(data->pid, 1); 203 os_kill_process(data->pid, 1);
201 data->pid = -1; 204 data->pid = -1;
@@ -207,11 +210,6 @@ static void xterm_close(int fd, void *d)
207 os_close_file(fd); 210 os_close_file(fd);
208} 211}
209 212
210static void xterm_free(void *d)
211{
212 free(d);
213}
214
215const struct chan_ops xterm_ops = { 213const struct chan_ops xterm_ops = {
216 .type = "xterm", 214 .type = "xterm",
217 .init = xterm_init, 215 .init = xterm_init,
@@ -221,6 +219,6 @@ const struct chan_ops xterm_ops = {
221 .write = generic_write, 219 .write = generic_write,
222 .console_write = generic_console_write, 220 .console_write = generic_console_write,
223 .window_size = generic_window_size, 221 .window_size = generic_window_size,
224 .free = xterm_free, 222 .free = generic_free,
225 .winch = 1, 223 .winch = 1,
226}; 224};
diff --git a/arch/um/include/arch.h b/arch/um/include/arch.h
index 10ad52daa8c5..49c601ff2bac 100644
--- a/arch/um/include/arch.h
+++ b/arch/um/include/arch.h
@@ -9,7 +9,7 @@
9#include "sysdep/ptrace.h" 9#include "sysdep/ptrace.h"
10 10
11extern void arch_check_bugs(void); 11extern void arch_check_bugs(void);
12extern int arch_fixup(unsigned long address, union uml_pt_regs *regs); 12extern int arch_fixup(unsigned long address, struct uml_pt_regs *regs);
13extern int arch_handle_signal(int sig, union uml_pt_regs *regs); 13extern int arch_handle_signal(int sig, struct uml_pt_regs *regs);
14 14
15#endif 15#endif
diff --git a/arch/um/include/as-layout.h b/arch/um/include/as-layout.h
index fccf187bf4e1..a5cdf953e04a 100644
--- a/arch/um/include/as-layout.h
+++ b/arch/um/include/as-layout.h
@@ -6,6 +6,28 @@
6#ifndef __START_H__ 6#ifndef __START_H__
7#define __START_H__ 7#define __START_H__
8 8
9#include "uml-config.h"
10#include "kern_constants.h"
11
12/*
13 * Assembly doesn't want any casting, but C does, so define these
14 * without casts here, and define new symbols with casts inside the C
15 * section.
16 */
17#define ASM_STUB_CODE (UML_CONFIG_TOP_ADDR - 2 * UM_KERN_PAGE_SIZE)
18#define ASM_STUB_DATA (UML_CONFIG_TOP_ADDR - UM_KERN_PAGE_SIZE)
19#define ASM_STUB_START ASM_STUB_CODE
20
21/*
22 * This file is included by the assembly stubs, which just want the
23 * definitions above.
24 */
25#ifndef __ASSEMBLY__
26
27#define STUB_CODE ((unsigned long) ASM_STUB_CODE)
28#define STUB_DATA ((unsigned long) ASM_STUB_DATA)
29#define STUB_START ((unsigned long) ASM_STUB_START)
30
9#include "sysdep/ptrace.h" 31#include "sysdep/ptrace.h"
10 32
11struct cpu_task { 33struct cpu_task {
@@ -28,8 +50,9 @@ extern unsigned long _unprotected_end;
28extern unsigned long brk_start; 50extern unsigned long brk_start;
29 51
30extern int linux_main(int argc, char **argv); 52extern int linux_main(int argc, char **argv);
31extern void set_cmdline(char *cmd);
32 53
33extern void (*sig_info[])(int, union uml_pt_regs *); 54extern void (*sig_info[])(int, struct uml_pt_regs *);
55
56#endif
34 57
35#endif 58#endif
diff --git a/arch/um/include/choose-mode.h b/arch/um/include/choose-mode.h
deleted file mode 100644
index b87b36a87d91..000000000000
--- a/arch/um/include/choose-mode.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __CHOOSE_MODE_H__
7#define __CHOOSE_MODE_H__
8
9#include "uml-config.h"
10
11#if defined(UML_CONFIG_MODE_TT) && defined(UML_CONFIG_MODE_SKAS)
12#define CHOOSE_MODE(tt, skas) (mode_tt ? (tt) : (skas))
13
14extern int mode_tt;
15static inline void *__choose_mode(void *tt, void *skas) {
16 return mode_tt ? tt : skas;
17}
18
19#define __CHOOSE_MODE(tt, skas) (*( (typeof(tt) *) __choose_mode(&(tt), &(skas))))
20
21#elif defined(UML_CONFIG_MODE_SKAS)
22#define CHOOSE_MODE(tt, skas) (skas)
23
24#elif defined(UML_CONFIG_MODE_TT)
25#define CHOOSE_MODE(tt, skas) (tt)
26
27#else
28#error CONFIG_MODE_SKAS and CONFIG_MODE_TT are both disabled
29#endif
30
31#define CHOOSE_MODE_PROC(tt, skas, args...) \
32 CHOOSE_MODE(tt(args), skas(args))
33
34#ifndef __CHOOSE_MODE
35#define __CHOOSE_MODE(tt, skas) CHOOSE_MODE(tt, skas)
36#endif
37
38#endif
diff --git a/arch/um/include/common-offsets.h b/arch/um/include/common-offsets.h
index 6eee343e53eb..0edab695ed4e 100644
--- a/arch/um/include/common-offsets.h
+++ b/arch/um/include/common-offsets.h
@@ -1,15 +1,13 @@
1/* for use by sys-$SUBARCH/kernel-offsets.c */ 1/* for use by sys-$SUBARCH/kernel-offsets.c */
2 2
3DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE); 3DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE);
4#ifdef CONFIG_MODE_TT
5OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid);
6#endif
7 4
8OFFSET(HOST_TASK_REGS, task_struct, thread.regs); 5OFFSET(HOST_TASK_REGS, task_struct, thread.regs);
9OFFSET(HOST_TASK_PID, task_struct, pid); 6OFFSET(HOST_TASK_PID, task_struct, pid);
10 7
11DEFINE(UM_KERN_PAGE_SIZE, PAGE_SIZE); 8DEFINE(UM_KERN_PAGE_SIZE, PAGE_SIZE);
12DEFINE(UM_KERN_PAGE_MASK, PAGE_MASK); 9DEFINE(UM_KERN_PAGE_MASK, PAGE_MASK);
10DEFINE(UM_KERN_PAGE_SHIFT, PAGE_SHIFT);
13DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC); 11DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC);
14 12
15DEFINE_STR(UM_KERN_EMERG, KERN_EMERG); 13DEFINE_STR(UM_KERN_EMERG, KERN_EMERG);
@@ -34,3 +32,9 @@ DEFINE(UM_GFP_ATOMIC, GFP_ATOMIC);
34DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx)); 32DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
35 33
36DEFINE(UM_THREAD_SIZE, THREAD_SIZE); 34DEFINE(UM_THREAD_SIZE, THREAD_SIZE);
35
36DEFINE(UM_HZ, HZ);
37
38DEFINE(UM_USEC_PER_SEC, USEC_PER_SEC);
39DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC);
40DEFINE(UM_NSEC_PER_USEC, NSEC_PER_USEC);
diff --git a/arch/um/include/irq_user.h b/arch/um/include/irq_user.h
index 15d311b9be9e..884a9c17eea0 100644
--- a/arch/um/include/irq_user.h
+++ b/arch/um/include/irq_user.h
@@ -1,12 +1,12 @@
1/* 1/*
2 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#ifndef __IRQ_USER_H__ 6#ifndef __IRQ_USER_H__
7#define __IRQ_USER_H__ 7#define __IRQ_USER_H__
8 8
9#include "uml-config.h" 9#include "sysdep/ptrace.h"
10 10
11struct irq_fd { 11struct irq_fd {
12 struct irq_fd *next; 12 struct irq_fd *next;
@@ -21,7 +21,7 @@ struct irq_fd {
21 21
22enum { IRQ_READ, IRQ_WRITE }; 22enum { IRQ_READ, IRQ_WRITE };
23 23
24extern void sigio_handler(int sig, union uml_pt_regs *regs); 24extern void sigio_handler(int sig, struct uml_pt_regs *regs);
25extern int activate_fd(int irq, int fd, int type, void *dev_id); 25extern int activate_fd(int irq, int fd, int type, void *dev_id);
26extern void free_irq_by_irq_and_dev(unsigned int irq, void *dev_id); 26extern void free_irq_by_irq_and_dev(unsigned int irq, void *dev_id);
27extern void free_irq_by_fd(int fd); 27extern void free_irq_by_fd(int fd);
@@ -30,8 +30,4 @@ extern void deactivate_fd(int fd, int irqnum);
30extern int deactivate_all_fds(void); 30extern int deactivate_all_fds(void);
31extern int activate_ipi(int fd, int pid); 31extern int activate_ipi(int fd, int pid);
32 32
33#ifdef CONFIG_MODE_TT
34extern void forward_interrupts(int pid);
35#endif
36
37#endif 33#endif
diff --git a/arch/um/include/kern_util.h b/arch/um/include/kern_util.h
index 6c2be26f1d7d..74ce8e5370a6 100644
--- a/arch/um/include/kern_util.h
+++ b/arch/um/include/kern_util.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -8,9 +8,8 @@
8 8
9#include "sysdep/ptrace.h" 9#include "sysdep/ptrace.h"
10#include "sysdep/faultinfo.h" 10#include "sysdep/faultinfo.h"
11#include "uml-config.h"
12 11
13typedef void (*kern_hndl)(int, union uml_pt_regs *); 12typedef void (*kern_hndl)(int, struct uml_pt_regs *);
14 13
15struct kern_handlers { 14struct kern_handlers {
16 kern_hndl relay_signal; 15 kern_hndl relay_signal;
@@ -34,9 +33,6 @@ extern int nsyscalls;
34 UML_ROUND_DOWN(((unsigned long) addr) + PAGE_SIZE - 1) 33 UML_ROUND_DOWN(((unsigned long) addr) + PAGE_SIZE - 1)
35 34
36extern int kernel_fork(unsigned long flags, int (*fn)(void *), void * arg); 35extern int kernel_fork(unsigned long flags, int (*fn)(void *), void * arg);
37#ifdef UML_CONFIG_MODE_TT
38extern unsigned long stack_sp(unsigned long page);
39#endif
40extern int kernel_thread_proc(void *data); 36extern int kernel_thread_proc(void *data);
41extern void syscall_segv(int sig); 37extern void syscall_segv(int sig);
42extern int current_pid(void); 38extern int current_pid(void);
@@ -44,7 +40,7 @@ extern unsigned long alloc_stack(int order, int atomic);
44extern int do_signal(void); 40extern int do_signal(void);
45extern int is_stack_fault(unsigned long sp); 41extern int is_stack_fault(unsigned long sp);
46extern unsigned long segv(struct faultinfo fi, unsigned long ip, 42extern unsigned long segv(struct faultinfo fi, unsigned long ip,
47 int is_user, union uml_pt_regs *regs); 43 int is_user, struct uml_pt_regs *regs);
48extern int handle_page_fault(unsigned long address, unsigned long ip, 44extern int handle_page_fault(unsigned long address, unsigned long ip,
49 int is_write, int is_user, int *code_out); 45 int is_write, int is_user, int *code_out);
50extern void syscall_ready(void); 46extern void syscall_ready(void);
@@ -57,7 +53,7 @@ extern int need_finish_fork(void);
57extern void free_stack(unsigned long stack, int order); 53extern void free_stack(unsigned long stack, int order);
58extern void add_input_request(int op, void (*proc)(int), void *arg); 54extern void add_input_request(int op, void (*proc)(int), void *arg);
59extern char *current_cmd(void); 55extern char *current_cmd(void);
60extern void timer_handler(int sig, union uml_pt_regs *regs); 56extern void timer_handler(int sig, struct uml_pt_regs *regs);
61extern int set_signals(int enable); 57extern int set_signals(int enable);
62extern int pid_to_processor_id(int pid); 58extern int pid_to_processor_id(int pid);
63extern void deliver_signals(void *t); 59extern void deliver_signals(void *t);
@@ -67,9 +63,8 @@ extern void finish_fork(void);
67extern void paging_init(void); 63extern void paging_init(void);
68extern void init_flush_vm(void); 64extern void init_flush_vm(void);
69extern void *syscall_sp(void *t); 65extern void *syscall_sp(void *t);
70extern void syscall_trace(union uml_pt_regs *regs, int entryexit); 66extern void syscall_trace(struct uml_pt_regs *regs, int entryexit);
71extern int hz(void); 67extern unsigned int do_IRQ(int irq, struct uml_pt_regs *regs);
72extern unsigned int do_IRQ(int irq, union uml_pt_regs *regs);
73extern void interrupt_end(void); 68extern void interrupt_end(void);
74extern void initial_thread_cb(void (*proc)(void *), void *arg); 69extern void initial_thread_cb(void (*proc)(void *), void *arg);
75extern int debugger_signal(int status, int pid); 70extern int debugger_signal(int status, int pid);
@@ -79,10 +74,9 @@ extern int init_ptrace_proxy(int idle_pid, int startup, int stop);
79extern int init_parent_proxy(int pid); 74extern int init_parent_proxy(int pid);
80extern int singlestepping(void *t); 75extern int singlestepping(void *t);
81extern void check_stack_overflow(void *ptr); 76extern void check_stack_overflow(void *ptr);
82extern void relay_signal(int sig, union uml_pt_regs *regs); 77extern void relay_signal(int sig, struct uml_pt_regs *regs);
83extern int user_context(unsigned long sp); 78extern int user_context(unsigned long sp);
84extern void timer_irq(union uml_pt_regs *regs); 79extern void timer_irq(struct uml_pt_regs *regs);
85extern void unprotect_stack(unsigned long stack);
86extern void do_uml_exitcalls(void); 80extern void do_uml_exitcalls(void);
87extern int attach_debugger(int idle_pid, int pid, int stop); 81extern int attach_debugger(int idle_pid, int pid, int stop);
88extern int config_gdb(char *str); 82extern int config_gdb(char *str);
@@ -113,11 +107,9 @@ extern void time_init_kern(void);
113 107
114/* Are we disallowed to sleep? Used to choose between GFP_KERNEL and GFP_ATOMIC. */ 108/* Are we disallowed to sleep? Used to choose between GFP_KERNEL and GFP_ATOMIC. */
115extern int __cant_sleep(void); 109extern int __cant_sleep(void);
116extern void sigio_handler(int sig, union uml_pt_regs *regs); 110extern void sigio_handler(int sig, struct uml_pt_regs *regs);
117 111extern void copy_sc(struct uml_pt_regs *regs, void *from);
118extern void copy_sc(union uml_pt_regs *regs, void *from);
119
120extern unsigned long to_irq_stack(unsigned long *mask_out); 112extern unsigned long to_irq_stack(unsigned long *mask_out);
121unsigned long from_irq_stack(int nested); 113unsigned long from_irq_stack(int nested);
122 114extern int start_uml(void);
123#endif 115#endif
diff --git a/arch/um/include/mconsole.h b/arch/um/include/mconsole.h
index b282839c1625..c139ae1d6826 100644
--- a/arch/um/include/mconsole.h
+++ b/arch/um/include/mconsole.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) 2 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org)
3 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) 3 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 * Licensed under the GPL 4 * Licensed under the GPL
5 */ 5 */
6 6
@@ -63,7 +63,7 @@ struct mc_request
63 63
64 struct mconsole_request request; 64 struct mconsole_request request;
65 struct mconsole_command *cmd; 65 struct mconsole_command *cmd;
66 union uml_pt_regs regs; 66 struct uml_pt_regs regs;
67}; 67};
68 68
69extern char mconsole_socket_name[]; 69extern char mconsole_socket_name[];
@@ -96,14 +96,3 @@ extern void lock_notify(void);
96extern void unlock_notify(void); 96extern void unlock_notify(void);
97 97
98#endif 98#endif
99
100/*
101 * Overrides for Emacs so that we follow Linus's tabbing style.
102 * Emacs will notice this stuff at the end of the file and automatically
103 * adjust the settings for this buffer only. This must remain at the end
104 * of the file.
105 * ---------------------------------------------------------------------------
106 * Local variables:
107 * c-file-style: "linux"
108 * End:
109 */
diff --git a/arch/um/include/mem.h b/arch/um/include/mem.h
index e8ff0d8fa610..5cd40e99e8d5 100644
--- a/arch/um/include/mem.h
+++ b/arch/um/include/mem.h
@@ -1,18 +1,12 @@
1/* 1/*
2 * Copyright (C) 2002, 2003 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#ifndef __MEM_H__ 6#ifndef __MEM_H__
7#define __MEM_H__ 7#define __MEM_H__
8 8
9#include "linux/types.h" 9extern int phys_mapping(unsigned long phys, unsigned long long *offset_out);
10
11extern int phys_mapping(unsigned long phys, __u64 *offset_out);
12extern int physmem_subst_mapping(void *virt, int fd, __u64 offset, int w);
13extern int is_remapped(void *virt);
14extern int physmem_remove_mapping(void *virt);
15extern void physmem_forget_descriptor(int fd);
16 10
17extern unsigned long uml_physmem; 11extern unsigned long uml_physmem;
18static inline unsigned long to_phys(void *virt) 12static inline unsigned long to_phys(void *virt)
@@ -26,14 +20,3 @@ static inline void *to_virt(unsigned long phys)
26} 20}
27 21
28#endif 22#endif
29
30/*
31 * Overrides for Emacs so that we follow Linus's tabbing style.
32 * Emacs will notice this stuff at the end of the file and automatically
33 * adjust the settings for this buffer only. This must remain at the end
34 * of the file.
35 * ---------------------------------------------------------------------------
36 * Local variables:
37 * c-file-style: "linux"
38 * End:
39 */
diff --git a/arch/um/include/mode.h b/arch/um/include/mode.h
deleted file mode 100644
index 786cf563eb05..000000000000
--- a/arch/um/include/mode.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __MODE_H__
7#define __MODE_H__
8
9#include "uml-config.h"
10
11#ifdef UML_CONFIG_MODE_TT
12#include "mode-tt.h"
13#endif
14
15#ifdef UML_CONFIG_MODE_SKAS
16#include "mode-skas.h"
17#endif
18
19#endif
20
21/*
22 * Overrides for Emacs so that we follow Linus's tabbing style.
23 * Emacs will notice this stuff at the end of the file and automatically
24 * adjust the settings for this buffer only. This must remain at the end
25 * of the file.
26 * ---------------------------------------------------------------------------
27 * Local variables:
28 * c-file-style: "linux"
29 * End:
30 */
diff --git a/arch/um/include/mode_kern.h b/arch/um/include/mode_kern.h
deleted file mode 100644
index 88e5e77bf517..000000000000
--- a/arch/um/include/mode_kern.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __MODE_KERN_H__
7#define __MODE_KERN_H__
8
9#ifdef CONFIG_MODE_TT
10#include "mode_kern_tt.h"
11#endif
12
13#ifdef CONFIG_MODE_SKAS
14#include "mode_kern_skas.h"
15#endif
16
17#endif
diff --git a/arch/um/include/net_kern.h b/arch/um/include/net_kern.h
index 9237056b9103..d843c7924a7c 100644
--- a/arch/um/include/net_kern.h
+++ b/arch/um/include/net_kern.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -30,24 +30,24 @@ struct uml_net_private {
30 struct work_struct work; 30 struct work_struct work;
31 int fd; 31 int fd;
32 unsigned char mac[ETH_ALEN]; 32 unsigned char mac[ETH_ALEN];
33 int max_packet;
33 unsigned short (*protocol)(struct sk_buff *); 34 unsigned short (*protocol)(struct sk_buff *);
34 int (*open)(void *); 35 int (*open)(void *);
35 void (*close)(int, void *); 36 void (*close)(int, void *);
36 void (*remove)(void *); 37 void (*remove)(void *);
37 int (*read)(int, struct sk_buff **skb, struct uml_net_private *); 38 int (*read)(int, struct sk_buff *skb, struct uml_net_private *);
38 int (*write)(int, struct sk_buff **skb, struct uml_net_private *); 39 int (*write)(int, struct sk_buff *skb, struct uml_net_private *);
39 40
40 void (*add_address)(unsigned char *, unsigned char *, void *); 41 void (*add_address)(unsigned char *, unsigned char *, void *);
41 void (*delete_address)(unsigned char *, unsigned char *, void *); 42 void (*delete_address)(unsigned char *, unsigned char *, void *);
42 int (*set_mtu)(int mtu, void *);
43 char user[0]; 43 char user[0];
44}; 44};
45 45
46struct net_kern_info { 46struct net_kern_info {
47 void (*init)(struct net_device *, void *); 47 void (*init)(struct net_device *, void *);
48 unsigned short (*protocol)(struct sk_buff *); 48 unsigned short (*protocol)(struct sk_buff *);
49 int (*read)(int, struct sk_buff **skb, struct uml_net_private *); 49 int (*read)(int, struct sk_buff *skb, struct uml_net_private *);
50 int (*write)(int, struct sk_buff **skb, struct uml_net_private *); 50 int (*write)(int, struct sk_buff *skb, struct uml_net_private *);
51}; 51};
52 52
53struct transport { 53struct transport {
@@ -62,7 +62,6 @@ struct transport {
62 62
63extern struct net_device *ether_init(int); 63extern struct net_device *ether_init(int);
64extern unsigned short ether_protocol(struct sk_buff *); 64extern unsigned short ether_protocol(struct sk_buff *);
65extern struct sk_buff *ether_adjust_skb(struct sk_buff *skb, int extra);
66extern int tap_setup_common(char *str, char *type, char **dev_name, 65extern int tap_setup_common(char *str, char *type, char **dev_name,
67 char **mac_out, char **gate_addr); 66 char **mac_out, char **gate_addr);
68extern void register_transport(struct transport *new); 67extern void register_transport(struct transport *new);
diff --git a/arch/um/include/net_user.h b/arch/um/include/net_user.h
index cfe7c50634b9..63bee158cd8e 100644
--- a/arch/um/include/net_user.h
+++ b/arch/um/include/net_user.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -18,10 +18,10 @@ struct net_user_info {
18 int (*open)(void *); 18 int (*open)(void *);
19 void (*close)(int, void *); 19 void (*close)(int, void *);
20 void (*remove)(void *); 20 void (*remove)(void *);
21 int (*set_mtu)(int mtu, void *);
22 void (*add_address)(unsigned char *, unsigned char *, void *); 21 void (*add_address)(unsigned char *, unsigned char *, void *);
23 void (*delete_address)(unsigned char *, unsigned char *, void *); 22 void (*delete_address)(unsigned char *, unsigned char *, void *);
24 int max_packet; 23 int max_packet;
24 int mtu;
25}; 25};
26 26
27extern void ether_user_init(void *data, void *dev); 27extern void ether_user_init(void *data, void *dev);
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index 930b261ea483..fbf0a87c6eaa 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -1,20 +1,18 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#ifndef __OS_H__ 6#ifndef __OS_H__
7#define __OS_H__ 7#define __OS_H__
8 8
9#include "uml-config.h" 9#include <stdarg.h>
10#include "asm/types.h"
11#include "../os/include/file.h"
12#include "sysdep/ptrace.h"
13#include "kern_util.h"
14#include "skas/mm_id.h"
15#include "irq_user.h" 10#include "irq_user.h"
11#include "kern_util.h"
12#include "longjmp.h"
13#include "mm_id.h"
16#include "sysdep/tls.h" 14#include "sysdep/tls.h"
17#include "sysdep/archsetjmp.h" 15#include "../os/include/file.h"
18 16
19#define CATCH_EINTR(expr) while ((errno = 0, ((expr) < 0)) && (errno == EINTR)) 17#define CATCH_EINTR(expr) while ((errno = 0, ((expr) < 0)) && (errno == EINTR))
20 18
@@ -130,18 +128,15 @@ static inline struct openflags of_cloexec(struct openflags flags)
130extern int os_stat_file(const char *file_name, struct uml_stat *buf); 128extern int os_stat_file(const char *file_name, struct uml_stat *buf);
131extern int os_stat_fd(const int fd, struct uml_stat *buf); 129extern int os_stat_fd(const int fd, struct uml_stat *buf);
132extern int os_access(const char *file, int mode); 130extern int os_access(const char *file, int mode);
133extern void os_print_error(int error, const char* str);
134extern int os_get_exec_close(int fd, int *close_on_exec); 131extern int os_get_exec_close(int fd, int *close_on_exec);
135extern int os_set_exec_close(int fd, int close_on_exec); 132extern int os_set_exec_close(int fd);
136extern int os_ioctl_generic(int fd, unsigned int cmd, unsigned long arg); 133extern int os_ioctl_generic(int fd, unsigned int cmd, unsigned long arg);
137extern int os_window_size(int fd, int *rows, int *cols);
138extern int os_new_tty_pgrp(int fd, int pid);
139extern int os_get_ifname(int fd, char *namebuf); 134extern int os_get_ifname(int fd, char *namebuf);
140extern int os_set_slip(int fd); 135extern int os_set_slip(int fd);
141extern int os_set_owner(int fd, int pid); 136extern int os_set_owner(int fd, int pid);
142extern int os_mode_fd(int fd, int mode); 137extern int os_mode_fd(int fd, int mode);
143 138
144extern int os_seek_file(int fd, __u64 offset); 139extern int os_seek_file(int fd, unsigned long long offset);
145extern int os_open_file(char *file, struct openflags flags, int mode); 140extern int os_open_file(char *file, struct openflags flags, int mode);
146extern int os_read_file(int fd, void *buf, int len); 141extern int os_read_file(int fd, void *buf, int len);
147extern int os_write_file(int fd, const void *buf, int count); 142extern int os_write_file(int fd, const void *buf, int count);
@@ -179,11 +174,7 @@ extern void check_host_supports_tls(int *supports_tls, int *tls_min);
179 174
180/* Make sure they are clear when running in TT mode. Required by 175/* Make sure they are clear when running in TT mode. Required by
181 * SEGV_MAYBE_FIXABLE */ 176 * SEGV_MAYBE_FIXABLE */
182#ifdef UML_CONFIG_MODE_SKAS
183#define clear_can_do_skas() do { ptrace_faultinfo = proc_mm = 0; } while (0) 177#define clear_can_do_skas() do { ptrace_faultinfo = proc_mm = 0; } while (0)
184#else
185#define clear_can_do_skas() do {} while (0)
186#endif
187 178
188/* mem.c */ 179/* mem.c */
189extern int create_mem_file(unsigned long long len); 180extern int create_mem_file(unsigned long long len);
@@ -194,20 +185,13 @@ extern int os_process_parent(int pid);
194extern void os_stop_process(int pid); 185extern void os_stop_process(int pid);
195extern void os_kill_process(int pid, int reap_child); 186extern void os_kill_process(int pid, int reap_child);
196extern void os_kill_ptraced_process(int pid, int reap_child); 187extern void os_kill_ptraced_process(int pid, int reap_child);
197#ifdef UML_CONFIG_MODE_TT
198extern void os_usr1_process(int pid);
199#endif
200extern long os_ptrace_ldt(long pid, long addr, long data); 188extern long os_ptrace_ldt(long pid, long addr, long data);
201 189
202extern int os_getpid(void); 190extern int os_getpid(void);
203extern int os_getpgrp(void); 191extern int os_getpgrp(void);
204 192
205#ifdef UML_CONFIG_MODE_TT
206extern void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int));
207extern void stop(void);
208#endif
209extern void init_new_thread_signals(void); 193extern void init_new_thread_signals(void);
210extern int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr); 194extern int run_kernel_thread(int (*fn)(void *), void *arg, jmp_buf **jmp_ptr);
211 195
212extern int os_map_memory(void *virt, int fd, unsigned long long off, 196extern int os_map_memory(void *virt, int fd, unsigned long long off,
213 unsigned long len, int r, int w, int x); 197 unsigned long len, int r, int w, int x);
@@ -218,21 +202,9 @@ extern int os_drop_memory(void *addr, int length);
218extern int can_drop_memory(void); 202extern int can_drop_memory(void);
219extern void os_flush_stdout(void); 203extern void os_flush_stdout(void);
220 204
221/* tt.c
222 * for tt mode only (will be deleted in future...)
223 */
224extern void forward_ipi(int fd, int pid);
225extern void kill_child_dead(int pid);
226extern int wait_for_stop(int pid, int sig, int cont_type, void *relay);
227extern int protect_memory(unsigned long addr, unsigned long len,
228 int r, int w, int x, int must_succeed);
229extern void forward_pending_sigio(int target);
230extern int start_fork_tramp(void *arg, unsigned long temp_stack,
231 int clone_flags, int (*tramp)(void *));
232
233/* uaccess.c */ 205/* uaccess.c */
234extern unsigned long __do_user_copy(void *to, const void *from, int n, 206extern unsigned long __do_user_copy(void *to, const void *from, int n,
235 void **fault_addr, void **fault_catcher, 207 void **fault_addr, jmp_buf **fault_catcher,
236 void (*op)(void *to, const void *from, 208 void (*op)(void *to, const void *from,
237 int n), int *faulted_out); 209 int n), int *faulted_out);
238 210
@@ -255,6 +227,7 @@ extern int set_umid(char *name);
255extern char *get_umid(void); 227extern char *get_umid(void);
256 228
257/* signal.c */ 229/* signal.c */
230extern void timer_init(void);
258extern void set_sigstack(void *sig_stack, int size); 231extern void set_sigstack(void *sig_stack, int size);
259extern void remove_sigstack(void); 232extern void remove_sigstack(void);
260extern void set_handler(int sig, void (*handler)(int), int flags, ...); 233extern void set_handler(int sig, void (*handler)(int), int flags, ...);
@@ -266,7 +239,6 @@ extern int set_signals(int enable);
266 239
267/* trap.c */ 240/* trap.c */
268extern void os_fill_handlinfo(struct kern_handlers h); 241extern void os_fill_handlinfo(struct kern_handlers h);
269extern void do_longjmp(void *p, int val);
270 242
271/* util.c */ 243/* util.c */
272extern void stack_protections(unsigned long address); 244extern void stack_protections(unsigned long address);
@@ -277,17 +249,12 @@ extern int setjmp_wrapper(void (*proc)(void *, void *), ...);
277extern void os_dump_core(void); 249extern void os_dump_core(void);
278 250
279/* time.c */ 251/* time.c */
280#define BILLION (1000 * 1000 * 1000) 252extern void idle_sleep(unsigned long long nsecs);
281 253extern int set_interval(void);
282extern void switch_timers(int to_real); 254extern int timer_one_shot(int ticks);
283extern void idle_sleep(int secs); 255extern long long disable_timer(void);
284extern int set_interval(int is_virtual);
285#ifdef CONFIG_MODE_TT
286extern void enable_timer(void);
287#endif
288extern void disable_timer(void);
289extern void uml_idle_timer(void); 256extern void uml_idle_timer(void);
290extern unsigned long long os_nsecs(void); 257extern long long os_nsecs(void);
291 258
292/* skas/mem.c */ 259/* skas/mem.c */
293extern long run_syscall_stub(struct mm_id * mm_idp, 260extern long run_syscall_stub(struct mm_id * mm_idp,
@@ -308,7 +275,9 @@ extern int protect(struct mm_id * mm_idp, unsigned long addr,
308extern int is_skas_winch(int pid, int fd, void *data); 275extern int is_skas_winch(int pid, int fd, void *data);
309extern int start_userspace(unsigned long stub_stack); 276extern int start_userspace(unsigned long stub_stack);
310extern int copy_context_skas0(unsigned long stack, int pid); 277extern int copy_context_skas0(unsigned long stack, int pid);
311extern void userspace(union uml_pt_regs *regs); 278extern void save_registers(int pid, struct uml_pt_regs *regs);
279extern void restore_registers(int pid, struct uml_pt_regs *regs);
280extern void userspace(struct uml_pt_regs *regs);
312extern void map_stub_pages(int fd, unsigned long code, 281extern void map_stub_pages(int fd, unsigned long code,
313 unsigned long data, unsigned long stack); 282 unsigned long data, unsigned long stack);
314extern void new_thread(void *stack, jmp_buf *buf, void (*handler)(void)); 283extern void new_thread(void *stack, jmp_buf *buf, void (*handler)(void));
diff --git a/arch/um/include/registers.h b/arch/um/include/registers.h
index f845b3629a6d..0e27406a43a4 100644
--- a/arch/um/include/registers.h
+++ b/arch/um/include/registers.h
@@ -9,13 +9,15 @@
9#include "sysdep/ptrace.h" 9#include "sysdep/ptrace.h"
10#include "sysdep/archsetjmp.h" 10#include "sysdep/archsetjmp.h"
11 11
12extern void init_thread_registers(union uml_pt_regs *to); 12extern void init_thread_registers(struct uml_pt_regs *to);
13extern int save_fp_registers(int pid, unsigned long *fp_regs); 13extern int save_fp_registers(int pid, unsigned long *fp_regs);
14extern int restore_fp_registers(int pid, unsigned long *fp_regs); 14extern int restore_fp_registers(int pid, unsigned long *fp_regs);
15extern void save_registers(int pid, union uml_pt_regs *regs); 15extern int save_fpx_registers(int pid, unsigned long *fp_regs);
16extern void restore_registers(int pid, union uml_pt_regs *regs); 16extern int restore_fpx_registers(int pid, unsigned long *fp_regs);
17extern void save_registers(int pid, struct uml_pt_regs *regs);
18extern void restore_registers(int pid, struct uml_pt_regs *regs);
17extern void init_registers(int pid); 19extern void init_registers(int pid);
18extern void get_safe_registers(unsigned long * regs, unsigned long * fp_regs); 20extern void get_safe_registers(unsigned long *regs);
19extern unsigned long get_thread_reg(int reg, jmp_buf *buf); 21extern unsigned long get_thread_reg(int reg, jmp_buf *buf);
20 22
21#endif 23#endif
diff --git a/arch/um/include/skas/mmu-skas.h b/arch/um/include/skas/mmu-skas.h
deleted file mode 100644
index b26986c0c3d2..000000000000
--- a/arch/um/include/skas/mmu-skas.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SKAS_MMU_H
7#define __SKAS_MMU_H
8
9#include "mm_id.h"
10#include "asm/ldt.h"
11
12struct mmu_context_skas {
13 struct mm_id id;
14 unsigned long last_page_table;
15#ifdef CONFIG_3_LEVEL_PGTABLES
16 unsigned long last_pmd;
17#endif
18 uml_ldt_t ldt;
19};
20
21extern void switch_mm_skas(struct mm_id * mm_idp);
22
23#endif
diff --git a/arch/um/include/skas/mode-skas.h b/arch/um/include/skas/mode-skas.h
index 8bc6916bbbb1..e065feb000df 100644
--- a/arch/um/include/skas/mode-skas.h
+++ b/arch/um/include/skas/mode-skas.h
@@ -1,18 +1,11 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#ifndef __MODE_SKAS_H__ 6#ifndef __MODE_SKAS_H__
7#define __MODE_SKAS_H__ 7#define __MODE_SKAS_H__
8 8
9#include <sysdep/ptrace.h>
10
11extern unsigned long exec_regs[];
12extern unsigned long exec_fp_regs[];
13extern unsigned long exec_fpx_regs[];
14extern int have_fpx_regs;
15
16extern void kill_off_processes_skas(void); 9extern void kill_off_processes_skas(void);
17 10
18#endif 11#endif
diff --git a/arch/um/include/skas/mode_kern_skas.h b/arch/um/include/skas/mode_kern_skas.h
deleted file mode 100644
index 8ee6285dfacc..000000000000
--- a/arch/um/include/skas/mode_kern_skas.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SKAS_MODE_KERN_H__
7#define __SKAS_MODE_KERN_H__
8
9#include "linux/sched.h"
10#include "asm/page.h"
11#include "asm/ptrace.h"
12
13extern void flush_thread_skas(void);
14extern void switch_to_skas(void *prev, void *next);
15extern void start_thread_skas(struct pt_regs *regs, unsigned long eip,
16 unsigned long esp);
17extern int copy_thread_skas(int nr, unsigned long clone_flags,
18 unsigned long sp, unsigned long stack_top,
19 struct task_struct *p, struct pt_regs *regs);
20extern void release_thread_skas(struct task_struct *task);
21extern void init_idle_skas(void);
22extern void flush_tlb_kernel_range_skas(unsigned long start,
23 unsigned long end);
24extern void flush_tlb_kernel_vm_skas(void);
25extern void __flush_tlb_one_skas(unsigned long addr);
26extern void flush_tlb_range_skas(struct vm_area_struct *vma,
27 unsigned long start, unsigned long end);
28extern void flush_tlb_mm_skas(struct mm_struct *mm);
29extern void force_flush_all_skas(void);
30extern long execute_syscall_skas(void *r);
31extern void before_mem_skas(unsigned long unused);
32extern unsigned long set_task_sizes_skas(unsigned long *task_size_out);
33extern int start_uml_skas(void);
34extern int external_pid_skas(struct task_struct *task);
35extern int thread_pid_skas(struct task_struct *task);
36extern void flush_tlb_page_skas(struct vm_area_struct *vma,
37 unsigned long address);
38
39#define kmem_end_skas (host_task_size - 1024 * 1024)
40
41#endif
diff --git a/arch/um/include/skas/skas.h b/arch/um/include/skas/skas.h
index e88926b16072..b073f8a86bd3 100644
--- a/arch/um/include/skas/skas.h
+++ b/arch/um/include/skas/skas.h
@@ -1,12 +1,11 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#ifndef __SKAS_H 6#ifndef __SKAS_H
7#define __SKAS_H 7#define __SKAS_H
8 8
9#include "mm_id.h"
10#include "sysdep/ptrace.h" 9#include "sysdep/ptrace.h"
11 10
12extern int userspace_pid[]; 11extern int userspace_pid[];
@@ -15,7 +14,7 @@ extern int skas_needs_stub;
15 14
16extern int user_thread(unsigned long stack, int flags); 15extern int user_thread(unsigned long stack, int flags);
17extern void new_thread_handler(void); 16extern void new_thread_handler(void);
18extern void handle_syscall(union uml_pt_regs *regs); 17extern void handle_syscall(struct uml_pt_regs *regs);
19extern int new_mm(unsigned long stack); 18extern int new_mm(unsigned long stack);
20extern void get_skas_faultinfo(int pid, struct faultinfo * fi); 19extern void get_skas_faultinfo(int pid, struct faultinfo * fi);
21extern long execute_syscall_skas(void *r); 20extern long execute_syscall_skas(void *r);
diff --git a/arch/um/include/skas/uaccess-skas.h b/arch/um/include/skas/uaccess-skas.h
deleted file mode 100644
index 224a75f4c025..000000000000
--- a/arch/um/include/skas/uaccess-skas.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SKAS_UACCESS_H
7#define __SKAS_UACCESS_H
8
9#include "asm/errno.h"
10
11/* No SKAS-specific checking. */
12#define access_ok_skas(type, addr, size) 0
13
14extern int copy_from_user_skas(void *to, const void __user *from, int n);
15extern int copy_to_user_skas(void __user *to, const void *from, int n);
16extern int strncpy_from_user_skas(char *dst, const char __user *src, int count);
17extern int __clear_user_skas(void __user *mem, int len);
18extern int clear_user_skas(void __user *mem, int len);
19extern int strnlen_user_skas(const void __user *str, int len);
20
21#endif
diff --git a/arch/um/include/sysdep-i386/kernel-offsets.h b/arch/um/include/sysdep-i386/kernel-offsets.h
index 97ec9d894d75..5868526b5eef 100644
--- a/arch/um/include/sysdep-i386/kernel-offsets.h
+++ b/arch/um/include/sysdep-i386/kernel-offsets.h
@@ -17,6 +17,5 @@
17 17
18void foo(void) 18void foo(void)
19{ 19{
20 OFFSET(HOST_TASK_DEBUGREGS, task_struct, thread.arch.debugregs);
21#include <common-offsets.h> 20#include <common-offsets.h>
22} 21}
diff --git a/arch/um/include/sysdep-i386/ptrace.h b/arch/um/include/sysdep-i386/ptrace.h
index 52b398bcafcf..11c08969d134 100644
--- a/arch/um/include/sysdep-i386/ptrace.h
+++ b/arch/um/include/sysdep-i386/ptrace.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -9,17 +9,11 @@
9#include "uml-config.h" 9#include "uml-config.h"
10#include "user_constants.h" 10#include "user_constants.h"
11#include "sysdep/faultinfo.h" 11#include "sysdep/faultinfo.h"
12#include "choose-mode.h"
13 12
14#define MAX_REG_NR (UM_FRAME_SIZE / sizeof(unsigned long)) 13#define MAX_REG_NR (UM_FRAME_SIZE / sizeof(unsigned long))
15#define MAX_REG_OFFSET (UM_FRAME_SIZE) 14#define MAX_REG_OFFSET (UM_FRAME_SIZE)
16 15
17#ifdef UML_CONFIG_PT_PROXY
18extern void update_debugregs(int seq);
19#else
20static inline void update_debugregs(int seq) {} 16static inline void update_debugregs(int seq) {}
21#endif
22
23 17
24/* syscall emulation path in ptrace */ 18/* syscall emulation path in ptrace */
25 19
@@ -31,12 +25,6 @@ void set_using_sysemu(int value);
31int get_using_sysemu(void); 25int get_using_sysemu(void);
32extern int sysemu_supported; 26extern int sysemu_supported;
33 27
34#ifdef UML_CONFIG_MODE_TT
35#include "sysdep/sc.h"
36#endif
37
38#ifdef UML_CONFIG_MODE_SKAS
39
40#include "skas_ptregs.h" 28#include "skas_ptregs.h"
41 29
42#define REGS_IP(r) ((r)[HOST_IP]) 30#define REGS_IP(r) ((r)[HOST_IP])
@@ -60,70 +48,36 @@ extern int sysemu_supported;
60 48
61#define REGS_RESTART_SYSCALL(r) IP_RESTART_SYSCALL(REGS_IP(r)) 49#define REGS_RESTART_SYSCALL(r) IP_RESTART_SYSCALL(REGS_IP(r))
62 50
63#endif
64#ifndef PTRACE_SYSEMU_SINGLESTEP 51#ifndef PTRACE_SYSEMU_SINGLESTEP
65#define PTRACE_SYSEMU_SINGLESTEP 32 52#define PTRACE_SYSEMU_SINGLESTEP 32
66#endif 53#endif
67 54
68union uml_pt_regs { 55struct uml_pt_regs {
69#ifdef UML_CONFIG_MODE_TT 56 unsigned long gp[MAX_REG_NR];
70 struct tt_regs { 57 struct faultinfo faultinfo;
71 long syscall; 58 long syscall;
72 void *sc; 59 int is_user;
73 struct faultinfo faultinfo;
74 } tt;
75#endif
76#ifdef UML_CONFIG_MODE_SKAS
77 struct skas_regs {
78 unsigned long regs[MAX_REG_NR];
79 unsigned long fp[HOST_FP_SIZE];
80 unsigned long xfp[HOST_XFP_SIZE];
81 struct faultinfo faultinfo;
82 long syscall;
83 int is_user;
84 } skas;
85#endif
86}; 60};
87 61
88#define EMPTY_UML_PT_REGS { } 62#define EMPTY_UML_PT_REGS { }
89 63
90extern int mode_tt; 64#define UPT_IP(r) REGS_IP((r)->gp)
91 65#define UPT_SP(r) REGS_SP((r)->gp)
92#define UPT_SC(r) ((r)->tt.sc) 66#define UPT_EFLAGS(r) REGS_EFLAGS((r)->gp)
93#define UPT_IP(r) \ 67#define UPT_EAX(r) REGS_EAX((r)->gp)
94 __CHOOSE_MODE(SC_IP(UPT_SC(r)), REGS_IP((r)->skas.regs)) 68#define UPT_EBX(r) REGS_EBX((r)->gp)
95#define UPT_SP(r) \ 69#define UPT_ECX(r) REGS_ECX((r)->gp)
96 __CHOOSE_MODE(SC_SP(UPT_SC(r)), REGS_SP((r)->skas.regs)) 70#define UPT_EDX(r) REGS_EDX((r)->gp)
97#define UPT_EFLAGS(r) \ 71#define UPT_ESI(r) REGS_ESI((r)->gp)
98 __CHOOSE_MODE(SC_EFLAGS(UPT_SC(r)), REGS_EFLAGS((r)->skas.regs)) 72#define UPT_EDI(r) REGS_EDI((r)->gp)
99#define UPT_EAX(r) \ 73#define UPT_EBP(r) REGS_EBP((r)->gp)
100 __CHOOSE_MODE(SC_EAX(UPT_SC(r)), REGS_EAX((r)->skas.regs)) 74#define UPT_ORIG_EAX(r) ((r)->syscall)
101#define UPT_EBX(r) \ 75#define UPT_CS(r) REGS_CS((r)->gp)
102 __CHOOSE_MODE(SC_EBX(UPT_SC(r)), REGS_EBX((r)->skas.regs)) 76#define UPT_SS(r) REGS_SS((r)->gp)
103#define UPT_ECX(r) \ 77#define UPT_DS(r) REGS_DS((r)->gp)
104 __CHOOSE_MODE(SC_ECX(UPT_SC(r)), REGS_ECX((r)->skas.regs)) 78#define UPT_ES(r) REGS_ES((r)->gp)
105#define UPT_EDX(r) \ 79#define UPT_FS(r) REGS_FS((r)->gp)
106 __CHOOSE_MODE(SC_EDX(UPT_SC(r)), REGS_EDX((r)->skas.regs)) 80#define UPT_GS(r) REGS_GS((r)->gp)
107#define UPT_ESI(r) \
108 __CHOOSE_MODE(SC_ESI(UPT_SC(r)), REGS_ESI((r)->skas.regs))
109#define UPT_EDI(r) \
110 __CHOOSE_MODE(SC_EDI(UPT_SC(r)), REGS_EDI((r)->skas.regs))
111#define UPT_EBP(r) \
112 __CHOOSE_MODE(SC_EBP(UPT_SC(r)), REGS_EBP((r)->skas.regs))
113#define UPT_ORIG_EAX(r) \
114 __CHOOSE_MODE((r)->tt.syscall, (r)->skas.syscall)
115#define UPT_CS(r) \
116 __CHOOSE_MODE(SC_CS(UPT_SC(r)), REGS_CS((r)->skas.regs))
117#define UPT_SS(r) \
118 __CHOOSE_MODE(SC_SS(UPT_SC(r)), REGS_SS((r)->skas.regs))
119#define UPT_DS(r) \
120 __CHOOSE_MODE(SC_DS(UPT_SC(r)), REGS_DS((r)->skas.regs))
121#define UPT_ES(r) \
122 __CHOOSE_MODE(SC_ES(UPT_SC(r)), REGS_ES((r)->skas.regs))
123#define UPT_FS(r) \
124 __CHOOSE_MODE(SC_FS(UPT_SC(r)), REGS_FS((r)->skas.regs))
125#define UPT_GS(r) \
126 __CHOOSE_MODE(SC_GS(UPT_SC(r)), REGS_GS((r)->skas.regs))
127 81
128#define UPT_SYSCALL_ARG1(r) UPT_EBX(r) 82#define UPT_SYSCALL_ARG1(r) UPT_EBX(r)
129#define UPT_SYSCALL_ARG2(r) UPT_ECX(r) 83#define UPT_SYSCALL_ARG2(r) UPT_ECX(r)
@@ -134,20 +88,19 @@ extern int mode_tt;
134 88
135extern int user_context(unsigned long sp); 89extern int user_context(unsigned long sp);
136 90
137#define UPT_IS_USER(r) \ 91#define UPT_IS_USER(r) ((r)->is_user)
138 CHOOSE_MODE(user_context(UPT_SP(r)), (r)->skas.is_user)
139 92
140struct syscall_args { 93struct syscall_args {
141 unsigned long args[6]; 94 unsigned long args[6];
142}; 95};
143 96
144#define SYSCALL_ARGS(r) ((struct syscall_args) \ 97#define SYSCALL_ARGS(r) ((struct syscall_args) \
145 { .args = { UPT_SYSCALL_ARG1(r), \ 98 { .args = { UPT_SYSCALL_ARG1(r), \
146 UPT_SYSCALL_ARG2(r), \ 99 UPT_SYSCALL_ARG2(r), \
147 UPT_SYSCALL_ARG3(r), \ 100 UPT_SYSCALL_ARG3(r), \
148 UPT_SYSCALL_ARG4(r), \ 101 UPT_SYSCALL_ARG4(r), \
149 UPT_SYSCALL_ARG5(r), \ 102 UPT_SYSCALL_ARG5(r), \
150 UPT_SYSCALL_ARG6(r) } } ) 103 UPT_SYSCALL_ARG6(r) } } )
151 104
152#define UPT_REG(regs, reg) \ 105#define UPT_REG(regs, reg) \
153 ({ unsigned long val; \ 106 ({ unsigned long val; \
@@ -175,7 +128,6 @@ struct syscall_args {
175 } \ 128 } \
176 val; \ 129 val; \
177 }) 130 })
178
179 131
180#define UPT_SET(regs, reg, val) \ 132#define UPT_SET(regs, reg, val) \
181 do { \ 133 do { \
@@ -204,29 +156,16 @@ struct syscall_args {
204 } while (0) 156 } while (0)
205 157
206#define UPT_SET_SYSCALL_RETURN(r, res) \ 158#define UPT_SET_SYSCALL_RETURN(r, res) \
207 CHOOSE_MODE(SC_SET_SYSCALL_RETURN(UPT_SC(r), (res)), \ 159 REGS_SET_SYSCALL_RETURN((r)->regs, (res))
208 REGS_SET_SYSCALL_RETURN((r)->skas.regs, (res)))
209 160
210#define UPT_RESTART_SYSCALL(r) \ 161#define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->gp)
211 CHOOSE_MODE(SC_RESTART_SYSCALL(UPT_SC(r)), \
212 REGS_RESTART_SYSCALL((r)->skas.regs))
213 162
214#define UPT_ORIG_SYSCALL(r) UPT_EAX(r) 163#define UPT_ORIG_SYSCALL(r) UPT_EAX(r)
215#define UPT_SYSCALL_NR(r) UPT_ORIG_EAX(r) 164#define UPT_SYSCALL_NR(r) UPT_ORIG_EAX(r)
216#define UPT_SYSCALL_RET(r) UPT_EAX(r) 165#define UPT_SYSCALL_RET(r) UPT_EAX(r)
217 166
218#define UPT_FAULTINFO(r) \ 167#define UPT_FAULTINFO(r) (&(r)->faultinfo)
219 CHOOSE_MODE((&(r)->tt.faultinfo), (&(r)->skas.faultinfo))
220 168
221#endif 169extern void arch_init_registers(int pid);
222 170
223/* 171#endif
224 * Overrides for Emacs so that we follow Linus's tabbing style.
225 * Emacs will notice this stuff at the end of the file and automatically
226 * adjust the settings for this buffer only. This must remain at the end
227 * of the file.
228 * ---------------------------------------------------------------------------
229 * Local variables:
230 * c-file-style: "linux"
231 * End:
232 */
diff --git a/arch/um/include/sysdep-i386/sigcontext.h b/arch/um/include/sysdep-i386/sigcontext.h
index 23fd2644d7ed..67e77122aa45 100644
--- a/arch/um/include/sysdep-i386/sigcontext.h
+++ b/arch/um/include/sysdep-i386/sigcontext.h
@@ -1,19 +1,15 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#ifndef __SYS_SIGCONTEXT_I386_H 6#ifndef __SYS_SIGCONTEXT_I386_H
7#define __SYS_SIGCONTEXT_I386_H 7#define __SYS_SIGCONTEXT_I386_H
8 8
9#include "uml-config.h" 9#include "sysdep/sc.h"
10#include <sysdep/sc.h>
11 10
12#define IP_RESTART_SYSCALL(ip) ((ip) -= 2) 11#define IP_RESTART_SYSCALL(ip) ((ip) -= 2)
13 12
14#define SC_RESTART_SYSCALL(sc) IP_RESTART_SYSCALL(SC_IP(sc))
15#define SC_SET_SYSCALL_RETURN(sc, result) SC_EAX(sc) = (result)
16
17#define GET_FAULTINFO_FROM_SC(fi,sc) \ 13#define GET_FAULTINFO_FROM_SC(fi,sc) \
18 { \ 14 { \
19 (fi).cr2 = SC_CR2(sc); \ 15 (fi).cr2 = SC_CR2(sc); \
@@ -21,32 +17,10 @@
21 (fi).trap_no = SC_TRAPNO(sc); \ 17 (fi).trap_no = SC_TRAPNO(sc); \
22 } 18 }
23 19
24/* ptrace expects that, at the start of a system call, %eax contains
25 * -ENOSYS, so this makes it so.
26 */
27#define SC_START_SYSCALL(sc) do SC_EAX(sc) = -ENOSYS; while(0)
28
29/* This is Page Fault */ 20/* This is Page Fault */
30#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14) 21#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14)
31 22
32/* SKAS3 has no trap_no on i386, but get_skas_faultinfo() sets it to 0. */ 23/* SKAS3 has no trap_no on i386, but get_skas_faultinfo() sets it to 0. */
33#ifdef UML_CONFIG_MODE_SKAS
34#define SEGV_MAYBE_FIXABLE(fi) ((fi)->trap_no == 0 && ptrace_faultinfo) 24#define SEGV_MAYBE_FIXABLE(fi) ((fi)->trap_no == 0 && ptrace_faultinfo)
35#else
36#define SEGV_MAYBE_FIXABLE(fi) 0
37#endif
38
39extern unsigned long *sc_sigmask(void *sc_ptr);
40extern int sc_get_fpregs(unsigned long buf, void *sc_ptr);
41 25
42#endif 26#endif
43/*
44 * Overrides for Emacs so that we follow Linus's tabbing style.
45 * Emacs will notice this stuff at the end of the file and automatically
46 * adjust the settings for this buffer only. This must remain at the end
47 * of the file.
48 * ---------------------------------------------------------------------------
49 * Local variables:
50 * c-file-style: "linux"
51 * End:
52 */
diff --git a/arch/um/include/sysdep-i386/stub.h b/arch/um/include/sysdep-i386/stub.h
index 4fffae75ba53..8c097b87fca7 100644
--- a/arch/um/include/sysdep-i386/stub.h
+++ b/arch/um/include/sysdep-i386/stub.h
@@ -9,7 +9,7 @@
9#include <sys/mman.h> 9#include <sys/mman.h>
10#include <asm/ptrace.h> 10#include <asm/ptrace.h>
11#include <asm/unistd.h> 11#include <asm/unistd.h>
12#include <asm/page.h> 12#include "as-layout.h"
13#include "stub-data.h" 13#include "stub-data.h"
14#include "kern_constants.h" 14#include "kern_constants.h"
15#include "uml-config.h" 15#include "uml-config.h"
@@ -19,7 +19,7 @@ extern void stub_clone_handler(void);
19 19
20#define STUB_SYSCALL_RET EAX 20#define STUB_SYSCALL_RET EAX
21#define STUB_MMAP_NR __NR_mmap2 21#define STUB_MMAP_NR __NR_mmap2
22#define MMAP_OFFSET(o) ((o) >> PAGE_SHIFT) 22#define MMAP_OFFSET(o) ((o) >> UM_KERN_PAGE_SHIFT)
23 23
24static inline long stub_syscall0(long syscall) 24static inline long stub_syscall0(long syscall)
25{ 25{
@@ -90,12 +90,12 @@ static inline void remap_stack(int fd, unsigned long offset)
90{ 90{
91 __asm__ volatile ("movl %%eax,%%ebp ; movl %0,%%eax ; int $0x80 ;" 91 __asm__ volatile ("movl %%eax,%%ebp ; movl %0,%%eax ; int $0x80 ;"
92 "movl %7, %%ebx ; movl %%eax, (%%ebx)" 92 "movl %7, %%ebx ; movl %%eax, (%%ebx)"
93 : : "g" (STUB_MMAP_NR), "b" (UML_CONFIG_STUB_DATA), 93 : : "g" (STUB_MMAP_NR), "b" (STUB_DATA),
94 "c" (UM_KERN_PAGE_SIZE), 94 "c" (UM_KERN_PAGE_SIZE),
95 "d" (PROT_READ | PROT_WRITE), 95 "d" (PROT_READ | PROT_WRITE),
96 "S" (MAP_FIXED | MAP_SHARED), "D" (fd), 96 "S" (MAP_FIXED | MAP_SHARED), "D" (fd),
97 "a" (offset), 97 "a" (offset),
98 "i" (&((struct stub_data *) UML_CONFIG_STUB_DATA)->err) 98 "i" (&((struct stub_data *) STUB_DATA)->err)
99 : "memory"); 99 : "memory");
100} 100}
101 101
diff --git a/arch/um/include/sysdep-i386/thread.h b/arch/um/include/sysdep-i386/thread.h
deleted file mode 100644
index 243fed44d780..000000000000
--- a/arch/um/include/sysdep-i386/thread.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef __UM_THREAD_H
2#define __UM_THREAD_H
3
4#include <kern_constants.h>
5
6#define TASK_DEBUGREGS(task) ((unsigned long *) &(((char *) (task))[HOST_TASK_DEBUGREGS]))
7#ifdef UML_CONFIG_MODE_TT
8#define TASK_EXTERN_PID(task) *((int *) &(((char *) (task))[HOST_TASK_EXTERN_PID]))
9#endif
10
11#endif
diff --git a/arch/um/include/sysdep-x86_64/ptrace.h b/arch/um/include/sysdep-x86_64/ptrace.h
index 62403bd99661..9ea44d111f33 100644
--- a/arch/um/include/sysdep-x86_64/ptrace.h
+++ b/arch/um/include/sysdep-x86_64/ptrace.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright 2003 PathScale, Inc. 2 * Copyright 2003 PathScale, Inc.
3 * Copyright (C) 2003 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * 4 *
4 * Licensed under the GPL 5 * Licensed under the GPL
5 */ 6 */
@@ -14,11 +15,6 @@
14#define MAX_REG_OFFSET (UM_FRAME_SIZE) 15#define MAX_REG_OFFSET (UM_FRAME_SIZE)
15#define MAX_REG_NR ((MAX_REG_OFFSET) / sizeof(unsigned long)) 16#define MAX_REG_NR ((MAX_REG_OFFSET) / sizeof(unsigned long))
16 17
17#ifdef UML_CONFIG_MODE_TT
18#include "sysdep/sc.h"
19#endif
20
21#ifdef UML_CONFIG_MODE_SKAS
22#include "skas_ptregs.h" 18#include "skas_ptregs.h"
23 19
24#define REGS_IP(r) ((r)[HOST_IP]) 20#define REGS_IP(r) ((r)[HOST_IP])
@@ -88,78 +84,51 @@
88 84
89#define REGS_ERR(r) ((r)->fault_type) 85#define REGS_ERR(r) ((r)->fault_type)
90 86
91#endif 87struct uml_pt_regs {
92 88 unsigned long gp[MAX_REG_NR];
93#include "choose-mode.h" 89 struct faultinfo faultinfo;
94 90 long syscall;
95/* XXX */ 91 int is_user;
96union uml_pt_regs {
97#ifdef UML_CONFIG_MODE_TT
98 struct tt_regs {
99 long syscall;
100 unsigned long orig_rax;
101 void *sc;
102 struct faultinfo faultinfo;
103 } tt;
104#endif
105#ifdef UML_CONFIG_MODE_SKAS
106 struct skas_regs {
107 unsigned long regs[MAX_REG_NR];
108 unsigned long fp[HOST_FP_SIZE];
109 struct faultinfo faultinfo;
110 long syscall;
111 int is_user;
112 } skas;
113#endif
114}; 92};
115 93
116#define EMPTY_UML_PT_REGS { } 94#define EMPTY_UML_PT_REGS { }
117 95
118/* XXX */ 96#define UPT_RBX(r) REGS_RBX((r)->gp)
119extern int mode_tt; 97#define UPT_RCX(r) REGS_RCX((r)->gp)
120 98#define UPT_RDX(r) REGS_RDX((r)->gp)
121#define UPT_RBX(r) __CHOOSE_MODE(SC_RBX(UPT_SC(r)), REGS_RBX((r)->skas.regs)) 99#define UPT_RSI(r) REGS_RSI((r)->gp)
122#define UPT_RCX(r) __CHOOSE_MODE(SC_RCX(UPT_SC(r)), REGS_RCX((r)->skas.regs)) 100#define UPT_RDI(r) REGS_RDI((r)->gp)
123#define UPT_RDX(r) __CHOOSE_MODE(SC_RDX(UPT_SC(r)), REGS_RDX((r)->skas.regs)) 101#define UPT_RBP(r) REGS_RBP((r)->gp)
124#define UPT_RSI(r) __CHOOSE_MODE(SC_RSI(UPT_SC(r)), REGS_RSI((r)->skas.regs)) 102#define UPT_RAX(r) REGS_RAX((r)->gp)
125#define UPT_RDI(r) __CHOOSE_MODE(SC_RDI(UPT_SC(r)), REGS_RDI((r)->skas.regs)) 103#define UPT_R8(r) REGS_R8((r)->gp)
126#define UPT_RBP(r) __CHOOSE_MODE(SC_RBP(UPT_SC(r)), REGS_RBP((r)->skas.regs)) 104#define UPT_R9(r) REGS_R9((r)->gp)
127#define UPT_RAX(r) __CHOOSE_MODE(SC_RAX(UPT_SC(r)), REGS_RAX((r)->skas.regs)) 105#define UPT_R10(r) REGS_R10((r)->gp)
128#define UPT_R8(r) __CHOOSE_MODE(SC_R8(UPT_SC(r)), REGS_R8((r)->skas.regs)) 106#define UPT_R11(r) REGS_R11((r)->gp)
129#define UPT_R9(r) __CHOOSE_MODE(SC_R9(UPT_SC(r)), REGS_R9((r)->skas.regs)) 107#define UPT_R12(r) REGS_R12((r)->gp)
130#define UPT_R10(r) __CHOOSE_MODE(SC_R10(UPT_SC(r)), REGS_R10((r)->skas.regs)) 108#define UPT_R13(r) REGS_R13((r)->gp)
131#define UPT_R11(r) __CHOOSE_MODE(SC_R11(UPT_SC(r)), REGS_R11((r)->skas.regs)) 109#define UPT_R14(r) REGS_R14((r)->gp)
132#define UPT_R12(r) __CHOOSE_MODE(SC_R12(UPT_SC(r)), REGS_R12((r)->skas.regs)) 110#define UPT_R15(r) REGS_R15((r)->gp)
133#define UPT_R13(r) __CHOOSE_MODE(SC_R13(UPT_SC(r)), REGS_R13((r)->skas.regs)) 111#define UPT_CS(r) REGS_CS((r)->gp)
134#define UPT_R14(r) __CHOOSE_MODE(SC_R14(UPT_SC(r)), REGS_R14((r)->skas.regs)) 112#define UPT_FS_BASE(r) REGS_FS_BASE((r)->gp)
135#define UPT_R15(r) __CHOOSE_MODE(SC_R15(UPT_SC(r)), REGS_R15((r)->skas.regs)) 113#define UPT_FS(r) REGS_FS((r)->gp)
136#define UPT_CS(r) __CHOOSE_MODE(SC_CS(UPT_SC(r)), REGS_CS((r)->skas.regs)) 114#define UPT_GS_BASE(r) REGS_GS_BASE((r)->gp)
137#define UPT_FS_BASE(r) \ 115#define UPT_GS(r) REGS_GS((r)->gp)
138 __CHOOSE_MODE(SC_FS_BASE(UPT_SC(r)), REGS_FS_BASE((r)->skas.regs)) 116#define UPT_DS(r) REGS_DS((r)->gp)
139#define UPT_FS(r) __CHOOSE_MODE(SC_FS(UPT_SC(r)), REGS_FS((r)->skas.regs)) 117#define UPT_ES(r) REGS_ES((r)->gp)
140#define UPT_GS_BASE(r) \ 118#define UPT_CS(r) REGS_CS((r)->gp)
141 __CHOOSE_MODE(SC_GS_BASE(UPT_SC(r)), REGS_GS_BASE((r)->skas.regs)) 119#define UPT_SS(r) REGS_SS((r)->gp)
142#define UPT_GS(r) __CHOOSE_MODE(SC_GS(UPT_SC(r)), REGS_GS((r)->skas.regs)) 120#define UPT_ORIG_RAX(r) REGS_ORIG_RAX((r)->gp)
143#define UPT_DS(r) __CHOOSE_MODE(SC_DS(UPT_SC(r)), REGS_DS((r)->skas.regs)) 121
144#define UPT_ES(r) __CHOOSE_MODE(SC_ES(UPT_SC(r)), REGS_ES((r)->skas.regs)) 122#define UPT_IP(r) REGS_IP((r)->gp)
145#define UPT_CS(r) __CHOOSE_MODE(SC_CS(UPT_SC(r)), REGS_CS((r)->skas.regs)) 123#define UPT_SP(r) REGS_SP((r)->gp)
146#define UPT_SS(r) __CHOOSE_MODE(SC_SS(UPT_SC(r)), REGS_SS((r)->skas.regs)) 124
147#define UPT_ORIG_RAX(r) \ 125#define UPT_EFLAGS(r) REGS_EFLAGS((r)->gp)
148 __CHOOSE_MODE((r)->tt.orig_rax, REGS_ORIG_RAX((r)->skas.regs)) 126#define UPT_SYSCALL_NR(r) ((r)->syscall)
149
150#define UPT_IP(r) __CHOOSE_MODE(SC_IP(UPT_SC(r)), REGS_IP((r)->skas.regs))
151#define UPT_SP(r) __CHOOSE_MODE(SC_SP(UPT_SC(r)), REGS_SP((r)->skas.regs))
152
153#define UPT_EFLAGS(r) \
154 __CHOOSE_MODE(SC_EFLAGS(UPT_SC(r)), REGS_EFLAGS((r)->skas.regs))
155#define UPT_SC(r) ((r)->tt.sc)
156#define UPT_SYSCALL_NR(r) __CHOOSE_MODE((r)->tt.syscall, (r)->skas.syscall)
157#define UPT_SYSCALL_RET(r) UPT_RAX(r) 127#define UPT_SYSCALL_RET(r) UPT_RAX(r)
158 128
159extern int user_context(unsigned long sp); 129extern int user_context(unsigned long sp);
160 130
161#define UPT_IS_USER(r) \ 131#define UPT_IS_USER(r) ((r)->is_user)
162 CHOOSE_MODE(user_context(UPT_SP(r)), (r)->skas.is_user)
163 132
164#define UPT_SYSCALL_ARG1(r) UPT_RDI(r) 133#define UPT_SYSCALL_ARG1(r) UPT_RDI(r)
165#define UPT_SYSCALL_ARG2(r) UPT_RSI(r) 134#define UPT_SYSCALL_ARG2(r) UPT_RSI(r)
@@ -173,101 +142,99 @@ struct syscall_args {
173}; 142};
174 143
175#define SYSCALL_ARGS(r) ((struct syscall_args) \ 144#define SYSCALL_ARGS(r) ((struct syscall_args) \
176 { .args = { UPT_SYSCALL_ARG1(r), \ 145 { .args = { UPT_SYSCALL_ARG1(r), \
177 UPT_SYSCALL_ARG2(r), \ 146 UPT_SYSCALL_ARG2(r), \
178 UPT_SYSCALL_ARG3(r), \ 147 UPT_SYSCALL_ARG3(r), \
179 UPT_SYSCALL_ARG4(r), \ 148 UPT_SYSCALL_ARG4(r), \
180 UPT_SYSCALL_ARG5(r), \ 149 UPT_SYSCALL_ARG5(r), \
181 UPT_SYSCALL_ARG6(r) } } ) 150 UPT_SYSCALL_ARG6(r) } } )
182 151
183#define UPT_REG(regs, reg) \ 152#define UPT_REG(regs, reg) \
184 ({ unsigned long val; \ 153 ({ unsigned long val; \
185 switch(reg){ \ 154 switch(reg){ \
186 case R8: val = UPT_R8(regs); break; \ 155 case R8: val = UPT_R8(regs); break; \
187 case R9: val = UPT_R9(regs); break; \ 156 case R9: val = UPT_R9(regs); break; \
188 case R10: val = UPT_R10(regs); break; \ 157 case R10: val = UPT_R10(regs); break; \
189 case R11: val = UPT_R11(regs); break; \ 158 case R11: val = UPT_R11(regs); break; \
190 case R12: val = UPT_R12(regs); break; \ 159 case R12: val = UPT_R12(regs); break; \
191 case R13: val = UPT_R13(regs); break; \ 160 case R13: val = UPT_R13(regs); break; \
192 case R14: val = UPT_R14(regs); break; \ 161 case R14: val = UPT_R14(regs); break; \
193 case R15: val = UPT_R15(regs); break; \ 162 case R15: val = UPT_R15(regs); break; \
194 case RIP: val = UPT_IP(regs); break; \ 163 case RIP: val = UPT_IP(regs); break; \
195 case RSP: val = UPT_SP(regs); break; \ 164 case RSP: val = UPT_SP(regs); break; \
196 case RAX: val = UPT_RAX(regs); break; \ 165 case RAX: val = UPT_RAX(regs); break; \
197 case RBX: val = UPT_RBX(regs); break; \ 166 case RBX: val = UPT_RBX(regs); break; \
198 case RCX: val = UPT_RCX(regs); break; \ 167 case RCX: val = UPT_RCX(regs); break; \
199 case RDX: val = UPT_RDX(regs); break; \ 168 case RDX: val = UPT_RDX(regs); break; \
200 case RSI: val = UPT_RSI(regs); break; \ 169 case RSI: val = UPT_RSI(regs); break; \
201 case RDI: val = UPT_RDI(regs); break; \ 170 case RDI: val = UPT_RDI(regs); break; \
202 case RBP: val = UPT_RBP(regs); break; \ 171 case RBP: val = UPT_RBP(regs); break; \
203 case ORIG_RAX: val = UPT_ORIG_RAX(regs); break; \ 172 case ORIG_RAX: val = UPT_ORIG_RAX(regs); break; \
204 case CS: val = UPT_CS(regs); break; \ 173 case CS: val = UPT_CS(regs); break; \
205 case SS: val = UPT_SS(regs); break; \ 174 case SS: val = UPT_SS(regs); break; \
206 case FS_BASE: val = UPT_FS_BASE(regs); break; \ 175 case FS_BASE: val = UPT_FS_BASE(regs); break; \
207 case GS_BASE: val = UPT_GS_BASE(regs); break; \ 176 case GS_BASE: val = UPT_GS_BASE(regs); break; \
208 case DS: val = UPT_DS(regs); break; \ 177 case DS: val = UPT_DS(regs); break; \
209 case ES: val = UPT_ES(regs); break; \ 178 case ES: val = UPT_ES(regs); break; \
210 case FS : val = UPT_FS (regs); break; \ 179 case FS : val = UPT_FS (regs); break; \
211 case GS: val = UPT_GS(regs); break; \ 180 case GS: val = UPT_GS(regs); break; \
212 case EFLAGS: val = UPT_EFLAGS(regs); break; \ 181 case EFLAGS: val = UPT_EFLAGS(regs); break; \
213 default : \ 182 default : \
214 panic("Bad register in UPT_REG : %d\n", reg); \ 183 panic("Bad register in UPT_REG : %d\n", reg); \
215 val = -1; \ 184 val = -1; \
216 } \ 185 } \
217 val; \ 186 val; \
218 }) 187 })
219 188
220 189
221#define UPT_SET(regs, reg, val) \ 190#define UPT_SET(regs, reg, val) \
222 ({ unsigned long __upt_val = val; \ 191 ({ unsigned long __upt_val = val; \
223 switch(reg){ \ 192 switch(reg){ \
224 case R8: UPT_R8(regs) = __upt_val; break; \ 193 case R8: UPT_R8(regs) = __upt_val; break; \
225 case R9: UPT_R9(regs) = __upt_val; break; \ 194 case R9: UPT_R9(regs) = __upt_val; break; \
226 case R10: UPT_R10(regs) = __upt_val; break; \ 195 case R10: UPT_R10(regs) = __upt_val; break; \
227 case R11: UPT_R11(regs) = __upt_val; break; \ 196 case R11: UPT_R11(regs) = __upt_val; break; \
228 case R12: UPT_R12(regs) = __upt_val; break; \ 197 case R12: UPT_R12(regs) = __upt_val; break; \
229 case R13: UPT_R13(regs) = __upt_val; break; \ 198 case R13: UPT_R13(regs) = __upt_val; break; \
230 case R14: UPT_R14(regs) = __upt_val; break; \ 199 case R14: UPT_R14(regs) = __upt_val; break; \
231 case R15: UPT_R15(regs) = __upt_val; break; \ 200 case R15: UPT_R15(regs) = __upt_val; break; \
232 case RIP: UPT_IP(regs) = __upt_val; break; \ 201 case RIP: UPT_IP(regs) = __upt_val; break; \
233 case RSP: UPT_SP(regs) = __upt_val; break; \ 202 case RSP: UPT_SP(regs) = __upt_val; break; \
234 case RAX: UPT_RAX(regs) = __upt_val; break; \ 203 case RAX: UPT_RAX(regs) = __upt_val; break; \
235 case RBX: UPT_RBX(regs) = __upt_val; break; \ 204 case RBX: UPT_RBX(regs) = __upt_val; break; \
236 case RCX: UPT_RCX(regs) = __upt_val; break; \ 205 case RCX: UPT_RCX(regs) = __upt_val; break; \
237 case RDX: UPT_RDX(regs) = __upt_val; break; \ 206 case RDX: UPT_RDX(regs) = __upt_val; break; \
238 case RSI: UPT_RSI(regs) = __upt_val; break; \ 207 case RSI: UPT_RSI(regs) = __upt_val; break; \
239 case RDI: UPT_RDI(regs) = __upt_val; break; \ 208 case RDI: UPT_RDI(regs) = __upt_val; break; \
240 case RBP: UPT_RBP(regs) = __upt_val; break; \ 209 case RBP: UPT_RBP(regs) = __upt_val; break; \
241 case ORIG_RAX: UPT_ORIG_RAX(regs) = __upt_val; break; \ 210 case ORIG_RAX: UPT_ORIG_RAX(regs) = __upt_val; break; \
242 case CS: UPT_CS(regs) = __upt_val; break; \ 211 case CS: UPT_CS(regs) = __upt_val; break; \
243 case SS: UPT_SS(regs) = __upt_val; break; \ 212 case SS: UPT_SS(regs) = __upt_val; break; \
244 case FS_BASE: UPT_FS_BASE(regs) = __upt_val; break; \ 213 case FS_BASE: UPT_FS_BASE(regs) = __upt_val; break; \
245 case GS_BASE: UPT_GS_BASE(regs) = __upt_val; break; \ 214 case GS_BASE: UPT_GS_BASE(regs) = __upt_val; break; \
246 case DS: UPT_DS(regs) = __upt_val; break; \ 215 case DS: UPT_DS(regs) = __upt_val; break; \
247 case ES: UPT_ES(regs) = __upt_val; break; \ 216 case ES: UPT_ES(regs) = __upt_val; break; \
248 case FS: UPT_FS(regs) = __upt_val; break; \ 217 case FS: UPT_FS(regs) = __upt_val; break; \
249 case GS: UPT_GS(regs) = __upt_val; break; \ 218 case GS: UPT_GS(regs) = __upt_val; break; \
250 case EFLAGS: UPT_EFLAGS(regs) = __upt_val; break; \ 219 case EFLAGS: UPT_EFLAGS(regs) = __upt_val; break; \
251 default : \ 220 default : \
252 panic("Bad register in UPT_SET : %d\n", reg); \ 221 panic("Bad register in UPT_SET : %d\n", reg); \
253 break; \ 222 break; \
254 } \ 223 } \
255 __upt_val; \ 224 __upt_val; \
256 }) 225 })
257 226
258#define UPT_SET_SYSCALL_RETURN(r, res) \ 227#define UPT_SET_SYSCALL_RETURN(r, res) \
259 CHOOSE_MODE(SC_SET_SYSCALL_RETURN(UPT_SC(r), (res)), \ 228 REGS_SET_SYSCALL_RETURN((r)->regs, (res))
260 REGS_SET_SYSCALL_RETURN((r)->skas.regs, (res))) 229
230#define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->gp)
261 231
262#define UPT_RESTART_SYSCALL(r) \ 232#define UPT_SEGV_IS_FIXABLE(r) REGS_SEGV_IS_FIXABLE(&r->skas)
263 CHOOSE_MODE(SC_RESTART_SYSCALL(UPT_SC(r)), \
264 REGS_RESTART_SYSCALL((r)->skas.regs))
265 233
266#define UPT_SEGV_IS_FIXABLE(r) \ 234#define UPT_FAULTINFO(r) (&(r)->faultinfo)
267 CHOOSE_MODE(SC_SEGV_IS_FIXABLE(UPT_SC(r)), \
268 REGS_SEGV_IS_FIXABLE(&r->skas))
269 235
270#define UPT_FAULTINFO(r) \ 236static inline void arch_init_registers(int pid)
271 CHOOSE_MODE((&(r)->tt.faultinfo), (&(r)->skas.faultinfo)) 237{
238}
272 239
273#endif 240#endif
diff --git a/arch/um/include/sysdep-x86_64/sigcontext.h b/arch/um/include/sysdep-x86_64/sigcontext.h
index 41073235e7ad..0155133b1458 100644
--- a/arch/um/include/sysdep-x86_64/sigcontext.h
+++ b/arch/um/include/sysdep-x86_64/sigcontext.h
@@ -11,43 +11,17 @@
11 11
12#define IP_RESTART_SYSCALL(ip) ((ip) -= 2) 12#define IP_RESTART_SYSCALL(ip) ((ip) -= 2)
13 13
14#define SC_RESTART_SYSCALL(sc) IP_RESTART_SYSCALL(SC_IP(sc)) 14#define GET_FAULTINFO_FROM_SC(fi, sc) \
15#define SC_SET_SYSCALL_RETURN(sc, result) SC_RAX(sc) = (result)
16
17#define SC_FAULT_ADDR(sc) SC_CR2(sc)
18#define SC_FAULT_TYPE(sc) SC_ERR(sc)
19
20#define GET_FAULTINFO_FROM_SC(fi,sc) \
21 { \ 15 { \
22 (fi).cr2 = SC_CR2(sc); \ 16 (fi).cr2 = SC_CR2(sc); \
23 (fi).error_code = SC_ERR(sc); \ 17 (fi).error_code = SC_ERR(sc); \
24 (fi).trap_no = SC_TRAPNO(sc); \ 18 (fi).trap_no = SC_TRAPNO(sc); \
25 } 19 }
26 20
27/* ptrace expects that, at the start of a system call, %eax contains
28 * -ENOSYS, so this makes it so.
29 */
30
31#define SC_START_SYSCALL(sc) do SC_RAX(sc) = -ENOSYS; while(0)
32
33/* This is Page Fault */ 21/* This is Page Fault */
34#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14) 22#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14)
35 23
36/* No broken SKAS API, which doesn't pass trap_no, here. */ 24/* No broken SKAS API, which doesn't pass trap_no, here. */
37#define SEGV_MAYBE_FIXABLE(fi) 0 25#define SEGV_MAYBE_FIXABLE(fi) 0
38 26
39extern unsigned long *sc_sigmask(void *sc_ptr);
40
41#endif 27#endif
42
43/*
44 * Overrides for Emacs so that we follow Linus's tabbing style.
45 * Emacs will notice this stuff at the end of the file and automatically
46 * adjust the settings for this buffer only. This must remain at the end
47 * of the file.
48 * ---------------------------------------------------------------------------
49 * Local variables:
50 * c-file-style: "linux"
51 * End:
52 */
53
diff --git a/arch/um/include/sysdep-x86_64/stub.h b/arch/um/include/sysdep-x86_64/stub.h
index 92e989f81761..655f9c2de3ac 100644
--- a/arch/um/include/sysdep-x86_64/stub.h
+++ b/arch/um/include/sysdep-x86_64/stub.h
@@ -9,6 +9,7 @@
9#include <sys/mman.h> 9#include <sys/mman.h>
10#include <asm/unistd.h> 10#include <asm/unistd.h>
11#include <sysdep/ptrace_user.h> 11#include <sysdep/ptrace_user.h>
12#include "as-layout.h"
12#include "stub-data.h" 13#include "stub-data.h"
13#include "kern_constants.h" 14#include "kern_constants.h"
14#include "uml-config.h" 15#include "uml-config.h"
@@ -94,13 +95,13 @@ static inline void remap_stack(long fd, unsigned long offset)
94{ 95{
95 __asm__ volatile ("movq %4,%%r10 ; movq %5,%%r8 ; " 96 __asm__ volatile ("movq %4,%%r10 ; movq %5,%%r8 ; "
96 "movq %6, %%r9; " __syscall "; movq %7, %%rbx ; " 97 "movq %6, %%r9; " __syscall "; movq %7, %%rbx ; "
97 "movq %%rax, (%%rbx)": 98 "movq %%rax, (%%rbx)":
98 : "a" (STUB_MMAP_NR), "D" (UML_CONFIG_STUB_DATA), 99 : "a" (STUB_MMAP_NR), "D" (STUB_DATA),
99 "S" (UM_KERN_PAGE_SIZE), 100 "S" (UM_KERN_PAGE_SIZE),
100 "d" (PROT_READ | PROT_WRITE), 101 "d" (PROT_READ | PROT_WRITE),
101 "g" (MAP_FIXED | MAP_SHARED), "g" (fd), 102 "g" (MAP_FIXED | MAP_SHARED), "g" (fd),
102 "g" (offset), 103 "g" (offset),
103 "i" (&((struct stub_data *) UML_CONFIG_STUB_DATA)->err) 104 "i" (&((struct stub_data *) STUB_DATA)->err)
104 : __syscall_clobber, "r10", "r8", "r9" ); 105 : __syscall_clobber, "r10", "r8", "r9" );
105} 106}
106 107
diff --git a/arch/um/include/sysdep-x86_64/thread.h b/arch/um/include/sysdep-x86_64/thread.h
deleted file mode 100644
index cbef3e1697f4..000000000000
--- a/arch/um/include/sysdep-x86_64/thread.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef __UM_THREAD_H
2#define __UM_THREAD_H
3
4#include <kern_constants.h>
5
6#ifdef UML_CONFIG_MODE_TT
7#define TASK_EXTERN_PID(task) *((int *) &(((char *) (task))[HOST_TASK_EXTERN_PID]))
8#endif
9
10#endif
diff --git a/arch/um/include/task.h b/arch/um/include/task.h
index 6375ba7203c9..3fe726b3cf48 100644
--- a/arch/um/include/task.h
+++ b/arch/um/include/task.h
@@ -3,7 +3,7 @@
3 3
4#include <kern_constants.h> 4#include <kern_constants.h>
5 5
6#define TASK_REGS(task) ((union uml_pt_regs *) &(((char *) (task))[HOST_TASK_REGS])) 6#define TASK_REGS(task) ((struct uml_pt_regs *) &(((char *) (task))[HOST_TASK_REGS]))
7#define TASK_PID(task) *((int *) &(((char *) (task))[HOST_TASK_PID])) 7#define TASK_PID(task) *((int *) &(((char *) (task))[HOST_TASK_PID]))
8 8
9#endif 9#endif
diff --git a/arch/um/include/tlb.h b/arch/um/include/tlb.h
index bcd1a4afb842..ecd2265b301b 100644
--- a/arch/um/include/tlb.h
+++ b/arch/um/include/tlb.h
@@ -8,34 +8,7 @@
8 8
9#include "um_mmu.h" 9#include "um_mmu.h"
10 10
11struct host_vm_op {
12 enum { NONE, MMAP, MUNMAP, MPROTECT } type;
13 union {
14 struct {
15 unsigned long addr;
16 unsigned long len;
17 unsigned int prot;
18 int fd;
19 __u64 offset;
20 } mmap;
21 struct {
22 unsigned long addr;
23 unsigned long len;
24 } munmap;
25 struct {
26 unsigned long addr;
27 unsigned long len;
28 unsigned int prot;
29 } mprotect;
30 } u;
31};
32
33extern void force_flush_all(void); 11extern void force_flush_all(void);
34extern void fix_range_common(struct mm_struct *mm, unsigned long start_addr,
35 unsigned long end_addr, int force,
36 int (*do_ops)(union mm_context *,
37 struct host_vm_op *, int, int,
38 void **));
39extern int flush_tlb_kernel_range_common(unsigned long start, 12extern int flush_tlb_kernel_range_common(unsigned long start,
40 unsigned long end); 13 unsigned long end);
41 14
diff --git a/arch/um/include/tt/debug.h b/arch/um/include/tt/debug.h
deleted file mode 100644
index 9778fa838296..000000000000
--- a/arch/um/include/tt/debug.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) and
3 * Lars Brinkhoff.
4 * Licensed under the GPL
5 */
6
7#ifndef __UML_TT_DEBUG_H
8#define __UML_TT_DEBUG_H
9
10extern int debugger_proxy(int status, pid_t pid);
11extern void child_proxy(pid_t pid, int status);
12extern void init_proxy (pid_t pid, int waiting, int status);
13extern int start_debugger(char *prog, int startup, int stop, int *debugger_fd);
14extern void fake_child_exit(void);
15extern int gdb_config(char *str);
16extern int gdb_remove(int unused);
17
18#endif
diff --git a/arch/um/include/tt/mmu-tt.h b/arch/um/include/tt/mmu-tt.h
deleted file mode 100644
index 572a78b22587..000000000000
--- a/arch/um/include/tt/mmu-tt.h
+++ /dev/null
@@ -1,12 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __TT_MMU_H
7#define __TT_MMU_H
8
9struct mmu_context_tt {
10};
11
12#endif
diff --git a/arch/um/include/tt/mode-tt.h b/arch/um/include/tt/mode-tt.h
deleted file mode 100644
index 2823cd56eea2..000000000000
--- a/arch/um/include/tt/mode-tt.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __MODE_TT_H__
7#define __MODE_TT_H__
8
9#include "sysdep/ptrace.h"
10
11enum { OP_NONE, OP_EXEC, OP_FORK, OP_TRACE_ON, OP_REBOOT, OP_HALT, OP_CB };
12
13extern int tracing_pid;
14
15extern int tracer(int (*init_proc)(void *), void *sp);
16extern void sig_handler_common_tt(int sig, void *sc);
17extern void syscall_handler_tt(int sig, union uml_pt_regs *regs);
18extern void reboot_tt(void);
19extern void halt_tt(void);
20extern int is_tracer_winch(int pid, int fd, void *data);
21extern void kill_off_processes_tt(void);
22
23#endif
diff --git a/arch/um/include/tt/mode_kern_tt.h b/arch/um/include/tt/mode_kern_tt.h
deleted file mode 100644
index a4fc63057195..000000000000
--- a/arch/um/include/tt/mode_kern_tt.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __TT_MODE_KERN_H__
7#define __TT_MODE_KERN_H__
8
9#include "linux/sched.h"
10#include "asm/page.h"
11#include "asm/ptrace.h"
12#include "asm/uaccess.h"
13
14extern void switch_to_tt(void *prev, void *next);
15extern void flush_thread_tt(void);
16extern void start_thread_tt(struct pt_regs *regs, unsigned long eip,
17 unsigned long esp);
18extern int copy_thread_tt(int nr, unsigned long clone_flags, unsigned long sp,
19 unsigned long stack_top, struct task_struct *p,
20 struct pt_regs *regs);
21extern void release_thread_tt(struct task_struct *task);
22extern void initial_thread_cb_tt(void (*proc)(void *), void *arg);
23extern void init_idle_tt(void);
24extern void flush_tlb_kernel_range_tt(unsigned long start, unsigned long end);
25extern void flush_tlb_kernel_vm_tt(void);
26extern void __flush_tlb_one_tt(unsigned long addr);
27extern void flush_tlb_range_tt(struct vm_area_struct *vma,
28 unsigned long start, unsigned long end);
29extern void flush_tlb_mm_tt(struct mm_struct *mm);
30extern void force_flush_all_tt(void);
31extern long execute_syscall_tt(void *r);
32extern void before_mem_tt(unsigned long brk_start);
33extern unsigned long set_task_sizes_tt(unsigned long *task_size_out);
34extern int start_uml_tt(void);
35extern int external_pid_tt(struct task_struct *task);
36extern int thread_pid_tt(struct task_struct *task);
37
38#define kmem_end_tt (host_task_size - ABOVE_KMEM)
39
40#endif
diff --git a/arch/um/include/tt/tt.h b/arch/um/include/tt/tt.h
deleted file mode 100644
index acb8356e1f98..000000000000
--- a/arch/um/include/tt/tt.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __TT_H__
7#define __TT_H__
8
9#include "sysdep/ptrace.h"
10
11extern int gdb_pid;
12extern int debug;
13extern int debug_stop;
14extern int debug_trace;
15
16extern int honeypot;
17
18extern int fork_tramp(void *sig_stack);
19extern int do_proc_op(void *t, int proc_id);
20extern int tracer(int (*init_proc)(void *), void *sp);
21extern void attach_process(int pid);
22extern void tracer_panic(char *format, ...)
23 __attribute__ ((format (printf, 1, 2)));
24extern void set_init_pid(int pid);
25extern int set_user_mode(void *task);
26extern void set_tracing(void *t, int tracing);
27extern int is_tracing(void *task);
28extern void syscall_handler(int sig, union uml_pt_regs *regs);
29extern void exit_kernel(int pid, void *task);
30extern void do_syscall(void *task, int pid, int local_using_sysemu);
31extern void do_sigtrap(void *task);
32extern int is_valid_pid(int pid);
33extern void remap_data(void *segment_start, void *segment_end, int w);
34extern long execute_syscall_tt(void *r);
35
36#endif
37
diff --git a/arch/um/include/tt/uaccess-tt.h b/arch/um/include/tt/uaccess-tt.h
deleted file mode 100644
index 13a64f61fcf4..000000000000
--- a/arch/um/include/tt/uaccess-tt.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __TT_UACCESS_H
7#define __TT_UACCESS_H
8
9#include "linux/string.h"
10#include "linux/sched.h"
11#include "asm/processor.h"
12#include "asm/errno.h"
13#include "asm/current.h"
14#include "asm/a.out.h"
15#include "uml_uaccess.h"
16
17#define ABOVE_KMEM (16 * 1024 * 1024)
18
19extern unsigned long end_vm;
20extern unsigned long uml_physmem;
21
22#define is_stack(addr, size) \
23 (((unsigned long) (addr) < STACK_TOP) && \
24 ((unsigned long) (addr) >= STACK_TOP - ABOVE_KMEM) && \
25 (((unsigned long) (addr) + (size)) <= STACK_TOP))
26
27#define access_ok_tt(type, addr, size) \
28 (is_stack(addr, size))
29
30extern int __do_copy_from_user(void *to, const void *from, int n,
31 void **fault_addr, void **fault_catcher);
32extern int __do_strncpy_from_user(char *dst, const char *src, size_t n,
33 void **fault_addr, void **fault_catcher);
34extern int __do_clear_user(void *mem, size_t len, void **fault_addr,
35 void **fault_catcher);
36extern int __do_strnlen_user(const char *str, unsigned long n,
37 void **fault_addr, void **fault_catcher);
38
39extern int copy_from_user_tt(void *to, const void __user *from, int n);
40extern int copy_to_user_tt(void __user *to, const void *from, int n);
41extern int strncpy_from_user_tt(char *dst, const char __user *src, int count);
42extern int __clear_user_tt(void __user *mem, int len);
43extern int clear_user_tt(void __user *mem, int len);
44extern int strnlen_user_tt(const void __user *str, int len);
45
46#endif
diff --git a/arch/um/include/um_mmu.h b/arch/um/include/um_mmu.h
index 0fa643238300..8855d8df512f 100644
--- a/arch/um/include/um_mmu.h
+++ b/arch/um/include/um_mmu.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -7,34 +7,22 @@
7#define __ARCH_UM_MMU_H 7#define __ARCH_UM_MMU_H
8 8
9#include "uml-config.h" 9#include "uml-config.h"
10#include "choose-mode.h" 10#include "mm_id.h"
11#include "asm/ldt.h"
11 12
12#ifdef UML_CONFIG_MODE_TT 13typedef struct mm_context {
13#include "mmu-tt.h" 14 struct mm_id id;
15 unsigned long last_page_table;
16#ifdef CONFIG_3_LEVEL_PGTABLES
17 unsigned long last_pmd;
14#endif 18#endif
19 struct uml_ldt ldt;
20} mm_context_t;
15 21
16#ifdef UML_CONFIG_MODE_SKAS 22extern void __switch_mm(struct mm_id * mm_idp);
17#include "mmu-skas.h"
18#endif
19 23
20typedef union mm_context { 24/* Avoid tangled inclusion with asm/ldt.h */
21#ifdef UML_CONFIG_MODE_TT 25extern long init_new_ldt(struct mm_context *to_mm, struct mm_context *from_mm);
22 struct mmu_context_tt tt; 26extern void free_ldt(struct mm_context *mm);
23#endif
24#ifdef UML_CONFIG_MODE_SKAS
25 struct mmu_context_skas skas;
26#endif
27} mm_context_t;
28 27
29#endif 28#endif
30
31/*
32 * Overrides for Emacs so that we follow Linus's tabbing style.
33 * Emacs will notice this stuff at the end of the file and automatically
34 * adjust the settings for this buffer only. This must remain at the end
35 * of the file.
36 * ---------------------------------------------------------------------------
37 * Local variables:
38 * c-file-style: "linux"
39 * End:
40 */
diff --git a/arch/um/include/um_uaccess.h b/arch/um/include/um_uaccess.h
index 5126a99b5961..fdfc06b85605 100644
--- a/arch/um/include/um_uaccess.h
+++ b/arch/um/include/um_uaccess.h
@@ -1,26 +1,16 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#ifndef __ARCH_UM_UACCESS_H 6#ifndef __ARCH_UM_UACCESS_H
7#define __ARCH_UM_UACCESS_H 7#define __ARCH_UM_UACCESS_H
8 8
9#include "choose-mode.h"
10
11#ifdef CONFIG_MODE_TT
12#include "uaccess-tt.h"
13#endif
14
15#ifdef CONFIG_MODE_SKAS
16#include "uaccess-skas.h"
17#endif
18
19#include "asm/fixmap.h" 9#include "asm/fixmap.h"
20 10
21#define __under_task_size(addr, size) \ 11#define __under_task_size(addr, size) \
22 (((unsigned long) (addr) < TASK_SIZE) && \ 12 (((unsigned long) (addr) < TASK_SIZE) && \
23 (((unsigned long) (addr) + (size)) < TASK_SIZE)) 13 (((unsigned long) (addr) + (size)) < TASK_SIZE))
24 14
25#define __access_ok_vsyscall(type, addr, size) \ 15#define __access_ok_vsyscall(type, addr, size) \
26 ((type == VERIFY_READ) && \ 16 ((type == VERIFY_READ) && \
@@ -35,20 +25,14 @@
35 (__addr_range_nowrap(addr, size) && \ 25 (__addr_range_nowrap(addr, size) && \
36 (__under_task_size(addr, size) || \ 26 (__under_task_size(addr, size) || \
37 __access_ok_vsyscall(type, addr, size) || \ 27 __access_ok_vsyscall(type, addr, size) || \
38 segment_eq(get_fs(), KERNEL_DS) || \ 28 segment_eq(get_fs(), KERNEL_DS)))
39 CHOOSE_MODE_PROC(access_ok_tt, access_ok_skas, type, addr, size)))
40 29
41static inline int copy_from_user(void *to, const void __user *from, int n) 30extern int copy_from_user(void *to, const void __user *from, int n);
42{ 31extern int copy_to_user(void __user *to, const void *from, int n);
43 return(CHOOSE_MODE_PROC(copy_from_user_tt, copy_from_user_skas, to,
44 from, n));
45}
46 32
47static inline int copy_to_user(void __user *to, const void *from, int n) 33extern int __do_copy_to_user(void *to, const void *from, int n,
48{ 34 void **fault_addr, jmp_buf **fault_catcher);
49 return(CHOOSE_MODE_PROC(copy_to_user_tt, copy_to_user_skas, to, 35extern void __do_copy(void *to, const void *from, int n);
50 from, n));
51}
52 36
53/* 37/*
54 * strncpy_from_user: - Copy a NUL terminated string from userspace. 38 * strncpy_from_user: - Copy a NUL terminated string from userspace.
@@ -69,11 +53,7 @@ static inline int copy_to_user(void __user *to, const void *from, int n)
69 * and returns @count. 53 * and returns @count.
70 */ 54 */
71 55
72static inline int strncpy_from_user(char *dst, const char __user *src, int count) 56extern int strncpy_from_user(char *dst, const char __user *src, int count);
73{
74 return(CHOOSE_MODE_PROC(strncpy_from_user_tt, strncpy_from_user_skas,
75 dst, src, count));
76}
77 57
78/* 58/*
79 * __clear_user: - Zero a block of memory in user space, with less checking. 59 * __clear_user: - Zero a block of memory in user space, with less checking.
@@ -86,10 +66,7 @@ static inline int strncpy_from_user(char *dst, const char __user *src, int count
86 * Returns number of bytes that could not be cleared. 66 * Returns number of bytes that could not be cleared.
87 * On success, this will be zero. 67 * On success, this will be zero.
88 */ 68 */
89static inline int __clear_user(void *mem, int len) 69extern int __clear_user(void __user *mem, int len);
90{
91 return(CHOOSE_MODE_PROC(__clear_user_tt, __clear_user_skas, mem, len));
92}
93 70
94/* 71/*
95 * clear_user: - Zero a block of memory in user space. 72 * clear_user: - Zero a block of memory in user space.
@@ -101,10 +78,7 @@ static inline int __clear_user(void *mem, int len)
101 * Returns number of bytes that could not be cleared. 78 * Returns number of bytes that could not be cleared.
102 * On success, this will be zero. 79 * On success, this will be zero.
103 */ 80 */
104static inline int clear_user(void __user *mem, int len) 81extern int clear_user(void __user *mem, int len);
105{
106 return(CHOOSE_MODE_PROC(clear_user_tt, clear_user_skas, mem, len));
107}
108 82
109/* 83/*
110 * strlen_user: - Get the size of a string in user space. 84 * strlen_user: - Get the size of a string in user space.
@@ -117,20 +91,6 @@ static inline int clear_user(void __user *mem, int len)
117 * On exception, returns 0. 91 * On exception, returns 0.
118 * If the string is too long, returns a value greater than @n. 92 * If the string is too long, returns a value greater than @n.
119 */ 93 */
120static inline int strnlen_user(const void __user *str, long len) 94extern int strnlen_user(const void __user *str, int len);
121{
122 return(CHOOSE_MODE_PROC(strnlen_user_tt, strnlen_user_skas, str, len));
123}
124 95
125#endif 96#endif
126
127/*
128 * Overrides for Emacs so that we follow Linus's tabbing style.
129 * Emacs will notice this stuff at the end of the file and automatically
130 * adjust the settings for this buffer only. This must remain at the end
131 * of the file.
132 * ---------------------------------------------------------------------------
133 * Local variables:
134 * c-file-style: "linux"
135 * End:
136 */
diff --git a/arch/um/include/uml_uaccess.h b/arch/um/include/uml_uaccess.h
deleted file mode 100644
index c0df11d06f5e..000000000000
--- a/arch/um/include/uml_uaccess.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Copyright (C) 2001 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UML_UACCESS_H__
7#define __UML_UACCESS_H__
8
9extern int __do_copy_to_user(void *to, const void *from, int n,
10 void **fault_addr, void **fault_catcher);
11void __do_copy(void *to, const void *from, int n);
12
13#endif
14
15/*
16 * Overrides for Emacs so that we follow Linus's tabbing style.
17 * Emacs will notice this stuff at the end of the file and automatically
18 * adjust the settings for this buffer only. This must remain at the end
19 * of the file.
20 * ---------------------------------------------------------------------------
21 * Local variables:
22 * c-file-style: "linux"
23 * End:
24 */
diff --git a/arch/um/include/user.h b/arch/um/include/user.h
index d380e6d91a90..99033ff28a78 100644
--- a/arch/um/include/user.h
+++ b/arch/um/include/user.h
@@ -14,10 +14,12 @@
14 */ 14 */
15#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 15#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
16 16
17/* 17/* This is to get size_t */
18 * This will provide the size_t definition in both kernel and userspace builds 18#ifdef __KERNEL__
19 */
20#include <linux/types.h> 19#include <linux/types.h>
20#else
21#include <stddef.h>
22#endif
21 23
22extern void panic(const char *fmt, ...) 24extern void panic(const char *fmt, ...)
23 __attribute__ ((format (printf, 1, 2))); 25 __attribute__ ((format (printf, 1, 2)));
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
index c5cf4a0827b0..499e5e95e609 100644
--- a/arch/um/kernel/Makefile
+++ b/arch/um/kernel/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2# Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux,intel}.com)
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
@@ -9,15 +9,12 @@ clean-files :=
9obj-y = config.o exec.o exitcode.o init_task.o irq.o ksyms.o mem.o \ 9obj-y = config.o exec.o exitcode.o init_task.o irq.o ksyms.o mem.o \
10 physmem.o process.o ptrace.o reboot.o sigio.o \ 10 physmem.o process.o ptrace.o reboot.o sigio.o \
11 signal.o smp.o syscall.o sysrq.o time.o tlb.o trap.o uaccess.o \ 11 signal.o smp.o syscall.o sysrq.o time.o tlb.o trap.o uaccess.o \
12 um_arch.o umid.o 12 um_arch.o umid.o skas/
13 13
14obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o 14obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o
15obj-$(CONFIG_GPROF) += gprof_syms.o 15obj-$(CONFIG_GPROF) += gprof_syms.o
16obj-$(CONFIG_GCOV) += gmon_syms.o 16obj-$(CONFIG_GCOV) += gmon_syms.o
17 17
18obj-$(CONFIG_MODE_TT) += tt/
19obj-$(CONFIG_MODE_SKAS) += skas/
20
21USER_OBJS := config.o 18USER_OBJS := config.o
22 19
23include arch/um/scripts/Makefile.rules 20include arch/um/scripts/Makefile.rules
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index 41850906116e..3866f4960f04 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
@@ -10,8 +10,6 @@ SECTIONS
10 PROVIDE (__executable_start = START); 10 PROVIDE (__executable_start = START);
11 . = START + SIZEOF_HEADERS; 11 . = START + SIZEOF_HEADERS;
12 .interp : { *(.interp) } 12 .interp : { *(.interp) }
13 /* Used in arch/um/kernel/mem.c. Any memory between START and __binary_start
14 * is remapped.*/
15 __binary_start = .; 13 __binary_start = .;
16 . = ALIGN(4096); /* Init code and data */ 14 . = ALIGN(4096); /* Init code and data */
17 _text = .; 15 _text = .;
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c
index ce6828fd396f..8196450451cd 100644
--- a/arch/um/kernel/exec.c
+++ b/arch/um/kernel/exec.c
@@ -1,35 +1,44 @@
1/* 1/*
2 * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/slab.h" 6#include "linux/stddef.h"
7#include "linux/fs.h"
7#include "linux/smp_lock.h" 8#include "linux/smp_lock.h"
8#include "linux/ptrace.h" 9#include "linux/ptrace.h"
9#include "linux/fs.h" 10#include "linux/sched.h"
10#include "asm/ptrace.h" 11#include "asm/current.h"
11#include "asm/pgtable.h" 12#include "asm/processor.h"
12#include "asm/tlbflush.h"
13#include "asm/uaccess.h" 13#include "asm/uaccess.h"
14#include "kern_util.h"
15#include "as-layout.h" 14#include "as-layout.h"
16#include "mem_user.h" 15#include "mem_user.h"
17#include "kern.h" 16#include "skas.h"
18#include "irq_user.h"
19#include "tlb.h"
20#include "os.h" 17#include "os.h"
21#include "choose-mode.h"
22#include "mode_kern.h"
23 18
24void flush_thread(void) 19void flush_thread(void)
25{ 20{
21 void *data = NULL;
22 unsigned long end = proc_mm ? task_size : STUB_START;
23 int ret;
24
26 arch_flush_thread(&current->thread.arch); 25 arch_flush_thread(&current->thread.arch);
27 CHOOSE_MODE(flush_thread_tt(), flush_thread_skas()); 26
27 ret = unmap(&current->mm->context.id, 0, end, 1, &data);
28 if (ret) {
29 printk(KERN_ERR "flush_thread - clearing address space failed, "
30 "err = %d\n", ret);
31 force_sig(SIGKILL, current);
32 }
33
34 __switch_mm(&current->mm->context.id);
28} 35}
29 36
30void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) 37void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp)
31{ 38{
32 CHOOSE_MODE_PROC(start_thread_tt, start_thread_skas, regs, eip, esp); 39 set_fs(USER_DS);
40 PT_REGS_IP(regs) = eip;
41 PT_REGS_SP(regs) = esp;
33} 42}
34 43
35#ifdef CONFIG_TTY_LOG 44#ifdef CONFIG_TTY_LOG
@@ -39,7 +48,7 @@ extern void log_exec(char **argv, void *tty);
39static long execve1(char *file, char __user * __user *argv, 48static long execve1(char *file, char __user * __user *argv,
40 char __user *__user *env) 49 char __user *__user *env)
41{ 50{
42 long error; 51 long error;
43#ifdef CONFIG_TTY_LOG 52#ifdef CONFIG_TTY_LOG
44 struct tty_struct *tty; 53 struct tty_struct *tty;
45 54
@@ -49,17 +58,16 @@ static long execve1(char *file, char __user * __user *argv,
49 log_exec(argv, tty); 58 log_exec(argv, tty);
50 mutex_unlock(&tty_mutex); 59 mutex_unlock(&tty_mutex);
51#endif 60#endif
52 error = do_execve(file, argv, env, &current->thread.regs); 61 error = do_execve(file, argv, env, &current->thread.regs);
53 if (error == 0){ 62 if (error == 0) {
54 task_lock(current); 63 task_lock(current);
55 current->ptrace &= ~PT_DTRACE; 64 current->ptrace &= ~PT_DTRACE;
56#ifdef SUBARCH_EXECVE1 65#ifdef SUBARCH_EXECVE1
57 SUBARCH_EXECVE1(&current->thread.regs.regs); 66 SUBARCH_EXECVE1(&current->thread.regs.regs);
58#endif 67#endif
59 task_unlock(current); 68 task_unlock(current);
60 set_cmdline(current_cmd()); 69 }
61 } 70 return error;
62 return(error);
63} 71}
64 72
65long um_execve(char *file, char __user *__user *argv, char __user *__user *env) 73long um_execve(char *file, char __user *__user *argv, char __user *__user *env)
@@ -67,9 +75,9 @@ long um_execve(char *file, char __user *__user *argv, char __user *__user *env)
67 long err; 75 long err;
68 76
69 err = execve1(file, argv, env); 77 err = execve1(file, argv, env);
70 if(!err) 78 if (!err)
71 do_longjmp(current->thread.exec_buf, 1); 79 UML_LONGJMP(current->thread.exec_buf, 1);
72 return(err); 80 return err;
73} 81}
74 82
75long sys_execve(char __user *file, char __user *__user *argv, 83long sys_execve(char __user *file, char __user *__user *argv,
@@ -86,5 +94,5 @@ long sys_execve(char __user *file, char __user *__user *argv,
86 putname(filename); 94 putname(filename);
87 out: 95 out:
88 unlock_kernel(); 96 unlock_kernel();
89 return(error); 97 return error;
90} 98}
diff --git a/arch/um/kernel/init_task.c b/arch/um/kernel/init_task.c
index cba516e6c99a..dcfceca95052 100644
--- a/arch/um/kernel/init_task.c
+++ b/arch/um/kernel/init_task.c
@@ -3,16 +3,12 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/mm.h"
7#include "linux/fs.h"
8#include "linux/module.h"
9#include "linux/sched.h" 6#include "linux/sched.h"
10#include "linux/init_task.h" 7#include "linux/init_task.h"
8#include "linux/fs.h"
9#include "linux/module.h"
11#include "linux/mqueue.h" 10#include "linux/mqueue.h"
12#include "asm/uaccess.h" 11#include "asm/uaccess.h"
13#include "asm/pgtable.h"
14#include "mem_user.h"
15#include "os.h"
16 12
17static struct fs_struct init_fs = INIT_FS; 13static struct fs_struct init_fs = INIT_FS;
18struct mm_struct init_mm = INIT_MM(init_mm); 14struct mm_struct init_mm = INIT_MM(init_mm);
@@ -46,8 +42,3 @@ union thread_union init_thread_union
46union thread_union cpu0_irqstack 42union thread_union cpu0_irqstack
47 __attribute__((__section__(".data.init_irqstack"))) = 43 __attribute__((__section__(".data.init_irqstack"))) =
48 { INIT_THREAD_INFO(init_task) }; 44 { INIT_THREAD_INFO(init_task) };
49
50void unprotect_stack(unsigned long stack)
51{
52 os_protect_memory((void *) stack, THREAD_SIZE, 1, 1, 0);
53}
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index cf0dd9cf8c43..277fce17b088 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -1,37 +1,19 @@
1/* 1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 * Derived (i.e. mostly copied) from arch/i386/kernel/irq.c: 4 * Derived (i.e. mostly copied) from arch/i386/kernel/irq.c:
5 * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar 5 * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
6 */ 6 */
7 7
8#include "linux/kernel.h" 8#include "linux/cpumask.h"
9#include "linux/module.h" 9#include "linux/hardirq.h"
10#include "linux/smp.h"
11#include "linux/kernel_stat.h"
12#include "linux/interrupt.h" 10#include "linux/interrupt.h"
13#include "linux/random.h" 11#include "linux/kernel_stat.h"
14#include "linux/slab.h" 12#include "linux/module.h"
15#include "linux/file.h"
16#include "linux/proc_fs.h"
17#include "linux/init.h"
18#include "linux/seq_file.h" 13#include "linux/seq_file.h"
19#include "linux/profile.h" 14#include "as-layout.h"
20#include "linux/hardirq.h"
21#include "asm/irq.h"
22#include "asm/hw_irq.h"
23#include "asm/atomic.h"
24#include "asm/signal.h"
25#include "asm/system.h"
26#include "asm/errno.h"
27#include "asm/uaccess.h"
28#include "kern_util.h" 15#include "kern_util.h"
29#include "irq_user.h"
30#include "irq_kern.h"
31#include "os.h" 16#include "os.h"
32#include "sigio.h"
33#include "misc_constants.h"
34#include "as-layout.h"
35 17
36/* 18/*
37 * Generic, controller-independent functions: 19 * Generic, controller-independent functions:
@@ -71,9 +53,8 @@ int show_interrupts(struct seq_file *p, void *v)
71 seq_putc(p, '\n'); 53 seq_putc(p, '\n');
72skip: 54skip:
73 spin_unlock_irqrestore(&irq_desc[i].lock, flags); 55 spin_unlock_irqrestore(&irq_desc[i].lock, flags);
74 } else if (i == NR_IRQS) { 56 } else if (i == NR_IRQS)
75 seq_putc(p, '\n'); 57 seq_putc(p, '\n');
76 }
77 58
78 return 0; 59 return 0;
79} 60}
@@ -91,7 +72,7 @@ static struct irq_fd **last_irq_ptr = &active_fds;
91 72
92extern void free_irqs(void); 73extern void free_irqs(void);
93 74
94void sigio_handler(int sig, union uml_pt_regs *regs) 75void sigio_handler(int sig, struct uml_pt_regs *regs)
95{ 76{
96 struct irq_fd *irq_fd; 77 struct irq_fd *irq_fd;
97 int n; 78 int n;
@@ -102,11 +83,13 @@ void sigio_handler(int sig, union uml_pt_regs *regs)
102 while (1) { 83 while (1) {
103 n = os_waiting_for_events(active_fds); 84 n = os_waiting_for_events(active_fds);
104 if (n <= 0) { 85 if (n <= 0) {
105 if(n == -EINTR) continue; 86 if (n == -EINTR)
87 continue;
106 else break; 88 else break;
107 } 89 }
108 90
109 for (irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next) { 91 for (irq_fd = active_fds; irq_fd != NULL;
92 irq_fd = irq_fd->next) {
110 if (irq_fd->current_events != 0) { 93 if (irq_fd->current_events != 0) {
111 irq_fd->current_events = 0; 94 irq_fd->current_events = 0;
112 do_IRQ(irq_fd->irq, regs); 95 do_IRQ(irq_fd->irq, regs);
@@ -138,8 +121,7 @@ int activate_fd(int irq, int fd, int type, void *dev_id)
138 121
139 if (type == IRQ_READ) 122 if (type == IRQ_READ)
140 events = UM_POLLIN | UM_POLLPRI; 123 events = UM_POLLIN | UM_POLLPRI;
141 else 124 else events = UM_POLLOUT;
142 events = UM_POLLOUT;
143 *new_fd = ((struct irq_fd) { .next = NULL, 125 *new_fd = ((struct irq_fd) { .next = NULL,
144 .id = dev_id, 126 .id = dev_id,
145 .fd = fd, 127 .fd = fd,
@@ -153,9 +135,10 @@ int activate_fd(int irq, int fd, int type, void *dev_id)
153 spin_lock_irqsave(&irq_lock, flags); 135 spin_lock_irqsave(&irq_lock, flags);
154 for (irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next) { 136 for (irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next) {
155 if ((irq_fd->fd == fd) && (irq_fd->type == type)) { 137 if ((irq_fd->fd == fd) && (irq_fd->type == type)) {
156 printk("Registering fd %d twice\n", fd); 138 printk(KERN_ERR "Registering fd %d twice\n", fd);
157 printk("Irqs : %d, %d\n", irq_fd->irq, irq); 139 printk(KERN_ERR "Irqs : %d, %d\n", irq_fd->irq, irq);
158 printk("Ids : 0x%p, 0x%p\n", irq_fd->id, dev_id); 140 printk(KERN_ERR "Ids : 0x%p, 0x%p\n", irq_fd->id,
141 dev_id);
159 goto out_unlock; 142 goto out_unlock;
160 } 143 }
161 } 144 }
@@ -171,7 +154,8 @@ int activate_fd(int irq, int fd, int type, void *dev_id)
171 if (n == 0) 154 if (n == 0)
172 break; 155 break;
173 156
174 /* n > 0 157 /*
158 * n > 0
175 * It means we couldn't put new pollfd to current pollfds 159 * It means we couldn't put new pollfd to current pollfds
176 * and tmp_fds is NULL or too small for new pollfds array. 160 * and tmp_fds is NULL or too small for new pollfds array.
177 * Needed size is equal to n as minimum. 161 * Needed size is equal to n as minimum.
@@ -197,7 +181,8 @@ int activate_fd(int irq, int fd, int type, void *dev_id)
197 181
198 spin_unlock_irqrestore(&irq_lock, flags); 182 spin_unlock_irqrestore(&irq_lock, flags);
199 183
200 /* This calls activate_fd, so it has to be outside the critical 184 /*
185 * This calls activate_fd, so it has to be outside the critical
201 * section. 186 * section.
202 */ 187 */
203 maybe_sigio_broken(fd, (type == IRQ_READ)); 188 maybe_sigio_broken(fd, (type == IRQ_READ));
@@ -264,13 +249,14 @@ static struct irq_fd *find_irq_by_fd(int fd, int irqnum, int *index_out)
264 i++; 249 i++;
265 } 250 }
266 if (irq == NULL) { 251 if (irq == NULL) {
267 printk("find_irq_by_fd doesn't have descriptor %d\n", fd); 252 printk(KERN_ERR "find_irq_by_fd doesn't have descriptor %d\n",
253 fd);
268 goto out; 254 goto out;
269 } 255 }
270 fdi = os_get_pollfd(i); 256 fdi = os_get_pollfd(i);
271 if ((fdi != -1) && (fdi != fd)) { 257 if ((fdi != -1) && (fdi != fd)) {
272 printk("find_irq_by_fd - mismatch between active_fds and " 258 printk(KERN_ERR "find_irq_by_fd - mismatch between active_fds "
273 "pollfds, fd %d vs %d, need %d\n", irq->fd, 259 "and pollfds, fd %d vs %d, need %d\n", irq->fd,
274 fdi, fd); 260 fdi, fd);
275 irq = NULL; 261 irq = NULL;
276 goto out; 262 goto out;
@@ -306,7 +292,7 @@ void deactivate_fd(int fd, int irqnum)
306 292
307 spin_lock_irqsave(&irq_lock, flags); 293 spin_lock_irqsave(&irq_lock, flags);
308 irq = find_irq_by_fd(fd, irqnum, &i); 294 irq = find_irq_by_fd(fd, irqnum, &i);
309 if(irq == NULL){ 295 if (irq == NULL) {
310 spin_unlock_irqrestore(&irq_lock, flags); 296 spin_unlock_irqrestore(&irq_lock, flags);
311 return; 297 return;
312 } 298 }
@@ -339,36 +325,12 @@ int deactivate_all_fds(void)
339 return 0; 325 return 0;
340} 326}
341 327
342#ifdef CONFIG_MODE_TT
343void forward_interrupts(int pid)
344{
345 struct irq_fd *irq;
346 unsigned long flags;
347 int err;
348
349 spin_lock_irqsave(&irq_lock, flags);
350 for (irq = active_fds; irq != NULL; irq = irq->next) {
351 err = os_set_owner(irq->fd, pid);
352 if (err < 0) {
353 /* XXX Just remove the irq rather than
354 * print out an infinite stream of these
355 */
356 printk("Failed to forward %d to pid %d, err = %d\n",
357 irq->fd, pid, -err);
358 }
359
360 irq->pid = pid;
361 }
362 spin_unlock_irqrestore(&irq_lock, flags);
363}
364#endif
365
366/* 328/*
367 * do_IRQ handles all normal device IRQ's (the special 329 * do_IRQ handles all normal device IRQ's (the special
368 * SMP cross-CPU interrupts have their own specific 330 * SMP cross-CPU interrupts have their own specific
369 * handlers). 331 * handlers).
370 */ 332 */
371unsigned int do_IRQ(int irq, union uml_pt_regs *regs) 333unsigned int do_IRQ(int irq, struct uml_pt_regs *regs)
372{ 334{
373 struct pt_regs *old_regs = set_irq_regs((struct pt_regs *)regs); 335 struct pt_regs *old_regs = set_irq_regs((struct pt_regs *)regs);
374 irq_enter(); 336 irq_enter();
@@ -396,8 +358,10 @@ int um_request_irq(unsigned int irq, int fd, int type,
396EXPORT_SYMBOL(um_request_irq); 358EXPORT_SYMBOL(um_request_irq);
397EXPORT_SYMBOL(reactivate_fd); 359EXPORT_SYMBOL(reactivate_fd);
398 360
399/* hw_interrupt_type must define (startup || enable) && 361/*
400 * (shutdown || disable) && end */ 362 * hw_interrupt_type must define (startup || enable) &&
363 * (shutdown || disable) && end
364 */
401static void dummy(unsigned int irq) 365static void dummy(unsigned int irq)
402{ 366{
403} 367}
@@ -446,7 +410,8 @@ int init_aio_irq(int irq, char *name, irq_handler_t handler)
446 410
447 err = os_pipe(fds, 1, 1); 411 err = os_pipe(fds, 1, 1);
448 if (err) { 412 if (err) {
449 printk("init_aio_irq - os_pipe failed, err = %d\n", -err); 413 printk(KERN_ERR "init_aio_irq - os_pipe failed, err = %d\n",
414 -err);
450 goto out; 415 goto out;
451 } 416 }
452 417
@@ -454,7 +419,8 @@ int init_aio_irq(int irq, char *name, irq_handler_t handler)
454 IRQF_DISABLED | IRQF_SAMPLE_RANDOM, name, 419 IRQF_DISABLED | IRQF_SAMPLE_RANDOM, name,
455 (void *) (long) fds[0]); 420 (void *) (long) fds[0]);
456 if (err) { 421 if (err) {
457 printk("init_aio_irq - : um_request_irq failed, err = %d\n", 422 printk(KERN_ERR "init_aio_irq - : um_request_irq failed, "
423 "err = %d\n",
458 err); 424 err);
459 goto out_close; 425 goto out_close;
460 } 426 }
@@ -525,8 +491,9 @@ unsigned long to_irq_stack(unsigned long *mask_out)
525 int nested; 491 int nested;
526 492
527 mask = xchg(&pending_mask, *mask_out); 493 mask = xchg(&pending_mask, *mask_out);
528 if(mask != 0){ 494 if (mask != 0) {
529 /* If any interrupts come in at this point, we want to 495 /*
496 * If any interrupts come in at this point, we want to
530 * make sure that their bits aren't lost by our 497 * make sure that their bits aren't lost by our
531 * putting our bit in. So, this loop accumulates bits 498 * putting our bit in. So, this loop accumulates bits
532 * until xchg returns the same value that we put in. 499 * until xchg returns the same value that we put in.
@@ -538,13 +505,13 @@ unsigned long to_irq_stack(unsigned long *mask_out)
538 do { 505 do {
539 old |= mask; 506 old |= mask;
540 mask = xchg(&pending_mask, old); 507 mask = xchg(&pending_mask, old);
541 } while(mask != old); 508 } while (mask != old);
542 return 1; 509 return 1;
543 } 510 }
544 511
545 ti = current_thread_info(); 512 ti = current_thread_info();
546 nested = (ti->real_thread != NULL); 513 nested = (ti->real_thread != NULL);
547 if(!nested){ 514 if (!nested) {
548 struct task_struct *task; 515 struct task_struct *task;
549 struct thread_info *tti; 516 struct thread_info *tti;
550 517
diff --git a/arch/um/kernel/ksyms.c b/arch/um/kernel/ksyms.c
index 7b3e53fb8070..1b388b41d95d 100644
--- a/arch/um/kernel/ksyms.c
+++ b/arch/um/kernel/ksyms.c
@@ -1,22 +1,15 @@
1/* 1/*
2 * Copyright (C) 2001 - 2004 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/module.h" 6#include "linux/module.h"
7#include "linux/string.h" 7#include "linux/syscalls.h"
8#include "linux/smp_lock.h" 8#include "asm/a.out.h"
9#include "linux/spinlock.h"
10#include "linux/highmem.h"
11#include "asm/current.h"
12#include "asm/processor.h"
13#include "asm/unistd.h"
14#include "asm/pgalloc.h"
15#include "asm/pgtable.h"
16#include "asm/page.h"
17#include "asm/tlbflush.h" 9#include "asm/tlbflush.h"
18#include "kern_util.h" 10#include "asm/uaccess.h"
19#include "as-layout.h" 11#include "as-layout.h"
12#include "kern_util.h"
20#include "mem_user.h" 13#include "mem_user.h"
21#include "os.h" 14#include "os.h"
22 15
@@ -34,30 +27,19 @@ EXPORT_SYMBOL(get_kmem_end);
34EXPORT_SYMBOL(high_physmem); 27EXPORT_SYMBOL(high_physmem);
35EXPORT_SYMBOL(empty_zero_page); 28EXPORT_SYMBOL(empty_zero_page);
36EXPORT_SYMBOL(um_virt_to_phys); 29EXPORT_SYMBOL(um_virt_to_phys);
37EXPORT_SYMBOL(mode_tt);
38EXPORT_SYMBOL(handle_page_fault); 30EXPORT_SYMBOL(handle_page_fault);
39EXPORT_SYMBOL(find_iomem); 31EXPORT_SYMBOL(find_iomem);
40 32
41#ifdef CONFIG_MODE_TT 33EXPORT_SYMBOL(strnlen_user);
42EXPORT_SYMBOL(stop); 34EXPORT_SYMBOL(strncpy_from_user);
43EXPORT_SYMBOL(strncpy_from_user_tt); 35EXPORT_SYMBOL(copy_to_user);
44EXPORT_SYMBOL(copy_from_user_tt); 36EXPORT_SYMBOL(copy_from_user);
45EXPORT_SYMBOL(copy_to_user_tt); 37EXPORT_SYMBOL(clear_user);
46#endif
47
48#ifdef CONFIG_MODE_SKAS
49EXPORT_SYMBOL(strnlen_user_skas);
50EXPORT_SYMBOL(strncpy_from_user_skas);
51EXPORT_SYMBOL(copy_to_user_skas);
52EXPORT_SYMBOL(copy_from_user_skas);
53EXPORT_SYMBOL(clear_user_skas);
54#endif
55EXPORT_SYMBOL(uml_strdup); 38EXPORT_SYMBOL(uml_strdup);
56 39
57EXPORT_SYMBOL(os_stat_fd); 40EXPORT_SYMBOL(os_stat_fd);
58EXPORT_SYMBOL(os_stat_file); 41EXPORT_SYMBOL(os_stat_file);
59EXPORT_SYMBOL(os_access); 42EXPORT_SYMBOL(os_access);
60EXPORT_SYMBOL(os_print_error);
61EXPORT_SYMBOL(os_get_exec_close); 43EXPORT_SYMBOL(os_get_exec_close);
62EXPORT_SYMBOL(os_set_exec_close); 44EXPORT_SYMBOL(os_set_exec_close);
63EXPORT_SYMBOL(os_getpid); 45EXPORT_SYMBOL(os_getpid);
@@ -85,9 +67,6 @@ EXPORT_SYMBOL(run_helper);
85EXPORT_SYMBOL(start_thread); 67EXPORT_SYMBOL(start_thread);
86EXPORT_SYMBOL(dump_thread); 68EXPORT_SYMBOL(dump_thread);
87 69
88EXPORT_SYMBOL(do_gettimeofday);
89EXPORT_SYMBOL(do_settimeofday);
90
91#ifdef CONFIG_SMP 70#ifdef CONFIG_SMP
92 71
93/* required for SMP */ 72/* required for SMP */
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index d2b11f242698..8456397f5f4d 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -17,7 +17,7 @@
17#include "as-layout.h" 17#include "as-layout.h"
18#include "kern.h" 18#include "kern.h"
19#include "mem_user.h" 19#include "mem_user.h"
20#include "uml_uaccess.h" 20#include "um_uaccess.h"
21#include "os.h" 21#include "os.h"
22#include "linux/types.h" 22#include "linux/types.h"
23#include "linux/string.h" 23#include "linux/string.h"
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c
index 5ee7e851bbc1..e66432f42485 100644
--- a/arch/um/kernel/physmem.c
+++ b/arch/um/kernel/physmem.c
@@ -1,25 +1,17 @@
1/* 1/*
2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/mm.h"
7#include "linux/rbtree.h"
8#include "linux/slab.h"
9#include "linux/vmalloc.h"
10#include "linux/bootmem.h" 6#include "linux/bootmem.h"
11#include "linux/module.h" 7#include "linux/mm.h"
12#include "linux/pfn.h" 8#include "linux/pfn.h"
13#include "asm/types.h" 9#include "asm/page.h"
14#include "asm/pgtable.h"
15#include "kern_util.h"
16#include "as-layout.h" 10#include "as-layout.h"
17#include "mode_kern.h" 11#include "init.h"
18#include "mem.h" 12#include "kern.h"
19#include "mem_user.h" 13#include "mem_user.h"
20#include "os.h" 14#include "os.h"
21#include "kern.h"
22#include "init.h"
23 15
24static int physmem_fd = -1; 16static int physmem_fd = -1;
25 17
@@ -49,10 +41,10 @@ int __init init_maps(unsigned long physmem, unsigned long iomem,
49 total_len = phys_len + iomem_len + highmem_len; 41 total_len = phys_len + iomem_len + highmem_len;
50 42
51 map = alloc_bootmem_low_pages(total_len); 43 map = alloc_bootmem_low_pages(total_len);
52 if(map == NULL) 44 if (map == NULL)
53 return -ENOMEM; 45 return -ENOMEM;
54 46
55 for(i = 0; i < total_pages; i++){ 47 for (i = 0; i < total_pages; i++) {
56 p = &map[i]; 48 p = &map[i];
57 memset(p, 0, sizeof(struct page)); 49 memset(p, 0, sizeof(struct page));
58 SetPageReserved(p); 50 SetPageReserved(p);
@@ -68,8 +60,8 @@ static unsigned long kmem_top = 0;
68 60
69unsigned long get_kmem_end(void) 61unsigned long get_kmem_end(void)
70{ 62{
71 if(kmem_top == 0) 63 if (kmem_top == 0)
72 kmem_top = CHOOSE_MODE(kmem_end_tt, kmem_end_skas); 64 kmem_top = host_task_size - 1024 * 1024;
73 return kmem_top; 65 return kmem_top;
74} 66}
75 67
@@ -81,9 +73,9 @@ void map_memory(unsigned long virt, unsigned long phys, unsigned long len,
81 73
82 fd = phys_mapping(phys, &offset); 74 fd = phys_mapping(phys, &offset);
83 err = os_map_memory((void *) virt, fd, offset, len, r, w, x); 75 err = os_map_memory((void *) virt, fd, offset, len, r, w, x);
84 if(err) { 76 if (err) {
85 if(err == -ENOMEM) 77 if (err == -ENOMEM)
86 printk("try increasing the host's " 78 printk(KERN_ERR "try increasing the host's "
87 "/proc/sys/vm/max_map_count to <physical " 79 "/proc/sys/vm/max_map_count to <physical "
88 "memory size>/4096\n"); 80 "memory size>/4096\n");
89 panic("map_memory(0x%lx, %d, 0x%llx, %ld, %d, %d, %d) failed, " 81 panic("map_memory(0x%lx, %d, 0x%llx, %ld, %d, %d, %d) failed, "
@@ -105,13 +97,16 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end,
105 97
106 offset = uml_reserved - uml_physmem; 98 offset = uml_reserved - uml_physmem;
107 err = os_map_memory((void *) uml_reserved, physmem_fd, offset, 99 err = os_map_memory((void *) uml_reserved, physmem_fd, offset,
108 len - offset, 1, 1, 0); 100 len - offset, 1, 1, 1);
109 if(err < 0){ 101 if (err < 0) {
110 os_print_error(err, "Mapping memory"); 102 printf("setup_physmem - mapping %ld bytes of memory at 0x%p "
103 "failed - errno = %d\n", len - offset,
104 (void *) uml_reserved, err);
111 exit(1); 105 exit(1);
112 } 106 }
113 107
114 /* Special kludge - This page will be mapped in to userspace processes 108 /*
109 * Special kludge - This page will be mapped in to userspace processes
115 * from physmem_fd, so it needs to be written out there. 110 * from physmem_fd, so it needs to be written out there.
116 */ 111 */
117 os_seek_file(physmem_fd, __pa(&__syscall_stub_start)); 112 os_seek_file(physmem_fd, __pa(&__syscall_stub_start));
@@ -122,20 +117,20 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end,
122 len - bootmap_size - reserve); 117 len - bootmap_size - reserve);
123} 118}
124 119
125int phys_mapping(unsigned long phys, __u64 *offset_out) 120int phys_mapping(unsigned long phys, unsigned long long *offset_out)
126{ 121{
127 int fd = -1; 122 int fd = -1;
128 123
129 if(phys < physmem_size){ 124 if (phys < physmem_size) {
130 fd = physmem_fd; 125 fd = physmem_fd;
131 *offset_out = phys; 126 *offset_out = phys;
132 } 127 }
133 else if(phys < __pa(end_iomem)){ 128 else if (phys < __pa(end_iomem)) {
134 struct iomem_region *region = iomem_regions; 129 struct iomem_region *region = iomem_regions;
135 130
136 while(region != NULL){ 131 while (region != NULL) {
137 if((phys >= region->phys) && 132 if ((phys >= region->phys) &&
138 (phys < region->phys + region->size)){ 133 (phys < region->phys + region->size)) {
139 fd = region->fd; 134 fd = region->fd;
140 *offset_out = phys - region->phys; 135 *offset_out = phys - region->phys;
141 break; 136 break;
@@ -143,7 +138,7 @@ int phys_mapping(unsigned long phys, __u64 *offset_out)
143 region = region->next; 138 region = region->next;
144 } 139 }
145 } 140 }
146 else if(phys < __pa(end_iomem) + highmem){ 141 else if (phys < __pa(end_iomem) + highmem) {
147 fd = physmem_fd; 142 fd = physmem_fd;
148 *offset_out = phys - iomem_size; 143 *offset_out = phys - iomem_size;
149 } 144 }
@@ -188,8 +183,8 @@ unsigned long find_iomem(char *driver, unsigned long *len_out)
188{ 183{
189 struct iomem_region *region = iomem_regions; 184 struct iomem_region *region = iomem_regions;
190 185
191 while(region != NULL){ 186 while (region != NULL) {
192 if(!strcmp(region->driver, driver)){ 187 if (!strcmp(region->driver, driver)) {
193 *len_out = region->size; 188 *len_out = region->size;
194 return region->virt; 189 return region->virt;
195 } 190 }
@@ -206,12 +201,12 @@ int setup_iomem(void)
206 unsigned long iomem_start = high_physmem + PAGE_SIZE; 201 unsigned long iomem_start = high_physmem + PAGE_SIZE;
207 int err; 202 int err;
208 203
209 while(region != NULL){ 204 while (region != NULL) {
210 err = os_map_memory((void *) iomem_start, region->fd, 0, 205 err = os_map_memory((void *) iomem_start, region->fd, 0,
211 region->size, 1, 1, 0); 206 region->size, 1, 1, 0);
212 if(err) 207 if (err)
213 printk("Mapping iomem region for driver '%s' failed, " 208 printk(KERN_ERR "Mapping iomem region for driver '%s' "
214 "errno = %d\n", region->driver, -err); 209 "failed, errno = %d\n", region->driver, -err);
215 else { 210 else {
216 region->virt = iomem_start; 211 region->virt = iomem_start;
217 region->phys = __pa(region->virt); 212 region->phys = __pa(region->virt);
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index bfa52f206bb6..0eae00b3e588 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -1,53 +1,30 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Copyright 2003 PathScale, Inc. 3 * Copyright 2003 PathScale, Inc.
4 * Licensed under the GPL 4 * Licensed under the GPL
5 */ 5 */
6 6
7#include "linux/kernel.h" 7#include "linux/stddef.h"
8#include "linux/sched.h" 8#include "linux/err.h"
9#include "linux/interrupt.h" 9#include "linux/hardirq.h"
10#include "linux/string.h"
11#include "linux/mm.h" 10#include "linux/mm.h"
12#include "linux/slab.h" 11#include "linux/personality.h"
13#include "linux/utsname.h"
14#include "linux/fs.h"
15#include "linux/utime.h"
16#include "linux/smp_lock.h"
17#include "linux/module.h"
18#include "linux/init.h"
19#include "linux/capability.h"
20#include "linux/vmalloc.h"
21#include "linux/spinlock.h"
22#include "linux/proc_fs.h" 12#include "linux/proc_fs.h"
23#include "linux/ptrace.h" 13#include "linux/ptrace.h"
24#include "linux/random.h" 14#include "linux/random.h"
25#include "linux/personality.h" 15#include "linux/sched.h"
26#include "asm/unistd.h" 16#include "linux/tick.h"
27#include "asm/mman.h" 17#include "linux/threads.h"
28#include "asm/segment.h"
29#include "asm/stat.h"
30#include "asm/pgtable.h" 18#include "asm/pgtable.h"
31#include "asm/processor.h"
32#include "asm/tlbflush.h"
33#include "asm/uaccess.h" 19#include "asm/uaccess.h"
34#include "asm/user.h"
35#include "kern_util.h"
36#include "as-layout.h" 20#include "as-layout.h"
37#include "kern.h" 21#include "kern_util.h"
38#include "signal_kern.h"
39#include "init.h"
40#include "irq_user.h"
41#include "mem_user.h"
42#include "tlb.h"
43#include "frame_kern.h"
44#include "sigcontext.h"
45#include "os.h" 22#include "os.h"
46#include "mode.h" 23#include "skas.h"
47#include "mode_kern.h" 24#include "tlb.h"
48#include "choose-mode.h"
49 25
50/* This is a per-cpu array. A processor only modifies its entry and it only 26/*
27 * This is a per-cpu array. A processor only modifies its entry and it only
51 * cares about its entry, so it's OK if another processor is modifying its 28 * cares about its entry, so it's OK if another processor is modifying its
52 * entry. 29 * entry.
53 */ 30 */
@@ -55,15 +32,16 @@ struct cpu_task cpu_tasks[NR_CPUS] = { [0 ... NR_CPUS - 1] = { -1, NULL } };
55 32
56static inline int external_pid(struct task_struct *task) 33static inline int external_pid(struct task_struct *task)
57{ 34{
58 return CHOOSE_MODE_PROC(external_pid_tt, external_pid_skas, task); 35 /* FIXME: Need to look up userspace_pid by cpu */
36 return userspace_pid[0];
59} 37}
60 38
61int pid_to_processor_id(int pid) 39int pid_to_processor_id(int pid)
62{ 40{
63 int i; 41 int i;
64 42
65 for(i = 0; i < ncpus; i++){ 43 for(i = 0; i < ncpus; i++) {
66 if(cpu_tasks[i].pid == pid) 44 if (cpu_tasks[i].pid == pid)
67 return i; 45 return i;
68 } 46 }
69 return -1; 47 return -1;
@@ -82,9 +60,9 @@ unsigned long alloc_stack(int order, int atomic)
82 if (atomic) 60 if (atomic)
83 flags = GFP_ATOMIC; 61 flags = GFP_ATOMIC;
84 page = __get_free_pages(flags, order); 62 page = __get_free_pages(flags, order);
85 if(page == 0) 63 if (page == 0)
86 return 0; 64 return 0;
87 stack_protections(page); 65
88 return page; 66 return page;
89} 67}
90 68
@@ -105,6 +83,8 @@ static inline void set_current(struct task_struct *task)
105 { external_pid(task), task }); 83 { external_pid(task), task });
106} 84}
107 85
86extern void arch_switch_to(struct task_struct *from, struct task_struct *to);
87
108void *_switch_to(void *prev, void *next, void *last) 88void *_switch_to(void *prev, void *next, void *last)
109{ 89{
110 struct task_struct *from = prev; 90 struct task_struct *from = prev;
@@ -114,9 +94,14 @@ void *_switch_to(void *prev, void *next, void *last)
114 set_current(to); 94 set_current(to);
115 95
116 do { 96 do {
117 current->thread.saved_task = NULL ; 97 current->thread.saved_task = NULL;
118 CHOOSE_MODE_PROC(switch_to_tt, switch_to_skas, prev, next); 98
119 if(current->thread.saved_task) 99 switch_threads(&from->thread.switch_buf,
100 &to->thread.switch_buf);
101
102 arch_switch_to(current->thread.prev_sched, current);
103
104 if (current->thread.saved_task)
120 show_regs(&(current->thread.regs)); 105 show_regs(&(current->thread.regs));
121 next= current->thread.saved_task; 106 next= current->thread.saved_task;
122 prev= current; 107 prev= current;
@@ -128,20 +113,14 @@ void *_switch_to(void *prev, void *next, void *last)
128 113
129void interrupt_end(void) 114void interrupt_end(void)
130{ 115{
131 if(need_resched()) 116 if (need_resched())
132 schedule(); 117 schedule();
133 if(test_tsk_thread_flag(current, TIF_SIGPENDING)) 118 if (test_tsk_thread_flag(current, TIF_SIGPENDING))
134 do_signal(); 119 do_signal();
135} 120}
136 121
137void release_thread(struct task_struct *task)
138{
139 CHOOSE_MODE(release_thread_tt(task), release_thread_skas(task));
140}
141
142void exit_thread(void) 122void exit_thread(void)
143{ 123{
144 unprotect_stack((unsigned long) current_thread);
145} 124}
146 125
147void *get_current(void) 126void *get_current(void)
@@ -149,28 +128,99 @@ void *get_current(void)
149 return current; 128 return current;
150} 129}
151 130
131extern void schedule_tail(struct task_struct *prev);
132
133/*
134 * This is called magically, by its address being stuffed in a jmp_buf
135 * and being longjmp-d to.
136 */
137void new_thread_handler(void)
138{
139 int (*fn)(void *), n;
140 void *arg;
141
142 if (current->thread.prev_sched != NULL)
143 schedule_tail(current->thread.prev_sched);
144 current->thread.prev_sched = NULL;
145
146 fn = current->thread.request.u.thread.proc;
147 arg = current->thread.request.u.thread.arg;
148
149 /*
150 * The return value is 1 if the kernel thread execs a process,
151 * 0 if it just exits
152 */
153 n = run_kernel_thread(fn, arg, &current->thread.exec_buf);
154 if (n == 1) {
155 /* Handle any immediate reschedules or signals */
156 interrupt_end();
157 userspace(&current->thread.regs.regs);
158 }
159 else do_exit(0);
160}
161
162/* Called magically, see new_thread_handler above */
163void fork_handler(void)
164{
165 force_flush_all();
166 if (current->thread.prev_sched == NULL)
167 panic("blech");
168
169 schedule_tail(current->thread.prev_sched);
170
171 /*
172 * XXX: if interrupt_end() calls schedule, this call to
173 * arch_switch_to isn't needed. We could want to apply this to
174 * improve performance. -bb
175 */
176 arch_switch_to(current->thread.prev_sched, current);
177
178 current->thread.prev_sched = NULL;
179
180 /* Handle any immediate reschedules or signals */
181 interrupt_end();
182
183 userspace(&current->thread.regs.regs);
184}
185
152int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, 186int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
153 unsigned long stack_top, struct task_struct * p, 187 unsigned long stack_top, struct task_struct * p,
154 struct pt_regs *regs) 188 struct pt_regs *regs)
155{ 189{
156 int ret; 190 void (*handler)(void);
191 int ret = 0;
157 192
158 p->thread = (struct thread_struct) INIT_THREAD; 193 p->thread = (struct thread_struct) INIT_THREAD;
159 ret = CHOOSE_MODE_PROC(copy_thread_tt, copy_thread_skas, nr,
160 clone_flags, sp, stack_top, p, regs);
161 194
162 if (ret || !current->thread.forking) 195 if (current->thread.forking) {
163 goto out; 196 memcpy(&p->thread.regs.regs, &regs->regs,
197 sizeof(p->thread.regs.regs));
198 REGS_SET_SYSCALL_RETURN(p->thread.regs.regs.gp, 0);
199 if (sp != 0)
200 REGS_SP(p->thread.regs.regs.gp) = sp;
164 201
165 clear_flushed_tls(p); 202 handler = fork_handler;
166 203
167 /* 204 arch_copy_thread(&current->thread.arch, &p->thread.arch);
168 * Set a new TLS for the child thread? 205 }
169 */ 206 else {
170 if (clone_flags & CLONE_SETTLS) 207 init_thread_registers(&p->thread.regs.regs);
171 ret = arch_copy_tls(p); 208 p->thread.request.u.thread = current->thread.request.u.thread;
209 handler = new_thread_handler;
210 }
211
212 new_thread(task_stack_page(p), &p->thread.switch_buf, handler);
213
214 if (current->thread.forking) {
215 clear_flushed_tls(p);
216
217 /*
218 * Set a new TLS for the child thread?
219 */
220 if (clone_flags & CLONE_SETTLS)
221 ret = arch_copy_tls(p);
222 }
172 223
173out:
174 return ret; 224 return ret;
175} 225}
176 226
@@ -179,39 +229,35 @@ void initial_thread_cb(void (*proc)(void *), void *arg)
179 int save_kmalloc_ok = kmalloc_ok; 229 int save_kmalloc_ok = kmalloc_ok;
180 230
181 kmalloc_ok = 0; 231 kmalloc_ok = 0;
182 CHOOSE_MODE_PROC(initial_thread_cb_tt, initial_thread_cb_skas, proc, 232 initial_thread_cb_skas(proc, arg);
183 arg);
184 kmalloc_ok = save_kmalloc_ok; 233 kmalloc_ok = save_kmalloc_ok;
185} 234}
186 235
187#ifdef CONFIG_MODE_TT
188unsigned long stack_sp(unsigned long page)
189{
190 return page + PAGE_SIZE - sizeof(void *);
191}
192#endif
193
194void default_idle(void) 236void default_idle(void)
195{ 237{
196 CHOOSE_MODE(uml_idle_timer(), (void) 0); 238 unsigned long long nsecs;
197 239
198 while(1){ 240 while(1) {
199 /* endless idle loop with no priority at all */ 241 /* endless idle loop with no priority at all */
200 242
201 /* 243 /*
202 * although we are an idle CPU, we do not want to 244 * although we are an idle CPU, we do not want to
203 * get into the scheduler unnecessarily. 245 * get into the scheduler unnecessarily.
204 */ 246 */
205 if(need_resched()) 247 if (need_resched())
206 schedule(); 248 schedule();
207 249
208 idle_sleep(10); 250 tick_nohz_stop_sched_tick();
251 nsecs = disable_timer();
252 idle_sleep(nsecs);
253 tick_nohz_restart_sched_tick();
209 } 254 }
210} 255}
211 256
212void cpu_idle(void) 257void cpu_idle(void)
213{ 258{
214 CHOOSE_MODE(init_idle_tt(), init_idle_skas()); 259 cpu_tasks[current_thread->cpu].pid = os_getpid();
260 default_idle();
215} 261}
216 262
217void *um_virt_to_phys(struct task_struct *task, unsigned long addr, 263void *um_virt_to_phys(struct task_struct *task, unsigned long addr,
@@ -223,26 +269,26 @@ void *um_virt_to_phys(struct task_struct *task, unsigned long addr,
223 pte_t *pte; 269 pte_t *pte;
224 pte_t ptent; 270 pte_t ptent;
225 271
226 if(task->mm == NULL) 272 if (task->mm == NULL)
227 return ERR_PTR(-EINVAL); 273 return ERR_PTR(-EINVAL);
228 pgd = pgd_offset(task->mm, addr); 274 pgd = pgd_offset(task->mm, addr);
229 if(!pgd_present(*pgd)) 275 if (!pgd_present(*pgd))
230 return ERR_PTR(-EINVAL); 276 return ERR_PTR(-EINVAL);
231 277
232 pud = pud_offset(pgd, addr); 278 pud = pud_offset(pgd, addr);
233 if(!pud_present(*pud)) 279 if (!pud_present(*pud))
234 return ERR_PTR(-EINVAL); 280 return ERR_PTR(-EINVAL);
235 281
236 pmd = pmd_offset(pud, addr); 282 pmd = pmd_offset(pud, addr);
237 if(!pmd_present(*pmd)) 283 if (!pmd_present(*pmd))
238 return ERR_PTR(-EINVAL); 284 return ERR_PTR(-EINVAL);
239 285
240 pte = pte_offset_kernel(pmd, addr); 286 pte = pte_offset_kernel(pmd, addr);
241 ptent = *pte; 287 ptent = *pte;
242 if(!pte_present(ptent)) 288 if (!pte_present(ptent))
243 return ERR_PTR(-EINVAL); 289 return ERR_PTR(-EINVAL);
244 290
245 if(pte_out != NULL) 291 if (pte_out != NULL)
246 *pte_out = ptent; 292 *pte_out = ptent;
247 return (void *) (pte_val(ptent) & PAGE_MASK) + (addr & ~PAGE_MASK); 293 return (void *) (pte_val(ptent) & PAGE_MASK) + (addr & ~PAGE_MASK);
248} 294}
@@ -315,7 +361,7 @@ int smp_sigio_handler(void)
315#ifdef CONFIG_SMP 361#ifdef CONFIG_SMP
316 int cpu = current_thread->cpu; 362 int cpu = current_thread->cpu;
317 IPI_handler(cpu); 363 IPI_handler(cpu);
318 if(cpu != 0) 364 if (cpu != 0)
319 return 1; 365 return 1;
320#endif 366#endif
321 return 0; 367 return 0;
@@ -343,7 +389,8 @@ int get_using_sysemu(void)
343 389
344static int proc_read_sysemu(char *buf, char **start, off_t offset, int size,int *eof, void *data) 390static int proc_read_sysemu(char *buf, char **start, off_t offset, int size,int *eof, void *data)
345{ 391{
346 if (snprintf(buf, size, "%d\n", get_using_sysemu()) < size) /*No overflow*/ 392 if (snprintf(buf, size, "%d\n", get_using_sysemu()) < size)
393 /* No overflow */
347 *eof = 1; 394 *eof = 1;
348 395
349 return strlen(buf); 396 return strlen(buf);
@@ -358,7 +405,8 @@ static int proc_write_sysemu(struct file *file,const char __user *buf, unsigned
358 405
359 if (tmp[0] >= '0' && tmp[0] <= '2') 406 if (tmp[0] >= '0' && tmp[0] <= '2')
360 set_using_sysemu(tmp[0] - '0'); 407 set_using_sysemu(tmp[0] - '0');
361 return count; /*We use the first char, but pretend to write everything*/ 408 /* We use the first char, but pretend to write everything */
409 return count;
362} 410}
363 411
364int __init make_proc_sysemu(void) 412int __init make_proc_sysemu(void)
@@ -388,10 +436,10 @@ int singlestepping(void * t)
388 struct task_struct *task = t ? t : current; 436 struct task_struct *task = t ? t : current;
389 437
390 if ( ! (task->ptrace & PT_DTRACE) ) 438 if ( ! (task->ptrace & PT_DTRACE) )
391 return(0); 439 return 0;
392 440
393 if (task->thread.singlestep_syscall) 441 if (task->thread.singlestep_syscall)
394 return(1); 442 return 1;
395 443
396 return 2; 444 return 2;
397} 445}
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c
index 6916c8888dba..a0eba0833068 100644
--- a/arch/um/kernel/ptrace.c
+++ b/arch/um/kernel/ptrace.c
@@ -1,35 +1,27 @@
1/* 1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/sched.h"
7#include "linux/mm.h"
8#include "linux/errno.h"
9#include "linux/smp_lock.h"
10#include "linux/security.h"
11#include "linux/ptrace.h"
12#include "linux/audit.h" 6#include "linux/audit.h"
7#include "linux/ptrace.h"
8#include "linux/sched.h"
9#include "asm/uaccess.h"
13#ifdef CONFIG_PROC_MM 10#ifdef CONFIG_PROC_MM
14#include "linux/proc_mm.h" 11#include "proc_mm.h"
15#endif 12#endif
16#include "asm/ptrace.h"
17#include "asm/uaccess.h"
18#include "kern_util.h"
19#include "skas_ptrace.h" 13#include "skas_ptrace.h"
20#include "sysdep/ptrace.h"
21#include "os.h"
22 14
23static inline void set_singlestepping(struct task_struct *child, int on) 15static inline void set_singlestepping(struct task_struct *child, int on)
24{ 16{
25 if (on) 17 if (on)
26 child->ptrace |= PT_DTRACE; 18 child->ptrace |= PT_DTRACE;
27 else 19 else
28 child->ptrace &= ~PT_DTRACE; 20 child->ptrace &= ~PT_DTRACE;
29 child->thread.singlestep_syscall = 0; 21 child->thread.singlestep_syscall = 0;
30 22
31#ifdef SUBARCH_SET_SINGLESTEPPING 23#ifdef SUBARCH_SET_SINGLESTEPPING
32 SUBARCH_SET_SINGLESTEPPING(child, on); 24 SUBARCH_SET_SINGLESTEPPING(child, on);
33#endif 25#endif
34} 26}
35 27
@@ -37,8 +29,8 @@ static inline void set_singlestepping(struct task_struct *child, int on)
37 * Called by kernel/ptrace.c when detaching.. 29 * Called by kernel/ptrace.c when detaching..
38 */ 30 */
39void ptrace_disable(struct task_struct *child) 31void ptrace_disable(struct task_struct *child)
40{ 32{
41 set_singlestepping(child,0); 33 set_singlestepping(child,0);
42} 34}
43 35
44extern int peek_user(struct task_struct * child, long addr, long data); 36extern int peek_user(struct task_struct * child, long addr, long data);
@@ -50,40 +42,40 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
50 unsigned long __user *p = (void __user *)(unsigned long)data; 42 unsigned long __user *p = (void __user *)(unsigned long)data;
51 43
52 switch (request) { 44 switch (request) {
53 /* when I and D space are separate, these will need to be fixed. */ 45 /* read word at location addr. */
54 case PTRACE_PEEKTEXT: /* read word at location addr. */ 46 case PTRACE_PEEKTEXT:
55 case PTRACE_PEEKDATA: 47 case PTRACE_PEEKDATA:
56 ret = generic_ptrace_peekdata(child, addr, data); 48 ret = generic_ptrace_peekdata(child, addr, data);
57 break; 49 break;
58 50
59 /* read the word at location addr in the USER area. */ 51 /* read the word at location addr in the USER area. */
60 case PTRACE_PEEKUSR: 52 case PTRACE_PEEKUSR:
61 ret = peek_user(child, addr, data); 53 ret = peek_user(child, addr, data);
62 break; 54 break;
63 55
64 /* when I and D space are separate, this will have to be fixed. */ 56 /* write the word at location addr. */
65 case PTRACE_POKETEXT: /* write the word at location addr. */ 57 case PTRACE_POKETEXT:
66 case PTRACE_POKEDATA: 58 case PTRACE_POKEDATA:
67 ret = generic_ptrace_pokedata(child, addr, data); 59 ret = generic_ptrace_pokedata(child, addr, data);
68 break; 60 break;
69 61
70 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ 62 /* write the word at location addr in the USER area */
71 ret = poke_user(child, addr, data); 63 case PTRACE_POKEUSR:
72 break; 64 ret = poke_user(child, addr, data);
65 break;
73 66
74 case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ 67 /* continue and stop at next (return from) syscall */
75 case PTRACE_CONT: { /* restart after signal. */ 68 case PTRACE_SYSCALL:
69 /* restart after signal. */
70 case PTRACE_CONT: {
76 ret = -EIO; 71 ret = -EIO;
77 if (!valid_signal(data)) 72 if (!valid_signal(data))
78 break; 73 break;
79 74
80 set_singlestepping(child, 0); 75 set_singlestepping(child, 0);
81 if (request == PTRACE_SYSCALL) { 76 if (request == PTRACE_SYSCALL)
82 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 77 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
83 } 78 else clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
84 else {
85 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
86 }
87 child->exit_code = data; 79 child->exit_code = data;
88 wake_up_process(child); 80 wake_up_process(child);
89 ret = 0; 81 ret = 0;
@@ -91,8 +83,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
91 } 83 }
92 84
93/* 85/*
94 * make the child exit. Best I can do is send it a sigkill. 86 * make the child exit. Best I can do is send it a sigkill.
95 * perhaps it should be put in the status that it wants to 87 * perhaps it should be put in the status that it wants to
96 * exit. 88 * exit.
97 */ 89 */
98 case PTRACE_KILL: { 90 case PTRACE_KILL: {
@@ -100,7 +92,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
100 if (child->exit_state == EXIT_ZOMBIE) /* already dead */ 92 if (child->exit_state == EXIT_ZOMBIE) /* already dead */
101 break; 93 break;
102 94
103 set_singlestepping(child, 0); 95 set_singlestepping(child, 0);
104 child->exit_code = SIGKILL; 96 child->exit_code = SIGKILL;
105 wake_up_process(child); 97 wake_up_process(child);
106 break; 98 break;
@@ -111,7 +103,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
111 if (!valid_signal(data)) 103 if (!valid_signal(data))
112 break; 104 break;
113 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 105 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
114 set_singlestepping(child, 1); 106 set_singlestepping(child, 1);
115 child->exit_code = data; 107 child->exit_code = data;
116 /* give it a chance to run. */ 108 /* give it a chance to run. */
117 wake_up_process(child); 109 wake_up_process(child);
@@ -119,11 +111,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
119 break; 111 break;
120 } 112 }
121 113
122 case PTRACE_DETACH:
123 /* detach a process that was attached. */
124 ret = ptrace_detach(child, data);
125 break;
126
127#ifdef PTRACE_GETREGS 114#ifdef PTRACE_GETREGS
128 case PTRACE_GETREGS: { /* Get all gp regs from the child. */ 115 case PTRACE_GETREGS: { /* Get all gp regs from the child. */
129 if (!access_ok(VERIFY_WRITE, p, MAX_REG_OFFSET)) { 116 if (!access_ok(VERIFY_WRITE, p, MAX_REG_OFFSET)) {
@@ -156,22 +143,14 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
156#endif 143#endif
157#ifdef PTRACE_GETFPREGS 144#ifdef PTRACE_GETFPREGS
158 case PTRACE_GETFPREGS: /* Get the child FPU state. */ 145 case PTRACE_GETFPREGS: /* Get the child FPU state. */
159 ret = get_fpregs(data, child); 146 ret = get_fpregs((struct user_i387_struct __user *) data,
147 child);
160 break; 148 break;
161#endif 149#endif
162#ifdef PTRACE_SETFPREGS 150#ifdef PTRACE_SETFPREGS
163 case PTRACE_SETFPREGS: /* Set the child FPU state. */ 151 case PTRACE_SETFPREGS: /* Set the child FPU state. */
164 ret = set_fpregs(data, child); 152 ret = set_fpregs((struct user_i387_struct __user *) data,
165 break; 153 child);
166#endif
167#ifdef PTRACE_GETFPXREGS
168 case PTRACE_GETFPXREGS: /* Get the child FPU state. */
169 ret = get_fpxregs(data, child);
170 break;
171#endif
172#ifdef PTRACE_SETFPXREGS
173 case PTRACE_SETFPXREGS: /* Set the child FPU state. */
174 ret = set_fpxregs(data, child);
175 break; 154 break;
176#endif 155#endif
177 case PTRACE_GET_THREAD_AREA: 156 case PTRACE_GET_THREAD_AREA:
@@ -185,14 +164,13 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
185 break; 164 break;
186 165
187 case PTRACE_FAULTINFO: { 166 case PTRACE_FAULTINFO: {
188 /* Take the info from thread->arch->faultinfo, 167 /*
168 * Take the info from thread->arch->faultinfo,
189 * but transfer max. sizeof(struct ptrace_faultinfo). 169 * but transfer max. sizeof(struct ptrace_faultinfo).
190 * On i386, ptrace_faultinfo is smaller! 170 * On i386, ptrace_faultinfo is smaller!
191 */ 171 */
192 ret = copy_to_user(p, &child->thread.arch.faultinfo, 172 ret = copy_to_user(p, &child->thread.arch.faultinfo,
193 sizeof(struct ptrace_faultinfo)); 173 sizeof(struct ptrace_faultinfo));
194 if(ret)
195 break;
196 break; 174 break;
197 } 175 }
198 176
@@ -200,12 +178,13 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
200 case PTRACE_LDT: { 178 case PTRACE_LDT: {
201 struct ptrace_ldt ldt; 179 struct ptrace_ldt ldt;
202 180
203 if(copy_from_user(&ldt, p, sizeof(ldt))){ 181 if (copy_from_user(&ldt, p, sizeof(ldt))) {
204 ret = -EIO; 182 ret = -EIO;
205 break; 183 break;
206 } 184 }
207 185
208 /* This one is confusing, so just punt and return -EIO for 186 /*
187 * This one is confusing, so just punt and return -EIO for
209 * now 188 * now
210 */ 189 */
211 ret = -EIO; 190 ret = -EIO;
@@ -217,7 +196,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
217 struct mm_struct *old = child->mm; 196 struct mm_struct *old = child->mm;
218 struct mm_struct *new = proc_mm_get_mm(data); 197 struct mm_struct *new = proc_mm_get_mm(data);
219 198
220 if(IS_ERR(new)){ 199 if (IS_ERR(new)) {
221 ret = PTR_ERR(new); 200 ret = PTR_ERR(new);
222 break; 201 break;
223 } 202 }
@@ -231,20 +210,22 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
231 } 210 }
232#endif 211#endif
233#ifdef PTRACE_ARCH_PRCTL 212#ifdef PTRACE_ARCH_PRCTL
234 case PTRACE_ARCH_PRCTL: 213 case PTRACE_ARCH_PRCTL:
235 /* XXX Calls ptrace on the host - needs some SMP thinking */ 214 /* XXX Calls ptrace on the host - needs some SMP thinking */
236 ret = arch_prctl_skas(child, data, (void *) addr); 215 ret = arch_prctl(child, data, (void *) addr);
237 break; 216 break;
238#endif 217#endif
239 default: 218 default:
240 ret = ptrace_request(child, request, addr, data); 219 ret = ptrace_request(child, request, addr, data);
220 if (ret == -EIO)
221 ret = subarch_ptrace(child, request, addr, data);
241 break; 222 break;
242 } 223 }
243 224
244 return ret; 225 return ret;
245} 226}
246 227
247void send_sigtrap(struct task_struct *tsk, union uml_pt_regs *regs, 228void send_sigtrap(struct task_struct *tsk, struct uml_pt_regs *regs,
248 int error_code) 229 int error_code)
249{ 230{
250 struct siginfo info; 231 struct siginfo info;
@@ -260,10 +241,11 @@ void send_sigtrap(struct task_struct *tsk, union uml_pt_regs *regs,
260 force_sig_info(SIGTRAP, &info, tsk); 241 force_sig_info(SIGTRAP, &info, tsk);
261} 242}
262 243
263/* XXX Check PT_DTRACE vs TIF_SINGLESTEP for singlestepping check and 244/*
245 * XXX Check PT_DTRACE vs TIF_SINGLESTEP for singlestepping check and
264 * PT_PTRACED vs TIF_SYSCALL_TRACE for syscall tracing check 246 * PT_PTRACED vs TIF_SYSCALL_TRACE for syscall tracing check
265 */ 247 */
266void syscall_trace(union uml_pt_regs *regs, int entryexit) 248void syscall_trace(struct uml_pt_regs *regs, int entryexit)
267{ 249{
268 int is_singlestep = (current->ptrace & PT_DTRACE) && entryexit; 250 int is_singlestep = (current->ptrace & PT_DTRACE) && entryexit;
269 int tracesysgood; 251 int tracesysgood;
@@ -277,7 +259,7 @@ void syscall_trace(union uml_pt_regs *regs, int entryexit)
277 UPT_SYSCALL_ARG3(regs), 259 UPT_SYSCALL_ARG3(regs),
278 UPT_SYSCALL_ARG4(regs)); 260 UPT_SYSCALL_ARG4(regs));
279 else audit_syscall_exit(AUDITSC_RESULT(UPT_SYSCALL_RET(regs)), 261 else audit_syscall_exit(AUDITSC_RESULT(UPT_SYSCALL_RET(regs)),
280 UPT_SYSCALL_RET(regs)); 262 UPT_SYSCALL_RET(regs));
281 } 263 }
282 264
283 /* Fake a debug trap */ 265 /* Fake a debug trap */
@@ -290,15 +272,18 @@ void syscall_trace(union uml_pt_regs *regs, int entryexit)
290 if (!(current->ptrace & PT_PTRACED)) 272 if (!(current->ptrace & PT_PTRACED))
291 return; 273 return;
292 274
293 /* the 0x80 provides a way for the tracing parent to distinguish 275 /*
294 between a syscall stop and SIGTRAP delivery */ 276 * the 0x80 provides a way for the tracing parent to distinguish
277 * between a syscall stop and SIGTRAP delivery
278 */
295 tracesysgood = (current->ptrace & PT_TRACESYSGOOD); 279 tracesysgood = (current->ptrace & PT_TRACESYSGOOD);
296 ptrace_notify(SIGTRAP | (tracesysgood ? 0x80 : 0)); 280 ptrace_notify(SIGTRAP | (tracesysgood ? 0x80 : 0));
297 281
298 if (entryexit) /* force do_signal() --> is_syscall() */ 282 if (entryexit) /* force do_signal() --> is_syscall() */
299 set_thread_flag(TIF_SIGPENDING); 283 set_thread_flag(TIF_SIGPENDING);
300 284
301 /* this isn't the same as continuing with a signal, but it will do 285 /*
286 * this isn't the same as continuing with a signal, but it will do
302 * for normal use. strace only continues with a signal if the 287 * for normal use. strace only continues with a signal if the
303 * stopping signal is not SIGTRAP. -brl 288 * stopping signal is not SIGTRAP. -brl
304 */ 289 */
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c
index 7e4305a1fd3c..04cebcf0679f 100644
--- a/arch/um/kernel/reboot.c
+++ b/arch/um/kernel/reboot.c
@@ -1,60 +1,53 @@
1/* 1/*
2 * Copyright (C) 2000, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/module.h"
7#include "linux/sched.h" 6#include "linux/sched.h"
8#include "asm/smp.h"
9#include "kern_util.h"
10#include "kern.h"
11#include "os.h" 7#include "os.h"
12#include "mode.h" 8#include "skas.h"
13#include "choose-mode.h"
14 9
15void (*pm_power_off)(void); 10void (*pm_power_off)(void);
16 11
17#ifdef CONFIG_SMP
18static void kill_idlers(int me)
19{
20#ifdef CONFIG_MODE_TT
21 struct task_struct *p;
22 int i;
23
24 for(i = 0; i < ARRAY_SIZE(idle_threads); i++){
25 p = idle_threads[i];
26 if((p != NULL) && (p->thread.mode.tt.extern_pid != me))
27 os_kill_process(p->thread.mode.tt.extern_pid, 0);
28 }
29#endif
30}
31#endif
32
33static void kill_off_processes(void) 12static void kill_off_processes(void)
34{ 13{
35 CHOOSE_MODE(kill_off_processes_tt(), kill_off_processes_skas()); 14 if(proc_mm)
36#ifdef CONFIG_SMP 15 /*
37 kill_idlers(os_getpid()); 16 * FIXME: need to loop over userspace_pids
38#endif 17 */
18 os_kill_ptraced_process(userspace_pid[0], 1);
19 else {
20 struct task_struct *p;
21 int pid, me;
22
23 me = os_getpid();
24 for_each_process(p){
25 if(p->mm == NULL)
26 continue;
27
28 pid = p->mm->context.id.u.pid;
29 os_kill_ptraced_process(pid, 1);
30 }
31 }
39} 32}
40 33
41void uml_cleanup(void) 34void uml_cleanup(void)
42{ 35{
43 kmalloc_ok = 0; 36 kmalloc_ok = 0;
44 do_uml_exitcalls(); 37 do_uml_exitcalls();
45 kill_off_processes(); 38 kill_off_processes();
46} 39}
47 40
48void machine_restart(char * __unused) 41void machine_restart(char * __unused)
49{ 42{
50 uml_cleanup(); 43 uml_cleanup();
51 CHOOSE_MODE(reboot_tt(), reboot_skas()); 44 reboot_skas();
52} 45}
53 46
54void machine_power_off(void) 47void machine_power_off(void)
55{ 48{
56 uml_cleanup(); 49 uml_cleanup();
57 CHOOSE_MODE(halt_tt(), halt_skas()); 50 halt_skas();
58} 51}
59 52
60void machine_halt(void) 53void machine_halt(void)
diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c
index c4020c3d7857..19cb97733937 100644
--- a/arch/um/kernel/signal.c
+++ b/arch/um/kernel/signal.c
@@ -1,29 +1,17 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/stddef.h"
7#include "linux/sys.h"
8#include "linux/sched.h"
9#include "linux/wait.h"
10#include "linux/kernel.h"
11#include "linux/smp_lock.h"
12#include "linux/module.h" 6#include "linux/module.h"
13#include "linux/slab.h"
14#include "linux/tty.h"
15#include "linux/binfmts.h"
16#include "linux/ptrace.h" 7#include "linux/ptrace.h"
8#include "linux/sched.h"
9#include "asm/siginfo.h"
17#include "asm/signal.h" 10#include "asm/signal.h"
18#include "asm/uaccess.h"
19#include "asm/unistd.h" 11#include "asm/unistd.h"
20#include "asm/ucontext.h"
21#include "kern_util.h"
22#include "signal_kern.h"
23#include "kern.h"
24#include "frame_kern.h" 12#include "frame_kern.h"
13#include "kern_util.h"
25#include "sigcontext.h" 14#include "sigcontext.h"
26#include "mode.h"
27 15
28EXPORT_SYMBOL(block_signals); 16EXPORT_SYMBOL(block_signals);
29EXPORT_SYMBOL(unblock_signals); 17EXPORT_SYMBOL(unblock_signals);
@@ -46,9 +34,9 @@ static int handle_signal(struct pt_regs *regs, unsigned long signr,
46 current_thread_info()->restart_block.fn = do_no_restart_syscall; 34 current_thread_info()->restart_block.fn = do_no_restart_syscall;
47 35
48 /* Did we come from a system call? */ 36 /* Did we come from a system call? */
49 if(PT_REGS_SYSCALL_NR(regs) >= 0){ 37 if (PT_REGS_SYSCALL_NR(regs) >= 0) {
50 /* If so, check system call restarting.. */ 38 /* If so, check system call restarting.. */
51 switch(PT_REGS_SYSCALL_RET(regs)){ 39 switch(PT_REGS_SYSCALL_RET(regs)) {
52 case -ERESTART_RESTARTBLOCK: 40 case -ERESTART_RESTARTBLOCK:
53 case -ERESTARTNOHAND: 41 case -ERESTARTNOHAND:
54 PT_REGS_SYSCALL_RET(regs) = -EINTR; 42 PT_REGS_SYSCALL_RET(regs) = -EINTR;
@@ -68,17 +56,17 @@ static int handle_signal(struct pt_regs *regs, unsigned long signr,
68 } 56 }
69 57
70 sp = PT_REGS_SP(regs); 58 sp = PT_REGS_SP(regs);
71 if((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags(sp) == 0)) 59 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags(sp) == 0))
72 sp = current->sas_ss_sp + current->sas_ss_size; 60 sp = current->sas_ss_sp + current->sas_ss_size;
73 61
74#ifdef CONFIG_ARCH_HAS_SC_SIGNALS 62#ifdef CONFIG_ARCH_HAS_SC_SIGNALS
75 if(!(ka->sa.sa_flags & SA_SIGINFO)) 63 if (!(ka->sa.sa_flags & SA_SIGINFO))
76 err = setup_signal_stack_sc(sp, signr, ka, regs, oldset); 64 err = setup_signal_stack_sc(sp, signr, ka, regs, oldset);
77 else 65 else
78#endif 66#endif
79 err = setup_signal_stack_si(sp, signr, ka, regs, info, oldset); 67 err = setup_signal_stack_si(sp, signr, ka, regs, info, oldset);
80 68
81 if(err){ 69 if (err) {
82 spin_lock_irq(&current->sighand->siglock); 70 spin_lock_irq(&current->sighand->siglock);
83 current->blocked = *oldset; 71 current->blocked = *oldset;
84 recalc_sigpending(); 72 recalc_sigpending();
@@ -88,7 +76,7 @@ static int handle_signal(struct pt_regs *regs, unsigned long signr,
88 spin_lock_irq(&current->sighand->siglock); 76 spin_lock_irq(&current->sighand->siglock);
89 sigorsets(&current->blocked, &current->blocked, 77 sigorsets(&current->blocked, &current->blocked,
90 &ka->sa.sa_mask); 78 &ka->sa.sa_mask);
91 if(!(ka->sa.sa_flags & SA_NODEFER)) 79 if (!(ka->sa.sa_flags & SA_NODEFER))
92 sigaddset(&current->blocked, signr); 80 sigaddset(&current->blocked, signr);
93 recalc_sigpending(); 81 recalc_sigpending();
94 spin_unlock_irq(&current->sighand->siglock); 82 spin_unlock_irq(&current->sighand->siglock);
@@ -109,14 +97,16 @@ static int kern_do_signal(struct pt_regs *regs)
109 else 97 else
110 oldset = &current->blocked; 98 oldset = &current->blocked;
111 99
112 while((sig = get_signal_to_deliver(&info, &ka_copy, regs, NULL)) > 0){ 100 while ((sig = get_signal_to_deliver(&info, &ka_copy, regs, NULL)) > 0) {
113 handled_sig = 1; 101 handled_sig = 1;
114 /* Whee! Actually deliver the signal. */ 102 /* Whee! Actually deliver the signal. */
115 if(!handle_signal(regs, sig, &ka_copy, &info, oldset)){ 103 if (!handle_signal(regs, sig, &ka_copy, &info, oldset)) {
116 /* a signal was successfully delivered; the saved 104 /*
105 * a signal was successfully delivered; the saved
117 * sigmask will have been stored in the signal frame, 106 * sigmask will have been stored in the signal frame,
118 * and will be restored by sigreturn, so we can simply 107 * and will be restored by sigreturn, so we can simply
119 * clear the TIF_RESTORE_SIGMASK flag */ 108 * clear the TIF_RESTORE_SIGMASK flag
109 */
120 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 110 if (test_thread_flag(TIF_RESTORE_SIGMASK))
121 clear_thread_flag(TIF_RESTORE_SIGMASK); 111 clear_thread_flag(TIF_RESTORE_SIGMASK);
122 break; 112 break;
@@ -124,9 +114,9 @@ static int kern_do_signal(struct pt_regs *regs)
124 } 114 }
125 115
126 /* Did we come from a system call? */ 116 /* Did we come from a system call? */
127 if(!handled_sig && (PT_REGS_SYSCALL_NR(regs) >= 0)){ 117 if (!handled_sig && (PT_REGS_SYSCALL_NR(regs) >= 0)) {
128 /* Restart the system call - no handlers present */ 118 /* Restart the system call - no handlers present */
129 switch(PT_REGS_SYSCALL_RET(regs)){ 119 switch(PT_REGS_SYSCALL_RET(regs)) {
130 case -ERESTARTNOHAND: 120 case -ERESTARTNOHAND:
131 case -ERESTARTSYS: 121 case -ERESTARTSYS:
132 case -ERESTARTNOINTR: 122 case -ERESTARTNOINTR:
@@ -137,22 +127,25 @@ static int kern_do_signal(struct pt_regs *regs)
137 PT_REGS_ORIG_SYSCALL(regs) = __NR_restart_syscall; 127 PT_REGS_ORIG_SYSCALL(regs) = __NR_restart_syscall;
138 PT_REGS_RESTART_SYSCALL(regs); 128 PT_REGS_RESTART_SYSCALL(regs);
139 break; 129 break;
140 } 130 }
141 } 131 }
142 132
143 /* This closes a way to execute a system call on the host. If 133 /*
134 * This closes a way to execute a system call on the host. If
144 * you set a breakpoint on a system call instruction and singlestep 135 * you set a breakpoint on a system call instruction and singlestep
145 * from it, the tracing thread used to PTRACE_SINGLESTEP the process 136 * from it, the tracing thread used to PTRACE_SINGLESTEP the process
146 * rather than PTRACE_SYSCALL it, allowing the system call to execute 137 * rather than PTRACE_SYSCALL it, allowing the system call to execute
147 * on the host. The tracing thread will check this flag and 138 * on the host. The tracing thread will check this flag and
148 * PTRACE_SYSCALL if necessary. 139 * PTRACE_SYSCALL if necessary.
149 */ 140 */
150 if(current->ptrace & PT_DTRACE) 141 if (current->ptrace & PT_DTRACE)
151 current->thread.singlestep_syscall = 142 current->thread.singlestep_syscall =
152 is_syscall(PT_REGS_IP(&current->thread.regs)); 143 is_syscall(PT_REGS_IP(&current->thread.regs));
153 144
154 /* if there's no signal to deliver, we just put the saved sigmask 145 /*
155 * back */ 146 * if there's no signal to deliver, we just put the saved sigmask
147 * back
148 */
156 if (!handled_sig && test_thread_flag(TIF_RESTORE_SIGMASK)) { 149 if (!handled_sig && test_thread_flag(TIF_RESTORE_SIGMASK)) {
157 clear_thread_flag(TIF_RESTORE_SIGMASK); 150 clear_thread_flag(TIF_RESTORE_SIGMASK);
158 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 151 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
diff --git a/arch/um/kernel/skas/Makefile b/arch/um/kernel/skas/Makefile
index 3e3fa7e7e3cf..0b76d8869c94 100644
--- a/arch/um/kernel/skas/Makefile
+++ b/arch/um/kernel/skas/Makefile
@@ -1,9 +1,9 @@
1# 1#
2# Copyright (C) 2002 - 2004 Jeff Dike (jdike@addtoit.com) 2# Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
6obj-y := clone.o exec.o mem.o mmu.o process.o syscall.o tlb.o uaccess.o 6obj-y := clone.o mmu.o process.o syscall.o uaccess.o
7 7
8# clone.o is in the stub, so it can't be built with profiling 8# clone.o is in the stub, so it can't be built with profiling
9# GCC hardened also auto-enables -fpic, but we need %ebx so it can't work -> 9# GCC hardened also auto-enables -fpic, but we need %ebx so it can't work ->
diff --git a/arch/um/kernel/skas/clone.c b/arch/um/kernel/skas/clone.c
index 47b812b3bca8..d119f4f7d897 100644
--- a/arch/um/kernel/skas/clone.c
+++ b/arch/um/kernel/skas/clone.c
@@ -4,6 +4,7 @@
4#include <sys/time.h> 4#include <sys/time.h>
5#include <asm/unistd.h> 5#include <asm/unistd.h>
6#include <asm/page.h> 6#include <asm/page.h>
7#include "as-layout.h"
7#include "ptrace_user.h" 8#include "ptrace_user.h"
8#include "skas.h" 9#include "skas.h"
9#include "stub-data.h" 10#include "stub-data.h"
@@ -21,12 +22,11 @@
21void __attribute__ ((__section__ (".__syscall_stub"))) 22void __attribute__ ((__section__ (".__syscall_stub")))
22stub_clone_handler(void) 23stub_clone_handler(void)
23{ 24{
24 struct stub_data *data = (struct stub_data *) UML_CONFIG_STUB_DATA; 25 struct stub_data *data = (struct stub_data *) STUB_DATA;
25 long err; 26 long err;
26 27
27 err = stub_syscall2(__NR_clone, CLONE_PARENT | CLONE_FILES | SIGCHLD, 28 err = stub_syscall2(__NR_clone, CLONE_PARENT | CLONE_FILES | SIGCHLD,
28 UML_CONFIG_STUB_DATA + UM_KERN_PAGE_SIZE / 2 - 29 STUB_DATA + UM_KERN_PAGE_SIZE / 2 - sizeof(void *));
29 sizeof(void *));
30 if(err != 0) 30 if(err != 0)
31 goto out; 31 goto out;
32 32
diff --git a/arch/um/kernel/skas/exec.c b/arch/um/kernel/skas/exec.c
deleted file mode 100644
index 580eb6468949..000000000000
--- a/arch/um/kernel/skas/exec.c
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include "linux/kernel.h"
7#include "asm/current.h"
8#include "asm/page.h"
9#include "asm/signal.h"
10#include "asm/ptrace.h"
11#include "asm/uaccess.h"
12#include "asm/mmu_context.h"
13#include "tlb.h"
14#include "skas.h"
15#include "um_mmu.h"
16#include "os.h"
17
18void flush_thread_skas(void)
19{
20 void *data = NULL;
21 unsigned long end = proc_mm ? task_size : CONFIG_STUB_START;
22 int ret;
23
24 ret = unmap(&current->mm->context.skas.id, 0, end, 1, &data);
25 if(ret){
26 printk("flush_thread_skas - clearing address space failed, "
27 "err = %d\n", ret);
28 force_sig(SIGKILL, current);
29 }
30
31 switch_mm_skas(&current->mm->context.skas.id);
32}
33
34void start_thread_skas(struct pt_regs *regs, unsigned long eip,
35 unsigned long esp)
36{
37 set_fs(USER_DS);
38 PT_REGS_IP(regs) = eip;
39 PT_REGS_SP(regs) = esp;
40}
diff --git a/arch/um/kernel/skas/mem.c b/arch/um/kernel/skas/mem.c
deleted file mode 100644
index 7c18dfcd7d8e..000000000000
--- a/arch/um/kernel/skas/mem.c
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include "linux/mm.h"
7#include "asm/pgtable.h"
8#include "mem_user.h"
9#include "skas.h"
10
11unsigned long set_task_sizes_skas(unsigned long *task_size_out)
12{
13 /* Round up to the nearest 4M */
14 unsigned long host_task_size = ROUND_4M((unsigned long)
15 &host_task_size);
16
17 if (!skas_needs_stub)
18 *task_size_out = host_task_size;
19 else *task_size_out = CONFIG_STUB_START & PGDIR_MASK;
20
21 return host_task_size;
22}
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c
index 2c6d090a2e87..f859ec306cd5 100644
--- a/arch/um/kernel/skas/mmu.c
+++ b/arch/um/kernel/skas/mmu.c
@@ -1,20 +1,13 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/sched.h"
7#include "linux/list.h"
8#include "linux/spinlock.h"
9#include "linux/slab.h"
10#include "linux/errno.h"
11#include "linux/mm.h" 6#include "linux/mm.h"
12#include "asm/current.h" 7#include "linux/sched.h"
13#include "asm/segment.h"
14#include "asm/mmu.h"
15#include "asm/pgalloc.h" 8#include "asm/pgalloc.h"
16#include "asm/pgtable.h" 9#include "asm/pgtable.h"
17#include "asm/ldt.h" 10#include "as-layout.h"
18#include "os.h" 11#include "os.h"
19#include "skas.h" 12#include "skas.h"
20 13
@@ -41,10 +34,11 @@ static int init_stub_pte(struct mm_struct *mm, unsigned long proc,
41 if (!pte) 34 if (!pte)
42 goto out_pte; 35 goto out_pte;
43 36
44 /* There's an interaction between the skas0 stub pages, stack 37 /*
38 * There's an interaction between the skas0 stub pages, stack
45 * randomization, and the BUG at the end of exit_mmap. exit_mmap 39 * randomization, and the BUG at the end of exit_mmap. exit_mmap
46 * checks that the number of page tables freed is the same as had 40 * checks that the number of page tables freed is the same as had
47 * been allocated. If the stack is on the last page table page, 41 * been allocated. If the stack is on the last page table page,
48 * then the stack pte page will be freed, and if not, it won't. To 42 * then the stack pte page will be freed, and if not, it won't. To
49 * avoid having to know where the stack is, or if the process mapped 43 * avoid having to know where the stack is, or if the process mapped
50 * something at the top of its address space for some other reason, 44 * something at the top of its address space for some other reason,
@@ -54,76 +48,77 @@ static int init_stub_pte(struct mm_struct *mm, unsigned long proc,
54 * destroy_context_skas. 48 * destroy_context_skas.
55 */ 49 */
56 50
57 mm->context.skas.last_page_table = pmd_page_vaddr(*pmd); 51 mm->context.last_page_table = pmd_page_vaddr(*pmd);
58#ifdef CONFIG_3_LEVEL_PGTABLES 52#ifdef CONFIG_3_LEVEL_PGTABLES
59 mm->context.skas.last_pmd = (unsigned long) __va(pud_val(*pud)); 53 mm->context.last_pmd = (unsigned long) __va(pud_val(*pud));
60#endif 54#endif
61 55
62 *pte = mk_pte(virt_to_page(kernel), __pgprot(_PAGE_PRESENT)); 56 *pte = mk_pte(virt_to_page(kernel), __pgprot(_PAGE_PRESENT));
63 *pte = pte_mkread(*pte); 57 *pte = pte_mkread(*pte);
64 return(0); 58 return 0;
65 59
66 out_pmd: 60 out_pmd:
67 pud_free(pud); 61 pud_free(pud);
68 out_pte: 62 out_pte:
69 pmd_free(pmd); 63 pmd_free(pmd);
70 out: 64 out:
71 return(-ENOMEM); 65 return -ENOMEM;
72} 66}
73 67
74int init_new_context_skas(struct task_struct *task, struct mm_struct *mm) 68int init_new_context(struct task_struct *task, struct mm_struct *mm)
75{ 69{
76 struct mmu_context_skas *from_mm = NULL; 70 struct mm_context *from_mm = NULL;
77 struct mmu_context_skas *to_mm = &mm->context.skas; 71 struct mm_context *to_mm = &mm->context;
78 unsigned long stack = 0; 72 unsigned long stack = 0;
79 int ret = -ENOMEM; 73 int ret = -ENOMEM;
80 74
81 if(skas_needs_stub){ 75 if (skas_needs_stub) {
82 stack = get_zeroed_page(GFP_KERNEL); 76 stack = get_zeroed_page(GFP_KERNEL);
83 if(stack == 0) 77 if (stack == 0)
84 goto out; 78 goto out;
85 79
86 /* This zeros the entry that pgd_alloc didn't, needed since 80 /*
81 * This zeros the entry that pgd_alloc didn't, needed since
87 * we are about to reinitialize it, and want mm.nr_ptes to 82 * we are about to reinitialize it, and want mm.nr_ptes to
88 * be accurate. 83 * be accurate.
89 */ 84 */
90 mm->pgd[USER_PTRS_PER_PGD] = __pgd(0); 85 mm->pgd[USER_PTRS_PER_PGD] = __pgd(0);
91 86
92 ret = init_stub_pte(mm, CONFIG_STUB_CODE, 87 ret = init_stub_pte(mm, STUB_CODE,
93 (unsigned long) &__syscall_stub_start); 88 (unsigned long) &__syscall_stub_start);
94 if(ret) 89 if (ret)
95 goto out_free; 90 goto out_free;
96 91
97 ret = init_stub_pte(mm, CONFIG_STUB_DATA, stack); 92 ret = init_stub_pte(mm, STUB_DATA, stack);
98 if(ret) 93 if (ret)
99 goto out_free; 94 goto out_free;
100 95
101 mm->nr_ptes--; 96 mm->nr_ptes--;
102 } 97 }
103 98
104 to_mm->id.stack = stack; 99 to_mm->id.stack = stack;
105 if(current->mm != NULL && current->mm != &init_mm) 100 if (current->mm != NULL && current->mm != &init_mm)
106 from_mm = &current->mm->context.skas; 101 from_mm = &current->mm->context;
107 102
108 if(proc_mm){ 103 if (proc_mm) {
109 ret = new_mm(stack); 104 ret = new_mm(stack);
110 if(ret < 0){ 105 if (ret < 0) {
111 printk("init_new_context_skas - new_mm failed, " 106 printk(KERN_ERR "init_new_context_skas - "
112 "errno = %d\n", ret); 107 "new_mm failed, errno = %d\n", ret);
113 goto out_free; 108 goto out_free;
114 } 109 }
115 to_mm->id.u.mm_fd = ret; 110 to_mm->id.u.mm_fd = ret;
116 } 111 }
117 else { 112 else {
118 if(from_mm) 113 if (from_mm)
119 to_mm->id.u.pid = copy_context_skas0(stack, 114 to_mm->id.u.pid = copy_context_skas0(stack,
120 from_mm->id.u.pid); 115 from_mm->id.u.pid);
121 else to_mm->id.u.pid = start_userspace(stack); 116 else to_mm->id.u.pid = start_userspace(stack);
122 } 117 }
123 118
124 ret = init_new_ldt(to_mm, from_mm); 119 ret = init_new_ldt(to_mm, from_mm);
125 if(ret < 0){ 120 if (ret < 0) {
126 printk("init_new_context_skas - init_ldt" 121 printk(KERN_ERR "init_new_context_skas - init_ldt"
127 " failed, errno = %d\n", ret); 122 " failed, errno = %d\n", ret);
128 goto out_free; 123 goto out_free;
129 } 124 }
@@ -131,22 +126,22 @@ int init_new_context_skas(struct task_struct *task, struct mm_struct *mm)
131 return 0; 126 return 0;
132 127
133 out_free: 128 out_free:
134 if(to_mm->id.stack != 0) 129 if (to_mm->id.stack != 0)
135 free_page(to_mm->id.stack); 130 free_page(to_mm->id.stack);
136 out: 131 out:
137 return ret; 132 return ret;
138} 133}
139 134
140void destroy_context_skas(struct mm_struct *mm) 135void destroy_context(struct mm_struct *mm)
141{ 136{
142 struct mmu_context_skas *mmu = &mm->context.skas; 137 struct mm_context *mmu = &mm->context;
143 138
144 if(proc_mm) 139 if (proc_mm)
145 os_close_file(mmu->id.u.mm_fd); 140 os_close_file(mmu->id.u.mm_fd);
146 else 141 else
147 os_kill_ptraced_process(mmu->id.u.pid, 1); 142 os_kill_ptraced_process(mmu->id.u.pid, 1);
148 143
149 if(!proc_mm || !ptrace_faultinfo){ 144 if (!proc_mm || !ptrace_faultinfo) {
150 free_page(mmu->id.stack); 145 free_page(mmu->id.stack);
151 pte_lock_deinit(virt_to_page(mmu->last_page_table)); 146 pte_lock_deinit(virt_to_page(mmu->last_page_table));
152 pte_free_kernel((pte_t *) mmu->last_page_table); 147 pte_free_kernel((pte_t *) mmu->last_page_table);
@@ -155,4 +150,6 @@ void destroy_context_skas(struct mm_struct *mm)
155 pmd_free((pmd_t *) mmu->last_pmd); 150 pmd_free((pmd_t *) mmu->last_pmd);
156#endif 151#endif
157 } 152 }
153
154 free_ldt(mmu);
158} 155}
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c
index 48051a98525f..fce389c2342f 100644
--- a/arch/um/kernel/skas/process.c
+++ b/arch/um/kernel/skas/process.c
@@ -1,146 +1,26 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/sched.h"
7#include "linux/slab.h"
8#include "linux/ptrace.h"
9#include "linux/proc_fs.h"
10#include "linux/file.h"
11#include "linux/errno.h"
12#include "linux/init.h" 6#include "linux/init.h"
13#include "asm/uaccess.h" 7#include "linux/sched.h"
14#include "asm/atomic.h"
15#include "kern_util.h"
16#include "as-layout.h" 8#include "as-layout.h"
17#include "skas.h"
18#include "os.h" 9#include "os.h"
19#include "tlb.h" 10#include "skas.h"
20#include "kern.h"
21#include "mode.h"
22#include "registers.h"
23
24void switch_to_skas(void *prev, void *next)
25{
26 struct task_struct *from, *to;
27
28 from = prev;
29 to = next;
30
31 /* XXX need to check runqueues[cpu].idle */
32 if(current->pid == 0)
33 switch_timers(0);
34
35 switch_threads(&from->thread.mode.skas.switch_buf,
36 &to->thread.mode.skas.switch_buf);
37
38 arch_switch_to_skas(current->thread.prev_sched, current);
39
40 if(current->pid == 0)
41 switch_timers(1);
42}
43
44extern void schedule_tail(struct task_struct *prev);
45
46/* This is called magically, by its address being stuffed in a jmp_buf
47 * and being longjmp-d to.
48 */
49void new_thread_handler(void)
50{
51 int (*fn)(void *), n;
52 void *arg;
53
54 if(current->thread.prev_sched != NULL)
55 schedule_tail(current->thread.prev_sched);
56 current->thread.prev_sched = NULL;
57
58 fn = current->thread.request.u.thread.proc;
59 arg = current->thread.request.u.thread.arg;
60
61 /* The return value is 1 if the kernel thread execs a process,
62 * 0 if it just exits
63 */
64 n = run_kernel_thread(fn, arg, &current->thread.exec_buf);
65 if(n == 1){
66 /* Handle any immediate reschedules or signals */
67 interrupt_end();
68 userspace(&current->thread.regs.regs);
69 }
70 else do_exit(0);
71}
72
73void release_thread_skas(struct task_struct *task)
74{
75}
76
77/* Called magically, see new_thread_handler above */
78void fork_handler(void)
79{
80 force_flush_all();
81 if(current->thread.prev_sched == NULL)
82 panic("blech");
83
84 schedule_tail(current->thread.prev_sched);
85
86 /* XXX: if interrupt_end() calls schedule, this call to
87 * arch_switch_to_skas isn't needed. We could want to apply this to
88 * improve performance. -bb */
89 arch_switch_to_skas(current->thread.prev_sched, current);
90
91 current->thread.prev_sched = NULL;
92
93/* Handle any immediate reschedules or signals */
94 interrupt_end();
95
96 userspace(&current->thread.regs.regs);
97}
98
99int copy_thread_skas(int nr, unsigned long clone_flags, unsigned long sp,
100 unsigned long stack_top, struct task_struct * p,
101 struct pt_regs *regs)
102{
103 void (*handler)(void);
104
105 if(current->thread.forking){
106 memcpy(&p->thread.regs.regs.skas, &regs->regs.skas,
107 sizeof(p->thread.regs.regs.skas));
108 REGS_SET_SYSCALL_RETURN(p->thread.regs.regs.skas.regs, 0);
109 if(sp != 0) REGS_SP(p->thread.regs.regs.skas.regs) = sp;
110
111 handler = fork_handler;
112
113 arch_copy_thread(&current->thread.arch, &p->thread.arch);
114 }
115 else {
116 init_thread_registers(&p->thread.regs.regs);
117 p->thread.request.u.thread = current->thread.request.u.thread;
118 handler = new_thread_handler;
119 }
120
121 new_thread(task_stack_page(p), &p->thread.mode.skas.switch_buf,
122 handler);
123 return(0);
124}
125 11
126int new_mm(unsigned long stack) 12int new_mm(unsigned long stack)
127{ 13{
128 int fd; 14 int fd;
129 15
130 fd = os_open_file("/proc/mm", of_cloexec(of_write(OPENFLAGS())), 0); 16 fd = os_open_file("/proc/mm", of_cloexec(of_write(OPENFLAGS())), 0);
131 if(fd < 0) 17 if (fd < 0)
132 return(fd); 18 return fd;
133 19
134 if(skas_needs_stub) 20 if (skas_needs_stub)
135 map_stub_pages(fd, CONFIG_STUB_CODE, CONFIG_STUB_DATA, stack); 21 map_stub_pages(fd, STUB_CODE, STUB_DATA, stack);
136 22
137 return(fd); 23 return fd;
138}
139
140void init_idle_skas(void)
141{
142 cpu_tasks[current_thread->cpu].pid = os_getpid();
143 default_idle();
144} 24}
145 25
146extern void start_kernel(void); 26extern void start_kernel(void);
@@ -158,67 +38,32 @@ static int __init start_kernel_proc(void *unused)
158 cpu_online_map = cpumask_of_cpu(0); 38 cpu_online_map = cpumask_of_cpu(0);
159#endif 39#endif
160 start_kernel(); 40 start_kernel();
161 return(0); 41 return 0;
162} 42}
163 43
164extern int userspace_pid[]; 44extern int userspace_pid[];
165 45
166extern char cpu0_irqstack[]; 46extern char cpu0_irqstack[];
167 47
168int __init start_uml_skas(void) 48int __init start_uml(void)
169{ 49{
170 stack_protections((unsigned long) &cpu0_irqstack); 50 stack_protections((unsigned long) &cpu0_irqstack);
171 set_sigstack(cpu0_irqstack, THREAD_SIZE); 51 set_sigstack(cpu0_irqstack, THREAD_SIZE);
172 if(proc_mm) 52 if (proc_mm)
173 userspace_pid[0] = start_userspace(0); 53 userspace_pid[0] = start_userspace(0);
174 54
175 init_new_thread_signals(); 55 init_new_thread_signals();
176 56
177 init_task.thread.request.u.thread.proc = start_kernel_proc; 57 init_task.thread.request.u.thread.proc = start_kernel_proc;
178 init_task.thread.request.u.thread.arg = NULL; 58 init_task.thread.request.u.thread.arg = NULL;
179 return(start_idle_thread(task_stack_page(&init_task), 59 return start_idle_thread(task_stack_page(&init_task),
180 &init_task.thread.mode.skas.switch_buf)); 60 &init_task.thread.switch_buf);
181}
182
183int external_pid_skas(struct task_struct *task)
184{
185 /* FIXME: Need to look up userspace_pid by cpu */
186 return(userspace_pid[0]);
187}
188
189int thread_pid_skas(struct task_struct *task)
190{
191 /* FIXME: Need to look up userspace_pid by cpu */
192 return(userspace_pid[0]);
193}
194
195void kill_off_processes_skas(void)
196{
197 if(proc_mm)
198 /*
199 * FIXME: need to loop over userspace_pids in
200 * kill_off_processes_skas
201 */
202 os_kill_ptraced_process(userspace_pid[0], 1);
203 else {
204 struct task_struct *p;
205 int pid, me;
206
207 me = os_getpid();
208 for_each_process(p){
209 if(p->mm == NULL)
210 continue;
211
212 pid = p->mm->context.skas.id.u.pid;
213 os_kill_ptraced_process(pid, 1);
214 }
215 }
216} 61}
217 62
218unsigned long current_stub_stack(void) 63unsigned long current_stub_stack(void)
219{ 64{
220 if(current->mm == NULL) 65 if (current->mm == NULL)
221 return(0); 66 return 0;
222 67
223 return(current->mm->context.skas.id.stack); 68 return current->mm->context.id.stack;
224} 69}
diff --git a/arch/um/kernel/skas/syscall.c b/arch/um/kernel/skas/syscall.c
index 0ae4eea21be4..50b476f2b38d 100644
--- a/arch/um/kernel/skas/syscall.c
+++ b/arch/um/kernel/skas/syscall.c
@@ -1,19 +1,15 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/sys.h" 6#include "linux/kernel.h"
7#include "linux/ptrace.h" 7#include "linux/ptrace.h"
8#include "asm/errno.h"
9#include "asm/unistd.h"
10#include "asm/ptrace.h"
11#include "asm/current.h"
12#include "sysdep/syscalls.h"
13#include "kern_util.h" 8#include "kern_util.h"
14#include "syscall.h" 9#include "sysdep/ptrace.h"
10#include "sysdep/syscalls.h"
15 11
16void handle_syscall(union uml_pt_regs *r) 12void handle_syscall(struct uml_pt_regs *r)
17{ 13{
18 struct pt_regs *regs = container_of(r, struct pt_regs, regs); 14 struct pt_regs *regs = container_of(r, struct pt_regs, regs);
19 long result; 15 long result;
@@ -24,7 +20,8 @@ void handle_syscall(union uml_pt_regs *r)
24 current->thread.nsyscalls++; 20 current->thread.nsyscalls++;
25 nsyscalls++; 21 nsyscalls++;
26 22
27 /* This should go in the declaration of syscall, but when I do that, 23 /*
24 * This should go in the declaration of syscall, but when I do that,
28 * strace -f -c bash -c 'ls ; ls' breaks, sometimes not tracing 25 * strace -f -c bash -c 'ls ; ls' breaks, sometimes not tracing
29 * children at all, sometimes hanging when bash doesn't see the first 26 * children at all, sometimes hanging when bash doesn't see the first
30 * ls exit. 27 * ls exit.
@@ -33,11 +30,11 @@ void handle_syscall(union uml_pt_regs *r)
33 * in case it's a compiler bug. 30 * in case it's a compiler bug.
34 */ 31 */
35 syscall = UPT_SYSCALL_NR(r); 32 syscall = UPT_SYSCALL_NR(r);
36 if((syscall >= NR_syscalls) || (syscall < 0)) 33 if ((syscall >= NR_syscalls) || (syscall < 0))
37 result = -ENOSYS; 34 result = -ENOSYS;
38 else result = EXECUTE_SYSCALL(syscall, regs); 35 else result = EXECUTE_SYSCALL(syscall, regs);
39 36
40 REGS_SET_SYSCALL_RETURN(r->skas.regs, result); 37 REGS_SET_SYSCALL_RETURN(r->gp, result);
41 38
42 syscall_trace(r, 1); 39 syscall_trace(r, 1);
43} 40}
diff --git a/arch/um/kernel/skas/tlb.c b/arch/um/kernel/skas/tlb.c
deleted file mode 100644
index c0f0693743ba..000000000000
--- a/arch/um/kernel/skas/tlb.c
+++ /dev/null
@@ -1,164 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Copyright 2003 PathScale, Inc.
4 * Licensed under the GPL
5 */
6
7#include "linux/stddef.h"
8#include "linux/sched.h"
9#include "linux/mm.h"
10#include "asm/page.h"
11#include "asm/pgtable.h"
12#include "asm/mmu.h"
13#include "mem_user.h"
14#include "mem.h"
15#include "skas.h"
16#include "os.h"
17#include "tlb.h"
18
19static int do_ops(union mm_context *mmu, struct host_vm_op *ops, int last,
20 int finished, void **flush)
21{
22 struct host_vm_op *op;
23 int i, ret = 0;
24
25 for(i = 0; i <= last && !ret; i++){
26 op = &ops[i];
27 switch(op->type){
28 case MMAP:
29 ret = map(&mmu->skas.id, op->u.mmap.addr,
30 op->u.mmap.len, op->u.mmap.prot,
31 op->u.mmap.fd, op->u.mmap.offset, finished,
32 flush);
33 break;
34 case MUNMAP:
35 ret = unmap(&mmu->skas.id, op->u.munmap.addr,
36 op->u.munmap.len, finished, flush);
37 break;
38 case MPROTECT:
39 ret = protect(&mmu->skas.id, op->u.mprotect.addr,
40 op->u.mprotect.len, op->u.mprotect.prot,
41 finished, flush);
42 break;
43 default:
44 printk("Unknown op type %d in do_ops\n", op->type);
45 break;
46 }
47 }
48
49 return ret;
50}
51
52extern int proc_mm;
53
54static void fix_range(struct mm_struct *mm, unsigned long start_addr,
55 unsigned long end_addr, int force)
56{
57 if(!proc_mm && (end_addr > CONFIG_STUB_START))
58 end_addr = CONFIG_STUB_START;
59
60 fix_range_common(mm, start_addr, end_addr, force, do_ops);
61}
62
63void __flush_tlb_one_skas(unsigned long addr)
64{
65 flush_tlb_kernel_range_common(addr, addr + PAGE_SIZE);
66}
67
68void flush_tlb_range_skas(struct vm_area_struct *vma, unsigned long start,
69 unsigned long end)
70{
71 if(vma->vm_mm == NULL)
72 flush_tlb_kernel_range_common(start, end);
73 else fix_range(vma->vm_mm, start, end, 0);
74}
75
76void flush_tlb_mm_skas(struct mm_struct *mm)
77{
78 unsigned long end;
79
80 /* Don't bother flushing if this address space is about to be
81 * destroyed.
82 */
83 if(atomic_read(&mm->mm_users) == 0)
84 return;
85
86 end = proc_mm ? task_size : CONFIG_STUB_START;
87 fix_range(mm, 0, end, 0);
88}
89
90void force_flush_all_skas(void)
91{
92 struct mm_struct *mm = current->mm;
93 struct vm_area_struct *vma = mm->mmap;
94
95 while(vma != NULL) {
96 fix_range(mm, vma->vm_start, vma->vm_end, 1);
97 vma = vma->vm_next;
98 }
99}
100
101void flush_tlb_page_skas(struct vm_area_struct *vma, unsigned long address)
102{
103 pgd_t *pgd;
104 pud_t *pud;
105 pmd_t *pmd;
106 pte_t *pte;
107 struct mm_struct *mm = vma->vm_mm;
108 void *flush = NULL;
109 int r, w, x, prot, err = 0;
110 struct mm_id *mm_id;
111
112 pgd = pgd_offset(mm, address);
113 if(!pgd_present(*pgd))
114 goto kill;
115
116 pud = pud_offset(pgd, address);
117 if(!pud_present(*pud))
118 goto kill;
119
120 pmd = pmd_offset(pud, address);
121 if(!pmd_present(*pmd))
122 goto kill;
123
124 pte = pte_offset_kernel(pmd, address);
125
126 r = pte_read(*pte);
127 w = pte_write(*pte);
128 x = pte_exec(*pte);
129 if (!pte_young(*pte)) {
130 r = 0;
131 w = 0;
132 } else if (!pte_dirty(*pte)) {
133 w = 0;
134 }
135
136 mm_id = &mm->context.skas.id;
137 prot = ((r ? UM_PROT_READ : 0) | (w ? UM_PROT_WRITE : 0) |
138 (x ? UM_PROT_EXEC : 0));
139 if(pte_newpage(*pte)){
140 if(pte_present(*pte)){
141 unsigned long long offset;
142 int fd;
143
144 fd = phys_mapping(pte_val(*pte) & PAGE_MASK, &offset);
145 err = map(mm_id, address, PAGE_SIZE, prot, fd, offset,
146 1, &flush);
147 }
148 else err = unmap(mm_id, address, PAGE_SIZE, 1, &flush);
149 }
150 else if(pte_newprot(*pte))
151 err = protect(mm_id, address, PAGE_SIZE, prot, 1, &flush);
152
153 if(err)
154 goto kill;
155
156 *pte = pte_mkuptodate(*pte);
157
158 return;
159
160kill:
161 printk("Failed to flush page for address 0x%lx\n", address);
162 force_sig(SIGKILL, current);
163}
164
diff --git a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c
index 8912cec0fe43..1d8b119f2d0e 100644
--- a/arch/um/kernel/skas/uaccess.c
+++ b/arch/um/kernel/skas/uaccess.c
@@ -1,18 +1,14 @@
1/* 1/*
2 * Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/compiler.h" 6#include "linux/err.h"
7#include "linux/stddef.h"
8#include "linux/kernel.h"
9#include "linux/string.h"
10#include "linux/fs.h"
11#include "linux/hardirq.h"
12#include "linux/highmem.h" 7#include "linux/highmem.h"
8#include "linux/mm.h"
9#include "asm/current.h"
13#include "asm/page.h" 10#include "asm/page.h"
14#include "asm/pgtable.h" 11#include "asm/pgtable.h"
15#include "asm/uaccess.h"
16#include "kern_util.h" 12#include "kern_util.h"
17#include "os.h" 13#include "os.h"
18 14
@@ -27,16 +23,16 @@ static unsigned long maybe_map(unsigned long virt, int is_write)
27 void *phys = um_virt_to_phys(current, virt, &pte); 23 void *phys = um_virt_to_phys(current, virt, &pte);
28 int dummy_code; 24 int dummy_code;
29 25
30 if(IS_ERR(phys) || (is_write && !pte_write(pte))){ 26 if (IS_ERR(phys) || (is_write && !pte_write(pte))) {
31 err = handle_page_fault(virt, 0, is_write, 1, &dummy_code); 27 err = handle_page_fault(virt, 0, is_write, 1, &dummy_code);
32 if(err) 28 if (err)
33 return(-1UL); 29 return -1UL;
34 phys = um_virt_to_phys(current, virt, NULL); 30 phys = um_virt_to_phys(current, virt, NULL);
35 } 31 }
36 if(IS_ERR(phys)) 32 if (IS_ERR(phys))
37 phys = (void *) -1; 33 phys = (void *) -1;
38 34
39 return((unsigned long) phys); 35 return (unsigned long) phys;
40} 36}
41 37
42static int do_op_one_page(unsigned long addr, int len, int is_write, 38static int do_op_one_page(unsigned long addr, int len, int is_write,
@@ -46,17 +42,18 @@ static int do_op_one_page(unsigned long addr, int len, int is_write,
46 int n; 42 int n;
47 43
48 addr = maybe_map(addr, is_write); 44 addr = maybe_map(addr, is_write);
49 if(addr == -1UL) 45 if (addr == -1UL)
50 return(-1); 46 return -1;
51 47
52 page = phys_to_page(addr); 48 page = phys_to_page(addr);
53 addr = (unsigned long) kmap_atomic(page, KM_UML_USERCOPY) + (addr & ~PAGE_MASK); 49 addr = (unsigned long) kmap_atomic(page, KM_UML_USERCOPY) +
50 (addr & ~PAGE_MASK);
54 51
55 n = (*op)(addr, len, arg); 52 n = (*op)(addr, len, arg);
56 53
57 kunmap_atomic(page, KM_UML_USERCOPY); 54 kunmap_atomic(page, KM_UML_USERCOPY);
58 55
59 return(n); 56 return n;
60} 57}
61 58
62static void do_buffer_op(void *jmpbuf, void *arg_ptr) 59static void do_buffer_op(void *jmpbuf, void *arg_ptr)
@@ -81,21 +78,21 @@ static void do_buffer_op(void *jmpbuf, void *arg_ptr)
81 78
82 current->thread.fault_catcher = jmpbuf; 79 current->thread.fault_catcher = jmpbuf;
83 n = do_op_one_page(addr, size, is_write, op, arg); 80 n = do_op_one_page(addr, size, is_write, op, arg);
84 if(n != 0){ 81 if (n != 0) {
85 *res = (n < 0 ? remain : 0); 82 *res = (n < 0 ? remain : 0);
86 goto out; 83 goto out;
87 } 84 }
88 85
89 addr += size; 86 addr += size;
90 remain -= size; 87 remain -= size;
91 if(remain == 0){ 88 if (remain == 0) {
92 *res = 0; 89 *res = 0;
93 goto out; 90 goto out;
94 } 91 }
95 92
96 while(addr < ((addr + remain) & PAGE_MASK)){ 93 while(addr < ((addr + remain) & PAGE_MASK)) {
97 n = do_op_one_page(addr, PAGE_SIZE, is_write, op, arg); 94 n = do_op_one_page(addr, PAGE_SIZE, is_write, op, arg);
98 if(n != 0){ 95 if (n != 0) {
99 *res = (n < 0 ? remain : 0); 96 *res = (n < 0 ? remain : 0);
100 goto out; 97 goto out;
101 } 98 }
@@ -103,13 +100,13 @@ static void do_buffer_op(void *jmpbuf, void *arg_ptr)
103 addr += PAGE_SIZE; 100 addr += PAGE_SIZE;
104 remain -= PAGE_SIZE; 101 remain -= PAGE_SIZE;
105 } 102 }
106 if(remain == 0){ 103 if (remain == 0) {
107 *res = 0; 104 *res = 0;
108 goto out; 105 goto out;
109 } 106 }
110 107
111 n = do_op_one_page(addr, remain, is_write, op, arg); 108 n = do_op_one_page(addr, remain, is_write, op, arg);
112 if(n != 0) 109 if (n != 0)
113 *res = (n < 0 ? remain : 0); 110 *res = (n < 0 ? remain : 0);
114 else *res = 0; 111 else *res = 0;
115 out: 112 out:
@@ -124,10 +121,10 @@ static int buffer_op(unsigned long addr, int len, int is_write,
124 121
125 faulted = setjmp_wrapper(do_buffer_op, addr, len, is_write, op, arg, 122 faulted = setjmp_wrapper(do_buffer_op, addr, len, is_write, op, arg,
126 &res); 123 &res);
127 if(!faulted) 124 if (!faulted)
128 return(res); 125 return res;
129 126
130 return(addr + len - (unsigned long) current->thread.fault_addr); 127 return addr + len - (unsigned long) current->thread.fault_addr;
131} 128}
132 129
133static int copy_chunk_from_user(unsigned long from, int len, void *arg) 130static int copy_chunk_from_user(unsigned long from, int len, void *arg)
@@ -136,19 +133,19 @@ static int copy_chunk_from_user(unsigned long from, int len, void *arg)
136 133
137 memcpy((void *) to, (void *) from, len); 134 memcpy((void *) to, (void *) from, len);
138 *to_ptr += len; 135 *to_ptr += len;
139 return(0); 136 return 0;
140} 137}
141 138
142int copy_from_user_skas(void *to, const void __user *from, int n) 139int copy_from_user(void *to, const void __user *from, int n)
143{ 140{
144 if(segment_eq(get_fs(), KERNEL_DS)){ 141 if (segment_eq(get_fs(), KERNEL_DS)) {
145 memcpy(to, (__force void*)from, n); 142 memcpy(to, (__force void*)from, n);
146 return(0); 143 return 0;
147 } 144 }
148 145
149 return(access_ok(VERIFY_READ, from, n) ? 146 return access_ok(VERIFY_READ, from, n) ?
150 buffer_op((unsigned long) from, n, 0, copy_chunk_from_user, &to): 147 buffer_op((unsigned long) from, n, 0, copy_chunk_from_user, &to):
151 n); 148 n;
152} 149}
153 150
154static int copy_chunk_to_user(unsigned long to, int len, void *arg) 151static int copy_chunk_to_user(unsigned long to, int len, void *arg)
@@ -157,19 +154,19 @@ static int copy_chunk_to_user(unsigned long to, int len, void *arg)
157 154
158 memcpy((void *) to, (void *) from, len); 155 memcpy((void *) to, (void *) from, len);
159 *from_ptr += len; 156 *from_ptr += len;
160 return(0); 157 return 0;
161} 158}
162 159
163int copy_to_user_skas(void __user *to, const void *from, int n) 160int copy_to_user(void __user *to, const void *from, int n)
164{ 161{
165 if(segment_eq(get_fs(), KERNEL_DS)){ 162 if (segment_eq(get_fs(), KERNEL_DS)) {
166 memcpy((__force void*)to, from, n); 163 memcpy((__force void *) to, from, n);
167 return(0); 164 return 0;
168 } 165 }
169 166
170 return(access_ok(VERIFY_WRITE, to, n) ? 167 return access_ok(VERIFY_WRITE, to, n) ?
171 buffer_op((unsigned long) to, n, 1, copy_chunk_to_user, &from) : 168 buffer_op((unsigned long) to, n, 1, copy_chunk_to_user, &from) :
172 n); 169 n;
173} 170}
174 171
175static int strncpy_chunk_from_user(unsigned long from, int len, void *arg) 172static int strncpy_chunk_from_user(unsigned long from, int len, void *arg)
@@ -181,51 +178,51 @@ static int strncpy_chunk_from_user(unsigned long from, int len, void *arg)
181 n = strnlen(to, len); 178 n = strnlen(to, len);
182 *to_ptr += n; 179 *to_ptr += n;
183 180
184 if(n < len) 181 if (n < len)
185 return(1); 182 return 1;
186 return(0); 183 return 0;
187} 184}
188 185
189int strncpy_from_user_skas(char *dst, const char __user *src, int count) 186int strncpy_from_user(char *dst, const char __user *src, int count)
190{ 187{
191 int n; 188 int n;
192 char *ptr = dst; 189 char *ptr = dst;
193 190
194 if(segment_eq(get_fs(), KERNEL_DS)){ 191 if (segment_eq(get_fs(), KERNEL_DS)) {
195 strncpy(dst, (__force void*)src, count); 192 strncpy(dst, (__force void *) src, count);
196 return(strnlen(dst, count)); 193 return strnlen(dst, count);
197 } 194 }
198 195
199 if(!access_ok(VERIFY_READ, src, 1)) 196 if (!access_ok(VERIFY_READ, src, 1))
200 return(-EFAULT); 197 return -EFAULT;
201 198
202 n = buffer_op((unsigned long) src, count, 0, strncpy_chunk_from_user, 199 n = buffer_op((unsigned long) src, count, 0, strncpy_chunk_from_user,
203 &ptr); 200 &ptr);
204 if(n != 0) 201 if (n != 0)
205 return(-EFAULT); 202 return -EFAULT;
206 return(strnlen(dst, count)); 203 return strnlen(dst, count);
207} 204}
208 205
209static int clear_chunk(unsigned long addr, int len, void *unused) 206static int clear_chunk(unsigned long addr, int len, void *unused)
210{ 207{
211 memset((void *) addr, 0, len); 208 memset((void *) addr, 0, len);
212 return(0); 209 return 0;
213} 210}
214 211
215int __clear_user_skas(void __user *mem, int len) 212int __clear_user(void __user *mem, int len)
216{ 213{
217 return(buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL)); 214 return buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL);
218} 215}
219 216
220int clear_user_skas(void __user *mem, int len) 217int clear_user(void __user *mem, int len)
221{ 218{
222 if(segment_eq(get_fs(), KERNEL_DS)){ 219 if (segment_eq(get_fs(), KERNEL_DS)) {
223 memset((__force void*)mem, 0, len); 220 memset((__force void*)mem, 0, len);
224 return(0); 221 return 0;
225 } 222 }
226 223
227 return(access_ok(VERIFY_WRITE, mem, len) ? 224 return access_ok(VERIFY_WRITE, mem, len) ?
228 buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL) : len); 225 buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL) : len;
229} 226}
230 227
231static int strnlen_chunk(unsigned long str, int len, void *arg) 228static int strnlen_chunk(unsigned long str, int len, void *arg)
@@ -235,31 +232,20 @@ static int strnlen_chunk(unsigned long str, int len, void *arg)
235 n = strnlen((void *) str, len); 232 n = strnlen((void *) str, len);
236 *len_ptr += n; 233 *len_ptr += n;
237 234
238 if(n < len) 235 if (n < len)
239 return(1); 236 return 1;
240 return(0); 237 return 0;
241} 238}
242 239
243int strnlen_user_skas(const void __user *str, int len) 240int strnlen_user(const void __user *str, int len)
244{ 241{
245 int count = 0, n; 242 int count = 0, n;
246 243
247 if(segment_eq(get_fs(), KERNEL_DS)) 244 if (segment_eq(get_fs(), KERNEL_DS))
248 return(strnlen((__force char*)str, len) + 1); 245 return strnlen((__force char*)str, len) + 1;
249 246
250 n = buffer_op((unsigned long) str, len, 0, strnlen_chunk, &count); 247 n = buffer_op((unsigned long) str, len, 0, strnlen_chunk, &count);
251 if(n == 0) 248 if (n == 0)
252 return(count + 1); 249 return count + 1;
253 return(-EFAULT); 250 return -EFAULT;
254} 251}
255
256/*
257 * Overrides for Emacs so that we follow Linus's tabbing style.
258 * Emacs will notice this stuff at the end of the file and automatically
259 * adjust the settings for this buffer only. This must remain at the end
260 * of the file.
261 * ---------------------------------------------------------------------------
262 * Local variables:
263 * c-file-style: "linux"
264 * End:
265 */
diff --git a/arch/um/kernel/smp.c b/arch/um/kernel/smp.c
index e6a7778006ad..36d89cf8d20b 100644
--- a/arch/um/kernel/smp.c
+++ b/arch/um/kernel/smp.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -56,12 +56,12 @@ void smp_send_stop(void)
56 int i; 56 int i;
57 57
58 printk(KERN_INFO "Stopping all CPUs..."); 58 printk(KERN_INFO "Stopping all CPUs...");
59 for(i = 0; i < num_online_cpus(); i++){ 59 for (i = 0; i < num_online_cpus(); i++) {
60 if(i == current_thread->cpu) 60 if (i == current_thread->cpu)
61 continue; 61 continue;
62 os_write_file(cpu_data[i].ipi_pipe[1], "S", 1); 62 os_write_file(cpu_data[i].ipi_pipe[1], "S", 1);
63 } 63 }
64 printk("done\n"); 64 printk(KERN_INFO "done\n");
65} 65}
66 66
67static cpumask_t smp_commenced_mask = CPU_MASK_NONE; 67static cpumask_t smp_commenced_mask = CPU_MASK_NONE;
@@ -72,7 +72,7 @@ static int idle_proc(void *cpup)
72 int cpu = (int) cpup, err; 72 int cpu = (int) cpup, err;
73 73
74 err = os_pipe(cpu_data[cpu].ipi_pipe, 1, 1); 74 err = os_pipe(cpu_data[cpu].ipi_pipe, 1, 1);
75 if(err < 0) 75 if (err < 0)
76 panic("CPU#%d failed to create IPI pipe, err = %d", cpu, -err); 76 panic("CPU#%d failed to create IPI pipe, err = %d", cpu, -err);
77 77
78 os_set_fd_async(cpu_data[cpu].ipi_pipe[0], 78 os_set_fd_async(cpu_data[cpu].ipi_pipe[0],
@@ -80,7 +80,7 @@ static int idle_proc(void *cpup)
80 80
81 wmb(); 81 wmb();
82 if (cpu_test_and_set(cpu, cpu_callin_map)) { 82 if (cpu_test_and_set(cpu, cpu_callin_map)) {
83 printk("huh, CPU#%d already present??\n", cpu); 83 printk(KERN_ERR "huh, CPU#%d already present??\n", cpu);
84 BUG(); 84 BUG();
85 } 85 }
86 86
@@ -95,12 +95,11 @@ static int idle_proc(void *cpup)
95static struct task_struct *idle_thread(int cpu) 95static struct task_struct *idle_thread(int cpu)
96{ 96{
97 struct task_struct *new_task; 97 struct task_struct *new_task;
98 unsigned char c;
99 98
100 current->thread.request.u.thread.proc = idle_proc; 99 current->thread.request.u.thread.proc = idle_proc;
101 current->thread.request.u.thread.arg = (void *) cpu; 100 current->thread.request.u.thread.arg = (void *) cpu;
102 new_task = fork_idle(cpu); 101 new_task = fork_idle(cpu);
103 if(IS_ERR(new_task)) 102 if (IS_ERR(new_task))
104 panic("copy_process failed in idle_thread, error = %ld", 103 panic("copy_process failed in idle_thread, error = %ld",
105 PTR_ERR(new_task)); 104 PTR_ERR(new_task));
106 105
@@ -108,9 +107,7 @@ static struct task_struct *idle_thread(int cpu)
108 { .pid = new_task->thread.mode.tt.extern_pid, 107 { .pid = new_task->thread.mode.tt.extern_pid,
109 .task = new_task } ); 108 .task = new_task } );
110 idle_threads[cpu] = new_task; 109 idle_threads[cpu] = new_task;
111 CHOOSE_MODE(os_write_file(new_task->thread.mode.tt.switch_pipe[1], &c, 110 panic("skas mode doesn't support SMP");
112 sizeof(c)),
113 ({ panic("skas mode doesn't support SMP"); }));
114 return new_task; 111 return new_task;
115} 112}
116 113
@@ -129,14 +126,14 @@ void smp_prepare_cpus(unsigned int maxcpus)
129 cpu_set(me, cpu_callin_map); 126 cpu_set(me, cpu_callin_map);
130 127
131 err = os_pipe(cpu_data[me].ipi_pipe, 1, 1); 128 err = os_pipe(cpu_data[me].ipi_pipe, 1, 1);
132 if(err < 0) 129 if (err < 0)
133 panic("CPU#0 failed to create IPI pipe, errno = %d", -err); 130 panic("CPU#0 failed to create IPI pipe, errno = %d", -err);
134 131
135 os_set_fd_async(cpu_data[me].ipi_pipe[0], 132 os_set_fd_async(cpu_data[me].ipi_pipe[0],
136 current->thread.mode.tt.extern_pid); 133 current->thread.mode.tt.extern_pid);
137 134
138 for(cpu = 1; cpu < ncpus; cpu++){ 135 for (cpu = 1; cpu < ncpus; cpu++) {
139 printk("Booting processor %d...\n", cpu); 136 printk(KERN_INFO "Booting processor %d...\n", cpu);
140 137
141 idle = idle_thread(cpu); 138 idle = idle_thread(cpu);
142 139
@@ -147,8 +144,8 @@ void smp_prepare_cpus(unsigned int maxcpus)
147 cpu_relax(); 144 cpu_relax();
148 145
149 if (cpu_isset(cpu, cpu_callin_map)) 146 if (cpu_isset(cpu, cpu_callin_map))
150 printk("done\n"); 147 printk(KERN_INFO "done\n");
151 else printk("failed\n"); 148 else printk(KERN_INFO "failed\n");
152 } 149 }
153} 150}
154 151
@@ -190,13 +187,14 @@ void IPI_handler(int cpu)
190 break; 187 break;
191 188
192 case 'S': 189 case 'S':
193 printk("CPU#%d stopping\n", cpu); 190 printk(KERN_INFO "CPU#%d stopping\n", cpu);
194 while(1) 191 while (1)
195 pause(); 192 pause();
196 break; 193 break;
197 194
198 default: 195 default:
199 printk("CPU#%d received unknown IPI [%c]!\n", cpu, c); 196 printk(KERN_ERR "CPU#%d received unknown IPI [%c]!\n",
197 cpu, c);
200 break; 198 break;
201 } 199 }
202 } 200 }
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c
index 7b3b67333ff3..b9d92b2089ae 100644
--- a/arch/um/kernel/syscall.c
+++ b/arch/um/kernel/syscall.c
@@ -1,27 +1,17 @@
1/* 1/*
2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/sched.h"
7#include "linux/file.h" 6#include "linux/file.h"
8#include "linux/smp_lock.h"
9#include "linux/mm.h"
10#include "linux/fs.h" 7#include "linux/fs.h"
8#include "linux/mm.h"
9#include "linux/sched.h"
11#include "linux/utsname.h" 10#include "linux/utsname.h"
12#include "linux/msg.h" 11#include "asm/current.h"
13#include "linux/shm.h"
14#include "linux/sys.h"
15#include "linux/syscalls.h"
16#include "linux/unistd.h"
17#include "linux/slab.h"
18#include "linux/utime.h"
19#include "asm/mman.h" 12#include "asm/mman.h"
20#include "asm/uaccess.h" 13#include "asm/uaccess.h"
21#include "kern_util.h" 14#include "asm/unistd.h"
22#include "sysdep/syscalls.h"
23#include "mode_kern.h"
24#include "choose-mode.h"
25 15
26/* Unlocked, I don't care if this is a bit off */ 16/* Unlocked, I don't care if this is a bit off */
27int nsyscalls = 0; 17int nsyscalls = 0;
@@ -34,7 +24,7 @@ long sys_fork(void)
34 ret = do_fork(SIGCHLD, UPT_SP(&current->thread.regs.regs), 24 ret = do_fork(SIGCHLD, UPT_SP(&current->thread.regs.regs),
35 &current->thread.regs, 0, NULL, NULL); 25 &current->thread.regs, 0, NULL, NULL);
36 current->thread.forking = 0; 26 current->thread.forking = 0;
37 return(ret); 27 return ret;
38} 28}
39 29
40long sys_vfork(void) 30long sys_vfork(void)
@@ -46,7 +36,7 @@ long sys_vfork(void)
46 UPT_SP(&current->thread.regs.regs), 36 UPT_SP(&current->thread.regs.regs),
47 &current->thread.regs, 0, NULL, NULL); 37 &current->thread.regs, 0, NULL, NULL);
48 current->thread.forking = 0; 38 current->thread.forking = 0;
49 return(ret); 39 return ret;
50} 40}
51 41
52/* common code for old and new mmaps */ 42/* common code for old and new mmaps */
@@ -92,15 +82,15 @@ long old_mmap(unsigned long addr, unsigned long len,
92 */ 82 */
93long sys_pipe(unsigned long __user * fildes) 83long sys_pipe(unsigned long __user * fildes)
94{ 84{
95 int fd[2]; 85 int fd[2];
96 long error; 86 long error;
97 87
98 error = do_pipe(fd); 88 error = do_pipe(fd);
99 if (!error) { 89 if (!error) {
100 if (copy_to_user(fildes, fd, sizeof(fd))) 90 if (copy_to_user(fildes, fd, sizeof(fd)))
101 error = -EFAULT; 91 error = -EFAULT;
102 } 92 }
103 return error; 93 return error;
104} 94}
105 95
106 96
@@ -124,7 +114,7 @@ long sys_olduname(struct oldold_utsname __user * name)
124 if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname))) 114 if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname)))
125 return -EFAULT; 115 return -EFAULT;
126 116
127 down_read(&uts_sem); 117 down_read(&uts_sem);
128 118
129 error = __copy_to_user(&name->sysname, &utsname()->sysname, 119 error = __copy_to_user(&name->sysname, &utsname()->sysname,
130 __OLD_UTS_LEN); 120 __OLD_UTS_LEN);
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index 259c49da7ff5..1ac746a9eae1 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -1,189 +1,126 @@
1/* 1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/kernel.h" 6#include "linux/clockchips.h"
7#include "linux/module.h"
8#include "linux/unistd.h"
9#include "linux/stddef.h"
10#include "linux/spinlock.h"
11#include "linux/time.h"
12#include "linux/sched.h"
13#include "linux/interrupt.h" 7#include "linux/interrupt.h"
14#include "linux/init.h" 8#include "linux/jiffies.h"
15#include "linux/delay.h" 9#include "linux/threads.h"
16#include "linux/hrtimer.h"
17#include "asm/irq.h" 10#include "asm/irq.h"
18#include "asm/param.h" 11#include "asm/param.h"
19#include "asm/current.h"
20#include "kern_util.h" 12#include "kern_util.h"
21#include "mode.h"
22#include "os.h" 13#include "os.h"
23 14
24int hz(void)
25{
26 return(HZ);
27}
28
29/* 15/*
30 * Scheduler clock - returns current time in nanosec units. 16 * Scheduler clock - returns current time in nanosec units.
31 */ 17 */
32unsigned long long sched_clock(void) 18unsigned long long sched_clock(void)
33{ 19{
34 return (unsigned long long)jiffies_64 * (1000000000 / HZ); 20 return (unsigned long long)jiffies_64 * (NSEC_PER_SEC / HZ);
35} 21}
36 22
37#ifdef CONFIG_UML_REAL_TIME_CLOCK 23void timer_handler(int sig, struct uml_pt_regs *regs)
38static unsigned long long prev_nsecs[NR_CPUS]; 24{
39static long long delta[NR_CPUS]; /* Deviation per interval */ 25 unsigned long flags;
40#endif 26
27 local_irq_save(flags);
28 do_IRQ(TIMER_IRQ, regs);
29 local_irq_restore(flags);
30}
41 31
42void timer_irq(union uml_pt_regs *regs) 32static void itimer_set_mode(enum clock_event_mode mode,
33 struct clock_event_device *evt)
43{ 34{
44 unsigned long long ticks = 0; 35 switch(mode) {
45#ifdef CONFIG_UML_REAL_TIME_CLOCK 36 case CLOCK_EVT_MODE_PERIODIC:
46 int c = cpu(); 37 set_interval();
47 if(prev_nsecs[c]){ 38 break;
48 /* We've had 1 tick */ 39
49 unsigned long long nsecs = os_nsecs(); 40 case CLOCK_EVT_MODE_SHUTDOWN:
50 41 case CLOCK_EVT_MODE_UNUSED:
51 delta[c] += nsecs - prev_nsecs[c]; 42 case CLOCK_EVT_MODE_ONESHOT:
52 prev_nsecs[c] = nsecs; 43 disable_timer();
53 44 break;
54 /* Protect against the host clock being set backwards */ 45
55 if(delta[c] < 0) 46 case CLOCK_EVT_MODE_RESUME:
56 delta[c] = 0; 47 break;
57
58 ticks += (delta[c] * HZ) / BILLION;
59 delta[c] -= (ticks * BILLION) / HZ;
60 }
61 else prev_nsecs[c] = os_nsecs();
62#else
63 ticks = 1;
64#endif
65 while(ticks > 0){
66 do_IRQ(TIMER_IRQ, regs);
67 ticks--;
68 } 48 }
69} 49}
70 50
71/* Protects local_offset */ 51static int itimer_next_event(unsigned long delta,
72static DEFINE_SPINLOCK(timer_spinlock); 52 struct clock_event_device *evt)
73static unsigned long long local_offset = 0;
74
75static inline unsigned long long get_time(void)
76{ 53{
77 unsigned long long nsecs; 54 return timer_one_shot(delta + 1);
78 unsigned long flags;
79
80 spin_lock_irqsave(&timer_spinlock, flags);
81 nsecs = os_nsecs();
82 nsecs += local_offset;
83 spin_unlock_irqrestore(&timer_spinlock, flags);
84
85 return nsecs;
86} 55}
87 56
88irqreturn_t um_timer(int irq, void *dev) 57static struct clock_event_device itimer_clockevent = {
58 .name = "itimer",
59 .rating = 250,
60 .cpumask = CPU_MASK_ALL,
61 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
62 .set_mode = itimer_set_mode,
63 .set_next_event = itimer_next_event,
64 .shift = 32,
65 .irq = 0,
66};
67
68static irqreturn_t um_timer(int irq, void *dev)
89{ 69{
90 unsigned long long nsecs; 70 (*itimer_clockevent.event_handler)(&itimer_clockevent);
91 unsigned long flags;
92
93 write_seqlock_irqsave(&xtime_lock, flags);
94
95 do_timer(1);
96
97#ifdef CONFIG_UML_REAL_TIME_CLOCK
98 nsecs = get_time();
99#else
100 nsecs = (unsigned long long) xtime.tv_sec * BILLION + xtime.tv_nsec +
101 BILLION / HZ;
102#endif
103 xtime.tv_sec = nsecs / NSEC_PER_SEC;
104 xtime.tv_nsec = nsecs - xtime.tv_sec * NSEC_PER_SEC;
105
106 write_sequnlock_irqrestore(&xtime_lock, flags);
107 71
108 return IRQ_HANDLED; 72 return IRQ_HANDLED;
109} 73}
110 74
111static void register_timer(void) 75static cycle_t itimer_read(void)
76{
77 return os_nsecs();
78}
79
80static struct clocksource itimer_clocksource = {
81 .name = "itimer",
82 .rating = 300,
83 .read = itimer_read,
84 .mask = CLOCKSOURCE_MASK(64),
85 .mult = 1,
86 .shift = 0,
87 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
88};
89
90static void __init setup_itimer(void)
112{ 91{
113 int err; 92 int err;
114 93
115 err = request_irq(TIMER_IRQ, um_timer, IRQF_DISABLED, "timer", NULL); 94 err = request_irq(TIMER_IRQ, um_timer, IRQF_DISABLED, "timer", NULL);
116 if(err != 0) 95 if (err != 0)
117 printk(KERN_ERR "register_timer : request_irq failed - " 96 printk(KERN_ERR "register_timer : request_irq failed - "
118 "errno = %d\n", -err); 97 "errno = %d\n", -err);
119 98
120 err = set_interval(1); 99 itimer_clockevent.mult = div_sc(HZ, NSEC_PER_SEC, 32);
121 if(err != 0) 100 itimer_clockevent.max_delta_ns =
122 printk(KERN_ERR "register_timer : set_interval failed - " 101 clockevent_delta2ns(60 * HZ, &itimer_clockevent);
123 "errno = %d\n", -err); 102 itimer_clockevent.min_delta_ns =
103 clockevent_delta2ns(1, &itimer_clockevent);
104 err = clocksource_register(&itimer_clocksource);
105 if (err) {
106 printk(KERN_ERR "clocksource_register returned %d\n", err);
107 return;
108 }
109 clockevents_register_device(&itimer_clockevent);
124} 110}
125 111
126extern void (*late_time_init)(void); 112extern void (*late_time_init)(void);
127 113
128void time_init(void) 114void __init time_init(void)
129{ 115{
130 long long nsecs; 116 long long nsecs;
131 117
132 nsecs = os_nsecs(); 118 timer_init();
133 set_normalized_timespec(&wall_to_monotonic, -nsecs / BILLION,
134 -nsecs % BILLION);
135 set_normalized_timespec(&xtime, nsecs / BILLION, nsecs % BILLION);
136 late_time_init = register_timer;
137}
138
139void do_gettimeofday(struct timeval *tv)
140{
141#ifdef CONFIG_UML_REAL_TIME_CLOCK
142 unsigned long long nsecs = get_time();
143#else
144 unsigned long long nsecs = (unsigned long long) xtime.tv_sec * BILLION +
145 xtime.tv_nsec;
146#endif
147 tv->tv_sec = nsecs / NSEC_PER_SEC;
148 /* Careful about calculations here - this was originally done as
149 * (nsecs - tv->tv_sec * NSEC_PER_SEC) / NSEC_PER_USEC
150 * which gave bogus (> 1000000) values. Dunno why, suspect gcc
151 * (4.0.0) miscompiled it, or there's a subtle 64/32-bit conversion
152 * problem that I missed.
153 */
154 nsecs -= tv->tv_sec * NSEC_PER_SEC;
155 tv->tv_usec = (unsigned long) nsecs / NSEC_PER_USEC;
156}
157
158static inline void set_time(unsigned long long nsecs)
159{
160 unsigned long long now;
161 unsigned long flags;
162
163 spin_lock_irqsave(&timer_spinlock, flags);
164 now = os_nsecs();
165 local_offset = nsecs - now;
166 spin_unlock_irqrestore(&timer_spinlock, flags);
167
168 clock_was_set();
169}
170
171int do_settimeofday(struct timespec *tv)
172{
173 set_time((unsigned long long) tv->tv_sec * NSEC_PER_SEC + tv->tv_nsec);
174
175 return 0;
176}
177 119
178void timer_handler(int sig, union uml_pt_regs *regs) 120 nsecs = os_nsecs();
179{ 121 set_normalized_timespec(&wall_to_monotonic, -nsecs / NSEC_PER_SEC,
180 if(current_thread->cpu == 0) 122 -nsecs % NSEC_PER_SEC);
181 timer_irq(regs); 123 set_normalized_timespec(&xtime, nsecs / NSEC_PER_SEC,
182 local_irq_disable(); 124 nsecs % NSEC_PER_SEC);
183 irq_enter(); 125 late_time_init = setup_itimer;
184 update_process_times(CHOOSE_MODE(
185 (UPT_SC(regs) && user_context(UPT_SP(regs))),
186 (regs)->skas.is_user));
187 irq_exit();
188 local_irq_enable();
189} 126}
diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c
index 8a8d52851443..f4a0e407eee4 100644
--- a/arch/um/kernel/tlb.c
+++ b/arch/um/kernel/tlb.c
@@ -1,130 +1,182 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/mm.h" 6#include "linux/mm.h"
7#include "asm/page.h"
8#include "asm/pgalloc.h"
9#include "asm/pgtable.h" 7#include "asm/pgtable.h"
10#include "asm/tlbflush.h" 8#include "asm/tlbflush.h"
11#include "choose-mode.h"
12#include "mode_kern.h"
13#include "as-layout.h" 9#include "as-layout.h"
14#include "tlb.h"
15#include "mem.h"
16#include "mem_user.h" 10#include "mem_user.h"
17#include "os.h" 11#include "os.h"
12#include "skas.h"
13#include "tlb.h"
14
15struct host_vm_change {
16 struct host_vm_op {
17 enum { NONE, MMAP, MUNMAP, MPROTECT } type;
18 union {
19 struct {
20 unsigned long addr;
21 unsigned long len;
22 unsigned int prot;
23 int fd;
24 __u64 offset;
25 } mmap;
26 struct {
27 unsigned long addr;
28 unsigned long len;
29 } munmap;
30 struct {
31 unsigned long addr;
32 unsigned long len;
33 unsigned int prot;
34 } mprotect;
35 } u;
36 } ops[1];
37 int index;
38 struct mm_id *id;
39 void *data;
40 int force;
41};
42
43#define INIT_HVC(mm, force) \
44 ((struct host_vm_change) \
45 { .ops = { { .type = NONE } }, \
46 .id = &mm->context.id, \
47 .data = NULL, \
48 .index = 0, \
49 .force = force })
50
51static int do_ops(struct host_vm_change *hvc, int end,
52 int finished)
53{
54 struct host_vm_op *op;
55 int i, ret = 0;
56
57 for (i = 0; i < end && !ret; i++) {
58 op = &hvc->ops[i];
59 switch(op->type) {
60 case MMAP:
61 ret = map(hvc->id, op->u.mmap.addr, op->u.mmap.len,
62 op->u.mmap.prot, op->u.mmap.fd,
63 op->u.mmap.offset, finished, &hvc->data);
64 break;
65 case MUNMAP:
66 ret = unmap(hvc->id, op->u.munmap.addr,
67 op->u.munmap.len, finished, &hvc->data);
68 break;
69 case MPROTECT:
70 ret = protect(hvc->id, op->u.mprotect.addr,
71 op->u.mprotect.len, op->u.mprotect.prot,
72 finished, &hvc->data);
73 break;
74 default:
75 printk(KERN_ERR "Unknown op type %d in do_ops\n",
76 op->type);
77 break;
78 }
79 }
80
81 return ret;
82}
18 83
19static int add_mmap(unsigned long virt, unsigned long phys, unsigned long len, 84static int add_mmap(unsigned long virt, unsigned long phys, unsigned long len,
20 unsigned int prot, struct host_vm_op *ops, int *index, 85 unsigned int prot, struct host_vm_change *hvc)
21 int last_filled, union mm_context *mmu, void **flush,
22 int (*do_ops)(union mm_context *, struct host_vm_op *,
23 int, int, void **))
24{ 86{
25 __u64 offset; 87 __u64 offset;
26 struct host_vm_op *last; 88 struct host_vm_op *last;
27 int fd, ret = 0; 89 int fd, ret = 0;
28 90
29 fd = phys_mapping(phys, &offset); 91 fd = phys_mapping(phys, &offset);
30 if(*index != -1){ 92 if (hvc->index != 0) {
31 last = &ops[*index]; 93 last = &hvc->ops[hvc->index - 1];
32 if((last->type == MMAP) && 94 if ((last->type == MMAP) &&
33 (last->u.mmap.addr + last->u.mmap.len == virt) && 95 (last->u.mmap.addr + last->u.mmap.len == virt) &&
34 (last->u.mmap.prot == prot) && (last->u.mmap.fd == fd) && 96 (last->u.mmap.prot == prot) && (last->u.mmap.fd == fd) &&
35 (last->u.mmap.offset + last->u.mmap.len == offset)){ 97 (last->u.mmap.offset + last->u.mmap.len == offset)) {
36 last->u.mmap.len += len; 98 last->u.mmap.len += len;
37 return 0; 99 return 0;
38 } 100 }
39 } 101 }
40 102
41 if(*index == last_filled){ 103 if (hvc->index == ARRAY_SIZE(hvc->ops)) {
42 ret = (*do_ops)(mmu, ops, last_filled, 0, flush); 104 ret = do_ops(hvc, ARRAY_SIZE(hvc->ops), 0);
43 *index = -1; 105 hvc->index = 0;
44 } 106 }
45 107
46 ops[++*index] = ((struct host_vm_op) { .type = MMAP, 108 hvc->ops[hvc->index++] = ((struct host_vm_op)
47 .u = { .mmap = { 109 { .type = MMAP,
48 .addr = virt, 110 .u = { .mmap = { .addr = virt,
49 .len = len, 111 .len = len,
50 .prot = prot, 112 .prot = prot,
51 .fd = fd, 113 .fd = fd,
52 .offset = offset } 114 .offset = offset }
53 } }); 115 } });
54 return ret; 116 return ret;
55} 117}
56 118
57static int add_munmap(unsigned long addr, unsigned long len, 119static int add_munmap(unsigned long addr, unsigned long len,
58 struct host_vm_op *ops, int *index, int last_filled, 120 struct host_vm_change *hvc)
59 union mm_context *mmu, void **flush,
60 int (*do_ops)(union mm_context *, struct host_vm_op *,
61 int, int, void **))
62{ 121{
63 struct host_vm_op *last; 122 struct host_vm_op *last;
64 int ret = 0; 123 int ret = 0;
65 124
66 if(*index != -1){ 125 if (hvc->index != 0) {
67 last = &ops[*index]; 126 last = &hvc->ops[hvc->index - 1];
68 if((last->type == MUNMAP) && 127 if ((last->type == MUNMAP) &&
69 (last->u.munmap.addr + last->u.mmap.len == addr)){ 128 (last->u.munmap.addr + last->u.mmap.len == addr)) {
70 last->u.munmap.len += len; 129 last->u.munmap.len += len;
71 return 0; 130 return 0;
72 } 131 }
73 } 132 }
74 133
75 if(*index == last_filled){ 134 if (hvc->index == ARRAY_SIZE(hvc->ops)) {
76 ret = (*do_ops)(mmu, ops, last_filled, 0, flush); 135 ret = do_ops(hvc, ARRAY_SIZE(hvc->ops), 0);
77 *index = -1; 136 hvc->index = 0;
78 } 137 }
79 138
80 ops[++*index] = ((struct host_vm_op) { .type = MUNMAP, 139 hvc->ops[hvc->index++] = ((struct host_vm_op)
81 .u = { .munmap = { 140 { .type = MUNMAP,
82 .addr = addr, 141 .u = { .munmap = { .addr = addr,
83 .len = len } } }); 142 .len = len } } });
84 return ret; 143 return ret;
85} 144}
86 145
87static int add_mprotect(unsigned long addr, unsigned long len, 146static int add_mprotect(unsigned long addr, unsigned long len,
88 unsigned int prot, struct host_vm_op *ops, int *index, 147 unsigned int prot, struct host_vm_change *hvc)
89 int last_filled, union mm_context *mmu, void **flush,
90 int (*do_ops)(union mm_context *, struct host_vm_op *,
91 int, int, void **))
92{ 148{
93 struct host_vm_op *last; 149 struct host_vm_op *last;
94 int ret = 0; 150 int ret = 0;
95 151
96 if(*index != -1){ 152 if (hvc->index != 0) {
97 last = &ops[*index]; 153 last = &hvc->ops[hvc->index - 1];
98 if((last->type == MPROTECT) && 154 if ((last->type == MPROTECT) &&
99 (last->u.mprotect.addr + last->u.mprotect.len == addr) && 155 (last->u.mprotect.addr + last->u.mprotect.len == addr) &&
100 (last->u.mprotect.prot == prot)){ 156 (last->u.mprotect.prot == prot)) {
101 last->u.mprotect.len += len; 157 last->u.mprotect.len += len;
102 return 0; 158 return 0;
103 } 159 }
104 } 160 }
105 161
106 if(*index == last_filled){ 162 if (hvc->index == ARRAY_SIZE(hvc->ops)) {
107 ret = (*do_ops)(mmu, ops, last_filled, 0, flush); 163 ret = do_ops(hvc, ARRAY_SIZE(hvc->ops), 0);
108 *index = -1; 164 hvc->index = 0;
109 } 165 }
110 166
111 ops[++*index] = ((struct host_vm_op) { .type = MPROTECT, 167 hvc->ops[hvc->index++] = ((struct host_vm_op)
112 .u = { .mprotect = { 168 { .type = MPROTECT,
113 .addr = addr, 169 .u = { .mprotect = { .addr = addr,
114 .len = len, 170 .len = len,
115 .prot = prot } } }); 171 .prot = prot } } });
116 return ret; 172 return ret;
117} 173}
118 174
119#define ADD_ROUND(n, inc) (((n) + (inc)) & ~((inc) - 1)) 175#define ADD_ROUND(n, inc) (((n) + (inc)) & ~((inc) - 1))
120 176
121static inline int update_pte_range(pmd_t *pmd, unsigned long addr, 177static inline int update_pte_range(pmd_t *pmd, unsigned long addr,
122 unsigned long end, struct host_vm_op *ops, 178 unsigned long end,
123 int last_op, int *op_index, int force, 179 struct host_vm_change *hvc)
124 union mm_context *mmu, void **flush,
125 int (*do_ops)(union mm_context *,
126 struct host_vm_op *, int, int,
127 void **))
128{ 180{
129 pte_t *pte; 181 pte_t *pte;
130 int r, w, x, prot, ret = 0; 182 int r, w, x, prot, ret = 0;
@@ -142,29 +194,22 @@ static inline int update_pte_range(pmd_t *pmd, unsigned long addr,
142 } 194 }
143 prot = ((r ? UM_PROT_READ : 0) | (w ? UM_PROT_WRITE : 0) | 195 prot = ((r ? UM_PROT_READ : 0) | (w ? UM_PROT_WRITE : 0) |
144 (x ? UM_PROT_EXEC : 0)); 196 (x ? UM_PROT_EXEC : 0));
145 if(force || pte_newpage(*pte)){ 197 if (hvc->force || pte_newpage(*pte)) {
146 if(pte_present(*pte)) 198 if (pte_present(*pte))
147 ret = add_mmap(addr, pte_val(*pte) & PAGE_MASK, 199 ret = add_mmap(addr, pte_val(*pte) & PAGE_MASK,
148 PAGE_SIZE, prot, ops, op_index, 200 PAGE_SIZE, prot, hvc);
149 last_op, mmu, flush, do_ops); 201 else ret = add_munmap(addr, PAGE_SIZE, hvc);
150 else ret = add_munmap(addr, PAGE_SIZE, ops, op_index,
151 last_op, mmu, flush, do_ops);
152 } 202 }
153 else if(pte_newprot(*pte)) 203 else if (pte_newprot(*pte))
154 ret = add_mprotect(addr, PAGE_SIZE, prot, ops, op_index, 204 ret = add_mprotect(addr, PAGE_SIZE, prot, hvc);
155 last_op, mmu, flush, do_ops);
156 *pte = pte_mkuptodate(*pte); 205 *pte = pte_mkuptodate(*pte);
157 } while (pte++, addr += PAGE_SIZE, ((addr != end) && !ret)); 206 } while (pte++, addr += PAGE_SIZE, ((addr != end) && !ret));
158 return ret; 207 return ret;
159} 208}
160 209
161static inline int update_pmd_range(pud_t *pud, unsigned long addr, 210static inline int update_pmd_range(pud_t *pud, unsigned long addr,
162 unsigned long end, struct host_vm_op *ops, 211 unsigned long end,
163 int last_op, int *op_index, int force, 212 struct host_vm_change *hvc)
164 union mm_context *mmu, void **flush,
165 int (*do_ops)(union mm_context *,
166 struct host_vm_op *, int, int,
167 void **))
168{ 213{
169 pmd_t *pmd; 214 pmd_t *pmd;
170 unsigned long next; 215 unsigned long next;
@@ -173,28 +218,20 @@ static inline int update_pmd_range(pud_t *pud, unsigned long addr,
173 pmd = pmd_offset(pud, addr); 218 pmd = pmd_offset(pud, addr);
174 do { 219 do {
175 next = pmd_addr_end(addr, end); 220 next = pmd_addr_end(addr, end);
176 if(!pmd_present(*pmd)){ 221 if (!pmd_present(*pmd)) {
177 if(force || pmd_newpage(*pmd)){ 222 if (hvc->force || pmd_newpage(*pmd)) {
178 ret = add_munmap(addr, next - addr, ops, 223 ret = add_munmap(addr, next - addr, hvc);
179 op_index, last_op, mmu,
180 flush, do_ops);
181 pmd_mkuptodate(*pmd); 224 pmd_mkuptodate(*pmd);
182 } 225 }
183 } 226 }
184 else ret = update_pte_range(pmd, addr, next, ops, last_op, 227 else ret = update_pte_range(pmd, addr, next, hvc);
185 op_index, force, mmu, flush,
186 do_ops);
187 } while (pmd++, addr = next, ((addr != end) && !ret)); 228 } while (pmd++, addr = next, ((addr != end) && !ret));
188 return ret; 229 return ret;
189} 230}
190 231
191static inline int update_pud_range(pgd_t *pgd, unsigned long addr, 232static inline int update_pud_range(pgd_t *pgd, unsigned long addr,
192 unsigned long end, struct host_vm_op *ops, 233 unsigned long end,
193 int last_op, int *op_index, int force, 234 struct host_vm_change *hvc)
194 union mm_context *mmu, void **flush,
195 int (*do_ops)(union mm_context *,
196 struct host_vm_op *, int, int,
197 void **))
198{ 235{
199 pud_t *pud; 236 pud_t *pud;
200 unsigned long next; 237 unsigned long next;
@@ -203,56 +240,45 @@ static inline int update_pud_range(pgd_t *pgd, unsigned long addr,
203 pud = pud_offset(pgd, addr); 240 pud = pud_offset(pgd, addr);
204 do { 241 do {
205 next = pud_addr_end(addr, end); 242 next = pud_addr_end(addr, end);
206 if(!pud_present(*pud)){ 243 if (!pud_present(*pud)) {
207 if(force || pud_newpage(*pud)){ 244 if (hvc->force || pud_newpage(*pud)) {
208 ret = add_munmap(addr, next - addr, ops, 245 ret = add_munmap(addr, next - addr, hvc);
209 op_index, last_op, mmu,
210 flush, do_ops);
211 pud_mkuptodate(*pud); 246 pud_mkuptodate(*pud);
212 } 247 }
213 } 248 }
214 else ret = update_pmd_range(pud, addr, next, ops, last_op, 249 else ret = update_pmd_range(pud, addr, next, hvc);
215 op_index, force, mmu, flush,
216 do_ops);
217 } while (pud++, addr = next, ((addr != end) && !ret)); 250 } while (pud++, addr = next, ((addr != end) && !ret));
218 return ret; 251 return ret;
219} 252}
220 253
221void fix_range_common(struct mm_struct *mm, unsigned long start_addr, 254void fix_range_common(struct mm_struct *mm, unsigned long start_addr,
222 unsigned long end_addr, int force, 255 unsigned long end_addr, int force)
223 int (*do_ops)(union mm_context *, struct host_vm_op *,
224 int, int, void **))
225{ 256{
226 pgd_t *pgd; 257 pgd_t *pgd;
227 union mm_context *mmu = &mm->context; 258 struct host_vm_change hvc;
228 struct host_vm_op ops[1];
229 unsigned long addr = start_addr, next; 259 unsigned long addr = start_addr, next;
230 int ret = 0, last_op = ARRAY_SIZE(ops) - 1, op_index = -1; 260 int ret = 0;
231 void *flush = NULL;
232 261
233 ops[0].type = NONE; 262 hvc = INIT_HVC(mm, force);
234 pgd = pgd_offset(mm, addr); 263 pgd = pgd_offset(mm, addr);
235 do { 264 do {
236 next = pgd_addr_end(addr, end_addr); 265 next = pgd_addr_end(addr, end_addr);
237 if(!pgd_present(*pgd)){ 266 if (!pgd_present(*pgd)) {
238 if (force || pgd_newpage(*pgd)){ 267 if (force || pgd_newpage(*pgd)) {
239 ret = add_munmap(addr, next - addr, ops, 268 ret = add_munmap(addr, next - addr, &hvc);
240 &op_index, last_op, mmu,
241 &flush, do_ops);
242 pgd_mkuptodate(*pgd); 269 pgd_mkuptodate(*pgd);
243 } 270 }
244 } 271 }
245 else ret = update_pud_range(pgd, addr, next, ops, last_op, 272 else ret = update_pud_range(pgd, addr, next, &hvc);
246 &op_index, force, mmu, &flush,
247 do_ops);
248 } while (pgd++, addr = next, ((addr != end_addr) && !ret)); 273 } while (pgd++, addr = next, ((addr != end_addr) && !ret));
249 274
250 if(!ret) 275 if (!ret)
251 ret = (*do_ops)(mmu, ops, op_index, 1, &flush); 276 ret = do_ops(&hvc, hvc.index, 1);
252 277
253 /* This is not an else because ret is modified above */ 278 /* This is not an else because ret is modified above */
254 if(ret) { 279 if (ret) {
255 printk("fix_range_common: failed, killing current process\n"); 280 printk(KERN_ERR "fix_range_common: failed, killing current "
281 "process\n");
256 force_sig(SIGKILL, current); 282 force_sig(SIGKILL, current);
257 } 283 }
258} 284}
@@ -268,17 +294,17 @@ int flush_tlb_kernel_range_common(unsigned long start, unsigned long end)
268 int updated = 0, err; 294 int updated = 0, err;
269 295
270 mm = &init_mm; 296 mm = &init_mm;
271 for(addr = start; addr < end;){ 297 for (addr = start; addr < end;) {
272 pgd = pgd_offset(mm, addr); 298 pgd = pgd_offset(mm, addr);
273 if(!pgd_present(*pgd)){ 299 if (!pgd_present(*pgd)) {
274 last = ADD_ROUND(addr, PGDIR_SIZE); 300 last = ADD_ROUND(addr, PGDIR_SIZE);
275 if(last > end) 301 if (last > end)
276 last = end; 302 last = end;
277 if(pgd_newpage(*pgd)){ 303 if (pgd_newpage(*pgd)) {
278 updated = 1; 304 updated = 1;
279 err = os_unmap_memory((void *) addr, 305 err = os_unmap_memory((void *) addr,
280 last - addr); 306 last - addr);
281 if(err < 0) 307 if (err < 0)
282 panic("munmap failed, errno = %d\n", 308 panic("munmap failed, errno = %d\n",
283 -err); 309 -err);
284 } 310 }
@@ -287,15 +313,15 @@ int flush_tlb_kernel_range_common(unsigned long start, unsigned long end)
287 } 313 }
288 314
289 pud = pud_offset(pgd, addr); 315 pud = pud_offset(pgd, addr);
290 if(!pud_present(*pud)){ 316 if (!pud_present(*pud)) {
291 last = ADD_ROUND(addr, PUD_SIZE); 317 last = ADD_ROUND(addr, PUD_SIZE);
292 if(last > end) 318 if (last > end)
293 last = end; 319 last = end;
294 if(pud_newpage(*pud)){ 320 if (pud_newpage(*pud)) {
295 updated = 1; 321 updated = 1;
296 err = os_unmap_memory((void *) addr, 322 err = os_unmap_memory((void *) addr,
297 last - addr); 323 last - addr);
298 if(err < 0) 324 if (err < 0)
299 panic("munmap failed, errno = %d\n", 325 panic("munmap failed, errno = %d\n",
300 -err); 326 -err);
301 } 327 }
@@ -304,15 +330,15 @@ int flush_tlb_kernel_range_common(unsigned long start, unsigned long end)
304 } 330 }
305 331
306 pmd = pmd_offset(pud, addr); 332 pmd = pmd_offset(pud, addr);
307 if(!pmd_present(*pmd)){ 333 if (!pmd_present(*pmd)) {
308 last = ADD_ROUND(addr, PMD_SIZE); 334 last = ADD_ROUND(addr, PMD_SIZE);
309 if(last > end) 335 if (last > end)
310 last = end; 336 last = end;
311 if(pmd_newpage(*pmd)){ 337 if (pmd_newpage(*pmd)) {
312 updated = 1; 338 updated = 1;
313 err = os_unmap_memory((void *) addr, 339 err = os_unmap_memory((void *) addr,
314 last - addr); 340 last - addr);
315 if(err < 0) 341 if (err < 0)
316 panic("munmap failed, errno = %d\n", 342 panic("munmap failed, errno = %d\n",
317 -err); 343 -err);
318 } 344 }
@@ -321,45 +347,110 @@ int flush_tlb_kernel_range_common(unsigned long start, unsigned long end)
321 } 347 }
322 348
323 pte = pte_offset_kernel(pmd, addr); 349 pte = pte_offset_kernel(pmd, addr);
324 if(!pte_present(*pte) || pte_newpage(*pte)){ 350 if (!pte_present(*pte) || pte_newpage(*pte)) {
325 updated = 1; 351 updated = 1;
326 err = os_unmap_memory((void *) addr, 352 err = os_unmap_memory((void *) addr,
327 PAGE_SIZE); 353 PAGE_SIZE);
328 if(err < 0) 354 if (err < 0)
329 panic("munmap failed, errno = %d\n", 355 panic("munmap failed, errno = %d\n",
330 -err); 356 -err);
331 if(pte_present(*pte)) 357 if (pte_present(*pte))
332 map_memory(addr, 358 map_memory(addr,
333 pte_val(*pte) & PAGE_MASK, 359 pte_val(*pte) & PAGE_MASK,
334 PAGE_SIZE, 1, 1, 1); 360 PAGE_SIZE, 1, 1, 1);
335 } 361 }
336 else if(pte_newprot(*pte)){ 362 else if (pte_newprot(*pte)) {
337 updated = 1; 363 updated = 1;
338 os_protect_memory((void *) addr, PAGE_SIZE, 1, 1, 1); 364 os_protect_memory((void *) addr, PAGE_SIZE, 1, 1, 1);
339 } 365 }
340 addr += PAGE_SIZE; 366 addr += PAGE_SIZE;
341 } 367 }
342 return(updated); 368 return updated;
369}
370
371void flush_tlb_page(struct vm_area_struct *vma, unsigned long address)
372{
373 pgd_t *pgd;
374 pud_t *pud;
375 pmd_t *pmd;
376 pte_t *pte;
377 struct mm_struct *mm = vma->vm_mm;
378 void *flush = NULL;
379 int r, w, x, prot, err = 0;
380 struct mm_id *mm_id;
381
382 address &= PAGE_MASK;
383 pgd = pgd_offset(mm, address);
384 if (!pgd_present(*pgd))
385 goto kill;
386
387 pud = pud_offset(pgd, address);
388 if (!pud_present(*pud))
389 goto kill;
390
391 pmd = pmd_offset(pud, address);
392 if (!pmd_present(*pmd))
393 goto kill;
394
395 pte = pte_offset_kernel(pmd, address);
396
397 r = pte_read(*pte);
398 w = pte_write(*pte);
399 x = pte_exec(*pte);
400 if (!pte_young(*pte)) {
401 r = 0;
402 w = 0;
403 } else if (!pte_dirty(*pte)) {
404 w = 0;
405 }
406
407 mm_id = &mm->context.id;
408 prot = ((r ? UM_PROT_READ : 0) | (w ? UM_PROT_WRITE : 0) |
409 (x ? UM_PROT_EXEC : 0));
410 if (pte_newpage(*pte)) {
411 if (pte_present(*pte)) {
412 unsigned long long offset;
413 int fd;
414
415 fd = phys_mapping(pte_val(*pte) & PAGE_MASK, &offset);
416 err = map(mm_id, address, PAGE_SIZE, prot, fd, offset,
417 1, &flush);
418 }
419 else err = unmap(mm_id, address, PAGE_SIZE, 1, &flush);
420 }
421 else if (pte_newprot(*pte))
422 err = protect(mm_id, address, PAGE_SIZE, prot, 1, &flush);
423
424 if (err)
425 goto kill;
426
427 *pte = pte_mkuptodate(*pte);
428
429 return;
430
431kill:
432 printk(KERN_ERR "Failed to flush page for address 0x%lx\n", address);
433 force_sig(SIGKILL, current);
343} 434}
344 435
345pgd_t *pgd_offset_proc(struct mm_struct *mm, unsigned long address) 436pgd_t *pgd_offset_proc(struct mm_struct *mm, unsigned long address)
346{ 437{
347 return(pgd_offset(mm, address)); 438 return pgd_offset(mm, address);
348} 439}
349 440
350pud_t *pud_offset_proc(pgd_t *pgd, unsigned long address) 441pud_t *pud_offset_proc(pgd_t *pgd, unsigned long address)
351{ 442{
352 return(pud_offset(pgd, address)); 443 return pud_offset(pgd, address);
353} 444}
354 445
355pmd_t *pmd_offset_proc(pud_t *pud, unsigned long address) 446pmd_t *pmd_offset_proc(pud_t *pud, unsigned long address)
356{ 447{
357 return(pmd_offset(pud, address)); 448 return pmd_offset(pud, address);
358} 449}
359 450
360pte_t *pte_offset_proc(pmd_t *pmd, unsigned long address) 451pte_t *pte_offset_proc(pmd_t *pmd, unsigned long address)
361{ 452{
362 return(pte_offset_kernel(pmd, address)); 453 return pte_offset_kernel(pmd, address);
363} 454}
364 455
365pte_t *addr_pte(struct task_struct *task, unsigned long addr) 456pte_t *addr_pte(struct task_struct *task, unsigned long addr)
@@ -368,7 +459,7 @@ pte_t *addr_pte(struct task_struct *task, unsigned long addr)
368 pud_t *pud = pud_offset(pgd, addr); 459 pud_t *pud = pud_offset(pgd, addr);
369 pmd_t *pmd = pmd_offset(pud, addr); 460 pmd_t *pmd = pmd_offset(pud, addr);
370 461
371 return(pte_offset_map(pmd, addr)); 462 return pte_offset_map(pmd, addr);
372} 463}
373 464
374void flush_tlb_all(void) 465void flush_tlb_all(void)
@@ -378,35 +469,58 @@ void flush_tlb_all(void)
378 469
379void flush_tlb_kernel_range(unsigned long start, unsigned long end) 470void flush_tlb_kernel_range(unsigned long start, unsigned long end)
380{ 471{
381 CHOOSE_MODE_PROC(flush_tlb_kernel_range_tt, 472 flush_tlb_kernel_range_common(start, end);
382 flush_tlb_kernel_range_common, start, end);
383} 473}
384 474
385void flush_tlb_kernel_vm(void) 475void flush_tlb_kernel_vm(void)
386{ 476{
387 CHOOSE_MODE(flush_tlb_kernel_vm_tt(), 477 flush_tlb_kernel_range_common(start_vm, end_vm);
388 flush_tlb_kernel_range_common(start_vm, end_vm));
389} 478}
390 479
391void __flush_tlb_one(unsigned long addr) 480void __flush_tlb_one(unsigned long addr)
392{ 481{
393 CHOOSE_MODE_PROC(__flush_tlb_one_tt, __flush_tlb_one_skas, addr); 482 flush_tlb_kernel_range_common(addr, addr + PAGE_SIZE);
483}
484
485static void fix_range(struct mm_struct *mm, unsigned long start_addr,
486 unsigned long end_addr, int force)
487{
488 if (!proc_mm && (end_addr > STUB_START))
489 end_addr = STUB_START;
490
491 fix_range_common(mm, start_addr, end_addr, force);
394} 492}
395 493
396void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, 494void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
397 unsigned long end) 495 unsigned long end)
398{ 496{
399 CHOOSE_MODE_PROC(flush_tlb_range_tt, flush_tlb_range_skas, vma, start, 497 if (vma->vm_mm == NULL)
400 end); 498 flush_tlb_kernel_range_common(start, end);
499 else fix_range(vma->vm_mm, start, end, 0);
401} 500}
402 501
403void flush_tlb_mm(struct mm_struct *mm) 502void flush_tlb_mm(struct mm_struct *mm)
404{ 503{
405 CHOOSE_MODE_PROC(flush_tlb_mm_tt, flush_tlb_mm_skas, mm); 504 unsigned long end;
505
506 /*
507 * Don't bother flushing if this address space is about to be
508 * destroyed.
509 */
510 if (atomic_read(&mm->mm_users) == 0)
511 return;
512
513 end = proc_mm ? task_size : STUB_START;
514 fix_range(mm, 0, end, 0);
406} 515}
407 516
408void force_flush_all(void) 517void force_flush_all(void)
409{ 518{
410 CHOOSE_MODE(force_flush_all_tt(), force_flush_all_skas()); 519 struct mm_struct *mm = current->mm;
411} 520 struct vm_area_struct *vma = mm->mmap;
412 521
522 while (vma != NULL) {
523 fix_range(mm, vma->vm_start, vma->vm_end, 1);
524 vma = vma->vm_next;
525 }
526}
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c
index 3850d53f79fd..bd060551e619 100644
--- a/arch/um/kernel/trap.c
+++ b/arch/um/kernel/trap.c
@@ -1,40 +1,24 @@
1/* 1/*
2 * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/kernel.h" 6#include <linux/mm.h>
7#include "asm/errno.h" 7#include <linux/sched.h>
8#include "linux/sched.h" 8#include <linux/hardirq.h>
9#include "linux/mm.h" 9#include <asm/current.h>
10#include "linux/spinlock.h" 10#include <asm/pgtable.h>
11#include "linux/init.h" 11#include <asm/tlbflush.h>
12#include "linux/ptrace.h"
13#include "asm/semaphore.h"
14#include "asm/pgtable.h"
15#include "asm/pgalloc.h"
16#include "asm/tlbflush.h"
17#include "asm/a.out.h"
18#include "asm/current.h"
19#include "asm/irq.h"
20#include "sysdep/sigcontext.h"
21#include "kern_util.h"
22#include "as-layout.h"
23#include "arch.h" 12#include "arch.h"
24#include "kern.h" 13#include "as-layout.h"
25#include "chan_kern.h" 14#include "kern_util.h"
26#include "mconsole_kern.h"
27#include "mem.h"
28#include "mem_kern.h"
29#include "sysdep/sigcontext.h"
30#include "sysdep/ptrace.h"
31#include "os.h"
32#ifdef CONFIG_MODE_SKAS
33#include "skas.h"
34#endif
35#include "os.h" 15#include "os.h"
16#include "sysdep/sigcontext.h"
36 17
37/* Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by segv(). */ 18/*
19 * Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by
20 * segv().
21 */
38int handle_page_fault(unsigned long address, unsigned long ip, 22int handle_page_fault(unsigned long address, unsigned long ip,
39 int is_write, int is_user, int *code_out) 23 int is_write, int is_user, int *code_out)
40{ 24{
@@ -48,31 +32,33 @@ int handle_page_fault(unsigned long address, unsigned long ip,
48 32
49 *code_out = SEGV_MAPERR; 33 *code_out = SEGV_MAPERR;
50 34
51 /* If the fault was during atomic operation, don't take the fault, just 35 /*
52 * fail. */ 36 * If the fault was during atomic operation, don't take the fault, just
37 * fail.
38 */
53 if (in_atomic()) 39 if (in_atomic())
54 goto out_nosemaphore; 40 goto out_nosemaphore;
55 41
56 down_read(&mm->mmap_sem); 42 down_read(&mm->mmap_sem);
57 vma = find_vma(mm, address); 43 vma = find_vma(mm, address);
58 if(!vma) 44 if (!vma)
59 goto out; 45 goto out;
60 else if(vma->vm_start <= address) 46 else if (vma->vm_start <= address)
61 goto good_area; 47 goto good_area;
62 else if(!(vma->vm_flags & VM_GROWSDOWN)) 48 else if (!(vma->vm_flags & VM_GROWSDOWN))
63 goto out; 49 goto out;
64 else if(is_user && !ARCH_IS_STACKGROW(address)) 50 else if (is_user && !ARCH_IS_STACKGROW(address))
65 goto out; 51 goto out;
66 else if(expand_stack(vma, address)) 52 else if (expand_stack(vma, address))
67 goto out; 53 goto out;
68 54
69good_area: 55good_area:
70 *code_out = SEGV_ACCERR; 56 *code_out = SEGV_ACCERR;
71 if(is_write && !(vma->vm_flags & VM_WRITE)) 57 if (is_write && !(vma->vm_flags & VM_WRITE))
72 goto out; 58 goto out;
73 59
74 /* Don't require VM_READ|VM_EXEC for write faults! */ 60 /* Don't require VM_READ|VM_EXEC for write faults! */
75 if(!is_write && !(vma->vm_flags & (VM_READ | VM_EXEC))) 61 if (!is_write && !(vma->vm_flags & (VM_READ | VM_EXEC)))
76 goto out; 62 goto out;
77 63
78 do { 64 do {
@@ -98,9 +84,10 @@ survive:
98 pud = pud_offset(pgd, address); 84 pud = pud_offset(pgd, address);
99 pmd = pmd_offset(pud, address); 85 pmd = pmd_offset(pud, address);
100 pte = pte_offset_kernel(pmd, address); 86 pte = pte_offset_kernel(pmd, address);
101 } while(!pte_present(*pte)); 87 } while (!pte_present(*pte));
102 err = 0; 88 err = 0;
103 /* The below warning was added in place of 89 /*
90 * The below warning was added in place of
104 * pte_mkyoung(); if (is_write) pte_mkdirty(); 91 * pte_mkyoung(); if (is_write) pte_mkdirty();
105 * If it's triggered, we'd see normally a hang here (a clean pte is 92 * If it's triggered, we'd see normally a hang here (a clean pte is
106 * marked read-only to emulate the dirty bit). 93 * marked read-only to emulate the dirty bit).
@@ -114,7 +101,7 @@ survive:
114out: 101out:
115 up_read(&mm->mmap_sem); 102 up_read(&mm->mmap_sem);
116out_nosemaphore: 103out_nosemaphore:
117 return(err); 104 return err;
118 105
119/* 106/*
120 * We ran out of memory, or some other thing happened to us that made 107 * We ran out of memory, or some other thing happened to us that made
@@ -141,11 +128,11 @@ static void bad_segv(struct faultinfo fi, unsigned long ip)
141 force_sig_info(SIGSEGV, &si, current); 128 force_sig_info(SIGSEGV, &si, current);
142} 129}
143 130
144static void segv_handler(int sig, union uml_pt_regs *regs) 131static void segv_handler(int sig, struct uml_pt_regs *regs)
145{ 132{
146 struct faultinfo * fi = UPT_FAULTINFO(regs); 133 struct faultinfo * fi = UPT_FAULTINFO(regs);
147 134
148 if(UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)){ 135 if (UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)) {
149 bad_segv(*fi, UPT_IP(regs)); 136 bad_segv(*fi, UPT_IP(regs));
150 return; 137 return;
151 } 138 }
@@ -159,45 +146,49 @@ static void segv_handler(int sig, union uml_pt_regs *regs)
159 * give us bad data! 146 * give us bad data!
160 */ 147 */
161unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, 148unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user,
162 union uml_pt_regs *regs) 149 struct uml_pt_regs *regs)
163{ 150{
164 struct siginfo si; 151 struct siginfo si;
165 void *catcher; 152 jmp_buf *catcher;
166 int err; 153 int err;
167 int is_write = FAULT_WRITE(fi); 154 int is_write = FAULT_WRITE(fi);
168 unsigned long address = FAULT_ADDRESS(fi); 155 unsigned long address = FAULT_ADDRESS(fi);
169 156
170 if(!is_user && (address >= start_vm) && (address < end_vm)){ 157 if (!is_user && (address >= start_vm) && (address < end_vm)) {
171 flush_tlb_kernel_vm(); 158 flush_tlb_kernel_vm();
172 return 0; 159 return 0;
173 } 160 }
174 else if(current->mm == NULL) { 161 else if (current->mm == NULL) {
175 show_regs(container_of(regs, struct pt_regs, regs)); 162 show_regs(container_of(regs, struct pt_regs, regs));
176 panic("Segfault with no mm"); 163 panic("Segfault with no mm");
177 } 164 }
178 165
179 if (SEGV_IS_FIXABLE(&fi) || SEGV_MAYBE_FIXABLE(&fi)) 166 if (SEGV_IS_FIXABLE(&fi) || SEGV_MAYBE_FIXABLE(&fi))
180 err = handle_page_fault(address, ip, is_write, is_user, &si.si_code); 167 err = handle_page_fault(address, ip, is_write, is_user,
168 &si.si_code);
181 else { 169 else {
182 err = -EFAULT; 170 err = -EFAULT;
183 /* A thread accessed NULL, we get a fault, but CR2 is invalid. 171 /*
184 * This code is used in __do_copy_from_user() of TT mode. */ 172 * A thread accessed NULL, we get a fault, but CR2 is invalid.
173 * This code is used in __do_copy_from_user() of TT mode.
174 * XXX tt mode is gone, so maybe this isn't needed any more
175 */
185 address = 0; 176 address = 0;
186 } 177 }
187 178
188 catcher = current->thread.fault_catcher; 179 catcher = current->thread.fault_catcher;
189 if(!err) 180 if (!err)
190 return 0; 181 return 0;
191 else if(catcher != NULL){ 182 else if (catcher != NULL) {
192 current->thread.fault_addr = (void *) address; 183 current->thread.fault_addr = (void *) address;
193 do_longjmp(catcher, 1); 184 UML_LONGJMP(catcher, 1);
194 } 185 }
195 else if(current->thread.fault_addr != NULL) 186 else if (current->thread.fault_addr != NULL)
196 panic("fault_addr set but no fault catcher"); 187 panic("fault_addr set but no fault catcher");
197 else if(!is_user && arch_fixup(ip, regs)) 188 else if (!is_user && arch_fixup(ip, regs))
198 return 0; 189 return 0;
199 190
200 if(!is_user) { 191 if (!is_user) {
201 show_regs(container_of(regs, struct pt_regs, regs)); 192 show_regs(container_of(regs, struct pt_regs, regs));
202 panic("Kernel mode fault at addr 0x%lx, ip 0x%lx", 193 panic("Kernel mode fault at addr 0x%lx, ip 0x%lx",
203 address, ip); 194 address, ip);
@@ -211,7 +202,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user,
211 current->thread.arch.faultinfo = fi; 202 current->thread.arch.faultinfo = fi;
212 force_sig_info(SIGBUS, &si, current); 203 force_sig_info(SIGBUS, &si, current);
213 } else if (err == -ENOMEM) { 204 } else if (err == -ENOMEM) {
214 printk("VM: killing process %s\n", current->comm); 205 printk(KERN_INFO "VM: killing process %s\n", current->comm);
215 do_exit(SIGKILL); 206 do_exit(SIGKILL);
216 } else { 207 } else {
217 BUG_ON(err != -EFAULT); 208 BUG_ON(err != -EFAULT);
@@ -223,15 +214,15 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user,
223 return 0; 214 return 0;
224} 215}
225 216
226void relay_signal(int sig, union uml_pt_regs *regs) 217void relay_signal(int sig, struct uml_pt_regs *regs)
227{ 218{
228 if(arch_handle_signal(sig, regs)) 219 if (arch_handle_signal(sig, regs))
229 return; 220 return;
230 221
231 if(!UPT_IS_USER(regs)){ 222 if (!UPT_IS_USER(regs)) {
232 if(sig == SIGBUS) 223 if (sig == SIGBUS)
233 printk("Bus error - the host /dev/shm or /tmp mount " 224 printk(KERN_ERR "Bus error - the host /dev/shm or /tmp "
234 "likely just ran out of space\n"); 225 "mount likely just ran out of space\n");
235 panic("Kernel mode signal %d", sig); 226 panic("Kernel mode signal %d", sig);
236 } 227 }
237 228
@@ -239,14 +230,14 @@ void relay_signal(int sig, union uml_pt_regs *regs)
239 force_sig(sig, current); 230 force_sig(sig, current);
240} 231}
241 232
242static void bus_handler(int sig, union uml_pt_regs *regs) 233static void bus_handler(int sig, struct uml_pt_regs *regs)
243{ 234{
244 if(current->thread.fault_catcher != NULL) 235 if (current->thread.fault_catcher != NULL)
245 do_longjmp(current->thread.fault_catcher, 1); 236 UML_LONGJMP(current->thread.fault_catcher, 1);
246 else relay_signal(sig, regs); 237 else relay_signal(sig, regs);
247} 238}
248 239
249static void winch(int sig, union uml_pt_regs *regs) 240static void winch(int sig, struct uml_pt_regs *regs)
250{ 241{
251 do_IRQ(WINCH_IRQ, regs); 242 do_IRQ(WINCH_IRQ, regs);
252} 243}
diff --git a/arch/um/kernel/tt/Makefile b/arch/um/kernel/tt/Makefile
deleted file mode 100644
index 6939e5af8472..000000000000
--- a/arch/um/kernel/tt/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
1#
2# Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com)
3# Licensed under the GPL
4#
5
6obj-y = exec_kern.o exec_user.o gdb.o ksyms.o mem.o mem_user.o process_kern.o \
7 syscall_kern.o syscall_user.o tlb.o tracer.o trap_user.o \
8 uaccess.o uaccess_user.o
9
10obj-$(CONFIG_PT_PROXY) += gdb_kern.o ptproxy/
11
12USER_OBJS := gdb.o tracer.o
13
14include arch/um/scripts/Makefile.rules
diff --git a/arch/um/kernel/tt/exec_kern.c b/arch/um/kernel/tt/exec_kern.c
deleted file mode 100644
index 40126cb51801..000000000000
--- a/arch/um/kernel/tt/exec_kern.c
+++ /dev/null
@@ -1,84 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include "linux/kernel.h"
7#include "linux/mm.h"
8#include "asm/signal.h"
9#include "asm/ptrace.h"
10#include "asm/uaccess.h"
11#include "asm/pgalloc.h"
12#include "asm/tlbflush.h"
13#include "kern_util.h"
14#include "irq_user.h"
15#include "mem_user.h"
16#include "os.h"
17#include "tlb.h"
18#include "mode.h"
19
20static int exec_tramp(void *sig_stack)
21{
22 init_new_thread_stack(sig_stack, NULL);
23 init_new_thread_signals();
24 os_stop_process(os_getpid());
25 return(0);
26}
27
28void flush_thread_tt(void)
29{
30 unsigned long stack;
31 int new_pid;
32
33 stack = alloc_stack(0, 0);
34 if(stack == 0){
35 printk(KERN_ERR
36 "flush_thread : failed to allocate temporary stack\n");
37 do_exit(SIGKILL);
38 }
39
40 new_pid = start_fork_tramp(task_stack_page(current), stack, 0, exec_tramp);
41 if(new_pid < 0){
42 printk(KERN_ERR
43 "flush_thread : new thread failed, errno = %d\n",
44 -new_pid);
45 do_exit(SIGKILL);
46 }
47
48 if(current_thread->cpu == 0)
49 forward_interrupts(new_pid);
50 current->thread.request.op = OP_EXEC;
51 current->thread.request.u.exec.pid = new_pid;
52 unprotect_stack((unsigned long) current_thread);
53 os_usr1_process(os_getpid());
54 change_sig(SIGUSR1, 1);
55
56 change_sig(SIGUSR1, 0);
57 enable_timer();
58 free_page(stack);
59 protect_memory(uml_reserved, high_physmem - uml_reserved, 1, 1, 0, 1);
60 stack_protections((unsigned long) current_thread);
61 force_flush_all();
62 unblock_signals();
63}
64
65void start_thread_tt(struct pt_regs *regs, unsigned long eip,
66 unsigned long esp)
67{
68 set_fs(USER_DS);
69 flush_tlb_mm(current->mm);
70 PT_REGS_IP(regs) = eip;
71 PT_REGS_SP(regs) = esp;
72 PT_FIX_EXEC_STACK(esp);
73}
74
75/*
76 * Overrides for Emacs so that we follow Linus's tabbing style.
77 * Emacs will notice this stuff at the end of the file and automatically
78 * adjust the settings for this buffer only. This must remain at the end
79 * of the file.
80 * ---------------------------------------------------------------------------
81 * Local variables:
82 * c-file-style: "linux"
83 * End:
84 */
diff --git a/arch/um/kernel/tt/exec_user.c b/arch/um/kernel/tt/exec_user.c
deleted file mode 100644
index 7b5f2181cf51..000000000000
--- a/arch/um/kernel/tt/exec_user.c
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <stdio.h>
7#include <unistd.h>
8#include <stdlib.h>
9#include <sched.h>
10#include <errno.h>
11#include <sys/wait.h>
12#include <signal.h>
13#include "kern_util.h"
14#include "user.h"
15#include "ptrace_user.h"
16#include "os.h"
17
18void do_exec(int old_pid, int new_pid)
19{
20 unsigned long regs[FRAME_SIZE];
21 int err;
22
23 if((ptrace(PTRACE_ATTACH, new_pid, 0, 0) < 0) ||
24 (ptrace(PTRACE_CONT, new_pid, 0, 0) < 0))
25 tracer_panic("do_exec failed to attach proc - errno = %d",
26 errno);
27
28 CATCH_EINTR(err = waitpid(new_pid, 0, WUNTRACED));
29 if (err < 0)
30 tracer_panic("do_exec failed to attach proc in waitpid - errno = %d",
31 errno);
32
33 if(ptrace_getregs(old_pid, regs) < 0)
34 tracer_panic("do_exec failed to get registers - errno = %d",
35 errno);
36
37 os_kill_ptraced_process(old_pid, 0);
38
39 if (ptrace(PTRACE_OLDSETOPTIONS, new_pid, 0, (void *)PTRACE_O_TRACESYSGOOD) < 0)
40 tracer_panic("do_exec: PTRACE_SETOPTIONS failed, errno = %d", errno);
41
42 if(ptrace_setregs(new_pid, regs) < 0)
43 tracer_panic("do_exec failed to start new proc - errno = %d",
44 errno);
45}
46
47/*
48 * Overrides for Emacs so that we follow Linus's tabbing style.
49 * Emacs will notice this stuff at the end of the file and automatically
50 * adjust the settings for this buffer only. This must remain at the end
51 * of the file.
52 * ---------------------------------------------------------------------------
53 * Local variables:
54 * c-file-style: "linux"
55 * End:
56 */
diff --git a/arch/um/kernel/tt/gdb.c b/arch/um/kernel/tt/gdb.c
deleted file mode 100644
index 030e4658f36b..000000000000
--- a/arch/um/kernel/tt/gdb.c
+++ /dev/null
@@ -1,280 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <stdio.h>
7#include <stdlib.h>
8#include <errno.h>
9#include <string.h>
10#include <signal.h>
11#include <sys/types.h>
12#include "ptrace_user.h"
13#include "uml-config.h"
14#include "kern_constants.h"
15#include "chan_user.h"
16#include "init.h"
17#include "user.h"
18#include "debug.h"
19#include "kern_util.h"
20#include "tt.h"
21#include "sysdep/thread.h"
22#include "os.h"
23
24extern int debugger_pid;
25extern int debugger_fd;
26extern int debugger_parent;
27
28int detach(int pid, int sig)
29{
30 return(ptrace(PTRACE_DETACH, pid, 0, sig));
31}
32
33int attach(int pid)
34{
35 int err;
36
37 err = ptrace(PTRACE_ATTACH, pid, 0, 0);
38 if(err < 0) return(-errno);
39 else return(err);
40}
41
42int cont(int pid)
43{
44 return(ptrace(PTRACE_CONT, pid, 0, 0));
45}
46
47#ifdef UML_CONFIG_PT_PROXY
48
49int debugger_signal(int status, pid_t pid)
50{
51 return(debugger_proxy(status, pid));
52}
53
54void child_signal(pid_t pid, int status)
55{
56 child_proxy(pid, status);
57}
58
59static void gdb_announce(char *dev_name, int dev)
60{
61 printf("gdb assigned device '%s'\n", dev_name);
62}
63
64static struct chan_opts opts = {
65 .announce = gdb_announce,
66 .xterm_title = "UML kernel debugger",
67 .raw = 0,
68 .tramp_stack = 0,
69 .in_kernel = 0,
70};
71
72/* Accessed by the tracing thread, which automatically serializes access */
73static void *xterm_data;
74static int xterm_fd;
75
76extern void *xterm_init(char *, int, struct chan_opts *);
77extern int xterm_open(int, int, int, void *, char **);
78extern void xterm_close(int, void *);
79
80int open_gdb_chan(void)
81{
82 char stack[UM_KERN_PAGE_SIZE], *dummy;
83
84 opts.tramp_stack = (unsigned long) stack;
85 xterm_data = xterm_init("", 0, &opts);
86 xterm_fd = xterm_open(1, 1, 1, xterm_data, &dummy);
87 return(xterm_fd);
88}
89
90static void exit_debugger_cb(void *unused)
91{
92 if(debugger_pid != -1){
93 if(gdb_pid != -1){
94 fake_child_exit();
95 gdb_pid = -1;
96 }
97 else kill_child_dead(debugger_pid);
98 debugger_pid = -1;
99 if(debugger_parent != -1)
100 detach(debugger_parent, SIGINT);
101 }
102 if(xterm_data != NULL) xterm_close(xterm_fd, xterm_data);
103}
104
105static void exit_debugger(void)
106{
107 initial_thread_cb(exit_debugger_cb, NULL);
108}
109
110__uml_exitcall(exit_debugger);
111
112struct gdb_data {
113 char *str;
114 int err;
115};
116
117extern char *linux_prog;
118
119static void config_gdb_cb(void *arg)
120{
121 struct gdb_data *data = arg;
122 void *task;
123 int pid;
124
125 data->err = -1;
126 if(debugger_pid != -1) exit_debugger_cb(NULL);
127 if(!strncmp(data->str, "pid,", strlen("pid,"))){
128 data->str += strlen("pid,");
129 pid = strtoul(data->str, NULL, 0);
130 task = cpu_tasks[0].task;
131 debugger_pid = attach_debugger(TASK_EXTERN_PID(task), pid, 0);
132 if(debugger_pid != -1){
133 data->err = 0;
134 gdb_pid = pid;
135 }
136 return;
137 }
138 data->err = 0;
139 debugger_pid = start_debugger(linux_prog, 0, 0, &debugger_fd);
140 init_proxy(debugger_pid, 0, 0);
141}
142
143int gdb_config(char *str, char **error_out)
144{
145 struct gdb_data data;
146
147 if(*str++ != '=') return(-1);
148 data.str = str;
149 initial_thread_cb(config_gdb_cb, &data);
150 return(data.err);
151}
152
153void remove_gdb_cb(void *unused)
154{
155 exit_debugger_cb(NULL);
156}
157
158int gdb_remove(int unused, char **error_out)
159{
160 initial_thread_cb(remove_gdb_cb, NULL);
161 return 0;
162}
163
164void signal_usr1(int sig)
165{
166 if(debugger_pid != -1){
167 printf("The debugger is already running\n");
168 return;
169 }
170 debugger_pid = start_debugger(linux_prog, 0, 0, &debugger_fd);
171 init_proxy(debugger_pid, 0, 0);
172}
173
174int init_ptrace_proxy(int idle_pid, int startup, int stop)
175{
176 int pid, status;
177
178 pid = start_debugger(linux_prog, startup, stop, &debugger_fd);
179 status = wait_for_stop(idle_pid, SIGSTOP, PTRACE_CONT, NULL);
180 if(pid < 0){
181 cont(idle_pid);
182 return(-1);
183 }
184 init_proxy(pid, 1, status);
185 return(pid);
186}
187
188int attach_debugger(int idle_pid, int pid, int stop)
189{
190 int status = 0, err;
191
192 err = attach(pid);
193 if(err < 0){
194 printf("Failed to attach pid %d, errno = %d\n", pid, -err);
195 return(-1);
196 }
197 if(stop) status = wait_for_stop(idle_pid, SIGSTOP, PTRACE_CONT, NULL);
198 init_proxy(pid, 1, status);
199 return(pid);
200}
201
202#ifdef notdef /* Put this back in when it does something useful */
203static int __init uml_gdb_init_setup(char *line, int *add)
204{
205 gdb_init = uml_strdup(line);
206 return 0;
207}
208
209__uml_setup("gdb=", uml_gdb_init_setup,
210"gdb=<channel description>\n\n"
211);
212#endif
213
214static int __init uml_gdb_pid_setup(char *line, int *add)
215{
216 gdb_pid = strtoul(line, NULL, 0);
217 *add = 0;
218 return 0;
219}
220
221__uml_setup("gdb-pid=", uml_gdb_pid_setup,
222"gdb-pid=<pid>\n"
223" gdb-pid is used to attach an external debugger to UML. This may be\n"
224" an already-running gdb or a debugger-like process like strace.\n\n"
225);
226
227#else
228
229int debugger_signal(int status, pid_t pid){ return(0); }
230void child_signal(pid_t pid, int status){ }
231int init_ptrace_proxy(int idle_pid, int startup, int stop)
232{
233 printf("debug requested when CONFIG_PT_PROXY is off\n");
234 kill_child_dead(idle_pid);
235 exit(1);
236}
237
238void signal_usr1(int sig)
239{
240 printf("debug requested when CONFIG_PT_PROXY is off\n");
241}
242
243int attach_debugger(int idle_pid, int pid, int stop)
244{
245 printf("attach_debugger called when CONFIG_PT_PROXY "
246 "is off\n");
247 return(-1);
248}
249
250int config_gdb(char *str)
251{
252 return(-1);
253}
254
255int remove_gdb(void)
256{
257 return(-1);
258}
259
260int init_parent_proxy(int pid)
261{
262 return(-1);
263}
264
265void debugger_parent_signal(int status, int pid)
266{
267}
268
269#endif
270
271/*
272 * Overrides for Emacs so that we follow Linus's tabbing style.
273 * Emacs will notice this stuff at the end of the file and automatically
274 * adjust the settings for this buffer only. This must remain at the end
275 * of the file.
276 * ---------------------------------------------------------------------------
277 * Local variables:
278 * c-file-style: "linux"
279 * End:
280 */
diff --git a/arch/um/kernel/tt/gdb_kern.c b/arch/um/kernel/tt/gdb_kern.c
deleted file mode 100644
index 03b06bc00771..000000000000
--- a/arch/um/kernel/tt/gdb_kern.c
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include "linux/init.h"
7#include "mconsole_kern.h"
8
9#ifdef CONFIG_MCONSOLE
10
11extern int gdb_config(char *str, char **error_out);
12extern int gdb_remove(int n, char **error_out);
13
14static struct mc_device gdb_mc = {
15 .list = INIT_LIST_HEAD(gdb_mc.list),
16 .name = "gdb",
17 .config = gdb_config,
18 .remove = gdb_remove,
19};
20
21int gdb_mc_init(void)
22{
23 mconsole_register_dev(&gdb_mc);
24 return(0);
25}
26
27__initcall(gdb_mc_init);
28
29#endif
30
31/*
32 * Overrides for Emacs so that we follow Linus's tabbing style.
33 * Emacs will notice this stuff at the end of the file and automatically
34 * adjust the settings for this buffer only. This must remain at the end
35 * of the file.
36 * ---------------------------------------------------------------------------
37 * Local variables:
38 * c-file-style: "linux"
39 * End:
40 */
diff --git a/arch/um/kernel/tt/include/mode-tt.h b/arch/um/kernel/tt/include/mode-tt.h
deleted file mode 100644
index e171e15fead5..000000000000
--- a/arch/um/kernel/tt/include/mode-tt.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __MODE_TT_H__
7#define __MODE_TT_H__
8
9#include "sysdep/ptrace.h"
10
11enum { OP_NONE, OP_EXEC, OP_FORK, OP_TRACE_ON, OP_REBOOT, OP_HALT, OP_CB };
12
13extern int tracing_pid;
14
15extern int tracer(int (*init_proc)(void *), void *sp);
16extern void sig_handler_common_tt(int sig, void *sc);
17extern void syscall_handler_tt(int sig, union uml_pt_regs *regs);
18extern void reboot_tt(void);
19extern void halt_tt(void);
20extern int is_tracer_winch(int pid, int fd, void *data);
21extern void kill_off_processes_tt(void);
22
23#endif
24
25/*
26 * Overrides for Emacs so that we follow Linus's tabbing style.
27 * Emacs will notice this stuff at the end of the file and automatically
28 * adjust the settings for this buffer only. This must remain at the end
29 * of the file.
30 * ---------------------------------------------------------------------------
31 * Local variables:
32 * c-file-style: "linux"
33 * End:
34 */
diff --git a/arch/um/kernel/tt/ksyms.c b/arch/um/kernel/tt/ksyms.c
deleted file mode 100644
index 84a9385a8fef..000000000000
--- a/arch/um/kernel/tt/ksyms.c
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include "linux/module.h"
7#include "asm/uaccess.h"
8#include "mode.h"
9
10EXPORT_SYMBOL(__do_copy_from_user);
11EXPORT_SYMBOL(__do_copy_to_user);
12EXPORT_SYMBOL(__do_strncpy_from_user);
13EXPORT_SYMBOL(__do_strnlen_user);
14EXPORT_SYMBOL(__do_clear_user);
15EXPORT_SYMBOL(clear_user_tt);
16
17EXPORT_SYMBOL(tracing_pid);
18EXPORT_SYMBOL(honeypot);
19
20/*
21 * Overrides for Emacs so that we follow Linus's tabbing style.
22 * Emacs will notice this stuff at the end of the file and automatically
23 * adjust the settings for this buffer only. This must remain at the end
24 * of the file.
25 * ---------------------------------------------------------------------------
26 * Local variables:
27 * c-file-style: "linux"
28 * End:
29 */
diff --git a/arch/um/kernel/tt/mem.c b/arch/um/kernel/tt/mem.c
deleted file mode 100644
index d0c3c4975f28..000000000000
--- a/arch/um/kernel/tt/mem.c
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include "linux/stddef.h"
7#include "linux/mm.h"
8#include "asm/uaccess.h"
9#include "mem_user.h"
10#include "kern_util.h"
11#include "kern.h"
12#include "tt.h"
13
14void before_mem_tt(unsigned long brk_start)
15{
16 if(debug)
17 remap_data(UML_ROUND_DOWN(&_stext), UML_ROUND_UP(&_etext), 1);
18 remap_data(UML_ROUND_DOWN(&_sdata), UML_ROUND_UP(&_edata), 1);
19 remap_data(UML_ROUND_DOWN(&__bss_start), UML_ROUND_UP(&_end), 1);
20}
21
22#define SIZE ((CONFIG_NEST_LEVEL + CONFIG_KERNEL_HALF_GIGS) * 0x20000000)
23#define START (CONFIG_TOP_ADDR - SIZE)
24
25unsigned long set_task_sizes_tt(unsigned long *task_size_out)
26{
27 unsigned long host_task_size;
28
29 /* Round up to the nearest 4M */
30 host_task_size = ROUND_4M((unsigned long) &host_task_size);
31 *task_size_out = START;
32
33 return host_task_size;
34}
diff --git a/arch/um/kernel/tt/mem_user.c b/arch/um/kernel/tt/mem_user.c
deleted file mode 100644
index 9774f6360c32..000000000000
--- a/arch/um/kernel/tt/mem_user.c
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <stdlib.h>
7#include <stdio.h>
8#include <unistd.h>
9#include <string.h>
10#include <errno.h>
11#include <sys/mman.h>
12#include "tt.h"
13#include "mem_user.h"
14#include "os.h"
15
16void remap_data(void *segment_start, void *segment_end, int w)
17{
18 void *addr;
19 unsigned long size;
20 int data, prot;
21
22 if(w) prot = PROT_WRITE;
23 else prot = 0;
24 prot |= PROT_READ | PROT_EXEC;
25 size = (unsigned long) segment_end -
26 (unsigned long) segment_start;
27 data = create_mem_file(size);
28 addr = mmap(NULL, size, PROT_WRITE | PROT_READ, MAP_SHARED, data, 0);
29 if(addr == MAP_FAILED){
30 perror("mapping new data segment");
31 exit(1);
32 }
33 memcpy(addr, segment_start, size);
34 if(switcheroo(data, prot, addr, segment_start, size) < 0){
35 printf("switcheroo failed\n");
36 exit(1);
37 }
38}
39
40/*
41 * Overrides for Emacs so that we follow Linus's tabbing style.
42 * Emacs will notice this stuff at the end of the file and automatically
43 * adjust the settings for this buffer only. This must remain at the end
44 * of the file.
45 * ---------------------------------------------------------------------------
46 * Local variables:
47 * c-file-style: "linux"
48 * End:
49 */
diff --git a/arch/um/kernel/tt/process_kern.c b/arch/um/kernel/tt/process_kern.c
deleted file mode 100644
index 74347adf81bf..000000000000
--- a/arch/um/kernel/tt/process_kern.c
+++ /dev/null
@@ -1,461 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include "linux/sched.h"
7#include "linux/signal.h"
8#include "linux/kernel.h"
9#include "linux/interrupt.h"
10#include "linux/ptrace.h"
11#include "asm/system.h"
12#include "asm/pgalloc.h"
13#include "asm/ptrace.h"
14#include "asm/tlbflush.h"
15#include "irq_user.h"
16#include "kern_util.h"
17#include "os.h"
18#include "kern.h"
19#include "sigcontext.h"
20#include "mem_user.h"
21#include "tlb.h"
22#include "mode.h"
23#include "mode_kern.h"
24#include "init.h"
25#include "tt.h"
26
27void switch_to_tt(void *prev, void *next)
28{
29 struct task_struct *from, *to, *prev_sched;
30 unsigned long flags;
31 int err, vtalrm, alrm, prof, cpu;
32 char c;
33
34 from = prev;
35 to = next;
36
37 cpu = task_thread_info(from)->cpu;
38 if(cpu == 0)
39 forward_interrupts(to->thread.mode.tt.extern_pid);
40#ifdef CONFIG_SMP
41 forward_ipi(cpu_data[cpu].ipi_pipe[0], to->thread.mode.tt.extern_pid);
42#endif
43 local_irq_save(flags);
44
45 vtalrm = change_sig(SIGVTALRM, 0);
46 alrm = change_sig(SIGALRM, 0);
47 prof = change_sig(SIGPROF, 0);
48
49 forward_pending_sigio(to->thread.mode.tt.extern_pid);
50
51 c = 0;
52
53 /* Notice that here we "up" the semaphore on which "to" is waiting, and
54 * below (the read) we wait on this semaphore (which is implemented by
55 * switch_pipe) and go sleeping. Thus, after that, we have resumed in
56 * "to", and can't use any more the value of "from" (which is outdated),
57 * nor the value in "to" (since it was the task which stole us the CPU,
58 * which we don't care about). */
59
60 err = os_write_file(to->thread.mode.tt.switch_pipe[1], &c, sizeof(c));
61 if(err != sizeof(c))
62 panic("write of switch_pipe failed, err = %d", -err);
63
64 if(from->thread.mode.tt.switch_pipe[0] == -1)
65 os_kill_process(os_getpid(), 0);
66
67 err = os_read_file(from->thread.mode.tt.switch_pipe[0], &c,
68 sizeof(c));
69 if(err != sizeof(c))
70 panic("read of switch_pipe failed, errno = %d", -err);
71
72 /* If the process that we have just scheduled away from has exited,
73 * then it needs to be killed here. The reason is that, even though
74 * it will kill itself when it next runs, that may be too late. Its
75 * stack will be freed, possibly before then, and if that happens,
76 * we have a use-after-free situation. So, it gets killed here
77 * in case it has not already killed itself.
78 */
79 prev_sched = current->thread.prev_sched;
80 if(prev_sched->thread.mode.tt.switch_pipe[0] == -1)
81 os_kill_process(prev_sched->thread.mode.tt.extern_pid, 1);
82
83 change_sig(SIGVTALRM, vtalrm);
84 change_sig(SIGALRM, alrm);
85 change_sig(SIGPROF, prof);
86
87 arch_switch_to_tt(prev_sched, current);
88
89 flush_tlb_all();
90 local_irq_restore(flags);
91}
92
93void release_thread_tt(struct task_struct *task)
94{
95 int pid = task->thread.mode.tt.extern_pid;
96
97 /*
98 * We first have to kill the other process, before
99 * closing its switch_pipe. Else it might wake up
100 * and receive "EOF" before we could kill it.
101 */
102 if(os_getpid() != pid)
103 os_kill_process(pid, 0);
104
105 os_close_file(task->thread.mode.tt.switch_pipe[0]);
106 os_close_file(task->thread.mode.tt.switch_pipe[1]);
107 /* use switch_pipe as flag: thread is released */
108 task->thread.mode.tt.switch_pipe[0] = -1;
109}
110
111void suspend_new_thread(int fd)
112{
113 int err;
114 char c;
115
116 os_stop_process(os_getpid());
117 err = os_read_file(fd, &c, sizeof(c));
118 if(err != sizeof(c))
119 panic("read failed in suspend_new_thread, err = %d", -err);
120}
121
122void schedule_tail(struct task_struct *prev);
123
124static void new_thread_handler(int sig)
125{
126 unsigned long disable;
127 int (*fn)(void *);
128 void *arg;
129
130 fn = current->thread.request.u.thread.proc;
131 arg = current->thread.request.u.thread.arg;
132
133 UPT_SC(&current->thread.regs.regs) = (void *) (&sig + 1);
134 disable = (1 << (SIGVTALRM - 1)) | (1 << (SIGALRM - 1)) |
135 (1 << (SIGIO - 1)) | (1 << (SIGPROF - 1));
136 SC_SIGMASK(UPT_SC(&current->thread.regs.regs)) &= ~disable;
137
138 suspend_new_thread(current->thread.mode.tt.switch_pipe[0]);
139
140 force_flush_all();
141 if(current->thread.prev_sched != NULL)
142 schedule_tail(current->thread.prev_sched);
143 current->thread.prev_sched = NULL;
144
145 init_new_thread_signals();
146 enable_timer();
147 free_page(current->thread.temp_stack);
148 set_cmdline("(kernel thread)");
149
150 change_sig(SIGUSR1, 1);
151 change_sig(SIGPROF, 1);
152 local_irq_enable();
153 if(!run_kernel_thread(fn, arg, &current->thread.exec_buf))
154 do_exit(0);
155
156 /* XXX No set_user_mode here because a newly execed process will
157 * immediately segfault on its non-existent IP, coming straight back
158 * to the signal handler, which will call set_user_mode on its way
159 * out. This should probably change since it's confusing.
160 */
161}
162
163static int new_thread_proc(void *stack)
164{
165 /* local_irq_disable is needed to block out signals until this thread is
166 * properly scheduled. Otherwise, the tracing thread will get mighty
167 * upset about any signals that arrive before that.
168 * This has the complication that it sets the saved signal mask in
169 * the sigcontext to block signals. This gets restored when this
170 * thread (or a descendant, since they get a copy of this sigcontext)
171 * returns to userspace.
172 * So, this is compensated for elsewhere.
173 * XXX There is still a small window until local_irq_disable() actually
174 * finishes where signals are possible - shouldn't be a problem in
175 * practice since SIGIO hasn't been forwarded here yet, and the
176 * local_irq_disable should finish before a SIGVTALRM has time to be
177 * delivered.
178 */
179
180 local_irq_disable();
181 init_new_thread_stack(stack, new_thread_handler);
182 os_usr1_process(os_getpid());
183 change_sig(SIGUSR1, 1);
184 return(0);
185}
186
187/* Signal masking - signals are blocked at the start of fork_tramp. They
188 * are re-enabled when finish_fork_handler is entered by fork_tramp hitting
189 * itself with a SIGUSR1. set_user_mode has to be run with SIGUSR1 off,
190 * so it is blocked before it's called. They are re-enabled on sigreturn
191 * despite the fact that they were blocked when the SIGUSR1 was issued because
192 * copy_thread copies the parent's sigcontext, including the signal mask
193 * onto the signal frame.
194 */
195
196void finish_fork_handler(int sig)
197{
198 UPT_SC(&current->thread.regs.regs) = (void *) (&sig + 1);
199 suspend_new_thread(current->thread.mode.tt.switch_pipe[0]);
200
201 force_flush_all();
202 if(current->thread.prev_sched != NULL)
203 schedule_tail(current->thread.prev_sched);
204 current->thread.prev_sched = NULL;
205
206 enable_timer();
207 change_sig(SIGVTALRM, 1);
208 local_irq_enable();
209 if(current->mm != current->parent->mm)
210 protect_memory(uml_reserved, high_physmem - uml_reserved, 1,
211 1, 0, 1);
212 stack_protections((unsigned long) current_thread);
213
214 free_page(current->thread.temp_stack);
215 local_irq_disable();
216 change_sig(SIGUSR1, 0);
217 set_user_mode(current);
218}
219
220int fork_tramp(void *stack)
221{
222 local_irq_disable();
223 arch_init_thread();
224 init_new_thread_stack(stack, finish_fork_handler);
225
226 os_usr1_process(os_getpid());
227 change_sig(SIGUSR1, 1);
228 return(0);
229}
230
231int copy_thread_tt(int nr, unsigned long clone_flags, unsigned long sp,
232 unsigned long stack_top, struct task_struct * p,
233 struct pt_regs *regs)
234{
235 int (*tramp)(void *);
236 int new_pid, err;
237 unsigned long stack;
238
239 if(current->thread.forking)
240 tramp = fork_tramp;
241 else {
242 tramp = new_thread_proc;
243 p->thread.request.u.thread = current->thread.request.u.thread;
244 }
245
246 err = os_pipe(p->thread.mode.tt.switch_pipe, 1, 1);
247 if(err < 0){
248 printk("copy_thread : pipe failed, err = %d\n", -err);
249 return(err);
250 }
251
252 stack = alloc_stack(0, 0);
253 if(stack == 0){
254 printk(KERN_ERR "copy_thread : failed to allocate "
255 "temporary stack\n");
256 return(-ENOMEM);
257 }
258
259 clone_flags &= CLONE_VM;
260 p->thread.temp_stack = stack;
261 new_pid = start_fork_tramp(task_stack_page(p), stack, clone_flags, tramp);
262 if(new_pid < 0){
263 printk(KERN_ERR "copy_thread : clone failed - errno = %d\n",
264 -new_pid);
265 return(new_pid);
266 }
267
268 if(current->thread.forking){
269 sc_to_sc(UPT_SC(&p->thread.regs.regs), UPT_SC(&regs->regs));
270 SC_SET_SYSCALL_RETURN(UPT_SC(&p->thread.regs.regs), 0);
271 if(sp != 0)
272 SC_SP(UPT_SC(&p->thread.regs.regs)) = sp;
273 }
274 p->thread.mode.tt.extern_pid = new_pid;
275
276 current->thread.request.op = OP_FORK;
277 current->thread.request.u.fork.pid = new_pid;
278 os_usr1_process(os_getpid());
279
280 /* Enable the signal and then disable it to ensure that it is handled
281 * here, and nowhere else.
282 */
283 change_sig(SIGUSR1, 1);
284
285 change_sig(SIGUSR1, 0);
286 err = 0;
287 return(err);
288}
289
290void reboot_tt(void)
291{
292 current->thread.request.op = OP_REBOOT;
293 os_usr1_process(os_getpid());
294 change_sig(SIGUSR1, 1);
295}
296
297void halt_tt(void)
298{
299 current->thread.request.op = OP_HALT;
300 os_usr1_process(os_getpid());
301 change_sig(SIGUSR1, 1);
302}
303
304void kill_off_processes_tt(void)
305{
306 struct task_struct *p;
307 int me;
308
309 me = os_getpid();
310 for_each_process(p){
311 if(p->thread.mode.tt.extern_pid != me)
312 os_kill_process(p->thread.mode.tt.extern_pid, 0);
313 }
314 if(init_task.thread.mode.tt.extern_pid != me)
315 os_kill_process(init_task.thread.mode.tt.extern_pid, 0);
316}
317
318void initial_thread_cb_tt(void (*proc)(void *), void *arg)
319{
320 if(os_getpid() == tracing_pid){
321 (*proc)(arg);
322 }
323 else {
324 current->thread.request.op = OP_CB;
325 current->thread.request.u.cb.proc = proc;
326 current->thread.request.u.cb.arg = arg;
327 os_usr1_process(os_getpid());
328 change_sig(SIGUSR1, 1);
329
330 change_sig(SIGUSR1, 0);
331 }
332}
333
334int do_proc_op(void *t, int proc_id)
335{
336 struct task_struct *task;
337 struct thread_struct *thread;
338 int op, pid;
339
340 task = t;
341 thread = &task->thread;
342 op = thread->request.op;
343 switch(op){
344 case OP_NONE:
345 case OP_TRACE_ON:
346 break;
347 case OP_EXEC:
348 pid = thread->request.u.exec.pid;
349 do_exec(thread->mode.tt.extern_pid, pid);
350 thread->mode.tt.extern_pid = pid;
351 cpu_tasks[task_thread_info(task)->cpu].pid = pid;
352 break;
353 case OP_FORK:
354 attach_process(thread->request.u.fork.pid);
355 break;
356 case OP_CB:
357 (*thread->request.u.cb.proc)(thread->request.u.cb.arg);
358 break;
359 case OP_REBOOT:
360 case OP_HALT:
361 break;
362 default:
363 tracer_panic("Bad op in do_proc_op");
364 break;
365 }
366 thread->request.op = OP_NONE;
367 return(op);
368}
369
370void init_idle_tt(void)
371{
372 default_idle();
373}
374
375extern void start_kernel(void);
376
377static int start_kernel_proc(void *unused)
378{
379 int pid;
380
381 block_signals();
382 pid = os_getpid();
383
384 cpu_tasks[0].pid = pid;
385 cpu_tasks[0].task = current;
386#ifdef CONFIG_SMP
387 cpu_online_map = cpumask_of_cpu(0);
388#endif
389 if(debug) os_stop_process(pid);
390 start_kernel();
391 return(0);
392}
393
394void set_tracing(void *task, int tracing)
395{
396 ((struct task_struct *) task)->thread.mode.tt.tracing = tracing;
397}
398
399int is_tracing(void *t)
400{
401 return (((struct task_struct *) t)->thread.mode.tt.tracing);
402}
403
404int set_user_mode(void *t)
405{
406 struct task_struct *task;
407
408 task = t ? t : current;
409 if(task->thread.mode.tt.tracing)
410 return(1);
411 task->thread.request.op = OP_TRACE_ON;
412 os_usr1_process(os_getpid());
413 return(0);
414}
415
416void set_init_pid(int pid)
417{
418 int err;
419
420 init_task.thread.mode.tt.extern_pid = pid;
421 err = os_pipe(init_task.thread.mode.tt.switch_pipe, 1, 1);
422 if(err)
423 panic("Can't create switch pipe for init_task, errno = %d",
424 -err);
425}
426
427int start_uml_tt(void)
428{
429 void *sp;
430 int pages;
431
432 pages = (1 << CONFIG_KERNEL_STACK_ORDER);
433 sp = task_stack_page(&init_task) +
434 pages * PAGE_SIZE - sizeof(unsigned long);
435 return(tracer(start_kernel_proc, sp));
436}
437
438int external_pid_tt(struct task_struct *task)
439{
440 return(task->thread.mode.tt.extern_pid);
441}
442
443int thread_pid_tt(struct task_struct *task)
444{
445 return(task->thread.mode.tt.extern_pid);
446}
447
448int is_valid_pid(int pid)
449{
450 struct task_struct *task;
451
452 read_lock(&tasklist_lock);
453 for_each_process(task){
454 if(task->thread.mode.tt.extern_pid == pid){
455 read_unlock(&tasklist_lock);
456 return(1);
457 }
458 }
459 read_unlock(&tasklist_lock);
460 return(0);
461}
diff --git a/arch/um/kernel/tt/ptproxy/Makefile b/arch/um/kernel/tt/ptproxy/Makefile
deleted file mode 100644
index 3ad5b774de59..000000000000
--- a/arch/um/kernel/tt/ptproxy/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
1#
2# Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3# Licensed under the GPL
4#
5
6obj-y = proxy.o ptrace.o sysdep.o wait.o
7
8USER_OBJS := $(obj-y)
9
10include arch/um/scripts/Makefile.rules
diff --git a/arch/um/kernel/tt/ptproxy/proxy.c b/arch/um/kernel/tt/ptproxy/proxy.c
deleted file mode 100644
index 420c23f311f3..000000000000
--- a/arch/um/kernel/tt/ptproxy/proxy.c
+++ /dev/null
@@ -1,377 +0,0 @@
1/**********************************************************************
2proxy.c
3
4Copyright (C) 1999 Lars Brinkhoff. See the file COPYING for licensing
5terms and conditions.
6
7Jeff Dike (jdike@karaya.com) : Modified for integration into uml
8**********************************************************************/
9
10/* XXX This file shouldn't refer to CONFIG_* */
11
12#include <errno.h>
13#include <stdio.h>
14#include <stdlib.h>
15#include <unistd.h>
16#include <signal.h>
17#include <string.h>
18#include <termios.h>
19#include <sys/wait.h>
20#include <sys/types.h>
21#include <sys/ioctl.h>
22#include <asm/unistd.h>
23#include "ptrace_user.h"
24
25#include "ptproxy.h"
26#include "sysdep.h"
27#include "wait.h"
28
29#include "user.h"
30#include "os.h"
31#include "tempfile.h"
32
33static int debugger_wait(debugger_state *debugger, int *status, int options,
34 int (*syscall)(debugger_state *debugger, pid_t child),
35 int (*normal_return)(debugger_state *debugger,
36 pid_t unused),
37 int (*wait_return)(debugger_state *debugger,
38 pid_t unused))
39{
40 if(debugger->real_wait){
41 debugger->handle_trace = normal_return;
42 syscall_continue(debugger->pid);
43 debugger->real_wait = 0;
44 return(1);
45 }
46 debugger->wait_status_ptr = status;
47 debugger->wait_options = options;
48 if((debugger->debugee != NULL) && debugger->debugee->event){
49 syscall_continue(debugger->pid);
50 wait_for_stop(debugger->pid, SIGTRAP, PTRACE_SYSCALL,
51 NULL);
52 (*wait_return)(debugger, -1);
53 return(0);
54 }
55 else if(debugger->wait_options & WNOHANG){
56 syscall_cancel(debugger->pid, 0);
57 debugger->handle_trace = syscall;
58 return(0);
59 }
60 else {
61 syscall_pause(debugger->pid);
62 debugger->handle_trace = wait_return;
63 debugger->waiting = 1;
64 }
65 return(1);
66}
67
68/*
69 * Handle debugger trap, i.e. syscall.
70 */
71
72int debugger_syscall(debugger_state *debugger, pid_t child)
73{
74 long arg1, arg2, arg3, arg4, arg5, result;
75 int syscall, ret = 0;
76
77 syscall = get_syscall(debugger->pid, &arg1, &arg2, &arg3, &arg4,
78 &arg5);
79
80 switch(syscall){
81 case __NR_execve:
82 /* execve never returns */
83 debugger->handle_trace = debugger_syscall;
84 break;
85
86 case __NR_ptrace:
87 if(debugger->debugee->pid != 0) arg2 = debugger->debugee->pid;
88 if(!debugger->debugee->in_context)
89 child = debugger->debugee->pid;
90 result = proxy_ptrace(debugger, arg1, arg2, arg3, arg4, child,
91 &ret);
92 syscall_cancel(debugger->pid, result);
93 debugger->handle_trace = debugger_syscall;
94 return(ret);
95
96#ifdef __NR_waitpid
97 case __NR_waitpid:
98#endif
99 case __NR_wait4:
100 if(!debugger_wait(debugger, (int *) arg2, arg3,
101 debugger_syscall, debugger_normal_return,
102 proxy_wait_return))
103 return(0);
104 break;
105
106 case __NR_kill:
107 if(!debugger->debugee->in_context)
108 child = debugger->debugee->pid;
109 if(arg1 == debugger->debugee->pid){
110 result = kill(child, arg2);
111 syscall_cancel(debugger->pid, result);
112 debugger->handle_trace = debugger_syscall;
113 return(0);
114 }
115 else debugger->handle_trace = debugger_normal_return;
116 break;
117
118 default:
119 debugger->handle_trace = debugger_normal_return;
120 }
121
122 syscall_continue(debugger->pid);
123 return(0);
124}
125
126/* Used by the tracing thread */
127static debugger_state parent;
128static int parent_syscall(debugger_state *debugger, int pid);
129
130int init_parent_proxy(int pid)
131{
132 parent = ((debugger_state) { .pid = pid,
133 .wait_options = 0,
134 .wait_status_ptr = NULL,
135 .waiting = 0,
136 .real_wait = 0,
137 .expecting_child = 0,
138 .handle_trace = parent_syscall,
139 .debugee = NULL } );
140 return(0);
141}
142
143int parent_normal_return(debugger_state *debugger, pid_t unused)
144{
145 debugger->handle_trace = parent_syscall;
146 syscall_continue(debugger->pid);
147 return(0);
148}
149
150static int parent_syscall(debugger_state *debugger, int pid)
151{
152 long arg1, arg2, arg3, arg4, arg5;
153 int syscall;
154
155 syscall = get_syscall(pid, &arg1, &arg2, &arg3, &arg4, &arg5);
156
157 if((syscall == __NR_wait4)
158#ifdef __NR_waitpid
159 || (syscall == __NR_waitpid)
160#endif
161 ){
162 debugger_wait(&parent, (int *) arg2, arg3, parent_syscall,
163 parent_normal_return, parent_wait_return);
164 }
165 else ptrace(PTRACE_SYSCALL, pid, 0, 0);
166 return(0);
167}
168
169int debugger_normal_return(debugger_state *debugger, pid_t unused)
170{
171 debugger->handle_trace = debugger_syscall;
172 syscall_continue(debugger->pid);
173 return(0);
174}
175
176void debugger_cancelled_return(debugger_state *debugger, int result)
177{
178 debugger->handle_trace = debugger_syscall;
179 syscall_set_result(debugger->pid, result);
180 syscall_continue(debugger->pid);
181}
182
183/* Used by the tracing thread */
184static debugger_state debugger;
185static debugee_state debugee;
186
187void init_proxy (pid_t debugger_pid, int stopped, int status)
188{
189 debugger.pid = debugger_pid;
190 debugger.handle_trace = debugger_syscall;
191 debugger.debugee = &debugee;
192 debugger.waiting = 0;
193 debugger.real_wait = 0;
194 debugger.expecting_child = 0;
195
196 debugee.pid = 0;
197 debugee.traced = 0;
198 debugee.stopped = stopped;
199 debugee.event = 0;
200 debugee.zombie = 0;
201 debugee.died = 0;
202 debugee.wait_status = status;
203 debugee.in_context = 1;
204}
205
206int debugger_proxy(int status, int pid)
207{
208 int ret = 0, sig;
209
210 if(WIFSTOPPED(status)){
211 sig = WSTOPSIG(status);
212 if (sig == SIGTRAP)
213 ret = (*debugger.handle_trace)(&debugger, pid);
214
215 else if(sig == SIGCHLD){
216 if(debugger.expecting_child){
217 ptrace(PTRACE_SYSCALL, debugger.pid, 0, sig);
218 debugger.expecting_child = 0;
219 }
220 else if(debugger.waiting)
221 real_wait_return(&debugger);
222 else {
223 ptrace(PTRACE_SYSCALL, debugger.pid, 0, sig);
224 debugger.real_wait = 1;
225 }
226 }
227 else ptrace(PTRACE_SYSCALL, debugger.pid, 0, sig);
228 }
229 else if(WIFEXITED(status)){
230 tracer_panic("debugger (pid %d) exited with status %d",
231 debugger.pid, WEXITSTATUS(status));
232 }
233 else if(WIFSIGNALED(status)){
234 tracer_panic("debugger (pid %d) exited with signal %d",
235 debugger.pid, WTERMSIG(status));
236 }
237 else {
238 tracer_panic("proxy got unknown status (0x%x) on debugger "
239 "(pid %d)", status, debugger.pid);
240 }
241 return(ret);
242}
243
244void child_proxy(pid_t pid, int status)
245{
246 debugee.event = 1;
247 debugee.wait_status = status;
248
249 if(WIFSTOPPED(status)){
250 debugee.stopped = 1;
251 debugger.expecting_child = 1;
252 kill(debugger.pid, SIGCHLD);
253 }
254 else if(WIFEXITED(status) || WIFSIGNALED(status)){
255 debugee.zombie = 1;
256 debugger.expecting_child = 1;
257 kill(debugger.pid, SIGCHLD);
258 }
259 else panic("proxy got unknown status (0x%x) on child (pid %d)",
260 status, pid);
261}
262
263void debugger_parent_signal(int status, int pid)
264{
265 int sig;
266
267 if(WIFSTOPPED(status)){
268 sig = WSTOPSIG(status);
269 if(sig == SIGTRAP) (*parent.handle_trace)(&parent, pid);
270 else ptrace(PTRACE_SYSCALL, pid, 0, sig);
271 }
272}
273
274void fake_child_exit(void)
275{
276 int status, pid;
277
278 child_proxy(1, W_EXITCODE(0, 0));
279 while(debugger.waiting == 1){
280 CATCH_EINTR(pid = waitpid(debugger.pid, &status, WUNTRACED));
281 if(pid != debugger.pid){
282 printk("fake_child_exit - waitpid failed, "
283 "errno = %d\n", errno);
284 return;
285 }
286 debugger_proxy(status, debugger.pid);
287 }
288 CATCH_EINTR(pid = waitpid(debugger.pid, &status, WUNTRACED));
289 if(pid != debugger.pid){
290 printk("fake_child_exit - waitpid failed, "
291 "errno = %d\n", errno);
292 return;
293 }
294 if(ptrace(PTRACE_DETACH, debugger.pid, 0, SIGCONT) < 0)
295 printk("fake_child_exit - PTRACE_DETACH failed, errno = %d\n",
296 errno);
297}
298
299char gdb_init_string[] =
300"att 1 \n\
301b panic \n\
302b stop \n\
303handle SIGWINCH nostop noprint pass \n\
304";
305
306int start_debugger(char *prog, int startup, int stop, int *fd_out)
307{
308 int slave, child;
309
310 slave = open_gdb_chan();
311 child = fork();
312 if(child == 0){
313 char *tempname = NULL;
314 int fd;
315
316 if(setsid() < 0) perror("setsid");
317 if((dup2(slave, 0) < 0) || (dup2(slave, 1) < 0) ||
318 (dup2(slave, 2) < 0)){
319 printk("start_debugger : dup2 failed, errno = %d\n",
320 errno);
321 exit(1);
322 }
323 if(ioctl(0, TIOCSCTTY, 0) < 0){
324 printk("start_debugger : TIOCSCTTY failed, "
325 "errno = %d\n", errno);
326 exit(1);
327 }
328 if(tcsetpgrp (1, os_getpid()) < 0){
329 printk("start_debugger : tcsetpgrp failed, "
330 "errno = %d\n", errno);
331#ifdef notdef
332 exit(1);
333#endif
334 }
335 fd = make_tempfile("/tmp/gdb_init-XXXXXX", &tempname, 0);
336 if(fd < 0){
337 printk("start_debugger : make_tempfile failed,"
338 "err = %d\n", -fd);
339 exit(1);
340 }
341 os_write_file(fd, gdb_init_string,
342 sizeof(gdb_init_string) - 1);
343 if(startup){
344 if(stop){
345 os_write_file(fd, "b start_kernel\n",
346 strlen("b start_kernel\n"));
347 }
348 os_write_file(fd, "c\n", strlen("c\n"));
349 }
350 if(ptrace(PTRACE_TRACEME, 0, 0, 0) < 0){
351 printk("start_debugger : PTRACE_TRACEME failed, "
352 "errno = %d\n", errno);
353 exit(1);
354 }
355 execlp("gdb", "gdb", "--command", tempname, prog, NULL);
356 printk("start_debugger : exec of gdb failed, errno = %d\n",
357 errno);
358 }
359 if(child < 0){
360 printk("start_debugger : fork for gdb failed, errno = %d\n",
361 errno);
362 return(-1);
363 }
364 *fd_out = slave;
365 return(child);
366}
367
368/*
369 * Overrides for Emacs so that we follow Linus's tabbing style.
370 * Emacs will notice this stuff at the end of the file and automatically
371 * adjust the settings for this buffer only. This must remain at the end
372 * of the file.
373 * ---------------------------------------------------------------------------
374 * Local variables:
375 * c-file-style: "linux"
376 * End:
377 */
diff --git a/arch/um/kernel/tt/ptproxy/ptproxy.h b/arch/um/kernel/tt/ptproxy/ptproxy.h
deleted file mode 100644
index 5eb0285b1968..000000000000
--- a/arch/um/kernel/tt/ptproxy/ptproxy.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/**********************************************************************
2ptproxy.h
3
4Copyright (C) 1999 Lars Brinkhoff. See the file COPYING for licensing
5terms and conditions.
6**********************************************************************/
7
8#ifndef __PTPROXY_H
9#define __PTPROXY_H
10
11#include <sys/types.h>
12
13typedef struct debugger debugger_state;
14typedef struct debugee debugee_state;
15
16struct debugger
17{
18 pid_t pid;
19 int wait_options;
20 int *wait_status_ptr;
21 unsigned int waiting : 1;
22 unsigned int real_wait : 1;
23 unsigned int expecting_child : 1;
24 int (*handle_trace) (debugger_state *, pid_t);
25
26 debugee_state *debugee;
27};
28
29struct debugee
30{
31 pid_t pid;
32 int wait_status;
33 unsigned int died : 1;
34 unsigned int event : 1;
35 unsigned int stopped : 1;
36 unsigned int trace_singlestep : 1;
37 unsigned int trace_syscall : 1;
38 unsigned int traced : 1;
39 unsigned int zombie : 1;
40 unsigned int in_context : 1;
41};
42
43extern int debugger_syscall(debugger_state *debugger, pid_t pid);
44extern int debugger_normal_return (debugger_state *debugger, pid_t unused);
45
46extern long proxy_ptrace (struct debugger *, int, pid_t, long, long, pid_t,
47 int *strace_out);
48extern void debugger_cancelled_return(debugger_state *debugger, int result);
49
50#endif
51
52/*
53 * Overrides for Emacs so that we follow Linus's tabbing style.
54 * Emacs will notice this stuff at the end of the file and automatically
55 * adjust the settings for this buffer only. This must remain at the end
56 * of the file.
57 * ---------------------------------------------------------------------------
58 * Local variables:
59 * c-file-style: "linux"
60 * End:
61 */
diff --git a/arch/um/kernel/tt/ptproxy/ptrace.c b/arch/um/kernel/tt/ptproxy/ptrace.c
deleted file mode 100644
index 4b4f6179b212..000000000000
--- a/arch/um/kernel/tt/ptproxy/ptrace.c
+++ /dev/null
@@ -1,237 +0,0 @@
1/**********************************************************************
2ptrace.c
3
4Copyright (C) 1999 Lars Brinkhoff. See the file COPYING for licensing
5terms and conditions.
6
7Jeff Dike (jdike@karaya.com) : Modified for integration into uml
8**********************************************************************/
9
10#include <errno.h>
11#include <unistd.h>
12#include <signal.h>
13#include <sys/types.h>
14#include <sys/time.h>
15#include <sys/wait.h>
16
17#include "ptproxy.h"
18#include "debug.h"
19#include "kern_util.h"
20#include "ptrace_user.h"
21#include "tt.h"
22#include "os.h"
23
24long proxy_ptrace(struct debugger *debugger, int arg1, pid_t arg2,
25 long arg3, long arg4, pid_t child, int *ret)
26{
27 sigset_t relay;
28 long result;
29 int status;
30
31 *ret = 0;
32 if(debugger->debugee->died) return(-ESRCH);
33
34 switch(arg1){
35 case PTRACE_ATTACH:
36 if(debugger->debugee->traced) return(-EPERM);
37
38 debugger->debugee->pid = arg2;
39 debugger->debugee->traced = 1;
40
41 if(is_valid_pid(arg2) && (arg2 != child)){
42 debugger->debugee->in_context = 0;
43 kill(arg2, SIGSTOP);
44 debugger->debugee->event = 1;
45 debugger->debugee->wait_status = W_STOPCODE(SIGSTOP);
46 }
47 else {
48 debugger->debugee->in_context = 1;
49 if(debugger->debugee->stopped)
50 child_proxy(child, W_STOPCODE(SIGSTOP));
51 else kill(child, SIGSTOP);
52 }
53
54 return(0);
55
56 case PTRACE_DETACH:
57 if(!debugger->debugee->traced) return(-EPERM);
58
59 debugger->debugee->traced = 0;
60 debugger->debugee->pid = 0;
61 if(!debugger->debugee->in_context)
62 kill(child, SIGCONT);
63
64 return(0);
65
66 case PTRACE_CONT:
67 if(!debugger->debugee->in_context) return(-EPERM);
68 *ret = PTRACE_CONT;
69 return(ptrace(PTRACE_CONT, child, arg3, arg4));
70
71#ifdef UM_HAVE_GETFPREGS
72 case PTRACE_GETFPREGS:
73 {
74 long regs[FP_FRAME_SIZE];
75 int i, result;
76
77 result = ptrace(PTRACE_GETFPREGS, child, 0, regs);
78 if(result == -1) return(-errno);
79
80 for (i = 0; i < sizeof(regs)/sizeof(regs[0]); i++)
81 ptrace(PTRACE_POKEDATA, debugger->pid, arg4 + 4 * i,
82 regs[i]);
83 return(result);
84 }
85#endif
86
87#ifdef UM_HAVE_GETFPXREGS
88 case PTRACE_GETFPXREGS:
89 {
90 long regs[FPX_FRAME_SIZE];
91 int i, result;
92
93 result = ptrace(PTRACE_GETFPXREGS, child, 0, regs);
94 if(result == -1) return(-errno);
95
96 for (i = 0; i < sizeof(regs)/sizeof(regs[0]); i++)
97 ptrace(PTRACE_POKEDATA, debugger->pid, arg4 + 4 * i,
98 regs[i]);
99 return(result);
100 }
101#endif
102
103#ifdef UM_HAVE_GETREGS
104 case PTRACE_GETREGS:
105 {
106 long regs[FRAME_SIZE];
107 int i, result;
108
109 result = ptrace(PTRACE_GETREGS, child, 0, regs);
110 if(result == -1) return(-errno);
111
112 for (i = 0; i < sizeof(regs)/sizeof(regs[0]); i++)
113 ptrace (PTRACE_POKEDATA, debugger->pid,
114 arg4 + 4 * i, regs[i]);
115 return(result);
116 }
117 break;
118#endif
119
120 case PTRACE_KILL:
121 result = ptrace(PTRACE_KILL, child, arg3, arg4);
122 if(result == -1) return(-errno);
123
124 return(result);
125
126 case PTRACE_PEEKDATA:
127 case PTRACE_PEEKTEXT:
128 case PTRACE_PEEKUSR:
129 /* The value being read out could be -1, so we have to
130 * check errno to see if there's an error, and zero it
131 * beforehand so we're not faked out by an old error
132 */
133
134 errno = 0;
135 result = ptrace(arg1, child, arg3, 0);
136 if((result == -1) && (errno != 0)) return(-errno);
137
138 result = ptrace(PTRACE_POKEDATA, debugger->pid, arg4, result);
139 if(result == -1) return(-errno);
140
141 return(result);
142
143 case PTRACE_POKEDATA:
144 case PTRACE_POKETEXT:
145 case PTRACE_POKEUSR:
146 result = ptrace(arg1, child, arg3, arg4);
147 if(result == -1) return(-errno);
148
149 if(arg1 == PTRACE_POKEUSR) ptrace_pokeuser(arg3, arg4);
150 return(result);
151
152#ifdef UM_HAVE_SETFPREGS
153 case PTRACE_SETFPREGS:
154 {
155 long regs[FP_FRAME_SIZE];
156 int i;
157
158 for (i = 0; i < sizeof(regs)/sizeof(regs[0]); i++)
159 regs[i] = ptrace (PTRACE_PEEKDATA, debugger->pid,
160 arg4 + 4 * i, 0);
161 result = ptrace(PTRACE_SETFPREGS, child, 0, regs);
162 if(result == -1) return(-errno);
163
164 return(result);
165 }
166#endif
167
168#ifdef UM_HAVE_SETFPXREGS
169 case PTRACE_SETFPXREGS:
170 {
171 long regs[FPX_FRAME_SIZE];
172 int i;
173
174 for (i = 0; i < sizeof(regs)/sizeof(regs[0]); i++)
175 regs[i] = ptrace (PTRACE_PEEKDATA, debugger->pid,
176 arg4 + 4 * i, 0);
177 result = ptrace(PTRACE_SETFPXREGS, child, 0, regs);
178 if(result == -1) return(-errno);
179
180 return(result);
181 }
182#endif
183
184#ifdef UM_HAVE_SETREGS
185 case PTRACE_SETREGS:
186 {
187 long regs[FRAME_SIZE];
188 int i;
189
190 for (i = 0; i < sizeof(regs)/sizeof(regs[0]); i++)
191 regs[i] = ptrace(PTRACE_PEEKDATA, debugger->pid,
192 arg4 + 4 * i, 0);
193 result = ptrace(PTRACE_SETREGS, child, 0, regs);
194 if(result == -1) return(-errno);
195
196 return(result);
197 }
198#endif
199
200 case PTRACE_SINGLESTEP:
201 if(!debugger->debugee->in_context) return(-EPERM);
202 sigemptyset(&relay);
203 sigaddset(&relay, SIGSEGV);
204 sigaddset(&relay, SIGILL);
205 sigaddset(&relay, SIGBUS);
206 result = ptrace(PTRACE_SINGLESTEP, child, arg3, arg4);
207 if(result == -1) return(-errno);
208
209 status = wait_for_stop(child, SIGTRAP, PTRACE_SINGLESTEP,
210 &relay);
211 child_proxy(child, status);
212 return(result);
213
214 case PTRACE_SYSCALL:
215 if(!debugger->debugee->in_context) return(-EPERM);
216 result = ptrace(PTRACE_SYSCALL, child, arg3, arg4);
217 if(result == -1) return(-errno);
218
219 *ret = PTRACE_SYSCALL;
220 return(result);
221
222 case PTRACE_TRACEME:
223 default:
224 return(-EINVAL);
225 }
226}
227
228/*
229 * Overrides for Emacs so that we follow Linus's tabbing style.
230 * Emacs will notice this stuff at the end of the file and automatically
231 * adjust the settings for this buffer only. This must remain at the end
232 * of the file.
233 * ---------------------------------------------------------------------------
234 * Local variables:
235 * c-file-style: "linux"
236 * End:
237 */
diff --git a/arch/um/kernel/tt/ptproxy/sysdep.c b/arch/um/kernel/tt/ptproxy/sysdep.c
deleted file mode 100644
index e0e1ab0588ad..000000000000
--- a/arch/um/kernel/tt/ptproxy/sysdep.c
+++ /dev/null
@@ -1,70 +0,0 @@
1/**********************************************************************
2sysdep.c
3
4Copyright (C) 1999 Lars Brinkhoff. See the file COPYING for licensing
5terms and conditions.
6**********************************************************************/
7
8#include <stdio.h>
9#include <string.h>
10#include <stdlib.h>
11#include <signal.h>
12#include <errno.h>
13#include <sys/types.h>
14#include <linux/unistd.h>
15#include "ptrace_user.h"
16#include "user.h"
17#include "os.h"
18
19int get_syscall(pid_t pid, long *arg1, long *arg2, long *arg3, long *arg4,
20 long *arg5)
21{
22 *arg1 = ptrace(PTRACE_PEEKUSR, pid, PT_SYSCALL_ARG1_OFFSET, 0);
23 *arg2 = ptrace(PTRACE_PEEKUSR, pid, PT_SYSCALL_ARG2_OFFSET, 0);
24 *arg3 = ptrace(PTRACE_PEEKUSR, pid, PT_SYSCALL_ARG3_OFFSET, 0);
25 *arg4 = ptrace(PTRACE_PEEKUSR, pid, PT_SYSCALL_ARG4_OFFSET, 0);
26 *arg5 = ptrace(PTRACE_PEEKUSR, pid, PT_SYSCALL_ARG5_OFFSET, 0);
27 return(ptrace(PTRACE_PEEKUSR, pid, PT_SYSCALL_NR_OFFSET, 0));
28}
29
30void syscall_cancel(pid_t pid, int result)
31{
32 if((ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_NR_OFFSET,
33 __NR_getpid) < 0) ||
34 (ptrace(PTRACE_SYSCALL, pid, 0, 0) < 0) ||
35 (wait_for_stop(pid, SIGTRAP, PTRACE_SYSCALL, NULL) < 0) ||
36 (ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, result) < 0) ||
37 (ptrace(PTRACE_SYSCALL, pid, 0, 0) < 0))
38 printk("ptproxy: couldn't cancel syscall: errno = %d\n",
39 errno);
40}
41
42void syscall_set_result(pid_t pid, long result)
43{
44 ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, result);
45}
46
47void syscall_continue(pid_t pid)
48{
49 ptrace(PTRACE_SYSCALL, pid, 0, 0);
50}
51
52int syscall_pause(pid_t pid)
53{
54 if(ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_NR_OFFSET, __NR_pause) < 0){
55 printk("syscall_change - ptrace failed, errno = %d\n", errno);
56 return(-1);
57 }
58 return(0);
59}
60
61/*
62 * Overrides for Emacs so that we follow Linus's tabbing style.
63 * Emacs will notice this stuff at the end of the file and automatically
64 * adjust the settings for this buffer only. This must remain at the end
65 * of the file.
66 * ---------------------------------------------------------------------------
67 * Local variables:
68 * c-file-style: "linux"
69 * End:
70 */
diff --git a/arch/um/kernel/tt/ptproxy/sysdep.h b/arch/um/kernel/tt/ptproxy/sysdep.h
deleted file mode 100644
index 735f488049aa..000000000000
--- a/arch/um/kernel/tt/ptproxy/sysdep.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/**********************************************************************
2sysdep.h
3
4Copyright (C) 1999 Lars Brinkhoff.
5Copyright (C) 2001 Jeff Dike (jdike@karaya.com)
6See the file COPYING for licensing terms and conditions.
7**********************************************************************/
8
9extern int get_syscall(pid_t pid, long *arg1, long *arg2, long *arg3,
10 long *arg4, long *arg5);
11extern void syscall_cancel (pid_t pid, long result);
12extern void syscall_set_result (pid_t pid, long result);
13extern void syscall_continue (pid_t pid);
14extern int syscall_pause(pid_t pid);
15
16/*
17 * Overrides for Emacs so that we follow Linus's tabbing style.
18 * Emacs will notice this stuff at the end of the file and automatically
19 * adjust the settings for this buffer only. This must remain at the end
20 * of the file.
21 * ---------------------------------------------------------------------------
22 * Local variables:
23 * c-file-style: "linux"
24 * End:
25 */
diff --git a/arch/um/kernel/tt/ptproxy/wait.c b/arch/um/kernel/tt/ptproxy/wait.c
deleted file mode 100644
index bdd4af4b65fc..000000000000
--- a/arch/um/kernel/tt/ptproxy/wait.c
+++ /dev/null
@@ -1,85 +0,0 @@
1/**********************************************************************
2wait.c
3
4Copyright (C) 1999 Lars Brinkhoff. See the file COPYING for licensing
5terms and conditions.
6
7**********************************************************************/
8
9#include <errno.h>
10#include <signal.h>
11#include <sys/wait.h>
12
13#include "ptproxy.h"
14#include "sysdep.h"
15#include "wait.h"
16#include "ptrace_user.h"
17#include "sysdep/ptrace.h"
18#include "sysdep/sigcontext.h"
19
20int proxy_wait_return(struct debugger *debugger, pid_t unused)
21{
22 debugger->waiting = 0;
23
24 if(debugger->debugee->died || (debugger->wait_options & __WCLONE)){
25 debugger_cancelled_return(debugger, -ECHILD);
26 return(0);
27 }
28
29 if(debugger->debugee->zombie && debugger->debugee->event)
30 debugger->debugee->died = 1;
31
32 if(debugger->debugee->event){
33 debugger->debugee->event = 0;
34 ptrace(PTRACE_POKEDATA, debugger->pid,
35 debugger->wait_status_ptr,
36 debugger->debugee->wait_status);
37 /* if (wait4)
38 ptrace (PTRACE_POKEDATA, pid, rusage_ptr, ...); */
39 debugger_cancelled_return(debugger, debugger->debugee->pid);
40 return(0);
41 }
42
43 /* pause will return -EINTR, which happens to be right for wait */
44 debugger_normal_return(debugger, -1);
45 return(0);
46}
47
48int parent_wait_return(struct debugger *debugger, pid_t unused)
49{
50 return(debugger_normal_return(debugger, -1));
51}
52
53int real_wait_return(struct debugger *debugger)
54{
55 unsigned long ip;
56 int pid;
57
58 pid = debugger->pid;
59
60 ip = ptrace(PTRACE_PEEKUSR, pid, PT_IP_OFFSET, 0);
61 IP_RESTART_SYSCALL(ip);
62
63 if(ptrace(PTRACE_POKEUSR, pid, PT_IP_OFFSET, ip) < 0)
64 tracer_panic("real_wait_return : Failed to restart system "
65 "call, errno = %d\n", errno);
66
67 if((ptrace(PTRACE_SYSCALL, debugger->pid, 0, SIGCHLD) < 0) ||
68 (ptrace(PTRACE_SYSCALL, debugger->pid, 0, 0) < 0) ||
69 (ptrace(PTRACE_SYSCALL, debugger->pid, 0, 0) < 0) ||
70 debugger_normal_return(debugger, -1))
71 tracer_panic("real_wait_return : gdb failed to wait, "
72 "errno = %d\n", errno);
73 return(0);
74}
75
76/*
77 * Overrides for Emacs so that we follow Linus's tabbing style.
78 * Emacs will notice this stuff at the end of the file and automatically
79 * adjust the settings for this buffer only. This must remain at the end
80 * of the file.
81 * ---------------------------------------------------------------------------
82 * Local variables:
83 * c-file-style: "linux"
84 * End:
85 */
diff --git a/arch/um/kernel/tt/ptproxy/wait.h b/arch/um/kernel/tt/ptproxy/wait.h
deleted file mode 100644
index 542e73ee2cee..000000000000
--- a/arch/um/kernel/tt/ptproxy/wait.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/**********************************************************************
2wait.h
3
4Copyright (C) 1999 Lars Brinkhoff. See the file COPYING for licensing
5terms and conditions.
6**********************************************************************/
7
8#ifndef __PTPROXY_WAIT_H
9#define __PTPROXY_WAIT_H
10
11extern int proxy_wait_return(struct debugger *debugger, pid_t unused);
12extern int real_wait_return(struct debugger *debugger);
13extern int parent_wait_return(struct debugger *debugger, pid_t unused);
14
15#endif
diff --git a/arch/um/kernel/tt/syscall_kern.c b/arch/um/kernel/tt/syscall_kern.c
deleted file mode 100644
index 293caa6d0c2d..000000000000
--- a/arch/um/kernel/tt/syscall_kern.c
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5
6#include "linux/types.h"
7#include "linux/utime.h"
8#include "linux/sys.h"
9#include "linux/ptrace.h"
10#include "asm/unistd.h"
11#include "asm/ptrace.h"
12#include "asm/uaccess.h"
13#include "asm/stat.h"
14#include "sysdep/syscalls.h"
15#include "sysdep/sigcontext.h"
16#include "kern_util.h"
17#include "syscall.h"
18
19void syscall_handler_tt(int sig, struct pt_regs *regs)
20{
21 void *sc;
22 long result;
23 int syscall;
24
25 sc = UPT_SC(&regs->regs);
26 SC_START_SYSCALL(sc);
27
28 syscall = UPT_SYSCALL_NR(&regs->regs);
29 syscall_trace(&regs->regs, 0);
30
31 current->thread.nsyscalls++;
32 nsyscalls++;
33
34 if((syscall >= NR_syscalls) || (syscall < 0))
35 result = -ENOSYS;
36 else result = EXECUTE_SYSCALL(syscall, regs);
37
38 /* regs->sc may have changed while the system call ran (there may
39 * have been an interrupt or segfault), so it needs to be refreshed.
40 */
41 UPT_SC(&regs->regs) = sc;
42
43 SC_SET_SYSCALL_RETURN(sc, result);
44
45 syscall_trace(&regs->regs, 1);
46}
diff --git a/arch/um/kernel/tt/syscall_user.c b/arch/um/kernel/tt/syscall_user.c
deleted file mode 100644
index f52b47aff1d2..000000000000
--- a/arch/um/kernel/tt/syscall_user.c
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <unistd.h>
7#include <signal.h>
8#include <errno.h>
9#include <asm/unistd.h>
10#include "sysdep/ptrace.h"
11#include "sigcontext.h"
12#include "ptrace_user.h"
13#include "task.h"
14#include "kern_util.h"
15#include "syscall.h"
16#include "tt.h"
17
18void do_sigtrap(void *task)
19{
20 UPT_SYSCALL_NR(TASK_REGS(task)) = -1;
21}
22
23void do_syscall(void *task, int pid, int local_using_sysemu)
24{
25 unsigned long proc_regs[FRAME_SIZE];
26
27 if(ptrace_getregs(pid, proc_regs) < 0)
28 tracer_panic("Couldn't read registers");
29
30 UPT_SYSCALL_NR(TASK_REGS(task)) = PT_SYSCALL_NR(proc_regs);
31
32#ifdef UPT_ORIGGPR2
33 UPT_ORIGGPR2(TASK_REGS(task)) = REGS_ORIGGPR2(proc_regs);
34#endif
35
36 if(((unsigned long *) PT_IP(proc_regs) >= &_stext) &&
37 ((unsigned long *) PT_IP(proc_regs) <= &_etext))
38 tracer_panic("I'm tracing myself and I can't get out");
39
40 /* advanced sysemu mode set syscall number to -1 automatically */
41 if (local_using_sysemu==2)
42 return;
43
44 /* syscall number -1 in sysemu skips syscall restarting in host */
45 if(ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_NR_OFFSET,
46 local_using_sysemu ? -1 : __NR_getpid) < 0)
47 tracer_panic("do_syscall : Nullifying syscall failed, "
48 "errno = %d", errno);
49}
50
51/*
52 * Overrides for Emacs so that we follow Linus's tabbing style.
53 * Emacs will notice this stuff at the end of the file and automatically
54 * adjust the settings for this buffer only. This must remain at the end
55 * of the file.
56 * ---------------------------------------------------------------------------
57 * Local variables:
58 * c-file-style: "linux"
59 * End:
60 */
diff --git a/arch/um/kernel/tt/tlb.c b/arch/um/kernel/tt/tlb.c
deleted file mode 100644
index 7caa24fe05df..000000000000
--- a/arch/um/kernel/tt/tlb.c
+++ /dev/null
@@ -1,120 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Copyright 2003 PathScale, Inc.
4 * Licensed under the GPL
5 */
6
7#include "linux/stddef.h"
8#include "linux/kernel.h"
9#include "linux/sched.h"
10#include "linux/mm.h"
11#include "asm/page.h"
12#include "asm/pgtable.h"
13#include "asm/uaccess.h"
14#include "asm/tlbflush.h"
15#include "mem_user.h"
16#include "os.h"
17#include "tlb.h"
18
19static int do_ops(union mm_context *mmu, struct host_vm_op *ops, int last,
20 int finished, void **flush)
21{
22 struct host_vm_op *op;
23 int i, ret=0;
24
25 for(i = 0; i <= last && !ret; i++){
26 op = &ops[i];
27 switch(op->type){
28 case MMAP:
29 ret = os_map_memory((void *) op->u.mmap.addr,
30 op->u.mmap.fd, op->u.mmap.offset,
31 op->u.mmap.len, op->u.mmap.r,
32 op->u.mmap.w, op->u.mmap.x);
33 break;
34 case MUNMAP:
35 ret = os_unmap_memory((void *) op->u.munmap.addr,
36 op->u.munmap.len);
37 break;
38 case MPROTECT:
39 ret = protect_memory(op->u.mprotect.addr,
40 op->u.munmap.len,
41 op->u.mprotect.r,
42 op->u.mprotect.w,
43 op->u.mprotect.x, 1);
44 protect_memory(op->u.mprotect.addr, op->u.munmap.len,
45 op->u.mprotect.r, op->u.mprotect.w,
46 op->u.mprotect.x, 1);
47 break;
48 default:
49 printk("Unknown op type %d in do_ops\n", op->type);
50 break;
51 }
52 }
53
54 return ret;
55}
56
57static void fix_range(struct mm_struct *mm, unsigned long start_addr,
58 unsigned long end_addr, int force)
59{
60 if((current->thread.mode.tt.extern_pid != -1) &&
61 (current->thread.mode.tt.extern_pid != os_getpid()))
62 panic("fix_range fixing wrong address space, current = 0x%p",
63 current);
64
65 fix_range_common(mm, start_addr, end_addr, force, do_ops);
66}
67
68atomic_t vmchange_seq = ATOMIC_INIT(1);
69
70void flush_tlb_kernel_range_tt(unsigned long start, unsigned long end)
71{
72 if(flush_tlb_kernel_range_common(start, end))
73 atomic_inc(&vmchange_seq);
74}
75
76void flush_tlb_kernel_vm_tt(void)
77{
78 flush_tlb_kernel_range(start_vm, end_vm);
79}
80
81void __flush_tlb_one_tt(unsigned long addr)
82{
83 flush_tlb_kernel_range(addr, addr + PAGE_SIZE);
84}
85
86void flush_tlb_range_tt(struct vm_area_struct *vma, unsigned long start,
87 unsigned long end)
88{
89 if(vma->vm_mm != current->mm) return;
90
91 /* Assumes that the range start ... end is entirely within
92 * either process memory or kernel vm
93 */
94 if((start >= start_vm) && (start < end_vm)){
95 if(flush_tlb_kernel_range_common(start, end))
96 atomic_inc(&vmchange_seq);
97 }
98 else fix_range(vma->vm_mm, start, end, 0);
99}
100
101void flush_tlb_mm_tt(struct mm_struct *mm)
102{
103 unsigned long seq;
104
105 if(mm != current->mm) return;
106
107 fix_range(mm, 0, STACK_TOP, 0);
108
109 seq = atomic_read(&vmchange_seq);
110 if(current->thread.mode.tt.vm_seq == seq)
111 return;
112 current->thread.mode.tt.vm_seq = seq;
113 flush_tlb_kernel_range_common(start_vm, end_vm);
114}
115
116void force_flush_all_tt(void)
117{
118 fix_range(current->mm, 0, STACK_TOP, 1);
119 flush_tlb_kernel_range_common(start_vm, end_vm);
120}
diff --git a/arch/um/kernel/tt/tracer.c b/arch/um/kernel/tt/tracer.c
deleted file mode 100644
index c23588393f6e..000000000000
--- a/arch/um/kernel/tt/tracer.c
+++ /dev/null
@@ -1,461 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <stdio.h>
7#include <stdlib.h>
8#include <stdarg.h>
9#include <unistd.h>
10#include <signal.h>
11#include <errno.h>
12#include <sched.h>
13#include <string.h>
14#include <sys/mman.h>
15#include <sys/time.h>
16#include <sys/wait.h>
17#include "user.h"
18#include "sysdep/ptrace.h"
19#include "sigcontext.h"
20#include "sysdep/sigcontext.h"
21#include "os.h"
22#include "mem_user.h"
23#include "process.h"
24#include "kern_util.h"
25#include "chan_user.h"
26#include "ptrace_user.h"
27#include "irq_user.h"
28#include "mode.h"
29#include "tt.h"
30
31static int tracer_winch[2];
32
33int is_tracer_winch(int pid, int fd, void *data)
34{
35 if(pid != os_getpgrp())
36 return(0);
37
38 register_winch_irq(tracer_winch[0], fd, -1, data);
39 return(1);
40}
41
42static void tracer_winch_handler(int sig)
43{
44 int n;
45 char c = 1;
46
47 n = os_write_file(tracer_winch[1], &c, sizeof(c));
48 if(n != sizeof(c))
49 printk("tracer_winch_handler - write failed, err = %d\n", -n);
50}
51
52/* Called only by the tracing thread during initialization */
53
54static void setup_tracer_winch(void)
55{
56 int err;
57
58 err = os_pipe(tracer_winch, 1, 1);
59 if(err < 0){
60 printk("setup_tracer_winch : os_pipe failed, err = %d\n", -err);
61 return;
62 }
63 signal(SIGWINCH, tracer_winch_handler);
64}
65
66void attach_process(int pid)
67{
68 if((ptrace(PTRACE_ATTACH, pid, 0, 0) < 0) ||
69 (ptrace(PTRACE_CONT, pid, 0, 0) < 0))
70 tracer_panic("OP_FORK failed to attach pid");
71 wait_for_stop(pid, SIGSTOP, PTRACE_CONT, NULL);
72 if (ptrace(PTRACE_OLDSETOPTIONS, pid, 0, (void *)PTRACE_O_TRACESYSGOOD) < 0)
73 tracer_panic("OP_FORK: PTRACE_SETOPTIONS failed, errno = %d", errno);
74 if(ptrace(PTRACE_CONT, pid, 0, 0) < 0)
75 tracer_panic("OP_FORK failed to continue process");
76}
77
78void tracer_panic(char *format, ...)
79{
80 va_list ap;
81
82 va_start(ap, format);
83 vprintf(format, ap);
84 va_end(ap);
85 printf("\n");
86 while(1) pause();
87}
88
89static void tracer_segv(int sig, struct sigcontext sc)
90{
91 struct faultinfo fi;
92 GET_FAULTINFO_FROM_SC(fi, &sc);
93 printf("Tracing thread segfault at address 0x%lx, ip 0x%lx\n",
94 FAULT_ADDRESS(fi), SC_IP(&sc));
95 while(1)
96 pause();
97}
98
99/* Changed early in boot, and then only read */
100int debug = 0;
101int debug_stop = 1;
102int debug_parent = 0;
103int honeypot = 0;
104
105static int signal_tramp(void *arg)
106{
107 int (*proc)(void *);
108
109 if(honeypot && munmap((void *) (host_task_size - 0x10000000),
110 0x10000000))
111 panic("Unmapping stack failed");
112 if(ptrace(PTRACE_TRACEME, 0, 0, 0) < 0)
113 panic("ptrace PTRACE_TRACEME failed");
114 os_stop_process(os_getpid());
115 change_sig(SIGWINCH, 0);
116 signal(SIGUSR1, SIG_IGN);
117 change_sig(SIGCHLD, 0);
118 signal(SIGSEGV, (__sighandler_t) sig_handler);
119 set_cmdline("(idle thread)");
120 set_init_pid(os_getpid());
121 init_irq_signals(0);
122 proc = arg;
123 return((*proc)(NULL));
124}
125
126static void sleeping_process_signal(int pid, int sig)
127{
128 switch(sig){
129 /* These two result from UML being ^Z-ed and bg-ed. PTRACE_CONT is
130 * right because the process must be in the kernel already.
131 */
132 case SIGCONT:
133 case SIGTSTP:
134 if(ptrace(PTRACE_CONT, pid, 0, sig) < 0)
135 tracer_panic("sleeping_process_signal : Failed to "
136 "continue pid %d, signal = %d, "
137 "errno = %d\n", pid, sig, errno);
138 break;
139
140 /* This happens when the debugger (e.g. strace) is doing system call
141 * tracing on the kernel. During a context switch, the current task
142 * will be set to the incoming process and the outgoing process will
143 * hop into write and then read. Since it's not the current process
144 * any more, the trace of those will land here. So, we need to just
145 * PTRACE_SYSCALL it.
146 */
147 case (SIGTRAP + 0x80):
148 if(ptrace(PTRACE_SYSCALL, pid, 0, 0) < 0)
149 tracer_panic("sleeping_process_signal : Failed to "
150 "PTRACE_SYSCALL pid %d, errno = %d\n",
151 pid, errno);
152 break;
153 case SIGSTOP:
154 break;
155 default:
156 tracer_panic("sleeping process %d got unexpected "
157 "signal : %d\n", pid, sig);
158 break;
159 }
160}
161
162/* Accessed only by the tracing thread */
163int debugger_pid = -1;
164int debugger_parent = -1;
165int debugger_fd = -1;
166int gdb_pid = -1;
167
168struct {
169 int pid;
170 int signal;
171 unsigned long addr;
172 struct timeval time;
173} signal_record[1024][32];
174
175int signal_index[32];
176int nsignals = 0;
177int debug_trace = 0;
178
179extern void signal_usr1(int sig);
180
181int tracing_pid = -1;
182
183int tracer(int (*init_proc)(void *), void *sp)
184{
185 void *task = NULL;
186 int status, pid = 0, sig = 0, cont_type, tracing = 0, op = 0;
187 int proc_id = 0, n, err, old_tracing = 0, strace = 0;
188 int local_using_sysemu = 0;
189
190 signal(SIGPIPE, SIG_IGN);
191 setup_tracer_winch();
192 tracing_pid = os_getpid();
193 printf("tracing thread pid = %d\n", tracing_pid);
194
195 pid = clone(signal_tramp, sp, CLONE_FILES | SIGCHLD, init_proc);
196 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
197 if(n < 0){
198 printf("waitpid on idle thread failed, errno = %d\n", errno);
199 exit(1);
200 }
201 if (ptrace(PTRACE_OLDSETOPTIONS, pid, 0, (void *)PTRACE_O_TRACESYSGOOD) < 0) {
202 printf("Failed to PTRACE_SETOPTIONS for idle thread, errno = %d\n", errno);
203 exit(1);
204 }
205 if((ptrace(PTRACE_CONT, pid, 0, 0) < 0)){
206 printf("Failed to continue idle thread, errno = %d\n", errno);
207 exit(1);
208 }
209
210 signal(SIGSEGV, (sighandler_t) tracer_segv);
211 signal(SIGUSR1, signal_usr1);
212 if(debug_trace){
213 printf("Tracing thread pausing to be attached\n");
214 stop();
215 }
216 if(debug){
217 if(gdb_pid != -1)
218 debugger_pid = attach_debugger(pid, gdb_pid, 1);
219 else debugger_pid = init_ptrace_proxy(pid, 1, debug_stop);
220 if(debug_parent){
221 debugger_parent = os_process_parent(debugger_pid);
222 init_parent_proxy(debugger_parent);
223 err = attach(debugger_parent);
224 if(err){
225 printf("Failed to attach debugger parent %d, "
226 "errno = %d\n", debugger_parent, -err);
227 debugger_parent = -1;
228 }
229 else {
230 if(ptrace(PTRACE_SYSCALL, debugger_parent,
231 0, 0) < 0){
232 printf("Failed to continue debugger "
233 "parent, errno = %d\n", errno);
234 debugger_parent = -1;
235 }
236 }
237 }
238 }
239 set_cmdline("(tracing thread)");
240 while(1){
241 CATCH_EINTR(pid = waitpid(-1, &status, WUNTRACED));
242 if(pid <= 0){
243 if(errno != ECHILD){
244 printf("wait failed - errno = %d\n", errno);
245 }
246 continue;
247 }
248 if(pid == debugger_pid){
249 int cont = 0;
250
251 if(WIFEXITED(status) || WIFSIGNALED(status))
252 debugger_pid = -1;
253 /* XXX Figure out how to deal with gdb and SMP */
254 else cont = debugger_signal(status, cpu_tasks[0].pid);
255 if(cont == PTRACE_SYSCALL) strace = 1;
256 continue;
257 }
258 else if(pid == debugger_parent){
259 debugger_parent_signal(status, pid);
260 continue;
261 }
262 nsignals++;
263 if(WIFEXITED(status)) ;
264#ifdef notdef
265 {
266 printf("Child %d exited with status %d\n", pid,
267 WEXITSTATUS(status));
268 }
269#endif
270 else if(WIFSIGNALED(status)){
271 sig = WTERMSIG(status);
272 if(sig != 9){
273 printf("Child %d exited with signal %d\n", pid,
274 sig);
275 }
276 }
277 else if(WIFSTOPPED(status)){
278 proc_id = pid_to_processor_id(pid);
279 sig = WSTOPSIG(status);
280 if(proc_id == -1){
281 sleeping_process_signal(pid, sig);
282 continue;
283 }
284
285 task = cpu_tasks[proc_id].task;
286 tracing = is_tracing(task);
287 old_tracing = tracing;
288
289 /* Assume: no syscall, when coming from user */
290 if ( tracing )
291 do_sigtrap(task);
292
293 switch(sig){
294 case SIGUSR1:
295 sig = 0;
296 op = do_proc_op(task, proc_id);
297 switch(op){
298 /*
299 * This is called when entering user mode; after
300 * this, we start intercepting syscalls.
301 *
302 * In fact, a process is started in kernel mode,
303 * so with is_tracing() == 0 (and that is reset
304 * when executing syscalls, since UML kernel has
305 * the right to do syscalls);
306 */
307 case OP_TRACE_ON:
308 arch_leave_kernel(task, pid);
309 tracing = 1;
310 break;
311 case OP_REBOOT:
312 case OP_HALT:
313 unmap_physmem();
314 kmalloc_ok = 0;
315 os_kill_ptraced_process(pid, 0);
316 /* Now let's reap remaining zombies */
317 errno = 0;
318 do {
319 waitpid(-1, &status,
320 WUNTRACED);
321 } while (errno != ECHILD);
322 return(op == OP_REBOOT);
323 case OP_NONE:
324 printf("Detaching pid %d\n", pid);
325 detach(pid, SIGSTOP);
326 continue;
327 default:
328 break;
329 }
330 /* OP_EXEC switches host processes on us,
331 * we want to continue the new one.
332 */
333 pid = cpu_tasks[proc_id].pid;
334 break;
335 case (SIGTRAP + 0x80):
336 if(!tracing && (debugger_pid != -1)){
337 child_signal(pid, status & 0x7fff);
338 continue;
339 }
340 tracing = 0;
341 /* local_using_sysemu has been already set
342 * below, since if we are here, is_tracing() on
343 * the traced task was 1, i.e. the process had
344 * already run through one iteration of the
345 * loop which executed a OP_TRACE_ON request.*/
346 do_syscall(task, pid, local_using_sysemu);
347 sig = SIGUSR2;
348 break;
349 case SIGTRAP:
350 if(!tracing && (debugger_pid != -1)){
351 child_signal(pid, status);
352 continue;
353 }
354 tracing = 0;
355 break;
356 case SIGPROF:
357 if(tracing) sig = 0;
358 break;
359 case SIGCHLD:
360 case SIGHUP:
361 sig = 0;
362 break;
363 case SIGSEGV:
364 case SIGIO:
365 case SIGALRM:
366 case SIGVTALRM:
367 case SIGFPE:
368 case SIGBUS:
369 case SIGILL:
370 case SIGWINCH:
371
372 default:
373 tracing = 0;
374 break;
375 }
376 set_tracing(task, tracing);
377
378 if(!tracing && old_tracing)
379 arch_enter_kernel(task, pid);
380
381 if(!tracing && (debugger_pid != -1) && (sig != 0) &&
382 (sig != SIGALRM) && (sig != SIGVTALRM) &&
383 (sig != SIGSEGV) && (sig != SIGTRAP) &&
384 (sig != SIGUSR2) && (sig != SIGIO) &&
385 (sig != SIGFPE)){
386 child_signal(pid, status);
387 continue;
388 }
389
390 local_using_sysemu = get_using_sysemu();
391
392 if(tracing)
393 cont_type = SELECT_PTRACE_OPERATION(local_using_sysemu,
394 singlestepping(task));
395 else if((debugger_pid != -1) && strace)
396 cont_type = PTRACE_SYSCALL;
397 else
398 cont_type = PTRACE_CONT;
399
400 if(ptrace(cont_type, pid, 0, sig) != 0){
401 tracer_panic("ptrace failed to continue "
402 "process - errno = %d\n",
403 errno);
404 }
405 }
406 }
407 return(0);
408}
409
410static int __init uml_debug_setup(char *line, int *add)
411{
412 char *next;
413
414 debug = 1;
415 *add = 0;
416 if(*line != '=') return(0);
417 line++;
418
419 while(line != NULL){
420 next = strchr(line, ',');
421 if(next) *next++ = '\0';
422
423 if(!strcmp(line, "go")) debug_stop = 0;
424 else if(!strcmp(line, "parent")) debug_parent = 1;
425 else printf("Unknown debug option : '%s'\n", line);
426
427 line = next;
428 }
429 return(0);
430}
431
432__uml_setup("debug", uml_debug_setup,
433"debug\n"
434" Starts up the kernel under the control of gdb. See the \n"
435" kernel debugging tutorial and the debugging session pages\n"
436" at http://user-mode-linux.sourceforge.net/ for more information.\n\n"
437);
438
439static int __init uml_debugtrace_setup(char *line, int *add)
440{
441 debug_trace = 1;
442 return 0;
443}
444__uml_setup("debugtrace", uml_debugtrace_setup,
445"debugtrace\n"
446" Causes the tracing thread to pause until it is attached by a\n"
447" debugger and continued. This is mostly for debugging crashes\n"
448" early during boot, and should be pretty much obsoleted by\n"
449" the debug switch.\n\n"
450);
451
452/*
453 * Overrides for Emacs so that we follow Linus's tabbing style.
454 * Emacs will notice this stuff at the end of the file and automatically
455 * adjust the settings for this buffer only. This must remain at the end
456 * of the file.
457 * ---------------------------------------------------------------------------
458 * Local variables:
459 * c-file-style: "linux"
460 * End:
461 */
diff --git a/arch/um/kernel/tt/trap_user.c b/arch/um/kernel/tt/trap_user.c
deleted file mode 100644
index 3032eb5e2467..000000000000
--- a/arch/um/kernel/tt/trap_user.c
+++ /dev/null
@@ -1,70 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <stdlib.h>
7#include <errno.h>
8#include <signal.h>
9#include "sysdep/ptrace.h"
10#include "sysdep/sigcontext.h"
11#include "kern_util.h"
12#include "task.h"
13#include "tt.h"
14#include "os.h"
15
16void sig_handler_common_tt(int sig, void *sc_ptr)
17{
18 struct sigcontext *sc = sc_ptr;
19 struct tt_regs save_regs, *r;
20 int save_errno = errno, is_user = 0;
21 void (*handler)(int, union uml_pt_regs *);
22
23 /* This is done because to allow SIGSEGV to be delivered inside a SEGV
24 * handler. This can happen in copy_user, and if SEGV is disabled,
25 * the process will die.
26 */
27 if(sig == SIGSEGV)
28 change_sig(SIGSEGV, 1);
29
30 r = &TASK_REGS(get_current())->tt;
31 if ( sig == SIGFPE || sig == SIGSEGV ||
32 sig == SIGBUS || sig == SIGILL ||
33 sig == SIGTRAP ) {
34 GET_FAULTINFO_FROM_SC(r->faultinfo, sc);
35 }
36 save_regs = *r;
37 if (sc)
38 is_user = user_context(SC_SP(sc));
39 r->sc = sc;
40 if(sig != SIGUSR2)
41 r->syscall = -1;
42
43 handler = sig_info[sig];
44
45 /* unblock SIGALRM, SIGVTALRM, SIGIO if sig isn't IRQ signal */
46 if (sig != SIGIO && sig != SIGWINCH &&
47 sig != SIGVTALRM && sig != SIGALRM)
48 unblock_signals();
49
50 handler(sig, (union uml_pt_regs *) r);
51
52 if(is_user){
53 interrupt_end();
54 block_signals();
55 set_user_mode(NULL);
56 }
57 *r = save_regs;
58 errno = save_errno;
59}
60
61/*
62 * Overrides for Emacs so that we follow Linus's tabbing style.
63 * Emacs will notice this stuff at the end of the file and automatically
64 * adjust the settings for this buffer only. This must remain at the end
65 * of the file.
66 * ---------------------------------------------------------------------------
67 * Local variables:
68 * c-file-style: "linux"
69 * End:
70 */
diff --git a/arch/um/kernel/tt/uaccess.c b/arch/um/kernel/tt/uaccess.c
deleted file mode 100644
index 1cb60726567e..000000000000
--- a/arch/um/kernel/tt/uaccess.c
+++ /dev/null
@@ -1,73 +0,0 @@
1/*
2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5
6#include "linux/sched.h"
7#include "asm/uaccess.h"
8
9int copy_from_user_tt(void *to, const void __user *from, int n)
10{
11 if(!access_ok(VERIFY_READ, from, n))
12 return(n);
13
14 return(__do_copy_from_user(to, from, n, &current->thread.fault_addr,
15 &current->thread.fault_catcher));
16}
17
18int copy_to_user_tt(void __user *to, const void *from, int n)
19{
20 if(!access_ok(VERIFY_WRITE, to, n))
21 return(n);
22
23 return(__do_copy_to_user(to, from, n, &current->thread.fault_addr,
24 &current->thread.fault_catcher));
25}
26
27int strncpy_from_user_tt(char *dst, const char __user *src, int count)
28{
29 int n;
30
31 if(!access_ok(VERIFY_READ, src, 1))
32 return(-EFAULT);
33
34 n = __do_strncpy_from_user(dst, src, count,
35 &current->thread.fault_addr,
36 &current->thread.fault_catcher);
37 if(n < 0) return(-EFAULT);
38 return(n);
39}
40
41int __clear_user_tt(void __user *mem, int len)
42{
43 return(__do_clear_user(mem, len,
44 &current->thread.fault_addr,
45 &current->thread.fault_catcher));
46}
47
48int clear_user_tt(void __user *mem, int len)
49{
50 if(!access_ok(VERIFY_WRITE, mem, len))
51 return(len);
52
53 return(__do_clear_user(mem, len, &current->thread.fault_addr,
54 &current->thread.fault_catcher));
55}
56
57int strnlen_user_tt(const void __user *str, int len)
58{
59 return(__do_strnlen_user(str, len,
60 &current->thread.fault_addr,
61 &current->thread.fault_catcher));
62}
63
64/*
65 * Overrides for Emacs so that we follow Linus's tabbing style.
66 * Emacs will notice this stuff at the end of the file and automatically
67 * adjust the settings for this buffer only. This must remain at the end
68 * of the file.
69 * ---------------------------------------------------------------------------
70 * Local variables:
71 * c-file-style: "linux"
72 * End:
73 */
diff --git a/arch/um/kernel/tt/uaccess_user.c b/arch/um/kernel/tt/uaccess_user.c
deleted file mode 100644
index 0e5c82c5e5b7..000000000000
--- a/arch/um/kernel/tt/uaccess_user.c
+++ /dev/null
@@ -1,105 +0,0 @@
1/*
2 * Copyright (C) 2001 Chris Emerson (cemerson@chiark.greenend.org.uk)
3 * Copyright (C) 2001 Jeff Dike (jdike@karaya.com)
4 * Licensed under the GPL
5 */
6
7#include <string.h>
8#include "uml_uaccess.h"
9#include "task.h"
10#include "kern_util.h"
11#include "os.h"
12#include "longjmp.h"
13
14int __do_copy_from_user(void *to, const void *from, int n,
15 void **fault_addr, void **fault_catcher)
16{
17 struct tt_regs save = TASK_REGS(get_current())->tt;
18 unsigned long fault;
19 int faulted;
20
21 fault = __do_user_copy(to, from, n, fault_addr, fault_catcher,
22 __do_copy, &faulted);
23 TASK_REGS(get_current())->tt = save;
24
25 if(!faulted)
26 return 0;
27 else if (fault)
28 return n - (fault - (unsigned long) from);
29 else
30 /* In case of a general protection fault, we don't have the
31 * fault address, so NULL is used instead. Pretend we didn't
32 * copy anything. */
33 return n;
34}
35
36static void __do_strncpy(void *dst, const void *src, int count)
37{
38 strncpy(dst, src, count);
39}
40
41int __do_strncpy_from_user(char *dst, const char *src, unsigned long count,
42 void **fault_addr, void **fault_catcher)
43{
44 struct tt_regs save = TASK_REGS(get_current())->tt;
45 unsigned long fault;
46 int faulted;
47
48 fault = __do_user_copy(dst, src, count, fault_addr, fault_catcher,
49 __do_strncpy, &faulted);
50 TASK_REGS(get_current())->tt = save;
51
52 if(!faulted) return(strlen(dst));
53 else return(-1);
54}
55
56static void __do_clear(void *to, const void *from, int n)
57{
58 memset(to, 0, n);
59}
60
61int __do_clear_user(void *mem, unsigned long len,
62 void **fault_addr, void **fault_catcher)
63{
64 struct tt_regs save = TASK_REGS(get_current())->tt;
65 unsigned long fault;
66 int faulted;
67
68 fault = __do_user_copy(mem, NULL, len, fault_addr, fault_catcher,
69 __do_clear, &faulted);
70 TASK_REGS(get_current())->tt = save;
71
72 if(!faulted) return(0);
73 else return(len - (fault - (unsigned long) mem));
74}
75
76int __do_strnlen_user(const char *str, unsigned long n,
77 void **fault_addr, void **fault_catcher)
78{
79 struct tt_regs save = TASK_REGS(get_current())->tt;
80 int ret;
81 unsigned long *faddrp = (unsigned long *)fault_addr;
82 jmp_buf jbuf;
83
84 *fault_catcher = &jbuf;
85 if(UML_SETJMP(&jbuf) == 0)
86 ret = strlen(str) + 1;
87 else ret = *faddrp - (unsigned long) str;
88
89 *fault_addr = NULL;
90 *fault_catcher = NULL;
91
92 TASK_REGS(get_current())->tt = save;
93 return ret;
94}
95
96/*
97 * Overrides for Emacs so that we follow Linus's tabbing style.
98 * Emacs will notice this stuff at the end of the file and automatically
99 * adjust the settings for this buffer only. This must remain at the end
100 * of the file.
101 * ---------------------------------------------------------------------------
102 * Local variables:
103 * c-file-style: "linux"
104 * End:
105 */
diff --git a/arch/um/kernel/uaccess.c b/arch/um/kernel/uaccess.c
index 054e3de0784e..d7436aacd26f 100644
--- a/arch/um/kernel/uaccess.c
+++ b/arch/um/kernel/uaccess.c
@@ -18,7 +18,7 @@ void __do_copy(void *to, const void *from, int n)
18 18
19 19
20int __do_copy_to_user(void *to, const void *from, int n, 20int __do_copy_to_user(void *to, const void *from, int n,
21 void **fault_addr, void **fault_catcher) 21 void **fault_addr, jmp_buf **fault_catcher)
22{ 22{
23 unsigned long fault; 23 unsigned long fault;
24 int faulted; 24 int faulted;
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index ecc458fe51b9..f1c71393f578 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -1,46 +1,24 @@
1/* 1/*
2 * Copyright (C) 2000, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/kernel.h"
7#include "linux/sched.h"
8#include "linux/notifier.h"
9#include "linux/mm.h"
10#include "linux/types.h"
11#include "linux/tty.h"
12#include "linux/init.h"
13#include "linux/bootmem.h"
14#include "linux/spinlock.h"
15#include "linux/utsname.h"
16#include "linux/sysrq.h"
17#include "linux/seq_file.h"
18#include "linux/delay.h" 6#include "linux/delay.h"
7#include "linux/mm.h"
19#include "linux/module.h" 8#include "linux/module.h"
9#include "linux/seq_file.h"
10#include "linux/string.h"
20#include "linux/utsname.h" 11#include "linux/utsname.h"
21#include "asm/page.h"
22#include "asm/pgtable.h" 12#include "asm/pgtable.h"
23#include "asm/ptrace.h" 13#include "asm/processor.h"
24#include "asm/elf.h"
25#include "asm/user.h"
26#include "asm/setup.h" 14#include "asm/setup.h"
27#include "ubd_user.h"
28#include "asm/current.h"
29#include "kern_util.h"
30#include "as-layout.h"
31#include "arch.h" 15#include "arch.h"
16#include "as-layout.h"
17#include "init.h"
32#include "kern.h" 18#include "kern.h"
33#include "mem_user.h" 19#include "mem_user.h"
34#include "mem.h"
35#include "initrd.h"
36#include "init.h"
37#include "os.h" 20#include "os.h"
38#include "choose-mode.h"
39#include "mode_kern.h"
40#include "mode.h"
41#ifdef UML_CONFIG_MODE_SKAS
42#include "skas.h" 21#include "skas.h"
43#endif
44 22
45#define DEFAULT_COMMAND_LINE "root=98:0" 23#define DEFAULT_COMMAND_LINE "root=98:0"
46 24
@@ -53,7 +31,7 @@ static void __init add_arg(char *arg)
53 printf("add_arg: Too many command line arguments!\n"); 31 printf("add_arg: Too many command line arguments!\n");
54 exit(1); 32 exit(1);
55 } 33 }
56 if(strlen(command_line) > 0) 34 if (strlen(command_line) > 0)
57 strcat(command_line, " "); 35 strcat(command_line, " ");
58 strcat(command_line, arg); 36 strcat(command_line, arg);
59} 37}
@@ -70,8 +48,8 @@ struct cpuinfo_um boot_cpu_data = {
70 48
71unsigned long thread_saved_pc(struct task_struct *task) 49unsigned long thread_saved_pc(struct task_struct *task)
72{ 50{
73 return os_process_pc(CHOOSE_MODE_PROC(thread_pid_tt, thread_pid_skas, 51 /* FIXME: Need to look up userspace_pid by cpu */
74 task)); 52 return os_process_pc(userspace_pid[0]);
75} 53}
76 54
77/* Changed in setup_arch, which is called in early boot */ 55/* Changed in setup_arch, which is called in early boot */
@@ -90,7 +68,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
90 seq_printf(m, "processor\t: %d\n", index); 68 seq_printf(m, "processor\t: %d\n", index);
91 seq_printf(m, "vendor_id\t: User Mode Linux\n"); 69 seq_printf(m, "vendor_id\t: User Mode Linux\n");
92 seq_printf(m, "model name\t: UML\n"); 70 seq_printf(m, "model name\t: UML\n");
93 seq_printf(m, "mode\t\t: %s\n", CHOOSE_MODE("tt", "skas")); 71 seq_printf(m, "mode\t\t: skas\n");
94 seq_printf(m, "host\t\t: %s\n", host_info); 72 seq_printf(m, "host\t\t: %s\n", host_info);
95 seq_printf(m, "bogomips\t: %lu.%02lu\n\n", 73 seq_printf(m, "bogomips\t: %lu.%02lu\n\n",
96 loops_per_jiffy/(500000/HZ), 74 loops_per_jiffy/(500000/HZ),
@@ -132,44 +110,13 @@ unsigned long end_vm;
132/* Set in uml_ncpus_setup */ 110/* Set in uml_ncpus_setup */
133int ncpus = 1; 111int ncpus = 1;
134 112
135#ifdef CONFIG_CMDLINE_ON_HOST
136/* Pointer set in linux_main, the array itself is private to each thread,
137 * and changed at address space creation time so this poses no concurrency
138 * problems.
139 */
140static char *argv1_begin = NULL;
141static char *argv1_end = NULL;
142#endif
143
144/* Set in early boot */ 113/* Set in early boot */
145static int have_root __initdata = 0; 114static int have_root __initdata = 0;
146 115
147/* Set in uml_mem_setup and modified in linux_main */ 116/* Set in uml_mem_setup and modified in linux_main */
148long long physmem_size = 32 * 1024 * 1024; 117long long physmem_size = 32 * 1024 * 1024;
149 118
150void set_cmdline(char *cmd) 119static char *usage_string =
151{
152#ifdef CONFIG_CMDLINE_ON_HOST
153 char *umid, *ptr;
154
155 if(CHOOSE_MODE(honeypot, 0)) return;
156
157 umid = get_umid();
158 if(*umid != '\0'){
159 snprintf(argv1_begin,
160 (argv1_end - argv1_begin) * sizeof(*ptr),
161 "(%s) ", umid);
162 ptr = &argv1_begin[strlen(argv1_begin)];
163 }
164 else ptr = argv1_begin;
165
166 snprintf(ptr, (argv1_end - ptr) * sizeof(*ptr), "[%s]", cmd);
167 memset(argv1_begin + strlen(argv1_begin), '\0',
168 argv1_end - argv1_begin - strlen(argv1_begin));
169#endif
170}
171
172static char *usage_string =
173"User Mode Linux v%s\n" 120"User Mode Linux v%s\n"
174" available at http://user-mode-linux.sourceforge.net/\n\n"; 121" available at http://user-mode-linux.sourceforge.net/\n\n";
175 122
@@ -201,13 +148,10 @@ __uml_setup("root=", uml_root_setup,
201" root=/dev/ubd5\n\n" 148" root=/dev/ubd5\n\n"
202); 149);
203 150
204#ifndef CONFIG_MODE_TT
205
206static int __init no_skas_debug_setup(char *line, int *add) 151static int __init no_skas_debug_setup(char *line, int *add)
207{ 152{
208 printf("'debug' is not necessary to gdb UML in skas mode - run \n"); 153 printf("'debug' is not necessary to gdb UML in skas mode - run \n");
209 printf("'gdb linux' and disable CONFIG_CMDLINE_ON_HOST if gdb \n"); 154 printf("'gdb linux'");
210 printf("doesn't work as expected\n");
211 155
212 return 0; 156 return 0;
213} 157}
@@ -217,8 +161,6 @@ __uml_setup("debug", no_skas_debug_setup,
217" this flag is not needed to run gdb on UML in skas mode\n\n" 161" this flag is not needed to run gdb on UML in skas mode\n\n"
218); 162);
219 163
220#endif
221
222#ifdef CONFIG_SMP 164#ifdef CONFIG_SMP
223static int __init uml_ncpus_setup(char *line, int *add) 165static int __init uml_ncpus_setup(char *line, int *add)
224{ 166{
@@ -232,56 +174,10 @@ static int __init uml_ncpus_setup(char *line, int *add)
232 174
233__uml_setup("ncpus=", uml_ncpus_setup, 175__uml_setup("ncpus=", uml_ncpus_setup,
234"ncpus=<# of desired CPUs>\n" 176"ncpus=<# of desired CPUs>\n"
235" This tells an SMP kernel how many virtual processors to start.\n\n" 177" This tells an SMP kernel how many virtual processors to start.\n\n"
236); 178);
237#endif 179#endif
238 180
239static int force_tt = 0;
240
241#if defined(CONFIG_MODE_TT) && defined(CONFIG_MODE_SKAS)
242#define DEFAULT_TT 0
243
244static int __init mode_tt_setup(char *line, int *add)
245{
246 force_tt = 1;
247 return 0;
248}
249
250#else
251#ifdef CONFIG_MODE_SKAS
252
253#define DEFAULT_TT 0
254
255static int __init mode_tt_setup(char *line, int *add)
256{
257 printf("CONFIG_MODE_TT disabled - 'mode=tt' ignored\n");
258 return 0;
259}
260
261#else
262#ifdef CONFIG_MODE_TT
263
264#define DEFAULT_TT 1
265
266static int __init mode_tt_setup(char *line, int *add)
267{
268 printf("CONFIG_MODE_SKAS disabled - 'mode=tt' redundant\n");
269 return 0;
270}
271
272#endif
273#endif
274#endif
275
276__uml_setup("mode=tt", mode_tt_setup,
277"mode=tt\n"
278" When both CONFIG_MODE_TT and CONFIG_MODE_SKAS are enabled, this option\n"
279" forces UML to run in tt (tracing thread) mode. It is not the default\n"
280" because it's slower and less secure than skas mode.\n\n"
281);
282
283int mode_tt = DEFAULT_TT;
284
285static int __init Usage(char *line, int *add) 181static int __init Usage(char *line, int *add)
286{ 182{
287 const char **p; 183 const char **p;
@@ -310,9 +206,8 @@ static int __init uml_checksetup(char *line, int *add)
310 int n; 206 int n;
311 207
312 n = strlen(p->str); 208 n = strlen(p->str);
313 if(!strncmp(line, p->str, n)){ 209 if (!strncmp(line, p->str, n) && p->setup_func(line + n, add))
314 if (p->setup_func(line + n, add)) return 1; 210 return 1;
315 }
316 p++; 211 p++;
317 } 212 }
318 return 0; 213 return 0;
@@ -323,7 +218,7 @@ static void __init uml_postsetup(void)
323 initcall_t *p; 218 initcall_t *p;
324 219
325 p = &__uml_postsetup_start; 220 p = &__uml_postsetup_start;
326 while(p < &__uml_postsetup_end){ 221 while(p < &__uml_postsetup_end) {
327 (*p)(); 222 (*p)();
328 p++; 223 p++;
329 } 224 }
@@ -339,6 +234,20 @@ EXPORT_SYMBOL(end_iomem);
339 234
340extern char __binary_start; 235extern char __binary_start;
341 236
237static unsigned long set_task_sizes_skas(unsigned long *task_size_out)
238{
239 /* Round up to the nearest 4M */
240 unsigned long host_task_size = ROUND_4M((unsigned long)
241 &host_task_size);
242
243 if (!skas_needs_stub)
244 *task_size_out = host_task_size;
245 else
246 *task_size_out = STUB_START & PGDIR_MASK;
247
248 return host_task_size;
249}
250
342int __init linux_main(int argc, char **argv) 251int __init linux_main(int argc, char **argv)
343{ 252{
344 unsigned long avail, diff; 253 unsigned long avail, diff;
@@ -346,45 +255,30 @@ int __init linux_main(int argc, char **argv)
346 unsigned int i, add; 255 unsigned int i, add;
347 char * mode; 256 char * mode;
348 257
349 for (i = 1; i < argc; i++){ 258 for (i = 1; i < argc; i++) {
350 if((i == 1) && (argv[i][0] == ' ')) continue; 259 if ((i == 1) && (argv[i][0] == ' '))
260 continue;
351 add = 1; 261 add = 1;
352 uml_checksetup(argv[i], &add); 262 uml_checksetup(argv[i], &add);
353 if (add) 263 if (add)
354 add_arg(argv[i]); 264 add_arg(argv[i]);
355 } 265 }
356 if(have_root == 0) 266 if (have_root == 0)
357 add_arg(DEFAULT_COMMAND_LINE); 267 add_arg(DEFAULT_COMMAND_LINE);
358 268
269 /* OS sanity checks that need to happen before the kernel runs */
359 os_early_checks(); 270 os_early_checks();
360 if (force_tt)
361 clear_can_do_skas();
362 mode_tt = force_tt ? 1 : !can_do_skas();
363#ifndef CONFIG_MODE_TT
364 if (mode_tt) {
365 /*Since CONFIG_MODE_TT is #undef'ed, force_tt cannot be 1. So,
366 * can_do_skas() returned 0, and the message is correct. */
367 printf("Support for TT mode is disabled, and no SKAS support is present on the host.\n");
368 exit(1);
369 }
370#endif
371 271
372#ifndef CONFIG_MODE_SKAS 272 can_do_skas();
373 mode = "TT"; 273
374#else 274 if (proc_mm && ptrace_faultinfo)
375 /* Show to the user the result of selection */
376 if (mode_tt)
377 mode = "TT";
378 else if (proc_mm && ptrace_faultinfo)
379 mode = "SKAS3"; 275 mode = "SKAS3";
380 else 276 else
381 mode = "SKAS0"; 277 mode = "SKAS0";
382#endif
383 278
384 printf("UML running in %s mode\n", mode); 279 printf("UML running in %s mode\n", mode);
385 280
386 host_task_size = CHOOSE_MODE_PROC(set_task_sizes_tt, 281 host_task_size = set_task_sizes_skas(&task_size);
387 set_task_sizes_skas, &task_size);
388 282
389 /* 283 /*
390 * Setting up handlers to 'sig_info' struct 284 * Setting up handlers to 'sig_info' struct
@@ -392,13 +286,15 @@ int __init linux_main(int argc, char **argv)
392 os_fill_handlinfo(handlinfo_kern); 286 os_fill_handlinfo(handlinfo_kern);
393 287
394 brk_start = (unsigned long) sbrk(0); 288 brk_start = (unsigned long) sbrk(0);
395 CHOOSE_MODE_PROC(before_mem_tt, before_mem_skas, brk_start); 289
396 /* Increase physical memory size for exec-shield users 290 /*
397 so they actually get what they asked for. This should 291 * Increase physical memory size for exec-shield users
398 add zero for non-exec shield users */ 292 * so they actually get what they asked for. This should
293 * add zero for non-exec shield users
294 */
399 295
400 diff = UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end); 296 diff = UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end);
401 if(diff > 1024 * 1024){ 297 if (diff > 1024 * 1024) {
402 printf("Adding %ld bytes to physical memory to account for " 298 printf("Adding %ld bytes to physical memory to account for "
403 "exec-shield gap\n", diff); 299 "exec-shield gap\n", diff);
404 physmem_size += UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end); 300 physmem_size += UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end);
@@ -411,20 +307,16 @@ int __init linux_main(int argc, char **argv)
411 307
412 setup_machinename(init_utsname()->machine); 308 setup_machinename(init_utsname()->machine);
413 309
414#ifdef CONFIG_CMDLINE_ON_HOST
415 argv1_begin = argv[1];
416 argv1_end = &argv[1][strlen(argv[1])];
417#endif
418
419 highmem = 0; 310 highmem = 0;
420 iomem_size = (iomem_size + PAGE_SIZE - 1) & PAGE_MASK; 311 iomem_size = (iomem_size + PAGE_SIZE - 1) & PAGE_MASK;
421 max_physmem = get_kmem_end() - uml_physmem - iomem_size - MIN_VMALLOC; 312 max_physmem = get_kmem_end() - uml_physmem - iomem_size - MIN_VMALLOC;
422 313
423 /* Zones have to begin on a 1 << MAX_ORDER page boundary, 314 /*
315 * Zones have to begin on a 1 << MAX_ORDER page boundary,
424 * so this makes sure that's true for highmem 316 * so this makes sure that's true for highmem
425 */ 317 */
426 max_physmem &= ~((1 << (PAGE_SHIFT + MAX_ORDER)) - 1); 318 max_physmem &= ~((1 << (PAGE_SHIFT + MAX_ORDER)) - 1);
427 if(physmem_size + iomem_size > max_physmem){ 319 if (physmem_size + iomem_size > max_physmem) {
428 highmem = physmem_size + iomem_size - max_physmem; 320 highmem = physmem_size + iomem_size - max_physmem;
429 physmem_size -= highmem; 321 physmem_size -= highmem;
430#ifndef CONFIG_HIGHMEM 322#ifndef CONFIG_HIGHMEM
@@ -441,7 +333,7 @@ int __init linux_main(int argc, char **argv)
441 start_vm = VMALLOC_START; 333 start_vm = VMALLOC_START;
442 334
443 setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem); 335 setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem);
444 if(init_maps(physmem_size, iomem_size, highmem)){ 336 if (init_maps(physmem_size, iomem_size, highmem)) {
445 printf("Failed to allocate mem_map for %Lu bytes of physical " 337 printf("Failed to allocate mem_map for %Lu bytes of physical "
446 "memory and %Lu bytes of highmem\n", physmem_size, 338 "memory and %Lu bytes of highmem\n", physmem_size,
447 highmem); 339 highmem);
@@ -450,10 +342,11 @@ int __init linux_main(int argc, char **argv)
450 342
451 virtmem_size = physmem_size; 343 virtmem_size = physmem_size;
452 avail = get_kmem_end() - start_vm; 344 avail = get_kmem_end() - start_vm;
453 if(physmem_size > avail) virtmem_size = avail; 345 if (physmem_size > avail)
346 virtmem_size = avail;
454 end_vm = start_vm + virtmem_size; 347 end_vm = start_vm + virtmem_size;
455 348
456 if(virtmem_size < physmem_size) 349 if (virtmem_size < physmem_size)
457 printf("Kernel virtual memory size shrunk to %lu bytes\n", 350 printf("Kernel virtual memory size shrunk to %lu bytes\n",
458 virtmem_size); 351 virtmem_size);
459 352
@@ -462,7 +355,7 @@ int __init linux_main(int argc, char **argv)
462 stack_protections((unsigned long) &init_thread_info); 355 stack_protections((unsigned long) &init_thread_info);
463 os_flush_stdout(); 356 os_flush_stdout();
464 357
465 return CHOOSE_MODE(start_uml_tt(), start_uml_skas()); 358 return start_uml();
466} 359}
467 360
468extern int uml_exitcode; 361extern int uml_exitcode;
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
index 81acdc24348e..13df191e2b41 100644
--- a/arch/um/kernel/uml.lds.S
+++ b/arch/um/kernel/uml.lds.S
@@ -18,13 +18,6 @@ SECTIONS
18 18
19 . = START + SIZEOF_HEADERS; 19 . = START + SIZEOF_HEADERS;
20 20
21#ifdef MODE_TT
22 .remap_data : { UNMAP_PATH (.data .bss) }
23 .remap : { UNMAP_PATH (.text) }
24
25 . = ALIGN(4096); /* Init code and data */
26#endif
27
28 _text = .; 21 _text = .;
29 _stext = .; 22 _stext = .;
30 __init_begin = .; 23 __init_begin = .;
diff --git a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile
index 2f8c79464015..8e129af8170d 100644
--- a/arch/um/os-Linux/Makefile
+++ b/arch/um/os-Linux/Makefile
@@ -1,23 +1,18 @@
1# 1#
2# Copyright (C) 2000 Jeff Dike (jdike@karaya.com) 2# Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
6obj-y = aio.o elf_aux.o execvp.o file.o helper.o irq.o main.o mem.o process.o \ 6obj-y = aio.o elf_aux.o execvp.o file.o helper.o irq.o main.o mem.o process.o \
7 sigio.o signal.o start_up.o time.o trap.o tty.o uaccess.o umid.o tls.o \ 7 registers.o sigio.o signal.o start_up.o time.o trap.o tty.o uaccess.o \
8 user_syms.o util.o drivers/ sys-$(SUBARCH)/ 8 umid.o tls.o user_syms.o util.o drivers/ sys-$(SUBARCH)/ skas/
9
10obj-$(CONFIG_MODE_SKAS) += skas/
11
12obj-$(CONFIG_MODE_TT) += tt.o
13user-objs-$(CONFIG_MODE_TT) += tt.o
14 9
15obj-$(CONFIG_TTY_LOG) += tty_log.o 10obj-$(CONFIG_TTY_LOG) += tty_log.o
16user-objs-$(CONFIG_TTY_LOG) += tty_log.o 11user-objs-$(CONFIG_TTY_LOG) += tty_log.o
17 12
18USER_OBJS := $(user-objs-y) aio.o elf_aux.o execvp.o file.o helper.o irq.o \ 13USER_OBJS := $(user-objs-y) aio.o elf_aux.o execvp.o file.o helper.o irq.o \
19 main.o mem.o process.o sigio.o signal.o start_up.o time.o trap.o tty.o \ 14 main.o mem.o process.o registers.o sigio.o signal.o start_up.o time.o \
20 tls.o uaccess.o umid.o util.o 15 trap.o tty.o tls.o uaccess.o umid.o util.o
21 16
22CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH) 17CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH)
23 18
diff --git a/arch/um/os-Linux/aio.c b/arch/um/os-Linux/aio.c
index 59348359f9ab..4158118c4a56 100644
--- a/arch/um/os-Linux/aio.c
+++ b/arch/um/os-Linux/aio.c
@@ -1,20 +1,19 @@
1/* 1/*
2 * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2004 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stdlib.h>
7#include <unistd.h> 6#include <unistd.h>
7#include <sched.h>
8#include <signal.h> 8#include <signal.h>
9#include <errno.h> 9#include <errno.h>
10#include <sched.h> 10#include <sys/time.h>
11#include <sys/syscall.h> 11#include <asm/unistd.h>
12#include "os.h"
13#include "aio.h" 12#include "aio.h"
14#include "init.h" 13#include "init.h"
15#include "user.h"
16#include "mode.h"
17#include "kern_constants.h" 14#include "kern_constants.h"
15#include "os.h"
16#include "user.h"
18 17
19struct aio_thread_req { 18struct aio_thread_req {
20 enum aio_type type; 19 enum aio_type type;
@@ -28,7 +27,8 @@ struct aio_thread_req {
28#if defined(HAVE_AIO_ABI) 27#if defined(HAVE_AIO_ABI)
29#include <linux/aio_abi.h> 28#include <linux/aio_abi.h>
30 29
31/* If we have the headers, we are going to build with AIO enabled. 30/*
31 * If we have the headers, we are going to build with AIO enabled.
32 * If we don't have aio in libc, we define the necessary stubs here. 32 * If we don't have aio in libc, we define the necessary stubs here.
33 */ 33 */
34 34
@@ -52,7 +52,8 @@ static long io_getevents(aio_context_t ctx_id, long min_nr, long nr,
52 52
53#endif 53#endif
54 54
55/* The AIO_MMAP cases force the mmapped page into memory here 55/*
56 * The AIO_MMAP cases force the mmapped page into memory here
56 * rather than in whatever place first touches the data. I used 57 * rather than in whatever place first touches the data. I used
57 * to do this by touching the page, but that's delicate because 58 * to do this by touching the page, but that's delicate because
58 * gcc is prone to optimizing that away. So, what's done here 59 * gcc is prone to optimizing that away. So, what's done here
@@ -106,12 +107,12 @@ static int aio_thread(void *arg)
106 107
107 signal(SIGWINCH, SIG_IGN); 108 signal(SIGWINCH, SIG_IGN);
108 109
109 while(1){ 110 while (1) {
110 n = io_getevents(ctx, 1, 1, &event, NULL); 111 n = io_getevents(ctx, 1, 1, &event, NULL);
111 if(n < 0){ 112 if (n < 0) {
112 if(errno == EINTR) 113 if (errno == EINTR)
113 continue; 114 continue;
114 printk("aio_thread - io_getevents failed, " 115 printk(UM_KERN_ERR "aio_thread - io_getevents failed, "
115 "errno = %d\n", errno); 116 "errno = %d\n", errno);
116 } 117 }
117 else { 118 else {
@@ -120,9 +121,9 @@ static int aio_thread(void *arg)
120 .err = event.res }); 121 .err = event.res });
121 reply_fd = ((struct aio_context *) reply.data)->reply_fd; 122 reply_fd = ((struct aio_context *) reply.data)->reply_fd;
122 err = write(reply_fd, &reply, sizeof(reply)); 123 err = write(reply_fd, &reply, sizeof(reply));
123 if(err != sizeof(reply)) 124 if (err != sizeof(reply))
124 printk("aio_thread - write failed, fd = %d, " 125 printk(UM_KERN_ERR "aio_thread - write failed, "
125 "err = %d\n", reply_fd, errno); 126 "fd = %d, err = %d\n", reply_fd, errno);
126 } 127 }
127 } 128 }
128 return 0; 129 return 0;
@@ -137,10 +138,10 @@ static int do_not_aio(struct aio_thread_req *req)
137 int n; 138 int n;
138 139
139 actual = lseek64(req->io_fd, req->offset, SEEK_SET); 140 actual = lseek64(req->io_fd, req->offset, SEEK_SET);
140 if(actual != req->offset) 141 if (actual != req->offset)
141 return -errno; 142 return -errno;
142 143
143 switch(req->type){ 144 switch(req->type) {
144 case AIO_READ: 145 case AIO_READ:
145 n = read(req->io_fd, req->buf, req->len); 146 n = read(req->io_fd, req->buf, req->len);
146 break; 147 break;
@@ -151,11 +152,12 @@ static int do_not_aio(struct aio_thread_req *req)
151 n = read(req->io_fd, &c, sizeof(c)); 152 n = read(req->io_fd, &c, sizeof(c));
152 break; 153 break;
153 default: 154 default:
154 printk("do_not_aio - bad request type : %d\n", req->type); 155 printk(UM_KERN_ERR "do_not_aio - bad request type : %d\n",
156 req->type);
155 return -EINVAL; 157 return -EINVAL;
156 } 158 }
157 159
158 if(n < 0) 160 if (n < 0)
159 return -errno; 161 return -errno;
160 return 0; 162 return 0;
161} 163}
@@ -173,16 +175,18 @@ static int not_aio_thread(void *arg)
173 int err; 175 int err;
174 176
175 signal(SIGWINCH, SIG_IGN); 177 signal(SIGWINCH, SIG_IGN);
176 while(1){ 178 while (1) {
177 err = read(aio_req_fd_r, &req, sizeof(req)); 179 err = read(aio_req_fd_r, &req, sizeof(req));
178 if(err != sizeof(req)){ 180 if (err != sizeof(req)) {
179 if(err < 0) 181 if (err < 0)
180 printk("not_aio_thread - read failed, " 182 printk(UM_KERN_ERR "not_aio_thread - "
181 "fd = %d, err = %d\n", aio_req_fd_r, 183 "read failed, fd = %d, err = %d\n",
184 aio_req_fd_r,
182 errno); 185 errno);
183 else { 186 else {
184 printk("not_aio_thread - short read, fd = %d, " 187 printk(UM_KERN_ERR "not_aio_thread - short "
185 "length = %d\n", aio_req_fd_r, err); 188 "read, fd = %d, length = %d\n",
189 aio_req_fd_r, err);
186 } 190 }
187 continue; 191 continue;
188 } 192 }
@@ -190,9 +194,9 @@ static int not_aio_thread(void *arg)
190 reply = ((struct aio_thread_reply) { .data = req.aio, 194 reply = ((struct aio_thread_reply) { .data = req.aio,
191 .err = err }); 195 .err = err });
192 err = write(req.aio->reply_fd, &reply, sizeof(reply)); 196 err = write(req.aio->reply_fd, &reply, sizeof(reply));
193 if(err != sizeof(reply)) 197 if (err != sizeof(reply))
194 printk("not_aio_thread - write failed, fd = %d, " 198 printk(UM_KERN_ERR "not_aio_thread - write failed, "
195 "err = %d\n", req.aio->reply_fd, errno); 199 "fd = %d, err = %d\n", req.aio->reply_fd, errno);
196 } 200 }
197 201
198 return 0; 202 return 0;
@@ -203,35 +207,36 @@ static int init_aio_24(void)
203 int fds[2], err; 207 int fds[2], err;
204 208
205 err = os_pipe(fds, 1, 1); 209 err = os_pipe(fds, 1, 1);
206 if(err) 210 if (err)
207 goto out; 211 goto out;
208 212
209 aio_req_fd_w = fds[0]; 213 aio_req_fd_w = fds[0];
210 aio_req_fd_r = fds[1]; 214 aio_req_fd_r = fds[1];
211 215
212 err = os_set_fd_block(aio_req_fd_w, 0); 216 err = os_set_fd_block(aio_req_fd_w, 0);
213 if(err) 217 if (err)
214 goto out_close_pipe; 218 goto out_close_pipe;
215 219
216 err = run_helper_thread(not_aio_thread, NULL, 220 err = run_helper_thread(not_aio_thread, NULL,
217 CLONE_FILES | CLONE_VM | SIGCHLD, &aio_stack); 221 CLONE_FILES | CLONE_VM | SIGCHLD, &aio_stack);
218 if(err < 0) 222 if (err < 0)
219 goto out_close_pipe; 223 goto out_close_pipe;
220 224
221 aio_pid = err; 225 aio_pid = err;
222 goto out; 226 goto out;
223 227
224out_close_pipe: 228out_close_pipe:
225 os_close_file(fds[0]); 229 close(fds[0]);
226 os_close_file(fds[1]); 230 close(fds[1]);
227 aio_req_fd_w = -1; 231 aio_req_fd_w = -1;
228 aio_req_fd_r = -1; 232 aio_req_fd_r = -1;
229out: 233out:
230#ifndef HAVE_AIO_ABI 234#ifndef HAVE_AIO_ABI
231 printk("/usr/include/linux/aio_abi.h not present during build\n"); 235 printk(UM_KERN_INFO "/usr/include/linux/aio_abi.h not present during "
236 "build\n");
232#endif 237#endif
233 printk("2.6 host AIO support not used - falling back to I/O " 238 printk(UM_KERN_INFO "2.6 host AIO support not used - falling back to "
234 "thread\n"); 239 "I/O thread\n");
235 return 0; 240 return 0;
236} 241}
237 242
@@ -241,21 +246,21 @@ static int init_aio_26(void)
241{ 246{
242 int err; 247 int err;
243 248
244 if(io_setup(256, &ctx)){ 249 if (io_setup(256, &ctx)) {
245 err = -errno; 250 err = -errno;
246 printk("aio_thread failed to initialize context, err = %d\n", 251 printk(UM_KERN_ERR "aio_thread failed to initialize context, "
247 errno); 252 "err = %d\n", errno);
248 return err; 253 return err;
249 } 254 }
250 255
251 err = run_helper_thread(aio_thread, NULL, 256 err = run_helper_thread(aio_thread, NULL,
252 CLONE_FILES | CLONE_VM | SIGCHLD, &aio_stack); 257 CLONE_FILES | CLONE_VM | SIGCHLD, &aio_stack);
253 if(err < 0) 258 if (err < 0)
254 return err; 259 return err;
255 260
256 aio_pid = err; 261 aio_pid = err;
257 262
258 printk("Using 2.6 host AIO\n"); 263 printk(UM_KERN_INFO "Using 2.6 host AIO\n");
259 return 0; 264 return 0;
260} 265}
261 266
@@ -266,13 +271,13 @@ static int submit_aio_26(enum aio_type type, int io_fd, char *buf, int len,
266 int err; 271 int err;
267 272
268 err = do_aio(ctx, type, io_fd, buf, len, offset, aio); 273 err = do_aio(ctx, type, io_fd, buf, len, offset, aio);
269 if(err){ 274 if (err) {
270 reply = ((struct aio_thread_reply) { .data = aio, 275 reply = ((struct aio_thread_reply) { .data = aio,
271 .err = err }); 276 .err = err });
272 err = write(aio->reply_fd, &reply, sizeof(reply)); 277 err = write(aio->reply_fd, &reply, sizeof(reply));
273 if(err != sizeof(reply)){ 278 if (err != sizeof(reply)) {
274 err = -errno; 279 err = -errno;
275 printk("submit_aio_26 - write failed, " 280 printk(UM_KERN_ERR "submit_aio_26 - write failed, "
276 "fd = %d, err = %d\n", aio->reply_fd, -err); 281 "fd = %d, err = %d\n", aio->reply_fd, -err);
277 } 282 }
278 else err = 0; 283 else err = 0;
@@ -320,28 +325,24 @@ static int init_aio(void)
320{ 325{
321 int err; 326 int err;
322 327
323 CHOOSE_MODE(({ if(!aio_24){ 328 if (!aio_24) {
324 printk("Disabling 2.6 AIO in tt mode\n");
325 aio_24 = 1;
326 } }), (void) 0);
327
328 if(!aio_24){
329 err = init_aio_26(); 329 err = init_aio_26();
330 if(err && (errno == ENOSYS)){ 330 if (err && (errno == ENOSYS)) {
331 printk("2.6 AIO not supported on the host - " 331 printk(UM_KERN_INFO "2.6 AIO not supported on the "
332 "reverting to 2.4 AIO\n"); 332 "host - reverting to 2.4 AIO\n");
333 aio_24 = 1; 333 aio_24 = 1;
334 } 334 }
335 else return err; 335 else return err;
336 } 336 }
337 337
338 if(aio_24) 338 if (aio_24)
339 return init_aio_24(); 339 return init_aio_24();
340 340
341 return 0; 341 return 0;
342} 342}
343 343
344/* The reason for the __initcall/__uml_exitcall asymmetry is that init_aio 344/*
345 * The reason for the __initcall/__uml_exitcall asymmetry is that init_aio
345 * needs to be called when the kernel is running because it calls run_helper, 346 * needs to be called when the kernel is running because it calls run_helper,
346 * which needs get_free_page. exit_aio is a __uml_exitcall because the generic 347 * which needs get_free_page. exit_aio is a __uml_exitcall because the generic
347 * kernel does not run __exitcalls on shutdown, and can't because many of them 348 * kernel does not run __exitcalls on shutdown, and can't because many of them
@@ -372,7 +373,7 @@ static int submit_aio_24(enum aio_type type, int io_fd, char *buf, int len,
372 int err; 373 int err;
373 374
374 err = write(aio_req_fd_w, &req, sizeof(req)); 375 err = write(aio_req_fd_w, &req, sizeof(req));
375 if(err == sizeof(req)) 376 if (err == sizeof(req))
376 err = 0; 377 err = 0;
377 else err = -errno; 378 else err = -errno;
378 379
@@ -384,9 +385,8 @@ int submit_aio(enum aio_type type, int io_fd, char *buf, int len,
384 struct aio_context *aio) 385 struct aio_context *aio)
385{ 386{
386 aio->reply_fd = reply_fd; 387 aio->reply_fd = reply_fd;
387 if(aio_24) 388 if (aio_24)
388 return submit_aio_24(type, io_fd, buf, len, offset, aio); 389 return submit_aio_24(type, io_fd, buf, len, offset, aio);
389 else { 390 else
390 return submit_aio_26(type, io_fd, buf, len, offset, aio); 391 return submit_aio_26(type, io_fd, buf, len, offset, aio);
391 }
392} 392}
diff --git a/arch/um/os-Linux/drivers/etap.h b/arch/um/os-Linux/drivers/etap.h
index 57ecdaf2f67e..ddffd41c3f3f 100644
--- a/arch/um/os-Linux/drivers/etap.h
+++ b/arch/um/os-Linux/drivers/etap.h
@@ -1,8 +1,11 @@
1/* 1/*
2 * Copyright (C) 2001 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#ifndef __DRIVERS_ETAP_H
7#define __DRIVERS_ETAP_H
8
6#include "net_user.h" 9#include "net_user.h"
7 10
8struct ethertap_data { 11struct ethertap_data {
@@ -15,13 +18,4 @@ struct ethertap_data {
15 18
16extern const struct net_user_info ethertap_user_info; 19extern const struct net_user_info ethertap_user_info;
17 20
18/* 21#endif
19 * Overrides for Emacs so that we follow Linus's tabbing style.
20 * Emacs will notice this stuff at the end of the file and automatically
21 * adjust the settings for this buffer only. This must remain at the end
22 * of the file.
23 * ---------------------------------------------------------------------------
24 * Local variables:
25 * c-file-style: "linux"
26 * End:
27 */
diff --git a/arch/um/os-Linux/drivers/ethertap_kern.c b/arch/um/os-Linux/drivers/ethertap_kern.c
index 12689141414d..04f11b9f1ac0 100644
--- a/arch/um/os-Linux/drivers/ethertap_kern.c
+++ b/arch/um/os-Linux/drivers/ethertap_kern.c
@@ -1,16 +1,15 @@
1/* 1/*
2 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and 2 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and
3 * James Leu (jleu@mindspring.net). 3 * James Leu (jleu@mindspring.net).
4 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 * Copyright (C) 2001 by various other people who didn't put their name here. 5 * Copyright (C) 2001 by various other people who didn't put their name here.
5 * Licensed under the GPL. 6 * Licensed under the GPL.
6 */ 7 */
7 8
8#include "linux/init.h" 9#include "linux/init.h"
9#include "linux/netdevice.h" 10#include <linux/netdevice.h>
10#include "linux/etherdevice.h"
11#include "net_kern.h"
12#include "net_user.h"
13#include "etap.h" 11#include "etap.h"
12#include "net_kern.h"
14 13
15struct ethertap_init { 14struct ethertap_init {
16 char *dev_name; 15 char *dev_name;
@@ -37,32 +36,24 @@ static void etap_init(struct net_device *dev, void *data)
37 printk("\n"); 36 printk("\n");
38} 37}
39 38
40static int etap_read(int fd, struct sk_buff **skb, struct uml_net_private *lp) 39static int etap_read(int fd, struct sk_buff *skb, struct uml_net_private *lp)
41{ 40{
42 int len; 41 int len;
43 42
44 *skb = ether_adjust_skb(*skb, ETH_HEADER_ETHERTAP); 43 len = net_recvfrom(fd, skb_mac_header(skb),
45 if(*skb == NULL) return(-ENOMEM); 44 skb->dev->mtu + 2 + ETH_HEADER_ETHERTAP);
46 len = net_recvfrom(fd, skb_mac_header(*skb), 45 if (len <= 0)
47 (*skb)->dev->mtu + 2 * ETH_HEADER_ETHERTAP); 46 return(len);
48 if(len <= 0) return(len); 47
49 skb_pull(*skb, 2); 48 skb_pull(skb, 2);
50 len -= 2; 49 len -= 2;
51 return(len); 50 return len;
52} 51}
53 52
54static int etap_write(int fd, struct sk_buff **skb, struct uml_net_private *lp) 53static int etap_write(int fd, struct sk_buff *skb, struct uml_net_private *lp)
55{ 54{
56 if(skb_headroom(*skb) < 2){ 55 skb_push(skb, 2);
57 struct sk_buff *skb2; 56 return net_send(fd, skb->data, skb->len);
58
59 skb2 = skb_realloc_headroom(*skb, 2);
60 dev_kfree_skb(*skb);
61 if (skb2 == NULL) return(-ENOMEM);
62 *skb = skb2;
63 }
64 skb_push(*skb, 2);
65 return(net_send(fd, (*skb)->data, (*skb)->len));
66} 57}
67 58
68const struct net_kern_info ethertap_kern_info = { 59const struct net_kern_info ethertap_kern_info = {
@@ -79,15 +70,15 @@ int ethertap_setup(char *str, char **mac_out, void *data)
79 *init = ((struct ethertap_init) 70 *init = ((struct ethertap_init)
80 { .dev_name = NULL, 71 { .dev_name = NULL,
81 .gate_addr = NULL }); 72 .gate_addr = NULL });
82 if(tap_setup_common(str, "ethertap", &init->dev_name, mac_out, 73 if (tap_setup_common(str, "ethertap", &init->dev_name, mac_out,
83 &init->gate_addr)) 74 &init->gate_addr))
84 return(0); 75 return 0;
85 if(init->dev_name == NULL){ 76 if (init->dev_name == NULL) {
86 printk("ethertap_setup : Missing tap device name\n"); 77 printk(KERN_ERR "ethertap_setup : Missing tap device name\n");
87 return(0); 78 return 0;
88 } 79 }
89 80
90 return(1); 81 return 1;
91} 82}
92 83
93static struct transport ethertap_transport = { 84static struct transport ethertap_transport = {
@@ -97,6 +88,7 @@ static struct transport ethertap_transport = {
97 .user = &ethertap_user_info, 88 .user = &ethertap_user_info,
98 .kern = &ethertap_kern_info, 89 .kern = &ethertap_kern_info,
99 .private_size = sizeof(struct ethertap_data), 90 .private_size = sizeof(struct ethertap_data),
91 .setup_size = sizeof(struct ethertap_init),
100}; 92};
101 93
102static int register_ethertap(void) 94static int register_ethertap(void)
diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c
index 61d3953c7ac9..4ff553603449 100644
--- a/arch/um/os-Linux/drivers/ethertap_user.c
+++ b/arch/um/os-Linux/drivers/ethertap_user.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
2 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and 3 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and
3 * James Leu (jleu@mindspring.net). 4 * James Leu (jleu@mindspring.net).
4 * Copyright (C) 2001 by various other people who didn't put their name here. 5 * Copyright (C) 2001 by various other people who didn't put their name here.
@@ -7,20 +8,16 @@
7 8
8#include <stdio.h> 9#include <stdio.h>
9#include <unistd.h> 10#include <unistd.h>
10#include <stddef.h> 11#include <errno.h>
11#include <stdlib.h> 12#include <string.h>
12#include <sys/errno.h>
13#include <sys/socket.h> 13#include <sys/socket.h>
14#include <sys/wait.h> 14#include <sys/wait.h>
15#include <sys/un.h>
16#include <net/if.h>
17#include "user.h"
18#include "kern_util.h"
19#include "net_user.h"
20#include "etap.h" 15#include "etap.h"
16#include "kern_constants.h"
21#include "os.h" 17#include "os.h"
18#include "net_user.h"
22#include "um_malloc.h" 19#include "um_malloc.h"
23#include "kern_constants.h" 20#include "user.h"
24 21
25#define MAX_PACKET ETH_MAX_PACKET 22#define MAX_PACKET ETH_MAX_PACKET
26 23
@@ -49,16 +46,18 @@ static void etap_change(int op, unsigned char *addr, unsigned char *netmask,
49 memcpy(change.addr, addr, sizeof(change.addr)); 46 memcpy(change.addr, addr, sizeof(change.addr));
50 memcpy(change.netmask, netmask, sizeof(change.netmask)); 47 memcpy(change.netmask, netmask, sizeof(change.netmask));
51 CATCH_EINTR(n = write(fd, &change, sizeof(change))); 48 CATCH_EINTR(n = write(fd, &change, sizeof(change)));
52 if(n != sizeof(change)){ 49 if (n != sizeof(change)) {
53 printk("etap_change - request failed, err = %d\n", errno); 50 printk(UM_KERN_ERR "etap_change - request failed, err = %d\n",
51 errno);
54 return; 52 return;
55 } 53 }
56 54
57 output = kmalloc(UM_KERN_PAGE_SIZE, UM_GFP_KERNEL); 55 output = kmalloc(UM_KERN_PAGE_SIZE, UM_GFP_KERNEL);
58 if(output == NULL) 56 if (output == NULL)
59 printk("etap_change : Failed to allocate output buffer\n"); 57 printk(UM_KERN_ERR "etap_change : Failed to allocate output "
58 "buffer\n");
60 read_output(fd, output, UM_KERN_PAGE_SIZE); 59 read_output(fd, output, UM_KERN_PAGE_SIZE);
61 if(output != NULL){ 60 if (output != NULL) {
62 printk("%s", output); 61 printk("%s", output);
63 kfree(output); 62 kfree(output);
64 } 63 }
@@ -87,11 +86,11 @@ static void etap_pre_exec(void *arg)
87 struct etap_pre_exec_data *data = arg; 86 struct etap_pre_exec_data *data = arg;
88 87
89 dup2(data->control_remote, 1); 88 dup2(data->control_remote, 1);
90 os_close_file(data->data_me); 89 close(data->data_me);
91 os_close_file(data->control_me); 90 close(data->control_me);
92} 91}
93 92
94static int etap_tramp(char *dev, char *gate, int control_me, 93static int etap_tramp(char *dev, char *gate, int control_me,
95 int control_remote, int data_me, int data_remote) 94 int control_remote, int data_me, int data_remote)
96{ 95{
97 struct etap_pre_exec_data pe_data; 96 struct etap_pre_exec_data pe_data;
@@ -101,13 +100,13 @@ static int etap_tramp(char *dev, char *gate, int control_me,
101 char gate_buf[sizeof("nnn.nnn.nnn.nnn\0")]; 100 char gate_buf[sizeof("nnn.nnn.nnn.nnn\0")];
102 char *setup_args[] = { "uml_net", version_buf, "ethertap", dev, 101 char *setup_args[] = { "uml_net", version_buf, "ethertap", dev,
103 data_fd_buf, gate_buf, NULL }; 102 data_fd_buf, gate_buf, NULL };
104 char *nosetup_args[] = { "uml_net", version_buf, "ethertap", 103 char *nosetup_args[] = { "uml_net", version_buf, "ethertap",
105 dev, data_fd_buf, NULL }; 104 dev, data_fd_buf, NULL };
106 char **args, c; 105 char **args, c;
107 106
108 sprintf(data_fd_buf, "%d", data_remote); 107 sprintf(data_fd_buf, "%d", data_remote);
109 sprintf(version_buf, "%d", UML_NET_VERSION); 108 sprintf(version_buf, "%d", UML_NET_VERSION);
110 if(gate != NULL){ 109 if (gate != NULL) {
111 strcpy(gate_buf, gate); 110 strcpy(gate_buf, gate);
112 args = setup_args; 111 args = setup_args;
113 } 112 }
@@ -119,24 +118,26 @@ static int etap_tramp(char *dev, char *gate, int control_me,
119 pe_data.data_me = data_me; 118 pe_data.data_me = data_me;
120 pid = run_helper(etap_pre_exec, &pe_data, args); 119 pid = run_helper(etap_pre_exec, &pe_data, args);
121 120
122 if(pid < 0) 121 if (pid < 0)
123 err = pid; 122 err = pid;
124 os_close_file(data_remote); 123 close(data_remote);
125 os_close_file(control_remote); 124 close(control_remote);
126 CATCH_EINTR(n = read(control_me, &c, sizeof(c))); 125 CATCH_EINTR(n = read(control_me, &c, sizeof(c)));
127 if(n != sizeof(c)){ 126 if (n != sizeof(c)) {
128 err = -errno; 127 err = -errno;
129 printk("etap_tramp : read of status failed, err = %d\n", -err); 128 printk(UM_KERN_ERR "etap_tramp : read of status failed, "
129 "err = %d\n", -err);
130 return err; 130 return err;
131 } 131 }
132 if(c != 1){ 132 if (c != 1) {
133 printk("etap_tramp : uml_net failed\n"); 133 printk(UM_KERN_ERR "etap_tramp : uml_net failed\n");
134 err = -EINVAL; 134 err = -EINVAL;
135 CATCH_EINTR(n = waitpid(pid, &status, 0)); 135 CATCH_EINTR(n = waitpid(pid, &status, 0));
136 if(n < 0) 136 if (n < 0)
137 err = -errno; 137 err = -errno;
138 else if(!WIFEXITED(status) || (WEXITSTATUS(status) != 1)) 138 else if (!WIFEXITED(status) || (WEXITSTATUS(status) != 1))
139 printk("uml_net didn't exit with status 1\n"); 139 printk(UM_KERN_ERR "uml_net didn't exit with "
140 "status 1\n");
140 } 141 }
141 return err; 142 return err;
142} 143}
@@ -148,43 +149,56 @@ static int etap_open(void *data)
148 int data_fds[2], control_fds[2], err, output_len; 149 int data_fds[2], control_fds[2], err, output_len;
149 150
150 err = tap_open_common(pri->dev, pri->gate_addr); 151 err = tap_open_common(pri->dev, pri->gate_addr);
151 if(err) 152 if (err)
152 return err; 153 return err;
153 154
154 err = os_pipe(data_fds, 0, 0); 155 err = socketpair(AF_UNIX, SOCK_DGRAM, 0, data_fds);
155 if(err < 0){ 156 if (err) {
156 printk("data os_pipe failed - err = %d\n", -err); 157 err = -errno;
158 printk(UM_KERN_ERR "etap_open - data socketpair failed - "
159 "err = %d\n", errno);
157 return err; 160 return err;
158 } 161 }
159 162
160 err = os_pipe(control_fds, 1, 0); 163 err = socketpair(AF_UNIX, SOCK_STREAM, 0, control_fds);
161 if(err < 0){ 164 if (err) {
162 printk("control os_pipe failed - err = %d\n", -err); 165 err = -errno;
163 return err; 166 printk(UM_KERN_ERR "etap_open - control socketpair failed - "
167 "err = %d\n", errno);
168 goto out_close_data;
164 } 169 }
165 170
166 err = etap_tramp(pri->dev_name, pri->gate_addr, control_fds[0], 171 err = etap_tramp(pri->dev_name, pri->gate_addr, control_fds[0],
167 control_fds[1], data_fds[0], data_fds[1]); 172 control_fds[1], data_fds[0], data_fds[1]);
168 output_len = UM_KERN_PAGE_SIZE; 173 output_len = UM_KERN_PAGE_SIZE;
169 output = kmalloc(output_len, UM_GFP_KERNEL); 174 output = kmalloc(output_len, UM_GFP_KERNEL);
170 read_output(control_fds[0], output, output_len); 175 read_output(control_fds[0], output, output_len);
171 176
172 if(output == NULL) 177 if (output == NULL)
173 printk("etap_open : failed to allocate output buffer\n"); 178 printk(UM_KERN_ERR "etap_open : failed to allocate output "
179 "buffer\n");
174 else { 180 else {
175 printk("%s", output); 181 printk("%s", output);
176 kfree(output); 182 kfree(output);
177 } 183 }
178 184
179 if(err < 0){ 185 if (err < 0) {
180 printk("etap_tramp failed - err = %d\n", -err); 186 printk(UM_KERN_ERR "etap_tramp failed - err = %d\n", -err);
181 return err; 187 goto out_close_control;
182 } 188 }
183 189
184 pri->data_fd = data_fds[0]; 190 pri->data_fd = data_fds[0];
185 pri->control_fd = control_fds[0]; 191 pri->control_fd = control_fds[0];
186 iter_addresses(pri->dev, etap_open_addr, &pri->control_fd); 192 iter_addresses(pri->dev, etap_open_addr, &pri->control_fd);
187 return data_fds[0]; 193 return data_fds[0];
194
195out_close_control:
196 close(control_fds[0]);
197 close(control_fds[1]);
198out_close_data:
199 close(data_fds[0]);
200 close(data_fds[1]);
201 return err;
188} 202}
189 203
190static void etap_close(int fd, void *data) 204static void etap_close(int fd, void *data)
@@ -192,37 +206,41 @@ static void etap_close(int fd, void *data)
192 struct ethertap_data *pri = data; 206 struct ethertap_data *pri = data;
193 207
194 iter_addresses(pri->dev, etap_close_addr, &pri->control_fd); 208 iter_addresses(pri->dev, etap_close_addr, &pri->control_fd);
195 os_close_file(fd); 209 close(fd);
196 os_shutdown_socket(pri->data_fd, 1, 1); 210
197 os_close_file(pri->data_fd); 211 if (shutdown(pri->data_fd, SHUT_RDWR) < 0)
212 printk(UM_KERN_ERR "etap_close - shutdown data socket failed, "
213 "errno = %d\n", errno);
214
215 if (shutdown(pri->control_fd, SHUT_RDWR) < 0)
216 printk(UM_KERN_ERR "etap_close - shutdown control socket "
217 "failed, errno = %d\n", errno);
218
219 close(pri->data_fd);
198 pri->data_fd = -1; 220 pri->data_fd = -1;
199 os_close_file(pri->control_fd); 221 close(pri->control_fd);
200 pri->control_fd = -1; 222 pri->control_fd = -1;
201} 223}
202 224
203static int etap_set_mtu(int mtu, void *data)
204{
205 return mtu;
206}
207
208static void etap_add_addr(unsigned char *addr, unsigned char *netmask, 225static void etap_add_addr(unsigned char *addr, unsigned char *netmask,
209 void *data) 226 void *data)
210{ 227{
211 struct ethertap_data *pri = data; 228 struct ethertap_data *pri = data;
212 229
213 tap_check_ips(pri->gate_addr, addr); 230 tap_check_ips(pri->gate_addr, addr);
214 if(pri->control_fd == -1) 231 if (pri->control_fd == -1)
215 return; 232 return;
216 etap_open_addr(addr, netmask, &pri->control_fd); 233 etap_open_addr(addr, netmask, &pri->control_fd);
217} 234}
218 235
219static void etap_del_addr(unsigned char *addr, unsigned char *netmask, 236static void etap_del_addr(unsigned char *addr, unsigned char *netmask,
220 void *data) 237 void *data)
221{ 238{
222 struct ethertap_data *pri = data; 239 struct ethertap_data *pri = data;
223 240
224 if(pri->control_fd == -1) 241 if (pri->control_fd == -1)
225 return; 242 return;
243
226 etap_close_addr(addr, netmask, &pri->control_fd); 244 etap_close_addr(addr, netmask, &pri->control_fd);
227} 245}
228 246
@@ -231,8 +249,8 @@ const struct net_user_info ethertap_user_info = {
231 .open = etap_open, 249 .open = etap_open,
232 .close = etap_close, 250 .close = etap_close,
233 .remove = NULL, 251 .remove = NULL,
234 .set_mtu = etap_set_mtu,
235 .add_address = etap_add_addr, 252 .add_address = etap_add_addr,
236 .delete_address = etap_del_addr, 253 .delete_address = etap_del_addr,
237 .max_packet = MAX_PACKET - ETH_HEADER_ETHERTAP 254 .mtu = ETH_MAX_PACKET,
255 .max_packet = ETH_MAX_PACKET + ETH_HEADER_ETHERTAP,
238}; 256};
diff --git a/arch/um/os-Linux/drivers/tuntap.h b/arch/um/os-Linux/drivers/tuntap.h
index d3e8d3af6245..f17c31586c84 100644
--- a/arch/um/os-Linux/drivers/tuntap.h
+++ b/arch/um/os-Linux/drivers/tuntap.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -19,14 +19,3 @@ struct tuntap_data {
19extern const struct net_user_info tuntap_user_info; 19extern const struct net_user_info tuntap_user_info;
20 20
21#endif 21#endif
22
23/*
24 * Overrides for Emacs so that we follow Linus's tabbing style.
25 * Emacs will notice this stuff at the end of the file and automatically
26 * adjust the settings for this buffer only. This must remain at the end
27 * of the file.
28 * ---------------------------------------------------------------------------
29 * Local variables:
30 * c-file-style: "linux"
31 * End:
32 */
diff --git a/arch/um/os-Linux/drivers/tuntap_kern.c b/arch/um/os-Linux/drivers/tuntap_kern.c
index f1714e7fb1d0..9d384807b077 100644
--- a/arch/um/os-Linux/drivers/tuntap_kern.c
+++ b/arch/um/os-Linux/drivers/tuntap_kern.c
@@ -1,16 +1,13 @@
1/* 1/*
2 * Copyright (C) 2001 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/stddef.h" 6#include <linux/netdevice.h>
7#include "linux/netdevice.h" 7#include <linux/init.h>
8#include "linux/etherdevice.h" 8#include <linux/skbuff.h>
9#include "linux/skbuff.h" 9#include <asm/errno.h>
10#include "linux/init.h"
11#include "asm/errno.h"
12#include "net_kern.h" 10#include "net_kern.h"
13#include "net_user.h"
14#include "tuntap.h" 11#include "tuntap.h"
15 12
16struct tuntap_init { 13struct tuntap_init {
@@ -38,19 +35,15 @@ static void tuntap_init(struct net_device *dev, void *data)
38 printk("\n"); 35 printk("\n");
39} 36}
40 37
41static int tuntap_read(int fd, struct sk_buff **skb, 38static int tuntap_read(int fd, struct sk_buff *skb, struct uml_net_private *lp)
42 struct uml_net_private *lp)
43{ 39{
44 *skb = ether_adjust_skb(*skb, ETH_HEADER_OTHER); 40 return net_read(fd, skb_mac_header(skb),
45 if(*skb == NULL) return(-ENOMEM); 41 skb->dev->mtu + ETH_HEADER_OTHER);
46 return(net_read(fd, skb_mac_header(*skb),
47 (*skb)->dev->mtu + ETH_HEADER_OTHER));
48} 42}
49 43
50static int tuntap_write(int fd, struct sk_buff **skb, 44static int tuntap_write(int fd, struct sk_buff *skb, struct uml_net_private *lp)
51 struct uml_net_private *lp)
52{ 45{
53 return(net_write(fd, (*skb)->data, (*skb)->len)); 46 return net_write(fd, skb->data, skb->len);
54} 47}
55 48
56const struct net_kern_info tuntap_kern_info = { 49const struct net_kern_info tuntap_kern_info = {
@@ -67,11 +60,11 @@ int tuntap_setup(char *str, char **mac_out, void *data)
67 *init = ((struct tuntap_init) 60 *init = ((struct tuntap_init)
68 { .dev_name = NULL, 61 { .dev_name = NULL,
69 .gate_addr = NULL }); 62 .gate_addr = NULL });
70 if(tap_setup_common(str, "tuntap", &init->dev_name, mac_out, 63 if (tap_setup_common(str, "tuntap", &init->dev_name, mac_out,
71 &init->gate_addr)) 64 &init->gate_addr))
72 return(0); 65 return 0;
73 66
74 return(1); 67 return 1;
75} 68}
76 69
77static struct transport tuntap_transport = { 70static struct transport tuntap_transport = {
diff --git a/arch/um/os-Linux/drivers/tuntap_user.c b/arch/um/os-Linux/drivers/tuntap_user.c
index f848b4ea9343..6c55d3c8ead8 100644
--- a/arch/um/os-Linux/drivers/tuntap_user.c
+++ b/arch/um/os-Linux/drivers/tuntap_user.c
@@ -1,27 +1,22 @@
1/* 1/*
2 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stdio.h> 6#include <stdio.h>
7#include <stddef.h>
8#include <stdlib.h>
9#include <unistd.h> 7#include <unistd.h>
10#include <errno.h> 8#include <errno.h>
11#include <sys/wait.h> 9#include <string.h>
10#include <linux/if_tun.h>
11#include <net/if.h>
12#include <sys/ioctl.h>
12#include <sys/socket.h> 13#include <sys/socket.h>
13#include <sys/un.h> 14#include <sys/wait.h>
14#include <sys/uio.h> 15#include <sys/uio.h>
15#include <sys/ioctl.h> 16#include "kern_constants.h"
16#include <net/if.h> 17#include "os.h"
17#include <linux/if_tun.h>
18#include "net_user.h"
19#include "tuntap.h" 18#include "tuntap.h"
20#include "kern_util.h"
21#include "user.h" 19#include "user.h"
22#include "os.h"
23
24#define MAX_PACKET ETH_MAX_PACKET
25 20
26static int tuntap_user_init(void *data, void *dev) 21static int tuntap_user_init(void *data, void *dev)
27{ 22{
@@ -37,7 +32,7 @@ static void tuntap_add_addr(unsigned char *addr, unsigned char *netmask,
37 struct tuntap_data *pri = data; 32 struct tuntap_data *pri = data;
38 33
39 tap_check_ips(pri->gate_addr, addr); 34 tap_check_ips(pri->gate_addr, addr);
40 if((pri->fd == -1) || pri->fixed_config) 35 if ((pri->fd == -1) || pri->fixed_config)
41 return; 36 return;
42 open_addr(addr, netmask, pri->dev_name); 37 open_addr(addr, netmask, pri->dev_name);
43} 38}
@@ -47,7 +42,7 @@ static void tuntap_del_addr(unsigned char *addr, unsigned char *netmask,
47{ 42{
48 struct tuntap_data *pri = data; 43 struct tuntap_data *pri = data;
49 44
50 if((pri->fd == -1) || pri->fixed_config) 45 if ((pri->fd == -1) || pri->fixed_config)
51 return; 46 return;
52 close_addr(addr, netmask, pri->dev_name); 47 close_addr(addr, netmask, pri->dev_name);
53} 48}
@@ -62,7 +57,7 @@ static void tuntap_pre_exec(void *arg)
62 struct tuntap_pre_exec_data *data = arg; 57 struct tuntap_pre_exec_data *data = arg;
63 58
64 dup2(data->stdout, 1); 59 dup2(data->stdout, 1);
65 os_close_file(data->close_me); 60 close(data->close_me);
66} 61}
67 62
68static int tuntap_open_tramp(char *gate, int *fd_out, int me, int remote, 63static int tuntap_open_tramp(char *gate, int *fd_out, int me, int remote,
@@ -85,14 +80,14 @@ static int tuntap_open_tramp(char *gate, int *fd_out, int me, int remote,
85 80
86 pid = run_helper(tuntap_pre_exec, &data, argv); 81 pid = run_helper(tuntap_pre_exec, &data, argv);
87 82
88 if(pid < 0) 83 if (pid < 0)
89 return -pid; 84 return -pid;
90 85
91 os_close_file(remote); 86 close(remote);
92 87
93 msg.msg_name = NULL; 88 msg.msg_name = NULL;
94 msg.msg_namelen = 0; 89 msg.msg_namelen = 0;
95 if(buffer != NULL){ 90 if (buffer != NULL) {
96 iov = ((struct iovec) { buffer, buffer_len }); 91 iov = ((struct iovec) { buffer, buffer_len });
97 msg.msg_iov = &iov; 92 msg.msg_iov = &iov;
98 msg.msg_iovlen = 1; 93 msg.msg_iovlen = 1;
@@ -106,26 +101,28 @@ static int tuntap_open_tramp(char *gate, int *fd_out, int me, int remote,
106 msg.msg_flags = 0; 101 msg.msg_flags = 0;
107 n = recvmsg(me, &msg, 0); 102 n = recvmsg(me, &msg, 0);
108 *used_out = n; 103 *used_out = n;
109 if(n < 0){ 104 if (n < 0) {
110 err = -errno; 105 err = -errno;
111 printk("tuntap_open_tramp : recvmsg failed - errno = %d\n", 106 printk(UM_KERN_ERR "tuntap_open_tramp : recvmsg failed - "
112 errno); 107 "errno = %d\n", errno);
113 return err; 108 return err;
114 } 109 }
115 CATCH_EINTR(waitpid(pid, NULL, 0)); 110 CATCH_EINTR(waitpid(pid, NULL, 0));
116 111
117 cmsg = CMSG_FIRSTHDR(&msg); 112 cmsg = CMSG_FIRSTHDR(&msg);
118 if(cmsg == NULL){ 113 if (cmsg == NULL) {
119 printk("tuntap_open_tramp : didn't receive a message\n"); 114 printk(UM_KERN_ERR "tuntap_open_tramp : didn't receive a "
115 "message\n");
120 return -EINVAL; 116 return -EINVAL;
121 } 117 }
122 if((cmsg->cmsg_level != SOL_SOCKET) || 118 if ((cmsg->cmsg_level != SOL_SOCKET) ||
123 (cmsg->cmsg_type != SCM_RIGHTS)){ 119 (cmsg->cmsg_type != SCM_RIGHTS)) {
124 printk("tuntap_open_tramp : didn't receive a descriptor\n"); 120 printk(UM_KERN_ERR "tuntap_open_tramp : didn't receive a "
121 "descriptor\n");
125 return -EINVAL; 122 return -EINVAL;
126 } 123 }
127 *fd_out = ((int *) CMSG_DATA(cmsg))[0]; 124 *fd_out = ((int *) CMSG_DATA(cmsg))[0];
128 os_set_exec_close(*fd_out, 1); 125 os_set_exec_close(*fd_out);
129 return 0; 126 return 0;
130} 127}
131 128
@@ -137,47 +134,51 @@ static int tuntap_open(void *data)
137 int err, fds[2], len, used; 134 int err, fds[2], len, used;
138 135
139 err = tap_open_common(pri->dev, pri->gate_addr); 136 err = tap_open_common(pri->dev, pri->gate_addr);
140 if(err < 0) 137 if (err < 0)
141 return err; 138 return err;
142 139
143 if(pri->fixed_config){ 140 if (pri->fixed_config) {
144 pri->fd = os_open_file("/dev/net/tun", 141 pri->fd = os_open_file("/dev/net/tun",
145 of_cloexec(of_rdwr(OPENFLAGS())), 0); 142 of_cloexec(of_rdwr(OPENFLAGS())), 0);
146 if(pri->fd < 0){ 143 if (pri->fd < 0) {
147 printk("Failed to open /dev/net/tun, err = %d\n", 144 printk(UM_KERN_ERR "Failed to open /dev/net/tun, "
148 -pri->fd); 145 "err = %d\n", -pri->fd);
149 return pri->fd; 146 return pri->fd;
150 } 147 }
151 memset(&ifr, 0, sizeof(ifr)); 148 memset(&ifr, 0, sizeof(ifr));
152 ifr.ifr_flags = IFF_TAP | IFF_NO_PI; 149 ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
153 strlcpy(ifr.ifr_name, pri->dev_name, sizeof(ifr.ifr_name)); 150 strlcpy(ifr.ifr_name, pri->dev_name, sizeof(ifr.ifr_name));
154 if(ioctl(pri->fd, TUNSETIFF, (void *) &ifr) < 0){ 151 if (ioctl(pri->fd, TUNSETIFF, (void *) &ifr) < 0) {
155 err = -errno; 152 err = -errno;
156 printk("TUNSETIFF failed, errno = %d\n", errno); 153 printk(UM_KERN_ERR "TUNSETIFF failed, errno = %d\n",
157 os_close_file(pri->fd); 154 errno);
155 close(pri->fd);
158 return err; 156 return err;
159 } 157 }
160 } 158 }
161 else { 159 else {
162 err = os_pipe(fds, 0, 0); 160 err = socketpair(AF_UNIX, SOCK_DGRAM, 0, fds);
163 if(err < 0){ 161 if (err) {
164 printk("tuntap_open : os_pipe failed - err = %d\n", 162 err = -errno;
165 -err); 163 printk(UM_KERN_ERR "tuntap_open : socketpair failed - "
164 "errno = %d\n", errno);
166 return err; 165 return err;
167 } 166 }
168 167
169 buffer = get_output_buffer(&len); 168 buffer = get_output_buffer(&len);
170 if(buffer != NULL) len--; 169 if (buffer != NULL)
170 len--;
171 used = 0; 171 used = 0;
172 172
173 err = tuntap_open_tramp(pri->gate_addr, &pri->fd, fds[0], 173 err = tuntap_open_tramp(pri->gate_addr, &pri->fd, fds[0],
174 fds[1], buffer, len, &used); 174 fds[1], buffer, len, &used);
175 175
176 output = buffer; 176 output = buffer;
177 if(err < 0) { 177 if (err < 0) {
178 printk("%s", output); 178 printk("%s", output);
179 free_output_buffer(buffer); 179 free_output_buffer(buffer);
180 printk("tuntap_open_tramp failed - err = %d\n", -err); 180 printk(UM_KERN_ERR "tuntap_open_tramp failed - "
181 "err = %d\n", -err);
181 return err; 182 return err;
182 } 183 }
183 184
@@ -186,7 +187,7 @@ static int tuntap_open(void *data)
186 printk("%s", output); 187 printk("%s", output);
187 free_output_buffer(buffer); 188 free_output_buffer(buffer);
188 189
189 os_close_file(fds[0]); 190 close(fds[0]);
190 iter_addresses(pri->dev, open_addr, pri->dev_name); 191 iter_addresses(pri->dev, open_addr, pri->dev_name);
191 } 192 }
192 193
@@ -197,24 +198,19 @@ static void tuntap_close(int fd, void *data)
197{ 198{
198 struct tuntap_data *pri = data; 199 struct tuntap_data *pri = data;
199 200
200 if(!pri->fixed_config) 201 if (!pri->fixed_config)
201 iter_addresses(pri->dev, close_addr, pri->dev_name); 202 iter_addresses(pri->dev, close_addr, pri->dev_name);
202 os_close_file(fd); 203 close(fd);
203 pri->fd = -1; 204 pri->fd = -1;
204} 205}
205 206
206static int tuntap_set_mtu(int mtu, void *data)
207{
208 return mtu;
209}
210
211const struct net_user_info tuntap_user_info = { 207const struct net_user_info tuntap_user_info = {
212 .init = tuntap_user_init, 208 .init = tuntap_user_init,
213 .open = tuntap_open, 209 .open = tuntap_open,
214 .close = tuntap_close, 210 .close = tuntap_close,
215 .remove = NULL, 211 .remove = NULL,
216 .set_mtu = tuntap_set_mtu,
217 .add_address = tuntap_add_addr, 212 .add_address = tuntap_add_addr,
218 .delete_address = tuntap_del_addr, 213 .delete_address = tuntap_del_addr,
219 .max_packet = MAX_PACKET 214 .mtu = ETH_MAX_PACKET,
215 .max_packet = ETH_MAX_PACKET + ETH_HEADER_OTHER,
220}; 216};
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
index c3ecc2a84e0c..b542a3a021bf 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
@@ -82,13 +82,6 @@ int os_access(const char* file, int mode)
82 return 0; 82 return 0;
83} 83}
84 84
85void os_print_error(int error, const char* str)
86{
87 errno = error < 0 ? -error : error;
88
89 perror(str);
90}
91
92/* FIXME? required only by hostaudio (because it passes ioctls verbatim) */ 85/* FIXME? required only by hostaudio (because it passes ioctls verbatim) */
93int os_ioctl_generic(int fd, unsigned int cmd, unsigned long arg) 86int os_ioctl_generic(int fd, unsigned int cmd, unsigned long arg)
94{ 87{
@@ -101,30 +94,6 @@ int os_ioctl_generic(int fd, unsigned int cmd, unsigned long arg)
101 return err; 94 return err;
102} 95}
103 96
104int os_window_size(int fd, int *rows, int *cols)
105{
106 struct winsize size;
107
108 if(ioctl(fd, TIOCGWINSZ, &size) < 0)
109 return -errno;
110
111 *rows = size.ws_row;
112 *cols = size.ws_col;
113
114 return 0;
115}
116
117int os_new_tty_pgrp(int fd, int pid)
118{
119 if(ioctl(fd, TIOCSCTTY, 0) < 0)
120 return -errno;
121
122 if(tcsetpgrp(fd, pid) < 0)
123 return -errno;
124
125 return 0;
126}
127
128/* FIXME: ensure namebuf in os_get_if_name is big enough */ 97/* FIXME: ensure namebuf in os_get_if_name is big enough */
129int os_get_ifname(int fd, char* namebuf) 98int os_get_ifname(int fd, char* namebuf)
130{ 99{
@@ -205,19 +174,19 @@ int os_file_mode(char *file, struct openflags *mode_out)
205 174
206 *mode_out = OPENFLAGS(); 175 *mode_out = OPENFLAGS();
207 176
208 err = os_access(file, OS_ACC_W_OK); 177 err = access(file, W_OK);
209 if((err < 0) && (err != -EACCES)) 178 if(err && (errno != EACCES))
210 return(err); 179 return -errno;
211 180 else if(!err)
212 *mode_out = of_write(*mode_out); 181 *mode_out = of_write(*mode_out);
213
214 err = os_access(file, OS_ACC_R_OK);
215 if((err < 0) && (err != -EACCES))
216 return(err);
217 182
218 *mode_out = of_read(*mode_out); 183 err = access(file, R_OK);
184 if(err && (errno != EACCES))
185 return -errno;
186 else if(!err)
187 *mode_out = of_read(*mode_out);
219 188
220 return(0); 189 return err;
221} 190}
222 191
223int os_open_file(char *file, struct openflags flags, int mode) 192int os_open_file(char *file, struct openflags flags, int mode)
@@ -236,15 +205,15 @@ int os_open_file(char *file, struct openflags flags, int mode)
236 205
237 fd = open64(file, f, mode); 206 fd = open64(file, f, mode);
238 if(fd < 0) 207 if(fd < 0)
239 return(-errno); 208 return -errno;
240 209
241 if(flags.cl && fcntl(fd, F_SETFD, 1)){ 210 if(flags.cl && fcntl(fd, F_SETFD, 1)){
242 err = -errno; 211 err = -errno;
243 os_close_file(fd); 212 close(fd);
244 return err; 213 return err;
245 } 214 }
246 215
247 return(fd); 216 return fd;
248} 217}
249 218
250int os_connect_socket(char *name) 219int os_connect_socket(char *name)
@@ -280,9 +249,9 @@ void os_close_file(int fd)
280 close(fd); 249 close(fd);
281} 250}
282 251
283int os_seek_file(int fd, __u64 offset) 252int os_seek_file(int fd, unsigned long long offset)
284{ 253{
285 __u64 actual; 254 unsigned long long actual;
286 255
287 actual = lseek64(fd, offset, SEEK_SET); 256 actual = lseek64(fd, offset, SEEK_SET);
288 if(actual != offset) 257 if(actual != offset)
@@ -316,31 +285,33 @@ int os_file_size(char *file, unsigned long long *size_out)
316 err = os_stat_file(file, &buf); 285 err = os_stat_file(file, &buf);
317 if(err < 0){ 286 if(err < 0){
318 printk("Couldn't stat \"%s\" : err = %d\n", file, -err); 287 printk("Couldn't stat \"%s\" : err = %d\n", file, -err);
319 return(err); 288 return err;
320 } 289 }
321 290
322 if(S_ISBLK(buf.ust_mode)){ 291 if(S_ISBLK(buf.ust_mode)){
323 int fd; 292 int fd;
324 long blocks; 293 long blocks;
325 294
326 fd = os_open_file(file, of_read(OPENFLAGS()), 0); 295 fd = open(file, O_RDONLY, 0);
327 if(fd < 0){ 296 if(fd < 0) {
328 printk("Couldn't open \"%s\", errno = %d\n", file, -fd); 297 err = -errno;
329 return(fd); 298 printk("Couldn't open \"%s\", errno = %d\n", file,
299 errno);
300 return err;
330 } 301 }
331 if(ioctl(fd, BLKGETSIZE, &blocks) < 0){ 302 if(ioctl(fd, BLKGETSIZE, &blocks) < 0){
332 err = -errno; 303 err = -errno;
333 printk("Couldn't get the block size of \"%s\", " 304 printk("Couldn't get the block size of \"%s\", "
334 "errno = %d\n", file, errno); 305 "errno = %d\n", file, errno);
335 os_close_file(fd); 306 close(fd);
336 return(err); 307 return err;
337 } 308 }
338 *size_out = ((long long) blocks) * 512; 309 *size_out = ((long long) blocks) * 512;
339 os_close_file(fd); 310 close(fd);
340 return(0);
341 } 311 }
342 *size_out = buf.ust_size; 312 else *size_out = buf.ust_size;
343 return(0); 313
314 return 0;
344} 315}
345 316
346int os_file_modtime(char *file, unsigned long *modtime) 317int os_file_modtime(char *file, unsigned long *modtime)
@@ -358,35 +329,28 @@ int os_file_modtime(char *file, unsigned long *modtime)
358 return 0; 329 return 0;
359} 330}
360 331
361int os_get_exec_close(int fd, int* close_on_exec) 332int os_get_exec_close(int fd, int *close_on_exec)
362{ 333{
363 int ret; 334 int ret;
364 335
365 do { 336 CATCH_EINTR(ret = fcntl(fd, F_GETFD));
366 ret = fcntl(fd, F_GETFD);
367 } while((ret < 0) && (errno == EINTR)) ;
368 337
369 if(ret < 0) 338 if(ret < 0)
370 return(-errno); 339 return -errno;
371 340
372 *close_on_exec = (ret&FD_CLOEXEC) ? 1 : 0; 341 *close_on_exec = (ret & FD_CLOEXEC) ? 1 : 0;
373 return(ret); 342 return ret;
374} 343}
375 344
376int os_set_exec_close(int fd, int close_on_exec) 345int os_set_exec_close(int fd)
377{ 346{
378 int flag, err; 347 int err;
379
380 if(close_on_exec) flag = FD_CLOEXEC;
381 else flag = 0;
382 348
383 do { 349 CATCH_EINTR(err = fcntl(fd, F_SETFD, FD_CLOEXEC));
384 err = fcntl(fd, F_SETFD, flag);
385 } while((err < 0) && (errno == EINTR)) ;
386 350
387 if(err < 0) 351 if(err < 0)
388 return(-errno); 352 return -errno;
389 return(err); 353 return err;
390} 354}
391 355
392int os_pipe(int *fds, int stream, int close_on_exec) 356int os_pipe(int *fds, int stream, int close_on_exec)
@@ -395,16 +359,16 @@ int os_pipe(int *fds, int stream, int close_on_exec)
395 359
396 err = socketpair(AF_UNIX, type, 0, fds); 360 err = socketpair(AF_UNIX, type, 0, fds);
397 if(err < 0) 361 if(err < 0)
398 return(-errno); 362 return -errno;
399 363
400 if(!close_on_exec) 364 if(!close_on_exec)
401 return(0); 365 return 0;
402 366
403 err = os_set_exec_close(fds[0], 1); 367 err = os_set_exec_close(fds[0]);
404 if(err < 0) 368 if(err < 0)
405 goto error; 369 goto error;
406 370
407 err = os_set_exec_close(fds[1], 1); 371 err = os_set_exec_close(fds[1]);
408 if(err < 0) 372 if(err < 0)
409 goto error; 373 goto error;
410 374
@@ -412,9 +376,9 @@ int os_pipe(int *fds, int stream, int close_on_exec)
412 376
413 error: 377 error:
414 printk("os_pipe : Setting FD_CLOEXEC failed, err = %d\n", -err); 378 printk("os_pipe : Setting FD_CLOEXEC failed, err = %d\n", -err);
415 os_close_file(fds[1]); 379 close(fds[1]);
416 os_close_file(fds[0]); 380 close(fds[0]);
417 return(err); 381 return err;
418} 382}
419 383
420int os_set_fd_async(int fd, int owner) 384int os_set_fd_async(int fd, int owner)
@@ -561,7 +525,7 @@ int os_create_unix_socket(char *file, int len, int close_on_exec)
561 return -errno; 525 return -errno;
562 526
563 if(close_on_exec) { 527 if(close_on_exec) {
564 err = os_set_exec_close(sock, 1); 528 err = os_set_exec_close(sock);
565 if(err < 0) 529 if(err < 0)
566 printk("create_unix_socket : close_on_exec failed, " 530 printk("create_unix_socket : close_on_exec failed, "
567 "err = %d", -err); 531 "err = %d", -err);
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
index d81af7b8587a..7a72dbb61b0d 100644
--- a/arch/um/os-Linux/helper.c
+++ b/arch/um/os-Linux/helper.c
@@ -11,6 +11,7 @@
11#include <limits.h> 11#include <limits.h>
12#include <sys/signal.h> 12#include <sys/signal.h>
13#include <sys/wait.h> 13#include <sys/wait.h>
14#include <sys/socket.h>
14#include "user.h" 15#include "user.h"
15#include "kern_util.h" 16#include "kern_util.h"
16#include "os.h" 17#include "os.h"
@@ -54,13 +55,14 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv)
54 if (stack == 0) 55 if (stack == 0)
55 return -ENOMEM; 56 return -ENOMEM;
56 57
57 ret = os_pipe(fds, 1, 0); 58 ret = socketpair(AF_UNIX, SOCK_STREAM, 0, fds);
58 if (ret < 0) { 59 if (ret < 0) {
59 printk("run_helper : pipe failed, ret = %d\n", -ret); 60 ret = -errno;
61 printk("run_helper : pipe failed, errno = %d\n", errno);
60 goto out_free; 62 goto out_free;
61 } 63 }
62 64
63 ret = os_set_exec_close(fds[1], 1); 65 ret = os_set_exec_close(fds[1]);
64 if (ret < 0) { 66 if (ret < 0) {
65 printk("run_helper : setting FD_CLOEXEC failed, ret = %d\n", 67 printk("run_helper : setting FD_CLOEXEC failed, ret = %d\n",
66 -ret); 68 -ret);
diff --git a/arch/um/os-Linux/irq.c b/arch/um/os-Linux/irq.c
index a633fa8e0a94..6aa6f95d6524 100644
--- a/arch/um/os-Linux/irq.c
+++ b/arch/um/os-Linux/irq.c
@@ -145,11 +145,7 @@ void init_irq_signals(int on_sigstack)
145 145
146 flags = on_sigstack ? SA_ONSTACK : 0; 146 flags = on_sigstack ? SA_ONSTACK : 0;
147 147
148 set_handler(SIGVTALRM, (__sighandler_t) alarm_handler,
149 flags | SA_RESTART, SIGUSR1, SIGIO, SIGWINCH, SIGALRM, -1);
150 set_handler(SIGALRM, (__sighandler_t) alarm_handler,
151 flags | SA_RESTART, SIGUSR1, SIGIO, SIGWINCH, SIGALRM, -1);
152 set_handler(SIGIO, (__sighandler_t) sig_handler, flags | SA_RESTART, 148 set_handler(SIGIO, (__sighandler_t) sig_handler, flags | SA_RESTART,
153 SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); 149 SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
154 signal(SIGWINCH, SIG_IGN); 150 signal(SIGWINCH, SIG_IGN);
155} 151}
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index e85f4995a011..82c3778627b8 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -1,33 +1,21 @@
1/* 1/*
2 * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <unistd.h>
7#include <stdio.h> 6#include <stdio.h>
8#include <stdlib.h> 7#include <stdlib.h>
9#include <string.h> 8#include <unistd.h>
10#include <signal.h>
11#include <errno.h> 9#include <errno.h>
10#include <signal.h>
11#include <string.h>
12#include <sys/resource.h> 12#include <sys/resource.h>
13#include <sys/mman.h>
14#include <sys/user.h>
15#include <asm/page.h>
16#include "kern_util.h"
17#include "as-layout.h" 13#include "as-layout.h"
18#include "mem_user.h"
19#include "irq_user.h"
20#include "user.h"
21#include "init.h" 14#include "init.h"
22#include "mode.h" 15#include "kern_constants.h"
23#include "choose-mode.h" 16#include "kern_util.h"
24#include "uml-config.h"
25#include "os.h" 17#include "os.h"
26#include "um_malloc.h" 18#include "um_malloc.h"
27#include "kern_constants.h"
28
29/* Set in main, unchanged thereafter */
30char *linux_prog;
31 19
32#define PGD_BOUND (4 * 1024 * 1024) 20#define PGD_BOUND (4 * 1024 * 1024)
33#define STACKSIZE (8 * 1024 * 1024) 21#define STACKSIZE (8 * 1024 * 1024)
@@ -37,13 +25,13 @@ static void set_stklim(void)
37{ 25{
38 struct rlimit lim; 26 struct rlimit lim;
39 27
40 if(getrlimit(RLIMIT_STACK, &lim) < 0){ 28 if (getrlimit(RLIMIT_STACK, &lim) < 0) {
41 perror("getrlimit"); 29 perror("getrlimit");
42 exit(1); 30 exit(1);
43 } 31 }
44 if((lim.rlim_cur == RLIM_INFINITY) || (lim.rlim_cur > STACKSIZE)){ 32 if ((lim.rlim_cur == RLIM_INFINITY) || (lim.rlim_cur > STACKSIZE)) {
45 lim.rlim_cur = STACKSIZE; 33 lim.rlim_cur = STACKSIZE;
46 if(setrlimit(RLIMIT_STACK, &lim) < 0){ 34 if (setrlimit(RLIMIT_STACK, &lim) < 0) {
47 perror("setrlimit"); 35 perror("setrlimit");
48 exit(1); 36 exit(1);
49 } 37 }
@@ -55,7 +43,7 @@ static __init void do_uml_initcalls(void)
55 initcall_t *call; 43 initcall_t *call;
56 44
57 call = &__uml_initcall_start; 45 call = &__uml_initcall_start;
58 while (call < &__uml_initcall_end){ 46 while (call < &__uml_initcall_end) {
59 (*call)(); 47 (*call)();
60 call++; 48 call++;
61 } 49 }
@@ -74,7 +62,8 @@ static void install_fatal_handler(int sig)
74 /* All signals are enabled in this handler ... */ 62 /* All signals are enabled in this handler ... */
75 sigemptyset(&action.sa_mask); 63 sigemptyset(&action.sa_mask);
76 64
77 /* ... including the signal being handled, plus we want the 65 /*
66 * ... including the signal being handled, plus we want the
78 * handler reset to the default behavior, so that if an exit 67 * handler reset to the default behavior, so that if an exit
79 * handler is hanging for some reason, the UML will just die 68 * handler is hanging for some reason, the UML will just die
80 * after this signal is sent a second time. 69 * after this signal is sent a second time.
@@ -82,7 +71,7 @@ static void install_fatal_handler(int sig)
82 action.sa_flags = SA_RESETHAND | SA_NODEFER; 71 action.sa_flags = SA_RESETHAND | SA_NODEFER;
83 action.sa_restorer = NULL; 72 action.sa_restorer = NULL;
84 action.sa_handler = last_ditch_exit; 73 action.sa_handler = last_ditch_exit;
85 if(sigaction(sig, &action, NULL) < 0){ 74 if (sigaction(sig, &action, NULL) < 0) {
86 printf("failed to install handler for signal %d - errno = %d\n", 75 printf("failed to install handler for signal %d - errno = %d\n",
87 errno); 76 errno);
88 exit(1); 77 exit(1);
@@ -98,7 +87,8 @@ static void setup_env_path(void)
98 int path_len = 0; 87 int path_len = 0;
99 88
100 old_path = getenv("PATH"); 89 old_path = getenv("PATH");
101 /* if no PATH variable is set or it has an empty value 90 /*
91 * if no PATH variable is set or it has an empty value
102 * just use the default + /usr/lib/uml 92 * just use the default + /usr/lib/uml
103 */ 93 */
104 if (!old_path || (path_len = strlen(old_path)) == 0) { 94 if (!old_path || (path_len = strlen(old_path)) == 0) {
@@ -126,93 +116,68 @@ int __init main(int argc, char **argv, char **envp)
126 char **new_argv; 116 char **new_argv;
127 int ret, i, err; 117 int ret, i, err;
128 118
129#ifdef UML_CONFIG_CMDLINE_ON_HOST
130 /* Allocate memory for thread command lines */
131 if(argc < 2 || strlen(argv[1]) < THREAD_NAME_LEN - 1){
132
133 char padding[THREAD_NAME_LEN] = {
134 [ 0 ... THREAD_NAME_LEN - 2] = ' ', '\0'
135 };
136
137 new_argv = malloc((argc + 2) * sizeof(char*));
138 if(!new_argv) {
139 perror("Allocating extended argv");
140 exit(1);
141 }
142
143 new_argv[0] = argv[0];
144 new_argv[1] = padding;
145
146 for(i = 2; i <= argc; i++)
147 new_argv[i] = argv[i - 1];
148 new_argv[argc + 1] = NULL;
149
150 execvp(new_argv[0], new_argv);
151 perror("execing with extended args");
152 exit(1);
153 }
154#endif
155
156 linux_prog = argv[0];
157
158 set_stklim(); 119 set_stklim();
159 120
160 setup_env_path(); 121 setup_env_path();
161 122
162 new_argv = malloc((argc + 1) * sizeof(char *)); 123 new_argv = malloc((argc + 1) * sizeof(char *));
163 if(new_argv == NULL){ 124 if (new_argv == NULL) {
164 perror("Mallocing argv"); 125 perror("Mallocing argv");
165 exit(1); 126 exit(1);
166 } 127 }
167 for(i=0;i<argc;i++){ 128 for (i = 0; i < argc; i++) {
168 new_argv[i] = strdup(argv[i]); 129 new_argv[i] = strdup(argv[i]);
169 if(new_argv[i] == NULL){ 130 if (new_argv[i] == NULL) {
170 perror("Mallocing an arg"); 131 perror("Mallocing an arg");
171 exit(1); 132 exit(1);
172 } 133 }
173 } 134 }
174 new_argv[argc] = NULL; 135 new_argv[argc] = NULL;
175 136
176 /* Allow these signals to bring down a UML if all other 137 /*
138 * Allow these signals to bring down a UML if all other
177 * methods of control fail. 139 * methods of control fail.
178 */ 140 */
179 install_fatal_handler(SIGINT); 141 install_fatal_handler(SIGINT);
180 install_fatal_handler(SIGTERM); 142 install_fatal_handler(SIGTERM);
181 install_fatal_handler(SIGHUP); 143 install_fatal_handler(SIGHUP);
182 144
183 scan_elf_aux( envp); 145 scan_elf_aux(envp);
184 146
185 do_uml_initcalls(); 147 do_uml_initcalls();
186 ret = linux_main(argc, argv); 148 ret = linux_main(argc, argv);
187 149
188 /* Disable SIGPROF - I have no idea why libc doesn't do this or turn 150 /*
151 * Disable SIGPROF - I have no idea why libc doesn't do this or turn
189 * off the profiling time, but UML dies with a SIGPROF just before 152 * off the profiling time, but UML dies with a SIGPROF just before
190 * exiting when profiling is active. 153 * exiting when profiling is active.
191 */ 154 */
192 change_sig(SIGPROF, 0); 155 change_sig(SIGPROF, 0);
193 156
194 /* This signal stuff used to be in the reboot case. However, 157 /*
158 * This signal stuff used to be in the reboot case. However,
195 * sometimes a SIGVTALRM can come in when we're halting (reproducably 159 * sometimes a SIGVTALRM can come in when we're halting (reproducably
196 * when writing out gcov information, presumably because that takes 160 * when writing out gcov information, presumably because that takes
197 * some time) and cause a segfault. 161 * some time) and cause a segfault.
198 */ 162 */
199 163
200 /* stop timers and set SIG*ALRM to be ignored */ 164 /* stop timers and set SIGVTALRM to be ignored */
201 disable_timer(); 165 disable_timer();
202 166
203 /* disable SIGIO for the fds and set SIGIO to be ignored */ 167 /* disable SIGIO for the fds and set SIGIO to be ignored */
204 err = deactivate_all_fds(); 168 err = deactivate_all_fds();
205 if(err) 169 if (err)
206 printf("deactivate_all_fds failed, errno = %d\n", -err); 170 printf("deactivate_all_fds failed, errno = %d\n", -err);
207 171
208 /* Let any pending signals fire now. This ensures 172 /*
173 * Let any pending signals fire now. This ensures
209 * that they won't be delivered after the exec, when 174 * that they won't be delivered after the exec, when
210 * they are definitely not expected. 175 * they are definitely not expected.
211 */ 176 */
212 unblock_signals(); 177 unblock_signals();
213 178
214 /* Reboot */ 179 /* Reboot */
215 if(ret){ 180 if (ret) {
216 printf("\n"); 181 printf("\n");
217 execvp(new_argv[0], new_argv); 182 execvp(new_argv[0], new_argv);
218 perror("Failed to exec kernel"); 183 perror("Failed to exec kernel");
@@ -222,26 +187,24 @@ int __init main(int argc, char **argv, char **envp)
222 return uml_exitcode; 187 return uml_exitcode;
223} 188}
224 189
225#define CAN_KMALLOC() \
226 (kmalloc_ok && CHOOSE_MODE((os_getpid() != tracing_pid), 1))
227
228extern void *__real_malloc(int); 190extern void *__real_malloc(int);
229 191
230void *__wrap_malloc(int size) 192void *__wrap_malloc(int size)
231{ 193{
232 void *ret; 194 void *ret;
233 195
234 if(!CAN_KMALLOC()) 196 if (!kmalloc_ok)
235 return __real_malloc(size); 197 return __real_malloc(size);
236 else if(size <= UM_KERN_PAGE_SIZE) 198 else if (size <= UM_KERN_PAGE_SIZE)
237 /* finding contiguous pages can be hard*/ 199 /* finding contiguous pages can be hard*/
238 ret = kmalloc(size, UM_GFP_KERNEL); 200 ret = kmalloc(size, UM_GFP_KERNEL);
239 else ret = vmalloc(size); 201 else ret = vmalloc(size);
240 202
241 /* glibc people insist that if malloc fails, errno should be 203 /*
204 * glibc people insist that if malloc fails, errno should be
242 * set by malloc as well. So we do. 205 * set by malloc as well. So we do.
243 */ 206 */
244 if(ret == NULL) 207 if (ret == NULL)
245 errno = ENOMEM; 208 errno = ENOMEM;
246 209
247 return ret; 210 return ret;
@@ -251,7 +214,7 @@ void *__wrap_calloc(int n, int size)
251{ 214{
252 void *ptr = __wrap_malloc(n * size); 215 void *ptr = __wrap_malloc(n * size);
253 216
254 if(ptr == NULL) 217 if (ptr == NULL)
255 return NULL; 218 return NULL;
256 memset(ptr, 0, n * size); 219 memset(ptr, 0, n * size);
257 return ptr; 220 return ptr;
@@ -265,7 +228,8 @@ void __wrap_free(void *ptr)
265{ 228{
266 unsigned long addr = (unsigned long) ptr; 229 unsigned long addr = (unsigned long) ptr;
267 230
268 /* We need to know how the allocation happened, so it can be correctly 231 /*
232 * We need to know how the allocation happened, so it can be correctly
269 * freed. This is done by seeing what region of memory the pointer is 233 * freed. This is done by seeing what region of memory the pointer is
270 * in - 234 * in -
271 * physical memory - kmalloc/kfree 235 * physical memory - kmalloc/kfree
@@ -283,12 +247,12 @@ void __wrap_free(void *ptr)
283 * there is a possibility for memory leaks. 247 * there is a possibility for memory leaks.
284 */ 248 */
285 249
286 if((addr >= uml_physmem) && (addr < high_physmem)){ 250 if ((addr >= uml_physmem) && (addr < high_physmem)) {
287 if(CAN_KMALLOC()) 251 if (kmalloc_ok)
288 kfree(ptr); 252 kfree(ptr);
289 } 253 }
290 else if((addr >= start_vm) && (addr < end_vm)){ 254 else if ((addr >= start_vm) && (addr < end_vm)) {
291 if(CAN_KMALLOC()) 255 if (kmalloc_ok)
292 vfree(ptr); 256 vfree(ptr);
293 } 257 }
294 else __real_free(ptr); 258 else __real_free(ptr);
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
index c6378c6d10d2..436f8d20b20f 100644
--- a/arch/um/os-Linux/mem.c
+++ b/arch/um/os-Linux/mem.c
@@ -218,7 +218,7 @@ int __init create_tmp_file(unsigned long long len)
218 218
219 err = fchmod(fd, 0777); 219 err = fchmod(fd, 0777);
220 if(err < 0){ 220 if(err < 0){
221 perror("os_mode_fd"); 221 perror("fchmod");
222 exit(1); 222 exit(1);
223 } 223 }
224 224
@@ -226,7 +226,7 @@ int __init create_tmp_file(unsigned long long len)
226 * increase the file size by one byte, to the desired length. 226 * increase the file size by one byte, to the desired length.
227 */ 227 */
228 if (lseek64(fd, len - 1, SEEK_SET) < 0) { 228 if (lseek64(fd, len - 1, SEEK_SET) < 0) {
229 perror("os_seek_file"); 229 perror("lseek64");
230 exit(1); 230 exit(1);
231 } 231 }
232 232
@@ -247,7 +247,7 @@ int __init create_mem_file(unsigned long long len)
247 247
248 fd = create_tmp_file(len); 248 fd = create_tmp_file(len);
249 249
250 err = os_set_exec_close(fd, 1); 250 err = os_set_exec_close(fd);
251 if(err < 0){ 251 if(err < 0){
252 errno = -err; 252 errno = -err;
253 perror("exec_close"); 253 perror("exec_close");
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index e9c143297512..37781db4ceca 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -1,27 +1,24 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <unistd.h>
7#include <stdio.h> 6#include <stdio.h>
7#include <unistd.h>
8#include <errno.h> 8#include <errno.h>
9#include <signal.h> 9#include <signal.h>
10#include <fcntl.h>
10#include <sys/mman.h> 11#include <sys/mman.h>
12#include <sys/ptrace.h>
11#include <sys/wait.h> 13#include <sys/wait.h>
12#include <sys/mman.h> 14#include <asm/unistd.h>
13#include <sys/syscall.h> 15#include "init.h"
14#include "ptrace_user.h" 16#include "kern_constants.h"
17#include "longjmp.h"
15#include "os.h" 18#include "os.h"
16#include "user.h"
17#include "process.h" 19#include "process.h"
18#include "irq_user.h"
19#include "kern_util.h"
20#include "longjmp.h"
21#include "skas_ptrace.h" 20#include "skas_ptrace.h"
22#include "kern_constants.h" 21#include "user.h"
23#include "uml-config.h"
24#include "init.h"
25 22
26#define ARBITRARY_ADDR -1 23#define ARBITRARY_ADDR -1
27#define FAILURE_PID -1 24#define FAILURE_PID -1
@@ -32,30 +29,32 @@
32unsigned long os_process_pc(int pid) 29unsigned long os_process_pc(int pid)
33{ 30{
34 char proc_stat[STAT_PATH_LEN], buf[256]; 31 char proc_stat[STAT_PATH_LEN], buf[256];
35 unsigned long pc; 32 unsigned long pc = ARBITRARY_ADDR;
36 int fd, err; 33 int fd, err;
37 34
38 sprintf(proc_stat, "/proc/%d/stat", pid); 35 sprintf(proc_stat, "/proc/%d/stat", pid);
39 fd = os_open_file(proc_stat, of_read(OPENFLAGS()), 0); 36 fd = open(proc_stat, O_RDONLY, 0);
40 if(fd < 0){ 37 if (fd < 0) {
41 printk("os_process_pc - couldn't open '%s', err = %d\n", 38 printk(UM_KERN_ERR "os_process_pc - couldn't open '%s', "
42 proc_stat, -fd); 39 "errno = %d\n", proc_stat, errno);
43 return ARBITRARY_ADDR; 40 goto out;
44 } 41 }
45 CATCH_EINTR(err = read(fd, buf, sizeof(buf))); 42 CATCH_EINTR(err = read(fd, buf, sizeof(buf)));
46 if(err < 0){ 43 if (err < 0) {
47 printk("os_process_pc - couldn't read '%s', err = %d\n", 44 printk(UM_KERN_ERR "os_process_pc - couldn't read '%s', "
48 proc_stat, errno); 45 "err = %d\n", proc_stat, errno);
49 os_close_file(fd); 46 goto out_close;
50 return ARBITRARY_ADDR;
51 } 47 }
52 os_close_file(fd); 48 os_close_file(fd);
53 pc = ARBITRARY_ADDR; 49 pc = ARBITRARY_ADDR;
54 if(sscanf(buf, "%*d " COMM_SCANF " %*c %*d %*d %*d %*d %*d %*d %*d " 50 if (sscanf(buf, "%*d " COMM_SCANF " %*c %*d %*d %*d %*d %*d %*d %*d "
55 "%*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d " 51 "%*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d "
56 "%*d %*d %*d %*d %*d %lu", &pc) != 1){ 52 "%*d %*d %*d %*d %*d %lu", &pc) != 1)
57 printk("os_process_pc - couldn't find pc in '%s'\n", buf); 53 printk(UM_KERN_ERR "os_process_pc - couldn't find pc in '%s'\n",
58 } 54 buf);
55 out_close:
56 close(fd);
57 out:
59 return pc; 58 return pc;
60} 59}
61 60
@@ -63,30 +62,32 @@ int os_process_parent(int pid)
63{ 62{
64 char stat[STAT_PATH_LEN]; 63 char stat[STAT_PATH_LEN];
65 char data[256]; 64 char data[256];
66 int parent, n, fd; 65 int parent = FAILURE_PID, n, fd;
67 66
68 if(pid == -1) 67 if (pid == -1)
69 return -1; 68 return parent;
70 69
71 snprintf(stat, sizeof(stat), "/proc/%d/stat", pid); 70 snprintf(stat, sizeof(stat), "/proc/%d/stat", pid);
72 fd = os_open_file(stat, of_read(OPENFLAGS()), 0); 71 fd = open(stat, O_RDONLY, 0);
73 if(fd < 0){ 72 if (fd < 0) {
74 printk("Couldn't open '%s', err = %d\n", stat, -fd); 73 printk(UM_KERN_ERR "Couldn't open '%s', errno = %d\n", stat,
75 return FAILURE_PID; 74 errno);
75 return parent;
76 } 76 }
77 77
78 CATCH_EINTR(n = read(fd, data, sizeof(data))); 78 CATCH_EINTR(n = read(fd, data, sizeof(data)));
79 os_close_file(fd); 79 close(fd);
80 80
81 if(n < 0){ 81 if (n < 0) {
82 printk("Couldn't read '%s', err = %d\n", stat, errno); 82 printk(UM_KERN_ERR "Couldn't read '%s', errno = %d\n", stat,
83 return FAILURE_PID; 83 errno);
84 return parent;
84 } 85 }
85 86
86 parent = FAILURE_PID; 87 parent = FAILURE_PID;
87 n = sscanf(data, "%*d " COMM_SCANF " %*c %d", &parent); 88 n = sscanf(data, "%*d " COMM_SCANF " %*c %d", &parent);
88 if(n != 1) 89 if (n != 1)
89 printk("Failed to scan '%s'\n", data); 90 printk(UM_KERN_ERR "Failed to scan '%s'\n", data);
90 91
91 return parent; 92 return parent;
92} 93}
@@ -99,9 +100,8 @@ void os_stop_process(int pid)
99void os_kill_process(int pid, int reap_child) 100void os_kill_process(int pid, int reap_child)
100{ 101{
101 kill(pid, SIGKILL); 102 kill(pid, SIGKILL);
102 if(reap_child) 103 if (reap_child)
103 CATCH_EINTR(waitpid(pid, NULL, 0)); 104 CATCH_EINTR(waitpid(pid, NULL, 0));
104
105} 105}
106 106
107/* This is here uniquely to have access to the userspace errno, i.e. the one 107/* This is here uniquely to have access to the userspace errno, i.e. the one
@@ -129,17 +129,10 @@ void os_kill_ptraced_process(int pid, int reap_child)
129 kill(pid, SIGKILL); 129 kill(pid, SIGKILL);
130 ptrace(PTRACE_KILL, pid); 130 ptrace(PTRACE_KILL, pid);
131 ptrace(PTRACE_CONT, pid); 131 ptrace(PTRACE_CONT, pid);
132 if(reap_child) 132 if (reap_child)
133 CATCH_EINTR(waitpid(pid, NULL, 0)); 133 CATCH_EINTR(waitpid(pid, NULL, 0));
134} 134}
135 135
136#ifdef UML_CONFIG_MODE_TT
137void os_usr1_process(int pid)
138{
139 kill(pid, SIGUSR1);
140}
141#endif
142
143/* Don't use the glibc version, which caches the result in TLS. It misses some 136/* Don't use the glibc version, which caches the result in TLS. It misses some
144 * syscalls, and also breaks with clone(), which does not unshare the TLS. 137 * syscalls, and also breaks with clone(), which does not unshare the TLS.
145 */ 138 */
@@ -160,34 +153,35 @@ int os_map_memory(void *virt, int fd, unsigned long long off, unsigned long len,
160 void *loc; 153 void *loc;
161 int prot; 154 int prot;
162 155
163 prot = (r ? PROT_READ : 0) | (w ? PROT_WRITE : 0) | 156 prot = (r ? PROT_READ : 0) | (w ? PROT_WRITE : 0) |
164 (x ? PROT_EXEC : 0); 157 (x ? PROT_EXEC : 0);
165 158
166 loc = mmap64((void *) virt, len, prot, MAP_SHARED | MAP_FIXED, 159 loc = mmap64((void *) virt, len, prot, MAP_SHARED | MAP_FIXED,
167 fd, off); 160 fd, off);
168 if(loc == MAP_FAILED) 161 if (loc == MAP_FAILED)
169 return -errno; 162 return -errno;
170 return 0; 163 return 0;
171} 164}
172 165
173int os_protect_memory(void *addr, unsigned long len, int r, int w, int x) 166int os_protect_memory(void *addr, unsigned long len, int r, int w, int x)
174{ 167{
175 int prot = ((r ? PROT_READ : 0) | (w ? PROT_WRITE : 0) | 168 int prot = ((r ? PROT_READ : 0) | (w ? PROT_WRITE : 0) |
176 (x ? PROT_EXEC : 0)); 169 (x ? PROT_EXEC : 0));
177 170
178 if(mprotect(addr, len, prot) < 0) 171 if (mprotect(addr, len, prot) < 0)
179 return -errno; 172 return -errno;
180 return 0; 173
174 return 0;
181} 175}
182 176
183int os_unmap_memory(void *addr, int len) 177int os_unmap_memory(void *addr, int len)
184{ 178{
185 int err; 179 int err;
186 180
187 err = munmap(addr, len); 181 err = munmap(addr, len);
188 if(err < 0) 182 if (err < 0)
189 return -errno; 183 return -errno;
190 return 0; 184 return 0;
191} 185}
192 186
193#ifndef MADV_REMOVE 187#ifndef MADV_REMOVE
@@ -199,7 +193,7 @@ int os_drop_memory(void *addr, int length)
199 int err; 193 int err;
200 194
201 err = madvise(addr, length, MADV_REMOVE); 195 err = madvise(addr, length, MADV_REMOVE);
202 if(err < 0) 196 if (err < 0)
203 err = -errno; 197 err = -errno;
204 return err; 198 return err;
205} 199}
@@ -209,22 +203,24 @@ int __init can_drop_memory(void)
209 void *addr; 203 void *addr;
210 int fd, ok = 0; 204 int fd, ok = 0;
211 205
212 printk("Checking host MADV_REMOVE support..."); 206 printk(UM_KERN_INFO "Checking host MADV_REMOVE support...");
213 fd = create_mem_file(UM_KERN_PAGE_SIZE); 207 fd = create_mem_file(UM_KERN_PAGE_SIZE);
214 if(fd < 0){ 208 if (fd < 0) {
215 printk("Creating test memory file failed, err = %d\n", -fd); 209 printk(UM_KERN_ERR "Creating test memory file failed, "
210 "err = %d\n", -fd);
216 goto out; 211 goto out;
217 } 212 }
218 213
219 addr = mmap64(NULL, UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE, 214 addr = mmap64(NULL, UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE,
220 MAP_SHARED, fd, 0); 215 MAP_SHARED, fd, 0);
221 if(addr == MAP_FAILED){ 216 if (addr == MAP_FAILED) {
222 printk("Mapping test memory file failed, err = %d\n", -errno); 217 printk(UM_KERN_ERR "Mapping test memory file failed, "
218 "err = %d\n", -errno);
223 goto out_close; 219 goto out_close;
224 } 220 }
225 221
226 if(madvise(addr, UM_KERN_PAGE_SIZE, MADV_REMOVE) != 0){ 222 if (madvise(addr, UM_KERN_PAGE_SIZE, MADV_REMOVE) != 0) {
227 printk("MADV_REMOVE failed, err = %d\n", -errno); 223 printk(UM_KERN_ERR "MADV_REMOVE failed, err = %d\n", -errno);
228 goto out_unmap; 224 goto out_unmap;
229 } 225 }
230 226
@@ -239,58 +235,31 @@ out:
239 return ok; 235 return ok;
240} 236}
241 237
242#ifdef UML_CONFIG_MODE_TT
243void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int))
244{
245 int flags = 0, pages;
246
247 if(sig_stack != NULL){
248 pages = (1 << UML_CONFIG_KERNEL_STACK_ORDER);
249 set_sigstack(sig_stack, pages * UM_KERN_PAGE_SIZE);
250 flags = SA_ONSTACK;
251 }
252 if(usr1_handler){
253 struct sigaction sa;
254
255 sa.sa_handler = usr1_handler;
256 sigemptyset(&sa.sa_mask);
257 sa.sa_flags = flags;
258 sa.sa_restorer = NULL;
259 if(sigaction(SIGUSR1, &sa, NULL) < 0)
260 panic("init_new_thread_stack - sigaction failed - "
261 "errno = %d\n", errno);
262 }
263}
264#endif
265
266void init_new_thread_signals(void) 238void init_new_thread_signals(void)
267{ 239{
268 set_handler(SIGSEGV, (__sighandler_t) sig_handler, SA_ONSTACK, 240 set_handler(SIGSEGV, (__sighandler_t) sig_handler, SA_ONSTACK,
269 SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); 241 SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
270 set_handler(SIGTRAP, (__sighandler_t) sig_handler, SA_ONSTACK, 242 set_handler(SIGTRAP, (__sighandler_t) sig_handler, SA_ONSTACK,
271 SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); 243 SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
272 set_handler(SIGFPE, (__sighandler_t) sig_handler, SA_ONSTACK, 244 set_handler(SIGFPE, (__sighandler_t) sig_handler, SA_ONSTACK,
273 SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); 245 SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
274 set_handler(SIGILL, (__sighandler_t) sig_handler, SA_ONSTACK, 246 set_handler(SIGILL, (__sighandler_t) sig_handler, SA_ONSTACK,
275 SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); 247 SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
276 set_handler(SIGBUS, (__sighandler_t) sig_handler, SA_ONSTACK, 248 set_handler(SIGBUS, (__sighandler_t) sig_handler, SA_ONSTACK,
277 SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); 249 SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
278 set_handler(SIGUSR2, (__sighandler_t) sig_handler,
279 SA_ONSTACK, SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM,
280 -1);
281 signal(SIGHUP, SIG_IGN); 250 signal(SIGHUP, SIG_IGN);
282 251
283 init_irq_signals(1); 252 init_irq_signals(1);
284} 253}
285 254
286int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr) 255int run_kernel_thread(int (*fn)(void *), void *arg, jmp_buf **jmp_ptr)
287{ 256{
288 jmp_buf buf; 257 jmp_buf buf;
289 int n; 258 int n;
290 259
291 *jmp_ptr = &buf; 260 *jmp_ptr = &buf;
292 n = UML_SETJMP(&buf); 261 n = UML_SETJMP(&buf);
293 if(n != 0) 262 if (n != 0)
294 return n; 263 return n;
295 (*fn)(arg); 264 (*fn)(arg);
296 return 0; 265 return 0;
diff --git a/arch/um/os-Linux/registers.c b/arch/um/os-Linux/registers.c
new file mode 100644
index 000000000000..a32ba6ab1211
--- /dev/null
+++ b/arch/um/os-Linux/registers.c
@@ -0,0 +1,57 @@
1/*
2 * Copyright (C) 2004 PathScale, Inc
3 * Copyright (C) 2004 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 * Licensed under the GPL
5 */
6
7#include <errno.h>
8#include <string.h>
9#include <sys/ptrace.h>
10#include "sysdep/ptrace.h"
11#include "user.h"
12
13/* This is set once at boot time and not changed thereafter */
14
15static unsigned long exec_regs[MAX_REG_NR];
16
17void init_thread_registers(struct uml_pt_regs *to)
18{
19 memcpy(to->gp, exec_regs, sizeof(to->gp));
20}
21
22void save_registers(int pid, struct uml_pt_regs *regs)
23{
24 int err;
25
26 err = ptrace(PTRACE_GETREGS, pid, 0, regs->gp);
27 if (err < 0)
28 panic("save_registers - saving registers failed, errno = %d\n",
29 errno);
30}
31
32void restore_registers(int pid, struct uml_pt_regs *regs)
33{
34 int err;
35
36 err = ptrace(PTRACE_SETREGS, pid, 0, regs->gp);
37 if (err < 0)
38 panic("restore_registers - saving registers failed, "
39 "errno = %d\n", errno);
40}
41
42void init_registers(int pid)
43{
44 int err;
45
46 err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs);
47 if (err)
48 panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
49 errno);
50
51 arch_init_registers(pid);
52}
53
54void get_safe_registers(unsigned long *regs)
55{
56 memcpy(regs, exec_regs, sizeof(exec_regs));
57}
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index b98f7ea2d2f6..e9800b0b5689 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -1,26 +1,21 @@
1/* 1/*
2 * Copyright (C) 2004 PathScale, Inc 2 * Copyright (C) 2004 PathScale, Inc
3 * Copyright (C) 2004 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 4 * Licensed under the GPL
4 */ 5 */
5 6
6#include <signal.h>
7#include <stdio.h>
8#include <unistd.h>
9#include <stdlib.h> 7#include <stdlib.h>
10#include <errno.h>
11#include <stdarg.h> 8#include <stdarg.h>
12#include <string.h> 9#include <errno.h>
13#include <sys/mman.h> 10#include <signal.h>
14#include "user.h" 11#include <strings.h>
15#include "signal_kern.h"
16#include "sysdep/sigcontext.h"
17#include "sysdep/barrier.h"
18#include "sigcontext.h"
19#include "mode.h"
20#include "os.h" 12#include "os.h"
13#include "sysdep/barrier.h"
14#include "sysdep/sigcontext.h"
15#include "user.h"
21 16
22/* These are the asynchronous signals. SIGVTALRM and SIGARLM are handled 17/*
23 * together under SIGVTALRM_BIT. SIGPROF is excluded because we want to 18 * These are the asynchronous signals. SIGPROF is excluded because we want to
24 * be able to profile all of UML, not just the non-critical sections. If 19 * be able to profile all of UML, not just the non-critical sections. If
25 * profiling is not thread-safe, then that is not my problem. We can disable 20 * profiling is not thread-safe, then that is not my problem. We can disable
26 * profiling when SMP is enabled in that case. 21 * profiling when SMP is enabled in that case.
@@ -31,10 +26,8 @@
31#define SIGVTALRM_BIT 1 26#define SIGVTALRM_BIT 1
32#define SIGVTALRM_MASK (1 << SIGVTALRM_BIT) 27#define SIGVTALRM_MASK (1 << SIGVTALRM_BIT)
33 28
34#define SIGALRM_BIT 2 29/*
35#define SIGALRM_MASK (1 << SIGALRM_BIT) 30 * These are used by both the signal handlers and
36
37/* These are used by both the signal handlers and
38 * block/unblock_signals. I don't want modifications cached in a 31 * block/unblock_signals. I don't want modifications cached in a
39 * register - they must go straight to memory. 32 * register - they must go straight to memory.
40 */ 33 */
@@ -46,34 +39,27 @@ void sig_handler(int sig, struct sigcontext *sc)
46 int enabled; 39 int enabled;
47 40
48 enabled = signals_enabled; 41 enabled = signals_enabled;
49 if(!enabled && (sig == SIGIO)){ 42 if (!enabled && (sig == SIGIO)) {
50 pending |= SIGIO_MASK; 43 pending |= SIGIO_MASK;
51 return; 44 return;
52 } 45 }
53 46
54 block_signals(); 47 block_signals();
55 48
56 CHOOSE_MODE_PROC(sig_handler_common_tt, sig_handler_common_skas, 49 sig_handler_common_skas(sig, sc);
57 sig, sc);
58 50
59 set_signals(enabled); 51 set_signals(enabled);
60} 52}
61 53
62static void real_alarm_handler(int sig, struct sigcontext *sc) 54static void real_alarm_handler(struct sigcontext *sc)
63{ 55{
64 union uml_pt_regs regs; 56 struct uml_pt_regs regs;
65 57
66 if(sig == SIGALRM) 58 if (sc != NULL)
67 switch_timers(0);
68
69 if(sc != NULL)
70 copy_sc(&regs, sc); 59 copy_sc(&regs, sc);
71 regs.skas.is_user = 0; 60 regs.is_user = 0;
72 unblock_signals(); 61 unblock_signals();
73 timer_handler(sig, &regs); 62 timer_handler(SIGVTALRM, &regs);
74
75 if(sig == SIGALRM)
76 switch_timers(1);
77} 63}
78 64
79void alarm_handler(int sig, struct sigcontext *sc) 65void alarm_handler(int sig, struct sigcontext *sc)
@@ -81,27 +67,30 @@ void alarm_handler(int sig, struct sigcontext *sc)
81 int enabled; 67 int enabled;
82 68
83 enabled = signals_enabled; 69 enabled = signals_enabled;
84 if(!signals_enabled){ 70 if (!signals_enabled) {
85 if(sig == SIGVTALRM) 71 pending |= SIGVTALRM_MASK;
86 pending |= SIGVTALRM_MASK;
87 else pending |= SIGALRM_MASK;
88
89 return; 72 return;
90 } 73 }
91 74
92 block_signals(); 75 block_signals();
93 76
94 real_alarm_handler(sig, sc); 77 real_alarm_handler(sc);
95 set_signals(enabled); 78 set_signals(enabled);
96} 79}
97 80
81void timer_init(void)
82{
83 set_handler(SIGVTALRM, (__sighandler_t) alarm_handler,
84 SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGWINCH, -1);
85}
86
98void set_sigstack(void *sig_stack, int size) 87void set_sigstack(void *sig_stack, int size)
99{ 88{
100 stack_t stack = ((stack_t) { .ss_flags = 0, 89 stack_t stack = ((stack_t) { .ss_flags = 0,
101 .ss_sp = (__ptr_t) sig_stack, 90 .ss_sp = (__ptr_t) sig_stack,
102 .ss_size = size - sizeof(void *) }); 91 .ss_size = size - sizeof(void *) });
103 92
104 if(sigaltstack(&stack, NULL) != 0) 93 if (sigaltstack(&stack, NULL) != 0)
105 panic("enabling signal stack failed, errno = %d\n", errno); 94 panic("enabling signal stack failed, errno = %d\n", errno);
106} 95}
107 96
@@ -111,7 +100,7 @@ void remove_sigstack(void)
111 .ss_sp = NULL, 100 .ss_sp = NULL,
112 .ss_size = 0 }); 101 .ss_size = 0 });
113 102
114 if(sigaltstack(&stack, NULL) != 0) 103 if (sigaltstack(&stack, NULL) != 0)
115 panic("disabling signal stack failed, errno = %d\n", errno); 104 panic("disabling signal stack failed, errno = %d\n", errno);
116} 105}
117 106
@@ -135,26 +124,27 @@ void handle_signal(int sig, struct sigcontext *sc)
135 * with this interrupt. 124 * with this interrupt.
136 */ 125 */
137 bail = to_irq_stack(&pending); 126 bail = to_irq_stack(&pending);
138 if(bail) 127 if (bail)
139 return; 128 return;
140 129
141 nested = pending & 1; 130 nested = pending & 1;
142 pending &= ~1; 131 pending &= ~1;
143 132
144 while((sig = ffs(pending)) != 0){ 133 while ((sig = ffs(pending)) != 0){
145 sig--; 134 sig--;
146 pending &= ~(1 << sig); 135 pending &= ~(1 << sig);
147 (*handlers[sig])(sig, sc); 136 (*handlers[sig])(sig, sc);
148 } 137 }
149 138
150 /* Again, pending comes back with a mask of signals 139 /*
140 * Again, pending comes back with a mask of signals
151 * that arrived while tearing down the stack. If this 141 * that arrived while tearing down the stack. If this
152 * is non-zero, we just go back, set up the stack 142 * is non-zero, we just go back, set up the stack
153 * again, and handle the new interrupts. 143 * again, and handle the new interrupts.
154 */ 144 */
155 if(!nested) 145 if (!nested)
156 pending = from_irq_stack(nested); 146 pending = from_irq_stack(nested);
157 } while(pending); 147 } while (pending);
158} 148}
159 149
160extern void hard_handler(int sig); 150extern void hard_handler(int sig);
@@ -172,18 +162,18 @@ void set_handler(int sig, void (*handler)(int), int flags, ...)
172 sigemptyset(&action.sa_mask); 162 sigemptyset(&action.sa_mask);
173 163
174 va_start(ap, flags); 164 va_start(ap, flags);
175 while((mask = va_arg(ap, int)) != -1) 165 while ((mask = va_arg(ap, int)) != -1)
176 sigaddset(&action.sa_mask, mask); 166 sigaddset(&action.sa_mask, mask);
177 va_end(ap); 167 va_end(ap);
178 168
179 action.sa_flags = flags; 169 action.sa_flags = flags;
180 action.sa_restorer = NULL; 170 action.sa_restorer = NULL;
181 if(sigaction(sig, &action, NULL) < 0) 171 if (sigaction(sig, &action, NULL) < 0)
182 panic("sigaction failed - errno = %d\n", errno); 172 panic("sigaction failed - errno = %d\n", errno);
183 173
184 sigemptyset(&sig_mask); 174 sigemptyset(&sig_mask);
185 sigaddset(&sig_mask, sig); 175 sigaddset(&sig_mask, sig);
186 if(sigprocmask(SIG_UNBLOCK, &sig_mask, NULL) < 0) 176 if (sigprocmask(SIG_UNBLOCK, &sig_mask, NULL) < 0)
187 panic("sigprocmask failed - errno = %d\n", errno); 177 panic("sigprocmask failed - errno = %d\n", errno);
188} 178}
189 179
@@ -194,13 +184,14 @@ int change_sig(int signal, int on)
194 sigemptyset(&sigset); 184 sigemptyset(&sigset);
195 sigaddset(&sigset, signal); 185 sigaddset(&sigset, signal);
196 sigprocmask(on ? SIG_UNBLOCK : SIG_BLOCK, &sigset, &old); 186 sigprocmask(on ? SIG_UNBLOCK : SIG_BLOCK, &sigset, &old);
197 return(!sigismember(&old, signal)); 187 return !sigismember(&old, signal);
198} 188}
199 189
200void block_signals(void) 190void block_signals(void)
201{ 191{
202 signals_enabled = 0; 192 signals_enabled = 0;
203 /* This must return with signals disabled, so this barrier 193 /*
194 * This must return with signals disabled, so this barrier
204 * ensures that writes are flushed out before the return. 195 * ensures that writes are flushed out before the return.
205 * This might matter if gcc figures out how to inline this and 196 * This might matter if gcc figures out how to inline this and
206 * decides to shuffle this code into the caller. 197 * decides to shuffle this code into the caller.
@@ -212,27 +203,31 @@ void unblock_signals(void)
212{ 203{
213 int save_pending; 204 int save_pending;
214 205
215 if(signals_enabled == 1) 206 if (signals_enabled == 1)
216 return; 207 return;
217 208
218 /* We loop because the IRQ handler returns with interrupts off. So, 209 /*
210 * We loop because the IRQ handler returns with interrupts off. So,
219 * interrupts may have arrived and we need to re-enable them and 211 * interrupts may have arrived and we need to re-enable them and
220 * recheck pending. 212 * recheck pending.
221 */ 213 */
222 while(1){ 214 while(1) {
223 /* Save and reset save_pending after enabling signals. This 215 /*
216 * Save and reset save_pending after enabling signals. This
224 * way, pending won't be changed while we're reading it. 217 * way, pending won't be changed while we're reading it.
225 */ 218 */
226 signals_enabled = 1; 219 signals_enabled = 1;
227 220
228 /* Setting signals_enabled and reading pending must 221 /*
222 * Setting signals_enabled and reading pending must
229 * happen in this order. 223 * happen in this order.
230 */ 224 */
231 mb(); 225 mb();
232 226
233 save_pending = pending; 227 save_pending = pending;
234 if(save_pending == 0){ 228 if (save_pending == 0) {
235 /* This must return with signals enabled, so 229 /*
230 * This must return with signals enabled, so
236 * this barrier ensures that writes are 231 * this barrier ensures that writes are
237 * flushed out before the return. This might 232 * flushed out before the return. This might
238 * matter if gcc figures out how to inline 233 * matter if gcc figures out how to inline
@@ -245,26 +240,24 @@ void unblock_signals(void)
245 240
246 pending = 0; 241 pending = 0;
247 242
248 /* We have pending interrupts, so disable signals, as the 243 /*
244 * We have pending interrupts, so disable signals, as the
249 * handlers expect them off when they are called. They will 245 * handlers expect them off when they are called. They will
250 * be enabled again above. 246 * be enabled again above.
251 */ 247 */
252 248
253 signals_enabled = 0; 249 signals_enabled = 0;
254 250
255 /* Deal with SIGIO first because the alarm handler might 251 /*
252 * Deal with SIGIO first because the alarm handler might
256 * schedule, leaving the pending SIGIO stranded until we come 253 * schedule, leaving the pending SIGIO stranded until we come
257 * back here. 254 * back here.
258 */ 255 */
259 if(save_pending & SIGIO_MASK) 256 if (save_pending & SIGIO_MASK)
260 CHOOSE_MODE_PROC(sig_handler_common_tt, 257 sig_handler_common_skas(SIGIO, NULL);
261 sig_handler_common_skas, SIGIO, NULL);
262
263 if(save_pending & SIGALRM_MASK)
264 real_alarm_handler(SIGALRM, NULL);
265 258
266 if(save_pending & SIGVTALRM_MASK) 259 if (save_pending & SIGVTALRM_MASK)
267 real_alarm_handler(SIGVTALRM, NULL); 260 real_alarm_handler(NULL);
268 } 261 }
269} 262}
270 263
@@ -276,11 +269,11 @@ int get_signals(void)
276int set_signals(int enable) 269int set_signals(int enable)
277{ 270{
278 int ret; 271 int ret;
279 if(signals_enabled == enable) 272 if (signals_enabled == enable)
280 return enable; 273 return enable;
281 274
282 ret = signals_enabled; 275 ret = signals_enabled;
283 if(enable) 276 if (enable)
284 unblock_signals(); 277 unblock_signals();
285 else block_signals(); 278 else block_signals();
286 279
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c
index 0f7df4eb903f..484e68f9f7ae 100644
--- a/arch/um/os-Linux/skas/mem.c
+++ b/arch/um/os-Linux/skas/mem.c
@@ -1,31 +1,26 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <signal.h> 6#include <stddef.h>
7#include <unistd.h>
7#include <errno.h> 8#include <errno.h>
8#include <string.h> 9#include <string.h>
9#include <unistd.h>
10#include <sys/mman.h> 10#include <sys/mman.h>
11#include <sys/wait.h> 11#include "init.h"
12#include <asm/page.h> 12#include "kern_constants.h"
13#include <asm/unistd.h> 13#include "as-layout.h"
14#include "mem_user.h" 14#include "mm_id.h"
15#include "mem.h"
16#include "skas.h"
17#include "user.h"
18#include "os.h" 15#include "os.h"
19#include "proc_mm.h" 16#include "proc_mm.h"
20#include "ptrace_user.h" 17#include "ptrace_user.h"
21#include "kern_util.h"
22#include "task.h"
23#include "registers.h" 18#include "registers.h"
24#include "uml-config.h" 19#include "skas.h"
20#include "user.h"
25#include "sysdep/ptrace.h" 21#include "sysdep/ptrace.h"
26#include "sysdep/stub.h" 22#include "sysdep/stub.h"
27#include "init.h" 23#include "uml-config.h"
28#include "kern_constants.h"
29 24
30extern unsigned long batch_syscall_stub, __syscall_stub_start; 25extern unsigned long batch_syscall_stub, __syscall_stub_start;
31 26
@@ -34,7 +29,7 @@ extern void wait_stub_done(int pid);
34static inline unsigned long *check_init_stack(struct mm_id * mm_idp, 29static inline unsigned long *check_init_stack(struct mm_id * mm_idp,
35 unsigned long *stack) 30 unsigned long *stack)
36{ 31{
37 if(stack == NULL) { 32 if (stack == NULL) {
38 stack = (unsigned long *) mm_idp->stack + 2; 33 stack = (unsigned long *) mm_idp->stack + 2;
39 *stack = 0; 34 *stack = 0;
40 } 35 }
@@ -45,8 +40,8 @@ static unsigned long syscall_regs[MAX_REG_NR];
45 40
46static int __init init_syscall_regs(void) 41static int __init init_syscall_regs(void)
47{ 42{
48 get_safe_registers(syscall_regs, NULL); 43 get_safe_registers(syscall_regs);
49 syscall_regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE + 44 syscall_regs[REGS_IP_INDEX] = STUB_CODE +
50 ((unsigned long) &batch_syscall_stub - 45 ((unsigned long) &batch_syscall_stub -
51 (unsigned long) &__syscall_stub_start); 46 (unsigned long) &__syscall_stub_start);
52 return 0; 47 return 0;
@@ -68,29 +63,30 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
68 unsigned long * syscall; 63 unsigned long * syscall;
69 int err, pid = mm_idp->u.pid; 64 int err, pid = mm_idp->u.pid;
70 65
71 if(proc_mm) 66 if (proc_mm)
72 /* FIXME: Need to look up userspace_pid by cpu */ 67 /* FIXME: Need to look up userspace_pid by cpu */
73 pid = userspace_pid[0]; 68 pid = userspace_pid[0];
74 69
75 multi_count++; 70 multi_count++;
76 71
77 n = ptrace_setregs(pid, syscall_regs); 72 n = ptrace_setregs(pid, syscall_regs);
78 if(n < 0){ 73 if (n < 0) {
79 printk("Registers - \n"); 74 printk(UM_KERN_ERR "Registers - \n");
80 for(i = 0; i < MAX_REG_NR; i++) 75 for (i = 0; i < MAX_REG_NR; i++)
81 printk("\t%d\t0x%lx\n", i, syscall_regs[i]); 76 printk(UM_KERN_ERR "\t%d\t0x%lx\n", i, syscall_regs[i]);
82 panic("do_syscall_stub : PTRACE_SETREGS failed, errno = %d\n", 77 panic("do_syscall_stub : PTRACE_SETREGS failed, errno = %d\n",
83 -n); 78 -n);
84 } 79 }
85 80
86 err = ptrace(PTRACE_CONT, pid, 0, 0); 81 err = ptrace(PTRACE_CONT, pid, 0, 0);
87 if(err) 82 if (err)
88 panic("Failed to continue stub, pid = %d, errno = %d\n", pid, 83 panic("Failed to continue stub, pid = %d, errno = %d\n", pid,
89 errno); 84 errno);
90 85
91 wait_stub_done(pid); 86 wait_stub_done(pid);
92 87
93 /* When the stub stops, we find the following values on the 88 /*
89 * When the stub stops, we find the following values on the
94 * beginning of the stack: 90 * beginning of the stack:
95 * (long )return_value 91 * (long )return_value
96 * (long )offset to failed sycall-data (0, if no error) 92 * (long )offset to failed sycall-data (0, if no error)
@@ -98,26 +94,26 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
98 ret = *((unsigned long *) mm_idp->stack); 94 ret = *((unsigned long *) mm_idp->stack);
99 offset = *((unsigned long *) mm_idp->stack + 1); 95 offset = *((unsigned long *) mm_idp->stack + 1);
100 if (offset) { 96 if (offset) {
101 data = (unsigned long *)(mm_idp->stack + 97 data = (unsigned long *)(mm_idp->stack + offset - STUB_DATA);
102 offset - UML_CONFIG_STUB_DATA); 98 printk(UM_KERN_ERR "do_syscall_stub : ret = %ld, offset = %ld, "
103 printk("do_syscall_stub : ret = %ld, offset = %ld, "
104 "data = %p\n", ret, offset, data); 99 "data = %p\n", ret, offset, data);
105 syscall = (unsigned long *)((unsigned long)data + data[0]); 100 syscall = (unsigned long *)((unsigned long)data + data[0]);
106 printk("do_syscall_stub: syscall %ld failed, return value = " 101 printk(UM_KERN_ERR "do_syscall_stub: syscall %ld failed, "
107 "0x%lx, expected return value = 0x%lx\n", 102 "return value = 0x%lx, expected return value = 0x%lx\n",
108 syscall[0], ret, syscall[7]); 103 syscall[0], ret, syscall[7]);
109 printk(" syscall parameters: " 104 printk(UM_KERN_ERR " syscall parameters: "
110 "0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n", 105 "0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n",
111 syscall[1], syscall[2], syscall[3], 106 syscall[1], syscall[2], syscall[3],
112 syscall[4], syscall[5], syscall[6]); 107 syscall[4], syscall[5], syscall[6]);
113 for(n = 1; n < data[0]/sizeof(long); n++) { 108 for (n = 1; n < data[0]/sizeof(long); n++) {
114 if(n == 1) 109 if (n == 1)
115 printk(" additional syscall data:"); 110 printk(UM_KERN_ERR " additional syscall "
116 if(n % 4 == 1) 111 "data:");
117 printk("\n "); 112 if (n % 4 == 1)
113 printk("\n" UM_KERN_ERR " ");
118 printk(" 0x%lx", data[n]); 114 printk(" 0x%lx", data[n]);
119 } 115 }
120 if(n > 1) 116 if (n > 1)
121 printk("\n"); 117 printk("\n");
122 } 118 }
123 else ret = 0; 119 else ret = 0;
@@ -133,7 +129,7 @@ long run_syscall_stub(struct mm_id * mm_idp, int syscall,
133{ 129{
134 unsigned long *stack = check_init_stack(mm_idp, *addr); 130 unsigned long *stack = check_init_stack(mm_idp, *addr);
135 131
136 if(done && *addr == NULL) 132 if (done && *addr == NULL)
137 single_count++; 133 single_count++;
138 134
139 *stack += sizeof(long); 135 *stack += sizeof(long);
@@ -150,8 +146,8 @@ long run_syscall_stub(struct mm_id * mm_idp, int syscall,
150 *stack = 0; 146 *stack = 0;
151 multi_op_count++; 147 multi_op_count++;
152 148
153 if(!done && ((((unsigned long) stack) & ~UM_KERN_PAGE_MASK) < 149 if (!done && ((((unsigned long) stack) & ~UM_KERN_PAGE_MASK) <
154 UM_KERN_PAGE_SIZE - 10 * sizeof(long))){ 150 UM_KERN_PAGE_SIZE - 10 * sizeof(long))) {
155 *addr = stack; 151 *addr = stack;
156 return 0; 152 return 0;
157 } 153 }
@@ -166,14 +162,15 @@ long syscall_stub_data(struct mm_id * mm_idp,
166 unsigned long *stack; 162 unsigned long *stack;
167 int ret = 0; 163 int ret = 0;
168 164
169 /* If *addr still is uninitialized, it *must* contain NULL. 165 /*
166 * If *addr still is uninitialized, it *must* contain NULL.
170 * Thus in this case do_syscall_stub correctly won't be called. 167 * Thus in this case do_syscall_stub correctly won't be called.
171 */ 168 */
172 if((((unsigned long) *addr) & ~UM_KERN_PAGE_MASK) >= 169 if ((((unsigned long) *addr) & ~UM_KERN_PAGE_MASK) >=
173 UM_KERN_PAGE_SIZE - (10 + data_count) * sizeof(long)) { 170 UM_KERN_PAGE_SIZE - (10 + data_count) * sizeof(long)) {
174 ret = do_syscall_stub(mm_idp, addr); 171 ret = do_syscall_stub(mm_idp, addr);
175 /* in case of error, don't overwrite data on stack */ 172 /* in case of error, don't overwrite data on stack */
176 if(ret) 173 if (ret)
177 return ret; 174 return ret;
178 } 175 }
179 176
@@ -185,7 +182,7 @@ long syscall_stub_data(struct mm_id * mm_idp,
185 memcpy(stack + 1, data, data_count * sizeof(long)); 182 memcpy(stack + 1, data, data_count * sizeof(long));
186 183
187 *stub_addr = (void *)(((unsigned long)(stack + 1) & 184 *stub_addr = (void *)(((unsigned long)(stack + 1) &
188 ~UM_KERN_PAGE_MASK) + UML_CONFIG_STUB_DATA); 185 ~UM_KERN_PAGE_MASK) + STUB_DATA);
189 186
190 return 0; 187 return 0;
191} 188}
@@ -195,7 +192,7 @@ int map(struct mm_id * mm_idp, unsigned long virt, unsigned long len, int prot,
195{ 192{
196 int ret; 193 int ret;
197 194
198 if(proc_mm){ 195 if (proc_mm) {
199 struct proc_mm_op map; 196 struct proc_mm_op map;
200 int fd = mm_idp->u.mm_fd; 197 int fd = mm_idp->u.mm_fd;
201 198
@@ -211,9 +208,10 @@ int map(struct mm_id * mm_idp, unsigned long virt, unsigned long len, int prot,
211 .offset= offset 208 .offset= offset
212 } } } ); 209 } } } );
213 CATCH_EINTR(ret = write(fd, &map, sizeof(map))); 210 CATCH_EINTR(ret = write(fd, &map, sizeof(map)));
214 if(ret != sizeof(map)){ 211 if (ret != sizeof(map)) {
215 ret = -errno; 212 ret = -errno;
216 printk("map : /proc/mm map failed, err = %d\n", -ret); 213 printk(UM_KERN_ERR "map : /proc/mm map failed, "
214 "err = %d\n", -ret);
217 } 215 }
218 else ret = 0; 216 else ret = 0;
219 } 217 }
@@ -234,7 +232,7 @@ int unmap(struct mm_id * mm_idp, unsigned long addr, unsigned long len,
234{ 232{
235 int ret; 233 int ret;
236 234
237 if(proc_mm){ 235 if (proc_mm) {
238 struct proc_mm_op unmap; 236 struct proc_mm_op unmap;
239 int fd = mm_idp->u.mm_fd; 237 int fd = mm_idp->u.mm_fd;
240 238
@@ -245,9 +243,10 @@ int unmap(struct mm_id * mm_idp, unsigned long addr, unsigned long len,
245 (unsigned long) addr, 243 (unsigned long) addr,
246 .len = len } } } ); 244 .len = len } } } );
247 CATCH_EINTR(ret = write(fd, &unmap, sizeof(unmap))); 245 CATCH_EINTR(ret = write(fd, &unmap, sizeof(unmap)));
248 if(ret != sizeof(unmap)){ 246 if (ret != sizeof(unmap)) {
249 ret = -errno; 247 ret = -errno;
250 printk("unmap - proc_mm write returned %d\n", ret); 248 printk(UM_KERN_ERR "unmap - proc_mm write returned "
249 "%d\n", ret);
251 } 250 }
252 else ret = 0; 251 else ret = 0;
253 } 252 }
@@ -268,7 +267,7 @@ int protect(struct mm_id * mm_idp, unsigned long addr, unsigned long len,
268 struct proc_mm_op protect; 267 struct proc_mm_op protect;
269 int ret; 268 int ret;
270 269
271 if(proc_mm){ 270 if (proc_mm) {
272 int fd = mm_idp->u.mm_fd; 271 int fd = mm_idp->u.mm_fd;
273 272
274 protect = ((struct proc_mm_op) { .op = MM_MPROTECT, 273 protect = ((struct proc_mm_op) { .op = MM_MPROTECT,
@@ -280,9 +279,9 @@ int protect(struct mm_id * mm_idp, unsigned long addr, unsigned long len,
280 .prot = prot } } } ); 279 .prot = prot } } } );
281 280
282 CATCH_EINTR(ret = write(fd, &protect, sizeof(protect))); 281 CATCH_EINTR(ret = write(fd, &protect, sizeof(protect)));
283 if(ret != sizeof(protect)){ 282 if (ret != sizeof(protect)) {
284 ret = -errno; 283 ret = -errno;
285 printk("protect failed, err = %d", -ret); 284 printk(UM_KERN_ERR "protect failed, err = %d", -ret);
286 } 285 }
287 else ret = 0; 286 else ret = 0;
288 } 287 }
@@ -295,7 +294,3 @@ int protect(struct mm_id * mm_idp, unsigned long addr, unsigned long len,
295 294
296 return ret; 295 return ret;
297} 296}
298
299void before_mem_skas(unsigned long unused)
300{
301}
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index ba9af8d62055..d77c81d7068a 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -1,48 +1,38 @@
1/* 1/*
2 * Copyright (C) 2002- 2004 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2002- 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stdlib.h> 6#include <stdlib.h>
7#include <string.h>
8#include <unistd.h> 7#include <unistd.h>
9#include <errno.h>
10#include <signal.h>
11#include <sched.h> 8#include <sched.h>
12#include "ptrace_user.h" 9#include <errno.h>
13#include <sys/wait.h> 10#include <string.h>
14#include <sys/mman.h> 11#include <sys/mman.h>
15#include <sys/user.h> 12#include <sys/ptrace.h>
16#include <sys/time.h> 13#include <sys/wait.h>
17#include <sys/syscall.h> 14#include <asm/unistd.h>
18#include <asm/types.h> 15#include "as-layout.h"
19#include "user.h"
20#include "sysdep/ptrace.h"
21#include "kern_util.h"
22#include "skas.h"
23#include "stub-data.h"
24#include "mm_id.h"
25#include "sysdep/sigcontext.h"
26#include "sysdep/stub.h"
27#include "os.h"
28#include "proc_mm.h"
29#include "skas_ptrace.h"
30#include "chan_user.h" 16#include "chan_user.h"
31#include "registers.h" 17#include "kern_constants.h"
32#include "mem.h" 18#include "mem.h"
33#include "uml-config.h" 19#include "os.h"
34#include "process.h" 20#include "process.h"
35#include "longjmp.h" 21#include "proc_mm.h"
36#include "kern_constants.h" 22#include "ptrace_user.h"
37#include "as-layout.h" 23#include "registers.h"
24#include "skas.h"
25#include "skas_ptrace.h"
26#include "user.h"
27#include "sysdep/stub.h"
38 28
39int is_skas_winch(int pid, int fd, void *data) 29int is_skas_winch(int pid, int fd, void *data)
40{ 30{
41 if(pid != os_getpgrp()) 31 if (pid != getpgrp())
42 return(0); 32 return 0;
43 33
44 register_winch_irq(-1, fd, -1, data, 0); 34 register_winch_irq(-1, fd, -1, data, 0);
45 return(1); 35 return 1;
46} 36}
47 37
48static int ptrace_dump_regs(int pid) 38static int ptrace_dump_regs(int pid)
@@ -50,13 +40,12 @@ static int ptrace_dump_regs(int pid)
50 unsigned long regs[MAX_REG_NR]; 40 unsigned long regs[MAX_REG_NR];
51 int i; 41 int i;
52 42
53 if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0) 43 if (ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
54 return -errno; 44 return -errno;
55 else { 45
56 printk("Stub registers -\n"); 46 printk(UM_KERN_ERR "Stub registers -\n");
57 for(i = 0; i < ARRAY_SIZE(regs); i++) 47 for (i = 0; i < ARRAY_SIZE(regs); i++)
58 printk("\t%d - %lx\n", i, regs[i]); 48 printk(UM_KERN_ERR "\t%d - %lx\n", i, regs[i]);
59 }
60 49
61 return 0; 50 return 0;
62} 51}
@@ -74,27 +63,28 @@ void wait_stub_done(int pid)
74{ 63{
75 int n, status, err; 64 int n, status, err;
76 65
77 while(1){ 66 while (1) {
78 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED)); 67 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
79 if((n < 0) || !WIFSTOPPED(status)) 68 if ((n < 0) || !WIFSTOPPED(status))
80 goto bad_wait; 69 goto bad_wait;
81 70
82 if(((1 << WSTOPSIG(status)) & STUB_SIG_MASK) == 0) 71 if (((1 << WSTOPSIG(status)) & STUB_SIG_MASK) == 0)
83 break; 72 break;
84 73
85 err = ptrace(PTRACE_CONT, pid, 0, 0); 74 err = ptrace(PTRACE_CONT, pid, 0, 0);
86 if(err) 75 if (err)
87 panic("wait_stub_done : continue failed, errno = %d\n", 76 panic("wait_stub_done : continue failed, errno = %d\n",
88 errno); 77 errno);
89 } 78 }
90 79
91 if(((1 << WSTOPSIG(status)) & STUB_DONE_MASK) != 0) 80 if (((1 << WSTOPSIG(status)) & STUB_DONE_MASK) != 0)
92 return; 81 return;
93 82
94bad_wait: 83bad_wait:
95 err = ptrace_dump_regs(pid); 84 err = ptrace_dump_regs(pid);
96 if(err) 85 if (err)
97 printk("Failed to get registers from stub, errno = %d\n", -err); 86 printk(UM_KERN_ERR "Failed to get registers from stub, "
87 "errno = %d\n", -err);
98 panic("wait_stub_done : failed to wait for SIGUSR1/SIGTRAP, pid = %d, " 88 panic("wait_stub_done : failed to wait for SIGUSR1/SIGTRAP, pid = %d, "
99 "n = %d, errno = %d, status = 0x%x\n", pid, n, errno, status); 89 "n = %d, errno = %d, status = 0x%x\n", pid, n, errno, status);
100} 90}
@@ -105,9 +95,9 @@ void get_skas_faultinfo(int pid, struct faultinfo * fi)
105{ 95{
106 int err; 96 int err;
107 97
108 if(ptrace_faultinfo){ 98 if (ptrace_faultinfo) {
109 err = ptrace(PTRACE_FAULTINFO, pid, 0, fi); 99 err = ptrace(PTRACE_FAULTINFO, pid, 0, fi);
110 if(err) 100 if (err)
111 panic("get_skas_faultinfo - PTRACE_FAULTINFO failed, " 101 panic("get_skas_faultinfo - PTRACE_FAULTINFO failed, "
112 "errno = %d\n", errno); 102 "errno = %d\n", errno);
113 103
@@ -119,52 +109,57 @@ void get_skas_faultinfo(int pid, struct faultinfo * fi)
119 } 109 }
120 else { 110 else {
121 err = ptrace(PTRACE_CONT, pid, 0, SIGSEGV); 111 err = ptrace(PTRACE_CONT, pid, 0, SIGSEGV);
122 if(err) 112 if (err)
123 panic("Failed to continue stub, pid = %d, errno = %d\n", 113 panic("Failed to continue stub, pid = %d, errno = %d\n",
124 pid, errno); 114 pid, errno);
125 wait_stub_done(pid); 115 wait_stub_done(pid);
126 116
127 /* faultinfo is prepared by the stub-segv-handler at start of 117 /*
118 * faultinfo is prepared by the stub-segv-handler at start of
128 * the stub stack page. We just have to copy it. 119 * the stub stack page. We just have to copy it.
129 */ 120 */
130 memcpy(fi, (void *)current_stub_stack(), sizeof(*fi)); 121 memcpy(fi, (void *)current_stub_stack(), sizeof(*fi));
131 } 122 }
132} 123}
133 124
134static void handle_segv(int pid, union uml_pt_regs * regs) 125static void handle_segv(int pid, struct uml_pt_regs * regs)
135{ 126{
136 get_skas_faultinfo(pid, &regs->skas.faultinfo); 127 get_skas_faultinfo(pid, &regs->faultinfo);
137 segv(regs->skas.faultinfo, 0, 1, NULL); 128 segv(regs->faultinfo, 0, 1, NULL);
138} 129}
139 130
140/*To use the same value of using_sysemu as the caller, ask it that value (in local_using_sysemu)*/ 131/*
141static void handle_trap(int pid, union uml_pt_regs *regs, int local_using_sysemu) 132 * To use the same value of using_sysemu as the caller, ask it that value
133 * (in local_using_sysemu
134 */
135static void handle_trap(int pid, struct uml_pt_regs *regs,
136 int local_using_sysemu)
142{ 137{
143 int err, status; 138 int err, status;
144 139
145 /* Mark this as a syscall */ 140 /* Mark this as a syscall */
146 UPT_SYSCALL_NR(regs) = PT_SYSCALL_NR(regs->skas.regs); 141 UPT_SYSCALL_NR(regs) = PT_SYSCALL_NR(regs->gp);
147 142
148 if (!local_using_sysemu) 143 if (!local_using_sysemu)
149 { 144 {
150 err = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_NR_OFFSET, 145 err = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_NR_OFFSET,
151 __NR_getpid); 146 __NR_getpid);
152 if(err < 0) 147 if (err < 0)
153 panic("handle_trap - nullifying syscall failed errno = %d\n", 148 panic("handle_trap - nullifying syscall failed, "
154 errno); 149 "errno = %d\n", errno);
155 150
156 err = ptrace(PTRACE_SYSCALL, pid, 0, 0); 151 err = ptrace(PTRACE_SYSCALL, pid, 0, 0);
157 if(err < 0) 152 if (err < 0)
158 panic("handle_trap - continuing to end of syscall failed, " 153 panic("handle_trap - continuing to end of syscall "
159 "errno = %d\n", errno); 154 "failed, errno = %d\n", errno);
160 155
161 CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED)); 156 CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED));
162 if((err < 0) || !WIFSTOPPED(status) || 157 if ((err < 0) || !WIFSTOPPED(status) ||
163 (WSTOPSIG(status) != SIGTRAP + 0x80)){ 158 (WSTOPSIG(status) != SIGTRAP + 0x80)) {
164 err = ptrace_dump_regs(pid); 159 err = ptrace_dump_regs(pid);
165 if(err) 160 if (err)
166 printk("Failed to get registers from process, " 161 printk(UM_KERN_ERR "Failed to get registers "
167 "errno = %d\n", -err); 162 "from process, errno = %d\n", -err);
168 panic("handle_trap - failed to wait at end of syscall, " 163 panic("handle_trap - failed to wait at end of syscall, "
169 "errno = %d, status = %d\n", errno, status); 164 "errno = %d, status = %d\n", errno, status);
170 } 165 }
@@ -182,63 +177,64 @@ static int userspace_tramp(void *stack)
182 177
183 ptrace(PTRACE_TRACEME, 0, 0, 0); 178 ptrace(PTRACE_TRACEME, 0, 0, 0);
184 179
185 init_new_thread_signals(); 180 signal(SIGTERM, SIG_DFL);
186 err = set_interval(1); 181 err = set_interval();
187 if(err) 182 if (err)
188 panic("userspace_tramp - setting timer failed, errno = %d\n", 183 panic("userspace_tramp - setting timer failed, errno = %d\n",
189 err); 184 err);
190 185
191 if(!proc_mm){ 186 if (!proc_mm) {
192 /* This has a pte, but it can't be mapped in with the usual 187 /*
188 * This has a pte, but it can't be mapped in with the usual
193 * tlb_flush mechanism because this is part of that mechanism 189 * tlb_flush mechanism because this is part of that mechanism
194 */ 190 */
195 int fd; 191 int fd;
196 __u64 offset; 192 unsigned long long offset;
197 fd = phys_mapping(to_phys(&__syscall_stub_start), &offset); 193 fd = phys_mapping(to_phys(&__syscall_stub_start), &offset);
198 addr = mmap64((void *) UML_CONFIG_STUB_CODE, UM_KERN_PAGE_SIZE, 194 addr = mmap64((void *) STUB_CODE, UM_KERN_PAGE_SIZE,
199 PROT_EXEC, MAP_FIXED | MAP_PRIVATE, fd, offset); 195 PROT_EXEC, MAP_FIXED | MAP_PRIVATE, fd, offset);
200 if(addr == MAP_FAILED){ 196 if (addr == MAP_FAILED) {
201 printk("mapping mmap stub failed, errno = %d\n", 197 printk(UM_KERN_ERR "mapping mmap stub at 0x%lx failed, "
202 errno); 198 "errno = %d\n", STUB_CODE, errno);
203 exit(1); 199 exit(1);
204 } 200 }
205 201
206 if(stack != NULL){ 202 if (stack != NULL) {
207 fd = phys_mapping(to_phys(stack), &offset); 203 fd = phys_mapping(to_phys(stack), &offset);
208 addr = mmap((void *) UML_CONFIG_STUB_DATA, 204 addr = mmap((void *) STUB_DATA,
209 UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE, 205 UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE,
210 MAP_FIXED | MAP_SHARED, fd, offset); 206 MAP_FIXED | MAP_SHARED, fd, offset);
211 if(addr == MAP_FAILED){ 207 if (addr == MAP_FAILED) {
212 printk("mapping segfault stack failed, " 208 printk(UM_KERN_ERR "mapping segfault stack "
213 "errno = %d\n", errno); 209 "at 0x%lx failed, errno = %d\n",
210 STUB_DATA, errno);
214 exit(1); 211 exit(1);
215 } 212 }
216 } 213 }
217 } 214 }
218 if(!ptrace_faultinfo && (stack != NULL)){ 215 if (!ptrace_faultinfo && (stack != NULL)) {
219 struct sigaction sa; 216 struct sigaction sa;
220 217
221 unsigned long v = UML_CONFIG_STUB_CODE + 218 unsigned long v = STUB_CODE +
222 (unsigned long) stub_segv_handler - 219 (unsigned long) stub_segv_handler -
223 (unsigned long) &__syscall_stub_start; 220 (unsigned long) &__syscall_stub_start;
224 221
225 set_sigstack((void *) UML_CONFIG_STUB_DATA, UM_KERN_PAGE_SIZE); 222 set_sigstack((void *) STUB_DATA, UM_KERN_PAGE_SIZE);
226 sigemptyset(&sa.sa_mask); 223 sigemptyset(&sa.sa_mask);
227 sigaddset(&sa.sa_mask, SIGIO); 224 sigaddset(&sa.sa_mask, SIGIO);
228 sigaddset(&sa.sa_mask, SIGWINCH); 225 sigaddset(&sa.sa_mask, SIGWINCH);
229 sigaddset(&sa.sa_mask, SIGALRM);
230 sigaddset(&sa.sa_mask, SIGVTALRM); 226 sigaddset(&sa.sa_mask, SIGVTALRM);
231 sigaddset(&sa.sa_mask, SIGUSR1); 227 sigaddset(&sa.sa_mask, SIGUSR1);
232 sa.sa_flags = SA_ONSTACK; 228 sa.sa_flags = SA_ONSTACK;
233 sa.sa_handler = (void *) v; 229 sa.sa_handler = (void *) v;
234 sa.sa_restorer = NULL; 230 sa.sa_restorer = NULL;
235 if(sigaction(SIGSEGV, &sa, NULL) < 0) 231 if (sigaction(SIGSEGV, &sa, NULL) < 0)
236 panic("userspace_tramp - setting SIGSEGV handler " 232 panic("userspace_tramp - setting SIGSEGV handler "
237 "failed - errno = %d\n", errno); 233 "failed - errno = %d\n", errno);
238 } 234 }
239 235
240 os_stop_process(os_getpid()); 236 kill(os_getpid(), SIGSTOP);
241 return(0); 237 return 0;
242} 238}
243 239
244/* Each element set once, and only accessed by a single processor anyway */ 240/* Each element set once, and only accessed by a single processor anyway */
@@ -255,44 +251,55 @@ int start_userspace(unsigned long stub_stack)
255 stack = mmap(NULL, UM_KERN_PAGE_SIZE, 251 stack = mmap(NULL, UM_KERN_PAGE_SIZE,
256 PROT_READ | PROT_WRITE | PROT_EXEC, 252 PROT_READ | PROT_WRITE | PROT_EXEC,
257 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); 253 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
258 if(stack == MAP_FAILED) 254 if (stack == MAP_FAILED)
259 panic("start_userspace : mmap failed, errno = %d", errno); 255 panic("start_userspace : mmap failed, errno = %d", errno);
260 sp = (unsigned long) stack + UM_KERN_PAGE_SIZE - sizeof(void *); 256 sp = (unsigned long) stack + UM_KERN_PAGE_SIZE - sizeof(void *);
261 257
262 flags = CLONE_FILES | SIGCHLD; 258 flags = CLONE_FILES | SIGCHLD;
263 if(proc_mm) flags |= CLONE_VM; 259 if (proc_mm)
260 flags |= CLONE_VM;
261
264 pid = clone(userspace_tramp, (void *) sp, flags, (void *) stub_stack); 262 pid = clone(userspace_tramp, (void *) sp, flags, (void *) stub_stack);
265 if(pid < 0) 263 if (pid < 0)
266 panic("start_userspace : clone failed, errno = %d", errno); 264 panic("start_userspace : clone failed, errno = %d", errno);
267 265
268 do { 266 do {
269 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED)); 267 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
270 if(n < 0) 268 if (n < 0)
271 panic("start_userspace : wait failed, errno = %d", 269 panic("start_userspace : wait failed, errno = %d",
272 errno); 270 errno);
273 } while(WIFSTOPPED(status) && (WSTOPSIG(status) == SIGVTALRM)); 271 } while (WIFSTOPPED(status) && (WSTOPSIG(status) == SIGVTALRM));
274 272
275 if(!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGSTOP)) 273 if (!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGSTOP))
276 panic("start_userspace : expected SIGSTOP, got status = %d", 274 panic("start_userspace : expected SIGSTOP, got status = %d",
277 status); 275 status);
278 276
279 if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL, (void *)PTRACE_O_TRACESYSGOOD) < 0) 277 if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL,
280 panic("start_userspace : PTRACE_OLDSETOPTIONS failed, errno=%d\n", 278 (void *) PTRACE_O_TRACESYSGOOD) < 0)
281 errno); 279 panic("start_userspace : PTRACE_OLDSETOPTIONS failed, "
280 "errno = %d\n", errno);
282 281
283 if(munmap(stack, UM_KERN_PAGE_SIZE) < 0) 282 if (munmap(stack, UM_KERN_PAGE_SIZE) < 0)
284 panic("start_userspace : munmap failed, errno = %d\n", errno); 283 panic("start_userspace : munmap failed, errno = %d\n", errno);
285 284
286 return(pid); 285 return pid;
287} 286}
288 287
289void userspace(union uml_pt_regs *regs) 288void userspace(struct uml_pt_regs *regs)
290{ 289{
290 struct itimerval timer;
291 unsigned long long nsecs, now;
291 int err, status, op, pid = userspace_pid[0]; 292 int err, status, op, pid = userspace_pid[0];
292 /* To prevent races if using_sysemu changes under us.*/ 293 /* To prevent races if using_sysemu changes under us.*/
293 int local_using_sysemu; 294 int local_using_sysemu;
294 295
295 while(1){ 296 if (getitimer(ITIMER_VIRTUAL, &timer))
297 printk("Failed to get itimer, errno = %d\n", errno);
298 nsecs = timer.it_value.tv_sec * UM_NSEC_PER_SEC +
299 timer.it_value.tv_usec * UM_NSEC_PER_USEC;
300 nsecs += os_nsecs();
301
302 while (1) {
296 restore_registers(pid, regs); 303 restore_registers(pid, regs);
297 304
298 /* Now we set local_using_sysemu to be used for one loop */ 305 /* Now we set local_using_sysemu to be used for one loop */
@@ -302,26 +309,28 @@ void userspace(union uml_pt_regs *regs)
302 singlestepping(NULL)); 309 singlestepping(NULL));
303 310
304 err = ptrace(op, pid, 0, 0); 311 err = ptrace(op, pid, 0, 0);
305 if(err) 312 if (err)
306 panic("userspace - could not resume userspace process, " 313 panic("userspace - could not resume userspace process, "
307 "pid=%d, ptrace operation = %d, errno = %d\n", 314 "pid=%d, ptrace operation = %d, errno = %d\n",
308 pid, op, errno); 315 pid, op, errno);
309 316
310 CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED)); 317 CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED));
311 if(err < 0) 318 if (err < 0)
312 panic("userspace - waitpid failed, errno = %d\n", 319 panic("userspace - waitpid failed, errno = %d\n",
313 errno); 320 errno);
314 321
315 regs->skas.is_user = 1; 322 regs->is_user = 1;
316 save_registers(pid, regs); 323 save_registers(pid, regs);
317 UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */ 324 UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */
318 325
319 if(WIFSTOPPED(status)){ 326 if (WIFSTOPPED(status)) {
320 int sig = WSTOPSIG(status); 327 int sig = WSTOPSIG(status);
321 switch(sig){ 328 switch(sig) {
322 case SIGSEGV: 329 case SIGSEGV:
323 if(PTRACE_FULL_FAULTINFO || !ptrace_faultinfo){ 330 if (PTRACE_FULL_FAULTINFO ||
324 get_skas_faultinfo(pid, &regs->skas.faultinfo); 331 !ptrace_faultinfo) {
332 get_skas_faultinfo(pid,
333 &regs->faultinfo);
325 (*sig_info[SIGSEGV])(SIGSEGV, regs); 334 (*sig_info[SIGSEGV])(SIGSEGV, regs);
326 } 335 }
327 else handle_segv(pid, regs); 336 else handle_segv(pid, regs);
@@ -332,8 +341,20 @@ void userspace(union uml_pt_regs *regs)
332 case SIGTRAP: 341 case SIGTRAP:
333 relay_signal(SIGTRAP, regs); 342 relay_signal(SIGTRAP, regs);
334 break; 343 break;
335 case SIGIO:
336 case SIGVTALRM: 344 case SIGVTALRM:
345 now = os_nsecs();
346 if(now < nsecs)
347 break;
348 block_signals();
349 (*sig_info[sig])(sig, regs);
350 unblock_signals();
351 nsecs = timer.it_value.tv_sec *
352 UM_NSEC_PER_SEC +
353 timer.it_value.tv_usec *
354 UM_NSEC_PER_USEC;
355 nsecs += os_nsecs();
356 break;
357 case SIGIO:
337 case SIGILL: 358 case SIGILL:
338 case SIGBUS: 359 case SIGBUS:
339 case SIGFPE: 360 case SIGFPE:
@@ -343,30 +364,29 @@ void userspace(union uml_pt_regs *regs)
343 unblock_signals(); 364 unblock_signals();
344 break; 365 break;
345 default: 366 default:
346 printk("userspace - child stopped with signal " 367 printk(UM_KERN_ERR "userspace - child stopped "
347 "%d\n", sig); 368 "with signal %d\n", sig);
348 } 369 }
349 pid = userspace_pid[0]; 370 pid = userspace_pid[0];
350 interrupt_end(); 371 interrupt_end();
351 372
352 /* Avoid -ERESTARTSYS handling in host */ 373 /* Avoid -ERESTARTSYS handling in host */
353 if(PT_SYSCALL_NR_OFFSET != PT_SYSCALL_RET_OFFSET) 374 if (PT_SYSCALL_NR_OFFSET != PT_SYSCALL_RET_OFFSET)
354 PT_SYSCALL_NR(regs->skas.regs) = -1; 375 PT_SYSCALL_NR(regs->gp) = -1;
355 } 376 }
356 } 377 }
357} 378}
358 379
359static unsigned long thread_regs[MAX_REG_NR]; 380static unsigned long thread_regs[MAX_REG_NR];
360static unsigned long thread_fp_regs[HOST_FP_SIZE];
361 381
362static int __init init_thread_regs(void) 382static int __init init_thread_regs(void)
363{ 383{
364 get_safe_registers(thread_regs, thread_fp_regs); 384 get_safe_registers(thread_regs);
365 /* Set parent's instruction pointer to start of clone-stub */ 385 /* Set parent's instruction pointer to start of clone-stub */
366 thread_regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE + 386 thread_regs[REGS_IP_INDEX] = STUB_CODE +
367 (unsigned long) stub_clone_handler - 387 (unsigned long) stub_clone_handler -
368 (unsigned long) &__syscall_stub_start; 388 (unsigned long) &__syscall_stub_start;
369 thread_regs[REGS_SP_INDEX] = UML_CONFIG_STUB_DATA + UM_KERN_PAGE_SIZE - 389 thread_regs[REGS_SP_INDEX] = STUB_DATA + UM_KERN_PAGE_SIZE -
370 sizeof(void *); 390 sizeof(void *);
371#ifdef __SIGNAL_FRAMESIZE 391#ifdef __SIGNAL_FRAMESIZE
372 thread_regs[REGS_SP_INDEX] -= __SIGNAL_FRAMESIZE; 392 thread_regs[REGS_SP_INDEX] -= __SIGNAL_FRAMESIZE;
@@ -378,53 +398,53 @@ __initcall(init_thread_regs);
378 398
379int copy_context_skas0(unsigned long new_stack, int pid) 399int copy_context_skas0(unsigned long new_stack, int pid)
380{ 400{
401 struct timeval tv = { .tv_sec = 0, .tv_usec = UM_USEC_PER_SEC / UM_HZ };
381 int err; 402 int err;
382 unsigned long current_stack = current_stub_stack(); 403 unsigned long current_stack = current_stub_stack();
383 struct stub_data *data = (struct stub_data *) current_stack; 404 struct stub_data *data = (struct stub_data *) current_stack;
384 struct stub_data *child_data = (struct stub_data *) new_stack; 405 struct stub_data *child_data = (struct stub_data *) new_stack;
385 __u64 new_offset; 406 unsigned long long new_offset;
386 int new_fd = phys_mapping(to_phys((void *)new_stack), &new_offset); 407 int new_fd = phys_mapping(to_phys((void *)new_stack), &new_offset);
387 408
388 /* prepare offset and fd of child's stack as argument for parent's 409 /*
410 * prepare offset and fd of child's stack as argument for parent's
389 * and child's mmap2 calls 411 * and child's mmap2 calls
390 */ 412 */
391 *data = ((struct stub_data) { .offset = MMAP_OFFSET(new_offset), 413 *data = ((struct stub_data) { .offset = MMAP_OFFSET(new_offset),
392 .fd = new_fd, 414 .fd = new_fd,
393 .timer = ((struct itimerval) 415 .timer = ((struct itimerval)
394 { { 0, 1000000 / hz() }, 416 { .it_value = tv,
395 { 0, 1000000 / hz() }})}); 417 .it_interval = tv }) });
418
396 err = ptrace_setregs(pid, thread_regs); 419 err = ptrace_setregs(pid, thread_regs);
397 if(err < 0) 420 if (err < 0)
398 panic("copy_context_skas0 : PTRACE_SETREGS failed, " 421 panic("copy_context_skas0 : PTRACE_SETREGS failed, "
399 "pid = %d, errno = %d\n", pid, -err); 422 "pid = %d, errno = %d\n", pid, -err);
400 423
401 err = ptrace_setfpregs(pid, thread_fp_regs);
402 if(err < 0)
403 panic("copy_context_skas0 : PTRACE_SETFPREGS failed, "
404 "pid = %d, errno = %d\n", pid, -err);
405
406 /* set a well known return code for detection of child write failure */ 424 /* set a well known return code for detection of child write failure */
407 child_data->err = 12345678; 425 child_data->err = 12345678;
408 426
409 /* Wait, until parent has finished its work: read child's pid from 427 /*
428 * Wait, until parent has finished its work: read child's pid from
410 * parent's stack, and check, if bad result. 429 * parent's stack, and check, if bad result.
411 */ 430 */
412 err = ptrace(PTRACE_CONT, pid, 0, 0); 431 err = ptrace(PTRACE_CONT, pid, 0, 0);
413 if(err) 432 if (err)
414 panic("Failed to continue new process, pid = %d, " 433 panic("Failed to continue new process, pid = %d, "
415 "errno = %d\n", pid, errno); 434 "errno = %d\n", pid, errno);
416 wait_stub_done(pid); 435 wait_stub_done(pid);
417 436
418 pid = data->err; 437 pid = data->err;
419 if(pid < 0) 438 if (pid < 0)
420 panic("copy_context_skas0 - stub-parent reports error %d\n", 439 panic("copy_context_skas0 - stub-parent reports error %d\n",
421 -pid); 440 -pid);
422 441
423 /* Wait, until child has finished too: read child's result from 442 /*
443 * Wait, until child has finished too: read child's result from
424 * child's stack and check it. 444 * child's stack and check it.
425 */ 445 */
426 wait_stub_done(pid); 446 wait_stub_done(pid);
427 if (child_data->err != UML_CONFIG_STUB_DATA) 447 if (child_data->err != STUB_DATA)
428 panic("copy_context_skas0 - stub-child reports error %ld\n", 448 panic("copy_context_skas0 - stub-child reports error %ld\n",
429 child_data->err); 449 child_data->err);
430 450
@@ -446,7 +466,7 @@ void map_stub_pages(int fd, unsigned long code,
446{ 466{
447 struct proc_mm_op mmop; 467 struct proc_mm_op mmop;
448 int n; 468 int n;
449 __u64 code_offset; 469 unsigned long long code_offset;
450 int code_fd = phys_mapping(to_phys((void *) &__syscall_stub_start), 470 int code_fd = phys_mapping(to_phys((void *) &__syscall_stub_start),
451 &code_offset); 471 &code_offset);
452 472
@@ -461,16 +481,17 @@ void map_stub_pages(int fd, unsigned long code,
461 .offset = code_offset 481 .offset = code_offset
462 } } }); 482 } } });
463 CATCH_EINTR(n = write(fd, &mmop, sizeof(mmop))); 483 CATCH_EINTR(n = write(fd, &mmop, sizeof(mmop)));
464 if(n != sizeof(mmop)){ 484 if (n != sizeof(mmop)) {
465 n = errno; 485 n = errno;
466 printk("mmap args - addr = 0x%lx, fd = %d, offset = %llx\n", 486 printk(UM_KERN_ERR "mmap args - addr = 0x%lx, fd = %d, "
467 code, code_fd, (unsigned long long) code_offset); 487 "offset = %llx\n", code, code_fd,
488 (unsigned long long) code_offset);
468 panic("map_stub_pages : /proc/mm map for code failed, " 489 panic("map_stub_pages : /proc/mm map for code failed, "
469 "err = %d\n", n); 490 "err = %d\n", n);
470 } 491 }
471 492
472 if ( stack ) { 493 if (stack) {
473 __u64 map_offset; 494 unsigned long long map_offset;
474 int map_fd = phys_mapping(to_phys((void *)stack), &map_offset); 495 int map_fd = phys_mapping(to_phys((void *)stack), &map_offset);
475 mmop = ((struct proc_mm_op) 496 mmop = ((struct proc_mm_op)
476 { .op = MM_MMAP, 497 { .op = MM_MMAP,
@@ -484,7 +505,7 @@ void map_stub_pages(int fd, unsigned long code,
484 .offset = map_offset 505 .offset = map_offset
485 } } }); 506 } } });
486 CATCH_EINTR(n = write(fd, &mmop, sizeof(mmop))); 507 CATCH_EINTR(n = write(fd, &mmop, sizeof(mmop)));
487 if(n != sizeof(mmop)) 508 if (n != sizeof(mmop))
488 panic("map_stub_pages : /proc/mm map for data failed, " 509 panic("map_stub_pages : /proc/mm map for data failed, "
489 "err = %d\n", errno); 510 "err = %d\n", errno);
490 } 511 }
@@ -504,7 +525,7 @@ void new_thread(void *stack, jmp_buf *buf, void (*handler)(void))
504 525
505void switch_threads(jmp_buf *me, jmp_buf *you) 526void switch_threads(jmp_buf *me, jmp_buf *you)
506{ 527{
507 if(UML_SETJMP(me) == 0) 528 if (UML_SETJMP(me) == 0)
508 UML_LONGJMP(you, 1); 529 UML_LONGJMP(you, 1);
509} 530}
510 531
@@ -520,8 +541,7 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf)
520 int n; 541 int n;
521 542
522 set_handler(SIGWINCH, (__sighandler_t) sig_handler, 543 set_handler(SIGWINCH, (__sighandler_t) sig_handler,
523 SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGALRM, 544 SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGVTALRM, -1);
524 SIGVTALRM, -1);
525 545
526 /* 546 /*
527 * Can't use UML_SETJMP or UML_LONGJMP here because they save 547 * Can't use UML_SETJMP or UML_LONGJMP here because they save
@@ -532,7 +552,7 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf)
532 * after returning to the jumper. 552 * after returning to the jumper.
533 */ 553 */
534 n = setjmp(initial_jmpbuf); 554 n = setjmp(initial_jmpbuf);
535 switch(n){ 555 switch(n) {
536 case INIT_JMP_NEW_THREAD: 556 case INIT_JMP_NEW_THREAD:
537 (*switch_buf)[0].JB_IP = (unsigned long) new_thread_handler; 557 (*switch_buf)[0].JB_IP = (unsigned long) new_thread_handler;
538 (*switch_buf)[0].JB_SP = (unsigned long) stack + 558 (*switch_buf)[0].JB_SP = (unsigned long) stack +
@@ -544,10 +564,10 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf)
544 break; 564 break;
545 case INIT_JMP_HALT: 565 case INIT_JMP_HALT:
546 kmalloc_ok = 0; 566 kmalloc_ok = 0;
547 return(0); 567 return 0;
548 case INIT_JMP_REBOOT: 568 case INIT_JMP_REBOOT:
549 kmalloc_ok = 0; 569 kmalloc_ok = 0;
550 return(1); 570 return 1;
551 default: 571 default:
552 panic("Bad sigsetjmp return in start_idle_thread - %d\n", n); 572 panic("Bad sigsetjmp return in start_idle_thread - %d\n", n);
553 } 573 }
@@ -563,7 +583,7 @@ void initial_thread_cb_skas(void (*proc)(void *), void *arg)
563 cb_back = &here; 583 cb_back = &here;
564 584
565 block_signals(); 585 block_signals();
566 if(UML_SETJMP(&here) == 0) 586 if (UML_SETJMP(&here) == 0)
567 UML_LONGJMP(&initial_jmpbuf, INIT_JMP_CALLBACK); 587 UML_LONGJMP(&initial_jmpbuf, INIT_JMP_CALLBACK);
568 unblock_signals(); 588 unblock_signals();
569 589
@@ -584,16 +604,16 @@ void reboot_skas(void)
584 UML_LONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT); 604 UML_LONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT);
585} 605}
586 606
587void switch_mm_skas(struct mm_id *mm_idp) 607void __switch_mm(struct mm_id *mm_idp)
588{ 608{
589 int err; 609 int err;
590 610
591 /* FIXME: need cpu pid in switch_mm_skas */ 611 /* FIXME: need cpu pid in __switch_mm */
592 if(proc_mm){ 612 if (proc_mm) {
593 err = ptrace(PTRACE_SWITCH_MM, userspace_pid[0], 0, 613 err = ptrace(PTRACE_SWITCH_MM, userspace_pid[0], 0,
594 mm_idp->u.mm_fd); 614 mm_idp->u.mm_fd);
595 if(err) 615 if (err)
596 panic("switch_mm_skas - PTRACE_SWITCH_MM failed, " 616 panic("__switch_mm - PTRACE_SWITCH_MM failed, "
597 "errno = %d\n", errno); 617 "errno = %d\n", errno);
598 } 618 }
599 else userspace_pid[0] = mm_idp->u.pid; 619 else userspace_pid[0] = mm_idp->u.pid;
diff --git a/arch/um/os-Linux/skas/trap.c b/arch/um/os-Linux/skas/trap.c
index 3b600c2e63b8..3b1b9244f468 100644
--- a/arch/um/os-Linux/skas/trap.c
+++ b/arch/um/os-Linux/skas/trap.c
@@ -1,37 +1,43 @@
1/* 1/*
2 * Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <signal.h> 6#if 0
7#include <errno.h>
8#include "kern_util.h" 7#include "kern_util.h"
9#include "as-layout.h"
10#include "task.h"
11#include "sigcontext.h"
12#include "skas.h" 8#include "skas.h"
13#include "ptrace_user.h" 9#include "ptrace_user.h"
14#include "sysdep/ptrace.h"
15#include "sysdep/ptrace_user.h" 10#include "sysdep/ptrace_user.h"
11#endif
12
13#include <errno.h>
14#include <signal.h>
15#include "sysdep/ptrace.h"
16#include "kern_constants.h"
17#include "as-layout.h"
16#include "os.h" 18#include "os.h"
19#include "sigcontext.h"
20#include "task.h"
17 21
18static union uml_pt_regs ksig_regs[UM_NR_CPUS]; 22static struct uml_pt_regs ksig_regs[UM_NR_CPUS];
19 23
20void sig_handler_common_skas(int sig, void *sc_ptr) 24void sig_handler_common_skas(int sig, void *sc_ptr)
21{ 25{
22 struct sigcontext *sc = sc_ptr; 26 struct sigcontext *sc = sc_ptr;
23 union uml_pt_regs *r; 27 struct uml_pt_regs *r;
24 void (*handler)(int, union uml_pt_regs *); 28 void (*handler)(int, struct uml_pt_regs *);
25 int save_user, save_errno = errno; 29 int save_user, save_errno = errno;
26 30
27 /* This is done because to allow SIGSEGV to be delivered inside a SEGV 31 /*
32 * This is done because to allow SIGSEGV to be delivered inside a SEGV
28 * handler. This can happen in copy_user, and if SEGV is disabled, 33 * handler. This can happen in copy_user, and if SEGV is disabled,
29 * the process will die. 34 * the process will die.
30 * XXX Figure out why this is better than SA_NODEFER 35 * XXX Figure out why this is better than SA_NODEFER
31 */ 36 */
32 if(sig == SIGSEGV) { 37 if (sig == SIGSEGV) {
33 change_sig(SIGSEGV, 1); 38 change_sig(SIGSEGV, 1);
34 /* For segfaults, we want the data from the 39 /*
40 * For segfaults, we want the data from the
35 * sigcontext. In this case, we don't want to mangle 41 * sigcontext. In this case, we don't want to mangle
36 * the process registers, so use a static set of 42 * the process registers, so use a static set of
37 * registers. For other signals, the process 43 * registers. For other signals, the process
@@ -42,25 +48,22 @@ void sig_handler_common_skas(int sig, void *sc_ptr)
42 } 48 }
43 else r = TASK_REGS(get_current()); 49 else r = TASK_REGS(get_current());
44 50
45 save_user = r->skas.is_user; 51 save_user = r->is_user;
46 r->skas.is_user = 0; 52 r->is_user = 0;
47 if ( sig == SIGFPE || sig == SIGSEGV || 53 if ((sig == SIGFPE) || (sig == SIGSEGV) || (sig == SIGBUS) ||
48 sig == SIGBUS || sig == SIGILL || 54 (sig == SIGILL) || (sig == SIGTRAP))
49 sig == SIGTRAP ) { 55 GET_FAULTINFO_FROM_SC(r->faultinfo, sc);
50 GET_FAULTINFO_FROM_SC(r->skas.faultinfo, sc);
51 }
52 56
53 change_sig(SIGUSR1, 1); 57 change_sig(SIGUSR1, 1);
54 58
55 handler = sig_info[sig]; 59 handler = sig_info[sig];
56 60
57 /* unblock SIGALRM, SIGVTALRM, SIGIO if sig isn't IRQ signal */ 61 /* unblock SIGVTALRM, SIGIO if sig isn't IRQ signal */
58 if (sig != SIGIO && sig != SIGWINCH && 62 if ((sig != SIGIO) && (sig != SIGWINCH) && (sig != SIGVTALRM))
59 sig != SIGVTALRM && sig != SIGALRM)
60 unblock_signals(); 63 unblock_signals();
61 64
62 handler(sig, r); 65 handler(sig, r);
63 66
64 errno = save_errno; 67 errno = save_errno;
65 r->skas.is_user = save_user; 68 r->is_user = save_user;
66} 69}
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 46f613975c19..7b81f6c08a5e 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -1,75 +1,65 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <pty.h>
7#include <stdio.h> 6#include <stdio.h>
8#include <stddef.h>
9#include <stdarg.h>
10#include <stdlib.h> 7#include <stdlib.h>
11#include <string.h> 8#include <stdarg.h>
12#include <unistd.h> 9#include <unistd.h>
13#include <signal.h>
14#include <sched.h>
15#include <fcntl.h>
16#include <errno.h> 10#include <errno.h>
17#include <sys/time.h> 11#include <fcntl.h>
18#include <sys/wait.h> 12#include <sched.h>
13#include <signal.h>
14#include <string.h>
19#include <sys/mman.h> 15#include <sys/mman.h>
20#include <sys/resource.h> 16#include <sys/ptrace.h>
17#include <sys/stat.h>
18#include <sys/wait.h>
21#include <asm/unistd.h> 19#include <asm/unistd.h>
22#include <asm/page.h>
23#include <sys/types.h>
24#include "kern_util.h"
25#include "user.h"
26#include "signal_kern.h"
27#include "sysdep/ptrace.h"
28#include "sysdep/sigcontext.h"
29#include "irq_user.h"
30#include "ptrace_user.h"
31#include "mem_user.h"
32#include "init.h" 20#include "init.h"
33#include "os.h"
34#include "uml-config.h"
35#include "choose-mode.h"
36#include "mode.h"
37#include "tempfile.h"
38#include "kern_constants.h" 21#include "kern_constants.h"
39 22#include "os.h"
40#ifdef UML_CONFIG_MODE_SKAS 23#include "mem_user.h"
41#include "skas.h" 24#include "ptrace_user.h"
42#include "skas_ptrace.h"
43#include "registers.h" 25#include "registers.h"
44#endif 26#include "skas_ptrace.h"
45 27
46static int ptrace_child(void *arg) 28static int ptrace_child(void)
47{ 29{
48 int ret; 30 int ret;
31 /* Calling os_getpid because some libcs cached getpid incorrectly */
49 int pid = os_getpid(), ppid = getppid(); 32 int pid = os_getpid(), ppid = getppid();
50 int sc_result; 33 int sc_result;
51 34
52 change_sig(SIGWINCH, 0); 35 change_sig(SIGWINCH, 0);
53 if(ptrace(PTRACE_TRACEME, 0, 0, 0) < 0){ 36 if (ptrace(PTRACE_TRACEME, 0, 0, 0) < 0) {
54 perror("ptrace"); 37 perror("ptrace");
55 os_kill_process(pid, 0); 38 kill(pid, SIGKILL);
56 } 39 }
57 kill(pid, SIGSTOP); 40 kill(pid, SIGSTOP);
58 41
59 /*This syscall will be intercepted by the parent. Don't call more than 42 /*
60 * once, please.*/ 43 * This syscall will be intercepted by the parent. Don't call more than
44 * once, please.
45 */
61 sc_result = os_getpid(); 46 sc_result = os_getpid();
62 47
63 if (sc_result == pid) 48 if (sc_result == pid)
64 ret = 1; /*Nothing modified by the parent, we are running 49 /* Nothing modified by the parent, we are running normally. */
65 normally.*/ 50 ret = 1;
66 else if (sc_result == ppid) 51 else if (sc_result == ppid)
67 ret = 0; /*Expected in check_ptrace and check_sysemu when they 52 /*
68 succeed in modifying the stack frame*/ 53 * Expected in check_ptrace and check_sysemu when they succeed
54 * in modifying the stack frame
55 */
56 ret = 0;
69 else 57 else
70 ret = 2; /*Serious trouble! This could be caused by a bug in 58 /* Serious trouble! This could be caused by a bug in host 2.6
71 host 2.6 SKAS3/2.6 patch before release -V6, together 59 * SKAS3/2.6 patch before release -V6, together with a bug in
72 with a bug in the UML code itself.*/ 60 * the UML code itself.
61 */
62 ret = 2;
73 _exit(ret); 63 _exit(ret);
74} 64}
75 65
@@ -101,29 +91,23 @@ static void non_fatal(char *fmt, ...)
101 fflush(stdout); 91 fflush(stdout);
102} 92}
103 93
104static int start_ptraced_child(void **stack_out) 94static int start_ptraced_child(void)
105{ 95{
106 void *stack;
107 unsigned long sp;
108 int pid, n, status; 96 int pid, n, status;
109 97
110 stack = mmap(NULL, UM_KERN_PAGE_SIZE, 98 pid = fork();
111 PROT_READ | PROT_WRITE | PROT_EXEC, 99 if (pid == 0)
112 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); 100 ptrace_child();
113 if(stack == MAP_FAILED) 101 else if (pid < 0)
114 fatal_perror("check_ptrace : mmap failed"); 102 fatal_perror("start_ptraced_child : fork failed");
115 sp = (unsigned long) stack + UM_KERN_PAGE_SIZE - sizeof(void *); 103
116 pid = clone(ptrace_child, (void *) sp, SIGCHLD, NULL);
117 if(pid < 0)
118 fatal_perror("start_ptraced_child : clone failed");
119 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED)); 104 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
120 if(n < 0) 105 if (n < 0)
121 fatal_perror("check_ptrace : clone failed"); 106 fatal_perror("check_ptrace : waitpid failed");
122 if(!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGSTOP)) 107 if (!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGSTOP))
123 fatal("check_ptrace : expected SIGSTOP, got status = %d", 108 fatal("check_ptrace : expected SIGSTOP, got status = %d",
124 status); 109 status);
125 110
126 *stack_out = stack;
127 return pid; 111 return pid;
128} 112}
129 113
@@ -133,15 +117,14 @@ static int start_ptraced_child(void **stack_out)
133 * So only for SYSEMU features we test mustpanic, while normal host features 117 * So only for SYSEMU features we test mustpanic, while normal host features
134 * must work anyway! 118 * must work anyway!
135 */ 119 */
136static int stop_ptraced_child(int pid, void *stack, int exitcode, 120static int stop_ptraced_child(int pid, int exitcode, int mustexit)
137 int mustexit)
138{ 121{
139 int status, n, ret = 0; 122 int status, n, ret = 0;
140 123
141 if(ptrace(PTRACE_CONT, pid, 0, 0) < 0) 124 if (ptrace(PTRACE_CONT, pid, 0, 0) < 0)
142 fatal_perror("stop_ptraced_child : ptrace failed"); 125 fatal_perror("stop_ptraced_child : ptrace failed");
143 CATCH_EINTR(n = waitpid(pid, &status, 0)); 126 CATCH_EINTR(n = waitpid(pid, &status, 0));
144 if(!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) { 127 if (!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) {
145 int exit_with = WEXITSTATUS(status); 128 int exit_with = WEXITSTATUS(status);
146 if (exit_with == 2) 129 if (exit_with == 2)
147 non_fatal("check_ptrace : child exited with status 2. " 130 non_fatal("check_ptrace : child exited with status 2. "
@@ -154,8 +137,6 @@ static int stop_ptraced_child(int pid, void *stack, int exitcode,
154 ret = -1; 137 ret = -1;
155 } 138 }
156 139
157 if(munmap(stack, UM_KERN_PAGE_SIZE) < 0)
158 fatal_perror("check_ptrace : munmap failed");
159 return ret; 140 return ret;
160} 141}
161 142
@@ -207,40 +188,39 @@ __uml_setup("nosysemu", nosysemu_cmd_param,
207 188
208static void __init check_sysemu(void) 189static void __init check_sysemu(void)
209{ 190{
210 void *stack;
211 unsigned long regs[MAX_REG_NR]; 191 unsigned long regs[MAX_REG_NR];
212 int pid, n, status, count=0; 192 int pid, n, status, count=0;
213 193
214 non_fatal("Checking syscall emulation patch for ptrace..."); 194 non_fatal("Checking syscall emulation patch for ptrace...");
215 sysemu_supported = 0; 195 sysemu_supported = 0;
216 pid = start_ptraced_child(&stack); 196 pid = start_ptraced_child();
217 197
218 if(ptrace(PTRACE_SYSEMU, pid, 0, 0) < 0) 198 if (ptrace(PTRACE_SYSEMU, pid, 0, 0) < 0)
219 goto fail; 199 goto fail;
220 200
221 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED)); 201 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
222 if (n < 0) 202 if (n < 0)
223 fatal_perror("check_sysemu : wait failed"); 203 fatal_perror("check_sysemu : wait failed");
224 if(!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP)) 204 if (!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP))
225 fatal("check_sysemu : expected SIGTRAP, got status = %d", 205 fatal("check_sysemu : expected SIGTRAP, got status = %d",
226 status); 206 status);
227 207
228 if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0) 208 if (ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
229 fatal_perror("check_sysemu : PTRACE_GETREGS failed"); 209 fatal_perror("check_sysemu : PTRACE_GETREGS failed");
230 if(PT_SYSCALL_NR(regs) != __NR_getpid){ 210 if (PT_SYSCALL_NR(regs) != __NR_getpid) {
231 non_fatal("check_sysemu got system call number %d, " 211 non_fatal("check_sysemu got system call number %d, "
232 "expected %d...", PT_SYSCALL_NR(regs), __NR_getpid); 212 "expected %d...", PT_SYSCALL_NR(regs), __NR_getpid);
233 goto fail; 213 goto fail;
234 } 214 }
235 215
236 n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, os_getpid()); 216 n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, os_getpid());
237 if(n < 0){ 217 if (n < 0) {
238 non_fatal("check_sysemu : failed to modify system call " 218 non_fatal("check_sysemu : failed to modify system call "
239 "return"); 219 "return");
240 goto fail; 220 goto fail;
241 } 221 }
242 222
243 if (stop_ptraced_child(pid, stack, 0, 0) < 0) 223 if (stop_ptraced_child(pid, 0, 0) < 0)
244 goto fail_stopped; 224 goto fail_stopped;
245 225
246 sysemu_supported = 1; 226 sysemu_supported = 1;
@@ -248,90 +228,90 @@ static void __init check_sysemu(void)
248 set_using_sysemu(!force_sysemu_disabled); 228 set_using_sysemu(!force_sysemu_disabled);
249 229
250 non_fatal("Checking advanced syscall emulation patch for ptrace..."); 230 non_fatal("Checking advanced syscall emulation patch for ptrace...");
251 pid = start_ptraced_child(&stack); 231 pid = start_ptraced_child();
252 232
253 if((ptrace(PTRACE_OLDSETOPTIONS, pid, 0, 233 if ((ptrace(PTRACE_OLDSETOPTIONS, pid, 0,
254 (void *) PTRACE_O_TRACESYSGOOD) < 0)) 234 (void *) PTRACE_O_TRACESYSGOOD) < 0))
255 fatal_perror("check_ptrace: PTRACE_OLDSETOPTIONS failed"); 235 fatal_perror("check_ptrace: PTRACE_OLDSETOPTIONS failed");
256 236
257 while(1){ 237 while (1) {
258 count++; 238 count++;
259 if(ptrace(PTRACE_SYSEMU_SINGLESTEP, pid, 0, 0) < 0) 239 if (ptrace(PTRACE_SYSEMU_SINGLESTEP, pid, 0, 0) < 0)
260 goto fail; 240 goto fail;
261 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED)); 241 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
262 if(n < 0) 242 if (n < 0)
263 fatal_perror("check_ptrace : wait failed"); 243 fatal_perror("check_ptrace : wait failed");
264 244
265 if(WIFSTOPPED(status) && (WSTOPSIG(status) == (SIGTRAP|0x80))){ 245 if (WIFSTOPPED(status) &&
246 (WSTOPSIG(status) == (SIGTRAP|0x80))) {
266 if (!count) 247 if (!count)
267 fatal("check_ptrace : SYSEMU_SINGLESTEP " 248 fatal("check_ptrace : SYSEMU_SINGLESTEP "
268 "doesn't singlestep"); 249 "doesn't singlestep");
269 n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, 250 n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET,
270 os_getpid()); 251 os_getpid());
271 if(n < 0) 252 if (n < 0)
272 fatal_perror("check_sysemu : failed to modify " 253 fatal_perror("check_sysemu : failed to modify "
273 "system call return"); 254 "system call return");
274 break; 255 break;
275 } 256 }
276 else if(WIFSTOPPED(status) && (WSTOPSIG(status) == SIGTRAP)) 257 else if (WIFSTOPPED(status) && (WSTOPSIG(status) == SIGTRAP))
277 count++; 258 count++;
278 else 259 else
279 fatal("check_ptrace : expected SIGTRAP or " 260 fatal("check_ptrace : expected SIGTRAP or "
280 "(SIGTRAP | 0x80), got status = %d", status); 261 "(SIGTRAP | 0x80), got status = %d", status);
281 } 262 }
282 if (stop_ptraced_child(pid, stack, 0, 0) < 0) 263 if (stop_ptraced_child(pid, 0, 0) < 0)
283 goto fail_stopped; 264 goto fail_stopped;
284 265
285 sysemu_supported = 2; 266 sysemu_supported = 2;
286 non_fatal("OK\n"); 267 non_fatal("OK\n");
287 268
288 if ( !force_sysemu_disabled ) 269 if (!force_sysemu_disabled)
289 set_using_sysemu(sysemu_supported); 270 set_using_sysemu(sysemu_supported);
290 return; 271 return;
291 272
292fail: 273fail:
293 stop_ptraced_child(pid, stack, 1, 0); 274 stop_ptraced_child(pid, 1, 0);
294fail_stopped: 275fail_stopped:
295 non_fatal("missing\n"); 276 non_fatal("missing\n");
296} 277}
297 278
298static void __init check_ptrace(void) 279static void __init check_ptrace(void)
299{ 280{
300 void *stack;
301 int pid, syscall, n, status; 281 int pid, syscall, n, status;
302 282
303 non_fatal("Checking that ptrace can change system call numbers..."); 283 non_fatal("Checking that ptrace can change system call numbers...");
304 pid = start_ptraced_child(&stack); 284 pid = start_ptraced_child();
305 285
306 if((ptrace(PTRACE_OLDSETOPTIONS, pid, 0, 286 if ((ptrace(PTRACE_OLDSETOPTIONS, pid, 0,
307 (void *) PTRACE_O_TRACESYSGOOD) < 0)) 287 (void *) PTRACE_O_TRACESYSGOOD) < 0))
308 fatal_perror("check_ptrace: PTRACE_OLDSETOPTIONS failed"); 288 fatal_perror("check_ptrace: PTRACE_OLDSETOPTIONS failed");
309 289
310 while(1){ 290 while (1) {
311 if(ptrace(PTRACE_SYSCALL, pid, 0, 0) < 0) 291 if (ptrace(PTRACE_SYSCALL, pid, 0, 0) < 0)
312 fatal_perror("check_ptrace : ptrace failed"); 292 fatal_perror("check_ptrace : ptrace failed");
313 293
314 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED)); 294 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
315 if(n < 0) 295 if (n < 0)
316 fatal_perror("check_ptrace : wait failed"); 296 fatal_perror("check_ptrace : wait failed");
317 297
318 if(!WIFSTOPPED(status) || 298 if (!WIFSTOPPED(status) ||
319 (WSTOPSIG(status) != (SIGTRAP | 0x80))) 299 (WSTOPSIG(status) != (SIGTRAP | 0x80)))
320 fatal("check_ptrace : expected (SIGTRAP|0x80), " 300 fatal("check_ptrace : expected (SIGTRAP|0x80), "
321 "got status = %d", status); 301 "got status = %d", status);
322 302
323 syscall = ptrace(PTRACE_PEEKUSR, pid, PT_SYSCALL_NR_OFFSET, 303 syscall = ptrace(PTRACE_PEEKUSR, pid, PT_SYSCALL_NR_OFFSET,
324 0); 304 0);
325 if(syscall == __NR_getpid){ 305 if (syscall == __NR_getpid) {
326 n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_NR_OFFSET, 306 n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_NR_OFFSET,
327 __NR_getppid); 307 __NR_getppid);
328 if(n < 0) 308 if (n < 0)
329 fatal_perror("check_ptrace : failed to modify " 309 fatal_perror("check_ptrace : failed to modify "
330 "system call"); 310 "system call");
331 break; 311 break;
332 } 312 }
333 } 313 }
334 stop_ptraced_child(pid, stack, 0, 1); 314 stop_ptraced_child(pid, 0, 1);
335 non_fatal("OK\n"); 315 non_fatal("OK\n");
336 check_sysemu(); 316 check_sysemu();
337} 317}
@@ -343,18 +323,18 @@ static void __init check_coredump_limit(void)
343 struct rlimit lim; 323 struct rlimit lim;
344 int err = getrlimit(RLIMIT_CORE, &lim); 324 int err = getrlimit(RLIMIT_CORE, &lim);
345 325
346 if(err){ 326 if (err) {
347 perror("Getting core dump limit"); 327 perror("Getting core dump limit");
348 return; 328 return;
349 } 329 }
350 330
351 printf("Core dump limits :\n\tsoft - "); 331 printf("Core dump limits :\n\tsoft - ");
352 if(lim.rlim_cur == RLIM_INFINITY) 332 if (lim.rlim_cur == RLIM_INFINITY)
353 printf("NONE\n"); 333 printf("NONE\n");
354 else printf("%lu\n", lim.rlim_cur); 334 else printf("%lu\n", lim.rlim_cur);
355 335
356 printf("\thard - "); 336 printf("\thard - ");
357 if(lim.rlim_max == RLIM_INFINITY) 337 if (lim.rlim_max == RLIM_INFINITY)
358 printf("NONE\n"); 338 printf("NONE\n");
359 else printf("%lu\n", lim.rlim_max); 339 else printf("%lu\n", lim.rlim_max);
360} 340}
@@ -408,20 +388,18 @@ __uml_setup("noptraceldt", noptraceldt_cmd_param,
408" To support PTRACE_LDT, the host needs to be patched using\n" 388" To support PTRACE_LDT, the host needs to be patched using\n"
409" the current skas3 patch.\n\n"); 389" the current skas3 patch.\n\n");
410 390
411#ifdef UML_CONFIG_MODE_SKAS
412static inline void check_skas3_ptrace_faultinfo(void) 391static inline void check_skas3_ptrace_faultinfo(void)
413{ 392{
414 struct ptrace_faultinfo fi; 393 struct ptrace_faultinfo fi;
415 void *stack;
416 int pid, n; 394 int pid, n;
417 395
418 non_fatal(" - PTRACE_FAULTINFO..."); 396 non_fatal(" - PTRACE_FAULTINFO...");
419 pid = start_ptraced_child(&stack); 397 pid = start_ptraced_child();
420 398
421 n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi); 399 n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi);
422 if (n < 0) { 400 if (n < 0) {
423 ptrace_faultinfo = 0; 401 ptrace_faultinfo = 0;
424 if(errno == EIO) 402 if (errno == EIO)
425 non_fatal("not found\n"); 403 non_fatal("not found\n");
426 else 404 else
427 perror("not found"); 405 perror("not found");
@@ -434,13 +412,12 @@ static inline void check_skas3_ptrace_faultinfo(void)
434 } 412 }
435 413
436 init_registers(pid); 414 init_registers(pid);
437 stop_ptraced_child(pid, stack, 1, 1); 415 stop_ptraced_child(pid, 1, 1);
438} 416}
439 417
440static inline void check_skas3_ptrace_ldt(void) 418static inline void check_skas3_ptrace_ldt(void)
441{ 419{
442#ifdef PTRACE_LDT 420#ifdef PTRACE_LDT
443 void *stack;
444 int pid, n; 421 int pid, n;
445 unsigned char ldtbuf[40]; 422 unsigned char ldtbuf[40];
446 struct ptrace_ldt ldt_op = (struct ptrace_ldt) { 423 struct ptrace_ldt ldt_op = (struct ptrace_ldt) {
@@ -449,11 +426,11 @@ static inline void check_skas3_ptrace_ldt(void)
449 .bytecount = sizeof(ldtbuf)}; 426 .bytecount = sizeof(ldtbuf)};
450 427
451 non_fatal(" - PTRACE_LDT..."); 428 non_fatal(" - PTRACE_LDT...");
452 pid = start_ptraced_child(&stack); 429 pid = start_ptraced_child();
453 430
454 n = ptrace(PTRACE_LDT, pid, 0, (unsigned long) &ldt_op); 431 n = ptrace(PTRACE_LDT, pid, 0, (unsigned long) &ldt_op);
455 if (n < 0) { 432 if (n < 0) {
456 if(errno == EIO) 433 if (errno == EIO)
457 non_fatal("not found\n"); 434 non_fatal("not found\n");
458 else { 435 else {
459 perror("not found"); 436 perror("not found");
@@ -461,13 +438,13 @@ static inline void check_skas3_ptrace_ldt(void)
461 ptrace_ldt = 0; 438 ptrace_ldt = 0;
462 } 439 }
463 else { 440 else {
464 if(ptrace_ldt) 441 if (ptrace_ldt)
465 non_fatal("found\n"); 442 non_fatal("found\n");
466 else 443 else
467 non_fatal("found, but use is disabled\n"); 444 non_fatal("found, but use is disabled\n");
468 } 445 }
469 446
470 stop_ptraced_child(pid, stack, 1, 1); 447 stop_ptraced_child(pid, 1, 1);
471#else 448#else
472 /* PTRACE_LDT might be disabled via cmdline option. 449 /* PTRACE_LDT might be disabled via cmdline option.
473 * We want to override this, else we might use the stub 450 * We want to override this, else we might use the stub
@@ -484,12 +461,9 @@ static inline void check_skas3_proc_mm(void)
484 proc_mm = 0; 461 proc_mm = 0;
485 perror("not found"); 462 perror("not found");
486 } 463 }
487 else { 464 else if (!proc_mm)
488 if (!proc_mm) 465 non_fatal("found but disabled on command line\n");
489 non_fatal("found but disabled on command line\n"); 466 else non_fatal("found\n");
490 else
491 non_fatal("found\n");
492 }
493} 467}
494 468
495int can_do_skas(void) 469int can_do_skas(void)
@@ -500,17 +474,11 @@ int can_do_skas(void)
500 check_skas3_ptrace_faultinfo(); 474 check_skas3_ptrace_faultinfo();
501 check_skas3_ptrace_ldt(); 475 check_skas3_ptrace_ldt();
502 476
503 if(!proc_mm || !ptrace_faultinfo || !ptrace_ldt) 477 if (!proc_mm || !ptrace_faultinfo || !ptrace_ldt)
504 skas_needs_stub = 1; 478 skas_needs_stub = 1;
505 479
506 return 1; 480 return 1;
507} 481}
508#else
509int can_do_skas(void)
510{
511 return 0;
512}
513#endif
514 482
515int __init parse_iomem(char *str, int *add) 483int __init parse_iomem(char *str, int *add)
516{ 484{
@@ -521,25 +489,25 @@ int __init parse_iomem(char *str, int *add)
521 489
522 driver = str; 490 driver = str;
523 file = strchr(str,','); 491 file = strchr(str,',');
524 if(file == NULL){ 492 if (file == NULL) {
525 printf("parse_iomem : failed to parse iomem\n"); 493 printf("parse_iomem : failed to parse iomem\n");
526 goto out; 494 goto out;
527 } 495 }
528 *file = '\0'; 496 *file = '\0';
529 file++; 497 file++;
530 fd = open(file, O_RDWR, 0); 498 fd = open(file, O_RDWR, 0);
531 if(fd < 0){ 499 if (fd < 0) {
532 os_print_error(fd, "parse_iomem - Couldn't open io file"); 500 perror("parse_iomem - Couldn't open io file");
533 goto out; 501 goto out;
534 } 502 }
535 503
536 if(fstat64(fd, &buf) < 0){ 504 if (fstat64(fd, &buf) < 0) {
537 perror("parse_iomem - cannot stat_fd file"); 505 perror("parse_iomem - cannot stat_fd file");
538 goto out_close; 506 goto out_close;
539 } 507 }
540 508
541 new = malloc(sizeof(*new)); 509 new = malloc(sizeof(*new));
542 if(new == NULL){ 510 if (new == NULL) {
543 perror("Couldn't allocate iomem_region struct"); 511 perror("Couldn't allocate iomem_region struct");
544 goto out_close; 512 goto out_close;
545 } 513 }
diff --git a/arch/um/os-Linux/sys-i386/Makefile b/arch/um/os-Linux/sys-i386/Makefile
index 37806621b25d..a841262c594a 100644
--- a/arch/um/os-Linux/sys-i386/Makefile
+++ b/arch/um/os-Linux/sys-i386/Makefile
@@ -1,9 +1,9 @@
1# 1#
2# Copyright (C) 2000 Jeff Dike (jdike@karaya.com) 2# Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
6obj-$(CONFIG_MODE_SKAS) = registers.o signal.o tls.o 6obj-y = registers.o signal.o tls.o
7 7
8USER_OBJS := $(obj-y) 8USER_OBJS := $(obj-y)
9 9
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c
index 84b44f9cd42a..d1997ca76e5c 100644
--- a/arch/um/os-Linux/sys-i386/registers.c
+++ b/arch/um/os-Linux/sys-i386/registers.c
@@ -1,144 +1,73 @@
1/* 1/*
2 * Copyright (C) 2004 PathScale, Inc 2 * Copyright (C) 2004 PathScale, Inc
3 * Copyright (C) 2004 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 4 * Licensed under the GPL
4 */ 5 */
5 6
6#include <errno.h> 7#include <errno.h>
7#include <string.h> 8#include "kern_constants.h"
8#include "sysdep/ptrace_user.h"
9#include "sysdep/ptrace.h"
10#include "uml-config.h"
11#include "skas_ptregs.h"
12#include "registers.h"
13#include "longjmp.h" 9#include "longjmp.h"
14#include "user.h" 10#include "user.h"
11#include "sysdep/ptrace_user.h"
15 12
16/* These are set once at boot time and not changed thereafter */
17
18static unsigned long exec_regs[MAX_REG_NR];
19static unsigned long exec_fp_regs[HOST_FP_SIZE];
20static unsigned long exec_fpx_regs[HOST_XFP_SIZE];
21static int have_fpx_regs = 1;
22
23void init_thread_registers(union uml_pt_regs *to)
24{
25 memcpy(to->skas.regs, exec_regs, sizeof(to->skas.regs));
26 memcpy(to->skas.fp, exec_fp_regs, sizeof(to->skas.fp));
27 if(have_fpx_regs)
28 memcpy(to->skas.xfp, exec_fpx_regs, sizeof(to->skas.xfp));
29}
30
31/* XXX These need to use [GS]ETFPXREGS and copy_sc_{to,from}_user_skas needs
32 * to pass in a sufficiently large buffer
33 */
34int save_fp_registers(int pid, unsigned long *fp_regs) 13int save_fp_registers(int pid, unsigned long *fp_regs)
35{ 14{
36 if(ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0) 15 if (ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0)
37 return -errno; 16 return -errno;
38 return 0; 17 return 0;
39} 18}
40 19
41int restore_fp_registers(int pid, unsigned long *fp_regs) 20int restore_fp_registers(int pid, unsigned long *fp_regs)
42{ 21{
43 if(ptrace(PTRACE_SETFPREGS, pid, 0, fp_regs) < 0) 22 if (ptrace(PTRACE_SETFPREGS, pid, 0, fp_regs) < 0)
44 return -errno; 23 return -errno;
45 return 0; 24 return 0;
46} 25}
47 26
48static int move_registers(int pid, int int_op, union uml_pt_regs *regs, 27int save_fpx_registers(int pid, unsigned long *fp_regs)
49 int fp_op, unsigned long *fp_regs)
50{ 28{
51 if(ptrace(int_op, pid, 0, regs->skas.regs) < 0) 29 if (ptrace(PTRACE_GETFPXREGS, pid, 0, fp_regs) < 0)
52 return -errno;
53
54 if(ptrace(fp_op, pid, 0, fp_regs) < 0)
55 return -errno; 30 return -errno;
56
57 return 0; 31 return 0;
58} 32}
59 33
60void save_registers(int pid, union uml_pt_regs *regs) 34int restore_fpx_registers(int pid, unsigned long *fp_regs)
61{ 35{
62 unsigned long *fp_regs; 36 if (ptrace(PTRACE_SETFPXREGS, pid, 0, fp_regs) < 0)
63 int err, fp_op; 37 return -errno;
64 38 return 0;
65 if(have_fpx_regs){
66 fp_op = PTRACE_GETFPXREGS;
67 fp_regs = regs->skas.xfp;
68 }
69 else {
70 fp_op = PTRACE_GETFPREGS;
71 fp_regs = regs->skas.fp;
72 }
73
74 err = move_registers(pid, PTRACE_GETREGS, regs, fp_op, fp_regs);
75 if(err)
76 panic("save_registers - saving registers failed, errno = %d\n",
77 -err);
78} 39}
79 40
80void restore_registers(int pid, union uml_pt_regs *regs) 41unsigned long get_thread_reg(int reg, jmp_buf *buf)
81{ 42{
82 unsigned long *fp_regs; 43 switch (reg) {
83 int err, fp_op; 44 case EIP:
84 45 return buf[0]->__eip;
85 if(have_fpx_regs){ 46 case UESP:
86 fp_op = PTRACE_SETFPXREGS; 47 return buf[0]->__esp;
87 fp_regs = regs->skas.xfp; 48 case EBP:
88 } 49 return buf[0]->__ebp;
89 else { 50 default:
90 fp_op = PTRACE_SETFPREGS; 51 printk(UM_KERN_ERR "get_thread_regs - unknown register %d\n",
91 fp_regs = regs->skas.fp; 52 reg);
53 return 0;
92 } 54 }
93
94 err = move_registers(pid, PTRACE_SETREGS, regs, fp_op, fp_regs);
95 if(err)
96 panic("restore_registers - saving registers failed, "
97 "errno = %d\n", -err);
98} 55}
99 56
100void init_registers(int pid) 57int have_fpx_regs = 1;
58
59void arch_init_registers(int pid)
101{ 60{
61 unsigned long fpx_regs[HOST_XFP_SIZE];
102 int err; 62 int err;
103 63
104 memset(exec_regs, 0, sizeof(exec_regs)); 64 err = ptrace(PTRACE_GETFPXREGS, pid, 0, fpx_regs);
105 err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs);
106 if(err)
107 panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
108 errno);
109
110 errno = 0;
111 err = ptrace(PTRACE_GETFPXREGS, pid, 0, exec_fpx_regs);
112 if(!err) 65 if(!err)
113 return; 66 return;
67
114 if(errno != EIO) 68 if(errno != EIO)
115 panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d", 69 panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d",
116 errno); 70 errno);
117 71
118 have_fpx_regs = 0; 72 have_fpx_regs = 0;
119
120 err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs);
121 if(err)
122 panic("check_ptrace : PTRACE_GETFPREGS failed, errno = %d",
123 errno);
124}
125
126void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
127{
128 memcpy(regs, exec_regs, sizeof(exec_regs));
129 if(fp_regs != NULL)
130 memcpy(fp_regs, exec_fp_regs,
131 HOST_FP_SIZE * sizeof(unsigned long));
132}
133
134unsigned long get_thread_reg(int reg, jmp_buf *buf)
135{
136 switch(reg){
137 case EIP: return buf[0]->__eip;
138 case UESP: return buf[0]->__esp;
139 case EBP: return buf[0]->__ebp;
140 default:
141 printk("get_thread_regs - unknown register %d\n", reg);
142 return 0;
143 }
144} 73}
diff --git a/arch/um/os-Linux/sys-x86_64/Makefile b/arch/um/os-Linux/sys-x86_64/Makefile
index 7955e061a678..a42a4ef02e1e 100644
--- a/arch/um/os-Linux/sys-x86_64/Makefile
+++ b/arch/um/os-Linux/sys-x86_64/Makefile
@@ -1,9 +1,9 @@
1# 1#
2# Copyright (C) 2000 Jeff Dike (jdike@karaya.com) 2# Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
6obj-$(CONFIG_MODE_SKAS) = registers.o prctl.o signal.o 6obj-y = registers.o prctl.o signal.o
7 7
8USER_OBJS := $(obj-y) 8USER_OBJS := $(obj-y)
9 9
diff --git a/arch/um/os-Linux/sys-x86_64/registers.c b/arch/um/os-Linux/sys-x86_64/registers.c
index 9467315b8059..9bfa789992de 100644
--- a/arch/um/os-Linux/sys-x86_64/registers.c
+++ b/arch/um/os-Linux/sys-x86_64/registers.c
@@ -1,23 +1,15 @@
1/* 1/*
2 * Copyright (C) 2004 PathScale, Inc 2 * Copyright (C) 2006-2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <errno.h> 6#include <errno.h>
7#include <sys/ptrace.h> 7#include <sys/ptrace.h>
8#include <string.h> 8#define __FRAME_OFFSETS
9#include "ptrace_user.h" 9#include <asm/ptrace.h>
10#include "uml-config.h"
11#include "skas_ptregs.h"
12#include "registers.h"
13#include "longjmp.h" 10#include "longjmp.h"
14#include "user.h" 11#include "user.h"
15 12
16/* These are set once at boot time and not changed thereafter */
17
18static unsigned long exec_regs[MAX_REG_NR];
19static unsigned long exec_fp_regs[HOST_FP_SIZE];
20
21int save_fp_registers(int pid, unsigned long *fp_regs) 13int save_fp_registers(int pid, unsigned long *fp_regs)
22{ 14{
23 if(ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0) 15 if(ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0)
@@ -32,67 +24,6 @@ int restore_fp_registers(int pid, unsigned long *fp_regs)
32 return 0; 24 return 0;
33} 25}
34 26
35void init_thread_registers(union uml_pt_regs *to)
36{
37 memcpy(to->skas.regs, exec_regs, sizeof(to->skas.regs));
38 memcpy(to->skas.fp, exec_fp_regs, sizeof(to->skas.fp));
39}
40
41static int move_registers(int pid, int int_op, int fp_op,
42 union uml_pt_regs *regs)
43{
44 if(ptrace(int_op, pid, 0, regs->skas.regs) < 0)
45 return -errno;
46
47 if(ptrace(fp_op, pid, 0, regs->skas.fp) < 0)
48 return -errno;
49
50 return 0;
51}
52
53void save_registers(int pid, union uml_pt_regs *regs)
54{
55 int err;
56
57 err = move_registers(pid, PTRACE_GETREGS, PTRACE_GETFPREGS, regs);
58 if(err)
59 panic("save_registers - saving registers failed, errno = %d\n",
60 -err);
61}
62
63void restore_registers(int pid, union uml_pt_regs *regs)
64{
65 int err;
66
67 err = move_registers(pid, PTRACE_SETREGS, PTRACE_SETFPREGS, regs);
68 if(err)
69 panic("restore_registers - saving registers failed, "
70 "errno = %d\n", -err);
71}
72
73void init_registers(int pid)
74{
75 int err;
76
77 err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs);
78 if(err)
79 panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
80 errno);
81
82 err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs);
83 if(err)
84 panic("check_ptrace : PTRACE_GETFPREGS failed, errno = %d",
85 errno);
86}
87
88void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
89{
90 memcpy(regs, exec_regs, sizeof(exec_regs));
91 if(fp_regs != NULL)
92 memcpy(fp_regs, exec_fp_regs,
93 HOST_FP_SIZE * sizeof(unsigned long));
94}
95
96unsigned long get_thread_reg(int reg, jmp_buf *buf) 27unsigned long get_thread_reg(int reg, jmp_buf *buf)
97{ 28{
98 switch(reg){ 29 switch(reg){
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index 5de169b168f6..e34e1effe0f5 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -1,101 +1,86 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stdio.h> 6#include <stddef.h>
7#include <stdlib.h> 7#include <errno.h>
8#include <unistd.h> 8#include <signal.h>
9#include <time.h> 9#include <time.h>
10#include <sys/time.h> 10#include <sys/time.h>
11#include <signal.h>
12#include <errno.h>
13#include "kern_util.h"
14#include "user.h"
15#include "process.h"
16#include "kern_constants.h" 11#include "kern_constants.h"
17#include "os.h" 12#include "os.h"
18#include "uml-config.h" 13#include "user.h"
19 14
20int set_interval(int is_virtual) 15int set_interval(void)
21{ 16{
22 int usec = 1000000/hz(); 17 int usec = UM_USEC_PER_SEC / UM_HZ;
23 int timer_type = is_virtual ? ITIMER_VIRTUAL : ITIMER_REAL;
24 struct itimerval interval = ((struct itimerval) { { 0, usec }, 18 struct itimerval interval = ((struct itimerval) { { 0, usec },
25 { 0, usec } }); 19 { 0, usec } });
26 20
27 if(setitimer(timer_type, &interval, NULL) == -1) 21 if (setitimer(ITIMER_VIRTUAL, &interval, NULL) == -1)
28 return -errno; 22 return -errno;
29 23
30 return 0; 24 return 0;
31} 25}
32 26
33#ifdef UML_CONFIG_MODE_TT 27int timer_one_shot(int ticks)
34void enable_timer(void)
35{ 28{
36 set_interval(1); 29 unsigned long usec = ticks * UM_USEC_PER_SEC / UM_HZ;
37} 30 unsigned long sec = usec / UM_USEC_PER_SEC;
38#endif 31 struct itimerval interval;
39 32
40void disable_timer(void) 33 usec %= UM_USEC_PER_SEC;
41{ 34 interval = ((struct itimerval) { { 0, 0 }, { sec, usec } });
42 struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }}); 35
43 if((setitimer(ITIMER_VIRTUAL, &disable, NULL) < 0) || 36 if (setitimer(ITIMER_VIRTUAL, &interval, NULL) == -1)
44 (setitimer(ITIMER_REAL, &disable, NULL) < 0)) 37 return -errno;
45 printk("disnable_timer - setitimer failed, errno = %d\n", 38
46 errno); 39 return 0;
47 /* If there are signals already queued, after unblocking ignore them */
48 signal(SIGALRM, SIG_IGN);
49 signal(SIGVTALRM, SIG_IGN);
50} 40}
51 41
52void switch_timers(int to_real) 42/**
43 * timeval_to_ns - Convert timeval to nanoseconds
44 * @ts: pointer to the timeval variable to be converted
45 *
46 * Returns the scalar nanosecond representation of the timeval
47 * parameter.
48 *
49 * Ripped from linux/time.h because it's a kernel header, and thus
50 * unusable from here.
51 */
52static inline long long timeval_to_ns(const struct timeval *tv)
53{ 53{
54 struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }}); 54 return ((long long) tv->tv_sec * UM_NSEC_PER_SEC) +
55 struct itimerval enable = ((struct itimerval) { { 0, 1000000/hz() }, 55 tv->tv_usec * UM_NSEC_PER_USEC;
56 { 0, 1000000/hz() }});
57 int old, new;
58
59 if(to_real){
60 old = ITIMER_VIRTUAL;
61 new = ITIMER_REAL;
62 }
63 else {
64 old = ITIMER_REAL;
65 new = ITIMER_VIRTUAL;
66 }
67
68 if((setitimer(old, &disable, NULL) < 0) ||
69 (setitimer(new, &enable, NULL)))
70 printk("switch_timers - setitimer failed, errno = %d\n",
71 errno);
72} 56}
73 57
74#ifdef UML_CONFIG_MODE_TT 58long long disable_timer(void)
75void uml_idle_timer(void)
76{ 59{
77 if(signal(SIGVTALRM, SIG_IGN) == SIG_ERR) 60 struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } });
78 panic("Couldn't unset SIGVTALRM handler"); 61
62 if(setitimer(ITIMER_VIRTUAL, &time, &time) < 0)
63 printk(UM_KERN_ERR "disable_timer - setitimer failed, "
64 "errno = %d\n", errno);
79 65
80 set_handler(SIGALRM, (__sighandler_t) alarm_handler, 66 return timeval_to_ns(&time.it_value);
81 SA_RESTART, SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
82 set_interval(0);
83} 67}
84#endif
85 68
86unsigned long long os_nsecs(void) 69long long os_nsecs(void)
87{ 70{
88 struct timeval tv; 71 struct timeval tv;
89 72
90 gettimeofday(&tv, NULL); 73 gettimeofday(&tv, NULL);
91 return((unsigned long long) tv.tv_sec * BILLION + tv.tv_usec * 1000); 74 return timeval_to_ns(&tv);
92} 75}
93 76
94void idle_sleep(int secs) 77extern void alarm_handler(int sig, struct sigcontext *sc);
78
79void idle_sleep(unsigned long long nsecs)
95{ 80{
96 struct timespec ts; 81 struct timespec ts = { .tv_sec = nsecs / UM_NSEC_PER_SEC,
82 .tv_nsec = nsecs % UM_NSEC_PER_SEC };
97 83
98 ts.tv_sec = secs; 84 if (nanosleep(&ts, &ts) == 0)
99 ts.tv_nsec = 0; 85 alarm_handler(SIGVTALRM, NULL);
100 nanosleep(&ts, NULL);
101} 86}
diff --git a/arch/um/os-Linux/tls.c b/arch/um/os-Linux/tls.c
index 16215b990804..73277801ef14 100644
--- a/arch/um/os-Linux/tls.c
+++ b/arch/um/os-Linux/tls.c
@@ -1,18 +1,9 @@
1#include <errno.h> 1#include <errno.h>
2#include <unistd.h>
3#include <sys/ptrace.h> 2#include <sys/ptrace.h>
4#include <sys/syscall.h>
5#include <asm/ldt.h>
6#include "sysdep/tls.h" 3#include "sysdep/tls.h"
7#include "uml-config.h"
8 4
9/* TLS support - we basically rely on the host's one.*/ 5/* TLS support - we basically rely on the host's one.*/
10 6
11/* In TT mode, this should be called only by the tracing thread, and makes sense
12 * only for PTRACE_SET_THREAD_AREA. In SKAS mode, it's used normally.
13 *
14 */
15
16#ifndef PTRACE_GET_THREAD_AREA 7#ifndef PTRACE_GET_THREAD_AREA
17#define PTRACE_GET_THREAD_AREA 25 8#define PTRACE_GET_THREAD_AREA 25
18#endif 9#endif
@@ -32,8 +23,6 @@ int os_set_thread_area(user_desc_t *info, int pid)
32 return ret; 23 return ret;
33} 24}
34 25
35#ifdef UML_CONFIG_MODE_SKAS
36
37int os_get_thread_area(user_desc_t *info, int pid) 26int os_get_thread_area(user_desc_t *info, int pid)
38{ 27{
39 int ret; 28 int ret;
@@ -44,32 +33,3 @@ int os_get_thread_area(user_desc_t *info, int pid)
44 ret = -errno; 33 ret = -errno;
45 return ret; 34 return ret;
46} 35}
47
48#endif
49
50#ifdef UML_CONFIG_MODE_TT
51#include "linux/unistd.h"
52
53int do_set_thread_area_tt(user_desc_t *info)
54{
55 int ret;
56
57 ret = syscall(__NR_set_thread_area,info);
58 if (ret < 0) {
59 ret = -errno;
60 }
61 return ret;
62}
63
64int do_get_thread_area_tt(user_desc_t *info)
65{
66 int ret;
67
68 ret = syscall(__NR_get_thread_area,info);
69 if (ret < 0) {
70 ret = -errno;
71 }
72 return ret;
73}
74
75#endif /* UML_CONFIG_MODE_TT */
diff --git a/arch/um/os-Linux/trap.c b/arch/um/os-Linux/trap.c
index 295da657931a..2a1c9843e32e 100644
--- a/arch/um/os-Linux/trap.c
+++ b/arch/um/os-Linux/trap.c
@@ -1,22 +1,14 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stdlib.h>
7#include <signal.h> 6#include <signal.h>
8#include "kern_util.h"
9#include "os.h" 7#include "os.h"
10#include "mode.h" 8#include "sysdep/ptrace.h"
11#include "longjmp.h"
12
13void usr2_handler(int sig, union uml_pt_regs *regs)
14{
15 CHOOSE_MODE(syscall_handler_tt(sig, regs), (void) 0);
16}
17 9
18/* Initialized from linux_main() */ 10/* Initialized from linux_main() */
19void (*sig_info[NSIG])(int, union uml_pt_regs *); 11void (*sig_info[NSIG])(int, struct uml_pt_regs *);
20 12
21void os_fill_handlinfo(struct kern_handlers h) 13void os_fill_handlinfo(struct kern_handlers h)
22{ 14{
@@ -28,13 +20,4 @@ void os_fill_handlinfo(struct kern_handlers h)
28 sig_info[SIGSEGV] = h.page_fault; 20 sig_info[SIGSEGV] = h.page_fault;
29 sig_info[SIGIO] = h.sigio_handler; 21 sig_info[SIGIO] = h.sigio_handler;
30 sig_info[SIGVTALRM] = h.timer_handler; 22 sig_info[SIGVTALRM] = h.timer_handler;
31 sig_info[SIGALRM] = h.timer_handler;
32 sig_info[SIGUSR2] = usr2_handler;
33}
34
35void do_longjmp(void *b, int val)
36{
37 jmp_buf *buf = b;
38
39 UML_LONGJMP(buf, val);
40} 23}
diff --git a/arch/um/os-Linux/tt.c b/arch/um/os-Linux/tt.c
deleted file mode 100644
index bcf9359c4e9f..000000000000
--- a/arch/um/os-Linux/tt.c
+++ /dev/null
@@ -1,196 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <stdio.h>
7#include <unistd.h>
8#include <signal.h>
9#include <sched.h>
10#include <errno.h>
11#include <stdarg.h>
12#include <stdlib.h>
13#include <sys/time.h>
14#include <sys/ptrace.h>
15#include <linux/ptrace.h>
16#include <sys/wait.h>
17#include <sys/mman.h>
18#include <asm/ptrace.h>
19#include <asm/unistd.h>
20#include <asm/page.h>
21#include "kern_util.h"
22#include "user.h"
23#include "signal_kern.h"
24#include "sysdep/ptrace.h"
25#include "sysdep/sigcontext.h"
26#include "irq_user.h"
27#include "ptrace_user.h"
28#include "init.h"
29#include "os.h"
30#include "uml-config.h"
31#include "choose-mode.h"
32#include "mode.h"
33#include "tempfile.h"
34#include "kern_constants.h"
35
36int protect_memory(unsigned long addr, unsigned long len, int r, int w, int x,
37 int must_succeed)
38{
39 int err;
40
41 err = os_protect_memory((void *) addr, len, r, w, x);
42 if(err < 0){
43 if(must_succeed)
44 panic("protect failed, err = %d", -err);
45 else return(err);
46 }
47 return(0);
48}
49
50void kill_child_dead(int pid)
51{
52 kill(pid, SIGKILL);
53 kill(pid, SIGCONT);
54 do {
55 int n;
56 CATCH_EINTR(n = waitpid(pid, NULL, 0));
57 if (n > 0)
58 kill(pid, SIGCONT);
59 else
60 break;
61 } while(1);
62}
63
64void stop(void)
65{
66 while(1) sleep(1000000);
67}
68
69int wait_for_stop(int pid, int sig, int cont_type, void *relay)
70{
71 sigset_t *relay_signals = relay;
72 int status, ret;
73
74 while(1){
75 CATCH_EINTR(ret = waitpid(pid, &status, WUNTRACED));
76 if((ret < 0) ||
77 !WIFSTOPPED(status) || (WSTOPSIG(status) != sig)){
78 if(ret < 0){
79 printk("wait failed, errno = %d\n",
80 errno);
81 }
82 else if(WIFEXITED(status))
83 printk("process %d exited with status %d\n",
84 pid, WEXITSTATUS(status));
85 else if(WIFSIGNALED(status))
86 printk("process %d exited with signal %d\n",
87 pid, WTERMSIG(status));
88 else if((WSTOPSIG(status) == SIGVTALRM) ||
89 (WSTOPSIG(status) == SIGALRM) ||
90 (WSTOPSIG(status) == SIGIO) ||
91 (WSTOPSIG(status) == SIGPROF) ||
92 (WSTOPSIG(status) == SIGCHLD) ||
93 (WSTOPSIG(status) == SIGWINCH) ||
94 (WSTOPSIG(status) == SIGINT)){
95 ptrace(cont_type, pid, 0, WSTOPSIG(status));
96 continue;
97 }
98 else if((relay_signals != NULL) &&
99 sigismember(relay_signals, WSTOPSIG(status))){
100 ptrace(cont_type, pid, 0, WSTOPSIG(status));
101 continue;
102 }
103 else printk("process %d stopped with signal %d\n",
104 pid, WSTOPSIG(status));
105 panic("wait_for_stop failed to wait for %d to stop "
106 "with %d\n", pid, sig);
107 }
108 return(status);
109 }
110}
111
112void forward_ipi(int fd, int pid)
113{
114 int err;
115
116 err = os_set_owner(fd, pid);
117 if(err < 0)
118 printk("forward_ipi: set_owner failed, fd = %d, me = %d, "
119 "target = %d, err = %d\n", fd, os_getpid(), pid, -err);
120}
121
122/*
123 *-------------------------
124 * only for tt mode (will be deleted in future...)
125 *-------------------------
126 */
127
128struct tramp {
129 int (*tramp)(void *);
130 void *tramp_data;
131 unsigned long temp_stack;
132 int flags;
133 int pid;
134};
135
136/* See above for why sigkill is here */
137
138int sigkill = SIGKILL;
139
140int outer_tramp(void *arg)
141{
142 struct tramp *t;
143 int sig = sigkill;
144
145 t = arg;
146 t->pid = clone(t->tramp, (void *) t->temp_stack + UM_KERN_PAGE_SIZE/2,
147 t->flags, t->tramp_data);
148 if(t->pid > 0) wait_for_stop(t->pid, SIGSTOP, PTRACE_CONT, NULL);
149 kill(os_getpid(), sig);
150 _exit(0);
151}
152
153int start_fork_tramp(void *thread_arg, unsigned long temp_stack,
154 int clone_flags, int (*tramp)(void *))
155{
156 struct tramp arg;
157 unsigned long sp;
158 int new_pid, status, err;
159
160 /* The trampoline will run on the temporary stack */
161 sp = stack_sp(temp_stack);
162
163 clone_flags |= CLONE_FILES | SIGCHLD;
164
165 arg.tramp = tramp;
166 arg.tramp_data = thread_arg;
167 arg.temp_stack = temp_stack;
168 arg.flags = clone_flags;
169
170 /* Start the process and wait for it to kill itself */
171 new_pid = clone(outer_tramp, (void *) sp, clone_flags, &arg);
172 if(new_pid < 0)
173 return(new_pid);
174
175 CATCH_EINTR(err = waitpid(new_pid, &status, 0));
176 if(err < 0)
177 panic("Waiting for outer trampoline failed - errno = %d",
178 errno);
179
180 if(!WIFSIGNALED(status) || (WTERMSIG(status) != SIGKILL))
181 panic("outer trampoline didn't exit with SIGKILL, "
182 "status = %d", status);
183
184 return(arg.pid);
185}
186
187void forward_pending_sigio(int target)
188{
189 sigset_t sigs;
190
191 if(sigpending(&sigs))
192 panic("forward_pending_sigio : sigpending failed");
193 if(sigismember(&sigs, SIGIO))
194 kill(target, SIGIO);
195}
196
diff --git a/arch/um/os-Linux/uaccess.c b/arch/um/os-Linux/uaccess.c
index bbb73a650370..8d27b6d1df91 100644
--- a/arch/um/os-Linux/uaccess.c
+++ b/arch/um/os-Linux/uaccess.c
@@ -8,7 +8,7 @@
8#include "longjmp.h" 8#include "longjmp.h"
9 9
10unsigned long __do_user_copy(void *to, const void *from, int n, 10unsigned long __do_user_copy(void *to, const void *from, int n,
11 void **fault_addr, void **fault_catcher, 11 void **fault_addr, jmp_buf **fault_catcher,
12 void (*op)(void *to, const void *from, 12 void (*op)(void *to, const void *from,
13 int n), int *faulted_out) 13 int n), int *faulted_out)
14{ 14{
diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c
index b462863f7172..106fa8641553 100644
--- a/arch/um/os-Linux/umid.c
+++ b/arch/um/os-Linux/umid.c
@@ -1,17 +1,21 @@
1/*
2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
1#include <stdio.h> 6#include <stdio.h>
2#include <unistd.h>
3#include <stdlib.h> 7#include <stdlib.h>
4#include <string.h> 8#include <dirent.h>
5#include <errno.h> 9#include <errno.h>
10#include <fcntl.h>
6#include <signal.h> 11#include <signal.h>
7#include <dirent.h> 12#include <string.h>
8#include <sys/fcntl.h> 13#include <unistd.h>
9#include <sys/stat.h> 14#include <sys/stat.h>
10#include <sys/param.h>
11#include "init.h" 15#include "init.h"
16#include "kern_constants.h"
12#include "os.h" 17#include "os.h"
13#include "user.h" 18#include "user.h"
14#include "mode.h"
15 19
16#define UML_DIR "~/.uml/" 20#define UML_DIR "~/.uml/"
17 21
@@ -28,13 +32,13 @@ static int __init make_uml_dir(void)
28 char dir[512] = { '\0' }; 32 char dir[512] = { '\0' };
29 int len, err; 33 int len, err;
30 34
31 if(*uml_dir == '~'){ 35 if (*uml_dir == '~') {
32 char *home = getenv("HOME"); 36 char *home = getenv("HOME");
33 37
34 err = -ENOENT; 38 err = -ENOENT;
35 if(home == NULL){ 39 if (home == NULL) {
36 printk("make_uml_dir : no value in environment for " 40 printk(UM_KERN_ERR "make_uml_dir : no value in "
37 "$HOME\n"); 41 "environment for $HOME\n");
38 goto err; 42 goto err;
39 } 43 }
40 strlcpy(dir, home, sizeof(dir)); 44 strlcpy(dir, home, sizeof(dir));
@@ -53,7 +57,7 @@ static int __init make_uml_dir(void)
53 } 57 }
54 strcpy(uml_dir, dir); 58 strcpy(uml_dir, dir);
55 59
56 if((mkdir(uml_dir, 0777) < 0) && (errno != EEXIST)){ 60 if ((mkdir(uml_dir, 0777) < 0) && (errno != EEXIST)) {
57 printf("Failed to mkdir '%s': %s\n", uml_dir, strerror(errno)); 61 printf("Failed to mkdir '%s': %s\n", uml_dir, strerror(errno));
58 err = -errno; 62 err = -errno;
59 goto err_free; 63 goto err_free;
@@ -70,8 +74,8 @@ err:
70/* 74/*
71 * Unlinks the files contained in @dir and then removes @dir. 75 * Unlinks the files contained in @dir and then removes @dir.
72 * Doesn't handle directory trees, so it's not like rm -rf, but almost such. We 76 * Doesn't handle directory trees, so it's not like rm -rf, but almost such. We
73 * ignore ENOENT errors for anything (they happen, strangely enough - possibly due 77 * ignore ENOENT errors for anything (they happen, strangely enough - possibly
74 * to races between multiple dying UML threads). 78 * due to races between multiple dying UML threads).
75 */ 79 */
76static int remove_files_and_dir(char *dir) 80static int remove_files_and_dir(char *dir)
77{ 81{
@@ -116,7 +120,8 @@ out:
116 return ret; 120 return ret;
117} 121}
118 122
119/* This says that there isn't already a user of the specified directory even if 123/*
124 * This says that there isn't already a user of the specified directory even if
120 * there are errors during the checking. This is because if these errors 125 * there are errors during the checking. This is because if these errors
121 * happen, the directory is unusable by the pre-existing UML, so we might as 126 * happen, the directory is unusable by the pre-existing UML, so we might as
122 * well take it over. This could happen either by 127 * well take it over. This could happen either by
@@ -134,44 +139,45 @@ static inline int is_umdir_used(char *dir)
134 int dead, fd, p, n, err; 139 int dead, fd, p, n, err;
135 140
136 n = snprintf(file, sizeof(file), "%s/pid", dir); 141 n = snprintf(file, sizeof(file), "%s/pid", dir);
137 if(n >= sizeof(file)){ 142 if (n >= sizeof(file)) {
138 printk("is_umdir_used - pid filename too long\n"); 143 printk(UM_KERN_ERR "is_umdir_used - pid filename too long\n");
139 err = -E2BIG; 144 err = -E2BIG;
140 goto out; 145 goto out;
141 } 146 }
142 147
143 dead = 0; 148 dead = 0;
144 fd = open(file, O_RDONLY); 149 fd = open(file, O_RDONLY);
145 if(fd < 0) { 150 if (fd < 0) {
146 fd = -errno; 151 fd = -errno;
147 if(fd != -ENOENT){ 152 if (fd != -ENOENT) {
148 printk("is_umdir_used : couldn't open pid file '%s', " 153 printk(UM_KERN_ERR "is_umdir_used : couldn't open pid "
149 "err = %d\n", file, -fd); 154 "file '%s', err = %d\n", file, -fd);
150 } 155 }
151 goto out; 156 goto out;
152 } 157 }
153 158
154 err = 0; 159 err = 0;
155 n = read(fd, pid, sizeof(pid)); 160 n = read(fd, pid, sizeof(pid));
156 if(n < 0){ 161 if (n < 0) {
157 printk("is_umdir_used : couldn't read pid file '%s', " 162 printk(UM_KERN_ERR "is_umdir_used : couldn't read pid file "
158 "err = %d\n", file, errno); 163 "'%s', err = %d\n", file, errno);
159 goto out_close; 164 goto out_close;
160 } else if(n == 0){ 165 } else if (n == 0) {
161 printk("is_umdir_used : couldn't read pid file '%s', " 166 printk(UM_KERN_ERR "is_umdir_used : couldn't read pid file "
162 "0-byte read\n", file); 167 "'%s', 0-byte read\n", file);
163 goto out_close; 168 goto out_close;
164 } 169 }
165 170
166 p = strtoul(pid, &end, 0); 171 p = strtoul(pid, &end, 0);
167 if(end == pid){ 172 if (end == pid) {
168 printk("is_umdir_used : couldn't parse pid file '%s', " 173 printk(UM_KERN_ERR "is_umdir_used : couldn't parse pid file "
169 "errno = %d\n", file, errno); 174 "'%s', errno = %d\n", file, errno);
170 goto out_close; 175 goto out_close;
171 } 176 }
172 177
173 if((kill(p, 0) == 0) || (errno != ESRCH)){ 178 if ((kill(p, 0) == 0) || (errno != ESRCH)) {
174 printk("umid \"%s\" is already in use by pid %d\n", umid, p); 179 printk(UM_KERN_ERR "umid \"%s\" is already in use by pid %d\n",
180 umid, p);
175 return 1; 181 return 1;
176 } 182 }
177 183
@@ -195,8 +201,8 @@ static int umdir_take_if_dead(char *dir)
195 201
196 ret = remove_files_and_dir(dir); 202 ret = remove_files_and_dir(dir);
197 if (ret) { 203 if (ret) {
198 printk("is_umdir_used - remove_files_and_dir failed with " 204 printk(UM_KERN_ERR "is_umdir_used - remove_files_and_dir "
199 "err = %d\n", ret); 205 "failed with err = %d\n", ret);
200 } 206 }
201 return ret; 207 return ret;
202} 208}
@@ -207,27 +213,28 @@ static void __init create_pid_file(void)
207 char pid[sizeof("nnnnn\0")]; 213 char pid[sizeof("nnnnn\0")];
208 int fd, n; 214 int fd, n;
209 215
210 if(umid_file_name("pid", file, sizeof(file))) 216 if (umid_file_name("pid", file, sizeof(file)))
211 return; 217 return;
212 218
213 fd = open(file, O_RDWR | O_CREAT | O_EXCL, 0644); 219 fd = open(file, O_RDWR | O_CREAT | O_EXCL, 0644);
214 if(fd < 0){ 220 if (fd < 0) {
215 printk("Open of machine pid file \"%s\" failed: %s\n", 221 printk(UM_KERN_ERR "Open of machine pid file \"%s\" failed: "
216 file, strerror(errno)); 222 "%s\n", file, strerror(errno));
217 return; 223 return;
218 } 224 }
219 225
220 snprintf(pid, sizeof(pid), "%d\n", getpid()); 226 snprintf(pid, sizeof(pid), "%d\n", getpid());
221 n = write(fd, pid, strlen(pid)); 227 n = write(fd, pid, strlen(pid));
222 if(n != strlen(pid)) 228 if (n != strlen(pid))
223 printk("Write of pid file failed - err = %d\n", errno); 229 printk(UM_KERN_ERR "Write of pid file failed - err = %d\n",
230 errno);
224 231
225 close(fd); 232 close(fd);
226} 233}
227 234
228int __init set_umid(char *name) 235int __init set_umid(char *name)
229{ 236{
230 if(strlen(name) > UMID_LEN - 1) 237 if (strlen(name) > UMID_LEN - 1)
231 return -E2BIG; 238 return -E2BIG;
232 239
233 strlcpy(umid, name, sizeof(umid)); 240 strlcpy(umid, name, sizeof(umid));
@@ -243,18 +250,18 @@ int __init make_umid(void)
243 int fd, err; 250 int fd, err;
244 char tmp[256]; 251 char tmp[256];
245 252
246 if(umid_setup) 253 if (umid_setup)
247 return 0; 254 return 0;
248 255
249 make_uml_dir(); 256 make_uml_dir();
250 257
251 if(*umid == '\0'){ 258 if (*umid == '\0') {
252 strlcpy(tmp, uml_dir, sizeof(tmp)); 259 strlcpy(tmp, uml_dir, sizeof(tmp));
253 strlcat(tmp, "XXXXXX", sizeof(tmp)); 260 strlcat(tmp, "XXXXXX", sizeof(tmp));
254 fd = mkstemp(tmp); 261 fd = mkstemp(tmp);
255 if(fd < 0){ 262 if (fd < 0) {
256 printk("make_umid - mkstemp(%s) failed: %s\n", 263 printk(UM_KERN_ERR "make_umid - mkstemp(%s) failed: "
257 tmp, strerror(errno)); 264 "%s\n", tmp, strerror(errno));
258 err = -errno; 265 err = -errno;
259 goto err; 266 goto err;
260 } 267 }
@@ -263,11 +270,12 @@ int __init make_umid(void)
263 270
264 set_umid(&tmp[strlen(uml_dir)]); 271 set_umid(&tmp[strlen(uml_dir)]);
265 272
266 /* There's a nice tiny little race between this unlink and 273 /*
274 * There's a nice tiny little race between this unlink and
267 * the mkdir below. It'd be nice if there were a mkstemp 275 * the mkdir below. It'd be nice if there were a mkstemp
268 * for directories. 276 * for directories.
269 */ 277 */
270 if(unlink(tmp)){ 278 if (unlink(tmp)) {
271 err = -errno; 279 err = -errno;
272 goto err; 280 goto err;
273 } 281 }
@@ -275,9 +283,9 @@ int __init make_umid(void)
275 283
276 snprintf(tmp, sizeof(tmp), "%s%s", uml_dir, umid); 284 snprintf(tmp, sizeof(tmp), "%s%s", uml_dir, umid);
277 err = mkdir(tmp, 0777); 285 err = mkdir(tmp, 0777);
278 if(err < 0){ 286 if (err < 0) {
279 err = -errno; 287 err = -errno;
280 if(err != -EEXIST) 288 if (err != -EEXIST)
281 goto err; 289 goto err;
282 290
283 if (umdir_take_if_dead(tmp) < 0) 291 if (umdir_take_if_dead(tmp) < 0)
@@ -285,9 +293,10 @@ int __init make_umid(void)
285 293
286 err = mkdir(tmp, 0777); 294 err = mkdir(tmp, 0777);
287 } 295 }
288 if(err){ 296 if (err) {
289 err = -errno; 297 err = -errno;
290 printk("Failed to create '%s' - err = %d\n", umid, -errno); 298 printk(UM_KERN_ERR "Failed to create '%s' - err = %d\n", umid,
299 errno);
291 goto err; 300 goto err;
292 } 301 }
293 302
@@ -302,14 +311,15 @@ int __init make_umid(void)
302 311
303static int __init make_umid_init(void) 312static int __init make_umid_init(void)
304{ 313{
305 if(!make_umid()) 314 if (!make_umid())
306 return 0; 315 return 0;
307 316
308 /* If initializing with the given umid failed, then try again with 317 /*
318 * If initializing with the given umid failed, then try again with
309 * a random one. 319 * a random one.
310 */ 320 */
311 printk("Failed to initialize umid \"%s\", trying with a random umid\n", 321 printk(UM_KERN_ERR "Failed to initialize umid \"%s\", trying with a "
312 umid); 322 "random umid\n", umid);
313 *umid = '\0'; 323 *umid = '\0';
314 make_umid(); 324 make_umid();
315 325
@@ -323,12 +333,12 @@ int __init umid_file_name(char *name, char *buf, int len)
323 int n, err; 333 int n, err;
324 334
325 err = make_umid(); 335 err = make_umid();
326 if(err) 336 if (err)
327 return err; 337 return err;
328 338
329 n = snprintf(buf, len, "%s%s/%s", uml_dir, umid, name); 339 n = snprintf(buf, len, "%s%s/%s", uml_dir, umid, name);
330 if(n >= len){ 340 if (n >= len) {
331 printk("umid_file_name : buffer too short\n"); 341 printk(UM_KERN_ERR "umid_file_name : buffer too short\n");
332 return -E2BIG; 342 return -E2BIG;
333 } 343 }
334 344
@@ -342,21 +352,22 @@ char *get_umid(void)
342 352
343static int __init set_uml_dir(char *name, int *add) 353static int __init set_uml_dir(char *name, int *add)
344{ 354{
345 if(*name == '\0'){ 355 if (*name == '\0') {
346 printf("uml_dir can't be an empty string\n"); 356 printf("uml_dir can't be an empty string\n");
347 return 0; 357 return 0;
348 } 358 }
349 359
350 if(name[strlen(name) - 1] == '/'){ 360 if (name[strlen(name) - 1] == '/') {
351 uml_dir = name; 361 uml_dir = name;
352 return 0; 362 return 0;
353 } 363 }
354 364
355 uml_dir = malloc(strlen(name) + 2); 365 uml_dir = malloc(strlen(name) + 2);
356 if(uml_dir == NULL){ 366 if (uml_dir == NULL) {
357 printf("Failed to malloc uml_dir - error = %d\n", errno); 367 printf("Failed to malloc uml_dir - error = %d\n", errno);
358 368
359 /* Return 0 here because do_initcalls doesn't look at 369 /*
370 * Return 0 here because do_initcalls doesn't look at
360 * the return value. 371 * the return value.
361 */ 372 */
362 return 0; 373 return 0;
@@ -377,7 +388,7 @@ static void remove_umid_dir(void)
377 388
378 sprintf(dir, "%s%s", uml_dir, umid); 389 sprintf(dir, "%s%s", uml_dir, umid);
379 err = remove_files_and_dir(dir); 390 err = remove_files_and_dir(dir);
380 if(err) 391 if (err)
381 printf("remove_umid_dir - remove_files_and_dir failed with " 392 printf("remove_umid_dir - remove_files_and_dir failed with "
382 "err = %d\n", err); 393 "err = %d\n", err);
383} 394}
diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c
index 7cbcf484e13d..ef095436a78c 100644
--- a/arch/um/os-Linux/util.c
+++ b/arch/um/os-Linux/util.c
@@ -105,6 +105,44 @@ int setjmp_wrapper(void (*proc)(void *, void *), ...)
105 105
106void os_dump_core(void) 106void os_dump_core(void)
107{ 107{
108 int pid;
109
108 signal(SIGSEGV, SIG_DFL); 110 signal(SIGSEGV, SIG_DFL);
111
112 /*
113 * We are about to SIGTERM this entire process group to ensure that
114 * nothing is around to run after the kernel exits. The
115 * kernel wants to abort, not die through SIGTERM, so we
116 * ignore it here.
117 */
118
119 signal(SIGTERM, SIG_IGN);
120 kill(0, SIGTERM);
121 /*
122 * Most of the other processes associated with this UML are
123 * likely sTopped, so give them a SIGCONT so they see the
124 * SIGTERM.
125 */
126 kill(0, SIGCONT);
127
128 /*
129 * Now, having sent signals to everyone but us, make sure they
130 * die by ptrace. Processes can survive what's been done to
131 * them so far - the mechanism I understand is receiving a
132 * SIGSEGV and segfaulting immediately upon return. There is
133 * always a SIGSEGV pending, and (I'm guessing) signals are
134 * processed in numeric order so the SIGTERM (signal 15 vs
135 * SIGSEGV being signal 11) is never handled.
136 *
137 * Run a waitpid loop until we get some kind of error.
138 * Hopefully, it's ECHILD, but there's not a lot we can do if
139 * it's something else. Tell os_kill_ptraced_process not to
140 * wait for the child to report its death because there's
141 * nothing reasonable to do if that fails.
142 */
143
144 while ((pid = waitpid(-1, NULL, WNOHANG)) > 0)
145 os_kill_ptraced_process(pid, 0);
146
109 abort(); 147 abort();
110} 148}
diff --git a/arch/um/scripts/Makefile.rules b/arch/um/scripts/Makefile.rules
index a9a4b85ca516..61107b68e05b 100644
--- a/arch/um/scripts/Makefile.rules
+++ b/arch/um/scripts/Makefile.rules
@@ -21,12 +21,12 @@ $(UNPROFILE_OBJS:.o=.%): \
21$(UNPROFILE_OBJS) : CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ \ 21$(UNPROFILE_OBJS) : CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ \
22 -Dunix -D__unix__ -D__$(SUBARCH)__ $(CF) 22 -Dunix -D__unix__ -D__$(SUBARCH)__ $(CF)
23 23
24# The stubs and unmap.o can't try to call mcount or update basic block data 24# The stubs can't try to call mcount or update basic block data
25define unprofile 25define unprofile
26 $(patsubst -pg,,$(patsubst -fprofile-arcs -ftest-coverage,,$(1))) 26 $(patsubst -pg,,$(patsubst -fprofile-arcs -ftest-coverage,,$(1)))
27endef 27endef
28 28
29ifdef subarch-obj-y 29ifdef subarch-obj-y
30obj-y += subarch.o 30obj-y += subarch.o
31subarch-y = $(addprefix ../../$(SUBARCH)/,$(subarch-obj-y)) 31subarch-y = $(addprefix ../../$(HEADER_ARCH)/,$(subarch-obj-y))
32endif 32endif
diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile
index 8909b07d9ee7..964dc1a04c37 100644
--- a/arch/um/sys-i386/Makefile
+++ b/arch/um/sys-i386/Makefile
@@ -1,23 +1,21 @@
1#
2# Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3#
4
1obj-y = bug.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \ 5obj-y = bug.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \
2 ptrace_user.o setjmp.o signal.o sigcontext.o syscalls.o sysrq.o \ 6 ptrace_user.o setjmp.o signal.o stub.o stub_segv.o syscalls.o sysrq.o \
3 sys_call_table.o tls.o 7 sys_call_table.o tls.o
4 8
5obj-$(CONFIG_MODE_SKAS) += stub.o stub_segv.o 9subarch-obj-y = lib/bitops_32.o lib/semaphore_32.o lib/string_32.o
6 10subarch-obj-$(CONFIG_HIGHMEM) += mm/highmem_32.o
7subarch-obj-y = lib/bitops.o lib/semaphore.o lib/string.o 11subarch-obj-$(CONFIG_MODULES) += kernel/module_32.o
8subarch-obj-$(CONFIG_HIGHMEM) += mm/highmem.o
9subarch-obj-$(CONFIG_MODULES) += kernel/module.o
10 12
11USER_OBJS := bugs.o ptrace_user.o sigcontext.o fault.o 13USER_OBJS := bugs.o ptrace_user.o fault.o
12 14
13USER_OBJS += user-offsets.s 15USER_OBJS += user-offsets.s
14extra-y += user-offsets.s 16extra-y += user-offsets.s
15 17
16extra-$(CONFIG_MODE_TT) += unmap.o
17
18UNPROFILE_OBJS := stub_segv.o 18UNPROFILE_OBJS := stub_segv.o
19CFLAGS_stub_segv.o := $(CFLAGS_NO_HARDENING) 19CFLAGS_stub_segv.o := $(CFLAGS_NO_HARDENING)
20 20
21include arch/um/scripts/Makefile.rules 21include arch/um/scripts/Makefile.rules
22
23$(obj)/unmap.%: _c_flags = $(call unprofile,$(KBUILD_CFLAGS))
diff --git a/arch/um/sys-i386/bugs.c b/arch/um/sys-i386/bugs.c
index 0393e44813e7..806895d73bcc 100644
--- a/arch/um/sys-i386/bugs.c
+++ b/arch/um/sys-i386/bugs.c
@@ -1,18 +1,15 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <unistd.h>
7#include <errno.h> 6#include <errno.h>
7#include <signal.h>
8#include <string.h> 8#include <string.h>
9#include <sys/signal.h> 9#include "kern_constants.h"
10#include <asm/ldt.h>
11#include "kern_util.h"
12#include "user.h"
13#include "sysdep/ptrace.h"
14#include "task.h"
15#include "os.h" 10#include "os.h"
11#include "task.h"
12#include "user.h"
16 13
17#define MAXTOKEN 64 14#define MAXTOKEN 64
18 15
@@ -30,18 +27,20 @@ static char token(int fd, char *buf, int len, char stop)
30 do { 27 do {
31 n = os_read_file(fd, ptr, sizeof(*ptr)); 28 n = os_read_file(fd, ptr, sizeof(*ptr));
32 c = *ptr++; 29 c = *ptr++;
33 if(n != sizeof(*ptr)){ 30 if (n != sizeof(*ptr)) {
34 if(n == 0) 31 if (n == 0)
35 return 0; 32 return 0;
36 printk("Reading /proc/cpuinfo failed, err = %d\n", -n); 33 printk(UM_KERN_ERR "Reading /proc/cpuinfo failed, "
37 if(n < 0) 34 "err = %d\n", -n);
35 if (n < 0)
38 return n; 36 return n;
39 else return -EIO; 37 else return -EIO;
40 } 38 }
41 } while((c != '\n') && (c != stop) && (ptr < end)); 39 } while ((c != '\n') && (c != stop) && (ptr < end));
42 40
43 if(ptr == end){ 41 if (ptr == end) {
44 printk("Failed to find '%c' in /proc/cpuinfo\n", stop); 42 printk(UM_KERN_ERR "Failed to find '%c' in /proc/cpuinfo\n",
43 stop);
45 return -1; 44 return -1;
46 } 45 }
47 *(ptr - 1) = '\0'; 46 *(ptr - 1) = '\0';
@@ -54,26 +53,27 @@ static int find_cpuinfo_line(int fd, char *key, char *scratch, int len)
54 char c; 53 char c;
55 54
56 scratch[len - 1] = '\0'; 55 scratch[len - 1] = '\0';
57 while(1){ 56 while (1) {
58 c = token(fd, scratch, len - 1, ':'); 57 c = token(fd, scratch, len - 1, ':');
59 if(c <= 0) 58 if (c <= 0)
60 return 0; 59 return 0;
61 else if(c != ':'){ 60 else if (c != ':') {
62 printk("Failed to find ':' in /proc/cpuinfo\n"); 61 printk(UM_KERN_ERR "Failed to find ':' in "
62 "/proc/cpuinfo\n");
63 return 0; 63 return 0;
64 } 64 }
65 65
66 if(!strncmp(scratch, key, strlen(key))) 66 if (!strncmp(scratch, key, strlen(key)))
67 return 1; 67 return 1;
68 68
69 do { 69 do {
70 n = os_read_file(fd, &c, sizeof(c)); 70 n = os_read_file(fd, &c, sizeof(c));
71 if(n != sizeof(c)){ 71 if (n != sizeof(c)) {
72 printk("Failed to find newline in " 72 printk(UM_KERN_ERR "Failed to find newline in "
73 "/proc/cpuinfo, err = %d\n", -n); 73 "/proc/cpuinfo, err = %d\n", -n);
74 return 0; 74 return 0;
75 } 75 }
76 } while(c != '\n'); 76 } while (c != '\n');
77 } 77 }
78 return 0; 78 return 0;
79} 79}
@@ -83,46 +83,50 @@ static int check_cpu_flag(char *feature, int *have_it)
83 char buf[MAXTOKEN], c; 83 char buf[MAXTOKEN], c;
84 int fd, len = ARRAY_SIZE(buf); 84 int fd, len = ARRAY_SIZE(buf);
85 85
86 printk("Checking for host processor %s support...", feature); 86 printk(UM_KERN_INFO "Checking for host processor %s support...",
87 feature);
87 fd = os_open_file("/proc/cpuinfo", of_read(OPENFLAGS()), 0); 88 fd = os_open_file("/proc/cpuinfo", of_read(OPENFLAGS()), 0);
88 if(fd < 0){ 89 if (fd < 0) {
89 printk("Couldn't open /proc/cpuinfo, err = %d\n", -fd); 90 printk(UM_KERN_ERR "Couldn't open /proc/cpuinfo, err = %d\n",
91 -fd);
90 return 0; 92 return 0;
91 } 93 }
92 94
93 *have_it = 0; 95 *have_it = 0;
94 if(!find_cpuinfo_line(fd, "flags", buf, ARRAY_SIZE(buf))) 96 if (!find_cpuinfo_line(fd, "flags", buf, ARRAY_SIZE(buf)))
95 goto out; 97 goto out;
96 98
97 c = token(fd, buf, len - 1, ' '); 99 c = token(fd, buf, len - 1, ' ');
98 if(c < 0) 100 if (c < 0)
99 goto out; 101 goto out;
100 else if(c != ' '){ 102 else if (c != ' ') {
101 printk("Failed to find ' ' in /proc/cpuinfo\n"); 103 printk(UM_KERN_ERR "Failed to find ' ' in /proc/cpuinfo\n");
102 goto out; 104 goto out;
103 } 105 }
104 106
105 while(1){ 107 while (1) {
106 c = token(fd, buf, len - 1, ' '); 108 c = token(fd, buf, len - 1, ' ');
107 if(c < 0) 109 if (c < 0)
108 goto out; 110 goto out;
109 else if(c == '\n') break; 111 else if (c == '\n')
112 break;
110 113
111 if(!strcmp(buf, feature)){ 114 if (!strcmp(buf, feature)) {
112 *have_it = 1; 115 *have_it = 1;
113 goto out; 116 goto out;
114 } 117 }
115 } 118 }
116 out: 119 out:
117 if(*have_it == 0) 120 if (*have_it == 0)
118 printk("No\n"); 121 printk("No\n");
119 else if(*have_it == 1) 122 else if (*have_it == 1)
120 printk("Yes\n"); 123 printk("Yes\n");
121 os_close_file(fd); 124 os_close_file(fd);
122 return 1; 125 return 1;
123} 126}
124 127
125#if 0 /* This doesn't work in tt mode, plus it's causing compilation problems 128#if 0 /*
129 * This doesn't work in tt mode, plus it's causing compilation problems
126 * for some people. 130 * for some people.
127 */ 131 */
128static void disable_lcall(void) 132static void disable_lcall(void)
@@ -135,8 +139,9 @@ static void disable_lcall(void)
135 ldt.base_addr = 0; 139 ldt.base_addr = 0;
136 ldt.limit = 0; 140 ldt.limit = 0;
137 err = modify_ldt(1, &ldt, sizeof(ldt)); 141 err = modify_ldt(1, &ldt, sizeof(ldt));
138 if(err) 142 if (err)
139 printk("Failed to disable lcall7 - errno = %d\n", errno); 143 printk(UM_KERN_ERR "Failed to disable lcall7 - errno = %d\n",
144 errno);
140} 145}
141#endif 146#endif
142 147
@@ -151,40 +156,41 @@ void arch_check_bugs(void)
151{ 156{
152 int have_it; 157 int have_it;
153 158
154 if(os_access("/proc/cpuinfo", OS_ACC_R_OK) < 0){ 159 if (os_access("/proc/cpuinfo", OS_ACC_R_OK) < 0) {
155 printk("/proc/cpuinfo not available - skipping CPU capability " 160 printk(UM_KERN_ERR "/proc/cpuinfo not available - skipping CPU "
156 "checks\n"); 161 "capability checks\n");
157 return; 162 return;
158 } 163 }
159 if(check_cpu_flag("cmov", &have_it)) 164 if (check_cpu_flag("cmov", &have_it))
160 host_has_cmov = have_it; 165 host_has_cmov = have_it;
161 if(check_cpu_flag("xmm", &have_it)) 166 if (check_cpu_flag("xmm", &have_it))
162 host_has_xmm = have_it; 167 host_has_xmm = have_it;
163} 168}
164 169
165int arch_handle_signal(int sig, union uml_pt_regs *regs) 170int arch_handle_signal(int sig, struct uml_pt_regs *regs)
166{ 171{
167 unsigned char tmp[2]; 172 unsigned char tmp[2];
168 173
169 /* This is testing for a cmov (0x0f 0x4x) instruction causing a 174 /*
175 * This is testing for a cmov (0x0f 0x4x) instruction causing a
170 * SIGILL in init. 176 * SIGILL in init.
171 */ 177 */
172 if((sig != SIGILL) || (TASK_PID(get_current()) != 1)) 178 if ((sig != SIGILL) || (TASK_PID(get_current()) != 1))
173 return 0; 179 return 0;
174 180
175 if (copy_from_user_proc(tmp, (void *) UPT_IP(regs), 2)) 181 if (copy_from_user_proc(tmp, (void *) UPT_IP(regs), 2))
176 panic("SIGILL in init, could not read instructions!\n"); 182 panic("SIGILL in init, could not read instructions!\n");
177 if((tmp[0] != 0x0f) || ((tmp[1] & 0xf0) != 0x40)) 183 if ((tmp[0] != 0x0f) || ((tmp[1] & 0xf0) != 0x40))
178 return 0; 184 return 0;
179 185
180 if(host_has_cmov == 0) 186 if (host_has_cmov == 0)
181 panic("SIGILL caused by cmov, which this processor doesn't " 187 panic("SIGILL caused by cmov, which this processor doesn't "
182 "implement, boot a filesystem compiled for older " 188 "implement, boot a filesystem compiled for older "
183 "processors"); 189 "processors");
184 else if(host_has_cmov == 1) 190 else if (host_has_cmov == 1)
185 panic("SIGILL caused by cmov, which this processor claims to " 191 panic("SIGILL caused by cmov, which this processor claims to "
186 "implement"); 192 "implement");
187 else if(host_has_cmov == -1) 193 else if (host_has_cmov == -1)
188 panic("SIGILL caused by cmov, couldn't tell if this processor " 194 panic("SIGILL caused by cmov, couldn't tell if this processor "
189 "implements it, boot a filesystem compiled for older " 195 "implements it, boot a filesystem compiled for older "
190 "processors"); 196 "processors");
diff --git a/arch/um/sys-i386/fault.c b/arch/um/sys-i386/fault.c
index 745b4fd49e9f..d670f68532f4 100644
--- a/arch/um/sys-i386/fault.c
+++ b/arch/um/sys-i386/fault.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2002 - 2004 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -15,14 +15,14 @@ struct exception_table_entry
15const struct exception_table_entry *search_exception_tables(unsigned long add); 15const struct exception_table_entry *search_exception_tables(unsigned long add);
16 16
17/* Compare this to arch/i386/mm/extable.c:fixup_exception() */ 17/* Compare this to arch/i386/mm/extable.c:fixup_exception() */
18int arch_fixup(unsigned long address, union uml_pt_regs *regs) 18int arch_fixup(unsigned long address, struct uml_pt_regs *regs)
19{ 19{
20 const struct exception_table_entry *fixup; 20 const struct exception_table_entry *fixup;
21 21
22 fixup = search_exception_tables(address); 22 fixup = search_exception_tables(address);
23 if(fixup != 0){ 23 if (fixup != 0) {
24 UPT_IP(regs) = fixup->fixup; 24 UPT_IP(regs) = fixup->fixup;
25 return(1); 25 return 1;
26 } 26 }
27 return(0); 27 return 0;
28} 28}
diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c
index a939a7ef0227..67c0958eb984 100644
--- a/arch/um/sys-i386/ldt.c
+++ b/arch/um/sys-i386/ldt.c
@@ -1,106 +1,30 @@
1/* 1/*
2 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/sched.h" 6#include "linux/mm.h"
7#include "linux/slab.h"
8#include "linux/types.h"
9#include "linux/errno.h"
10#include "linux/spinlock.h"
11#include "asm/uaccess.h"
12#include "asm/smp.h"
13#include "asm/ldt.h"
14#include "asm/unistd.h" 7#include "asm/unistd.h"
15#include "choose-mode.h"
16#include "kern.h"
17#include "mode_kern.h"
18#include "os.h" 8#include "os.h"
19 9#include "proc_mm.h"
20extern int modify_ldt(int func, void *ptr, unsigned long bytecount);
21
22#ifdef CONFIG_MODE_TT
23
24static long do_modify_ldt_tt(int func, void __user *ptr,
25 unsigned long bytecount)
26{
27 struct user_desc info;
28 int res = 0;
29 void *buf = NULL;
30 void *p = NULL; /* What we pass to host. */
31
32 switch(func){
33 case 1:
34 case 0x11: /* write_ldt */
35 /* Do this check now to avoid overflows. */
36 if (bytecount != sizeof(struct user_desc)) {
37 res = -EINVAL;
38 goto out;
39 }
40
41 if(copy_from_user(&info, ptr, sizeof(info))) {
42 res = -EFAULT;
43 goto out;
44 }
45
46 p = &info;
47 break;
48 case 0:
49 case 2: /* read_ldt */
50
51 /* The use of info avoids kmalloc on the write case, not on the
52 * read one. */
53 buf = kmalloc(bytecount, GFP_KERNEL);
54 if (!buf) {
55 res = -ENOMEM;
56 goto out;
57 }
58 p = buf;
59 break;
60 default:
61 res = -ENOSYS;
62 goto out;
63 }
64
65 res = modify_ldt(func, p, bytecount);
66 if(res < 0)
67 goto out;
68
69 switch(func){
70 case 0:
71 case 2:
72 /* Modify_ldt was for reading and returned the number of read
73 * bytes.*/
74 if(copy_to_user(ptr, p, res))
75 res = -EFAULT;
76 break;
77 }
78
79out:
80 kfree(buf);
81 return res;
82}
83
84#endif
85
86#ifdef CONFIG_MODE_SKAS
87
88#include "skas.h" 10#include "skas.h"
89#include "skas_ptrace.h" 11#include "skas_ptrace.h"
90#include "asm/mmu_context.h" 12#include "sysdep/tls.h"
91#include "proc_mm.h" 13
14extern int modify_ldt(int func, void *ptr, unsigned long bytecount);
92 15
93long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc, 16long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc,
94 void **addr, int done) 17 void **addr, int done)
95{ 18{
96 long res; 19 long res;
97 20
98 if(proc_mm){ 21 if (proc_mm) {
99 /* This is a special handling for the case, that the mm to 22 /*
23 * This is a special handling for the case, that the mm to
100 * modify isn't current->active_mm. 24 * modify isn't current->active_mm.
101 * If this is called directly by modify_ldt, 25 * If this is called directly by modify_ldt,
102 * (current->active_mm->context.skas.u == mm_idp) 26 * (current->active_mm->context.skas.u == mm_idp)
103 * will be true. So no call to switch_mm_skas(mm_idp) is done. 27 * will be true. So no call to __switch_mm(mm_idp) is done.
104 * If this is called in case of init_new_ldt or PTRACE_LDT, 28 * If this is called in case of init_new_ldt or PTRACE_LDT,
105 * mm_idp won't belong to current->active_mm, but child->mm. 29 * mm_idp won't belong to current->active_mm, but child->mm.
106 * So we need to switch child's mm into our userspace, then 30 * So we need to switch child's mm into our userspace, then
@@ -108,12 +32,12 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc,
108 * 32 *
109 * Note: I'm unsure: should interrupts be disabled here? 33 * Note: I'm unsure: should interrupts be disabled here?
110 */ 34 */
111 if(!current->active_mm || current->active_mm == &init_mm || 35 if (!current->active_mm || current->active_mm == &init_mm ||
112 mm_idp != &current->active_mm->context.skas.id) 36 mm_idp != &current->active_mm->context.id)
113 switch_mm_skas(mm_idp); 37 __switch_mm(mm_idp);
114 } 38 }
115 39
116 if(ptrace_ldt) { 40 if (ptrace_ldt) {
117 struct ptrace_ldt ldt_op = (struct ptrace_ldt) { 41 struct ptrace_ldt ldt_op = (struct ptrace_ldt) {
118 .func = func, 42 .func = func,
119 .ptr = desc, 43 .ptr = desc,
@@ -121,7 +45,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc,
121 u32 cpu; 45 u32 cpu;
122 int pid; 46 int pid;
123 47
124 if(!proc_mm) 48 if (!proc_mm)
125 pid = mm_idp->u.pid; 49 pid = mm_idp->u.pid;
126 else { 50 else {
127 cpu = get_cpu(); 51 cpu = get_cpu();
@@ -130,7 +54,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc,
130 54
131 res = os_ptrace_ldt(pid, 0, (unsigned long) &ldt_op); 55 res = os_ptrace_ldt(pid, 0, (unsigned long) &ldt_op);
132 56
133 if(proc_mm) 57 if (proc_mm)
134 put_cpu(); 58 put_cpu();
135 } 59 }
136 else { 60 else {
@@ -139,7 +63,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc,
139 (sizeof(*desc) + sizeof(long) - 1) & 63 (sizeof(*desc) + sizeof(long) - 1) &
140 ~(sizeof(long) - 1), 64 ~(sizeof(long) - 1),
141 addr, &stub_addr); 65 addr, &stub_addr);
142 if(!res){ 66 if (!res) {
143 unsigned long args[] = { func, 67 unsigned long args[] = { func,
144 (unsigned long)stub_addr, 68 (unsigned long)stub_addr,
145 sizeof(*desc), 69 sizeof(*desc),
@@ -149,13 +73,14 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc,
149 } 73 }
150 } 74 }
151 75
152 if(proc_mm){ 76 if (proc_mm) {
153 /* This is the second part of special handling, that makes 77 /*
78 * This is the second part of special handling, that makes
154 * PTRACE_LDT possible to implement. 79 * PTRACE_LDT possible to implement.
155 */ 80 */
156 if(current->active_mm && current->active_mm != &init_mm && 81 if (current->active_mm && current->active_mm != &init_mm &&
157 mm_idp != &current->active_mm->context.skas.id) 82 mm_idp != &current->active_mm->context.id)
158 switch_mm_skas(&current->active_mm->context.skas.id); 83 __switch_mm(&current->active_mm->context.id);
159 } 84 }
160 85
161 return res; 86 return res;
@@ -170,21 +95,22 @@ static long read_ldt_from_host(void __user * ptr, unsigned long bytecount)
170 .ptr = kmalloc(bytecount, GFP_KERNEL)}; 95 .ptr = kmalloc(bytecount, GFP_KERNEL)};
171 u32 cpu; 96 u32 cpu;
172 97
173 if(ptrace_ldt.ptr == NULL) 98 if (ptrace_ldt.ptr == NULL)
174 return -ENOMEM; 99 return -ENOMEM;
175 100
176 /* This is called from sys_modify_ldt only, so userspace_pid gives 101 /*
102 * This is called from sys_modify_ldt only, so userspace_pid gives
177 * us the right number 103 * us the right number
178 */ 104 */
179 105
180 cpu = get_cpu(); 106 cpu = get_cpu();
181 res = os_ptrace_ldt(userspace_pid[cpu], 0, (unsigned long) &ptrace_ldt); 107 res = os_ptrace_ldt(userspace_pid[cpu], 0, (unsigned long) &ptrace_ldt);
182 put_cpu(); 108 put_cpu();
183 if(res < 0) 109 if (res < 0)
184 goto out; 110 goto out;
185 111
186 n = copy_to_user(ptr, ptrace_ldt.ptr, res); 112 n = copy_to_user(ptr, ptrace_ldt.ptr, res);
187 if(n != 0) 113 if (n != 0)
188 res = -EFAULT; 114 res = -EFAULT;
189 115
190 out: 116 out:
@@ -209,35 +135,34 @@ static int read_ldt(void __user * ptr, unsigned long bytecount)
209{ 135{
210 int i, err = 0; 136 int i, err = 0;
211 unsigned long size; 137 unsigned long size;
212 uml_ldt_t * ldt = &current->mm->context.skas.ldt; 138 uml_ldt_t * ldt = &current->mm->context.ldt;
213 139
214 if(!ldt->entry_count) 140 if (!ldt->entry_count)
215 goto out; 141 goto out;
216 if(bytecount > LDT_ENTRY_SIZE*LDT_ENTRIES) 142 if (bytecount > LDT_ENTRY_SIZE*LDT_ENTRIES)
217 bytecount = LDT_ENTRY_SIZE*LDT_ENTRIES; 143 bytecount = LDT_ENTRY_SIZE*LDT_ENTRIES;
218 err = bytecount; 144 err = bytecount;
219 145
220 if(ptrace_ldt){ 146 if (ptrace_ldt)
221 return read_ldt_from_host(ptr, bytecount); 147 return read_ldt_from_host(ptr, bytecount);
222 }
223 148
224 down(&ldt->semaphore); 149 down(&ldt->semaphore);
225 if(ldt->entry_count <= LDT_DIRECT_ENTRIES){ 150 if (ldt->entry_count <= LDT_DIRECT_ENTRIES) {
226 size = LDT_ENTRY_SIZE*LDT_DIRECT_ENTRIES; 151 size = LDT_ENTRY_SIZE*LDT_DIRECT_ENTRIES;
227 if(size > bytecount) 152 if (size > bytecount)
228 size = bytecount; 153 size = bytecount;
229 if(copy_to_user(ptr, ldt->u.entries, size)) 154 if (copy_to_user(ptr, ldt->u.entries, size))
230 err = -EFAULT; 155 err = -EFAULT;
231 bytecount -= size; 156 bytecount -= size;
232 ptr += size; 157 ptr += size;
233 } 158 }
234 else { 159 else {
235 for(i=0; i<ldt->entry_count/LDT_ENTRIES_PER_PAGE && bytecount; 160 for (i=0; i<ldt->entry_count/LDT_ENTRIES_PER_PAGE && bytecount;
236 i++){ 161 i++) {
237 size = PAGE_SIZE; 162 size = PAGE_SIZE;
238 if(size > bytecount) 163 if (size > bytecount)
239 size = bytecount; 164 size = bytecount;
240 if(copy_to_user(ptr, ldt->u.pages[i], size)){ 165 if (copy_to_user(ptr, ldt->u.pages[i], size)) {
241 err = -EFAULT; 166 err = -EFAULT;
242 break; 167 break;
243 } 168 }
@@ -247,10 +172,10 @@ static int read_ldt(void __user * ptr, unsigned long bytecount)
247 } 172 }
248 up(&ldt->semaphore); 173 up(&ldt->semaphore);
249 174
250 if(bytecount == 0 || err == -EFAULT) 175 if (bytecount == 0 || err == -EFAULT)
251 goto out; 176 goto out;
252 177
253 if(clear_user(ptr, bytecount)) 178 if (clear_user(ptr, bytecount))
254 err = -EFAULT; 179 err = -EFAULT;
255 180
256out: 181out:
@@ -261,15 +186,16 @@ static int read_default_ldt(void __user * ptr, unsigned long bytecount)
261{ 186{
262 int err; 187 int err;
263 188
264 if(bytecount > 5*LDT_ENTRY_SIZE) 189 if (bytecount > 5*LDT_ENTRY_SIZE)
265 bytecount = 5*LDT_ENTRY_SIZE; 190 bytecount = 5*LDT_ENTRY_SIZE;
266 191
267 err = bytecount; 192 err = bytecount;
268 /* UML doesn't support lcall7 and lcall27. 193 /*
194 * UML doesn't support lcall7 and lcall27.
269 * So, we don't really have a default ldt, but emulate 195 * So, we don't really have a default ldt, but emulate
270 * an empty ldt of common host default ldt size. 196 * an empty ldt of common host default ldt size.
271 */ 197 */
272 if(clear_user(ptr, bytecount)) 198 if (clear_user(ptr, bytecount))
273 err = -EFAULT; 199 err = -EFAULT;
274 200
275 return err; 201 return err;
@@ -277,60 +203,60 @@ static int read_default_ldt(void __user * ptr, unsigned long bytecount)
277 203
278static int write_ldt(void __user * ptr, unsigned long bytecount, int func) 204static int write_ldt(void __user * ptr, unsigned long bytecount, int func)
279{ 205{
280 uml_ldt_t * ldt = &current->mm->context.skas.ldt; 206 uml_ldt_t * ldt = &current->mm->context.ldt;
281 struct mm_id * mm_idp = &current->mm->context.skas.id; 207 struct mm_id * mm_idp = &current->mm->context.id;
282 int i, err; 208 int i, err;
283 struct user_desc ldt_info; 209 struct user_desc ldt_info;
284 struct ldt_entry entry0, *ldt_p; 210 struct ldt_entry entry0, *ldt_p;
285 void *addr = NULL; 211 void *addr = NULL;
286 212
287 err = -EINVAL; 213 err = -EINVAL;
288 if(bytecount != sizeof(ldt_info)) 214 if (bytecount != sizeof(ldt_info))
289 goto out; 215 goto out;
290 err = -EFAULT; 216 err = -EFAULT;
291 if(copy_from_user(&ldt_info, ptr, sizeof(ldt_info))) 217 if (copy_from_user(&ldt_info, ptr, sizeof(ldt_info)))
292 goto out; 218 goto out;
293 219
294 err = -EINVAL; 220 err = -EINVAL;
295 if(ldt_info.entry_number >= LDT_ENTRIES) 221 if (ldt_info.entry_number >= LDT_ENTRIES)
296 goto out; 222 goto out;
297 if(ldt_info.contents == 3){ 223 if (ldt_info.contents == 3) {
298 if (func == 1) 224 if (func == 1)
299 goto out; 225 goto out;
300 if (ldt_info.seg_not_present == 0) 226 if (ldt_info.seg_not_present == 0)
301 goto out; 227 goto out;
302 } 228 }
303 229
304 if(!ptrace_ldt) 230 if (!ptrace_ldt)
305 down(&ldt->semaphore); 231 down(&ldt->semaphore);
306 232
307 err = write_ldt_entry(mm_idp, func, &ldt_info, &addr, 1); 233 err = write_ldt_entry(mm_idp, func, &ldt_info, &addr, 1);
308 if(err) 234 if (err)
309 goto out_unlock; 235 goto out_unlock;
310 else if(ptrace_ldt) { 236 else if (ptrace_ldt) {
311 /* With PTRACE_LDT available, this is used as a flag only */ 237 /* With PTRACE_LDT available, this is used as a flag only */
312 ldt->entry_count = 1; 238 ldt->entry_count = 1;
313 goto out; 239 goto out;
314 } 240 }
315 241
316 if(ldt_info.entry_number >= ldt->entry_count && 242 if (ldt_info.entry_number >= ldt->entry_count &&
317 ldt_info.entry_number >= LDT_DIRECT_ENTRIES){ 243 ldt_info.entry_number >= LDT_DIRECT_ENTRIES) {
318 for(i=ldt->entry_count/LDT_ENTRIES_PER_PAGE; 244 for (i=ldt->entry_count/LDT_ENTRIES_PER_PAGE;
319 i*LDT_ENTRIES_PER_PAGE <= ldt_info.entry_number; 245 i*LDT_ENTRIES_PER_PAGE <= ldt_info.entry_number;
320 i++){ 246 i++) {
321 if(i == 0) 247 if (i == 0)
322 memcpy(&entry0, ldt->u.entries, 248 memcpy(&entry0, ldt->u.entries,
323 sizeof(entry0)); 249 sizeof(entry0));
324 ldt->u.pages[i] = (struct ldt_entry *) 250 ldt->u.pages[i] = (struct ldt_entry *)
325 __get_free_page(GFP_KERNEL|__GFP_ZERO); 251 __get_free_page(GFP_KERNEL|__GFP_ZERO);
326 if(!ldt->u.pages[i]){ 252 if (!ldt->u.pages[i]) {
327 err = -ENOMEM; 253 err = -ENOMEM;
328 /* Undo the change in host */ 254 /* Undo the change in host */
329 memset(&ldt_info, 0, sizeof(ldt_info)); 255 memset(&ldt_info, 0, sizeof(ldt_info));
330 write_ldt_entry(mm_idp, 1, &ldt_info, &addr, 1); 256 write_ldt_entry(mm_idp, 1, &ldt_info, &addr, 1);
331 goto out_unlock; 257 goto out_unlock;
332 } 258 }
333 if(i == 0) { 259 if (i == 0) {
334 memcpy(ldt->u.pages[0], &entry0, 260 memcpy(ldt->u.pages[0], &entry0,
335 sizeof(entry0)); 261 sizeof(entry0));
336 memcpy(ldt->u.pages[0]+1, ldt->u.entries+1, 262 memcpy(ldt->u.pages[0]+1, ldt->u.entries+1,
@@ -339,17 +265,17 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int func)
339 ldt->entry_count = (i + 1) * LDT_ENTRIES_PER_PAGE; 265 ldt->entry_count = (i + 1) * LDT_ENTRIES_PER_PAGE;
340 } 266 }
341 } 267 }
342 if(ldt->entry_count <= ldt_info.entry_number) 268 if (ldt->entry_count <= ldt_info.entry_number)
343 ldt->entry_count = ldt_info.entry_number + 1; 269 ldt->entry_count = ldt_info.entry_number + 1;
344 270
345 if(ldt->entry_count <= LDT_DIRECT_ENTRIES) 271 if (ldt->entry_count <= LDT_DIRECT_ENTRIES)
346 ldt_p = ldt->u.entries + ldt_info.entry_number; 272 ldt_p = ldt->u.entries + ldt_info.entry_number;
347 else 273 else
348 ldt_p = ldt->u.pages[ldt_info.entry_number/LDT_ENTRIES_PER_PAGE] + 274 ldt_p = ldt->u.pages[ldt_info.entry_number/LDT_ENTRIES_PER_PAGE] +
349 ldt_info.entry_number%LDT_ENTRIES_PER_PAGE; 275 ldt_info.entry_number%LDT_ENTRIES_PER_PAGE;
350 276
351 if(ldt_info.base_addr == 0 && ldt_info.limit == 0 && 277 if (ldt_info.base_addr == 0 && ldt_info.limit == 0 &&
352 (func == 1 || LDT_empty(&ldt_info))){ 278 (func == 1 || LDT_empty(&ldt_info))) {
353 ldt_p->a = 0; 279 ldt_p->a = 0;
354 ldt_p->b = 0; 280 ldt_p->b = 0;
355 } 281 }
@@ -400,7 +326,7 @@ static void ldt_get_host_info(void)
400 326
401 spin_lock(&host_ldt_lock); 327 spin_lock(&host_ldt_lock);
402 328
403 if(host_ldt_entries != NULL){ 329 if (host_ldt_entries != NULL) {
404 spin_unlock(&host_ldt_lock); 330 spin_unlock(&host_ldt_lock);
405 return; 331 return;
406 } 332 }
@@ -408,49 +334,49 @@ static void ldt_get_host_info(void)
408 334
409 spin_unlock(&host_ldt_lock); 335 spin_unlock(&host_ldt_lock);
410 336
411 for(i = LDT_PAGES_MAX-1, order=0; i; i>>=1, order++); 337 for (i = LDT_PAGES_MAX-1, order=0; i; i>>=1, order++)
338 ;
412 339
413 ldt = (struct ldt_entry *) 340 ldt = (struct ldt_entry *)
414 __get_free_pages(GFP_KERNEL|__GFP_ZERO, order); 341 __get_free_pages(GFP_KERNEL|__GFP_ZERO, order);
415 if(ldt == NULL) { 342 if (ldt == NULL) {
416 printk("ldt_get_host_info: couldn't allocate buffer for host " 343 printk(KERN_ERR "ldt_get_host_info: couldn't allocate buffer "
417 "ldt\n"); 344 "for host ldt\n");
418 return; 345 return;
419 } 346 }
420 347
421 ret = modify_ldt(0, ldt, (1<<order)*PAGE_SIZE); 348 ret = modify_ldt(0, ldt, (1<<order)*PAGE_SIZE);
422 if(ret < 0) { 349 if (ret < 0) {
423 printk("ldt_get_host_info: couldn't read host ldt\n"); 350 printk(KERN_ERR "ldt_get_host_info: couldn't read host ldt\n");
424 goto out_free; 351 goto out_free;
425 } 352 }
426 if(ret == 0) { 353 if (ret == 0) {
427 /* default_ldt is active, simply write an empty entry 0 */ 354 /* default_ldt is active, simply write an empty entry 0 */
428 host_ldt_entries = dummy_list; 355 host_ldt_entries = dummy_list;
429 goto out_free; 356 goto out_free;
430 } 357 }
431 358
432 for(i=0, size=0; i<ret/LDT_ENTRY_SIZE; i++){ 359 for (i=0, size=0; i<ret/LDT_ENTRY_SIZE; i++) {
433 if(ldt[i].a != 0 || ldt[i].b != 0) 360 if (ldt[i].a != 0 || ldt[i].b != 0)
434 size++; 361 size++;
435 } 362 }
436 363
437 if(size < ARRAY_SIZE(dummy_list)) 364 if (size < ARRAY_SIZE(dummy_list))
438 host_ldt_entries = dummy_list; 365 host_ldt_entries = dummy_list;
439 else { 366 else {
440 size = (size + 1) * sizeof(dummy_list[0]); 367 size = (size + 1) * sizeof(dummy_list[0]);
441 tmp = kmalloc(size, GFP_KERNEL); 368 tmp = kmalloc(size, GFP_KERNEL);
442 if(tmp == NULL) { 369 if (tmp == NULL) {
443 printk("ldt_get_host_info: couldn't allocate host ldt " 370 printk(KERN_ERR "ldt_get_host_info: couldn't allocate "
444 "list\n"); 371 "host ldt list\n");
445 goto out_free; 372 goto out_free;
446 } 373 }
447 host_ldt_entries = tmp; 374 host_ldt_entries = tmp;
448 } 375 }
449 376
450 for(i=0, k=0; i<ret/LDT_ENTRY_SIZE; i++){ 377 for (i=0, k=0; i<ret/LDT_ENTRY_SIZE; i++) {
451 if(ldt[i].a != 0 || ldt[i].b != 0) { 378 if (ldt[i].a != 0 || ldt[i].b != 0)
452 host_ldt_entries[k++] = i; 379 host_ldt_entries[k++] = i;
453 }
454 } 380 }
455 host_ldt_entries[k] = -1; 381 host_ldt_entries[k] = -1;
456 382
@@ -458,8 +384,7 @@ out_free:
458 free_pages((unsigned long)ldt, order); 384 free_pages((unsigned long)ldt, order);
459} 385}
460 386
461long init_new_ldt(struct mmu_context_skas * new_mm, 387long init_new_ldt(struct mm_context *new_mm, struct mm_context *from_mm)
462 struct mmu_context_skas * from_mm)
463{ 388{
464 struct user_desc desc; 389 struct user_desc desc;
465 short * num_p; 390 short * num_p;
@@ -469,15 +394,15 @@ long init_new_ldt(struct mmu_context_skas * new_mm,
469 struct proc_mm_op copy; 394 struct proc_mm_op copy;
470 395
471 396
472 if(!ptrace_ldt) 397 if (!ptrace_ldt)
473 init_MUTEX(&new_mm->ldt.semaphore); 398 init_MUTEX(&new_mm->ldt.semaphore);
474 399
475 if(!from_mm){ 400 if (!from_mm) {
476 memset(&desc, 0, sizeof(desc)); 401 memset(&desc, 0, sizeof(desc));
477 /* 402 /*
478 * We have to initialize a clean ldt. 403 * We have to initialize a clean ldt.
479 */ 404 */
480 if(proc_mm) { 405 if (proc_mm) {
481 /* 406 /*
482 * If the new mm was created using proc_mm, host's 407 * If the new mm was created using proc_mm, host's
483 * default-ldt currently is assigned, which normally 408 * default-ldt currently is assigned, which normally
@@ -485,8 +410,7 @@ long init_new_ldt(struct mmu_context_skas * new_mm,
485 * To remove these gates, we simply write an empty 410 * To remove these gates, we simply write an empty
486 * entry as number 0 to the host. 411 * entry as number 0 to the host.
487 */ 412 */
488 err = write_ldt_entry(&new_mm->id, 1, &desc, 413 err = write_ldt_entry(&new_mm->id, 1, &desc, &addr, 1);
489 &addr, 1);
490 } 414 }
491 else{ 415 else{
492 /* 416 /*
@@ -495,11 +419,11 @@ long init_new_ldt(struct mmu_context_skas * new_mm,
495 * will be reset in the following loop 419 * will be reset in the following loop
496 */ 420 */
497 ldt_get_host_info(); 421 ldt_get_host_info();
498 for(num_p=host_ldt_entries; *num_p != -1; num_p++){ 422 for (num_p=host_ldt_entries; *num_p != -1; num_p++) {
499 desc.entry_number = *num_p; 423 desc.entry_number = *num_p;
500 err = write_ldt_entry(&new_mm->id, 1, &desc, 424 err = write_ldt_entry(&new_mm->id, 1, &desc,
501 &addr, *(num_p + 1) == -1); 425 &addr, *(num_p + 1) == -1);
502 if(err) 426 if (err)
503 break; 427 break;
504 } 428 }
505 } 429 }
@@ -508,8 +432,9 @@ long init_new_ldt(struct mmu_context_skas * new_mm,
508 goto out; 432 goto out;
509 } 433 }
510 434
511 if(proc_mm){ 435 if (proc_mm) {
512 /* We have a valid from_mm, so we now have to copy the LDT of 436 /*
437 * We have a valid from_mm, so we now have to copy the LDT of
513 * from_mm to new_mm, because using proc_mm an new mm with 438 * from_mm to new_mm, because using proc_mm an new mm with
514 * an empty/default LDT was created in new_mm() 439 * an empty/default LDT was created in new_mm()
515 */ 440 */
@@ -518,27 +443,27 @@ long init_new_ldt(struct mmu_context_skas * new_mm,
518 { .copy_segments = 443 { .copy_segments =
519 from_mm->id.u.mm_fd } } ); 444 from_mm->id.u.mm_fd } } );
520 i = os_write_file(new_mm->id.u.mm_fd, &copy, sizeof(copy)); 445 i = os_write_file(new_mm->id.u.mm_fd, &copy, sizeof(copy));
521 if(i != sizeof(copy)) 446 if (i != sizeof(copy))
522 printk("new_mm : /proc/mm copy_segments failed, " 447 printk(KERN_ERR "new_mm : /proc/mm copy_segments "
523 "err = %d\n", -i); 448 "failed, err = %d\n", -i);
524 } 449 }
525 450
526 if(!ptrace_ldt) { 451 if (!ptrace_ldt) {
527 /* Our local LDT is used to supply the data for 452 /*
453 * Our local LDT is used to supply the data for
528 * modify_ldt(READLDT), if PTRACE_LDT isn't available, 454 * modify_ldt(READLDT), if PTRACE_LDT isn't available,
529 * i.e., we have to use the stub for modify_ldt, which 455 * i.e., we have to use the stub for modify_ldt, which
530 * can't handle the big read buffer of up to 64kB. 456 * can't handle the big read buffer of up to 64kB.
531 */ 457 */
532 down(&from_mm->ldt.semaphore); 458 down(&from_mm->ldt.semaphore);
533 if(from_mm->ldt.entry_count <= LDT_DIRECT_ENTRIES){ 459 if (from_mm->ldt.entry_count <= LDT_DIRECT_ENTRIES)
534 memcpy(new_mm->ldt.u.entries, from_mm->ldt.u.entries, 460 memcpy(new_mm->ldt.u.entries, from_mm->ldt.u.entries,
535 sizeof(new_mm->ldt.u.entries)); 461 sizeof(new_mm->ldt.u.entries));
536 } 462 else {
537 else{
538 i = from_mm->ldt.entry_count / LDT_ENTRIES_PER_PAGE; 463 i = from_mm->ldt.entry_count / LDT_ENTRIES_PER_PAGE;
539 while(i-->0){ 464 while (i-->0) {
540 page = __get_free_page(GFP_KERNEL|__GFP_ZERO); 465 page = __get_free_page(GFP_KERNEL|__GFP_ZERO);
541 if (!page){ 466 if (!page) {
542 err = -ENOMEM; 467 err = -ENOMEM;
543 break; 468 break;
544 } 469 }
@@ -557,22 +482,19 @@ long init_new_ldt(struct mmu_context_skas * new_mm,
557} 482}
558 483
559 484
560void free_ldt(struct mmu_context_skas * mm) 485void free_ldt(struct mm_context *mm)
561{ 486{
562 int i; 487 int i;
563 488
564 if(!ptrace_ldt && mm->ldt.entry_count > LDT_DIRECT_ENTRIES){ 489 if (!ptrace_ldt && mm->ldt.entry_count > LDT_DIRECT_ENTRIES) {
565 i = mm->ldt.entry_count / LDT_ENTRIES_PER_PAGE; 490 i = mm->ldt.entry_count / LDT_ENTRIES_PER_PAGE;
566 while(i-- > 0){ 491 while (i-- > 0)
567 free_page((long )mm->ldt.u.pages[i]); 492 free_page((long) mm->ldt.u.pages[i]);
568 }
569 } 493 }
570 mm->ldt.entry_count = 0; 494 mm->ldt.entry_count = 0;
571} 495}
572#endif
573 496
574int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount) 497int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount)
575{ 498{
576 return CHOOSE_MODE_PROC(do_modify_ldt_tt, do_modify_ldt_skas, func, 499 return do_modify_ldt_skas(func, ptr, bytecount);
577 ptr, bytecount);
578} 500}
diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c
index 28bf01150323..9657c89fdf31 100644
--- a/arch/um/sys-i386/ptrace.c
+++ b/arch/um/sys-i386/ptrace.c
@@ -1,35 +1,26 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <linux/compiler.h>
7#include "linux/sched.h"
8#include "linux/mm.h" 6#include "linux/mm.h"
9#include "asm/elf.h" 7#include "linux/sched.h"
10#include "asm/ptrace.h"
11#include "asm/uaccess.h" 8#include "asm/uaccess.h"
12#include "asm/unistd.h" 9#include "skas.h"
13#include "sysdep/ptrace.h"
14#include "sysdep/sigcontext.h"
15#include "sysdep/sc.h"
16 10
17void arch_switch_to_tt(struct task_struct *from, struct task_struct *to) 11extern int arch_switch_tls(struct task_struct *from, struct task_struct *to);
18{
19 update_debugregs(to->thread.arch.debugregs_seq);
20 arch_switch_tls_tt(from, to);
21}
22 12
23void arch_switch_to_skas(struct task_struct *from, struct task_struct *to) 13void arch_switch_to(struct task_struct *from, struct task_struct *to)
24{ 14{
25 int err = arch_switch_tls_skas(from, to); 15 int err = arch_switch_tls(from, to);
26 if (!err) 16 if (!err)
27 return; 17 return;
28 18
29 if (err != -EINVAL) 19 if (err != -EINVAL)
30 printk(KERN_WARNING "arch_switch_tls_skas failed, errno %d, not EINVAL\n", -err); 20 printk(KERN_WARNING "arch_switch_tls failed, errno %d, "
21 "not EINVAL\n", -err);
31 else 22 else
32 printk(KERN_WARNING "arch_switch_tls_skas failed, errno = EINVAL\n"); 23 printk(KERN_WARNING "arch_switch_tls failed, errno = EINVAL\n");
33} 24}
34 25
35int is_syscall(unsigned long addr) 26int is_syscall(unsigned long addr)
@@ -38,21 +29,21 @@ int is_syscall(unsigned long addr)
38 int n; 29 int n;
39 30
40 n = copy_from_user(&instr, (void __user *) addr, sizeof(instr)); 31 n = copy_from_user(&instr, (void __user *) addr, sizeof(instr));
41 if(n){ 32 if (n) {
42 /* access_process_vm() grants access to vsyscall and stub, 33 /* access_process_vm() grants access to vsyscall and stub,
43 * while copy_from_user doesn't. Maybe access_process_vm is 34 * while copy_from_user doesn't. Maybe access_process_vm is
44 * slow, but that doesn't matter, since it will be called only 35 * slow, but that doesn't matter, since it will be called only
45 * in case of singlestepping, if copy_from_user failed. 36 * in case of singlestepping, if copy_from_user failed.
46 */ 37 */
47 n = access_process_vm(current, addr, &instr, sizeof(instr), 0); 38 n = access_process_vm(current, addr, &instr, sizeof(instr), 0);
48 if(n != sizeof(instr)) { 39 if (n != sizeof(instr)) {
49 printk("is_syscall : failed to read instruction from " 40 printk(KERN_ERR "is_syscall : failed to read "
50 "0x%lx\n", addr); 41 "instruction from 0x%lx\n", addr);
51 return(1); 42 return 1;
52 } 43 }
53 } 44 }
54 /* int 0x80 or sysenter */ 45 /* int 0x80 or sysenter */
55 return((instr == 0x80cd) || (instr == 0x340f)); 46 return (instr == 0x80cd) || (instr == 0x340f);
56} 47}
57 48
58/* determines which flags the user has access to. */ 49/* determines which flags the user has access to. */
@@ -96,21 +87,21 @@ int putreg(struct task_struct *child, int regno, unsigned long value)
96 87
97int poke_user(struct task_struct *child, long addr, long data) 88int poke_user(struct task_struct *child, long addr, long data)
98{ 89{
99 if ((addr & 3) || addr < 0) 90 if ((addr & 3) || addr < 0)
100 return -EIO; 91 return -EIO;
101
102 if (addr < MAX_REG_OFFSET)
103 return putreg(child, addr, data);
104 92
105 else if((addr >= offsetof(struct user, u_debugreg[0])) && 93 if (addr < MAX_REG_OFFSET)
106 (addr <= offsetof(struct user, u_debugreg[7]))){ 94 return putreg(child, addr, data);
107 addr -= offsetof(struct user, u_debugreg[0]); 95 else if ((addr >= offsetof(struct user, u_debugreg[0])) &&
108 addr = addr >> 2; 96 (addr <= offsetof(struct user, u_debugreg[7]))) {
109 if((addr == 4) || (addr == 5)) return -EIO; 97 addr -= offsetof(struct user, u_debugreg[0]);
110 child->thread.arch.debugregs[addr] = data; 98 addr = addr >> 2;
111 return 0; 99 if ((addr == 4) || (addr == 5))
112 } 100 return -EIO;
113 return -EIO; 101 child->thread.arch.debugregs[addr] = data;
102 return 0;
103 }
104 return -EIO;
114} 105}
115 106
116unsigned long getreg(struct task_struct *child, int regno) 107unsigned long getreg(struct task_struct *child, int regno)
@@ -133,20 +124,20 @@ unsigned long getreg(struct task_struct *child, int regno)
133 return retval; 124 return retval;
134} 125}
135 126
127/* read the word at location addr in the USER area. */
136int peek_user(struct task_struct *child, long addr, long data) 128int peek_user(struct task_struct *child, long addr, long data)
137{ 129{
138/* read the word at location addr in the USER area. */
139 unsigned long tmp; 130 unsigned long tmp;
140 131
141 if ((addr & 3) || addr < 0) 132 if ((addr & 3) || addr < 0)
142 return -EIO; 133 return -EIO;
143 134
144 tmp = 0; /* Default return condition */ 135 tmp = 0; /* Default return condition */
145 if(addr < MAX_REG_OFFSET){ 136 if (addr < MAX_REG_OFFSET) {
146 tmp = getreg(child, addr); 137 tmp = getreg(child, addr);
147 } 138 }
148 else if((addr >= offsetof(struct user, u_debugreg[0])) && 139 else if ((addr >= offsetof(struct user, u_debugreg[0])) &&
149 (addr <= offsetof(struct user, u_debugreg[7]))){ 140 (addr <= offsetof(struct user, u_debugreg[7]))) {
150 addr -= offsetof(struct user, u_debugreg[0]); 141 addr -= offsetof(struct user, u_debugreg[0]);
151 addr = addr >> 2; 142 addr = addr >> 2;
152 tmp = child->thread.arch.debugregs[addr]; 143 tmp = child->thread.arch.debugregs[addr];
@@ -154,277 +145,68 @@ int peek_user(struct task_struct *child, long addr, long data)
154 return put_user(tmp, (unsigned long __user *) data); 145 return put_user(tmp, (unsigned long __user *) data);
155} 146}
156 147
157struct i387_fxsave_struct { 148int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
158 unsigned short cwd;
159 unsigned short swd;
160 unsigned short twd;
161 unsigned short fop;
162 long fip;
163 long fcs;
164 long foo;
165 long fos;
166 long mxcsr;
167 long reserved;
168 long st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
169 long xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */
170 long padding[56];
171};
172
173/*
174 * FPU tag word conversions.
175 */
176
177static inline unsigned short twd_i387_to_fxsr( unsigned short twd )
178{ 149{
179 unsigned int tmp; /* to avoid 16 bit prefixes in the code */ 150 int err, n, cpu = ((struct thread_info *) child->stack)->cpu;
180 151 long fpregs[HOST_FP_SIZE];
181 /* Transform each pair of bits into 01 (valid) or 00 (empty) */
182 tmp = ~twd;
183 tmp = (tmp | (tmp>>1)) & 0x5555; /* 0V0V0V0V0V0V0V0V */
184 /* and move the valid bits to the lower byte. */
185 tmp = (tmp | (tmp >> 1)) & 0x3333; /* 00VV00VV00VV00VV */
186 tmp = (tmp | (tmp >> 2)) & 0x0f0f; /* 0000VVVV0000VVVV */
187 tmp = (tmp | (tmp >> 4)) & 0x00ff; /* 00000000VVVVVVVV */
188 return tmp;
189}
190 152
191static inline unsigned long twd_fxsr_to_i387( struct i387_fxsave_struct *fxsave ) 153 BUG_ON(sizeof(*buf) != sizeof(fpregs));
192{ 154 err = save_fp_registers(userspace_pid[cpu], fpregs);
193 struct _fpxreg *st = NULL; 155 if (err)
194 unsigned long twd = (unsigned long) fxsave->twd; 156 return err;
195 unsigned long tag;
196 unsigned long ret = 0xffff0000;
197 int i;
198 157
199#define FPREG_ADDR(f, n) ((char *)&(f)->st_space + (n) * 16); 158 n = copy_to_user((void *) buf, fpregs, sizeof(fpregs));
159 if(n > 0)
160 return -EFAULT;
200 161
201 for ( i = 0 ; i < 8 ; i++ ) { 162 return n;
202 if ( twd & 0x1 ) {
203 st = (struct _fpxreg *) FPREG_ADDR( fxsave, i );
204
205 switch ( st->exponent & 0x7fff ) {
206 case 0x7fff:
207 tag = 2; /* Special */
208 break;
209 case 0x0000:
210 if ( !st->significand[0] &&
211 !st->significand[1] &&
212 !st->significand[2] &&
213 !st->significand[3] ) {
214 tag = 1; /* Zero */
215 } else {
216 tag = 2; /* Special */
217 }
218 break;
219 default:
220 if ( st->significand[3] & 0x8000 ) {
221 tag = 0; /* Valid */
222 } else {
223 tag = 2; /* Special */
224 }
225 break;
226 }
227 } else {
228 tag = 3; /* Empty */
229 }
230 ret |= (tag << (2 * i));
231 twd = twd >> 1;
232 }
233 return ret;
234} 163}
235 164
236/* 165int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
237 * FXSR floating point environment conversions.
238 */
239
240#ifdef CONFIG_MODE_TT
241static inline int convert_fxsr_to_user_tt(struct _fpstate __user *buf,
242 struct pt_regs *regs)
243{ 166{
244 struct i387_fxsave_struct *fxsave = SC_FXSR_ENV(PT_REGS_SC(regs)); 167 int n, cpu = ((struct thread_info *) child->stack)->cpu;
245 unsigned long env[7]; 168 long fpregs[HOST_FP_SIZE];
246 struct _fpreg __user *to;
247 struct _fpxreg *from;
248 int i;
249 169
250 env[0] = (unsigned long)fxsave->cwd | 0xffff0000; 170 BUG_ON(sizeof(*buf) != sizeof(fpregs));
251 env[1] = (unsigned long)fxsave->swd | 0xffff0000; 171 n = copy_from_user(fpregs, (void *) buf, sizeof(fpregs));
252 env[2] = twd_fxsr_to_i387(fxsave); 172 if (n > 0)
253 env[3] = fxsave->fip; 173 return -EFAULT;
254 env[4] = fxsave->fcs | ((unsigned long)fxsave->fop << 16);
255 env[5] = fxsave->foo;
256 env[6] = fxsave->fos;
257 174
258 if ( __copy_to_user( buf, env, 7 * sizeof(unsigned long) ) ) 175 return restore_fp_registers(userspace_pid[cpu], fpregs);
259 return 1;
260
261 to = &buf->_st[0];
262 from = (struct _fpxreg *) &fxsave->st_space[0];
263 for ( i = 0 ; i < 8 ; i++, to++, from++ ) {
264 if ( __copy_to_user( to, from, sizeof(*to) ) )
265 return 1;
266 }
267 return 0;
268} 176}
269#endif
270 177
271static inline int convert_fxsr_to_user(struct _fpstate __user *buf, 178int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
272 struct pt_regs *regs)
273{ 179{
274 return(CHOOSE_MODE(convert_fxsr_to_user_tt(buf, regs), 0)); 180 int err, n, cpu = ((struct thread_info *) child->stack)->cpu;
275} 181 long fpregs[HOST_XFP_SIZE];
276 182
277#ifdef CONFIG_MODE_TT 183 BUG_ON(sizeof(*buf) != sizeof(fpregs));
278static inline int convert_fxsr_from_user_tt(struct pt_regs *regs, 184 err = save_fpx_registers(userspace_pid[cpu], fpregs);
279 struct _fpstate __user *buf) 185 if (err)
280{ 186 return err;
281 struct i387_fxsave_struct *fxsave = SC_FXSR_ENV(PT_REGS_SC(regs));
282 unsigned long env[7];
283 struct _fpxreg *to;
284 struct _fpreg __user *from;
285 int i;
286
287 if ( __copy_from_user( env, buf, 7 * sizeof(long) ) )
288 return 1;
289 187
290 fxsave->cwd = (unsigned short)(env[0] & 0xffff); 188 n = copy_to_user((void *) buf, fpregs, sizeof(fpregs));
291 fxsave->swd = (unsigned short)(env[1] & 0xffff); 189 if(n > 0)
292 fxsave->twd = twd_i387_to_fxsr((unsigned short)(env[2] & 0xffff)); 190 return -EFAULT;
293 fxsave->fip = env[3];
294 fxsave->fop = (unsigned short)((env[4] & 0xffff0000) >> 16);
295 fxsave->fcs = (env[4] & 0xffff);
296 fxsave->foo = env[5];
297 fxsave->fos = env[6];
298 191
299 to = (struct _fpxreg *) &fxsave->st_space[0]; 192 return n;
300 from = &buf->_st[0];
301 for ( i = 0 ; i < 8 ; i++, to++, from++ ) {
302 if ( __copy_from_user( to, from, sizeof(*from) ) )
303 return 1;
304 }
305 return 0;
306}
307#endif
308
309static inline int convert_fxsr_from_user(struct pt_regs *regs,
310 struct _fpstate __user *buf)
311{
312 return(CHOOSE_MODE(convert_fxsr_from_user_tt(regs, buf), 0));
313}
314
315int get_fpregs(unsigned long buf, struct task_struct *child)
316{
317 int err;
318
319 err = convert_fxsr_to_user((struct _fpstate __user *) buf,
320 &child->thread.regs);
321 if(err) return(-EFAULT);
322 else return(0);
323}
324
325int set_fpregs(unsigned long buf, struct task_struct *child)
326{
327 int err;
328
329 err = convert_fxsr_from_user(&child->thread.regs,
330 (struct _fpstate __user *) buf);
331 if(err) return(-EFAULT);
332 else return(0);
333}
334
335#ifdef CONFIG_MODE_TT
336int get_fpxregs_tt(unsigned long buf, struct task_struct *tsk)
337{
338 struct pt_regs *regs = &tsk->thread.regs;
339 struct i387_fxsave_struct *fxsave = SC_FXSR_ENV(PT_REGS_SC(regs));
340 int err;
341
342 err = __copy_to_user((void __user *) buf, fxsave,
343 sizeof(struct user_fxsr_struct));
344 if(err) return -EFAULT;
345 else return 0;
346}
347#endif
348
349int get_fpxregs(unsigned long buf, struct task_struct *tsk)
350{
351 return(CHOOSE_MODE(get_fpxregs_tt(buf, tsk), 0));
352}
353
354#ifdef CONFIG_MODE_TT
355int set_fpxregs_tt(unsigned long buf, struct task_struct *tsk)
356{
357 struct pt_regs *regs = &tsk->thread.regs;
358 struct i387_fxsave_struct *fxsave = SC_FXSR_ENV(PT_REGS_SC(regs));
359 int err;
360
361 err = __copy_from_user(fxsave, (void __user *) buf,
362 sizeof(struct user_fxsr_struct) );
363 if(err) return -EFAULT;
364 else return 0;
365}
366#endif
367
368int set_fpxregs(unsigned long buf, struct task_struct *tsk)
369{
370 return(CHOOSE_MODE(set_fpxregs_tt(buf, tsk), 0));
371}
372
373#ifdef notdef
374int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
375{
376 fpu->cwd = (((SC_FP_CW(PT_REGS_SC(regs)) & 0xffff) << 16) |
377 (SC_FP_SW(PT_REGS_SC(regs)) & 0xffff));
378 fpu->swd = SC_FP_CSSEL(PT_REGS_SC(regs)) & 0xffff;
379 fpu->twd = SC_FP_IPOFF(PT_REGS_SC(regs));
380 fpu->fip = SC_FP_CSSEL(PT_REGS_SC(regs)) & 0xffff;
381 fpu->fcs = SC_FP_DATAOFF(PT_REGS_SC(regs));
382 fpu->foo = SC_FP_DATASEL(PT_REGS_SC(regs));
383 fpu->fos = 0;
384 memcpy(fpu->st_space, (void *) SC_FP_ST(PT_REGS_SC(regs)),
385 sizeof(fpu->st_space));
386 return(1);
387} 193}
388#endif
389 194
390#ifdef CONFIG_MODE_TT 195int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
391static inline void copy_fpu_fxsave_tt(struct pt_regs *regs,
392 struct user_i387_struct *buf)
393{ 196{
394 struct i387_fxsave_struct *fpu = SC_FXSR_ENV(PT_REGS_SC(regs)); 197 int n, cpu = ((struct thread_info *) child->stack)->cpu;
395 unsigned short *to; 198 long fpregs[HOST_XFP_SIZE];
396 unsigned short *from;
397 int i;
398 199
399 memcpy( buf, fpu, 7 * sizeof(long) ); 200 BUG_ON(sizeof(*buf) != sizeof(fpregs));
201 n = copy_from_user(fpregs, (void *) buf, sizeof(fpregs));
202 if (n > 0)
203 return -EFAULT;
400 204
401 to = (unsigned short *) &buf->st_space[0]; 205 return restore_fpx_registers(userspace_pid[cpu], fpregs);
402 from = (unsigned short *) &fpu->st_space[0];
403 for ( i = 0 ; i < 8 ; i++, to += 5, from += 8 ) {
404 memcpy( to, from, 5 * sizeof(unsigned short) );
405 }
406} 206}
407#endif
408 207
409static inline void copy_fpu_fxsave(struct pt_regs *regs, 208long subarch_ptrace(struct task_struct *child, long request, long addr,
410 struct user_i387_struct *buf) 209 long data)
411{ 210{
412 (void) CHOOSE_MODE(copy_fpu_fxsave_tt(regs, buf), 0); 211 return -EIO;
413} 212}
414
415int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu )
416{
417 copy_fpu_fxsave(regs, (struct user_i387_struct *) fpu);
418 return(1);
419}
420
421/*
422 * Overrides for Emacs so that we follow Linus's tabbing style.
423 * Emacs will notice this stuff at the end of the file and automatically
424 * adjust the settings for this buffer only. This must remain at the end
425 * of the file.
426 * ---------------------------------------------------------------------------
427 * Local variables:
428 * c-file-style: "linux"
429 * End:
430 */
diff --git a/arch/um/sys-i386/ptrace_user.c b/arch/um/sys-i386/ptrace_user.c
index 40ff0c831bd0..5cf97bc229b9 100644
--- a/arch/um/sys-i386/ptrace_user.c
+++ b/arch/um/sys-i386/ptrace_user.c
@@ -1,20 +1,10 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stdio.h>
7#include <stddef.h>
8#include <errno.h> 6#include <errno.h>
9#include <unistd.h> 7#include <sys/ptrace.h>
10#include "ptrace_user.h"
11/* Grr, asm/user.h includes asm/ptrace.h, so has to follow ptrace_user.h */
12#include <asm/user.h>
13#include "kern_util.h"
14#include "sysdep/thread.h"
15#include "user.h"
16#include "os.h"
17#include "uml-config.h"
18 8
19int ptrace_getregs(long pid, unsigned long *regs_out) 9int ptrace_getregs(long pid, unsigned long *regs_out)
20{ 10{
@@ -43,89 +33,3 @@ int ptrace_setfpregs(long pid, unsigned long *regs)
43 return -errno; 33 return -errno;
44 return 0; 34 return 0;
45} 35}
46
47#ifdef UML_CONFIG_MODE_TT
48
49static void write_debugregs(int pid, unsigned long *regs)
50{
51 struct user *dummy;
52 int nregs, i;
53
54 dummy = NULL;
55 nregs = ARRAY_SIZE(dummy->u_debugreg);
56 for(i = 0; i < nregs; i++){
57 if((i == 4) || (i == 5)) continue;
58 if(ptrace(PTRACE_POKEUSR, pid, &dummy->u_debugreg[i],
59 regs[i]) < 0)
60 printk("write_debugregs - ptrace failed on "
61 "register %d, value = 0x%lx, errno = %d\n", i,
62 regs[i], errno);
63 }
64}
65
66static void read_debugregs(int pid, unsigned long *regs)
67{
68 struct user *dummy;
69 int nregs, i;
70
71 dummy = NULL;
72 nregs = ARRAY_SIZE(dummy->u_debugreg);
73 for(i = 0; i < nregs; i++){
74 regs[i] = ptrace(PTRACE_PEEKUSR, pid,
75 &dummy->u_debugreg[i], 0);
76 }
77}
78
79/* Accessed only by the tracing thread */
80static unsigned long kernel_debugregs[8] = { [ 0 ... 7 ] = 0 };
81
82void arch_enter_kernel(void *task, int pid)
83{
84 read_debugregs(pid, TASK_DEBUGREGS(task));
85 write_debugregs(pid, kernel_debugregs);
86}
87
88void arch_leave_kernel(void *task, int pid)
89{
90 read_debugregs(pid, kernel_debugregs);
91 write_debugregs(pid, TASK_DEBUGREGS(task));
92}
93
94#ifdef UML_CONFIG_PT_PROXY
95/* Accessed only by the tracing thread */
96static int debugregs_seq;
97
98/* Only called by the ptrace proxy */
99void ptrace_pokeuser(unsigned long addr, unsigned long data)
100{
101 if((addr < offsetof(struct user, u_debugreg[0])) ||
102 (addr > offsetof(struct user, u_debugreg[7])))
103 return;
104 addr -= offsetof(struct user, u_debugreg[0]);
105 addr = addr >> 2;
106 if(kernel_debugregs[addr] == data) return;
107
108 kernel_debugregs[addr] = data;
109 debugregs_seq++;
110}
111
112static void update_debugregs_cb(void *arg)
113{
114 int pid = *((int *) arg);
115
116 write_debugregs(pid, kernel_debugregs);
117}
118
119/* Optimized out in its header when not defined */
120void update_debugregs(int seq)
121{
122 int me;
123
124 if(seq == debugregs_seq) return;
125
126 me = os_getpid();
127 initial_thread_cb(update_debugregs_cb, &me);
128}
129#endif
130
131#endif
diff --git a/arch/um/sys-i386/sigcontext.c b/arch/um/sys-i386/sigcontext.c
deleted file mode 100644
index 467d489c31cd..000000000000
--- a/arch/um/sys-i386/sigcontext.c
+++ /dev/null
@@ -1,71 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <stddef.h>
7#include <string.h>
8#include <asm/ptrace.h>
9#include <asm/sigcontext.h>
10#include "sysdep/ptrace.h"
11#include "kern_util.h"
12
13void sc_to_sc(void *to_ptr, void *from_ptr)
14{
15 struct sigcontext *to = to_ptr, *from = from_ptr;
16
17 memcpy(to, from, sizeof(*to) + sizeof(struct _fpstate));
18 if(from->fpstate != NULL)
19 to->fpstate = (struct _fpstate *) (to + 1);
20}
21
22unsigned long *sc_sigmask(void *sc_ptr)
23{
24 struct sigcontext *sc = sc_ptr;
25 return &sc->oldmask;
26}
27
28int sc_get_fpregs(unsigned long buf, void *sc_ptr)
29{
30 struct sigcontext *sc = sc_ptr;
31 struct _fpstate *from = sc->fpstate, *to = (struct _fpstate *) buf;
32 int err = 0;
33
34 if(from == NULL){
35 err |= clear_user_proc(&to->cw, sizeof(to->cw));
36 err |= clear_user_proc(&to->sw, sizeof(to->sw));
37 err |= clear_user_proc(&to->tag, sizeof(to->tag));
38 err |= clear_user_proc(&to->ipoff, sizeof(to->ipoff));
39 err |= clear_user_proc(&to->cssel, sizeof(to->cssel));
40 err |= clear_user_proc(&to->dataoff, sizeof(to->dataoff));
41 err |= clear_user_proc(&to->datasel, sizeof(to->datasel));
42 err |= clear_user_proc(&to->_st, sizeof(to->_st));
43 }
44 else {
45 err |= copy_to_user_proc(&to->cw, &from->cw, sizeof(to->cw));
46 err |= copy_to_user_proc(&to->sw, &from->sw, sizeof(to->sw));
47 err |= copy_to_user_proc(&to->tag, &from->tag,
48 sizeof(to->tag));
49 err |= copy_to_user_proc(&to->ipoff, &from->ipoff,
50 sizeof(to->ipoff));
51 err |= copy_to_user_proc(&to->cssel,& from->cssel,
52 sizeof(to->cssel));
53 err |= copy_to_user_proc(&to->dataoff, &from->dataoff,
54 sizeof(to->dataoff));
55 err |= copy_to_user_proc(&to->datasel, &from->datasel,
56 sizeof(to->datasel));
57 err |= copy_to_user_proc(to->_st, from->_st, sizeof(to->_st));
58 }
59 return(err);
60}
61
62/*
63 * Overrides for Emacs so that we follow Linus's tabbing style.
64 * Emacs will notice this stuff at the end of the file and automatically
65 * adjust the settings for this buffer only. This must remain at the end
66 * of the file.
67 * ---------------------------------------------------------------------------
68 * Local variables:
69 * c-file-style: "linux"
70 * End:
71 */
diff --git a/arch/um/sys-i386/signal.c b/arch/um/sys-i386/signal.c
index 1cbf95f6858a..0147227ce18d 100644
--- a/arch/um/sys-i386/signal.c
+++ b/arch/um/sys-i386/signal.c
@@ -1,189 +1,293 @@
1/* 1/*
2 * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2004 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/signal.h"
7#include "linux/ptrace.h" 6#include "linux/ptrace.h"
8#include "asm/current.h"
9#include "asm/ucontext.h"
10#include "asm/uaccess.h"
11#include "asm/unistd.h" 7#include "asm/unistd.h"
8#include "asm/uaccess.h"
9#include "asm/ucontext.h"
12#include "frame_kern.h" 10#include "frame_kern.h"
13#include "sigcontext.h"
14#include "registers.h"
15#include "mode.h"
16
17#ifdef CONFIG_MODE_SKAS
18
19#include "skas.h" 11#include "skas.h"
20 12
21void copy_sc(union uml_pt_regs *regs, void *from) 13void copy_sc(struct uml_pt_regs *regs, void *from)
22{ 14{
23 struct sigcontext *sc = from; 15 struct sigcontext *sc = from;
24 16
25 REGS_GS(regs->skas.regs) = sc->gs; 17 REGS_GS(regs->gp) = sc->gs;
26 REGS_FS(regs->skas.regs) = sc->fs; 18 REGS_FS(regs->gp) = sc->fs;
27 REGS_ES(regs->skas.regs) = sc->es; 19 REGS_ES(regs->gp) = sc->es;
28 REGS_DS(regs->skas.regs) = sc->ds; 20 REGS_DS(regs->gp) = sc->ds;
29 REGS_EDI(regs->skas.regs) = sc->edi; 21 REGS_EDI(regs->gp) = sc->edi;
30 REGS_ESI(regs->skas.regs) = sc->esi; 22 REGS_ESI(regs->gp) = sc->esi;
31 REGS_EBP(regs->skas.regs) = sc->ebp; 23 REGS_EBP(regs->gp) = sc->ebp;
32 REGS_SP(regs->skas.regs) = sc->esp; 24 REGS_SP(regs->gp) = sc->esp;
33 REGS_EBX(regs->skas.regs) = sc->ebx; 25 REGS_EBX(regs->gp) = sc->ebx;
34 REGS_EDX(regs->skas.regs) = sc->edx; 26 REGS_EDX(regs->gp) = sc->edx;
35 REGS_ECX(regs->skas.regs) = sc->ecx; 27 REGS_ECX(regs->gp) = sc->ecx;
36 REGS_EAX(regs->skas.regs) = sc->eax; 28 REGS_EAX(regs->gp) = sc->eax;
37 REGS_IP(regs->skas.regs) = sc->eip; 29 REGS_IP(regs->gp) = sc->eip;
38 REGS_CS(regs->skas.regs) = sc->cs; 30 REGS_CS(regs->gp) = sc->cs;
39 REGS_EFLAGS(regs->skas.regs) = sc->eflags; 31 REGS_EFLAGS(regs->gp) = sc->eflags;
40 REGS_SS(regs->skas.regs) = sc->ss; 32 REGS_SS(regs->gp) = sc->ss;
41} 33}
42 34
43static int copy_sc_from_user_skas(struct pt_regs *regs, 35/*
44 struct sigcontext __user *from) 36 * FPU tag word conversions.
37 */
38
39static inline unsigned short twd_i387_to_fxsr(unsigned short twd)
45{ 40{
46 struct sigcontext sc; 41 unsigned int tmp; /* to avoid 16 bit prefixes in the code */
47 unsigned long fpregs[HOST_FP_SIZE]; 42
48 int err; 43 /* Transform each pair of bits into 01 (valid) or 00 (empty) */
44 tmp = ~twd;
45 tmp = (tmp | (tmp>>1)) & 0x5555; /* 0V0V0V0V0V0V0V0V */
46 /* and move the valid bits to the lower byte. */
47 tmp = (tmp | (tmp >> 1)) & 0x3333; /* 00VV00VV00VV00VV */
48 tmp = (tmp | (tmp >> 2)) & 0x0f0f; /* 0000VVVV0000VVVV */
49 tmp = (tmp | (tmp >> 4)) & 0x00ff; /* 00000000VVVVVVVV */
50 return tmp;
51}
49 52
50 err = copy_from_user(&sc, from, sizeof(sc)); 53static inline unsigned long twd_fxsr_to_i387(struct user_fxsr_struct *fxsave)
51 err |= copy_from_user(fpregs, sc.fpstate, sizeof(fpregs)); 54{
52 if(err) 55 struct _fpxreg *st = NULL;
53 return err; 56 unsigned long twd = (unsigned long) fxsave->twd;
57 unsigned long tag;
58 unsigned long ret = 0xffff0000;
59 int i;
60
61#define FPREG_ADDR(f, n) ((char *)&(f)->st_space + (n) * 16);
62
63 for (i = 0; i < 8; i++) {
64 if (twd & 0x1) {
65 st = (struct _fpxreg *) FPREG_ADDR(fxsave, i);
66
67 switch (st->exponent & 0x7fff) {
68 case 0x7fff:
69 tag = 2; /* Special */
70 break;
71 case 0x0000:
72 if ( !st->significand[0] &&
73 !st->significand[1] &&
74 !st->significand[2] &&
75 !st->significand[3] ) {
76 tag = 1; /* Zero */
77 } else {
78 tag = 2; /* Special */
79 }
80 break;
81 default:
82 if (st->significand[3] & 0x8000) {
83 tag = 0; /* Valid */
84 } else {
85 tag = 2; /* Special */
86 }
87 break;
88 }
89 } else {
90 tag = 3; /* Empty */
91 }
92 ret |= (tag << (2 * i));
93 twd = twd >> 1;
94 }
95 return ret;
96}
54 97
55 copy_sc(&regs->regs, &sc); 98static int convert_fxsr_to_user(struct _fpstate __user *buf,
99 struct user_fxsr_struct *fxsave)
100{
101 unsigned long env[7];
102 struct _fpreg __user *to;
103 struct _fpxreg *from;
104 int i;
105
106 env[0] = (unsigned long)fxsave->cwd | 0xffff0000ul;
107 env[1] = (unsigned long)fxsave->swd | 0xffff0000ul;
108 env[2] = twd_fxsr_to_i387(fxsave);
109 env[3] = fxsave->fip;
110 env[4] = fxsave->fcs | ((unsigned long)fxsave->fop << 16);
111 env[5] = fxsave->foo;
112 env[6] = fxsave->fos;
113
114 if (__copy_to_user(buf, env, 7 * sizeof(unsigned long)))
115 return 1;
56 116
57 err = restore_fp_registers(userspace_pid[0], fpregs); 117 to = &buf->_st[0];
58 if(err < 0) { 118 from = (struct _fpxreg *) &fxsave->st_space[0];
59 printk("copy_sc_from_user_skas - PTRACE_SETFPREGS failed, " 119 for (i = 0; i < 8; i++, to++, from++) {
60 "errno = %d\n", -err); 120 unsigned long __user *t = (unsigned long __user *)to;
61 return err; 121 unsigned long *f = (unsigned long *)from;
62 }
63 122
123 if (__put_user(*f, t) ||
124 __put_user(*(f + 1), t + 1) ||
125 __put_user(from->exponent, &to->exponent))
126 return 1;
127 }
64 return 0; 128 return 0;
65} 129}
66 130
67int copy_sc_to_user_skas(struct sigcontext __user *to, struct _fpstate __user *to_fp, 131static int convert_fxsr_from_user(struct user_fxsr_struct *fxsave,
68 struct pt_regs *regs, unsigned long sp) 132 struct _fpstate __user *buf)
69{ 133{
70 struct sigcontext sc; 134 unsigned long env[7];
71 unsigned long fpregs[HOST_FP_SIZE]; 135 struct _fpxreg *to;
72 struct faultinfo * fi = &current->thread.arch.faultinfo; 136 struct _fpreg __user *from;
73 int err; 137 int i;
74 138
75 sc.gs = REGS_GS(regs->regs.skas.regs); 139 if (copy_from_user( env, buf, 7 * sizeof(long)))
76 sc.fs = REGS_FS(regs->regs.skas.regs);
77 sc.es = REGS_ES(regs->regs.skas.regs);
78 sc.ds = REGS_DS(regs->regs.skas.regs);
79 sc.edi = REGS_EDI(regs->regs.skas.regs);
80 sc.esi = REGS_ESI(regs->regs.skas.regs);
81 sc.ebp = REGS_EBP(regs->regs.skas.regs);
82 sc.esp = sp;
83 sc.ebx = REGS_EBX(regs->regs.skas.regs);
84 sc.edx = REGS_EDX(regs->regs.skas.regs);
85 sc.ecx = REGS_ECX(regs->regs.skas.regs);
86 sc.eax = REGS_EAX(regs->regs.skas.regs);
87 sc.eip = REGS_IP(regs->regs.skas.regs);
88 sc.cs = REGS_CS(regs->regs.skas.regs);
89 sc.eflags = REGS_EFLAGS(regs->regs.skas.regs);
90 sc.esp_at_signal = regs->regs.skas.regs[UESP];
91 sc.ss = regs->regs.skas.regs[SS];
92 sc.cr2 = fi->cr2;
93 sc.err = fi->error_code;
94 sc.trapno = fi->trap_no;
95
96 err = save_fp_registers(userspace_pid[0], fpregs);
97 if(err < 0){
98 printk("copy_sc_to_user_skas - PTRACE_GETFPREGS failed, "
99 "errno = %d\n", err);
100 return 1; 140 return 1;
101 }
102 to_fp = (to_fp ? to_fp : (struct _fpstate __user *) (to + 1));
103 sc.fpstate = to_fp;
104 141
105 if(err) 142 fxsave->cwd = (unsigned short)(env[0] & 0xffff);
106 return err; 143 fxsave->swd = (unsigned short)(env[1] & 0xffff);
107 144 fxsave->twd = twd_i387_to_fxsr((unsigned short)(env[2] & 0xffff));
108 return copy_to_user(to, &sc, sizeof(sc)) || 145 fxsave->fip = env[3];
109 copy_to_user(to_fp, fpregs, sizeof(fpregs)); 146 fxsave->fop = (unsigned short)((env[4] & 0xffff0000ul) >> 16);
147 fxsave->fcs = (env[4] & 0xffff);
148 fxsave->foo = env[5];
149 fxsave->fos = env[6];
150
151 to = (struct _fpxreg *) &fxsave->st_space[0];
152 from = &buf->_st[0];
153 for (i = 0; i < 8; i++, to++, from++) {
154 unsigned long *t = (unsigned long *)to;
155 unsigned long __user *f = (unsigned long __user *)from;
156
157 if (__get_user(*t, f) ||
158 __get_user(*(t + 1), f + 1) ||
159 __get_user(to->exponent, &from->exponent))
160 return 1;
161 }
162 return 0;
110} 163}
111#endif
112 164
113#ifdef CONFIG_MODE_TT 165extern int have_fpx_regs;
114 166
115/* These copy a sigcontext to/from userspace. They copy the fpstate pointer, 167static int copy_sc_from_user(struct pt_regs *regs,
116 * blowing away the old, good one. So, that value is saved, and then restored 168 struct sigcontext __user *from)
117 * after the sigcontext copy. In copy_from, the variable holding the saved
118 * fpstate pointer, and the sigcontext that it should be restored to are both
119 * in the kernel, so we can just restore using an assignment. In copy_to, the
120 * saved pointer is in the kernel, but the sigcontext is in userspace, so we
121 * copy_to_user it.
122 */
123int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext __user *from,
124 int fpsize)
125{ 169{
126 struct _fpstate *to_fp; 170 struct sigcontext sc;
127 struct _fpstate __user *from_fp;
128 unsigned long sigs;
129 int err; 171 int err;
130 172
131 to_fp = to->fpstate; 173 err = copy_from_user(&sc, from, sizeof(sc));
132 sigs = to->oldmask; 174 if (err)
133 err = copy_from_user(to, from, sizeof(*to)); 175 return err;
134 from_fp = to->fpstate; 176
135 to->oldmask = sigs; 177 copy_sc(&regs->regs, &sc);
136 to->fpstate = to_fp; 178 if (have_fpx_regs) {
137 if(to_fp != NULL) 179 struct user_fxsr_struct fpx;
138 err |= copy_from_user(to_fp, from_fp, fpsize); 180
139 return err; 181 err = copy_from_user(&fpx, &sc.fpstate->_fxsr_env[0],
182 sizeof(struct user_fxsr_struct));
183 if (err)
184 return 1;
185
186 err = convert_fxsr_from_user(&fpx, sc.fpstate);
187 if (err)
188 return 1;
189
190 err = restore_fpx_registers(userspace_pid[current_thread->cpu],
191 (unsigned long *) &fpx);
192 if (err < 0) {
193 printk(KERN_ERR "copy_sc_from_user - "
194 "restore_fpx_registers failed, errno = %d\n",
195 -err);
196 return 1;
197 }
198 }
199 else {
200 struct user_i387_struct fp;
201
202 err = copy_from_user(&fp, sc.fpstate,
203 sizeof(struct user_i387_struct));
204 if (err)
205 return 1;
206
207 err = restore_fp_registers(userspace_pid[current_thread->cpu],
208 (unsigned long *) &fp);
209 if (err < 0) {
210 printk(KERN_ERR "copy_sc_from_user - "
211 "restore_fp_registers failed, errno = %d\n",
212 -err);
213 return 1;
214 }
215 }
216
217 return 0;
140} 218}
141 219
142int copy_sc_to_user_tt(struct sigcontext __user *to, struct _fpstate __user *fp, 220static int copy_sc_to_user(struct sigcontext __user *to,
143 struct sigcontext *from, int fpsize, unsigned long sp) 221 struct _fpstate __user *to_fp, struct pt_regs *regs,
222 unsigned long sp)
144{ 223{
145 struct _fpstate __user *to_fp; 224 struct sigcontext sc;
146 struct _fpstate *from_fp; 225 struct faultinfo * fi = &current->thread.arch.faultinfo;
147 int err; 226 int err;
148 227
149 to_fp = (fp ? fp : (struct _fpstate __user *) (to + 1)); 228 sc.gs = REGS_GS(regs->regs.gp);
150 from_fp = from->fpstate; 229 sc.fs = REGS_FS(regs->regs.gp);
151 err = copy_to_user(to, from, sizeof(*to)); 230 sc.es = REGS_ES(regs->regs.gp);
231 sc.ds = REGS_DS(regs->regs.gp);
232 sc.edi = REGS_EDI(regs->regs.gp);
233 sc.esi = REGS_ESI(regs->regs.gp);
234 sc.ebp = REGS_EBP(regs->regs.gp);
235 sc.esp = sp;
236 sc.ebx = REGS_EBX(regs->regs.gp);
237 sc.edx = REGS_EDX(regs->regs.gp);
238 sc.ecx = REGS_ECX(regs->regs.gp);
239 sc.eax = REGS_EAX(regs->regs.gp);
240 sc.eip = REGS_IP(regs->regs.gp);
241 sc.cs = REGS_CS(regs->regs.gp);
242 sc.eflags = REGS_EFLAGS(regs->regs.gp);
243 sc.esp_at_signal = regs->regs.gp[UESP];
244 sc.ss = regs->regs.gp[SS];
245 sc.cr2 = fi->cr2;
246 sc.err = fi->error_code;
247 sc.trapno = fi->trap_no;
152 248
153 /* The SP in the sigcontext is the updated one for the signal 249 to_fp = (to_fp ? to_fp : (struct _fpstate __user *) (to + 1));
154 * delivery. The sp passed in is the original, and this needs 250 sc.fpstate = to_fp;
155 * to be restored, so we stick it in separately.
156 */
157 err |= copy_to_user(&SC_SP(to), &sp, sizeof(sp));
158 251
159 if(from_fp != NULL){ 252 if (have_fpx_regs) {
160 err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate)); 253 struct user_fxsr_struct fpx;
161 err |= copy_to_user(to_fp, from_fp, fpsize); 254
255 err = save_fpx_registers(userspace_pid[current_thread->cpu],
256 (unsigned long *) &fpx);
257 if (err < 0){
258 printk(KERN_ERR "copy_sc_to_user - save_fpx_registers "
259 "failed, errno = %d\n", err);
260 return 1;
261 }
262
263 err = convert_fxsr_to_user(to_fp, &fpx);
264 if (err)
265 return 1;
266
267 err |= __put_user(fpx.swd, &to_fp->status);
268 err |= __put_user(X86_FXSR_MAGIC, &to_fp->magic);
269 if (err)
270 return 1;
271
272 if (copy_to_user(&to_fp->_fxsr_env[0], &fpx,
273 sizeof(struct user_fxsr_struct)))
274 return 1;
162 } 275 }
163 return err; 276 else {
164} 277 struct user_i387_struct fp;
165#endif
166
167static int copy_sc_from_user(struct pt_regs *to, void __user *from)
168{
169 int ret;
170 278
171 ret = CHOOSE_MODE(copy_sc_from_user_tt(UPT_SC(&to->regs), from, 279 err = save_fp_registers(userspace_pid[current_thread->cpu],
172 sizeof(struct _fpstate)), 280 (unsigned long *) &fp);
173 copy_sc_from_user_skas(to, from)); 281 if (copy_to_user(to_fp, &fp, sizeof(struct user_i387_struct)))
174 return ret; 282 return 1;
175} 283 }
176 284
177static int copy_sc_to_user(struct sigcontext __user *to, struct _fpstate __user *fp, 285 return copy_to_user(to, &sc, sizeof(sc));
178 struct pt_regs *from, unsigned long sp)
179{
180 return CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs),
181 sizeof(*fp), sp),
182 copy_sc_to_user_skas(to, fp, from, sp));
183} 286}
184 287
185static int copy_ucontext_to_user(struct ucontext __user *uc, struct _fpstate __user *fp, 288static int copy_ucontext_to_user(struct ucontext __user *uc,
186 sigset_t *set, unsigned long sp) 289 struct _fpstate __user *fp, sigset_t *set,
290 unsigned long sp)
187{ 291{
188 int err = 0; 292 int err = 0;
189 293
@@ -233,7 +337,7 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
233 return 1; 337 return 1;
234 338
235 restorer = frame->retcode; 339 restorer = frame->retcode;
236 if(ka->sa.sa_flags & SA_RESTORER) 340 if (ka->sa.sa_flags & SA_RESTORER)
237 restorer = ka->sa.sa_restorer; 341 restorer = ka->sa.sa_restorer;
238 342
239 /* Update SP now because the page fault handler refuses to extend 343 /* Update SP now because the page fault handler refuses to extend
@@ -265,7 +369,7 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
265 err |= __put_user(__NR_sigreturn, (int __user *)(frame->retcode+2)); 369 err |= __put_user(__NR_sigreturn, (int __user *)(frame->retcode+2));
266 err |= __put_user(0x80cd, (short __user *)(frame->retcode+6)); 370 err |= __put_user(0x80cd, (short __user *)(frame->retcode+6));
267 371
268 if(err) 372 if (err)
269 goto err; 373 goto err;
270 374
271 PT_REGS_SP(regs) = (unsigned long) frame; 375 PT_REGS_SP(regs) = (unsigned long) frame;
@@ -298,7 +402,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
298 return 1; 402 return 1;
299 403
300 restorer = frame->retcode; 404 restorer = frame->retcode;
301 if(ka->sa.sa_flags & SA_RESTORER) 405 if (ka->sa.sa_flags & SA_RESTORER)
302 restorer = ka->sa.sa_restorer; 406 restorer = ka->sa.sa_restorer;
303 407
304 /* See comment above about why this is here */ 408 /* See comment above about why this is here */
@@ -323,7 +427,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
323 err |= __put_user(__NR_rt_sigreturn, (int __user *)(frame->retcode+1)); 427 err |= __put_user(__NR_rt_sigreturn, (int __user *)(frame->retcode+1));
324 err |= __put_user(0x80cd, (short __user *)(frame->retcode+5)); 428 err |= __put_user(0x80cd, (short __user *)(frame->retcode+5));
325 429
326 if(err) 430 if (err)
327 goto err; 431 goto err;
328 432
329 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler; 433 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler;
@@ -350,8 +454,8 @@ long sys_sigreturn(struct pt_regs regs)
350 unsigned long __user *extramask = frame->extramask; 454 unsigned long __user *extramask = frame->extramask;
351 int sig_size = (_NSIG_WORDS - 1) * sizeof(unsigned long); 455 int sig_size = (_NSIG_WORDS - 1) * sizeof(unsigned long);
352 456
353 if(copy_from_user(&set.sig[0], oldmask, sizeof(set.sig[0])) || 457 if (copy_from_user(&set.sig[0], oldmask, sizeof(set.sig[0])) ||
354 copy_from_user(&set.sig[1], extramask, sig_size)) 458 copy_from_user(&set.sig[1], extramask, sig_size))
355 goto segfault; 459 goto segfault;
356 460
357 sigdelsetmask(&set, ~_BLOCKABLE); 461 sigdelsetmask(&set, ~_BLOCKABLE);
@@ -361,7 +465,7 @@ long sys_sigreturn(struct pt_regs regs)
361 recalc_sigpending(); 465 recalc_sigpending();
362 spin_unlock_irq(&current->sighand->siglock); 466 spin_unlock_irq(&current->sighand->siglock);
363 467
364 if(copy_sc_from_user(&current->thread.regs, sc)) 468 if (copy_sc_from_user(&current->thread.regs, sc))
365 goto segfault; 469 goto segfault;
366 470
367 /* Avoid ERESTART handling */ 471 /* Avoid ERESTART handling */
@@ -376,12 +480,13 @@ long sys_sigreturn(struct pt_regs regs)
376long sys_rt_sigreturn(struct pt_regs regs) 480long sys_rt_sigreturn(struct pt_regs regs)
377{ 481{
378 unsigned long sp = PT_REGS_SP(&current->thread.regs); 482 unsigned long sp = PT_REGS_SP(&current->thread.regs);
379 struct rt_sigframe __user *frame = (struct rt_sigframe __user *) (sp - 4); 483 struct rt_sigframe __user *frame =
484 (struct rt_sigframe __user *) (sp - 4);
380 sigset_t set; 485 sigset_t set;
381 struct ucontext __user *uc = &frame->uc; 486 struct ucontext __user *uc = &frame->uc;
382 int sig_size = _NSIG_WORDS * sizeof(unsigned long); 487 int sig_size = _NSIG_WORDS * sizeof(unsigned long);
383 488
384 if(copy_from_user(&set, &uc->uc_sigmask, sig_size)) 489 if (copy_from_user(&set, &uc->uc_sigmask, sig_size))
385 goto segfault; 490 goto segfault;
386 491
387 sigdelsetmask(&set, ~_BLOCKABLE); 492 sigdelsetmask(&set, ~_BLOCKABLE);
@@ -391,7 +496,7 @@ long sys_rt_sigreturn(struct pt_regs regs)
391 recalc_sigpending(); 496 recalc_sigpending();
392 spin_unlock_irq(&current->sighand->siglock); 497 spin_unlock_irq(&current->sighand->siglock);
393 498
394 if(copy_sc_from_user(&current->thread.regs, &uc->uc_mcontext)) 499 if (copy_sc_from_user(&current->thread.regs, &uc->uc_mcontext))
395 goto segfault; 500 goto segfault;
396 501
397 /* Avoid ERESTART handling */ 502 /* Avoid ERESTART handling */
diff --git a/arch/um/sys-i386/stub.S b/arch/um/sys-i386/stub.S
index 6a70d9ab5c29..e730772c401b 100644
--- a/arch/um/sys-i386/stub.S
+++ b/arch/um/sys-i386/stub.S
@@ -1,4 +1,5 @@
1#include "uml-config.h" 1#include "uml-config.h"
2#include "as-layout.h"
2 3
3 .globl syscall_stub 4 .globl syscall_stub
4.section .__syscall_stub, "x" 5.section .__syscall_stub, "x"
@@ -6,7 +7,7 @@
6 .globl batch_syscall_stub 7 .globl batch_syscall_stub
7batch_syscall_stub: 8batch_syscall_stub:
8 /* load pointer to first operation */ 9 /* load pointer to first operation */
9 mov $(UML_CONFIG_STUB_DATA+8), %esp 10 mov $(ASM_STUB_DATA+8), %esp
10 11
11again: 12again:
12 /* load length of additional data */ 13 /* load length of additional data */
@@ -14,12 +15,12 @@ again:
14 15
15 /* if(length == 0) : end of list */ 16 /* if(length == 0) : end of list */
16 /* write possible 0 to header */ 17 /* write possible 0 to header */
17 mov %eax, UML_CONFIG_STUB_DATA+4 18 mov %eax, ASM_STUB_DATA+4
18 cmpl $0, %eax 19 cmpl $0, %eax
19 jz done 20 jz done
20 21
21 /* save current pointer */ 22 /* save current pointer */
22 mov %esp, UML_CONFIG_STUB_DATA+4 23 mov %esp, ASM_STUB_DATA+4
23 24
24 /* skip additional data */ 25 /* skip additional data */
25 add %eax, %esp 26 add %eax, %esp
@@ -45,7 +46,7 @@ again:
45 46
46done: 47done:
47 /* save return value */ 48 /* save return value */
48 mov %eax, UML_CONFIG_STUB_DATA 49 mov %eax, ASM_STUB_DATA
49 50
50 /* stop */ 51 /* stop */
51 int3 52 int3
diff --git a/arch/um/sys-i386/stub_segv.c b/arch/um/sys-i386/stub_segv.c
index 2355dc19c46c..b3999cb76bfd 100644
--- a/arch/um/sys-i386/stub_segv.c
+++ b/arch/um/sys-i386/stub_segv.c
@@ -6,6 +6,7 @@
6#include <signal.h> 6#include <signal.h>
7#include <sys/select.h> /* The only way I can see to get sigset_t */ 7#include <sys/select.h> /* The only way I can see to get sigset_t */
8#include <asm/unistd.h> 8#include <asm/unistd.h>
9#include "as-layout.h"
9#include "uml-config.h" 10#include "uml-config.h"
10#include "sysdep/stub.h" 11#include "sysdep/stub.h"
11#include "sysdep/sigcontext.h" 12#include "sysdep/sigcontext.h"
@@ -17,8 +18,7 @@ stub_segv_handler(int sig)
17 struct sigcontext *sc = (struct sigcontext *) (&sig + 1); 18 struct sigcontext *sc = (struct sigcontext *) (&sig + 1);
18 int pid; 19 int pid;
19 20
20 GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA), 21 GET_FAULTINFO_FROM_SC(*((struct faultinfo *) STUB_DATA), sc);
21 sc);
22 22
23 pid = stub_syscall0(__NR_getpid); 23 pid = stub_syscall0(__NR_getpid);
24 stub_syscall2(__NR_kill, pid, SIGUSR1); 24 stub_syscall2(__NR_kill, pid, SIGUSR1);
diff --git a/arch/um/sys-i386/tls.c b/arch/um/sys-i386/tls.c
index fea8e5e15cc4..b02266ab5c55 100644
--- a/arch/um/sys-i386/tls.c
+++ b/arch/um/sys-i386/tls.c
@@ -3,25 +3,12 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/kernel.h" 6#include "linux/percpu.h"
7#include "linux/sched.h" 7#include "linux/sched.h"
8#include "linux/slab.h"
9#include "linux/types.h"
10#include "asm/uaccess.h" 8#include "asm/uaccess.h"
11#include "asm/ptrace.h"
12#include "asm/segment.h"
13#include "asm/smp.h"
14#include "asm/desc.h"
15#include "choose-mode.h"
16#include "kern.h"
17#include "kern_util.h"
18#include "mode_kern.h"
19#include "os.h" 9#include "os.h"
20#include "mode.h"
21
22#ifdef CONFIG_MODE_SKAS
23#include "skas.h" 10#include "skas.h"
24#endif 11#include "sysdep/tls.h"
25 12
26/* 13/*
27 * If needed we can detect when it's uninitialized. 14 * If needed we can detect when it's uninitialized.
@@ -31,8 +18,7 @@
31static int host_supports_tls = -1; 18static int host_supports_tls = -1;
32int host_gdt_entry_tls_min; 19int host_gdt_entry_tls_min;
33 20
34#ifdef CONFIG_MODE_SKAS 21int do_set_thread_area(struct user_desc *info)
35int do_set_thread_area_skas(struct user_desc *info)
36{ 22{
37 int ret; 23 int ret;
38 u32 cpu; 24 u32 cpu;
@@ -43,7 +29,7 @@ int do_set_thread_area_skas(struct user_desc *info)
43 return ret; 29 return ret;
44} 30}
45 31
46int do_get_thread_area_skas(struct user_desc *info) 32int do_get_thread_area(struct user_desc *info)
47{ 33{
48 int ret; 34 int ret;
49 u32 cpu; 35 u32 cpu;
@@ -53,7 +39,6 @@ int do_get_thread_area_skas(struct user_desc *info)
53 put_cpu(); 39 put_cpu();
54 return ret; 40 return ret;
55} 41}
56#endif
57 42
58/* 43/*
59 * sys_get_thread_area: get a yet unused TLS descriptor index. 44 * sys_get_thread_area: get a yet unused TLS descriptor index.
@@ -82,7 +67,8 @@ static inline void clear_user_desc(struct user_desc* info)
82 /* Postcondition: LDT_empty(info) returns true. */ 67 /* Postcondition: LDT_empty(info) returns true. */
83 memset(info, 0, sizeof(*info)); 68 memset(info, 0, sizeof(*info));
84 69
85 /* Check the LDT_empty or the i386 sys_get_thread_area code - we obtain 70 /*
71 * Check the LDT_empty or the i386 sys_get_thread_area code - we obtain
86 * indeed an empty user_desc. 72 * indeed an empty user_desc.
87 */ 73 */
88 info->read_exec_only = 1; 74 info->read_exec_only = 1;
@@ -97,10 +83,13 @@ static int load_TLS(int flags, struct task_struct *to)
97 int idx; 83 int idx;
98 84
99 for (idx = GDT_ENTRY_TLS_MIN; idx < GDT_ENTRY_TLS_MAX; idx++) { 85 for (idx = GDT_ENTRY_TLS_MIN; idx < GDT_ENTRY_TLS_MAX; idx++) {
100 struct uml_tls_struct* curr = &to->thread.arch.tls_array[idx - GDT_ENTRY_TLS_MIN]; 86 struct uml_tls_struct* curr =
87 &to->thread.arch.tls_array[idx - GDT_ENTRY_TLS_MIN];
101 88
102 /* Actually, now if it wasn't flushed it gets cleared and 89 /*
103 * flushed to the host, which will clear it.*/ 90 * Actually, now if it wasn't flushed it gets cleared and
91 * flushed to the host, which will clear it.
92 */
104 if (!curr->present) { 93 if (!curr->present) {
105 if (!curr->flushed) { 94 if (!curr->flushed) {
106 clear_user_desc(&curr->tls); 95 clear_user_desc(&curr->tls);
@@ -124,7 +113,8 @@ out:
124 return ret; 113 return ret;
125} 114}
126 115
127/* Verify if we need to do a flush for the new process, i.e. if there are any 116/*
117 * Verify if we need to do a flush for the new process, i.e. if there are any
128 * present desc's, only if they haven't been flushed. 118 * present desc's, only if they haven't been flushed.
129 */ 119 */
130static inline int needs_TLS_update(struct task_struct *task) 120static inline int needs_TLS_update(struct task_struct *task)
@@ -133,10 +123,13 @@ static inline int needs_TLS_update(struct task_struct *task)
133 int ret = 0; 123 int ret = 0;
134 124
135 for (i = GDT_ENTRY_TLS_MIN; i < GDT_ENTRY_TLS_MAX; i++) { 125 for (i = GDT_ENTRY_TLS_MIN; i < GDT_ENTRY_TLS_MAX; i++) {
136 struct uml_tls_struct* curr = &task->thread.arch.tls_array[i - GDT_ENTRY_TLS_MIN]; 126 struct uml_tls_struct* curr =
127 &task->thread.arch.tls_array[i - GDT_ENTRY_TLS_MIN];
137 128
138 /* Can't test curr->present, we may need to clear a descriptor 129 /*
139 * which had a value. */ 130 * Can't test curr->present, we may need to clear a descriptor
131 * which had a value.
132 */
140 if (curr->flushed) 133 if (curr->flushed)
141 continue; 134 continue;
142 ret = 1; 135 ret = 1;
@@ -145,7 +138,8 @@ static inline int needs_TLS_update(struct task_struct *task)
145 return ret; 138 return ret;
146} 139}
147 140
148/* On a newly forked process, the TLS descriptors haven't yet been flushed. So 141/*
142 * On a newly forked process, the TLS descriptors haven't yet been flushed. So
149 * we mark them as such and the first switch_to will do the job. 143 * we mark them as such and the first switch_to will do the job.
150 */ 144 */
151void clear_flushed_tls(struct task_struct *task) 145void clear_flushed_tls(struct task_struct *task)
@@ -153,10 +147,13 @@ void clear_flushed_tls(struct task_struct *task)
153 int i; 147 int i;
154 148
155 for (i = GDT_ENTRY_TLS_MIN; i < GDT_ENTRY_TLS_MAX; i++) { 149 for (i = GDT_ENTRY_TLS_MIN; i < GDT_ENTRY_TLS_MAX; i++) {
156 struct uml_tls_struct* curr = &task->thread.arch.tls_array[i - GDT_ENTRY_TLS_MIN]; 150 struct uml_tls_struct* curr =
151 &task->thread.arch.tls_array[i - GDT_ENTRY_TLS_MIN];
157 152
158 /* Still correct to do this, if it wasn't present on the host it 153 /*
159 * will remain as flushed as it was. */ 154 * Still correct to do this, if it wasn't present on the host it
155 * will remain as flushed as it was.
156 */
160 if (!curr->present) 157 if (!curr->present)
161 continue; 158 continue;
162 159
@@ -164,40 +161,33 @@ void clear_flushed_tls(struct task_struct *task)
164 } 161 }
165} 162}
166 163
167/* In SKAS0 mode, currently, multiple guest threads sharing the same ->mm have a 164/*
165 * In SKAS0 mode, currently, multiple guest threads sharing the same ->mm have a
168 * common host process. So this is needed in SKAS0 too. 166 * common host process. So this is needed in SKAS0 too.
169 * 167 *
170 * However, if each thread had a different host process (and this was discussed 168 * However, if each thread had a different host process (and this was discussed
171 * for SMP support) this won't be needed. 169 * for SMP support) this won't be needed.
172 * 170 *
173 * And this will not need be used when (and if) we'll add support to the host 171 * And this will not need be used when (and if) we'll add support to the host
174 * SKAS patch. */ 172 * SKAS patch.
173 */
175 174
176int arch_switch_tls_skas(struct task_struct *from, struct task_struct *to) 175int arch_switch_tls(struct task_struct *from, struct task_struct *to)
177{ 176{
178 if (!host_supports_tls) 177 if (!host_supports_tls)
179 return 0; 178 return 0;
180 179
181 /* We have no need whatsoever to switch TLS for kernel threads; beyond 180 /*
181 * We have no need whatsoever to switch TLS for kernel threads; beyond
182 * that, that would also result in us calling os_set_thread_area with 182 * that, that would also result in us calling os_set_thread_area with
183 * userspace_pid[cpu] == 0, which gives an error. */ 183 * userspace_pid[cpu] == 0, which gives an error.
184 */
184 if (likely(to->mm)) 185 if (likely(to->mm))
185 return load_TLS(O_FORCE, to); 186 return load_TLS(O_FORCE, to);
186 187
187 return 0; 188 return 0;
188} 189}
189 190
190int arch_switch_tls_tt(struct task_struct *from, struct task_struct *to)
191{
192 if (!host_supports_tls)
193 return 0;
194
195 if (needs_TLS_update(to))
196 return load_TLS(0, to);
197
198 return 0;
199}
200
201static int set_tls_entry(struct task_struct* task, struct user_desc *info, 191static int set_tls_entry(struct task_struct* task, struct user_desc *info,
202 int idx, int flushed) 192 int idx, int flushed)
203{ 193{
@@ -251,17 +241,20 @@ static int get_tls_entry(struct task_struct* task, struct user_desc *info, int i
251 *info = t->arch.tls_array[idx - GDT_ENTRY_TLS_MIN].tls; 241 *info = t->arch.tls_array[idx - GDT_ENTRY_TLS_MIN].tls;
252 242
253out: 243out:
254 /* Temporary debugging check, to make sure that things have been 244 /*
245 * Temporary debugging check, to make sure that things have been
255 * flushed. This could be triggered if load_TLS() failed. 246 * flushed. This could be triggered if load_TLS() failed.
256 */ 247 */
257 if (unlikely(task == current && !t->arch.tls_array[idx - GDT_ENTRY_TLS_MIN].flushed)) { 248 if (unlikely(task == current &&
249 !t->arch.tls_array[idx - GDT_ENTRY_TLS_MIN].flushed)) {
258 printk(KERN_ERR "get_tls_entry: task with pid %d got here " 250 printk(KERN_ERR "get_tls_entry: task with pid %d got here "
259 "without flushed TLS.", current->pid); 251 "without flushed TLS.", current->pid);
260 } 252 }
261 253
262 return 0; 254 return 0;
263clear: 255clear:
264 /* When the TLS entry has not been set, the values read to user in the 256 /*
257 * When the TLS entry has not been set, the values read to user in the
265 * tls_array are 0 (because it's cleared at boot, see 258 * tls_array are 0 (because it's cleared at boot, see
266 * arch/i386/kernel/head.S:cpu_gdt_table). Emulate that. 259 * arch/i386/kernel/head.S:cpu_gdt_table). Emulate that.
267 */ 260 */
@@ -293,7 +286,7 @@ asmlinkage int sys_set_thread_area(struct user_desc __user *user_desc)
293 return -EFAULT; 286 return -EFAULT;
294 } 287 }
295 288
296 ret = CHOOSE_MODE_PROC(do_set_thread_area_tt, do_set_thread_area_skas, &info); 289 ret = do_set_thread_area(&info);
297 if (ret) 290 if (ret)
298 return ret; 291 return ret;
299 return set_tls_entry(current, &info, idx, 1); 292 return set_tls_entry(current, &info, idx, 1);
@@ -363,8 +356,10 @@ out:
363} 356}
364 357
365 358
366/* XXX: This part is probably common to i386 and x86-64. Don't create a common 359/*
367 * file for now, do that when implementing x86-64 support.*/ 360 * XXX: This part is probably common to i386 and x86-64. Don't create a common
361 * file for now, do that when implementing x86-64 support.
362 */
368static int __init __setup_host_supports_tls(void) 363static int __init __setup_host_supports_tls(void)
369{ 364{
370 check_host_supports_tls(&host_supports_tls, &host_gdt_entry_tls_min); 365 check_host_supports_tls(&host_supports_tls, &host_gdt_entry_tls_min);
diff --git a/arch/um/sys-i386/unmap.c b/arch/um/sys-i386/unmap.c
deleted file mode 100644
index 1b0ad0e4adcd..000000000000
--- a/arch/um/sys-i386/unmap.c
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <linux/mman.h>
7#include <asm/unistd.h>
8
9static int errno;
10
11static inline _syscall2(int,munmap,void *,start,size_t,len)
12static inline _syscall6(void *,mmap2,void *,addr,size_t,len,int,prot,int,flags,int,fd,off_t,offset)
13int switcheroo(int fd, int prot, void *from, void *to, int size)
14{
15 if(munmap(to, size) < 0){
16 return(-1);
17 }
18 if(mmap2(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1 ){
19 return(-1);
20 }
21 if(munmap(from, size) < 0){
22 return(-1);
23 }
24 return(0);
25}
diff --git a/arch/um/sys-i386/user-offsets.c b/arch/um/sys-i386/user-offsets.c
index 29118cf5ff25..514241526a1b 100644
--- a/arch/um/sys-i386/user-offsets.c
+++ b/arch/um/sys-i386/user-offsets.c
@@ -2,9 +2,9 @@
2#include <stddef.h> 2#include <stddef.h>
3#include <signal.h> 3#include <signal.h>
4#include <sys/poll.h> 4#include <sys/poll.h>
5#include <sys/user.h>
5#include <sys/mman.h> 6#include <sys/mman.h>
6#include <asm/ptrace.h> 7#include <asm/ptrace.h>
7#include <asm/user.h>
8 8
9#define DEFINE(sym, val) \ 9#define DEFINE(sym, val) \
10 asm volatile("\n->" #sym " %0 " #val : : "i" (val)) 10 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
@@ -48,8 +48,8 @@ void foo(void)
48 OFFSET(HOST_SC_FP_ST, _fpstate, _st); 48 OFFSET(HOST_SC_FP_ST, _fpstate, _st);
49 OFFSET(HOST_SC_FXSR_ENV, _fpstate, _fxsr_env); 49 OFFSET(HOST_SC_FXSR_ENV, _fpstate, _fxsr_env);
50 50
51 DEFINE_LONGS(HOST_FP_SIZE, sizeof(struct user_i387_struct)); 51 DEFINE_LONGS(HOST_FP_SIZE, sizeof(struct user_fpregs_struct));
52 DEFINE_LONGS(HOST_XFP_SIZE, sizeof(struct user_fxsr_struct)); 52 DEFINE_LONGS(HOST_XFP_SIZE, sizeof(struct user_fpxregs_struct));
53 53
54 DEFINE(HOST_IP, EIP); 54 DEFINE(HOST_IP, EIP);
55 DEFINE(HOST_SP, UESP); 55 DEFINE(HOST_SP, UESP);
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile
index e446a9916fd7..3c22de532088 100644
--- a/arch/um/sys-x86_64/Makefile
+++ b/arch/um/sys-x86_64/Makefile
@@ -5,27 +5,22 @@
5# 5#
6 6
7obj-y = bug.o bugs.o delay.o fault.o ldt.o mem.o ptrace.o ptrace_user.o \ 7obj-y = bug.o bugs.o delay.o fault.o ldt.o mem.o ptrace.o ptrace_user.o \
8 setjmp.o sigcontext.o signal.o syscalls.o syscall_table.o sysrq.o \ 8 setjmp.o signal.o stub.o stub_segv.o syscalls.o syscall_table.o \
9 ksyms.o tls.o 9 sysrq.o ksyms.o tls.o
10 10
11obj-$(CONFIG_MODE_SKAS) += stub.o stub_segv.o
12obj-$(CONFIG_MODULES) += um_module.o 11obj-$(CONFIG_MODULES) += um_module.o
13 12
14subarch-obj-y = lib/bitops.o lib/csum-partial.o lib/memcpy.o lib/thunk.o 13subarch-obj-y = lib/bitops_64.o lib/csum-partial_64.o lib/memcpy_64.o lib/thunk_64.o
15subarch-obj-$(CONFIG_MODULES) += kernel/module.o 14subarch-obj-$(CONFIG_MODULES) += kernel/module_64.o
16 15
17ldt-y = ../sys-i386/ldt.o 16ldt-y = ../sys-i386/ldt.o
18 17
19USER_OBJS := ptrace_user.o sigcontext.o 18USER_OBJS := ptrace_user.o
20 19
21USER_OBJS += user-offsets.s 20USER_OBJS += user-offsets.s
22extra-y += user-offsets.s 21extra-y += user-offsets.s
23 22
24extra-$(CONFIG_MODE_TT) += unmap.o
25
26UNPROFILE_OBJS := stub_segv.o 23UNPROFILE_OBJS := stub_segv.o
27CFLAGS_stub_segv.o := $(CFLAGS_NO_HARDENING) 24CFLAGS_stub_segv.o := $(CFLAGS_NO_HARDENING)
28 25
29include arch/um/scripts/Makefile.rules 26include arch/um/scripts/Makefile.rules
30
31$(obj)/unmap.%: _c_flags = $(call unprofile,$(KBUILD_CFLAGS))
diff --git a/arch/um/sys-x86_64/bugs.c b/arch/um/sys-x86_64/bugs.c
index 095478890371..506b6765bbcb 100644
--- a/arch/um/sys-x86_64/bugs.c
+++ b/arch/um/sys-x86_64/bugs.c
@@ -14,7 +14,7 @@ void arch_check_bugs(void)
14{ 14{
15} 15}
16 16
17int arch_handle_signal(int sig, union uml_pt_regs *regs) 17int arch_handle_signal(int sig, struct uml_pt_regs *regs)
18{ 18{
19 return 0; 19 return 0;
20} 20}
diff --git a/arch/um/sys-x86_64/fault.c b/arch/um/sys-x86_64/fault.c
index 4636b1465b6c..ce85117fc64e 100644
--- a/arch/um/sys-x86_64/fault.c
+++ b/arch/um/sys-x86_64/fault.c
@@ -14,14 +14,15 @@ struct exception_table_entry
14}; 14};
15 15
16const struct exception_table_entry *search_exception_tables(unsigned long add); 16const struct exception_table_entry *search_exception_tables(unsigned long add);
17int arch_fixup(unsigned long address, union uml_pt_regs *regs) 17
18int arch_fixup(unsigned long address, struct uml_pt_regs *regs)
18{ 19{
19 const struct exception_table_entry *fixup; 20 const struct exception_table_entry *fixup;
20 21
21 fixup = search_exception_tables(address); 22 fixup = search_exception_tables(address);
22 if(fixup != 0){ 23 if (fixup != 0) {
23 UPT_IP(regs) = fixup->fixup; 24 UPT_IP(regs) = fixup->fixup;
24 return(1); 25 return 1;
25 } 26 }
26 return(0); 27 return 0;
27} 28}
diff --git a/arch/um/sys-x86_64/ptrace.c b/arch/um/sys-x86_64/ptrace.c
index 1970d78aa528..a3cfeed17af4 100644
--- a/arch/um/sys-x86_64/ptrace.c
+++ b/arch/um/sys-x86_64/ptrace.c
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright 2003 PathScale, Inc. 2 * Copyright 2003 PathScale, Inc.
3 * Copyright (C) 2003 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * 4 *
4 * Licensed under the GPL 5 * Licensed under the GPL
5 */ 6 */
@@ -12,17 +13,10 @@
12#include <asm/uaccess.h> 13#include <asm/uaccess.h>
13#include <asm/elf.h> 14#include <asm/elf.h>
14 15
15/* XXX x86_64 */ 16/*
16unsigned long not_ss; 17 * determines which flags the user has access to.
17unsigned long not_ds; 18 * 1 = access 0 = no access
18unsigned long not_es; 19 */
19
20#define SC_SS(r) (not_ss)
21#define SC_DS(r) (not_ds)
22#define SC_ES(r) (not_es)
23
24/* determines which flags the user has access to. */
25/* 1 = access 0 = no access */
26#define FLAG_MASK 0x44dd5UL 20#define FLAG_MASK 0x44dd5UL
27 21
28int putreg(struct task_struct *child, int regno, unsigned long value) 22int putreg(struct task_struct *child, int regno, unsigned long value)
@@ -66,20 +60,21 @@ int putreg(struct task_struct *child, int regno, unsigned long value)
66 60
67int poke_user(struct task_struct *child, long addr, long data) 61int poke_user(struct task_struct *child, long addr, long data)
68{ 62{
69 if ((addr & 3) || addr < 0) 63 if ((addr & 3) || addr < 0)
70 return -EIO; 64 return -EIO;
71 65
72 if (addr < MAX_REG_OFFSET) 66 if (addr < MAX_REG_OFFSET)
73 return putreg(child, addr, data); 67 return putreg(child, addr, data);
74 else if((addr >= offsetof(struct user, u_debugreg[0])) && 68 else if ((addr >= offsetof(struct user, u_debugreg[0])) &&
75 (addr <= offsetof(struct user, u_debugreg[7]))){ 69 (addr <= offsetof(struct user, u_debugreg[7]))){
76 addr -= offsetof(struct user, u_debugreg[0]); 70 addr -= offsetof(struct user, u_debugreg[0]);
77 addr = addr >> 2; 71 addr = addr >> 2;
78 if((addr == 4) || (addr == 5)) return -EIO; 72 if ((addr == 4) || (addr == 5))
79 child->thread.arch.debugregs[addr] = data; 73 return -EIO;
80 return 0; 74 child->thread.arch.debugregs[addr] = data;
81 } 75 return 0;
82 return -EIO; 76 }
77 return -EIO;
83} 78}
84 79
85unsigned long getreg(struct task_struct *child, int regno) 80unsigned long getreg(struct task_struct *child, int regno)
@@ -107,29 +102,22 @@ unsigned long getreg(struct task_struct *child, int regno)
107int peek_user(struct task_struct *child, long addr, long data) 102int peek_user(struct task_struct *child, long addr, long data)
108{ 103{
109 /* read the word at location addr in the USER area. */ 104 /* read the word at location addr in the USER area. */
110 unsigned long tmp; 105 unsigned long tmp;
111
112 if ((addr & 3) || addr < 0)
113 return -EIO;
114
115 tmp = 0; /* Default return condition */
116 if(addr < MAX_REG_OFFSET){
117 tmp = getreg(child, addr);
118 }
119 else if((addr >= offsetof(struct user, u_debugreg[0])) &&
120 (addr <= offsetof(struct user, u_debugreg[7]))){
121 addr -= offsetof(struct user, u_debugreg[0]);
122 addr = addr >> 2;
123 tmp = child->thread.arch.debugregs[addr];
124 }
125 return put_user(tmp, (unsigned long *) data);
126}
127 106
128void arch_switch(void) 107 if ((addr & 3) || addr < 0)
129{ 108 return -EIO;
130/* XXX 109
131 printk("arch_switch\n"); 110 tmp = 0; /* Default return condition */
132*/ 111 if (addr < MAX_REG_OFFSET){
112 tmp = getreg(child, addr);
113 }
114 else if ((addr >= offsetof(struct user, u_debugreg[0])) &&
115 (addr <= offsetof(struct user, u_debugreg[7]))){
116 addr -= offsetof(struct user, u_debugreg[0]);
117 addr = addr >> 2;
118 tmp = child->thread.arch.debugregs[addr];
119 }
120 return put_user(tmp, (unsigned long *) data);
133} 121}
134 122
135/* XXX Mostly copied from sys-i386 */ 123/* XXX Mostly copied from sys-i386 */
@@ -139,54 +127,68 @@ int is_syscall(unsigned long addr)
139 int n; 127 int n;
140 128
141 n = copy_from_user(&instr, (void __user *) addr, sizeof(instr)); 129 n = copy_from_user(&instr, (void __user *) addr, sizeof(instr));
142 if(n){ 130 if (n){
143 /* access_process_vm() grants access to vsyscall and stub, 131 /* access_process_vm() grants access to vsyscall and stub,
144 * while copy_from_user doesn't. Maybe access_process_vm is 132 * while copy_from_user doesn't. Maybe access_process_vm is
145 * slow, but that doesn't matter, since it will be called only 133 * slow, but that doesn't matter, since it will be called only
146 * in case of singlestepping, if copy_from_user failed. 134 * in case of singlestepping, if copy_from_user failed.
147 */ 135 */
148 n = access_process_vm(current, addr, &instr, sizeof(instr), 0); 136 n = access_process_vm(current, addr, &instr, sizeof(instr), 0);
149 if(n != sizeof(instr)) { 137 if (n != sizeof(instr)) {
150 printk("is_syscall : failed to read instruction from " 138 printk("is_syscall : failed to read instruction from "
151 "0x%lx\n", addr); 139 "0x%lx\n", addr);
152 return(1); 140 return 1;
153 } 141 }
154 } 142 }
155 /* sysenter */ 143 /* sysenter */
156 return(instr == 0x050f); 144 return instr == 0x050f;
157} 145}
158 146
159int get_fpregs(unsigned long buf, struct task_struct *child) 147int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
160{ 148{
161 panic("get_fpregs"); 149 int err, n, cpu = ((struct thread_info *) child->stack)->cpu;
162 return(0); 150 long fpregs[HOST_FP_SIZE];
163}
164 151
165int set_fpregs(unsigned long buf, struct task_struct *child) 152 BUG_ON(sizeof(*buf) != sizeof(fpregs));
166{ 153 err = save_fp_registers(userspace_pid[cpu], fpregs);
167 panic("set_fpregs"); 154 if (err)
168 return(0); 155 return err;
156
157 n = copy_to_user((void *) buf, fpregs, sizeof(fpregs));
158 if(n > 0)
159 return -EFAULT;
160
161 return n;
169} 162}
170 163
171int get_fpxregs(unsigned long buf, struct task_struct *tsk) 164int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
172{ 165{
173 panic("get_fpxregs"); 166 int n, cpu = ((struct thread_info *) child->stack)->cpu;
174 return(0); 167 long fpregs[HOST_FP_SIZE];
168
169 BUG_ON(sizeof(*buf) != sizeof(fpregs));
170 n = copy_from_user(fpregs, (void *) buf, sizeof(fpregs));
171 if (n > 0)
172 return -EFAULT;
173
174 return restore_fp_registers(userspace_pid[cpu], fpregs);
175} 175}
176 176
177int set_fpxregs(unsigned long buf, struct task_struct *tsk) 177long subarch_ptrace(struct task_struct *child, long request, long addr,
178 long data)
178{ 179{
179 panic("set_fxpregs"); 180 int ret = -EIO;
180 return(0);
181}
182 181
183/* 182 switch (request) {
184 * Overrides for Emacs so that we follow Linus's tabbing style. 183 case PTRACE_GETFPXREGS: /* Get the child FPU state. */
185 * Emacs will notice this stuff at the end of the file and automatically 184 ret = get_fpregs((struct user_i387_struct __user *) data,
186 * adjust the settings for this buffer only. This must remain at the end 185 child);
187 * of the file. 186 break;
188 * --------------------------------------------------------------------------- 187 case PTRACE_SETFPXREGS: /* Set the child FPU state. */
189 * Local variables: 188 ret = set_fpregs((struct user_i387_struct __user *) data,
190 * c-file-style: "linux" 189 child);
191 * End: 190 break;
192 */ 191 }
192
193 return ret;
194}
diff --git a/arch/um/sys-x86_64/sigcontext.c b/arch/um/sys-x86_64/sigcontext.c
deleted file mode 100644
index c88e64def6f2..000000000000
--- a/arch/um/sys-x86_64/sigcontext.c
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
7#include <stdio.h>
8#include <string.h>
9#include <signal.h>
10#include "user.h"
11
12void sc_to_sc(void *to_ptr, void *from_ptr)
13{
14 struct sigcontext *to = to_ptr, *from = from_ptr;
15 int size = sizeof(*to); /* + sizeof(struct _fpstate); */
16
17 memcpy(to, from, size);
18 if(from->fpstate != NULL)
19 to->fpstate = (struct _fpstate *) (to + 1);
20
21 to->fpstate = NULL;
22}
23
24unsigned long *sc_sigmask(void *sc_ptr)
25{
26 struct sigcontext *sc = sc_ptr;
27
28 return(&sc->oldmask);
29}
30
31/* Overrides for Emacs so that we follow Linus's tabbing style.
32 * Emacs will notice this stuff at the end of the file and automatically
33 * adjust the settings for this buffer only. This must remain at the end
34 * of the file.
35 * ---------------------------------------------------------------------------
36 * Local variables:
37 * c-file-style: "linux"
38 * End:
39 */
diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c
index fe8ec04d35bb..1778d33808f4 100644
--- a/arch/um/sys-x86_64/signal.c
+++ b/arch/um/sys-x86_64/signal.c
@@ -1,111 +1,121 @@
1/* 1/*
2 * Copyright (C) 2003 PathScale, Inc. 2 * Copyright (C) 2003 PathScale, Inc.
3 * Copyright (C) 2003 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 4 * Licensed under the GPL
4 */ 5 */
5 6
6#include "linux/stddef.h"
7#include "linux/errno.h"
8#include "linux/personality.h" 7#include "linux/personality.h"
9#include "linux/ptrace.h" 8#include "linux/ptrace.h"
10#include "asm/current.h" 9#include "asm/unistd.h"
11#include "asm/uaccess.h" 10#include "asm/uaccess.h"
12#include "asm/sigcontext.h" 11#include "asm/ucontext.h"
13#include "asm/ptrace.h"
14#include "asm/arch/ucontext.h"
15#include "choose-mode.h"
16#include "sysdep/ptrace.h"
17#include "frame_kern.h" 12#include "frame_kern.h"
18
19#ifdef CONFIG_MODE_SKAS
20
21#include "skas.h" 13#include "skas.h"
22 14
23void copy_sc(union uml_pt_regs *regs, void *from) 15void copy_sc(struct uml_pt_regs *regs, void *from)
24{ 16{
25 struct sigcontext *sc = from; 17 struct sigcontext *sc = from;
26 18
27#define GETREG(regs, regno, sc, regname) \ 19#define GETREG(regs, regno, sc, regname) \
28 (regs)->skas.regs[(regno) / sizeof(unsigned long)] = (sc)->regname 20 (regs)->gp[(regno) / sizeof(unsigned long)] = (sc)->regname
29 21
30 GETREG(regs, R8, sc, r8); 22 GETREG(regs, R8, sc, r8);
31 GETREG(regs, R9, sc, r9); 23 GETREG(regs, R9, sc, r9);
32 GETREG(regs, R10, sc, r10); 24 GETREG(regs, R10, sc, r10);
33 GETREG(regs, R11, sc, r11); 25 GETREG(regs, R11, sc, r11);
34 GETREG(regs, R12, sc, r12); 26 GETREG(regs, R12, sc, r12);
35 GETREG(regs, R13, sc, r13); 27 GETREG(regs, R13, sc, r13);
36 GETREG(regs, R14, sc, r14); 28 GETREG(regs, R14, sc, r14);
37 GETREG(regs, R15, sc, r15); 29 GETREG(regs, R15, sc, r15);
38 GETREG(regs, RDI, sc, rdi); 30 GETREG(regs, RDI, sc, rdi);
39 GETREG(regs, RSI, sc, rsi); 31 GETREG(regs, RSI, sc, rsi);
40 GETREG(regs, RBP, sc, rbp); 32 GETREG(regs, RBP, sc, rbp);
41 GETREG(regs, RBX, sc, rbx); 33 GETREG(regs, RBX, sc, rbx);
42 GETREG(regs, RDX, sc, rdx); 34 GETREG(regs, RDX, sc, rdx);
43 GETREG(regs, RAX, sc, rax); 35 GETREG(regs, RAX, sc, rax);
44 GETREG(regs, RCX, sc, rcx); 36 GETREG(regs, RCX, sc, rcx);
45 GETREG(regs, RSP, sc, rsp); 37 GETREG(regs, RSP, sc, rsp);
46 GETREG(regs, RIP, sc, rip); 38 GETREG(regs, RIP, sc, rip);
47 GETREG(regs, EFLAGS, sc, eflags); 39 GETREG(regs, EFLAGS, sc, eflags);
48 GETREG(regs, CS, sc, cs); 40 GETREG(regs, CS, sc, cs);
49 41
50#undef GETREG 42#undef GETREG
51} 43}
52 44
53static int copy_sc_from_user_skas(struct pt_regs *regs, 45static int copy_sc_from_user(struct pt_regs *regs,
54 struct sigcontext __user *from) 46 struct sigcontext __user *from,
47 struct _fpstate __user *fpp)
55{ 48{
56 int err = 0; 49 struct user_i387_struct fp;
57 50 int err = 0;
58#define GETREG(regs, regno, sc, regname) \ 51
59 __get_user((regs)->regs.skas.regs[(regno) / sizeof(unsigned long)], \ 52#define GETREG(regs, regno, sc, regname) \
60 &(sc)->regname) 53 __get_user((regs)->regs.gp[(regno) / sizeof(unsigned long)], \
61 54 &(sc)->regname)
62 err |= GETREG(regs, R8, from, r8); 55
63 err |= GETREG(regs, R9, from, r9); 56 err |= GETREG(regs, R8, from, r8);
64 err |= GETREG(regs, R10, from, r10); 57 err |= GETREG(regs, R9, from, r9);
65 err |= GETREG(regs, R11, from, r11); 58 err |= GETREG(regs, R10, from, r10);
66 err |= GETREG(regs, R12, from, r12); 59 err |= GETREG(regs, R11, from, r11);
67 err |= GETREG(regs, R13, from, r13); 60 err |= GETREG(regs, R12, from, r12);
68 err |= GETREG(regs, R14, from, r14); 61 err |= GETREG(regs, R13, from, r13);
69 err |= GETREG(regs, R15, from, r15); 62 err |= GETREG(regs, R14, from, r14);
70 err |= GETREG(regs, RDI, from, rdi); 63 err |= GETREG(regs, R15, from, r15);
71 err |= GETREG(regs, RSI, from, rsi); 64 err |= GETREG(regs, RDI, from, rdi);
72 err |= GETREG(regs, RBP, from, rbp); 65 err |= GETREG(regs, RSI, from, rsi);
73 err |= GETREG(regs, RBX, from, rbx); 66 err |= GETREG(regs, RBP, from, rbp);
74 err |= GETREG(regs, RDX, from, rdx); 67 err |= GETREG(regs, RBX, from, rbx);
75 err |= GETREG(regs, RAX, from, rax); 68 err |= GETREG(regs, RDX, from, rdx);
76 err |= GETREG(regs, RCX, from, rcx); 69 err |= GETREG(regs, RAX, from, rax);
77 err |= GETREG(regs, RSP, from, rsp); 70 err |= GETREG(regs, RCX, from, rcx);
78 err |= GETREG(regs, RIP, from, rip); 71 err |= GETREG(regs, RSP, from, rsp);
79 err |= GETREG(regs, EFLAGS, from, eflags); 72 err |= GETREG(regs, RIP, from, rip);
80 err |= GETREG(regs, CS, from, cs); 73 err |= GETREG(regs, EFLAGS, from, eflags);
74 err |= GETREG(regs, CS, from, cs);
75 if (err)
76 return 1;
81 77
82#undef GETREG 78#undef GETREG
83 79
84 return err; 80 err = copy_from_user(&fp, fpp, sizeof(struct user_i387_struct));
81 if (err)
82 return 1;
83
84 err = restore_fp_registers(userspace_pid[current_thread->cpu],
85 (unsigned long *) &fp);
86 if (err < 0) {
87 printk(KERN_ERR "copy_sc_from_user - "
88 "restore_fp_registers failed, errno = %d\n",
89 -err);
90 return 1;
91 }
92
93 return 0;
85} 94}
86 95
87int copy_sc_to_user_skas(struct sigcontext __user *to, 96static int copy_sc_to_user(struct sigcontext __user *to,
88 struct _fpstate __user *to_fp, 97 struct _fpstate __user *to_fp, struct pt_regs *regs,
89 struct pt_regs *regs, unsigned long mask, 98 unsigned long mask, unsigned long sp)
90 unsigned long sp)
91{ 99{
92 struct faultinfo * fi = &current->thread.arch.faultinfo; 100 struct faultinfo * fi = &current->thread.arch.faultinfo;
101 struct user_i387_struct fp;
93 int err = 0; 102 int err = 0;
94 103
95 err |= __put_user(0, &to->gs); 104 err |= __put_user(0, &to->gs);
96 err |= __put_user(0, &to->fs); 105 err |= __put_user(0, &to->fs);
97 106
98#define PUTREG(regs, regno, sc, regname) \ 107#define PUTREG(regs, regno, sc, regname) \
99 __put_user((regs)->regs.skas.regs[(regno) / sizeof(unsigned long)], \ 108 __put_user((regs)->regs.gp[(regno) / sizeof(unsigned long)], \
100 &(sc)->regname) 109 &(sc)->regname)
101 110
102 err |= PUTREG(regs, RDI, to, rdi); 111 err |= PUTREG(regs, RDI, to, rdi);
103 err |= PUTREG(regs, RSI, to, rsi); 112 err |= PUTREG(regs, RSI, to, rsi);
104 err |= PUTREG(regs, RBP, to, rbp); 113 err |= PUTREG(regs, RBP, to, rbp);
105 /* Must use orignal RSP, which is passed in, rather than what's in 114 /*
106 * the pt_regs, because that's already been updated to point at the 115 * Must use orignal RSP, which is passed in, rather than what's in
107 * signal frame. 116 * the pt_regs, because that's already been updated to point at the
108 */ 117 * signal frame.
118 */
109 err |= __put_user(sp, &to->rsp); 119 err |= __put_user(sp, &to->rsp);
110 err |= PUTREG(regs, RBX, to, rbx); 120 err |= PUTREG(regs, RBX, to, rbx);
111 err |= PUTREG(regs, RDX, to, rdx); 121 err |= PUTREG(regs, RDX, to, rdx);
@@ -121,91 +131,38 @@ int copy_sc_to_user_skas(struct sigcontext __user *to,
121 err |= PUTREG(regs, R15, to, r15); 131 err |= PUTREG(regs, R15, to, r15);
122 err |= PUTREG(regs, CS, to, cs); /* XXX x86_64 doesn't do this */ 132 err |= PUTREG(regs, CS, to, cs); /* XXX x86_64 doesn't do this */
123 133
124 err |= __put_user(fi->cr2, &to->cr2); 134 err |= __put_user(fi->cr2, &to->cr2);
125 err |= __put_user(fi->error_code, &to->err); 135 err |= __put_user(fi->error_code, &to->err);
126 err |= __put_user(fi->trap_no, &to->trapno); 136 err |= __put_user(fi->trap_no, &to->trapno);
127 137
128 err |= PUTREG(regs, RIP, to, rip); 138 err |= PUTREG(regs, RIP, to, rip);
129 err |= PUTREG(regs, EFLAGS, to, eflags); 139 err |= PUTREG(regs, EFLAGS, to, eflags);
130#undef PUTREG 140#undef PUTREG
131 141
132 err |= __put_user(mask, &to->oldmask); 142 err |= __put_user(mask, &to->oldmask);
133 143 if (err)
134 return(err); 144 return 1;
135} 145
136 146 err = save_fp_registers(userspace_pid[current_thread->cpu],
137#endif 147 (unsigned long *) &fp);
138 148 if (err < 0) {
139#ifdef CONFIG_MODE_TT 149 printk(KERN_ERR "copy_sc_from_user - restore_fp_registers "
140int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext __user *from, 150 "failed, errno = %d\n", -err);
141 int fpsize) 151 return 1;
142{
143 struct _fpstate *to_fp;
144 struct _fpstate __user *from_fp;
145 unsigned long sigs;
146 int err;
147
148 to_fp = to->fpstate;
149 sigs = to->oldmask;
150 err = copy_from_user(to, from, sizeof(*to));
151 from_fp = to->fpstate;
152 to->fpstate = to_fp;
153 to->oldmask = sigs;
154 if(to_fp != NULL)
155 err |= copy_from_user(to_fp, from_fp, fpsize);
156 return(err);
157}
158
159int copy_sc_to_user_tt(struct sigcontext __user *to, struct _fpstate __user *fp,
160 struct sigcontext *from, int fpsize, unsigned long sp)
161{
162 struct _fpstate __user *to_fp;
163 struct _fpstate *from_fp;
164 int err;
165
166 to_fp = (fp ? fp : (struct _fpstate __user *) (to + 1));
167 from_fp = from->fpstate;
168 err = copy_to_user(to, from, sizeof(*to));
169 /* The SP in the sigcontext is the updated one for the signal
170 * delivery. The sp passed in is the original, and this needs
171 * to be restored, so we stick it in separately.
172 */
173 err |= copy_to_user(&SC_SP(to), &sp, sizeof(sp));
174
175 if(from_fp != NULL){
176 err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate));
177 err |= copy_to_user(to_fp, from_fp, fpsize);
178 } 152 }
179 return err;
180}
181 153
182#endif 154 if (copy_to_user(to_fp, &fp, sizeof(struct user_i387_struct)))
183 155 return 1;
184static int copy_sc_from_user(struct pt_regs *to, void __user *from)
185{
186 int ret;
187
188 ret = CHOOSE_MODE(copy_sc_from_user_tt(UPT_SC(&to->regs), from,
189 sizeof(struct _fpstate)),
190 copy_sc_from_user_skas(to, from));
191 return(ret);
192}
193 156
194static int copy_sc_to_user(struct sigcontext __user *to, 157 return err;
195 struct _fpstate __user *fp,
196 struct pt_regs *from, unsigned long mask,
197 unsigned long sp)
198{
199 return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs),
200 sizeof(*fp), sp),
201 copy_sc_to_user_skas(to, fp, from, mask, sp)));
202} 158}
203 159
204struct rt_sigframe 160struct rt_sigframe
205{ 161{
206 char __user *pretcode; 162 char __user *pretcode;
207 struct ucontext uc; 163 struct ucontext uc;
208 struct siginfo info; 164 struct siginfo info;
165 struct _fpstate fpstate;
209}; 166};
210 167
211#define round_down(m, n) (((m) / (n)) * (n)) 168#define round_down(m, n) (((m) / (n)) * (n))
@@ -215,7 +172,6 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
215 siginfo_t *info, sigset_t *set) 172 siginfo_t *info, sigset_t *set)
216{ 173{
217 struct rt_sigframe __user *frame; 174 struct rt_sigframe __user *frame;
218 struct _fpstate __user *fp = NULL;
219 unsigned long save_sp = PT_REGS_RSP(regs); 175 unsigned long save_sp = PT_REGS_RSP(regs);
220 int err = 0; 176 int err = 0;
221 struct task_struct *me = current; 177 struct task_struct *me = current;
@@ -223,15 +179,8 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
223 frame = (struct rt_sigframe __user *) 179 frame = (struct rt_sigframe __user *)
224 round_down(stack_top - sizeof(struct rt_sigframe), 16); 180 round_down(stack_top - sizeof(struct rt_sigframe), 16);
225 /* Subtract 128 for a red zone and 8 for proper alignment */ 181 /* Subtract 128 for a red zone and 8 for proper alignment */
226 frame = (struct rt_sigframe __user *) ((unsigned long) frame - 128 - 8); 182 frame = (struct rt_sigframe __user *) ((unsigned long) frame - 128 - 8);
227
228 if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate)))
229 goto out;
230 183
231#if 0 /* XXX */
232 if (save_i387(fp) < 0)
233 err |= -1;
234#endif
235 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 184 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
236 goto out; 185 goto out;
237 186
@@ -241,7 +190,8 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
241 goto out; 190 goto out;
242 } 191 }
243 192
244 /* Update SP now because the page fault handler refuses to extend 193 /*
194 * Update SP now because the page fault handler refuses to extend
245 * the stack if the faulting address is too far below the current 195 * the stack if the faulting address is too far below the current
246 * SP, which frame now certainly is. If there's an error, the original 196 * SP, which frame now certainly is. If there's an error, the original
247 * value is restored on the way out. 197 * value is restored on the way out.
@@ -258,9 +208,9 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
258 err |= __put_user(sas_ss_flags(save_sp), 208 err |= __put_user(sas_ss_flags(save_sp),
259 &frame->uc.uc_stack.ss_flags); 209 &frame->uc.uc_stack.ss_flags);
260 err |= __put_user(me->sas_ss_size, &frame->uc.uc_stack.ss_size); 210 err |= __put_user(me->sas_ss_size, &frame->uc.uc_stack.ss_size);
261 err |= copy_sc_to_user(&frame->uc.uc_mcontext, fp, regs, set->sig[0], 211 err |= copy_sc_to_user(&frame->uc.uc_mcontext, &frame->fpstate, regs,
262 save_sp); 212 set->sig[0], save_sp);
263 err |= __put_user(fp, &frame->uc.uc_mcontext.fpstate); 213 err |= __put_user(&frame->fpstate, &frame->uc.uc_mcontext.fpstate);
264 if (sizeof(*set) == 16) { 214 if (sizeof(*set) == 16) {
265 __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]); 215 __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]);
266 __put_user(set->sig[1], &frame->uc.uc_sigmask.sig[1]); 216 __put_user(set->sig[1], &frame->uc.uc_sigmask.sig[1]);
@@ -269,8 +219,10 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
269 err |= __copy_to_user(&frame->uc.uc_sigmask, set, 219 err |= __copy_to_user(&frame->uc.uc_sigmask, set,
270 sizeof(*set)); 220 sizeof(*set));
271 221
272 /* Set up to return from userspace. If provided, use a stub 222 /*
273 already in userspace. */ 223 * Set up to return from userspace. If provided, use a stub
224 * already in userspace.
225 */
274 /* x86-64 should always use SA_RESTORER. */ 226 /* x86-64 should always use SA_RESTORER. */
275 if (ka->sa.sa_flags & SA_RESTORER) 227 if (ka->sa.sa_flags & SA_RESTORER)
276 err |= __put_user(ka->sa.sa_restorer, &frame->pretcode); 228 err |= __put_user(ka->sa.sa_restorer, &frame->pretcode);
@@ -292,8 +244,10 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
292 /* In case the signal handler was declared without prototypes */ 244 /* In case the signal handler was declared without prototypes */
293 PT_REGS_RAX(regs) = 0; 245 PT_REGS_RAX(regs) = 0;
294 246
295 /* This also works for non SA_SIGINFO handlers because they expect the 247 /*
296 next argument after the signal number on the stack. */ 248 * This also works for non SA_SIGINFO handlers because they expect the
249 * next argument after the signal number on the stack.
250 */
297 PT_REGS_RSI(regs) = (unsigned long) &frame->info; 251 PT_REGS_RSI(regs) = (unsigned long) &frame->info;
298 PT_REGS_RDX(regs) = (unsigned long) &frame->uc; 252 PT_REGS_RDX(regs) = (unsigned long) &frame->uc;
299 PT_REGS_RIP(regs) = (unsigned long) ka->sa.sa_handler; 253 PT_REGS_RIP(regs) = (unsigned long) ka->sa.sa_handler;
@@ -313,7 +267,7 @@ long sys_rt_sigreturn(struct pt_regs *regs)
313 struct ucontext __user *uc = &frame->uc; 267 struct ucontext __user *uc = &frame->uc;
314 sigset_t set; 268 sigset_t set;
315 269
316 if(copy_from_user(&set, &uc->uc_sigmask, sizeof(set))) 270 if (copy_from_user(&set, &uc->uc_sigmask, sizeof(set)))
317 goto segfault; 271 goto segfault;
318 272
319 sigdelsetmask(&set, ~_BLOCKABLE); 273 sigdelsetmask(&set, ~_BLOCKABLE);
@@ -323,24 +277,15 @@ long sys_rt_sigreturn(struct pt_regs *regs)
323 recalc_sigpending(); 277 recalc_sigpending();
324 spin_unlock_irq(&current->sighand->siglock); 278 spin_unlock_irq(&current->sighand->siglock);
325 279
326 if(copy_sc_from_user(&current->thread.regs, &uc->uc_mcontext)) 280 if (copy_sc_from_user(&current->thread.regs, &uc->uc_mcontext,
281 &frame->fpstate))
327 goto segfault; 282 goto segfault;
328 283
329 /* Avoid ERESTART handling */ 284 /* Avoid ERESTART handling */
330 PT_REGS_SYSCALL_NR(&current->thread.regs) = -1; 285 PT_REGS_SYSCALL_NR(&current->thread.regs) = -1;
331 return(PT_REGS_SYSCALL_RET(&current->thread.regs)); 286 return PT_REGS_SYSCALL_RET(&current->thread.regs);
332 287
333 segfault: 288 segfault:
334 force_sig(SIGSEGV, current); 289 force_sig(SIGSEGV, current);
335 return 0; 290 return 0;
336} 291}
337/*
338 * Overrides for Emacs so that we follow Linus's tabbing style.
339 * Emacs will notice this stuff at the end of the file and automatically
340 * adjust the settings for this buffer only. This must remain at the end
341 * of the file.
342 * ---------------------------------------------------------------------------
343 * Local variables:
344 * c-file-style: "linux"
345 * End:
346 */
diff --git a/arch/um/sys-x86_64/stub.S b/arch/um/sys-x86_64/stub.S
index 03c279735784..4afe204a6af7 100644
--- a/arch/um/sys-x86_64/stub.S
+++ b/arch/um/sys-x86_64/stub.S
@@ -1,4 +1,5 @@
1#include "uml-config.h" 1#include "uml-config.h"
2#include "as-layout.h"
2 3
3 .globl syscall_stub 4 .globl syscall_stub
4.section .__syscall_stub, "x" 5.section .__syscall_stub, "x"
@@ -7,18 +8,18 @@ syscall_stub:
7 /* We don't have 64-bit constants, so this constructs the address 8 /* We don't have 64-bit constants, so this constructs the address
8 * we need. 9 * we need.
9 */ 10 */
10 movq $(UML_CONFIG_STUB_DATA >> 32), %rbx 11 movq $(ASM_STUB_DATA >> 32), %rbx
11 salq $32, %rbx 12 salq $32, %rbx
12 movq $(UML_CONFIG_STUB_DATA & 0xffffffff), %rcx 13 movq $(ASM_STUB_DATA & 0xffffffff), %rcx
13 or %rcx, %rbx 14 or %rcx, %rbx
14 movq %rax, (%rbx) 15 movq %rax, (%rbx)
15 int3 16 int3
16 17
17 .globl batch_syscall_stub 18 .globl batch_syscall_stub
18batch_syscall_stub: 19batch_syscall_stub:
19 mov $(UML_CONFIG_STUB_DATA >> 32), %rbx 20 mov $(ASM_STUB_DATA >> 32), %rbx
20 sal $32, %rbx 21 sal $32, %rbx
21 mov $(UML_CONFIG_STUB_DATA & 0xffffffff), %rax 22 mov $(ASM_STUB_DATA & 0xffffffff), %rax
22 or %rax, %rbx 23 or %rax, %rbx
23 /* load pointer to first operation */ 24 /* load pointer to first operation */
24 mov %rbx, %rsp 25 mov %rbx, %rsp
diff --git a/arch/um/sys-x86_64/stub_segv.c b/arch/um/sys-x86_64/stub_segv.c
index 652fa34c2cd3..3afb590f0072 100644
--- a/arch/um/sys-x86_64/stub_segv.c
+++ b/arch/um/sys-x86_64/stub_segv.c
@@ -6,6 +6,7 @@
6#include <stddef.h> 6#include <stddef.h>
7#include <signal.h> 7#include <signal.h>
8#include <asm/unistd.h> 8#include <asm/unistd.h>
9#include "as-layout.h"
9#include "uml-config.h" 10#include "uml-config.h"
10#include "sysdep/sigcontext.h" 11#include "sysdep/sigcontext.h"
11#include "sysdep/faultinfo.h" 12#include "sysdep/faultinfo.h"
@@ -33,7 +34,7 @@ stub_segv_handler(int sig)
33 int pid; 34 int pid;
34 35
35 __asm__ __volatile__("movq %%rdx, %0" : "=g" (uc) :); 36 __asm__ __volatile__("movq %%rdx, %0" : "=g" (uc) :);
36 GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA), 37 GET_FAULTINFO_FROM_SC(*((struct faultinfo *) STUB_DATA),
37 &uc->uc_mcontext); 38 &uc->uc_mcontext);
38 39
39 pid = stub_syscall0(__NR_getpid); 40 pid = stub_syscall0(__NR_getpid);
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c
index b3f6350cac44..86f6b18410ee 100644
--- a/arch/um/sys-x86_64/syscalls.c
+++ b/arch/um/sys-x86_64/syscalls.c
@@ -1,70 +1,36 @@
1/* 1/*
2 * Copyright (C) 2003 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
2 * Copyright 2003 PathScale, Inc. 3 * Copyright 2003 PathScale, Inc.
3 * 4 *
4 * Licensed under the GPL 5 * Licensed under the GPL
5 */ 6 */
6 7
7#include "linux/linkage.h" 8#include "linux/linkage.h"
8#include "linux/slab.h"
9#include "linux/shm.h"
10#include "linux/utsname.h"
11#include "linux/personality.h" 9#include "linux/personality.h"
12#include "asm/uaccess.h" 10#include "linux/utsname.h"
13#define __FRAME_OFFSETS
14#include "asm/ptrace.h"
15#include "asm/unistd.h"
16#include "asm/prctl.h" /* XXX This should get the constants from libc */ 11#include "asm/prctl.h" /* XXX This should get the constants from libc */
17#include "choose-mode.h" 12#include "asm/uaccess.h"
18#include "kern.h"
19#include "os.h" 13#include "os.h"
20 14
21asmlinkage long sys_uname64(struct new_utsname __user * name) 15asmlinkage long sys_uname64(struct new_utsname __user * name)
22{ 16{
23 int err; 17 int err;
18
24 down_read(&uts_sem); 19 down_read(&uts_sem);
25 err = copy_to_user(name, utsname(), sizeof (*name)); 20 err = copy_to_user(name, utsname(), sizeof (*name));
26 up_read(&uts_sem); 21 up_read(&uts_sem);
22
27 if (personality(current->personality) == PER_LINUX32) 23 if (personality(current->personality) == PER_LINUX32)
28 err |= copy_to_user(&name->machine, "i686", 5); 24 err |= copy_to_user(&name->machine, "i686", 5);
29 return err ? -EFAULT : 0;
30}
31
32#ifdef CONFIG_MODE_TT
33extern long arch_prctl(int code, unsigned long addr);
34
35static long arch_prctl_tt(int code, unsigned long addr)
36{
37 unsigned long tmp;
38 long ret;
39
40 switch(code){
41 case ARCH_SET_GS:
42 case ARCH_SET_FS:
43 ret = arch_prctl(code, addr);
44 break;
45 case ARCH_GET_FS:
46 case ARCH_GET_GS:
47 ret = arch_prctl(code, (unsigned long) &tmp);
48 if(!ret)
49 ret = put_user(tmp, (long __user *)addr);
50 break;
51 default:
52 ret = -EINVAL;
53 break;
54 }
55 25
56 return(ret); 26 return err ? -EFAULT : 0;
57} 27}
58#endif
59
60#ifdef CONFIG_MODE_SKAS
61 28
62long arch_prctl_skas(struct task_struct *task, int code, 29long arch_prctl(struct task_struct *task, int code, unsigned long __user *addr)
63 unsigned long __user *addr)
64{ 30{
65 unsigned long *ptr = addr, tmp; 31 unsigned long *ptr = addr, tmp;
66 long ret; 32 long ret;
67 int pid = task->mm->context.skas.id.u.pid; 33 int pid = task->mm->context.id.u.pid;
68 34
69 /* 35 /*
70 * With ARCH_SET_FS (and ARCH_SET_GS is treated similarly to 36 * With ARCH_SET_FS (and ARCH_SET_GS is treated similarly to
@@ -79,52 +45,50 @@ long arch_prctl_skas(struct task_struct *task, int code,
79 * arch_prctl is run on the host, then the registers are read 45 * arch_prctl is run on the host, then the registers are read
80 * back. 46 * back.
81 */ 47 */
82 switch(code){ 48 switch (code) {
83 case ARCH_SET_FS: 49 case ARCH_SET_FS:
84 case ARCH_SET_GS: 50 case ARCH_SET_GS:
85 restore_registers(pid, &current->thread.regs.regs); 51 restore_registers(pid, &current->thread.regs.regs);
86 break; 52 break;
87 case ARCH_GET_FS: 53 case ARCH_GET_FS:
88 case ARCH_GET_GS: 54 case ARCH_GET_GS:
89 /* 55 /*
90 * With these two, we read to a local pointer and 56 * With these two, we read to a local pointer and
91 * put_user it to the userspace pointer that we were 57 * put_user it to the userspace pointer that we were
92 * given. If addr isn't valid (because it hasn't been 58 * given. If addr isn't valid (because it hasn't been
93 * faulted in or is just bogus), we want put_user to 59 * faulted in or is just bogus), we want put_user to
94 * fault it in (or return -EFAULT) instead of having 60 * fault it in (or return -EFAULT) instead of having
95 * the host return -EFAULT. 61 * the host return -EFAULT.
96 */ 62 */
97 ptr = &tmp; 63 ptr = &tmp;
98 } 64 }
99 65
100 ret = os_arch_prctl(pid, code, ptr); 66 ret = os_arch_prctl(pid, code, ptr);
101 if(ret) 67 if (ret)
102 return ret; 68 return ret;
103 69
104 switch(code){ 70 switch (code) {
105 case ARCH_SET_FS: 71 case ARCH_SET_FS:
106 current->thread.arch.fs = (unsigned long) ptr; 72 current->thread.arch.fs = (unsigned long) ptr;
107 save_registers(pid, &current->thread.regs.regs); 73 save_registers(pid, &current->thread.regs.regs);
108 break; 74 break;
109 case ARCH_SET_GS: 75 case ARCH_SET_GS:
110 save_registers(pid, &current->thread.regs.regs); 76 save_registers(pid, &current->thread.regs.regs);
111 break; 77 break;
112 case ARCH_GET_FS: 78 case ARCH_GET_FS:
113 ret = put_user(tmp, addr); 79 ret = put_user(tmp, addr);
114 break; 80 break;
115 case ARCH_GET_GS: 81 case ARCH_GET_GS:
116 ret = put_user(tmp, addr); 82 ret = put_user(tmp, addr);
117 break; 83 break;
118 } 84 }
119 85
120 return ret; 86 return ret;
121} 87}
122#endif
123 88
124long sys_arch_prctl(int code, unsigned long addr) 89long sys_arch_prctl(int code, unsigned long addr)
125{ 90{
126 return CHOOSE_MODE_PROC(arch_prctl_tt, arch_prctl_skas, current, code, 91 return arch_prctl(current, code, (unsigned long __user *) addr);
127 (unsigned long __user *) addr);
128} 92}
129 93
130long sys_clone(unsigned long clone_flags, unsigned long newsp, 94long sys_clone(unsigned long clone_flags, unsigned long newsp,
@@ -141,10 +105,10 @@ long sys_clone(unsigned long clone_flags, unsigned long newsp,
141 return ret; 105 return ret;
142} 106}
143 107
144void arch_switch_to_skas(struct task_struct *from, struct task_struct *to) 108void arch_switch_to(struct task_struct *from, struct task_struct *to)
145{ 109{
146 if((to->thread.arch.fs == 0) || (to->mm == NULL)) 110 if ((to->thread.arch.fs == 0) || (to->mm == NULL))
147 return; 111 return;
148 112
149 arch_prctl_skas(to, ARCH_SET_FS, (void __user *) to->thread.arch.fs); 113 arch_prctl(to, ARCH_SET_FS, (void __user *) to->thread.arch.fs);
150} 114}
diff --git a/arch/um/sys-x86_64/tls.c b/arch/um/sys-x86_64/tls.c
index febbc94be25f..f7ba46200ecd 100644
--- a/arch/um/sys-x86_64/tls.c
+++ b/arch/um/sys-x86_64/tls.c
@@ -11,7 +11,7 @@ int arch_copy_tls(struct task_struct *t)
11 * (which is argument 5, child_tid, of clone) so it can be set 11 * (which is argument 5, child_tid, of clone) so it can be set
12 * during context switches. 12 * during context switches.
13 */ 13 */
14 t->thread.arch.fs = t->thread.regs.regs.skas.regs[R8 / sizeof(long)]; 14 t->thread.arch.fs = t->thread.regs.regs.gp[R8 / sizeof(long)];
15 15
16 return 0; 16 return 0;
17} 17}
diff --git a/arch/um/sys-x86_64/unmap.c b/arch/um/sys-x86_64/unmap.c
deleted file mode 100644
index f4a4bffd8a18..000000000000
--- a/arch/um/sys-x86_64/unmap.c
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <linux/mman.h>
7#include <asm/unistd.h>
8
9static int errno;
10
11static inline _syscall2(int,munmap,void *,start,size_t,len)
12static inline _syscall6(void *,mmap,void *,addr,size_t,len,int,prot,int,flags,int,fd,off_t,offset)
13int switcheroo(int fd, int prot, void *from, void *to, int size)
14{
15 if(munmap(to, size) < 0){
16 return(-1);
17 }
18 if(mmap(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1){
19 return(-1);
20 }
21 if(munmap(from, size) < 0){
22 return(-1);
23 }
24 return(0);
25}
diff --git a/arch/um/sys-x86_64/user-offsets.c b/arch/um/sys-x86_64/user-offsets.c
index 0d5fd764c21f..f1ef2a8dfbc6 100644
--- a/arch/um/sys-x86_64/user-offsets.c
+++ b/arch/um/sys-x86_64/user-offsets.c
@@ -3,17 +3,10 @@
3#include <signal.h> 3#include <signal.h>
4#include <sys/poll.h> 4#include <sys/poll.h>
5#include <sys/mman.h> 5#include <sys/mman.h>
6#include <sys/user.h>
6#define __FRAME_OFFSETS 7#define __FRAME_OFFSETS
7#include <asm/ptrace.h> 8#include <asm/ptrace.h>
8#include <asm/types.h> 9#include <asm/types.h>
9/* For some reason, x86_64 defines u64 and u32 only in <pci/types.h>, which I
10 * refuse to include here, even though they're used throughout the headers.
11 * These are used in asm/user.h, and that include can't be avoided because of
12 * the sizeof(struct user_regs_struct) below.
13 */
14typedef __u64 u64;
15typedef __u32 u32;
16#include <asm/user.h>
17 10
18#define DEFINE(sym, val) \ 11#define DEFINE(sym, val) \
19 asm volatile("\n->" #sym " %0 " #val : : "i" (val)) 12 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
diff --git a/arch/v850/kernel/fpga85e2c.c b/arch/v850/kernel/fpga85e2c.c
index 5c4923558a75..ab9cf16a85c8 100644
--- a/arch/v850/kernel/fpga85e2c.c
+++ b/arch/v850/kernel/fpga85e2c.c
@@ -160,5 +160,8 @@ static void make_reg_snap (int irq, void *dummy, struct pt_regs *regs)
160 160
161static int reg_snap_dev_id; 161static int reg_snap_dev_id;
162static struct irqaction reg_snap_action = { 162static struct irqaction reg_snap_action = {
163 make_reg_snap, 0, CPU_MASK_NONE, "reg_snap", &reg_snap_dev_id, 0 163 .handler = make_reg_snap,
164 .mask = CPU_MASK_NONE,
165 .name = "reg_snap",
166 .dev_id = &reg_snap_dev_id,
164}; 167};
diff --git a/arch/v850/kernel/time.c b/arch/v850/kernel/time.c
index f0905b03523b..d810c93fe665 100644
--- a/arch/v850/kernel/time.c
+++ b/arch/v850/kernel/time.c
@@ -92,12 +92,11 @@ static irqreturn_t timer_interrupt (int irq, void *dummy, struct pt_regs *regs)
92 92
93static int timer_dev_id; 93static int timer_dev_id;
94static struct irqaction timer_irqaction = { 94static struct irqaction timer_irqaction = {
95 timer_interrupt, 95 .handler = timer_interrupt,
96 IRQF_DISABLED, 96 .flags = IRQF_DISABLED,
97 CPU_MASK_NONE, 97 .mask = CPU_MASK_NONE,
98 "timer", 98 .name = "timer",
99 &timer_dev_id, 99 .dev_id = &timer_dev_id,
100 NULL
101}; 100};
102 101
103void time_init (void) 102void time_init (void)
diff --git a/arch/x86/kernel/Makefile_32 b/arch/x86/kernel/Makefile_32
index c624193740fd..7ff02063b858 100644
--- a/arch/x86/kernel/Makefile_32
+++ b/arch/x86/kernel/Makefile_32
@@ -7,7 +7,7 @@ extra-y := head_32.o init_task_32.o vmlinux.lds
7obj-y := process_32.o signal_32.o entry_32.o traps_32.o irq_32.o \ 7obj-y := process_32.o signal_32.o entry_32.o traps_32.o irq_32.o \
8 ptrace_32.o time_32.o ioport_32.o ldt_32.o setup_32.o i8259_32.o sys_i386_32.o \ 8 ptrace_32.o time_32.o ioport_32.o ldt_32.o setup_32.o i8259_32.o sys_i386_32.o \
9 pci-dma_32.o i386_ksyms_32.o i387_32.o bootflag.o e820_32.o\ 9 pci-dma_32.o i386_ksyms_32.o i387_32.o bootflag.o e820_32.o\
10 quirks.o i8237.o topology.o alternative.o i8253_32.o tsc_32.o 10 quirks.o i8237.o topology.o alternative.o i8253.o tsc_32.o
11 11
12obj-$(CONFIG_STACKTRACE) += stacktrace.o 12obj-$(CONFIG_STACKTRACE) += stacktrace.o
13obj-y += cpu/ 13obj-y += cpu/
@@ -37,9 +37,9 @@ obj-$(CONFIG_EFI) += efi_32.o efi_stub_32.o
37obj-$(CONFIG_DOUBLEFAULT) += doublefault_32.o 37obj-$(CONFIG_DOUBLEFAULT) += doublefault_32.o
38obj-$(CONFIG_VM86) += vm86_32.o 38obj-$(CONFIG_VM86) += vm86_32.o
39obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 39obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
40obj-$(CONFIG_HPET_TIMER) += hpet_32.o 40obj-$(CONFIG_HPET_TIMER) += hpet.o
41obj-$(CONFIG_K8_NB) += k8.o 41obj-$(CONFIG_K8_NB) += k8.o
42obj-$(CONFIG_MGEODE_LX) += geode_32.o 42obj-$(CONFIG_MGEODE_LX) += geode_32.o mfgpt_32.o
43 43
44obj-$(CONFIG_VMI) += vmi_32.o vmiclock_32.o 44obj-$(CONFIG_VMI) += vmi_32.o vmiclock_32.o
45obj-$(CONFIG_PARAVIRT) += paravirt_32.o 45obj-$(CONFIG_PARAVIRT) += paravirt_32.o
diff --git a/arch/x86/kernel/Makefile_64 b/arch/x86/kernel/Makefile_64
index 3ab017a0a3b9..43da66213a47 100644
--- a/arch/x86/kernel/Makefile_64
+++ b/arch/x86/kernel/Makefile_64
@@ -8,8 +8,8 @@ obj-y := process_64.o signal_64.o entry_64.o traps_64.o irq_64.o \
8 ptrace_64.o time_64.o ioport_64.o ldt_64.o setup_64.o i8259_64.o sys_x86_64.o \ 8 ptrace_64.o time_64.o ioport_64.o ldt_64.o setup_64.o i8259_64.o sys_x86_64.o \
9 x8664_ksyms_64.o i387_64.o syscall_64.o vsyscall_64.o \ 9 x8664_ksyms_64.o i387_64.o syscall_64.o vsyscall_64.o \
10 setup64.o bootflag.o e820_64.o reboot_64.o quirks.o i8237.o \ 10 setup64.o bootflag.o e820_64.o reboot_64.o quirks.o i8237.o \
11 pci-dma_64.o pci-nommu_64.o alternative.o hpet_64.o tsc_64.o bugs_64.o \ 11 pci-dma_64.o pci-nommu_64.o alternative.o hpet.o tsc_64.o bugs_64.o \
12 perfctr-watchdog.o 12 perfctr-watchdog.o i8253.o
13 13
14obj-$(CONFIG_STACKTRACE) += stacktrace.o 14obj-$(CONFIG_STACKTRACE) += stacktrace.o
15obj-$(CONFIG_X86_MCE) += mce_64.o therm_throt.o 15obj-$(CONFIG_X86_MCE) += mce_64.o therm_throt.o
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index bd72d94e713e..11b03d3c6fda 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -10,6 +10,7 @@
10#include <asm/pgtable.h> 10#include <asm/pgtable.h>
11#include <asm/mce.h> 11#include <asm/mce.h>
12#include <asm/nmi.h> 12#include <asm/nmi.h>
13#include <asm/vsyscall.h>
13 14
14#define MAX_PATCH_LEN (255-1) 15#define MAX_PATCH_LEN (255-1)
15 16
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 925758dbca0c..09b82093bc75 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -25,6 +25,7 @@
25#include <linux/sysdev.h> 25#include <linux/sysdev.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/ioport.h> 27#include <linux/ioport.h>
28#include <linux/clockchips.h>
28 29
29#include <asm/atomic.h> 30#include <asm/atomic.h>
30#include <asm/smp.h> 31#include <asm/smp.h>
@@ -39,12 +40,9 @@
39#include <asm/hpet.h> 40#include <asm/hpet.h>
40#include <asm/apic.h> 41#include <asm/apic.h>
41 42
42int apic_mapped;
43int apic_verbosity; 43int apic_verbosity;
44int apic_runs_main_timer; 44int disable_apic_timer __cpuinitdata;
45int apic_calibrate_pmtmr __initdata; 45static int apic_calibrate_pmtmr __initdata;
46
47int disable_apic_timer __initdata;
48 46
49/* Local APIC timer works in C2? */ 47/* Local APIC timer works in C2? */
50int local_apic_timer_c2_ok; 48int local_apic_timer_c2_ok;
@@ -56,14 +54,78 @@ static struct resource lapic_resource = {
56 .flags = IORESOURCE_MEM | IORESOURCE_BUSY, 54 .flags = IORESOURCE_MEM | IORESOURCE_BUSY,
57}; 55};
58 56
57static unsigned int calibration_result;
58
59static int lapic_next_event(unsigned long delta,
60 struct clock_event_device *evt);
61static void lapic_timer_setup(enum clock_event_mode mode,
62 struct clock_event_device *evt);
63
64static void lapic_timer_broadcast(cpumask_t mask);
65
66static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen);
67
68static struct clock_event_device lapic_clockevent = {
69 .name = "lapic",
70 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT
71 | CLOCK_EVT_FEAT_C3STOP | CLOCK_EVT_FEAT_DUMMY,
72 .shift = 32,
73 .set_mode = lapic_timer_setup,
74 .set_next_event = lapic_next_event,
75 .broadcast = lapic_timer_broadcast,
76 .rating = 100,
77 .irq = -1,
78};
79static DEFINE_PER_CPU(struct clock_event_device, lapic_events);
80
81static int lapic_next_event(unsigned long delta,
82 struct clock_event_device *evt)
83{
84 apic_write(APIC_TMICT, delta);
85 return 0;
86}
87
88static void lapic_timer_setup(enum clock_event_mode mode,
89 struct clock_event_device *evt)
90{
91 unsigned long flags;
92 unsigned int v;
93
94 /* Lapic used as dummy for broadcast ? */
95 if (evt->features & CLOCK_EVT_FEAT_DUMMY)
96 return;
97
98 local_irq_save(flags);
99
100 switch (mode) {
101 case CLOCK_EVT_MODE_PERIODIC:
102 case CLOCK_EVT_MODE_ONESHOT:
103 __setup_APIC_LVTT(calibration_result,
104 mode != CLOCK_EVT_MODE_PERIODIC, 1);
105 break;
106 case CLOCK_EVT_MODE_UNUSED:
107 case CLOCK_EVT_MODE_SHUTDOWN:
108 v = apic_read(APIC_LVTT);
109 v |= (APIC_LVT_MASKED | LOCAL_TIMER_VECTOR);
110 apic_write(APIC_LVTT, v);
111 break;
112 case CLOCK_EVT_MODE_RESUME:
113 /* Nothing to do here */
114 break;
115 }
116
117 local_irq_restore(flags);
118}
119
59/* 120/*
60 * cpu_mask that denotes the CPUs that needs timer interrupt coming in as 121 * Local APIC timer broadcast function
61 * IPIs in place of local APIC timers
62 */ 122 */
63static cpumask_t timer_interrupt_broadcast_ipi_mask; 123static void lapic_timer_broadcast(cpumask_t mask)
64 124{
65/* Using APIC to generate smp_local_timer_interrupt? */ 125#ifdef CONFIG_SMP
66int using_apic_timer __read_mostly = 0; 126 send_IPI_mask(mask, LOCAL_TIMER_VECTOR);
127#endif
128}
67 129
68static void apic_pm_activate(void); 130static void apic_pm_activate(void);
69 131
@@ -184,7 +246,10 @@ void disconnect_bsp_APIC(int virt_wire_setup)
184 apic_write(APIC_SPIV, value); 246 apic_write(APIC_SPIV, value);
185 247
186 if (!virt_wire_setup) { 248 if (!virt_wire_setup) {
187 /* For LVT0 make it edge triggered, active high, external and enabled */ 249 /*
250 * For LVT0 make it edge triggered, active high,
251 * external and enabled
252 */
188 value = apic_read(APIC_LVT0); 253 value = apic_read(APIC_LVT0);
189 value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING | 254 value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING |
190 APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR | 255 APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR |
@@ -420,10 +485,12 @@ void __cpuinit setup_local_APIC (void)
420 value = apic_read(APIC_LVT0) & APIC_LVT_MASKED; 485 value = apic_read(APIC_LVT0) & APIC_LVT_MASKED;
421 if (!smp_processor_id() && !value) { 486 if (!smp_processor_id() && !value) {
422 value = APIC_DM_EXTINT; 487 value = APIC_DM_EXTINT;
423 apic_printk(APIC_VERBOSE, "enabled ExtINT on CPU#%d\n", smp_processor_id()); 488 apic_printk(APIC_VERBOSE, "enabled ExtINT on CPU#%d\n",
489 smp_processor_id());
424 } else { 490 } else {
425 value = APIC_DM_EXTINT | APIC_LVT_MASKED; 491 value = APIC_DM_EXTINT | APIC_LVT_MASKED;
426 apic_printk(APIC_VERBOSE, "masked ExtINT on CPU#%d\n", smp_processor_id()); 492 apic_printk(APIC_VERBOSE, "masked ExtINT on CPU#%d\n",
493 smp_processor_id());
427 } 494 }
428 apic_write(APIC_LVT0, value); 495 apic_write(APIC_LVT0, value);
429 496
@@ -706,8 +773,8 @@ void __init init_apic_mappings(void)
706 apic_phys = mp_lapic_addr; 773 apic_phys = mp_lapic_addr;
707 774
708 set_fixmap_nocache(FIX_APIC_BASE, apic_phys); 775 set_fixmap_nocache(FIX_APIC_BASE, apic_phys);
709 apic_mapped = 1; 776 apic_printk(APIC_VERBOSE, "mapped APIC to %16lx (%16lx)\n",
710 apic_printk(APIC_VERBOSE,"mapped APIC to %16lx (%16lx)\n", APIC_BASE, apic_phys); 777 APIC_BASE, apic_phys);
711 778
712 /* Put local APIC into the resource map. */ 779 /* Put local APIC into the resource map. */
713 lapic_resource.start = apic_phys; 780 lapic_resource.start = apic_phys;
@@ -730,12 +797,14 @@ void __init init_apic_mappings(void)
730 if (smp_found_config) { 797 if (smp_found_config) {
731 ioapic_phys = mp_ioapics[i].mpc_apicaddr; 798 ioapic_phys = mp_ioapics[i].mpc_apicaddr;
732 } else { 799 } else {
733 ioapic_phys = (unsigned long) alloc_bootmem_pages(PAGE_SIZE); 800 ioapic_phys = (unsigned long)
801 alloc_bootmem_pages(PAGE_SIZE);
734 ioapic_phys = __pa(ioapic_phys); 802 ioapic_phys = __pa(ioapic_phys);
735 } 803 }
736 set_fixmap_nocache(idx, ioapic_phys); 804 set_fixmap_nocache(idx, ioapic_phys);
737 apic_printk(APIC_VERBOSE,"mapped IOAPIC to %016lx (%016lx)\n", 805 apic_printk(APIC_VERBOSE,
738 __fix_to_virt(idx), ioapic_phys); 806 "mapped IOAPIC to %016lx (%016lx)\n",
807 __fix_to_virt(idx), ioapic_phys);
739 idx++; 808 idx++;
740 809
741 if (ioapic_res != NULL) { 810 if (ioapic_res != NULL) {
@@ -758,16 +827,14 @@ void __init init_apic_mappings(void)
758 * P5 APIC double write bug. 827 * P5 APIC double write bug.
759 */ 828 */
760 829
761#define APIC_DIVISOR 16 830static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen)
762
763static void __setup_APIC_LVTT(unsigned int clocks)
764{ 831{
765 unsigned int lvtt_value, tmp_value; 832 unsigned int lvtt_value, tmp_value;
766 int cpu = smp_processor_id();
767 833
768 lvtt_value = APIC_LVT_TIMER_PERIODIC | LOCAL_TIMER_VECTOR; 834 lvtt_value = LOCAL_TIMER_VECTOR;
769 835 if (!oneshot)
770 if (cpu_isset(cpu, timer_interrupt_broadcast_ipi_mask)) 836 lvtt_value |= APIC_LVT_TIMER_PERIODIC;
837 if (!irqen)
771 lvtt_value |= APIC_LVT_MASKED; 838 lvtt_value |= APIC_LVT_MASKED;
772 839
773 apic_write(APIC_LVTT, lvtt_value); 840 apic_write(APIC_LVTT, lvtt_value);
@@ -780,44 +847,18 @@ static void __setup_APIC_LVTT(unsigned int clocks)
780 & ~(APIC_TDR_DIV_1 | APIC_TDR_DIV_TMBASE)) 847 & ~(APIC_TDR_DIV_1 | APIC_TDR_DIV_TMBASE))
781 | APIC_TDR_DIV_16); 848 | APIC_TDR_DIV_16);
782 849
783 apic_write(APIC_TMICT, clocks/APIC_DIVISOR); 850 if (!oneshot)
851 apic_write(APIC_TMICT, clocks);
784} 852}
785 853
786static void setup_APIC_timer(unsigned int clocks) 854static void setup_APIC_timer(void)
787{ 855{
788 unsigned long flags; 856 struct clock_event_device *levt = &__get_cpu_var(lapic_events);
789 857
790 local_irq_save(flags); 858 memcpy(levt, &lapic_clockevent, sizeof(*levt));
859 levt->cpumask = cpumask_of_cpu(smp_processor_id());
791 860
792 /* wait for irq slice */ 861 clockevents_register_device(levt);
793 if (hpet_address && hpet_use_timer) {
794 u32 trigger = hpet_readl(HPET_T0_CMP);
795 while (hpet_readl(HPET_T0_CMP) == trigger)
796 /* do nothing */ ;
797 } else {
798 int c1, c2;
799 outb_p(0x00, 0x43);
800 c2 = inb_p(0x40);
801 c2 |= inb_p(0x40) << 8;
802 do {
803 c1 = c2;
804 outb_p(0x00, 0x43);
805 c2 = inb_p(0x40);
806 c2 |= inb_p(0x40) << 8;
807 } while (c2 - c1 < 300);
808 }
809 __setup_APIC_LVTT(clocks);
810 /* Turn off PIT interrupt if we use APIC timer as main timer.
811 Only works with the PM timer right now
812 TBD fix it for HPET too. */
813 if ((pmtmr_ioport != 0) &&
814 smp_processor_id() == boot_cpu_id &&
815 apic_runs_main_timer == 1 &&
816 !cpu_isset(boot_cpu_id, timer_interrupt_broadcast_ipi_mask)) {
817 stop_timer_interrupt();
818 apic_runs_main_timer++;
819 }
820 local_irq_restore(flags);
821} 862}
822 863
823/* 864/*
@@ -835,17 +876,22 @@ static void setup_APIC_timer(unsigned int clocks)
835 876
836#define TICK_COUNT 100000000 877#define TICK_COUNT 100000000
837 878
838static int __init calibrate_APIC_clock(void) 879static void __init calibrate_APIC_clock(void)
839{ 880{
840 unsigned apic, apic_start; 881 unsigned apic, apic_start;
841 unsigned long tsc, tsc_start; 882 unsigned long tsc, tsc_start;
842 int result; 883 int result;
884
885 local_irq_disable();
886
843 /* 887 /*
844 * Put whatever arbitrary (but long enough) timeout 888 * Put whatever arbitrary (but long enough) timeout
845 * value into the APIC clock, we just want to get the 889 * value into the APIC clock, we just want to get the
846 * counter running for calibration. 890 * counter running for calibration.
891 *
892 * No interrupt enable !
847 */ 893 */
848 __setup_APIC_LVTT(4000000000); 894 __setup_APIC_LVTT(250000000, 0, 0);
849 895
850 apic_start = apic_read(APIC_TMCCT); 896 apic_start = apic_read(APIC_TMCCT);
851#ifdef CONFIG_X86_PM_TIMER 897#ifdef CONFIG_X86_PM_TIMER
@@ -867,123 +913,88 @@ static int __init calibrate_APIC_clock(void)
867 result = (apic_start - apic) * 1000L * tsc_khz / 913 result = (apic_start - apic) * 1000L * tsc_khz /
868 (tsc - tsc_start); 914 (tsc - tsc_start);
869 } 915 }
870 printk("result %d\n", result);
871 916
917 local_irq_enable();
918
919 printk(KERN_DEBUG "APIC timer calibration result %d\n", result);
872 920
873 printk(KERN_INFO "Detected %d.%03d MHz APIC timer.\n", 921 printk(KERN_INFO "Detected %d.%03d MHz APIC timer.\n",
874 result / 1000 / 1000, result / 1000 % 1000); 922 result / 1000 / 1000, result / 1000 % 1000);
875 923
876 return result * APIC_DIVISOR / HZ; 924 /* Calculate the scaled math multiplication factor */
877} 925 lapic_clockevent.mult = div_sc(result, NSEC_PER_SEC, 32);
926 lapic_clockevent.max_delta_ns =
927 clockevent_delta2ns(0x7FFFFF, &lapic_clockevent);
928 lapic_clockevent.min_delta_ns =
929 clockevent_delta2ns(0xF, &lapic_clockevent);
878 930
879static unsigned int calibration_result; 931 calibration_result = result / HZ;
932}
880 933
881void __init setup_boot_APIC_clock (void) 934void __init setup_boot_APIC_clock (void)
882{ 935{
936 /*
937 * The local apic timer can be disabled via the kernel commandline.
938 * Register the lapic timer as a dummy clock event source on SMP
939 * systems, so the broadcast mechanism is used. On UP systems simply
940 * ignore it.
941 */
883 if (disable_apic_timer) { 942 if (disable_apic_timer) {
884 printk(KERN_INFO "Disabling APIC timer\n"); 943 printk(KERN_INFO "Disabling APIC timer\n");
944 /* No broadcast on UP ! */
945 if (num_possible_cpus() > 1)
946 setup_APIC_timer();
885 return; 947 return;
886 } 948 }
887 949
888 printk(KERN_INFO "Using local APIC timer interrupts.\n"); 950 printk(KERN_INFO "Using local APIC timer interrupts.\n");
889 using_apic_timer = 1; 951 calibrate_APIC_clock();
890
891 local_irq_disable();
892 952
893 calibration_result = calibrate_APIC_clock();
894 /* 953 /*
895 * Now set up the timer for real. 954 * If nmi_watchdog is set to IO_APIC, we need the
955 * PIT/HPET going. Otherwise register lapic as a dummy
956 * device.
896 */ 957 */
897 setup_APIC_timer(calibration_result); 958 if (nmi_watchdog != NMI_IO_APIC)
898 959 lapic_clockevent.features &= ~CLOCK_EVT_FEAT_DUMMY;
899 local_irq_enable(); 960 else
900} 961 printk(KERN_WARNING "APIC timer registered as dummy,"
901 962 " due to nmi_watchdog=1!\n");
902void __cpuinit setup_secondary_APIC_clock(void)
903{
904 local_irq_disable(); /* FIXME: Do we need this? --RR */
905 setup_APIC_timer(calibration_result);
906 local_irq_enable();
907}
908
909void disable_APIC_timer(void)
910{
911 if (using_apic_timer) {
912 unsigned long v;
913 963
914 v = apic_read(APIC_LVTT); 964 setup_APIC_timer();
915 /*
916 * When an illegal vector value (0-15) is written to an LVT
917 * entry and delivery mode is Fixed, the APIC may signal an
918 * illegal vector error, with out regard to whether the mask
919 * bit is set or whether an interrupt is actually seen on input.
920 *
921 * Boot sequence might call this function when the LVTT has
922 * '0' vector value. So make sure vector field is set to
923 * valid value.
924 */
925 v |= (APIC_LVT_MASKED | LOCAL_TIMER_VECTOR);
926 apic_write(APIC_LVTT, v);
927 }
928} 965}
929 966
930void enable_APIC_timer(void) 967/*
968 * AMD C1E enabled CPUs have a real nasty problem: Some BIOSes set the
969 * C1E flag only in the secondary CPU, so when we detect the wreckage
970 * we already have enabled the boot CPU local apic timer. Check, if
971 * disable_apic_timer is set and the DUMMY flag is cleared. If yes,
972 * set the DUMMY flag again and force the broadcast mode in the
973 * clockevents layer.
974 */
975void __cpuinit check_boot_apic_timer_broadcast(void)
931{ 976{
932 int cpu = smp_processor_id(); 977 struct clock_event_device *levt = &per_cpu(lapic_events, boot_cpu_id);
933 978
934 if (using_apic_timer && 979 if (!disable_apic_timer ||
935 !cpu_isset(cpu, timer_interrupt_broadcast_ipi_mask)) { 980 (lapic_clockevent.features & CLOCK_EVT_FEAT_DUMMY))
936 unsigned long v; 981 return;
937 982
938 v = apic_read(APIC_LVTT); 983 printk(KERN_INFO "AMD C1E detected late. Force timer broadcast.\n");
939 apic_write(APIC_LVTT, v & ~APIC_LVT_MASKED); 984 lapic_clockevent.features |= CLOCK_EVT_FEAT_DUMMY;
940 } 985 levt->features |= CLOCK_EVT_FEAT_DUMMY;
941}
942 986
943void switch_APIC_timer_to_ipi(void *cpumask) 987 local_irq_enable();
944{ 988 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_FORCE, &boot_cpu_id);
945 cpumask_t mask = *(cpumask_t *)cpumask; 989 local_irq_disable();
946 int cpu = smp_processor_id();
947
948 if (cpu_isset(cpu, mask) &&
949 !cpu_isset(cpu, timer_interrupt_broadcast_ipi_mask)) {
950 disable_APIC_timer();
951 cpu_set(cpu, timer_interrupt_broadcast_ipi_mask);
952 }
953} 990}
954EXPORT_SYMBOL(switch_APIC_timer_to_ipi);
955 991
956void smp_send_timer_broadcast_ipi(void) 992void __cpuinit setup_secondary_APIC_clock(void)
957{ 993{
958 int cpu = smp_processor_id(); 994 check_boot_apic_timer_broadcast();
959 cpumask_t mask; 995 setup_APIC_timer();
960
961 cpus_and(mask, cpu_online_map, timer_interrupt_broadcast_ipi_mask);
962
963 if (cpu_isset(cpu, mask)) {
964 cpu_clear(cpu, mask);
965 add_pda(apic_timer_irqs, 1);
966 smp_local_timer_interrupt();
967 }
968
969 if (!cpus_empty(mask)) {
970 send_IPI_mask(mask, LOCAL_TIMER_VECTOR);
971 }
972} 996}
973 997
974void switch_ipi_to_APIC_timer(void *cpumask)
975{
976 cpumask_t mask = *(cpumask_t *)cpumask;
977 int cpu = smp_processor_id();
978
979 if (cpu_isset(cpu, mask) &&
980 cpu_isset(cpu, timer_interrupt_broadcast_ipi_mask)) {
981 cpu_clear(cpu, timer_interrupt_broadcast_ipi_mask);
982 enable_APIC_timer();
983 }
984}
985EXPORT_SYMBOL(switch_ipi_to_APIC_timer);
986
987int setup_profiling_timer(unsigned int multiplier) 998int setup_profiling_timer(unsigned int multiplier)
988{ 999{
989 return -EINVAL; 1000 return -EINVAL;
@@ -997,8 +1008,6 @@ void setup_APIC_extended_lvt(unsigned char lvt_off, unsigned char vector,
997 apic_write(reg, v); 1008 apic_write(reg, v);
998} 1009}
999 1010
1000#undef APIC_DIVISOR
1001
1002/* 1011/*
1003 * Local timer interrupt handler. It does both profiling and 1012 * Local timer interrupt handler. It does both profiling and
1004 * process statistics/rescheduling. 1013 * process statistics/rescheduling.
@@ -1011,22 +1020,34 @@ void setup_APIC_extended_lvt(unsigned char lvt_off, unsigned char vector,
1011 1020
1012void smp_local_timer_interrupt(void) 1021void smp_local_timer_interrupt(void)
1013{ 1022{
1014 profile_tick(CPU_PROFILING); 1023 int cpu = smp_processor_id();
1015#ifdef CONFIG_SMP 1024 struct clock_event_device *evt = &per_cpu(lapic_events, cpu);
1016 update_process_times(user_mode(get_irq_regs())); 1025
1017#endif
1018 if (apic_runs_main_timer > 1 && smp_processor_id() == boot_cpu_id)
1019 main_timer_handler();
1020 /* 1026 /*
1021 * We take the 'long' return path, and there every subsystem 1027 * Normally we should not be here till LAPIC has been initialized but
1022 * grabs the appropriate locks (kernel lock/ irq lock). 1028 * in some cases like kdump, its possible that there is a pending LAPIC
1029 * timer interrupt from previous kernel's context and is delivered in
1030 * new kernel the moment interrupts are enabled.
1023 * 1031 *
1024 * We might want to decouple profiling from the 'long path', 1032 * Interrupts are enabled early and LAPIC is setup much later, hence
1025 * and do the profiling totally in assembly. 1033 * its possible that when we get here evt->event_handler is NULL.
1026 * 1034 * Check for event_handler being NULL and discard the interrupt as
1027 * Currently this isn't too much of an issue (performance wise), 1035 * spurious.
1028 * we can take more than 100K local irqs per second on a 100 MHz P5. 1036 */
1037 if (!evt->event_handler) {
1038 printk(KERN_WARNING
1039 "Spurious LAPIC timer interrupt on cpu %d\n", cpu);
1040 /* Switch it off */
1041 lapic_timer_setup(CLOCK_EVT_MODE_SHUTDOWN, evt);
1042 return;
1043 }
1044
1045 /*
1046 * the NMI deadlock-detector uses this.
1029 */ 1047 */
1048 add_pda(apic_timer_irqs, 1);
1049
1050 evt->event_handler(evt);
1030} 1051}
1031 1052
1032/* 1053/*
@@ -1042,11 +1063,6 @@ void smp_apic_timer_interrupt(struct pt_regs *regs)
1042 struct pt_regs *old_regs = set_irq_regs(regs); 1063 struct pt_regs *old_regs = set_irq_regs(regs);
1043 1064
1044 /* 1065 /*
1045 * the NMI deadlock-detector uses this.
1046 */
1047 add_pda(apic_timer_irqs, 1);
1048
1049 /*
1050 * NOTE! We'd better ACK the irq immediately, 1066 * NOTE! We'd better ACK the irq immediately,
1051 * because timer handling can be slow. 1067 * because timer handling can be slow.
1052 */ 1068 */
@@ -1225,29 +1241,13 @@ static __init int setup_noapictimer(char *str)
1225 disable_apic_timer = 1; 1241 disable_apic_timer = 1;
1226 return 1; 1242 return 1;
1227} 1243}
1228 1244__setup("noapictimer", setup_noapictimer);
1229static __init int setup_apicmaintimer(char *str)
1230{
1231 apic_runs_main_timer = 1;
1232 nohpet = 1;
1233 return 1;
1234}
1235__setup("apicmaintimer", setup_apicmaintimer);
1236
1237static __init int setup_noapicmaintimer(char *str)
1238{
1239 apic_runs_main_timer = -1;
1240 return 1;
1241}
1242__setup("noapicmaintimer", setup_noapicmaintimer);
1243 1245
1244static __init int setup_apicpmtimer(char *s) 1246static __init int setup_apicpmtimer(char *s)
1245{ 1247{
1246 apic_calibrate_pmtmr = 1; 1248 apic_calibrate_pmtmr = 1;
1247 notsc_setup(NULL); 1249 notsc_setup(NULL);
1248 return setup_apicmaintimer(NULL); 1250 return 0;
1249} 1251}
1250__setup("apicpmtimer", setup_apicpmtimer); 1252__setup("apicpmtimer", setup_apicpmtimer);
1251 1253
1252__setup("noapictimer", setup_noapictimer);
1253
diff --git a/arch/x86/kernel/bugs_64.c b/arch/x86/kernel/bugs_64.c
index 4e5e9d364d63..9a189cef6404 100644
--- a/arch/x86/kernel/bugs_64.c
+++ b/arch/x86/kernel/bugs_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/x86_64/kernel/bugs.c
3 *
4 * Copyright (C) 1994 Linus Torvalds 2 * Copyright (C) 1994 Linus Torvalds
5 * Copyright (C) 2000 SuSE 3 * Copyright (C) 2000 SuSE
6 */ 4 */
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 59266f03d1cd..205fd5ba57f7 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/i386/cpu/bugs.c
3 *
4 * Copyright (C) 1994 Linus Torvalds 2 * Copyright (C) 1994 Linus Torvalds
5 * 3 *
6 * Cyrix stuff, June 1998 by: 4 * Cyrix stuff, June 1998 by:
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
index b6434a7ef8b2..2ca43ba32bc0 100644
--- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -595,7 +595,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
595 dmi_check_system(sw_any_bug_dmi_table); 595 dmi_check_system(sw_any_bug_dmi_table);
596 if (bios_with_sw_any_bug && cpus_weight(policy->cpus) == 1) { 596 if (bios_with_sw_any_bug && cpus_weight(policy->cpus) == 1) {
597 policy->shared_type = CPUFREQ_SHARED_TYPE_ALL; 597 policy->shared_type = CPUFREQ_SHARED_TYPE_ALL;
598 policy->cpus = cpu_core_map[cpu]; 598 policy->cpus = per_cpu(cpu_core_map, cpu);
599 } 599 }
600#endif 600#endif
601 601
@@ -646,7 +646,6 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
646 policy->cpuinfo.transition_latency = 646 policy->cpuinfo.transition_latency =
647 perf->states[i].transition_latency * 1000; 647 perf->states[i].transition_latency * 1000;
648 } 648 }
649 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
650 649
651 data->max_freq = perf->states[0].core_frequency * 1000; 650 data->max_freq = perf->states[0].core_frequency * 1000;
652 /* table init */ 651 /* table init */
diff --git a/arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c b/arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c
index 66acd5039918..32f0bda3fc95 100644
--- a/arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c
+++ b/arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c
@@ -363,7 +363,6 @@ static int nforce2_cpu_init(struct cpufreq_policy *policy)
363 policy->cur = nforce2_get(policy->cpu); 363 policy->cur = nforce2_get(policy->cpu);
364 policy->min = policy->cpuinfo.min_freq; 364 policy->min = policy->cpuinfo.min_freq;
365 policy->max = policy->cpuinfo.max_freq; 365 policy->max = policy->cpuinfo.max_freq;
366 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
367 366
368 return 0; 367 return 0;
369} 368}
diff --git a/arch/x86/kernel/cpu/cpufreq/e_powersaver.c b/arch/x86/kernel/cpu/cpufreq/e_powersaver.c
index f43d98e11cc7..c11baaf9f2b4 100644
--- a/arch/x86/kernel/cpu/cpufreq/e_powersaver.c
+++ b/arch/x86/kernel/cpu/cpufreq/e_powersaver.c
@@ -253,7 +253,6 @@ static int eps_cpu_init(struct cpufreq_policy *policy)
253 f_table[k].frequency = CPUFREQ_TABLE_END; 253 f_table[k].frequency = CPUFREQ_TABLE_END;
254 } 254 }
255 255
256 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
257 policy->cpuinfo.transition_latency = 140000; /* 844mV -> 700mV in ns */ 256 policy->cpuinfo.transition_latency = 140000; /* 844mV -> 700mV in ns */
258 policy->cur = fsb * current_multiplier; 257 policy->cur = fsb * current_multiplier;
259 258
diff --git a/arch/x86/kernel/cpu/cpufreq/elanfreq.c b/arch/x86/kernel/cpu/cpufreq/elanfreq.c
index f317276afa7a..1e7ae7dafcf6 100644
--- a/arch/x86/kernel/cpu/cpufreq/elanfreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/elanfreq.c
@@ -219,7 +219,6 @@ static int elanfreq_cpu_init(struct cpufreq_policy *policy)
219 } 219 }
220 220
221 /* cpuinfo and default policy values */ 221 /* cpuinfo and default policy values */
222 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
223 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; 222 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
224 policy->cur = elanfreq_get_cpu_frequency(0); 223 policy->cur = elanfreq_get_cpu_frequency(0);
225 224
diff --git a/arch/x86/kernel/cpu/cpufreq/gx-suspmod.c b/arch/x86/kernel/cpu/cpufreq/gx-suspmod.c
index 461dabc4e495..ed2bda127c44 100644
--- a/arch/x86/kernel/cpu/cpufreq/gx-suspmod.c
+++ b/arch/x86/kernel/cpu/cpufreq/gx-suspmod.c
@@ -420,7 +420,6 @@ static int cpufreq_gx_cpu_init(struct cpufreq_policy *policy)
420 policy->min = maxfreq / POLICY_MIN_DIV; 420 policy->min = maxfreq / POLICY_MIN_DIV;
421 policy->max = maxfreq; 421 policy->max = maxfreq;
422 policy->cur = curfreq; 422 policy->cur = curfreq;
423 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
424 policy->cpuinfo.min_freq = maxfreq / max_duration; 423 policy->cpuinfo.min_freq = maxfreq / max_duration;
425 policy->cpuinfo.max_freq = maxfreq; 424 policy->cpuinfo.max_freq = maxfreq;
426 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; 425 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
diff --git a/arch/x86/kernel/cpu/cpufreq/longhaul.c b/arch/x86/kernel/cpu/cpufreq/longhaul.c
index f0cce3c2dc3a..5045f5d583c8 100644
--- a/arch/x86/kernel/cpu/cpufreq/longhaul.c
+++ b/arch/x86/kernel/cpu/cpufreq/longhaul.c
@@ -710,6 +710,10 @@ static int enable_arbiter_disable(void)
710 reg = 0x78; 710 reg = 0x78;
711 dev = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8601_0, 711 dev = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8601_0,
712 NULL); 712 NULL);
713 /* Find PM133/VT8605 host bridge */
714 if (dev == NULL)
715 dev = pci_get_device(PCI_VENDOR_ID_VIA,
716 PCI_DEVICE_ID_VIA_8605_0, NULL);
713 /* Find CLE266 host bridge */ 717 /* Find CLE266 host bridge */
714 if (dev == NULL) { 718 if (dev == NULL) {
715 reg = 0x76; 719 reg = 0x76;
@@ -918,7 +922,6 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
918 if ((longhaul_version != TYPE_LONGHAUL_V1) && (scale_voltage != 0)) 922 if ((longhaul_version != TYPE_LONGHAUL_V1) && (scale_voltage != 0))
919 longhaul_setup_voltagescaling(); 923 longhaul_setup_voltagescaling();
920 924
921 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
922 policy->cpuinfo.transition_latency = 200000; /* nsec */ 925 policy->cpuinfo.transition_latency = 200000; /* nsec */
923 policy->cur = calc_speed(longhaul_get_cpu_mult()); 926 policy->cur = calc_speed(longhaul_get_cpu_mult());
924 927
diff --git a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
index 4c76b511e194..793eae854f4f 100644
--- a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
+++ b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
@@ -200,7 +200,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
200 unsigned int i; 200 unsigned int i;
201 201
202#ifdef CONFIG_SMP 202#ifdef CONFIG_SMP
203 policy->cpus = cpu_sibling_map[policy->cpu]; 203 policy->cpus = per_cpu(cpu_sibling_map, policy->cpu);
204#endif 204#endif
205 205
206 /* Errata workaround */ 206 /* Errata workaround */
@@ -229,7 +229,6 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
229 cpufreq_frequency_table_get_attr(p4clockmod_table, policy->cpu); 229 cpufreq_frequency_table_get_attr(p4clockmod_table, policy->cpu);
230 230
231 /* cpuinfo and default policy values */ 231 /* cpuinfo and default policy values */
232 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
233 policy->cpuinfo.transition_latency = 1000000; /* assumed */ 232 policy->cpuinfo.transition_latency = 1000000; /* assumed */
234 policy->cur = stock_freq; 233 policy->cur = stock_freq;
235 234
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k6.c b/arch/x86/kernel/cpu/cpufreq/powernow-k6.c
index f89524051e4a..6d0285339317 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k6.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k6.c
@@ -160,7 +160,6 @@ static int powernow_k6_cpu_init(struct cpufreq_policy *policy)
160 } 160 }
161 161
162 /* cpuinfo and default policy values */ 162 /* cpuinfo and default policy values */
163 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
164 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; 163 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
165 policy->cur = busfreq * max_multiplier; 164 policy->cur = busfreq * max_multiplier;
166 165
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k7.c b/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
index ca3e1d341889..7decd6a50ffa 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
@@ -637,8 +637,6 @@ static int __init powernow_cpu_init (struct cpufreq_policy *policy)
637 printk (KERN_INFO PFX "Minimum speed %d MHz. Maximum speed %d MHz.\n", 637 printk (KERN_INFO PFX "Minimum speed %d MHz. Maximum speed %d MHz.\n",
638 minimum_speed/1000, maximum_speed/1000); 638 minimum_speed/1000, maximum_speed/1000);
639 639
640 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
641
642 policy->cpuinfo.transition_latency = cpufreq_scale(2000000UL, fsb, latency); 640 policy->cpuinfo.transition_latency = cpufreq_scale(2000000UL, fsb, latency);
643 641
644 policy->cur = powernow_get(0); 642 policy->cur = powernow_get(0);
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index 34ed53a06730..c06ac680c9ca 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -57,7 +57,7 @@ static struct powernow_k8_data *powernow_data[NR_CPUS];
57static int cpu_family = CPU_OPTERON; 57static int cpu_family = CPU_OPTERON;
58 58
59#ifndef CONFIG_SMP 59#ifndef CONFIG_SMP
60static cpumask_t cpu_core_map[1]; 60DEFINE_PER_CPU(cpumask_t, cpu_core_map);
61#endif 61#endif
62 62
63/* Return a frequency in MHz, given an input fid */ 63/* Return a frequency in MHz, given an input fid */
@@ -76,7 +76,10 @@ static u32 find_khz_freq_from_fid(u32 fid)
76/* Return a frequency in MHz, given an input fid and did */ 76/* Return a frequency in MHz, given an input fid and did */
77static u32 find_freq_from_fiddid(u32 fid, u32 did) 77static u32 find_freq_from_fiddid(u32 fid, u32 did)
78{ 78{
79 return 100 * (fid + 0x10) >> did; 79 if (current_cpu_data.x86 == 0x10)
80 return 100 * (fid + 0x10) >> did;
81 else
82 return 100 * (fid + 0x8) >> did;
80} 83}
81 84
82static u32 find_khz_freq_from_fiddid(u32 fid, u32 did) 85static u32 find_khz_freq_from_fiddid(u32 fid, u32 did)
@@ -664,7 +667,7 @@ static int fill_powernow_table(struct powernow_k8_data *data, struct pst_s *pst,
664 667
665 dprintk("cfid 0x%x, cvid 0x%x\n", data->currfid, data->currvid); 668 dprintk("cfid 0x%x, cvid 0x%x\n", data->currfid, data->currvid);
666 data->powernow_table = powernow_table; 669 data->powernow_table = powernow_table;
667 if (first_cpu(cpu_core_map[data->cpu]) == data->cpu) 670 if (first_cpu(per_cpu(cpu_core_map, data->cpu)) == data->cpu)
668 print_basics(data); 671 print_basics(data);
669 672
670 for (j = 0; j < data->numps; j++) 673 for (j = 0; j < data->numps; j++)
@@ -818,7 +821,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
818 821
819 /* fill in data */ 822 /* fill in data */
820 data->numps = data->acpi_data.state_count; 823 data->numps = data->acpi_data.state_count;
821 if (first_cpu(cpu_core_map[data->cpu]) == data->cpu) 824 if (first_cpu(per_cpu(cpu_core_map, data->cpu)) == data->cpu)
822 print_basics(data); 825 print_basics(data);
823 powernow_k8_acpi_pst_values(data, 0); 826 powernow_k8_acpi_pst_values(data, 0);
824 827
@@ -1208,11 +1211,10 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1208 /* run on any CPU again */ 1211 /* run on any CPU again */
1209 set_cpus_allowed(current, oldmask); 1212 set_cpus_allowed(current, oldmask);
1210 1213
1211 pol->governor = CPUFREQ_DEFAULT_GOVERNOR;
1212 if (cpu_family == CPU_HW_PSTATE) 1214 if (cpu_family == CPU_HW_PSTATE)
1213 pol->cpus = cpumask_of_cpu(pol->cpu); 1215 pol->cpus = cpumask_of_cpu(pol->cpu);
1214 else 1216 else
1215 pol->cpus = cpu_core_map[pol->cpu]; 1217 pol->cpus = per_cpu(cpu_core_map, pol->cpu);
1216 data->available_cores = &(pol->cpus); 1218 data->available_cores = &(pol->cpus);
1217 1219
1218 /* Take a crude guess here. 1220 /* Take a crude guess here.
@@ -1279,7 +1281,7 @@ static unsigned int powernowk8_get (unsigned int cpu)
1279 cpumask_t oldmask = current->cpus_allowed; 1281 cpumask_t oldmask = current->cpus_allowed;
1280 unsigned int khz = 0; 1282 unsigned int khz = 0;
1281 1283
1282 data = powernow_data[first_cpu(cpu_core_map[cpu])]; 1284 data = powernow_data[first_cpu(per_cpu(cpu_core_map, cpu))];
1283 1285
1284 if (!data) 1286 if (!data)
1285 return -EINVAL; 1287 return -EINVAL;
@@ -1325,21 +1327,16 @@ static struct cpufreq_driver cpufreq_amd64_driver = {
1325static int __cpuinit powernowk8_init(void) 1327static int __cpuinit powernowk8_init(void)
1326{ 1328{
1327 unsigned int i, supported_cpus = 0; 1329 unsigned int i, supported_cpus = 0;
1328 unsigned int booted_cores = 1;
1329 1330
1330 for_each_online_cpu(i) { 1331 for_each_online_cpu(i) {
1331 if (check_supported_cpu(i)) 1332 if (check_supported_cpu(i))
1332 supported_cpus++; 1333 supported_cpus++;
1333 } 1334 }
1334 1335
1335#ifdef CONFIG_SMP
1336 booted_cores = cpu_data[0].booted_cores;
1337#endif
1338
1339 if (supported_cpus == num_online_cpus()) { 1336 if (supported_cpus == num_online_cpus()) {
1340 printk(KERN_INFO PFX "Found %d %s " 1337 printk(KERN_INFO PFX "Found %d %s "
1341 "processors (%d cpu cores) (" VERSION ")\n", 1338 "processors (%d cpu cores) (" VERSION ")\n",
1342 supported_cpus/booted_cores, 1339 num_online_nodes(),
1343 boot_cpu_data.x86_model_id, supported_cpus); 1340 boot_cpu_data.x86_model_id, supported_cpus);
1344 return cpufreq_register_driver(&cpufreq_amd64_driver); 1341 return cpufreq_register_driver(&cpufreq_amd64_driver);
1345 } 1342 }
diff --git a/arch/x86/kernel/cpu/cpufreq/sc520_freq.c b/arch/x86/kernel/cpu/cpufreq/sc520_freq.c
index b8fb4b521c62..d9f3e90a7ae0 100644
--- a/arch/x86/kernel/cpu/cpufreq/sc520_freq.c
+++ b/arch/x86/kernel/cpu/cpufreq/sc520_freq.c
@@ -111,7 +111,6 @@ static int sc520_freq_cpu_init(struct cpufreq_policy *policy)
111 return -ENODEV; 111 return -ENODEV;
112 112
113 /* cpuinfo and default policy values */ 113 /* cpuinfo and default policy values */
114 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
115 policy->cpuinfo.transition_latency = 1000000; /* 1ms */ 114 policy->cpuinfo.transition_latency = 1000000; /* 1ms */
116 policy->cur = sc520_freq_get_cpu_frequency(0); 115 policy->cur = sc520_freq_get_cpu_frequency(0);
117 116
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
index 6c5dc2c85aeb..811d47438546 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -393,7 +393,6 @@ static int centrino_cpu_init(struct cpufreq_policy *policy)
393 393
394 freq = get_cur_freq(policy->cpu); 394 freq = get_cur_freq(policy->cpu);
395 395
396 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
397 policy->cpuinfo.transition_latency = 10000; /* 10uS transition latency */ 396 policy->cpuinfo.transition_latency = 10000; /* 10uS transition latency */
398 policy->cur = freq; 397 policy->cur = freq;
399 398
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
index a5b2346faf1f..14d68aa301ee 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
@@ -322,7 +322,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
322 322
323 /* only run on CPU to be set, or on its sibling */ 323 /* only run on CPU to be set, or on its sibling */
324#ifdef CONFIG_SMP 324#ifdef CONFIG_SMP
325 policy->cpus = cpu_sibling_map[policy->cpu]; 325 policy->cpus = per_cpu(cpu_sibling_map, policy->cpu);
326#endif 326#endif
327 327
328 cpus_allowed = current->cpus_allowed; 328 cpus_allowed = current->cpus_allowed;
@@ -348,7 +348,6 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
348 (speed / 1000)); 348 (speed / 1000));
349 349
350 /* cpuinfo and default policy values */ 350 /* cpuinfo and default policy values */
351 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
352 policy->cur = speed; 351 policy->cur = speed;
353 352
354 result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs); 353 result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs);
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c b/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c
index e1c509aa3054..f2b5a621d27b 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c
@@ -290,7 +290,6 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
290 (speed / 1000)); 290 (speed / 1000));
291 291
292 /* cpuinfo and default policy values */ 292 /* cpuinfo and default policy values */
293 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
294 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; 293 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
295 policy->cur = speed; 294 policy->cur = speed;
296 295
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
index 1e31b6caffb1..879a0f789b1e 100644
--- a/arch/x86/kernel/cpu/proc.c
+++ b/arch/x86/kernel/cpu/proc.c
@@ -122,7 +122,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
122#ifdef CONFIG_X86_HT 122#ifdef CONFIG_X86_HT
123 if (c->x86_max_cores * smp_num_siblings > 1) { 123 if (c->x86_max_cores * smp_num_siblings > 1) {
124 seq_printf(m, "physical id\t: %d\n", c->phys_proc_id); 124 seq_printf(m, "physical id\t: %d\n", c->phys_proc_id);
125 seq_printf(m, "siblings\t: %d\n", cpus_weight(cpu_core_map[n])); 125 seq_printf(m, "siblings\t: %d\n",
126 cpus_weight(per_cpu(cpu_core_map, n)));
126 seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id); 127 seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id);
127 seq_printf(m, "cpu cores\t: %d\n", c->booted_cores); 128 seq_printf(m, "cpu cores\t: %d\n", c->booted_cores);
128 } 129 }
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index 5c2faa10e9fa..f4548c93ccf5 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -11,8 +11,6 @@
11 * ----------------------------------------------------------------------- */ 11 * ----------------------------------------------------------------------- */
12 12
13/* 13/*
14 * cpuid.c
15 *
16 * x86 CPUID access device 14 * x86 CPUID access device
17 * 15 *
18 * This device is accessed by lseek() to the appropriate CPUID level 16 * This device is accessed by lseek() to the appropriate CPUID level
diff --git a/arch/x86/kernel/crash_dump_32.c b/arch/x86/kernel/crash_dump_32.c
index 3f532df488bc..32e75d0731a9 100644
--- a/arch/x86/kernel/crash_dump_32.c
+++ b/arch/x86/kernel/crash_dump_32.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * kernel/crash_dump.c - Memory preserving reboot related code. 2 * Memory preserving reboot related code.
3 * 3 *
4 * Created by: Hariprasad Nellitheertha (hari@in.ibm.com) 4 * Created by: Hariprasad Nellitheertha (hari@in.ibm.com)
5 * Copyright (C) IBM Corporation, 2004. All rights reserved 5 * Copyright (C) IBM Corporation, 2004. All rights reserved
diff --git a/arch/x86/kernel/crash_dump_64.c b/arch/x86/kernel/crash_dump_64.c
index 942deac4d43a..15e6c6bc4a46 100644
--- a/arch/x86/kernel/crash_dump_64.c
+++ b/arch/x86/kernel/crash_dump_64.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * kernel/crash_dump.c - Memory preserving reboot related code. 2 * Memory preserving reboot related code.
3 * 3 *
4 * Created by: Hariprasad Nellitheertha (hari@in.ibm.com) 4 * Created by: Hariprasad Nellitheertha (hari@in.ibm.com)
5 * Copyright (C) IBM Corporation, 2004. All rights reserved 5 * Copyright (C) IBM Corporation, 2004. All rights reserved
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 290b7bc82da3..8099fea0a72f 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -251,6 +251,7 @@ check_userspace:
251 jb resume_kernel # not returning to v8086 or userspace 251 jb resume_kernel # not returning to v8086 or userspace
252 252
253ENTRY(resume_userspace) 253ENTRY(resume_userspace)
254 LOCKDEP_SYS_EXIT
254 DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt 255 DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt
255 # setting need_resched or sigpending 256 # setting need_resched or sigpending
256 # between sampling and the iret 257 # between sampling and the iret
@@ -338,6 +339,7 @@ sysenter_past_esp:
338 jae syscall_badsys 339 jae syscall_badsys
339 call *sys_call_table(,%eax,4) 340 call *sys_call_table(,%eax,4)
340 movl %eax,PT_EAX(%esp) 341 movl %eax,PT_EAX(%esp)
342 LOCKDEP_SYS_EXIT
341 DISABLE_INTERRUPTS(CLBR_ANY) 343 DISABLE_INTERRUPTS(CLBR_ANY)
342 TRACE_IRQS_OFF 344 TRACE_IRQS_OFF
343 movl TI_flags(%ebp), %ecx 345 movl TI_flags(%ebp), %ecx
@@ -377,6 +379,7 @@ syscall_call:
377 call *sys_call_table(,%eax,4) 379 call *sys_call_table(,%eax,4)
378 movl %eax,PT_EAX(%esp) # store the return value 380 movl %eax,PT_EAX(%esp) # store the return value
379syscall_exit: 381syscall_exit:
382 LOCKDEP_SYS_EXIT
380 DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt 383 DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt
381 # setting need_resched or sigpending 384 # setting need_resched or sigpending
382 # between sampling and the iret 385 # between sampling and the iret
@@ -467,6 +470,7 @@ work_pending:
467 jz work_notifysig 470 jz work_notifysig
468work_resched: 471work_resched:
469 call schedule 472 call schedule
473 LOCKDEP_SYS_EXIT
470 DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt 474 DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt
471 # setting need_resched or sigpending 475 # setting need_resched or sigpending
472 # between sampling and the iret 476 # between sampling and the iret
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 1d232e5f5658..f1cacd4897f7 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -244,6 +244,7 @@ ret_from_sys_call:
244 movl $_TIF_ALLWORK_MASK,%edi 244 movl $_TIF_ALLWORK_MASK,%edi
245 /* edi: flagmask */ 245 /* edi: flagmask */
246sysret_check: 246sysret_check:
247 LOCKDEP_SYS_EXIT
247 GET_THREAD_INFO(%rcx) 248 GET_THREAD_INFO(%rcx)
248 cli 249 cli
249 TRACE_IRQS_OFF 250 TRACE_IRQS_OFF
@@ -333,6 +334,7 @@ int_ret_from_sys_call:
333 movl $_TIF_ALLWORK_MASK,%edi 334 movl $_TIF_ALLWORK_MASK,%edi
334 /* edi: mask to check */ 335 /* edi: mask to check */
335int_with_check: 336int_with_check:
337 LOCKDEP_SYS_EXIT_IRQ
336 GET_THREAD_INFO(%rcx) 338 GET_THREAD_INFO(%rcx)
337 movl threadinfo_flags(%rcx),%edx 339 movl threadinfo_flags(%rcx),%edx
338 andl %edi,%edx 340 andl %edi,%edx
@@ -544,11 +546,13 @@ exit_intr:
544retint_with_reschedule: 546retint_with_reschedule:
545 movl $_TIF_WORK_MASK,%edi 547 movl $_TIF_WORK_MASK,%edi
546retint_check: 548retint_check:
549 LOCKDEP_SYS_EXIT_IRQ
547 movl threadinfo_flags(%rcx),%edx 550 movl threadinfo_flags(%rcx),%edx
548 andl %edi,%edx 551 andl %edi,%edx
549 CFI_REMEMBER_STATE 552 CFI_REMEMBER_STATE
550 jnz retint_careful 553 jnz retint_careful
551retint_swapgs: 554
555retint_swapgs: /* return to user-space */
552 /* 556 /*
553 * The iretq could re-enable interrupts: 557 * The iretq could re-enable interrupts:
554 */ 558 */
@@ -557,7 +561,7 @@ retint_swapgs:
557 swapgs 561 swapgs
558 jmp restore_args 562 jmp restore_args
559 563
560retint_restore_args: 564retint_restore_args: /* return to kernel space */
561 cli 565 cli
562 /* 566 /*
563 * The iretq could re-enable interrupts: 567 * The iretq could re-enable interrupts:
@@ -866,26 +870,21 @@ error_sti:
866 movq ORIG_RAX(%rsp),%rsi /* get error code */ 870 movq ORIG_RAX(%rsp),%rsi /* get error code */
867 movq $-1,ORIG_RAX(%rsp) 871 movq $-1,ORIG_RAX(%rsp)
868 call *%rax 872 call *%rax
869 /* ebx: no swapgs flag (1: don't need swapgs, 0: need it) */ 873 /* ebx: no swapgs flag (1: don't need swapgs, 0: need it) */
870error_exit: 874error_exit:
871 movl %ebx,%eax 875 movl %ebx,%eax
872 RESTORE_REST 876 RESTORE_REST
873 cli 877 cli
874 TRACE_IRQS_OFF 878 TRACE_IRQS_OFF
875 GET_THREAD_INFO(%rcx) 879 GET_THREAD_INFO(%rcx)
876 testl %eax,%eax 880 testl %eax,%eax
877 jne retint_kernel 881 jne retint_kernel
882 LOCKDEP_SYS_EXIT_IRQ
878 movl threadinfo_flags(%rcx),%edx 883 movl threadinfo_flags(%rcx),%edx
879 movl $_TIF_WORK_MASK,%edi 884 movl $_TIF_WORK_MASK,%edi
880 andl %edi,%edx 885 andl %edi,%edx
881 jnz retint_careful 886 jnz retint_careful
882 /* 887 jmp retint_swapgs
883 * The iret might restore flags:
884 */
885 TRACE_IRQS_IRETQ
886 swapgs
887 RESTORE_ARGS 0,8,0
888 jmp iret_label
889 CFI_ENDPROC 888 CFI_ENDPROC
890 889
891error_kernelspace: 890error_kernelspace:
diff --git a/arch/x86/kernel/geode_32.c b/arch/x86/kernel/geode_32.c
index 41e8aec4c61d..f12d8c5d9809 100644
--- a/arch/x86/kernel/geode_32.c
+++ b/arch/x86/kernel/geode_32.c
@@ -145,10 +145,14 @@ EXPORT_SYMBOL_GPL(geode_gpio_setup_event);
145 145
146static int __init geode_southbridge_init(void) 146static int __init geode_southbridge_init(void)
147{ 147{
148 int timers;
149
148 if (!is_geode()) 150 if (!is_geode())
149 return -ENODEV; 151 return -ENODEV;
150 152
151 init_lbars(); 153 init_lbars();
154 timers = geode_mfgpt_detect();
155 printk(KERN_INFO "geode: %d MFGPT timers available.\n", timers);
152 return 0; 156 return 0;
153} 157}
154 158
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 6c34bdd22e26..8561f626edad 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/x86_64/kernel/head64.c -- prepare to run common code 2 * prepare to run common code
3 * 3 *
4 * Copyright (C) 2000 Andrea Arcangeli <andrea@suse.de> SuSE 4 * Copyright (C) 2000 Andrea Arcangeli <andrea@suse.de> SuSE
5 */ 5 */
diff --git a/arch/x86/kernel/hpet_32.c b/arch/x86/kernel/hpet.c
index 533d4932bc79..f8367074da0d 100644
--- a/arch/x86/kernel/hpet_32.c
+++ b/arch/x86/kernel/hpet.c
@@ -1,5 +1,6 @@
1#include <linux/clocksource.h> 1#include <linux/clocksource.h>
2#include <linux/clockchips.h> 2#include <linux/clockchips.h>
3#include <linux/delay.h>
3#include <linux/errno.h> 4#include <linux/errno.h>
4#include <linux/hpet.h> 5#include <linux/hpet.h>
5#include <linux/init.h> 6#include <linux/init.h>
@@ -7,11 +8,11 @@
7#include <linux/pm.h> 8#include <linux/pm.h>
8#include <linux/delay.h> 9#include <linux/delay.h>
9 10
11#include <asm/fixmap.h>
10#include <asm/hpet.h> 12#include <asm/hpet.h>
13#include <asm/i8253.h>
11#include <asm/io.h> 14#include <asm/io.h>
12 15
13extern struct clock_event_device *global_clock_event;
14
15#define HPET_MASK CLOCKSOURCE_MASK(32) 16#define HPET_MASK CLOCKSOURCE_MASK(32)
16#define HPET_SHIFT 22 17#define HPET_SHIFT 22
17 18
@@ -22,9 +23,9 @@ extern struct clock_event_device *global_clock_event;
22 * HPET address is set in acpi/boot.c, when an ACPI entry exists 23 * HPET address is set in acpi/boot.c, when an ACPI entry exists
23 */ 24 */
24unsigned long hpet_address; 25unsigned long hpet_address;
25static void __iomem * hpet_virt_address; 26static void __iomem *hpet_virt_address;
26 27
27static inline unsigned long hpet_readl(unsigned long a) 28unsigned long hpet_readl(unsigned long a)
28{ 29{
29 return readl(hpet_virt_address + a); 30 return readl(hpet_virt_address + a);
30} 31}
@@ -34,6 +35,36 @@ static inline void hpet_writel(unsigned long d, unsigned long a)
34 writel(d, hpet_virt_address + a); 35 writel(d, hpet_virt_address + a);
35} 36}
36 37
38#ifdef CONFIG_X86_64
39
40#include <asm/pgtable.h>
41
42static inline void hpet_set_mapping(void)
43{
44 set_fixmap_nocache(FIX_HPET_BASE, hpet_address);
45 __set_fixmap(VSYSCALL_HPET, hpet_address, PAGE_KERNEL_VSYSCALL_NOCACHE);
46 hpet_virt_address = (void __iomem *)fix_to_virt(FIX_HPET_BASE);
47}
48
49static inline void hpet_clear_mapping(void)
50{
51 hpet_virt_address = NULL;
52}
53
54#else
55
56static inline void hpet_set_mapping(void)
57{
58 hpet_virt_address = ioremap_nocache(hpet_address, HPET_MMAP_SIZE);
59}
60
61static inline void hpet_clear_mapping(void)
62{
63 iounmap(hpet_virt_address);
64 hpet_virt_address = NULL;
65}
66#endif
67
37/* 68/*
38 * HPET command line enable / disable 69 * HPET command line enable / disable
39 */ 70 */
@@ -49,6 +80,13 @@ static int __init hpet_setup(char* str)
49} 80}
50__setup("hpet=", hpet_setup); 81__setup("hpet=", hpet_setup);
51 82
83static int __init disable_hpet(char *str)
84{
85 boot_hpet_disable = 1;
86 return 1;
87}
88__setup("nohpet", disable_hpet);
89
52static inline int is_hpet_capable(void) 90static inline int is_hpet_capable(void)
53{ 91{
54 return (!boot_hpet_disable && hpet_address); 92 return (!boot_hpet_disable && hpet_address);
@@ -83,7 +121,7 @@ static void hpet_reserve_platform_timers(unsigned long id)
83 121
84 memset(&hd, 0, sizeof (hd)); 122 memset(&hd, 0, sizeof (hd));
85 hd.hd_phys_address = hpet_address; 123 hd.hd_phys_address = hpet_address;
86 hd.hd_address = hpet_virt_address; 124 hd.hd_address = hpet;
87 hd.hd_nirqs = nrtimers; 125 hd.hd_nirqs = nrtimers;
88 hd.hd_flags = HPET_DATA_PLATFORM; 126 hd.hd_flags = HPET_DATA_PLATFORM;
89 hpet_reserve_timer(&hd, 0); 127 hpet_reserve_timer(&hd, 0);
@@ -111,9 +149,9 @@ static void hpet_reserve_platform_timers(unsigned long id) { }
111 */ 149 */
112static unsigned long hpet_period; 150static unsigned long hpet_period;
113 151
114static void hpet_set_mode(enum clock_event_mode mode, 152static void hpet_legacy_set_mode(enum clock_event_mode mode,
115 struct clock_event_device *evt); 153 struct clock_event_device *evt);
116static int hpet_next_event(unsigned long delta, 154static int hpet_legacy_next_event(unsigned long delta,
117 struct clock_event_device *evt); 155 struct clock_event_device *evt);
118 156
119/* 157/*
@@ -122,10 +160,11 @@ static int hpet_next_event(unsigned long delta,
122static struct clock_event_device hpet_clockevent = { 160static struct clock_event_device hpet_clockevent = {
123 .name = "hpet", 161 .name = "hpet",
124 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 162 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
125 .set_mode = hpet_set_mode, 163 .set_mode = hpet_legacy_set_mode,
126 .set_next_event = hpet_next_event, 164 .set_next_event = hpet_legacy_next_event,
127 .shift = 32, 165 .shift = 32,
128 .irq = 0, 166 .irq = 0,
167 .rating = 50,
129}; 168};
130 169
131static void hpet_start_counter(void) 170static void hpet_start_counter(void)
@@ -140,7 +179,18 @@ static void hpet_start_counter(void)
140 hpet_writel(cfg, HPET_CFG); 179 hpet_writel(cfg, HPET_CFG);
141} 180}
142 181
143static void hpet_enable_int(void) 182static void hpet_resume_device(void)
183{
184 force_hpet_resume();
185}
186
187static void hpet_restart_counter(void)
188{
189 hpet_resume_device();
190 hpet_start_counter();
191}
192
193static void hpet_enable_legacy_int(void)
144{ 194{
145 unsigned long cfg = hpet_readl(HPET_CFG); 195 unsigned long cfg = hpet_readl(HPET_CFG);
146 196
@@ -149,7 +199,39 @@ static void hpet_enable_int(void)
149 hpet_legacy_int_enabled = 1; 199 hpet_legacy_int_enabled = 1;
150} 200}
151 201
152static void hpet_set_mode(enum clock_event_mode mode, 202static void hpet_legacy_clockevent_register(void)
203{
204 uint64_t hpet_freq;
205
206 /* Start HPET legacy interrupts */
207 hpet_enable_legacy_int();
208
209 /*
210 * The period is a femto seconds value. We need to calculate the
211 * scaled math multiplication factor for nanosecond to hpet tick
212 * conversion.
213 */
214 hpet_freq = 1000000000000000ULL;
215 do_div(hpet_freq, hpet_period);
216 hpet_clockevent.mult = div_sc((unsigned long) hpet_freq,
217 NSEC_PER_SEC, 32);
218 /* Calculate the min / max delta */
219 hpet_clockevent.max_delta_ns = clockevent_delta2ns(0x7FFFFFFF,
220 &hpet_clockevent);
221 hpet_clockevent.min_delta_ns = clockevent_delta2ns(0x30,
222 &hpet_clockevent);
223
224 /*
225 * Start hpet with the boot cpu mask and make it
226 * global after the IO_APIC has been initialized.
227 */
228 hpet_clockevent.cpumask = cpumask_of_cpu(smp_processor_id());
229 clockevents_register_device(&hpet_clockevent);
230 global_clock_event = &hpet_clockevent;
231 printk(KERN_DEBUG "hpet clockevent registered\n");
232}
233
234static void hpet_legacy_set_mode(enum clock_event_mode mode,
153 struct clock_event_device *evt) 235 struct clock_event_device *evt)
154{ 236{
155 unsigned long cfg, cmp, now; 237 unsigned long cfg, cmp, now;
@@ -190,12 +272,12 @@ static void hpet_set_mode(enum clock_event_mode mode,
190 break; 272 break;
191 273
192 case CLOCK_EVT_MODE_RESUME: 274 case CLOCK_EVT_MODE_RESUME:
193 hpet_enable_int(); 275 hpet_enable_legacy_int();
194 break; 276 break;
195 } 277 }
196} 278}
197 279
198static int hpet_next_event(unsigned long delta, 280static int hpet_legacy_next_event(unsigned long delta,
199 struct clock_event_device *evt) 281 struct clock_event_device *evt)
200{ 282{
201 unsigned long cnt; 283 unsigned long cnt;
@@ -215,6 +297,13 @@ static cycle_t read_hpet(void)
215 return (cycle_t)hpet_readl(HPET_COUNTER); 297 return (cycle_t)hpet_readl(HPET_COUNTER);
216} 298}
217 299
300#ifdef CONFIG_X86_64
301static cycle_t __vsyscall_fn vread_hpet(void)
302{
303 return readl((const void __iomem *)fix_to_virt(VSYSCALL_HPET) + 0xf0);
304}
305#endif
306
218static struct clocksource clocksource_hpet = { 307static struct clocksource clocksource_hpet = {
219 .name = "hpet", 308 .name = "hpet",
220 .rating = 250, 309 .rating = 250,
@@ -222,61 +311,17 @@ static struct clocksource clocksource_hpet = {
222 .mask = HPET_MASK, 311 .mask = HPET_MASK,
223 .shift = HPET_SHIFT, 312 .shift = HPET_SHIFT,
224 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 313 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
225 .resume = hpet_start_counter, 314 .resume = hpet_restart_counter,
315#ifdef CONFIG_X86_64
316 .vread = vread_hpet,
317#endif
226}; 318};
227 319
228/* 320static int hpet_clocksource_register(void)
229 * Try to setup the HPET timer
230 */
231int __init hpet_enable(void)
232{ 321{
233 unsigned long id;
234 uint64_t hpet_freq;
235 u64 tmp, start, now; 322 u64 tmp, start, now;
236 cycle_t t1; 323 cycle_t t1;
237 324
238 if (!is_hpet_capable())
239 return 0;
240
241 hpet_virt_address = ioremap_nocache(hpet_address, HPET_MMAP_SIZE);
242
243 /*
244 * Read the period and check for a sane value:
245 */
246 hpet_period = hpet_readl(HPET_PERIOD);
247 if (hpet_period < HPET_MIN_PERIOD || hpet_period > HPET_MAX_PERIOD)
248 goto out_nohpet;
249
250 /*
251 * The period is a femto seconds value. We need to calculate the
252 * scaled math multiplication factor for nanosecond to hpet tick
253 * conversion.
254 */
255 hpet_freq = 1000000000000000ULL;
256 do_div(hpet_freq, hpet_period);
257 hpet_clockevent.mult = div_sc((unsigned long) hpet_freq,
258 NSEC_PER_SEC, 32);
259 /* Calculate the min / max delta */
260 hpet_clockevent.max_delta_ns = clockevent_delta2ns(0x7FFFFFFF,
261 &hpet_clockevent);
262 hpet_clockevent.min_delta_ns = clockevent_delta2ns(0x30,
263 &hpet_clockevent);
264
265 /*
266 * Read the HPET ID register to retrieve the IRQ routing
267 * information and the number of channels
268 */
269 id = hpet_readl(HPET_ID);
270
271#ifdef CONFIG_HPET_EMULATE_RTC
272 /*
273 * The legacy routing mode needs at least two channels, tick timer
274 * and the rtc emulation channel.
275 */
276 if (!(id & HPET_ID_NUMBER))
277 goto out_nohpet;
278#endif
279
280 /* Start the counter */ 325 /* Start the counter */
281 hpet_start_counter(); 326 hpet_start_counter();
282 327
@@ -298,7 +343,7 @@ int __init hpet_enable(void)
298 if (t1 == read_hpet()) { 343 if (t1 == read_hpet()) {
299 printk(KERN_WARNING 344 printk(KERN_WARNING
300 "HPET counter not counting. HPET disabled\n"); 345 "HPET counter not counting. HPET disabled\n");
301 goto out_nohpet; 346 return -ENODEV;
302 } 347 }
303 348
304 /* Initialize and register HPET clocksource 349 /* Initialize and register HPET clocksource
@@ -319,27 +364,84 @@ int __init hpet_enable(void)
319 364
320 clocksource_register(&clocksource_hpet); 365 clocksource_register(&clocksource_hpet);
321 366
367 return 0;
368}
369
370/*
371 * Try to setup the HPET timer
372 */
373int __init hpet_enable(void)
374{
375 unsigned long id;
376
377 if (!is_hpet_capable())
378 return 0;
379
380 hpet_set_mapping();
381
382 /*
383 * Read the period and check for a sane value:
384 */
385 hpet_period = hpet_readl(HPET_PERIOD);
386 if (hpet_period < HPET_MIN_PERIOD || hpet_period > HPET_MAX_PERIOD)
387 goto out_nohpet;
388
389 /*
390 * Read the HPET ID register to retrieve the IRQ routing
391 * information and the number of channels
392 */
393 id = hpet_readl(HPET_ID);
394
395#ifdef CONFIG_HPET_EMULATE_RTC
396 /*
397 * The legacy routing mode needs at least two channels, tick timer
398 * and the rtc emulation channel.
399 */
400 if (!(id & HPET_ID_NUMBER))
401 goto out_nohpet;
402#endif
403
404 if (hpet_clocksource_register())
405 goto out_nohpet;
406
322 if (id & HPET_ID_LEGSUP) { 407 if (id & HPET_ID_LEGSUP) {
323 hpet_enable_int(); 408 hpet_legacy_clockevent_register();
324 hpet_reserve_platform_timers(id);
325 /*
326 * Start hpet with the boot cpu mask and make it
327 * global after the IO_APIC has been initialized.
328 */
329 hpet_clockevent.cpumask = cpumask_of_cpu(smp_processor_id());
330 clockevents_register_device(&hpet_clockevent);
331 global_clock_event = &hpet_clockevent;
332 return 1; 409 return 1;
333 } 410 }
334 return 0; 411 return 0;
335 412
336out_nohpet: 413out_nohpet:
337 iounmap(hpet_virt_address); 414 hpet_clear_mapping();
338 hpet_virt_address = NULL;
339 boot_hpet_disable = 1; 415 boot_hpet_disable = 1;
340 return 0; 416 return 0;
341} 417}
342 418
419/*
420 * Needs to be late, as the reserve_timer code calls kalloc !
421 *
422 * Not a problem on i386 as hpet_enable is called from late_time_init,
423 * but on x86_64 it is necessary !
424 */
425static __init int hpet_late_init(void)
426{
427 if (boot_hpet_disable)
428 return -ENODEV;
429
430 if (!hpet_address) {
431 if (!force_hpet_address)
432 return -ENODEV;
433
434 hpet_address = force_hpet_address;
435 hpet_enable();
436 if (!hpet_virt_address)
437 return -ENODEV;
438 }
439
440 hpet_reserve_platform_timers(hpet_readl(HPET_ID));
441
442 return 0;
443}
444fs_initcall(hpet_late_init);
343 445
344#ifdef CONFIG_HPET_EMULATE_RTC 446#ifdef CONFIG_HPET_EMULATE_RTC
345 447
diff --git a/arch/x86/kernel/hpet_64.c b/arch/x86/kernel/hpet_64.c
deleted file mode 100644
index e2d1b912e154..000000000000
--- a/arch/x86/kernel/hpet_64.c
+++ /dev/null
@@ -1,493 +0,0 @@
1#include <linux/kernel.h>
2#include <linux/sched.h>
3#include <linux/init.h>
4#include <linux/mc146818rtc.h>
5#include <linux/time.h>
6#include <linux/clocksource.h>
7#include <linux/ioport.h>
8#include <linux/acpi.h>
9#include <linux/hpet.h>
10#include <asm/pgtable.h>
11#include <asm/vsyscall.h>
12#include <asm/timex.h>
13#include <asm/hpet.h>
14
15#define HPET_MASK 0xFFFFFFFF
16#define HPET_SHIFT 22
17
18/* FSEC = 10^-15 NSEC = 10^-9 */
19#define FSEC_PER_NSEC 1000000
20
21int nohpet __initdata;
22
23unsigned long hpet_address;
24unsigned long hpet_period; /* fsecs / HPET clock */
25unsigned long hpet_tick; /* HPET clocks / interrupt */
26
27int hpet_use_timer; /* Use counter of hpet for time keeping,
28 * otherwise PIT
29 */
30
31#ifdef CONFIG_HPET
32static __init int late_hpet_init(void)
33{
34 struct hpet_data hd;
35 unsigned int ntimer;
36
37 if (!hpet_address)
38 return 0;
39
40 memset(&hd, 0, sizeof(hd));
41
42 ntimer = hpet_readl(HPET_ID);
43 ntimer = (ntimer & HPET_ID_NUMBER) >> HPET_ID_NUMBER_SHIFT;
44 ntimer++;
45
46 /*
47 * Register with driver.
48 * Timer0 and Timer1 is used by platform.
49 */
50 hd.hd_phys_address = hpet_address;
51 hd.hd_address = (void __iomem *)fix_to_virt(FIX_HPET_BASE);
52 hd.hd_nirqs = ntimer;
53 hd.hd_flags = HPET_DATA_PLATFORM;
54 hpet_reserve_timer(&hd, 0);
55#ifdef CONFIG_HPET_EMULATE_RTC
56 hpet_reserve_timer(&hd, 1);
57#endif
58 hd.hd_irq[0] = HPET_LEGACY_8254;
59 hd.hd_irq[1] = HPET_LEGACY_RTC;
60 if (ntimer > 2) {
61 struct hpet *hpet;
62 struct hpet_timer *timer;
63 int i;
64
65 hpet = (struct hpet *) fix_to_virt(FIX_HPET_BASE);
66 timer = &hpet->hpet_timers[2];
67 for (i = 2; i < ntimer; timer++, i++)
68 hd.hd_irq[i] = (timer->hpet_config &
69 Tn_INT_ROUTE_CNF_MASK) >>
70 Tn_INT_ROUTE_CNF_SHIFT;
71
72 }
73
74 hpet_alloc(&hd);
75 return 0;
76}
77fs_initcall(late_hpet_init);
78#endif
79
80int hpet_timer_stop_set_go(unsigned long tick)
81{
82 unsigned int cfg;
83
84/*
85 * Stop the timers and reset the main counter.
86 */
87
88 cfg = hpet_readl(HPET_CFG);
89 cfg &= ~(HPET_CFG_ENABLE | HPET_CFG_LEGACY);
90 hpet_writel(cfg, HPET_CFG);
91 hpet_writel(0, HPET_COUNTER);
92 hpet_writel(0, HPET_COUNTER + 4);
93
94/*
95 * Set up timer 0, as periodic with first interrupt to happen at hpet_tick,
96 * and period also hpet_tick.
97 */
98 if (hpet_use_timer) {
99 hpet_writel(HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
100 HPET_TN_32BIT, HPET_T0_CFG);
101 hpet_writel(hpet_tick, HPET_T0_CMP); /* next interrupt */
102 hpet_writel(hpet_tick, HPET_T0_CMP); /* period */
103 cfg |= HPET_CFG_LEGACY;
104 }
105/*
106 * Go!
107 */
108
109 cfg |= HPET_CFG_ENABLE;
110 hpet_writel(cfg, HPET_CFG);
111
112 return 0;
113}
114
115static cycle_t read_hpet(void)
116{
117 return (cycle_t)hpet_readl(HPET_COUNTER);
118}
119
120static cycle_t __vsyscall_fn vread_hpet(void)
121{
122 return readl((void __iomem *)fix_to_virt(VSYSCALL_HPET) + 0xf0);
123}
124
125struct clocksource clocksource_hpet = {
126 .name = "hpet",
127 .rating = 250,
128 .read = read_hpet,
129 .mask = (cycle_t)HPET_MASK,
130 .mult = 0, /* set below */
131 .shift = HPET_SHIFT,
132 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
133 .vread = vread_hpet,
134};
135
136int __init hpet_arch_init(void)
137{
138 unsigned int id;
139 u64 tmp;
140
141 if (!hpet_address)
142 return -1;
143 set_fixmap_nocache(FIX_HPET_BASE, hpet_address);
144 __set_fixmap(VSYSCALL_HPET, hpet_address, PAGE_KERNEL_VSYSCALL_NOCACHE);
145
146/*
147 * Read the period, compute tick and quotient.
148 */
149
150 id = hpet_readl(HPET_ID);
151
152 if (!(id & HPET_ID_VENDOR) || !(id & HPET_ID_NUMBER))
153 return -1;
154
155 hpet_period = hpet_readl(HPET_PERIOD);
156 if (hpet_period < 100000 || hpet_period > 100000000)
157 return -1;
158
159 hpet_tick = (FSEC_PER_TICK + hpet_period / 2) / hpet_period;
160
161 hpet_use_timer = (id & HPET_ID_LEGSUP);
162
163 /*
164 * hpet period is in femto seconds per cycle
165 * so we need to convert this to ns/cyc units
166 * aproximated by mult/2^shift
167 *
168 * fsec/cyc * 1nsec/1000000fsec = nsec/cyc = mult/2^shift
169 * fsec/cyc * 1ns/1000000fsec * 2^shift = mult
170 * fsec/cyc * 2^shift * 1nsec/1000000fsec = mult
171 * (fsec/cyc << shift)/1000000 = mult
172 * (hpet_period << shift)/FSEC_PER_NSEC = mult
173 */
174 tmp = (u64)hpet_period << HPET_SHIFT;
175 do_div(tmp, FSEC_PER_NSEC);
176 clocksource_hpet.mult = (u32)tmp;
177 clocksource_register(&clocksource_hpet);
178
179 return hpet_timer_stop_set_go(hpet_tick);
180}
181
182int hpet_reenable(void)
183{
184 return hpet_timer_stop_set_go(hpet_tick);
185}
186
187/*
188 * calibrate_tsc() calibrates the processor TSC in a very simple way, comparing
189 * it to the HPET timer of known frequency.
190 */
191
192#define TICK_COUNT 100000000
193#define SMI_THRESHOLD 50000
194#define MAX_TRIES 5
195
196/*
197 * Some platforms take periodic SMI interrupts with 5ms duration. Make sure none
198 * occurs between the reads of the hpet & TSC.
199 */
200static void __init read_hpet_tsc(int *hpet, int *tsc)
201{
202 int tsc1, tsc2, hpet1, i;
203
204 for (i = 0; i < MAX_TRIES; i++) {
205 tsc1 = get_cycles_sync();
206 hpet1 = hpet_readl(HPET_COUNTER);
207 tsc2 = get_cycles_sync();
208 if ((tsc2 - tsc1) < SMI_THRESHOLD)
209 break;
210 }
211 *hpet = hpet1;
212 *tsc = tsc2;
213}
214
215unsigned int __init hpet_calibrate_tsc(void)
216{
217 int tsc_start, hpet_start;
218 int tsc_now, hpet_now;
219 unsigned long flags;
220
221 local_irq_save(flags);
222
223 read_hpet_tsc(&hpet_start, &tsc_start);
224
225 do {
226 local_irq_disable();
227 read_hpet_tsc(&hpet_now, &tsc_now);
228 local_irq_restore(flags);
229 } while ((tsc_now - tsc_start) < TICK_COUNT &&
230 (hpet_now - hpet_start) < TICK_COUNT);
231
232 return (tsc_now - tsc_start) * 1000000000L
233 / ((hpet_now - hpet_start) * hpet_period / 1000);
234}
235
236#ifdef CONFIG_HPET_EMULATE_RTC
237/* HPET in LegacyReplacement Mode eats up RTC interrupt line. When, HPET
238 * is enabled, we support RTC interrupt functionality in software.
239 * RTC has 3 kinds of interrupts:
240 * 1) Update Interrupt - generate an interrupt, every sec, when RTC clock
241 * is updated
242 * 2) Alarm Interrupt - generate an interrupt at a specific time of day
243 * 3) Periodic Interrupt - generate periodic interrupt, with frequencies
244 * 2Hz-8192Hz (2Hz-64Hz for non-root user) (all freqs in powers of 2)
245 * (1) and (2) above are implemented using polling at a frequency of
246 * 64 Hz. The exact frequency is a tradeoff between accuracy and interrupt
247 * overhead. (DEFAULT_RTC_INT_FREQ)
248 * For (3), we use interrupts at 64Hz or user specified periodic
249 * frequency, whichever is higher.
250 */
251#include <linux/rtc.h>
252
253#define DEFAULT_RTC_INT_FREQ 64
254#define RTC_NUM_INTS 1
255
256static unsigned long UIE_on;
257static unsigned long prev_update_sec;
258
259static unsigned long AIE_on;
260static struct rtc_time alarm_time;
261
262static unsigned long PIE_on;
263static unsigned long PIE_freq = DEFAULT_RTC_INT_FREQ;
264static unsigned long PIE_count;
265
266static unsigned long hpet_rtc_int_freq; /* RTC interrupt frequency */
267static unsigned int hpet_t1_cmp; /* cached comparator register */
268
269int is_hpet_enabled(void)
270{
271 return hpet_address != 0;
272}
273
274/*
275 * Timer 1 for RTC, we do not use periodic interrupt feature,
276 * even if HPET supports periodic interrupts on Timer 1.
277 * The reason being, to set up a periodic interrupt in HPET, we need to
278 * stop the main counter. And if we do that everytime someone diables/enables
279 * RTC, we will have adverse effect on main kernel timer running on Timer 0.
280 * So, for the time being, simulate the periodic interrupt in software.
281 *
282 * hpet_rtc_timer_init() is called for the first time and during subsequent
283 * interuppts reinit happens through hpet_rtc_timer_reinit().
284 */
285int hpet_rtc_timer_init(void)
286{
287 unsigned int cfg, cnt;
288 unsigned long flags;
289
290 if (!is_hpet_enabled())
291 return 0;
292 /*
293 * Set the counter 1 and enable the interrupts.
294 */
295 if (PIE_on && (PIE_freq > DEFAULT_RTC_INT_FREQ))
296 hpet_rtc_int_freq = PIE_freq;
297 else
298 hpet_rtc_int_freq = DEFAULT_RTC_INT_FREQ;
299
300 local_irq_save(flags);
301
302 cnt = hpet_readl(HPET_COUNTER);
303 cnt += ((hpet_tick*HZ)/hpet_rtc_int_freq);
304 hpet_writel(cnt, HPET_T1_CMP);
305 hpet_t1_cmp = cnt;
306
307 cfg = hpet_readl(HPET_T1_CFG);
308 cfg &= ~HPET_TN_PERIODIC;
309 cfg |= HPET_TN_ENABLE | HPET_TN_32BIT;
310 hpet_writel(cfg, HPET_T1_CFG);
311
312 local_irq_restore(flags);
313
314 return 1;
315}
316
317static void hpet_rtc_timer_reinit(void)
318{
319 unsigned int cfg, cnt, ticks_per_int, lost_ints;
320
321 if (unlikely(!(PIE_on | AIE_on | UIE_on))) {
322 cfg = hpet_readl(HPET_T1_CFG);
323 cfg &= ~HPET_TN_ENABLE;
324 hpet_writel(cfg, HPET_T1_CFG);
325 return;
326 }
327
328 if (PIE_on && (PIE_freq > DEFAULT_RTC_INT_FREQ))
329 hpet_rtc_int_freq = PIE_freq;
330 else
331 hpet_rtc_int_freq = DEFAULT_RTC_INT_FREQ;
332
333 /* It is more accurate to use the comparator value than current count.*/
334 ticks_per_int = hpet_tick * HZ / hpet_rtc_int_freq;
335 hpet_t1_cmp += ticks_per_int;
336 hpet_writel(hpet_t1_cmp, HPET_T1_CMP);
337
338 /*
339 * If the interrupt handler was delayed too long, the write above tries
340 * to schedule the next interrupt in the past and the hardware would
341 * not interrupt until the counter had wrapped around.
342 * So we have to check that the comparator wasn't set to a past time.
343 */
344 cnt = hpet_readl(HPET_COUNTER);
345 if (unlikely((int)(cnt - hpet_t1_cmp) > 0)) {
346 lost_ints = (cnt - hpet_t1_cmp) / ticks_per_int + 1;
347 /* Make sure that, even with the time needed to execute
348 * this code, the next scheduled interrupt has been moved
349 * back to the future: */
350 lost_ints++;
351
352 hpet_t1_cmp += lost_ints * ticks_per_int;
353 hpet_writel(hpet_t1_cmp, HPET_T1_CMP);
354
355 if (PIE_on)
356 PIE_count += lost_ints;
357
358 if (printk_ratelimit())
359 printk(KERN_WARNING "rtc: lost some interrupts at %ldHz.\n",
360 hpet_rtc_int_freq);
361 }
362}
363
364/*
365 * The functions below are called from rtc driver.
366 * Return 0 if HPET is not being used.
367 * Otherwise do the necessary changes and return 1.
368 */
369int hpet_mask_rtc_irq_bit(unsigned long bit_mask)
370{
371 if (!is_hpet_enabled())
372 return 0;
373
374 if (bit_mask & RTC_UIE)
375 UIE_on = 0;
376 if (bit_mask & RTC_PIE)
377 PIE_on = 0;
378 if (bit_mask & RTC_AIE)
379 AIE_on = 0;
380
381 return 1;
382}
383
384int hpet_set_rtc_irq_bit(unsigned long bit_mask)
385{
386 int timer_init_reqd = 0;
387
388 if (!is_hpet_enabled())
389 return 0;
390
391 if (!(PIE_on | AIE_on | UIE_on))
392 timer_init_reqd = 1;
393
394 if (bit_mask & RTC_UIE) {
395 UIE_on = 1;
396 }
397 if (bit_mask & RTC_PIE) {
398 PIE_on = 1;
399 PIE_count = 0;
400 }
401 if (bit_mask & RTC_AIE) {
402 AIE_on = 1;
403 }
404
405 if (timer_init_reqd)
406 hpet_rtc_timer_init();
407
408 return 1;
409}
410
411int hpet_set_alarm_time(unsigned char hrs, unsigned char min, unsigned char sec)
412{
413 if (!is_hpet_enabled())
414 return 0;
415
416 alarm_time.tm_hour = hrs;
417 alarm_time.tm_min = min;
418 alarm_time.tm_sec = sec;
419
420 return 1;
421}
422
423int hpet_set_periodic_freq(unsigned long freq)
424{
425 if (!is_hpet_enabled())
426 return 0;
427
428 PIE_freq = freq;
429 PIE_count = 0;
430
431 return 1;
432}
433
434int hpet_rtc_dropped_irq(void)
435{
436 if (!is_hpet_enabled())
437 return 0;
438
439 return 1;
440}
441
442irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id)
443{
444 struct rtc_time curr_time;
445 unsigned long rtc_int_flag = 0;
446 int call_rtc_interrupt = 0;
447
448 hpet_rtc_timer_reinit();
449
450 if (UIE_on | AIE_on) {
451 rtc_get_rtc_time(&curr_time);
452 }
453 if (UIE_on) {
454 if (curr_time.tm_sec != prev_update_sec) {
455 /* Set update int info, call real rtc int routine */
456 call_rtc_interrupt = 1;
457 rtc_int_flag = RTC_UF;
458 prev_update_sec = curr_time.tm_sec;
459 }
460 }
461 if (PIE_on) {
462 PIE_count++;
463 if (PIE_count >= hpet_rtc_int_freq/PIE_freq) {
464 /* Set periodic int info, call real rtc int routine */
465 call_rtc_interrupt = 1;
466 rtc_int_flag |= RTC_PF;
467 PIE_count = 0;
468 }
469 }
470 if (AIE_on) {
471 if ((curr_time.tm_sec == alarm_time.tm_sec) &&
472 (curr_time.tm_min == alarm_time.tm_min) &&
473 (curr_time.tm_hour == alarm_time.tm_hour)) {
474 /* Set alarm int info, call real rtc int routine */
475 call_rtc_interrupt = 1;
476 rtc_int_flag |= RTC_AF;
477 }
478 }
479 if (call_rtc_interrupt) {
480 rtc_int_flag |= (RTC_IRQF | (RTC_NUM_INTS << 8));
481 rtc_interrupt(rtc_int_flag, dev_id);
482 }
483 return IRQ_HANDLED;
484}
485#endif
486
487static int __init nohpet_setup(char *s)
488{
489 nohpet = 1;
490 return 1;
491}
492
493__setup("nohpet", nohpet_setup);
diff --git a/arch/x86/kernel/i387_32.c b/arch/x86/kernel/i387_32.c
index 665847281ed2..7d2e12f6c78b 100644
--- a/arch/x86/kernel/i387_32.c
+++ b/arch/x86/kernel/i387_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/i387.c
3 *
4 * Copyright (C) 1994 Linus Torvalds 2 * Copyright (C) 1994 Linus Torvalds
5 * 3 *
6 * Pentium III FXSR, SSE support 4 * Pentium III FXSR, SSE support
diff --git a/arch/x86/kernel/i387_64.c b/arch/x86/kernel/i387_64.c
index 1d58c13bc6bc..56c1f1147109 100644
--- a/arch/x86/kernel/i387_64.c
+++ b/arch/x86/kernel/i387_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/x86_64/kernel/i387.c
3 *
4 * Copyright (C) 1994 Linus Torvalds 2 * Copyright (C) 1994 Linus Torvalds
5 * Copyright (C) 2002 Andi Kleen, SuSE Labs 3 * Copyright (C) 2002 Andi Kleen, SuSE Labs
6 * 4 *
diff --git a/arch/x86/kernel/i8237.c b/arch/x86/kernel/i8237.c
index 6f508e8d7c57..29313832df0c 100644
--- a/arch/x86/kernel/i8237.c
+++ b/arch/x86/kernel/i8237.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * i8237.c: 8237A DMA controller suspend functions. 2 * 8237A DMA controller suspend functions.
3 * 3 *
4 * Written by Pierre Ossman, 2005. 4 * Written by Pierre Ossman, 2005.
5 * 5 *
diff --git a/arch/x86/kernel/i8253_32.c b/arch/x86/kernel/i8253.c
index 6d839f2f1b1a..5cc8841ca2c6 100644
--- a/arch/x86/kernel/i8253_32.c
+++ b/arch/x86/kernel/i8253.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * i8253.c 8253/PIT functions 2 * 8253/PIT functions
3 * 3 *
4 */ 4 */
5#include <linux/clockchips.h> 5#include <linux/clockchips.h>
@@ -13,7 +13,6 @@
13#include <asm/delay.h> 13#include <asm/delay.h>
14#include <asm/i8253.h> 14#include <asm/i8253.h>
15#include <asm/io.h> 15#include <asm/io.h>
16#include <asm/timer.h>
17 16
18DEFINE_SPINLOCK(i8253_lock); 17DEFINE_SPINLOCK(i8253_lock);
19EXPORT_SYMBOL(i8253_lock); 18EXPORT_SYMBOL(i8253_lock);
@@ -120,6 +119,7 @@ void __init setup_pit_timer(void)
120 global_clock_event = &pit_clockevent; 119 global_clock_event = &pit_clockevent;
121} 120}
122 121
122#ifndef CONFIG_X86_64
123/* 123/*
124 * Since the PIT overflows every tick, its not very useful 124 * Since the PIT overflows every tick, its not very useful
125 * to just read by itself. So use jiffies to emulate a free 125 * to just read by itself. So use jiffies to emulate a free
@@ -204,3 +204,5 @@ static int __init init_pit_clocksource(void)
204 return clocksource_register(&clocksource_pit); 204 return clocksource_register(&clocksource_pit);
205} 205}
206arch_initcall(init_pit_clocksource); 206arch_initcall(init_pit_clocksource);
207
208#endif
diff --git a/arch/x86/kernel/i8259_32.c b/arch/x86/kernel/i8259_32.c
index 0499cbe9871a..679bb33acbf1 100644
--- a/arch/x86/kernel/i8259_32.c
+++ b/arch/x86/kernel/i8259_32.c
@@ -10,7 +10,6 @@
10#include <linux/sysdev.h> 10#include <linux/sysdev.h>
11#include <linux/bitops.h> 11#include <linux/bitops.h>
12 12
13#include <asm/8253pit.h>
14#include <asm/atomic.h> 13#include <asm/atomic.h>
15#include <asm/system.h> 14#include <asm/system.h>
16#include <asm/io.h> 15#include <asm/io.h>
diff --git a/arch/x86/kernel/i8259_64.c b/arch/x86/kernel/i8259_64.c
index 948cae646099..eb72976cc13c 100644
--- a/arch/x86/kernel/i8259_64.c
+++ b/arch/x86/kernel/i8259_64.c
@@ -444,46 +444,6 @@ void __init init_ISA_irqs (void)
444 } 444 }
445} 445}
446 446
447static void setup_timer_hardware(void)
448{
449 outb_p(0x34,0x43); /* binary, mode 2, LSB/MSB, ch 0 */
450 udelay(10);
451 outb_p(LATCH & 0xff , 0x40); /* LSB */
452 udelay(10);
453 outb(LATCH >> 8 , 0x40); /* MSB */
454}
455
456static int timer_resume(struct sys_device *dev)
457{
458 setup_timer_hardware();
459 return 0;
460}
461
462void i8254_timer_resume(void)
463{
464 setup_timer_hardware();
465}
466
467static struct sysdev_class timer_sysclass = {
468 set_kset_name("timer_pit"),
469 .resume = timer_resume,
470};
471
472static struct sys_device device_timer = {
473 .id = 0,
474 .cls = &timer_sysclass,
475};
476
477static int __init init_timer_sysfs(void)
478{
479 int error = sysdev_class_register(&timer_sysclass);
480 if (!error)
481 error = sysdev_register(&device_timer);
482 return error;
483}
484
485device_initcall(init_timer_sysfs);
486
487void __init init_IRQ(void) 447void __init init_IRQ(void)
488{ 448{
489 int i; 449 int i;
@@ -533,12 +493,6 @@ void __init init_IRQ(void)
533 set_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt); 493 set_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
534 set_intr_gate(ERROR_APIC_VECTOR, error_interrupt); 494 set_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
535 495
536 /*
537 * Set the clock to HZ Hz, we already have a valid
538 * vector now:
539 */
540 setup_timer_hardware();
541
542 if (!acpi_ioapic) 496 if (!acpi_ioapic)
543 setup_irq(2, &irq2); 497 setup_irq(2, &irq2);
544} 498}
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index e2f4a1c68547..4ee1e5ee9b57 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -378,7 +378,7 @@ static struct irq_cpu_info {
378 378
379#define IRQ_ALLOWED(cpu, allowed_mask) cpu_isset(cpu, allowed_mask) 379#define IRQ_ALLOWED(cpu, allowed_mask) cpu_isset(cpu, allowed_mask)
380 380
381#define CPU_TO_PACKAGEINDEX(i) (first_cpu(cpu_sibling_map[i])) 381#define CPU_TO_PACKAGEINDEX(i) (first_cpu(per_cpu(cpu_sibling_map, i)))
382 382
383static cpumask_t balance_irq_affinity[NR_IRQS] = { 383static cpumask_t balance_irq_affinity[NR_IRQS] = {
384 [0 ... NR_IRQS-1] = CPU_MASK_ALL 384 [0 ... NR_IRQS-1] = CPU_MASK_ALL
@@ -598,7 +598,7 @@ tryanotherirq:
598 * (A+B)/2 vs B 598 * (A+B)/2 vs B
599 */ 599 */
600 load = CPU_IRQ(min_loaded) >> 1; 600 load = CPU_IRQ(min_loaded) >> 1;
601 for_each_cpu_mask(j, cpu_sibling_map[min_loaded]) { 601 for_each_cpu_mask(j, per_cpu(cpu_sibling_map, min_loaded)) {
602 if (load > CPU_IRQ(j)) { 602 if (load > CPU_IRQ(j)) {
603 /* This won't change cpu_sibling_map[min_loaded] */ 603 /* This won't change cpu_sibling_map[min_loaded] */
604 load = CPU_IRQ(j); 604 load = CPU_IRQ(j);
diff --git a/arch/x86/kernel/ioport_32.c b/arch/x86/kernel/ioport_32.c
index 3d310a946d76..4ed48dc8df1e 100644
--- a/arch/x86/kernel/ioport_32.c
+++ b/arch/x86/kernel/ioport_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/ioport.c
3 *
4 * This contains the io-permission bitmap code - written by obz, with changes 2 * This contains the io-permission bitmap code - written by obz, with changes
5 * by Linus. 3 * by Linus.
6 */ 4 */
diff --git a/arch/x86/kernel/ioport_64.c b/arch/x86/kernel/ioport_64.c
index 653efa30b0f4..5f62fad64dab 100644
--- a/arch/x86/kernel/ioport_64.c
+++ b/arch/x86/kernel/ioport_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/x86_64/kernel/ioport.c
3 *
4 * This contains the io-permission bitmap code - written by obz, with changes 2 * This contains the io-permission bitmap code - written by obz, with changes
5 * by Linus. 3 * by Linus.
6 */ 4 */
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 4f681bcdb1fc..e173b763f148 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/irq.c
3 *
4 * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar 2 * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
5 * 3 *
6 * This file contains the lowest level x86-specific interrupt 4 * This file contains the lowest level x86-specific interrupt
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index bd11e42b22bf..865669efc540 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/x86_64/kernel/irq.c
3 *
4 * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar 2 * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
5 * 3 *
6 * This file contains the lowest level x86_64-specific interrupt 4 * This file contains the lowest level x86_64-specific interrupt
diff --git a/arch/x86/kernel/kprobes_32.c b/arch/x86/kernel/kprobes_32.c
index 448a50b1324c..90f778c04b3f 100644
--- a/arch/x86/kernel/kprobes_32.c
+++ b/arch/x86/kernel/kprobes_32.c
@@ -1,6 +1,5 @@
1/* 1/*
2 * Kernel Probes (KProbes) 2 * Kernel Probes (KProbes)
3 * arch/i386/kernel/kprobes.c
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
@@ -42,6 +41,13 @@ void jprobe_return_end(void);
42DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; 41DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
43DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); 42DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
44 43
44struct kretprobe_blackpoint kretprobe_blacklist[] = {
45 {"__switch_to", }, /* This function switches only current task, but
46 doesn't switch kernel stack.*/
47 {NULL, NULL} /* Terminator */
48};
49const int kretprobe_blacklist_size = ARRAY_SIZE(kretprobe_blacklist);
50
45/* insert a jmp code */ 51/* insert a jmp code */
46static __always_inline void set_jmp_op(void *from, void *to) 52static __always_inline void set_jmp_op(void *from, void *to)
47{ 53{
@@ -558,6 +564,12 @@ static int __kprobes post_kprobe_handler(struct pt_regs *regs)
558 564
559 resume_execution(cur, regs, kcb); 565 resume_execution(cur, regs, kcb);
560 regs->eflags |= kcb->kprobe_saved_eflags; 566 regs->eflags |= kcb->kprobe_saved_eflags;
567#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
568 if (raw_irqs_disabled_flags(regs->eflags))
569 trace_hardirqs_off();
570 else
571 trace_hardirqs_on();
572#endif
561 573
562 /*Restore back the original saved kprobes variables and continue. */ 574 /*Restore back the original saved kprobes variables and continue. */
563 if (kcb->kprobe_status == KPROBE_REENTER) { 575 if (kcb->kprobe_status == KPROBE_REENTER) {
@@ -579,7 +591,7 @@ out:
579 return 1; 591 return 1;
580} 592}
581 593
582static int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) 594int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr)
583{ 595{
584 struct kprobe *cur = kprobe_running(); 596 struct kprobe *cur = kprobe_running();
585 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 597 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
@@ -661,7 +673,6 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
661 ret = NOTIFY_STOP; 673 ret = NOTIFY_STOP;
662 break; 674 break;
663 case DIE_GPF: 675 case DIE_GPF:
664 case DIE_PAGE_FAULT:
665 /* kprobe_running() needs smp_processor_id() */ 676 /* kprobe_running() needs smp_processor_id() */
666 preempt_disable(); 677 preempt_disable();
667 if (kprobe_running() && 678 if (kprobe_running() &&
@@ -695,6 +706,7 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
695 memcpy(kcb->jprobes_stack, (kprobe_opcode_t *)addr, 706 memcpy(kcb->jprobes_stack, (kprobe_opcode_t *)addr,
696 MIN_STACK_SIZE(addr)); 707 MIN_STACK_SIZE(addr));
697 regs->eflags &= ~IF_MASK; 708 regs->eflags &= ~IF_MASK;
709 trace_hardirqs_off();
698 regs->eip = (unsigned long)(jp->entry); 710 regs->eip = (unsigned long)(jp->entry);
699 return 1; 711 return 1;
700} 712}
diff --git a/arch/x86/kernel/kprobes_64.c b/arch/x86/kernel/kprobes_64.c
index a30e004682e2..681b801c5e26 100644
--- a/arch/x86/kernel/kprobes_64.c
+++ b/arch/x86/kernel/kprobes_64.c
@@ -1,6 +1,5 @@
1/* 1/*
2 * Kernel Probes (KProbes) 2 * Kernel Probes (KProbes)
3 * arch/x86_64/kernel/kprobes.c
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
@@ -49,6 +48,13 @@ static void __kprobes arch_copy_kprobe(struct kprobe *p);
49DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; 48DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
50DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); 49DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
51 50
51struct kretprobe_blackpoint kretprobe_blacklist[] = {
52 {"__switch_to", }, /* This function switches only current task, but
53 doesn't switch kernel stack.*/
54 {NULL, NULL} /* Terminator */
55};
56const int kretprobe_blacklist_size = ARRAY_SIZE(kretprobe_blacklist);
57
52/* 58/*
53 * returns non-zero if opcode modifies the interrupt flag. 59 * returns non-zero if opcode modifies the interrupt flag.
54 */ 60 */
@@ -545,6 +551,12 @@ int __kprobes post_kprobe_handler(struct pt_regs *regs)
545 551
546 resume_execution(cur, regs, kcb); 552 resume_execution(cur, regs, kcb);
547 regs->eflags |= kcb->kprobe_saved_rflags; 553 regs->eflags |= kcb->kprobe_saved_rflags;
554#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
555 if (raw_irqs_disabled_flags(regs->eflags))
556 trace_hardirqs_off();
557 else
558 trace_hardirqs_on();
559#endif
548 560
549 /* Restore the original saved kprobes variables and continue. */ 561 /* Restore the original saved kprobes variables and continue. */
550 if (kcb->kprobe_status == KPROBE_REENTER) { 562 if (kcb->kprobe_status == KPROBE_REENTER) {
@@ -652,7 +664,6 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
652 ret = NOTIFY_STOP; 664 ret = NOTIFY_STOP;
653 break; 665 break;
654 case DIE_GPF: 666 case DIE_GPF:
655 case DIE_PAGE_FAULT:
656 /* kprobe_running() needs smp_processor_id() */ 667 /* kprobe_running() needs smp_processor_id() */
657 preempt_disable(); 668 preempt_disable();
658 if (kprobe_running() && 669 if (kprobe_running() &&
@@ -685,6 +696,7 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
685 memcpy(kcb->jprobes_stack, (kprobe_opcode_t *)addr, 696 memcpy(kcb->jprobes_stack, (kprobe_opcode_t *)addr,
686 MIN_STACK_SIZE(addr)); 697 MIN_STACK_SIZE(addr));
687 regs->eflags &= ~IF_MASK; 698 regs->eflags &= ~IF_MASK;
699 trace_hardirqs_off();
688 regs->rip = (unsigned long)(jp->entry); 700 regs->rip = (unsigned long)(jp->entry);
689 return 1; 701 return 1;
690} 702}
diff --git a/arch/x86/kernel/ldt_32.c b/arch/x86/kernel/ldt_32.c
index e0b2d17f4f10..a8b18421863a 100644
--- a/arch/x86/kernel/ldt_32.c
+++ b/arch/x86/kernel/ldt_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/ldt.c
3 *
4 * Copyright (C) 1992 Krishna Balasubramanian and Linus Torvalds 2 * Copyright (C) 1992 Krishna Balasubramanian and Linus Torvalds
5 * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com> 3 * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
6 */ 4 */
diff --git a/arch/x86/kernel/ldt_64.c b/arch/x86/kernel/ldt_64.c
index bc9ffd5c19cc..3796523d616a 100644
--- a/arch/x86/kernel/ldt_64.c
+++ b/arch/x86/kernel/ldt_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/x86_64/kernel/ldt.c
3 *
4 * Copyright (C) 1992 Krishna Balasubramanian and Linus Torvalds 2 * Copyright (C) 1992 Krishna Balasubramanian and Linus Torvalds
5 * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com> 3 * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
6 * Copyright (C) 2002 Andi Kleen 4 * Copyright (C) 2002 Andi Kleen
diff --git a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c
index 91966bafb3dc..deda9a221cf2 100644
--- a/arch/x86/kernel/machine_kexec_32.c
+++ b/arch/x86/kernel/machine_kexec_32.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * machine_kexec.c - handle transition of Linux booting another kernel 2 * handle transition of Linux booting another kernel
3 * Copyright (C) 2002-2005 Eric Biederman <ebiederm@xmission.com> 3 * Copyright (C) 2002-2005 Eric Biederman <ebiederm@xmission.com>
4 * 4 *
5 * This source code is licensed under the GNU General Public License, 5 * This source code is licensed under the GNU General Public License,
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index c3a554703672..cd1899a2f0c5 100644
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * machine_kexec.c - handle transition of Linux booting another kernel 2 * handle transition of Linux booting another kernel
3 * Copyright (C) 2002-2005 Eric Biederman <ebiederm@xmission.com> 3 * Copyright (C) 2002-2005 Eric Biederman <ebiederm@xmission.com>
4 * 4 *
5 * This source code is licensed under the GNU General Public License, 5 * This source code is licensed under the GNU General Public License,
diff --git a/arch/x86/kernel/mca_32.c b/arch/x86/kernel/mca_32.c
index b83672b89527..9482033ed0fe 100644
--- a/arch/x86/kernel/mca_32.c
+++ b/arch/x86/kernel/mca_32.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/mca.c
3 * Written by Martin Kolinek, February 1996 2 * Written by Martin Kolinek, February 1996
4 * 3 *
5 * Changes: 4 * Changes:
diff --git a/arch/x86/kernel/mce_amd_64.c b/arch/x86/kernel/mce_amd_64.c
index 2f8a7f18b0fe..805b62b1e0df 100644
--- a/arch/x86/kernel/mce_amd_64.c
+++ b/arch/x86/kernel/mce_amd_64.c
@@ -472,7 +472,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
472 472
473#ifdef CONFIG_SMP 473#ifdef CONFIG_SMP
474 if (cpu_data[cpu].cpu_core_id && shared_bank[bank]) { /* symlink */ 474 if (cpu_data[cpu].cpu_core_id && shared_bank[bank]) { /* symlink */
475 i = first_cpu(cpu_core_map[cpu]); 475 i = first_cpu(per_cpu(cpu_core_map, cpu));
476 476
477 /* first core not up yet */ 477 /* first core not up yet */
478 if (cpu_data[i].cpu_core_id) 478 if (cpu_data[i].cpu_core_id)
@@ -492,7 +492,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
492 if (err) 492 if (err)
493 goto out; 493 goto out;
494 494
495 b->cpus = cpu_core_map[cpu]; 495 b->cpus = per_cpu(cpu_core_map, cpu);
496 per_cpu(threshold_banks, cpu)[bank] = b; 496 per_cpu(threshold_banks, cpu)[bank] = b;
497 goto out; 497 goto out;
498 } 498 }
@@ -509,7 +509,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
509#ifndef CONFIG_SMP 509#ifndef CONFIG_SMP
510 b->cpus = CPU_MASK_ALL; 510 b->cpus = CPU_MASK_ALL;
511#else 511#else
512 b->cpus = cpu_core_map[cpu]; 512 b->cpus = per_cpu(cpu_core_map, cpu);
513#endif 513#endif
514 err = kobject_register(&b->kobj); 514 err = kobject_register(&b->kobj);
515 if (err) 515 if (err)
diff --git a/arch/x86/kernel/mfgpt_32.c b/arch/x86/kernel/mfgpt_32.c
new file mode 100644
index 000000000000..0ab680f2d9db
--- /dev/null
+++ b/arch/x86/kernel/mfgpt_32.c
@@ -0,0 +1,362 @@
1/*
2 * Driver/API for AMD Geode Multi-Function General Purpose Timers (MFGPT)
3 *
4 * Copyright (C) 2006, Advanced Micro Devices, Inc.
5 * Copyright (C) 2007, Andres Salomon <dilinger@debian.org>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of version 2 of the GNU General Public License
9 * as published by the Free Software Foundation.
10 *
11 * The MFGPTs are documented in AMD Geode CS5536 Companion Device Data Book.
12 */
13
14/*
15 * We are using the 32Khz input clock - its the only one that has the
16 * ranges we find desirable. The following table lists the suitable
17 * divisors and the associated hz, minimum interval
18 * and the maximum interval:
19 *
20 * Divisor Hz Min Delta (S) Max Delta (S)
21 * 1 32000 .0005 2.048
22 * 2 16000 .001 4.096
23 * 4 8000 .002 8.192
24 * 8 4000 .004 16.384
25 * 16 2000 .008 32.768
26 * 32 1000 .016 65.536
27 * 64 500 .032 131.072
28 * 128 250 .064 262.144
29 * 256 125 .128 524.288
30 */
31
32#include <linux/kernel.h>
33#include <linux/interrupt.h>
34#include <linux/module.h>
35#include <asm/geode.h>
36
37#define F_AVAIL 0x01
38
39static struct mfgpt_timer_t {
40 int flags;
41 struct module *owner;
42} mfgpt_timers[MFGPT_MAX_TIMERS];
43
44/* Selected from the table above */
45
46#define MFGPT_DIVISOR 16
47#define MFGPT_SCALE 4 /* divisor = 2^(scale) */
48#define MFGPT_HZ (32000 / MFGPT_DIVISOR)
49#define MFGPT_PERIODIC (MFGPT_HZ / HZ)
50
51#ifdef CONFIG_GEODE_MFGPT_TIMER
52static int __init mfgpt_timer_setup(void);
53#else
54#define mfgpt_timer_setup() (0)
55#endif
56
57/* Allow for disabling of MFGPTs */
58static int disable;
59static int __init mfgpt_disable(char *s)
60{
61 disable = 1;
62 return 1;
63}
64__setup("nomfgpt", mfgpt_disable);
65
66/*
67 * Check whether any MFGPTs are available for the kernel to use. In most
68 * cases, firmware that uses AMD's VSA code will claim all timers during
69 * bootup; we certainly don't want to take them if they're already in use.
70 * In other cases (such as with VSAless OpenFirmware), the system firmware
71 * leaves timers available for us to use.
72 */
73int __init geode_mfgpt_detect(void)
74{
75 int count = 0, i;
76 u16 val;
77
78 if (disable) {
79 printk(KERN_INFO "geode-mfgpt: Skipping MFGPT setup\n");
80 return 0;
81 }
82
83 for (i = 0; i < MFGPT_MAX_TIMERS; i++) {
84 val = geode_mfgpt_read(i, MFGPT_REG_SETUP);
85 if (!(val & MFGPT_SETUP_SETUP)) {
86 mfgpt_timers[i].flags = F_AVAIL;
87 count++;
88 }
89 }
90
91 /* set up clock event device, if desired */
92 i = mfgpt_timer_setup();
93
94 return count;
95}
96
97int geode_mfgpt_toggle_event(int timer, int cmp, int event, int enable)
98{
99 u32 msr, mask, value, dummy;
100 int shift = (cmp == MFGPT_CMP1) ? 0 : 8;
101
102 if (timer < 0 || timer >= MFGPT_MAX_TIMERS)
103 return -EIO;
104
105 /*
106 * The register maps for these are described in sections 6.17.1.x of
107 * the AMD Geode CS5536 Companion Device Data Book.
108 */
109 switch (event) {
110 case MFGPT_EVENT_RESET:
111 /*
112 * XXX: According to the docs, we cannot reset timers above
113 * 6; that is, resets for 7 and 8 will be ignored. Is this
114 * a problem? -dilinger
115 */
116 msr = MFGPT_NR_MSR;
117 mask = 1 << (timer + 24);
118 break;
119
120 case MFGPT_EVENT_NMI:
121 msr = MFGPT_NR_MSR;
122 mask = 1 << (timer + shift);
123 break;
124
125 case MFGPT_EVENT_IRQ:
126 msr = MFGPT_IRQ_MSR;
127 mask = 1 << (timer + shift);
128 break;
129
130 default:
131 return -EIO;
132 }
133
134 rdmsr(msr, value, dummy);
135
136 if (enable)
137 value |= mask;
138 else
139 value &= ~mask;
140
141 wrmsr(msr, value, dummy);
142 return 0;
143}
144
145int geode_mfgpt_set_irq(int timer, int cmp, int irq, int enable)
146{
147 u32 val, dummy;
148 int offset;
149
150 if (timer < 0 || timer >= MFGPT_MAX_TIMERS)
151 return -EIO;
152
153 if (geode_mfgpt_toggle_event(timer, cmp, MFGPT_EVENT_IRQ, enable))
154 return -EIO;
155
156 rdmsr(MSR_PIC_ZSEL_LOW, val, dummy);
157
158 offset = (timer % 4) * 4;
159
160 val &= ~((0xF << offset) | (0xF << (offset + 16)));
161
162 if (enable) {
163 val |= (irq & 0x0F) << (offset);
164 val |= (irq & 0x0F) << (offset + 16);
165 }
166
167 wrmsr(MSR_PIC_ZSEL_LOW, val, dummy);
168 return 0;
169}
170
171static int mfgpt_get(int timer, struct module *owner)
172{
173 mfgpt_timers[timer].flags &= ~F_AVAIL;
174 mfgpt_timers[timer].owner = owner;
175 printk(KERN_INFO "geode-mfgpt: Registered timer %d\n", timer);
176 return timer;
177}
178
179int geode_mfgpt_alloc_timer(int timer, int domain, struct module *owner)
180{
181 int i;
182
183 if (!geode_get_dev_base(GEODE_DEV_MFGPT))
184 return -ENODEV;
185 if (timer >= MFGPT_MAX_TIMERS)
186 return -EIO;
187
188 if (timer < 0) {
189 /* Try to find an available timer */
190 for (i = 0; i < MFGPT_MAX_TIMERS; i++) {
191 if (mfgpt_timers[i].flags & F_AVAIL)
192 return mfgpt_get(i, owner);
193
194 if (i == 5 && domain == MFGPT_DOMAIN_WORKING)
195 break;
196 }
197 } else {
198 /* If they requested a specific timer, try to honor that */
199 if (mfgpt_timers[timer].flags & F_AVAIL)
200 return mfgpt_get(timer, owner);
201 }
202
203 /* No timers available - too bad */
204 return -1;
205}
206
207
208#ifdef CONFIG_GEODE_MFGPT_TIMER
209
210/*
211 * The MFPGT timers on the CS5536 provide us with suitable timers to use
212 * as clock event sources - not as good as a HPET or APIC, but certainly
213 * better then the PIT. This isn't a general purpose MFGPT driver, but
214 * a simplified one designed specifically to act as a clock event source.
215 * For full details about the MFGPT, please consult the CS5536 data sheet.
216 */
217
218#include <linux/clocksource.h>
219#include <linux/clockchips.h>
220
221static unsigned int mfgpt_tick_mode = CLOCK_EVT_MODE_SHUTDOWN;
222static u16 mfgpt_event_clock;
223
224static int irq = 7;
225static int __init mfgpt_setup(char *str)
226{
227 get_option(&str, &irq);
228 return 1;
229}
230__setup("mfgpt_irq=", mfgpt_setup);
231
232static inline void mfgpt_disable_timer(u16 clock)
233{
234 u16 val = geode_mfgpt_read(clock, MFGPT_REG_SETUP);
235 geode_mfgpt_write(clock, MFGPT_REG_SETUP, val & ~MFGPT_SETUP_CNTEN);
236}
237
238static int mfgpt_next_event(unsigned long, struct clock_event_device *);
239static void mfgpt_set_mode(enum clock_event_mode, struct clock_event_device *);
240
241static struct clock_event_device mfgpt_clockevent = {
242 .name = "mfgpt-timer",
243 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
244 .set_mode = mfgpt_set_mode,
245 .set_next_event = mfgpt_next_event,
246 .rating = 250,
247 .cpumask = CPU_MASK_ALL,
248 .shift = 32
249};
250
251static inline void mfgpt_start_timer(u16 clock, u16 delta)
252{
253 geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_CMP2, (u16) delta);
254 geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_COUNTER, 0);
255
256 geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_SETUP,
257 MFGPT_SETUP_CNTEN | MFGPT_SETUP_CMP2);
258}
259
260static void mfgpt_set_mode(enum clock_event_mode mode,
261 struct clock_event_device *evt)
262{
263 mfgpt_disable_timer(mfgpt_event_clock);
264
265 if (mode == CLOCK_EVT_MODE_PERIODIC)
266 mfgpt_start_timer(mfgpt_event_clock, MFGPT_PERIODIC);
267
268 mfgpt_tick_mode = mode;
269}
270
271static int mfgpt_next_event(unsigned long delta, struct clock_event_device *evt)
272{
273 mfgpt_start_timer(mfgpt_event_clock, delta);
274 return 0;
275}
276
277/* Assume (foolishly?), that this interrupt was due to our tick */
278
279static irqreturn_t mfgpt_tick(int irq, void *dev_id)
280{
281 if (mfgpt_tick_mode == CLOCK_EVT_MODE_SHUTDOWN)
282 return IRQ_HANDLED;
283
284 /* Turn off the clock */
285 mfgpt_disable_timer(mfgpt_event_clock);
286
287 /* Clear the counter */
288 geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_COUNTER, 0);
289
290 /* Restart the clock in periodic mode */
291
292 if (mfgpt_tick_mode == CLOCK_EVT_MODE_PERIODIC) {
293 geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_SETUP,
294 MFGPT_SETUP_CNTEN | MFGPT_SETUP_CMP2);
295 }
296
297 mfgpt_clockevent.event_handler(&mfgpt_clockevent);
298 return IRQ_HANDLED;
299}
300
301static struct irqaction mfgptirq = {
302 .handler = mfgpt_tick,
303 .flags = IRQF_DISABLED | IRQF_NOBALANCING,
304 .mask = CPU_MASK_NONE,
305 .name = "mfgpt-timer"
306};
307
308static int __init mfgpt_timer_setup(void)
309{
310 int timer, ret;
311 u16 val;
312
313 timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING,
314 THIS_MODULE);
315 if (timer < 0) {
316 printk(KERN_ERR
317 "mfgpt-timer: Could not allocate a MFPGT timer\n");
318 return -ENODEV;
319 }
320
321 mfgpt_event_clock = timer;
322 /* Set the clock scale and enable the event mode for CMP2 */
323 val = MFGPT_SCALE | (3 << 8);
324
325 geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_SETUP, val);
326
327 /* Set up the IRQ on the MFGPT side */
328 if (geode_mfgpt_setup_irq(mfgpt_event_clock, MFGPT_CMP2, irq)) {
329 printk(KERN_ERR "mfgpt-timer: Could not set up IRQ %d\n", irq);
330 return -EIO;
331 }
332
333 /* And register it with the kernel */
334 ret = setup_irq(irq, &mfgptirq);
335
336 if (ret) {
337 printk(KERN_ERR
338 "mfgpt-timer: Unable to set up the interrupt.\n");
339 goto err;
340 }
341
342 /* Set up the clock event */
343 mfgpt_clockevent.mult = div_sc(MFGPT_HZ, NSEC_PER_SEC, 32);
344 mfgpt_clockevent.min_delta_ns = clockevent_delta2ns(0xF,
345 &mfgpt_clockevent);
346 mfgpt_clockevent.max_delta_ns = clockevent_delta2ns(0xFFFE,
347 &mfgpt_clockevent);
348
349 printk(KERN_INFO
350 "mfgpt-timer: registering the MFGT timer as a clock event.\n");
351 clockevents_register_device(&mfgpt_clockevent);
352
353 return 0;
354
355err:
356 geode_mfgpt_release_irq(mfgpt_event_clock, MFGPT_CMP2, irq);
357 printk(KERN_ERR
358 "mfgpt-timer: Unable to set up the MFGPT clock source\n");
359 return -EIO;
360}
361
362#endif
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index 0c1069b8d638..c044de310b69 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -11,8 +11,6 @@
11 * ----------------------------------------------------------------------- */ 11 * ----------------------------------------------------------------------- */
12 12
13/* 13/*
14 * msr.c
15 *
16 * x86 MSR access device 14 * x86 MSR access device
17 * 15 *
18 * This device is accessed by lseek() to the appropriate register number 16 * This device is accessed by lseek() to the appropriate register number
diff --git a/arch/x86/kernel/nmi_32.c b/arch/x86/kernel/nmi_32.c
index c7227e2180f8..f803ed0ed1c4 100644
--- a/arch/x86/kernel/nmi_32.c
+++ b/arch/x86/kernel/nmi_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/nmi.c
3 *
4 * NMI watchdog support on APIC systems 2 * NMI watchdog support on APIC systems
5 * 3 *
6 * Started by Ingo Molnar <mingo@redhat.com> 4 * Started by Ingo Molnar <mingo@redhat.com>
@@ -353,7 +351,8 @@ __kprobes int nmi_watchdog_tick(struct pt_regs * regs, unsigned reason)
353 * Take the local apic timer and PIT/HPET into account. We don't 351 * Take the local apic timer and PIT/HPET into account. We don't
354 * know which one is active, when we have highres/dyntick on 352 * know which one is active, when we have highres/dyntick on
355 */ 353 */
356 sum = per_cpu(irq_stat, cpu).apic_timer_irqs + kstat_cpu(cpu).irqs[0]; 354 sum = per_cpu(irq_stat, cpu).apic_timer_irqs +
355 per_cpu(irq_stat, cpu).irq0_irqs;
357 356
358 /* if the none of the timers isn't firing, this cpu isn't doing much */ 357 /* if the none of the timers isn't firing, this cpu isn't doing much */
359 if (!touched && last_irq_sums[cpu] == sum) { 358 if (!touched && last_irq_sums[cpu] == sum) {
diff --git a/arch/x86/kernel/nmi_64.c b/arch/x86/kernel/nmi_64.c
index 0ec6d2ddb931..a576fd740062 100644
--- a/arch/x86/kernel/nmi_64.c
+++ b/arch/x86/kernel/nmi_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/x86_64/nmi.c
3 *
4 * NMI watchdog support on APIC systems 2 * NMI watchdog support on APIC systems
5 * 3 *
6 * Started by Ingo Molnar <mingo@redhat.com> 4 * Started by Ingo Molnar <mingo@redhat.com>
@@ -329,7 +327,7 @@ int __kprobes nmi_watchdog_tick(struct pt_regs * regs, unsigned reason)
329 touched = 1; 327 touched = 1;
330 } 328 }
331 329
332 sum = read_pda(apic_timer_irqs); 330 sum = read_pda(apic_timer_irqs) + read_pda(irq0_irqs);
333 if (__get_cpu_var(nmi_touch)) { 331 if (__get_cpu_var(nmi_touch)) {
334 __get_cpu_var(nmi_touch) = 0; 332 __get_cpu_var(nmi_touch) = 0;
335 touched = 1; 333 touched = 1;
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index 71da01e73f03..a50b787b3bfa 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -35,6 +35,7 @@
35#include <linux/pci_ids.h> 35#include <linux/pci_ids.h>
36#include <linux/pci.h> 36#include <linux/pci.h>
37#include <linux/delay.h> 37#include <linux/delay.h>
38#include <linux/scatterlist.h>
38#include <asm/iommu.h> 39#include <asm/iommu.h>
39#include <asm/calgary.h> 40#include <asm/calgary.h>
40#include <asm/tce.h> 41#include <asm/tce.h>
@@ -384,31 +385,32 @@ static void calgary_unmap_sg(struct device *dev,
384 struct scatterlist *sglist, int nelems, int direction) 385 struct scatterlist *sglist, int nelems, int direction)
385{ 386{
386 struct iommu_table *tbl = find_iommu_table(dev); 387 struct iommu_table *tbl = find_iommu_table(dev);
388 struct scatterlist *s;
389 int i;
387 390
388 if (!translate_phb(to_pci_dev(dev))) 391 if (!translate_phb(to_pci_dev(dev)))
389 return; 392 return;
390 393
391 while (nelems--) { 394 for_each_sg(sglist, s, nelems, i) {
392 unsigned int npages; 395 unsigned int npages;
393 dma_addr_t dma = sglist->dma_address; 396 dma_addr_t dma = s->dma_address;
394 unsigned int dmalen = sglist->dma_length; 397 unsigned int dmalen = s->dma_length;
395 398
396 if (dmalen == 0) 399 if (dmalen == 0)
397 break; 400 break;
398 401
399 npages = num_dma_pages(dma, dmalen); 402 npages = num_dma_pages(dma, dmalen);
400 iommu_free(tbl, dma, npages); 403 iommu_free(tbl, dma, npages);
401 sglist++;
402 } 404 }
403} 405}
404 406
405static int calgary_nontranslate_map_sg(struct device* dev, 407static int calgary_nontranslate_map_sg(struct device* dev,
406 struct scatterlist *sg, int nelems, int direction) 408 struct scatterlist *sg, int nelems, int direction)
407{ 409{
410 struct scatterlist *s;
408 int i; 411 int i;
409 412
410 for (i = 0; i < nelems; i++ ) { 413 for_each_sg(sg, s, nelems, i) {
411 struct scatterlist *s = &sg[i];
412 BUG_ON(!s->page); 414 BUG_ON(!s->page);
413 s->dma_address = virt_to_bus(page_address(s->page) +s->offset); 415 s->dma_address = virt_to_bus(page_address(s->page) +s->offset);
414 s->dma_length = s->length; 416 s->dma_length = s->length;
@@ -420,6 +422,7 @@ static int calgary_map_sg(struct device *dev, struct scatterlist *sg,
420 int nelems, int direction) 422 int nelems, int direction)
421{ 423{
422 struct iommu_table *tbl = find_iommu_table(dev); 424 struct iommu_table *tbl = find_iommu_table(dev);
425 struct scatterlist *s;
423 unsigned long vaddr; 426 unsigned long vaddr;
424 unsigned int npages; 427 unsigned int npages;
425 unsigned long entry; 428 unsigned long entry;
@@ -428,8 +431,7 @@ static int calgary_map_sg(struct device *dev, struct scatterlist *sg,
428 if (!translate_phb(to_pci_dev(dev))) 431 if (!translate_phb(to_pci_dev(dev)))
429 return calgary_nontranslate_map_sg(dev, sg, nelems, direction); 432 return calgary_nontranslate_map_sg(dev, sg, nelems, direction);
430 433
431 for (i = 0; i < nelems; i++ ) { 434 for_each_sg(sg, s, nelems, i) {
432 struct scatterlist *s = &sg[i];
433 BUG_ON(!s->page); 435 BUG_ON(!s->page);
434 436
435 vaddr = (unsigned long)page_address(s->page) + s->offset; 437 vaddr = (unsigned long)page_address(s->page) + s->offset;
@@ -454,9 +456,9 @@ static int calgary_map_sg(struct device *dev, struct scatterlist *sg,
454 return nelems; 456 return nelems;
455error: 457error:
456 calgary_unmap_sg(dev, sg, nelems, direction); 458 calgary_unmap_sg(dev, sg, nelems, direction);
457 for (i = 0; i < nelems; i++) { 459 for_each_sg(sg, s, nelems, i) {
458 sg[i].dma_address = bad_dma_address; 460 sg->dma_address = bad_dma_address;
459 sg[i].dma_length = 0; 461 sg->dma_length = 0;
460 } 462 }
461 return 0; 463 return 0;
462} 464}
diff --git a/arch/x86/kernel/pci-dma_32.c b/arch/x86/kernel/pci-dma_32.c
index 048f09b62553..0aae2f3847a5 100644
--- a/arch/x86/kernel/pci-dma_32.c
+++ b/arch/x86/kernel/pci-dma_32.c
@@ -63,7 +63,8 @@ void dma_free_coherent(struct device *dev, size_t size,
63{ 63{
64 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL; 64 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
65 int order = get_order(size); 65 int order = get_order(size);
66 66
67 WARN_ON(irqs_disabled()); /* for portability */
67 if (mem && vaddr >= mem->virt_base && vaddr < (mem->virt_base + (mem->size << PAGE_SHIFT))) { 68 if (mem && vaddr >= mem->virt_base && vaddr < (mem->virt_base + (mem->size << PAGE_SHIFT))) {
68 int page = (vaddr - mem->virt_base) >> PAGE_SHIFT; 69 int page = (vaddr - mem->virt_base) >> PAGE_SHIFT;
69 70
diff --git a/arch/x86/kernel/pci-dma_64.c b/arch/x86/kernel/pci-dma_64.c
index 29711445c818..9576a2eb375e 100644
--- a/arch/x86/kernel/pci-dma_64.c
+++ b/arch/x86/kernel/pci-dma_64.c
@@ -167,6 +167,7 @@ EXPORT_SYMBOL(dma_alloc_coherent);
167void dma_free_coherent(struct device *dev, size_t size, 167void dma_free_coherent(struct device *dev, size_t size,
168 void *vaddr, dma_addr_t bus) 168 void *vaddr, dma_addr_t bus)
169{ 169{
170 WARN_ON(irqs_disabled()); /* for portability */
170 if (dma_ops->unmap_single) 171 if (dma_ops->unmap_single)
171 dma_ops->unmap_single(dev, bus, size, 0); 172 dma_ops->unmap_single(dev, bus, size, 0);
172 free_pages((unsigned long)vaddr, get_order(size)); 173 free_pages((unsigned long)vaddr, get_order(size));
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index 4918c575d582..cfcc84e6c350 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -23,6 +23,7 @@
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/bitops.h> 24#include <linux/bitops.h>
25#include <linux/kdebug.h> 25#include <linux/kdebug.h>
26#include <linux/scatterlist.h>
26#include <asm/atomic.h> 27#include <asm/atomic.h>
27#include <asm/io.h> 28#include <asm/io.h>
28#include <asm/mtrr.h> 29#include <asm/mtrr.h>
@@ -278,10 +279,10 @@ static void gart_unmap_single(struct device *dev, dma_addr_t dma_addr,
278 */ 279 */
279static void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int dir) 280static void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
280{ 281{
282 struct scatterlist *s;
281 int i; 283 int i;
282 284
283 for (i = 0; i < nents; i++) { 285 for_each_sg(sg, s, nents, i) {
284 struct scatterlist *s = &sg[i];
285 if (!s->dma_length || !s->length) 286 if (!s->dma_length || !s->length)
286 break; 287 break;
287 gart_unmap_single(dev, s->dma_address, s->dma_length, dir); 288 gart_unmap_single(dev, s->dma_address, s->dma_length, dir);
@@ -292,14 +293,14 @@ static void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
292static int dma_map_sg_nonforce(struct device *dev, struct scatterlist *sg, 293static int dma_map_sg_nonforce(struct device *dev, struct scatterlist *sg,
293 int nents, int dir) 294 int nents, int dir)
294{ 295{
296 struct scatterlist *s;
295 int i; 297 int i;
296 298
297#ifdef CONFIG_IOMMU_DEBUG 299#ifdef CONFIG_IOMMU_DEBUG
298 printk(KERN_DEBUG "dma_map_sg overflow\n"); 300 printk(KERN_DEBUG "dma_map_sg overflow\n");
299#endif 301#endif
300 302
301 for (i = 0; i < nents; i++ ) { 303 for_each_sg(sg, s, nents, i) {
302 struct scatterlist *s = &sg[i];
303 unsigned long addr = page_to_phys(s->page) + s->offset; 304 unsigned long addr = page_to_phys(s->page) + s->offset;
304 if (nonforced_iommu(dev, addr, s->length)) { 305 if (nonforced_iommu(dev, addr, s->length)) {
305 addr = dma_map_area(dev, addr, s->length, dir); 306 addr = dma_map_area(dev, addr, s->length, dir);
@@ -319,23 +320,23 @@ static int dma_map_sg_nonforce(struct device *dev, struct scatterlist *sg,
319} 320}
320 321
321/* Map multiple scatterlist entries continuous into the first. */ 322/* Map multiple scatterlist entries continuous into the first. */
322static int __dma_map_cont(struct scatterlist *sg, int start, int stopat, 323static int __dma_map_cont(struct scatterlist *start, int nelems,
323 struct scatterlist *sout, unsigned long pages) 324 struct scatterlist *sout, unsigned long pages)
324{ 325{
325 unsigned long iommu_start = alloc_iommu(pages); 326 unsigned long iommu_start = alloc_iommu(pages);
326 unsigned long iommu_page = iommu_start; 327 unsigned long iommu_page = iommu_start;
328 struct scatterlist *s;
327 int i; 329 int i;
328 330
329 if (iommu_start == -1) 331 if (iommu_start == -1)
330 return -1; 332 return -1;
331 333
332 for (i = start; i < stopat; i++) { 334 for_each_sg(start, s, nelems, i) {
333 struct scatterlist *s = &sg[i];
334 unsigned long pages, addr; 335 unsigned long pages, addr;
335 unsigned long phys_addr = s->dma_address; 336 unsigned long phys_addr = s->dma_address;
336 337
337 BUG_ON(i > start && s->offset); 338 BUG_ON(s != start && s->offset);
338 if (i == start) { 339 if (s == start) {
339 *sout = *s; 340 *sout = *s;
340 sout->dma_address = iommu_bus_base; 341 sout->dma_address = iommu_bus_base;
341 sout->dma_address += iommu_page*PAGE_SIZE + s->offset; 342 sout->dma_address += iommu_page*PAGE_SIZE + s->offset;
@@ -357,17 +358,17 @@ static int __dma_map_cont(struct scatterlist *sg, int start, int stopat,
357 return 0; 358 return 0;
358} 359}
359 360
360static inline int dma_map_cont(struct scatterlist *sg, int start, int stopat, 361static inline int dma_map_cont(struct scatterlist *start, int nelems,
361 struct scatterlist *sout, 362 struct scatterlist *sout,
362 unsigned long pages, int need) 363 unsigned long pages, int need)
363{ 364{
364 if (!need) { 365 if (!need) {
365 BUG_ON(stopat - start != 1); 366 BUG_ON(nelems != 1);
366 *sout = sg[start]; 367 *sout = *start;
367 sout->dma_length = sg[start].length; 368 sout->dma_length = start->length;
368 return 0; 369 return 0;
369 } 370 }
370 return __dma_map_cont(sg, start, stopat, sout, pages); 371 return __dma_map_cont(start, nelems, sout, pages);
371} 372}
372 373
373/* 374/*
@@ -381,6 +382,7 @@ int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
381 int start; 382 int start;
382 unsigned long pages = 0; 383 unsigned long pages = 0;
383 int need = 0, nextneed; 384 int need = 0, nextneed;
385 struct scatterlist *s, *ps, *start_sg, *sgmap;
384 386
385 if (nents == 0) 387 if (nents == 0)
386 return 0; 388 return 0;
@@ -390,8 +392,9 @@ int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
390 392
391 out = 0; 393 out = 0;
392 start = 0; 394 start = 0;
393 for (i = 0; i < nents; i++) { 395 start_sg = sgmap = sg;
394 struct scatterlist *s = &sg[i]; 396 ps = NULL; /* shut up gcc */
397 for_each_sg(sg, s, nents, i) {
395 dma_addr_t addr = page_to_phys(s->page) + s->offset; 398 dma_addr_t addr = page_to_phys(s->page) + s->offset;
396 s->dma_address = addr; 399 s->dma_address = addr;
397 BUG_ON(s->length == 0); 400 BUG_ON(s->length == 0);
@@ -400,29 +403,33 @@ int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
400 403
401 /* Handle the previous not yet processed entries */ 404 /* Handle the previous not yet processed entries */
402 if (i > start) { 405 if (i > start) {
403 struct scatterlist *ps = &sg[i-1];
404 /* Can only merge when the last chunk ends on a page 406 /* Can only merge when the last chunk ends on a page
405 boundary and the new one doesn't have an offset. */ 407 boundary and the new one doesn't have an offset. */
406 if (!iommu_merge || !nextneed || !need || s->offset || 408 if (!iommu_merge || !nextneed || !need || s->offset ||
407 (ps->offset + ps->length) % PAGE_SIZE) { 409 (ps->offset + ps->length) % PAGE_SIZE) {
408 if (dma_map_cont(sg, start, i, sg+out, pages, 410 if (dma_map_cont(start_sg, i - start, sgmap,
409 need) < 0) 411 pages, need) < 0)
410 goto error; 412 goto error;
411 out++; 413 out++;
414 sgmap = sg_next(sgmap);
412 pages = 0; 415 pages = 0;
413 start = i; 416 start = i;
417 start_sg = s;
414 } 418 }
415 } 419 }
416 420
417 need = nextneed; 421 need = nextneed;
418 pages += to_pages(s->offset, s->length); 422 pages += to_pages(s->offset, s->length);
423 ps = s;
419 } 424 }
420 if (dma_map_cont(sg, start, i, sg+out, pages, need) < 0) 425 if (dma_map_cont(start_sg, i - start, sgmap, pages, need) < 0)
421 goto error; 426 goto error;
422 out++; 427 out++;
423 flush_gart(); 428 flush_gart();
424 if (out < nents) 429 if (out < nents) {
425 sg[out].dma_length = 0; 430 sgmap = sg_next(sgmap);
431 sgmap->dma_length = 0;
432 }
426 return out; 433 return out;
427 434
428error: 435error:
@@ -437,8 +444,8 @@ error:
437 if (panic_on_overflow) 444 if (panic_on_overflow)
438 panic("dma_map_sg: overflow on %lu pages\n", pages); 445 panic("dma_map_sg: overflow on %lu pages\n", pages);
439 iommu_full(dev, pages << PAGE_SHIFT, dir); 446 iommu_full(dev, pages << PAGE_SHIFT, dir);
440 for (i = 0; i < nents; i++) 447 for_each_sg(sg, s, nents, i)
441 sg[i].dma_address = bad_dma_address; 448 s->dma_address = bad_dma_address;
442 return 0; 449 return 0;
443} 450}
444 451
diff --git a/arch/x86/kernel/pci-nommu_64.c b/arch/x86/kernel/pci-nommu_64.c
index 2a34c6c025a9..e85d4360360c 100644
--- a/arch/x86/kernel/pci-nommu_64.c
+++ b/arch/x86/kernel/pci-nommu_64.c
@@ -5,6 +5,7 @@
5#include <linux/pci.h> 5#include <linux/pci.h>
6#include <linux/string.h> 6#include <linux/string.h>
7#include <linux/dma-mapping.h> 7#include <linux/dma-mapping.h>
8#include <linux/scatterlist.h>
8 9
9#include <asm/iommu.h> 10#include <asm/iommu.h>
10#include <asm/processor.h> 11#include <asm/processor.h>
@@ -57,10 +58,10 @@ static void nommu_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
57static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg, 58static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
58 int nents, int direction) 59 int nents, int direction)
59{ 60{
61 struct scatterlist *s;
60 int i; 62 int i;
61 63
62 for (i = 0; i < nents; i++ ) { 64 for_each_sg(sg, s, nents, i) {
63 struct scatterlist *s = &sg[i];
64 BUG_ON(!s->page); 65 BUG_ON(!s->page);
65 s->dma_address = virt_to_bus(page_address(s->page) +s->offset); 66 s->dma_address = virt_to_bus(page_address(s->page) +s->offset);
66 if (!check_addr("map_sg", hwdev, s->dma_address, s->length)) 67 if (!check_addr("map_sg", hwdev, s->dma_address, s->length))
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 84664710b784..097aeafce5ff 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/process.c
3 *
4 * Copyright (C) 1995 Linus Torvalds 2 * Copyright (C) 1995 Linus Torvalds
5 * 3 *
6 * Pentium III FXSR, SSE support 4 * Pentium III FXSR, SSE support
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 98956555450b..6309b275cb9c 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/x86-64/kernel/process.c
3 *
4 * Copyright (C) 1995 Linus Torvalds 2 * Copyright (C) 1995 Linus Torvalds
5 * 3 *
6 * Pentium III FXSR, SSE support 4 * Pentium III FXSR, SSE support
@@ -38,6 +36,7 @@
38#include <linux/notifier.h> 36#include <linux/notifier.h>
39#include <linux/kprobes.h> 37#include <linux/kprobes.h>
40#include <linux/kdebug.h> 38#include <linux/kdebug.h>
39#include <linux/tick.h>
41 40
42#include <asm/uaccess.h> 41#include <asm/uaccess.h>
43#include <asm/pgtable.h> 42#include <asm/pgtable.h>
@@ -208,6 +207,8 @@ void cpu_idle (void)
208 if (__get_cpu_var(cpu_idle_state)) 207 if (__get_cpu_var(cpu_idle_state))
209 __get_cpu_var(cpu_idle_state) = 0; 208 __get_cpu_var(cpu_idle_state) = 0;
210 209
210 tick_nohz_stop_sched_tick();
211
211 rmb(); 212 rmb();
212 idle = pm_idle; 213 idle = pm_idle;
213 if (!idle) 214 if (!idle)
@@ -228,6 +229,7 @@ void cpu_idle (void)
228 __exit_idle(); 229 __exit_idle();
229 } 230 }
230 231
232 tick_nohz_restart_sched_tick();
231 preempt_enable_no_resched(); 233 preempt_enable_no_resched();
232 schedule(); 234 schedule();
233 preempt_disable(); 235 preempt_disable();
@@ -579,7 +581,7 @@ static inline void __switch_to_xtra(struct task_struct *prev_p,
579 * 581 *
580 * Kprobes not supported here. Set the probe on schedule instead. 582 * Kprobes not supported here. Set the probe on schedule instead.
581 */ 583 */
582__kprobes struct task_struct * 584struct task_struct *
583__switch_to(struct task_struct *prev_p, struct task_struct *next_p) 585__switch_to(struct task_struct *prev_p, struct task_struct *next_p)
584{ 586{
585 struct thread_struct *prev = &prev_p->thread, 587 struct thread_struct *prev = &prev_p->thread,
diff --git a/arch/x86/kernel/ptrace_32.c b/arch/x86/kernel/ptrace_32.c
index 7c1b92522e95..8622b9cd3e38 100644
--- a/arch/x86/kernel/ptrace_32.c
+++ b/arch/x86/kernel/ptrace_32.c
@@ -1,4 +1,3 @@
1/* ptrace.c */
2/* By Ross Biro 1/23/92 */ 1/* By Ross Biro 1/23/92 */
3/* 2/*
4 * Pentium III FXSR, SSE support 3 * Pentium III FXSR, SSE support
@@ -525,11 +524,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
525 ret = 0; 524 ret = 0;
526 break; 525 break;
527 526
528 case PTRACE_DETACH:
529 /* detach a process that was attached. */
530 ret = ptrace_detach(child, data);
531 break;
532
533 case PTRACE_GETREGS: { /* Get all gp regs from the child. */ 527 case PTRACE_GETREGS: { /* Get all gp regs from the child. */
534 if (!access_ok(VERIFY_WRITE, datap, FRAME_SIZE*sizeof(long))) { 528 if (!access_ok(VERIFY_WRITE, datap, FRAME_SIZE*sizeof(long))) {
535 ret = -EIO; 529 ret = -EIO;
diff --git a/arch/x86/kernel/ptrace_64.c b/arch/x86/kernel/ptrace_64.c
index eea3702427b4..86321ee6da93 100644
--- a/arch/x86/kernel/ptrace_64.c
+++ b/arch/x86/kernel/ptrace_64.c
@@ -1,4 +1,3 @@
1/* ptrace.c */
2/* By Ross Biro 1/23/92 */ 1/* By Ross Biro 1/23/92 */
3/* 2/*
4 * Pentium III FXSR, SSE support 3 * Pentium III FXSR, SSE support
@@ -501,11 +500,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
501 ret = 0; 500 ret = 0;
502 break; 501 break;
503 502
504 case PTRACE_DETACH:
505 /* detach a process that was attached. */
506 ret = ptrace_detach(child, data);
507 break;
508
509 case PTRACE_GETREGS: { /* Get all gp regs from the child. */ 503 case PTRACE_GETREGS: { /* Get all gp regs from the child. */
510 if (!access_ok(VERIFY_WRITE, (unsigned __user *)data, 504 if (!access_ok(VERIFY_WRITE, (unsigned __user *)data,
511 sizeof(struct user_regs_struct))) { 505 sizeof(struct user_regs_struct))) {
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index 6722469c2633..d769e204f942 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -4,6 +4,8 @@
4#include <linux/pci.h> 4#include <linux/pci.h>
5#include <linux/irq.h> 5#include <linux/irq.h>
6 6
7#include <asm/hpet.h>
8
7#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_SMP) && defined(CONFIG_PCI) 9#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_SMP) && defined(CONFIG_PCI)
8 10
9static void __devinit quirk_intel_irqbalance(struct pci_dev *dev) 11static void __devinit quirk_intel_irqbalance(struct pci_dev *dev)
@@ -47,3 +49,206 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, quir
47DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, quirk_intel_irqbalance); 49DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, quirk_intel_irqbalance);
48DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH, quirk_intel_irqbalance); 50DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH, quirk_intel_irqbalance);
49#endif 51#endif
52
53#if defined(CONFIG_HPET_TIMER)
54unsigned long force_hpet_address;
55
56static enum {
57 NONE_FORCE_HPET_RESUME,
58 OLD_ICH_FORCE_HPET_RESUME,
59 ICH_FORCE_HPET_RESUME
60} force_hpet_resume_type;
61
62static void __iomem *rcba_base;
63
64static void ich_force_hpet_resume(void)
65{
66 u32 val;
67
68 if (!force_hpet_address)
69 return;
70
71 if (rcba_base == NULL)
72 BUG();
73
74 /* read the Function Disable register, dword mode only */
75 val = readl(rcba_base + 0x3404);
76 if (!(val & 0x80)) {
77 /* HPET disabled in HPTC. Trying to enable */
78 writel(val | 0x80, rcba_base + 0x3404);
79 }
80
81 val = readl(rcba_base + 0x3404);
82 if (!(val & 0x80))
83 BUG();
84 else
85 printk(KERN_DEBUG "Force enabled HPET at resume\n");
86
87 return;
88}
89
90static void ich_force_enable_hpet(struct pci_dev *dev)
91{
92 u32 val;
93 u32 uninitialized_var(rcba);
94 int err = 0;
95
96 if (hpet_address || force_hpet_address)
97 return;
98
99 pci_read_config_dword(dev, 0xF0, &rcba);
100 rcba &= 0xFFFFC000;
101 if (rcba == 0) {
102 printk(KERN_DEBUG "RCBA disabled. Cannot force enable HPET\n");
103 return;
104 }
105
106 /* use bits 31:14, 16 kB aligned */
107 rcba_base = ioremap_nocache(rcba, 0x4000);
108 if (rcba_base == NULL) {
109 printk(KERN_DEBUG "ioremap failed. Cannot force enable HPET\n");
110 return;
111 }
112
113 /* read the Function Disable register, dword mode only */
114 val = readl(rcba_base + 0x3404);
115
116 if (val & 0x80) {
117 /* HPET is enabled in HPTC. Just not reported by BIOS */
118 val = val & 0x3;
119 force_hpet_address = 0xFED00000 | (val << 12);
120 printk(KERN_DEBUG "Force enabled HPET at base address 0x%lx\n",
121 force_hpet_address);
122 iounmap(rcba_base);
123 return;
124 }
125
126 /* HPET disabled in HPTC. Trying to enable */
127 writel(val | 0x80, rcba_base + 0x3404);
128
129 val = readl(rcba_base + 0x3404);
130 if (!(val & 0x80)) {
131 err = 1;
132 } else {
133 val = val & 0x3;
134 force_hpet_address = 0xFED00000 | (val << 12);
135 }
136
137 if (err) {
138 force_hpet_address = 0;
139 iounmap(rcba_base);
140 printk(KERN_DEBUG "Failed to force enable HPET\n");
141 } else {
142 force_hpet_resume_type = ICH_FORCE_HPET_RESUME;
143 printk(KERN_DEBUG "Force enabled HPET at base address 0x%lx\n",
144 force_hpet_address);
145 }
146}
147
148DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_0,
149 ich_force_enable_hpet);
150DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1,
151 ich_force_enable_hpet);
152DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0,
153 ich_force_enable_hpet);
154DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1,
155 ich_force_enable_hpet);
156DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31,
157 ich_force_enable_hpet);
158DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_1,
159 ich_force_enable_hpet);
160
161
162static struct pci_dev *cached_dev;
163
164static void old_ich_force_hpet_resume(void)
165{
166 u32 val;
167 u32 uninitialized_var(gen_cntl);
168
169 if (!force_hpet_address || !cached_dev)
170 return;
171
172 pci_read_config_dword(cached_dev, 0xD0, &gen_cntl);
173 gen_cntl &= (~(0x7 << 15));
174 gen_cntl |= (0x4 << 15);
175
176 pci_write_config_dword(cached_dev, 0xD0, gen_cntl);
177 pci_read_config_dword(cached_dev, 0xD0, &gen_cntl);
178 val = gen_cntl >> 15;
179 val &= 0x7;
180 if (val == 0x4)
181 printk(KERN_DEBUG "Force enabled HPET at resume\n");
182 else
183 BUG();
184}
185
186static void old_ich_force_enable_hpet(struct pci_dev *dev)
187{
188 u32 val;
189 u32 uninitialized_var(gen_cntl);
190
191 if (hpet_address || force_hpet_address)
192 return;
193
194 pci_read_config_dword(dev, 0xD0, &gen_cntl);
195 /*
196 * Bit 17 is HPET enable bit.
197 * Bit 16:15 control the HPET base address.
198 */
199 val = gen_cntl >> 15;
200 val &= 0x7;
201 if (val & 0x4) {
202 val &= 0x3;
203 force_hpet_address = 0xFED00000 | (val << 12);
204 printk(KERN_DEBUG "HPET at base address 0x%lx\n",
205 force_hpet_address);
206 return;
207 }
208
209 /*
210 * HPET is disabled. Trying enabling at FED00000 and check
211 * whether it sticks
212 */
213 gen_cntl &= (~(0x7 << 15));
214 gen_cntl |= (0x4 << 15);
215 pci_write_config_dword(dev, 0xD0, gen_cntl);
216
217 pci_read_config_dword(dev, 0xD0, &gen_cntl);
218
219 val = gen_cntl >> 15;
220 val &= 0x7;
221 if (val & 0x4) {
222 /* HPET is enabled in HPTC. Just not reported by BIOS */
223 val &= 0x3;
224 force_hpet_address = 0xFED00000 | (val << 12);
225 printk(KERN_DEBUG "Force enabled HPET at base address 0x%lx\n",
226 force_hpet_address);
227 cached_dev = dev;
228 force_hpet_resume_type = OLD_ICH_FORCE_HPET_RESUME;
229 return;
230 }
231
232 printk(KERN_DEBUG "Failed to force enable HPET\n");
233}
234
235DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0,
236 old_ich_force_enable_hpet);
237DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_12,
238 old_ich_force_enable_hpet);
239
240void force_hpet_resume(void)
241{
242 switch (force_hpet_resume_type) {
243 case ICH_FORCE_HPET_RESUME:
244 return ich_force_hpet_resume();
245
246 case OLD_ICH_FORCE_HPET_RESUME:
247 return old_ich_force_hpet_resume();
248
249 default:
250 break;
251 }
252}
253
254#endif
diff --git a/arch/x86/kernel/reboot_32.c b/arch/x86/kernel/reboot_32.c
index b37ed226830a..9e2269d00918 100644
--- a/arch/x86/kernel/reboot_32.c
+++ b/arch/x86/kernel/reboot_32.c
@@ -1,7 +1,3 @@
1/*
2 * linux/arch/i386/kernel/reboot.c
3 */
4
5#include <linux/mm.h> 1#include <linux/mm.h>
6#include <linux/module.h> 2#include <linux/module.h>
7#include <linux/delay.h> 3#include <linux/delay.h>
diff --git a/arch/x86/kernel/reboot_fixups_32.c b/arch/x86/kernel/reboot_fixups_32.c
index 03e1cce58f49..8b30b26ad069 100644
--- a/arch/x86/kernel/reboot_fixups_32.c
+++ b/arch/x86/kernel/reboot_fixups_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/reboot_fixups.c
3 *
4 * This is a good place to put board specific reboot fixups. 2 * This is a good place to put board specific reboot fixups.
5 * 3 *
6 * List of supported fixups: 4 * List of supported fixups:
@@ -11,6 +9,7 @@
11 9
12#include <asm/delay.h> 10#include <asm/delay.h>
13#include <linux/pci.h> 11#include <linux/pci.h>
12#include <linux/interrupt.h>
14#include <asm/reboot_fixups.h> 13#include <asm/reboot_fixups.h>
15#include <asm/msr.h> 14#include <asm/msr.h>
16 15
@@ -56,6 +55,11 @@ void mach_reboot_fixups(void)
56 struct pci_dev *dev; 55 struct pci_dev *dev;
57 int i; 56 int i;
58 57
58 /* we can be called from sysrq-B code. In such a case it is
59 * prohibited to dig PCI */
60 if (in_interrupt())
61 return;
62
59 for (i=0; i < ARRAY_SIZE(fixups_table); i++) { 63 for (i=0; i < ARRAY_SIZE(fixups_table); i++) {
60 cur = &(fixups_table[i]); 64 cur = &(fixups_table[i]);
61 dev = pci_get_device(cur->vendor, cur->device, NULL); 65 dev = pci_get_device(cur->vendor, cur->device, NULL);
diff --git a/arch/x86/kernel/scx200_32.c b/arch/x86/kernel/scx200_32.c
index c7d3df23f589..87bc159d29df 100644
--- a/arch/x86/kernel/scx200_32.c
+++ b/arch/x86/kernel/scx200_32.c
@@ -1,8 +1,8 @@
1/* linux/arch/i386/kernel/scx200.c 1/*
2 2 * Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>
3 Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com> 3 *
4 4 * National Semiconductor SCx200 support.
5 National Semiconductor SCx200 support. */ 5 */
6 6
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/errno.h> 8#include <linux/errno.h>
@@ -24,7 +24,7 @@ MODULE_DESCRIPTION("NatSemi SCx200 Driver");
24MODULE_LICENSE("GPL"); 24MODULE_LICENSE("GPL");
25 25
26unsigned scx200_gpio_base = 0; 26unsigned scx200_gpio_base = 0;
27long scx200_gpio_shadow[2]; 27unsigned long scx200_gpio_shadow[2];
28 28
29unsigned scx200_cb_base = 0; 29unsigned scx200_cb_base = 0;
30 30
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index d474cd639bcb..c8e1bc38d421 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/setup.c
3 *
4 * Copyright (C) 1995 Linus Torvalds 2 * Copyright (C) 1995 Linus Torvalds
5 * 3 *
6 * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999 4 * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index af838f6b0b7f..85b5b6310acc 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -1,10 +1,5 @@
1/* 1/*
2 * linux/arch/x86-64/kernel/setup.c
3 *
4 * Copyright (C) 1995 Linus Torvalds 2 * Copyright (C) 1995 Linus Torvalds
5 *
6 * Nov 2001 Dave Jones <davej@suse.de>
7 * Forked from i386 setup code.
8 */ 3 */
9 4
10/* 5/*
@@ -546,6 +541,37 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
546#endif 541#endif
547} 542}
548 543
544#define ENABLE_C1E_MASK 0x18000000
545#define CPUID_PROCESSOR_SIGNATURE 1
546#define CPUID_XFAM 0x0ff00000
547#define CPUID_XFAM_K8 0x00000000
548#define CPUID_XFAM_10H 0x00100000
549#define CPUID_XFAM_11H 0x00200000
550#define CPUID_XMOD 0x000f0000
551#define CPUID_XMOD_REV_F 0x00040000
552
553/* AMD systems with C1E don't have a working lAPIC timer. Check for that. */
554static __cpuinit int amd_apic_timer_broken(void)
555{
556 u32 lo, hi;
557 u32 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
558 switch (eax & CPUID_XFAM) {
559 case CPUID_XFAM_K8:
560 if ((eax & CPUID_XMOD) < CPUID_XMOD_REV_F)
561 break;
562 case CPUID_XFAM_10H:
563 case CPUID_XFAM_11H:
564 rdmsr(MSR_K8_ENABLE_C1E, lo, hi);
565 if (lo & ENABLE_C1E_MASK)
566 return 1;
567 break;
568 default:
569 /* err on the side of caution */
570 return 1;
571 }
572 return 0;
573}
574
549static void __cpuinit init_amd(struct cpuinfo_x86 *c) 575static void __cpuinit init_amd(struct cpuinfo_x86 *c)
550{ 576{
551 unsigned level; 577 unsigned level;
@@ -617,6 +643,9 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
617 /* Family 10 doesn't support C states in MWAIT so don't use it */ 643 /* Family 10 doesn't support C states in MWAIT so don't use it */
618 if (c->x86 == 0x10 && !force_mwait) 644 if (c->x86 == 0x10 && !force_mwait)
619 clear_bit(X86_FEATURE_MWAIT, &c->x86_capability); 645 clear_bit(X86_FEATURE_MWAIT, &c->x86_capability);
646
647 if (amd_apic_timer_broken())
648 disable_apic_timer = 1;
620} 649}
621 650
622static void __cpuinit detect_ht(struct cpuinfo_x86 *c) 651static void __cpuinit detect_ht(struct cpuinfo_x86 *c)
@@ -1041,7 +1070,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1041 if (smp_num_siblings * c->x86_max_cores > 1) { 1070 if (smp_num_siblings * c->x86_max_cores > 1) {
1042 int cpu = c - cpu_data; 1071 int cpu = c - cpu_data;
1043 seq_printf(m, "physical id\t: %d\n", c->phys_proc_id); 1072 seq_printf(m, "physical id\t: %d\n", c->phys_proc_id);
1044 seq_printf(m, "siblings\t: %d\n", cpus_weight(cpu_core_map[cpu])); 1073 seq_printf(m, "siblings\t: %d\n",
1074 cpus_weight(per_cpu(cpu_core_map, cpu)));
1045 seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id); 1075 seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id);
1046 seq_printf(m, "cpu cores\t: %d\n", c->booted_cores); 1076 seq_printf(m, "cpu cores\t: %d\n", c->booted_cores);
1047 } 1077 }
diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c
index c03570f7fe8e..d01d51fcce2a 100644
--- a/arch/x86/kernel/signal_32.c
+++ b/arch/x86/kernel/signal_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/signal.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds 2 * Copyright (C) 1991, 1992 Linus Torvalds
5 * 3 *
6 * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson 4 * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c
index 739175b01e06..683802bec419 100644
--- a/arch/x86/kernel/signal_64.c
+++ b/arch/x86/kernel/signal_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/x86_64/kernel/signal.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds 2 * Copyright (C) 1991, 1992 Linus Torvalds
5 * Copyright (C) 2000, 2001, 2002 Andi Kleen SuSE Labs 3 * Copyright (C) 2000, 2001, 2002 Andi Kleen SuSE Labs
6 * 4 *
diff --git a/arch/x86/kernel/smpboot_32.c b/arch/x86/kernel/smpboot_32.c
index e4f61d1c6248..31fc08bd15ef 100644
--- a/arch/x86/kernel/smpboot_32.c
+++ b/arch/x86/kernel/smpboot_32.c
@@ -70,12 +70,12 @@ EXPORT_SYMBOL(smp_num_siblings);
70int cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID}; 70int cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID};
71 71
72/* representing HT siblings of each logical CPU */ 72/* representing HT siblings of each logical CPU */
73cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly; 73DEFINE_PER_CPU(cpumask_t, cpu_sibling_map);
74EXPORT_SYMBOL(cpu_sibling_map); 74EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
75 75
76/* representing HT and core siblings of each logical CPU */ 76/* representing HT and core siblings of each logical CPU */
77cpumask_t cpu_core_map[NR_CPUS] __read_mostly; 77DEFINE_PER_CPU(cpumask_t, cpu_core_map);
78EXPORT_SYMBOL(cpu_core_map); 78EXPORT_PER_CPU_SYMBOL(cpu_core_map);
79 79
80/* bitmap of online cpus */ 80/* bitmap of online cpus */
81cpumask_t cpu_online_map __read_mostly; 81cpumask_t cpu_online_map __read_mostly;
@@ -300,7 +300,7 @@ cpumask_t cpu_coregroup_map(int cpu)
300 * And for power savings, we return cpu_core_map 300 * And for power savings, we return cpu_core_map
301 */ 301 */
302 if (sched_mc_power_savings || sched_smt_power_savings) 302 if (sched_mc_power_savings || sched_smt_power_savings)
303 return cpu_core_map[cpu]; 303 return per_cpu(cpu_core_map, cpu);
304 else 304 else
305 return c->llc_shared_map; 305 return c->llc_shared_map;
306} 306}
@@ -319,22 +319,22 @@ void __cpuinit set_cpu_sibling_map(int cpu)
319 for_each_cpu_mask(i, cpu_sibling_setup_map) { 319 for_each_cpu_mask(i, cpu_sibling_setup_map) {
320 if (c[cpu].phys_proc_id == c[i].phys_proc_id && 320 if (c[cpu].phys_proc_id == c[i].phys_proc_id &&
321 c[cpu].cpu_core_id == c[i].cpu_core_id) { 321 c[cpu].cpu_core_id == c[i].cpu_core_id) {
322 cpu_set(i, cpu_sibling_map[cpu]); 322 cpu_set(i, per_cpu(cpu_sibling_map, cpu));
323 cpu_set(cpu, cpu_sibling_map[i]); 323 cpu_set(cpu, per_cpu(cpu_sibling_map, i));
324 cpu_set(i, cpu_core_map[cpu]); 324 cpu_set(i, per_cpu(cpu_core_map, cpu));
325 cpu_set(cpu, cpu_core_map[i]); 325 cpu_set(cpu, per_cpu(cpu_core_map, i));
326 cpu_set(i, c[cpu].llc_shared_map); 326 cpu_set(i, c[cpu].llc_shared_map);
327 cpu_set(cpu, c[i].llc_shared_map); 327 cpu_set(cpu, c[i].llc_shared_map);
328 } 328 }
329 } 329 }
330 } else { 330 } else {
331 cpu_set(cpu, cpu_sibling_map[cpu]); 331 cpu_set(cpu, per_cpu(cpu_sibling_map, cpu));
332 } 332 }
333 333
334 cpu_set(cpu, c[cpu].llc_shared_map); 334 cpu_set(cpu, c[cpu].llc_shared_map);
335 335
336 if (current_cpu_data.x86_max_cores == 1) { 336 if (current_cpu_data.x86_max_cores == 1) {
337 cpu_core_map[cpu] = cpu_sibling_map[cpu]; 337 per_cpu(cpu_core_map, cpu) = per_cpu(cpu_sibling_map, cpu);
338 c[cpu].booted_cores = 1; 338 c[cpu].booted_cores = 1;
339 return; 339 return;
340 } 340 }
@@ -346,17 +346,17 @@ void __cpuinit set_cpu_sibling_map(int cpu)
346 cpu_set(cpu, c[i].llc_shared_map); 346 cpu_set(cpu, c[i].llc_shared_map);
347 } 347 }
348 if (c[cpu].phys_proc_id == c[i].phys_proc_id) { 348 if (c[cpu].phys_proc_id == c[i].phys_proc_id) {
349 cpu_set(i, cpu_core_map[cpu]); 349 cpu_set(i, per_cpu(cpu_core_map, cpu));
350 cpu_set(cpu, cpu_core_map[i]); 350 cpu_set(cpu, per_cpu(cpu_core_map, i));
351 /* 351 /*
352 * Does this new cpu bringup a new core? 352 * Does this new cpu bringup a new core?
353 */ 353 */
354 if (cpus_weight(cpu_sibling_map[cpu]) == 1) { 354 if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1) {
355 /* 355 /*
356 * for each core in package, increment 356 * for each core in package, increment
357 * the booted_cores for this new cpu 357 * the booted_cores for this new cpu
358 */ 358 */
359 if (first_cpu(cpu_sibling_map[i]) == i) 359 if (first_cpu(per_cpu(cpu_sibling_map, i)) == i)
360 c[cpu].booted_cores++; 360 c[cpu].booted_cores++;
361 /* 361 /*
362 * increment the core count for all 362 * increment the core count for all
@@ -983,8 +983,8 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
983 printk(KERN_NOTICE "Local APIC not detected." 983 printk(KERN_NOTICE "Local APIC not detected."
984 " Using dummy APIC emulation.\n"); 984 " Using dummy APIC emulation.\n");
985 map_cpu_to_logical_apicid(); 985 map_cpu_to_logical_apicid();
986 cpu_set(0, cpu_sibling_map[0]); 986 cpu_set(0, per_cpu(cpu_sibling_map, 0));
987 cpu_set(0, cpu_core_map[0]); 987 cpu_set(0, per_cpu(cpu_core_map, 0));
988 return; 988 return;
989 } 989 }
990 990
@@ -1008,8 +1008,8 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
1008 printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n"); 1008 printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n");
1009 smpboot_clear_io_apic_irqs(); 1009 smpboot_clear_io_apic_irqs();
1010 phys_cpu_present_map = physid_mask_of_physid(0); 1010 phys_cpu_present_map = physid_mask_of_physid(0);
1011 cpu_set(0, cpu_sibling_map[0]); 1011 cpu_set(0, per_cpu(cpu_sibling_map, 0));
1012 cpu_set(0, cpu_core_map[0]); 1012 cpu_set(0, per_cpu(cpu_core_map, 0));
1013 return; 1013 return;
1014 } 1014 }
1015 1015
@@ -1023,8 +1023,8 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
1023 printk(KERN_INFO "SMP mode deactivated, forcing use of dummy APIC emulation.\n"); 1023 printk(KERN_INFO "SMP mode deactivated, forcing use of dummy APIC emulation.\n");
1024 smpboot_clear_io_apic_irqs(); 1024 smpboot_clear_io_apic_irqs();
1025 phys_cpu_present_map = physid_mask_of_physid(0); 1025 phys_cpu_present_map = physid_mask_of_physid(0);
1026 cpu_set(0, cpu_sibling_map[0]); 1026 cpu_set(0, per_cpu(cpu_sibling_map, 0));
1027 cpu_set(0, cpu_core_map[0]); 1027 cpu_set(0, per_cpu(cpu_core_map, 0));
1028 return; 1028 return;
1029 } 1029 }
1030 1030
@@ -1102,16 +1102,16 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
1102 Dprintk("Boot done.\n"); 1102 Dprintk("Boot done.\n");
1103 1103
1104 /* 1104 /*
1105 * construct cpu_sibling_map[], so that we can tell sibling CPUs 1105 * construct cpu_sibling_map, so that we can tell sibling CPUs
1106 * efficiently. 1106 * efficiently.
1107 */ 1107 */
1108 for (cpu = 0; cpu < NR_CPUS; cpu++) { 1108 for (cpu = 0; cpu < NR_CPUS; cpu++) {
1109 cpus_clear(cpu_sibling_map[cpu]); 1109 cpus_clear(per_cpu(cpu_sibling_map, cpu));
1110 cpus_clear(cpu_core_map[cpu]); 1110 cpus_clear(per_cpu(cpu_core_map, cpu));
1111 } 1111 }
1112 1112
1113 cpu_set(0, cpu_sibling_map[0]); 1113 cpu_set(0, per_cpu(cpu_sibling_map, 0));
1114 cpu_set(0, cpu_core_map[0]); 1114 cpu_set(0, per_cpu(cpu_core_map, 0));
1115 1115
1116 smpboot_setup_io_apic(); 1116 smpboot_setup_io_apic();
1117 1117
@@ -1148,19 +1148,19 @@ void remove_siblinginfo(int cpu)
1148 int sibling; 1148 int sibling;
1149 struct cpuinfo_x86 *c = cpu_data; 1149 struct cpuinfo_x86 *c = cpu_data;
1150 1150
1151 for_each_cpu_mask(sibling, cpu_core_map[cpu]) { 1151 for_each_cpu_mask(sibling, per_cpu(cpu_core_map, cpu)) {
1152 cpu_clear(cpu, cpu_core_map[sibling]); 1152 cpu_clear(cpu, per_cpu(cpu_core_map, sibling));
1153 /* 1153 /*/
1154 * last thread sibling in this cpu core going down 1154 * last thread sibling in this cpu core going down
1155 */ 1155 */
1156 if (cpus_weight(cpu_sibling_map[cpu]) == 1) 1156 if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1)
1157 c[sibling].booted_cores--; 1157 c[sibling].booted_cores--;
1158 } 1158 }
1159 1159
1160 for_each_cpu_mask(sibling, cpu_sibling_map[cpu]) 1160 for_each_cpu_mask(sibling, per_cpu(cpu_sibling_map, cpu))
1161 cpu_clear(cpu, cpu_sibling_map[sibling]); 1161 cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling));
1162 cpus_clear(cpu_sibling_map[cpu]); 1162 cpus_clear(per_cpu(cpu_sibling_map, cpu));
1163 cpus_clear(cpu_core_map[cpu]); 1163 cpus_clear(per_cpu(cpu_core_map, cpu));
1164 c[cpu].phys_proc_id = 0; 1164 c[cpu].phys_proc_id = 0;
1165 c[cpu].cpu_core_id = 0; 1165 c[cpu].cpu_core_id = 0;
1166 cpu_clear(cpu, cpu_sibling_setup_map); 1166 cpu_clear(cpu, cpu_sibling_setup_map);
diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c
index 32f50783edc8..0faa0a0af272 100644
--- a/arch/x86/kernel/smpboot_64.c
+++ b/arch/x86/kernel/smpboot_64.c
@@ -91,12 +91,12 @@ EXPORT_SYMBOL(cpu_data);
91int smp_threads_ready; 91int smp_threads_ready;
92 92
93/* representing HT siblings of each logical CPU */ 93/* representing HT siblings of each logical CPU */
94cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly; 94DEFINE_PER_CPU(cpumask_t, cpu_sibling_map);
95EXPORT_SYMBOL(cpu_sibling_map); 95EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
96 96
97/* representing HT and core siblings of each logical CPU */ 97/* representing HT and core siblings of each logical CPU */
98cpumask_t cpu_core_map[NR_CPUS] __read_mostly; 98DEFINE_PER_CPU(cpumask_t, cpu_core_map);
99EXPORT_SYMBOL(cpu_core_map); 99EXPORT_PER_CPU_SYMBOL(cpu_core_map);
100 100
101/* 101/*
102 * Trampoline 80x86 program as an array. 102 * Trampoline 80x86 program as an array.
@@ -223,8 +223,6 @@ void __cpuinit smp_callin(void)
223 local_irq_disable(); 223 local_irq_disable();
224 Dprintk("Stack at about %p\n",&cpuid); 224 Dprintk("Stack at about %p\n",&cpuid);
225 225
226 disable_APIC_timer();
227
228 /* 226 /*
229 * Save our processor parameters 227 * Save our processor parameters
230 */ 228 */
@@ -245,7 +243,7 @@ cpumask_t cpu_coregroup_map(int cpu)
245 * And for power savings, we return cpu_core_map 243 * And for power savings, we return cpu_core_map
246 */ 244 */
247 if (sched_mc_power_savings || sched_smt_power_savings) 245 if (sched_mc_power_savings || sched_smt_power_savings)
248 return cpu_core_map[cpu]; 246 return per_cpu(cpu_core_map, cpu);
249 else 247 else
250 return c->llc_shared_map; 248 return c->llc_shared_map;
251} 249}
@@ -264,22 +262,22 @@ static inline void set_cpu_sibling_map(int cpu)
264 for_each_cpu_mask(i, cpu_sibling_setup_map) { 262 for_each_cpu_mask(i, cpu_sibling_setup_map) {
265 if (c[cpu].phys_proc_id == c[i].phys_proc_id && 263 if (c[cpu].phys_proc_id == c[i].phys_proc_id &&
266 c[cpu].cpu_core_id == c[i].cpu_core_id) { 264 c[cpu].cpu_core_id == c[i].cpu_core_id) {
267 cpu_set(i, cpu_sibling_map[cpu]); 265 cpu_set(i, per_cpu(cpu_sibling_map, cpu));
268 cpu_set(cpu, cpu_sibling_map[i]); 266 cpu_set(cpu, per_cpu(cpu_sibling_map, i));
269 cpu_set(i, cpu_core_map[cpu]); 267 cpu_set(i, per_cpu(cpu_core_map, cpu));
270 cpu_set(cpu, cpu_core_map[i]); 268 cpu_set(cpu, per_cpu(cpu_core_map, i));
271 cpu_set(i, c[cpu].llc_shared_map); 269 cpu_set(i, c[cpu].llc_shared_map);
272 cpu_set(cpu, c[i].llc_shared_map); 270 cpu_set(cpu, c[i].llc_shared_map);
273 } 271 }
274 } 272 }
275 } else { 273 } else {
276 cpu_set(cpu, cpu_sibling_map[cpu]); 274 cpu_set(cpu, per_cpu(cpu_sibling_map, cpu));
277 } 275 }
278 276
279 cpu_set(cpu, c[cpu].llc_shared_map); 277 cpu_set(cpu, c[cpu].llc_shared_map);
280 278
281 if (current_cpu_data.x86_max_cores == 1) { 279 if (current_cpu_data.x86_max_cores == 1) {
282 cpu_core_map[cpu] = cpu_sibling_map[cpu]; 280 per_cpu(cpu_core_map, cpu) = per_cpu(cpu_sibling_map, cpu);
283 c[cpu].booted_cores = 1; 281 c[cpu].booted_cores = 1;
284 return; 282 return;
285 } 283 }
@@ -291,17 +289,17 @@ static inline void set_cpu_sibling_map(int cpu)
291 cpu_set(cpu, c[i].llc_shared_map); 289 cpu_set(cpu, c[i].llc_shared_map);
292 } 290 }
293 if (c[cpu].phys_proc_id == c[i].phys_proc_id) { 291 if (c[cpu].phys_proc_id == c[i].phys_proc_id) {
294 cpu_set(i, cpu_core_map[cpu]); 292 cpu_set(i, per_cpu(cpu_core_map, cpu));
295 cpu_set(cpu, cpu_core_map[i]); 293 cpu_set(cpu, per_cpu(cpu_core_map, i));
296 /* 294 /*
297 * Does this new cpu bringup a new core? 295 * Does this new cpu bringup a new core?
298 */ 296 */
299 if (cpus_weight(cpu_sibling_map[cpu]) == 1) { 297 if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1) {
300 /* 298 /*
301 * for each core in package, increment 299 * for each core in package, increment
302 * the booted_cores for this new cpu 300 * the booted_cores for this new cpu
303 */ 301 */
304 if (first_cpu(cpu_sibling_map[i]) == i) 302 if (first_cpu(per_cpu(cpu_sibling_map, i)) == i)
305 c[cpu].booted_cores++; 303 c[cpu].booted_cores++;
306 /* 304 /*
307 * increment the core count for all 305 * increment the core count for all
@@ -337,19 +335,12 @@ void __cpuinit start_secondary(void)
337 */ 335 */
338 check_tsc_sync_target(); 336 check_tsc_sync_target();
339 337
340 Dprintk("cpu %d: setting up apic clock\n", smp_processor_id());
341 setup_secondary_APIC_clock();
342
343 Dprintk("cpu %d: enabling apic timer\n", smp_processor_id());
344
345 if (nmi_watchdog == NMI_IO_APIC) { 338 if (nmi_watchdog == NMI_IO_APIC) {
346 disable_8259A_irq(0); 339 disable_8259A_irq(0);
347 enable_NMI_through_LVT0(NULL); 340 enable_NMI_through_LVT0(NULL);
348 enable_8259A_irq(0); 341 enable_8259A_irq(0);
349 } 342 }
350 343
351 enable_APIC_timer();
352
353 /* 344 /*
354 * The sibling maps must be set before turing the online map on for 345 * The sibling maps must be set before turing the online map on for
355 * this cpu 346 * this cpu
@@ -378,6 +369,8 @@ void __cpuinit start_secondary(void)
378 369
379 unlock_ipi_call_lock(); 370 unlock_ipi_call_lock();
380 371
372 setup_secondary_APIC_clock();
373
381 cpu_idle(); 374 cpu_idle();
382} 375}
383 376
@@ -742,8 +735,8 @@ static __init void disable_smp(void)
742 phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id); 735 phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id);
743 else 736 else
744 phys_cpu_present_map = physid_mask_of_physid(0); 737 phys_cpu_present_map = physid_mask_of_physid(0);
745 cpu_set(0, cpu_sibling_map[0]); 738 cpu_set(0, per_cpu(cpu_sibling_map, 0));
746 cpu_set(0, cpu_core_map[0]); 739 cpu_set(0, per_cpu(cpu_core_map, 0));
747} 740}
748 741
749#ifdef CONFIG_HOTPLUG_CPU 742#ifdef CONFIG_HOTPLUG_CPU
@@ -978,19 +971,19 @@ static void remove_siblinginfo(int cpu)
978 int sibling; 971 int sibling;
979 struct cpuinfo_x86 *c = cpu_data; 972 struct cpuinfo_x86 *c = cpu_data;
980 973
981 for_each_cpu_mask(sibling, cpu_core_map[cpu]) { 974 for_each_cpu_mask(sibling, per_cpu(cpu_core_map, cpu)) {
982 cpu_clear(cpu, cpu_core_map[sibling]); 975 cpu_clear(cpu, per_cpu(cpu_core_map, sibling));
983 /* 976 /*
984 * last thread sibling in this cpu core going down 977 * last thread sibling in this cpu core going down
985 */ 978 */
986 if (cpus_weight(cpu_sibling_map[cpu]) == 1) 979 if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1)
987 c[sibling].booted_cores--; 980 c[sibling].booted_cores--;
988 } 981 }
989 982
990 for_each_cpu_mask(sibling, cpu_sibling_map[cpu]) 983 for_each_cpu_mask(sibling, per_cpu(cpu_sibling_map, cpu))
991 cpu_clear(cpu, cpu_sibling_map[sibling]); 984 cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling));
992 cpus_clear(cpu_sibling_map[cpu]); 985 cpus_clear(per_cpu(cpu_sibling_map, cpu));
993 cpus_clear(cpu_core_map[cpu]); 986 cpus_clear(per_cpu(cpu_core_map, cpu));
994 c[cpu].phys_proc_id = 0; 987 c[cpu].phys_proc_id = 0;
995 c[cpu].cpu_core_id = 0; 988 c[cpu].cpu_core_id = 0;
996 cpu_clear(cpu, cpu_sibling_setup_map); 989 cpu_clear(cpu, cpu_sibling_setup_map);
diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c
index cb9109113584..413e527cdeb9 100644
--- a/arch/x86/kernel/stacktrace.c
+++ b/arch/x86/kernel/stacktrace.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/x86_64/kernel/stacktrace.c
3 *
4 * Stack trace management functions 2 * Stack trace management functions
5 * 3 *
6 * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> 4 * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
diff --git a/arch/x86/kernel/summit_32.c b/arch/x86/kernel/summit_32.c
index d0e01a3acf35..91c7acc8d999 100644
--- a/arch/x86/kernel/summit_32.c
+++ b/arch/x86/kernel/summit_32.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/i386/kernel/summit.c - IBM Summit-Specific Code 2 * IBM Summit-Specific Code
3 * 3 *
4 * Written By: Matthew Dobson, IBM Corporation 4 * Written By: Matthew Dobson, IBM Corporation
5 * 5 *
diff --git a/arch/x86/kernel/sys_i386_32.c b/arch/x86/kernel/sys_i386_32.c
index 42147304de88..f8bae9ba0324 100644
--- a/arch/x86/kernel/sys_i386_32.c
+++ b/arch/x86/kernel/sys_i386_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/sys_i386.c
3 *
4 * This file contains various random system calls that 2 * This file contains various random system calls that
5 * have a non-standard calling sequence on the Linux/i386 3 * have a non-standard calling sequence on the Linux/i386
6 * platform. 4 * platform.
diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c
index 4770b7a2052c..907942ee6e76 100644
--- a/arch/x86/kernel/sys_x86_64.c
+++ b/arch/x86/kernel/sys_x86_64.c
@@ -1,7 +1,3 @@
1/*
2 * linux/arch/x86_64/kernel/sys_x86_64.c
3 */
4
5#include <linux/errno.h> 1#include <linux/errno.h>
6#include <linux/sched.h> 2#include <linux/sched.h>
7#include <linux/syscalls.h> 3#include <linux/syscalls.h>
diff --git a/arch/x86/kernel/sysenter_32.c b/arch/x86/kernel/sysenter_32.c
index 4eb2e408764f..5a2d951e2608 100644
--- a/arch/x86/kernel/sysenter_32.c
+++ b/arch/x86/kernel/sysenter_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/sysenter.c
3 *
4 * (C) Copyright 2002 Linus Torvalds 2 * (C) Copyright 2002 Linus Torvalds
5 * Portions based on the vdso-randomization code from exec-shield: 3 * Portions based on the vdso-randomization code from exec-shield:
6 * Copyright(C) 2005-2006, Red Hat, Inc., Ingo Molnar 4 * Copyright(C) 2005-2006, Red Hat, Inc., Ingo Molnar
diff --git a/arch/x86/kernel/time_32.c b/arch/x86/kernel/time_32.c
index 19a6c678d02e..8a322c96bc23 100644
--- a/arch/x86/kernel/time_32.c
+++ b/arch/x86/kernel/time_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/time.c
3 *
4 * Copyright (C) 1991, 1992, 1995 Linus Torvalds 2 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
5 * 3 *
6 * This file contains the PC-specific time handling details: 4 * This file contains the PC-specific time handling details:
@@ -157,6 +155,9 @@ EXPORT_SYMBOL(profile_pc);
157 */ 155 */
158irqreturn_t timer_interrupt(int irq, void *dev_id) 156irqreturn_t timer_interrupt(int irq, void *dev_id)
159{ 157{
158 /* Keep nmi watchdog up to date */
159 per_cpu(irq_stat, smp_processor_id()).irq0_irqs++;
160
160#ifdef CONFIG_X86_IO_APIC 161#ifdef CONFIG_X86_IO_APIC
161 if (timer_ack) { 162 if (timer_ack) {
162 /* 163 /*
diff --git a/arch/x86/kernel/time_64.c b/arch/x86/kernel/time_64.c
index 6d48a4e826d9..c821edc32216 100644
--- a/arch/x86/kernel/time_64.c
+++ b/arch/x86/kernel/time_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/x86-64/kernel/time.c
3 *
4 * "High Precision Event Timer" based timekeeping. 2 * "High Precision Event Timer" based timekeeping.
5 * 3 *
6 * Copyright (c) 1991,1992,1995 Linus Torvalds 4 * Copyright (c) 1991,1992,1995 Linus Torvalds
@@ -28,11 +26,12 @@
28#include <linux/cpu.h> 26#include <linux/cpu.h>
29#include <linux/kallsyms.h> 27#include <linux/kallsyms.h>
30#include <linux/acpi.h> 28#include <linux/acpi.h>
29#include <linux/clockchips.h>
30
31#ifdef CONFIG_ACPI 31#ifdef CONFIG_ACPI
32#include <acpi/achware.h> /* for PM timer frequency */ 32#include <acpi/achware.h> /* for PM timer frequency */
33#include <acpi/acpi_bus.h> 33#include <acpi/acpi_bus.h>
34#endif 34#endif
35#include <asm/8253pit.h>
36#include <asm/i8253.h> 35#include <asm/i8253.h>
37#include <asm/pgtable.h> 36#include <asm/pgtable.h>
38#include <asm/vsyscall.h> 37#include <asm/vsyscall.h>
@@ -47,12 +46,8 @@
47#include <asm/nmi.h> 46#include <asm/nmi.h>
48#include <asm/vgtod.h> 47#include <asm/vgtod.h>
49 48
50static char *timename = NULL;
51
52DEFINE_SPINLOCK(rtc_lock); 49DEFINE_SPINLOCK(rtc_lock);
53EXPORT_SYMBOL(rtc_lock); 50EXPORT_SYMBOL(rtc_lock);
54DEFINE_SPINLOCK(i8253_lock);
55EXPORT_SYMBOL(i8253_lock);
56 51
57volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES; 52volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES;
58 53
@@ -153,45 +148,12 @@ int update_persistent_clock(struct timespec now)
153 return set_rtc_mmss(now.tv_sec); 148 return set_rtc_mmss(now.tv_sec);
154} 149}
155 150
156void main_timer_handler(void) 151static irqreturn_t timer_event_interrupt(int irq, void *dev_id)
157{ 152{
158/* 153 add_pda(irq0_irqs, 1);
159 * Here we are in the timer irq handler. We have irqs locally disabled (so we
160 * don't need spin_lock_irqsave()) but we don't know if the timer_bh is running
161 * on the other CPU, so we need a lock. We also need to lock the vsyscall
162 * variables, because both do_timer() and us change them -arca+vojtech
163 */
164
165 write_seqlock(&xtime_lock);
166
167/*
168 * Do the timer stuff.
169 */
170 154
171 do_timer(1); 155 global_clock_event->event_handler(global_clock_event);
172#ifndef CONFIG_SMP
173 update_process_times(user_mode(get_irq_regs()));
174#endif
175
176/*
177 * In the SMP case we use the local APIC timer interrupt to do the profiling,
178 * except when we simulate SMP mode on a uniprocessor system, in that case we
179 * have to call the local interrupt handler.
180 */
181
182 if (!using_apic_timer)
183 smp_local_timer_interrupt();
184 156
185 write_sequnlock(&xtime_lock);
186}
187
188static irqreturn_t timer_interrupt(int irq, void *dev_id)
189{
190 if (apic_runs_main_timer > 1)
191 return IRQ_HANDLED;
192 main_timer_handler();
193 if (using_apic_timer)
194 smp_send_timer_broadcast_ipi();
195 return IRQ_HANDLED; 157 return IRQ_HANDLED;
196} 158}
197 159
@@ -292,97 +254,21 @@ static unsigned int __init tsc_calibrate_cpu_khz(void)
292 return pmc_now * tsc_khz / (tsc_now - tsc_start); 254 return pmc_now * tsc_khz / (tsc_now - tsc_start);
293} 255}
294 256
295/*
296 * pit_calibrate_tsc() uses the speaker output (channel 2) of
297 * the PIT. This is better than using the timer interrupt output,
298 * because we can read the value of the speaker with just one inb(),
299 * where we need three i/o operations for the interrupt channel.
300 * We count how many ticks the TSC does in 50 ms.
301 */
302
303static unsigned int __init pit_calibrate_tsc(void)
304{
305 unsigned long start, end;
306 unsigned long flags;
307
308 spin_lock_irqsave(&i8253_lock, flags);
309
310 outb((inb(0x61) & ~0x02) | 0x01, 0x61);
311
312 outb(0xb0, 0x43);
313 outb((PIT_TICK_RATE / (1000 / 50)) & 0xff, 0x42);
314 outb((PIT_TICK_RATE / (1000 / 50)) >> 8, 0x42);
315 start = get_cycles_sync();
316 while ((inb(0x61) & 0x20) == 0);
317 end = get_cycles_sync();
318
319 spin_unlock_irqrestore(&i8253_lock, flags);
320
321 return (end - start) / 50;
322}
323
324#define PIT_MODE 0x43
325#define PIT_CH0 0x40
326
327static void __pit_init(int val, u8 mode)
328{
329 unsigned long flags;
330
331 spin_lock_irqsave(&i8253_lock, flags);
332 outb_p(mode, PIT_MODE);
333 outb_p(val & 0xff, PIT_CH0); /* LSB */
334 outb_p(val >> 8, PIT_CH0); /* MSB */
335 spin_unlock_irqrestore(&i8253_lock, flags);
336}
337
338void __init pit_init(void)
339{
340 __pit_init(LATCH, 0x34); /* binary, mode 2, LSB/MSB, ch 0 */
341}
342
343void pit_stop_interrupt(void)
344{
345 __pit_init(0, 0x30); /* mode 0 */
346}
347
348void stop_timer_interrupt(void)
349{
350 char *name;
351 if (hpet_address) {
352 name = "HPET";
353 hpet_timer_stop_set_go(0);
354 } else {
355 name = "PIT";
356 pit_stop_interrupt();
357 }
358 printk(KERN_INFO "timer: %s interrupt stopped.\n", name);
359}
360
361static struct irqaction irq0 = { 257static struct irqaction irq0 = {
362 .handler = timer_interrupt, 258 .handler = timer_event_interrupt,
363 .flags = IRQF_DISABLED | IRQF_IRQPOLL, 259 .flags = IRQF_DISABLED | IRQF_IRQPOLL | IRQF_NOBALANCING,
364 .mask = CPU_MASK_NONE, 260 .mask = CPU_MASK_NONE,
365 .name = "timer" 261 .name = "timer"
366}; 262};
367 263
368void __init time_init(void) 264void __init time_init(void)
369{ 265{
370 if (nohpet) 266 if (!hpet_enable())
371 hpet_address = 0; 267 setup_pit_timer();
372 268
373 if (hpet_arch_init()) 269 setup_irq(0, &irq0);
374 hpet_address = 0;
375 270
376 if (hpet_use_timer) { 271 tsc_calibrate();
377 /* set tick_nsec to use the proper rate for HPET */
378 tick_nsec = TICK_NSEC_HPET;
379 tsc_khz = hpet_calibrate_tsc();
380 timename = "HPET";
381 } else {
382 pit_init();
383 tsc_khz = pit_calibrate_tsc();
384 timename = "PIT";
385 }
386 272
387 cpu_khz = tsc_khz; 273 cpu_khz = tsc_khz;
388 if (cpu_has(&boot_cpu_data, X86_FEATURE_CONSTANT_TSC) && 274 if (cpu_has(&boot_cpu_data, X86_FEATURE_CONSTANT_TSC) &&
@@ -398,50 +284,7 @@ void __init time_init(void)
398 else 284 else
399 vgetcpu_mode = VGETCPU_LSL; 285 vgetcpu_mode = VGETCPU_LSL;
400 286
401 set_cyc2ns_scale(tsc_khz);
402 printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n", 287 printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n",
403 cpu_khz / 1000, cpu_khz % 1000); 288 cpu_khz / 1000, cpu_khz % 1000);
404 init_tsc_clocksource(); 289 init_tsc_clocksource();
405
406 setup_irq(0, &irq0);
407}
408
409/*
410 * sysfs support for the timer.
411 */
412
413static int timer_suspend(struct sys_device *dev, pm_message_t state)
414{
415 return 0;
416}
417
418static int timer_resume(struct sys_device *dev)
419{
420 if (hpet_address)
421 hpet_reenable();
422 else
423 i8254_timer_resume();
424 return 0;
425} 290}
426
427static struct sysdev_class timer_sysclass = {
428 .resume = timer_resume,
429 .suspend = timer_suspend,
430 set_kset_name("timer"),
431};
432
433/* XXX this sysfs stuff should probably go elsewhere later -john */
434static struct sys_device device_timer = {
435 .id = 0,
436 .cls = &timer_sysclass,
437};
438
439static int time_init_device(void)
440{
441 int error = sysdev_class_register(&timer_sysclass);
442 if (!error)
443 error = sysdev_register(&device_timer);
444 return error;
445}
446
447device_initcall(time_init_device);
diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index 45782356a618..c25f23eb397c 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/i386/kernel/topology.c - Populate sysfs with topology information 2 * Populate sysfs with topology information
3 * 3 *
4 * Written by: Matthew Dobson, IBM Corporation 4 * Written by: Matthew Dobson, IBM Corporation
5 * Original Code: Paul Dorwin, IBM Corporation, Patrick Mochel, OSDL 5 * Original Code: Paul Dorwin, IBM Corporation, Patrick Mochel, OSDL
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index 47b0bef335bd..05c27ecaf2a7 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/traps.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds 2 * Copyright (C) 1991, 1992 Linus Torvalds
5 * 3 *
6 * Pentium III FXSR, SSE support 4 * Pentium III FXSR, SSE support
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index 03888420775d..bc7116acf8ff 100644
--- a/arch/x86/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/x86-64/traps.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds 2 * Copyright (C) 1991, 1992 Linus Torvalds
5 * Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs 3 * Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs
6 * 4 *
diff --git a/arch/x86/kernel/tsc_32.c b/arch/x86/kernel/tsc_32.c
index 3ed0ae8c918d..b85ad754f70e 100644
--- a/arch/x86/kernel/tsc_32.c
+++ b/arch/x86/kernel/tsc_32.c
@@ -1,9 +1,3 @@
1/*
2 * This code largely moved from arch/i386/kernel/timer/timer_tsc.c
3 * which was originally moved from arch/i386/kernel/time.c.
4 * See comments there for proper credits.
5 */
6
7#include <linux/sched.h> 1#include <linux/sched.h>
8#include <linux/clocksource.h> 2#include <linux/clocksource.h>
9#include <linux/workqueue.h> 3#include <linux/workqueue.h>
diff --git a/arch/x86/kernel/tsc_64.c b/arch/x86/kernel/tsc_64.c
index 2a59bde663f2..9f22e542c374 100644
--- a/arch/x86/kernel/tsc_64.c
+++ b/arch/x86/kernel/tsc_64.c
@@ -6,7 +6,9 @@
6#include <linux/time.h> 6#include <linux/time.h>
7#include <linux/acpi.h> 7#include <linux/acpi.h>
8#include <linux/cpufreq.h> 8#include <linux/cpufreq.h>
9#include <linux/acpi_pmtmr.h>
9 10
11#include <asm/hpet.h>
10#include <asm/timex.h> 12#include <asm/timex.h>
11 13
12static int notsc __initdata = 0; 14static int notsc __initdata = 0;
@@ -18,7 +20,7 @@ EXPORT_SYMBOL(tsc_khz);
18 20
19static unsigned int cyc2ns_scale __read_mostly; 21static unsigned int cyc2ns_scale __read_mostly;
20 22
21void set_cyc2ns_scale(unsigned long khz) 23static inline void set_cyc2ns_scale(unsigned long khz)
22{ 24{
23 cyc2ns_scale = (NSEC_PER_MSEC << NS_SCALE) / khz; 25 cyc2ns_scale = (NSEC_PER_MSEC << NS_SCALE) / khz;
24} 26}
@@ -118,6 +120,95 @@ core_initcall(cpufreq_tsc);
118 120
119#endif 121#endif
120 122
123#define MAX_RETRIES 5
124#define SMI_TRESHOLD 50000
125
126/*
127 * Read TSC and the reference counters. Take care of SMI disturbance
128 */
129static unsigned long __init tsc_read_refs(unsigned long *pm,
130 unsigned long *hpet)
131{
132 unsigned long t1, t2;
133 int i;
134
135 for (i = 0; i < MAX_RETRIES; i++) {
136 t1 = get_cycles_sync();
137 if (hpet)
138 *hpet = hpet_readl(HPET_COUNTER) & 0xFFFFFFFF;
139 else
140 *pm = acpi_pm_read_early();
141 t2 = get_cycles_sync();
142 if ((t2 - t1) < SMI_TRESHOLD)
143 return t2;
144 }
145 return ULONG_MAX;
146}
147
148/**
149 * tsc_calibrate - calibrate the tsc on boot
150 */
151void __init tsc_calibrate(void)
152{
153 unsigned long flags, tsc1, tsc2, tr1, tr2, pm1, pm2, hpet1, hpet2;
154 int hpet = is_hpet_enabled();
155
156 local_irq_save(flags);
157
158 tsc1 = tsc_read_refs(&pm1, hpet ? &hpet1 : NULL);
159
160 outb((inb(0x61) & ~0x02) | 0x01, 0x61);
161
162 outb(0xb0, 0x43);
163 outb((CLOCK_TICK_RATE / (1000 / 50)) & 0xff, 0x42);
164 outb((CLOCK_TICK_RATE / (1000 / 50)) >> 8, 0x42);
165 tr1 = get_cycles_sync();
166 while ((inb(0x61) & 0x20) == 0);
167 tr2 = get_cycles_sync();
168
169 tsc2 = tsc_read_refs(&pm2, hpet ? &hpet2 : NULL);
170
171 local_irq_restore(flags);
172
173 /*
174 * Preset the result with the raw and inaccurate PIT
175 * calibration value
176 */
177 tsc_khz = (tr2 - tr1) / 50;
178
179 /* hpet or pmtimer available ? */
180 if (!hpet && !pm1 && !pm2) {
181 printk(KERN_INFO "TSC calibrated against PIT\n");
182 return;
183 }
184
185 /* Check, whether the sampling was disturbed by an SMI */
186 if (tsc1 == ULONG_MAX || tsc2 == ULONG_MAX) {
187 printk(KERN_WARNING "TSC calibration disturbed by SMI, "
188 "using PIT calibration result\n");
189 return;
190 }
191
192 tsc2 = (tsc2 - tsc1) * 1000000L;
193
194 if (hpet) {
195 printk(KERN_INFO "TSC calibrated against HPET\n");
196 if (hpet2 < hpet1)
197 hpet2 += 0x100000000;
198 hpet2 -= hpet1;
199 tsc1 = (hpet2 * hpet_readl(HPET_PERIOD)) / 1000000;
200 } else {
201 printk(KERN_INFO "TSC calibrated against PM_TIMER\n");
202 if (pm2 < pm1)
203 pm2 += ACPI_PM_OVRRUN;
204 pm2 -= pm1;
205 tsc1 = (pm2 * 1000000000) / PMTMR_TICKS_PER_SEC;
206 }
207
208 tsc_khz = tsc2 / tsc1;
209 set_cyc2ns_scale(tsc_khz);
210}
211
121/* 212/*
122 * Make an educated guess if the TSC is trustworthy and synchronized 213 * Make an educated guess if the TSC is trustworthy and synchronized
123 * over all CPUs. 214 * over all CPUs.
diff --git a/arch/x86/kernel/tsc_sync.c b/arch/x86/kernel/tsc_sync.c
index 355f5f506c81..9125efe66a06 100644
--- a/arch/x86/kernel/tsc_sync.c
+++ b/arch/x86/kernel/tsc_sync.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/x86_64/kernel/tsc_sync.c: check TSC synchronization. 2 * check TSC synchronization.
3 * 3 *
4 * Copyright (C) 2006, Red Hat, Inc., Ingo Molnar 4 * Copyright (C) 2006, Red Hat, Inc., Ingo Molnar
5 * 5 *
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
index f2dcd1d27c0a..157e4bedd3c5 100644
--- a/arch/x86/kernel/vm86_32.c
+++ b/arch/x86/kernel/vm86_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/kernel/vm86.c
3 *
4 * Copyright (C) 1994 Linus Torvalds 2 * Copyright (C) 1994 Linus Torvalds
5 * 3 *
6 * 29 dec 2001 - Fixed oopses caused by unchecked access to the vm86 4 * 29 dec 2001 - Fixed oopses caused by unchecked access to the vm86
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index 06c34949bfdc..93847d848157 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/x86_64/kernel/vsyscall.c
3 *
4 * Copyright (C) 2001 Andrea Arcangeli <andrea@suse.de> SuSE 2 * Copyright (C) 2001 Andrea Arcangeli <andrea@suse.de> SuSE
5 * Copyright 2003 Andi Kleen, SuSE Labs. 3 * Copyright 2003 Andi Kleen, SuSE Labs.
6 * 4 *
diff --git a/arch/x86/lib/copy_user_nocache_64.S b/arch/x86/lib/copy_user_nocache_64.S
index 4620efb12f13..5196762b3b0e 100644
--- a/arch/x86/lib/copy_user_nocache_64.S
+++ b/arch/x86/lib/copy_user_nocache_64.S
@@ -117,6 +117,7 @@ ENTRY(__copy_user_nocache)
117 popq %rbx 117 popq %rbx
118 CFI_ADJUST_CFA_OFFSET -8 118 CFI_ADJUST_CFA_OFFSET -8
119 CFI_RESTORE rbx 119 CFI_RESTORE rbx
120 sfence
120 ret 121 ret
121 CFI_RESTORE_STATE 122 CFI_RESTORE_STATE
122 123
diff --git a/arch/x86/lib/thunk_64.S b/arch/x86/lib/thunk_64.S
index 55e586d352d3..6ea73f3de567 100644
--- a/arch/x86/lib/thunk_64.S
+++ b/arch/x86/lib/thunk_64.S
@@ -50,6 +50,10 @@
50 thunk trace_hardirqs_on_thunk,trace_hardirqs_on 50 thunk trace_hardirqs_on_thunk,trace_hardirqs_on
51 thunk trace_hardirqs_off_thunk,trace_hardirqs_off 51 thunk trace_hardirqs_off_thunk,trace_hardirqs_off
52#endif 52#endif
53
54#ifdef CONFIG_DEBUG_LOCK_ALLOC
55 thunk lockdep_sys_exit_thunk,lockdep_sys_exit
56#endif
53 57
54 /* SAVE_ARGS below is used only for the .cfi directives it contains. */ 58 /* SAVE_ARGS below is used only for the .cfi directives it contains. */
55 CFI_STARTPROC 59 CFI_STARTPROC
diff --git a/arch/x86/mm/fault_32.c b/arch/x86/mm/fault_32.c
index fcb38e7f3543..c686ae20fd6b 100644
--- a/arch/x86/mm/fault_32.c
+++ b/arch/x86/mm/fault_32.c
@@ -25,6 +25,7 @@
25#include <linux/kprobes.h> 25#include <linux/kprobes.h>
26#include <linux/uaccess.h> 26#include <linux/uaccess.h>
27#include <linux/kdebug.h> 27#include <linux/kdebug.h>
28#include <linux/kprobes.h>
28 29
29#include <asm/system.h> 30#include <asm/system.h>
30#include <asm/desc.h> 31#include <asm/desc.h>
@@ -32,33 +33,27 @@
32 33
33extern void die(const char *,struct pt_regs *,long); 34extern void die(const char *,struct pt_regs *,long);
34 35
35static ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); 36#ifdef CONFIG_KPROBES
36 37static inline int notify_page_fault(struct pt_regs *regs)
37int register_page_fault_notifier(struct notifier_block *nb)
38{ 38{
39 vmalloc_sync_all(); 39 int ret = 0;
40 return atomic_notifier_chain_register(&notify_page_fault_chain, nb); 40
41} 41 /* kprobe_running() needs smp_processor_id() */
42EXPORT_SYMBOL_GPL(register_page_fault_notifier); 42 if (!user_mode_vm(regs)) {
43 preempt_disable();
44 if (kprobe_running() && kprobe_fault_handler(regs, 14))
45 ret = 1;
46 preempt_enable();
47 }
43 48
44int unregister_page_fault_notifier(struct notifier_block *nb) 49 return ret;
45{
46 return atomic_notifier_chain_unregister(&notify_page_fault_chain, nb);
47} 50}
48EXPORT_SYMBOL_GPL(unregister_page_fault_notifier); 51#else
49 52static inline int notify_page_fault(struct pt_regs *regs)
50static inline int notify_page_fault(struct pt_regs *regs, long err)
51{ 53{
52 struct die_args args = { 54 return 0;
53 .regs = regs,
54 .str = "page fault",
55 .err = err,
56 .trapnr = 14,
57 .signr = SIGSEGV
58 };
59 return atomic_notifier_call_chain(&notify_page_fault_chain,
60 DIE_PAGE_FAULT, &args);
61} 55}
56#endif
62 57
63/* 58/*
64 * Return EIP plus the CS segment base. The segment limit is also 59 * Return EIP plus the CS segment base. The segment limit is also
@@ -331,7 +326,7 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs,
331 if (unlikely(address >= TASK_SIZE)) { 326 if (unlikely(address >= TASK_SIZE)) {
332 if (!(error_code & 0x0000000d) && vmalloc_fault(address) >= 0) 327 if (!(error_code & 0x0000000d) && vmalloc_fault(address) >= 0)
333 return; 328 return;
334 if (notify_page_fault(regs, error_code) == NOTIFY_STOP) 329 if (notify_page_fault(regs))
335 return; 330 return;
336 /* 331 /*
337 * Don't take the mm semaphore here. If we fixup a prefetch 332 * Don't take the mm semaphore here. If we fixup a prefetch
@@ -340,7 +335,7 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs,
340 goto bad_area_nosemaphore; 335 goto bad_area_nosemaphore;
341 } 336 }
342 337
343 if (notify_page_fault(regs, error_code) == NOTIFY_STOP) 338 if (notify_page_fault(regs))
344 return; 339 return;
345 340
346 /* It's safe to allow irq's after cr2 has been saved and the vmalloc 341 /* It's safe to allow irq's after cr2 has been saved and the vmalloc
@@ -598,7 +593,7 @@ out_of_memory:
598 } 593 }
599 printk("VM: killing process %s\n", tsk->comm); 594 printk("VM: killing process %s\n", tsk->comm);
600 if (error_code & 4) 595 if (error_code & 4)
601 do_exit(SIGKILL); 596 do_group_exit(SIGKILL);
602 goto no_context; 597 goto no_context;
603 598
604do_sigbus: 599do_sigbus:
diff --git a/arch/x86/mm/fault_64.c b/arch/x86/mm/fault_64.c
index 54816adb8e93..5e0e54906c48 100644
--- a/arch/x86/mm/fault_64.c
+++ b/arch/x86/mm/fault_64.c
@@ -25,6 +25,7 @@
25#include <linux/kprobes.h> 25#include <linux/kprobes.h>
26#include <linux/uaccess.h> 26#include <linux/uaccess.h>
27#include <linux/kdebug.h> 27#include <linux/kdebug.h>
28#include <linux/kprobes.h>
28 29
29#include <asm/system.h> 30#include <asm/system.h>
30#include <asm/pgalloc.h> 31#include <asm/pgalloc.h>
@@ -40,34 +41,27 @@
40#define PF_RSVD (1<<3) 41#define PF_RSVD (1<<3)
41#define PF_INSTR (1<<4) 42#define PF_INSTR (1<<4)
42 43
43static ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); 44#ifdef CONFIG_KPROBES
44 45static inline int notify_page_fault(struct pt_regs *regs)
45/* Hook to register for page fault notifications */
46int register_page_fault_notifier(struct notifier_block *nb)
47{ 46{
48 vmalloc_sync_all(); 47 int ret = 0;
49 return atomic_notifier_chain_register(&notify_page_fault_chain, nb); 48
50} 49 /* kprobe_running() needs smp_processor_id() */
51EXPORT_SYMBOL_GPL(register_page_fault_notifier); 50 if (!user_mode(regs)) {
51 preempt_disable();
52 if (kprobe_running() && kprobe_fault_handler(regs, 14))
53 ret = 1;
54 preempt_enable();
55 }
52 56
53int unregister_page_fault_notifier(struct notifier_block *nb) 57 return ret;
54{
55 return atomic_notifier_chain_unregister(&notify_page_fault_chain, nb);
56} 58}
57EXPORT_SYMBOL_GPL(unregister_page_fault_notifier); 59#else
58 60static inline int notify_page_fault(struct pt_regs *regs)
59static inline int notify_page_fault(struct pt_regs *regs, long err)
60{ 61{
61 struct die_args args = { 62 return 0;
62 .regs = regs,
63 .str = "page fault",
64 .err = err,
65 .trapnr = 14,
66 .signr = SIGSEGV
67 };
68 return atomic_notifier_call_chain(&notify_page_fault_chain,
69 DIE_PAGE_FAULT, &args);
70} 63}
64#endif
71 65
72/* Sometimes the CPU reports invalid exceptions on prefetch. 66/* Sometimes the CPU reports invalid exceptions on prefetch.
73 Check that here and ignore. 67 Check that here and ignore.
@@ -345,7 +339,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
345 if (vmalloc_fault(address) >= 0) 339 if (vmalloc_fault(address) >= 0)
346 return; 340 return;
347 } 341 }
348 if (notify_page_fault(regs, error_code) == NOTIFY_STOP) 342 if (notify_page_fault(regs))
349 return; 343 return;
350 /* 344 /*
351 * Don't take the mm semaphore here. If we fixup a prefetch 345 * Don't take the mm semaphore here. If we fixup a prefetch
@@ -354,7 +348,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
354 goto bad_area_nosemaphore; 348 goto bad_area_nosemaphore;
355 } 349 }
356 350
357 if (notify_page_fault(regs, error_code) == NOTIFY_STOP) 351 if (notify_page_fault(regs))
358 return; 352 return;
359 353
360 if (likely(regs->eflags & X86_EFLAGS_IF)) 354 if (likely(regs->eflags & X86_EFLAGS_IF))
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 730a5b177b1f..dda4e83649a0 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -735,11 +735,6 @@ int arch_add_memory(int nid, u64 start, u64 size)
735 return __add_pages(zone, start_pfn, nr_pages); 735 return __add_pages(zone, start_pfn, nr_pages);
736} 736}
737 737
738int remove_memory(u64 start, u64 size)
739{
740 return -EINVAL;
741}
742EXPORT_SYMBOL_GPL(remove_memory);
743#endif 738#endif
744 739
745struct kmem_cache *pmd_cache; 740struct kmem_cache *pmd_cache;
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 458893b376f8..1e3862e41065 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -474,12 +474,6 @@ error:
474} 474}
475EXPORT_SYMBOL_GPL(arch_add_memory); 475EXPORT_SYMBOL_GPL(arch_add_memory);
476 476
477int remove_memory(u64 start, u64 size)
478{
479 return -EINVAL;
480}
481EXPORT_SYMBOL_GPL(remove_memory);
482
483#if !defined(CONFIG_ACPI_NUMA) && defined(CONFIG_NUMA) 477#if !defined(CONFIG_ACPI_NUMA) && defined(CONFIG_NUMA)
484int memory_add_physaddr_to_nid(u64 start) 478int memory_add_physaddr_to_nid(u64 start)
485{ 479{
@@ -748,3 +742,48 @@ const char *arch_vma_name(struct vm_area_struct *vma)
748 return "[vsyscall]"; 742 return "[vsyscall]";
749 return NULL; 743 return NULL;
750} 744}
745
746#ifdef CONFIG_SPARSEMEM_VMEMMAP
747/*
748 * Initialise the sparsemem vmemmap using huge-pages at the PMD level.
749 */
750int __meminit vmemmap_populate(struct page *start_page,
751 unsigned long size, int node)
752{
753 unsigned long addr = (unsigned long)start_page;
754 unsigned long end = (unsigned long)(start_page + size);
755 unsigned long next;
756 pgd_t *pgd;
757 pud_t *pud;
758 pmd_t *pmd;
759
760 for (; addr < end; addr = next) {
761 next = pmd_addr_end(addr, end);
762
763 pgd = vmemmap_pgd_populate(addr, node);
764 if (!pgd)
765 return -ENOMEM;
766 pud = vmemmap_pud_populate(pgd, addr, node);
767 if (!pud)
768 return -ENOMEM;
769
770 pmd = pmd_offset(pud, addr);
771 if (pmd_none(*pmd)) {
772 pte_t entry;
773 void *p = vmemmap_alloc_block(PMD_SIZE, node);
774 if (!p)
775 return -ENOMEM;
776
777 entry = pfn_pte(__pa(p) >> PAGE_SHIFT, PAGE_KERNEL);
778 mk_pte_huge(entry);
779 set_pmd(pmd, __pmd(pte_val(entry)));
780
781 printk(KERN_DEBUG " [%lx-%lx] PMD ->%p on node %d\n",
782 addr, addr + PMD_SIZE - 1, p, node);
783 } else
784 vmemmap_verify((pte_t *)pmd, node, addr, next);
785 }
786
787 return 0;
788}
789#endif
diff --git a/arch/x86/oprofile/op_model_p4.c b/arch/x86/oprofile/op_model_p4.c
index 47925927b12f..56b4757a1f47 100644
--- a/arch/x86/oprofile/op_model_p4.c
+++ b/arch/x86/oprofile/op_model_p4.c
@@ -379,7 +379,7 @@ static unsigned int get_stagger(void)
379{ 379{
380#ifdef CONFIG_SMP 380#ifdef CONFIG_SMP
381 int cpu = smp_processor_id(); 381 int cpu = smp_processor_id();
382 return (cpu != first_cpu(cpu_sibling_map[cpu])); 382 return (cpu != first_cpu(per_cpu(cpu_sibling_map, cpu)));
383#endif 383#endif
384 return 0; 384 return 0;
385} 385}
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index bc8a44bddaa7..2d88f7c6d6ac 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -2,15 +2,199 @@
2#include <linux/acpi.h> 2#include <linux/acpi.h>
3#include <linux/init.h> 3#include <linux/init.h>
4#include <linux/irq.h> 4#include <linux/irq.h>
5#include <linux/dmi.h>
5#include <asm/numa.h> 6#include <asm/numa.h>
6#include "pci.h" 7#include "pci.h"
7 8
9static int __devinit can_skip_ioresource_align(const struct dmi_system_id *d)
10{
11 pci_probe |= PCI_CAN_SKIP_ISA_ALIGN;
12 printk(KERN_INFO "PCI: %s detected, can skip ISA alignment\n", d->ident);
13 return 0;
14}
15
16static struct dmi_system_id acpi_pciprobe_dmi_table[] = {
17/*
18 * Systems where PCI IO resource ISA alignment can be skipped
19 * when the ISA enable bit in the bridge control is not set
20 */
21 {
22 .callback = can_skip_ioresource_align,
23 .ident = "IBM System x3800",
24 .matches = {
25 DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
26 DMI_MATCH(DMI_PRODUCT_NAME, "x3800"),
27 },
28 },
29 {
30 .callback = can_skip_ioresource_align,
31 .ident = "IBM System x3850",
32 .matches = {
33 DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
34 DMI_MATCH(DMI_PRODUCT_NAME, "x3850"),
35 },
36 },
37 {
38 .callback = can_skip_ioresource_align,
39 .ident = "IBM System x3950",
40 .matches = {
41 DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
42 DMI_MATCH(DMI_PRODUCT_NAME, "x3950"),
43 },
44 },
45 {}
46};
47
48struct pci_root_info {
49 char *name;
50 unsigned int res_num;
51 struct resource *res;
52 struct pci_bus *bus;
53 int busnum;
54};
55
56static acpi_status
57resource_to_addr(struct acpi_resource *resource,
58 struct acpi_resource_address64 *addr)
59{
60 acpi_status status;
61
62 status = acpi_resource_to_address64(resource, addr);
63 if (ACPI_SUCCESS(status) &&
64 (addr->resource_type == ACPI_MEMORY_RANGE ||
65 addr->resource_type == ACPI_IO_RANGE) &&
66 addr->address_length > 0 &&
67 addr->producer_consumer == ACPI_PRODUCER) {
68 return AE_OK;
69 }
70 return AE_ERROR;
71}
72
73static acpi_status
74count_resource(struct acpi_resource *acpi_res, void *data)
75{
76 struct pci_root_info *info = data;
77 struct acpi_resource_address64 addr;
78 acpi_status status;
79
80 status = resource_to_addr(acpi_res, &addr);
81 if (ACPI_SUCCESS(status))
82 info->res_num++;
83 return AE_OK;
84}
85
86static acpi_status
87setup_resource(struct acpi_resource *acpi_res, void *data)
88{
89 struct pci_root_info *info = data;
90 struct resource *res;
91 struct acpi_resource_address64 addr;
92 acpi_status status;
93 unsigned long flags;
94 struct resource *root;
95
96 status = resource_to_addr(acpi_res, &addr);
97 if (!ACPI_SUCCESS(status))
98 return AE_OK;
99
100 if (addr.resource_type == ACPI_MEMORY_RANGE) {
101 root = &iomem_resource;
102 flags = IORESOURCE_MEM;
103 if (addr.info.mem.caching == ACPI_PREFETCHABLE_MEMORY)
104 flags |= IORESOURCE_PREFETCH;
105 } else if (addr.resource_type == ACPI_IO_RANGE) {
106 root = &ioport_resource;
107 flags = IORESOURCE_IO;
108 } else
109 return AE_OK;
110
111 res = &info->res[info->res_num];
112 res->name = info->name;
113 res->flags = flags;
114 res->start = addr.minimum + addr.translation_offset;
115 res->end = res->start + addr.address_length - 1;
116 res->child = NULL;
117
118 if (insert_resource(root, res)) {
119 printk(KERN_ERR "PCI: Failed to allocate 0x%lx-0x%lx "
120 "from %s for %s\n", (unsigned long) res->start,
121 (unsigned long) res->end, root->name, info->name);
122 } else {
123 info->bus->resource[info->res_num] = res;
124 info->res_num++;
125 }
126 return AE_OK;
127}
128
129static void
130adjust_transparent_bridge_resources(struct pci_bus *bus)
131{
132 struct pci_dev *dev;
133
134 list_for_each_entry(dev, &bus->devices, bus_list) {
135 int i;
136 u16 class = dev->class >> 8;
137
138 if (class == PCI_CLASS_BRIDGE_PCI && dev->transparent) {
139 for(i = 3; i < PCI_BUS_NUM_RESOURCES; i++)
140 dev->subordinate->resource[i] =
141 dev->bus->resource[i - 3];
142 }
143 }
144}
145
146static void
147get_current_resources(struct acpi_device *device, int busnum,
148 struct pci_bus *bus)
149{
150 struct pci_root_info info;
151 size_t size;
152
153 info.bus = bus;
154 info.res_num = 0;
155 acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_resource,
156 &info);
157 if (!info.res_num)
158 return;
159
160 size = sizeof(*info.res) * info.res_num;
161 info.res = kmalloc(size, GFP_KERNEL);
162 if (!info.res)
163 goto res_alloc_fail;
164
165 info.name = kmalloc(12, GFP_KERNEL);
166 if (!info.name)
167 goto name_alloc_fail;
168 sprintf(info.name, "PCI Bus #%02x", busnum);
169
170 info.res_num = 0;
171 acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource,
172 &info);
173 if (info.res_num)
174 adjust_transparent_bridge_resources(bus);
175
176 return;
177
178name_alloc_fail:
179 kfree(info.res);
180res_alloc_fail:
181 return;
182}
183
8struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int domain, int busnum) 184struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int domain, int busnum)
9{ 185{
10 struct pci_bus *bus; 186 struct pci_bus *bus;
11 struct pci_sysdata *sd; 187 struct pci_sysdata *sd;
12 int pxm; 188 int pxm;
13 189
190 dmi_check_system(acpi_pciprobe_dmi_table);
191
192 if (domain && !pci_domains_supported) {
193 printk(KERN_WARNING "PCI: Multiple domains not supported "
194 "(dom %d, bus %d)\n", domain, busnum);
195 return NULL;
196 }
197
14 /* Allocate per-root-bus (not per bus) arch-specific data. 198 /* Allocate per-root-bus (not per bus) arch-specific data.
15 * TODO: leak; this memory is never freed. 199 * TODO: leak; this memory is never freed.
16 * It's arguable whether it's worth the trouble to care. 200 * It's arguable whether it's worth the trouble to care.
@@ -21,12 +205,7 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
21 return NULL; 205 return NULL;
22 } 206 }
23 207
24 if (domain != 0) { 208 sd->domain = domain;
25 printk(KERN_WARNING "PCI: Multiple domains not supported\n");
26 kfree(sd);
27 return NULL;
28 }
29
30 sd->node = -1; 209 sd->node = -1;
31 210
32 pxm = acpi_get_pxm(device->handle); 211 pxm = acpi_get_pxm(device->handle);
@@ -47,6 +226,9 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
47 } 226 }
48 } 227 }
49#endif 228#endif
229
230 if (bus && (pci_probe & PCI_USE__CRS))
231 get_current_resources(device, busnum, bus);
50 232
51 return bus; 233 return bus;
52} 234}
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 07d5223442bf..2d71bbc411d2 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -29,12 +29,14 @@ struct pci_raw_ops *raw_pci_ops;
29 29
30static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) 30static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value)
31{ 31{
32 return raw_pci_ops->read(0, bus->number, devfn, where, size, value); 32 return raw_pci_ops->read(pci_domain_nr(bus), bus->number,
33 devfn, where, size, value);
33} 34}
34 35
35static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) 36static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value)
36{ 37{
37 return raw_pci_ops->write(0, bus->number, devfn, where, size, value); 38 return raw_pci_ops->write(pci_domain_nr(bus), bus->number,
39 devfn, where, size, value);
38} 40}
39 41
40struct pci_ops pci_root_ops = { 42struct pci_ops pci_root_ops = {
@@ -287,6 +289,16 @@ static struct dmi_system_id __devinitdata pciprobe_dmi_table[] = {
287 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL685c G1"), 289 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL685c G1"),
288 }, 290 },
289 }, 291 },
292#ifdef __i386__
293 {
294 .callback = assign_all_busses,
295 .ident = "Compaq EVO N800c",
296 .matches = {
297 DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
298 DMI_MATCH(DMI_PRODUCT_NAME, "EVO N800c"),
299 },
300 },
301#endif
290 {} 302 {}
291}; 303};
292 304
@@ -426,6 +438,9 @@ char * __devinit pcibios_setup(char *str)
426 } else if (!strcmp(str, "assign-busses")) { 438 } else if (!strcmp(str, "assign-busses")) {
427 pci_probe |= PCI_ASSIGN_ALL_BUSSES; 439 pci_probe |= PCI_ASSIGN_ALL_BUSSES;
428 return NULL; 440 return NULL;
441 } else if (!strcmp(str, "use_crs")) {
442 pci_probe |= PCI_USE__CRS;
443 return NULL;
429 } else if (!strcmp(str, "routeirq")) { 444 } else if (!strcmp(str, "routeirq")) {
430 pci_routeirq = 1; 445 pci_routeirq = 1;
431 return NULL; 446 return NULL;
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index c82cbf4c7226..6cff66dd0c91 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -353,6 +353,53 @@ static void __devinit pci_fixup_video(struct pci_dev *pdev)
353} 353}
354DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video); 354DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video);
355 355
356
357static struct dmi_system_id __devinitdata msi_k8t_dmi_table[] = {
358 {
359 .ident = "MSI-K8T-Neo2Fir",
360 .matches = {
361 DMI_MATCH(DMI_SYS_VENDOR, "MSI"),
362 DMI_MATCH(DMI_PRODUCT_NAME, "MS-6702E"),
363 },
364 },
365 {}
366};
367
368/*
369 * The AMD-Athlon64 board MSI "K8T Neo2-FIR" disables the onboard sound
370 * card if a PCI-soundcard is added.
371 *
372 * The BIOS only gives options "DISABLED" and "AUTO". This code sets
373 * the corresponding register-value to enable the soundcard.
374 *
375 * The soundcard is only enabled, if the mainborad is identified
376 * via DMI-tables and the soundcard is detected to be off.
377 */
378static void __devinit pci_fixup_msi_k8t_onboard_sound(struct pci_dev *dev)
379{
380 unsigned char val;
381 if (!dmi_check_system(msi_k8t_dmi_table))
382 return; /* only applies to MSI K8T Neo2-FIR */
383
384 pci_read_config_byte(dev, 0x50, &val);
385 if (val & 0x40) {
386 pci_write_config_byte(dev, 0x50, val & (~0x40));
387
388 /* verify the change for status output */
389 pci_read_config_byte(dev, 0x50, &val);
390 if (val & 0x40)
391 printk(KERN_INFO "PCI: Detected MSI K8T Neo2-FIR, "
392 "can't enable onboard soundcard!\n");
393 else
394 printk(KERN_INFO "PCI: Detected MSI K8T Neo2-FIR, "
395 "enabled onboard soundcard.\n");
396 }
397}
398DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237,
399 pci_fixup_msi_k8t_onboard_sound);
400DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237,
401 pci_fixup_msi_k8t_onboard_sound);
402
356/* 403/*
357 * Some Toshiba laptops need extra code to enable their TI TSB43AB22/A. 404 * Some Toshiba laptops need extra code to enable their TI TSB43AB22/A.
358 * 405 *
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index bcd2f94b732c..42ba0e2da1a0 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -33,6 +33,15 @@
33 33
34#include "pci.h" 34#include "pci.h"
35 35
36static int
37skip_isa_ioresource_align(struct pci_dev *dev) {
38
39 if ((pci_probe & PCI_CAN_SKIP_ISA_ALIGN) &&
40 !(dev->bus->bridge_ctl & PCI_BRIDGE_CTL_ISA))
41 return 1;
42 return 0;
43}
44
36/* 45/*
37 * We need to avoid collisions with `mirrored' VGA ports 46 * We need to avoid collisions with `mirrored' VGA ports
38 * and other strange ISA hardware, so we always want the 47 * and other strange ISA hardware, so we always want the
@@ -50,9 +59,13 @@ void
50pcibios_align_resource(void *data, struct resource *res, 59pcibios_align_resource(void *data, struct resource *res,
51 resource_size_t size, resource_size_t align) 60 resource_size_t size, resource_size_t align)
52{ 61{
62 struct pci_dev *dev = data;
63
53 if (res->flags & IORESOURCE_IO) { 64 if (res->flags & IORESOURCE_IO) {
54 resource_size_t start = res->start; 65 resource_size_t start = res->start;
55 66
67 if (skip_isa_ioresource_align(dev))
68 return;
56 if (start & 0x300) { 69 if (start & 0x300) {
57 start = (start + 0x3ff) & ~0x3ff; 70 start = (start + 0x3ff) & ~0x3ff;
58 res->start = start; 71 res->start = start;
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index d98c6b096f8e..c52150fdf82b 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -492,6 +492,26 @@ static int pirq_amd756_set(struct pci_dev *router, struct pci_dev *dev, int pirq
492 return 1; 492 return 1;
493} 493}
494 494
495/*
496 * PicoPower PT86C523
497 */
498static int pirq_pico_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
499{
500 outb(0x10 + ((pirq - 1) >> 1), 0x24);
501 return ((pirq - 1) & 1) ? (inb(0x26) >> 4) : (inb(0x26) & 0xf);
502}
503
504static int pirq_pico_set(struct pci_dev *router, struct pci_dev *dev, int pirq,
505 int irq)
506{
507 unsigned int x;
508 outb(0x10 + ((pirq - 1) >> 1), 0x24);
509 x = inb(0x26);
510 x = ((pirq - 1) & 1) ? ((x & 0x0f) | (irq << 4)) : ((x & 0xf0) | (irq));
511 outb(x, 0x26);
512 return 1;
513}
514
495#ifdef CONFIG_PCI_BIOS 515#ifdef CONFIG_PCI_BIOS
496 516
497static int pirq_bios_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) 517static int pirq_bios_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
@@ -721,6 +741,24 @@ static __init int amd_router_probe(struct irq_router *r, struct pci_dev *router,
721 return 1; 741 return 1;
722} 742}
723 743
744static __init int pico_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
745{
746 switch (device) {
747 case PCI_DEVICE_ID_PICOPOWER_PT86C523:
748 r->name = "PicoPower PT86C523";
749 r->get = pirq_pico_get;
750 r->set = pirq_pico_set;
751 return 1;
752
753 case PCI_DEVICE_ID_PICOPOWER_PT86C523BBP:
754 r->name = "PicoPower PT86C523 rev. BB+";
755 r->get = pirq_pico_get;
756 r->set = pirq_pico_set;
757 return 1;
758 }
759 return 0;
760}
761
724static __initdata struct irq_router_handler pirq_routers[] = { 762static __initdata struct irq_router_handler pirq_routers[] = {
725 { PCI_VENDOR_ID_INTEL, intel_router_probe }, 763 { PCI_VENDOR_ID_INTEL, intel_router_probe },
726 { PCI_VENDOR_ID_AL, ali_router_probe }, 764 { PCI_VENDOR_ID_AL, ali_router_probe },
@@ -732,6 +770,7 @@ static __initdata struct irq_router_handler pirq_routers[] = {
732 { PCI_VENDOR_ID_VLSI, vlsi_router_probe }, 770 { PCI_VENDOR_ID_VLSI, vlsi_router_probe },
733 { PCI_VENDOR_ID_SERVERWORKS, serverworks_router_probe }, 771 { PCI_VENDOR_ID_SERVERWORKS, serverworks_router_probe },
734 { PCI_VENDOR_ID_AMD, amd_router_probe }, 772 { PCI_VENDOR_ID_AMD, amd_router_probe },
773 { PCI_VENDOR_ID_PICOPOWER, pico_router_probe },
735 /* Someone with docs needs to add the ATI Radeon IGP */ 774 /* Someone with docs needs to add the ATI Radeon IGP */
736 { 0, NULL } 775 { 0, NULL }
737}; 776};
diff --git a/arch/x86/pci/pci.h b/arch/x86/pci/pci.h
index 8c66f275756f..ac56d3916c50 100644
--- a/arch/x86/pci/pci.h
+++ b/arch/x86/pci/pci.h
@@ -26,6 +26,8 @@
26#define PCI_ASSIGN_ROMS 0x1000 26#define PCI_ASSIGN_ROMS 0x1000
27#define PCI_BIOS_IRQ_SCAN 0x2000 27#define PCI_BIOS_IRQ_SCAN 0x2000
28#define PCI_ASSIGN_ALL_BUSSES 0x4000 28#define PCI_ASSIGN_ALL_BUSSES 0x4000
29#define PCI_CAN_SKIP_ISA_ALIGN 0x8000
30#define PCI_USE__CRS 0x10000
29 31
30extern unsigned int pci_probe; 32extern unsigned int pci_probe;
31extern unsigned long pirq_table_addr; 33extern unsigned long pirq_table_addr;
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 557b8e24706a..4fa33c27ccb6 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -147,8 +147,13 @@ void __init xen_smp_prepare_boot_cpu(void)
147 make_lowmem_page_readwrite(&per_cpu__gdt_page); 147 make_lowmem_page_readwrite(&per_cpu__gdt_page);
148 148
149 for (cpu = 0; cpu < NR_CPUS; cpu++) { 149 for (cpu = 0; cpu < NR_CPUS; cpu++) {
150 cpus_clear(cpu_sibling_map[cpu]); 150 cpus_clear(per_cpu(cpu_sibling_map, cpu));
151 cpus_clear(cpu_core_map[cpu]); 151 /*
152 * cpu_core_map lives in a per cpu area that is cleared
153 * when the per cpu array is allocated.
154 *
155 * cpus_clear(per_cpu(cpu_core_map, cpu));
156 */
152 } 157 }
153 158
154 xen_setup_vcpu_info_placement(); 159 xen_setup_vcpu_info_placement();
@@ -159,8 +164,13 @@ void __init xen_smp_prepare_cpus(unsigned int max_cpus)
159 unsigned cpu; 164 unsigned cpu;
160 165
161 for (cpu = 0; cpu < NR_CPUS; cpu++) { 166 for (cpu = 0; cpu < NR_CPUS; cpu++) {
162 cpus_clear(cpu_sibling_map[cpu]); 167 cpus_clear(per_cpu(cpu_sibling_map, cpu));
163 cpus_clear(cpu_core_map[cpu]); 168 /*
169 * cpu_core_ map will be zeroed when the per
170 * cpu area is allocated.
171 *
172 * cpus_clear(per_cpu(cpu_core_map, cpu));
173 */
164 } 174 }
165 175
166 smp_store_cpu_info(0); 176 smp_store_cpu_info(0);
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index b1b98e614f7c..8c83dbe4c4d0 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -36,6 +36,18 @@ config GENERIC_CMOS_UPDATE
36 bool 36 bool
37 default y 37 default y
38 38
39config CLOCKSOURCE_WATCHDOG
40 bool
41 default y
42
43config GENERIC_CLOCKEVENTS
44 bool
45 default y
46
47config GENERIC_CLOCKEVENTS_BROADCAST
48 bool
49 default y
50
39config ZONE_DMA32 51config ZONE_DMA32
40 bool 52 bool
41 default y 53 default y
@@ -130,6 +142,8 @@ source "init/Kconfig"
130 142
131menu "Processor type and features" 143menu "Processor type and features"
132 144
145source "kernel/time/Kconfig"
146
133choice 147choice
134 prompt "Subarchitecture Type" 148 prompt "Subarchitecture Type"
135 default X86_PC 149 default X86_PC
@@ -395,6 +409,7 @@ config ARCH_DISCONTIGMEM_DEFAULT
395config ARCH_SPARSEMEM_ENABLE 409config ARCH_SPARSEMEM_ENABLE
396 def_bool y 410 def_bool y
397 depends on (NUMA || EXPERIMENTAL) 411 depends on (NUMA || EXPERIMENTAL)
412 select SPARSEMEM_VMEMMAP_ENABLE
398 413
399config ARCH_MEMORY_PROBE 414config ARCH_MEMORY_PROBE
400 def_bool y 415 def_bool y
@@ -724,6 +739,11 @@ config PCI_MMCONFIG
724 bool "Support mmconfig PCI config space access" 739 bool "Support mmconfig PCI config space access"
725 depends on PCI && ACPI 740 depends on PCI && ACPI
726 741
742config PCI_DOMAINS
743 bool
744 depends on PCI
745 default y
746
727source "drivers/pci/pcie/Kconfig" 747source "drivers/pci/pcie/Kconfig"
728 748
729source "drivers/pci/Kconfig" 749source "drivers/pci/Kconfig"
diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c
index 06a13d9b69db..5533c7850d53 100644
--- a/arch/xtensa/kernel/ptrace.c
+++ b/arch/xtensa/kernel/ptrace.c
@@ -304,10 +304,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
304 ret = put_user(sizeof(elf_fpregset_t), (unsigned long *) data); 304 ret = put_user(sizeof(elf_fpregset_t), (unsigned long *) data);
305 break; 305 break;
306 306
307 case PTRACE_DETACH: /* detach a process that was attached. */
308 ret = ptrace_detach(child, data);
309 break;
310
311 default: 307 default:
312 ret = ptrace_request(child, request, addr, data); 308 ret = ptrace_request(child, request, addr, data);
313 goto out; 309 goto out;
diff --git a/arch/xtensa/mm/fault.c b/arch/xtensa/mm/fault.c
index 45d28f217c03..2f842859948f 100644
--- a/arch/xtensa/mm/fault.c
+++ b/arch/xtensa/mm/fault.c
@@ -152,7 +152,7 @@ out_of_memory:
152 } 152 }
153 printk("VM: killing process %s\n", current->comm); 153 printk("VM: killing process %s\n", current->comm);
154 if (user_mode(regs)) 154 if (user_mode(regs))
155 do_exit(SIGKILL); 155 do_group_exit(SIGKILL);
156 bad_page_fault(regs, address, SIGKILL); 156 bad_page_fault(regs, address, SIGKILL);
157 return; 157 return;
158 158